From: Andrea Amorese Date: Tue, 25 Jan 2022 16:59:25 +0000 (+0100) Subject: Built motion from commit fbacb665.|2.5.44 X-Git-Url: http://repos.xcallymotion.com/base//%22?a=commitdiff_plain;h=c2f29e8c4ace586ff44f210cd0cbc4e22d60a458;p=motion2.git Built motion from commit fbacb665.|2.5.44 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 31ce595..f8d3b6b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-25T16:35:33.398Z", + "time": "2022-01-25T16:50:09.020Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 5e74143..940ae97 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-25T16:35:33.398Z", + "time": "2022-01-25T16:50:09.020Z", "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 0b13a8d..db5febb 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 _0x2f92=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x1ddc97,_0x32dd52){var _0x525ca2=function(_0x460dad){while(--_0x460dad){_0x1ddc97['push'](_0x1ddc97['shift']());}};_0x525ca2(++_0x32dd52);}(_0x2f92,0xe2));var _0x22f9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x2f92[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x22f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x22f9('0x1')],'get':function(_0x3f87a){return this['getDataValue'](_0x22f9('0x2'));}},'action':{'type':Sequelize[_0x22f9('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x22f9('0x4'),_0x22f9('0x5'),_0x22f9('0x6'),_0x22f9('0x7'),'urlForward',_0x22f9('0x8'),_0x22f9('0x9'),_0x22f9('0xa')]],'msg':_0x22f9('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comment':_0x22f9('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x22f9('0xd')},'data3':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comments':_0x22f9('0xe')},'data6':{'type':Sequelize[_0x22f9('0x3')],'comments':_0x22f9('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x22f9('0x10')}}; \ No newline at end of file +var _0x98ba=['urlForward[body]','sequelize','exports','VIRTUAL','action','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x98ba,0x141));var _0xa98b=function(_0x30ebc5,_0x1d6f6a){_0x30ebc5=_0x30ebc5-0x0;var _0xfbe79a=_0x98ba[_0x30ebc5];return _0xfbe79a;};'use strict';var Sequelize=require(_0xa98b('0x0'));module[_0xa98b('0x1')]={'name':{'type':Sequelize[_0xa98b('0x2')],'get':function(_0x11aa08){return this['getDataValue'](_0xa98b('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xa98b('0x4'),_0xa98b('0x5'),_0xa98b('0x6'),_0xa98b('0x7'),_0xa98b('0x8'),'browser',_0xa98b('0x9'),_0xa98b('0xa')]],'msg':_0xa98b('0xb')}},'comment':_0xa98b('0xb')},'data1':{'type':Sequelize[_0xa98b('0xc')](0x1000),'comment':_0xa98b('0xd')},'data2':{'type':Sequelize[_0xa98b('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xa98b('0xc')](0x1000),'comment':_0xa98b('0xe')},'data4':{'type':Sequelize[_0xa98b('0xc')](0x1000),'comments':_0xa98b('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xa98b('0x10')},'data6':{'type':Sequelize[_0xa98b('0xc')],'comments':_0xa98b('0x11')},'data7':{'type':Sequelize[_0xa98b('0x12')],'comments':_0xa98b('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a381441..2aaf26d 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 _0x5911=['undefined','count','set','reject','save','update','then','error','stack','name','send','Action','find','params','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x470453,_0x905ca6){var _0x46257d=function(_0x1eeb02){while(--_0x1eeb02){_0x470453['push'](_0x470453['shift']());}};_0x46257d(++_0x905ca6);}(_0x5911,0x1e9));var _0x1591=function(_0x3b47bd,_0x122d99){_0x3b47bd=_0x3b47bd-0x0;var _0x1032d9=_0x5911[_0x3b47bd];return _0x1032d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1591('0x0'));var zipdir=require(_0x1591('0x1'));var jsonpatch=require(_0x1591('0x2'));var rp=require('request-promise');var moment=require(_0x1591('0x3'));var BPromise=require(_0x1591('0x4'));var Mustache=require(_0x1591('0x5'));var util=require('util');var path=require(_0x1591('0x6'));var sox=require(_0x1591('0x7'));var csv=require('to-csv');var ejs=require(_0x1591('0x8'));var fs=require('fs');var fs_extra=require(_0x1591('0x9'));var _=require(_0x1591('0xa'));var squel=require(_0x1591('0xb'));var crypto=require('crypto');var jsforce=require(_0x1591('0xc'));var deskjs=require(_0x1591('0xd'));var toCsv=require(_0x1591('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1591('0xf'));var qs=require(_0x1591('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1591('0x11'));var logger=require(_0x1591('0x12'))(_0x1591('0x13'));var utils=require(_0x1591('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1591('0x15'))['db'];function respondWithStatusCode(_0x20568a,_0x271c71){_0x271c71=_0x271c71||0xcc;return function(_0x4e2a13){if(_0x4e2a13){return _0x20568a[_0x1591('0x16')](_0x271c71);}return _0x20568a[_0x1591('0x17')](_0x271c71)[_0x1591('0x18')]();};}function respondWithResult(_0x3ea316,_0x326830){_0x326830=_0x326830||0xc8;return function(_0x4ab7da){if(_0x4ab7da){return _0x3ea316['status'](_0x326830)['json'](_0x4ab7da);}};}function respondWithFilteredResult(_0x2661c2,_0x3557f3){return function(_0x15c5ec){if(_0x15c5ec){var _0xb9a4ac=typeof _0x3557f3[_0x1591('0x19')]==='undefined'&&typeof _0x3557f3[_0x1591('0x1a')]===_0x1591('0x1b');var _0x107ad9=_0x15c5ec['count'];var _0x2ff3df=_0xb9a4ac?0x0:_0x3557f3[_0x1591('0x19')];var _0x320073=_0xb9a4ac?_0x15c5ec[_0x1591('0x1c')]:_0x3557f3[_0x1591('0x19')]+_0x3557f3[_0x1591('0x1a')];var _0xb80b09;if(_0x320073>=_0x107ad9){_0x320073=_0x107ad9;_0xb80b09=0xc8;}else{_0xb80b09=0xce;}_0x2661c2[_0x1591('0x17')](_0xb80b09);return _0x2661c2[_0x1591('0x1d')]('Content-Range',_0x2ff3df+'-'+_0x320073+'/'+_0x107ad9)['json'](_0x15c5ec);}return null;};}function patchUpdates(_0x215945){return function(_0x1c2a17){try{jsonpatch['apply'](_0x1c2a17,_0x215945,!![]);}catch(_0x1839cb){return BPromise[_0x1591('0x1e')](_0x1839cb);}return _0x1c2a17[_0x1591('0x1f')]();};}function saveUpdates(_0x5f2244,_0x48100c){return function(_0x23a1ba){if(_0x23a1ba){return _0x23a1ba[_0x1591('0x20')](_0x5f2244)[_0x1591('0x21')](function(_0x309192){return _0x309192;});}return null;};}function removeEntity(_0x1190a8,_0x57486a){return function(_0x2ecfff){if(_0x2ecfff){return _0x2ecfff['destroy']()[_0x1591('0x21')](function(){_0x1190a8[_0x1591('0x17')](0xcc)[_0x1591('0x18')]();});}};}function handleEntityNotFound(_0x23d1dc,_0xc7ac7e){return function(_0x40d191){if(!_0x40d191){_0x23d1dc[_0x1591('0x16')](0x194);}return _0x40d191;};}function handleError(_0x57599d,_0x494c87){_0x494c87=_0x494c87||0x1f4;return function(_0x2b4509){logger[_0x1591('0x22')](_0x2b4509[_0x1591('0x23')]);if(_0x2b4509['name']){delete _0x2b4509[_0x1591('0x24')];}_0x57599d[_0x1591('0x17')](_0x494c87)[_0x1591('0x25')](_0x2b4509);};}exports[_0x1591('0x20')]=function(_0x174e28,_0x141469){if(_0x174e28['body']['id']){delete _0x174e28['body']['id'];}return db[_0x1591('0x26')][_0x1591('0x27')]({'where':{'id':_0x174e28[_0x1591('0x28')]['id']}})[_0x1591('0x21')](handleEntityNotFound(_0x141469,null))['then'](saveUpdates(_0x174e28[_0x1591('0x29')],null))[_0x1591('0x21')](respondWithResult(_0x141469,null))['catch'](handleError(_0x141469,null));};exports['destroy']=function(_0x3e1ab9,_0x8256ec){return db['Action']['find']({'where':{'id':_0x3e1ab9[_0x1591('0x28')]['id']}})[_0x1591('0x21')](handleEntityNotFound(_0x8256ec,null))[_0x1591('0x21')](removeEntity(_0x8256ec,null))[_0x1591('0x2a')](handleError(_0x8256ec,null));}; \ No newline at end of file +var _0xc7ac=['crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','end','error','stack','name','send','update','body','find','params','destroy','Action','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xc7ac,0xa7));var _0xcc7a=function(_0x44e9d8,_0x13c3cd){_0x44e9d8=_0x44e9d8-0x0;var _0x32a396=_0xc7ac[_0x44e9d8];return _0x32a396;};'use strict';var emlformat=require(_0xcc7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc7a('0x1'));var jsonpatch=require(_0xcc7a('0x2'));var rp=require('request-promise');var moment=require(_0xcc7a('0x3'));var BPromise=require(_0xcc7a('0x4'));var Mustache=require(_0xcc7a('0x5'));var util=require(_0xcc7a('0x6'));var path=require(_0xcc7a('0x7'));var sox=require(_0xcc7a('0x8'));var csv=require(_0xcc7a('0x9'));var ejs=require(_0xcc7a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc7a('0xb'));var squel=require(_0xcc7a('0xc'));var crypto=require(_0xcc7a('0xd'));var jsforce=require(_0xcc7a('0xe'));var deskjs=require(_0xcc7a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcc7a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcc7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc7a('0x12'));var logger=require(_0xcc7a('0x13'))(_0xcc7a('0x14'));var utils=require('../../config/utils');var config=require(_0xcc7a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c314,_0x270277){_0x270277=_0x270277||0xcc;return function(_0x419ddb){if(_0x419ddb){return _0x30c314[_0xcc7a('0x16')](_0x270277);}return _0x30c314[_0xcc7a('0x17')](_0x270277)['end']();};}function respondWithResult(_0x5f9ee2,_0x417f18){_0x417f18=_0x417f18||0xc8;return function(_0xc7e275){if(_0xc7e275){return _0x5f9ee2[_0xcc7a('0x17')](_0x417f18)[_0xcc7a('0x18')](_0xc7e275);}};}function respondWithFilteredResult(_0x17e63d,_0x145710){return function(_0x6fab84){if(_0x6fab84){var _0x480e4f=typeof _0x145710[_0xcc7a('0x19')]===_0xcc7a('0x1a')&&typeof _0x145710[_0xcc7a('0x1b')]===_0xcc7a('0x1a');var _0x1d09ca=_0x6fab84[_0xcc7a('0x1c')];var _0x19eff8=_0x480e4f?0x0:_0x145710['offset'];var _0x41b956=_0x480e4f?_0x6fab84[_0xcc7a('0x1c')]:_0x145710[_0xcc7a('0x19')]+_0x145710['limit'];var _0x5d5573;if(_0x41b956>=_0x1d09ca){_0x41b956=_0x1d09ca;_0x5d5573=0xc8;}else{_0x5d5573=0xce;}_0x17e63d[_0xcc7a('0x17')](_0x5d5573);return _0x17e63d['set'](_0xcc7a('0x1d'),_0x19eff8+'-'+_0x41b956+'/'+_0x1d09ca)['json'](_0x6fab84);}return null;};}function patchUpdates(_0x549c69){return function(_0x22110a){try{jsonpatch['apply'](_0x22110a,_0x549c69,!![]);}catch(_0x418901){return BPromise[_0xcc7a('0x1e')](_0x418901);}return _0x22110a[_0xcc7a('0x1f')]();};}function saveUpdates(_0x280652,_0x58aec3){return function(_0x17fb49){if(_0x17fb49){return _0x17fb49['update'](_0x280652)['then'](function(_0x5e3ac2){return _0x5e3ac2;});}return null;};}function removeEntity(_0x38cb60,_0x9e7e2b){return function(_0x4be289){if(_0x4be289){return _0x4be289['destroy']()[_0xcc7a('0x20')](function(){_0x38cb60[_0xcc7a('0x17')](0xcc)[_0xcc7a('0x21')]();});}};}function handleEntityNotFound(_0x470438,_0x43c148){return function(_0xe4fa73){if(!_0xe4fa73){_0x470438[_0xcc7a('0x16')](0x194);}return _0xe4fa73;};}function handleError(_0x2b0c9f,_0x3c25bd){_0x3c25bd=_0x3c25bd||0x1f4;return function(_0x30270a){logger[_0xcc7a('0x22')](_0x30270a[_0xcc7a('0x23')]);if(_0x30270a['name']){delete _0x30270a[_0xcc7a('0x24')];}_0x2b0c9f[_0xcc7a('0x17')](_0x3c25bd)[_0xcc7a('0x25')](_0x30270a);};}exports[_0xcc7a('0x26')]=function(_0x4ea4ad,_0x2b1ca1){if(_0x4ea4ad[_0xcc7a('0x27')]['id']){delete _0x4ea4ad[_0xcc7a('0x27')]['id'];}return db['Action'][_0xcc7a('0x28')]({'where':{'id':_0x4ea4ad[_0xcc7a('0x29')]['id']}})[_0xcc7a('0x20')](handleEntityNotFound(_0x2b1ca1,null))[_0xcc7a('0x20')](saveUpdates(_0x4ea4ad['body'],null))[_0xcc7a('0x20')](respondWithResult(_0x2b1ca1,null))['catch'](handleError(_0x2b1ca1,null));};exports[_0xcc7a('0x2a')]=function(_0x1ab9ba,_0x1b2ad4){return db[_0xcc7a('0x2b')][_0xcc7a('0x28')]({'where':{'id':_0x1ab9ba[_0xcc7a('0x29')]['id']}})[_0xcc7a('0x20')](handleEntityNotFound(_0x1b2ad4,null))[_0xcc7a('0x20')](removeEntity(_0x1b2ad4,null))[_0xcc7a('0x2c')](handleError(_0x1b2ad4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9204881..49536b9 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 _0x0239=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x0239,0x8f));var _0x9023=function(_0xb93e37,_0x3643bf){_0xb93e37=_0xb93e37-0x0;var _0x275cad=_0x0239[_0xb93e37];return _0x275cad;};'use strict';var _=require(_0x9023('0x0'));var util=require('util');var logger=require(_0x9023('0x1'))(_0x9023('0x2'));var moment=require(_0x9023('0x3'));var BPromise=require(_0x9023('0x4'));var rp=require(_0x9023('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9023('0x6'));var config=require(_0x9023('0x7'));var attributes=require(_0x9023('0x8'));module[_0x9023('0x9')]=function(_0x5c973b,_0x4785f3){return _0x5c973b[_0x9023('0xa')]('Action',attributes,{'tableName':_0x9023('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13cb=['./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x13cb,0x19c));var _0xb13c=function(_0x1a08cf,_0x186382){_0x1a08cf=_0x1a08cf-0x0;var _0x4174b7=_0x13cb[_0x1a08cf];return _0x4174b7;};'use strict';var _=require(_0xb13c('0x0'));var util=require(_0xb13c('0x1'));var logger=require(_0xb13c('0x2'))(_0xb13c('0x3'));var moment=require(_0xb13c('0x4'));var BPromise=require('bluebird');var rp=require(_0xb13c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb13c('0x6'));var config=require(_0xb13c('0x7'));var attributes=require(_0xb13c('0x8'));module['exports']=function(_0x13e7bb,_0x53e4d9){return _0x13e7bb[_0xb13c('0x9')](_0xb13c('0xa'),attributes,{'tableName':_0xb13c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 5723a79..5b0709a 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x481ccf,_0x4c1878){_0x481ccf=_0x481ccf-0x0;var _0x2be0ba=_0x1cb9[_0x481ccf];return _0x2be0ba;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x23e55d,_0x356a3f){var _0x488f17=function(_0xb51e1f){while(--_0xb51e1f){_0x23e55d['push'](_0x23e55d['shift']());}};_0x488f17(++_0x356a3f);}(_0xabce,0x103));var _0xeabc=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xabce[_0x397cfb];return _0x15fed9;};'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')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7ed522a..809d0c8 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 _0x5fd3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x5fd3,0x15f));var _0x35fd=function(_0x2bee74,_0x283a27){_0x2bee74=_0x2bee74-0x0;var _0x167c55=_0x5fd3[_0x2bee74];return _0x167c55;};'use strict';var multer=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var path=require(_0x35fd('0x2'));var timeout=require(_0x35fd('0x3'));var express=require('express');var router=express[_0x35fd('0x4')]();var fs_extra=require(_0x35fd('0x5'));var auth=require(_0x35fd('0x6'));var interaction=require(_0x35fd('0x7'));var config=require('../../config/environment');var controller=require(_0x35fd('0x8'));router['put'](_0x35fd('0x9'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xb')]);router[_0x35fd('0xc')]('/:id',auth[_0x35fd('0xa')](),controller[_0x35fd('0xd')]);module[_0x35fd('0xe')]=router; \ No newline at end of file +var _0xf82c=['../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','path','Router','fs-extra'];(function(_0x23a2bd,_0x954eea){var _0x368fc4=function(_0x58bc14){while(--_0x58bc14){_0x23a2bd['push'](_0x23a2bd['shift']());}};_0x368fc4(++_0x954eea);}(_0xf82c,0x141));var _0xcf82=function(_0x2aa6b6,_0x4fdc23){_0x2aa6b6=_0x2aa6b6-0x0;var _0x2eac21=_0xf82c[_0x2aa6b6];return _0x2eac21;};'use strict';var multer=require(_0xcf82('0x0'));var util=require('util');var path=require(_0xcf82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf82('0x2')]();var fs_extra=require(_0xcf82('0x3'));var auth=require(_0xcf82('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf82('0x5'));var controller=require(_0xcf82('0x6'));router[_0xcf82('0x7')](_0xcf82('0x8'),auth[_0xcf82('0x9')](),controller[_0xcf82('0xa')]);router[_0xcf82('0xb')](_0xcf82('0x8'),auth[_0xcf82('0x9')](),controller[_0xcf82('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 82a41e3..6fdad24 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 _0x038b=['exports','STRING','TEXT'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x038b,0x114));var _0xb038=function(_0x12d940,_0x44067b){_0x12d940=_0x12d940-0x0;var _0x38faca=_0x038b[_0x12d940];return _0x38faca;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0xfff322,_0x5ac91a){var _0x35efcf=function(_0x2d0adb){while(--_0x2d0adb){_0xfff322['push'](_0xfff322['shift']());}};_0x35efcf(++_0x5ac91a);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 946a131..74e6b45 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 _0x8807=['SUM(%s)','COUNT(%s)','SEC_TO_TIME(%s)','IS\x20EMPTY','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','metric','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MIN(%s)','GROUP_CONCAT(%s)','ROUND(%s)','ValidationErrorItem','MetricId','function','format','web','fullPath','%s-%s.%s','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','SELECT','run','runReport'];(function(_0x4aa5db,_0x185906){var _0x4f4729=function(_0x555ef8){while(--_0x555ef8){_0x4aa5db['push'](_0x4aa5db['shift']());}};_0x4f4729(++_0x185906);}(_0x8807,0xac));var _0x7880=function(_0x1acf4b,_0x5a750c){_0x1acf4b=_0x1acf4b-0x0;var _0x4eca09=_0x8807[_0x1acf4b];return _0x4eca09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7880('0x0'));var zipdir=require(_0x7880('0x1'));var jsonpatch=require(_0x7880('0x2'));var rp=require(_0x7880('0x3'));var moment=require(_0x7880('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7880('0x5'));var util=require('util');var path=require(_0x7880('0x6'));var sox=require(_0x7880('0x7'));var csv=require(_0x7880('0x8'));var ejs=require(_0x7880('0x9'));var fs=require('fs');var fs_extra=require(_0x7880('0xa'));var _=require(_0x7880('0xb'));var squel=require(_0x7880('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7880('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7880('0xe'));var Redis=require('ioredis');var authService=require(_0x7880('0xf'));var qs=require(_0x7880('0x10'));var as=require(_0x7880('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7880('0x12'))(_0x7880('0x13'));var utils=require(_0x7880('0x14'));var config=require(_0x7880('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7880('0x16'))['db'];var dbH=require(_0x7880('0x16'))[_0x7880('0x17')];function respondWithStatusCode(_0x51009c,_0x3d0fc3){_0x3d0fc3=_0x3d0fc3||0xcc;return function(_0xec3ced){if(_0xec3ced){return _0x51009c[_0x7880('0x18')](_0x3d0fc3);}return _0x51009c[_0x7880('0x19')](_0x3d0fc3)['end']();};}function respondWithResult(_0x13c1fa,_0x345124){_0x345124=_0x345124||0xc8;return function(_0x5d12b2){if(_0x5d12b2){return _0x13c1fa[_0x7880('0x19')](_0x345124)[_0x7880('0x1a')](_0x5d12b2);}};}function respondWithFilteredResult(_0x3479a9,_0x4d408e){return function(_0x2f167b){if(_0x2f167b){var _0x1b4cf6=typeof _0x4d408e[_0x7880('0x1b')]===_0x7880('0x1c')&&typeof _0x4d408e[_0x7880('0x1d')]===_0x7880('0x1c');var _0x1693c3=_0x2f167b['count'];var _0x32d325=_0x1b4cf6?0x0:_0x4d408e['offset'];var _0x328b9f=_0x1b4cf6?_0x2f167b[_0x7880('0x1e')]:_0x4d408e[_0x7880('0x1b')]+_0x4d408e[_0x7880('0x1d')];var _0x53f6a5;if(_0x328b9f>=_0x1693c3){_0x328b9f=_0x1693c3;_0x53f6a5=0xc8;}else{_0x53f6a5=0xce;}_0x3479a9[_0x7880('0x19')](_0x53f6a5);return _0x3479a9['set'](_0x7880('0x1f'),_0x32d325+'-'+_0x328b9f+'/'+_0x1693c3)[_0x7880('0x1a')](_0x2f167b);}return null;};}function patchUpdates(_0xda460f){return function(_0xa9aeb7){try{jsonpatch[_0x7880('0x20')](_0xa9aeb7,_0xda460f,!![]);}catch(_0x45c88c){return BPromise[_0x7880('0x21')](_0x45c88c);}return _0xa9aeb7[_0x7880('0x22')]();};}function saveUpdates(_0x11bd2c,_0x2c0e01){return function(_0x566dbb){if(_0x566dbb){return _0x566dbb[_0x7880('0x23')](_0x11bd2c)[_0x7880('0x24')](function(_0x36bee2){return _0x36bee2;});}return null;};}function removeEntity(_0x28cd6e,_0x5f5087){return function(_0x4980b5){if(_0x4980b5){return _0x4980b5[_0x7880('0x25')]()[_0x7880('0x24')](function(){var _0x1fd318=_0x4980b5[_0x7880('0x26')]({'plain':!![]});var _0x45fc64=_0x7880('0x27');return db[_0x7880('0x28')][_0x7880('0x25')]({'where':{'type':_0x45fc64,'resourceId':_0x1fd318['id']}})[_0x7880('0x24')](function(){return _0x4980b5;});})['then'](function(){_0x28cd6e[_0x7880('0x19')](0xcc)[_0x7880('0x29')]();});}};}function handleEntityNotFound(_0x5a61cd,_0x342062){return function(_0x4ea754){if(!_0x4ea754){_0x5a61cd[_0x7880('0x18')](0x194);}return _0x4ea754;};}function handleError(_0x3eb734,_0x5c5e39){_0x5c5e39=_0x5c5e39||0x1f4;return function(_0x4ac858){logger['error'](_0x4ac858[_0x7880('0x2a')]);if(_0x4ac858[_0x7880('0x2b')]){delete _0x4ac858['name'];}_0x3eb734['status'](_0x5c5e39)[_0x7880('0x2c')](_0x4ac858);};}exports['index']=function(_0x5db878,_0x28d488){var _0x1300f2={},_0x150ada={},_0x4b8a79={'count':0x0,'rows':[]};var _0x2eb1e6=_[_0x7880('0x2d')](db[_0x7880('0x2e')][_0x7880('0x2f')],function(_0x49ca6c){return{'name':_0x49ca6c[_0x7880('0x30')],'type':_0x49ca6c['type'][_0x7880('0x31')]};});_0x150ada[_0x7880('0x32')]=_[_0x7880('0x2d')](_0x2eb1e6,_0x7880('0x2b'));_0x150ada['query']=_['keys'](_0x5db878[_0x7880('0x33')]);_0x150ada['filters']=_['intersection'](_0x150ada[_0x7880('0x32')],_0x150ada['query']);_0x1300f2[_0x7880('0x34')]=_[_0x7880('0x35')](_0x150ada[_0x7880('0x32')],qs[_0x7880('0x36')](_0x5db878[_0x7880('0x33')]['fields']));_0x1300f2['attributes']=_0x1300f2[_0x7880('0x34')][_0x7880('0x37')]?_0x1300f2[_0x7880('0x34')]:_0x150ada['model'];if(!_0x5db878[_0x7880('0x33')][_0x7880('0x38')](_0x7880('0x39'))){_0x1300f2[_0x7880('0x1d')]=qs['limit'](_0x5db878['query'][_0x7880('0x1d')]);_0x1300f2[_0x7880('0x1b')]=qs[_0x7880('0x1b')](_0x5db878[_0x7880('0x33')][_0x7880('0x1b')]);}_0x1300f2[_0x7880('0x3a')]=qs[_0x7880('0x3b')](_0x5db878[_0x7880('0x33')]['sort']);_0x1300f2[_0x7880('0x3c')]=qs[_0x7880('0x3d')](_[_0x7880('0x3e')](_0x5db878[_0x7880('0x33')],_0x150ada[_0x7880('0x3d')]),_0x2eb1e6);if(_0x5db878[_0x7880('0x33')][_0x7880('0x3f')]){_0x1300f2['where']=_['merge'](_0x1300f2[_0x7880('0x3c')],{'$or':_['map'](_0x2eb1e6,function(_0x1453dd){if(_0x1453dd[_0x7880('0x40')]!==_0x7880('0x41')){var _0x3ac7af={};_0x3ac7af[_0x1453dd[_0x7880('0x2b')]]={'$like':'%'+_0x5db878[_0x7880('0x33')]['filter']+'%'};return _0x3ac7af;}})});}_0x1300f2=_[_0x7880('0x42')]({},_0x1300f2,_0x5db878[_0x7880('0x43')]);var _0x23c818={'where':_0x1300f2[_0x7880('0x3c')]};return db[_0x7880('0x2e')][_0x7880('0x1e')](_0x23c818)[_0x7880('0x24')](function(_0x40d115){_0x4b8a79[_0x7880('0x1e')]=_0x40d115;if(_0x5db878[_0x7880('0x33')][_0x7880('0x44')]){_0x1300f2[_0x7880('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7880('0x46')](_0x1300f2);})['then'](function(_0x271cf4){_0x4b8a79[_0x7880('0x47')]=_0x271cf4;return _0x4b8a79;})[_0x7880('0x24')](respondWithFilteredResult(_0x28d488,_0x1300f2))['catch'](handleError(_0x28d488,null));};exports[_0x7880('0x48')]=function(_0x25bafa,_0x4aa197){var _0x281b66={'raw':![],'where':{'id':_0x25bafa[_0x7880('0x49')]['id']}},_0x32ed31={};_0x32ed31[_0x7880('0x32')]=_[_0x7880('0x4a')](db[_0x7880('0x2e')]['rawAttributes']);_0x32ed31[_0x7880('0x33')]=_['keys'](_0x25bafa['query']);_0x32ed31[_0x7880('0x3d')]=_['intersection'](_0x32ed31['model'],_0x32ed31['query']);_0x281b66[_0x7880('0x34')]=_[_0x7880('0x35')](_0x32ed31[_0x7880('0x32')],qs['fields'](_0x25bafa[_0x7880('0x33')][_0x7880('0x36')]));_0x281b66[_0x7880('0x34')]=_0x281b66[_0x7880('0x34')][_0x7880('0x37')]?_0x281b66[_0x7880('0x34')]:_0x32ed31['model'];if(_0x25bafa[_0x7880('0x33')][_0x7880('0x44')]){_0x281b66['include']=[{'all':!![]}];}_0x281b66=_[_0x7880('0x42')]({},_0x281b66,_0x25bafa['options']);return db[_0x7880('0x2e')][_0x7880('0x4b')](_0x281b66)[_0x7880('0x24')](handleEntityNotFound(_0x4aa197,null))['then'](respondWithResult(_0x4aa197,null))[_0x7880('0x4c')](handleError(_0x4aa197,null));};exports[_0x7880('0x4d')]=function(_0x432e55,_0x5e024e){return db[_0x7880('0x2e')][_0x7880('0x4d')](_0x432e55['body'],{})[_0x7880('0x24')](function(_0x6d7983){var _0x282164=_0x432e55[_0x7880('0x4e')][_0x7880('0x26')]({'plain':!![]});if(!_0x282164)throw new Error(_0x7880('0x4f'));if(_0x282164[_0x7880('0x50')]===_0x7880('0x4e')){var _0xaea634=_0x6d7983[_0x7880('0x26')]({'plain':!![]});var _0x370502=_0x7880('0x51');return db[_0x7880('0x52')][_0x7880('0x4b')]({'where':{'name':_0x370502,'userProfileId':_0x282164[_0x7880('0x53')]},'raw':!![]})['then'](function(_0x4a005b){if(_0x4a005b&&_0x4a005b[_0x7880('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xaea634[_0x7880('0x2b')],'resourceId':_0xaea634['id'],'type':_0x7880('0x27'),'sectionId':_0x4a005b['id']},{})['then'](function(){return _0x6d7983;});}else{return _0x6d7983;}})[_0x7880('0x4c')](function(_0x37b46f){logger[_0x7880('0x55')](_0x7880('0x56'),_0x37b46f);throw _0x37b46f;});}return _0x6d7983;})[_0x7880('0x24')](respondWithResult(_0x5e024e,0xc9))[_0x7880('0x4c')](handleError(_0x5e024e,null));};exports[_0x7880('0x23')]=function(_0x5b4597,_0x4884c7){if(_0x5b4597[_0x7880('0x57')]['id']){delete _0x5b4597[_0x7880('0x57')]['id'];}return db[_0x7880('0x2e')][_0x7880('0x4b')]({'where':{'id':_0x5b4597[_0x7880('0x49')]['id']}})['then'](handleEntityNotFound(_0x4884c7,null))[_0x7880('0x24')](saveUpdates(_0x5b4597[_0x7880('0x57')],null))[_0x7880('0x24')](respondWithResult(_0x4884c7,null))[_0x7880('0x4c')](handleError(_0x4884c7,null));};exports[_0x7880('0x25')]=function(_0x170db0,_0x29d89b){return db[_0x7880('0x2e')]['find']({'where':{'id':_0x170db0[_0x7880('0x49')]['id']}})['then'](handleEntityNotFound(_0x29d89b,null))['then'](removeEntity(_0x29d89b,null))[_0x7880('0x4c')](handleError(_0x29d89b,null));};exports[_0x7880('0x58')]=function(_0x270cca,_0x4e0fd9){var _0x513791=0xa;var _0x2b48b2=[_0x7880('0x59'),_0x7880('0x5a'),_0x7880('0x5b'),_0x7880('0x5c')];var _0x593bbb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7880('0x5d'),'MAX':_0x7880('0x5e'),'MIN':'MIN(%s)','AVG':_0x7880('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x33e86d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7880('0x62'),'HOUR':_0x7880('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7880('0x64')};var _0xf1a04e=function(_0x57b2f4){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),'IS\x20EMPTY',_0x7880('0x68')],_0x57b2f4);};var _0x43f96e=function(_0x24d00f){if(!_0x24d00f||!_0x24d00f[_0x7880('0x69')]['length']){return'';}for(var _0x1b1045='(',_0x3dcacb=0x0;_0x3dcacb<_0x24d00f[_0x7880('0x69')][_0x7880('0x37')];_0x3dcacb+=0x1){_0x3dcacb>0x0&&(_0x1b1045+='\x20'+_0x24d00f[_0x7880('0x6a')]+'\x20');_0x1b1045+=_0x24d00f['rules'][_0x3dcacb][_0x7880('0x6b')]?_0x43f96e(_0x24d00f['rules'][_0x3dcacb]['group']):_0x24d00f['rules'][_0x3dcacb][_0x7880('0x6c')]+'\x20'+_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6d')]+(_0xf1a04e(_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6d')])?'\x20'+_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6e')]:'');}return _0x1b1045+')';};var _0x47e2e4={'where':{'id':_0x270cca[_0x7880('0x49')]['id']}},_0xd16dea,_0x5625e6,_0x350afd,_0x49628c,_0x4862fc;_0x47e2e4=_['merge']({},_0x47e2e4,_0x270cca[_0x7880('0x43')]);return db[_0x7880('0x2e')][_0x7880('0x4b')](_0x47e2e4)['then'](function(_0x1cda40){if(_0x1cda40){_0xd16dea=_0x1cda40;return _0x1cda40[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x4bfbf6){if(_0x4bfbf6){if(!_0x4bfbf6[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))]['ValidationErrorItem'](_0x7880('0x71'),0x193);}_0x5625e6=_0x4bfbf6;return db[_0x7880('0x72')][_0x7880('0x46')]({'raw':!![]});}return null;})[_0x7880('0x24')](function(_0x1006a0){if(_0x1006a0){_0x350afd=_[_0x7880('0x73')](_0x1006a0,'id');var _0x18a4ff;var _0x532e06=squel[_0x7880('0x74')]();_0x532e06[_0x7880('0x75')](_0xd16dea[_0x7880('0x76')]);for(var _0x2ad8bd=0x0;_0x2ad8bd<_0x5625e6[_0x7880('0x37')];_0x2ad8bd+=0x1){_0x18a4ff=_0x5625e6[_0x2ad8bd]['MetricId']?_0x350afd[_0x5625e6[_0x2ad8bd]['MetricId']][_0x7880('0x77')]:_0x5625e6[_0x2ad8bd][_0x7880('0x6c')];_0x18a4ff=_0x5625e6[_0x2ad8bd]['function']?_[_0x7880('0x78')](_0x593bbb[_0x5625e6[_0x2ad8bd]['function']],'%s',_0x18a4ff):_0x18a4ff;_0x18a4ff=_0x5625e6[_0x2ad8bd]['format']?_['replace'](_0x33e86d[_0x5625e6[_0x2ad8bd]['format']],'%s',_0x18a4ff):_0x18a4ff;if(_0x5625e6[_0x2ad8bd][_0x7880('0x79')]){_0x532e06[_0x7880('0x6b')](_0x18a4ff);}_0x5625e6[_0x2ad8bd]['orderBy']&&_0x532e06[_0x7880('0x3a')](_0x18a4ff,_0x5625e6[_0x2ad8bd][_0x7880('0x7a')]===_0x7880('0x7b')?![]:!![]);_0x532e06[_0x7880('0x6c')](_0x18a4ff,_0x5625e6[_0x2ad8bd][_0x7880('0x7c')]||_0x18a4ff);}if(_0xd16dea[_0x7880('0x7d')]){_0xd16dea[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0xd16dea[_0x7880('0x7d')]);for(var _0x1067e3=0x0;_0x1067e3<_0xd16dea[_0x7880('0x7d')][_0x7880('0x37')];_0x1067e3+=0x1){if(_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x40')]&&_['includes'](_0x2b48b2,_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x40')])&&_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x7f')]&&_0xd16dea['joins'][_0x1067e3][_0x7880('0x80')]&&_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x81')]){_0x532e06[_0xd16dea[_0x7880('0x7d')][_0x1067e3]['type']](_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x80')],null,util['format'](_0x7880('0x82'),_0xd16dea[_0x7880('0x76')],_0xd16dea[_0x7880('0x7d')][_0x1067e3]['parentKey'],_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x80')],_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x81')]));}}}if(_0xd16dea[_0x7880('0x83')]){_0xd16dea[_0x7880('0x83')]=JSON[_0x7880('0x7e')](_0xd16dea[_0x7880('0x83')]);_0x532e06['where'](_0x43f96e(_0xd16dea[_0x7880('0x83')][_0x7880('0x6b')]));}_0x4862fc=_0x532e06['clone']();_0x532e06['limit'](_0x513791);_0x532e06['offset'](0x0);logger[_0x7880('0x84')](_0x7880('0x85'),_0x532e06[_0x7880('0x86')]());return dbH['sequelize'][_0x7880('0x33')](_0x532e06[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')][_0x7880('0x88')]['SELECT']});}})['then'](respondWithResult(_0x4e0fd9,null))['catch'](handleError(_0x4e0fd9,null));};function runReport(_0x56bfc2,_0xcbc80c,_0x3d2aff){var _0x30bbff=_0xcbc80c[_0x7880('0x2b')];var _0x11c84c=0xa;var _0x21748a=[_0x7880('0x59'),'left_join',_0x7880('0x5b'),_0x7880('0x5c')];var _0x874188={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7880('0x5d'),'MAX':'MAX(%s)','MIN':_0x7880('0x89'),'AVG':_0x7880('0x5f'),'GROUP_CONCAT':_0x7880('0x8a'),'GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x1bd855={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x7880('0x8b'),'UNIX_TIMESTAMP':_0x7880('0x64')};var _0x568d46=function(_0xe6dfaa){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),'IS\x20EMPTY',_0x7880('0x68')],_0xe6dfaa);};var _0x589f36=function(_0x71c586){if(!_0x71c586||!_0x71c586[_0x7880('0x69')][_0x7880('0x37')]){return'';}for(var _0x52a4d5='(',_0x301632=0x0;_0x301632<_0x71c586[_0x7880('0x69')]['length'];_0x301632+=0x1){_0x301632>0x0&&(_0x52a4d5+='\x20'+_0x71c586['operator']+'\x20');_0x52a4d5+=_0x71c586['rules'][_0x301632][_0x7880('0x6b')]?_0x589f36(_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6b')]):_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6c')]+'\x20'+_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6d')]+(_0x568d46(_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6d')])?'\x20'+_0x71c586['rules'][_0x301632][_0x7880('0x6e')]:'');}return _0x52a4d5+')';};var _0x2c6903={'where':{'id':_0x56bfc2['id']}},_0x5ee7f4,_0x222b6e,_0x359fac,_0xb53bd5,_0x5c21c0;_0x2c6903=_[_0x7880('0x42')]({},_0x2c6903,_0x3d2aff);return db['AnalyticCustomReport']['find'](_0x2c6903)['then'](function(_0x8135b9){if(_0x8135b9){_0x5ee7f4=_0x8135b9;return _0x8135b9[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x1a8f15){if(_0x1a8f15){if(!_0x1a8f15[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))][(_0x7880('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x222b6e=_0x1a8f15;return db[_0x7880('0x72')][_0x7880('0x46')]({'raw':!![]});}return null;})[_0x7880('0x24')](function(_0x86cd6){if(_0x86cd6){_0x359fac=_[_0x7880('0x73')](_0x86cd6,'id');var _0x29d7a7;var _0xc5d8b7=squel[_0x7880('0x74')]();_0xc5d8b7[_0x7880('0x75')](_0x5ee7f4[_0x7880('0x76')]);for(var _0x5266a6=0x0;_0x5266a6<_0x222b6e[_0x7880('0x37')];_0x5266a6+=0x1){_0x29d7a7=_0x222b6e[_0x5266a6][_0x7880('0x8d')]?_0x359fac[_0x222b6e[_0x5266a6]['MetricId']][_0x7880('0x77')]:_0x222b6e[_0x5266a6][_0x7880('0x6c')];_0x29d7a7=_0x222b6e[_0x5266a6][_0x7880('0x8e')]?_[_0x7880('0x78')](_0x874188[_0x222b6e[_0x5266a6]['function']],'%s',_0x29d7a7):_0x29d7a7;_0x29d7a7=_0x222b6e[_0x5266a6]['format']?_[_0x7880('0x78')](_0x1bd855[_0x222b6e[_0x5266a6][_0x7880('0x8f')]],'%s',_0x29d7a7):_0x29d7a7;if(_0x222b6e[_0x5266a6]['groupBy']){_0xc5d8b7[_0x7880('0x6b')](_0x29d7a7);}_0x222b6e[_0x5266a6][_0x7880('0x7a')]&&_0xc5d8b7['order'](_0x29d7a7,_0x222b6e[_0x5266a6]['orderBy']===_0x7880('0x7b')?![]:!![]);_0xc5d8b7[_0x7880('0x6c')](_0x29d7a7,_0x222b6e[_0x5266a6][_0x7880('0x7c')]||_0x29d7a7);}if(_0x5ee7f4[_0x7880('0x7d')]){_0x5ee7f4[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0x5ee7f4[_0x7880('0x7d')]);for(var _0x3e9670=0x0;_0x3e9670<_0x5ee7f4[_0x7880('0x7d')]['length'];_0x3e9670+=0x1){if(_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x40')]&&_[_0x7880('0x65')](_0x21748a,_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['type'])&&_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x7f')]&&_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['foreignTable']&&_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x81')]){_0xc5d8b7[_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x40')]](_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['foreignTable'],null,util[_0x7880('0x8f')](_0x7880('0x82'),_0x5ee7f4[_0x7880('0x76')],_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x7f')],_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x80')],_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x81')]));}}}if(_0x5ee7f4[_0x7880('0x83')]){_0x5ee7f4['conditions']=JSON[_0x7880('0x7e')](_0x5ee7f4['conditions']);_0xc5d8b7[_0x7880('0x3c')](_0x589f36(_0x5ee7f4['conditions'][_0x7880('0x6b')]));}_0x5c21c0=_0xc5d8b7['clone']();_0xc5d8b7[_0x7880('0x1d')](_0x11c84c);_0xc5d8b7[_0x7880('0x1b')](0x0);return;}})['then'](function(){if(_0xcbc80c['output']===_0x7880('0x90')){return null;}var _0xcf5aff=_[_0x7880('0x42')](_0xcbc80c,{'name':_0xcbc80c[_0x7880('0x91')]||_0xcbc80c[_0x7880('0x2b')]||_0x5ee7f4['name'],'basename':_0x30bbff,'savename':util[_0x7880('0x8f')](_0x7880('0x92'),_0xcbc80c[_0x7880('0x2b')]||_0x5ee7f4['name'],require('randomstring')[_0x7880('0x93')](0x4),_0xcbc80c[_0x7880('0x94')]||_0x7880('0x95')),'reportId':_0x5ee7f4['id'],'reportType':_0x7880('0x96')});return db['AnalyticExtractedReport'][_0x7880('0x4d')](_0xcf5aff,{'raw':!![]});})[_0x7880('0x24')](function(_0x372839){if(_0x5ee7f4[_0x7880('0x76')]===_0x7880('0x97')){_0x5c21c0[_0x7880('0x3c')](_0x5ee7f4[_0x7880('0x76')]+_0x7880('0x98'),_0xcbc80c['startDate'],_0xcbc80c[_0x7880('0x99')]);}else{_0x5c21c0['where'](_0x5ee7f4['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcbc80c[_0x7880('0x9a')],_0xcbc80c[_0x7880('0x99')]);}if(_0x372839){logger['info'](_0x7880('0x9b'),_0x5c21c0[_0x7880('0x86')]());require(_0x7880('0x9c'))[_0x7880('0x9d')](path[_0x7880('0x59')](__dirname,'../../components/export/',_0x372839['output']),[_0x372839['id'],_0x5c21c0[_0x7880('0x86')](),path[_0x7880('0x59')](__dirname,_0x7880('0x9e'),_0x372839[_0x7880('0x9f')]),_0x30bbff]);return _0x372839;}else{var _0x32cfc7=squel['select']();_0x32cfc7[_0x7880('0x75')]('('+_0x5c21c0[_0x7880('0x86')]()+')',_0x7880('0xa0'));_0x32cfc7['field']('COUNT(*)',_0x7880('0x1e'));_0x5c21c0[_0x7880('0x1d')](_0xcbc80c['limit']||_0x11c84c);_0x5c21c0[_0x7880('0x1b')](_0xcbc80c[_0x7880('0x1b')]||0x0);return dbH[_0x7880('0x87')][_0x7880('0x33')](_0x32cfc7[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')][_0x7880('0x88')]['SELECT']})[_0x7880('0x24')](function(_0x1f9fee){if(!_0x1f9fee[_0x7880('0x37')]){_0xb53bd5=0x0;}else{_0xb53bd5=_0x1f9fee[0x0]['count']||0x0;}return dbH['sequelize'][_0x7880('0x33')](_0x5c21c0[_0x7880('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x7880('0xa1')]});})[_0x7880('0x24')](function(_0x43dd30){return{'rows':_0x43dd30||[],'count':_0xb53bd5};});}});}exports[_0x7880('0xa2')]=function(_0x3cdf23,_0x2a273d){return runReport(_0x3cdf23[_0x7880('0x49')],_0x3cdf23[_0x7880('0x33')],_0x3cdf23[_0x7880('0x43')])[_0x7880('0x24')](respondWithResult(_0x2a273d,null))[_0x7880('0x4c')](handleError(_0x2a273d,null));};exports[_0x7880('0xa3')]=runReport;exports[_0x7880('0x33')]=function(_0x4fd42c,_0x18b729){var _0x2c8cf8=0xa;var _0x285d67=['join',_0x7880('0x5a'),'right_join',_0x7880('0x5c')];var _0x3d26a7={'SUM':_0x7880('0xa4'),'COUNT':_0x7880('0xa5'),'COUNT DISTINCT':_0x7880('0x5d'),'MAX':'MAX(%s)','MIN':_0x7880('0x89'),'AVG':_0x7880('0x5f'),'GROUP_CONCAT':_0x7880('0x8a'),'GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x290e53={'SEC_TO_TIME':_0x7880('0xa6'),'DATE':_0x7880('0x62'),'HOUR':_0x7880('0x63'),'ROUND':_0x7880('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x43eabd=function(_0x473808){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),_0x7880('0xa7'),_0x7880('0x68')],_0x473808);};var _0x2ec27d=function(_0x5a24ec){if(!_0x5a24ec||!_0x5a24ec[_0x7880('0x69')][_0x7880('0x37')]){return'';}for(var _0x5aa8a7='(',_0x4eeb7e=0x0;_0x4eeb7e<_0x5a24ec[_0x7880('0x69')][_0x7880('0x37')];_0x4eeb7e+=0x1){_0x4eeb7e>0x0&&(_0x5aa8a7+='\x20'+_0x5a24ec[_0x7880('0x6a')]+'\x20');_0x5aa8a7+=_0x5a24ec[_0x7880('0x69')][_0x4eeb7e][_0x7880('0x6b')]?_0x2ec27d(_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['group']):_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['field']+'\x20'+_0x5a24ec[_0x7880('0x69')][_0x4eeb7e][_0x7880('0x6d')]+(_0x43eabd(_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['condition'])?'\x20'+_0x5a24ec['rules'][_0x4eeb7e]['value']:'');}return _0x5aa8a7+')';};var _0x9c4245={'where':{'id':_0x4fd42c[_0x7880('0x49')]['id']}},_0x23778f,_0x5d286c,_0xa2ef4c,_0x2306a8,_0x299939;_0x9c4245=_['merge']({},_0x9c4245,_0x4fd42c[_0x7880('0x43')]);return db[_0x7880('0x2e')]['find'](_0x9c4245)['then'](function(_0x522bac){if(_0x522bac){_0x23778f=_0x522bac;return _0x522bac[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x42c0aa){if(_0x42c0aa){if(!_0x42c0aa[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))][(_0x7880('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5d286c=_0x42c0aa;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4e4824){if(_0x4e4824){_0xa2ef4c=_[_0x7880('0x73')](_0x4e4824,'id');var _0x148f86;var _0x704bff=squel[_0x7880('0x74')]();_0x704bff[_0x7880('0x75')](_0x23778f[_0x7880('0x76')]);for(var _0x3fe7a4=0x0;_0x3fe7a4<_0x5d286c['length'];_0x3fe7a4+=0x1){_0x148f86=_0x5d286c[_0x3fe7a4][_0x7880('0x8d')]?_0xa2ef4c[_0x5d286c[_0x3fe7a4][_0x7880('0x8d')]][_0x7880('0x77')]:_0x5d286c[_0x3fe7a4]['field'];_0x148f86=_0x5d286c[_0x3fe7a4]['function']?_[_0x7880('0x78')](_0x3d26a7[_0x5d286c[_0x3fe7a4][_0x7880('0x8e')]],'%s',_0x148f86):_0x148f86;_0x148f86=_0x5d286c[_0x3fe7a4]['format']?_[_0x7880('0x78')](_0x290e53[_0x5d286c[_0x3fe7a4][_0x7880('0x8f')]],'%s',_0x148f86):_0x148f86;if(_0x5d286c[_0x3fe7a4][_0x7880('0x79')]){_0x704bff[_0x7880('0x6b')](_0x148f86);}_0x5d286c[_0x3fe7a4]['orderBy']&&_0x704bff[_0x7880('0x3a')](_0x148f86,_0x5d286c[_0x3fe7a4][_0x7880('0x7a')]==='DESC'?![]:!![]);_0x704bff[_0x7880('0x6c')](_0x148f86,_0x5d286c[_0x3fe7a4][_0x7880('0x7c')]||_0x148f86);}if(_0x23778f[_0x7880('0x7d')]){_0x23778f[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0x23778f[_0x7880('0x7d')]);for(var _0x1dc852=0x0;_0x1dc852<_0x23778f[_0x7880('0x7d')][_0x7880('0x37')];_0x1dc852+=0x1){if(_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')]&&_['includes'](_0x285d67,_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')])&&_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x7f')]&&_0x23778f[_0x7880('0x7d')][_0x1dc852]['foreignTable']&&_0x23778f[_0x7880('0x7d')][_0x1dc852]['foreignKey']){_0x704bff[_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')]](_0x23778f['joins'][_0x1dc852][_0x7880('0x80')],null,util[_0x7880('0x8f')](_0x7880('0x82'),_0x23778f[_0x7880('0x76')],_0x23778f['joins'][_0x1dc852][_0x7880('0x7f')],_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x80')],_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x81')]));}}}if(_0x23778f['conditions']){_0x23778f[_0x7880('0x83')]=JSON[_0x7880('0x7e')](_0x23778f[_0x7880('0x83')]);_0x704bff[_0x7880('0x3c')](_0x2ec27d(_0x23778f[_0x7880('0x83')][_0x7880('0x6b')]));}_0x299939=_0x704bff['clone']();_0x704bff[_0x7880('0x1d')](_0x2c8cf8);_0x704bff[_0x7880('0x1b')](0x0);logger['debug'](_0x7880('0x85'),_0x704bff[_0x7880('0x86')]());return dbH['sequelize'][_0x7880('0x33')](_0x704bff[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')]['QueryTypes'][_0x7880('0xa1')]});}})[_0x7880('0x24')](function(){return{'sql':_0x299939['toString']()};})[_0x7880('0x24')](respondWithResult(_0x18b729,null))[_0x7880('0x4c')](handleError(_0x18b729,null));}; \ No newline at end of file +var _0xae89=['sort','where','filters','pick','filter','merge','options','include','findAll','rows','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','DESC','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MAX(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','alias','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','countTable','COUNT(*)','run','runReport','operator','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','CustomReports','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x522494,_0x11c830){var _0x470cf1=function(_0x229f42){while(--_0x229f42){_0x522494['push'](_0x522494['shift']());}};_0x470cf1(++_0x11c830);}(_0xae89,0x66));var _0x9ae8=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0xae89[_0x323419];return _0x4c0be7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ae8('0x0'));var rp=require(_0x9ae8('0x1'));var moment=require(_0x9ae8('0x2'));var BPromise=require(_0x9ae8('0x3'));var Mustache=require(_0x9ae8('0x4'));var util=require(_0x9ae8('0x5'));var path=require(_0x9ae8('0x6'));var sox=require(_0x9ae8('0x7'));var csv=require(_0x9ae8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ae8('0x9'));var _=require(_0x9ae8('0xa'));var squel=require(_0x9ae8('0xb'));var crypto=require(_0x9ae8('0xc'));var jsforce=require(_0x9ae8('0xd'));var deskjs=require(_0x9ae8('0xe'));var toCsv=require(_0x9ae8('0x8'));var querystring=require(_0x9ae8('0xf'));var Papa=require(_0x9ae8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ae8('0x11'));var logger=require(_0x9ae8('0x12'))(_0x9ae8('0x13'));var utils=require('../../config/utils');var config=require(_0x9ae8('0x14'));var licenseUtil=require(_0x9ae8('0x15'));var db=require(_0x9ae8('0x16'))['db'];var dbH=require(_0x9ae8('0x16'))['dbH'];function respondWithStatusCode(_0x38865d,_0xb66061){_0xb66061=_0xb66061||0xcc;return function(_0x4748c5){if(_0x4748c5){return _0x38865d['sendStatus'](_0xb66061);}return _0x38865d[_0x9ae8('0x17')](_0xb66061)[_0x9ae8('0x18')]();};}function respondWithResult(_0x391619,_0x3d68a3){_0x3d68a3=_0x3d68a3||0xc8;return function(_0x2af23a){if(_0x2af23a){return _0x391619[_0x9ae8('0x17')](_0x3d68a3)[_0x9ae8('0x19')](_0x2af23a);}};}function respondWithFilteredResult(_0x133b06,_0x2370aa){return function(_0x26a8ed){if(_0x26a8ed){var _0x4d64da=typeof _0x2370aa[_0x9ae8('0x1a')]===_0x9ae8('0x1b')&&typeof _0x2370aa[_0x9ae8('0x1c')]===_0x9ae8('0x1b');var _0x588d2d=_0x26a8ed[_0x9ae8('0x1d')];var _0x519ce0=_0x4d64da?0x0:_0x2370aa[_0x9ae8('0x1a')];var _0x55b16b=_0x4d64da?_0x26a8ed[_0x9ae8('0x1d')]:_0x2370aa[_0x9ae8('0x1a')]+_0x2370aa[_0x9ae8('0x1c')];var _0x3d9ced;if(_0x55b16b>=_0x588d2d){_0x55b16b=_0x588d2d;_0x3d9ced=0xc8;}else{_0x3d9ced=0xce;}_0x133b06['status'](_0x3d9ced);return _0x133b06[_0x9ae8('0x1e')](_0x9ae8('0x1f'),_0x519ce0+'-'+_0x55b16b+'/'+_0x588d2d)[_0x9ae8('0x19')](_0x26a8ed);}return null;};}function patchUpdates(_0x5dd6c0){return function(_0x475f2e){try{jsonpatch[_0x9ae8('0x20')](_0x475f2e,_0x5dd6c0,!![]);}catch(_0x228b89){return BPromise['reject'](_0x228b89);}return _0x475f2e[_0x9ae8('0x21')]();};}function saveUpdates(_0x3929ec,_0x50e95e){return function(_0x334cba){if(_0x334cba){return _0x334cba[_0x9ae8('0x22')](_0x3929ec)['then'](function(_0x147086){return _0x147086;});}return null;};}function removeEntity(_0x5dcb67,_0x27575f){return function(_0x347986){if(_0x347986){return _0x347986[_0x9ae8('0x23')]()['then'](function(){var _0xcf6a15=_0x347986[_0x9ae8('0x24')]({'plain':!![]});var _0x584bae=_0x9ae8('0x25');return db[_0x9ae8('0x26')][_0x9ae8('0x23')]({'where':{'type':_0x584bae,'resourceId':_0xcf6a15['id']}})[_0x9ae8('0x27')](function(){return _0x347986;});})[_0x9ae8('0x27')](function(){_0x5dcb67[_0x9ae8('0x17')](0xcc)[_0x9ae8('0x18')]();});}};}function handleEntityNotFound(_0x5264c3,_0xa715a){return function(_0x2240bd){if(!_0x2240bd){_0x5264c3[_0x9ae8('0x28')](0x194);}return _0x2240bd;};}function handleError(_0x3318f1,_0x2fab5c){_0x2fab5c=_0x2fab5c||0x1f4;return function(_0x191a69){logger[_0x9ae8('0x29')](_0x191a69[_0x9ae8('0x2a')]);if(_0x191a69[_0x9ae8('0x2b')]){delete _0x191a69[_0x9ae8('0x2b')];}_0x3318f1[_0x9ae8('0x17')](_0x2fab5c)[_0x9ae8('0x2c')](_0x191a69);};}exports[_0x9ae8('0x2d')]=function(_0x26e9d4,_0x42bb62){var _0x304acc={},_0x13de31={},_0x719631={'count':0x0,'rows':[]};var _0x8fa21b=_[_0x9ae8('0x2e')](db[_0x9ae8('0x2f')][_0x9ae8('0x30')],function(_0x21ad71){return{'name':_0x21ad71[_0x9ae8('0x31')],'type':_0x21ad71[_0x9ae8('0x32')][_0x9ae8('0x33')]};});_0x13de31[_0x9ae8('0x34')]=_[_0x9ae8('0x2e')](_0x8fa21b,_0x9ae8('0x2b'));_0x13de31[_0x9ae8('0x35')]=_['keys'](_0x26e9d4[_0x9ae8('0x35')]);_0x13de31['filters']=_[_0x9ae8('0x36')](_0x13de31[_0x9ae8('0x34')],_0x13de31[_0x9ae8('0x35')]);_0x304acc['attributes']=_['intersection'](_0x13de31[_0x9ae8('0x34')],qs[_0x9ae8('0x37')](_0x26e9d4[_0x9ae8('0x35')][_0x9ae8('0x37')]));_0x304acc[_0x9ae8('0x38')]=_0x304acc[_0x9ae8('0x38')]['length']?_0x304acc[_0x9ae8('0x38')]:_0x13de31[_0x9ae8('0x34')];if(!_0x26e9d4['query'][_0x9ae8('0x39')](_0x9ae8('0x3a'))){_0x304acc[_0x9ae8('0x1c')]=qs['limit'](_0x26e9d4['query']['limit']);_0x304acc[_0x9ae8('0x1a')]=qs['offset'](_0x26e9d4[_0x9ae8('0x35')][_0x9ae8('0x1a')]);}_0x304acc['order']=qs['sort'](_0x26e9d4[_0x9ae8('0x35')][_0x9ae8('0x3b')]);_0x304acc[_0x9ae8('0x3c')]=qs[_0x9ae8('0x3d')](_[_0x9ae8('0x3e')](_0x26e9d4[_0x9ae8('0x35')],_0x13de31[_0x9ae8('0x3d')]),_0x8fa21b);if(_0x26e9d4[_0x9ae8('0x35')][_0x9ae8('0x3f')]){_0x304acc[_0x9ae8('0x3c')]=_[_0x9ae8('0x40')](_0x304acc[_0x9ae8('0x3c')],{'$or':_[_0x9ae8('0x2e')](_0x8fa21b,function(_0x2b3a02){if(_0x2b3a02[_0x9ae8('0x32')]!=='VIRTUAL'){var _0x595d9c={};_0x595d9c[_0x2b3a02['name']]={'$like':'%'+_0x26e9d4['query'][_0x9ae8('0x3f')]+'%'};return _0x595d9c;}})});}_0x304acc=_[_0x9ae8('0x40')]({},_0x304acc,_0x26e9d4[_0x9ae8('0x41')]);var _0x198fdf={'where':_0x304acc['where']};return db[_0x9ae8('0x2f')][_0x9ae8('0x1d')](_0x198fdf)['then'](function(_0xbcded4){_0x719631['count']=_0xbcded4;if(_0x26e9d4[_0x9ae8('0x35')]['includeAll']){_0x304acc[_0x9ae8('0x42')]=[{'all':!![]}];}return db[_0x9ae8('0x2f')][_0x9ae8('0x43')](_0x304acc);})['then'](function(_0xa22a6b){_0x719631[_0x9ae8('0x44')]=_0xa22a6b;return _0x719631;})[_0x9ae8('0x27')](respondWithFilteredResult(_0x42bb62,_0x304acc))['catch'](handleError(_0x42bb62,null));};exports['show']=function(_0x4a1209,_0x1a007f){var _0xfb026a={'raw':![],'where':{'id':_0x4a1209['params']['id']}},_0x5e83a3={};_0x5e83a3['model']=_[_0x9ae8('0x45')](db[_0x9ae8('0x2f')][_0x9ae8('0x30')]);_0x5e83a3[_0x9ae8('0x35')]=_[_0x9ae8('0x45')](_0x4a1209[_0x9ae8('0x35')]);_0x5e83a3[_0x9ae8('0x3d')]=_[_0x9ae8('0x36')](_0x5e83a3[_0x9ae8('0x34')],_0x5e83a3[_0x9ae8('0x35')]);_0xfb026a[_0x9ae8('0x38')]=_[_0x9ae8('0x36')](_0x5e83a3[_0x9ae8('0x34')],qs[_0x9ae8('0x37')](_0x4a1209[_0x9ae8('0x35')]['fields']));_0xfb026a[_0x9ae8('0x38')]=_0xfb026a[_0x9ae8('0x38')][_0x9ae8('0x46')]?_0xfb026a['attributes']:_0x5e83a3[_0x9ae8('0x34')];if(_0x4a1209[_0x9ae8('0x35')]['includeAll']){_0xfb026a[_0x9ae8('0x42')]=[{'all':!![]}];}_0xfb026a=_['merge']({},_0xfb026a,_0x4a1209[_0x9ae8('0x41')]);return db['AnalyticCustomReport'][_0x9ae8('0x47')](_0xfb026a)[_0x9ae8('0x27')](handleEntityNotFound(_0x1a007f,null))['then'](respondWithResult(_0x1a007f,null))[_0x9ae8('0x48')](handleError(_0x1a007f,null));};exports[_0x9ae8('0x49')]=function(_0x28a6cc,_0x3418de){return db['AnalyticCustomReport'][_0x9ae8('0x49')](_0x28a6cc[_0x9ae8('0x4a')],{})[_0x9ae8('0x27')](function(_0x1ba6f4){var _0x54947d=_0x28a6cc[_0x9ae8('0x4b')][_0x9ae8('0x24')]({'plain':!![]});if(!_0x54947d)throw new Error(_0x9ae8('0x4c'));if(_0x54947d['role']===_0x9ae8('0x4b')){var _0x230f45=_0x1ba6f4['get']({'plain':!![]});var _0x5baba5=_0x9ae8('0x4d');return db[_0x9ae8('0x4e')][_0x9ae8('0x47')]({'where':{'name':_0x5baba5,'userProfileId':_0x54947d['userProfileId']},'raw':!![]})[_0x9ae8('0x27')](function(_0x2ee8b8){if(_0x2ee8b8&&_0x2ee8b8[_0x9ae8('0x4f')]===0x0){return db[_0x9ae8('0x26')][_0x9ae8('0x49')]({'name':_0x230f45[_0x9ae8('0x2b')],'resourceId':_0x230f45['id'],'type':_0x9ae8('0x25'),'sectionId':_0x2ee8b8['id']},{})[_0x9ae8('0x27')](function(){return _0x1ba6f4;});}else{return _0x1ba6f4;}})[_0x9ae8('0x48')](function(_0x306ef3){logger[_0x9ae8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x306ef3);throw _0x306ef3;});}return _0x1ba6f4;})[_0x9ae8('0x27')](respondWithResult(_0x3418de,0xc9))[_0x9ae8('0x48')](handleError(_0x3418de,null));};exports['update']=function(_0x5a1a17,_0x268f3a){if(_0x5a1a17[_0x9ae8('0x4a')]['id']){delete _0x5a1a17[_0x9ae8('0x4a')]['id'];}return db[_0x9ae8('0x2f')][_0x9ae8('0x47')]({'where':{'id':_0x5a1a17[_0x9ae8('0x50')]['id']}})[_0x9ae8('0x27')](handleEntityNotFound(_0x268f3a,null))['then'](saveUpdates(_0x5a1a17[_0x9ae8('0x4a')],null))[_0x9ae8('0x27')](respondWithResult(_0x268f3a,null))[_0x9ae8('0x48')](handleError(_0x268f3a,null));};exports[_0x9ae8('0x23')]=function(_0x385786,_0x4d823a){return db[_0x9ae8('0x2f')][_0x9ae8('0x47')]({'where':{'id':_0x385786['params']['id']}})[_0x9ae8('0x27')](handleEntityNotFound(_0x4d823a,null))[_0x9ae8('0x27')](removeEntity(_0x4d823a,null))[_0x9ae8('0x48')](handleError(_0x4d823a,null));};exports[_0x9ae8('0x51')]=function(_0x1e61cd,_0x3476e2){var _0x2af5e0=0xa;var _0x4c8fd7=[_0x9ae8('0x52'),_0x9ae8('0x53'),'right_join',_0x9ae8('0x54')];var _0x16a029={'SUM':_0x9ae8('0x55'),'COUNT':_0x9ae8('0x56'),'COUNT DISTINCT':_0x9ae8('0x57'),'MAX':'MAX(%s)','MIN':_0x9ae8('0x58'),'AVG':_0x9ae8('0x59'),'GROUP_CONCAT':_0x9ae8('0x5a'),'GROUP_CONCAT ASC':_0x9ae8('0x5b'),'GROUP_CONCAT DESC':_0x9ae8('0x5c')};var _0x2ac445={'SEC_TO_TIME':_0x9ae8('0x5d'),'DATE':_0x9ae8('0x5e'),'HOUR':_0x9ae8('0x5f'),'ROUND':_0x9ae8('0x60'),'UNIX_TIMESTAMP':_0x9ae8('0x61')};var _0x1c1009=function(_0x27220b){return!_[_0x9ae8('0x62')]([_0x9ae8('0x63'),'IS\x20NOT\x20NULL',_0x9ae8('0x64'),'IS\x20NOT\x20EMPTY'],_0x27220b);};var _0x39f1a9=function(_0x3eca90){if(!_0x3eca90||!_0x3eca90[_0x9ae8('0x65')]['length']){return'';}for(var _0x162f2c='(',_0x326e3a=0x0;_0x326e3a<_0x3eca90[_0x9ae8('0x65')]['length'];_0x326e3a+=0x1){_0x326e3a>0x0&&(_0x162f2c+='\x20'+_0x3eca90['operator']+'\x20');_0x162f2c+=_0x3eca90[_0x9ae8('0x65')][_0x326e3a][_0x9ae8('0x66')]?_0x39f1a9(_0x3eca90[_0x9ae8('0x65')][_0x326e3a][_0x9ae8('0x66')]):_0x3eca90['rules'][_0x326e3a][_0x9ae8('0x67')]+'\x20'+_0x3eca90['rules'][_0x326e3a][_0x9ae8('0x68')]+(_0x1c1009(_0x3eca90[_0x9ae8('0x65')][_0x326e3a]['condition'])?'\x20'+_0x3eca90[_0x9ae8('0x65')][_0x326e3a][_0x9ae8('0x69')]:'');}return _0x162f2c+')';};var _0xae632e={'where':{'id':_0x1e61cd[_0x9ae8('0x50')]['id']}},_0x3d3c7a,_0x3d1923,_0xc08b1d,_0x3f0ed8,_0x1e0a46;_0xae632e=_[_0x9ae8('0x40')]({},_0xae632e,_0x1e61cd[_0x9ae8('0x41')]);return db[_0x9ae8('0x2f')]['find'](_0xae632e)[_0x9ae8('0x27')](function(_0x11e7fe){if(_0x11e7fe){_0x3d3c7a=_0x11e7fe;return _0x11e7fe[_0x9ae8('0x6a')]();}return null;})[_0x9ae8('0x27')](function(_0x3c6869){if(_0x3c6869){if(!_0x3c6869[_0x9ae8('0x46')]){throw new db[(_0x9ae8('0x6b'))][(_0x9ae8('0x6c'))](_0x9ae8('0x6d'),0x193);}_0x3d1923=_0x3c6869;return db[_0x9ae8('0x6e')][_0x9ae8('0x43')]({'raw':!![]});}return null;})[_0x9ae8('0x27')](function(_0x5d4a46){if(_0x5d4a46){_0xc08b1d=_[_0x9ae8('0x6f')](_0x5d4a46,'id');var _0xa046ed;var _0x393b8c=squel[_0x9ae8('0x70')]();_0x393b8c[_0x9ae8('0x71')](_0x3d3c7a[_0x9ae8('0x72')]);for(var _0x5a891e=0x0;_0x5a891e<_0x3d1923[_0x9ae8('0x46')];_0x5a891e+=0x1){_0xa046ed=_0x3d1923[_0x5a891e][_0x9ae8('0x73')]?_0xc08b1d[_0x3d1923[_0x5a891e][_0x9ae8('0x73')]][_0x9ae8('0x74')]:_0x3d1923[_0x5a891e][_0x9ae8('0x67')];_0xa046ed=_0x3d1923[_0x5a891e][_0x9ae8('0x75')]?_[_0x9ae8('0x76')](_0x16a029[_0x3d1923[_0x5a891e][_0x9ae8('0x75')]],'%s',_0xa046ed):_0xa046ed;_0xa046ed=_0x3d1923[_0x5a891e][_0x9ae8('0x77')]?_[_0x9ae8('0x76')](_0x2ac445[_0x3d1923[_0x5a891e][_0x9ae8('0x77')]],'%s',_0xa046ed):_0xa046ed;if(_0x3d1923[_0x5a891e][_0x9ae8('0x78')]){_0x393b8c['group'](_0xa046ed);}_0x3d1923[_0x5a891e][_0x9ae8('0x79')]&&_0x393b8c[_0x9ae8('0x7a')](_0xa046ed,_0x3d1923[_0x5a891e][_0x9ae8('0x79')]===_0x9ae8('0x7b')?![]:!![]);_0x393b8c['field'](_0xa046ed,_0x3d1923[_0x5a891e]['alias']||_0xa046ed);}if(_0x3d3c7a[_0x9ae8('0x7c')]){_0x3d3c7a[_0x9ae8('0x7c')]=JSON[_0x9ae8('0x7d')](_0x3d3c7a[_0x9ae8('0x7c')]);for(var _0x2a6dff=0x0;_0x2a6dff<_0x3d3c7a[_0x9ae8('0x7c')][_0x9ae8('0x46')];_0x2a6dff+=0x1){if(_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x32')]&&_[_0x9ae8('0x62')](_0x4c8fd7,_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff]['type'])&&_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x7e')]&&_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff]['foreignTable']&&_0x3d3c7a['joins'][_0x2a6dff][_0x9ae8('0x7f')]){_0x393b8c[_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff]['type']](_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x80')],null,util[_0x9ae8('0x77')](_0x9ae8('0x81'),_0x3d3c7a[_0x9ae8('0x72')],_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x7e')],_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x80')],_0x3d3c7a[_0x9ae8('0x7c')][_0x2a6dff][_0x9ae8('0x7f')]));}}}if(_0x3d3c7a[_0x9ae8('0x82')]){_0x3d3c7a[_0x9ae8('0x82')]=JSON[_0x9ae8('0x7d')](_0x3d3c7a[_0x9ae8('0x82')]);_0x393b8c[_0x9ae8('0x3c')](_0x39f1a9(_0x3d3c7a[_0x9ae8('0x82')][_0x9ae8('0x66')]));}_0x1e0a46=_0x393b8c[_0x9ae8('0x83')]();_0x393b8c[_0x9ae8('0x1c')](_0x2af5e0);_0x393b8c['offset'](0x0);logger[_0x9ae8('0x84')](_0x9ae8('0x85'),_0x393b8c[_0x9ae8('0x86')]());return dbH['sequelize'][_0x9ae8('0x35')](_0x393b8c[_0x9ae8('0x86')](),{'type':dbH[_0x9ae8('0x87')][_0x9ae8('0x88')][_0x9ae8('0x89')]});}})[_0x9ae8('0x27')](respondWithResult(_0x3476e2,null))[_0x9ae8('0x48')](handleError(_0x3476e2,null));};function runReport(_0x218ca9,_0x2ea5bd,_0x5de495){var _0x1034b9=_0x2ea5bd['name'];var _0x50282b=0xa;var _0x337fac=[_0x9ae8('0x52'),'left_join',_0x9ae8('0x8a'),'cross_join'];var _0x287ddb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9ae8('0x57'),'MAX':_0x9ae8('0x8b'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9ae8('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x599c8b={'SEC_TO_TIME':_0x9ae8('0x5d'),'DATE':'DATE(%s)','HOUR':_0x9ae8('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9ae8('0x61')};var _0x55149a=function(_0x18417d){return!_['includes']([_0x9ae8('0x63'),_0x9ae8('0x8c'),'IS\x20EMPTY',_0x9ae8('0x8d')],_0x18417d);};var _0x18fd15=function(_0x4690cd){if(!_0x4690cd||!_0x4690cd[_0x9ae8('0x65')][_0x9ae8('0x46')]){return'';}for(var _0x5e8a6f='(',_0x1f76ef=0x0;_0x1f76ef<_0x4690cd[_0x9ae8('0x65')][_0x9ae8('0x46')];_0x1f76ef+=0x1){_0x1f76ef>0x0&&(_0x5e8a6f+='\x20'+_0x4690cd['operator']+'\x20');_0x5e8a6f+=_0x4690cd['rules'][_0x1f76ef][_0x9ae8('0x66')]?_0x18fd15(_0x4690cd[_0x9ae8('0x65')][_0x1f76ef]['group']):_0x4690cd[_0x9ae8('0x65')][_0x1f76ef][_0x9ae8('0x67')]+'\x20'+_0x4690cd['rules'][_0x1f76ef][_0x9ae8('0x68')]+(_0x55149a(_0x4690cd[_0x9ae8('0x65')][_0x1f76ef][_0x9ae8('0x68')])?'\x20'+_0x4690cd[_0x9ae8('0x65')][_0x1f76ef][_0x9ae8('0x69')]:'');}return _0x5e8a6f+')';};var _0x18c7e7={'where':{'id':_0x218ca9['id']}},_0xfa814a,_0xf041c9,_0x45b3cf,_0x534a8e,_0x4f8770;_0x18c7e7=_['merge']({},_0x18c7e7,_0x5de495);return db['AnalyticCustomReport'][_0x9ae8('0x47')](_0x18c7e7)[_0x9ae8('0x27')](function(_0x57be07){if(_0x57be07){_0xfa814a=_0x57be07;return _0x57be07[_0x9ae8('0x6a')]();}return null;})[_0x9ae8('0x27')](function(_0x1868e7){if(_0x1868e7){if(!_0x1868e7[_0x9ae8('0x46')]){throw new db[(_0x9ae8('0x6b'))][(_0x9ae8('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf041c9=_0x1868e7;return db['AnalyticMetric'][_0x9ae8('0x43')]({'raw':!![]});}return null;})['then'](function(_0x42f17b){if(_0x42f17b){_0x45b3cf=_[_0x9ae8('0x6f')](_0x42f17b,'id');var _0x333a8a;var _0x10f2ab=squel['select']();_0x10f2ab[_0x9ae8('0x71')](_0xfa814a[_0x9ae8('0x72')]);for(var _0x307ed0=0x0;_0x307ed0<_0xf041c9['length'];_0x307ed0+=0x1){_0x333a8a=_0xf041c9[_0x307ed0]['MetricId']?_0x45b3cf[_0xf041c9[_0x307ed0][_0x9ae8('0x73')]][_0x9ae8('0x74')]:_0xf041c9[_0x307ed0][_0x9ae8('0x67')];_0x333a8a=_0xf041c9[_0x307ed0][_0x9ae8('0x75')]?_['replace'](_0x287ddb[_0xf041c9[_0x307ed0][_0x9ae8('0x75')]],'%s',_0x333a8a):_0x333a8a;_0x333a8a=_0xf041c9[_0x307ed0][_0x9ae8('0x77')]?_[_0x9ae8('0x76')](_0x599c8b[_0xf041c9[_0x307ed0][_0x9ae8('0x77')]],'%s',_0x333a8a):_0x333a8a;if(_0xf041c9[_0x307ed0]['groupBy']){_0x10f2ab[_0x9ae8('0x66')](_0x333a8a);}_0xf041c9[_0x307ed0]['orderBy']&&_0x10f2ab[_0x9ae8('0x7a')](_0x333a8a,_0xf041c9[_0x307ed0][_0x9ae8('0x79')]===_0x9ae8('0x7b')?![]:!![]);_0x10f2ab[_0x9ae8('0x67')](_0x333a8a,_0xf041c9[_0x307ed0][_0x9ae8('0x8e')]||_0x333a8a);}if(_0xfa814a[_0x9ae8('0x7c')]){_0xfa814a[_0x9ae8('0x7c')]=JSON[_0x9ae8('0x7d')](_0xfa814a[_0x9ae8('0x7c')]);for(var _0x5c6336=0x0;_0x5c6336<_0xfa814a[_0x9ae8('0x7c')][_0x9ae8('0x46')];_0x5c6336+=0x1){if(_0xfa814a[_0x9ae8('0x7c')][_0x5c6336][_0x9ae8('0x32')]&&_[_0x9ae8('0x62')](_0x337fac,_0xfa814a['joins'][_0x5c6336][_0x9ae8('0x32')])&&_0xfa814a[_0x9ae8('0x7c')][_0x5c6336]['parentKey']&&_0xfa814a[_0x9ae8('0x7c')][_0x5c6336][_0x9ae8('0x80')]&&_0xfa814a[_0x9ae8('0x7c')][_0x5c6336][_0x9ae8('0x7f')]){_0x10f2ab[_0xfa814a[_0x9ae8('0x7c')][_0x5c6336][_0x9ae8('0x32')]](_0xfa814a[_0x9ae8('0x7c')][_0x5c6336]['foreignTable'],null,util[_0x9ae8('0x77')](_0x9ae8('0x81'),_0xfa814a['table'],_0xfa814a[_0x9ae8('0x7c')][_0x5c6336]['parentKey'],_0xfa814a[_0x9ae8('0x7c')][_0x5c6336]['foreignTable'],_0xfa814a[_0x9ae8('0x7c')][_0x5c6336][_0x9ae8('0x7f')]));}}}if(_0xfa814a[_0x9ae8('0x82')]){_0xfa814a[_0x9ae8('0x82')]=JSON['parse'](_0xfa814a[_0x9ae8('0x82')]);_0x10f2ab['where'](_0x18fd15(_0xfa814a['conditions'][_0x9ae8('0x66')]));}_0x4f8770=_0x10f2ab[_0x9ae8('0x83')]();_0x10f2ab[_0x9ae8('0x1c')](_0x50282b);_0x10f2ab[_0x9ae8('0x1a')](0x0);return;}})['then'](function(){if(_0x2ea5bd['output']===_0x9ae8('0x8f')){return null;}var _0x5c554e=_[_0x9ae8('0x40')](_0x2ea5bd,{'name':_0x2ea5bd[_0x9ae8('0x90')]||_0x2ea5bd[_0x9ae8('0x2b')]||_0xfa814a[_0x9ae8('0x2b')],'basename':_0x1034b9,'savename':util[_0x9ae8('0x77')]('%s-%s.%s',_0x2ea5bd[_0x9ae8('0x2b')]||_0xfa814a['name'],require(_0x9ae8('0x91'))[_0x9ae8('0x92')](0x4),_0x2ea5bd['output']||_0x9ae8('0x93')),'reportId':_0xfa814a['id'],'reportType':_0x9ae8('0x94')});return db[_0x9ae8('0x95')][_0x9ae8('0x49')](_0x5c554e,{'raw':!![]});})[_0x9ae8('0x27')](function(_0x37af0e){if(_0xfa814a[_0x9ae8('0x72')]==='cdr'){_0x4f8770[_0x9ae8('0x3c')](_0xfa814a[_0x9ae8('0x72')]+_0x9ae8('0x96'),_0x2ea5bd[_0x9ae8('0x97')],_0x2ea5bd['endDate']);}else{_0x4f8770['where'](_0xfa814a[_0x9ae8('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2ea5bd['startDate'],_0x2ea5bd['endDate']);}if(_0x37af0e){logger[_0x9ae8('0x98')](_0x9ae8('0x99'),_0x4f8770[_0x9ae8('0x86')]());require(_0x9ae8('0x9a'))[_0x9ae8('0x9b')](path[_0x9ae8('0x52')](__dirname,'../../components/export/',_0x37af0e['output']),[_0x37af0e['id'],_0x4f8770[_0x9ae8('0x86')](),path['join'](__dirname,'../../files/reports',_0x37af0e['savename']),_0x1034b9]);return _0x37af0e;}else{var _0x5d23af=squel[_0x9ae8('0x70')]();_0x5d23af[_0x9ae8('0x71')]('('+_0x4f8770[_0x9ae8('0x86')]()+')',_0x9ae8('0x9c'));_0x5d23af['field'](_0x9ae8('0x9d'),'count');_0x4f8770['limit'](_0x2ea5bd[_0x9ae8('0x1c')]||_0x50282b);_0x4f8770['offset'](_0x2ea5bd[_0x9ae8('0x1a')]||0x0);return dbH[_0x9ae8('0x87')][_0x9ae8('0x35')](_0x5d23af['toString'](),{'type':dbH[_0x9ae8('0x87')][_0x9ae8('0x88')][_0x9ae8('0x89')]})[_0x9ae8('0x27')](function(_0x2a250e){if(!_0x2a250e[_0x9ae8('0x46')]){_0x534a8e=0x0;}else{_0x534a8e=_0x2a250e[0x0][_0x9ae8('0x1d')]||0x0;}return dbH[_0x9ae8('0x87')][_0x9ae8('0x35')](_0x4f8770[_0x9ae8('0x86')](),{'type':dbH[_0x9ae8('0x87')]['QueryTypes'][_0x9ae8('0x89')]});})['then'](function(_0x4dfbe7){return{'rows':_0x4dfbe7||[],'count':_0x534a8e};});}});}exports[_0x9ae8('0x9e')]=function(_0x1dbce7,_0x1826f1){return runReport(_0x1dbce7[_0x9ae8('0x50')],_0x1dbce7[_0x9ae8('0x35')],_0x1dbce7[_0x9ae8('0x41')])['then'](respondWithResult(_0x1826f1,null))[_0x9ae8('0x48')](handleError(_0x1826f1,null));};exports[_0x9ae8('0x9f')]=runReport;exports[_0x9ae8('0x35')]=function(_0x4cb77a,_0x388235){var _0x5be2e5=0xa;var _0x14c36c=[_0x9ae8('0x52'),'left_join',_0x9ae8('0x8a'),_0x9ae8('0x54')];var _0x134f8e={'SUM':_0x9ae8('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9ae8('0x57'),'MAX':_0x9ae8('0x8b'),'MIN':_0x9ae8('0x58'),'AVG':_0x9ae8('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9ae8('0x5b'),'GROUP_CONCAT DESC':_0x9ae8('0x5c')};var _0x46265d={'SEC_TO_TIME':_0x9ae8('0x5d'),'DATE':_0x9ae8('0x5e'),'HOUR':_0x9ae8('0x5f'),'ROUND':_0x9ae8('0x60'),'UNIX_TIMESTAMP':_0x9ae8('0x61')};var _0x5d4f67=function(_0xae57e2){return!_['includes']([_0x9ae8('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9ae8('0x8d')],_0xae57e2);};var _0x24dec5=function(_0x1fcec5){if(!_0x1fcec5||!_0x1fcec5[_0x9ae8('0x65')][_0x9ae8('0x46')]){return'';}for(var _0x33ab29='(',_0x470f60=0x0;_0x470f60<_0x1fcec5[_0x9ae8('0x65')][_0x9ae8('0x46')];_0x470f60+=0x1){_0x470f60>0x0&&(_0x33ab29+='\x20'+_0x1fcec5[_0x9ae8('0xa0')]+'\x20');_0x33ab29+=_0x1fcec5[_0x9ae8('0x65')][_0x470f60][_0x9ae8('0x66')]?_0x24dec5(_0x1fcec5[_0x9ae8('0x65')][_0x470f60]['group']):_0x1fcec5['rules'][_0x470f60][_0x9ae8('0x67')]+'\x20'+_0x1fcec5['rules'][_0x470f60][_0x9ae8('0x68')]+(_0x5d4f67(_0x1fcec5[_0x9ae8('0x65')][_0x470f60][_0x9ae8('0x68')])?'\x20'+_0x1fcec5[_0x9ae8('0x65')][_0x470f60]['value']:'');}return _0x33ab29+')';};var _0xba76fe={'where':{'id':_0x4cb77a[_0x9ae8('0x50')]['id']}},_0x2b4fd1,_0x16626a,_0x3dc54b,_0x583450,_0x500729;_0xba76fe=_[_0x9ae8('0x40')]({},_0xba76fe,_0x4cb77a[_0x9ae8('0x41')]);return db[_0x9ae8('0x2f')][_0x9ae8('0x47')](_0xba76fe)[_0x9ae8('0x27')](function(_0x38d1be){if(_0x38d1be){_0x2b4fd1=_0x38d1be;return _0x38d1be[_0x9ae8('0x6a')]();}return null;})[_0x9ae8('0x27')](function(_0x3ce3ee){if(_0x3ce3ee){if(!_0x3ce3ee['length']){throw new db['Sequelize'][(_0x9ae8('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16626a=_0x3ce3ee;return db[_0x9ae8('0x6e')][_0x9ae8('0x43')]({'raw':!![]});}return null;})[_0x9ae8('0x27')](function(_0x28d6bb){if(_0x28d6bb){_0x3dc54b=_[_0x9ae8('0x6f')](_0x28d6bb,'id');var _0x1c07b2;var _0x1032b0=squel['select']();_0x1032b0[_0x9ae8('0x71')](_0x2b4fd1['table']);for(var _0x25f540=0x0;_0x25f540<_0x16626a[_0x9ae8('0x46')];_0x25f540+=0x1){_0x1c07b2=_0x16626a[_0x25f540][_0x9ae8('0x73')]?_0x3dc54b[_0x16626a[_0x25f540][_0x9ae8('0x73')]]['metric']:_0x16626a[_0x25f540][_0x9ae8('0x67')];_0x1c07b2=_0x16626a[_0x25f540][_0x9ae8('0x75')]?_['replace'](_0x134f8e[_0x16626a[_0x25f540][_0x9ae8('0x75')]],'%s',_0x1c07b2):_0x1c07b2;_0x1c07b2=_0x16626a[_0x25f540][_0x9ae8('0x77')]?_[_0x9ae8('0x76')](_0x46265d[_0x16626a[_0x25f540]['format']],'%s',_0x1c07b2):_0x1c07b2;if(_0x16626a[_0x25f540][_0x9ae8('0x78')]){_0x1032b0[_0x9ae8('0x66')](_0x1c07b2);}_0x16626a[_0x25f540][_0x9ae8('0x79')]&&_0x1032b0['order'](_0x1c07b2,_0x16626a[_0x25f540][_0x9ae8('0x79')]===_0x9ae8('0x7b')?![]:!![]);_0x1032b0[_0x9ae8('0x67')](_0x1c07b2,_0x16626a[_0x25f540]['alias']||_0x1c07b2);}if(_0x2b4fd1[_0x9ae8('0x7c')]){_0x2b4fd1['joins']=JSON['parse'](_0x2b4fd1[_0x9ae8('0x7c')]);for(var _0x34a613=0x0;_0x34a613<_0x2b4fd1[_0x9ae8('0x7c')]['length'];_0x34a613+=0x1){if(_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613][_0x9ae8('0x32')]&&_[_0x9ae8('0x62')](_0x14c36c,_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613]['type'])&&_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613]['parentKey']&&_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613]['foreignTable']&&_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613][_0x9ae8('0x7f')]){_0x1032b0[_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613][_0x9ae8('0x32')]](_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613][_0x9ae8('0x80')],null,util[_0x9ae8('0x77')](_0x9ae8('0x81'),_0x2b4fd1['table'],_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613]['parentKey'],_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613][_0x9ae8('0x80')],_0x2b4fd1[_0x9ae8('0x7c')][_0x34a613]['foreignKey']));}}}if(_0x2b4fd1[_0x9ae8('0x82')]){_0x2b4fd1[_0x9ae8('0x82')]=JSON[_0x9ae8('0x7d')](_0x2b4fd1[_0x9ae8('0x82')]);_0x1032b0[_0x9ae8('0x3c')](_0x24dec5(_0x2b4fd1[_0x9ae8('0x82')]['group']));}_0x500729=_0x1032b0[_0x9ae8('0x83')]();_0x1032b0[_0x9ae8('0x1c')](_0x5be2e5);_0x1032b0[_0x9ae8('0x1a')](0x0);logger[_0x9ae8('0x84')](_0x9ae8('0x85'),_0x1032b0['toString']());return dbH['sequelize'][_0x9ae8('0x35')](_0x1032b0[_0x9ae8('0x86')](),{'type':dbH[_0x9ae8('0x87')][_0x9ae8('0x88')][_0x9ae8('0x89')]});}})['then'](function(){return{'sql':_0x500729[_0x9ae8('0x86')]()};})[_0x9ae8('0x27')](respondWithResult(_0x388235,null))[_0x9ae8('0x48')](handleError(_0x388235,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 579ceca..15ba92e 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 _0xfdf6=['moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x4ba7bf,_0x437bad){var _0x26fd1d=function(_0x35d056){while(--_0x35d056){_0x4ba7bf['push'](_0x4ba7bf['shift']());}};_0x26fd1d(++_0x437bad);}(_0xfdf6,0x105));var _0x6fdf=function(_0x5b4ef4,_0x3c4308){_0x5b4ef4=_0x5b4ef4-0x0;var _0x5da06d=_0xfdf6[_0x5b4ef4];return _0x5da06d;};'use strict';var _=require('lodash');var util=require(_0x6fdf('0x0'));var logger=require(_0x6fdf('0x1'))(_0x6fdf('0x2'));var moment=require(_0x6fdf('0x3'));var BPromise=require(_0x6fdf('0x4'));var rp=require(_0x6fdf('0x5'));var fs=require('fs');var path=require(_0x6fdf('0x6'));var rimraf=require('rimraf');var config=require(_0x6fdf('0x7'));var attributes=require(_0x6fdf('0x8'));module['exports']=function(_0x2fa45a,_0x2cc385){return _0x2fa45a[_0x6fdf('0x9')](_0x6fdf('0xa'),attributes,{'tableName':_0x6fdf('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8741=['moment','bluebird','path','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8741,0x173));var _0x1874=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8741[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1874('0x0'));var logger=require(_0x1874('0x1'))(_0x1874('0x2'));var moment=require(_0x1874('0x3'));var BPromise=require(_0x1874('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1874('0x5'));var rimraf=require(_0x1874('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x1874('0x7')]=function(_0x5ce91a,_0x79f9cf){return _0x5ce91a[_0x1874('0x8')](_0x1874('0x9'),attributes,{'tableName':_0x1874('0xa'),'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 38a4d66..2fe80a8 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 _0x96aa=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x1b5861,_0x2ebf04){var _0x1f46e6=function(_0x104914){while(--_0x104914){_0x1b5861['push'](_0x1b5861['shift']());}};_0x1f46e6(++_0x2ebf04);}(_0x96aa,0x75));var _0xa96a=function(_0x2c1b9f,_0x4d122b){_0x2c1b9f=_0x2c1b9f-0x0;var _0x46d07e=_0x96aa[_0x2c1b9f];return _0x46d07e;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require(_0xa96a('0x2'));var BPromise=require(_0xa96a('0x3'));var rs=require(_0xa96a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require(_0xa96a('0x7'))(_0xa96a('0x8'));var config=require(_0xa96a('0x9'));var jayson=require(_0xa96a('0xa'));var client=jayson[_0xa96a('0xb')][_0xa96a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c1de1,_0x4ec852,_0x47825d){return new BPromise(function(_0x2ea0ee,_0x542f93){return client['request'](_0x5c1de1,_0x47825d)['then'](function(_0x22415a){logger[_0xa96a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4ec852,'request\x20sent');logger[_0xa96a('0xe')](_0xa96a('0xf'),_0x4ec852,_0xa96a('0x10'),JSON[_0xa96a('0x11')](_0x22415a));if(_0x22415a['error']){if(_0x22415a['error'][_0xa96a('0x12')]===0x1f4){logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x22415a[_0xa96a('0x13')][_0xa96a('0x15')]);return _0x542f93(_0x22415a['error']['message']);}logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x22415a[_0xa96a('0x13')]['message']);return _0x2ea0ee(_0x22415a[_0xa96a('0x13')][_0xa96a('0x15')]);}else{logger[_0xa96a('0xd')](_0xa96a('0x14'),_0x4ec852,_0xa96a('0x10'));_0x2ea0ee(_0x22415a[_0xa96a('0x16')][_0xa96a('0x15')]);}})['catch'](function(_0x109762){logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x109762);_0x542f93(_0x109762);});});} \ No newline at end of file +var _0x20ff=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x20ff,0x1c9));var _0xf20f=function(_0x17804d,_0x297381){_0x17804d=_0x17804d-0x0;var _0x27fcc8=_0x20ff[_0x17804d];return _0x27fcc8;};'use strict';var _=require('lodash');var util=require(_0xf20f('0x0'));var moment=require('moment');var BPromise=require(_0xf20f('0x1'));var rs=require(_0xf20f('0x2'));var fs=require('fs');var Redis=require(_0xf20f('0x3'));var db=require(_0xf20f('0x4'))['db'];var utils=require(_0xf20f('0x5'));var logger=require(_0xf20f('0x6'))('rpc');var config=require(_0xf20f('0x7'));var jayson=require(_0xf20f('0x8'));var client=jayson[_0xf20f('0x9')][_0xf20f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c452e,_0x3729a5,_0x191853){return new BPromise(function(_0x458f80,_0x47febc){return client[_0xf20f('0xb')](_0x5c452e,_0x191853)[_0xf20f('0xc')](function(_0x8224f4){logger[_0xf20f('0xd')](_0xf20f('0xe'),_0x3729a5,_0xf20f('0xf'));logger[_0xf20f('0x10')](_0xf20f('0x11'),_0x3729a5,_0xf20f('0xf'),JSON['stringify'](_0x8224f4));if(_0x8224f4['error']){if(_0x8224f4[_0xf20f('0x12')][_0xf20f('0x13')]===0x1f4){logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x3729a5,_0x8224f4[_0xf20f('0x12')][_0xf20f('0x14')]);return _0x47febc(_0x8224f4[_0xf20f('0x12')][_0xf20f('0x14')]);}logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x3729a5,_0x8224f4['error'][_0xf20f('0x14')]);return _0x458f80(_0x8224f4[_0xf20f('0x12')]['message']);}else{logger[_0xf20f('0xd')](_0xf20f('0xe'),_0x3729a5,_0xf20f('0xf'));_0x458f80(_0x8224f4[_0xf20f('0x15')][_0xf20f('0x14')]);}})[_0xf20f('0x16')](function(_0x4029f4){logger[_0xf20f('0x12')](_0xf20f('0xe'),_0x3729a5,_0x4029f4);_0x47febc(_0x4029f4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index f3e6b9e..fa96b10 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 _0xee6f=['query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query'];(function(_0x1647d2,_0x3ec152){var _0xd766d9=function(_0x3bdff7){while(--_0x3bdff7){_0x1647d2['push'](_0x1647d2['shift']());}};_0xd766d9(++_0x3ec152);}(_0xee6f,0x6b));var _0xfee6=function(_0x452af7,_0x993b24){_0x452af7=_0x452af7-0x0;var _0x16a885=_0xee6f[_0x452af7];return _0x16a885;};'use strict';var multer=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var path=require(_0xfee6('0x2'));var timeout=require(_0xfee6('0x3'));var express=require('express');var router=express[_0xfee6('0x4')]();var fs_extra=require(_0xfee6('0x5'));var auth=require(_0xfee6('0x6'));var interaction=require(_0xfee6('0x7'));var config=require(_0xfee6('0x8'));var controller=require(_0xfee6('0x9'));router[_0xfee6('0xa')]('/',auth[_0xfee6('0xb')](),controller[_0xfee6('0xc')]);router[_0xfee6('0xa')](_0xfee6('0xd'),auth[_0xfee6('0xb')](),controller['show']);router[_0xfee6('0xa')]('/:id/preview',auth[_0xfee6('0xb')](),controller[_0xfee6('0xe')]);router[_0xfee6('0xa')](_0xfee6('0xf'),auth[_0xfee6('0xb')](),controller[_0xfee6('0x10')]);router['get'](_0xfee6('0x11'),auth[_0xfee6('0xb')](),controller[_0xfee6('0x12')]);router[_0xfee6('0x13')]('/',auth[_0xfee6('0xb')](),controller['create']);router[_0xfee6('0x14')](_0xfee6('0xd'),auth['isAuthenticated'](),controller[_0xfee6('0x15')]);router[_0xfee6('0x16')](_0xfee6('0xd'),auth['isAuthenticated'](),controller[_0xfee6('0x17')]);module[_0xfee6('0x18')]=router; \ No newline at end of file +var _0xa1b8=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','query','post','put','destroy'];(function(_0x132d31,_0x11bd12){var _0x3e0ebe=function(_0x26bba2){while(--_0x26bba2){_0x132d31['push'](_0x132d31['shift']());}};_0x3e0ebe(++_0x11bd12);}(_0xa1b8,0x1e1));var _0x8a1b=function(_0x1c8ac4,_0x559fd8){_0x1c8ac4=_0x1c8ac4-0x0;var _0x466643=_0xa1b8[_0x1c8ac4];return _0x466643;};'use strict';var multer=require(_0x8a1b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a1b('0x1'));var express=require('express');var router=express[_0x8a1b('0x2')]();var fs_extra=require(_0x8a1b('0x3'));var auth=require(_0x8a1b('0x4'));var interaction=require(_0x8a1b('0x5'));var config=require(_0x8a1b('0x6'));var controller=require(_0x8a1b('0x7'));router[_0x8a1b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8a1b('0x8')](_0x8a1b('0x9'),auth[_0x8a1b('0xa')](),controller['show']);router[_0x8a1b('0x8')](_0x8a1b('0xb'),auth[_0x8a1b('0xa')](),controller[_0x8a1b('0xc')]);router[_0x8a1b('0x8')](_0x8a1b('0xd'),auth[_0x8a1b('0xa')](),controller[_0x8a1b('0xe')]);router[_0x8a1b('0x8')]('/:id/query',auth[_0x8a1b('0xa')](),controller[_0x8a1b('0xf')]);router[_0x8a1b('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8a1b('0x11')]('/:id',auth[_0x8a1b('0xa')](),controller['update']);router['delete']('/:id',auth[_0x8a1b('0xa')](),controller[_0x8a1b('0x12')]);module[_0x8a1b('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 951d018..f919c27 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 _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x48d7ce,_0x1afb31){var _0x4d82b4=function(_0x2d4e5f){while(--_0x2d4e5f){_0x48d7ce['push'](_0x48d7ce['shift']());}};_0x4d82b4(++_0x1afb31);}(_0x53ec,0x192));var _0xc53e=function(_0x193bef,_0x229b65){_0x193bef=_0x193bef-0x0;var _0x4c725e=_0x53ec[_0x193bef];return _0x4c725e;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x1f909a,_0x15d56f){var _0x543f16=function(_0x17a991){while(--_0x17a991){_0x1f909a['push'](_0x1f909a['shift']());}};_0x543f16(++_0x15d56f);}(_0x5075,0x73));var _0x5507=function(_0x51a85c,_0x2660a3){_0x51a85c=_0x51a85c-0x0;var _0x55001f=_0x5075[_0x51a85c];return _0x55001f;};'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/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 354f252..464e29e 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x1b0a9d,_0x45a72a){var _0x719225=function(_0x5038d9){while(--_0x5038d9){_0x1b0a9d['push'](_0x1b0a9d['shift']());}};_0x719225(++_0x45a72a);}(_0x2675,0x75));var _0x5267=function(_0x25dcb2,_0x555f38){_0x25dcb2=_0x25dcb2-0x0;var _0x570978=_0x2675[_0x25dcb2];return _0x570978;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4ae459,_0x3bf329){var _0x51d0c9=function(_0x1ce66b){while(--_0x1ce66b){_0x4ae459['push'](_0x4ae459['shift']());}};_0x51d0c9(++_0x3bf329);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ff0a581..9119ea4 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 _0xb4c0=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x4f1ca2,_0x1434e2){var _0x261959=function(_0x48bdcd){while(--_0x48bdcd){_0x4f1ca2['push'](_0x4f1ca2['shift']());}};_0x261959(++_0x1434e2);}(_0xb4c0,0xb7));var _0x0b4c=function(_0x4d45fd,_0x16b74c){_0x4d45fd=_0x4d45fd-0x0;var _0x2b5aa5=_0xb4c0[_0x4d45fd];return _0x2b5aa5;};'use strict';var _=require(_0x0b4c('0x0'));var util=require(_0x0b4c('0x1'));var logger=require(_0x0b4c('0x2'))(_0x0b4c('0x3'));var moment=require(_0x0b4c('0x4'));var BPromise=require(_0x0b4c('0x5'));var rp=require(_0x0b4c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b4c('0x7'));var config=require(_0x0b4c('0x8'));var attributes=require(_0x0b4c('0x9'));module[_0x0b4c('0xa')]=function(_0x50c321,_0x3090f9){return _0x50c321['define'](_0x0b4c('0xb'),attributes,{'tableName':_0x0b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb85e=['../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb85e,0xd1));var _0xeb85=function(_0x5645ad,_0x580ea3){_0x5645ad=_0x5645ad-0x0;var _0x17d292=_0xb85e[_0x5645ad];return _0x17d292;};'use strict';var _=require('lodash');var util=require(_0xeb85('0x0'));var logger=require(_0xeb85('0x1'))('api');var moment=require(_0xeb85('0x2'));var BPromise=require(_0xeb85('0x3'));var rp=require(_0xeb85('0x4'));var fs=require('fs');var path=require(_0xeb85('0x5'));var rimraf=require(_0xeb85('0x6'));var config=require(_0xeb85('0x7'));var attributes=require(_0xeb85('0x8'));module[_0xeb85('0x9')]=function(_0x59088c,_0xbf550d){return _0x59088c[_0xeb85('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xeb85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2432272..e65b2c4 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 _0x4c9b=['error','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','message'];(function(_0x15750c,_0x21b27e){var _0x90d55f=function(_0x46f00a){while(--_0x46f00a){_0x15750c['push'](_0x15750c['shift']());}};_0x90d55f(++_0x21b27e);}(_0x4c9b,0xde));var _0xb4c9=function(_0x1ef863,_0x3d7b1f){_0x1ef863=_0x1ef863-0x0;var _0x3a18ab=_0x4c9b[_0x1ef863];return _0x3a18ab;};'use strict';var _=require(_0xb4c9('0x0'));var util=require('util');var moment=require(_0xb4c9('0x1'));var BPromise=require(_0xb4c9('0x2'));var rs=require(_0xb4c9('0x3'));var fs=require('fs');var Redis=require(_0xb4c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4c9('0x5'));var logger=require('../../config/logger')(_0xb4c9('0x6'));var config=require(_0xb4c9('0x7'));var jayson=require(_0xb4c9('0x8'));var client=jayson[_0xb4c9('0x9')][_0xb4c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e5f0,_0x1edc5e,_0x3d6987){return new BPromise(function(_0xd62bd2,_0x53385e){return client[_0xb4c9('0xb')](_0x46e5f0,_0x3d6987)[_0xb4c9('0xc')](function(_0x4622d8){logger[_0xb4c9('0xd')](_0xb4c9('0xe'),_0x1edc5e,_0xb4c9('0xf'));logger[_0xb4c9('0x10')](_0xb4c9('0x11'),_0x1edc5e,_0xb4c9('0xf'),JSON[_0xb4c9('0x12')](_0x4622d8));if(_0x4622d8['error']){if(_0x4622d8['error']['code']===0x1f4){logger['error'](_0xb4c9('0xe'),_0x1edc5e,_0x4622d8['error']['message']);return _0x53385e(_0x4622d8['error'][_0xb4c9('0x13')]);}logger[_0xb4c9('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1edc5e,_0x4622d8['error'][_0xb4c9('0x13')]);return _0xd62bd2(_0x4622d8['error'][_0xb4c9('0x13')]);}else{logger['info'](_0xb4c9('0xe'),_0x1edc5e,_0xb4c9('0xf'));_0xd62bd2(_0x4622d8[_0xb4c9('0x15')][_0xb4c9('0x13')]);}})['catch'](function(_0x2fb314){logger[_0xb4c9('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1edc5e,_0x2fb314);_0x53385e(_0x2fb314);});});} \ No newline at end of file +var _0x086c=['rpc','../../config/environment','jayson/promise','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x54ac2b,_0x51f6dd){var _0x5b1586=function(_0x11912d){while(--_0x11912d){_0x54ac2b['push'](_0x54ac2b['shift']());}};_0x5b1586(++_0x51f6dd);}(_0x086c,0xfa));var _0xc086=function(_0x353856,_0x5ce89d){_0x353856=_0x353856-0x0;var _0xa58048=_0x086c[_0x353856];return _0xa58048;};'use strict';var _=require(_0xc086('0x0'));var util=require('util');var moment=require(_0xc086('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc086('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc086('0x3'));var logger=require(_0xc086('0x4'))(_0xc086('0x5'));var config=require(_0xc086('0x6'));var jayson=require(_0xc086('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce271,_0x5509bb,_0x2853c8){return new BPromise(function(_0x5b72a7,_0x5c1bb7){return client['request'](_0x1ce271,_0x2853c8)['then'](function(_0x14e325){logger[_0xc086('0x8')](_0xc086('0x9'),_0x5509bb,_0xc086('0xa'));logger[_0xc086('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x5509bb,_0xc086('0xa'),JSON[_0xc086('0xc')](_0x14e325));if(_0x14e325[_0xc086('0xd')]){if(_0x14e325['error']['code']===0x1f4){logger[_0xc086('0xd')](_0xc086('0x9'),_0x5509bb,_0x14e325[_0xc086('0xd')][_0xc086('0xe')]);return _0x5c1bb7(_0x14e325[_0xc086('0xd')][_0xc086('0xe')]);}logger[_0xc086('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5509bb,_0x14e325[_0xc086('0xd')][_0xc086('0xe')]);return _0x5b72a7(_0x14e325[_0xc086('0xd')]['message']);}else{logger[_0xc086('0x8')](_0xc086('0x9'),_0x5509bb,'request\x20sent');_0x5b72a7(_0x14e325[_0xc086('0xf')][_0xc086('0xe')]);}})[_0xc086('0x10')](function(_0x15542b){logger['error'](_0xc086('0x9'),_0x5509bb,_0x15542b);_0x5c1bb7(_0x15542b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 35bdca5..0227dac 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 _0xf8c8=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query','post','create','put'];(function(_0x373205,_0x29d2ca){var _0x296652=function(_0x3fa822){while(--_0x3fa822){_0x373205['push'](_0x373205['shift']());}};_0x296652(++_0x29d2ca);}(_0xf8c8,0x118));var _0x8f8c=function(_0x36f462,_0x1b611a){_0x36f462=_0x36f462-0x0;var _0x4c30d3=_0xf8c8[_0x36f462];return _0x4c30d3;};'use strict';var multer=require(_0x8f8c('0x0'));var util=require(_0x8f8c('0x1'));var path=require('path');var timeout=require(_0x8f8c('0x2'));var express=require(_0x8f8c('0x3'));var router=express['Router']();var fs_extra=require(_0x8f8c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f8c('0x5'));var config=require(_0x8f8c('0x6'));var controller=require(_0x8f8c('0x7'));router[_0x8f8c('0x8')]('/',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8f8c('0xb')]);router[_0x8f8c('0x8')](_0x8f8c('0xc'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xd')]);router[_0x8f8c('0x8')](_0x8f8c('0xe'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xf')]);router[_0x8f8c('0x8')]('/:id/query',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x10')]);router[_0x8f8c('0x11')]('/',auth['isAuthenticated'](),controller[_0x8f8c('0x12')]);router[_0x8f8c('0x13')](_0x8f8c('0x14'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x15')]);router[_0x8f8c('0x16')]('/:id',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x17')]);module[_0x8f8c('0x18')]=router; \ No newline at end of file +var _0x352d=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','post','put','update','delete','destroy','multer'];(function(_0x4dda11,_0x4fc4c4){var _0x5a61a2=function(_0x45fe5c){while(--_0x45fe5c){_0x4dda11['push'](_0x4dda11['shift']());}};_0x5a61a2(++_0x4fc4c4);}(_0x352d,0x133));var _0xd352=function(_0x3ce6e8,_0x150292){_0x3ce6e8=_0x3ce6e8-0x0;var _0x214088=_0x352d[_0x3ce6e8];return _0x214088;};'use strict';var multer=require(_0xd352('0x0'));var util=require(_0xd352('0x1'));var path=require(_0xd352('0x2'));var timeout=require(_0xd352('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd352('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd352('0x5'));var config=require(_0xd352('0x6'));var controller=require(_0xd352('0x7'));router[_0xd352('0x8')]('/',auth[_0xd352('0x9')](),controller[_0xd352('0xa')]);router['get'](_0xd352('0xb'),auth[_0xd352('0x9')](),controller[_0xd352('0xc')]);router[_0xd352('0x8')](_0xd352('0xd'),auth[_0xd352('0x9')](),controller['preview']);router[_0xd352('0x8')](_0xd352('0xe'),auth[_0xd352('0x9')](),controller[_0xd352('0xf')]);router[_0xd352('0x8')](_0xd352('0x10'),auth['isAuthenticated'](),controller['query']);router[_0xd352('0x11')]('/',auth[_0xd352('0x9')](),controller['create']);router[_0xd352('0x12')](_0xd352('0xb'),auth[_0xd352('0x9')](),controller[_0xd352('0x13')]);router[_0xd352('0x14')](_0xd352('0xb'),auth['isAuthenticated'](),controller[_0xd352('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8f6a4af..a70b464 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 _0x6004=['xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x213ef8,_0x5fae78){var _0x5c4f00=function(_0x126c1c){while(--_0x126c1c){_0x213ef8['push'](_0x213ef8['shift']());}};_0x5c4f00(++_0x5fae78);}(_0x6004,0x17a));var _0x4600=function(_0x527a6c,_0x15b18d){_0x527a6c=_0x527a6c-0x0;var _0x4c780d=_0x6004[_0x527a6c];return _0x4c780d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4600('0x0'));module[_0x4600('0x1')]={'name':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x4600('0x3')](_0x4600('0x4'),_0x4600('0x5'),_0x4600('0x6')),'allowNull':![],'defaultValue':_0x4600('0x4')},'savename':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4600('0x7')]},'endDate':{'type':Sequelize[_0x4600('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4600('0x8')},'type':{'type':Sequelize[_0x4600('0x3')](_0x4600('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x4600('0x9')},'reportId':{'type':Sequelize[_0x4600('0xa')](0xb)[_0x4600('0xb')]},'reportType':{'type':Sequelize[_0x4600('0x2')]}}; \ No newline at end of file +var _0x31da=['manual','scheduled','INTEGER','UNSIGNED','moment','exports','STRING','csv','pdf','DATE','Loading'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x31da,0x1c7));var _0xa31d=function(_0x3cd0c2,_0x1c341d){_0x3cd0c2=_0x3cd0c2-0x0;var _0x128d9f=_0x31da[_0x3cd0c2];return _0x128d9f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa31d('0x0'));module[_0xa31d('0x1')]={'name':{'type':Sequelize[_0xa31d('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa31d('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xa31d('0x3'),_0xa31d('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0xa31d('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xa31d('0x5')]},'status':{'type':Sequelize[_0xa31d('0x2')],'defaultValue':_0xa31d('0x6')},'type':{'type':Sequelize['ENUM'](_0xa31d('0x7'),_0xa31d('0x8')),'allowNull':![],'defaultValue':_0xa31d('0x7')},'reportId':{'type':Sequelize[_0xa31d('0x9')](0xb)[_0xa31d('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 33e5375..5333220 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 _0x6a5f=['merge','VIRTUAL','filter','options','includeAll','include','rows','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','sendStatus','download','join','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','update','then','get','ExtractedReports','UserProfileResource','destroy','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick'];(function(_0x5956ae,_0x152484){var _0x2cff03=function(_0x665c5c){while(--_0x665c5c){_0x5956ae['push'](_0x5956ae['shift']());}};_0x2cff03(++_0x152484);}(_0x6a5f,0xcb));var _0xf6a5=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x6a5f[_0x25a136];return _0x5b7159;};'use strict';var emlformat=require(_0xf6a5('0x0'));var rimraf=require(_0xf6a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6a5('0x2'));var rp=require(_0xf6a5('0x3'));var moment=require(_0xf6a5('0x4'));var BPromise=require(_0xf6a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf6a5('0x6'));var csv=require('to-csv');var ejs=require(_0xf6a5('0x7'));var fs=require('fs');var fs_extra=require(_0xf6a5('0x8'));var _=require(_0xf6a5('0x9'));var squel=require('squel');var crypto=require(_0xf6a5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf6a5('0xb'));var toCsv=require(_0xf6a5('0xc'));var querystring=require(_0xf6a5('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6a5('0xe'));var authService=require(_0xf6a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6a5('0x11'))(_0xf6a5('0x12'));var utils=require(_0xf6a5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf6a5('0x14'));var db=require(_0xf6a5('0x15'))['db'];function respondWithStatusCode(_0x5f44d5,_0x2d431a){_0x2d431a=_0x2d431a||0xcc;return function(_0x1822cf){if(_0x1822cf){return _0x5f44d5['sendStatus'](_0x2d431a);}return _0x5f44d5['status'](_0x2d431a)[_0xf6a5('0x16')]();};}function respondWithResult(_0x13b8cf,_0x27ef29){_0x27ef29=_0x27ef29||0xc8;return function(_0x4401ff){if(_0x4401ff){return _0x13b8cf[_0xf6a5('0x17')](_0x27ef29)[_0xf6a5('0x18')](_0x4401ff);}};}function respondWithFilteredResult(_0x58f508,_0x5b3c33){return function(_0x5a30f5){if(_0x5a30f5){var _0x15d5a7=typeof _0x5b3c33[_0xf6a5('0x19')]===_0xf6a5('0x1a')&&typeof _0x5b3c33[_0xf6a5('0x1b')]===_0xf6a5('0x1a');var _0x1032fb=_0x5a30f5[_0xf6a5('0x1c')];var _0x27fd61=_0x15d5a7?0x0:_0x5b3c33[_0xf6a5('0x19')];var _0x3218f0=_0x15d5a7?_0x5a30f5[_0xf6a5('0x1c')]:_0x5b3c33[_0xf6a5('0x19')]+_0x5b3c33[_0xf6a5('0x1b')];var _0x212c31;if(_0x3218f0>=_0x1032fb){_0x3218f0=_0x1032fb;_0x212c31=0xc8;}else{_0x212c31=0xce;}_0x58f508[_0xf6a5('0x17')](_0x212c31);return _0x58f508[_0xf6a5('0x1d')]('Content-Range',_0x27fd61+'-'+_0x3218f0+'/'+_0x1032fb)[_0xf6a5('0x18')](_0x5a30f5);}return null;};}function patchUpdates(_0xaa82b){return function(_0x44db39){try{jsonpatch['apply'](_0x44db39,_0xaa82b,!![]);}catch(_0x154c0f){return BPromise['reject'](_0x154c0f);}return _0x44db39['save']();};}function saveUpdates(_0x3dcb7d,_0x185ccf){return function(_0xe1b55a){if(_0xe1b55a){return _0xe1b55a[_0xf6a5('0x1e')](_0x3dcb7d)[_0xf6a5('0x1f')](function(_0x254f0b){return _0x254f0b;});}return null;};}function removeEntity(_0x138b53,_0x2f953a){return function(_0x4bef75){if(_0x4bef75){return _0x4bef75['destroy']()['then'](function(){var _0x541365=_0x4bef75[_0xf6a5('0x20')]({'plain':!![]});var _0x567267=_0xf6a5('0x21');return db[_0xf6a5('0x22')][_0xf6a5('0x23')]({'where':{'type':_0x567267,'resourceId':_0x541365['id']}})[_0xf6a5('0x1f')](function(){return _0x4bef75;});})[_0xf6a5('0x1f')](function(){_0x138b53['status'](0xcc)[_0xf6a5('0x16')]();});}};}function handleEntityNotFound(_0x5ba666,_0x1ba68d){return function(_0x330140){if(!_0x330140){_0x5ba666['sendStatus'](0x194);}return _0x330140;};}function handleError(_0x51de8d,_0x195263){_0x195263=_0x195263||0x1f4;return function(_0x29f2a8){logger['error'](_0x29f2a8['stack']);if(_0x29f2a8[_0xf6a5('0x24')]){delete _0x29f2a8['name'];}_0x51de8d[_0xf6a5('0x17')](_0x195263)['send'](_0x29f2a8);};}exports[_0xf6a5('0x25')]=function(_0x286017,_0x3b2d76){var _0x2aa9a8={},_0x33d6ae={},_0x131efd={'count':0x0,'rows':[]};var _0x51ff85=_[_0xf6a5('0x26')](db[_0xf6a5('0x27')][_0xf6a5('0x28')],function(_0x10de7f){return{'name':_0x10de7f[_0xf6a5('0x29')],'type':_0x10de7f[_0xf6a5('0x2a')][_0xf6a5('0x2b')]};});_0x33d6ae[_0xf6a5('0x2c')]=_[_0xf6a5('0x26')](_0x51ff85,_0xf6a5('0x24'));_0x33d6ae['query']=_['keys'](_0x286017['query']);_0x33d6ae['filters']=_['intersection'](_0x33d6ae[_0xf6a5('0x2c')],_0x33d6ae[_0xf6a5('0x2d')]);_0x2aa9a8['attributes']=_[_0xf6a5('0x2e')](_0x33d6ae[_0xf6a5('0x2c')],qs['fields'](_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x2f')]));_0x2aa9a8[_0xf6a5('0x30')]=_0x2aa9a8['attributes']['length']?_0x2aa9a8[_0xf6a5('0x30')]:_0x33d6ae[_0xf6a5('0x2c')];if(!_0x286017[_0xf6a5('0x2d')]['hasOwnProperty'](_0xf6a5('0x31'))){_0x2aa9a8[_0xf6a5('0x1b')]=qs[_0xf6a5('0x1b')](_0x286017[_0xf6a5('0x2d')]['limit']);_0x2aa9a8['offset']=qs[_0xf6a5('0x19')](_0x286017[_0xf6a5('0x2d')]['offset']);}_0x2aa9a8[_0xf6a5('0x32')]=qs['sort'](_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x33')]);_0x2aa9a8[_0xf6a5('0x34')]=qs[_0xf6a5('0x35')](_[_0xf6a5('0x36')](_0x286017['query'],_0x33d6ae[_0xf6a5('0x35')]),_0x51ff85);if(_0x286017[_0xf6a5('0x2d')]['filter']){_0x2aa9a8[_0xf6a5('0x34')]=_[_0xf6a5('0x37')](_0x2aa9a8[_0xf6a5('0x34')],{'$or':_[_0xf6a5('0x26')](_0x51ff85,function(_0x28f15d){if(_0x28f15d[_0xf6a5('0x2a')]!==_0xf6a5('0x38')){var _0x119da5={};_0x119da5[_0x28f15d[_0xf6a5('0x24')]]={'$like':'%'+_0x286017['query'][_0xf6a5('0x39')]+'%'};return _0x119da5;}})});}_0x2aa9a8=_[_0xf6a5('0x37')]({},_0x2aa9a8,_0x286017[_0xf6a5('0x3a')]);var _0x171bd6={'where':_0x2aa9a8[_0xf6a5('0x34')]};return db[_0xf6a5('0x27')]['count'](_0x171bd6)[_0xf6a5('0x1f')](function(_0xfd3593){_0x131efd[_0xf6a5('0x1c')]=_0xfd3593;if(_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x3b')]){_0x2aa9a8[_0xf6a5('0x3c')]=[{'all':!![]}];}return db[_0xf6a5('0x27')]['findAll'](_0x2aa9a8);})['then'](function(_0x2d24d3){_0x131efd[_0xf6a5('0x3d')]=_0x2d24d3;return _0x131efd;})[_0xf6a5('0x1f')](respondWithFilteredResult(_0x3b2d76,_0x2aa9a8))['catch'](handleError(_0x3b2d76,null));};exports['show']=function(_0x29f291,_0x59100b){var _0x1b608a={'raw':!![],'where':{'id':_0x29f291['params']['id']}},_0x545b18={};_0x545b18['model']=_[_0xf6a5('0x3e')](db['AnalyticExtractedReport']['rawAttributes']);_0x545b18[_0xf6a5('0x2d')]=_[_0xf6a5('0x3e')](_0x29f291[_0xf6a5('0x2d')]);_0x545b18[_0xf6a5('0x35')]=_[_0xf6a5('0x2e')](_0x545b18[_0xf6a5('0x2c')],_0x545b18['query']);_0x1b608a['attributes']=_['intersection'](_0x545b18[_0xf6a5('0x2c')],qs['fields'](_0x29f291[_0xf6a5('0x2d')][_0xf6a5('0x2f')]));_0x1b608a['attributes']=_0x1b608a[_0xf6a5('0x30')]['length']?_0x1b608a[_0xf6a5('0x30')]:_0x545b18['model'];if(_0x29f291['query'][_0xf6a5('0x3b')]){_0x1b608a[_0xf6a5('0x3c')]=[{'all':!![]}];}_0x1b608a=_['merge']({},_0x1b608a,_0x29f291[_0xf6a5('0x3a')]);return db[_0xf6a5('0x27')][_0xf6a5('0x3f')](_0x1b608a)[_0xf6a5('0x1f')](handleEntityNotFound(_0x59100b,null))[_0xf6a5('0x1f')](respondWithResult(_0x59100b,null))[_0xf6a5('0x40')](handleError(_0x59100b,null));};exports[_0xf6a5('0x41')]=function(_0x397288,_0x1afc47){return db[_0xf6a5('0x27')]['create'](_0x397288[_0xf6a5('0x42')],{})[_0xf6a5('0x1f')](function(_0x1ed7d8){var _0x1207d4=_0x397288['user'][_0xf6a5('0x20')]({'plain':!![]});if(!_0x1207d4)throw new Error(_0xf6a5('0x43'));if(_0x1207d4[_0xf6a5('0x44')]==='user'){var _0x1ec666=_0x1ed7d8[_0xf6a5('0x20')]({'plain':!![]});var _0x161b86=_0xf6a5('0x21');return db[_0xf6a5('0x45')][_0xf6a5('0x3f')]({'where':{'name':_0x161b86,'userProfileId':_0x1207d4['userProfileId']},'raw':!![]})['then'](function(_0x3ee6b5){if(_0x3ee6b5&&_0x3ee6b5['autoAssociation']===0x0){return db[_0xf6a5('0x22')]['create']({'name':_0x1ec666['name'],'resourceId':_0x1ec666['id'],'type':_0x3ee6b5[_0xf6a5('0x24')],'sectionId':_0x3ee6b5['id']},{})[_0xf6a5('0x1f')](function(){return _0x1ed7d8;});}else{return _0x1ed7d8;}})['catch'](function(_0x38f56e){logger[_0xf6a5('0x46')](_0xf6a5('0x47'),_0x38f56e);throw _0x38f56e;});}return _0x1ed7d8;})['then'](respondWithResult(_0x1afc47,0xc9))[_0xf6a5('0x40')](handleError(_0x1afc47,null));};exports[_0xf6a5('0x1e')]=function(_0x137217,_0x25bf83){if(_0x137217['body']['id']){delete _0x137217[_0xf6a5('0x42')]['id'];}return db[_0xf6a5('0x27')][_0xf6a5('0x3f')]({'where':{'id':_0x137217[_0xf6a5('0x48')]['id']}})[_0xf6a5('0x1f')](handleEntityNotFound(_0x25bf83,null))['then'](saveUpdates(_0x137217[_0xf6a5('0x42')],null))[_0xf6a5('0x1f')](respondWithResult(_0x25bf83,null))[_0xf6a5('0x40')](handleError(_0x25bf83,null));};exports[_0xf6a5('0x23')]=function(_0xacb96f,_0x28197d){return db[_0xf6a5('0x27')]['find']({'where':{'id':_0xacb96f[_0xf6a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x28197d,null))[_0xf6a5('0x1f')](removeEntity(_0x28197d,null))[_0xf6a5('0x40')](handleError(_0x28197d,null));};exports['download']=function(_0x36f71a,_0x43da76,_0xfbc0f7){return db[_0xf6a5('0x27')][_0xf6a5('0x3f')]({'where':{'id':_0x36f71a[_0xf6a5('0x48')]['id']},'attributes':[_0xf6a5('0x24'),_0xf6a5('0x49'),_0xf6a5('0x4a'),'output'],'raw':!![]})[_0xf6a5('0x1f')](handleEntityNotFound(_0x43da76,null))['then'](function(_0x44601a){if(_0x44601a){if(!fs[_0xf6a5('0x4b')](path['join'](config['root'],_0xf6a5('0x4c'),_0x44601a[_0xf6a5('0x4a')]))){throw new db[(_0xf6a5('0x4d'))][(_0xf6a5('0x4e'))](_0xf6a5('0x4f'));}if(_0x36f71a[_0xf6a5('0x2d')]['exists']){return _0x43da76[_0xf6a5('0x50')](0xc8);}return _0x43da76[_0xf6a5('0x51')](path[_0xf6a5('0x52')](config['root'],_0xf6a5('0x4c'),_0x44601a['savename']),util[_0xf6a5('0x53')](_0xf6a5('0x54'),_0x44601a[_0xf6a5('0x49')]||_0x44601a[_0xf6a5('0x24')],_0x44601a['output'][_0xf6a5('0x55')]()));}})['catch'](handleError(_0x43da76,null));}; \ No newline at end of file +var _0x37a0=['send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','join','root','server/files/reports','ValidationError','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','json','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','name'];(function(_0x487524,_0x292ba6){var _0x3f3543=function(_0xaba548){while(--_0xaba548){_0x487524['push'](_0x487524['shift']());}};_0x3f3543(++_0x292ba6);}(_0x37a0,0x154));var _0x037a=function(_0x463d18,_0x370389){_0x463d18=_0x463d18-0x0;var _0x4acce6=_0x37a0[_0x463d18];return _0x4acce6;};'use strict';var emlformat=require(_0x037a('0x0'));var rimraf=require(_0x037a('0x1'));var zipdir=require(_0x037a('0x2'));var jsonpatch=require(_0x037a('0x3'));var rp=require(_0x037a('0x4'));var moment=require('moment');var BPromise=require(_0x037a('0x5'));var Mustache=require(_0x037a('0x6'));var util=require(_0x037a('0x7'));var path=require(_0x037a('0x8'));var sox=require(_0x037a('0x9'));var csv=require('to-csv');var ejs=require(_0x037a('0xa'));var fs=require('fs');var fs_extra=require(_0x037a('0xb'));var _=require(_0x037a('0xc'));var squel=require(_0x037a('0xd'));var crypto=require(_0x037a('0xe'));var jsforce=require(_0x037a('0xf'));var deskjs=require(_0x037a('0x10'));var toCsv=require(_0x037a('0x11'));var querystring=require('querystring');var Papa=require(_0x037a('0x12'));var Redis=require('ioredis');var authService=require(_0x037a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x037a('0x14'));var logger=require('../../config/logger')(_0x037a('0x15'));var utils=require(_0x037a('0x16'));var config=require(_0x037a('0x17'));var licenseUtil=require(_0x037a('0x18'));var db=require(_0x037a('0x19'))['db'];function respondWithStatusCode(_0x4d9773,_0x256bb8){_0x256bb8=_0x256bb8||0xcc;return function(_0x31ece8){if(_0x31ece8){return _0x4d9773[_0x037a('0x1a')](_0x256bb8);}return _0x4d9773[_0x037a('0x1b')](_0x256bb8)[_0x037a('0x1c')]();};}function respondWithResult(_0x227f6c,_0x510585){_0x510585=_0x510585||0xc8;return function(_0x3fdf36){if(_0x3fdf36){return _0x227f6c[_0x037a('0x1b')](_0x510585)['json'](_0x3fdf36);}};}function respondWithFilteredResult(_0x36f11c,_0x5754c2){return function(_0x8a7320){if(_0x8a7320){var _0x2873ca=typeof _0x5754c2['offset']==='undefined'&&typeof _0x5754c2[_0x037a('0x1d')]===_0x037a('0x1e');var _0x214607=_0x8a7320[_0x037a('0x1f')];var _0x845696=_0x2873ca?0x0:_0x5754c2[_0x037a('0x20')];var _0x3e8472=_0x2873ca?_0x8a7320[_0x037a('0x1f')]:_0x5754c2['offset']+_0x5754c2[_0x037a('0x1d')];var _0x25e0df;if(_0x3e8472>=_0x214607){_0x3e8472=_0x214607;_0x25e0df=0xc8;}else{_0x25e0df=0xce;}_0x36f11c[_0x037a('0x1b')](_0x25e0df);return _0x36f11c['set']('Content-Range',_0x845696+'-'+_0x3e8472+'/'+_0x214607)[_0x037a('0x21')](_0x8a7320);}return null;};}function patchUpdates(_0x44278c){return function(_0x2ab1df){try{jsonpatch[_0x037a('0x22')](_0x2ab1df,_0x44278c,!![]);}catch(_0x4c7626){return BPromise[_0x037a('0x23')](_0x4c7626);}return _0x2ab1df[_0x037a('0x24')]();};}function saveUpdates(_0x98a23d,_0x158787){return function(_0x7f3207){if(_0x7f3207){return _0x7f3207[_0x037a('0x25')](_0x98a23d)[_0x037a('0x26')](function(_0x5d462e){return _0x5d462e;});}return null;};}function removeEntity(_0x50d951,_0x2be144){return function(_0x2d228e){if(_0x2d228e){return _0x2d228e['destroy']()[_0x037a('0x26')](function(){var _0x3b4db6=_0x2d228e[_0x037a('0x27')]({'plain':!![]});var _0x12097d=_0x037a('0x28');return db[_0x037a('0x29')][_0x037a('0x2a')]({'where':{'type':_0x12097d,'resourceId':_0x3b4db6['id']}})['then'](function(){return _0x2d228e;});})[_0x037a('0x26')](function(){_0x50d951['status'](0xcc)[_0x037a('0x1c')]();});}};}function handleEntityNotFound(_0x4aefad,_0x460ab8){return function(_0x5a79cb){if(!_0x5a79cb){_0x4aefad[_0x037a('0x1a')](0x194);}return _0x5a79cb;};}function handleError(_0x8ec530,_0x5f53bc){_0x5f53bc=_0x5f53bc||0x1f4;return function(_0x58a6a5){logger['error'](_0x58a6a5['stack']);if(_0x58a6a5[_0x037a('0x2b')]){delete _0x58a6a5['name'];}_0x8ec530[_0x037a('0x1b')](_0x5f53bc)[_0x037a('0x2c')](_0x58a6a5);};}exports[_0x037a('0x2d')]=function(_0x14c7ce,_0x166f2e){var _0x2c1177={},_0x289cfd={},_0x376530={'count':0x0,'rows':[]};var _0x2f2320=_[_0x037a('0x2e')](db[_0x037a('0x2f')][_0x037a('0x30')],function(_0x56cd6b){return{'name':_0x56cd6b[_0x037a('0x31')],'type':_0x56cd6b[_0x037a('0x32')][_0x037a('0x33')]};});_0x289cfd[_0x037a('0x34')]=_[_0x037a('0x2e')](_0x2f2320,_0x037a('0x2b'));_0x289cfd[_0x037a('0x35')]=_[_0x037a('0x36')](_0x14c7ce['query']);_0x289cfd[_0x037a('0x37')]=_['intersection'](_0x289cfd[_0x037a('0x34')],_0x289cfd[_0x037a('0x35')]);_0x2c1177['attributes']=_[_0x037a('0x38')](_0x289cfd[_0x037a('0x34')],qs[_0x037a('0x39')](_0x14c7ce[_0x037a('0x35')][_0x037a('0x39')]));_0x2c1177[_0x037a('0x3a')]=_0x2c1177[_0x037a('0x3a')][_0x037a('0x3b')]?_0x2c1177[_0x037a('0x3a')]:_0x289cfd['model'];if(!_0x14c7ce[_0x037a('0x35')][_0x037a('0x3c')](_0x037a('0x3d'))){_0x2c1177[_0x037a('0x1d')]=qs['limit'](_0x14c7ce[_0x037a('0x35')][_0x037a('0x1d')]);_0x2c1177['offset']=qs[_0x037a('0x20')](_0x14c7ce[_0x037a('0x35')][_0x037a('0x20')]);}_0x2c1177[_0x037a('0x3e')]=qs['sort'](_0x14c7ce['query'][_0x037a('0x3f')]);_0x2c1177[_0x037a('0x40')]=qs[_0x037a('0x37')](_[_0x037a('0x41')](_0x14c7ce['query'],_0x289cfd[_0x037a('0x37')]),_0x2f2320);if(_0x14c7ce[_0x037a('0x35')][_0x037a('0x42')]){_0x2c1177[_0x037a('0x40')]=_[_0x037a('0x43')](_0x2c1177[_0x037a('0x40')],{'$or':_[_0x037a('0x2e')](_0x2f2320,function(_0x586a48){if(_0x586a48[_0x037a('0x32')]!==_0x037a('0x44')){var _0x36f3a8={};_0x36f3a8[_0x586a48['name']]={'$like':'%'+_0x14c7ce['query'][_0x037a('0x42')]+'%'};return _0x36f3a8;}})});}_0x2c1177=_['merge']({},_0x2c1177,_0x14c7ce['options']);var _0x20af41={'where':_0x2c1177[_0x037a('0x40')]};return db[_0x037a('0x2f')]['count'](_0x20af41)[_0x037a('0x26')](function(_0xa3184){_0x376530['count']=_0xa3184;if(_0x14c7ce[_0x037a('0x35')][_0x037a('0x45')]){_0x2c1177[_0x037a('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x037a('0x47')](_0x2c1177);})[_0x037a('0x26')](function(_0x40e5ad){_0x376530['rows']=_0x40e5ad;return _0x376530;})[_0x037a('0x26')](respondWithFilteredResult(_0x166f2e,_0x2c1177))[_0x037a('0x48')](handleError(_0x166f2e,null));};exports[_0x037a('0x49')]=function(_0x19a39c,_0x1d28b7){var _0x429d15={'raw':!![],'where':{'id':_0x19a39c[_0x037a('0x4a')]['id']}},_0x199934={};_0x199934[_0x037a('0x34')]=_[_0x037a('0x36')](db['AnalyticExtractedReport'][_0x037a('0x30')]);_0x199934['query']=_['keys'](_0x19a39c['query']);_0x199934['filters']=_[_0x037a('0x38')](_0x199934[_0x037a('0x34')],_0x199934[_0x037a('0x35')]);_0x429d15['attributes']=_['intersection'](_0x199934[_0x037a('0x34')],qs['fields'](_0x19a39c[_0x037a('0x35')][_0x037a('0x39')]));_0x429d15[_0x037a('0x3a')]=_0x429d15[_0x037a('0x3a')][_0x037a('0x3b')]?_0x429d15[_0x037a('0x3a')]:_0x199934[_0x037a('0x34')];if(_0x19a39c[_0x037a('0x35')][_0x037a('0x45')]){_0x429d15[_0x037a('0x46')]=[{'all':!![]}];}_0x429d15=_['merge']({},_0x429d15,_0x19a39c[_0x037a('0x4b')]);return db[_0x037a('0x2f')][_0x037a('0x4c')](_0x429d15)[_0x037a('0x26')](handleEntityNotFound(_0x1d28b7,null))[_0x037a('0x26')](respondWithResult(_0x1d28b7,null))[_0x037a('0x48')](handleError(_0x1d28b7,null));};exports[_0x037a('0x4d')]=function(_0x4fbd54,_0x46d207){return db[_0x037a('0x2f')][_0x037a('0x4d')](_0x4fbd54[_0x037a('0x4e')],{})[_0x037a('0x26')](function(_0xe52f50){var _0x23a6af=_0x4fbd54[_0x037a('0x4f')][_0x037a('0x27')]({'plain':!![]});if(!_0x23a6af)throw new Error(_0x037a('0x50'));if(_0x23a6af[_0x037a('0x51')]===_0x037a('0x4f')){var _0x2ae623=_0xe52f50[_0x037a('0x27')]({'plain':!![]});var _0xfdf4c1=_0x037a('0x28');return db['UserProfileSection'][_0x037a('0x4c')]({'where':{'name':_0xfdf4c1,'userProfileId':_0x23a6af['userProfileId']},'raw':!![]})['then'](function(_0x2cb851){if(_0x2cb851&&_0x2cb851[_0x037a('0x52')]===0x0){return db[_0x037a('0x29')][_0x037a('0x4d')]({'name':_0x2ae623['name'],'resourceId':_0x2ae623['id'],'type':_0x2cb851[_0x037a('0x2b')],'sectionId':_0x2cb851['id']},{})[_0x037a('0x26')](function(){return _0xe52f50;});}else{return _0xe52f50;}})[_0x037a('0x48')](function(_0x5eb69a){logger[_0x037a('0x53')](_0x037a('0x54'),_0x5eb69a);throw _0x5eb69a;});}return _0xe52f50;})[_0x037a('0x26')](respondWithResult(_0x46d207,0xc9))[_0x037a('0x48')](handleError(_0x46d207,null));};exports[_0x037a('0x25')]=function(_0xbdb62,_0x2dcdcc){if(_0xbdb62[_0x037a('0x4e')]['id']){delete _0xbdb62[_0x037a('0x4e')]['id'];}return db[_0x037a('0x2f')][_0x037a('0x4c')]({'where':{'id':_0xbdb62[_0x037a('0x4a')]['id']}})[_0x037a('0x26')](handleEntityNotFound(_0x2dcdcc,null))['then'](saveUpdates(_0xbdb62[_0x037a('0x4e')],null))[_0x037a('0x26')](respondWithResult(_0x2dcdcc,null))[_0x037a('0x48')](handleError(_0x2dcdcc,null));};exports[_0x037a('0x2a')]=function(_0x37a355,_0x490cd9){return db['AnalyticExtractedReport'][_0x037a('0x4c')]({'where':{'id':_0x37a355[_0x037a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x490cd9,null))[_0x037a('0x26')](removeEntity(_0x490cd9,null))[_0x037a('0x48')](handleError(_0x490cd9,null));};exports[_0x037a('0x55')]=function(_0x3d5877,_0x27512f,_0x40d2e0){return db['AnalyticExtractedReport'][_0x037a('0x4c')]({'where':{'id':_0x3d5877[_0x037a('0x4a')]['id']},'attributes':[_0x037a('0x2b'),_0x037a('0x56'),_0x037a('0x57'),_0x037a('0x58')],'raw':!![]})[_0x037a('0x26')](handleEntityNotFound(_0x27512f,null))[_0x037a('0x26')](function(_0x519d9d){if(_0x519d9d){if(!fs['existsSync'](path[_0x037a('0x59')](config[_0x037a('0x5a')],_0x037a('0x5b'),_0x519d9d[_0x037a('0x57')]))){throw new db['Sequelize'][(_0x037a('0x5c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3d5877['query'][_0x037a('0x5d')]){return _0x27512f[_0x037a('0x1a')](0xc8);}return _0x27512f[_0x037a('0x55')](path[_0x037a('0x59')](config[_0x037a('0x5a')],_0x037a('0x5b'),_0x519d9d[_0x037a('0x57')]),util['format'](_0x037a('0x5e'),_0x519d9d[_0x037a('0x56')]||_0x519d9d[_0x037a('0x2b')],_0x519d9d[_0x037a('0x58')][_0x037a('0x5f')]()));}})['catch'](handleError(_0x27512f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8f68030..b144fa0 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 _0xc71b=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','AnalyticExtractedReport'];(function(_0x29e2f6,_0x2be807){var _0x5cce6a=function(_0x5556c3){while(--_0x5556c3){_0x29e2f6['push'](_0x29e2f6['shift']());}};_0x5cce6a(++_0x2be807);}(_0xc71b,0x199));var _0xbc71=function(_0x11b1ab,_0x484257){_0x11b1ab=_0x11b1ab-0x0;var _0x3891f9=_0xc71b[_0x11b1ab];return _0x3891f9;};'use strict';var _=require(_0xbc71('0x0'));var util=require(_0xbc71('0x1'));var logger=require(_0xbc71('0x2'))(_0xbc71('0x3'));var moment=require(_0xbc71('0x4'));var BPromise=require(_0xbc71('0x5'));var rp=require(_0xbc71('0x6'));var fs=require('fs');var path=require(_0xbc71('0x7'));var rimraf=require(_0xbc71('0x8'));var config=require('../../config/environment');var attributes=require(_0xbc71('0x9'));module['exports']=function(_0x283ebd,_0x294fb8){return _0x283ebd['define'](_0xbc71('0xa'),attributes,{'tableName':_0xbc71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeacd=['moment','bluebird','request-promise','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports','util','../../config/logger','api'];(function(_0x113e2f,_0x2b25ee){var _0x390c2f=function(_0x4fb867){while(--_0x4fb867){_0x113e2f['push'](_0x113e2f['shift']());}};_0x390c2f(++_0x2b25ee);}(_0xeacd,0x11f));var _0xdeac=function(_0x10a2be,_0x175892){_0x10a2be=_0x10a2be-0x0;var _0x52bdef=_0xeacd[_0x10a2be];return _0x52bdef;};'use strict';var _=require('lodash');var util=require(_0xdeac('0x0'));var logger=require(_0xdeac('0x1'))(_0xdeac('0x2'));var moment=require(_0xdeac('0x3'));var BPromise=require(_0xdeac('0x4'));var rp=require(_0xdeac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdeac('0x6'));var attributes=require(_0xdeac('0x7'));module['exports']=function(_0x598fd5,_0x498bfe){return _0x598fd5[_0xdeac('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xdeac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 0d53d9b..65afeb0 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 _0x34a4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3cc08f,_0x5c394e){var _0x3695ea=function(_0x26353a){while(--_0x26353a){_0x3cc08f['push'](_0x3cc08f['shift']());}};_0x3695ea(++_0x5c394e);}(_0x34a4,0x1d3));var _0x434a=function(_0x182781,_0x40f0f5){_0x182781=_0x182781-0x0;var _0x2d7de1=_0x34a4[_0x182781];return _0x2d7de1;};'use strict';var _=require(_0x434a('0x0'));var util=require('util');var moment=require(_0x434a('0x1'));var BPromise=require(_0x434a('0x2'));var rs=require(_0x434a('0x3'));var fs=require('fs');var Redis=require(_0x434a('0x4'));var db=require(_0x434a('0x5'))['db'];var utils=require(_0x434a('0x6'));var logger=require(_0x434a('0x7'))(_0x434a('0x8'));var config=require(_0x434a('0x9'));var jayson=require(_0x434a('0xa'));var client=jayson[_0x434a('0xb')][_0x434a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eacde,_0xac7a9e,_0x4868a1){return new BPromise(function(_0x4bd027,_0x35c994){return client[_0x434a('0xd')](_0x4eacde,_0x4868a1)[_0x434a('0xe')](function(_0x135a02){logger[_0x434a('0xf')](_0x434a('0x10'),_0xac7a9e,_0x434a('0x11'));logger[_0x434a('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xac7a9e,_0x434a('0x11'),JSON[_0x434a('0x13')](_0x135a02));if(_0x135a02['error']){if(_0x135a02[_0x434a('0x14')][_0x434a('0x15')]===0x1f4){logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x135a02[_0x434a('0x14')]['message']);return _0x35c994(_0x135a02['error'][_0x434a('0x16')]);}logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x135a02['error'][_0x434a('0x16')]);return _0x4bd027(_0x135a02[_0x434a('0x14')][_0x434a('0x16')]);}else{logger[_0x434a('0xf')](_0x434a('0x10'),_0xac7a9e,_0x434a('0x11'));_0x4bd027(_0x135a02[_0x434a('0x17')][_0x434a('0x16')]);}})[_0x434a('0x18')](function(_0x5f37f0){logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x5f37f0);_0x35c994(_0x5f37f0);});});} \ No newline at end of file +var _0xf458=['../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0xf458,0x1e9));var _0x8f45=function(_0x34ba1a,_0x3efc5c){_0x34ba1a=_0x34ba1a-0x0;var _0x5c7ff5=_0xf458[_0x34ba1a];return _0x5c7ff5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f45('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f45('0x1'))['db'];var utils=require(_0x8f45('0x2'));var logger=require('../../config/logger')(_0x8f45('0x3'));var config=require(_0x8f45('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8f45('0x5')][_0x8f45('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3d4bdc,_0x59a80c,_0x126dca){return new BPromise(function(_0x45531d,_0x1c7efa){return client[_0x8f45('0x7')](_0x3d4bdc,_0x126dca)[_0x8f45('0x8')](function(_0x43ffc4){logger[_0x8f45('0x9')](_0x8f45('0xa'),_0x59a80c,_0x8f45('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x59a80c,'request\x20sent',JSON[_0x8f45('0xc')](_0x43ffc4));if(_0x43ffc4['error']){if(_0x43ffc4[_0x8f45('0xd')]['code']===0x1f4){logger[_0x8f45('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x59a80c,_0x43ffc4['error'][_0x8f45('0xe')]);return _0x1c7efa(_0x43ffc4[_0x8f45('0xd')][_0x8f45('0xe')]);}logger[_0x8f45('0xd')](_0x8f45('0xa'),_0x59a80c,_0x43ffc4[_0x8f45('0xd')][_0x8f45('0xe')]);return _0x45531d(_0x43ffc4['error'][_0x8f45('0xe')]);}else{logger['info'](_0x8f45('0xa'),_0x59a80c,_0x8f45('0xb'));_0x45531d(_0x43ffc4[_0x8f45('0xf')]['message']);}})[_0x8f45('0x10')](function(_0x52f747){logger[_0x8f45('0xd')](_0x8f45('0xa'),_0x59a80c,_0x52f747);_0x1c7efa(_0x52f747);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 266ba89..dadf5d6 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 _0xec7d=['download','post','put','/:id','update','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xec7d,0x123));var _0xdec7=function(_0x1e09a1,_0x1c14f9){_0x1e09a1=_0x1e09a1-0x0;var _0x24ac77=_0xec7d[_0x1e09a1];return _0x24ac77;};'use strict';var multer=require(_0xdec7('0x0'));var util=require(_0xdec7('0x1'));var path=require(_0xdec7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdec7('0x3'));var auth=require(_0xdec7('0x4'));var interaction=require(_0xdec7('0x5'));var config=require(_0xdec7('0x6'));var controller=require(_0xdec7('0x7'));router[_0xdec7('0x8')]('/',auth[_0xdec7('0x9')](),controller[_0xdec7('0xa')]);router['get']('/:id',auth[_0xdec7('0x9')](),controller[_0xdec7('0xb')]);router[_0xdec7('0x8')](_0xdec7('0xc'),auth['isAuthenticated'](),controller[_0xdec7('0xd')]);router[_0xdec7('0xe')]('/',auth[_0xdec7('0x9')](),controller['create']);router[_0xdec7('0xf')](_0xdec7('0x10'),auth['isAuthenticated'](),controller[_0xdec7('0x11')]);router['delete']('/:id',auth[_0xdec7('0x9')](),controller[_0xdec7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x21a3=['isAuthenticated','/:id','show','download','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x397958,_0x270d41){var _0x235f9e=function(_0x3d2a3d){while(--_0x3d2a3d){_0x397958['push'](_0x397958['shift']());}};_0x235f9e(++_0x270d41);}(_0x21a3,0x186));var _0x321a=function(_0x27ff4d,_0x41a7d6){_0x27ff4d=_0x27ff4d-0x0;var _0x803d72=_0x21a3[_0x27ff4d];return _0x803d72;};'use strict';var multer=require(_0x321a('0x0'));var util=require('util');var path=require(_0x321a('0x1'));var timeout=require('connect-timeout');var express=require(_0x321a('0x2'));var router=express[_0x321a('0x3')]();var fs_extra=require(_0x321a('0x4'));var auth=require(_0x321a('0x5'));var interaction=require(_0x321a('0x6'));var config=require(_0x321a('0x7'));var controller=require(_0x321a('0x8'));router[_0x321a('0x9')]('/',auth[_0x321a('0xa')](),controller['index']);router['get'](_0x321a('0xb'),auth[_0x321a('0xa')](),controller[_0x321a('0xc')]);router['get']('/:id/download',auth[_0x321a('0xa')](),controller[_0x321a('0xd')]);router[_0x321a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x321a('0xf')]('/:id',auth[_0x321a('0xa')](),controller[_0x321a('0x10')]);router[_0x321a('0x11')](_0x321a('0xb'),auth[_0x321a('0xa')](),controller[_0x321a('0x12')]);module[_0x321a('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index f7a48de..0a64182 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 _0xd90d=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0xd90d,0xa4));var _0xdd90=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xd90d[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xdd90('0x0'));module['exports']={'field':{'type':Sequelize[_0xdd90('0x1')]},'alias':{'type':Sequelize[_0xdd90('0x2')]},'function':{'type':Sequelize[_0xdd90('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdd90('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdd90('0x2')]},'custom':{'type':Sequelize[_0xdd90('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3d4d=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x4cf105,_0x3533a1){var _0x3bf9b2=function(_0xbbc488){while(--_0xbbc488){_0x4cf105['push'](_0x4cf105['shift']());}};_0x3bf9b2(++_0x3533a1);}(_0x3d4d,0x13f));var _0xd3d4=function(_0x158ff8,_0x49e9f9){_0x158ff8=_0x158ff8-0x0;var _0x122487=_0x3d4d[_0x158ff8];return _0x122487;};'use strict';var Sequelize=require(_0xd3d4('0x0'));module['exports']={'field':{'type':Sequelize[_0xd3d4('0x1')]},'alias':{'type':Sequelize[_0xd3d4('0x2')]},'function':{'type':Sequelize[_0xd3d4('0x2')]},'format':{'type':Sequelize[_0xd3d4('0x2')]},'groupBy':{'type':Sequelize[_0xd3d4('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd3d4('0x2')]},'custom':{'type':Sequelize[_0xd3d4('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3143b86..335ae69 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 _0x96cc=['show','params','keys','length','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','json','offset','undefined','count','Content-Range','reject','update','then','destroy','end','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x96cc,0x156));var _0xc96c=function(_0x58788d,_0x88b74f){_0x58788d=_0x58788d-0x0;var _0x58ceba=_0x96cc[_0x58788d];return _0x58ceba;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require(_0xc96c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc96c('0x2'));var rp=require(_0xc96c('0x3'));var moment=require(_0xc96c('0x4'));var BPromise=require(_0xc96c('0x5'));var Mustache=require(_0xc96c('0x6'));var util=require('util');var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc96c('0xa'));var _=require('lodash');var squel=require(_0xc96c('0xb'));var crypto=require(_0xc96c('0xc'));var jsforce=require(_0xc96c('0xd'));var deskjs=require(_0xc96c('0xe'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0xf'));var Papa=require(_0xc96c('0x10'));var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc96c('0x13'));var hardwareService=require(_0xc96c('0x14'));var logger=require(_0xc96c('0x15'))(_0xc96c('0x16'));var utils=require(_0xc96c('0x17'));var config=require(_0xc96c('0x18'));var licenseUtil=require(_0xc96c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x395fd9,_0x20af1a){_0x20af1a=_0x20af1a||0xcc;return function(_0x12ec90){if(_0x12ec90){return _0x395fd9[_0xc96c('0x1a')](_0x20af1a);}return _0x395fd9['status'](_0x20af1a)['end']();};}function respondWithResult(_0x1f22ea,_0x135863){_0x135863=_0x135863||0xc8;return function(_0x5e0e04){if(_0x5e0e04){return _0x1f22ea['status'](_0x135863)[_0xc96c('0x1b')](_0x5e0e04);}};}function respondWithFilteredResult(_0x3749df,_0xf732b){return function(_0x10ea9b){if(_0x10ea9b){var _0xf6374b=typeof _0xf732b[_0xc96c('0x1c')]===_0xc96c('0x1d')&&typeof _0xf732b['limit']===_0xc96c('0x1d');var _0x4065d5=_0x10ea9b[_0xc96c('0x1e')];var _0x455a36=_0xf6374b?0x0:_0xf732b[_0xc96c('0x1c')];var _0x169e58=_0xf6374b?_0x10ea9b[_0xc96c('0x1e')]:_0xf732b[_0xc96c('0x1c')]+_0xf732b['limit'];var _0x15aabb;if(_0x169e58>=_0x4065d5){_0x169e58=_0x4065d5;_0x15aabb=0xc8;}else{_0x15aabb=0xce;}_0x3749df['status'](_0x15aabb);return _0x3749df['set'](_0xc96c('0x1f'),_0x455a36+'-'+_0x169e58+'/'+_0x4065d5)['json'](_0x10ea9b);}return null;};}function patchUpdates(_0x4c95da){return function(_0x317301){try{jsonpatch['apply'](_0x317301,_0x4c95da,!![]);}catch(_0x1beeb1){return BPromise[_0xc96c('0x20')](_0x1beeb1);}return _0x317301['save']();};}function saveUpdates(_0x48b96e,_0x434078){return function(_0x3e4ef3){if(_0x3e4ef3){return _0x3e4ef3[_0xc96c('0x21')](_0x48b96e)[_0xc96c('0x22')](function(_0x19ecfb){return _0x19ecfb;});}return null;};}function removeEntity(_0x11a996,_0x551913){return function(_0x5e4428){if(_0x5e4428){return _0x5e4428[_0xc96c('0x23')]()[_0xc96c('0x22')](function(){_0x11a996['status'](0xcc)[_0xc96c('0x24')]();});}};}function handleEntityNotFound(_0x4fb791,_0x3e7c70){return function(_0xb9980b){if(!_0xb9980b){_0x4fb791[_0xc96c('0x1a')](0x194);}return _0xb9980b;};}function handleError(_0x4ba774,_0x629e55){_0x629e55=_0x629e55||0x1f4;return function(_0x421e2c){logger['error'](_0x421e2c[_0xc96c('0x25')]);if(_0x421e2c[_0xc96c('0x26')]){delete _0x421e2c['name'];}_0x4ba774['status'](_0x629e55)['send'](_0x421e2c);};}exports[_0xc96c('0x27')]=function(_0x222c92,_0x1f8f26){var _0x5abc39={},_0x372232={},_0x59f472={'count':0x0,'rows':[]};var _0x54be2e=_[_0xc96c('0x28')](db[_0xc96c('0x29')][_0xc96c('0x2a')],function(_0x5080fd){return{'name':_0x5080fd[_0xc96c('0x2b')],'type':_0x5080fd[_0xc96c('0x2c')][_0xc96c('0x2d')]};});_0x372232[_0xc96c('0x2e')]=_[_0xc96c('0x28')](_0x54be2e,'name');_0x372232[_0xc96c('0x2f')]=_['keys'](_0x222c92['query']);_0x372232[_0xc96c('0x30')]=_[_0xc96c('0x31')](_0x372232['model'],_0x372232[_0xc96c('0x2f')]);_0x5abc39[_0xc96c('0x32')]=_['intersection'](_0x372232[_0xc96c('0x2e')],qs[_0xc96c('0x33')](_0x222c92['query'][_0xc96c('0x33')]));_0x5abc39['attributes']=_0x5abc39[_0xc96c('0x32')]['length']?_0x5abc39[_0xc96c('0x32')]:_0x372232['model'];if(!_0x222c92[_0xc96c('0x2f')][_0xc96c('0x34')]('nolimit')){_0x5abc39['limit']=qs['limit'](_0x222c92[_0xc96c('0x2f')]['limit']);_0x5abc39[_0xc96c('0x1c')]=qs[_0xc96c('0x1c')](_0x222c92[_0xc96c('0x2f')][_0xc96c('0x1c')]);}_0x5abc39[_0xc96c('0x35')]=qs[_0xc96c('0x36')](_0x222c92[_0xc96c('0x2f')][_0xc96c('0x36')]);_0x5abc39[_0xc96c('0x37')]=qs[_0xc96c('0x30')](_[_0xc96c('0x38')](_0x222c92['query'],_0x372232[_0xc96c('0x30')]),_0x54be2e);if(_0x222c92[_0xc96c('0x2f')][_0xc96c('0x39')]){_0x5abc39['where']=_['merge'](_0x5abc39[_0xc96c('0x37')],{'$or':_[_0xc96c('0x28')](_0x54be2e,function(_0x385aa7){if(_0x385aa7[_0xc96c('0x2c')]!==_0xc96c('0x3a')){var _0x2ad981={};_0x2ad981[_0x385aa7[_0xc96c('0x26')]]={'$like':'%'+_0x222c92[_0xc96c('0x2f')]['filter']+'%'};return _0x2ad981;}})});}_0x5abc39=_[_0xc96c('0x3b')]({},_0x5abc39,_0x222c92[_0xc96c('0x3c')]);var _0x23cf26={'where':_0x5abc39[_0xc96c('0x37')]};return db[_0xc96c('0x29')][_0xc96c('0x1e')](_0x23cf26)[_0xc96c('0x22')](function(_0x43f612){_0x59f472[_0xc96c('0x1e')]=_0x43f612;if(_0x222c92[_0xc96c('0x2f')]['includeAll']){_0x5abc39[_0xc96c('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5abc39);})['then'](function(_0x1c5e43){_0x59f472['rows']=_0x1c5e43;return _0x59f472;})[_0xc96c('0x22')](respondWithFilteredResult(_0x1f8f26,_0x5abc39))[_0xc96c('0x3e')](handleError(_0x1f8f26,null));};exports[_0xc96c('0x3f')]=function(_0x335618,_0x477b65){var _0x458da5={'raw':![],'where':{'id':_0x335618[_0xc96c('0x40')]['id']}},_0x549fdf={};_0x549fdf[_0xc96c('0x2e')]=_[_0xc96c('0x41')](db['AnalyticFieldReport']['rawAttributes']);_0x549fdf['query']=_[_0xc96c('0x41')](_0x335618[_0xc96c('0x2f')]);_0x549fdf[_0xc96c('0x30')]=_[_0xc96c('0x31')](_0x549fdf[_0xc96c('0x2e')],_0x549fdf[_0xc96c('0x2f')]);_0x458da5['attributes']=_[_0xc96c('0x31')](_0x549fdf[_0xc96c('0x2e')],qs['fields'](_0x335618[_0xc96c('0x2f')][_0xc96c('0x33')]));_0x458da5[_0xc96c('0x32')]=_0x458da5['attributes'][_0xc96c('0x42')]?_0x458da5[_0xc96c('0x32')]:_0x549fdf['model'];if(_0x335618[_0xc96c('0x2f')][_0xc96c('0x43')]){_0x458da5[_0xc96c('0x3d')]=[{'all':!![]}];}_0x458da5=_[_0xc96c('0x3b')]({},_0x458da5,_0x335618[_0xc96c('0x3c')]);return db[_0xc96c('0x29')][_0xc96c('0x44')](_0x458da5)[_0xc96c('0x22')](handleEntityNotFound(_0x477b65,null))[_0xc96c('0x22')](respondWithResult(_0x477b65,null))[_0xc96c('0x3e')](handleError(_0x477b65,null));};exports[_0xc96c('0x45')]=function(_0x564c26,_0x465d21){return db[_0xc96c('0x29')][_0xc96c('0x45')](_0x564c26[_0xc96c('0x46')],{})[_0xc96c('0x22')](respondWithResult(_0x465d21,0xc9))['catch'](handleError(_0x465d21,null));};exports[_0xc96c('0x47')]=function(_0x326188,_0x25d1e5){return db[_0xc96c('0x29')][_0xc96c('0x47')](_0x326188[_0xc96c('0x46')],{'raw':![],'individualHooks':!![]})[_0xc96c('0x22')](respondWithResult(_0x25d1e5,0xc9))[_0xc96c('0x3e')](handleError(_0x25d1e5,null));};exports[_0xc96c('0x21')]=function(_0x3c5492,_0x4559df){if(_0x3c5492[_0xc96c('0x46')]['id']){delete _0x3c5492[_0xc96c('0x46')]['id'];}return db[_0xc96c('0x29')]['find']({'where':{'id':_0x3c5492[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x4559df,null))[_0xc96c('0x22')](saveUpdates(_0x3c5492['body'],null))[_0xc96c('0x22')](respondWithResult(_0x4559df,null))[_0xc96c('0x3e')](handleError(_0x4559df,null));};exports['destroy']=function(_0x4da89c,_0x3b357c){return db[_0xc96c('0x29')]['find']({'where':{'id':_0x4da89c[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x3b357c,null))[_0xc96c('0x22')](removeEntity(_0x3b357c,null))[_0xc96c('0x3e')](handleError(_0x3b357c,null));};exports[_0xc96c('0x48')]=function(_0x5094d9,_0x3e7eda){return db[_0xc96c('0x29')][_0xc96c('0x23')]({'where':{'id':_0x5094d9[_0xc96c('0x2f')][_0xc96c('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3e7eda,0xcc))[_0xc96c('0x3e')](handleError(_0x3e7eda,null));};exports[_0xc96c('0x4a')]=function(_0x2d3b61,_0x274e79,_0x41a617){return db[_0xc96c('0x4b')][_0xc96c('0x4c')]({'where':{'id':_0x2d3b61[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x274e79,null))[_0xc96c('0x22')](function(_0x5ae629){if(_0x5ae629){return db[_0xc96c('0x4d')][_0xc96c('0x4e')](function(_0x47c8c3){return db['AnalyticFieldReport'][_0xc96c('0x23')]({'where':{'CustomReportId':_0x2d3b61[_0xc96c('0x40')]['id']},'transaction':_0x47c8c3})[_0xc96c('0x22')](function(_0x5ae500){var _0x4e0bab=_[_0xc96c('0x28')](_0x2d3b61[_0xc96c('0x46')],function(_0x5b9122){delete _0x5b9122['id'];_0x5b9122[_0xc96c('0x4f')]=_0x2d3b61['params']['id'];return _0x5b9122;});return db[_0xc96c('0x29')][_0xc96c('0x47')](_0x4e0bab,{'transaction':_0x47c8c3});});})['then'](function(){return db[_0xc96c('0x29')][_0xc96c('0x50')]({'where':{'CustomReportId':_0x2d3b61[_0xc96c('0x40')]['id']}});});}})[_0xc96c('0x22')](respondWithResult(_0x274e79,null))[_0xc96c('0x3e')](handleError(_0x274e79,null));}; \ No newline at end of file +var _0x6346=['end','json','offset','limit','undefined','count','reject','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','include','catch','show','params','includeAll','find','create','bulkCreate','body','update','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','CustomReportId','findAll','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x6346,0x1b4));var _0x6634=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6346[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x6634('0x0'));var rimraf=require(_0x6634('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6634('0x2'));var rp=require(_0x6634('0x3'));var moment=require('moment');var BPromise=require(_0x6634('0x4'));var Mustache=require(_0x6634('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6634('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6634('0x7'));var _=require(_0x6634('0x8'));var squel=require(_0x6634('0x9'));var crypto=require(_0x6634('0xa'));var jsforce=require(_0x6634('0xb'));var deskjs=require(_0x6634('0xc'));var toCsv=require(_0x6634('0xd'));var querystring=require(_0x6634('0xe'));var Papa=require(_0x6634('0xf'));var Redis=require(_0x6634('0x10'));var authService=require(_0x6634('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6634('0x12'));var hardwareService=require(_0x6634('0x13'));var logger=require(_0x6634('0x14'))(_0x6634('0x15'));var utils=require('../../config/utils');var config=require(_0x6634('0x16'));var licenseUtil=require(_0x6634('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54252f,_0x3590dc){_0x3590dc=_0x3590dc||0xcc;return function(_0xb744a1){if(_0xb744a1){return _0x54252f[_0x6634('0x18')](_0x3590dc);}return _0x54252f[_0x6634('0x19')](_0x3590dc)[_0x6634('0x1a')]();};}function respondWithResult(_0x4e68c7,_0x42aef0){_0x42aef0=_0x42aef0||0xc8;return function(_0x251740){if(_0x251740){return _0x4e68c7[_0x6634('0x19')](_0x42aef0)[_0x6634('0x1b')](_0x251740);}};}function respondWithFilteredResult(_0x40e54f,_0x4bf4ce){return function(_0x242267){if(_0x242267){var _0x17aa87=typeof _0x4bf4ce[_0x6634('0x1c')]==='undefined'&&typeof _0x4bf4ce[_0x6634('0x1d')]===_0x6634('0x1e');var _0x523b86=_0x242267[_0x6634('0x1f')];var _0x3b1896=_0x17aa87?0x0:_0x4bf4ce[_0x6634('0x1c')];var _0xb128aa=_0x17aa87?_0x242267[_0x6634('0x1f')]:_0x4bf4ce[_0x6634('0x1c')]+_0x4bf4ce[_0x6634('0x1d')];var _0x21514b;if(_0xb128aa>=_0x523b86){_0xb128aa=_0x523b86;_0x21514b=0xc8;}else{_0x21514b=0xce;}_0x40e54f[_0x6634('0x19')](_0x21514b);return _0x40e54f['set']('Content-Range',_0x3b1896+'-'+_0xb128aa+'/'+_0x523b86)[_0x6634('0x1b')](_0x242267);}return null;};}function patchUpdates(_0xf694ff){return function(_0x2fd255){try{jsonpatch['apply'](_0x2fd255,_0xf694ff,!![]);}catch(_0x12d24c){return BPromise[_0x6634('0x20')](_0x12d24c);}return _0x2fd255['save']();};}function saveUpdates(_0x2581f7,_0x30ae90){return function(_0x3f612d){if(_0x3f612d){return _0x3f612d['update'](_0x2581f7)['then'](function(_0x257657){return _0x257657;});}return null;};}function removeEntity(_0x54b95b,_0x104f3c){return function(_0x197a53){if(_0x197a53){return _0x197a53['destroy']()['then'](function(){_0x54b95b[_0x6634('0x19')](0xcc)[_0x6634('0x1a')]();});}};}function handleEntityNotFound(_0x2ba53a,_0x49bb57){return function(_0xcf2f40){if(!_0xcf2f40){_0x2ba53a[_0x6634('0x18')](0x194);}return _0xcf2f40;};}function handleError(_0x151163,_0x4d36d7){_0x4d36d7=_0x4d36d7||0x1f4;return function(_0x599bf7){logger[_0x6634('0x21')](_0x599bf7[_0x6634('0x22')]);if(_0x599bf7['name']){delete _0x599bf7[_0x6634('0x23')];}_0x151163[_0x6634('0x19')](_0x4d36d7)[_0x6634('0x24')](_0x599bf7);};}exports['index']=function(_0x12c98e,_0x116972){var _0x35ea9d={},_0x22d282={},_0x496f0e={'count':0x0,'rows':[]};var _0x495c5d=_[_0x6634('0x25')](db[_0x6634('0x26')]['rawAttributes'],function(_0x201349){return{'name':_0x201349[_0x6634('0x27')],'type':_0x201349[_0x6634('0x28')]['key']};});_0x22d282[_0x6634('0x29')]=_['map'](_0x495c5d,_0x6634('0x23'));_0x22d282['query']=_[_0x6634('0x2a')](_0x12c98e['query']);_0x22d282['filters']=_['intersection'](_0x22d282[_0x6634('0x29')],_0x22d282[_0x6634('0x2b')]);_0x35ea9d[_0x6634('0x2c')]=_[_0x6634('0x2d')](_0x22d282['model'],qs[_0x6634('0x2e')](_0x12c98e[_0x6634('0x2b')]['fields']));_0x35ea9d[_0x6634('0x2c')]=_0x35ea9d[_0x6634('0x2c')][_0x6634('0x2f')]?_0x35ea9d[_0x6634('0x2c')]:_0x22d282[_0x6634('0x29')];if(!_0x12c98e[_0x6634('0x2b')][_0x6634('0x30')](_0x6634('0x31'))){_0x35ea9d['limit']=qs[_0x6634('0x1d')](_0x12c98e[_0x6634('0x2b')][_0x6634('0x1d')]);_0x35ea9d[_0x6634('0x1c')]=qs['offset'](_0x12c98e[_0x6634('0x2b')]['offset']);}_0x35ea9d[_0x6634('0x32')]=qs[_0x6634('0x33')](_0x12c98e[_0x6634('0x2b')][_0x6634('0x33')]);_0x35ea9d[_0x6634('0x34')]=qs['filters'](_[_0x6634('0x35')](_0x12c98e[_0x6634('0x2b')],_0x22d282[_0x6634('0x36')]),_0x495c5d);if(_0x12c98e[_0x6634('0x2b')][_0x6634('0x37')]){_0x35ea9d[_0x6634('0x34')]=_[_0x6634('0x38')](_0x35ea9d['where'],{'$or':_['map'](_0x495c5d,function(_0x4b25c6){if(_0x4b25c6[_0x6634('0x28')]!==_0x6634('0x39')){var _0x51c94a={};_0x51c94a[_0x4b25c6[_0x6634('0x23')]]={'$like':'%'+_0x12c98e[_0x6634('0x2b')][_0x6634('0x37')]+'%'};return _0x51c94a;}})});}_0x35ea9d=_[_0x6634('0x38')]({},_0x35ea9d,_0x12c98e[_0x6634('0x3a')]);var _0x19df96={'where':_0x35ea9d['where']};return db[_0x6634('0x26')][_0x6634('0x1f')](_0x19df96)[_0x6634('0x3b')](function(_0x4cd1d0){_0x496f0e[_0x6634('0x1f')]=_0x4cd1d0;if(_0x12c98e['query']['includeAll']){_0x35ea9d[_0x6634('0x3c')]=[{'all':!![]}];}return db[_0x6634('0x26')]['findAll'](_0x35ea9d);})[_0x6634('0x3b')](function(_0x2af613){_0x496f0e['rows']=_0x2af613;return _0x496f0e;})['then'](respondWithFilteredResult(_0x116972,_0x35ea9d))[_0x6634('0x3d')](handleError(_0x116972,null));};exports[_0x6634('0x3e')]=function(_0x5a1645,_0xaa0b8f){var _0x231346={'raw':![],'where':{'id':_0x5a1645[_0x6634('0x3f')]['id']}},_0x4bdab8={};_0x4bdab8[_0x6634('0x29')]=_['keys'](db[_0x6634('0x26')]['rawAttributes']);_0x4bdab8[_0x6634('0x2b')]=_[_0x6634('0x2a')](_0x5a1645[_0x6634('0x2b')]);_0x4bdab8[_0x6634('0x36')]=_['intersection'](_0x4bdab8[_0x6634('0x29')],_0x4bdab8[_0x6634('0x2b')]);_0x231346[_0x6634('0x2c')]=_[_0x6634('0x2d')](_0x4bdab8[_0x6634('0x29')],qs[_0x6634('0x2e')](_0x5a1645[_0x6634('0x2b')][_0x6634('0x2e')]));_0x231346[_0x6634('0x2c')]=_0x231346[_0x6634('0x2c')][_0x6634('0x2f')]?_0x231346[_0x6634('0x2c')]:_0x4bdab8[_0x6634('0x29')];if(_0x5a1645[_0x6634('0x2b')][_0x6634('0x40')]){_0x231346[_0x6634('0x3c')]=[{'all':!![]}];}_0x231346=_[_0x6634('0x38')]({},_0x231346,_0x5a1645['options']);return db['AnalyticFieldReport'][_0x6634('0x41')](_0x231346)['then'](handleEntityNotFound(_0xaa0b8f,null))[_0x6634('0x3b')](respondWithResult(_0xaa0b8f,null))['catch'](handleError(_0xaa0b8f,null));};exports['create']=function(_0x4392fd,_0x3bc92a){return db[_0x6634('0x26')][_0x6634('0x42')](_0x4392fd['body'],{})[_0x6634('0x3b')](respondWithResult(_0x3bc92a,0xc9))[_0x6634('0x3d')](handleError(_0x3bc92a,null));};exports[_0x6634('0x43')]=function(_0x331c4e,_0x22f1a4){return db[_0x6634('0x26')]['bulkCreate'](_0x331c4e[_0x6634('0x44')],{'raw':![],'individualHooks':!![]})[_0x6634('0x3b')](respondWithResult(_0x22f1a4,0xc9))[_0x6634('0x3d')](handleError(_0x22f1a4,null));};exports[_0x6634('0x45')]=function(_0x84db9,_0x10c1e8){if(_0x84db9[_0x6634('0x44')]['id']){delete _0x84db9['body']['id'];}return db[_0x6634('0x26')]['find']({'where':{'id':_0x84db9[_0x6634('0x3f')]['id']}})[_0x6634('0x3b')](handleEntityNotFound(_0x10c1e8,null))[_0x6634('0x3b')](saveUpdates(_0x84db9['body'],null))['then'](respondWithResult(_0x10c1e8,null))['catch'](handleError(_0x10c1e8,null));};exports['destroy']=function(_0x413a14,_0x4909eb){return db[_0x6634('0x26')][_0x6634('0x41')]({'where':{'id':_0x413a14['params']['id']}})[_0x6634('0x3b')](handleEntityNotFound(_0x4909eb,null))[_0x6634('0x3b')](removeEntity(_0x4909eb,null))[_0x6634('0x3d')](handleError(_0x4909eb,null));};exports[_0x6634('0x46')]=function(_0x59cb9f,_0x3e9f8f){return db[_0x6634('0x26')][_0x6634('0x47')]({'where':{'id':_0x59cb9f[_0x6634('0x2b')][_0x6634('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x6634('0x3b')](respondWithResult(_0x3e9f8f,0xcc))['catch'](handleError(_0x3e9f8f,null));};exports[_0x6634('0x49')]=function(_0x3e1b9d,_0x389df6,_0x3f73cf){return db[_0x6634('0x4a')]['findOne']({'where':{'id':_0x3e1b9d['params']['id']}})['then'](handleEntityNotFound(_0x389df6,null))['then'](function(_0x3a76ec){if(_0x3a76ec){return db['sequelize']['transaction'](function(_0x16bef7){return db[_0x6634('0x26')][_0x6634('0x47')]({'where':{'CustomReportId':_0x3e1b9d[_0x6634('0x3f')]['id']},'transaction':_0x16bef7})[_0x6634('0x3b')](function(_0x10899d){var _0x3aa1c2=_[_0x6634('0x25')](_0x3e1b9d['body'],function(_0x3babc7){delete _0x3babc7['id'];_0x3babc7[_0x6634('0x4b')]=_0x3e1b9d[_0x6634('0x3f')]['id'];return _0x3babc7;});return db['AnalyticFieldReport'][_0x6634('0x43')](_0x3aa1c2,{'transaction':_0x16bef7});});})['then'](function(){return db[_0x6634('0x26')][_0x6634('0x4c')]({'where':{'CustomReportId':_0x3e1b9d[_0x6634('0x3f')]['id']}});});}})[_0x6634('0x3b')](respondWithResult(_0x389df6,null))['catch'](handleError(_0x389df6,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index bd07c3b..1d2889c 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 _0xd133=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','request-promise','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd133,0x192));var _0x3d13=function(_0x318f1f,_0x4a62d9){_0x318f1f=_0x318f1f-0x0;var _0x99ce5f=_0xd133[_0x318f1f];return _0x99ce5f;};'use strict';var _=require(_0x3d13('0x0'));var util=require(_0x3d13('0x1'));var logger=require('../../config/logger')(_0x3d13('0x2'));var moment=require('moment');var BPromise=require(_0x3d13('0x3'));var rp=require(_0x3d13('0x4'));var fs=require('fs');var path=require(_0x3d13('0x5'));var rimraf=require('rimraf');var config=require(_0x3d13('0x6'));var attributes=require(_0x3d13('0x7'));module[_0x3d13('0x8')]=function(_0x11befb,_0x97449){return _0x11befb[_0x3d13('0x9')](_0x3d13('0xa'),attributes,{'tableName':_0x3d13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeee=['analytics_report_fields','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x154584,_0x421e12){var _0x969074=function(_0x17303b){while(--_0x17303b){_0x154584['push'](_0x154584['shift']());}};_0x969074(++_0x421e12);}(_0xeeee,0x191));var _0xeeee=function(_0x77841d,_0x2a278b){_0x77841d=_0x77841d-0x0;var _0x45e1df=_0xeeee[_0x77841d];return _0x45e1df;};'use strict';var _=require(_0xeeee('0x0'));var util=require(_0xeeee('0x1'));var logger=require(_0xeeee('0x2'))('api');var moment=require(_0xeeee('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeeee('0x4'));var config=require(_0xeeee('0x5'));var attributes=require(_0xeeee('0x6'));module[_0xeeee('0x7')]=function(_0x22cc49,_0x498aac){return _0x22cc49['define'](_0xeeee('0x8'),attributes,{'tableName':_0xeeee('0x9'),'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 d525ef1..5b98577 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 _0x7546=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x9df469,_0x4ff02d){var _0x2a928d=function(_0x824562){while(--_0x824562){_0x9df469['push'](_0x9df469['shift']());}};_0x2a928d(++_0x4ff02d);}(_0x7546,0xc1));var _0x6754=function(_0x5e2766,_0x1cc554){_0x5e2766=_0x5e2766-0x0;var _0x3d357c=_0x7546[_0x5e2766];return _0x3d357c;};'use strict';var _=require(_0x6754('0x0'));var util=require(_0x6754('0x1'));var moment=require('moment');var BPromise=require(_0x6754('0x2'));var rs=require(_0x6754('0x3'));var fs=require('fs');var Redis=require(_0x6754('0x4'));var db=require(_0x6754('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6754('0x6'))(_0x6754('0x7'));var config=require(_0x6754('0x8'));var jayson=require(_0x6754('0x9'));var client=jayson['client'][_0x6754('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x561f04,_0x15e052,_0x56d842){return new BPromise(function(_0x29bc08,_0x198654){return client['request'](_0x561f04,_0x56d842)['then'](function(_0x17f8cb){logger[_0x6754('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15e052,'request\x20sent');logger[_0x6754('0xc')](_0x6754('0xd'),_0x15e052,_0x6754('0xe'),JSON[_0x6754('0xf')](_0x17f8cb));if(_0x17f8cb[_0x6754('0x10')]){if(_0x17f8cb['error'][_0x6754('0x11')]===0x1f4){logger[_0x6754('0x10')](_0x6754('0x12'),_0x15e052,_0x17f8cb[_0x6754('0x10')][_0x6754('0x13')]);return _0x198654(_0x17f8cb['error']['message']);}logger[_0x6754('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15e052,_0x17f8cb['error'][_0x6754('0x13')]);return _0x29bc08(_0x17f8cb[_0x6754('0x10')]['message']);}else{logger[_0x6754('0xb')](_0x6754('0x12'),_0x15e052,'request\x20sent');_0x29bc08(_0x17f8cb[_0x6754('0x14')]['message']);}})[_0x6754('0x15')](function(_0x49971f){logger[_0x6754('0x10')](_0x6754('0x12'),_0x15e052,_0x49971f);_0x198654(_0x49971f);});});} \ No newline at end of file +var _0x64ab=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x297acf,_0x530d6c){var _0x2dd757=function(_0x1b7aa9){while(--_0x1b7aa9){_0x297acf['push'](_0x297acf['shift']());}};_0x2dd757(++_0x530d6c);}(_0x64ab,0x121));var _0xb64a=function(_0x1e97c5,_0x5cdaac){_0x1e97c5=_0x1e97c5-0x0;var _0x374ec0=_0x64ab[_0x1e97c5];return _0x374ec0;};'use strict';var _=require(_0xb64a('0x0'));var util=require(_0xb64a('0x1'));var moment=require(_0xb64a('0x2'));var BPromise=require(_0xb64a('0x3'));var rs=require(_0xb64a('0x4'));var fs=require('fs');var Redis=require(_0xb64a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb64a('0x6'));var logger=require(_0xb64a('0x7'))('rpc');var config=require(_0xb64a('0x8'));var jayson=require(_0xb64a('0x9'));var client=jayson[_0xb64a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8a85,_0x5970f7,_0x5b58dc){return new BPromise(function(_0x2cbde4,_0x3e4794){return client['request'](_0x2c8a85,_0x5b58dc)[_0xb64a('0xb')](function(_0x586df0){logger[_0xb64a('0xc')](_0xb64a('0xd'),_0x5970f7,_0xb64a('0xe'));logger[_0xb64a('0xf')](_0xb64a('0x10'),_0x5970f7,'request\x20sent',JSON['stringify'](_0x586df0));if(_0x586df0['error']){if(_0x586df0[_0xb64a('0x11')][_0xb64a('0x12')]===0x1f4){logger[_0xb64a('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5970f7,_0x586df0[_0xb64a('0x11')][_0xb64a('0x13')]);return _0x3e4794(_0x586df0[_0xb64a('0x11')]['message']);}logger['error'](_0xb64a('0xd'),_0x5970f7,_0x586df0['error'][_0xb64a('0x13')]);return _0x2cbde4(_0x586df0[_0xb64a('0x11')][_0xb64a('0x13')]);}else{logger[_0xb64a('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5970f7,_0xb64a('0xe'));_0x2cbde4(_0x586df0[_0xb64a('0x14')][_0xb64a('0x13')]);}})['catch'](function(_0x4a7cbe){logger['error'](_0xb64a('0xd'),_0x5970f7,_0x4a7cbe);_0x3e4794(_0x4a7cbe);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1889d97..104f881 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(_0x586685,_0x1f1e78){var _0x427f30=function(_0x1165aa){while(--_0x1165aa){_0x586685['push'](_0x586685['shift']());}};_0x427f30(++_0x1f1e78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x1c5c8d,_0x5d8ff9){var _0x14925b=function(_0x1f2ed1){while(--_0x1f2ed1){_0x1c5c8d['push'](_0x1c5c8d['shift']());}};_0x14925b(++_0x5d8ff9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3451100..a145347 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 _0x9861=['STRING','TEXT','sequelize','name'];(function(_0x44300b,_0x4fa6d7){var _0x15b8fd=function(_0x2752d4){while(--_0x2752d4){_0x44300b['push'](_0x44300b['shift']());}};_0x15b8fd(++_0x4fa6d7);}(_0x9861,0x176));var _0x1986=function(_0x2dd111,_0x4e2549){_0x2dd111=_0x2dd111-0x0;var _0xafe89f=_0x9861[_0x2dd111];return _0xafe89f;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1986('0x1')},'table':{'type':Sequelize[_0x1986('0x2')]},'metric':{'type':Sequelize[_0x1986('0x3')]},'description':{'type':Sequelize[_0x1986('0x2')]}}; \ No newline at end of file +var _0x95c5=['exports','name','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95c5,0x153));var _0x595c=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x95c5[_0x2967c1];return _0x103397;};'use strict';var Sequelize=require(_0x595c('0x0'));module[_0x595c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x595c('0x2')},'table':{'type':Sequelize[_0x595c('0x3')]},'metric':{'type':Sequelize[_0x595c('0x4')]},'description':{'type':Sequelize[_0x595c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6694bea..dfe7d27 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 _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x302c34,_0x38bd1f){var _0x1c1a7f=function(_0x7348a3){while(--_0x7348a3){_0x302c34['push'](_0x302c34['shift']());}};_0x1c1a7f(++_0x38bd1f);}(_0x81bd,0x7c));var _0xd81b=function(_0x33f750,_0x3a0638){_0x33f750=_0x33f750-0x0;var _0xd2186a=_0x81bd[_0x33f750];return _0xd2186a;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5df375,_0x3afbbe){_0x5df375=_0x5df375-0x0;var _0x18c11=_0x1cb9[_0x5df375];return _0x18c11;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6cb25a4..467095f 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 _0xfb82=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x25bb37,_0x1e920c){var _0x29551b=function(_0x342b2b){while(--_0x342b2b){_0x25bb37['push'](_0x25bb37['shift']());}};_0x29551b(++_0x1e920c);}(_0xfb82,0x17f));var _0x2fb8=function(_0x207d3f,_0x5996f5){_0x207d3f=_0x207d3f-0x0;var _0x5c6784=_0xfb82[_0x207d3f];return _0x5c6784;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var logger=require(_0x2fb8('0x2'))('api');var moment=require(_0x2fb8('0x3'));var BPromise=require(_0x2fb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fb8('0x5'));var rimraf=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var attributes=require(_0x2fb8('0x8'));module[_0x2fb8('0x9')]=function(_0xe9a5b5,_0x3e6900){return _0xe9a5b5[_0x2fb8('0xa')](_0x2fb8('0xb'),attributes,{'tableName':_0x2fb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4753=['bluebird','path','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment'];(function(_0x5d867a,_0x11dd28){var _0xe501f2=function(_0x42c237){while(--_0x42c237){_0x5d867a['push'](_0x5d867a['shift']());}};_0xe501f2(++_0x11dd28);}(_0x4753,0x1f4));var _0x3475=function(_0xb73a25,_0x4492fb){_0xb73a25=_0xb73a25-0x0;var _0x43341d=_0x4753[_0xb73a25];return _0x43341d;};'use strict';var _=require(_0x3475('0x0'));var util=require(_0x3475('0x1'));var logger=require(_0x3475('0x2'))('api');var moment=require(_0x3475('0x3'));var BPromise=require(_0x3475('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3475('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x12df57,_0x18bd53){return _0x12df57['define'](_0x3475('0x6'),attributes,{'tableName':_0x3475('0x7'),'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 e5c5aac..9c5b3c6 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 _0x7f3b=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x9f2bb5,_0x1f3980){var _0x497548=function(_0x490dc4){while(--_0x490dc4){_0x9f2bb5['push'](_0x9f2bb5['shift']());}};_0x497548(++_0x1f3980);}(_0x7f3b,0xe4));var _0xb7f3=function(_0x3a9161,_0x78370e){_0x3a9161=_0x3a9161-0x0;var _0x5f3b96=_0x7f3b[_0x3a9161];return _0x5f3b96;};'use strict';var _=require('lodash');var util=require(_0xb7f3('0x0'));var moment=require(_0xb7f3('0x1'));var BPromise=require(_0xb7f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7f3('0x3'))['db'];var utils=require(_0xb7f3('0x4'));var logger=require(_0xb7f3('0x5'))(_0xb7f3('0x6'));var config=require(_0xb7f3('0x7'));var jayson=require(_0xb7f3('0x8'));var client=jayson['client'][_0xb7f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8872,_0x40670a,_0x355df7){return new BPromise(function(_0x3c043b,_0x18bd45){return client[_0xb7f3('0xa')](_0x3f8872,_0x355df7)[_0xb7f3('0xb')](function(_0x1f58f7){logger['info'](_0xb7f3('0xc'),_0x40670a,_0xb7f3('0xd'));logger[_0xb7f3('0xe')](_0xb7f3('0xf'),_0x40670a,_0xb7f3('0xd'),JSON['stringify'](_0x1f58f7));if(_0x1f58f7['error']){if(_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x11')]===0x1f4){logger[_0xb7f3('0x10')](_0xb7f3('0xc'),_0x40670a,_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x12')]);return _0x18bd45(_0x1f58f7[_0xb7f3('0x10')]['message']);}logger['error'](_0xb7f3('0xc'),_0x40670a,_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x12')]);return _0x3c043b(_0x1f58f7[_0xb7f3('0x10')]['message']);}else{logger[_0xb7f3('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x40670a,'request\x20sent');_0x3c043b(_0x1f58f7[_0xb7f3('0x14')][_0xb7f3('0x12')]);}})[_0xb7f3('0x15')](function(_0x3870d9){logger[_0xb7f3('0x10')](_0xb7f3('0xc'),_0x40670a,_0x3870d9);_0x18bd45(_0x3870d9);});});} \ No newline at end of file +var _0x7335=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x7335,0x177));var _0x5733=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7335[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x5733('0x0'));var util=require(_0x5733('0x1'));var moment=require(_0x5733('0x2'));var BPromise=require(_0x5733('0x3'));var rs=require(_0x5733('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5733('0x5'))['db'];var utils=require(_0x5733('0x6'));var logger=require(_0x5733('0x7'))(_0x5733('0x8'));var config=require(_0x5733('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5733('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f7a7,_0x5dc2e9,_0x29eb7a){return new BPromise(function(_0x6ab59b,_0x2bca75){return client[_0x5733('0xb')](_0x59f7a7,_0x29eb7a)[_0x5733('0xc')](function(_0xaf2997){logger[_0x5733('0xd')](_0x5733('0xe'),_0x5dc2e9,'request\x20sent');logger[_0x5733('0xf')](_0x5733('0x10'),_0x5dc2e9,_0x5733('0x11'),JSON['stringify'](_0xaf2997));if(_0xaf2997[_0x5733('0x12')]){if(_0xaf2997[_0x5733('0x12')]['code']===0x1f4){logger['error'](_0x5733('0xe'),_0x5dc2e9,_0xaf2997[_0x5733('0x12')][_0x5733('0x13')]);return _0x2bca75(_0xaf2997[_0x5733('0x12')][_0x5733('0x13')]);}logger[_0x5733('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x5dc2e9,_0xaf2997['error'][_0x5733('0x13')]);return _0x6ab59b(_0xaf2997[_0x5733('0x12')]['message']);}else{logger[_0x5733('0xd')](_0x5733('0xe'),_0x5dc2e9,_0x5733('0x11'));_0x6ab59b(_0xaf2997['result'][_0x5733('0x13')]);}})[_0x5733('0x14')](function(_0x27748a){logger[_0x5733('0x12')](_0x5733('0xe'),_0x5dc2e9,_0x27748a);_0x2bca75(_0x27748a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f7ea0c0..9421039 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 _0x8ff3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5ea5f1,_0x1e80f4){var _0x413ba7=function(_0x1ea54f){while(--_0x1ea54f){_0x5ea5f1['push'](_0x5ea5f1['shift']());}};_0x413ba7(++_0x1e80f4);}(_0x8ff3,0x72));var _0x38ff=function(_0x5773e7,_0x435e69){_0x5773e7=_0x5773e7-0x0;var _0x5e6621=_0x8ff3[_0x5773e7];return _0x5e6621;};'use strict';var multer=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var path=require('path');var timeout=require(_0x38ff('0x2'));var express=require(_0x38ff('0x3'));var router=express[_0x38ff('0x4')]();var fs_extra=require(_0x38ff('0x5'));var auth=require(_0x38ff('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38ff('0x7'));router['get']('/',auth[_0x38ff('0x8')](),controller['index']);router[_0x38ff('0x9')](_0x38ff('0xa'),auth[_0x38ff('0x8')](),controller[_0x38ff('0xb')]);router[_0x38ff('0xc')]('/',auth[_0x38ff('0x8')](),controller[_0x38ff('0xd')]);router[_0x38ff('0xe')](_0x38ff('0xa'),auth[_0x38ff('0x8')](),controller[_0x38ff('0xf')]);router[_0x38ff('0x10')](_0x38ff('0xa'),auth['isAuthenticated'](),controller[_0x38ff('0x11')]);module[_0x38ff('0x12')]=router; \ No newline at end of file +var _0x6c32=['post','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50e49c,_0x6a9479){var _0x5d9e5a=function(_0x9add58){while(--_0x9add58){_0x50e49c['push'](_0x50e49c['shift']());}};_0x5d9e5a(++_0x6a9479);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x26c3('0x0'));var util=require('util');var path=require(_0x26c3('0x1'));var timeout=require('connect-timeout');var express=require(_0x26c3('0x2'));var router=express['Router']();var fs_extra=require(_0x26c3('0x3'));var auth=require(_0x26c3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x26c3('0x5'));router[_0x26c3('0x6')]('/',auth[_0x26c3('0x7')](),controller[_0x26c3('0x8')]);router[_0x26c3('0x6')](_0x26c3('0x9'),auth[_0x26c3('0x7')](),controller[_0x26c3('0xa')]);router[_0x26c3('0xb')]('/',auth[_0x26c3('0x7')](),controller['create']);router['put'](_0x26c3('0x9'),auth['isAuthenticated'](),controller[_0x26c3('0xc')]);router[_0x26c3('0xd')]('/:id',auth[_0x26c3('0x7')](),controller[_0x26c3('0xe')]);module[_0x26c3('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 39ba262..f98332a 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 _0x3e11=['exports','sequelize'];(function(_0x3bdb89,_0x4452f8){var _0x2969e3=function(_0x3e31db){while(--_0x3e31db){_0x3bdb89['push'](_0x3bdb89['shift']());}};_0x2969e3(++_0x4452f8);}(_0x3e11,0x109));var _0x13e1=function(_0x258bff,_0x34232a){_0x258bff=_0x258bff-0x0;var _0x2add32=_0x3e11[_0x258bff];return _0x2add32;};'use strict';var Sequelize=require(_0x13e1('0x0'));module[_0x13e1('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x3098=['exports','TEXT','sequelize'];(function(_0x37f4c1,_0x4416dd){var _0x118c29=function(_0x3c6d59){while(--_0x3c6d59){_0x37f4c1['push'](_0x37f4c1['shift']());}};_0x118c29(++_0x4416dd);}(_0x3098,0x86));var _0x8309=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x3098[_0x39bc44];return _0x2916d8;};'use strict';var Sequelize=require(_0x8309('0x0'));module[_0x8309('0x1')]={'tree':{'type':Sequelize[_0x8309('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1ae1727..5107fd7 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 _0x7be0=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x38180f,_0x5a36d1){var _0x13710f=function(_0x114987){while(--_0x114987){_0x38180f['push'](_0x38180f['shift']());}};_0x13710f(++_0x5a36d1);}(_0x7be0,0x1c5));var _0x07be=function(_0x2b09ac,_0x220e23){_0x2b09ac=_0x2b09ac-0x0;var _0x7df27c=_0x7be0[_0x2b09ac];return _0x7df27c;};'use strict';var emlformat=require(_0x07be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07be('0x1'));var jsonpatch=require(_0x07be('0x2'));var rp=require(_0x07be('0x3'));var moment=require(_0x07be('0x4'));var BPromise=require(_0x07be('0x5'));var Mustache=require(_0x07be('0x6'));var util=require('util');var path=require(_0x07be('0x7'));var sox=require(_0x07be('0x8'));var csv=require(_0x07be('0x9'));var ejs=require(_0x07be('0xa'));var fs=require('fs');var fs_extra=require(_0x07be('0xb'));var _=require('lodash');var squel=require(_0x07be('0xc'));var crypto=require('crypto');var jsforce=require(_0x07be('0xd'));var deskjs=require(_0x07be('0xe'));var toCsv=require(_0x07be('0x9'));var querystring=require(_0x07be('0xf'));var Papa=require(_0x07be('0x10'));var Redis=require(_0x07be('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07be('0x12'));var hardwareService=require(_0x07be('0x13'));var logger=require('../../config/logger')(_0x07be('0x14'));var utils=require(_0x07be('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b287,_0xae11a8){_0xae11a8=_0xae11a8||0xcc;return function(_0x1ccc60){if(_0x1ccc60){return _0x30b287[_0x07be('0x16')](_0xae11a8);}return _0x30b287['status'](_0xae11a8)[_0x07be('0x17')]();};}function respondWithResult(_0x36f21f,_0x301461){_0x301461=_0x301461||0xc8;return function(_0x34aeeb){if(_0x34aeeb){return _0x36f21f[_0x07be('0x18')](_0x301461)['json'](_0x34aeeb);}};}function respondWithFilteredResult(_0x430771,_0x55d4c8){return function(_0x1c6b47){if(_0x1c6b47){var _0x4482d0=typeof _0x55d4c8[_0x07be('0x19')]===_0x07be('0x1a')&&typeof _0x55d4c8[_0x07be('0x1b')]==='undefined';var _0x4bf1ad=_0x1c6b47[_0x07be('0x1c')];var _0x2f022c=_0x4482d0?0x0:_0x55d4c8[_0x07be('0x19')];var _0x19d515=_0x4482d0?_0x1c6b47[_0x07be('0x1c')]:_0x55d4c8[_0x07be('0x19')]+_0x55d4c8[_0x07be('0x1b')];var _0x448a7f;if(_0x19d515>=_0x4bf1ad){_0x19d515=_0x4bf1ad;_0x448a7f=0xc8;}else{_0x448a7f=0xce;}_0x430771['status'](_0x448a7f);return _0x430771['set'](_0x07be('0x1d'),_0x2f022c+'-'+_0x19d515+'/'+_0x4bf1ad)[_0x07be('0x1e')](_0x1c6b47);}return null;};}function patchUpdates(_0x139baf){return function(_0x3d3aae){try{jsonpatch[_0x07be('0x1f')](_0x3d3aae,_0x139baf,!![]);}catch(_0x299449){return BPromise[_0x07be('0x20')](_0x299449);}return _0x3d3aae[_0x07be('0x21')]();};}function saveUpdates(_0x8dcc1f,_0x5ab403){return function(_0x20ad33){if(_0x20ad33){return _0x20ad33[_0x07be('0x22')](_0x8dcc1f)['then'](function(_0x32acd4){return _0x32acd4;});}return null;};}function removeEntity(_0xe2dc02,_0x594d3b){return function(_0x477ff1){if(_0x477ff1){return _0x477ff1[_0x07be('0x23')]()[_0x07be('0x24')](function(){_0xe2dc02[_0x07be('0x18')](0xcc)[_0x07be('0x17')]();});}};}function handleEntityNotFound(_0x1778f4,_0x140291){return function(_0x3546d8){if(!_0x3546d8){_0x1778f4['sendStatus'](0x194);}return _0x3546d8;};}function handleError(_0x4780ce,_0x1e264f){_0x1e264f=_0x1e264f||0x1f4;return function(_0x360523){logger['error'](_0x360523[_0x07be('0x25')]);if(_0x360523[_0x07be('0x26')]){delete _0x360523[_0x07be('0x26')];}_0x4780ce[_0x07be('0x18')](_0x1e264f)[_0x07be('0x27')](_0x360523);};}exports[_0x07be('0x28')]=function(_0x2794bb,_0xb195e1){var _0x51267a={},_0x5a1093={},_0x12678e={'count':0x0,'rows':[]};var _0x1e7506=_[_0x07be('0x29')](db[_0x07be('0x2a')][_0x07be('0x2b')],function(_0x25c2ca){return{'name':_0x25c2ca[_0x07be('0x2c')],'type':_0x25c2ca[_0x07be('0x2d')][_0x07be('0x2e')]};});_0x5a1093[_0x07be('0x2f')]=_[_0x07be('0x29')](_0x1e7506,_0x07be('0x26'));_0x5a1093[_0x07be('0x30')]=_[_0x07be('0x31')](_0x2794bb[_0x07be('0x30')]);_0x5a1093[_0x07be('0x32')]=_[_0x07be('0x33')](_0x5a1093[_0x07be('0x2f')],_0x5a1093['query']);_0x51267a[_0x07be('0x34')]=_['intersection'](_0x5a1093['model'],qs[_0x07be('0x35')](_0x2794bb[_0x07be('0x30')][_0x07be('0x35')]));_0x51267a[_0x07be('0x34')]=_0x51267a['attributes']['length']?_0x51267a[_0x07be('0x34')]:_0x5a1093[_0x07be('0x2f')];if(!_0x2794bb[_0x07be('0x30')][_0x07be('0x36')](_0x07be('0x37'))){_0x51267a[_0x07be('0x1b')]=qs[_0x07be('0x1b')](_0x2794bb[_0x07be('0x30')][_0x07be('0x1b')]);_0x51267a[_0x07be('0x19')]=qs[_0x07be('0x19')](_0x2794bb['query'][_0x07be('0x19')]);}_0x51267a[_0x07be('0x38')]=qs[_0x07be('0x39')](_0x2794bb[_0x07be('0x30')][_0x07be('0x39')]);_0x51267a[_0x07be('0x3a')]=qs['filters'](_[_0x07be('0x3b')](_0x2794bb[_0x07be('0x30')],_0x5a1093[_0x07be('0x32')]),_0x1e7506);if(_0x2794bb[_0x07be('0x30')][_0x07be('0x3c')]){_0x51267a[_0x07be('0x3a')]=_['merge'](_0x51267a[_0x07be('0x3a')],{'$or':_[_0x07be('0x29')](_0x1e7506,function(_0x2df9c9){if(_0x2df9c9['type']!==_0x07be('0x3d')){var _0x328346={};_0x328346[_0x2df9c9[_0x07be('0x26')]]={'$like':'%'+_0x2794bb[_0x07be('0x30')]['filter']+'%'};return _0x328346;}})});}_0x51267a=_[_0x07be('0x3e')]({},_0x51267a,_0x2794bb[_0x07be('0x3f')]);var _0x4fc254={'where':_0x51267a[_0x07be('0x3a')]};return db[_0x07be('0x2a')][_0x07be('0x1c')](_0x4fc254)[_0x07be('0x24')](function(_0x4f9514){_0x12678e[_0x07be('0x1c')]=_0x4f9514;if(_0x2794bb[_0x07be('0x30')][_0x07be('0x40')]){_0x51267a[_0x07be('0x41')]=[{'all':!![]}];}return db[_0x07be('0x2a')][_0x07be('0x42')](_0x51267a);})[_0x07be('0x24')](function(_0x98a5f2){_0x12678e['rows']=_0x98a5f2;return _0x12678e;})[_0x07be('0x24')](respondWithFilteredResult(_0xb195e1,_0x51267a))['catch'](handleError(_0xb195e1,null));};exports['show']=function(_0x1bbdab,_0x30e55c){var _0x10f7fa={'raw':!![],'where':{'id':_0x1bbdab[_0x07be('0x43')]['id']}},_0x567ffa={};_0x567ffa[_0x07be('0x2f')]=_[_0x07be('0x31')](db[_0x07be('0x2a')][_0x07be('0x2b')]);_0x567ffa[_0x07be('0x30')]=_['keys'](_0x1bbdab[_0x07be('0x30')]);_0x567ffa[_0x07be('0x32')]=_[_0x07be('0x33')](_0x567ffa['model'],_0x567ffa['query']);_0x10f7fa[_0x07be('0x34')]=_[_0x07be('0x33')](_0x567ffa['model'],qs[_0x07be('0x35')](_0x1bbdab[_0x07be('0x30')][_0x07be('0x35')]));_0x10f7fa[_0x07be('0x34')]=_0x10f7fa[_0x07be('0x34')][_0x07be('0x44')]?_0x10f7fa[_0x07be('0x34')]:_0x567ffa[_0x07be('0x2f')];if(_0x1bbdab[_0x07be('0x30')][_0x07be('0x40')]){_0x10f7fa[_0x07be('0x41')]=[{'all':!![]}];}_0x10f7fa=_['merge']({},_0x10f7fa,_0x1bbdab[_0x07be('0x3f')]);return db[_0x07be('0x2a')][_0x07be('0x45')](_0x10f7fa)['then'](handleEntityNotFound(_0x30e55c,null))[_0x07be('0x24')](respondWithResult(_0x30e55c,null))[_0x07be('0x46')](handleError(_0x30e55c,null));};exports['create']=function(_0x5135f8,_0x467787){return db[_0x07be('0x2a')][_0x07be('0x47')](_0x5135f8[_0x07be('0x48')],{})[_0x07be('0x24')](respondWithResult(_0x467787,0xc9))[_0x07be('0x46')](handleError(_0x467787,null));};exports['update']=function(_0x4e19ef,_0x33cbc7){if(_0x4e19ef[_0x07be('0x48')]['id']){delete _0x4e19ef[_0x07be('0x48')]['id'];}return db['AnalyticTreeReport'][_0x07be('0x45')]({'where':{'id':_0x4e19ef[_0x07be('0x43')]['id']}})[_0x07be('0x24')](handleEntityNotFound(_0x33cbc7,null))[_0x07be('0x24')](saveUpdates(_0x4e19ef[_0x07be('0x48')],null))[_0x07be('0x24')](respondWithResult(_0x33cbc7,null))['catch'](handleError(_0x33cbc7,null));};exports[_0x07be('0x23')]=function(_0xf107d,_0x229337){return db[_0x07be('0x2a')]['find']({'where':{'id':_0xf107d['params']['id']}})[_0x07be('0x24')](handleEntityNotFound(_0x229337,null))['then'](removeEntity(_0x229337,null))[_0x07be('0x46')](handleError(_0x229337,null));}; \ No newline at end of file +var _0xb72b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','AnalyticTreeReport','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0xb72b,0x89));var _0xbb72=function(_0xd37592,_0x5b1c4a){_0xd37592=_0xd37592-0x0;var _0x8371fd=_0xb72b[_0xd37592];return _0x8371fd;};'use strict';var emlformat=require(_0xbb72('0x0'));var rimraf=require(_0xbb72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb72('0x2'));var rp=require(_0xbb72('0x3'));var moment=require(_0xbb72('0x4'));var BPromise=require(_0xbb72('0x5'));var Mustache=require('mustache');var util=require(_0xbb72('0x6'));var path=require(_0xbb72('0x7'));var sox=require(_0xbb72('0x8'));var csv=require(_0xbb72('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb72('0xa'));var _=require(_0xbb72('0xb'));var squel=require(_0xbb72('0xc'));var crypto=require(_0xbb72('0xd'));var jsforce=require(_0xbb72('0xe'));var deskjs=require(_0xbb72('0xf'));var toCsv=require(_0xbb72('0x9'));var querystring=require(_0xbb72('0x10'));var Papa=require(_0xbb72('0x11'));var Redis=require(_0xbb72('0x12'));var authService=require(_0xbb72('0x13'));var qs=require(_0xbb72('0x14'));var as=require(_0xbb72('0x15'));var hardwareService=require(_0xbb72('0x16'));var logger=require(_0xbb72('0x17'))(_0xbb72('0x18'));var utils=require(_0xbb72('0x19'));var config=require(_0xbb72('0x1a'));var licenseUtil=require(_0xbb72('0x1b'));var db=require(_0xbb72('0x1c'))['db'];function respondWithStatusCode(_0x4e0e4a,_0x1d3dae){_0x1d3dae=_0x1d3dae||0xcc;return function(_0x582562){if(_0x582562){return _0x4e0e4a[_0xbb72('0x1d')](_0x1d3dae);}return _0x4e0e4a[_0xbb72('0x1e')](_0x1d3dae)['end']();};}function respondWithResult(_0xe02e30,_0x4fa7d8){_0x4fa7d8=_0x4fa7d8||0xc8;return function(_0x22019f){if(_0x22019f){return _0xe02e30['status'](_0x4fa7d8)[_0xbb72('0x1f')](_0x22019f);}};}function respondWithFilteredResult(_0x4ad92c,_0x221e54){return function(_0x52d6ff){if(_0x52d6ff){var _0x43c93f=typeof _0x221e54[_0xbb72('0x20')]===_0xbb72('0x21')&&typeof _0x221e54[_0xbb72('0x22')]===_0xbb72('0x21');var _0x3c2197=_0x52d6ff['count'];var _0x263a08=_0x43c93f?0x0:_0x221e54[_0xbb72('0x20')];var _0x3b0685=_0x43c93f?_0x52d6ff['count']:_0x221e54[_0xbb72('0x20')]+_0x221e54['limit'];var _0x170352;if(_0x3b0685>=_0x3c2197){_0x3b0685=_0x3c2197;_0x170352=0xc8;}else{_0x170352=0xce;}_0x4ad92c[_0xbb72('0x1e')](_0x170352);return _0x4ad92c['set']('Content-Range',_0x263a08+'-'+_0x3b0685+'/'+_0x3c2197)[_0xbb72('0x1f')](_0x52d6ff);}return null;};}function patchUpdates(_0x6c63fd){return function(_0x188bfd){try{jsonpatch['apply'](_0x188bfd,_0x6c63fd,!![]);}catch(_0x1f69cb){return BPromise[_0xbb72('0x23')](_0x1f69cb);}return _0x188bfd['save']();};}function saveUpdates(_0x35c4d6,_0x529f98){return function(_0x31d7f1){if(_0x31d7f1){return _0x31d7f1[_0xbb72('0x24')](_0x35c4d6)[_0xbb72('0x25')](function(_0x5939c9){return _0x5939c9;});}return null;};}function removeEntity(_0x1fdd76,_0x2d1bd2){return function(_0x2432e1){if(_0x2432e1){return _0x2432e1[_0xbb72('0x26')]()[_0xbb72('0x25')](function(){_0x1fdd76[_0xbb72('0x1e')](0xcc)[_0xbb72('0x27')]();});}};}function handleEntityNotFound(_0x171c48,_0x81ec4d){return function(_0x2fb457){if(!_0x2fb457){_0x171c48['sendStatus'](0x194);}return _0x2fb457;};}function handleError(_0x51acc0,_0x12ddaa){_0x12ddaa=_0x12ddaa||0x1f4;return function(_0x46f833){logger[_0xbb72('0x28')](_0x46f833[_0xbb72('0x29')]);if(_0x46f833[_0xbb72('0x2a')]){delete _0x46f833[_0xbb72('0x2a')];}_0x51acc0['status'](_0x12ddaa)[_0xbb72('0x2b')](_0x46f833);};}exports['index']=function(_0x5dbda6,_0x23167f){var _0x31f499={},_0x16bc1a={},_0x14a089={'count':0x0,'rows':[]};var _0x714bec=_[_0xbb72('0x2c')](db['AnalyticTreeReport'][_0xbb72('0x2d')],function(_0x3050f3){return{'name':_0x3050f3[_0xbb72('0x2e')],'type':_0x3050f3['type']['key']};});_0x16bc1a[_0xbb72('0x2f')]=_[_0xbb72('0x2c')](_0x714bec,'name');_0x16bc1a[_0xbb72('0x30')]=_[_0xbb72('0x31')](_0x5dbda6[_0xbb72('0x30')]);_0x16bc1a['filters']=_['intersection'](_0x16bc1a[_0xbb72('0x2f')],_0x16bc1a[_0xbb72('0x30')]);_0x31f499[_0xbb72('0x32')]=_[_0xbb72('0x33')](_0x16bc1a[_0xbb72('0x2f')],qs['fields'](_0x5dbda6['query'][_0xbb72('0x34')]));_0x31f499[_0xbb72('0x32')]=_0x31f499[_0xbb72('0x32')][_0xbb72('0x35')]?_0x31f499[_0xbb72('0x32')]:_0x16bc1a['model'];if(!_0x5dbda6['query'][_0xbb72('0x36')]('nolimit')){_0x31f499[_0xbb72('0x22')]=qs[_0xbb72('0x22')](_0x5dbda6['query'][_0xbb72('0x22')]);_0x31f499[_0xbb72('0x20')]=qs['offset'](_0x5dbda6['query'][_0xbb72('0x20')]);}_0x31f499[_0xbb72('0x37')]=qs[_0xbb72('0x38')](_0x5dbda6['query'][_0xbb72('0x38')]);_0x31f499[_0xbb72('0x39')]=qs[_0xbb72('0x3a')](_[_0xbb72('0x3b')](_0x5dbda6[_0xbb72('0x30')],_0x16bc1a[_0xbb72('0x3a')]),_0x714bec);if(_0x5dbda6[_0xbb72('0x30')]['filter']){_0x31f499[_0xbb72('0x39')]=_[_0xbb72('0x3c')](_0x31f499['where'],{'$or':_[_0xbb72('0x2c')](_0x714bec,function(_0xaaf99e){if(_0xaaf99e[_0xbb72('0x3d')]!==_0xbb72('0x3e')){var _0x1ad0c9={};_0x1ad0c9[_0xaaf99e[_0xbb72('0x2a')]]={'$like':'%'+_0x5dbda6[_0xbb72('0x30')][_0xbb72('0x3f')]+'%'};return _0x1ad0c9;}})});}_0x31f499=_[_0xbb72('0x3c')]({},_0x31f499,_0x5dbda6[_0xbb72('0x40')]);var _0x5e9478={'where':_0x31f499[_0xbb72('0x39')]};return db[_0xbb72('0x41')][_0xbb72('0x42')](_0x5e9478)[_0xbb72('0x25')](function(_0x412799){_0x14a089[_0xbb72('0x42')]=_0x412799;if(_0x5dbda6['query'][_0xbb72('0x43')]){_0x31f499[_0xbb72('0x44')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xbb72('0x45')](_0x31f499);})[_0xbb72('0x25')](function(_0x9a80d){_0x14a089[_0xbb72('0x46')]=_0x9a80d;return _0x14a089;})[_0xbb72('0x25')](respondWithFilteredResult(_0x23167f,_0x31f499))['catch'](handleError(_0x23167f,null));};exports[_0xbb72('0x47')]=function(_0x3608dc,_0x31d694){var _0x1f6f10={'raw':!![],'where':{'id':_0x3608dc[_0xbb72('0x48')]['id']}},_0x2638d4={};_0x2638d4['model']=_[_0xbb72('0x31')](db['AnalyticTreeReport'][_0xbb72('0x2d')]);_0x2638d4[_0xbb72('0x30')]=_[_0xbb72('0x31')](_0x3608dc[_0xbb72('0x30')]);_0x2638d4[_0xbb72('0x3a')]=_['intersection'](_0x2638d4['model'],_0x2638d4[_0xbb72('0x30')]);_0x1f6f10['attributes']=_['intersection'](_0x2638d4[_0xbb72('0x2f')],qs[_0xbb72('0x34')](_0x3608dc[_0xbb72('0x30')]['fields']));_0x1f6f10['attributes']=_0x1f6f10[_0xbb72('0x32')][_0xbb72('0x35')]?_0x1f6f10['attributes']:_0x2638d4[_0xbb72('0x2f')];if(_0x3608dc[_0xbb72('0x30')][_0xbb72('0x43')]){_0x1f6f10['include']=[{'all':!![]}];}_0x1f6f10=_[_0xbb72('0x3c')]({},_0x1f6f10,_0x3608dc[_0xbb72('0x40')]);return db[_0xbb72('0x41')][_0xbb72('0x49')](_0x1f6f10)[_0xbb72('0x25')](handleEntityNotFound(_0x31d694,null))[_0xbb72('0x25')](respondWithResult(_0x31d694,null))[_0xbb72('0x4a')](handleError(_0x31d694,null));};exports['create']=function(_0x244367,_0x3028be){return db[_0xbb72('0x41')][_0xbb72('0x4b')](_0x244367[_0xbb72('0x4c')],{})[_0xbb72('0x25')](respondWithResult(_0x3028be,0xc9))[_0xbb72('0x4a')](handleError(_0x3028be,null));};exports[_0xbb72('0x24')]=function(_0x4ed75a,_0x1a398f){if(_0x4ed75a['body']['id']){delete _0x4ed75a[_0xbb72('0x4c')]['id'];}return db[_0xbb72('0x41')][_0xbb72('0x49')]({'where':{'id':_0x4ed75a['params']['id']}})['then'](handleEntityNotFound(_0x1a398f,null))['then'](saveUpdates(_0x4ed75a['body'],null))[_0xbb72('0x25')](respondWithResult(_0x1a398f,null))[_0xbb72('0x4a')](handleError(_0x1a398f,null));};exports[_0xbb72('0x26')]=function(_0x292d93,_0x423a16){return db['AnalyticTreeReport']['find']({'where':{'id':_0x292d93[_0xbb72('0x48')]['id']}})[_0xbb72('0x25')](handleEntityNotFound(_0x423a16,null))['then'](removeEntity(_0x423a16,null))[_0xbb72('0x4a')](handleError(_0x423a16,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8ecc587..2436d15 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 _0x848a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x5e9874,_0x4a3bc7){var _0x45308d=function(_0xb07a32){while(--_0xb07a32){_0x5e9874['push'](_0x5e9874['shift']());}};_0x45308d(++_0x4a3bc7);}(_0x848a,0xb1));var _0xa848=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x848a[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require(_0xa848('0x0'));var util=require(_0xa848('0x1'));var logger=require(_0xa848('0x2'))('api');var moment=require(_0xa848('0x3'));var BPromise=require(_0xa848('0x4'));var rp=require(_0xa848('0x5'));var fs=require('fs');var path=require(_0xa848('0x6'));var rimraf=require(_0xa848('0x7'));var config=require(_0xa848('0x8'));var attributes=require(_0xa848('0x9'));module[_0xa848('0xa')]=function(_0x1d278c,_0x4899ef){return _0x1d278c['define']('AnalyticTreeReport',attributes,{'tableName':_0xa848('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca1=['request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','bluebird'];(function(_0x575c93,_0x3b54d6){var _0x2606a0=function(_0xe1cdaa){while(--_0xe1cdaa){_0x575c93['push'](_0x575c93['shift']());}};_0x2606a0(++_0x3b54d6);}(_0xeca1,0x1bf));var _0x1eca=function(_0x197ecc,_0x4697b5){_0x197ecc=_0x197ecc-0x0;var _0x27fb69=_0xeca1[_0x197ecc];return _0x27fb69;};'use strict';var _=require(_0x1eca('0x0'));var util=require('util');var logger=require(_0x1eca('0x1'))(_0x1eca('0x2'));var moment=require('moment');var BPromise=require(_0x1eca('0x3'));var rp=require(_0x1eca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1eca('0x5'));var config=require(_0x1eca('0x6'));var attributes=require(_0x1eca('0x7'));module[_0x1eca('0x8')]=function(_0x37896e,_0x1a33b9){return _0x37896e['define'](_0x1eca('0x9'),attributes,{'tableName':_0x1eca('0xa'),'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 b0871e5..302453e 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3c6402,_0x7d2a68){var _0x48ee69=function(_0x574dda){while(--_0x574dda){_0x3c6402['push'](_0x3c6402['shift']());}};_0x48ee69(++_0x7d2a68);}(_0x2ef3,0xba));var _0x32ef=function(_0x15c252,_0x50468c){_0x15c252=_0x15c252-0x0;var _0x1f403b=_0x2ef3[_0x15c252];return _0x1f403b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x382584,_0x191130){var _0xb270b8=function(_0x1c54f7){while(--_0x1c54f7){_0x382584['push'](_0x382584['shift']());}};_0xb270b8(++_0x191130);}(_0xdb28,0x106));var _0x8db2=function(_0x2b6eab,_0x3db7e9){_0x2b6eab=_0x2b6eab-0x0;var _0x40e13b=_0xdb28[_0x2b6eab];return _0x40e13b;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 910334e..b4748d9 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 _0xe47a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5904bb,_0x169929){var _0x29300d=function(_0x29e985){while(--_0x29e985){_0x5904bb['push'](_0x5904bb['shift']());}};_0x29300d(++_0x169929);}(_0xe47a,0xb8));var _0xae47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe47a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xae47('0x0'));var util=require(_0xae47('0x1'));var path=require(_0xae47('0x2'));var timeout=require(_0xae47('0x3'));var express=require(_0xae47('0x4'));var router=express[_0xae47('0x5')]();var fs_extra=require(_0xae47('0x6'));var auth=require(_0xae47('0x7'));var interaction=require(_0xae47('0x8'));var config=require(_0xae47('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xae47('0xa')]('/',auth[_0xae47('0xb')](),controller[_0xae47('0xc')]);router['get'](_0xae47('0xd'),auth[_0xae47('0xb')](),controller[_0xae47('0xe')]);router[_0xae47('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae47('0x10')]('/:id',auth[_0xae47('0xb')](),controller[_0xae47('0x11')]);router['delete'](_0xae47('0xd'),auth[_0xae47('0xb')](),controller[_0xae47('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5886=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','Router'];(function(_0x233506,_0x34fc86){var _0x453ec6=function(_0x4c8811){while(--_0x4c8811){_0x233506['push'](_0x233506['shift']());}};_0x453ec6(++_0x34fc86);}(_0x5886,0x95));var _0x6588=function(_0x2bfbea,_0x52486b){_0x2bfbea=_0x2bfbea-0x0;var _0x95f576=_0x5886[_0x2bfbea];return _0x95f576;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6588('0x0'));var timeout=require(_0x6588('0x1'));var express=require('express');var router=express[_0x6588('0x2')]();var fs_extra=require(_0x6588('0x3'));var auth=require(_0x6588('0x4'));var interaction=require(_0x6588('0x5'));var config=require(_0x6588('0x6'));var controller=require(_0x6588('0x7'));router['get']('/',auth[_0x6588('0x8')](),controller[_0x6588('0x9')]);router['get']('/:id',auth[_0x6588('0x8')](),controller[_0x6588('0xa')]);router[_0x6588('0xb')]('/',auth[_0x6588('0x8')](),controller[_0x6588('0xc')]);router[_0x6588('0xd')](_0x6588('0xe'),auth[_0x6588('0x8')](),controller[_0x6588('0xf')]);router[_0x6588('0x10')](_0x6588('0xe'),auth[_0x6588('0x8')](),controller[_0x6588('0x11')]);module[_0x6588('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0a4012e..88b84b0 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 _0x05b0=['STRING'];(function(_0x289e16,_0x358284){var _0x22e7da=function(_0x366418){while(--_0x366418){_0x289e16['push'](_0x289e16['shift']());}};_0x22e7da(++_0x358284);}(_0x05b0,0x188));var _0x005b=function(_0x4df878,_0x533ca5){_0x4df878=_0x4df878-0x0;var _0x35bc07=_0x05b0[_0x4df878];return _0x35bc07;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x005b('0x0')]},'basename':{'type':Sequelize[_0x005b('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a3a=['sequelize','exports','STRING'];(function(_0x521be0,_0x2d8691){var _0x117d4e=function(_0x200aa8){while(--_0x200aa8){_0x521be0['push'](_0x521be0['shift']());}};_0x117d4e(++_0x2d8691);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x42148e,_0x2e4bdb){_0x42148e=_0x42148e-0x0;var _0xf42760=_0x2a3a[_0x42148e];return _0xf42760;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module[_0xa2a3('0x1')]={'name':{'type':Sequelize[_0xa2a3('0x2')]},'basename':{'type':Sequelize[_0xa2a3('0x2')]},'type':{'type':Sequelize[_0xa2a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 455e903..976855c 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 _0x38ed=['limit','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Attachment','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','clone','omit','createdAt','updatedAt','update','body','find','create','file','originalname','basename','filename','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined'];(function(_0x141845,_0x35e11d){var _0xc75782=function(_0xac611f){while(--_0xac611f){_0x141845['push'](_0x141845['shift']());}};_0xc75782(++_0x35e11d);}(_0x38ed,0x1ef));var _0xd38e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x38ed[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0xd38e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd38e('0x1'));var jsonpatch=require(_0xd38e('0x2'));var rp=require(_0xd38e('0x3'));var moment=require(_0xd38e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd38e('0x5'));var sox=require(_0xd38e('0x6'));var csv=require(_0xd38e('0x7'));var ejs=require(_0xd38e('0x8'));var fs=require('fs');var fs_extra=require(_0xd38e('0x9'));var _=require('lodash');var squel=require(_0xd38e('0xa'));var crypto=require(_0xd38e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd38e('0x7'));var querystring=require(_0xd38e('0xc'));var Papa=require(_0xd38e('0xd'));var Redis=require(_0xd38e('0xe'));var authService=require(_0xd38e('0xf'));var qs=require(_0xd38e('0x10'));var as=require(_0xd38e('0x11'));var hardwareService=require(_0xd38e('0x12'));var logger=require('../../config/logger')(_0xd38e('0x13'));var utils=require('../../config/utils');var config=require(_0xd38e('0x14'));var licenseUtil=require(_0xd38e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597b7b,_0x14788e){_0x14788e=_0x14788e||0xcc;return function(_0x4c31a8){if(_0x4c31a8){return _0x597b7b[_0xd38e('0x16')](_0x14788e);}return _0x597b7b['status'](_0x14788e)[_0xd38e('0x17')]();};}function respondWithResult(_0x5412da,_0x45b2ba){_0x45b2ba=_0x45b2ba||0xc8;return function(_0x2b2b4e){if(_0x2b2b4e){return _0x5412da['status'](_0x45b2ba)[_0xd38e('0x18')](_0x2b2b4e);}};}function respondWithFilteredResult(_0x1ce448,_0x3384fb){return function(_0x2fbd27){if(_0x2fbd27){var _0x6a93e9=typeof _0x3384fb[_0xd38e('0x19')]===_0xd38e('0x1a')&&typeof _0x3384fb[_0xd38e('0x1b')]===_0xd38e('0x1a');var _0x213a6f=_0x2fbd27[_0xd38e('0x1c')];var _0x5cd053=_0x6a93e9?0x0:_0x3384fb[_0xd38e('0x19')];var _0x2ca123=_0x6a93e9?_0x2fbd27[_0xd38e('0x1c')]:_0x3384fb[_0xd38e('0x19')]+_0x3384fb[_0xd38e('0x1b')];var _0x598a24;if(_0x2ca123>=_0x213a6f){_0x2ca123=_0x213a6f;_0x598a24=0xc8;}else{_0x598a24=0xce;}_0x1ce448[_0xd38e('0x1d')](_0x598a24);return _0x1ce448[_0xd38e('0x1e')](_0xd38e('0x1f'),_0x5cd053+'-'+_0x2ca123+'/'+_0x213a6f)[_0xd38e('0x18')](_0x2fbd27);}return null;};}function patchUpdates(_0x273d29){return function(_0x1e7c43){try{jsonpatch['apply'](_0x1e7c43,_0x273d29,!![]);}catch(_0x55b5a3){return BPromise[_0xd38e('0x20')](_0x55b5a3);}return _0x1e7c43[_0xd38e('0x21')]();};}function saveUpdates(_0x585fab,_0x50ac27){return function(_0x138ea4){if(_0x138ea4){return _0x138ea4['update'](_0x585fab)[_0xd38e('0x22')](function(_0x2498bd){return _0x2498bd;});}return null;};}function removeEntity(_0x2c956a,_0x4e5ee4){return function(_0x156939){if(_0x156939){return _0x156939[_0xd38e('0x23')]()[_0xd38e('0x22')](function(){_0x2c956a['status'](0xcc)[_0xd38e('0x17')]();});}};}function handleEntityNotFound(_0x2be45a,_0x4b750e){return function(_0x479c94){if(!_0x479c94){_0x2be45a[_0xd38e('0x16')](0x194);}return _0x479c94;};}function handleError(_0x3b68ec,_0x572c43){_0x572c43=_0x572c43||0x1f4;return function(_0x3db537){logger[_0xd38e('0x24')](_0x3db537[_0xd38e('0x25')]);if(_0x3db537[_0xd38e('0x26')]){delete _0x3db537[_0xd38e('0x26')];}_0x3b68ec[_0xd38e('0x1d')](_0x572c43)[_0xd38e('0x27')](_0x3db537);};}exports[_0xd38e('0x28')]=function(_0x3438a7,_0x36b2ea){var _0x4d30f0={},_0x439975={},_0x1f2817={'count':0x0,'rows':[]};var _0x1c0208=_[_0xd38e('0x29')](db[_0xd38e('0x2a')]['rawAttributes'],function(_0x269e26){return{'name':_0x269e26['fieldName'],'type':_0x269e26[_0xd38e('0x2b')][_0xd38e('0x2c')]};});_0x439975['model']=_[_0xd38e('0x29')](_0x1c0208,_0xd38e('0x26'));_0x439975[_0xd38e('0x2d')]=_[_0xd38e('0x2e')](_0x3438a7[_0xd38e('0x2d')]);_0x439975[_0xd38e('0x2f')]=_[_0xd38e('0x30')](_0x439975[_0xd38e('0x31')],_0x439975[_0xd38e('0x2d')]);_0x4d30f0['attributes']=_[_0xd38e('0x30')](_0x439975[_0xd38e('0x31')],qs[_0xd38e('0x32')](_0x3438a7[_0xd38e('0x2d')][_0xd38e('0x32')]));_0x4d30f0['attributes']=_0x4d30f0['attributes'][_0xd38e('0x33')]?_0x4d30f0[_0xd38e('0x34')]:_0x439975[_0xd38e('0x31')];if(!_0x3438a7['query'][_0xd38e('0x35')]('nolimit')){_0x4d30f0[_0xd38e('0x1b')]=qs[_0xd38e('0x1b')](_0x3438a7[_0xd38e('0x2d')]['limit']);_0x4d30f0[_0xd38e('0x19')]=qs['offset'](_0x3438a7[_0xd38e('0x2d')]['offset']);}_0x4d30f0[_0xd38e('0x36')]=qs['sort'](_0x3438a7['query'][_0xd38e('0x37')]);_0x4d30f0[_0xd38e('0x38')]=qs['filters'](_[_0xd38e('0x39')](_0x3438a7['query'],_0x439975[_0xd38e('0x2f')]),_0x1c0208);if(_0x3438a7['query']['filter']){_0x4d30f0['where']=_[_0xd38e('0x3a')](_0x4d30f0[_0xd38e('0x38')],{'$or':_[_0xd38e('0x29')](_0x1c0208,function(_0x22056d){if(_0x22056d[_0xd38e('0x2b')]!==_0xd38e('0x3b')){var _0x3b112c={};_0x3b112c[_0x22056d[_0xd38e('0x26')]]={'$like':'%'+_0x3438a7[_0xd38e('0x2d')][_0xd38e('0x3c')]+'%'};return _0x3b112c;}})});}_0x4d30f0=_['merge']({},_0x4d30f0,_0x3438a7[_0xd38e('0x3d')]);var _0xdc6cc4={'where':_0x4d30f0[_0xd38e('0x38')]};return db[_0xd38e('0x2a')][_0xd38e('0x1c')](_0xdc6cc4)[_0xd38e('0x22')](function(_0x4fc485){_0x1f2817['count']=_0x4fc485;if(_0x3438a7['query'][_0xd38e('0x3e')]){_0x4d30f0[_0xd38e('0x3f')]=[{'all':!![]}];}return db[_0xd38e('0x2a')]['findAll'](_0x4d30f0);})[_0xd38e('0x22')](function(_0x1268c9){_0x1f2817[_0xd38e('0x40')]=_0x1268c9;return _0x1f2817;})['then'](respondWithFilteredResult(_0x36b2ea,_0x4d30f0))[_0xd38e('0x41')](handleError(_0x36b2ea,null));};exports[_0xd38e('0x42')]=function(_0x19f5ca,_0xc23679){var _0x5a2ed2={'raw':!![],'where':{'id':_0x19f5ca[_0xd38e('0x43')]['id']}},_0x3efc77={};_0x3efc77[_0xd38e('0x31')]=_['keys'](db[_0xd38e('0x2a')]['rawAttributes']);_0x3efc77['query']=_[_0xd38e('0x2e')](_0x19f5ca[_0xd38e('0x2d')]);_0x3efc77[_0xd38e('0x2f')]=_[_0xd38e('0x30')](_0x3efc77['model'],_0x3efc77[_0xd38e('0x2d')]);_0x5a2ed2[_0xd38e('0x34')]=_['intersection'](_0x3efc77[_0xd38e('0x31')],qs[_0xd38e('0x32')](_0x19f5ca['query'][_0xd38e('0x32')]));_0x5a2ed2[_0xd38e('0x34')]=_0x5a2ed2['attributes']['length']?_0x5a2ed2[_0xd38e('0x34')]:_0x3efc77['model'];if(_0x19f5ca[_0xd38e('0x2d')]['includeAll']){_0x5a2ed2['include']=[{'all':!![]}];}_0x5a2ed2=_[_0xd38e('0x3a')]({},_0x5a2ed2,_0x19f5ca['options']);return db[_0xd38e('0x2a')]['find'](_0x5a2ed2)[_0xd38e('0x22')](handleEntityNotFound(_0xc23679,null))[_0xd38e('0x22')](respondWithResult(_0xc23679,null))['catch'](handleError(_0xc23679,null));};exports[_0xd38e('0x44')]=function(_0x177711,_0x58086e){var _0x467b86={'where':{'id':_0x177711[_0xd38e('0x43')]['id']}},_0x195076={};_0x195076[_0xd38e('0x31')]=_['keys'](db[_0xd38e('0x2a')]['rawAttributes']);_0x467b86[_0xd38e('0x34')]=_[_0xd38e('0x30')](_0x195076[_0xd38e('0x31')],qs['fields'](_0x177711[_0xd38e('0x2d')]['fields']));_0x467b86[_0xd38e('0x34')]=_0x467b86[_0xd38e('0x34')][_0xd38e('0x33')]?_0x467b86[_0xd38e('0x34')]:_0x195076[_0xd38e('0x31')];if(_0x177711[_0xd38e('0x2d')][_0xd38e('0x3e')]){_0x467b86['include']=[{'all':!![]}];}_0x467b86=_[_0xd38e('0x3a')]({},_0x467b86,_0x177711[_0xd38e('0x3d')]);return db[_0xd38e('0x2a')]['find'](_0x467b86)['then'](handleEntityNotFound(_0x58086e,null))[_0xd38e('0x22')](function(_0x465fae){if(_0x465fae){var _0x9e52a7=_0x465fae['get']({'plain':!![]});_0x9e52a7=qs[_0xd38e('0x45')](_0x9e52a7,['id',_0xd38e('0x46'),'updatedAt']);_0x177711['body']=_[_0xd38e('0x45')](_0x177711['body'],['id','createdAt',_0xd38e('0x47')]);return db[_0xd38e('0x2a')]['create'](_[_0xd38e('0x3a')](_0x9e52a7,_0x177711['body']),{'include':_0x177711[_0xd38e('0x2d')][_0xd38e('0x3e')]?[{'all':!![]}]:undefined});}})[_0xd38e('0x22')](respondWithResult(_0x58086e,0xc9))[_0xd38e('0x41')](handleError(_0x58086e,null));};exports[_0xd38e('0x48')]=function(_0x18cbcc,_0x408a4d){if(_0x18cbcc[_0xd38e('0x49')]['id']){delete _0x18cbcc['body']['id'];}return db[_0xd38e('0x2a')][_0xd38e('0x4a')]({'where':{'id':_0x18cbcc[_0xd38e('0x43')]['id']}})['then'](handleEntityNotFound(_0x408a4d,null))[_0xd38e('0x22')](saveUpdates(_0x18cbcc['body'],null))['then'](respondWithResult(_0x408a4d,null))[_0xd38e('0x41')](handleError(_0x408a4d,null));};exports['destroy']=function(_0xe7ec2f,_0x2e077e){return db[_0xd38e('0x2a')][_0xd38e('0x4a')]({'where':{'id':_0xe7ec2f[_0xd38e('0x43')]['id']}})[_0xd38e('0x22')](handleEntityNotFound(_0x2e077e,null))['then'](removeEntity(_0x2e077e,null))[_0xd38e('0x41')](handleError(_0x2e077e,null));};exports[_0xd38e('0x4b')]=function(_0x2bdbc0,_0x3900d6,_0x61ee42){_0x2bdbc0[_0xd38e('0x49')][_0xd38e('0x26')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x4d')];_0x2bdbc0[_0xd38e('0x49')][_0xd38e('0x4e')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x4f')];_0x2bdbc0['body'][_0xd38e('0x2b')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x50')];return db[_0xd38e('0x2a')][_0xd38e('0x4b')](_0x2bdbc0['body'])[_0xd38e('0x22')](respondWithResult(_0x3900d6,0xc9))[_0xd38e('0x41')](handleError(_0x3900d6,null));};exports['download']=function(_0x3cdb42,_0x2d28d9,_0x41a6f1){return db[_0xd38e('0x2a')][_0xd38e('0x51')]({'where':{'id':_0x3cdb42[_0xd38e('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2d28d9,null))[_0xd38e('0x22')](function(_0x1f3785){if(_0x1f3785){var _0x2e2379=_0x1f3785['ChatOfflineMessageId']!==null;var _0x3a1393=path[_0xd38e('0x52')](config[_0xd38e('0x53')],_0xd38e('0x54'));if(_0x2e2379){_0x3a1393=path['join'](_0x3a1393,_0xd38e('0x55'));}var _0x3c000c=path['join'](_0x3a1393,_0x1f3785[_0xd38e('0x4e')]);return _0x2d28d9[_0xd38e('0x56')](_0x3c000c);}})[_0xd38e('0x41')](handleError(_0x2d28d9,null));}; \ No newline at end of file +var _0x2ac5=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','map','options','Attachment','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','clone','get','updatedAt','body','omit','createdAt','create','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x177d46,_0x3bc970){var _0x3f82ee=function(_0x273181){while(--_0x273181){_0x177d46['push'](_0x177d46['shift']());}};_0x3f82ee(++_0x3bc970);}(_0x2ac5,0x10f));var _0x52ac=function(_0x551b0a,_0x41348c){_0x551b0a=_0x551b0a-0x0;var _0x5dacb8=_0x2ac5[_0x551b0a];return _0x5dacb8;};'use strict';var emlformat=require(_0x52ac('0x0'));var rimraf=require(_0x52ac('0x1'));var zipdir=require(_0x52ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52ac('0x3'));var moment=require('moment');var BPromise=require(_0x52ac('0x4'));var Mustache=require(_0x52ac('0x5'));var util=require(_0x52ac('0x6'));var path=require(_0x52ac('0x7'));var sox=require('sox');var csv=require(_0x52ac('0x8'));var ejs=require(_0x52ac('0x9'));var fs=require('fs');var fs_extra=require(_0x52ac('0xa'));var _=require(_0x52ac('0xb'));var squel=require(_0x52ac('0xc'));var crypto=require(_0x52ac('0xd'));var jsforce=require(_0x52ac('0xe'));var deskjs=require(_0x52ac('0xf'));var toCsv=require(_0x52ac('0x8'));var querystring=require('querystring');var Papa=require(_0x52ac('0x10'));var Redis=require(_0x52ac('0x11'));var authService=require(_0x52ac('0x12'));var qs=require(_0x52ac('0x13'));var as=require(_0x52ac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x52ac('0x15'))(_0x52ac('0x16'));var utils=require(_0x52ac('0x17'));var config=require(_0x52ac('0x18'));var licenseUtil=require(_0x52ac('0x19'));var db=require(_0x52ac('0x1a'))['db'];function respondWithStatusCode(_0x234c4d,_0x2b7cfe){_0x2b7cfe=_0x2b7cfe||0xcc;return function(_0x3cc7ee){if(_0x3cc7ee){return _0x234c4d[_0x52ac('0x1b')](_0x2b7cfe);}return _0x234c4d[_0x52ac('0x1c')](_0x2b7cfe)[_0x52ac('0x1d')]();};}function respondWithResult(_0x3c1893,_0x4f86d4){_0x4f86d4=_0x4f86d4||0xc8;return function(_0x1ae027){if(_0x1ae027){return _0x3c1893[_0x52ac('0x1c')](_0x4f86d4)[_0x52ac('0x1e')](_0x1ae027);}};}function respondWithFilteredResult(_0x42b6f2,_0x32671d){return function(_0x5b01be){if(_0x5b01be){var _0x313419=typeof _0x32671d['offset']===_0x52ac('0x1f')&&typeof _0x32671d['limit']==='undefined';var _0x3f8737=_0x5b01be[_0x52ac('0x20')];var _0x5d52b5=_0x313419?0x0:_0x32671d[_0x52ac('0x21')];var _0x5d7dfa=_0x313419?_0x5b01be['count']:_0x32671d[_0x52ac('0x21')]+_0x32671d[_0x52ac('0x22')];var _0x5c532f;if(_0x5d7dfa>=_0x3f8737){_0x5d7dfa=_0x3f8737;_0x5c532f=0xc8;}else{_0x5c532f=0xce;}_0x42b6f2[_0x52ac('0x1c')](_0x5c532f);return _0x42b6f2[_0x52ac('0x23')](_0x52ac('0x24'),_0x5d52b5+'-'+_0x5d7dfa+'/'+_0x3f8737)[_0x52ac('0x1e')](_0x5b01be);}return null;};}function patchUpdates(_0x44c858){return function(_0x175d5d){try{jsonpatch[_0x52ac('0x25')](_0x175d5d,_0x44c858,!![]);}catch(_0x105f25){return BPromise['reject'](_0x105f25);}return _0x175d5d['save']();};}function saveUpdates(_0x1fe918,_0x1bebd9){return function(_0x560384){if(_0x560384){return _0x560384[_0x52ac('0x26')](_0x1fe918)[_0x52ac('0x27')](function(_0x687c79){return _0x687c79;});}return null;};}function removeEntity(_0x39bf9c,_0x4cc263){return function(_0x5a9c40){if(_0x5a9c40){return _0x5a9c40[_0x52ac('0x28')]()[_0x52ac('0x27')](function(){_0x39bf9c[_0x52ac('0x1c')](0xcc)[_0x52ac('0x1d')]();});}};}function handleEntityNotFound(_0x279f4e,_0xfcb36d){return function(_0x461870){if(!_0x461870){_0x279f4e[_0x52ac('0x1b')](0x194);}return _0x461870;};}function handleError(_0xaa2be0,_0x2cf357){_0x2cf357=_0x2cf357||0x1f4;return function(_0x12ce9b){logger[_0x52ac('0x29')](_0x12ce9b[_0x52ac('0x2a')]);if(_0x12ce9b[_0x52ac('0x2b')]){delete _0x12ce9b[_0x52ac('0x2b')];}_0xaa2be0[_0x52ac('0x1c')](_0x2cf357)[_0x52ac('0x2c')](_0x12ce9b);};}exports[_0x52ac('0x2d')]=function(_0x3851dc,_0x46d787){var _0x184a92={},_0x359b99={},_0x421dc2={'count':0x0,'rows':[]};var _0x4e6902=_['map'](db['Attachment']['rawAttributes'],function(_0x4b2ba2){return{'name':_0x4b2ba2[_0x52ac('0x2e')],'type':_0x4b2ba2[_0x52ac('0x2f')][_0x52ac('0x30')]};});_0x359b99['model']=_['map'](_0x4e6902,_0x52ac('0x2b'));_0x359b99[_0x52ac('0x31')]=_[_0x52ac('0x32')](_0x3851dc[_0x52ac('0x31')]);_0x359b99[_0x52ac('0x33')]=_[_0x52ac('0x34')](_0x359b99['model'],_0x359b99[_0x52ac('0x31')]);_0x184a92['attributes']=_[_0x52ac('0x34')](_0x359b99[_0x52ac('0x35')],qs[_0x52ac('0x36')](_0x3851dc[_0x52ac('0x31')][_0x52ac('0x36')]));_0x184a92[_0x52ac('0x37')]=_0x184a92[_0x52ac('0x37')][_0x52ac('0x38')]?_0x184a92['attributes']:_0x359b99['model'];if(!_0x3851dc[_0x52ac('0x31')][_0x52ac('0x39')]('nolimit')){_0x184a92[_0x52ac('0x22')]=qs[_0x52ac('0x22')](_0x3851dc[_0x52ac('0x31')][_0x52ac('0x22')]);_0x184a92[_0x52ac('0x21')]=qs[_0x52ac('0x21')](_0x3851dc[_0x52ac('0x31')][_0x52ac('0x21')]);}_0x184a92[_0x52ac('0x3a')]=qs[_0x52ac('0x3b')](_0x3851dc[_0x52ac('0x31')]['sort']);_0x184a92[_0x52ac('0x3c')]=qs[_0x52ac('0x33')](_['pick'](_0x3851dc[_0x52ac('0x31')],_0x359b99[_0x52ac('0x33')]),_0x4e6902);if(_0x3851dc[_0x52ac('0x31')][_0x52ac('0x3d')]){_0x184a92[_0x52ac('0x3c')]=_[_0x52ac('0x3e')](_0x184a92[_0x52ac('0x3c')],{'$or':_[_0x52ac('0x3f')](_0x4e6902,function(_0xb02ab4){if(_0xb02ab4[_0x52ac('0x2f')]!=='VIRTUAL'){var _0x1ee847={};_0x1ee847[_0xb02ab4[_0x52ac('0x2b')]]={'$like':'%'+_0x3851dc[_0x52ac('0x31')]['filter']+'%'};return _0x1ee847;}})});}_0x184a92=_[_0x52ac('0x3e')]({},_0x184a92,_0x3851dc[_0x52ac('0x40')]);var _0x4ac9de={'where':_0x184a92[_0x52ac('0x3c')]};return db[_0x52ac('0x41')][_0x52ac('0x20')](_0x4ac9de)[_0x52ac('0x27')](function(_0x12b446){_0x421dc2[_0x52ac('0x20')]=_0x12b446;if(_0x3851dc[_0x52ac('0x31')][_0x52ac('0x42')]){_0x184a92[_0x52ac('0x43')]=[{'all':!![]}];}return db[_0x52ac('0x41')][_0x52ac('0x44')](_0x184a92);})['then'](function(_0x1603b6){_0x421dc2[_0x52ac('0x45')]=_0x1603b6;return _0x421dc2;})['then'](respondWithFilteredResult(_0x46d787,_0x184a92))[_0x52ac('0x46')](handleError(_0x46d787,null));};exports[_0x52ac('0x47')]=function(_0x2e4f0c,_0x42c7a5){var _0x157fc3={'raw':!![],'where':{'id':_0x2e4f0c[_0x52ac('0x48')]['id']}},_0x37fb85={};_0x37fb85[_0x52ac('0x35')]=_[_0x52ac('0x32')](db[_0x52ac('0x41')][_0x52ac('0x49')]);_0x37fb85[_0x52ac('0x31')]=_[_0x52ac('0x32')](_0x2e4f0c[_0x52ac('0x31')]);_0x37fb85[_0x52ac('0x33')]=_[_0x52ac('0x34')](_0x37fb85[_0x52ac('0x35')],_0x37fb85['query']);_0x157fc3[_0x52ac('0x37')]=_[_0x52ac('0x34')](_0x37fb85[_0x52ac('0x35')],qs['fields'](_0x2e4f0c[_0x52ac('0x31')]['fields']));_0x157fc3['attributes']=_0x157fc3[_0x52ac('0x37')][_0x52ac('0x38')]?_0x157fc3[_0x52ac('0x37')]:_0x37fb85['model'];if(_0x2e4f0c[_0x52ac('0x31')][_0x52ac('0x42')]){_0x157fc3['include']=[{'all':!![]}];}_0x157fc3=_['merge']({},_0x157fc3,_0x2e4f0c[_0x52ac('0x40')]);return db['Attachment'][_0x52ac('0x4a')](_0x157fc3)[_0x52ac('0x27')](handleEntityNotFound(_0x42c7a5,null))[_0x52ac('0x27')](respondWithResult(_0x42c7a5,null))[_0x52ac('0x46')](handleError(_0x42c7a5,null));};exports[_0x52ac('0x4b')]=function(_0xa16ba9,_0x5853b3){var _0x3934bc={'where':{'id':_0xa16ba9['params']['id']}},_0x8207e8={};_0x8207e8[_0x52ac('0x35')]=_[_0x52ac('0x32')](db[_0x52ac('0x41')][_0x52ac('0x49')]);_0x3934bc[_0x52ac('0x37')]=_[_0x52ac('0x34')](_0x8207e8[_0x52ac('0x35')],qs['fields'](_0xa16ba9['query'][_0x52ac('0x36')]));_0x3934bc[_0x52ac('0x37')]=_0x3934bc[_0x52ac('0x37')][_0x52ac('0x38')]?_0x3934bc[_0x52ac('0x37')]:_0x8207e8['model'];if(_0xa16ba9[_0x52ac('0x31')]['includeAll']){_0x3934bc['include']=[{'all':!![]}];}_0x3934bc=_['merge']({},_0x3934bc,_0xa16ba9[_0x52ac('0x40')]);return db[_0x52ac('0x41')][_0x52ac('0x4a')](_0x3934bc)[_0x52ac('0x27')](handleEntityNotFound(_0x5853b3,null))[_0x52ac('0x27')](function(_0x242ad0){if(_0x242ad0){var _0x2b5163=_0x242ad0[_0x52ac('0x4c')]({'plain':!![]});_0x2b5163=qs['omit'](_0x2b5163,['id','createdAt',_0x52ac('0x4d')]);_0xa16ba9[_0x52ac('0x4e')]=_[_0x52ac('0x4f')](_0xa16ba9[_0x52ac('0x4e')],['id',_0x52ac('0x50'),_0x52ac('0x4d')]);return db[_0x52ac('0x41')]['create'](_[_0x52ac('0x3e')](_0x2b5163,_0xa16ba9[_0x52ac('0x4e')]),{'include':_0xa16ba9[_0x52ac('0x31')][_0x52ac('0x42')]?[{'all':!![]}]:undefined});}})[_0x52ac('0x27')](respondWithResult(_0x5853b3,0xc9))[_0x52ac('0x46')](handleError(_0x5853b3,null));};exports[_0x52ac('0x26')]=function(_0x41a644,_0x579506){if(_0x41a644['body']['id']){delete _0x41a644[_0x52ac('0x4e')]['id'];}return db[_0x52ac('0x41')]['find']({'where':{'id':_0x41a644['params']['id']}})[_0x52ac('0x27')](handleEntityNotFound(_0x579506,null))[_0x52ac('0x27')](saveUpdates(_0x41a644['body'],null))[_0x52ac('0x27')](respondWithResult(_0x579506,null))[_0x52ac('0x46')](handleError(_0x579506,null));};exports[_0x52ac('0x28')]=function(_0x100d0d,_0x55cd3f){return db[_0x52ac('0x41')][_0x52ac('0x4a')]({'where':{'id':_0x100d0d['params']['id']}})[_0x52ac('0x27')](handleEntityNotFound(_0x55cd3f,null))[_0x52ac('0x27')](removeEntity(_0x55cd3f,null))[_0x52ac('0x46')](handleError(_0x55cd3f,null));};exports[_0x52ac('0x51')]=function(_0x6f8b66,_0x2d46f7,_0xfc31b0){_0x6f8b66[_0x52ac('0x4e')]['name']=_0x6f8b66[_0x52ac('0x52')][_0x52ac('0x53')];_0x6f8b66['body'][_0x52ac('0x54')]=_0x6f8b66[_0x52ac('0x52')][_0x52ac('0x55')];_0x6f8b66[_0x52ac('0x4e')][_0x52ac('0x2f')]=_0x6f8b66['file']['mimetype'];return db[_0x52ac('0x41')][_0x52ac('0x51')](_0x6f8b66['body'])[_0x52ac('0x27')](respondWithResult(_0x2d46f7,0xc9))['catch'](handleError(_0x2d46f7,null));};exports[_0x52ac('0x56')]=function(_0x28064f,_0x5e4405,_0xeb70e8){return db[_0x52ac('0x41')]['findOne']({'where':{'id':_0x28064f[_0x52ac('0x48')]['id']},'raw':!![]})[_0x52ac('0x27')](handleEntityNotFound(_0x5e4405,null))[_0x52ac('0x27')](function(_0x118ab2){if(_0x118ab2){var _0x349473=_0x118ab2[_0x52ac('0x57')]!==null;var _0x484418=path[_0x52ac('0x58')](config[_0x52ac('0x59')],_0x52ac('0x5a'));if(_0x349473){_0x484418=path[_0x52ac('0x58')](_0x484418,_0x52ac('0x5b'));}var _0x38b7ef=path['join'](_0x484418,_0x118ab2[_0x52ac('0x54')]);return _0x5e4405[_0x52ac('0x56')](_0x38b7ef);}})['catch'](handleError(_0x5e4405,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 59de0b8..7e4e48e 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 _0x8092=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','attachments','lodash','util','api','moment','bluebird'];(function(_0x5e87ec,_0x20ed69){var _0x3c3207=function(_0x5eba01){while(--_0x5eba01){_0x5e87ec['push'](_0x5e87ec['shift']());}};_0x3c3207(++_0x20ed69);}(_0x8092,0x12f));var _0x2809=function(_0x18e20a,_0x3c9c8a){_0x18e20a=_0x18e20a-0x0;var _0x4fcbfe=_0x8092[_0x18e20a];return _0x4fcbfe;};'use strict';var _=require(_0x2809('0x0'));var util=require(_0x2809('0x1'));var logger=require('../../config/logger')(_0x2809('0x2'));var moment=require(_0x2809('0x3'));var BPromise=require(_0x2809('0x4'));var rp=require(_0x2809('0x5'));var fs=require('fs');var path=require(_0x2809('0x6'));var rimraf=require(_0x2809('0x7'));var config=require(_0x2809('0x8'));var attributes=require(_0x2809('0x9'));module['exports']=function(_0x461221,_0x4c2ad3){return _0x461221['define']('Attachment',attributes,{'tableName':_0x2809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5f0=['exports','define','attachments','../../config/logger','api','moment','bluebird','request-promise','path','./attachment.attributes'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa5f0,0x19d));var _0x0a5f=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xa5f0[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a5f('0x0'))(_0x0a5f('0x1'));var moment=require(_0x0a5f('0x2'));var BPromise=require(_0x0a5f('0x3'));var rp=require(_0x0a5f('0x4'));var fs=require('fs');var path=require(_0x0a5f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a5f('0x6'));module[_0x0a5f('0x7')]=function(_0x632e51,_0x524f9f){return _0x632e51[_0x0a5f('0x8')]('Attachment',attributes,{'tableName':_0x0a5f('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 60171bd..84565b0 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 _0x7a2c=['request','info','Attachment,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','create','body','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x59c856,_0x37d3c7){var _0x203648=function(_0xae99b6){while(--_0xae99b6){_0x59c856['push'](_0x59c856['shift']());}};_0x203648(++_0x37d3c7);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x4d13fb,_0xc83d5c){_0x4d13fb=_0x4d13fb-0x0;var _0x5a0d53=_0x7a2c[_0x4d13fb];return _0x5a0d53;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('Attachment,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});}exports[_0xc7a2('0x16')]=function(_0x302d54){var _0x293343=this;return new Promise(function(_0x3da373,_0x4e50fb){return db['Attachment'][_0xc7a2('0x17')](_0x302d54[_0xc7a2('0x18')],{'raw':_0x302d54['options']?_0x302d54['options']['raw']===undefined?!![]:![]:!![]})[_0xc7a2('0x19')](function(_0x5a2f40){logger[_0xc7a2('0xc')](_0xc7a2('0x16'),_0x302d54);logger['debug'](_0xc7a2('0x16'),_0x302d54,JSON[_0xc7a2('0x10')](_0x5a2f40));_0x3da373(_0x5a2f40);})[_0xc7a2('0x15')](function(_0x35e0f6){logger[_0xc7a2('0x11')](_0xc7a2('0x16'),_0x35e0f6[_0xc7a2('0x13')],_0x302d54);_0x4e50fb(_0x293343['error'](0x1f4,_0x35e0f6['message']));});});}; \ No newline at end of file +var _0x0fc2=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x21f425,_0x16f48f){var _0x261f03=function(_0x5616d0){while(--_0x5616d0){_0x21f425['push'](_0x21f425['shift']());}};_0x261f03(++_0x16f48f);}(_0x0fc2,0x6e));var _0x20fc=function(_0x50f1e4,_0xd2e4d6){_0x50f1e4=_0x50f1e4-0x0;var _0x470580=_0x0fc2[_0x50f1e4];return _0x470580;};'use strict';var _=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var moment=require(_0x20fc('0x2'));var BPromise=require(_0x20fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20fc('0x4'));var db=require(_0x20fc('0x5'))['db'];var utils=require(_0x20fc('0x6'));var logger=require(_0x20fc('0x7'))(_0x20fc('0x8'));var config=require(_0x20fc('0x9'));var jayson=require(_0x20fc('0xa'));var client=jayson[_0x20fc('0xb')][_0x20fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc556e8,_0x157c28,_0x470d1a){return new BPromise(function(_0x24b617,_0x17415e){return client[_0x20fc('0xd')](_0xc556e8,_0x470d1a)[_0x20fc('0xe')](function(_0x5cb749){logger[_0x20fc('0xf')](_0x20fc('0x10'),_0x157c28,_0x20fc('0x11'));logger['debug'](_0x20fc('0x12'),_0x157c28,_0x20fc('0x11'),JSON[_0x20fc('0x13')](_0x5cb749));if(_0x5cb749[_0x20fc('0x14')]){if(_0x5cb749[_0x20fc('0x14')][_0x20fc('0x15')]===0x1f4){logger[_0x20fc('0x14')](_0x20fc('0x10'),_0x157c28,_0x5cb749['error'][_0x20fc('0x16')]);return _0x17415e(_0x5cb749['error'][_0x20fc('0x16')]);}logger['error'](_0x20fc('0x10'),_0x157c28,_0x5cb749['error'][_0x20fc('0x16')]);return _0x24b617(_0x5cb749[_0x20fc('0x14')][_0x20fc('0x16')]);}else{logger[_0x20fc('0xf')](_0x20fc('0x10'),_0x157c28,_0x20fc('0x11'));_0x24b617(_0x5cb749[_0x20fc('0x17')][_0x20fc('0x16')]);}})['catch'](function(_0x56eaf4){logger[_0x20fc('0x14')](_0x20fc('0x10'),_0x157c28,_0x56eaf4);_0x17415e(_0x56eaf4);});});}exports[_0x20fc('0x18')]=function(_0x421ff8){var _0x4d5e00=this;return new Promise(function(_0x3f4190,_0x322e2c){return db[_0x20fc('0x19')][_0x20fc('0x1a')](_0x421ff8[_0x20fc('0x1b')],{'raw':_0x421ff8[_0x20fc('0x1c')]?_0x421ff8[_0x20fc('0x1c')][_0x20fc('0x1d')]===undefined?!![]:![]:!![]})[_0x20fc('0xe')](function(_0x41be86){logger['info'](_0x20fc('0x18'),_0x421ff8);logger[_0x20fc('0x1e')]('CreateAttachment',_0x421ff8,JSON[_0x20fc('0x13')](_0x41be86));_0x3f4190(_0x41be86);})[_0x20fc('0x1f')](function(_0x359881){logger[_0x20fc('0x14')](_0x20fc('0x18'),_0x359881[_0x20fc('0x16')],_0x421ff8);_0x322e2c(_0x4d5e00[_0x20fc('0x14')](0x1f4,_0x359881['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 998b809..053824b 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x4c6393,_0x3d9d4d){var _0x22b930=function(_0x9f59f9){while(--_0x9f59f9){_0x4c6393['push'](_0x4c6393['shift']());}};_0x22b930(++_0x3d9d4d);}(_0xb10b,0x12a));var _0xbb10=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xb10b[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=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(_0x34d3fa,_0x2e54e1){var _0x1257c3=function(_0x41503d){while(--_0x41503d){_0x34d3fa['push'](_0x34d3fa['shift']());}};_0x1257c3(++_0x2e54e1);}(_0xadb5,0xad));var _0x5adb=function(_0x6b2927,_0x568817){_0x6b2927=_0x6b2927-0x0;var _0x295067=_0xadb5[_0x6b2927];return _0x295067;};'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 59546ad..759c5bc 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 _0x3b61=['then','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','signToken','json','password','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','name','salt','role','blocked','blockedAt','online','admin','agent'];(function(_0x52b182,_0x3fa5b5){var _0x4d1287=function(_0x5742ce){while(--_0x5742ce){_0x52b182['push'](_0x52b182['shift']());}};_0x4d1287(++_0x3fa5b5);}(_0x3b61,0x67));var _0x13b6=function(_0x5c4756,_0x373235){_0x5c4756=_0x5c4756-0x0;var _0x600499=_0x3b61[_0x5c4756];return _0x600499;};'use strict';var passport=require(_0x13b6('0x0'));var LocalStrategy=require(_0x13b6('0x1'))[_0x13b6('0x2')];var moment=require(_0x13b6('0x3'));var ActiveDirectory=require(_0x13b6('0x4'));var BPromise=require(_0x13b6('0x5'));var util=require(_0x13b6('0x6'));var db=require(_0x13b6('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x13b6('0x8'));var config=require(_0x13b6('0x9'));var logger=require(_0x13b6('0xa'))('api');function isActiveDirectoryConfigured(_0x217b6e){var _0x7d8b81=![];if(typeof _0x217b6e[_0x13b6('0xb')]!==_0x13b6('0xc')){_0x7d8b81=_0x217b6e[_0x13b6('0xb')]['baseDN']&&_0x217b6e[_0x13b6('0xb')][_0x13b6('0xd')]&&_0x217b6e[_0x13b6('0xb')][_0x13b6('0xe')];}return _0x7d8b81;}function adAuthenticate(_0xf65302,_0x4300b6,_0x2ea29f){return new BPromise(function(_0x289d02,_0xa17cab){try{var _0x12560d=new ActiveDirectory(_0xf65302);_0x12560d[_0x13b6('0xf')](_0x4300b6,_0x2ea29f,function(_0x3ef0d5,_0x111061){if(_0x3ef0d5){logger[_0x13b6('0x10')](_0x13b6('0x11'),_0x4300b6,util['inspect'](_0x3ef0d5,{'showHidden':![],'depth':null}));_0xa17cab('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x111061){logger[_0x13b6('0x10')](_0x13b6('0x12'),_0x4300b6);_0xa17cab(_0x13b6('0x13'));}else{_0x289d02(_0x111061);}});}catch(_0x8425d4){_0xa17cab(_0x8425d4);}});}function ActiveDirectoryAuthenticate(_0xb6b2c3,_0x1770a5,_0x323b91,_0x3dfc71){var _0x58326e,_0x556a01;if(!isActiveDirectoryConfigured(config)){logger[_0x13b6('0x10')](_0x13b6('0x14'),_0x1770a5);return _0x3dfc71(null,![],{'message':_0x13b6('0x13')});}return db[_0x13b6('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x13b6('0x16'),_0x13b6('0x17')],'raw':!![]})['then'](function(_0x3ac9b2){_0x58326e=_0x3ac9b2;if(!_0x58326e[_0x13b6('0x16')]){logger[_0x13b6('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1770a5);throw new Error(_0x13b6('0x13'));}return _0xb6b2c3['findOne']({'logging':!![],'attributes':['id',_0x13b6('0x18'),'password',_0x13b6('0x19'),_0x13b6('0x1a'),'disabled',_0x13b6('0x1b'),_0x13b6('0x1c'),_0x13b6('0x1d')],'where':{'name':_0x1770a5,'role':{'$or':[_0x13b6('0x1e'),'user',_0x13b6('0x1f')]},'adSsoEnabled':!![]}});})[_0x13b6('0x20')](function(_0x1239c7){if(!_0x1239c7||_0x1239c7&&_0x1239c7[_0x13b6('0x18')]!==_0x1770a5){throw new Error(_0x13b6('0x13'));}_0x556a01=_0x1239c7;var _0x28f5b3=_0x556a01[_0x13b6('0x18')]+'@'+config[_0x13b6('0xb')][_0x13b6('0xe')];return adAuthenticate(config[_0x13b6('0xb')],_0x28f5b3,_0x323b91);})['then'](function(_0x19777c){if(_0x556a01['disabled']){throw new Error(_0x13b6('0x13'));}if(_0x58326e[_0x13b6('0x17')]>0x0){if(_0x556a01[_0x13b6('0x1b')]){if(moment(_0x556a01[_0x13b6('0x1c')])[_0x13b6('0x21')](_0x58326e[_0x13b6('0x17')],_0x13b6('0x22'))>moment()){throw new Error(_0x13b6('0x13'));}return utils[_0x13b6('0x23')](_0x556a01,0x0,![],null)['then'](function(){return utils[_0x13b6('0x24')](_0x556a01);})[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}else{return utils[_0x13b6('0x24')](_0x556a01)[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}}else{return utils[_0x13b6('0x24')](_0x556a01)[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}})['catch'](function(_0x1e072a){return _0x3dfc71(null,![],_0x1e072a);});}function handleError(_0x3d72ab,_0x210a8f,_0x4d246d){return _0x3d72ab[_0x13b6('0x25')](_0x210a8f||0x1f4)[_0x13b6('0x26')]({'message':_0x4d246d?_0x4d246d[_0x13b6('0x27')]||_0x4d246d:''});}exports[_0x13b6('0x28')]=function(_0x35d95a,_0x5703c3,_0x2fe151){passport[_0x13b6('0xf')](_0x13b6('0x29'),function(_0x45fcf2,_0x578b47,_0x3a5d8c){var _0x5eee09=_0x45fcf2||_0x3a5d8c;if(_0x5eee09){return handleError(_0x5703c3,0x191,_0x5eee09);}if(!_0x578b47){return handleError(_0x5703c3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x48b0b1={'payload':{'id':_0x578b47['id'],'role':_0x578b47[_0x13b6('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x13b6('0x2a')](_0x48b0b1)[_0x13b6('0x20')](function(_0x2b9edf){_0x5703c3[_0x13b6('0x2b')]({'id':_0x578b47['id'],'token':_0x2b9edf,'statusCall':'','isAlreadyLogged':_0x578b47['online']});});}})(_0x35d95a,_0x5703c3,_0x2fe151);};passport['use'](_0x13b6('0x29'),new LocalStrategy({'usernameField':_0x13b6('0x18'),'passwordField':_0x13b6('0x2c')},function(_0x4d2a21,_0x25c89d,_0x1457e9){return ActiveDirectoryAuthenticate(db['User'],_0x4d2a21,_0x25c89d,_0x1457e9);})); \ No newline at end of file +var _0xf83f=['clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','passport','passport-local','Strategy','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','disabled','blocked','blockedAt','online','admin','user','name','blockDuration','add','minutes'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xf83f,0xff));var _0xff83=function(_0x31d350,_0x260a1b){_0x31d350=_0x31d350-0x0;var _0x28035f=_0xf83f[_0x31d350];return _0x28035f;};'use strict';var passport=require(_0xff83('0x0'));var LocalStrategy=require(_0xff83('0x1'))[_0xff83('0x2')];var moment=require('moment');var ActiveDirectory=require(_0xff83('0x3'));var BPromise=require(_0xff83('0x4'));var util=require('util');var db=require(_0xff83('0x5'))['db'];var authService=require(_0xff83('0x6'));var utils=require(_0xff83('0x7'));var config=require('../../config/environment');var logger=require(_0xff83('0x8'))(_0xff83('0x9'));function isActiveDirectoryConfigured(_0x34642c){var _0x7c48a7=![];if(typeof _0x34642c[_0xff83('0xa')]!==_0xff83('0xb')){_0x7c48a7=_0x34642c[_0xff83('0xa')][_0xff83('0xc')]&&_0x34642c[_0xff83('0xa')][_0xff83('0xd')]&&_0x34642c['activedirectory'][_0xff83('0xe')];}return _0x7c48a7;}function adAuthenticate(_0x2b7a46,_0x10fecc,_0x2b7217){return new BPromise(function(_0x33ba0b,_0x1a4c54){try{var _0xd6bf70=new ActiveDirectory(_0x2b7a46);_0xd6bf70[_0xff83('0xf')](_0x10fecc,_0x2b7217,function(_0x4998d5,_0x493827){if(_0x4998d5){logger[_0xff83('0x10')](_0xff83('0x11'),_0x10fecc,util[_0xff83('0x12')](_0x4998d5,{'showHidden':![],'depth':null}));_0x1a4c54('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x493827){logger[_0xff83('0x10')](_0xff83('0x13'),_0x10fecc);_0x1a4c54('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x33ba0b(_0x493827);}});}catch(_0x5c39b0){_0x1a4c54(_0x5c39b0);}});}function ActiveDirectoryAuthenticate(_0x2d62eb,_0x352596,_0xd87ec0,_0x9ab202){var _0x5998f1,_0x2cc5f8;if(!isActiveDirectoryConfigured(config)){logger[_0xff83('0x10')](_0xff83('0x14'),_0x352596);return _0x9ab202(null,![],{'message':_0xff83('0x15')});}return db[_0xff83('0x16')][_0xff83('0x17')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xff83('0x18')](function(_0x1e717d){_0x5998f1=_0x1e717d;if(!_0x5998f1[_0xff83('0x19')]){logger['error'](_0xff83('0x1a'),_0x352596);throw new Error(_0xff83('0x15'));}return _0x2d62eb[_0xff83('0x17')]({'logging':!![],'attributes':['id','name',_0xff83('0x1b'),_0xff83('0x1c'),'role',_0xff83('0x1d'),_0xff83('0x1e'),_0xff83('0x1f'),_0xff83('0x20')],'where':{'name':_0x352596,'role':{'$or':[_0xff83('0x21'),_0xff83('0x22'),'agent']},'adSsoEnabled':!![]}});})[_0xff83('0x18')](function(_0x440b29){if(!_0x440b29||_0x440b29&&_0x440b29[_0xff83('0x23')]!==_0x352596){throw new Error(_0xff83('0x15'));}_0x2cc5f8=_0x440b29;var _0x4b6208=_0x2cc5f8[_0xff83('0x23')]+'@'+config[_0xff83('0xa')][_0xff83('0xe')];return adAuthenticate(config['activedirectory'],_0x4b6208,_0xd87ec0);})[_0xff83('0x18')](function(_0x29f238){if(_0x2cc5f8['disabled']){throw new Error(_0xff83('0x15'));}if(_0x5998f1[_0xff83('0x24')]>0x0){if(_0x2cc5f8['blocked']){if(moment(_0x2cc5f8[_0xff83('0x1f')])[_0xff83('0x25')](_0x5998f1['blockDuration'],_0xff83('0x26'))>moment()){throw new Error(_0xff83('0x15'));}return utils[_0xff83('0x27')](_0x2cc5f8,0x0,![],null)[_0xff83('0x18')](function(){return utils[_0xff83('0x28')](_0x2cc5f8);})[_0xff83('0x18')](function(){return _0x9ab202(null,_0x2cc5f8);});}else{return utils[_0xff83('0x28')](_0x2cc5f8)[_0xff83('0x18')](function(){return _0x9ab202(null,_0x2cc5f8);});}}else{return utils[_0xff83('0x28')](_0x2cc5f8)[_0xff83('0x18')](function(){return _0x9ab202(null,_0x2cc5f8);});}})[_0xff83('0x29')](function(_0x27f236){return _0x9ab202(null,![],_0x27f236);});}function handleError(_0x469e39,_0x4e3237,_0x3d0f83){return _0x469e39[_0xff83('0x2a')](_0x4e3237||0x1f4)[_0xff83('0x2b')]({'message':_0x3d0f83?_0x3d0f83['message']||_0x3d0f83:''});}exports[_0xff83('0x2c')]=function(_0x15125d,_0x1b80b8,_0xa8e8da){passport[_0xff83('0xf')](_0xff83('0x2d'),function(_0x263de4,_0x1941d9,_0x5142b6){var _0x768f7=_0x263de4||_0x5142b6;if(_0x768f7){return handleError(_0x1b80b8,0x191,_0x768f7);}if(!_0x1941d9){return handleError(_0x1b80b8,0x194,{'message':_0xff83('0x2e')});}else{var _0x5ac23a={'payload':{'id':_0x1941d9['id'],'role':_0x1941d9[_0xff83('0x2f')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5ac23a)[_0xff83('0x18')](function(_0x22e197){_0x1b80b8[_0xff83('0x30')]({'id':_0x1941d9['id'],'token':_0x22e197,'statusCall':'','isAlreadyLogged':_0x1941d9[_0xff83('0x20')]});});}})(_0x15125d,_0x1b80b8,_0xa8e8da);};passport['use'](_0xff83('0x2d'),new LocalStrategy({'usernameField':_0xff83('0x23'),'passwordField':_0xff83('0x1b')},function(_0x4e255b,_0x3aa065,_0x234dbe){return ActiveDirectoryAuthenticate(db['User'],_0x4e255b,_0x3aa065,_0x234dbe);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 6edf6a2..a36f908 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 _0xb18a=['./authActiveDirectory.controller','post','exports','express'];(function(_0xe66276,_0x165f4e){var _0x2354c1=function(_0x37f151){while(--_0x37f151){_0xe66276['push'](_0xe66276['shift']());}};_0x2354c1(++_0x165f4e);}(_0xb18a,0x19f));var _0xab18=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb18a[_0x16b9ed];return _0x66b1f8;};'use strict';var express=require(_0xab18('0x0'));var router=express['Router']();var controller=require(_0xab18('0x1'));router[_0xab18('0x2')]('/',controller['login']);module[_0xab18('0x3')]=router; \ No newline at end of file +var _0xd614=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0xd614,0x9a));var _0x4d61=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd614[_0x618414];return _0x21c19a;};'use strict';var express=require('express');var router=express[_0x4d61('0x0')]();var controller=require(_0x4d61('0x1'));router[_0x4d61('0x2')]('/',controller[_0x4d61('0x3')]);module[_0x4d61('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 04eacc4..ecd2f14 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x4c5add,_0x20076e){_0x4c5add=_0x4c5add-0x0;var _0x1bdf7e=_0x7a54[_0x4c5add];return _0x1bdf7e;};'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(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7a54,0x106));var _0x47a5=function(_0x59c1bd,_0x54a96c){_0x59c1bd=_0x59c1bd-0x0;var _0x30c166=_0x7a54[_0x59c1bd];return _0x30c166;};'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 04f4df8..eec6323 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 _0x41a6=['login','setTokenCookie','exports','./authGoogle.controller','../user/user.controller.js','get','/callback','isMiddleware'];(function(_0x103b2e,_0x4293f1){var _0x14a460=function(_0x592c76){while(--_0x592c76){_0x103b2e['push'](_0x103b2e['shift']());}};_0x14a460(++_0x4293f1);}(_0x41a6,0x16b));var _0x641a=function(_0x33c6e3,_0x24ce45){_0x33c6e3=_0x33c6e3-0x0;var _0x1119e0=_0x41a6[_0x33c6e3];return _0x1119e0;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0x641a('0x0'));var userController=require(_0x641a('0x1'));var authService=require('../../components/auth/service');router[_0x641a('0x2')]('/',controller['login']);router[_0x641a('0x2')](_0x641a('0x3'),controller['callback'],authService[_0x641a('0x4')],userController[_0x641a('0x5')],authService[_0x641a('0x6')]);module[_0x641a('0x7')]=router; \ No newline at end of file +var _0x10b2=['callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x10b2,0x18e));var _0x210b=function(_0x2471d6,_0x11dd31){_0x2471d6=_0x2471d6-0x0;var _0x847aec=_0x10b2[_0x2471d6];return _0x847aec;};'use strict';var express=require(_0x210b('0x0'));var passport=require(_0x210b('0x1'));var router=express[_0x210b('0x2')]();var controller=require(_0x210b('0x3'));var userController=require(_0x210b('0x4'));var authService=require(_0x210b('0x5'));router['get']('/',controller[_0x210b('0x6')]);router[_0x210b('0x7')](_0x210b('0x8'),controller[_0x210b('0x9')],authService[_0x210b('0xa')],userController[_0x210b('0x6')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 3b9f39b..73edbf5 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 _0xa78e=['blocked','blockedAt','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','clearBlockUser','disabled','minutes','getLicense','catch','MailAccount','find','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','auth','pass','format','email','request','error','message','stringify','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','resetPasswordExpires','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','role'];(function(_0x5782e6,_0x7de50f){var _0x3f15d7=function(_0x1adae5){while(--_0x1adae5){_0x5782e6['push'](_0x5782e6['shift']());}};_0x3f15d7(++_0x7de50f);}(_0xa78e,0x194));var _0xea78=function(_0x59f3f4,_0x450a59){_0x59f3f4=_0x59f3f4-0x0;var _0xb0df5f=_0xa78e[_0x59f3f4];return _0xb0df5f;};'use strict';var util=require(_0xea78('0x0'));var passport=require(_0xea78('0x1'));var LocalStrategy=require('passport-local')[_0xea78('0x2')];var jayson=require('jayson/promise');var _=require(_0xea78('0x3'));var rs=require(_0xea78('0x4'));var moment=require(_0xea78('0x5'));var db=require(_0xea78('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xea78('0x7'));var client=jayson[_0xea78('0x8')][_0xea78('0x9')]({'port':0x232b});function localAuthenticate(_0x5d83e5,_0x3d1843,_0x238ada,_0x451a17){var _0x271011,_0x2d3f73;return db[_0xea78('0xa')][_0xea78('0xb')]({'where':{'id':0x1},'attributes':[_0xea78('0xc'),_0xea78('0xd')],'raw':!![]})[_0xea78('0xe')](function(_0x3fd743){_0x271011=_0x3fd743;return _0x5d83e5['findOne']({'attributes':['id','name','password','salt',_0xea78('0xf'),'disabled',_0xea78('0x10'),_0xea78('0x11'),'loginAttempts'],'where':{'name':_0x3d1843,'role':{'$or':['admin',_0xea78('0x12'),'agent']}}});})[_0xea78('0xe')](function(_0x7b5223){if(!_0x7b5223||_0x7b5223&&_0x7b5223[_0xea78('0x13')]!==_0x3d1843){throw new Error(_0xea78('0x14'));}else{_0x2d3f73=_0x7b5223;return _0x2d3f73;}})['then'](function(){_0x2d3f73['authenticate'](_0x238ada,function(_0xd15d22,_0x1dfa6f){var _0x2b0835=_0x2d3f73[_0xea78('0x15')]+0x1;if(_0xd15d22){return _0x451a17(_0xd15d22);}else if(!_0x1dfa6f){if(_0x2d3f73['disabled']){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else if(_0x271011[_0xea78('0xc')]>0x0){if(_0x2d3f73['blocked']){if(_0x271011['blockDuration']>0x0){if(moment(_0x2d3f73[_0xea78('0x11')])[_0xea78('0x16')](_0x271011[_0xea78('0xd')],'minutes')>moment()){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x17')](_0x2d3f73,_0x2b0835,![],null)[_0xea78('0xe')](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2b0835>=_0x271011[_0xea78('0xc')]){return utils[_0xea78('0x17')](_0x2d3f73,0x0,!![],moment())[_0xea78('0xe')](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}else{return utils[_0xea78('0x17')](_0x2d3f73,_0x2b0835,![],null)['then'](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2d3f73[_0xea78('0x18')]){return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x271011['allowedLoginAttempts']>0x0){if(_0x2d3f73[_0xea78('0x10')]){if(_0x271011[_0xea78('0xd')]>0x0){if(moment(_0x2d3f73[_0xea78('0x11')])[_0xea78('0x16')](_0x271011[_0xea78('0xd')],_0xea78('0x19'))>moment()){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x17')](_0x2d3f73,0x0,![],null)[_0xea78('0xe')](function(){return utils[_0xea78('0x1a')](_0x2d3f73);})[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);});}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xea78('0x17')](_0x2d3f73,0x0,![],null)[_0xea78('0xe')](function(){return utils[_0xea78('0x1a')](_0x2d3f73);})[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);})['catch'](function(_0x499cae){return _0x451a17(null,![],_0x499cae);});}}else{if(_0x2d3f73[_0xea78('0x10')]){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x1a')](_0x2d3f73)[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);});}}}});})[_0xea78('0x1b')](function(_0x3fcce0){return _0x451a17(null,![],_0x3fcce0);});}function sendServiceMail(_0x26b3c9){return db[_0xea78('0x1c')][_0xea78('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xea78('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xea78('0xe')](function(_0x1505c3){if(!_0x1505c3){throw new Error(_0xea78('0x1e'));}var _0x582a3b={'tls':{'rejectUnauthorized':![]}};if(_0x1505c3[_0xea78('0x1f')]['service']){_0x582a3b[_0xea78('0x20')]=_0x1505c3[_0xea78('0x1f')][_0xea78('0x20')];}else{_0x582a3b[_0xea78('0x21')]=_0x1505c3['Smtp']['host'];_0x582a3b[_0xea78('0x22')]=_0x1505c3[_0xea78('0x1f')]['port'];_0x582a3b[_0xea78('0x23')]=_0x1505c3[_0xea78('0x1f')][_0xea78('0x23')];}if(_0x1505c3[_0xea78('0x1f')]['authentication']){_0x582a3b[_0xea78('0x24')]={'user':_0x1505c3[_0xea78('0x1f')][_0xea78('0x12')],'pass':_0x1505c3[_0xea78('0x1f')][_0xea78('0x25')]};}var _0x15946f={'account':_0x582a3b,'message':_['merge']({'from':util[_0xea78('0x26')]('\x22%s\x22\x20<%s>',_0x1505c3[_0xea78('0x13')],_0x1505c3[_0xea78('0x27')]||_0x1505c3['Smtp'][_0xea78('0x12')])},_0x26b3c9)};return client[_0xea78('0x28')]('SendMail',_0x15946f);})[_0xea78('0xe')](function(_0x1b3e5b){if(_0x1b3e5b[_0xea78('0x29')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1b3e5b['error'][_0xea78('0x2a')]||JSON[_0xea78('0x2b')](_0x1b3e5b[_0xea78('0x29')])));}return!![];});}function handleError(_0x398068,_0x2adff1,_0x444e92){return _0x398068['status'](_0x2adff1||0x1f4)[_0xea78('0x2c')]({'message':_0x444e92?_0x444e92['message']||_0x444e92:''});}exports[_0xea78('0x2d')]=function(_0x5d8979,_0x10e055,_0x4ddf53){passport[_0xea78('0x2e')](_0xea78('0x2f'),function(_0x16f89e,_0x56f178,_0x3b5a73){var _0x474e72=_0x16f89e||_0x3b5a73;if(_0x474e72){return handleError(_0x10e055,0x191,_0x474e72);}if(!_0x56f178){return handleError(_0x10e055,0x194,{'message':_0xea78('0x30')});}else{var _0x3c320f={'payload':{'id':_0x56f178['id'],'role':_0x56f178[_0xea78('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3c320f)[_0xea78('0xe')](function(_0x484f25){_0x10e055[_0xea78('0x31')]({'id':_0x56f178['id'],'token':_0x484f25,'statusCall':'','isAlreadyLogged':_0x56f178[_0xea78('0x32')]});});}})(_0x5d8979,_0x10e055,_0x4ddf53);};exports[_0xea78('0x33')]=function(_0x544229,_0x2702c9,_0x2cb053){if(!_0x544229[_0xea78('0x34')]['email']){return handleError(_0x2702c9,0x1f4,{'message':_0xea78('0x35')});}var _0x4867d5=rs[_0xea78('0x36')]();_0x544229[_0xea78('0x34')]['email']=_0x544229['body'][_0xea78('0x27')][_0xea78('0x37')]()[_0xea78('0x38')]();var _0x6f3039;return db['Setting'][_0xea78('0xb')]({'where':{'id':0x1},'attributes':[_0xea78('0xc'),_0xea78('0xd')],'raw':!![]})[_0xea78('0xe')](function(_0x18676b){_0x6f3039=_0x18676b;return db[_0xea78('0x39')][_0xea78('0x1d')]({'where':{'email':_0x544229[_0xea78('0x34')]['email']}});})['then'](function(_0x5beda1){if(!_0x5beda1){throw new Error(_0xea78('0x3a'));}if(_0x5beda1['disabled']){throw new Error(_0xea78('0x3b'));}if(_0x5beda1[_0xea78('0x10')]){if(moment(_0x5beda1[_0xea78('0x11')])['add'](_0x6f3039[_0xea78('0xd')],_0xea78('0x19'))>moment()){throw new Error(_0xea78('0x3c'));}else{_0x5beda1[_0xea78('0x10')]=![];_0x5beda1['blockedAt']=null;}}_0x5beda1[_0xea78('0x3d')]=_0x4867d5;_0x5beda1[_0xea78('0x3e')]=Date[_0xea78('0x3f')]()+0x36ee80;return _0x5beda1[_0xea78('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x544229[_0xea78('0x34')][_0xea78('0x27')],'subject':_0xea78('0x41'),'text':_0xea78('0x42')+_0xea78('0x43')+_0xea78('0x44')+_0x544229[_0xea78('0x45')][_0xea78('0x21')]+_0xea78('0x46')+_0x4867d5+'\x0a\x0a'+_0xea78('0x47')});})[_0xea78('0xe')](function(){_0x2702c9[_0xea78('0x48')](0xc8)[_0xea78('0x2c')]({'message':_0xea78('0x49')});})[_0xea78('0x1b')](function(_0x216445){return handleError(_0x2702c9,0x1f4,_0x216445);});};exports['reset']=function(_0x32d097,_0x542524,_0x380d22){return db[_0xea78('0x39')]['find']({'where':{'resetPasswordToken':_0x32d097['params'][_0xea78('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xea78('0x3f')]()}}})[_0xea78('0xe')](function(_0x6aa68d){if(!_0x6aa68d){throw new Error(_0xea78('0x4b'));}return db['Setting'][_0xea78('0xb')]({'attributes':['id',_0xea78('0x4c'),_0xea78('0x4d'),_0xea78('0x4e')]})[_0xea78('0xe')](function(_0xb0bdfe){if(_0xb0bdfe['securePassword'])authService['validatePasswordPattern'](_0x32d097[_0xea78('0x34')][_0xea78('0x4f')]);if(!_0xb0bdfe[_0xea78('0x4d')]||!_0x6aa68d[_0xea78('0x50')])return _0x6aa68d;authService[_0xea78('0x51')](_0x32d097[_0xea78('0x34')][_0xea78('0x4f')],_0x6aa68d['previousPasswords'],_0xb0bdfe[_0xea78('0x4e')]);return _0x6aa68d;})[_0xea78('0xe')](function(){_0x6aa68d['password']=_0x32d097['body'][_0xea78('0x4f')];_0x6aa68d[_0xea78('0x3d')]=null;_0x6aa68d['resetPasswordExpires']=null;return _0x6aa68d[_0xea78('0x40')]();});})[_0xea78('0xe')](function(){_0x542524[_0xea78('0x48')](0xc8)['send']({'message':_0xea78('0x52')});})['catch'](function(_0x36c27a){return handleError(_0x542524,0x1f4,_0x36c27a);});};passport[_0xea78('0x53')](_0xea78('0x2f'),new LocalStrategy({'usernameField':_0xea78('0x13'),'passwordField':_0xea78('0x4f')},function(_0x1a8b74,_0x2bad55,_0x34d3da){return localAuthenticate(db[_0xea78('0x39')],_0x1a8b74,_0x2bad55,_0x34d3da);})); \ No newline at end of file +var _0x9952=['Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','use','util','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','allowedLoginAttempts','blockDuration','findOne','name','role','disabled','blocked','loginAttempts','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','merge','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','body'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0x9952,0x6e));var _0x2995=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x9952[_0x503ffd];return _0x160437;};'use strict';var util=require(_0x2995('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2995('0x1'))[_0x2995('0x2')];var jayson=require('jayson/promise');var _=require(_0x2995('0x3'));var rs=require(_0x2995('0x4'));var moment=require(_0x2995('0x5'));var db=require(_0x2995('0x6'))['db'];var authService=require(_0x2995('0x7'));var utils=require(_0x2995('0x8'));var client=jayson[_0x2995('0x9')]['http']({'port':0x232b});function localAuthenticate(_0xe494a4,_0x34c9ea,_0x2c301e,_0xa8e58f){var _0x2ca24d,_0x338d7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x2995('0xa'),_0x2995('0xb')],'raw':!![]})['then'](function(_0x1124e5){_0x2ca24d=_0x1124e5;return _0xe494a4[_0x2995('0xc')]({'attributes':['id',_0x2995('0xd'),'password','salt',_0x2995('0xe'),_0x2995('0xf'),_0x2995('0x10'),'blockedAt',_0x2995('0x11')],'where':{'name':_0x34c9ea,'role':{'$or':['admin','user',_0x2995('0x12')]}}});})[_0x2995('0x13')](function(_0x479826){if(!_0x479826||_0x479826&&_0x479826[_0x2995('0xd')]!==_0x34c9ea){throw new Error(_0x2995('0x14'));}else{_0x338d7=_0x479826;return _0x338d7;}})[_0x2995('0x13')](function(){_0x338d7[_0x2995('0x15')](_0x2c301e,function(_0x4acbfd,_0x60d599){var _0x58d555=_0x338d7['loginAttempts']+0x1;if(_0x4acbfd){return _0xa8e58f(_0x4acbfd);}else if(!_0x60d599){if(_0x338d7[_0x2995('0xf')]){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}else if(_0x2ca24d[_0x2995('0xa')]>0x0){if(_0x338d7[_0x2995('0x10')]){if(_0x2ca24d[_0x2995('0xb')]>0x0){if(moment(_0x338d7[_0x2995('0x16')])['add'](_0x2ca24d[_0x2995('0xb')],'minutes')>moment()){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}else{return utils[_0x2995('0x17')](_0x338d7,_0x58d555,![],null)[_0x2995('0x13')](function(){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});});}}else{return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}}else{if(_0x58d555>=_0x2ca24d['allowedLoginAttempts']){return utils[_0x2995('0x17')](_0x338d7,0x0,!![],moment())[_0x2995('0x13')](function(){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});});}else{return utils[_0x2995('0x17')](_0x338d7,_0x58d555,![],null)[_0x2995('0x13')](function(){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});});}}}else{return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}}else{if(_0x338d7['disabled']){return _0xa8e58f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2ca24d[_0x2995('0xa')]>0x0){if(_0x338d7[_0x2995('0x10')]){if(_0x2ca24d[_0x2995('0xb')]>0x0){if(moment(_0x338d7[_0x2995('0x16')])[_0x2995('0x18')](_0x2ca24d[_0x2995('0xb')],_0x2995('0x19'))>moment()){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}else{return utils[_0x2995('0x17')](_0x338d7,0x0,![],null)[_0x2995('0x13')](function(){return utils[_0x2995('0x1a')](_0x338d7);})[_0x2995('0x13')](function(){return _0xa8e58f(null,_0x338d7);});}}else{return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}}else{return utils[_0x2995('0x17')](_0x338d7,0x0,![],null)[_0x2995('0x13')](function(){return utils[_0x2995('0x1a')](_0x338d7);})['then'](function(){return _0xa8e58f(null,_0x338d7);})[_0x2995('0x1b')](function(_0x5c078b){return _0xa8e58f(null,![],_0x5c078b);});}}else{if(_0x338d7[_0x2995('0x10')]){return _0xa8e58f(null,![],{'message':_0x2995('0x14')});}else{return utils[_0x2995('0x1a')](_0x338d7)['then'](function(){return _0xa8e58f(null,_0x338d7);});}}}});})[_0x2995('0x1b')](function(_0x2ee38a){return _0xa8e58f(null,![],_0x2ee38a);});}function sendServiceMail(_0x5b7a62){return db[_0x2995('0x1c')][_0x2995('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x2995('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x2995('0x1e')}]})[_0x2995('0x13')](function(_0x3197d1){if(!_0x3197d1){throw new Error(_0x2995('0x1f'));}var _0x55bfd8={'tls':{'rejectUnauthorized':![]}};if(_0x3197d1['Smtp'][_0x2995('0x20')]){_0x55bfd8[_0x2995('0x20')]=_0x3197d1[_0x2995('0x1e')][_0x2995('0x20')];}else{_0x55bfd8[_0x2995('0x21')]=_0x3197d1['Smtp'][_0x2995('0x21')];_0x55bfd8[_0x2995('0x22')]=_0x3197d1['Smtp'][_0x2995('0x22')];_0x55bfd8['secure']=_0x3197d1[_0x2995('0x1e')][_0x2995('0x23')];}if(_0x3197d1['Smtp'][_0x2995('0x24')]){_0x55bfd8[_0x2995('0x25')]={'user':_0x3197d1['Smtp'][_0x2995('0x26')],'pass':_0x3197d1[_0x2995('0x1e')]['pass']};}var _0x205635={'account':_0x55bfd8,'message':_[_0x2995('0x27')]({'from':util[_0x2995('0x28')](_0x2995('0x29'),_0x3197d1[_0x2995('0xd')],_0x3197d1[_0x2995('0x2a')]||_0x3197d1[_0x2995('0x1e')][_0x2995('0x26')])},_0x5b7a62)};return client[_0x2995('0x2b')](_0x2995('0x2c'),_0x205635);})[_0x2995('0x13')](function(_0x46745f){if(_0x46745f[_0x2995('0x2d')]){throw new Error(util['format'](_0x2995('0x2e'),_0x46745f['error'][_0x2995('0x2f')]||JSON[_0x2995('0x30')](_0x46745f[_0x2995('0x2d')])));}return!![];});}function handleError(_0x5c1103,_0x434953,_0x2dfd30){return _0x5c1103[_0x2995('0x31')](_0x434953||0x1f4)[_0x2995('0x32')]({'message':_0x2dfd30?_0x2dfd30[_0x2995('0x2f')]||_0x2dfd30:''});}exports[_0x2995('0x33')]=function(_0x2c3076,_0x227c82,_0x32d996){passport[_0x2995('0x15')](_0x2995('0x34'),function(_0x1156bf,_0x37deaf,_0x3a1060){var _0x5b5a8d=_0x1156bf||_0x3a1060;if(_0x5b5a8d){return handleError(_0x227c82,0x191,_0x5b5a8d);}if(!_0x37deaf){return handleError(_0x227c82,0x194,{'message':_0x2995('0x35')});}else{var _0x430368={'payload':{'id':_0x37deaf['id'],'role':_0x37deaf['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x430368)[_0x2995('0x13')](function(_0x2832ae){_0x227c82['json']({'id':_0x37deaf['id'],'token':_0x2832ae,'statusCall':'','isAlreadyLogged':_0x37deaf[_0x2995('0x36')]});});}})(_0x2c3076,_0x227c82,_0x32d996);};exports['forgot']=function(_0x330b12,_0x9716ca,_0x30698d){if(!_0x330b12[_0x2995('0x37')]['email']){return handleError(_0x9716ca,0x1f4,{'message':_0x2995('0x38')});}var _0x3536fe=rs[_0x2995('0x39')]();_0x330b12['body'][_0x2995('0x2a')]=_0x330b12[_0x2995('0x37')][_0x2995('0x2a')][_0x2995('0x3a')]()[_0x2995('0x3b')]();var _0x13a65f;return db[_0x2995('0x3c')][_0x2995('0xc')]({'where':{'id':0x1},'attributes':[_0x2995('0xa'),_0x2995('0xb')],'raw':!![]})[_0x2995('0x13')](function(_0x1c8717){_0x13a65f=_0x1c8717;return db[_0x2995('0x3d')][_0x2995('0x1d')]({'where':{'email':_0x330b12[_0x2995('0x37')][_0x2995('0x2a')]}});})[_0x2995('0x13')](function(_0x20c200){if(!_0x20c200){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x20c200['disabled']){throw new Error(_0x2995('0x3e'));}if(_0x20c200['blocked']){if(moment(_0x20c200[_0x2995('0x16')])[_0x2995('0x18')](_0x13a65f[_0x2995('0xb')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x20c200[_0x2995('0x10')]=![];_0x20c200[_0x2995('0x16')]=null;}}_0x20c200['resetPasswordToken']=_0x3536fe;_0x20c200['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x20c200[_0x2995('0x3f')]();})[_0x2995('0x13')](function(){return sendServiceMail({'to':_0x330b12[_0x2995('0x37')][_0x2995('0x2a')],'subject':_0x2995('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x2995('0x41')+_0x2995('0x42')+_0x330b12[_0x2995('0x43')][_0x2995('0x21')]+_0x2995('0x44')+_0x3536fe+'\x0a\x0a'+_0x2995('0x45')});})[_0x2995('0x13')](function(){_0x9716ca[_0x2995('0x31')](0xc8)[_0x2995('0x32')]({'message':_0x2995('0x46')});})['catch'](function(_0x235d56){return handleError(_0x9716ca,0x1f4,_0x235d56);});};exports[_0x2995('0x47')]=function(_0x27746e,_0x1e4af1,_0x1e45fe){return db['User'][_0x2995('0x1d')]({'where':{'resetPasswordToken':_0x27746e[_0x2995('0x48')][_0x2995('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2995('0x13')](function(_0x1ae5cd){if(!_0x1ae5cd){throw new Error(_0x2995('0x4a'));}return db[_0x2995('0x3c')]['findOne']({'attributes':['id',_0x2995('0x4b'),'enforcePasswordHistory',_0x2995('0x4c')]})[_0x2995('0x13')](function(_0x44a74d){if(_0x44a74d['securePassword'])authService['validatePasswordPattern'](_0x27746e[_0x2995('0x37')][_0x2995('0x4d')]);if(!_0x44a74d['enforcePasswordHistory']||!_0x1ae5cd[_0x2995('0x4e')])return _0x1ae5cd;authService[_0x2995('0x4f')](_0x27746e[_0x2995('0x37')][_0x2995('0x4d')],_0x1ae5cd[_0x2995('0x4e')],_0x44a74d[_0x2995('0x4c')]);return _0x1ae5cd;})['then'](function(){_0x1ae5cd[_0x2995('0x4d')]=_0x27746e[_0x2995('0x37')][_0x2995('0x4d')];_0x1ae5cd[_0x2995('0x50')]=null;_0x1ae5cd[_0x2995('0x51')]=null;return _0x1ae5cd[_0x2995('0x3f')]();});})[_0x2995('0x13')](function(){_0x1e4af1[_0x2995('0x31')](0xc8)[_0x2995('0x32')]({'message':'Password\x20reset!'});})['catch'](function(_0x85776f){return handleError(_0x1e4af1,0x1f4,_0x85776f);});};passport[_0x2995('0x52')](_0x2995('0x34'),new LocalStrategy({'usernameField':_0x2995('0xd'),'passwordField':_0x2995('0x4d')},function(_0x226132,_0x1bbec8,_0x528c7f){return localAuthenticate(db['User'],_0x226132,_0x1bbec8,_0x528c7f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 706500f..f4f902f 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 _0xe554=['./authLocal.controller','login','post','forgot','reset'];(function(_0x3f2b4a,_0x30546b){var _0x221546=function(_0x4a1378){while(--_0x4a1378){_0x3f2b4a['push'](_0x3f2b4a['shift']());}};_0x221546(++_0x30546b);}(_0xe554,0x11d));var _0x4e55=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe554[_0xbca1b1];return _0x4e1686;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x4e55('0x0'));router['post']('/',controller[_0x4e55('0x1')]);router[_0x4e55('0x2')]('/forgot',controller[_0x4e55('0x3')]);router[_0x4e55('0x2')]('/reset/:token',controller[_0x4e55('0x4')]);module['exports']=router; \ No newline at end of file +var _0xba5f=['login','/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller','post'];(function(_0x5313c2,_0x70c1de){var _0x2c5017=function(_0x24bd89){while(--_0x24bd89){_0x5313c2['push'](_0x5313c2['shift']());}};_0x2c5017(++_0x70c1de);}(_0xba5f,0x1da));var _0xfba5=function(_0x577e4a,_0x25e8f5){_0x577e4a=_0x577e4a-0x0;var _0x5bcbe1=_0xba5f[_0x577e4a];return _0x5bcbe1;};'use strict';var express=require('express');var router=express[_0xfba5('0x0')]();var controller=require(_0xfba5('0x1'));router[_0xfba5('0x2')]('/',controller[_0xfba5('0x3')]);router[_0xfba5('0x2')](_0xfba5('0x4'),controller[_0xfba5('0x5')]);router[_0xfba5('0x2')](_0xfba5('0x6'),controller[_0xfba5('0x7')]);module[_0xfba5('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 26b0e52..797665e 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 _0x2570=['STRING','BOOLEAN','sequelize'];(function(_0x586f3e,_0x345160){var _0x5e3c4a=function(_0x3fb037){while(--_0x3fb037){_0x586f3e['push'](_0x586f3e['shift']());}};_0x5e3c4a(++_0x345160);}(_0x2570,0xec));var _0x0257=function(_0x3b0449,_0x14bba6){_0x3b0449=_0x3b0449-0x0;var _0x3e7b06=_0x2570[_0x3b0449];return _0x3e7b06;};'use strict';var Sequelize=require(_0x0257('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0257('0x1')]},'status':{'type':Sequelize[_0x0257('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xcc71=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x1c399b,_0x3bd125){var _0x1fc4a9=function(_0x1c5afe){while(--_0x1c5afe){_0x1c399b['push'](_0x1c399b['shift']());}};_0x1fc4a9(++_0x3bd125);}(_0xcc71,0x1b4));var _0x1cc7=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xcc71[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x1cc7('0x0'));module[_0x1cc7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x1cc7('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1cc7('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1cc7('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fc6615f..8106dba 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 _0x0114=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','ids','omit','findOne','Condition','length','merge','getConditions','addActions','getActions','Action','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','Automation'];(function(_0x1fdd46,_0x34c119){var _0x57be2c=function(_0x410cf1){while(--_0x410cf1){_0x1fdd46['push'](_0x1fdd46['shift']());}};_0x57be2c(++_0x34c119);}(_0x0114,0x123));var _0x4011=function(_0x12c5a0,_0x25107b){_0x12c5a0=_0x12c5a0-0x0;var _0x1294ca=_0x0114[_0x12c5a0];return _0x1294ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4011('0x0'));var jsonpatch=require(_0x4011('0x1'));var rp=require(_0x4011('0x2'));var moment=require(_0x4011('0x3'));var BPromise=require(_0x4011('0x4'));var Mustache=require(_0x4011('0x5'));var util=require(_0x4011('0x6'));var path=require(_0x4011('0x7'));var sox=require(_0x4011('0x8'));var csv=require('to-csv');var ejs=require(_0x4011('0x9'));var fs=require('fs');var fs_extra=require(_0x4011('0xa'));var _=require('lodash');var squel=require(_0x4011('0xb'));var crypto=require(_0x4011('0xc'));var jsforce=require(_0x4011('0xd'));var deskjs=require(_0x4011('0xe'));var toCsv=require(_0x4011('0xf'));var querystring=require(_0x4011('0x10'));var Papa=require(_0x4011('0x11'));var Redis=require('ioredis');var authService=require(_0x4011('0x12'));var qs=require(_0x4011('0x13'));var as=require(_0x4011('0x14'));var hardwareService=require(_0x4011('0x15'));var logger=require('../../config/logger')(_0x4011('0x16'));var utils=require(_0x4011('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4011('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xefde0e,_0x5907d2){_0x5907d2=_0x5907d2||0xcc;return function(_0x151e31){if(_0x151e31){return _0xefde0e[_0x4011('0x19')](_0x5907d2);}return _0xefde0e['status'](_0x5907d2)[_0x4011('0x1a')]();};}function respondWithResult(_0x1f6236,_0x28adb9){_0x28adb9=_0x28adb9||0xc8;return function(_0x2c52d2){if(_0x2c52d2){return _0x1f6236[_0x4011('0x1b')](_0x28adb9)[_0x4011('0x1c')](_0x2c52d2);}};}function respondWithFilteredResult(_0x47d4e0,_0x39ce4f){return function(_0x48e527){if(_0x48e527){var _0x138d69=typeof _0x39ce4f[_0x4011('0x1d')]===_0x4011('0x1e')&&typeof _0x39ce4f[_0x4011('0x1f')]==='undefined';var _0x3fbc59=_0x48e527[_0x4011('0x20')];var _0x4a964a=_0x138d69?0x0:_0x39ce4f[_0x4011('0x1d')];var _0x21b4fa=_0x138d69?_0x48e527['count']:_0x39ce4f['offset']+_0x39ce4f[_0x4011('0x1f')];var _0x5de56f;if(_0x21b4fa>=_0x3fbc59){_0x21b4fa=_0x3fbc59;_0x5de56f=0xc8;}else{_0x5de56f=0xce;}_0x47d4e0[_0x4011('0x1b')](_0x5de56f);return _0x47d4e0[_0x4011('0x21')](_0x4011('0x22'),_0x4a964a+'-'+_0x21b4fa+'/'+_0x3fbc59)[_0x4011('0x1c')](_0x48e527);}return null;};}function patchUpdates(_0x51ea34){return function(_0x539995){try{jsonpatch['apply'](_0x539995,_0x51ea34,!![]);}catch(_0xc4ab71){return BPromise['reject'](_0xc4ab71);}return _0x539995[_0x4011('0x23')]();};}function saveUpdates(_0x299d27,_0x5704cd){return function(_0x4db159){if(_0x4db159){return _0x4db159[_0x4011('0x24')](_0x299d27)[_0x4011('0x25')](function(_0x296786){return _0x296786;});}return null;};}function removeEntity(_0x1fa899,_0x23f1dc){return function(_0x4cbf63){if(_0x4cbf63){return _0x4cbf63['destroy']()[_0x4011('0x25')](function(){_0x1fa899['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13fb35,_0x5c07da){return function(_0x50194c){if(!_0x50194c){_0x13fb35[_0x4011('0x19')](0x194);}return _0x50194c;};}function handleError(_0x188332,_0x370672){_0x370672=_0x370672||0x1f4;return function(_0x1e7aa5){logger[_0x4011('0x26')](_0x1e7aa5[_0x4011('0x27')]);if(_0x1e7aa5[_0x4011('0x28')]){delete _0x1e7aa5[_0x4011('0x28')];}_0x188332[_0x4011('0x1b')](_0x370672)[_0x4011('0x29')](_0x1e7aa5);};}exports[_0x4011('0x2a')]=function(_0x4c40fb,_0x34e1f0){var _0x375eec={},_0x533987={},_0x413319={'count':0x0,'rows':[]};var _0x33b090=_[_0x4011('0x2b')](db[_0x4011('0x2c')][_0x4011('0x2d')],function(_0x43a564){return{'name':_0x43a564[_0x4011('0x2e')],'type':_0x43a564[_0x4011('0x2f')][_0x4011('0x30')]};});_0x533987[_0x4011('0x31')]=_['map'](_0x33b090,'name');_0x533987[_0x4011('0x32')]=_['keys'](_0x4c40fb[_0x4011('0x32')]);_0x533987[_0x4011('0x33')]=_[_0x4011('0x34')](_0x533987[_0x4011('0x31')],_0x533987[_0x4011('0x32')]);_0x375eec['attributes']=_['intersection'](_0x533987[_0x4011('0x31')],qs['fields'](_0x4c40fb[_0x4011('0x32')][_0x4011('0x35')]));_0x375eec[_0x4011('0x36')]=_0x375eec[_0x4011('0x36')]['length']?_0x375eec[_0x4011('0x36')]:_0x533987[_0x4011('0x31')];if(!_0x4c40fb[_0x4011('0x32')][_0x4011('0x37')](_0x4011('0x38'))){_0x375eec[_0x4011('0x1f')]=qs[_0x4011('0x1f')](_0x4c40fb[_0x4011('0x32')]['limit']);_0x375eec[_0x4011('0x1d')]=qs['offset'](_0x4c40fb['query']['offset']);}_0x375eec[_0x4011('0x39')]=qs[_0x4011('0x3a')](_0x4c40fb[_0x4011('0x32')][_0x4011('0x3a')]);_0x375eec[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0x4c40fb[_0x4011('0x32')],_0x533987['filters']),_0x33b090);if(_0x4c40fb[_0x4011('0x32')]['filter']){_0x375eec['where']=_['merge'](_0x375eec[_0x4011('0x3b')],{'$or':_[_0x4011('0x2b')](_0x33b090,function(_0x164577){if(_0x164577[_0x4011('0x2f')]!==_0x4011('0x3d')){var _0x1a6b56={};_0x1a6b56[_0x164577[_0x4011('0x28')]]={'$like':'%'+_0x4c40fb[_0x4011('0x32')][_0x4011('0x3e')]+'%'};return _0x1a6b56;}})});}_0x375eec=_['merge']({},_0x375eec,_0x4c40fb[_0x4011('0x3f')]);var _0x11af2c={'where':_0x375eec[_0x4011('0x3b')]};return db[_0x4011('0x2c')][_0x4011('0x20')](_0x11af2c)['then'](function(_0x2449b2){_0x413319['count']=_0x2449b2;if(_0x4c40fb[_0x4011('0x32')][_0x4011('0x40')]){_0x375eec[_0x4011('0x41')]=[{'all':!![]}];}return db[_0x4011('0x2c')]['findAll'](_0x375eec);})[_0x4011('0x25')](function(_0x7f36dc){_0x413319['rows']=_0x7f36dc;return _0x413319;})[_0x4011('0x25')](respondWithFilteredResult(_0x34e1f0,_0x375eec))[_0x4011('0x42')](handleError(_0x34e1f0,null));};exports[_0x4011('0x43')]=function(_0x4215c4,_0x21974d){var _0x2f40a3={'raw':![],'where':{'id':_0x4215c4[_0x4011('0x44')]['id']}},_0x437b3f={};_0x437b3f[_0x4011('0x31')]=_['keys'](db['Automation']['rawAttributes']);_0x437b3f[_0x4011('0x32')]=_[_0x4011('0x45')](_0x4215c4[_0x4011('0x32')]);_0x437b3f[_0x4011('0x33')]=_['intersection'](_0x437b3f[_0x4011('0x31')],_0x437b3f[_0x4011('0x32')]);_0x2f40a3[_0x4011('0x36')]=_[_0x4011('0x34')](_0x437b3f[_0x4011('0x31')],qs[_0x4011('0x35')](_0x4215c4[_0x4011('0x32')][_0x4011('0x35')]));_0x2f40a3[_0x4011('0x36')]=_0x2f40a3[_0x4011('0x36')]['length']?_0x2f40a3[_0x4011('0x36')]:_0x437b3f[_0x4011('0x31')];if(_0x4215c4[_0x4011('0x32')]['includeAll']){_0x2f40a3[_0x4011('0x41')]=[{'all':!![]}];}_0x2f40a3=_['merge']({},_0x2f40a3,_0x4215c4[_0x4011('0x3f')]);return db[_0x4011('0x2c')][_0x4011('0x46')](_0x2f40a3)['then'](handleEntityNotFound(_0x21974d,null))[_0x4011('0x25')](respondWithResult(_0x21974d,null))[_0x4011('0x42')](handleError(_0x21974d,null));};exports['create']=function(_0x5ee1a2,_0x3c17c4){return db[_0x4011('0x2c')][_0x4011('0x47')](_0x5ee1a2['body'],{})['then'](respondWithResult(_0x3c17c4,0xc9))['catch'](handleError(_0x3c17c4,null));};exports[_0x4011('0x24')]=function(_0x4272b5,_0x28b132){if(_0x4272b5['body']['id']){delete _0x4272b5['body']['id'];}return db[_0x4011('0x2c')]['find']({'where':{'id':_0x4272b5[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x28b132,null))['then'](saveUpdates(_0x4272b5[_0x4011('0x48')],null))[_0x4011('0x25')](respondWithResult(_0x28b132,null))[_0x4011('0x42')](handleError(_0x28b132,null));};exports[_0x4011('0x49')]=function(_0x361408,_0x31e849){return db[_0x4011('0x2c')][_0x4011('0x46')]({'where':{'id':_0x361408['params']['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x31e849,null))[_0x4011('0x25')](removeEntity(_0x31e849,null))[_0x4011('0x42')](handleError(_0x31e849,null));};exports['addConditions']=function(_0xaba9a1,_0x2b4b99,_0x3bfd87){return db['Condition'][_0x4011('0x46')]({'where':{'id':_0xaba9a1[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x2b4b99,null))[_0x4011('0x25')](function(_0x5f38e7){if(_0x5f38e7){return _0x5f38e7['addConditions'](_0xaba9a1[_0x4011('0x48')][_0x4011('0x4a')],_[_0x4011('0x4b')](_0xaba9a1[_0x4011('0x48')],['ids','id'])||{});}})[_0x4011('0x25')](respondWithResult(_0x2b4b99,null))[_0x4011('0x42')](handleError(_0x2b4b99,null));};exports['getConditions']=function(_0xc56a68,_0x6747d4,_0x5c4107){var _0x3c8ac4={};var _0x2d3603={};var _0x20fb81;var _0xf23607;return db['Automation'][_0x4011('0x4c')]({'where':{'id':_0xc56a68['params']['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x6747d4,null))[_0x4011('0x25')](function(_0x5459d4){if(_0x5459d4){_0x20fb81=_0x5459d4;_0x2d3603['model']=_[_0x4011('0x45')](db[_0x4011('0x4d')][_0x4011('0x2d')]);_0x2d3603[_0x4011('0x32')]=_[_0x4011('0x45')](_0xc56a68[_0x4011('0x32')]);_0x2d3603['filters']=_[_0x4011('0x34')](_0x2d3603[_0x4011('0x31')],_0x2d3603[_0x4011('0x32')]);_0x3c8ac4[_0x4011('0x36')]=_[_0x4011('0x34')](_0x2d3603[_0x4011('0x31')],qs[_0x4011('0x35')](_0xc56a68[_0x4011('0x32')][_0x4011('0x35')]));_0x3c8ac4[_0x4011('0x36')]=_0x3c8ac4[_0x4011('0x36')][_0x4011('0x4e')]?_0x3c8ac4['attributes']:_0x2d3603['model'];_0x3c8ac4[_0x4011('0x39')]=qs[_0x4011('0x3a')](_0xc56a68['query']['sort']);_0x3c8ac4[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0xc56a68[_0x4011('0x32')],_0x2d3603[_0x4011('0x33')]));if(_0xc56a68['query'][_0x4011('0x3e')]){_0x3c8ac4['where']=_[_0x4011('0x4f')](_0x3c8ac4['where'],{'$or':_['map'](_0x3c8ac4[_0x4011('0x36')],function(_0xd2c17c){var _0x4fbe07={};_0x4fbe07[_0xd2c17c]={'$like':'%'+_0xc56a68['query'][_0x4011('0x3e')]+'%'};return _0x4fbe07;})});}_0x3c8ac4=_[_0x4011('0x4f')]({},_0x3c8ac4,_0xc56a68[_0x4011('0x3f')]);return _0x20fb81[_0x4011('0x50')](_0x3c8ac4);}})[_0x4011('0x25')](function(_0x5e9a17){if(_0x5e9a17){_0xf23607=_0x5e9a17['length'];if(!_0xc56a68['query']['hasOwnProperty'](_0x4011('0x38'))){_0x3c8ac4['limit']=qs[_0x4011('0x1f')](_0xc56a68[_0x4011('0x32')][_0x4011('0x1f')]);_0x3c8ac4['offset']=qs[_0x4011('0x1d')](_0xc56a68[_0x4011('0x32')][_0x4011('0x1d')]);}return _0x20fb81['getConditions'](_0x3c8ac4);}})[_0x4011('0x25')](function(_0x22ca77){if(_0x22ca77){return _0x22ca77?{'count':_0xf23607,'rows':_0x22ca77}:null;}})['then'](respondWithResult(_0x6747d4,null))[_0x4011('0x42')](handleError(_0x6747d4,null));};exports[_0x4011('0x51')]=function(_0x51bdd6,_0x332dac,_0x2d970b){return db['Action'][_0x4011('0x46')]({'where':{'id':_0x51bdd6[_0x4011('0x44')]['id']}})['then'](handleEntityNotFound(_0x332dac,null))['then'](function(_0x5768a9){if(_0x5768a9){return _0x5768a9['addActions'](_0x51bdd6['body'][_0x4011('0x4a')],_[_0x4011('0x4b')](_0x51bdd6[_0x4011('0x48')],[_0x4011('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x332dac,null))[_0x4011('0x42')](handleError(_0x332dac,null));};exports[_0x4011('0x52')]=function(_0x3c9763,_0x370f5d,_0x2ce7f3){var _0xf9614a={};var _0x384a3c={};var _0xd230f;var _0x4b5d1f;return db[_0x4011('0x2c')]['findOne']({'where':{'id':_0x3c9763[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x370f5d,null))['then'](function(_0x2da703){if(_0x2da703){_0xd230f=_0x2da703;_0x384a3c['model']=_[_0x4011('0x45')](db[_0x4011('0x53')][_0x4011('0x2d')]);_0x384a3c[_0x4011('0x32')]=_[_0x4011('0x45')](_0x3c9763['query']);_0x384a3c[_0x4011('0x33')]=_[_0x4011('0x34')](_0x384a3c[_0x4011('0x31')],_0x384a3c[_0x4011('0x32')]);_0xf9614a[_0x4011('0x36')]=_[_0x4011('0x34')](_0x384a3c[_0x4011('0x31')],qs[_0x4011('0x35')](_0x3c9763['query']['fields']));_0xf9614a[_0x4011('0x36')]=_0xf9614a[_0x4011('0x36')][_0x4011('0x4e')]?_0xf9614a['attributes']:_0x384a3c[_0x4011('0x31')];_0xf9614a['order']=qs['sort'](_0x3c9763[_0x4011('0x32')]['sort']);_0xf9614a[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0x3c9763[_0x4011('0x32')],_0x384a3c[_0x4011('0x33')]));if(_0x3c9763['query'][_0x4011('0x3e')]){_0xf9614a[_0x4011('0x3b')]=_[_0x4011('0x4f')](_0xf9614a['where'],{'$or':_[_0x4011('0x2b')](_0xf9614a[_0x4011('0x36')],function(_0x162652){var _0x32be54={};_0x32be54[_0x162652]={'$like':'%'+_0x3c9763[_0x4011('0x32')][_0x4011('0x3e')]+'%'};return _0x32be54;})});}_0xf9614a=_[_0x4011('0x4f')]({},_0xf9614a,_0x3c9763['options']);return _0xd230f[_0x4011('0x52')](_0xf9614a);}})['then'](function(_0x56c72e){if(_0x56c72e){_0x4b5d1f=_0x56c72e[_0x4011('0x4e')];if(!_0x3c9763[_0x4011('0x32')][_0x4011('0x37')](_0x4011('0x38'))){_0xf9614a['limit']=qs[_0x4011('0x1f')](_0x3c9763[_0x4011('0x32')][_0x4011('0x1f')]);_0xf9614a[_0x4011('0x1d')]=qs[_0x4011('0x1d')](_0x3c9763[_0x4011('0x32')][_0x4011('0x1d')]);}return _0xd230f['getActions'](_0xf9614a);}})[_0x4011('0x25')](function(_0x1ecc61){if(_0x1ecc61){return _0x1ecc61?{'count':_0x4b5d1f,'rows':_0x1ecc61}:null;}})[_0x4011('0x25')](respondWithResult(_0x370f5d,null))[_0x4011('0x42')](handleError(_0x370f5d,null));}; \ No newline at end of file +var _0x552e=['options','includeAll','Automation','findAll','rows','catch','show','params','rawAttributes','find','create','body','addConditions','Condition','omit','ids','getConditions','order','pick','addActions','findOne','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','reject','update','then','destroy','end','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge'];(function(_0x33d1ea,_0x45fd13){var _0xe9b5cd=function(_0x203b0b){while(--_0x203b0b){_0x33d1ea['push'](_0x33d1ea['shift']());}};_0xe9b5cd(++_0x45fd13);}(_0x552e,0x15f));var _0xe552=function(_0x23ffff,_0x807a2a){_0x23ffff=_0x23ffff-0x0;var _0x94d47f=_0x552e[_0x23ffff];return _0x94d47f;};'use strict';var emlformat=require(_0xe552('0x0'));var rimraf=require(_0xe552('0x1'));var zipdir=require(_0xe552('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe552('0x3'));var moment=require('moment');var BPromise=require(_0xe552('0x4'));var Mustache=require('mustache');var util=require(_0xe552('0x5'));var path=require('path');var sox=require(_0xe552('0x6'));var csv=require(_0xe552('0x7'));var ejs=require(_0xe552('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe552('0x9'));var crypto=require(_0xe552('0xa'));var jsforce=require(_0xe552('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe552('0x7'));var querystring=require(_0xe552('0xc'));var Papa=require(_0xe552('0xd'));var Redis=require(_0xe552('0xe'));var authService=require(_0xe552('0xf'));var qs=require(_0xe552('0x10'));var as=require(_0xe552('0x11'));var hardwareService=require(_0xe552('0x12'));var logger=require(_0xe552('0x13'))(_0xe552('0x14'));var utils=require('../../config/utils');var config=require(_0xe552('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe552('0x16'))['db'];function respondWithStatusCode(_0xdfee76,_0x9328ff){_0x9328ff=_0x9328ff||0xcc;return function(_0x2f5972){if(_0x2f5972){return _0xdfee76[_0xe552('0x17')](_0x9328ff);}return _0xdfee76['status'](_0x9328ff)['end']();};}function respondWithResult(_0x1a38ba,_0x4fb1ec){_0x4fb1ec=_0x4fb1ec||0xc8;return function(_0x4a544d){if(_0x4a544d){return _0x1a38ba[_0xe552('0x18')](_0x4fb1ec)[_0xe552('0x19')](_0x4a544d);}};}function respondWithFilteredResult(_0x3f8770,_0x167d46){return function(_0x457dea){if(_0x457dea){var _0x5bf8a8=typeof _0x167d46[_0xe552('0x1a')]===_0xe552('0x1b')&&typeof _0x167d46['limit']===_0xe552('0x1b');var _0x31143a=_0x457dea[_0xe552('0x1c')];var _0x1530da=_0x5bf8a8?0x0:_0x167d46['offset'];var _0x368eac=_0x5bf8a8?_0x457dea[_0xe552('0x1c')]:_0x167d46[_0xe552('0x1a')]+_0x167d46['limit'];var _0x1710ce;if(_0x368eac>=_0x31143a){_0x368eac=_0x31143a;_0x1710ce=0xc8;}else{_0x1710ce=0xce;}_0x3f8770[_0xe552('0x18')](_0x1710ce);return _0x3f8770[_0xe552('0x1d')]('Content-Range',_0x1530da+'-'+_0x368eac+'/'+_0x31143a)[_0xe552('0x19')](_0x457dea);}return null;};}function patchUpdates(_0x2d6310){return function(_0x1bce02){try{jsonpatch['apply'](_0x1bce02,_0x2d6310,!![]);}catch(_0x3b9f05){return BPromise[_0xe552('0x1e')](_0x3b9f05);}return _0x1bce02['save']();};}function saveUpdates(_0x5e30f7,_0x13a428){return function(_0x3f4aa4){if(_0x3f4aa4){return _0x3f4aa4[_0xe552('0x1f')](_0x5e30f7)[_0xe552('0x20')](function(_0x3f9e1e){return _0x3f9e1e;});}return null;};}function removeEntity(_0x3a39a6,_0x363c91){return function(_0x10637b){if(_0x10637b){return _0x10637b[_0xe552('0x21')]()[_0xe552('0x20')](function(){_0x3a39a6['status'](0xcc)[_0xe552('0x22')]();});}};}function handleEntityNotFound(_0x559edf,_0x4f8c0b){return function(_0x4a9bd5){if(!_0x4a9bd5){_0x559edf[_0xe552('0x17')](0x194);}return _0x4a9bd5;};}function handleError(_0x328bfb,_0xaa71f3){_0xaa71f3=_0xaa71f3||0x1f4;return function(_0xd68754){logger['error'](_0xd68754[_0xe552('0x23')]);if(_0xd68754[_0xe552('0x24')]){delete _0xd68754[_0xe552('0x24')];}_0x328bfb[_0xe552('0x18')](_0xaa71f3)[_0xe552('0x25')](_0xd68754);};}exports[_0xe552('0x26')]=function(_0x1f0ca3,_0x25e61a){var _0x1632c2={},_0x2ffa0b={},_0x567895={'count':0x0,'rows':[]};var _0x399a45=_[_0xe552('0x27')](db['Automation']['rawAttributes'],function(_0x21026f){return{'name':_0x21026f[_0xe552('0x28')],'type':_0x21026f[_0xe552('0x29')][_0xe552('0x2a')]};});_0x2ffa0b[_0xe552('0x2b')]=_['map'](_0x399a45,_0xe552('0x24'));_0x2ffa0b['query']=_[_0xe552('0x2c')](_0x1f0ca3[_0xe552('0x2d')]);_0x2ffa0b[_0xe552('0x2e')]=_[_0xe552('0x2f')](_0x2ffa0b['model'],_0x2ffa0b['query']);_0x1632c2[_0xe552('0x30')]=_[_0xe552('0x2f')](_0x2ffa0b[_0xe552('0x2b')],qs[_0xe552('0x31')](_0x1f0ca3['query'][_0xe552('0x31')]));_0x1632c2[_0xe552('0x30')]=_0x1632c2['attributes'][_0xe552('0x32')]?_0x1632c2[_0xe552('0x30')]:_0x2ffa0b[_0xe552('0x2b')];if(!_0x1f0ca3[_0xe552('0x2d')][_0xe552('0x33')](_0xe552('0x34'))){_0x1632c2[_0xe552('0x35')]=qs['limit'](_0x1f0ca3[_0xe552('0x2d')]['limit']);_0x1632c2[_0xe552('0x1a')]=qs[_0xe552('0x1a')](_0x1f0ca3['query'][_0xe552('0x1a')]);}_0x1632c2['order']=qs[_0xe552('0x36')](_0x1f0ca3[_0xe552('0x2d')][_0xe552('0x36')]);_0x1632c2[_0xe552('0x37')]=qs['filters'](_['pick'](_0x1f0ca3[_0xe552('0x2d')],_0x2ffa0b[_0xe552('0x2e')]),_0x399a45);if(_0x1f0ca3[_0xe552('0x2d')][_0xe552('0x38')]){_0x1632c2[_0xe552('0x37')]=_['merge'](_0x1632c2[_0xe552('0x37')],{'$or':_[_0xe552('0x27')](_0x399a45,function(_0x3ad70f){if(_0x3ad70f[_0xe552('0x29')]!==_0xe552('0x39')){var _0x13daa6={};_0x13daa6[_0x3ad70f[_0xe552('0x24')]]={'$like':'%'+_0x1f0ca3[_0xe552('0x2d')][_0xe552('0x38')]+'%'};return _0x13daa6;}})});}_0x1632c2=_[_0xe552('0x3a')]({},_0x1632c2,_0x1f0ca3[_0xe552('0x3b')]);var _0x426fdd={'where':_0x1632c2['where']};return db['Automation'][_0xe552('0x1c')](_0x426fdd)[_0xe552('0x20')](function(_0x38e9e5){_0x567895[_0xe552('0x1c')]=_0x38e9e5;if(_0x1f0ca3[_0xe552('0x2d')][_0xe552('0x3c')]){_0x1632c2['include']=[{'all':!![]}];}return db[_0xe552('0x3d')][_0xe552('0x3e')](_0x1632c2);})[_0xe552('0x20')](function(_0xb8794d){_0x567895[_0xe552('0x3f')]=_0xb8794d;return _0x567895;})[_0xe552('0x20')](respondWithFilteredResult(_0x25e61a,_0x1632c2))[_0xe552('0x40')](handleError(_0x25e61a,null));};exports[_0xe552('0x41')]=function(_0x80071d,_0x3a891e){var _0x3d0b2a={'raw':![],'where':{'id':_0x80071d[_0xe552('0x42')]['id']}},_0x202379={};_0x202379[_0xe552('0x2b')]=_[_0xe552('0x2c')](db[_0xe552('0x3d')][_0xe552('0x43')]);_0x202379[_0xe552('0x2d')]=_[_0xe552('0x2c')](_0x80071d[_0xe552('0x2d')]);_0x202379['filters']=_[_0xe552('0x2f')](_0x202379['model'],_0x202379[_0xe552('0x2d')]);_0x3d0b2a[_0xe552('0x30')]=_[_0xe552('0x2f')](_0x202379[_0xe552('0x2b')],qs[_0xe552('0x31')](_0x80071d[_0xe552('0x2d')][_0xe552('0x31')]));_0x3d0b2a[_0xe552('0x30')]=_0x3d0b2a[_0xe552('0x30')][_0xe552('0x32')]?_0x3d0b2a[_0xe552('0x30')]:_0x202379['model'];if(_0x80071d[_0xe552('0x2d')]['includeAll']){_0x3d0b2a['include']=[{'all':!![]}];}_0x3d0b2a=_[_0xe552('0x3a')]({},_0x3d0b2a,_0x80071d['options']);return db[_0xe552('0x3d')][_0xe552('0x44')](_0x3d0b2a)[_0xe552('0x20')](handleEntityNotFound(_0x3a891e,null))[_0xe552('0x20')](respondWithResult(_0x3a891e,null))[_0xe552('0x40')](handleError(_0x3a891e,null));};exports[_0xe552('0x45')]=function(_0x48a1bb,_0x35b0cf){return db[_0xe552('0x3d')][_0xe552('0x45')](_0x48a1bb[_0xe552('0x46')],{})[_0xe552('0x20')](respondWithResult(_0x35b0cf,0xc9))[_0xe552('0x40')](handleError(_0x35b0cf,null));};exports[_0xe552('0x1f')]=function(_0xcf9de1,_0x958454){if(_0xcf9de1[_0xe552('0x46')]['id']){delete _0xcf9de1['body']['id'];}return db[_0xe552('0x3d')][_0xe552('0x44')]({'where':{'id':_0xcf9de1[_0xe552('0x42')]['id']}})['then'](handleEntityNotFound(_0x958454,null))[_0xe552('0x20')](saveUpdates(_0xcf9de1['body'],null))['then'](respondWithResult(_0x958454,null))['catch'](handleError(_0x958454,null));};exports[_0xe552('0x21')]=function(_0xefd7f8,_0x3211dd){return db[_0xe552('0x3d')][_0xe552('0x44')]({'where':{'id':_0xefd7f8['params']['id']}})['then'](handleEntityNotFound(_0x3211dd,null))[_0xe552('0x20')](removeEntity(_0x3211dd,null))[_0xe552('0x40')](handleError(_0x3211dd,null));};exports[_0xe552('0x47')]=function(_0x157153,_0x49660a,_0x56eb55){return db[_0xe552('0x48')]['find']({'where':{'id':_0x157153[_0xe552('0x42')]['id']}})['then'](handleEntityNotFound(_0x49660a,null))[_0xe552('0x20')](function(_0x234e9a){if(_0x234e9a){return _0x234e9a[_0xe552('0x47')](_0x157153[_0xe552('0x46')]['ids'],_[_0xe552('0x49')](_0x157153['body'],[_0xe552('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x49660a,null))[_0xe552('0x40')](handleError(_0x49660a,null));};exports[_0xe552('0x4b')]=function(_0x347d0b,_0x4bc49e,_0x1ec1f2){var _0x4e25a7={};var _0x29aef8={};var _0x1c6ea0;var _0x1220b3;return db[_0xe552('0x3d')]['findOne']({'where':{'id':_0x347d0b[_0xe552('0x42')]['id']}})[_0xe552('0x20')](handleEntityNotFound(_0x4bc49e,null))['then'](function(_0x3de570){if(_0x3de570){_0x1c6ea0=_0x3de570;_0x29aef8[_0xe552('0x2b')]=_[_0xe552('0x2c')](db[_0xe552('0x48')][_0xe552('0x43')]);_0x29aef8[_0xe552('0x2d')]=_[_0xe552('0x2c')](_0x347d0b['query']);_0x29aef8[_0xe552('0x2e')]=_[_0xe552('0x2f')](_0x29aef8[_0xe552('0x2b')],_0x29aef8[_0xe552('0x2d')]);_0x4e25a7[_0xe552('0x30')]=_[_0xe552('0x2f')](_0x29aef8[_0xe552('0x2b')],qs[_0xe552('0x31')](_0x347d0b[_0xe552('0x2d')]['fields']));_0x4e25a7[_0xe552('0x30')]=_0x4e25a7[_0xe552('0x30')][_0xe552('0x32')]?_0x4e25a7[_0xe552('0x30')]:_0x29aef8[_0xe552('0x2b')];_0x4e25a7[_0xe552('0x4c')]=qs['sort'](_0x347d0b['query'][_0xe552('0x36')]);_0x4e25a7[_0xe552('0x37')]=qs[_0xe552('0x2e')](_[_0xe552('0x4d')](_0x347d0b[_0xe552('0x2d')],_0x29aef8[_0xe552('0x2e')]));if(_0x347d0b[_0xe552('0x2d')][_0xe552('0x38')]){_0x4e25a7[_0xe552('0x37')]=_['merge'](_0x4e25a7[_0xe552('0x37')],{'$or':_[_0xe552('0x27')](_0x4e25a7['attributes'],function(_0x257ef9){var _0x181300={};_0x181300[_0x257ef9]={'$like':'%'+_0x347d0b[_0xe552('0x2d')][_0xe552('0x38')]+'%'};return _0x181300;})});}_0x4e25a7=_[_0xe552('0x3a')]({},_0x4e25a7,_0x347d0b[_0xe552('0x3b')]);return _0x1c6ea0[_0xe552('0x4b')](_0x4e25a7);}})['then'](function(_0x418655){if(_0x418655){_0x1220b3=_0x418655['length'];if(!_0x347d0b[_0xe552('0x2d')][_0xe552('0x33')]('nolimit')){_0x4e25a7[_0xe552('0x35')]=qs[_0xe552('0x35')](_0x347d0b[_0xe552('0x2d')]['limit']);_0x4e25a7[_0xe552('0x1a')]=qs[_0xe552('0x1a')](_0x347d0b[_0xe552('0x2d')]['offset']);}return _0x1c6ea0['getConditions'](_0x4e25a7);}})[_0xe552('0x20')](function(_0x4776a0){if(_0x4776a0){return _0x4776a0?{'count':_0x1220b3,'rows':_0x4776a0}:null;}})[_0xe552('0x20')](respondWithResult(_0x4bc49e,null))[_0xe552('0x40')](handleError(_0x4bc49e,null));};exports[_0xe552('0x4e')]=function(_0x322441,_0x558e95,_0x573986){return db['Action']['find']({'where':{'id':_0x322441[_0xe552('0x42')]['id']}})[_0xe552('0x20')](handleEntityNotFound(_0x558e95,null))[_0xe552('0x20')](function(_0x1f3bae){if(_0x1f3bae){return _0x1f3bae[_0xe552('0x4e')](_0x322441[_0xe552('0x46')]['ids'],_[_0xe552('0x49')](_0x322441['body'],[_0xe552('0x4a'),'id'])||{});}})[_0xe552('0x20')](respondWithResult(_0x558e95,null))[_0xe552('0x40')](handleError(_0x558e95,null));};exports['getActions']=function(_0x5f2972,_0x198144,_0x5263d0){var _0x24b386={};var _0x64b3f9={};var _0xb22a64;var _0x32be10;return db[_0xe552('0x3d')][_0xe552('0x4f')]({'where':{'id':_0x5f2972[_0xe552('0x42')]['id']}})[_0xe552('0x20')](handleEntityNotFound(_0x198144,null))[_0xe552('0x20')](function(_0x30c4a0){if(_0x30c4a0){_0xb22a64=_0x30c4a0;_0x64b3f9[_0xe552('0x2b')]=_[_0xe552('0x2c')](db[_0xe552('0x50')][_0xe552('0x43')]);_0x64b3f9[_0xe552('0x2d')]=_[_0xe552('0x2c')](_0x5f2972[_0xe552('0x2d')]);_0x64b3f9[_0xe552('0x2e')]=_[_0xe552('0x2f')](_0x64b3f9[_0xe552('0x2b')],_0x64b3f9[_0xe552('0x2d')]);_0x24b386[_0xe552('0x30')]=_[_0xe552('0x2f')](_0x64b3f9[_0xe552('0x2b')],qs['fields'](_0x5f2972['query'][_0xe552('0x31')]));_0x24b386[_0xe552('0x30')]=_0x24b386['attributes'][_0xe552('0x32')]?_0x24b386[_0xe552('0x30')]:_0x64b3f9['model'];_0x24b386[_0xe552('0x4c')]=qs[_0xe552('0x36')](_0x5f2972[_0xe552('0x2d')][_0xe552('0x36')]);_0x24b386['where']=qs['filters'](_[_0xe552('0x4d')](_0x5f2972[_0xe552('0x2d')],_0x64b3f9['filters']));if(_0x5f2972[_0xe552('0x2d')][_0xe552('0x38')]){_0x24b386[_0xe552('0x37')]=_[_0xe552('0x3a')](_0x24b386['where'],{'$or':_[_0xe552('0x27')](_0x24b386[_0xe552('0x30')],function(_0x59cd6b){var _0x1c22ee={};_0x1c22ee[_0x59cd6b]={'$like':'%'+_0x5f2972[_0xe552('0x2d')]['filter']+'%'};return _0x1c22ee;})});}_0x24b386=_[_0xe552('0x3a')]({},_0x24b386,_0x5f2972['options']);return _0xb22a64[_0xe552('0x51')](_0x24b386);}})[_0xe552('0x20')](function(_0x553227){if(_0x553227){_0x32be10=_0x553227['length'];if(!_0x5f2972['query'][_0xe552('0x33')](_0xe552('0x34'))){_0x24b386[_0xe552('0x35')]=qs['limit'](_0x5f2972['query'][_0xe552('0x35')]);_0x24b386['offset']=qs[_0xe552('0x1a')](_0x5f2972['query']['offset']);}return _0xb22a64['getActions'](_0x24b386);}})[_0xe552('0x20')](function(_0x4fe0a4){if(_0x4fe0a4){return _0x4fe0a4?{'count':_0x32be10,'rows':_0x4fe0a4}:null;}})['then'](respondWithResult(_0x198144,null))[_0xe552('0x40')](handleError(_0x198144,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 38ac03a..be95f3c 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 _0x276c=['lodash','util','api','moment','bluebird','path','rimraf','./automation.attributes','exports','define','tools_automations'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x276c,0x155));var _0xc276=function(_0x11f44e,_0x5b1c53){_0x11f44e=_0x11f44e-0x0;var _0x48b461=_0x276c[_0x11f44e];return _0x48b461;};'use strict';var _=require(_0xc276('0x0'));var util=require(_0xc276('0x1'));var logger=require('../../config/logger')(_0xc276('0x2'));var moment=require(_0xc276('0x3'));var BPromise=require(_0xc276('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc276('0x5'));var rimraf=require(_0xc276('0x6'));var config=require('../../config/environment');var attributes=require(_0xc276('0x7'));module[_0xc276('0x8')]=function(_0x39de9b,_0x57e69d){return _0x39de9b[_0xc276('0x9')]('Automation',attributes,{'tableName':_0xc276('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe966=['./automation.attributes','../../config/logger','api','moment','request-promise'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xe966,0x83));var _0x6e96=function(_0x482fcb,_0x5a5ff2){_0x482fcb=_0x482fcb-0x0;var _0x4eae71=_0xe966[_0x482fcb];return _0x4eae71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e96('0x0'))(_0x6e96('0x1'));var moment=require(_0x6e96('0x2'));var BPromise=require('bluebird');var rp=require(_0x6e96('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e96('0x4'));module['exports']=function(_0x2ffe57,_0x1bc7e6){return _0x2ffe57['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index f2861c3..c311663 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 _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb03e,0x1eb));var _0xeb03=function(_0x534f83,_0x7bbb9b){_0x534f83=_0x534f83-0x0;var _0x4e6dbc=_0xb03e[_0x534f83];return _0x4e6dbc;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('Automation,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file +var _0xcb10=['info','Automation,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x9cbfe0,_0x56aada){var _0x1f1534=function(_0x422947){while(--_0x422947){_0x9cbfe0['push'](_0x9cbfe0['shift']());}};_0x1f1534(++_0x56aada);}(_0xcb10,0x104));var _0x0cb1=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xcb10[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var moment=require('moment');var BPromise=require(_0x0cb1('0x2'));var rs=require(_0x0cb1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cb1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cb1('0x5'))(_0x0cb1('0x6'));var config=require(_0x0cb1('0x7'));var jayson=require(_0x0cb1('0x8'));var client=jayson[_0x0cb1('0x9')][_0x0cb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x390335,_0xdda18c,_0x575138){return new BPromise(function(_0x43620c,_0x1f815e){return client[_0x0cb1('0xb')](_0x390335,_0x575138)[_0x0cb1('0xc')](function(_0x41e0d2){logger[_0x0cb1('0xd')](_0x0cb1('0xe'),_0xdda18c,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xdda18c,_0x0cb1('0xf'),JSON[_0x0cb1('0x10')](_0x41e0d2));if(_0x41e0d2['error']){if(_0x41e0d2['error']['code']===0x1f4){logger[_0x0cb1('0x11')]('Automation,\x20%s,\x20%s',_0xdda18c,_0x41e0d2[_0x0cb1('0x11')][_0x0cb1('0x12')]);return _0x1f815e(_0x41e0d2[_0x0cb1('0x11')][_0x0cb1('0x12')]);}logger[_0x0cb1('0x11')](_0x0cb1('0xe'),_0xdda18c,_0x41e0d2['error'][_0x0cb1('0x12')]);return _0x43620c(_0x41e0d2[_0x0cb1('0x11')]['message']);}else{logger[_0x0cb1('0xd')]('Automation,\x20%s,\x20%s',_0xdda18c,_0x0cb1('0xf'));_0x43620c(_0x41e0d2[_0x0cb1('0x13')]['message']);}})[_0x0cb1('0x14')](function(_0x24315d){logger[_0x0cb1('0x11')](_0x0cb1('0xe'),_0xdda18c,_0x24315d);_0x1f815e(_0x24315d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 910907a..b29993a 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 _0x2bdb=['post','create','addConditions','put','update','delete','/:id','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x4fb2bf,_0x20e31d){var _0xaae939=function(_0x565c07){while(--_0x565c07){_0x4fb2bf['push'](_0x4fb2bf['shift']());}};_0xaae939(++_0x20e31d);}(_0x2bdb,0x105));var _0xb2bd=function(_0xb7acca,_0x15a520){_0xb7acca=_0xb7acca-0x0;var _0x176c7a=_0x2bdb[_0xb7acca];return _0x176c7a;};'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('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0x8')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')]('/',auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);router[_0xb2bd('0xf')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller['addActions']);router[_0xb2bd('0x12')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x13')]);router[_0xb2bd('0x14')](_0xb2bd('0x15'),auth[_0xb2bd('0x9')](),controller['destroy']);module[_0xb2bd('0x16')]=router; \ No newline at end of file +var _0xf9fd=['index','/:id','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./automation.controller','isAuthenticated'];(function(_0x9985b9,_0x4080d0){var _0x333811=function(_0x53270e){while(--_0x53270e){_0x9985b9['push'](_0x9985b9['shift']());}};_0x333811(++_0x4080d0);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var path=require(_0xdf9f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf9f('0x3'));var router=express[_0xdf9f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf9f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdf9f('0x6'));router['get']('/',auth[_0xdf9f('0x7')](),controller[_0xdf9f('0x8')]);router['get'](_0xdf9f('0x9'),auth[_0xdf9f('0x7')](),controller['show']);router[_0xdf9f('0xa')](_0xdf9f('0xb'),auth['isAuthenticated'](),controller[_0xdf9f('0xc')]);router[_0xdf9f('0xa')](_0xdf9f('0xd'),auth['isAuthenticated'](),controller[_0xdf9f('0xe')]);router[_0xdf9f('0xf')]('/',auth[_0xdf9f('0x7')](),controller[_0xdf9f('0x10')]);router[_0xdf9f('0xf')](_0xdf9f('0xb'),auth[_0xdf9f('0x7')](),controller[_0xdf9f('0x11')]);router['post'](_0xdf9f('0xd'),auth['isAuthenticated'](),controller[_0xdf9f('0x12')]);router[_0xdf9f('0x13')](_0xdf9f('0x9'),auth[_0xdf9f('0x7')](),controller[_0xdf9f('0x14')]);router[_0xdf9f('0x15')](_0xdf9f('0x9'),auth['isAuthenticated'](),controller[_0xdf9f('0x16')]);module[_0xdf9f('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 0eca431..150bd9b 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 _0x429a=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED'];(function(_0x1d3446,_0x263cd4){var _0x67032=function(_0xa1c866){while(--_0xa1c866){_0x1d3446['push'](_0x1d3446['shift']());}};_0x67032(++_0x263cd4);}(_0x429a,0x116));var _0xa429=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x429a[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require(_0xa429('0x0'));module[_0xa429('0x1')]={'name':{'type':Sequelize[_0xa429('0x2')],'unique':_0xa429('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa429('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xa429('0x2')]},'active':{'type':Sequelize[_0xa429('0x5')],'defaultValue':0x0,'comment':_0xa429('0x6')},'limitCalls':{'type':Sequelize[_0xa429('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa429('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa429('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'comment':_0xa429('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa429('0xf')},'dialTimezone':{'type':Sequelize[_0xa429('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa429('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa429('0x10')](_0xa429('0x11'),'never',_0xa429('0x12')),'defaultValue':_0xa429('0x11')},'dialAMDActive':{'type':Sequelize[_0xa429('0x5')],'defaultValue':0x0,'comment':_0xa429('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa429('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa429('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa429('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xa429('0x7')](0x9)[_0xa429('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa429('0x7')](0x9)[_0xa429('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa429('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa429('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa429('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa429('0x10')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xa429('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa429('0x1a')},'dialCutDigit':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x23')}}; \ No newline at end of file +var _0x223e=['#Machine\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0xfe21d8,_0x15ade1){var _0x3fe30f=function(_0x28f552){while(--_0x28f552){_0xfe21d8['push'](_0xfe21d8['shift']());}};_0x3fe30f(++_0x15ade1);}(_0x223e,0x1b1));var _0xe223=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x223e[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xe223('0x0'));module[_0xe223('0x1')]={'name':{'type':Sequelize[_0xe223('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe223('0x3')](_0xe223('0x4')),'allowNull':![],'defaultValue':_0xe223('0x4')},'description':{'type':Sequelize[_0xe223('0x2')]},'active':{'type':Sequelize[_0xe223('0x5')],'defaultValue':0x0,'comment':_0xe223('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xe223('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe223('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe223('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe223('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe223('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xe223('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe223('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe223('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe223('0x2')],'defaultValue':_0xe223('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xe223('0x3')](_0xe223('0x11'),'never','onlyIfOpen'),'defaultValue':_0xe223('0x11')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe223('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe223('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe223('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe223('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe223('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe223('0x8')](0x9)[_0xe223('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe223('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xe223('0x8')](0x9)[_0xe223('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe223('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe223('0x8')](0x9)[_0xe223('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe223('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe223('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe223('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe223('0x8')](0x9)[_0xe223('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe223('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe223('0x3')]('DESC',_0xe223('0x1b')),'defaultValue':_0xe223('0x1c')},'dialPrefix':{'type':Sequelize[_0xe223('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xe223('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe223('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe223('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe223('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe223('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe223('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe223('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe223('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe223('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe223('0x8')](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe223('0x8')](0x3)[_0xe223('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe223('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 689252e..7348320 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 _0x1d06=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','user','getHoppers','findOne','keys','CmHopper','sort','pick','CampaignId','includeAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','push','all','removeLists','getBlackLists','CmList','addBlackLists','spread','cm_hopper_black','ListId\x20=\x20?','sequelize','removeBlackLists','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query'];(function(_0x344264,_0x38aca6){var _0x528110=function(_0x3076f1){while(--_0x3076f1){_0x344264['push'](_0x344264['shift']());}};_0x528110(++_0x38aca6);}(_0x1d06,0x1e4));var _0x61d0=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1d06[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61d0('0x0'));var jsonpatch=require(_0x61d0('0x1'));var rp=require(_0x61d0('0x2'));var moment=require('moment');var BPromise=require(_0x61d0('0x3'));var Mustache=require(_0x61d0('0x4'));var util=require('util');var path=require(_0x61d0('0x5'));var sox=require('sox');var csv=require(_0x61d0('0x6'));var ejs=require(_0x61d0('0x7'));var fs=require('fs');var fs_extra=require(_0x61d0('0x8'));var _=require(_0x61d0('0x9'));var squel=require('squel');var crypto=require(_0x61d0('0xa'));var jsforce=require(_0x61d0('0xb'));var deskjs=require(_0x61d0('0xc'));var toCsv=require(_0x61d0('0x6'));var querystring=require(_0x61d0('0xd'));var Papa=require(_0x61d0('0xe'));var Redis=require(_0x61d0('0xf'));var authService=require(_0x61d0('0x10'));var qs=require(_0x61d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61d0('0x12'));var logger=require(_0x61d0('0x13'))(_0x61d0('0x14'));var utils=require('../../config/utils');var config=require(_0x61d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x61d0('0x16'))['db'];function respondWithStatusCode(_0xba1a15,_0x5d8e63){_0x5d8e63=_0x5d8e63||0xcc;return function(_0x34066e){if(_0x34066e){return _0xba1a15[_0x61d0('0x17')](_0x5d8e63);}return _0xba1a15[_0x61d0('0x18')](_0x5d8e63)[_0x61d0('0x19')]();};}function respondWithResult(_0x4b0506,_0x3760fa){_0x3760fa=_0x3760fa||0xc8;return function(_0x4e03fc){if(_0x4e03fc){return _0x4b0506[_0x61d0('0x18')](_0x3760fa)['json'](_0x4e03fc);}};}function respondWithFilteredResult(_0xf13354,_0x1030d5){return function(_0x11a4dd){if(_0x11a4dd){var _0x590bc2=typeof _0x1030d5['offset']===_0x61d0('0x1a')&&typeof _0x1030d5[_0x61d0('0x1b')]===_0x61d0('0x1a');var _0xf8ecc0=_0x11a4dd[_0x61d0('0x1c')];var _0x372193=_0x590bc2?0x0:_0x1030d5['offset'];var _0x5eb9f6=_0x590bc2?_0x11a4dd[_0x61d0('0x1c')]:_0x1030d5['offset']+_0x1030d5[_0x61d0('0x1b')];var _0x77da36;if(_0x5eb9f6>=_0xf8ecc0){_0x5eb9f6=_0xf8ecc0;_0x77da36=0xc8;}else{_0x77da36=0xce;}_0xf13354[_0x61d0('0x18')](_0x77da36);return _0xf13354[_0x61d0('0x1d')](_0x61d0('0x1e'),_0x372193+'-'+_0x5eb9f6+'/'+_0xf8ecc0)[_0x61d0('0x1f')](_0x11a4dd);}return null;};}function patchUpdates(_0x472c2e){return function(_0x22f0d2){try{jsonpatch[_0x61d0('0x20')](_0x22f0d2,_0x472c2e,!![]);}catch(_0x313b0c){return BPromise[_0x61d0('0x21')](_0x313b0c);}return _0x22f0d2[_0x61d0('0x22')]();};}function saveUpdates(_0x1c5789,_0x2f1019){return function(_0x488f4d){if(_0x488f4d){return _0x488f4d[_0x61d0('0x23')](_0x1c5789)[_0x61d0('0x24')](function(_0xb8f040){return _0xb8f040;});}return null;};}function removeEntity(_0x252b6a,_0x84d888){return function(_0x406fde){if(_0x406fde){return _0x406fde[_0x61d0('0x25')]()[_0x61d0('0x24')](function(){var _0xa772a9=_0x406fde[_0x61d0('0x26')]({'plain':!![]});var _0x240935=_0x61d0('0x27');return db['UserProfileResource'][_0x61d0('0x25')]({'where':{'type':_0x240935,'resourceId':_0xa772a9['id']}})[_0x61d0('0x24')](function(){return _0x406fde;});})[_0x61d0('0x24')](function(){_0x252b6a[_0x61d0('0x18')](0xcc)[_0x61d0('0x19')]();});}};}function handleEntityNotFound(_0x73672e,_0x516ffb){return function(_0x196e42){if(!_0x196e42){_0x73672e['sendStatus'](0x194);}return _0x196e42;};}function handleError(_0x314789,_0xaff012){_0xaff012=_0xaff012||0x1f4;return function(_0x391e60){logger[_0x61d0('0x28')](_0x391e60[_0x61d0('0x29')]);if(_0x391e60['name']){delete _0x391e60[_0x61d0('0x2a')];}_0x314789[_0x61d0('0x18')](_0xaff012)['send'](_0x391e60);};}exports[_0x61d0('0x2b')]=function(_0x196359,_0x31b91a){var _0x3d460b={},_0xf9cf91={},_0x428997={'count':0x0,'rows':[]};var _0x1d16e1=_[_0x61d0('0x2c')](db[_0x61d0('0x2d')][_0x61d0('0x2e')],function(_0x372a42){return{'name':_0x372a42[_0x61d0('0x2f')],'type':_0x372a42[_0x61d0('0x30')][_0x61d0('0x31')]};});_0xf9cf91[_0x61d0('0x32')]=_[_0x61d0('0x2c')](_0x1d16e1,_0x61d0('0x2a'));_0xf9cf91[_0x61d0('0x33')]=_['keys'](_0x196359['query']);_0xf9cf91[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0xf9cf91[_0x61d0('0x32')],_0xf9cf91['query']);_0x3d460b[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0xf9cf91[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x196359[_0x61d0('0x33')][_0x61d0('0x37')]));_0x3d460b['attributes']=_0x3d460b['attributes'][_0x61d0('0x38')]?_0x3d460b[_0x61d0('0x36')]:_0xf9cf91['model'];if(!_0x196359[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x3d460b['limit']=qs['limit'](_0x196359[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x3d460b[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x196359['query'][_0x61d0('0x3b')]);}_0x3d460b[_0x61d0('0x3c')]=qs['sort'](_0x196359['query']['sort']);_0x3d460b[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_['pick'](_0x196359['query'],_0xf9cf91[_0x61d0('0x34')]),_0x1d16e1);if(_0x196359[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x3d460b[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x3d460b[_0x61d0('0x3d')],{'$or':_['map'](_0x1d16e1,function(_0x5bbea9){if(_0x5bbea9['type']!=='VIRTUAL'){var _0x1c5162={};_0x1c5162[_0x5bbea9[_0x61d0('0x2a')]]={'$like':'%'+_0x196359[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x1c5162;}})});}_0x3d460b=_['merge']({},_0x3d460b,_0x196359[_0x61d0('0x40')]);var _0x983224={'where':_0x3d460b['where']};return db['Campaign'][_0x61d0('0x1c')](_0x983224)[_0x61d0('0x24')](function(_0x25c224){_0x428997[_0x61d0('0x1c')]=_0x25c224;if(_0x196359[_0x61d0('0x33')]['includeAll']){_0x3d460b[_0x61d0('0x41')]=[{'all':!![]}];}return db[_0x61d0('0x2d')][_0x61d0('0x42')](_0x3d460b);})[_0x61d0('0x24')](function(_0x23eb79){_0x428997[_0x61d0('0x43')]=_0x23eb79;return _0x428997;})[_0x61d0('0x24')](respondWithFilteredResult(_0x31b91a,_0x3d460b))[_0x61d0('0x44')](handleError(_0x31b91a,null));};exports[_0x61d0('0x45')]=function(_0x27e4bb,_0x16f1c9){var _0x3d28cc={'raw':![],'where':{'id':_0x27e4bb[_0x61d0('0x46')]['id']}},_0x37cd4e={};_0x37cd4e['model']=_['keys'](db[_0x61d0('0x2d')][_0x61d0('0x2e')]);_0x37cd4e[_0x61d0('0x33')]=_['keys'](_0x27e4bb[_0x61d0('0x33')]);_0x37cd4e['filters']=_[_0x61d0('0x35')](_0x37cd4e[_0x61d0('0x32')],_0x37cd4e[_0x61d0('0x33')]);_0x3d28cc[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x37cd4e[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x27e4bb['query']['fields']));_0x3d28cc['attributes']=_0x3d28cc['attributes'][_0x61d0('0x38')]?_0x3d28cc[_0x61d0('0x36')]:_0x37cd4e[_0x61d0('0x32')];if(_0x27e4bb['query']['includeAll']){_0x3d28cc['include']=[{'all':!![]}];}_0x3d28cc=_[_0x61d0('0x3f')]({},_0x3d28cc,_0x27e4bb[_0x61d0('0x40')]);return db[_0x61d0('0x2d')][_0x61d0('0x47')](_0x3d28cc)[_0x61d0('0x24')](handleEntityNotFound(_0x16f1c9,null))[_0x61d0('0x24')](respondWithResult(_0x16f1c9,null))[_0x61d0('0x44')](handleError(_0x16f1c9,null));};exports[_0x61d0('0x48')]=function(_0x2110e8,_0x23cd4a){return db[_0x61d0('0x2d')][_0x61d0('0x48')](_0x2110e8[_0x61d0('0x49')],{})[_0x61d0('0x24')](function(_0x3b661a){var _0x2629d3=_0x2110e8['user']['get']({'plain':!![]});if(!_0x2629d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2629d3[_0x61d0('0x4a')]==='user'){var _0x466906=_0x3b661a[_0x61d0('0x26')]({'plain':!![]});var _0x2f14ba=_0x61d0('0x27');return db[_0x61d0('0x4b')][_0x61d0('0x47')]({'where':{'name':_0x2f14ba,'userProfileId':_0x2629d3[_0x61d0('0x4c')]},'raw':!![]})[_0x61d0('0x24')](function(_0x579843){if(_0x579843&&_0x579843[_0x61d0('0x4d')]===0x0){return db[_0x61d0('0x4e')][_0x61d0('0x48')]({'name':_0x466906[_0x61d0('0x2a')],'resourceId':_0x466906['id'],'type':_0x579843[_0x61d0('0x2a')],'sectionId':_0x579843['id']},{})[_0x61d0('0x24')](function(){return _0x3b661a;});}else{return _0x3b661a;}})[_0x61d0('0x44')](function(_0x59a06f){logger['error'](_0x61d0('0x4f'),_0x59a06f);throw _0x59a06f;});}return _0x3b661a;})['then'](respondWithResult(_0x23cd4a,0xc9))[_0x61d0('0x44')](handleError(_0x23cd4a,null));};exports['clone']=function(_0x9106e6,_0x18d004){var _0x548ec8={'where':{'id':_0x9106e6['params']['id']}},_0x1c05e8={};_0x1c05e8['model']=_['keys'](db['Campaign'][_0x61d0('0x2e')]);_0x548ec8[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x1c05e8[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x9106e6['query'][_0x61d0('0x37')]));_0x548ec8[_0x61d0('0x36')]=_0x548ec8[_0x61d0('0x36')][_0x61d0('0x38')]?_0x548ec8[_0x61d0('0x36')]:_0x1c05e8[_0x61d0('0x32')];if(_0x9106e6[_0x61d0('0x33')]['includeAll']){_0x548ec8[_0x61d0('0x41')]=[{'all':!![]}];}_0x548ec8=_[_0x61d0('0x3f')]({},_0x548ec8,_0x9106e6[_0x61d0('0x40')]);return db['Campaign'][_0x61d0('0x47')](_0x548ec8)['then'](handleEntityNotFound(_0x18d004,null))[_0x61d0('0x24')](function(_0x31a454){if(_0x31a454){var _0x25e49b=_0x31a454['get']({'plain':!![]});_0x25e49b=qs['omit'](_0x25e49b,['id',_0x61d0('0x50'),_0x61d0('0x51')]);_0x9106e6['body']=_[_0x61d0('0x52')](_0x9106e6['body'],['id',_0x61d0('0x50'),_0x61d0('0x51')]);return db[_0x61d0('0x2d')]['create'](_[_0x61d0('0x3f')](_0x25e49b,_0x9106e6[_0x61d0('0x49')]),{'include':_0x9106e6[_0x61d0('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x61d0('0x24')](function(_0xc762f3){var _0x4984f9=_0x9106e6[_0x61d0('0x53')][_0x61d0('0x26')]({'plain':!![]});if(!_0x4984f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4984f9[_0x61d0('0x4a')]===_0x61d0('0x53')){var _0x542a71=_0xc762f3[_0x61d0('0x26')]({'plain':!![]});var _0x4f2198=_0x61d0('0x27');return db[_0x61d0('0x4b')]['find']({'where':{'name':_0x4f2198,'userProfileId':_0x4984f9[_0x61d0('0x4c')]},'raw':!![]})[_0x61d0('0x24')](function(_0x5da5b1){if(_0x5da5b1&&_0x5da5b1[_0x61d0('0x4d')]===0x0){return db[_0x61d0('0x4e')][_0x61d0('0x48')]({'name':_0x542a71['name'],'resourceId':_0x542a71['id'],'type':_0x5da5b1[_0x61d0('0x2a')],'sectionId':_0x5da5b1['id']},{})[_0x61d0('0x24')](function(){return _0xc762f3;});}else{return _0xc762f3;}})[_0x61d0('0x44')](function(_0x5a6e31){logger[_0x61d0('0x28')](_0x61d0('0x4f'),_0x5a6e31);throw _0x5a6e31;});}return _0xc762f3;});}})[_0x61d0('0x24')](respondWithResult(_0x18d004,0xc9))['catch'](handleError(_0x18d004,null));};exports[_0x61d0('0x23')]=function(_0x1973fe,_0xa75f73){if(_0x1973fe[_0x61d0('0x49')]['id']){delete _0x1973fe[_0x61d0('0x49')]['id'];}return db[_0x61d0('0x2d')]['find']({'where':{'id':_0x1973fe['params']['id']}})['then'](handleEntityNotFound(_0xa75f73,null))[_0x61d0('0x24')](saveUpdates(_0x1973fe[_0x61d0('0x49')],null))['then'](respondWithResult(_0xa75f73,null))[_0x61d0('0x44')](handleError(_0xa75f73,null));};exports[_0x61d0('0x25')]=function(_0x3347f3,_0x547161){return db[_0x61d0('0x2d')]['find']({'where':{'id':_0x3347f3[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x547161,null))['then'](removeEntity(_0x547161,null))[_0x61d0('0x44')](handleError(_0x547161,null));};exports[_0x61d0('0x54')]=function(_0x1f0c23,_0x46459f,_0x2faca1){var _0x27e4a8={'raw':!![],'where':{}};var _0x13833f={};var _0x4b120b={'count':0x0,'rows':[]};return db['Campaign'][_0x61d0('0x55')]({'where':{'id':_0x1f0c23[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x46459f,null))['then'](function(_0x38bff8){if(_0x38bff8){_0x13833f['model']=_[_0x61d0('0x56')](db[_0x61d0('0x57')][_0x61d0('0x2e')]);_0x13833f['query']=_[_0x61d0('0x56')](_0x1f0c23[_0x61d0('0x33')]);_0x13833f[_0x61d0('0x34')]=_['intersection'](_0x13833f[_0x61d0('0x32')],_0x13833f[_0x61d0('0x33')]);_0x27e4a8[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x13833f['model'],qs[_0x61d0('0x37')](_0x1f0c23[_0x61d0('0x33')]['fields']));_0x27e4a8[_0x61d0('0x36')]=_0x27e4a8['attributes'][_0x61d0('0x38')]?_0x27e4a8['attributes']:_0x13833f['model'];if(!_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x27e4a8[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x1f0c23[_0x61d0('0x33')]['limit']);_0x27e4a8[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3b')]);}_0x27e4a8[_0x61d0('0x3c')]=qs['sort'](_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x58')]);_0x27e4a8['where']=qs['filters'](_[_0x61d0('0x59')](_0x1f0c23[_0x61d0('0x33')],_0x13833f[_0x61d0('0x34')]));_0x27e4a8[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x38bff8['id'];if(_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x27e4a8[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x27e4a8['where'],{'$or':_[_0x61d0('0x2c')](_0x27e4a8[_0x61d0('0x36')],function(_0x3ae33c){var _0x36539f={};_0x36539f[_0x3ae33c]={'$like':'%'+_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x36539f;})});}_0x27e4a8=_[_0x61d0('0x3f')]({},_0x27e4a8,_0x1f0c23[_0x61d0('0x40')]);return db[_0x61d0('0x57')][_0x61d0('0x1c')]({'where':_0x27e4a8[_0x61d0('0x3d')]})['then'](function(_0x34f269){_0x4b120b[_0x61d0('0x1c')]=_0x34f269;if(_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x27e4a8[_0x61d0('0x41')]=[{'all':!![]}];}return db[_0x61d0('0x57')][_0x61d0('0x42')](_0x27e4a8);})[_0x61d0('0x24')](function(_0x50235d){_0x4b120b['rows']=_0x50235d;return _0x4b120b;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x46459f,_0x27e4a8))[_0x61d0('0x44')](handleError(_0x46459f,null));};exports['getHopperHistories']=function(_0x21d2a4,_0x4562bd,_0x1d3876){var _0x5e6b3f={'raw':!![],'where':{}};var _0x32d957={};var _0x30e140={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')]['findOne']({'where':{'id':_0x21d2a4[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x4562bd,null))[_0x61d0('0x24')](function(_0x2ae228){if(_0x2ae228){_0x32d957[_0x61d0('0x32')]=_[_0x61d0('0x56')](db['CmHopperHistory']['rawAttributes']);_0x32d957[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x21d2a4['query']);_0x32d957[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x32d957['model'],_0x32d957[_0x61d0('0x33')]);_0x5e6b3f[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x32d957[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x21d2a4[_0x61d0('0x33')]['fields']));_0x5e6b3f[_0x61d0('0x36')]=_0x5e6b3f[_0x61d0('0x36')][_0x61d0('0x38')]?_0x5e6b3f[_0x61d0('0x36')]:_0x32d957['model'];if(!_0x21d2a4[_0x61d0('0x33')]['hasOwnProperty'](_0x61d0('0x3a'))){_0x5e6b3f[_0x61d0('0x1b')]=qs['limit'](_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x5e6b3f['offset']=qs[_0x61d0('0x3b')](_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3b')]);}_0x5e6b3f['order']=qs[_0x61d0('0x58')](_0x21d2a4['query'][_0x61d0('0x58')]);_0x5e6b3f[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x21d2a4[_0x61d0('0x33')],_0x32d957[_0x61d0('0x34')]));_0x5e6b3f[_0x61d0('0x3d')]['CampaignId']=_0x2ae228['id'];if(_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x5e6b3f[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x5e6b3f[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x5e6b3f[_0x61d0('0x36')],function(_0x13fa43){var _0xa52eae={};_0xa52eae[_0x13fa43]={'$like':'%'+_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0xa52eae;})});}_0x5e6b3f=_[_0x61d0('0x3f')]({},_0x5e6b3f,_0x21d2a4[_0x61d0('0x40')]);return db['CmHopperHistory'][_0x61d0('0x1c')]({'where':_0x5e6b3f['where']})[_0x61d0('0x24')](function(_0x6f3e01){_0x30e140[_0x61d0('0x1c')]=_0x6f3e01;if(_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x5e6b3f[_0x61d0('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x61d0('0x42')](_0x5e6b3f);})[_0x61d0('0x24')](function(_0x2bd99e){_0x30e140[_0x61d0('0x43')]=_0x2bd99e;return _0x30e140;});}})['then'](respondWithFilteredResult(_0x4562bd,_0x5e6b3f))[_0x61d0('0x44')](handleError(_0x4562bd,null));};exports[_0x61d0('0x5c')]=function(_0x33549c,_0x164840,_0x4d5d87){var _0x154892={'raw':!![],'where':{}};var _0x4681ae={};var _0x3b14b9={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x33549c[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x164840,null))[_0x61d0('0x24')](function(_0x31b6ff){if(_0x31b6ff){_0x4681ae[_0x61d0('0x32')]=_[_0x61d0('0x56')](db[_0x61d0('0x5d')]['rawAttributes']);_0x4681ae[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x33549c['query']);_0x4681ae[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x4681ae['model'],_0x4681ae[_0x61d0('0x33')]);_0x154892[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x4681ae[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x33549c['query'][_0x61d0('0x37')]));_0x154892[_0x61d0('0x36')]=_0x154892[_0x61d0('0x36')][_0x61d0('0x38')]?_0x154892[_0x61d0('0x36')]:_0x4681ae[_0x61d0('0x32')];if(!_0x33549c[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x154892['limit']=qs[_0x61d0('0x1b')](_0x33549c[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x154892[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x33549c[_0x61d0('0x33')]['offset']);}_0x154892['order']=qs[_0x61d0('0x58')](_0x33549c[_0x61d0('0x33')]['sort']);_0x154892[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x33549c['query'],_0x4681ae[_0x61d0('0x34')]));_0x154892[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x31b6ff['id'];if(_0x33549c[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x154892[_0x61d0('0x3d')]=_['merge'](_0x154892[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x154892[_0x61d0('0x36')],function(_0x5e5329){var _0x4cbb32={};_0x4cbb32[_0x5e5329]={'$like':'%'+_0x33549c['query']['filter']+'%'};return _0x4cbb32;})});}_0x154892=_['merge']({},_0x154892,_0x33549c[_0x61d0('0x40')]);return db[_0x61d0('0x5d')][_0x61d0('0x1c')]({'where':_0x154892[_0x61d0('0x3d')]})[_0x61d0('0x24')](function(_0x6ae28){_0x3b14b9['count']=_0x6ae28;if(_0x33549c[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x154892['include']=[{'all':!![]}];}return db[_0x61d0('0x5d')][_0x61d0('0x42')](_0x154892);})[_0x61d0('0x24')](function(_0x458476){_0x3b14b9['rows']=_0x458476;return _0x3b14b9;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x164840,_0x154892))['catch'](handleError(_0x164840,null));};exports[_0x61d0('0x5e')]=function(_0x6c5b43,_0x39b5ee,_0x5ee948){var _0x5d4a97={'raw':!![],'where':{}};var _0x386487={};var _0x580048={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x6c5b43[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x39b5ee,null))[_0x61d0('0x24')](function(_0x1a1a12){if(_0x1a1a12){_0x386487[_0x61d0('0x32')]=_[_0x61d0('0x56')](db[_0x61d0('0x5f')][_0x61d0('0x2e')]);_0x386487['query']=_[_0x61d0('0x56')](_0x6c5b43[_0x61d0('0x33')]);_0x386487[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x386487['model'],_0x386487[_0x61d0('0x33')]);_0x5d4a97['attributes']=_[_0x61d0('0x35')](_0x386487[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x37')]));_0x5d4a97[_0x61d0('0x36')]=_0x5d4a97[_0x61d0('0x36')][_0x61d0('0x38')]?_0x5d4a97[_0x61d0('0x36')]:_0x386487[_0x61d0('0x32')];if(!_0x6c5b43['query'][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x5d4a97[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x5d4a97[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x6c5b43['query'][_0x61d0('0x3b')]);}_0x5d4a97['order']=qs['sort'](_0x6c5b43[_0x61d0('0x33')]['sort']);_0x5d4a97[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x6c5b43[_0x61d0('0x33')],_0x386487[_0x61d0('0x34')]));_0x5d4a97[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x1a1a12['id'];if(_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x5d4a97['where']=_[_0x61d0('0x3f')](_0x5d4a97[_0x61d0('0x3d')],{'$or':_['map'](_0x5d4a97['attributes'],function(_0x2cd456){var _0x561016={};_0x561016[_0x2cd456]={'$like':'%'+_0x6c5b43[_0x61d0('0x33')]['filter']+'%'};return _0x561016;})});}_0x5d4a97=_['merge']({},_0x5d4a97,_0x6c5b43[_0x61d0('0x40')]);return db['CmHopperBlack'][_0x61d0('0x1c')]({'where':_0x5d4a97[_0x61d0('0x3d')]})[_0x61d0('0x24')](function(_0x5bf567){_0x580048['count']=_0x5bf567;if(_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x5d4a97['include']=[{'all':!![]}];}return db[_0x61d0('0x5f')][_0x61d0('0x42')](_0x5d4a97);})[_0x61d0('0x24')](function(_0x2a977d){_0x580048['rows']=_0x2a977d;return _0x580048;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x39b5ee,_0x5d4a97))[_0x61d0('0x44')](handleError(_0x39b5ee,null));};exports['getLists']=function(_0x2baea5,_0x135feb,_0x2a147f){var _0x2e3465={};var _0x3d8e5d={};var _0x4b7ca7;var _0x704247;return db[_0x61d0('0x2d')]['findOne']({'where':{'id':_0x2baea5[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x135feb,null))['then'](function(_0x55b709){if(_0x55b709){_0x4b7ca7=_0x55b709;_0x3d8e5d[_0x61d0('0x32')]=_['keys'](db['CmList']['rawAttributes']);_0x3d8e5d[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x2baea5[_0x61d0('0x33')]);_0x3d8e5d[_0x61d0('0x34')]=_['intersection'](_0x3d8e5d[_0x61d0('0x32')],_0x3d8e5d[_0x61d0('0x33')]);_0x2e3465['attributes']=_[_0x61d0('0x35')](_0x3d8e5d[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x2baea5['query'][_0x61d0('0x37')]));_0x2e3465[_0x61d0('0x36')]=_0x2e3465[_0x61d0('0x36')][_0x61d0('0x38')]?_0x2e3465[_0x61d0('0x36')]:_0x3d8e5d[_0x61d0('0x32')];_0x2e3465[_0x61d0('0x3c')]=qs['sort'](_0x2baea5[_0x61d0('0x33')]['sort']);_0x2e3465[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x2baea5['query'],_0x3d8e5d[_0x61d0('0x34')]));if(_0x2baea5['query']['filter']){_0x2e3465['where']=_[_0x61d0('0x3f')](_0x2e3465[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x2e3465[_0x61d0('0x36')],function(_0x20f31a){var _0x57a324={};_0x57a324[_0x20f31a]={'$like':'%'+_0x2baea5[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x57a324;})});}_0x2e3465=_['merge']({},_0x2e3465,_0x2baea5[_0x61d0('0x40')]);return _0x4b7ca7[_0x61d0('0x60')](_0x2e3465);}})[_0x61d0('0x24')](function(_0x173c35){if(_0x173c35){_0x704247=_0x173c35[_0x61d0('0x38')];if(!_0x2baea5['query'][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x2e3465[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x2baea5[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x2e3465[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x2baea5['query'][_0x61d0('0x3b')]);}return _0x4b7ca7['getLists'](_0x2e3465);}})[_0x61d0('0x24')](function(_0x5aab85){if(_0x5aab85){return _0x5aab85?{'count':_0x704247,'rows':_0x5aab85}:null;}})[_0x61d0('0x24')](respondWithResult(_0x135feb,null))[_0x61d0('0x44')](handleError(_0x135feb,null));};exports[_0x61d0('0x61')]=function(_0xfe186a,_0x57bc9b,_0x2f56dd){var _0x6d06ec,_0x5a872b;return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0xfe186a['params']['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x57bc9b,null))[_0x61d0('0x24')](function(_0x4d07da){if(_0x4d07da){_0x5a872b=_0x4d07da;return _0x4d07da['addLists'](_0xfe186a[_0x61d0('0x49')][_0x61d0('0x62')],_[_0x61d0('0x52')](_0xfe186a['body'],[_0x61d0('0x62'),'id'])||{});}return null;})['spread'](function(_0x39a50f){var _0x2f9a60;_0x6d06ec=_0x39a50f||[];var _0x4ef981=[];if(_0x39a50f){for(var _0x2f49d6=0x0;_0x2f49d6<_0x39a50f[_0x61d0('0x38')];_0x2f49d6+=0x1){var _0x206985=_0x39a50f[_0x2f49d6][_0x61d0('0x26')]({'plain':!![]});_0x5a872b[_0x61d0('0x63')]=_0xfe186a[_0x61d0('0x49')]['dialCheckDuplicateType']?_0xfe186a[_0x61d0('0x49')][_0x61d0('0x63')]:_0x5a872b[_0x61d0('0x63')];switch(_0x5a872b['dialCheckDuplicateType']){case _0x61d0('0x64'):_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))[_0x61d0('0x68')]([_0x61d0('0x69'),_0x61d0('0x6a'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),_0x61d0('0x51')],squel[_0x61d0('0x6d')]()[_0x61d0('0x6e')]('phone','phone')[_0x61d0('0x6e')](_0x61d0('0x6f'),_0x61d0('0x6a'))[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))[_0x61d0('0x6e')](_0x206985[_0x61d0('0x70')][_0x61d0('0x71')](),_0x61d0('0x6c'))['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),'CampaignId')[_0x61d0('0x6e')](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')](_0x61d0('0x6f'),_0x61d0('0x51'))[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985[_0x61d0('0x70')][_0x61d0('0x71')]())[_0x61d0('0x3d')](_0x61d0('0x74'))[_0x61d0('0x3d')](_0x61d0('0x75'),squel['select']()[_0x61d0('0x6e')](_0x61d0('0x76'))[_0x61d0('0x72')](_0x61d0('0x77'))[_0x61d0('0x3d')](_0x61d0('0x78'),_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]()))['where'](_0x61d0('0x75'),squel[_0x61d0('0x6d')]()[_0x61d0('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0x61d0('0x67'))[_0x61d0('0x3d')](_0x61d0('0x78'),_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]())))[_0x61d0('0x71')]();break;case _0x61d0('0x79'):_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))['fromQuery']([_0x61d0('0x69'),_0x61d0('0x6a'),'ContactId','ListId',_0x61d0('0x5a'),'createdAt',_0x61d0('0x51')],squel['select']()['field']('phone',_0x61d0('0x69'))['field'](_0x61d0('0x6f'),_0x61d0('0x6a'))[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))[_0x61d0('0x6e')](_0x206985[_0x61d0('0x70')]['toString'](),_0x61d0('0x6c'))['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),'CampaignId')['field'](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')](_0x61d0('0x6f'),'updatedAt')[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985['CmListId'][_0x61d0('0x71')]())[_0x61d0('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x61d0('0x6d')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x61d0('0x3d')]('CampaignId\x20=\x20?',_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]())))[_0x61d0('0x71')]();break;default:_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))[_0x61d0('0x68')]([_0x61d0('0x69'),_0x61d0('0x6a'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),'updatedAt'],squel['select']()[_0x61d0('0x6e')](_0x61d0('0x69'),_0x61d0('0x69'))[_0x61d0('0x6e')](_0x61d0('0x6f'),'scheduledAt')[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))['field'](_0x206985[_0x61d0('0x70')]['toString'](),'ListId')['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),_0x61d0('0x5a'))[_0x61d0('0x6e')]('NOW()',_0x61d0('0x50'))[_0x61d0('0x6e')](_0x61d0('0x6f'),'updatedAt')[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')](_0x61d0('0x7a'))[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985[_0x61d0('0x70')][_0x61d0('0x71')]())[_0x61d0('0x3d')](_0x61d0('0x74')))[_0x61d0('0x71')]();}_0x4ef981[_0x61d0('0x7b')](db['sequelize'][_0x61d0('0x33')](_0x2f9a60));}return BPromise[_0x61d0('0x7c')](_0x4ef981);}})[_0x61d0('0x24')](function(){return _0x6d06ec;})[_0x61d0('0x24')](respondWithResult(_0x57bc9b,null))['catch'](handleError(_0x57bc9b,null));};exports[_0x61d0('0x7d')]=function(_0x1ddb2a,_0x938bb1,_0x30311a){return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0x1ddb2a[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x938bb1,null))['then'](function(_0x22f1a2){if(_0x22f1a2){return _0x22f1a2['removeLists'](_0x1ddb2a[_0x61d0('0x33')][_0x61d0('0x62')]);}})[_0x61d0('0x24')](function(_0x56733f){if(_0x56733f){return db[_0x61d0('0x57')][_0x61d0('0x25')]({'where':{'ListId':_0x1ddb2a[_0x61d0('0x33')][_0x61d0('0x62')],'CampaignId':_0x1ddb2a[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](function(){return _0x56733f;});}})[_0x61d0('0x24')](respondWithStatusCode(_0x938bb1,null))[_0x61d0('0x44')](handleError(_0x938bb1,null));};exports[_0x61d0('0x7e')]=function(_0x293666,_0xabb03f,_0x5ec107){var _0x2a7d50={};var _0x474d58={};var _0xf335cc;var _0x4143b1;return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x293666[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0xabb03f,null))[_0x61d0('0x24')](function(_0x3e994f){if(_0x3e994f){_0xf335cc=_0x3e994f;_0x474d58['model']=_[_0x61d0('0x56')](db[_0x61d0('0x7f')][_0x61d0('0x2e')]);_0x474d58[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x293666[_0x61d0('0x33')]);_0x474d58[_0x61d0('0x34')]=_['intersection'](_0x474d58[_0x61d0('0x32')],_0x474d58[_0x61d0('0x33')]);_0x2a7d50[_0x61d0('0x36')]=_['intersection'](_0x474d58[_0x61d0('0x32')],qs['fields'](_0x293666[_0x61d0('0x33')][_0x61d0('0x37')]));_0x2a7d50['attributes']=_0x2a7d50[_0x61d0('0x36')][_0x61d0('0x38')]?_0x2a7d50[_0x61d0('0x36')]:_0x474d58['model'];_0x2a7d50[_0x61d0('0x3c')]=qs[_0x61d0('0x58')](_0x293666['query'][_0x61d0('0x58')]);_0x2a7d50[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_['pick'](_0x293666[_0x61d0('0x33')],_0x474d58[_0x61d0('0x34')]));if(_0x293666[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x2a7d50[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x2a7d50[_0x61d0('0x3d')],{'$or':_['map'](_0x2a7d50[_0x61d0('0x36')],function(_0xf64c0){var _0x208e65={};_0x208e65[_0xf64c0]={'$like':'%'+_0x293666['query']['filter']+'%'};return _0x208e65;})});}_0x2a7d50=_['merge']({},_0x2a7d50,_0x293666[_0x61d0('0x40')]);return _0xf335cc[_0x61d0('0x7e')](_0x2a7d50);}})[_0x61d0('0x24')](function(_0x333046){if(_0x333046){_0x4143b1=_0x333046[_0x61d0('0x38')];if(!_0x293666[_0x61d0('0x33')]['hasOwnProperty']('nolimit')){_0x2a7d50[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x293666[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x2a7d50[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x293666[_0x61d0('0x33')][_0x61d0('0x3b')]);}return _0xf335cc[_0x61d0('0x7e')](_0x2a7d50);}})[_0x61d0('0x24')](function(_0x9096b7){if(_0x9096b7){return _0x9096b7?{'count':_0x4143b1,'rows':_0x9096b7}:null;}})['then'](respondWithResult(_0xabb03f,null))[_0x61d0('0x44')](handleError(_0xabb03f,null));};exports[_0x61d0('0x80')]=function(_0x5af753,_0x493cb1,_0x17d326){var _0x3cb01d,_0x467b0f;return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0x5af753[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x493cb1,null))['then'](function(_0x10ba44){if(_0x10ba44){_0x467b0f=_0x10ba44;return _0x10ba44[_0x61d0('0x80')](_0x5af753[_0x61d0('0x49')][_0x61d0('0x62')],_[_0x61d0('0x52')](_0x5af753[_0x61d0('0x49')],[_0x61d0('0x62'),'id'])||{});}return null;})[_0x61d0('0x81')](function(_0x1fd4b5){var _0x585957;_0x3cb01d=_0x1fd4b5||[];var _0x3e6f5=[];if(_0x1fd4b5){for(var _0x2676ed=0x0;_0x2676ed<_0x1fd4b5[_0x61d0('0x38')];_0x2676ed+=0x1){var _0x4c8b93=_0x1fd4b5[_0x2676ed][_0x61d0('0x26')]({'plain':!![]});_0x585957=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x82'))['fromQuery']([_0x61d0('0x69'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),'updatedAt'],squel['select']()[_0x61d0('0x6e')](_0x61d0('0x69'),_0x61d0('0x69'))[_0x61d0('0x6e')]('id','ContactId')['field'](_0x4c8b93[_0x61d0('0x70')][_0x61d0('0x71')](),'ListId')[_0x61d0('0x6e')](_0x5af753['params']['id'][_0x61d0('0x71')](),'CampaignId')['field'](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')]('NOW()',_0x61d0('0x51'))[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')](_0x61d0('0x83'),_0x4c8b93['CmListId'][_0x61d0('0x71')]())[_0x61d0('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x61d0('0x71')]();_0x3e6f5[_0x61d0('0x7b')](db[_0x61d0('0x84')][_0x61d0('0x33')](_0x585957));}return BPromise['all'](_0x3e6f5);}})[_0x61d0('0x24')](function(){return _0x3cb01d;})['then'](respondWithResult(_0x493cb1,null))[_0x61d0('0x44')](handleError(_0x493cb1,null));};exports[_0x61d0('0x85')]=function(_0x5bf9c7,_0xc69444,_0x53592a){return db['Campaign'][_0x61d0('0x47')]({'where':{'id':_0x5bf9c7[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0xc69444,null))[_0x61d0('0x24')](function(_0x5e43f9){if(_0x5e43f9){return _0x5e43f9['removeBlackLists'](_0x5bf9c7[_0x61d0('0x33')][_0x61d0('0x62')]);}})[_0x61d0('0x24')](function(_0x5bc1dd){if(_0x5bc1dd){return db[_0x61d0('0x5f')][_0x61d0('0x25')]({'where':{'ListId':_0x5bf9c7[_0x61d0('0x33')][_0x61d0('0x62')],'CampaignId':_0x5bf9c7['params']['id']}})['then'](function(){return _0x5bc1dd;});}})['then'](respondWithStatusCode(_0xc69444,null))[_0x61d0('0x44')](handleError(_0xc69444,null));}; \ No newline at end of file +var _0xe871=['updatedAt','omit','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','rawAttributes','pick','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ListId','select','field','NOW()','scheduledAt','ContactId','CmListId','toString','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','fast-json-patch','mustache','util','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0xe871,0x145));var _0x1e87=function(_0x1b01d8,_0x454635){_0x1b01d8=_0x1b01d8-0x0;var _0x469731=_0xe871[_0x1b01d8];return _0x469731;};'use strict';var emlformat=require(_0x1e87('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e87('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e87('0x2'));var util=require(_0x1e87('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x1e87('0x4'));var ejs=require(_0x1e87('0x5'));var fs=require('fs');var fs_extra=require(_0x1e87('0x6'));var _=require(_0x1e87('0x7'));var squel=require(_0x1e87('0x8'));var crypto=require(_0x1e87('0x9'));var jsforce=require(_0x1e87('0xa'));var deskjs=require(_0x1e87('0xb'));var toCsv=require(_0x1e87('0x4'));var querystring=require(_0x1e87('0xc'));var Papa=require(_0x1e87('0xd'));var Redis=require(_0x1e87('0xe'));var authService=require(_0x1e87('0xf'));var qs=require(_0x1e87('0x10'));var as=require(_0x1e87('0x11'));var hardwareService=require(_0x1e87('0x12'));var logger=require(_0x1e87('0x13'))(_0x1e87('0x14'));var utils=require('../../config/utils');var config=require(_0x1e87('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e87('0x16'))['db'];function respondWithStatusCode(_0x3a7015,_0x149490){_0x149490=_0x149490||0xcc;return function(_0x1895ec){if(_0x1895ec){return _0x3a7015[_0x1e87('0x17')](_0x149490);}return _0x3a7015[_0x1e87('0x18')](_0x149490)[_0x1e87('0x19')]();};}function respondWithResult(_0x21a1db,_0x587995){_0x587995=_0x587995||0xc8;return function(_0x177299){if(_0x177299){return _0x21a1db[_0x1e87('0x18')](_0x587995)[_0x1e87('0x1a')](_0x177299);}};}function respondWithFilteredResult(_0x4670b0,_0xe8cf20){return function(_0x227a04){if(_0x227a04){var _0x2f3d6f=typeof _0xe8cf20[_0x1e87('0x1b')]===_0x1e87('0x1c')&&typeof _0xe8cf20[_0x1e87('0x1d')]===_0x1e87('0x1c');var _0x2e6b4f=_0x227a04[_0x1e87('0x1e')];var _0x4189a0=_0x2f3d6f?0x0:_0xe8cf20[_0x1e87('0x1b')];var _0xb52e61=_0x2f3d6f?_0x227a04[_0x1e87('0x1e')]:_0xe8cf20['offset']+_0xe8cf20[_0x1e87('0x1d')];var _0x1bc2bb;if(_0xb52e61>=_0x2e6b4f){_0xb52e61=_0x2e6b4f;_0x1bc2bb=0xc8;}else{_0x1bc2bb=0xce;}_0x4670b0[_0x1e87('0x18')](_0x1bc2bb);return _0x4670b0['set']('Content-Range',_0x4189a0+'-'+_0xb52e61+'/'+_0x2e6b4f)[_0x1e87('0x1a')](_0x227a04);}return null;};}function patchUpdates(_0x402c3a){return function(_0x285990){try{jsonpatch[_0x1e87('0x1f')](_0x285990,_0x402c3a,!![]);}catch(_0x5d36fa){return BPromise[_0x1e87('0x20')](_0x5d36fa);}return _0x285990[_0x1e87('0x21')]();};}function saveUpdates(_0x1d551e,_0x2f7e16){return function(_0x3da922){if(_0x3da922){return _0x3da922[_0x1e87('0x22')](_0x1d551e)[_0x1e87('0x23')](function(_0x2f9ca3){return _0x2f9ca3;});}return null;};}function removeEntity(_0xfea4ee,_0x4618a0){return function(_0x2d00ca){if(_0x2d00ca){return _0x2d00ca[_0x1e87('0x24')]()[_0x1e87('0x23')](function(){var _0x4bd3f9=_0x2d00ca['get']({'plain':!![]});var _0x214bf1='IvrCampaigns';return db['UserProfileResource'][_0x1e87('0x24')]({'where':{'type':_0x214bf1,'resourceId':_0x4bd3f9['id']}})[_0x1e87('0x23')](function(){return _0x2d00ca;});})[_0x1e87('0x23')](function(){_0xfea4ee[_0x1e87('0x18')](0xcc)[_0x1e87('0x19')]();});}};}function handleEntityNotFound(_0x407e86,_0x4ba29c){return function(_0x52fed0){if(!_0x52fed0){_0x407e86[_0x1e87('0x17')](0x194);}return _0x52fed0;};}function handleError(_0x5e4e31,_0x11584a){_0x11584a=_0x11584a||0x1f4;return function(_0xdf9eeb){logger[_0x1e87('0x25')](_0xdf9eeb['stack']);if(_0xdf9eeb[_0x1e87('0x26')]){delete _0xdf9eeb[_0x1e87('0x26')];}_0x5e4e31[_0x1e87('0x18')](_0x11584a)[_0x1e87('0x27')](_0xdf9eeb);};}exports[_0x1e87('0x28')]=function(_0x205a60,_0x25d23f){var _0x5a8eac={},_0x204a79={},_0x1845f2={'count':0x0,'rows':[]};var _0x2cb7d9=_[_0x1e87('0x29')](db['Campaign']['rawAttributes'],function(_0x6669d9){return{'name':_0x6669d9[_0x1e87('0x2a')],'type':_0x6669d9[_0x1e87('0x2b')][_0x1e87('0x2c')]};});_0x204a79[_0x1e87('0x2d')]=_[_0x1e87('0x29')](_0x2cb7d9,_0x1e87('0x26'));_0x204a79[_0x1e87('0x2e')]=_[_0x1e87('0x2f')](_0x205a60['query']);_0x204a79[_0x1e87('0x30')]=_[_0x1e87('0x31')](_0x204a79[_0x1e87('0x2d')],_0x204a79[_0x1e87('0x2e')]);_0x5a8eac[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x204a79['model'],qs[_0x1e87('0x33')](_0x205a60[_0x1e87('0x2e')]['fields']));_0x5a8eac[_0x1e87('0x32')]=_0x5a8eac[_0x1e87('0x32')]['length']?_0x5a8eac[_0x1e87('0x32')]:_0x204a79['model'];if(!_0x205a60[_0x1e87('0x2e')][_0x1e87('0x34')](_0x1e87('0x35'))){_0x5a8eac[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x205a60[_0x1e87('0x2e')][_0x1e87('0x1d')]);_0x5a8eac[_0x1e87('0x1b')]=qs['offset'](_0x205a60['query'][_0x1e87('0x1b')]);}_0x5a8eac[_0x1e87('0x36')]=qs[_0x1e87('0x37')](_0x205a60['query'][_0x1e87('0x37')]);_0x5a8eac[_0x1e87('0x38')]=qs[_0x1e87('0x30')](_['pick'](_0x205a60[_0x1e87('0x2e')],_0x204a79[_0x1e87('0x30')]),_0x2cb7d9);if(_0x205a60['query']['filter']){_0x5a8eac['where']=_[_0x1e87('0x39')](_0x5a8eac[_0x1e87('0x38')],{'$or':_['map'](_0x2cb7d9,function(_0x4d97da){if(_0x4d97da[_0x1e87('0x2b')]!==_0x1e87('0x3a')){var _0x3ae83b={};_0x3ae83b[_0x4d97da[_0x1e87('0x26')]]={'$like':'%'+_0x205a60[_0x1e87('0x2e')][_0x1e87('0x3b')]+'%'};return _0x3ae83b;}})});}_0x5a8eac=_[_0x1e87('0x39')]({},_0x5a8eac,_0x205a60[_0x1e87('0x3c')]);var _0x5c7460={'where':_0x5a8eac[_0x1e87('0x38')]};return db[_0x1e87('0x3d')][_0x1e87('0x1e')](_0x5c7460)[_0x1e87('0x23')](function(_0x4b985d){_0x1845f2[_0x1e87('0x1e')]=_0x4b985d;if(_0x205a60[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x5a8eac[_0x1e87('0x3f')]=[{'all':!![]}];}return db[_0x1e87('0x3d')][_0x1e87('0x40')](_0x5a8eac);})[_0x1e87('0x23')](function(_0xb8ec4b){_0x1845f2[_0x1e87('0x41')]=_0xb8ec4b;return _0x1845f2;})[_0x1e87('0x23')](respondWithFilteredResult(_0x25d23f,_0x5a8eac))[_0x1e87('0x42')](handleError(_0x25d23f,null));};exports[_0x1e87('0x43')]=function(_0x5179a0,_0x38b06c){var _0x4b83a6={'raw':![],'where':{'id':_0x5179a0[_0x1e87('0x44')]['id']}},_0x1d285d={};_0x1d285d[_0x1e87('0x2d')]=_['keys'](db[_0x1e87('0x3d')]['rawAttributes']);_0x1d285d['query']=_[_0x1e87('0x2f')](_0x5179a0[_0x1e87('0x2e')]);_0x1d285d[_0x1e87('0x30')]=_[_0x1e87('0x31')](_0x1d285d['model'],_0x1d285d[_0x1e87('0x2e')]);_0x4b83a6['attributes']=_[_0x1e87('0x31')](_0x1d285d[_0x1e87('0x2d')],qs[_0x1e87('0x33')](_0x5179a0[_0x1e87('0x2e')][_0x1e87('0x33')]));_0x4b83a6[_0x1e87('0x32')]=_0x4b83a6['attributes'][_0x1e87('0x45')]?_0x4b83a6[_0x1e87('0x32')]:_0x1d285d[_0x1e87('0x2d')];if(_0x5179a0[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x4b83a6['include']=[{'all':!![]}];}_0x4b83a6=_['merge']({},_0x4b83a6,_0x5179a0[_0x1e87('0x3c')]);return db[_0x1e87('0x3d')][_0x1e87('0x46')](_0x4b83a6)[_0x1e87('0x23')](handleEntityNotFound(_0x38b06c,null))[_0x1e87('0x23')](respondWithResult(_0x38b06c,null))[_0x1e87('0x42')](handleError(_0x38b06c,null));};exports[_0x1e87('0x47')]=function(_0x41eb45,_0x5efd16){return db['Campaign'][_0x1e87('0x47')](_0x41eb45[_0x1e87('0x48')],{})[_0x1e87('0x23')](function(_0x5e3052){var _0x2587b8=_0x41eb45[_0x1e87('0x49')][_0x1e87('0x4a')]({'plain':!![]});if(!_0x2587b8)throw new Error(_0x1e87('0x4b'));if(_0x2587b8[_0x1e87('0x4c')]==='user'){var _0xec8ee4=_0x5e3052[_0x1e87('0x4a')]({'plain':!![]});var _0x266604=_0x1e87('0x4d');return db['UserProfileSection'][_0x1e87('0x46')]({'where':{'name':_0x266604,'userProfileId':_0x2587b8[_0x1e87('0x4e')]},'raw':!![]})[_0x1e87('0x23')](function(_0xae9a75){if(_0xae9a75&&_0xae9a75['autoAssociation']===0x0){return db[_0x1e87('0x4f')][_0x1e87('0x47')]({'name':_0xec8ee4[_0x1e87('0x26')],'resourceId':_0xec8ee4['id'],'type':_0xae9a75['name'],'sectionId':_0xae9a75['id']},{})[_0x1e87('0x23')](function(){return _0x5e3052;});}else{return _0x5e3052;}})[_0x1e87('0x42')](function(_0x468592){logger[_0x1e87('0x25')](_0x1e87('0x50'),_0x468592);throw _0x468592;});}return _0x5e3052;})[_0x1e87('0x23')](respondWithResult(_0x5efd16,0xc9))[_0x1e87('0x42')](handleError(_0x5efd16,null));};exports[_0x1e87('0x51')]=function(_0x1b131b,_0x25889d){var _0xb02af={'where':{'id':_0x1b131b[_0x1e87('0x44')]['id']}},_0x5cd22a={};_0x5cd22a[_0x1e87('0x2d')]=_[_0x1e87('0x2f')](db[_0x1e87('0x3d')]['rawAttributes']);_0xb02af[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x5cd22a[_0x1e87('0x2d')],qs[_0x1e87('0x33')](_0x1b131b[_0x1e87('0x2e')][_0x1e87('0x33')]));_0xb02af[_0x1e87('0x32')]=_0xb02af[_0x1e87('0x32')][_0x1e87('0x45')]?_0xb02af[_0x1e87('0x32')]:_0x5cd22a[_0x1e87('0x2d')];if(_0x1b131b[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0xb02af[_0x1e87('0x3f')]=[{'all':!![]}];}_0xb02af=_['merge']({},_0xb02af,_0x1b131b['options']);return db[_0x1e87('0x3d')][_0x1e87('0x46')](_0xb02af)[_0x1e87('0x23')](handleEntityNotFound(_0x25889d,null))[_0x1e87('0x23')](function(_0x2572c9){if(_0x2572c9){var _0x18da76=_0x2572c9[_0x1e87('0x4a')]({'plain':!![]});_0x18da76=qs['omit'](_0x18da76,['id',_0x1e87('0x52'),_0x1e87('0x53')]);_0x1b131b[_0x1e87('0x48')]=_[_0x1e87('0x54')](_0x1b131b[_0x1e87('0x48')],['id',_0x1e87('0x52'),_0x1e87('0x53')]);return db[_0x1e87('0x3d')][_0x1e87('0x47')](_[_0x1e87('0x39')](_0x18da76,_0x1b131b[_0x1e87('0x48')]),{'include':_0x1b131b[_0x1e87('0x2e')][_0x1e87('0x3e')]?[{'all':!![]}]:undefined})[_0x1e87('0x23')](function(_0x250106){var _0x4229a4=_0x1b131b[_0x1e87('0x49')][_0x1e87('0x4a')]({'plain':!![]});if(!_0x4229a4)throw new Error(_0x1e87('0x4b'));if(_0x4229a4[_0x1e87('0x4c')]===_0x1e87('0x49')){var _0x2f0f80=_0x250106['get']({'plain':!![]});var _0x1903c6=_0x1e87('0x4d');return db[_0x1e87('0x55')][_0x1e87('0x46')]({'where':{'name':_0x1903c6,'userProfileId':_0x4229a4[_0x1e87('0x4e')]},'raw':!![]})[_0x1e87('0x23')](function(_0x37149c){if(_0x37149c&&_0x37149c[_0x1e87('0x56')]===0x0){return db['UserProfileResource'][_0x1e87('0x47')]({'name':_0x2f0f80[_0x1e87('0x26')],'resourceId':_0x2f0f80['id'],'type':_0x37149c['name'],'sectionId':_0x37149c['id']},{})[_0x1e87('0x23')](function(){return _0x250106;});}else{return _0x250106;}})['catch'](function(_0x11310f){logger[_0x1e87('0x25')](_0x1e87('0x50'),_0x11310f);throw _0x11310f;});}return _0x250106;});}})[_0x1e87('0x23')](respondWithResult(_0x25889d,0xc9))[_0x1e87('0x42')](handleError(_0x25889d,null));};exports[_0x1e87('0x22')]=function(_0x43b39e,_0x2c77e6){if(_0x43b39e[_0x1e87('0x48')]['id']){delete _0x43b39e[_0x1e87('0x48')]['id'];}return db[_0x1e87('0x3d')][_0x1e87('0x46')]({'where':{'id':_0x43b39e[_0x1e87('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c77e6,null))['then'](saveUpdates(_0x43b39e[_0x1e87('0x48')],null))[_0x1e87('0x23')](respondWithResult(_0x2c77e6,null))['catch'](handleError(_0x2c77e6,null));};exports[_0x1e87('0x24')]=function(_0x55dde7,_0x3484e3){return db['Campaign'][_0x1e87('0x46')]({'where':{'id':_0x55dde7[_0x1e87('0x44')]['id']}})['then'](handleEntityNotFound(_0x3484e3,null))['then'](removeEntity(_0x3484e3,null))['catch'](handleError(_0x3484e3,null));};exports[_0x1e87('0x57')]=function(_0x17ccbc,_0x3b246b,_0x21e49f){var _0x3a779a={'raw':!![],'where':{}};var _0x4f2c36={};var _0xc52e9f={'count':0x0,'rows':[]};return db[_0x1e87('0x3d')][_0x1e87('0x58')]({'where':{'id':_0x17ccbc[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x3b246b,null))[_0x1e87('0x23')](function(_0x3fa133){if(_0x3fa133){_0x4f2c36[_0x1e87('0x2d')]=_[_0x1e87('0x2f')](db[_0x1e87('0x59')][_0x1e87('0x5a')]);_0x4f2c36[_0x1e87('0x2e')]=_[_0x1e87('0x2f')](_0x17ccbc[_0x1e87('0x2e')]);_0x4f2c36[_0x1e87('0x30')]=_[_0x1e87('0x31')](_0x4f2c36[_0x1e87('0x2d')],_0x4f2c36[_0x1e87('0x2e')]);_0x3a779a['attributes']=_['intersection'](_0x4f2c36[_0x1e87('0x2d')],qs['fields'](_0x17ccbc[_0x1e87('0x2e')]['fields']));_0x3a779a[_0x1e87('0x32')]=_0x3a779a[_0x1e87('0x32')][_0x1e87('0x45')]?_0x3a779a[_0x1e87('0x32')]:_0x4f2c36[_0x1e87('0x2d')];if(!_0x17ccbc[_0x1e87('0x2e')]['hasOwnProperty']('nolimit')){_0x3a779a[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x1d')]);_0x3a779a['offset']=qs[_0x1e87('0x1b')](_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x1b')]);}_0x3a779a[_0x1e87('0x36')]=qs['sort'](_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x37')]);_0x3a779a['where']=qs[_0x1e87('0x30')](_[_0x1e87('0x5b')](_0x17ccbc['query'],_0x4f2c36[_0x1e87('0x30')]));_0x3a779a[_0x1e87('0x38')]['CampaignId']=_0x3fa133['id'];if(_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x3b')]){_0x3a779a[_0x1e87('0x38')]=_[_0x1e87('0x39')](_0x3a779a[_0x1e87('0x38')],{'$or':_[_0x1e87('0x29')](_0x3a779a[_0x1e87('0x32')],function(_0x47fcfe){var _0x1ea0f5={};_0x1ea0f5[_0x47fcfe]={'$like':'%'+_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x3b')]+'%'};return _0x1ea0f5;})});}_0x3a779a=_[_0x1e87('0x39')]({},_0x3a779a,_0x17ccbc['options']);return db[_0x1e87('0x59')][_0x1e87('0x1e')]({'where':_0x3a779a[_0x1e87('0x38')]})['then'](function(_0x4e8736){_0xc52e9f[_0x1e87('0x1e')]=_0x4e8736;if(_0x17ccbc[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x3a779a[_0x1e87('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x1e87('0x40')](_0x3a779a);})[_0x1e87('0x23')](function(_0x15e715){_0xc52e9f[_0x1e87('0x41')]=_0x15e715;return _0xc52e9f;});}})[_0x1e87('0x23')](respondWithFilteredResult(_0x3b246b,_0x3a779a))['catch'](handleError(_0x3b246b,null));};exports[_0x1e87('0x5c')]=function(_0x217e27,_0x269a0d,_0xf66714){var _0x46f802={'raw':!![],'where':{}};var _0x3ea3f6={};var _0x47cd82={'count':0x0,'rows':[]};return db[_0x1e87('0x3d')]['findOne']({'where':{'id':_0x217e27[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x269a0d,null))[_0x1e87('0x23')](function(_0x134afc){if(_0x134afc){_0x3ea3f6['model']=_['keys'](db[_0x1e87('0x5d')][_0x1e87('0x5a')]);_0x3ea3f6[_0x1e87('0x2e')]=_[_0x1e87('0x2f')](_0x217e27[_0x1e87('0x2e')]);_0x3ea3f6['filters']=_[_0x1e87('0x31')](_0x3ea3f6[_0x1e87('0x2d')],_0x3ea3f6['query']);_0x46f802[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x3ea3f6[_0x1e87('0x2d')],qs['fields'](_0x217e27['query'][_0x1e87('0x33')]));_0x46f802[_0x1e87('0x32')]=_0x46f802[_0x1e87('0x32')][_0x1e87('0x45')]?_0x46f802['attributes']:_0x3ea3f6[_0x1e87('0x2d')];if(!_0x217e27[_0x1e87('0x2e')][_0x1e87('0x34')](_0x1e87('0x35'))){_0x46f802[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x217e27[_0x1e87('0x2e')][_0x1e87('0x1d')]);_0x46f802[_0x1e87('0x1b')]=qs[_0x1e87('0x1b')](_0x217e27[_0x1e87('0x2e')][_0x1e87('0x1b')]);}_0x46f802['order']=qs[_0x1e87('0x37')](_0x217e27['query'][_0x1e87('0x37')]);_0x46f802[_0x1e87('0x38')]=qs[_0x1e87('0x30')](_[_0x1e87('0x5b')](_0x217e27['query'],_0x3ea3f6[_0x1e87('0x30')]));_0x46f802[_0x1e87('0x38')][_0x1e87('0x5e')]=_0x134afc['id'];if(_0x217e27['query']['filter']){_0x46f802['where']=_[_0x1e87('0x39')](_0x46f802['where'],{'$or':_[_0x1e87('0x29')](_0x46f802[_0x1e87('0x32')],function(_0x1f3303){var _0x1ce009={};_0x1ce009[_0x1f3303]={'$like':'%'+_0x217e27[_0x1e87('0x2e')][_0x1e87('0x3b')]+'%'};return _0x1ce009;})});}_0x46f802=_[_0x1e87('0x39')]({},_0x46f802,_0x217e27[_0x1e87('0x3c')]);return db[_0x1e87('0x5d')][_0x1e87('0x1e')]({'where':_0x46f802[_0x1e87('0x38')]})[_0x1e87('0x23')](function(_0x206c38){_0x47cd82[_0x1e87('0x1e')]=_0x206c38;if(_0x217e27[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x46f802[_0x1e87('0x3f')]=[{'all':!![]}];}return db[_0x1e87('0x5d')][_0x1e87('0x40')](_0x46f802);})[_0x1e87('0x23')](function(_0x2cd820){_0x47cd82[_0x1e87('0x41')]=_0x2cd820;return _0x47cd82;});}})[_0x1e87('0x23')](respondWithFilteredResult(_0x269a0d,_0x46f802))['catch'](handleError(_0x269a0d,null));};exports[_0x1e87('0x5f')]=function(_0x222902,_0x1dafd8,_0x542556){var _0x57aa62={'raw':!![],'where':{}};var _0x1b7b88={};var _0x3e08cd={'count':0x0,'rows':[]};return db[_0x1e87('0x3d')][_0x1e87('0x58')]({'where':{'id':_0x222902[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x1dafd8,null))['then'](function(_0x4050b4){if(_0x4050b4){_0x1b7b88[_0x1e87('0x2d')]=_[_0x1e87('0x2f')](db[_0x1e87('0x60')]['rawAttributes']);_0x1b7b88['query']=_[_0x1e87('0x2f')](_0x222902[_0x1e87('0x2e')]);_0x1b7b88['filters']=_[_0x1e87('0x31')](_0x1b7b88[_0x1e87('0x2d')],_0x1b7b88[_0x1e87('0x2e')]);_0x57aa62[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x1b7b88[_0x1e87('0x2d')],qs[_0x1e87('0x33')](_0x222902[_0x1e87('0x2e')][_0x1e87('0x33')]));_0x57aa62['attributes']=_0x57aa62['attributes'][_0x1e87('0x45')]?_0x57aa62[_0x1e87('0x32')]:_0x1b7b88[_0x1e87('0x2d')];if(!_0x222902['query']['hasOwnProperty'](_0x1e87('0x35'))){_0x57aa62[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x222902[_0x1e87('0x2e')]['limit']);_0x57aa62[_0x1e87('0x1b')]=qs[_0x1e87('0x1b')](_0x222902[_0x1e87('0x2e')][_0x1e87('0x1b')]);}_0x57aa62[_0x1e87('0x36')]=qs[_0x1e87('0x37')](_0x222902[_0x1e87('0x2e')][_0x1e87('0x37')]);_0x57aa62[_0x1e87('0x38')]=qs[_0x1e87('0x30')](_[_0x1e87('0x5b')](_0x222902['query'],_0x1b7b88[_0x1e87('0x30')]));_0x57aa62['where'][_0x1e87('0x5e')]=_0x4050b4['id'];if(_0x222902[_0x1e87('0x2e')][_0x1e87('0x3b')]){_0x57aa62[_0x1e87('0x38')]=_[_0x1e87('0x39')](_0x57aa62[_0x1e87('0x38')],{'$or':_[_0x1e87('0x29')](_0x57aa62[_0x1e87('0x32')],function(_0x4dbfeb){var _0x579c64={};_0x579c64[_0x4dbfeb]={'$like':'%'+_0x222902[_0x1e87('0x2e')]['filter']+'%'};return _0x579c64;})});}_0x57aa62=_[_0x1e87('0x39')]({},_0x57aa62,_0x222902[_0x1e87('0x3c')]);return db[_0x1e87('0x60')][_0x1e87('0x1e')]({'where':_0x57aa62[_0x1e87('0x38')]})[_0x1e87('0x23')](function(_0x154ea1){_0x3e08cd[_0x1e87('0x1e')]=_0x154ea1;if(_0x222902[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x57aa62[_0x1e87('0x3f')]=[{'all':!![]}];}return db[_0x1e87('0x60')][_0x1e87('0x40')](_0x57aa62);})['then'](function(_0x3b9173){_0x3e08cd[_0x1e87('0x41')]=_0x3b9173;return _0x3e08cd;});}})[_0x1e87('0x23')](respondWithFilteredResult(_0x1dafd8,_0x57aa62))[_0x1e87('0x42')](handleError(_0x1dafd8,null));};exports['getHopperBlacks']=function(_0x1ce24d,_0x48bca2,_0x552e6b){var _0x392ee8={'raw':!![],'where':{}};var _0x55a7ad={};var _0x375c47={'count':0x0,'rows':[]};return db['Campaign'][_0x1e87('0x58')]({'where':{'id':_0x1ce24d['params']['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x48bca2,null))[_0x1e87('0x23')](function(_0x1df522){if(_0x1df522){_0x55a7ad[_0x1e87('0x2d')]=_[_0x1e87('0x2f')](db['CmHopperBlack'][_0x1e87('0x5a')]);_0x55a7ad[_0x1e87('0x2e')]=_[_0x1e87('0x2f')](_0x1ce24d[_0x1e87('0x2e')]);_0x55a7ad[_0x1e87('0x30')]=_[_0x1e87('0x31')](_0x55a7ad[_0x1e87('0x2d')],_0x55a7ad[_0x1e87('0x2e')]);_0x392ee8[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x55a7ad[_0x1e87('0x2d')],qs[_0x1e87('0x33')](_0x1ce24d[_0x1e87('0x2e')]['fields']));_0x392ee8['attributes']=_0x392ee8[_0x1e87('0x32')]['length']?_0x392ee8[_0x1e87('0x32')]:_0x55a7ad[_0x1e87('0x2d')];if(!_0x1ce24d[_0x1e87('0x2e')]['hasOwnProperty'](_0x1e87('0x35'))){_0x392ee8[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x1ce24d['query']['limit']);_0x392ee8[_0x1e87('0x1b')]=qs['offset'](_0x1ce24d[_0x1e87('0x2e')]['offset']);}_0x392ee8[_0x1e87('0x36')]=qs[_0x1e87('0x37')](_0x1ce24d['query'][_0x1e87('0x37')]);_0x392ee8[_0x1e87('0x38')]=qs['filters'](_[_0x1e87('0x5b')](_0x1ce24d[_0x1e87('0x2e')],_0x55a7ad[_0x1e87('0x30')]));_0x392ee8['where'][_0x1e87('0x5e')]=_0x1df522['id'];if(_0x1ce24d[_0x1e87('0x2e')]['filter']){_0x392ee8[_0x1e87('0x38')]=_[_0x1e87('0x39')](_0x392ee8[_0x1e87('0x38')],{'$or':_[_0x1e87('0x29')](_0x392ee8[_0x1e87('0x32')],function(_0x5eb511){var _0x3b97a9={};_0x3b97a9[_0x5eb511]={'$like':'%'+_0x1ce24d[_0x1e87('0x2e')][_0x1e87('0x3b')]+'%'};return _0x3b97a9;})});}_0x392ee8=_[_0x1e87('0x39')]({},_0x392ee8,_0x1ce24d[_0x1e87('0x3c')]);return db[_0x1e87('0x61')][_0x1e87('0x1e')]({'where':_0x392ee8['where']})['then'](function(_0x5029d7){_0x375c47[_0x1e87('0x1e')]=_0x5029d7;if(_0x1ce24d[_0x1e87('0x2e')][_0x1e87('0x3e')]){_0x392ee8[_0x1e87('0x3f')]=[{'all':!![]}];}return db[_0x1e87('0x61')][_0x1e87('0x40')](_0x392ee8);})[_0x1e87('0x23')](function(_0x6ad47a){_0x375c47[_0x1e87('0x41')]=_0x6ad47a;return _0x375c47;});}})[_0x1e87('0x23')](respondWithFilteredResult(_0x48bca2,_0x392ee8))[_0x1e87('0x42')](handleError(_0x48bca2,null));};exports[_0x1e87('0x62')]=function(_0x3844c4,_0x425d18,_0x4e9310){var _0x2721af={};var _0x2dc610={};var _0x551394;var _0x1ecb9b;return db[_0x1e87('0x3d')]['findOne']({'where':{'id':_0x3844c4[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x425d18,null))['then'](function(_0x3a204e){if(_0x3a204e){_0x551394=_0x3a204e;_0x2dc610[_0x1e87('0x2d')]=_['keys'](db[_0x1e87('0x63')][_0x1e87('0x5a')]);_0x2dc610[_0x1e87('0x2e')]=_[_0x1e87('0x2f')](_0x3844c4[_0x1e87('0x2e')]);_0x2dc610[_0x1e87('0x30')]=_[_0x1e87('0x31')](_0x2dc610[_0x1e87('0x2d')],_0x2dc610[_0x1e87('0x2e')]);_0x2721af['attributes']=_[_0x1e87('0x31')](_0x2dc610[_0x1e87('0x2d')],qs[_0x1e87('0x33')](_0x3844c4[_0x1e87('0x2e')][_0x1e87('0x33')]));_0x2721af[_0x1e87('0x32')]=_0x2721af[_0x1e87('0x32')]['length']?_0x2721af['attributes']:_0x2dc610[_0x1e87('0x2d')];_0x2721af[_0x1e87('0x36')]=qs[_0x1e87('0x37')](_0x3844c4[_0x1e87('0x2e')]['sort']);_0x2721af['where']=qs[_0x1e87('0x30')](_[_0x1e87('0x5b')](_0x3844c4['query'],_0x2dc610['filters']));if(_0x3844c4[_0x1e87('0x2e')]['filter']){_0x2721af['where']=_['merge'](_0x2721af[_0x1e87('0x38')],{'$or':_[_0x1e87('0x29')](_0x2721af['attributes'],function(_0x218d19){var _0x1b0b76={};_0x1b0b76[_0x218d19]={'$like':'%'+_0x3844c4[_0x1e87('0x2e')][_0x1e87('0x3b')]+'%'};return _0x1b0b76;})});}_0x2721af=_[_0x1e87('0x39')]({},_0x2721af,_0x3844c4[_0x1e87('0x3c')]);return _0x551394[_0x1e87('0x62')](_0x2721af);}})[_0x1e87('0x23')](function(_0x3919ce){if(_0x3919ce){_0x1ecb9b=_0x3919ce[_0x1e87('0x45')];if(!_0x3844c4[_0x1e87('0x2e')][_0x1e87('0x34')](_0x1e87('0x35'))){_0x2721af[_0x1e87('0x1d')]=qs[_0x1e87('0x1d')](_0x3844c4[_0x1e87('0x2e')]['limit']);_0x2721af[_0x1e87('0x1b')]=qs[_0x1e87('0x1b')](_0x3844c4[_0x1e87('0x2e')][_0x1e87('0x1b')]);}return _0x551394['getLists'](_0x2721af);}})[_0x1e87('0x23')](function(_0x1b81eb){if(_0x1b81eb){return _0x1b81eb?{'count':_0x1ecb9b,'rows':_0x1b81eb}:null;}})['then'](respondWithResult(_0x425d18,null))[_0x1e87('0x42')](handleError(_0x425d18,null));};exports[_0x1e87('0x64')]=function(_0x54c7ba,_0x389c64,_0x3669b5){var _0x4045e9,_0xc4bd5e;return db[_0x1e87('0x3d')][_0x1e87('0x46')]({'where':{'id':_0x54c7ba[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x389c64,null))[_0x1e87('0x23')](function(_0x79a352){if(_0x79a352){_0xc4bd5e=_0x79a352;return _0x79a352[_0x1e87('0x64')](_0x54c7ba[_0x1e87('0x48')][_0x1e87('0x65')],_['omit'](_0x54c7ba[_0x1e87('0x48')],[_0x1e87('0x65'),'id'])||{});}return null;})[_0x1e87('0x66')](function(_0x1fdb6c){var _0x295a8b;_0x4045e9=_0x1fdb6c||[];var _0x2e70fa=[];if(_0x1fdb6c){for(var _0x486415=0x0;_0x486415<_0x1fdb6c['length'];_0x486415+=0x1){var _0x5ee3d0=_0x1fdb6c[_0x486415][_0x1e87('0x4a')]({'plain':!![]});_0xc4bd5e[_0x1e87('0x67')]=_0x54c7ba[_0x1e87('0x48')][_0x1e87('0x67')]?_0x54c7ba[_0x1e87('0x48')][_0x1e87('0x67')]:_0xc4bd5e[_0x1e87('0x67')];switch(_0xc4bd5e['dialCheckDuplicateType']){case _0x1e87('0x68'):_0x295a8b=squel[_0x1e87('0x69')]()[_0x1e87('0x6a')](_0x1e87('0x6b'))[_0x1e87('0x6c')]([_0x1e87('0x6d'),'scheduledAt','ContactId',_0x1e87('0x6e'),_0x1e87('0x5e'),_0x1e87('0x52'),'updatedAt'],squel[_0x1e87('0x6f')]()[_0x1e87('0x70')](_0x1e87('0x6d'),_0x1e87('0x6d'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x72'))[_0x1e87('0x70')]('id',_0x1e87('0x73'))[_0x1e87('0x70')](_0x5ee3d0[_0x1e87('0x74')][_0x1e87('0x75')](),'ListId')['field'](_0x54c7ba[_0x1e87('0x44')]['id'][_0x1e87('0x75')](),_0x1e87('0x5e'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x52'))[_0x1e87('0x70')](_0x1e87('0x71'),'updatedAt')[_0x1e87('0x76')](_0x1e87('0x77'))['where']('deletedAt\x20IS\x20NULL')[_0x1e87('0x38')]('ListId\x20=\x20?',_0x5ee3d0[_0x1e87('0x74')][_0x1e87('0x75')]())[_0x1e87('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x1e87('0x38')](_0x1e87('0x78'),squel['select']()[_0x1e87('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x1e87('0x76')](_0x1e87('0x79'))[_0x1e87('0x38')](_0x1e87('0x7a'),_0x54c7ba[_0x1e87('0x44')]['id'][_0x1e87('0x75')]()))['where'](_0x1e87('0x78'),squel[_0x1e87('0x6f')]()[_0x1e87('0x70')](_0x1e87('0x7b'))[_0x1e87('0x76')](_0x1e87('0x6b'))[_0x1e87('0x38')](_0x1e87('0x7a'),_0x54c7ba[_0x1e87('0x44')]['id'][_0x1e87('0x75')]())))[_0x1e87('0x75')]();break;case _0x1e87('0x7c'):_0x295a8b=squel[_0x1e87('0x69')]()['into'](_0x1e87('0x6b'))['fromQuery']([_0x1e87('0x6d'),_0x1e87('0x72'),_0x1e87('0x73'),'ListId',_0x1e87('0x5e'),_0x1e87('0x52'),_0x1e87('0x53')],squel[_0x1e87('0x6f')]()[_0x1e87('0x70')](_0x1e87('0x6d'),_0x1e87('0x6d'))[_0x1e87('0x70')]('NOW()',_0x1e87('0x72'))[_0x1e87('0x70')]('id',_0x1e87('0x73'))[_0x1e87('0x70')](_0x5ee3d0[_0x1e87('0x74')][_0x1e87('0x75')](),_0x1e87('0x6e'))[_0x1e87('0x70')](_0x54c7ba['params']['id'][_0x1e87('0x75')](),_0x1e87('0x5e'))['field'](_0x1e87('0x71'),'createdAt')[_0x1e87('0x70')](_0x1e87('0x71'),'updatedAt')[_0x1e87('0x76')]('cm_contacts')[_0x1e87('0x38')](_0x1e87('0x7d'))['where']('ListId\x20=\x20?',_0x5ee3d0[_0x1e87('0x74')][_0x1e87('0x75')]())[_0x1e87('0x38')](_0x1e87('0x7e'))['where'](_0x1e87('0x78'),squel['select']()[_0x1e87('0x70')](_0x1e87('0x7b'))[_0x1e87('0x76')](_0x1e87('0x6b'))[_0x1e87('0x38')]('CampaignId\x20=\x20?',_0x54c7ba[_0x1e87('0x44')]['id'][_0x1e87('0x75')]())))[_0x1e87('0x75')]();break;default:_0x295a8b=squel[_0x1e87('0x69')]()[_0x1e87('0x6a')]('cm_hopper')[_0x1e87('0x6c')]([_0x1e87('0x6d'),_0x1e87('0x72'),_0x1e87('0x73'),_0x1e87('0x6e'),_0x1e87('0x5e'),_0x1e87('0x52'),_0x1e87('0x53')],squel[_0x1e87('0x6f')]()['field']('phone',_0x1e87('0x6d'))[_0x1e87('0x70')](_0x1e87('0x71'),'scheduledAt')['field']('id',_0x1e87('0x73'))[_0x1e87('0x70')](_0x5ee3d0[_0x1e87('0x74')][_0x1e87('0x75')](),_0x1e87('0x6e'))[_0x1e87('0x70')](_0x54c7ba[_0x1e87('0x44')]['id']['toString'](),_0x1e87('0x5e'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x52'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x53'))[_0x1e87('0x76')]('cm_contacts')[_0x1e87('0x38')](_0x1e87('0x7d'))[_0x1e87('0x38')](_0x1e87('0x7f'),_0x5ee3d0['CmListId']['toString']())[_0x1e87('0x38')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2e70fa[_0x1e87('0x80')](db[_0x1e87('0x81')][_0x1e87('0x2e')](_0x295a8b));}return BPromise[_0x1e87('0x82')](_0x2e70fa);}})[_0x1e87('0x23')](function(){return _0x4045e9;})[_0x1e87('0x23')](respondWithResult(_0x389c64,null))[_0x1e87('0x42')](handleError(_0x389c64,null));};exports[_0x1e87('0x83')]=function(_0x2371dc,_0x4c2a74,_0x1b5013){return db['Campaign'][_0x1e87('0x46')]({'where':{'id':_0x2371dc[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x4c2a74,null))[_0x1e87('0x23')](function(_0x362b1b){if(_0x362b1b){return _0x362b1b['removeLists'](_0x2371dc[_0x1e87('0x2e')][_0x1e87('0x65')]);}})['then'](function(_0x26f245){if(_0x26f245){return db['CmHopper']['destroy']({'where':{'ListId':_0x2371dc[_0x1e87('0x2e')][_0x1e87('0x65')],'CampaignId':_0x2371dc[_0x1e87('0x44')]['id']}})['then'](function(){return _0x26f245;});}})['then'](respondWithStatusCode(_0x4c2a74,null))['catch'](handleError(_0x4c2a74,null));};exports['getBlackLists']=function(_0x5b1e4d,_0x205d05,_0x450245){var _0x334411={};var _0x42342c={};var _0x1ab3e8;var _0x33c27a;return db[_0x1e87('0x3d')][_0x1e87('0x58')]({'where':{'id':_0x5b1e4d[_0x1e87('0x44')]['id']}})['then'](handleEntityNotFound(_0x205d05,null))[_0x1e87('0x23')](function(_0x11507e){if(_0x11507e){_0x1ab3e8=_0x11507e;_0x42342c[_0x1e87('0x2d')]=_[_0x1e87('0x2f')](db[_0x1e87('0x63')][_0x1e87('0x5a')]);_0x42342c[_0x1e87('0x2e')]=_['keys'](_0x5b1e4d[_0x1e87('0x2e')]);_0x42342c['filters']=_[_0x1e87('0x31')](_0x42342c[_0x1e87('0x2d')],_0x42342c['query']);_0x334411[_0x1e87('0x32')]=_[_0x1e87('0x31')](_0x42342c['model'],qs[_0x1e87('0x33')](_0x5b1e4d[_0x1e87('0x2e')]['fields']));_0x334411[_0x1e87('0x32')]=_0x334411[_0x1e87('0x32')][_0x1e87('0x45')]?_0x334411['attributes']:_0x42342c['model'];_0x334411[_0x1e87('0x36')]=qs[_0x1e87('0x37')](_0x5b1e4d[_0x1e87('0x2e')]['sort']);_0x334411[_0x1e87('0x38')]=qs['filters'](_[_0x1e87('0x5b')](_0x5b1e4d[_0x1e87('0x2e')],_0x42342c[_0x1e87('0x30')]));if(_0x5b1e4d[_0x1e87('0x2e')][_0x1e87('0x3b')]){_0x334411[_0x1e87('0x38')]=_[_0x1e87('0x39')](_0x334411[_0x1e87('0x38')],{'$or':_[_0x1e87('0x29')](_0x334411[_0x1e87('0x32')],function(_0x424630){var _0x404cf5={};_0x404cf5[_0x424630]={'$like':'%'+_0x5b1e4d['query']['filter']+'%'};return _0x404cf5;})});}_0x334411=_[_0x1e87('0x39')]({},_0x334411,_0x5b1e4d[_0x1e87('0x3c')]);return _0x1ab3e8[_0x1e87('0x84')](_0x334411);}})[_0x1e87('0x23')](function(_0x4b89dc){if(_0x4b89dc){_0x33c27a=_0x4b89dc[_0x1e87('0x45')];if(!_0x5b1e4d[_0x1e87('0x2e')]['hasOwnProperty'](_0x1e87('0x35'))){_0x334411['limit']=qs['limit'](_0x5b1e4d['query'][_0x1e87('0x1d')]);_0x334411[_0x1e87('0x1b')]=qs[_0x1e87('0x1b')](_0x5b1e4d[_0x1e87('0x2e')]['offset']);}return _0x1ab3e8[_0x1e87('0x84')](_0x334411);}})[_0x1e87('0x23')](function(_0x504a54){if(_0x504a54){return _0x504a54?{'count':_0x33c27a,'rows':_0x504a54}:null;}})[_0x1e87('0x23')](respondWithResult(_0x205d05,null))[_0x1e87('0x42')](handleError(_0x205d05,null));};exports[_0x1e87('0x85')]=function(_0x4da2cf,_0x2931fe,_0x3fb74c){var _0x13a4f8,_0x44db66;return db[_0x1e87('0x3d')]['find']({'where':{'id':_0x4da2cf['params']['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x2931fe,null))['then'](function(_0xe04d6d){if(_0xe04d6d){_0x44db66=_0xe04d6d;return _0xe04d6d['addBlackLists'](_0x4da2cf[_0x1e87('0x48')][_0x1e87('0x65')],_[_0x1e87('0x54')](_0x4da2cf[_0x1e87('0x48')],['ids','id'])||{});}return null;})[_0x1e87('0x66')](function(_0x3d473a){var _0x154dbc;_0x13a4f8=_0x3d473a||[];var _0x26c250=[];if(_0x3d473a){for(var _0x3856c4=0x0;_0x3856c4<_0x3d473a[_0x1e87('0x45')];_0x3856c4+=0x1){var _0xe0db5d=_0x3d473a[_0x3856c4]['get']({'plain':!![]});_0x154dbc=squel[_0x1e87('0x69')]()[_0x1e87('0x6a')](_0x1e87('0x86'))[_0x1e87('0x6c')]([_0x1e87('0x6d'),_0x1e87('0x73'),_0x1e87('0x6e'),_0x1e87('0x5e'),_0x1e87('0x52'),_0x1e87('0x53')],squel[_0x1e87('0x6f')]()['field']('phone',_0x1e87('0x6d'))[_0x1e87('0x70')]('id',_0x1e87('0x73'))[_0x1e87('0x70')](_0xe0db5d[_0x1e87('0x74')]['toString'](),_0x1e87('0x6e'))[_0x1e87('0x70')](_0x4da2cf[_0x1e87('0x44')]['id'][_0x1e87('0x75')](),_0x1e87('0x5e'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x52'))[_0x1e87('0x70')](_0x1e87('0x71'),_0x1e87('0x53'))['from'](_0x1e87('0x77'))[_0x1e87('0x38')](_0x1e87('0x7d'))[_0x1e87('0x38')](_0x1e87('0x7f'),_0xe0db5d[_0x1e87('0x74')][_0x1e87('0x75')]())[_0x1e87('0x38')](_0x1e87('0x7e')))[_0x1e87('0x75')]();_0x26c250['push'](db[_0x1e87('0x81')][_0x1e87('0x2e')](_0x154dbc));}return BPromise[_0x1e87('0x82')](_0x26c250);}})[_0x1e87('0x23')](function(){return _0x13a4f8;})[_0x1e87('0x23')](respondWithResult(_0x2931fe,null))[_0x1e87('0x42')](handleError(_0x2931fe,null));};exports[_0x1e87('0x87')]=function(_0x3e62b7,_0x3d8579,_0x5ea5b6){return db[_0x1e87('0x3d')][_0x1e87('0x46')]({'where':{'id':_0x3e62b7['params']['id']}})[_0x1e87('0x23')](handleEntityNotFound(_0x3d8579,null))[_0x1e87('0x23')](function(_0x1fc057){if(_0x1fc057){return _0x1fc057[_0x1e87('0x87')](_0x3e62b7[_0x1e87('0x2e')]['ids']);}})[_0x1e87('0x23')](function(_0x285f06){if(_0x285f06){return db[_0x1e87('0x61')][_0x1e87('0x24')]({'where':{'ListId':_0x3e62b7[_0x1e87('0x2e')][_0x1e87('0x65')],'CampaignId':_0x3e62b7[_0x1e87('0x44')]['id']}})[_0x1e87('0x23')](function(){return _0x285f06;});}})[_0x1e87('0x23')](respondWithStatusCode(_0x3d8579,null))[_0x1e87('0x42')](handleError(_0x3d8579,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9014d89..38929be 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0x7a54,0x106));var _0x47a5=function(_0x2c432b,_0x207ea1){_0x2c432b=_0x2c432b-0x0;var _0x20db52=_0x7a54[_0x2c432b];return _0x20db52;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index be49131..2224f82 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 _0x9ef8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x9ef8,0x17f));var _0x89ef=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x9ef8[_0x3a2e49];return _0x257140;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var moment=require('moment');var BPromise=require(_0x89ef('0x2'));var rs=require(_0x89ef('0x3'));var fs=require('fs');var Redis=require(_0x89ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ef('0x5'));var logger=require(_0x89ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x89ef('0x7')][_0x89ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24439e,_0x90b5bf,_0x46c0da){return new BPromise(function(_0x373288,_0x16e8c3){return client[_0x89ef('0x9')](_0x24439e,_0x46c0da)[_0x89ef('0xa')](function(_0x5683b6){logger[_0x89ef('0xb')](_0x89ef('0xc'),_0x90b5bf,_0x89ef('0xd'));logger['debug'](_0x89ef('0xe'),_0x90b5bf,_0x89ef('0xd'),JSON[_0x89ef('0xf')](_0x5683b6));if(_0x5683b6[_0x89ef('0x10')]){if(_0x5683b6[_0x89ef('0x10')]['code']===0x1f4){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x16e8c3(_0x5683b6['error'][_0x89ef('0x11')]);}logger[_0x89ef('0x10')](_0x89ef('0xc'),_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x373288(_0x5683b6['error'][_0x89ef('0x11')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x89ef('0xd'));_0x373288(_0x5683b6[_0x89ef('0x12')]['message']);}})[_0x89ef('0x13')](function(_0x490877){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x490877);_0x16e8c3(_0x490877);});});}exports[_0x89ef('0x14')]=function(_0x2c5f51){var _0x2aa140=this;return new Promise(function(_0x1189d7,_0x5e3aed){return db[_0x89ef('0x15')][_0x89ef('0x16')]({'raw':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x18')]===undefined?!![]:![]:!![],'where':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x19')]||null:null,'attributes':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1a')]||null:null,'limit':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1b')]||null:null,'include':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1c')]?_['map'](_0x2c5f51['options']['include'],function(_0x5c9242){return{'model':db[_0x5c9242[_0x89ef('0x1d')]],'as':_0x5c9242['as'],'attributes':_0x5c9242[_0x89ef('0x1a')],'include':_0x5c9242['include']?_['map'](_0x5c9242[_0x89ef('0x1c')],function(_0x10bb22){return{'model':db[_0x10bb22['model']],'as':_0x10bb22['as'],'attributes':_0x10bb22['attributes'],'include':_0x10bb22[_0x89ef('0x1c')]?_[_0x89ef('0x1e')](_0x10bb22[_0x89ef('0x1c')],function(_0x3efb34){return{'model':db[_0x3efb34[_0x89ef('0x1d')]],'as':_0x3efb34['as'],'attributes':_0x3efb34[_0x89ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x89ef('0xa')](function(_0x5e8108){logger[_0x89ef('0xb')](_0x89ef('0x14'),_0x2c5f51);logger[_0x89ef('0x1f')](_0x89ef('0x14'),_0x2c5f51,JSON['stringify'](_0x5e8108));_0x1189d7(_0x5e8108);})['catch'](function(_0x51245a){logger[_0x89ef('0x10')](_0x89ef('0x14'),_0x51245a['message'],_0x2c5f51);_0x5e3aed(_0x2aa140[_0x89ef('0x10')](0x1f4,_0x51245a[_0x89ef('0x11')]));});});}; \ No newline at end of file +var _0x3b75=['error','code','message','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15b605,_0x312fe1){var _0x3d0bf2=function(_0x1dbfc8){while(--_0x1dbfc8){_0x15b605['push'](_0x15b605['shift']());}};_0x3d0bf2(++_0x312fe1);}(_0x3b75,0xdc));var _0x53b7=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0x3b75[_0x152aa1];return _0x1bc01a;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var moment=require(_0x53b7('0x2'));var BPromise=require(_0x53b7('0x3'));var rs=require(_0x53b7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53b7('0x6'))('rpc');var config=require(_0x53b7('0x7'));var jayson=require(_0x53b7('0x8'));var client=jayson[_0x53b7('0x9')][_0x53b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e5139,_0x5ee630,_0x1f89b7){return new BPromise(function(_0x233482,_0x4275fe){return client['request'](_0x7e5139,_0x1f89b7)[_0x53b7('0xb')](function(_0x4b7c51){logger[_0x53b7('0xc')](_0x53b7('0xd'),_0x5ee630,_0x53b7('0xe'));logger[_0x53b7('0xf')](_0x53b7('0x10'),_0x5ee630,'request\x20sent',JSON[_0x53b7('0x11')](_0x4b7c51));if(_0x4b7c51[_0x53b7('0x12')]){if(_0x4b7c51[_0x53b7('0x12')][_0x53b7('0x13')]===0x1f4){logger[_0x53b7('0x12')](_0x53b7('0xd'),_0x5ee630,_0x4b7c51[_0x53b7('0x12')][_0x53b7('0x14')]);return _0x4275fe(_0x4b7c51[_0x53b7('0x12')]['message']);}logger[_0x53b7('0x12')](_0x53b7('0xd'),_0x5ee630,_0x4b7c51['error']['message']);return _0x233482(_0x4b7c51['error'][_0x53b7('0x14')]);}else{logger[_0x53b7('0xc')](_0x53b7('0xd'),_0x5ee630,'request\x20sent');_0x233482(_0x4b7c51[_0x53b7('0x15')][_0x53b7('0x14')]);}})[_0x53b7('0x16')](function(_0xe4cb1){logger[_0x53b7('0x12')](_0x53b7('0xd'),_0x5ee630,_0xe4cb1);_0x4275fe(_0xe4cb1);});});}exports['GetCampaign']=function(_0x4eaf6a){var _0x19b100=this;return new Promise(function(_0x45b608,_0x3a049f){return db[_0x53b7('0x17')][_0x53b7('0x18')]({'raw':_0x4eaf6a[_0x53b7('0x19')]?_0x4eaf6a[_0x53b7('0x19')][_0x53b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x4eaf6a[_0x53b7('0x19')]?_0x4eaf6a['options'][_0x53b7('0x1b')]||null:null,'attributes':_0x4eaf6a[_0x53b7('0x19')]?_0x4eaf6a[_0x53b7('0x19')][_0x53b7('0x1c')]||null:null,'limit':_0x4eaf6a[_0x53b7('0x19')]?_0x4eaf6a[_0x53b7('0x19')][_0x53b7('0x1d')]||null:null,'include':_0x4eaf6a[_0x53b7('0x19')]?_0x4eaf6a[_0x53b7('0x19')][_0x53b7('0x1e')]?_[_0x53b7('0x1f')](_0x4eaf6a[_0x53b7('0x19')]['include'],function(_0x41706f){return{'model':db[_0x41706f['model']],'as':_0x41706f['as'],'attributes':_0x41706f[_0x53b7('0x1c')],'include':_0x41706f[_0x53b7('0x1e')]?_['map'](_0x41706f['include'],function(_0x9f699d){return{'model':db[_0x9f699d[_0x53b7('0x20')]],'as':_0x9f699d['as'],'attributes':_0x9f699d[_0x53b7('0x1c')],'include':_0x9f699d[_0x53b7('0x1e')]?_['map'](_0x9f699d[_0x53b7('0x1e')],function(_0x465d87){return{'model':db[_0x465d87[_0x53b7('0x20')]],'as':_0x465d87['as'],'attributes':_0x465d87[_0x53b7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x53b7('0xb')](function(_0x39d382){logger['info'](_0x53b7('0x21'),_0x4eaf6a);logger[_0x53b7('0xf')](_0x53b7('0x21'),_0x4eaf6a,JSON[_0x53b7('0x11')](_0x39d382));_0x45b608(_0x39d382);})[_0x53b7('0x16')](function(_0x1024b5){logger[_0x53b7('0x12')](_0x53b7('0x21'),_0x1024b5[_0x53b7('0x14')],_0x4eaf6a);_0x3a049f(_0x19b100[_0x53b7('0x12')](0x1f4,_0x1024b5[_0x53b7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 54a7fa4..543848d 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 _0xde9d=['/:id/blacklists','post','create','/:id/clone','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var path=require(_0xdde9('0x2'));var timeout=require(_0xdde9('0x3'));var express=require(_0xdde9('0x4'));var router=express['Router']();var fs_extra=require(_0xdde9('0x5'));var auth=require(_0xdde9('0x6'));var interaction=require(_0xdde9('0x7'));var config=require('../../config/environment');var controller=require(_0xdde9('0x8'));router[_0xdde9('0x9')]('/',auth[_0xdde9('0xa')](),controller['index']);router[_0xdde9('0x9')](_0xdde9('0xb'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xc')]);router[_0xdde9('0x9')]('/:id/hoppers',auth[_0xdde9('0xa')](),controller['getHoppers']);router['get'](_0xdde9('0xd'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xe')]);router['get'](_0xdde9('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xdde9('0x9')](_0xdde9('0x10'),auth[_0xdde9('0xa')](),controller['getHopperBlacks']);router['get'](_0xdde9('0x11'),auth[_0xdde9('0xa')](),controller['getLists']);router['get'](_0xdde9('0x12'),auth[_0xdde9('0xa')](),controller['getBlackLists']);router[_0xdde9('0x13')]('/',auth[_0xdde9('0xa')](),controller[_0xdde9('0x14')]);router['post'](_0xdde9('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xdde9('0x13')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0xdde9('0x13')](_0xdde9('0x12'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x16')]);router[_0xdde9('0x17')](_0xdde9('0xb'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x18')]);router[_0xdde9('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xdde9('0x1a')]);router[_0xdde9('0x19')](_0xdde9('0x11'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x1b')]);router[_0xdde9('0x19')](_0xdde9('0x12'),auth['isAuthenticated'](),controller[_0xdde9('0x1c')]);module[_0xdde9('0x1d')]=router; \ No newline at end of file +var _0xa62c=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','create','clone','post','addLists','addBlackLists','put','update','delete','destroy','/:id/blacklists','removeBlackLists','exports','multer','util'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xa62c,0x70));var _0xca62=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xa62c[_0x3c22e0];return _0x215811;};'use strict';var multer=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var path=require(_0xca62('0x2'));var timeout=require(_0xca62('0x3'));var express=require(_0xca62('0x4'));var router=express[_0xca62('0x5')]();var fs_extra=require(_0xca62('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xca62('0x7'));var config=require(_0xca62('0x8'));var controller=require(_0xca62('0x9'));router[_0xca62('0xa')]('/',auth[_0xca62('0xb')](),controller[_0xca62('0xc')]);router[_0xca62('0xa')](_0xca62('0xd'),auth['isAuthenticated'](),controller[_0xca62('0xe')]);router[_0xca62('0xa')](_0xca62('0xf'),auth['isAuthenticated'](),controller[_0xca62('0x10')]);router[_0xca62('0xa')](_0xca62('0x11'),auth['isAuthenticated'](),controller[_0xca62('0x12')]);router[_0xca62('0xa')](_0xca62('0x13'),auth[_0xca62('0xb')](),controller[_0xca62('0x14')]);router[_0xca62('0xa')](_0xca62('0x15'),auth[_0xca62('0xb')](),controller[_0xca62('0x16')]);router['get'](_0xca62('0x17'),auth[_0xca62('0xb')](),controller[_0xca62('0x18')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xca62('0x19')]);router['post']('/',auth[_0xca62('0xb')](),controller[_0xca62('0x1a')]);router['post']('/:id/clone',auth[_0xca62('0xb')](),controller[_0xca62('0x1b')]);router[_0xca62('0x1c')]('/:id/lists',auth[_0xca62('0xb')](),controller[_0xca62('0x1d')]);router[_0xca62('0x1c')]('/:id/blacklists',auth[_0xca62('0xb')](),controller[_0xca62('0x1e')]);router[_0xca62('0x1f')](_0xca62('0xd'),auth[_0xca62('0xb')](),controller[_0xca62('0x20')]);router[_0xca62('0x21')](_0xca62('0xd'),auth[_0xca62('0xb')](),controller[_0xca62('0x22')]);router[_0xca62('0x21')](_0xca62('0x17'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0xca62('0x23'),auth[_0xca62('0xb')](),controller[_0xca62('0x24')]);module[_0xca62('0x25')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index abe2b7b..32124f3 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 _0x2f16=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x4b956e,_0x2d53d8){var _0x31037a=function(_0x291113){while(--_0x291113){_0x4b956e['push'](_0x4b956e['shift']());}};_0x31037a(++_0x2d53d8);}(_0x2f16,0x165));var _0x62f1=function(_0x4201b9,_0x112d90){_0x4201b9=_0x4201b9-0x0;var _0x4fc0a2=_0x2f16[_0x4201b9];return _0x4fc0a2;};'use strict';var Sequelize=require(_0x62f1('0x0'));module['exports']={'key':{'type':Sequelize[_0x62f1('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x62f1('0x1')]},'name':{'type':Sequelize[_0x62f1('0x2')],'get':function(){return this[_0x62f1('0x3')](_0x62f1('0x4'));}}}; \ No newline at end of file +var _0xe98f=['TEXT','VIRTUAL','exports'];(function(_0x5900b6,_0x542703){var _0x33347b=function(_0x4971d6){while(--_0x4971d6){_0x5900b6['push'](_0x5900b6['shift']());}};_0x33347b(++_0x542703);}(_0xe98f,0x9b));var _0xfe98=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe98f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xfe98('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xfe98('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xfe98('0x2')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c0c8e69..b17853f 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 _0x6351=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','CannedAnswer','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf'];(function(_0x1a4835,_0x540d39){var _0x4361ac=function(_0x3698d1){while(--_0x3698d1){_0x1a4835['push'](_0x1a4835['shift']());}};_0x4361ac(++_0x540d39);}(_0x6351,0x1c1));var _0x1635=function(_0x440236,_0x3701a4){_0x440236=_0x440236-0x0;var _0x508192=_0x6351[_0x440236];return _0x508192;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1635('0x0'));var zipdir=require(_0x1635('0x1'));var jsonpatch=require(_0x1635('0x2'));var rp=require(_0x1635('0x3'));var moment=require('moment');var BPromise=require(_0x1635('0x4'));var Mustache=require(_0x1635('0x5'));var util=require(_0x1635('0x6'));var path=require('path');var sox=require(_0x1635('0x7'));var csv=require(_0x1635('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1635('0x9'));var squel=require(_0x1635('0xa'));var crypto=require(_0x1635('0xb'));var jsforce=require(_0x1635('0xc'));var deskjs=require(_0x1635('0xd'));var toCsv=require(_0x1635('0x8'));var querystring=require('querystring');var Papa=require(_0x1635('0xe'));var Redis=require(_0x1635('0xf'));var authService=require(_0x1635('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1635('0x11'));var hardwareService=require(_0x1635('0x12'));var logger=require(_0x1635('0x13'))(_0x1635('0x14'));var utils=require(_0x1635('0x15'));var config=require(_0x1635('0x16'));var licenseUtil=require(_0x1635('0x17'));var db=require(_0x1635('0x18'))['db'];function respondWithStatusCode(_0x3c64c3,_0x543f56){_0x543f56=_0x543f56||0xcc;return function(_0x455795){if(_0x455795){return _0x3c64c3['sendStatus'](_0x543f56);}return _0x3c64c3[_0x1635('0x19')](_0x543f56)['end']();};}function respondWithResult(_0x370156,_0x15d7ae){_0x15d7ae=_0x15d7ae||0xc8;return function(_0x23303f){if(_0x23303f){return _0x370156[_0x1635('0x19')](_0x15d7ae)[_0x1635('0x1a')](_0x23303f);}};}function respondWithFilteredResult(_0xa2e589,_0x5353ec){return function(_0x2ede43){if(_0x2ede43){var _0x2532bb=typeof _0x5353ec['offset']==='undefined'&&typeof _0x5353ec['limit']===_0x1635('0x1b');var _0x12bf76=_0x2ede43[_0x1635('0x1c')];var _0x5c37ce=_0x2532bb?0x0:_0x5353ec[_0x1635('0x1d')];var _0x1611a0=_0x2532bb?_0x2ede43[_0x1635('0x1c')]:_0x5353ec['offset']+_0x5353ec[_0x1635('0x1e')];var _0x1186e0;if(_0x1611a0>=_0x12bf76){_0x1611a0=_0x12bf76;_0x1186e0=0xc8;}else{_0x1186e0=0xce;}_0xa2e589['status'](_0x1186e0);return _0xa2e589[_0x1635('0x1f')](_0x1635('0x20'),_0x5c37ce+'-'+_0x1611a0+'/'+_0x12bf76)[_0x1635('0x1a')](_0x2ede43);}return null;};}function patchUpdates(_0x2bc4fc){return function(_0x5eb351){try{jsonpatch['apply'](_0x5eb351,_0x2bc4fc,!![]);}catch(_0x5d9b3){return BPromise[_0x1635('0x21')](_0x5d9b3);}return _0x5eb351[_0x1635('0x22')]();};}function saveUpdates(_0x31f53c,_0x34bc44){return function(_0xc08892){if(_0xc08892){return _0xc08892[_0x1635('0x23')](_0x31f53c)[_0x1635('0x24')](function(_0x491a07){return _0x491a07;});}return null;};}function removeEntity(_0x5c2e94,_0x453a9b){return function(_0x51c54c){if(_0x51c54c){return _0x51c54c[_0x1635('0x25')]()[_0x1635('0x24')](function(){var _0x58a8a1=_0x51c54c[_0x1635('0x26')]({'plain':!![]});var _0x3e8565=_0x1635('0x27');return db[_0x1635('0x28')][_0x1635('0x25')]({'where':{'type':_0x3e8565,'resourceId':_0x58a8a1['id']}})[_0x1635('0x24')](function(){return _0x51c54c;});})['then'](function(){_0x5c2e94[_0x1635('0x19')](0xcc)[_0x1635('0x29')]();});}};}function handleEntityNotFound(_0x25662a,_0x48505e){return function(_0x3dd220){if(!_0x3dd220){_0x25662a['sendStatus'](0x194);}return _0x3dd220;};}function handleError(_0x51bb61,_0x589db5){_0x589db5=_0x589db5||0x1f4;return function(_0x4c4010){logger[_0x1635('0x2a')](_0x4c4010['stack']);if(_0x4c4010[_0x1635('0x2b')]){delete _0x4c4010[_0x1635('0x2b')];}_0x51bb61['status'](_0x589db5)[_0x1635('0x2c')](_0x4c4010);};}exports[_0x1635('0x2d')]=function(_0xa35e94,_0x240e73){var _0xe2ebcf={},_0x30df49={},_0x435de7={'count':0x0,'rows':[]};var _0xf8e208=_['map'](db[_0x1635('0x2e')]['rawAttributes'],function(_0x23746f){return{'name':_0x23746f[_0x1635('0x2f')],'type':_0x23746f['type'][_0x1635('0x30')]};});_0x30df49[_0x1635('0x31')]=_[_0x1635('0x32')](_0xf8e208,'name');_0x30df49[_0x1635('0x33')]=_[_0x1635('0x34')](_0xa35e94[_0x1635('0x33')]);_0x30df49[_0x1635('0x35')]=_[_0x1635('0x36')](_0x30df49[_0x1635('0x31')],_0x30df49[_0x1635('0x33')]);_0xe2ebcf[_0x1635('0x37')]=_[_0x1635('0x36')](_0x30df49[_0x1635('0x31')],qs['fields'](_0xa35e94[_0x1635('0x33')][_0x1635('0x38')]));_0xe2ebcf['attributes']=_0xe2ebcf['attributes'][_0x1635('0x39')]?_0xe2ebcf[_0x1635('0x37')]:_0x30df49[_0x1635('0x31')];if(!_0xa35e94['query'][_0x1635('0x3a')](_0x1635('0x3b'))){_0xe2ebcf['limit']=qs['limit'](_0xa35e94[_0x1635('0x33')][_0x1635('0x1e')]);_0xe2ebcf[_0x1635('0x1d')]=qs['offset'](_0xa35e94[_0x1635('0x33')][_0x1635('0x1d')]);}_0xe2ebcf[_0x1635('0x3c')]=qs[_0x1635('0x3d')](_0xa35e94[_0x1635('0x33')][_0x1635('0x3d')]);_0xe2ebcf['where']=qs[_0x1635('0x35')](_[_0x1635('0x3e')](_0xa35e94['query'],_0x30df49[_0x1635('0x35')]),_0xf8e208);if(_0xa35e94[_0x1635('0x33')][_0x1635('0x3f')]){_0xe2ebcf['where']=_[_0x1635('0x40')](_0xe2ebcf[_0x1635('0x41')],{'$or':[{'key':{'$like':'%'+_0xa35e94[_0x1635('0x33')][_0x1635('0x3f')]+'%'}},{'value':{'$like':'%'+_0xa35e94['query'][_0x1635('0x3f')]+'%'}}]});}_0xe2ebcf=_[_0x1635('0x40')]({},_0xe2ebcf,_0xa35e94['options']);var _0x370651={'where':_0xe2ebcf[_0x1635('0x41')]};return db[_0x1635('0x2e')][_0x1635('0x1c')](_0x370651)['then'](function(_0x15eeec){_0x435de7[_0x1635('0x1c')]=_0x15eeec;if(_0xa35e94[_0x1635('0x33')][_0x1635('0x42')]){_0xe2ebcf[_0x1635('0x43')]=[{'all':!![]}];}return db[_0x1635('0x2e')][_0x1635('0x44')](_0xe2ebcf);})[_0x1635('0x24')](function(_0x570c08){_0x435de7[_0x1635('0x45')]=_0x570c08;return _0x435de7;})[_0x1635('0x24')](respondWithFilteredResult(_0x240e73,_0xe2ebcf))['catch'](handleError(_0x240e73,null));};exports[_0x1635('0x46')]=function(_0xa897e1,_0x6ac79a){var _0x253cce={'raw':!![],'where':{'id':_0xa897e1[_0x1635('0x47')]['id']}},_0x5a989d={};_0x5a989d[_0x1635('0x31')]=_[_0x1635('0x34')](db['CannedAnswer'][_0x1635('0x48')]);_0x5a989d[_0x1635('0x33')]=_[_0x1635('0x34')](_0xa897e1[_0x1635('0x33')]);_0x5a989d[_0x1635('0x35')]=_['intersection'](_0x5a989d[_0x1635('0x31')],_0x5a989d[_0x1635('0x33')]);_0x253cce[_0x1635('0x37')]=_['intersection'](_0x5a989d[_0x1635('0x31')],qs[_0x1635('0x38')](_0xa897e1[_0x1635('0x33')]['fields']));_0x253cce[_0x1635('0x37')]=_0x253cce[_0x1635('0x37')][_0x1635('0x39')]?_0x253cce[_0x1635('0x37')]:_0x5a989d[_0x1635('0x31')];if(_0xa897e1[_0x1635('0x33')][_0x1635('0x42')]){_0x253cce['include']=[{'all':!![]}];}_0x253cce=_['merge']({},_0x253cce,_0xa897e1['options']);return db[_0x1635('0x2e')][_0x1635('0x49')](_0x253cce)['then'](handleEntityNotFound(_0x6ac79a,null))[_0x1635('0x24')](respondWithResult(_0x6ac79a,null))[_0x1635('0x4a')](handleError(_0x6ac79a,null));};exports['update']=function(_0x1aa33e,_0x10d4b8){if(_0x1aa33e[_0x1635('0x4b')]['id']){delete _0x1aa33e['body']['id'];}return db[_0x1635('0x2e')][_0x1635('0x49')]({'where':{'id':_0x1aa33e[_0x1635('0x47')]['id']}})[_0x1635('0x24')](handleEntityNotFound(_0x10d4b8,null))['then'](saveUpdates(_0x1aa33e[_0x1635('0x4b')],null))[_0x1635('0x24')](respondWithResult(_0x10d4b8,null))[_0x1635('0x4a')](handleError(_0x10d4b8,null));};exports[_0x1635('0x25')]=function(_0x3f474c,_0x200d7d){return db[_0x1635('0x2e')]['find']({'where':{'id':_0x3f474c[_0x1635('0x47')]['id']}})[_0x1635('0x24')](handleEntityNotFound(_0x200d7d,null))['then'](removeEntity(_0x200d7d,null))[_0x1635('0x4a')](handleError(_0x200d7d,null));};exports[_0x1635('0x4c')]=function(_0x5a68d0,_0x59f36e){var _0xc6feee={'key':_0x5a68d0[_0x1635('0x4b')]['key']};if(_0x5a68d0[_0x1635('0x4b')]['MailAccountId']){_0xc6feee['MailAccountId']=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4d')];}else if(_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4e')]){_0xc6feee[_0x1635('0x4e')]=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4e')];}else if(_0x5a68d0[_0x1635('0x4b')]['OpenchannelAccountId']){_0xc6feee[_0x1635('0x4f')]=_0x5a68d0['body'][_0x1635('0x4f')];}else if(_0x5a68d0[_0x1635('0x4b')]['ChatWebsiteId']){_0xc6feee[_0x1635('0x50')]=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x50')];}return db[_0x1635('0x2e')]['find']({'where':_0xc6feee})[_0x1635('0x24')](function(_0x32766e){if(_0x32766e){throw new db[(_0x1635('0x51'))][(_0x1635('0x52'))](_0x1635('0x53'));}return db[_0x1635('0x2e')][_0x1635('0x4c')](_0x5a68d0[_0x1635('0x4b')]);})[_0x1635('0x24')](function(_0x127a22){var _0xe9e722=_0x5a68d0[_0x1635('0x54')]['get']({'plain':!![]});if(!_0xe9e722)throw new Error(_0x1635('0x55'));if(_0xe9e722['role']===_0x1635('0x54')){var _0x582622=_0x127a22[_0x1635('0x26')]({'plain':!![]});return db[_0x1635('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0xe9e722[_0x1635('0x57')]},'raw':!![]})[_0x1635('0x24')](function(_0x1a78f3){if(_0x1a78f3&&_0x1a78f3[_0x1635('0x58')]===0x0){return db['UserProfileResource'][_0x1635('0x4c')]({'name':_0x582622['name'],'resourceId':_0x582622['id'],'type':_0x1a78f3[_0x1635('0x2b')],'sectionId':_0x1a78f3['id']},{})[_0x1635('0x24')](function(){return _0x127a22;});}else{return _0x127a22;}})[_0x1635('0x4a')](function(_0x4ad27d){logger[_0x1635('0x2a')](_0x1635('0x59'),_0x4ad27d);throw _0x4ad27d;});}return _0x127a22;})[_0x1635('0x24')](respondWithResult(_0x59f36e,0xc9))[_0x1635('0x4a')](handleError(_0x59f36e,null));}; \ No newline at end of file +var _0xe0c1=['options','CannedAnswer','count','findAll','rows','catch','show','params','filters','length','includeAll','include','merge','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter'];(function(_0x14a54b,_0x3eec32){var _0x5b5e4b=function(_0x1b3f00){while(--_0x1b3f00){_0x14a54b['push'](_0x14a54b['shift']());}};_0x5b5e4b(++_0x3eec32);}(_0xe0c1,0x74));var _0x1e0c=function(_0x2db18d,_0xc7c3f6){_0x2db18d=_0x2db18d-0x0;var _0x361708=_0xe0c1[_0x2db18d];return _0x361708;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e0c('0x0'));var zipdir=require(_0x1e0c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e0c('0x2'));var moment=require('moment');var BPromise=require(_0x1e0c('0x3'));var Mustache=require(_0x1e0c('0x4'));var util=require(_0x1e0c('0x5'));var path=require(_0x1e0c('0x6'));var sox=require(_0x1e0c('0x7'));var csv=require(_0x1e0c('0x8'));var ejs=require(_0x1e0c('0x9'));var fs=require('fs');var fs_extra=require(_0x1e0c('0xa'));var _=require(_0x1e0c('0xb'));var squel=require(_0x1e0c('0xc'));var crypto=require(_0x1e0c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1e0c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e0c('0xf'));var Papa=require(_0x1e0c('0x10'));var Redis=require(_0x1e0c('0x11'));var authService=require(_0x1e0c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1e0c('0x14'));var licenseUtil=require(_0x1e0c('0x15'));var db=require(_0x1e0c('0x16'))['db'];function respondWithStatusCode(_0x1b0627,_0xaade20){_0xaade20=_0xaade20||0xcc;return function(_0xb4d884){if(_0xb4d884){return _0x1b0627[_0x1e0c('0x17')](_0xaade20);}return _0x1b0627[_0x1e0c('0x18')](_0xaade20)['end']();};}function respondWithResult(_0x3681f1,_0x2e745b){_0x2e745b=_0x2e745b||0xc8;return function(_0x4c33b0){if(_0x4c33b0){return _0x3681f1[_0x1e0c('0x18')](_0x2e745b)[_0x1e0c('0x19')](_0x4c33b0);}};}function respondWithFilteredResult(_0x404fae,_0x448b39){return function(_0x59b645){if(_0x59b645){var _0x16d597=typeof _0x448b39[_0x1e0c('0x1a')]===_0x1e0c('0x1b')&&typeof _0x448b39[_0x1e0c('0x1c')]===_0x1e0c('0x1b');var _0x403778=_0x59b645['count'];var _0x13f89c=_0x16d597?0x0:_0x448b39['offset'];var _0x455b20=_0x16d597?_0x59b645['count']:_0x448b39[_0x1e0c('0x1a')]+_0x448b39[_0x1e0c('0x1c')];var _0x3b8cae;if(_0x455b20>=_0x403778){_0x455b20=_0x403778;_0x3b8cae=0xc8;}else{_0x3b8cae=0xce;}_0x404fae['status'](_0x3b8cae);return _0x404fae[_0x1e0c('0x1d')](_0x1e0c('0x1e'),_0x13f89c+'-'+_0x455b20+'/'+_0x403778)['json'](_0x59b645);}return null;};}function patchUpdates(_0x4883ed){return function(_0x388789){try{jsonpatch[_0x1e0c('0x1f')](_0x388789,_0x4883ed,!![]);}catch(_0x411583){return BPromise[_0x1e0c('0x20')](_0x411583);}return _0x388789[_0x1e0c('0x21')]();};}function saveUpdates(_0x54b634,_0x2de4c4){return function(_0xf9ad3a){if(_0xf9ad3a){return _0xf9ad3a[_0x1e0c('0x22')](_0x54b634)[_0x1e0c('0x23')](function(_0x18183f){return _0x18183f;});}return null;};}function removeEntity(_0x3c0dea,_0x435a59){return function(_0xdee72){if(_0xdee72){return _0xdee72[_0x1e0c('0x24')]()[_0x1e0c('0x23')](function(){var _0x3ccade=_0xdee72[_0x1e0c('0x25')]({'plain':!![]});var _0x2f84aa=_0x1e0c('0x26');return db[_0x1e0c('0x27')][_0x1e0c('0x24')]({'where':{'type':_0x2f84aa,'resourceId':_0x3ccade['id']}})['then'](function(){return _0xdee72;});})[_0x1e0c('0x23')](function(){_0x3c0dea[_0x1e0c('0x18')](0xcc)[_0x1e0c('0x28')]();});}};}function handleEntityNotFound(_0xd4f1cb,_0xa8f00){return function(_0x29afa0){if(!_0x29afa0){_0xd4f1cb[_0x1e0c('0x17')](0x194);}return _0x29afa0;};}function handleError(_0x1b3736,_0x8b04f0){_0x8b04f0=_0x8b04f0||0x1f4;return function(_0x432d9b){logger[_0x1e0c('0x29')](_0x432d9b['stack']);if(_0x432d9b[_0x1e0c('0x2a')]){delete _0x432d9b['name'];}_0x1b3736[_0x1e0c('0x18')](_0x8b04f0)[_0x1e0c('0x2b')](_0x432d9b);};}exports[_0x1e0c('0x2c')]=function(_0x3dec34,_0x1a9e06){var _0x14ef49={},_0xff8d2b={},_0x53a84d={'count':0x0,'rows':[]};var _0x553f12=_[_0x1e0c('0x2d')](db['CannedAnswer'][_0x1e0c('0x2e')],function(_0x16f24d){return{'name':_0x16f24d[_0x1e0c('0x2f')],'type':_0x16f24d[_0x1e0c('0x30')]['key']};});_0xff8d2b[_0x1e0c('0x31')]=_[_0x1e0c('0x2d')](_0x553f12,_0x1e0c('0x2a'));_0xff8d2b['query']=_[_0x1e0c('0x32')](_0x3dec34[_0x1e0c('0x33')]);_0xff8d2b['filters']=_[_0x1e0c('0x34')](_0xff8d2b[_0x1e0c('0x31')],_0xff8d2b[_0x1e0c('0x33')]);_0x14ef49[_0x1e0c('0x35')]=_[_0x1e0c('0x34')](_0xff8d2b['model'],qs[_0x1e0c('0x36')](_0x3dec34['query'][_0x1e0c('0x36')]));_0x14ef49[_0x1e0c('0x35')]=_0x14ef49['attributes']['length']?_0x14ef49[_0x1e0c('0x35')]:_0xff8d2b['model'];if(!_0x3dec34[_0x1e0c('0x33')][_0x1e0c('0x37')]('nolimit')){_0x14ef49[_0x1e0c('0x1c')]=qs['limit'](_0x3dec34[_0x1e0c('0x33')]['limit']);_0x14ef49[_0x1e0c('0x1a')]=qs['offset'](_0x3dec34[_0x1e0c('0x33')][_0x1e0c('0x1a')]);}_0x14ef49[_0x1e0c('0x38')]=qs[_0x1e0c('0x39')](_0x3dec34['query'][_0x1e0c('0x39')]);_0x14ef49['where']=qs['filters'](_['pick'](_0x3dec34[_0x1e0c('0x33')],_0xff8d2b['filters']),_0x553f12);if(_0x3dec34['query']['filter']){_0x14ef49['where']=_['merge'](_0x14ef49[_0x1e0c('0x3a')],{'$or':[{'key':{'$like':'%'+_0x3dec34[_0x1e0c('0x33')][_0x1e0c('0x3b')]+'%'}},{'value':{'$like':'%'+_0x3dec34[_0x1e0c('0x33')][_0x1e0c('0x3b')]+'%'}}]});}_0x14ef49=_['merge']({},_0x14ef49,_0x3dec34[_0x1e0c('0x3c')]);var _0x3cd799={'where':_0x14ef49['where']};return db[_0x1e0c('0x3d')][_0x1e0c('0x3e')](_0x3cd799)[_0x1e0c('0x23')](function(_0x40046e){_0x53a84d[_0x1e0c('0x3e')]=_0x40046e;if(_0x3dec34[_0x1e0c('0x33')]['includeAll']){_0x14ef49['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x1e0c('0x3f')](_0x14ef49);})[_0x1e0c('0x23')](function(_0x205521){_0x53a84d[_0x1e0c('0x40')]=_0x205521;return _0x53a84d;})[_0x1e0c('0x23')](respondWithFilteredResult(_0x1a9e06,_0x14ef49))[_0x1e0c('0x41')](handleError(_0x1a9e06,null));};exports[_0x1e0c('0x42')]=function(_0x5c7528,_0x122e8f){var _0xb6f228={'raw':!![],'where':{'id':_0x5c7528[_0x1e0c('0x43')]['id']}},_0x6937f1={};_0x6937f1[_0x1e0c('0x31')]=_[_0x1e0c('0x32')](db['CannedAnswer'][_0x1e0c('0x2e')]);_0x6937f1['query']=_[_0x1e0c('0x32')](_0x5c7528[_0x1e0c('0x33')]);_0x6937f1[_0x1e0c('0x44')]=_['intersection'](_0x6937f1[_0x1e0c('0x31')],_0x6937f1[_0x1e0c('0x33')]);_0xb6f228['attributes']=_[_0x1e0c('0x34')](_0x6937f1[_0x1e0c('0x31')],qs[_0x1e0c('0x36')](_0x5c7528[_0x1e0c('0x33')][_0x1e0c('0x36')]));_0xb6f228[_0x1e0c('0x35')]=_0xb6f228[_0x1e0c('0x35')][_0x1e0c('0x45')]?_0xb6f228[_0x1e0c('0x35')]:_0x6937f1[_0x1e0c('0x31')];if(_0x5c7528[_0x1e0c('0x33')][_0x1e0c('0x46')]){_0xb6f228[_0x1e0c('0x47')]=[{'all':!![]}];}_0xb6f228=_[_0x1e0c('0x48')]({},_0xb6f228,_0x5c7528[_0x1e0c('0x3c')]);return db[_0x1e0c('0x3d')][_0x1e0c('0x49')](_0xb6f228)[_0x1e0c('0x23')](handleEntityNotFound(_0x122e8f,null))['then'](respondWithResult(_0x122e8f,null))[_0x1e0c('0x41')](handleError(_0x122e8f,null));};exports['update']=function(_0x4af4fd,_0x485c95){if(_0x4af4fd['body']['id']){delete _0x4af4fd[_0x1e0c('0x4a')]['id'];}return db[_0x1e0c('0x3d')]['find']({'where':{'id':_0x4af4fd[_0x1e0c('0x43')]['id']}})[_0x1e0c('0x23')](handleEntityNotFound(_0x485c95,null))[_0x1e0c('0x23')](saveUpdates(_0x4af4fd[_0x1e0c('0x4a')],null))[_0x1e0c('0x23')](respondWithResult(_0x485c95,null))['catch'](handleError(_0x485c95,null));};exports['destroy']=function(_0x1a4f7d,_0x1b19a4){return db[_0x1e0c('0x3d')][_0x1e0c('0x49')]({'where':{'id':_0x1a4f7d[_0x1e0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b19a4,null))[_0x1e0c('0x23')](removeEntity(_0x1b19a4,null))[_0x1e0c('0x41')](handleError(_0x1b19a4,null));};exports[_0x1e0c('0x4b')]=function(_0x45e032,_0x271757){var _0x54be18={'key':_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x4c')]};if(_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x4d')]){_0x54be18[_0x1e0c('0x4d')]=_0x45e032['body'][_0x1e0c('0x4d')];}else if(_0x45e032[_0x1e0c('0x4a')]['SmsAccountId']){_0x54be18['SmsAccountId']=_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x4e')];}else if(_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x4f')]){_0x54be18[_0x1e0c('0x4f')]=_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x4f')];}else if(_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x50')]){_0x54be18[_0x1e0c('0x50')]=_0x45e032[_0x1e0c('0x4a')][_0x1e0c('0x50')];}return db[_0x1e0c('0x3d')][_0x1e0c('0x49')]({'where':_0x54be18})[_0x1e0c('0x23')](function(_0x3793aa){if(_0x3793aa){throw new db[(_0x1e0c('0x51'))][(_0x1e0c('0x52'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x1e0c('0x3d')][_0x1e0c('0x4b')](_0x45e032[_0x1e0c('0x4a')]);})[_0x1e0c('0x23')](function(_0x4e2c68){var _0x4e7778=_0x45e032['user'][_0x1e0c('0x25')]({'plain':!![]});if(!_0x4e7778)throw new Error(_0x1e0c('0x53'));if(_0x4e7778['role']===_0x1e0c('0x54')){var _0x2a8962=_0x4e2c68[_0x1e0c('0x25')]({'plain':!![]});return db[_0x1e0c('0x55')][_0x1e0c('0x49')]({'where':{'name':_0x1e0c('0x26'),'userProfileId':_0x4e7778['userProfileId']},'raw':!![]})[_0x1e0c('0x23')](function(_0x5c4782){if(_0x5c4782&&_0x5c4782[_0x1e0c('0x56')]===0x0){return db[_0x1e0c('0x27')][_0x1e0c('0x4b')]({'name':_0x2a8962[_0x1e0c('0x2a')],'resourceId':_0x2a8962['id'],'type':_0x5c4782[_0x1e0c('0x2a')],'sectionId':_0x5c4782['id']},{})[_0x1e0c('0x23')](function(){return _0x4e2c68;});}else{return _0x4e2c68;}})[_0x1e0c('0x41')](function(_0x1674df){logger[_0x1e0c('0x29')](_0x1e0c('0x57'),_0x1674df);throw _0x1674df;});}return _0x4e2c68;})[_0x1e0c('0x23')](respondWithResult(_0x271757,0xc9))[_0x1e0c('0x41')](handleError(_0x271757,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 79b1318..601167a 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 _0xfa20=['../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x551c36,_0x435b25){var _0x4854af=function(_0x473e09){while(--_0x473e09){_0x551c36['push'](_0x551c36['shift']());}};_0x4854af(++_0x435b25);}(_0xfa20,0x141));var _0x0fa2=function(_0x3194c2,_0x807309){_0x3194c2=_0x3194c2-0x0;var _0x4c666a=_0xfa20[_0x3194c2];return _0x4c666a;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x19387c,_0x2247e9){return _0x19387c['define'](_0x0fa2('0xb'),attributes,{'tableName':_0x0fa2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0fa2('0xd'),'collate':_0x0fa2('0xe')});}; \ No newline at end of file +var _0x7c11=['moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','api'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x7c11,0x1c5));var _0x17c1=function(_0x56684e,_0x3e6e67){_0x56684e=_0x56684e-0x0;var _0x4e84dc=_0x7c11[_0x56684e];return _0x4e84dc;};'use strict';var _=require('lodash');var util=require(_0x17c1('0x0'));var logger=require('../../config/logger')(_0x17c1('0x1'));var moment=require(_0x17c1('0x2'));var BPromise=require(_0x17c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17c1('0x4'));var rimraf=require(_0x17c1('0x5'));var config=require(_0x17c1('0x6'));var attributes=require(_0x17c1('0x7'));module[_0x17c1('0x8')]=function(_0x4846be,_0x3a3af1){return _0x4846be[_0x17c1('0x9')](_0x17c1('0xa'),attributes,{'tableName':_0x17c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x17c1('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 42654b4..376ac8b 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(_0x895c2,_0xf618c3){var _0xadbea7=function(_0x2bc323){while(--_0x2bc323){_0x895c2['push'](_0x895c2['shift']());}};_0xadbea7(++_0xf618c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x490657,_0x189e4d){var _0x8c2aca=function(_0x30acf){while(--_0x30acf){_0x490657['push'](_0x490657['shift']());}};_0x8c2aca(++_0x189e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 fdca741..68ed2b2 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 _0xb568=['./cannedAnswer.controller','get','index','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2774fa,_0x4f415d){var _0x398994=function(_0x24ef38){while(--_0x24ef38){_0x2774fa['push'](_0x2774fa['shift']());}};_0x398994(++_0x4f415d);}(_0xb568,0x185));var _0x8b56=function(_0x16ca4a,_0x1ed3e7){_0x16ca4a=_0x16ca4a-0x0;var _0x48f844=_0xb568[_0x16ca4a];return _0x48f844;};'use strict';var multer=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var path=require(_0x8b56('0x2'));var timeout=require(_0x8b56('0x3'));var express=require(_0x8b56('0x4'));var router=express[_0x8b56('0x5')]();var fs_extra=require(_0x8b56('0x6'));var auth=require(_0x8b56('0x7'));var interaction=require(_0x8b56('0x8'));var config=require(_0x8b56('0x9'));var controller=require(_0x8b56('0xa'));router[_0x8b56('0xb')]('/',auth['isAuthenticated'](),controller[_0x8b56('0xc')]);router[_0x8b56('0xb')](_0x8b56('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8b56('0xe')]('/',auth[_0x8b56('0xf')](),controller[_0x8b56('0x10')]);router[_0x8b56('0x11')]('/:id',auth[_0x8b56('0xf')](),controller[_0x8b56('0x12')]);router['delete'](_0x8b56('0xd'),auth[_0x8b56('0xf')](),controller[_0x8b56('0x13')]);module[_0x8b56('0x14')]=router; \ No newline at end of file +var _0x0f13=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x37737e,_0x22c163){var _0x1b8daa=function(_0x39993d){while(--_0x39993d){_0x37737e['push'](_0x37737e['shift']());}};_0x1b8daa(++_0x22c163);}(_0x0f13,0x6a));var _0x30f1=function(_0x3ed7c2,_0x14ee82){_0x3ed7c2=_0x3ed7c2-0x0;var _0x334c0f=_0x0f13[_0x3ed7c2];return _0x334c0f;};'use strict';var multer=require('multer');var util=require(_0x30f1('0x0'));var path=require(_0x30f1('0x1'));var timeout=require(_0x30f1('0x2'));var express=require(_0x30f1('0x3'));var router=express[_0x30f1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30f1('0x6'));var controller=require('./cannedAnswer.controller');router[_0x30f1('0x7')]('/',auth['isAuthenticated'](),controller[_0x30f1('0x8')]);router[_0x30f1('0x7')]('/:id',auth[_0x30f1('0x9')](),controller[_0x30f1('0xa')]);router[_0x30f1('0xb')]('/',auth['isAuthenticated'](),controller[_0x30f1('0xc')]);router[_0x30f1('0xd')](_0x30f1('0xe'),auth[_0x30f1('0x9')](),controller[_0x30f1('0xf')]);router[_0x30f1('0x10')]('/:id',auth[_0x30f1('0x9')](),controller['destroy']);module[_0x30f1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index c66d488..af39ded 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 _0x8b30=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2abb21,_0x4765b5){var _0x1b978f=function(_0x113284){while(--_0x113284){_0x2abb21['push'](_0x2abb21['shift']());}};_0x1b978f(++_0x4765b5);}(_0x8b30,0x1c7));var _0x08b3=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8b30[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x08b3('0x0'));module[_0x08b3('0x1')]={'calldate':{'type':Sequelize[_0x08b3('0x2')],'allowNull':![],'defaultValue':_0x08b3('0x3')},'clid':{'type':Sequelize[_0x08b3('0x4')]},'src':{'type':Sequelize[_0x08b3('0x4')]},'dst':{'type':Sequelize[_0x08b3('0x4')]},'dcontext':{'type':Sequelize[_0x08b3('0x4')]},'channel':{'type':Sequelize[_0x08b3('0x4')]},'dstchannel':{'type':Sequelize[_0x08b3('0x4')]},'lastapp':{'type':Sequelize[_0x08b3('0x4')]},'lastdata':{'type':Sequelize[_0x08b3('0x4')]},'duration':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x08b3('0x4')]},'userfield':{'type':Sequelize[_0x08b3('0x4')]},'uniqueid':{'type':Sequelize[_0x08b3('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x08b3('0x4')]},'type':{'type':Sequelize[_0x08b3('0x4')]},'tag':{'type':Sequelize[_0x08b3('0x4')]}}; \ No newline at end of file +var _0x5cbc=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x22a9bf,_0x18d676){var _0x3ad498=function(_0x481aae){while(--_0x481aae){_0x22a9bf['push'](_0x22a9bf['shift']());}};_0x3ad498(++_0x18d676);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0x5cbc[_0x547e20];return _0x359171;};'use strict';var Sequelize=require(_0xc5cb('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xc5cb('0x1')],'allowNull':![],'defaultValue':_0xc5cb('0x2')},'clid':{'type':Sequelize[_0xc5cb('0x3')]},'src':{'type':Sequelize[_0xc5cb('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xc5cb('0x3')]},'channel':{'type':Sequelize[_0xc5cb('0x3')]},'dstchannel':{'type':Sequelize[_0xc5cb('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc5cb('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc5cb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc5cb('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc5cb('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc5cb('0x3')]},'linkedid':{'type':Sequelize[_0xc5cb('0x3')]},'sequence':{'type':Sequelize[_0xc5cb('0x3')]},'peeraccount':{'type':Sequelize[_0xc5cb('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xc5cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 86b0ee7..e139cb6 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 _0xd13e=['limit','count','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','name','index','map','Cdr','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd13e,0x193));var _0xed13=function(_0x443e9c,_0x35e1cd){_0x443e9c=_0x443e9c-0x0;var _0x5c9cfe=_0xd13e[_0x443e9c];return _0x5c9cfe;};'use strict';var emlformat=require(_0xed13('0x0'));var rimraf=require(_0xed13('0x1'));var zipdir=require(_0xed13('0x2'));var jsonpatch=require(_0xed13('0x3'));var rp=require('request-promise');var moment=require(_0xed13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed13('0x5'));var util=require('util');var path=require(_0xed13('0x6'));var sox=require(_0xed13('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];function respondWithStatusCode(_0x3c0b22,_0x936103){_0x936103=_0x936103||0xcc;return function(_0x3295ba){if(_0x3295ba){return _0x3c0b22['sendStatus'](_0x936103);}return _0x3c0b22[_0xed13('0x19')](_0x936103)['end']();};}function respondWithResult(_0x257074,_0x56fdc6){_0x56fdc6=_0x56fdc6||0xc8;return function(_0x6e2978){if(_0x6e2978){return _0x257074['status'](_0x56fdc6)[_0xed13('0x1a')](_0x6e2978);}};}function respondWithFilteredResult(_0x4d5435,_0x38901a){return function(_0xf900d2){if(_0xf900d2){var _0x1d3d67=typeof _0x38901a[_0xed13('0x1b')]===_0xed13('0x1c')&&typeof _0x38901a[_0xed13('0x1d')]===_0xed13('0x1c');var _0x1148a3=_0xf900d2[_0xed13('0x1e')];var _0x1e161f=_0x1d3d67?0x0:_0x38901a[_0xed13('0x1b')];var _0x31de07=_0x1d3d67?_0xf900d2[_0xed13('0x1e')]:_0x38901a[_0xed13('0x1b')]+_0x38901a[_0xed13('0x1d')];var _0x2f38c9;if(_0x31de07>=_0x1148a3){_0x31de07=_0x1148a3;_0x2f38c9=0xc8;}else{_0x2f38c9=0xce;}_0x4d5435['status'](_0x2f38c9);return _0x4d5435['set'](_0xed13('0x1f'),_0x1e161f+'-'+_0x31de07+'/'+_0x1148a3)[_0xed13('0x1a')](_0xf900d2);}return null;};}function patchUpdates(_0x4f455b){return function(_0x40dd86){try{jsonpatch['apply'](_0x40dd86,_0x4f455b,!![]);}catch(_0x4e9e3b){return BPromise[_0xed13('0x20')](_0x4e9e3b);}return _0x40dd86[_0xed13('0x21')]();};}function saveUpdates(_0x2d62cd,_0x192d12){return function(_0x1d7621){if(_0x1d7621){return _0x1d7621[_0xed13('0x22')](_0x2d62cd)['then'](function(_0x5c0daf){return _0x5c0daf;});}return null;};}function removeEntity(_0x5d7ae1,_0x19d51b){return function(_0x3b1f23){if(_0x3b1f23){return _0x3b1f23[_0xed13('0x23')]()[_0xed13('0x24')](function(){_0x5d7ae1[_0xed13('0x19')](0xcc)[_0xed13('0x25')]();});}};}function handleEntityNotFound(_0x1f0405,_0x276c57){return function(_0x2410e2){if(!_0x2410e2){_0x1f0405[_0xed13('0x26')](0x194);}return _0x2410e2;};}function handleError(_0x1f064c,_0x3bc666){_0x3bc666=_0x3bc666||0x1f4;return function(_0x2c6c33){logger[_0xed13('0x27')](_0x2c6c33['stack']);if(_0x2c6c33['name']){delete _0x2c6c33[_0xed13('0x28')];}_0x1f064c[_0xed13('0x19')](_0x3bc666)['send'](_0x2c6c33);};}exports[_0xed13('0x29')]=function(_0x40444a,_0x4ed119){var _0x7ce996={},_0x2066ca={},_0x323156={'count':0x0,'rows':[]};var _0x570929=_[_0xed13('0x2a')](db[_0xed13('0x2b')]['rawAttributes'],function(_0x433665){return{'name':_0x433665[_0xed13('0x2c')],'type':_0x433665['type'][_0xed13('0x2d')]};});_0x2066ca[_0xed13('0x2e')]=_[_0xed13('0x2a')](_0x570929,_0xed13('0x28'));_0x2066ca[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x40444a[_0xed13('0x2f')]);_0x2066ca['filters']=_[_0xed13('0x31')](_0x2066ca['model'],_0x2066ca['query']);_0x7ce996[_0xed13('0x32')]=_[_0xed13('0x31')](_0x2066ca[_0xed13('0x2e')],qs['fields'](_0x40444a[_0xed13('0x2f')][_0xed13('0x33')]));_0x7ce996[_0xed13('0x32')]=_0x7ce996['attributes'][_0xed13('0x34')]?_0x7ce996[_0xed13('0x32')]:_0x2066ca[_0xed13('0x2e')];if(!_0x40444a[_0xed13('0x2f')]['hasOwnProperty'](_0xed13('0x35'))){_0x7ce996[_0xed13('0x1d')]=qs[_0xed13('0x1d')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1d')]);_0x7ce996[_0xed13('0x1b')]=qs[_0xed13('0x1b')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1b')]);}_0x7ce996[_0xed13('0x36')]=qs['sort'](_0x40444a[_0xed13('0x2f')][_0xed13('0x37')]);_0x7ce996['where']=qs['filters'](_['pick'](_0x40444a[_0xed13('0x2f')],_0x2066ca[_0xed13('0x38')]),_0x570929);if(_0x40444a['query']['filter']){_0x7ce996[_0xed13('0x39')]=_[_0xed13('0x3a')](_0x7ce996[_0xed13('0x39')],{'$or':_[_0xed13('0x2a')](_0x570929,function(_0x358098){if(_0x358098['type']!=='VIRTUAL'){var _0x1e943a={};_0x1e943a[_0x358098['name']]={'$like':'%'+_0x40444a[_0xed13('0x2f')]['filter']+'%'};return _0x1e943a;}})});}_0x7ce996=_[_0xed13('0x3a')]({},_0x7ce996,_0x40444a['options']);var _0x4d6429={'where':_0x7ce996['where']};return db[_0xed13('0x2b')][_0xed13('0x1e')](_0x4d6429)[_0xed13('0x24')](function(_0x42d5f7){_0x323156[_0xed13('0x1e')]=_0x42d5f7;if(_0x40444a['query'][_0xed13('0x3b')]){_0x7ce996[_0xed13('0x3c')]=[{'all':!![]}];}return db[_0xed13('0x2b')][_0xed13('0x3d')](_0x7ce996);})[_0xed13('0x24')](function(_0x5a8cfb){_0x323156[_0xed13('0x3e')]=_0x5a8cfb;return _0x323156;})[_0xed13('0x24')](respondWithFilteredResult(_0x4ed119,_0x7ce996))[_0xed13('0x3f')](handleError(_0x4ed119,null));};exports[_0xed13('0x40')]=function(_0x187e28,_0x2e43b5){var _0x535de7={'raw':!![],'where':{'id':_0x187e28[_0xed13('0x41')]['id']}},_0x2f04ef={};_0x2f04ef[_0xed13('0x2e')]=_[_0xed13('0x30')](db[_0xed13('0x2b')][_0xed13('0x42')]);_0x2f04ef[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x187e28[_0xed13('0x2f')]);_0x2f04ef[_0xed13('0x38')]=_[_0xed13('0x31')](_0x2f04ef[_0xed13('0x2e')],_0x2f04ef[_0xed13('0x2f')]);_0x535de7[_0xed13('0x32')]=_['intersection'](_0x2f04ef[_0xed13('0x2e')],qs[_0xed13('0x33')](_0x187e28['query'][_0xed13('0x33')]));_0x535de7[_0xed13('0x32')]=_0x535de7[_0xed13('0x32')]['length']?_0x535de7[_0xed13('0x32')]:_0x2f04ef[_0xed13('0x2e')];if(_0x187e28[_0xed13('0x2f')]['includeAll']){_0x535de7['include']=[{'all':!![]}];}_0x535de7=_[_0xed13('0x3a')]({},_0x535de7,_0x187e28[_0xed13('0x43')]);return db['Cdr'][_0xed13('0x44')](_0x535de7)[_0xed13('0x24')](handleEntityNotFound(_0x2e43b5,null))[_0xed13('0x24')](respondWithResult(_0x2e43b5,null))[_0xed13('0x3f')](handleError(_0x2e43b5,null));};exports['create']=function(_0x1df911,_0xf4ea89){return db[_0xed13('0x2b')][_0xed13('0x45')](_0x1df911['body'],{})[_0xed13('0x24')](respondWithResult(_0xf4ea89,0xc9))['catch'](handleError(_0xf4ea89,null));};exports[_0xed13('0x22')]=function(_0x50d12f,_0x5a0828){if(_0x50d12f[_0xed13('0x46')]['id']){delete _0x50d12f[_0xed13('0x46')]['id'];}return db['Cdr'][_0xed13('0x44')]({'where':{'id':_0x50d12f[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x5a0828,null))[_0xed13('0x24')](saveUpdates(_0x50d12f['body'],null))[_0xed13('0x24')](respondWithResult(_0x5a0828,null))['catch'](handleError(_0x5a0828,null));};exports[_0xed13('0x23')]=function(_0x365e50,_0x19762a){return db[_0xed13('0x2b')][_0xed13('0x44')]({'where':{'id':_0x365e50[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x19762a,null))[_0xed13('0x24')](removeEntity(_0x19762a,null))['catch'](handleError(_0x19762a,null));};exports[_0xed13('0x47')]=function(_0x38f66d,_0x372deb){return db[_0xed13('0x2b')]['describe']()[_0xed13('0x24')](respondWithResult(_0x372deb,null))['catch'](handleError(_0x372deb,null));}; \ No newline at end of file +var _0x3c94=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','Cdr','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x4baf6b,_0x440b09){var _0x5ad1b9=function(_0x247bb5){while(--_0x247bb5){_0x4baf6b['push'](_0x4baf6b['shift']());}};_0x5ad1b9(++_0x440b09);}(_0x3c94,0xcd));var _0x43c9=function(_0x1c7386,_0x298a93){_0x1c7386=_0x1c7386-0x0;var _0x2b6b71=_0x3c94[_0x1c7386];return _0x2b6b71;};'use strict';var emlformat=require(_0x43c9('0x0'));var rimraf=require(_0x43c9('0x1'));var zipdir=require(_0x43c9('0x2'));var jsonpatch=require(_0x43c9('0x3'));var rp=require(_0x43c9('0x4'));var moment=require(_0x43c9('0x5'));var BPromise=require(_0x43c9('0x6'));var Mustache=require(_0x43c9('0x7'));var util=require(_0x43c9('0x8'));var path=require(_0x43c9('0x9'));var sox=require(_0x43c9('0xa'));var csv=require(_0x43c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c9('0xc'));var _=require(_0x43c9('0xd'));var squel=require(_0x43c9('0xe'));var crypto=require(_0x43c9('0xf'));var jsforce=require(_0x43c9('0x10'));var deskjs=require(_0x43c9('0x11'));var toCsv=require(_0x43c9('0xb'));var querystring=require(_0x43c9('0x12'));var Papa=require(_0x43c9('0x13'));var Redis=require('ioredis');var authService=require(_0x43c9('0x14'));var qs=require(_0x43c9('0x15'));var as=require(_0x43c9('0x16'));var hardwareService=require(_0x43c9('0x17'));var logger=require(_0x43c9('0x18'))(_0x43c9('0x19'));var utils=require(_0x43c9('0x1a'));var config=require(_0x43c9('0x1b'));var licenseUtil=require(_0x43c9('0x1c'));var db=require(_0x43c9('0x1d'))['db'];function respondWithStatusCode(_0x62bb3b,_0x31faa1){_0x31faa1=_0x31faa1||0xcc;return function(_0x11fe24){if(_0x11fe24){return _0x62bb3b[_0x43c9('0x1e')](_0x31faa1);}return _0x62bb3b[_0x43c9('0x1f')](_0x31faa1)[_0x43c9('0x20')]();};}function respondWithResult(_0x275b2b,_0x569fa9){_0x569fa9=_0x569fa9||0xc8;return function(_0x37932f){if(_0x37932f){return _0x275b2b[_0x43c9('0x1f')](_0x569fa9)[_0x43c9('0x21')](_0x37932f);}};}function respondWithFilteredResult(_0xe02707,_0x3f908d){return function(_0x5cc1fa){if(_0x5cc1fa){var _0x549d3f=typeof _0x3f908d[_0x43c9('0x22')]===_0x43c9('0x23')&&typeof _0x3f908d[_0x43c9('0x24')]===_0x43c9('0x23');var _0x501856=_0x5cc1fa[_0x43c9('0x25')];var _0x1da149=_0x549d3f?0x0:_0x3f908d[_0x43c9('0x22')];var _0x22bf3d=_0x549d3f?_0x5cc1fa[_0x43c9('0x25')]:_0x3f908d[_0x43c9('0x22')]+_0x3f908d[_0x43c9('0x24')];var _0x1e3996;if(_0x22bf3d>=_0x501856){_0x22bf3d=_0x501856;_0x1e3996=0xc8;}else{_0x1e3996=0xce;}_0xe02707[_0x43c9('0x1f')](_0x1e3996);return _0xe02707[_0x43c9('0x26')](_0x43c9('0x27'),_0x1da149+'-'+_0x22bf3d+'/'+_0x501856)['json'](_0x5cc1fa);}return null;};}function patchUpdates(_0x39c6f1){return function(_0x772b71){try{jsonpatch[_0x43c9('0x28')](_0x772b71,_0x39c6f1,!![]);}catch(_0x4c2d7c){return BPromise[_0x43c9('0x29')](_0x4c2d7c);}return _0x772b71[_0x43c9('0x2a')]();};}function saveUpdates(_0x2ef8d9,_0x5705c6){return function(_0x28290a){if(_0x28290a){return _0x28290a[_0x43c9('0x2b')](_0x2ef8d9)[_0x43c9('0x2c')](function(_0x4d58d7){return _0x4d58d7;});}return null;};}function removeEntity(_0x4963d2,_0x2a40f4){return function(_0x3fd641){if(_0x3fd641){return _0x3fd641[_0x43c9('0x2d')]()['then'](function(){_0x4963d2[_0x43c9('0x1f')](0xcc)[_0x43c9('0x20')]();});}};}function handleEntityNotFound(_0x1e676a,_0x16fee9){return function(_0x2c69af){if(!_0x2c69af){_0x1e676a['sendStatus'](0x194);}return _0x2c69af;};}function handleError(_0x386078,_0x3b5c47){_0x3b5c47=_0x3b5c47||0x1f4;return function(_0x3910af){logger[_0x43c9('0x2e')](_0x3910af[_0x43c9('0x2f')]);if(_0x3910af[_0x43c9('0x30')]){delete _0x3910af[_0x43c9('0x30')];}_0x386078[_0x43c9('0x1f')](_0x3b5c47)[_0x43c9('0x31')](_0x3910af);};}exports[_0x43c9('0x32')]=function(_0x4eb970,_0x11e3c3){var _0x2cbfd7={},_0x15028c={},_0x519e2c={'count':0x0,'rows':[]};var _0x2c0ccc=_[_0x43c9('0x33')](db['Cdr'][_0x43c9('0x34')],function(_0x497719){return{'name':_0x497719[_0x43c9('0x35')],'type':_0x497719[_0x43c9('0x36')][_0x43c9('0x37')]};});_0x15028c[_0x43c9('0x38')]=_['map'](_0x2c0ccc,_0x43c9('0x30'));_0x15028c[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0x4eb970['query']);_0x15028c[_0x43c9('0x3b')]=_['intersection'](_0x15028c[_0x43c9('0x38')],_0x15028c[_0x43c9('0x39')]);_0x2cbfd7[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x15028c['model'],qs[_0x43c9('0x3e')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x2cbfd7[_0x43c9('0x3c')]=_0x2cbfd7['attributes'][_0x43c9('0x3f')]?_0x2cbfd7[_0x43c9('0x3c')]:_0x15028c[_0x43c9('0x38')];if(!_0x4eb970[_0x43c9('0x39')][_0x43c9('0x40')](_0x43c9('0x41'))){_0x2cbfd7[_0x43c9('0x24')]=qs[_0x43c9('0x24')](_0x4eb970['query'][_0x43c9('0x24')]);_0x2cbfd7[_0x43c9('0x22')]=qs[_0x43c9('0x22')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x22')]);}_0x2cbfd7[_0x43c9('0x42')]=qs[_0x43c9('0x43')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x43')]);_0x2cbfd7['where']=qs[_0x43c9('0x3b')](_['pick'](_0x4eb970[_0x43c9('0x39')],_0x15028c[_0x43c9('0x3b')]),_0x2c0ccc);if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]){_0x2cbfd7[_0x43c9('0x45')]=_[_0x43c9('0x46')](_0x2cbfd7[_0x43c9('0x45')],{'$or':_[_0x43c9('0x33')](_0x2c0ccc,function(_0x518bd3){if(_0x518bd3['type']!==_0x43c9('0x47')){var _0x2d63bd={};_0x2d63bd[_0x518bd3['name']]={'$like':'%'+_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]+'%'};return _0x2d63bd;}})});}_0x2cbfd7=_[_0x43c9('0x46')]({},_0x2cbfd7,_0x4eb970['options']);var _0xb01a6e={'where':_0x2cbfd7[_0x43c9('0x45')]};return db[_0x43c9('0x48')][_0x43c9('0x25')](_0xb01a6e)[_0x43c9('0x2c')](function(_0x39601e){_0x519e2c[_0x43c9('0x25')]=_0x39601e;if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x49')]){_0x2cbfd7[_0x43c9('0x4a')]=[{'all':!![]}];}return db[_0x43c9('0x48')][_0x43c9('0x4b')](_0x2cbfd7);})['then'](function(_0x2d5dd5){_0x519e2c[_0x43c9('0x4c')]=_0x2d5dd5;return _0x519e2c;})[_0x43c9('0x2c')](respondWithFilteredResult(_0x11e3c3,_0x2cbfd7))[_0x43c9('0x4d')](handleError(_0x11e3c3,null));};exports['show']=function(_0xff891d,_0x66cac9){var _0x5ce14f={'raw':!![],'where':{'id':_0xff891d[_0x43c9('0x4e')]['id']}},_0x2a8f7d={};_0x2a8f7d[_0x43c9('0x38')]=_[_0x43c9('0x3a')](db[_0x43c9('0x48')][_0x43c9('0x34')]);_0x2a8f7d[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0xff891d[_0x43c9('0x39')]);_0x2a8f7d['filters']=_[_0x43c9('0x3d')](_0x2a8f7d['model'],_0x2a8f7d[_0x43c9('0x39')]);_0x5ce14f[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x2a8f7d[_0x43c9('0x38')],qs['fields'](_0xff891d[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x5ce14f['attributes']=_0x5ce14f[_0x43c9('0x3c')][_0x43c9('0x3f')]?_0x5ce14f['attributes']:_0x2a8f7d[_0x43c9('0x38')];if(_0xff891d[_0x43c9('0x39')][_0x43c9('0x49')]){_0x5ce14f['include']=[{'all':!![]}];}_0x5ce14f=_[_0x43c9('0x46')]({},_0x5ce14f,_0xff891d['options']);return db['Cdr'][_0x43c9('0x4f')](_0x5ce14f)[_0x43c9('0x2c')](handleEntityNotFound(_0x66cac9,null))[_0x43c9('0x2c')](respondWithResult(_0x66cac9,null))[_0x43c9('0x4d')](handleError(_0x66cac9,null));};exports[_0x43c9('0x50')]=function(_0x28fe5d,_0x1f966e){return db[_0x43c9('0x48')][_0x43c9('0x50')](_0x28fe5d[_0x43c9('0x51')],{})[_0x43c9('0x2c')](respondWithResult(_0x1f966e,0xc9))[_0x43c9('0x4d')](handleError(_0x1f966e,null));};exports[_0x43c9('0x2b')]=function(_0x5082e9,_0xc57086){if(_0x5082e9[_0x43c9('0x51')]['id']){delete _0x5082e9['body']['id'];}return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x5082e9[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x2c')](saveUpdates(_0x5082e9[_0x43c9('0x51')],null))[_0x43c9('0x2c')](respondWithResult(_0xc57086,null))[_0x43c9('0x4d')](handleError(_0xc57086,null));};exports[_0x43c9('0x2d')]=function(_0x508b62,_0x27db89){return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x508b62[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0x27db89,null))[_0x43c9('0x2c')](removeEntity(_0x27db89,null))['catch'](handleError(_0x27db89,null));};exports[_0x43c9('0x52')]=function(_0x1bc3b5,_0x3aff2e){return db[_0x43c9('0x48')][_0x43c9('0x52')]()[_0x43c9('0x2c')](respondWithResult(_0x3aff2e,null))[_0x43c9('0x4d')](handleError(_0x3aff2e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 122ab38..b46c5e8 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x237533,_0x5aa66c){var _0x18c7ba=function(_0x56b8b8){while(--_0x56b8b8){_0x237533['push'](_0x237533['shift']());}};_0x18c7ba(++_0x5aa66c);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3514,_0x4ffe19){_0x4f3514=_0x4f3514-0x0;var _0x1e5740=_0x7a54[_0x4f3514];return _0x1e5740;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xe4dc62,_0x543aa4){var _0x1ea798=function(_0x10f96b){while(--_0x10f96b){_0xe4dc62['push'](_0xe4dc62['shift']());}};_0x1ea798(++_0x543aa4);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 f04812f..4696dd7 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 _0x16a5=['jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10413d,_0x39ceb2){var _0x26c937=function(_0x3fb540){while(--_0x3fb540){_0x10413d['push'](_0x10413d['shift']());}};_0x26c937(++_0x39ceb2);}(_0x16a5,0x150));var _0x516a=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x16a5[_0xd21fe7];return _0x14d570;};'use strict';var _=require('lodash');var util=require(_0x516a('0x0'));var moment=require(_0x516a('0x1'));var BPromise=require(_0x516a('0x2'));var rs=require(_0x516a('0x3'));var fs=require('fs');var Redis=require(_0x516a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x516a('0x5'));var logger=require(_0x516a('0x6'))(_0x516a('0x7'));var config=require(_0x516a('0x8'));var jayson=require(_0x516a('0x9'));var client=jayson[_0x516a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29e42f,_0x19a909,_0x2fcd42){return new BPromise(function(_0x2baaa8,_0x3a2fdf){return client[_0x516a('0xb')](_0x29e42f,_0x2fcd42)['then'](function(_0x4361b4){logger[_0x516a('0xc')](_0x516a('0xd'),_0x19a909,'request\x20sent');logger[_0x516a('0xe')](_0x516a('0xf'),_0x19a909,_0x516a('0x10'),JSON[_0x516a('0x11')](_0x4361b4));if(_0x4361b4[_0x516a('0x12')]){if(_0x4361b4[_0x516a('0x12')][_0x516a('0x13')]===0x1f4){logger[_0x516a('0x12')](_0x516a('0xd'),_0x19a909,_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);return _0x3a2fdf(_0x4361b4['error']['message']);}logger[_0x516a('0x12')](_0x516a('0xd'),_0x19a909,_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);return _0x2baaa8(_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);}else{logger[_0x516a('0xc')]('Cdr,\x20%s,\x20%s',_0x19a909,'request\x20sent');_0x2baaa8(_0x4361b4[_0x516a('0x15')]['message']);}})[_0x516a('0x16')](function(_0x3a686e){logger['error'](_0x516a('0xd'),_0x19a909,_0x3a686e);_0x3a2fdf(_0x3a686e);});});} \ No newline at end of file +var _0x9a52=['http','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x1318c4,_0x46c0d1){var _0x3ef069=function(_0x598c82){while(--_0x598c82){_0x1318c4['push'](_0x1318c4['shift']());}};_0x3ef069(++_0x46c0d1);}(_0x9a52,0x19a));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x29a5('0x0'));var util=require(_0x29a5('0x1'));var moment=require('moment');var BPromise=require(_0x29a5('0x2'));var rs=require(_0x29a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29a5('0x4'))(_0x29a5('0x5'));var config=require(_0x29a5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x29a5('0x7')][_0x29a5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfe5f80,_0x12d631,_0x369a3c){return new BPromise(function(_0xce93b6,_0x252a6a){return client['request'](_0xfe5f80,_0x369a3c)['then'](function(_0xa952dc){logger[_0x29a5('0x9')](_0x29a5('0xa'),_0x12d631,'request\x20sent');logger[_0x29a5('0xb')](_0x29a5('0xc'),_0x12d631,_0x29a5('0xd'),JSON[_0x29a5('0xe')](_0xa952dc));if(_0xa952dc[_0x29a5('0xf')]){if(_0xa952dc[_0x29a5('0xf')][_0x29a5('0x10')]===0x1f4){logger['error'](_0x29a5('0xa'),_0x12d631,_0xa952dc[_0x29a5('0xf')][_0x29a5('0x11')]);return _0x252a6a(_0xa952dc['error']['message']);}logger[_0x29a5('0xf')](_0x29a5('0xa'),_0x12d631,_0xa952dc[_0x29a5('0xf')][_0x29a5('0x11')]);return _0xce93b6(_0xa952dc[_0x29a5('0xf')][_0x29a5('0x11')]);}else{logger[_0x29a5('0x9')](_0x29a5('0xa'),_0x12d631,_0x29a5('0xd'));_0xce93b6(_0xa952dc['result'][_0x29a5('0x11')]);}})[_0x29a5('0x12')](function(_0x2856f7){logger[_0x29a5('0xf')](_0x29a5('0xa'),_0x12d631,_0x2856f7);_0x252a6a(_0x2856f7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 8b5f076..57d54ca 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x12b1a6,_0x22df2d){var _0x5813d3=function(_0x57773e){while(--_0x57773e){_0x12b1a6['push'](_0x12b1a6['shift']());}};_0x5813d3(++_0x22df2d);}(_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 105a1d4..a5ebde4 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 _0x2ede=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x9302ea,_0x3bb035){var _0x1e12df=function(_0x221307){while(--_0x221307){_0x9302ea['push'](_0x9302ea['shift']());}};_0x1e12df(++_0x3bb035);}(_0x2ede,0x123));var _0xe2ed=function(_0x2e961b,_0x2e0555){_0x2e961b=_0x2e961b-0x0;var _0x2ffc73=_0x2ede[_0x2e961b];return _0x2ffc73;};'use strict';var Sequelize=require(_0xe2ed('0x0'));module[_0xe2ed('0x1')]={'priority':{'type':Sequelize[_0xe2ed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe2ed('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe2ed('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe2ed('0x4')}}; \ No newline at end of file +var _0x8d87=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d87,0x193));var _0x78d8=function(_0x1a660d,_0x182bba){_0x1a660d=_0x1a660d-0x0;var _0x3c1a19=_0x8d87[_0x1a660d];return _0x3c1a19;};'use strict';var Sequelize=require('sequelize');module[_0x78d8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x78d8('0x1')],'allowNull':![],'defaultValue':_0x78d8('0x2')},'appdata':{'type':Sequelize[_0x78d8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x78d8('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f628e68..46047e1 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 _0xca56=['catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find'];(function(_0x1dbaa3,_0x4b000b){var _0x1af98a=function(_0x510ad1){while(--_0x510ad1){_0x1dbaa3['push'](_0x1dbaa3['shift']());}};_0x1af98a(++_0x4b000b);}(_0xca56,0xee));var _0x6ca5=function(_0x471761,_0x165eca){_0x471761=_0x471761-0x0;var _0x530a53=_0xca56[_0x471761];return _0x530a53;};'use strict';var emlformat=require(_0x6ca5('0x0'));var rimraf=require(_0x6ca5('0x1'));var zipdir=require(_0x6ca5('0x2'));var jsonpatch=require(_0x6ca5('0x3'));var rp=require(_0x6ca5('0x4'));var moment=require(_0x6ca5('0x5'));var BPromise=require(_0x6ca5('0x6'));var Mustache=require(_0x6ca5('0x7'));var util=require(_0x6ca5('0x8'));var path=require('path');var sox=require(_0x6ca5('0x9'));var csv=require(_0x6ca5('0xa'));var ejs=require(_0x6ca5('0xb'));var fs=require('fs');var fs_extra=require(_0x6ca5('0xc'));var _=require('lodash');var squel=require(_0x6ca5('0xd'));var crypto=require(_0x6ca5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ca5('0xa'));var querystring=require(_0x6ca5('0xf'));var Papa=require(_0x6ca5('0x10'));var Redis=require(_0x6ca5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ca5('0x12'));var hardwareService=require(_0x6ca5('0x13'));var logger=require(_0x6ca5('0x14'))(_0x6ca5('0x15'));var utils=require(_0x6ca5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6ca5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb3b9,_0x4fb08b){_0x4fb08b=_0x4fb08b||0xcc;return function(_0x5dd594){if(_0x5dd594){return _0x2eb3b9[_0x6ca5('0x18')](_0x4fb08b);}return _0x2eb3b9['status'](_0x4fb08b)['end']();};}function respondWithResult(_0x2a35cf,_0x428419){_0x428419=_0x428419||0xc8;return function(_0x5ba653){if(_0x5ba653){return _0x2a35cf[_0x6ca5('0x19')](_0x428419)[_0x6ca5('0x1a')](_0x5ba653);}};}function respondWithFilteredResult(_0x491a95,_0x40483f){return function(_0x19debd){if(_0x19debd){var _0x1cdfdc=typeof _0x40483f[_0x6ca5('0x1b')]===_0x6ca5('0x1c')&&typeof _0x40483f['limit']===_0x6ca5('0x1c');var _0x38f3db=_0x19debd['count'];var _0x2b3daf=_0x1cdfdc?0x0:_0x40483f[_0x6ca5('0x1b')];var _0x4fefd0=_0x1cdfdc?_0x19debd[_0x6ca5('0x1d')]:_0x40483f[_0x6ca5('0x1b')]+_0x40483f[_0x6ca5('0x1e')];var _0x37e362;if(_0x4fefd0>=_0x38f3db){_0x4fefd0=_0x38f3db;_0x37e362=0xc8;}else{_0x37e362=0xce;}_0x491a95[_0x6ca5('0x19')](_0x37e362);return _0x491a95[_0x6ca5('0x1f')]('Content-Range',_0x2b3daf+'-'+_0x4fefd0+'/'+_0x38f3db)[_0x6ca5('0x1a')](_0x19debd);}return null;};}function patchUpdates(_0xc7c1cb){return function(_0x44df63){try{jsonpatch[_0x6ca5('0x20')](_0x44df63,_0xc7c1cb,!![]);}catch(_0x11fe18){return BPromise[_0x6ca5('0x21')](_0x11fe18);}return _0x44df63[_0x6ca5('0x22')]();};}function saveUpdates(_0x1f8119,_0x23c16b){return function(_0x324881){if(_0x324881){return _0x324881[_0x6ca5('0x23')](_0x1f8119)[_0x6ca5('0x24')](function(_0x3754f5){return _0x3754f5;});}return null;};}function removeEntity(_0x1a23f2,_0x18967e){return function(_0x4e2f36){if(_0x4e2f36){return _0x4e2f36[_0x6ca5('0x25')]()[_0x6ca5('0x24')](function(){_0x1a23f2[_0x6ca5('0x19')](0xcc)[_0x6ca5('0x26')]();});}};}function handleEntityNotFound(_0x553930,_0xc10fad){return function(_0x350a69){if(!_0x350a69){_0x553930[_0x6ca5('0x18')](0x194);}return _0x350a69;};}function handleError(_0x1bdcc2,_0x409d7b){_0x409d7b=_0x409d7b||0x1f4;return function(_0x26239c){logger[_0x6ca5('0x27')](_0x26239c['stack']);if(_0x26239c[_0x6ca5('0x28')]){delete _0x26239c[_0x6ca5('0x28')];}_0x1bdcc2[_0x6ca5('0x19')](_0x409d7b)[_0x6ca5('0x29')](_0x26239c);};}exports[_0x6ca5('0x2a')]=function(_0x1b1ee9,_0x51b148){var _0xa570e4={'raw':!![],'where':{'id':_0x1b1ee9[_0x6ca5('0x2b')]['id']}},_0x31ab9c={};_0x31ab9c[_0x6ca5('0x2c')]=_[_0x6ca5('0x2d')](db[_0x6ca5('0x2e')][_0x6ca5('0x2f')]);_0x31ab9c[_0x6ca5('0x30')]=_[_0x6ca5('0x2d')](_0x1b1ee9[_0x6ca5('0x30')]);_0x31ab9c[_0x6ca5('0x31')]=_[_0x6ca5('0x32')](_0x31ab9c[_0x6ca5('0x2c')],_0x31ab9c[_0x6ca5('0x30')]);_0xa570e4[_0x6ca5('0x33')]=_[_0x6ca5('0x32')](_0x31ab9c[_0x6ca5('0x2c')],qs[_0x6ca5('0x34')](_0x1b1ee9[_0x6ca5('0x30')][_0x6ca5('0x34')]));_0xa570e4['attributes']=_0xa570e4[_0x6ca5('0x33')]['length']?_0xa570e4[_0x6ca5('0x33')]:_0x31ab9c[_0x6ca5('0x2c')];if(_0x1b1ee9[_0x6ca5('0x30')][_0x6ca5('0x35')]){_0xa570e4['include']=[{'all':!![]}];}_0xa570e4=_[_0x6ca5('0x36')]({},_0xa570e4,_0x1b1ee9[_0x6ca5('0x37')]);return db[_0x6ca5('0x2e')][_0x6ca5('0x38')](_0xa570e4)[_0x6ca5('0x24')](handleEntityNotFound(_0x51b148,null))[_0x6ca5('0x24')](respondWithResult(_0x51b148,null))[_0x6ca5('0x39')](handleError(_0x51b148,null));};exports[_0x6ca5('0x23')]=function(_0x3f2521,_0x529686){if(_0x3f2521[_0x6ca5('0x3a')]['id']){delete _0x3f2521[_0x6ca5('0x3a')]['id'];}return db[_0x6ca5('0x2e')]['find']({'where':{'id':_0x3f2521[_0x6ca5('0x2b')]['id']}})[_0x6ca5('0x24')](handleEntityNotFound(_0x529686,null))[_0x6ca5('0x24')](saveUpdates(_0x3f2521[_0x6ca5('0x3a')],null))['then'](respondWithResult(_0x529686,null))[_0x6ca5('0x39')](handleError(_0x529686,null));};exports[_0x6ca5('0x25')]=function(_0x353c1a,_0x41c53a){return db[_0x6ca5('0x2e')]['find']({'where':{'id':_0x353c1a[_0x6ca5('0x2b')]['id']}})[_0x6ca5('0x24')](handleEntityNotFound(_0x41c53a,null))[_0x6ca5('0x24')](removeEntity(_0x41c53a,null))[_0x6ca5('0x39')](handleError(_0x41c53a,null));}; \ No newline at end of file +var _0xbefe=['sendStatus','error','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy'];(function(_0x39b352,_0x5db49d){var _0x4a39d3=function(_0x277004){while(--_0x277004){_0x39b352['push'](_0x39b352['shift']());}};_0x4a39d3(++_0x5db49d);}(_0xbefe,0x168));var _0xebef=function(_0xe4f7a3,_0x449042){_0xe4f7a3=_0xe4f7a3-0x0;var _0xb1da7c=_0xbefe[_0xe4f7a3];return _0xb1da7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebef('0x1'));var rp=require(_0xebef('0x2'));var moment=require(_0xebef('0x3'));var BPromise=require(_0xebef('0x4'));var Mustache=require(_0xebef('0x5'));var util=require(_0xebef('0x6'));var path=require(_0xebef('0x7'));var sox=require(_0xebef('0x8'));var csv=require('to-csv');var ejs=require(_0xebef('0x9'));var fs=require('fs');var fs_extra=require(_0xebef('0xa'));var _=require(_0xebef('0xb'));var squel=require('squel');var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebef('0xe'));var Papa=require(_0xebef('0xf'));var Redis=require(_0xebef('0x10'));var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))('api');var utils=require(_0xebef('0x16'));var config=require(_0xebef('0x17'));var licenseUtil=require(_0xebef('0x18'));var db=require(_0xebef('0x19'))['db'];function respondWithStatusCode(_0x1dcae4,_0x566dbe){_0x566dbe=_0x566dbe||0xcc;return function(_0x584ac2){if(_0x584ac2){return _0x1dcae4['sendStatus'](_0x566dbe);}return _0x1dcae4['status'](_0x566dbe)[_0xebef('0x1a')]();};}function respondWithResult(_0x124634,_0x31772a){_0x31772a=_0x31772a||0xc8;return function(_0x35cd7a){if(_0x35cd7a){return _0x124634[_0xebef('0x1b')](_0x31772a)[_0xebef('0x1c')](_0x35cd7a);}};}function respondWithFilteredResult(_0x5813eb,_0x32ec37){return function(_0x9411d4){if(_0x9411d4){var _0x1921aa=typeof _0x32ec37[_0xebef('0x1d')]===_0xebef('0x1e')&&typeof _0x32ec37[_0xebef('0x1f')]===_0xebef('0x1e');var _0x1e4ddf=_0x9411d4[_0xebef('0x20')];var _0x16856f=_0x1921aa?0x0:_0x32ec37[_0xebef('0x1d')];var _0x5161f1=_0x1921aa?_0x9411d4[_0xebef('0x20')]:_0x32ec37[_0xebef('0x1d')]+_0x32ec37[_0xebef('0x1f')];var _0x502c1e;if(_0x5161f1>=_0x1e4ddf){_0x5161f1=_0x1e4ddf;_0x502c1e=0xc8;}else{_0x502c1e=0xce;}_0x5813eb[_0xebef('0x1b')](_0x502c1e);return _0x5813eb[_0xebef('0x21')](_0xebef('0x22'),_0x16856f+'-'+_0x5161f1+'/'+_0x1e4ddf)[_0xebef('0x1c')](_0x9411d4);}return null;};}function patchUpdates(_0x7ca0cc){return function(_0x138760){try{jsonpatch[_0xebef('0x23')](_0x138760,_0x7ca0cc,!![]);}catch(_0x4cc18e){return BPromise['reject'](_0x4cc18e);}return _0x138760['save']();};}function saveUpdates(_0x59e078,_0x2f1193){return function(_0x38f0b8){if(_0x38f0b8){return _0x38f0b8[_0xebef('0x24')](_0x59e078)[_0xebef('0x25')](function(_0x1ee3b){return _0x1ee3b;});}return null;};}function removeEntity(_0xe8dcbf,_0x5c5091){return function(_0x460104){if(_0x460104){return _0x460104[_0xebef('0x26')]()[_0xebef('0x25')](function(){_0xe8dcbf[_0xebef('0x1b')](0xcc)[_0xebef('0x1a')]();});}};}function handleEntityNotFound(_0x27f212,_0x36ca6b){return function(_0x42d2af){if(!_0x42d2af){_0x27f212[_0xebef('0x27')](0x194);}return _0x42d2af;};}function handleError(_0x2d63a8,_0x456a81){_0x456a81=_0x456a81||0x1f4;return function(_0x4fb77f){logger[_0xebef('0x28')](_0x4fb77f['stack']);if(_0x4fb77f['name']){delete _0x4fb77f['name'];}_0x2d63a8['status'](_0x456a81)['send'](_0x4fb77f);};}exports['show']=function(_0x55732a,_0x5703fc){var _0x506e64={'raw':!![],'where':{'id':_0x55732a['params']['id']}},_0x5a9249={};_0x5a9249[_0xebef('0x29')]=_['keys'](db[_0xebef('0x2a')]['rawAttributes']);_0x5a9249[_0xebef('0x2b')]=_[_0xebef('0x2c')](_0x55732a['query']);_0x5a9249[_0xebef('0x2d')]=_['intersection'](_0x5a9249[_0xebef('0x29')],_0x5a9249[_0xebef('0x2b')]);_0x506e64[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0x5a9249[_0xebef('0x29')],qs[_0xebef('0x30')](_0x55732a['query'][_0xebef('0x30')]));_0x506e64['attributes']=_0x506e64[_0xebef('0x2e')][_0xebef('0x31')]?_0x506e64[_0xebef('0x2e')]:_0x5a9249[_0xebef('0x29')];if(_0x55732a[_0xebef('0x2b')][_0xebef('0x32')]){_0x506e64[_0xebef('0x33')]=[{'all':!![]}];}_0x506e64=_['merge']({},_0x506e64,_0x55732a[_0xebef('0x34')]);return db[_0xebef('0x2a')][_0xebef('0x35')](_0x506e64)[_0xebef('0x25')](handleEntityNotFound(_0x5703fc,null))[_0xebef('0x25')](respondWithResult(_0x5703fc,null))[_0xebef('0x36')](handleError(_0x5703fc,null));};exports[_0xebef('0x24')]=function(_0x48aa2f,_0x53ad2b){if(_0x48aa2f[_0xebef('0x37')]['id']){delete _0x48aa2f['body']['id'];}return db[_0xebef('0x2a')][_0xebef('0x35')]({'where':{'id':_0x48aa2f[_0xebef('0x38')]['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x53ad2b,null))[_0xebef('0x25')](saveUpdates(_0x48aa2f['body'],null))[_0xebef('0x25')](respondWithResult(_0x53ad2b,null))[_0xebef('0x36')](handleError(_0x53ad2b,null));};exports['destroy']=function(_0x5a4750,_0x890f2f){return db['ChatApplication']['find']({'where':{'id':_0x5a4750['params']['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x890f2f,null))['then'](removeEntity(_0x890f2f,null))['catch'](handleError(_0x890f2f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index da8f2b2..4f49a86 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 _0xd239=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd239,0x92));var _0x9d23=function(_0x3fa3d6,_0x36bad1){_0x3fa3d6=_0x3fa3d6-0x0;var _0x9818a2=_0xd239[_0x3fa3d6];return _0x9818a2;};'use strict';var _=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var logger=require(_0x9d23('0x2'))(_0x9d23('0x3'));var moment=require(_0x9d23('0x4'));var BPromise=require(_0x9d23('0x5'));var rp=require(_0x9d23('0x6'));var fs=require('fs');var path=require(_0x9d23('0x7'));var rimraf=require(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var attributes=require(_0x9d23('0xa'));module[_0x9d23('0xb')]=function(_0x204f94,_0x595e14){return _0x204f94[_0x9d23('0xc')]('ChatApplication',attributes,{'tableName':_0x9d23('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9d23('0xe')});}; \ No newline at end of file +var _0x807b=['path','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x11ddae,_0x4b8ae4){var _0x437c1a=function(_0x5ad06f){while(--_0x5ad06f){_0x11ddae['push'](_0x11ddae['shift']());}};_0x437c1a(++_0x4b8ae4);}(_0x807b,0x13f));var _0xb807=function(_0x26d561,_0x32d756){_0x26d561=_0x26d561-0x0;var _0x1c8f0=_0x807b[_0x26d561];return _0x1c8f0;};'use strict';var _=require(_0xb807('0x0'));var util=require(_0xb807('0x1'));var logger=require(_0xb807('0x2'))(_0xb807('0x3'));var moment=require('moment');var BPromise=require(_0xb807('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb807('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb807('0x6'));module[_0xb807('0x7')]=function(_0xa845ff,_0x309df0){return _0xa845ff[_0xb807('0x8')]('ChatApplication',attributes,{'tableName':_0xb807('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb807('0xa'),'collate':_0xb807('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 057fc26..b876b54 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 _0x5184=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x58c825,_0x3899e4){var _0x23d13b=function(_0x486992){while(--_0x486992){_0x58c825['push'](_0x58c825['shift']());}};_0x23d13b(++_0x3899e4);}(_0x5184,0x8c));var _0x4518=function(_0x332c16,_0x30bf3f){_0x332c16=_0x332c16-0x0;var _0x16772d=_0x5184[_0x332c16];return _0x16772d;};'use strict';var _=require(_0x4518('0x0'));var util=require(_0x4518('0x1'));var moment=require(_0x4518('0x2'));var BPromise=require(_0x4518('0x3'));var rs=require(_0x4518('0x4'));var fs=require('fs');var Redis=require(_0x4518('0x5'));var db=require(_0x4518('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4518('0x7'))('rpc');var config=require(_0x4518('0x8'));var jayson=require(_0x4518('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1121da,_0x4c15e7,_0x257789){return new BPromise(function(_0x41376b,_0x2e0b8c){return client[_0x4518('0xa')](_0x1121da,_0x257789)[_0x4518('0xb')](function(_0x1d35d3){logger[_0x4518('0xc')](_0x4518('0xd'),_0x4c15e7,_0x4518('0xe'));logger[_0x4518('0xf')](_0x4518('0x10'),_0x4c15e7,_0x4518('0xe'),JSON[_0x4518('0x11')](_0x1d35d3));if(_0x1d35d3[_0x4518('0x12')]){if(_0x1d35d3[_0x4518('0x12')]['code']===0x1f4){logger[_0x4518('0x12')](_0x4518('0xd'),_0x4c15e7,_0x1d35d3['error'][_0x4518('0x13')]);return _0x2e0b8c(_0x1d35d3['error'][_0x4518('0x13')]);}logger[_0x4518('0x12')](_0x4518('0xd'),_0x4c15e7,_0x1d35d3[_0x4518('0x12')][_0x4518('0x13')]);return _0x41376b(_0x1d35d3[_0x4518('0x12')][_0x4518('0x13')]);}else{logger['info'](_0x4518('0xd'),_0x4c15e7,_0x4518('0xe'));_0x41376b(_0x1d35d3[_0x4518('0x14')][_0x4518('0x13')]);}})[_0x4518('0x15')](function(_0x142717){logger[_0x4518('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4c15e7,_0x142717);_0x2e0b8c(_0x142717);});});} \ No newline at end of file +var _0x61a8=['ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x61a8,0xd6));var _0x861a=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0x61a8[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x861a('0x0'));var util=require(_0x861a('0x1'));var moment=require('moment');var BPromise=require(_0x861a('0x2'));var rs=require(_0x861a('0x3'));var fs=require('fs');var Redis=require(_0x861a('0x4'));var db=require(_0x861a('0x5'))['db'];var utils=require(_0x861a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x861a('0x7')][_0x861a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d42eb,_0x57b874,_0x256d16){return new BPromise(function(_0xb2142e,_0x58ebf3){return client[_0x861a('0x9')](_0x2d42eb,_0x256d16)[_0x861a('0xa')](function(_0x4c30e9){logger[_0x861a('0xb')]('ChatApplication,\x20%s,\x20%s',_0x57b874,_0x861a('0xc'));logger[_0x861a('0xd')](_0x861a('0xe'),_0x57b874,_0x861a('0xc'),JSON[_0x861a('0xf')](_0x4c30e9));if(_0x4c30e9['error']){if(_0x4c30e9['error']['code']===0x1f4){logger[_0x861a('0x10')](_0x861a('0x11'),_0x57b874,_0x4c30e9[_0x861a('0x10')][_0x861a('0x12')]);return _0x58ebf3(_0x4c30e9[_0x861a('0x10')][_0x861a('0x12')]);}logger[_0x861a('0x10')](_0x861a('0x11'),_0x57b874,_0x4c30e9[_0x861a('0x10')][_0x861a('0x12')]);return _0xb2142e(_0x4c30e9[_0x861a('0x10')]['message']);}else{logger['info'](_0x861a('0x11'),_0x57b874,_0x861a('0xc'));_0xb2142e(_0x4c30e9[_0x861a('0x13')]['message']);}})[_0x861a('0x14')](function(_0x56d135){logger[_0x861a('0x10')](_0x861a('0x11'),_0x57b874,_0x56d135);_0x58ebf3(_0x56d135);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index aa41f4a..c172c30 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 _0xcde8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','isAuthenticated','update','exports','util'];(function(_0x9bf6c3,_0x325ba4){var _0x40b074=function(_0x595f33){while(--_0x595f33){_0x9bf6c3['push'](_0x9bf6c3['shift']());}};_0x40b074(++_0x325ba4);}(_0xcde8,0xc3));var _0x8cde=function(_0x36b650,_0x3e68ed){_0x36b650=_0x36b650-0x0;var _0x513cec=_0xcde8[_0x36b650];return _0x513cec;};'use strict';var multer=require('multer');var util=require(_0x8cde('0x0'));var path=require(_0x8cde('0x1'));var timeout=require(_0x8cde('0x2'));var express=require(_0x8cde('0x3'));var router=express[_0x8cde('0x4')]();var fs_extra=require(_0x8cde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8cde('0x6'));var config=require(_0x8cde('0x7'));var controller=require(_0x8cde('0x8'));router['get'](_0x8cde('0x9'),auth['isAuthenticated'](),controller[_0x8cde('0xa')]);router['put'](_0x8cde('0x9'),auth[_0x8cde('0xb')](),controller[_0x8cde('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8cde('0xd')]=router; \ No newline at end of file +var _0xda7b=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','put','update','delete','destroy','exports'];(function(_0x1b0826,_0x5eeb01){var _0x5dd7e5=function(_0x126688){while(--_0x126688){_0x1b0826['push'](_0x1b0826['shift']());}};_0x5dd7e5(++_0x5eeb01);}(_0xda7b,0x99));var _0xbda7=function(_0x2e7fca,_0x593ef5){_0x2e7fca=_0x2e7fca-0x0;var _0x56d7e7=_0xda7b[_0x2e7fca];return _0x56d7e7;};'use strict';var multer=require(_0xbda7('0x0'));var util=require(_0xbda7('0x1'));var path=require(_0xbda7('0x2'));var timeout=require('connect-timeout');var express=require(_0xbda7('0x3'));var router=express[_0xbda7('0x4')]();var fs_extra=require(_0xbda7('0x5'));var auth=require(_0xbda7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbda7('0x7'));var controller=require(_0xbda7('0x8'));router[_0xbda7('0x9')](_0xbda7('0xa'),auth[_0xbda7('0xb')](),controller['show']);router[_0xbda7('0xc')](_0xbda7('0xa'),auth[_0xbda7('0xb')](),controller[_0xbda7('0xd')]);router[_0xbda7('0xe')](_0xbda7('0xa'),auth[_0xbda7('0xb')](),controller[_0xbda7('0xf')]);module[_0xbda7('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 22e5f4e..23c9690 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 _0x204c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x204c,0xdc));var _0xc204=function(_0x75813b,_0x1489e7){_0x75813b=_0x75813b-0x0;var _0x1046e4=_0x204c[_0x75813b];return _0x1046e4;};'use strict';var Sequelize=require(_0xc204('0x0'));module[_0xc204('0x1')]={'name':{'type':Sequelize[_0xc204('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc204('0x2')]},'write':{'type':Sequelize[_0xc204('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd177=['STRING','BOOLEAN'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xd177,0x11e));var _0x7d17=function(_0x5f4216,_0x420201){_0x5f4216=_0x5f4216-0x0;var _0x461715=_0xd177[_0x5f4216];return _0x461715;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7d17('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x7d17('0x0')]},'write':{'type':Sequelize[_0x7d17('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index eda288a..635bfd7 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 _0x2990=['body','params','describe','getUnread','ChatInternalMessage','user','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ChatGroup','includeAll','include','rows','catch','find','create','update'];(function(_0x379f0c,_0x2e609d){var _0x157a60=function(_0x10b1e3){while(--_0x10b1e3){_0x379f0c['push'](_0x379f0c['shift']());}};_0x157a60(++_0x2e609d);}(_0x2990,0x1e4));var _0x0299=function(_0x47f33d,_0x11a7b5){_0x47f33d=_0x47f33d-0x0;var _0x3cbf7b=_0x2990[_0x47f33d];return _0x3cbf7b;};'use strict';var emlformat=require(_0x0299('0x0'));var rimraf=require(_0x0299('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0299('0x2'));var moment=require(_0x0299('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0299('0x4'));var util=require(_0x0299('0x5'));var path=require(_0x0299('0x6'));var sox=require('sox');var csv=require(_0x0299('0x7'));var ejs=require(_0x0299('0x8'));var fs=require('fs');var fs_extra=require(_0x0299('0x9'));var _=require(_0x0299('0xa'));var squel=require(_0x0299('0xb'));var crypto=require(_0x0299('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0299('0xd'));var toCsv=require(_0x0299('0x7'));var querystring=require('querystring');var Papa=require(_0x0299('0xe'));var Redis=require('ioredis');var authService=require(_0x0299('0xf'));var qs=require(_0x0299('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0299('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0299('0x12'));var licenseUtil=require(_0x0299('0x13'));var db=require(_0x0299('0x14'))['db'];config[_0x0299('0x15')]=_[_0x0299('0x16')](config[_0x0299('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0299('0x15')]));require(_0x0299('0x17'))['register'](socket);function respondWithStatusCode(_0x5a0747,_0xb7d36){_0xb7d36=_0xb7d36||0xcc;return function(_0x57ab6a){if(_0x57ab6a){return _0x5a0747[_0x0299('0x18')](_0xb7d36);}return _0x5a0747[_0x0299('0x19')](_0xb7d36)['end']();};}function respondWithResult(_0x4fae29,_0xd31203){_0xd31203=_0xd31203||0xc8;return function(_0x31dc5c){if(_0x31dc5c){return _0x4fae29['status'](_0xd31203)[_0x0299('0x1a')](_0x31dc5c);}};}function respondWithFilteredResult(_0xe1be04,_0x5448c6){return function(_0x253804){if(_0x253804){var _0x1c6ff9=typeof _0x5448c6[_0x0299('0x1b')]===_0x0299('0x1c')&&typeof _0x5448c6[_0x0299('0x1d')]===_0x0299('0x1c');var _0x15cc4c=_0x253804[_0x0299('0x1e')];var _0x423836=_0x1c6ff9?0x0:_0x5448c6[_0x0299('0x1b')];var _0x5dbf4a=_0x1c6ff9?_0x253804['count']:_0x5448c6[_0x0299('0x1b')]+_0x5448c6[_0x0299('0x1d')];var _0x2009b0;if(_0x5dbf4a>=_0x15cc4c){_0x5dbf4a=_0x15cc4c;_0x2009b0=0xc8;}else{_0x2009b0=0xce;}_0xe1be04[_0x0299('0x19')](_0x2009b0);return _0xe1be04[_0x0299('0x1f')](_0x0299('0x20'),_0x423836+'-'+_0x5dbf4a+'/'+_0x15cc4c)[_0x0299('0x1a')](_0x253804);}return null;};}function patchUpdates(_0x139c95){return function(_0x186518){try{jsonpatch[_0x0299('0x21')](_0x186518,_0x139c95,!![]);}catch(_0x29c5e7){return BPromise['reject'](_0x29c5e7);}return _0x186518[_0x0299('0x22')]();};}function saveUpdates(_0xc744f4,_0x35b7ee){return function(_0x5aeb62){if(_0x5aeb62){return _0x5aeb62['update'](_0xc744f4)[_0x0299('0x23')](function(_0x3a687d){return _0x3a687d;});}return null;};}function removeEntity(_0x14134f,_0x28fcad){return function(_0x56e384){if(_0x56e384){return _0x56e384[_0x0299('0x24')]()[_0x0299('0x23')](function(){_0x14134f[_0x0299('0x19')](0xcc)[_0x0299('0x25')]();});}};}function handleEntityNotFound(_0x35892f,_0x1b5d8a){return function(_0x3d79cc){if(!_0x3d79cc){_0x35892f[_0x0299('0x18')](0x194);}return _0x3d79cc;};}function handleError(_0x46a171,_0x29d0a3){_0x29d0a3=_0x29d0a3||0x1f4;return function(_0x19fc0f){logger[_0x0299('0x26')](_0x19fc0f[_0x0299('0x27')]);if(_0x19fc0f[_0x0299('0x28')]){delete _0x19fc0f[_0x0299('0x28')];}_0x46a171[_0x0299('0x19')](_0x29d0a3)[_0x0299('0x29')](_0x19fc0f);};}exports[_0x0299('0x2a')]=function(_0x1a368d,_0x2b8d94){var _0x120391={},_0x1f734={},_0x2ace97={'count':0x0,'rows':[]};var _0x3cfb28=_[_0x0299('0x2b')](db['ChatGroup'][_0x0299('0x2c')],function(_0x2de8ea){return{'name':_0x2de8ea[_0x0299('0x2d')],'type':_0x2de8ea[_0x0299('0x2e')][_0x0299('0x2f')]};});_0x1f734[_0x0299('0x30')]=_[_0x0299('0x2b')](_0x3cfb28,_0x0299('0x28'));_0x1f734['query']=_[_0x0299('0x31')](_0x1a368d[_0x0299('0x32')]);_0x1f734[_0x0299('0x33')]=_[_0x0299('0x34')](_0x1f734[_0x0299('0x30')],_0x1f734[_0x0299('0x32')]);_0x120391['attributes']=_['intersection'](_0x1f734[_0x0299('0x30')],qs[_0x0299('0x35')](_0x1a368d[_0x0299('0x32')][_0x0299('0x35')]));_0x120391['attributes']=_0x120391[_0x0299('0x36')][_0x0299('0x37')]?_0x120391[_0x0299('0x36')]:_0x1f734['model'];if(!_0x1a368d['query'][_0x0299('0x38')](_0x0299('0x39'))){_0x120391[_0x0299('0x1d')]=qs[_0x0299('0x1d')](_0x1a368d['query'][_0x0299('0x1d')]);_0x120391[_0x0299('0x1b')]=qs['offset'](_0x1a368d[_0x0299('0x32')][_0x0299('0x1b')]);}_0x120391[_0x0299('0x3a')]=qs[_0x0299('0x3b')](_0x1a368d[_0x0299('0x32')][_0x0299('0x3b')]);_0x120391[_0x0299('0x3c')]=qs[_0x0299('0x33')](_[_0x0299('0x3d')](_0x1a368d[_0x0299('0x32')],_0x1f734['filters']),_0x3cfb28);if(_0x1a368d[_0x0299('0x32')]['filter']){_0x120391[_0x0299('0x3c')]=_['merge'](_0x120391[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x3cfb28,function(_0x3d7729){if(_0x3d7729[_0x0299('0x2e')]!==_0x0299('0x3e')){var _0x5c7b1b={};_0x5c7b1b[_0x3d7729['name']]={'$like':'%'+_0x1a368d[_0x0299('0x32')][_0x0299('0x3f')]+'%'};return _0x5c7b1b;}})});}_0x120391=_[_0x0299('0x40')]({},_0x120391,_0x1a368d[_0x0299('0x41')]);var _0x1dae9e={'where':_0x120391[_0x0299('0x3c')]};return db[_0x0299('0x42')][_0x0299('0x1e')](_0x1dae9e)[_0x0299('0x23')](function(_0x469cfb){_0x2ace97[_0x0299('0x1e')]=_0x469cfb;if(_0x1a368d[_0x0299('0x32')][_0x0299('0x43')]){_0x120391[_0x0299('0x44')]=[{'all':!![]}];}return db[_0x0299('0x42')]['findAll'](_0x120391);})[_0x0299('0x23')](function(_0xa9ea2a){_0x2ace97[_0x0299('0x45')]=_0xa9ea2a;return _0x2ace97;})['then'](respondWithFilteredResult(_0x2b8d94,_0x120391))[_0x0299('0x46')](handleError(_0x2b8d94,null));};exports['show']=function(_0x224cc1,_0x2f388b){var _0x6b2d45={'raw':!![],'where':{'id':_0x224cc1['params']['id']}},_0xfc7df7={};_0xfc7df7[_0x0299('0x30')]=_['keys'](db['ChatGroup'][_0x0299('0x2c')]);_0xfc7df7[_0x0299('0x32')]=_[_0x0299('0x31')](_0x224cc1['query']);_0xfc7df7[_0x0299('0x33')]=_['intersection'](_0xfc7df7['model'],_0xfc7df7['query']);_0x6b2d45[_0x0299('0x36')]=_[_0x0299('0x34')](_0xfc7df7[_0x0299('0x30')],qs[_0x0299('0x35')](_0x224cc1['query']['fields']));_0x6b2d45[_0x0299('0x36')]=_0x6b2d45[_0x0299('0x36')]['length']?_0x6b2d45[_0x0299('0x36')]:_0xfc7df7[_0x0299('0x30')];if(_0x224cc1[_0x0299('0x32')][_0x0299('0x43')]){_0x6b2d45[_0x0299('0x44')]=[{'all':!![]}];}_0x6b2d45=_[_0x0299('0x40')]({},_0x6b2d45,_0x224cc1[_0x0299('0x41')]);return db[_0x0299('0x42')][_0x0299('0x47')](_0x6b2d45)[_0x0299('0x23')](handleEntityNotFound(_0x2f388b,null))[_0x0299('0x23')](respondWithResult(_0x2f388b,null))['catch'](handleError(_0x2f388b,null));};exports['create']=function(_0x34c77d,_0x427726){return db[_0x0299('0x42')][_0x0299('0x48')](_0x34c77d['body'],{})[_0x0299('0x23')](respondWithResult(_0x427726,0xc9))[_0x0299('0x46')](handleError(_0x427726,null));};exports[_0x0299('0x49')]=function(_0xebc75c,_0x3912e1){if(_0xebc75c['body']['id']){delete _0xebc75c[_0x0299('0x4a')]['id'];}return db['ChatGroup'][_0x0299('0x47')]({'where':{'id':_0xebc75c[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x3912e1,null))['then'](saveUpdates(_0xebc75c[_0x0299('0x4a')],null))[_0x0299('0x23')](respondWithResult(_0x3912e1,null))[_0x0299('0x46')](handleError(_0x3912e1,null));};exports[_0x0299('0x24')]=function(_0x183fce,_0x4f3722){return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x183fce[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x4f3722,null))[_0x0299('0x23')](removeEntity(_0x4f3722,null))[_0x0299('0x46')](handleError(_0x4f3722,null));};exports[_0x0299('0x4c')]=function(_0x5930f6,_0x5691b3){return db[_0x0299('0x42')]['describe']()[_0x0299('0x23')](respondWithResult(_0x5691b3,null))['catch'](handleError(_0x5691b3,null));};exports[_0x0299('0x4d')]=function(_0x23883d,_0x2abc52,_0x460d70){return db[_0x0299('0x4e')][_0x0299('0x1e')]({'where':{'ChatGroupId':_0x23883d['params']['id'],'ToId':_0x23883d[_0x0299('0x4f')]['id'],'read':![]}})[_0x0299('0x23')](function(_0x2b5145){return{'id':_['toInteger'](_0x23883d[_0x0299('0x4b')]['id']),'count':_0x2b5145};})[_0x0299('0x23')](respondWithResult(_0x2abc52,null))[_0x0299('0x46')](handleError(_0x2abc52,null));};exports['addMembers']=function(_0x2beabb,_0x4eb9cf,_0x1b43c2){return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x2beabb['params']['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x4eb9cf,null))[_0x0299('0x23')](function(_0x1d5c53){if(_0x1d5c53){return _0x1d5c53[_0x0299('0x50')](_0x2beabb['body']['ids'],_[_0x0299('0x51')](_0x2beabb[_0x0299('0x4a')],['ids','id'])||{});}})['then'](respondWithResult(_0x4eb9cf,null))[_0x0299('0x46')](handleError(_0x4eb9cf,null));};exports[_0x0299('0x52')]=function(_0x32a425,_0xba3db3,_0x51d4f9){var _0x39b123={};var _0x3cb2b2={};var _0x2ba052;var _0x4e8661;return db[_0x0299('0x42')][_0x0299('0x53')]({'where':{'id':_0x32a425[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0xba3db3,null))['then'](function(_0x4f1f4e){if(_0x4f1f4e){_0x2ba052=_0x4f1f4e;_0x3cb2b2[_0x0299('0x30')]=_[_0x0299('0x31')](db[_0x0299('0x54')][_0x0299('0x2c')]);_0x3cb2b2['query']=_[_0x0299('0x31')](_0x32a425[_0x0299('0x32')]);_0x3cb2b2[_0x0299('0x33')]=_[_0x0299('0x34')](_0x3cb2b2[_0x0299('0x30')],_0x3cb2b2[_0x0299('0x32')]);_0x39b123[_0x0299('0x36')]=_[_0x0299('0x34')](_0x3cb2b2[_0x0299('0x30')],qs[_0x0299('0x35')](_0x32a425[_0x0299('0x32')][_0x0299('0x35')]));_0x39b123[_0x0299('0x36')]=_0x39b123[_0x0299('0x36')][_0x0299('0x37')]?_0x39b123[_0x0299('0x36')]:_0x3cb2b2['model'];_0x39b123[_0x0299('0x3a')]=qs[_0x0299('0x3b')](_0x32a425[_0x0299('0x32')][_0x0299('0x3b')]);_0x39b123['where']=qs['filters'](_[_0x0299('0x3d')](_0x32a425['query'],_0x3cb2b2[_0x0299('0x33')]));if(_0x32a425[_0x0299('0x32')]['filter']){_0x39b123['where']=_['merge'](_0x39b123[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x39b123[_0x0299('0x36')],function(_0x6b68f9){var _0x2eedec={};_0x2eedec[_0x6b68f9]={'$like':'%'+_0x32a425[_0x0299('0x32')]['filter']+'%'};return _0x2eedec;})});}_0x39b123=_[_0x0299('0x40')]({},_0x39b123,_0x32a425[_0x0299('0x41')]);return _0x2ba052['getMembers'](_0x39b123);}})['then'](function(_0x1f5dda){if(_0x1f5dda){_0x4e8661=_0x1f5dda[_0x0299('0x37')];if(!_0x32a425['query'][_0x0299('0x38')](_0x0299('0x39'))){_0x39b123['limit']=qs[_0x0299('0x1d')](_0x32a425[_0x0299('0x32')][_0x0299('0x1d')]);_0x39b123[_0x0299('0x1b')]=qs[_0x0299('0x1b')](_0x32a425[_0x0299('0x32')][_0x0299('0x1b')]);}return _0x2ba052['getMembers'](_0x39b123);}})[_0x0299('0x23')](function(_0x278f6e){if(_0x278f6e){return _0x278f6e?{'count':_0x4e8661,'rows':_0x278f6e}:null;}})[_0x0299('0x23')](respondWithResult(_0xba3db3,null))[_0x0299('0x46')](handleError(_0xba3db3,null));};exports[_0x0299('0x55')]=function(_0x494faa,_0x2a62b7,_0x3537fa){return db[_0x0299('0x42')]['find']({'where':{'id':_0x494faa[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x2a62b7,null))['then'](function(_0x16f61b){if(_0x16f61b){return _0x16f61b[_0x0299('0x55')](_0x494faa[_0x0299('0x32')][_0x0299('0x56')]);}})['then'](respondWithStatusCode(_0x2a62b7,null))[_0x0299('0x46')](handleError(_0x2a62b7,null));};exports[_0x0299('0x57')]=function(_0x2f50de,_0x561bfd,_0x22d9da){if(_0x2f50de[_0x0299('0x4a')]['id']){delete _0x2f50de['body']['id'];}return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x2f50de[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x561bfd,null))['then'](function(_0x4e58bd){if(_0x4e58bd){_0x2f50de[_0x0299('0x4a')][_0x0299('0x58')]=_0x4e58bd['id'];return db[_0x0299('0x4e')][_0x0299('0x48')](_0x2f50de[_0x0299('0x4a')]);}})[_0x0299('0x23')](respondWithResult(_0x561bfd,null))[_0x0299('0x46')](handleError(_0x561bfd,null));};exports[_0x0299('0x59')]=function(_0x358779,_0x3dd631,_0x2825a9){var _0x55927f={};var _0x3b15fb={};var _0xb038cb;var _0x1ff4a8;return db[_0x0299('0x42')][_0x0299('0x53')]({'where':{'id':_0x358779[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x3dd631,null))[_0x0299('0x23')](function(_0x8050be){if(_0x8050be){_0xb038cb=_0x8050be;_0x3b15fb['model']=_[_0x0299('0x31')](db[_0x0299('0x4e')]['rawAttributes']);_0x3b15fb['query']=_[_0x0299('0x31')](_0x358779['query']);_0x3b15fb[_0x0299('0x33')]=_[_0x0299('0x34')](_0x3b15fb[_0x0299('0x30')],_0x3b15fb[_0x0299('0x32')]);_0x55927f[_0x0299('0x36')]=_[_0x0299('0x34')](_0x3b15fb[_0x0299('0x30')],qs[_0x0299('0x35')](_0x358779['query'][_0x0299('0x35')]));_0x55927f['attributes']=_0x55927f[_0x0299('0x36')][_0x0299('0x37')]?_0x55927f[_0x0299('0x36')]:_0x3b15fb[_0x0299('0x30')];_0x55927f['order']=qs['sort'](_0x358779['query']['sort']);_0x55927f[_0x0299('0x3c')]=qs[_0x0299('0x33')](_[_0x0299('0x3d')](_0x358779[_0x0299('0x32')],_0x3b15fb[_0x0299('0x33')]));if(_0x358779['query'][_0x0299('0x3f')]){_0x55927f[_0x0299('0x3c')]=_['merge'](_0x55927f[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x55927f['attributes'],function(_0x172c07){var _0x67f9c1={};_0x67f9c1[_0x172c07]={'$like':'%'+_0x358779['query']['filter']+'%'};return _0x67f9c1;})});}if(_0x358779[_0x0299('0x32')][_0x0299('0x5a')]){var _0x32f4d4=_0x358779[_0x0299('0x32')]['$gte']['split'](',');var _0x30a4ab={};_0x30a4ab[_0x32f4d4[0x0]]={'$gte':moment(_0x32f4d4[0x1])[_0x0299('0x5b')](_0x0299('0x5c'))};_0x55927f[_0x0299('0x3c')]=_[_0x0299('0x40')](_0x55927f[_0x0299('0x3c')],_0x30a4ab);}_0x55927f=_[_0x0299('0x40')]({},_0x55927f,_0x358779[_0x0299('0x41')]);return _0xb038cb[_0x0299('0x59')](_0x55927f);}})[_0x0299('0x23')](function(_0x1db309){if(_0x1db309){_0x1ff4a8=_0x1db309[_0x0299('0x37')];if(!_0x358779[_0x0299('0x32')][_0x0299('0x38')](_0x0299('0x39'))){_0x55927f[_0x0299('0x1d')]=qs[_0x0299('0x1d')](_0x358779[_0x0299('0x32')][_0x0299('0x1d')]);_0x55927f[_0x0299('0x1b')]=qs[_0x0299('0x1b')](_0x358779[_0x0299('0x32')][_0x0299('0x1b')]);}return _0xb038cb[_0x0299('0x59')](_0x55927f);}})[_0x0299('0x23')](function(_0x371355){if(_0x371355){return _0x371355?{'count':_0x1ff4a8,'rows':_0x371355}:null;}})['then'](respondWithResult(_0x3dd631,null))[_0x0299('0x46')](handleError(_0x3dd631,null));}; \ No newline at end of file +var _0x2eed=['offset','undefined','limit','count','Content-Range','json','apply','save','update','then','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','describe','user','toInteger','addMembers','omit','ids','getMembers','User','filter','options','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end'];(function(_0x1948d5,_0x2b2ee9){var _0x4eb7e1=function(_0x994ea8){while(--_0x994ea8){_0x1948d5['push'](_0x1948d5['shift']());}};_0x4eb7e1(++_0x2b2ee9);}(_0x2eed,0x9e));var _0xd2ee=function(_0x3f5aca,_0x21f54c){_0x3f5aca=_0x3f5aca-0x0;var _0x49d5f8=_0x2eed[_0x3f5aca];return _0x49d5f8;};'use strict';var emlformat=require(_0xd2ee('0x0'));var rimraf=require(_0xd2ee('0x1'));var zipdir=require(_0xd2ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2ee('0x3'));var moment=require(_0xd2ee('0x4'));var BPromise=require(_0xd2ee('0x5'));var Mustache=require(_0xd2ee('0x6'));var util=require(_0xd2ee('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd2ee('0x8'));var ejs=require(_0xd2ee('0x9'));var fs=require('fs');var fs_extra=require(_0xd2ee('0xa'));var _=require(_0xd2ee('0xb'));var squel=require('squel');var crypto=require(_0xd2ee('0xc'));var jsforce=require(_0xd2ee('0xd'));var deskjs=require(_0xd2ee('0xe'));var toCsv=require(_0xd2ee('0x8'));var querystring=require('querystring');var Papa=require(_0xd2ee('0xf'));var Redis=require(_0xd2ee('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd2ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2ee('0x12'))(_0xd2ee('0x13'));var utils=require(_0xd2ee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd2ee('0x15'));var db=require(_0xd2ee('0x16'))['db'];config[_0xd2ee('0x17')]=_['defaults'](config['redis'],{'host':_0xd2ee('0x18'),'port':0x18eb});var socket=require(_0xd2ee('0x19'))(new Redis(config['redis']));require(_0xd2ee('0x1a'))[_0xd2ee('0x1b')](socket);function respondWithStatusCode(_0x7107af,_0x453409){_0x453409=_0x453409||0xcc;return function(_0x398dc9){if(_0x398dc9){return _0x7107af['sendStatus'](_0x453409);}return _0x7107af[_0xd2ee('0x1c')](_0x453409)[_0xd2ee('0x1d')]();};}function respondWithResult(_0x3296be,_0x127410){_0x127410=_0x127410||0xc8;return function(_0x1e0ffd){if(_0x1e0ffd){return _0x3296be['status'](_0x127410)['json'](_0x1e0ffd);}};}function respondWithFilteredResult(_0x468e6a,_0x1f3101){return function(_0x535229){if(_0x535229){var _0x3e2df3=typeof _0x1f3101[_0xd2ee('0x1e')]===_0xd2ee('0x1f')&&typeof _0x1f3101[_0xd2ee('0x20')]===_0xd2ee('0x1f');var _0x13a88a=_0x535229[_0xd2ee('0x21')];var _0x46bfea=_0x3e2df3?0x0:_0x1f3101[_0xd2ee('0x1e')];var _0x1a34fc=_0x3e2df3?_0x535229['count']:_0x1f3101[_0xd2ee('0x1e')]+_0x1f3101[_0xd2ee('0x20')];var _0x245ec0;if(_0x1a34fc>=_0x13a88a){_0x1a34fc=_0x13a88a;_0x245ec0=0xc8;}else{_0x245ec0=0xce;}_0x468e6a['status'](_0x245ec0);return _0x468e6a['set'](_0xd2ee('0x22'),_0x46bfea+'-'+_0x1a34fc+'/'+_0x13a88a)[_0xd2ee('0x23')](_0x535229);}return null;};}function patchUpdates(_0x3fbb7d){return function(_0x4415bc){try{jsonpatch[_0xd2ee('0x24')](_0x4415bc,_0x3fbb7d,!![]);}catch(_0x1fd782){return BPromise['reject'](_0x1fd782);}return _0x4415bc[_0xd2ee('0x25')]();};}function saveUpdates(_0x54eade,_0x572823){return function(_0x4d3c72){if(_0x4d3c72){return _0x4d3c72[_0xd2ee('0x26')](_0x54eade)[_0xd2ee('0x27')](function(_0x46b04e){return _0x46b04e;});}return null;};}function removeEntity(_0x4e947d,_0x473818){return function(_0x2d8457){if(_0x2d8457){return _0x2d8457['destroy']()[_0xd2ee('0x27')](function(){_0x4e947d[_0xd2ee('0x1c')](0xcc)[_0xd2ee('0x1d')]();});}};}function handleEntityNotFound(_0x4e3740,_0x2c5b33){return function(_0x4b2675){if(!_0x4b2675){_0x4e3740['sendStatus'](0x194);}return _0x4b2675;};}function handleError(_0x27a19f,_0x16b7c8){_0x16b7c8=_0x16b7c8||0x1f4;return function(_0x297cd5){logger['error'](_0x297cd5[_0xd2ee('0x28')]);if(_0x297cd5[_0xd2ee('0x29')]){delete _0x297cd5[_0xd2ee('0x29')];}_0x27a19f[_0xd2ee('0x1c')](_0x16b7c8)[_0xd2ee('0x2a')](_0x297cd5);};}exports['index']=function(_0x5b09d8,_0x324c58){var _0x47add3={},_0x2e4b45={},_0x2665a6={'count':0x0,'rows':[]};var _0x300d58=_[_0xd2ee('0x2b')](db[_0xd2ee('0x2c')][_0xd2ee('0x2d')],function(_0x1cdecb){return{'name':_0x1cdecb[_0xd2ee('0x2e')],'type':_0x1cdecb[_0xd2ee('0x2f')][_0xd2ee('0x30')]};});_0x2e4b45['model']=_[_0xd2ee('0x2b')](_0x300d58,_0xd2ee('0x29'));_0x2e4b45[_0xd2ee('0x31')]=_[_0xd2ee('0x32')](_0x5b09d8[_0xd2ee('0x31')]);_0x2e4b45['filters']=_[_0xd2ee('0x33')](_0x2e4b45[_0xd2ee('0x34')],_0x2e4b45[_0xd2ee('0x31')]);_0x47add3[_0xd2ee('0x35')]=_[_0xd2ee('0x33')](_0x2e4b45['model'],qs[_0xd2ee('0x36')](_0x5b09d8[_0xd2ee('0x31')][_0xd2ee('0x36')]));_0x47add3[_0xd2ee('0x35')]=_0x47add3[_0xd2ee('0x35')][_0xd2ee('0x37')]?_0x47add3['attributes']:_0x2e4b45['model'];if(!_0x5b09d8[_0xd2ee('0x31')]['hasOwnProperty']('nolimit')){_0x47add3[_0xd2ee('0x20')]=qs['limit'](_0x5b09d8[_0xd2ee('0x31')][_0xd2ee('0x20')]);_0x47add3[_0xd2ee('0x1e')]=qs[_0xd2ee('0x1e')](_0x5b09d8[_0xd2ee('0x31')]['offset']);}_0x47add3[_0xd2ee('0x38')]=qs[_0xd2ee('0x39')](_0x5b09d8[_0xd2ee('0x31')][_0xd2ee('0x39')]);_0x47add3[_0xd2ee('0x3a')]=qs[_0xd2ee('0x3b')](_[_0xd2ee('0x3c')](_0x5b09d8[_0xd2ee('0x31')],_0x2e4b45[_0xd2ee('0x3b')]),_0x300d58);if(_0x5b09d8[_0xd2ee('0x31')]['filter']){_0x47add3[_0xd2ee('0x3a')]=_[_0xd2ee('0x3d')](_0x47add3[_0xd2ee('0x3a')],{'$or':_[_0xd2ee('0x2b')](_0x300d58,function(_0x194f71){if(_0x194f71[_0xd2ee('0x2f')]!==_0xd2ee('0x3e')){var _0x5593df={};_0x5593df[_0x194f71[_0xd2ee('0x29')]]={'$like':'%'+_0x5b09d8[_0xd2ee('0x31')]['filter']+'%'};return _0x5593df;}})});}_0x47add3=_[_0xd2ee('0x3d')]({},_0x47add3,_0x5b09d8['options']);var _0x1fb0f2={'where':_0x47add3['where']};return db['ChatGroup']['count'](_0x1fb0f2)[_0xd2ee('0x27')](function(_0x12498d){_0x2665a6[_0xd2ee('0x21')]=_0x12498d;if(_0x5b09d8[_0xd2ee('0x31')][_0xd2ee('0x3f')]){_0x47add3[_0xd2ee('0x40')]=[{'all':!![]}];}return db[_0xd2ee('0x2c')][_0xd2ee('0x41')](_0x47add3);})['then'](function(_0x18ec7d){_0x2665a6[_0xd2ee('0x42')]=_0x18ec7d;return _0x2665a6;})[_0xd2ee('0x27')](respondWithFilteredResult(_0x324c58,_0x47add3))['catch'](handleError(_0x324c58,null));};exports['show']=function(_0x4c30c1,_0x56e9e2){var _0x4b0897={'raw':!![],'where':{'id':_0x4c30c1[_0xd2ee('0x43')]['id']}},_0x396e6={};_0x396e6['model']=_[_0xd2ee('0x32')](db['ChatGroup'][_0xd2ee('0x2d')]);_0x396e6[_0xd2ee('0x31')]=_['keys'](_0x4c30c1['query']);_0x396e6[_0xd2ee('0x3b')]=_['intersection'](_0x396e6['model'],_0x396e6[_0xd2ee('0x31')]);_0x4b0897[_0xd2ee('0x35')]=_[_0xd2ee('0x33')](_0x396e6[_0xd2ee('0x34')],qs[_0xd2ee('0x36')](_0x4c30c1[_0xd2ee('0x31')][_0xd2ee('0x36')]));_0x4b0897[_0xd2ee('0x35')]=_0x4b0897[_0xd2ee('0x35')][_0xd2ee('0x37')]?_0x4b0897[_0xd2ee('0x35')]:_0x396e6['model'];if(_0x4c30c1['query']['includeAll']){_0x4b0897[_0xd2ee('0x40')]=[{'all':!![]}];}_0x4b0897=_[_0xd2ee('0x3d')]({},_0x4b0897,_0x4c30c1['options']);return db[_0xd2ee('0x2c')][_0xd2ee('0x44')](_0x4b0897)['then'](handleEntityNotFound(_0x56e9e2,null))['then'](respondWithResult(_0x56e9e2,null))[_0xd2ee('0x45')](handleError(_0x56e9e2,null));};exports['create']=function(_0x1176bb,_0x29b5f4){return db[_0xd2ee('0x2c')][_0xd2ee('0x46')](_0x1176bb[_0xd2ee('0x47')],{})[_0xd2ee('0x27')](respondWithResult(_0x29b5f4,0xc9))['catch'](handleError(_0x29b5f4,null));};exports[_0xd2ee('0x26')]=function(_0xab056f,_0x1c8cac){if(_0xab056f[_0xd2ee('0x47')]['id']){delete _0xab056f['body']['id'];}return db[_0xd2ee('0x2c')][_0xd2ee('0x44')]({'where':{'id':_0xab056f[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x1c8cac,null))[_0xd2ee('0x27')](saveUpdates(_0xab056f[_0xd2ee('0x47')],null))['then'](respondWithResult(_0x1c8cac,null))[_0xd2ee('0x45')](handleError(_0x1c8cac,null));};exports[_0xd2ee('0x48')]=function(_0x4da539,_0x4a4fdc){return db['ChatGroup'][_0xd2ee('0x44')]({'where':{'id':_0x4da539[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x4a4fdc,null))['then'](removeEntity(_0x4a4fdc,null))[_0xd2ee('0x45')](handleError(_0x4a4fdc,null));};exports[_0xd2ee('0x49')]=function(_0x5b3774,_0xbe92ba){return db[_0xd2ee('0x2c')]['describe']()[_0xd2ee('0x27')](respondWithResult(_0xbe92ba,null))[_0xd2ee('0x45')](handleError(_0xbe92ba,null));};exports['getUnread']=function(_0x239100,_0x33511a,_0xb11976){return db['ChatInternalMessage'][_0xd2ee('0x21')]({'where':{'ChatGroupId':_0x239100['params']['id'],'ToId':_0x239100[_0xd2ee('0x4a')]['id'],'read':![]}})[_0xd2ee('0x27')](function(_0x2d99d8){return{'id':_[_0xd2ee('0x4b')](_0x239100[_0xd2ee('0x43')]['id']),'count':_0x2d99d8};})['then'](respondWithResult(_0x33511a,null))[_0xd2ee('0x45')](handleError(_0x33511a,null));};exports[_0xd2ee('0x4c')]=function(_0x17c7cf,_0x4170d1,_0x8f6d13){return db[_0xd2ee('0x2c')][_0xd2ee('0x44')]({'where':{'id':_0x17c7cf[_0xd2ee('0x43')]['id']}})['then'](handleEntityNotFound(_0x4170d1,null))[_0xd2ee('0x27')](function(_0x2b56fb){if(_0x2b56fb){return _0x2b56fb[_0xd2ee('0x4c')](_0x17c7cf[_0xd2ee('0x47')]['ids'],_[_0xd2ee('0x4d')](_0x17c7cf['body'],[_0xd2ee('0x4e'),'id'])||{});}})[_0xd2ee('0x27')](respondWithResult(_0x4170d1,null))[_0xd2ee('0x45')](handleError(_0x4170d1,null));};exports[_0xd2ee('0x4f')]=function(_0x22e540,_0x2679cd,_0x19419b){var _0x322a94={};var _0xff2f4b={};var _0x75808a;var _0x2f7d97;return db[_0xd2ee('0x2c')]['findOne']({'where':{'id':_0x22e540[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x2679cd,null))[_0xd2ee('0x27')](function(_0x577e7d){if(_0x577e7d){_0x75808a=_0x577e7d;_0xff2f4b[_0xd2ee('0x34')]=_[_0xd2ee('0x32')](db[_0xd2ee('0x50')][_0xd2ee('0x2d')]);_0xff2f4b[_0xd2ee('0x31')]=_[_0xd2ee('0x32')](_0x22e540[_0xd2ee('0x31')]);_0xff2f4b['filters']=_[_0xd2ee('0x33')](_0xff2f4b[_0xd2ee('0x34')],_0xff2f4b[_0xd2ee('0x31')]);_0x322a94[_0xd2ee('0x35')]=_[_0xd2ee('0x33')](_0xff2f4b[_0xd2ee('0x34')],qs[_0xd2ee('0x36')](_0x22e540[_0xd2ee('0x31')]['fields']));_0x322a94[_0xd2ee('0x35')]=_0x322a94[_0xd2ee('0x35')][_0xd2ee('0x37')]?_0x322a94[_0xd2ee('0x35')]:_0xff2f4b[_0xd2ee('0x34')];_0x322a94[_0xd2ee('0x38')]=qs['sort'](_0x22e540[_0xd2ee('0x31')]['sort']);_0x322a94[_0xd2ee('0x3a')]=qs[_0xd2ee('0x3b')](_[_0xd2ee('0x3c')](_0x22e540[_0xd2ee('0x31')],_0xff2f4b[_0xd2ee('0x3b')]));if(_0x22e540['query'][_0xd2ee('0x51')]){_0x322a94[_0xd2ee('0x3a')]=_['merge'](_0x322a94[_0xd2ee('0x3a')],{'$or':_[_0xd2ee('0x2b')](_0x322a94[_0xd2ee('0x35')],function(_0x683a70){var _0x1f1204={};_0x1f1204[_0x683a70]={'$like':'%'+_0x22e540[_0xd2ee('0x31')]['filter']+'%'};return _0x1f1204;})});}_0x322a94=_[_0xd2ee('0x3d')]({},_0x322a94,_0x22e540[_0xd2ee('0x52')]);return _0x75808a[_0xd2ee('0x4f')](_0x322a94);}})[_0xd2ee('0x27')](function(_0x327782){if(_0x327782){_0x2f7d97=_0x327782[_0xd2ee('0x37')];if(!_0x22e540[_0xd2ee('0x31')]['hasOwnProperty'](_0xd2ee('0x53'))){_0x322a94[_0xd2ee('0x20')]=qs[_0xd2ee('0x20')](_0x22e540[_0xd2ee('0x31')][_0xd2ee('0x20')]);_0x322a94['offset']=qs[_0xd2ee('0x1e')](_0x22e540[_0xd2ee('0x31')][_0xd2ee('0x1e')]);}return _0x75808a['getMembers'](_0x322a94);}})[_0xd2ee('0x27')](function(_0x1a99c9){if(_0x1a99c9){return _0x1a99c9?{'count':_0x2f7d97,'rows':_0x1a99c9}:null;}})[_0xd2ee('0x27')](respondWithResult(_0x2679cd,null))[_0xd2ee('0x45')](handleError(_0x2679cd,null));};exports['removeMembers']=function(_0x3d358f,_0x4fc814,_0x1c1ba3){return db['ChatGroup'][_0xd2ee('0x44')]({'where':{'id':_0x3d358f[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x4fc814,null))[_0xd2ee('0x27')](function(_0x4823c5){if(_0x4823c5){return _0x4823c5[_0xd2ee('0x54')](_0x3d358f['query'][_0xd2ee('0x4e')]);}})[_0xd2ee('0x27')](respondWithStatusCode(_0x4fc814,null))[_0xd2ee('0x45')](handleError(_0x4fc814,null));};exports[_0xd2ee('0x55')]=function(_0x20dccf,_0x586194,_0x3ae578){if(_0x20dccf[_0xd2ee('0x47')]['id']){delete _0x20dccf[_0xd2ee('0x47')]['id'];}return db[_0xd2ee('0x2c')][_0xd2ee('0x44')]({'where':{'id':_0x20dccf[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x586194,null))['then'](function(_0x51de33){if(_0x51de33){_0x20dccf[_0xd2ee('0x47')][_0xd2ee('0x56')]=_0x51de33['id'];return db[_0xd2ee('0x57')][_0xd2ee('0x46')](_0x20dccf[_0xd2ee('0x47')]);}})['then'](respondWithResult(_0x586194,null))[_0xd2ee('0x45')](handleError(_0x586194,null));};exports[_0xd2ee('0x58')]=function(_0x25f75e,_0x1c33e4,_0x4e71a8){var _0x567551={};var _0x43674d={};var _0x2dd033;var _0x4f52ad;return db[_0xd2ee('0x2c')][_0xd2ee('0x59')]({'where':{'id':_0x25f75e[_0xd2ee('0x43')]['id']}})[_0xd2ee('0x27')](handleEntityNotFound(_0x1c33e4,null))[_0xd2ee('0x27')](function(_0x4a162d){if(_0x4a162d){_0x2dd033=_0x4a162d;_0x43674d[_0xd2ee('0x34')]=_['keys'](db[_0xd2ee('0x57')]['rawAttributes']);_0x43674d['query']=_['keys'](_0x25f75e[_0xd2ee('0x31')]);_0x43674d[_0xd2ee('0x3b')]=_['intersection'](_0x43674d[_0xd2ee('0x34')],_0x43674d['query']);_0x567551[_0xd2ee('0x35')]=_['intersection'](_0x43674d[_0xd2ee('0x34')],qs[_0xd2ee('0x36')](_0x25f75e['query'][_0xd2ee('0x36')]));_0x567551[_0xd2ee('0x35')]=_0x567551[_0xd2ee('0x35')][_0xd2ee('0x37')]?_0x567551['attributes']:_0x43674d[_0xd2ee('0x34')];_0x567551[_0xd2ee('0x38')]=qs[_0xd2ee('0x39')](_0x25f75e['query'][_0xd2ee('0x39')]);_0x567551[_0xd2ee('0x3a')]=qs['filters'](_[_0xd2ee('0x3c')](_0x25f75e['query'],_0x43674d[_0xd2ee('0x3b')]));if(_0x25f75e[_0xd2ee('0x31')][_0xd2ee('0x51')]){_0x567551[_0xd2ee('0x3a')]=_[_0xd2ee('0x3d')](_0x567551['where'],{'$or':_[_0xd2ee('0x2b')](_0x567551['attributes'],function(_0x4a786a){var _0x2ffb91={};_0x2ffb91[_0x4a786a]={'$like':'%'+_0x25f75e[_0xd2ee('0x31')][_0xd2ee('0x51')]+'%'};return _0x2ffb91;})});}if(_0x25f75e[_0xd2ee('0x31')][_0xd2ee('0x5a')]){var _0x3ed558=_0x25f75e['query'][_0xd2ee('0x5a')][_0xd2ee('0x5b')](',');var _0x3a5f40={};_0x3a5f40[_0x3ed558[0x0]]={'$gte':moment(_0x3ed558[0x1])[_0xd2ee('0x5c')](_0xd2ee('0x5d'))};_0x567551[_0xd2ee('0x3a')]=_[_0xd2ee('0x3d')](_0x567551[_0xd2ee('0x3a')],_0x3a5f40);}_0x567551=_[_0xd2ee('0x3d')]({},_0x567551,_0x25f75e['options']);return _0x2dd033[_0xd2ee('0x58')](_0x567551);}})[_0xd2ee('0x27')](function(_0x18abee){if(_0x18abee){_0x4f52ad=_0x18abee['length'];if(!_0x25f75e[_0xd2ee('0x31')]['hasOwnProperty']('nolimit')){_0x567551[_0xd2ee('0x20')]=qs['limit'](_0x25f75e[_0xd2ee('0x31')]['limit']);_0x567551[_0xd2ee('0x1e')]=qs[_0xd2ee('0x1e')](_0x25f75e[_0xd2ee('0x31')][_0xd2ee('0x1e')]);}return _0x2dd033[_0xd2ee('0x58')](_0x567551);}})['then'](function(_0x8e6cde){if(_0x8e6cde){return _0x8e6cde?{'count':_0x4f52ad,'rows':_0x8e6cde}:null;}})[_0xd2ee('0x27')](respondWithResult(_0x1c33e4,null))[_0xd2ee('0x45')](handleError(_0x1c33e4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 14aa68e..ef9def8 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 _0xea21=['exports','setMaxListeners','save','remove','emit','hook'];(function(_0x363799,_0x338533){var _0x4114a3=function(_0x190b13){while(--_0x190b13){_0x363799['push'](_0x363799['shift']());}};_0x4114a3(++_0x338533);}(_0xea21,0x109));var _0x1ea2=function(_0x3eb476,_0x5e49e9){_0x3eb476=_0x3eb476-0x0;var _0x4f3dc3=_0xea21[_0x3eb476];return _0x4f3dc3;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1ea2('0x0')](0x0);var events={'afterCreate':_0x1ea2('0x1'),'afterUpdate':'update','afterDestroy':_0x1ea2('0x2')};function emitEvent(_0x5ab549){return function(_0x1f425f,_0x5c7852,_0x44e926){ChatGroupEvents[_0x1ea2('0x3')](_0x5ab549+':'+_0x1f425f['id'],_0x1f425f);ChatGroupEvents[_0x1ea2('0x3')](_0x5ab549,_0x1f425f);_0x44e926(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x1ea2('0x4')](e,emitEvent(event));}}module[_0x1ea2('0x5')]=ChatGroupEvents; \ No newline at end of file +var _0xed3e=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x283176,_0x19ea6e){var _0x573b13=function(_0x10e221){while(--_0x10e221){_0x283176['push'](_0x283176['shift']());}};_0x573b13(++_0x19ea6e);}(_0xed3e,0xf0));var _0xeed3=function(_0x192a1c,_0x2b4937){_0x192a1c=_0x192a1c-0x0;var _0x1f0d94=_0xed3e[_0x192a1c];return _0x1f0d94;};'use strict';var EventEmitter=require(_0xeed3('0x0'));var ChatGroup=require(_0xeed3('0x1'))['db'][_0xeed3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xeed3('0x3')](0x0);var events={'afterCreate':_0xeed3('0x4'),'afterUpdate':_0xeed3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x271fe2){return function(_0x1bf2d7,_0x25be3e,_0xbef652){ChatGroupEvents[_0xeed3('0x6')](_0x271fe2+':'+_0x1bf2d7['id'],_0x1bf2d7);ChatGroupEvents[_0xeed3('0x6')](_0x271fe2,_0x1bf2d7);_0xbef652(null);};}for(var e in events){if(events[_0xeed3('0x7')](e)){var event=events[e];ChatGroup[_0xeed3('0x8')](e,emitEvent(event));}}module[_0xeed3('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f13103c..0e58233 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 _0x366e=['rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x366e,0x130));var _0xe366=function(_0xa4bc34,_0x4b8774){_0xa4bc34=_0xa4bc34-0x0;var _0xea4df9=_0x366e[_0xa4bc34];return _0xea4df9;};'use strict';var _=require(_0xe366('0x0'));var util=require(_0xe366('0x1'));var logger=require(_0xe366('0x2'))(_0xe366('0x3'));var moment=require(_0xe366('0x4'));var BPromise=require(_0xe366('0x5'));var rp=require(_0xe366('0x6'));var fs=require('fs');var path=require(_0xe366('0x7'));var rimraf=require(_0xe366('0x8'));var config=require('../../config/environment');var attributes=require(_0xe366('0x9'));module['exports']=function(_0x1609f2,_0x4fb17a){return _0x1609f2[_0xe366('0xa')](_0xe366('0xb'),attributes,{'tableName':_0xe366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22a7=['rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3767fe,_0x207ed9){var _0x288159=function(_0x48e317){while(--_0x48e317){_0x3767fe['push'](_0x3767fe['shift']());}};_0x288159(++_0x207ed9);}(_0x22a7,0x6e));var _0x722a=function(_0x5be1d6,_0x52ab2a){_0x5be1d6=_0x5be1d6-0x0;var _0x5d9bd4=_0x22a7[_0x5be1d6];return _0x5d9bd4;};'use strict';var _=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var logger=require(_0x722a('0x2'))('api');var moment=require(_0x722a('0x3'));var BPromise=require(_0x722a('0x4'));var rp=require(_0x722a('0x5'));var fs=require('fs');var path=require(_0x722a('0x6'));var rimraf=require(_0x722a('0x7'));var config=require(_0x722a('0x8'));var attributes=require(_0x722a('0x9'));module[_0x722a('0xa')]=function(_0x59f569,_0x3c0688){return _0x59f569['define'](_0x722a('0xb'),attributes,{'tableName':_0x722a('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 2e38fc4..e47dccd 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 _0xe57e=['result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x5cb228,_0x248994){var _0x241818=function(_0x1ec3da){while(--_0x1ec3da){_0x5cb228['push'](_0x5cb228['shift']());}};_0x241818(++_0x248994);}(_0xe57e,0xf2));var _0xee57=function(_0x3c0a47,_0x474d78){_0x3c0a47=_0x3c0a47-0x0;var _0xb46a81=_0xe57e[_0x3c0a47];return _0xb46a81;};'use strict';var _=require(_0xee57('0x0'));var util=require('util');var moment=require(_0xee57('0x1'));var BPromise=require(_0xee57('0x2'));var rs=require(_0xee57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee57('0x4'));var logger=require('../../config/logger')(_0xee57('0x5'));var config=require(_0xee57('0x6'));var jayson=require(_0xee57('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xee57('0x8')]=_[_0xee57('0x9')](config[_0xee57('0x8')],{'host':_0xee57('0xa'),'port':0x18eb});var socket=require(_0xee57('0xb'))(new Redis(config[_0xee57('0x8')]));require(_0xee57('0xc'))['register'](socket);function respondWithRpcPromise(_0x571f54,_0x195956,_0x3bbe45){return new BPromise(function(_0x3a9422,_0x39428b){return client[_0xee57('0xd')](_0x571f54,_0x3bbe45)[_0xee57('0xe')](function(_0x6a8687){logger['info']('ChatGroup,\x20%s,\x20%s',_0x195956,_0xee57('0xf'));logger[_0xee57('0x10')](_0xee57('0x11'),_0x195956,_0xee57('0xf'),JSON[_0xee57('0x12')](_0x6a8687));if(_0x6a8687['error']){if(_0x6a8687[_0xee57('0x13')]['code']===0x1f4){logger[_0xee57('0x13')]('ChatGroup,\x20%s,\x20%s',_0x195956,_0x6a8687[_0xee57('0x13')]['message']);return _0x39428b(_0x6a8687['error'][_0xee57('0x14')]);}logger[_0xee57('0x13')](_0xee57('0x15'),_0x195956,_0x6a8687[_0xee57('0x13')]['message']);return _0x3a9422(_0x6a8687[_0xee57('0x13')][_0xee57('0x14')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x195956,'request\x20sent');_0x3a9422(_0x6a8687[_0xee57('0x16')]['message']);}})[_0xee57('0x17')](function(_0x3f202f){logger[_0xee57('0x13')](_0xee57('0x15'),_0x195956,_0x3f202f);_0x39428b(_0x3f202f);});});} \ No newline at end of file +var _0xe5f7=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x20a031,_0x154d0d){var _0x587265=function(_0x5ca3eb){while(--_0x5ca3eb){_0x20a031['push'](_0x20a031['shift']());}};_0x587265(++_0x154d0d);}(_0xe5f7,0x178));var _0x7e5f=function(_0x1d8dba,_0x218d53){_0x1d8dba=_0x1d8dba-0x0;var _0x532a14=_0xe5f7[_0x1d8dba];return _0x532a14;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var moment=require(_0x7e5f('0x2'));var BPromise=require(_0x7e5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e5f('0x4'))['db'];var utils=require(_0x7e5f('0x5'));var logger=require(_0x7e5f('0x6'))('rpc');var config=require(_0x7e5f('0x7'));var jayson=require(_0x7e5f('0x8'));var client=jayson['client'][_0x7e5f('0x9')]({'port':0x232a});config[_0x7e5f('0xa')]=_[_0x7e5f('0xb')](config[_0x7e5f('0xa')],{'host':_0x7e5f('0xc'),'port':0x18eb});var socket=require(_0x7e5f('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x7e5f('0xe')](socket);function respondWithRpcPromise(_0x1fec12,_0x313706,_0x1900d8){return new BPromise(function(_0x3844af,_0x218e50){return client[_0x7e5f('0xf')](_0x1fec12,_0x1900d8)[_0x7e5f('0x10')](function(_0x23a476){logger[_0x7e5f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x313706,_0x7e5f('0x12'));logger['debug'](_0x7e5f('0x13'),_0x313706,_0x7e5f('0x12'),JSON[_0x7e5f('0x14')](_0x23a476));if(_0x23a476[_0x7e5f('0x15')]){if(_0x23a476[_0x7e5f('0x15')][_0x7e5f('0x16')]===0x1f4){logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0x23a476[_0x7e5f('0x15')][_0x7e5f('0x18')]);return _0x218e50(_0x23a476['error'][_0x7e5f('0x18')]);}logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0x23a476[_0x7e5f('0x15')]['message']);return _0x3844af(_0x23a476['error']['message']);}else{logger[_0x7e5f('0x11')](_0x7e5f('0x17'),_0x313706,'request\x20sent');_0x3844af(_0x23a476[_0x7e5f('0x19')][_0x7e5f('0x18')]);}})[_0x7e5f('0x1a')](function(_0xd97c29){logger[_0x7e5f('0x15')](_0x7e5f('0x17'),_0x313706,_0xd97c29);_0x218e50(_0xd97c29);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1e16d48..bd608a6 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 _0x8e96=['chatGroup:','./chatGroup.events','save','update','removeListener','register'];(function(_0x3a6fe3,_0x10240c){var _0x1c44ad=function(_0x26fab7){while(--_0x26fab7){_0x3a6fe3['push'](_0x3a6fe3['shift']());}};_0x1c44ad(++_0x10240c);}(_0x8e96,0x127));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x68e9('0x0'));var events=[_0x68e9('0x1'),'remove',_0x68e9('0x2')];function createListener(_0x2a80e1,_0x5d16ae){return function(_0x4cc136){_0x5d16ae['emit'](_0x2a80e1,_0x4cc136);};}function removeListener(_0x296e78,_0x40f5bc){return function(){ChatGroupEvents[_0x68e9('0x3')](_0x296e78,_0x40f5bc);};}exports[_0x68e9('0x4')]=function(_0x18996f){for(var _0x54af40=0x0,_0x3f3457=events['length'];_0x54af40<_0x3f3457;_0x54af40++){var _0x571123=events[_0x54af40];var _0x495315=createListener(_0x68e9('0x5')+_0x571123,_0x18996f);ChatGroupEvents['on'](_0x571123,_0x495315);}}; \ No newline at end of file +var _0x5d6e=['remove','update','emit','removeListener','length','chatGroup:','./chatGroup.events','save'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x5d6e,0xfe));var _0xe5d6=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x5d6e[_0x50e7e0];return _0x1a0307;};'use strict';var ChatGroupEvents=require(_0xe5d6('0x0'));var events=[_0xe5d6('0x1'),_0xe5d6('0x2'),_0xe5d6('0x3')];function createListener(_0x4e550b,_0xa8881f){return function(_0x2777e6){_0xa8881f[_0xe5d6('0x4')](_0x4e550b,_0x2777e6);};}function removeListener(_0x4d8e18,_0x521056){return function(){ChatGroupEvents[_0xe5d6('0x5')](_0x4d8e18,_0x521056);};}exports['register']=function(_0x319f83){for(var _0x157c66=0x0,_0x5e348f=events[_0xe5d6('0x6')];_0x157c66<_0x5e348f;_0x157c66++){var _0x29d7ab=events[_0x157c66];var _0x1df81c=createListener(_0xe5d6('0x7')+_0x29d7ab,_0x319f83);ChatGroupEvents['on'](_0x29d7ab,_0x1df81c);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c8b9659..72741f0 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 _0xd9a6=['/describe','describe','/:id','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x3eeab9,_0x2ed501){var _0x4a15=function(_0x46b513){while(--_0x46b513){_0x3eeab9['push'](_0x3eeab9['shift']());}};_0x4a15(++_0x2ed501);}(_0xd9a6,0x127));var _0x6d9a=function(_0x5876b6,_0x2bcc96){_0x5876b6=_0x5876b6-0x0;var _0xfc6c5e=_0xd9a6[_0x5876b6];return _0xfc6c5e;};'use strict';var multer=require(_0x6d9a('0x0'));var util=require(_0x6d9a('0x1'));var path=require(_0x6d9a('0x2'));var timeout=require(_0x6d9a('0x3'));var express=require('express');var router=express[_0x6d9a('0x4')]();var fs_extra=require(_0x6d9a('0x5'));var auth=require(_0x6d9a('0x6'));var interaction=require(_0x6d9a('0x7'));var config=require(_0x6d9a('0x8'));var controller=require(_0x6d9a('0x9'));router[_0x6d9a('0xa')]('/',auth[_0x6d9a('0xb')](),controller[_0x6d9a('0xc')]);router['get'](_0x6d9a('0xd'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0xe')]);router[_0x6d9a('0xa')](_0x6d9a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d9a('0xa')](_0x6d9a('0x10'),auth[_0x6d9a('0xb')](),controller['getUnread']);router[_0x6d9a('0xa')](_0x6d9a('0x11'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x12')]);router[_0x6d9a('0xa')](_0x6d9a('0x13'),auth['isAuthenticated'](),controller[_0x6d9a('0x14')]);router['post']('/',auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x15')]);router[_0x6d9a('0x16')](_0x6d9a('0x11'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x17')]);router[_0x6d9a('0x16')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d9a('0x18')]);router[_0x6d9a('0x19')](_0x6d9a('0xf'),auth[_0x6d9a('0xb')](),controller['update']);router[_0x6d9a('0x1a')](_0x6d9a('0xf'),auth[_0x6d9a('0xb')](),controller['destroy']);router[_0x6d9a('0x1a')](_0x6d9a('0x11'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x6d9a('0x1b')]=router; \ No newline at end of file +var _0x023d=['fs-extra','get','isAuthenticated','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','connect-timeout','express','Router'];(function(_0x588ead,_0x224d24){var _0x12a8f7=function(_0x2ec3a7){while(--_0x2ec3a7){_0x588ead['push'](_0x588ead['shift']());}};_0x12a8f7(++_0x224d24);}(_0x023d,0x1df));var _0xd023=function(_0x1cc3eb,_0x1e26f9){_0x1cc3eb=_0x1cc3eb-0x0;var _0x3ac1c9=_0x023d[_0x1cc3eb];return _0x3ac1c9;};'use strict';var multer=require(_0xd023('0x0'));var util=require(_0xd023('0x1'));var path=require('path');var timeout=require(_0xd023('0x2'));var express=require(_0xd023('0x3'));var router=express[_0xd023('0x4')]();var fs_extra=require(_0xd023('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0xd023('0x6')]('/',auth[_0xd023('0x7')](),controller['index']);router[_0xd023('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xd023('0x8'),auth[_0xd023('0x7')](),controller['show']);router[_0xd023('0x6')](_0xd023('0x9'),auth[_0xd023('0x7')](),controller[_0xd023('0xa')]);router['get'](_0xd023('0xb'),auth['isAuthenticated'](),controller[_0xd023('0xc')]);router[_0xd023('0x6')](_0xd023('0xd'),auth[_0xd023('0x7')](),controller['getMessages']);router[_0xd023('0xe')]('/',auth[_0xd023('0x7')](),controller['create']);router[_0xd023('0xe')](_0xd023('0xb'),auth[_0xd023('0x7')](),controller[_0xd023('0xf')]);router['post']('/:id/messages',auth[_0xd023('0x7')](),controller[_0xd023('0x10')]);router['put'](_0xd023('0x8'),auth[_0xd023('0x7')](),controller[_0xd023('0x11')]);router[_0xd023('0x12')]('/:id',auth[_0xd023('0x7')](),controller[_0xd023('0x13')]);router[_0xd023('0x12')](_0xd023('0xb'),auth[_0xd023('0x7')](),controller[_0xd023('0x14')]);module[_0xd023('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 578cca2..4441471 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 _0xd2bf=['sequelize','ENUM','star','TEXT','STRING','DATE','long','out','BOOLEAN'];(function(_0x474f57,_0x37252e){var _0x31f92f=function(_0x144d8e){while(--_0x144d8e){_0x474f57['push'](_0x474f57['shift']());}};_0x31f92f(++_0x37252e);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xd2bf[_0x4450b1];return _0x399b0b;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xfd2b('0x1')](_0xfd2b('0x2'),'thumb'),'defaultValue':_0xfd2b('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xfd2b('0x3')]},'mailTranscript':{'type':Sequelize[_0xfd2b('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfd2b('0x5')]},'disposition':{'type':Sequelize[_0xfd2b('0x4')]},'secondDisposition':{'type':Sequelize[_0xfd2b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfd2b('0x4')]},'browserName':{'type':Sequelize[_0xfd2b('0x4')]},'browserVersion':{'type':Sequelize[_0xfd2b('0x4')]},'osName':{'type':Sequelize[_0xfd2b('0x4')]},'osVersion':{'type':Sequelize[_0xfd2b('0x4')]},'deviceModel':{'type':Sequelize[_0xfd2b('0x4')]},'deviceVendor':{'type':Sequelize[_0xfd2b('0x4')]},'deviceType':{'type':Sequelize[_0xfd2b('0x4')]},'referer':{'type':Sequelize[_0xfd2b('0x3')]},'customerIp':{'type':Sequelize[_0xfd2b('0x4')]},'formData':{'type':Sequelize[_0xfd2b('0x3')](_0xfd2b('0x6'))},'read1stAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfd2b('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfd2b('0x4')]},'customerPort':{'type':Sequelize[_0xfd2b('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xfd2b('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xa062=['star','thumb','TEXT','STRING','out','sequelize','exports','BOOLEAN','ENUM'];(function(_0x172250,_0x2bef4a){var _0x421bcd=function(_0xb5bd17){while(--_0xb5bd17){_0x172250['push'](_0x172250['shift']());}};_0x421bcd(++_0x2bef4a);}(_0xa062,0x101));var _0x2a06=function(_0x291d65,_0x25bc0b){_0x291d65=_0x291d65-0x0;var _0x59e8f0=_0xa062[_0x291d65];return _0x59e8f0;};'use strict';var Sequelize=require(_0x2a06('0x0'));module[_0x2a06('0x1')]={'closed':{'type':Sequelize[_0x2a06('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x2a06('0x3')](_0x2a06('0x4'),_0x2a06('0x5')),'defaultValue':_0x2a06('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x2a06('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2a06('0x7')]},'secondDisposition':{'type':Sequelize[_0x2a06('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2a06('0x7')]},'note':{'type':Sequelize[_0x2a06('0x7')]},'browserName':{'type':Sequelize[_0x2a06('0x7')]},'browserVersion':{'type':Sequelize[_0x2a06('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2a06('0x7')]},'deviceModel':{'type':Sequelize[_0x2a06('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x2a06('0x7')]},'referer':{'type':Sequelize[_0x2a06('0x6')]},'customerIp':{'type':Sequelize[_0x2a06('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2a06('0x3')]('in',_0x2a06('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2a06('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x2a06('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x2a06('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 be6a9f3..3b2ed65 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 _0x0d8c=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','end','sendStatus','stack','name','send','render','merge','body','agent','interaction','account','map','fullname','TagIds','split','forEach','Tags','push','waiting','talking','unmanaged','abandoned','closed','UserId','disposition','answered','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','cm_contacts','users','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','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','keyBy','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.*','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','Messages','User','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','format','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','getMessages','hasOwnProperty','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','includeAgent','setTags','ids','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','Chat','N.A.','osName','referer','customerPort','existsSync','createReadStream','pipe','createWriteStream','out'];(function(_0x3ef984,_0x3f5981){var _0x578b03=function(_0x112d2f){while(--_0x112d2f){_0x3ef984['push'](_0x3ef984['shift']());}};_0x578b03(++_0x3f5981);}(_0x0d8c,0x14c));var _0xc0d8=function(_0x1d77d0,_0x41d470){_0x1d77d0=_0x1d77d0-0x0;var _0x513c2a=_0x0d8c[_0x1d77d0];return _0x513c2a;};'use strict';var emlformat=require(_0xc0d8('0x0'));var rimraf=require(_0xc0d8('0x1'));var zipdir=require(_0xc0d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0d8('0x3'));var moment=require(_0xc0d8('0x4'));var BPromise=require(_0xc0d8('0x5'));var Mustache=require('mustache');var util=require(_0xc0d8('0x6'));var path=require('path');var sox=require(_0xc0d8('0x7'));var csv=require(_0xc0d8('0x8'));var ejs=require(_0xc0d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc0d8('0xa'));var crypto=require('crypto');var jsforce=require(_0xc0d8('0xb'));var deskjs=require(_0xc0d8('0xc'));var toCsv=require(_0xc0d8('0x8'));var querystring=require('querystring');var Papa=require(_0xc0d8('0xd'));var Redis=require(_0xc0d8('0xe'));var authService=require(_0xc0d8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc0d8('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0d8('0x11'))(_0xc0d8('0x12'));var utils=require(_0xc0d8('0x13'));var config=require(_0xc0d8('0x14'));var licenseUtil=require(_0xc0d8('0x15'));var db=require('../../mysqldb')['db'];config[_0xc0d8('0x16')]=_[_0xc0d8('0x17')](config[_0xc0d8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc0d8('0x18'))(new Redis(config[_0xc0d8('0x16')]));require(_0xc0d8('0x19'))[_0xc0d8('0x1a')](socket);var jayson=require(_0xc0d8('0x1b'));var client=jayson['client'][_0xc0d8('0x1c')]({'port':0x232b});var client9004=jayson[_0xc0d8('0x1d')][_0xc0d8('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x7653f1,_0x26dd0d,_0x32f727,_0x24747b){return new BPromise(function(_0x23807e,_0x246972){var _0x44e2c7=_0x24747b||client;return _0x44e2c7[_0xc0d8('0x1e')](_0x7653f1,_0x32f727)[_0xc0d8('0x1f')](function(_0x55b5fd){logger[_0xc0d8('0x20')](_0xc0d8('0x21'),_0x26dd0d,_0xc0d8('0x22'));logger[_0xc0d8('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x26dd0d,_0xc0d8('0x22'),JSON['stringify'](_0x55b5fd));if(_0x55b5fd[_0xc0d8('0x24')]){if(_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x25')]===0x1f4){logger[_0xc0d8('0x24')](_0xc0d8('0x21'),_0x26dd0d,_0x55b5fd[_0xc0d8('0x24')]['message']);return _0x246972(_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x26')]);}logger['error'](_0xc0d8('0x21'),_0x26dd0d,_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x26')]);return _0x23807e(_0x55b5fd[_0xc0d8('0x24')]['message']);}else{logger[_0xc0d8('0x20')](_0xc0d8('0x21'),_0x26dd0d,_0xc0d8('0x22'));_0x23807e(_0x55b5fd[_0xc0d8('0x27')][_0xc0d8('0x26')]);}})[_0xc0d8('0x28')](function(_0x42994a){logger[_0xc0d8('0x24')](_0xc0d8('0x21'),_0x26dd0d,_0x42994a);_0x246972(_0x42994a);});});}function respondWithStatusCode(_0x1e66b6,_0xd759b2){_0xd759b2=_0xd759b2||0xcc;return function(_0x410d08){if(_0x410d08){return _0x1e66b6['sendStatus'](_0xd759b2);}return _0x1e66b6[_0xc0d8('0x29')](_0xd759b2)['end']();};}function respondWithResult(_0xa50e52,_0x55afb7){_0x55afb7=_0x55afb7||0xc8;return function(_0x35adf8){if(_0x35adf8){return _0xa50e52[_0xc0d8('0x29')](_0x55afb7)[_0xc0d8('0x2a')](_0x35adf8);}};}function respondWithFilteredResult(_0x51cc16,_0x560ed5){return function(_0x2bbe4b){if(_0x2bbe4b){var _0x1ecbeb=typeof _0x560ed5['offset']===_0xc0d8('0x2b')&&typeof _0x560ed5[_0xc0d8('0x2c')]==='undefined';var _0x38fcc3=_0x2bbe4b[_0xc0d8('0x2d')];var _0x59f5b6=_0x1ecbeb?0x0:_0x560ed5[_0xc0d8('0x2e')];var _0x1125b4=_0x1ecbeb?_0x2bbe4b['count']:_0x560ed5['offset']+_0x560ed5['limit'];var _0x1885f8;if(_0x1125b4>=_0x38fcc3){_0x1125b4=_0x38fcc3;_0x1885f8=0xc8;}else{_0x1885f8=0xce;}_0x51cc16[_0xc0d8('0x29')](_0x1885f8);return _0x51cc16[_0xc0d8('0x2f')](_0xc0d8('0x30'),_0x59f5b6+'-'+_0x1125b4+'/'+_0x38fcc3)[_0xc0d8('0x2a')](_0x2bbe4b);}return null;};}function patchUpdates(_0x4c4114){return function(_0x6f8a99){try{jsonpatch[_0xc0d8('0x31')](_0x6f8a99,_0x4c4114,!![]);}catch(_0x214275){return BPromise[_0xc0d8('0x32')](_0x214275);}return _0x6f8a99[_0xc0d8('0x33')]();};}function saveUpdates(_0x5afadf,_0x4de64a){return function(_0x5acc03){if(_0x5acc03){return _0x5acc03['update'](_0x5afadf)[_0xc0d8('0x1f')](function(_0x850ee7){return _0x850ee7;});}return null;};}function removeEntity(_0x6b98e9,_0x559e6f){return function(_0x45e186){if(_0x45e186){return _0x45e186['destroy']()['then'](function(){_0x6b98e9[_0xc0d8('0x29')](0xcc)[_0xc0d8('0x34')]();});}};}function handleEntityNotFound(_0x335338,_0x5b80ec){return function(_0x1b51dc){if(!_0x1b51dc){_0x335338[_0xc0d8('0x35')](0x194);}return _0x1b51dc;};}function handleError(_0x283abc,_0xe0dd7c){_0xe0dd7c=_0xe0dd7c||0x1f4;return function(_0x54541b){logger[_0xc0d8('0x24')](_0x54541b[_0xc0d8('0x36')]);if(_0x54541b[_0xc0d8('0x37')]){delete _0x54541b[_0xc0d8('0x37')];}_0x283abc[_0xc0d8('0x29')](_0xe0dd7c)[_0xc0d8('0x38')](_0x54541b);};}function getMustacheRender(_0x4b2b57,_0x580637){return Mustache[_0xc0d8('0x39')](_0x4b2b57,_[_0xc0d8('0x3a')](_0x580637[_0xc0d8('0x3b')],{'contact':_0x580637['contact'],'message':_0x580637[_0xc0d8('0x26')],'agent':_0x580637[_0xc0d8('0x3c')],'interaction':_0x580637[_0xc0d8('0x3d')],'account':_0x580637[_0xc0d8('0x3e')]}))||'';}function getInteractionUsers(_0x266776,_0x53e5f3){return new BPromise(function(_0x300c49,_0x33159a){try{if(_0x53e5f3[_0x266776['id']]){_0x266776['Users']=_[_0xc0d8('0x3f')](_0x53e5f3[_0x266776['id']],function(_0x3de5bd){return{'id':_0x3de5bd['id'],'fullname':_0x3de5bd[_0xc0d8('0x40')]};});}}catch(_0x4dadf7){_0x33159a(_0x4dadf7);}_0x300c49(_0x266776);});}function getInteractionTags(_0x293b9b,_0x43f237){return new BPromise(function(_0x40990f,_0x4a8059){try{if(_0x293b9b['TagIds']){_0x293b9b['Tags']=[];_0x293b9b[_0xc0d8('0x41')][_0xc0d8('0x42')](',')[_0xc0d8('0x43')](function(_0x235474){_0x293b9b[_0xc0d8('0x44')][_0xc0d8('0x45')](_0x43f237[_0x235474]);});}delete _0x293b9b[_0xc0d8('0x41')];}catch(_0x4c928d){_0x4a8059(_0x4c928d);}_0x40990f(_0x293b9b);});}function updateChatInteraction(_0xf5ec3d,_0x59493f,_0x4324e5){return new BPromise(function(_0x113ddb,_0x1a7664){return getInteractionUsers(_0xf5ec3d,_0x4324e5)[_0xc0d8('0x1f')](function(_0x340f74){return getInteractionTags(_0x340f74,_0x59493f);})['then'](function(_0x190f41){return getStateInteraction(_0x190f41);})[_0xc0d8('0x1f')](function(_0x252182){_0x113ddb(_0x252182);})[_0xc0d8('0x28')](function(_0x533a80){_0x1a7664(_0x533a80);});});}function getStateInteraction(_0x536ca0){return new BPromise(function(_0x3c31e2){_0x536ca0[_0xc0d8('0x46')]=0x0;_0x536ca0[_0xc0d8('0x47')]=0x0;_0x536ca0['answered']=0x0;_0x536ca0[_0xc0d8('0x48')]=0x0;_0x536ca0[_0xc0d8('0x49')]=0x0;_0x536ca0['total']=0x0;if(!_0x536ca0[_0xc0d8('0x4a')]&&!_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x46')]+=0x1;}if(!_0x536ca0['closed']&&_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x47')]+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}if(_0x536ca0[_0xc0d8('0x4a')]&&_0x536ca0[_0xc0d8('0x4c')]===_0xc0d8('0x49')){_0x536ca0['abandoned']+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}else if(_0x536ca0[_0xc0d8('0x4a')]&&!_0x536ca0['UserId']&&_0x536ca0[_0xc0d8('0x4c')]){_0x536ca0[_0xc0d8('0x48')]+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}else if(_0x536ca0[_0xc0d8('0x4a')]&&_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x4d')]+=0x1;if(_0x536ca0[_0xc0d8('0x47')]){_0x536ca0[_0xc0d8('0x47')]-=0x1;}}_0x536ca0['total']+=0x1;_0x3c31e2(_0x536ca0);});}exports[_0xc0d8('0x4e')]=function(_0x72120a,_0x1856b7){var _0x368422={},_0x4e4ac2={},_0xa40b67={'count':0x0,'rows':[]};var _0xb3b161=_[_0xc0d8('0x3f')](db[_0xc0d8('0x4f')][_0xc0d8('0x50')],function(_0x416768){return{'name':_0x416768[_0xc0d8('0x51')],'type':_0x416768['type'][_0xc0d8('0x52')]};});_0x4e4ac2[_0xc0d8('0x53')]=_['map'](_0xb3b161,_0xc0d8('0x37'));_0x4e4ac2[_0xc0d8('0x54')]=_[_0xc0d8('0x55')](_0x72120a['query']);_0x4e4ac2[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x4e4ac2[_0xc0d8('0x53')],_0x4e4ac2[_0xc0d8('0x54')]);_0x368422['attributes']=_[_0xc0d8('0x57')](_0x4e4ac2[_0xc0d8('0x53')],qs[_0xc0d8('0x58')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x58')]));_0x368422[_0xc0d8('0x59')]=_0x368422[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x368422[_0xc0d8('0x59')]:_0x4e4ac2[_0xc0d8('0x53')];if(!_0x72120a[_0xc0d8('0x54')]['hasOwnProperty'](_0xc0d8('0x5b'))){_0x368422[_0xc0d8('0x2c')]=qs[_0xc0d8('0x2c')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x2c')]);_0x368422['offset']=qs['offset'](_0x72120a['query'][_0xc0d8('0x2e')]);}_0x368422['order']=qs[_0xc0d8('0x5c')](_0x72120a[_0xc0d8('0x54')]['sort']);_0x368422[_0xc0d8('0x5d')]=qs['filters'](_['pick'](_0x72120a[_0xc0d8('0x54')],_0x4e4ac2[_0xc0d8('0x56')]),_0xb3b161);var _0x52ef49=[];var _0x23954e=squel[_0xc0d8('0x5e')]()[_0xc0d8('0x5f')]('id')['field'](_0xc0d8('0x37'))[_0xc0d8('0x5f')]('color')[_0xc0d8('0x60')](_0xc0d8('0x61'));var _0x2f3fc9=squel['select']()['field']('u.id')[_0xc0d8('0x5f')](_0xc0d8('0x62'))[_0xc0d8('0x5f')](_0xc0d8('0x63'))[_0xc0d8('0x60')](_0xc0d8('0x64'),'ui')[_0xc0d8('0x65')]('users','u','u.id\x20=\x20ui.UserId');var _0x2cd1f4=squel['select']()[_0xc0d8('0x60')]('chat_interactions','i')[_0xc0d8('0x65')](_0xc0d8('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc0d8('0x65')](_0xc0d8('0x67'),'o',_0xc0d8('0x68'))[_0xc0d8('0x65')](_0xc0d8('0x69'),'a',_0xc0d8('0x6a'))['left_join'](_0xc0d8('0x6b'),'me',_0xc0d8('0x6c'))[_0xc0d8('0x65')](_0xc0d8('0x6d'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xc0d8('0x65')](_0xc0d8('0x61'),'t',_0xc0d8('0x6e'));var _0x5cd56d=squel['expr']();var _0x11a4dc=[];var _0x582b72=squel['expr']();var _0x1323c7;if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x6f')]){_0x1323c7=as[_0xc0d8('0x70')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x6f')]);var _0x36130f=_0x1323c7[_0xc0d8('0x71')];for(var _0x3d55f0=0x0;_0x3d55f0<_0x1323c7['conditions'][_0xc0d8('0x5a')];_0x3d55f0++){var _0x3d255a=_0x1323c7[_0xc0d8('0x72')][_0x3d55f0];var _0x186c59='i';var _0x3e05b5=_[_0xc0d8('0x73')](_0xb3b161,[_0xc0d8('0x37'),_0x3d255a[_0xc0d8('0x5f')]]);if(!_0x3e05b5){switch(_0x3d255a['field']){case _0xc0d8('0x74'):if(_0x3d255a['value']==0x1){_0x2cd1f4[_0xc0d8('0x75')]('`'+_0x3d255a['field']+'`\x20=\x200');}else{_0x2cd1f4[_0xc0d8('0x75')]('`'+_0x3d255a[_0xc0d8('0x5f')]+_0xc0d8('0x76'));}break;case _0xc0d8('0x77'):if(_0x3d255a[_0xc0d8('0x78')]===_0xc0d8('0x79')){if(_0x3d255a[_0xc0d8('0x7a')][_0xc0d8('0x42')]('\x20')[_0xc0d8('0x5a')]>0x1){_0x5cd56d[_0x36130f](_0xc0d8('0x7b'),qs[_0xc0d8('0x7c')](_0x3d255a[_0xc0d8('0x7a')]),null);}else{var _0x15dfa3='%'+_0x3d255a[_0xc0d8('0x7a')]+'%';_0x5cd56d[_0x36130f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x15dfa3,_0x15dfa3,_0x15dfa3);}}else{_0x3e05b5=_['find'](_0xb3b161,[_0xc0d8('0x37'),_0xc0d8('0x7d')]);_0x3d255a[_0xc0d8('0x5f')]=_0xc0d8('0x7d');_0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5[_0xc0d8('0x7f')],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc[_0xc0d8('0x80')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x34')]);}break;case _0xc0d8('0x82'):var _0x25b240=_0x3d255a[_0xc0d8('0x7a')][_0xc0d8('0x42')](',')[_0xc0d8('0x3f')](function(_0x4eb3a7){return Number(_0x4eb3a7);});_0x25b240[_0xc0d8('0x43')](function(_0x253870){_0x582b72['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x253870+',%');});_0x11a4dc=_['union'](_0x11a4dc,_0x25b240);break;case'User':if(_0x3d255a[_0xc0d8('0x78')]===_0xc0d8('0x79')){_0x5cd56d[_0x36130f](_0xc0d8('0x83'),'%'+_0x3d255a['value']+'%',null);}else{_0x3e05b5=_[_0xc0d8('0x73')](_0xb3b161,['name',_0xc0d8('0x4b')]);_0x3d255a[_0xc0d8('0x5f')]=_0xc0d8('0x4b');_0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5[_0xc0d8('0x7f')],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc['text'],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc['value'][_0xc0d8('0x34')]);}break;case _0xc0d8('0x3b'):_0x1366fc=as['buildExpression']('me',null,_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc['text'],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc[_0xc0d8('0x7a')]['end']);break;}}else{var _0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5['type'],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc[_0xc0d8('0x80')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc['value']['end']);}}}else{var _0x29f242=_(_0x72120a[_0xc0d8('0x54')])[_0xc0d8('0x55')]()[_0xc0d8('0x3f')](function(_0x515559){return _[_0xc0d8('0x84')](_0xb3b161,[_0xc0d8('0x37'),_0x515559])?_0x515559:undefined;})[_0xc0d8('0x85')]()[_0xc0d8('0x7a')]();if(!_[_0xc0d8('0x86')](_0x29f242)){_0x29f242[_0xc0d8('0x43')](function(_0x166527){if(_0x166527==='ChatWebsiteId'){_0x2cd1f4['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xc0d8('0x87')](_0x72120a[_0xc0d8('0x54')][_0x166527]));}else if(_0x166527==='createdAt'){var _0x183a96=JSON[_0xc0d8('0x88')](_0x72120a[_0xc0d8('0x54')][_0x166527])['$gte'];var _0x35ee66=JSON['parse'](_0x72120a[_0xc0d8('0x54')][_0x166527])[_0xc0d8('0x89')];_0x2cd1f4[_0xc0d8('0x5d')](_0xc0d8('0x8a'),_0x183a96,_0x35ee66);}else{if(_0x72120a[_0xc0d8('0x54')][_0x166527]===_0xc0d8('0x8b')){_0x2cd1f4[_0xc0d8('0x5d')]('i.'+_0x166527+_0xc0d8('0x8c'));}else{_0x2cd1f4['where']('i.'+_0x166527+_0xc0d8('0x8d'),_0x72120a[_0xc0d8('0x54')][_0x166527]);}}});}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x8e')]){if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x8e')]==0x1){_0x2cd1f4[_0xc0d8('0x75')](_0xc0d8('0x8f'));}else{_0x2cd1f4['having']('`unreadMessages`\x20>\x200');}}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x90')]){_0x11a4dc=_[_0xc0d8('0x91')](_0x72120a['query'][_0xc0d8('0x90')])?_0x72120a['query'][_0xc0d8('0x90')]:new Array(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x90')]);_0x11a4dc['forEach'](function(_0x348db9){_0x582b72['or'](_0xc0d8('0x92'),'%,'+_0x348db9+',%');});}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x93')]){var _0x351a46=_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x93')]['replace']('\x5c','\x5c\x5c')[_0xc0d8('0x94')](/'/g,'\x27\x27');if(qs[_0xc0d8('0x95')](_0x351a46)){_0x5cd56d['or'](_0xc0d8('0x96'),_0x351a46+'%');}else{_0x5cd56d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc0d8('0x7c')](_0x351a46))['or'](_0xc0d8('0x97'),_0x351a46+'%');}}}_0x2cd1f4[_0xc0d8('0x5d')](_0x5cd56d);_0x2cd1f4['group'](_0xc0d8('0x98'));var _0x413ae0={'type':db[_0xc0d8('0x99')][_0xc0d8('0x9a')]['SELECT'],'raw':!![]};var _0xa10665=_0x2cd1f4[_0xc0d8('0x9b')]();_0xa10665['field'](_0xc0d8('0x98'));_0xa10665[_0xc0d8('0x5f')](_0xc0d8('0x9c'),'unreadMessages');if(_0x368422[_0xc0d8('0x9d')]){_0x368422[_0xc0d8('0x9d')][_0xc0d8('0x43')](function(_0x196d3b){var _0x28f673=_0x196d3b[0x0]==='contactName'?_0x196d3b[0x0]:'i.'+_0x196d3b[0x0];_0x2cd1f4[_0xc0d8('0x9d')](_0x28f673,_0x196d3b[0x1]===_0xc0d8('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x11a4dc)){_0x2cd1f4['having'](_0x582b72);_0xa10665[_0xc0d8('0x5d')](_0xc0d8('0x9f'),_0x11a4dc);}BPromise[_0xc0d8('0xa0')]()['then'](function(){if(!_0x1323c7){if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0xa1')])return;_0xa10665['where'](_0xc0d8('0xa2'));_0x2cd1f4[_0xc0d8('0x5d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x72120a['user']['role']!==_0xc0d8('0x3c'))return;return _0x72120a[_0xc0d8('0xa3')][_0xc0d8('0xa4')]({'attributes':['id'],'raw':!![]})[_0xc0d8('0x1f')](function(_0x4db77a){if(_[_0xc0d8('0x86')](_0x4db77a)){_0xa10665['where'](_0xc0d8('0xa5'));_0x2cd1f4['where'](_0xc0d8('0xa5'));}else{_0xa10665[_0xc0d8('0x5d')](_0xc0d8('0xa6'),_[_0xc0d8('0x3f')](_0x4db77a,'id'));_0x2cd1f4[_0xc0d8('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xc0d8('0x3f')](_0x4db77a,'id'));}});})[_0xc0d8('0x1f')](function(){if(_0x72120a[_0xc0d8('0xa3')][_0xc0d8('0xa7')]===_0xc0d8('0x3c')&&!_0x1323c7&&!_0x72120a[_0xc0d8('0x54')]['ChatWebsiteId'])return[];return db[_0xc0d8('0xa8')]['query'](_0xa10665[_0xc0d8('0xa9')](),_0x413ae0);})[_0xc0d8('0x1f')](function(_0x2a5974){_0xa40b67[_0xc0d8('0x2d')]=_0x2a5974[_0xc0d8('0x5a')];if(_0xa40b67[_0xc0d8('0x2d')]===0x0)return[];return db[_0xc0d8('0xa8')]['query'](_0x23954e[_0xc0d8('0xa9')](),_0x413ae0)[_0xc0d8('0x1f')](function(_0x174749){_0x52ef49=_[_0xc0d8('0xaa')](_0x174749,'id');_0x413ae0=_['merge'](_0x413ae0,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x72120a['query'][_0xc0d8('0x58')]){_0x368422['attributes']['forEach'](function(_0xff93f7){_0x2cd1f4[_0xc0d8('0x5f')]('i.'+_0xff93f7);});}else{_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0x9c'),_0xc0d8('0x74'));_0x2cd1f4[_0xc0d8('0x5f')]('a.key','Account.key');_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xab'),_0xc0d8('0xac'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xad'),_0xc0d8('0xae'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xaf'));_0x2cd1f4[_0xc0d8('0x5f')]('c.firstName','Contact.firstName');_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb0'),_0xc0d8('0xb1'));_0x2cd1f4['field']('c.email',_0xc0d8('0xb2'));_0x2cd1f4[_0xc0d8('0x5f')]('c.phone','Contact.phone');_0x2cd1f4['field'](_0xc0d8('0xb3'),_0xc0d8('0xb4'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb5'),_0xc0d8('0xb6'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb7'),_0xc0d8('0xb8'));_0x2cd1f4['field'](_0xc0d8('0xb9'),_0xc0d8('0xba'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xbb'),_0xc0d8('0x41'));}if(_0x368422['limit'])_0x2cd1f4[_0xc0d8('0x2c')](_0x368422[_0xc0d8('0x2c')]);if(_0x368422['offset'])_0x2cd1f4[_0xc0d8('0x2e')](_0x368422[_0xc0d8('0x2e')]);return db[_0xc0d8('0xa8')]['query'](_0x2cd1f4[_0xc0d8('0xa9')](),_0x413ae0);})[_0xc0d8('0x1f')](function(_0x1ceabf){if(_0x1ceabf[_0xc0d8('0x5a')]>0x0)_0x2f3fc9[_0xc0d8('0x5d')](_0xc0d8('0xbc'),_[_0xc0d8('0x3f')](_0x1ceabf,'id'));return db[_0xc0d8('0xa8')]['query'](_0x2f3fc9['toString'](),_0x413ae0)['then'](function(_0x1f4ade){var _0x1f730a=_[_0xc0d8('0xbd')](_0x1f4ade,_0xc0d8('0xbe'));var _0xc34450=[];_0x1ceabf['forEach'](function(_0x1cd6ac){_0xc34450[_0xc0d8('0x45')](updateChatInteraction(_0x1cd6ac,_0x52ef49,_0x1f730a));});return BPromise['all'](_0xc34450);});});})['then'](function(_0x4fd044){_0xa40b67[_0xc0d8('0xbf')]=_0x4fd044;return _0xa40b67;})[_0xc0d8('0x1f')](respondWithFilteredResult(_0x1856b7,_0x368422))[_0xc0d8('0x28')](handleError(_0x1856b7,null));};exports[_0xc0d8('0xc0')]=function(_0x668035,_0x7a8a9a){var _0x4976e4={'raw':![],'where':{'id':_0x668035[_0xc0d8('0xc1')]['id']}},_0x93f5ce={};_0x93f5ce[_0xc0d8('0x53')]=_[_0xc0d8('0x55')](db[_0xc0d8('0x4f')][_0xc0d8('0x50')]);_0x93f5ce['query']=_[_0xc0d8('0x55')](_0x668035[_0xc0d8('0x54')]);_0x93f5ce[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x93f5ce[_0xc0d8('0x53')],_0x93f5ce['query']);_0x4976e4['attributes']=_[_0xc0d8('0x57')](_0x93f5ce[_0xc0d8('0x53')],qs['fields'](_0x668035[_0xc0d8('0x54')][_0xc0d8('0x58')]));_0x4976e4['attributes']=_0x4976e4[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x4976e4[_0xc0d8('0x59')]:_0x93f5ce[_0xc0d8('0x53')];if(_0x668035['query'][_0xc0d8('0xc2')]){_0x4976e4['include']=[{'all':!![]}];}_0x4976e4=_[_0xc0d8('0x3a')]({},_0x4976e4,_0x668035[_0xc0d8('0xc3')]);return db['ChatInteraction'][_0xc0d8('0x73')](_0x4976e4)[_0xc0d8('0x1f')](handleEntityNotFound(_0x7a8a9a,null))[_0xc0d8('0x1f')](respondWithResult(_0x7a8a9a,null))[_0xc0d8('0x28')](handleError(_0x7a8a9a,null));};exports['create']=function(_0x3f646d,_0x2aea4f){return db[_0xc0d8('0x4f')][_0xc0d8('0xc4')](_0x3f646d['body'],{})['then'](respondWithResult(_0x2aea4f,0xc9))[_0xc0d8('0x28')](handleError(_0x2aea4f,null));};exports[_0xc0d8('0xc5')]=function(_0x25f30d,_0x253a1b){if(_0x25f30d['body']['id']){delete _0x25f30d[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x25f30d[_0xc0d8('0xc1')]['id']}})['then'](handleEntityNotFound(_0x253a1b,null))[_0xc0d8('0x1f')](saveUpdates(_0x25f30d[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](respondWithResult(_0x253a1b,null))[_0xc0d8('0x28')](handleError(_0x253a1b,null));};exports['destroy']=function(_0x535156,_0x137332){return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x535156[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x137332,null))[_0xc0d8('0x1f')](removeEntity(_0x137332,null))['catch'](handleError(_0x137332,null));};exports[_0xc0d8('0xc6')]=function(_0x41ed4c,_0x56495f){return db[_0xc0d8('0x4f')][_0xc0d8('0xc6')]()[_0xc0d8('0x1f')](respondWithResult(_0x56495f,null))[_0xc0d8('0x28')](handleError(_0x56495f,null));};exports[_0xc0d8('0xc7')]=function(_0x343099,_0x214008){var _0x5618c1=_0x343099[_0xc0d8('0xc1')]['id'];var _0x1c2ef5;var _0x422351;var _0x1b0e1a;return db['ChatInteraction'][_0xc0d8('0xc8')]({'where':{'id':_0x5618c1}})[_0xc0d8('0x1f')](function(_0x41e72c){_0x1c2ef5=_0x41e72c;return db[_0xc0d8('0xc9')][_0xc0d8('0xc8')]({'where':{'id':_0x41e72c[_0xc0d8('0xa1')]},'attributes':['id',_0xc0d8('0xca'),_0xc0d8('0xcb'),_0xc0d8('0xcc'),_0xc0d8('0xcd'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x55e497){if(_0x55e497&&_0x55e497[_0xc0d8('0xca')]&&_0x55e497[_0xc0d8('0xcb')]){_0x422351=_0x55e497;var _0x32b693={'interaction':{'id':_0x5618c1},'agent':{'id':_0x343099[_0xc0d8('0xa3')]['id'],'name':_0x343099['user'][_0xc0d8('0x37')],'fullname':_0x343099[_0xc0d8('0xa3')][_0xc0d8('0x40')],'email':_0x343099[_0xc0d8('0xa3')][_0xc0d8('0xce')]},'contact':_0x343099[_0xc0d8('0x3b')][_0xc0d8('0xcf')],'account':_0x343099[_0xc0d8('0x3b')][_0xc0d8('0x3e')]};var _0xbddfe={'rejectUnauthorized':![],'method':_0xc0d8('0xd0'),'url':_0xc0d8('0xd1'),'headers':{'X-APIKEY':_0x55e497[_0xc0d8('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x343099[_0xc0d8('0xa3')]['email']],'buttons':null,'topic':_0x422351[_0xc0d8('0xcc')],'note':_[_0xc0d8('0xd2')](_0x422351[_0xc0d8('0xcd')])?null:getMustacheRender(_0x422351[_0xc0d8('0xcd')],_0x32b693),'metadata':null},'redirect':_0xc0d8('0xd3'),'json':!![]};try{if(!_[_0xc0d8('0xd2')](_0x422351[_0xc0d8('0xd4')])){var _0x176ea1=getMustacheRender(_0x422351['vidaooMetadata'],_0x32b693);var _0x915f19=JSON[_0xc0d8('0x88')](_0x176ea1);_0xbddfe[_0xc0d8('0x3b')][_0xc0d8('0xd5')]=_0x915f19;}}catch(_0x52338f){throw new db[(_0xc0d8('0x99'))][(_0xc0d8('0xd6'))](_0xc0d8('0xd7'));}return rp(_0xbddfe);}else{throw new db[(_0xc0d8('0x99'))][(_0xc0d8('0xd6'))](_0xc0d8('0xd8'));}})[_0xc0d8('0x1f')](function(_0x162aab){_0x1b0e1a=_0x162aab;if(_0x1b0e1a['id']){var _0x2cb1e8={'body':_0x1b0e1a[_0xc0d8('0xd9')],'ChatWebsiteId':_0x422351['id'],'ChatInteractionId':_0x1c2ef5['id'],'direction':'out','UserId':_0x343099[_0xc0d8('0xa3')]['id']};return db[_0xc0d8('0xda')][_0xc0d8('0xc4')](_0x2cb1e8,{});}else{throw new db['Sequelize'][(_0xc0d8('0xd6'))](_0xc0d8('0xdb'));}})[_0xc0d8('0x1f')](function(){return _0x1c2ef5[_0xc0d8('0xdc')]({'vidaooSessionId':_0x1b0e1a['id']});})[_0xc0d8('0x1f')](respondWithResult(_0x214008,null))[_0xc0d8('0x28')](handleError(_0x214008,null));};exports[_0xc0d8('0xdd')]=function(_0x63a229,_0x175cca){if(_0x63a229[_0xc0d8('0x3b')]['id']){delete _0x63a229[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x63a229[_0xc0d8('0xc1')]['id']},'include':[{'model':db[_0xc0d8('0xde')],'as':_0xc0d8('0x77')}]})['then'](handleEntityNotFound(_0x175cca,null))['then'](saveUpdates(_0x63a229[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](respondWithResult(_0x175cca,null))[_0xc0d8('0x28')](handleError(_0x175cca,null));};exports[_0xc0d8('0xdf')]=function(_0x1881f4,_0x1398eb,_0x26c1ae){if(_0x1881f4[_0xc0d8('0x3b')]['id']){delete _0x1881f4[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x1881f4[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](function(_0x26459f){if(!_0x26459f){logger['error'](_0xc0d8('0xe0'),'abandon',0x194,_0xc0d8('0xe1'));_0x1398eb[_0xc0d8('0x35')](0x194);}else{if(_0x26459f['UserId']){throw new db['Sequelize'][(_0xc0d8('0xd6'))](_0xc0d8('0xe2'));}}return _0x26459f;})[_0xc0d8('0x1f')](function(_0x2e34a9){if(_0x2e34a9){return _0x2e34a9[_0xc0d8('0xc5')]({'closed':_0x1881f4[_0xc0d8('0x3b')][_0xc0d8('0x4a')],'disposition':_0x1881f4['body'][_0xc0d8('0x4c')]})['then'](function(_0x21c889){return _0x21c889;});}})[_0xc0d8('0x1f')](function(_0x7b3bae){return respondWithRpcPromise(_0xc0d8('0xe3'),_0xc0d8('0xdf'),_0x1881f4[_0xc0d8('0x3b')],client9004);})['then'](respondWithResult(_0x1398eb,null))[_0xc0d8('0x28')](handleError(_0x1398eb,null));};exports[_0xc0d8('0xe4')]=function(_0x2748ef,_0x50fa73,_0x52f5c8){_0x2748ef[_0xc0d8('0x3b')]['name']=_0x2748ef[_0xc0d8('0xe5')][_0xc0d8('0xe6')];_0x2748ef[_0xc0d8('0x3b')][_0xc0d8('0xe7')]=_0x2748ef[_0xc0d8('0xe5')][_0xc0d8('0xe8')];_0x2748ef[_0xc0d8('0x3b')]['type']=_0x2748ef['file']['mimetype'];return db['Attachment']['create'](_0x2748ef[_0xc0d8('0x3b')])[_0xc0d8('0x1f')](respondWithResult(_0x50fa73,0xc9))[_0xc0d8('0x28')](handleError(_0x50fa73,null));};exports[_0xc0d8('0xe9')]=function(_0x396bce,_0x24a15d,_0x351a2e){return db[_0xc0d8('0x4f')][_0xc0d8('0xc8')]({'where':{'id':_0x396bce['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x24a15d,null))[_0xc0d8('0x1f')](function(_0x2ebea7){if(_0x2ebea7){if(_0x2ebea7[_0xc0d8('0x4a')]){return _0x24a15d['status'](0x193)[_0xc0d8('0x2a')]({'status':0x193,'message':_0xc0d8('0xea')});}return db[_0xc0d8('0xeb')]['findOne']({'where':{'id':_0x396bce[_0xc0d8('0x54')][_0xc0d8('0xec')]},'raw':!![]})[_0xc0d8('0x1f')](handleEntityNotFound(_0x24a15d,null));}})['then'](function(_0x40dcef){if(_0x40dcef){var _0x42da29=_0x40dcef[_0xc0d8('0xed')]!==null;var _0x39b3e6=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0xf0'));if(_0x42da29){_0x39b3e6=path[_0xc0d8('0xee')](_0x39b3e6,_0xc0d8('0xf1'));}var _0xa7497b=path[_0xc0d8('0xee')](_0x39b3e6,_0x40dcef[_0xc0d8('0xe7')]);return _0x24a15d[_0xc0d8('0xf2')](_0xa7497b);}})[_0xc0d8('0x28')](handleError(_0x24a15d,null));};exports[_0xc0d8('0xf3')]=function(_0x57181c,_0x276e7b){var _0x1509d2=null;var _0x5c4006=null;var _0x4de817=null;var _0x241868=null;if(_0x57181c['body']['id']){delete _0x57181c[_0xc0d8('0x3b')]['id'];}if(_0x57181c[_0xc0d8('0x3b')]['mailTranscript']){_0x241868=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0xf4'),util['format'](_0xc0d8('0xf5'),Date['now']()));_0x57181c[_0xc0d8('0x3b')]['pathTranscript']=_0x241868;}return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x57181c[_0xc0d8('0xc1')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xc0d8('0xf6'),'include':[{'model':db['User'],'as':_0xc0d8('0xf7')}]}]})[_0xc0d8('0x1f')](handleEntityNotFound(_0x276e7b,null))[_0xc0d8('0x1f')](saveUpdates(_0x57181c[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](function(_0x4bf2b3){if(_0x4bf2b3){_0x1509d2=_0x4bf2b3;return db['ChatWebsite'][_0xc0d8('0x73')]({'where':{'id':_0x1509d2['ChatWebsiteId']}});}})[_0xc0d8('0x1f')](function(_0x4c8b77){if(_0x4c8b77){_0x4de817=_0x4c8b77;return db[_0xc0d8('0xde')][_0xc0d8('0x73')]({'where':{'id':_0x1509d2['ContactId']}});}})[_0xc0d8('0x1f')](function(_0x3c17e3){if(_0x3c17e3){_0x5c4006=_0x3c17e3;if(_0x241868){var _0x518448=null;for(var _0x186e2a=0x1;_0x186e2a<_0x1509d2[_0xc0d8('0xf6')][_0xc0d8('0x5a')];++_0x186e2a){_0x518448=_0x1509d2[_0xc0d8('0xf6')][_0x186e2a];var _0x226b28=_0x518448[_0xc0d8('0x4b')]?util['format'](_0xc0d8('0xf8'),_0x4de817[_0xc0d8('0xf9')],_0x518448[_0xc0d8('0x4b')]):_0xc0d8('0xfa');var _0x247cab=_0x57181c[_0xc0d8('0x3b')][_0xc0d8('0xfb')]||util['format'](_0xc0d8('0xf8'),_0xc0d8('0xfc'),_0x518448[_0xc0d8('0x7d')]);switch(_0x4de817[_0xc0d8('0xfd')]){case _0xc0d8('0xfe'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?util['format']('%s%d',_0x4de817[_0xc0d8('0xf9')],_0x518448['UserId']):_0xc0d8('0xfa');break;case _0xc0d8('0xff'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?_0x518448[_0xc0d8('0xf7')][_0xc0d8('0x100')]||_0x518448[_0xc0d8('0xf7')]['fullname']:_0xc0d8('0xfa');break;case _0xc0d8('0x101'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?_0x518448[_0xc0d8('0xf7')][_0xc0d8('0x40')]:_0xc0d8('0xfa');break;default:_0x226b28=_0x518448[_0xc0d8('0x4b')]?util[_0xc0d8('0x102')](_0xc0d8('0xf8'),_0x4de817[_0xc0d8('0xf9')],_0x518448[_0xc0d8('0x4b')]):_0xc0d8('0xfa');}var _0xddb44c=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x518448['createdAt'])[_0xc0d8('0x102')]('MM/DD/YYYY\x20HH:mm:ss'),_0x518448[_0xc0d8('0x103')]==='in'?_0x247cab:_0x226b28,_0x518448[_0xc0d8('0x3b')]);if(!_0x518448[_0xc0d8('0x104')]){fs['appendFileSync'](_0x241868,_0xddb44c);}}return db[_0xc0d8('0x105')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xc0d8('0x106')],'as':'Smtp','raw':!![]}]});}}})[_0xc0d8('0x1f')](function(_0x2f0a85){if(_0x2f0a85&&_0x2f0a85[_0xc0d8('0x107')]&&_0x57181c[_0xc0d8('0x3b')]){var _0x43ecd4={'tls':{'rejectUnauthorized':![]}};if(_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x108')]){_0x43ecd4[_0xc0d8('0x108')]=_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x108')];}else{_0x43ecd4[_0xc0d8('0x109')]=_0x2f0a85['Smtp'][_0xc0d8('0x109')];_0x43ecd4[_0xc0d8('0x10a')]=_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10a')];_0x43ecd4[_0xc0d8('0x10b')]=_0x2f0a85['Smtp'][_0xc0d8('0x10b')];}if(_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10c')]){_0x43ecd4[_0xc0d8('0x10d')]={'user':_0x2f0a85[_0xc0d8('0x107')]['user'],'pass':_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10e')]};}return respondWithRpcPromise(_0xc0d8('0x10f'),_0xc0d8('0x110'),{'account':_0x43ecd4,'message':{'from':util[_0xc0d8('0x102')](_0xc0d8('0x111'),_0x2f0a85['name'],_0x2f0a85['email']||_0x2f0a85['Smtp'][_0xc0d8('0xa3')]),'to':_0x57181c[_0xc0d8('0x3b')][_0xc0d8('0x112')],'subject':_0xc0d8('0x113'),'text':util[_0xc0d8('0x102')](_0xc0d8('0x114'),_0x57181c[_0xc0d8('0x3b')]['mailTranscript']),'attachments':[{'path':_0x241868}]}})['then'](function(){return _0x1509d2;})['catch'](function(_0x26cac9){console[_0xc0d8('0x24')](_0x26cac9);});}else{return _0x1509d2;}})[_0xc0d8('0x1f')](respondWithStatusCode(_0x276e7b,0xc8))[_0xc0d8('0x28')](handleError(_0x276e7b,null));};exports['addMessage']=function(_0x540e59,_0x49517e,_0x1c45aa){return db['ChatMessage'][_0xc0d8('0x73')]({'where':{'id':_0x540e59['params']['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x49517e,null))[_0xc0d8('0x1f')](function(_0x45b237){if(_0x45b237){return _0x45b237['addMessage'](_0x540e59[_0xc0d8('0x3b')]['ids'],_['omit'](_0x540e59[_0xc0d8('0x3b')],['ids','id'])||{});}})[_0xc0d8('0x1f')](respondWithResult(_0x49517e,null))[_0xc0d8('0x28')](handleError(_0x49517e,null));};exports[_0xc0d8('0x115')]=function(_0x4e5d0c,_0x4245c4,_0x33b060){var _0x553b1e={'raw':![],'where':{}};var _0x5d4f1a={};var _0x367837={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4e5d0c[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x4245c4,null))['then'](function(_0x3622bf){if(_0x3622bf){_0x5d4f1a['model']=_['keys'](db[_0xc0d8('0xda')][_0xc0d8('0x50')]);_0x5d4f1a[_0xc0d8('0x54')]=_[_0xc0d8('0x55')](_0x4e5d0c[_0xc0d8('0x54')]);_0x5d4f1a[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x5d4f1a[_0xc0d8('0x53')],_0x5d4f1a[_0xc0d8('0x54')]);_0x553b1e[_0xc0d8('0x59')]=_[_0xc0d8('0x57')](_0x5d4f1a[_0xc0d8('0x53')],qs['fields'](_0x4e5d0c['query'][_0xc0d8('0x58')]));_0x553b1e['attributes']=_0x553b1e[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x553b1e[_0xc0d8('0x59')]:_0x5d4f1a[_0xc0d8('0x53')];if(!_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x116')](_0xc0d8('0x5b'))){_0x553b1e[_0xc0d8('0x2c')]=qs['limit'](_0x4e5d0c[_0xc0d8('0x54')]['limit']);_0x553b1e[_0xc0d8('0x2e')]=qs[_0xc0d8('0x2e')](_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x2e')]);}_0x553b1e[_0xc0d8('0x9d')]=qs[_0xc0d8('0x5c')](_0x4e5d0c['query'][_0xc0d8('0x5c')]);_0x553b1e[_0xc0d8('0x5d')]=qs['filters'](_[_0xc0d8('0x117')](_0x4e5d0c[_0xc0d8('0x54')],_0x5d4f1a[_0xc0d8('0x56')]));_0x553b1e[_0xc0d8('0x5d')]['ChatInteractionId']=_0x3622bf['id'];if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x93')]){_0x553b1e['where']=_[_0xc0d8('0x3a')](_0x553b1e['where'],{'$or':_[_0xc0d8('0x3f')](_0x553b1e[_0xc0d8('0x59')],function(_0x40f5a3){var _0x3f6bb6={};_0x3f6bb6[_0x40f5a3]={'$like':'%'+_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x93')]+'%'};return _0x3f6bb6;})});}if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x118')]){var _0x42ee35=_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x118')][_0xc0d8('0x42')](',');var _0xac56fc={};_0xac56fc[_0x42ee35[0x0]]={'$gte':moment(_0x42ee35[0x1])[_0xc0d8('0x102')](_0xc0d8('0x119'))};_0x553b1e[_0xc0d8('0x5d')]=_['merge'](_0x553b1e[_0xc0d8('0x5d')],_0xac56fc);}_0x553b1e=_[_0xc0d8('0x3a')]({},_0x553b1e,_0x4e5d0c[_0xc0d8('0xc3')]);return db[_0xc0d8('0xda')]['count']({'where':_0x553b1e[_0xc0d8('0x5d')]})[_0xc0d8('0x1f')](function(_0x27baaa){_0x367837[_0xc0d8('0x2d')]=_0x27baaa;if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0xc2')]){_0x553b1e[_0xc0d8('0x11a')]=[{'all':!![]}];}return db[_0xc0d8('0xda')][_0xc0d8('0x11b')](_0x553b1e);})[_0xc0d8('0x1f')](function(_0x3ece25){_0x367837[_0xc0d8('0xbf')]=_0x3ece25;return _0x367837;});}})['then'](respondWithFilteredResult(_0x4245c4,_0x553b1e))[_0xc0d8('0x28')](handleError(_0x4245c4,null));};exports['getMyMessages']=function(_0x1886ca,_0x472f40,_0x15faec){var _0x12e4d4={'where':{}},_0x2dece0={},_0x5e838d={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc0d8('0xc8')]({'where':{'id':_0x1886ca[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x472f40,null))[_0xc0d8('0x1f')](function(_0x3dc497){if(_0x3dc497){_0x2dece0[_0xc0d8('0x53')]=_[_0xc0d8('0x55')](db['ChatMessage'][_0xc0d8('0x50')]);_0x2dece0['query']=_[_0xc0d8('0x55')](_0x1886ca[_0xc0d8('0x54')]);_0x2dece0['filters']=_[_0xc0d8('0x57')](_0x2dece0[_0xc0d8('0x53')],_0x2dece0[_0xc0d8('0x54')]);_0x12e4d4[_0xc0d8('0x59')]=_['intersection'](_0x2dece0[_0xc0d8('0x53')],qs[_0xc0d8('0x58')](_0x1886ca[_0xc0d8('0x54')]['fields']));_0x12e4d4['attributes']=_0x12e4d4[_0xc0d8('0x59')]['length']?_0x12e4d4[_0xc0d8('0x59')]:_0x2dece0[_0xc0d8('0x53')];if(!_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x116')](_0xc0d8('0x5b'))){_0x12e4d4[_0xc0d8('0x2c')]=qs[_0xc0d8('0x2c')](_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x2c')]);_0x12e4d4[_0xc0d8('0x2e')]=qs['offset'](_0x1886ca['query'][_0xc0d8('0x2e')]);}_0x12e4d4[_0xc0d8('0x9d')]=qs[_0xc0d8('0x5c')](_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x5c')]);_0x12e4d4[_0xc0d8('0x5d')]=qs[_0xc0d8('0x56')](_[_0xc0d8('0x117')](_0x1886ca['query'],_0x2dece0[_0xc0d8('0x56')]));_0x12e4d4[_0xc0d8('0x5d')][_0xc0d8('0xbe')]=_0x3dc497['id'];if(_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x93')]){_0x12e4d4['where']=_[_0xc0d8('0x3a')](_0x12e4d4[_0xc0d8('0x5d')],{'$or':_[_0xc0d8('0x3f')](_0x12e4d4['attributes'],function(_0x286e4c){var _0x6b65f2={};_0x6b65f2[_0x286e4c]={'$like':'%'+_0x1886ca[_0xc0d8('0x54')]['filter']+'%'};return _0x6b65f2;})});}_0x12e4d4[_0xc0d8('0x5d')][_0xc0d8('0x104')]=![];if(_0x1886ca['query']['id']){_0x12e4d4[_0xc0d8('0x5d')]['id']={'$gt':_0x1886ca[_0xc0d8('0x54')]['id']};}_0x12e4d4=_[_0xc0d8('0x3a')]({},_0x12e4d4,_0x1886ca[_0xc0d8('0xc3')]);return db[_0xc0d8('0xda')][_0xc0d8('0x2d')]({'where':_0x12e4d4['where']})['then'](function(_0x2d5a3e){_0x5e838d[_0xc0d8('0x2d')]=_0x2d5a3e;_0x12e4d4[_0xc0d8('0x11a')]=[];if(_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x11c')]){_0x12e4d4[_0xc0d8('0x11a')][_0xc0d8('0x45')]({'model':db['User'],'as':_0xc0d8('0xf7'),'attributes':['id',_0xc0d8('0x40'),'alias']});}if(_0x1886ca[_0xc0d8('0x54')]['includeAll']){_0x12e4d4['include']=[{'all':!![]}];}return db[_0xc0d8('0xda')][_0xc0d8('0x11b')](_0x12e4d4);})['then'](function(_0x1b02ad){_0x5e838d[_0xc0d8('0xbf')]=_0x1b02ad;return _0x5e838d;});}})[_0xc0d8('0x1f')](respondWithFilteredResult(_0x472f40,_0x12e4d4))[_0xc0d8('0x28')](handleError(_0x472f40,null));};exports['addTags']=function(_0x2f9d92,_0x268f3a,_0x3bb514){return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x2f9d92[_0xc0d8('0xc1')]['id']}})['then'](handleEntityNotFound(_0x268f3a,null))['then'](function(_0x263658){if(_0x263658){return _0x263658[_0xc0d8('0x11d')](_0x2f9d92[_0xc0d8('0x3b')][_0xc0d8('0x11e')],_[_0xc0d8('0x11f')](_0x2f9d92[_0xc0d8('0x3b')],[_0xc0d8('0x11e'),'id'])||{})[_0xc0d8('0x120')](function(){return db[_0xc0d8('0x82')][_0xc0d8('0x11b')]({'attributes':['id','name',_0xc0d8('0x121')],'where':{'id':_0x2f9d92[_0xc0d8('0x3b')][_0xc0d8('0x11e')]}});})[_0xc0d8('0x1f')](function(_0x12f12b){socket[_0xc0d8('0x122')](_0xc0d8('0x123'),{'id':Number(_0x2f9d92[_0xc0d8('0xc1')]['id']),'tags':_0x12f12b||[]});return{'id':Number(_0x2f9d92['params']['id']),'tags':_0x12f12b||[]};});}})[_0xc0d8('0x1f')](respondWithResult(_0x268f3a,null))[_0xc0d8('0x28')](handleError(_0x268f3a,null));};exports['removeTags']=function(_0x3527e4,_0x18f5b5,_0x18bfa3){return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x3527e4[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x18f5b5,null))['then'](function(_0xe5c920){if(_0xe5c920){return _0xe5c920[_0xc0d8('0x124')](_0x3527e4[_0xc0d8('0x54')][_0xc0d8('0x11e')]);}})['then'](respondWithStatusCode(_0x18f5b5,null))[_0xc0d8('0x28')](handleError(_0x18f5b5,null));};exports[_0xc0d8('0xf2')]=function(_0x4e7b62,_0x2b96c9){var _0x11fc31=moment()[_0xc0d8('0x125')]()[_0xc0d8('0xa9')]();var _0x102afe=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x127'),_0xc0d8('0x128'));var _0x33d4fb=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x127'),_0xc0d8('0x129'));var _0x4bedd9=path[_0xc0d8('0xee')](_0x102afe,_0x11fc31);var _0x5a0774=util['format'](_0xc0d8('0x12a'),_0x4e7b62[_0xc0d8('0xc1')]['id'],_0x11fc31);var _0x47c6c6=path[_0xc0d8('0xee')](_0x102afe,_0x5a0774);var _0xdd8b70=[];_0xdd8b70[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xf7')],'as':_0xc0d8('0xf7'),'attributes':['id','fullname'],'raw':!![]});_0xdd8b70[_0xc0d8('0x45')]({'model':db['CmContact'],'as':_0xc0d8('0x77'),'attributes':['id',_0xc0d8('0x12b'),_0xc0d8('0x12c')],'raw':!![]});if(_0x4e7b62[_0xc0d8('0x54')]['attachments']){_0xdd8b70['push']({'model':db[_0xc0d8('0xeb')],'as':_0xc0d8('0xeb'),'raw':!![]});}var _0x37861f=[{'model':db[_0xc0d8('0xda')],'as':'Messages','attributes':['id',_0xc0d8('0x3b'),_0xc0d8('0x12d'),_0xc0d8('0x103'),_0xc0d8('0x104'),_0xc0d8('0x8e')],'include':_0xdd8b70}];_0x37861f[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xc9')],'as':_0xc0d8('0x12e'),'attributes':['id',_0xc0d8('0x37')]});_0x37861f[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xf7')],'as':_0xc0d8('0x12f'),'attributes':['id',_0xc0d8('0x40')]});return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x4e7b62[_0xc0d8('0xc1')]['id']},'include':_0x37861f})[_0xc0d8('0x1f')](handleEntityNotFound(_0x2b96c9,null))[_0xc0d8('0x1f')](function(_0x3e2874){if(_0x3e2874){var _0x2d32d3=_0x3e2874[_0xc0d8('0x130')]({'plain':!![]});fs[_0xc0d8('0x131')](_0x4bedd9);var _0x433eab={'channel':_0xc0d8('0x132'),'account':_0x2d32d3[_0xc0d8('0x12e')][_0xc0d8('0x37')],'agent':_0x2d32d3[_0xc0d8('0x12f')]?_0x2d32d3[_0xc0d8('0x12f')][_0xc0d8('0x40')]:_0xc0d8('0x133'),'createdAt':moment(_0x2d32d3[_0xc0d8('0x12d')])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')](),'closedAt':_0x2d32d3[_0xc0d8('0x4a')]?moment(_0x2d32d3['closedAt'])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')]():'','disposition':_0x2d32d3[_0xc0d8('0x4c')],'chatInfo':{'browser':_0x2d32d3['browserName'],'os':_0x2d32d3[_0xc0d8('0x134')],'referer':_0x2d32d3[_0xc0d8('0x135')],'customerIp':_0x2d32d3['customerIp'],'customerPort':_0x2d32d3[_0xc0d8('0x136')]?_0x2d32d3['customerPort']:_0xc0d8('0x133')},'messages':_(_0x2d32d3[_0xc0d8('0xf6')])['tail']()['filter']({'secret':![]})[_0xc0d8('0x3f')](function(_0x266c9e){if(_0x266c9e[_0xc0d8('0xeb')]){var _0x1d16c8=path[_0xc0d8('0xee')](_0x33d4fb,_0x266c9e['Attachment']['basename']);if(fs[_0xc0d8('0x137')](_0x1d16c8)){fs[_0xc0d8('0x138')](_0x1d16c8)[_0xc0d8('0x139')](fs[_0xc0d8('0x13a')](path[_0xc0d8('0xee')](_0x4bedd9,_0x266c9e[_0xc0d8('0xeb')][_0xc0d8('0xe7')])));}}return{'date':moment(_0x266c9e['createdAt'])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')](),'sender':_0x266c9e[_0xc0d8('0x103')]==='out'?_0x266c9e[_0xc0d8('0xf7')]?_0x266c9e['User'][_0xc0d8('0x40')]:_0xc0d8('0xfa'):_0x266c9e[_0xc0d8('0x77')][_0xc0d8('0x12b')]+(_0x266c9e[_0xc0d8('0x77')][_0xc0d8('0x12c')]?'\x20'+_0x266c9e['Contact'][_0xc0d8('0x12c')]:''),'body':_0x266c9e[_0xc0d8('0xeb')]?_0x266c9e[_0xc0d8('0xeb')][_0xc0d8('0xe7')]:_0x266c9e[_0xc0d8('0x3b')],'direction':_0x266c9e[_0xc0d8('0x103')]===_0xc0d8('0x13b')?'A':'C','secret':_0x266c9e[_0xc0d8('0x104')],'read':_0x266c9e[_0xc0d8('0x8e')],'attachment':_0x266c9e[_0xc0d8('0xeb')]};})[_0xc0d8('0x7a')]()};return ejs[_0xc0d8('0x13c')](path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x13d'),_0xc0d8('0x13e')),{'interaction':_0x433eab})['then'](function(_0x91724d){var _0x5ee8d1=path[_0xc0d8('0xee')](_0x4bedd9,_0xc0d8('0x13f')+_0x2d32d3['id']+'-'+_0x11fc31+_0xc0d8('0x140'));var _0x3e422a={'path':_0x5ee8d1,'channel':_0xc0d8('0x132'),'interactionId':_0x2d32d3['id']};return pdf[_0xc0d8('0x141')](_0x91724d,_0x3e422a);})[_0xc0d8('0x1f')](function(){return new BPromise(function(_0x1ab2e0,_0x2338a5){zipdir(_0x4bedd9,{'saveTo':_0x47c6c6},function(_0x2ada8d,_0xd71387){if(_0x2ada8d)return _0x2338a5(_0x2ada8d);return _0x1ab2e0(_0xd71387);});})['then'](function(){return new BPromise(function(_0xc78f60,_0x4707b1){rimraf(_0x4bedd9,function(_0x342d42){if(_0x342d42)_0x4707b1(_0x342d42);return _0xc78f60();});});})[_0xc0d8('0x1f')](function(){return _0x2b96c9[_0xc0d8('0xf2')](_0x47c6c6,_0x5a0774,function(_0x5a73c9){if(_0x5a73c9){console[_0xc0d8('0x142')](_0xc0d8('0x143'),_0x5a73c9);}else{fs['unlinkSync'](_0x47c6c6);}});});});}else{return _0x2b96c9[_0xc0d8('0x35')](0xc8);}})['catch'](handleError(_0x2b96c9,null));}; \ No newline at end of file +var _0xddc5=['buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','where','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','user','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','merge','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','User','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','include','findAll','getMyMessages','includeAgent','setTags','emit','chatInteractionTags:save','removeTags','unix','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','out','direction','renderFile','server','views','transcript-','.pdf','Chat','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','end','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','talking','answered','total','closed','UserId','waiting','disposition','abandoned','unmanaged','index','ChatInteraction','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','chat_websites','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','`\x20=\x200','having','`\x20>\x200','Contact','$substring','value','find','ContactId'];(function(_0x222af7,_0x507d48){var _0x42bb7b=function(_0x2920b1){while(--_0x2920b1){_0x222af7['push'](_0x222af7['shift']());}};_0x42bb7b(++_0x507d48);}(_0xddc5,0xba));var _0x5ddc=function(_0x2de7d9,_0x167fb0){_0x2de7d9=_0x2de7d9-0x0;var _0x317d15=_0xddc5[_0x2de7d9];return _0x317d15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ddc('0x0'));var zipdir=require(_0x5ddc('0x1'));var jsonpatch=require(_0x5ddc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ddc('0x3'));var Mustache=require('mustache');var util=require(_0x5ddc('0x4'));var path=require(_0x5ddc('0x5'));var sox=require(_0x5ddc('0x6'));var csv=require(_0x5ddc('0x7'));var ejs=require(_0x5ddc('0x8'));var fs=require('fs');var fs_extra=require(_0x5ddc('0x9'));var _=require('lodash');var squel=require(_0x5ddc('0xa'));var crypto=require('crypto');var jsforce=require(_0x5ddc('0xb'));var deskjs=require(_0x5ddc('0xc'));var toCsv=require(_0x5ddc('0x7'));var querystring=require(_0x5ddc('0xd'));var Papa=require(_0x5ddc('0xe'));var Redis=require(_0x5ddc('0xf'));var authService=require(_0x5ddc('0x10'));var qs=require(_0x5ddc('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5ddc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ddc('0x13'))('api');var utils=require(_0x5ddc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5ddc('0x15'));var db=require(_0x5ddc('0x16'))['db'];config[_0x5ddc('0x17')]=_['defaults'](config['redis'],{'host':_0x5ddc('0x18'),'port':0x18eb});var socket=require(_0x5ddc('0x19'))(new Redis(config[_0x5ddc('0x17')]));require(_0x5ddc('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5ddc('0x1b')][_0x5ddc('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x5ddc('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x4bb4ff,_0x25a521,_0x126f31,_0x172b66){return new BPromise(function(_0x491257,_0x345fe4){var _0x5c103b=_0x172b66||client;return _0x5c103b['request'](_0x4bb4ff,_0x126f31)[_0x5ddc('0x1d')](function(_0x4c3db4){logger['info'](_0x5ddc('0x1e'),_0x25a521,_0x5ddc('0x1f'));logger['debug'](_0x5ddc('0x20'),_0x25a521,_0x5ddc('0x1f'),JSON[_0x5ddc('0x21')](_0x4c3db4));if(_0x4c3db4[_0x5ddc('0x22')]){if(_0x4c3db4[_0x5ddc('0x22')][_0x5ddc('0x23')]===0x1f4){logger[_0x5ddc('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x25a521,_0x4c3db4[_0x5ddc('0x22')]['message']);return _0x345fe4(_0x4c3db4[_0x5ddc('0x22')][_0x5ddc('0x24')]);}logger['error'](_0x5ddc('0x1e'),_0x25a521,_0x4c3db4[_0x5ddc('0x22')]['message']);return _0x491257(_0x4c3db4[_0x5ddc('0x22')][_0x5ddc('0x24')]);}else{logger[_0x5ddc('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x25a521,_0x5ddc('0x1f'));_0x491257(_0x4c3db4['result']['message']);}})[_0x5ddc('0x26')](function(_0xaffc49){logger[_0x5ddc('0x22')](_0x5ddc('0x1e'),_0x25a521,_0xaffc49);_0x345fe4(_0xaffc49);});});}function respondWithStatusCode(_0x499216,_0x3d09df){_0x3d09df=_0x3d09df||0xcc;return function(_0x3afc30){if(_0x3afc30){return _0x499216[_0x5ddc('0x27')](_0x3d09df);}return _0x499216[_0x5ddc('0x28')](_0x3d09df)['end']();};}function respondWithResult(_0x3ab1b0,_0x443a92){_0x443a92=_0x443a92||0xc8;return function(_0x4ca8cf){if(_0x4ca8cf){return _0x3ab1b0['status'](_0x443a92)[_0x5ddc('0x29')](_0x4ca8cf);}};}function respondWithFilteredResult(_0x526e04,_0x5217c7){return function(_0x52b18d){if(_0x52b18d){var _0x123d11=typeof _0x5217c7['offset']===_0x5ddc('0x2a')&&typeof _0x5217c7[_0x5ddc('0x2b')]===_0x5ddc('0x2a');var _0x23dd8d=_0x52b18d[_0x5ddc('0x2c')];var _0x27e6c3=_0x123d11?0x0:_0x5217c7[_0x5ddc('0x2d')];var _0x442c76=_0x123d11?_0x52b18d['count']:_0x5217c7[_0x5ddc('0x2d')]+_0x5217c7[_0x5ddc('0x2b')];var _0x4f3287;if(_0x442c76>=_0x23dd8d){_0x442c76=_0x23dd8d;_0x4f3287=0xc8;}else{_0x4f3287=0xce;}_0x526e04[_0x5ddc('0x28')](_0x4f3287);return _0x526e04[_0x5ddc('0x2e')](_0x5ddc('0x2f'),_0x27e6c3+'-'+_0x442c76+'/'+_0x23dd8d)[_0x5ddc('0x29')](_0x52b18d);}return null;};}function patchUpdates(_0x10d630){return function(_0x2c7a70){try{jsonpatch['apply'](_0x2c7a70,_0x10d630,!![]);}catch(_0x1a5d6f){return BPromise['reject'](_0x1a5d6f);}return _0x2c7a70[_0x5ddc('0x30')]();};}function saveUpdates(_0x3b848f,_0x2bf35b){return function(_0x338237){if(_0x338237){return _0x338237[_0x5ddc('0x31')](_0x3b848f)[_0x5ddc('0x1d')](function(_0x438fc8){return _0x438fc8;});}return null;};}function removeEntity(_0x4c66dc,_0x4d8448){return function(_0xf2a3a7){if(_0xf2a3a7){return _0xf2a3a7[_0x5ddc('0x32')]()[_0x5ddc('0x1d')](function(){_0x4c66dc[_0x5ddc('0x28')](0xcc)[_0x5ddc('0x33')]();});}};}function handleEntityNotFound(_0x16752b,_0x598f11){return function(_0x4178f7){if(!_0x4178f7){_0x16752b[_0x5ddc('0x27')](0x194);}return _0x4178f7;};}function handleError(_0x93d25a,_0x590d0d){_0x590d0d=_0x590d0d||0x1f4;return function(_0x996552){logger[_0x5ddc('0x22')](_0x996552['stack']);if(_0x996552[_0x5ddc('0x34')]){delete _0x996552[_0x5ddc('0x34')];}_0x93d25a['status'](_0x590d0d)[_0x5ddc('0x35')](_0x996552);};}function getMustacheRender(_0x5c3d01,_0x35498c){return Mustache['render'](_0x5c3d01,_['merge'](_0x35498c[_0x5ddc('0x36')],{'contact':_0x35498c[_0x5ddc('0x37')],'message':_0x35498c[_0x5ddc('0x24')],'agent':_0x35498c['agent'],'interaction':_0x35498c[_0x5ddc('0x38')],'account':_0x35498c[_0x5ddc('0x39')]}))||'';}function getInteractionUsers(_0xbecc4c,_0x5a7377){return new BPromise(function(_0x13eae4,_0x2a7836){try{if(_0x5a7377[_0xbecc4c['id']]){_0xbecc4c[_0x5ddc('0x3a')]=_[_0x5ddc('0x3b')](_0x5a7377[_0xbecc4c['id']],function(_0x35d09c){return{'id':_0x35d09c['id'],'fullname':_0x35d09c[_0x5ddc('0x3c')]};});}}catch(_0xe9e85c){_0x2a7836(_0xe9e85c);}_0x13eae4(_0xbecc4c);});}function getInteractionTags(_0x609368,_0x4980af){return new BPromise(function(_0x48066d,_0x337845){try{if(_0x609368[_0x5ddc('0x3d')]){_0x609368[_0x5ddc('0x3e')]=[];_0x609368['TagIds'][_0x5ddc('0x3f')](',')[_0x5ddc('0x40')](function(_0x251636){_0x609368['Tags'][_0x5ddc('0x41')](_0x4980af[_0x251636]);});}delete _0x609368['TagIds'];}catch(_0x38e138){_0x337845(_0x38e138);}_0x48066d(_0x609368);});}function updateChatInteraction(_0x11b118,_0x5eb937,_0x2cf3a2){return new BPromise(function(_0x3ee2d2,_0x55ccbd){return getInteractionUsers(_0x11b118,_0x2cf3a2)[_0x5ddc('0x1d')](function(_0x37eecc){return getInteractionTags(_0x37eecc,_0x5eb937);})[_0x5ddc('0x1d')](function(_0x3ec5e5){return getStateInteraction(_0x3ec5e5);})[_0x5ddc('0x1d')](function(_0x5121d4){_0x3ee2d2(_0x5121d4);})[_0x5ddc('0x26')](function(_0x53499c){_0x55ccbd(_0x53499c);});});}function getStateInteraction(_0x750a2b){return new BPromise(function(_0x494e13){_0x750a2b['waiting']=0x0;_0x750a2b[_0x5ddc('0x42')]=0x0;_0x750a2b[_0x5ddc('0x43')]=0x0;_0x750a2b['unmanaged']=0x0;_0x750a2b['abandoned']=0x0;_0x750a2b[_0x5ddc('0x44')]=0x0;if(!_0x750a2b[_0x5ddc('0x45')]&&!_0x750a2b[_0x5ddc('0x46')]){_0x750a2b[_0x5ddc('0x47')]+=0x1;}if(!_0x750a2b[_0x5ddc('0x45')]&&_0x750a2b[_0x5ddc('0x46')]){_0x750a2b[_0x5ddc('0x42')]+=0x1;if(_0x750a2b[_0x5ddc('0x47')]){_0x750a2b[_0x5ddc('0x47')]-=0x1;}}if(_0x750a2b[_0x5ddc('0x45')]&&_0x750a2b[_0x5ddc('0x48')]===_0x5ddc('0x49')){_0x750a2b['abandoned']+=0x1;if(_0x750a2b[_0x5ddc('0x47')]){_0x750a2b['waiting']-=0x1;}}else if(_0x750a2b[_0x5ddc('0x45')]&&!_0x750a2b[_0x5ddc('0x46')]&&_0x750a2b[_0x5ddc('0x48')]){_0x750a2b[_0x5ddc('0x4a')]+=0x1;if(_0x750a2b[_0x5ddc('0x47')]){_0x750a2b[_0x5ddc('0x47')]-=0x1;}}else if(_0x750a2b[_0x5ddc('0x45')]&&_0x750a2b[_0x5ddc('0x46')]){_0x750a2b[_0x5ddc('0x43')]+=0x1;if(_0x750a2b[_0x5ddc('0x42')]){_0x750a2b[_0x5ddc('0x42')]-=0x1;}}_0x750a2b[_0x5ddc('0x44')]+=0x1;_0x494e13(_0x750a2b);});}exports[_0x5ddc('0x4b')]=function(_0x3ddbb4,_0x5a38a2){var _0x4e0c9f={},_0x52fe61={},_0x2f2ced={'count':0x0,'rows':[]};var _0x48d976=_[_0x5ddc('0x3b')](db[_0x5ddc('0x4c')][_0x5ddc('0x4d')],function(_0xef8ed8){return{'name':_0xef8ed8['fieldName'],'type':_0xef8ed8[_0x5ddc('0x4e')][_0x5ddc('0x4f')]};});_0x52fe61[_0x5ddc('0x50')]=_[_0x5ddc('0x3b')](_0x48d976,_0x5ddc('0x34'));_0x52fe61['query']=_[_0x5ddc('0x51')](_0x3ddbb4[_0x5ddc('0x52')]);_0x52fe61[_0x5ddc('0x53')]=_['intersection'](_0x52fe61[_0x5ddc('0x50')],_0x52fe61[_0x5ddc('0x52')]);_0x4e0c9f[_0x5ddc('0x54')]=_[_0x5ddc('0x55')](_0x52fe61[_0x5ddc('0x50')],qs[_0x5ddc('0x56')](_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x56')]));_0x4e0c9f[_0x5ddc('0x54')]=_0x4e0c9f[_0x5ddc('0x54')][_0x5ddc('0x57')]?_0x4e0c9f['attributes']:_0x52fe61[_0x5ddc('0x50')];if(!_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x58')](_0x5ddc('0x59'))){_0x4e0c9f[_0x5ddc('0x2b')]=qs[_0x5ddc('0x2b')](_0x3ddbb4[_0x5ddc('0x52')]['limit']);_0x4e0c9f[_0x5ddc('0x2d')]=qs[_0x5ddc('0x2d')](_0x3ddbb4['query'][_0x5ddc('0x2d')]);}_0x4e0c9f[_0x5ddc('0x5a')]=qs[_0x5ddc('0x5b')](_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x5b')]);_0x4e0c9f['where']=qs[_0x5ddc('0x53')](_[_0x5ddc('0x5c')](_0x3ddbb4[_0x5ddc('0x52')],_0x52fe61[_0x5ddc('0x53')]),_0x48d976);var _0x2d45bb=[];var _0x4d0575=squel[_0x5ddc('0x5d')]()[_0x5ddc('0x5e')]('id')[_0x5ddc('0x5e')](_0x5ddc('0x34'))[_0x5ddc('0x5e')](_0x5ddc('0x5f'))[_0x5ddc('0x60')](_0x5ddc('0x61'));var _0x34ba3e=squel['select']()['field']('u.id')[_0x5ddc('0x5e')](_0x5ddc('0x62'))['field'](_0x5ddc('0x63'))[_0x5ddc('0x60')](_0x5ddc('0x64'),'ui')['left_join'](_0x5ddc('0x65'),'u',_0x5ddc('0x66'));var _0x2d8b60=squel[_0x5ddc('0x5d')]()[_0x5ddc('0x60')](_0x5ddc('0x67'),'i')['left_join'](_0x5ddc('0x68'),'c',_0x5ddc('0x69'))[_0x5ddc('0x6a')](_0x5ddc('0x65'),'o','o.id\x20=\x20i.UserId')[_0x5ddc('0x6a')](_0x5ddc('0x6b'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x5ddc('0x6a')]('chat_messages','me',_0x5ddc('0x6c'))[_0x5ddc('0x6a')](_0x5ddc('0x6d'),'it',_0x5ddc('0x6e'))['left_join'](_0x5ddc('0x61'),'t',_0x5ddc('0x6f'));var _0x3cb658=squel[_0x5ddc('0x70')]();var _0x296a7d=[];var _0x373a07=squel[_0x5ddc('0x70')]();var _0x29d5b6;if(_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x71')]){_0x29d5b6=as['parseSearch'](_0x3ddbb4[_0x5ddc('0x52')]['search']);var _0x1e6181=_0x29d5b6[_0x5ddc('0x72')];for(var _0x498c69=0x0;_0x498c69<_0x29d5b6[_0x5ddc('0x73')][_0x5ddc('0x57')];_0x498c69++){var _0xef10e6=_0x29d5b6[_0x5ddc('0x73')][_0x498c69];var _0x77f9c0='i';var _0x41aacb=_['find'](_0x48d976,['name',_0xef10e6[_0x5ddc('0x5e')]]);if(!_0x41aacb){switch(_0xef10e6[_0x5ddc('0x5e')]){case'unreadMessages':if(_0xef10e6['value']==0x1){_0x2d8b60['having']('`'+_0xef10e6[_0x5ddc('0x5e')]+_0x5ddc('0x74'));}else{_0x2d8b60[_0x5ddc('0x75')]('`'+_0xef10e6[_0x5ddc('0x5e')]+_0x5ddc('0x76'));}break;case _0x5ddc('0x77'):if(_0xef10e6['operator']===_0x5ddc('0x78')){if(_0xef10e6[_0x5ddc('0x79')][_0x5ddc('0x3f')]('\x20')[_0x5ddc('0x57')]>0x1){_0x3cb658[_0x1e6181]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xef10e6[_0x5ddc('0x79')]),null);}else{var _0x2002d6='%'+_0xef10e6[_0x5ddc('0x79')]+'%';_0x3cb658[_0x1e6181]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2002d6,_0x2002d6,_0x2002d6);}}else{_0x41aacb=_[_0x5ddc('0x7a')](_0x48d976,[_0x5ddc('0x34'),_0x5ddc('0x7b')]);_0xef10e6['field']=_0x5ddc('0x7b');_0x34b4de=as[_0x5ddc('0x7c')](_0x77f9c0,_0x41aacb[_0x5ddc('0x4e')],_0xef10e6);_0x3cb658[_0x1e6181](_0x34b4de[_0x5ddc('0x7d')],_0x34b4de[_0x5ddc('0x79')]['start'],_0x34b4de['value']['end']);}break;case _0x5ddc('0x7e'):var _0x4feb91=_0xef10e6['value']['split'](',')[_0x5ddc('0x3b')](function(_0x3eb127){return Number(_0x3eb127);});_0x4feb91[_0x5ddc('0x40')](function(_0xe19331){_0x373a07['or'](_0x5ddc('0x7f'),'%,'+_0xe19331+',%');});_0x296a7d=_['union'](_0x296a7d,_0x4feb91);break;case'User':if(_0xef10e6['operator']===_0x5ddc('0x78')){_0x3cb658[_0x1e6181](_0x5ddc('0x80'),'%'+_0xef10e6[_0x5ddc('0x79')]+'%',null);}else{_0x41aacb=_['find'](_0x48d976,[_0x5ddc('0x34'),_0x5ddc('0x46')]);_0xef10e6[_0x5ddc('0x5e')]=_0x5ddc('0x46');_0x34b4de=as['buildExpression'](_0x77f9c0,_0x41aacb[_0x5ddc('0x4e')],_0xef10e6);_0x3cb658[_0x1e6181](_0x34b4de[_0x5ddc('0x7d')],_0x34b4de['value'][_0x5ddc('0x81')],_0x34b4de[_0x5ddc('0x79')][_0x5ddc('0x33')]);}break;case _0x5ddc('0x36'):_0x34b4de=as[_0x5ddc('0x7c')]('me',null,_0xef10e6);_0x3cb658[_0x1e6181](_0x34b4de[_0x5ddc('0x7d')],_0x34b4de[_0x5ddc('0x79')][_0x5ddc('0x81')],_0x34b4de[_0x5ddc('0x79')][_0x5ddc('0x33')]);break;}}else{var _0x34b4de=as[_0x5ddc('0x7c')](_0x77f9c0,_0x41aacb[_0x5ddc('0x4e')],_0xef10e6);_0x3cb658[_0x1e6181](_0x34b4de[_0x5ddc('0x7d')],_0x34b4de[_0x5ddc('0x79')][_0x5ddc('0x81')],_0x34b4de[_0x5ddc('0x79')][_0x5ddc('0x33')]);}}}else{var _0xdedc2f=_(_0x3ddbb4['query'])['keys']()[_0x5ddc('0x3b')](function(_0x3ffecb){return _[_0x5ddc('0x82')](_0x48d976,[_0x5ddc('0x34'),_0x3ffecb])?_0x3ffecb:undefined;})[_0x5ddc('0x83')]()[_0x5ddc('0x79')]();if(!_[_0x5ddc('0x84')](_0xdedc2f)){_0xdedc2f[_0x5ddc('0x40')](function(_0x18c9be){if(_0x18c9be===_0x5ddc('0x85')){_0x2d8b60[_0x5ddc('0x86')]('i.ChatWebsiteId\x20IN\x20?',[][_0x5ddc('0x87')](_0x3ddbb4[_0x5ddc('0x52')][_0x18c9be]));}else if(_0x18c9be==='createdAt'){var _0x690480=JSON[_0x5ddc('0x88')](_0x3ddbb4[_0x5ddc('0x52')][_0x18c9be])[_0x5ddc('0x89')];var _0x322596=JSON[_0x5ddc('0x88')](_0x3ddbb4[_0x5ddc('0x52')][_0x18c9be])[_0x5ddc('0x8a')];_0x2d8b60['where'](_0x5ddc('0x8b'),_0x690480,_0x322596);}else{if(_0x3ddbb4[_0x5ddc('0x52')][_0x18c9be]===_0x5ddc('0x8c')){_0x2d8b60[_0x5ddc('0x86')]('i.'+_0x18c9be+_0x5ddc('0x8d'));}else{_0x2d8b60[_0x5ddc('0x86')]('i.'+_0x18c9be+_0x5ddc('0x8e'),_0x3ddbb4[_0x5ddc('0x52')][_0x18c9be]);}}});}if(_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x8f')]){if(_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x8f')]==0x1){_0x2d8b60['having']('`unreadMessages`\x20=\x200');}else{_0x2d8b60[_0x5ddc('0x75')](_0x5ddc('0x90'));}}if(_0x3ddbb4['query'][_0x5ddc('0x91')]){_0x296a7d=_['isArray'](_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x91')])?_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x91')]:new Array(_0x3ddbb4[_0x5ddc('0x52')]['tag']);_0x296a7d[_0x5ddc('0x40')](function(_0x2caa35){_0x373a07['or'](_0x5ddc('0x7f'),'%,'+_0x2caa35+',%');});}if(_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x92')]){var _0x9e4367=_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x92')]['replace']('\x5c','\x5c\x5c')[_0x5ddc('0x93')](/'/g,'\x27\x27');if(qs[_0x5ddc('0x94')](_0x9e4367)){_0x3cb658['or'](_0x5ddc('0x95'),_0x9e4367+'%');}else{_0x3cb658['or'](_0x5ddc('0x96'),qs[_0x5ddc('0x97')](_0x9e4367))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x9e4367+'%');}}}_0x2d8b60[_0x5ddc('0x86')](_0x3cb658);_0x2d8b60['group'](_0x5ddc('0x98'));var _0x38c620={'type':db[_0x5ddc('0x99')][_0x5ddc('0x9a')][_0x5ddc('0x9b')],'raw':!![]};var _0x3f274e=_0x2d8b60[_0x5ddc('0x9c')]();_0x3f274e[_0x5ddc('0x5e')]('i.id');_0x3f274e[_0x5ddc('0x5e')](_0x5ddc('0x9d'),_0x5ddc('0x9e'));if(_0x4e0c9f[_0x5ddc('0x5a')]){_0x4e0c9f[_0x5ddc('0x5a')]['forEach'](function(_0x226902){var _0x2976eb=_0x226902[0x0]===_0x5ddc('0x9f')?_0x226902[0x0]:'i.'+_0x226902[0x0];_0x2d8b60[_0x5ddc('0x5a')](_0x2976eb,_0x226902[0x1]===_0x5ddc('0xa0')?![]:!![]);});}if(!_[_0x5ddc('0x84')](_0x296a7d)){_0x2d8b60[_0x5ddc('0x75')](_0x373a07);_0x3f274e[_0x5ddc('0x86')](_0x5ddc('0xa1'),_0x296a7d);}BPromise[_0x5ddc('0xa2')]()[_0x5ddc('0x1d')](function(){if(!_0x29d5b6){if(_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x85')])return;_0x3f274e[_0x5ddc('0x86')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x2d8b60[_0x5ddc('0x86')](_0x5ddc('0xa3'));return;}if(_0x3ddbb4['user'][_0x5ddc('0xa4')]!==_0x5ddc('0xa5'))return;return _0x3ddbb4['user'][_0x5ddc('0xa6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd84bb6){if(_['isEmpty'](_0xd84bb6)){_0x3f274e[_0x5ddc('0x86')](_0x5ddc('0xa7'));_0x2d8b60['where'](_0x5ddc('0xa7'));}else{_0x3f274e[_0x5ddc('0x86')](_0x5ddc('0xa8'),_[_0x5ddc('0x3b')](_0xd84bb6,'id'));_0x2d8b60[_0x5ddc('0x86')](_0x5ddc('0xa8'),_[_0x5ddc('0x3b')](_0xd84bb6,'id'));}});})[_0x5ddc('0x1d')](function(){if(_0x3ddbb4[_0x5ddc('0xa9')][_0x5ddc('0xa4')]===_0x5ddc('0xa5')&&!_0x29d5b6&&!_0x3ddbb4[_0x5ddc('0x52')][_0x5ddc('0x85')])return[];return db[_0x5ddc('0xaa')]['query'](_0x3f274e[_0x5ddc('0xab')](),_0x38c620);})[_0x5ddc('0x1d')](function(_0x3a74c8){_0x2f2ced[_0x5ddc('0x2c')]=_0x3a74c8[_0x5ddc('0x57')];if(_0x2f2ced['count']===0x0)return[];return db[_0x5ddc('0xaa')][_0x5ddc('0x52')](_0x4d0575['toString'](),_0x38c620)[_0x5ddc('0x1d')](function(_0x476369){_0x2d45bb=_[_0x5ddc('0xac')](_0x476369,'id');_0x38c620=_['merge'](_0x38c620,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ddbb4['query']['fields']){_0x4e0c9f[_0x5ddc('0x54')][_0x5ddc('0x40')](function(_0x448959){_0x2d8b60['field']('i.'+_0x448959);});}else{_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0x9d'),_0x5ddc('0x9e'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xad'),_0x5ddc('0xae'));_0x2d8b60['field'](_0x5ddc('0xaf'),_0x5ddc('0xb0'));_0x2d8b60['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x5ddc('0x9f'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xb1'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xb2'),_0x5ddc('0xb3'));_0x2d8b60[_0x5ddc('0x5e')]('c.lastName',_0x5ddc('0xb4'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xb5'),_0x5ddc('0xb6'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xb7'),_0x5ddc('0xb8'));_0x2d8b60['field']('c.mobile',_0x5ddc('0xb9'));_0x2d8b60[_0x5ddc('0x5e')]('c.fax',_0x5ddc('0xba'));_0x2d8b60[_0x5ddc('0x5e')](_0x5ddc('0xbb'),_0x5ddc('0xbc'));_0x2d8b60[_0x5ddc('0x5e')]('o.internal','Owner.internal');_0x2d8b60['field'](_0x5ddc('0xbd'),_0x5ddc('0x3d'));}if(_0x4e0c9f[_0x5ddc('0x2b')])_0x2d8b60[_0x5ddc('0x2b')](_0x4e0c9f[_0x5ddc('0x2b')]);if(_0x4e0c9f[_0x5ddc('0x2d')])_0x2d8b60[_0x5ddc('0x2d')](_0x4e0c9f['offset']);return db[_0x5ddc('0xaa')]['query'](_0x2d8b60[_0x5ddc('0xab')](),_0x38c620);})[_0x5ddc('0x1d')](function(_0x2b8571){if(_0x2b8571[_0x5ddc('0x57')]>0x0)_0x34ba3e['where'](_0x5ddc('0xbe'),_[_0x5ddc('0x3b')](_0x2b8571,'id'));return db[_0x5ddc('0xaa')]['query'](_0x34ba3e['toString'](),_0x38c620)[_0x5ddc('0x1d')](function(_0x143db2){var _0x4d2771=_[_0x5ddc('0xbf')](_0x143db2,'ChatInteractionId');var _0x239395=[];_0x2b8571[_0x5ddc('0x40')](function(_0x2fd415){_0x239395[_0x5ddc('0x41')](updateChatInteraction(_0x2fd415,_0x2d45bb,_0x4d2771));});return BPromise[_0x5ddc('0xc0')](_0x239395);});});})[_0x5ddc('0x1d')](function(_0x45e6bb){_0x2f2ced[_0x5ddc('0xc1')]=_0x45e6bb;return _0x2f2ced;})[_0x5ddc('0x1d')](respondWithFilteredResult(_0x5a38a2,_0x4e0c9f))['catch'](handleError(_0x5a38a2,null));};exports['show']=function(_0x24f740,_0x4a323a){var _0xdb1be3={'raw':![],'where':{'id':_0x24f740[_0x5ddc('0xc2')]['id']}},_0x3740bc={};_0x3740bc[_0x5ddc('0x50')]=_[_0x5ddc('0x51')](db[_0x5ddc('0x4c')][_0x5ddc('0x4d')]);_0x3740bc[_0x5ddc('0x52')]=_[_0x5ddc('0x51')](_0x24f740[_0x5ddc('0x52')]);_0x3740bc[_0x5ddc('0x53')]=_['intersection'](_0x3740bc['model'],_0x3740bc['query']);_0xdb1be3['attributes']=_[_0x5ddc('0x55')](_0x3740bc['model'],qs['fields'](_0x24f740[_0x5ddc('0x52')][_0x5ddc('0x56')]));_0xdb1be3['attributes']=_0xdb1be3[_0x5ddc('0x54')][_0x5ddc('0x57')]?_0xdb1be3[_0x5ddc('0x54')]:_0x3740bc[_0x5ddc('0x50')];if(_0x24f740['query'][_0x5ddc('0xc3')]){_0xdb1be3['include']=[{'all':!![]}];}_0xdb1be3=_[_0x5ddc('0xc4')]({},_0xdb1be3,_0x24f740[_0x5ddc('0xc5')]);return db[_0x5ddc('0x4c')][_0x5ddc('0x7a')](_0xdb1be3)[_0x5ddc('0x1d')](handleEntityNotFound(_0x4a323a,null))[_0x5ddc('0x1d')](respondWithResult(_0x4a323a,null))[_0x5ddc('0x26')](handleError(_0x4a323a,null));};exports[_0x5ddc('0xc6')]=function(_0x2099c5,_0x210182){return db[_0x5ddc('0x4c')]['create'](_0x2099c5[_0x5ddc('0x36')],{})['then'](respondWithResult(_0x210182,0xc9))[_0x5ddc('0x26')](handleError(_0x210182,null));};exports[_0x5ddc('0x31')]=function(_0x228f19,_0x538d32){if(_0x228f19[_0x5ddc('0x36')]['id']){delete _0x228f19[_0x5ddc('0x36')]['id'];}return db['ChatInteraction'][_0x5ddc('0x7a')]({'where':{'id':_0x228f19[_0x5ddc('0xc2')]['id']}})['then'](handleEntityNotFound(_0x538d32,null))[_0x5ddc('0x1d')](saveUpdates(_0x228f19[_0x5ddc('0x36')],null))[_0x5ddc('0x1d')](respondWithResult(_0x538d32,null))['catch'](handleError(_0x538d32,null));};exports[_0x5ddc('0x32')]=function(_0x388289,_0x11fe79){return db['ChatInteraction']['find']({'where':{'id':_0x388289[_0x5ddc('0xc2')]['id']}})[_0x5ddc('0x1d')](handleEntityNotFound(_0x11fe79,null))['then'](removeEntity(_0x11fe79,null))[_0x5ddc('0x26')](handleError(_0x11fe79,null));};exports[_0x5ddc('0xc7')]=function(_0x3097cb,_0x584341){return db['ChatInteraction'][_0x5ddc('0xc7')]()['then'](respondWithResult(_0x584341,null))['catch'](handleError(_0x584341,null));};exports[_0x5ddc('0xc8')]=function(_0x3c2420,_0x23d96b){var _0x4d1763=_0x3c2420['params']['id'];var _0x23558b;var _0x309f61;var _0x240c1;return db[_0x5ddc('0x4c')][_0x5ddc('0xc9')]({'where':{'id':_0x4d1763}})[_0x5ddc('0x1d')](function(_0x556601){_0x23558b=_0x556601;return db[_0x5ddc('0xca')][_0x5ddc('0xc9')]({'where':{'id':_0x556601[_0x5ddc('0x85')]},'attributes':['id','vidaooApiKey',_0x5ddc('0xcb'),_0x5ddc('0xcc'),_0x5ddc('0xcd'),_0x5ddc('0xce')],'raw':!![]});})['then'](function(_0x1d7468){if(_0x1d7468&&_0x1d7468[_0x5ddc('0xcf')]&&_0x1d7468[_0x5ddc('0xcb')]){_0x309f61=_0x1d7468;var _0x168a63={'interaction':{'id':_0x4d1763},'agent':{'id':_0x3c2420[_0x5ddc('0xa9')]['id'],'name':_0x3c2420[_0x5ddc('0xa9')][_0x5ddc('0x34')],'fullname':_0x3c2420[_0x5ddc('0xa9')][_0x5ddc('0x3c')],'email':_0x3c2420[_0x5ddc('0xa9')][_0x5ddc('0xd0')]},'contact':_0x3c2420[_0x5ddc('0x36')]['contact'],'account':_0x3c2420[_0x5ddc('0x36')][_0x5ddc('0x39')]};var _0x2f4b89={'rejectUnauthorized':![],'method':'POST','url':_0x5ddc('0xd1'),'headers':{'X-APIKEY':_0x1d7468[_0x5ddc('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3c2420['user'][_0x5ddc('0xd0')]],'buttons':null,'topic':_0x309f61[_0x5ddc('0xcc')],'note':_['isNull'](_0x309f61[_0x5ddc('0xcd')])?null:getMustacheRender(_0x309f61[_0x5ddc('0xcd')],_0x168a63),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x5ddc('0xd2')](_0x309f61['vidaooMetadata'])){var _0x1b3930=getMustacheRender(_0x309f61[_0x5ddc('0xce')],_0x168a63);var _0x3b63d2=JSON['parse'](_0x1b3930);_0x2f4b89[_0x5ddc('0x36')][_0x5ddc('0xd3')]=_0x3b63d2;}}catch(_0x5562cf){throw new db[(_0x5ddc('0x99'))][(_0x5ddc('0xd4'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2f4b89);}else{throw new db[(_0x5ddc('0x99'))]['ValidationError'](_0x5ddc('0xd5'));}})[_0x5ddc('0x1d')](function(_0x4dda03){_0x240c1=_0x4dda03;if(_0x240c1['id']){var _0xc1d5e={'body':_0x240c1['join_url'],'ChatWebsiteId':_0x309f61['id'],'ChatInteractionId':_0x23558b['id'],'direction':'out','UserId':_0x3c2420['user']['id']};return db[_0x5ddc('0xd6')][_0x5ddc('0xc6')](_0xc1d5e,{});}else{throw new db[(_0x5ddc('0x99'))][(_0x5ddc('0xd4'))](_0x5ddc('0xd7'));}})[_0x5ddc('0x1d')](function(){return _0x23558b[_0x5ddc('0xd8')]({'vidaooSessionId':_0x240c1['id']});})[_0x5ddc('0x1d')](respondWithResult(_0x23d96b,null))[_0x5ddc('0x26')](handleError(_0x23d96b,null));};exports[_0x5ddc('0xd9')]=function(_0xc440b2,_0x4e0021){if(_0xc440b2[_0x5ddc('0x36')]['id']){delete _0xc440b2[_0x5ddc('0x36')]['id'];}return db['ChatInteraction'][_0x5ddc('0x7a')]({'where':{'id':_0xc440b2[_0x5ddc('0xc2')]['id']},'include':[{'model':db[_0x5ddc('0xda')],'as':_0x5ddc('0x77')}]})[_0x5ddc('0x1d')](handleEntityNotFound(_0x4e0021,null))[_0x5ddc('0x1d')](saveUpdates(_0xc440b2[_0x5ddc('0x36')],null))[_0x5ddc('0x1d')](respondWithResult(_0x4e0021,null))[_0x5ddc('0x26')](handleError(_0x4e0021,null));};exports[_0x5ddc('0xdb')]=function(_0x491723,_0x36d287,_0x4791ce){if(_0x491723[_0x5ddc('0x36')]['id']){delete _0x491723[_0x5ddc('0x36')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x491723[_0x5ddc('0xc2')]['id']}})[_0x5ddc('0x1d')](function(_0x266ad0){if(!_0x266ad0){logger[_0x5ddc('0x22')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x5ddc('0xdb'),0x194,_0x5ddc('0xdc'));_0x36d287[_0x5ddc('0x27')](0x194);}else{if(_0x266ad0['UserId']){throw new db[(_0x5ddc('0x99'))][(_0x5ddc('0xd4'))](_0x5ddc('0xdd'));}}return _0x266ad0;})[_0x5ddc('0x1d')](function(_0x5c00d9){if(_0x5c00d9){return _0x5c00d9['update']({'closed':_0x491723[_0x5ddc('0x36')]['closed'],'disposition':_0x491723[_0x5ddc('0x36')]['disposition']})['then'](function(_0x4a373b){return _0x4a373b;});}})[_0x5ddc('0x1d')](function(_0x1434b0){return respondWithRpcPromise(_0x5ddc('0xde'),_0x5ddc('0xdb'),_0x491723[_0x5ddc('0x36')],client9004);})[_0x5ddc('0x1d')](respondWithResult(_0x36d287,null))[_0x5ddc('0x26')](handleError(_0x36d287,null));};exports[_0x5ddc('0xdf')]=function(_0x22c2b3,_0x18648b,_0x110f93){_0x22c2b3['body'][_0x5ddc('0x34')]=_0x22c2b3['file'][_0x5ddc('0xe0')];_0x22c2b3[_0x5ddc('0x36')][_0x5ddc('0xe1')]=_0x22c2b3['file'][_0x5ddc('0xe2')];_0x22c2b3['body']['type']=_0x22c2b3[_0x5ddc('0xe3')][_0x5ddc('0xe4')];return db[_0x5ddc('0xe5')]['create'](_0x22c2b3[_0x5ddc('0x36')])[_0x5ddc('0x1d')](respondWithResult(_0x18648b,0xc9))[_0x5ddc('0x26')](handleError(_0x18648b,null));};exports['attachmentDownload']=function(_0x50a7bf,_0x1b29d3,_0x3fe916){return db['ChatInteraction'][_0x5ddc('0xc9')]({'where':{'id':_0x50a7bf[_0x5ddc('0xc2')]['id']},'raw':!![]})[_0x5ddc('0x1d')](handleEntityNotFound(_0x1b29d3,null))[_0x5ddc('0x1d')](function(_0x4795c9){if(_0x4795c9){if(_0x4795c9['closed']){return _0x1b29d3['status'](0x193)[_0x5ddc('0x29')]({'status':0x193,'message':'Unauthorized'});}return db[_0x5ddc('0xe5')]['findOne']({'where':{'id':_0x50a7bf[_0x5ddc('0x52')][_0x5ddc('0xe6')]},'raw':!![]})[_0x5ddc('0x1d')](handleEntityNotFound(_0x1b29d3,null));}})[_0x5ddc('0x1d')](function(_0x1825d9){if(_0x1825d9){var _0x1f143d=_0x1825d9[_0x5ddc('0xe7')]!==null;var _0xf423ee=path[_0x5ddc('0xe8')](config[_0x5ddc('0xe9')],_0x5ddc('0xea'));if(_0x1f143d){_0xf423ee=path[_0x5ddc('0xe8')](_0xf423ee,'offline-chat/');}var _0x1f5bc6=path[_0x5ddc('0xe8')](_0xf423ee,_0x1825d9[_0x5ddc('0xe1')]);return _0x1b29d3[_0x5ddc('0xeb')](_0x1f5bc6);}})[_0x5ddc('0x26')](handleError(_0x1b29d3,null));};exports[_0x5ddc('0xec')]=function(_0x25b27e,_0x513478){var _0x33dcbe=null;var _0x14af12=null;var _0x448e2f=null;var _0x568e85=null;if(_0x25b27e['body']['id']){delete _0x25b27e[_0x5ddc('0x36')]['id'];}if(_0x25b27e[_0x5ddc('0x36')][_0x5ddc('0xed')]){_0x568e85=path[_0x5ddc('0xe8')](config[_0x5ddc('0xe9')],_0x5ddc('0xee'),util['format'](_0x5ddc('0xef'),Date[_0x5ddc('0xf0')]()));_0x25b27e[_0x5ddc('0x36')][_0x5ddc('0xf1')]=_0x568e85;}return db[_0x5ddc('0x4c')]['find']({'where':{'id':_0x25b27e[_0x5ddc('0xc2')]['id']},'include':[{'model':db[_0x5ddc('0xd6')],'as':'Messages','include':[{'model':db[_0x5ddc('0xf2')],'as':_0x5ddc('0xf2')}]}]})[_0x5ddc('0x1d')](handleEntityNotFound(_0x513478,null))['then'](saveUpdates(_0x25b27e[_0x5ddc('0x36')],null))[_0x5ddc('0x1d')](function(_0x312e2e){if(_0x312e2e){_0x33dcbe=_0x312e2e;return db[_0x5ddc('0xca')]['find']({'where':{'id':_0x33dcbe['ChatWebsiteId']}});}})[_0x5ddc('0x1d')](function(_0x5c72f3){if(_0x5c72f3){_0x448e2f=_0x5c72f3;return db[_0x5ddc('0xda')][_0x5ddc('0x7a')]({'where':{'id':_0x33dcbe[_0x5ddc('0x7b')]}});}})[_0x5ddc('0x1d')](function(_0x17defb){if(_0x17defb){_0x14af12=_0x17defb;if(_0x568e85){var _0x438ab1=null;for(var _0x112f08=0x1;_0x112f08<_0x33dcbe[_0x5ddc('0xf3')][_0x5ddc('0x57')];++_0x112f08){_0x438ab1=_0x33dcbe[_0x5ddc('0xf3')][_0x112f08];var _0x38e4c1=_0x438ab1['UserId']?util[_0x5ddc('0xf4')](_0x5ddc('0xf5'),_0x448e2f['agentAlias'],_0x438ab1[_0x5ddc('0x46')]):_0x5ddc('0xf6');var _0x4c50fc=_0x25b27e[_0x5ddc('0x36')][_0x5ddc('0xf7')]||util[_0x5ddc('0xf4')](_0x5ddc('0xf5'),_0x5ddc('0xf8'),_0x438ab1[_0x5ddc('0x7b')]);switch(_0x448e2f[_0x5ddc('0xf9')]){case _0x5ddc('0xfa'):_0x38e4c1=_0x438ab1[_0x5ddc('0x46')]?util['format'](_0x5ddc('0xf5'),_0x448e2f[_0x5ddc('0xfb')],_0x438ab1[_0x5ddc('0x46')]):_0x5ddc('0xf6');break;case _0x5ddc('0xfc'):_0x38e4c1=_0x438ab1['UserId']?_0x438ab1['User'][_0x5ddc('0xfd')]||_0x438ab1[_0x5ddc('0xf2')][_0x5ddc('0x3c')]:'System';break;case _0x5ddc('0xfe'):_0x38e4c1=_0x438ab1[_0x5ddc('0x46')]?_0x438ab1[_0x5ddc('0xf2')][_0x5ddc('0x3c')]:_0x5ddc('0xf6');break;default:_0x38e4c1=_0x438ab1[_0x5ddc('0x46')]?util[_0x5ddc('0xf4')](_0x5ddc('0xf5'),_0x448e2f[_0x5ddc('0xfb')],_0x438ab1[_0x5ddc('0x46')]):_0x5ddc('0xf6');}var _0x396a6b=util[_0x5ddc('0xf4')]('[%s]\x20%s:\x20%s\x0a',moment(_0x438ab1[_0x5ddc('0xff')])['format'](_0x5ddc('0x100')),_0x438ab1['direction']==='in'?_0x4c50fc:_0x38e4c1,_0x438ab1[_0x5ddc('0x36')]);if(!_0x438ab1[_0x5ddc('0x101')]){fs['appendFileSync'](_0x568e85,_0x396a6b);}}return db[_0x5ddc('0x102')][_0x5ddc('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x5ddc('0x103')],'as':_0x5ddc('0x104'),'raw':!![]}]});}}})[_0x5ddc('0x1d')](function(_0x210f12){if(_0x210f12&&_0x210f12[_0x5ddc('0x104')]&&_0x25b27e['body']){var _0x3cbd8b={'tls':{'rejectUnauthorized':![]}};if(_0x210f12[_0x5ddc('0x104')]['service']){_0x3cbd8b[_0x5ddc('0x105')]=_0x210f12[_0x5ddc('0x104')][_0x5ddc('0x105')];}else{_0x3cbd8b[_0x5ddc('0x106')]=_0x210f12['Smtp']['host'];_0x3cbd8b[_0x5ddc('0x107')]=_0x210f12[_0x5ddc('0x104')][_0x5ddc('0x107')];_0x3cbd8b['secure']=_0x210f12[_0x5ddc('0x104')][_0x5ddc('0x108')];}if(_0x210f12[_0x5ddc('0x104')][_0x5ddc('0x109')]){_0x3cbd8b[_0x5ddc('0x10a')]={'user':_0x210f12[_0x5ddc('0x104')][_0x5ddc('0xa9')],'pass':_0x210f12[_0x5ddc('0x104')]['pass']};}return respondWithRpcPromise('SendMail',_0x5ddc('0x10b'),{'account':_0x3cbd8b,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x210f12['name'],_0x210f12[_0x5ddc('0xd0')]||_0x210f12[_0x5ddc('0x104')][_0x5ddc('0xa9')]),'to':_0x25b27e['body']['mailTranscript'],'subject':_0x5ddc('0x10c'),'text':util['format'](_0x5ddc('0x10d'),_0x25b27e[_0x5ddc('0x36')][_0x5ddc('0xed')]),'attachments':[{'path':_0x568e85}]}})['then'](function(){return _0x33dcbe;})['catch'](function(_0x1ccd71){console['error'](_0x1ccd71);});}else{return _0x33dcbe;}})[_0x5ddc('0x1d')](respondWithStatusCode(_0x513478,0xc8))['catch'](handleError(_0x513478,null));};exports[_0x5ddc('0x10e')]=function(_0xa80399,_0x5a5eca,_0x24afd8){return db[_0x5ddc('0xd6')][_0x5ddc('0x7a')]({'where':{'id':_0xa80399[_0x5ddc('0xc2')]['id']}})[_0x5ddc('0x1d')](handleEntityNotFound(_0x5a5eca,null))['then'](function(_0x2817c1){if(_0x2817c1){return _0x2817c1[_0x5ddc('0x10e')](_0xa80399[_0x5ddc('0x36')][_0x5ddc('0x10f')],_[_0x5ddc('0x110')](_0xa80399['body'],[_0x5ddc('0x10f'),'id'])||{});}})[_0x5ddc('0x1d')](respondWithResult(_0x5a5eca,null))['catch'](handleError(_0x5a5eca,null));};exports[_0x5ddc('0x111')]=function(_0x2dc80e,_0x27cf26,_0x241df3){var _0x222c3a={'raw':![],'where':{}};var _0x4de286={};var _0x5858dc={'count':0x0,'rows':[]};return db[_0x5ddc('0x4c')][_0x5ddc('0xc9')]({'where':{'id':_0x2dc80e[_0x5ddc('0xc2')]['id']}})[_0x5ddc('0x1d')](handleEntityNotFound(_0x27cf26,null))[_0x5ddc('0x1d')](function(_0x566691){if(_0x566691){_0x4de286['model']=_['keys'](db[_0x5ddc('0xd6')][_0x5ddc('0x4d')]);_0x4de286[_0x5ddc('0x52')]=_[_0x5ddc('0x51')](_0x2dc80e[_0x5ddc('0x52')]);_0x4de286[_0x5ddc('0x53')]=_[_0x5ddc('0x55')](_0x4de286[_0x5ddc('0x50')],_0x4de286[_0x5ddc('0x52')]);_0x222c3a[_0x5ddc('0x54')]=_[_0x5ddc('0x55')](_0x4de286['model'],qs[_0x5ddc('0x56')](_0x2dc80e['query']['fields']));_0x222c3a[_0x5ddc('0x54')]=_0x222c3a['attributes']['length']?_0x222c3a[_0x5ddc('0x54')]:_0x4de286['model'];if(!_0x2dc80e[_0x5ddc('0x52')]['hasOwnProperty'](_0x5ddc('0x59'))){_0x222c3a[_0x5ddc('0x2b')]=qs['limit'](_0x2dc80e[_0x5ddc('0x52')]['limit']);_0x222c3a[_0x5ddc('0x2d')]=qs[_0x5ddc('0x2d')](_0x2dc80e[_0x5ddc('0x52')][_0x5ddc('0x2d')]);}_0x222c3a[_0x5ddc('0x5a')]=qs[_0x5ddc('0x5b')](_0x2dc80e['query'][_0x5ddc('0x5b')]);_0x222c3a[_0x5ddc('0x86')]=qs['filters'](_[_0x5ddc('0x5c')](_0x2dc80e[_0x5ddc('0x52')],_0x4de286[_0x5ddc('0x53')]));_0x222c3a[_0x5ddc('0x86')][_0x5ddc('0x112')]=_0x566691['id'];if(_0x2dc80e[_0x5ddc('0x52')]['filter']){_0x222c3a[_0x5ddc('0x86')]=_[_0x5ddc('0xc4')](_0x222c3a[_0x5ddc('0x86')],{'$or':_[_0x5ddc('0x3b')](_0x222c3a[_0x5ddc('0x54')],function(_0x3c4dba){var _0x49239e={};_0x49239e[_0x3c4dba]={'$like':'%'+_0x2dc80e['query'][_0x5ddc('0x92')]+'%'};return _0x49239e;})});}if(_0x2dc80e[_0x5ddc('0x52')][_0x5ddc('0x89')]){var _0x27d629=_0x2dc80e[_0x5ddc('0x52')]['$gte']['split'](',');var _0x1d58bb={};_0x1d58bb[_0x27d629[0x0]]={'$gte':moment(_0x27d629[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x222c3a['where']=_['merge'](_0x222c3a[_0x5ddc('0x86')],_0x1d58bb);}_0x222c3a=_['merge']({},_0x222c3a,_0x2dc80e['options']);return db['ChatMessage'][_0x5ddc('0x2c')]({'where':_0x222c3a[_0x5ddc('0x86')]})['then'](function(_0x1a9f53){_0x5858dc['count']=_0x1a9f53;if(_0x2dc80e[_0x5ddc('0x52')][_0x5ddc('0xc3')]){_0x222c3a[_0x5ddc('0x113')]=[{'all':!![]}];}return db[_0x5ddc('0xd6')][_0x5ddc('0x114')](_0x222c3a);})[_0x5ddc('0x1d')](function(_0x177db4){_0x5858dc['rows']=_0x177db4;return _0x5858dc;});}})[_0x5ddc('0x1d')](respondWithFilteredResult(_0x27cf26,_0x222c3a))['catch'](handleError(_0x27cf26,null));};exports[_0x5ddc('0x115')]=function(_0x344e45,_0x3d39e7,_0x4b21cf){var _0xf18fa1={'where':{}},_0x1c2aff={},_0x5c588f={'count':0x0,'rows':[]};return db[_0x5ddc('0x4c')][_0x5ddc('0xc9')]({'where':{'id':_0x344e45['params']['id']}})['then'](handleEntityNotFound(_0x3d39e7,null))[_0x5ddc('0x1d')](function(_0x5cf447){if(_0x5cf447){_0x1c2aff['model']=_[_0x5ddc('0x51')](db[_0x5ddc('0xd6')][_0x5ddc('0x4d')]);_0x1c2aff[_0x5ddc('0x52')]=_[_0x5ddc('0x51')](_0x344e45[_0x5ddc('0x52')]);_0x1c2aff[_0x5ddc('0x53')]=_[_0x5ddc('0x55')](_0x1c2aff[_0x5ddc('0x50')],_0x1c2aff[_0x5ddc('0x52')]);_0xf18fa1[_0x5ddc('0x54')]=_[_0x5ddc('0x55')](_0x1c2aff[_0x5ddc('0x50')],qs[_0x5ddc('0x56')](_0x344e45['query'][_0x5ddc('0x56')]));_0xf18fa1['attributes']=_0xf18fa1[_0x5ddc('0x54')]['length']?_0xf18fa1[_0x5ddc('0x54')]:_0x1c2aff[_0x5ddc('0x50')];if(!_0x344e45['query'][_0x5ddc('0x58')](_0x5ddc('0x59'))){_0xf18fa1['limit']=qs[_0x5ddc('0x2b')](_0x344e45[_0x5ddc('0x52')]['limit']);_0xf18fa1[_0x5ddc('0x2d')]=qs['offset'](_0x344e45[_0x5ddc('0x52')][_0x5ddc('0x2d')]);}_0xf18fa1[_0x5ddc('0x5a')]=qs['sort'](_0x344e45[_0x5ddc('0x52')][_0x5ddc('0x5b')]);_0xf18fa1['where']=qs[_0x5ddc('0x53')](_[_0x5ddc('0x5c')](_0x344e45[_0x5ddc('0x52')],_0x1c2aff[_0x5ddc('0x53')]));_0xf18fa1['where'][_0x5ddc('0x112')]=_0x5cf447['id'];if(_0x344e45['query'][_0x5ddc('0x92')]){_0xf18fa1[_0x5ddc('0x86')]=_[_0x5ddc('0xc4')](_0xf18fa1[_0x5ddc('0x86')],{'$or':_[_0x5ddc('0x3b')](_0xf18fa1[_0x5ddc('0x54')],function(_0x520c1b){var _0x4a135a={};_0x4a135a[_0x520c1b]={'$like':'%'+_0x344e45[_0x5ddc('0x52')]['filter']+'%'};return _0x4a135a;})});}_0xf18fa1[_0x5ddc('0x86')][_0x5ddc('0x101')]=![];if(_0x344e45[_0x5ddc('0x52')]['id']){_0xf18fa1[_0x5ddc('0x86')]['id']={'$gt':_0x344e45[_0x5ddc('0x52')]['id']};}_0xf18fa1=_[_0x5ddc('0xc4')]({},_0xf18fa1,_0x344e45[_0x5ddc('0xc5')]);return db['ChatMessage'][_0x5ddc('0x2c')]({'where':_0xf18fa1[_0x5ddc('0x86')]})['then'](function(_0x442141){_0x5c588f[_0x5ddc('0x2c')]=_0x442141;_0xf18fa1[_0x5ddc('0x113')]=[];if(_0x344e45[_0x5ddc('0x52')][_0x5ddc('0x116')]){_0xf18fa1[_0x5ddc('0x113')][_0x5ddc('0x41')]({'model':db[_0x5ddc('0xf2')],'as':_0x5ddc('0xf2'),'attributes':['id',_0x5ddc('0x3c'),_0x5ddc('0xfd')]});}if(_0x344e45[_0x5ddc('0x52')][_0x5ddc('0xc3')]){_0xf18fa1['include']=[{'all':!![]}];}return db[_0x5ddc('0xd6')][_0x5ddc('0x114')](_0xf18fa1);})[_0x5ddc('0x1d')](function(_0x41df2a){_0x5c588f[_0x5ddc('0xc1')]=_0x41df2a;return _0x5c588f;});}})['then'](respondWithFilteredResult(_0x3d39e7,_0xf18fa1))[_0x5ddc('0x26')](handleError(_0x3d39e7,null));};exports['addTags']=function(_0x1e1334,_0xe4902f,_0x5af93b){return db[_0x5ddc('0x4c')]['find']({'where':{'id':_0x1e1334['params']['id']}})[_0x5ddc('0x1d')](handleEntityNotFound(_0xe4902f,null))[_0x5ddc('0x1d')](function(_0x6bc00){if(_0x6bc00){return _0x6bc00[_0x5ddc('0x117')](_0x1e1334[_0x5ddc('0x36')][_0x5ddc('0x10f')],_[_0x5ddc('0x110')](_0x1e1334[_0x5ddc('0x36')],[_0x5ddc('0x10f'),'id'])||{})['spread'](function(){return db[_0x5ddc('0x7e')][_0x5ddc('0x114')]({'attributes':['id',_0x5ddc('0x34'),_0x5ddc('0x5f')],'where':{'id':_0x1e1334[_0x5ddc('0x36')][_0x5ddc('0x10f')]}});})[_0x5ddc('0x1d')](function(_0x3b0ed0){socket[_0x5ddc('0x118')](_0x5ddc('0x119'),{'id':Number(_0x1e1334[_0x5ddc('0xc2')]['id']),'tags':_0x3b0ed0||[]});return{'id':Number(_0x1e1334[_0x5ddc('0xc2')]['id']),'tags':_0x3b0ed0||[]};});}})[_0x5ddc('0x1d')](respondWithResult(_0xe4902f,null))[_0x5ddc('0x26')](handleError(_0xe4902f,null));};exports[_0x5ddc('0x11a')]=function(_0x4ed35b,_0x1e3d7a,_0x443a42){return db[_0x5ddc('0x4c')][_0x5ddc('0x7a')]({'where':{'id':_0x4ed35b[_0x5ddc('0xc2')]['id']}})[_0x5ddc('0x1d')](handleEntityNotFound(_0x1e3d7a,null))[_0x5ddc('0x1d')](function(_0x1c7c4c){if(_0x1c7c4c){return _0x1c7c4c[_0x5ddc('0x11a')](_0x4ed35b[_0x5ddc('0x52')][_0x5ddc('0x10f')]);}})[_0x5ddc('0x1d')](respondWithStatusCode(_0x1e3d7a,null))[_0x5ddc('0x26')](handleError(_0x1e3d7a,null));};exports[_0x5ddc('0xeb')]=function(_0x231339,_0x2283a1){var _0xb3b8ff=moment()[_0x5ddc('0x11b')]()[_0x5ddc('0xab')]();var _0xf9a6e6=path[_0x5ddc('0xe8')](config[_0x5ddc('0xe9')],'server',_0x5ddc('0x11c'),'tmp');var _0x10fc4c=path[_0x5ddc('0xe8')](config[_0x5ddc('0xe9')],'server',_0x5ddc('0x11c'),_0x5ddc('0x11d'));var _0x3240a0=path[_0x5ddc('0xe8')](_0xf9a6e6,_0xb3b8ff);var _0x5eb5de=util[_0x5ddc('0xf4')](_0x5ddc('0x11e'),_0x231339['params']['id'],_0xb3b8ff);var _0x1281e0=path[_0x5ddc('0xe8')](_0xf9a6e6,_0x5eb5de);var _0x1fbc3d=[];_0x1fbc3d[_0x5ddc('0x41')]({'model':db[_0x5ddc('0xf2')],'as':_0x5ddc('0xf2'),'attributes':['id',_0x5ddc('0x3c')],'raw':!![]});_0x1fbc3d[_0x5ddc('0x41')]({'model':db[_0x5ddc('0xda')],'as':_0x5ddc('0x77'),'attributes':['id',_0x5ddc('0x11f'),_0x5ddc('0x120')],'raw':!![]});if(_0x231339['query'][_0x5ddc('0x11d')]){_0x1fbc3d[_0x5ddc('0x41')]({'model':db[_0x5ddc('0xe5')],'as':'Attachment','raw':!![]});}var _0xd729cf=[{'model':db[_0x5ddc('0xd6')],'as':_0x5ddc('0xf3'),'attributes':['id','body','createdAt','direction',_0x5ddc('0x101'),_0x5ddc('0x8f')],'include':_0x1fbc3d}];_0xd729cf[_0x5ddc('0x41')]({'model':db['ChatWebsite'],'as':_0x5ddc('0x121'),'attributes':['id',_0x5ddc('0x34')]});_0xd729cf['push']({'model':db[_0x5ddc('0xf2')],'as':_0x5ddc('0x122'),'attributes':['id',_0x5ddc('0x3c')]});return db[_0x5ddc('0x4c')][_0x5ddc('0x7a')]({'where':{'id':_0x231339[_0x5ddc('0xc2')]['id']},'include':_0xd729cf})[_0x5ddc('0x1d')](handleEntityNotFound(_0x2283a1,null))[_0x5ddc('0x1d')](function(_0x2076a9){if(_0x2076a9){var _0x25a7da=_0x2076a9['get']({'plain':!![]});fs['mkdirSync'](_0x3240a0);var _0x3182e4={'channel':'Chat','account':_0x25a7da[_0x5ddc('0x121')][_0x5ddc('0x34')],'agent':_0x25a7da[_0x5ddc('0x122')]?_0x25a7da[_0x5ddc('0x122')][_0x5ddc('0x3c')]:_0x5ddc('0x123'),'createdAt':moment(_0x25a7da[_0x5ddc('0xff')])['format'](_0x5ddc('0x124'))[_0x5ddc('0xab')](),'closedAt':_0x25a7da[_0x5ddc('0x45')]?moment(_0x25a7da[_0x5ddc('0x125')])[_0x5ddc('0xf4')](_0x5ddc('0x124'))[_0x5ddc('0xab')]():'','disposition':_0x25a7da[_0x5ddc('0x48')],'chatInfo':{'browser':_0x25a7da['browserName'],'os':_0x25a7da['osName'],'referer':_0x25a7da['referer'],'customerIp':_0x25a7da[_0x5ddc('0x126')],'customerPort':_0x25a7da['customerPort']?_0x25a7da[_0x5ddc('0x127')]:'N.A.'},'messages':_(_0x25a7da[_0x5ddc('0xf3')])[_0x5ddc('0x128')]()[_0x5ddc('0x92')]({'secret':![]})[_0x5ddc('0x3b')](function(_0x2fdf4a){if(_0x2fdf4a[_0x5ddc('0xe5')]){var _0x75e1f7=path[_0x5ddc('0xe8')](_0x10fc4c,_0x2fdf4a[_0x5ddc('0xe5')][_0x5ddc('0xe1')]);if(fs['existsSync'](_0x75e1f7)){fs[_0x5ddc('0x129')](_0x75e1f7)[_0x5ddc('0x12a')](fs[_0x5ddc('0x12b')](path[_0x5ddc('0xe8')](_0x3240a0,_0x2fdf4a[_0x5ddc('0xe5')]['basename'])));}}return{'date':moment(_0x2fdf4a[_0x5ddc('0xff')])[_0x5ddc('0xf4')](_0x5ddc('0x124'))[_0x5ddc('0xab')](),'sender':_0x2fdf4a['direction']===_0x5ddc('0x12c')?_0x2fdf4a[_0x5ddc('0xf2')]?_0x2fdf4a[_0x5ddc('0xf2')]['fullname']:_0x5ddc('0xf6'):_0x2fdf4a[_0x5ddc('0x77')][_0x5ddc('0x11f')]+(_0x2fdf4a[_0x5ddc('0x77')][_0x5ddc('0x120')]?'\x20'+_0x2fdf4a[_0x5ddc('0x77')]['lastName']:''),'body':_0x2fdf4a['Attachment']?_0x2fdf4a['Attachment'][_0x5ddc('0xe1')]:_0x2fdf4a[_0x5ddc('0x36')],'direction':_0x2fdf4a[_0x5ddc('0x12d')]===_0x5ddc('0x12c')?'A':'C','secret':_0x2fdf4a[_0x5ddc('0x101')],'read':_0x2fdf4a[_0x5ddc('0x8f')],'attachment':_0x2fdf4a[_0x5ddc('0xe5')]};})[_0x5ddc('0x79')]()};return ejs[_0x5ddc('0x12e')](path[_0x5ddc('0xe8')](config[_0x5ddc('0xe9')],_0x5ddc('0x12f'),_0x5ddc('0x130'),'downloadInteraction.ejs'),{'interaction':_0x3182e4})[_0x5ddc('0x1d')](function(_0x20691a){var _0x4caae0=path['join'](_0x3240a0,_0x5ddc('0x131')+_0x25a7da['id']+'-'+_0xb3b8ff+_0x5ddc('0x132'));var _0x14d2ce={'path':_0x4caae0,'channel':_0x5ddc('0x133'),'interactionId':_0x25a7da['id']};return pdf['createPdfFromHTML'](_0x20691a,_0x14d2ce);})[_0x5ddc('0x1d')](function(){return new BPromise(function(_0x100bea,_0x4573a6){zipdir(_0x3240a0,{'saveTo':_0x1281e0},function(_0x14f099,_0x220e16){if(_0x14f099)return _0x4573a6(_0x14f099);return _0x100bea(_0x220e16);});})[_0x5ddc('0x1d')](function(){return new BPromise(function(_0x1ec281,_0xe4d549){rimraf(_0x3240a0,function(_0x2f2b9c){if(_0x2f2b9c)_0xe4d549(_0x2f2b9c);return _0x1ec281();});});})['then'](function(){return _0x2283a1[_0x5ddc('0xeb')](_0x1281e0,_0x5eb5de,function(_0x3a36b0){if(_0x3a36b0){console['log'](_0x5ddc('0x134'),_0x3a36b0);}else{fs[_0x5ddc('0x135')](_0x1281e0);}});});});}else{return _0x2283a1[_0x5ddc('0x27')](0xc8);}})[_0x5ddc('0x26')](handleError(_0x2283a1,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 07fbd2a..879c347 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 _0xbd3b=['events','../../mysqldb','save','remove','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x24b5dc,_0x2c2e55){var _0x461db2=function(_0x1f2041){while(--_0x1f2041){_0x24b5dc['push'](_0x24b5dc['shift']());}};_0x461db2(++_0x2c2e55);}(_0xbd3b,0x1d4));var _0xbbd3=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xbd3b[_0x4bd950];return _0x5dc59a;};'use strict';var EventEmitter=require(_0xbbd3('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xbbd3('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbbd3('0x2'),'afterUpdate':'update','afterDestroy':_0xbbd3('0x3')};function emitEvent(_0x53c4ae){return function(_0x1ceacf,_0x236085,_0xa17659){_0x1ceacf['getUsers']({'attributes':['id'],'raw':!![]})[_0xbbd3('0x4')](function(_0x1cf67e){_0x1ceacf[_0xbbd3('0x5')](_0xbbd3('0x6'),_0x1cf67e['map'](function(_0x7f1b45){return{'id':_0x7f1b45['id']};}));return ChatMessage[_0xbbd3('0x7')]({'where':{'ChatInteractionId':_0x1ceacf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbd3('0x4')](function(_0x5f4199){_0x1ceacf['setDataValue'](_0xbbd3('0x8'),_0x5f4199['length']);ChatInteractionEvents[_0xbbd3('0x9')](_0x53c4ae+':'+_0x1ceacf['id'],_0x1ceacf);ChatInteractionEvents[_0xbbd3('0x9')](_0x53c4ae,_0x1ceacf);_0xa17659(null);})['catch'](_0xa17659(null));};}for(var e in events){if(events[_0xbbd3('0xa')](e)){var event=events[e];ChatInteraction[_0xbbd3('0xb')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xc9ac=['getUsers','then','setDataValue','map','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','save','remove'];(function(_0x6abae1,_0x11a02f){var _0x14dad0=function(_0xf1fa3){while(--_0xf1fa3){_0x6abae1['push'](_0x6abae1['shift']());}};_0x14dad0(++_0x11a02f);}(_0xc9ac,0x18f));var _0xcc9a=function(_0x2b30fe,_0xe92c0a){_0x2b30fe=_0x2b30fe-0x0;var _0x2d1e4e=_0xc9ac[_0x2b30fe];return _0x2d1e4e;};'use strict';var EventEmitter=require(_0xcc9a('0x0'));var ChatInteraction=require(_0xcc9a('0x1'))['db'][_0xcc9a('0x2')];var ChatMessage=require(_0xcc9a('0x1'))['db'][_0xcc9a('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc9a('0x4'),'afterUpdate':'update','afterDestroy':_0xcc9a('0x5')};function emitEvent(_0x3d6f9b){return function(_0x4ff337,_0x2d42d8,_0xdc65d6){_0x4ff337[_0xcc9a('0x6')]({'attributes':['id'],'raw':!![]})[_0xcc9a('0x7')](function(_0x608bb2){_0x4ff337[_0xcc9a('0x8')]('Users',_0x608bb2[_0xcc9a('0x9')](function(_0xbe078a){return{'id':_0xbe078a['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4ff337['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcc9a('0x7')](function(_0x1b1a7d){_0x4ff337[_0xcc9a('0x8')](_0xcc9a('0xa'),_0x1b1a7d['length']);ChatInteractionEvents[_0xcc9a('0xb')](_0x3d6f9b+':'+_0x4ff337['id'],_0x4ff337);ChatInteractionEvents[_0xcc9a('0xb')](_0x3d6f9b,_0x4ff337);_0xdc65d6(null);})[_0xcc9a('0xc')](_0xdc65d6(null));};}for(var e in events){if(events[_0xcc9a('0xd')](e)){var event=events[e];ChatInteraction[_0xcc9a('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c893d9a..c6a56ec 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 _0x3933=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x2703f9,_0x39425b){var _0x3910b1=function(_0x4a9c21){while(--_0x4a9c21){_0x2703f9['push'](_0x2703f9['shift']());}};_0x3910b1(++_0x39425b);}(_0x3933,0x14e));var _0x3393=function(_0x5d23c0,_0x31b911){_0x5d23c0=_0x5d23c0-0x0;var _0x68af05=_0x3933[_0x5d23c0];return _0x68af05;};'use strict';var _=require(_0x3393('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3393('0x1'));var BPromise=require(_0x3393('0x2'));var rp=require(_0x3393('0x3'));var fs=require('fs');var path=require(_0x3393('0x4'));var rimraf=require(_0x3393('0x5'));var config=require(_0x3393('0x6'));var attributes=require(_0x3393('0x7'));module[_0x3393('0x8')]=function(_0x306fb0,_0x1ac255){return _0x306fb0['define'](_0x3393('0x9'),attributes,{'tableName':_0x3393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47220d,_0x4c7a42,_0x4c835f){if(_0x47220d[_0x3393('0xb')](_0x3393('0xc'))){_0x47220d[_0x3393('0xd')]=moment()[_0x3393('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4c835f(null,_0x47220d);}},'charset':_0x3393('0xf'),'collate':_0x3393('0x10')});}; \ No newline at end of file +var _0xa32b=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format','utf8mb4_unicode_ci'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xa32b,0x170));var _0xba32=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0xa32b[_0x5c4d27];return _0x1dda1a;};'use strict';var _=require(_0xba32('0x0'));var util=require(_0xba32('0x1'));var logger=require('../../config/logger')(_0xba32('0x2'));var moment=require(_0xba32('0x3'));var BPromise=require(_0xba32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba32('0x5'));var rimraf=require(_0xba32('0x6'));var config=require(_0xba32('0x7'));var attributes=require('./chatInteraction.attributes');module[_0xba32('0x8')]=function(_0x475b79,_0x51a8c5){return _0x475b79[_0xba32('0x9')](_0xba32('0xa'),attributes,{'tableName':_0xba32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49f5bb,_0x50a917,_0x37a60f){if(_0x49f5bb['changed'](_0xba32('0xc'))){_0x49f5bb[_0xba32('0xd')]=moment()[_0xba32('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x37a60f(null,_0x49f5bb);}},'charset':'utf8mb4','collate':_0xba32('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 93830fd..219f79f 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 _0xa92c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util'];(function(_0xcc7a6d,_0x1fe408){var _0x19f821=function(_0x18887c){while(--_0x18887c){_0xcc7a6d['push'](_0xcc7a6d['shift']());}};_0x19f821(++_0x1fe408);}(_0xa92c,0x10c));var _0xca92=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xa92c[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xca92('0x0'));var util=require(_0xca92('0x1'));var moment=require(_0xca92('0x2'));var BPromise=require(_0xca92('0x3'));var rs=require(_0xca92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca92('0x5'))['db'];var utils=require(_0xca92('0x6'));var logger=require(_0xca92('0x7'))(_0xca92('0x8'));var config=require(_0xca92('0x9'));var jayson=require(_0xca92('0xa'));var client=jayson[_0xca92('0xb')][_0xca92('0xc')]({'port':0x232a});config[_0xca92('0xd')]=_[_0xca92('0xe')](config[_0xca92('0xd')],{'host':_0xca92('0xf'),'port':0x18eb});var socket=require(_0xca92('0x10'))(new Redis(config[_0xca92('0xd')]));require(_0xca92('0x11'))[_0xca92('0x12')](socket);function respondWithRpcPromise(_0x100031,_0x3c5fa1,_0x163e14){return new BPromise(function(_0xb854fa,_0x381de7){return client[_0xca92('0x13')](_0x100031,_0x163e14)[_0xca92('0x14')](function(_0x34aa02){logger['info'](_0xca92('0x15'),_0x3c5fa1,_0xca92('0x16'));logger['debug'](_0xca92('0x17'),_0x3c5fa1,_0xca92('0x16'),JSON[_0xca92('0x18')](_0x34aa02));if(_0x34aa02[_0xca92('0x19')]){if(_0x34aa02[_0xca92('0x19')]['code']===0x1f4){logger[_0xca92('0x19')](_0xca92('0x15'),_0x3c5fa1,_0x34aa02[_0xca92('0x19')]['message']);return _0x381de7(_0x34aa02['error']['message']);}logger[_0xca92('0x19')](_0xca92('0x15'),_0x3c5fa1,_0x34aa02[_0xca92('0x19')][_0xca92('0x1a')]);return _0xb854fa(_0x34aa02[_0xca92('0x19')]['message']);}else{logger[_0xca92('0x1b')](_0xca92('0x15'),_0x3c5fa1,'request\x20sent');_0xb854fa(_0x34aa02[_0xca92('0x1c')][_0xca92('0x1a')]);}})[_0xca92('0x1d')](function(_0x2b378c){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3c5fa1,_0x2b378c);_0x381de7(_0x2b378c);});});}exports[_0xca92('0x1e')]=function(_0xdbd130){var _0x4131df=this;return new Promise(function(_0x246b61,_0x1965a7){return db['ChatInteraction'][_0xca92('0x1f')](_0xdbd130[_0xca92('0x20')],{'raw':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x23')]||null:null,'attributes':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x24')]||null:null,'limit':_0xdbd130['options']?_0xdbd130[_0xca92('0x21')][_0xca92('0x25')]||null:null})[_0xca92('0x14')](function(_0x1c8ba0){logger[_0xca92('0x1b')]('UpdateChatInteraction',_0xdbd130);logger[_0xca92('0x26')](_0xca92('0x1e'),_0xdbd130,JSON[_0xca92('0x18')](_0x1c8ba0));_0x246b61(_0x1c8ba0);})['catch'](function(_0x5b4331){logger[_0xca92('0x19')](_0xca92('0x1e'),_0x5b4331[_0xca92('0x1a')],_0xdbd130);_0x1965a7(_0x4131df[_0xca92('0x19')](0x1f4,_0x5b4331[_0xca92('0x1a')]));});});};exports[_0xca92('0x27')]=function(_0x1ae37a){return new Promise(function(_0x1f7fb1,_0x2d6a04){return db['ChatInteraction'][_0xca92('0x28')]({'where':_0x1ae37a[_0xca92('0x21')]?_0x1ae37a[_0xca92('0x21')][_0xca92('0x23')]||null:null})['then'](function(_0x111d00){if(_0x111d00){return _0x111d00[_0xca92('0x29')](_0x1ae37a[_0xca92('0x20')][_0xca92('0x2a')],_['omit'](_0x1ae37a['body'],[_0xca92('0x2a'),'id'])||{});}})[_0xca92('0x2b')](function(_0x48eeb2){logger[_0xca92('0x1b')](_0xca92('0x2c'),_0x1ae37a);logger[_0xca92('0x26')](_0xca92('0x2c'),_0x1ae37a,JSON[_0xca92('0x18')](_0x48eeb2));_0x1f7fb1(_0x48eeb2);})[_0xca92('0x1d')](function(_0x5af478){logger[_0xca92('0x19')](_0xca92('0x2c'),_0x5af478[_0xca92('0x1a')],_0x1ae37a);_0x2d6a04(_this[_0xca92('0x19')](0x1f4,_0x5af478[_0xca92('0x1a')]));});});}; \ No newline at end of file +var _0xeb4e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','bluebird'];(function(_0x82305a,_0x46a9fb){var _0x5b57e6=function(_0x1139a9){while(--_0x1139a9){_0x82305a['push'](_0x82305a['shift']());}};_0x5b57e6(++_0x46a9fb);}(_0xeb4e,0x1b5));var _0xeeb4=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xeb4e[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xeeb4('0x0'));var util=require(_0xeeb4('0x1'));var moment=require('moment');var BPromise=require(_0xeeb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeb4('0x3'))['db'];var utils=require(_0xeeb4('0x4'));var logger=require(_0xeeb4('0x5'))(_0xeeb4('0x6'));var config=require(_0xeeb4('0x7'));var jayson=require(_0xeeb4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xeeb4('0x9')]=_['defaults'](config['redis'],{'host':_0xeeb4('0xa'),'port':0x18eb});var socket=require(_0xeeb4('0xb'))(new Redis(config['redis']));require(_0xeeb4('0xc'))[_0xeeb4('0xd')](socket);function respondWithRpcPromise(_0x5e7386,_0x4f9168,_0x9d1546){return new BPromise(function(_0x4c2806,_0x217922){return client[_0xeeb4('0xe')](_0x5e7386,_0x9d1546)[_0xeeb4('0xf')](function(_0x2e526e){logger[_0xeeb4('0x10')](_0xeeb4('0x11'),_0x4f9168,_0xeeb4('0x12'));logger[_0xeeb4('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4f9168,_0xeeb4('0x12'),JSON[_0xeeb4('0x14')](_0x2e526e));if(_0x2e526e[_0xeeb4('0x15')]){if(_0x2e526e[_0xeeb4('0x15')][_0xeeb4('0x16')]===0x1f4){logger['error'](_0xeeb4('0x11'),_0x4f9168,_0x2e526e[_0xeeb4('0x15')]['message']);return _0x217922(_0x2e526e[_0xeeb4('0x15')][_0xeeb4('0x17')]);}logger[_0xeeb4('0x15')](_0xeeb4('0x11'),_0x4f9168,_0x2e526e['error']['message']);return _0x4c2806(_0x2e526e[_0xeeb4('0x15')][_0xeeb4('0x17')]);}else{logger[_0xeeb4('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x4f9168,_0xeeb4('0x12'));_0x4c2806(_0x2e526e[_0xeeb4('0x18')]['message']);}})['catch'](function(_0x23aaaf){logger[_0xeeb4('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x4f9168,_0x23aaaf);_0x217922(_0x23aaaf);});});}exports[_0xeeb4('0x19')]=function(_0x462fd1){var _0x154b6f=this;return new Promise(function(_0x2b2dbb,_0x4b5ca7){return db['ChatInteraction'][_0xeeb4('0x1a')](_0x462fd1[_0xeeb4('0x1b')],{'raw':_0x462fd1[_0xeeb4('0x1c')]?_0x462fd1[_0xeeb4('0x1c')][_0xeeb4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x462fd1[_0xeeb4('0x1c')]?_0x462fd1['options'][_0xeeb4('0x1e')]||null:null,'attributes':_0x462fd1['options']?_0x462fd1[_0xeeb4('0x1c')]['attributes']||null:null,'limit':_0x462fd1[_0xeeb4('0x1c')]?_0x462fd1[_0xeeb4('0x1c')][_0xeeb4('0x1f')]||null:null})[_0xeeb4('0xf')](function(_0x31b598){logger[_0xeeb4('0x10')](_0xeeb4('0x19'),_0x462fd1);logger[_0xeeb4('0x13')](_0xeeb4('0x19'),_0x462fd1,JSON[_0xeeb4('0x14')](_0x31b598));_0x2b2dbb(_0x31b598);})['catch'](function(_0x242895){logger[_0xeeb4('0x15')]('UpdateChatInteraction',_0x242895[_0xeeb4('0x17')],_0x462fd1);_0x4b5ca7(_0x154b6f[_0xeeb4('0x15')](0x1f4,_0x242895[_0xeeb4('0x17')]));});});};exports[_0xeeb4('0x20')]=function(_0x3a1d8f){return new Promise(function(_0x4430a7,_0x5d9775){return db['ChatInteraction'][_0xeeb4('0x21')]({'where':_0x3a1d8f[_0xeeb4('0x1c')]?_0x3a1d8f[_0xeeb4('0x1c')][_0xeeb4('0x1e')]||null:null})['then'](function(_0x44b272){if(_0x44b272){return _0x44b272[_0xeeb4('0x22')](_0x3a1d8f[_0xeeb4('0x1b')][_0xeeb4('0x23')],_[_0xeeb4('0x24')](_0x3a1d8f[_0xeeb4('0x1b')],[_0xeeb4('0x23'),'id'])||{});}})[_0xeeb4('0x25')](function(_0x3d758e){logger[_0xeeb4('0x10')]('AddTags',_0x3a1d8f);logger[_0xeeb4('0x13')](_0xeeb4('0x26'),_0x3a1d8f,JSON[_0xeeb4('0x14')](_0x3d758e));_0x4430a7(_0x3d758e);})[_0xeeb4('0x27')](function(_0x27e0c2){logger[_0xeeb4('0x15')](_0xeeb4('0x26'),_0x27e0c2[_0xeeb4('0x17')],_0x3a1d8f);_0x5d9775(_this[_0xeeb4('0x15')](0x1f4,_0x27e0c2[_0xeeb4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index b27f8f5..8685011 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 _0xd50c=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x15a184,_0x21d451){var _0x134847=function(_0x36a221){while(--_0x36a221){_0x15a184['push'](_0x15a184['shift']());}};_0x134847(++_0x21d451);}(_0xd50c,0xed));var _0xcd50=function(_0x5aa28b,_0x3d4d1e){_0x5aa28b=_0x5aa28b-0x0;var _0xc1df71=_0xd50c[_0x5aa28b];return _0xc1df71;};'use strict';var ChatInteractionEvents=require(_0xcd50('0x0'));var events=[_0xcd50('0x1'),_0xcd50('0x2'),_0xcd50('0x3')];function createListener(_0x391b7e,_0xec40dc){return function(_0x2934d5){_0xec40dc[_0xcd50('0x4')](_0x391b7e,_0x2934d5);};}function removeListener(_0x3906e3,_0x180f7a){return function(){ChatInteractionEvents['removeListener'](_0x3906e3,_0x180f7a);};}exports[_0xcd50('0x5')]=function(_0x1cd5d6){for(var _0x5c868e=0x0,_0x2211fa=events[_0xcd50('0x6')];_0x5c868e<_0x2211fa;_0x5c868e++){var _0x36f6ea=events[_0x5c868e];var _0xa9f880=createListener(_0xcd50('0x7')+_0x36f6ea,_0x1cd5d6);ChatInteractionEvents['on'](_0x36f6ea,_0xa9f880);}}; \ No newline at end of file +var _0x21d9=['./chatInteraction.events','save','update','removeListener','register','chatInteraction:'];(function(_0x5bb710,_0x2f29f4){var _0x40ed91=function(_0x111bcb){while(--_0x111bcb){_0x5bb710['push'](_0x5bb710['shift']());}};_0x40ed91(++_0x2f29f4);}(_0x21d9,0xf0));var _0x921d=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x21d9[_0x32b993];return _0x482780;};'use strict';var ChatInteractionEvents=require(_0x921d('0x0'));var events=[_0x921d('0x1'),'remove',_0x921d('0x2')];function createListener(_0x32afc7,_0x11eff8){return function(_0x26cd01){_0x11eff8['emit'](_0x32afc7,_0x26cd01);};}function removeListener(_0x4706f4,_0x43d1a2){return function(){ChatInteractionEvents[_0x921d('0x3')](_0x4706f4,_0x43d1a2);};}exports[_0x921d('0x4')]=function(_0x290d34){for(var _0x12715c=0x0,_0x9f18a=events['length'];_0x12715c<_0x9f18a;_0x12715c++){var _0x26e2c0=events[_0x12715c];var _0x54d58f=createListener(_0x921d('0x5')+_0x26e2c0,_0x290d34);ChatInteractionEvents['on'](_0x26e2c0,_0x54d58f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 842e8f1..5958f4e 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 _0xb14a=['customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','chatinteraction:update','update','put','/:id/custom_update'];(function(_0x39365b,_0x538970){var _0x54ea69=function(_0x421ff1){while(--_0x421ff1){_0x39365b['push'](_0x39365b['shift']());}};_0x54ea69(++_0x538970);}(_0xb14a,0xb5));var _0xab14=function(_0x43ff76,_0x1dc2bb){_0x43ff76=_0x43ff76-0x0;var _0x1967b1=_0xb14a[_0x43ff76];return _0x1967b1;};'use strict';var multer=require('multer');var util=require(_0xab14('0x0'));var path=require(_0xab14('0x1'));var timeout=require(_0xab14('0x2'));var express=require(_0xab14('0x3'));var router=express[_0xab14('0x4')]();var fs_extra=require(_0xab14('0x5'));var auth=require(_0xab14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xab14('0x7'));var controller=require(_0xab14('0x8'));router[_0xab14('0x9')]('/',auth[_0xab14('0xa')](),controller[_0xab14('0xb')]);router['get'](_0xab14('0xc'),auth[_0xab14('0xa')](),controller[_0xab14('0xd')]);router['get'](_0xab14('0xe'),auth[_0xab14('0xf')](),controller['show']);router['get'](_0xab14('0x10'),auth[_0xab14('0xf')](),controller[_0xab14('0x11')]);router[_0xab14('0x9')](_0xab14('0x12'),auth[_0xab14('0xa')](),controller[_0xab14('0x13')]);router['get'](_0xab14('0x14'),auth[_0xab14('0xf')](),controller[_0xab14('0x15')]);router[_0xab14('0x9')]('/:id/download',auth[_0xab14('0xa')](),controller[_0xab14('0x16')]);router[_0xab14('0x17')]('/',auth['isAuthenticated'](),controller[_0xab14('0x18')]);router[_0xab14('0x17')](_0xab14('0x19'),auth['isAuthenticated'](),controller[_0xab14('0x1a')]);var upload=multer({'storage':multer[_0xab14('0x1b')]({'destination':function(_0x245f1b,_0x354389,_0x47addb){_0x47addb(null,path['join'](config[_0xab14('0x1c')],_0xab14('0x1d')));},'filename':function(_0x3759de,_0x42b2f5,_0x4f38cf){_0x4f38cf(null,util[_0xab14('0x1e')](_0xab14('0x1f'),Date[_0xab14('0x20')](),_0x42b2f5[_0xab14('0x21')][_0xab14('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xab14('0x17')](_0xab14('0x23'),upload[_0xab14('0x24')](_0xab14('0x25')),controller[_0xab14('0x26')]);router[_0xab14('0x17')](_0xab14('0x12'),auth[_0xab14('0xf')](),controller[_0xab14('0x27')]);router[_0xab14('0x17')](_0xab14('0x28'),auth[_0xab14('0xa')](),interaction['tracked'](_0xab14('0x29'),'chatinteraction:addtags'),controller[_0xab14('0x2a')]);router['put']('/:id',auth[_0xab14('0xa')](),interaction['tracked'](_0xab14('0x29'),_0xab14('0x2b')),controller[_0xab14('0x2c')]);router[_0xab14('0x2d')](_0xab14('0x2e'),controller[_0xab14('0x2f')]);router['put'](_0xab14('0x30'),auth['isChatInteractionAuthorized'](),controller[_0xab14('0x31')]);router[_0xab14('0x2d')](_0xab14('0x32'),controller[_0xab14('0x33')]);router[_0xab14('0x34')](_0xab14('0xe'),auth['isAuthenticated'](),interaction[_0xab14('0x35')](_0xab14('0x29'),'chatinteraction:destroy'),controller[_0xab14('0x36')]);router['delete'](_0xab14('0x28'),auth[_0xab14('0xa')](),controller[_0xab14('0x37')]);module[_0xab14('0x38')]=router; \ No newline at end of file +var _0x47d2=['post','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','single','file','attachmentUpload','addMessage','tracked','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','download','create'];(function(_0x25a73d,_0x4fd9ee){var _0x9a40b1=function(_0x4ba486){while(--_0x4ba486){_0x25a73d['push'](_0x25a73d['shift']());}};_0x9a40b1(++_0x4fd9ee);}(_0x47d2,0x122));var _0x247d=function(_0x4559a7,_0x597010){_0x4559a7=_0x4559a7-0x0;var _0x2de007=_0x47d2[_0x4559a7];return _0x2de007;};'use strict';var multer=require('multer');var util=require(_0x247d('0x0'));var path=require(_0x247d('0x1'));var timeout=require(_0x247d('0x2'));var express=require('express');var router=express[_0x247d('0x3')]();var fs_extra=require(_0x247d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x247d('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x247d('0x6')]('/',auth['isAuthenticated'](),controller[_0x247d('0x7')]);router[_0x247d('0x6')](_0x247d('0x8'),auth[_0x247d('0x9')](),controller[_0x247d('0xa')]);router[_0x247d('0x6')](_0x247d('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x247d('0xc')]);router[_0x247d('0x6')](_0x247d('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x247d('0xe')]);router[_0x247d('0x6')](_0x247d('0xf'),auth[_0x247d('0x9')](),controller[_0x247d('0x10')]);router[_0x247d('0x6')](_0x247d('0x11'),auth[_0x247d('0x12')](),controller[_0x247d('0x13')]);router[_0x247d('0x6')]('/:id/download',auth[_0x247d('0x9')](),controller[_0x247d('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x247d('0x15')]);router[_0x247d('0x16')]('/:id/vidaoo',auth[_0x247d('0x9')](),controller[_0x247d('0x17')]);var upload=multer({'storage':multer[_0x247d('0x18')]({'destination':function(_0x1c068a,_0x1603b6,_0x58f041){_0x58f041(null,path[_0x247d('0x19')](config[_0x247d('0x1a')],_0x247d('0x1b')));},'filename':function(_0x485ca6,_0x91242,_0x92f767){_0x92f767(null,util['format'](_0x247d('0x1c'),Date[_0x247d('0x1d')](),_0x91242[_0x247d('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x247d('0x16')]('/:id/attachment_upload',upload[_0x247d('0x1f')](_0x247d('0x20')),controller[_0x247d('0x21')]);router[_0x247d('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x247d('0x22')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x247d('0x23')]('chat','chatinteraction:addtags'),controller[_0x247d('0x24')]);router[_0x247d('0x25')](_0x247d('0xb'),auth[_0x247d('0x9')](),interaction[_0x247d('0x23')](_0x247d('0x26'),_0x247d('0x27')),controller[_0x247d('0x28')]);router['put'](_0x247d('0x29'),controller[_0x247d('0x2a')]);router[_0x247d('0x25')](_0x247d('0x2b'),auth[_0x247d('0x12')](),controller['abandon']);router[_0x247d('0x25')](_0x247d('0x2c'),controller[_0x247d('0x2d')]);router[_0x247d('0x2e')](_0x247d('0xb'),auth['isAuthenticated'](),interaction[_0x247d('0x23')](_0x247d('0x26'),_0x247d('0x2f')),controller[_0x247d('0x30')]);router[_0x247d('0x2e')](_0x247d('0x31'),auth['isAuthenticated'](),controller[_0x247d('0x32')]);module[_0x247d('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 78ff93f..f847f0c 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 _0x3384=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x76a3ae,_0x2e54cb){var _0x6aae2a=function(_0x247e54){while(--_0x247e54){_0x76a3ae['push'](_0x76a3ae['shift']());}};_0x6aae2a(++_0x2e54cb);}(_0x3384,0x1a0));var _0x4338=function(_0x1c4e70,_0x20c24f){_0x1c4e70=_0x1c4e70-0x0;var _0x43d1a7=_0x3384[_0x1c4e70];return _0x43d1a7;};'use strict';var Sequelize=require(_0x4338('0x0'));module[_0x4338('0x1')]={'body':{'type':Sequelize[_0x4338('0x2')](_0x4338('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4338('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd6df=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x411a13,_0x4cf363){var _0x18cf54=function(_0x1af266){while(--_0x1af266){_0x411a13['push'](_0x411a13['shift']());}};_0x18cf54(++_0x4cf363);}(_0xd6df,0x110));var _0xfd6d=function(_0x5a02c0,_0x3179f9){_0x5a02c0=_0x5a02c0-0x0;var _0x3634cb=_0xd6df[_0x5a02c0];return _0x3634cb;};'use strict';var Sequelize=require(_0xfd6d('0x0'));module[_0xfd6d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfd6d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfd6d('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfd6d('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index fd8c76c..6d54fbe 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 _0x4e14=['show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4d9d1a,_0x470c36){var _0x31674f=function(_0x32d554){while(--_0x32d554){_0x4d9d1a['push'](_0x4d9d1a['shift']());}};_0x31674f(++_0x470c36);}(_0x4e14,0x98));var _0x44e1=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x4e14[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require(_0x44e1('0x0'));var rimraf=require(_0x44e1('0x1'));var zipdir=require(_0x44e1('0x2'));var jsonpatch=require(_0x44e1('0x3'));var rp=require(_0x44e1('0x4'));var moment=require('moment');var BPromise=require(_0x44e1('0x5'));var Mustache=require(_0x44e1('0x6'));var util=require(_0x44e1('0x7'));var path=require(_0x44e1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44e1('0x9'));var fs=require('fs');var fs_extra=require(_0x44e1('0xa'));var _=require(_0x44e1('0xb'));var squel=require(_0x44e1('0xc'));var crypto=require(_0x44e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x44e1('0xf'));var Papa=require(_0x44e1('0x10'));var Redis=require(_0x44e1('0x11'));var authService=require(_0x44e1('0x12'));var qs=require(_0x44e1('0x13'));var as=require(_0x44e1('0x14'));var hardwareService=require(_0x44e1('0x15'));var logger=require(_0x44e1('0x16'))(_0x44e1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x44e1('0x18'));var db=require(_0x44e1('0x19'))['db'];config[_0x44e1('0x1a')]=_[_0x44e1('0x1b')](config[_0x44e1('0x1a')],{'host':_0x44e1('0x1c'),'port':0x18eb});var socket=require(_0x44e1('0x1d'))(new Redis(config[_0x44e1('0x1a')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x31e7e5,_0x4c428a){_0x4c428a=_0x4c428a||0xcc;return function(_0x19f15b){if(_0x19f15b){return _0x31e7e5[_0x44e1('0x1e')](_0x4c428a);}return _0x31e7e5[_0x44e1('0x1f')](_0x4c428a)[_0x44e1('0x20')]();};}function respondWithResult(_0x3681ef,_0x4c7234){_0x4c7234=_0x4c7234||0xc8;return function(_0x2d5b9b){if(_0x2d5b9b){return _0x3681ef['status'](_0x4c7234)['json'](_0x2d5b9b);}};}function respondWithFilteredResult(_0x42944e,_0x858ff7){return function(_0x29d306){if(_0x29d306){var _0x2e9b42=typeof _0x858ff7[_0x44e1('0x21')]==='undefined'&&typeof _0x858ff7[_0x44e1('0x22')]==='undefined';var _0x2d24d6=_0x29d306[_0x44e1('0x23')];var _0x49aba7=_0x2e9b42?0x0:_0x858ff7[_0x44e1('0x21')];var _0x440b64=_0x2e9b42?_0x29d306[_0x44e1('0x23')]:_0x858ff7[_0x44e1('0x21')]+_0x858ff7[_0x44e1('0x22')];var _0x2a936a;if(_0x440b64>=_0x2d24d6){_0x440b64=_0x2d24d6;_0x2a936a=0xc8;}else{_0x2a936a=0xce;}_0x42944e['status'](_0x2a936a);return _0x42944e['set'](_0x44e1('0x24'),_0x49aba7+'-'+_0x440b64+'/'+_0x2d24d6)['json'](_0x29d306);}return null;};}function patchUpdates(_0x5605d0){return function(_0x3c6b13){try{jsonpatch[_0x44e1('0x25')](_0x3c6b13,_0x5605d0,!![]);}catch(_0x468d16){return BPromise[_0x44e1('0x26')](_0x468d16);}return _0x3c6b13[_0x44e1('0x27')]();};}function saveUpdates(_0x43241a,_0x5a0bfb){return function(_0x9f6306){if(_0x9f6306){return _0x9f6306[_0x44e1('0x28')](_0x43241a)[_0x44e1('0x29')](function(_0x26d08d){return _0x26d08d;});}return null;};}function removeEntity(_0x341951,_0x489aef){return function(_0x4280a4){if(_0x4280a4){return _0x4280a4[_0x44e1('0x2a')]()[_0x44e1('0x29')](function(){_0x341951['status'](0xcc)[_0x44e1('0x20')]();});}};}function handleEntityNotFound(_0x2286fc,_0x207e40){return function(_0x27445e){if(!_0x27445e){_0x2286fc['sendStatus'](0x194);}return _0x27445e;};}function handleError(_0x297085,_0x3694dc){_0x3694dc=_0x3694dc||0x1f4;return function(_0xa08318){logger[_0x44e1('0x2b')](_0xa08318[_0x44e1('0x2c')]);if(_0xa08318[_0x44e1('0x2d')]){delete _0xa08318[_0x44e1('0x2d')];}_0x297085[_0x44e1('0x1f')](_0x3694dc)[_0x44e1('0x2e')](_0xa08318);};}exports['index']=function(_0xc5328f,_0x2828bc){var _0x2b6222={},_0x1f8efd={},_0x56cc8a={'count':0x0,'rows':[]};var _0x51d965=_[_0x44e1('0x2f')](db[_0x44e1('0x30')][_0x44e1('0x31')],function(_0x1cc23a){return{'name':_0x1cc23a[_0x44e1('0x32')],'type':_0x1cc23a[_0x44e1('0x33')][_0x44e1('0x34')]};});_0x1f8efd[_0x44e1('0x35')]=_[_0x44e1('0x2f')](_0x51d965,_0x44e1('0x2d'));_0x1f8efd[_0x44e1('0x36')]=_[_0x44e1('0x37')](_0xc5328f[_0x44e1('0x36')]);_0x1f8efd[_0x44e1('0x38')]=_[_0x44e1('0x39')](_0x1f8efd['model'],_0x1f8efd[_0x44e1('0x36')]);_0x2b6222[_0x44e1('0x3a')]=_[_0x44e1('0x39')](_0x1f8efd['model'],qs[_0x44e1('0x3b')](_0xc5328f[_0x44e1('0x36')]['fields']));_0x2b6222['attributes']=_0x2b6222[_0x44e1('0x3a')][_0x44e1('0x3c')]?_0x2b6222[_0x44e1('0x3a')]:_0x1f8efd[_0x44e1('0x35')];if(!_0xc5328f[_0x44e1('0x36')][_0x44e1('0x3d')](_0x44e1('0x3e'))){_0x2b6222[_0x44e1('0x22')]=qs[_0x44e1('0x22')](_0xc5328f['query'][_0x44e1('0x22')]);_0x2b6222[_0x44e1('0x21')]=qs[_0x44e1('0x21')](_0xc5328f['query'][_0x44e1('0x21')]);}_0x2b6222[_0x44e1('0x3f')]=qs[_0x44e1('0x40')](_0xc5328f[_0x44e1('0x36')][_0x44e1('0x40')]);_0x2b6222[_0x44e1('0x41')]=qs[_0x44e1('0x38')](_[_0x44e1('0x42')](_0xc5328f[_0x44e1('0x36')],_0x1f8efd[_0x44e1('0x38')]),_0x51d965);if(_0xc5328f[_0x44e1('0x36')][_0x44e1('0x43')]){_0x2b6222[_0x44e1('0x41')]=_[_0x44e1('0x44')](_0x2b6222[_0x44e1('0x41')],{'$or':_[_0x44e1('0x2f')](_0x51d965,function(_0x1b9bfc){if(_0x1b9bfc['type']!==_0x44e1('0x45')){var _0x37dfde={};_0x37dfde[_0x1b9bfc['name']]={'$like':'%'+_0xc5328f[_0x44e1('0x36')][_0x44e1('0x43')]+'%'};return _0x37dfde;}})});}_0x2b6222=_[_0x44e1('0x44')]({},_0x2b6222,_0xc5328f[_0x44e1('0x46')]);var _0x5d80fb={'where':_0x2b6222[_0x44e1('0x41')]};return db[_0x44e1('0x30')][_0x44e1('0x23')](_0x5d80fb)['then'](function(_0x290aa3){_0x56cc8a['count']=_0x290aa3;if(_0xc5328f[_0x44e1('0x36')][_0x44e1('0x47')]){_0x2b6222[_0x44e1('0x48')]=[{'all':!![]}];}return db[_0x44e1('0x30')][_0x44e1('0x49')](_0x2b6222);})[_0x44e1('0x29')](function(_0x1df32d){_0x56cc8a[_0x44e1('0x4a')]=_0x1df32d;return _0x56cc8a;})[_0x44e1('0x29')](respondWithFilteredResult(_0x2828bc,_0x2b6222))[_0x44e1('0x4b')](handleError(_0x2828bc,null));};exports[_0x44e1('0x4c')]=function(_0x1e92ad,_0x18ecba){var _0xdf5e07={'raw':!![],'where':{'id':_0x1e92ad[_0x44e1('0x4d')]['id']}},_0xcc01e2={};_0xcc01e2['model']=_[_0x44e1('0x37')](db[_0x44e1('0x30')][_0x44e1('0x31')]);_0xcc01e2[_0x44e1('0x36')]=_[_0x44e1('0x37')](_0x1e92ad[_0x44e1('0x36')]);_0xcc01e2['filters']=_[_0x44e1('0x39')](_0xcc01e2[_0x44e1('0x35')],_0xcc01e2['query']);_0xdf5e07[_0x44e1('0x3a')]=_[_0x44e1('0x39')](_0xcc01e2[_0x44e1('0x35')],qs[_0x44e1('0x3b')](_0x1e92ad[_0x44e1('0x36')][_0x44e1('0x3b')]));_0xdf5e07[_0x44e1('0x3a')]=_0xdf5e07['attributes'][_0x44e1('0x3c')]?_0xdf5e07[_0x44e1('0x3a')]:_0xcc01e2[_0x44e1('0x35')];if(_0x1e92ad[_0x44e1('0x36')][_0x44e1('0x47')]){_0xdf5e07[_0x44e1('0x48')]=[{'all':!![]}];}_0xdf5e07=_['merge']({},_0xdf5e07,_0x1e92ad[_0x44e1('0x46')]);return db[_0x44e1('0x30')][_0x44e1('0x4e')](_0xdf5e07)['then'](handleEntityNotFound(_0x18ecba,null))['then'](respondWithResult(_0x18ecba,null))[_0x44e1('0x4b')](handleError(_0x18ecba,null));};exports[_0x44e1('0x4f')]=function(_0x193612,_0x3c3901){return db[_0x44e1('0x30')]['create'](_0x193612[_0x44e1('0x50')],{})[_0x44e1('0x29')](respondWithResult(_0x3c3901,0xc9))[_0x44e1('0x4b')](handleError(_0x3c3901,null));};exports['update']=function(_0x58ff1a,_0x1367ea){if(_0x58ff1a[_0x44e1('0x50')]['id']){delete _0x58ff1a[_0x44e1('0x50')]['id'];}return db[_0x44e1('0x30')]['find']({'where':{'id':_0x58ff1a['params']['id']}})[_0x44e1('0x29')](handleEntityNotFound(_0x1367ea,null))['then'](saveUpdates(_0x58ff1a['body'],null))[_0x44e1('0x29')](respondWithResult(_0x1367ea,null))[_0x44e1('0x4b')](handleError(_0x1367ea,null));};exports[_0x44e1('0x2a')]=function(_0x12dfcb,_0x1b6389){return db[_0x44e1('0x30')][_0x44e1('0x4e')]({'where':{'id':_0x12dfcb[_0x44e1('0x4d')]['id']}})[_0x44e1('0x29')](handleEntityNotFound(_0x1b6389,null))[_0x44e1('0x29')](removeEntity(_0x1b6389,null))['catch'](handleError(_0x1b6389,null));};exports['describe']=function(_0x3dde2a,_0x49a85d){return db['ChatInternalMessage'][_0x44e1('0x51')]()[_0x44e1('0x29')](respondWithResult(_0x49a85d,null))[_0x44e1('0x4b')](handleError(_0x49a85d,null));};function wrapUser(_0x262a39){return function(_0x569f44){var _0x2de2c5=_0x262a39[_0x44e1('0x52')]({'plain':!![]});_0x2de2c5[_0x44e1('0x53')]=[];if(_0x569f44){_0x2de2c5[_0x44e1('0x54')]=_0x569f44[_0x44e1('0x55')];_0x2de2c5[_0x44e1('0x56')]=_0x569f44;}else{_0x2de2c5[_0x44e1('0x54')]=moment(0x0)[_0x44e1('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2de2c5[_0x44e1('0x56')]={};}return _0x2de2c5;};}exports['getUsers']=function(_0x187b21,_0x24e2c0,_0x1f31ba){var _0x387b1f=[];return db[_0x44e1('0x58')]['findAll']({'where':{'role':[_0x44e1('0x59'),_0x44e1('0x5a'),_0x44e1('0x5b')]},'attributes':['id',_0x44e1('0x5c'),_0x44e1('0x2d'),_0x44e1('0x5d'),_0x44e1('0x5e'),_0x44e1('0x5f'),_0x44e1('0x60'),_0x44e1('0x61'),_0x44e1('0x62'),_0x44e1('0x63')],'order':qs['sort'](_0x44e1('0x64')),'include':[{'model':db[_0x44e1('0x65')],'as':_0x44e1('0x66'),'attributes':['id',_0x44e1('0x2d'),_0x44e1('0x33')],'through':{'attributes':[]}}]})[_0x44e1('0x29')](function(_0x3683a0){if(_0x3683a0){var _0x47ad65=_0x187b21[_0x44e1('0x5b')][_0x44e1('0x52')]({'plain':!![]});if(!_0x47ad65)throw new Error(_0x44e1('0x67'));if(_0x47ad65[_0x44e1('0x5d')]==='user'){return db[_0x44e1('0x68')][_0x44e1('0x4e')]({'where':{'name':_0x44e1('0x69'),'userProfileId':_0x47ad65['userProfileId']},'raw':!![]})[_0x44e1('0x29')](function(_0x23fe20){if(_0x23fe20){if(_0x23fe20[_0x44e1('0x6a')]===0x0){return db[_0x44e1('0x6b')][_0x44e1('0x49')]({'where':{'sectionId':_0x23fe20['id']},'raw':!![]})[_0x44e1('0x29')](function(_0x53c105){var _0x5297b6=[];if(_[_0x44e1('0x6c')](_0x53c105)){_0x5297b6=_[_0x44e1('0x43')](_0x3683a0,function(_0x12d486){if(_0x12d486[_0x44e1('0x5d')]!==_0x44e1('0x59')){return _0x12d486;}});return _0x5297b6;}else{for(var _0x38618c=0x0;_0x38618c<_0x3683a0[_0x44e1('0x3c')];_0x38618c++){var _0x41d135=_0x3683a0[_0x38618c];if(_0x41d135[_0x44e1('0x5d')]===_0x44e1('0x59')){var _0x55e48f=_[_0x44e1('0x4e')](_0x53c105,function(_0x59ee70){return _0x59ee70[_0x44e1('0x6d')]===_0x41d135['id'];});if(_0x55e48f)_0x5297b6[_0x44e1('0x6e')](_0x41d135);}else{_0x5297b6[_0x44e1('0x6e')](_0x41d135);}}return _0x5297b6;}});}else{return _0x3683a0;}}else{var _0x587c37=_[_0x44e1('0x43')](_0x3683a0,function(_0x36abc1){if(_0x36abc1[_0x44e1('0x5d')]!=='agent'){return _0x36abc1;}});return _0x587c37;}});}else{return _0x3683a0;}}})['then'](function(_0x4dbecd){var _0x57aebe=[];if(_0x4dbecd){_0x387b1f=_0x4dbecd;for(var _0x4e392c=0x0;_0x4e392c<_0x4dbecd[_0x44e1('0x3c')];_0x4e392c+=0x1){_0x387b1f[_0x4e392c]['messages']=[];_0x57aebe[_0x44e1('0x6e')](db['ChatInternalMessage'][_0x44e1('0x4e')]({'where':{'FromId':[_0x187b21[_0x44e1('0x5b')]['id'],_0x4dbecd[_0x4e392c]['id']],'ToId':[_0x187b21[_0x44e1('0x5b')]['id'],_0x4dbecd[_0x4e392c]['id']],'ChatGroupId':null},'attributes':['id',_0x44e1('0x55'),_0x44e1('0x6f'),'ToId','read',_0x44e1('0x50')],'order':qs[_0x44e1('0x40')](_0x44e1('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x44e1('0x29')](wrapUser(_0x4dbecd[_0x4e392c])));}return BPromise[_0x44e1('0x71')](_0x57aebe);}return[];})[_0x44e1('0x29')](function(_0xf3b6e5){return{'rows':_0xf3b6e5,'count':_0xf3b6e5[_0x44e1('0x3c')]};})[_0x44e1('0x29')](respondWithResult(_0x24e2c0,null))[_0x44e1('0x4b')](handleError(_0x24e2c0,null));}; \ No newline at end of file +var _0xbc99=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','catch','params','includeAll','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type'];(function(_0x560c01,_0x12b739){var _0x41885e=function(_0x435bbb){while(--_0x435bbb){_0x560c01['push'](_0x560c01['shift']());}};_0x41885e(++_0x12b739);}(_0xbc99,0xa8));var _0x9bc9=function(_0x493869,_0x165d37){_0x493869=_0x493869-0x0;var _0x44ecbb=_0xbc99[_0x493869];return _0x44ecbb;};'use strict';var emlformat=require(_0x9bc9('0x0'));var rimraf=require(_0x9bc9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9bc9('0x2'));var moment=require(_0x9bc9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9bc9('0x4'));var util=require(_0x9bc9('0x5'));var path=require(_0x9bc9('0x6'));var sox=require(_0x9bc9('0x7'));var csv=require(_0x9bc9('0x8'));var ejs=require(_0x9bc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bc9('0xa'));var squel=require(_0x9bc9('0xb'));var crypto=require(_0x9bc9('0xc'));var jsforce=require(_0x9bc9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9bc9('0x8'));var querystring=require(_0x9bc9('0xe'));var Papa=require(_0x9bc9('0xf'));var Redis=require(_0x9bc9('0x10'));var authService=require(_0x9bc9('0x11'));var qs=require(_0x9bc9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bc9('0x13'));var logger=require(_0x9bc9('0x14'))(_0x9bc9('0x15'));var utils=require('../../config/utils');var config=require(_0x9bc9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9bc9('0x17')]=_[_0x9bc9('0x18')](config[_0x9bc9('0x17')],{'host':_0x9bc9('0x19'),'port':0x18eb});var socket=require(_0x9bc9('0x1a'))(new Redis(config[_0x9bc9('0x17')]));require(_0x9bc9('0x1b'))['register'](socket);function respondWithStatusCode(_0x4c1317,_0x1350fb){_0x1350fb=_0x1350fb||0xcc;return function(_0x47754f){if(_0x47754f){return _0x4c1317[_0x9bc9('0x1c')](_0x1350fb);}return _0x4c1317[_0x9bc9('0x1d')](_0x1350fb)[_0x9bc9('0x1e')]();};}function respondWithResult(_0x4961da,_0x33122f){_0x33122f=_0x33122f||0xc8;return function(_0x335a9f){if(_0x335a9f){return _0x4961da[_0x9bc9('0x1d')](_0x33122f)['json'](_0x335a9f);}};}function respondWithFilteredResult(_0x61f14e,_0x38c53d){return function(_0xb085d6){if(_0xb085d6){var _0x38aba2=typeof _0x38c53d[_0x9bc9('0x1f')]===_0x9bc9('0x20')&&typeof _0x38c53d['limit']===_0x9bc9('0x20');var _0x2df54a=_0xb085d6[_0x9bc9('0x21')];var _0x35a2aa=_0x38aba2?0x0:_0x38c53d[_0x9bc9('0x1f')];var _0x2d6b40=_0x38aba2?_0xb085d6['count']:_0x38c53d[_0x9bc9('0x1f')]+_0x38c53d['limit'];var _0x278de5;if(_0x2d6b40>=_0x2df54a){_0x2d6b40=_0x2df54a;_0x278de5=0xc8;}else{_0x278de5=0xce;}_0x61f14e['status'](_0x278de5);return _0x61f14e[_0x9bc9('0x22')]('Content-Range',_0x35a2aa+'-'+_0x2d6b40+'/'+_0x2df54a)['json'](_0xb085d6);}return null;};}function patchUpdates(_0x586e31){return function(_0x48d65e){try{jsonpatch[_0x9bc9('0x23')](_0x48d65e,_0x586e31,!![]);}catch(_0xe58ebe){return BPromise[_0x9bc9('0x24')](_0xe58ebe);}return _0x48d65e[_0x9bc9('0x25')]();};}function saveUpdates(_0x2385e5,_0x4bced8){return function(_0x24e916){if(_0x24e916){return _0x24e916[_0x9bc9('0x26')](_0x2385e5)['then'](function(_0x26bd75){return _0x26bd75;});}return null;};}function removeEntity(_0xf97786,_0x42ce37){return function(_0x34ed25){if(_0x34ed25){return _0x34ed25[_0x9bc9('0x27')]()[_0x9bc9('0x28')](function(){_0xf97786[_0x9bc9('0x1d')](0xcc)[_0x9bc9('0x1e')]();});}};}function handleEntityNotFound(_0x2e9e39,_0x2479ae){return function(_0x264104){if(!_0x264104){_0x2e9e39['sendStatus'](0x194);}return _0x264104;};}function handleError(_0x1f2c75,_0x2e7590){_0x2e7590=_0x2e7590||0x1f4;return function(_0x17c680){logger[_0x9bc9('0x29')](_0x17c680[_0x9bc9('0x2a')]);if(_0x17c680[_0x9bc9('0x2b')]){delete _0x17c680[_0x9bc9('0x2b')];}_0x1f2c75[_0x9bc9('0x1d')](_0x2e7590)['send'](_0x17c680);};}exports[_0x9bc9('0x2c')]=function(_0x466223,_0x19e5ab){var _0x597cfd={},_0x248e72={},_0x348c10={'count':0x0,'rows':[]};var _0x14c6d8=_[_0x9bc9('0x2d')](db[_0x9bc9('0x2e')][_0x9bc9('0x2f')],function(_0x4fde4e){return{'name':_0x4fde4e[_0x9bc9('0x30')],'type':_0x4fde4e[_0x9bc9('0x31')][_0x9bc9('0x32')]};});_0x248e72[_0x9bc9('0x33')]=_[_0x9bc9('0x2d')](_0x14c6d8,_0x9bc9('0x2b'));_0x248e72[_0x9bc9('0x34')]=_[_0x9bc9('0x35')](_0x466223[_0x9bc9('0x34')]);_0x248e72['filters']=_[_0x9bc9('0x36')](_0x248e72[_0x9bc9('0x33')],_0x248e72[_0x9bc9('0x34')]);_0x597cfd['attributes']=_['intersection'](_0x248e72[_0x9bc9('0x33')],qs[_0x9bc9('0x37')](_0x466223['query'][_0x9bc9('0x37')]));_0x597cfd[_0x9bc9('0x38')]=_0x597cfd['attributes'][_0x9bc9('0x39')]?_0x597cfd[_0x9bc9('0x38')]:_0x248e72[_0x9bc9('0x33')];if(!_0x466223[_0x9bc9('0x34')][_0x9bc9('0x3a')](_0x9bc9('0x3b'))){_0x597cfd[_0x9bc9('0x3c')]=qs[_0x9bc9('0x3c')](_0x466223[_0x9bc9('0x34')][_0x9bc9('0x3c')]);_0x597cfd[_0x9bc9('0x1f')]=qs[_0x9bc9('0x1f')](_0x466223[_0x9bc9('0x34')][_0x9bc9('0x1f')]);}_0x597cfd[_0x9bc9('0x3d')]=qs['sort'](_0x466223[_0x9bc9('0x34')][_0x9bc9('0x3e')]);_0x597cfd[_0x9bc9('0x3f')]=qs['filters'](_[_0x9bc9('0x40')](_0x466223[_0x9bc9('0x34')],_0x248e72[_0x9bc9('0x41')]),_0x14c6d8);if(_0x466223[_0x9bc9('0x34')]['filter']){_0x597cfd[_0x9bc9('0x3f')]=_[_0x9bc9('0x42')](_0x597cfd[_0x9bc9('0x3f')],{'$or':_[_0x9bc9('0x2d')](_0x14c6d8,function(_0x392412){if(_0x392412['type']!==_0x9bc9('0x43')){var _0x28b7a1={};_0x28b7a1[_0x392412[_0x9bc9('0x2b')]]={'$like':'%'+_0x466223[_0x9bc9('0x34')][_0x9bc9('0x44')]+'%'};return _0x28b7a1;}})});}_0x597cfd=_[_0x9bc9('0x42')]({},_0x597cfd,_0x466223[_0x9bc9('0x45')]);var _0x58b12f={'where':_0x597cfd['where']};return db[_0x9bc9('0x2e')]['count'](_0x58b12f)['then'](function(_0x25372c){_0x348c10[_0x9bc9('0x21')]=_0x25372c;if(_0x466223['query']['includeAll']){_0x597cfd[_0x9bc9('0x46')]=[{'all':!![]}];}return db[_0x9bc9('0x2e')]['findAll'](_0x597cfd);})['then'](function(_0x1b94f2){_0x348c10['rows']=_0x1b94f2;return _0x348c10;})['then'](respondWithFilteredResult(_0x19e5ab,_0x597cfd))[_0x9bc9('0x47')](handleError(_0x19e5ab,null));};exports['show']=function(_0x518263,_0x32d624){var _0x4ad1db={'raw':!![],'where':{'id':_0x518263[_0x9bc9('0x48')]['id']}},_0x2aade7={};_0x2aade7[_0x9bc9('0x33')]=_[_0x9bc9('0x35')](db[_0x9bc9('0x2e')][_0x9bc9('0x2f')]);_0x2aade7[_0x9bc9('0x34')]=_[_0x9bc9('0x35')](_0x518263[_0x9bc9('0x34')]);_0x2aade7[_0x9bc9('0x41')]=_[_0x9bc9('0x36')](_0x2aade7[_0x9bc9('0x33')],_0x2aade7[_0x9bc9('0x34')]);_0x4ad1db[_0x9bc9('0x38')]=_[_0x9bc9('0x36')](_0x2aade7['model'],qs[_0x9bc9('0x37')](_0x518263[_0x9bc9('0x34')][_0x9bc9('0x37')]));_0x4ad1db['attributes']=_0x4ad1db[_0x9bc9('0x38')][_0x9bc9('0x39')]?_0x4ad1db['attributes']:_0x2aade7[_0x9bc9('0x33')];if(_0x518263[_0x9bc9('0x34')][_0x9bc9('0x49')]){_0x4ad1db[_0x9bc9('0x46')]=[{'all':!![]}];}_0x4ad1db=_[_0x9bc9('0x42')]({},_0x4ad1db,_0x518263[_0x9bc9('0x45')]);return db[_0x9bc9('0x2e')][_0x9bc9('0x4a')](_0x4ad1db)[_0x9bc9('0x28')](handleEntityNotFound(_0x32d624,null))[_0x9bc9('0x28')](respondWithResult(_0x32d624,null))[_0x9bc9('0x47')](handleError(_0x32d624,null));};exports[_0x9bc9('0x4b')]=function(_0x5c6ede,_0x2c4153){return db[_0x9bc9('0x2e')][_0x9bc9('0x4b')](_0x5c6ede['body'],{})[_0x9bc9('0x28')](respondWithResult(_0x2c4153,0xc9))[_0x9bc9('0x47')](handleError(_0x2c4153,null));};exports[_0x9bc9('0x26')]=function(_0x53c333,_0x3342dc){if(_0x53c333[_0x9bc9('0x4c')]['id']){delete _0x53c333[_0x9bc9('0x4c')]['id'];}return db[_0x9bc9('0x2e')][_0x9bc9('0x4a')]({'where':{'id':_0x53c333[_0x9bc9('0x48')]['id']}})['then'](handleEntityNotFound(_0x3342dc,null))['then'](saveUpdates(_0x53c333['body'],null))['then'](respondWithResult(_0x3342dc,null))[_0x9bc9('0x47')](handleError(_0x3342dc,null));};exports['destroy']=function(_0x5093c5,_0x52c151){return db[_0x9bc9('0x2e')]['find']({'where':{'id':_0x5093c5[_0x9bc9('0x48')]['id']}})[_0x9bc9('0x28')](handleEntityNotFound(_0x52c151,null))[_0x9bc9('0x28')](removeEntity(_0x52c151,null))[_0x9bc9('0x47')](handleError(_0x52c151,null));};exports[_0x9bc9('0x4d')]=function(_0x1150bb,_0x44244a){return db['ChatInternalMessage']['describe']()[_0x9bc9('0x28')](respondWithResult(_0x44244a,null))[_0x9bc9('0x47')](handleError(_0x44244a,null));};function wrapUser(_0x276bc3){return function(_0x349d79){var _0x3dead=_0x276bc3[_0x9bc9('0x4e')]({'plain':!![]});_0x3dead[_0x9bc9('0x4f')]=[];if(_0x349d79){_0x3dead[_0x9bc9('0x50')]=_0x349d79[_0x9bc9('0x51')];_0x3dead['lastMessage']=_0x349d79;}else{_0x3dead[_0x9bc9('0x50')]=moment(0x0)[_0x9bc9('0x52')](_0x9bc9('0x53'));_0x3dead['lastMessage']={};}return _0x3dead;};}exports['getUsers']=function(_0x5edf28,_0x593cb1,_0x50d6cf){var _0x4cfae9=[];return db[_0x9bc9('0x54')][_0x9bc9('0x55')]({'where':{'role':['agent','admin',_0x9bc9('0x56')]},'attributes':['id',_0x9bc9('0x57'),_0x9bc9('0x2b'),_0x9bc9('0x58'),_0x9bc9('0x59'),_0x9bc9('0x5a'),_0x9bc9('0x5b'),_0x9bc9('0x5c'),_0x9bc9('0x5d'),'showWebBar'],'order':qs[_0x9bc9('0x3e')](_0x9bc9('0x5e')),'include':[{'model':db[_0x9bc9('0x5f')],'as':_0x9bc9('0x60'),'attributes':['id',_0x9bc9('0x2b'),_0x9bc9('0x31')],'through':{'attributes':[]}}]})[_0x9bc9('0x28')](function(_0x29c0a1){if(_0x29c0a1){var _0x50b07c=_0x5edf28['user'][_0x9bc9('0x4e')]({'plain':!![]});if(!_0x50b07c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50b07c['role']===_0x9bc9('0x56')){return db['UserProfileSection'][_0x9bc9('0x4a')]({'where':{'name':_0x9bc9('0x61'),'userProfileId':_0x50b07c[_0x9bc9('0x62')]},'raw':!![]})[_0x9bc9('0x28')](function(_0x3b11c1){if(_0x3b11c1){if(_0x3b11c1[_0x9bc9('0x63')]===0x0){return db[_0x9bc9('0x64')][_0x9bc9('0x55')]({'where':{'sectionId':_0x3b11c1['id']},'raw':!![]})[_0x9bc9('0x28')](function(_0x3a9869){var _0x5b1c78=[];if(_[_0x9bc9('0x65')](_0x3a9869)){_0x5b1c78=_[_0x9bc9('0x44')](_0x29c0a1,function(_0x26d75f){if(_0x26d75f['role']!==_0x9bc9('0x66')){return _0x26d75f;}});return _0x5b1c78;}else{for(var _0x16f1cf=0x0;_0x16f1cf<_0x29c0a1[_0x9bc9('0x39')];_0x16f1cf++){var _0x591012=_0x29c0a1[_0x16f1cf];if(_0x591012[_0x9bc9('0x58')]===_0x9bc9('0x66')){var _0x510cba=_[_0x9bc9('0x4a')](_0x3a9869,function(_0x5efcb1){return _0x5efcb1[_0x9bc9('0x67')]===_0x591012['id'];});if(_0x510cba)_0x5b1c78['push'](_0x591012);}else{_0x5b1c78['push'](_0x591012);}}return _0x5b1c78;}});}else{return _0x29c0a1;}}else{var _0x5228ce=_[_0x9bc9('0x44')](_0x29c0a1,function(_0x48ceed){if(_0x48ceed[_0x9bc9('0x58')]!=='agent'){return _0x48ceed;}});return _0x5228ce;}});}else{return _0x29c0a1;}}})[_0x9bc9('0x28')](function(_0x3c6ef4){var _0x1a287f=[];if(_0x3c6ef4){_0x4cfae9=_0x3c6ef4;for(var _0x51629d=0x0;_0x51629d<_0x3c6ef4['length'];_0x51629d+=0x1){_0x4cfae9[_0x51629d][_0x9bc9('0x4f')]=[];_0x1a287f[_0x9bc9('0x68')](db[_0x9bc9('0x2e')][_0x9bc9('0x4a')]({'where':{'FromId':[_0x5edf28['user']['id'],_0x3c6ef4[_0x51629d]['id']],'ToId':[_0x5edf28[_0x9bc9('0x56')]['id'],_0x3c6ef4[_0x51629d]['id']],'ChatGroupId':null},'attributes':['id',_0x9bc9('0x51'),_0x9bc9('0x69'),_0x9bc9('0x6a'),'read',_0x9bc9('0x4c')],'order':qs['sort'](_0x9bc9('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3c6ef4[_0x51629d])));}return BPromise[_0x9bc9('0x6c')](_0x1a287f);}return[];})[_0x9bc9('0x28')](function(_0x37928a){return{'rows':_0x37928a,'count':_0x37928a['length']};})[_0x9bc9('0x28')](respondWithResult(_0x593cb1,null))[_0x9bc9('0x47')](handleError(_0x593cb1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index dc71d45..9ab3aab 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 _0x6ea6=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x41b3a7,_0x3b754a){var _0x573b21=function(_0x326117){while(--_0x326117){_0x41b3a7['push'](_0x41b3a7['shift']());}};_0x573b21(++_0x3b754a);}(_0x6ea6,0x14f));var _0x66ea=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x6ea6[_0x546aaf];return _0x1cbf6d;};'use strict';var EventEmitter=require(_0x66ea('0x0'));var ChatInternalMessage=require(_0x66ea('0x1'))['db'][_0x66ea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x66ea('0x3')](0x0);var events={'afterCreate':_0x66ea('0x4'),'afterUpdate':_0x66ea('0x5'),'afterDestroy':_0x66ea('0x6')};function emitEvent(_0xb2e7d6){return function(_0x1449db,_0x1b5935,_0x1b266f){ChatInternalMessageEvents['emit'](_0xb2e7d6+':'+_0x1449db['id'],_0x1449db);ChatInternalMessageEvents[_0x66ea('0x7')](_0xb2e7d6,_0x1449db);_0x1b266f(null);};}for(var e in events){if(events[_0x66ea('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x66ea('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x7381=['exports','events','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x13a3cc,_0x136345){var _0x583000=function(_0x10eb7c){while(--_0x10eb7c){_0x13a3cc['push'](_0x13a3cc['shift']());}};_0x583000(++_0x136345);}(_0x7381,0x133));var _0x1738=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x7381[_0x29aefc];return _0x11be36;};'use strict';var EventEmitter=require(_0x1738('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x1738('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58068d){return function(_0x5d44dd,_0x15e752,_0x3fdeb3){ChatInternalMessageEvents['emit'](_0x58068d+':'+_0x5d44dd['id'],_0x5d44dd);ChatInternalMessageEvents[_0x1738('0x2')](_0x58068d,_0x5d44dd);_0x3fdeb3(null);};}for(var e in events){if(events[_0x1738('0x3')](e)){var event=events[e];ChatInternalMessage[_0x1738('0x4')](e,emitEvent(event));}}module[_0x1738('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1f8e15d..e19eea7 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 _0x23df=['rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x23df,0x173));var _0xf23d=function(_0x57e098,_0x29f6e6){_0x57e098=_0x57e098-0x0;var _0x144829=_0x23df[_0x57e098];return _0x144829;};'use strict';var _=require('lodash');var util=require(_0xf23d('0x0'));var logger=require(_0xf23d('0x1'))(_0xf23d('0x2'));var moment=require(_0xf23d('0x3'));var BPromise=require(_0xf23d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf23d('0x5'));var rimraf=require(_0xf23d('0x6'));var config=require('../../config/environment');var attributes=require(_0xf23d('0x7'));module[_0xf23d('0x8')]=function(_0x39a41a,_0x521c23){return _0x39a41a['define'](_0xf23d('0x9'),attributes,{'tableName':_0xf23d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf23d('0xb'),'collate':_0xf23d('0xc')});}; \ No newline at end of file +var _0xf169=['define','ChatInternalMessage','util','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x20f52e,_0x596d5e){var _0x1489ca=function(_0x550038){while(--_0x550038){_0x20f52e['push'](_0x20f52e['shift']());}};_0x1489ca(++_0x596d5e);}(_0xf169,0x1c4));var _0x9f16=function(_0x451e00,_0x4c8dd3){_0x451e00=_0x451e00-0x0;var _0x4148e7=_0xf169[_0x451e00];return _0x4148e7;};'use strict';var _=require('lodash');var util=require(_0x9f16('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9f16('0x1'));var rp=require(_0x9f16('0x2'));var fs=require('fs');var path=require(_0x9f16('0x3'));var rimraf=require(_0x9f16('0x4'));var config=require(_0x9f16('0x5'));var attributes=require(_0x9f16('0x6'));module['exports']=function(_0x7c7b2e,_0x5cce95){return _0x7c7b2e[_0x9f16('0x7')](_0x9f16('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 e297087..0edc99b 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 _0x5267=['client','http','redis','defaults','localhost','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x42e3d9,_0x17b0c3){var _0x53c442=function(_0x2df7b7){while(--_0x2df7b7){_0x42e3d9['push'](_0x42e3d9['shift']());}};_0x53c442(++_0x17b0c3);}(_0x5267,0x1f0));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7526('0x0'));var util=require('util');var moment=require(_0x7526('0x1'));var BPromise=require(_0x7526('0x2'));var rs=require(_0x7526('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7526('0x4'))['db'];var utils=require(_0x7526('0x5'));var logger=require('../../config/logger')(_0x7526('0x6'));var config=require(_0x7526('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7526('0x8')][_0x7526('0x9')]({'port':0x232a});config[_0x7526('0xa')]=_[_0x7526('0xb')](config[_0x7526('0xa')],{'host':_0x7526('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7526('0xa')]));require('./chatInternalMessage.socket')[_0x7526('0xd')](socket);function respondWithRpcPromise(_0x2d8f30,_0x46f666,_0x33500c){return new BPromise(function(_0x28e843,_0x22a783){return client['request'](_0x2d8f30,_0x33500c)['then'](function(_0x65f35b){logger[_0x7526('0xe')](_0x7526('0xf'),_0x46f666,_0x7526('0x10'));logger[_0x7526('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x46f666,_0x7526('0x10'),JSON['stringify'](_0x65f35b));if(_0x65f35b[_0x7526('0x12')]){if(_0x65f35b['error']['code']===0x1f4){logger[_0x7526('0x12')](_0x7526('0xf'),_0x46f666,_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);return _0x22a783(_0x65f35b['error']['message']);}logger[_0x7526('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x46f666,_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);return _0x28e843(_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);}else{logger[_0x7526('0xe')](_0x7526('0xf'),_0x46f666,_0x7526('0x10'));_0x28e843(_0x65f35b['result'][_0x7526('0x13')]);}})[_0x7526('0x14')](function(_0xdf7e20){logger[_0x7526('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x46f666,_0xdf7e20);_0x22a783(_0xdf7e20);});});} \ No newline at end of file +var _0xea81=['rpc','../../config/environment','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x169585,_0x476cc6){var _0x5cf666=function(_0x4f7106){while(--_0x4f7106){_0x169585['push'](_0x169585['shift']());}};_0x5cf666(++_0x476cc6);}(_0xea81,0x1ed));var _0x1ea8=function(_0x89aca9,_0x2cf00a){_0x89aca9=_0x89aca9-0x0;var _0x17f368=_0xea81[_0x89aca9];return _0x17f368;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var moment=require(_0x1ea8('0x2'));var BPromise=require(_0x1ea8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ea8('0x4'))['db'];var utils=require(_0x1ea8('0x5'));var logger=require(_0x1ea8('0x6'))(_0x1ea8('0x7'));var config=require(_0x1ea8('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x1ea8('0x9')]=_[_0x1ea8('0xa')](config[_0x1ea8('0x9')],{'host':_0x1ea8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1ea8('0x9')]));require(_0x1ea8('0xc'))[_0x1ea8('0xd')](socket);function respondWithRpcPromise(_0x432447,_0x495092,_0x5732b5){return new BPromise(function(_0x5be789,_0x5bd5dc){return client[_0x1ea8('0xe')](_0x432447,_0x5732b5)[_0x1ea8('0xf')](function(_0x5a327){logger[_0x1ea8('0x10')](_0x1ea8('0x11'),_0x495092,'request\x20sent');logger['debug'](_0x1ea8('0x12'),_0x495092,_0x1ea8('0x13'),JSON['stringify'](_0x5a327));if(_0x5a327[_0x1ea8('0x14')]){if(_0x5a327[_0x1ea8('0x14')][_0x1ea8('0x15')]===0x1f4){logger[_0x1ea8('0x14')](_0x1ea8('0x11'),_0x495092,_0x5a327['error'][_0x1ea8('0x16')]);return _0x5bd5dc(_0x5a327[_0x1ea8('0x14')][_0x1ea8('0x16')]);}logger['error'](_0x1ea8('0x11'),_0x495092,_0x5a327[_0x1ea8('0x14')]['message']);return _0x5be789(_0x5a327['error'][_0x1ea8('0x16')]);}else{logger['info'](_0x1ea8('0x11'),_0x495092,'request\x20sent');_0x5be789(_0x5a327[_0x1ea8('0x17')][_0x1ea8('0x16')]);}})[_0x1ea8('0x18')](function(_0xc24384){logger[_0x1ea8('0x14')](_0x1ea8('0x11'),_0x495092,_0xc24384);_0x5bd5dc(_0xc24384);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3471103..ab3fde2 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 _0x7673=['remove','update','emit','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x261287,_0x11f4af){var _0x2088f1=function(_0x169cc4){while(--_0x169cc4){_0x261287['push'](_0x261287['shift']());}};_0x2088f1(++_0x11f4af);}(_0x7673,0x186));var _0x3767=function(_0x49b73b,_0x49456b){_0x49b73b=_0x49b73b-0x0;var _0x391e11=_0x7673[_0x49b73b];return _0x391e11;};'use strict';var ChatInternalMessageEvents=require(_0x3767('0x0'));var events=[_0x3767('0x1'),_0x3767('0x2'),_0x3767('0x3')];function createListener(_0x566fdd,_0x39f7ea){return function(_0x509148){_0x39f7ea[_0x3767('0x4')](_0x566fdd,_0x509148);};}function removeListener(_0x28afb6,_0x239db6){return function(){ChatInternalMessageEvents['removeListener'](_0x28afb6,_0x239db6);};}exports[_0x3767('0x5')]=function(_0x345854){for(var _0x108aa1=0x0,_0x8aea93=events['length'];_0x108aa1<_0x8aea93;_0x108aa1++){var _0x4d6b2b=events[_0x108aa1];var _0x1b2877=createListener(_0x3767('0x6')+_0x4d6b2b,_0x345854);ChatInternalMessageEvents['on'](_0x4d6b2b,_0x1b2877);}}; \ No newline at end of file +var _0x64a7=['update','emit','removeListener','register','chatInternalMessage:','save','remove'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x64a7,0x18d));var _0x764a=function(_0x403554,_0x23456a){_0x403554=_0x403554-0x0;var _0x2061d0=_0x64a7[_0x403554];return _0x2061d0;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x764a('0x0'),_0x764a('0x1'),_0x764a('0x2')];function createListener(_0x4664aa,_0x4b18d4){return function(_0x58bb49){_0x4b18d4[_0x764a('0x3')](_0x4664aa,_0x58bb49);};}function removeListener(_0x329a73,_0x58da5c){return function(){ChatInternalMessageEvents[_0x764a('0x4')](_0x329a73,_0x58da5c);};}exports[_0x764a('0x5')]=function(_0x457bb2){for(var _0x5ca27b=0x0,_0x1fb0f7=events['length'];_0x5ca27b<_0x1fb0f7;_0x5ca27b++){var _0x459983=events[_0x5ca27b];var _0x128ed9=createListener(_0x764a('0x6')+_0x459983,_0x457bb2);ChatInternalMessageEvents['on'](_0x459983,_0x128ed9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8bc9fdf..a29af05 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 _0xd14b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2c4373,_0x462dc7){var _0x421542=function(_0x14dd6d){while(--_0x14dd6d){_0x2c4373['push'](_0x2c4373['shift']());}};_0x421542(++_0x462dc7);}(_0xd14b,0x1b7));var _0xbd14=function(_0x4e61bc,_0x1cff51){_0x4e61bc=_0x4e61bc-0x0;var _0x4e0fb1=_0xd14b[_0x4e61bc];return _0x4e0fb1;};'use strict';var multer=require(_0xbd14('0x0'));var util=require(_0xbd14('0x1'));var path=require(_0xbd14('0x2'));var timeout=require(_0xbd14('0x3'));var express=require(_0xbd14('0x4'));var router=express[_0xbd14('0x5')]();var fs_extra=require(_0xbd14('0x6'));var auth=require(_0xbd14('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd14('0x8'));var controller=require(_0xbd14('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xbd14('0xa')]);router[_0xbd14('0xb')](_0xbd14('0xc'),auth[_0xbd14('0xd')](),controller[_0xbd14('0xe')]);router[_0xbd14('0xb')](_0xbd14('0xf'),auth[_0xbd14('0xd')](),controller[_0xbd14('0x10')]);router[_0xbd14('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd14('0x11')]);router[_0xbd14('0x12')]('/',auth['isAuthenticated'](),controller[_0xbd14('0x13')]);router[_0xbd14('0x14')](_0xbd14('0x15'),controller[_0xbd14('0x16')]);router[_0xbd14('0x17')](_0xbd14('0x15'),auth[_0xbd14('0xd')](),controller[_0xbd14('0x18')]);module[_0xbd14('0x19')]=router; \ No newline at end of file +var _0x07f0=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','put'];(function(_0x261f8d,_0x328248){var _0xd6e676=function(_0x45d8d7){while(--_0x45d8d7){_0x261f8d['push'](_0x261f8d['shift']());}};_0xd6e676(++_0x328248);}(_0x07f0,0x136));var _0x007f=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x07f0[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0x007f('0x0'));var util=require(_0x007f('0x1'));var path=require(_0x007f('0x2'));var timeout=require(_0x007f('0x3'));var express=require(_0x007f('0x4'));var router=express[_0x007f('0x5')]();var fs_extra=require(_0x007f('0x6'));var auth=require(_0x007f('0x7'));var interaction=require(_0x007f('0x8'));var config=require('../../config/environment');var controller=require(_0x007f('0x9'));router[_0x007f('0xa')]('/',auth[_0x007f('0xb')](),controller[_0x007f('0xc')]);router['get'](_0x007f('0xd'),auth[_0x007f('0xb')](),controller[_0x007f('0xe')]);router[_0x007f('0xa')](_0x007f('0xf'),auth[_0x007f('0xb')](),controller[_0x007f('0x10')]);router['get'](_0x007f('0x11'),auth[_0x007f('0xb')](),controller['show']);router[_0x007f('0x12')]('/',auth[_0x007f('0xb')](),controller['create']);router[_0x007f('0x13')](_0x007f('0x11'),controller['update']);router[_0x007f('0x14')](_0x007f('0x11'),auth[_0x007f('0xb')](),controller[_0x007f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 96ffd46..5e5d1ee 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 _0x0b0e=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x0b0e[_0x47878f];return _0x4b05b8;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0b0('0x3')]('in',_0xe0b0('0x4')),'defaultValue':_0xe0b0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe0b0('0x5')]},'providerName':{'type':Sequelize[_0xe0b0('0x6')]},'providerResponse':{'type':Sequelize[_0xe0b0('0x1')]}}; \ No newline at end of file +var _0xe820=['sequelize','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xe820,0xd2));var _0x0e82=function(_0x55ceca,_0x3b899c){_0x55ceca=_0x55ceca-0x0;var _0x31fef3=_0xe820[_0x55ceca];return _0x31fef3;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'body':{'type':Sequelize[_0x0e82('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e82('0x3')]('in',_0x0e82('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0e82('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0e82('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6c8c51f..7724e6a 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 _0xb160=['show','params','length','find','create','body','describe','../../config/logger','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','acceptmessage','parse','formData','reject','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','email','EventManager','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','stack','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','name','options','ChatMessage','includeAll','include','findAll','rows'];(function(_0x5e2a2b,_0x25abe0){var _0x326d1c=function(_0xf77a58){while(--_0xf77a58){_0x5e2a2b['push'](_0x5e2a2b['shift']());}};_0x326d1c(++_0x25abe0);}(_0xb160,0xb3));var _0x0b16=function(_0x43ed8e,_0x4bdd98){_0x43ed8e=_0x43ed8e-0x0;var _0x291e45=_0xb160[_0x43ed8e];return _0x291e45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b16('0x0'));var zipdir=require(_0x0b16('0x1'));var jsonpatch=require(_0x0b16('0x2'));var rp=require(_0x0b16('0x3'));var moment=require(_0x0b16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b16('0x5'));var util=require('util');var path=require(_0x0b16('0x6'));var sox=require(_0x0b16('0x7'));var csv=require(_0x0b16('0x8'));var ejs=require(_0x0b16('0x9'));var fs=require('fs');var fs_extra=require(_0x0b16('0xa'));var _=require(_0x0b16('0xb'));var squel=require(_0x0b16('0xc'));var crypto=require(_0x0b16('0xd'));var jsforce=require(_0x0b16('0xe'));var deskjs=require(_0x0b16('0xf'));var toCsv=require(_0x0b16('0x8'));var querystring=require(_0x0b16('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b16('0x11'));var qs=require(_0x0b16('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b16('0x13'));var logger=require('../../config/logger')(_0x0b16('0x14'));var utils=require(_0x0b16('0x15'));var config=require(_0x0b16('0x16'));var licenseUtil=require(_0x0b16('0x17'));var db=require('../../mysqldb')['db'];config[_0x0b16('0x18')]=_['defaults'](config[_0x0b16('0x18')],{'host':_0x0b16('0x19'),'port':0x18eb});var socket=require(_0x0b16('0x1a'))(new Redis(config[_0x0b16('0x18')]));require('./chatMessage.socket')[_0x0b16('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b16('0x1c')][_0x0b16('0x1d')]({'port':0x232c});var client9002=jayson[_0x0b16('0x1c')][_0x0b16('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x216016,_0x2aa868,_0x59d2b7,_0x5f4819){return new BPromise(function(_0x2b2615,_0x226790){var _0x2d2364=_0x5f4819||client;return _0x2d2364[_0x0b16('0x1e')](_0x216016,_0x59d2b7)[_0x0b16('0x1f')](function(_0xe490fc){logger[_0x0b16('0x20')](_0x0b16('0x21'),_0x2aa868,_0x0b16('0x22'));logger[_0x0b16('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2aa868,_0x0b16('0x22'),JSON[_0x0b16('0x24')](_0xe490fc));if(_0xe490fc[_0x0b16('0x25')]){if(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x26')]===0x1f4){logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);return _0x226790(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);}logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);return _0x2b2615(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);}else{logger['info'](_0x0b16('0x21'),_0x2aa868,'request\x20sent');_0x2b2615(_0xe490fc[_0x0b16('0x28')][_0x0b16('0x27')]);}})[_0x0b16('0x29')](function(_0x64b632){logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0x64b632);_0x226790(_0x64b632);});});}function respondWithStatusCode(_0x4695a9,_0x568ae1){_0x568ae1=_0x568ae1||0xcc;return function(_0x49ef3f){if(_0x49ef3f){return _0x4695a9[_0x0b16('0x2a')](_0x568ae1);}return _0x4695a9[_0x0b16('0x2b')](_0x568ae1)['end']();};}function respondWithResult(_0x2c1605,_0x59675a){_0x59675a=_0x59675a||0xc8;return function(_0x225915){if(_0x225915){return _0x2c1605[_0x0b16('0x2b')](_0x59675a)[_0x0b16('0x2c')](_0x225915);}};}function respondWithFilteredResult(_0x295e58,_0xda58fe){return function(_0x3935ee){if(_0x3935ee){var _0x1ebb29=typeof _0xda58fe[_0x0b16('0x2d')]==='undefined'&&typeof _0xda58fe[_0x0b16('0x2e')]===_0x0b16('0x2f');var _0x3cd501=_0x3935ee[_0x0b16('0x30')];var _0x107a6d=_0x1ebb29?0x0:_0xda58fe[_0x0b16('0x2d')];var _0x5a4b7c=_0x1ebb29?_0x3935ee[_0x0b16('0x30')]:_0xda58fe[_0x0b16('0x2d')]+_0xda58fe[_0x0b16('0x2e')];var _0x51f68e;if(_0x5a4b7c>=_0x3cd501){_0x5a4b7c=_0x3cd501;_0x51f68e=0xc8;}else{_0x51f68e=0xce;}_0x295e58[_0x0b16('0x2b')](_0x51f68e);return _0x295e58[_0x0b16('0x31')](_0x0b16('0x32'),_0x107a6d+'-'+_0x5a4b7c+'/'+_0x3cd501)[_0x0b16('0x2c')](_0x3935ee);}return null;};}function patchUpdates(_0x2766f9){return function(_0x2d58ff){try{jsonpatch[_0x0b16('0x33')](_0x2d58ff,_0x2766f9,!![]);}catch(_0x215f0a){return BPromise['reject'](_0x215f0a);}return _0x2d58ff['save']();};}function saveUpdates(_0x46d00b,_0x3b0085){return function(_0x165780){if(_0x165780){return _0x165780[_0x0b16('0x34')](_0x46d00b)[_0x0b16('0x1f')](function(_0x152be5){return _0x152be5;});}return null;};}function removeEntity(_0x132492,_0x5049c5){return function(_0x31c963){if(_0x31c963){return _0x31c963[_0x0b16('0x35')]()['then'](function(){_0x132492[_0x0b16('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1100e8,_0x3cbde1){return function(_0x18a054){if(!_0x18a054){_0x1100e8[_0x0b16('0x2a')](0x194);}return _0x18a054;};}function handleError(_0x2a4c4d,_0x1027c1){_0x1027c1=_0x1027c1||0x1f4;return function(_0x584512){logger[_0x0b16('0x25')](_0x584512[_0x0b16('0x36')]);if(_0x584512['name']){delete _0x584512['name'];}_0x2a4c4d['status'](_0x1027c1)['send'](_0x584512);};}exports[_0x0b16('0x37')]=function(_0xe82d54,_0x483410){var _0x103b08={},_0x52abb3={},_0x5edb0f={'count':0x0,'rows':[]};var _0x321fca=_[_0x0b16('0x38')](db['ChatMessage'][_0x0b16('0x39')],function(_0x5020e3){return{'name':_0x5020e3[_0x0b16('0x3a')],'type':_0x5020e3['type'][_0x0b16('0x3b')]};});_0x52abb3['model']=_[_0x0b16('0x38')](_0x321fca,'name');_0x52abb3[_0x0b16('0x3c')]=_[_0x0b16('0x3d')](_0xe82d54['query']);_0x52abb3['filters']=_[_0x0b16('0x3e')](_0x52abb3[_0x0b16('0x3f')],_0x52abb3['query']);_0x103b08['attributes']=_['intersection'](_0x52abb3['model'],qs[_0x0b16('0x40')](_0xe82d54[_0x0b16('0x3c')]['fields']));_0x103b08[_0x0b16('0x41')]=_0x103b08['attributes']['length']?_0x103b08[_0x0b16('0x41')]:_0x52abb3[_0x0b16('0x3f')];if(!_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x42')](_0x0b16('0x43'))){_0x103b08['limit']=qs[_0x0b16('0x2e')](_0xe82d54['query'][_0x0b16('0x2e')]);_0x103b08[_0x0b16('0x2d')]=qs['offset'](_0xe82d54['query'][_0x0b16('0x2d')]);}_0x103b08[_0x0b16('0x44')]=qs['sort'](_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x45')]);_0x103b08[_0x0b16('0x46')]=qs[_0x0b16('0x47')](_[_0x0b16('0x48')](_0xe82d54['query'],_0x52abb3[_0x0b16('0x47')]),_0x321fca);if(_0xe82d54[_0x0b16('0x3c')]['filter']){_0x103b08[_0x0b16('0x46')]=_[_0x0b16('0x49')](_0x103b08[_0x0b16('0x46')],{'$or':_[_0x0b16('0x38')](_0x321fca,function(_0x5923d7){if(_0x5923d7['type']!=='VIRTUAL'){var _0xeca4ad={};_0xeca4ad[_0x5923d7[_0x0b16('0x4a')]]={'$like':'%'+_0xe82d54['query']['filter']+'%'};return _0xeca4ad;}})});}_0x103b08=_[_0x0b16('0x49')]({},_0x103b08,_0xe82d54[_0x0b16('0x4b')]);var _0x53a0ae={'where':_0x103b08[_0x0b16('0x46')]};return db[_0x0b16('0x4c')][_0x0b16('0x30')](_0x53a0ae)[_0x0b16('0x1f')](function(_0x5949b6){_0x5edb0f['count']=_0x5949b6;if(_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x4d')]){_0x103b08[_0x0b16('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0x0b16('0x4f')](_0x103b08);})['then'](function(_0x2747d0){_0x5edb0f[_0x0b16('0x50')]=_0x2747d0;return _0x5edb0f;})['then'](respondWithFilteredResult(_0x483410,_0x103b08))[_0x0b16('0x29')](handleError(_0x483410,null));};exports[_0x0b16('0x51')]=function(_0x28a4f6,_0x5946da){var _0x43adaf={'raw':!![],'where':{'id':_0x28a4f6[_0x0b16('0x52')]['id']}},_0x285177={};_0x285177[_0x0b16('0x3f')]=_['keys'](db[_0x0b16('0x4c')][_0x0b16('0x39')]);_0x285177['query']=_['keys'](_0x28a4f6[_0x0b16('0x3c')]);_0x285177[_0x0b16('0x47')]=_[_0x0b16('0x3e')](_0x285177[_0x0b16('0x3f')],_0x285177['query']);_0x43adaf['attributes']=_['intersection'](_0x285177['model'],qs['fields'](_0x28a4f6[_0x0b16('0x3c')][_0x0b16('0x40')]));_0x43adaf[_0x0b16('0x41')]=_0x43adaf[_0x0b16('0x41')][_0x0b16('0x53')]?_0x43adaf[_0x0b16('0x41')]:_0x285177[_0x0b16('0x3f')];if(_0x28a4f6[_0x0b16('0x3c')]['includeAll']){_0x43adaf[_0x0b16('0x4e')]=[{'all':!![]}];}_0x43adaf=_[_0x0b16('0x49')]({},_0x43adaf,_0x28a4f6[_0x0b16('0x4b')]);return db[_0x0b16('0x4c')][_0x0b16('0x54')](_0x43adaf)[_0x0b16('0x1f')](handleEntityNotFound(_0x5946da,null))[_0x0b16('0x1f')](respondWithResult(_0x5946da,null))[_0x0b16('0x29')](handleError(_0x5946da,null));};exports[_0x0b16('0x55')]=function(_0x2364f0,_0x5723c2){return db[_0x0b16('0x4c')][_0x0b16('0x55')](_0x2364f0[_0x0b16('0x56')],{})[_0x0b16('0x1f')](respondWithResult(_0x5723c2,0xc9))[_0x0b16('0x29')](handleError(_0x5723c2,null));};exports[_0x0b16('0x34')]=function(_0x4c8953,_0x380b1d){if(_0x4c8953[_0x0b16('0x56')]['id']){delete _0x4c8953[_0x0b16('0x56')]['id'];}return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x4c8953[_0x0b16('0x52')]['id']}})['then'](handleEntityNotFound(_0x380b1d,null))[_0x0b16('0x1f')](saveUpdates(_0x4c8953[_0x0b16('0x56')],null))[_0x0b16('0x1f')](respondWithResult(_0x380b1d,null))[_0x0b16('0x29')](handleError(_0x380b1d,null));};exports[_0x0b16('0x35')]=function(_0xf49a2d,_0x1ca47e){return db['ChatMessage']['find']({'where':{'id':_0xf49a2d[_0x0b16('0x52')]['id']}})[_0x0b16('0x1f')](handleEntityNotFound(_0x1ca47e,null))[_0x0b16('0x1f')](removeEntity(_0x1ca47e,null))[_0x0b16('0x29')](handleError(_0x1ca47e,null));};exports[_0x0b16('0x57')]=function(_0xd83cb8,_0x47ca41){return db['ChatMessage'][_0x0b16('0x57')]()[_0x0b16('0x1f')](respondWithResult(_0x47ca41,null))[_0x0b16('0x29')](handleError(_0x47ca41,null));};var interaction_log=require(_0x0b16('0x58'))('chat-interactions');exports[_0x0b16('0x59')]=function(_0x1d9c49,_0x2c0434,_0xea335b){var _0x41b4a3={'agent':{},'channel':_0x0b16('0x5a')};if(_0x1d9c49[_0x0b16('0x56')]['id']){delete _0x1d9c49[_0x0b16('0x56')]['id'];}_0x1d9c49[_0x0b16('0x56')]['read']=!![];_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5b')]=moment()[_0x0b16('0x5c')](_0x0b16('0x5d'));_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5e')]=_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5e')]||_0x1d9c49[_0x0b16('0x5f')]['id'];_0x41b4a3[_0x0b16('0x60')]['id']=_0x1d9c49[_0x0b16('0x56')]['UserId'];return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x1d9c49[_0x0b16('0x52')]['id'],'UserId':null}})[_0x0b16('0x1f')](handleEntityNotFound(_0x2c0434,null))[_0x0b16('0x1f')](saveUpdates(_0x1d9c49[_0x0b16('0x56')],null))[_0x0b16('0x1f')](function(_0x5edb9c){if(_0x5edb9c){_0x41b4a3[_0x0b16('0x27')]=_0x5edb9c['get']({'plain':!![]});return db['ChatInteraction'][_0x0b16('0x54')]({'where':{'id':_0x5edb9c['ChatInteractionId']}});}return null;})[_0x0b16('0x1f')](handleEntityNotFound(_0x2c0434,null))['then'](function(_0x42777f){if(_0x42777f){return _0x42777f[_0x0b16('0x34')]({'UserId':_0x1d9c49['body'][_0x0b16('0x5e')],'read1stAt':_[_0x0b16('0x61')](_0x42777f[_0x0b16('0x62')])?moment()[_0x0b16('0x5c')](_0x0b16('0x5d')):undefined});}return null;})[_0x0b16('0x1f')](function(_0x341f3c){if(_0x341f3c){_0x41b4a3['interaction']=_0x341f3c[_0x0b16('0x63')]({'plain':!![]});interaction_log[_0x0b16('0x20')](_0x0b16('0x64'),_0x1d9c49['user']['id'],_0x1d9c49[_0x0b16('0x5f')]['name'],_0x1d9c49['user'][_0x0b16('0x65')],_0x41b4a3[_0x0b16('0x66')]['id'],_0x1d9c49[_0x0b16('0x56')]?JSON[_0x0b16('0x24')](_0x1d9c49[_0x0b16('0x56')]):_0x0b16('0x67'));return respondWithRpcPromise(_0x0b16('0x68'),_0x0b16('0x69'),_0x41b4a3);}return null;})[_0x0b16('0x1f')](function(_0x4db345){var _0x227536=_0x0b16('0x6a')+_0x4db345[_0x0b16('0x27')][_0x0b16('0x6b')];return db[_0x0b16('0x6c')]['query'](_0x227536,{'type':db[_0x0b16('0x6d')][_0x0b16('0x6e')][_0x0b16('0x6f')],'raw':!![]})[_0x0b16('0x1f')](function(_0x535d4f){return _0x535d4f;});})[_0x0b16('0x1f')](function(_0x40493e){if(_0x40493e){_0x41b4a3[_0x0b16('0x27')]['contact']=_0x40493e[0x0];if(!_0x1d9c49['body'][_0x0b16('0x5e')])return;return db[_0x0b16('0x70')][_0x0b16('0x54')]({'where':{'id':_0x1d9c49[_0x0b16('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x0b16('0x4a'),_0x0b16('0x71'),'email',_0x0b16('0x72')],'raw':!![]});}return null;})[_0x0b16('0x1f')](function(_0x16a071){if(!_0x16a071)return null;_0x41b4a3['message'][_0x0b16('0x60')]=_0x16a071;return _0x41b4a3;})[_0x0b16('0x1f')](function(_0x9a063d){if(_0x9a063d){if(_0x1d9c49[_0x0b16('0x56')]['manual']){_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x73')]=util[_0x0b16('0x5c')](_0x0b16('0x74'),_0x1d9c49[_0x0b16('0x5f')][_0x0b16('0x4a')]);_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x75')]=_0x41b4a3['channel'];_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x76')]=_0x41b4a3['channel'];_0x41b4a3['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0b16('0x77'),'message':_[_0x0b16('0x49')](_0x41b4a3[_0x0b16('0x27')],JSON[_0x0b16('0x78')](_0x41b4a3[_0x0b16('0x66')][_0x0b16('0x79')]))},client9002)['then'](function(){return _0x41b4a3;});}return _0x41b4a3;}return null;})['then'](respondWithResult(_0x2c0434,null))[_0x0b16('0x29')](handleError(_0x2c0434,null));};var interaction_log=require(_0x0b16('0x58'))('chat-interactions');exports[_0x0b16('0x7a')]=function(_0x1ddd65,_0xdff954,_0x38f4ce){var _0x4c2677={'agent':{},'channel':_0x0b16('0x5a')};if(_0x1ddd65[_0x0b16('0x56')]['id']){delete _0x1ddd65[_0x0b16('0x56')]['id'];}_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')]=_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')]||_0x1ddd65['user']['id'];_0x4c2677[_0x0b16('0x60')]['id']=_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')];return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x1ddd65[_0x0b16('0x52')]['id'],'UserId':null}})[_0x0b16('0x1f')](handleEntityNotFound(_0xdff954,null))[_0x0b16('0x1f')](function(_0x36b1b4){if(_0x36b1b4){_0x4c2677[_0x0b16('0x27')]=_0x36b1b4[_0x0b16('0x63')]({'plain':!![]});return db[_0x0b16('0x7b')]['find']({'where':{'id':_0x36b1b4[_0x0b16('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0xdff954,null))['then'](function(_0x1bdb70){if(_0x1bdb70){_0x4c2677[_0x0b16('0x66')]=_0x1bdb70[_0x0b16('0x63')]({'plain':!![]});interaction_log['info'](_0x0b16('0x7d'),_0x1ddd65[_0x0b16('0x5f')]['id'],_0x1ddd65[_0x0b16('0x5f')]['name'],_0x1ddd65[_0x0b16('0x5f')][_0x0b16('0x65')],_0x4c2677[_0x0b16('0x66')]['id'],_0x1ddd65[_0x0b16('0x56')]?JSON['stringify'](_0x1ddd65[_0x0b16('0x56')]):_0x0b16('0x67'));return respondWithRpcPromise(_0x0b16('0x7e'),'rejectMessage',_0x4c2677);}return null;})[_0x0b16('0x1f')](function(_0x24e8fe){var _0x26ea88=_0x0b16('0x6a')+_0x24e8fe['message']['ContactId'];return db[_0x0b16('0x6c')][_0x0b16('0x3c')](_0x26ea88,{'type':db[_0x0b16('0x6d')]['QueryTypes'][_0x0b16('0x6f')],'raw':!![]})[_0x0b16('0x1f')](function(_0x407db4){return _0x407db4;});})[_0x0b16('0x1f')](function(_0x2fcad4){if(_0x2fcad4){_0x4c2677[_0x0b16('0x27')][_0x0b16('0x7f')]=_0x2fcad4[0x0];if(!_0x1ddd65[_0x0b16('0x56')]['UserId'])return;return db['User'][_0x0b16('0x54')]({'where':{'id':_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')],'role':'agent'},'attributes':['id',_0x0b16('0x4a'),'fullname',_0x0b16('0x80'),'internal'],'raw':!![]});}return null;})[_0x0b16('0x1f')](function(_0x1182e5){if(!_0x1182e5)return null;_0x4c2677['message']['agent']=_0x1182e5;return _0x4c2677;})[_0x0b16('0x1f')](function(_0x17548f){if(_0x17548f){_0x17548f[_0x0b16('0x27')][_0x0b16('0x73')]=util[_0x0b16('0x5c')](_0x0b16('0x74'),_0x1ddd65['user'][_0x0b16('0x4a')]);_0x17548f[_0x0b16('0x27')][_0x0b16('0x75')]=_0x4c2677[_0x0b16('0x75')];_0x17548f['message'][_0x0b16('0x76')]=_0x4c2677['channel'];_0x17548f[_0x0b16('0x27')]['event']=_0x0b16('0x7a');respondWithRpcPromise(_0x0b16('0x81'),_0x0b16('0x81'),{'event':'rejectmessage','message':_[_0x0b16('0x49')](_0x4c2677['message'],JSON[_0x0b16('0x78')](_0x4c2677[_0x0b16('0x66')][_0x0b16('0x79')]))},client9002);return _0x4c2677;}return null;})[_0x0b16('0x1f')](respondWithResult(_0xdff954,null))[_0x0b16('0x29')](handleError(_0xdff954,null));}; \ No newline at end of file +var _0x0055=['apply','reject','save','destroy','send','index','map','ChatMessage','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','length','options','find','create','body','update','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','formData','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','json'];(function(_0xe8e2ad,_0x4df5f5){var _0x15f391=function(_0x2eb6fd){while(--_0x2eb6fd){_0xe8e2ad['push'](_0xe8e2ad['shift']());}};_0x15f391(++_0x4df5f5);}(_0x0055,0x160));var _0x5005=function(_0x5eb3c1,_0x2d0bab){_0x5eb3c1=_0x5eb3c1-0x0;var _0xfafed=_0x0055[_0x5eb3c1];return _0xfafed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5005('0x0'));var jsonpatch=require(_0x5005('0x1'));var rp=require(_0x5005('0x2'));var moment=require(_0x5005('0x3'));var BPromise=require(_0x5005('0x4'));var Mustache=require(_0x5005('0x5'));var util=require(_0x5005('0x6'));var path=require(_0x5005('0x7'));var sox=require(_0x5005('0x8'));var csv=require('to-csv');var ejs=require(_0x5005('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5005('0xa'));var squel=require('squel');var crypto=require(_0x5005('0xb'));var jsforce=require(_0x5005('0xc'));var deskjs=require(_0x5005('0xd'));var toCsv=require(_0x5005('0xe'));var querystring=require(_0x5005('0xf'));var Papa=require(_0x5005('0x10'));var Redis=require(_0x5005('0x11'));var authService=require(_0x5005('0x12'));var qs=require(_0x5005('0x13'));var as=require(_0x5005('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5005('0x15'))(_0x5005('0x16'));var utils=require(_0x5005('0x17'));var config=require(_0x5005('0x18'));var licenseUtil=require(_0x5005('0x19'));var db=require(_0x5005('0x1a'))['db'];config['redis']=_[_0x5005('0x1b')](config[_0x5005('0x1c')],{'host':_0x5005('0x1d'),'port':0x18eb});var socket=require(_0x5005('0x1e'))(new Redis(config[_0x5005('0x1c')]));require('./chatMessage.socket')[_0x5005('0x1f')](socket);var jayson=require(_0x5005('0x20'));var client=jayson[_0x5005('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x5005('0x21')][_0x5005('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x525dd2,_0x62a768,_0x42c1ab,_0x16ca56){return new BPromise(function(_0x30643e,_0x72e846){var _0x38e382=_0x16ca56||client;return _0x38e382[_0x5005('0x23')](_0x525dd2,_0x42c1ab)[_0x5005('0x24')](function(_0x5857bb){logger[_0x5005('0x25')](_0x5005('0x26'),_0x62a768,_0x5005('0x27'));logger[_0x5005('0x28')](_0x5005('0x29'),_0x62a768,_0x5005('0x27'),JSON['stringify'](_0x5857bb));if(_0x5857bb[_0x5005('0x2a')]){if(_0x5857bb[_0x5005('0x2a')][_0x5005('0x2b')]===0x1f4){logger[_0x5005('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x62a768,_0x5857bb['error'][_0x5005('0x2c')]);return _0x72e846(_0x5857bb['error'][_0x5005('0x2c')]);}logger[_0x5005('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x62a768,_0x5857bb['error'][_0x5005('0x2c')]);return _0x30643e(_0x5857bb['error'][_0x5005('0x2c')]);}else{logger[_0x5005('0x25')](_0x5005('0x26'),_0x62a768,_0x5005('0x27'));_0x30643e(_0x5857bb[_0x5005('0x2d')][_0x5005('0x2c')]);}})[_0x5005('0x2e')](function(_0xca3fd0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x62a768,_0xca3fd0);_0x72e846(_0xca3fd0);});});}function respondWithStatusCode(_0x42bbca,_0x67e10f){_0x67e10f=_0x67e10f||0xcc;return function(_0x2f6f79){if(_0x2f6f79){return _0x42bbca[_0x5005('0x2f')](_0x67e10f);}return _0x42bbca[_0x5005('0x30')](_0x67e10f)[_0x5005('0x31')]();};}function respondWithResult(_0x2815c9,_0x594067){_0x594067=_0x594067||0xc8;return function(_0x430a5c){if(_0x430a5c){return _0x2815c9['status'](_0x594067)['json'](_0x430a5c);}};}function respondWithFilteredResult(_0x1588c6,_0x28645f){return function(_0x3a39ed){if(_0x3a39ed){var _0x12aff7=typeof _0x28645f[_0x5005('0x32')]===_0x5005('0x33')&&typeof _0x28645f['limit']===_0x5005('0x33');var _0x251e91=_0x3a39ed[_0x5005('0x34')];var _0x121349=_0x12aff7?0x0:_0x28645f['offset'];var _0x3196c9=_0x12aff7?_0x3a39ed['count']:_0x28645f[_0x5005('0x32')]+_0x28645f[_0x5005('0x35')];var _0x172d1c;if(_0x3196c9>=_0x251e91){_0x3196c9=_0x251e91;_0x172d1c=0xc8;}else{_0x172d1c=0xce;}_0x1588c6[_0x5005('0x30')](_0x172d1c);return _0x1588c6[_0x5005('0x36')]('Content-Range',_0x121349+'-'+_0x3196c9+'/'+_0x251e91)[_0x5005('0x37')](_0x3a39ed);}return null;};}function patchUpdates(_0x1e96fd){return function(_0xdf3542){try{jsonpatch[_0x5005('0x38')](_0xdf3542,_0x1e96fd,!![]);}catch(_0x13ec3b){return BPromise[_0x5005('0x39')](_0x13ec3b);}return _0xdf3542[_0x5005('0x3a')]();};}function saveUpdates(_0x54e924,_0x3a6ba9){return function(_0x2f6f28){if(_0x2f6f28){return _0x2f6f28['update'](_0x54e924)[_0x5005('0x24')](function(_0x5cba00){return _0x5cba00;});}return null;};}function removeEntity(_0x221dcb,_0x3873ac){return function(_0x11abc8){if(_0x11abc8){return _0x11abc8[_0x5005('0x3b')]()[_0x5005('0x24')](function(){_0x221dcb[_0x5005('0x30')](0xcc)[_0x5005('0x31')]();});}};}function handleEntityNotFound(_0x4c2f81,_0x3f2ba2){return function(_0x375d28){if(!_0x375d28){_0x4c2f81[_0x5005('0x2f')](0x194);}return _0x375d28;};}function handleError(_0x2f84fc,_0x34d7a5){_0x34d7a5=_0x34d7a5||0x1f4;return function(_0x102e4b){logger['error'](_0x102e4b['stack']);if(_0x102e4b['name']){delete _0x102e4b['name'];}_0x2f84fc['status'](_0x34d7a5)[_0x5005('0x3c')](_0x102e4b);};}exports[_0x5005('0x3d')]=function(_0x1c12a0,_0x33328c){var _0x154214={},_0x3adf68={},_0x2deff7={'count':0x0,'rows':[]};var _0x280e6e=_[_0x5005('0x3e')](db[_0x5005('0x3f')]['rawAttributes'],function(_0x1fccc2){return{'name':_0x1fccc2['fieldName'],'type':_0x1fccc2[_0x5005('0x40')][_0x5005('0x41')]};});_0x3adf68[_0x5005('0x42')]=_[_0x5005('0x3e')](_0x280e6e,_0x5005('0x43'));_0x3adf68[_0x5005('0x44')]=_[_0x5005('0x45')](_0x1c12a0[_0x5005('0x44')]);_0x3adf68['filters']=_[_0x5005('0x46')](_0x3adf68[_0x5005('0x42')],_0x3adf68['query']);_0x154214[_0x5005('0x47')]=_['intersection'](_0x3adf68['model'],qs[_0x5005('0x48')](_0x1c12a0[_0x5005('0x44')]['fields']));_0x154214[_0x5005('0x47')]=_0x154214[_0x5005('0x47')]['length']?_0x154214[_0x5005('0x47')]:_0x3adf68['model'];if(!_0x1c12a0['query'][_0x5005('0x49')](_0x5005('0x4a'))){_0x154214[_0x5005('0x35')]=qs['limit'](_0x1c12a0[_0x5005('0x44')][_0x5005('0x35')]);_0x154214['offset']=qs['offset'](_0x1c12a0['query'][_0x5005('0x32')]);}_0x154214[_0x5005('0x4b')]=qs['sort'](_0x1c12a0[_0x5005('0x44')][_0x5005('0x4c')]);_0x154214['where']=qs[_0x5005('0x4d')](_[_0x5005('0x4e')](_0x1c12a0[_0x5005('0x44')],_0x3adf68[_0x5005('0x4d')]),_0x280e6e);if(_0x1c12a0[_0x5005('0x44')][_0x5005('0x4f')]){_0x154214[_0x5005('0x50')]=_[_0x5005('0x51')](_0x154214[_0x5005('0x50')],{'$or':_[_0x5005('0x3e')](_0x280e6e,function(_0x367e9c){if(_0x367e9c[_0x5005('0x40')]!==_0x5005('0x52')){var _0x4e199f={};_0x4e199f[_0x367e9c[_0x5005('0x43')]]={'$like':'%'+_0x1c12a0[_0x5005('0x44')]['filter']+'%'};return _0x4e199f;}})});}_0x154214=_[_0x5005('0x51')]({},_0x154214,_0x1c12a0['options']);var _0x51baca={'where':_0x154214[_0x5005('0x50')]};return db['ChatMessage'][_0x5005('0x34')](_0x51baca)[_0x5005('0x24')](function(_0x562fe7){_0x2deff7[_0x5005('0x34')]=_0x562fe7;if(_0x1c12a0[_0x5005('0x44')][_0x5005('0x53')]){_0x154214[_0x5005('0x54')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x154214);})['then'](function(_0x433a95){_0x2deff7[_0x5005('0x55')]=_0x433a95;return _0x2deff7;})[_0x5005('0x24')](respondWithFilteredResult(_0x33328c,_0x154214))[_0x5005('0x2e')](handleError(_0x33328c,null));};exports[_0x5005('0x56')]=function(_0x1c4c37,_0x1ecca0){var _0x13f265={'raw':!![],'where':{'id':_0x1c4c37[_0x5005('0x57')]['id']}},_0x502780={};_0x502780[_0x5005('0x42')]=_[_0x5005('0x45')](db['ChatMessage']['rawAttributes']);_0x502780[_0x5005('0x44')]=_[_0x5005('0x45')](_0x1c4c37[_0x5005('0x44')]);_0x502780[_0x5005('0x4d')]=_[_0x5005('0x46')](_0x502780[_0x5005('0x42')],_0x502780[_0x5005('0x44')]);_0x13f265['attributes']=_[_0x5005('0x46')](_0x502780[_0x5005('0x42')],qs[_0x5005('0x48')](_0x1c4c37[_0x5005('0x44')][_0x5005('0x48')]));_0x13f265['attributes']=_0x13f265['attributes'][_0x5005('0x58')]?_0x13f265['attributes']:_0x502780[_0x5005('0x42')];if(_0x1c4c37[_0x5005('0x44')][_0x5005('0x53')]){_0x13f265[_0x5005('0x54')]=[{'all':!![]}];}_0x13f265=_[_0x5005('0x51')]({},_0x13f265,_0x1c4c37[_0x5005('0x59')]);return db[_0x5005('0x3f')][_0x5005('0x5a')](_0x13f265)['then'](handleEntityNotFound(_0x1ecca0,null))[_0x5005('0x24')](respondWithResult(_0x1ecca0,null))[_0x5005('0x2e')](handleError(_0x1ecca0,null));};exports[_0x5005('0x5b')]=function(_0x15a4ac,_0x4feed6){return db[_0x5005('0x3f')][_0x5005('0x5b')](_0x15a4ac[_0x5005('0x5c')],{})['then'](respondWithResult(_0x4feed6,0xc9))[_0x5005('0x2e')](handleError(_0x4feed6,null));};exports[_0x5005('0x5d')]=function(_0x7d3187,_0x399064){if(_0x7d3187[_0x5005('0x5c')]['id']){delete _0x7d3187[_0x5005('0x5c')]['id'];}return db[_0x5005('0x3f')][_0x5005('0x5a')]({'where':{'id':_0x7d3187[_0x5005('0x57')]['id']}})['then'](handleEntityNotFound(_0x399064,null))[_0x5005('0x24')](saveUpdates(_0x7d3187[_0x5005('0x5c')],null))['then'](respondWithResult(_0x399064,null))[_0x5005('0x2e')](handleError(_0x399064,null));};exports[_0x5005('0x3b')]=function(_0x364839,_0x4bf112){return db[_0x5005('0x3f')][_0x5005('0x5a')]({'where':{'id':_0x364839[_0x5005('0x57')]['id']}})[_0x5005('0x24')](handleEntityNotFound(_0x4bf112,null))[_0x5005('0x24')](removeEntity(_0x4bf112,null))[_0x5005('0x2e')](handleError(_0x4bf112,null));};exports[_0x5005('0x5e')]=function(_0x2968e4,_0x4a9d55){return db[_0x5005('0x3f')]['describe']()[_0x5005('0x24')](respondWithResult(_0x4a9d55,null))[_0x5005('0x2e')](handleError(_0x4a9d55,null));};var interaction_log=require('../../config/logger')(_0x5005('0x5f'));exports[_0x5005('0x60')]=function(_0xa672b4,_0x19a2fc,_0x557858){var _0x14c54a={'agent':{},'channel':_0x5005('0x61')};if(_0xa672b4[_0x5005('0x5c')]['id']){delete _0xa672b4['body']['id'];}_0xa672b4[_0x5005('0x5c')][_0x5005('0x62')]=!![];_0xa672b4[_0x5005('0x5c')][_0x5005('0x63')]=moment()[_0x5005('0x64')](_0x5005('0x65'));_0xa672b4['body'][_0x5005('0x66')]=_0xa672b4[_0x5005('0x5c')][_0x5005('0x66')]||_0xa672b4[_0x5005('0x67')]['id'];_0x14c54a[_0x5005('0x68')]['id']=_0xa672b4[_0x5005('0x5c')]['UserId'];return db[_0x5005('0x3f')][_0x5005('0x5a')]({'where':{'id':_0xa672b4[_0x5005('0x57')]['id'],'UserId':null}})[_0x5005('0x24')](handleEntityNotFound(_0x19a2fc,null))['then'](saveUpdates(_0xa672b4[_0x5005('0x5c')],null))[_0x5005('0x24')](function(_0x2ebed4){if(_0x2ebed4){_0x14c54a['message']=_0x2ebed4[_0x5005('0x69')]({'plain':!![]});return db[_0x5005('0x6a')][_0x5005('0x5a')]({'where':{'id':_0x2ebed4['ChatInteractionId']}});}return null;})[_0x5005('0x24')](handleEntityNotFound(_0x19a2fc,null))[_0x5005('0x24')](function(_0x582b3a){if(_0x582b3a){return _0x582b3a[_0x5005('0x5d')]({'UserId':_0xa672b4['body'][_0x5005('0x66')],'read1stAt':_[_0x5005('0x6b')](_0x582b3a[_0x5005('0x6c')])?moment()[_0x5005('0x64')](_0x5005('0x65')):undefined});}return null;})[_0x5005('0x24')](function(_0x4bd4c6){if(_0x4bd4c6){_0x14c54a['interaction']=_0x4bd4c6[_0x5005('0x69')]({'plain':!![]});interaction_log['info'](_0x5005('0x6d'),_0xa672b4[_0x5005('0x67')]['id'],_0xa672b4[_0x5005('0x67')][_0x5005('0x43')],_0xa672b4[_0x5005('0x67')][_0x5005('0x6e')],_0x14c54a[_0x5005('0x6f')]['id'],_0xa672b4[_0x5005('0x5c')]?JSON[_0x5005('0x70')](_0xa672b4[_0x5005('0x5c')]):_0x5005('0x71'));return respondWithRpcPromise(_0x5005('0x72'),'acceptMessage',_0x14c54a);}return null;})[_0x5005('0x24')](function(_0x4298ce){var _0x1ab1aa=_0x5005('0x73')+_0x4298ce['message'][_0x5005('0x74')];return db['sequelize'][_0x5005('0x44')](_0x1ab1aa,{'type':db[_0x5005('0x75')][_0x5005('0x76')][_0x5005('0x77')],'raw':!![]})[_0x5005('0x24')](function(_0x3f0adf){return _0x3f0adf;});})[_0x5005('0x24')](function(_0x5719b7){if(_0x5719b7){_0x14c54a[_0x5005('0x2c')][_0x5005('0x78')]=_0x5719b7[0x0];if(!_0xa672b4[_0x5005('0x5c')]['UserId'])return;return db['User'][_0x5005('0x5a')]({'where':{'id':_0xa672b4[_0x5005('0x5c')][_0x5005('0x66')],'role':_0x5005('0x68')},'attributes':['id',_0x5005('0x43'),_0x5005('0x79'),_0x5005('0x7a'),_0x5005('0x7b')],'raw':!![]});}return null;})[_0x5005('0x24')](function(_0x1318a4){if(!_0x1318a4)return null;_0x14c54a[_0x5005('0x2c')][_0x5005('0x68')]=_0x1318a4;return _0x14c54a;})[_0x5005('0x24')](function(_0xb62182){if(_0xb62182){if(_0xa672b4['body'][_0x5005('0x7c')]){_0x14c54a[_0x5005('0x2c')][_0x5005('0x7d')]=util[_0x5005('0x64')](_0x5005('0x7e'),_0xa672b4[_0x5005('0x67')][_0x5005('0x43')]);_0x14c54a[_0x5005('0x2c')][_0x5005('0x7f')]=_0x14c54a['channel'];_0x14c54a[_0x5005('0x2c')][_0x5005('0x80')]=_0x14c54a['channel'];_0x14c54a['message']['event']=_0x5005('0x60');return respondWithRpcPromise(_0x5005('0x81'),_0x5005('0x81'),{'event':_0x5005('0x82'),'message':_[_0x5005('0x51')](_0x14c54a[_0x5005('0x2c')],JSON[_0x5005('0x83')](_0x14c54a[_0x5005('0x6f')]['formData']))},client9002)[_0x5005('0x24')](function(){return _0x14c54a;});}return _0x14c54a;}return null;})[_0x5005('0x24')](respondWithResult(_0x19a2fc,null))[_0x5005('0x2e')](handleError(_0x19a2fc,null));};var interaction_log=require(_0x5005('0x15'))('chat-interactions');exports[_0x5005('0x39')]=function(_0xd5f6c,_0x53fe4c,_0x46b305){var _0x3ba829={'agent':{},'channel':_0x5005('0x61')};if(_0xd5f6c['body']['id']){delete _0xd5f6c[_0x5005('0x5c')]['id'];}_0xd5f6c['body'][_0x5005('0x66')]=_0xd5f6c[_0x5005('0x5c')]['UserId']||_0xd5f6c[_0x5005('0x67')]['id'];_0x3ba829[_0x5005('0x68')]['id']=_0xd5f6c['body']['UserId'];return db['ChatMessage'][_0x5005('0x5a')]({'where':{'id':_0xd5f6c[_0x5005('0x57')]['id'],'UserId':null}})[_0x5005('0x24')](handleEntityNotFound(_0x53fe4c,null))['then'](function(_0x468014){if(_0x468014){_0x3ba829['message']=_0x468014['get']({'plain':!![]});return db[_0x5005('0x6a')][_0x5005('0x5a')]({'where':{'id':_0x468014['ChatInteractionId']}});}return null;})[_0x5005('0x24')](handleEntityNotFound(_0x53fe4c,null))[_0x5005('0x24')](function(_0x2475fb){if(_0x2475fb){_0x3ba829[_0x5005('0x6f')]=_0x2475fb['get']({'plain':!![]});interaction_log[_0x5005('0x25')](_0x5005('0x84'),_0xd5f6c[_0x5005('0x67')]['id'],_0xd5f6c[_0x5005('0x67')][_0x5005('0x43')],_0xd5f6c['user'][_0x5005('0x6e')],_0x3ba829[_0x5005('0x6f')]['id'],_0xd5f6c[_0x5005('0x5c')]?JSON['stringify'](_0xd5f6c[_0x5005('0x5c')]):_0x5005('0x71'));return respondWithRpcPromise(_0x5005('0x85'),_0x5005('0x86'),_0x3ba829);}return null;})[_0x5005('0x24')](function(_0xde8364){var _0x51e3da='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xde8364['message'][_0x5005('0x74')];return db['sequelize'][_0x5005('0x44')](_0x51e3da,{'type':db[_0x5005('0x75')][_0x5005('0x76')][_0x5005('0x77')],'raw':!![]})[_0x5005('0x24')](function(_0x31c5e0){return _0x31c5e0;});})[_0x5005('0x24')](function(_0x45886f){if(_0x45886f){_0x3ba829[_0x5005('0x2c')][_0x5005('0x78')]=_0x45886f[0x0];if(!_0xd5f6c[_0x5005('0x5c')][_0x5005('0x66')])return;return db['User'][_0x5005('0x5a')]({'where':{'id':_0xd5f6c['body'][_0x5005('0x66')],'role':'agent'},'attributes':['id','name',_0x5005('0x79'),'email',_0x5005('0x7b')],'raw':!![]});}return null;})[_0x5005('0x24')](function(_0x30b35b){if(!_0x30b35b)return null;_0x3ba829[_0x5005('0x2c')][_0x5005('0x68')]=_0x30b35b;return _0x3ba829;})[_0x5005('0x24')](function(_0x4a8a4d){if(_0x4a8a4d){_0x4a8a4d[_0x5005('0x2c')][_0x5005('0x7d')]=util['format'](_0x5005('0x7e'),_0xd5f6c[_0x5005('0x67')][_0x5005('0x43')]);_0x4a8a4d['message'][_0x5005('0x7f')]=_0x3ba829[_0x5005('0x7f')];_0x4a8a4d['message'][_0x5005('0x80')]=_0x3ba829[_0x5005('0x7f')];_0x4a8a4d['message']['event']=_0x5005('0x39');respondWithRpcPromise('EventManager',_0x5005('0x81'),{'event':'rejectmessage','message':_['merge'](_0x3ba829[_0x5005('0x2c')],JSON['parse'](_0x3ba829[_0x5005('0x6f')][_0x5005('0x87')]))},client9002);return _0x3ba829;}return null;})[_0x5005('0x24')](respondWithResult(_0x53fe4c,null))[_0x5005('0x2e')](handleError(_0x53fe4c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 32fb713..61559f9 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 _0x18fc=['hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save','emit'];(function(_0x46723d,_0x3d6bd5){var _0x5e2b3a=function(_0x1a3c33){while(--_0x1a3c33){_0x46723d['push'](_0x46723d['shift']());}};_0x5e2b3a(++_0x3d6bd5);}(_0x18fc,0x144));var _0xc18f=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x18fc[_0x26b80e];return _0x84a8a8;};'use strict';var EventEmitter=require(_0xc18f('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xc18f('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc18f('0x2')](0x0);var events={'afterCreate':_0xc18f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32b8e6){return function(_0x2e1d,_0x2afef9,_0x2e1f4d){ChatMessageEvents[_0xc18f('0x4')](_0x32b8e6+':'+_0x2e1d['id'],_0x2e1d);ChatMessageEvents[_0xc18f('0x4')](_0x32b8e6,_0x2e1d);_0x2e1f4d(null);};}for(var e in events){if(events[_0xc18f('0x5')](e)){var event=events[e];ChatMessage[_0xc18f('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x9efa=['remove','emit','events','../../mysqldb','setMaxListeners','save'];(function(_0x30c6ec,_0x388d9b){var _0x43c1b1=function(_0x29ea88){while(--_0x29ea88){_0x30c6ec['push'](_0x30c6ec['shift']());}};_0x43c1b1(++_0x388d9b);}(_0x9efa,0x1d0));var _0xa9ef=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9efa[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0xa9ef('0x0'));var ChatMessage=require(_0xa9ef('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa9ef('0x2')](0x0);var events={'afterCreate':_0xa9ef('0x3'),'afterUpdate':'update','afterDestroy':_0xa9ef('0x4')};function emitEvent(_0x3fe1cb){return function(_0x76003,_0x5b02b4,_0x22e759){ChatMessageEvents[_0xa9ef('0x5')](_0x3fe1cb+':'+_0x76003['id'],_0x76003);ChatMessageEvents[_0xa9ef('0x5')](_0x3fe1cb,_0x76003);_0x22e759(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 32dd296..f5a0577 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 _0xbc8a=['path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','toLowerCase','out','UserId','ChatInteraction','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x4eed89,_0x108efd){var _0x1d6ded=function(_0x18a0bd){while(--_0x18a0bd){_0x4eed89['push'](_0x4eed89['shift']());}};_0x1d6ded(++_0x108efd);}(_0xbc8a,0x190));var _0xabc8=function(_0x3cff3a,_0x2dcc6b){_0x3cff3a=_0x3cff3a-0x0;var _0x31d709=_0xbc8a[_0x3cff3a];return _0x31d709;};'use strict';var _=require('lodash');var util=require(_0xabc8('0x0'));var logger=require('../../config/logger')(_0xabc8('0x1'));var moment=require(_0xabc8('0x2'));var BPromise=require(_0xabc8('0x3'));var rp=require(_0xabc8('0x4'));var fs=require('fs');var path=require(_0xabc8('0x5'));var rimraf=require(_0xabc8('0x6'));var config=require(_0xabc8('0x7'));var attributes=require(_0xabc8('0x8'));module['exports']=function(_0x4b2afa,_0x3bf739){return _0x4b2afa[_0xabc8('0x9')](_0xabc8('0xa'),attributes,{'tableName':_0xabc8('0xb'),'paranoid':![],'indexes':[{'name':_0xabc8('0xc'),'fields':['body'],'type':_0xabc8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10acc7,_0x3c3c3f,_0x4b2bd5){var _0x540e36=_0x4b2afa[_0xabc8('0xe')];var _0x4a400a=_0x10acc7[_0xabc8('0xf')]({'plain':!![]});if(_0x4a400a['direction'][_0xabc8('0x10')]()==='in'||_0x4a400a['direction'][_0xabc8('0x10')]()===_0xabc8('0x11')&&!_0x4a400a['secret']&&!_['isNil'](_0x4a400a[_0xabc8('0x12')])){_0x540e36[_0xabc8('0x13')]['findOne']({'where':{'id':_0x4a400a['ChatInteractionId']}})['then'](function(_0x35846c){if(_0x35846c){_0x35846c[_0xabc8('0x14')]({'lastMsgAt':_0x4a400a[_0xabc8('0x15')],'lastMsgDirection':_0x4a400a[_0xabc8('0x16')][_0xabc8('0x10')]()});}})[_0xabc8('0x17')](function(_0x2b86a8){console[_0xabc8('0x18')](_0x2b86a8);});}_0x4b2bd5();}},'charset':_0xabc8('0x19'),'collate':_0xabc8('0x1a')});}; \ No newline at end of file +var _0x1070=['define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','get','toLowerCase','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','direction','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatMessage.attributes'];(function(_0x746018,_0x307bbb){var _0x20f3b2=function(_0x41eccf){while(--_0x41eccf){_0x746018['push'](_0x746018['shift']());}};_0x20f3b2(++_0x307bbb);}(_0x1070,0x1c2));var _0x0107=function(_0x39e5db,_0x4038f2){_0x39e5db=_0x39e5db-0x0;var _0x39fb47=_0x1070[_0x39e5db];return _0x39fb47;};'use strict';var _=require(_0x0107('0x0'));var util=require(_0x0107('0x1'));var logger=require(_0x0107('0x2'))(_0x0107('0x3'));var moment=require(_0x0107('0x4'));var BPromise=require(_0x0107('0x5'));var rp=require(_0x0107('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0107('0x7'));var attributes=require(_0x0107('0x8'));module['exports']=function(_0x5772da,_0x234730){return _0x5772da[_0x0107('0x9')](_0x0107('0xa'),attributes,{'tableName':_0x0107('0xb'),'paranoid':![],'indexes':[{'name':_0x0107('0xc'),'fields':[_0x0107('0xd')],'type':_0x0107('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xca8e24,_0x58147a,_0x4c15d6){var _0x3304ea=_0x5772da['models'];var _0x45629e=_0xca8e24[_0x0107('0xf')]({'plain':!![]});if(_0x45629e['direction']['toLowerCase']()==='in'||_0x45629e['direction'][_0x0107('0x10')]()==='out'&&!_0x45629e['secret']&&!_[_0x0107('0x11')](_0x45629e[_0x0107('0x12')])){_0x3304ea[_0x0107('0x13')][_0x0107('0x14')]({'where':{'id':_0x45629e['ChatInteractionId']}})[_0x0107('0x15')](function(_0x40322a){if(_0x40322a){_0x40322a[_0x0107('0x16')]({'lastMsgAt':_0x45629e[_0x0107('0x17')],'lastMsgDirection':_0x45629e[_0x0107('0x18')][_0x0107('0x10')]()});}})[_0x0107('0x19')](function(_0x3b4917){console[_0x0107('0x1a')](_0x3b4917);});}_0x4c15d6();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7a75a29..d8c52b6 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 _0x88f3=['then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./chatMessage.socket','request'];(function(_0x3dc36e,_0x1917ec){var _0x3c317b=function(_0x37636f){while(--_0x37636f){_0x3dc36e['push'](_0x3dc36e['shift']());}};_0x3c317b(++_0x1917ec);}(_0x88f3,0x13e));var _0x388f=function(_0x438928,_0x4045dc){_0x438928=_0x438928-0x0;var _0x930564=_0x88f3[_0x438928];return _0x930564;};'use strict';var _=require('lodash');var util=require(_0x388f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x388f('0x1'));var fs=require('fs');var Redis=require(_0x388f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x388f('0x3'));var logger=require(_0x388f('0x4'))(_0x388f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x388f('0x6')]['http']({'port':0x232a});config[_0x388f('0x7')]=_[_0x388f('0x8')](config[_0x388f('0x7')],{'host':_0x388f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x388f('0x7')]));require(_0x388f('0xa'))['register'](socket);function respondWithRpcPromise(_0x98779e,_0x2aa07c,_0x285c5d){return new BPromise(function(_0x165e3c,_0x43644a){return client[_0x388f('0xb')](_0x98779e,_0x285c5d)[_0x388f('0xc')](function(_0x53033c){logger[_0x388f('0xd')]('ChatMessage,\x20%s,\x20%s',_0x2aa07c,_0x388f('0xe'));logger[_0x388f('0xf')](_0x388f('0x10'),_0x2aa07c,_0x388f('0xe'),JSON['stringify'](_0x53033c));if(_0x53033c[_0x388f('0x11')]){if(_0x53033c[_0x388f('0x11')][_0x388f('0x12')]===0x1f4){logger[_0x388f('0x11')](_0x388f('0x13'),_0x2aa07c,_0x53033c['error'][_0x388f('0x14')]);return _0x43644a(_0x53033c['error'][_0x388f('0x14')]);}logger[_0x388f('0x11')]('ChatMessage,\x20%s,\x20%s',_0x2aa07c,_0x53033c['error'][_0x388f('0x14')]);return _0x165e3c(_0x53033c[_0x388f('0x11')]['message']);}else{logger[_0x388f('0xd')](_0x388f('0x13'),_0x2aa07c,'request\x20sent');_0x165e3c(_0x53033c[_0x388f('0x15')][_0x388f('0x14')]);}})['catch'](function(_0x4cfe6a){logger[_0x388f('0x11')](_0x388f('0x13'),_0x2aa07c,_0x4cfe6a);_0x43644a(_0x4cfe6a);});});}exports[_0x388f('0x16')]=function(_0x25e7d3){var _0x4f4e21=this;return new Promise(function(_0x38dbb1,_0x24fffe){return db[_0x388f('0x17')][_0x388f('0x18')](_0x25e7d3[_0x388f('0x19')],{'raw':_0x25e7d3[_0x388f('0x1a')]?_0x25e7d3[_0x388f('0x1a')][_0x388f('0x1b')]===undefined?!![]:![]:!![]})[_0x388f('0xc')](function(_0x275aff){logger[_0x388f('0xd')](_0x388f('0x16'),_0x25e7d3);logger[_0x388f('0xf')](_0x388f('0x16'),_0x25e7d3,JSON[_0x388f('0x1c')](_0x275aff));_0x38dbb1(_0x275aff);})[_0x388f('0x1d')](function(_0x4163ed){logger[_0x388f('0x11')]('CreateChatMessage',_0x4163ed[_0x388f('0x14')],_0x25e7d3);_0x24fffe(_0x4f4e21[_0x388f('0x11')](0x1f4,_0x4163ed[_0x388f('0x14')]));});});}; \ No newline at end of file +var _0x2865=['body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage'];(function(_0x52d32c,_0x18be15){var _0x4aec2b=function(_0x6e8870){while(--_0x6e8870){_0x52d32c['push'](_0x52d32c['shift']());}};_0x4aec2b(++_0x18be15);}(_0x2865,0x1b0));var _0x5286=function(_0xda4ace,_0x125cd8){_0xda4ace=_0xda4ace-0x0;var _0x5cac51=_0x2865[_0xda4ace];return _0x5cac51;};'use strict';var _=require('lodash');var util=require(_0x5286('0x0'));var moment=require(_0x5286('0x1'));var BPromise=require(_0x5286('0x2'));var rs=require(_0x5286('0x3'));var fs=require('fs');var Redis=require(_0x5286('0x4'));var db=require(_0x5286('0x5'))['db'];var utils=require(_0x5286('0x6'));var logger=require(_0x5286('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5286('0x8'));var client=jayson[_0x5286('0x9')][_0x5286('0xa')]({'port':0x232a});config[_0x5286('0xb')]=_['defaults'](config[_0x5286('0xb')],{'host':_0x5286('0xc'),'port':0x18eb});var socket=require(_0x5286('0xd'))(new Redis(config[_0x5286('0xb')]));require(_0x5286('0xe'))[_0x5286('0xf')](socket);function respondWithRpcPromise(_0x56db61,_0x1768e7,_0x17a40b){return new BPromise(function(_0x4307b2,_0x4b85e3){return client[_0x5286('0x10')](_0x56db61,_0x17a40b)[_0x5286('0x11')](function(_0x507059){logger[_0x5286('0x12')](_0x5286('0x13'),_0x1768e7,_0x5286('0x14'));logger[_0x5286('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1768e7,_0x5286('0x14'),JSON[_0x5286('0x16')](_0x507059));if(_0x507059[_0x5286('0x17')]){if(_0x507059[_0x5286('0x17')][_0x5286('0x18')]===0x1f4){logger[_0x5286('0x17')](_0x5286('0x13'),_0x1768e7,_0x507059['error'][_0x5286('0x19')]);return _0x4b85e3(_0x507059[_0x5286('0x17')][_0x5286('0x19')]);}logger[_0x5286('0x17')]('ChatMessage,\x20%s,\x20%s',_0x1768e7,_0x507059['error'][_0x5286('0x19')]);return _0x4307b2(_0x507059[_0x5286('0x17')][_0x5286('0x19')]);}else{logger[_0x5286('0x12')](_0x5286('0x13'),_0x1768e7,_0x5286('0x14'));_0x4307b2(_0x507059[_0x5286('0x1a')][_0x5286('0x19')]);}})[_0x5286('0x1b')](function(_0x350988){logger[_0x5286('0x17')](_0x5286('0x13'),_0x1768e7,_0x350988);_0x4b85e3(_0x350988);});});}exports[_0x5286('0x1c')]=function(_0x564930){var _0x34be80=this;return new Promise(function(_0x47e115,_0x3a1329){return db[_0x5286('0x1d')]['create'](_0x564930[_0x5286('0x1e')],{'raw':_0x564930[_0x5286('0x1f')]?_0x564930[_0x5286('0x1f')][_0x5286('0x20')]===undefined?!![]:![]:!![]})[_0x5286('0x11')](function(_0x1ae21b){logger[_0x5286('0x12')]('CreateChatMessage',_0x564930);logger[_0x5286('0x15')](_0x5286('0x1c'),_0x564930,JSON[_0x5286('0x16')](_0x1ae21b));_0x47e115(_0x1ae21b);})[_0x5286('0x1b')](function(_0x533582){logger[_0x5286('0x17')](_0x5286('0x1c'),_0x533582[_0x5286('0x19')],_0x564930);_0x3a1329(_0x34be80[_0x5286('0x17')](0x1f4,_0x533582[_0x5286('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 35b2db6..635bc94 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 _0x2e8a=['remove','emit','chatMessage:','save'];(function(_0x4f7ca7,_0x5099e7){var _0x55f6b0=function(_0x368838){while(--_0x368838){_0x4f7ca7['push'](_0x4f7ca7['shift']());}};_0x55f6b0(++_0x5099e7);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0x2e8a[_0x16dbab];return _0x59b0b2;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa2e8('0x0'),_0xa2e8('0x1'),'update'];function createListener(_0x3a9fbd,_0x2b63d9){return function(_0x4b770c){_0x2b63d9[_0xa2e8('0x2')](_0x3a9fbd,_0x4b770c);};}function removeListener(_0x522e76,_0x492531){return function(){ChatMessageEvents['removeListener'](_0x522e76,_0x492531);};}exports['register']=function(_0x4593d2){for(var _0x32fb35=0x0,_0x4d31a8=events['length'];_0x32fb35<_0x4d31a8;_0x32fb35++){var _0x99f433=events[_0x32fb35];var _0x3b6834=createListener(_0xa2e8('0x3')+_0x99f433,_0x4593d2);ChatMessageEvents['on'](_0x99f433,_0x3b6834);}}; \ No newline at end of file +var _0x6bac=['./chatMessage.events','remove','update','removeListener','length'];(function(_0x229b05,_0x58c5a9){var _0x2ea740=function(_0x463061){while(--_0x463061){_0x229b05['push'](_0x229b05['shift']());}};_0x2ea740(++_0x58c5a9);}(_0x6bac,0xa5));var _0xc6ba=function(_0x79e805,_0x17a8ed){_0x79e805=_0x79e805-0x0;var _0x4da84d=_0x6bac[_0x79e805];return _0x4da84d;};'use strict';var ChatMessageEvents=require(_0xc6ba('0x0'));var events=['save',_0xc6ba('0x1'),_0xc6ba('0x2')];function createListener(_0xf479c,_0x1869a3){return function(_0x489037){_0x1869a3['emit'](_0xf479c,_0x489037);};}function removeListener(_0x487ef1,_0x378f3d){return function(){ChatMessageEvents[_0xc6ba('0x3')](_0x487ef1,_0x378f3d);};}exports['register']=function(_0x222f20){for(var _0x2a16af=0x0,_0x33167e=events[_0xc6ba('0x4')];_0x2a16af<_0x33167e;_0x2a16af++){var _0x12d6e9=events[_0x2a16af];var _0x1fa2a8=createListener('chatMessage:'+_0x12d6e9,_0x222f20);ChatMessageEvents['on'](_0x12d6e9,_0x1fa2a8);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 201ac32..d65e477 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 _0xc11d=['get','index','isAuthenticated','describe','/:id','show','post','tracked','chat','update','put','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17b7b6,_0x25aec5){var _0x4d3dd7=function(_0x174be4){while(--_0x174be4){_0x17b7b6['push'](_0x17b7b6['shift']());}};_0x4d3dd7(++_0x25aec5);}(_0xc11d,0x1de));var _0xdc11=function(_0x2fcf33,_0x332942){_0x2fcf33=_0x2fcf33-0x0;var _0xeb551d=_0xc11d[_0x2fcf33];return _0xeb551d;};'use strict';var multer=require(_0xdc11('0x0'));var util=require(_0xdc11('0x1'));var path=require('path');var timeout=require(_0xdc11('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc11('0x3'));var interaction=require(_0xdc11('0x4'));var config=require(_0xdc11('0x5'));var controller=require('./chatMessage.controller');router[_0xdc11('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc11('0x7')]);router[_0xdc11('0x6')]('/describe',auth[_0xdc11('0x8')](),controller[_0xdc11('0x9')]);router[_0xdc11('0x6')](_0xdc11('0xa'),auth[_0xdc11('0x8')](),controller[_0xdc11('0xb')]);router[_0xdc11('0xc')]('/',auth[_0xdc11('0x8')](),interaction[_0xdc11('0xd')](_0xdc11('0xe'),'chatmessage:create'),controller['create']);router['put'](_0xdc11('0xa'),controller[_0xdc11('0xf')]);router[_0xdc11('0x10')](_0xdc11('0x11'),auth[_0xdc11('0x8')](),controller[_0xdc11('0x12')]);router[_0xdc11('0x10')]('/:id/reject',auth[_0xdc11('0x8')](),controller[_0xdc11('0x13')]);router[_0xdc11('0x14')]('/:id',auth[_0xdc11('0x8')](),controller[_0xdc11('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbf3c=['express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','show','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','reject','delete','destroy','exports','util','path','connect-timeout'];(function(_0x227b65,_0x3a4249){var _0x32c32f=function(_0x2aa7b4){while(--_0x2aa7b4){_0x227b65['push'](_0x227b65['shift']());}};_0x32c32f(++_0x3a4249);}(_0xbf3c,0xef));var _0xcbf3=function(_0x15c25b,_0x3e45aa){_0x15c25b=_0x15c25b-0x0;var _0x3a4965=_0xbf3c[_0x15c25b];return _0x3a4965;};'use strict';var multer=require('multer');var util=require(_0xcbf3('0x0'));var path=require(_0xcbf3('0x1'));var timeout=require(_0xcbf3('0x2'));var express=require(_0xcbf3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcbf3('0x4'));var interaction=require(_0xcbf3('0x5'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0xcbf3('0x6')]('/',auth[_0xcbf3('0x7')](),controller[_0xcbf3('0x8')]);router[_0xcbf3('0x6')](_0xcbf3('0x9'),auth[_0xcbf3('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcbf3('0xa')]);router['post']('/',auth[_0xcbf3('0x7')](),interaction[_0xcbf3('0xb')](_0xcbf3('0xc'),_0xcbf3('0xd')),controller['create']);router[_0xcbf3('0xe')]('/:id',controller[_0xcbf3('0xf')]);router[_0xcbf3('0xe')](_0xcbf3('0x10'),auth[_0xcbf3('0x7')](),controller[_0xcbf3('0x11')]);router['put']('/:id/reject',auth[_0xcbf3('0x7')](),controller[_0xcbf3('0x12')]);router[_0xcbf3('0x13')]('/:id',auth[_0xcbf3('0x7')](),controller[_0xcbf3('0x14')]);module[_0xcbf3('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2e636ff..abb9290 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 _0x5f66=['medium','TEXT','exports'];(function(_0x5c075e,_0x2e9229){var _0x2b4271=function(_0x19ce53){while(--_0x19ce53){_0x5c075e['push'](_0x5c075e['shift']());}};_0x2b4271(++_0x2e9229);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x58d23c,_0x34d513){var _0x17d372=function(_0x5b6e2b){while(--_0x5b6e2b){_0x58d23c['push'](_0x58d23c['shift']());}};_0x17d372(++_0x34d513);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5bc76e,_0x2d69c7){_0x5bc76e=_0x5bc76e-0x0;var _0x524844=_0x5f2f[_0x5bc76e];return _0x524844;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7eda674..7b91dc0 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(_0x5eafc3,_0x53ab20){var _0x5a13d1=function(_0x27f9ee){while(--_0x27f9ee){_0x5eafc3['push'](_0x5eafc3['shift']());}};_0x5a13d1(++_0x53ab20);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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(_0x9496d2,_0x58c6f4){var _0x4ff60f=function(_0x50c716){while(--_0x50c716){_0x9496d2['push'](_0x9496d2['shift']());}};_0x4ff60f(++_0x58c6f4);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 bedc131..d117ac0 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 _0x882a=['hasOwnProperty','events','../../mysqldb','save','update','emit'];(function(_0x34ca5a,_0x2f14b1){var _0x38c2be=function(_0x239f61){while(--_0x239f61){_0x34ca5a['push'](_0x34ca5a['shift']());}};_0x38c2be(++_0x2f14b1);}(_0x882a,0xc7));var _0xa882=function(_0x38d203,_0x550d39){_0x38d203=_0x38d203-0x0;var _0x445791=_0x882a[_0x38d203];return _0x445791;};'use strict';var EventEmitter=require(_0xa882('0x0'));var ChatOfflineMessage=require(_0xa882('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa882('0x2'),'afterUpdate':_0xa882('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c5051){return function(_0x126b9a,_0x2355bc,_0x24657e){ChatOfflineMessageEvents[_0xa882('0x4')](_0x3c5051+':'+_0x126b9a['id'],_0x126b9a);ChatOfflineMessageEvents[_0xa882('0x4')](_0x3c5051,_0x126b9a);_0x24657e(null);};}for(var e in events){if(events[_0xa882('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x2973=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x12e542,_0x3da782){var _0x2d2195=function(_0x430822){while(--_0x430822){_0x12e542['push'](_0x12e542['shift']());}};_0x2d2195(++_0x3da782);}(_0x2973,0xef));var _0x3297=function(_0x34e481,_0x1f0d05){_0x34e481=_0x34e481-0x0;var _0x195d01=_0x2973[_0x34e481];return _0x195d01;};'use strict';var EventEmitter=require(_0x3297('0x0'));var ChatOfflineMessage=require(_0x3297('0x1'))['db'][_0x3297('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3297('0x3')](0x0);var events={'afterCreate':_0x3297('0x4'),'afterUpdate':_0x3297('0x5'),'afterDestroy':_0x3297('0x6')};function emitEvent(_0x572151){return function(_0xb386a2,_0x8b8a4a,_0x46498e){ChatOfflineMessageEvents[_0x3297('0x7')](_0x572151+':'+_0xb386a2['id'],_0xb386a2);ChatOfflineMessageEvents[_0x3297('0x7')](_0x572151,_0xb386a2);_0x46498e(null);};}for(var e in events){if(events[_0x3297('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x3297('0x9')](e,emitEvent(event));}}module[_0x3297('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4ed5516..cbab7d8 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 _0x3cef=['exports','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x54fea7,_0x33e39c){var _0x502ed1=function(_0x2980ed){while(--_0x2980ed){_0x54fea7['push'](_0x54fea7['shift']());}};_0x502ed1(++_0x33e39c);}(_0x3cef,0x10b));var _0xf3ce=function(_0x3e5e50,_0x28c883){_0x3e5e50=_0x3e5e50-0x0;var _0x3c852a=_0x3cef[_0x3e5e50];return _0x3c852a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xf3ce('0x0')]=function(_0x30ff22){return _0x30ff22['define']('ChatOfflineMessage',attributes,{'tableName':_0xf3ce('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf3ce('0x2')});}; \ No newline at end of file +var _0xb5d3=['exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x470ada,_0x59115d){var _0x2e53c1=function(_0x3c3d71){while(--_0x3c3d71){_0x470ada['push'](_0x470ada['shift']());}};_0x2e53c1(++_0x59115d);}(_0xb5d3,0x149));var _0x3b5d=function(_0x3b6cc7,_0x5df0c1){_0x3b6cc7=_0x3b6cc7-0x0;var _0x37f564=_0xb5d3[_0x3b6cc7];return _0x37f564;};'use strict';var attributes=require(_0x3b5d('0x0'));module[_0x3b5d('0x1')]=function(_0x487290){return _0x487290[_0x3b5d('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x3b5d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b5d('0x4'),'collate':_0x3b5d('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 5d0cabe..e273231 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 _0x12d7=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require('util');var moment=require(_0x712d('0x1'));var BPromise=require(_0x712d('0x2'));var rs=require(_0x712d('0x3'));var fs=require('fs');var Redis=require(_0x712d('0x4'));var db=require(_0x712d('0x5'))['db'];var utils=require(_0x712d('0x6'));var logger=require('../../config/logger')(_0x712d('0x7'));var config=require(_0x712d('0x8'));var jayson=require(_0x712d('0x9'));var client=jayson[_0x712d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0028,_0x2923c4,_0x80eb6){return new BPromise(function(_0x1dde71,_0x2e32c1){return client[_0x712d('0xb')](_0x4e0028,_0x80eb6)[_0x712d('0xc')](function(_0x3ccad4){logger[_0x712d('0xd')](_0x712d('0xe'),_0x2923c4,_0x712d('0xf'));logger[_0x712d('0x10')](_0x712d('0x11'),_0x2923c4,_0x712d('0xf'),JSON['stringify'](_0x3ccad4));if(_0x3ccad4['error']){if(_0x3ccad4[_0x712d('0x12')]['code']===0x1f4){logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3ccad4['error']['message']);return _0x2e32c1(_0x3ccad4[_0x712d('0x12')][_0x712d('0x13')]);}logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3ccad4['error']['message']);return _0x1dde71(_0x3ccad4[_0x712d('0x12')][_0x712d('0x13')]);}else{logger[_0x712d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2923c4,_0x712d('0xf'));_0x1dde71(_0x3ccad4[_0x712d('0x14')]['message']);}})[_0x712d('0x15')](function(_0x3572bd){logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3572bd);_0x2e32c1(_0x3572bd);});});} \ No newline at end of file +var _0xfd69=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0xfd69,0xa4));var _0x9fd6=function(_0x1c2aa7,_0x1f7fb6){_0x1c2aa7=_0x1c2aa7-0x0;var _0x51594c=_0xfd69[_0x1c2aa7];return _0x51594c;};'use strict';var _=require(_0x9fd6('0x0'));var util=require(_0x9fd6('0x1'));var moment=require(_0x9fd6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fd6('0x3'));var db=require(_0x9fd6('0x4'))['db'];var utils=require(_0x9fd6('0x5'));var logger=require(_0x9fd6('0x6'))(_0x9fd6('0x7'));var config=require(_0x9fd6('0x8'));var jayson=require(_0x9fd6('0x9'));var client=jayson[_0x9fd6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a6792,_0x5df490,_0x53e38d){return new BPromise(function(_0x29aedc,_0x36206a){return client[_0x9fd6('0xb')](_0x2a6792,_0x53e38d)[_0x9fd6('0xc')](function(_0x244ee3){logger[_0x9fd6('0xd')](_0x9fd6('0xe'),_0x5df490,_0x9fd6('0xf'));logger[_0x9fd6('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5df490,'request\x20sent',JSON[_0x9fd6('0x11')](_0x244ee3));if(_0x244ee3[_0x9fd6('0x12')]){if(_0x244ee3[_0x9fd6('0x12')][_0x9fd6('0x13')]===0x1f4){logger[_0x9fd6('0x12')](_0x9fd6('0xe'),_0x5df490,_0x244ee3[_0x9fd6('0x12')][_0x9fd6('0x14')]);return _0x36206a(_0x244ee3[_0x9fd6('0x12')][_0x9fd6('0x14')]);}logger['error'](_0x9fd6('0xe'),_0x5df490,_0x244ee3[_0x9fd6('0x12')]['message']);return _0x29aedc(_0x244ee3[_0x9fd6('0x12')]['message']);}else{logger[_0x9fd6('0xd')](_0x9fd6('0xe'),_0x5df490,'request\x20sent');_0x29aedc(_0x244ee3[_0x9fd6('0x15')][_0x9fd6('0x14')]);}})['catch'](function(_0x51270e){logger[_0x9fd6('0x12')](_0x9fd6('0xe'),_0x5df490,_0x51270e);_0x36206a(_0x51270e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bed5fe5..7af6416 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 _0xe9b1=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','destroy','multer'];(function(_0x205e1f,_0x12cc1d){var _0x505ea0=function(_0x3afa28){while(--_0x3afa28){_0x205e1f['push'](_0x205e1f['shift']());}};_0x505ea0(++_0x12cc1d);}(_0xe9b1,0x92));var _0x1e9b=function(_0x5a585b,_0x3e0674){_0x5a585b=_0x5a585b-0x0;var _0x4cd398=_0xe9b1[_0x5a585b];return _0x4cd398;};'use strict';var multer=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var path=require(_0x1e9b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e9b('0x3')]();var fs_extra=require(_0x1e9b('0x4'));var auth=require(_0x1e9b('0x5'));var interaction=require(_0x1e9b('0x6'));var config=require(_0x1e9b('0x7'));var controller=require(_0x1e9b('0x8'));router[_0x1e9b('0x9')]('/',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xb')]);router[_0x1e9b('0x9')](_0x1e9b('0xc'),auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xd')]);router[_0x1e9b('0x9')]('/:id',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xe')]);router[_0x1e9b('0xf')]('/',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1e9b('0x11')]);router[_0x1e9b('0x12')](_0x1e9b('0x13'),auth[_0x1e9b('0xa')](),controller[_0x1e9b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0217=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x58c23d,_0x88614f){var _0x20e8ae=function(_0x3951eb){while(--_0x3951eb){_0x58c23d['push'](_0x58c23d['shift']());}};_0x20e8ae(++_0x88614f);}(_0x0217,0x1cf));var _0x7021=function(_0x3f6fd0,_0x4b5c9c){_0x3f6fd0=_0x3f6fd0-0x0;var _0x4257a2=_0x0217[_0x3f6fd0];return _0x4257a2;};'use strict';var multer=require(_0x7021('0x0'));var util=require('util');var path=require(_0x7021('0x1'));var timeout=require(_0x7021('0x2'));var express=require('express');var router=express[_0x7021('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7021('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7021('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x7021('0x6')]('/',auth[_0x7021('0x7')](),controller[_0x7021('0x8')]);router[_0x7021('0x6')](_0x7021('0x9'),auth[_0x7021('0x7')](),controller[_0x7021('0xa')]);router[_0x7021('0x6')](_0x7021('0xb'),auth[_0x7021('0x7')](),controller['show']);router[_0x7021('0xc')]('/',auth[_0x7021('0x7')](),controller['create']);router[_0x7021('0xd')](_0x7021('0xb'),auth['isAuthenticated'](),controller[_0x7021('0xe')]);router[_0x7021('0xf')](_0x7021('0xb'),auth[_0x7021('0x7')](),controller[_0x7021('0x10')]);module[_0x7021('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e8c62ee..73fb925 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 _0x660e=['sequelize','exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x4f26f0,_0x559017){var _0x57a1aa=function(_0x4a644f){while(--_0x4a644f){_0x4f26f0['push'](_0x4f26f0['shift']());}};_0x57a1aa(++_0x559017);}(_0x660e,0x1b0));var _0xe660=function(_0x183608,_0x3302fd){_0x183608=_0x183608-0x0;var _0x292e43=_0x660e[_0x183608];return _0x292e43;};'use strict';var Sequelize=require(_0xe660('0x0'));module[_0xe660('0x1')]={'name':{'type':Sequelize[_0xe660('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe660('0x3')](_0xe660('0x4'),'timeout'),'defaultValue':_0xe660('0x4')},'selector':{'type':Sequelize[_0xe660('0x2')]},'timeout':{'type':Sequelize[_0xe660('0x5')]}}; \ No newline at end of file +var _0xdfad=['sequelize','exports','ENUM','mouseOver','timeout','STRING','INTEGER'];(function(_0x25e0c7,_0x3e4af4){var _0x299fd0=function(_0x365fb8){while(--_0x365fb8){_0x25e0c7['push'](_0x25e0c7['shift']());}};_0x299fd0(++_0x3e4af4);}(_0xdfad,0x157));var _0xddfa=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xdfad[_0x504df1];return _0x1063b5;};'use strict';var Sequelize=require(_0xddfa('0x0'));module[_0xddfa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xddfa('0x2')](_0xddfa('0x3'),_0xddfa('0x4')),'defaultValue':_0xddfa('0x3')},'selector':{'type':Sequelize[_0xddfa('0x5')]},'timeout':{'type':Sequelize[_0xddfa('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 978c704..3a1964e 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 _0x20d7=['limit','undefined','count','Content-Range','json','reject','update','error','stack','name','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','util','path','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','../../mysqldb','sendStatus','status','end','offset'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x20d7,0x146));var _0x720d=function(_0x96eb37,_0x3f9f23){_0x96eb37=_0x96eb37-0x0;var _0xa04f6e=_0x20d7[_0x96eb37];return _0xa04f6e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x720d('0x0'));var jsonpatch=require(_0x720d('0x1'));var rp=require(_0x720d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x720d('0x3'));var path=require(_0x720d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x720d('0x5'));var _=require('lodash');var squel=require(_0x720d('0x6'));var crypto=require(_0x720d('0x7'));var jsforce=require(_0x720d('0x8'));var deskjs=require(_0x720d('0x9'));var toCsv=require(_0x720d('0xa'));var querystring=require(_0x720d('0xb'));var Papa=require(_0x720d('0xc'));var Redis=require(_0x720d('0xd'));var authService=require(_0x720d('0xe'));var qs=require(_0x720d('0xf'));var as=require(_0x720d('0x10'));var hardwareService=require(_0x720d('0x11'));var logger=require(_0x720d('0x12'))(_0x720d('0x13'));var utils=require(_0x720d('0x14'));var config=require(_0x720d('0x15'));var licenseUtil=require(_0x720d('0x16'));var db=require(_0x720d('0x17'))['db'];function respondWithStatusCode(_0x1abbf9,_0x555f4f){_0x555f4f=_0x555f4f||0xcc;return function(_0x28daea){if(_0x28daea){return _0x1abbf9[_0x720d('0x18')](_0x555f4f);}return _0x1abbf9[_0x720d('0x19')](_0x555f4f)[_0x720d('0x1a')]();};}function respondWithResult(_0x2c3c4e,_0x3eb77b){_0x3eb77b=_0x3eb77b||0xc8;return function(_0x2e0ecd){if(_0x2e0ecd){return _0x2c3c4e[_0x720d('0x19')](_0x3eb77b)['json'](_0x2e0ecd);}};}function respondWithFilteredResult(_0x408dff,_0x561445){return function(_0x48c460){if(_0x48c460){var _0x5af38e=typeof _0x561445[_0x720d('0x1b')]==='undefined'&&typeof _0x561445[_0x720d('0x1c')]===_0x720d('0x1d');var _0x443443=_0x48c460[_0x720d('0x1e')];var _0x302562=_0x5af38e?0x0:_0x561445[_0x720d('0x1b')];var _0x134394=_0x5af38e?_0x48c460['count']:_0x561445[_0x720d('0x1b')]+_0x561445[_0x720d('0x1c')];var _0x243dce;if(_0x134394>=_0x443443){_0x134394=_0x443443;_0x243dce=0xc8;}else{_0x243dce=0xce;}_0x408dff[_0x720d('0x19')](_0x243dce);return _0x408dff['set'](_0x720d('0x1f'),_0x302562+'-'+_0x134394+'/'+_0x443443)[_0x720d('0x20')](_0x48c460);}return null;};}function patchUpdates(_0x3c09c2){return function(_0x3237c2){try{jsonpatch['apply'](_0x3237c2,_0x3c09c2,!![]);}catch(_0x26b78f){return BPromise[_0x720d('0x21')](_0x26b78f);}return _0x3237c2['save']();};}function saveUpdates(_0x318c23,_0x28690b){return function(_0x1cbe26){if(_0x1cbe26){return _0x1cbe26[_0x720d('0x22')](_0x318c23)['then'](function(_0x3be62e){return _0x3be62e;});}return null;};}function removeEntity(_0x5d27ea,_0x341bcc){return function(_0x466b1d){if(_0x466b1d){return _0x466b1d['destroy']()['then'](function(){_0x5d27ea[_0x720d('0x19')](0xcc)[_0x720d('0x1a')]();});}};}function handleEntityNotFound(_0x5d31ac,_0x2f6d4f){return function(_0x3acb8b){if(!_0x3acb8b){_0x5d31ac[_0x720d('0x18')](0x194);}return _0x3acb8b;};}function handleError(_0x4f44e3,_0xa400f8){_0xa400f8=_0xa400f8||0x1f4;return function(_0x2b7ed4){logger[_0x720d('0x23')](_0x2b7ed4[_0x720d('0x24')]);if(_0x2b7ed4[_0x720d('0x25')]){delete _0x2b7ed4['name'];}_0x4f44e3[_0x720d('0x19')](_0xa400f8)['send'](_0x2b7ed4);};}exports['show']=function(_0x260820,_0x22c161){var _0x4d9778={'raw':!![],'where':{'id':_0x260820[_0x720d('0x26')]['id']}},_0x4b76bd={};_0x4b76bd[_0x720d('0x27')]=_[_0x720d('0x28')](db[_0x720d('0x29')][_0x720d('0x2a')]);_0x4b76bd[_0x720d('0x2b')]=_['keys'](_0x260820[_0x720d('0x2b')]);_0x4b76bd[_0x720d('0x2c')]=_[_0x720d('0x2d')](_0x4b76bd[_0x720d('0x27')],_0x4b76bd['query']);_0x4d9778[_0x720d('0x2e')]=_[_0x720d('0x2d')](_0x4b76bd[_0x720d('0x27')],qs[_0x720d('0x2f')](_0x260820[_0x720d('0x2b')][_0x720d('0x2f')]));_0x4d9778['attributes']=_0x4d9778[_0x720d('0x2e')][_0x720d('0x30')]?_0x4d9778[_0x720d('0x2e')]:_0x4b76bd['model'];if(_0x260820[_0x720d('0x2b')][_0x720d('0x31')]){_0x4d9778[_0x720d('0x32')]=[{'all':!![]}];}_0x4d9778=_[_0x720d('0x33')]({},_0x4d9778,_0x260820[_0x720d('0x34')]);return db[_0x720d('0x29')][_0x720d('0x35')](_0x4d9778)[_0x720d('0x36')](handleEntityNotFound(_0x22c161,null))[_0x720d('0x36')](respondWithResult(_0x22c161,null))['catch'](handleError(_0x22c161,null));};exports[_0x720d('0x37')]=function(_0x41325b,_0x3ede58){return db['ChatProactiveAction'][_0x720d('0x37')](_0x41325b[_0x720d('0x38')],{})[_0x720d('0x36')](respondWithResult(_0x3ede58,0xc9))['catch'](handleError(_0x3ede58,null));};exports[_0x720d('0x22')]=function(_0x3ac007,_0x5be2a8){if(_0x3ac007[_0x720d('0x38')]['id']){delete _0x3ac007[_0x720d('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x3ac007['params']['id']}})['then'](handleEntityNotFound(_0x5be2a8,null))[_0x720d('0x36')](saveUpdates(_0x3ac007[_0x720d('0x38')],null))[_0x720d('0x36')](respondWithResult(_0x5be2a8,null))[_0x720d('0x39')](handleError(_0x5be2a8,null));};exports[_0x720d('0x3a')]=function(_0x1b401f,_0x306f63){return db[_0x720d('0x29')][_0x720d('0x35')]({'where':{'id':_0x1b401f[_0x720d('0x26')]['id']}})['then'](handleEntityNotFound(_0x306f63,null))['then'](removeEntity(_0x306f63,null))[_0x720d('0x39')](handleError(_0x306f63,null));}; \ No newline at end of file +var _0x7118=['json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x7118,0x159));var _0x8711=function(_0x3c7d11,_0x25a5c9){_0x3c7d11=_0x3c7d11-0x0;var _0x4fb661=_0x7118[_0x3c7d11];return _0x4fb661;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8711('0x0'));var jsonpatch=require(_0x8711('0x1'));var rp=require('request-promise');var moment=require(_0x8711('0x2'));var BPromise=require(_0x8711('0x3'));var Mustache=require(_0x8711('0x4'));var util=require(_0x8711('0x5'));var path=require(_0x8711('0x6'));var sox=require(_0x8711('0x7'));var csv=require(_0x8711('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8711('0x9'));var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0x8'));var querystring=require(_0x8711('0xf'));var Papa=require(_0x8711('0x10'));var Redis=require(_0x8711('0x11'));var authService=require(_0x8711('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x13'));var logger=require(_0x8711('0x14'))(_0x8711('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8711('0x16'));var db=require(_0x8711('0x17'))['db'];function respondWithStatusCode(_0x5d2c38,_0x49b241){_0x49b241=_0x49b241||0xcc;return function(_0x11adb0){if(_0x11adb0){return _0x5d2c38[_0x8711('0x18')](_0x49b241);}return _0x5d2c38[_0x8711('0x19')](_0x49b241)[_0x8711('0x1a')]();};}function respondWithResult(_0xc0a891,_0x22f434){_0x22f434=_0x22f434||0xc8;return function(_0x16b742){if(_0x16b742){return _0xc0a891['status'](_0x22f434)[_0x8711('0x1b')](_0x16b742);}};}function respondWithFilteredResult(_0x363bcd,_0x13f394){return function(_0x2e12ec){if(_0x2e12ec){var _0x3ab905=typeof _0x13f394[_0x8711('0x1c')]==='undefined'&&typeof _0x13f394[_0x8711('0x1d')]===_0x8711('0x1e');var _0x1c2cb5=_0x2e12ec[_0x8711('0x1f')];var _0x19a157=_0x3ab905?0x0:_0x13f394['offset'];var _0x5b2bf8=_0x3ab905?_0x2e12ec['count']:_0x13f394[_0x8711('0x1c')]+_0x13f394[_0x8711('0x1d')];var _0x2f6134;if(_0x5b2bf8>=_0x1c2cb5){_0x5b2bf8=_0x1c2cb5;_0x2f6134=0xc8;}else{_0x2f6134=0xce;}_0x363bcd['status'](_0x2f6134);return _0x363bcd['set'](_0x8711('0x20'),_0x19a157+'-'+_0x5b2bf8+'/'+_0x1c2cb5)[_0x8711('0x1b')](_0x2e12ec);}return null;};}function patchUpdates(_0x1209e0){return function(_0x44b948){try{jsonpatch[_0x8711('0x21')](_0x44b948,_0x1209e0,!![]);}catch(_0x270081){return BPromise[_0x8711('0x22')](_0x270081);}return _0x44b948[_0x8711('0x23')]();};}function saveUpdates(_0xace829,_0x41369d){return function(_0x4a35f5){if(_0x4a35f5){return _0x4a35f5[_0x8711('0x24')](_0xace829)[_0x8711('0x25')](function(_0x3302b9){return _0x3302b9;});}return null;};}function removeEntity(_0x939ef3,_0x4cf830){return function(_0x27cafd){if(_0x27cafd){return _0x27cafd[_0x8711('0x26')]()[_0x8711('0x25')](function(){_0x939ef3['status'](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x17bf7f,_0x3e8281){return function(_0x217197){if(!_0x217197){_0x17bf7f[_0x8711('0x18')](0x194);}return _0x217197;};}function handleError(_0x514956,_0x494683){_0x494683=_0x494683||0x1f4;return function(_0x515a74){logger[_0x8711('0x27')](_0x515a74[_0x8711('0x28')]);if(_0x515a74[_0x8711('0x29')]){delete _0x515a74[_0x8711('0x29')];}_0x514956[_0x8711('0x19')](_0x494683)[_0x8711('0x2a')](_0x515a74);};}exports[_0x8711('0x2b')]=function(_0x3ca2b5,_0x398097){var _0x47e7b7={'raw':!![],'where':{'id':_0x3ca2b5['params']['id']}},_0x27db5d={};_0x27db5d[_0x8711('0x2c')]=_[_0x8711('0x2d')](db[_0x8711('0x2e')]['rawAttributes']);_0x27db5d[_0x8711('0x2f')]=_['keys'](_0x3ca2b5[_0x8711('0x2f')]);_0x27db5d[_0x8711('0x30')]=_[_0x8711('0x31')](_0x27db5d['model'],_0x27db5d['query']);_0x47e7b7[_0x8711('0x32')]=_[_0x8711('0x31')](_0x27db5d[_0x8711('0x2c')],qs[_0x8711('0x33')](_0x3ca2b5[_0x8711('0x2f')][_0x8711('0x33')]));_0x47e7b7[_0x8711('0x32')]=_0x47e7b7[_0x8711('0x32')][_0x8711('0x34')]?_0x47e7b7[_0x8711('0x32')]:_0x27db5d['model'];if(_0x3ca2b5[_0x8711('0x2f')][_0x8711('0x35')]){_0x47e7b7[_0x8711('0x36')]=[{'all':!![]}];}_0x47e7b7=_[_0x8711('0x37')]({},_0x47e7b7,_0x3ca2b5[_0x8711('0x38')]);return db[_0x8711('0x2e')][_0x8711('0x39')](_0x47e7b7)[_0x8711('0x25')](handleEntityNotFound(_0x398097,null))[_0x8711('0x25')](respondWithResult(_0x398097,null))[_0x8711('0x3a')](handleError(_0x398097,null));};exports['create']=function(_0x18643f,_0x318e5d){return db[_0x8711('0x2e')][_0x8711('0x3b')](_0x18643f[_0x8711('0x3c')],{})['then'](respondWithResult(_0x318e5d,0xc9))[_0x8711('0x3a')](handleError(_0x318e5d,null));};exports[_0x8711('0x24')]=function(_0xa31bb6,_0x59486c){if(_0xa31bb6[_0x8711('0x3c')]['id']){delete _0xa31bb6[_0x8711('0x3c')]['id'];}return db[_0x8711('0x2e')][_0x8711('0x39')]({'where':{'id':_0xa31bb6[_0x8711('0x3d')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x59486c,null))[_0x8711('0x25')](saveUpdates(_0xa31bb6['body'],null))[_0x8711('0x25')](respondWithResult(_0x59486c,null))[_0x8711('0x3a')](handleError(_0x59486c,null));};exports[_0x8711('0x26')]=function(_0x3bb19e,_0x5a7e83){return db['ChatProactiveAction'][_0x8711('0x39')]({'where':{'id':_0x3bb19e[_0x8711('0x3d')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x5a7e83,null))[_0x8711('0x25')](removeEntity(_0x5a7e83,null))[_0x8711('0x3a')](handleError(_0x5a7e83,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 3a37845..f66dccd 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 _0x6c23=['exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x273dc3,_0x3d8d20){var _0x3dad14=function(_0x4b4a09){while(--_0x4b4a09){_0x273dc3['push'](_0x273dc3['shift']());}};_0x3dad14(++_0x3d8d20);}(_0x6c23,0x13c));var _0x36c2=function(_0x5d8b05,_0x3fe969){_0x5d8b05=_0x5d8b05-0x0;var _0x24b9b5=_0x6c23[_0x5d8b05];return _0x24b9b5;};'use strict';var _=require('lodash');var util=require(_0x36c2('0x0'));var logger=require(_0x36c2('0x1'))(_0x36c2('0x2'));var moment=require(_0x36c2('0x3'));var BPromise=require(_0x36c2('0x4'));var rp=require(_0x36c2('0x5'));var fs=require('fs');var path=require(_0x36c2('0x6'));var rimraf=require(_0x36c2('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x36c2('0x8')]=function(_0x423ef3,_0xe4415c){return _0x423ef3[_0x36c2('0x9')](_0x36c2('0xa'),attributes,{'tableName':_0x36c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa002=['moment','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','util','../../config/logger'];(function(_0x5730e3,_0x5d58ff){var _0x83daa4=function(_0xa30445){while(--_0xa30445){_0x5730e3['push'](_0x5730e3['shift']());}};_0x83daa4(++_0x5d58ff);}(_0xa002,0xa0));var _0x2a00=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa002[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x2a00('0x0'));var logger=require(_0x2a00('0x1'))('api');var moment=require(_0x2a00('0x2'));var BPromise=require('bluebird');var rp=require(_0x2a00('0x3'));var fs=require('fs');var path=require(_0x2a00('0x4'));var rimraf=require('rimraf');var config=require(_0x2a00('0x5'));var attributes=require(_0x2a00('0x6'));module[_0x2a00('0x7')]=function(_0x428115,_0x299b16){return _0x428115['define'](_0x2a00('0x8'),attributes,{'tableName':'chat_proactive_actions','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 9f3346b..4fa9e48 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 _0x2437=['request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2437,0x1bf));var _0x7243=function(_0x5598a4,_0x49f787){_0x5598a4=_0x5598a4-0x0;var _0x1923b6=_0x2437[_0x5598a4];return _0x1923b6;};'use strict';var _=require('lodash');var util=require(_0x7243('0x0'));var moment=require(_0x7243('0x1'));var BPromise=require('bluebird');var rs=require(_0x7243('0x2'));var fs=require('fs');var Redis=require(_0x7243('0x3'));var db=require(_0x7243('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7243('0x5'));var config=require('../../config/environment');var jayson=require(_0x7243('0x6'));var client=jayson[_0x7243('0x7')][_0x7243('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e9857,_0x2e4519,_0x7b9cd4){return new BPromise(function(_0x21623b,_0xe39c08){return client[_0x7243('0x9')](_0x3e9857,_0x7b9cd4)['then'](function(_0x11d537){logger[_0x7243('0xa')](_0x7243('0xb'),_0x2e4519,'request\x20sent');logger['debug'](_0x7243('0xc'),_0x2e4519,_0x7243('0xd'),JSON[_0x7243('0xe')](_0x11d537));if(_0x11d537[_0x7243('0xf')]){if(_0x11d537['error'][_0x7243('0x10')]===0x1f4){logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);return _0xe39c08(_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);}logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);return _0x21623b(_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);}else{logger[_0x7243('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x2e4519,_0x7243('0xd'));_0x21623b(_0x11d537[_0x7243('0x12')]['message']);}})[_0x7243('0x13')](function(_0x34eab3){logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x34eab3);_0xe39c08(_0x34eab3);});});} \ No newline at end of file +var _0x2984=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2984,0x121));var _0x4298=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x2984[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x4298('0x0'));var util=require(_0x4298('0x1'));var moment=require('moment');var BPromise=require(_0x4298('0x2'));var rs=require(_0x4298('0x3'));var fs=require('fs');var Redis=require(_0x4298('0x4'));var db=require(_0x4298('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4298('0x6'));var config=require(_0x4298('0x7'));var jayson=require(_0x4298('0x8'));var client=jayson[_0x4298('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51fcf1,_0x1fba00,_0x2f5df0){return new BPromise(function(_0x5edb2e,_0x4ea8ec){return client[_0x4298('0xa')](_0x51fcf1,_0x2f5df0)[_0x4298('0xb')](function(_0x5e379f){logger[_0x4298('0xc')](_0x4298('0xd'),_0x1fba00,_0x4298('0xe'));logger[_0x4298('0xf')](_0x4298('0x10'),_0x1fba00,'request\x20sent',JSON[_0x4298('0x11')](_0x5e379f));if(_0x5e379f[_0x4298('0x12')]){if(_0x5e379f[_0x4298('0x12')][_0x4298('0x13')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1fba00,_0x5e379f[_0x4298('0x12')][_0x4298('0x14')]);return _0x4ea8ec(_0x5e379f[_0x4298('0x12')][_0x4298('0x14')]);}logger[_0x4298('0x12')](_0x4298('0xd'),_0x1fba00,_0x5e379f[_0x4298('0x12')]['message']);return _0x5edb2e(_0x5e379f['error'][_0x4298('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1fba00,_0x4298('0xe'));_0x5edb2e(_0x5e379f['result'][_0x4298('0x14')]);}})[_0x4298('0x15')](function(_0x174eeb){logger[_0x4298('0x12')](_0x4298('0xd'),_0x1fba00,_0x174eeb);_0x4ea8ec(_0x174eeb);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b66c50b..812b375 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','show','post','isAuthenticated','put','/:id','update','delete'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x8ef6,0xf2));var _0x68ef=function(_0x56c585,_0x45c4f1){_0x56c585=_0x56c585-0x0;var _0xc8da37=_0x8ef6[_0x56c585];return _0xc8da37;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x68ef('0xb')]);router[_0x68ef('0xc')]('/',auth[_0x68ef('0xd')](),controller['create']);router[_0x68ef('0xe')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file +var _0x3eea=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','update','isAuthenticated','destroy','multer'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xc7abef,_0x879cf2){_0xc7abef=_0xc7abef-0x0;var _0x5bace7=_0x3eea[_0xc7abef];return _0x5bace7;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xb'),auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router['delete'](_0xa3ee('0xb'),auth[_0xa3ee('0xf')](),controller[_0xa3ee('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2d3f843..42e60eb 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 _0xa877=['STRING','name','rrmemory','beepall','roundrobin','exports'];(function(_0x140e85,_0x5834c5){var _0xd7b268=function(_0x3edca4){while(--_0x3edca4){_0x140e85['push'](_0x140e85['shift']());}};_0xd7b268(++_0x5834c5);}(_0xa877,0x173));var _0x7a87=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa877[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7a87('0x0')]={'name':{'type':Sequelize[_0x7a87('0x1')],'unique':_0x7a87('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a87('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7a87('0x3'),_0x7a87('0x4'),_0x7a87('0x5'))}}; \ No newline at end of file +var _0x1fb3=['name','exports','STRING'];(function(_0x3afaae,_0x1ee943){var _0x21c7cc=function(_0x4f545d){while(--_0x4f545d){_0x3afaae['push'](_0x3afaae['shift']());}};_0x21c7cc(++_0x1ee943);}(_0x1fb3,0x160));var _0x31fb=function(_0x5a306a,_0x3bdfdf){_0x5a306a=_0x5a306a-0x0;var _0x5ec858=_0x1fb3[_0x5a306a];return _0x5ec858;};'use strict';var Sequelize=require('sequelize');module[_0x31fb('0x0')]={'name':{'type':Sequelize[_0x31fb('0x1')],'unique':_0x31fb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x31fb('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c96b790..b1e2c02 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 _0xf3b5=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','ChatQueues','UserProfileResource','destroy','stack','name','index','map','ChatQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','body','params','describe','getMembers','UserChatQueue','ChatQueueId','filter','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','chatPause','updatedAt','findOne','Team','getTeams','ids','Agents','online','voicePause','interface','transaction','addTeams','each','findOrCreate','forEach','userChatQueue:save','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','all','union','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5944cf,_0x1d517e){var _0x8d3adf=function(_0x3da283){while(--_0x3da283){_0x5944cf['push'](_0x5944cf['shift']());}};_0x8d3adf(++_0x1d517e);}(_0xf3b5,0x8c));var _0x5f3b=function(_0x2ed30c,_0x276d01){_0x2ed30c=_0x2ed30c-0x0;var _0x56e1a7=_0xf3b5[_0x2ed30c];return _0x56e1a7;};'use strict';var emlformat=require(_0x5f3b('0x0'));var rimraf=require(_0x5f3b('0x1'));var zipdir=require(_0x5f3b('0x2'));var jsonpatch=require(_0x5f3b('0x3'));var rp=require(_0x5f3b('0x4'));var moment=require('moment');var BPromise=require(_0x5f3b('0x5'));var Mustache=require(_0x5f3b('0x6'));var util=require(_0x5f3b('0x7'));var path=require('path');var sox=require(_0x5f3b('0x8'));var csv=require(_0x5f3b('0x9'));var ejs=require(_0x5f3b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f3b('0xb'));var squel=require(_0x5f3b('0xc'));var crypto=require(_0x5f3b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f3b('0xe'));var toCsv=require(_0x5f3b('0x9'));var querystring=require(_0x5f3b('0xf'));var Papa=require(_0x5f3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f3b('0x11'));var as=require(_0x5f3b('0x12'));var hardwareService=require(_0x5f3b('0x13'));var logger=require('../../config/logger')(_0x5f3b('0x14'));var utils=require(_0x5f3b('0x15'));var config=require(_0x5f3b('0x16'));var licenseUtil=require(_0x5f3b('0x17'));var db=require(_0x5f3b('0x18'))['db'];config['redis']=_[_0x5f3b('0x19')](config[_0x5f3b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f3b('0x1b'))(new Redis(config['redis']));require(_0x5f3b('0x1c'))[_0x5f3b('0x1d')](socket);var jayson=require(_0x5f3b('0x1e'));var client=jayson[_0x5f3b('0x1f')][_0x5f3b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x18fbf8,_0x377c6b,_0x42f30a,_0x46bfaf){return new BPromise(function(_0x32e476,_0x2210ae){var _0x49c098=_0x46bfaf||client;return _0x49c098['request'](_0x18fbf8,_0x42f30a)['then'](function(_0x58afde){logger[_0x5f3b('0x21')](_0x5f3b('0x22'),_0x377c6b,_0x5f3b('0x23'));logger[_0x5f3b('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x377c6b,_0x5f3b('0x23'),JSON['stringify'](_0x58afde));if(_0x58afde[_0x5f3b('0x25')]){if(_0x58afde['error'][_0x5f3b('0x26')]===0x1f4){logger[_0x5f3b('0x25')](_0x5f3b('0x22'),_0x377c6b,_0x58afde[_0x5f3b('0x25')][_0x5f3b('0x27')]);return _0x2210ae(_0x58afde['error'][_0x5f3b('0x27')]);}logger[_0x5f3b('0x25')](_0x5f3b('0x22'),_0x377c6b,_0x58afde[_0x5f3b('0x25')]['message']);return _0x32e476(_0x58afde[_0x5f3b('0x25')]['message']);}else{logger[_0x5f3b('0x21')](_0x5f3b('0x22'),_0x377c6b,'request\x20sent');_0x32e476(_0x58afde[_0x5f3b('0x28')][_0x5f3b('0x27')]);}})[_0x5f3b('0x29')](function(_0x58115d){logger['error'](_0x5f3b('0x22'),_0x377c6b,_0x58115d);_0x2210ae(_0x58115d);});});}function respondWithStatusCode(_0x2dc51f,_0x2a1ec5){_0x2a1ec5=_0x2a1ec5||0xcc;return function(_0xcf5156){if(_0xcf5156){return _0x2dc51f[_0x5f3b('0x2a')](_0x2a1ec5);}return _0x2dc51f[_0x5f3b('0x2b')](_0x2a1ec5)[_0x5f3b('0x2c')]();};}function respondWithResult(_0x4095c9,_0x2687f0){_0x2687f0=_0x2687f0||0xc8;return function(_0x5e7a8f){if(_0x5e7a8f){return _0x4095c9[_0x5f3b('0x2b')](_0x2687f0)['json'](_0x5e7a8f);}};}function respondWithFilteredResult(_0x44f43e,_0x191ffc){return function(_0x2df70c){if(_0x2df70c){var _0x17d11=typeof _0x191ffc[_0x5f3b('0x2d')]===_0x5f3b('0x2e')&&typeof _0x191ffc[_0x5f3b('0x2f')]===_0x5f3b('0x2e');var _0x32398b=_0x2df70c[_0x5f3b('0x30')];var _0x54b435=_0x17d11?0x0:_0x191ffc['offset'];var _0x59371f=_0x17d11?_0x2df70c[_0x5f3b('0x30')]:_0x191ffc[_0x5f3b('0x2d')]+_0x191ffc['limit'];var _0x19683c;if(_0x59371f>=_0x32398b){_0x59371f=_0x32398b;_0x19683c=0xc8;}else{_0x19683c=0xce;}_0x44f43e[_0x5f3b('0x2b')](_0x19683c);return _0x44f43e[_0x5f3b('0x31')]('Content-Range',_0x54b435+'-'+_0x59371f+'/'+_0x32398b)[_0x5f3b('0x32')](_0x2df70c);}return null;};}function patchUpdates(_0xd396e9){return function(_0x59e91b){try{jsonpatch[_0x5f3b('0x33')](_0x59e91b,_0xd396e9,!![]);}catch(_0x548852){return BPromise[_0x5f3b('0x34')](_0x548852);}return _0x59e91b[_0x5f3b('0x35')]();};}function saveUpdates(_0xa5d854,_0x10cd1d){return function(_0xa7b254){if(_0xa7b254){return _0xa7b254['update'](_0xa5d854)[_0x5f3b('0x36')](function(_0x4651be){return _0x4651be;});}return null;};}function removeEntity(_0x60ab9,_0x4fa3e5){return function(_0x1f5b24){if(_0x1f5b24){return _0x1f5b24['destroy']()[_0x5f3b('0x36')](function(){var _0x2775bc=_0x1f5b24[_0x5f3b('0x37')]({'plain':!![]});var _0x58ce92=_0x5f3b('0x38');return db[_0x5f3b('0x39')][_0x5f3b('0x3a')]({'where':{'type':_0x58ce92,'resourceId':_0x2775bc['id']}})[_0x5f3b('0x36')](function(){return _0x1f5b24;});})[_0x5f3b('0x36')](function(){_0x60ab9[_0x5f3b('0x2b')](0xcc)[_0x5f3b('0x2c')]();});}};}function handleEntityNotFound(_0x2b7fe7,_0x529884){return function(_0x5960ba){if(!_0x5960ba){_0x2b7fe7[_0x5f3b('0x2a')](0x194);}return _0x5960ba;};}function handleError(_0x3a5476,_0x39c776){_0x39c776=_0x39c776||0x1f4;return function(_0x442c7b){logger['error'](_0x442c7b[_0x5f3b('0x3b')]);if(_0x442c7b[_0x5f3b('0x3c')]){delete _0x442c7b[_0x5f3b('0x3c')];}_0x3a5476[_0x5f3b('0x2b')](_0x39c776)['send'](_0x442c7b);};}exports[_0x5f3b('0x3d')]=function(_0x5c8fb6,_0x24a082){var _0x29dc3a={},_0x3ac574={},_0x1624d5={'count':0x0,'rows':[]};var _0x595d3c=_[_0x5f3b('0x3e')](db[_0x5f3b('0x3f')][_0x5f3b('0x40')],function(_0x2219e1){return{'name':_0x2219e1['fieldName'],'type':_0x2219e1[_0x5f3b('0x41')][_0x5f3b('0x42')]};});_0x3ac574[_0x5f3b('0x43')]=_['map'](_0x595d3c,_0x5f3b('0x3c'));_0x3ac574[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x5c8fb6[_0x5f3b('0x44')]);_0x3ac574[_0x5f3b('0x46')]=_[_0x5f3b('0x47')](_0x3ac574[_0x5f3b('0x43')],_0x3ac574[_0x5f3b('0x44')]);_0x29dc3a[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x3ac574[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x29dc3a[_0x5f3b('0x48')]=_0x29dc3a[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x29dc3a[_0x5f3b('0x48')]:_0x3ac574[_0x5f3b('0x43')];if(!_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x29dc3a[_0x5f3b('0x2f')]=qs['limit'](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x29dc3a['offset']=qs[_0x5f3b('0x2d')](_0x5c8fb6['query'][_0x5f3b('0x2d')]);}_0x29dc3a[_0x5f3b('0x4d')]=qs[_0x5f3b('0x4e')](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x29dc3a[_0x5f3b('0x4f')]=qs[_0x5f3b('0x46')](_[_0x5f3b('0x50')](_0x5c8fb6[_0x5f3b('0x44')],_0x3ac574['filters']),_0x595d3c);if(_0x5c8fb6['query']['filter']){_0x29dc3a[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x29dc3a[_0x5f3b('0x4f')],{'$or':_[_0x5f3b('0x3e')](_0x595d3c,function(_0x11908c){if(_0x11908c[_0x5f3b('0x41')]!==_0x5f3b('0x52')){var _0x5345d3={};_0x5345d3[_0x11908c[_0x5f3b('0x3c')]]={'$like':'%'+_0x5c8fb6['query']['filter']+'%'};return _0x5345d3;}})});}_0x29dc3a=_[_0x5f3b('0x51')]({},_0x29dc3a,_0x5c8fb6[_0x5f3b('0x53')]);var _0x383eab={'where':_0x29dc3a[_0x5f3b('0x4f')]};return db[_0x5f3b('0x3f')][_0x5f3b('0x30')](_0x383eab)[_0x5f3b('0x36')](function(_0x13ecda){_0x1624d5[_0x5f3b('0x30')]=_0x13ecda;if(_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x54')]){_0x29dc3a['include']=[{'all':!![]}];}return db[_0x5f3b('0x3f')][_0x5f3b('0x55')](_0x29dc3a);})[_0x5f3b('0x36')](function(_0x46991c){_0x1624d5[_0x5f3b('0x56')]=_0x46991c;return _0x1624d5;})['then'](respondWithFilteredResult(_0x24a082,_0x29dc3a))[_0x5f3b('0x29')](handleError(_0x24a082,null));};exports['show']=function(_0x44ba6c,_0x1a3fa4){var _0x5235fa={'raw':!![],'where':{'id':_0x44ba6c['params']['id']}},_0x572e4a={};_0x572e4a[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db['ChatQueue']['rawAttributes']);_0x572e4a[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x44ba6c['query']);_0x572e4a['filters']=_[_0x5f3b('0x47')](_0x572e4a[_0x5f3b('0x43')],_0x572e4a['query']);_0x5235fa[_0x5f3b('0x48')]=_['intersection'](_0x572e4a['model'],qs[_0x5f3b('0x49')](_0x44ba6c['query']['fields']));_0x5235fa[_0x5f3b('0x48')]=_0x5235fa[_0x5f3b('0x48')]['length']?_0x5235fa['attributes']:_0x572e4a['model'];if(_0x44ba6c['query'][_0x5f3b('0x54')]){_0x5235fa[_0x5f3b('0x57')]=[{'all':!![]}];}_0x5235fa=_[_0x5f3b('0x51')]({},_0x5235fa,_0x44ba6c['options']);return db[_0x5f3b('0x3f')][_0x5f3b('0x58')](_0x5235fa)[_0x5f3b('0x36')](handleEntityNotFound(_0x1a3fa4,null))[_0x5f3b('0x36')](respondWithResult(_0x1a3fa4,null))['catch'](handleError(_0x1a3fa4,null));};exports[_0x5f3b('0x59')]=function(_0x432efe,_0x20f6dd){return db[_0x5f3b('0x3f')][_0x5f3b('0x59')](_0x432efe['body'],{})[_0x5f3b('0x36')](function(_0x161170){var _0x3db253=_0x432efe[_0x5f3b('0x5a')]['get']({'plain':!![]});if(!_0x3db253)throw new Error(_0x5f3b('0x5b'));if(_0x3db253[_0x5f3b('0x5c')]===_0x5f3b('0x5a')){var _0x28dfd4=_0x161170[_0x5f3b('0x37')]({'plain':!![]});var _0x53264e=_0x5f3b('0x38');return db[_0x5f3b('0x5d')]['find']({'where':{'name':_0x53264e,'userProfileId':_0x3db253[_0x5f3b('0x5e')]},'raw':!![]})[_0x5f3b('0x36')](function(_0x1005bc){if(_0x1005bc&&_0x1005bc['autoAssociation']===0x0){return db[_0x5f3b('0x39')]['create']({'name':_0x28dfd4[_0x5f3b('0x3c')],'resourceId':_0x28dfd4['id'],'type':_0x1005bc[_0x5f3b('0x3c')],'sectionId':_0x1005bc['id']},{})[_0x5f3b('0x36')](function(){return _0x161170;});}else{return _0x161170;}})[_0x5f3b('0x29')](function(_0x24929b){logger[_0x5f3b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24929b);throw _0x24929b;});}return _0x161170;})[_0x5f3b('0x36')](respondWithResult(_0x20f6dd,0xc9))[_0x5f3b('0x29')](handleError(_0x20f6dd,null));};exports[_0x5f3b('0x5f')]=function(_0xd4b0cd,_0x2188cd){if(_0xd4b0cd[_0x5f3b('0x60')]['id']){delete _0xd4b0cd[_0x5f3b('0x60')]['id'];}return db[_0x5f3b('0x3f')]['find']({'where':{'id':_0xd4b0cd[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x2188cd,null))[_0x5f3b('0x36')](saveUpdates(_0xd4b0cd[_0x5f3b('0x60')],null))[_0x5f3b('0x36')](respondWithResult(_0x2188cd,null))['catch'](handleError(_0x2188cd,null));};exports[_0x5f3b('0x3a')]=function(_0x52b0bd,_0x47ae05){return db[_0x5f3b('0x3f')]['find']({'where':{'id':_0x52b0bd['params']['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x47ae05,null))[_0x5f3b('0x36')](removeEntity(_0x47ae05,null))[_0x5f3b('0x29')](handleError(_0x47ae05,null));};exports[_0x5f3b('0x62')]=function(_0x3dfb32,_0x19a383){return db['ChatQueue'][_0x5f3b('0x62')]()['then'](respondWithResult(_0x19a383,null))[_0x5f3b('0x29')](handleError(_0x19a383,null));};exports[_0x5f3b('0x63')]=function(_0x12de5f,_0x522cf9,_0x3d1d6f){var _0x429268={'raw':!![],'where':{}},_0x26f11a={},_0x3a96c0;return db['ChatQueue']['findOne']({'where':{'id':_0x12de5f[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x522cf9,null))[_0x5f3b('0x36')](function(_0x229f41){if(_0x229f41){_0x3a96c0=_0x229f41[_0x5f3b('0x37')]({'plain':!![]});_0x26f11a[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x64')]['rawAttributes']);_0x26f11a[_0x5f3b('0x44')]=_['keys'](_0x12de5f[_0x5f3b('0x44')]);_0x26f11a[_0x5f3b('0x46')]=_['intersection'](_0x26f11a[_0x5f3b('0x43')],_0x26f11a[_0x5f3b('0x44')]);_0x429268[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x26f11a[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x429268[_0x5f3b('0x48')]=_0x429268[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x429268['attributes']:_0x26f11a[_0x5f3b('0x43')];if(!_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x429268[_0x5f3b('0x2f')]=qs['limit'](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x429268[_0x5f3b('0x2d')]=qs['offset'](_0x12de5f[_0x5f3b('0x44')]['offset']);}_0x429268[_0x5f3b('0x4d')]=qs['sort'](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x429268[_0x5f3b('0x4f')]=qs['filters'](_['pick'](_0x12de5f[_0x5f3b('0x44')],_0x26f11a[_0x5f3b('0x46')]));_0x429268[_0x5f3b('0x4f')][_0x5f3b('0x65')]=_0x229f41['id'];if(_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x66')]){_0x429268[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x429268[_0x5f3b('0x4f')],{'$or':_[_0x5f3b('0x3e')](_0x429268[_0x5f3b('0x48')],function(_0x36c926){var _0x4746ad={};_0x4746ad[_0x36c926]={'$like':'%'+_0x12de5f['query'][_0x5f3b('0x66')]+'%'};return _0x4746ad;})});}_0x429268=_[_0x5f3b('0x51')]({},_0x429268,_0x12de5f[_0x5f3b('0x53')]);return db[_0x5f3b('0x64')][_0x5f3b('0x55')](_0x429268);}})[_0x5f3b('0x36')](function(_0x3f81ba){if(_0x3f81ba){return db[_0x5f3b('0x67')][_0x5f3b('0x68')]({'where':{'id':_[_0x5f3b('0x3e')](_0x3f81ba,_0x5f3b('0x69')),'role':_0x5f3b('0x6a')},'attributes':['id',_0x5f3b('0x3c'),'chatPause','updatedAt',_0x5f3b('0x6b')]});}})[_0x5f3b('0x36')](function(_0x339044){if(_0x339044){return{'count':_0x339044[_0x5f3b('0x30')],'rows':_[_0x5f3b('0x3e')](_0x339044['rows'],function(_0x564b78){return{'membername':_0x564b78[_0x5f3b('0x3c')],'UserId':_0x564b78['id'],'queue_name':_0x3a96c0[_0x5f3b('0x3c')],'ChatQueueId':_0x3a96c0['id'],'interface':util[_0x5f3b('0x6c')](_0x5f3b('0x6d'),'SIP',_0x564b78['name']),'penalty':0x0,'paused':_0x564b78[_0x5f3b('0x6e')],'createdAt':_0x564b78[_0x5f3b('0x6b')],'updatedAt':_0x564b78[_0x5f3b('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x522cf9,_0x429268))[_0x5f3b('0x29')](handleError(_0x522cf9,null));};exports['getTeams']=function(_0x2c7853,_0x4ce638,_0x2f189f){var _0x5d2012={};var _0x413ab1={};var _0x49b254;var _0x401548;return db[_0x5f3b('0x3f')][_0x5f3b('0x70')]({'where':{'id':_0x2c7853[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x4ce638,null))['then'](function(_0x31098a){if(_0x31098a){_0x49b254=_0x31098a;_0x413ab1[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x71')]['rawAttributes']);_0x413ab1[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x2c7853[_0x5f3b('0x44')]);_0x413ab1['filters']=_[_0x5f3b('0x47')](_0x413ab1['model'],_0x413ab1[_0x5f3b('0x44')]);_0x5d2012['attributes']=_[_0x5f3b('0x47')](_0x413ab1[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x2c7853['query'][_0x5f3b('0x49')]));_0x5d2012[_0x5f3b('0x48')]=_0x5d2012['attributes'][_0x5f3b('0x4a')]?_0x5d2012[_0x5f3b('0x48')]:_0x413ab1[_0x5f3b('0x43')];_0x5d2012['order']=qs['sort'](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x5d2012[_0x5f3b('0x4f')]=qs[_0x5f3b('0x46')](_[_0x5f3b('0x50')](_0x2c7853[_0x5f3b('0x44')],_0x413ab1['filters']));if(_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x66')]){_0x5d2012[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x5d2012['where'],{'$or':_[_0x5f3b('0x3e')](_0x5d2012[_0x5f3b('0x48')],function(_0x28a6a5){var _0xc5eea9={};_0xc5eea9[_0x28a6a5]={'$like':'%'+_0x2c7853[_0x5f3b('0x44')]['filter']+'%'};return _0xc5eea9;})});}_0x5d2012=_['merge']({},_0x5d2012,_0x2c7853[_0x5f3b('0x53')]);return _0x49b254[_0x5f3b('0x72')](_0x5d2012);}})['then'](function(_0x28de5d){if(_0x28de5d){_0x401548=_0x28de5d['length'];if(!_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x5d2012['limit']=qs[_0x5f3b('0x2f')](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x5d2012[_0x5f3b('0x2d')]=qs['offset'](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x2d')]);}return _0x49b254[_0x5f3b('0x72')](_0x5d2012);}})['then'](function(_0xfa476a){if(_0xfa476a){return _0xfa476a?{'count':_0x401548,'rows':_0xfa476a}:null;}})[_0x5f3b('0x36')](respondWithResult(_0x4ce638,null))[_0x5f3b('0x29')](handleError(_0x4ce638,null));};exports['addTeams']=function(_0x5733cb,_0x1a385c,_0x409935){var _0x1109ff=_0x5733cb[_0x5f3b('0x60')][_0x5f3b('0x73')];return db[_0x5f3b('0x71')][_0x5f3b('0x55')]({'where':{'id':_0x1109ff},'attributes':['id'],'include':[{'model':db[_0x5f3b('0x67')],'as':_0x5f3b('0x74'),'attributes':['id',_0x5f3b('0x3c'),_0x5f3b('0x75'),_0x5f3b('0x76'),_0x5f3b('0x77')],'raw':!![]}]})[_0x5f3b('0x36')](function(_0x3e6d17){if(_0x3e6d17){var _0x1d96e9=_['flatMap'](_0x3e6d17,function(_0x2a38af){var _0x9bc018=_0x2a38af['get']({'plain':!![]});return _0x9bc018[_0x5f3b('0x74')];});return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x5733cb[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](function(_0x1312d2){return db['sequelize'][_0x5f3b('0x78')](function(_0x490a09){return _0x1312d2[_0x5f3b('0x79')](_0x1109ff,{'transaction':_0x490a09})[_0x5f3b('0x36')](function(){return BPromise[_0x5f3b('0x7a')](_0x1d96e9,function(_0x581921){return db[_0x5f3b('0x64')][_0x5f3b('0x7b')]({'where':{'UserId':_0x581921['id'],'ChatQueueId':_0x5733cb[_0x5f3b('0x61')]['id']},'transaction':_0x490a09});});})['then'](function(){_0x1d96e9[_0x5f3b('0x7c')](function(_0x53d6ca){socket['emit'](_0x5f3b('0x7d'),{'UserId':_0x53d6ca['id'],'ChatQueueId':_0x1312d2['id']});});});});});}})[_0x5f3b('0x36')](respondWithStatusCode(_0x1a385c,null))['catch'](handleError(_0x1a385c,null));};exports['removeTeams']=function(_0x1492a9,_0x3df5a0,_0x1d4016){return db[_0x5f3b('0x71')][_0x5f3b('0x55')]({'where':{'id':_0x1492a9[_0x5f3b('0x44')][_0x5f3b('0x73')]},'attributes':['id'],'include':[{'model':db[_0x5f3b('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5f3b('0x36')](handleEntityNotFound(_0x3df5a0,null))[_0x5f3b('0x36')](function(_0x5e264d){var _0x107412=_[_0x5f3b('0x3e')](_0x5e264d,'id');var _0x2aed6c=[];var _0xd8ca73=[];var _0x325dad=squel[_0x5f3b('0x7e')]();_0x325dad[_0x5f3b('0x7f')]('tq.TeamId')[_0x5f3b('0x80')]('team_has_chat_queues','tq')[_0x5f3b('0x81')]('user_has_teams','ut',_0x5f3b('0x82'))[_0x5f3b('0x4f')](_0x5f3b('0x83'),_0x1492a9[_0x5f3b('0x61')]['id']);for(var _0x2c66bf=0x0;_0x2c66bf<_0x5e264d[_0x5f3b('0x4a')];_0x2c66bf+=0x1){let _0x5e764d=_0x5e264d[_0x2c66bf];for(var _0x1d6032=0x0;_0x1d6032<_0x5e764d[_0x5f3b('0x74')][_0x5f3b('0x4a')];_0x1d6032+=0x1){let _0x3bd81a=_0x5e764d[_0x5f3b('0x74')][_0x1d6032];var _0x223988=_0x325dad[_0x5f3b('0x84')]();_0x223988[_0x5f3b('0x4f')]('ut.UserId\x20=\x20?',_0x3bd81a['id']);_0xd8ca73[_0x5f3b('0x85')](db[_0x5f3b('0x86')][_0x5f3b('0x44')](_0x223988[_0x5f3b('0x87')](),{'type':db[_0x5f3b('0x86')]['QueryTypes']['SELECT']})[_0x5f3b('0x36')](function(_0x41150b){if(_0x41150b[_0x5f3b('0x4a')]===0x1){return _0x3bd81a['id'];}else{var _0x3d8754=_[_0x5f3b('0x88')](_[_0x5f3b('0x3e')](_0x41150b,_0x5f3b('0x89')),function(_0x167f7f){return _[_0x5f3b('0x8a')](_0x107412,_0x167f7f);});if(_0x3d8754){return _0x3bd81a['id'];}}}));}}return BPromise[_0x5f3b('0x8b')](_0xd8ca73)[_0x5f3b('0x36')](function(_0xc4573e){_0x2aed6c=_(_0x2aed6c)[_0x5f3b('0x8c')](_0xc4573e)['compact']()['value']();return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x1492a9[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](function(_0xa0baf7){return db[_0x5f3b('0x86')][_0x5f3b('0x78')](function(_0x2ed6ac){return _0xa0baf7[_0x5f3b('0x8d')](_0x1492a9[_0x5f3b('0x44')]['ids'],{'transaction':_0x2ed6ac})[_0x5f3b('0x36')](function(){if(!_[_0x5f3b('0x8e')](_0x2aed6c)){return _0xa0baf7[_0x5f3b('0x8f')](_0x2aed6c,{'transaction':_0x2ed6ac});}})[_0x5f3b('0x36')](function(){_0x2aed6c[_0x5f3b('0x7c')](function(_0x274367){socket['emit'](_0x5f3b('0x90'),{'UserId':_0x274367,'ChatQueueId':_0xa0baf7['id']});});});});});});})['then'](respondWithStatusCode(_0x3df5a0,null))[_0x5f3b('0x29')](handleError(_0x3df5a0,null));};exports['addAgents']=function(_0x21cbe2,_0x497747,_0x3617dd){return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x21cbe2[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x497747,null))['then'](function(_0x89b0c3){if(_0x89b0c3){return _0x89b0c3[_0x5f3b('0x91')](_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')],_[_0x5f3b('0x92')](_0x21cbe2['body'],[_0x5f3b('0x73'),'id'])||{})[_0x5f3b('0x93')](function(_0x65c590){for(var _0x57a9c2=0x0;_0x57a9c2<_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')][_0x5f3b('0x4a')];_0x57a9c2+=0x1){socket[_0x5f3b('0x94')]('userChatQueue:save',{'UserId':Number(_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')][_0x57a9c2]),'ChatQueueId':Number(_0x21cbe2['params']['id'])});}return _0x65c590;});}})[_0x5f3b('0x36')](respondWithResult(_0x497747,null))[_0x5f3b('0x29')](handleError(_0x497747,null));};exports[_0x5f3b('0x8f')]=function(_0x44b995,_0x129ebd,_0x170a54){return db['ChatQueue'][_0x5f3b('0x58')]({'where':{'id':_0x44b995[_0x5f3b('0x61')]['id']}})['then'](handleEntityNotFound(_0x129ebd,null))[_0x5f3b('0x36')](function(_0x43f89a){if(_0x43f89a){return _0x43f89a[_0x5f3b('0x8f')](_0x44b995[_0x5f3b('0x44')]['ids'])[_0x5f3b('0x36')](function(){if(_[_0x5f3b('0x95')](_0x44b995[_0x5f3b('0x44')][_0x5f3b('0x73')])){for(var _0x142e4b=0x0;_0x142e4b<_0x44b995['query'][_0x5f3b('0x73')][_0x5f3b('0x4a')];_0x142e4b+=0x1){socket[_0x5f3b('0x94')]('userChatQueue:remove',{'UserId':Number(_0x44b995[_0x5f3b('0x44')][_0x5f3b('0x73')][_0x142e4b]),'ChatQueueId':Number(_0x44b995[_0x5f3b('0x61')]['id'])});}}else{socket[_0x5f3b('0x94')]('userChatQueue:remove',{'UserId':Number(_0x44b995['query'][_0x5f3b('0x73')]),'ChatQueueId':Number(_0x44b995[_0x5f3b('0x61')]['id'])});}});}})[_0x5f3b('0x36')](respondWithStatusCode(_0x129ebd,null))[_0x5f3b('0x29')](handleError(_0x129ebd,null));};exports[_0x5f3b('0x96')]=function(_0x264736,_0x43c0cf,_0xf96ffa){var _0x6a3071={};var _0x4df555={};var _0x3bc28a;var _0x5c46c7;return db[_0x5f3b('0x3f')][_0x5f3b('0x70')]({'where':{'id':_0x264736[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x43c0cf,null))[_0x5f3b('0x36')](function(_0x51defa){if(_0x51defa){_0x3bc28a=_0x51defa;_0x4df555[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x67')][_0x5f3b('0x40')]);_0x4df555['query']=_['keys'](_0x264736[_0x5f3b('0x44')]);_0x4df555[_0x5f3b('0x46')]=_[_0x5f3b('0x47')](_0x4df555[_0x5f3b('0x43')],_0x4df555[_0x5f3b('0x44')]);_0x6a3071[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x4df555['model'],qs[_0x5f3b('0x49')](_0x264736[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x6a3071[_0x5f3b('0x48')]=_0x6a3071[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x6a3071[_0x5f3b('0x48')]:_0x4df555[_0x5f3b('0x43')];_0x6a3071[_0x5f3b('0x4d')]=qs[_0x5f3b('0x4e')](_0x264736['query'][_0x5f3b('0x4e')]);_0x6a3071[_0x5f3b('0x4f')]=qs['filters'](_[_0x5f3b('0x50')](_0x264736[_0x5f3b('0x44')],_0x4df555[_0x5f3b('0x46')]));if(_0x264736['query']['filter']){_0x6a3071[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x6a3071['where'],{'$or':_[_0x5f3b('0x3e')](_0x6a3071[_0x5f3b('0x48')],function(_0x522ace){var _0x28d711={};_0x28d711[_0x522ace]={'$like':'%'+_0x264736[_0x5f3b('0x44')][_0x5f3b('0x66')]+'%'};return _0x28d711;})});}_0x6a3071=_['merge']({},_0x6a3071,_0x264736[_0x5f3b('0x53')]);return _0x3bc28a['getAgents'](_0x6a3071);}})['then'](function(_0x2aad13){if(_0x2aad13){_0x5c46c7=_0x2aad13['length'];if(!_0x264736[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x6a3071[_0x5f3b('0x2f')]=qs[_0x5f3b('0x2f')](_0x264736[_0x5f3b('0x44')]['limit']);_0x6a3071[_0x5f3b('0x2d')]=qs[_0x5f3b('0x2d')](_0x264736[_0x5f3b('0x44')][_0x5f3b('0x2d')]);}return _0x3bc28a[_0x5f3b('0x96')](_0x6a3071);}})[_0x5f3b('0x36')](function(_0x4c31fb){if(_0x4c31fb){return _0x4c31fb?{'count':_0x5c46c7,'rows':_0x4c31fb}:null;}})[_0x5f3b('0x36')](respondWithResult(_0x43c0cf,null))[_0x5f3b('0x29')](handleError(_0x43c0cf,null));}; \ No newline at end of file +var _0xaae9=['update','destroy','get','stack','name','send','index','map','fieldName','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','type','VIRTUAL','ChatQueue','include','findAll','rows','catch','show','params','rawAttributes','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','pick','ChatQueueId','filter','UserChatQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','chatPause','getTeams','Team','order','addTeams','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xaae9,0x18e));var _0x9aae=function(_0x8624a2,_0x405fa1){_0x8624a2=_0x8624a2-0x0;var _0x3d94ae=_0xaae9[_0x8624a2];return _0x3d94ae;};'use strict';var emlformat=require(_0x9aae('0x0'));var rimraf=require(_0x9aae('0x1'));var zipdir=require(_0x9aae('0x2'));var jsonpatch=require(_0x9aae('0x3'));var rp=require(_0x9aae('0x4'));var moment=require(_0x9aae('0x5'));var BPromise=require(_0x9aae('0x6'));var Mustache=require(_0x9aae('0x7'));var util=require(_0x9aae('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9aae('0x9'));var fs=require('fs');var fs_extra=require(_0x9aae('0xa'));var _=require(_0x9aae('0xb'));var squel=require(_0x9aae('0xc'));var crypto=require(_0x9aae('0xd'));var jsforce=require(_0x9aae('0xe'));var deskjs=require(_0x9aae('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9aae('0x10'));var Papa=require(_0x9aae('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9aae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9aae('0x13'));var logger=require('../../config/logger')(_0x9aae('0x14'));var utils=require(_0x9aae('0x15'));var config=require(_0x9aae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9aae('0x17'))['db'];config[_0x9aae('0x18')]=_[_0x9aae('0x19')](config[_0x9aae('0x18')],{'host':_0x9aae('0x1a'),'port':0x18eb});var socket=require(_0x9aae('0x1b'))(new Redis(config['redis']));require(_0x9aae('0x1c'))[_0x9aae('0x1d')](socket);var jayson=require(_0x9aae('0x1e'));var client=jayson[_0x9aae('0x1f')][_0x9aae('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1165af,_0x256401,_0x166fc7,_0x53e784){return new BPromise(function(_0x3b3557,_0x1dca12){var _0x1ad285=_0x53e784||client;return _0x1ad285[_0x9aae('0x21')](_0x1165af,_0x166fc7)[_0x9aae('0x22')](function(_0x3268c5){logger[_0x9aae('0x23')]('ChatQueue,\x20%s,\x20%s',_0x256401,'request\x20sent');logger[_0x9aae('0x24')](_0x9aae('0x25'),_0x256401,_0x9aae('0x26'),JSON[_0x9aae('0x27')](_0x3268c5));if(_0x3268c5[_0x9aae('0x28')]){if(_0x3268c5['error']['code']===0x1f4){logger['error'](_0x9aae('0x29'),_0x256401,_0x3268c5[_0x9aae('0x28')][_0x9aae('0x2a')]);return _0x1dca12(_0x3268c5['error'][_0x9aae('0x2a')]);}logger[_0x9aae('0x28')]('ChatQueue,\x20%s,\x20%s',_0x256401,_0x3268c5['error'][_0x9aae('0x2a')]);return _0x3b3557(_0x3268c5[_0x9aae('0x28')][_0x9aae('0x2a')]);}else{logger['info'](_0x9aae('0x29'),_0x256401,'request\x20sent');_0x3b3557(_0x3268c5[_0x9aae('0x2b')]['message']);}})['catch'](function(_0x49d132){logger[_0x9aae('0x28')](_0x9aae('0x29'),_0x256401,_0x49d132);_0x1dca12(_0x49d132);});});}function respondWithStatusCode(_0x3db2fb,_0x2b9fa5){_0x2b9fa5=_0x2b9fa5||0xcc;return function(_0x331f15){if(_0x331f15){return _0x3db2fb[_0x9aae('0x2c')](_0x2b9fa5);}return _0x3db2fb[_0x9aae('0x2d')](_0x2b9fa5)['end']();};}function respondWithResult(_0x34130d,_0x34debe){_0x34debe=_0x34debe||0xc8;return function(_0x3da42e){if(_0x3da42e){return _0x34130d[_0x9aae('0x2d')](_0x34debe)[_0x9aae('0x2e')](_0x3da42e);}};}function respondWithFilteredResult(_0x14e865,_0x28588e){return function(_0x424f36){if(_0x424f36){var _0x146d01=typeof _0x28588e[_0x9aae('0x2f')]===_0x9aae('0x30')&&typeof _0x28588e[_0x9aae('0x31')]===_0x9aae('0x30');var _0x2558f1=_0x424f36[_0x9aae('0x32')];var _0x5c5d46=_0x146d01?0x0:_0x28588e[_0x9aae('0x2f')];var _0x50e9f4=_0x146d01?_0x424f36[_0x9aae('0x32')]:_0x28588e[_0x9aae('0x2f')]+_0x28588e['limit'];var _0x4a9ec6;if(_0x50e9f4>=_0x2558f1){_0x50e9f4=_0x2558f1;_0x4a9ec6=0xc8;}else{_0x4a9ec6=0xce;}_0x14e865['status'](_0x4a9ec6);return _0x14e865[_0x9aae('0x33')]('Content-Range',_0x5c5d46+'-'+_0x50e9f4+'/'+_0x2558f1)['json'](_0x424f36);}return null;};}function patchUpdates(_0x366de7){return function(_0x171bbe){try{jsonpatch[_0x9aae('0x34')](_0x171bbe,_0x366de7,!![]);}catch(_0x54327c){return BPromise[_0x9aae('0x35')](_0x54327c);}return _0x171bbe[_0x9aae('0x36')]();};}function saveUpdates(_0x401b49,_0x1df8b0){return function(_0x4842c6){if(_0x4842c6){return _0x4842c6[_0x9aae('0x37')](_0x401b49)[_0x9aae('0x22')](function(_0x23abe3){return _0x23abe3;});}return null;};}function removeEntity(_0x9178ab,_0x4dc0ff){return function(_0x864a6a){if(_0x864a6a){return _0x864a6a[_0x9aae('0x38')]()[_0x9aae('0x22')](function(){var _0x935150=_0x864a6a[_0x9aae('0x39')]({'plain':!![]});var _0x3b7e4f='ChatQueues';return db['UserProfileResource'][_0x9aae('0x38')]({'where':{'type':_0x3b7e4f,'resourceId':_0x935150['id']}})[_0x9aae('0x22')](function(){return _0x864a6a;});})[_0x9aae('0x22')](function(){_0x9178ab[_0x9aae('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aee01,_0x304998){return function(_0x2081f2){if(!_0x2081f2){_0x3aee01[_0x9aae('0x2c')](0x194);}return _0x2081f2;};}function handleError(_0x512f13,_0x4013a4){_0x4013a4=_0x4013a4||0x1f4;return function(_0x239a21){logger[_0x9aae('0x28')](_0x239a21[_0x9aae('0x3a')]);if(_0x239a21[_0x9aae('0x3b')]){delete _0x239a21[_0x9aae('0x3b')];}_0x512f13['status'](_0x4013a4)[_0x9aae('0x3c')](_0x239a21);};}exports[_0x9aae('0x3d')]=function(_0x183b3c,_0x413560){var _0x49589a={},_0x5acb2a={},_0x318950={'count':0x0,'rows':[]};var _0x4d4cd1=_[_0x9aae('0x3e')](db['ChatQueue']['rawAttributes'],function(_0x5ae0d4){return{'name':_0x5ae0d4[_0x9aae('0x3f')],'type':_0x5ae0d4['type']['key']};});_0x5acb2a[_0x9aae('0x40')]=_[_0x9aae('0x3e')](_0x4d4cd1,_0x9aae('0x3b'));_0x5acb2a[_0x9aae('0x41')]=_['keys'](_0x183b3c['query']);_0x5acb2a['filters']=_['intersection'](_0x5acb2a[_0x9aae('0x40')],_0x5acb2a[_0x9aae('0x41')]);_0x49589a['attributes']=_['intersection'](_0x5acb2a[_0x9aae('0x40')],qs[_0x9aae('0x42')](_0x183b3c['query'][_0x9aae('0x42')]));_0x49589a['attributes']=_0x49589a[_0x9aae('0x43')][_0x9aae('0x44')]?_0x49589a[_0x9aae('0x43')]:_0x5acb2a[_0x9aae('0x40')];if(!_0x183b3c['query'][_0x9aae('0x45')](_0x9aae('0x46'))){_0x49589a['limit']=qs[_0x9aae('0x31')](_0x183b3c['query'][_0x9aae('0x31')]);_0x49589a['offset']=qs[_0x9aae('0x2f')](_0x183b3c[_0x9aae('0x41')][_0x9aae('0x2f')]);}_0x49589a['order']=qs['sort'](_0x183b3c[_0x9aae('0x41')][_0x9aae('0x47')]);_0x49589a[_0x9aae('0x48')]=qs[_0x9aae('0x49')](_['pick'](_0x183b3c['query'],_0x5acb2a[_0x9aae('0x49')]),_0x4d4cd1);if(_0x183b3c[_0x9aae('0x41')]['filter']){_0x49589a[_0x9aae('0x48')]=_[_0x9aae('0x4a')](_0x49589a[_0x9aae('0x48')],{'$or':_[_0x9aae('0x3e')](_0x4d4cd1,function(_0x6a85e4){if(_0x6a85e4[_0x9aae('0x4b')]!==_0x9aae('0x4c')){var _0x11940d={};_0x11940d[_0x6a85e4[_0x9aae('0x3b')]]={'$like':'%'+_0x183b3c[_0x9aae('0x41')]['filter']+'%'};return _0x11940d;}})});}_0x49589a=_['merge']({},_0x49589a,_0x183b3c['options']);var _0x25dc60={'where':_0x49589a[_0x9aae('0x48')]};return db[_0x9aae('0x4d')][_0x9aae('0x32')](_0x25dc60)[_0x9aae('0x22')](function(_0x3002aa){_0x318950[_0x9aae('0x32')]=_0x3002aa;if(_0x183b3c[_0x9aae('0x41')]['includeAll']){_0x49589a[_0x9aae('0x4e')]=[{'all':!![]}];}return db[_0x9aae('0x4d')][_0x9aae('0x4f')](_0x49589a);})[_0x9aae('0x22')](function(_0xe0a26f){_0x318950[_0x9aae('0x50')]=_0xe0a26f;return _0x318950;})['then'](respondWithFilteredResult(_0x413560,_0x49589a))[_0x9aae('0x51')](handleError(_0x413560,null));};exports[_0x9aae('0x52')]=function(_0x22ad17,_0x3a03c1){var _0x2748d0={'raw':!![],'where':{'id':_0x22ad17[_0x9aae('0x53')]['id']}},_0x4c262c={};_0x4c262c[_0x9aae('0x40')]=_['keys'](db[_0x9aae('0x4d')][_0x9aae('0x54')]);_0x4c262c[_0x9aae('0x41')]=_[_0x9aae('0x55')](_0x22ad17[_0x9aae('0x41')]);_0x4c262c['filters']=_[_0x9aae('0x56')](_0x4c262c[_0x9aae('0x40')],_0x4c262c[_0x9aae('0x41')]);_0x2748d0[_0x9aae('0x43')]=_[_0x9aae('0x56')](_0x4c262c['model'],qs[_0x9aae('0x42')](_0x22ad17[_0x9aae('0x41')][_0x9aae('0x42')]));_0x2748d0['attributes']=_0x2748d0[_0x9aae('0x43')][_0x9aae('0x44')]?_0x2748d0['attributes']:_0x4c262c['model'];if(_0x22ad17['query']['includeAll']){_0x2748d0[_0x9aae('0x4e')]=[{'all':!![]}];}_0x2748d0=_[_0x9aae('0x4a')]({},_0x2748d0,_0x22ad17[_0x9aae('0x57')]);return db[_0x9aae('0x4d')][_0x9aae('0x58')](_0x2748d0)[_0x9aae('0x22')](handleEntityNotFound(_0x3a03c1,null))[_0x9aae('0x22')](respondWithResult(_0x3a03c1,null))[_0x9aae('0x51')](handleError(_0x3a03c1,null));};exports['create']=function(_0x58ca61,_0x49db02){return db[_0x9aae('0x4d')][_0x9aae('0x59')](_0x58ca61[_0x9aae('0x5a')],{})[_0x9aae('0x22')](function(_0x68ce8c){var _0x45fd6d=_0x58ca61[_0x9aae('0x5b')][_0x9aae('0x39')]({'plain':!![]});if(!_0x45fd6d)throw new Error(_0x9aae('0x5c'));if(_0x45fd6d['role']===_0x9aae('0x5b')){var _0x44e08d=_0x68ce8c[_0x9aae('0x39')]({'plain':!![]});var _0x3fa9da=_0x9aae('0x5d');return db['UserProfileSection'][_0x9aae('0x58')]({'where':{'name':_0x3fa9da,'userProfileId':_0x45fd6d[_0x9aae('0x5e')]},'raw':!![]})['then'](function(_0x3450b5){if(_0x3450b5&&_0x3450b5['autoAssociation']===0x0){return db[_0x9aae('0x5f')][_0x9aae('0x59')]({'name':_0x44e08d[_0x9aae('0x3b')],'resourceId':_0x44e08d['id'],'type':_0x3450b5[_0x9aae('0x3b')],'sectionId':_0x3450b5['id']},{})['then'](function(){return _0x68ce8c;});}else{return _0x68ce8c;}})[_0x9aae('0x51')](function(_0x182d33){logger[_0x9aae('0x28')](_0x9aae('0x60'),_0x182d33);throw _0x182d33;});}return _0x68ce8c;})[_0x9aae('0x22')](respondWithResult(_0x49db02,0xc9))[_0x9aae('0x51')](handleError(_0x49db02,null));};exports['update']=function(_0x24e25e,_0x1f879b){if(_0x24e25e[_0x9aae('0x5a')]['id']){delete _0x24e25e[_0x9aae('0x5a')]['id'];}return db[_0x9aae('0x4d')]['find']({'where':{'id':_0x24e25e[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x1f879b,null))[_0x9aae('0x22')](saveUpdates(_0x24e25e[_0x9aae('0x5a')],null))[_0x9aae('0x22')](respondWithResult(_0x1f879b,null))[_0x9aae('0x51')](handleError(_0x1f879b,null));};exports[_0x9aae('0x38')]=function(_0x30a47d,_0x554901){return db['ChatQueue'][_0x9aae('0x58')]({'where':{'id':_0x30a47d[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x554901,null))['then'](removeEntity(_0x554901,null))[_0x9aae('0x51')](handleError(_0x554901,null));};exports['describe']=function(_0x15e84b,_0x41eb82){return db[_0x9aae('0x4d')][_0x9aae('0x61')]()[_0x9aae('0x22')](respondWithResult(_0x41eb82,null))[_0x9aae('0x51')](handleError(_0x41eb82,null));};exports['getMembers']=function(_0x3b96d0,_0x433d53,_0x24ed6b){var _0x32c1c0={'raw':!![],'where':{}},_0x551e8d={},_0x39eb44;return db[_0x9aae('0x4d')][_0x9aae('0x62')]({'where':{'id':_0x3b96d0[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x433d53,null))['then'](function(_0x5e38ae){if(_0x5e38ae){_0x39eb44=_0x5e38ae[_0x9aae('0x39')]({'plain':!![]});_0x551e8d[_0x9aae('0x40')]=_[_0x9aae('0x55')](db['UserChatQueue']['rawAttributes']);_0x551e8d[_0x9aae('0x41')]=_[_0x9aae('0x55')](_0x3b96d0['query']);_0x551e8d[_0x9aae('0x49')]=_[_0x9aae('0x56')](_0x551e8d['model'],_0x551e8d[_0x9aae('0x41')]);_0x32c1c0[_0x9aae('0x43')]=_[_0x9aae('0x56')](_0x551e8d[_0x9aae('0x40')],qs[_0x9aae('0x42')](_0x3b96d0[_0x9aae('0x41')][_0x9aae('0x42')]));_0x32c1c0['attributes']=_0x32c1c0[_0x9aae('0x43')][_0x9aae('0x44')]?_0x32c1c0[_0x9aae('0x43')]:_0x551e8d[_0x9aae('0x40')];if(!_0x3b96d0[_0x9aae('0x41')]['hasOwnProperty'](_0x9aae('0x46'))){_0x32c1c0['limit']=qs[_0x9aae('0x31')](_0x3b96d0['query'][_0x9aae('0x31')]);_0x32c1c0[_0x9aae('0x2f')]=qs['offset'](_0x3b96d0['query'][_0x9aae('0x2f')]);}_0x32c1c0['order']=qs[_0x9aae('0x47')](_0x3b96d0[_0x9aae('0x41')][_0x9aae('0x47')]);_0x32c1c0[_0x9aae('0x48')]=qs[_0x9aae('0x49')](_[_0x9aae('0x63')](_0x3b96d0[_0x9aae('0x41')],_0x551e8d[_0x9aae('0x49')]));_0x32c1c0[_0x9aae('0x48')][_0x9aae('0x64')]=_0x5e38ae['id'];if(_0x3b96d0[_0x9aae('0x41')][_0x9aae('0x65')]){_0x32c1c0[_0x9aae('0x48')]=_['merge'](_0x32c1c0[_0x9aae('0x48')],{'$or':_[_0x9aae('0x3e')](_0x32c1c0[_0x9aae('0x43')],function(_0x48d55e){var _0x183b96={};_0x183b96[_0x48d55e]={'$like':'%'+_0x3b96d0['query'][_0x9aae('0x65')]+'%'};return _0x183b96;})});}_0x32c1c0=_[_0x9aae('0x4a')]({},_0x32c1c0,_0x3b96d0[_0x9aae('0x57')]);return db[_0x9aae('0x66')][_0x9aae('0x4f')](_0x32c1c0);}})[_0x9aae('0x22')](function(_0x59dd62){if(_0x59dd62){return db['User'][_0x9aae('0x67')]({'where':{'id':_[_0x9aae('0x3e')](_0x59dd62,_0x9aae('0x68')),'role':_0x9aae('0x69')},'attributes':['id',_0x9aae('0x3b'),'chatPause',_0x9aae('0x6a'),_0x9aae('0x6b')]});}})['then'](function(_0x51bd1e){if(_0x51bd1e){return{'count':_0x51bd1e['count'],'rows':_['map'](_0x51bd1e[_0x9aae('0x50')],function(_0x13c42b){return{'membername':_0x13c42b[_0x9aae('0x3b')],'UserId':_0x13c42b['id'],'queue_name':_0x39eb44[_0x9aae('0x3b')],'ChatQueueId':_0x39eb44['id'],'interface':util['format'](_0x9aae('0x6c'),'SIP',_0x13c42b[_0x9aae('0x3b')]),'penalty':0x0,'paused':_0x13c42b[_0x9aae('0x6d')],'createdAt':_0x13c42b['createdAt'],'updatedAt':_0x13c42b[_0x9aae('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9aae('0x22')](respondWithFilteredResult(_0x433d53,_0x32c1c0))[_0x9aae('0x51')](handleError(_0x433d53,null));};exports[_0x9aae('0x6e')]=function(_0x4dc615,_0x2ff09d,_0x164f25){var _0x12d93e={};var _0x317649={};var _0x3409f9;var _0x44dc29;return db[_0x9aae('0x4d')][_0x9aae('0x62')]({'where':{'id':_0x4dc615['params']['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x2ff09d,null))[_0x9aae('0x22')](function(_0x25e177){if(_0x25e177){_0x3409f9=_0x25e177;_0x317649['model']=_['keys'](db[_0x9aae('0x6f')][_0x9aae('0x54')]);_0x317649['query']=_[_0x9aae('0x55')](_0x4dc615['query']);_0x317649[_0x9aae('0x49')]=_[_0x9aae('0x56')](_0x317649['model'],_0x317649[_0x9aae('0x41')]);_0x12d93e[_0x9aae('0x43')]=_[_0x9aae('0x56')](_0x317649[_0x9aae('0x40')],qs[_0x9aae('0x42')](_0x4dc615[_0x9aae('0x41')][_0x9aae('0x42')]));_0x12d93e[_0x9aae('0x43')]=_0x12d93e['attributes'][_0x9aae('0x44')]?_0x12d93e[_0x9aae('0x43')]:_0x317649[_0x9aae('0x40')];_0x12d93e[_0x9aae('0x70')]=qs['sort'](_0x4dc615[_0x9aae('0x41')][_0x9aae('0x47')]);_0x12d93e[_0x9aae('0x48')]=qs[_0x9aae('0x49')](_['pick'](_0x4dc615[_0x9aae('0x41')],_0x317649[_0x9aae('0x49')]));if(_0x4dc615[_0x9aae('0x41')][_0x9aae('0x65')]){_0x12d93e['where']=_['merge'](_0x12d93e[_0x9aae('0x48')],{'$or':_[_0x9aae('0x3e')](_0x12d93e[_0x9aae('0x43')],function(_0x3dbec1){var _0x5b6092={};_0x5b6092[_0x3dbec1]={'$like':'%'+_0x4dc615[_0x9aae('0x41')][_0x9aae('0x65')]+'%'};return _0x5b6092;})});}_0x12d93e=_['merge']({},_0x12d93e,_0x4dc615[_0x9aae('0x57')]);return _0x3409f9[_0x9aae('0x6e')](_0x12d93e);}})[_0x9aae('0x22')](function(_0x5edf0d){if(_0x5edf0d){_0x44dc29=_0x5edf0d[_0x9aae('0x44')];if(!_0x4dc615[_0x9aae('0x41')]['hasOwnProperty']('nolimit')){_0x12d93e[_0x9aae('0x31')]=qs[_0x9aae('0x31')](_0x4dc615[_0x9aae('0x41')][_0x9aae('0x31')]);_0x12d93e[_0x9aae('0x2f')]=qs[_0x9aae('0x2f')](_0x4dc615[_0x9aae('0x41')][_0x9aae('0x2f')]);}return _0x3409f9[_0x9aae('0x6e')](_0x12d93e);}})[_0x9aae('0x22')](function(_0x22fe39){if(_0x22fe39){return _0x22fe39?{'count':_0x44dc29,'rows':_0x22fe39}:null;}})[_0x9aae('0x22')](respondWithResult(_0x2ff09d,null))[_0x9aae('0x51')](handleError(_0x2ff09d,null));};exports[_0x9aae('0x71')]=function(_0x17e09b,_0x4ed3b7,_0x338c97){var _0x478664=_0x17e09b[_0x9aae('0x5a')]['ids'];return db[_0x9aae('0x6f')][_0x9aae('0x4f')]({'where':{'id':_0x478664},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x9aae('0x72'),_0x9aae('0x73'),_0x9aae('0x74')],'raw':!![]}]})['then'](function(_0x658818){if(_0x658818){var _0xf80905=_[_0x9aae('0x75')](_0x658818,function(_0x5dbcfb){var _0x9d144b=_0x5dbcfb[_0x9aae('0x39')]({'plain':!![]});return _0x9d144b[_0x9aae('0x76')];});return db[_0x9aae('0x4d')][_0x9aae('0x58')]({'where':{'id':_0x17e09b[_0x9aae('0x53')]['id']}})['then'](function(_0x1687f3){return db[_0x9aae('0x77')][_0x9aae('0x78')](function(_0x12a9c9){return _0x1687f3[_0x9aae('0x71')](_0x478664,{'transaction':_0x12a9c9})['then'](function(){return BPromise[_0x9aae('0x79')](_0xf80905,function(_0x50d52f){return db[_0x9aae('0x66')][_0x9aae('0x7a')]({'where':{'UserId':_0x50d52f['id'],'ChatQueueId':_0x17e09b['params']['id']},'transaction':_0x12a9c9});});})[_0x9aae('0x22')](function(){_0xf80905[_0x9aae('0x7b')](function(_0x34f477){socket[_0x9aae('0x7c')](_0x9aae('0x7d'),{'UserId':_0x34f477['id'],'ChatQueueId':_0x1687f3['id']});});});});});}})[_0x9aae('0x22')](respondWithStatusCode(_0x4ed3b7,null))[_0x9aae('0x51')](handleError(_0x4ed3b7,null));};exports[_0x9aae('0x7e')]=function(_0x513c7b,_0x299606,_0xc6ec6){return db[_0x9aae('0x6f')]['findAll']({'where':{'id':_0x513c7b[_0x9aae('0x41')][_0x9aae('0x7f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9aae('0x76'),'attributes':['id'],'raw':!![]}]})[_0x9aae('0x22')](handleEntityNotFound(_0x299606,null))[_0x9aae('0x22')](function(_0x3d4822){var _0x1c17f7=_['map'](_0x3d4822,'id');var _0x4422a9=[];var _0x45720f=[];var _0x270c1b=squel[_0x9aae('0x80')]();_0x270c1b[_0x9aae('0x81')]('tq.TeamId')[_0x9aae('0x82')](_0x9aae('0x83'),'tq')['join'](_0x9aae('0x84'),'ut',_0x9aae('0x85'))[_0x9aae('0x48')](_0x9aae('0x86'),_0x513c7b[_0x9aae('0x53')]['id']);for(var _0x58df27=0x0;_0x58df27<_0x3d4822[_0x9aae('0x44')];_0x58df27+=0x1){let _0x42dc4e=_0x3d4822[_0x58df27];for(var _0x483775=0x0;_0x483775<_0x42dc4e[_0x9aae('0x76')][_0x9aae('0x44')];_0x483775+=0x1){let _0x1e81ef=_0x42dc4e[_0x9aae('0x76')][_0x483775];var _0x104219=_0x270c1b[_0x9aae('0x87')]();_0x104219[_0x9aae('0x48')](_0x9aae('0x88'),_0x1e81ef['id']);_0x45720f[_0x9aae('0x89')](db['sequelize'][_0x9aae('0x41')](_0x104219['toString'](),{'type':db[_0x9aae('0x77')][_0x9aae('0x8a')][_0x9aae('0x8b')]})[_0x9aae('0x22')](function(_0x35ef3a){if(_0x35ef3a[_0x9aae('0x44')]===0x1){return _0x1e81ef['id'];}else{var _0x30291e=_['every'](_[_0x9aae('0x3e')](_0x35ef3a,'TeamId'),function(_0x43f97a){return _[_0x9aae('0x8c')](_0x1c17f7,_0x43f97a);});if(_0x30291e){return _0x1e81ef['id'];}}}));}}return BPromise[_0x9aae('0x8d')](_0x45720f)[_0x9aae('0x22')](function(_0x53d931){_0x4422a9=_(_0x4422a9)[_0x9aae('0x8e')](_0x53d931)[_0x9aae('0x8f')]()['value']();return db[_0x9aae('0x4d')][_0x9aae('0x58')]({'where':{'id':_0x513c7b[_0x9aae('0x53')]['id']}})['then'](function(_0x1d8411){return db['sequelize'][_0x9aae('0x78')](function(_0x397a13){return _0x1d8411[_0x9aae('0x7e')](_0x513c7b[_0x9aae('0x41')][_0x9aae('0x7f')],{'transaction':_0x397a13})[_0x9aae('0x22')](function(){if(!_['isEmpty'](_0x4422a9)){return _0x1d8411[_0x9aae('0x90')](_0x4422a9,{'transaction':_0x397a13});}})[_0x9aae('0x22')](function(){_0x4422a9['forEach'](function(_0x49f429){socket['emit'](_0x9aae('0x91'),{'UserId':_0x49f429,'ChatQueueId':_0x1d8411['id']});});});});});});})[_0x9aae('0x22')](respondWithStatusCode(_0x299606,null))['catch'](handleError(_0x299606,null));};exports[_0x9aae('0x92')]=function(_0x3fa734,_0x517bcf,_0x4f3b17){return db[_0x9aae('0x4d')][_0x9aae('0x58')]({'where':{'id':_0x3fa734[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x517bcf,null))['then'](function(_0xb45f83){if(_0xb45f83){return _0xb45f83['addAgents'](_0x3fa734['body'][_0x9aae('0x7f')],_[_0x9aae('0x93')](_0x3fa734[_0x9aae('0x5a')],[_0x9aae('0x7f'),'id'])||{})[_0x9aae('0x94')](function(_0x119f7c){for(var _0x576755=0x0;_0x576755<_0x3fa734[_0x9aae('0x5a')][_0x9aae('0x7f')][_0x9aae('0x44')];_0x576755+=0x1){socket[_0x9aae('0x7c')](_0x9aae('0x7d'),{'UserId':Number(_0x3fa734[_0x9aae('0x5a')][_0x9aae('0x7f')][_0x576755]),'ChatQueueId':Number(_0x3fa734[_0x9aae('0x53')]['id'])});}return _0x119f7c;});}})['then'](respondWithResult(_0x517bcf,null))[_0x9aae('0x51')](handleError(_0x517bcf,null));};exports[_0x9aae('0x90')]=function(_0x6898f6,_0x41ffc4,_0x134c15){return db[_0x9aae('0x4d')]['find']({'where':{'id':_0x6898f6[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x41ffc4,null))[_0x9aae('0x22')](function(_0x1315e4){if(_0x1315e4){return _0x1315e4[_0x9aae('0x90')](_0x6898f6['query']['ids'])[_0x9aae('0x22')](function(){if(_[_0x9aae('0x95')](_0x6898f6['query'][_0x9aae('0x7f')])){for(var _0x5a3258=0x0;_0x5a3258<_0x6898f6['query'][_0x9aae('0x7f')][_0x9aae('0x44')];_0x5a3258+=0x1){socket[_0x9aae('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x6898f6['query'][_0x9aae('0x7f')][_0x5a3258]),'ChatQueueId':Number(_0x6898f6[_0x9aae('0x53')]['id'])});}}else{socket[_0x9aae('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x6898f6[_0x9aae('0x41')][_0x9aae('0x7f')]),'ChatQueueId':Number(_0x6898f6[_0x9aae('0x53')]['id'])});}});}})[_0x9aae('0x22')](respondWithStatusCode(_0x41ffc4,null))['catch'](handleError(_0x41ffc4,null));};exports[_0x9aae('0x96')]=function(_0x3d1619,_0x10ef4f,_0x18c8cc){var _0x378c25={};var _0x3c8297={};var _0x143d46;var _0x85e8db;return db[_0x9aae('0x4d')][_0x9aae('0x62')]({'where':{'id':_0x3d1619[_0x9aae('0x53')]['id']}})[_0x9aae('0x22')](handleEntityNotFound(_0x10ef4f,null))[_0x9aae('0x22')](function(_0x2af22b){if(_0x2af22b){_0x143d46=_0x2af22b;_0x3c8297[_0x9aae('0x40')]=_[_0x9aae('0x55')](db['User'][_0x9aae('0x54')]);_0x3c8297[_0x9aae('0x41')]=_['keys'](_0x3d1619['query']);_0x3c8297['filters']=_[_0x9aae('0x56')](_0x3c8297[_0x9aae('0x40')],_0x3c8297[_0x9aae('0x41')]);_0x378c25[_0x9aae('0x43')]=_['intersection'](_0x3c8297[_0x9aae('0x40')],qs[_0x9aae('0x42')](_0x3d1619['query'][_0x9aae('0x42')]));_0x378c25['attributes']=_0x378c25['attributes'][_0x9aae('0x44')]?_0x378c25[_0x9aae('0x43')]:_0x3c8297[_0x9aae('0x40')];_0x378c25[_0x9aae('0x70')]=qs[_0x9aae('0x47')](_0x3d1619['query'][_0x9aae('0x47')]);_0x378c25[_0x9aae('0x48')]=qs[_0x9aae('0x49')](_[_0x9aae('0x63')](_0x3d1619[_0x9aae('0x41')],_0x3c8297[_0x9aae('0x49')]));if(_0x3d1619['query']['filter']){_0x378c25['where']=_['merge'](_0x378c25['where'],{'$or':_[_0x9aae('0x3e')](_0x378c25['attributes'],function(_0x2d5036){var _0xb3f916={};_0xb3f916[_0x2d5036]={'$like':'%'+_0x3d1619['query'][_0x9aae('0x65')]+'%'};return _0xb3f916;})});}_0x378c25=_[_0x9aae('0x4a')]({},_0x378c25,_0x3d1619[_0x9aae('0x57')]);return _0x143d46[_0x9aae('0x96')](_0x378c25);}})[_0x9aae('0x22')](function(_0x31f31c){if(_0x31f31c){_0x85e8db=_0x31f31c[_0x9aae('0x44')];if(!_0x3d1619[_0x9aae('0x41')][_0x9aae('0x45')]('nolimit')){_0x378c25[_0x9aae('0x31')]=qs[_0x9aae('0x31')](_0x3d1619['query'][_0x9aae('0x31')]);_0x378c25[_0x9aae('0x2f')]=qs[_0x9aae('0x2f')](_0x3d1619[_0x9aae('0x41')][_0x9aae('0x2f')]);}return _0x143d46[_0x9aae('0x96')](_0x378c25);}})['then'](function(_0x5a1456){if(_0x5a1456){return _0x5a1456?{'count':_0x85e8db,'rows':_0x5a1456}:null;}})[_0x9aae('0x22')](respondWithResult(_0x10ef4f,null))[_0x9aae('0x51')](handleError(_0x10ef4f,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5e8eda4..1af87a0 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 _0x7234=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x7234,0x172));var _0x4723=function(_0x2df8d8,_0x4477d1){_0x2df8d8=_0x2df8d8-0x0;var _0xa0732f=_0x7234[_0x2df8d8];return _0xa0732f;};'use strict';var EventEmitter=require(_0x4723('0x0'));var ChatQueue=require(_0x4723('0x1'))['db'][_0x4723('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4723('0x3')](0x0);var events={'afterCreate':_0x4723('0x4'),'afterUpdate':'update','afterDestroy':_0x4723('0x5')};function emitEvent(_0x3663dd){return function(_0x16c121,_0x104c0a,_0x5cead5){ChatQueueEvents[_0x4723('0x6')](_0x3663dd+':'+_0x16c121['id'],_0x16c121);ChatQueueEvents[_0x4723('0x6')](_0x3663dd,_0x16c121);_0x5cead5(null);};}for(var e in events){if(events[_0x4723('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x4723('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x94b4=['remove','emit','hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x94b4,0x174));var _0x494b=function(_0xc294c4,_0x48f78a){_0xc294c4=_0xc294c4-0x0;var _0x460cf3=_0x94b4[_0xc294c4];return _0x460cf3;};'use strict';var EventEmitter=require(_0x494b('0x0'));var ChatQueue=require(_0x494b('0x1'))['db'][_0x494b('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x494b('0x3')](0x0);var events={'afterCreate':_0x494b('0x4'),'afterUpdate':_0x494b('0x5'),'afterDestroy':_0x494b('0x6')};function emitEvent(_0x526dfb){return function(_0xc808,_0x23b906,_0x56d85d){ChatQueueEvents[_0x494b('0x7')](_0x526dfb+':'+_0xc808['id'],_0xc808);ChatQueueEvents[_0x494b('0x7')](_0x526dfb,_0xc808);_0x56d85d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x494b('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9be65be..bcb37b2 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 _0x5d3e=['rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d3e,0x161));var _0xe5d3=function(_0x499fd2,_0x6343e3){_0x499fd2=_0x499fd2-0x0;var _0x5d7e6b=_0x5d3e[_0x499fd2];return _0x5d7e6b;};'use strict';var _=require(_0xe5d3('0x0'));var util=require(_0xe5d3('0x1'));var logger=require('../../config/logger')(_0xe5d3('0x2'));var moment=require(_0xe5d3('0x3'));var BPromise=require(_0xe5d3('0x4'));var rp=require(_0xe5d3('0x5'));var fs=require('fs');var path=require(_0xe5d3('0x6'));var rimraf=require(_0xe5d3('0x7'));var config=require(_0xe5d3('0x8'));var attributes=require('./chatQueue.attributes');module[_0xe5d3('0x9')]=function(_0x4b6cf2,_0x4ceebc){return _0x4b6cf2['define'](_0xe5d3('0xa'),attributes,{'tableName':_0xe5d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe91=['rimraf','exports','ChatQueue','lodash','util','../../config/logger','api','moment','path'];(function(_0x2a3bbe,_0x455253){var _0x5afbc5=function(_0x6817fb){while(--_0x6817fb){_0x2a3bbe['push'](_0x2a3bbe['shift']());}};_0x5afbc5(++_0x455253);}(_0xbe91,0xb7));var _0x1be9=function(_0x55af0d,_0x5db5c9){_0x55af0d=_0x55af0d-0x0;var _0x245085=_0xbe91[_0x55af0d];return _0x245085;};'use strict';var _=require(_0x1be9('0x0'));var util=require(_0x1be9('0x1'));var logger=require(_0x1be9('0x2'))(_0x1be9('0x3'));var moment=require(_0x1be9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1be9('0x5'));var rimraf=require(_0x1be9('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x1be9('0x7')]=function(_0x1ef159,_0x5ae84f){return _0x1ef159['define'](_0x1be9('0x8'),attributes,{'tableName':'chat_queues','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 90961e4..8776e73 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 _0x1364=['ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowChatQueue','ChatQueue','find','debug','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1364,0x1eb));var _0x4136=function(_0x45aad7,_0x54477f){_0x45aad7=_0x45aad7-0x0;var _0x2e575d=_0x1364[_0x45aad7];return _0x2e575d;};'use strict';var _=require(_0x4136('0x0'));var util=require('util');var moment=require(_0x4136('0x1'));var BPromise=require(_0x4136('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4136('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4136('0x4'));var logger=require(_0x4136('0x5'))(_0x4136('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4136('0x7')]['http']({'port':0x232a});config[_0x4136('0x8')]=_[_0x4136('0x9')](config[_0x4136('0x8')],{'host':_0x4136('0xa'),'port':0x18eb});var socket=require(_0x4136('0xb'))(new Redis(config[_0x4136('0x8')]));require('./chatQueue.socket')[_0x4136('0xc')](socket);function respondWithRpcPromise(_0x1ffc81,_0x4dd717,_0xbf0655){return new BPromise(function(_0xf207ea,_0x1be8e9){return client[_0x4136('0xd')](_0x1ffc81,_0xbf0655)[_0x4136('0xe')](function(_0x54e54e){logger[_0x4136('0xf')](_0x4136('0x10'),_0x4dd717,'request\x20sent');logger['debug'](_0x4136('0x11'),_0x4dd717,_0x4136('0x12'),JSON[_0x4136('0x13')](_0x54e54e));if(_0x54e54e['error']){if(_0x54e54e[_0x4136('0x14')][_0x4136('0x15')]===0x1f4){logger[_0x4136('0x14')](_0x4136('0x10'),_0x4dd717,_0x54e54e['error'][_0x4136('0x16')]);return _0x1be8e9(_0x54e54e[_0x4136('0x14')][_0x4136('0x16')]);}logger[_0x4136('0x14')](_0x4136('0x10'),_0x4dd717,_0x54e54e['error'][_0x4136('0x16')]);return _0xf207ea(_0x54e54e['error']['message']);}else{logger[_0x4136('0xf')](_0x4136('0x10'),_0x4dd717,'request\x20sent');_0xf207ea(_0x54e54e['result']['message']);}})[_0x4136('0x17')](function(_0x37877a){logger['error'](_0x4136('0x10'),_0x4dd717,_0x37877a);_0x1be8e9(_0x37877a);});});}exports[_0x4136('0x18')]=function(_0x19d236){var _0x533d5f=this;return new Promise(function(_0x575ed2,_0x13a1db){return db['ChatQueue'][_0x4136('0x19')]({'raw':_0x19d236[_0x4136('0x1a')]?_0x19d236['options'][_0x4136('0x1b')]===undefined?!![]:![]:!![],'where':_0x19d236[_0x4136('0x1a')]?_0x19d236['options'][_0x4136('0x1c')]||null:null,'attributes':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')][_0x4136('0x1d')]||null:null,'limit':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')][_0x4136('0x1e')]||null:null,'include':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')]['include']?_[_0x4136('0x1f')](_0x19d236['options'][_0x4136('0x20')],function(_0x367aa1){return{'model':db[_0x367aa1['model']],'as':_0x367aa1['as'],'attributes':_0x367aa1[_0x4136('0x1d')],'include':_0x367aa1[_0x4136('0x20')]?_['map'](_0x367aa1[_0x4136('0x20')],function(_0x492d89){return{'model':db[_0x492d89[_0x4136('0x21')]],'as':_0x492d89['as'],'attributes':_0x492d89['attributes'],'include':_0x492d89[_0x4136('0x20')]?_[_0x4136('0x1f')](_0x492d89['include'],function(_0x270cd4){return{'model':db[_0x270cd4[_0x4136('0x21')]],'as':_0x270cd4['as'],'attributes':_0x270cd4[_0x4136('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4136('0xe')](function(_0x5333f2){logger[_0x4136('0xf')](_0x4136('0x18'),_0x19d236);logger['debug'](_0x4136('0x18'),_0x19d236,JSON['stringify'](_0x5333f2));_0x575ed2(_0x5333f2);})[_0x4136('0x17')](function(_0x3f33b3){logger[_0x4136('0x14')](_0x4136('0x18'),_0x3f33b3[_0x4136('0x16')],_0x19d236);_0x13a1db(_0x533d5f['error'](0x1f4,_0x3f33b3[_0x4136('0x16')]));});});};exports[_0x4136('0x22')]=function(_0x729b08){var _0x1c4509=this;return new Promise(function(_0x11c1dc,_0xb692b5){return db[_0x4136('0x23')][_0x4136('0x24')]({'raw':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x1c')]||null:null,'attributes':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x1d')]||null:null,'include':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x20')]?_[_0x4136('0x1f')](_0x729b08[_0x4136('0x1a')]['include'],function(_0x732164){return{'model':db[_0x732164[_0x4136('0x21')]],'as':_0x732164['as'],'attributes':_0x732164[_0x4136('0x1d')],'include':_0x732164[_0x4136('0x20')]?_['map'](_0x732164[_0x4136('0x20')],function(_0x1740e5){return{'model':db[_0x1740e5[_0x4136('0x21')]],'as':_0x1740e5['as'],'attributes':_0x1740e5[_0x4136('0x1d')],'include':_0x1740e5[_0x4136('0x20')]?_[_0x4136('0x1f')](_0x1740e5[_0x4136('0x20')],function(_0x34f52e){return{'model':db[_0x34f52e[_0x4136('0x21')]],'as':_0x34f52e['as'],'attributes':_0x34f52e[_0x4136('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4136('0xe')](function(_0xff6f42){logger[_0x4136('0xf')](_0x4136('0x22'),_0x729b08);logger[_0x4136('0x25')]('ShowChatQueue',_0x729b08,JSON[_0x4136('0x13')](_0xff6f42));_0x11c1dc(_0xff6f42);})['catch'](function(_0x395c7e){logger['error'](_0x4136('0x22'),_0x395c7e[_0x4136('0x16')],_0x729b08);_0xb692b5(_0x1c4509[_0x4136('0x14')](0x1f4,_0x395c7e[_0x4136('0x16')]));});});}; \ No newline at end of file +var _0x020a=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x56e03e,_0xd00a46){var _0x28609a=function(_0x4d0051){while(--_0x4d0051){_0x56e03e['push'](_0x56e03e['shift']());}};_0x28609a(++_0xd00a46);}(_0x020a,0xc9));var _0xa020=function(_0x5f52a4,_0x5706d9){_0x5f52a4=_0x5f52a4-0x0;var _0xde1bce=_0x020a[_0x5f52a4];return _0xde1bce;};'use strict';var _=require(_0xa020('0x0'));var util=require(_0xa020('0x1'));var moment=require(_0xa020('0x2'));var BPromise=require('bluebird');var rs=require(_0xa020('0x3'));var fs=require('fs');var Redis=require(_0xa020('0x4'));var db=require(_0xa020('0x5'))['db'];var utils=require(_0xa020('0x6'));var logger=require(_0xa020('0x7'))(_0xa020('0x8'));var config=require(_0xa020('0x9'));var jayson=require(_0xa020('0xa'));var client=jayson[_0xa020('0xb')][_0xa020('0xc')]({'port':0x232a});config['redis']=_[_0xa020('0xd')](config[_0xa020('0xe')],{'host':_0xa020('0xf'),'port':0x18eb});var socket=require(_0xa020('0x10'))(new Redis(config['redis']));require(_0xa020('0x11'))[_0xa020('0x12')](socket);function respondWithRpcPromise(_0x133c26,_0x10d945,_0x3bb4b6){return new BPromise(function(_0x1f42ed,_0x1cf52a){return client['request'](_0x133c26,_0x3bb4b6)['then'](function(_0x22bf19){logger[_0xa020('0x13')](_0xa020('0x14'),_0x10d945,_0xa020('0x15'));logger[_0xa020('0x16')](_0xa020('0x17'),_0x10d945,_0xa020('0x15'),JSON[_0xa020('0x18')](_0x22bf19));if(_0x22bf19[_0xa020('0x19')]){if(_0x22bf19[_0xa020('0x19')][_0xa020('0x1a')]===0x1f4){logger[_0xa020('0x19')](_0xa020('0x14'),_0x10d945,_0x22bf19[_0xa020('0x19')]['message']);return _0x1cf52a(_0x22bf19[_0xa020('0x19')][_0xa020('0x1b')]);}logger[_0xa020('0x19')](_0xa020('0x14'),_0x10d945,_0x22bf19[_0xa020('0x19')][_0xa020('0x1b')]);return _0x1f42ed(_0x22bf19[_0xa020('0x19')]['message']);}else{logger[_0xa020('0x13')](_0xa020('0x14'),_0x10d945,_0xa020('0x15'));_0x1f42ed(_0x22bf19[_0xa020('0x1c')][_0xa020('0x1b')]);}})['catch'](function(_0x2ae88d){logger[_0xa020('0x19')](_0xa020('0x14'),_0x10d945,_0x2ae88d);_0x1cf52a(_0x2ae88d);});});}exports[_0xa020('0x1d')]=function(_0x59c001){var _0x5a18c7=this;return new Promise(function(_0x4ce464,_0x2704b4){return db[_0xa020('0x1e')][_0xa020('0x1f')]({'raw':_0x59c001[_0xa020('0x20')]?_0x59c001['options'][_0xa020('0x21')]===undefined?!![]:![]:!![],'where':_0x59c001['options']?_0x59c001[_0xa020('0x20')][_0xa020('0x22')]||null:null,'attributes':_0x59c001[_0xa020('0x20')]?_0x59c001[_0xa020('0x20')][_0xa020('0x23')]||null:null,'limit':_0x59c001[_0xa020('0x20')]?_0x59c001[_0xa020('0x20')][_0xa020('0x24')]||null:null,'include':_0x59c001[_0xa020('0x20')]?_0x59c001['options'][_0xa020('0x25')]?_[_0xa020('0x26')](_0x59c001[_0xa020('0x20')]['include'],function(_0x30fa91){return{'model':db[_0x30fa91[_0xa020('0x27')]],'as':_0x30fa91['as'],'attributes':_0x30fa91[_0xa020('0x23')],'include':_0x30fa91['include']?_['map'](_0x30fa91[_0xa020('0x25')],function(_0x44f771){return{'model':db[_0x44f771[_0xa020('0x27')]],'as':_0x44f771['as'],'attributes':_0x44f771[_0xa020('0x23')],'include':_0x44f771['include']?_['map'](_0x44f771[_0xa020('0x25')],function(_0x241a8c){return{'model':db[_0x241a8c['model']],'as':_0x241a8c['as'],'attributes':_0x241a8c[_0xa020('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa020('0x28')](function(_0x2567e8){logger[_0xa020('0x13')]('GetChatQueue',_0x59c001);logger['debug'](_0xa020('0x1d'),_0x59c001,JSON['stringify'](_0x2567e8));_0x4ce464(_0x2567e8);})[_0xa020('0x29')](function(_0x39e8cb){logger[_0xa020('0x19')]('GetChatQueue',_0x39e8cb[_0xa020('0x1b')],_0x59c001);_0x2704b4(_0x5a18c7[_0xa020('0x19')](0x1f4,_0x39e8cb[_0xa020('0x1b')]));});});};exports[_0xa020('0x2a')]=function(_0x34cc23){var _0x2298d0=this;return new Promise(function(_0x552a1e,_0x490e82){return db[_0xa020('0x1e')][_0xa020('0x2b')]({'raw':_0x34cc23[_0xa020('0x20')]?_0x34cc23[_0xa020('0x20')][_0xa020('0x21')]===undefined?!![]:![]:!![],'where':_0x34cc23[_0xa020('0x20')]?_0x34cc23['options']['where']||null:null,'attributes':_0x34cc23[_0xa020('0x20')]?_0x34cc23[_0xa020('0x20')][_0xa020('0x23')]||null:null,'include':_0x34cc23[_0xa020('0x20')]?_0x34cc23[_0xa020('0x20')][_0xa020('0x25')]?_[_0xa020('0x26')](_0x34cc23[_0xa020('0x20')]['include'],function(_0x16a433){return{'model':db[_0x16a433['model']],'as':_0x16a433['as'],'attributes':_0x16a433[_0xa020('0x23')],'include':_0x16a433[_0xa020('0x25')]?_[_0xa020('0x26')](_0x16a433[_0xa020('0x25')],function(_0xaca9f1){return{'model':db[_0xaca9f1[_0xa020('0x27')]],'as':_0xaca9f1['as'],'attributes':_0xaca9f1['attributes'],'include':_0xaca9f1[_0xa020('0x25')]?_['map'](_0xaca9f1['include'],function(_0x13beb2){return{'model':db[_0x13beb2['model']],'as':_0x13beb2['as'],'attributes':_0x13beb2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa020('0x28')](function(_0x209d5e){logger['info'](_0xa020('0x2a'),_0x34cc23);logger['debug'](_0xa020('0x2a'),_0x34cc23,JSON[_0xa020('0x18')](_0x209d5e));_0x552a1e(_0x209d5e);})[_0xa020('0x29')](function(_0x1e4294){logger['error'](_0xa020('0x2a'),_0x1e4294[_0xa020('0x1b')],_0x34cc23);_0x490e82(_0x2298d0[_0xa020('0x19')](0x1f4,_0x1e4294['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5a822f3..cafcb5d 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 _0xe13a=['update','emit','removeListener','register','chatQueue:','save','remove'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xe13a,0x178));var _0xae13=function(_0x33c845,_0x2e2723){_0x33c845=_0x33c845-0x0;var _0x42e520=_0xe13a[_0x33c845];return _0x42e520;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xae13('0x0'),_0xae13('0x1'),_0xae13('0x2')];function createListener(_0x6066c0,_0x4cf961){return function(_0x3aaf90){_0x4cf961[_0xae13('0x3')](_0x6066c0,_0x3aaf90);};}function removeListener(_0x3ebbfe,_0x10abd7){return function(){ChatQueueEvents[_0xae13('0x4')](_0x3ebbfe,_0x10abd7);};}exports[_0xae13('0x5')]=function(_0x412a07){for(var _0x3379ed=0x0,_0x341ba4=events['length'];_0x3379ed<_0x341ba4;_0x3379ed++){var _0x2f6d10=events[_0x3379ed];var _0x2b2e1f=createListener(_0xae13('0x6')+_0x2f6d10,_0x412a07);ChatQueueEvents['on'](_0x2f6d10,_0x2b2e1f);}}; \ No newline at end of file +var _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x4497cd,_0x4a2208){var _0x3c6c43=function(_0x6a8fda){while(--_0x6a8fda){_0x4497cd['push'](_0x4497cd['shift']());}};_0x3c6c43(++_0x4a2208);}(_0xc368,0x7b));var _0x8c36=function(_0x2b08c0,_0x905d08){_0x2b08c0=_0x2b08c0-0x0;var _0x5ae759=_0xc368[_0x2b08c0];return _0x5ae759;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a06bcb2..5aed0ac 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5657af,_0xdaa17d){var _0x40dc44=function(_0x49d43d){while(--_0x49d43d){_0x5657af['push'](_0x5657af['shift']());}};_0x40dc44(++_0xdaa17d);}(_0x55ca,0x126));var _0xa55c=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x55ca[_0x529296];return _0x1796bf;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +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(_0x36c9c4,_0x5c6d32){var _0x253490=function(_0x1875a7){while(--_0x1875a7){_0x36c9c4['push'](_0x36c9c4['shift']());}};_0x253490(++_0x5c6d32);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 2c177d0..fa493b5 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 _0x745d=['exports','STRING','DATE'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x745d,0x1cb));var _0xd745=function(_0x49d538,_0x3d12aa){_0x49d538=_0x49d538-0x0;var _0x2eda35=_0x745d[_0x49d538];return _0x2eda35;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd745('0x0')]={'uniqueid':{'type':Sequelize[_0xd745('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd745('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd745('0x2')]},'acceptAt':{'type':Sequelize[_0xd745('0x2')]},'exitAt':{'type':Sequelize[_0xd745('0x2')]},'reason':{'type':Sequelize[_0xd745('0x1')]}}; \ No newline at end of file +var _0x8cce=['STRING','DATE','moment','sequelize'];(function(_0x19738a,_0x562adf){var _0x1633fa=function(_0x5883cd){while(--_0x5883cd){_0x19738a['push'](_0x19738a['shift']());}};_0x1633fa(++_0x562adf);}(_0x8cce,0xee));var _0xe8cc=function(_0x29d92b,_0x16d171){_0x29d92b=_0x29d92b-0x0;var _0x2e0777=_0x8cce[_0x29d92b];return _0x2e0777;};'use strict';var moment=require(_0xe8cc('0x0'));var Sequelize=require(_0xe8cc('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe8cc('0x2')]},'joinAt':{'type':Sequelize[_0xe8cc('0x3')]},'leaveAt':{'type':Sequelize[_0xe8cc('0x3')]},'acceptAt':{'type':Sequelize[_0xe8cc('0x3')]},'exitAt':{'type':Sequelize[_0xe8cc('0x3')]},'reason':{'type':Sequelize[_0xe8cc('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 7b6d976..4ab6bff 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 _0xc962=['name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','catch','params','intersection','create','body','find','destroy','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack'];(function(_0x901b53,_0x29de87){var _0x5aa1bf=function(_0x25dd7d){while(--_0x25dd7d){_0x901b53['push'](_0x901b53['shift']());}};_0x5aa1bf(++_0x29de87);}(_0xc962,0x6d));var _0x2c96=function(_0x50e76a,_0x2d71f6){_0x50e76a=_0x50e76a-0x0;var _0x38e24b=_0xc962[_0x50e76a];return _0x38e24b;};'use strict';var emlformat=require(_0x2c96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c96('0x1'));var moment=require(_0x2c96('0x2'));var BPromise=require(_0x2c96('0x3'));var Mustache=require(_0x2c96('0x4'));var util=require(_0x2c96('0x5'));var path=require(_0x2c96('0x6'));var sox=require(_0x2c96('0x7'));var csv=require(_0x2c96('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c96('0x9'));var _=require(_0x2c96('0xa'));var squel=require(_0x2c96('0xb'));var crypto=require(_0x2c96('0xc'));var jsforce=require(_0x2c96('0xd'));var deskjs=require(_0x2c96('0xe'));var toCsv=require(_0x2c96('0x8'));var querystring=require(_0x2c96('0xf'));var Papa=require(_0x2c96('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c96('0x11'));var as=require(_0x2c96('0x12'));var hardwareService=require(_0x2c96('0x13'));var logger=require(_0x2c96('0x14'))(_0x2c96('0x15'));var utils=require(_0x2c96('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c96('0x17'))['db'];function respondWithStatusCode(_0x43d83f,_0x27a97c){_0x27a97c=_0x27a97c||0xcc;return function(_0x2491a4){if(_0x2491a4){return _0x43d83f[_0x2c96('0x18')](_0x27a97c);}return _0x43d83f[_0x2c96('0x19')](_0x27a97c)[_0x2c96('0x1a')]();};}function respondWithResult(_0x534203,_0x4fa416){_0x4fa416=_0x4fa416||0xc8;return function(_0x4c1d9a){if(_0x4c1d9a){return _0x534203[_0x2c96('0x19')](_0x4fa416)[_0x2c96('0x1b')](_0x4c1d9a);}};}function respondWithFilteredResult(_0x567ef0,_0x35ad10){return function(_0x3903a7){if(_0x3903a7){var _0x54649f=typeof _0x35ad10[_0x2c96('0x1c')]===_0x2c96('0x1d')&&typeof _0x35ad10[_0x2c96('0x1e')]===_0x2c96('0x1d');var _0x4757f3=_0x3903a7[_0x2c96('0x1f')];var _0x2ccbed=_0x54649f?0x0:_0x35ad10[_0x2c96('0x1c')];var _0x3fde3e=_0x54649f?_0x3903a7['count']:_0x35ad10['offset']+_0x35ad10[_0x2c96('0x1e')];var _0x3fb8a6;if(_0x3fde3e>=_0x4757f3){_0x3fde3e=_0x4757f3;_0x3fb8a6=0xc8;}else{_0x3fb8a6=0xce;}_0x567ef0[_0x2c96('0x19')](_0x3fb8a6);return _0x567ef0['set'](_0x2c96('0x20'),_0x2ccbed+'-'+_0x3fde3e+'/'+_0x4757f3)[_0x2c96('0x1b')](_0x3903a7);}return null;};}function patchUpdates(_0x17573b){return function(_0x4f8178){try{jsonpatch[_0x2c96('0x21')](_0x4f8178,_0x17573b,!![]);}catch(_0x3450ab){return BPromise['reject'](_0x3450ab);}return _0x4f8178[_0x2c96('0x22')]();};}function saveUpdates(_0x173867,_0x361e42){return function(_0x14daf1){if(_0x14daf1){return _0x14daf1[_0x2c96('0x23')](_0x173867)[_0x2c96('0x24')](function(_0x623e95){return _0x623e95;});}return null;};}function removeEntity(_0x5b2332,_0x3d8b21){return function(_0x58933c){if(_0x58933c){return _0x58933c['destroy']()[_0x2c96('0x24')](function(){_0x5b2332['status'](0xcc)[_0x2c96('0x1a')]();});}};}function handleEntityNotFound(_0x66cd41,_0x39e8bf){return function(_0xa5a767){if(!_0xa5a767){_0x66cd41['sendStatus'](0x194);}return _0xa5a767;};}function handleError(_0x345b6c,_0x1496bb){_0x1496bb=_0x1496bb||0x1f4;return function(_0x490f14){logger[_0x2c96('0x25')](_0x490f14[_0x2c96('0x26')]);if(_0x490f14[_0x2c96('0x27')]){delete _0x490f14[_0x2c96('0x27')];}_0x345b6c['status'](_0x1496bb)[_0x2c96('0x28')](_0x490f14);};}exports[_0x2c96('0x29')]=function(_0x1ddcc5,_0x319ad5){var _0x481612={},_0x19ee5d={},_0x332e2a={'count':0x0,'rows':[]};var _0x5eea2f=_[_0x2c96('0x2a')](db['ChatQueueReport'][_0x2c96('0x2b')],function(_0x761fe1){return{'name':_0x761fe1[_0x2c96('0x2c')],'type':_0x761fe1[_0x2c96('0x2d')][_0x2c96('0x2e')]};});_0x19ee5d[_0x2c96('0x2f')]=_[_0x2c96('0x2a')](_0x5eea2f,_0x2c96('0x27'));_0x19ee5d['query']=_[_0x2c96('0x30')](_0x1ddcc5[_0x2c96('0x31')]);_0x19ee5d[_0x2c96('0x32')]=_['intersection'](_0x19ee5d[_0x2c96('0x2f')],_0x19ee5d[_0x2c96('0x31')]);_0x481612[_0x2c96('0x33')]=_['intersection'](_0x19ee5d[_0x2c96('0x2f')],qs[_0x2c96('0x34')](_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x34')]));_0x481612[_0x2c96('0x33')]=_0x481612['attributes'][_0x2c96('0x35')]?_0x481612[_0x2c96('0x33')]:_0x19ee5d[_0x2c96('0x2f')];if(!_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x36')](_0x2c96('0x37'))){_0x481612[_0x2c96('0x1e')]=qs[_0x2c96('0x1e')](_0x1ddcc5['query']['limit']);_0x481612[_0x2c96('0x1c')]=qs[_0x2c96('0x1c')](_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x1c')]);}_0x481612['order']=qs[_0x2c96('0x38')](_0x1ddcc5['query'][_0x2c96('0x38')]);_0x481612[_0x2c96('0x39')]=qs[_0x2c96('0x32')](_[_0x2c96('0x3a')](_0x1ddcc5[_0x2c96('0x31')],_0x19ee5d['filters']),_0x5eea2f);if(_0x1ddcc5[_0x2c96('0x31')]['filter']){_0x481612[_0x2c96('0x39')]=_[_0x2c96('0x3b')](_0x481612['where'],{'$or':_['map'](_0x5eea2f,function(_0xdb4945){if(_0xdb4945[_0x2c96('0x2d')]!==_0x2c96('0x3c')){var _0x4655d6={};_0x4655d6[_0xdb4945[_0x2c96('0x27')]]={'$like':'%'+_0x1ddcc5[_0x2c96('0x31')]['filter']+'%'};return _0x4655d6;}})});}_0x481612=_[_0x2c96('0x3b')]({},_0x481612,_0x1ddcc5[_0x2c96('0x3d')]);var _0x532c08={'where':_0x481612['where']};return db[_0x2c96('0x3e')][_0x2c96('0x1f')](_0x532c08)[_0x2c96('0x24')](function(_0x3a7585){_0x332e2a[_0x2c96('0x1f')]=_0x3a7585;if(_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x3f')]){_0x481612[_0x2c96('0x40')]=[{'all':!![]}];}return db[_0x2c96('0x3e')][_0x2c96('0x41')](_0x481612);})[_0x2c96('0x24')](function(_0x609778){_0x332e2a['rows']=_0x609778;return _0x332e2a;})['then'](respondWithFilteredResult(_0x319ad5,_0x481612))[_0x2c96('0x42')](handleError(_0x319ad5,null));};exports['show']=function(_0x1c490e,_0x1e6d13){var _0x10348e={'raw':!![],'where':{'id':_0x1c490e[_0x2c96('0x43')]['id']}},_0x1480a1={};_0x1480a1['model']=_['keys'](db[_0x2c96('0x3e')]['rawAttributes']);_0x1480a1[_0x2c96('0x31')]=_[_0x2c96('0x30')](_0x1c490e[_0x2c96('0x31')]);_0x1480a1[_0x2c96('0x32')]=_[_0x2c96('0x44')](_0x1480a1['model'],_0x1480a1[_0x2c96('0x31')]);_0x10348e[_0x2c96('0x33')]=_['intersection'](_0x1480a1[_0x2c96('0x2f')],qs['fields'](_0x1c490e[_0x2c96('0x31')][_0x2c96('0x34')]));_0x10348e[_0x2c96('0x33')]=_0x10348e[_0x2c96('0x33')][_0x2c96('0x35')]?_0x10348e[_0x2c96('0x33')]:_0x1480a1[_0x2c96('0x2f')];if(_0x1c490e[_0x2c96('0x31')]['includeAll']){_0x10348e[_0x2c96('0x40')]=[{'all':!![]}];}_0x10348e=_[_0x2c96('0x3b')]({},_0x10348e,_0x1c490e[_0x2c96('0x3d')]);return db[_0x2c96('0x3e')]['find'](_0x10348e)[_0x2c96('0x24')](handleEntityNotFound(_0x1e6d13,null))[_0x2c96('0x24')](respondWithResult(_0x1e6d13,null))[_0x2c96('0x42')](handleError(_0x1e6d13,null));};exports[_0x2c96('0x45')]=function(_0x202a15,_0x583a6c){return db[_0x2c96('0x3e')][_0x2c96('0x45')](_0x202a15['body'],{})[_0x2c96('0x24')](respondWithResult(_0x583a6c,0xc9))['catch'](handleError(_0x583a6c,null));};exports[_0x2c96('0x23')]=function(_0x26196e,_0x2d2c98){if(_0x26196e[_0x2c96('0x46')]['id']){delete _0x26196e[_0x2c96('0x46')]['id'];}return db[_0x2c96('0x3e')][_0x2c96('0x47')]({'where':{'id':_0x26196e[_0x2c96('0x43')]['id']}})[_0x2c96('0x24')](handleEntityNotFound(_0x2d2c98,null))[_0x2c96('0x24')](saveUpdates(_0x26196e[_0x2c96('0x46')],null))['then'](respondWithResult(_0x2d2c98,null))[_0x2c96('0x42')](handleError(_0x2d2c98,null));};exports[_0x2c96('0x48')]=function(_0x2bbeae,_0x379405){return db[_0x2c96('0x3e')]['find']({'where':{'id':_0x2bbeae[_0x2c96('0x43')]['id']}})['then'](handleEntityNotFound(_0x379405,null))[_0x2c96('0x24')](removeEntity(_0x379405,null))[_0x2c96('0x42')](handleError(_0x379405,null));};exports['describe']=function(_0x244255,_0x7feba3){return db[_0x2c96('0x3e')][_0x2c96('0x49')]()[_0x2c96('0x24')](respondWithResult(_0x7feba3,null))[_0x2c96('0x42')](handleError(_0x7feba3,null));}; \ No newline at end of file +var _0xa498=['params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','count','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0xa498,0x179));var _0x8a49=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0xa498[_0x3b4455];return _0x34dd09;};'use strict';var emlformat=require(_0x8a49('0x0'));var rimraf=require(_0x8a49('0x1'));var zipdir=require(_0x8a49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a49('0x3'));var moment=require(_0x8a49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a49('0x5'));var util=require(_0x8a49('0x6'));var path=require(_0x8a49('0x7'));var sox=require(_0x8a49('0x8'));var csv=require(_0x8a49('0x9'));var ejs=require(_0x8a49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a49('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a49('0xc'));var deskjs=require(_0x8a49('0xd'));var toCsv=require(_0x8a49('0x9'));var querystring=require(_0x8a49('0xe'));var Papa=require(_0x8a49('0xf'));var Redis=require(_0x8a49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8a49('0x11'));var as=require(_0x8a49('0x12'));var hardwareService=require(_0x8a49('0x13'));var logger=require(_0x8a49('0x14'))(_0x8a49('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a49('0x16'))['db'];function respondWithStatusCode(_0x5b7fe8,_0x408ca9){_0x408ca9=_0x408ca9||0xcc;return function(_0x5c7d24){if(_0x5c7d24){return _0x5b7fe8['sendStatus'](_0x408ca9);}return _0x5b7fe8[_0x8a49('0x17')](_0x408ca9)[_0x8a49('0x18')]();};}function respondWithResult(_0x57bcb3,_0x45b414){_0x45b414=_0x45b414||0xc8;return function(_0x3e4e73){if(_0x3e4e73){return _0x57bcb3['status'](_0x45b414)[_0x8a49('0x19')](_0x3e4e73);}};}function respondWithFilteredResult(_0x424925,_0x4a6aec){return function(_0x1fdaf4){if(_0x1fdaf4){var _0x50a72d=typeof _0x4a6aec[_0x8a49('0x1a')]==='undefined'&&typeof _0x4a6aec['limit']==='undefined';var _0x18f466=_0x1fdaf4[_0x8a49('0x1b')];var _0x563bbc=_0x50a72d?0x0:_0x4a6aec[_0x8a49('0x1a')];var _0x22f569=_0x50a72d?_0x1fdaf4[_0x8a49('0x1b')]:_0x4a6aec[_0x8a49('0x1a')]+_0x4a6aec[_0x8a49('0x1c')];var _0x42c2a5;if(_0x22f569>=_0x18f466){_0x22f569=_0x18f466;_0x42c2a5=0xc8;}else{_0x42c2a5=0xce;}_0x424925['status'](_0x42c2a5);return _0x424925[_0x8a49('0x1d')]('Content-Range',_0x563bbc+'-'+_0x22f569+'/'+_0x18f466)[_0x8a49('0x19')](_0x1fdaf4);}return null;};}function patchUpdates(_0x254d6e){return function(_0x49526a){try{jsonpatch['apply'](_0x49526a,_0x254d6e,!![]);}catch(_0x14bfb2){return BPromise[_0x8a49('0x1e')](_0x14bfb2);}return _0x49526a[_0x8a49('0x1f')]();};}function saveUpdates(_0x3659da,_0xcebf3e){return function(_0x4e0bf1){if(_0x4e0bf1){return _0x4e0bf1[_0x8a49('0x20')](_0x3659da)[_0x8a49('0x21')](function(_0x19f79b){return _0x19f79b;});}return null;};}function removeEntity(_0x2d47f4,_0x4b895f){return function(_0x19431c){if(_0x19431c){return _0x19431c[_0x8a49('0x22')]()[_0x8a49('0x21')](function(){_0x2d47f4[_0x8a49('0x17')](0xcc)[_0x8a49('0x18')]();});}};}function handleEntityNotFound(_0x493380,_0x4d177a){return function(_0x4304d4){if(!_0x4304d4){_0x493380[_0x8a49('0x23')](0x194);}return _0x4304d4;};}function handleError(_0x5de9a2,_0x385a06){_0x385a06=_0x385a06||0x1f4;return function(_0x1a8e0b){logger[_0x8a49('0x24')](_0x1a8e0b[_0x8a49('0x25')]);if(_0x1a8e0b['name']){delete _0x1a8e0b[_0x8a49('0x26')];}_0x5de9a2[_0x8a49('0x17')](_0x385a06)[_0x8a49('0x27')](_0x1a8e0b);};}exports[_0x8a49('0x28')]=function(_0x59e4a9,_0x1dc14a){var _0x31673a={},_0x3eadad={},_0x1b181b={'count':0x0,'rows':[]};var _0x477c36=_[_0x8a49('0x29')](db[_0x8a49('0x2a')]['rawAttributes'],function(_0x4f256e){return{'name':_0x4f256e[_0x8a49('0x2b')],'type':_0x4f256e[_0x8a49('0x2c')][_0x8a49('0x2d')]};});_0x3eadad[_0x8a49('0x2e')]=_['map'](_0x477c36,_0x8a49('0x26'));_0x3eadad[_0x8a49('0x2f')]=_[_0x8a49('0x30')](_0x59e4a9[_0x8a49('0x2f')]);_0x3eadad[_0x8a49('0x31')]=_['intersection'](_0x3eadad[_0x8a49('0x2e')],_0x3eadad['query']);_0x31673a[_0x8a49('0x32')]=_[_0x8a49('0x33')](_0x3eadad[_0x8a49('0x2e')],qs[_0x8a49('0x34')](_0x59e4a9['query'][_0x8a49('0x34')]));_0x31673a[_0x8a49('0x32')]=_0x31673a[_0x8a49('0x32')][_0x8a49('0x35')]?_0x31673a[_0x8a49('0x32')]:_0x3eadad['model'];if(!_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x36')](_0x8a49('0x37'))){_0x31673a[_0x8a49('0x1c')]=qs['limit'](_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x1c')]);_0x31673a['offset']=qs['offset'](_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x1a')]);}_0x31673a[_0x8a49('0x38')]=qs[_0x8a49('0x39')](_0x59e4a9['query'][_0x8a49('0x39')]);_0x31673a['where']=qs[_0x8a49('0x31')](_[_0x8a49('0x3a')](_0x59e4a9[_0x8a49('0x2f')],_0x3eadad[_0x8a49('0x31')]),_0x477c36);if(_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x3b')]){_0x31673a[_0x8a49('0x3c')]=_[_0x8a49('0x3d')](_0x31673a[_0x8a49('0x3c')],{'$or':_[_0x8a49('0x29')](_0x477c36,function(_0x4c08a5){if(_0x4c08a5[_0x8a49('0x2c')]!==_0x8a49('0x3e')){var _0x34d9f7={};_0x34d9f7[_0x4c08a5[_0x8a49('0x26')]]={'$like':'%'+_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x3b')]+'%'};return _0x34d9f7;}})});}_0x31673a=_[_0x8a49('0x3d')]({},_0x31673a,_0x59e4a9[_0x8a49('0x3f')]);var _0x63271b={'where':_0x31673a[_0x8a49('0x3c')]};return db[_0x8a49('0x2a')]['count'](_0x63271b)[_0x8a49('0x21')](function(_0x5dc751){_0x1b181b[_0x8a49('0x1b')]=_0x5dc751;if(_0x59e4a9[_0x8a49('0x2f')][_0x8a49('0x40')]){_0x31673a[_0x8a49('0x41')]=[{'all':!![]}];}return db[_0x8a49('0x2a')][_0x8a49('0x42')](_0x31673a);})[_0x8a49('0x21')](function(_0xfad17b){_0x1b181b[_0x8a49('0x43')]=_0xfad17b;return _0x1b181b;})[_0x8a49('0x21')](respondWithFilteredResult(_0x1dc14a,_0x31673a))[_0x8a49('0x44')](handleError(_0x1dc14a,null));};exports[_0x8a49('0x45')]=function(_0xa8fbc2,_0xde8f5d){var _0x42225f={'raw':!![],'where':{'id':_0xa8fbc2['params']['id']}},_0x5d1d55={};_0x5d1d55[_0x8a49('0x2e')]=_[_0x8a49('0x30')](db[_0x8a49('0x2a')]['rawAttributes']);_0x5d1d55[_0x8a49('0x2f')]=_['keys'](_0xa8fbc2[_0x8a49('0x2f')]);_0x5d1d55[_0x8a49('0x31')]=_[_0x8a49('0x33')](_0x5d1d55[_0x8a49('0x2e')],_0x5d1d55[_0x8a49('0x2f')]);_0x42225f[_0x8a49('0x32')]=_[_0x8a49('0x33')](_0x5d1d55[_0x8a49('0x2e')],qs[_0x8a49('0x34')](_0xa8fbc2[_0x8a49('0x2f')][_0x8a49('0x34')]));_0x42225f['attributes']=_0x42225f[_0x8a49('0x32')][_0x8a49('0x35')]?_0x42225f[_0x8a49('0x32')]:_0x5d1d55[_0x8a49('0x2e')];if(_0xa8fbc2[_0x8a49('0x2f')]['includeAll']){_0x42225f[_0x8a49('0x41')]=[{'all':!![]}];}_0x42225f=_[_0x8a49('0x3d')]({},_0x42225f,_0xa8fbc2[_0x8a49('0x3f')]);return db['ChatQueueReport']['find'](_0x42225f)[_0x8a49('0x21')](handleEntityNotFound(_0xde8f5d,null))[_0x8a49('0x21')](respondWithResult(_0xde8f5d,null))['catch'](handleError(_0xde8f5d,null));};exports[_0x8a49('0x46')]=function(_0x34aeb9,_0x3c7b36){return db[_0x8a49('0x2a')][_0x8a49('0x46')](_0x34aeb9[_0x8a49('0x47')],{})[_0x8a49('0x21')](respondWithResult(_0x3c7b36,0xc9))[_0x8a49('0x44')](handleError(_0x3c7b36,null));};exports[_0x8a49('0x20')]=function(_0x362d8f,_0x5e727e){if(_0x362d8f['body']['id']){delete _0x362d8f[_0x8a49('0x47')]['id'];}return db[_0x8a49('0x2a')][_0x8a49('0x48')]({'where':{'id':_0x362d8f[_0x8a49('0x49')]['id']}})[_0x8a49('0x21')](handleEntityNotFound(_0x5e727e,null))[_0x8a49('0x21')](saveUpdates(_0x362d8f[_0x8a49('0x47')],null))[_0x8a49('0x21')](respondWithResult(_0x5e727e,null))[_0x8a49('0x44')](handleError(_0x5e727e,null));};exports[_0x8a49('0x22')]=function(_0x5d2dbb,_0x1923a5){return db[_0x8a49('0x2a')][_0x8a49('0x48')]({'where':{'id':_0x5d2dbb[_0x8a49('0x49')]['id']}})['then'](handleEntityNotFound(_0x1923a5,null))[_0x8a49('0x21')](removeEntity(_0x1923a5,null))[_0x8a49('0x44')](handleError(_0x1923a5,null));};exports[_0x8a49('0x4a')]=function(_0xa78845,_0x458b26){return db[_0x8a49('0x2a')][_0x8a49('0x4a')]()['then'](respondWithResult(_0x458b26,null))['catch'](handleError(_0x458b26,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7252ecf..4dabc74 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0xe706,0xa3));var _0x6e70=function(_0xeb0035,_0x2c3d9a){_0xeb0035=_0xeb0035-0x0;var _0x190e57=_0xe706[_0xeb0035];return _0x190e57;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0e72cde..c1c5db2 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 _0x87e4=['jayson/promise','client','http','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x248f3e,_0x2405e0){var _0x18f93c=function(_0x459551){while(--_0x459551){_0x248f3e['push'](_0x248f3e['shift']());}};_0x18f93c(++_0x2405e0);}(_0x87e4,0x100));var _0x487e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x87e4[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x487e('0x0'));var util=require(_0x487e('0x1'));var moment=require(_0x487e('0x2'));var BPromise=require(_0x487e('0x3'));var rs=require(_0x487e('0x4'));var fs=require('fs');var Redis=require(_0x487e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x487e('0x6'))(_0x487e('0x7'));var config=require('../../config/environment');var jayson=require(_0x487e('0x8'));var client=jayson[_0x487e('0x9')][_0x487e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2039,_0x4dcf87,_0x1f4eef){return new BPromise(function(_0x27c661,_0x576ca1){return client['request'](_0x5d2039,_0x1f4eef)[_0x487e('0xb')](function(_0x5a7a2){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4dcf87,_0x487e('0xc'));logger[_0x487e('0xd')](_0x487e('0xe'),_0x4dcf87,'request\x20sent',JSON[_0x487e('0xf')](_0x5a7a2));if(_0x5a7a2[_0x487e('0x10')]){if(_0x5a7a2[_0x487e('0x10')][_0x487e('0x11')]===0x1f4){logger[_0x487e('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4dcf87,_0x5a7a2['error']['message']);return _0x576ca1(_0x5a7a2[_0x487e('0x10')][_0x487e('0x12')]);}logger[_0x487e('0x10')](_0x487e('0x13'),_0x4dcf87,_0x5a7a2[_0x487e('0x10')][_0x487e('0x12')]);return _0x27c661(_0x5a7a2[_0x487e('0x10')]['message']);}else{logger[_0x487e('0x14')](_0x487e('0x13'),_0x4dcf87,_0x487e('0xc'));_0x27c661(_0x5a7a2[_0x487e('0x15')]['message']);}})[_0x487e('0x16')](function(_0x32dd2e){logger['error'](_0x487e('0x13'),_0x4dcf87,_0x32dd2e);_0x576ca1(_0x32dd2e);});});}exports[_0x487e('0x17')]=function(_0x4c0fd5){var _0x3b750b=this;return new Promise(function(_0x3579c3,_0x65e27d){return db[_0x487e('0x18')][_0x487e('0x19')](_0x4c0fd5[_0x487e('0x1a')],{'raw':_0x4c0fd5[_0x487e('0x1b')]?_0x4c0fd5[_0x487e('0x1b')][_0x487e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4ca1af){logger[_0x487e('0x14')](_0x487e('0x17'),_0x4c0fd5);logger['debug']('CreateChatQueueReport',_0x4c0fd5,JSON[_0x487e('0xf')](_0x4ca1af));_0x3579c3(_0x4ca1af);})[_0x487e('0x16')](function(_0x4675df){logger[_0x487e('0x10')](_0x487e('0x17'),_0x4675df[_0x487e('0x12')],_0x4c0fd5);_0x65e27d(_0x3b750b[_0x487e('0x10')](0x1f4,_0x4675df[_0x487e('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x377602){var _0x458073=this;return new Promise(function(_0x5623b0,_0x48e3cf){return db[_0x487e('0x18')][_0x487e('0x1d')](_0x377602[_0x487e('0x1a')],{'raw':_0x377602['options']?_0x377602['options'][_0x487e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')][_0x487e('0x1e')]||null:null,'attributes':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')][_0x487e('0x1f')]||null:null,'limit':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')]['limit']||null:null})[_0x487e('0xb')](function(_0x3bdf96){logger['info'](_0x487e('0x20'),_0x377602);logger[_0x487e('0xd')](_0x487e('0x20'),_0x377602,JSON['stringify'](_0x3bdf96));_0x5623b0(_0x3bdf96);})[_0x487e('0x16')](function(_0x490e81){logger[_0x487e('0x10')]('UpdateChatQueueReport',_0x490e81[_0x487e('0x12')],_0x377602);_0x48e3cf(_0x458073[_0x487e('0x10')](0x1f4,_0x490e81['message']));});});}; \ No newline at end of file +var _0xf289=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateChatQueueReport','create','body','catch','UpdateChatQueueReport','ChatQueueReport','update','options','raw','where','limit'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xf289,0x132));var _0x9f28=function(_0x114d21,_0x2dd56c){_0x114d21=_0x114d21-0x0;var _0x189038=_0xf289[_0x114d21];return _0x189038;};'use strict';var _=require(_0x9f28('0x0'));var util=require(_0x9f28('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f28('0x2'));var fs=require('fs');var Redis=require(_0x9f28('0x3'));var db=require(_0x9f28('0x4'))['db'];var utils=require(_0x9f28('0x5'));var logger=require(_0x9f28('0x6'))(_0x9f28('0x7'));var config=require(_0x9f28('0x8'));var jayson=require(_0x9f28('0x9'));var client=jayson[_0x9f28('0xa')][_0x9f28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c5ae5,_0x233e1d,_0x8e5cde){return new BPromise(function(_0x183370,_0x235ae9){return client[_0x9f28('0xc')](_0x1c5ae5,_0x8e5cde)[_0x9f28('0xd')](function(_0x4e018c){logger[_0x9f28('0xe')](_0x9f28('0xf'),_0x233e1d,_0x9f28('0x10'));logger[_0x9f28('0x11')](_0x9f28('0x12'),_0x233e1d,_0x9f28('0x10'),JSON[_0x9f28('0x13')](_0x4e018c));if(_0x4e018c[_0x9f28('0x14')]){if(_0x4e018c[_0x9f28('0x14')][_0x9f28('0x15')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x233e1d,_0x4e018c[_0x9f28('0x14')]['message']);return _0x235ae9(_0x4e018c['error'][_0x9f28('0x16')]);}logger[_0x9f28('0x14')](_0x9f28('0xf'),_0x233e1d,_0x4e018c[_0x9f28('0x14')][_0x9f28('0x16')]);return _0x183370(_0x4e018c[_0x9f28('0x14')][_0x9f28('0x16')]);}else{logger[_0x9f28('0xe')](_0x9f28('0xf'),_0x233e1d,_0x9f28('0x10'));_0x183370(_0x4e018c['result']['message']);}})['catch'](function(_0x2ae20f){logger[_0x9f28('0x14')](_0x9f28('0xf'),_0x233e1d,_0x2ae20f);_0x235ae9(_0x2ae20f);});});}exports[_0x9f28('0x17')]=function(_0x3bb71){var _0x1c71e2=this;return new Promise(function(_0xbe0cb8,_0x55f210){return db['ChatQueueReport'][_0x9f28('0x18')](_0x3bb71[_0x9f28('0x19')],{'raw':_0x3bb71['options']?_0x3bb71['options']['raw']===undefined?!![]:![]:!![]})[_0x9f28('0xd')](function(_0x8f491e){logger['info'](_0x9f28('0x17'),_0x3bb71);logger[_0x9f28('0x11')](_0x9f28('0x17'),_0x3bb71,JSON['stringify'](_0x8f491e));_0xbe0cb8(_0x8f491e);})[_0x9f28('0x1a')](function(_0x2b9b63){logger[_0x9f28('0x14')](_0x9f28('0x17'),_0x2b9b63[_0x9f28('0x16')],_0x3bb71);_0x55f210(_0x1c71e2['error'](0x1f4,_0x2b9b63[_0x9f28('0x16')]));});});};exports[_0x9f28('0x1b')]=function(_0x5d6ff4){var _0x487c94=this;return new Promise(function(_0x4f461f,_0x15682d){return db[_0x9f28('0x1c')][_0x9f28('0x1d')](_0x5d6ff4['body'],{'raw':_0x5d6ff4[_0x9f28('0x1e')]?_0x5d6ff4[_0x9f28('0x1e')][_0x9f28('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6ff4[_0x9f28('0x1e')]?_0x5d6ff4[_0x9f28('0x1e')][_0x9f28('0x20')]||null:null,'attributes':_0x5d6ff4[_0x9f28('0x1e')]?_0x5d6ff4[_0x9f28('0x1e')]['attributes']||null:null,'limit':_0x5d6ff4['options']?_0x5d6ff4['options'][_0x9f28('0x21')]||null:null})[_0x9f28('0xd')](function(_0x3e68ba){logger[_0x9f28('0xe')](_0x9f28('0x1b'),_0x5d6ff4);logger[_0x9f28('0x11')](_0x9f28('0x1b'),_0x5d6ff4,JSON['stringify'](_0x3e68ba));_0x4f461f(_0x3e68ba);})[_0x9f28('0x1a')](function(_0x4633d5){logger[_0x9f28('0x14')](_0x9f28('0x1b'),_0x4633d5[_0x9f28('0x16')],_0x5d6ff4);_0x15682d(_0x487c94[_0x9f28('0x14')](0x1f4,_0x4633d5[_0x9f28('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7207e59..e44e9d1 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 _0xb2e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x2478fc,_0x41df49){var _0x473f4c=function(_0x31dd33){while(--_0x31dd33){_0x2478fc['push'](_0x2478fc['shift']());}};_0x473f4c(++_0x41df49);}(_0xb2e2,0xac));var _0x2b2e=function(_0x37eaa4,_0x57e9a3){_0x37eaa4=_0x37eaa4-0x0;var _0x202f03=_0xb2e2[_0x37eaa4];return _0x202f03;};'use strict';var multer=require('multer');var util=require(_0x2b2e('0x0'));var path=require(_0x2b2e('0x1'));var timeout=require(_0x2b2e('0x2'));var express=require(_0x2b2e('0x3'));var router=express[_0x2b2e('0x4')]();var fs_extra=require(_0x2b2e('0x5'));var auth=require(_0x2b2e('0x6'));var interaction=require(_0x2b2e('0x7'));var config=require('../../config/environment');var controller=require(_0x2b2e('0x8'));router[_0x2b2e('0x9')]('/',auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xb')]);router[_0x2b2e('0x9')](_0x2b2e('0xc'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xd')]);router[_0x2b2e('0x9')](_0x2b2e('0xe'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xf')]);router[_0x2b2e('0x10')]('/',auth['isAuthenticated'](),controller[_0x2b2e('0x11')]);router[_0x2b2e('0x12')](_0x2b2e('0xe'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0x13')]);router[_0x2b2e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b2e('0x15')]=router; \ No newline at end of file +var _0x89c9=['show','post','create','/:id','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x39f4b2,_0x5eaa78){var _0x3721de=function(_0x5d6f45){while(--_0x5d6f45){_0x39f4b2['push'](_0x39f4b2['shift']());}};_0x3721de(++_0x5eaa78);}(_0x89c9,0x14a));var _0x989c=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0x89c9[_0x3fc5d8];return _0x25307a;};'use strict';var multer=require(_0x989c('0x0'));var util=require(_0x989c('0x1'));var path=require('path');var timeout=require(_0x989c('0x2'));var express=require('express');var router=express[_0x989c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x989c('0x4'));var interaction=require(_0x989c('0x5'));var config=require(_0x989c('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x989c('0x7')](),controller[_0x989c('0x8')]);router[_0x989c('0x9')](_0x989c('0xa'),auth[_0x989c('0x7')](),controller[_0x989c('0xb')]);router[_0x989c('0x9')]('/:id',auth[_0x989c('0x7')](),controller[_0x989c('0xc')]);router[_0x989c('0xd')]('/',auth[_0x989c('0x7')](),controller[_0x989c('0xe')]);router['put'](_0x989c('0xf'),auth[_0x989c('0x7')](),controller[_0x989c('0x10')]);router['delete'](_0x989c('0xf'),auth[_0x989c('0x7')](),controller[_0x989c('0x11')]);module[_0x989c('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index df11165..b40686d 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xb43b,0x1b2));var _0xbb43=function(_0x238cc2,_0x3c618d){_0x238cc2=_0x238cc2-0x0;var _0x293692=_0xb43b[_0x238cc2];return _0x293692;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x259b33,_0x55b714){_0x259b33=_0x259b33-0x0;var _0x5e3805=_0xb43b[_0x259b33];return _0x5e3805;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 4f4a4fb..dc66139 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 _0xf642=['index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','ChatTransferReport','findAll','rows','catch','params','keys','include','create','body','update','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','then','destroy','end','error','name'];(function(_0x1423f0,_0x18bb72){var _0x5dfea4=function(_0x240314){while(--_0x240314){_0x1423f0['push'](_0x1423f0['shift']());}};_0x5dfea4(++_0x18bb72);}(_0xf642,0xbc));var _0x2f64=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0xf642[_0x348652];return _0x18a9ea;};'use strict';var emlformat=require(_0x2f64('0x0'));var rimraf=require(_0x2f64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f64('0x2'));var BPromise=require(_0x2f64('0x3'));var Mustache=require(_0x2f64('0x4'));var util=require(_0x2f64('0x5'));var path=require(_0x2f64('0x6'));var sox=require(_0x2f64('0x7'));var csv=require(_0x2f64('0x8'));var ejs=require(_0x2f64('0x9'));var fs=require('fs');var fs_extra=require(_0x2f64('0xa'));var _=require(_0x2f64('0xb'));var squel=require(_0x2f64('0xc'));var crypto=require(_0x2f64('0xd'));var jsforce=require(_0x2f64('0xe'));var deskjs=require(_0x2f64('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2f64('0x10'));var Papa=require('papaparse');var Redis=require(_0x2f64('0x11'));var authService=require(_0x2f64('0x12'));var qs=require(_0x2f64('0x13'));var as=require(_0x2f64('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f64('0x15'))(_0x2f64('0x16'));var utils=require(_0x2f64('0x17'));var config=require(_0x2f64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f64('0x19'))['db'];function respondWithStatusCode(_0x4ca95a,_0x76b722){_0x76b722=_0x76b722||0xcc;return function(_0xa54e7b){if(_0xa54e7b){return _0x4ca95a[_0x2f64('0x1a')](_0x76b722);}return _0x4ca95a[_0x2f64('0x1b')](_0x76b722)['end']();};}function respondWithResult(_0x1c9ccd,_0x164125){_0x164125=_0x164125||0xc8;return function(_0xe94372){if(_0xe94372){return _0x1c9ccd[_0x2f64('0x1b')](_0x164125)[_0x2f64('0x1c')](_0xe94372);}};}function respondWithFilteredResult(_0x5c839f,_0x5d21ab){return function(_0x365413){if(_0x365413){var _0x338f05=typeof _0x5d21ab['offset']===_0x2f64('0x1d')&&typeof _0x5d21ab[_0x2f64('0x1e')]===_0x2f64('0x1d');var _0x2a22e5=_0x365413['count'];var _0x57c3d3=_0x338f05?0x0:_0x5d21ab[_0x2f64('0x1f')];var _0x230423=_0x338f05?_0x365413['count']:_0x5d21ab[_0x2f64('0x1f')]+_0x5d21ab[_0x2f64('0x1e')];var _0x14e056;if(_0x230423>=_0x2a22e5){_0x230423=_0x2a22e5;_0x14e056=0xc8;}else{_0x14e056=0xce;}_0x5c839f[_0x2f64('0x1b')](_0x14e056);return _0x5c839f[_0x2f64('0x20')]('Content-Range',_0x57c3d3+'-'+_0x230423+'/'+_0x2a22e5)[_0x2f64('0x1c')](_0x365413);}return null;};}function patchUpdates(_0x1d1acc){return function(_0x2591cd){try{jsonpatch[_0x2f64('0x21')](_0x2591cd,_0x1d1acc,!![]);}catch(_0x48b752){return BPromise[_0x2f64('0x22')](_0x48b752);}return _0x2591cd['save']();};}function saveUpdates(_0x4a32a9,_0x41fbaf){return function(_0x550a7f){if(_0x550a7f){return _0x550a7f['update'](_0x4a32a9)[_0x2f64('0x23')](function(_0x287b10){return _0x287b10;});}return null;};}function removeEntity(_0x38835,_0x392619){return function(_0x3a63ca){if(_0x3a63ca){return _0x3a63ca[_0x2f64('0x24')]()[_0x2f64('0x23')](function(){_0x38835[_0x2f64('0x1b')](0xcc)[_0x2f64('0x25')]();});}};}function handleEntityNotFound(_0x44ed92,_0x4dd7cf){return function(_0x1fc455){if(!_0x1fc455){_0x44ed92[_0x2f64('0x1a')](0x194);}return _0x1fc455;};}function handleError(_0x3e0d95,_0x587c84){_0x587c84=_0x587c84||0x1f4;return function(_0x340475){logger[_0x2f64('0x26')](_0x340475['stack']);if(_0x340475[_0x2f64('0x27')]){delete _0x340475[_0x2f64('0x27')];}_0x3e0d95[_0x2f64('0x1b')](_0x587c84)['send'](_0x340475);};}exports[_0x2f64('0x28')]=function(_0x124598,_0x2391ff){var _0x253a2a={},_0x118308={},_0x4bbded={'count':0x0,'rows':[]};var _0x1d66ec=_[_0x2f64('0x29')](db['ChatTransferReport'][_0x2f64('0x2a')],function(_0x203f8b){return{'name':_0x203f8b[_0x2f64('0x2b')],'type':_0x203f8b[_0x2f64('0x2c')][_0x2f64('0x2d')]};});_0x118308[_0x2f64('0x2e')]=_[_0x2f64('0x29')](_0x1d66ec,_0x2f64('0x27'));_0x118308[_0x2f64('0x2f')]=_['keys'](_0x124598[_0x2f64('0x2f')]);_0x118308['filters']=_[_0x2f64('0x30')](_0x118308[_0x2f64('0x2e')],_0x118308[_0x2f64('0x2f')]);_0x253a2a['attributes']=_[_0x2f64('0x30')](_0x118308[_0x2f64('0x2e')],qs[_0x2f64('0x31')](_0x124598['query'][_0x2f64('0x31')]));_0x253a2a[_0x2f64('0x32')]=_0x253a2a[_0x2f64('0x32')][_0x2f64('0x33')]?_0x253a2a[_0x2f64('0x32')]:_0x118308[_0x2f64('0x2e')];if(!_0x124598[_0x2f64('0x2f')][_0x2f64('0x34')](_0x2f64('0x35'))){_0x253a2a[_0x2f64('0x1e')]=qs[_0x2f64('0x1e')](_0x124598[_0x2f64('0x2f')]['limit']);_0x253a2a[_0x2f64('0x1f')]=qs['offset'](_0x124598[_0x2f64('0x2f')][_0x2f64('0x1f')]);}_0x253a2a['order']=qs[_0x2f64('0x36')](_0x124598[_0x2f64('0x2f')][_0x2f64('0x36')]);_0x253a2a['where']=qs[_0x2f64('0x37')](_[_0x2f64('0x38')](_0x124598[_0x2f64('0x2f')],_0x118308[_0x2f64('0x37')]),_0x1d66ec);if(_0x124598[_0x2f64('0x2f')][_0x2f64('0x39')]){_0x253a2a[_0x2f64('0x3a')]=_[_0x2f64('0x3b')](_0x253a2a[_0x2f64('0x3a')],{'$or':_['map'](_0x1d66ec,function(_0x4b0bee){if(_0x4b0bee[_0x2f64('0x2c')]!==_0x2f64('0x3c')){var _0x50b41f={};_0x50b41f[_0x4b0bee[_0x2f64('0x27')]]={'$like':'%'+_0x124598[_0x2f64('0x2f')][_0x2f64('0x39')]+'%'};return _0x50b41f;}})});}_0x253a2a=_[_0x2f64('0x3b')]({},_0x253a2a,_0x124598[_0x2f64('0x3d')]);var _0x245d31={'where':_0x253a2a[_0x2f64('0x3a')]};return db['ChatTransferReport'][_0x2f64('0x3e')](_0x245d31)[_0x2f64('0x23')](function(_0x2373d5){_0x4bbded[_0x2f64('0x3e')]=_0x2373d5;if(_0x124598[_0x2f64('0x2f')][_0x2f64('0x3f')]){_0x253a2a['include']=[{'all':!![]}];}return db[_0x2f64('0x40')][_0x2f64('0x41')](_0x253a2a);})['then'](function(_0x49f0ed){_0x4bbded[_0x2f64('0x42')]=_0x49f0ed;return _0x4bbded;})[_0x2f64('0x23')](respondWithFilteredResult(_0x2391ff,_0x253a2a))[_0x2f64('0x43')](handleError(_0x2391ff,null));};exports['show']=function(_0x53ebb3,_0x133a47){var _0x11a4af={'raw':!![],'where':{'id':_0x53ebb3[_0x2f64('0x44')]['id']}},_0x260d0f={};_0x260d0f['model']=_[_0x2f64('0x45')](db[_0x2f64('0x40')]['rawAttributes']);_0x260d0f[_0x2f64('0x2f')]=_[_0x2f64('0x45')](_0x53ebb3[_0x2f64('0x2f')]);_0x260d0f[_0x2f64('0x37')]=_[_0x2f64('0x30')](_0x260d0f[_0x2f64('0x2e')],_0x260d0f['query']);_0x11a4af['attributes']=_['intersection'](_0x260d0f['model'],qs['fields'](_0x53ebb3[_0x2f64('0x2f')]['fields']));_0x11a4af[_0x2f64('0x32')]=_0x11a4af[_0x2f64('0x32')]['length']?_0x11a4af[_0x2f64('0x32')]:_0x260d0f[_0x2f64('0x2e')];if(_0x53ebb3[_0x2f64('0x2f')][_0x2f64('0x3f')]){_0x11a4af[_0x2f64('0x46')]=[{'all':!![]}];}_0x11a4af=_[_0x2f64('0x3b')]({},_0x11a4af,_0x53ebb3[_0x2f64('0x3d')]);return db['ChatTransferReport']['find'](_0x11a4af)[_0x2f64('0x23')](handleEntityNotFound(_0x133a47,null))[_0x2f64('0x23')](respondWithResult(_0x133a47,null))[_0x2f64('0x43')](handleError(_0x133a47,null));};exports['create']=function(_0x5604ee,_0x58f2c4){return db[_0x2f64('0x40')][_0x2f64('0x47')](_0x5604ee[_0x2f64('0x48')],{})[_0x2f64('0x23')](respondWithResult(_0x58f2c4,0xc9))[_0x2f64('0x43')](handleError(_0x58f2c4,null));};exports[_0x2f64('0x49')]=function(_0x597502,_0x20fa85){if(_0x597502[_0x2f64('0x48')]['id']){delete _0x597502[_0x2f64('0x48')]['id'];}return db[_0x2f64('0x40')]['find']({'where':{'id':_0x597502['params']['id']}})['then'](handleEntityNotFound(_0x20fa85,null))[_0x2f64('0x23')](saveUpdates(_0x597502[_0x2f64('0x48')],null))[_0x2f64('0x23')](respondWithResult(_0x20fa85,null))[_0x2f64('0x43')](handleError(_0x20fa85,null));};exports[_0x2f64('0x24')]=function(_0x3375ef,_0x4f8679){return db[_0x2f64('0x40')][_0x2f64('0x4a')]({'where':{'id':_0x3375ef[_0x2f64('0x44')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0x4f8679,null))[_0x2f64('0x23')](removeEntity(_0x4f8679,null))['catch'](handleError(_0x4f8679,null));};exports[_0x2f64('0x4b')]=function(_0x30d7cf,_0x24b713){return db[_0x2f64('0x40')][_0x2f64('0x4b')]()[_0x2f64('0x23')](respondWithResult(_0x24b713,null))[_0x2f64('0x43')](handleError(_0x24b713,null));}; \ No newline at end of file +var _0x7a48=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','findAll','rows','show','keys','includeAll','include','find','create','body','catch','update','params','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7a48,0x116));var _0x87a4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7a48[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x87a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87a4('0x1'));var rp=require(_0x87a4('0x2'));var moment=require(_0x87a4('0x3'));var BPromise=require(_0x87a4('0x4'));var Mustache=require('mustache');var util=require(_0x87a4('0x5'));var path=require(_0x87a4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x87a4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87a4('0x8'));var squel=require(_0x87a4('0x9'));var crypto=require(_0x87a4('0xa'));var jsforce=require(_0x87a4('0xb'));var deskjs=require(_0x87a4('0xc'));var toCsv=require(_0x87a4('0xd'));var querystring=require(_0x87a4('0xe'));var Papa=require(_0x87a4('0xf'));var Redis=require(_0x87a4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87a4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87a4('0x12'))(_0x87a4('0x13'));var utils=require('../../config/utils');var config=require(_0x87a4('0x14'));var licenseUtil=require(_0x87a4('0x15'));var db=require(_0x87a4('0x16'))['db'];function respondWithStatusCode(_0x550b38,_0x4e261e){_0x4e261e=_0x4e261e||0xcc;return function(_0x2bfb2a){if(_0x2bfb2a){return _0x550b38[_0x87a4('0x17')](_0x4e261e);}return _0x550b38[_0x87a4('0x18')](_0x4e261e)[_0x87a4('0x19')]();};}function respondWithResult(_0x573f09,_0x31fe58){_0x31fe58=_0x31fe58||0xc8;return function(_0x2ea96e){if(_0x2ea96e){return _0x573f09[_0x87a4('0x18')](_0x31fe58)[_0x87a4('0x1a')](_0x2ea96e);}};}function respondWithFilteredResult(_0x356098,_0x54a876){return function(_0x4f5cab){if(_0x4f5cab){var _0x4a2679=typeof _0x54a876[_0x87a4('0x1b')]===_0x87a4('0x1c')&&typeof _0x54a876['limit']==='undefined';var _0x5b246a=_0x4f5cab[_0x87a4('0x1d')];var _0x357ffb=_0x4a2679?0x0:_0x54a876[_0x87a4('0x1b')];var _0x11d17f=_0x4a2679?_0x4f5cab[_0x87a4('0x1d')]:_0x54a876[_0x87a4('0x1b')]+_0x54a876['limit'];var _0x13f519;if(_0x11d17f>=_0x5b246a){_0x11d17f=_0x5b246a;_0x13f519=0xc8;}else{_0x13f519=0xce;}_0x356098['status'](_0x13f519);return _0x356098['set']('Content-Range',_0x357ffb+'-'+_0x11d17f+'/'+_0x5b246a)[_0x87a4('0x1a')](_0x4f5cab);}return null;};}function patchUpdates(_0x5167f0){return function(_0x58960a){try{jsonpatch[_0x87a4('0x1e')](_0x58960a,_0x5167f0,!![]);}catch(_0x3f686e){return BPromise[_0x87a4('0x1f')](_0x3f686e);}return _0x58960a[_0x87a4('0x20')]();};}function saveUpdates(_0x41c600,_0x4308d8){return function(_0x155642){if(_0x155642){return _0x155642['update'](_0x41c600)[_0x87a4('0x21')](function(_0x2e3103){return _0x2e3103;});}return null;};}function removeEntity(_0x36efb0,_0x5adc8b){return function(_0x42faa2){if(_0x42faa2){return _0x42faa2['destroy']()[_0x87a4('0x21')](function(){_0x36efb0[_0x87a4('0x18')](0xcc)[_0x87a4('0x19')]();});}};}function handleEntityNotFound(_0x129f12,_0x4b9727){return function(_0x4b0917){if(!_0x4b0917){_0x129f12['sendStatus'](0x194);}return _0x4b0917;};}function handleError(_0x5369bb,_0x241e9c){_0x241e9c=_0x241e9c||0x1f4;return function(_0x57e026){logger[_0x87a4('0x22')](_0x57e026[_0x87a4('0x23')]);if(_0x57e026[_0x87a4('0x24')]){delete _0x57e026[_0x87a4('0x24')];}_0x5369bb[_0x87a4('0x18')](_0x241e9c)[_0x87a4('0x25')](_0x57e026);};}exports[_0x87a4('0x26')]=function(_0x1bd55c,_0x2b7c5f){var _0x2107ad={},_0x473b09={},_0x3a1d20={'count':0x0,'rows':[]};var _0x4d94e9=_[_0x87a4('0x27')](db['ChatTransferReport'][_0x87a4('0x28')],function(_0x353578){return{'name':_0x353578['fieldName'],'type':_0x353578[_0x87a4('0x29')]['key']};});_0x473b09[_0x87a4('0x2a')]=_[_0x87a4('0x27')](_0x4d94e9,_0x87a4('0x24'));_0x473b09[_0x87a4('0x2b')]=_['keys'](_0x1bd55c[_0x87a4('0x2b')]);_0x473b09[_0x87a4('0x2c')]=_[_0x87a4('0x2d')](_0x473b09['model'],_0x473b09[_0x87a4('0x2b')]);_0x2107ad[_0x87a4('0x2e')]=_[_0x87a4('0x2d')](_0x473b09[_0x87a4('0x2a')],qs['fields'](_0x1bd55c[_0x87a4('0x2b')][_0x87a4('0x2f')]));_0x2107ad[_0x87a4('0x2e')]=_0x2107ad[_0x87a4('0x2e')][_0x87a4('0x30')]?_0x2107ad[_0x87a4('0x2e')]:_0x473b09[_0x87a4('0x2a')];if(!_0x1bd55c['query']['hasOwnProperty'](_0x87a4('0x31'))){_0x2107ad[_0x87a4('0x32')]=qs[_0x87a4('0x32')](_0x1bd55c[_0x87a4('0x2b')][_0x87a4('0x32')]);_0x2107ad[_0x87a4('0x1b')]=qs[_0x87a4('0x1b')](_0x1bd55c[_0x87a4('0x2b')]['offset']);}_0x2107ad[_0x87a4('0x33')]=qs['sort'](_0x1bd55c['query'][_0x87a4('0x34')]);_0x2107ad[_0x87a4('0x35')]=qs[_0x87a4('0x2c')](_[_0x87a4('0x36')](_0x1bd55c[_0x87a4('0x2b')],_0x473b09[_0x87a4('0x2c')]),_0x4d94e9);if(_0x1bd55c[_0x87a4('0x2b')][_0x87a4('0x37')]){_0x2107ad[_0x87a4('0x35')]=_[_0x87a4('0x38')](_0x2107ad[_0x87a4('0x35')],{'$or':_['map'](_0x4d94e9,function(_0x26de6c){if(_0x26de6c[_0x87a4('0x29')]!==_0x87a4('0x39')){var _0xae37c3={};_0xae37c3[_0x26de6c[_0x87a4('0x24')]]={'$like':'%'+_0x1bd55c[_0x87a4('0x2b')][_0x87a4('0x37')]+'%'};return _0xae37c3;}})});}_0x2107ad=_[_0x87a4('0x38')]({},_0x2107ad,_0x1bd55c[_0x87a4('0x3a')]);var _0x996885={'where':_0x2107ad[_0x87a4('0x35')]};return db[_0x87a4('0x3b')][_0x87a4('0x1d')](_0x996885)[_0x87a4('0x21')](function(_0x513b95){_0x3a1d20['count']=_0x513b95;if(_0x1bd55c[_0x87a4('0x2b')]['includeAll']){_0x2107ad['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x87a4('0x3c')](_0x2107ad);})[_0x87a4('0x21')](function(_0x5d8305){_0x3a1d20[_0x87a4('0x3d')]=_0x5d8305;return _0x3a1d20;})[_0x87a4('0x21')](respondWithFilteredResult(_0x2b7c5f,_0x2107ad))['catch'](handleError(_0x2b7c5f,null));};exports[_0x87a4('0x3e')]=function(_0x4939d7,_0x39aeff){var _0x509d33={'raw':!![],'where':{'id':_0x4939d7['params']['id']}},_0x98a32a={};_0x98a32a[_0x87a4('0x2a')]=_['keys'](db[_0x87a4('0x3b')][_0x87a4('0x28')]);_0x98a32a[_0x87a4('0x2b')]=_[_0x87a4('0x3f')](_0x4939d7['query']);_0x98a32a[_0x87a4('0x2c')]=_[_0x87a4('0x2d')](_0x98a32a['model'],_0x98a32a[_0x87a4('0x2b')]);_0x509d33['attributes']=_[_0x87a4('0x2d')](_0x98a32a[_0x87a4('0x2a')],qs['fields'](_0x4939d7[_0x87a4('0x2b')][_0x87a4('0x2f')]));_0x509d33['attributes']=_0x509d33['attributes']['length']?_0x509d33[_0x87a4('0x2e')]:_0x98a32a['model'];if(_0x4939d7[_0x87a4('0x2b')][_0x87a4('0x40')]){_0x509d33[_0x87a4('0x41')]=[{'all':!![]}];}_0x509d33=_['merge']({},_0x509d33,_0x4939d7[_0x87a4('0x3a')]);return db[_0x87a4('0x3b')][_0x87a4('0x42')](_0x509d33)['then'](handleEntityNotFound(_0x39aeff,null))[_0x87a4('0x21')](respondWithResult(_0x39aeff,null))['catch'](handleError(_0x39aeff,null));};exports[_0x87a4('0x43')]=function(_0x5b94b8,_0x49f558){return db[_0x87a4('0x3b')][_0x87a4('0x43')](_0x5b94b8[_0x87a4('0x44')],{})[_0x87a4('0x21')](respondWithResult(_0x49f558,0xc9))[_0x87a4('0x45')](handleError(_0x49f558,null));};exports[_0x87a4('0x46')]=function(_0x44fb7e,_0x456bc4){if(_0x44fb7e[_0x87a4('0x44')]['id']){delete _0x44fb7e[_0x87a4('0x44')]['id'];}return db[_0x87a4('0x3b')]['find']({'where':{'id':_0x44fb7e[_0x87a4('0x47')]['id']}})[_0x87a4('0x21')](handleEntityNotFound(_0x456bc4,null))['then'](saveUpdates(_0x44fb7e[_0x87a4('0x44')],null))['then'](respondWithResult(_0x456bc4,null))[_0x87a4('0x45')](handleError(_0x456bc4,null));};exports[_0x87a4('0x48')]=function(_0x5a232d,_0x272faf){return db['ChatTransferReport'][_0x87a4('0x42')]({'where':{'id':_0x5a232d[_0x87a4('0x47')]['id']}})[_0x87a4('0x21')](handleEntityNotFound(_0x272faf,null))['then'](removeEntity(_0x272faf,null))['catch'](handleError(_0x272faf,null));};exports[_0x87a4('0x49')]=function(_0xfbc13b,_0x590f93){return db[_0x87a4('0x3b')]['describe']()[_0x87a4('0x21')](respondWithResult(_0x590f93,null))['catch'](handleError(_0x590f93,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9ac6bb7..ee20f17 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 _0x10dd=['./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x10dd,0xc9));var _0xd10d=function(_0x2c7d77,_0xb60231){_0x2c7d77=_0x2c7d77-0x0;var _0x54481d=_0x10dd[_0x2c7d77];return _0x54481d;};'use strict';var _=require(_0xd10d('0x0'));var util=require(_0xd10d('0x1'));var logger=require(_0xd10d('0x2'))('api');var moment=require(_0xd10d('0x3'));var BPromise=require(_0xd10d('0x4'));var rp=require(_0xd10d('0x5'));var fs=require('fs');var path=require(_0xd10d('0x6'));var rimraf=require(_0xd10d('0x7'));var config=require(_0xd10d('0x8'));var attributes=require(_0xd10d('0x9'));module[_0xd10d('0xa')]=function(_0x124bbc,_0x229f92){return _0x124bbc['define'](_0xd10d('0xb'),attributes,{'tableName':_0xd10d('0xc'),'paranoid':![],'indexes':[{'name':_0xd10d('0xd'),'fields':[_0xd10d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb1b=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0xcb1b,0x1e0));var _0xbcb1=function(_0x13908b,_0x198bf8){_0x13908b=_0x13908b-0x0;var _0x171c6d=_0xcb1b[_0x13908b];return _0x171c6d;};'use strict';var _=require(_0xbcb1('0x0'));var util=require(_0xbcb1('0x1'));var logger=require('../../config/logger')(_0xbcb1('0x2'));var moment=require(_0xbcb1('0x3'));var BPromise=require(_0xbcb1('0x4'));var rp=require(_0xbcb1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcb1('0x6'));var config=require(_0xbcb1('0x7'));var attributes=require('./chatTransferReport.attributes');module[_0xbcb1('0x8')]=function(_0x1c8115,_0x34a94c){return _0x1c8115[_0xbcb1('0x9')](_0xbcb1('0xa'),attributes,{'tableName':_0xbcb1('0xb'),'paranoid':![],'indexes':[{'name':_0xbcb1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index dc13569..75fad4a 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 _0xd39c=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x40c61d,_0x50d58f){var _0x3d7a64=function(_0x5e651a){while(--_0x5e651a){_0x40c61d['push'](_0x40c61d['shift']());}};_0x3d7a64(++_0x50d58f);}(_0xd39c,0xc3));var _0xcd39=function(_0x1ed107,_0x1a23f0){_0x1ed107=_0x1ed107-0x0;var _0x1958a7=_0xd39c[_0x1ed107];return _0x1958a7;};'use strict';var _=require(_0xcd39('0x0'));var util=require(_0xcd39('0x1'));var moment=require(_0xcd39('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd39('0x3'));var fs=require('fs');var Redis=require(_0xcd39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd39('0x5'));var logger=require('../../config/logger')(_0xcd39('0x6'));var config=require(_0xcd39('0x7'));var jayson=require(_0xcd39('0x8'));var client=jayson[_0xcd39('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3498,_0x291a05,_0x5cbb63){return new BPromise(function(_0x508522,_0x709e9){return client[_0xcd39('0xa')](_0x5a3498,_0x5cbb63)['then'](function(_0x5c110d){logger[_0xcd39('0xb')](_0xcd39('0xc'),_0x291a05,_0xcd39('0xd'));logger['debug'](_0xcd39('0xe'),_0x291a05,_0xcd39('0xd'),JSON[_0xcd39('0xf')](_0x5c110d));if(_0x5c110d[_0xcd39('0x10')]){if(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x11')]===0x1f4){logger[_0xcd39('0x10')](_0xcd39('0xc'),_0x291a05,_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);return _0x709e9(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);return _0x508522(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0xcd39('0xd'));_0x508522(_0x5c110d[_0xcd39('0x13')][_0xcd39('0x12')]);}})['catch'](function(_0x4a4acc){logger[_0xcd39('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0x4a4acc);_0x709e9(_0x4a4acc);});});} \ No newline at end of file +var _0x780b=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x780b,0x106));var _0xb780=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x780b[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xb780('0x0'));var util=require(_0xb780('0x1'));var moment=require(_0xb780('0x2'));var BPromise=require(_0xb780('0x3'));var rs=require(_0xb780('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb780('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb780('0x6'))(_0xb780('0x7'));var config=require(_0xb780('0x8'));var jayson=require(_0xb780('0x9'));var client=jayson[_0xb780('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77500e,_0x1c0ac7,_0x4da610){return new BPromise(function(_0x56746d,_0x226a23){return client['request'](_0x77500e,_0x4da610)[_0xb780('0xb')](function(_0x57a106){logger[_0xb780('0xc')](_0xb780('0xd'),_0x1c0ac7,_0xb780('0xe'));logger[_0xb780('0xf')](_0xb780('0x10'),_0x1c0ac7,_0xb780('0xe'),JSON[_0xb780('0x11')](_0x57a106));if(_0x57a106['error']){if(_0x57a106[_0xb780('0x12')][_0xb780('0x13')]===0x1f4){logger['error'](_0xb780('0xd'),_0x1c0ac7,_0x57a106[_0xb780('0x12')][_0xb780('0x14')]);return _0x226a23(_0x57a106[_0xb780('0x12')]['message']);}logger[_0xb780('0x12')](_0xb780('0xd'),_0x1c0ac7,_0x57a106[_0xb780('0x12')][_0xb780('0x14')]);return _0x56746d(_0x57a106['error'][_0xb780('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x1c0ac7,_0xb780('0xe'));_0x56746d(_0x57a106[_0xb780('0x15')]['message']);}})['catch'](function(_0x5d4df4){logger['error'](_0xb780('0xd'),_0x1c0ac7,_0x5d4df4);_0x226a23(_0x5d4df4);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index dc450df..b2afd25 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 _0xbc90=['create','put','delete','destroy','exports','multer','util','express','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xbc90,0xfc));var _0x0bc9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xbc90[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x0bc9('0x0'));var util=require(_0x0bc9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0bc9('0x2'));var router=express['Router']();var fs_extra=require(_0x0bc9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0bc9('0x4'));var controller=require(_0x0bc9('0x5'));router[_0x0bc9('0x6')]('/',auth[_0x0bc9('0x7')](),controller[_0x0bc9('0x8')]);router[_0x0bc9('0x6')](_0x0bc9('0x9'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0xa')]);router[_0x0bc9('0x6')](_0x0bc9('0xb'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0xc')]);router[_0x0bc9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0bc9('0xe')]);router[_0x0bc9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0bc9('0x10')](_0x0bc9('0xb'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0x11')]);module[_0x0bc9('0x12')]=router; \ No newline at end of file +var _0xa15f=['describe','/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa15f,0x1e3));var _0xfa15=function(_0x150165,_0x27704e){_0x150165=_0x150165-0x0;var _0x562248=_0xa15f[_0x150165];return _0x562248;};'use strict';var multer=require(_0xfa15('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa15('0x1'));var express=require(_0xfa15('0x2'));var router=express[_0xfa15('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfa15('0x4'));var interaction=require(_0xfa15('0x5'));var config=require(_0xfa15('0x6'));var controller=require('./chatTransferReport.controller');router[_0xfa15('0x7')]('/',auth['isAuthenticated'](),controller[_0xfa15('0x8')]);router[_0xfa15('0x7')](_0xfa15('0x9'),auth[_0xfa15('0xa')](),controller[_0xfa15('0xb')]);router[_0xfa15('0x7')](_0xfa15('0xc'),auth[_0xfa15('0xa')](),controller[_0xfa15('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa15('0xe')]);router[_0xfa15('0xf')](_0xfa15('0xc'),auth[_0xfa15('0xa')](),controller[_0xfa15('0x10')]);router['delete'](_0xfa15('0xc'),auth[_0xfa15('0xa')](),controller[_0xfa15('0x11')]);module[_0xfa15('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 2cd1aad..79d7b81 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 _0xc5e8=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','stringify','name','text','input','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5e8,0xf2));var _0x8c5e=function(_0x22acf7,_0x264c90){_0x22acf7=_0x22acf7-0x0;var _0x403e6e=_0xc5e8[_0x22acf7];return _0x403e6e;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x8c5e('0x0')]={'name':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'unique':_0x8c5e('0x2')},'description':{'type':Sequelize[_0x8c5e('0x1')]},'mapKey':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x4')},'customerAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8c5e('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0x8c5e('0x8')},'header_online':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x9')},'start_chat_button':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0xb')},'header_offline':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xc')},'download_transcript':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8c5e('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x11')},'placeholderMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0xb')},'skipMessageButton':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x8c5e('0x15')](_0x8c5e('0x16'),_0x8c5e('0x17')),'defaultValue':_0x8c5e('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8c5e('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x8c5e('0x19'),'type':_0x8c5e('0x1a'),'required':!![]},'props':{'title':_0x8c5e('0x19'),'helpText':''}},{'type':_0x8c5e('0x1b'),'props':{'title':_0x8c5e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8c5e('0x3'),'type':_0x8c5e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8c5e('0x1c'))?JSON[_0x8c5e('0x1d')](this[_0x8c5e('0x1e')](_0x8c5e('0x1c'))):{};},'set':function(_0x459e51){return this[_0x8c5e('0x1f')]('onlineForm',JSON[_0x8c5e('0x18')](_0x459e51));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8c5e('0x1b'),'props':{'title':_0x8c5e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8c5e('0x3'),'type':_0x8c5e('0x3')},'variable':null},{'type':_0x8c5e('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x8c5e('0x21'),'helpText':_0x8c5e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x8c5e('0x1e')]('offlineForm')?JSON[_0x8c5e('0x1d')](this['getDataValue'](_0x8c5e('0x23'))):{};},'set':function(_0x41c730){return this[_0x8c5e('0x1f')](_0x8c5e('0x23'),JSON['stringify'](_0x41c730));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8c5e('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x25')},'skipUnmanaged':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8c5e('0xf')],'defaultValue':function(){return _0x8c5e('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x28')},'messagesAlignment':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x29')},'defaultTitle':{'type':Sequelize[_0x8c5e('0x1')]},'customerAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c5e('0x7')],'comment':_0x8c5e('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![],'comment':_0x8c5e('0x2c'),'set':function(_0x718e00){if(!_0x718e00)this['setDataValue'](_0x8c5e('0x2d'),null);this[_0x8c5e('0x1f')]('mandatoryDisposition',_0x718e00);}},'vidaooEscalation':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8c5e('0x1')]},'vidaooTopic':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8c5e('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x8c5e('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8c5e('0xf')]}}; \ No newline at end of file +var _0x7fd5=['squared','rounded','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','thumb','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','CHAT','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN'];(function(_0x2229ae,_0x5eddad){var _0x401270=function(_0x1a106f){while(--_0x1a106f){_0x2229ae['push'](_0x2229ae['shift']());}};_0x401270(++_0x5eddad);}(_0x7fd5,0x14d));var _0x57fd=function(_0x425036,_0x39bebc){_0x425036=_0x425036-0x0;var _0x7fc880=_0x7fd5[_0x425036];return _0x7fc880;};'use strict';var Sequelize=require(_0x57fd('0x0'));var rs=require(_0x57fd('0x1'));module[_0x57fd('0x2')]={'name':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'unique':_0x57fd('0x4')},'description':{'type':Sequelize[_0x57fd('0x3')]},'mapKey':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x6')},'customerAlias':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'defaultValue':_0x57fd('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x57fd('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x57fd('0xa')),'defaultValue':_0x57fd('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0xc')},'header_offline':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x57fd('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x57fd('0xf')]},'closingQuestion':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x12')},'noteTitle':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x13')},'placeholderMessage':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x14')},'closingMessageButton':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0xc')},'skipMessageButton':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x15')},'ratingType':{'type':Sequelize[_0x57fd('0x16')]('star',_0x57fd('0x17')),'defaultValue':_0x57fd('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x57fd('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x57fd('0xf')],'defaultValue':function(){return JSON[_0x57fd('0x19')]({'items':[{'type':_0x57fd('0x1a'),'variable':null,'config':{'placeholder':_0x57fd('0x1b'),'type':'text','required':!![]},'props':{'title':_0x57fd('0x1b'),'helpText':''}},{'type':_0x57fd('0x1a'),'props':{'title':_0x57fd('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x57fd('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x57fd('0x1c')](_0x57fd('0x1d'))?JSON[_0x57fd('0x1e')](this[_0x57fd('0x1c')]('onlineForm')):{};},'set':function(_0x536e35){return this[_0x57fd('0x1f')]('onlineForm',JSON[_0x57fd('0x19')](_0x536e35));}},'offlineForm':{'type':Sequelize[_0x57fd('0xf')],'defaultValue':function(){return JSON[_0x57fd('0x19')]({'items':[{'type':_0x57fd('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x57fd('0x5')},'variable':null},{'type':_0x57fd('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x57fd('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x57fd('0x1c')](_0x57fd('0x22'))?JSON[_0x57fd('0x1e')](this[_0x57fd('0x1c')](_0x57fd('0x22'))):{};},'set':function(_0x36f67d){return this[_0x57fd('0x1f')](_0x57fd('0x22'),JSON[_0x57fd('0x19')](_0x36f67d));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x57fd('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x57fd('0x3')]},'forwardOffline':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x57fd('0x3')]},'waitingTitle':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x24')},'waitingMessage':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0x26')},'offlineMessageBody':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x57fd('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x57fd('0x3')]},'notificationTemplate':{'type':Sequelize[_0x57fd('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x57fd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x2a')},'verticalAlignment':{'type':Sequelize[_0x57fd('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':_0x57fd('0x2b')},'messagesAlignment':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x57fd('0x3')]},'customerAvatar':{'type':Sequelize[_0x57fd('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x57fd('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57fd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x57fd('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x57fd('0x2c')},'systemAvatar':{'type':Sequelize[_0x57fd('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x57fd('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1da168){if(!_0x1da168)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x57fd('0x2e'),_0x1da168);}},'vidaooEscalation':{'type':Sequelize[_0x57fd('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x57fd('0x3')],'allowNull':![],'defaultValue':_0x57fd('0x2f')},'vidaooNote':{'type':Sequelize[_0x57fd('0x3')],'defaultValue':function(){return _0x57fd('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x57fd('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x57fd('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 54dca47..10e421b 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 _0xb7e7=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','Disposition','getDispositions','length','order','ChatWebsiteId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','Start','startRouting','EventManager','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0xee3a14,_0x438a19){var _0x553638=function(_0x4090c1){while(--_0x4090c1){_0xee3a14['push'](_0xee3a14['shift']());}};_0x553638(++_0x438a19);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var BPromise=require(_0x7b7e('0x0'));var Mustache=require('mustache');var util=require(_0x7b7e('0x1'));var path=require('path');var ejs=require(_0x7b7e('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b7e('0x3'));var querystring=require('querystring');var Redis=require(_0x7b7e('0x4'));var qs=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('api');var config=require('../../config/environment');var db=require(_0x7b7e('0x7'))['db'];config[_0x7b7e('0x8')]=_[_0x7b7e('0x9')](config['redis'],{'host':_0x7b7e('0xa'),'port':0x18eb});var socket=require(_0x7b7e('0xb'))(new Redis(config[_0x7b7e('0x8')]));require(_0x7b7e('0xc'))[_0x7b7e('0xd')](socket);var htmlToText=require(_0x7b7e('0xe'));var jayson=require(_0x7b7e('0xf'));var client=jayson['client'][_0x7b7e('0x10')]({'port':0x232c});var client9002=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232a});var client9003=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232b});var client9001=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x55620b,_0xaadda,_0x54d8ce,_0x267446){return new BPromise(function(_0x430eab,_0x50d7d2){var _0x422d3a=_0x267446||client;return _0x422d3a['request'](_0x55620b,_0x54d8ce)['then'](function(_0x2889ed){logger[_0x7b7e('0x12')](_0x7b7e('0x13'),_0xaadda,_0x7b7e('0x14'));logger[_0x7b7e('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xaadda,'request\x20sent',JSON[_0x7b7e('0x16')](_0x2889ed));if(_0x2889ed[_0x7b7e('0x17')]){if(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x18')]===0x1f4){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x50d7d2(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x430eab(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}else{logger[_0x7b7e('0x12')]('ChatWebsite,\x20%s,\x20%s',_0xaadda,_0x7b7e('0x14'));_0x430eab(_0x2889ed[_0x7b7e('0x1a')][_0x7b7e('0x19')]);}})['catch'](function(_0x313122){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x313122);_0x50d7d2(_0x313122);});});}function respondWithStatusCode(_0x200156,_0x2b7211){_0x2b7211=_0x2b7211||0xcc;return function(_0x303d8c){if(_0x303d8c){return _0x200156[_0x7b7e('0x1b')](_0x2b7211);}return _0x200156[_0x7b7e('0x1c')](_0x2b7211)['end']();};}function respondWithResult(_0x5d6215,_0x4a836a){_0x4a836a=_0x4a836a||0xc8;return function(_0x26ee14){if(_0x26ee14){return _0x5d6215[_0x7b7e('0x1c')](_0x4a836a)[_0x7b7e('0x1d')](_0x26ee14);}};}function respondWithFilteredResult(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(_0x5dadbb){var _0x182245=typeof _0x51d3b1[_0x7b7e('0x1e')]===_0x7b7e('0x1f')&&typeof _0x51d3b1[_0x7b7e('0x20')]===_0x7b7e('0x1f');var _0x48fad1=_0x5dadbb[_0x7b7e('0x21')];var _0x21a15=_0x182245?0x0:_0x51d3b1['offset'];var _0x57b9da=_0x182245?_0x5dadbb['count']:_0x51d3b1[_0x7b7e('0x1e')]+_0x51d3b1[_0x7b7e('0x20')];var _0x503625;if(_0x57b9da>=_0x48fad1){_0x57b9da=_0x48fad1;_0x503625=0xc8;}else{_0x503625=0xce;}_0x483c6f[_0x7b7e('0x1c')](_0x503625);return _0x483c6f['set'](_0x7b7e('0x22'),_0x21a15+'-'+_0x57b9da+'/'+_0x48fad1)[_0x7b7e('0x1d')](_0x5dadbb);}return null;};}function saveUpdates(_0x27b525){return function(_0x5515ca){if(_0x5515ca){return _0x5515ca[_0x7b7e('0x23')](_0x27b525)[_0x7b7e('0x24')](function(_0x35602a){return _0x35602a;});}return null;};}function removeEntity(_0x326dd2){return function(_0x33f9a1){if(_0x33f9a1){return _0x33f9a1['destroy']()[_0x7b7e('0x24')](function(){var _0x51c010=_0x33f9a1[_0x7b7e('0x25')]({'plain':!![]});var _0x1c7de4=_0x7b7e('0x26');return db[_0x7b7e('0x27')][_0x7b7e('0x28')]({'where':{'type':_0x1c7de4,'resourceId':_0x51c010['id']}})[_0x7b7e('0x24')](function(){return _0x33f9a1;});})[_0x7b7e('0x24')](function(){_0x326dd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xebcdbc){return function(_0x162b84){if(!_0x162b84){_0xebcdbc['sendStatus'](0x194);}return _0x162b84;};}function handleError(_0x3a3bc7,_0x2a4754){_0x2a4754=_0x2a4754||0x1f4;return function(_0x2ca366){logger['error'](_0x2ca366[_0x7b7e('0x29')]);if(_0x2ca366[_0x7b7e('0x2a')]){delete _0x2ca366[_0x7b7e('0x2a')];}_0x3a3bc7[_0x7b7e('0x1c')](_0x2a4754)[_0x7b7e('0x2b')](_0x2ca366);};}exports[_0x7b7e('0x2c')]=function(_0x3e8cf4,_0x202f04){var _0x44497c={'include':[{'model':db[_0x7b7e('0x2d')],'as':_0x7b7e('0x2e')}]},_0x39b3bb={},_0xd5a64d={'count':0x0,'rows':[]};var _0xdcb8ef=_[_0x7b7e('0x2f')](db[_0x7b7e('0x30')]['rawAttributes'],function(_0x8c80d5){return{'name':_0x8c80d5[_0x7b7e('0x31')],'type':_0x8c80d5[_0x7b7e('0x32')][_0x7b7e('0x33')]};});_0x39b3bb[_0x7b7e('0x34')]=_[_0x7b7e('0x2f')](_0xdcb8ef,_0x7b7e('0x2a'));_0x39b3bb[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x3e8cf4[_0x7b7e('0x35')]);_0x39b3bb['filters']=_[_0x7b7e('0x37')](_0x39b3bb[_0x7b7e('0x34')],_0x39b3bb[_0x7b7e('0x35')]);_0x44497c[_0x7b7e('0x38')]=_['intersection'](_0x39b3bb[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x3e8cf4[_0x7b7e('0x35')]['fields']));_0x44497c['attributes']=_0x44497c[_0x7b7e('0x38')]['length']?_0x44497c[_0x7b7e('0x38')]:_0x39b3bb[_0x7b7e('0x34')];if(!_0x3e8cf4['query'][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x44497c[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x44497c[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3e8cf4[_0x7b7e('0x35')]['offset']);}_0x44497c['order']=qs[_0x7b7e('0x3c')](_0x3e8cf4['query'][_0x7b7e('0x3c')]);_0x44497c['where']=qs['filters'](_[_0x7b7e('0x3d')](_0x3e8cf4['query'],_0x39b3bb[_0x7b7e('0x3e')]),_0xdcb8ef);if(_0x3e8cf4['query'][_0x7b7e('0x3f')]){_0x44497c[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x44497c[_0x7b7e('0x40')],{'$or':_['map'](_0xdcb8ef,function(_0x1e4505){if(_0x1e4505[_0x7b7e('0x32')]!==_0x7b7e('0x42')){var _0x37895a={};_0x37895a[_0x1e4505[_0x7b7e('0x2a')]]={'$like':'%'+_0x3e8cf4[_0x7b7e('0x35')]['filter']+'%'};return _0x37895a;}})});}_0x44497c=_['merge']({},_0x44497c,_0x3e8cf4['options']);var _0xc5280c={'where':_0x44497c[_0x7b7e('0x40')]};return db[_0x7b7e('0x30')][_0x7b7e('0x21')](_0xc5280c)[_0x7b7e('0x24')](function(_0x2d47c6){_0xd5a64d['count']=_0x2d47c6;if(_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x44497c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x7b7e('0x44')](_0x44497c);})[_0x7b7e('0x24')](function(_0x249a6d){_0xd5a64d[_0x7b7e('0x45')]=_0x249a6d;return _0xd5a64d;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x202f04,_0x44497c))[_0x7b7e('0x46')](handleError(_0x202f04,null));};exports['show']=function(_0x2673eb,_0x4cc7db){var _0x402793={'raw':![],'where':{'id':_0x2673eb[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]},_0x1dad4c={};_0x1dad4c[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x30')][_0x7b7e('0x48')]);_0x1dad4c[_0x7b7e('0x35')]=_['keys'](_0x2673eb[_0x7b7e('0x35')]);_0x1dad4c[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],_0x1dad4c[_0x7b7e('0x35')]);_0x402793['attributes']=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x402793[_0x7b7e('0x38')]=_0x402793[_0x7b7e('0x38')]['length']?_0x402793[_0x7b7e('0x38')]:_0x1dad4c['model'];if(_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x402793['include']=[{'all':!![]}];}_0x402793=_[_0x7b7e('0x41')]({},_0x402793,_0x2673eb[_0x7b7e('0x49')]);return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x402793)[_0x7b7e('0x24')](handleEntityNotFound(_0x4cc7db,null))[_0x7b7e('0x24')](respondWithResult(_0x4cc7db,null))[_0x7b7e('0x46')](handleError(_0x4cc7db,null));};exports['create']=function(_0xbf044d,_0x3ff731){return db[_0x7b7e('0x30')][_0x7b7e('0x4b')](_0xbf044d['body'],{})['then'](function(_0x5bdf1d){var _0x2471ad=_0xbf044d[_0x7b7e('0x4c')][_0x7b7e('0x25')]({'plain':!![]});if(!_0x2471ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2471ad['role']===_0x7b7e('0x4c')){var _0x39efb5=_0x5bdf1d['get']({'plain':!![]});var _0xf54f87=_0x7b7e('0x26');return db[_0x7b7e('0x4d')]['find']({'where':{'name':_0xf54f87,'userProfileId':_0x2471ad[_0x7b7e('0x4e')]},'raw':!![]})[_0x7b7e('0x24')](function(_0x4d9a71){if(_0x4d9a71&&_0x4d9a71[_0x7b7e('0x4f')]===0x0){return db[_0x7b7e('0x27')][_0x7b7e('0x4b')]({'name':_0x39efb5[_0x7b7e('0x2a')],'resourceId':_0x39efb5['id'],'type':_0x4d9a71[_0x7b7e('0x2a')],'sectionId':_0x4d9a71['id']},{})[_0x7b7e('0x24')](function(){return _0x5bdf1d;});}else{return _0x5bdf1d;}})[_0x7b7e('0x46')](function(_0x2d1908){logger[_0x7b7e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1908);throw _0x2d1908;});}return _0x5bdf1d;})[_0x7b7e('0x24')](respondWithResult(_0x3ff731,0xc9))[_0x7b7e('0x46')](handleError(_0x3ff731,null));};exports['update']=function(_0xc2b1b6,_0xa22edc){if(_0xc2b1b6[_0x7b7e('0x50')]['id']){delete _0xc2b1b6['body']['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0xc2b1b6[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xa22edc,null))[_0x7b7e('0x24')](saveUpdates(_0xc2b1b6['body'],null))[_0x7b7e('0x24')](respondWithResult(_0xa22edc,null))[_0x7b7e('0x46')](handleError(_0xa22edc,null));};exports[_0x7b7e('0x28')]=function(_0x3b1adb,_0x5eb32c){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x3b1adb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5eb32c,null))[_0x7b7e('0x24')](removeEntity(_0x5eb32c,null))[_0x7b7e('0x46')](handleError(_0x5eb32c,null));};exports[_0x7b7e('0x51')]=function(_0x709e87,_0x3665ca){return db[_0x7b7e('0x30')]['describe']()[_0x7b7e('0x24')](respondWithResult(_0x3665ca,null))['catch'](handleError(_0x3665ca,null));};exports['addDisposition']=function(_0x2b105a,_0x7cbe6c){if(_0x2b105a[_0x7b7e('0x50')]['id']){delete _0x2b105a[_0x7b7e('0x50')]['id'];}return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x24')](function(_0x169540){if(_0x169540){_0x2b105a[_0x7b7e('0x50')]['ChatWebsiteId']=_0x169540['id'];return db[_0x7b7e('0x52')]['create'](_0x2b105a['body']);}})[_0x7b7e('0x24')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports[_0x7b7e('0x53')]=function(_0x4a2378,_0x3c3d29){var _0x148dde={'raw':![],'where':{}};var _0x4c46e0={};var _0x2c167d={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x4a2378[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x3c3d29,null))[_0x7b7e('0x24')](function(_0x430033){if(_0x430033){_0x4c46e0[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x52')][_0x7b7e('0x48')]);_0x4c46e0[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x4a2378['query']);_0x4c46e0['filters']=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],_0x4c46e0[_0x7b7e('0x35')]);_0x148dde[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x4a2378['query'][_0x7b7e('0x39')]));_0x148dde[_0x7b7e('0x38')]=_0x148dde['attributes'][_0x7b7e('0x54')]?_0x148dde[_0x7b7e('0x38')]:_0x4c46e0[_0x7b7e('0x34')];if(!_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x148dde[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x148dde[_0x7b7e('0x1e')]=qs['offset'](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x148dde[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x148dde[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x4a2378[_0x7b7e('0x35')],_0x4c46e0[_0x7b7e('0x3e')]));_0x148dde['where'][_0x7b7e('0x56')]=_0x430033['id'];if(_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x148dde[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x148dde['where'],{'$or':_['map'](_0x148dde['attributes'],function(_0x397923){var _0x8b339c={};_0x8b339c[_0x397923]={'$like':'%'+_0x4a2378[_0x7b7e('0x35')]['filter']+'%'};return _0x8b339c;})});}_0x148dde=_[_0x7b7e('0x41')]({},_0x148dde,_0x4a2378[_0x7b7e('0x49')]);return db[_0x7b7e('0x52')]['count']({'where':_0x148dde[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x111c99){_0x2c167d[_0x7b7e('0x21')]=_0x111c99;if(_0x4a2378['query'][_0x7b7e('0x43')]){_0x148dde[_0x7b7e('0x57')]=[{'all':!![]}];}return db[_0x7b7e('0x52')][_0x7b7e('0x44')](_0x148dde);})['then'](function(_0x4ec41e){_0x2c167d[_0x7b7e('0x45')]=_0x4ec41e;return _0x2c167d;});}})['then'](respondWithFilteredResult(_0x3c3d29,_0x148dde))[_0x7b7e('0x46')](handleError(_0x3c3d29,null));};exports[_0x7b7e('0x58')]=function(_0x4e2b05,_0x30b703){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x4e2b05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x30b703,null))[_0x7b7e('0x24')](function(_0x374312){if(_0x374312){return _0x374312[_0x7b7e('0x58')](_0x4e2b05[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x30b703,null))[_0x7b7e('0x46')](handleError(_0x30b703,null));};exports[_0x7b7e('0x5a')]=function(_0x31a353,_0xbdc4b9){if(_0x31a353[_0x7b7e('0x50')]['id']){delete _0x31a353[_0x7b7e('0x50')]['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x31a353[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xbdc4b9,null))[_0x7b7e('0x24')](function(_0xa03d7a){if(_0xa03d7a){_0x31a353[_0x7b7e('0x50')][_0x7b7e('0x56')]=_0xa03d7a['id'];return db[_0x7b7e('0x5b')]['create'](_0x31a353[_0x7b7e('0x50')]);}})[_0x7b7e('0x24')](respondWithResult(_0xbdc4b9,null))[_0x7b7e('0x46')](handleError(_0xbdc4b9,null));};exports[_0x7b7e('0x5c')]=function(_0x920e05,_0x4b4f55){var _0x51d41f={'raw':![],'where':{}};var _0xb294bd={};var _0x110f2b={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x920e05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4b4f55,null))[_0x7b7e('0x24')](function(_0x27d180){if(_0x27d180){_0xb294bd[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['CannedAnswer'][_0x7b7e('0x48')]);_0xb294bd[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x920e05[_0x7b7e('0x35')]);_0xb294bd[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0xb294bd[_0x7b7e('0x34')],_0xb294bd['query']);_0x51d41f[_0x7b7e('0x38')]=_['intersection'](_0xb294bd[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x920e05['query'][_0x7b7e('0x39')]));_0x51d41f[_0x7b7e('0x38')]=_0x51d41f[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x51d41f[_0x7b7e('0x38')]:_0xb294bd['model'];if(!_0x920e05[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x51d41f[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x51d41f['offset']=qs[_0x7b7e('0x1e')](_0x920e05['query'][_0x7b7e('0x1e')]);}_0x51d41f[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x51d41f[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x920e05[_0x7b7e('0x35')],_0xb294bd[_0x7b7e('0x3e')]));_0x51d41f['where'][_0x7b7e('0x56')]=_0x27d180['id'];if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x51d41f[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x51d41f[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x51d41f[_0x7b7e('0x38')],function(_0x41e2b5){var _0x97232d={};_0x97232d[_0x41e2b5]={'$like':'%'+_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x97232d;})});}_0x51d41f=_[_0x7b7e('0x41')]({},_0x51d41f,_0x920e05[_0x7b7e('0x49')]);return db[_0x7b7e('0x5b')][_0x7b7e('0x21')]({'where':_0x51d41f[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x45a690){_0x110f2b[_0x7b7e('0x21')]=_0x45a690;if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x51d41f['include']=[{'all':!![]}];}return db[_0x7b7e('0x5b')][_0x7b7e('0x44')](_0x51d41f);})['then'](function(_0x36fae4){_0x110f2b['rows']=_0x36fae4;return _0x110f2b;});}})['then'](respondWithFilteredResult(_0x4b4f55,_0x51d41f))[_0x7b7e('0x46')](handleError(_0x4b4f55,null));};exports['removeAnswers']=function(_0x4d91c6,_0x8925c6){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x4d91c6['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x8925c6,null))[_0x7b7e('0x24')](function(_0x2a6fdd){if(_0x2a6fdd){return _0x2a6fdd[_0x7b7e('0x5e')](_0x4d91c6[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x8925c6,null))[_0x7b7e('0x46')](handleError(_0x8925c6,null));};exports[_0x7b7e('0x5f')]=function(_0x47fb99,_0x2a31f8){_0x47fb99[_0x7b7e('0x50')][_0x7b7e('0x60')]=_0x47fb99['file'][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x47fb99[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a31f8,null))['then'](saveUpdates(_0x47fb99[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2a31f8,null))['catch'](handleError(_0x2a31f8,null));};exports[_0x7b7e('0x62')]=function(_0x5ab8a7,_0x4c7158){_0x5ab8a7[_0x7b7e('0x50')][_0x7b7e('0x63')]=_0x5ab8a7[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x5ab8a7[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4c7158,null))['then'](saveUpdates(_0x5ab8a7[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x4c7158,null))[_0x7b7e('0x46')](handleError(_0x4c7158,null));};exports[_0x7b7e('0x65')]=function(_0x1ae419,_0x13c910){_0x1ae419[_0x7b7e('0x50')][_0x7b7e('0x66')]=_0x1ae419[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1ae419['params']['id']}})['then'](handleEntityNotFound(_0x13c910,null))[_0x7b7e('0x24')](saveUpdates(_0x1ae419[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x13c910,null))[_0x7b7e('0x46')](handleError(_0x13c910,null));};exports[_0x7b7e('0x67')]=function(_0x420199,_0x2d885c){_0x420199[_0x7b7e('0x50')][_0x7b7e('0x68')]=_0x420199[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x420199[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d885c,null))[_0x7b7e('0x24')](saveUpdates(_0x420199[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2d885c,null))['catch'](handleError(_0x2d885c,null));};exports['getLogo']=function(_0x4e7889,_0x110ad6){var _0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x6b'));var _0x42531c={'where':{'id':_0x4e7889[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x60')],'raw':!![]};var _0x18846e=![];return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]()['then'](function(_0x229527){if(_0x229527){_0x18846e=_0x229527[_0x7b7e('0x6e')];}})[_0x7b7e('0x24')](function(){return db[_0x7b7e('0x30')]['find'](_0x42531c);})[_0x7b7e('0x24')](handleEntityNotFound(_0x110ad6,null))[_0x7b7e('0x24')](function(_0x46f43a){if(_0x46f43a){if(!_[_0x7b7e('0x6f')](_0x46f43a[_0x7b7e('0x60')])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]))&&_0x18846e){_0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]);}}return _0x110ad6[_0x7b7e('0x72')](_0x88ad);}})[_0x7b7e('0x46')](handleError(_0x110ad6,null));};exports[_0x7b7e('0x73')]=function(_0x451862,_0x1ba63b){var _0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x74'));var _0x28a696={'where':{'id':_0x451862[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x63')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x28a696)['then'](handleEntityNotFound(_0x1ba63b,null))[_0x7b7e('0x24')](function(_0x4ebfa7){if(_0x4ebfa7){if(!_['isNil'](_0x4ebfa7['agentAvatar'])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config['root'],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]))){_0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]);}}return _0x1ba63b['download'](_0x42def4);}})['catch'](handleError(_0x1ba63b,null));};exports[_0x7b7e('0x75')]=function(_0x596ec1,_0x4deac2){var _0xc55b86=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x59e5f1={'where':{'id':_0x596ec1[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x66'),_0x7b7e('0x76')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x59e5f1)[_0x7b7e('0x24')](handleEntityNotFound(_0x4deac2,null))[_0x7b7e('0x24')](function(_0x1b4600){if(_0x1b4600){if(!_[_0x7b7e('0x6f')](_0x1b4600['customerAvatar'])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]))&&_0x1b4600[_0x7b7e('0x76')]){_0xc55b86=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]);}}return _0x4deac2[_0x7b7e('0x72')](_0xc55b86);}})[_0x7b7e('0x46')](handleError(_0x4deac2,null));};exports['getSystemAvatar']=function(_0x137ba6,_0x1d7938){var _0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x78'));var _0x218861={'where':{'id':_0x137ba6[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x68')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x218861)[_0x7b7e('0x24')](handleEntityNotFound(_0x1d7938,null))[_0x7b7e('0x24')](function(_0x23e2ad){if(_0x23e2ad){if(!_['isNil'](_0x23e2ad[_0x7b7e('0x68')])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]))){_0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]);}}return _0x1d7938[_0x7b7e('0x72')](_0x5e067f);}})[_0x7b7e('0x46')](handleError(_0x1d7938,null));};exports[_0x7b7e('0x79')]=function(_0xeeaf19,_0x27785c){var _0x176a28=require(_0x7b7e('0x7a'));var _0x394db1=new _0x176a28();var _0x285728=_0x394db1['setUA'](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x7c')])[_0x7b7e('0x7d')]();var _0x5d0479={'body':_0xeeaf19['body'],'channel':_0x7b7e('0x7e')};var _0x5afd0b=[];var _0x5ac317=[];var _0x26aef0={};var _0x173308=![];return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x33eba1){if(!_0x33eba1){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x5afd0b=_['difference'](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),_0x7b7e('0x84')]);_0x5ac317=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),'updatedAt','CompanyId',_0x7b7e('0x86')]);if(_0xeeaf19['body']['id']){delete _0xeeaf19[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88'));}if(_['isNil'](_0xeeaf19['body'][_0x7b7e('0x50')])||_0xeeaf19[_0x7b7e('0x50')]['body']===''){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0x8a')+_0x5ac317);}if(!_[_0x7b7e('0x8b')](_0x5ac317,_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x8c')+_0x5ac317);}_0x26aef0[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')]['from'];})['then'](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0xeeaf19['params']['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e'),'include':[{'model':db[_0x7b7e('0x7f')],'as':'Contacts','where':_0x26aef0,'limit':0x1,'order':[[_0x7b7e('0x84'),_0x7b7e('0x8f')]]}]},{'model':db[_0x7b7e('0x90')],'as':_0x7b7e('0x91')}]});})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x398345){if(_0x398345&&_0x398345['List']){_0x5d0479['account']=_0x398345;_0x5d0479['applications']=_0x398345[_0x7b7e('0x91')];_0x5d0479[_0x7b7e('0x92')]=_0x398345[_0x7b7e('0x8e')];_0x5d0479[_0x7b7e('0x93')]=_[_0x7b7e('0x94')](_0x5d0479[_0x7b7e('0x93')],[_0x7b7e('0x95')],[_0x7b7e('0x96')]);if(_0x5d0479[_0x7b7e('0x97')]['Applications']){delete _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x91')];}if(_0x5d0479[_0x7b7e('0x97')]['List']&&_0x5d0479[_0x7b7e('0x97')]['List'][_0x7b7e('0x98')][_0x7b7e('0x54')]){return _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x8e')]['Contacts'][0x0];}var _0x40b101=_[_0x7b7e('0x9')](_0xeeaf19[_0x7b7e('0x50')],{'firstName':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')],'ListId':_0x398345['ListId']});_0x40b101[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')];return db[_0x7b7e('0x7f')][_0x7b7e('0x4b')](_0x40b101,{'fields':_0x5afd0b,'raw':!![]});}})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x576d82){_0x5d0479[_0x7b7e('0x99')]=_0x576d82;var _0x65ccc1=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x9a')];if(_0xeeaf19[_0x7b7e('0x7b')]['cf-connecting-ip']){_0x65ccc1=_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9b')];}else if(_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')]){_0x65ccc1=_[_0x7b7e('0x9d')](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')][_0x7b7e('0x9e')](','));}if(_0x576d82){var _0x3cfe88={'ContactId':_0x576d82['id'],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'from':(_0x576d82['firstName']||'')+'\x20'+(_0x576d82[_0x7b7e('0x9f')]||''),'customerIp':_0x65ccc1,'customerPort':_0xeeaf19['headers'][_0x7b7e('0xa0')]?_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0xa0')]:null,'referer':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xa1')],'browserName':_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')]&&_0x285728[_0x7b7e('0xa2')][_0x7b7e('0xa3')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')],_0x285728['browser']['version']):_0x7b7e('0xa6'),'browserVersion':_0x285728['browser'][_0x7b7e('0xa3')]||_0x7b7e('0xa6'),'osName':util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728['os'][_0x7b7e('0x2a')],_0x285728['os']['version']),'osVersion':_0x285728['os'][_0x7b7e('0xa3')],'deviceModel':_0x285728['device']['model']&&_0x285728['device'][_0x7b7e('0xa7')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa8'),_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x34')],_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],_0x285728['device'][_0x7b7e('0x32')]):null,'deviceVendor':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],'deviceType':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x32')],'formData':JSON[_0x7b7e('0x16')](_0xeeaf19[_0x7b7e('0x50')])};var _0x7025d7={'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'closed':![]};if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]){_0x7025d7[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')];return db['ChatInteraction']['find']({'where':_0x7025d7})[_0x7b7e('0x24')](function(_0x42a8f9){if(_0x42a8f9){return[_0x42a8f9,![]];}_0x3cfe88[_0x7b7e('0xaa')]=_0xeeaf19['body'][_0x7b7e('0xaa')];_0x3cfe88[_0x7b7e('0xab')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xab')];return db[_0x7b7e('0xac')]['create'](_0x3cfe88)['then'](function(_0x51ed9d){return[_0x51ed9d,!![]];});});}_0x7025d7[_0x7b7e('0xad')]=_0x576d82['id'];if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]['id']){_0x7025d7['id']=_0xeeaf19['body'][_0x7b7e('0xae')]['id'];return db['ChatInteraction'][_0x7b7e('0x4a')]({'where':_0x7025d7})['then'](function(_0x4a2fa9){if(_0x4a2fa9){return[_0x4a2fa9,![]];}return db['ChatInteraction'][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x5a922a){return[_0x5a922a,!![]];});});}return db[_0x7b7e('0xac')][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x27a391){return[_0x27a391,!![]];});}})['spread'](function(_0x845230,_0x62846d){if(_0x845230){_0x173308=_0x62846d;if(!_0x62846d){var _0x495348={'from':(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0xaf')]||'')+'\x20'+(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0x9f')]||'')};if(_0xeeaf19['body'][_0x7b7e('0xaa')]&&_0xeeaf19[_0x7b7e('0x50')]['messageId']&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]!=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb0')]){_0x495348[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')]['messageId'];}return _0x845230[_0x7b7e('0x23')](_0x495348);}else{return _0x845230;}}})['then'](function(_0x42957f){_0x5d0479['interaction']=_0x42957f[_0x7b7e('0x25')]({'plain':!![]});_0x5d0479[_0x7b7e('0xae')]['created']=_0x173308;if(_0x5d0479['interaction']['created']){if(_0x5d0479[_0x7b7e('0x97')][_0x7b7e('0xb1')]){_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0xb2')]({'id':0x0,'priority':_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0x54')]+0x1,'app':'close','appdata':_0x7b7e('0xb3'),'interval':_0x7b7e('0xb4')});}}return db[_0x7b7e('0xb5')]['create']({'body':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x50')],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'ChatInteractionId':_0x42957f['id'],'direction':'in','ContactId':_0x5d0479[_0x7b7e('0x99')]['id'],'AttachmentId':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb6')]});})[_0x7b7e('0x24')](function(_0xc9ed8f){_0x5d0479[_0x7b7e('0x19')]=_0xc9ed8f;if(_0x5d0479[_0x7b7e('0xae')][_0x7b7e('0xb7')]){return db[_0x7b7e('0xb8')]['find']({'attributes':['id',_0x7b7e('0x2a')],'where':{'id':_0x5d0479['interaction'][_0x7b7e('0xb7')]}})['then'](function(_0x276a76){if(_0x276a76){_0x5d0479[_0x7b7e('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7b7e('0xb9'),'appdata':_0x276a76['name']+','+(_0x5d0479[_0x7b7e('0x97')]['waitForTheAssignedAgent']||0xa),'interval':_0x7b7e('0xb4')});_0x5d0479['forcedOwnership']=!![];}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);});}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);})[_0x7b7e('0x24')](function(_0x255fed){respondWithRpcPromise(_0x7b7e('0xbc'),_0x7b7e('0xbc'),{'event':_0x7b7e('0x79'),'message':_0x255fed},client9002);return _0x255fed;})[_0x7b7e('0x24')](respondWithResult(_0x27785c,null))[_0x7b7e('0x46')](handleError(_0x27785c,null));};exports['offline']=function(_0x5eae74,_0x4999af){var _0x4a193a,_0x55b604,_0x283d97;var _0x1586b9=[];var _0x3a10d3={};var _0x46f331=_0x5eae74[_0x7b7e('0xbd')]||[];var _0x4ce6b2=[];var _0x5a9723;return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x350a01){if(!_0x350a01){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x1586b9=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x350a01),[_0x7b7e('0x83'),'updatedAt',_0x7b7e('0xbe'),'ListId']);if(_0x5eae74['body']['id']){delete _0x5eae74[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')])||_0x5eae74[_0x7b7e('0x50')]['body']===''){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xbf')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0xc0')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)['send'](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xc1')+_0x1586b9));}if(!_[_0x7b7e('0x8b')](_0x1586b9,_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline'])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0xc2')+_0x1586b9));}_0x3a10d3[_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline']]=_0x5eae74['body'][_0x7b7e('0x87')];})[_0x7b7e('0x24')](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x5eae74[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e')},{'model':db[_0x7b7e('0xc3')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x4999af,null))[_0x7b7e('0x24')](function(_0x4a6398){if(_0x4a6398&&_0x4a6398[_0x7b7e('0x8e')]){_0x55b604=_0x4a6398;var _0x4b3682=_[_0x7b7e('0x9')](_0x5eae74['body'],{'firstName':_0x5eae74[_0x7b7e('0x50')]['from'],'phone':_0x5eae74['body'][_0x7b7e('0x87')],'ListId':_0x4a6398['ListId']});_0x4b3682[_0x5eae74['body'][_0x7b7e('0xc0')]]=_0x5eae74[_0x7b7e('0x50')]['from'];return db[_0x7b7e('0x7f')][_0x7b7e('0xc4')]({'where':_0x3a10d3,'defaults':_0x4b3682});}})[_0x7b7e('0xc5')](function(_0x45c9b7){if(_0x45c9b7){_0x283d97=_0x45c9b7;var _0x1dc553=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x3e0e3e=ejs[_0x7b7e('0xc7')](_0x1dc553,{'body':_[_0x7b7e('0xc8')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')]),'bodyTitle':_0x55b604[_0x7b7e('0xc9')]});return db['ChatOfflineMessage'][_0x7b7e('0x4b')]({'body':_0x3e0e3e,'plainBody':htmlToText[_0x7b7e('0xca')](_0x3e0e3e),'ContactId':_0x45c9b7['id'],'ChatWebsiteId':_0x55b604['id']});}})['then'](function(_0x4a656c){_0x5a9723=_0x4a656c;if(_0x46f331[_0x7b7e('0x54')]){var _0x52531d=_0x46f331[_0x7b7e('0x2f')](function(_0x23f186){return{'name':_0x23f186[_0x7b7e('0xcb')],'basename':_0x23f186[_0x7b7e('0x61')],'type':_0x23f186[_0x7b7e('0xcc')],'ChatOfflineMessageId':_0x4a656c['id']};});_0x4ce6b2=_0x52531d['map'](_0x2405ba=>{var _0x582bb9={'filename':_0x2405ba[_0x7b7e('0x2a')],'path':path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server',_0x7b7e('0xbd'),_0x7b7e('0xcd'),'offline-chat',_0x2405ba[_0x7b7e('0xce')])};return _0x582bb9;});if(!_0x55b604[_0x7b7e('0xcf')]){return db['sequelize'][_0x7b7e('0xd0')](function(_0x30e0ac){return db[_0x7b7e('0xd1')][_0x7b7e('0xd2')](_0x52531d,{'transaction':_0x30e0ac});});}}})['then'](function(){if(_0x5a9723){_0x4a193a=_0x5a9723;return db[_0x7b7e('0xc3')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x7b7e('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x7b7e('0x24')](function(_0x4e4703){if(_0x4e4703&&_0x4e4703[_0x7b7e('0xd4')]&&_0x55b604[_0x7b7e('0xd5')]&&_0x55b604[_0x7b7e('0xd6')]){var _0xf34506={'tls':{'rejectUnauthorized':![]}};if(_0x4e4703[_0x7b7e('0xd4')]['service']){_0xf34506[_0x7b7e('0xd7')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd7')];}else{_0xf34506['host']=_0x4e4703['Smtp'][_0x7b7e('0xd8')];_0xf34506[_0x7b7e('0xd9')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd9')];_0xf34506['secure']=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xda')];}if(_0x4e4703[_0x7b7e('0xd4')]['authentication']){_0xf34506[_0x7b7e('0xdb')]={'user':_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0x4c')],'pass':_0x4e4703['Smtp'][_0x7b7e('0xdc')]};}return respondWithRpcPromise(_0x7b7e('0xdd'),_0x7b7e('0xde'),{'account':_0xf34506,'message':{'from':util[_0x7b7e('0xa4')](_0x7b7e('0xdf'),_0x4e4703['name'],_0x4e4703[_0x7b7e('0xe0')]||_0x4e4703[_0x7b7e('0xd4')]['user']),'to':_0x55b604['forwardOfflineAddress'],'subject':_0x55b604[_0x7b7e('0xe1')],'html':_0x4a193a[_0x7b7e('0x50')],'attachments':_0x4ce6b2}},client9003)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x1bbd6d){console[_0x7b7e('0x17')](_0x1bbd6d);});}})[_0x7b7e('0x24')](function(){if(_0x55b604&&_0x55b604[_0x7b7e('0xcf')]&&_0x55b604[_0x7b7e('0xe2')]){var _0x50a68e=[];if(_0x46f331[_0x7b7e('0x54')]){_0x50a68e=_0x46f331['map'](function(_0x471524){return{'name':_0x471524['originalname'],'basename':_0x471524[_0x7b7e('0x61')],'type':_0x471524['mimetype'],'ChatOfflineMessageId':_0x5a9723['id']};});}var _0x4c63f5;if(!_['isNil'](_0x55b604[_0x7b7e('0xe3')])){var _0x423c16=_['map'](_0x5eae74[_0x7b7e('0x50')],function(_0x22d7a7){return _0x22d7a7;});var _0x12bd58=_[_0x7b7e('0xe4')](_0x423c16)[0x0];var _0x5e3718=_[_0x7b7e('0xe5')](_0x12bd58,function(_0x22153b){return _0x22153b;});_0x4c63f5=_0x5e3718[0x1][_0x55b604[_0x7b7e('0xe3')]];}var _0x59d4ef={'from':_0x283d97['email'],'firstName':_0x283d97['firstName'],'lastName':_0x283d97[_0x7b7e('0x9f')],'mapKey':'email','message':{'from':_0x283d97[_0x7b7e('0xe0')],'to':_0x55b604[_0x7b7e('0xc3')][_0x7b7e('0xe0')],'cc':'','subject':_[_0x7b7e('0x6f')](_0x4c63f5)?_0x55b604['offlineMessageSubject']:_0x4c63f5,'messageId':'','sentAt':new Date(),'attach':_0x50a68e['length'],'attachments':_0x50a68e,'originChannel':_0x7b7e('0xe6'),'ChatWebsiteId':_0x55b604['id'],'ChatOfflineMessageId':_0x4a193a['id'],'originTo':_0x55b604['MailAccount'][_0x7b7e('0xe0')]},'body':_0x4a193a['body']};var _0x1b2f83={'account':{'id':_0x55b604[_0x7b7e('0xe2')]},'body':_0x59d4ef,'log':_0x7b7e('0xe7')};return respondWithRpcPromise('NotifyMailAccount',_0x7b7e('0xe8'),_0x1b2f83,client9001)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x5d0a9e){console[_0x7b7e('0x17')](_0x5d0a9e);});}return;})['then'](function(){if(_0x4a193a){return _0x4a193a;}})[_0x7b7e('0x24')](respondWithResult(_0x4999af,null))['catch'](function(_0x4e4ab6){console[_0x7b7e('0x17')](_0x7b7e('0x46'),_0x4e4ab6);for(var _0x44c7e4 of _0x46f331){var _0x28e62f=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0xe9'),'files',_0x7b7e('0xcd'),_0x7b7e('0xea'),_0x44c7e4[_0x7b7e('0x61')]);fs_extra[_0x7b7e('0xeb')](_0x28e62f)[_0x7b7e('0x46')](function(_0x22fe0f){console[_0x7b7e('0x17')](_0x7b7e('0xec'),_0x28e62f,_0x22fe0f);});}});};exports[_0x7b7e('0xed')]=function(_0x2f7540,_0x11901c){return db[_0x7b7e('0xac')][_0x7b7e('0x4a')]({'where':{'id':_0x2f7540[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x11901c,null))[_0x7b7e('0x24')](function(_0x18d515){if(_0x18d515){return _0x18d515[_0x7b7e('0xed')](_0x2f7540[_0x7b7e('0x50')][_0x7b7e('0x59')],_['omit'](_0x2f7540[_0x7b7e('0x50')],['ids','id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x11901c,null))[_0x7b7e('0x46')](handleError(_0x11901c,null));};exports[_0x7b7e('0xee')]=function(_0x5d4968,_0x37ae1c){var _0x4bb4e5={'raw':![],'where':{}};var _0x1c7308={};var _0x57ea72={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x5d4968['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x37ae1c,null))['then'](function(_0x215583){if(_0x215583){_0x1c7308[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['ChatInteraction'][_0x7b7e('0x48')]);_0x1c7308[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x5d4968[_0x7b7e('0x35')]);_0x1c7308[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1c7308[_0x7b7e('0x34')],_0x1c7308[_0x7b7e('0x35')]);_0x4bb4e5['attributes']=_[_0x7b7e('0x37')](_0x1c7308['model'],qs[_0x7b7e('0x39')](_0x5d4968['query']['fields']));_0x4bb4e5['attributes']=_0x4bb4e5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x4bb4e5[_0x7b7e('0x38')]:_0x1c7308[_0x7b7e('0x34')];if(!_0x5d4968[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x4bb4e5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x4bb4e5[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d4968[_0x7b7e('0x35')]['offset']);}_0x4bb4e5['order']=qs[_0x7b7e('0x3c')](_0x5d4968[_0x7b7e('0x35')]['sort']);_0x4bb4e5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x5d4968[_0x7b7e('0x35')],_0x1c7308[_0x7b7e('0x3e')]));_0x4bb4e5[_0x7b7e('0x40')]['ChatWebsiteId']=_0x215583['id'];if(_0x5d4968[_0x7b7e('0x35')]['filter']){_0x4bb4e5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x4bb4e5[_0x7b7e('0x40')],{'$or':_['map'](_0x4bb4e5[_0x7b7e('0x38')],function(_0x401dd6){var _0x3bbf22={};_0x3bbf22[_0x401dd6]={'$like':'%'+_0x5d4968[_0x7b7e('0x35')]['filter']+'%'};return _0x3bbf22;})});}_0x4bb4e5=_[_0x7b7e('0x41')]({},_0x4bb4e5,_0x5d4968[_0x7b7e('0x49')]);return db[_0x7b7e('0xac')][_0x7b7e('0x21')]({'where':_0x4bb4e5['where']})[_0x7b7e('0x24')](function(_0x2be57d){_0x57ea72[_0x7b7e('0x21')]=_0x2be57d;if(_0x5d4968[_0x7b7e('0x35')]['includeAll']){_0x4bb4e5[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xb8')],'as':_0x7b7e('0xf0'),'attributes':['name','fullname',_0x7b7e('0xf1')],'required':![]},{'model':db[_0x7b7e('0xf2')],'as':_0x7b7e('0xf3'),'attributes':['id',_0x7b7e('0x2a'),_0x7b7e('0xf4')],'where':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?{'id':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]}:undefined,'required':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?!![]:![]}];}return db[_0x7b7e('0xac')][_0x7b7e('0x44')](_0x4bb4e5);})[_0x7b7e('0x24')](function(_0x2eb712){_0x57ea72[_0x7b7e('0x45')]=_0x2eb712;return _0x57ea72;});}})['then'](respondWithFilteredResult(_0x37ae1c,_0x4bb4e5))[_0x7b7e('0x46')](handleError(_0x37ae1c,null));};function iftimePromise(_0x5a78d6,_0x27d9b7){return respondWithRpcPromise(_0x7b7e('0xf6'),_0x7b7e('0xf7'),{'command':_0x27d9b7[_0x7b7e('0xf8')]?util['format'](_0x7b7e('0xf9'),_0x5a78d6[_0x7b7e('0xfa')],_0x27d9b7[_0x7b7e('0xf8')]):util[_0x7b7e('0xa4')](_0x7b7e('0xfb'),_0x5a78d6[_0x7b7e('0xfa')])},client9002)[_0x7b7e('0x24')](function(_0x1f2174){var _0x1b60e7=_0x1f2174&&_0x1f2174[_0x7b7e('0xfc')](_0x7b7e('0xfd'))>=0x0?!![]:![];logger[_0x7b7e('0x12')](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],_0x1b60e7?'ONLINE':_0x7b7e('0xff'),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return _0x1b60e7;})[_0x7b7e('0x46')](function(_0x322025){logger['error'](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],util[_0x7b7e('0x100')](_0x322025,{'showHidden':![],'depth':null}),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return![];});}exports[_0x7b7e('0xf7')]=function(_0x33693d,_0xe12d13){var _0x19a9ec=0x0;var _0x1da40b=0x0;var _0x377613=![];var _0x3b4171;var _0x14757d;return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x33693d[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x101'),'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x102'),'attributes':['id',_0x7b7e('0xfa')],'raw':!![]}]}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xe12d13,null))['then'](function(_0x528506){if(_0x528506){_0x3b4171=_0x528506;return _0x528506[_0x7b7e('0x103')]({'raw':!![]});}})[_0x7b7e('0x24')](function(_0x42d6aa){if(_0x3b4171){if(_0x42d6aa){_0x14757d=_0x42d6aa;}}return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]();})[_0x7b7e('0x24')](function(_0x2a7845){if(_0x2a7845){_0x1da40b=_0x2a7845[_0x7b7e('0x104')];_0x377613=_0x2a7845[_0x7b7e('0x6e')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x204397){_0x19a9ec=_0x204397;if(_0x1da40b&&_0x204397>_0x1da40b){return db[_0x7b7e('0x105')][_0x7b7e('0x5d')]({'where':{'id':0x1}})[_0x7b7e('0x24')](function(_0x43a7fa){if(_0x43a7fa){_0x43a7fa['increment'](_0x7b7e('0x106'));}});}})[_0x7b7e('0x24')](function(){if(_0x3b4171['Interval']&&_0x3b4171[_0x7b7e('0x101')]['Intervals']){var _0x30a1a0=[];for(var _0x2d5595=0x0;_0x2d5595<_0x3b4171[_0x7b7e('0x101')]['Intervals'][_0x7b7e('0x54')];_0x2d5595++){var _0x5ac66a=_0x3b4171[_0x7b7e('0x101')][_0x7b7e('0x102')][_0x2d5595][_0x7b7e('0x25')]({'plain':!![]});_0x30a1a0[_0x7b7e('0xb2')](iftimePromise(_0x5ac66a,_0x3b4171));}return BPromise[_0x7b7e('0x107')](_0x30a1a0)[_0x7b7e('0x24')](function(_0x36755d){return _['some'](_0x36755d);});}else{return!![];}})[_0x7b7e('0x24')](function(_0x5273e5){var _0xeaeb7=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x108')),'utf8');var _0x3c9c06={'remote':_0x3b4171[_0x7b7e('0x109')],'query':querystring[_0x7b7e('0x16')](_['merge'](_0x3b4171[_0x7b7e('0x25')]({'plain':!![]}),{'customerIp':_0x33693d[_0x7b7e('0x7b')]['x-forwarded-for']||_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0x10a')]||_0x33693d[_0x7b7e('0x10b')]['remoteAddress']||_0x33693d['ip'],'referer':_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0xa1')],'openedInteractions':_0x19a9ec,'maxInteractions':_0x1da40b,'virtual':_0x377613[_0x7b7e('0x104')],'online':_0x5273e5,'custom':_0x377613}))[_0x7b7e('0x10c')](/'/g,'\x5c\x27')};_0xe12d13[_0x7b7e('0x2b')](ejs['render'](Mustache['render'](_0xeaeb7,_0x3c9c06),{'proactiveActions':_0x14757d,'alignment':_0x3b4171[_0x7b7e('0x10d')],'verticalAlignment':_0x3b4171[_0x7b7e('0x10e')],'div_color':_0x3b4171['color'],'labelText':_0x3b4171[_0x7b7e('0x10f')],'text_color':_0x3b4171[_0x7b7e('0x110')],'button_color':_0x3b4171[_0x7b7e('0x111')],'background_color':_0x3b4171[_0x7b7e('0x112')]}));})[_0x7b7e('0x46')](handleError(_0xe12d13,null));};exports['addApplications']=function(_0x24b8e0,_0x143e7b){var _0x472bbd=_0x24b8e0[_0x7b7e('0x47')]['id'];var _0x335f4b=_0x24b8e0[_0x7b7e('0x50')];var _0x22f1a4=0xc8;var _0x4f1e67=null;return db[_0x7b7e('0x113')]['transaction']({'isolationLevel':db[_0x7b7e('0x113')][_0x7b7e('0x114')][_0x7b7e('0x115')]['READ_COMMITTED']},function(_0x15f854){return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(_0xe077b4){if(_0xe077b4){return db[_0x7b7e('0x90')]['destroy']({'where':{'ChatWebsiteId':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(){var _0xe3ef56=_['map'](_0x335f4b,function(_0x217a46){_0x217a46[_0x7b7e('0x56')]=_0x472bbd;return _0x217a46;});return db[_0x7b7e('0x90')][_0x7b7e('0xd2')](_0xe3ef56,{'transaction':_0x15f854});});}else{_0x22f1a4=0x194;_0x4f1e67=[];}});})[_0x7b7e('0x24')](function(){if(_0x22f1a4!==0x194){return db[_0x7b7e('0x90')][_0x7b7e('0x116')]({'where':{'ChatWebsiteId':_0x472bbd},'order':_0x7b7e('0x95')})['then'](function(_0x508c76){_0x4f1e67=_0x508c76;});}})['catch'](function(_0x2d271d){_0x22f1a4=0x1f4;logger['error'](_0x2d271d[_0x7b7e('0x29')]);if(_0x2d271d[_0x7b7e('0x2a')]){delete _0x2d271d[_0x7b7e('0x2a')];}_0x4f1e67=_0x2d271d;})[_0x7b7e('0x117')](function(){if(_0x4f1e67===null){_0x143e7b[_0x7b7e('0x1b')](_0x22f1a4);}else{if(_0x22f1a4===0x1f4){_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)['send'](_0x4f1e67);}else{_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)[_0x7b7e('0x1d')](_0x4f1e67);}}});};exports[_0x7b7e('0x118')]=function(_0x10aaf2,_0x25be32){var _0xc29f56={};var _0x3d9e71={};var _0x33673a;var _0x321eb6;return db['ChatWebsite']['findOne']({'where':{'id':_0x10aaf2[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x25be32,null))['then'](function(_0x444bf4){if(_0x444bf4){_0x33673a=_0x444bf4;_0x3d9e71[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x90')][_0x7b7e('0x48')]);_0x3d9e71[_0x7b7e('0x35')]=_['keys'](_0x10aaf2[_0x7b7e('0x35')]);_0x3d9e71[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3d9e71[_0x7b7e('0x34')],_0x3d9e71[_0x7b7e('0x35')]);_0xc29f56[_0x7b7e('0x38')]=_['intersection'](_0x3d9e71['model'],qs[_0x7b7e('0x39')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0xc29f56[_0x7b7e('0x38')]=_0xc29f56['attributes']['length']?_0xc29f56[_0x7b7e('0x38')]:_0x3d9e71['model'];_0xc29f56['order']=qs['sort'](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0xc29f56['where']=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x10aaf2[_0x7b7e('0x35')],_0x3d9e71[_0x7b7e('0x3e')]));if(_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0xc29f56[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0xc29f56[_0x7b7e('0x40')],{'$or':_['map'](_0xc29f56['attributes'],function(_0xc31bf){var _0x4794df={};_0x4794df[_0xc31bf]={'$like':'%'+_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x4794df;})});}_0xc29f56=_[_0x7b7e('0x41')]({},_0xc29f56,_0x10aaf2['options']);return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x4c6547){if(_0x4c6547){_0x321eb6=_0x4c6547[_0x7b7e('0x54')];if(!_0x10aaf2[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0xc29f56['limit']=qs[_0x7b7e('0x20')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0xc29f56[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x10aaf2['query'][_0x7b7e('0x1e')]);}return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x1f0878){if(_0x1f0878){return _0x1f0878?{'count':_0x321eb6,'rows':_0x1f0878}:null;}})['then'](respondWithResult(_0x25be32,null))[_0x7b7e('0x46')](handleError(_0x25be32,null));};exports[_0x7b7e('0x119')]=function(_0x4746bb,_0x6865f0){return db[_0x7b7e('0x11a')][_0x7b7e('0x4a')]({'where':{'id':_0x4746bb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x6865f0,null))[_0x7b7e('0x24')](function(_0x3b0796){if(_0x3b0796){return _0x3b0796[_0x7b7e('0x119')](_0x4746bb[_0x7b7e('0x50')][_0x7b7e('0x59')],_[_0x7b7e('0x11b')](_0x4746bb[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x6865f0,null))[_0x7b7e('0x46')](handleError(_0x6865f0,null));};exports[_0x7b7e('0x103')]=function(_0x119050,_0xd4abb1){var _0x5a79a5={};var _0x246351={};var _0x12de27;var _0x554684;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x119050[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xd4abb1,null))[_0x7b7e('0x24')](function(_0x2784cb){if(_0x2784cb){_0x12de27=_0x2784cb;_0x246351['model']=_[_0x7b7e('0x36')](db['ChatProactiveAction'][_0x7b7e('0x48')]);_0x246351[_0x7b7e('0x35')]=_['keys'](_0x119050['query']);_0x246351[_0x7b7e('0x3e')]=_['intersection'](_0x246351['model'],_0x246351['query']);_0x5a79a5[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x246351[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x5a79a5[_0x7b7e('0x38')]=_0x5a79a5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x5a79a5[_0x7b7e('0x38')]:_0x246351[_0x7b7e('0x34')];_0x5a79a5[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x119050['query'][_0x7b7e('0x3c')]);_0x5a79a5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x119050[_0x7b7e('0x35')],_0x246351[_0x7b7e('0x3e')]));if(_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x5a79a5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x5a79a5[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x5a79a5[_0x7b7e('0x38')],function(_0x56bb34){var _0x5510d1={};_0x5510d1[_0x56bb34]={'$like':'%'+_0x119050[_0x7b7e('0x35')]['filter']+'%'};return _0x5510d1;})});}_0x5a79a5=_[_0x7b7e('0x41')]({},_0x5a79a5,_0x119050[_0x7b7e('0x49')]);return _0x12de27['getProactiveActions'](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x297ef5){if(_0x297ef5){_0x554684=_0x297ef5[_0x7b7e('0x54')];if(!_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x5a79a5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x5a79a5['offset']=qs[_0x7b7e('0x1e')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x12de27[_0x7b7e('0x103')](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x5607c0){if(_0x5607c0){return _0x5607c0?{'count':_0x554684,'rows':_0x5607c0}:null;}})[_0x7b7e('0x24')](respondWithResult(_0xd4abb1,null))[_0x7b7e('0x46')](handleError(_0xd4abb1,null));};exports[_0x7b7e('0x11c')]=function(_0x1bb023,_0x28f668){var _0x58b728=_0x1bb023[_0x7b7e('0x35')][_0x7b7e('0x11d')]==='false'?'offlineForm':_0x7b7e('0x11e');return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'attributes':['id',_0x58b728],'where':{'id':_0x1bb023['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x28f668,null))[_0x7b7e('0x24')](function(_0x5c61e3){if(_0x5c61e3){var _0x4772ad=_0x5c61e3[_0x58b728];var _0x3b6f4a=_0x4772ad&&_0x4772ad[_0x7b7e('0x11f')]?_0x4772ad[_0x7b7e('0x11f')]:[];_0x28f668[_0x7b7e('0x2b')]({'fromKey':_['isNil'](_0x4772ad[_0x7b7e('0x120')])?undefined:_0x4772ad[_0x7b7e('0x120')],'count':_0x3b6f4a[_0x7b7e('0x54')],'rows':_0x3b6f4a});}})[_0x7b7e('0x46')](handleError(_0x28f668,null));};exports['getOfflineMessages']=function(_0x16d369,_0x51a98f){var _0x21d4ca={'raw':![],'where':{}};var _0x3409ed={};var _0x2eb5a3={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x16d369['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x51a98f,null))[_0x7b7e('0x24')](function(_0x5793a9){if(_0x5793a9){_0x3409ed[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x121')]['rawAttributes']);_0x3409ed[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x16d369['query']);_0x3409ed[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3409ed['model'],_0x3409ed[_0x7b7e('0x35')]);_0x21d4ca[_0x7b7e('0x38')]=_['intersection'](_0x3409ed[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x21d4ca[_0x7b7e('0x38')]=_0x21d4ca[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x21d4ca[_0x7b7e('0x38')]:_0x3409ed[_0x7b7e('0x34')];if(!_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3a')]('nolimit')){_0x21d4ca[_0x7b7e('0x20')]=qs['limit'](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x21d4ca[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x21d4ca['order']=qs[_0x7b7e('0x3c')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x21d4ca[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x16d369[_0x7b7e('0x35')],_0x3409ed['filters']));_0x21d4ca[_0x7b7e('0x40')]['ChatWebsiteId']=_0x5793a9['id'];if(_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x21d4ca[_0x7b7e('0x40')]=_['merge'](_0x21d4ca[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x21d4ca[_0x7b7e('0x38')],function(_0x432292){var _0x13541e={};_0x13541e[_0x432292]={'$like':'%'+_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x13541e;})});}_0x21d4ca=_[_0x7b7e('0x41')]({},_0x21d4ca,_0x16d369['options']);return db[_0x7b7e('0x121')][_0x7b7e('0x21')]({'where':_0x21d4ca[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x3b9377){_0x2eb5a3[_0x7b7e('0x21')]=_0x3b9377;if(_0x16d369['query']['includeAll']){_0x21d4ca[_0x7b7e('0x57')]=[{'all':!![]}];}else{_0x21d4ca[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xd1')],'as':'Attachments','required':![]}];}return db[_0x7b7e('0x121')][_0x7b7e('0x44')](_0x21d4ca);})[_0x7b7e('0x24')](function(_0x58f17c){_0x2eb5a3[_0x7b7e('0x45')]=_0x58f17c;return _0x2eb5a3;});}})[_0x7b7e('0x24')](respondWithFilteredResult(_0x51a98f,_0x21d4ca))[_0x7b7e('0x46')](handleError(_0x51a98f,null));};exports[_0x7b7e('0x122')]=function(_0x1b4510,_0x5581d2){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1b4510[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5581d2,null))[_0x7b7e('0x24')](function(_0x1febae){if(_0x1febae){return _0x1febae[_0x7b7e('0x122')](_0x1b4510[_0x7b7e('0x50')]['ids'],_[_0x7b7e('0x11b')](_0x1b4510[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{})[_0x7b7e('0xc5')](function(_0x386416){for(var _0x6297b1=0x0;_0x6297b1<_0x1b4510[_0x7b7e('0x50')][_0x7b7e('0x59')][_0x7b7e('0x54')];_0x6297b1+=0x1){socket[_0x7b7e('0x123')]('userChatWebsite:save',{'UserId':Number(_0x1b4510['body'][_0x7b7e('0x59')][_0x6297b1]),'ChatWebsiteId':Number(_0x1b4510[_0x7b7e('0x47')]['id'])});}return _0x386416;});}})[_0x7b7e('0x24')](respondWithResult(_0x5581d2,null))[_0x7b7e('0x46')](handleError(_0x5581d2,null));};exports[_0x7b7e('0x124')]=function(_0xd1688a,_0x43a6a5){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0xd1688a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x43a6a5,null))[_0x7b7e('0x24')](function(_0x444b73){if(_0x444b73){return _0x444b73['removeAgents'](_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')])[_0x7b7e('0x24')](function(){if(_[_0x7b7e('0x125')](_0xd1688a['query'][_0x7b7e('0x59')])){for(var _0x2eef95=0x0;_0x2eef95<_0xd1688a['query']['ids'][_0x7b7e('0x54')];_0x2eef95+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')][_0x2eef95]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}}else{socket[_0x7b7e('0x123')](_0x7b7e('0x126'),{'UserId':Number(_0xd1688a['query'][_0x7b7e('0x59')]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}});}})[_0x7b7e('0x24')](respondWithStatusCode(_0x43a6a5,null))[_0x7b7e('0x46')](handleError(_0x43a6a5,null));};exports[_0x7b7e('0x127')]=function(_0x3947ea,_0x58c9e7){var _0x439bda={};var _0x11526f={};var _0x37fd3e;var _0x6f772;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x3947ea[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x58c9e7,null))[_0x7b7e('0x24')](function(_0x1c3415){if(_0x1c3415){_0x37fd3e=_0x1c3415;_0x11526f[_0x7b7e('0x34')]=_['keys'](db['User'][_0x7b7e('0x48')]);_0x11526f[_0x7b7e('0x35')]=_['keys'](_0x3947ea['query']);_0x11526f[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x11526f[_0x7b7e('0x34')],_0x11526f[_0x7b7e('0x35')]);_0x439bda[_0x7b7e('0x38')]=_['intersection'](_0x11526f['model'],qs['fields'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x439bda['attributes']=_0x439bda[_0x7b7e('0x38')]['length']?_0x439bda['attributes']:_0x11526f[_0x7b7e('0x34')];_0x439bda['order']=qs['sort'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x439bda[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x3947ea['query'],_0x11526f['filters']));if(_0x3947ea[_0x7b7e('0x35')]['filter']){_0x439bda[_0x7b7e('0x40')]=_['merge'](_0x439bda[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x439bda[_0x7b7e('0x38')],function(_0x592624){var _0x1a0cd7={};_0x1a0cd7[_0x592624]={'$like':'%'+_0x3947ea[_0x7b7e('0x35')]['filter']+'%'};return _0x1a0cd7;})});}_0x439bda=_[_0x7b7e('0x41')]({},_0x439bda,_0x3947ea[_0x7b7e('0x49')]);return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})['then'](function(_0x2b4c67){if(_0x2b4c67){_0x6f772=_0x2b4c67['length'];if(!_0x3947ea['query']['hasOwnProperty'](_0x7b7e('0x3b'))){_0x439bda[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x439bda[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})[_0x7b7e('0x24')](function(_0x2ee403){if(_0x2ee403){return _0x2ee403?{'count':_0x6f772,'rows':_0x2ee403}:null;}})['then'](respondWithResult(_0x58c9e7,null))[_0x7b7e('0x46')](handleError(_0x58c9e7,null));}; \ No newline at end of file +var _0x757a=['body','user','UserProfileSection','autoAssociation','describe','params','ChatWebsiteId','Disposition','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','ValidationError','difference','createdAt','updatedAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','includes','mapKey','CmList','Contacts','DESC','ChatApplication','List','account','applications','Applications','list','priority','asc','ListId','CmContact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','format','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','firstName','contact','messageId','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','findOne','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','increment','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','color_button','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','set','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','find','catch','create'];(function(_0x3ae33a,_0x68223b){var _0x5f09c1=function(_0x5af971){while(--_0x5af971){_0x3ae33a['push'](_0x3ae33a['shift']());}};_0x5f09c1(++_0x68223b);}(_0x757a,0xde));var _0xa757=function(_0x264673,_0x1a2827){_0x264673=_0x264673-0x0;var _0x173192=_0x757a[_0x264673];return _0x173192;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa757('0x2'));var querystring=require(_0xa757('0x3'));var Redis=require(_0xa757('0x4'));var qs=require(_0xa757('0x5'));var logger=require(_0xa757('0x6'))(_0xa757('0x7'));var config=require('../../config/environment');var db=require(_0xa757('0x8'))['db'];config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);var htmlToText=require(_0xa757('0xd'));var jayson=require(_0xa757('0xe'));var client=jayson[_0xa757('0xf')][_0xa757('0x10')]({'port':0x232c});var client9002=jayson[_0xa757('0xf')][_0xa757('0x10')]({'port':0x232a});var client9003=jayson[_0xa757('0xf')]['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x56acfb,_0x4db68e,_0x421040,_0x544b45){return new BPromise(function(_0x564187,_0x2ed0d2){var _0x513b1f=_0x544b45||client;return _0x513b1f['request'](_0x56acfb,_0x421040)[_0xa757('0x11')](function(_0x1b670e){logger[_0xa757('0x12')](_0xa757('0x13'),_0x4db68e,_0xa757('0x14'));logger[_0xa757('0x15')](_0xa757('0x16'),_0x4db68e,_0xa757('0x14'),JSON[_0xa757('0x17')](_0x1b670e));if(_0x1b670e[_0xa757('0x18')]){if(_0x1b670e['error'][_0xa757('0x19')]===0x1f4){logger[_0xa757('0x18')](_0xa757('0x13'),_0x4db68e,_0x1b670e['error']['message']);return _0x2ed0d2(_0x1b670e[_0xa757('0x18')][_0xa757('0x1a')]);}logger[_0xa757('0x18')](_0xa757('0x13'),_0x4db68e,_0x1b670e[_0xa757('0x18')][_0xa757('0x1a')]);return _0x564187(_0x1b670e['error'][_0xa757('0x1a')]);}else{logger['info'](_0xa757('0x13'),_0x4db68e,_0xa757('0x14'));_0x564187(_0x1b670e[_0xa757('0x1b')][_0xa757('0x1a')]);}})['catch'](function(_0x5638c7){logger[_0xa757('0x18')](_0xa757('0x13'),_0x4db68e,_0x5638c7);_0x2ed0d2(_0x5638c7);});});}function respondWithStatusCode(_0x2ba923,_0x8d121f){_0x8d121f=_0x8d121f||0xcc;return function(_0x1d6e2){if(_0x1d6e2){return _0x2ba923[_0xa757('0x1c')](_0x8d121f);}return _0x2ba923[_0xa757('0x1d')](_0x8d121f)[_0xa757('0x1e')]();};}function respondWithResult(_0x2bf276,_0x59fae6){_0x59fae6=_0x59fae6||0xc8;return function(_0x3707c1){if(_0x3707c1){return _0x2bf276['status'](_0x59fae6)[_0xa757('0x1f')](_0x3707c1);}};}function respondWithFilteredResult(_0x47903b,_0x40551d){return function(_0x3859ce){if(_0x3859ce){var _0x37c7e6=typeof _0x40551d['offset']===_0xa757('0x20')&&typeof _0x40551d[_0xa757('0x21')]===_0xa757('0x20');var _0x3bf7f3=_0x3859ce['count'];var _0x449a7d=_0x37c7e6?0x0:_0x40551d['offset'];var _0x5a5664=_0x37c7e6?_0x3859ce['count']:_0x40551d['offset']+_0x40551d[_0xa757('0x21')];var _0x596ae2;if(_0x5a5664>=_0x3bf7f3){_0x5a5664=_0x3bf7f3;_0x596ae2=0xc8;}else{_0x596ae2=0xce;}_0x47903b[_0xa757('0x1d')](_0x596ae2);return _0x47903b[_0xa757('0x22')]('Content-Range',_0x449a7d+'-'+_0x5a5664+'/'+_0x3bf7f3)[_0xa757('0x1f')](_0x3859ce);}return null;};}function saveUpdates(_0x5119ad){return function(_0x2c4823){if(_0x2c4823){return _0x2c4823[_0xa757('0x23')](_0x5119ad)['then'](function(_0x235e54){return _0x235e54;});}return null;};}function removeEntity(_0x5ade7b){return function(_0x3a4a66){if(_0x3a4a66){return _0x3a4a66[_0xa757('0x24')]()[_0xa757('0x11')](function(){var _0x300dc4=_0x3a4a66[_0xa757('0x25')]({'plain':!![]});var _0x2c1885=_0xa757('0x26');return db[_0xa757('0x27')][_0xa757('0x24')]({'where':{'type':_0x2c1885,'resourceId':_0x300dc4['id']}})[_0xa757('0x11')](function(){return _0x3a4a66;});})[_0xa757('0x11')](function(){_0x5ade7b[_0xa757('0x1d')](0xcc)[_0xa757('0x1e')]();});}};}function handleEntityNotFound(_0x2dfb33){return function(_0x27be88){if(!_0x27be88){_0x2dfb33[_0xa757('0x1c')](0x194);}return _0x27be88;};}function handleError(_0x3e64b7,_0x1ad384){_0x1ad384=_0x1ad384||0x1f4;return function(_0x1eacde){logger[_0xa757('0x18')](_0x1eacde[_0xa757('0x28')]);if(_0x1eacde[_0xa757('0x29')]){delete _0x1eacde[_0xa757('0x29')];}_0x3e64b7[_0xa757('0x1d')](_0x1ad384)['send'](_0x1eacde);};}exports[_0xa757('0x2a')]=function(_0x21d6b3,_0x1e9d63){var _0x1794a9={'include':[{'model':db[_0xa757('0x2b')],'as':_0xa757('0x2c')}]},_0x1c4c40={},_0x51e2aa={'count':0x0,'rows':[]};var _0x37b1a3=_[_0xa757('0x2d')](db[_0xa757('0x2e')][_0xa757('0x2f')],function(_0x499390){return{'name':_0x499390[_0xa757('0x30')],'type':_0x499390[_0xa757('0x31')][_0xa757('0x32')]};});_0x1c4c40[_0xa757('0x33')]=_[_0xa757('0x2d')](_0x37b1a3,_0xa757('0x29'));_0x1c4c40[_0xa757('0x34')]=_[_0xa757('0x35')](_0x21d6b3[_0xa757('0x34')]);_0x1c4c40['filters']=_[_0xa757('0x36')](_0x1c4c40[_0xa757('0x33')],_0x1c4c40[_0xa757('0x34')]);_0x1794a9[_0xa757('0x37')]=_[_0xa757('0x36')](_0x1c4c40[_0xa757('0x33')],qs['fields'](_0x21d6b3[_0xa757('0x34')][_0xa757('0x38')]));_0x1794a9['attributes']=_0x1794a9['attributes'][_0xa757('0x39')]?_0x1794a9[_0xa757('0x37')]:_0x1c4c40['model'];if(!_0x21d6b3['query'][_0xa757('0x3a')](_0xa757('0x3b'))){_0x1794a9[_0xa757('0x21')]=qs['limit'](_0x21d6b3[_0xa757('0x34')][_0xa757('0x21')]);_0x1794a9[_0xa757('0x3c')]=qs[_0xa757('0x3c')](_0x21d6b3[_0xa757('0x34')]['offset']);}_0x1794a9[_0xa757('0x3d')]=qs['sort'](_0x21d6b3['query'][_0xa757('0x3e')]);_0x1794a9[_0xa757('0x3f')]=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x21d6b3[_0xa757('0x34')],_0x1c4c40['filters']),_0x37b1a3);if(_0x21d6b3['query'][_0xa757('0x42')]){_0x1794a9[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x1794a9[_0xa757('0x3f')],{'$or':_[_0xa757('0x2d')](_0x37b1a3,function(_0x3db5d5){if(_0x3db5d5['type']!==_0xa757('0x44')){var _0x364998={};_0x364998[_0x3db5d5['name']]={'$like':'%'+_0x21d6b3[_0xa757('0x34')]['filter']+'%'};return _0x364998;}})});}_0x1794a9=_[_0xa757('0x43')]({},_0x1794a9,_0x21d6b3[_0xa757('0x45')]);var _0x4cf90f={'where':_0x1794a9[_0xa757('0x3f')]};return db[_0xa757('0x2e')]['count'](_0x4cf90f)[_0xa757('0x11')](function(_0x257bcd){_0x51e2aa[_0xa757('0x46')]=_0x257bcd;if(_0x21d6b3[_0xa757('0x34')]['includeAll']){_0x1794a9[_0xa757('0x47')]=[{'all':!![]}];}return db[_0xa757('0x2e')][_0xa757('0x48')](_0x1794a9);})[_0xa757('0x11')](function(_0x4d7493){_0x51e2aa[_0xa757('0x49')]=_0x4d7493;return _0x51e2aa;})['then'](respondWithFilteredResult(_0x1e9d63,_0x1794a9))['catch'](handleError(_0x1e9d63,null));};exports[_0xa757('0x4a')]=function(_0x3c039d,_0x1ae3ae){var _0x5e13cf={'raw':![],'where':{'id':_0x3c039d['params']['id']},'include':[{'model':db[_0xa757('0x2b')],'as':_0xa757('0x2c')}]},_0x421c65={};_0x421c65[_0xa757('0x33')]=_[_0xa757('0x35')](db[_0xa757('0x2e')][_0xa757('0x2f')]);_0x421c65[_0xa757('0x34')]=_[_0xa757('0x35')](_0x3c039d['query']);_0x421c65[_0xa757('0x40')]=_[_0xa757('0x36')](_0x421c65[_0xa757('0x33')],_0x421c65[_0xa757('0x34')]);_0x5e13cf[_0xa757('0x37')]=_[_0xa757('0x36')](_0x421c65[_0xa757('0x33')],qs[_0xa757('0x38')](_0x3c039d[_0xa757('0x34')][_0xa757('0x38')]));_0x5e13cf[_0xa757('0x37')]=_0x5e13cf[_0xa757('0x37')][_0xa757('0x39')]?_0x5e13cf[_0xa757('0x37')]:_0x421c65[_0xa757('0x33')];if(_0x3c039d[_0xa757('0x34')]['includeAll']){_0x5e13cf[_0xa757('0x47')]=[{'all':!![]}];}_0x5e13cf=_['merge']({},_0x5e13cf,_0x3c039d[_0xa757('0x45')]);return db[_0xa757('0x2e')][_0xa757('0x4b')](_0x5e13cf)[_0xa757('0x11')](handleEntityNotFound(_0x1ae3ae,null))['then'](respondWithResult(_0x1ae3ae,null))[_0xa757('0x4c')](handleError(_0x1ae3ae,null));};exports[_0xa757('0x4d')]=function(_0x8614f9,_0x980e1){return db['ChatWebsite'][_0xa757('0x4d')](_0x8614f9[_0xa757('0x4e')],{})[_0xa757('0x11')](function(_0x1c9f1e){var _0x33666d=_0x8614f9[_0xa757('0x4f')]['get']({'plain':!![]});if(!_0x33666d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33666d['role']==='user'){var _0x1d8742=_0x1c9f1e[_0xa757('0x25')]({'plain':!![]});var _0x137477=_0xa757('0x26');return db[_0xa757('0x50')][_0xa757('0x4b')]({'where':{'name':_0x137477,'userProfileId':_0x33666d['userProfileId']},'raw':!![]})[_0xa757('0x11')](function(_0x163d99){if(_0x163d99&&_0x163d99[_0xa757('0x51')]===0x0){return db[_0xa757('0x27')]['create']({'name':_0x1d8742[_0xa757('0x29')],'resourceId':_0x1d8742['id'],'type':_0x163d99[_0xa757('0x29')],'sectionId':_0x163d99['id']},{})['then'](function(){return _0x1c9f1e;});}else{return _0x1c9f1e;}})[_0xa757('0x4c')](function(_0x5cd0c3){logger[_0xa757('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cd0c3);throw _0x5cd0c3;});}return _0x1c9f1e;})[_0xa757('0x11')](respondWithResult(_0x980e1,0xc9))['catch'](handleError(_0x980e1,null));};exports['update']=function(_0x367b48,_0x235c1e){if(_0x367b48[_0xa757('0x4e')]['id']){delete _0x367b48[_0xa757('0x4e')]['id'];}return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x367b48['params']['id']},'include':[{'model':db['Pause'],'as':_0xa757('0x2c')}]})[_0xa757('0x11')](handleEntityNotFound(_0x235c1e,null))[_0xa757('0x11')](saveUpdates(_0x367b48['body'],null))['then'](respondWithResult(_0x235c1e,null))[_0xa757('0x4c')](handleError(_0x235c1e,null));};exports[_0xa757('0x24')]=function(_0x215a80,_0x504c4f){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x215a80['params']['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x504c4f,null))[_0xa757('0x11')](removeEntity(_0x504c4f,null))[_0xa757('0x4c')](handleError(_0x504c4f,null));};exports[_0xa757('0x52')]=function(_0x1291df,_0xfbcb43){return db[_0xa757('0x2e')][_0xa757('0x52')]()[_0xa757('0x11')](respondWithResult(_0xfbcb43,null))[_0xa757('0x4c')](handleError(_0xfbcb43,null));};exports['addDisposition']=function(_0x9e96e6,_0x5c803a){if(_0x9e96e6['body']['id']){delete _0x9e96e6[_0xa757('0x4e')]['id'];}return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x9e96e6[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x11')](function(_0x1b34ad){if(_0x1b34ad){_0x9e96e6[_0xa757('0x4e')][_0xa757('0x54')]=_0x1b34ad['id'];return db[_0xa757('0x55')][_0xa757('0x4d')](_0x9e96e6['body']);}})[_0xa757('0x11')](respondWithResult(_0x5c803a,null))[_0xa757('0x4c')](handleError(_0x5c803a,null));};exports['getDispositions']=function(_0x11ebb3,_0x409ee9){var _0x198a11={'raw':![],'where':{}};var _0x180cec={};var _0x27d79b={'count':0x0,'rows':[]};return db[_0xa757('0x2e')]['findOne']({'where':{'id':_0x11ebb3[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0x409ee9,null))[_0xa757('0x11')](function(_0x3250d0){if(_0x3250d0){_0x180cec[_0xa757('0x33')]=_[_0xa757('0x35')](db[_0xa757('0x55')]['rawAttributes']);_0x180cec['query']=_[_0xa757('0x35')](_0x11ebb3[_0xa757('0x34')]);_0x180cec[_0xa757('0x40')]=_['intersection'](_0x180cec[_0xa757('0x33')],_0x180cec['query']);_0x198a11[_0xa757('0x37')]=_[_0xa757('0x36')](_0x180cec[_0xa757('0x33')],qs[_0xa757('0x38')](_0x11ebb3[_0xa757('0x34')][_0xa757('0x38')]));_0x198a11['attributes']=_0x198a11[_0xa757('0x37')][_0xa757('0x39')]?_0x198a11[_0xa757('0x37')]:_0x180cec[_0xa757('0x33')];if(!_0x11ebb3[_0xa757('0x34')]['hasOwnProperty'](_0xa757('0x3b'))){_0x198a11[_0xa757('0x21')]=qs[_0xa757('0x21')](_0x11ebb3[_0xa757('0x34')][_0xa757('0x21')]);_0x198a11['offset']=qs[_0xa757('0x3c')](_0x11ebb3[_0xa757('0x34')][_0xa757('0x3c')]);}_0x198a11['order']=qs[_0xa757('0x3e')](_0x11ebb3[_0xa757('0x34')][_0xa757('0x3e')]);_0x198a11[_0xa757('0x3f')]=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x11ebb3[_0xa757('0x34')],_0x180cec[_0xa757('0x40')]));_0x198a11[_0xa757('0x3f')][_0xa757('0x54')]=_0x3250d0['id'];if(_0x11ebb3[_0xa757('0x34')][_0xa757('0x42')]){_0x198a11[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x198a11['where'],{'$or':_[_0xa757('0x2d')](_0x198a11[_0xa757('0x37')],function(_0x532ab5){var _0x11f2b3={};_0x11f2b3[_0x532ab5]={'$like':'%'+_0x11ebb3[_0xa757('0x34')]['filter']+'%'};return _0x11f2b3;})});}_0x198a11=_[_0xa757('0x43')]({},_0x198a11,_0x11ebb3[_0xa757('0x45')]);return db[_0xa757('0x55')][_0xa757('0x46')]({'where':_0x198a11[_0xa757('0x3f')]})[_0xa757('0x11')](function(_0xdb2ac6){_0x27d79b[_0xa757('0x46')]=_0xdb2ac6;if(_0x11ebb3[_0xa757('0x34')][_0xa757('0x56')]){_0x198a11[_0xa757('0x47')]=[{'all':!![]}];}return db[_0xa757('0x55')][_0xa757('0x48')](_0x198a11);})[_0xa757('0x11')](function(_0x27604c){_0x27d79b[_0xa757('0x49')]=_0x27604c;return _0x27d79b;});}})['then'](respondWithFilteredResult(_0x409ee9,_0x198a11))[_0xa757('0x4c')](handleError(_0x409ee9,null));};exports['removeDispositions']=function(_0x39357f,_0x20c444){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x39357f[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0x20c444,null))[_0xa757('0x11')](function(_0x67a58b){if(_0x67a58b){return _0x67a58b[_0xa757('0x57')](_0x39357f['query'][_0xa757('0x58')]);}})[_0xa757('0x11')](respondWithStatusCode(_0x20c444,null))[_0xa757('0x4c')](handleError(_0x20c444,null));};exports['addAnswer']=function(_0x501134,_0x1f437d){if(_0x501134[_0xa757('0x4e')]['id']){delete _0x501134[_0xa757('0x4e')]['id'];}return db['ChatWebsite'][_0xa757('0x4b')]({'where':{'id':_0x501134['params']['id']}})['then'](handleEntityNotFound(_0x1f437d,null))[_0xa757('0x11')](function(_0x1adf5a){if(_0x1adf5a){_0x501134[_0xa757('0x4e')]['ChatWebsiteId']=_0x1adf5a['id'];return db[_0xa757('0x59')][_0xa757('0x4d')](_0x501134[_0xa757('0x4e')]);}})[_0xa757('0x11')](respondWithResult(_0x1f437d,null))[_0xa757('0x4c')](handleError(_0x1f437d,null));};exports[_0xa757('0x5a')]=function(_0x26dcec,_0x44c681){var _0xe38e76={'raw':![],'where':{}};var _0x35c1aa={};var _0x180fee={'count':0x0,'rows':[]};return db[_0xa757('0x2e')]['findOne']({'where':{'id':_0x26dcec[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x44c681,null))[_0xa757('0x11')](function(_0x346a4a){if(_0x346a4a){_0x35c1aa[_0xa757('0x33')]=_[_0xa757('0x35')](db[_0xa757('0x59')][_0xa757('0x2f')]);_0x35c1aa[_0xa757('0x34')]=_[_0xa757('0x35')](_0x26dcec[_0xa757('0x34')]);_0x35c1aa[_0xa757('0x40')]=_[_0xa757('0x36')](_0x35c1aa[_0xa757('0x33')],_0x35c1aa[_0xa757('0x34')]);_0xe38e76[_0xa757('0x37')]=_[_0xa757('0x36')](_0x35c1aa[_0xa757('0x33')],qs[_0xa757('0x38')](_0x26dcec[_0xa757('0x34')][_0xa757('0x38')]));_0xe38e76[_0xa757('0x37')]=_0xe38e76['attributes'][_0xa757('0x39')]?_0xe38e76[_0xa757('0x37')]:_0x35c1aa['model'];if(!_0x26dcec[_0xa757('0x34')]['hasOwnProperty'](_0xa757('0x3b'))){_0xe38e76[_0xa757('0x21')]=qs['limit'](_0x26dcec[_0xa757('0x34')][_0xa757('0x21')]);_0xe38e76[_0xa757('0x3c')]=qs[_0xa757('0x3c')](_0x26dcec['query'][_0xa757('0x3c')]);}_0xe38e76[_0xa757('0x3d')]=qs['sort'](_0x26dcec[_0xa757('0x34')][_0xa757('0x3e')]);_0xe38e76['where']=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x26dcec[_0xa757('0x34')],_0x35c1aa[_0xa757('0x40')]));_0xe38e76[_0xa757('0x3f')][_0xa757('0x54')]=_0x346a4a['id'];if(_0x26dcec[_0xa757('0x34')][_0xa757('0x42')]){_0xe38e76[_0xa757('0x3f')]=_['merge'](_0xe38e76['where'],{'$or':_[_0xa757('0x2d')](_0xe38e76[_0xa757('0x37')],function(_0x11baf9){var _0x234855={};_0x234855[_0x11baf9]={'$like':'%'+_0x26dcec[_0xa757('0x34')][_0xa757('0x42')]+'%'};return _0x234855;})});}_0xe38e76=_[_0xa757('0x43')]({},_0xe38e76,_0x26dcec['options']);return db[_0xa757('0x59')]['count']({'where':_0xe38e76[_0xa757('0x3f')]})[_0xa757('0x11')](function(_0x365a0d){_0x180fee[_0xa757('0x46')]=_0x365a0d;if(_0x26dcec[_0xa757('0x34')]['includeAll']){_0xe38e76[_0xa757('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa757('0x48')](_0xe38e76);})[_0xa757('0x11')](function(_0x183097){_0x180fee[_0xa757('0x49')]=_0x183097;return _0x180fee;});}})['then'](respondWithFilteredResult(_0x44c681,_0xe38e76))[_0xa757('0x4c')](handleError(_0x44c681,null));};exports[_0xa757('0x5b')]=function(_0x187681,_0x3c6d51){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x187681[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x3c6d51,null))['then'](function(_0x24fd9c){if(_0x24fd9c){return _0x24fd9c[_0xa757('0x5b')](_0x187681[_0xa757('0x34')][_0xa757('0x58')]);}})['then'](respondWithStatusCode(_0x3c6d51,null))[_0xa757('0x4c')](handleError(_0x3c6d51,null));};exports[_0xa757('0x5c')]=function(_0x441f80,_0x9b5432){_0x441f80[_0xa757('0x4e')][_0xa757('0x5d')]=_0x441f80[_0xa757('0x5e')]['filename'];return db['ChatWebsite'][_0xa757('0x4b')]({'where':{'id':_0x441f80['params']['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x9b5432,null))['then'](saveUpdates(_0x441f80['body'],null))[_0xa757('0x11')](respondWithResult(_0x9b5432,null))[_0xa757('0x4c')](handleError(_0x9b5432,null));};exports[_0xa757('0x5f')]=function(_0x218030,_0xb95266){_0x218030[_0xa757('0x4e')][_0xa757('0x60')]=_0x218030[_0xa757('0x5e')][_0xa757('0x61')];return db[_0xa757('0x2e')]['find']({'where':{'id':_0x218030[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0xb95266,null))[_0xa757('0x11')](saveUpdates(_0x218030[_0xa757('0x4e')],null))[_0xa757('0x11')](respondWithResult(_0xb95266,null))[_0xa757('0x4c')](handleError(_0xb95266,null));};exports['addCustomerAvatar']=function(_0x3738f9,_0x3ba04e){_0x3738f9[_0xa757('0x4e')][_0xa757('0x62')]=_0x3738f9[_0xa757('0x5e')][_0xa757('0x61')];return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x3738f9[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x3ba04e,null))[_0xa757('0x11')](saveUpdates(_0x3738f9[_0xa757('0x4e')],null))[_0xa757('0x11')](respondWithResult(_0x3ba04e,null))[_0xa757('0x4c')](handleError(_0x3ba04e,null));};exports[_0xa757('0x63')]=function(_0x56a060,_0x4af060){_0x56a060[_0xa757('0x4e')]['systemAvatar']=_0x56a060[_0xa757('0x5e')][_0xa757('0x61')];return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x56a060['params']['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x4af060,null))[_0xa757('0x11')](saveUpdates(_0x56a060[_0xa757('0x4e')],null))[_0xa757('0x11')](respondWithResult(_0x4af060,null))[_0xa757('0x4c')](handleError(_0x4af060,null));};exports[_0xa757('0x64')]=function(_0x526b82,_0x3cb1ec){var _0x3cca3e=path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x67'));var _0x4b1c4c={'where':{'id':_0x526b82['params']['id']},'attributes':['id',_0xa757('0x5d')],'raw':!![]};var _0x531cba=![];return require(_0xa757('0x68'))['getLicense']()[_0xa757('0x11')](function(_0x1dee22){if(_0x1dee22){_0x531cba=_0x1dee22[_0xa757('0x69')];}})[_0xa757('0x11')](function(){return db[_0xa757('0x2e')][_0xa757('0x4b')](_0x4b1c4c);})[_0xa757('0x11')](handleEntityNotFound(_0x3cb1ec,null))[_0xa757('0x11')](function(_0x2ac258){if(_0x2ac258){if(!_[_0xa757('0x6a')](_0x2ac258[_0xa757('0x5d')])){if(fs['existsSync'](path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x6b'),_0x2ac258[_0xa757('0x5d')]))&&_0x531cba){_0x3cca3e=path[_0xa757('0x65')](config[_0xa757('0x66')],'server/files/images/logos/',_0x2ac258[_0xa757('0x5d')]);}}return _0x3cb1ec[_0xa757('0x6c')](_0x3cca3e);}})['catch'](handleError(_0x3cb1ec,null));};exports[_0xa757('0x6d')]=function(_0x68a80b,_0x1f4782){var _0x5e6171=path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x6e'));var _0xfdd493={'where':{'id':_0x68a80b[_0xa757('0x53')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa757('0x2e')]['find'](_0xfdd493)['then'](handleEntityNotFound(_0x1f4782,null))[_0xa757('0x11')](function(_0x544ed2){if(_0x544ed2){if(!_['isNil'](_0x544ed2[_0xa757('0x60')])){if(fs[_0xa757('0x6f')](path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x70'),_0x544ed2[_0xa757('0x60')]))){_0x5e6171=path['join'](config['root'],'server/files/images/avatars/',_0x544ed2['agentAvatar']);}}return _0x1f4782['download'](_0x5e6171);}})['catch'](handleError(_0x1f4782,null));};exports['getCustomerAvatar']=function(_0x1c9b81,_0x536b96){var _0x1ba0df=path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x71'));var _0x46fd6b={'where':{'id':_0x1c9b81[_0xa757('0x53')]['id']},'attributes':['id',_0xa757('0x62'),_0xa757('0x72')],'raw':!![]};return db[_0xa757('0x2e')]['find'](_0x46fd6b)['then'](handleEntityNotFound(_0x536b96,null))[_0xa757('0x11')](function(_0x3147eb){if(_0x3147eb){if(!_[_0xa757('0x6a')](_0x3147eb[_0xa757('0x62')])){if(fs['existsSync'](path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x70'),_0x3147eb[_0xa757('0x62')]))&&_0x3147eb[_0xa757('0x72')]){_0x1ba0df=path[_0xa757('0x65')](config[_0xa757('0x66')],'server/files/images/avatars/',_0x3147eb[_0xa757('0x62')]);}}return _0x536b96[_0xa757('0x6c')](_0x1ba0df);}})['catch'](handleError(_0x536b96,null));};exports[_0xa757('0x73')]=function(_0x3924af,_0x332c68){var _0x18fa30=path[_0xa757('0x65')](config['root'],_0xa757('0x74'));var _0x237c6f={'where':{'id':_0x3924af[_0xa757('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa757('0x2e')][_0xa757('0x4b')](_0x237c6f)[_0xa757('0x11')](handleEntityNotFound(_0x332c68,null))['then'](function(_0x21aeae){if(_0x21aeae){if(!_[_0xa757('0x6a')](_0x21aeae[_0xa757('0x75')])){if(fs[_0xa757('0x6f')](path[_0xa757('0x65')](config['root'],_0xa757('0x70'),_0x21aeae['systemAvatar']))){_0x18fa30=path['join'](config[_0xa757('0x66')],_0xa757('0x70'),_0x21aeae[_0xa757('0x75')]);}}return _0x332c68[_0xa757('0x6c')](_0x18fa30);}})['catch'](handleError(_0x332c68,null));};exports[_0xa757('0x76')]=function(_0x36c462,_0x4735a9){var _0x2aa91b=require(_0xa757('0x77'));var _0x3e660e=new _0x2aa91b();var _0x182d4f=_0x3e660e[_0xa757('0x78')](_0x36c462['headers'][_0xa757('0x79')])[_0xa757('0x7a')]();var _0x1e6f99={'body':_0x36c462[_0xa757('0x4e')],'channel':_0xa757('0x7b')};var _0x182d71=[];var _0x3addae=[];var _0x4024d1={};var _0x160872=![];return db['CmContact']['describe']()[_0xa757('0x11')](function(_0x59b351){if(!_0x59b351){throw new db['Sequelize'][(_0xa757('0x7c'))]('no\x20available\x20attributes');}_0x182d71=_[_0xa757('0x7d')](_[_0xa757('0x35')](_0x59b351),[_0xa757('0x7e'),_0xa757('0x7f')]);_0x3addae=_[_0xa757('0x7d')](_[_0xa757('0x35')](_0x59b351),[_0xa757('0x7e'),_0xa757('0x7f'),_0xa757('0x80'),'ListId']);if(_0x36c462[_0xa757('0x4e')]['id']){delete _0x36c462[_0xa757('0x4e')]['id'];}if(_['isNil'](_0x36c462[_0xa757('0x4e')][_0xa757('0x81')])){throw new db[(_0xa757('0x82'))][(_0xa757('0x7c'))](_0xa757('0x83'));}if(_[_0xa757('0x6a')](_0x36c462[_0xa757('0x4e')][_0xa757('0x4e')])||_0x36c462[_0xa757('0x4e')][_0xa757('0x4e')]===''){throw new db[(_0xa757('0x82'))][(_0xa757('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa757('0x6a')](_0x36c462[_0xa757('0x4e')]['mapKey'])){throw new db[(_0xa757('0x82'))][(_0xa757('0x7c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3addae);}if(!_[_0xa757('0x84')](_0x3addae,_0x36c462[_0xa757('0x4e')][_0xa757('0x85')])){throw new db[(_0xa757('0x82'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3addae);}_0x4024d1[_0x36c462[_0xa757('0x4e')]['mapKey']]=_0x36c462[_0xa757('0x4e')]['from'];})[_0xa757('0x11')](function(){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x36c462[_0xa757('0x53')]['id']},'include':[{'model':db[_0xa757('0x86')],'as':'List','include':[{'model':db['CmContact'],'as':_0xa757('0x87'),'where':_0x4024d1,'limit':0x1,'order':[[_0xa757('0x7f'),_0xa757('0x88')]]}]},{'model':db[_0xa757('0x89')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x4735a9,null))[_0xa757('0x11')](function(_0x50ff83){if(_0x50ff83&&_0x50ff83[_0xa757('0x8a')]){_0x1e6f99[_0xa757('0x8b')]=_0x50ff83;_0x1e6f99[_0xa757('0x8c')]=_0x50ff83[_0xa757('0x8d')];_0x1e6f99[_0xa757('0x8e')]=_0x50ff83[_0xa757('0x8a')];_0x1e6f99[_0xa757('0x8c')]=_['orderBy'](_0x1e6f99[_0xa757('0x8c')],[_0xa757('0x8f')],[_0xa757('0x90')]);if(_0x1e6f99[_0xa757('0x8b')][_0xa757('0x8d')]){delete _0x1e6f99[_0xa757('0x8b')][_0xa757('0x8d')];}if(_0x1e6f99['account']['List']&&_0x1e6f99[_0xa757('0x8b')][_0xa757('0x8a')][_0xa757('0x87')][_0xa757('0x39')]){return _0x1e6f99[_0xa757('0x8b')][_0xa757('0x8a')]['Contacts'][0x0];}var _0x244c9b=_['defaults'](_0x36c462[_0xa757('0x4e')],{'firstName':_0x36c462[_0xa757('0x4e')][_0xa757('0x81')],'ListId':_0x50ff83[_0xa757('0x91')]});_0x244c9b[_0x36c462[_0xa757('0x4e')][_0xa757('0x85')]]=_0x36c462[_0xa757('0x4e')][_0xa757('0x81')];return db[_0xa757('0x92')][_0xa757('0x4d')](_0x244c9b,{'fields':_0x182d71,'raw':!![]});}})['then'](handleEntityNotFound(_0x4735a9,null))['then'](function(_0x3e025a){_0x1e6f99['contact']=_0x3e025a;var _0x4bd0a6=_0x36c462[_0xa757('0x4e')][_0xa757('0x93')];if(_0x36c462['headers'][_0xa757('0x94')]){_0x4bd0a6=_0x36c462['headers'][_0xa757('0x94')];}else if(_0x36c462[_0xa757('0x95')][_0xa757('0x96')]){_0x4bd0a6=_[_0xa757('0x97')](_0x36c462[_0xa757('0x95')][_0xa757('0x96')][_0xa757('0x98')](','));}if(_0x3e025a){var _0x44d742={'ContactId':_0x3e025a['id'],'ChatWebsiteId':_0x36c462['params']['id'],'from':(_0x3e025a['firstName']||'')+'\x20'+(_0x3e025a[_0xa757('0x99')]||''),'customerIp':_0x4bd0a6,'customerPort':_0x36c462['headers'][_0xa757('0x9a')]?_0x36c462[_0xa757('0x95')][_0xa757('0x9a')]:null,'referer':_0x36c462[_0xa757('0x4e')][_0xa757('0x9b')],'browserName':_0x182d4f[_0xa757('0x9c')][_0xa757('0x29')]&&_0x182d4f[_0xa757('0x9c')]['version']?util[_0xa757('0x9d')]('%s\x20%s',_0x182d4f['browser'][_0xa757('0x29')],_0x182d4f[_0xa757('0x9c')][_0xa757('0x9e')]):_0xa757('0x9f'),'browserVersion':_0x182d4f['browser'][_0xa757('0x9e')]||'unknown','osName':util[_0xa757('0x9d')]('%s\x20%s',_0x182d4f['os'][_0xa757('0x29')],_0x182d4f['os'][_0xa757('0x9e')]),'osVersion':_0x182d4f['os']['version'],'deviceModel':_0x182d4f[_0xa757('0xa0')][_0xa757('0x33')]&&_0x182d4f['device'][_0xa757('0xa1')]?util[_0xa757('0x9d')](_0xa757('0xa2'),_0x182d4f[_0xa757('0xa0')][_0xa757('0x33')],_0x182d4f[_0xa757('0xa0')][_0xa757('0xa1')],_0x182d4f['device'][_0xa757('0x31')]):null,'deviceVendor':_0x182d4f[_0xa757('0xa0')]['vendor'],'deviceType':_0x182d4f['device'][_0xa757('0x31')],'formData':JSON[_0xa757('0x17')](_0x36c462[_0xa757('0x4e')])};var _0x1612d5={'ChatWebsiteId':_0x36c462[_0xa757('0x53')]['id'],'closed':![]};if(_0x36c462[_0xa757('0x4e')][_0xa757('0xa3')]){_0x1612d5[_0xa757('0xa3')]=_0x36c462[_0xa757('0x4e')][_0xa757('0xa3')];return db[_0xa757('0xa4')][_0xa757('0x4b')]({'where':_0x1612d5})[_0xa757('0x11')](function(_0x5758db){if(_0x5758db){return[_0x5758db,![]];}_0x44d742[_0xa757('0xa3')]=_0x36c462[_0xa757('0x4e')][_0xa757('0xa3')];_0x44d742['externalUrl']=_0x36c462['body'][_0xa757('0xa5')];return db[_0xa757('0xa4')]['create'](_0x44d742)[_0xa757('0x11')](function(_0xa50160){return[_0xa50160,!![]];});});}_0x1612d5['ContactId']=_0x3e025a['id'];if(_0x36c462[_0xa757('0x4e')]['interaction']&&_0x36c462[_0xa757('0x4e')][_0xa757('0xa6')]['id']){_0x1612d5['id']=_0x36c462[_0xa757('0x4e')][_0xa757('0xa6')]['id'];return db[_0xa757('0xa4')][_0xa757('0x4b')]({'where':_0x1612d5})[_0xa757('0x11')](function(_0x69af1f){if(_0x69af1f){return[_0x69af1f,![]];}return db['ChatInteraction'][_0xa757('0x4d')](_0x44d742)['then'](function(_0x49f140){return[_0x49f140,!![]];});});}return db[_0xa757('0xa4')][_0xa757('0x4d')](_0x44d742)['then'](function(_0x488019){return[_0x488019,!![]];});}})['spread'](function(_0x31084d,_0x1f0e18){if(_0x31084d){_0x160872=_0x1f0e18;if(!_0x1f0e18){var _0x10cf3b={'from':(_0x1e6f99['contact'][_0xa757('0xa7')]||'')+'\x20'+(_0x1e6f99[_0xa757('0xa8')][_0xa757('0x99')]||'')};if(_0x36c462[_0xa757('0x4e')][_0xa757('0xa3')]&&_0x36c462[_0xa757('0x4e')][_0xa757('0xa9')]&&_0x36c462[_0xa757('0x4e')]['threadId']!=_0x36c462[_0xa757('0x4e')]['messageId']){_0x10cf3b[_0xa757('0xa3')]=_0x36c462[_0xa757('0x4e')][_0xa757('0xa9')];}return _0x31084d[_0xa757('0x23')](_0x10cf3b);}else{return _0x31084d;}}})[_0xa757('0x11')](function(_0x56c40e){_0x1e6f99[_0xa757('0xa6')]=_0x56c40e['get']({'plain':!![]});_0x1e6f99[_0xa757('0xa6')][_0xa757('0xaa')]=_0x160872;if(_0x1e6f99[_0xa757('0xa6')][_0xa757('0xaa')]){if(_0x1e6f99[_0xa757('0x8b')][_0xa757('0xab')]){_0x1e6f99[_0xa757('0x8c')][_0xa757('0xac')]({'id':0x0,'priority':_0x1e6f99[_0xa757('0x8c')]['length']+0x1,'app':'close','appdata':_0xa757('0xad'),'interval':_0xa757('0xae')});}}return db['ChatMessage'][_0xa757('0x4d')]({'body':_0x36c462[_0xa757('0x4e')]['body'],'ChatWebsiteId':_0x36c462[_0xa757('0x53')]['id'],'ChatInteractionId':_0x56c40e['id'],'direction':'in','ContactId':_0x1e6f99['contact']['id'],'AttachmentId':_0x36c462[_0xa757('0x4e')][_0xa757('0xaf')]});})[_0xa757('0x11')](function(_0x2bdbdf){_0x1e6f99[_0xa757('0x1a')]=_0x2bdbdf;if(_0x1e6f99[_0xa757('0xa6')][_0xa757('0xb0')]){return db[_0xa757('0xb1')][_0xa757('0x4b')]({'attributes':['id',_0xa757('0x29')],'where':{'id':_0x1e6f99[_0xa757('0xa6')][_0xa757('0xb0')]}})[_0xa757('0x11')](function(_0x5005fa){if(_0x5005fa){_0x1e6f99['applications'][_0xa757('0xb2')]({'id':0x0,'priority':0x0,'app':_0xa757('0xb3'),'appdata':_0x5005fa[_0xa757('0x29')]+','+(_0x1e6f99['account'][_0xa757('0xb4')]||0xa),'interval':_0xa757('0xae')});_0x1e6f99[_0xa757('0xb5')]=!![];}return respondWithRpcPromise(_0xa757('0xb6'),_0xa757('0xb7'),_0x1e6f99);});}return respondWithRpcPromise('Start','startRouting',_0x1e6f99);})[_0xa757('0x11')](function(_0x4606e1){respondWithRpcPromise(_0xa757('0xb8'),'EventManager',{'event':_0xa757('0x76'),'message':_0x4606e1},client9002);return _0x4606e1;})[_0xa757('0x11')](respondWithResult(_0x4735a9,null))['catch'](handleError(_0x4735a9,null));};exports[_0xa757('0xb9')]=function(_0x39527f,_0x257371){var _0x4f8908,_0x41d5d1,_0x5ae589;var _0x1b702f=[];var _0x3540ca={};var _0x22939e=_0x39527f[_0xa757('0xba')]||[];var _0x36ea16=[];var _0x53949c;return db[_0xa757('0x92')]['describe']()[_0xa757('0x11')](function(_0x439650){if(!_0x439650){throw new db[(_0xa757('0x82'))][(_0xa757('0x7c'))]('no\x20available\x20attributes');}_0x1b702f=_['difference'](_[_0xa757('0x35')](_0x439650),[_0xa757('0x7e'),_0xa757('0x7f'),_0xa757('0x80'),_0xa757('0x91')]);if(_0x39527f['body']['id']){delete _0x39527f['body']['id'];}if(_[_0xa757('0x6a')](_0x39527f[_0xa757('0x4e')][_0xa757('0x81')])){throw _0x257371[_0xa757('0x1d')](0x1f4)[_0xa757('0xbb')](new db[(_0xa757('0x82'))]['ValidationError'](_0xa757('0x83')));}if(_[_0xa757('0x6a')](_0x39527f[_0xa757('0x4e')]['body'])||_0x39527f[_0xa757('0x4e')][_0xa757('0x4e')]===''){throw _0x257371[_0xa757('0x1d')](0x1f4)[_0xa757('0xbb')](new db[(_0xa757('0x82'))][(_0xa757('0x7c'))](_0xa757('0xbc')));}if(_['isNil'](_0x39527f[_0xa757('0x4e')][_0xa757('0xbd')])){throw _0x257371[_0xa757('0x1d')](0x1f4)[_0xa757('0xbb')](new db[(_0xa757('0x82'))][(_0xa757('0x7c'))](_0xa757('0xbe')+_0x1b702f));}if(!_['includes'](_0x1b702f,_0x39527f[_0xa757('0x4e')]['mapKeyOffline'])){throw _0x257371[_0xa757('0x1d')](0x1f4)['send'](new db[(_0xa757('0x82'))][(_0xa757('0x7c'))](_0xa757('0xbf')+_0x1b702f));}_0x3540ca[_0x39527f['body']['mapKeyOffline']]=_0x39527f['body'][_0xa757('0x81')];})[_0xa757('0x11')](function(){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x39527f['params']['id']},'include':[{'model':db[_0xa757('0x86')],'as':'List'},{'model':db[_0xa757('0xc0')],'as':_0xa757('0xc0')}]});})[_0xa757('0x11')](handleEntityNotFound(_0x257371,null))['then'](function(_0x42d869){if(_0x42d869&&_0x42d869['List']){_0x41d5d1=_0x42d869;var _0x2cd549=_[_0xa757('0xc1')](_0x39527f['body'],{'firstName':_0x39527f[_0xa757('0x4e')][_0xa757('0x81')],'phone':_0x39527f[_0xa757('0x4e')]['from'],'ListId':_0x42d869['ListId']});_0x2cd549[_0x39527f['body'][_0xa757('0xbd')]]=_0x39527f[_0xa757('0x4e')]['from'];return db['CmContact'][_0xa757('0xc2')]({'where':_0x3540ca,'defaults':_0x2cd549});}})[_0xa757('0xc3')](function(_0x1b7a7b){if(_0x1b7a7b){_0x5ae589=_0x1b7a7b;var _0x4da912=fs['readFileSync'](path['join'](config[_0xa757('0x66')],_0xa757('0xc4')),_0xa757('0xc5'));var _0x330523=ejs[_0xa757('0xc6')](_0x4da912,{'body':_[_0xa757('0xc7')](_0x39527f[_0xa757('0x4e')][_0xa757('0x4e')]),'bodyTitle':_0x41d5d1['offlineMessageBody']});return db[_0xa757('0xc8')][_0xa757('0x4d')]({'body':_0x330523,'plainBody':htmlToText['fromString'](_0x330523),'ContactId':_0x1b7a7b['id'],'ChatWebsiteId':_0x41d5d1['id']});}})[_0xa757('0x11')](function(_0x28ef9c){_0x53949c=_0x28ef9c;if(_0x22939e[_0xa757('0x39')]){var _0x34b501=_0x22939e[_0xa757('0x2d')](function(_0x9b7857){return{'name':_0x9b7857[_0xa757('0xc9')],'basename':_0x9b7857[_0xa757('0x61')],'type':_0x9b7857[_0xa757('0xca')],'ChatOfflineMessageId':_0x28ef9c['id']};});_0x36ea16=_0x34b501[_0xa757('0x2d')](_0x39afb0=>{var _0x1c55ad={'filename':_0x39afb0['name'],'path':path['join'](config[_0xa757('0x66')],_0xa757('0xcb'),_0xa757('0xba'),_0xa757('0xcc'),_0xa757('0xcd'),_0x39afb0[_0xa757('0xce')])};return _0x1c55ad;});if(!_0x41d5d1[_0xa757('0xcf')]){return db['sequelize'][_0xa757('0xd0')](function(_0x2266db){return db[_0xa757('0xd1')][_0xa757('0xd2')](_0x34b501,{'transaction':_0x2266db});});}}})[_0xa757('0x11')](function(){if(_0x53949c){_0x4f8908=_0x53949c;return db[_0xa757('0xc0')][_0xa757('0xd3')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa757('0xd4'),'raw':!![]}]});}})[_0xa757('0x11')](function(_0x4ddabe){if(_0x4ddabe&&_0x4ddabe['Smtp']&&_0x41d5d1['forwardOffline']&&_0x41d5d1[_0xa757('0xd5')]){var _0x50f3e3={'tls':{'rejectUnauthorized':![]}};if(_0x4ddabe['Smtp'][_0xa757('0xd6')]){_0x50f3e3[_0xa757('0xd6')]=_0x4ddabe[_0xa757('0xd4')][_0xa757('0xd6')];}else{_0x50f3e3['host']=_0x4ddabe[_0xa757('0xd4')][_0xa757('0xd7')];_0x50f3e3['port']=_0x4ddabe[_0xa757('0xd4')][_0xa757('0xd8')];_0x50f3e3[_0xa757('0xd9')]=_0x4ddabe[_0xa757('0xd4')]['secure'];}if(_0x4ddabe[_0xa757('0xd4')][_0xa757('0xda')]){_0x50f3e3[_0xa757('0xdb')]={'user':_0x4ddabe[_0xa757('0xd4')][_0xa757('0x4f')],'pass':_0x4ddabe[_0xa757('0xd4')][_0xa757('0xdc')]};}return respondWithRpcPromise(_0xa757('0xdd'),_0xa757('0xde'),{'account':_0x50f3e3,'message':{'from':util['format'](_0xa757('0xdf'),_0x4ddabe[_0xa757('0x29')],_0x4ddabe[_0xa757('0xe0')]||_0x4ddabe[_0xa757('0xd4')][_0xa757('0x4f')]),'to':_0x41d5d1[_0xa757('0xd5')],'subject':_0x41d5d1[_0xa757('0xe1')],'html':_0x4f8908['body'],'attachments':_0x36ea16}},client9003)[_0xa757('0x11')](function(){return _0x4f8908;})[_0xa757('0x4c')](function(_0x2fa389){console[_0xa757('0x18')](_0x2fa389);});}})[_0xa757('0x11')](function(){if(_0x41d5d1&&_0x41d5d1[_0xa757('0xcf')]&&_0x41d5d1[_0xa757('0xe2')]){var _0x1eeff5=[];if(_0x22939e[_0xa757('0x39')]){_0x1eeff5=_0x22939e['map'](function(_0xe4b4ab){return{'name':_0xe4b4ab['originalname'],'basename':_0xe4b4ab['filename'],'type':_0xe4b4ab[_0xa757('0xca')],'ChatOfflineMessageId':_0x53949c['id']};});}var _0x48cf01;if(!_[_0xa757('0x6a')](_0x41d5d1[_0xa757('0xe3')])){var _0x54f4ca=_[_0xa757('0x2d')](_0x39527f['body'],function(_0x522478){return _0x522478;});var _0x451ca7=_['toPairsIn'](_0x54f4ca)[0x0];var _0x5730f3=_['mapValues'](_0x451ca7,function(_0x52aed8){return _0x52aed8;});_0x48cf01=_0x5730f3[0x1][_0x41d5d1['subjectOffline']];}var _0x3a98f9={'from':_0x5ae589[_0xa757('0xe0')],'firstName':_0x5ae589[_0xa757('0xa7')],'lastName':_0x5ae589[_0xa757('0x99')],'mapKey':'email','message':{'from':_0x5ae589[_0xa757('0xe0')],'to':_0x41d5d1[_0xa757('0xc0')][_0xa757('0xe0')],'cc':'','subject':_[_0xa757('0x6a')](_0x48cf01)?_0x41d5d1[_0xa757('0xe1')]:_0x48cf01,'messageId':'','sentAt':new Date(),'attach':_0x1eeff5[_0xa757('0x39')],'attachments':_0x1eeff5,'originChannel':_0xa757('0xe4'),'ChatWebsiteId':_0x41d5d1['id'],'ChatOfflineMessageId':_0x4f8908['id'],'originTo':_0x41d5d1['MailAccount'][_0xa757('0xe0')]},'body':_0x4f8908[_0xa757('0x4e')]};var _0x5be779={'account':{'id':_0x41d5d1[_0xa757('0xe2')]},'body':_0x3a98f9,'log':_0xa757('0xe5')};return respondWithRpcPromise('NotifyMailAccount',_0xa757('0xe6'),_0x5be779,client9001)[_0xa757('0x11')](function(){return _0x4f8908;})[_0xa757('0x4c')](function(_0x2aaf2a){console[_0xa757('0x18')](_0x2aaf2a);});}return;})[_0xa757('0x11')](function(){if(_0x4f8908){return _0x4f8908;}})[_0xa757('0x11')](respondWithResult(_0x257371,null))['catch'](function(_0x3d79d4){console[_0xa757('0x18')](_0xa757('0x4c'),_0x3d79d4);for(var _0x2f667c of _0x22939e){var _0x531b88=path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0xcb'),'files',_0xa757('0xcc'),_0xa757('0xcd'),_0x2f667c['filename']);fs_extra[_0xa757('0xe7')](_0x531b88)['catch'](function(_0x1c38cb){console['error'](_0xa757('0xe8'),_0x531b88,_0x1c38cb);});}});};exports[_0xa757('0xe9')]=function(_0x3039d7,_0x58f20d){return db[_0xa757('0xa4')][_0xa757('0x4b')]({'where':{'id':_0x3039d7[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x58f20d,null))[_0xa757('0x11')](function(_0x4b274f){if(_0x4b274f){return _0x4b274f[_0xa757('0xe9')](_0x3039d7[_0xa757('0x4e')][_0xa757('0x58')],_[_0xa757('0xea')](_0x3039d7[_0xa757('0x4e')],[_0xa757('0x58'),'id'])||{});}})['then'](respondWithResult(_0x58f20d,null))[_0xa757('0x4c')](handleError(_0x58f20d,null));};exports[_0xa757('0xeb')]=function(_0x35a0d8,_0x430ed6){var _0x31dba9={'raw':![],'where':{}};var _0x3eb7d4={};var _0x1b8b13={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xa757('0xd3')]({'where':{'id':_0x35a0d8['params']['id']}})['then'](handleEntityNotFound(_0x430ed6,null))[_0xa757('0x11')](function(_0x3655fa){if(_0x3655fa){_0x3eb7d4[_0xa757('0x33')]=_['keys'](db[_0xa757('0xa4')]['rawAttributes']);_0x3eb7d4[_0xa757('0x34')]=_[_0xa757('0x35')](_0x35a0d8['query']);_0x3eb7d4[_0xa757('0x40')]=_['intersection'](_0x3eb7d4[_0xa757('0x33')],_0x3eb7d4[_0xa757('0x34')]);_0x31dba9[_0xa757('0x37')]=_[_0xa757('0x36')](_0x3eb7d4[_0xa757('0x33')],qs[_0xa757('0x38')](_0x35a0d8[_0xa757('0x34')][_0xa757('0x38')]));_0x31dba9[_0xa757('0x37')]=_0x31dba9[_0xa757('0x37')][_0xa757('0x39')]?_0x31dba9['attributes']:_0x3eb7d4[_0xa757('0x33')];if(!_0x35a0d8[_0xa757('0x34')][_0xa757('0x3a')](_0xa757('0x3b'))){_0x31dba9[_0xa757('0x21')]=qs[_0xa757('0x21')](_0x35a0d8[_0xa757('0x34')][_0xa757('0x21')]);_0x31dba9['offset']=qs[_0xa757('0x3c')](_0x35a0d8['query'][_0xa757('0x3c')]);}_0x31dba9[_0xa757('0x3d')]=qs[_0xa757('0x3e')](_0x35a0d8[_0xa757('0x34')][_0xa757('0x3e')]);_0x31dba9['where']=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x35a0d8[_0xa757('0x34')],_0x3eb7d4['filters']));_0x31dba9[_0xa757('0x3f')]['ChatWebsiteId']=_0x3655fa['id'];if(_0x35a0d8['query'][_0xa757('0x42')]){_0x31dba9[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x31dba9[_0xa757('0x3f')],{'$or':_['map'](_0x31dba9[_0xa757('0x37')],function(_0xdc5215){var _0x41c5ec={};_0x41c5ec[_0xdc5215]={'$like':'%'+_0x35a0d8[_0xa757('0x34')][_0xa757('0x42')]+'%'};return _0x41c5ec;})});}_0x31dba9=_['merge']({},_0x31dba9,_0x35a0d8['options']);return db['ChatInteraction']['count']({'where':_0x31dba9[_0xa757('0x3f')]})['then'](function(_0xb64ce5){_0x1b8b13[_0xa757('0x46')]=_0xb64ce5;if(_0x35a0d8[_0xa757('0x34')][_0xa757('0x56')]){_0x31dba9[_0xa757('0x47')]=[{'model':db[_0xa757('0x92')],'as':_0xa757('0xec'),'required':![]},{'model':db[_0xa757('0xb1')],'as':_0xa757('0xed'),'attributes':[_0xa757('0x29'),_0xa757('0xee'),_0xa757('0xef')],'required':![]},{'model':db[_0xa757('0xf0')],'as':_0xa757('0xf1'),'attributes':['id',_0xa757('0x29'),_0xa757('0xf2')],'where':_0x35a0d8[_0xa757('0x34')][_0xa757('0xf3')]?{'id':_0x35a0d8[_0xa757('0x34')][_0xa757('0xf3')]}:undefined,'required':_0x35a0d8[_0xa757('0x34')][_0xa757('0xf3')]?!![]:![]}];}return db[_0xa757('0xa4')][_0xa757('0x48')](_0x31dba9);})[_0xa757('0x11')](function(_0x1f0f82){_0x1b8b13[_0xa757('0x49')]=_0x1f0f82;return _0x1b8b13;});}})[_0xa757('0x11')](respondWithFilteredResult(_0x430ed6,_0x31dba9))['catch'](handleError(_0x430ed6,null));};function iftimePromise(_0x3bd029,_0x2f37ca){return respondWithRpcPromise(_0xa757('0xf4'),_0xa757('0xf5'),{'command':_0x2f37ca['timezone']?util[_0xa757('0x9d')](_0xa757('0xf6'),_0x3bd029[_0xa757('0xf7')],_0x2f37ca[_0xa757('0xf8')]):util[_0xa757('0x9d')](_0xa757('0xf9'),_0x3bd029[_0xa757('0xf7')])},client9002)[_0xa757('0x11')](function(_0x7e03ff){var _0x1bb7ed=_0x7e03ff&&_0x7e03ff[_0xa757('0xfa')](_0xa757('0xfb'))>=0x0?!![]:![];logger[_0xa757('0x12')](_0xa757('0xfc'),_0x2f37ca['id'],_0x3bd029['id'],_0x3bd029['interval'],_0x1bb7ed?_0xa757('0xfd'):_0xa757('0xfe'),_0x2f37ca['timezone']?_0x2f37ca[_0xa757('0xf8')]:_0xa757('0xff'));return _0x1bb7ed;})[_0xa757('0x4c')](function(_0x466f7b){logger['error'](_0xa757('0xfc'),_0x2f37ca['id'],_0x3bd029['id'],_0x3bd029[_0xa757('0xf7')],util[_0xa757('0x100')](_0x466f7b,{'showHidden':![],'depth':null}),_0x2f37ca[_0xa757('0xf8')]?_0x2f37ca[_0xa757('0xf8')]:_0xa757('0xff'));return![];});}exports[_0xa757('0xf5')]=function(_0x195707,_0x32311d){var _0x1d83a8=0x0;var _0x2da3b2=0x0;var _0x4f10fc=![];var _0x5d427d;var _0x5ad837;return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x195707[_0xa757('0x53')]['id']},'include':[{'model':db[_0xa757('0x101')],'as':_0xa757('0x101'),'include':[{'model':db[_0xa757('0x101')],'as':_0xa757('0x102'),'attributes':['id',_0xa757('0xf7')],'raw':!![]}]}]})[_0xa757('0x11')](handleEntityNotFound(_0x32311d,null))[_0xa757('0x11')](function(_0x46c664){if(_0x46c664){_0x5d427d=_0x46c664;return _0x46c664[_0xa757('0x103')]({'raw':!![]});}})[_0xa757('0x11')](function(_0x7af4cd){if(_0x5d427d){if(_0x7af4cd){_0x5ad837=_0x7af4cd;}}return require(_0xa757('0x68'))[_0xa757('0x104')]();})[_0xa757('0x11')](function(_0x38727a){if(_0x38727a){_0x2da3b2=_0x38727a[_0xa757('0x105')];_0x4f10fc=_0x38727a[_0xa757('0x69')];}})[_0xa757('0x11')](function(){return db[_0xa757('0xa4')][_0xa757('0x46')]({'where':{'closed':![]}});})[_0xa757('0x11')](function(_0x196823){_0x1d83a8=_0x196823;if(_0x2da3b2&&_0x196823>_0x2da3b2){return db['License'][_0xa757('0xd3')]({'where':{'id':0x1}})[_0xa757('0x11')](function(_0x2328eb){if(_0x2328eb){_0x2328eb[_0xa757('0x106')]('chatLicenseExceeded');}});}})[_0xa757('0x11')](function(){if(_0x5d427d['Interval']&&_0x5d427d[_0xa757('0x101')][_0xa757('0x102')]){var _0x1a2818=[];for(var _0x56b7f3=0x0;_0x56b7f3<_0x5d427d[_0xa757('0x101')]['Intervals']['length'];_0x56b7f3++){var _0x411c88=_0x5d427d[_0xa757('0x101')]['Intervals'][_0x56b7f3][_0xa757('0x25')]({'plain':!![]});_0x1a2818[_0xa757('0xac')](iftimePromise(_0x411c88,_0x5d427d));}return BPromise[_0xa757('0x107')](_0x1a2818)[_0xa757('0x11')](function(_0x39442a){return _[_0xa757('0x108')](_0x39442a);});}else{return!![];}})[_0xa757('0x11')](function(_0x3ef371){var _0x46465a=fs[_0xa757('0x109')](path[_0xa757('0x65')](config[_0xa757('0x66')],_0xa757('0x10a')),_0xa757('0xc5'));var _0x466b78={'remote':_0x5d427d[_0xa757('0x10b')],'query':querystring[_0xa757('0x17')](_[_0xa757('0x43')](_0x5d427d[_0xa757('0x25')]({'plain':!![]}),{'customerIp':_0x195707['headers']['x-forwarded-for']||_0x195707[_0xa757('0x95')][_0xa757('0x10c')]||_0x195707[_0xa757('0x10d')][_0xa757('0x10e')]||_0x195707['ip'],'referer':_0x195707[_0xa757('0x95')][_0xa757('0x9b')],'openedInteractions':_0x1d83a8,'maxInteractions':_0x2da3b2,'virtual':_0x4f10fc[_0xa757('0x105')],'online':_0x3ef371,'custom':_0x4f10fc}))['replace'](/'/g,'\x5c\x27')};_0x32311d[_0xa757('0xbb')](ejs[_0xa757('0xc6')](Mustache[_0xa757('0xc6')](_0x46465a,_0x466b78),{'proactiveActions':_0x5ad837,'alignment':_0x5d427d[_0xa757('0x10f')],'verticalAlignment':_0x5d427d[_0xa757('0x110')],'div_color':_0x5d427d['color'],'labelText':_0x5d427d[_0xa757('0x111')],'text_color':_0x5d427d['textColor'],'button_color':_0x5d427d[_0xa757('0x112')],'background_color':_0x5d427d['backgroundColor']}));})[_0xa757('0x4c')](handleError(_0x32311d,null));};exports[_0xa757('0x113')]=function(_0x52a8a8,_0x59039a){var _0x2892a7=_0x52a8a8[_0xa757('0x53')]['id'];var _0x54a489=_0x52a8a8[_0xa757('0x4e')];var _0xe21512=0xc8;var _0x25aad1=null;return db[_0xa757('0x114')][_0xa757('0xd0')]({'isolationLevel':db[_0xa757('0x114')]['Transaction'][_0xa757('0x115')][_0xa757('0x116')]},function(_0x1132f2){return db[_0xa757('0x2e')][_0xa757('0xd3')]({'where':{'id':_0x2892a7},'transaction':_0x1132f2})[_0xa757('0x11')](function(_0x1e3ee8){if(_0x1e3ee8){return db[_0xa757('0x89')][_0xa757('0x24')]({'where':{'ChatWebsiteId':_0x2892a7},'transaction':_0x1132f2})[_0xa757('0x11')](function(){var _0x17135b=_[_0xa757('0x2d')](_0x54a489,function(_0x4ebd06){_0x4ebd06[_0xa757('0x54')]=_0x2892a7;return _0x4ebd06;});return db[_0xa757('0x89')][_0xa757('0xd2')](_0x17135b,{'transaction':_0x1132f2});});}else{_0xe21512=0x194;_0x25aad1=[];}});})[_0xa757('0x11')](function(){if(_0xe21512!==0x194){return db['ChatApplication'][_0xa757('0x117')]({'where':{'ChatWebsiteId':_0x2892a7},'order':_0xa757('0x8f')})[_0xa757('0x11')](function(_0x141d20){_0x25aad1=_0x141d20;});}})[_0xa757('0x4c')](function(_0x54f67c){_0xe21512=0x1f4;logger[_0xa757('0x18')](_0x54f67c[_0xa757('0x28')]);if(_0x54f67c[_0xa757('0x29')]){delete _0x54f67c[_0xa757('0x29')];}_0x25aad1=_0x54f67c;})[_0xa757('0x118')](function(){if(_0x25aad1===null){_0x59039a[_0xa757('0x1c')](_0xe21512);}else{if(_0xe21512===0x1f4){_0x59039a[_0xa757('0x1d')](_0xe21512)[_0xa757('0xbb')](_0x25aad1);}else{_0x59039a[_0xa757('0x1d')](_0xe21512)['json'](_0x25aad1);}}});};exports[_0xa757('0x119')]=function(_0x505a2a,_0x344d13){var _0x5836cd={};var _0x35fe4e={};var _0x418eeb;var _0xc25de1;return db[_0xa757('0x2e')]['findOne']({'where':{'id':_0x505a2a[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0x344d13,null))[_0xa757('0x11')](function(_0x16a500){if(_0x16a500){_0x418eeb=_0x16a500;_0x35fe4e[_0xa757('0x33')]=_[_0xa757('0x35')](db[_0xa757('0x89')][_0xa757('0x2f')]);_0x35fe4e[_0xa757('0x34')]=_[_0xa757('0x35')](_0x505a2a[_0xa757('0x34')]);_0x35fe4e[_0xa757('0x40')]=_[_0xa757('0x36')](_0x35fe4e[_0xa757('0x33')],_0x35fe4e[_0xa757('0x34')]);_0x5836cd[_0xa757('0x37')]=_[_0xa757('0x36')](_0x35fe4e[_0xa757('0x33')],qs[_0xa757('0x38')](_0x505a2a[_0xa757('0x34')][_0xa757('0x38')]));_0x5836cd[_0xa757('0x37')]=_0x5836cd[_0xa757('0x37')]['length']?_0x5836cd[_0xa757('0x37')]:_0x35fe4e[_0xa757('0x33')];_0x5836cd[_0xa757('0x3d')]=qs[_0xa757('0x3e')](_0x505a2a[_0xa757('0x34')][_0xa757('0x3e')]);_0x5836cd[_0xa757('0x3f')]=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x505a2a[_0xa757('0x34')],_0x35fe4e['filters']));if(_0x505a2a['query'][_0xa757('0x42')]){_0x5836cd[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x5836cd[_0xa757('0x3f')],{'$or':_[_0xa757('0x2d')](_0x5836cd['attributes'],function(_0xf19c44){var _0x648a92={};_0x648a92[_0xf19c44]={'$like':'%'+_0x505a2a[_0xa757('0x34')][_0xa757('0x42')]+'%'};return _0x648a92;})});}_0x5836cd=_[_0xa757('0x43')]({},_0x5836cd,_0x505a2a[_0xa757('0x45')]);return _0x418eeb[_0xa757('0x119')](_0x5836cd);}})['then'](function(_0x4c53e3){if(_0x4c53e3){_0xc25de1=_0x4c53e3[_0xa757('0x39')];if(!_0x505a2a[_0xa757('0x34')]['hasOwnProperty']('nolimit')){_0x5836cd['limit']=qs[_0xa757('0x21')](_0x505a2a[_0xa757('0x34')][_0xa757('0x21')]);_0x5836cd[_0xa757('0x3c')]=qs[_0xa757('0x3c')](_0x505a2a[_0xa757('0x34')]['offset']);}return _0x418eeb[_0xa757('0x119')](_0x5836cd);}})['then'](function(_0x14ab00){if(_0x14ab00){return _0x14ab00?{'count':_0xc25de1,'rows':_0x14ab00}:null;}})[_0xa757('0x11')](respondWithResult(_0x344d13,null))[_0xa757('0x4c')](handleError(_0x344d13,null));};exports['addProactiveActions']=function(_0x34cd11,_0xd8ff77){return db[_0xa757('0x11a')][_0xa757('0x4b')]({'where':{'id':_0x34cd11[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0xd8ff77,null))[_0xa757('0x11')](function(_0x5da427){if(_0x5da427){return _0x5da427[_0xa757('0x11b')](_0x34cd11[_0xa757('0x4e')][_0xa757('0x58')],_[_0xa757('0xea')](_0x34cd11[_0xa757('0x4e')],[_0xa757('0x58'),'id'])||{});}})['then'](respondWithResult(_0xd8ff77,null))[_0xa757('0x4c')](handleError(_0xd8ff77,null));};exports[_0xa757('0x103')]=function(_0x4067a2,_0x2e8eb6){var _0x3e454d={};var _0x265365={};var _0x3b12e9;var _0x1b753b;return db[_0xa757('0x2e')][_0xa757('0xd3')]({'where':{'id':_0x4067a2[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e8eb6,null))[_0xa757('0x11')](function(_0x119e10){if(_0x119e10){_0x3b12e9=_0x119e10;_0x265365['model']=_[_0xa757('0x35')](db[_0xa757('0x11c')]['rawAttributes']);_0x265365['query']=_[_0xa757('0x35')](_0x4067a2[_0xa757('0x34')]);_0x265365[_0xa757('0x40')]=_[_0xa757('0x36')](_0x265365[_0xa757('0x33')],_0x265365[_0xa757('0x34')]);_0x3e454d['attributes']=_[_0xa757('0x36')](_0x265365[_0xa757('0x33')],qs['fields'](_0x4067a2[_0xa757('0x34')][_0xa757('0x38')]));_0x3e454d['attributes']=_0x3e454d['attributes']['length']?_0x3e454d[_0xa757('0x37')]:_0x265365[_0xa757('0x33')];_0x3e454d['order']=qs[_0xa757('0x3e')](_0x4067a2['query'][_0xa757('0x3e')]);_0x3e454d[_0xa757('0x3f')]=qs['filters'](_['pick'](_0x4067a2[_0xa757('0x34')],_0x265365[_0xa757('0x40')]));if(_0x4067a2[_0xa757('0x34')][_0xa757('0x42')]){_0x3e454d[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x3e454d['where'],{'$or':_[_0xa757('0x2d')](_0x3e454d[_0xa757('0x37')],function(_0x5c371b){var _0x5c1bae={};_0x5c1bae[_0x5c371b]={'$like':'%'+_0x4067a2[_0xa757('0x34')][_0xa757('0x42')]+'%'};return _0x5c1bae;})});}_0x3e454d=_['merge']({},_0x3e454d,_0x4067a2['options']);return _0x3b12e9['getProactiveActions'](_0x3e454d);}})[_0xa757('0x11')](function(_0x21a21d){if(_0x21a21d){_0x1b753b=_0x21a21d[_0xa757('0x39')];if(!_0x4067a2[_0xa757('0x34')][_0xa757('0x3a')](_0xa757('0x3b'))){_0x3e454d[_0xa757('0x21')]=qs[_0xa757('0x21')](_0x4067a2['query']['limit']);_0x3e454d[_0xa757('0x3c')]=qs[_0xa757('0x3c')](_0x4067a2['query'][_0xa757('0x3c')]);}return _0x3b12e9[_0xa757('0x103')](_0x3e454d);}})[_0xa757('0x11')](function(_0x2d94f8){if(_0x2d94f8){return _0x2d94f8?{'count':_0x1b753b,'rows':_0x2d94f8}:null;}})[_0xa757('0x11')](respondWithResult(_0x2e8eb6,null))[_0xa757('0x4c')](handleError(_0x2e8eb6,null));};exports[_0xa757('0x11d')]=function(_0x26957f,_0x3c7bf7){var _0x1d431e=_0x26957f[_0xa757('0x34')]['online']===_0xa757('0x11e')?_0xa757('0x11f'):_0xa757('0x120');return db['ChatWebsite'][_0xa757('0x4b')]({'attributes':['id',_0x1d431e],'where':{'id':_0x26957f[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x3c7bf7,null))[_0xa757('0x11')](function(_0x325afa){if(_0x325afa){var _0x4be11c=_0x325afa[_0x1d431e];var _0x2c06d5=_0x4be11c&&_0x4be11c[_0xa757('0x121')]?_0x4be11c[_0xa757('0x121')]:[];_0x3c7bf7[_0xa757('0xbb')]({'fromKey':_[_0xa757('0x6a')](_0x4be11c[_0xa757('0x122')])?undefined:_0x4be11c['fromKey'],'count':_0x2c06d5[_0xa757('0x39')],'rows':_0x2c06d5});}})[_0xa757('0x4c')](handleError(_0x3c7bf7,null));};exports[_0xa757('0x123')]=function(_0x193bd6,_0x4ed18b){var _0x3ae2d6={'raw':![],'where':{}};var _0x1f687b={};var _0x40d442={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x193bd6[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x4ed18b,null))['then'](function(_0x5cce3e){if(_0x5cce3e){_0x1f687b[_0xa757('0x33')]=_[_0xa757('0x35')](db[_0xa757('0xc8')][_0xa757('0x2f')]);_0x1f687b['query']=_[_0xa757('0x35')](_0x193bd6[_0xa757('0x34')]);_0x1f687b[_0xa757('0x40')]=_[_0xa757('0x36')](_0x1f687b['model'],_0x1f687b[_0xa757('0x34')]);_0x3ae2d6[_0xa757('0x37')]=_[_0xa757('0x36')](_0x1f687b[_0xa757('0x33')],qs[_0xa757('0x38')](_0x193bd6[_0xa757('0x34')][_0xa757('0x38')]));_0x3ae2d6[_0xa757('0x37')]=_0x3ae2d6[_0xa757('0x37')][_0xa757('0x39')]?_0x3ae2d6[_0xa757('0x37')]:_0x1f687b[_0xa757('0x33')];if(!_0x193bd6[_0xa757('0x34')][_0xa757('0x3a')](_0xa757('0x3b'))){_0x3ae2d6[_0xa757('0x21')]=qs['limit'](_0x193bd6[_0xa757('0x34')][_0xa757('0x21')]);_0x3ae2d6['offset']=qs[_0xa757('0x3c')](_0x193bd6[_0xa757('0x34')][_0xa757('0x3c')]);}_0x3ae2d6[_0xa757('0x3d')]=qs['sort'](_0x193bd6[_0xa757('0x34')][_0xa757('0x3e')]);_0x3ae2d6['where']=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x193bd6[_0xa757('0x34')],_0x1f687b[_0xa757('0x40')]));_0x3ae2d6['where'][_0xa757('0x54')]=_0x5cce3e['id'];if(_0x193bd6[_0xa757('0x34')][_0xa757('0x42')]){_0x3ae2d6['where']=_['merge'](_0x3ae2d6[_0xa757('0x3f')],{'$or':_[_0xa757('0x2d')](_0x3ae2d6[_0xa757('0x37')],function(_0x5df3a1){var _0x3949b5={};_0x3949b5[_0x5df3a1]={'$like':'%'+_0x193bd6[_0xa757('0x34')][_0xa757('0x42')]+'%'};return _0x3949b5;})});}_0x3ae2d6=_['merge']({},_0x3ae2d6,_0x193bd6[_0xa757('0x45')]);return db['ChatOfflineMessage'][_0xa757('0x46')]({'where':_0x3ae2d6[_0xa757('0x3f')]})[_0xa757('0x11')](function(_0x3d3fbe){_0x40d442[_0xa757('0x46')]=_0x3d3fbe;if(_0x193bd6['query'][_0xa757('0x56')]){_0x3ae2d6[_0xa757('0x47')]=[{'all':!![]}];}else{_0x3ae2d6['include']=[{'model':db[_0xa757('0x92')],'as':_0xa757('0xec'),'required':![]},{'model':db[_0xa757('0xd1')],'as':_0xa757('0x124'),'required':![]}];}return db[_0xa757('0xc8')][_0xa757('0x48')](_0x3ae2d6);})[_0xa757('0x11')](function(_0x4779a1){_0x40d442[_0xa757('0x49')]=_0x4779a1;return _0x40d442;});}})['then'](respondWithFilteredResult(_0x4ed18b,_0x3ae2d6))[_0xa757('0x4c')](handleError(_0x4ed18b,null));};exports['addAgents']=function(_0x153d6e,_0x5cce1a){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x153d6e[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x5cce1a,null))['then'](function(_0x19d612){if(_0x19d612){return _0x19d612[_0xa757('0x125')](_0x153d6e[_0xa757('0x4e')][_0xa757('0x58')],_[_0xa757('0xea')](_0x153d6e[_0xa757('0x4e')],[_0xa757('0x58'),'id'])||{})['spread'](function(_0x2dd360){for(var _0x17a46c=0x0;_0x17a46c<_0x153d6e[_0xa757('0x4e')][_0xa757('0x58')][_0xa757('0x39')];_0x17a46c+=0x1){socket['emit'](_0xa757('0x126'),{'UserId':Number(_0x153d6e[_0xa757('0x4e')][_0xa757('0x58')][_0x17a46c]),'ChatWebsiteId':Number(_0x153d6e[_0xa757('0x53')]['id'])});}return _0x2dd360;});}})[_0xa757('0x11')](respondWithResult(_0x5cce1a,null))[_0xa757('0x4c')](handleError(_0x5cce1a,null));};exports[_0xa757('0x127')]=function(_0x509030,_0x20c801){return db[_0xa757('0x2e')][_0xa757('0x4b')]({'where':{'id':_0x509030[_0xa757('0x53')]['id']}})[_0xa757('0x11')](handleEntityNotFound(_0x20c801,null))[_0xa757('0x11')](function(_0x2f435e){if(_0x2f435e){return _0x2f435e[_0xa757('0x127')](_0x509030['query'][_0xa757('0x58')])[_0xa757('0x11')](function(){if(_[_0xa757('0x128')](_0x509030['query']['ids'])){for(var _0x38ebb2=0x0;_0x38ebb2<_0x509030[_0xa757('0x34')][_0xa757('0x58')][_0xa757('0x39')];_0x38ebb2+=0x1){socket[_0xa757('0x129')](_0xa757('0x12a'),{'UserId':Number(_0x509030[_0xa757('0x34')][_0xa757('0x58')][_0x38ebb2]),'ChatWebsiteId':Number(_0x509030[_0xa757('0x53')]['id'])});}}else{socket['emit'](_0xa757('0x12a'),{'UserId':Number(_0x509030['query'][_0xa757('0x58')]),'ChatWebsiteId':Number(_0x509030[_0xa757('0x53')]['id'])});}});}})[_0xa757('0x11')](respondWithStatusCode(_0x20c801,null))['catch'](handleError(_0x20c801,null));};exports[_0xa757('0x12b')]=function(_0x13dd20,_0x42a68c){var _0x35b73f={};var _0x45249e={};var _0x381ec6;var _0x29ebb3;return db[_0xa757('0x2e')][_0xa757('0xd3')]({'where':{'id':_0x13dd20[_0xa757('0x53')]['id']}})['then'](handleEntityNotFound(_0x42a68c,null))[_0xa757('0x11')](function(_0x39ee36){if(_0x39ee36){_0x381ec6=_0x39ee36;_0x45249e[_0xa757('0x33')]=_['keys'](db['User'][_0xa757('0x2f')]);_0x45249e['query']=_[_0xa757('0x35')](_0x13dd20['query']);_0x45249e['filters']=_[_0xa757('0x36')](_0x45249e[_0xa757('0x33')],_0x45249e[_0xa757('0x34')]);_0x35b73f[_0xa757('0x37')]=_[_0xa757('0x36')](_0x45249e[_0xa757('0x33')],qs['fields'](_0x13dd20['query'][_0xa757('0x38')]));_0x35b73f[_0xa757('0x37')]=_0x35b73f['attributes']['length']?_0x35b73f['attributes']:_0x45249e[_0xa757('0x33')];_0x35b73f[_0xa757('0x3d')]=qs[_0xa757('0x3e')](_0x13dd20['query'][_0xa757('0x3e')]);_0x35b73f[_0xa757('0x3f')]=qs[_0xa757('0x40')](_[_0xa757('0x41')](_0x13dd20[_0xa757('0x34')],_0x45249e[_0xa757('0x40')]));if(_0x13dd20[_0xa757('0x34')][_0xa757('0x42')]){_0x35b73f[_0xa757('0x3f')]=_[_0xa757('0x43')](_0x35b73f[_0xa757('0x3f')],{'$or':_[_0xa757('0x2d')](_0x35b73f[_0xa757('0x37')],function(_0x32f78f){var _0x4fc399={};_0x4fc399[_0x32f78f]={'$like':'%'+_0x13dd20[_0xa757('0x34')]['filter']+'%'};return _0x4fc399;})});}_0x35b73f=_[_0xa757('0x43')]({},_0x35b73f,_0x13dd20[_0xa757('0x45')]);return _0x381ec6[_0xa757('0x12b')](_0x35b73f);}})[_0xa757('0x11')](function(_0xe79266){if(_0xe79266){_0x29ebb3=_0xe79266[_0xa757('0x39')];if(!_0x13dd20[_0xa757('0x34')][_0xa757('0x3a')]('nolimit')){_0x35b73f[_0xa757('0x21')]=qs[_0xa757('0x21')](_0x13dd20[_0xa757('0x34')][_0xa757('0x21')]);_0x35b73f[_0xa757('0x3c')]=qs['offset'](_0x13dd20[_0xa757('0x34')][_0xa757('0x3c')]);}return _0x381ec6[_0xa757('0x12b')](_0x35b73f);}})[_0xa757('0x11')](function(_0x2a5c0a){if(_0x2a5c0a){return _0x2a5c0a?{'count':_0x29ebb3,'rows':_0x2a5c0a}:null;}})[_0xa757('0x11')](respondWithResult(_0x42a68c,null))[_0xa757('0x4c')](handleError(_0x42a68c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b6f49ba..48f382a 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 _0x59c3=['update','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x3a86e4,_0x100abd){var _0x1de922=function(_0x4f9c04){while(--_0x4f9c04){_0x3a86e4['push'](_0x3a86e4['shift']());}};_0x1de922(++_0x100abd);}(_0x59c3,0x133));var _0x359c=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x59c3[_0x2cf2e9];return _0xd3670d;};'use strict';var EventEmitter=require(_0x359c('0x0'));var ChatWebsite=require(_0x359c('0x1'))['db'][_0x359c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x359c('0x3')](0x0);var events={'afterCreate':_0x359c('0x4'),'afterUpdate':_0x359c('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa40711){return function(_0x225098,_0x61333a,_0x9497b6){ChatWebsiteEvents[_0x359c('0x6')](_0xa40711+':'+_0x225098['id'],_0x225098);ChatWebsiteEvents[_0x359c('0x6')](_0xa40711,_0x225098);_0x9497b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x359c('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x7d86=['emit','hasOwnProperty','hook','exports','events','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x12ca7a,_0x3295bf){var _0x2249df=function(_0x48b046){while(--_0x48b046){_0x12ca7a['push'](_0x12ca7a['shift']());}};_0x2249df(++_0x3295bf);}(_0x7d86,0x86));var _0x67d8=function(_0x374fc6,_0x164861){_0x374fc6=_0x374fc6-0x0;var _0x39deb1=_0x7d86[_0x374fc6];return _0x39deb1;};'use strict';var EventEmitter=require(_0x67d8('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x67d8('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x67d8('0x2')](0x0);var events={'afterCreate':_0x67d8('0x3'),'afterUpdate':_0x67d8('0x4'),'afterDestroy':_0x67d8('0x5')};function emitEvent(_0x431294){return function(_0x3f58a1,_0x517caf,_0x3679f5){ChatWebsiteEvents[_0x67d8('0x6')](_0x431294+':'+_0x3f58a1['id'],_0x3f58a1);ChatWebsiteEvents[_0x67d8('0x6')](_0x431294,_0x3f58a1);_0x3679f5(null);};}for(var e in events){if(events[_0x67d8('0x7')](e)){var event=events[e];ChatWebsite[_0x67d8('0x8')](e,emitEvent(event));}}module[_0x67d8('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 b6d91cc..1684167 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 _0xe9cb=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9cb,0x128));var _0xbe9c=function(_0x21e418,_0xcedbf5){_0x21e418=_0x21e418-0x0;var _0x3e5bc7=_0xe9cb[_0x21e418];return _0x3e5bc7;};'use strict';var _=require(_0xbe9c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe9c('0x1'));var moment=require('moment');var BPromise=require(_0xbe9c('0x2'));var rp=require(_0xbe9c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9c('0x4'));var config=require(_0xbe9c('0x5'));var attributes=require(_0xbe9c('0x6'));module[_0xbe9c('0x7')]=function(_0x5f15e3,_0x7cd420){return _0x5f15e3[_0xbe9c('0x8')]('ChatWebsite',attributes,{'tableName':_0xbe9c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee5=['util','../../config/logger','api','bluebird','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x6b5dff,_0x5784fd){var _0x52e0d4=function(_0x338860){while(--_0x338860){_0x6b5dff['push'](_0x6b5dff['shift']());}};_0x52e0d4(++_0x5784fd);}(_0x6ee5,0x188));var _0x56ee=function(_0x2da923,_0x56a642){_0x2da923=_0x2da923-0x0;var _0x3f24b7=_0x6ee5[_0x2da923];return _0x3f24b7;};'use strict';var _=require('lodash');var util=require(_0x56ee('0x0'));var logger=require(_0x56ee('0x1'))(_0x56ee('0x2'));var moment=require('moment');var BPromise=require(_0x56ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56ee('0x4'));var attributes=require(_0x56ee('0x5'));module[_0x56ee('0x6')]=function(_0x8d8cc7,_0x2f85dc){return _0x8d8cc7[_0x56ee('0x7')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 60ebd32..11a7052 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 _0x9f8d=['localhost','socket.io-emitter','redis','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x5312e3,_0x21fdb4){var _0x4181dc=function(_0x50ef05){while(--_0x50ef05){_0x5312e3['push'](_0x5312e3['shift']());}};_0x4181dc(++_0x21fdb4);}(_0x9f8d,0xc5));var _0xd9f8=function(_0x336c5b,_0x4abbce){_0x336c5b=_0x336c5b-0x0;var _0x11edfd=_0x9f8d[_0x336c5b];return _0x11edfd;};'use strict';var _=require(_0xd9f8('0x0'));var util=require(_0xd9f8('0x1'));var moment=require(_0xd9f8('0x2'));var BPromise=require(_0xd9f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9f8('0x4'));var logger=require('../../config/logger')(_0xd9f8('0x5'));var config=require(_0xd9f8('0x6'));var jayson=require(_0xd9f8('0x7'));var client=jayson[_0xd9f8('0x8')][_0xd9f8('0x9')]({'port':0x232a});config['redis']=_[_0xd9f8('0xa')](config['redis'],{'host':_0xd9f8('0xb'),'port':0x18eb});var socket=require(_0xd9f8('0xc'))(new Redis(config[_0xd9f8('0xd')]));require('./chatWebsite.socket')[_0xd9f8('0xe')](socket);function respondWithRpcPromise(_0x8e5998,_0x9f8fa9,_0x5f0d51){return new BPromise(function(_0x4fd502,_0x8d25a0){return client[_0xd9f8('0xf')](_0x8e5998,_0x5f0d51)[_0xd9f8('0x10')](function(_0x4c1304){logger[_0xd9f8('0x11')](_0xd9f8('0x12'),_0x9f8fa9,'request\x20sent');logger[_0xd9f8('0x13')](_0xd9f8('0x14'),_0x9f8fa9,_0xd9f8('0x15'),JSON[_0xd9f8('0x16')](_0x4c1304));if(_0x4c1304['error']){if(_0x4c1304['error'][_0xd9f8('0x17')]===0x1f4){logger[_0xd9f8('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x9f8fa9,_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);return _0x8d25a0(_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);}logger[_0xd9f8('0x18')](_0xd9f8('0x12'),_0x9f8fa9,_0x4c1304[_0xd9f8('0x18')]['message']);return _0x4fd502(_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);}else{logger[_0xd9f8('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x9f8fa9,_0xd9f8('0x15'));_0x4fd502(_0x4c1304['result'][_0xd9f8('0x19')]);}})['catch'](function(_0x49907a){logger[_0xd9f8('0x18')](_0xd9f8('0x12'),_0x9f8fa9,_0x49907a);_0x8d25a0(_0x49907a);});});} \ No newline at end of file +var _0x97a7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1eca06,_0x2eebe7){var _0x2b95d6=function(_0x13b109){while(--_0x13b109){_0x1eca06['push'](_0x1eca06['shift']());}};_0x2b95d6(++_0x2eebe7);}(_0x97a7,0x1a6));var _0x797a=function(_0x4ed255,_0x5d09e1){_0x4ed255=_0x4ed255-0x0;var _0x5adc21=_0x97a7[_0x4ed255];return _0x5adc21;};'use strict';var _=require(_0x797a('0x0'));var util=require(_0x797a('0x1'));var moment=require(_0x797a('0x2'));var BPromise=require(_0x797a('0x3'));var rs=require(_0x797a('0x4'));var fs=require('fs');var Redis=require(_0x797a('0x5'));var db=require(_0x797a('0x6'))['db'];var utils=require(_0x797a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x797a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x797a('0x9')][_0x797a('0xa')]({'port':0x232a});config[_0x797a('0xb')]=_[_0x797a('0xc')](config[_0x797a('0xb')],{'host':_0x797a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x797a('0xb')]));require(_0x797a('0xe'))[_0x797a('0xf')](socket);function respondWithRpcPromise(_0x404d0f,_0x5ba2a6,_0x45942a){return new BPromise(function(_0x25f3c2,_0x5d75c1){return client[_0x797a('0x10')](_0x404d0f,_0x45942a)[_0x797a('0x11')](function(_0x265971){logger[_0x797a('0x12')](_0x797a('0x13'),_0x5ba2a6,_0x797a('0x14'));logger['debug'](_0x797a('0x15'),_0x5ba2a6,'request\x20sent',JSON[_0x797a('0x16')](_0x265971));if(_0x265971[_0x797a('0x17')]){if(_0x265971[_0x797a('0x17')][_0x797a('0x18')]===0x1f4){logger[_0x797a('0x17')](_0x797a('0x13'),_0x5ba2a6,_0x265971[_0x797a('0x17')][_0x797a('0x19')]);return _0x5d75c1(_0x265971['error']['message']);}logger[_0x797a('0x17')](_0x797a('0x13'),_0x5ba2a6,_0x265971[_0x797a('0x17')]['message']);return _0x25f3c2(_0x265971[_0x797a('0x17')][_0x797a('0x19')]);}else{logger[_0x797a('0x12')](_0x797a('0x13'),_0x5ba2a6,_0x797a('0x14'));_0x25f3c2(_0x265971[_0x797a('0x1a')][_0x797a('0x19')]);}})[_0x797a('0x1b')](function(_0x4eb8ec){logger[_0x797a('0x17')](_0x797a('0x13'),_0x5ba2a6,_0x4eb8ec);_0x5d75c1(_0x4eb8ec);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 722e19f..3af3e27 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 _0x24ff=['emit','register','chatWebsite:','save','update'];(function(_0x221d95,_0x2d57ad){var _0x1b06fd=function(_0xe30941){while(--_0xe30941){_0x221d95['push'](_0x221d95['shift']());}};_0x1b06fd(++_0x2d57ad);}(_0x24ff,0xa3));var _0xf24f=function(_0x135bad,_0x3bc595){_0x135bad=_0x135bad-0x0;var _0x4c7793=_0x24ff[_0x135bad];return _0x4c7793;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xf24f('0x0'),'remove',_0xf24f('0x1')];function createListener(_0x1dea46,_0x9d037e){return function(_0x43aed3){_0x9d037e[_0xf24f('0x2')](_0x1dea46,_0x43aed3);};}function removeListener(_0xd3d57b,_0x158c56){return function(){ChatWebsiteEvents['removeListener'](_0xd3d57b,_0x158c56);};}exports[_0xf24f('0x3')]=function(_0x3fad6b){for(var _0x36a8c2=0x0,_0x2ee617=events['length'];_0x36a8c2<_0x2ee617;_0x36a8c2++){var _0x477b57=events[_0x36a8c2];var _0x4964e7=createListener(_0xf24f('0x4')+_0x477b57,_0x3fad6b);ChatWebsiteEvents['on'](_0x477b57,_0x4964e7);}}; \ No newline at end of file +var _0xa61a=['emit','removeListener','register','length','./chatWebsite.events','save','remove'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xa61a,0xac));var _0xaa61=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xa61a[_0x416cdc];return _0x1931ce;};'use strict';var ChatWebsiteEvents=require(_0xaa61('0x0'));var events=[_0xaa61('0x1'),_0xaa61('0x2'),'update'];function createListener(_0x193b25,_0x135db2){return function(_0x2cbaee){_0x135db2[_0xaa61('0x3')](_0x193b25,_0x2cbaee);};}function removeListener(_0x28c263,_0x35b578){return function(){ChatWebsiteEvents[_0xaa61('0x4')](_0x28c263,_0x35b578);};}exports[_0xaa61('0x5')]=function(_0x562204){for(var _0x1c4f4d=0x0,_0x1c6367=events[_0xaa61('0x6')];_0x1c4f4d<_0x1c6367;_0x1c4f4d++){var _0x165d62=events[_0x1c4f4d];var _0x592cdd=createListener('chatWebsite:'+_0x165d62,_0x562204);ChatWebsiteEvents['on'](_0x165d62,_0x592cdd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cadeff7..1e013ad 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 _0xd505=['getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','delete','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet'];(function(_0x1cf333,_0x12b78e){var _0x25734b=function(_0x55787d){while(--_0x55787d){_0x1cf333['push'](_0x1cf333['shift']());}};_0x25734b(++_0x12b78e);}(_0xd505,0x128));var _0x5d50=function(_0x4d509b,_0x4cb65f){_0x4d509b=_0x4d509b-0x0;var _0x17f2f6=_0xd505[_0x4d509b];return _0x17f2f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d50('0x0'));var timeout=require(_0x5d50('0x1'));var express=require(_0x5d50('0x2'));var router=express[_0x5d50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d50('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d50('0x5'));var controller=require(_0x5d50('0x6'));router[_0x5d50('0x7')]('/',auth[_0x5d50('0x8')](),controller[_0x5d50('0x9')]);router[_0x5d50('0x7')](_0x5d50('0xa'),auth[_0x5d50('0x8')](),controller['describe']);router['get'](_0x5d50('0xb'),auth[_0x5d50('0x8')](),controller[_0x5d50('0xc')]);router[_0x5d50('0x7')](_0x5d50('0xd'),auth[_0x5d50('0x8')](),controller[_0x5d50('0xe')]);router[_0x5d50('0x7')](_0x5d50('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5d50('0x7')]('/:id/logo',controller[_0x5d50('0x10')]);router['get'](_0x5d50('0x11'),controller['getAvatar']);router['get'](_0x5d50('0x12'),controller['getCustomerAvatar']);router['get'](_0x5d50('0x13'),controller[_0x5d50('0x14')]);router['get'](_0x5d50('0x15'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x16')]);router[_0x5d50('0x7')]('/:id/snippet',controller[_0x5d50('0x17')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x5d50('0x18')]);router['get'](_0x5d50('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x5d50('0x7')]('/:id/fields',controller['getFields']);router[_0x5d50('0x7')](_0x5d50('0x1a'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x1b')]);router[_0x5d50('0x7')](_0x5d50('0x1c'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x1d')]);router[_0x5d50('0x1e')]('/',auth[_0x5d50('0x8')](),controller[_0x5d50('0x1f')]);router[_0x5d50('0x1e')](_0x5d50('0xd'),auth[_0x5d50('0x8')](),controller['addDisposition']);router[_0x5d50('0x1e')]('/:id/canned_answers',auth[_0x5d50('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x1b370e,_0x25488e,_0x3ea0e1){_0x3ea0e1(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x23')));},'filename':function(_0x2afad1,_0xe47d82,_0x1e6db9){_0x1e6db9(null,util[_0x5d50('0x24')](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0xe47d82[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x28'),upload[_0x5d50('0x29')](_0x5d50('0x2a')),controller[_0x5d50('0x2b')]);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x26c6dd,_0xc6fc50,_0x2a02da){_0x2a02da(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x52cf42,_0x3d5ca5,_0x7fe96d){_0x7fe96d(null,util[_0x5d50('0x24')](_0x5d50('0x25'),Date['now'](),_0x3d5ca5[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x11'),upload['single'](_0x5d50('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x170b72,_0x33a57a,_0x58ff98){_0x58ff98(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x236461,_0x283b28,_0x15c64){_0x15c64(null,util['format'](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0x283b28[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x12'),upload[_0x5d50('0x29')](_0x5d50('0x2a')),controller[_0x5d50('0x2d')]);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x5e88f5,_0x380ecd,_0x3f6528){_0x3f6528(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x437c9b,_0x34100b,_0x247e84){_0x247e84(null,util['format'](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0x34100b[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x13'),upload[_0x5d50('0x29')]('file'),controller[_0x5d50('0x2e')]);router[_0x5d50('0x1e')](_0x5d50('0x2f'),controller[_0x5d50('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x4431d5,_0x5e9f8c,_0x20b676){const _0x4cc28c=path['join'](config[_0x5d50('0x22')],_0x5d50('0x31'),_0x5d50('0x32'),_0x5d50('0x33'));fs_extra[_0x5d50('0x34')](_0x4cc28c,function(){_0x20b676(null,_0x4cc28c);});},'filename':function(_0x4c3485,_0x5a8ec6,_0x596c75){const _0x97f8d6=_0x5a8ec6[_0x5d50('0x27')][_0x5d50('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4cee65=path[_0x5d50('0x36')](_0x97f8d6);const _0x428b49=Date[_0x5d50('0x26')]()+'-'+_0x97f8d6[_0x5d50('0x35')](_0x4cee65,'')+_0x4cee65;_0x596c75(null,_0x428b49);}})});router[_0x5d50('0x1e')](_0x5d50('0x37'),offlineUploadMulter[_0x5d50('0x38')](),controller[_0x5d50('0x39')]);router[_0x5d50('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x5d50('0x3a')]);router[_0x5d50('0x1e')]('/:id/proactive_actions',auth[_0x5d50('0x8')](),controller[_0x5d50('0x3b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x5d50('0x8')](),controller['update']);router[_0x5d50('0x3c')](_0x5d50('0xb'),auth[_0x5d50('0x8')](),controller['destroy']);router[_0x5d50('0x3c')](_0x5d50('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5d50('0x3c')](_0x5d50('0xf'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x3d')]);router[_0x5d50('0x3c')](_0x5d50('0x1c'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x3e')]);module[_0x5d50('0x3f')]=router; \ No newline at end of file +var _0x8517=['../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','server/files/images/avatars/','single','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x164b1d,_0x4a9f81){var _0xb29999=function(_0x2c6e02){while(--_0x2c6e02){_0x164b1d['push'](_0x164b1d['shift']());}};_0xb29999(++_0x4a9f81);}(_0x8517,0x15e));var _0x7851=function(_0x6b0651,_0x319ae3){_0x6b0651=_0x6b0651-0x0;var _0x229252=_0x8517[_0x6b0651];return _0x229252;};'use strict';var multer=require('multer');var util=require(_0x7851('0x0'));var path=require(_0x7851('0x1'));var timeout=require(_0x7851('0x2'));var express=require(_0x7851('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7851('0x4'));var interaction=require(_0x7851('0x5'));var config=require(_0x7851('0x6'));var controller=require(_0x7851('0x7'));router['get']('/',auth[_0x7851('0x8')](),controller[_0x7851('0x9')]);router['get'](_0x7851('0xa'),auth[_0x7851('0x8')](),controller['describe']);router[_0x7851('0xb')](_0x7851('0xc'),auth[_0x7851('0x8')](),controller[_0x7851('0xd')]);router[_0x7851('0xb')](_0x7851('0xe'),auth[_0x7851('0x8')](),controller[_0x7851('0xf')]);router['get'](_0x7851('0x10'),auth[_0x7851('0x8')](),controller[_0x7851('0x11')]);router[_0x7851('0xb')](_0x7851('0x12'),controller['getLogo']);router[_0x7851('0xb')](_0x7851('0x13'),controller['getAvatar']);router[_0x7851('0xb')](_0x7851('0x14'),controller[_0x7851('0x15')]);router['get'](_0x7851('0x16'),controller[_0x7851('0x17')]);router[_0x7851('0xb')](_0x7851('0x18'),auth[_0x7851('0x8')](),controller[_0x7851('0x19')]);router['get'](_0x7851('0x1a'),controller[_0x7851('0x1b')]);router[_0x7851('0xb')](_0x7851('0x1c'),auth[_0x7851('0x8')](),controller[_0x7851('0x1d')]);router[_0x7851('0xb')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x7851('0x1e')]);router[_0x7851('0xb')]('/:id/fields',controller[_0x7851('0x1f')]);router[_0x7851('0xb')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x7851('0xb')](_0x7851('0x20'),auth[_0x7851('0x8')](),controller[_0x7851('0x21')]);router[_0x7851('0x22')]('/',auth[_0x7851('0x8')](),controller[_0x7851('0x23')]);router['post'](_0x7851('0xe'),auth[_0x7851('0x8')](),controller[_0x7851('0x24')]);router['post']('/:id/canned_answers',auth[_0x7851('0x8')](),controller[_0x7851('0x25')]);var upload=multer({'storage':multer[_0x7851('0x26')]({'destination':function(_0x1c02ab,_0x3863f9,_0x1f2aaf){_0x1f2aaf(null,path[_0x7851('0x27')](config[_0x7851('0x28')],_0x7851('0x29')));},'filename':function(_0x4f819f,_0x1476d7,_0x5533fd){_0x5533fd(null,util[_0x7851('0x2a')](_0x7851('0x2b'),Date[_0x7851('0x2c')](),_0x1476d7[_0x7851('0x2d')]));}})});router[_0x7851('0x22')]('/:id/logo',upload['single'](_0x7851('0x2e')),controller[_0x7851('0x2f')]);var upload=multer({'storage':multer[_0x7851('0x26')]({'destination':function(_0x3767f9,_0xb4eb6,_0x317ebe){_0x317ebe(null,path[_0x7851('0x27')](config['root'],_0x7851('0x30')));},'filename':function(_0xd3b129,_0x230363,_0x4df40d){_0x4df40d(null,util[_0x7851('0x2a')]('%s-%s',Date[_0x7851('0x2c')](),_0x230363[_0x7851('0x2d')]));}})});router[_0x7851('0x22')]('/:id/avatar',upload[_0x7851('0x31')](_0x7851('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0x7851('0x26')]({'destination':function(_0x1db3d1,_0x18f9e4,_0x38cc5e){_0x38cc5e(null,path[_0x7851('0x27')](config[_0x7851('0x28')],_0x7851('0x30')));},'filename':function(_0x297b1d,_0x73b809,_0x576bcd){_0x576bcd(null,util[_0x7851('0x2a')]('%s-%s',Date[_0x7851('0x2c')](),_0x73b809[_0x7851('0x2d')]));}})});router[_0x7851('0x22')]('/:id/customer_avatar',upload['single'](_0x7851('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd1ecf6,_0x1f7ba8,_0x152004){_0x152004(null,path['join'](config[_0x7851('0x28')],_0x7851('0x30')));},'filename':function(_0x4c3d4b,_0x552e3f,_0x1a6ded){_0x1a6ded(null,util[_0x7851('0x2a')](_0x7851('0x2b'),Date[_0x7851('0x2c')](),_0x552e3f[_0x7851('0x2d')]));}})});router[_0x7851('0x22')]('/:id/system_avatar',upload[_0x7851('0x31')](_0x7851('0x2e')),controller[_0x7851('0x32')]);router['post'](_0x7851('0x33'),controller[_0x7851('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x7851('0x26')]({'destination':function(_0x5aaf92,_0x4f2f49,_0x2a3fe4){const _0x482f0c=path[_0x7851('0x27')](config[_0x7851('0x28')],_0x7851('0x35'),_0x7851('0x36'),_0x7851('0x37'));fs_extra[_0x7851('0x38')](_0x482f0c,function(){_0x2a3fe4(null,_0x482f0c);});},'filename':function(_0x427725,_0x44eeb7,_0x7962e6){const _0x51d2a3=_0x44eeb7['originalname'][_0x7851('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x8c510f=path[_0x7851('0x3a')](_0x51d2a3);const _0x188bde=Date[_0x7851('0x2c')]()+'-'+_0x51d2a3[_0x7851('0x39')](_0x8c510f,'')+_0x8c510f;_0x7962e6(null,_0x188bde);}})});router[_0x7851('0x22')](_0x7851('0x3b'),offlineUploadMulter['any'](),controller['offline']);router[_0x7851('0x22')](_0x7851('0x18'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x7851('0x22')](_0x7851('0x1c'),auth['isAuthenticated'](),controller[_0x7851('0x3c')]);router['post'](_0x7851('0x3d'),auth[_0x7851('0x8')](),controller[_0x7851('0x3e')]);router['post'](_0x7851('0x20'),auth[_0x7851('0x8')](),controller[_0x7851('0x3f')]);router[_0x7851('0x40')](_0x7851('0xc'),auth[_0x7851('0x8')](),controller[_0x7851('0x41')]);router[_0x7851('0x42')](_0x7851('0xc'),auth[_0x7851('0x8')](),controller[_0x7851('0x43')]);router[_0x7851('0x42')](_0x7851('0xe'),auth[_0x7851('0x8')](),controller[_0x7851('0x44')]);router[_0x7851('0x42')]('/:id/canned_answers',auth[_0x7851('0x8')](),controller[_0x7851('0x45')]);router[_0x7851('0x42')](_0x7851('0x20'),auth[_0x7851('0x8')](),controller[_0x7851('0x46')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 0cd7181..e003f12 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9df9=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','express','../components/auth/service','../config/environment','Router','production'];(function(_0x26d868,_0x22fa0b){var _0x3c9a1f=function(_0x56c215){while(--_0x56c215){_0x26d868['push'](_0x26d868['shift']());}};_0x3c9a1f(++_0x22fa0b);}(_0x9df9,0xb1));var _0x99df=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9df9[_0x4b055c];return _0x4b62bb;};var beaverLogger=require('beaver-logger/server');var express=require(_0x99df('0x0'));var auth=require(_0x99df('0x1'));var config=require(_0x99df('0x2'));var router=express[_0x99df('0x3')]();var isProduction=config['env']===_0x99df('0x4')||![];function clientSideLogs(_0x4f1f13,_0xa59f36,_0x2ed11f){var _0x2d8af2=_0x4f1f13[_0x99df('0x5')][_0x99df('0x6')](_0x99df('0x7'));if(!_0x2d8af2){throw new Error(_0x99df('0x8'));}return beaverLogger[_0x99df('0x9')]({'uri':_0x99df('0xa'),'logger':_0x2d8af2,'enableCors':!isProduction})(_0x4f1f13,_0xa59f36,_0x2ed11f);}router[_0x99df('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x99df('0xc')]=router; \ No newline at end of file +var _0x0141=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated','express','../config/environment','Router','app','client-side-logger'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x0141,0x100));var _0x1014=function(_0x41dcf5,_0x4ebf9e){_0x41dcf5=_0x41dcf5-0x0;var _0x3b4f85=_0x0141[_0x41dcf5];return _0x3b4f85;};var beaverLogger=require('beaver-logger/server');var express=require(_0x1014('0x0'));var auth=require('../components/auth/service');var config=require(_0x1014('0x1'));var router=express[_0x1014('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x3ebca3,_0x3daa9d,_0x4feb4e){var _0x5cc64c=_0x3ebca3[_0x1014('0x3')]['get'](_0x1014('0x4'));if(!_0x5cc64c){throw new Error(_0x1014('0x5'));}return beaverLogger[_0x1014('0x6')]({'uri':_0x1014('0x7'),'logger':_0x5cc64c,'enableCors':!isProduction})(_0x3ebca3,_0x3daa9d,_0x4feb4e);}router['use'](auth[_0x1014('0x8')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7342851..c7956d5 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 _0x2376=['Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0xe78f01,_0x525d21){var _0x561def=function(_0x311810){while(--_0x311810){_0xe78f01['push'](_0xe78f01['shift']());}};_0x561def(++_0x525d21);}(_0x2376,0x153));var _0x6237=function(_0x121b0d,_0x22104d){_0x121b0d=_0x121b0d-0x0;var _0x13482f=_0x2376[_0x121b0d];return _0x13482f;};'use strict';var Sequelize=require('sequelize');module[_0x6237('0x0')]={'name':{'type':Sequelize[_0x6237('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6237('0x2')](_0x6237('0x3'),_0x6237('0x4'),_0x6237('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6237('0x2')](_0x6237('0x6'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0x6237('0x7')},'data2':{'type':Sequelize[_0x6237('0x1')],'comment':_0x6237('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x6237('0x9')},'data4':{'type':Sequelize[_0x6237('0x1')],'comment':_0x6237('0xa')},'data5':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xc')},'data6':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xd')},'data7':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xe')}}; \ No newline at end of file +var _0x3005=['AmazonAWS','Google','MicrosoftAzure','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM'];(function(_0x3d1886,_0x28aba8){var _0x154776=function(_0x522465){while(--_0x522465){_0x3d1886['push'](_0x3d1886['shift']());}};_0x154776(++_0x28aba8);}(_0x3005,0x1d1));var _0x5300=function(_0x1d098c,_0x85b526){_0x1d098c=_0x1d098c-0x0;var _0x27b7c1=_0x3005[_0x1d098c];return _0x27b7c1;};'use strict';var Sequelize=require(_0x5300('0x0'));module[_0x5300('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5300('0x2')](_0x5300('0x3'),_0x5300('0x4'),_0x5300('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x5300('0x6'))},'data1':{'type':Sequelize[_0x5300('0x7')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x5300('0x7')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':_0x5300('0x8')},'data4':{'type':Sequelize[_0x5300('0x7')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0x5300('0x9')},'data6':{'type':Sequelize[_0x5300('0xa')],'comment':_0x5300('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x5300('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 55fa82a..59e766f 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 _0x8e44=['join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','status','end','json','undefined','offset','count','limit','set','Content-Range','update','destroy','then','sendStatus','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x24a3e0,_0x1d5ebe){var _0x233769=function(_0x30dd43){while(--_0x30dd43){_0x24a3e0['push'](_0x24a3e0['shift']());}};_0x233769(++_0x1d5ebe);}(_0x8e44,0x195));var _0x48e4=function(_0x1bfda4,_0x4a1d18){_0x1bfda4=_0x1bfda4-0x0;var _0x2a3741=_0x8e44[_0x1bfda4];return _0x2a3741;};'use strict';var _=require(_0x48e4('0x0'));var Redis=require(_0x48e4('0x1'));var qs=require(_0x48e4('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x48e4('0x3'));var logger=require(_0x48e4('0x4'))('api');var db=require(_0x48e4('0x5'))['db'];var oauth=require(_0x48e4('0x6'));config['redis']=_['defaults'](config[_0x48e4('0x7')],{'host':_0x48e4('0x8'),'port':0x18eb});var socket=require(_0x48e4('0x9'))(new Redis(config[_0x48e4('0x7')]));var redis=new Redis(config[_0x48e4('0x7')]);function respondWithStatusCode(_0x445b56,_0x3ed5f5){_0x3ed5f5=_0x3ed5f5||0xcc;return function(_0x4ddd00){if(_0x4ddd00){return _0x445b56['sendStatus'](_0x3ed5f5);}return _0x445b56[_0x48e4('0xa')](_0x3ed5f5)[_0x48e4('0xb')]();};}function respondWithResult(_0x28fa0c,_0x5e41b8){_0x5e41b8=_0x5e41b8||0xc8;return function(_0x599f81){if(_0x599f81){return _0x28fa0c['status'](_0x5e41b8)[_0x48e4('0xc')](_0x599f81);}};}function respondWithFilteredResult(_0x19721a,_0x28ca5f){return function(_0x2ce4b6){if(_0x2ce4b6){var _0x11bf0f=typeof _0x28ca5f['offset']===_0x48e4('0xd')&&typeof _0x28ca5f['limit']===_0x48e4('0xd');var _0x2f839c=_0x2ce4b6['count'];var _0x45588b=_0x11bf0f?0x0:_0x28ca5f[_0x48e4('0xe')];var _0x506e23=_0x11bf0f?_0x2ce4b6[_0x48e4('0xf')]:_0x28ca5f[_0x48e4('0xe')]+_0x28ca5f[_0x48e4('0x10')];var _0x218089;if(_0x506e23>=_0x2f839c){_0x506e23=_0x2f839c;_0x218089=0xc8;}else{_0x218089=0xce;}_0x19721a['status'](_0x218089);return _0x19721a[_0x48e4('0x11')](_0x48e4('0x12'),_0x45588b+'-'+_0x506e23+'/'+_0x2f839c)[_0x48e4('0xc')](_0x2ce4b6);}return null;};}function saveUpdates(_0x3e1b99){return function(_0x50ebcb){if(_0x50ebcb){return _0x50ebcb[_0x48e4('0x13')](_0x3e1b99)['then'](function(_0xaa747f){return _0xaa747f;});}return null;};}function removeEntity(_0x1463fa){return function(_0x40f10a){if(_0x40f10a){return _0x40f10a[_0x48e4('0x14')]()[_0x48e4('0x15')](function(){_0x1463fa['status'](0xcc)[_0x48e4('0xb')]();});}};}function handleEntityNotFound(_0x3e3b3e){return function(_0xaad0ac){if(!_0xaad0ac){_0x3e3b3e[_0x48e4('0x16')](0x194);}return _0xaad0ac;};}function handleError(_0x35712e,_0x10235e){_0x10235e=_0x10235e||0x1f4;return function(_0x988250){logger[_0x48e4('0x17')](_0x988250['stack']);if(_0x988250[_0x48e4('0x18')]){delete _0x988250[_0x48e4('0x18')];}_0x35712e['status'](_0x10235e)[_0x48e4('0x19')](_0x988250);};}function maskClientSecret(_0x435761){return _['padEnd'](_0x435761['slice'](0x0,0x3),0x14,'*');}exports[_0x48e4('0x1a')]=function(_0x52f929,_0x1bdd6f){var _0x3283f5={},_0x34922a={},_0x3c8e29={'count':0x0,'rows':[]};var _0xb58b49=_[_0x48e4('0x1b')](db[_0x48e4('0x1c')][_0x48e4('0x1d')],function(_0x4908d6){return{'name':_0x4908d6[_0x48e4('0x1e')],'type':_0x4908d6['type'][_0x48e4('0x1f')]};});_0x34922a['model']=_[_0x48e4('0x1b')](_0xb58b49,'name');_0x34922a['query']=_['keys'](_0x52f929[_0x48e4('0x20')]);_0x34922a[_0x48e4('0x21')]=_[_0x48e4('0x22')](_0x34922a[_0x48e4('0x23')],_0x34922a['query']);_0x3283f5[_0x48e4('0x24')]=_['intersection'](_0x34922a[_0x48e4('0x23')],qs[_0x48e4('0x25')](_0x52f929[_0x48e4('0x20')][_0x48e4('0x25')]));_0x3283f5[_0x48e4('0x24')]=_0x3283f5['attributes'][_0x48e4('0x26')]?_0x3283f5[_0x48e4('0x24')]:_0x34922a[_0x48e4('0x23')];if(!_0x52f929[_0x48e4('0x20')][_0x48e4('0x27')]('nolimit')){_0x3283f5[_0x48e4('0x10')]=qs[_0x48e4('0x10')](_0x52f929[_0x48e4('0x20')][_0x48e4('0x10')]);_0x3283f5[_0x48e4('0xe')]=qs[_0x48e4('0xe')](_0x52f929[_0x48e4('0x20')][_0x48e4('0xe')]);}_0x3283f5['order']=qs[_0x48e4('0x28')](_0x52f929['query'][_0x48e4('0x28')]);_0x3283f5[_0x48e4('0x29')]=qs[_0x48e4('0x21')](_[_0x48e4('0x2a')](_0x52f929[_0x48e4('0x20')],_0x34922a[_0x48e4('0x21')]),_0xb58b49);if(_0x52f929[_0x48e4('0x20')][_0x48e4('0x2b')]){_0x3283f5[_0x48e4('0x29')]=_[_0x48e4('0x2c')](_0x3283f5[_0x48e4('0x29')],{'$or':_['map'](_0xb58b49,function(_0x213128){if(_0x213128[_0x48e4('0x2d')]!==_0x48e4('0x2e')){var _0x396194={};_0x396194[_0x213128['name']]={'$like':'%'+_0x52f929[_0x48e4('0x20')][_0x48e4('0x2b')]+'%'};return _0x396194;}})});}_0x3283f5=_[_0x48e4('0x2c')]({},_0x3283f5,_0x52f929[_0x48e4('0x2f')]);var _0x56a9ab={'where':_0x3283f5['where']};return db['CloudProvider'][_0x48e4('0xf')](_0x56a9ab)[_0x48e4('0x15')](function(_0x324c7c){_0x3c8e29['count']=_0x324c7c;if(_0x52f929['query']['includeAll']){_0x3283f5[_0x48e4('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0x48e4('0x31')](_0x3283f5);})[_0x48e4('0x15')](function(_0x2ca7ac){_0x3c8e29[_0x48e4('0x32')]=_[_0x48e4('0x1b')](_0x2ca7ac,function(_0x2415d5){if(_0x2415d5[_0x48e4('0x33')]===_0x48e4('0x34')){var _0x183522=encryptor[_0x48e4('0x35')](_0x2415d5[_0x48e4('0x36')]);_0x2415d5[_0x48e4('0x36')]=maskClientSecret(_0x183522);}return _0x2415d5;});return _0x3c8e29;})[_0x48e4('0x15')](respondWithFilteredResult(_0x1bdd6f,_0x3283f5))[_0x48e4('0x37')](handleError(_0x1bdd6f,null));};exports[_0x48e4('0x38')]=function(_0x4ea8d1,_0x30163d){var _0x1d220a={'raw':!![],'where':{'id':_0x4ea8d1[_0x48e4('0x39')]['id']}},_0x157031={};_0x157031[_0x48e4('0x23')]=_['keys'](db[_0x48e4('0x1c')][_0x48e4('0x1d')]);_0x157031['query']=_[_0x48e4('0x3a')](_0x4ea8d1['query']);_0x157031[_0x48e4('0x21')]=_[_0x48e4('0x22')](_0x157031['model'],_0x157031[_0x48e4('0x20')]);_0x1d220a[_0x48e4('0x24')]=_['intersection'](_0x157031[_0x48e4('0x23')],qs[_0x48e4('0x25')](_0x4ea8d1[_0x48e4('0x20')]['fields']));_0x1d220a[_0x48e4('0x24')]=_0x1d220a[_0x48e4('0x24')][_0x48e4('0x26')]?_0x1d220a[_0x48e4('0x24')]:_0x157031[_0x48e4('0x23')];if(_0x4ea8d1['query'][_0x48e4('0x3b')]){_0x1d220a[_0x48e4('0x30')]=[{'all':!![]}];}_0x1d220a=_[_0x48e4('0x2c')]({},_0x1d220a,_0x4ea8d1[_0x48e4('0x2f')]);return db[_0x48e4('0x1c')]['find'](_0x1d220a)[_0x48e4('0x15')](handleEntityNotFound(_0x30163d,null))['then'](function(_0x17c746){if(_0x17c746[_0x48e4('0x33')]===_0x48e4('0x34')){var _0x5dde9e=encryptor[_0x48e4('0x35')](_0x17c746['data3']);_0x17c746[_0x48e4('0x36')]=maskClientSecret(_0x5dde9e);}return _0x17c746;})[_0x48e4('0x15')](respondWithResult(_0x30163d,null))[_0x48e4('0x37')](handleError(_0x30163d,null));};exports[_0x48e4('0x3c')]=function(_0x108898,_0xbd0630){if(!_0x108898[_0x48e4('0x3d')][_0x48e4('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x108898['body'][_0x48e4('0x33')])throw new Error(_0x48e4('0x3e'));var _0x29e776=db[_0x48e4('0x1c')][_0x48e4('0x1d')][_0x48e4('0x33')][_0x48e4('0x3f')];if(!_0x29e776['includes'](_0x108898[_0x48e4('0x3d')]['service']))throw new Error(_0x48e4('0x40')+_0x29e776[_0x48e4('0x41')](',\x20'));if(_0x108898[_0x48e4('0x3d')][_0x48e4('0x33')]===_0x48e4('0x34')&&_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]){_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]=encryptor[_0x48e4('0x42')](_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]);}return db[_0x48e4('0x1c')][_0x48e4('0x3c')](_0x108898[_0x48e4('0x3d')],{})['then'](respondWithResult(_0xbd0630,0xc9))['catch'](handleError(_0xbd0630,null));};exports[_0x48e4('0x13')]=function(_0x580a4a,_0x2a99ea){if(_0x580a4a[_0x48e4('0x3d')]['id']){delete _0x580a4a[_0x48e4('0x3d')]['id'];}return db[_0x48e4('0x1c')][_0x48e4('0x43')]({'where':{'id':_0x580a4a[_0x48e4('0x39')]['id']}})['then'](handleEntityNotFound(_0x2a99ea,null))[_0x48e4('0x15')](function(_0x710f80){if(_0x710f80[_0x48e4('0x33')]===_0x48e4('0x34')&&_0x580a4a[_0x48e4('0x3d')]['data3']){_0x580a4a['body']['data3']=encryptor[_0x48e4('0x42')](_0x580a4a[_0x48e4('0x3d')]['data3']);}return _0x710f80;})[_0x48e4('0x15')](saveUpdates(_0x580a4a[_0x48e4('0x3d')],null))[_0x48e4('0x15')](respondWithResult(_0x2a99ea,null))[_0x48e4('0x37')](handleError(_0x2a99ea,null));};exports[_0x48e4('0x14')]=function(_0xbca62a,_0x1f66fd){return db['CloudProvider'][_0x48e4('0x43')]({'where':{'id':_0xbca62a[_0x48e4('0x39')]['id']}})[_0x48e4('0x15')](handleEntityNotFound(_0x1f66fd,null))[_0x48e4('0x15')](removeEntity(_0x1f66fd,null))[_0x48e4('0x37')](handleError(_0x1f66fd,null));};exports[_0x48e4('0x44')]=function(_0x4d13cb,_0x48dabb){return db['CloudProvider'][_0x48e4('0x45')]({'where':{'id':_0x4d13cb[_0x48e4('0x39')]['id']},'raw':!![]})['then'](function(_0x9f96){if(!_0x9f96)return _0x48dabb[_0x48e4('0x16')](0x194);return{'url':oauth[_0x48e4('0x46')](_0x9f96,_0x4d13cb['user']['id'])};})[_0x48e4('0x15')](respondWithResult(_0x48dabb,null))[_0x48e4('0x37')](handleError(_0x48dabb,null));};exports['oauth2MicrosoftCallback']=function(_0x3afcbb,_0x220644){var _0x2ef9cd=_0x3afcbb[_0x48e4('0x3d')];var _0x1326a3;var _0x451d3c;if(_0x2ef9cd['error'])throw _0x2ef9cd;redis[_0x48e4('0x47')](_0x2ef9cd[_0x48e4('0x48')])[_0x48e4('0x15')](function(_0x384143){if(!_0x384143)throw new Error(_0x48e4('0x49'));_0x1326a3=JSON[_0x48e4('0x4a')](_0x384143);var _0x5eb94f=Buffer[_0x48e4('0x4b')](_0x2ef9cd[_0x48e4('0x48')],_0x48e4('0x4c'))[_0x48e4('0x4d')](_0x48e4('0x4e'));_0x451d3c=JSON['parse'](_0x5eb94f);if(!oauth[_0x48e4('0x4f')](_0x2ef9cd[_0x48e4('0x50')],_0x1326a3['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2ef9cd[_0x48e4('0x48')]);return oauth[_0x48e4('0x51')](_0x2ef9cd[_0x48e4('0x52')],_0x1326a3);})[_0x48e4('0x15')](function(_0x3e9c4a){_0x1326a3['data5']=_0x3e9c4a[_0x48e4('0x53')];_0x1326a3[_0x48e4('0x54')]=_0x3e9c4a[_0x48e4('0x55')];return db[_0x48e4('0x1c')]['update']({'data5':_0x1326a3[_0x48e4('0x56')],'data6':_0x1326a3['data6']},{'where':{'id':_0x1326a3['id']}});})['then'](function(){oauth[_0x48e4('0x57')](_0x1326a3);socket[_0x48e4('0x58')](_0x48e4('0x59'),{'id':_0x451d3c['id']});return;})[_0x48e4('0x15')](respondWithStatusCode(_0x220644,null))[_0x48e4('0x37')](function(_0x3e9163){if(_0x451d3c){socket[_0x48e4('0x58')](_0x48e4('0x5a'),{'id':_0x451d3c['id']});}if(!_0x1326a3){logger[_0x48e4('0x17')](_0x48e4('0x5b'),_0x3e9163);return _0x220644[_0x48e4('0xa')](0x1f4)['send'](_0x3e9163[_0x48e4('0x5c')]);}logger[_0x48e4('0x17')](_0x48e4('0x5d'),_0x1326a3['id'],_0x3e9163);});}; \ No newline at end of file +var _0x0c81=['message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','padEnd','slice','rawAttributes','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','CloudProvider','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','keys','length','includeAll','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data6','data5','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x0c81,0xb2));var _0x10c8=function(_0x4d2abc,_0x29b228){_0x4d2abc=_0x4d2abc-0x0;var _0x5c4540=_0x0c81[_0x4d2abc];return _0x5c4540;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x10c8('0x0'));var config=require(_0x10c8('0x1'));var logger=require(_0x10c8('0x2'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x10c8('0x3'));config[_0x10c8('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x10c8('0x5'))(new Redis(config[_0x10c8('0x4')]));var redis=new Redis(config[_0x10c8('0x4')]);function respondWithStatusCode(_0x2ca168,_0x401a49){_0x401a49=_0x401a49||0xcc;return function(_0x786f7f){if(_0x786f7f){return _0x2ca168[_0x10c8('0x6')](_0x401a49);}return _0x2ca168['status'](_0x401a49)[_0x10c8('0x7')]();};}function respondWithResult(_0x2fddb1,_0x368cab){_0x368cab=_0x368cab||0xc8;return function(_0x23cb8f){if(_0x23cb8f){return _0x2fddb1[_0x10c8('0x8')](_0x368cab)['json'](_0x23cb8f);}};}function respondWithFilteredResult(_0x847113,_0x4eb2ae){return function(_0x537117){if(_0x537117){var _0x205805=typeof _0x4eb2ae[_0x10c8('0x9')]===_0x10c8('0xa')&&typeof _0x4eb2ae[_0x10c8('0xb')]===_0x10c8('0xa');var _0x3dbceb=_0x537117[_0x10c8('0xc')];var _0x500990=_0x205805?0x0:_0x4eb2ae['offset'];var _0x1bed06=_0x205805?_0x537117[_0x10c8('0xc')]:_0x4eb2ae[_0x10c8('0x9')]+_0x4eb2ae[_0x10c8('0xb')];var _0x380a0e;if(_0x1bed06>=_0x3dbceb){_0x1bed06=_0x3dbceb;_0x380a0e=0xc8;}else{_0x380a0e=0xce;}_0x847113['status'](_0x380a0e);return _0x847113[_0x10c8('0xd')](_0x10c8('0xe'),_0x500990+'-'+_0x1bed06+'/'+_0x3dbceb)[_0x10c8('0xf')](_0x537117);}return null;};}function saveUpdates(_0x251ade){return function(_0xd7996b){if(_0xd7996b){return _0xd7996b[_0x10c8('0x10')](_0x251ade)[_0x10c8('0x11')](function(_0x2a7e9e){return _0x2a7e9e;});}return null;};}function removeEntity(_0x4e8004){return function(_0x3db9c2){if(_0x3db9c2){return _0x3db9c2[_0x10c8('0x12')]()['then'](function(){_0x4e8004[_0x10c8('0x8')](0xcc)[_0x10c8('0x7')]();});}};}function handleEntityNotFound(_0x462d22){return function(_0x331623){if(!_0x331623){_0x462d22['sendStatus'](0x194);}return _0x331623;};}function handleError(_0x47b02e,_0xab0ac5){_0xab0ac5=_0xab0ac5||0x1f4;return function(_0x403ab6){logger[_0x10c8('0x13')](_0x403ab6[_0x10c8('0x14')]);if(_0x403ab6[_0x10c8('0x15')]){delete _0x403ab6['name'];}_0x47b02e[_0x10c8('0x8')](_0xab0ac5)[_0x10c8('0x16')](_0x403ab6);};}function maskClientSecret(_0x4bb565){return _[_0x10c8('0x17')](_0x4bb565[_0x10c8('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x169ff6,_0x5c6d76){var _0x2fd2a7={},_0x34ab28={},_0x457c7e={'count':0x0,'rows':[]};var _0x86278a=_['map'](db['CloudProvider'][_0x10c8('0x19')],function(_0x1d5d31){return{'name':_0x1d5d31['fieldName'],'type':_0x1d5d31['type'][_0x10c8('0x1a')]};});_0x34ab28['model']=_[_0x10c8('0x1b')](_0x86278a,_0x10c8('0x15'));_0x34ab28[_0x10c8('0x1c')]=_['keys'](_0x169ff6[_0x10c8('0x1c')]);_0x34ab28[_0x10c8('0x1d')]=_[_0x10c8('0x1e')](_0x34ab28[_0x10c8('0x1f')],_0x34ab28[_0x10c8('0x1c')]);_0x2fd2a7['attributes']=_[_0x10c8('0x1e')](_0x34ab28[_0x10c8('0x1f')],qs[_0x10c8('0x20')](_0x169ff6[_0x10c8('0x1c')][_0x10c8('0x20')]));_0x2fd2a7[_0x10c8('0x21')]=_0x2fd2a7['attributes']['length']?_0x2fd2a7[_0x10c8('0x21')]:_0x34ab28[_0x10c8('0x1f')];if(!_0x169ff6[_0x10c8('0x1c')][_0x10c8('0x22')]('nolimit')){_0x2fd2a7['limit']=qs[_0x10c8('0xb')](_0x169ff6[_0x10c8('0x1c')][_0x10c8('0xb')]);_0x2fd2a7[_0x10c8('0x9')]=qs[_0x10c8('0x9')](_0x169ff6[_0x10c8('0x1c')][_0x10c8('0x9')]);}_0x2fd2a7[_0x10c8('0x23')]=qs[_0x10c8('0x24')](_0x169ff6['query'][_0x10c8('0x24')]);_0x2fd2a7['where']=qs['filters'](_[_0x10c8('0x25')](_0x169ff6[_0x10c8('0x1c')],_0x34ab28[_0x10c8('0x1d')]),_0x86278a);if(_0x169ff6[_0x10c8('0x1c')][_0x10c8('0x26')]){_0x2fd2a7[_0x10c8('0x27')]=_[_0x10c8('0x28')](_0x2fd2a7[_0x10c8('0x27')],{'$or':_[_0x10c8('0x1b')](_0x86278a,function(_0x231321){if(_0x231321[_0x10c8('0x29')]!==_0x10c8('0x2a')){var _0x167377={};_0x167377[_0x231321[_0x10c8('0x15')]]={'$like':'%'+_0x169ff6[_0x10c8('0x1c')][_0x10c8('0x26')]+'%'};return _0x167377;}})});}_0x2fd2a7=_[_0x10c8('0x28')]({},_0x2fd2a7,_0x169ff6[_0x10c8('0x2b')]);var _0x554d27={'where':_0x2fd2a7['where']};return db[_0x10c8('0x2c')][_0x10c8('0xc')](_0x554d27)['then'](function(_0x513f06){_0x457c7e[_0x10c8('0xc')]=_0x513f06;if(_0x169ff6['query']['includeAll']){_0x2fd2a7[_0x10c8('0x2d')]=[{'all':!![]}];}return db[_0x10c8('0x2c')][_0x10c8('0x2e')](_0x2fd2a7);})['then'](function(_0x191bd2){_0x457c7e[_0x10c8('0x2f')]=_[_0x10c8('0x1b')](_0x191bd2,function(_0x2b7ad4){if(_0x2b7ad4[_0x10c8('0x30')]===_0x10c8('0x31')){var _0x42f666=encryptor[_0x10c8('0x32')](_0x2b7ad4['data3']);_0x2b7ad4[_0x10c8('0x33')]=maskClientSecret(_0x42f666);}return _0x2b7ad4;});return _0x457c7e;})[_0x10c8('0x11')](respondWithFilteredResult(_0x5c6d76,_0x2fd2a7))[_0x10c8('0x34')](handleError(_0x5c6d76,null));};exports['show']=function(_0x2ba0ac,_0x14b2ba){var _0x551809={'raw':!![],'where':{'id':_0x2ba0ac[_0x10c8('0x35')]['id']}},_0x1b9192={};_0x1b9192[_0x10c8('0x1f')]=_['keys'](db['CloudProvider']['rawAttributes']);_0x1b9192['query']=_[_0x10c8('0x36')](_0x2ba0ac[_0x10c8('0x1c')]);_0x1b9192[_0x10c8('0x1d')]=_['intersection'](_0x1b9192[_0x10c8('0x1f')],_0x1b9192[_0x10c8('0x1c')]);_0x551809[_0x10c8('0x21')]=_['intersection'](_0x1b9192[_0x10c8('0x1f')],qs[_0x10c8('0x20')](_0x2ba0ac['query'][_0x10c8('0x20')]));_0x551809[_0x10c8('0x21')]=_0x551809[_0x10c8('0x21')][_0x10c8('0x37')]?_0x551809['attributes']:_0x1b9192[_0x10c8('0x1f')];if(_0x2ba0ac[_0x10c8('0x1c')][_0x10c8('0x38')]){_0x551809['include']=[{'all':!![]}];}_0x551809=_[_0x10c8('0x28')]({},_0x551809,_0x2ba0ac['options']);return db[_0x10c8('0x2c')][_0x10c8('0x39')](_0x551809)[_0x10c8('0x11')](handleEntityNotFound(_0x14b2ba,null))[_0x10c8('0x11')](function(_0x42b3a0){if(_0x42b3a0[_0x10c8('0x30')]===_0x10c8('0x31')){var _0x8a7128=encryptor[_0x10c8('0x32')](_0x42b3a0['data3']);_0x42b3a0[_0x10c8('0x33')]=maskClientSecret(_0x8a7128);}return _0x42b3a0;})[_0x10c8('0x11')](respondWithResult(_0x14b2ba,null))[_0x10c8('0x34')](handleError(_0x14b2ba,null));};exports[_0x10c8('0x3a')]=function(_0x1c2fd1,_0x4ed6dd){if(!_0x1c2fd1['body'][_0x10c8('0x15')])throw new Error(_0x10c8('0x3b'));if(!_0x1c2fd1['body'][_0x10c8('0x30')])throw new Error(_0x10c8('0x3c'));var _0x17c864=db[_0x10c8('0x2c')][_0x10c8('0x19')][_0x10c8('0x30')]['values'];if(!_0x17c864[_0x10c8('0x3d')](_0x1c2fd1[_0x10c8('0x3e')][_0x10c8('0x30')]))throw new Error(_0x10c8('0x3f')+_0x17c864[_0x10c8('0x40')](',\x20'));if(_0x1c2fd1[_0x10c8('0x3e')][_0x10c8('0x30')]===_0x10c8('0x31')&&_0x1c2fd1[_0x10c8('0x3e')][_0x10c8('0x33')]){_0x1c2fd1[_0x10c8('0x3e')][_0x10c8('0x33')]=encryptor[_0x10c8('0x41')](_0x1c2fd1[_0x10c8('0x3e')]['data3']);}return db['CloudProvider'][_0x10c8('0x3a')](_0x1c2fd1['body'],{})[_0x10c8('0x11')](respondWithResult(_0x4ed6dd,0xc9))['catch'](handleError(_0x4ed6dd,null));};exports['update']=function(_0x58e34f,_0xcfa66f){if(_0x58e34f[_0x10c8('0x3e')]['id']){delete _0x58e34f[_0x10c8('0x3e')]['id'];}return db['CloudProvider'][_0x10c8('0x39')]({'where':{'id':_0x58e34f[_0x10c8('0x35')]['id']}})[_0x10c8('0x11')](handleEntityNotFound(_0xcfa66f,null))[_0x10c8('0x11')](function(_0x15e38d){if(_0x15e38d['service']===_0x10c8('0x31')&&_0x58e34f[_0x10c8('0x3e')][_0x10c8('0x33')]){_0x58e34f[_0x10c8('0x3e')][_0x10c8('0x33')]=encryptor['encryptString'](_0x58e34f['body'][_0x10c8('0x33')]);}return _0x15e38d;})[_0x10c8('0x11')](saveUpdates(_0x58e34f['body'],null))[_0x10c8('0x11')](respondWithResult(_0xcfa66f,null))[_0x10c8('0x34')](handleError(_0xcfa66f,null));};exports['destroy']=function(_0x55ade2,_0x35bbac){return db[_0x10c8('0x2c')]['find']({'where':{'id':_0x55ade2[_0x10c8('0x35')]['id']}})[_0x10c8('0x11')](handleEntityNotFound(_0x35bbac,null))[_0x10c8('0x11')](removeEntity(_0x35bbac,null))[_0x10c8('0x34')](handleError(_0x35bbac,null));};exports['oauth2MicrosoftAuthorize']=function(_0x25c451,_0x2e2071){return db[_0x10c8('0x2c')][_0x10c8('0x42')]({'where':{'id':_0x25c451[_0x10c8('0x35')]['id']},'raw':!![]})[_0x10c8('0x11')](function(_0x2e0240){if(!_0x2e0240)return _0x2e2071[_0x10c8('0x6')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x2e0240,_0x25c451[_0x10c8('0x43')]['id'])};})[_0x10c8('0x11')](respondWithResult(_0x2e2071,null))[_0x10c8('0x34')](handleError(_0x2e2071,null));};exports[_0x10c8('0x44')]=function(_0x2b9cd3,_0x513415){var _0x1c0c6a=_0x2b9cd3[_0x10c8('0x3e')];var _0x23ed26;var _0x463841;if(_0x1c0c6a[_0x10c8('0x13')])throw _0x1c0c6a;redis[_0x10c8('0x45')](_0x1c0c6a['state'])['then'](function(_0x2fb4f4){if(!_0x2fb4f4)throw new Error(_0x10c8('0x46'));_0x23ed26=JSON[_0x10c8('0x47')](_0x2fb4f4);var _0x2ff0b2=Buffer[_0x10c8('0x48')](_0x1c0c6a[_0x10c8('0x49')],_0x10c8('0x4a'))[_0x10c8('0x4b')](_0x10c8('0x4c'));_0x463841=JSON[_0x10c8('0x47')](_0x2ff0b2);if(!oauth['isValidIdToken'](_0x1c0c6a[_0x10c8('0x4d')],_0x23ed26[_0x10c8('0x4e')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x1c0c6a[_0x10c8('0x49')]);return oauth[_0x10c8('0x4f')](_0x1c0c6a[_0x10c8('0x50')],_0x23ed26);})[_0x10c8('0x11')](function(_0x5094a3){_0x23ed26['data5']=_0x5094a3['access_token'];_0x23ed26[_0x10c8('0x51')]=_0x5094a3['refresh_token'];return db[_0x10c8('0x2c')][_0x10c8('0x10')]({'data5':_0x23ed26[_0x10c8('0x52')],'data6':_0x23ed26[_0x10c8('0x51')]},{'where':{'id':_0x23ed26['id']}});})[_0x10c8('0x11')](function(){oauth['startRefreshInterval'](_0x23ed26);socket['emit'](_0x10c8('0x53'),{'id':_0x463841['id']});return;})['then'](respondWithStatusCode(_0x513415,null))[_0x10c8('0x34')](function(_0x25aacd){if(_0x463841){socket['emit'](_0x10c8('0x54'),{'id':_0x463841['id']});}if(!_0x23ed26){logger[_0x10c8('0x13')](_0x10c8('0x55'),_0x25aacd);return _0x513415['status'](0x1f4)[_0x10c8('0x16')](_0x25aacd[_0x10c8('0x56')]);}logger['error'](_0x10c8('0x57'),_0x23ed26['id'],_0x25aacd);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 079b870..2ef05f1 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 _0x8f62=['util','api','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x36bf76,_0x3a72dc){var _0xfa29c3=function(_0x157b18){while(--_0x157b18){_0x36bf76['push'](_0x36bf76['shift']());}};_0xfa29c3(++_0x3a72dc);}(_0x8f62,0x1af));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x28f6('0x0'));var util=require(_0x28f6('0x1'));var logger=require('../../config/logger')(_0x28f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28f6('0x3'));var fs=require('fs');var path=require(_0x28f6('0x4'));var rimraf=require(_0x28f6('0x5'));var config=require(_0x28f6('0x6'));var attributes=require(_0x28f6('0x7'));module[_0x28f6('0x8')]=function(_0x125feb,_0x302436){return _0x125feb[_0x28f6('0x9')](_0x28f6('0xa'),attributes,{'tableName':_0x28f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfb=['exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./cloudProvider.attributes'];(function(_0x551aa6,_0x35abf8){var _0x555c10=function(_0x393d9a){while(--_0x393d9a){_0x551aa6['push'](_0x551aa6['shift']());}};_0x555c10(++_0x35abf8);}(_0xbdfb,0x108));var _0xbbdf=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0xbdfb[_0x3af6d3];return _0xf0c5a8;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var rp=require(_0xbbdf('0x6'));var fs=require('fs');var path=require(_0xbbdf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbbdf('0x8'));module[_0xbbdf('0x9')]=function(_0xcae17e,_0x2d4a5e){return _0xcae17e[_0xbbdf('0xa')](_0xbbdf('0xb'),attributes,{'tableName':_0xbbdf('0xc'),'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 66ca671..15cb1a9 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 _0x2ef3=['value','oauth2Claims','replace','oauth2/','set','stringify','decode','payload','iss','aud','audience','unix','exp','resolve','then','data3','findOne','data6','decryptString','data5','access_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','POST','{TENANT_ID}','intervals','CloudProvider','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','/token','type','Dynamics365','push','join','Outlook365','data2','code','from','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','data4','response_mode','state','nonce','prompt','map'];(function(_0x422102,_0x43aa77){var _0x4a2906=function(_0x588488){while(--_0x588488){_0x422102['push'](_0x422102['shift']());}};_0x4a2906(++_0x43aa77);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ad87d,_0x2840e3){_0x5ad87d=_0x5ad87d-0x0;var _0x229d99=_0x2ef3[_0x5ad87d];return _0x229d99;};'use strict';var _=require(_0x32ef('0x0'));var crypto=require(_0x32ef('0x1'));var jwt=require(_0x32ef('0x2'));var moment=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var util=require('util');var encryptor=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var logger=require('../../config/logger')(_0x32ef('0x8'));var schedule=require(_0x32ef('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x32ef('0xa')](config[_0x32ef('0xb')],{'host':_0x32ef('0xc'),'port':0x18eb});var redis=new Redis(config[_0x32ef('0xb')]);var MICROSOFT_AUTH_URL=_0x32ef('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x32ef('0xe'),_0x32ef('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x32ef('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x32ef('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5af651){var _0x193714=_['map'](AZURE_AUTH_SCOPES[_0x5af651[_0x32ef('0x15')]]);if(_0x5af651['type']===_0x32ef('0x16'))_0x193714[_0x32ef('0x17')](_0x5af651['data7']+'/.default');return _0x193714[_0x32ef('0x18')]('\x20');}function getAccessTokenScope(_0x4d8009){if(_0x4d8009[_0x32ef('0x15')]===_0x32ef('0x19'))return _0x32ef('0x12');if(_0x4d8009[_0x32ef('0x15')]==='Dynamics365')return _0x4d8009['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x13db1a,_0x3950e6){var _0xb5aed2=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x13db1a[_0x32ef('0x1a')]);var _0x1a9476=[_0x32ef('0x1b'),'id_token'];var _0xbe37f6=Buffer[_0x32ef('0x1c')](JSON['stringify']({'id':_0x3950e6}))[_0x32ef('0x1d')](_0x32ef('0x1e'));var _0x26aff3=crypto[_0x32ef('0x1f')](0x10)[_0x32ef('0x1d')](_0x32ef('0x20'));var _0x4de441=getAuthorizationScopes(_0x13db1a);var _0x3c5b78=[{'key':'client_id','value':_0x13db1a[_0x32ef('0x21')]},{'key':_0x32ef('0x22'),'value':encodeURIComponent(_0x1a9476['join']('\x20'))},{'key':_0x32ef('0x23'),'value':_0x13db1a[_0x32ef('0x24')]},{'key':_0x32ef('0x25'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x4de441)},{'key':_0x32ef('0x26'),'value':_0xbe37f6},{'key':_0x32ef('0x27'),'value':_0x26aff3},{'key':_0x32ef('0x28'),'value':'login'}];var _0x59585f=_0xb5aed2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x32ef('0x29')](_0x3c5b78,function(_0x4d584b){return _0x4d584b['key']+'='+_0x4d584b[_0x32ef('0x2a')];})[_0x32ef('0x18')]('&');_0x13db1a[_0x32ef('0x2b')]={'issuer':_0xb5aed2[_0x32ef('0x2c')](_0x32ef('0x2d'),''),'audience':_0x13db1a[_0x32ef('0x21')],'state':_0xbe37f6,'nonce':_0x26aff3};redis[_0x32ef('0x2e')](_0xbe37f6,JSON[_0x32ef('0x2f')](_0x13db1a));return _0x59585f;}function isValidIdToken(_0x338f19,_0x2f52d7){try{var _0x1335e2=jwt[_0x32ef('0x30')](_0x338f19,{'complete':!![]});var _0x5a88a5=_0x1335e2[_0x32ef('0x31')];if(_0x5a88a5[_0x32ef('0x32')]!==_0x2f52d7['issuer'])return![];if(_0x5a88a5[_0x32ef('0x33')]!==_0x2f52d7[_0x32ef('0x34')])return![];if(_0x5a88a5[_0x32ef('0x27')]!==_0x2f52d7[_0x32ef('0x27')])return![];if(moment()['isAfter'](moment[_0x32ef('0x35')](_0x5a88a5[_0x32ef('0x36')])))return![];return!![];}catch(_0x31dbc3){throw _0x31dbc3;}}function refreshOauth2MicrosoftAccessToken(_0x2ac686){return Promise[_0x32ef('0x37')]()[_0x32ef('0x38')](function(){if(_0x2ac686[_0x32ef('0x39')])return _0x2ac686;return db['CloudProvider'][_0x32ef('0x3a')]({'where':{'id':_0x2ac686['id']},'raw':!![]});})['then'](function(_0x38bf73){var _0x2b6c6a={'grant_type':'refresh_token','refresh_token':_0x38bf73[_0x32ef('0x3b')],'scope':getAccessTokenScope(_0x38bf73),'redirect_uri':_0x38bf73[_0x32ef('0x24')],'client_id':_0x38bf73[_0x32ef('0x21')],'client_secret':encryptor[_0x32ef('0x3c')](_0x38bf73[_0x32ef('0x39')])};var _0x59a4a3={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x32ef('0x2c')]('{TENANT_ID}',_0x38bf73[_0x32ef('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b6c6a,'json':!![]};return rp(_0x59a4a3);})[_0x32ef('0x38')](function(_0x2f1349){_0x2ac686[_0x32ef('0x3d')]=_0x2f1349[_0x32ef('0x3e')];_0x2ac686[_0x32ef('0x3b')]=_0x2f1349['refresh_token'];return db['CloudProvider']['update']({'data5':_0x2ac686[_0x32ef('0x3d')],'data6':_0x2ac686[_0x32ef('0x3b')]},{'where':{'id':_0x2ac686['id']}});})[_0x32ef('0x38')](function(){return _0x2ac686;})['catch'](function(_0x4fb402){logger[_0x32ef('0x3f')](_0x32ef('0x40'),_0x2ac686['id'],_0x4fb402);});}function getOauth2MicrosoftAccessToken(_0x410334,_0x480348){var _0x4abbd6={'grant_type':_0x32ef('0x41'),'code':_0x410334,'scope':getAccessTokenScope(_0x480348),'redirect_uri':_0x480348[_0x32ef('0x24')],'client_id':_0x480348[_0x32ef('0x21')],'client_secret':encryptor[_0x32ef('0x3c')](_0x480348[_0x32ef('0x39')])};var _0x211c79={'method':_0x32ef('0x42'),'uri':MICROSOFT_AUTH_URL[_0x32ef('0x2c')](_0x32ef('0x43'),_0x480348['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4abbd6,'json':!![]};return rp(_0x211c79);}function startRefreshInterval(_0x3a4a99){var _0x36e374=schedule[_0x32ef('0x44')];if(_0x36e374[_0x3a4a99['id']])clearInterval(_0x36e374[_0x3a4a99['id']]);_0x36e374[_0x3a4a99['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3a4a99['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x32ef('0x44')]=_0x36e374;}function startAllRefreshIntervals(){return db[_0x32ef('0x45')][_0x32ef('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x32ef('0x38')](function(_0x1faf72){var _0x33a0fb=_0x1faf72[_0x32ef('0x29')](function(_0x1cebed){return refreshOauth2MicrosoftAccessToken(_0x1cebed)[_0x32ef('0x38')](function(_0x57a3c0){startRefreshInterval(_0x57a3c0);});});return Promise[_0x32ef('0x47')](_0x33a0fb);})[_0x32ef('0x48')](function(_0x48e071){var _0x3cac2e=_0x48e071?util[_0x32ef('0x49')](_0x48e071,{'showHidden':![],'depth':null}):'';logger[_0x32ef('0x3f')](_0x32ef('0x4a'),_0x3cac2e);});}module[_0x32ef('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xc4aa=['defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','randomBytes','hex','client_id','data1','redirect_uri','response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','nonce','isAfter','resolve','then','data3','findOne','refresh_token','data6','data4','decryptString','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','bind','all','inspect','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis'];(function(_0x1f504c,_0x319b4f){var _0x50d2e6=function(_0x47f98d){while(--_0x47f98d){_0x1f504c['push'](_0x1f504c['shift']());}};_0x50d2e6(++_0x319b4f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xac4a('0x0'));var crypto=require(_0xac4a('0x1'));var jwt=require(_0xac4a('0x2'));var moment=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xac4a('0x6'))(_0xac4a('0x7'));var schedule=require(_0xac4a('0x8'));var db=require(_0xac4a('0x9'))['db'];config[_0xac4a('0xa')]=_[_0xac4a('0xb')](config[_0xac4a('0xa')],{'host':_0xac4a('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xac4a('0xd'),_0xac4a('0xe'),_0xac4a('0xf'),'offline_access',_0xac4a('0x10'),_0xac4a('0x11'),_0xac4a('0x12')],'Dynamics365':['openid',_0xac4a('0x13')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xac4a('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4855b6){var _0x333ca5=_[_0xac4a('0x15')](AZURE_AUTH_SCOPES[_0x4855b6[_0xac4a('0x16')]]);if(_0x4855b6['type']===_0xac4a('0x17'))_0x333ca5[_0xac4a('0x18')](_0x4855b6[_0xac4a('0x19')]+_0xac4a('0x1a'));return _0x333ca5[_0xac4a('0x1b')]('\x20');}function getAccessTokenScope(_0x3b71c0){if(_0x3b71c0[_0xac4a('0x16')]===_0xac4a('0x1c'))return _0xac4a('0x10');if(_0x3b71c0[_0xac4a('0x16')]===_0xac4a('0x17'))return _0x3b71c0[_0xac4a('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x402fff,_0x34d797){var _0x23eb66=MICROSOFT_AUTH_URL[_0xac4a('0x1d')](_0xac4a('0x1e'),_0x402fff[_0xac4a('0x1f')]);var _0x28e304=[_0xac4a('0x20'),'id_token'];var _0x5ac21e=Buffer[_0xac4a('0x21')](JSON[_0xac4a('0x22')]({'id':_0x34d797}))[_0xac4a('0x23')]('base64');var _0x39e83e=crypto[_0xac4a('0x24')](0x10)[_0xac4a('0x23')](_0xac4a('0x25'));var _0x123694=getAuthorizationScopes(_0x402fff);var _0x3e829c=[{'key':_0xac4a('0x26'),'value':_0x402fff[_0xac4a('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x28e304[_0xac4a('0x1b')]('\x20'))},{'key':_0xac4a('0x28'),'value':_0x402fff['data4']},{'key':_0xac4a('0x29'),'value':_0xac4a('0x2a')},{'key':_0xac4a('0x2b'),'value':encodeURIComponent(_0x123694)},{'key':_0xac4a('0x2c'),'value':_0x5ac21e},{'key':'nonce','value':_0x39e83e},{'key':_0xac4a('0x2d'),'value':_0xac4a('0x2e')}];var _0x15435c=_0x23eb66+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xac4a('0x15')](_0x3e829c,function(_0x594f36){return _0x594f36[_0xac4a('0x2f')]+'='+_0x594f36[_0xac4a('0x30')];})[_0xac4a('0x1b')]('&');_0x402fff[_0xac4a('0x31')]={'issuer':_0x23eb66[_0xac4a('0x1d')](_0xac4a('0x32'),''),'audience':_0x402fff[_0xac4a('0x27')],'state':_0x5ac21e,'nonce':_0x39e83e};redis[_0xac4a('0x33')](_0x5ac21e,JSON[_0xac4a('0x22')](_0x402fff));return _0x15435c;}function isValidIdToken(_0x1c13dc,_0x20202c){try{var _0x4e17ce=jwt[_0xac4a('0x34')](_0x1c13dc,{'complete':!![]});var _0x267a22=_0x4e17ce[_0xac4a('0x35')];if(_0x267a22[_0xac4a('0x36')]!==_0x20202c[_0xac4a('0x37')])return![];if(_0x267a22['aud']!==_0x20202c['audience'])return![];if(_0x267a22[_0xac4a('0x38')]!==_0x20202c[_0xac4a('0x38')])return![];if(moment()[_0xac4a('0x39')](moment['unix'](_0x267a22['exp'])))return![];return!![];}catch(_0x355755){throw _0x355755;}}function refreshOauth2MicrosoftAccessToken(_0x2896bc){return Promise[_0xac4a('0x3a')]()[_0xac4a('0x3b')](function(){if(_0x2896bc[_0xac4a('0x3c')])return _0x2896bc;return db['CloudProvider'][_0xac4a('0x3d')]({'where':{'id':_0x2896bc['id']},'raw':!![]});})['then'](function(_0x30364b){var _0x57adcf={'grant_type':_0xac4a('0x3e'),'refresh_token':_0x30364b[_0xac4a('0x3f')],'scope':getAccessTokenScope(_0x30364b),'redirect_uri':_0x30364b[_0xac4a('0x40')],'client_id':_0x30364b[_0xac4a('0x27')],'client_secret':encryptor[_0xac4a('0x41')](_0x30364b[_0xac4a('0x3c')])};var _0xbd4591={'method':_0xac4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0xac4a('0x1d')](_0xac4a('0x1e'),_0x30364b[_0xac4a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57adcf,'json':!![]};return rp(_0xbd4591);})[_0xac4a('0x3b')](function(_0x1a9be2){_0x2896bc[_0xac4a('0x43')]=_0x1a9be2['access_token'];_0x2896bc[_0xac4a('0x3f')]=_0x1a9be2[_0xac4a('0x3e')];return db['CloudProvider'][_0xac4a('0x44')]({'data5':_0x2896bc[_0xac4a('0x43')],'data6':_0x2896bc['data6']},{'where':{'id':_0x2896bc['id']}});})['then'](function(){return _0x2896bc;})[_0xac4a('0x45')](function(_0x1ba096){logger[_0xac4a('0x46')](_0xac4a('0x47'),_0x2896bc['id'],_0x1ba096);});}function getOauth2MicrosoftAccessToken(_0x4f5986,_0x453d02){var _0x2e56c6={'grant_type':'authorization_code','code':_0x4f5986,'scope':getAccessTokenScope(_0x453d02),'redirect_uri':_0x453d02[_0xac4a('0x40')],'client_id':_0x453d02[_0xac4a('0x27')],'client_secret':encryptor[_0xac4a('0x41')](_0x453d02['data3'])};var _0x121328={'method':_0xac4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0xac4a('0x1d')]('{TENANT_ID}',_0x453d02[_0xac4a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e56c6,'json':!![]};return rp(_0x121328);}function startRefreshInterval(_0x2e76e3){var _0x4b9faf=schedule['intervals'];if(_0x4b9faf[_0x2e76e3['id']])clearInterval(_0x4b9faf[_0x2e76e3['id']]);_0x4b9faf[_0x2e76e3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xac4a('0x48')](this,{'id':_0x2e76e3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4b9faf;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x41b757){var _0x2bf8e8=_0x41b757[_0xac4a('0x15')](function(_0x472484){return refreshOauth2MicrosoftAccessToken(_0x472484)[_0xac4a('0x3b')](function(_0x415f31){startRefreshInterval(_0x415f31);});});return Promise[_0xac4a('0x49')](_0x2bf8e8);})[_0xac4a('0x45')](function(_0x28292c){var _0x1f7721=_0x28292c?util[_0xac4a('0x4a')](_0x28292c,{'showHidden':![],'depth':null}):'';logger[_0xac4a('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart',_0x1f7721);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 339900e..b586dc0 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 _0x6db4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird'];(function(_0x13e97c,_0x3c4ad2){var _0x213d81=function(_0x2f4e05){while(--_0x2f4e05){_0x13e97c['push'](_0x13e97c['shift']());}};_0x213d81(++_0x3c4ad2);}(_0x6db4,0x111));var _0x46db=function(_0x5b36af,_0x3ea3f0){_0x5b36af=_0x5b36af-0x0;var _0x2a6901=_0x6db4[_0x5b36af];return _0x2a6901;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var moment=require(_0x46db('0x1'));var BPromise=require(_0x46db('0x2'));var rs=require(_0x46db('0x3'));var fs=require('fs');var Redis=require(_0x46db('0x4'));var db=require(_0x46db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46db('0x6'))(_0x46db('0x7'));var config=require(_0x46db('0x8'));var jayson=require(_0x46db('0x9'));var client=jayson[_0x46db('0xa')][_0x46db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23de32,_0x5409cd,_0x3a2dcb){return new BPromise(function(_0x2a597d,_0x27b949){return client[_0x46db('0xc')](_0x23de32,_0x3a2dcb)[_0x46db('0xd')](function(_0x427c62){logger[_0x46db('0xe')](_0x46db('0xf'),_0x5409cd,_0x46db('0x10'));logger[_0x46db('0x11')](_0x46db('0x12'),_0x5409cd,_0x46db('0x10'),JSON['stringify'](_0x427c62));if(_0x427c62[_0x46db('0x13')]){if(_0x427c62[_0x46db('0x13')][_0x46db('0x14')]===0x1f4){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);return _0x27b949(_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x427c62['error'][_0x46db('0x15')]);return _0x2a597d(_0x427c62[_0x46db('0x13')]['message']);}else{logger[_0x46db('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x46db('0x10'));_0x2a597d(_0x427c62['result'][_0x46db('0x15')]);}})[_0x46db('0x16')](function(_0x5a75fb){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x5a75fb);_0x27b949(_0x5a75fb);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3a351a,_0x1e949b){var _0x46f124=function(_0x2e9133){while(--_0x2e9133){_0x3a351a['push'](_0x3a351a['shift']());}};_0x46f124(++_0x1e949b);}(_0xb10b,0x12a));var _0xbb10=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb10b[_0x45d55e];return _0x29812a;};'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);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4ba62a7..34e1e33 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17c118,_0x391c66){_0x17c118=_0x17c118-0x0;var _0x42c295=_0x5f2f[_0x17c118];return _0x42c295;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2691ba,_0x478d7d){_0x2691ba=_0x2691ba-0x0;var _0x5e18a4=_0x5f2f[_0x2691ba];return _0x5e18a4;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index e8a74ab..3847f7d 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 _0x0447=['exports','STRING','name','sequelize'];(function(_0x31e630,_0x2c8b92){var _0xd9b265=function(_0x38bae2){while(--_0x38bae2){_0x31e630['push'](_0x31e630['shift']());}};_0xd9b265(++_0x2c8b92);}(_0x0447,0x133));var _0x7044=function(_0x5e1a3e,_0xaf5f51){_0x5e1a3e=_0x5e1a3e-0x0;var _0x3a04b4=_0x0447[_0x5e1a3e];return _0x3a04b4;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'name':{'type':Sequelize[_0x7044('0x2')],'unique':_0x7044('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7044('0x2')]},'companyId':{'type':Sequelize[_0x7044('0x2')]},'website':{'type':Sequelize[_0x7044('0x2')]},'phone':{'type':Sequelize[_0x7044('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7044('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7044('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7044('0x2')]},'email':{'type':Sequelize[_0x7044('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7044('0x2')]},'sStreet':{'type':Sequelize[_0x7044('0x2')]},'sPostalCode':{'type':Sequelize[_0x7044('0x2')]},'sCity':{'type':Sequelize[_0x7044('0x2')]},'sCountry':{'type':Sequelize[_0x7044('0x2')]},'description':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file +var _0x6b24=['STRING','sequelize','exports'];(function(_0x3a8a72,_0x543462){var _0x3ad0a0=function(_0xcce9c){while(--_0xcce9c){_0x3a8a72['push'](_0x3a8a72['shift']());}};_0x3ad0a0(++_0x543462);}(_0x6b24,0x196));var _0x46b2=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x6b24[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x46b2('0x0'));module[_0x46b2('0x1')]={'name':{'type':Sequelize[_0x46b2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x46b2('0x2')]},'website':{'type':Sequelize[_0x46b2('0x2')]},'phone':{'type':Sequelize[_0x46b2('0x2')]},'fax':{'type':Sequelize[_0x46b2('0x2')]},'type':{'type':Sequelize[_0x46b2('0x2')]},'street':{'type':Sequelize[_0x46b2('0x2')]},'postalCode':{'type':Sequelize[_0x46b2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x46b2('0x2')]},'sPostalCode':{'type':Sequelize[_0x46b2('0x2')]},'sCity':{'type':Sequelize[_0x46b2('0x2')]},'sCountry':{'type':Sequelize[_0x46b2('0x2')]},'description':{'type':Sequelize[_0x46b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2df4759..e8e82af 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 _0x803e=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','findAll','rows','catch','rawAttributes','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContact','addContacts','ids','findOne','pick','getContacts','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','get','destroy','sendStatus','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields'];(function(_0x21065c,_0x559d23){var _0x31417a=function(_0x3d6c87){while(--_0x3d6c87){_0x21065c['push'](_0x21065c['shift']());}};_0x31417a(++_0x559d23);}(_0x803e,0x12e));var _0xe803=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x803e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe803('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe803('0x1'));var rp=require(_0xe803('0x2'));var moment=require(_0xe803('0x3'));var BPromise=require(_0xe803('0x4'));var Mustache=require(_0xe803('0x5'));var util=require(_0xe803('0x6'));var path=require(_0xe803('0x7'));var sox=require(_0xe803('0x8'));var csv=require(_0xe803('0x9'));var ejs=require(_0xe803('0xa'));var fs=require('fs');var fs_extra=require(_0xe803('0xb'));var _=require(_0xe803('0xc'));var squel=require('squel');var crypto=require(_0xe803('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe803('0xe'));var toCsv=require(_0xe803('0x9'));var querystring=require(_0xe803('0xf'));var Papa=require(_0xe803('0x10'));var Redis=require(_0xe803('0x11'));var authService=require(_0xe803('0x12'));var qs=require(_0xe803('0x13'));var as=require(_0xe803('0x14'));var hardwareService=require(_0xe803('0x15'));var logger=require(_0xe803('0x16'))(_0xe803('0x17'));var utils=require(_0xe803('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe803('0x19'));var db=require(_0xe803('0x1a'))['db'];function respondWithStatusCode(_0x3c8352,_0x17618e){_0x17618e=_0x17618e||0xcc;return function(_0x16efe0){if(_0x16efe0){return _0x3c8352['sendStatus'](_0x17618e);}return _0x3c8352['status'](_0x17618e)[_0xe803('0x1b')]();};}function respondWithResult(_0x4dee95,_0x1449c8){_0x1449c8=_0x1449c8||0xc8;return function(_0x5da7f1){if(_0x5da7f1){return _0x4dee95[_0xe803('0x1c')](_0x1449c8)[_0xe803('0x1d')](_0x5da7f1);}};}function respondWithFilteredResult(_0x37f02b,_0x446a19){return function(_0x3d5d6a){if(_0x3d5d6a){var _0x46e652=typeof _0x446a19[_0xe803('0x1e')]==='undefined'&&typeof _0x446a19[_0xe803('0x1f')]==='undefined';var _0x417ff7=_0x3d5d6a[_0xe803('0x20')];var _0x470871=_0x46e652?0x0:_0x446a19[_0xe803('0x1e')];var _0x2c2a0c=_0x46e652?_0x3d5d6a[_0xe803('0x20')]:_0x446a19[_0xe803('0x1e')]+_0x446a19['limit'];var _0x5688aa;if(_0x2c2a0c>=_0x417ff7){_0x2c2a0c=_0x417ff7;_0x5688aa=0xc8;}else{_0x5688aa=0xce;}_0x37f02b['status'](_0x5688aa);return _0x37f02b[_0xe803('0x21')](_0xe803('0x22'),_0x470871+'-'+_0x2c2a0c+'/'+_0x417ff7)['json'](_0x3d5d6a);}return null;};}function patchUpdates(_0x5613ea){return function(_0x5edecf){try{jsonpatch[_0xe803('0x23')](_0x5edecf,_0x5613ea,!![]);}catch(_0xbb6497){return BPromise['reject'](_0xbb6497);}return _0x5edecf[_0xe803('0x24')]();};}function saveUpdates(_0x33f73e,_0x1e7243){return function(_0x15d43c){if(_0x15d43c){return _0x15d43c[_0xe803('0x25')](_0x33f73e)['then'](function(_0x312fad){return _0x312fad;});}return null;};}function removeEntity(_0x2953a1,_0x2f2b8e){return function(_0x3995d3){if(_0x3995d3){return _0x3995d3['destroy']()[_0xe803('0x26')](function(){var _0x67d9c8=_0x3995d3[_0xe803('0x27')]({'plain':!![]});var _0x29e0a2='Companies';return db['UserProfileResource'][_0xe803('0x28')]({'where':{'type':_0x29e0a2,'resourceId':_0x67d9c8['id']}})[_0xe803('0x26')](function(){return _0x3995d3;});})[_0xe803('0x26')](function(){_0x2953a1[_0xe803('0x1c')](0xcc)[_0xe803('0x1b')]();});}};}function handleEntityNotFound(_0x52e094,_0x409896){return function(_0x532478){if(!_0x532478){_0x52e094[_0xe803('0x29')](0x194);}return _0x532478;};}function handleError(_0x4285fa,_0x2b77c2){_0x2b77c2=_0x2b77c2||0x1f4;return function(_0x2a76b2){logger['error'](_0x2a76b2[_0xe803('0x2a')]);if(_0x2a76b2[_0xe803('0x2b')]){delete _0x2a76b2[_0xe803('0x2b')];}_0x4285fa['status'](_0x2b77c2)[_0xe803('0x2c')](_0x2a76b2);};}exports[_0xe803('0x2d')]=function(_0x43d95d,_0x41964a){var _0x333485={},_0x9b8f41={},_0xd68dd={'count':0x0,'rows':[]};return db[_0xe803('0x2e')][_0xe803('0x2f')]()['then'](function(_0x29b567){_0x9b8f41[_0xe803('0x30')]=_[_0xe803('0x31')](_0x29b567);_0x9b8f41[_0xe803('0x32')]=_[_0xe803('0x31')](_0x43d95d[_0xe803('0x32')]);_0x9b8f41['filters']=_[_0xe803('0x33')](_0x9b8f41[_0xe803('0x30')],_0x9b8f41[_0xe803('0x32')]);_0x333485[_0xe803('0x34')]=_[_0xe803('0x33')](_0x9b8f41[_0xe803('0x30')],qs[_0xe803('0x35')](_0x43d95d['query'][_0xe803('0x35')]));_0x333485[_0xe803('0x34')]=_0x333485[_0xe803('0x34')][_0xe803('0x36')]?_0x333485[_0xe803('0x34')]:_0x9b8f41['model'];if(!_0x43d95d[_0xe803('0x32')][_0xe803('0x37')](_0xe803('0x38'))){_0x333485['limit']=qs[_0xe803('0x1f')](_0x43d95d[_0xe803('0x32')]['limit']);_0x333485[_0xe803('0x1e')]=qs[_0xe803('0x1e')](_0x43d95d[_0xe803('0x32')][_0xe803('0x1e')]);}_0x333485[_0xe803('0x39')]=qs['sort'](_0x43d95d[_0xe803('0x32')][_0xe803('0x3a')]);_0x333485[_0xe803('0x3b')]=qs[_0xe803('0x3c')](_['pick'](_0x43d95d[_0xe803('0x32')],_0x9b8f41[_0xe803('0x3c')]),_0x29b567);if(_0x43d95d['query'][_0xe803('0x3d')]){_0x333485[_0xe803('0x3b')]=_[_0xe803('0x3e')](_0x333485['where'],{'$or':_[_0xe803('0x3f')](_0x333485[_0xe803('0x34')],function(_0x4ac58e){var _0xbfacb3={};_0xbfacb3[_0x4ac58e]={'$like':'%'+_0x43d95d['query'][_0xe803('0x3d')]+'%'};return _0xbfacb3;})});}_0x333485=_[_0xe803('0x3e')]({},_0x333485,_0x43d95d[_0xe803('0x40')]);var _0x4e4fed={'where':_0x333485[_0xe803('0x3b')]};return db[_0xe803('0x2e')]['count'](_0x4e4fed)[_0xe803('0x26')](function(_0x27ada8){_0xd68dd[_0xe803('0x20')]=_0x27ada8;if(_0x43d95d[_0xe803('0x32')][_0xe803('0x41')]){_0x333485['include']=[{'all':!![]}];}return db[_0xe803('0x2e')][_0xe803('0x42')](_0x333485);})['then'](function(_0xffe2dd){_0xd68dd[_0xe803('0x43')]=_0xffe2dd;return _0xd68dd;})['then'](respondWithFilteredResult(_0x41964a,_0x333485))[_0xe803('0x44')](handleError(_0x41964a,null));})[_0xe803('0x44')](handleError(_0x41964a,null));};exports['show']=function(_0x48f4b8,_0x212ba2){var _0x274ab4={'raw':![],'where':{'id':_0x48f4b8['params']['id']}},_0x1a33ba={};_0x1a33ba[_0xe803('0x30')]=_['keys'](db['CmCompany'][_0xe803('0x45')]);_0x1a33ba[_0xe803('0x32')]=_[_0xe803('0x31')](_0x48f4b8[_0xe803('0x32')]);_0x1a33ba['filters']=_[_0xe803('0x33')](_0x1a33ba[_0xe803('0x30')],_0x1a33ba[_0xe803('0x32')]);_0x274ab4[_0xe803('0x34')]=_[_0xe803('0x33')](_0x1a33ba[_0xe803('0x30')],qs[_0xe803('0x35')](_0x48f4b8[_0xe803('0x32')]['fields']));_0x274ab4[_0xe803('0x34')]=_0x274ab4['attributes'][_0xe803('0x36')]?_0x274ab4['attributes']:_0x1a33ba[_0xe803('0x30')];if(_0x48f4b8[_0xe803('0x32')][_0xe803('0x41')]){_0x274ab4[_0xe803('0x46')]=[{'all':!![]}];}_0x274ab4=_[_0xe803('0x3e')]({},_0x274ab4,_0x48f4b8[_0xe803('0x40')]);return db[_0xe803('0x2e')]['find'](_0x274ab4)[_0xe803('0x26')](handleEntityNotFound(_0x212ba2,null))[_0xe803('0x26')](respondWithResult(_0x212ba2,null))['catch'](handleError(_0x212ba2,null));};exports['create']=function(_0x2111d8,_0x32c501){return db['CmCompany'][_0xe803('0x47')](_0x2111d8[_0xe803('0x48')],{})[_0xe803('0x26')](function(_0xde157f){var _0x33c1c7=_0x2111d8[_0xe803('0x49')][_0xe803('0x27')]({'plain':!![]});if(!_0x33c1c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33c1c7[_0xe803('0x4a')]===_0xe803('0x49')){var _0xaf5c7b=_0xde157f[_0xe803('0x27')]({'plain':!![]});var _0x2c345='Companies';return db[_0xe803('0x4b')][_0xe803('0x4c')]({'where':{'name':_0x2c345,'userProfileId':_0x33c1c7[_0xe803('0x4d')]},'raw':!![]})['then'](function(_0x236324){if(_0x236324&&_0x236324[_0xe803('0x4e')]===0x0){return db[_0xe803('0x4f')][_0xe803('0x47')]({'name':_0xaf5c7b['name'],'resourceId':_0xaf5c7b['id'],'type':_0x236324[_0xe803('0x2b')],'sectionId':_0x236324['id']},{})[_0xe803('0x26')](function(){return _0xde157f;});}else{return _0xde157f;}})[_0xe803('0x44')](function(_0x1bf794){logger[_0xe803('0x50')](_0xe803('0x51'),_0x1bf794);throw _0x1bf794;});}return _0xde157f;})[_0xe803('0x26')](respondWithResult(_0x32c501,0xc9))['catch'](handleError(_0x32c501,null));};exports[_0xe803('0x25')]=function(_0x531c6b,_0x209cef){if(_0x531c6b['body']['id']){delete _0x531c6b[_0xe803('0x48')]['id'];}return db[_0xe803('0x2e')][_0xe803('0x4c')]({'where':{'id':_0x531c6b[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x209cef,null))[_0xe803('0x26')](saveUpdates(_0x531c6b['body'],null))['then'](respondWithResult(_0x209cef,null))[_0xe803('0x44')](handleError(_0x209cef,null));};exports['destroy']=function(_0x43caeb,_0x15c67b){return db[_0xe803('0x2e')][_0xe803('0x4c')]({'where':{'id':_0x43caeb[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x15c67b,null))[_0xe803('0x26')](removeEntity(_0x15c67b,null))[_0xe803('0x44')](handleError(_0x15c67b,null));};exports[_0xe803('0x2f')]=function(_0x34b247,_0x32989f){return db['CmCompany'][_0xe803('0x2f')]()[_0xe803('0x26')](respondWithResult(_0x32989f,null))[_0xe803('0x44')](handleError(_0x32989f,null));};exports['addContacts']=function(_0x19bfe5,_0x2a3872,_0x2153fb){return db[_0xe803('0x53')][_0xe803('0x4c')]({'where':{'id':_0x19bfe5[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x2a3872,null))[_0xe803('0x26')](function(_0x1122d3){if(_0x1122d3){return _0x1122d3[_0xe803('0x54')](_0x19bfe5[_0xe803('0x48')][_0xe803('0x55')],_['omit'](_0x19bfe5[_0xe803('0x48')],[_0xe803('0x55'),'id'])||{});}})[_0xe803('0x26')](respondWithResult(_0x2a3872,null))[_0xe803('0x44')](handleError(_0x2a3872,null));};exports['getContacts']=function(_0x2d8627,_0x3dd74e,_0x467605){var _0x1c841f={};var _0x37d37a={};var _0x227fe7;var _0x14ed0a;return db[_0xe803('0x2e')][_0xe803('0x56')]({'where':{'id':_0x2d8627[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x3dd74e,null))['then'](function(_0x1e6708){if(_0x1e6708){_0x227fe7=_0x1e6708;_0x37d37a['model']=_[_0xe803('0x31')](db[_0xe803('0x53')]['rawAttributes']);_0x37d37a['query']=_[_0xe803('0x31')](_0x2d8627[_0xe803('0x32')]);_0x37d37a['filters']=_[_0xe803('0x33')](_0x37d37a[_0xe803('0x30')],_0x37d37a[_0xe803('0x32')]);_0x1c841f[_0xe803('0x34')]=_[_0xe803('0x33')](_0x37d37a[_0xe803('0x30')],qs[_0xe803('0x35')](_0x2d8627[_0xe803('0x32')][_0xe803('0x35')]));_0x1c841f[_0xe803('0x34')]=_0x1c841f['attributes']['length']?_0x1c841f['attributes']:_0x37d37a[_0xe803('0x30')];_0x1c841f[_0xe803('0x39')]=qs[_0xe803('0x3a')](_0x2d8627[_0xe803('0x32')][_0xe803('0x3a')]);_0x1c841f['where']=qs[_0xe803('0x3c')](_[_0xe803('0x57')](_0x2d8627[_0xe803('0x32')],_0x37d37a[_0xe803('0x3c')]));if(_0x2d8627[_0xe803('0x32')][_0xe803('0x3d')]){_0x1c841f[_0xe803('0x3b')]=_['merge'](_0x1c841f[_0xe803('0x3b')],{'$or':_['map'](_0x1c841f[_0xe803('0x34')],function(_0x58fb72){var _0x41a15b={};_0x41a15b[_0x58fb72]={'$like':'%'+_0x2d8627[_0xe803('0x32')][_0xe803('0x3d')]+'%'};return _0x41a15b;})});}_0x1c841f=_[_0xe803('0x3e')]({},_0x1c841f,_0x2d8627[_0xe803('0x40')]);return _0x227fe7[_0xe803('0x58')](_0x1c841f);}})[_0xe803('0x26')](function(_0x232d91){if(_0x232d91){_0x14ed0a=_0x232d91['length'];if(!_0x2d8627[_0xe803('0x32')][_0xe803('0x37')](_0xe803('0x38'))){_0x1c841f[_0xe803('0x1f')]=qs[_0xe803('0x1f')](_0x2d8627['query'][_0xe803('0x1f')]);_0x1c841f['offset']=qs[_0xe803('0x1e')](_0x2d8627[_0xe803('0x32')]['offset']);}return _0x227fe7[_0xe803('0x58')](_0x1c841f);}})['then'](function(_0x2362b9){if(_0x2362b9){return _0x2362b9?{'count':_0x14ed0a,'rows':_0x2362b9}:null;}})['then'](respondWithResult(_0x3dd74e,null))[_0xe803('0x44')](handleError(_0x3dd74e,null));}; \ No newline at end of file +var _0x593c=['../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x221902,_0x3d46c1){var _0x79fde9=function(_0x506c17){while(--_0x506c17){_0x221902['push'](_0x221902['shift']());}};_0x79fde9(++_0x3d46c1);}(_0x593c,0xf6));var _0xc593=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x593c[_0x6a0266];return _0x309e00;};'use strict';var emlformat=require(_0xc593('0x0'));var rimraf=require(_0xc593('0x1'));var zipdir=require(_0xc593('0x2'));var jsonpatch=require(_0xc593('0x3'));var rp=require('request-promise');var moment=require(_0xc593('0x4'));var BPromise=require(_0xc593('0x5'));var Mustache=require(_0xc593('0x6'));var util=require(_0xc593('0x7'));var path=require(_0xc593('0x8'));var sox=require(_0xc593('0x9'));var csv=require('to-csv');var ejs=require(_0xc593('0xa'));var fs=require('fs');var fs_extra=require(_0xc593('0xb'));var _=require(_0xc593('0xc'));var squel=require(_0xc593('0xd'));var crypto=require(_0xc593('0xe'));var jsforce=require(_0xc593('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc593('0x10'));var querystring=require('querystring');var Papa=require(_0xc593('0x11'));var Redis=require(_0xc593('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc593('0x13'));var as=require(_0xc593('0x14'));var hardwareService=require(_0xc593('0x15'));var logger=require(_0xc593('0x16'))(_0xc593('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc593('0x18'));var db=require(_0xc593('0x19'))['db'];function respondWithStatusCode(_0xc09b59,_0x5c8d79){_0x5c8d79=_0x5c8d79||0xcc;return function(_0x348cb2){if(_0x348cb2){return _0xc09b59['sendStatus'](_0x5c8d79);}return _0xc09b59[_0xc593('0x1a')](_0x5c8d79)[_0xc593('0x1b')]();};}function respondWithResult(_0x4e89e2,_0x4144e0){_0x4144e0=_0x4144e0||0xc8;return function(_0x2a5dfc){if(_0x2a5dfc){return _0x4e89e2[_0xc593('0x1a')](_0x4144e0)[_0xc593('0x1c')](_0x2a5dfc);}};}function respondWithFilteredResult(_0x24ab73,_0x181fa8){return function(_0x25f1b9){if(_0x25f1b9){var _0x22c485=typeof _0x181fa8[_0xc593('0x1d')]==='undefined'&&typeof _0x181fa8[_0xc593('0x1e')]==='undefined';var _0x20af78=_0x25f1b9[_0xc593('0x1f')];var _0x56b950=_0x22c485?0x0:_0x181fa8[_0xc593('0x1d')];var _0x141d97=_0x22c485?_0x25f1b9[_0xc593('0x1f')]:_0x181fa8[_0xc593('0x1d')]+_0x181fa8[_0xc593('0x1e')];var _0x463b93;if(_0x141d97>=_0x20af78){_0x141d97=_0x20af78;_0x463b93=0xc8;}else{_0x463b93=0xce;}_0x24ab73[_0xc593('0x1a')](_0x463b93);return _0x24ab73[_0xc593('0x20')]('Content-Range',_0x56b950+'-'+_0x141d97+'/'+_0x20af78)[_0xc593('0x1c')](_0x25f1b9);}return null;};}function patchUpdates(_0x549b3f){return function(_0x6b4616){try{jsonpatch[_0xc593('0x21')](_0x6b4616,_0x549b3f,!![]);}catch(_0x2a55bf){return BPromise[_0xc593('0x22')](_0x2a55bf);}return _0x6b4616[_0xc593('0x23')]();};}function saveUpdates(_0x287e6e,_0x2ac3c3){return function(_0x5551f1){if(_0x5551f1){return _0x5551f1[_0xc593('0x24')](_0x287e6e)[_0xc593('0x25')](function(_0x257c86){return _0x257c86;});}return null;};}function removeEntity(_0x3b2daf,_0x251187){return function(_0x3bb71f){if(_0x3bb71f){return _0x3bb71f[_0xc593('0x26')]()[_0xc593('0x25')](function(){var _0x3e7f8a=_0x3bb71f[_0xc593('0x27')]({'plain':!![]});var _0x238c08=_0xc593('0x28');return db[_0xc593('0x29')][_0xc593('0x26')]({'where':{'type':_0x238c08,'resourceId':_0x3e7f8a['id']}})[_0xc593('0x25')](function(){return _0x3bb71f;});})['then'](function(){_0x3b2daf[_0xc593('0x1a')](0xcc)[_0xc593('0x1b')]();});}};}function handleEntityNotFound(_0x472916,_0x71f2cb){return function(_0x4627d7){if(!_0x4627d7){_0x472916[_0xc593('0x2a')](0x194);}return _0x4627d7;};}function handleError(_0x1120ed,_0x261955){_0x261955=_0x261955||0x1f4;return function(_0x4f966d){logger[_0xc593('0x2b')](_0x4f966d[_0xc593('0x2c')]);if(_0x4f966d[_0xc593('0x2d')]){delete _0x4f966d[_0xc593('0x2d')];}_0x1120ed[_0xc593('0x1a')](_0x261955)[_0xc593('0x2e')](_0x4f966d);};}exports[_0xc593('0x2f')]=function(_0x464aff,_0xe74f29){var _0x609ab8={},_0x4baa46={},_0x5e7744={'count':0x0,'rows':[]};return db[_0xc593('0x30')][_0xc593('0x31')]()['then'](function(_0x5718a6){_0x4baa46['model']=_[_0xc593('0x32')](_0x5718a6);_0x4baa46['query']=_[_0xc593('0x32')](_0x464aff[_0xc593('0x33')]);_0x4baa46[_0xc593('0x34')]=_[_0xc593('0x35')](_0x4baa46['model'],_0x4baa46[_0xc593('0x33')]);_0x609ab8[_0xc593('0x36')]=_[_0xc593('0x35')](_0x4baa46[_0xc593('0x37')],qs['fields'](_0x464aff['query'][_0xc593('0x38')]));_0x609ab8[_0xc593('0x36')]=_0x609ab8[_0xc593('0x36')]['length']?_0x609ab8[_0xc593('0x36')]:_0x4baa46[_0xc593('0x37')];if(!_0x464aff[_0xc593('0x33')][_0xc593('0x39')](_0xc593('0x3a'))){_0x609ab8[_0xc593('0x1e')]=qs['limit'](_0x464aff[_0xc593('0x33')][_0xc593('0x1e')]);_0x609ab8[_0xc593('0x1d')]=qs[_0xc593('0x1d')](_0x464aff[_0xc593('0x33')][_0xc593('0x1d')]);}_0x609ab8[_0xc593('0x3b')]=qs[_0xc593('0x3c')](_0x464aff[_0xc593('0x33')][_0xc593('0x3c')]);_0x609ab8[_0xc593('0x3d')]=qs[_0xc593('0x34')](_[_0xc593('0x3e')](_0x464aff[_0xc593('0x33')],_0x4baa46['filters']),_0x5718a6);if(_0x464aff['query']['filter']){_0x609ab8[_0xc593('0x3d')]=_[_0xc593('0x3f')](_0x609ab8[_0xc593('0x3d')],{'$or':_['map'](_0x609ab8[_0xc593('0x36')],function(_0x356a35){var _0x3a959d={};_0x3a959d[_0x356a35]={'$like':'%'+_0x464aff['query'][_0xc593('0x40')]+'%'};return _0x3a959d;})});}_0x609ab8=_[_0xc593('0x3f')]({},_0x609ab8,_0x464aff['options']);var _0x82e9c5={'where':_0x609ab8['where']};return db[_0xc593('0x30')]['count'](_0x82e9c5)['then'](function(_0x366061){_0x5e7744[_0xc593('0x1f')]=_0x366061;if(_0x464aff[_0xc593('0x33')][_0xc593('0x41')]){_0x609ab8[_0xc593('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xc593('0x43')](_0x609ab8);})[_0xc593('0x25')](function(_0x3230e6){_0x5e7744[_0xc593('0x44')]=_0x3230e6;return _0x5e7744;})['then'](respondWithFilteredResult(_0xe74f29,_0x609ab8))[_0xc593('0x45')](handleError(_0xe74f29,null));})['catch'](handleError(_0xe74f29,null));};exports[_0xc593('0x46')]=function(_0x2472a2,_0x5c89b2){var _0x1223f2={'raw':![],'where':{'id':_0x2472a2[_0xc593('0x47')]['id']}},_0x4092fa={};_0x4092fa[_0xc593('0x37')]=_[_0xc593('0x32')](db[_0xc593('0x30')][_0xc593('0x48')]);_0x4092fa[_0xc593('0x33')]=_[_0xc593('0x32')](_0x2472a2[_0xc593('0x33')]);_0x4092fa[_0xc593('0x34')]=_[_0xc593('0x35')](_0x4092fa[_0xc593('0x37')],_0x4092fa[_0xc593('0x33')]);_0x1223f2['attributes']=_[_0xc593('0x35')](_0x4092fa[_0xc593('0x37')],qs[_0xc593('0x38')](_0x2472a2[_0xc593('0x33')]['fields']));_0x1223f2[_0xc593('0x36')]=_0x1223f2[_0xc593('0x36')][_0xc593('0x49')]?_0x1223f2['attributes']:_0x4092fa[_0xc593('0x37')];if(_0x2472a2['query']['includeAll']){_0x1223f2[_0xc593('0x42')]=[{'all':!![]}];}_0x1223f2=_['merge']({},_0x1223f2,_0x2472a2[_0xc593('0x4a')]);return db[_0xc593('0x30')][_0xc593('0x4b')](_0x1223f2)[_0xc593('0x25')](handleEntityNotFound(_0x5c89b2,null))[_0xc593('0x25')](respondWithResult(_0x5c89b2,null))[_0xc593('0x45')](handleError(_0x5c89b2,null));};exports[_0xc593('0x4c')]=function(_0x35dafb,_0x336879){return db['CmCompany'][_0xc593('0x4c')](_0x35dafb[_0xc593('0x4d')],{})[_0xc593('0x25')](function(_0x359ead){var _0x12dd23=_0x35dafb[_0xc593('0x4e')][_0xc593('0x27')]({'plain':!![]});if(!_0x12dd23)throw new Error(_0xc593('0x4f'));if(_0x12dd23[_0xc593('0x50')]==='user'){var _0x271f9f=_0x359ead[_0xc593('0x27')]({'plain':!![]});var _0x4a820e=_0xc593('0x28');return db['UserProfileSection'][_0xc593('0x4b')]({'where':{'name':_0x4a820e,'userProfileId':_0x12dd23[_0xc593('0x51')]},'raw':!![]})[_0xc593('0x25')](function(_0x12014c){if(_0x12014c&&_0x12014c[_0xc593('0x52')]===0x0){return db['UserProfileResource'][_0xc593('0x4c')]({'name':_0x271f9f[_0xc593('0x2d')],'resourceId':_0x271f9f['id'],'type':_0x12014c[_0xc593('0x2d')],'sectionId':_0x12014c['id']},{})[_0xc593('0x25')](function(){return _0x359ead;});}else{return _0x359ead;}})[_0xc593('0x45')](function(_0x3c59bd){logger[_0xc593('0x2b')](_0xc593('0x53'),_0x3c59bd);throw _0x3c59bd;});}return _0x359ead;})[_0xc593('0x25')](respondWithResult(_0x336879,0xc9))[_0xc593('0x45')](handleError(_0x336879,null));};exports[_0xc593('0x24')]=function(_0x3fffa2,_0x45ecfc){if(_0x3fffa2['body']['id']){delete _0x3fffa2['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x3fffa2[_0xc593('0x47')]['id']}})['then'](handleEntityNotFound(_0x45ecfc,null))['then'](saveUpdates(_0x3fffa2[_0xc593('0x4d')],null))[_0xc593('0x25')](respondWithResult(_0x45ecfc,null))['catch'](handleError(_0x45ecfc,null));};exports[_0xc593('0x26')]=function(_0x2fd6dc,_0x582f7d){return db[_0xc593('0x30')][_0xc593('0x4b')]({'where':{'id':_0x2fd6dc[_0xc593('0x47')]['id']}})[_0xc593('0x25')](handleEntityNotFound(_0x582f7d,null))[_0xc593('0x25')](removeEntity(_0x582f7d,null))[_0xc593('0x45')](handleError(_0x582f7d,null));};exports[_0xc593('0x31')]=function(_0x17bc0b,_0x50c100){return db[_0xc593('0x30')]['describe']()[_0xc593('0x25')](respondWithResult(_0x50c100,null))[_0xc593('0x45')](handleError(_0x50c100,null));};exports['addContacts']=function(_0x220c28,_0x1358de,_0x1c9a6a){return db['CmContact'][_0xc593('0x4b')]({'where':{'id':_0x220c28['params']['id']}})[_0xc593('0x25')](handleEntityNotFound(_0x1358de,null))[_0xc593('0x25')](function(_0x2659f5){if(_0x2659f5){return _0x2659f5[_0xc593('0x54')](_0x220c28[_0xc593('0x4d')][_0xc593('0x55')],_[_0xc593('0x56')](_0x220c28[_0xc593('0x4d')],['ids','id'])||{});}})[_0xc593('0x25')](respondWithResult(_0x1358de,null))[_0xc593('0x45')](handleError(_0x1358de,null));};exports[_0xc593('0x57')]=function(_0x582fe5,_0xeaed9f,_0x43130f){var _0x30293a={};var _0xe74ee7={};var _0x5aa131;var _0x19f26e;return db[_0xc593('0x30')][_0xc593('0x58')]({'where':{'id':_0x582fe5[_0xc593('0x47')]['id']}})[_0xc593('0x25')](handleEntityNotFound(_0xeaed9f,null))[_0xc593('0x25')](function(_0x27224a){if(_0x27224a){_0x5aa131=_0x27224a;_0xe74ee7[_0xc593('0x37')]=_[_0xc593('0x32')](db[_0xc593('0x59')]['rawAttributes']);_0xe74ee7['query']=_['keys'](_0x582fe5[_0xc593('0x33')]);_0xe74ee7[_0xc593('0x34')]=_[_0xc593('0x35')](_0xe74ee7['model'],_0xe74ee7['query']);_0x30293a['attributes']=_[_0xc593('0x35')](_0xe74ee7['model'],qs[_0xc593('0x38')](_0x582fe5[_0xc593('0x33')][_0xc593('0x38')]));_0x30293a[_0xc593('0x36')]=_0x30293a[_0xc593('0x36')]['length']?_0x30293a[_0xc593('0x36')]:_0xe74ee7[_0xc593('0x37')];_0x30293a[_0xc593('0x3b')]=qs[_0xc593('0x3c')](_0x582fe5[_0xc593('0x33')][_0xc593('0x3c')]);_0x30293a[_0xc593('0x3d')]=qs['filters'](_['pick'](_0x582fe5[_0xc593('0x33')],_0xe74ee7['filters']));if(_0x582fe5['query'][_0xc593('0x40')]){_0x30293a[_0xc593('0x3d')]=_['merge'](_0x30293a[_0xc593('0x3d')],{'$or':_['map'](_0x30293a['attributes'],function(_0x584b45){var _0x43a72c={};_0x43a72c[_0x584b45]={'$like':'%'+_0x582fe5[_0xc593('0x33')]['filter']+'%'};return _0x43a72c;})});}_0x30293a=_[_0xc593('0x3f')]({},_0x30293a,_0x582fe5[_0xc593('0x4a')]);return _0x5aa131[_0xc593('0x57')](_0x30293a);}})[_0xc593('0x25')](function(_0x2bfe61){if(_0x2bfe61){_0x19f26e=_0x2bfe61['length'];if(!_0x582fe5[_0xc593('0x33')][_0xc593('0x39')]('nolimit')){_0x30293a['limit']=qs[_0xc593('0x1e')](_0x582fe5[_0xc593('0x33')][_0xc593('0x1e')]);_0x30293a['offset']=qs[_0xc593('0x1d')](_0x582fe5[_0xc593('0x33')][_0xc593('0x1d')]);}return _0x5aa131[_0xc593('0x57')](_0x30293a);}})[_0xc593('0x25')](function(_0x4340af){if(_0x4340af){return _0x4340af?{'count':_0x19f26e,'rows':_0x4340af}:null;}})[_0xc593('0x25')](respondWithResult(_0xeaed9f,null))[_0xc593('0x45')](handleError(_0xeaed9f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c09afde..e66ce85 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 _0xa837=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xa837,0x10f));var _0x7a83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa837[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7a83('0x0'));var logger=require(_0x7a83('0x1'))(_0x7a83('0x2'));var moment=require(_0x7a83('0x3'));var BPromise=require(_0x7a83('0x4'));var rp=require(_0x7a83('0x5'));var fs=require('fs');var path=require(_0x7a83('0x6'));var rimraf=require(_0x7a83('0x7'));var config=require(_0x7a83('0x8'));var attributes=require(_0x7a83('0x9'));module[_0x7a83('0xa')]=function(_0x54171d,_0x40187e){return _0x54171d[_0x7a83('0xb')](_0x7a83('0xc'),attributes,{'tableName':_0x7a83('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a73=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','api'];(function(_0x31e794,_0x2c83e1){var _0xefee37=function(_0x1b17d5){while(--_0x1b17d5){_0x31e794['push'](_0x31e794['shift']());}};_0xefee37(++_0x2c83e1);}(_0x3a73,0xe8));var _0x33a7=function(_0x56e625,_0x315aa2){_0x56e625=_0x56e625-0x0;var _0x42d64f=_0x3a73[_0x56e625];return _0x42d64f;};'use strict';var _=require(_0x33a7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x33a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x33a7('0x2'));var rimraf=require(_0x33a7('0x3'));var config=require(_0x33a7('0x4'));var attributes=require(_0x33a7('0x5'));module[_0x33a7('0x6')]=function(_0x2a5f46,_0x5732b9){return _0x2a5f46[_0x33a7('0x7')](_0x33a7('0x8'),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 c495685..1a1a7cc 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 _0x5172=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x1fe869,_0x1478a7){var _0x460744=function(_0x119a35){while(--_0x119a35){_0x1fe869['push'](_0x1fe869['shift']());}};_0x460744(++_0x1478a7);}(_0x5172,0xfa));var _0x2517=function(_0x2eb295,_0x433288){_0x2eb295=_0x2eb295-0x0;var _0x46333e=_0x5172[_0x2eb295];return _0x46333e;};'use strict';var _=require('lodash');var util=require(_0x2517('0x0'));var moment=require(_0x2517('0x1'));var BPromise=require(_0x2517('0x2'));var rs=require(_0x2517('0x3'));var fs=require('fs');var Redis=require(_0x2517('0x4'));var db=require(_0x2517('0x5'))['db'];var utils=require(_0x2517('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2517('0x7'));var client=jayson[_0x2517('0x8')][_0x2517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534f6b,_0x34a0f3,_0xdc9016){return new BPromise(function(_0x351e80,_0x5da3f7){return client[_0x2517('0xa')](_0x534f6b,_0xdc9016)['then'](function(_0x4ef35f){logger[_0x2517('0xb')](_0x2517('0xc'),_0x34a0f3,_0x2517('0xd'));logger[_0x2517('0xe')](_0x2517('0xf'),_0x34a0f3,_0x2517('0xd'),JSON[_0x2517('0x10')](_0x4ef35f));if(_0x4ef35f['error']){if(_0x4ef35f[_0x2517('0x11')][_0x2517('0x12')]===0x1f4){logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4ef35f[_0x2517('0x11')][_0x2517('0x13')]);return _0x5da3f7(_0x4ef35f[_0x2517('0x11')]['message']);}logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4ef35f['error'][_0x2517('0x13')]);return _0x351e80(_0x4ef35f[_0x2517('0x11')][_0x2517('0x13')]);}else{logger[_0x2517('0xb')]('CmCompany,\x20%s,\x20%s',_0x34a0f3,_0x2517('0xd'));_0x351e80(_0x4ef35f[_0x2517('0x14')]['message']);}})['catch'](function(_0x4f402c){logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4f402c);_0x5da3f7(_0x4f402c);});});} \ No newline at end of file +var _0x86e5=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5bda9b,_0x5ea719){var _0x4c2a55=function(_0x73f642){while(--_0x73f642){_0x5bda9b['push'](_0x5bda9b['shift']());}};_0x4c2a55(++_0x5ea719);}(_0x86e5,0x6a));var _0x586e=function(_0x593f72,_0x24896f){_0x593f72=_0x593f72-0x0;var _0x27df1c=_0x86e5[_0x593f72];return _0x27df1c;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var moment=require(_0x586e('0x1'));var BPromise=require(_0x586e('0x2'));var rs=require(_0x586e('0x3'));var fs=require('fs');var Redis=require(_0x586e('0x4'));var db=require(_0x586e('0x5'))['db'];var utils=require(_0x586e('0x6'));var logger=require(_0x586e('0x7'))(_0x586e('0x8'));var config=require(_0x586e('0x9'));var jayson=require(_0x586e('0xa'));var client=jayson[_0x586e('0xb')][_0x586e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe378b6,_0x19d94d,_0xf7c4f7){return new BPromise(function(_0xe6ab13,_0x3d087f){return client[_0x586e('0xd')](_0xe378b6,_0xf7c4f7)[_0x586e('0xe')](function(_0x29df0a){logger[_0x586e('0xf')](_0x586e('0x10'),_0x19d94d,_0x586e('0x11'));logger[_0x586e('0x12')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x19d94d,_0x586e('0x11'),JSON[_0x586e('0x13')](_0x29df0a));if(_0x29df0a[_0x586e('0x14')]){if(_0x29df0a[_0x586e('0x14')][_0x586e('0x15')]===0x1f4){logger[_0x586e('0x14')](_0x586e('0x10'),_0x19d94d,_0x29df0a[_0x586e('0x14')][_0x586e('0x16')]);return _0x3d087f(_0x29df0a[_0x586e('0x14')]['message']);}logger[_0x586e('0x14')](_0x586e('0x10'),_0x19d94d,_0x29df0a[_0x586e('0x14')][_0x586e('0x16')]);return _0xe6ab13(_0x29df0a[_0x586e('0x14')][_0x586e('0x16')]);}else{logger[_0x586e('0xf')](_0x586e('0x10'),_0x19d94d,_0x586e('0x11'));_0xe6ab13(_0x29df0a[_0x586e('0x17')][_0x586e('0x16')]);}})[_0x586e('0x18')](function(_0x27b845){logger[_0x586e('0x14')](_0x586e('0x10'),_0x19d94d,_0x27b845);_0x3d087f(_0x27b845);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8d6606f..42dd848 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 _0x02fe=['get','isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0xae2add,_0x1c1106){var _0x1a512a=function(_0x1e739e){while(--_0x1e739e){_0xae2add['push'](_0xae2add['shift']());}};_0x1a512a(++_0x1c1106);}(_0x02fe,0x1b8));var _0xe02f=function(_0xf9cd7a,_0x343d80){_0xf9cd7a=_0xf9cd7a-0x0;var _0x234a09=_0x02fe[_0xf9cd7a];return _0x234a09;};'use strict';var multer=require('multer');var util=require(_0xe02f('0x0'));var path=require(_0xe02f('0x1'));var timeout=require(_0xe02f('0x2'));var express=require(_0xe02f('0x3'));var router=express[_0xe02f('0x4')]();var fs_extra=require(_0xe02f('0x5'));var auth=require(_0xe02f('0x6'));var interaction=require(_0xe02f('0x7'));var config=require(_0xe02f('0x8'));var controller=require(_0xe02f('0x9'));router[_0xe02f('0xa')]('/',auth[_0xe02f('0xb')](),controller[_0xe02f('0xc')]);router[_0xe02f('0xa')](_0xe02f('0xd'),auth[_0xe02f('0xb')](),controller['describe']);router[_0xe02f('0xa')]('/:id',auth[_0xe02f('0xb')](),controller[_0xe02f('0xe')]);router[_0xe02f('0xa')](_0xe02f('0xf'),auth['isAuthenticated'](),controller[_0xe02f('0x10')]);router[_0xe02f('0x11')]('/',auth[_0xe02f('0xb')](),controller[_0xe02f('0x12')]);router[_0xe02f('0x11')](_0xe02f('0xf'),auth['isAuthenticated'](),controller[_0xe02f('0x13')]);router[_0xe02f('0x14')](_0xe02f('0x15'),auth[_0xe02f('0xb')](),controller[_0xe02f('0x16')]);router['delete']('/:id',auth[_0xe02f('0xb')](),controller[_0xe02f('0x17')]);module[_0xe02f('0x18')]=router; \ No newline at end of file +var _0xbf16=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','addContacts','put','update','delete','exports','multer'];(function(_0x9a7d5b,_0x50327f){var _0xe2a5b3=function(_0x98ad8d){while(--_0x98ad8d){_0x9a7d5b['push'](_0x9a7d5b['shift']());}};_0xe2a5b3(++_0x50327f);}(_0xbf16,0x95));var _0x6bf1=function(_0x31893e,_0x47fc31){_0x31893e=_0x31893e-0x0;var _0x4ad29c=_0xbf16[_0x31893e];return _0x4ad29c;};'use strict';var multer=require(_0x6bf1('0x0'));var util=require(_0x6bf1('0x1'));var path=require(_0x6bf1('0x2'));var timeout=require(_0x6bf1('0x3'));var express=require(_0x6bf1('0x4'));var router=express[_0x6bf1('0x5')]();var fs_extra=require(_0x6bf1('0x6'));var auth=require(_0x6bf1('0x7'));var interaction=require(_0x6bf1('0x8'));var config=require(_0x6bf1('0x9'));var controller=require(_0x6bf1('0xa'));router[_0x6bf1('0xb')]('/',auth['isAuthenticated'](),controller[_0x6bf1('0xc')]);router['get'](_0x6bf1('0xd'),auth[_0x6bf1('0xe')](),controller[_0x6bf1('0xf')]);router[_0x6bf1('0xb')](_0x6bf1('0x10'),auth[_0x6bf1('0xe')](),controller[_0x6bf1('0x11')]);router[_0x6bf1('0xb')]('/:id/contacts',auth[_0x6bf1('0xe')](),controller['getContacts']);router[_0x6bf1('0x12')]('/',auth['isAuthenticated'](),controller[_0x6bf1('0x13')]);router['post']('/:id/contacts',auth[_0x6bf1('0xe')](),controller[_0x6bf1('0x14')]);router[_0x6bf1('0x15')](_0x6bf1('0x10'),auth[_0x6bf1('0xe')](),controller[_0x6bf1('0x16')]);router[_0x6bf1('0x17')](_0x6bf1('0x10'),auth[_0x6bf1('0xe')](),controller['destroy']);module[_0x6bf1('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7daa618..6d0e4f6 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 _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x2a34a9,_0x55e772){var _0x393119=function(_0x38f2fd){while(--_0x38f2fd){_0x2a34a9['push'](_0x2a34a9['shift']());}};_0x393119(++_0x55e772);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0x0b0e[_0x1df473];return _0x1bdd49;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb10b=['TEXT','INTEGER','UNSIGNED','DATE','lodash','exports','STRING'];(function(_0x51446b,_0x4723f8){var _0x50346c=function(_0x3993b4){while(--_0x3993b4){_0x51446b['push'](_0x51446b['shift']());}};_0x50346c(++_0x4723f8);}(_0xb10b,0x12a));var _0xbb10=function(_0x9ca21f,_0x437553){_0x9ca21f=_0x9ca21f-0x0;var _0x9ef54b=_0xb10b[_0x9ca21f];return _0x9ef54b;};'use strict';var _=require(_0xbb10('0x0'));var Sequelize=require('sequelize');module[_0xbb10('0x1')]={'firstName':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbb10('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xbb10('0x2')]},'city':{'type':Sequelize[_0xbb10('0x2')]},'country':{'type':Sequelize[_0xbb10('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbb10('0x2')]},'description':{'type':Sequelize[_0xbb10('0x3')]},'phone':{'type':Sequelize[_0xbb10('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbb10('0x2')]},'email':{'type':Sequelize[_0xbb10('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xbb10('0x2')]},'fb_data':{'type':Sequelize[_0xbb10('0x2')]},'twitter':{'type':Sequelize[_0xbb10('0x2')]},'skype':{'type':Sequelize[_0xbb10('0x2')]},'teams':{'type':Sequelize[_0xbb10('0x2')]},'viber':{'type':Sequelize[_0xbb10('0x2')]},'line':{'type':Sequelize[_0xbb10('0x2')]},'wechat':{'type':Sequelize[_0xbb10('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xbb10('0x4')](0x2)[_0xbb10('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbb10('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xbb10('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c93ae4e..be1a78f 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 _0xf330=['binding','fork','stringify','exit','error\x20child\x20process','getJourney','mail','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userSecondDisposition','UserId','fullname','alias','startCase','chat','Website','Account','closed','disposition','secondDisposition','thirdDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','all','flatten','sortBy','reverse','slice','moment','bluebird','util','lodash','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','limit','offset','count','set','Content-Range','update','then','sendStatus','name','send','index','CmContact','describe','keys','length','cf_','push','findOne','trimStart','fieldType','type','model','query','filters','intersection','attributes','fields','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','datetime','DATE','text','start','end','map','hasOwnProperty','isNil','Contact','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','filter','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','order','DESC','t.id\x20IN\x20?','agent','some','user','getLists','isEmpty','c.ListId\x20IS\x20NULL','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.email','c.ListId','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','tags','analytics','CmCustomField','findAll','columnName','displayName','custom','body','get','mergeWith','join','CmHopper','destroy','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','utcOffset','timezones','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','omit','format','cf_%d','params','pickBy','startsWith','table','cm_contacts','setFields','values','phone','getTags','rawAttributes','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperFinal','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','import','User','No\x20ListId\x20specified'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0xf330,0x160));var _0x0f33=function(_0x5b43ab,_0x38d0df){_0x5b43ab=_0x5b43ab-0x0;var _0x4cd58a=_0xf330[_0x5b43ab];return _0x4cd58a;};'use strict';var moment=require(_0x0f33('0x0'));var BPromise=require(_0x0f33('0x1'));var util=require(_0x0f33('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x0f33('0x3'));var squel=require(_0x0f33('0x4'));var Papa=require(_0x0f33('0x5'));var Redis=require('ioredis');var qs=require(_0x0f33('0x6'));var as=require(_0x0f33('0x7'));var logger=require(_0x0f33('0x8'))(_0x0f33('0x9'));var config=require('../../config/environment');var shared=require(_0x0f33('0xa'));var db=require(_0x0f33('0xb'))['db'];config[_0x0f33('0xc')]=_[_0x0f33('0xd')](config['redis'],{'host':_0x0f33('0xe'),'port':0x18eb});var socket=require(_0x0f33('0xf'))(new Redis(config[_0x0f33('0xc')]));require(_0x0f33('0x10'))[_0x0f33('0x11')](socket);function respondWithResult(_0x241363,_0x15bdfa){_0x15bdfa=_0x15bdfa||0xc8;return function(_0x2e9340){if(_0x2e9340){return _0x241363[_0x0f33('0x12')](_0x15bdfa)[_0x0f33('0x13')](_0x2e9340);}};}function respondWithFilteredResult(_0x24f4b0,_0x19f0e3){return function(_0x24f650){if(_0x24f650){var _0x289a5e=typeof _0x19f0e3['offset']===_0x0f33('0x14')&&typeof _0x19f0e3[_0x0f33('0x15')]===_0x0f33('0x14');var _0x2614cf=_0x24f650['count'];var _0x5393ed=_0x289a5e?0x0:_0x19f0e3[_0x0f33('0x16')];var _0x3de8d5=_0x289a5e?_0x24f650[_0x0f33('0x17')]:_0x19f0e3[_0x0f33('0x16')]+_0x19f0e3[_0x0f33('0x15')];var _0x12e7a0;if(_0x3de8d5>=_0x2614cf){_0x3de8d5=_0x2614cf;_0x12e7a0=0xc8;}else{_0x12e7a0=0xce;}_0x24f4b0[_0x0f33('0x12')](_0x12e7a0);return _0x24f4b0[_0x0f33('0x18')](_0x0f33('0x19'),_0x5393ed+'-'+_0x3de8d5+'/'+_0x2614cf)[_0x0f33('0x13')](_0x24f650);}return null;};}function saveUpdates(_0x463dd2){return function(_0xc970e0){if(_0xc970e0){return _0xc970e0[_0x0f33('0x1a')](_0x463dd2)[_0x0f33('0x1b')](function(_0x445279){return _0x445279;});}return null;};}function removeEntity(_0x326489){return function(_0x443958){if(_0x443958){return _0x443958['destroy']()['then'](function(){_0x326489[_0x0f33('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4ce6){return function(_0x21d02b){if(!_0x21d02b){_0x1e4ce6[_0x0f33('0x1c')](0x194);}return _0x21d02b;};}function handleError(_0x4dcaf7,_0x4260c5){_0x4260c5=_0x4260c5||0x1f4;return function(_0x282d15){logger['error'](_0x282d15['stack']);if(_0x282d15[_0x0f33('0x1d')]){delete _0x282d15[_0x0f33('0x1d')];}_0x4dcaf7[_0x0f33('0x12')](_0x4260c5)[_0x0f33('0x1e')](_0x282d15);};}exports[_0x0f33('0x1f')]=function(_0x36ca43,_0x55c4d5){var _0x2187de={},_0x20d589={},_0x4697e8={'count':0x0,'rows':[]};return db[_0x0f33('0x20')][_0x0f33('0x21')]()['then'](function(_0x3a35d1){var _0x49d54e=[];for(var _0xebaae9=0x0;_0xebaae90x1){_0x3e33fd['or'](_0x0f33('0x5b'),qs[_0x0f33('0x5c')](_0x1a4e47),null);}else{if(qs['isNumeric'](_0x1a4e47)){_0x3e33fd['or'](_0x0f33('0x5d'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x5e'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x5f'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x60'),_0x1a4e47+'%');}else if(qs[_0x0f33('0x61')](_0x1a4e47)){_0x3e33fd['or'](_0x0f33('0x62'),_0x1a4e47+'%');}else{_0x3e33fd['or'](_0x0f33('0x63'),'%'+_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x64'),'%'+_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x62'),'%'+_0x1a4e47+'%');}}}}_0x1a24c4[_0x0f33('0x31')](_0x3e33fd);_0x1a24c4[_0x0f33('0x65')](_0x0f33('0x66'));var _0x399266={'type':db[_0x0f33('0x67')][_0x0f33('0x68')]['SELECT'],'raw':!![]};var _0x314a16=_0x1a24c4[_0x0f33('0x69')]()['field'](_0x0f33('0x66'));if(_0x2187de[_0x0f33('0x6a')]){_0x2187de['order']['forEach'](function(_0x58ce05){_0x1a24c4['order']('c.'+_0x58ce05[0x0],_0x58ce05[0x1]===_0x0f33('0x6b')?![]:!![]);});}if(!_['isEmpty'](_0x49ef6d)){_0x1a24c4['having'](_0x85e904);_0x314a16[_0x0f33('0x31')](_0x0f33('0x6c'),_0x49ef6d);}BPromise['resolve']()[_0x0f33('0x1b')](function(){if(!_0x13a76e)return;if(_0x36ca43['user']['role']!==_0x0f33('0x6d'))return;if(!_[_0x0f33('0x6e')](_0x13a76e[_0x0f33('0x40')],[_0x0f33('0x34'),'User'])){return _0x36ca43[_0x0f33('0x6f')][_0x0f33('0x70')]({'attributes':['id'],'raw':!![]})[_0x0f33('0x1b')](function(_0x54f505){if(_[_0x0f33('0x71')](_0x54f505)){_0x314a16[_0x0f33('0x31')]('c.ListId\x20IS\x20NULL');_0x1a24c4['where'](_0x0f33('0x72'));}else{_0x314a16['where']('c.ListId\x20IN\x20?',_[_0x0f33('0x4c')](_0x54f505,'id'));_0x1a24c4['where'](_0x0f33('0x52'),_['map'](_0x54f505,'id'));}});}})['then'](function(){if(_0x36ca43[_0x0f33('0x6f')]['role']===_0x0f33('0x6d')&&!_0x13a76e&&!_0x36ca43[_0x0f33('0x2b')][_0x0f33('0x51')])return[];return db[_0x0f33('0x73')][_0x0f33('0x2b')](_0x314a16[_0x0f33('0x74')](),_0x399266);})[_0x0f33('0x1b')](function(_0x194990){_0x4697e8['count']=_0x194990[_0x0f33('0x23')];if(_0x4697e8[_0x0f33('0x17')]===0x0)return[];return db['sequelize'][_0x0f33('0x2b')](_0x3714ae[_0x0f33('0x74')](),_0x399266)['then'](function(_0x2a0d02){_0x3207f0=_['keyBy'](_0x2a0d02,'id');_0x399266=_[_0x0f33('0x75')](_0x399266,{'model':db[_0x0f33('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36ca43[_0x0f33('0x2b')][_0x0f33('0x2f')]){_0x2187de[_0x0f33('0x2e')][_0x0f33('0x50')](function(_0x58b941){_0x1a24c4[_0x0f33('0x34')]('c.'+_0x58b941);});}else{_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x66'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x76'));_0x1a24c4['field'](_0x0f33('0x77'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x78'));_0x1a24c4[_0x0f33('0x34')]('c.mobile');_0x1a24c4[_0x0f33('0x34')]('c.fax');_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x79'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7a'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7b'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7c'));_0x1a24c4['field']('c.CompanyId');_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7d'),_0x0f33('0x7e'));}if(_0x2187de[_0x0f33('0x15')])_0x1a24c4[_0x0f33('0x15')](_0x2187de[_0x0f33('0x15')]);if(_0x2187de['offset'])_0x1a24c4[_0x0f33('0x16')](_0x2187de[_0x0f33('0x16')]);return db[_0x0f33('0x73')]['query'](_0x1a24c4[_0x0f33('0x74')](),_0x399266);});})['then'](function(_0x76b97f){_0x76b97f[_0x0f33('0x50')](function(_0x4f9348){if(_0x4f9348[_0x0f33('0x7e')]){_0x4f9348[_0x0f33('0x7f')]=[];_0x4f9348['TagIds'][_0x0f33('0x5a')](',')['forEach'](function(_0x5afb7c){_0x4f9348['Tags'][_0x0f33('0x25')](_0x3207f0[_0x5afb7c]);});}delete _0x4f9348[_0x0f33('0x7e')];});_0x4697e8[_0x0f33('0x80')]=_0x76b97f;return _0x4697e8;})['then'](respondWithFilteredResult(_0x55c4d5,_0x2187de));})[_0x0f33('0x81')](handleError(_0x55c4d5,null));};exports['destroy']=function(_0x1047fa,_0x5d5752){return db[_0x0f33('0x20')][_0x0f33('0x82')]({'where':{'id':_0x1047fa['params']['id']}})[_0x0f33('0x1b')](handleEntityNotFound(_0x5d5752,null))[_0x0f33('0x1b')](removeEntity(_0x5d5752,null))['catch'](handleError(_0x5d5752,null));};exports[_0x0f33('0x21')]=function(_0x301105,_0x5d7f8b){return db[_0x0f33('0x20')][_0x0f33('0x21')]()[_0x0f33('0x1b')](function(_0x5c9105){delete _0x5c9105[_0x0f33('0x83')];for(var _0x4c96da=0x0;_0x4c96da=_0x4c7493){_0x504af6=_0x4c7493;_0x52fd5d=0xc8;}else{_0x52fd5d=0xce;}_0x3285d9[_0x163f('0x13')](_0x52fd5d);return _0x3285d9['set'](_0x163f('0x18'),_0x36039b+'-'+_0x504af6+'/'+_0x4c7493)[_0x163f('0x19')](_0x150074);}return null;};}function saveUpdates(_0x27b4b2){return function(_0x385e4c){if(_0x385e4c){return _0x385e4c[_0x163f('0x1a')](_0x27b4b2)['then'](function(_0x545946){return _0x545946;});}return null;};}function removeEntity(_0x11d761){return function(_0x749ba4){if(_0x749ba4){return _0x749ba4['destroy']()[_0x163f('0x1b')](function(){_0x11d761[_0x163f('0x13')](0xcc)[_0x163f('0x1c')]();});}};}function handleEntityNotFound(_0x5a713d){return function(_0x559202){if(!_0x559202){_0x5a713d[_0x163f('0x1d')](0x194);}return _0x559202;};}function handleError(_0x4ada88,_0x3fbfc1){_0x3fbfc1=_0x3fbfc1||0x1f4;return function(_0x1299ad){logger[_0x163f('0x1e')](_0x1299ad['stack']);if(_0x1299ad['name']){delete _0x1299ad['name'];}_0x4ada88[_0x163f('0x13')](_0x3fbfc1)[_0x163f('0x1f')](_0x1299ad);};}exports[_0x163f('0x20')]=function(_0x33ec2a,_0x185043){var _0x5bee02={},_0x4ca5d4={},_0x128e64={'count':0x0,'rows':[]};return db['CmContact'][_0x163f('0x21')]()[_0x163f('0x1b')](function(_0x1d2fd3){var _0x2573fc=[];for(var _0x5dc6f8=0x0;_0x5dc6f80x1){_0x577470['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x163f('0x61')](_0x50a7ec),null);}else{if(qs[_0x163f('0x62')](_0x50a7ec)){_0x577470['or']('c.id\x20LIKE\x20?',_0x50a7ec+'%');_0x577470['or'](_0x163f('0x63'),_0x50a7ec+'%');_0x577470['or']('c.mobile\x20LIKE\x20?',_0x50a7ec+'%');_0x577470['or'](_0x163f('0x64'),_0x50a7ec+'%');}else if(qs['isEmail'](_0x50a7ec)){_0x577470['or'](_0x163f('0x65'),_0x50a7ec+'%');}else{_0x577470['or'](_0x163f('0x66'),'%'+_0x50a7ec+'%');_0x577470['or'](_0x163f('0x67'),'%'+_0x50a7ec+'%');_0x577470['or']('c.email\x20LIKE\x20?','%'+_0x50a7ec+'%');}}}}_0x3aee46['where'](_0x577470);_0x3aee46['group'](_0x163f('0x68'));var _0x446911={'type':db[_0x163f('0x69')][_0x163f('0x6a')][_0x163f('0x6b')],'raw':!![]};var _0x262c37=_0x3aee46[_0x163f('0x6c')]()[_0x163f('0x38')](_0x163f('0x68'));if(_0x5bee02[_0x163f('0x35')]){_0x5bee02[_0x163f('0x35')]['forEach'](function(_0x582b4b){_0x3aee46[_0x163f('0x35')]('c.'+_0x582b4b[0x0],_0x582b4b[0x1]===_0x163f('0x6d')?![]:!![]);});}if(!_[_0x163f('0x5b')](_0x2eacef)){_0x3aee46[_0x163f('0x6e')](_0x4c94bf);_0x262c37[_0x163f('0x37')](_0x163f('0x6f'),_0x2eacef);}BPromise['resolve']()[_0x163f('0x1b')](function(){if(!_0x166082)return;if(_0x33ec2a[_0x163f('0x70')]['role']!==_0x163f('0x71'))return;if(!_[_0x163f('0x72')](_0x166082[_0x163f('0x48')],[_0x163f('0x38'),_0x163f('0x50')])){return _0x33ec2a[_0x163f('0x70')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0xa05ab5){if(_['isEmpty'](_0xa05ab5)){_0x262c37[_0x163f('0x37')](_0x163f('0x73'));_0x3aee46[_0x163f('0x37')]('c.ListId\x20IS\x20NULL');}else{_0x262c37[_0x163f('0x37')](_0x163f('0x5c'),_[_0x163f('0x4c')](_0xa05ab5,'id'));_0x3aee46[_0x163f('0x37')]('c.ListId\x20IN\x20?',_[_0x163f('0x4c')](_0xa05ab5,'id'));}});}})[_0x163f('0x1b')](function(){if(_0x33ec2a[_0x163f('0x70')]['role']===_0x163f('0x71')&&!_0x166082&&!_0x33ec2a['query'][_0x163f('0x74')])return[];return db[_0x163f('0x75')][_0x163f('0x2f')](_0x262c37[_0x163f('0x76')](),_0x446911);})[_0x163f('0x1b')](function(_0x596981){_0x128e64[_0x163f('0x17')]=_0x596981['length'];if(_0x128e64['count']===0x0)return[];return db['sequelize'][_0x163f('0x2f')](_0x56e530['toString'](),_0x446911)[_0x163f('0x1b')](function(_0x1ab764){_0x8fd182=_[_0x163f('0x77')](_0x1ab764,'id');_0x446911=_[_0x163f('0x78')](_0x446911,{'model':db[_0x163f('0x79')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x33ec2a['query'][_0x163f('0x32')]){_0x5bee02['attributes']['forEach'](function(_0x3d9042){_0x3aee46[_0x163f('0x38')]('c.'+_0x3d9042);});}else{_0x3aee46['field']('c.id');_0x3aee46[_0x163f('0x38')](_0x163f('0x7a'));_0x3aee46['field'](_0x163f('0x7b'));_0x3aee46[_0x163f('0x38')](_0x163f('0x7c'));_0x3aee46[_0x163f('0x38')](_0x163f('0x7d'));_0x3aee46[_0x163f('0x38')](_0x163f('0x7e'));_0x3aee46['field'](_0x163f('0x7f'));_0x3aee46[_0x163f('0x38')](_0x163f('0x80'));_0x3aee46[_0x163f('0x38')](_0x163f('0x81'));_0x3aee46[_0x163f('0x38')](_0x163f('0x82'));_0x3aee46[_0x163f('0x38')](_0x163f('0x83'));_0x3aee46[_0x163f('0x38')](_0x163f('0x84'),'TagIds');}if(_0x5bee02[_0x163f('0x16')])_0x3aee46[_0x163f('0x16')](_0x5bee02[_0x163f('0x16')]);if(_0x5bee02[_0x163f('0x14')])_0x3aee46[_0x163f('0x14')](_0x5bee02[_0x163f('0x14')]);return db[_0x163f('0x75')][_0x163f('0x2f')](_0x3aee46['toString'](),_0x446911);});})[_0x163f('0x1b')](function(_0x529674){_0x529674[_0x163f('0x4d')](function(_0x27c52c){if(_0x27c52c['TagIds']){_0x27c52c[_0x163f('0x85')]=[];_0x27c52c[_0x163f('0x86')]['split'](',')[_0x163f('0x4d')](function(_0xef5fcf){_0x27c52c[_0x163f('0x85')][_0x163f('0x25')](_0x8fd182[_0xef5fcf]);});}delete _0x27c52c[_0x163f('0x86')];});_0x128e64[_0x163f('0x87')]=_0x529674;return _0x128e64;})[_0x163f('0x1b')](respondWithFilteredResult(_0x185043,_0x5bee02));})[_0x163f('0x88')](handleError(_0x185043,null));};exports['destroy']=function(_0x25669d,_0x1f56e1){return db[_0x163f('0x79')][_0x163f('0x49')]({'where':{'id':_0x25669d[_0x163f('0x89')]['id']}})[_0x163f('0x1b')](handleEntityNotFound(_0x1f56e1,null))[_0x163f('0x1b')](removeEntity(_0x1f56e1,null))[_0x163f('0x88')](handleError(_0x1f56e1,null));};exports[_0x163f('0x21')]=function(_0x51e11e,_0x1a9707){return db[_0x163f('0x79')][_0x163f('0x21')]()[_0x163f('0x1b')](function(_0xbd9d42){delete _0xbd9d42[_0x163f('0x8a')];for(var _0x4b9436=0x0;_0x4b9436{}\s\\|]/g,'-');_0x2fecd6(null,util[_0x5e45('0x23')]('%s-%s%s',path[_0x5e45('0x24')](_0x38d8c0['originalname'],path[_0x5e45('0x25')](_0x38d8c0['originalname'])),Date[_0x5e45('0x26')](),path[_0x5e45('0x25')](_0x38d8c0[_0x5e45('0x21')])));}})});router[_0x5e45('0x19')](_0x5e45('0x27'),upload[_0x5e45('0x28')]('file'),controller[_0x5e45('0x29')]);var upload=multer({'storage':multer[_0x5e45('0x1e')]({'destination':function(_0x1fceeb,_0x5aa12b,_0x18ffb9){_0x18ffb9(null,path[_0x5e45('0x1f')](config[_0x5e45('0x20')],_0x5e45('0x2a')));},'filename':function(_0x4eee82,_0x399b51,_0x4ee3b9){_0x399b51['originalname']=_0x399b51['originalname'][_0x5e45('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ee3b9(null,util[_0x5e45('0x23')](_0x5e45('0x2b'),path[_0x5e45('0x24')](_0x399b51[_0x5e45('0x21')],path[_0x5e45('0x25')](_0x399b51[_0x5e45('0x21')])),Date[_0x5e45('0x26')](),path[_0x5e45('0x25')](_0x399b51[_0x5e45('0x21')])));}})});router[_0x5e45('0x19')](_0x5e45('0x2c'),upload[_0x5e45('0x28')](_0x5e45('0x2d')),controller[_0x5e45('0x2e')]);router['post'](_0x5e45('0x2f'),auth['isAuthenticated'](),controller[_0x5e45('0x30')]);router[_0x5e45('0x31')](_0x5e45('0xd'),auth[_0x5e45('0xa')](),controller[_0x5e45('0x32')]);router[_0x5e45('0x33')](_0x5e45('0xd'),auth['isAuthenticated'](),controller[_0x5e45('0x34')]);module[_0x5e45('0x35')]=router; \ No newline at end of file +var _0xa049=['update','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/jscripty_sessions','getJscriptySessions','getJourney','/merge','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','root','originalname','replace','format','%s-%s%s','extname','/csv','file','uploadCsv','join','server/files/tmp','basename','now','/upload','single','upload','/upload/:id','put','/:id'];(function(_0x3d82bb,_0x3d4263){var _0x361eca=function(_0x599064){while(--_0x599064){_0x3d82bb['push'](_0x3d82bb['shift']());}};_0x361eca(++_0x3d4263);}(_0xa049,0xce));var _0x9a04=function(_0x33adeb,_0x2a9393){_0x33adeb=_0x33adeb-0x0;var _0x579bed=_0xa049[_0x33adeb];return _0x579bed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a04('0x0'));var timeout=require(_0x9a04('0x1'));var express=require(_0x9a04('0x2'));var router=express['Router']();var fs_extra=require(_0x9a04('0x3'));var auth=require(_0x9a04('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9a04('0x5'));var controller=require(_0x9a04('0x6'));router[_0x9a04('0x7')]('/',auth[_0x9a04('0x8')](),controller[_0x9a04('0x9')]);router[_0x9a04('0x7')](_0x9a04('0xa'),auth['isAuthenticated'](),controller[_0x9a04('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9a04('0xc')]);router[_0x9a04('0x7')](_0x9a04('0xd'),auth[_0x9a04('0x8')](),controller[_0x9a04('0xe')]);router['get'](_0x9a04('0xf'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x10')]);router['get'](_0x9a04('0x11'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x12')]);router[_0x9a04('0x7')]('/:id/hopper_finals',auth[_0x9a04('0x8')](),controller['getHopperFinals']);router[_0x9a04('0x7')](_0x9a04('0x13'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x14')]);router[_0x9a04('0x7')]('/:id/journey',auth['isAuthenticated'](),controller[_0x9a04('0x15')]);router['post'](_0x9a04('0x16'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x17')]);router[_0x9a04('0x18')]('/',auth['isAuthenticated'](),controller[_0x9a04('0x19')]);router[_0x9a04('0x18')](_0x9a04('0x1a'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x1b')]);router[_0x9a04('0x18')](_0x9a04('0xd'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x1c')]);var upload=multer({'storage':multer[_0x9a04('0x1d')]({'destination':function(_0x3c46e5,_0x1621d8,_0x3b292d){_0x3b292d(null,path['join'](config[_0x9a04('0x1e')],'server/files/tmp'));},'filename':function(_0x20d78f,_0x5d3219,_0x18ebb5){_0x5d3219[_0x9a04('0x1f')]=_0x5d3219[_0x9a04('0x1f')][_0x9a04('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x18ebb5(null,util[_0x9a04('0x21')](_0x9a04('0x22'),path['basename'](_0x5d3219[_0x9a04('0x1f')],path[_0x9a04('0x23')](_0x5d3219['originalname'])),Date['now'](),path[_0x9a04('0x23')](_0x5d3219[_0x9a04('0x1f')])));}})});router[_0x9a04('0x18')](_0x9a04('0x24'),upload['single'](_0x9a04('0x25')),controller[_0x9a04('0x26')]);var upload=multer({'storage':multer[_0x9a04('0x1d')]({'destination':function(_0x59eb1f,_0x50a1bb,_0x1ea65c){_0x1ea65c(null,path[_0x9a04('0x27')](config[_0x9a04('0x1e')],_0x9a04('0x28')));},'filename':function(_0x2ad3e6,_0x4c2efd,_0x585204){_0x4c2efd[_0x9a04('0x1f')]=_0x4c2efd[_0x9a04('0x1f')][_0x9a04('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x585204(null,util[_0x9a04('0x21')](_0x9a04('0x22'),path[_0x9a04('0x29')](_0x4c2efd[_0x9a04('0x1f')],path['extname'](_0x4c2efd[_0x9a04('0x1f')])),Date[_0x9a04('0x2a')](),path['extname'](_0x4c2efd[_0x9a04('0x1f')])));}})});router[_0x9a04('0x18')](_0x9a04('0x2b'),upload[_0x9a04('0x2c')](_0x9a04('0x25')),controller[_0x9a04('0x2d')]);router[_0x9a04('0x18')](_0x9a04('0x2e'),auth['isAuthenticated'](),controller['import']);router[_0x9a04('0x2f')](_0x9a04('0x30'),auth[_0x9a04('0x8')](),controller[_0x9a04('0x31')]);router[_0x9a04('0x32')](_0x9a04('0x30'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5e1d00f..30d4e34 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 _0xceb6=['isArray','setDataValue','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type','select','parse'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xceb6,0x137));var _0x6ceb=function(_0x92ba74,_0x5798db){_0x92ba74=_0x92ba74-0x0;var _0x9fa6ea=_0xceb6[_0x92ba74];return _0x9fa6ea;};'use strict';var Sequelize=require(_0x6ceb('0x0'));var _=require(_0x6ceb('0x1'));module[_0x6ceb('0x2')]={'name':{'type':Sequelize[_0x6ceb('0x3')],'get':function(_0xcddf32){return this[_0x6ceb('0x4')](_0x6ceb('0x5'));}},'alias':{'type':Sequelize[_0x6ceb('0x6')],'allowNull':![],'set':function(_0x40f182){this['setDataValue']('alias',_0x40f182?_0x40f182:this['getDataValue'](_0x6ceb('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6ceb('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x6ceb('0x9'))===_0x6ceb('0xa')){return JSON[_0x6ceb('0xb')](this['getDataValue']('values'));}else{return this[_0x6ceb('0x4')]('values');}},'set':function(_0xc84810){if(Array[_0x6ceb('0xc')](_0xc84810)){this[_0x6ceb('0xd')](_0x6ceb('0xe'),JSON[_0x6ceb('0xf')](_0xc84810));}else{this[_0x6ceb('0xd')](_0x6ceb('0xe'),_0xc84810);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6ceb('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6ceb('0x11')](_0x6ceb('0x12'))}}; \ No newline at end of file +var _0x53ff=['stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','long','values'];(function(_0x52f9e0,_0x19bef6){var _0x284efb=function(_0x173aef){while(--_0x173aef){_0x52f9e0['push'](_0x52f9e0['shift']());}};_0x284efb(++_0x19bef6);}(_0x53ff,0x145));var _0xf53f=function(_0x383a00,_0x1dcecf){_0x383a00=_0x383a00-0x0;var _0x582a75=_0x53ff[_0x383a00];return _0x582a75;};'use strict';var Sequelize=require(_0xf53f('0x0'));var _=require(_0xf53f('0x1'));module[_0xf53f('0x2')]={'name':{'type':Sequelize[_0xf53f('0x3')],'get':function(_0x13d601){return this[_0xf53f('0x4')](_0xf53f('0x5'));}},'alias':{'type':Sequelize[_0xf53f('0x6')],'allowNull':![],'set':function(_0x504a7c){this[_0xf53f('0x7')](_0xf53f('0x5'),_0x504a7c?_0x504a7c:this['getDataValue']('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xf53f('0x8')](_0xf53f('0x9')),'get':function(){if(this[_0xf53f('0x4')]('type')==='select'){return JSON['parse'](this[_0xf53f('0x4')](_0xf53f('0xa')));}else{return this['getDataValue'](_0xf53f('0xa'));}},'set':function(_0x35e853){if(Array['isArray'](_0x35e853)){this[_0xf53f('0x7')]('values',JSON[_0xf53f('0xb')](_0x35e853));}else{this[_0xf53f('0x7')](_0xf53f('0xa'),_0x35e853);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf53f('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xf53f('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 7c89a74..4c2f356 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 _0x2630=['destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','length','include','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','addColumn','cm_contacts','format','cf_%d','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then'];(function(_0x529727,_0xf7211d){var _0x51de61=function(_0x52c6df){while(--_0x52c6df){_0x529727['push'](_0x529727['shift']());}};_0x51de61(++_0xf7211d);}(_0x2630,0x187));var _0x0263=function(_0x1d44f4,_0x54f648){_0x1d44f4=_0x1d44f4-0x0;var _0x2f7ecf=_0x2630[_0x1d44f4];return _0x2f7ecf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0263('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0263('0x1'));var moment=require(_0x0263('0x2'));var BPromise=require(_0x0263('0x3'));var Mustache=require(_0x0263('0x4'));var util=require(_0x0263('0x5'));var path=require('path');var sox=require(_0x0263('0x6'));var csv=require(_0x0263('0x7'));var ejs=require(_0x0263('0x8'));var fs=require('fs');var fs_extra=require(_0x0263('0x9'));var _=require(_0x0263('0xa'));var squel=require('squel');var crypto=require(_0x0263('0xb'));var jsforce=require(_0x0263('0xc'));var deskjs=require(_0x0263('0xd'));var toCsv=require(_0x0263('0x7'));var querystring=require(_0x0263('0xe'));var Papa=require(_0x0263('0xf'));var Redis=require(_0x0263('0x10'));var authService=require(_0x0263('0x11'));var qs=require(_0x0263('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0263('0x13'));var utils=require('../../config/utils');var config=require(_0x0263('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0263('0x15'))['db'];function respondWithStatusCode(_0x306f24,_0x217698){_0x217698=_0x217698||0xcc;return function(_0xf4e15e){if(_0xf4e15e){return _0x306f24['sendStatus'](_0x217698);}return _0x306f24[_0x0263('0x16')](_0x217698)[_0x0263('0x17')]();};}function respondWithResult(_0x35949e,_0x3c9979){_0x3c9979=_0x3c9979||0xc8;return function(_0x1ad0f7){if(_0x1ad0f7){return _0x35949e['status'](_0x3c9979)['json'](_0x1ad0f7);}};}function respondWithFilteredResult(_0x2c4dba,_0x24063b){return function(_0xf32ce9){if(_0xf32ce9){var _0x25230e=typeof _0x24063b[_0x0263('0x18')]===_0x0263('0x19')&&typeof _0x24063b[_0x0263('0x1a')]===_0x0263('0x19');var _0x25cfbe=_0xf32ce9[_0x0263('0x1b')];var _0x144551=_0x25230e?0x0:_0x24063b[_0x0263('0x18')];var _0x2c7e90=_0x25230e?_0xf32ce9[_0x0263('0x1b')]:_0x24063b[_0x0263('0x18')]+_0x24063b['limit'];var _0x15dc89;if(_0x2c7e90>=_0x25cfbe){_0x2c7e90=_0x25cfbe;_0x15dc89=0xc8;}else{_0x15dc89=0xce;}_0x2c4dba[_0x0263('0x16')](_0x15dc89);return _0x2c4dba[_0x0263('0x1c')]('Content-Range',_0x144551+'-'+_0x2c7e90+'/'+_0x25cfbe)[_0x0263('0x1d')](_0xf32ce9);}return null;};}function patchUpdates(_0x4ce22b){return function(_0x2c6d2b){try{jsonpatch['apply'](_0x2c6d2b,_0x4ce22b,!![]);}catch(_0x2cb4f5){return BPromise[_0x0263('0x1e')](_0x2cb4f5);}return _0x2c6d2b[_0x0263('0x1f')]();};}function saveUpdates(_0x4f9757,_0x4a143d){return function(_0x69a875){if(_0x69a875){return _0x69a875[_0x0263('0x20')](_0x4f9757)[_0x0263('0x21')](function(_0x2b72ab){return _0x2b72ab;});}return null;};}function removeEntity(_0x146be3,_0x33b3d5){return function(_0x518918){if(_0x518918){return _0x518918[_0x0263('0x22')]()[_0x0263('0x21')](function(){_0x146be3[_0x0263('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c487,_0x235d90){return function(_0x425cb3){if(!_0x425cb3){_0x52c487[_0x0263('0x23')](0x194);}return _0x425cb3;};}function handleError(_0x1dee11,_0x237c61){_0x237c61=_0x237c61||0x1f4;return function(_0x1cadf3){logger[_0x0263('0x24')](_0x1cadf3[_0x0263('0x25')]);if(_0x1cadf3[_0x0263('0x26')]){delete _0x1cadf3[_0x0263('0x26')];}_0x1dee11[_0x0263('0x16')](_0x237c61)[_0x0263('0x27')](_0x1cadf3);};}exports[_0x0263('0x28')]=function(_0x1b81ce,_0x54d475){var _0x11b54d={},_0x441609={},_0x81d1af={'count':0x0,'rows':[]};var _0x4d15b8=_[_0x0263('0x29')](db[_0x0263('0x2a')]['rawAttributes'],function(_0x2a82bd){return{'name':_0x2a82bd[_0x0263('0x2b')],'type':_0x2a82bd[_0x0263('0x2c')][_0x0263('0x2d')]};});_0x441609[_0x0263('0x2e')]=_[_0x0263('0x2f')](_[_0x0263('0x29')](_0x4d15b8,_0x0263('0x26')),['name']);_0x441609[_0x0263('0x30')]=_['keys'](_0x1b81ce['query']);_0x441609['filters']=_[_0x0263('0x31')](_0x441609[_0x0263('0x2e')],_0x441609[_0x0263('0x30')]);_0x11b54d[_0x0263('0x32')]=_[_0x0263('0x31')](_0x441609[_0x0263('0x2e')],qs[_0x0263('0x33')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x33')]));_0x11b54d['attributes']=_0x11b54d[_0x0263('0x32')]['length']?_0x11b54d[_0x0263('0x32')]:_0x441609[_0x0263('0x2e')];if(!_0x1b81ce['query'][_0x0263('0x34')]('nolimit')){_0x11b54d['limit']=qs[_0x0263('0x1a')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x1a')]);_0x11b54d['offset']=qs[_0x0263('0x18')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x18')]);}_0x11b54d[_0x0263('0x35')]=qs[_0x0263('0x36')](_0x1b81ce['query'][_0x0263('0x36')]);_0x11b54d['where']=qs[_0x0263('0x37')](_[_0x0263('0x38')](_0x1b81ce[_0x0263('0x30')],_0x441609[_0x0263('0x37')]),_0x4d15b8);if(_0x1b81ce[_0x0263('0x30')]['filter']){_0x11b54d[_0x0263('0x39')]=_['merge'](_0x11b54d[_0x0263('0x39')],{'$or':_[_0x0263('0x29')](_0x4d15b8,function(_0x258124){if(_0x258124[_0x0263('0x2c')]!=='VIRTUAL'){var _0x21935d={};_0x21935d[_0x258124[_0x0263('0x26')]]={'$like':'%'+_0x1b81ce['query']['filter']+'%'};return _0x21935d;}})});}_0x11b54d=_[_0x0263('0x3a')]({},_0x11b54d,_0x1b81ce[_0x0263('0x3b')]);var _0x5db5c2={'where':_0x11b54d[_0x0263('0x39')]};return db[_0x0263('0x2a')][_0x0263('0x1b')](_0x5db5c2)['then'](function(_0x4a4651){_0x81d1af['count']=_0x4a4651;if(_0x1b81ce[_0x0263('0x30')][_0x0263('0x3c')]){_0x11b54d['include']=[{'all':!![]}];}return db[_0x0263('0x2a')][_0x0263('0x3d')](_0x11b54d);})[_0x0263('0x21')](function(_0x955449){_0x81d1af[_0x0263('0x3e')]=_0x955449;return _0x81d1af;})[_0x0263('0x21')](respondWithFilteredResult(_0x54d475,_0x11b54d))['catch'](handleError(_0x54d475,null));};exports[_0x0263('0x3f')]=function(_0x171c22,_0x44cecc){var _0x476521={'raw':!![],'where':{'id':_0x171c22[_0x0263('0x40')]['id']}},_0x582621={};_0x582621[_0x0263('0x2e')]=_[_0x0263('0x41')](db[_0x0263('0x2a')][_0x0263('0x42')]);_0x582621[_0x0263('0x30')]=_[_0x0263('0x41')](_0x171c22[_0x0263('0x30')]);_0x582621['filters']=_[_0x0263('0x31')](_0x582621['model'],_0x582621[_0x0263('0x30')]);_0x476521[_0x0263('0x32')]=_[_0x0263('0x31')](_0x582621[_0x0263('0x2e')],qs[_0x0263('0x33')](_0x171c22[_0x0263('0x30')]['fields']));_0x476521[_0x0263('0x32')]=_0x476521[_0x0263('0x32')][_0x0263('0x43')]?_0x476521[_0x0263('0x32')]:_0x582621['model'];if(_0x171c22[_0x0263('0x30')]['includeAll']){_0x476521[_0x0263('0x44')]=[{'all':!![]}];}_0x476521=_[_0x0263('0x3a')]({},_0x476521,_0x171c22['options']);return db[_0x0263('0x2a')][_0x0263('0x45')](_0x476521)[_0x0263('0x21')](handleEntityNotFound(_0x44cecc,null))['then'](respondWithResult(_0x44cecc,null))[_0x0263('0x46')](handleError(_0x44cecc,null));};exports[_0x0263('0x20')]=function(_0x34aff9,_0x1af99b){if(_0x34aff9[_0x0263('0x47')]['id']){delete _0x34aff9['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x34aff9[_0x0263('0x40')]['id']}})[_0x0263('0x21')](handleEntityNotFound(_0x1af99b,null))[_0x0263('0x21')](saveUpdates(_0x34aff9['body'],null))[_0x0263('0x21')](respondWithResult(_0x1af99b,null))[_0x0263('0x46')](handleError(_0x1af99b,null));};exports[_0x0263('0x22')]=function(_0x34f43f,_0x3183a8){return db[_0x0263('0x2a')][_0x0263('0x45')]({'where':{'id':_0x34f43f[_0x0263('0x40')]['id']}})[_0x0263('0x21')](handleEntityNotFound(_0x3183a8,null))['then'](removeEntity(_0x3183a8,null))[_0x0263('0x46')](handleError(_0x3183a8,null));};exports[_0x0263('0x48')]=function(_0x1ef2dc,_0x77920e){var _0x6a4dac;return db[_0x0263('0x49')][_0x0263('0x4a')](function(_0x2c42d9){return db[_0x0263('0x2a')]['create'](_0x1ef2dc['body'],{'transaction':_0x2c42d9})[_0x0263('0x21')](function(_0x12035b){_0x6a4dac=_0x12035b;var _0x5796db={'type':db[_0x0263('0x4b')][_0x0263('0x4c')],'transaction':_0x2c42d9};switch(_0x1ef2dc[_0x0263('0x47')][_0x0263('0x2c')]){case _0x0263('0x4d'):_0x5796db[_0x0263('0x2c')]=db[_0x0263('0x4b')]['TEXT'];break;case _0x0263('0x4e'):_0x5796db['type']=db[_0x0263('0x4b')][_0x0263('0x4f')];break;case'switch':_0x5796db[_0x0263('0x2c')]=db[_0x0263('0x4b')]['BOOLEAN'];_0x5796db[_0x0263('0x50')]=![];break;default:}return db[_0x0263('0x49')]['queryInterface'][_0x0263('0x51')](_0x0263('0x52'),util[_0x0263('0x53')](_0x0263('0x54'),_0x6a4dac['id']),_0x5796db);})[_0x0263('0x21')](function(){return _0x6a4dac;});})[_0x0263('0x21')](respondWithResult(_0x77920e,0xc9))[_0x0263('0x46')](handleError(_0x77920e,null));}; \ No newline at end of file +var _0xbaf2=['end','undefined','limit','offset','count','Content-Range','apply','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','CmCustomField','includeAll','findAll','rows','show','params','length','find','catch','update','create','transaction','Sequelize','body','INTEGER','switch','BOOLEAN','defaultValue','sequelize','format','cf_%d','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0xbaf2,0x1c3));var _0x2baf=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xbaf2[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x2baf('0x0'));var rimraf=require(_0x2baf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2baf('0x2'));var moment=require(_0x2baf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2baf('0x4'));var util=require(_0x2baf('0x5'));var path=require('path');var sox=require(_0x2baf('0x6'));var csv=require(_0x2baf('0x7'));var ejs=require(_0x2baf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2baf('0x9'));var squel=require('squel');var crypto=require(_0x2baf('0xa'));var jsforce=require(_0x2baf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2baf('0x7'));var querystring=require(_0x2baf('0xc'));var Papa=require(_0x2baf('0xd'));var Redis=require(_0x2baf('0xe'));var authService=require(_0x2baf('0xf'));var qs=require(_0x2baf('0x10'));var as=require(_0x2baf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2baf('0x12'))(_0x2baf('0x13'));var utils=require(_0x2baf('0x14'));var config=require(_0x2baf('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2b9d,_0x2a03e0){_0x2a03e0=_0x2a03e0||0xcc;return function(_0x1e5a08){if(_0x1e5a08){return _0x3d2b9d['sendStatus'](_0x2a03e0);}return _0x3d2b9d[_0x2baf('0x16')](_0x2a03e0)[_0x2baf('0x17')]();};}function respondWithResult(_0x4e6570,_0x1b2189){_0x1b2189=_0x1b2189||0xc8;return function(_0x13f0ce){if(_0x13f0ce){return _0x4e6570[_0x2baf('0x16')](_0x1b2189)['json'](_0x13f0ce);}};}function respondWithFilteredResult(_0x1bfdaf,_0x304169){return function(_0x17cbf9){if(_0x17cbf9){var _0x6e9866=typeof _0x304169['offset']===_0x2baf('0x18')&&typeof _0x304169[_0x2baf('0x19')]===_0x2baf('0x18');var _0x3ff113=_0x17cbf9['count'];var _0xb670d3=_0x6e9866?0x0:_0x304169[_0x2baf('0x1a')];var _0x147467=_0x6e9866?_0x17cbf9[_0x2baf('0x1b')]:_0x304169[_0x2baf('0x1a')]+_0x304169[_0x2baf('0x19')];var _0xf48bf3;if(_0x147467>=_0x3ff113){_0x147467=_0x3ff113;_0xf48bf3=0xc8;}else{_0xf48bf3=0xce;}_0x1bfdaf[_0x2baf('0x16')](_0xf48bf3);return _0x1bfdaf['set'](_0x2baf('0x1c'),_0xb670d3+'-'+_0x147467+'/'+_0x3ff113)['json'](_0x17cbf9);}return null;};}function patchUpdates(_0x5e1eb1){return function(_0xc945){try{jsonpatch[_0x2baf('0x1d')](_0xc945,_0x5e1eb1,!![]);}catch(_0x330245){return BPromise['reject'](_0x330245);}return _0xc945[_0x2baf('0x1e')]();};}function saveUpdates(_0x597c56,_0x15c3ac){return function(_0x514dc7){if(_0x514dc7){return _0x514dc7['update'](_0x597c56)[_0x2baf('0x1f')](function(_0x502bff){return _0x502bff;});}return null;};}function removeEntity(_0x2efea2,_0x544986){return function(_0x231986){if(_0x231986){return _0x231986[_0x2baf('0x20')]()[_0x2baf('0x1f')](function(){_0x2efea2[_0x2baf('0x16')](0xcc)[_0x2baf('0x17')]();});}};}function handleEntityNotFound(_0x16bd66,_0x5460a3){return function(_0x54cb35){if(!_0x54cb35){_0x16bd66['sendStatus'](0x194);}return _0x54cb35;};}function handleError(_0x58e781,_0x3ec74e){_0x3ec74e=_0x3ec74e||0x1f4;return function(_0xe9258a){logger[_0x2baf('0x21')](_0xe9258a['stack']);if(_0xe9258a[_0x2baf('0x22')]){delete _0xe9258a[_0x2baf('0x22')];}_0x58e781[_0x2baf('0x16')](_0x3ec74e)[_0x2baf('0x23')](_0xe9258a);};}exports[_0x2baf('0x24')]=function(_0x5b4d32,_0x444e07){var _0x3f27c0={},_0x12a8aa={},_0x712d33={'count':0x0,'rows':[]};var _0x458a6f=_[_0x2baf('0x25')](db['CmCustomField'][_0x2baf('0x26')],function(_0x29a70e){return{'name':_0x29a70e[_0x2baf('0x27')],'type':_0x29a70e[_0x2baf('0x28')][_0x2baf('0x29')]};});_0x12a8aa['model']=_['differenceBy'](_[_0x2baf('0x25')](_0x458a6f,_0x2baf('0x22')),[_0x2baf('0x22')]);_0x12a8aa[_0x2baf('0x2a')]=_[_0x2baf('0x2b')](_0x5b4d32[_0x2baf('0x2a')]);_0x12a8aa[_0x2baf('0x2c')]=_[_0x2baf('0x2d')](_0x12a8aa[_0x2baf('0x2e')],_0x12a8aa[_0x2baf('0x2a')]);_0x3f27c0[_0x2baf('0x2f')]=_[_0x2baf('0x2d')](_0x12a8aa[_0x2baf('0x2e')],qs[_0x2baf('0x30')](_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x30')]));_0x3f27c0[_0x2baf('0x2f')]=_0x3f27c0[_0x2baf('0x2f')]['length']?_0x3f27c0[_0x2baf('0x2f')]:_0x12a8aa[_0x2baf('0x2e')];if(!_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x31')]('nolimit')){_0x3f27c0[_0x2baf('0x19')]=qs[_0x2baf('0x19')](_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x19')]);_0x3f27c0['offset']=qs[_0x2baf('0x1a')](_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x1a')]);}_0x3f27c0[_0x2baf('0x32')]=qs[_0x2baf('0x33')](_0x5b4d32[_0x2baf('0x2a')]['sort']);_0x3f27c0['where']=qs[_0x2baf('0x2c')](_[_0x2baf('0x34')](_0x5b4d32[_0x2baf('0x2a')],_0x12a8aa['filters']),_0x458a6f);if(_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x35')]){_0x3f27c0[_0x2baf('0x36')]=_['merge'](_0x3f27c0[_0x2baf('0x36')],{'$or':_[_0x2baf('0x25')](_0x458a6f,function(_0x2498db){if(_0x2498db['type']!==_0x2baf('0x37')){var _0x334c82={};_0x334c82[_0x2498db[_0x2baf('0x22')]]={'$like':'%'+_0x5b4d32[_0x2baf('0x2a')][_0x2baf('0x35')]+'%'};return _0x334c82;}})});}_0x3f27c0=_[_0x2baf('0x38')]({},_0x3f27c0,_0x5b4d32[_0x2baf('0x39')]);var _0x1d6a28={'where':_0x3f27c0[_0x2baf('0x36')]};return db[_0x2baf('0x3a')][_0x2baf('0x1b')](_0x1d6a28)[_0x2baf('0x1f')](function(_0x2693de){_0x712d33['count']=_0x2693de;if(_0x5b4d32['query'][_0x2baf('0x3b')]){_0x3f27c0['include']=[{'all':!![]}];}return db[_0x2baf('0x3a')][_0x2baf('0x3c')](_0x3f27c0);})['then'](function(_0x174563){_0x712d33[_0x2baf('0x3d')]=_0x174563;return _0x712d33;})[_0x2baf('0x1f')](respondWithFilteredResult(_0x444e07,_0x3f27c0))['catch'](handleError(_0x444e07,null));};exports[_0x2baf('0x3e')]=function(_0x6e5d47,_0x1ea6fd){var _0x4d2690={'raw':!![],'where':{'id':_0x6e5d47[_0x2baf('0x3f')]['id']}},_0x3d1135={};_0x3d1135['model']=_[_0x2baf('0x2b')](db[_0x2baf('0x3a')][_0x2baf('0x26')]);_0x3d1135[_0x2baf('0x2a')]=_[_0x2baf('0x2b')](_0x6e5d47[_0x2baf('0x2a')]);_0x3d1135[_0x2baf('0x2c')]=_[_0x2baf('0x2d')](_0x3d1135[_0x2baf('0x2e')],_0x3d1135[_0x2baf('0x2a')]);_0x4d2690[_0x2baf('0x2f')]=_[_0x2baf('0x2d')](_0x3d1135[_0x2baf('0x2e')],qs[_0x2baf('0x30')](_0x6e5d47['query'][_0x2baf('0x30')]));_0x4d2690['attributes']=_0x4d2690['attributes'][_0x2baf('0x40')]?_0x4d2690['attributes']:_0x3d1135[_0x2baf('0x2e')];if(_0x6e5d47[_0x2baf('0x2a')]['includeAll']){_0x4d2690['include']=[{'all':!![]}];}_0x4d2690=_[_0x2baf('0x38')]({},_0x4d2690,_0x6e5d47[_0x2baf('0x39')]);return db[_0x2baf('0x3a')][_0x2baf('0x41')](_0x4d2690)[_0x2baf('0x1f')](handleEntityNotFound(_0x1ea6fd,null))[_0x2baf('0x1f')](respondWithResult(_0x1ea6fd,null))[_0x2baf('0x42')](handleError(_0x1ea6fd,null));};exports[_0x2baf('0x43')]=function(_0x35ca70,_0x432df3){if(_0x35ca70['body']['id']){delete _0x35ca70['body']['id'];}return db[_0x2baf('0x3a')]['find']({'where':{'id':_0x35ca70[_0x2baf('0x3f')]['id']}})[_0x2baf('0x1f')](handleEntityNotFound(_0x432df3,null))[_0x2baf('0x1f')](saveUpdates(_0x35ca70['body'],null))['then'](respondWithResult(_0x432df3,null))[_0x2baf('0x42')](handleError(_0x432df3,null));};exports['destroy']=function(_0x16237f,_0x270d2c){return db[_0x2baf('0x3a')][_0x2baf('0x41')]({'where':{'id':_0x16237f['params']['id']}})[_0x2baf('0x1f')](handleEntityNotFound(_0x270d2c,null))['then'](removeEntity(_0x270d2c,null))['catch'](handleError(_0x270d2c,null));};exports[_0x2baf('0x44')]=function(_0x42e64e,_0x55e36b){var _0x1182dc;return db['sequelize'][_0x2baf('0x45')](function(_0x420a45){return db['CmCustomField'][_0x2baf('0x44')](_0x42e64e['body'],{'transaction':_0x420a45})[_0x2baf('0x1f')](function(_0x5aefb1){_0x1182dc=_0x5aefb1;var _0x3a7953={'type':db[_0x2baf('0x46')]['TEXT'],'transaction':_0x420a45};switch(_0x42e64e[_0x2baf('0x47')][_0x2baf('0x28')]){case'text':_0x3a7953['type']=db['Sequelize']['TEXT'];break;case'number':_0x3a7953[_0x2baf('0x28')]=db['Sequelize'][_0x2baf('0x48')];break;case _0x2baf('0x49'):_0x3a7953[_0x2baf('0x28')]=db[_0x2baf('0x46')][_0x2baf('0x4a')];_0x3a7953[_0x2baf('0x4b')]=![];break;default:}return db[_0x2baf('0x4c')]['queryInterface']['addColumn']('cm_contacts',util[_0x2baf('0x4d')](_0x2baf('0x4e'),_0x1182dc['id']),_0x3a7953);})[_0x2baf('0x1f')](function(){return _0x1182dc;});})['then'](respondWithResult(_0x55e36b,0xc9))['catch'](handleError(_0x55e36b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 7805e5e..0d4f8f2 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 _0x01b2=['CmCustomField','lodash','util','moment','request-promise','path','rimraf','define'];(function(_0x5e68af,_0x3d7a54){var _0x3f6cd5=function(_0x557dd7){while(--_0x557dd7){_0x5e68af['push'](_0x5e68af['shift']());}};_0x3f6cd5(++_0x3d7a54);}(_0x01b2,0x149));var _0x201b=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x01b2[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0x201b('0x0'));var util=require(_0x201b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x201b('0x2'));var BPromise=require('bluebird');var rp=require(_0x201b('0x3'));var fs=require('fs');var path=require(_0x201b('0x4'));var rimraf=require(_0x201b('0x5'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x111efd,_0x3a1ea9){return _0x111efd[_0x201b('0x6')](_0x201b('0x7'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4593=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','util','../../config/logger','api'];(function(_0x13be43,_0x1261e8){var _0x2b5d2f=function(_0x4a979f){while(--_0x4a979f){_0x13be43['push'](_0x13be43['shift']());}};_0x2b5d2f(++_0x1261e8);}(_0x4593,0xd5));var _0x3459=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x4593[_0x359bbe];return _0x1b3353;};'use strict';var _=require('lodash');var util=require(_0x3459('0x0'));var logger=require(_0x3459('0x1'))(_0x3459('0x2'));var moment=require(_0x3459('0x3'));var BPromise=require(_0x3459('0x4'));var rp=require(_0x3459('0x5'));var fs=require('fs');var path=require(_0x3459('0x6'));var rimraf=require(_0x3459('0x7'));var config=require(_0x3459('0x8'));var attributes=require(_0x3459('0x9'));module['exports']=function(_0x46a751,_0x7114cc){return _0x46a751['define'](_0x3459('0xa'),attributes,{'tableName':_0x3459('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 43e043f..77d0539 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 _0x10a4=['http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5f3472,_0x47ada9){var _0x30b1fa=function(_0x1872f1){while(--_0x1872f1){_0x5f3472['push'](_0x5f3472['shift']());}};_0x30b1fa(++_0x47ada9);}(_0x10a4,0xb4));var _0x410a=function(_0x3c4702,_0x315207){_0x3c4702=_0x3c4702-0x0;var _0x186a83=_0x10a4[_0x3c4702];return _0x186a83;};'use strict';var _=require(_0x410a('0x0'));var util=require(_0x410a('0x1'));var moment=require(_0x410a('0x2'));var BPromise=require(_0x410a('0x3'));var rs=require(_0x410a('0x4'));var fs=require('fs');var Redis=require(_0x410a('0x5'));var db=require(_0x410a('0x6'))['db'];var utils=require(_0x410a('0x7'));var logger=require(_0x410a('0x8'))(_0x410a('0x9'));var config=require('../../config/environment');var jayson=require(_0x410a('0xa'));var client=jayson[_0x410a('0xb')][_0x410a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d5e98,_0x486625,_0x573c04){return new BPromise(function(_0x30b546,_0x3badd1){return client['request'](_0x5d5e98,_0x573c04)[_0x410a('0xd')](function(_0x5c68b0){logger[_0x410a('0xe')](_0x410a('0xf'),_0x486625,_0x410a('0x10'));logger[_0x410a('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x486625,_0x410a('0x10'),JSON[_0x410a('0x12')](_0x5c68b0));if(_0x5c68b0[_0x410a('0x13')]){if(_0x5c68b0['error'][_0x410a('0x14')]===0x1f4){logger[_0x410a('0x13')](_0x410a('0xf'),_0x486625,_0x5c68b0['error']['message']);return _0x3badd1(_0x5c68b0[_0x410a('0x13')]['message']);}logger[_0x410a('0x13')](_0x410a('0xf'),_0x486625,_0x5c68b0[_0x410a('0x13')][_0x410a('0x15')]);return _0x30b546(_0x5c68b0['error'][_0x410a('0x15')]);}else{logger[_0x410a('0xe')](_0x410a('0xf'),_0x486625,_0x410a('0x10'));_0x30b546(_0x5c68b0[_0x410a('0x16')][_0x410a('0x15')]);}})[_0x410a('0x17')](function(_0x3d8fe8){logger['error'](_0x410a('0xf'),_0x486625,_0x3d8fe8);_0x3badd1(_0x3d8fe8);});});} \ No newline at end of file +var _0x14cf=['request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x14cf,0xba));var _0xf14c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x14cf[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xf14c('0x0'));var util=require('util');var moment=require(_0xf14c('0x1'));var BPromise=require(_0xf14c('0x2'));var rs=require(_0xf14c('0x3'));var fs=require('fs');var Redis=require(_0xf14c('0x4'));var db=require(_0xf14c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf14c('0x6'))(_0xf14c('0x7'));var config=require(_0xf14c('0x8'));var jayson=require(_0xf14c('0x9'));var client=jayson[_0xf14c('0xa')][_0xf14c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cd319,_0x4943a9,_0x2ba1cb){return new BPromise(function(_0x5894c8,_0x42d534){return client[_0xf14c('0xc')](_0x1cd319,_0x2ba1cb)[_0xf14c('0xd')](function(_0x4083ae){logger[_0xf14c('0xe')](_0xf14c('0xf'),_0x4943a9,'request\x20sent');logger['debug'](_0xf14c('0x10'),_0x4943a9,'request\x20sent',JSON[_0xf14c('0x11')](_0x4083ae));if(_0x4083ae[_0xf14c('0x12')]){if(_0x4083ae[_0xf14c('0x12')][_0xf14c('0x13')]===0x1f4){logger[_0xf14c('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4943a9,_0x4083ae[_0xf14c('0x12')][_0xf14c('0x14')]);return _0x42d534(_0x4083ae['error'][_0xf14c('0x14')]);}logger['error'](_0xf14c('0xf'),_0x4943a9,_0x4083ae[_0xf14c('0x12')][_0xf14c('0x14')]);return _0x5894c8(_0x4083ae[_0xf14c('0x12')][_0xf14c('0x14')]);}else{logger[_0xf14c('0xe')](_0xf14c('0xf'),_0x4943a9,_0xf14c('0x15'));_0x5894c8(_0x4083ae['result'][_0xf14c('0x14')]);}})[_0xf14c('0x16')](function(_0x5566eb){logger['error'](_0xf14c('0xf'),_0x4943a9,_0x5566eb);_0x42d534(_0x5566eb);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 8e7161f..0d4c69c 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 _0x6cfa=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x3ec74a,_0x511693){var _0x39398d=function(_0x1ace5c){while(--_0x1ace5c){_0x3ec74a['push'](_0x3ec74a['shift']());}};_0x39398d(++_0x511693);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x4eced3,_0x556d73){_0x4eced3=_0x4eced3-0x0;var _0x26436c=_0x6cfa[_0x4eced3];return _0x26436c;};'use strict';var multer=require(_0xa6cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa6cf('0x1'));var express=require('express');var router=express[_0xa6cf('0x2')]();var fs_extra=require(_0xa6cf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6cf('0x4'));router[_0xa6cf('0x5')]('/',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x7')]);router[_0xa6cf('0x5')](_0xa6cf('0x8'),auth[_0xa6cf('0x6')](),controller['show']);router[_0xa6cf('0x9')]('/',auth['isAuthenticated'](),controller[_0xa6cf('0xa')]);router['put'](_0xa6cf('0x8'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xb')]);router[_0xa6cf('0xc')]('/:id',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xd')]);module[_0xa6cf('0xe')]=router; \ No newline at end of file +var _0x544f=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update'];(function(_0x3b8a05,_0xe57766){var _0x1345c3=function(_0xae5862){while(--_0xae5862){_0x3b8a05['push'](_0x3b8a05['shift']());}};_0x1345c3(++_0xe57766);}(_0x544f,0x14c));var _0xf544=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x544f[_0x8a969d];return _0x1d8dc7;};'use strict';var multer=require(_0xf544('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require(_0xf544('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./cmCustomField.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router[_0xf544('0x7')](_0xf544('0x9'),auth[_0xf544('0x8')](),controller['show']);router[_0xf544('0xa')]('/',auth['isAuthenticated'](),controller[_0xf544('0xb')]);router['put'](_0xf544('0x9'),auth['isAuthenticated'](),controller[_0xf544('0xc')]);router['delete'](_0xf544('0x9'),auth[_0xf544('0x8')](),controller[_0xf544('0xd')]);module[_0xf544('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index dca6df5..91b7327 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 _0xef0f=['moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x31e2cd,_0x4c05ba){var _0x48af4e=function(_0x270bdd){while(--_0x270bdd){_0x31e2cd['push'](_0x31e2cd['shift']());}};_0x48af4e(++_0x4c05ba);}(_0xef0f,0x168));var _0xfef0=function(_0xdc4445,_0x4b9e17){_0xdc4445=_0xdc4445-0x0;var _0x356c67=_0xef0f[_0xdc4445];return _0x356c67;};'use strict';var moment=require(_0xfef0('0x0'));var Sequelize=require('sequelize');module[_0xfef0('0x1')]={'phone':{'type':Sequelize[_0xfef0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xfef0('0x4')](_0xfef0('0x5'))},'countbusyretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfef0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfef0('0x7')]},'priority':{'type':Sequelize[_0xfef0('0x6')](0x2)[_0xfef0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfef0('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'UserId':{'type':Sequelize[_0xfef0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'CampaignId':{'type':Sequelize[_0xfef0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfef0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfef0('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x1a85=['exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x334604,_0x2ea84b){var _0x259674=function(_0x56c6a7){while(--_0x56c6a7){_0x334604['push'](_0x334604['shift']());}};_0x259674(++_0x2ea84b);}(_0x1a85,0x178));var _0x51a8=function(_0x5ea451,_0x133637){_0x5ea451=_0x5ea451-0x0;var _0x37a06a=_0x1a85[_0x5ea451];return _0x37a06a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x51a8('0x0')]={'phone':{'type':Sequelize[_0x51a8('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x51a8('0x3'))},'countbusyretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x51a8('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x51a8('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x51a8('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x51a8('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x51a8('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x51a8('0x4')],'unique':_0x51a8('0x7')},'CampaignId':{'type':Sequelize[_0x51a8('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x51a8('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x51a8('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x51a8('0x5')],'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 c6d6b1e..595b82c 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 _0x5304=['UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','findOne','Company','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','concat','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','includeAll','include','findAll','rows','show','keys','options','catch','create','body','find','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','campaign'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5304,0x167));var _0x4530=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x5304[_0x15d18f];return _0xd12bf7;};'use strict';var emlformat=require(_0x4530('0x0'));var rimraf=require(_0x4530('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4530('0x2'));var BPromise=require(_0x4530('0x3'));var Mustache=require(_0x4530('0x4'));var util=require('util');var path=require(_0x4530('0x5'));var sox=require('sox');var csv=require(_0x4530('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4530('0x7'));var _=require('lodash');var squel=require(_0x4530('0x8'));var crypto=require(_0x4530('0x9'));var jsforce=require(_0x4530('0xa'));var deskjs=require(_0x4530('0xb'));var toCsv=require(_0x4530('0x6'));var querystring=require('querystring');var Papa=require(_0x4530('0xc'));var Redis=require(_0x4530('0xd'));var authService=require(_0x4530('0xe'));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('../../config/environment');var shared=require('../../config/environment');var licenseUtil=require(_0x4530('0xf'));var db=require(_0x4530('0x10'))['db'];function respondWithStatusCode(_0x895da3,_0x16c428){_0x16c428=_0x16c428||0xcc;return function(_0x9ad0bd){if(_0x9ad0bd){return _0x895da3[_0x4530('0x11')](_0x16c428);}return _0x895da3[_0x4530('0x12')](_0x16c428)[_0x4530('0x13')]();};}function respondWithResult(_0x1bd136,_0x4ed52b){_0x4ed52b=_0x4ed52b||0xc8;return function(_0xcce6b8){if(_0xcce6b8){return _0x1bd136[_0x4530('0x12')](_0x4ed52b)[_0x4530('0x14')](_0xcce6b8);}};}function respondWithFilteredResult(_0x18b1df,_0x5d68f6){return function(_0x31999b){if(_0x31999b){var _0x2b704b=typeof _0x5d68f6[_0x4530('0x15')]===_0x4530('0x16')&&typeof _0x5d68f6[_0x4530('0x17')]===_0x4530('0x16');var _0x50c690=_0x31999b[_0x4530('0x18')];var _0x2e39bb=_0x2b704b?0x0:_0x5d68f6[_0x4530('0x15')];var _0x17ed53=_0x2b704b?_0x31999b[_0x4530('0x18')]:_0x5d68f6['offset']+_0x5d68f6[_0x4530('0x17')];var _0x51191a;if(_0x17ed53>=_0x50c690){_0x17ed53=_0x50c690;_0x51191a=0xc8;}else{_0x51191a=0xce;}_0x18b1df[_0x4530('0x12')](_0x51191a);return _0x18b1df[_0x4530('0x19')](_0x4530('0x1a'),_0x2e39bb+'-'+_0x17ed53+'/'+_0x50c690)['json'](_0x31999b);}return null;};}function patchUpdates(_0x5edac2){return function(_0x57f2f9){try{jsonpatch['apply'](_0x57f2f9,_0x5edac2,!![]);}catch(_0x30b644){return BPromise['reject'](_0x30b644);}return _0x57f2f9[_0x4530('0x1b')]();};}function saveUpdates(_0x45c8e7,_0x3836dd){return function(_0x512d48){if(_0x512d48){return _0x512d48[_0x4530('0x1c')](_0x45c8e7)[_0x4530('0x1d')](function(_0xc51dc7){return _0xc51dc7;});}return null;};}function removeEntity(_0x173a4d,_0x3edb06){return function(_0x5ae4bd){if(_0x5ae4bd){return _0x5ae4bd[_0x4530('0x1e')]()[_0x4530('0x1d')](function(){_0x173a4d[_0x4530('0x12')](0xcc)[_0x4530('0x13')]();});}};}function handleEntityNotFound(_0x3a2eb3,_0x320862){return function(_0x36c6fe){if(!_0x36c6fe){_0x3a2eb3[_0x4530('0x11')](0x194);}return _0x36c6fe;};}function handleError(_0x12e6a8,_0x41e471){_0x41e471=_0x41e471||0x1f4;return function(_0x59b4e0){logger[_0x4530('0x1f')](_0x59b4e0[_0x4530('0x20')]);if(_0x59b4e0[_0x4530('0x21')]){delete _0x59b4e0['name'];}_0x12e6a8[_0x4530('0x12')](_0x41e471)[_0x4530('0x22')](_0x59b4e0);};}exports['index']=function(_0x4dc430,_0x4838e2){var _0x150d11={},_0x235356={},_0x205da5={'count':0x0,'rows':[]};var _0x32e317=_['map'](db['CmHopper'][_0x4530('0x23')],function(_0x17bad2){return{'name':_0x17bad2[_0x4530('0x24')],'type':_0x17bad2[_0x4530('0x25')][_0x4530('0x26')]};});_0x235356['model']=_[_0x4530('0x27')](_0x32e317,_0x4530('0x21'));_0x235356['query']=_['keys'](_0x4dc430['query']);_0x235356[_0x4530('0x28')]=_[_0x4530('0x29')](_0x235356[_0x4530('0x2a')],_0x235356[_0x4530('0x2b')]);_0x235356[_0x4530('0x28')]=_[_0x4530('0x2c')](_0x235356['filters'],[_0x4530('0x2d'),_0x4530('0x2e'),'$gt',_0x4530('0x2f'),_0x4530('0x30'),'$lte',_0x4530('0x31'),_0x4530('0x32'),_0x4530('0x33'),_0x4530('0x34'),_0x4530('0x35'),_0x4530('0x36'),_0x4530('0x37'),_0x4530('0x38'),_0x4530('0x39'),_0x4530('0x3a'),_0x4530('0x3b'),_0x4530('0x38'),'$overlap',_0x4530('0x3c'),'$contained','$any']);_0x150d11[_0x4530('0x3d')]=_[_0x4530('0x29')](_0x235356[_0x4530('0x2a')],qs[_0x4530('0x3e')](_0x4dc430['query']['fields']));_0x150d11['attributes']=_0x150d11[_0x4530('0x3d')][_0x4530('0x3f')]?_0x150d11[_0x4530('0x3d')]:_0x235356[_0x4530('0x2a')];if(!_0x4dc430[_0x4530('0x2b')][_0x4530('0x40')](_0x4530('0x41'))){_0x150d11[_0x4530('0x17')]=qs[_0x4530('0x17')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x17')]);_0x150d11[_0x4530('0x15')]=qs[_0x4530('0x15')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x15')]);}_0x150d11[_0x4530('0x42')]=qs[_0x4530('0x43')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x43')]);_0x150d11[_0x4530('0x44')]=qs[_0x4530('0x28')](_[_0x4530('0x45')](_0x4dc430[_0x4530('0x2b')],_0x235356['filters']),_0x32e317);if(_0x4dc430[_0x4530('0x2b')][_0x4530('0x46')]){_0x150d11[_0x4530('0x44')]=_[_0x4530('0x47')](_0x150d11[_0x4530('0x44')],{'$or':_[_0x4530('0x27')](_0x32e317,function(_0x1fcf4e){if(_0x1fcf4e[_0x4530('0x25')]!==_0x4530('0x48')){var _0x27d926={};_0x27d926[_0x1fcf4e[_0x4530('0x21')]]={'$like':'%'+_0x4dc430[_0x4530('0x2b')][_0x4530('0x46')]+'%'};return _0x27d926;}})});}_0x150d11=_['merge']({},_0x150d11,_0x4dc430['options']);var _0xe8bc79={'where':_0x150d11[_0x4530('0x44')]};return db[_0x4530('0x49')][_0x4530('0x18')](_0xe8bc79)[_0x4530('0x1d')](function(_0x3c7dcb){_0x205da5[_0x4530('0x18')]=_0x3c7dcb;if(_0x4dc430['query'][_0x4530('0x4a')]){_0x150d11[_0x4530('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0x4530('0x4c')](_0x150d11);})[_0x4530('0x1d')](function(_0x1f5299){_0x205da5[_0x4530('0x4d')]=_0x1f5299;return _0x205da5;})[_0x4530('0x1d')](respondWithFilteredResult(_0x4838e2,_0x150d11))['catch'](handleError(_0x4838e2,null));};exports[_0x4530('0x4e')]=function(_0x85bbd2,_0x336172){var _0x30b310={'raw':!![],'where':{'id':_0x85bbd2['params']['id']}},_0x43291b={};_0x43291b[_0x4530('0x2a')]=_[_0x4530('0x4f')](db[_0x4530('0x49')]['rawAttributes']);_0x43291b['query']=_[_0x4530('0x4f')](_0x85bbd2[_0x4530('0x2b')]);_0x43291b[_0x4530('0x28')]=_['intersection'](_0x43291b[_0x4530('0x2a')],_0x43291b['query']);_0x30b310[_0x4530('0x3d')]=_[_0x4530('0x29')](_0x43291b['model'],qs[_0x4530('0x3e')](_0x85bbd2[_0x4530('0x2b')][_0x4530('0x3e')]));_0x30b310[_0x4530('0x3d')]=_0x30b310['attributes'][_0x4530('0x3f')]?_0x30b310[_0x4530('0x3d')]:_0x43291b['model'];if(_0x85bbd2[_0x4530('0x2b')][_0x4530('0x4a')]){_0x30b310['include']=[{'all':!![]}];}_0x30b310=_[_0x4530('0x47')]({},_0x30b310,_0x85bbd2[_0x4530('0x50')]);return db[_0x4530('0x49')]['find'](_0x30b310)['then'](handleEntityNotFound(_0x336172,null))[_0x4530('0x1d')](respondWithResult(_0x336172,null))[_0x4530('0x51')](handleError(_0x336172,null));};exports[_0x4530('0x52')]=function(_0x5477d4,_0x16b0ae){return db['CmHopper'][_0x4530('0x52')](_0x5477d4[_0x4530('0x53')],{})[_0x4530('0x1d')](respondWithResult(_0x16b0ae,0xc9))['catch'](handleError(_0x16b0ae,null));};exports[_0x4530('0x1c')]=function(_0x31bfc4,_0x22a7d5){if(_0x31bfc4[_0x4530('0x53')]['id']){delete _0x31bfc4[_0x4530('0x53')]['id'];}return db['CmHopper'][_0x4530('0x54')]({'where':{'id':_0x31bfc4[_0x4530('0x55')]['id']}})[_0x4530('0x1d')](handleEntityNotFound(_0x22a7d5,null))[_0x4530('0x1d')](saveUpdates(_0x31bfc4['body'],null))[_0x4530('0x1d')](respondWithResult(_0x22a7d5,null))[_0x4530('0x51')](handleError(_0x22a7d5,null));};exports[_0x4530('0x56')]=function(_0x29007c,_0x232e28){return db['CmHopper'][_0x4530('0x56')]()['then'](respondWithResult(_0x232e28,null))[_0x4530('0x51')](handleError(_0x232e28,null));};exports['destroy']=function(_0x1e7602,_0x5b1361){var _0x4786f8;return db[_0x4530('0x49')][_0x4530('0x54')]({'where':{'id':_0x1e7602[_0x4530('0x55')]['id']}})['then'](handleEntityNotFound(_0x5b1361,null))[_0x4530('0x1d')](function(_0x30c6a3){if(_0x30c6a3){return _0x30c6a3[_0x4530('0x1e')]()[_0x4530('0x1d')](function(_0x5cc099){return _0x5cc099;});}})[_0x4530('0x1d')](function(_0x58fc2c){_0x4786f8=_0x58fc2c;if(_0x58fc2c){if(_0x58fc2c[_0x4530('0x57')]||_0x58fc2c[_0x4530('0x58')]){return db[_0x58fc2c['VoiceQueueId']?_0x4530('0x59'):_0x4530('0x5a')]['find']({'where':{'id':_0x58fc2c[_0x4530('0x57')]?_0x58fc2c[_0x4530('0x57')]:_0x58fc2c['CampaignId']},'attributes':['id',_0x4530('0x21')],'raw':!![]});}}})[_0x4530('0x1d')](function(_0x47f0a1){var _0x183cd3={};if(_0x47f0a1){_[_0x4530('0x47')](_0x183cd3,_[_0x4530('0x5b')](_0x4786f8[_0x4530('0x5c')],[_0x4530('0x5d'),'updatedAt','id']));_0x183cd3[_0x4530('0x5e')]=0x15;_0x183cd3[_0x4530('0x5f')]='deleted';_0x183cd3[_0x4530('0x60')]=_0x47f0a1[_0x4530('0x21')];_0x183cd3['membername']=_0x1e7602['user'][_0x4530('0x21')];_0x183cd3[_0x4530('0x61')]=_0x1e7602[_0x4530('0x62')]['id'];_0x183cd3['deleted']=!![];_0x183cd3[_0x4530('0x63')]=moment()[_0x4530('0x64')](_0x4530('0x65'));_0x183cd3['calleridnum']=_0x4786f8[_0x4530('0x66')];_0x183cd3['campaigntype']=_0x4786f8[_0x4530('0x57')]?_0x4530('0x67'):_0x4530('0x68');return db[_0x4530('0x69')]['find']({'where':{'id':_0x183cd3[_0x4530('0x6a')]},'attributes':[_0x4530('0x6b'),_0x4530('0x6c')]})[_0x4530('0x1d')](function(_0x4ae3c6){if(!_[_0x4530('0x6d')](_0x5b1361)&&!_[_0x4530('0x6d')](_0x4ae3c6[_0x4530('0x6b')])){_0x183cd3[_0x4530('0x6e')]=_0x4ae3c6[_0x4530('0x6b')];if(!_[_0x4530('0x6d')](_0x4ae3c6[_0x4530('0x6c')])){_0x183cd3['calleridname']+='\x20'+_0x4ae3c6[_0x4530('0x6c')];}}})['finally'](function(){return db['CmHopperFinal'][_0x4530('0x52')](_0x183cd3);});}})[_0x4530('0x1d')](function(){return _0x5b1361[_0x4530('0x12')](0xcc)['end']();})[_0x4530('0x51')](handleError(_0x5b1361,null));};exports[_0x4530('0x6f')]=function(_0x16b688,_0x145b73,_0x105542){var _0x16d8cf=[];return db[_0x4530('0x69')][_0x4530('0x56')]()[_0x4530('0x1d')](function(_0xc95b3c){_0x16d8cf=_[_0x4530('0x4f')](_0xc95b3c);return _0x16b688[_0x4530('0x62')][_0x4530('0x70')]({'where':{'type':_0x4530('0x71'),'dialActive':!![],'dialMethod':_0x4530('0x72')},'attributes':['id',_0x4530('0x73'),_0x4530('0x74')],'raw':!![]});})[_0x4530('0x1d')](function(_0x2dface){if(_0x2dface&&_0x2dface['length']){return db[_0x4530('0x75')][_0x4530('0x76')](function(_0x3ad21a){var _0x206caf={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4530('0x64')](_0x4530('0x65'))},'VoiceQueueId':{'$in':_[_0x4530('0x27')](_0x2dface,'id')},'$or':[{'UserId':null},{'UserId':_0x16b688[_0x4530('0x62')]['id']}]};var _0x23e329={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2dface)[_0x4530('0x46')]([_0x4530('0x74'),0x0])[_0x4530('0x27')]('id')[_0x4530('0x77')]()},'$or':[{'UserId':null},{'UserId':_0x16b688['user']['id']}]};var _0x8130bc={'$or':[_0x206caf,_0x23e329]};var _0x53da38=[];if(_0x16b688[_0x4530('0x53')]['direction']&&_0x16b688[_0x4530('0x53')][_0x4530('0x78')]===_0x4530('0x79')){if(!_[_0x4530('0x7a')](_0x16b688['body'][_0x4530('0x7b')])){_0x8130bc['id']={'$in':_0x16b688[_0x4530('0x53')][_0x4530('0x7b')]};}_0x53da38=[[_0x4530('0x7c'),'ASC'],['scheduledAt',_0x2dface[0x0][_0x4530('0x73')]===_0x4530('0x7d')?_0x4530('0x7e'):_0x4530('0x7d')],db[_0x4530('0x75')][_0x4530('0x7f')](_0x4530('0x80')),['id','DESC']];}else{if(!_[_0x4530('0x7a')](_0x16b688[_0x4530('0x53')][_0x4530('0x7b')])){_0x8130bc['id']={'$notIn':_0x16b688[_0x4530('0x53')][_0x4530('0x7b')]};}_0x53da38=[['priority','DESC'],[_0x4530('0x81'),_0x2dface[0x0]['dialOrderByScheduledAt']],db[_0x4530('0x75')][_0x4530('0x7f')](_0x4530('0x82')),['id',_0x4530('0x7d')]];}return db[_0x4530('0x49')]['findOne']({'attributes':['id',_0x4530('0x83'),_0x4530('0x84')],'where':_0x8130bc,'order':_0x53da38,'transaction':_0x3ad21a,'lock':_0x3ad21a[_0x4530('0x85')][_0x4530('0x86')],'include':[{'model':db[_0x4530('0x69')],'as':_0x4530('0x87'),'attributes':_0x16d8cf,'include':[{'model':db[_0x4530('0x88')],'as':'Company','attributes':['id',_0x4530('0x21')]}]},{'model':db[_0x4530('0x89')],'as':_0x4530('0x8a'),'attributes':['id',_0x4530('0x21')]},{'model':db[_0x4530('0x59')],'as':_0x4530('0x8b'),'attributes':['id',_0x4530('0x21'),_0x4530('0x8c')]}]})['then'](function(_0x2592fa){if(_0x2592fa){return _0x2592fa[_0x4530('0x1c')]({'UserId':_0x16b688[_0x4530('0x62')]['id']},{'transaction':_0x3ad21a});}});});}})[_0x4530('0x1d')](handleEntityNotFound(_0x145b73,null))['then'](respondWithResult(_0x145b73,null))[_0x4530('0x51')](handleError(_0x145b73,null));};exports[_0x4530('0x8d')]=function(_0x2ec97c,_0x134522,_0x4dbd56){var _0x522416=[];return db[_0x4530('0x69')][_0x4530('0x56')]()[_0x4530('0x1d')](function(_0xd4d965){_0x522416=_[_0x4530('0x4f')](_0xd4d965);return _0x2ec97c[_0x4530('0x62')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x4530('0x73'),_0x4530('0x74')],'raw':!![]});})['then'](function(_0x22a3ef){if(_0x22a3ef&&_0x22a3ef[_0x4530('0x3f')]){return db[_0x4530('0x75')][_0x4530('0x76')](function(_0x27400d){var _0x2f5c23={'active':![],'recallme':!![],'id':_0x2ec97c['body']['hopperId']};return db['CmHopper'][_0x4530('0x8e')]({'attributes':['id',_0x4530('0x83'),_0x4530('0x84')],'where':_0x2f5c23,'transaction':_0x27400d,'lock':_0x27400d[_0x4530('0x85')]['UPDATE'],'include':[{'model':db[_0x4530('0x69')],'as':_0x4530('0x87'),'attributes':_0x522416,'include':[{'model':db[_0x4530('0x88')],'as':_0x4530('0x8f'),'attributes':['id','name']}]},{'model':db[_0x4530('0x89')],'as':_0x4530('0x8a'),'attributes':['id',_0x4530('0x21')]},{'model':db[_0x4530('0x59')],'as':_0x4530('0x8b'),'attributes':['id',_0x4530('0x21'),'dialActive']}]})[_0x4530('0x1d')](function(_0xe0853a){if(_0xe0853a){return _0xe0853a[_0x4530('0x1c')]({'UserId':_0x2ec97c[_0x4530('0x62')]['id']},{'transaction':_0x27400d});}});});}})[_0x4530('0x1d')](handleEntityNotFound(_0x134522,null))[_0x4530('0x1d')](respondWithResult(_0x134522,null))[_0x4530('0x51')](handleError(_0x134522,null));};exports[_0x4530('0x90')]=function(_0x2d9785,_0x165b6d,_0x2dcb22){return _0x2d9785[_0x4530('0x62')][_0x4530('0x70')]({'where':{'type':_0x4530('0x71'),'dialActive':!![],'dialMethod':_0x4530('0x72')},'attributes':['id'],'raw':!![]})[_0x4530('0x1d')](function(_0x3fc31f){if(_0x3fc31f&&_0x3fc31f[_0x4530('0x3f')]){return db[_0x4530('0x49')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4530('0x64')](_0x4530('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x3fc31f,'id')},'$or':[{'UserId':null},{'UserId':_0x2d9785[_0x4530('0x62')]['id']}]}});}return 0x0;})[_0x4530('0x1d')](function(_0x36b26d){if(!_['isNil'](_0x36b26d)&&_['isNumber'](_0x36b26d)){return _0x165b6d['status'](0xc8)[_0x4530('0x14')]({'contacts':_0x36b26d});}else{logger['error'](_0x4530('0x91'),'getOpenContacts',0x194,_0x4530('0x92'));_0x165b6d['sendStatus'](0x194);}})[_0x4530('0x51')](handleError(_0x165b6d,null));};exports[_0x4530('0x93')]=function(_0x41b218,_0x2da7ce,_0x4a7e13){var _0x51cc67=shared['timezones'];var _0x2002e8=[];_[_0x4530('0x27')](_0x51cc67,function(_0x11375b){_0x2002e8[_0x4530('0x94')]({'id':_0x11375b[_0x4530('0x21')],'name':_0x11375b[_0x4530('0x21')],'utcOffset':_0x11375b[_0x4530('0x95')]});});return _0x2da7ce[_0x4530('0x12')](0xc8)['json']({'tz':_0x2002e8});};exports[_0x4530('0x96')]=function(_0x155b08,_0x16761e,_0x5c97a0){var _0x5c8995=shared[_0x4530('0x97')];var _0x5621ec={};if(!_[_0x4530('0x6d')](_0x5c8995[_0x155b08['body']['id']]))_0x5621ec=_0x5c8995[_0x155b08[_0x4530('0x53')]['id']];return _0x16761e[_0x4530('0x12')](0xc8)['json'](_0x5621ec);}; \ No newline at end of file +var _0xb315=['keys','filters','intersection','model','concat','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','CmHopper','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','VoiceQueueId','VoiceQueue','CampaignId','omit','updatedAt','state','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','format','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','preview','transaction','hopperId','LOCK','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','getTimezone','eml-format','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xb315,0x6f));var _0x5b31=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xb315[_0x5caf7e];return _0x5c3435;};'use strict';var emlformat=require(_0x5b31('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b31('0x1'));var rp=require(_0x5b31('0x2'));var moment=require(_0x5b31('0x3'));var BPromise=require(_0x5b31('0x4'));var Mustache=require('mustache');var util=require(_0x5b31('0x5'));var path=require(_0x5b31('0x6'));var sox=require(_0x5b31('0x7'));var csv=require(_0x5b31('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b31('0x9'));var _=require(_0x5b31('0xa'));var squel=require(_0x5b31('0xb'));var crypto=require('crypto');var jsforce=require(_0x5b31('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5b31('0x8'));var querystring=require(_0x5b31('0xd'));var Papa=require(_0x5b31('0xe'));var Redis=require(_0x5b31('0xf'));var authService=require(_0x5b31('0x10'));var qs=require(_0x5b31('0x11'));var as=require(_0x5b31('0x12'));var hardwareService=require(_0x5b31('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5b31('0x14'));var shared=require('../../config/environment');var licenseUtil=require(_0x5b31('0x15'));var db=require(_0x5b31('0x16'))['db'];function respondWithStatusCode(_0x641d48,_0x221168){_0x221168=_0x221168||0xcc;return function(_0x7f12d){if(_0x7f12d){return _0x641d48[_0x5b31('0x17')](_0x221168);}return _0x641d48[_0x5b31('0x18')](_0x221168)['end']();};}function respondWithResult(_0x2b0cbd,_0x3fba58){_0x3fba58=_0x3fba58||0xc8;return function(_0xea0f76){if(_0xea0f76){return _0x2b0cbd[_0x5b31('0x18')](_0x3fba58)[_0x5b31('0x19')](_0xea0f76);}};}function respondWithFilteredResult(_0x24adab,_0x34dae0){return function(_0x160842){if(_0x160842){var _0x2010d3=typeof _0x34dae0[_0x5b31('0x1a')]===_0x5b31('0x1b')&&typeof _0x34dae0['limit']==='undefined';var _0x41f3a1=_0x160842[_0x5b31('0x1c')];var _0xb1d337=_0x2010d3?0x0:_0x34dae0[_0x5b31('0x1a')];var _0x3e875b=_0x2010d3?_0x160842['count']:_0x34dae0['offset']+_0x34dae0['limit'];var _0x45ac12;if(_0x3e875b>=_0x41f3a1){_0x3e875b=_0x41f3a1;_0x45ac12=0xc8;}else{_0x45ac12=0xce;}_0x24adab[_0x5b31('0x18')](_0x45ac12);return _0x24adab[_0x5b31('0x1d')]('Content-Range',_0xb1d337+'-'+_0x3e875b+'/'+_0x41f3a1)['json'](_0x160842);}return null;};}function patchUpdates(_0x59548c){return function(_0x109f2b){try{jsonpatch[_0x5b31('0x1e')](_0x109f2b,_0x59548c,!![]);}catch(_0x87da5b){return BPromise['reject'](_0x87da5b);}return _0x109f2b['save']();};}function saveUpdates(_0x454cdb,_0x2992b2){return function(_0x5bea9e){if(_0x5bea9e){return _0x5bea9e[_0x5b31('0x1f')](_0x454cdb)[_0x5b31('0x20')](function(_0x433714){return _0x433714;});}return null;};}function removeEntity(_0x2148e9,_0x5a866d){return function(_0x2893d9){if(_0x2893d9){return _0x2893d9[_0x5b31('0x21')]()[_0x5b31('0x20')](function(){_0x2148e9[_0x5b31('0x18')](0xcc)[_0x5b31('0x22')]();});}};}function handleEntityNotFound(_0xdb6a96,_0x160f65){return function(_0x5a3271){if(!_0x5a3271){_0xdb6a96[_0x5b31('0x17')](0x194);}return _0x5a3271;};}function handleError(_0x1f234f,_0x1304ab){_0x1304ab=_0x1304ab||0x1f4;return function(_0xf5792b){logger[_0x5b31('0x23')](_0xf5792b['stack']);if(_0xf5792b['name']){delete _0xf5792b[_0x5b31('0x24')];}_0x1f234f[_0x5b31('0x18')](_0x1304ab)[_0x5b31('0x25')](_0xf5792b);};}exports['index']=function(_0x5d1ba2,_0x35035d){var _0x1ee8a5={},_0x556561={},_0xda9640={'count':0x0,'rows':[]};var _0x1611ca=_[_0x5b31('0x26')](db['CmHopper'][_0x5b31('0x27')],function(_0x7b8779){return{'name':_0x7b8779[_0x5b31('0x28')],'type':_0x7b8779[_0x5b31('0x29')][_0x5b31('0x2a')]};});_0x556561['model']=_[_0x5b31('0x26')](_0x1611ca,'name');_0x556561[_0x5b31('0x2b')]=_[_0x5b31('0x2c')](_0x5d1ba2[_0x5b31('0x2b')]);_0x556561[_0x5b31('0x2d')]=_[_0x5b31('0x2e')](_0x556561[_0x5b31('0x2f')],_0x556561[_0x5b31('0x2b')]);_0x556561[_0x5b31('0x2d')]=_[_0x5b31('0x30')](_0x556561[_0x5b31('0x2d')],['$and',_0x5b31('0x31'),_0x5b31('0x32'),_0x5b31('0x33'),'$lt',_0x5b31('0x34'),_0x5b31('0x35'),_0x5b31('0x36'),'$not',_0x5b31('0x37'),_0x5b31('0x38'),_0x5b31('0x39'),_0x5b31('0x3a'),_0x5b31('0x3b'),_0x5b31('0x3c'),_0x5b31('0x3d'),'$notILike','$like',_0x5b31('0x3e'),_0x5b31('0x3f'),_0x5b31('0x40'),_0x5b31('0x41')]);_0x1ee8a5['attributes']=_[_0x5b31('0x2e')](_0x556561[_0x5b31('0x2f')],qs[_0x5b31('0x42')](_0x5d1ba2[_0x5b31('0x2b')][_0x5b31('0x42')]));_0x1ee8a5[_0x5b31('0x43')]=_0x1ee8a5['attributes']['length']?_0x1ee8a5[_0x5b31('0x43')]:_0x556561[_0x5b31('0x2f')];if(!_0x5d1ba2['query'][_0x5b31('0x44')](_0x5b31('0x45'))){_0x1ee8a5[_0x5b31('0x46')]=qs['limit'](_0x5d1ba2[_0x5b31('0x2b')][_0x5b31('0x46')]);_0x1ee8a5['offset']=qs[_0x5b31('0x1a')](_0x5d1ba2['query'][_0x5b31('0x1a')]);}_0x1ee8a5[_0x5b31('0x47')]=qs[_0x5b31('0x48')](_0x5d1ba2[_0x5b31('0x2b')][_0x5b31('0x48')]);_0x1ee8a5['where']=qs[_0x5b31('0x2d')](_[_0x5b31('0x49')](_0x5d1ba2[_0x5b31('0x2b')],_0x556561['filters']),_0x1611ca);if(_0x5d1ba2[_0x5b31('0x2b')][_0x5b31('0x4a')]){_0x1ee8a5['where']=_[_0x5b31('0x4b')](_0x1ee8a5['where'],{'$or':_[_0x5b31('0x26')](_0x1611ca,function(_0x3bdf98){if(_0x3bdf98['type']!==_0x5b31('0x4c')){var _0xad1449={};_0xad1449[_0x3bdf98['name']]={'$like':'%'+_0x5d1ba2['query'][_0x5b31('0x4a')]+'%'};return _0xad1449;}})});}_0x1ee8a5=_[_0x5b31('0x4b')]({},_0x1ee8a5,_0x5d1ba2[_0x5b31('0x4d')]);var _0x24d22c={'where':_0x1ee8a5[_0x5b31('0x4e')]};return db[_0x5b31('0x4f')]['count'](_0x24d22c)[_0x5b31('0x20')](function(_0x349a66){_0xda9640['count']=_0x349a66;if(_0x5d1ba2['query'][_0x5b31('0x50')]){_0x1ee8a5[_0x5b31('0x51')]=[{'all':!![]}];}return db[_0x5b31('0x4f')][_0x5b31('0x52')](_0x1ee8a5);})[_0x5b31('0x20')](function(_0xe19346){_0xda9640[_0x5b31('0x53')]=_0xe19346;return _0xda9640;})[_0x5b31('0x20')](respondWithFilteredResult(_0x35035d,_0x1ee8a5))[_0x5b31('0x54')](handleError(_0x35035d,null));};exports[_0x5b31('0x55')]=function(_0x5ccea3,_0x1ac981){var _0x657cbf={'raw':!![],'where':{'id':_0x5ccea3[_0x5b31('0x56')]['id']}},_0x27554c={};_0x27554c[_0x5b31('0x2f')]=_['keys'](db['CmHopper']['rawAttributes']);_0x27554c[_0x5b31('0x2b')]=_['keys'](_0x5ccea3[_0x5b31('0x2b')]);_0x27554c[_0x5b31('0x2d')]=_['intersection'](_0x27554c[_0x5b31('0x2f')],_0x27554c[_0x5b31('0x2b')]);_0x657cbf[_0x5b31('0x43')]=_[_0x5b31('0x2e')](_0x27554c[_0x5b31('0x2f')],qs[_0x5b31('0x42')](_0x5ccea3[_0x5b31('0x2b')][_0x5b31('0x42')]));_0x657cbf[_0x5b31('0x43')]=_0x657cbf[_0x5b31('0x43')]['length']?_0x657cbf[_0x5b31('0x43')]:_0x27554c['model'];if(_0x5ccea3['query']['includeAll']){_0x657cbf['include']=[{'all':!![]}];}_0x657cbf=_[_0x5b31('0x4b')]({},_0x657cbf,_0x5ccea3[_0x5b31('0x4d')]);return db[_0x5b31('0x4f')]['find'](_0x657cbf)[_0x5b31('0x20')](handleEntityNotFound(_0x1ac981,null))['then'](respondWithResult(_0x1ac981,null))[_0x5b31('0x54')](handleError(_0x1ac981,null));};exports[_0x5b31('0x57')]=function(_0x3a04ac,_0x42eae1){return db[_0x5b31('0x4f')][_0x5b31('0x57')](_0x3a04ac['body'],{})[_0x5b31('0x20')](respondWithResult(_0x42eae1,0xc9))[_0x5b31('0x54')](handleError(_0x42eae1,null));};exports[_0x5b31('0x1f')]=function(_0x20f383,_0x5e36e0){if(_0x20f383[_0x5b31('0x58')]['id']){delete _0x20f383['body']['id'];}return db[_0x5b31('0x4f')][_0x5b31('0x59')]({'where':{'id':_0x20f383[_0x5b31('0x56')]['id']}})['then'](handleEntityNotFound(_0x5e36e0,null))[_0x5b31('0x20')](saveUpdates(_0x20f383[_0x5b31('0x58')],null))[_0x5b31('0x20')](respondWithResult(_0x5e36e0,null))[_0x5b31('0x54')](handleError(_0x5e36e0,null));};exports['describe']=function(_0x1fe2e7,_0x1394ca){return db['CmHopper'][_0x5b31('0x5a')]()[_0x5b31('0x20')](respondWithResult(_0x1394ca,null))[_0x5b31('0x54')](handleError(_0x1394ca,null));};exports[_0x5b31('0x21')]=function(_0x51138e,_0x699fbd){var _0x99e632;return db['CmHopper'][_0x5b31('0x59')]({'where':{'id':_0x51138e[_0x5b31('0x56')]['id']}})[_0x5b31('0x20')](handleEntityNotFound(_0x699fbd,null))['then'](function(_0x165b13){if(_0x165b13){return _0x165b13[_0x5b31('0x21')]()[_0x5b31('0x20')](function(_0x2510bc){return _0x2510bc;});}})[_0x5b31('0x20')](function(_0x563942){_0x99e632=_0x563942;if(_0x563942){if(_0x563942['VoiceQueueId']||_0x563942['CampaignId']){return db[_0x563942[_0x5b31('0x5b')]?_0x5b31('0x5c'):'Campaign'][_0x5b31('0x59')]({'where':{'id':_0x563942['VoiceQueueId']?_0x563942[_0x5b31('0x5b')]:_0x563942[_0x5b31('0x5d')]},'attributes':['id',_0x5b31('0x24')],'raw':!![]});}}})[_0x5b31('0x20')](function(_0x4e4ce8){var _0x2306a4={};if(_0x4e4ce8){_[_0x5b31('0x4b')](_0x2306a4,_[_0x5b31('0x5e')](_0x99e632['dataValues'],['createdAt',_0x5b31('0x5f'),'id']));_0x2306a4[_0x5b31('0x60')]=0x15;_0x2306a4['statedesc']=_0x5b31('0x61');_0x2306a4[_0x5b31('0x62')]=_0x4e4ce8[_0x5b31('0x24')];_0x2306a4[_0x5b31('0x63')]=_0x51138e[_0x5b31('0x64')][_0x5b31('0x24')];_0x2306a4[_0x5b31('0x65')]=_0x51138e['user']['id'];_0x2306a4[_0x5b31('0x61')]=!![];_0x2306a4[_0x5b31('0x66')]=moment()['format'](_0x5b31('0x67'));_0x2306a4[_0x5b31('0x68')]=_0x99e632[_0x5b31('0x69')];_0x2306a4[_0x5b31('0x6a')]=_0x99e632[_0x5b31('0x5b')]?_0x5b31('0x6b'):_0x5b31('0x6c');return db[_0x5b31('0x6d')]['find']({'where':{'id':_0x2306a4[_0x5b31('0x6e')]},'attributes':[_0x5b31('0x6f'),_0x5b31('0x70')]})[_0x5b31('0x20')](function(_0x1ce6b7){if(!_[_0x5b31('0x71')](_0x699fbd)&&!_[_0x5b31('0x71')](_0x1ce6b7[_0x5b31('0x6f')])){_0x2306a4['calleridname']=_0x1ce6b7['firstName'];if(!_[_0x5b31('0x71')](_0x1ce6b7[_0x5b31('0x70')])){_0x2306a4[_0x5b31('0x72')]+='\x20'+_0x1ce6b7[_0x5b31('0x70')];}}})['finally'](function(){return db[_0x5b31('0x73')][_0x5b31('0x57')](_0x2306a4);});}})['then'](function(){return _0x699fbd['status'](0xcc)['end']();})[_0x5b31('0x54')](handleError(_0x699fbd,null));};exports[_0x5b31('0x74')]=function(_0x3f042a,_0x1d69e5,_0x357a52){var _0x1737c4=[];return db['CmContact'][_0x5b31('0x5a')]()['then'](function(_0x34d244){_0x1737c4=_['keys'](_0x34d244);return _0x3f042a['user'][_0x5b31('0x75')]({'where':{'type':_0x5b31('0x76'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x5b31('0x77'),_0x5b31('0x78')],'raw':!![]});})['then'](function(_0x9146ad){if(_0x9146ad&&_0x9146ad[_0x5b31('0x79')]){return db['sequelize']['transaction'](function(_0x3e0503){var _0x34ace3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5b31('0x7a')](_0x5b31('0x67'))},'VoiceQueueId':{'$in':_[_0x5b31('0x26')](_0x9146ad,'id')},'$or':[{'UserId':null},{'UserId':_0x3f042a[_0x5b31('0x64')]['id']}]};var _0x4f127d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x9146ad)[_0x5b31('0x4a')]([_0x5b31('0x78'),0x0])['map']('id')[_0x5b31('0x7b')]()},'$or':[{'UserId':null},{'UserId':_0x3f042a['user']['id']}]};var _0x585ace={'$or':[_0x34ace3,_0x4f127d]};var _0x1db39b=[];if(_0x3f042a['body'][_0x5b31('0x7c')]&&_0x3f042a[_0x5b31('0x58')]['direction']==='prev'){if(!_[_0x5b31('0x7d')](_0x3f042a['body'][_0x5b31('0x7e')])){_0x585ace['id']={'$in':_0x3f042a['body']['hopperIds']};}_0x1db39b=[[_0x5b31('0x7f'),_0x5b31('0x80')],[_0x5b31('0x81'),_0x9146ad[0x0]['dialOrderByScheduledAt']===_0x5b31('0x80')?_0x5b31('0x82'):_0x5b31('0x80')],db[_0x5b31('0x83')][_0x5b31('0x84')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x5b31('0x82')]];}else{if(!_['isEmpty'](_0x3f042a['body'][_0x5b31('0x7e')])){_0x585ace['id']={'$notIn':_0x3f042a[_0x5b31('0x58')][_0x5b31('0x7e')]};}_0x1db39b=[[_0x5b31('0x7f'),_0x5b31('0x82')],[_0x5b31('0x81'),_0x9146ad[0x0]['dialOrderByScheduledAt']],db[_0x5b31('0x83')][_0x5b31('0x84')](_0x5b31('0x85')),['id',_0x5b31('0x80')]];}return db[_0x5b31('0x4f')][_0x5b31('0x86')]({'attributes':['id',_0x5b31('0x87'),_0x5b31('0x88')],'where':_0x585ace,'order':_0x1db39b,'transaction':_0x3e0503,'lock':_0x3e0503['LOCK'][_0x5b31('0x89')],'include':[{'model':db[_0x5b31('0x6d')],'as':_0x5b31('0x8a'),'attributes':_0x1737c4,'include':[{'model':db[_0x5b31('0x8b')],'as':_0x5b31('0x8c'),'attributes':['id',_0x5b31('0x24')]}]},{'model':db['CmList'],'as':_0x5b31('0x8d'),'attributes':['id',_0x5b31('0x24')]},{'model':db[_0x5b31('0x5c')],'as':_0x5b31('0x8e'),'attributes':['id',_0x5b31('0x24'),_0x5b31('0x8f')]}]})[_0x5b31('0x20')](function(_0x1c12a0){if(_0x1c12a0){return _0x1c12a0['update']({'UserId':_0x3f042a[_0x5b31('0x64')]['id']},{'transaction':_0x3e0503});}});});}})[_0x5b31('0x20')](handleEntityNotFound(_0x1d69e5,null))[_0x5b31('0x20')](respondWithResult(_0x1d69e5,null))[_0x5b31('0x54')](handleError(_0x1d69e5,null));};exports['getPreviewRecall']=function(_0x5acbf1,_0x3d8e21,_0x2c4d94){var _0x450ca2=[];return db[_0x5b31('0x6d')]['describe']()['then'](function(_0x223505){_0x450ca2=_['keys'](_0x223505);return _0x5acbf1[_0x5b31('0x64')]['getVoiceQueues']({'where':{'type':_0x5b31('0x76'),'dialActive':!![],'dialMethod':_0x5b31('0x90')},'attributes':['id',_0x5b31('0x77'),_0x5b31('0x78')],'raw':!![]});})[_0x5b31('0x20')](function(_0x4dfc7f){if(_0x4dfc7f&&_0x4dfc7f[_0x5b31('0x79')]){return db[_0x5b31('0x83')][_0x5b31('0x91')](function(_0x3e5b2c){var _0x1c48f2={'active':![],'recallme':!![],'id':_0x5acbf1[_0x5b31('0x58')][_0x5b31('0x92')]};return db[_0x5b31('0x4f')][_0x5b31('0x86')]({'attributes':['id',_0x5b31('0x87'),'recallme'],'where':_0x1c48f2,'transaction':_0x3e5b2c,'lock':_0x3e5b2c[_0x5b31('0x93')][_0x5b31('0x89')],'include':[{'model':db[_0x5b31('0x6d')],'as':'Contact','attributes':_0x450ca2,'include':[{'model':db[_0x5b31('0x8b')],'as':_0x5b31('0x8c'),'attributes':['id',_0x5b31('0x24')]}]},{'model':db[_0x5b31('0x94')],'as':_0x5b31('0x8d'),'attributes':['id','name']},{'model':db[_0x5b31('0x5c')],'as':_0x5b31('0x8e'),'attributes':['id',_0x5b31('0x24'),'dialActive']}]})[_0x5b31('0x20')](function(_0x284ad){if(_0x284ad){return _0x284ad['update']({'UserId':_0x5acbf1[_0x5b31('0x64')]['id']},{'transaction':_0x3e5b2c});}});});}})[_0x5b31('0x20')](handleEntityNotFound(_0x3d8e21,null))[_0x5b31('0x20')](respondWithResult(_0x3d8e21,null))[_0x5b31('0x54')](handleError(_0x3d8e21,null));};exports[_0x5b31('0x95')]=function(_0x3889f6,_0x59dd8a,_0x2f1724){return _0x3889f6['user'][_0x5b31('0x75')]({'where':{'type':_0x5b31('0x76'),'dialActive':!![],'dialMethod':_0x5b31('0x90')},'attributes':['id'],'raw':!![]})[_0x5b31('0x20')](function(_0x7af008){if(_0x7af008&&_0x7af008[_0x5b31('0x79')]){return db[_0x5b31('0x4f')][_0x5b31('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5b31('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5b31('0x26')](_0x7af008,'id')},'$or':[{'UserId':null},{'UserId':_0x3889f6['user']['id']}]}});}return 0x0;})[_0x5b31('0x20')](function(_0x25b474){if(!_[_0x5b31('0x71')](_0x25b474)&&_[_0x5b31('0x96')](_0x25b474)){return _0x59dd8a[_0x5b31('0x18')](0xc8)[_0x5b31('0x19')]({'contacts':_0x25b474});}else{logger[_0x5b31('0x23')](_0x5b31('0x97'),_0x5b31('0x95'),0x194,'entity\x20not\x20found');_0x59dd8a[_0x5b31('0x17')](0x194);}})[_0x5b31('0x54')](handleError(_0x59dd8a,null));};exports['getTimezones']=function(_0x598830,_0x308e50,_0x52418a){var _0x4a594f=shared[_0x5b31('0x98')];var _0x30f02b=[];_[_0x5b31('0x26')](_0x4a594f,function(_0x49ff7c){_0x30f02b[_0x5b31('0x99')]({'id':_0x49ff7c['name'],'name':_0x49ff7c[_0x5b31('0x24')],'utcOffset':_0x49ff7c['utcOffset']});});return _0x308e50[_0x5b31('0x18')](0xc8)[_0x5b31('0x19')]({'tz':_0x30f02b});};exports[_0x5b31('0x9a')]=function(_0x5451d2,_0x33e0c5,_0x26413b){var _0x3cb460=shared['timezones'];var _0x18bcdf={};if(!_[_0x5b31('0x71')](_0x3cb460[_0x5451d2['body']['id']]))_0x18bcdf=_0x3cb460[_0x5451d2['body']['id']];return _0x33e0c5[_0x5b31('0x18')](0xc8)[_0x5b31('0x19')](_0x18bcdf);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1746494..df82e5d 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 _0x5fc3=['scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x498903,_0x503c20){var _0x51a96b=function(_0x14bff6){while(--_0x14bff6){_0x498903['push'](_0x498903['shift']());}};_0x51a96b(++_0x503c20);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x5fc3[_0x4b6830];return _0x239e4a;};'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')]('CmHopper',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]},{'name':_0x35fc('0xd'),'fields':[_0x35fc('0xd')]},{'name':_0x35fc('0xe'),'fields':[_0x35fc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x2bdf88,_0x515fec){var _0x487520=function(_0x161037){while(--_0x161037){_0x2bdf88['push'](_0x2bdf88['shift']());}};_0x487520(++_0x515fec);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 75cb547..fddc7d4 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 _0x3299=['GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','name','CmList','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../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','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','catch','ShowCmHopper','find','create','body','CreateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x3299,0x1f0));var _0x9329=function(_0x2ce960,_0x14b428){_0x2ce960=_0x2ce960-0x0;var _0x9a5742=_0x3299[_0x2ce960];return _0x9a5742;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9329('0x0'));var BPromise=require(_0x9329('0x1'));var rs=require(_0x9329('0x2'));var fs=require('fs');var Redis=require(_0x9329('0x3'));var db=require(_0x9329('0x4'))['db'];var utils=require(_0x9329('0x5'));var logger=require(_0x9329('0x6'))(_0x9329('0x7'));var config=require(_0x9329('0x8'));var jayson=require(_0x9329('0x9'));const {validateExpressRequest}=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9ebe,_0x4329ed,_0x5887a5){return new BPromise(function(_0x4e1df9,_0x5d806e){return client[_0x9329('0xc')](_0x2f9ebe,_0x5887a5)[_0x9329('0xd')](function(_0x2df5a9){logger[_0x9329('0xe')](_0x9329('0xf'),_0x4329ed,_0x9329('0x10'));logger[_0x9329('0x11')](_0x9329('0x12'),_0x4329ed,_0x9329('0x10'),JSON[_0x9329('0x13')](_0x2df5a9));if(_0x2df5a9['error']){if(_0x2df5a9[_0x9329('0x14')]['code']===0x1f4){logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x2df5a9['error']['message']);return _0x5d806e(_0x2df5a9['error'][_0x9329('0x15')]);}logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x2df5a9['error'][_0x9329('0x15')]);return _0x4e1df9(_0x2df5a9[_0x9329('0x14')]['message']);}else{logger[_0x9329('0xe')]('CmHopper,\x20%s,\x20%s',_0x4329ed,_0x9329('0x10'));_0x4e1df9(_0x2df5a9['result'][_0x9329('0x15')]);}})['catch'](function(_0x599813){logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x599813);_0x5d806e(_0x599813);});});}exports[_0x9329('0x16')]=function(_0xc9c73f){var _0x201cfc=this;return new Promise(function(_0x55d833,_0x413814){return db[_0x9329('0x17')][_0x9329('0x18')]({'raw':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0xc9c73f['options']?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')]['limit']||null:null,'include':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f['options'][_0x9329('0x1d')]?_['map'](_0xc9c73f[_0x9329('0x19')][_0x9329('0x1d')],function(_0x3088fe){return{'model':db[_0x3088fe[_0x9329('0x1e')]],'as':_0x3088fe['as'],'attributes':_0x3088fe[_0x9329('0x1c')],'include':_0x3088fe[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3088fe[_0x9329('0x1d')],function(_0x50cfdd){return{'model':db[_0x50cfdd[_0x9329('0x1e')]],'as':_0x50cfdd['as'],'attributes':_0x50cfdd[_0x9329('0x1c')],'include':_0x50cfdd[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x50cfdd[_0x9329('0x1d')],function(_0x277f24){return{'model':db[_0x277f24[_0x9329('0x1e')]],'as':_0x277f24['as'],'attributes':_0x277f24['attributes']};}):[]};}):[]};}):[]:[]})[_0x9329('0xd')](function(_0x2cd1af){logger[_0x9329('0xe')](_0x9329('0x16'),_0xc9c73f);logger[_0x9329('0x11')](_0x9329('0x16'),_0xc9c73f,JSON[_0x9329('0x13')](_0x2cd1af));_0x55d833(_0x2cd1af);})[_0x9329('0x20')](function(_0x528626){logger[_0x9329('0x14')](_0x9329('0x16'),_0x528626[_0x9329('0x15')],_0xc9c73f);_0x413814(_0x201cfc[_0x9329('0x14')](0x1f4,_0x528626['message']));});});};exports[_0x9329('0x21')]=function(_0x4582e1){var _0x260e87=this;return new Promise(function(_0x40c04a,_0xf01197){return db['CmHopper'][_0x9329('0x22')]({'raw':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')]['attributes']||null:null,'include':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')]['include']?_[_0x9329('0x1f')](_0x4582e1[_0x9329('0x19')][_0x9329('0x1d')],function(_0x32a5d9){return{'model':db[_0x32a5d9[_0x9329('0x1e')]],'as':_0x32a5d9['as'],'attributes':_0x32a5d9[_0x9329('0x1c')],'include':_0x32a5d9['include']?_[_0x9329('0x1f')](_0x32a5d9[_0x9329('0x1d')],function(_0xa32c30){return{'model':db[_0xa32c30['model']],'as':_0xa32c30['as'],'attributes':_0xa32c30['attributes'],'include':_0xa32c30[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0xa32c30[_0x9329('0x1d')],function(_0x4569e6){return{'model':db[_0x4569e6[_0x9329('0x1e')]],'as':_0x4569e6['as'],'attributes':_0x4569e6[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6ae08f){logger[_0x9329('0xe')](_0x9329('0x21'),_0x4582e1);logger[_0x9329('0x11')](_0x9329('0x21'),_0x4582e1,JSON['stringify'](_0x6ae08f));_0x40c04a(_0x6ae08f);})[_0x9329('0x20')](function(_0x4cc052){logger[_0x9329('0x14')](_0x9329('0x21'),_0x4cc052[_0x9329('0x15')],_0x4582e1);_0xf01197(_0x260e87['error'](0x1f4,_0x4cc052[_0x9329('0x15')]));});});};exports['CreateCmHopper']=function(_0x5b1980){var _0x4190c4=this;return new Promise(function(_0x1e2e89,_0x3c4225){return db[_0x9329('0x17')][_0x9329('0x23')](_0x5b1980[_0x9329('0x24')],{'raw':_0x5b1980[_0x9329('0x19')]?_0x5b1980['options'][_0x9329('0x1a')]===undefined?!![]:![]:!![]})[_0x9329('0xd')](function(_0x1c00b1){logger['info'](_0x9329('0x25'),_0x5b1980);logger[_0x9329('0x11')](_0x9329('0x25'),_0x5b1980,JSON[_0x9329('0x13')](_0x1c00b1));_0x1e2e89(_0x1c00b1);})['catch'](function(_0x222315){logger[_0x9329('0x14')](_0x9329('0x25'),_0x222315[_0x9329('0x15')],_0x5b1980);_0x3c4225(_0x4190c4[_0x9329('0x14')](0x1f4,_0x222315[_0x9329('0x15')]));});});};exports['UpdateCmHopper']=function(_0x20d0bf){var _0x4b98bb=this;return new Promise(function(_0x1b8dbd,_0xdfb871){return db['CmHopper'][_0x9329('0x26')](_0x20d0bf[_0x9329('0x24')],{'raw':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x27')]||null:null})['then'](function(_0x1e5d06){logger[_0x9329('0xe')]('UpdateCmHopper',_0x20d0bf);logger['info'](_0x9329('0x28'),JSON[_0x9329('0x13')](_0x20d0bf[_0x9329('0x19')][_0x9329('0x1b')]),_0x20d0bf[_0x9329('0x24')][_0x9329('0x29')]);logger[_0x9329('0x11')]('UpdateCmHopper',_0x20d0bf,JSON[_0x9329('0x13')](_0x1e5d06));_0x1b8dbd(_0x1e5d06);})[_0x9329('0x20')](function(_0x20357f){logger[_0x9329('0x14')]('UpdateCmHopper',_0x20357f['message'],_0x20d0bf);_0xdfb871(_0x4b98bb[_0x9329('0x14')](0x1f4,_0x20357f['message']));});});};exports[_0x9329('0x2a')]=function(_0xb7e8f5){var _0xd70740=this;return new Promise(function(_0x118a69,_0x2ab988){return db[_0x9329('0x17')][_0x9329('0x2b')]({'where':_0xb7e8f5[_0x9329('0x19')]?_0xb7e8f5[_0x9329('0x19')][_0x9329('0x1b')]||null:null})['then'](function(_0x197814){logger[_0x9329('0xe')](_0x9329('0x2a'),_0xb7e8f5);logger['debug'](_0x9329('0x2a'),_0xb7e8f5,JSON['stringify'](_0x197814));_0x118a69(_0x197814);})['catch'](function(_0x1624ce){logger[_0x9329('0x14')](_0x9329('0x2a'),_0x1624ce['message'],_0xb7e8f5);_0x2ab988(_0xd70740['error'](0x1f4,_0x1624ce[_0x9329('0x15')]));});});};exports[_0x9329('0x2c')]=function(_0x2b12a8){var _0x4f5ae7=this;return new Promise(function(_0x20df98,_0x3ef4bc){return db[_0x9329('0x2d')][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x1606e6){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x2116d7){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':_0x2b12a8['options']?_0x2b12a8[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x27')]||null:null,'order':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x31')]||null:null,'transaction':_0x2116d7,'lock':_0x2116d7[_0x9329('0x32')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x9329('0x33')](_0x1606e6)},{'model':db['User'],'as':_0x9329('0x34'),'attributes':['id','name',_0x9329('0x35')]}]})[_0x9329('0xd')](function(_0x101ccb){var _0x5cab48=[];var _0x569146=[];for(var _0x4e45b2=0x0;_0x4e45b2<_0x101ccb['length'];_0x4e45b2+=0x1){var _0x361e25=_0x101ccb[_0x4e45b2][_0x9329('0x36')];if(_0x361e25===null){_0x5cab48[_0x9329('0x37')](_0x101ccb[_0x4e45b2][_0x9329('0x26')](_0x2b12a8[_0x9329('0x24')],{'transaction':_0x2116d7}));}else if(!_0x569146[_0x9329('0x38')](_0x361e25)){_0x569146[_0x9329('0x37')](_0x361e25);_0x5cab48[_0x9329('0x37')](_0x101ccb[_0x4e45b2][_0x9329('0x26')](_0x2b12a8['body'],{'transaction':_0x2116d7}));}}return BPromise[_0x9329('0x39')](_0x5cab48);});})[_0x9329('0xd')](function(_0x5989bc){logger['info'](_0x9329('0x2c'),_0x2b12a8);if(_0x5989bc[_0x9329('0x3a')]>0x0){logger[_0x9329('0xe')](_0x9329('0x3b'),_0x5989bc[0x0][_0x9329('0x3c')]['id'],_0x5989bc[0x0][_0x9329('0x3c')][_0x9329('0x3d')],_0x5989bc[0x0][_0x9329('0x3c')][_0x9329('0x29')]);}logger[_0x9329('0x11')](_0x9329('0x2c'),_0x2b12a8,JSON['stringify'](_0x5989bc));_0x20df98(_0x5989bc);})['catch'](function(_0x4aeef1){logger['error']('GetContactDialer',_0x4aeef1['message'],_0x2b12a8);_0x3ef4bc(_0x4f5ae7[_0x9329('0x14')](0x1f4,_0x4aeef1['message']));});});});};exports[_0x9329('0x3e')]=function(_0x20a0dd){var _0x166397=this;return new Promise(function(_0x2532fa,_0x57e296){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x2ee519){return db[_0x9329('0x3f')][_0x9329('0x23')](_0x20a0dd[_0x9329('0x24')],{'raw':_0x20a0dd[_0x9329('0x19')]?_0x20a0dd[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x2ee519})[_0x9329('0xd')](function(){logger['info'](_0x9329('0x40'),JSON[_0x9329('0x13')](_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')]),_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')][_0x9329('0x29')]);return db['CmHopper'][_0x9329('0x2b')]({'where':_0x20a0dd[_0x9329('0x19')]?_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'transaction':_0x2ee519});});})[_0x9329('0xd')](function(_0x43ec17){logger['info'](_0x9329('0x3e'),_0x20a0dd);logger[_0x9329('0x11')](_0x9329('0x3e'),_0x20a0dd,JSON[_0x9329('0x13')](_0x43ec17));_0x2532fa(_0x43ec17);})[_0x9329('0x20')](function(_0x5779f0){logger[_0x9329('0x14')](_0x9329('0x3e'),_0x5779f0[_0x9329('0x15')],_0x20a0dd);_0x57e296(_0x166397['error'](0x1f4,_0x5779f0['message']));});});};exports['CountReScheduled']=function(_0x209e53){var _0x96fea4=this;return new Promise(function(_0x294a8f,_0xf8f428){return db['CmHopper'][_0x9329('0x18')]({'raw':_0x209e53['options']?_0x209e53[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x209e53[_0x9329('0x19')]?_0x209e53['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x9329('0x2f')]['fn']('IF',db[_0x9329('0x2f')][_0x9329('0x41')]('`scheduledat`\x20>=\x20'+util[_0x9329('0x42')]('\x22%s\x22',moment()['format'](_0x9329('0x43')))+_0x9329('0x44')))),_0x9329('0x45')]]})['then'](function(_0x48a729){logger['info'](_0x9329('0x46'),_0x209e53);logger[_0x9329('0x11')](_0x9329('0x46'),_0x209e53,JSON['stringify'](_0x48a729));_0x294a8f(_0x48a729);})[_0x9329('0x20')](function(_0x1b178c){logger[_0x9329('0x14')](_0x9329('0x46'),_0x1b178c[_0x9329('0x15')],_0x209e53);_0xf8f428(_0x96fea4[_0x9329('0x14')](0x1f4,_0x1b178c[_0x9329('0x15')]));});});};exports[_0x9329('0x47')]=function(_0x3a4bd4){var _0x49b0fb=this;return new Promise(function(_0x28acc1,_0x1aad23){return db[_0x9329('0x2d')][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x11f033){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x3e5b85){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':0x1,'order':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x31')]||null:null,'group':db[_0x9329('0x17')][_0x9329('0x36')],'transaction':_0x3e5b85,'lock':_0x3e5b85[_0x9329('0x32')][_0x9329('0x48')],'include':_0x3a4bd4['options']?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3a4bd4[_0x9329('0x19')]['include'],function(_0x2b2f0b){return{'model':db[_0x2b2f0b[_0x9329('0x1e')]],'as':_0x2b2f0b['as'],'attributes':_0x2b2f0b[_0x9329('0x1c')],'include':_0x2b2f0b[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x2b2f0b[_0x9329('0x1d')],function(_0x4035bb){return{'model':db[_0x4035bb[_0x9329('0x1e')]],'as':_0x4035bb['as'],'attributes':_0x4035bb['attributes'],'include':_0x4035bb['include']?_[_0x9329('0x1f')](_0x4035bb['include'],function(_0x59a5e5){return{'model':db[_0x59a5e5[_0x9329('0x1e')]],'as':_0x59a5e5['as'],'attributes':_0x59a5e5[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e9adf){var _0x4f42d9=[];for(var _0xf11731=0x0;_0xf11731<_0x1e9adf['length'];_0xf11731+=0x1){_0x4f42d9[_0x9329('0x37')](_0x1e9adf[_0xf11731][_0x9329('0x26')](_0x3a4bd4[_0x9329('0x24')],{'transaction':_0x3e5b85}));}return BPromise['all'](_0x4f42d9);});})[_0x9329('0xd')](function(_0x3d659a){logger[_0x9329('0xe')](_0x9329('0x47'),_0x3a4bd4);logger[_0x9329('0x11')](_0x9329('0x47'),_0x3a4bd4,JSON[_0x9329('0x13')](_0x3d659a));_0x28acc1(_0x3d659a);})[_0x9329('0x20')](function(_0x2a3304){logger[_0x9329('0x14')]('GetContactRecallMe',_0x2a3304[_0x9329('0x15')],_0x3a4bd4);_0x1aad23(_0x49b0fb['error'](0x1f4,_0x2a3304['message']));});});});};exports[_0x9329('0x49')]=function(_0x3e01fb){var _0x124cf8=this;return new Promise(function(_0x42704c,_0x1a05e3){db['CmContact'][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x2f125f){return db[_0x9329('0x17')][_0x9329('0x18')]({'raw':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')]['where']||null:null,'attributes':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb['options']['limit']||null:null,'include':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3e01fb[_0x9329('0x19')][_0x9329('0x1d')],function(_0x34cd64){return{'model':db[_0x34cd64[_0x9329('0x1e')]],'as':_0x34cd64['as'],'attributes':_0x34cd64['as']===_0x9329('0x4a')?_[_0x9329('0x33')](_0x2f125f):_0x34cd64['attributes'],'include':_0x34cd64[_0x9329('0x1d')]?_['map'](_0x34cd64[_0x9329('0x1d')],function(_0x5085ce){return{'model':db[_0x5085ce[_0x9329('0x1e')]],'as':_0x5085ce['as'],'attributes':_0x5085ce['attributes'],'include':_0x5085ce[_0x9329('0x1d')]?_['map'](_0x5085ce['include'],function(_0x20630c){return{'model':db[_0x20630c['model']],'as':_0x20630c['as'],'attributes':_0x20630c[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9329('0xd')](function(_0x32afce){logger['info']('GetCmHopper',_0x3e01fb);logger['debug'](_0x9329('0x16'),_0x3e01fb,JSON['stringify'](_0x32afce));_0x42704c(_0x32afce);})[_0x9329('0x20')](function(_0x511eab){logger['error'](_0x9329('0x16'),_0x511eab['message'],_0x3e01fb);_0x1a05e3(_0x124cf8[_0x9329('0x14')](0x1f4,_0x511eab['message']));});});});};exports[_0x9329('0x4b')]=function(_0x21b290){var _0x26d8de=this;return new Promise(function(_0x2ddf9c,_0x6bb610){return db[_0x9329('0x2d')][_0x9329('0x4c')]({'raw':!![],'where':{'phone':_0x21b290[_0x9329('0x19')][_0x9329('0x1b')]['phone']},'attributes':['id',_0x9329('0x4d')],'order':[['id',_0x9329('0x4e')]]})['then'](function(_0x34d658){logger['info'](_0x9329('0x4f'),_0x21b290);logger['debug'](_0x9329('0x4f'),_0x21b290,JSON[_0x9329('0x13')](_0x34d658));_0x2ddf9c(_0x34d658);})[_0x9329('0x20')](function(_0x70a33a){logger[_0x9329('0x14')](_0x9329('0x4f'),_0x70a33a[_0x9329('0x15')],_0x21b290);_0x6bb610(_0x26d8de[_0x9329('0x14')](0x1f4,_0x70a33a['message']));});});};exports[_0x9329('0x50')]=function(_0x4ca2fc){var _0x1a4a90=this;return new Promise(function(_0x175e35,_0x56bc51){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x426e7c){return db['CmHopper'][_0x9329('0x26')]({'active':![]},{'where':{},'transaction':_0x426e7c})[_0x9329('0xd')](function(_0x4bf935){logger[_0x9329('0xe')](_0x9329('0x50'),_0x4ca2fc);logger[_0x9329('0x11')]('ResetActiveCalls',_0x4ca2fc,JSON[_0x9329('0x13')](_0x4bf935));_0x175e35(_0x4bf935);})[_0x9329('0x20')](function(_0x5dbc08){logger[_0x9329('0x14')](_0x9329('0x50'),_0x5dbc08[_0x9329('0x15')],_0x4ca2fc);_0x56bc51(_0x1a4a90[_0x9329('0x14')](0x1f4,_0x5dbc08['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1c90b6){var _0x5157ca=this;var _0x549474=_0x1c90b6[_0x9329('0x24')]['where'][_0x9329('0x51')];var _0x166c4c=_0x1c90b6[_0x9329('0x24')][_0x9329('0x1b')][_0x9329('0x52')];return new Promise(function(_0x3005fb,_0xb83415){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':{'voiceQueueId':_0x549474,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9329('0x2f')]['literal'](_0x9329('0x53')+_0x166c4c+_0x9329('0x54'))}},'include':[{'model':db[_0x9329('0x2d')],'as':_0x9329('0x4a')},{'model':db[_0x9329('0x55')],'as':_0x9329('0x34'),'attributes':['id',_0x9329('0x56'),_0x9329('0x35')]},{'model':db[_0x9329('0x57')],'as':_0x9329('0x58')}]})[_0x9329('0xd')](function(_0xdae3cb){return db['sequelize'][_0x9329('0x30')](function(_0x4c9872){return db[_0x9329('0x17')][_0x9329('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x549474,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9329('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x166c4c+_0x9329('0x54'))}},'transaction':_0x4c9872})[_0x9329('0xd')](function(_0x3b9688){_0x3005fb(_0xdae3cb);})[_0x9329('0x20')](function(_0x1d85ea){logger[_0x9329('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x1d85ea[_0x9329('0x15')],_0x1c90b6);_0xb83415(validateExpressRequest);});});})['catch'](function(_0x12a88a){logger[_0x9329('0x14')](_0x9329('0x59'),_0x12a88a[_0x9329('0x15')],_0x1c90b6);_0xb83415(_0x5157ca[_0x9329('0x14')](0x1f4,_0x12a88a[_0x9329('0x15')]));});});}; \ No newline at end of file +var _0xe515=['contactsRescheduled','GetContactRecallMe','UPDATE','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','twilio/lib/webhooks/webhooks','client','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCmHopper','CmHopper','options','raw','where','limit','map','include','model','attributes','catch','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','order','LOCK','CmContact','Contact','User','Agent','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null'];(function(_0x5574e5,_0x2287ce){var _0x47d890=function(_0x4a85c6){while(--_0x4a85c6){_0x5574e5['push'](_0x5574e5['shift']());}};_0x47d890(++_0x2287ce);}(_0xe515,0x16b));var _0x5e51=function(_0x252577,_0xb65db8){_0x252577=_0x252577-0x0;var _0x12dd5c=_0xe515[_0x252577];return _0x12dd5c;};'use strict';var _=require('lodash');var util=require(_0x5e51('0x0'));var moment=require(_0x5e51('0x1'));var BPromise=require(_0x5e51('0x2'));var rs=require(_0x5e51('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e51('0x4'));var logger=require('../../config/logger')(_0x5e51('0x5'));var config=require('../../config/environment');var jayson=require(_0x5e51('0x6'));const {validateExpressRequest}=require(_0x5e51('0x7'));var client=jayson[_0x5e51('0x8')][_0x5e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54d314,_0x419637,_0x37780b){return new BPromise(function(_0x1a7833,_0x2be285){return client['request'](_0x54d314,_0x37780b)[_0x5e51('0xa')](function(_0x297886){logger['info'](_0x5e51('0xb'),_0x419637,_0x5e51('0xc'));logger[_0x5e51('0xd')](_0x5e51('0xe'),_0x419637,'request\x20sent',JSON[_0x5e51('0xf')](_0x297886));if(_0x297886[_0x5e51('0x10')]){if(_0x297886[_0x5e51('0x10')]['code']===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x419637,_0x297886['error']['message']);return _0x2be285(_0x297886[_0x5e51('0x10')][_0x5e51('0x11')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x419637,_0x297886['error'][_0x5e51('0x11')]);return _0x1a7833(_0x297886[_0x5e51('0x10')][_0x5e51('0x11')]);}else{logger[_0x5e51('0x12')]('CmHopper,\x20%s,\x20%s',_0x419637,_0x5e51('0xc'));_0x1a7833(_0x297886[_0x5e51('0x13')]['message']);}})['catch'](function(_0x197555){logger[_0x5e51('0x10')](_0x5e51('0xb'),_0x419637,_0x197555);_0x2be285(_0x197555);});});}exports[_0x5e51('0x14')]=function(_0x3d89c2){var _0x4b4f92=this;return new Promise(function(_0x3eaefc,_0x566771){return db[_0x5e51('0x15')]['findAll']({'raw':_0x3d89c2['options']?_0x3d89c2[_0x5e51('0x16')][_0x5e51('0x17')]===undefined?!![]:![]:!![],'where':_0x3d89c2['options']?_0x3d89c2[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0x3d89c2[_0x5e51('0x16')]?_0x3d89c2[_0x5e51('0x16')]['attributes']||null:null,'limit':_0x3d89c2[_0x5e51('0x16')]?_0x3d89c2[_0x5e51('0x16')][_0x5e51('0x19')]||null:null,'include':_0x3d89c2[_0x5e51('0x16')]?_0x3d89c2[_0x5e51('0x16')]['include']?_[_0x5e51('0x1a')](_0x3d89c2[_0x5e51('0x16')][_0x5e51('0x1b')],function(_0x1e9bc4){return{'model':db[_0x1e9bc4[_0x5e51('0x1c')]],'as':_0x1e9bc4['as'],'attributes':_0x1e9bc4[_0x5e51('0x1d')],'include':_0x1e9bc4[_0x5e51('0x1b')]?_[_0x5e51('0x1a')](_0x1e9bc4['include'],function(_0x5d98c9){return{'model':db[_0x5d98c9[_0x5e51('0x1c')]],'as':_0x5d98c9['as'],'attributes':_0x5d98c9[_0x5e51('0x1d')],'include':_0x5d98c9['include']?_[_0x5e51('0x1a')](_0x5d98c9[_0x5e51('0x1b')],function(_0x528668){return{'model':db[_0x528668[_0x5e51('0x1c')]],'as':_0x528668['as'],'attributes':_0x528668[_0x5e51('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e51('0xa')](function(_0x456bbf){logger[_0x5e51('0x12')](_0x5e51('0x14'),_0x3d89c2);logger[_0x5e51('0xd')](_0x5e51('0x14'),_0x3d89c2,JSON[_0x5e51('0xf')](_0x456bbf));_0x3eaefc(_0x456bbf);})[_0x5e51('0x1e')](function(_0x3e5e0b){logger['error']('GetCmHopper',_0x3e5e0b[_0x5e51('0x11')],_0x3d89c2);_0x566771(_0x4b4f92[_0x5e51('0x10')](0x1f4,_0x3e5e0b[_0x5e51('0x11')]));});});};exports[_0x5e51('0x1f')]=function(_0x86e686){var _0x295a2b=this;return new Promise(function(_0x3444e9,_0x3f389b){return db[_0x5e51('0x15')][_0x5e51('0x20')]({'raw':_0x86e686[_0x5e51('0x16')]?_0x86e686['options']['raw']===undefined?!![]:![]:!![],'where':_0x86e686[_0x5e51('0x16')]?_0x86e686[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0x86e686[_0x5e51('0x16')]?_0x86e686[_0x5e51('0x16')][_0x5e51('0x1d')]||null:null,'include':_0x86e686['options']?_0x86e686[_0x5e51('0x16')][_0x5e51('0x1b')]?_['map'](_0x86e686[_0x5e51('0x16')][_0x5e51('0x1b')],function(_0x2000a0){return{'model':db[_0x2000a0[_0x5e51('0x1c')]],'as':_0x2000a0['as'],'attributes':_0x2000a0[_0x5e51('0x1d')],'include':_0x2000a0[_0x5e51('0x1b')]?_[_0x5e51('0x1a')](_0x2000a0[_0x5e51('0x1b')],function(_0x31f767){return{'model':db[_0x31f767[_0x5e51('0x1c')]],'as':_0x31f767['as'],'attributes':_0x31f767[_0x5e51('0x1d')],'include':_0x31f767['include']?_[_0x5e51('0x1a')](_0x31f767['include'],function(_0x1adffa){return{'model':db[_0x1adffa['model']],'as':_0x1adffa['as'],'attributes':_0x1adffa[_0x5e51('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e51('0xa')](function(_0x4f9dac){logger[_0x5e51('0x12')](_0x5e51('0x1f'),_0x86e686);logger[_0x5e51('0xd')]('ShowCmHopper',_0x86e686,JSON[_0x5e51('0xf')](_0x4f9dac));_0x3444e9(_0x4f9dac);})['catch'](function(_0x895521){logger[_0x5e51('0x10')]('ShowCmHopper',_0x895521[_0x5e51('0x11')],_0x86e686);_0x3f389b(_0x295a2b['error'](0x1f4,_0x895521[_0x5e51('0x11')]));});});};exports['CreateCmHopper']=function(_0x28445c){var _0x4c5099=this;return new Promise(function(_0x2489ba,_0x13e3f6){return db[_0x5e51('0x15')][_0x5e51('0x21')](_0x28445c[_0x5e51('0x22')],{'raw':_0x28445c[_0x5e51('0x16')]?_0x28445c[_0x5e51('0x16')][_0x5e51('0x17')]===undefined?!![]:![]:!![]})[_0x5e51('0xa')](function(_0x329e7c){logger[_0x5e51('0x12')]('CreateCmHopper',_0x28445c);logger['debug'](_0x5e51('0x23'),_0x28445c,JSON['stringify'](_0x329e7c));_0x2489ba(_0x329e7c);})[_0x5e51('0x1e')](function(_0x5949f7){logger['error'](_0x5e51('0x23'),_0x5949f7[_0x5e51('0x11')],_0x28445c);_0x13e3f6(_0x4c5099[_0x5e51('0x10')](0x1f4,_0x5949f7[_0x5e51('0x11')]));});});};exports[_0x5e51('0x24')]=function(_0xa9f290){var _0x2cec46=this;return new Promise(function(_0x5387ef,_0x1bb2b9){return db[_0x5e51('0x15')][_0x5e51('0x25')](_0xa9f290[_0x5e51('0x22')],{'raw':_0xa9f290[_0x5e51('0x16')]?_0xa9f290[_0x5e51('0x16')][_0x5e51('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9f290['options']?_0xa9f290[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0xa9f290[_0x5e51('0x16')]?_0xa9f290[_0x5e51('0x16')][_0x5e51('0x1d')]||null:null,'limit':_0xa9f290[_0x5e51('0x16')]?_0xa9f290[_0x5e51('0x16')][_0x5e51('0x19')]||null:null})['then'](function(_0x438c7f){logger['info'](_0x5e51('0x24'),_0xa9f290);logger[_0x5e51('0x12')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0xa9f290['options'][_0x5e51('0x18')]),_0xa9f290[_0x5e51('0x22')]['active']);logger[_0x5e51('0xd')](_0x5e51('0x24'),_0xa9f290,JSON[_0x5e51('0xf')](_0x438c7f));_0x5387ef(_0x438c7f);})[_0x5e51('0x1e')](function(_0x294ce8){logger[_0x5e51('0x10')]('UpdateCmHopper',_0x294ce8['message'],_0xa9f290);_0x1bb2b9(_0x2cec46[_0x5e51('0x10')](0x1f4,_0x294ce8[_0x5e51('0x11')]));});});};exports[_0x5e51('0x26')]=function(_0x4426c4){var _0x1f5720=this;return new Promise(function(_0x4d9460,_0x8a427a){return db[_0x5e51('0x15')][_0x5e51('0x27')]({'where':_0x4426c4[_0x5e51('0x16')]?_0x4426c4['options'][_0x5e51('0x18')]||null:null})[_0x5e51('0xa')](function(_0xfb8de5){logger['info'](_0x5e51('0x26'),_0x4426c4);logger[_0x5e51('0xd')](_0x5e51('0x26'),_0x4426c4,JSON[_0x5e51('0xf')](_0xfb8de5));_0x4d9460(_0xfb8de5);})[_0x5e51('0x1e')](function(_0x2aa40c){logger[_0x5e51('0x10')](_0x5e51('0x26'),_0x2aa40c['message'],_0x4426c4);_0x8a427a(_0x1f5720[_0x5e51('0x10')](0x1f4,_0x2aa40c[_0x5e51('0x11')]));});});};exports[_0x5e51('0x28')]=function(_0x5851dc){var _0x11ff0f=this;return new Promise(function(_0x486148,_0x4ebd3b){return db['CmContact'][_0x5e51('0x29')]()[_0x5e51('0xa')](function(_0x14c806){return db[_0x5e51('0x2a')][_0x5e51('0x2b')](function(_0x169d48){return db[_0x5e51('0x15')][_0x5e51('0x2c')]({'where':_0x5851dc[_0x5e51('0x16')]?_0x5851dc[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0x5851dc[_0x5e51('0x16')]?_0x5851dc['options'][_0x5e51('0x1d')]||null:null,'limit':_0x5851dc[_0x5e51('0x16')]?_0x5851dc['options'][_0x5e51('0x19')]||null:null,'order':_0x5851dc[_0x5e51('0x16')]?_0x5851dc[_0x5e51('0x16')][_0x5e51('0x2d')]||null:null,'transaction':_0x169d48,'lock':_0x169d48[_0x5e51('0x2e')]['UPDATE'],'include':[{'model':db[_0x5e51('0x2f')],'as':_0x5e51('0x30'),'attributes':_['keys'](_0x14c806)},{'model':db[_0x5e51('0x31')],'as':_0x5e51('0x32'),'attributes':['id','name','voicePause']}]})[_0x5e51('0xa')](function(_0x1e3402){var _0x35b2b5=[];var _0x3cb667=[];for(var _0x57c54e=0x0;_0x57c54e<_0x1e3402[_0x5e51('0x33')];_0x57c54e+=0x1){var _0x5e6984=_0x1e3402[_0x57c54e][_0x5e51('0x34')];if(_0x5e6984===null){_0x35b2b5[_0x5e51('0x35')](_0x1e3402[_0x57c54e][_0x5e51('0x25')](_0x5851dc[_0x5e51('0x22')],{'transaction':_0x169d48}));}else if(!_0x3cb667['includes'](_0x5e6984)){_0x3cb667[_0x5e51('0x35')](_0x5e6984);_0x35b2b5[_0x5e51('0x35')](_0x1e3402[_0x57c54e][_0x5e51('0x25')](_0x5851dc['body'],{'transaction':_0x169d48}));}}return BPromise[_0x5e51('0x36')](_0x35b2b5);});})['then'](function(_0x552d35){logger[_0x5e51('0x12')](_0x5e51('0x28'),_0x5851dc);if(_0x552d35[_0x5e51('0x33')]>0x0){logger['info'](_0x5e51('0x37'),_0x552d35[0x0][_0x5e51('0x38')]['id'],_0x552d35[0x0][_0x5e51('0x38')][_0x5e51('0x39')],_0x552d35[0x0][_0x5e51('0x38')][_0x5e51('0x3a')]);}logger[_0x5e51('0xd')]('GetContactDialer',_0x5851dc,JSON[_0x5e51('0xf')](_0x552d35));_0x486148(_0x552d35);})[_0x5e51('0x1e')](function(_0x233ab1){logger['error'](_0x5e51('0x28'),_0x233ab1[_0x5e51('0x11')],_0x5851dc);_0x4ebd3b(_0x11ff0f[_0x5e51('0x10')](0x1f4,_0x233ab1[_0x5e51('0x11')]));});});});};exports[_0x5e51('0x3b')]=function(_0x321cbf){var _0x495f25=this;return new Promise(function(_0x1789fd,_0x49ba2){return db[_0x5e51('0x2a')]['transaction'](function(_0x1edb55){return db['CmHopperFinal'][_0x5e51('0x21')](_0x321cbf[_0x5e51('0x22')],{'raw':_0x321cbf['options']?_0x321cbf[_0x5e51('0x16')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1edb55})[_0x5e51('0xa')](function(){logger['info'](_0x5e51('0x3c'),JSON[_0x5e51('0xf')](_0x321cbf[_0x5e51('0x16')][_0x5e51('0x18')]),_0x321cbf['options'][_0x5e51('0x18')][_0x5e51('0x3a')]);return db[_0x5e51('0x15')][_0x5e51('0x27')]({'where':_0x321cbf['options']?_0x321cbf[_0x5e51('0x16')]['where']||null:null,'transaction':_0x1edb55});});})[_0x5e51('0xa')](function(_0x408633){logger[_0x5e51('0x12')]('MoveContactManagedDialer',_0x321cbf);logger[_0x5e51('0xd')](_0x5e51('0x3b'),_0x321cbf,JSON[_0x5e51('0xf')](_0x408633));_0x1789fd(_0x408633);})[_0x5e51('0x1e')](function(_0xc1f2bd){logger[_0x5e51('0x10')](_0x5e51('0x3b'),_0xc1f2bd[_0x5e51('0x11')],_0x321cbf);_0x49ba2(_0x495f25[_0x5e51('0x10')](0x1f4,_0xc1f2bd['message']));});});};exports[_0x5e51('0x3d')]=function(_0x26e6a1){var _0x25fc90=this;return new Promise(function(_0x30b85e,_0x4711b2){return db[_0x5e51('0x15')]['findAll']({'raw':_0x26e6a1[_0x5e51('0x16')]?_0x26e6a1['options'][_0x5e51('0x17')]===undefined?!![]:![]:!![],'where':_0x26e6a1[_0x5e51('0x16')]?_0x26e6a1[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':[[db[_0x5e51('0x2a')]['fn']('COUNT',db[_0x5e51('0x2a')]['fn']('IF',db[_0x5e51('0x2a')][_0x5e51('0x3e')](_0x5e51('0x3f')+util['format'](_0x5e51('0x40'),moment()['format'](_0x5e51('0x41')))+_0x5e51('0x42')))),_0x5e51('0x43')]]})['then'](function(_0x15bede){logger['info'](_0x5e51('0x3d'),_0x26e6a1);logger['debug'](_0x5e51('0x3d'),_0x26e6a1,JSON[_0x5e51('0xf')](_0x15bede));_0x30b85e(_0x15bede);})[_0x5e51('0x1e')](function(_0x35ac69){logger[_0x5e51('0x10')](_0x5e51('0x3d'),_0x35ac69[_0x5e51('0x11')],_0x26e6a1);_0x4711b2(_0x25fc90[_0x5e51('0x10')](0x1f4,_0x35ac69[_0x5e51('0x11')]));});});};exports[_0x5e51('0x44')]=function(_0x487039){var _0x5489f5=this;return new Promise(function(_0x49d68d,_0x3d5c24){return db[_0x5e51('0x2f')][_0x5e51('0x29')]()[_0x5e51('0xa')](function(_0x24697e){return db[_0x5e51('0x2a')][_0x5e51('0x2b')](function(_0x439d0e){return db[_0x5e51('0x15')][_0x5e51('0x2c')]({'where':_0x487039[_0x5e51('0x16')]?_0x487039[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0x487039[_0x5e51('0x16')]?_0x487039[_0x5e51('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x487039['options']?_0x487039[_0x5e51('0x16')][_0x5e51('0x2d')]||null:null,'group':db[_0x5e51('0x15')]['UserId'],'transaction':_0x439d0e,'lock':_0x439d0e[_0x5e51('0x2e')][_0x5e51('0x45')],'include':_0x487039[_0x5e51('0x16')]?_0x487039[_0x5e51('0x16')]['include']?_['map'](_0x487039[_0x5e51('0x16')][_0x5e51('0x1b')],function(_0x19f26b){return{'model':db[_0x19f26b[_0x5e51('0x1c')]],'as':_0x19f26b['as'],'attributes':_0x19f26b[_0x5e51('0x1d')],'include':_0x19f26b[_0x5e51('0x1b')]?_[_0x5e51('0x1a')](_0x19f26b[_0x5e51('0x1b')],function(_0x1390a8){return{'model':db[_0x1390a8[_0x5e51('0x1c')]],'as':_0x1390a8['as'],'attributes':_0x1390a8[_0x5e51('0x1d')],'include':_0x1390a8[_0x5e51('0x1b')]?_[_0x5e51('0x1a')](_0x1390a8[_0x5e51('0x1b')],function(_0x21b224){return{'model':db[_0x21b224[_0x5e51('0x1c')]],'as':_0x21b224['as'],'attributes':_0x21b224['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e51('0xa')](function(_0x5c208e){var _0x5417c3=[];for(var _0x5e112b=0x0;_0x5e112b<_0x5c208e[_0x5e51('0x33')];_0x5e112b+=0x1){_0x5417c3[_0x5e51('0x35')](_0x5c208e[_0x5e112b][_0x5e51('0x25')](_0x487039['body'],{'transaction':_0x439d0e}));}return BPromise[_0x5e51('0x36')](_0x5417c3);});})[_0x5e51('0xa')](function(_0x5dd77f){logger[_0x5e51('0x12')](_0x5e51('0x44'),_0x487039);logger[_0x5e51('0xd')](_0x5e51('0x44'),_0x487039,JSON[_0x5e51('0xf')](_0x5dd77f));_0x49d68d(_0x5dd77f);})[_0x5e51('0x1e')](function(_0x5a6c64){logger[_0x5e51('0x10')]('GetContactRecallMe',_0x5a6c64['message'],_0x487039);_0x3d5c24(_0x5489f5[_0x5e51('0x10')](0x1f4,_0x5a6c64[_0x5e51('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x24bae5){var _0xe2172e=this;return new Promise(function(_0x4ab578,_0x5d4d05){db[_0x5e51('0x2f')][_0x5e51('0x29')]()[_0x5e51('0xa')](function(_0xebb07f){return db[_0x5e51('0x15')][_0x5e51('0x2c')]({'raw':_0x24bae5['options']?_0x24bae5[_0x5e51('0x16')][_0x5e51('0x17')]===undefined?!![]:![]:!![],'where':_0x24bae5[_0x5e51('0x16')]?_0x24bae5[_0x5e51('0x16')][_0x5e51('0x18')]||null:null,'attributes':_0x24bae5['options']?_0x24bae5['options'][_0x5e51('0x1d')]||null:null,'limit':_0x24bae5[_0x5e51('0x16')]?_0x24bae5[_0x5e51('0x16')][_0x5e51('0x19')]||null:null,'include':_0x24bae5[_0x5e51('0x16')]?_0x24bae5['options'][_0x5e51('0x1b')]?_['map'](_0x24bae5[_0x5e51('0x16')][_0x5e51('0x1b')],function(_0x2de91d){return{'model':db[_0x2de91d[_0x5e51('0x1c')]],'as':_0x2de91d['as'],'attributes':_0x2de91d['as']==='Contact'?_[_0x5e51('0x46')](_0xebb07f):_0x2de91d[_0x5e51('0x1d')],'include':_0x2de91d[_0x5e51('0x1b')]?_[_0x5e51('0x1a')](_0x2de91d['include'],function(_0x4b398c){return{'model':db[_0x4b398c['model']],'as':_0x4b398c['as'],'attributes':_0x4b398c[_0x5e51('0x1d')],'include':_0x4b398c['include']?_[_0x5e51('0x1a')](_0x4b398c['include'],function(_0x3dd932){return{'model':db[_0x3dd932['model']],'as':_0x3dd932['as'],'attributes':_0x3dd932[_0x5e51('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e51('0xa')](function(_0xc653cd){logger['info'](_0x5e51('0x14'),_0x24bae5);logger[_0x5e51('0xd')](_0x5e51('0x14'),_0x24bae5,JSON['stringify'](_0xc653cd));_0x4ab578(_0xc653cd);})[_0x5e51('0x1e')](function(_0x6da072){logger['error'](_0x5e51('0x14'),_0x6da072[_0x5e51('0x11')],_0x24bae5);_0x5d4d05(_0xe2172e[_0x5e51('0x10')](0x1f4,_0x6da072[_0x5e51('0x11')]));});});});};exports[_0x5e51('0x47')]=function(_0x5b2000){var _0x8658d7=this;return new Promise(function(_0x7a1707,_0x2a9bac){return db[_0x5e51('0x2f')][_0x5e51('0x48')]({'raw':!![],'where':{'phone':_0x5b2000[_0x5e51('0x16')][_0x5e51('0x18')]['phone']},'attributes':['id',_0x5e51('0x49')],'order':[['id',_0x5e51('0x4a')]]})[_0x5e51('0xa')](function(_0x26e56e){logger['info'](_0x5e51('0x4b'),_0x5b2000);logger[_0x5e51('0xd')](_0x5e51('0x4b'),_0x5b2000,JSON[_0x5e51('0xf')](_0x26e56e));_0x7a1707(_0x26e56e);})['catch'](function(_0x3786ba){logger[_0x5e51('0x10')](_0x5e51('0x4b'),_0x3786ba[_0x5e51('0x11')],_0x5b2000);_0x2a9bac(_0x8658d7['error'](0x1f4,_0x3786ba[_0x5e51('0x11')]));});});};exports['ResetActiveCalls']=function(_0x3e623d){var _0xecb883=this;return new Promise(function(_0x283029,_0x35b554){return db[_0x5e51('0x2a')][_0x5e51('0x2b')](function(_0x4f41a2){return db['CmHopper'][_0x5e51('0x25')]({'active':![]},{'where':{},'transaction':_0x4f41a2})['then'](function(_0x358b46){logger[_0x5e51('0x12')]('ResetActiveCalls',_0x3e623d);logger['debug'](_0x5e51('0x4c'),_0x3e623d,JSON[_0x5e51('0xf')](_0x358b46));_0x283029(_0x358b46);})[_0x5e51('0x1e')](function(_0x113391){logger[_0x5e51('0x10')](_0x5e51('0x4c'),_0x113391[_0x5e51('0x11')],_0x3e623d);_0x35b554(_0xecb883[_0x5e51('0x10')](0x1f4,_0x113391[_0x5e51('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x3ffaae){var _0x541f52=this;var _0x3fe851=_0x3ffaae[_0x5e51('0x22')][_0x5e51('0x18')][_0x5e51('0x4d')];var _0x1aacce=_0x3ffaae[_0x5e51('0x22')][_0x5e51('0x18')][_0x5e51('0x4e')];return new Promise(function(_0x55d8b1,_0x224535){return db['CmHopper'][_0x5e51('0x2c')]({'where':{'voiceQueueId':_0x3fe851,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x5e51('0x3e')](_0x5e51('0x4f')+_0x1aacce+_0x5e51('0x50'))}},'include':[{'model':db[_0x5e51('0x2f')],'as':_0x5e51('0x30')},{'model':db[_0x5e51('0x31')],'as':'Agent','attributes':['id',_0x5e51('0x51'),_0x5e51('0x52')]},{'model':db[_0x5e51('0x53')],'as':_0x5e51('0x54')}]})[_0x5e51('0xa')](function(_0x3bde25){return db[_0x5e51('0x2a')][_0x5e51('0x2b')](function(_0x390b87){return db[_0x5e51('0x15')][_0x5e51('0x25')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x3fe851,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5e51('0x2a')]['literal'](_0x5e51('0x4f')+_0x1aacce+'\x20MINUTE')}},'transaction':_0x390b87})['then'](function(_0x556b38){_0x55d8b1(_0x3bde25);})[_0x5e51('0x1e')](function(_0x146d86){logger[_0x5e51('0x10')](_0x5e51('0x55'),_0x146d86['message'],_0x3ffaae);_0x224535(validateExpressRequest);});});})[_0x5e51('0x1e')](function(_0xbbff56){logger[_0x5e51('0x10')](_0x5e51('0x55'),_0xbbff56[_0x5e51('0x11')],_0x3ffaae);_0x224535(_0x541f52[_0x5e51('0x10')](0x1f4,_0xbbff56[_0x5e51('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a2f0bd0..4806f54 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 _0xbf9a=['getPreview','/timezone','getTimezone','/previewrecall','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','getOpenContacts','/timezones','isAuthenticated','getTimezones','show','create','post'];(function(_0x1a5687,_0xc2188f){var _0x257d5c=function(_0x4a1783){while(--_0x4a1783){_0x1a5687['push'](_0x1a5687['shift']());}};_0x257d5c(++_0xc2188f);}(_0xbf9a,0x7e));var _0xabf9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xbf9a[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0xabf9('0x0'));var util=require('util');var path=require(_0xabf9('0x1'));var timeout=require(_0xabf9('0x2'));var express=require(_0xabf9('0x3'));var router=express['Router']();var fs_extra=require(_0xabf9('0x4'));var auth=require(_0xabf9('0x5'));var interaction=require(_0xabf9('0x6'));var config=require(_0xabf9('0x7'));var controller=require(_0xabf9('0x8'));router[_0xabf9('0x9')]('/',auth['isAuthenticated'](),controller[_0xabf9('0xa')]);router[_0xabf9('0x9')](_0xabf9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/opencontacts',auth['isAuthenticated'](),controller[_0xabf9('0xc')]);router['get'](_0xabf9('0xd'),auth[_0xabf9('0xe')](),controller[_0xabf9('0xf')]);router[_0xabf9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xabf9('0x10')]);router['post']('/',auth[_0xabf9('0xe')](),controller[_0xabf9('0x11')]);router[_0xabf9('0x12')]('/preview',auth['isAuthenticated'](),controller[_0xabf9('0x13')]);router[_0xabf9('0x12')](_0xabf9('0x14'),auth[_0xabf9('0xe')](),controller[_0xabf9('0x15')]);router[_0xabf9('0x12')](_0xabf9('0x16'),auth[_0xabf9('0xe')](),controller['getPreviewRecall']);router[_0xabf9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xabf9('0x18')]);router[_0xabf9('0x19')](_0xabf9('0x1a'),auth[_0xabf9('0xe')](),controller[_0xabf9('0x1b')]);module[_0xabf9('0x1c')]=router; \ No newline at end of file +var _0xc44d=['index','isAuthenticated','/:id','show','post','create','/preview','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xc44d,0xc6));var _0xdc44=function(_0x5f4e8c,_0x4f2b92){_0x5f4e8c=_0x5f4e8c-0x0;var _0x388477=_0xc44d[_0x5f4e8c];return _0x388477;};'use strict';var multer=require(_0xdc44('0x0'));var util=require('util');var path=require(_0xdc44('0x1'));var timeout=require(_0xdc44('0x2'));var express=require(_0xdc44('0x3'));var router=express['Router']();var fs_extra=require(_0xdc44('0x4'));var auth=require(_0xdc44('0x5'));var interaction=require(_0xdc44('0x6'));var config=require(_0xdc44('0x7'));var controller=require('./cmHopper.controller');router[_0xdc44('0x8')]('/',auth['isAuthenticated'](),controller[_0xdc44('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xdc44('0x8')]('/opencontacts',auth[_0xdc44('0xa')](),controller['getOpenContacts']);router[_0xdc44('0x8')]('/timezones',auth[_0xdc44('0xa')](),controller['getTimezones']);router[_0xdc44('0x8')](_0xdc44('0xb'),auth[_0xdc44('0xa')](),controller[_0xdc44('0xc')]);router[_0xdc44('0xd')]('/',auth['isAuthenticated'](),controller[_0xdc44('0xe')]);router[_0xdc44('0xd')](_0xdc44('0xf'),auth['isAuthenticated'](),controller[_0xdc44('0x10')]);router['post'](_0xdc44('0x11'),auth[_0xdc44('0xa')](),controller[_0xdc44('0x12')]);router['post'](_0xdc44('0x13'),auth[_0xdc44('0xa')](),controller[_0xdc44('0x14')]);router['put'](_0xdc44('0xb'),auth[_0xdc44('0xa')](),controller['update']);router[_0xdc44('0x15')](_0xdc44('0xb'),auth[_0xdc44('0xa')](),controller['destroy']);module[_0xdc44('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0b2664c..d565214 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 _0x83c8=['contactListQueue','INTEGER','moment','STRING'];(function(_0x10239e,_0x31ba32){var _0x40db42=function(_0x442ac6){while(--_0x442ac6){_0x10239e['push'](_0x10239e['shift']());}};_0x40db42(++_0x31ba32);}(_0x83c8,0x8a));var _0x883c=function(_0x24beac,_0x5aa9c9){_0x24beac=_0x24beac-0x0;var _0x4980dd=_0x83c8[_0x24beac];return _0x4980dd;};'use strict';var moment=require(_0x883c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x883c('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x883c('0x2')},'ListId':{'type':Sequelize[_0x883c('0x3')],'unique':_0x883c('0x2')},'VoiceQueueId':{'type':Sequelize[_0x883c('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xf939=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x463e0a,_0x33759d){var _0x1421fb=function(_0xabe2de){while(--_0xabe2de){_0x463e0a['push'](_0x463e0a['shift']());}};_0x1421fb(++_0x33759d);}(_0xf939,0x1b8));var _0x9f93=function(_0x332d96,_0x14f151){_0x332d96=_0x332d96-0x0;var _0x23fb32=_0xf939[_0x332d96];return _0x23fb32;};'use strict';var moment=require(_0x9f93('0x0'));var Sequelize=require('sequelize');module[_0x9f93('0x1')]={'phone':{'type':Sequelize[_0x9f93('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9f93('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9f93('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9f93('0x3')],'unique':_0x9f93('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 66a61d2..9778fb1 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 _0xe2ea=['limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','show','intersection','includeAll','catch','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset'];(function(_0x13e1d9,_0x479e22){var _0x5e3c69=function(_0x314654){while(--_0x314654){_0x13e1d9['push'](_0x13e1d9['shift']());}};_0x5e3c69(++_0x479e22);}(_0xe2ea,0xc3));var _0xae2e=function(_0x1537b7,_0x260819){_0x1537b7=_0x1537b7-0x0;var _0x5a13fb=_0xe2ea[_0x1537b7];return _0x5a13fb;};'use strict';var emlformat=require(_0xae2e('0x0'));var rimraf=require(_0xae2e('0x1'));var zipdir=require(_0xae2e('0x2'));var jsonpatch=require(_0xae2e('0x3'));var rp=require(_0xae2e('0x4'));var moment=require(_0xae2e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae2e('0x6'));var util=require(_0xae2e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae2e('0x8'));var fs=require('fs');var fs_extra=require(_0xae2e('0x9'));var _=require(_0xae2e('0xa'));var squel=require(_0xae2e('0xb'));var crypto=require(_0xae2e('0xc'));var jsforce=require(_0xae2e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae2e('0xe'));var querystring=require(_0xae2e('0xf'));var Papa=require(_0xae2e('0x10'));var Redis=require(_0xae2e('0x11'));var authService=require(_0xae2e('0x12'));var qs=require(_0xae2e('0x13'));var as=require(_0xae2e('0x14'));var hardwareService=require(_0xae2e('0x15'));var logger=require(_0xae2e('0x16'))(_0xae2e('0x17'));var utils=require(_0xae2e('0x18'));var config=require(_0xae2e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380c27,_0x204117){_0x204117=_0x204117||0xcc;return function(_0x53e3d9){if(_0x53e3d9){return _0x380c27['sendStatus'](_0x204117);}return _0x380c27[_0xae2e('0x1a')](_0x204117)[_0xae2e('0x1b')]();};}function respondWithResult(_0x4a0b3f,_0x4a1ed3){_0x4a1ed3=_0x4a1ed3||0xc8;return function(_0x3acd83){if(_0x3acd83){return _0x4a0b3f['status'](_0x4a1ed3)[_0xae2e('0x1c')](_0x3acd83);}};}function respondWithFilteredResult(_0x4fa731,_0xfac5dd){return function(_0x3c4077){if(_0x3c4077){var _0x196226=typeof _0xfac5dd[_0xae2e('0x1d')]==='undefined'&&typeof _0xfac5dd[_0xae2e('0x1e')]===_0xae2e('0x1f');var _0x1087b0=_0x3c4077['count'];var _0x1db656=_0x196226?0x0:_0xfac5dd[_0xae2e('0x1d')];var _0x39ab8f=_0x196226?_0x3c4077[_0xae2e('0x20')]:_0xfac5dd[_0xae2e('0x1d')]+_0xfac5dd['limit'];var _0x19a1e5;if(_0x39ab8f>=_0x1087b0){_0x39ab8f=_0x1087b0;_0x19a1e5=0xc8;}else{_0x19a1e5=0xce;}_0x4fa731[_0xae2e('0x1a')](_0x19a1e5);return _0x4fa731[_0xae2e('0x21')]('Content-Range',_0x1db656+'-'+_0x39ab8f+'/'+_0x1087b0)[_0xae2e('0x1c')](_0x3c4077);}return null;};}function patchUpdates(_0x48cd28){return function(_0x45ae83){try{jsonpatch[_0xae2e('0x22')](_0x45ae83,_0x48cd28,!![]);}catch(_0x4ca586){return BPromise['reject'](_0x4ca586);}return _0x45ae83[_0xae2e('0x23')]();};}function saveUpdates(_0x90d7cd,_0x9d4f1f){return function(_0x39e3d5){if(_0x39e3d5){return _0x39e3d5[_0xae2e('0x24')](_0x90d7cd)[_0xae2e('0x25')](function(_0x4de83a){return _0x4de83a;});}return null;};}function removeEntity(_0x326cd4,_0x553207){return function(_0xb24994){if(_0xb24994){return _0xb24994[_0xae2e('0x26')]()['then'](function(){_0x326cd4['status'](0xcc)[_0xae2e('0x1b')]();});}};}function handleEntityNotFound(_0x543892,_0x4f66a1){return function(_0x1640d2){if(!_0x1640d2){_0x543892[_0xae2e('0x27')](0x194);}return _0x1640d2;};}function handleError(_0xd49c22,_0x430cb2){_0x430cb2=_0x430cb2||0x1f4;return function(_0x13b0b9){logger[_0xae2e('0x28')](_0x13b0b9[_0xae2e('0x29')]);if(_0x13b0b9['name']){delete _0x13b0b9[_0xae2e('0x2a')];}_0xd49c22[_0xae2e('0x1a')](_0x430cb2)['send'](_0x13b0b9);};}exports[_0xae2e('0x2b')]=function(_0x29a3b0,_0x2243c1){var _0x1ae7d7={},_0x3644a4={},_0x95ec69={'count':0x0,'rows':[]};var _0x17ee8c=_[_0xae2e('0x2c')](db[_0xae2e('0x2d')][_0xae2e('0x2e')],function(_0x266de9){return{'name':_0x266de9[_0xae2e('0x2f')],'type':_0x266de9[_0xae2e('0x30')][_0xae2e('0x31')]};});_0x3644a4[_0xae2e('0x32')]=_[_0xae2e('0x2c')](_0x17ee8c,'name');_0x3644a4[_0xae2e('0x33')]=_[_0xae2e('0x34')](_0x29a3b0[_0xae2e('0x33')]);_0x3644a4[_0xae2e('0x35')]=_['intersection'](_0x3644a4[_0xae2e('0x32')],_0x3644a4['query']);_0x1ae7d7[_0xae2e('0x36')]=_['intersection'](_0x3644a4[_0xae2e('0x32')],qs[_0xae2e('0x37')](_0x29a3b0['query'][_0xae2e('0x37')]));_0x1ae7d7[_0xae2e('0x36')]=_0x1ae7d7['attributes'][_0xae2e('0x38')]?_0x1ae7d7[_0xae2e('0x36')]:_0x3644a4['model'];if(!_0x29a3b0['query'][_0xae2e('0x39')](_0xae2e('0x3a'))){_0x1ae7d7[_0xae2e('0x1e')]=qs['limit'](_0x29a3b0[_0xae2e('0x33')]['limit']);_0x1ae7d7['offset']=qs[_0xae2e('0x1d')](_0x29a3b0['query'][_0xae2e('0x1d')]);}_0x1ae7d7[_0xae2e('0x3b')]=qs['sort'](_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3c')]);_0x1ae7d7[_0xae2e('0x3d')]=qs['filters'](_['pick'](_0x29a3b0[_0xae2e('0x33')],_0x3644a4[_0xae2e('0x35')]),_0x17ee8c);if(_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3e')]){_0x1ae7d7[_0xae2e('0x3d')]=_['merge'](_0x1ae7d7[_0xae2e('0x3d')],{'$or':_[_0xae2e('0x2c')](_0x17ee8c,function(_0x539520){if(_0x539520['type']!=='VIRTUAL'){var _0x32302b={};_0x32302b[_0x539520['name']]={'$like':'%'+_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3e')]+'%'};return _0x32302b;}})});}_0x1ae7d7=_[_0xae2e('0x3f')]({},_0x1ae7d7,_0x29a3b0[_0xae2e('0x40')]);var _0xbbbbf8={'where':_0x1ae7d7[_0xae2e('0x3d')]};return db[_0xae2e('0x2d')]['count'](_0xbbbbf8)[_0xae2e('0x25')](function(_0x304d33){_0x95ec69[_0xae2e('0x20')]=_0x304d33;if(_0x29a3b0[_0xae2e('0x33')]['includeAll']){_0x1ae7d7[_0xae2e('0x41')]=[{'all':!![]}];}return db[_0xae2e('0x2d')]['findAll'](_0x1ae7d7);})['then'](function(_0x1ca7be){_0x95ec69[_0xae2e('0x42')]=_0x1ca7be;return _0x95ec69;})[_0xae2e('0x25')](respondWithFilteredResult(_0x2243c1,_0x1ae7d7))['catch'](handleError(_0x2243c1,null));};exports[_0xae2e('0x43')]=function(_0x234103,_0x50caf3){var _0x3441d4={'raw':!![],'where':{'id':_0x234103['params']['id']}},_0x473d3d={};_0x473d3d[_0xae2e('0x32')]=_[_0xae2e('0x34')](db[_0xae2e('0x2d')][_0xae2e('0x2e')]);_0x473d3d[_0xae2e('0x33')]=_[_0xae2e('0x34')](_0x234103[_0xae2e('0x33')]);_0x473d3d[_0xae2e('0x35')]=_[_0xae2e('0x44')](_0x473d3d['model'],_0x473d3d[_0xae2e('0x33')]);_0x3441d4[_0xae2e('0x36')]=_[_0xae2e('0x44')](_0x473d3d['model'],qs[_0xae2e('0x37')](_0x234103[_0xae2e('0x33')][_0xae2e('0x37')]));_0x3441d4['attributes']=_0x3441d4['attributes'][_0xae2e('0x38')]?_0x3441d4['attributes']:_0x473d3d[_0xae2e('0x32')];if(_0x234103[_0xae2e('0x33')][_0xae2e('0x45')]){_0x3441d4[_0xae2e('0x41')]=[{'all':!![]}];}_0x3441d4=_[_0xae2e('0x3f')]({},_0x3441d4,_0x234103[_0xae2e('0x40')]);return db[_0xae2e('0x2d')]['find'](_0x3441d4)['then'](handleEntityNotFound(_0x50caf3,null))[_0xae2e('0x25')](respondWithResult(_0x50caf3,null))[_0xae2e('0x46')](handleError(_0x50caf3,null));};exports[_0xae2e('0x24')]=function(_0x15caf6,_0x971b72){if(_0x15caf6[_0xae2e('0x47')]['id']){delete _0x15caf6['body']['id'];}return db[_0xae2e('0x2d')][_0xae2e('0x48')]({'where':{'id':_0x15caf6[_0xae2e('0x49')]['id']}})[_0xae2e('0x25')](handleEntityNotFound(_0x971b72,null))[_0xae2e('0x25')](saveUpdates(_0x15caf6['body'],null))[_0xae2e('0x25')](respondWithResult(_0x971b72,null))[_0xae2e('0x46')](handleError(_0x971b72,null));};exports[_0xae2e('0x26')]=function(_0xa3add9,_0x517800){return db[_0xae2e('0x2d')][_0xae2e('0x48')]({'where':{'id':_0xa3add9['params']['id']}})[_0xae2e('0x25')](handleEntityNotFound(_0x517800,null))[_0xae2e('0x25')](removeEntity(_0x517800,null))[_0xae2e('0x46')](handleError(_0x517800,null));};exports[_0xae2e('0x4a')]=function(_0x5ca245,_0x29018b){return db[_0xae2e('0x2d')][_0xae2e('0x4a')]()[_0xae2e('0x25')](respondWithResult(_0x29018b,null))['catch'](handleError(_0x29018b,null));}; \ No newline at end of file +var _0xc7e3=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopperBlack','includeAll','findAll','rows','catch','show','rawAttributes','include','find','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0xff9ce4,_0x583317){var _0x29ebe1=function(_0x2dab13){while(--_0x2dab13){_0xff9ce4['push'](_0xff9ce4['shift']());}};_0x29ebe1(++_0x583317);}(_0xc7e3,0x15c));var _0x3c7e=function(_0xec0fbd,_0x4dbcdb){_0xec0fbd=_0xec0fbd-0x0;var _0x24a373=_0xc7e3[_0xec0fbd];return _0x24a373;};'use strict';var emlformat=require(_0x3c7e('0x0'));var rimraf=require(_0x3c7e('0x1'));var zipdir=require(_0x3c7e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c7e('0x3'));var BPromise=require(_0x3c7e('0x4'));var Mustache=require(_0x3c7e('0x5'));var util=require(_0x3c7e('0x6'));var path=require(_0x3c7e('0x7'));var sox=require(_0x3c7e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c7e('0x9'));var _=require(_0x3c7e('0xa'));var squel=require(_0x3c7e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c7e('0xc'));var toCsv=require(_0x3c7e('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c7e('0xe'));var authService=require(_0x3c7e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3c7e('0x10'));var hardwareService=require(_0x3c7e('0x11'));var logger=require(_0x3c7e('0x12'))(_0x3c7e('0x13'));var utils=require(_0x3c7e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c7e('0x15'));var db=require(_0x3c7e('0x16'))['db'];function respondWithStatusCode(_0x124bf1,_0xbfeaca){_0xbfeaca=_0xbfeaca||0xcc;return function(_0x16e335){if(_0x16e335){return _0x124bf1[_0x3c7e('0x17')](_0xbfeaca);}return _0x124bf1[_0x3c7e('0x18')](_0xbfeaca)[_0x3c7e('0x19')]();};}function respondWithResult(_0x57a65a,_0x487d22){_0x487d22=_0x487d22||0xc8;return function(_0x3e3447){if(_0x3e3447){return _0x57a65a[_0x3c7e('0x18')](_0x487d22)[_0x3c7e('0x1a')](_0x3e3447);}};}function respondWithFilteredResult(_0xae2f51,_0x389921){return function(_0x2a0f77){if(_0x2a0f77){var _0x3e4f7b=typeof _0x389921[_0x3c7e('0x1b')]===_0x3c7e('0x1c')&&typeof _0x389921[_0x3c7e('0x1d')]===_0x3c7e('0x1c');var _0x1b0176=_0x2a0f77[_0x3c7e('0x1e')];var _0xcdcfd3=_0x3e4f7b?0x0:_0x389921[_0x3c7e('0x1b')];var _0x1c1795=_0x3e4f7b?_0x2a0f77[_0x3c7e('0x1e')]:_0x389921[_0x3c7e('0x1b')]+_0x389921[_0x3c7e('0x1d')];var _0x275fc4;if(_0x1c1795>=_0x1b0176){_0x1c1795=_0x1b0176;_0x275fc4=0xc8;}else{_0x275fc4=0xce;}_0xae2f51[_0x3c7e('0x18')](_0x275fc4);return _0xae2f51[_0x3c7e('0x1f')](_0x3c7e('0x20'),_0xcdcfd3+'-'+_0x1c1795+'/'+_0x1b0176)[_0x3c7e('0x1a')](_0x2a0f77);}return null;};}function patchUpdates(_0x5e7b09){return function(_0x3acf00){try{jsonpatch[_0x3c7e('0x21')](_0x3acf00,_0x5e7b09,!![]);}catch(_0x2523e6){return BPromise[_0x3c7e('0x22')](_0x2523e6);}return _0x3acf00['save']();};}function saveUpdates(_0x1c20cf,_0x57a032){return function(_0x4a50d7){if(_0x4a50d7){return _0x4a50d7[_0x3c7e('0x23')](_0x1c20cf)[_0x3c7e('0x24')](function(_0x55ff9b){return _0x55ff9b;});}return null;};}function removeEntity(_0x538530,_0x26e85a){return function(_0x32ed0b){if(_0x32ed0b){return _0x32ed0b[_0x3c7e('0x25')]()[_0x3c7e('0x24')](function(){_0x538530[_0x3c7e('0x18')](0xcc)[_0x3c7e('0x19')]();});}};}function handleEntityNotFound(_0x5e9c92,_0x10311e){return function(_0x5b935d){if(!_0x5b935d){_0x5e9c92[_0x3c7e('0x17')](0x194);}return _0x5b935d;};}function handleError(_0x1eec40,_0x45379f){_0x45379f=_0x45379f||0x1f4;return function(_0x29c471){logger['error'](_0x29c471[_0x3c7e('0x26')]);if(_0x29c471['name']){delete _0x29c471[_0x3c7e('0x27')];}_0x1eec40[_0x3c7e('0x18')](_0x45379f)['send'](_0x29c471);};}exports['index']=function(_0x45e813,_0x40a264){var _0x1f0788={},_0xe8f7f7={},_0x1f5910={'count':0x0,'rows':[]};var _0x199785=_[_0x3c7e('0x28')](db['CmHopperBlack']['rawAttributes'],function(_0x37bc2b){return{'name':_0x37bc2b[_0x3c7e('0x29')],'type':_0x37bc2b[_0x3c7e('0x2a')][_0x3c7e('0x2b')]};});_0xe8f7f7[_0x3c7e('0x2c')]=_['map'](_0x199785,_0x3c7e('0x27'));_0xe8f7f7['query']=_[_0x3c7e('0x2d')](_0x45e813[_0x3c7e('0x2e')]);_0xe8f7f7[_0x3c7e('0x2f')]=_[_0x3c7e('0x30')](_0xe8f7f7[_0x3c7e('0x2c')],_0xe8f7f7[_0x3c7e('0x2e')]);_0x1f0788[_0x3c7e('0x31')]=_[_0x3c7e('0x30')](_0xe8f7f7[_0x3c7e('0x2c')],qs[_0x3c7e('0x32')](_0x45e813[_0x3c7e('0x2e')][_0x3c7e('0x32')]));_0x1f0788[_0x3c7e('0x31')]=_0x1f0788[_0x3c7e('0x31')][_0x3c7e('0x33')]?_0x1f0788[_0x3c7e('0x31')]:_0xe8f7f7[_0x3c7e('0x2c')];if(!_0x45e813['query'][_0x3c7e('0x34')](_0x3c7e('0x35'))){_0x1f0788[_0x3c7e('0x1d')]=qs[_0x3c7e('0x1d')](_0x45e813[_0x3c7e('0x2e')][_0x3c7e('0x1d')]);_0x1f0788[_0x3c7e('0x1b')]=qs['offset'](_0x45e813[_0x3c7e('0x2e')]['offset']);}_0x1f0788[_0x3c7e('0x36')]=qs[_0x3c7e('0x37')](_0x45e813[_0x3c7e('0x2e')][_0x3c7e('0x37')]);_0x1f0788[_0x3c7e('0x38')]=qs[_0x3c7e('0x2f')](_[_0x3c7e('0x39')](_0x45e813['query'],_0xe8f7f7[_0x3c7e('0x2f')]),_0x199785);if(_0x45e813[_0x3c7e('0x2e')][_0x3c7e('0x3a')]){_0x1f0788[_0x3c7e('0x38')]=_['merge'](_0x1f0788[_0x3c7e('0x38')],{'$or':_['map'](_0x199785,function(_0x2c8126){if(_0x2c8126[_0x3c7e('0x2a')]!==_0x3c7e('0x3b')){var _0x440b55={};_0x440b55[_0x2c8126[_0x3c7e('0x27')]]={'$like':'%'+_0x45e813[_0x3c7e('0x2e')]['filter']+'%'};return _0x440b55;}})});}_0x1f0788=_[_0x3c7e('0x3c')]({},_0x1f0788,_0x45e813[_0x3c7e('0x3d')]);var _0x37c23e={'where':_0x1f0788[_0x3c7e('0x38')]};return db[_0x3c7e('0x3e')]['count'](_0x37c23e)[_0x3c7e('0x24')](function(_0x26cfa2){_0x1f5910['count']=_0x26cfa2;if(_0x45e813[_0x3c7e('0x2e')][_0x3c7e('0x3f')]){_0x1f0788['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x3c7e('0x40')](_0x1f0788);})['then'](function(_0x1b0126){_0x1f5910[_0x3c7e('0x41')]=_0x1b0126;return _0x1f5910;})[_0x3c7e('0x24')](respondWithFilteredResult(_0x40a264,_0x1f0788))[_0x3c7e('0x42')](handleError(_0x40a264,null));};exports[_0x3c7e('0x43')]=function(_0xf773bb,_0x82779c){var _0x7f7957={'raw':!![],'where':{'id':_0xf773bb['params']['id']}},_0x351822={};_0x351822[_0x3c7e('0x2c')]=_[_0x3c7e('0x2d')](db[_0x3c7e('0x3e')][_0x3c7e('0x44')]);_0x351822['query']=_[_0x3c7e('0x2d')](_0xf773bb[_0x3c7e('0x2e')]);_0x351822['filters']=_['intersection'](_0x351822[_0x3c7e('0x2c')],_0x351822['query']);_0x7f7957[_0x3c7e('0x31')]=_[_0x3c7e('0x30')](_0x351822[_0x3c7e('0x2c')],qs[_0x3c7e('0x32')](_0xf773bb[_0x3c7e('0x2e')][_0x3c7e('0x32')]));_0x7f7957['attributes']=_0x7f7957[_0x3c7e('0x31')]['length']?_0x7f7957[_0x3c7e('0x31')]:_0x351822[_0x3c7e('0x2c')];if(_0xf773bb[_0x3c7e('0x2e')][_0x3c7e('0x3f')]){_0x7f7957[_0x3c7e('0x45')]=[{'all':!![]}];}_0x7f7957=_['merge']({},_0x7f7957,_0xf773bb[_0x3c7e('0x3d')]);return db[_0x3c7e('0x3e')][_0x3c7e('0x46')](_0x7f7957)[_0x3c7e('0x24')](handleEntityNotFound(_0x82779c,null))[_0x3c7e('0x24')](respondWithResult(_0x82779c,null))[_0x3c7e('0x42')](handleError(_0x82779c,null));};exports['update']=function(_0x27f6e5,_0x33d348){if(_0x27f6e5[_0x3c7e('0x47')]['id']){delete _0x27f6e5['body']['id'];}return db[_0x3c7e('0x3e')]['find']({'where':{'id':_0x27f6e5['params']['id']}})[_0x3c7e('0x24')](handleEntityNotFound(_0x33d348,null))['then'](saveUpdates(_0x27f6e5['body'],null))[_0x3c7e('0x24')](respondWithResult(_0x33d348,null))['catch'](handleError(_0x33d348,null));};exports[_0x3c7e('0x25')]=function(_0x50448a,_0x530510){return db[_0x3c7e('0x3e')][_0x3c7e('0x46')]({'where':{'id':_0x50448a[_0x3c7e('0x48')]['id']}})['then'](handleEntityNotFound(_0x530510,null))[_0x3c7e('0x24')](removeEntity(_0x530510,null))[_0x3c7e('0x42')](handleError(_0x530510,null));};exports['describe']=function(_0x1d8a14,_0x184c44){return db[_0x3c7e('0x3e')][_0x3c7e('0x49')]()[_0x3c7e('0x24')](respondWithResult(_0x184c44,null))[_0x3c7e('0x42')](handleError(_0x184c44,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2d2abc4..9c4b7e8 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 _0xc628=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api'];(function(_0x2ece4f,_0x5cb907){var _0x12e804=function(_0x2dd6d2){while(--_0x2dd6d2){_0x2ece4f['push'](_0x2ece4f['shift']());}};_0x12e804(++_0x5cb907);}(_0xc628,0x126));var _0x8c62=function(_0x275f78,_0x2a0cfc){_0x275f78=_0x275f78-0x0;var _0x538243=_0xc628[_0x275f78];return _0x538243;};'use strict';var _=require(_0x8c62('0x0'));var util=require(_0x8c62('0x1'));var logger=require('../../config/logger')(_0x8c62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c62('0x3'));var fs=require('fs');var path=require(_0x8c62('0x4'));var rimraf=require('rimraf');var config=require(_0x8c62('0x5'));var attributes=require(_0x8c62('0x6'));module[_0x8c62('0x7')]=function(_0x2a5a71,_0x3be0c3){return _0x2a5a71[_0x8c62('0x8')](_0x8c62('0x9'),attributes,{'tableName':_0x8c62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcc9=['bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','moment'];(function(_0x2197c1,_0x5d09a5){var _0x438d1e=function(_0x184bcd){while(--_0x184bcd){_0x2197c1['push'](_0x2197c1['shift']());}};_0x438d1e(++_0x5d09a5);}(_0xbcc9,0xd9));var _0x9bcc=function(_0x1263c1,_0x287a24){_0x1263c1=_0x1263c1-0x0;var _0x59639e=_0xbcc9[_0x1263c1];return _0x59639e;};'use strict';var _=require(_0x9bcc('0x0'));var util=require(_0x9bcc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9bcc('0x2'));var BPromise=require(_0x9bcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bcc('0x4'));var rimraf=require(_0x9bcc('0x5'));var config=require(_0x9bcc('0x6'));var attributes=require(_0x9bcc('0x7'));module[_0x9bcc('0x8')]=function(_0x1668de,_0x347750){return _0x1668de[_0x9bcc('0x9')]('CmHopperBlack',attributes,{'tableName':_0x9bcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 96a7f88..12d62eb 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 _0x4722=['error','code','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x5d3d3b,_0xed4483){var _0x943621=function(_0x1bbab2){while(--_0x1bbab2){_0x5d3d3b['push'](_0x5d3d3b['shift']());}};_0x943621(++_0xed4483);}(_0x4722,0x80));var _0x2472=function(_0x3c126e,_0x2bf56a){_0x3c126e=_0x3c126e-0x0;var _0x2a910b=_0x4722[_0x3c126e];return _0x2a910b;};'use strict';var _=require(_0x2472('0x0'));var util=require('util');var moment=require(_0x2472('0x1'));var BPromise=require(_0x2472('0x2'));var rs=require(_0x2472('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2472('0x4'));var logger=require(_0x2472('0x5'))(_0x2472('0x6'));var config=require(_0x2472('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2472('0x8')][_0x2472('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x466a6f,_0x32498d,_0x2092ad){return new BPromise(function(_0x13514b,_0x45a01a){return client[_0x2472('0xa')](_0x466a6f,_0x2092ad)[_0x2472('0xb')](function(_0x585389){logger['info'](_0x2472('0xc'),_0x32498d,_0x2472('0xd'));logger[_0x2472('0xe')](_0x2472('0xf'),_0x32498d,_0x2472('0xd'),JSON['stringify'](_0x585389));if(_0x585389[_0x2472('0x10')]){if(_0x585389[_0x2472('0x10')][_0x2472('0x11')]===0x1f4){logger[_0x2472('0x10')](_0x2472('0xc'),_0x32498d,_0x585389[_0x2472('0x10')][_0x2472('0x12')]);return _0x45a01a(_0x585389['error'][_0x2472('0x12')]);}logger['error'](_0x2472('0xc'),_0x32498d,_0x585389[_0x2472('0x10')]['message']);return _0x13514b(_0x585389[_0x2472('0x10')][_0x2472('0x12')]);}else{logger[_0x2472('0x13')](_0x2472('0xc'),_0x32498d,_0x2472('0xd'));_0x13514b(_0x585389['result'][_0x2472('0x12')]);}})[_0x2472('0x14')](function(_0x1f5143){logger[_0x2472('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x32498d,_0x1f5143);_0x45a01a(_0x1f5143);});});}exports[_0x2472('0x15')]=function(_0x56baf9){var _0x2ab161=this;return new Promise(function(_0x3c1357,_0x1df07f){return db[_0x2472('0x16')][_0x2472('0x17')]({'raw':_0x56baf9[_0x2472('0x18')]?_0x56baf9[_0x2472('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x56baf9[_0x2472('0x18')]?_0x56baf9['options'][_0x2472('0x19')]||null:null,'attributes':_0x56baf9[_0x2472('0x18')]?_0x56baf9[_0x2472('0x18')][_0x2472('0x1a')]||null:null,'limit':_0x56baf9[_0x2472('0x18')]?_0x56baf9['options'][_0x2472('0x1b')]||null:null,'include':_0x56baf9['options']?_0x56baf9[_0x2472('0x18')][_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x56baf9[_0x2472('0x18')][_0x2472('0x1c')],function(_0x3ab2a2){return{'model':db[_0x3ab2a2[_0x2472('0x1e')]],'as':_0x3ab2a2['as'],'attributes':_0x3ab2a2[_0x2472('0x1a')],'include':_0x3ab2a2[_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x3ab2a2[_0x2472('0x1c')],function(_0x1f7940){return{'model':db[_0x1f7940[_0x2472('0x1e')]],'as':_0x1f7940['as'],'attributes':_0x1f7940[_0x2472('0x1a')],'include':_0x1f7940[_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x1f7940[_0x2472('0x1c')],function(_0x254b13){return{'model':db[_0x254b13[_0x2472('0x1e')]],'as':_0x254b13['as'],'attributes':_0x254b13[_0x2472('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2472('0xb')](function(_0x5281a6){logger[_0x2472('0x13')](_0x2472('0x15'),_0x56baf9);logger[_0x2472('0xe')](_0x2472('0x15'),_0x56baf9,JSON[_0x2472('0x1f')](_0x5281a6));_0x3c1357(_0x5281a6);})[_0x2472('0x14')](function(_0x323931){logger[_0x2472('0x10')](_0x2472('0x15'),_0x323931[_0x2472('0x12')],_0x56baf9);_0x1df07f(_0x2ab161[_0x2472('0x10')](0x1f4,_0x323931[_0x2472('0x12')]));});});};exports[_0x2472('0x20')]=function(_0x209f57){var _0x321be0=this;return new Promise(function(_0x5a76db,_0x5c767e){return db[_0x2472('0x16')][_0x2472('0x21')](_0x209f57['body'],{'raw':_0x209f57[_0x2472('0x18')]?_0x209f57[_0x2472('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x19')]||null:null,'attributes':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x1a')]||null:null,'limit':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x1b')]||null:null})[_0x2472('0xb')](function(_0x12d969){logger[_0x2472('0x13')]('UpdateCmHopperBlack',_0x209f57);logger[_0x2472('0xe')]('UpdateCmHopperBlack',_0x209f57,JSON[_0x2472('0x1f')](_0x12d969));_0x5a76db(_0x12d969);})['catch'](function(_0x5f88fc){logger['error']('UpdateCmHopperBlack',_0x5f88fc['message'],_0x209f57);_0x5c767e(_0x321be0[_0x2472('0x10')](0x1f4,_0x5f88fc[_0x2472('0x12')]));});});};exports[_0x2472('0x22')]=function(_0x14dc3c){var _0x3a68f9=this;return new Promise(function(_0x464121,_0x13f053){return db['CmHopperBlack'][_0x2472('0x23')]({'where':_0x14dc3c[_0x2472('0x18')]?_0x14dc3c[_0x2472('0x18')][_0x2472('0x19')]||null:null})[_0x2472('0xb')](function(_0x2f6096){logger[_0x2472('0x13')]('DestroyCmHopperBlack',_0x14dc3c);logger[_0x2472('0xe')]('DestroyCmHopperBlack',_0x14dc3c,JSON[_0x2472('0x1f')](_0x2f6096));_0x464121(_0x2f6096);})[_0x2472('0x14')](function(_0x5b4a3b){logger[_0x2472('0x10')](_0x2472('0x22'),_0x5b4a3b[_0x2472('0x12')],_0x14dc3c);_0x13f053(_0x3a68f9[_0x2472('0x10')](0x1f4,_0x5b4a3b[_0x2472('0x12')]));});});}; \ No newline at end of file +var _0x5fd9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash'];(function(_0x1fa19c,_0x5c740b){var _0x5b332d=function(_0x289cb8){while(--_0x289cb8){_0x1fa19c['push'](_0x1fa19c['shift']());}};_0x5b332d(++_0x5c740b);}(_0x5fd9,0x74));var _0x95fd=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x5fd9[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0x95fd('0x0'));var util=require(_0x95fd('0x1'));var moment=require(_0x95fd('0x2'));var BPromise=require(_0x95fd('0x3'));var rs=require(_0x95fd('0x4'));var fs=require('fs');var Redis=require(_0x95fd('0x5'));var db=require(_0x95fd('0x6'))['db'];var utils=require(_0x95fd('0x7'));var logger=require(_0x95fd('0x8'))(_0x95fd('0x9'));var config=require('../../config/environment');var jayson=require(_0x95fd('0xa'));var client=jayson[_0x95fd('0xb')][_0x95fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b8774,_0x38ee4b,_0x1b1d8b){return new BPromise(function(_0x4a1345,_0x37a66b){return client['request'](_0x2b8774,_0x1b1d8b)[_0x95fd('0xd')](function(_0x388c06){logger['info'](_0x95fd('0xe'),_0x38ee4b,_0x95fd('0xf'));logger[_0x95fd('0x10')](_0x95fd('0x11'),_0x38ee4b,'request\x20sent',JSON[_0x95fd('0x12')](_0x388c06));if(_0x388c06[_0x95fd('0x13')]){if(_0x388c06['error']['code']===0x1f4){logger['error'](_0x95fd('0xe'),_0x38ee4b,_0x388c06[_0x95fd('0x13')][_0x95fd('0x14')]);return _0x37a66b(_0x388c06[_0x95fd('0x13')][_0x95fd('0x14')]);}logger['error'](_0x95fd('0xe'),_0x38ee4b,_0x388c06[_0x95fd('0x13')]['message']);return _0x4a1345(_0x388c06[_0x95fd('0x13')][_0x95fd('0x14')]);}else{logger[_0x95fd('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x38ee4b,_0x95fd('0xf'));_0x4a1345(_0x388c06[_0x95fd('0x16')][_0x95fd('0x14')]);}})['catch'](function(_0x4eb0b0){logger[_0x95fd('0x13')](_0x95fd('0xe'),_0x38ee4b,_0x4eb0b0);_0x37a66b(_0x4eb0b0);});});}exports[_0x95fd('0x17')]=function(_0x366c62){var _0x398aa6=this;return new Promise(function(_0x1f4958,_0x4d0502){return db[_0x95fd('0x18')][_0x95fd('0x19')]({'raw':_0x366c62['options']?_0x366c62[_0x95fd('0x1a')][_0x95fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x366c62[_0x95fd('0x1a')]?_0x366c62[_0x95fd('0x1a')][_0x95fd('0x1c')]||null:null,'attributes':_0x366c62[_0x95fd('0x1a')]?_0x366c62[_0x95fd('0x1a')][_0x95fd('0x1d')]||null:null,'limit':_0x366c62[_0x95fd('0x1a')]?_0x366c62['options'][_0x95fd('0x1e')]||null:null,'include':_0x366c62[_0x95fd('0x1a')]?_0x366c62['options'][_0x95fd('0x1f')]?_[_0x95fd('0x20')](_0x366c62[_0x95fd('0x1a')][_0x95fd('0x1f')],function(_0x45d3cd){return{'model':db[_0x45d3cd[_0x95fd('0x21')]],'as':_0x45d3cd['as'],'attributes':_0x45d3cd[_0x95fd('0x1d')],'include':_0x45d3cd[_0x95fd('0x1f')]?_[_0x95fd('0x20')](_0x45d3cd['include'],function(_0x4013a1){return{'model':db[_0x4013a1[_0x95fd('0x21')]],'as':_0x4013a1['as'],'attributes':_0x4013a1[_0x95fd('0x1d')],'include':_0x4013a1[_0x95fd('0x1f')]?_[_0x95fd('0x20')](_0x4013a1[_0x95fd('0x1f')],function(_0x4e707f){return{'model':db[_0x4e707f[_0x95fd('0x21')]],'as':_0x4e707f['as'],'attributes':_0x4e707f['attributes']};}):[]};}):[]};}):[]:[]})[_0x95fd('0xd')](function(_0x32e9cd){logger['info'](_0x95fd('0x17'),_0x366c62);logger['debug'](_0x95fd('0x17'),_0x366c62,JSON['stringify'](_0x32e9cd));_0x1f4958(_0x32e9cd);})[_0x95fd('0x22')](function(_0x54ff3d){logger[_0x95fd('0x13')](_0x95fd('0x17'),_0x54ff3d[_0x95fd('0x14')],_0x366c62);_0x4d0502(_0x398aa6[_0x95fd('0x13')](0x1f4,_0x54ff3d[_0x95fd('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x34458a){var _0x4b1a56=this;return new Promise(function(_0xa152d,_0x4e9a56){return db[_0x95fd('0x18')]['update'](_0x34458a[_0x95fd('0x23')],{'raw':_0x34458a[_0x95fd('0x1a')]?_0x34458a[_0x95fd('0x1a')][_0x95fd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34458a[_0x95fd('0x1a')]?_0x34458a[_0x95fd('0x1a')][_0x95fd('0x1c')]||null:null,'attributes':_0x34458a['options']?_0x34458a['options'][_0x95fd('0x1d')]||null:null,'limit':_0x34458a[_0x95fd('0x1a')]?_0x34458a[_0x95fd('0x1a')][_0x95fd('0x1e')]||null:null})[_0x95fd('0xd')](function(_0x3e024d){logger[_0x95fd('0x15')](_0x95fd('0x24'),_0x34458a);logger[_0x95fd('0x10')]('UpdateCmHopperBlack',_0x34458a,JSON[_0x95fd('0x12')](_0x3e024d));_0xa152d(_0x3e024d);})['catch'](function(_0x56964d){logger[_0x95fd('0x13')](_0x95fd('0x24'),_0x56964d['message'],_0x34458a);_0x4e9a56(_0x4b1a56[_0x95fd('0x13')](0x1f4,_0x56964d[_0x95fd('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x5e1a54){var _0x2070d6=this;return new Promise(function(_0x4cd4b0,_0x1c67be){return db[_0x95fd('0x18')][_0x95fd('0x25')]({'where':_0x5e1a54['options']?_0x5e1a54['options']['where']||null:null})[_0x95fd('0xd')](function(_0x36fd9b){logger['info'](_0x95fd('0x26'),_0x5e1a54);logger[_0x95fd('0x10')](_0x95fd('0x26'),_0x5e1a54,JSON[_0x95fd('0x12')](_0x36fd9b));_0x4cd4b0(_0x36fd9b);})[_0x95fd('0x22')](function(_0x3eb740){logger[_0x95fd('0x13')](_0x95fd('0x26'),_0x3eb740[_0x95fd('0x14')],_0x5e1a54);_0x1c67be(_0x2070d6[_0x95fd('0x13')](0x1f4,_0x3eb740[_0x95fd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index ffc2aa6..99669f0 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 _0xdf55=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x1e8f9e,_0x148061){var _0x2cec83=function(_0x55d9ee){while(--_0x55d9ee){_0x1e8f9e['push'](_0x1e8f9e['shift']());}};_0x2cec83(++_0x148061);}(_0xdf55,0x83));var _0x5df5=function(_0x197df3,_0x57d366){_0x197df3=_0x197df3-0x0;var _0xafdaf7=_0xdf55[_0x197df3];return _0xafdaf7;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['put']('/:id',auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0xf')](_0x5df5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('0x10')]=router; \ No newline at end of file +var _0xf072=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','multer','util','path','express','fs-extra'];(function(_0x7d67f0,_0x241e0a){var _0x1bb0a5=function(_0x164b9c){while(--_0x164b9c){_0x7d67f0['push'](_0x7d67f0['shift']());}};_0x1bb0a5(++_0x241e0a);}(_0xf072,0x1cf));var _0x2f07=function(_0x57a65e,_0x33a406){_0x57a65e=_0x57a65e-0x0;var _0x3cfaf8=_0xf072[_0x57a65e];return _0x3cfaf8;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0xf')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller['update']);router[_0x2f07('0x10')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 586300a..2793593 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 _0xff5e=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x5bc6db,_0x33349e){var _0xf97078=function(_0x3af85d){while(--_0x3af85d){_0x5bc6db['push'](_0x5bc6db['shift']());}};_0xf97078(++_0x33349e);}(_0xff5e,0xb6));var _0xeff5=function(_0x1b69d0,_0xd9d920){_0x1b69d0=_0x1b69d0-0x0;var _0x51b6e4=_0xff5e[_0x1b69d0];return _0x51b6e4;};'use strict';var Sequelize=require(_0xeff5('0x0'));var moment=require('moment');module[_0xeff5('0x1')]={'state':{'type':Sequelize[_0xeff5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xeff5('0x3')]},'scheduledat':{'type':Sequelize[_0xeff5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeff5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xeff5('0x3')]},'originatecalleridname':{'type':Sequelize[_0xeff5('0x3')]},'calleridnum':{'type':Sequelize[_0xeff5('0x3')]},'calleridname':{'type':Sequelize[_0xeff5('0x3')]},'starttime':{'type':Sequelize[_0xeff5('0x4')]},'responsetime':{'type':Sequelize[_0xeff5('0x4')]},'answertime':{'type':Sequelize[_0xeff5('0x4')]},'droptime':{'type':Sequelize[_0xeff5('0x4')]},'endtime':{'type':Sequelize[_0xeff5('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xeff5('0x3')]},'campaigntype':{'type':Sequelize[_0xeff5('0x3')]},'membername':{'type':Sequelize[_0xeff5('0x3')]},'reason':{'type':Sequelize[_0xeff5('0x3')]},'disposition':{'type':Sequelize[_0xeff5('0x3')]},'secondDisposition':{'type':Sequelize[_0xeff5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xeff5('0x3')]},'dispositionat':{'type':Sequelize[_0xeff5('0x4')],'set':function(_0xbf1805){var _0x243223=this[_0xeff5('0x5')](_0xeff5('0x6'));if(_0x243223&&_0xbf1805){this[_0xeff5('0x7')](_0xeff5('0x8'),moment(_0xbf1805)[_0xeff5('0x9')](moment(_0x243223),_0xeff5('0xa')));}return this[_0xeff5('0x7')](_0xeff5('0xb'),_0xbf1805);}},'amd':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xeff5('0x4')]},'callback':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeff5('0x4')]},'deleted':{'type':Sequelize[_0xeff5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xeff5('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c4b=['getDataValue','endtime','setDataValue','diff','seconds','dispositionat','BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x558146,_0x26ee6d){var _0x565a12=function(_0x4c2543){while(--_0x4c2543){_0x558146['push'](_0x558146['shift']());}};_0x565a12(++_0x26ee6d);}(_0x0c4b,0x96));var _0xb0c4=function(_0x4ab7a6,_0x32b113){_0x4ab7a6=_0x4ab7a6-0x0;var _0x38d525=_0x0c4b[_0x4ab7a6];return _0x38d525;};'use strict';var Sequelize=require(_0xb0c4('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xb0c4('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb0c4('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb0c4('0x2')]},'originatecalleridname':{'type':Sequelize[_0xb0c4('0x2')]},'calleridnum':{'type':Sequelize[_0xb0c4('0x2')]},'calleridname':{'type':Sequelize[_0xb0c4('0x2')]},'starttime':{'type':Sequelize[_0xb0c4('0x3')]},'responsetime':{'type':Sequelize[_0xb0c4('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xb0c4('0x3')]},'ringtime':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb0c4('0x2')]},'campaign':{'type':Sequelize[_0xb0c4('0x2')]},'campaigntype':{'type':Sequelize[_0xb0c4('0x2')]},'membername':{'type':Sequelize[_0xb0c4('0x2')]},'reason':{'type':Sequelize[_0xb0c4('0x2')]},'disposition':{'type':Sequelize[_0xb0c4('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb0c4('0x2')]},'dispositionat':{'type':Sequelize[_0xb0c4('0x3')],'set':function(_0xad22ac){var _0x1885d4=this[_0xb0c4('0x4')](_0xb0c4('0x5'));if(_0x1885d4&&_0xad22ac){this[_0xb0c4('0x6')]('followuptime',moment(_0xad22ac)[_0xb0c4('0x7')](moment(_0x1885d4),_0xb0c4('0x8')));}return this[_0xb0c4('0x6')](_0xb0c4('0x9'),_0xad22ac);}},'amd':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb0c4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb0c4('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb0c4('0x3')]},'recallme':{'type':Sequelize[_0xb0c4('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb0c4('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb0c4('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb0c4('0x1')],'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 aba38cf..5308d8f 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 _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x184e5e,_0x33c5e5){var _0x3e7caa=function(_0xfc7135){while(--_0xfc7135){_0x184e5e['push'](_0x184e5e['shift']());}};_0x3e7caa(++_0x33c5e5);}(_0xacf4,0xe7));var _0x4acf=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xacf4[_0x4c2623];return _0x2be431;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file +var _0x187d=['state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','select','from','cm_hopper','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','into','CampaignId','CampaignId\x20=\x20?','state','checkContactHopper','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','toString'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x187d,0x93));var _0xd187=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x187d[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':!![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')]()[_0xd187('0x3f')](respondWithResult(_0x3f5def,null))['catch'](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x2657be,_0x4523c8){if(_0x2657be[_0xd187('0x48')][_0xd187('0x49')]){delete _0x2657be['body'][_0xd187('0x49')];}return db[_0xd187('0x2d')]['find']({'where':{'uniqueid':_0x2657be[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x4523c8,null))['then'](saveUpdates(_0x2657be['body'],null))['then'](respondWithResult(_0x4523c8,null))['catch'](handleError(_0x4523c8,null));};exports[_0xd187('0x4a')]=function(_0x22f432,_0x12d448,_0x1bcc3a){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x22f432[_0xd187('0x43')]['id']},'attributes':[[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0xd187('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x4f')))),_0xd187('0x50')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x52')))),'congestionContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xd187('0x53')],[db['sequelize']['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn']('COUNT',db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0xd187('0x56')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x12d448,null))[_0xd187('0x3f')](respondWithResult(_0x12d448,null))[_0xd187('0x41')](handleError(_0x12d448,null));};exports[_0xd187('0x59')]=function(_0x23271b,_0x288a04,_0x39934c){return db[_0xd187('0x2d')][_0xd187('0x3e')]({'raw':![],'where':{'CampaignId':_0x23271b[_0xd187('0x43')]['id']},'attributes':[[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x5a')))),_0xd187('0x4e')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x51')))),'busyContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')]['literal'](_0xd187('0x52')))),_0xd187('0x5b')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize']['literal'](_0xd187('0x5c')))),_0xd187('0x53')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db[_0xd187('0x4c')][_0xd187('0x4d')](_0xd187('0x54')))),_0xd187('0x55')],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db[_0xd187('0x4c')]['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x5d')))),'reCallContacts'],[db[_0xd187('0x4c')]['fn'](_0xd187('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0xd187('0x4d')](_0xd187('0x57')))),_0xd187('0x58')]]})[_0xd187('0x3f')](handleEntityNotFound(_0x288a04,null))['then'](respondWithResult(_0x288a04,null))[_0xd187('0x41')](handleError(_0x288a04,null));};exports[_0xd187('0x5e')]=function(_0x52e364,_0x569959,_0x3bca83){return db['VoiceQueue'][_0xd187('0x46')]({'where':{'id':_0x52e364[_0xd187('0x43')]['id']}})['then'](handleEntityNotFound(_0x569959,null))[_0xd187('0x3f')](function(_0x570c1c){var _0x317bc3;if(_0x570c1c){_0x317bc3=squel['insert']()['into']('cm_hopper')[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x64'),_0xd187('0x65'),_0xd187('0x66')],squel['select']()[_0xd187('0x67')](_0xd187('0x68'),_0xd187('0x60'))['field'](_0xd187('0x69'),_0xd187('0x61'))[_0xd187('0x67')](_0xd187('0x6a'),'ContactId')[_0xd187('0x67')](_0xd187('0x6b'),'ListId')[_0xd187('0x67')](_0xd187('0x6c'),_0xd187('0x64'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')]('NOW()',_0xd187('0x66'))['from']('cm_hopper_final')['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x6f'),_0x52e364[_0xd187('0x48')]['state'][_0xd187('0x6e')]())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x60'))[_0xd187('0x72')](_0xd187('0x73'))['where'](_0xd187('0x6d'),_0x52e364[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x74'))[_0xd187('0x72')](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x6d'),_0x52e364['params']['id']['toString']())[_0xd187('0x39')](_0xd187('0x76')))[_0xd187('0x77')](_0xd187('0x62')))[_0xd187('0x6e')]();return db[_0xd187('0x4c')]['query'](_0x317bc3);}return[];})[_0xd187('0x3f')](respondWithResult(_0x569959,null))['catch'](handleError(_0x569959,null));};exports[_0xd187('0x78')]=function(_0x520f86,_0x5cbfa6,_0x304117){return db['Campaign'][_0xd187('0x46')]({'where':{'id':_0x520f86[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x5cbfa6,null))[_0xd187('0x3f')](function(_0x1b93db){var _0x13a362;if(_0x1b93db){_0x13a362=squel[_0xd187('0x79')]()[_0xd187('0x7a')](_0xd187('0x73'))[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x62'),_0xd187('0x63'),_0xd187('0x7b'),'createdAt',_0xd187('0x66')],squel[_0xd187('0x71')]()[_0xd187('0x67')](_0xd187('0x68'),'phone')[_0xd187('0x67')](_0xd187('0x69'),'scheduledAt')['field'](_0xd187('0x6a'),_0xd187('0x62'))[_0xd187('0x67')](_0xd187('0x6b'),_0xd187('0x63'))[_0xd187('0x67')]('ANY_VALUE(CampaignId)',_0xd187('0x7b'))[_0xd187('0x67')]('NOW()',_0xd187('0x65'))[_0xd187('0x67')](_0xd187('0x69'),_0xd187('0x66'))['from']('cm_hopper_final')[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id']['toString']())[_0xd187('0x39')](_0xd187('0x6f'),_0x520f86[_0xd187('0x48')][_0xd187('0x7d')]['toString']())[_0xd187('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')['from'](_0xd187('0x73'))[_0xd187('0x39')]('CampaignId\x20=\x20?',_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]()))[_0xd187('0x39')](_0xd187('0x70'),squel[_0xd187('0x71')]()['field'](_0xd187('0x74'))['from'](_0xd187('0x75'))[_0xd187('0x39')](_0xd187('0x7c'),_0x520f86[_0xd187('0x43')]['id'][_0xd187('0x6e')]())[_0xd187('0x39')](_0xd187('0x76')))['group'](_0xd187('0x62')))[_0xd187('0x6e')]();return db['sequelize'][_0xd187('0x31')](_0x13a362);}return[];})[_0xd187('0x3f')](respondWithResult(_0x5cbfa6,null))['catch'](handleError(_0x5cbfa6,null));};exports[_0xd187('0x7e')]=function(_0x3bd1d8,_0x224312,_0x45b522){return db[_0xd187('0x7f')][_0xd187('0x80')]({'where':{'VoiceQueueId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x64')],'CampaignId':_0x3bd1d8['body'][_0xd187('0x7b')],'ContactId':_0x3bd1d8[_0xd187('0x48')][_0xd187('0x62')]}})[_0xd187('0x3f')](handleEntityNotFound(_0x224312,null))[_0xd187('0x3f')](function(_0x400a9){if(_0x400a9){return _0x400a9;}return null;})['then'](respondWithResult(_0x224312,null))['catch'](handleError(_0x224312,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 42e270e..060ff89 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 _0xf04b=['../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x1fc72c,_0x56285a){var _0x3b50b2=function(_0x3863df){while(--_0x3863df){_0x1fc72c['push'](_0x1fc72c['shift']());}};_0x3b50b2(++_0x56285a);}(_0xf04b,0xb2));var _0xbf04=function(_0x37c1e8,_0x56a79e){_0x37c1e8=_0x37c1e8-0x0;var _0xca01e5=_0xf04b[_0x37c1e8];return _0xca01e5;};'use strict';var _=require(_0xbf04('0x0'));var util=require(_0xbf04('0x1'));var logger=require(_0xbf04('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf04('0x3'));var rp=require(_0xbf04('0x4'));var fs=require('fs');var path=require(_0xbf04('0x5'));var rimraf=require(_0xbf04('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf04('0x7'));module[_0xbf04('0x8')]=function(_0x5d2452,_0x296c1e){return _0x5d2452['define'](_0xbf04('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xbf04('0xa'),'fields':[_0xbf04('0xa')]},{'name':_0xbf04('0xb'),'fields':[_0xbf04('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcda8=['exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./cmHopperFinal.attributes'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xcda8,0x1d9));var _0x8cda=function(_0x1118e6,_0x4be56f){_0x1118e6=_0x1118e6-0x0;var _0x1da930=_0xcda8[_0x1118e6];return _0x1da930;};'use strict';var _=require(_0x8cda('0x0'));var util=require(_0x8cda('0x1'));var logger=require(_0x8cda('0x2'))(_0x8cda('0x3'));var moment=require(_0x8cda('0x4'));var BPromise=require(_0x8cda('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cda('0x6'));var config=require('../../config/environment');var attributes=require(_0x8cda('0x7'));module[_0x8cda('0x8')]=function(_0xd78aa5,_0x1d0db0){return _0xd78aa5[_0x8cda('0x9')](_0x8cda('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x8cda('0xb'),'fields':['calleridnum']},{'name':_0x8cda('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 6bb9945..30cd436 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xa5410d,_0x263e70){var _0x35a584=function(_0x55f7c4){while(--_0x55f7c4){_0xa5410d['push'](_0xa5410d['shift']());}};_0x35a584(++_0x263e70);}(_0x7a54,0x106));var _0x47a5=function(_0x3491db,_0x28d9d0){_0x3491db=_0x3491db-0x0;var _0x1f2725=_0x7a54[_0x3491db];return _0x1f2725;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x2664d9,_0x48bd0b){var _0x5a4343=function(_0x374cb4){while(--_0x374cb4){_0x2664d9['push'](_0x2664d9['shift']());}};_0x5a4343(++_0x48bd0b);}(_0x7a54,0x106));var _0x47a5=function(_0x53acf9,_0x49aebe){_0x53acf9=_0x53acf9-0x0;var _0x2d9705=_0x7a54[_0x53acf9];return _0x2d9705;};'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 95896e4..2ca1cbb 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 _0x7d74=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','describe','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x578473,_0x1d5330){var _0x26f53e=function(_0x1faf91){while(--_0x1faf91){_0x578473['push'](_0x578473['shift']());}};_0x26f53e(++_0x1d5330);}(_0x7d74,0x1e2));var _0x47d7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7d74[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var path=require(_0x47d7('0x2'));var timeout=require(_0x47d7('0x3'));var express=require(_0x47d7('0x4'));var router=express[_0x47d7('0x5')]();var fs_extra=require(_0x47d7('0x6'));var auth=require(_0x47d7('0x7'));var interaction=require(_0x47d7('0x8'));var config=require('../../config/environment');var controller=require(_0x47d7('0x9'));router[_0x47d7('0xa')]('/',auth[_0x47d7('0xb')](),controller['index']);router[_0x47d7('0xa')]('/describe',auth[_0x47d7('0xb')](),controller[_0x47d7('0xc')]);router[_0x47d7('0xa')]('/:id',auth[_0x47d7('0xb')](),controller['show']);router[_0x47d7('0xa')]('/voice/queue/countAttributes/:id',auth[_0x47d7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0x47d7('0xb')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')](_0x47d7('0xf'),auth['isAuthenticated'](),controller[_0x47d7('0x10')]);router[_0x47d7('0xe')](_0x47d7('0x11'),auth[_0x47d7('0xb')](),controller[_0x47d7('0x12')]);router[_0x47d7('0xe')](_0x47d7('0x13'),auth['isAuthenticated'](),controller[_0x47d7('0x14')]);router[_0x47d7('0x15')](_0x47d7('0x16'),auth[_0x47d7('0xb')](),controller[_0x47d7('0x17')]);module[_0x47d7('0x18')]=router; \ No newline at end of file +var _0xabf4=['show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x18dead,_0xc44380){var _0x228372=function(_0x48106e){while(--_0x48106e){_0x18dead['push'](_0x18dead['shift']());}};_0x228372(++_0xc44380);}(_0xabf4,0x196));var _0x4abf=function(_0x21c1f2,_0x1c307c){_0x21c1f2=_0x21c1f2-0x0;var _0x54d10e=_0xabf4[_0x21c1f2];return _0x54d10e;};'use strict';var multer=require(_0x4abf('0x0'));var util=require(_0x4abf('0x1'));var path=require(_0x4abf('0x2'));var timeout=require(_0x4abf('0x3'));var express=require(_0x4abf('0x4'));var router=express[_0x4abf('0x5')]();var fs_extra=require(_0x4abf('0x6'));var auth=require(_0x4abf('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4abf('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x4abf('0x9')]('/',auth[_0x4abf('0xa')](),controller[_0x4abf('0xb')]);router['get'](_0x4abf('0xc'),auth[_0x4abf('0xa')](),controller[_0x4abf('0xd')]);router['get']('/:id',auth[_0x4abf('0xa')](),controller[_0x4abf('0xe')]);router[_0x4abf('0x9')](_0x4abf('0xf'),auth[_0x4abf('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x4abf('0x10'),auth['isAuthenticated'](),controller[_0x4abf('0x11')]);router[_0x4abf('0x12')](_0x4abf('0x13'),auth[_0x4abf('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x4abf('0x12')](_0x4abf('0x14'),auth[_0x4abf('0xa')](),controller[_0x4abf('0x15')]);router[_0x4abf('0x12')](_0x4abf('0x16'),auth[_0x4abf('0xa')](),controller[_0x4abf('0x17')]);router[_0x4abf('0x18')](_0x4abf('0x19'),auth[_0x4abf('0xa')](),controller[_0x4abf('0x1a')]);module[_0x4abf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5a98b87..190935d 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 _0x158a=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x158a,0xdd));var _0xa158=function(_0x1e064d,_0x4a94ab){_0x1e064d=_0x1e064d-0x0;var _0x33d2e4=_0x158a[_0x1e064d];return _0x33d2e4;};'use strict';var Sequelize=require(_0xa158('0x0'));module['exports']={'state':{'type':Sequelize[_0xa158('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa158('0x2')]},'countbusyretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa158('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa158('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa158('0x3')]},'calleridnum':{'type':Sequelize[_0xa158('0x3')]},'calleridname':{'type':Sequelize[_0xa158('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa158('0x2')]},'answertime':{'type':Sequelize[_0xa158('0x2')]},'droptime':{'type':Sequelize[_0xa158('0x2')]},'endtime':{'type':Sequelize[_0xa158('0x2')]},'ringtime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa158('0x3')]},'campaign':{'type':Sequelize[_0xa158('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa158('0x3')]},'reason':{'type':Sequelize[_0xa158('0x3')]},'amd':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa158('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa158('0x2')]},'recallme':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa158('0x2')]},'edited':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa158('0x3')]}}; \ No newline at end of file +var _0x5aac=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x147040,_0x4db71a){var _0x3cab3c=function(_0x5248c2){while(--_0x5248c2){_0x147040['push'](_0x147040['shift']());}};_0x3cab3c(++_0x4db71a);}(_0x5aac,0x72));var _0xc5aa=function(_0x1f06fd,_0x12fbda){_0x1f06fd=_0x1f06fd-0x0;var _0x4b20d9=_0x5aac[_0x1f06fd];return _0x4b20d9;};'use strict';var Sequelize=require(_0xc5aa('0x0'));module[_0xc5aa('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xc5aa('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc5aa('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc5aa('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc5aa('0x2')]},'calleridnum':{'type':Sequelize[_0xc5aa('0x2')]},'calleridname':{'type':Sequelize[_0xc5aa('0x2')]},'starttime':{'type':Sequelize[_0xc5aa('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc5aa('0x4')]},'droptime':{'type':Sequelize[_0xc5aa('0x4')]},'endtime':{'type':Sequelize[_0xc5aa('0x4')]},'ringtime':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc5aa('0x2')]},'campaign':{'type':Sequelize[_0xc5aa('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc5aa('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xc5aa('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc5aa('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc5aa('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc5aa('0x4')]},'recallme':{'type':Sequelize[_0xc5aa('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc5aa('0x4')]},'edited':{'type':Sequelize[_0xc5aa('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc5aa('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc5aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1db8274..82782f5 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 _0xd4d0=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopperHistory','then','include','rows','show','params','keys','rawAttributes','includeAll','catch','create','body','describe','update','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5614cd,_0x5d6c18){var _0x4ca444=function(_0x3f5877){while(--_0x3f5877){_0x5614cd['push'](_0x5614cd['shift']());}};_0x4ca444(++_0x5d6c18);}(_0xd4d0,0x170));var _0x0d4d=function(_0x9ff648,_0x32f221){_0x9ff648=_0x9ff648-0x0;var _0x352c34=_0xd4d0[_0x9ff648];return _0x352c34;};'use strict';var emlformat=require(_0x0d4d('0x0'));var rimraf=require(_0x0d4d('0x1'));var zipdir=require(_0x0d4d('0x2'));var jsonpatch=require(_0x0d4d('0x3'));var rp=require('request-promise');var moment=require(_0x0d4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d4d('0x5'));var util=require(_0x0d4d('0x6'));var path=require(_0x0d4d('0x7'));var sox=require('sox');var csv=require(_0x0d4d('0x8'));var ejs=require(_0x0d4d('0x9'));var fs=require('fs');var fs_extra=require(_0x0d4d('0xa'));var _=require('lodash');var squel=require(_0x0d4d('0xb'));var crypto=require(_0x0d4d('0xc'));var jsforce=require(_0x0d4d('0xd'));var deskjs=require(_0x0d4d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0d4d('0xf'));var Papa=require(_0x0d4d('0x10'));var Redis=require('ioredis');var authService=require(_0x0d4d('0x11'));var qs=require(_0x0d4d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d4d('0x13'));var logger=require('../../config/logger')(_0x0d4d('0x14'));var utils=require('../../config/utils');var config=require(_0x0d4d('0x15'));var licenseUtil=require(_0x0d4d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403541,_0x1f6c78){_0x1f6c78=_0x1f6c78||0xcc;return function(_0x382d4b){if(_0x382d4b){return _0x403541[_0x0d4d('0x17')](_0x1f6c78);}return _0x403541[_0x0d4d('0x18')](_0x1f6c78)[_0x0d4d('0x19')]();};}function respondWithResult(_0x414c51,_0x2bc2f4){_0x2bc2f4=_0x2bc2f4||0xc8;return function(_0x1e68b5){if(_0x1e68b5){return _0x414c51[_0x0d4d('0x18')](_0x2bc2f4)[_0x0d4d('0x1a')](_0x1e68b5);}};}function respondWithFilteredResult(_0x22245b,_0x3eb7c2){return function(_0x202215){if(_0x202215){var _0x389833=typeof _0x3eb7c2['offset']==='undefined'&&typeof _0x3eb7c2[_0x0d4d('0x1b')]===_0x0d4d('0x1c');var _0x1cdce9=_0x202215[_0x0d4d('0x1d')];var _0x389076=_0x389833?0x0:_0x3eb7c2[_0x0d4d('0x1e')];var _0x489007=_0x389833?_0x202215[_0x0d4d('0x1d')]:_0x3eb7c2[_0x0d4d('0x1e')]+_0x3eb7c2[_0x0d4d('0x1b')];var _0x57f6f8;if(_0x489007>=_0x1cdce9){_0x489007=_0x1cdce9;_0x57f6f8=0xc8;}else{_0x57f6f8=0xce;}_0x22245b[_0x0d4d('0x18')](_0x57f6f8);return _0x22245b['set'](_0x0d4d('0x1f'),_0x389076+'-'+_0x489007+'/'+_0x1cdce9)[_0x0d4d('0x1a')](_0x202215);}return null;};}function patchUpdates(_0x241f0d){return function(_0x2c1cf0){try{jsonpatch[_0x0d4d('0x20')](_0x2c1cf0,_0x241f0d,!![]);}catch(_0x4cd0df){return BPromise[_0x0d4d('0x21')](_0x4cd0df);}return _0x2c1cf0[_0x0d4d('0x22')]();};}function saveUpdates(_0x32d463,_0x53be2b){return function(_0x5bbb03){if(_0x5bbb03){return _0x5bbb03['update'](_0x32d463)['then'](function(_0x5bf09f){return _0x5bf09f;});}return null;};}function removeEntity(_0x2bc06f,_0x22ebfd){return function(_0x1cbdc9){if(_0x1cbdc9){return _0x1cbdc9[_0x0d4d('0x23')]()['then'](function(){_0x2bc06f[_0x0d4d('0x18')](0xcc)[_0x0d4d('0x19')]();});}};}function handleEntityNotFound(_0x5ea252,_0x35c36c){return function(_0x16897e){if(!_0x16897e){_0x5ea252[_0x0d4d('0x17')](0x194);}return _0x16897e;};}function handleError(_0x345b2d,_0x59f2c2){_0x59f2c2=_0x59f2c2||0x1f4;return function(_0x3746e6){logger[_0x0d4d('0x24')](_0x3746e6[_0x0d4d('0x25')]);if(_0x3746e6['name']){delete _0x3746e6[_0x0d4d('0x26')];}_0x345b2d[_0x0d4d('0x18')](_0x59f2c2)[_0x0d4d('0x27')](_0x3746e6);};}exports[_0x0d4d('0x28')]=function(_0x588ec9,_0x2acb93){var _0x3008a5={},_0x1b4527={},_0xdf96c8={'count':0x0,'rows':[]};var _0x9dfcd=_[_0x0d4d('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x555e76){return{'name':_0x555e76[_0x0d4d('0x2a')],'type':_0x555e76[_0x0d4d('0x2b')][_0x0d4d('0x2c')]};});_0x1b4527[_0x0d4d('0x2d')]=_[_0x0d4d('0x29')](_0x9dfcd,_0x0d4d('0x26'));_0x1b4527['query']=_['keys'](_0x588ec9[_0x0d4d('0x2e')]);_0x1b4527[_0x0d4d('0x2f')]=_[_0x0d4d('0x30')](_0x1b4527['model'],_0x1b4527[_0x0d4d('0x2e')]);_0x3008a5[_0x0d4d('0x31')]=_['intersection'](_0x1b4527[_0x0d4d('0x2d')],qs[_0x0d4d('0x32')](_0x588ec9[_0x0d4d('0x2e')]['fields']));_0x3008a5[_0x0d4d('0x31')]=_0x3008a5[_0x0d4d('0x31')][_0x0d4d('0x33')]?_0x3008a5[_0x0d4d('0x31')]:_0x1b4527[_0x0d4d('0x2d')];if(!_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x34')](_0x0d4d('0x35'))){_0x3008a5[_0x0d4d('0x1b')]=qs[_0x0d4d('0x1b')](_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x1b')]);_0x3008a5[_0x0d4d('0x1e')]=qs[_0x0d4d('0x1e')](_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x1e')]);}_0x3008a5[_0x0d4d('0x36')]=qs[_0x0d4d('0x37')](_0x588ec9['query'][_0x0d4d('0x37')]);_0x3008a5[_0x0d4d('0x38')]=qs['filters'](_['pick'](_0x588ec9[_0x0d4d('0x2e')],_0x1b4527[_0x0d4d('0x2f')]),_0x9dfcd);if(_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x39')]){_0x3008a5[_0x0d4d('0x38')]=_[_0x0d4d('0x3a')](_0x3008a5[_0x0d4d('0x38')],{'$or':_['map'](_0x9dfcd,function(_0x57f1bd){if(_0x57f1bd[_0x0d4d('0x2b')]!==_0x0d4d('0x3b')){var _0x3232af={};_0x3232af[_0x57f1bd[_0x0d4d('0x26')]]={'$like':'%'+_0x588ec9['query'][_0x0d4d('0x39')]+'%'};return _0x3232af;}})});}_0x3008a5=_[_0x0d4d('0x3a')]({},_0x3008a5,_0x588ec9[_0x0d4d('0x3c')]);var _0x1c617a={'where':_0x3008a5['where']};return db[_0x0d4d('0x3d')]['count'](_0x1c617a)[_0x0d4d('0x3e')](function(_0x1da6bd){_0xdf96c8[_0x0d4d('0x1d')]=_0x1da6bd;if(_0x588ec9[_0x0d4d('0x2e')]['includeAll']){_0x3008a5[_0x0d4d('0x3f')]=[{'all':!![]}];}return db[_0x0d4d('0x3d')]['findAll'](_0x3008a5);})[_0x0d4d('0x3e')](function(_0x25fe78){_0xdf96c8[_0x0d4d('0x40')]=_0x25fe78;return _0xdf96c8;})[_0x0d4d('0x3e')](respondWithFilteredResult(_0x2acb93,_0x3008a5))['catch'](handleError(_0x2acb93,null));};exports[_0x0d4d('0x41')]=function(_0x31e040,_0x18bf46){var _0x3879bd={'raw':!![],'where':{'id':_0x31e040[_0x0d4d('0x42')]['id']}},_0x377567={};_0x377567[_0x0d4d('0x2d')]=_[_0x0d4d('0x43')](db['CmHopperHistory'][_0x0d4d('0x44')]);_0x377567[_0x0d4d('0x2e')]=_[_0x0d4d('0x43')](_0x31e040[_0x0d4d('0x2e')]);_0x377567['filters']=_['intersection'](_0x377567[_0x0d4d('0x2d')],_0x377567[_0x0d4d('0x2e')]);_0x3879bd[_0x0d4d('0x31')]=_[_0x0d4d('0x30')](_0x377567[_0x0d4d('0x2d')],qs[_0x0d4d('0x32')](_0x31e040['query']['fields']));_0x3879bd[_0x0d4d('0x31')]=_0x3879bd[_0x0d4d('0x31')]['length']?_0x3879bd['attributes']:_0x377567[_0x0d4d('0x2d')];if(_0x31e040['query'][_0x0d4d('0x45')]){_0x3879bd['include']=[{'all':!![]}];}_0x3879bd=_[_0x0d4d('0x3a')]({},_0x3879bd,_0x31e040[_0x0d4d('0x3c')]);return db[_0x0d4d('0x3d')]['find'](_0x3879bd)[_0x0d4d('0x3e')](handleEntityNotFound(_0x18bf46,null))['then'](respondWithResult(_0x18bf46,null))[_0x0d4d('0x46')](handleError(_0x18bf46,null));};exports[_0x0d4d('0x47')]=function(_0x1dfe45,_0x2daee4){return db['CmHopperHistory'][_0x0d4d('0x47')](_0x1dfe45[_0x0d4d('0x48')],{})[_0x0d4d('0x3e')](respondWithResult(_0x2daee4,0xc9))[_0x0d4d('0x46')](handleError(_0x2daee4,null));};exports['describe']=function(_0x50f874,_0x2c4f2d){return db[_0x0d4d('0x3d')][_0x0d4d('0x49')]()[_0x0d4d('0x3e')](respondWithResult(_0x2c4f2d,null))[_0x0d4d('0x46')](handleError(_0x2c4f2d,null));};exports[_0x0d4d('0x4a')]=function(_0xe66ef1,_0x2535db){if(_0xe66ef1[_0x0d4d('0x48')][_0x0d4d('0x4b')]){delete _0xe66ef1['body'][_0x0d4d('0x4b')];}return db[_0x0d4d('0x3d')][_0x0d4d('0x4c')]({'where':{'uniqueid':_0xe66ef1['params']['id']}})[_0x0d4d('0x3e')](handleEntityNotFound(_0x2535db,null))[_0x0d4d('0x3e')](saveUpdates(_0xe66ef1[_0x0d4d('0x48')],null))[_0x0d4d('0x3e')](respondWithResult(_0x2535db,null))[_0x0d4d('0x46')](handleError(_0x2535db,null));}; \ No newline at end of file +var _0x5930=['Content-Range','save','update','then','send','index','map','CmHopperHistory','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','find','create','body','describe','uniqueid','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x3ba813,_0x4acfd9){var _0x499b77=function(_0x1aaef8){while(--_0x1aaef8){_0x3ba813['push'](_0x3ba813['shift']());}};_0x499b77(++_0x4acfd9);}(_0x5930,0x184));var _0x0593=function(_0xaec7bb,_0x53dfb9){_0xaec7bb=_0xaec7bb-0x0;var _0x35174b=_0x5930[_0xaec7bb];return _0x35174b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0593('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0593('0x1'));var BPromise=require(_0x0593('0x2'));var Mustache=require(_0x0593('0x3'));var util=require(_0x0593('0x4'));var path=require(_0x0593('0x5'));var sox=require(_0x0593('0x6'));var csv=require(_0x0593('0x7'));var ejs=require(_0x0593('0x8'));var fs=require('fs');var fs_extra=require(_0x0593('0x9'));var _=require('lodash');var squel=require(_0x0593('0xa'));var crypto=require('crypto');var jsforce=require(_0x0593('0xb'));var deskjs=require(_0x0593('0xc'));var toCsv=require(_0x0593('0x7'));var querystring=require(_0x0593('0xd'));var Papa=require(_0x0593('0xe'));var Redis=require(_0x0593('0xf'));var authService=require(_0x0593('0x10'));var qs=require(_0x0593('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0593('0x12'));var logger=require(_0x0593('0x13'))(_0x0593('0x14'));var utils=require(_0x0593('0x15'));var config=require(_0x0593('0x16'));var licenseUtil=require(_0x0593('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17b243,_0x1172b9){_0x1172b9=_0x1172b9||0xcc;return function(_0x342582){if(_0x342582){return _0x17b243[_0x0593('0x18')](_0x1172b9);}return _0x17b243[_0x0593('0x19')](_0x1172b9)[_0x0593('0x1a')]();};}function respondWithResult(_0x409383,_0x1743ec){_0x1743ec=_0x1743ec||0xc8;return function(_0x4b63de){if(_0x4b63de){return _0x409383[_0x0593('0x19')](_0x1743ec)[_0x0593('0x1b')](_0x4b63de);}};}function respondWithFilteredResult(_0x5db5a8,_0x5dac3c){return function(_0x21c2c3){if(_0x21c2c3){var _0x128111=typeof _0x5dac3c[_0x0593('0x1c')]===_0x0593('0x1d')&&typeof _0x5dac3c[_0x0593('0x1e')]===_0x0593('0x1d');var _0x2fb192=_0x21c2c3[_0x0593('0x1f')];var _0x2df151=_0x128111?0x0:_0x5dac3c[_0x0593('0x1c')];var _0x393327=_0x128111?_0x21c2c3[_0x0593('0x1f')]:_0x5dac3c[_0x0593('0x1c')]+_0x5dac3c[_0x0593('0x1e')];var _0x9353c6;if(_0x393327>=_0x2fb192){_0x393327=_0x2fb192;_0x9353c6=0xc8;}else{_0x9353c6=0xce;}_0x5db5a8[_0x0593('0x19')](_0x9353c6);return _0x5db5a8['set'](_0x0593('0x20'),_0x2df151+'-'+_0x393327+'/'+_0x2fb192)[_0x0593('0x1b')](_0x21c2c3);}return null;};}function patchUpdates(_0x45e1b3){return function(_0xc40f5b){try{jsonpatch['apply'](_0xc40f5b,_0x45e1b3,!![]);}catch(_0x4699c3){return BPromise['reject'](_0x4699c3);}return _0xc40f5b[_0x0593('0x21')]();};}function saveUpdates(_0x3ae61e,_0x184b80){return function(_0x144f09){if(_0x144f09){return _0x144f09[_0x0593('0x22')](_0x3ae61e)[_0x0593('0x23')](function(_0x566735){return _0x566735;});}return null;};}function removeEntity(_0xb3e784,_0x58cbd8){return function(_0x18e74d){if(_0x18e74d){return _0x18e74d['destroy']()[_0x0593('0x23')](function(){_0xb3e784[_0x0593('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6c028,_0x3ac260){return function(_0x10ad0b){if(!_0x10ad0b){_0xd6c028[_0x0593('0x18')](0x194);}return _0x10ad0b;};}function handleError(_0x505855,_0x546ed2){_0x546ed2=_0x546ed2||0x1f4;return function(_0x2e93b7){logger['error'](_0x2e93b7['stack']);if(_0x2e93b7['name']){delete _0x2e93b7['name'];}_0x505855[_0x0593('0x19')](_0x546ed2)[_0x0593('0x24')](_0x2e93b7);};}exports[_0x0593('0x25')]=function(_0x31e41b,_0x34b912){var _0x36d2a5={},_0x27472e={},_0x3fa12c={'count':0x0,'rows':[]};var _0x25f2c1=_[_0x0593('0x26')](db[_0x0593('0x27')]['rawAttributes'],function(_0x49a046){return{'name':_0x49a046[_0x0593('0x28')],'type':_0x49a046[_0x0593('0x29')]['key']};});_0x27472e[_0x0593('0x2a')]=_['map'](_0x25f2c1,_0x0593('0x2b'));_0x27472e[_0x0593('0x2c')]=_['keys'](_0x31e41b[_0x0593('0x2c')]);_0x27472e[_0x0593('0x2d')]=_[_0x0593('0x2e')](_0x27472e[_0x0593('0x2a')],_0x27472e[_0x0593('0x2c')]);_0x36d2a5[_0x0593('0x2f')]=_[_0x0593('0x2e')](_0x27472e[_0x0593('0x2a')],qs[_0x0593('0x30')](_0x31e41b[_0x0593('0x2c')]['fields']));_0x36d2a5[_0x0593('0x2f')]=_0x36d2a5['attributes'][_0x0593('0x31')]?_0x36d2a5[_0x0593('0x2f')]:_0x27472e[_0x0593('0x2a')];if(!_0x31e41b[_0x0593('0x2c')]['hasOwnProperty']('nolimit')){_0x36d2a5[_0x0593('0x1e')]=qs[_0x0593('0x1e')](_0x31e41b['query']['limit']);_0x36d2a5['offset']=qs[_0x0593('0x1c')](_0x31e41b['query']['offset']);}_0x36d2a5[_0x0593('0x32')]=qs[_0x0593('0x33')](_0x31e41b['query'][_0x0593('0x33')]);_0x36d2a5[_0x0593('0x34')]=qs['filters'](_[_0x0593('0x35')](_0x31e41b[_0x0593('0x2c')],_0x27472e[_0x0593('0x2d')]),_0x25f2c1);if(_0x31e41b[_0x0593('0x2c')]['filter']){_0x36d2a5['where']=_['merge'](_0x36d2a5[_0x0593('0x34')],{'$or':_['map'](_0x25f2c1,function(_0x224b45){if(_0x224b45[_0x0593('0x29')]!=='VIRTUAL'){var _0x8ec9ac={};_0x8ec9ac[_0x224b45[_0x0593('0x2b')]]={'$like':'%'+_0x31e41b[_0x0593('0x2c')]['filter']+'%'};return _0x8ec9ac;}})});}_0x36d2a5=_['merge']({},_0x36d2a5,_0x31e41b[_0x0593('0x36')]);var _0x52dcb2={'where':_0x36d2a5[_0x0593('0x34')]};return db[_0x0593('0x27')][_0x0593('0x1f')](_0x52dcb2)['then'](function(_0x1705b4){_0x3fa12c[_0x0593('0x1f')]=_0x1705b4;if(_0x31e41b[_0x0593('0x2c')][_0x0593('0x37')]){_0x36d2a5[_0x0593('0x38')]=[{'all':!![]}];}return db[_0x0593('0x27')][_0x0593('0x39')](_0x36d2a5);})[_0x0593('0x23')](function(_0x575a19){_0x3fa12c[_0x0593('0x3a')]=_0x575a19;return _0x3fa12c;})[_0x0593('0x23')](respondWithFilteredResult(_0x34b912,_0x36d2a5))[_0x0593('0x3b')](handleError(_0x34b912,null));};exports[_0x0593('0x3c')]=function(_0x68326,_0x45021d){var _0x5346e6={'raw':!![],'where':{'id':_0x68326[_0x0593('0x3d')]['id']}},_0x5136e2={};_0x5136e2['model']=_[_0x0593('0x3e')](db[_0x0593('0x27')][_0x0593('0x3f')]);_0x5136e2['query']=_['keys'](_0x68326[_0x0593('0x2c')]);_0x5136e2[_0x0593('0x2d')]=_[_0x0593('0x2e')](_0x5136e2[_0x0593('0x2a')],_0x5136e2[_0x0593('0x2c')]);_0x5346e6[_0x0593('0x2f')]=_[_0x0593('0x2e')](_0x5136e2[_0x0593('0x2a')],qs[_0x0593('0x30')](_0x68326[_0x0593('0x2c')]['fields']));_0x5346e6[_0x0593('0x2f')]=_0x5346e6[_0x0593('0x2f')][_0x0593('0x31')]?_0x5346e6['attributes']:_0x5136e2[_0x0593('0x2a')];if(_0x68326[_0x0593('0x2c')][_0x0593('0x37')]){_0x5346e6['include']=[{'all':!![]}];}_0x5346e6=_[_0x0593('0x40')]({},_0x5346e6,_0x68326[_0x0593('0x36')]);return db['CmHopperHistory'][_0x0593('0x41')](_0x5346e6)[_0x0593('0x23')](handleEntityNotFound(_0x45021d,null))['then'](respondWithResult(_0x45021d,null))['catch'](handleError(_0x45021d,null));};exports[_0x0593('0x42')]=function(_0x4138d9,_0x8f9e8f){return db[_0x0593('0x27')]['create'](_0x4138d9[_0x0593('0x43')],{})['then'](respondWithResult(_0x8f9e8f,0xc9))['catch'](handleError(_0x8f9e8f,null));};exports[_0x0593('0x44')]=function(_0x2ef643,_0x4d18bc){return db['CmHopperHistory'][_0x0593('0x44')]()[_0x0593('0x23')](respondWithResult(_0x4d18bc,null))['catch'](handleError(_0x4d18bc,null));};exports['update']=function(_0x161b0e,_0x30bfe7){if(_0x161b0e['body'][_0x0593('0x45')]){delete _0x161b0e['body'][_0x0593('0x45')];}return db[_0x0593('0x27')][_0x0593('0x41')]({'where':{'uniqueid':_0x161b0e[_0x0593('0x3d')]['id']}})[_0x0593('0x23')](handleEntityNotFound(_0x30bfe7,null))[_0x0593('0x23')](saveUpdates(_0x161b0e[_0x0593('0x43')],null))[_0x0593('0x23')](respondWithResult(_0x30bfe7,null))[_0x0593('0x3b')](handleError(_0x30bfe7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 82a6763..45cf495 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 _0x1751=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x531c39,_0x499775){var _0x955259=function(_0x1a18fc){while(--_0x1a18fc){_0x531c39['push'](_0x531c39['shift']());}};_0x955259(++_0x499775);}(_0x1751,0x76));var _0x1175=function(_0x49a555,_0x4dd64f){_0x49a555=_0x49a555-0x0;var _0x311982=_0x1751[_0x49a555];return _0x311982;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'paranoid':![],'indexes':[{'name':_0x1175('0xe'),'fields':[_0x1175('0xe')]},{'name':_0x1175('0xf'),'fields':[_0x1175('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb296=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x111802,_0x47fe60){var _0x34f278=function(_0x310e2f){while(--_0x310e2f){_0x111802['push'](_0x111802['shift']());}};_0x34f278(++_0x47fe60);}(_0xb296,0xa3));var _0x6b29=function(_0x5ec2bc,_0x44f078){_0x5ec2bc=_0x5ec2bc-0x0;var _0x32c55c=_0xb296[_0x5ec2bc];return _0x32c55c;};'use strict';var _=require(_0x6b29('0x0'));var util=require(_0x6b29('0x1'));var logger=require(_0x6b29('0x2'))(_0x6b29('0x3'));var moment=require(_0x6b29('0x4'));var BPromise=require(_0x6b29('0x5'));var rp=require(_0x6b29('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b29('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b29('0x8'));module[_0x6b29('0x9')]=function(_0x5e0aa1,_0x327329){return _0x5e0aa1[_0x6b29('0xa')](_0x6b29('0xb'),attributes,{'tableName':_0x6b29('0xc'),'paranoid':![],'indexes':[{'name':_0x6b29('0xd'),'fields':['endtime']},{'name':_0x6b29('0xe'),'fields':[_0x6b29('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 a4693ae..69a17e7 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 _0x12c9=['findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','debug','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x54c239,_0x400ecb){var _0x3f4865=function(_0x24f40f){while(--_0x24f40f){_0x54c239['push'](_0x54c239['shift']());}};_0x3f4865(++_0x400ecb);}(_0x12c9,0x9f));var _0x912c=function(_0x554f07,_0x4200f3){_0x554f07=_0x554f07-0x0;var _0x145814=_0x12c9[_0x554f07];return _0x145814;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var moment=require(_0x912c('0x1'));var BPromise=require('bluebird');var rs=require(_0x912c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x912c('0x3'))['db'];var utils=require(_0x912c('0x4'));var logger=require(_0x912c('0x5'))(_0x912c('0x6'));var config=require(_0x912c('0x7'));var jayson=require(_0x912c('0x8'));var client=jayson[_0x912c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a317,_0xf08f88,_0x4745c5){return new BPromise(function(_0x486e08,_0x2d86b9){return client['request'](_0x31a317,_0x4745c5)['then'](function(_0x28a597){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,'request\x20sent');logger[_0x912c('0xa')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xf08f88,_0x912c('0xb'),JSON[_0x912c('0xc')](_0x28a597));if(_0x28a597[_0x912c('0xd')]){if(_0x28a597[_0x912c('0xd')][_0x912c('0xe')]===0x1f4){logger[_0x912c('0xd')](_0x912c('0xf'),_0xf08f88,_0x28a597['error'][_0x912c('0x10')]);return _0x2d86b9(_0x28a597[_0x912c('0xd')][_0x912c('0x10')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,_0x28a597[_0x912c('0xd')][_0x912c('0x10')]);return _0x486e08(_0x28a597['error'][_0x912c('0x10')]);}else{logger[_0x912c('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,'request\x20sent');_0x486e08(_0x28a597[_0x912c('0x12')][_0x912c('0x10')]);}})[_0x912c('0x13')](function(_0x533f99){logger[_0x912c('0xd')](_0x912c('0xf'),_0xf08f88,_0x533f99);_0x2d86b9(_0x533f99);});});}exports[_0x912c('0x14')]=function(_0x25b3d6){var _0x4b5255=this;return new Promise(function(_0x46d34c,_0x1c3af6){return db[_0x912c('0x15')][_0x912c('0x16')](_0x25b3d6['body'],{'raw':_0x25b3d6[_0x912c('0x17')]?_0x25b3d6[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![]})[_0x912c('0x19')](function(_0x551576){logger[_0x912c('0x11')](_0x912c('0x14'),_0x25b3d6);logger[_0x912c('0xa')](_0x912c('0x14'),_0x25b3d6,JSON['stringify'](_0x551576));_0x46d34c(_0x551576);})[_0x912c('0x13')](function(_0x27f644){logger[_0x912c('0xd')](_0x912c('0x14'),_0x27f644[_0x912c('0x10')],_0x25b3d6);_0x1c3af6(_0x4b5255['error'](0x1f4,_0x27f644[_0x912c('0x10')]));});});};exports[_0x912c('0x1a')]=function(_0x4e79ba){var _0x57f829=this;return new Promise(function(_0x47278e,_0x5e2bea){return db[_0x912c('0x15')]['findAll']({'raw':_0x4e79ba['options']?_0x4e79ba[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![],'where':_0x4e79ba['options']?_0x4e79ba['options'][_0x912c('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')][_0x912c('0x1e')]('id')),_0x912c('0x1f')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x912c('0x21')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x22')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x23'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x24')))),_0x912c('0x25')],[db['sequelize']['fn'](_0x912c('0x23'),db[_0x912c('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x912c('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x912c('0x19')](function(_0x53e664){logger[_0x912c('0x11')](_0x912c('0x1a'),_0x4e79ba);logger[_0x912c('0xa')](_0x912c('0x1a'),_0x4e79ba,JSON[_0x912c('0xc')](_0x53e664));_0x47278e(_0x53e664);})[_0x912c('0x13')](function(_0x245213){logger[_0x912c('0xd')](_0x912c('0x1a'),_0x245213['message'],_0x4e79ba);_0x5e2bea(_0x57f829[_0x912c('0xd')](0x1f4,_0x245213[_0x912c('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2bb739){var _0x22cab2=this;return new Promise(function(_0x1f4c8e,_0x42fb5d){return db['CmHopperHistory'][_0x912c('0x27')]({'raw':_0x2bb739['options']?_0x2bb739[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![],'where':_0x2bb739[_0x912c('0x17')]?_0x2bb739['options'][_0x912c('0x1b')]||null:null,'attributes':[[_0x912c('0x28'),_0x912c('0x29')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2a')))),'outboundNoSuchCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x2b')))),_0x912c('0x2c')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x2d')))),'outboundAnswerCallsDay'],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2e')))),'outboundBusyCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2f')))),_0x912c('0x30')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x31')))),_0x912c('0x32')],[db['sequelize']['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x912c('0x33')],[db['sequelize']['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x34')))),'outboundUnknownCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x35')))),_0x912c('0x36')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x912c('0x37')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x38')))),_0x912c('0x39')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x912c('0x3a')],[db['sequelize']['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x3b')))),_0x912c('0x39')],[db['sequelize']['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x3c')))),_0x912c('0x3d')]],'group':[_0x912c('0x28')]})[_0x912c('0x19')](function(_0x565f31){logger[_0x912c('0x11')](_0x912c('0x3e'),_0x2bb739);logger[_0x912c('0xa')](_0x912c('0x3e'),_0x2bb739,JSON[_0x912c('0xc')](_0x565f31));_0x1f4c8e(_0x565f31);})['catch'](function(_0x1e92c8){logger[_0x912c('0xd')](_0x912c('0x3e'),_0x1e92c8['message'],_0x2bb739);_0x42fb5d(_0x22cab2[_0x912c('0xd')](0x1f4,_0x1e92c8['message']));});});};exports[_0x912c('0x3f')]=function(_0x269773){var _0x4b4e2e=this;return new Promise(function(_0x2ade1d,_0x13cef7){return db['CmHopperHistory'][_0x912c('0x27')]({'raw':_0x269773[_0x912c('0x17')]?_0x269773['options']['raw']===undefined?!![]:![]:!![],'where':_0x269773[_0x912c('0x17')]?_0x269773[_0x912c('0x17')][_0x912c('0x1b')]||null:null,'attributes':[[_0x912c('0x28'),_0x912c('0x29')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['col']('id')),_0x912c('0x40')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2d')))),_0x912c('0x41')]],'group':[_0x912c('0x28')]})[_0x912c('0x19')](function(_0x1e7dad){logger[_0x912c('0x11')](_0x912c('0x3f'),_0x269773);logger[_0x912c('0xa')](_0x912c('0x3f'),_0x269773,JSON[_0x912c('0xc')](_0x1e7dad));_0x2ade1d(_0x1e7dad);})[_0x912c('0x13')](function(_0x35cd8a){logger[_0x912c('0xd')](_0x912c('0x3f'),_0x35cd8a[_0x912c('0x10')],_0x269773);_0x13cef7(_0x4b4e2e[_0x912c('0xd')](0x1f4,_0x35cd8a[_0x912c('0x10')]));});});}; \ No newline at end of file +var _0x4157=['outboundBusyCallsDay','`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','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay'];(function(_0x3604f0,_0x465f1e){var _0x31bfd1=function(_0x1329a1){while(--_0x1329a1){_0x3604f0['push'](_0x3604f0['shift']());}};_0x31bfd1(++_0x465f1e);}(_0x4157,0xf3));var _0x7415=function(_0x6cff0f,_0x140556){_0x6cff0f=_0x6cff0f-0x0;var _0x1ff0f3=_0x4157[_0x6cff0f];return _0x1ff0f3;};'use strict';var _=require(_0x7415('0x0'));var util=require(_0x7415('0x1'));var moment=require(_0x7415('0x2'));var BPromise=require(_0x7415('0x3'));var rs=require(_0x7415('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7415('0x5'))['db'];var utils=require(_0x7415('0x6'));var logger=require(_0x7415('0x7'))(_0x7415('0x8'));var config=require(_0x7415('0x9'));var jayson=require(_0x7415('0xa'));var client=jayson[_0x7415('0xb')][_0x7415('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7980,_0x49b694,_0x26fe93){return new BPromise(function(_0x588c5a,_0x972b02){return client['request'](_0x3c7980,_0x26fe93)[_0x7415('0xd')](function(_0x1a42df){logger[_0x7415('0xe')](_0x7415('0xf'),_0x49b694,_0x7415('0x10'));logger[_0x7415('0x11')](_0x7415('0x12'),_0x49b694,'request\x20sent',JSON[_0x7415('0x13')](_0x1a42df));if(_0x1a42df[_0x7415('0x14')]){if(_0x1a42df[_0x7415('0x14')][_0x7415('0x15')]===0x1f4){logger[_0x7415('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x49b694,_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);return _0x972b02(_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);}logger[_0x7415('0x14')](_0x7415('0xf'),_0x49b694,_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);return _0x588c5a(_0x1a42df[_0x7415('0x14')][_0x7415('0x16')]);}else{logger[_0x7415('0xe')](_0x7415('0xf'),_0x49b694,_0x7415('0x10'));_0x588c5a(_0x1a42df['result'][_0x7415('0x16')]);}})[_0x7415('0x17')](function(_0x2398d1){logger[_0x7415('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x49b694,_0x2398d1);_0x972b02(_0x2398d1);});});}exports[_0x7415('0x18')]=function(_0x2543f1){var _0x51efee=this;return new Promise(function(_0x302a2b,_0x510ae1){return db[_0x7415('0x19')][_0x7415('0x1a')](_0x2543f1[_0x7415('0x1b')],{'raw':_0x2543f1[_0x7415('0x1c')]?_0x2543f1[_0x7415('0x1c')][_0x7415('0x1d')]===undefined?!![]:![]:!![]})[_0x7415('0xd')](function(_0x36a934){logger[_0x7415('0xe')](_0x7415('0x18'),_0x2543f1);logger[_0x7415('0x11')]('CreateCmHopperHistory',_0x2543f1,JSON['stringify'](_0x36a934));_0x302a2b(_0x36a934);})[_0x7415('0x17')](function(_0x43df4a){logger[_0x7415('0x14')](_0x7415('0x18'),_0x43df4a['message'],_0x2543f1);_0x510ae1(_0x51efee[_0x7415('0x14')](0x1f4,_0x43df4a['message']));});});};exports['AvgHandleTime']=function(_0xca366e){var _0x31d6e5=this;return new Promise(function(_0x804d07,_0x1271ca){return db[_0x7415('0x19')][_0x7415('0x1e')]({'raw':_0xca366e[_0x7415('0x1c')]?_0xca366e[_0x7415('0x1c')][_0x7415('0x1d')]===undefined?!![]:![]:!![],'where':_0xca366e[_0x7415('0x1c')]?_0xca366e['options'][_0x7415('0x1f')]||null:null,'attributes':[[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')][_0x7415('0x22')]('id')),'predictiveIntervalTotalCalls'],[db[_0x7415('0x20')]['fn']('COUNT',db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0x7415('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x25')))),_0x7415('0x26')],[db['sequelize']['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x27')))),_0x7415('0x28')],[db[_0x7415('0x20')]['fn'](_0x7415('0x29'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x7415('0x2a')],[db[_0x7415('0x20')]['fn']('AVG',db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x2b')))),_0x7415('0x2c')]]})[_0x7415('0xd')](function(_0xbce78b){logger['info'](_0x7415('0x2d'),_0xca366e);logger[_0x7415('0x11')](_0x7415('0x2d'),_0xca366e,JSON[_0x7415('0x13')](_0xbce78b));_0x804d07(_0xbce78b);})[_0x7415('0x17')](function(_0x9bdee3){logger[_0x7415('0x14')]('AvgHandleTime',_0x9bdee3['message'],_0xca366e);_0x1271ca(_0x31d6e5[_0x7415('0x14')](0x1f4,_0x9bdee3['message']));});});};exports[_0x7415('0x2e')]=function(_0x385855){var _0x4fc53b=this;return new Promise(function(_0x488ea0,_0x51af31){return db[_0x7415('0x19')]['findAll']({'raw':_0x385855[_0x7415('0x1c')]?_0x385855[_0x7415('0x1c')][_0x7415('0x1d')]===undefined?!![]:![]:!![],'where':_0x385855['options']?_0x385855[_0x7415('0x1c')][_0x7415('0x1f')]||null:null,'attributes':[[_0x7415('0x2f'),_0x7415('0x30')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x31')))),_0x7415('0x32')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db['sequelize']['literal'](_0x7415('0x33')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x7415('0x34')],[db[_0x7415('0x20')]['fn']('COUNT',db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x7415('0x35')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db['sequelize'][_0x7415('0x23')](_0x7415('0x36')))),_0x7415('0x37')],[db[_0x7415('0x20')]['fn']('COUNT',db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x7415('0x38')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db['sequelize'][_0x7415('0x23')](_0x7415('0x39')))),_0x7415('0x3a')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x3b')))),_0x7415('0x3c')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')]['literal'](_0x7415('0x3d')))),_0x7415('0x3e')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db['sequelize']['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x3f')))),_0x7415('0x40')],[db[_0x7415('0x20')]['fn']('COUNT',db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x41')))),_0x7415('0x42')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x7415('0x23')](_0x7415('0x43')))),_0x7415('0x44')],[db['sequelize']['fn']('COUNT',db[_0x7415('0x20')]['fn']('IF',db['sequelize']['literal'](_0x7415('0x45')))),'outboundRejectCallsDay'],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')]['fn']('IF',db[_0x7415('0x20')][_0x7415('0x23')](_0x7415('0x46')))),'outboundReCallsDay']],'group':[_0x7415('0x2f')]})[_0x7415('0xd')](function(_0x51c42d){logger[_0x7415('0xe')](_0x7415('0x2e'),_0x385855);logger[_0x7415('0x11')](_0x7415('0x2e'),_0x385855,JSON[_0x7415('0x13')](_0x51c42d));_0x488ea0(_0x51c42d);})[_0x7415('0x17')](function(_0x4c52ab){logger[_0x7415('0x14')](_0x7415('0x2e'),_0x4c52ab['message'],_0x385855);_0x51af31(_0x4fc53b[_0x7415('0x14')](0x1f4,_0x4c52ab['message']));});});};exports['GetCampaignHopperHistory']=function(_0x22b925){var _0x348ec6=this;return new Promise(function(_0x2a4dc5,_0x35f16e){return db[_0x7415('0x19')][_0x7415('0x1e')]({'raw':_0x22b925['options']?_0x22b925[_0x7415('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22b925[_0x7415('0x1c')]?_0x22b925[_0x7415('0x1c')][_0x7415('0x1f')]||null:null,'attributes':[[_0x7415('0x2f'),_0x7415('0x30')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')][_0x7415('0x22')]('id')),_0x7415('0x47')],[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7415('0x24')))),_0x7415('0x48')]],'group':[_0x7415('0x2f')]})[_0x7415('0xd')](function(_0x2d662c){logger[_0x7415('0xe')]('GetCampaignHopperHistory',_0x22b925);logger[_0x7415('0x11')](_0x7415('0x49'),_0x22b925,JSON['stringify'](_0x2d662c));_0x2a4dc5(_0x2d662c);})['catch'](function(_0x2b551f){logger[_0x7415('0x14')]('GetCampaignHopperHistory',_0x2b551f[_0x7415('0x16')],_0x22b925);_0x35f16e(_0x348ec6[_0x7415('0x14')](0x1f4,_0x2b551f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 272f5c7..94b920a 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 _0x0915=['isAuthenticated','index','describe','show','/:id','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x94f612,_0x40bb0f){var _0x4f677c=function(_0x575177){while(--_0x575177){_0x94f612['push'](_0x94f612['shift']());}};_0x4f677c(++_0x40bb0f);}(_0x0915,0x11e));var _0x5091=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x0915[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var path=require(_0x5091('0x2'));var timeout=require(_0x5091('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5091('0x4'));var config=require(_0x5091('0x5'));var controller=require(_0x5091('0x6'));router[_0x5091('0x7')]('/',auth[_0x5091('0x8')](),controller[_0x5091('0x9')]);router[_0x5091('0x7')]('/describe',auth[_0x5091('0x8')](),controller[_0x5091('0xa')]);router[_0x5091('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5091('0xb')]);router['post']('/',auth[_0x5091('0x8')](),controller['create']);router['put'](_0x5091('0xc'),auth[_0x5091('0x8')](),controller['update']);module[_0x5091('0xd')]=router; \ No newline at end of file +var _0xc00d=['post','create','put','/:id','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','isAuthenticated','describe','show'];(function(_0x497948,_0x4ca60c){var _0x39bb36=function(_0x2ec88e){while(--_0x2ec88e){_0x497948['push'](_0x497948['shift']());}};_0x39bb36(++_0x4ca60c);}(_0xc00d,0x149));var _0xdc00=function(_0x27b8e9,_0xc4eb5f){_0x27b8e9=_0x27b8e9-0x0;var _0x1af1ac=_0xc00d[_0x27b8e9];return _0x1af1ac;};'use strict';var multer=require(_0xdc00('0x0'));var util=require(_0xdc00('0x1'));var path=require('path');var timeout=require(_0xdc00('0x2'));var express=require('express');var router=express[_0xdc00('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc00('0x4'));var interaction=require(_0xdc00('0x5'));var config=require(_0xdc00('0x6'));var controller=require(_0xdc00('0x7'));router[_0xdc00('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc00('0x8')](_0xdc00('0x9'),auth[_0xdc00('0xa')](),controller[_0xdc00('0xb')]);router[_0xdc00('0x8')]('/:id',auth[_0xdc00('0xa')](),controller[_0xdc00('0xc')]);router[_0xdc00('0xd')]('/',auth[_0xdc00('0xa')](),controller[_0xdc00('0xe')]);router[_0xdc00('0xf')](_0xdc00('0x10'),auth['isAuthenticated'](),controller[_0xdc00('0x11')]);module[_0xdc00('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 34721ce..3868573 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 _0x1f63=['name','STRING','sequelize','exports'];(function(_0x35c1df,_0x7e0b8){var _0x2919f5=function(_0x11e960){while(--_0x11e960){_0x35c1df['push'](_0x35c1df['shift']());}};_0x2919f5(++_0x7e0b8);}(_0x1f63,0x7a));var _0x31f6=function(_0x8f92a9,_0x149334){_0x8f92a9=_0x8f92a9-0x0;var _0xaea6a7=_0x1f63[_0x8f92a9];return _0xaea6a7;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x31f6('0x3')]},'dialPrefix':{'type':Sequelize[_0x31f6('0x3')]}}; \ No newline at end of file +var _0x2bd6=['sequelize','exports','STRING','name'];(function(_0x1e4151,_0x470174){var _0x1dc64c=function(_0x481112){while(--_0x481112){_0x1e4151['push'](_0x1e4151['shift']());}};_0x1dc64c(++_0x470174);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x2bd6[_0x25efdf];return _0x22c495;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'name':{'type':Sequelize[_0x62bd('0x2')],'unique':_0x62bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x62bd('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index ba906ac..2c40d8f 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 _0x6d6d=['includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','length','order','ListId','rows','removeDispositions','CmContact','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','text','TEXT','number','Sequelize','INTEGER','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','then','get','UserProfileResource','destroy','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x405882,_0x2fd472){var _0x25e4fe=function(_0x443e78){while(--_0x443e78){_0x405882['push'](_0x405882['shift']());}};_0x25e4fe(++_0x2fd472);}(_0x6d6d,0xe0));var _0xd6d6=function(_0x12cfdb,_0x5bd754){_0x12cfdb=_0x12cfdb-0x0;var _0x211ad5=_0x6d6d[_0x12cfdb];return _0x211ad5;};'use strict';var emlformat=require(_0xd6d6('0x0'));var rimraf=require(_0xd6d6('0x1'));var zipdir=require(_0xd6d6('0x2'));var jsonpatch=require(_0xd6d6('0x3'));var rp=require(_0xd6d6('0x4'));var moment=require(_0xd6d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd6d6('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6d6('0x7'));var csv=require(_0xd6d6('0x8'));var ejs=require(_0xd6d6('0x9'));var fs=require('fs');var fs_extra=require(_0xd6d6('0xa'));var _=require(_0xd6d6('0xb'));var squel=require(_0xd6d6('0xc'));var crypto=require(_0xd6d6('0xd'));var jsforce=require(_0xd6d6('0xe'));var deskjs=require(_0xd6d6('0xf'));var toCsv=require(_0xd6d6('0x8'));var querystring=require(_0xd6d6('0x10'));var Papa=require(_0xd6d6('0x11'));var Redis=require(_0xd6d6('0x12'));var authService=require(_0xd6d6('0x13'));var qs=require(_0xd6d6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6d6('0x15'));var utils=require('../../config/utils');var config=require(_0xd6d6('0x16'));var licenseUtil=require(_0xd6d6('0x17'));var db=require('../../mysqldb')['db'];config[_0xd6d6('0x18')]=_[_0xd6d6('0x19')](config[_0xd6d6('0x18')],{'host':_0xd6d6('0x1a'),'port':0x18eb});var socket=require(_0xd6d6('0x1b'))(new Redis(config[_0xd6d6('0x18')]));require(_0xd6d6('0x1c'))[_0xd6d6('0x1d')](socket);function respondWithStatusCode(_0x13e4b9,_0x1febf3){_0x1febf3=_0x1febf3||0xcc;return function(_0x138c55){if(_0x138c55){return _0x13e4b9[_0xd6d6('0x1e')](_0x1febf3);}return _0x13e4b9[_0xd6d6('0x1f')](_0x1febf3)[_0xd6d6('0x20')]();};}function respondWithResult(_0x2ca041,_0x4ea2f0){_0x4ea2f0=_0x4ea2f0||0xc8;return function(_0xc5e0be){if(_0xc5e0be){return _0x2ca041[_0xd6d6('0x1f')](_0x4ea2f0)[_0xd6d6('0x21')](_0xc5e0be);}};}function respondWithFilteredResult(_0x2f0fcc,_0x36611b){return function(_0x1301e7){if(_0x1301e7){var _0x50d26f=typeof _0x36611b['offset']===_0xd6d6('0x22')&&typeof _0x36611b[_0xd6d6('0x23')]===_0xd6d6('0x22');var _0x10ca89=_0x1301e7[_0xd6d6('0x24')];var _0x4eec82=_0x50d26f?0x0:_0x36611b[_0xd6d6('0x25')];var _0x1870c0=_0x50d26f?_0x1301e7[_0xd6d6('0x24')]:_0x36611b[_0xd6d6('0x25')]+_0x36611b['limit'];var _0x3137f2;if(_0x1870c0>=_0x10ca89){_0x1870c0=_0x10ca89;_0x3137f2=0xc8;}else{_0x3137f2=0xce;}_0x2f0fcc[_0xd6d6('0x1f')](_0x3137f2);return _0x2f0fcc['set']('Content-Range',_0x4eec82+'-'+_0x1870c0+'/'+_0x10ca89)[_0xd6d6('0x21')](_0x1301e7);}return null;};}function patchUpdates(_0x186a42){return function(_0x585505){try{jsonpatch['apply'](_0x585505,_0x186a42,!![]);}catch(_0xbc3876){return BPromise['reject'](_0xbc3876);}return _0x585505['save']();};}function saveUpdates(_0x421356,_0x2ef58e){return function(_0x15a0f1){if(_0x15a0f1){return _0x15a0f1['update'](_0x421356)[_0xd6d6('0x26')](function(_0x3f16d2){return _0x3f16d2;});}return null;};}function removeEntity(_0x31405c,_0x492057){return function(_0x2a86aa){if(_0x2a86aa){return _0x2a86aa['destroy']()['then'](function(){var _0x4cb6c7=_0x2a86aa[_0xd6d6('0x27')]({'plain':!![]});var _0x5c55cf='Lists';return db[_0xd6d6('0x28')][_0xd6d6('0x29')]({'where':{'type':_0x5c55cf,'resourceId':_0x4cb6c7['id']}})[_0xd6d6('0x26')](function(){return _0x2a86aa;});})['then'](function(){_0x31405c[_0xd6d6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1016a5,_0x1a9ef1){return function(_0x50c837){if(!_0x50c837){_0x1016a5['sendStatus'](0x194);}return _0x50c837;};}function handleError(_0x352ef0,_0xfb4381){_0xfb4381=_0xfb4381||0x1f4;return function(_0x59a822){logger[_0xd6d6('0x2a')](_0x59a822[_0xd6d6('0x2b')]);if(_0x59a822[_0xd6d6('0x2c')]){delete _0x59a822['name'];}_0x352ef0['status'](_0xfb4381)['send'](_0x59a822);};}exports[_0xd6d6('0x2d')]=function(_0x48c644,_0x169830){var _0x187234={},_0x294852={},_0x4994a2={'count':0x0,'rows':[]};var _0x27060d=_[_0xd6d6('0x2e')](db[_0xd6d6('0x2f')][_0xd6d6('0x30')],function(_0x8958f2){return{'name':_0x8958f2[_0xd6d6('0x31')],'type':_0x8958f2[_0xd6d6('0x32')][_0xd6d6('0x33')]};});_0x294852[_0xd6d6('0x34')]=_[_0xd6d6('0x2e')](_0x27060d,'name');_0x294852[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x48c644[_0xd6d6('0x35')]);_0x294852[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x294852[_0xd6d6('0x34')],_0x294852[_0xd6d6('0x35')]);_0x187234[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x294852[_0xd6d6('0x34')],qs[_0xd6d6('0x3a')](_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x187234['attributes']=_0x187234[_0xd6d6('0x39')]['length']?_0x187234[_0xd6d6('0x39')]:_0x294852['model'];if(!_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x187234[_0xd6d6('0x23')]=qs['limit'](_0x48c644[_0xd6d6('0x35')]['limit']);_0x187234[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0x48c644['query'][_0xd6d6('0x25')]);}_0x187234['order']=qs[_0xd6d6('0x3d')](_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x187234[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x48c644[_0xd6d6('0x35')],_0x294852[_0xd6d6('0x37')]),_0x27060d);if(_0x48c644['query'][_0xd6d6('0x40')]){_0x187234[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x187234[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0x27060d,function(_0x4d8fec){if(_0x4d8fec['type']!==_0xd6d6('0x42')){var _0x25305f={};_0x25305f[_0x4d8fec['name']]={'$like':'%'+_0x48c644['query'][_0xd6d6('0x40')]+'%'};return _0x25305f;}})});}_0x187234=_[_0xd6d6('0x41')]({},_0x187234,_0x48c644[_0xd6d6('0x43')]);var _0x9b5345={'where':_0x187234[_0xd6d6('0x3e')]};return db['CmList'][_0xd6d6('0x24')](_0x9b5345)[_0xd6d6('0x26')](function(_0x5ab8eb){_0x4994a2[_0xd6d6('0x24')]=_0x5ab8eb;if(_0x48c644['query'][_0xd6d6('0x44')]){_0x187234['include']=[{'all':!![]}];}return db[_0xd6d6('0x2f')][_0xd6d6('0x45')](_0x187234);})[_0xd6d6('0x26')](function(_0x9faed9){_0x4994a2['rows']=_0x9faed9;return _0x4994a2;})[_0xd6d6('0x26')](respondWithFilteredResult(_0x169830,_0x187234))[_0xd6d6('0x46')](handleError(_0x169830,null));};exports[_0xd6d6('0x47')]=function(_0x1d5fd1,_0x1a0b2f){var _0x2de613={'raw':![],'where':{'id':_0x1d5fd1[_0xd6d6('0x48')]['id']}},_0x5dbf18={};_0x5dbf18[_0xd6d6('0x34')]=_['keys'](db[_0xd6d6('0x2f')][_0xd6d6('0x30')]);_0x5dbf18[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x1d5fd1[_0xd6d6('0x35')]);_0x5dbf18['filters']=_[_0xd6d6('0x38')](_0x5dbf18[_0xd6d6('0x34')],_0x5dbf18[_0xd6d6('0x35')]);_0x2de613[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x5dbf18[_0xd6d6('0x34')],qs['fields'](_0x1d5fd1[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x2de613['attributes']=_0x2de613[_0xd6d6('0x39')]['length']?_0x2de613[_0xd6d6('0x39')]:_0x5dbf18[_0xd6d6('0x34')];if(_0x1d5fd1[_0xd6d6('0x35')]['includeAll']){_0x2de613[_0xd6d6('0x49')]=[{'all':!![]}];}_0x2de613=_[_0xd6d6('0x41')]({},_0x2de613,_0x1d5fd1['options']);return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')](_0x2de613)['then'](handleEntityNotFound(_0x1a0b2f,null))[_0xd6d6('0x26')](respondWithResult(_0x1a0b2f,null))[_0xd6d6('0x46')](handleError(_0x1a0b2f,null));};exports[_0xd6d6('0x4b')]=function(_0x1bfe83,_0x3121b3){return db[_0xd6d6('0x2f')]['create'](_0x1bfe83[_0xd6d6('0x4c')],{})['then'](function(_0x3fe5c1){var _0x189ae6=_0x1bfe83[_0xd6d6('0x4d')][_0xd6d6('0x27')]({'plain':!![]});if(!_0x189ae6)throw new Error(_0xd6d6('0x4e'));if(_0x189ae6['role']===_0xd6d6('0x4d')){var _0x34fcf5=_0x3fe5c1[_0xd6d6('0x27')]({'plain':!![]});var _0x4d78d5=_0xd6d6('0x4f');return db[_0xd6d6('0x50')][_0xd6d6('0x4a')]({'where':{'name':_0x4d78d5,'userProfileId':_0x189ae6['userProfileId']},'raw':!![]})[_0xd6d6('0x26')](function(_0x23822c){if(_0x23822c&&_0x23822c[_0xd6d6('0x51')]===0x0){return db[_0xd6d6('0x28')]['create']({'name':_0x34fcf5[_0xd6d6('0x2c')],'resourceId':_0x34fcf5['id'],'type':_0x23822c[_0xd6d6('0x2c')],'sectionId':_0x23822c['id']},{})['then'](function(){return _0x3fe5c1;});}else{return _0x3fe5c1;}})[_0xd6d6('0x46')](function(_0x1f98c0){logger[_0xd6d6('0x2a')](_0xd6d6('0x52'),_0x1f98c0);throw _0x1f98c0;});}return _0x3fe5c1;})['then'](respondWithResult(_0x3121b3,0xc9))['catch'](handleError(_0x3121b3,null));};exports[_0xd6d6('0x53')]=function(_0x53533a,_0x4c520f){if(_0x53533a['body']['id']){delete _0x53533a[_0xd6d6('0x4c')]['id'];}return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x53533a['params']['id']}})['then'](handleEntityNotFound(_0x4c520f,null))['then'](saveUpdates(_0x53533a['body'],null))['then'](respondWithResult(_0x4c520f,null))['catch'](handleError(_0x4c520f,null));};exports[_0xd6d6('0x29')]=function(_0x58926f,_0x110f7a){return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x58926f[_0xd6d6('0x48')]['id']}})['then'](handleEntityNotFound(_0x110f7a,null))[_0xd6d6('0x26')](removeEntity(_0x110f7a,null))[_0xd6d6('0x46')](handleError(_0x110f7a,null));};exports[_0xd6d6('0x54')]=function(_0x5f5332,_0x483e4b){return db[_0xd6d6('0x2f')][_0xd6d6('0x54')]()[_0xd6d6('0x26')](respondWithResult(_0x483e4b,null))[_0xd6d6('0x46')](handleError(_0x483e4b,null));};exports[_0xd6d6('0x55')]=function(_0x49cdf3,_0x24cabe,_0x4d0433){if(_0x49cdf3[_0xd6d6('0x4c')]['id']){delete _0x49cdf3['body']['id'];}return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x49cdf3[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x24cabe,null))[_0xd6d6('0x26')](function(_0x2367e5){if(_0x2367e5){_0x49cdf3[_0xd6d6('0x4c')]['ListId']=_0x2367e5['id'];return db[_0xd6d6('0x56')][_0xd6d6('0x4b')](_0x49cdf3[_0xd6d6('0x4c')]);}})[_0xd6d6('0x26')](respondWithResult(_0x24cabe,null))[_0xd6d6('0x46')](handleError(_0x24cabe,null));};exports[_0xd6d6('0x57')]=function(_0xdd8af2,_0x1856cb,_0x489461){var _0x500f01={'raw':![],'where':{}};var _0x2f7e65={};var _0x5a7808={'count':0x0,'rows':[]};return db[_0xd6d6('0x2f')][_0xd6d6('0x58')]({'where':{'id':_0xdd8af2[_0xd6d6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1856cb,null))['then'](function(_0x494503){if(_0x494503){_0x2f7e65[_0xd6d6('0x34')]=_[_0xd6d6('0x36')](db[_0xd6d6('0x56')][_0xd6d6('0x30')]);_0x2f7e65[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0xdd8af2[_0xd6d6('0x35')]);_0x2f7e65[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x2f7e65['model'],_0x2f7e65[_0xd6d6('0x35')]);_0x500f01[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x2f7e65['model'],qs[_0xd6d6('0x3a')](_0xdd8af2['query'][_0xd6d6('0x3a')]));_0x500f01[_0xd6d6('0x39')]=_0x500f01[_0xd6d6('0x39')][_0xd6d6('0x59')]?_0x500f01[_0xd6d6('0x39')]:_0x2f7e65[_0xd6d6('0x34')];if(!_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x500f01['limit']=qs[_0xd6d6('0x23')](_0xdd8af2[_0xd6d6('0x35')]['limit']);_0x500f01[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0x500f01[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x500f01[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_['pick'](_0xdd8af2[_0xd6d6('0x35')],_0x2f7e65[_0xd6d6('0x37')]));_0x500f01[_0xd6d6('0x3e')][_0xd6d6('0x5b')]=_0x494503['id'];if(_0xdd8af2[_0xd6d6('0x35')]['filter']){_0x500f01[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x500f01[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0x500f01[_0xd6d6('0x39')],function(_0x48a39f){var _0x17107d={};_0x17107d[_0x48a39f]={'$like':'%'+_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x17107d;})});}_0x500f01=_['merge']({},_0x500f01,_0xdd8af2[_0xd6d6('0x43')]);return db[_0xd6d6('0x56')][_0xd6d6('0x24')]({'where':_0x500f01['where']})['then'](function(_0x8e5ae8){_0x5a7808['count']=_0x8e5ae8;if(_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x44')]){_0x500f01[_0xd6d6('0x49')]=[{'all':!![]}];}return db[_0xd6d6('0x56')][_0xd6d6('0x45')](_0x500f01);})[_0xd6d6('0x26')](function(_0x56e74b){_0x5a7808[_0xd6d6('0x5c')]=_0x56e74b;return _0x5a7808;});}})[_0xd6d6('0x26')](respondWithFilteredResult(_0x1856cb,_0x500f01))[_0xd6d6('0x46')](handleError(_0x1856cb,null));};exports['removeDispositions']=function(_0x15b7ce,_0x47fa05,_0x8c6ea9){return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x15b7ce[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x47fa05,null))['then'](function(_0x181faa){if(_0x181faa){return _0x181faa[_0xd6d6('0x5d')](_0x15b7ce[_0xd6d6('0x35')]['ids']);}})[_0xd6d6('0x26')](respondWithStatusCode(_0x47fa05,null))[_0xd6d6('0x46')](handleError(_0x47fa05,null));};exports['addContacts']=function(_0x13d5c9,_0x3af37b,_0x55f13c){return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x13d5c9[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x3af37b,null))[_0xd6d6('0x26')](function(_0x578aa7){if(_0x578aa7){var _0x42baba=[];var _0x2f0a33={'success':[],'errors':[]};return db[_0xd6d6('0x5e')]['describe']()['then'](function(_0x4d62ab){if(_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')]&&_[_0xd6d6('0x60')](_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')])){if(_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')]['length']){_0x13d5c9['body'][_0xd6d6('0x5f')]=_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')][_0xd6d6('0x61')](';')+';';}else{_0x13d5c9['body']['tags']=null;}}else{_0x13d5c9[_0xd6d6('0x4c')]['tags']=null;}if(_0x13d5c9['body']&&_['isArray'](_0x13d5c9[_0xd6d6('0x4c')])){for(var _0x207e7e=0x0;_0x207e7e<_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x59')];_0x207e7e+=0x1){_0x13d5c9[_0xd6d6('0x4c')][_0x207e7e][_0xd6d6('0x5b')]=_0x13d5c9['params']['id'];_0x42baba[_0xd6d6('0x62')](_0x13d5c9[_0xd6d6('0x4c')][_0x207e7e]);}return BPromise[_0xd6d6('0x63')](_0x42baba,function(_0x9f4026){return db[_0xd6d6('0x5e')][_0xd6d6('0x4b')](_[_0xd6d6('0x64')](_0x9f4026,[_0xd6d6('0x65'),'id'])||{},{'fields':_[_0xd6d6('0x36')](_0x4d62ab),'raw':!![]})[_0xd6d6('0x26')](function(_0x5099d8){_0x2f0a33[_0xd6d6('0x66')][_0xd6d6('0x62')](_0x5099d8[_0xd6d6('0x67')]);})[_0xd6d6('0x46')](function(_0x379c6c){_0x2f0a33[_0xd6d6('0x68')][_0xd6d6('0x62')]({'data':_0x9f4026,'error':_0x379c6c[_0xd6d6('0x69')]});});})['then'](function(_0x109317){return _0x2f0a33;})[_0xd6d6('0x46')](function(_0x46932e){return _0x46932e;});}else{_0x3af37b['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd6d6('0x26')](respondWithResult(_0x3af37b,null))[_0xd6d6('0x46')](handleError(_0x3af37b,null));};exports[_0xd6d6('0x6a')]=function(_0xe1696,_0x107ab7,_0x4cf31a){var _0x303197;return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0xe1696[_0xd6d6('0x48')]['id']},'include':[{'model':db[_0xd6d6('0x6b')],'as':_0xd6d6('0x6c')}]})[_0xd6d6('0x26')](handleEntityNotFound(_0x107ab7,null))[_0xd6d6('0x26')](function(_0x15023f){if(_0x15023f){_0x303197=_0x15023f;return db['CmContact'][_0xd6d6('0x30')];}})['then'](function(_0x59bab7){if(_0x59bab7){var _0x840372={};var _0x23649a={};_0x23649a['model']=_[_0xd6d6('0x6d')](_[_0xd6d6('0x36')](_0x59bab7),_['map'](_0x303197['CustomFields'],function(_0x4fe8da){return util['format'](_0xd6d6('0x6e'),_0x4fe8da['id']);}));_0x23649a[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0xe1696[_0xd6d6('0x35')]);_0x23649a['filters']=_[_0xd6d6('0x38')](_0x23649a[_0xd6d6('0x34')],_0x23649a[_0xd6d6('0x35')]);_0x840372['attributes']=_['intersection'](_0x23649a[_0xd6d6('0x34')],qs['fields'](_0xe1696['query'][_0xd6d6('0x3a')]));_0x840372['attributes']=_0x840372[_0xd6d6('0x39')]['length']?_0x840372[_0xd6d6('0x39')]:_0x23649a[_0xd6d6('0x34')];if(!_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x840372['limit']=qs['limit'](_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0x840372[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0x840372['order']=qs[_0xd6d6('0x3d')](_0xe1696['query'][_0xd6d6('0x3d')]);_0x840372[_0xd6d6('0x3e')]=qs['filters'](_[_0xd6d6('0x3f')](_0xe1696['query'],_0x23649a[_0xd6d6('0x37')]));_0x840372[_0xd6d6('0x6f')]=!![];if(_0xe1696[_0xd6d6('0x35')]['filter']){_0x840372['where']=_[_0xd6d6('0x41')](_0x840372[_0xd6d6('0x3e')],{'$or':_['map'](_0x840372[_0xd6d6('0x39')],function(_0x2a8d2a){var _0x516b5d={};_0x516b5d[_0x2a8d2a]={'$like':'%'+_0xe1696['query'][_0xd6d6('0x40')]+'%'};return _0x516b5d;})});}_0x840372=_['merge']({},_0x840372,_0xe1696['options']);return _0x303197[_0xd6d6('0x6a')](_0x840372);}})['then'](respondWithResult(_0x107ab7,null))[_0xd6d6('0x46')](handleError(_0x107ab7,null));};exports[_0xd6d6('0x70')]=function(_0x54c5e8,_0x36a4a9,_0x21ca30){var _0x309242;return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x54c5e8[_0xd6d6('0x48')]['id']},'include':[{'model':db[_0xd6d6('0x6b')],'as':_0xd6d6('0x6c')}]})[_0xd6d6('0x26')](handleEntityNotFound(_0x36a4a9,null))[_0xd6d6('0x26')](function(_0x2fccf5){if(_0x2fccf5){_0x309242=_0x2fccf5;return db[_0xd6d6('0x5e')]['rawAttributes'];}})[_0xd6d6('0x26')](function(_0x241f37){if(_0x241f37){var _0xc28475={};var _0x569de4={};_0x569de4[_0xd6d6('0x34')]=_[_0xd6d6('0x6d')](_[_0xd6d6('0x36')](_0x241f37),_[_0xd6d6('0x2e')](_0x309242[_0xd6d6('0x6c')],function(_0x11b921){return util[_0xd6d6('0x71')](_0xd6d6('0x6e'),_0x11b921['id']);}));_0x569de4['query']=_[_0xd6d6('0x36')](_0x54c5e8[_0xd6d6('0x35')]);_0x569de4[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x569de4[_0xd6d6('0x34')],_0x569de4[_0xd6d6('0x35')]);_0xc28475[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x569de4['model'],qs[_0xd6d6('0x3a')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0xc28475[_0xd6d6('0x39')]=_0xc28475[_0xd6d6('0x39')]['length']?_0xc28475[_0xd6d6('0x39')]:_0x569de4[_0xd6d6('0x34')];if(!_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0xc28475[_0xd6d6('0x23')]=qs[_0xd6d6('0x23')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0xc28475[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0xc28475['order']=qs[_0xd6d6('0x3d')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0xc28475[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x54c5e8[_0xd6d6('0x35')],_0x569de4[_0xd6d6('0x37')]));_0xc28475['raw']=!![];if(_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0xc28475[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0xc28475[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0xc28475[_0xd6d6('0x39')],function(_0x40c9de){var _0x5a835d={};_0x5a835d[_0x40c9de]={'$like':'%'+_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x5a835d;})});}_0xc28475=_[_0xd6d6('0x41')]({},_0xc28475,_0x54c5e8[_0xd6d6('0x43')]);return _0x309242[_0xd6d6('0x6a')](_0xc28475);}})[_0xd6d6('0x26')](function(_0x1cb63b){if(!_[_0xd6d6('0x72')](_0x1cb63b)){var _0x4eae88=toCsv(_0x1cb63b);var _0x50f43f=Date[_0xd6d6('0x73')]();fs['writeFileSync'](util[_0xd6d6('0x71')](_0xd6d6('0x74'),_0x309242['id'],_0x50f43f),_0x4eae88);_0x36a4a9[_0xd6d6('0x75')](_0xd6d6('0x76'),_0xd6d6('0x77')+util['format'](_0xd6d6('0x78'),_0x309242['id'],_0x50f43f));_0x36a4a9[_0xd6d6('0x75')](_0xd6d6('0x79'),_0xd6d6('0x7a'));return _0x36a4a9[_0xd6d6('0x7b')](util[_0xd6d6('0x71')](_0xd6d6('0x74'),_0x309242['id'],_0x50f43f));}else{return _0x36a4a9[_0xd6d6('0x1e')](0xcc);}})[_0xd6d6('0x46')](handleError(_0x36a4a9,null));};exports[_0xd6d6('0x7c')]=function(_0x5820af,_0x4bca67,_0x52a94a){var _0x5975ab;delete _0x5820af[_0xd6d6('0x4c')]['id'];return db[_0xd6d6('0x2f')][_0xd6d6('0x58')]({'where':{'id':_0x5820af[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x4bca67,null))['then'](function(_0x3861e6){if(_0x3861e6){return db['sequelize'][_0xd6d6('0x7d')](function(_0x2562c6){return db[_0xd6d6('0x6b')][_0xd6d6('0x4b')](_0x5820af[_0xd6d6('0x4c')],{'transaction':_0x2562c6})[_0xd6d6('0x26')](function(_0x5909b6){_0x5975ab=_0x5909b6;return _0x3861e6[_0xd6d6('0x7e')](_0x5909b6,{'transaction':_0x2562c6});})[_0xd6d6('0x26')](function(){var _0x556b4a={'type':db['Sequelize']['TEXT'],'transaction':_0x2562c6};switch(_0x5820af[_0xd6d6('0x4c')][_0xd6d6('0x32')]){case _0xd6d6('0x7f'):_0x556b4a['type']=db['Sequelize'][_0xd6d6('0x80')];break;case _0xd6d6('0x81'):_0x556b4a['type']=db[_0xd6d6('0x82')][_0xd6d6('0x83')];break;case'switch':_0x556b4a[_0xd6d6('0x32')]=db[_0xd6d6('0x82')]['BOOLEAN'];_0x556b4a[_0xd6d6('0x84')]=![];break;default:}return db[_0xd6d6('0x85')][_0xd6d6('0x86')][_0xd6d6('0x87')](_0xd6d6('0x88'),util[_0xd6d6('0x71')]('cf_%s',_0x5975ab['id']),_0x556b4a);})[_0xd6d6('0x26')](function(){return _0x5975ab;});});}})[_0xd6d6('0x26')](respondWithResult(_0x4bca67,null))[_0xd6d6('0x46')](handleError(_0x4bca67,null));};exports[_0xd6d6('0x89')]=function(_0x58630b,_0xdb8dcf,_0x237360){var _0x56502f={};var _0x1fcaa4={};var _0x486636;var _0x270a67;return db['CmList'][_0xd6d6('0x58')]({'where':{'id':_0x58630b[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0xdb8dcf,null))['then'](function(_0x5cd40b){if(_0x5cd40b){_0x486636=_0x5cd40b;_0x1fcaa4[_0xd6d6('0x34')]=_[_0xd6d6('0x36')](db['CmCustomField'][_0xd6d6('0x30')]);_0x1fcaa4[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x58630b[_0xd6d6('0x35')]);_0x1fcaa4[_0xd6d6('0x37')]=_['intersection'](_0x1fcaa4['model'],_0x1fcaa4['query']);_0x56502f[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x1fcaa4['model'],qs['fields'](_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x56502f[_0xd6d6('0x39')]=_0x56502f[_0xd6d6('0x39')]['length']?_0x56502f[_0xd6d6('0x39')]:_0x1fcaa4[_0xd6d6('0x34')];_0x56502f[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x56502f[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x58630b[_0xd6d6('0x35')],_0x1fcaa4[_0xd6d6('0x37')]));_0x56502f['where']=_['merge'](_0x56502f['where'],{'$or':[{'ListId':_0x5cd40b['id']},{'ListId':null}]});if(_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0x56502f[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x56502f['where'],{'$or':_[_0xd6d6('0x2e')](_0x56502f[_0xd6d6('0x39')],function(_0x4b1090){var _0x2b620a={};_0x2b620a[_0x4b1090]={'$like':'%'+_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x2b620a;})});}_0x56502f=_[_0xd6d6('0x41')]({},_0x56502f,_0x58630b['options']);return db['CmCustomField']['findAndCountAll'](_0x56502f);}})['then'](respondWithResult(_0xdb8dcf,null))['catch'](handleError(_0xdb8dcf,null));};exports[_0xd6d6('0x8a')]=function(_0x760a1a,_0x5a9f34,_0x1b74ad){return db[_0xd6d6('0x2f')]['find']({'where':{'id':_0x760a1a['params']['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x5a9f34,null))[_0xd6d6('0x26')](function(_0x36cf8e){if(_0x36cf8e){return _0x36cf8e[_0xd6d6('0x8a')](_0x760a1a['body']['ids'],_['omit'](_0x760a1a[_0xd6d6('0x4c')],['ids','id'])||{})[_0xd6d6('0x8b')](function(_0x38dcc2){for(var _0x2ff1c0=0x0;_0x2ff1c0<_0x760a1a[_0xd6d6('0x4c')]['ids'][_0xd6d6('0x59')];_0x2ff1c0+=0x1){socket[_0xd6d6('0x8c')](_0xd6d6('0x8d'),{'UserId':Number(_0x760a1a[_0xd6d6('0x4c')]['ids'][_0x2ff1c0]),'CmListId':Number(_0x760a1a[_0xd6d6('0x48')]['id'])});}return _0x38dcc2;});}})[_0xd6d6('0x26')](respondWithResult(_0x5a9f34,null))[_0xd6d6('0x46')](handleError(_0x5a9f34,null));};exports[_0xd6d6('0x8e')]=function(_0x474800,_0x15d4c6,_0x580850){return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x474800['params']['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x15d4c6,null))[_0xd6d6('0x26')](function(_0x2e4d5f){if(_0x2e4d5f){return _0x2e4d5f['removeAgents'](_0x474800['query'][_0xd6d6('0x65')])[_0xd6d6('0x26')](function(){if(_[_0xd6d6('0x60')](_0x474800['query'][_0xd6d6('0x65')])){for(var _0x4d01fe=0x0;_0x4d01fe<_0x474800[_0xd6d6('0x35')]['ids']['length'];_0x4d01fe+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x474800[_0xd6d6('0x35')][_0xd6d6('0x65')][_0x4d01fe]),'CmListId':Number(_0x474800['params']['id'])});}}else{socket[_0xd6d6('0x8c')](_0xd6d6('0x8f'),{'UserId':Number(_0x474800[_0xd6d6('0x35')][_0xd6d6('0x65')]),'CmListId':Number(_0x474800[_0xd6d6('0x48')]['id'])});}});}})[_0xd6d6('0x26')](respondWithStatusCode(_0x15d4c6,null))['catch'](handleError(_0x15d4c6,null));};exports[_0xd6d6('0x90')]=function(_0x31903d,_0x591672,_0x4ad628){var _0x1cb5a8={};var _0x4e241e={};var _0x122c09;var _0x5131c7;return db[_0xd6d6('0x2f')]['findOne']({'where':{'id':_0x31903d[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x591672,null))[_0xd6d6('0x26')](function(_0x36e5da){if(_0x36e5da){_0x122c09=_0x36e5da;_0x4e241e['model']=_['keys'](db[_0xd6d6('0x91')][_0xd6d6('0x30')]);_0x4e241e['query']=_[_0xd6d6('0x36')](_0x31903d[_0xd6d6('0x35')]);_0x4e241e[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x4e241e[_0xd6d6('0x34')],_0x4e241e[_0xd6d6('0x35')]);_0x1cb5a8[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x4e241e[_0xd6d6('0x34')],qs[_0xd6d6('0x3a')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x1cb5a8[_0xd6d6('0x39')]=_0x1cb5a8[_0xd6d6('0x39')][_0xd6d6('0x59')]?_0x1cb5a8[_0xd6d6('0x39')]:_0x4e241e[_0xd6d6('0x34')];_0x1cb5a8[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x1cb5a8['where']=qs[_0xd6d6('0x37')](_['pick'](_0x31903d[_0xd6d6('0x35')],_0x4e241e[_0xd6d6('0x37')]));if(_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0x1cb5a8[_0xd6d6('0x3e')]=_['merge'](_0x1cb5a8[_0xd6d6('0x3e')],{'$or':_['map'](_0x1cb5a8[_0xd6d6('0x39')],function(_0x1f133){var _0x2e0062={};_0x2e0062[_0x1f133]={'$like':'%'+_0x31903d['query'][_0xd6d6('0x40')]+'%'};return _0x2e0062;})});}_0x1cb5a8=_['merge']({},_0x1cb5a8,_0x31903d[_0xd6d6('0x43')]);return _0x122c09[_0xd6d6('0x90')](_0x1cb5a8);}})[_0xd6d6('0x26')](function(_0x55ce9f){if(_0x55ce9f){_0x5131c7=_0x55ce9f['length'];if(!_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x1cb5a8[_0xd6d6('0x23')]=qs[_0xd6d6('0x23')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0x1cb5a8['offset']=qs['offset'](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x25')]);}return _0x122c09[_0xd6d6('0x90')](_0x1cb5a8);}})['then'](function(_0x45509a){if(_0x45509a){return _0x45509a?{'count':_0x5131c7,'rows':_0x45509a}:null;}})['then'](respondWithResult(_0x591672,null))['catch'](handleError(_0x591672,null));}; \ No newline at end of file +var _0x5a16=['getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','BOOLEAN','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Lists','UserProfileResource','end','stack','name','send','map','CmList','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','length','hasOwnProperty','pick','filter','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5a16,0x14c));var _0x65a1=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x5a16[_0x4450b1];return _0x399b0b;};'use strict';var emlformat=require(_0x65a1('0x0'));var rimraf=require(_0x65a1('0x1'));var zipdir=require(_0x65a1('0x2'));var jsonpatch=require(_0x65a1('0x3'));var rp=require('request-promise');var moment=require(_0x65a1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65a1('0x5'));var util=require(_0x65a1('0x6'));var path=require('path');var sox=require(_0x65a1('0x7'));var csv=require(_0x65a1('0x8'));var ejs=require(_0x65a1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65a1('0xa'));var crypto=require(_0x65a1('0xb'));var jsforce=require(_0x65a1('0xc'));var deskjs=require(_0x65a1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65a1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x65a1('0xf'));var as=require(_0x65a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65a1('0x11'))(_0x65a1('0x12'));var utils=require(_0x65a1('0x13'));var config=require(_0x65a1('0x14'));var licenseUtil=require(_0x65a1('0x15'));var db=require(_0x65a1('0x16'))['db'];config[_0x65a1('0x17')]=_['defaults'](config[_0x65a1('0x17')],{'host':_0x65a1('0x18'),'port':0x18eb});var socket=require(_0x65a1('0x19'))(new Redis(config[_0x65a1('0x17')]));require(_0x65a1('0x1a'))['register'](socket);function respondWithStatusCode(_0x3601b6,_0x380743){_0x380743=_0x380743||0xcc;return function(_0x4e4124){if(_0x4e4124){return _0x3601b6[_0x65a1('0x1b')](_0x380743);}return _0x3601b6[_0x65a1('0x1c')](_0x380743)['end']();};}function respondWithResult(_0x87a4b9,_0x526fce){_0x526fce=_0x526fce||0xc8;return function(_0x368604){if(_0x368604){return _0x87a4b9[_0x65a1('0x1c')](_0x526fce)['json'](_0x368604);}};}function respondWithFilteredResult(_0x3bc6e3,_0x2f2651){return function(_0x2e3937){if(_0x2e3937){var _0x1aa283=typeof _0x2f2651[_0x65a1('0x1d')]==='undefined'&&typeof _0x2f2651['limit']===_0x65a1('0x1e');var _0xf0d4=_0x2e3937[_0x65a1('0x1f')];var _0x12aa3b=_0x1aa283?0x0:_0x2f2651['offset'];var _0x1de1d8=_0x1aa283?_0x2e3937[_0x65a1('0x1f')]:_0x2f2651[_0x65a1('0x1d')]+_0x2f2651[_0x65a1('0x20')];var _0xce7821;if(_0x1de1d8>=_0xf0d4){_0x1de1d8=_0xf0d4;_0xce7821=0xc8;}else{_0xce7821=0xce;}_0x3bc6e3[_0x65a1('0x1c')](_0xce7821);return _0x3bc6e3[_0x65a1('0x21')](_0x65a1('0x22'),_0x12aa3b+'-'+_0x1de1d8+'/'+_0xf0d4)[_0x65a1('0x23')](_0x2e3937);}return null;};}function patchUpdates(_0x5b04eb){return function(_0x1725d3){try{jsonpatch[_0x65a1('0x24')](_0x1725d3,_0x5b04eb,!![]);}catch(_0x53044a){return BPromise['reject'](_0x53044a);}return _0x1725d3[_0x65a1('0x25')]();};}function saveUpdates(_0x4bb6b2,_0x30dd60){return function(_0x5995e8){if(_0x5995e8){return _0x5995e8[_0x65a1('0x26')](_0x4bb6b2)[_0x65a1('0x27')](function(_0x4e5ed4){return _0x4e5ed4;});}return null;};}function removeEntity(_0x33c802,_0x55c6ad){return function(_0x48367d){if(_0x48367d){return _0x48367d[_0x65a1('0x28')]()['then'](function(){var _0x52532e=_0x48367d[_0x65a1('0x29')]({'plain':!![]});var _0x3047de=_0x65a1('0x2a');return db[_0x65a1('0x2b')]['destroy']({'where':{'type':_0x3047de,'resourceId':_0x52532e['id']}})[_0x65a1('0x27')](function(){return _0x48367d;});})[_0x65a1('0x27')](function(){_0x33c802[_0x65a1('0x1c')](0xcc)[_0x65a1('0x2c')]();});}};}function handleEntityNotFound(_0x50b288,_0x3e0cd0){return function(_0x348c14){if(!_0x348c14){_0x50b288['sendStatus'](0x194);}return _0x348c14;};}function handleError(_0x5bb53c,_0x42cec0){_0x42cec0=_0x42cec0||0x1f4;return function(_0x1deb9e){logger['error'](_0x1deb9e[_0x65a1('0x2d')]);if(_0x1deb9e[_0x65a1('0x2e')]){delete _0x1deb9e[_0x65a1('0x2e')];}_0x5bb53c[_0x65a1('0x1c')](_0x42cec0)[_0x65a1('0x2f')](_0x1deb9e);};}exports['index']=function(_0x218f1f,_0xf959ca){var _0x4660a0={},_0x43ed65={},_0x39afe9={'count':0x0,'rows':[]};var _0x14fbe6=_[_0x65a1('0x30')](db[_0x65a1('0x31')][_0x65a1('0x32')],function(_0x3ebfe8){return{'name':_0x3ebfe8[_0x65a1('0x33')],'type':_0x3ebfe8['type']['key']};});_0x43ed65[_0x65a1('0x34')]=_[_0x65a1('0x30')](_0x14fbe6,_0x65a1('0x2e'));_0x43ed65[_0x65a1('0x35')]=_['keys'](_0x218f1f[_0x65a1('0x35')]);_0x43ed65[_0x65a1('0x36')]=_[_0x65a1('0x37')](_0x43ed65['model'],_0x43ed65[_0x65a1('0x35')]);_0x4660a0[_0x65a1('0x38')]=_[_0x65a1('0x37')](_0x43ed65[_0x65a1('0x34')],qs[_0x65a1('0x39')](_0x218f1f[_0x65a1('0x35')]['fields']));_0x4660a0[_0x65a1('0x38')]=_0x4660a0[_0x65a1('0x38')]['length']?_0x4660a0[_0x65a1('0x38')]:_0x43ed65[_0x65a1('0x34')];if(!_0x218f1f[_0x65a1('0x35')]['hasOwnProperty'](_0x65a1('0x3a'))){_0x4660a0['limit']=qs[_0x65a1('0x20')](_0x218f1f[_0x65a1('0x35')][_0x65a1('0x20')]);_0x4660a0[_0x65a1('0x1d')]=qs[_0x65a1('0x1d')](_0x218f1f[_0x65a1('0x35')]['offset']);}_0x4660a0[_0x65a1('0x3b')]=qs[_0x65a1('0x3c')](_0x218f1f[_0x65a1('0x35')][_0x65a1('0x3c')]);_0x4660a0[_0x65a1('0x3d')]=qs[_0x65a1('0x36')](_['pick'](_0x218f1f[_0x65a1('0x35')],_0x43ed65[_0x65a1('0x36')]),_0x14fbe6);if(_0x218f1f[_0x65a1('0x35')]['filter']){_0x4660a0[_0x65a1('0x3d')]=_[_0x65a1('0x3e')](_0x4660a0['where'],{'$or':_[_0x65a1('0x30')](_0x14fbe6,function(_0x2843c3){if(_0x2843c3['type']!==_0x65a1('0x3f')){var _0x2bf6db={};_0x2bf6db[_0x2843c3[_0x65a1('0x2e')]]={'$like':'%'+_0x218f1f['query']['filter']+'%'};return _0x2bf6db;}})});}_0x4660a0=_[_0x65a1('0x3e')]({},_0x4660a0,_0x218f1f[_0x65a1('0x40')]);var _0x1b921e={'where':_0x4660a0[_0x65a1('0x3d')]};return db[_0x65a1('0x31')][_0x65a1('0x1f')](_0x1b921e)[_0x65a1('0x27')](function(_0x31a302){_0x39afe9[_0x65a1('0x1f')]=_0x31a302;if(_0x218f1f[_0x65a1('0x35')][_0x65a1('0x41')]){_0x4660a0['include']=[{'all':!![]}];}return db[_0x65a1('0x31')]['findAll'](_0x4660a0);})[_0x65a1('0x27')](function(_0x7a6f9a){_0x39afe9[_0x65a1('0x42')]=_0x7a6f9a;return _0x39afe9;})[_0x65a1('0x27')](respondWithFilteredResult(_0xf959ca,_0x4660a0))[_0x65a1('0x43')](handleError(_0xf959ca,null));};exports[_0x65a1('0x44')]=function(_0x527a17,_0x17207f){var _0x9f0c59={'raw':![],'where':{'id':_0x527a17[_0x65a1('0x45')]['id']}},_0x14e115={};_0x14e115[_0x65a1('0x34')]=_[_0x65a1('0x46')](db['CmList'][_0x65a1('0x32')]);_0x14e115[_0x65a1('0x35')]=_[_0x65a1('0x46')](_0x527a17[_0x65a1('0x35')]);_0x14e115[_0x65a1('0x36')]=_['intersection'](_0x14e115[_0x65a1('0x34')],_0x14e115[_0x65a1('0x35')]);_0x9f0c59[_0x65a1('0x38')]=_[_0x65a1('0x37')](_0x14e115['model'],qs['fields'](_0x527a17['query'][_0x65a1('0x39')]));_0x9f0c59[_0x65a1('0x38')]=_0x9f0c59[_0x65a1('0x38')]['length']?_0x9f0c59['attributes']:_0x14e115[_0x65a1('0x34')];if(_0x527a17[_0x65a1('0x35')][_0x65a1('0x41')]){_0x9f0c59[_0x65a1('0x47')]=[{'all':!![]}];}_0x9f0c59=_['merge']({},_0x9f0c59,_0x527a17['options']);return db[_0x65a1('0x31')][_0x65a1('0x48')](_0x9f0c59)[_0x65a1('0x27')](handleEntityNotFound(_0x17207f,null))[_0x65a1('0x27')](respondWithResult(_0x17207f,null))[_0x65a1('0x43')](handleError(_0x17207f,null));};exports['create']=function(_0x3da698,_0x896f2e){return db['CmList'][_0x65a1('0x49')](_0x3da698[_0x65a1('0x4a')],{})['then'](function(_0x199d31){var _0x12ed7b=_0x3da698[_0x65a1('0x4b')][_0x65a1('0x29')]({'plain':!![]});if(!_0x12ed7b)throw new Error(_0x65a1('0x4c'));if(_0x12ed7b[_0x65a1('0x4d')]==='user'){var _0x264807=_0x199d31[_0x65a1('0x29')]({'plain':!![]});var _0x35d394=_0x65a1('0x2a');return db[_0x65a1('0x4e')]['find']({'where':{'name':_0x35d394,'userProfileId':_0x12ed7b[_0x65a1('0x4f')]},'raw':!![]})[_0x65a1('0x27')](function(_0x3329de){if(_0x3329de&&_0x3329de[_0x65a1('0x50')]===0x0){return db[_0x65a1('0x2b')][_0x65a1('0x49')]({'name':_0x264807[_0x65a1('0x2e')],'resourceId':_0x264807['id'],'type':_0x3329de[_0x65a1('0x2e')],'sectionId':_0x3329de['id']},{})[_0x65a1('0x27')](function(){return _0x199d31;});}else{return _0x199d31;}})[_0x65a1('0x43')](function(_0x351800){logger[_0x65a1('0x51')](_0x65a1('0x52'),_0x351800);throw _0x351800;});}return _0x199d31;})[_0x65a1('0x27')](respondWithResult(_0x896f2e,0xc9))[_0x65a1('0x43')](handleError(_0x896f2e,null));};exports['update']=function(_0x5bbb0c,_0x19b68b){if(_0x5bbb0c[_0x65a1('0x4a')]['id']){delete _0x5bbb0c[_0x65a1('0x4a')]['id'];}return db['CmList']['find']({'where':{'id':_0x5bbb0c[_0x65a1('0x45')]['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x19b68b,null))[_0x65a1('0x27')](saveUpdates(_0x5bbb0c[_0x65a1('0x4a')],null))[_0x65a1('0x27')](respondWithResult(_0x19b68b,null))[_0x65a1('0x43')](handleError(_0x19b68b,null));};exports[_0x65a1('0x28')]=function(_0x15cb93,_0x3cdf85){return db['CmList'][_0x65a1('0x48')]({'where':{'id':_0x15cb93[_0x65a1('0x45')]['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x3cdf85,null))['then'](removeEntity(_0x3cdf85,null))[_0x65a1('0x43')](handleError(_0x3cdf85,null));};exports[_0x65a1('0x53')]=function(_0x564fff,_0xa9b9c){return db[_0x65a1('0x31')]['describe']()['then'](respondWithResult(_0xa9b9c,null))['catch'](handleError(_0xa9b9c,null));};exports['addDisposition']=function(_0x4b4a42,_0x370001,_0x3d36c3){if(_0x4b4a42[_0x65a1('0x4a')]['id']){delete _0x4b4a42[_0x65a1('0x4a')]['id'];}return db['CmList'][_0x65a1('0x48')]({'where':{'id':_0x4b4a42[_0x65a1('0x45')]['id']}})['then'](handleEntityNotFound(_0x370001,null))[_0x65a1('0x27')](function(_0x2106c4){if(_0x2106c4){_0x4b4a42[_0x65a1('0x4a')][_0x65a1('0x54')]=_0x2106c4['id'];return db[_0x65a1('0x55')][_0x65a1('0x49')](_0x4b4a42[_0x65a1('0x4a')]);}})[_0x65a1('0x27')](respondWithResult(_0x370001,null))[_0x65a1('0x43')](handleError(_0x370001,null));};exports['getDispositions']=function(_0x35edcf,_0x551539,_0xf0218d){var _0x10fae4={'raw':![],'where':{}};var _0x36b604={};var _0x2b8536={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x35edcf[_0x65a1('0x45')]['id']}})['then'](handleEntityNotFound(_0x551539,null))[_0x65a1('0x27')](function(_0x4d20db){if(_0x4d20db){_0x36b604[_0x65a1('0x34')]=_[_0x65a1('0x46')](db[_0x65a1('0x55')][_0x65a1('0x32')]);_0x36b604[_0x65a1('0x35')]=_[_0x65a1('0x46')](_0x35edcf[_0x65a1('0x35')]);_0x36b604[_0x65a1('0x36')]=_['intersection'](_0x36b604[_0x65a1('0x34')],_0x36b604[_0x65a1('0x35')]);_0x10fae4['attributes']=_[_0x65a1('0x37')](_0x36b604[_0x65a1('0x34')],qs[_0x65a1('0x39')](_0x35edcf['query'][_0x65a1('0x39')]));_0x10fae4[_0x65a1('0x38')]=_0x10fae4[_0x65a1('0x38')][_0x65a1('0x56')]?_0x10fae4[_0x65a1('0x38')]:_0x36b604['model'];if(!_0x35edcf[_0x65a1('0x35')][_0x65a1('0x57')]('nolimit')){_0x10fae4[_0x65a1('0x20')]=qs['limit'](_0x35edcf['query']['limit']);_0x10fae4[_0x65a1('0x1d')]=qs['offset'](_0x35edcf[_0x65a1('0x35')][_0x65a1('0x1d')]);}_0x10fae4[_0x65a1('0x3b')]=qs[_0x65a1('0x3c')](_0x35edcf[_0x65a1('0x35')][_0x65a1('0x3c')]);_0x10fae4[_0x65a1('0x3d')]=qs[_0x65a1('0x36')](_[_0x65a1('0x58')](_0x35edcf[_0x65a1('0x35')],_0x36b604[_0x65a1('0x36')]));_0x10fae4['where'][_0x65a1('0x54')]=_0x4d20db['id'];if(_0x35edcf[_0x65a1('0x35')][_0x65a1('0x59')]){_0x10fae4[_0x65a1('0x3d')]=_['merge'](_0x10fae4[_0x65a1('0x3d')],{'$or':_['map'](_0x10fae4[_0x65a1('0x38')],function(_0x15a0c3){var _0x4d86d8={};_0x4d86d8[_0x15a0c3]={'$like':'%'+_0x35edcf[_0x65a1('0x35')]['filter']+'%'};return _0x4d86d8;})});}_0x10fae4=_['merge']({},_0x10fae4,_0x35edcf[_0x65a1('0x40')]);return db['Disposition'][_0x65a1('0x1f')]({'where':_0x10fae4[_0x65a1('0x3d')]})[_0x65a1('0x27')](function(_0x3a4f29){_0x2b8536[_0x65a1('0x1f')]=_0x3a4f29;if(_0x35edcf[_0x65a1('0x35')][_0x65a1('0x41')]){_0x10fae4[_0x65a1('0x47')]=[{'all':!![]}];}return db[_0x65a1('0x55')][_0x65a1('0x5a')](_0x10fae4);})[_0x65a1('0x27')](function(_0x38e711){_0x2b8536[_0x65a1('0x42')]=_0x38e711;return _0x2b8536;});}})[_0x65a1('0x27')](respondWithFilteredResult(_0x551539,_0x10fae4))[_0x65a1('0x43')](handleError(_0x551539,null));};exports[_0x65a1('0x5b')]=function(_0xee757a,_0x3af41e,_0x170e3e){return db['CmList'][_0x65a1('0x48')]({'where':{'id':_0xee757a[_0x65a1('0x45')]['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x3af41e,null))['then'](function(_0x223633){if(_0x223633){return _0x223633[_0x65a1('0x5b')](_0xee757a[_0x65a1('0x35')][_0x65a1('0x5c')]);}})[_0x65a1('0x27')](respondWithStatusCode(_0x3af41e,null))[_0x65a1('0x43')](handleError(_0x3af41e,null));};exports[_0x65a1('0x5d')]=function(_0x524c4f,_0x3b13d6,_0x52da37){return db[_0x65a1('0x31')][_0x65a1('0x48')]({'where':{'id':_0x524c4f[_0x65a1('0x45')]['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x3b13d6,null))[_0x65a1('0x27')](function(_0xd0234c){if(_0xd0234c){var _0x32d44c=[];var _0x35cead={'success':[],'errors':[]};return db[_0x65a1('0x5e')]['describe']()['then'](function(_0x52dd6b){if(_0x524c4f[_0x65a1('0x4a')][_0x65a1('0x5f')]&&_[_0x65a1('0x60')](_0x524c4f[_0x65a1('0x4a')][_0x65a1('0x5f')])){if(_0x524c4f[_0x65a1('0x4a')]['tags']['length']){_0x524c4f[_0x65a1('0x4a')][_0x65a1('0x5f')]=_0x524c4f['body']['tags'][_0x65a1('0x61')](';')+';';}else{_0x524c4f[_0x65a1('0x4a')][_0x65a1('0x5f')]=null;}}else{_0x524c4f['body'][_0x65a1('0x5f')]=null;}if(_0x524c4f[_0x65a1('0x4a')]&&_[_0x65a1('0x60')](_0x524c4f[_0x65a1('0x4a')])){for(var _0x4af439=0x0;_0x4af439<_0x524c4f[_0x65a1('0x4a')][_0x65a1('0x56')];_0x4af439+=0x1){_0x524c4f[_0x65a1('0x4a')][_0x4af439]['ListId']=_0x524c4f['params']['id'];_0x32d44c[_0x65a1('0x62')](_0x524c4f[_0x65a1('0x4a')][_0x4af439]);}return BPromise[_0x65a1('0x63')](_0x32d44c,function(_0x32572b){return db['CmContact'][_0x65a1('0x49')](_[_0x65a1('0x64')](_0x32572b,[_0x65a1('0x5c'),'id'])||{},{'fields':_[_0x65a1('0x46')](_0x52dd6b),'raw':!![]})[_0x65a1('0x27')](function(_0x5ba3d6){_0x35cead[_0x65a1('0x65')]['push'](_0x5ba3d6[_0x65a1('0x66')]);})[_0x65a1('0x43')](function(_0x5175e5){_0x35cead[_0x65a1('0x67')][_0x65a1('0x62')]({'data':_0x32572b,'error':_0x5175e5[_0x65a1('0x68')]});});})[_0x65a1('0x27')](function(_0x5b191){return _0x35cead;})[_0x65a1('0x43')](function(_0x2f84de){return _0x2f84de;});}else{_0x3b13d6['status'](0x190)['json']({'message':_0x65a1('0x69')});}});}})[_0x65a1('0x27')](respondWithResult(_0x3b13d6,null))[_0x65a1('0x43')](handleError(_0x3b13d6,null));};exports[_0x65a1('0x6a')]=function(_0x234f8b,_0x25a605,_0x376bcb){var _0x12a8fe;return db[_0x65a1('0x31')][_0x65a1('0x48')]({'where':{'id':_0x234f8b[_0x65a1('0x45')]['id']},'include':[{'model':db[_0x65a1('0x6b')],'as':_0x65a1('0x6c')}]})[_0x65a1('0x27')](handleEntityNotFound(_0x25a605,null))[_0x65a1('0x27')](function(_0x8bab85){if(_0x8bab85){_0x12a8fe=_0x8bab85;return db[_0x65a1('0x5e')][_0x65a1('0x32')];}})[_0x65a1('0x27')](function(_0x102018){if(_0x102018){var _0x192983={};var _0x208c0d={};_0x208c0d[_0x65a1('0x34')]=_[_0x65a1('0x6d')](_[_0x65a1('0x46')](_0x102018),_['map'](_0x12a8fe[_0x65a1('0x6c')],function(_0x2ebfdc){return util[_0x65a1('0x6e')](_0x65a1('0x6f'),_0x2ebfdc['id']);}));_0x208c0d[_0x65a1('0x35')]=_[_0x65a1('0x46')](_0x234f8b[_0x65a1('0x35')]);_0x208c0d[_0x65a1('0x36')]=_['intersection'](_0x208c0d[_0x65a1('0x34')],_0x208c0d[_0x65a1('0x35')]);_0x192983[_0x65a1('0x38')]=_[_0x65a1('0x37')](_0x208c0d['model'],qs['fields'](_0x234f8b[_0x65a1('0x35')][_0x65a1('0x39')]));_0x192983[_0x65a1('0x38')]=_0x192983[_0x65a1('0x38')][_0x65a1('0x56')]?_0x192983[_0x65a1('0x38')]:_0x208c0d[_0x65a1('0x34')];if(!_0x234f8b[_0x65a1('0x35')][_0x65a1('0x57')]('nolimit')){_0x192983[_0x65a1('0x20')]=qs[_0x65a1('0x20')](_0x234f8b[_0x65a1('0x35')][_0x65a1('0x20')]);_0x192983[_0x65a1('0x1d')]=qs[_0x65a1('0x1d')](_0x234f8b[_0x65a1('0x35')][_0x65a1('0x1d')]);}_0x192983[_0x65a1('0x3b')]=qs[_0x65a1('0x3c')](_0x234f8b[_0x65a1('0x35')]['sort']);_0x192983[_0x65a1('0x3d')]=qs[_0x65a1('0x36')](_[_0x65a1('0x58')](_0x234f8b['query'],_0x208c0d[_0x65a1('0x36')]));_0x192983[_0x65a1('0x70')]=!![];if(_0x234f8b[_0x65a1('0x35')]['filter']){_0x192983[_0x65a1('0x3d')]=_[_0x65a1('0x3e')](_0x192983[_0x65a1('0x3d')],{'$or':_[_0x65a1('0x30')](_0x192983[_0x65a1('0x38')],function(_0xb53d68){var _0x189fca={};_0x189fca[_0xb53d68]={'$like':'%'+_0x234f8b[_0x65a1('0x35')]['filter']+'%'};return _0x189fca;})});}_0x192983=_['merge']({},_0x192983,_0x234f8b[_0x65a1('0x40')]);return _0x12a8fe[_0x65a1('0x6a')](_0x192983);}})[_0x65a1('0x27')](respondWithResult(_0x25a605,null))['catch'](handleError(_0x25a605,null));};exports[_0x65a1('0x71')]=function(_0x5bde3a,_0x5c09c1,_0x4380da){var _0x44370a;return db[_0x65a1('0x31')][_0x65a1('0x48')]({'where':{'id':_0x5bde3a[_0x65a1('0x45')]['id']},'include':[{'model':db[_0x65a1('0x6b')],'as':_0x65a1('0x6c')}]})[_0x65a1('0x27')](handleEntityNotFound(_0x5c09c1,null))[_0x65a1('0x27')](function(_0x4dc21c){if(_0x4dc21c){_0x44370a=_0x4dc21c;return db[_0x65a1('0x5e')][_0x65a1('0x32')];}})[_0x65a1('0x27')](function(_0x941654){if(_0x941654){var _0x372842={};var _0xd38889={};_0xd38889[_0x65a1('0x34')]=_[_0x65a1('0x6d')](_[_0x65a1('0x46')](_0x941654),_[_0x65a1('0x30')](_0x44370a[_0x65a1('0x6c')],function(_0xbbab20){return util[_0x65a1('0x6e')](_0x65a1('0x6f'),_0xbbab20['id']);}));_0xd38889['query']=_[_0x65a1('0x46')](_0x5bde3a[_0x65a1('0x35')]);_0xd38889[_0x65a1('0x36')]=_[_0x65a1('0x37')](_0xd38889['model'],_0xd38889['query']);_0x372842[_0x65a1('0x38')]=_[_0x65a1('0x37')](_0xd38889[_0x65a1('0x34')],qs['fields'](_0x5bde3a[_0x65a1('0x35')][_0x65a1('0x39')]));_0x372842[_0x65a1('0x38')]=_0x372842['attributes']['length']?_0x372842[_0x65a1('0x38')]:_0xd38889[_0x65a1('0x34')];if(!_0x5bde3a[_0x65a1('0x35')]['hasOwnProperty'](_0x65a1('0x3a'))){_0x372842[_0x65a1('0x20')]=qs[_0x65a1('0x20')](_0x5bde3a['query'][_0x65a1('0x20')]);_0x372842['offset']=qs[_0x65a1('0x1d')](_0x5bde3a[_0x65a1('0x35')]['offset']);}_0x372842[_0x65a1('0x3b')]=qs[_0x65a1('0x3c')](_0x5bde3a['query']['sort']);_0x372842[_0x65a1('0x3d')]=qs[_0x65a1('0x36')](_[_0x65a1('0x58')](_0x5bde3a[_0x65a1('0x35')],_0xd38889[_0x65a1('0x36')]));_0x372842[_0x65a1('0x70')]=!![];if(_0x5bde3a[_0x65a1('0x35')][_0x65a1('0x59')]){_0x372842[_0x65a1('0x3d')]=_['merge'](_0x372842[_0x65a1('0x3d')],{'$or':_[_0x65a1('0x30')](_0x372842['attributes'],function(_0x32f7f2){var _0x2a621e={};_0x2a621e[_0x32f7f2]={'$like':'%'+_0x5bde3a[_0x65a1('0x35')][_0x65a1('0x59')]+'%'};return _0x2a621e;})});}_0x372842=_['merge']({},_0x372842,_0x5bde3a[_0x65a1('0x40')]);return _0x44370a[_0x65a1('0x6a')](_0x372842);}})[_0x65a1('0x27')](function(_0x2dcc8c){if(!_[_0x65a1('0x72')](_0x2dcc8c)){var _0xcd2035=toCsv(_0x2dcc8c);var _0x5412da=Date[_0x65a1('0x73')]();fs[_0x65a1('0x74')](util['format'](_0x65a1('0x75'),_0x44370a['id'],_0x5412da),_0xcd2035);_0x5c09c1[_0x65a1('0x76')](_0x65a1('0x77'),_0x65a1('0x78')+util[_0x65a1('0x6e')](_0x65a1('0x79'),_0x44370a['id'],_0x5412da));_0x5c09c1[_0x65a1('0x76')](_0x65a1('0x7a'),_0x65a1('0x7b'));return _0x5c09c1[_0x65a1('0x7c')](util['format'](_0x65a1('0x75'),_0x44370a['id'],_0x5412da));}else{return _0x5c09c1['sendStatus'](0xcc);}})[_0x65a1('0x43')](handleError(_0x5c09c1,null));};exports[_0x65a1('0x7d')]=function(_0x7f021c,_0x44be89,_0x2829d2){var _0x126ad2;delete _0x7f021c[_0x65a1('0x4a')]['id'];return db[_0x65a1('0x31')][_0x65a1('0x7e')]({'where':{'id':_0x7f021c['params']['id']}})['then'](handleEntityNotFound(_0x44be89,null))[_0x65a1('0x27')](function(_0x3e896c){if(_0x3e896c){return db[_0x65a1('0x7f')][_0x65a1('0x80')](function(_0x58bc1f){return db[_0x65a1('0x6b')][_0x65a1('0x49')](_0x7f021c['body'],{'transaction':_0x58bc1f})['then'](function(_0x6a9e2){_0x126ad2=_0x6a9e2;return _0x3e896c['addCustomFields'](_0x6a9e2,{'transaction':_0x58bc1f});})['then'](function(){var _0x71c642={'type':db[_0x65a1('0x81')][_0x65a1('0x82')],'transaction':_0x58bc1f};switch(_0x7f021c[_0x65a1('0x4a')][_0x65a1('0x83')]){case _0x65a1('0x84'):_0x71c642['type']=db[_0x65a1('0x81')][_0x65a1('0x82')];break;case _0x65a1('0x85'):_0x71c642[_0x65a1('0x83')]=db[_0x65a1('0x81')][_0x65a1('0x86')];break;case'switch':_0x71c642['type']=db[_0x65a1('0x81')][_0x65a1('0x87')];_0x71c642['defaultValue']=![];break;default:}return db[_0x65a1('0x7f')]['queryInterface'][_0x65a1('0x88')]('cm_contacts',util[_0x65a1('0x6e')](_0x65a1('0x89'),_0x126ad2['id']),_0x71c642);})[_0x65a1('0x27')](function(){return _0x126ad2;});});}})[_0x65a1('0x27')](respondWithResult(_0x44be89,null))['catch'](handleError(_0x44be89,null));};exports[_0x65a1('0x8a')]=function(_0x30d82e,_0x437bb9,_0x52cd74){var _0x5dad01={};var _0x2ffd8b={};var _0x54d7ad;var _0x26dc6f;return db[_0x65a1('0x31')][_0x65a1('0x7e')]({'where':{'id':_0x30d82e['params']['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x437bb9,null))[_0x65a1('0x27')](function(_0x3ce783){if(_0x3ce783){_0x54d7ad=_0x3ce783;_0x2ffd8b[_0x65a1('0x34')]=_[_0x65a1('0x46')](db[_0x65a1('0x6b')][_0x65a1('0x32')]);_0x2ffd8b['query']=_[_0x65a1('0x46')](_0x30d82e[_0x65a1('0x35')]);_0x2ffd8b['filters']=_['intersection'](_0x2ffd8b[_0x65a1('0x34')],_0x2ffd8b['query']);_0x5dad01[_0x65a1('0x38')]=_[_0x65a1('0x37')](_0x2ffd8b['model'],qs[_0x65a1('0x39')](_0x30d82e[_0x65a1('0x35')]['fields']));_0x5dad01['attributes']=_0x5dad01[_0x65a1('0x38')][_0x65a1('0x56')]?_0x5dad01['attributes']:_0x2ffd8b[_0x65a1('0x34')];_0x5dad01['order']=qs['sort'](_0x30d82e[_0x65a1('0x35')]['sort']);_0x5dad01[_0x65a1('0x3d')]=qs[_0x65a1('0x36')](_[_0x65a1('0x58')](_0x30d82e[_0x65a1('0x35')],_0x2ffd8b['filters']));_0x5dad01['where']=_[_0x65a1('0x3e')](_0x5dad01[_0x65a1('0x3d')],{'$or':[{'ListId':_0x3ce783['id']},{'ListId':null}]});if(_0x30d82e[_0x65a1('0x35')]['filter']){_0x5dad01[_0x65a1('0x3d')]=_[_0x65a1('0x3e')](_0x5dad01['where'],{'$or':_['map'](_0x5dad01[_0x65a1('0x38')],function(_0x522043){var _0x7cb47f={};_0x7cb47f[_0x522043]={'$like':'%'+_0x30d82e['query'][_0x65a1('0x59')]+'%'};return _0x7cb47f;})});}_0x5dad01=_[_0x65a1('0x3e')]({},_0x5dad01,_0x30d82e[_0x65a1('0x40')]);return db[_0x65a1('0x6b')][_0x65a1('0x8b')](_0x5dad01);}})[_0x65a1('0x27')](respondWithResult(_0x437bb9,null))[_0x65a1('0x43')](handleError(_0x437bb9,null));};exports[_0x65a1('0x8c')]=function(_0x50826f,_0x30209c,_0x5f1c06){return db['CmList']['find']({'where':{'id':_0x50826f[_0x65a1('0x45')]['id']}})['then'](handleEntityNotFound(_0x30209c,null))['then'](function(_0x3d5b40){if(_0x3d5b40){return _0x3d5b40[_0x65a1('0x8c')](_0x50826f[_0x65a1('0x4a')][_0x65a1('0x5c')],_[_0x65a1('0x64')](_0x50826f[_0x65a1('0x4a')],[_0x65a1('0x5c'),'id'])||{})['spread'](function(_0x3742e8){for(var _0x53c87d=0x0;_0x53c87d<_0x50826f['body'][_0x65a1('0x5c')][_0x65a1('0x56')];_0x53c87d+=0x1){socket[_0x65a1('0x8d')]('userCmList:save',{'UserId':Number(_0x50826f[_0x65a1('0x4a')]['ids'][_0x53c87d]),'CmListId':Number(_0x50826f[_0x65a1('0x45')]['id'])});}return _0x3742e8;});}})[_0x65a1('0x27')](respondWithResult(_0x30209c,null))['catch'](handleError(_0x30209c,null));};exports[_0x65a1('0x8e')]=function(_0x1fa8b2,_0x87644f,_0x124c03){return db[_0x65a1('0x31')][_0x65a1('0x48')]({'where':{'id':_0x1fa8b2[_0x65a1('0x45')]['id']}})[_0x65a1('0x27')](handleEntityNotFound(_0x87644f,null))[_0x65a1('0x27')](function(_0x117c6a){if(_0x117c6a){return _0x117c6a['removeAgents'](_0x1fa8b2[_0x65a1('0x35')][_0x65a1('0x5c')])['then'](function(){if(_[_0x65a1('0x60')](_0x1fa8b2[_0x65a1('0x35')][_0x65a1('0x5c')])){for(var _0x458133=0x0;_0x458133<_0x1fa8b2[_0x65a1('0x35')][_0x65a1('0x5c')][_0x65a1('0x56')];_0x458133+=0x1){socket[_0x65a1('0x8d')](_0x65a1('0x8f'),{'UserId':Number(_0x1fa8b2['query'][_0x65a1('0x5c')][_0x458133]),'CmListId':Number(_0x1fa8b2[_0x65a1('0x45')]['id'])});}}else{socket[_0x65a1('0x8d')]('userCmList:remove',{'UserId':Number(_0x1fa8b2[_0x65a1('0x35')]['ids']),'CmListId':Number(_0x1fa8b2[_0x65a1('0x45')]['id'])});}});}})[_0x65a1('0x27')](respondWithStatusCode(_0x87644f,null))[_0x65a1('0x43')](handleError(_0x87644f,null));};exports['getAgents']=function(_0x476b94,_0x49a801,_0x52fb7c){var _0x285a99={};var _0x3abdb3={};var _0x2ff1c4;var _0x3e7d2e;return db['CmList'][_0x65a1('0x7e')]({'where':{'id':_0x476b94[_0x65a1('0x45')]['id']}})['then'](handleEntityNotFound(_0x49a801,null))['then'](function(_0x218c64){if(_0x218c64){_0x2ff1c4=_0x218c64;_0x3abdb3[_0x65a1('0x34')]=_['keys'](db[_0x65a1('0x90')]['rawAttributes']);_0x3abdb3[_0x65a1('0x35')]=_[_0x65a1('0x46')](_0x476b94[_0x65a1('0x35')]);_0x3abdb3['filters']=_[_0x65a1('0x37')](_0x3abdb3[_0x65a1('0x34')],_0x3abdb3['query']);_0x285a99[_0x65a1('0x38')]=_['intersection'](_0x3abdb3[_0x65a1('0x34')],qs[_0x65a1('0x39')](_0x476b94[_0x65a1('0x35')][_0x65a1('0x39')]));_0x285a99[_0x65a1('0x38')]=_0x285a99[_0x65a1('0x38')][_0x65a1('0x56')]?_0x285a99[_0x65a1('0x38')]:_0x3abdb3[_0x65a1('0x34')];_0x285a99[_0x65a1('0x3b')]=qs[_0x65a1('0x3c')](_0x476b94[_0x65a1('0x35')][_0x65a1('0x3c')]);_0x285a99['where']=qs[_0x65a1('0x36')](_[_0x65a1('0x58')](_0x476b94[_0x65a1('0x35')],_0x3abdb3['filters']));if(_0x476b94[_0x65a1('0x35')][_0x65a1('0x59')]){_0x285a99[_0x65a1('0x3d')]=_[_0x65a1('0x3e')](_0x285a99[_0x65a1('0x3d')],{'$or':_[_0x65a1('0x30')](_0x285a99[_0x65a1('0x38')],function(_0xf109c0){var _0x2ce108={};_0x2ce108[_0xf109c0]={'$like':'%'+_0x476b94[_0x65a1('0x35')]['filter']+'%'};return _0x2ce108;})});}_0x285a99=_[_0x65a1('0x3e')]({},_0x285a99,_0x476b94[_0x65a1('0x40')]);return _0x2ff1c4[_0x65a1('0x91')](_0x285a99);}})[_0x65a1('0x27')](function(_0x39925d){if(_0x39925d){_0x3e7d2e=_0x39925d['length'];if(!_0x476b94[_0x65a1('0x35')]['hasOwnProperty'](_0x65a1('0x3a'))){_0x285a99[_0x65a1('0x20')]=qs[_0x65a1('0x20')](_0x476b94['query'][_0x65a1('0x20')]);_0x285a99[_0x65a1('0x1d')]=qs[_0x65a1('0x1d')](_0x476b94['query'][_0x65a1('0x1d')]);}return _0x2ff1c4[_0x65a1('0x91')](_0x285a99);}})[_0x65a1('0x27')](function(_0x30c830){if(_0x30c830){return _0x30c830?{'count':_0x3e7d2e,'rows':_0x30c830}:null;}})['then'](respondWithResult(_0x49a801,null))[_0x65a1('0x43')](handleError(_0x49a801,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4d1f7d2..aaafd51 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(_0x91e5fc,_0x34d314){_0x91e5fc=_0x91e5fc-0x0;var _0xdd79a6=_0x3e74[_0x91e5fc];return _0xdd79a6;};'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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x5fc3[_0x5447aa];return _0xb21e53;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index def8557..2264ba2 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 _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x53b589,_0x4e6902){var _0x31a87f=function(_0x1eea45){while(--_0x1eea45){_0x53b589['push'](_0x53b589['shift']());}};_0x31a87f(++_0x4e6902);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xcb91[_0x65c0bb];return _0x320bd5;};'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')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x21e4d8,_0x16e4a2){var _0x25a486=function(_0x268487){while(--_0x268487){_0x21e4d8['push'](_0x21e4d8['shift']());}};_0x25a486(++_0x16e4a2);}(_0xa8a8,0xec));var _0x8a8a=function(_0x12f5b4,_0x4366ba){_0x12f5b4=_0x12f5b4-0x0;var _0x33ea75=_0xa8a8[_0x12f5b4];return _0x33ea75;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 25bd65d..8b9b413 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 _0xcf01=['code','error','message','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x49534b,_0x147009){var _0x22517e=function(_0x2d3b79){while(--_0x2d3b79){_0x49534b['push'](_0x49534b['shift']());}};_0x22517e(++_0x147009);}(_0xcf01,0xd4));var _0x1cf0=function(_0x42d5f0,_0x151b49){_0x42d5f0=_0x42d5f0-0x0;var _0x5d008f=_0xcf01[_0x42d5f0];return _0x5d008f;};'use strict';var _=require(_0x1cf0('0x0'));var util=require('util');var moment=require(_0x1cf0('0x1'));var BPromise=require(_0x1cf0('0x2'));var rs=require(_0x1cf0('0x3'));var fs=require('fs');var Redis=require(_0x1cf0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cf0('0x5'));var logger=require(_0x1cf0('0x6'))(_0x1cf0('0x7'));var config=require(_0x1cf0('0x8'));var jayson=require(_0x1cf0('0x9'));var client=jayson[_0x1cf0('0xa')]['http']({'port':0x232a});config[_0x1cf0('0xb')]=_[_0x1cf0('0xc')](config[_0x1cf0('0xb')],{'host':_0x1cf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cf0('0xb')]));require(_0x1cf0('0xe'))[_0x1cf0('0xf')](socket);function respondWithRpcPromise(_0x23d04f,_0xc630a,_0x8eb9e6){return new BPromise(function(_0x362146,_0x371bc0){return client[_0x1cf0('0x10')](_0x23d04f,_0x8eb9e6)['then'](function(_0x31e2d2){logger['info'](_0x1cf0('0x11'),_0xc630a,_0x1cf0('0x12'));logger[_0x1cf0('0x13')](_0x1cf0('0x14'),_0xc630a,_0x1cf0('0x12'),JSON[_0x1cf0('0x15')](_0x31e2d2));if(_0x31e2d2['error']){if(_0x31e2d2['error'][_0x1cf0('0x16')]===0x1f4){logger[_0x1cf0('0x17')](_0x1cf0('0x11'),_0xc630a,_0x31e2d2[_0x1cf0('0x17')][_0x1cf0('0x18')]);return _0x371bc0(_0x31e2d2[_0x1cf0('0x17')]['message']);}logger[_0x1cf0('0x17')]('CmList,\x20%s,\x20%s',_0xc630a,_0x31e2d2[_0x1cf0('0x17')]['message']);return _0x362146(_0x31e2d2['error'][_0x1cf0('0x18')]);}else{logger[_0x1cf0('0x19')](_0x1cf0('0x11'),_0xc630a,_0x1cf0('0x12'));_0x362146(_0x31e2d2['result'][_0x1cf0('0x18')]);}})['catch'](function(_0xb5c8fd){logger[_0x1cf0('0x17')](_0x1cf0('0x11'),_0xc630a,_0xb5c8fd);_0x371bc0(_0xb5c8fd);});});} \ No newline at end of file +var _0xf316=['request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','debug'];(function(_0x47c9b5,_0x30cf3d){var _0x6580e1=function(_0x52a368){while(--_0x52a368){_0x47c9b5['push'](_0x47c9b5['shift']());}};_0x6580e1(++_0x30cf3d);}(_0xf316,0x1c8));var _0x6f31=function(_0x231e04,_0x233506){_0x231e04=_0x231e04-0x0;var _0x58a8f8=_0xf316[_0x231e04];return _0x58a8f8;};'use strict';var _=require(_0x6f31('0x0'));var util=require('util');var moment=require(_0x6f31('0x1'));var BPromise=require(_0x6f31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f31('0x3'));var db=require(_0x6f31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f31('0x5'))('rpc');var config=require(_0x6f31('0x6'));var jayson=require(_0x6f31('0x7'));var client=jayson['client'][_0x6f31('0x8')]({'port':0x232a});config[_0x6f31('0x9')]=_[_0x6f31('0xa')](config[_0x6f31('0x9')],{'host':_0x6f31('0xb'),'port':0x18eb});var socket=require(_0x6f31('0xc'))(new Redis(config[_0x6f31('0x9')]));require(_0x6f31('0xd'))[_0x6f31('0xe')](socket);function respondWithRpcPromise(_0x3f0ee3,_0x4d2029,_0x209269){return new BPromise(function(_0x360931,_0x31a74c){return client['request'](_0x3f0ee3,_0x209269)[_0x6f31('0xf')](function(_0x340036){logger[_0x6f31('0x10')](_0x6f31('0x11'),_0x4d2029,'request\x20sent');logger[_0x6f31('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x4d2029,_0x6f31('0x13'),JSON[_0x6f31('0x14')](_0x340036));if(_0x340036[_0x6f31('0x15')]){if(_0x340036['error'][_0x6f31('0x16')]===0x1f4){logger[_0x6f31('0x15')](_0x6f31('0x11'),_0x4d2029,_0x340036['error'][_0x6f31('0x17')]);return _0x31a74c(_0x340036[_0x6f31('0x15')][_0x6f31('0x17')]);}logger[_0x6f31('0x15')](_0x6f31('0x11'),_0x4d2029,_0x340036[_0x6f31('0x15')][_0x6f31('0x17')]);return _0x360931(_0x340036[_0x6f31('0x15')]['message']);}else{logger[_0x6f31('0x10')](_0x6f31('0x11'),_0x4d2029,_0x6f31('0x13'));_0x360931(_0x340036['result'][_0x6f31('0x17')]);}})[_0x6f31('0x18')](function(_0x4027fb){logger[_0x6f31('0x15')](_0x6f31('0x11'),_0x4d2029,_0x4027fb);_0x31a74c(_0x4027fb);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 12aa157..8a2e658 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 _0x9178=['save','removeListener','register','length','cmList:','./cmList.events'];(function(_0x1f8da6,_0x54609d){var _0x4f20ea=function(_0x45a5cf){while(--_0x45a5cf){_0x1f8da6['push'](_0x1f8da6['shift']());}};_0x4f20ea(++_0x54609d);}(_0x9178,0xd7));var _0x8917=function(_0xad3f81,_0x3cbf7f){_0xad3f81=_0xad3f81-0x0;var _0x110f32=_0x9178[_0xad3f81];return _0x110f32;};'use strict';var CmListEvents=require(_0x8917('0x0'));var events=[_0x8917('0x1'),'remove','update'];function createListener(_0x3c4151,_0x4bf7f8){return function(_0x4255b8){_0x4bf7f8['emit'](_0x3c4151,_0x4255b8);};}function removeListener(_0x372132,_0x5658db){return function(){CmListEvents[_0x8917('0x2')](_0x372132,_0x5658db);};}exports[_0x8917('0x3')]=function(_0x2cdfc7){for(var _0x3ee6cf=0x0,_0x3d5d45=events[_0x8917('0x4')];_0x3ee6cf<_0x3d5d45;_0x3ee6cf++){var _0x152fcc=events[_0x3ee6cf];var _0x18e688=createListener(_0x8917('0x5')+_0x152fcc,_0x2cdfc7);CmListEvents['on'](_0x152fcc,_0x18e688);}}; \ No newline at end of file +var _0xca9e=['./cmList.events','remove','update','removeListener','length'];(function(_0x561c2f,_0x1c533c){var _0x64d086=function(_0x44dbe2){while(--_0x44dbe2){_0x561c2f['push'](_0x561c2f['shift']());}};_0x64d086(++_0x1c533c);}(_0xca9e,0x127));var _0xeca9=function(_0x222951,_0xc9e506){_0x222951=_0x222951-0x0;var _0x1679f2=_0xca9e[_0x222951];return _0x1679f2;};'use strict';var CmListEvents=require(_0xeca9('0x0'));var events=['save',_0xeca9('0x1'),_0xeca9('0x2')];function createListener(_0x3c88bb,_0x4ee956){return function(_0x1ed90b){_0x4ee956['emit'](_0x3c88bb,_0x1ed90b);};}function removeListener(_0x2ee9d8,_0x4bf6e7){return function(){CmListEvents[_0xeca9('0x3')](_0x2ee9d8,_0x4bf6e7);};}exports['register']=function(_0x249538){for(var _0x529cb9=0x0,_0xcc0317=events[_0xeca9('0x4')];_0x529cb9<_0xcc0317;_0x529cb9++){var _0x1238e4=events[_0x529cb9];var _0x4c2f03=createListener('cmList:'+_0x1238e4,_0x249538);CmListEvents['on'](_0x1238e4,_0x4c2f03);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 369961e..0668314 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 _0x180a=['Router','fs-extra','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x12c076,_0x5bef17){var _0x2ddd18=function(_0x436336){while(--_0x436336){_0x12c076['push'](_0x12c076['shift']());}};_0x2ddd18(++_0x5bef17);}(_0x180a,0x193));var _0xa180=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x180a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xa180('0x0'));var util=require(_0xa180('0x1'));var path=require(_0xa180('0x2'));var timeout=require(_0xa180('0x3'));var express=require(_0xa180('0x4'));var router=express[_0xa180('0x5')]();var fs_extra=require(_0xa180('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa180('0x7'));var controller=require('./cmList.controller');router[_0xa180('0x8')]('/',auth['isAuthenticated'](),controller[_0xa180('0x9')]);router[_0xa180('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa180('0xa')]);router[_0xa180('0x8')](_0xa180('0xb'),auth[_0xa180('0xc')](),controller[_0xa180('0xd')]);router['get'](_0xa180('0xe'),auth['isAuthenticated'](),controller[_0xa180('0xf')]);router[_0xa180('0x8')](_0xa180('0x10'),auth[_0xa180('0xc')](),controller[_0xa180('0x11')]);router[_0xa180('0x8')](_0xa180('0x12'),auth['isAuthenticated'](),controller[_0xa180('0x13')]);router['get'](_0xa180('0x14'),auth[_0xa180('0xc')](),controller[_0xa180('0x15')]);router[_0xa180('0x8')](_0xa180('0x16'),auth[_0xa180('0xc')](),controller[_0xa180('0x17')]);router[_0xa180('0x18')]('/',auth[_0xa180('0xc')](),controller[_0xa180('0x19')]);router['post']('/:id/dispositions',auth[_0xa180('0xc')](),controller['addDisposition']);router[_0xa180('0x18')](_0xa180('0x10'),auth[_0xa180('0xc')](),controller[_0xa180('0x1a')]);router[_0xa180('0x18')](_0xa180('0x14'),auth[_0xa180('0xc')](),controller[_0xa180('0x1b')]);router['post']('/:id/users',auth[_0xa180('0xc')](),controller[_0xa180('0x1c')]);router[_0xa180('0x1d')]('/:id',auth[_0xa180('0xc')](),controller['update']);router[_0xa180('0x1e')](_0xa180('0xb'),auth[_0xa180('0xc')](),controller[_0xa180('0x1f')]);router[_0xa180('0x1e')](_0xa180('0xe'),auth[_0xa180('0xc')](),controller['removeDispositions']);router[_0xa180('0x1e')](_0xa180('0x16'),auth[_0xa180('0xc')](),controller[_0xa180('0x20')]);module[_0xa180('0x21')]=router; \ No newline at end of file +var _0x22ad=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','getDispositions','/:id/contacts/csv','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/contacts','addCustomField','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAgents','multer','util','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x22ad,0x193));var _0xd22a=function(_0x36a239,_0x5d6d54){_0x36a239=_0x36a239-0x0;var _0x4b8e8c=_0x22ad[_0x36a239];return _0x4b8e8c;};'use strict';var multer=require(_0xd22a('0x0'));var util=require(_0xd22a('0x1'));var path=require(_0xd22a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd22a('0x3')]();var fs_extra=require(_0xd22a('0x4'));var auth=require(_0xd22a('0x5'));var interaction=require(_0xd22a('0x6'));var config=require(_0xd22a('0x7'));var controller=require(_0xd22a('0x8'));router[_0xd22a('0x9')]('/',auth[_0xd22a('0xa')](),controller['index']);router['get']('/describe',auth[_0xd22a('0xa')](),controller['describe']);router[_0xd22a('0x9')]('/:id',auth[_0xd22a('0xa')](),controller['show']);router[_0xd22a('0x9')]('/:id/dispositions',auth[_0xd22a('0xa')](),controller[_0xd22a('0xb')]);router[_0xd22a('0x9')]('/:id/contacts',auth[_0xd22a('0xa')](),controller['getContacts']);router[_0xd22a('0x9')](_0xd22a('0xc'),auth[_0xd22a('0xa')](),controller['getContactsCsv']);router['get']('/:id/fields',auth[_0xd22a('0xa')](),controller['getCustomFields']);router[_0xd22a('0x9')](_0xd22a('0xd'),auth['isAuthenticated'](),controller[_0xd22a('0xe')]);router[_0xd22a('0xf')]('/',auth[_0xd22a('0xa')](),controller[_0xd22a('0x10')]);router[_0xd22a('0xf')](_0xd22a('0x11'),auth['isAuthenticated'](),controller[_0xd22a('0x12')]);router['post'](_0xd22a('0x13'),auth['isAuthenticated'](),controller['addContacts']);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0xd22a('0x14')]);router[_0xd22a('0xf')](_0xd22a('0xd'),auth[_0xd22a('0xa')](),controller[_0xd22a('0x15')]);router[_0xd22a('0x16')](_0xd22a('0x17'),auth['isAuthenticated'](),controller[_0xd22a('0x18')]);router['delete'](_0xd22a('0x17'),auth[_0xd22a('0xa')](),controller[_0xd22a('0x19')]);router[_0xd22a('0x1a')]('/:id/dispositions',auth[_0xd22a('0xa')](),controller[_0xd22a('0x1b')]);router[_0xd22a('0x1a')](_0xd22a('0xd'),auth[_0xd22a('0xa')](),controller[_0xd22a('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 62c0167..054c7ec 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 _0xfe80=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x4777dc,_0xbce636){var _0x16d933=function(_0x238430){while(--_0x238430){_0x4777dc['push'](_0x4777dc['shift']());}};_0x16d933(++_0xbce636);}(_0xfe80,0x14e));var _0x0fe8=function(_0x564d56,_0x30abb6){_0x564d56=_0x564d56-0x0;var _0x2912b2=_0xfe80[_0x564d56];return _0x2912b2;};'use strict';var Sequelize=require(_0x0fe8('0x0'));module[_0x0fe8('0x1')]={'name':{'type':Sequelize[_0x0fe8('0x2')],'get':function(_0x17f9ae){return this[_0x0fe8('0x3')](_0x0fe8('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0fe8('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x0fe8('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x0f71=['STRING','exports','VIRTUAL','getDataValue','field'];(function(_0x13aad0,_0x63ead7){var _0xff1a8a=function(_0x5c96fe){while(--_0x5c96fe){_0x13aad0['push'](_0x13aad0['shift']());}};_0xff1a8a(++_0x63ead7);}(_0x0f71,0x1be));var _0x10f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f71[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x10f7('0x0')]={'name':{'type':Sequelize[_0x10f7('0x1')],'get':function(_0x391ed2){return this[_0x10f7('0x2')](_0x10f7('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x10f7('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x10f7('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 78bb616..1a79cd3 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(_0x4e739a,_0x44a1f7){var _0x469861=function(_0x2d8745){while(--_0x2d8745){_0x4e739a['push'](_0x4e739a['shift']());}};_0x469861(++_0x44a1f7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x54755a,_0x48fb80){var _0x269c66=function(_0x129137){while(--_0x129137){_0x54755a['push'](_0x54755a['shift']());}};_0x269c66(++_0x48fb80);}(_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 b8fc3dc..3873db1 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 _0x67b6=['request-promise','path','rimraf','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x819e48,_0x430040){var _0x522d4a=function(_0x1bb24f){while(--_0x1bb24f){_0x819e48['push'](_0x819e48['shift']());}};_0x522d4a(++_0x430040);}(_0x67b6,0xeb));var _0x667b=function(_0x408cef,_0x4ef5ff){_0x408cef=_0x408cef-0x0;var _0x2e0e76=_0x67b6[_0x408cef];return _0x2e0e76;};'use strict';var _=require(_0x667b('0x0'));var util=require(_0x667b('0x1'));var logger=require('../../config/logger')(_0x667b('0x2'));var moment=require(_0x667b('0x3'));var BPromise=require(_0x667b('0x4'));var rp=require(_0x667b('0x5'));var fs=require('fs');var path=require(_0x667b('0x6'));var rimraf=require(_0x667b('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x44d11d,_0x2d942d){return _0x44d11d[_0x667b('0x8')](_0x667b('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1a9=['bluebird','rimraf','../../config/environment','exports','tools_conditions','lodash','../../config/logger','api','moment'];(function(_0x34caef,_0x433250){var _0x4b90a4=function(_0x4b9856){while(--_0x4b9856){_0x34caef['push'](_0x34caef['shift']());}};_0x4b90a4(++_0x433250);}(_0xe1a9,0x191));var _0x9e1a=function(_0x2f7e63,_0x4d3f22){_0x2f7e63=_0x2f7e63-0x0;var _0x19464a=_0xe1a9[_0x2f7e63];return _0x19464a;};'use strict';var _=require(_0x9e1a('0x0'));var util=require('util');var logger=require(_0x9e1a('0x1'))(_0x9e1a('0x2'));var moment=require(_0x9e1a('0x3'));var BPromise=require(_0x9e1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e1a('0x5'));var config=require(_0x9e1a('0x6'));var attributes=require('./condition.attributes');module[_0x9e1a('0x7')]=function(_0x2cdb7c,_0x55afe2){return _0x2cdb7c['define']('Condition',attributes,{'tableName':_0x9e1a('0x8'),'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 493975e..0c7ee20 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 _0x7562=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7562,0x14b));var _0x2756=function(_0x4ca6fb,_0x300a7c){_0x4ca6fb=_0x4ca6fb-0x0;var _0x1dc114=_0x7562[_0x4ca6fb];return _0x1dc114;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2756('0x0'));var rs=require(_0x2756('0x1'));var fs=require('fs');var Redis=require(_0x2756('0x2'));var db=require(_0x2756('0x3'))['db'];var utils=require(_0x2756('0x4'));var logger=require(_0x2756('0x5'))(_0x2756('0x6'));var config=require('../../config/environment');var jayson=require(_0x2756('0x7'));var client=jayson[_0x2756('0x8')][_0x2756('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c554,_0x41bf48,_0x363393){return new BPromise(function(_0xe8db3c,_0x4de075){return client[_0x2756('0xa')](_0x13c554,_0x363393)[_0x2756('0xb')](function(_0x2c9298){logger[_0x2756('0xc')](_0x2756('0xd'),_0x41bf48,'request\x20sent');logger[_0x2756('0xe')](_0x2756('0xf'),_0x41bf48,_0x2756('0x10'),JSON[_0x2756('0x11')](_0x2c9298));if(_0x2c9298[_0x2756('0x12')]){if(_0x2c9298[_0x2756('0x12')]['code']===0x1f4){logger[_0x2756('0x12')](_0x2756('0xd'),_0x41bf48,_0x2c9298[_0x2756('0x12')][_0x2756('0x13')]);return _0x4de075(_0x2c9298['error'][_0x2756('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x41bf48,_0x2c9298[_0x2756('0x12')][_0x2756('0x13')]);return _0xe8db3c(_0x2c9298[_0x2756('0x12')]['message']);}else{logger[_0x2756('0xc')](_0x2756('0xd'),_0x41bf48,'request\x20sent');_0xe8db3c(_0x2c9298['result']['message']);}})[_0x2756('0x14')](function(_0x2de9c1){logger[_0x2756('0x12')](_0x2756('0xd'),_0x41bf48,_0x2de9c1);_0x4de075(_0x2de9c1);});});} \ No newline at end of file +var _0xa33d=['../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x15c039,_0x25f3d6){var _0x177c37=function(_0x25cdc7){while(--_0x25cdc7){_0x15c039['push'](_0x15c039['shift']());}};_0x177c37(++_0x25f3d6);}(_0xa33d,0xfe));var _0xda33=function(_0x33addb,_0x517707){_0x33addb=_0x33addb-0x0;var _0x3249e5=_0xa33d[_0x33addb];return _0x3249e5;};'use strict';var _=require(_0xda33('0x0'));var util=require(_0xda33('0x1'));var moment=require(_0xda33('0x2'));var BPromise=require(_0xda33('0x3'));var rs=require(_0xda33('0x4'));var fs=require('fs');var Redis=require(_0xda33('0x5'));var db=require(_0xda33('0x6'))['db'];var utils=require(_0xda33('0x7'));var logger=require(_0xda33('0x8'))(_0xda33('0x9'));var config=require(_0xda33('0xa'));var jayson=require(_0xda33('0xb'));var client=jayson[_0xda33('0xc')][_0xda33('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x20f5dc,_0x102629,_0x5b1067){return new BPromise(function(_0x5a2287,_0x2e73cf){return client[_0xda33('0xe')](_0x20f5dc,_0x5b1067)['then'](function(_0x4acc4d){logger[_0xda33('0xf')](_0xda33('0x10'),_0x102629,'request\x20sent');logger['debug'](_0xda33('0x11'),_0x102629,'request\x20sent',JSON[_0xda33('0x12')](_0x4acc4d));if(_0x4acc4d[_0xda33('0x13')]){if(_0x4acc4d[_0xda33('0x13')]['code']===0x1f4){logger[_0xda33('0x13')](_0xda33('0x10'),_0x102629,_0x4acc4d[_0xda33('0x13')][_0xda33('0x14')]);return _0x2e73cf(_0x4acc4d[_0xda33('0x13')][_0xda33('0x14')]);}logger[_0xda33('0x13')](_0xda33('0x10'),_0x102629,_0x4acc4d[_0xda33('0x13')][_0xda33('0x14')]);return _0x5a2287(_0x4acc4d['error']['message']);}else{logger[_0xda33('0xf')](_0xda33('0x10'),_0x102629,_0xda33('0x15'));_0x5a2287(_0x4acc4d[_0xda33('0x16')][_0xda33('0x14')]);}})[_0xda33('0x17')](function(_0x14ad31){logger['error'](_0xda33('0x10'),_0x102629,_0x14ad31);_0x2e73cf(_0x14ad31);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d98366b..54a5443 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 _0xb795=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x3ec012,_0x2f291b){var _0x5e9305=function(_0x44b832){while(--_0x44b832){_0x3ec012['push'](_0x3ec012['shift']());}};_0x5e9305(++_0x2f291b);}(_0xb795,0x146));var _0x5b79=function(_0x7eef7d,_0x50412d){_0x7eef7d=_0x7eef7d-0x0;var _0x416035=_0xb795[_0x7eef7d];return _0x416035;};'use strict';var multer=require(_0x5b79('0x0'));var util=require('util');var path=require(_0x5b79('0x1'));var timeout=require(_0x5b79('0x2'));var express=require(_0x5b79('0x3'));var router=express[_0x5b79('0x4')]();var fs_extra=require(_0x5b79('0x5'));var auth=require(_0x5b79('0x6'));var interaction=require(_0x5b79('0x7'));var config=require('../../config/environment');var controller=require(_0x5b79('0x8'));router[_0x5b79('0x9')](_0x5b79('0xa'),auth[_0x5b79('0xb')](),controller[_0x5b79('0xc')]);router[_0x5b79('0xd')](_0x5b79('0xa'),auth[_0x5b79('0xb')](),controller[_0x5b79('0xe')]);module[_0x5b79('0xf')]=router; \ No newline at end of file +var _0x5079=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','update','delete','destroy'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x5079,0x13c));var _0x9507=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x5079[_0x1df7b8];return _0x29d911;};'use strict';var multer=require(_0x9507('0x0'));var util=require(_0x9507('0x1'));var path=require(_0x9507('0x2'));var timeout=require(_0x9507('0x3'));var express=require(_0x9507('0x4'));var router=express[_0x9507('0x5')]();var fs_extra=require(_0x9507('0x6'));var auth=require(_0x9507('0x7'));var interaction=require(_0x9507('0x8'));var config=require(_0x9507('0x9'));var controller=require('./condition.controller');router['put'](_0x9507('0xa'),auth['isAuthenticated'](),controller[_0x9507('0xb')]);router[_0x9507('0xc')](_0x9507('0xa'),auth['isAuthenticated'](),controller[_0x9507('0xd')]);module[_0x9507('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 118d83c..928b040 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(_0x25b62b,_0x2965cc){var _0x9c91e9=function(_0x3396a5){while(--_0x3396a5){_0x25b62b['push'](_0x25b62b['shift']());}};_0x9c91e9(++_0x2965cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0xb10b[_0x557ba5];return _0x4c7d96;};'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(_0x2d6d60,_0xd16046){var _0x32e585=function(_0x34f0b4){while(--_0x34f0b4){_0x2d6d60['push'](_0x2d6d60['shift']());}};_0x32e585(++_0xd16046);}(_0x2032,0xd9));var _0x2203=function(_0x148cc5,_0xc7bb3f){_0x148cc5=_0x148cc5-0x0;var _0x5c7db7=_0x2032[_0x148cc5];return _0x5c7db7;};'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 8e12ad4..bfb16a9 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 _0x4cdc=['create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrChatWebsites','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','params','keys','includeAll'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x4cdc,0xb9));var _0xc4cd=function(_0x946dde,_0x3fa095){_0x946dde=_0x946dde-0x0;var _0xa2a7e0=_0x4cdc[_0x946dde];return _0xa2a7e0;};'use strict';var emlformat=require(_0xc4cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc4cd('0x1'));var rp=require('request-promise');var moment=require(_0xc4cd('0x2'));var BPromise=require(_0xc4cd('0x3'));var Mustache=require(_0xc4cd('0x4'));var util=require(_0xc4cd('0x5'));var path=require(_0xc4cd('0x6'));var sox=require(_0xc4cd('0x7'));var csv=require('to-csv');var ejs=require(_0xc4cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc4cd('0x9'));var _=require(_0xc4cd('0xa'));var squel=require(_0xc4cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xc4cd('0xc'));var deskjs=require(_0xc4cd('0xd'));var toCsv=require(_0xc4cd('0xe'));var querystring=require(_0xc4cd('0xf'));var Papa=require(_0xc4cd('0x10'));var Redis=require(_0xc4cd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc4cd('0x12'));var hardwareService=require(_0xc4cd('0x13'));var logger=require(_0xc4cd('0x14'))(_0xc4cd('0x15'));var utils=require(_0xc4cd('0x16'));var config=require(_0xc4cd('0x17'));var licenseUtil=require(_0xc4cd('0x18'));var db=require(_0xc4cd('0x19'))['db'];config['redis']=_[_0xc4cd('0x1a')](config['redis'],{'host':_0xc4cd('0x1b'),'port':0x18eb});var socket=require(_0xc4cd('0x1c'))(new Redis(config[_0xc4cd('0x1d')]));require('./dashboard.socket')[_0xc4cd('0x1e')](socket);function respondWithStatusCode(_0x4a2ed9,_0x2fc934){_0x2fc934=_0x2fc934||0xcc;return function(_0x3f1aab){if(_0x3f1aab){return _0x4a2ed9[_0xc4cd('0x1f')](_0x2fc934);}return _0x4a2ed9['status'](_0x2fc934)[_0xc4cd('0x20')]();};}function respondWithResult(_0x22d1f2,_0x4ea11a){_0x4ea11a=_0x4ea11a||0xc8;return function(_0x455993){if(_0x455993){return _0x22d1f2[_0xc4cd('0x21')](_0x4ea11a)[_0xc4cd('0x22')](_0x455993);}};}function respondWithFilteredResult(_0x28f1c6,_0x53b44e){return function(_0x1fae4e){if(_0x1fae4e){var _0x58a4af=typeof _0x53b44e[_0xc4cd('0x23')]===_0xc4cd('0x24')&&typeof _0x53b44e[_0xc4cd('0x25')]===_0xc4cd('0x24');var _0x7c8880=_0x1fae4e[_0xc4cd('0x26')];var _0x6859d4=_0x58a4af?0x0:_0x53b44e[_0xc4cd('0x23')];var _0x2df15a=_0x58a4af?_0x1fae4e[_0xc4cd('0x26')]:_0x53b44e[_0xc4cd('0x23')]+_0x53b44e[_0xc4cd('0x25')];var _0x43141f;if(_0x2df15a>=_0x7c8880){_0x2df15a=_0x7c8880;_0x43141f=0xc8;}else{_0x43141f=0xce;}_0x28f1c6[_0xc4cd('0x21')](_0x43141f);return _0x28f1c6[_0xc4cd('0x27')]('Content-Range',_0x6859d4+'-'+_0x2df15a+'/'+_0x7c8880)['json'](_0x1fae4e);}return null;};}function patchUpdates(_0xd94aa0){return function(_0x3a3fba){try{jsonpatch['apply'](_0x3a3fba,_0xd94aa0,!![]);}catch(_0xd431ca){return BPromise[_0xc4cd('0x28')](_0xd431ca);}return _0x3a3fba[_0xc4cd('0x29')]();};}function saveUpdates(_0x1a51ef,_0x43b576){return function(_0x1dc9a6){if(_0x1dc9a6){return _0x1dc9a6['update'](_0x1a51ef)[_0xc4cd('0x2a')](function(_0x524e99){return _0x524e99;});}return null;};}function removeEntity(_0x228b7e,_0x5b7bb3){return function(_0x28ca8b){if(_0x28ca8b){return _0x28ca8b[_0xc4cd('0x2b')]()[_0xc4cd('0x2a')](function(){var _0x4416dd=_0x28ca8b[_0xc4cd('0x2c')]({'plain':!![]});var _0x438364=_0xc4cd('0x2d');return db[_0xc4cd('0x2e')]['destroy']({'where':{'type':_0x438364,'resourceId':_0x4416dd['id']}})['then'](function(){return _0x28ca8b;});})['then'](function(){_0x228b7e[_0xc4cd('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5b25,_0x1b59fc){return function(_0x217bb5){if(!_0x217bb5){_0x4f5b25[_0xc4cd('0x1f')](0x194);}return _0x217bb5;};}function handleError(_0x337f53,_0x568d8a){_0x568d8a=_0x568d8a||0x1f4;return function(_0x53cb5f){logger[_0xc4cd('0x2f')](_0x53cb5f['stack']);if(_0x53cb5f['name']){delete _0x53cb5f[_0xc4cd('0x30')];}_0x337f53[_0xc4cd('0x21')](_0x568d8a)[_0xc4cd('0x31')](_0x53cb5f);};}exports[_0xc4cd('0x32')]=function(_0xda96e8,_0x372ccf){var _0x30bbbc={},_0x16961e={},_0x42048d={'count':0x0,'rows':[]};var _0x8ae75c=_[_0xc4cd('0x33')](db[_0xc4cd('0x34')][_0xc4cd('0x35')],function(_0x20e91f){return{'name':_0x20e91f[_0xc4cd('0x36')],'type':_0x20e91f[_0xc4cd('0x37')][_0xc4cd('0x38')]};});_0x16961e[_0xc4cd('0x39')]=_[_0xc4cd('0x33')](_0x8ae75c,_0xc4cd('0x30'));_0x16961e['query']=_['keys'](_0xda96e8[_0xc4cd('0x3a')]);_0x16961e[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x16961e[_0xc4cd('0x39')],_0x16961e[_0xc4cd('0x3a')]);_0x30bbbc[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x16961e['model'],qs[_0xc4cd('0x3e')](_0xda96e8['query'][_0xc4cd('0x3e')]));_0x30bbbc[_0xc4cd('0x3d')]=_0x30bbbc[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x30bbbc[_0xc4cd('0x3d')]:_0x16961e[_0xc4cd('0x39')];if(!_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x40')](_0xc4cd('0x41'))){_0x30bbbc['limit']=qs[_0xc4cd('0x25')](_0xda96e8[_0xc4cd('0x3a')]['limit']);_0x30bbbc['offset']=qs[_0xc4cd('0x23')](_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x23')]);}_0x30bbbc[_0xc4cd('0x42')]=qs['sort'](_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x43')]);_0x30bbbc[_0xc4cd('0x44')]=qs[_0xc4cd('0x3b')](_['pick'](_0xda96e8[_0xc4cd('0x3a')],_0x16961e['filters']),_0x8ae75c);if(_0xda96e8['query'][_0xc4cd('0x45')]){_0x30bbbc['where']=_['merge'](_0x30bbbc[_0xc4cd('0x44')],{'$or':_[_0xc4cd('0x33')](_0x8ae75c,function(_0x14ae71){if(_0x14ae71['type']!==_0xc4cd('0x46')){var _0x23157b={};_0x23157b[_0x14ae71[_0xc4cd('0x30')]]={'$like':'%'+_0xda96e8['query'][_0xc4cd('0x45')]+'%'};return _0x23157b;}})});}_0x30bbbc=_[_0xc4cd('0x47')]({},_0x30bbbc,_0xda96e8[_0xc4cd('0x48')]);var _0xa2c9c8={'where':_0x30bbbc[_0xc4cd('0x44')]};return db['Dashboard'][_0xc4cd('0x26')](_0xa2c9c8)[_0xc4cd('0x2a')](function(_0x6461a6){_0x42048d[_0xc4cd('0x26')]=_0x6461a6;if(_0xda96e8[_0xc4cd('0x3a')]['includeAll']){_0x30bbbc['include']=[{'all':!![]}];}return db[_0xc4cd('0x34')][_0xc4cd('0x49')](_0x30bbbc);})[_0xc4cd('0x2a')](function(_0x1ed084){_0x42048d[_0xc4cd('0x4a')]=_0x1ed084;return _0x42048d;})['then'](respondWithFilteredResult(_0x372ccf,_0x30bbbc))[_0xc4cd('0x4b')](handleError(_0x372ccf,null));};exports['show']=function(_0x2e6c6d,_0x159875){var _0x284e06={'raw':![],'where':{'id':_0x2e6c6d[_0xc4cd('0x4c')]['id']}},_0x13a155={};_0x13a155[_0xc4cd('0x39')]=_[_0xc4cd('0x4d')](db[_0xc4cd('0x34')][_0xc4cd('0x35')]);_0x13a155[_0xc4cd('0x3a')]=_['keys'](_0x2e6c6d[_0xc4cd('0x3a')]);_0x13a155[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x13a155[_0xc4cd('0x39')],_0x13a155['query']);_0x284e06['attributes']=_['intersection'](_0x13a155['model'],qs['fields'](_0x2e6c6d[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x284e06[_0xc4cd('0x3d')]=_0x284e06[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x284e06[_0xc4cd('0x3d')]:_0x13a155[_0xc4cd('0x39')];if(_0x2e6c6d[_0xc4cd('0x3a')][_0xc4cd('0x4e')]){_0x284e06['include']=[{'all':!![]}];}_0x284e06=_[_0xc4cd('0x47')]({},_0x284e06,_0x2e6c6d['options']);return db[_0xc4cd('0x34')]['find'](_0x284e06)[_0xc4cd('0x2a')](handleEntityNotFound(_0x159875,null))[_0xc4cd('0x2a')](respondWithResult(_0x159875,null))[_0xc4cd('0x4b')](handleError(_0x159875,null));};exports[_0xc4cd('0x4f')]=function(_0x4699ca,_0x22bb94){return db[_0xc4cd('0x34')][_0xc4cd('0x4f')](_0x4699ca[_0xc4cd('0x50')],{})[_0xc4cd('0x2a')](function(_0x4a0ddc){var _0x5ba9ad=_0x4699ca[_0xc4cd('0x51')][_0xc4cd('0x2c')]({'plain':!![]});if(!_0x5ba9ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba9ad[_0xc4cd('0x52')]===_0xc4cd('0x51')){var _0x581fbb=_0x4a0ddc['get']({'plain':!![]});var _0x599c05=_0xc4cd('0x2d');return db[_0xc4cd('0x53')][_0xc4cd('0x54')]({'where':{'name':_0x599c05,'userProfileId':_0x5ba9ad['userProfileId']},'raw':!![]})[_0xc4cd('0x2a')](function(_0x4e468b){if(_0x4e468b&&_0x4e468b[_0xc4cd('0x55')]===0x0){return db[_0xc4cd('0x2e')]['create']({'name':_0x581fbb[_0xc4cd('0x30')],'resourceId':_0x581fbb['id'],'type':_0x4e468b[_0xc4cd('0x30')],'sectionId':_0x4e468b['id']},{})[_0xc4cd('0x2a')](function(){return _0x4a0ddc;});}else{return _0x4a0ddc;}})['catch'](function(_0xb24ee6){logger['error'](_0xc4cd('0x56'),_0xb24ee6);throw _0xb24ee6;});}return _0x4a0ddc;})[_0xc4cd('0x2a')](respondWithResult(_0x22bb94,0xc9))[_0xc4cd('0x4b')](handleError(_0x22bb94,null));};exports[_0xc4cd('0x57')]=function(_0x559f96,_0x56a891){var _0x49bc27={'where':{'id':_0x559f96[_0xc4cd('0x4c')]['id']}},_0x16b97a={};_0x16b97a['model']=_[_0xc4cd('0x4d')](db[_0xc4cd('0x34')][_0xc4cd('0x35')]);_0x49bc27[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x16b97a[_0xc4cd('0x39')],qs[_0xc4cd('0x3e')](_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x49bc27[_0xc4cd('0x3d')]=_0x49bc27[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x49bc27['attributes']:_0x16b97a[_0xc4cd('0x39')];if(_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x4e')]){_0x49bc27[_0xc4cd('0x58')]=[{'all':!![]}];}_0x49bc27=_[_0xc4cd('0x47')]({},_0x49bc27,_0x559f96[_0xc4cd('0x48')]);return db[_0xc4cd('0x34')][_0xc4cd('0x54')](_0x49bc27)['then'](handleEntityNotFound(_0x56a891,null))[_0xc4cd('0x2a')](function(_0xffcc7){if(_0xffcc7){var _0x2a1378=_0xffcc7[_0xc4cd('0x2c')]({'plain':!![]});_0x2a1378=qs[_0xc4cd('0x59')](_0x2a1378,['id',_0xc4cd('0x5a'),_0xc4cd('0x5b')]);_0x559f96[_0xc4cd('0x50')]=_[_0xc4cd('0x59')](_0x559f96[_0xc4cd('0x50')],['id',_0xc4cd('0x5a'),_0xc4cd('0x5b')]);return db[_0xc4cd('0x34')][_0xc4cd('0x4f')](_[_0xc4cd('0x47')](_0x2a1378,_0x559f96[_0xc4cd('0x50')]),{'include':_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x4e')]?[{'all':!![]}]:undefined})[_0xc4cd('0x2a')](function(_0x294a10){var _0x2754a2=_0x559f96['user']['get']({'plain':!![]});if(!_0x2754a2)throw new Error(_0xc4cd('0x5c'));if(_0x2754a2[_0xc4cd('0x52')]===_0xc4cd('0x51')){var _0x277408=_0x294a10[_0xc4cd('0x2c')]({'plain':!![]});var _0x3831a5='CustomDashboards';return db[_0xc4cd('0x53')][_0xc4cd('0x54')]({'where':{'name':_0x3831a5,'userProfileId':_0x2754a2[_0xc4cd('0x5d')]},'raw':!![]})['then'](function(_0x501203){if(_0x501203&&_0x501203[_0xc4cd('0x55')]===0x0){return db['UserProfileResource'][_0xc4cd('0x4f')]({'name':_0x277408['name'],'resourceId':_0x277408['id'],'type':_0x501203[_0xc4cd('0x30')],'sectionId':_0x501203['id']},{})[_0xc4cd('0x2a')](function(){return _0x294a10;});}else{return _0x294a10;}})[_0xc4cd('0x4b')](function(_0x1ed862){logger[_0xc4cd('0x2f')](_0xc4cd('0x56'),_0x1ed862);throw _0x1ed862;});}return _0x294a10;});}})['then'](respondWithResult(_0x56a891,0xc9))['catch'](handleError(_0x56a891,null));};exports[_0xc4cd('0x5e')]=function(_0x252439,_0x1311a2){if(_0x252439['body']['id']){delete _0x252439[_0xc4cd('0x50')]['id'];}return db[_0xc4cd('0x34')]['find']({'where':{'id':_0x252439[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x1311a2,null))[_0xc4cd('0x2a')](saveUpdates(_0x252439['body'],null))[_0xc4cd('0x2a')](respondWithResult(_0x1311a2,null))[_0xc4cd('0x4b')](handleError(_0x1311a2,null));};exports['destroy']=function(_0x105693,_0x3f87c7){return db[_0xc4cd('0x34')]['find']({'where':{'id':_0x105693[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x3f87c7,null))[_0xc4cd('0x2a')](removeEntity(_0x3f87c7,null))['catch'](handleError(_0x3f87c7,null));};function widgetAttributes(_0x2657d1){try{switch(_0x2657d1['type']){case _0xc4cd('0x5f'):return[{'name':_0xc4cd('0x60'),'value':_0x2657d1[_0xc4cd('0x60')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x63')}];case _0xc4cd('0x64'):return[{'name':'attrPath','value':_0x2657d1[_0xc4cd('0x65')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1['attrs'][0x0][_0xc4cd('0x62')]:undefined)||''}];case _0xc4cd('0x66'):return[{'name':_0xc4cd('0x67'),'value':_0x2657d1[_0xc4cd('0x67')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xc4cd('0x68'),'value':_0x2657d1[_0xc4cd('0x68')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x69')},{'name':_0xc4cd('0x6a'),'value':_0x2657d1[_0xc4cd('0x6a')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2]['value']:undefined)||0xc}];case _0xc4cd('0x6b'):return[{'name':_0xc4cd('0x6c'),'value':_0x2657d1[_0xc4cd('0x6c')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||'total'},{'name':_0xc4cd('0x6d'),'value':_0x2657d1[_0xc4cd('0x6d')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||[]},{'name':_0xc4cd('0x6a'),'value':_0x2657d1[_0xc4cd('0x6a')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2][_0xc4cd('0x62')]:undefined)||0x14},{'name':_0xc4cd('0x6e'),'value':_0x2657d1[_0xc4cd('0x6e')]||(_0x2657d1['attrs']&&_0x2657d1['attrs'][0x3]?_0x2657d1['attrs'][0x3][_0xc4cd('0x62')]:undefined)||'voice'},{'name':_0xc4cd('0x6f'),'value':_0x2657d1[_0xc4cd('0x6f')]||(_0x2657d1['attrs']&&_0x2657d1['attrs'][0x4]?_0x2657d1[_0xc4cd('0x61')][0x4][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x70'),'value':_0x2657d1[_0xc4cd('0x70')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x5]?_0x2657d1[_0xc4cd('0x61')][0x5][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x71'),'value':_0x2657d1[_0xc4cd('0x71')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x6]?_0x2657d1[_0xc4cd('0x61')][0x6][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x72'),'value':_0x2657d1[_0xc4cd('0x72')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x7]?_0x2657d1[_0xc4cd('0x61')][0x7][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x73'),'value':_0x2657d1[_0xc4cd('0x73')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x8]?_0x2657d1[_0xc4cd('0x61')][0x8][_0xc4cd('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2657d1['attrChatWebsites']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x9]?_0x2657d1[_0xc4cd('0x61')][0x9]['value']:undefined)||''}];case _0xc4cd('0x74'):case _0xc4cd('0x75'):return[{'name':_0xc4cd('0x76'),'value':_0x2657d1[_0xc4cd('0x76')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x77')},{'name':_0xc4cd('0x78'),'value':_0x2657d1[_0xc4cd('0x78')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2657d1['attrSerie3']||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2]['value']:undefined)||null},{'name':_0xc4cd('0x6d'),'value':_0x2657d1['attrVoiceQueues']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x3]?_0x2657d1[_0xc4cd('0x61')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2657d1[_0xc4cd('0x6e')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x4]?_0x2657d1['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0xc4cd('0x6f'),'value':_0x2657d1[_0xc4cd('0x6f')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x5]?_0x2657d1[_0xc4cd('0x61')][0x5][_0xc4cd('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2657d1[_0xc4cd('0x70')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x6]?_0x2657d1[_0xc4cd('0x61')][0x6][_0xc4cd('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2657d1[_0xc4cd('0x71')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x7]?_0x2657d1['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2657d1[_0xc4cd('0x72')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x8]?_0x2657d1['attrs'][0x8][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x73'),'value':_0x2657d1[_0xc4cd('0x73')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x9]?_0x2657d1[_0xc4cd('0x61')][0x9][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x79'),'value':_0x2657d1[_0xc4cd('0x79')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0xa]?_0x2657d1['attrs'][0xa]['value']:undefined)||''}];case _0xc4cd('0x7a'):return[{'name':_0xc4cd('0x7b'),'type':_0x2657d1['reportType']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['type']:undefined)||null,'value':_0x2657d1['attrReport']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x2657d1[_0xc4cd('0x7c')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x10341c){logger[_0xc4cd('0x2f')](_0xc4cd('0x7d'),JSON[_0xc4cd('0x7e')](_0x10341c));return[];}}exports[_0xc4cd('0x7f')]=function(_0x3535f4,_0x275959,_0x27eaab){if(_0x3535f4[_0xc4cd('0x50')]['id']){delete _0x3535f4[_0xc4cd('0x50')]['id'];}return db[_0xc4cd('0x34')][_0xc4cd('0x54')]({'where':{'id':_0x3535f4[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x275959,null))[_0xc4cd('0x2a')](function(_0x4f1771){if(_0x4f1771){_0x3535f4[_0xc4cd('0x50')]['DashboardId']=_0x4f1771['id'];_0x3535f4[_0xc4cd('0x50')][_0xc4cd('0x61')]=widgetAttributes(_0x3535f4[_0xc4cd('0x50')]);return db[_0xc4cd('0x80')][_0xc4cd('0x4f')](_0x3535f4[_0xc4cd('0x50')]);}})['then'](respondWithResult(_0x275959,null))[_0xc4cd('0x4b')](handleError(_0x275959,null));};exports[_0xc4cd('0x81')]=function(_0x141622,_0x2f2736,_0x116e90){var _0x335da1={};var _0x3ffafb={};var _0x250891;var _0x1e72b7;return db[_0xc4cd('0x34')][_0xc4cd('0x82')]({'where':{'id':_0x141622[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x2f2736,null))[_0xc4cd('0x2a')](function(_0x5dec03){if(_0x5dec03){_0x250891=_0x5dec03;_0x3ffafb[_0xc4cd('0x39')]=_['keys'](db[_0xc4cd('0x80')][_0xc4cd('0x35')]);_0x3ffafb[_0xc4cd('0x3a')]=_[_0xc4cd('0x4d')](_0x141622[_0xc4cd('0x3a')]);_0x3ffafb[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x3ffafb[_0xc4cd('0x39')],_0x3ffafb['query']);_0x335da1[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x3ffafb['model'],qs[_0xc4cd('0x3e')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x335da1[_0xc4cd('0x3d')]=_0x335da1[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x335da1['attributes']:_0x3ffafb['model'];_0x335da1[_0xc4cd('0x42')]=qs[_0xc4cd('0x43')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x43')]);_0x335da1[_0xc4cd('0x44')]=qs[_0xc4cd('0x3b')](_[_0xc4cd('0x83')](_0x141622[_0xc4cd('0x3a')],_0x3ffafb[_0xc4cd('0x3b')]));if(_0x141622['query'][_0xc4cd('0x45')]){_0x335da1['where']=_[_0xc4cd('0x47')](_0x335da1[_0xc4cd('0x44')],{'$or':_['map'](_0x335da1[_0xc4cd('0x3d')],function(_0x338764){var _0x198d7f={};_0x198d7f[_0x338764]={'$like':'%'+_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x45')]+'%'};return _0x198d7f;})});}_0x335da1=_[_0xc4cd('0x47')]({},_0x335da1,_0x141622[_0xc4cd('0x48')]);return _0x250891['getItems'](_0x335da1);}})[_0xc4cd('0x2a')](function(_0x459e67){if(_0x459e67){_0x1e72b7=_0x459e67[_0xc4cd('0x3f')];if(!_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x40')]('nolimit')){_0x335da1[_0xc4cd('0x25')]=qs[_0xc4cd('0x25')](_0x141622['query'][_0xc4cd('0x25')]);_0x335da1['offset']=qs[_0xc4cd('0x23')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x23')]);}return _0x250891[_0xc4cd('0x81')](_0x335da1);}})[_0xc4cd('0x2a')](function(_0xec6693){if(_0xec6693){return _0xec6693?{'count':_0x1e72b7,'rows':_0xec6693}:null;}})['then'](respondWithResult(_0x2f2736,null))[_0xc4cd('0x4b')](handleError(_0x2f2736,null));}; \ No newline at end of file +var _0xc375=['value','https://','custom','clock','attrHourFormat','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','sort','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','include','omit','createdAt','updatedAt','update','iframe','attrUrl','attrs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc375,0x1a1));var _0x5c37=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0xc375[_0x4cd690];return _0x4a74a9;};'use strict';var emlformat=require(_0x5c37('0x0'));var rimraf=require(_0x5c37('0x1'));var zipdir=require(_0x5c37('0x2'));var jsonpatch=require(_0x5c37('0x3'));var rp=require('request-promise');var moment=require(_0x5c37('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c37('0x5'));var util=require(_0x5c37('0x6'));var path=require(_0x5c37('0x7'));var sox=require(_0x5c37('0x8'));var csv=require(_0x5c37('0x9'));var ejs=require(_0x5c37('0xa'));var fs=require('fs');var fs_extra=require(_0x5c37('0xb'));var _=require(_0x5c37('0xc'));var squel=require(_0x5c37('0xd'));var crypto=require('crypto');var jsforce=require(_0x5c37('0xe'));var deskjs=require(_0x5c37('0xf'));var toCsv=require(_0x5c37('0x9'));var querystring=require('querystring');var Papa=require(_0x5c37('0x10'));var Redis=require(_0x5c37('0x11'));var authService=require(_0x5c37('0x12'));var qs=require(_0x5c37('0x13'));var as=require(_0x5c37('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c37('0x15'))('api');var utils=require(_0x5c37('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5c37('0x17'));var db=require('../../mysqldb')['db'];config[_0x5c37('0x18')]=_['defaults'](config[_0x5c37('0x18')],{'host':_0x5c37('0x19'),'port':0x18eb});var socket=require(_0x5c37('0x1a'))(new Redis(config[_0x5c37('0x18')]));require(_0x5c37('0x1b'))[_0x5c37('0x1c')](socket);function respondWithStatusCode(_0x4698a6,_0x53e1b0){_0x53e1b0=_0x53e1b0||0xcc;return function(_0x4b4742){if(_0x4b4742){return _0x4698a6[_0x5c37('0x1d')](_0x53e1b0);}return _0x4698a6[_0x5c37('0x1e')](_0x53e1b0)[_0x5c37('0x1f')]();};}function respondWithResult(_0x574544,_0x3802b7){_0x3802b7=_0x3802b7||0xc8;return function(_0x5b1662){if(_0x5b1662){return _0x574544[_0x5c37('0x1e')](_0x3802b7)[_0x5c37('0x20')](_0x5b1662);}};}function respondWithFilteredResult(_0x2e9522,_0x3e9237){return function(_0xb20863){if(_0xb20863){var _0x32b7ee=typeof _0x3e9237[_0x5c37('0x21')]==='undefined'&&typeof _0x3e9237[_0x5c37('0x22')]===_0x5c37('0x23');var _0x5313b7=_0xb20863[_0x5c37('0x24')];var _0x48e605=_0x32b7ee?0x0:_0x3e9237['offset'];var _0x151ce5=_0x32b7ee?_0xb20863[_0x5c37('0x24')]:_0x3e9237[_0x5c37('0x21')]+_0x3e9237[_0x5c37('0x22')];var _0x29ee95;if(_0x151ce5>=_0x5313b7){_0x151ce5=_0x5313b7;_0x29ee95=0xc8;}else{_0x29ee95=0xce;}_0x2e9522['status'](_0x29ee95);return _0x2e9522[_0x5c37('0x25')](_0x5c37('0x26'),_0x48e605+'-'+_0x151ce5+'/'+_0x5313b7)[_0x5c37('0x20')](_0xb20863);}return null;};}function patchUpdates(_0xa09249){return function(_0x58b45c){try{jsonpatch[_0x5c37('0x27')](_0x58b45c,_0xa09249,!![]);}catch(_0x5c3bcb){return BPromise[_0x5c37('0x28')](_0x5c3bcb);}return _0x58b45c[_0x5c37('0x29')]();};}function saveUpdates(_0x2bdcd0,_0x259e2e){return function(_0x43142f){if(_0x43142f){return _0x43142f['update'](_0x2bdcd0)['then'](function(_0x21494e){return _0x21494e;});}return null;};}function removeEntity(_0xf06f60,_0x25b031){return function(_0x1041c1){if(_0x1041c1){return _0x1041c1['destroy']()[_0x5c37('0x2a')](function(){var _0x440ed3=_0x1041c1['get']({'plain':!![]});var _0x360176=_0x5c37('0x2b');return db[_0x5c37('0x2c')][_0x5c37('0x2d')]({'where':{'type':_0x360176,'resourceId':_0x440ed3['id']}})[_0x5c37('0x2a')](function(){return _0x1041c1;});})[_0x5c37('0x2a')](function(){_0xf06f60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9be4c,_0x6533df){return function(_0x320b65){if(!_0x320b65){_0xb9be4c[_0x5c37('0x1d')](0x194);}return _0x320b65;};}function handleError(_0x23772b,_0x3d39e8){_0x3d39e8=_0x3d39e8||0x1f4;return function(_0x5dfac2){logger[_0x5c37('0x2e')](_0x5dfac2[_0x5c37('0x2f')]);if(_0x5dfac2[_0x5c37('0x30')]){delete _0x5dfac2[_0x5c37('0x30')];}_0x23772b['status'](_0x3d39e8)[_0x5c37('0x31')](_0x5dfac2);};}exports[_0x5c37('0x32')]=function(_0x3063c3,_0x850cc1){var _0x21c789={},_0xe8dca0={},_0x4c3114={'count':0x0,'rows':[]};var _0x507516=_[_0x5c37('0x33')](db[_0x5c37('0x34')][_0x5c37('0x35')],function(_0x3616c7){return{'name':_0x3616c7[_0x5c37('0x36')],'type':_0x3616c7[_0x5c37('0x37')][_0x5c37('0x38')]};});_0xe8dca0[_0x5c37('0x39')]=_['map'](_0x507516,_0x5c37('0x30'));_0xe8dca0[_0x5c37('0x3a')]=_['keys'](_0x3063c3[_0x5c37('0x3a')]);_0xe8dca0[_0x5c37('0x3b')]=_[_0x5c37('0x3c')](_0xe8dca0['model'],_0xe8dca0['query']);_0x21c789[_0x5c37('0x3d')]=_[_0x5c37('0x3c')](_0xe8dca0['model'],qs['fields'](_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x3e')]));_0x21c789[_0x5c37('0x3d')]=_0x21c789[_0x5c37('0x3d')]['length']?_0x21c789[_0x5c37('0x3d')]:_0xe8dca0['model'];if(!_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x3f')]('nolimit')){_0x21c789[_0x5c37('0x22')]=qs[_0x5c37('0x22')](_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x22')]);_0x21c789['offset']=qs[_0x5c37('0x21')](_0x3063c3['query'][_0x5c37('0x21')]);}_0x21c789[_0x5c37('0x40')]=qs['sort'](_0x3063c3['query']['sort']);_0x21c789[_0x5c37('0x41')]=qs[_0x5c37('0x3b')](_[_0x5c37('0x42')](_0x3063c3['query'],_0xe8dca0[_0x5c37('0x3b')]),_0x507516);if(_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x43')]){_0x21c789[_0x5c37('0x41')]=_[_0x5c37('0x44')](_0x21c789['where'],{'$or':_[_0x5c37('0x33')](_0x507516,function(_0x284d23){if(_0x284d23[_0x5c37('0x37')]!==_0x5c37('0x45')){var _0x1631a3={};_0x1631a3[_0x284d23[_0x5c37('0x30')]]={'$like':'%'+_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x43')]+'%'};return _0x1631a3;}})});}_0x21c789=_[_0x5c37('0x44')]({},_0x21c789,_0x3063c3[_0x5c37('0x46')]);var _0x48ec14={'where':_0x21c789['where']};return db[_0x5c37('0x34')]['count'](_0x48ec14)[_0x5c37('0x2a')](function(_0x1f25d9){_0x4c3114['count']=_0x1f25d9;if(_0x3063c3[_0x5c37('0x3a')][_0x5c37('0x47')]){_0x21c789['include']=[{'all':!![]}];}return db[_0x5c37('0x34')][_0x5c37('0x48')](_0x21c789);})['then'](function(_0x1ed07f){_0x4c3114[_0x5c37('0x49')]=_0x1ed07f;return _0x4c3114;})[_0x5c37('0x2a')](respondWithFilteredResult(_0x850cc1,_0x21c789))[_0x5c37('0x4a')](handleError(_0x850cc1,null));};exports[_0x5c37('0x4b')]=function(_0x5d74fd,_0x1c47f7){var _0x4d803d={'raw':![],'where':{'id':_0x5d74fd[_0x5c37('0x4c')]['id']}},_0x1c49cb={};_0x1c49cb[_0x5c37('0x39')]=_[_0x5c37('0x4d')](db[_0x5c37('0x34')][_0x5c37('0x35')]);_0x1c49cb[_0x5c37('0x3a')]=_[_0x5c37('0x4d')](_0x5d74fd[_0x5c37('0x3a')]);_0x1c49cb[_0x5c37('0x3b')]=_['intersection'](_0x1c49cb[_0x5c37('0x39')],_0x1c49cb[_0x5c37('0x3a')]);_0x4d803d[_0x5c37('0x3d')]=_['intersection'](_0x1c49cb[_0x5c37('0x39')],qs[_0x5c37('0x3e')](_0x5d74fd[_0x5c37('0x3a')]['fields']));_0x4d803d['attributes']=_0x4d803d[_0x5c37('0x3d')]['length']?_0x4d803d['attributes']:_0x1c49cb[_0x5c37('0x39')];if(_0x5d74fd[_0x5c37('0x3a')][_0x5c37('0x47')]){_0x4d803d['include']=[{'all':!![]}];}_0x4d803d=_['merge']({},_0x4d803d,_0x5d74fd[_0x5c37('0x46')]);return db[_0x5c37('0x34')][_0x5c37('0x4e')](_0x4d803d)['then'](handleEntityNotFound(_0x1c47f7,null))[_0x5c37('0x2a')](respondWithResult(_0x1c47f7,null))['catch'](handleError(_0x1c47f7,null));};exports[_0x5c37('0x4f')]=function(_0x2a524e,_0x4e0444){return db['Dashboard']['create'](_0x2a524e[_0x5c37('0x50')],{})[_0x5c37('0x2a')](function(_0x2ef350){var _0x26b8eb=_0x2a524e['user']['get']({'plain':!![]});if(!_0x26b8eb)throw new Error(_0x5c37('0x51'));if(_0x26b8eb[_0x5c37('0x52')]===_0x5c37('0x53')){var _0x5ac4be=_0x2ef350[_0x5c37('0x54')]({'plain':!![]});var _0x25a194=_0x5c37('0x2b');return db[_0x5c37('0x55')]['find']({'where':{'name':_0x25a194,'userProfileId':_0x26b8eb[_0x5c37('0x56')]},'raw':!![]})[_0x5c37('0x2a')](function(_0x52f766){if(_0x52f766&&_0x52f766[_0x5c37('0x57')]===0x0){return db[_0x5c37('0x2c')]['create']({'name':_0x5ac4be[_0x5c37('0x30')],'resourceId':_0x5ac4be['id'],'type':_0x52f766[_0x5c37('0x30')],'sectionId':_0x52f766['id']},{})[_0x5c37('0x2a')](function(){return _0x2ef350;});}else{return _0x2ef350;}})['catch'](function(_0x48260d){logger['error'](_0x5c37('0x58'),_0x48260d);throw _0x48260d;});}return _0x2ef350;})[_0x5c37('0x2a')](respondWithResult(_0x4e0444,0xc9))[_0x5c37('0x4a')](handleError(_0x4e0444,null));};exports[_0x5c37('0x59')]=function(_0x47e5ed,_0x262c8d){var _0x525913={'where':{'id':_0x47e5ed[_0x5c37('0x4c')]['id']}},_0x3e5ddd={};_0x3e5ddd[_0x5c37('0x39')]=_[_0x5c37('0x4d')](db[_0x5c37('0x34')][_0x5c37('0x35')]);_0x525913['attributes']=_[_0x5c37('0x3c')](_0x3e5ddd['model'],qs[_0x5c37('0x3e')](_0x47e5ed[_0x5c37('0x3a')][_0x5c37('0x3e')]));_0x525913[_0x5c37('0x3d')]=_0x525913['attributes'][_0x5c37('0x5a')]?_0x525913[_0x5c37('0x3d')]:_0x3e5ddd[_0x5c37('0x39')];if(_0x47e5ed[_0x5c37('0x3a')][_0x5c37('0x47')]){_0x525913[_0x5c37('0x5b')]=[{'all':!![]}];}_0x525913=_[_0x5c37('0x44')]({},_0x525913,_0x47e5ed[_0x5c37('0x46')]);return db['Dashboard'][_0x5c37('0x4e')](_0x525913)['then'](handleEntityNotFound(_0x262c8d,null))[_0x5c37('0x2a')](function(_0x2c3b80){if(_0x2c3b80){var _0xc28e42=_0x2c3b80[_0x5c37('0x54')]({'plain':!![]});_0xc28e42=qs[_0x5c37('0x5c')](_0xc28e42,['id',_0x5c37('0x5d'),_0x5c37('0x5e')]);_0x47e5ed[_0x5c37('0x50')]=_['omit'](_0x47e5ed['body'],['id',_0x5c37('0x5d'),_0x5c37('0x5e')]);return db[_0x5c37('0x34')]['create'](_[_0x5c37('0x44')](_0xc28e42,_0x47e5ed['body']),{'include':_0x47e5ed[_0x5c37('0x3a')][_0x5c37('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8a783c){var _0xd9abf1=_0x47e5ed[_0x5c37('0x53')]['get']({'plain':!![]});if(!_0xd9abf1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd9abf1['role']===_0x5c37('0x53')){var _0x387866=_0x8a783c[_0x5c37('0x54')]({'plain':!![]});var _0x163250=_0x5c37('0x2b');return db['UserProfileSection'][_0x5c37('0x4e')]({'where':{'name':_0x163250,'userProfileId':_0xd9abf1[_0x5c37('0x56')]},'raw':!![]})[_0x5c37('0x2a')](function(_0x2c9935){if(_0x2c9935&&_0x2c9935[_0x5c37('0x57')]===0x0){return db[_0x5c37('0x2c')][_0x5c37('0x4f')]({'name':_0x387866[_0x5c37('0x30')],'resourceId':_0x387866['id'],'type':_0x2c9935[_0x5c37('0x30')],'sectionId':_0x2c9935['id']},{})[_0x5c37('0x2a')](function(){return _0x8a783c;});}else{return _0x8a783c;}})[_0x5c37('0x4a')](function(_0x266b8d){logger['error'](_0x5c37('0x58'),_0x266b8d);throw _0x266b8d;});}return _0x8a783c;});}})[_0x5c37('0x2a')](respondWithResult(_0x262c8d,0xc9))[_0x5c37('0x4a')](handleError(_0x262c8d,null));};exports[_0x5c37('0x5f')]=function(_0x128419,_0x35aa57){if(_0x128419[_0x5c37('0x50')]['id']){delete _0x128419[_0x5c37('0x50')]['id'];}return db[_0x5c37('0x34')][_0x5c37('0x4e')]({'where':{'id':_0x128419['params']['id']}})['then'](handleEntityNotFound(_0x35aa57,null))[_0x5c37('0x2a')](saveUpdates(_0x128419[_0x5c37('0x50')],null))[_0x5c37('0x2a')](respondWithResult(_0x35aa57,null))[_0x5c37('0x4a')](handleError(_0x35aa57,null));};exports['destroy']=function(_0x10c175,_0x272fe9){return db[_0x5c37('0x34')][_0x5c37('0x4e')]({'where':{'id':_0x10c175[_0x5c37('0x4c')]['id']}})['then'](handleEntityNotFound(_0x272fe9,null))[_0x5c37('0x2a')](removeEntity(_0x272fe9,null))['catch'](handleError(_0x272fe9,null));};function widgetAttributes(_0x517d5d){try{switch(_0x517d5d['type']){case _0x5c37('0x60'):return[{'name':_0x5c37('0x61'),'value':_0x517d5d[_0x5c37('0x61')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x0]?_0x517d5d[_0x5c37('0x62')][0x0][_0x5c37('0x63')]:undefined)||_0x5c37('0x64')}];case _0x5c37('0x65'):return[{'name':'attrPath','value':_0x517d5d['attrPath']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x0]?_0x517d5d['attrs'][0x0][_0x5c37('0x63')]:undefined)||''}];case _0x5c37('0x66'):return[{'name':_0x5c37('0x67'),'value':_0x517d5d[_0x5c37('0x67')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x0]?_0x517d5d[_0x5c37('0x62')][0x0][_0x5c37('0x63')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x517d5d['attrTimezone']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x1]?_0x517d5d['attrs'][0x1]['value']:undefined)||_0x5c37('0x68')},{'name':'attrFontSize','value':_0x517d5d['attrFontSize']||(_0x517d5d['attrs']&&_0x517d5d[_0x5c37('0x62')][0x2]?_0x517d5d[_0x5c37('0x62')][0x2]['value']:undefined)||0xc}];case _0x5c37('0x69'):return[{'name':_0x5c37('0x6a'),'value':_0x517d5d['attrMetric']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x0]?_0x517d5d['attrs'][0x0][_0x5c37('0x63')]:undefined)||_0x5c37('0x6b')},{'name':_0x5c37('0x6c'),'value':_0x517d5d[_0x5c37('0x6c')]||(_0x517d5d['attrs']&&_0x517d5d[_0x5c37('0x62')][0x1]?_0x517d5d[_0x5c37('0x62')][0x1]['value']:undefined)||[]},{'name':_0x5c37('0x6d'),'value':_0x517d5d[_0x5c37('0x6d')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x2]?_0x517d5d[_0x5c37('0x62')][0x2][_0x5c37('0x63')]:undefined)||0x14},{'name':_0x5c37('0x6e'),'value':_0x517d5d[_0x5c37('0x6e')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x3]?_0x517d5d[_0x5c37('0x62')][0x3][_0x5c37('0x63')]:undefined)||_0x5c37('0x6f')},{'name':'attrEmailAccounts','value':_0x517d5d[_0x5c37('0x70')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x4]?_0x517d5d[_0x5c37('0x62')][0x4][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x71'),'value':_0x517d5d['attrFaxAccounts']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x5]?_0x517d5d[_0x5c37('0x62')][0x5][_0x5c37('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x517d5d[_0x5c37('0x72')]||(_0x517d5d['attrs']&&_0x517d5d[_0x5c37('0x62')][0x6]?_0x517d5d[_0x5c37('0x62')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x517d5d[_0x5c37('0x73')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x7]?_0x517d5d[_0x5c37('0x62')][0x7][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x74'),'value':_0x517d5d['attrWhatsappAccounts']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x8]?_0x517d5d[_0x5c37('0x62')][0x8][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x75'),'value':_0x517d5d['attrChatWebsites']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x9]?_0x517d5d[_0x5c37('0x62')][0x9][_0x5c37('0x63')]:undefined)||''}];case _0x5c37('0x76'):case'pie-chart':return[{'name':_0x5c37('0x77'),'value':_0x517d5d[_0x5c37('0x77')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x0]?_0x517d5d['attrs'][0x0]['value']:undefined)||_0x5c37('0x6b')},{'name':'attrSerie2','value':_0x517d5d[_0x5c37('0x78')]||(_0x517d5d['attrs']&&_0x517d5d[_0x5c37('0x62')][0x1]?_0x517d5d['attrs'][0x1][_0x5c37('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0x517d5d['attrSerie3']||(_0x517d5d['attrs']&&_0x517d5d[_0x5c37('0x62')][0x2]?_0x517d5d[_0x5c37('0x62')][0x2][_0x5c37('0x63')]:undefined)||null},{'name':_0x5c37('0x6c'),'value':_0x517d5d[_0x5c37('0x6c')]||(_0x517d5d['attrs']&&_0x517d5d['attrs'][0x3]?_0x517d5d[_0x5c37('0x62')][0x3]['value']:undefined)||[]},{'name':_0x5c37('0x6e'),'value':_0x517d5d[_0x5c37('0x6e')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x4]?_0x517d5d[_0x5c37('0x62')][0x4][_0x5c37('0x63')]:undefined)||_0x5c37('0x6f')},{'name':_0x5c37('0x70'),'value':_0x517d5d[_0x5c37('0x70')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x5]?_0x517d5d[_0x5c37('0x62')][0x5][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x71'),'value':_0x517d5d[_0x5c37('0x71')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x6]?_0x517d5d['attrs'][0x6][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x72'),'value':_0x517d5d['attrSmsAccounts']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x7]?_0x517d5d['attrs'][0x7][_0x5c37('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x517d5d[_0x5c37('0x73')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x8]?_0x517d5d['attrs'][0x8][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x74'),'value':_0x517d5d[_0x5c37('0x74')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x9]?_0x517d5d[_0x5c37('0x62')][0x9][_0x5c37('0x63')]:undefined)||''},{'name':_0x5c37('0x75'),'value':_0x517d5d[_0x5c37('0x75')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0xa]?_0x517d5d[_0x5c37('0x62')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x5c37('0x79'),'type':_0x517d5d['reportType']||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x0]?_0x517d5d[_0x5c37('0x62')][0x0][_0x5c37('0x37')]:undefined)||null,'value':_0x517d5d[_0x5c37('0x79')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d[_0x5c37('0x62')][0x0]?_0x517d5d['attrs'][0x0][_0x5c37('0x63')]:undefined)||null},{'name':_0x5c37('0x7a'),'value':_0x517d5d[_0x5c37('0x7a')]||(_0x517d5d[_0x5c37('0x62')]&&_0x517d5d['attrs'][0x1]?_0x517d5d[_0x5c37('0x62')][0x1][_0x5c37('0x63')]:undefined)||0x0}];default:return[];}}catch(_0xf1e13c){logger[_0x5c37('0x2e')]('widgetAttributes:\x20%s',JSON[_0x5c37('0x7b')](_0xf1e13c));return[];}}exports['addItem']=function(_0x24463c,_0x1fa3b9,_0x1ebd38){if(_0x24463c[_0x5c37('0x50')]['id']){delete _0x24463c['body']['id'];}return db[_0x5c37('0x34')]['find']({'where':{'id':_0x24463c[_0x5c37('0x4c')]['id']}})[_0x5c37('0x2a')](handleEntityNotFound(_0x1fa3b9,null))['then'](function(_0x298a7c){if(_0x298a7c){_0x24463c['body'][_0x5c37('0x7c')]=_0x298a7c['id'];_0x24463c[_0x5c37('0x50')][_0x5c37('0x62')]=widgetAttributes(_0x24463c[_0x5c37('0x50')]);return db[_0x5c37('0x7d')][_0x5c37('0x4f')](_0x24463c[_0x5c37('0x50')]);}})[_0x5c37('0x2a')](respondWithResult(_0x1fa3b9,null))[_0x5c37('0x4a')](handleError(_0x1fa3b9,null));};exports[_0x5c37('0x7e')]=function(_0x5827f9,_0x46cf0b,_0x3eefc7){var _0x49a099={};var _0x357f3d={};var _0x112229;var _0x404a18;return db[_0x5c37('0x34')]['findOne']({'where':{'id':_0x5827f9['params']['id']}})[_0x5c37('0x2a')](handleEntityNotFound(_0x46cf0b,null))[_0x5c37('0x2a')](function(_0xecd439){if(_0xecd439){_0x112229=_0xecd439;_0x357f3d[_0x5c37('0x39')]=_[_0x5c37('0x4d')](db[_0x5c37('0x7d')]['rawAttributes']);_0x357f3d['query']=_[_0x5c37('0x4d')](_0x5827f9[_0x5c37('0x3a')]);_0x357f3d['filters']=_[_0x5c37('0x3c')](_0x357f3d[_0x5c37('0x39')],_0x357f3d[_0x5c37('0x3a')]);_0x49a099[_0x5c37('0x3d')]=_[_0x5c37('0x3c')](_0x357f3d[_0x5c37('0x39')],qs[_0x5c37('0x3e')](_0x5827f9['query'][_0x5c37('0x3e')]));_0x49a099[_0x5c37('0x3d')]=_0x49a099[_0x5c37('0x3d')][_0x5c37('0x5a')]?_0x49a099[_0x5c37('0x3d')]:_0x357f3d['model'];_0x49a099[_0x5c37('0x40')]=qs[_0x5c37('0x7f')](_0x5827f9['query'][_0x5c37('0x7f')]);_0x49a099[_0x5c37('0x41')]=qs[_0x5c37('0x3b')](_[_0x5c37('0x42')](_0x5827f9[_0x5c37('0x3a')],_0x357f3d[_0x5c37('0x3b')]));if(_0x5827f9[_0x5c37('0x3a')]['filter']){_0x49a099['where']=_['merge'](_0x49a099[_0x5c37('0x41')],{'$or':_[_0x5c37('0x33')](_0x49a099['attributes'],function(_0x35c771){var _0x3779d6={};_0x3779d6[_0x35c771]={'$like':'%'+_0x5827f9[_0x5c37('0x3a')][_0x5c37('0x43')]+'%'};return _0x3779d6;})});}_0x49a099=_[_0x5c37('0x44')]({},_0x49a099,_0x5827f9[_0x5c37('0x46')]);return _0x112229[_0x5c37('0x7e')](_0x49a099);}})[_0x5c37('0x2a')](function(_0x237225){if(_0x237225){_0x404a18=_0x237225['length'];if(!_0x5827f9[_0x5c37('0x3a')][_0x5c37('0x3f')](_0x5c37('0x80'))){_0x49a099[_0x5c37('0x22')]=qs[_0x5c37('0x22')](_0x5827f9[_0x5c37('0x3a')]['limit']);_0x49a099[_0x5c37('0x21')]=qs[_0x5c37('0x21')](_0x5827f9[_0x5c37('0x3a')][_0x5c37('0x21')]);}return _0x112229[_0x5c37('0x7e')](_0x49a099);}})[_0x5c37('0x2a')](function(_0x41ab19){if(_0x41ab19){return _0x41ab19?{'count':_0x404a18,'rows':_0x41ab19}:null;}})[_0x5c37('0x2a')](respondWithResult(_0x46cf0b,null))[_0x5c37('0x4a')](handleError(_0x46cf0b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5acc934..5073af1 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 _0xe08b=['events','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe08b,0x10e));var _0xbe08=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xe08b[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0xbe08('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbe08('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbe08('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe08('0x3'),'afterDestroy':_0xbe08('0x4')};function emitEvent(_0x27b8f8){return function(_0x469522,_0x41edfb,_0x1ba7e6){DashboardEvents[_0xbe08('0x5')](_0x27b8f8+':'+_0x469522['id'],_0x469522);DashboardEvents[_0xbe08('0x5')](_0x27b8f8,_0x469522);_0x1ba7e6(null);};}for(var e in events){if(events[_0xbe08('0x6')](e)){var event=events[e];Dashboard[_0xbe08('0x7')](e,emitEvent(event));}}module[_0xbe08('0x8')]=DashboardEvents; \ No newline at end of file +var _0xc1d3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x57c701,_0x18ee4d){var _0xd624f1=function(_0x1231c5){while(--_0x1231c5){_0x57c701['push'](_0x57c701['shift']());}};_0xd624f1(++_0x18ee4d);}(_0xc1d3,0x147));var _0x3c1d=function(_0x505942,_0x1db575){_0x505942=_0x505942-0x0;var _0x5dd4af=_0xc1d3[_0x505942];return _0x5dd4af;};'use strict';var EventEmitter=require(_0x3c1d('0x0'));var Dashboard=require(_0x3c1d('0x1'))['db'][_0x3c1d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3c1d('0x3')](0x0);var events={'afterCreate':_0x3c1d('0x4'),'afterUpdate':_0x3c1d('0x5'),'afterDestroy':_0x3c1d('0x6')};function emitEvent(_0x555102){return function(_0x492440,_0x280eb3,_0x25cdae){DashboardEvents[_0x3c1d('0x7')](_0x555102+':'+_0x492440['id'],_0x492440);DashboardEvents['emit'](_0x555102,_0x492440);_0x25cdae(null);};}for(var e in events){if(events[_0x3c1d('0x8')](e)){var event=events[e];Dashboard[_0x3c1d('0x9')](e,emitEvent(event));}}module[_0x3c1d('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 9fc48dc..614787b 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 _0xce25=['path','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','../../config/logger','request-promise'];(function(_0x562785,_0x15c245){var _0x4ac95a=function(_0x4832b7){while(--_0x4832b7){_0x562785['push'](_0x562785['shift']());}};_0x4ac95a(++_0x15c245);}(_0xce25,0x196));var _0x5ce2=function(_0x574c51,_0x17628b){_0x574c51=_0x574c51-0x0;var _0x233481=_0xce25[_0x574c51];return _0x233481;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5ce2('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ce2('0x1'));var fs=require('fs');var path=require(_0x5ce2('0x2'));var rimraf=require('rimraf');var config=require(_0x5ce2('0x3'));var attributes=require(_0x5ce2('0x4'));module['exports']=function(_0x57a7a5,_0x41fb85){return _0x57a7a5[_0x5ce2('0x5')](_0x5ce2('0x6'),attributes,{'tableName':_0x5ce2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa415=['dashboards','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0xa415,0x121));var _0x5a41=function(_0x626c4b,_0x5becc7){_0x626c4b=_0x626c4b-0x0;var _0x68d101=_0xa415[_0x626c4b];return _0x68d101;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5a41('0x0'))(_0x5a41('0x1'));var moment=require(_0x5a41('0x2'));var BPromise=require(_0x5a41('0x3'));var rp=require(_0x5a41('0x4'));var fs=require('fs');var path=require(_0x5a41('0x5'));var rimraf=require(_0x5a41('0x6'));var config=require(_0x5a41('0x7'));var attributes=require(_0x5a41('0x8'));module[_0x5a41('0x9')]=function(_0xac23a2,_0x3fd9f1){return _0xac23a2['define'](_0x5a41('0xa'),attributes,{'tableName':_0x5a41('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 094b253..56c9e6d 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 _0x3d74=['message','info','result','catch','lodash','moment','bluebird','randomstring','rpc','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x3d74,0x1e8));var _0x43d7=function(_0x3504e9,_0x334180){_0x3504e9=_0x3504e9-0x0;var _0x1b4d74=_0x3d74[_0x3504e9];return _0x1b4d74;};'use strict';var _=require(_0x43d7('0x0'));var util=require('util');var moment=require(_0x43d7('0x1'));var BPromise=require(_0x43d7('0x2'));var rs=require(_0x43d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x43d7('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x43d7('0x5')]({'port':0x232a});config[_0x43d7('0x6')]=_[_0x43d7('0x7')](config['redis'],{'host':_0x43d7('0x8'),'port':0x18eb});var socket=require(_0x43d7('0x9'))(new Redis(config[_0x43d7('0x6')]));require(_0x43d7('0xa'))['register'](socket);function respondWithRpcPromise(_0x38b7f1,_0x1ed35a,_0x53fc1c){return new BPromise(function(_0x376721,_0x201a4d){return client[_0x43d7('0xb')](_0x38b7f1,_0x53fc1c)['then'](function(_0x56fe35){logger['info'](_0x43d7('0xc'),_0x1ed35a,'request\x20sent');logger[_0x43d7('0xd')](_0x43d7('0xe'),_0x1ed35a,_0x43d7('0xf'),JSON['stringify'](_0x56fe35));if(_0x56fe35[_0x43d7('0x10')]){if(_0x56fe35[_0x43d7('0x10')][_0x43d7('0x11')]===0x1f4){logger[_0x43d7('0x10')](_0x43d7('0xc'),_0x1ed35a,_0x56fe35[_0x43d7('0x10')][_0x43d7('0x12')]);return _0x201a4d(_0x56fe35[_0x43d7('0x10')]['message']);}logger[_0x43d7('0x10')](_0x43d7('0xc'),_0x1ed35a,_0x56fe35['error']['message']);return _0x376721(_0x56fe35['error']['message']);}else{logger[_0x43d7('0x13')](_0x43d7('0xc'),_0x1ed35a,_0x43d7('0xf'));_0x376721(_0x56fe35[_0x43d7('0x14')][_0x43d7('0x12')]);}})[_0x43d7('0x15')](function(_0x5b2bc5){logger['error'](_0x43d7('0xc'),_0x1ed35a,_0x5b2bc5);_0x201a4d(_0x5b2bc5);});});} \ No newline at end of file +var _0xbb48=['rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x29e428,_0x5469a6){var _0xe6ba2f=function(_0x5e95b7){while(--_0x5e95b7){_0x29e428['push'](_0x29e428['shift']());}};_0xe6ba2f(++_0x5469a6);}(_0xbb48,0xbd));var _0x8bb4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbb48[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x8bb4('0x0'));var util=require('util');var moment=require(_0x8bb4('0x1'));var BPromise=require(_0x8bb4('0x2'));var rs=require(_0x8bb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bb4('0x4'))['db'];var utils=require(_0x8bb4('0x5'));var logger=require(_0x8bb4('0x6'))(_0x8bb4('0x7'));var config=require(_0x8bb4('0x8'));var jayson=require(_0x8bb4('0x9'));var client=jayson[_0x8bb4('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8bb4('0xb')](config[_0x8bb4('0xc')],{'host':_0x8bb4('0xd'),'port':0x18eb});var socket=require(_0x8bb4('0xe'))(new Redis(config[_0x8bb4('0xc')]));require('./dashboard.socket')[_0x8bb4('0xf')](socket);function respondWithRpcPromise(_0x1e74af,_0x56d6aa,_0x52e8f1){return new BPromise(function(_0x397a19,_0x2e53f5){return client[_0x8bb4('0x10')](_0x1e74af,_0x52e8f1)[_0x8bb4('0x11')](function(_0x2a69f0){logger[_0x8bb4('0x12')](_0x8bb4('0x13'),_0x56d6aa,_0x8bb4('0x14'));logger[_0x8bb4('0x15')](_0x8bb4('0x16'),_0x56d6aa,_0x8bb4('0x14'),JSON['stringify'](_0x2a69f0));if(_0x2a69f0[_0x8bb4('0x17')]){if(_0x2a69f0[_0x8bb4('0x17')][_0x8bb4('0x18')]===0x1f4){logger[_0x8bb4('0x17')](_0x8bb4('0x13'),_0x56d6aa,_0x2a69f0[_0x8bb4('0x17')][_0x8bb4('0x19')]);return _0x2e53f5(_0x2a69f0[_0x8bb4('0x17')]['message']);}logger[_0x8bb4('0x17')](_0x8bb4('0x13'),_0x56d6aa,_0x2a69f0[_0x8bb4('0x17')][_0x8bb4('0x19')]);return _0x397a19(_0x2a69f0[_0x8bb4('0x17')]['message']);}else{logger[_0x8bb4('0x12')](_0x8bb4('0x13'),_0x56d6aa,_0x8bb4('0x14'));_0x397a19(_0x2a69f0[_0x8bb4('0x1a')]['message']);}})[_0x8bb4('0x1b')](function(_0x33d8c0){logger[_0x8bb4('0x17')](_0x8bb4('0x13'),_0x56d6aa,_0x33d8c0);_0x2e53f5(_0x33d8c0);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8a862ab..3b4ef0b 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 _0xeb23=['removeListener','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeb23,0x1d0));var _0x3eb2=function(_0x3ed7af,_0x13f8ca){_0x3ed7af=_0x3ed7af-0x0;var _0x3cc1ac=_0xeb23[_0x3ed7af];return _0x3cc1ac;};'use strict';var DashboardEvents=require(_0x3eb2('0x0'));var events=[_0x3eb2('0x1'),_0x3eb2('0x2'),_0x3eb2('0x3')];function createListener(_0x3719f2,_0x5b535a){return function(_0x5db4ba){_0x5b535a[_0x3eb2('0x4')](_0x3719f2,_0x5db4ba);};}function removeListener(_0x4deffc,_0x4feaa2){return function(){DashboardEvents[_0x3eb2('0x5')](_0x4deffc,_0x4feaa2);};}exports['register']=function(_0x62c0d2){for(var _0x161e72=0x0,_0x261b36=events['length'];_0x161e72<_0x261b36;_0x161e72++){var _0x40f277=events[_0x161e72];var _0x3dee2f=createListener(_0x3eb2('0x6')+_0x40f277,_0x62c0d2);DashboardEvents['on'](_0x40f277,_0x3dee2f);}}; \ No newline at end of file +var _0xcaec=['remove','update','emit','removeListener','register','./dashboard.events'];(function(_0x8461e0,_0x999f9d){var _0x2a8854=function(_0x51c74a){while(--_0x51c74a){_0x8461e0['push'](_0x8461e0['shift']());}};_0x2a8854(++_0x999f9d);}(_0xcaec,0x173));var _0xccae=function(_0x3fef19,_0x12bd0e){_0x3fef19=_0x3fef19-0x0;var _0x28fe22=_0xcaec[_0x3fef19];return _0x28fe22;};'use strict';var DashboardEvents=require(_0xccae('0x0'));var events=['save',_0xccae('0x1'),_0xccae('0x2')];function createListener(_0x2e4083,_0x1266e8){return function(_0xa84ef8){_0x1266e8[_0xccae('0x3')](_0x2e4083,_0xa84ef8);};}function removeListener(_0x18563f,_0x3a8ae1){return function(){DashboardEvents[_0xccae('0x4')](_0x18563f,_0x3a8ae1);};}exports[_0xccae('0x5')]=function(_0x401ecd){for(var _0x48d2e9=0x0,_0x5e7e01=events['length'];_0x48d2e9<_0x5e7e01;_0x48d2e9++){var _0x5815f9=events[_0x48d2e9];var _0x28c74a=createListener('dashboard:'+_0x5815f9,_0x401ecd);DashboardEvents['on'](_0x5815f9,_0x28c74a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index fcb0a30..8ff0cff 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 _0xc8a1=['clone','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/items','getItems','post'];(function(_0xee1228,_0x2df586){var _0x210f17=function(_0x5b4d31){while(--_0x5b4d31){_0xee1228['push'](_0xee1228['shift']());}};_0x210f17(++_0x2df586);}(_0xc8a1,0x1ea));var _0x1c8a=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xc8a1[_0x4394b6];return _0x360244;};'use strict';var multer=require(_0x1c8a('0x0'));var util=require(_0x1c8a('0x1'));var path=require(_0x1c8a('0x2'));var timeout=require(_0x1c8a('0x3'));var express=require(_0x1c8a('0x4'));var router=express['Router']();var fs_extra=require(_0x1c8a('0x5'));var auth=require(_0x1c8a('0x6'));var interaction=require(_0x1c8a('0x7'));var config=require(_0x1c8a('0x8'));var controller=require('./dashboard.controller');router[_0x1c8a('0x9')]('/',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0xb')]);router[_0x1c8a('0x9')](_0x1c8a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1c8a('0x9')](_0x1c8a('0xd'),auth[_0x1c8a('0xa')](),controller[_0x1c8a('0xe')]);router[_0x1c8a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1c8a('0xf')]('/:id/clone',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x10')]);router[_0x1c8a('0xf')]('/:id/items',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x11')]);router[_0x1c8a('0x12')](_0x1c8a('0xc'),auth[_0x1c8a('0xa')](),controller['update']);router[_0x1c8a('0x13')](_0x1c8a('0xc'),auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x14')]);module[_0x1c8a('0x15')]=router; \ No newline at end of file +var _0xec9d=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xec9d,0x76));var _0xdec9=function(_0xd9b032,_0x37af18){_0xd9b032=_0xd9b032-0x0;var _0x550b42=_0xec9d[_0xd9b032];return _0x550b42;};'use strict';var multer=require('multer');var util=require(_0xdec9('0x0'));var path=require(_0xdec9('0x1'));var timeout=require(_0xdec9('0x2'));var express=require(_0xdec9('0x3'));var router=express[_0xdec9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdec9('0x5'));var interaction=require(_0xdec9('0x6'));var config=require(_0xdec9('0x7'));var controller=require(_0xdec9('0x8'));router[_0xdec9('0x9')]('/',auth[_0xdec9('0xa')](),controller[_0xdec9('0xb')]);router[_0xdec9('0x9')](_0xdec9('0xc'),auth[_0xdec9('0xa')](),controller[_0xdec9('0xd')]);router[_0xdec9('0x9')](_0xdec9('0xe'),auth[_0xdec9('0xa')](),controller[_0xdec9('0xf')]);router[_0xdec9('0x10')]('/',auth[_0xdec9('0xa')](),controller[_0xdec9('0x11')]);router[_0xdec9('0x10')](_0xdec9('0x12'),auth[_0xdec9('0xa')](),controller['clone']);router[_0xdec9('0x10')](_0xdec9('0xe'),auth[_0xdec9('0xa')](),controller[_0xdec9('0x13')]);router['put'](_0xdec9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xdec9('0x14')](_0xdec9('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2116f61..52e1fdf 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 _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x527176,_0x4deb09){var _0x29312f=function(_0x212cfe){while(--_0x212cfe){_0x527176['push'](_0x527176['shift']());}};_0x29312f(++_0x4deb09);}(_0x6f47,0xc7));var _0x76f4=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x6f47[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x966c03,_0x283d91){var _0x419b38=function(_0x3d755a){while(--_0x3d755a){_0x966c03['push'](_0x966c03['shift']());}};_0x419b38(++_0x283d91);}(_0x2eb2,0x19f));var _0x22eb=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x2eb2[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('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 3e80e12..1164141 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 _0x1751=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','length','include','merge','options','find','destroy','type','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'];(function(_0x110aa3,_0x56cb2c){var _0x23a446=function(_0x4c7ad4){while(--_0x4c7ad4){_0x110aa3['push'](_0x110aa3['shift']());}};_0x23a446(++_0x56cb2c);}(_0x1751,0x76));var _0x1175=function(_0xaf7c,_0x5a7953){_0xaf7c=_0xaf7c-0x0;var _0x3178a7=_0x1751[_0xaf7c];return _0x3178a7;};'use strict';var emlformat=require(_0x1175('0x0'));var rimraf=require(_0x1175('0x1'));var zipdir=require(_0x1175('0x2'));var jsonpatch=require(_0x1175('0x3'));var rp=require('request-promise');var moment=require(_0x1175('0x4'));var BPromise=require(_0x1175('0x5'));var Mustache=require(_0x1175('0x6'));var util=require(_0x1175('0x7'));var path=require(_0x1175('0x8'));var sox=require(_0x1175('0x9'));var csv=require(_0x1175('0xa'));var ejs=require(_0x1175('0xb'));var fs=require('fs');var fs_extra=require(_0x1175('0xc'));var _=require(_0x1175('0xd'));var squel=require(_0x1175('0xe'));var crypto=require(_0x1175('0xf'));var jsforce=require(_0x1175('0x10'));var deskjs=require(_0x1175('0x11'));var toCsv=require(_0x1175('0xa'));var querystring=require(_0x1175('0x12'));var Papa=require(_0x1175('0x13'));var Redis=require(_0x1175('0x14'));var authService=require(_0x1175('0x15'));var qs=require(_0x1175('0x16'));var as=require(_0x1175('0x17'));var hardwareService=require(_0x1175('0x18'));var logger=require(_0x1175('0x19'))(_0x1175('0x1a'));var utils=require(_0x1175('0x1b'));var config=require(_0x1175('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1175('0x1d')]=_[_0x1175('0x1e')](config['redis'],{'host':_0x1175('0x1f'),'port':0x18eb});var socket=require(_0x1175('0x20'))(new Redis(config[_0x1175('0x1d')]));require('./dashboardItem.socket')[_0x1175('0x21')](socket);function respondWithStatusCode(_0x42671f,_0x16979a){_0x16979a=_0x16979a||0xcc;return function(_0x57cea4){if(_0x57cea4){return _0x42671f[_0x1175('0x22')](_0x16979a);}return _0x42671f['status'](_0x16979a)[_0x1175('0x23')]();};}function respondWithResult(_0x43b6b1,_0x2a9bc4){_0x2a9bc4=_0x2a9bc4||0xc8;return function(_0x2585be){if(_0x2585be){return _0x43b6b1['status'](_0x2a9bc4)[_0x1175('0x24')](_0x2585be);}};}function respondWithFilteredResult(_0xaa45d,_0x5e64c5){return function(_0x50e563){if(_0x50e563){var _0x40b685=typeof _0x5e64c5[_0x1175('0x25')]===_0x1175('0x26')&&typeof _0x5e64c5[_0x1175('0x27')]===_0x1175('0x26');var _0x59b5b8=_0x50e563[_0x1175('0x28')];var _0x3ae698=_0x40b685?0x0:_0x5e64c5[_0x1175('0x25')];var _0x345468=_0x40b685?_0x50e563[_0x1175('0x28')]:_0x5e64c5[_0x1175('0x25')]+_0x5e64c5['limit'];var _0x5e2334;if(_0x345468>=_0x59b5b8){_0x345468=_0x59b5b8;_0x5e2334=0xc8;}else{_0x5e2334=0xce;}_0xaa45d[_0x1175('0x29')](_0x5e2334);return _0xaa45d[_0x1175('0x2a')](_0x1175('0x2b'),_0x3ae698+'-'+_0x345468+'/'+_0x59b5b8)[_0x1175('0x24')](_0x50e563);}return null;};}function patchUpdates(_0x4542c7){return function(_0x1accd1){try{jsonpatch[_0x1175('0x2c')](_0x1accd1,_0x4542c7,!![]);}catch(_0x4bd6cd){return BPromise[_0x1175('0x2d')](_0x4bd6cd);}return _0x1accd1[_0x1175('0x2e')]();};}function saveUpdates(_0x15d346,_0x18e59a){return function(_0x28b5e0){if(_0x28b5e0){return _0x28b5e0[_0x1175('0x2f')](_0x15d346)[_0x1175('0x30')](function(_0x5a3dc9){return _0x5a3dc9;});}return null;};}function removeEntity(_0x9d3b8,_0x383ba5){return function(_0x38cf17){if(_0x38cf17){return _0x38cf17['destroy']()['then'](function(){_0x9d3b8['status'](0xcc)[_0x1175('0x23')]();});}};}function handleEntityNotFound(_0x2e4682,_0x3fd476){return function(_0x5e4ac6){if(!_0x5e4ac6){_0x2e4682['sendStatus'](0x194);}return _0x5e4ac6;};}function handleError(_0x5c590e,_0x514c71){_0x514c71=_0x514c71||0x1f4;return function(_0x3abc9c){logger[_0x1175('0x31')](_0x3abc9c[_0x1175('0x32')]);if(_0x3abc9c[_0x1175('0x33')]){delete _0x3abc9c['name'];}_0x5c590e['status'](_0x514c71)[_0x1175('0x34')](_0x3abc9c);};}exports[_0x1175('0x35')]=function(_0x57f7a8,_0x565c20){var _0x5b6bfb={'raw':![],'where':{'id':_0x57f7a8[_0x1175('0x36')]['id']}},_0x4234c6={};_0x4234c6['model']=_[_0x1175('0x37')](db[_0x1175('0x38')][_0x1175('0x39')]);_0x4234c6[_0x1175('0x3a')]=_[_0x1175('0x37')](_0x57f7a8[_0x1175('0x3a')]);_0x4234c6['filters']=_[_0x1175('0x3b')](_0x4234c6[_0x1175('0x3c')],_0x4234c6[_0x1175('0x3a')]);_0x5b6bfb[_0x1175('0x3d')]=_['intersection'](_0x4234c6[_0x1175('0x3c')],qs['fields'](_0x57f7a8[_0x1175('0x3a')][_0x1175('0x3e')]));_0x5b6bfb[_0x1175('0x3d')]=_0x5b6bfb[_0x1175('0x3d')][_0x1175('0x3f')]?_0x5b6bfb[_0x1175('0x3d')]:_0x4234c6['model'];if(_0x57f7a8['query']['includeAll']){_0x5b6bfb[_0x1175('0x40')]=[{'all':!![]}];}_0x5b6bfb=_[_0x1175('0x41')]({},_0x5b6bfb,_0x57f7a8[_0x1175('0x42')]);return db[_0x1175('0x38')][_0x1175('0x43')](_0x5b6bfb)[_0x1175('0x30')](handleEntityNotFound(_0x565c20,null))['then'](respondWithResult(_0x565c20,null))['catch'](handleError(_0x565c20,null));};exports[_0x1175('0x44')]=function(_0x325cb7,_0x203afa){return db['DashboardItem'][_0x1175('0x43')]({'where':{'id':_0x325cb7[_0x1175('0x36')]['id']}})[_0x1175('0x30')](handleEntityNotFound(_0x203afa,null))['then'](removeEntity(_0x203afa,null))['catch'](handleError(_0x203afa,null));};function widgetAttributes(_0x57650d){try{switch(_0x57650d[_0x1175('0x45')]){case'iframe':return[{'name':_0x1175('0x46'),'value':_0x57650d[_0x1175('0x46')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x49')}];case _0x1175('0x4a'):return[{'name':_0x1175('0x4b'),'value':_0x57650d[_0x1175('0x4b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||''}];case _0x1175('0x4c'):return[{'name':_0x1175('0x4d'),'value':_0x57650d['attrHourFormat']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0]['value']:undefined)||_0x1175('0x4e')},{'name':_0x1175('0x4f'),'value':_0x57650d[_0x1175('0x4f')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d['attrs'][0x1][_0x1175('0x48')]:undefined)||_0x1175('0x50')},{'name':_0x1175('0x51'),'value':_0x57650d[_0x1175('0x51')]||(_0x57650d['attrs']&&_0x57650d[_0x1175('0x47')][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||0xc}];case'counter':return[{'name':_0x1175('0x52'),'value':_0x57650d['attrMetric']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x53')},{'name':_0x1175('0x54'),'value':_0x57650d[_0x1175('0x54')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d[_0x1175('0x47')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x57650d[_0x1175('0x51')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||0x14},{'name':'attrChannel','value':_0x57650d[_0x1175('0x55')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x3]?_0x57650d[_0x1175('0x47')][0x3][_0x1175('0x48')]:undefined)||_0x1175('0x56')},{'name':_0x1175('0x57'),'value':_0x57650d[_0x1175('0x57')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x4]?_0x57650d[_0x1175('0x47')][0x4][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x58'),'value':_0x57650d[_0x1175('0x58')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x5]?_0x57650d[_0x1175('0x47')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x57650d[_0x1175('0x59')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x6]?_0x57650d['attrs'][0x6][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5a'),'value':_0x57650d[_0x1175('0x5a')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x7]?_0x57650d[_0x1175('0x47')][0x7]['value']:undefined)||''},{'name':_0x1175('0x5b'),'value':_0x57650d[_0x1175('0x5b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x8]?_0x57650d[_0x1175('0x47')][0x8][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5c'),'value':_0x57650d[_0x1175('0x5c')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x9]?_0x57650d['attrs'][0x9][_0x1175('0x48')]:undefined)||''}];case _0x1175('0x5d'):case _0x1175('0x5e'):return[{'name':_0x1175('0x5f'),'value':_0x57650d['attrSerie1']||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x0]?_0x57650d['attrs'][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x53')},{'name':_0x1175('0x60'),'value':_0x57650d['attrSerie2']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d[_0x1175('0x47')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x57650d[_0x1175('0x61')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||null},{'name':_0x1175('0x54'),'value':_0x57650d[_0x1175('0x54')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x3]?_0x57650d[_0x1175('0x47')][0x3][_0x1175('0x48')]:undefined)||[]},{'name':_0x1175('0x55'),'value':_0x57650d['attrChannel']||(_0x57650d['attrs']&&_0x57650d[_0x1175('0x47')][0x4]?_0x57650d[_0x1175('0x47')][0x4]['value']:undefined)||_0x1175('0x56')},{'name':'attrEmailAccounts','value':_0x57650d['attrEmailAccounts']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x5]?_0x57650d[_0x1175('0x47')][0x5][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x58'),'value':_0x57650d['attrFaxAccounts']||(_0x57650d['attrs']&&_0x57650d['attrs'][0x6]?_0x57650d['attrs'][0x6][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x59'),'value':_0x57650d['attrSmsAccounts']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x7]?_0x57650d[_0x1175('0x47')][0x7][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5a'),'value':_0x57650d[_0x1175('0x5a')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x8]?_0x57650d[_0x1175('0x47')][0x8][_0x1175('0x48')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x57650d[_0x1175('0x5b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x9]?_0x57650d[_0x1175('0x47')][0x9][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5c'),'value':_0x57650d[_0x1175('0x5c')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0xa]?_0x57650d[_0x1175('0x47')][0xa]['value']:undefined)||''}];case _0x1175('0x62'):return[{'name':_0x1175('0x63'),'type':_0x57650d['reportType']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x45')]:undefined)||null,'value':_0x57650d[_0x1175('0x63')]||(_0x57650d['attrs']&&_0x57650d['attrs'][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||null},{'name':'attrRefresh','value':_0x57650d[_0x1175('0x64')]||(_0x57650d['attrs']&&_0x57650d['attrs'][0x1]?_0x57650d[_0x1175('0x47')][0x1][_0x1175('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x4857b8){logger[_0x1175('0x31')](_0x1175('0x65'),JSON[_0x1175('0x66')](_0x4857b8));return[];}}exports[_0x1175('0x67')]=function(_0x3f3a7,_0x2ed1ef){if(_0x3f3a7[_0x1175('0x68')]){_0x3f3a7[_0x1175('0x68')]['attrs']=widgetAttributes(_0x3f3a7['body']);}return db[_0x1175('0x38')]['create'](_0x3f3a7[_0x1175('0x68')],{})[_0x1175('0x30')](respondWithResult(_0x2ed1ef,0xc9))[_0x1175('0x69')](handleError(_0x2ed1ef,null));};exports['update']=function(_0x446abe,_0x4dc426){if(_0x446abe['body']['id']){delete _0x446abe[_0x1175('0x68')]['id'];}_0x446abe[_0x1175('0x68')][_0x1175('0x47')]=widgetAttributes(_0x446abe[_0x1175('0x68')]);return db['DashboardItem']['find']({'where':{'id':_0x446abe[_0x1175('0x36')]['id']}})[_0x1175('0x30')](handleEntityNotFound(_0x4dc426,null))['then'](saveUpdates(_0x446abe[_0x1175('0x68')],null))['then'](respondWithResult(_0x4dc426,null))[_0x1175('0x69')](handleError(_0x4dc426,null));}; \ No newline at end of file +var _0x287e=['attrEmailAccounts','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','body','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','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','socket.io-emitter','./dashboardItem.socket','register','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','stack','name','show','params','model','DashboardItem','rawAttributes','query','keys','filters','attributes','fields','length','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x133f4c,_0x1ab854){var _0x5de610=function(_0x55bcff){while(--_0x55bcff){_0x133f4c['push'](_0x133f4c['shift']());}};_0x5de610(++_0x1ab854);}(_0x287e,0x1e3));var _0xe287=function(_0x163856,_0x541e5f){_0x163856=_0x163856-0x0;var _0x40742d=_0x287e[_0x163856];return _0x40742d;};'use strict';var emlformat=require(_0xe287('0x0'));var rimraf=require(_0xe287('0x1'));var zipdir=require(_0xe287('0x2'));var jsonpatch=require(_0xe287('0x3'));var rp=require(_0xe287('0x4'));var moment=require(_0xe287('0x5'));var BPromise=require(_0xe287('0x6'));var Mustache=require(_0xe287('0x7'));var util=require(_0xe287('0x8'));var path=require('path');var sox=require(_0xe287('0x9'));var csv=require(_0xe287('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe287('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe287('0xc'));var toCsv=require(_0xe287('0xa'));var querystring=require(_0xe287('0xd'));var Papa=require(_0xe287('0xe'));var Redis=require(_0xe287('0xf'));var authService=require(_0xe287('0x10'));var qs=require(_0xe287('0x11'));var as=require(_0xe287('0x12'));var hardwareService=require(_0xe287('0x13'));var logger=require(_0xe287('0x14'))(_0xe287('0x15'));var utils=require(_0xe287('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe287('0x17'));var db=require('../../mysqldb')['db'];config[_0xe287('0x18')]=_['defaults'](config[_0xe287('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe287('0x19'))(new Redis(config[_0xe287('0x18')]));require(_0xe287('0x1a'))[_0xe287('0x1b')](socket);function respondWithStatusCode(_0x279281,_0x497f73){_0x497f73=_0x497f73||0xcc;return function(_0x298641){if(_0x298641){return _0x279281['sendStatus'](_0x497f73);}return _0x279281[_0xe287('0x1c')](_0x497f73)[_0xe287('0x1d')]();};}function respondWithResult(_0x5c1dea,_0x336ff3){_0x336ff3=_0x336ff3||0xc8;return function(_0x5053e0){if(_0x5053e0){return _0x5c1dea['status'](_0x336ff3)[_0xe287('0x1e')](_0x5053e0);}};}function respondWithFilteredResult(_0x31370b,_0x2f27a5){return function(_0x5ece64){if(_0x5ece64){var _0x2c4ef3=typeof _0x2f27a5['offset']==='undefined'&&typeof _0x2f27a5[_0xe287('0x1f')]===_0xe287('0x20');var _0x58ca20=_0x5ece64[_0xe287('0x21')];var _0x509877=_0x2c4ef3?0x0:_0x2f27a5[_0xe287('0x22')];var _0x219b2f=_0x2c4ef3?_0x5ece64[_0xe287('0x21')]:_0x2f27a5['offset']+_0x2f27a5[_0xe287('0x1f')];var _0x477a45;if(_0x219b2f>=_0x58ca20){_0x219b2f=_0x58ca20;_0x477a45=0xc8;}else{_0x477a45=0xce;}_0x31370b[_0xe287('0x1c')](_0x477a45);return _0x31370b[_0xe287('0x23')](_0xe287('0x24'),_0x509877+'-'+_0x219b2f+'/'+_0x58ca20)[_0xe287('0x1e')](_0x5ece64);}return null;};}function patchUpdates(_0x3e971a){return function(_0x496076){try{jsonpatch['apply'](_0x496076,_0x3e971a,!![]);}catch(_0x41288c){return BPromise[_0xe287('0x25')](_0x41288c);}return _0x496076['save']();};}function saveUpdates(_0x76665f,_0x4da623){return function(_0x1d5e88){if(_0x1d5e88){return _0x1d5e88[_0xe287('0x26')](_0x76665f)[_0xe287('0x27')](function(_0x4ff2ee){return _0x4ff2ee;});}return null;};}function removeEntity(_0x58f4f1,_0x21b1aa){return function(_0x244e8a){if(_0x244e8a){return _0x244e8a[_0xe287('0x28')]()[_0xe287('0x27')](function(){_0x58f4f1[_0xe287('0x1c')](0xcc)[_0xe287('0x1d')]();});}};}function handleEntityNotFound(_0x34549e,_0x17fda2){return function(_0x55c97a){if(!_0x55c97a){_0x34549e[_0xe287('0x29')](0x194);}return _0x55c97a;};}function handleError(_0x5499e2,_0x34d583){_0x34d583=_0x34d583||0x1f4;return function(_0x220175){logger['error'](_0x220175[_0xe287('0x2a')]);if(_0x220175[_0xe287('0x2b')]){delete _0x220175[_0xe287('0x2b')];}_0x5499e2[_0xe287('0x1c')](_0x34d583)['send'](_0x220175);};}exports[_0xe287('0x2c')]=function(_0x7e8dd8,_0x46e4e4){var _0x5c93b8={'raw':![],'where':{'id':_0x7e8dd8[_0xe287('0x2d')]['id']}},_0x811e53={};_0x811e53[_0xe287('0x2e')]=_['keys'](db[_0xe287('0x2f')][_0xe287('0x30')]);_0x811e53[_0xe287('0x31')]=_[_0xe287('0x32')](_0x7e8dd8[_0xe287('0x31')]);_0x811e53[_0xe287('0x33')]=_['intersection'](_0x811e53[_0xe287('0x2e')],_0x811e53['query']);_0x5c93b8[_0xe287('0x34')]=_['intersection'](_0x811e53[_0xe287('0x2e')],qs[_0xe287('0x35')](_0x7e8dd8[_0xe287('0x31')][_0xe287('0x35')]));_0x5c93b8['attributes']=_0x5c93b8['attributes'][_0xe287('0x36')]?_0x5c93b8[_0xe287('0x34')]:_0x811e53['model'];if(_0x7e8dd8['query']['includeAll']){_0x5c93b8['include']=[{'all':!![]}];}_0x5c93b8=_['merge']({},_0x5c93b8,_0x7e8dd8[_0xe287('0x37')]);return db[_0xe287('0x2f')][_0xe287('0x38')](_0x5c93b8)[_0xe287('0x27')](handleEntityNotFound(_0x46e4e4,null))[_0xe287('0x27')](respondWithResult(_0x46e4e4,null))[_0xe287('0x39')](handleError(_0x46e4e4,null));};exports['destroy']=function(_0x39741f,_0x444b87){return db[_0xe287('0x2f')]['find']({'where':{'id':_0x39741f[_0xe287('0x2d')]['id']}})[_0xe287('0x27')](handleEntityNotFound(_0x444b87,null))[_0xe287('0x27')](removeEntity(_0x444b87,null))[_0xe287('0x39')](handleError(_0x444b87,null));};function widgetAttributes(_0x49d930){try{switch(_0x49d930[_0xe287('0x3a')]){case _0xe287('0x3b'):return[{'name':_0xe287('0x3c'),'value':_0x49d930[_0xe287('0x3c')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0][_0xe287('0x3e')]:undefined)||_0xe287('0x3f')}];case _0xe287('0x40'):return[{'name':_0xe287('0x41'),'value':_0x49d930[_0xe287('0x41')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0]['value']:undefined)||''}];case _0xe287('0x42'):return[{'name':'attrHourFormat','value':_0x49d930[_0xe287('0x43')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0][_0xe287('0x3e')]:undefined)||_0xe287('0x44')},{'name':_0xe287('0x45'),'value':_0x49d930[_0xe287('0x45')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x1]?_0x49d930[_0xe287('0x3d')][0x1][_0xe287('0x3e')]:undefined)||_0xe287('0x46')},{'name':_0xe287('0x47'),'value':_0x49d930['attrFontSize']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x2]?_0x49d930[_0xe287('0x3d')][0x2][_0xe287('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0xe287('0x48'),'value':_0x49d930[_0xe287('0x48')]||(_0x49d930['attrs']&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0][_0xe287('0x3e')]:undefined)||_0xe287('0x49')},{'name':_0xe287('0x4a'),'value':_0x49d930[_0xe287('0x4a')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x1]?_0x49d930[_0xe287('0x3d')][0x1][_0xe287('0x3e')]:undefined)||[]},{'name':_0xe287('0x47'),'value':_0x49d930[_0xe287('0x47')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x2]?_0x49d930[_0xe287('0x3d')][0x2][_0xe287('0x3e')]:undefined)||0x14},{'name':_0xe287('0x4b'),'value':_0x49d930[_0xe287('0x4b')]||(_0x49d930['attrs']&&_0x49d930['attrs'][0x3]?_0x49d930[_0xe287('0x3d')][0x3][_0xe287('0x3e')]:undefined)||_0xe287('0x4c')},{'name':'attrEmailAccounts','value':_0x49d930['attrEmailAccounts']||(_0x49d930['attrs']&&_0x49d930['attrs'][0x4]?_0x49d930[_0xe287('0x3d')][0x4][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x4d'),'value':_0x49d930[_0xe287('0x4d')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x5]?_0x49d930[_0xe287('0x3d')][0x5][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x4e'),'value':_0x49d930[_0xe287('0x4e')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x6]?_0x49d930['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x49d930[_0xe287('0x4f')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x7]?_0x49d930['attrs'][0x7][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x50'),'value':_0x49d930[_0xe287('0x50')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x8]?_0x49d930[_0xe287('0x3d')][0x8][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x51'),'value':_0x49d930['attrChatWebsites']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x9]?_0x49d930[_0xe287('0x3d')][0x9][_0xe287('0x3e')]:undefined)||''}];case _0xe287('0x52'):case _0xe287('0x53'):return[{'name':_0xe287('0x54'),'value':_0x49d930[_0xe287('0x54')]||(_0x49d930['attrs']&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0][_0xe287('0x3e')]:undefined)||_0xe287('0x49')},{'name':_0xe287('0x55'),'value':_0x49d930['attrSerie2']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x1]?_0x49d930['attrs'][0x1][_0xe287('0x3e')]:undefined)||null},{'name':_0xe287('0x56'),'value':_0x49d930[_0xe287('0x56')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x2]?_0x49d930['attrs'][0x2][_0xe287('0x3e')]:undefined)||null},{'name':_0xe287('0x4a'),'value':_0x49d930[_0xe287('0x4a')]||(_0x49d930['attrs']&&_0x49d930[_0xe287('0x3d')][0x3]?_0x49d930['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x49d930['attrChannel']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x4]?_0x49d930[_0xe287('0x3d')][0x4][_0xe287('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x49d930[_0xe287('0x57')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x5]?_0x49d930[_0xe287('0x3d')][0x5][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x4d'),'value':_0x49d930[_0xe287('0x4d')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x6]?_0x49d930[_0xe287('0x3d')][0x6]['value']:undefined)||''},{'name':_0xe287('0x4e'),'value':_0x49d930[_0xe287('0x4e')]||(_0x49d930['attrs']&&_0x49d930['attrs'][0x7]?_0x49d930[_0xe287('0x3d')][0x7][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x4f'),'value':_0x49d930['attrOpenchannelAccounts']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x8]?_0x49d930['attrs'][0x8][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x50'),'value':_0x49d930[_0xe287('0x50')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x9]?_0x49d930[_0xe287('0x3d')][0x9][_0xe287('0x3e')]:undefined)||''},{'name':_0xe287('0x51'),'value':_0x49d930['attrChatWebsites']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0xa]?_0x49d930[_0xe287('0x3d')][0xa]['value']:undefined)||''}];case _0xe287('0x58'):return[{'name':_0xe287('0x59'),'type':_0x49d930['reportType']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x0]?_0x49d930[_0xe287('0x3d')][0x0][_0xe287('0x3a')]:undefined)||null,'value':_0x49d930[_0xe287('0x59')]||(_0x49d930[_0xe287('0x3d')]&&_0x49d930[_0xe287('0x3d')][0x0]?_0x49d930[_0xe287('0x3d')][0x0]['value']:undefined)||null},{'name':_0xe287('0x5a'),'value':_0x49d930['attrRefresh']||(_0x49d930[_0xe287('0x3d')]&&_0x49d930['attrs'][0x1]?_0x49d930['attrs'][0x1][_0xe287('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x585f9d){logger[_0xe287('0x5b')](_0xe287('0x5c'),JSON['stringify'](_0x585f9d));return[];}}exports['create']=function(_0x3eafd2,_0x5311ac){if(_0x3eafd2[_0xe287('0x5d')]){_0x3eafd2[_0xe287('0x5d')][_0xe287('0x3d')]=widgetAttributes(_0x3eafd2[_0xe287('0x5d')]);}return db[_0xe287('0x2f')][_0xe287('0x5e')](_0x3eafd2[_0xe287('0x5d')],{})['then'](respondWithResult(_0x5311ac,0xc9))[_0xe287('0x39')](handleError(_0x5311ac,null));};exports['update']=function(_0xe461e9,_0xf0a628){if(_0xe461e9[_0xe287('0x5d')]['id']){delete _0xe461e9[_0xe287('0x5d')]['id'];}_0xe461e9[_0xe287('0x5d')][_0xe287('0x3d')]=widgetAttributes(_0xe461e9[_0xe287('0x5d')]);return db[_0xe287('0x2f')][_0xe287('0x38')]({'where':{'id':_0xe461e9[_0xe287('0x2d')]['id']}})[_0xe287('0x27')](handleEntityNotFound(_0xf0a628,null))['then'](saveUpdates(_0xe461e9[_0xe287('0x5d')],null))[_0xe287('0x27')](respondWithResult(_0xf0a628,null))[_0xe287('0x39')](handleError(_0xf0a628,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 743dcf7..65c9220 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 _0x9d1a=['update','remove','emit','hasOwnProperty','exports','events','DashboardItem','setMaxListeners','save'];(function(_0x34f4bb,_0x4f427d){var _0x43920c=function(_0x6f6e4f){while(--_0x6f6e4f){_0x34f4bb['push'](_0x34f4bb['shift']());}};_0x43920c(++_0x4f427d);}(_0x9d1a,0xa7));var _0xa9d1=function(_0x54a360,_0x97497e){_0x54a360=_0x54a360-0x0;var _0x5b9d56=_0x9d1a[_0x54a360];return _0x5b9d56;};'use strict';var EventEmitter=require(_0xa9d1('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa9d1('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa9d1('0x2')](0x0);var events={'afterCreate':_0xa9d1('0x3'),'afterUpdate':_0xa9d1('0x4'),'afterDestroy':_0xa9d1('0x5')};function emitEvent(_0x376793){return function(_0x408bfe,_0x4696da,_0x102e98){DashboardItemEvents[_0xa9d1('0x6')](_0x376793+':'+_0x408bfe['id'],_0x408bfe);DashboardItemEvents['emit'](_0x376793,_0x408bfe);_0x102e98(null);};}for(var e in events){if(events[_0xa9d1('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xa9d1('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xbf4a=['../../mysqldb','DashboardItem','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1a63a7,_0x135783){var _0x4e66bc=function(_0x346182){while(--_0x346182){_0x1a63a7['push'](_0x1a63a7['shift']());}};_0x4e66bc(++_0x135783);}(_0xbf4a,0x104));var _0xabf4=function(_0x4f8784,_0x21dc05){_0x4f8784=_0x4f8784-0x0;var _0x4ec172=_0xbf4a[_0x4f8784];return _0x4ec172;};'use strict';var EventEmitter=require(_0xabf4('0x0'));var DashboardItem=require(_0xabf4('0x1'))['db'][_0xabf4('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xabf4('0x3'),'afterUpdate':'update','afterDestroy':_0xabf4('0x4')};function emitEvent(_0x1a593c){return function(_0x416fc9,_0x126e11,_0x698454){DashboardItemEvents['emit'](_0x1a593c+':'+_0x416fc9['id'],_0x416fc9);DashboardItemEvents[_0xabf4('0x5')](_0x1a593c,_0x416fc9);_0x698454(null);};}for(var e in events){if(events[_0xabf4('0x6')](e)){var event=events[e];DashboardItem[_0xabf4('0x7')](e,emitEvent(event));}}module[_0xabf4('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index dddf63d..97aee80 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 _0x3c6d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','dashboard_items'];(function(_0x3651e8,_0x33901e){var _0x5decb1=function(_0x400a53){while(--_0x400a53){_0x3651e8['push'](_0x3651e8['shift']());}};_0x5decb1(++_0x33901e);}(_0x3c6d,0x190));var _0xd3c6=function(_0x489528,_0x2d6632){_0x489528=_0x489528-0x0;var _0x2b96eb=_0x3c6d[_0x489528];return _0x2b96eb;};'use strict';var _=require(_0xd3c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rp=require(_0xd3c6('0x4'));var fs=require('fs');var path=require(_0xd3c6('0x5'));var rimraf=require(_0xd3c6('0x6'));var config=require(_0xd3c6('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x4523d4,_0x4a1c95){return _0x4523d4[_0xd3c6('0x8')]('DashboardItem',attributes,{'tableName':_0xd3c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x465b=['request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird'];(function(_0x46a294,_0xdbbcea){var _0x23ad18=function(_0x46840d){while(--_0x46840d){_0x46a294['push'](_0x46a294['shift']());}};_0x23ad18(++_0xdbbcea);}(_0x465b,0x1dc));var _0xb465=function(_0x593bb6,_0x31033a){_0x593bb6=_0x593bb6-0x0;var _0x4bebc5=_0x465b[_0x593bb6];return _0x4bebc5;};'use strict';var _=require(_0xb465('0x0'));var util=require(_0xb465('0x1'));var logger=require('../../config/logger')(_0xb465('0x2'));var moment=require(_0xb465('0x3'));var BPromise=require(_0xb465('0x4'));var rp=require(_0xb465('0x5'));var fs=require('fs');var path=require(_0xb465('0x6'));var rimraf=require('rimraf');var config=require(_0xb465('0x7'));var attributes=require(_0xb465('0x8'));module[_0xb465('0x9')]=function(_0x96948b,_0x48c5f5){return _0x96948b[_0xb465('0xa')](_0xb465('0xb'),attributes,{'tableName':_0xb465('0xc'),'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 147c145..f0368cc 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 _0x0692=['register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0x0692,0x6a));var _0x2069=function(_0x2f0069,_0x5e75f4){_0x2f0069=_0x2f0069-0x0;var _0xe8188b=_0x0692[_0x2f0069];return _0xe8188b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2069('0x0'));var rs=require(_0x2069('0x1'));var fs=require('fs');var Redis=require(_0x2069('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2069('0x3'));var logger=require(_0x2069('0x4'))(_0x2069('0x5'));var config=require(_0x2069('0x6'));var jayson=require(_0x2069('0x7'));var client=jayson[_0x2069('0x8')][_0x2069('0x9')]({'port':0x232a});config[_0x2069('0xa')]=_[_0x2069('0xb')](config[_0x2069('0xa')],{'host':_0x2069('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2069('0xa')]));require(_0x2069('0xd'))[_0x2069('0xe')](socket);function respondWithRpcPromise(_0x24de08,_0x1660a2,_0x13f5f9){return new BPromise(function(_0xc393b0,_0x4b5ad1){return client[_0x2069('0xf')](_0x24de08,_0x13f5f9)[_0x2069('0x10')](function(_0x5b36bb){logger['info'](_0x2069('0x11'),_0x1660a2,_0x2069('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1660a2,'request\x20sent',JSON[_0x2069('0x13')](_0x5b36bb));if(_0x5b36bb['error']){if(_0x5b36bb[_0x2069('0x14')]['code']===0x1f4){logger[_0x2069('0x14')](_0x2069('0x11'),_0x1660a2,_0x5b36bb[_0x2069('0x14')][_0x2069('0x15')]);return _0x4b5ad1(_0x5b36bb[_0x2069('0x14')]['message']);}logger['error'](_0x2069('0x11'),_0x1660a2,_0x5b36bb['error'][_0x2069('0x15')]);return _0xc393b0(_0x5b36bb[_0x2069('0x14')]['message']);}else{logger[_0x2069('0x16')](_0x2069('0x11'),_0x1660a2,'request\x20sent');_0xc393b0(_0x5b36bb[_0x2069('0x17')][_0x2069('0x15')]);}})['catch'](function(_0x427da2){logger[_0x2069('0x14')](_0x2069('0x11'),_0x1660a2,_0x427da2);_0x4b5ad1(_0x427da2);});});} \ No newline at end of file +var _0xf981=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf981,0xbe));var _0x1f98=function(_0x3169d9,_0xcd812f){_0x3169d9=_0x3169d9-0x0;var _0x2f6399=_0xf981[_0x3169d9];return _0x2f6399;};'use strict';var _=require(_0x1f98('0x0'));var util=require(_0x1f98('0x1'));var moment=require(_0x1f98('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f98('0x3'));var fs=require('fs');var Redis=require(_0x1f98('0x4'));var db=require(_0x1f98('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1f98('0x6'));var config=require(_0x1f98('0x7'));var jayson=require(_0x1f98('0x8'));var client=jayson[_0x1f98('0x9')]['http']({'port':0x232a});config[_0x1f98('0xa')]=_[_0x1f98('0xb')](config[_0x1f98('0xa')],{'host':_0x1f98('0xc'),'port':0x18eb});var socket=require(_0x1f98('0xd'))(new Redis(config[_0x1f98('0xa')]));require('./dashboardItem.socket')[_0x1f98('0xe')](socket);function respondWithRpcPromise(_0x41907d,_0x1d4478,_0x1ac7ee){return new BPromise(function(_0x367004,_0x4fae4b){return client[_0x1f98('0xf')](_0x41907d,_0x1ac7ee)['then'](function(_0x560661){logger[_0x1f98('0x10')](_0x1f98('0x11'),_0x1d4478,'request\x20sent');logger[_0x1f98('0x12')](_0x1f98('0x13'),_0x1d4478,_0x1f98('0x14'),JSON[_0x1f98('0x15')](_0x560661));if(_0x560661[_0x1f98('0x16')]){if(_0x560661[_0x1f98('0x16')][_0x1f98('0x17')]===0x1f4){logger[_0x1f98('0x16')](_0x1f98('0x11'),_0x1d4478,_0x560661[_0x1f98('0x16')]['message']);return _0x4fae4b(_0x560661[_0x1f98('0x16')][_0x1f98('0x18')]);}logger[_0x1f98('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1d4478,_0x560661['error']['message']);return _0x367004(_0x560661[_0x1f98('0x16')][_0x1f98('0x18')]);}else{logger[_0x1f98('0x10')]('DashboardItem,\x20%s,\x20%s',_0x1d4478,_0x1f98('0x14'));_0x367004(_0x560661['result'][_0x1f98('0x18')]);}})[_0x1f98('0x19')](function(_0x5d88f3){logger['error'](_0x1f98('0x11'),_0x1d4478,_0x5d88f3);_0x4fae4b(_0x5d88f3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 5059299..5866839 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 _0x09ae=['dashboardItem:','./dashboardItem.events','remove','update','register','length'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x09ae,0x17b));var _0xe09a=function(_0x2d2a4e,_0x3773f8){_0x2d2a4e=_0x2d2a4e-0x0;var _0x3cb40f=_0x09ae[_0x2d2a4e];return _0x3cb40f;};'use strict';var DashboardItemEvents=require(_0xe09a('0x0'));var events=['save',_0xe09a('0x1'),_0xe09a('0x2')];function createListener(_0x29b6c7,_0xb61bae){return function(_0x52d4f2){_0xb61bae['emit'](_0x29b6c7,_0x52d4f2);};}function removeListener(_0x3fe850,_0x547ad1){return function(){DashboardItemEvents['removeListener'](_0x3fe850,_0x547ad1);};}exports[_0xe09a('0x3')]=function(_0xa1dfb8){for(var _0x5181fc=0x0,_0x9e4eb6=events[_0xe09a('0x4')];_0x5181fc<_0x9e4eb6;_0x5181fc++){var _0x45f8c7=events[_0x5181fc];var _0x27d2a3=createListener(_0xe09a('0x5')+_0x45f8c7,_0xa1dfb8);DashboardItemEvents['on'](_0x45f8c7,_0x27d2a3);}}; \ No newline at end of file +var _0x31de=['update','length','./dashboardItem.events','save','remove'];(function(_0x2e22c5,_0x1bb995){var _0x2819d9=function(_0x59bab7){while(--_0x59bab7){_0x2e22c5['push'](_0x2e22c5['shift']());}};_0x2819d9(++_0x1bb995);}(_0x31de,0x16a));var _0xe31d=function(_0x15bd66,_0x2d074d){_0x15bd66=_0x15bd66-0x0;var _0x451225=_0x31de[_0x15bd66];return _0x451225;};'use strict';var DashboardItemEvents=require(_0xe31d('0x0'));var events=[_0xe31d('0x1'),_0xe31d('0x2'),_0xe31d('0x3')];function createListener(_0x5018fc,_0x1524e3){return function(_0x8fe327){_0x1524e3['emit'](_0x5018fc,_0x8fe327);};}function removeListener(_0x1b2f83,_0x4dd093){return function(){DashboardItemEvents['removeListener'](_0x1b2f83,_0x4dd093);};}exports['register']=function(_0x4b6920){for(var _0x57cd43=0x0,_0x4ea51d=events[_0xe31d('0x4')];_0x57cd43<_0x4ea51d;_0x57cd43++){var _0x181a9b=events[_0x57cd43];var _0x3fdfb4=createListener('dashboardItem:'+_0x181a9b,_0x4b6920);DashboardItemEvents['on'](_0x181a9b,_0x3fdfb4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e183bb2..8a39f6e 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 _0xc92f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','put','/:id','update'];(function(_0x612a71,_0xb27d3f){var _0xb07bc1=function(_0x41b70b){while(--_0x41b70b){_0x612a71['push'](_0x612a71['shift']());}};_0xb07bc1(++_0xb27d3f);}(_0xc92f,0x162));var _0xfc92=function(_0x230431,_0x4e25f1){_0x230431=_0x230431-0x0;var _0x3f9266=_0xc92f[_0x230431];return _0x3f9266;};'use strict';var multer=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var path=require(_0xfc92('0x2'));var timeout=require(_0xfc92('0x3'));var express=require(_0xfc92('0x4'));var router=express[_0xfc92('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc92('0x6'));var config=require(_0xfc92('0x7'));var controller=require(_0xfc92('0x8'));router['get']('/:id',auth[_0xfc92('0x9')](),controller['show']);router[_0xfc92('0xa')]('/',auth[_0xfc92('0x9')](),controller['create']);router[_0xfc92('0xb')](_0xfc92('0xc'),auth[_0xfc92('0x9')](),controller[_0xfc92('0xd')]);router['delete'](_0xfc92('0xc'),auth[_0xfc92('0x9')](),controller[_0xfc92('0xe')]);module[_0xfc92('0xf')]=router; \ No newline at end of file +var _0xa8df=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','create','put','isAuthenticated','update','exports','multer'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xa8df,0x1df));var _0xfa8d=function(_0x542cf4,_0x1dd665){_0x542cf4=_0x542cf4-0x0;var _0x12866e=_0xa8df[_0x542cf4];return _0x12866e;};'use strict';var multer=require(_0xfa8d('0x0'));var util=require(_0xfa8d('0x1'));var path=require(_0xfa8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xfa8d('0x3'));var router=express['Router']();var fs_extra=require(_0xfa8d('0x4'));var auth=require(_0xfa8d('0x5'));var interaction=require(_0xfa8d('0x6'));var config=require(_0xfa8d('0x7'));var controller=require(_0xfa8d('0x8'));router[_0xfa8d('0x9')](_0xfa8d('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xfa8d('0xb')]);router[_0xfa8d('0xc')](_0xfa8d('0xa'),auth[_0xfa8d('0xd')](),controller[_0xfa8d('0xe')]);router['delete'](_0xfa8d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa8d('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 8742625..f13a40b 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 _0x8870=['second','third','first','sequelize','STRING','ENUM'];(function(_0x36ef0c,_0x547216){var _0x206a4c=function(_0x4b1f03){while(--_0x4b1f03){_0x36ef0c['push'](_0x36ef0c['shift']());}};_0x206a4c(++_0x547216);}(_0x8870,0xff));var _0x0887=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8870[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0887('0x0'));module['exports']={'name':{'type':Sequelize[_0x0887('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x0887('0x2')]('first',_0x0887('0x3'),_0x0887('0x4')),'allowNull':![],'defaultValue':_0x0887('0x5')},'description':{'type':Sequelize[_0x0887('0x1')]}}; \ No newline at end of file +var _0x8786=['STRING','ENUM','first','second','third','sequelize'];(function(_0x1231b9,_0x48a493){var _0x2e669a=function(_0x5be94d){while(--_0x5be94d){_0x1231b9['push'](_0x1231b9['shift']());}};_0x2e669a(++_0x48a493);}(_0x8786,0x13d));var _0x6878=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8786[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x6878('0x0'));module['exports']={'name':{'type':Sequelize[_0x6878('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6878('0x2')](_0x6878('0x3'),_0x6878('0x4'),_0x6878('0x5')),'allowNull':![],'defaultValue':_0x6878('0x3')},'description':{'type':Sequelize[_0x6878('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 106c53c..253b56e 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 _0x2645=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','end','error','name','send','map','Disposition','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch'];(function(_0x21ecb6,_0x37a730){var _0x178936=function(_0x59bb66){while(--_0x59bb66){_0x21ecb6['push'](_0x21ecb6['shift']());}};_0x178936(++_0x37a730);}(_0x2645,0xb0));var _0x5264=function(_0xb6135c,_0x9a89ff){_0xb6135c=_0xb6135c-0x0;var _0x4e408c=_0x2645[_0xb6135c];return _0x4e408c;};'use strict';var emlformat=require(_0x5264('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5264('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5264('0x2'));var moment=require(_0x5264('0x3'));var BPromise=require(_0x5264('0x4'));var Mustache=require(_0x5264('0x5'));var util=require(_0x5264('0x6'));var path=require(_0x5264('0x7'));var sox=require(_0x5264('0x8'));var csv=require(_0x5264('0x9'));var ejs=require(_0x5264('0xa'));var fs=require('fs');var fs_extra=require(_0x5264('0xb'));var _=require(_0x5264('0xc'));var squel=require(_0x5264('0xd'));var crypto=require(_0x5264('0xe'));var jsforce=require(_0x5264('0xf'));var deskjs=require(_0x5264('0x10'));var toCsv=require(_0x5264('0x9'));var querystring=require(_0x5264('0x11'));var Papa=require('papaparse');var Redis=require(_0x5264('0x12'));var authService=require(_0x5264('0x13'));var qs=require(_0x5264('0x14'));var as=require(_0x5264('0x15'));var hardwareService=require(_0x5264('0x16'));var logger=require('../../config/logger')(_0x5264('0x17'));var utils=require('../../config/utils');var config=require(_0x5264('0x18'));var licenseUtil=require(_0x5264('0x19'));var db=require(_0x5264('0x1a'))['db'];function respondWithStatusCode(_0x1a8172,_0x1c79ea){_0x1c79ea=_0x1c79ea||0xcc;return function(_0x4c78c2){if(_0x4c78c2){return _0x1a8172[_0x5264('0x1b')](_0x1c79ea);}return _0x1a8172[_0x5264('0x1c')](_0x1c79ea)['end']();};}function respondWithResult(_0x483dce,_0x472b8b){_0x472b8b=_0x472b8b||0xc8;return function(_0x3c6781){if(_0x3c6781){return _0x483dce[_0x5264('0x1c')](_0x472b8b)[_0x5264('0x1d')](_0x3c6781);}};}function respondWithFilteredResult(_0x5e4285,_0x6356d6){return function(_0x5313fc){if(_0x5313fc){var _0x52fee1=typeof _0x6356d6['offset']===_0x5264('0x1e')&&typeof _0x6356d6[_0x5264('0x1f')]==='undefined';var _0x208fb1=_0x5313fc[_0x5264('0x20')];var _0x2a5084=_0x52fee1?0x0:_0x6356d6[_0x5264('0x21')];var _0x2801fd=_0x52fee1?_0x5313fc[_0x5264('0x20')]:_0x6356d6[_0x5264('0x21')]+_0x6356d6[_0x5264('0x1f')];var _0x150efb;if(_0x2801fd>=_0x208fb1){_0x2801fd=_0x208fb1;_0x150efb=0xc8;}else{_0x150efb=0xce;}_0x5e4285[_0x5264('0x1c')](_0x150efb);return _0x5e4285[_0x5264('0x22')](_0x5264('0x23'),_0x2a5084+'-'+_0x2801fd+'/'+_0x208fb1)['json'](_0x5313fc);}return null;};}function patchUpdates(_0x22226d){return function(_0x38ac1a){try{jsonpatch['apply'](_0x38ac1a,_0x22226d,!![]);}catch(_0x2cec5d){return BPromise['reject'](_0x2cec5d);}return _0x38ac1a[_0x5264('0x24')]();};}function saveUpdates(_0x3edd29,_0x41fdbd){return function(_0x372263){if(_0x372263){return _0x372263[_0x5264('0x25')](_0x3edd29)[_0x5264('0x26')](function(_0x3585ff){return _0x3585ff;});}return null;};}function removeEntity(_0x54b4ae,_0x1fbd9a){return function(_0x40e994){if(_0x40e994){return _0x40e994[_0x5264('0x27')]()[_0x5264('0x26')](function(){var _0x3f07d0=_0x40e994[_0x5264('0x28')]({'plain':!![]});var _0x1b1a44=_0x5264('0x29');return db['UserProfileResource'][_0x5264('0x27')]({'where':{'type':_0x1b1a44,'resourceId':_0x3f07d0['id']}})[_0x5264('0x26')](function(){return _0x40e994;});})[_0x5264('0x26')](function(){_0x54b4ae[_0x5264('0x1c')](0xcc)[_0x5264('0x2a')]();});}};}function handleEntityNotFound(_0x2074c8,_0x1cef70){return function(_0x3b3517){if(!_0x3b3517){_0x2074c8[_0x5264('0x1b')](0x194);}return _0x3b3517;};}function handleError(_0xe74305,_0x14d748){_0x14d748=_0x14d748||0x1f4;return function(_0x30e52b){logger[_0x5264('0x2b')](_0x30e52b['stack']);if(_0x30e52b[_0x5264('0x2c')]){delete _0x30e52b[_0x5264('0x2c')];}_0xe74305[_0x5264('0x1c')](_0x14d748)[_0x5264('0x2d')](_0x30e52b);};}exports['index']=function(_0x34a7f1,_0x63514e){var _0x3fcef1={},_0x548c11={},_0x4b00b1={'count':0x0,'rows':[]};var _0x4e05e9=_[_0x5264('0x2e')](db[_0x5264('0x2f')]['rawAttributes'],function(_0x43f112){return{'name':_0x43f112[_0x5264('0x30')],'type':_0x43f112['type'][_0x5264('0x31')]};});_0x548c11[_0x5264('0x32')]=_['map'](_0x4e05e9,_0x5264('0x2c'));_0x548c11['query']=_['keys'](_0x34a7f1[_0x5264('0x33')]);_0x548c11[_0x5264('0x34')]=_[_0x5264('0x35')](_0x548c11['model'],_0x548c11[_0x5264('0x33')]);_0x3fcef1['attributes']=_[_0x5264('0x35')](_0x548c11[_0x5264('0x32')],qs[_0x5264('0x36')](_0x34a7f1[_0x5264('0x33')]['fields']));_0x3fcef1[_0x5264('0x37')]=_0x3fcef1[_0x5264('0x37')][_0x5264('0x38')]?_0x3fcef1['attributes']:_0x548c11['model'];if(!_0x34a7f1['query'][_0x5264('0x39')](_0x5264('0x3a'))){_0x3fcef1['limit']=qs['limit'](_0x34a7f1[_0x5264('0x33')][_0x5264('0x1f')]);_0x3fcef1[_0x5264('0x21')]=qs['offset'](_0x34a7f1[_0x5264('0x33')]['offset']);}_0x3fcef1[_0x5264('0x3b')]=qs[_0x5264('0x3c')](_0x34a7f1[_0x5264('0x33')][_0x5264('0x3c')]);_0x3fcef1['where']=qs[_0x5264('0x34')](_[_0x5264('0x3d')](_0x34a7f1['query'],_0x548c11[_0x5264('0x34')]),_0x4e05e9);if(_0x34a7f1['query'][_0x5264('0x3e')]){_0x3fcef1[_0x5264('0x3f')]=_[_0x5264('0x40')](_0x3fcef1[_0x5264('0x3f')],{'$or':_[_0x5264('0x2e')](_0x4e05e9,function(_0x533bbb){if(_0x533bbb['type']!==_0x5264('0x41')){var _0x3f399a={};_0x3f399a[_0x533bbb['name']]={'$like':'%'+_0x34a7f1['query'][_0x5264('0x3e')]+'%'};return _0x3f399a;}})});}_0x3fcef1=_[_0x5264('0x40')]({},_0x3fcef1,_0x34a7f1[_0x5264('0x42')]);var _0x19e789={'where':_0x3fcef1[_0x5264('0x3f')]};return db[_0x5264('0x2f')][_0x5264('0x20')](_0x19e789)[_0x5264('0x26')](function(_0x529ca5){_0x4b00b1[_0x5264('0x20')]=_0x529ca5;if(_0x34a7f1['query'][_0x5264('0x43')]){_0x3fcef1[_0x5264('0x44')]=[{'all':!![]}];}return db[_0x5264('0x2f')]['findAll'](_0x3fcef1);})['then'](function(_0x5180b3){_0x4b00b1[_0x5264('0x45')]=_0x5180b3;return _0x4b00b1;})[_0x5264('0x26')](respondWithFilteredResult(_0x63514e,_0x3fcef1))['catch'](handleError(_0x63514e,null));};exports[_0x5264('0x46')]=function(_0x282b20,_0x41f2e1){var _0x164b16={'raw':!![],'where':{'id':_0x282b20[_0x5264('0x47')]['id']}},_0x2000a7={};_0x2000a7[_0x5264('0x32')]=_['keys'](db[_0x5264('0x2f')]['rawAttributes']);_0x2000a7[_0x5264('0x33')]=_['keys'](_0x282b20['query']);_0x2000a7['filters']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],_0x2000a7[_0x5264('0x33')]);_0x164b16['attributes']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],qs[_0x5264('0x36')](_0x282b20[_0x5264('0x33')]['fields']));_0x164b16[_0x5264('0x37')]=_0x164b16[_0x5264('0x37')][_0x5264('0x38')]?_0x164b16['attributes']:_0x2000a7[_0x5264('0x32')];if(_0x282b20[_0x5264('0x33')]['includeAll']){_0x164b16[_0x5264('0x44')]=[{'all':!![]}];}_0x164b16=_[_0x5264('0x40')]({},_0x164b16,_0x282b20[_0x5264('0x42')]);return db['Disposition']['find'](_0x164b16)['then'](handleEntityNotFound(_0x41f2e1,null))[_0x5264('0x26')](respondWithResult(_0x41f2e1,null))[_0x5264('0x48')](handleError(_0x41f2e1,null));};exports[_0x5264('0x49')]=function(_0x5259a5,_0x1f9602){return db['Disposition'][_0x5264('0x49')](_0x5259a5[_0x5264('0x4a')],{})[_0x5264('0x26')](function(_0x4e3236){var _0x1f862f=_0x5259a5[_0x5264('0x4b')][_0x5264('0x28')]({'plain':!![]});if(!_0x1f862f)throw new Error(_0x5264('0x4c'));if(_0x1f862f[_0x5264('0x4d')]==='user'){var _0x1b659a=_0x4e3236['get']({'plain':!![]});var _0x1c4c2b='Dispositions';return db[_0x5264('0x4e')]['find']({'where':{'name':_0x1c4c2b,'userProfileId':_0x1f862f[_0x5264('0x4f')]},'raw':!![]})[_0x5264('0x26')](function(_0x51e171){if(_0x51e171&&_0x51e171[_0x5264('0x50')]===0x0){return db[_0x5264('0x51')]['create']({'name':_0x1b659a[_0x5264('0x2c')],'resourceId':_0x1b659a['id'],'type':_0x51e171[_0x5264('0x2c')],'sectionId':_0x51e171['id']},{})[_0x5264('0x26')](function(){return _0x4e3236;});}else{return _0x4e3236;}})[_0x5264('0x48')](function(_0x29172c){logger[_0x5264('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29172c);throw _0x29172c;});}return _0x4e3236;})[_0x5264('0x26')](respondWithResult(_0x1f9602,0xc9))['catch'](handleError(_0x1f9602,null));};exports[_0x5264('0x25')]=function(_0xf9ab47,_0x215858){if(_0xf9ab47['body']['id']){delete _0xf9ab47[_0x5264('0x4a')]['id'];}return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0xf9ab47[_0x5264('0x47')]['id']}})[_0x5264('0x26')](handleEntityNotFound(_0x215858,null))[_0x5264('0x26')](saveUpdates(_0xf9ab47[_0x5264('0x4a')],null))['then'](respondWithResult(_0x215858,null))[_0x5264('0x48')](handleError(_0x215858,null));};exports[_0x5264('0x27')]=function(_0x24b7dd,_0xf70d43){return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0x24b7dd[_0x5264('0x47')]['id']}})['then'](handleEntityNotFound(_0xf70d43,null))[_0x5264('0x26')](removeEntity(_0xf70d43,null))[_0x5264('0x48')](handleError(_0xf70d43,null));}; \ No newline at end of file +var _0xcf6a=['keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x4f6a85,_0x41b2a0){var _0x53bc61=function(_0x1c72d8){while(--_0x1c72d8){_0x4f6a85['push'](_0x4f6a85['shift']());}};_0x53bc61(++_0x41b2a0);}(_0xcf6a,0xbb));var _0xacf6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xcf6a[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xacf6('0x0'));var rimraf=require(_0xacf6('0x1'));var zipdir=require(_0xacf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xacf6('0x3'));var BPromise=require(_0xacf6('0x4'));var Mustache=require(_0xacf6('0x5'));var util=require(_0xacf6('0x6'));var path=require(_0xacf6('0x7'));var sox=require('sox');var csv=require(_0xacf6('0x8'));var ejs=require(_0xacf6('0x9'));var fs=require('fs');var fs_extra=require(_0xacf6('0xa'));var _=require(_0xacf6('0xb'));var squel=require(_0xacf6('0xc'));var crypto=require('crypto');var jsforce=require(_0xacf6('0xd'));var deskjs=require(_0xacf6('0xe'));var toCsv=require(_0xacf6('0x8'));var querystring=require(_0xacf6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacf6('0x10'));var as=require(_0xacf6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacf6('0x12'))(_0xacf6('0x13'));var utils=require(_0xacf6('0x14'));var config=require(_0xacf6('0x15'));var licenseUtil=require(_0xacf6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb086,_0x488bc5){_0x488bc5=_0x488bc5||0xcc;return function(_0x134ef6){if(_0x134ef6){return _0x1fb086[_0xacf6('0x17')](_0x488bc5);}return _0x1fb086['status'](_0x488bc5)[_0xacf6('0x18')]();};}function respondWithResult(_0xc07764,_0x543d29){_0x543d29=_0x543d29||0xc8;return function(_0x1658c2){if(_0x1658c2){return _0xc07764['status'](_0x543d29)['json'](_0x1658c2);}};}function respondWithFilteredResult(_0x591687,_0xcd9514){return function(_0x3ab6f1){if(_0x3ab6f1){var _0xfb0fb5=typeof _0xcd9514[_0xacf6('0x19')]===_0xacf6('0x1a')&&typeof _0xcd9514[_0xacf6('0x1b')]===_0xacf6('0x1a');var _0x2354e5=_0x3ab6f1['count'];var _0x45a875=_0xfb0fb5?0x0:_0xcd9514[_0xacf6('0x19')];var _0x2191ab=_0xfb0fb5?_0x3ab6f1[_0xacf6('0x1c')]:_0xcd9514[_0xacf6('0x19')]+_0xcd9514['limit'];var _0x2180ef;if(_0x2191ab>=_0x2354e5){_0x2191ab=_0x2354e5;_0x2180ef=0xc8;}else{_0x2180ef=0xce;}_0x591687[_0xacf6('0x1d')](_0x2180ef);return _0x591687[_0xacf6('0x1e')](_0xacf6('0x1f'),_0x45a875+'-'+_0x2191ab+'/'+_0x2354e5)['json'](_0x3ab6f1);}return null;};}function patchUpdates(_0x5ebf1e){return function(_0x4e00eb){try{jsonpatch['apply'](_0x4e00eb,_0x5ebf1e,!![]);}catch(_0x2ae333){return BPromise[_0xacf6('0x20')](_0x2ae333);}return _0x4e00eb[_0xacf6('0x21')]();};}function saveUpdates(_0x51ac6d,_0x26a795){return function(_0x50fc67){if(_0x50fc67){return _0x50fc67[_0xacf6('0x22')](_0x51ac6d)[_0xacf6('0x23')](function(_0x2056e9){return _0x2056e9;});}return null;};}function removeEntity(_0x366a8b,_0x3d27a0){return function(_0x446018){if(_0x446018){return _0x446018[_0xacf6('0x24')]()['then'](function(){var _0x1976b3=_0x446018[_0xacf6('0x25')]({'plain':!![]});var _0xdd2c3c=_0xacf6('0x26');return db[_0xacf6('0x27')]['destroy']({'where':{'type':_0xdd2c3c,'resourceId':_0x1976b3['id']}})['then'](function(){return _0x446018;});})[_0xacf6('0x23')](function(){_0x366a8b[_0xacf6('0x1d')](0xcc)[_0xacf6('0x18')]();});}};}function handleEntityNotFound(_0x4b3c9b,_0x2b262a){return function(_0x1e7130){if(!_0x1e7130){_0x4b3c9b[_0xacf6('0x17')](0x194);}return _0x1e7130;};}function handleError(_0xcacd7a,_0x19bc65){_0x19bc65=_0x19bc65||0x1f4;return function(_0x442f46){logger[_0xacf6('0x28')](_0x442f46[_0xacf6('0x29')]);if(_0x442f46[_0xacf6('0x2a')]){delete _0x442f46[_0xacf6('0x2a')];}_0xcacd7a['status'](_0x19bc65)[_0xacf6('0x2b')](_0x442f46);};}exports[_0xacf6('0x2c')]=function(_0xf97fdd,_0x3d05c8){var _0x1af2af={},_0x2e77f1={},_0x3d857a={'count':0x0,'rows':[]};var _0xfed42e=_['map'](db[_0xacf6('0x2d')][_0xacf6('0x2e')],function(_0x484d6a){return{'name':_0x484d6a[_0xacf6('0x2f')],'type':_0x484d6a[_0xacf6('0x30')][_0xacf6('0x31')]};});_0x2e77f1[_0xacf6('0x32')]=_[_0xacf6('0x33')](_0xfed42e,_0xacf6('0x2a'));_0x2e77f1[_0xacf6('0x34')]=_[_0xacf6('0x35')](_0xf97fdd[_0xacf6('0x34')]);_0x2e77f1['filters']=_[_0xacf6('0x36')](_0x2e77f1['model'],_0x2e77f1[_0xacf6('0x34')]);_0x1af2af[_0xacf6('0x37')]=_[_0xacf6('0x36')](_0x2e77f1[_0xacf6('0x32')],qs[_0xacf6('0x38')](_0xf97fdd['query'][_0xacf6('0x38')]));_0x1af2af[_0xacf6('0x37')]=_0x1af2af[_0xacf6('0x37')][_0xacf6('0x39')]?_0x1af2af[_0xacf6('0x37')]:_0x2e77f1['model'];if(!_0xf97fdd['query']['hasOwnProperty'](_0xacf6('0x3a'))){_0x1af2af[_0xacf6('0x1b')]=qs[_0xacf6('0x1b')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x1b')]);_0x1af2af[_0xacf6('0x19')]=qs[_0xacf6('0x19')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x19')]);}_0x1af2af['order']=qs[_0xacf6('0x3b')](_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3b')]);_0x1af2af[_0xacf6('0x3c')]=qs[_0xacf6('0x3d')](_[_0xacf6('0x3e')](_0xf97fdd['query'],_0x2e77f1['filters']),_0xfed42e);if(_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3f')]){_0x1af2af[_0xacf6('0x3c')]=_[_0xacf6('0x40')](_0x1af2af[_0xacf6('0x3c')],{'$or':_[_0xacf6('0x33')](_0xfed42e,function(_0x4d8e00){if(_0x4d8e00[_0xacf6('0x30')]!==_0xacf6('0x41')){var _0x1133d0={};_0x1133d0[_0x4d8e00[_0xacf6('0x2a')]]={'$like':'%'+_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x3f')]+'%'};return _0x1133d0;}})});}_0x1af2af=_[_0xacf6('0x40')]({},_0x1af2af,_0xf97fdd[_0xacf6('0x42')]);var _0xf2032c={'where':_0x1af2af[_0xacf6('0x3c')]};return db[_0xacf6('0x2d')][_0xacf6('0x1c')](_0xf2032c)[_0xacf6('0x23')](function(_0x276f86){_0x3d857a['count']=_0x276f86;if(_0xf97fdd[_0xacf6('0x34')][_0xacf6('0x43')]){_0x1af2af[_0xacf6('0x44')]=[{'all':!![]}];}return db[_0xacf6('0x2d')][_0xacf6('0x45')](_0x1af2af);})[_0xacf6('0x23')](function(_0xf46453){_0x3d857a[_0xacf6('0x46')]=_0xf46453;return _0x3d857a;})[_0xacf6('0x23')](respondWithFilteredResult(_0x3d05c8,_0x1af2af))[_0xacf6('0x47')](handleError(_0x3d05c8,null));};exports[_0xacf6('0x48')]=function(_0x2c41a7,_0x5e72e5){var _0x5d7391={'raw':!![],'where':{'id':_0x2c41a7[_0xacf6('0x49')]['id']}},_0x312a64={};_0x312a64[_0xacf6('0x32')]=_[_0xacf6('0x35')](db[_0xacf6('0x2d')]['rawAttributes']);_0x312a64['query']=_[_0xacf6('0x35')](_0x2c41a7[_0xacf6('0x34')]);_0x312a64[_0xacf6('0x3d')]=_[_0xacf6('0x36')](_0x312a64['model'],_0x312a64[_0xacf6('0x34')]);_0x5d7391[_0xacf6('0x37')]=_[_0xacf6('0x36')](_0x312a64['model'],qs[_0xacf6('0x38')](_0x2c41a7['query']['fields']));_0x5d7391[_0xacf6('0x37')]=_0x5d7391[_0xacf6('0x37')][_0xacf6('0x39')]?_0x5d7391['attributes']:_0x312a64[_0xacf6('0x32')];if(_0x2c41a7[_0xacf6('0x34')][_0xacf6('0x43')]){_0x5d7391['include']=[{'all':!![]}];}_0x5d7391=_['merge']({},_0x5d7391,_0x2c41a7[_0xacf6('0x42')]);return db[_0xacf6('0x2d')]['find'](_0x5d7391)[_0xacf6('0x23')](handleEntityNotFound(_0x5e72e5,null))['then'](respondWithResult(_0x5e72e5,null))[_0xacf6('0x47')](handleError(_0x5e72e5,null));};exports[_0xacf6('0x4a')]=function(_0x1e00ea,_0x20ebac){return db[_0xacf6('0x2d')]['create'](_0x1e00ea[_0xacf6('0x4b')],{})[_0xacf6('0x23')](function(_0x4edb35){var _0x1abb5a=_0x1e00ea[_0xacf6('0x4c')][_0xacf6('0x25')]({'plain':!![]});if(!_0x1abb5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1abb5a[_0xacf6('0x4d')]===_0xacf6('0x4c')){var _0x326288=_0x4edb35[_0xacf6('0x25')]({'plain':!![]});var _0x348003=_0xacf6('0x26');return db['UserProfileSection'][_0xacf6('0x4e')]({'where':{'name':_0x348003,'userProfileId':_0x1abb5a['userProfileId']},'raw':!![]})[_0xacf6('0x23')](function(_0x4b8115){if(_0x4b8115&&_0x4b8115['autoAssociation']===0x0){return db[_0xacf6('0x27')][_0xacf6('0x4a')]({'name':_0x326288[_0xacf6('0x2a')],'resourceId':_0x326288['id'],'type':_0x4b8115[_0xacf6('0x2a')],'sectionId':_0x4b8115['id']},{})[_0xacf6('0x23')](function(){return _0x4edb35;});}else{return _0x4edb35;}})[_0xacf6('0x47')](function(_0xd9726){logger[_0xacf6('0x28')](_0xacf6('0x4f'),_0xd9726);throw _0xd9726;});}return _0x4edb35;})[_0xacf6('0x23')](respondWithResult(_0x20ebac,0xc9))[_0xacf6('0x47')](handleError(_0x20ebac,null));};exports['update']=function(_0x315803,_0x2294a0){if(_0x315803[_0xacf6('0x4b')]['id']){delete _0x315803[_0xacf6('0x4b')]['id'];}return db[_0xacf6('0x2d')][_0xacf6('0x4e')]({'where':{'id':_0x315803[_0xacf6('0x49')]['id']}})[_0xacf6('0x23')](handleEntityNotFound(_0x2294a0,null))[_0xacf6('0x23')](saveUpdates(_0x315803['body'],null))[_0xacf6('0x23')](respondWithResult(_0x2294a0,null))['catch'](handleError(_0x2294a0,null));};exports[_0xacf6('0x24')]=function(_0x9a6a16,_0x25b875){return db[_0xacf6('0x2d')][_0xacf6('0x4e')]({'where':{'id':_0x9a6a16[_0xacf6('0x49')]['id']}})[_0xacf6('0x23')](handleEntityNotFound(_0x25b875,null))['then'](removeEntity(_0x25b875,null))[_0xacf6('0x47')](handleError(_0x25b875,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ff3d8fe..10609d9 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 _0x1e2f=['define','Disposition','tools_dispositions','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x288d06,_0x29730d){var _0x34d754=function(_0x4c265a){while(--_0x4c265a){_0x288d06['push'](_0x288d06['shift']());}};_0x34d754(++_0x29730d);}(_0x1e2f,0x1ee));var _0xf1e2=function(_0x2b0ac8,_0x29a0cc){_0x2b0ac8=_0x2b0ac8-0x0;var _0x1931c2=_0x1e2f[_0x2b0ac8];return _0x1931c2;};'use strict';var _=require(_0xf1e2('0x0'));var util=require(_0xf1e2('0x1'));var logger=require(_0xf1e2('0x2'))(_0xf1e2('0x3'));var moment=require(_0xf1e2('0x4'));var BPromise=require(_0xf1e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf1e2('0x6'));var config=require(_0xf1e2('0x7'));var attributes=require(_0xf1e2('0x8'));module[_0xf1e2('0x9')]=function(_0x53fe46,_0x411c8d){return _0x53fe46[_0xf1e2('0xa')](_0xf1e2('0xb'),attributes,{'tableName':_0xf1e2('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xf1e2('0xd')]},{'unique':!![],'name':_0xf1e2('0xe'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x10')]},{'unique':!![],'name':_0xf1e2('0x11'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x12')]},{'unique':!![],'name':'name_sms','fields':['name',_0xf1e2('0x13')]},{'unique':!![],'name':_0xf1e2('0x14'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x15')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf1e2('0x16')]},{'unique':!![],'name':_0xf1e2('0x17'),'fields':[_0xf1e2('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x60dd=['../../config/logger','api','bluebird','path','rimraf','exports','define','tools_dispositions','name','ListId','name_chat','MailAccountId','name_sms','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util'];(function(_0x2ae090,_0x4424e2){var _0x31b10f=function(_0x580272){while(--_0x580272){_0x2ae090['push'](_0x2ae090['shift']());}};_0x31b10f(++_0x4424e2);}(_0x60dd,0x1b9));var _0xd60d=function(_0xc2335a,_0x2dc8c6){_0xc2335a=_0xc2335a-0x0;var _0x36e129=_0x60dd[_0xc2335a];return _0x36e129;};'use strict';var _=require('lodash');var util=require(_0xd60d('0x0'));var logger=require(_0xd60d('0x1'))(_0xd60d('0x2'));var moment=require('moment');var BPromise=require(_0xd60d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd60d('0x4'));var rimraf=require(_0xd60d('0x5'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0xd60d('0x6')]=function(_0x3d5fa3,_0x8180a4){return _0x3d5fa3[_0xd60d('0x7')]('Disposition',attributes,{'tableName':_0xd60d('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd60d('0x9'),_0xd60d('0xa')]},{'unique':!![],'name':_0xd60d('0xb'),'fields':[_0xd60d('0x9'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0xd60d('0xc')]},{'unique':!![],'name':_0xd60d('0xd'),'fields':[_0xd60d('0x9'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xd60d('0x9'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xd60d('0x9'),_0xd60d('0xe')]},{'unique':!![],'name':_0xd60d('0xf'),'fields':[_0xd60d('0x9'),_0xd60d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c27393e..708163d 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(_0x5c98b9,_0x56430c){var _0x500eef=function(_0x7f39b7){while(--_0x7f39b7){_0x5c98b9['push'](_0x5c98b9['shift']());}};_0x500eef(++_0x56430c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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(_0x474b6e,_0x285f6a){var _0x357c98=function(_0x40b0c0){while(--_0x40b0c0){_0x474b6e['push'](_0x474b6e['shift']());}};_0x357c98(++_0x285f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 5253c31..ccd4a3e 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 _0xecc9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','get','/:id','create','put','update','destroy'];(function(_0xd94141,_0x3dff74){var _0x357c3d=function(_0x34a025){while(--_0x34a025){_0xd94141['push'](_0xd94141['shift']());}};_0x357c3d(++_0x3dff74);}(_0xecc9,0xcd));var _0x9ecc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xecc9[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x9ecc('0x0'));var util=require(_0x9ecc('0x1'));var path=require(_0x9ecc('0x2'));var timeout=require(_0x9ecc('0x3'));var express=require(_0x9ecc('0x4'));var router=express[_0x9ecc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9ecc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ecc('0x7'));var controller=require(_0x9ecc('0x8'));router['get']('/',auth[_0x9ecc('0x9')](),controller['index']);router[_0x9ecc('0xa')](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller['show']);router['post']('/',auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xc')]);router[_0x9ecc('0xd')](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xe')]);router['delete'](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xf')]);module[_0x9ecc('0x10')]=router; \ No newline at end of file +var _0xaf55=['index','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated'];(function(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0xaf55,0x1e3));var _0x5af5=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xaf55[_0x456fb1];return _0x4083d6;};'use strict';var multer=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var path=require(_0x5af5('0x2'));var timeout=require(_0x5af5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5af5('0x4'));var auth=require(_0x5af5('0x5'));var interaction=require(_0x5af5('0x6'));var config=require(_0x5af5('0x7'));var controller=require(_0x5af5('0x8'));router['get']('/',auth[_0x5af5('0x9')](),controller[_0x5af5('0xa')]);router['get'](_0x5af5('0xb'),auth[_0x5af5('0x9')](),controller['show']);router[_0x5af5('0xc')]('/',auth['isAuthenticated'](),controller[_0x5af5('0xd')]);router['put'](_0x5af5('0xb'),auth[_0x5af5('0x9')](),controller[_0x5af5('0xe')]);router[_0x5af5('0xf')](_0x5af5('0xb'),auth['isAuthenticated'](),controller[_0x5af5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4c24b8a..78510ea 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 _0x8ab0=['14400','12000','v17,v27,v29','INTEGER','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','7200','9600'];(function(_0x4d3005,_0x18de04){var _0x3953c6=function(_0x3248e1){while(--_0x3248e1){_0x4d3005['push'](_0x4d3005['shift']());}};_0x3953c6(++_0x18de04);}(_0x8ab0,0x8a));var _0x08ab=function(_0x344698,_0x1057a9){_0x344698=_0x344698-0x0;var _0x491ad2=_0x8ab0[_0x344698];return _0x491ad2;};'use strict';var Sequelize=require(_0x08ab('0x0'));module[_0x08ab('0x1')]={'name':{'type':Sequelize[_0x08ab('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x08ab('0x2')]},'ecm':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x4'),'no'),'defaultValue':_0x08ab('0x4')},'headerinfo':{'type':Sequelize[_0x08ab('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x5'),_0x08ab('0x6'),_0x08ab('0x7'),_0x08ab('0x8'),'12000',_0x08ab('0x9')),'defaultValue':_0x08ab('0x6')},'maxrate':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x5'),_0x08ab('0x6'),_0x08ab('0x7'),_0x08ab('0x8'),_0x08ab('0xa'),_0x08ab('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x08ab('0xb')},'gateway':{'type':Sequelize[_0x08ab('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x08ab('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x08ab('0x3')]('SIP','IAX','DADHI','KHOMP'),'defaultValue':_0x08ab('0xd')},'key':{'type':Sequelize[_0x08ab('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x08ab('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08ab('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x08ab('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![],'comment':_0x08ab('0x11'),'set':function(_0x2d084c){if(!_0x2d084c)this[_0x08ab('0x12')](_0x08ab('0x13'),null);this[_0x08ab('0x12')](_0x08ab('0x14'),_0x2d084c);}}}; \ No newline at end of file +var _0xf64e=['yes','2400','7200','12000','14400','4800','9600','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x2e3ae8,_0x3611b9){var _0x314157=function(_0x41b483){while(--_0x41b483){_0x2e3ae8['push'](_0x2e3ae8['shift']());}};_0x314157(++_0x3611b9);}(_0xf64e,0x6f));var _0xef64=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf64e[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xef64('0x0'));module[_0xef64('0x1')]={'name':{'type':Sequelize[_0xef64('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xef64('0x2')]},'ecm':{'type':Sequelize[_0xef64('0x3')](_0xef64('0x4'),'no'),'defaultValue':_0xef64('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xef64('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xef64('0x3')](_0xef64('0x5'),'4800',_0xef64('0x6'),'9600',_0xef64('0x7'),_0xef64('0x8')),'defaultValue':_0xef64('0x9')},'maxrate':{'type':Sequelize[_0xef64('0x3')](_0xef64('0x5'),_0xef64('0x9'),'7200',_0xef64('0xa'),'12000','14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xef64('0x2')],'defaultValue':_0xef64('0xb')},'gateway':{'type':Sequelize[_0xef64('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xef64('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xef64('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xef64('0x3')](_0xef64('0xd'),'IAX',_0xef64('0xe'),_0xef64('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xef64('0x10')],'defaultValue':function(){return _0xef64('0x11');}},'notificationSound':{'type':Sequelize[_0xef64('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef64('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef64('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef64('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xef64('0x13'),'set':function(_0x52dff8){if(!_0x52dff8)this[_0xef64('0x14')](_0xef64('0x15'),null);this[_0xef64('0x14')](_0xef64('0x16'),_0x52dff8);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b19d09a..ae91eb3 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 _0x04c1=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','save','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','type','filter','options','include','findAll','rows','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','getAnswers','order','removeAnswers','ids','omit','getInteractions','FaxInteraction','CmContact','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','localstationid','system','push','Answer','Set','ecm','gateway','faxdetect','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','update','VoiceExtension','tech','key','createdAt','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x04c1,0xc2));var _0x104c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x04c1[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x104c('0x0'));var zipdir=require(_0x104c('0x1'));var jsonpatch=require(_0x104c('0x2'));var rp=require('request-promise');var moment=require(_0x104c('0x3'));var BPromise=require(_0x104c('0x4'));var Mustache=require(_0x104c('0x5'));var util=require(_0x104c('0x6'));var path=require('path');var sox=require(_0x104c('0x7'));var csv=require('to-csv');var ejs=require(_0x104c('0x8'));var fs=require('fs');var fs_extra=require(_0x104c('0x9'));var _=require('lodash');var squel=require(_0x104c('0xa'));var crypto=require(_0x104c('0xb'));var jsforce=require(_0x104c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x104c('0xd'));var querystring=require(_0x104c('0xe'));var Papa=require(_0x104c('0xf'));var Redis=require(_0x104c('0x10'));var authService=require(_0x104c('0x11'));var qs=require(_0x104c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x104c('0x13'))(_0x104c('0x14'));var utils=require('../../config/utils');var config=require(_0x104c('0x15'));var licenseUtil=require(_0x104c('0x16'));var db=require(_0x104c('0x17'))['db'];config[_0x104c('0x18')]=_[_0x104c('0x19')](config[_0x104c('0x18')],{'host':_0x104c('0x1a'),'port':0x18eb});var socket=require(_0x104c('0x1b'))(new Redis(config[_0x104c('0x18')]));require('./faxAccount.socket')[_0x104c('0x1c')](socket);var jayson=require(_0x104c('0x1d'));var client=jayson[_0x104c('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x104c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e861,_0x7e37dd,_0x35e02d,_0x1318c1){return new BPromise(function(_0x418099,_0x2fbb1d){var _0x45ab44=_0x1318c1||client;return _0x45ab44[_0x104c('0x1f')](_0x59e861,_0x35e02d)[_0x104c('0x20')](function(_0x3a1c6c){logger[_0x104c('0x21')](_0x104c('0x22'),_0x7e37dd,_0x104c('0x23'));logger['debug'](_0x104c('0x24'),_0x7e37dd,_0x104c('0x23'),JSON[_0x104c('0x25')](_0x3a1c6c));if(_0x3a1c6c[_0x104c('0x26')]){if(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x27')]===0x1f4){logger[_0x104c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x7e37dd,_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);return _0x2fbb1d(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);}logger[_0x104c('0x26')](_0x104c('0x22'),_0x7e37dd,_0x3a1c6c[_0x104c('0x26')]['message']);return _0x418099(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);}else{logger[_0x104c('0x21')](_0x104c('0x22'),_0x7e37dd,_0x104c('0x23'));_0x418099(_0x3a1c6c['result']['message']);}})[_0x104c('0x29')](function(_0x220529){logger[_0x104c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x7e37dd,_0x220529);_0x2fbb1d(_0x220529);});});}function respondWithStatusCode(_0x1ea889,_0x5798a9){_0x5798a9=_0x5798a9||0xcc;return function(_0x6b7944){if(_0x6b7944){return _0x1ea889[_0x104c('0x2a')](_0x5798a9);}return _0x1ea889['status'](_0x5798a9)[_0x104c('0x2b')]();};}function respondWithResult(_0x2bac12,_0x5aaa9f){_0x5aaa9f=_0x5aaa9f||0xc8;return function(_0x1943e5){if(_0x1943e5){return _0x2bac12['status'](_0x5aaa9f)[_0x104c('0x2c')](_0x1943e5);}};}function respondWithFilteredResult(_0x240212,_0x18fb6e){return function(_0x3121a6){if(_0x3121a6){var _0x445704=typeof _0x18fb6e[_0x104c('0x2d')]==='undefined'&&typeof _0x18fb6e[_0x104c('0x2e')]==='undefined';var _0x37d004=_0x3121a6[_0x104c('0x2f')];var _0x568f92=_0x445704?0x0:_0x18fb6e[_0x104c('0x2d')];var _0xd56d71=_0x445704?_0x3121a6[_0x104c('0x2f')]:_0x18fb6e[_0x104c('0x2d')]+_0x18fb6e[_0x104c('0x2e')];var _0x2b159f;if(_0xd56d71>=_0x37d004){_0xd56d71=_0x37d004;_0x2b159f=0xc8;}else{_0x2b159f=0xce;}_0x240212[_0x104c('0x30')](_0x2b159f);return _0x240212[_0x104c('0x31')](_0x104c('0x32'),_0x568f92+'-'+_0xd56d71+'/'+_0x37d004)[_0x104c('0x2c')](_0x3121a6);}return null;};}function patchUpdates(_0x60b7e0){return function(_0x2e1c07){try{jsonpatch[_0x104c('0x33')](_0x2e1c07,_0x60b7e0,!![]);}catch(_0x2a8e52){return BPromise['reject'](_0x2a8e52);}return _0x2e1c07[_0x104c('0x34')]();};}function saveUpdates(_0x2871af,_0x1fe6a4){return function(_0x394984){if(_0x394984){return _0x394984['update'](_0x2871af)[_0x104c('0x20')](function(_0x41734b){return _0x41734b;});}return null;};}function removeEntity(_0x401c52,_0x28b6fe){return function(_0x3c5cd1){if(_0x3c5cd1){return _0x3c5cd1['destroy']()['then'](function(){var _0x21742c=_0x3c5cd1[_0x104c('0x35')]({'plain':!![]});var _0x55ffae=_0x104c('0x36');return db[_0x104c('0x37')][_0x104c('0x38')]({'where':{'type':_0x55ffae,'resourceId':_0x21742c['id']}})[_0x104c('0x20')](function(){return _0x3c5cd1;});})[_0x104c('0x20')](function(){_0x401c52[_0x104c('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cbc0,_0x41015b){return function(_0x20128d){if(!_0x20128d){_0x45cbc0['sendStatus'](0x194);}return _0x20128d;};}function handleError(_0x82f673,_0x2068d2){_0x2068d2=_0x2068d2||0x1f4;return function(_0x2f9db7){logger[_0x104c('0x26')](_0x2f9db7[_0x104c('0x39')]);if(_0x2f9db7[_0x104c('0x3a')]){delete _0x2f9db7[_0x104c('0x3a')];}_0x82f673[_0x104c('0x30')](_0x2068d2)[_0x104c('0x3b')](_0x2f9db7);};}exports[_0x104c('0x3c')]=function(_0x1ffe78,_0x230435){var _0x2b6ea5={'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]},_0x230b68={},_0x27af95={'count':0x0,'rows':[]};var _0x4cba3d=_[_0x104c('0x3f')](db[_0x104c('0x40')][_0x104c('0x41')],function(_0x65c434){return{'name':_0x65c434[_0x104c('0x42')],'type':_0x65c434['type']['key']};});_0x230b68['model']=_['map'](_0x4cba3d,'name');_0x230b68[_0x104c('0x43')]=_[_0x104c('0x44')](_0x1ffe78[_0x104c('0x43')]);_0x230b68['filters']=_[_0x104c('0x45')](_0x230b68[_0x104c('0x46')],_0x230b68['query']);_0x2b6ea5[_0x104c('0x47')]=_[_0x104c('0x45')](_0x230b68[_0x104c('0x46')],qs['fields'](_0x1ffe78['query'][_0x104c('0x48')]));_0x2b6ea5[_0x104c('0x47')]=_0x2b6ea5[_0x104c('0x47')][_0x104c('0x49')]?_0x2b6ea5[_0x104c('0x47')]:_0x230b68[_0x104c('0x46')];if(!_0x1ffe78['query'][_0x104c('0x4a')]('nolimit')){_0x2b6ea5[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0x1ffe78['query'][_0x104c('0x2e')]);_0x2b6ea5[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x1ffe78[_0x104c('0x43')]['offset']);}_0x2b6ea5['order']=qs[_0x104c('0x4b')](_0x1ffe78['query']['sort']);_0x2b6ea5[_0x104c('0x4c')]=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0x1ffe78['query'],_0x230b68[_0x104c('0x4d')]),_0x4cba3d);if(_0x1ffe78['query']['filter']){_0x2b6ea5['where']=_[_0x104c('0x4f')](_0x2b6ea5[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x4cba3d,function(_0x1c2065){if(_0x1c2065[_0x104c('0x50')]!=='VIRTUAL'){var _0x39cf85={};_0x39cf85[_0x1c2065[_0x104c('0x3a')]]={'$like':'%'+_0x1ffe78[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x39cf85;}})});}_0x2b6ea5=_[_0x104c('0x4f')]({},_0x2b6ea5,_0x1ffe78[_0x104c('0x52')]);var _0x4bef4a={'where':_0x2b6ea5['where']};return db[_0x104c('0x40')]['count'](_0x4bef4a)['then'](function(_0x4763ed){_0x27af95[_0x104c('0x2f')]=_0x4763ed;if(_0x1ffe78[_0x104c('0x43')]['includeAll']){_0x2b6ea5[_0x104c('0x53')]=[{'all':!![]}];}return db[_0x104c('0x40')][_0x104c('0x54')](_0x2b6ea5);})['then'](function(_0x241c82){_0x27af95[_0x104c('0x55')]=_0x241c82;return _0x27af95;})[_0x104c('0x20')](respondWithFilteredResult(_0x230435,_0x2b6ea5))['catch'](handleError(_0x230435,null));};exports['show']=function(_0x8a99a7,_0x1f6b30){var _0xdedf64={'raw':![],'where':{'id':_0x8a99a7[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]},_0x3a84a6={};_0x3a84a6[_0x104c('0x46')]=_['keys'](db[_0x104c('0x40')][_0x104c('0x41')]);_0x3a84a6['query']=_[_0x104c('0x44')](_0x8a99a7[_0x104c('0x43')]);_0x3a84a6[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x3a84a6[_0x104c('0x46')],_0x3a84a6['query']);_0xdedf64[_0x104c('0x47')]=_[_0x104c('0x45')](_0x3a84a6['model'],qs[_0x104c('0x48')](_0x8a99a7['query'][_0x104c('0x48')]));_0xdedf64['attributes']=_0xdedf64[_0x104c('0x47')]['length']?_0xdedf64[_0x104c('0x47')]:_0x3a84a6['model'];if(_0x8a99a7[_0x104c('0x43')][_0x104c('0x57')]){_0xdedf64['include']=[{'all':!![]}];}_0xdedf64=_[_0x104c('0x4f')]({},_0xdedf64,_0x8a99a7[_0x104c('0x52')]);return db[_0x104c('0x40')]['find'](_0xdedf64)[_0x104c('0x20')](handleEntityNotFound(_0x1f6b30,null))[_0x104c('0x20')](respondWithResult(_0x1f6b30,null))[_0x104c('0x29')](handleError(_0x1f6b30,null));};exports[_0x104c('0x58')]=function(_0x9b5b,_0x4af673){return db['FaxAccount'][_0x104c('0x58')](_0x9b5b[_0x104c('0x59')],{})[_0x104c('0x20')](function(_0x4f05d9){var _0x417e8a=_0x9b5b['user'][_0x104c('0x35')]({'plain':!![]});if(!_0x417e8a)throw new Error(_0x104c('0x5a'));if(_0x417e8a[_0x104c('0x5b')]===_0x104c('0x5c')){var _0x4f9b8e=_0x4f05d9[_0x104c('0x35')]({'plain':!![]});var _0x3294fd=_0x104c('0x36');return db[_0x104c('0x5d')][_0x104c('0x5e')]({'where':{'name':_0x3294fd,'userProfileId':_0x417e8a[_0x104c('0x5f')]},'raw':!![]})[_0x104c('0x20')](function(_0xafc2ca){if(_0xafc2ca&&_0xafc2ca[_0x104c('0x60')]===0x0){return db[_0x104c('0x37')]['create']({'name':_0x4f9b8e[_0x104c('0x3a')],'resourceId':_0x4f9b8e['id'],'type':_0xafc2ca[_0x104c('0x3a')],'sectionId':_0xafc2ca['id']},{})[_0x104c('0x20')](function(){return _0x4f05d9;});}else{return _0x4f05d9;}})['catch'](function(_0x49af07){logger[_0x104c('0x26')](_0x104c('0x61'),_0x49af07);throw _0x49af07;});}return _0x4f05d9;})[_0x104c('0x20')](respondWithResult(_0x4af673,0xc9))[_0x104c('0x29')](handleError(_0x4af673,null));};exports['update']=function(_0x3a2aac,_0x54b669){if(_0x3a2aac[_0x104c('0x59')]['id']){delete _0x3a2aac[_0x104c('0x59')]['id'];}return db['FaxAccount'][_0x104c('0x5e')]({'where':{'id':_0x3a2aac[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]})[_0x104c('0x20')](handleEntityNotFound(_0x54b669,null))[_0x104c('0x20')](saveUpdates(_0x3a2aac['body'],null))[_0x104c('0x20')](respondWithResult(_0x54b669,null))[_0x104c('0x29')](handleError(_0x54b669,null));};exports['destroy']=function(_0x314dd1,_0x1803d9){return db['FaxAccount'][_0x104c('0x5e')]({'where':{'id':_0x314dd1['params']['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x1803d9,null))[_0x104c('0x20')](removeEntity(_0x1803d9,null))[_0x104c('0x29')](handleError(_0x1803d9,null));};exports[_0x104c('0x62')]=function(_0x4758b0,_0x34ec00){return db[_0x104c('0x40')]['describe']()[_0x104c('0x20')](respondWithResult(_0x34ec00,null))[_0x104c('0x29')](handleError(_0x34ec00,null));};exports['addDisposition']=function(_0x54a046,_0x437f70,_0x3926b2){if(_0x54a046[_0x104c('0x59')]['id']){delete _0x54a046[_0x104c('0x59')]['id'];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x54a046[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x437f70,null))['then'](function(_0x4e9a24){if(_0x4e9a24){_0x54a046[_0x104c('0x59')][_0x104c('0x63')]=_0x4e9a24['id'];return db[_0x104c('0x64')][_0x104c('0x58')](_0x54a046[_0x104c('0x59')]);}})[_0x104c('0x20')](respondWithResult(_0x437f70,null))[_0x104c('0x29')](handleError(_0x437f70,null));};exports[_0x104c('0x65')]=function(_0x5dba25,_0x520f29,_0x52c2ab){var _0x150f9b={'raw':![],'where':{}};var _0x1cc80d={};var _0x5c26ec={'count':0x0,'rows':[]};return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x5dba25[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x520f29,null))[_0x104c('0x20')](function(_0x1dbd43){if(_0x1dbd43){_0x1cc80d[_0x104c('0x46')]=_[_0x104c('0x44')](db['Disposition']['rawAttributes']);_0x1cc80d[_0x104c('0x43')]=_[_0x104c('0x44')](_0x5dba25[_0x104c('0x43')]);_0x1cc80d['filters']=_[_0x104c('0x45')](_0x1cc80d[_0x104c('0x46')],_0x1cc80d[_0x104c('0x43')]);_0x150f9b[_0x104c('0x47')]=_[_0x104c('0x45')](_0x1cc80d[_0x104c('0x46')],qs[_0x104c('0x48')](_0x5dba25[_0x104c('0x43')][_0x104c('0x48')]));_0x150f9b[_0x104c('0x47')]=_0x150f9b[_0x104c('0x47')]['length']?_0x150f9b[_0x104c('0x47')]:_0x1cc80d['model'];if(!_0x5dba25[_0x104c('0x43')][_0x104c('0x4a')](_0x104c('0x67'))){_0x150f9b['limit']=qs[_0x104c('0x2e')](_0x5dba25[_0x104c('0x43')][_0x104c('0x2e')]);_0x150f9b['offset']=qs[_0x104c('0x2d')](_0x5dba25[_0x104c('0x43')]['offset']);}_0x150f9b['order']=qs[_0x104c('0x4b')](_0x5dba25['query'][_0x104c('0x4b')]);_0x150f9b['where']=qs['filters'](_[_0x104c('0x4e')](_0x5dba25['query'],_0x1cc80d[_0x104c('0x4d')]));_0x150f9b[_0x104c('0x4c')][_0x104c('0x63')]=_0x1dbd43['id'];if(_0x5dba25[_0x104c('0x43')][_0x104c('0x51')]){_0x150f9b[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x150f9b['where'],{'$or':_[_0x104c('0x3f')](_0x150f9b[_0x104c('0x47')],function(_0x123812){var _0x3ea180={};_0x3ea180[_0x123812]={'$like':'%'+_0x5dba25[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x3ea180;})});}_0x150f9b=_[_0x104c('0x4f')]({},_0x150f9b,_0x5dba25[_0x104c('0x52')]);return db[_0x104c('0x64')][_0x104c('0x2f')]({'where':_0x150f9b[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x31e0d2){_0x5c26ec['count']=_0x31e0d2;if(_0x5dba25[_0x104c('0x43')]['includeAll']){_0x150f9b[_0x104c('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x150f9b);})[_0x104c('0x20')](function(_0x186c55){_0x5c26ec['rows']=_0x186c55;return _0x5c26ec;});}})['then'](respondWithFilteredResult(_0x520f29,_0x150f9b))[_0x104c('0x29')](handleError(_0x520f29,null));};exports[_0x104c('0x68')]=function(_0x53d1e9,_0x1aa076,_0x884108){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x53d1e9[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x1aa076,null))['then'](function(_0x3cdaf0){if(_0x3cdaf0){return _0x3cdaf0[_0x104c('0x68')](_0x53d1e9[_0x104c('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1aa076,null))[_0x104c('0x29')](handleError(_0x1aa076,null));};exports['addAnswer']=function(_0x5e1c9e,_0x4ef3e6,_0x583854){if(_0x5e1c9e[_0x104c('0x59')]['id']){delete _0x5e1c9e[_0x104c('0x59')]['id'];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x5e1c9e[_0x104c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ef3e6,null))[_0x104c('0x20')](function(_0x277ae7){if(_0x277ae7){_0x5e1c9e['body']['FaxAccountId']=_0x277ae7['id'];return db[_0x104c('0x69')]['create'](_0x5e1c9e[_0x104c('0x59')]);}})[_0x104c('0x20')](respondWithResult(_0x4ef3e6,null))['catch'](handleError(_0x4ef3e6,null));};exports[_0x104c('0x6a')]=function(_0xd901e0,_0x40fabb,_0x358614){var _0x5e2e03={'raw':![],'where':{}};var _0x5f1b96={};var _0x24fb0e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xd901e0[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x40fabb,null))[_0x104c('0x20')](function(_0x5f381b){if(_0x5f381b){_0x5f1b96[_0x104c('0x46')]=_['keys'](db[_0x104c('0x69')]['rawAttributes']);_0x5f1b96[_0x104c('0x43')]=_[_0x104c('0x44')](_0xd901e0[_0x104c('0x43')]);_0x5f1b96['filters']=_[_0x104c('0x45')](_0x5f1b96[_0x104c('0x46')],_0x5f1b96[_0x104c('0x43')]);_0x5e2e03['attributes']=_['intersection'](_0x5f1b96[_0x104c('0x46')],qs[_0x104c('0x48')](_0xd901e0[_0x104c('0x43')][_0x104c('0x48')]));_0x5e2e03['attributes']=_0x5e2e03[_0x104c('0x47')]['length']?_0x5e2e03[_0x104c('0x47')]:_0x5f1b96[_0x104c('0x46')];if(!_0xd901e0[_0x104c('0x43')][_0x104c('0x4a')](_0x104c('0x67'))){_0x5e2e03[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0xd901e0[_0x104c('0x43')][_0x104c('0x2e')]);_0x5e2e03[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0xd901e0[_0x104c('0x43')][_0x104c('0x2d')]);}_0x5e2e03[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0xd901e0[_0x104c('0x43')][_0x104c('0x4b')]);_0x5e2e03[_0x104c('0x4c')]=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0xd901e0[_0x104c('0x43')],_0x5f1b96['filters']));_0x5e2e03[_0x104c('0x4c')][_0x104c('0x63')]=_0x5f381b['id'];if(_0xd901e0[_0x104c('0x43')][_0x104c('0x51')]){_0x5e2e03[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x5e2e03[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x5e2e03['attributes'],function(_0x2ea744){var _0x97005c={};_0x97005c[_0x2ea744]={'$like':'%'+_0xd901e0['query'][_0x104c('0x51')]+'%'};return _0x97005c;})});}_0x5e2e03=_[_0x104c('0x4f')]({},_0x5e2e03,_0xd901e0[_0x104c('0x52')]);return db[_0x104c('0x69')][_0x104c('0x2f')]({'where':_0x5e2e03['where']})[_0x104c('0x20')](function(_0x50c98a){_0x24fb0e['count']=_0x50c98a;if(_0xd901e0[_0x104c('0x43')][_0x104c('0x57')]){_0x5e2e03[_0x104c('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x104c('0x54')](_0x5e2e03);})[_0x104c('0x20')](function(_0x1c8061){_0x24fb0e[_0x104c('0x55')]=_0x1c8061;return _0x24fb0e;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x40fabb,_0x5e2e03))[_0x104c('0x29')](handleError(_0x40fabb,null));};exports['removeAnswers']=function(_0x5f44e6,_0x429275,_0x30bf1b){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x5f44e6[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x429275,null))[_0x104c('0x20')](function(_0x97a36e){if(_0x97a36e){return _0x97a36e[_0x104c('0x6c')](_0x5f44e6['query'][_0x104c('0x6d')]);}})[_0x104c('0x20')](respondWithStatusCode(_0x429275,null))[_0x104c('0x29')](handleError(_0x429275,null));};exports['addInteraction']=function(_0xcefb85,_0x5a83c4,_0x1c77e5){return db['FaxInteraction'][_0x104c('0x5e')]({'where':{'id':_0xcefb85[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x5a83c4,null))[_0x104c('0x20')](function(_0x5aaa6){if(_0x5aaa6){return _0x5aaa6['addInteraction'](_0xcefb85['body'][_0x104c('0x6d')],_[_0x104c('0x6e')](_0xcefb85[_0x104c('0x59')],[_0x104c('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x5a83c4,null))['catch'](handleError(_0x5a83c4,null));};exports[_0x104c('0x6f')]=function(_0x1aa0ae,_0x1db299,_0x2d1a5e){var _0x93b84b={'raw':![],'where':{}};var _0x7b294b={};var _0x4f568f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x104c('0x66')]({'where':{'id':_0x1aa0ae[_0x104c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1db299,null))[_0x104c('0x20')](function(_0x1bcb01){if(_0x1bcb01){_0x7b294b[_0x104c('0x46')]=_[_0x104c('0x44')](db['FaxInteraction']['rawAttributes']);_0x7b294b[_0x104c('0x43')]=_[_0x104c('0x44')](_0x1aa0ae[_0x104c('0x43')]);_0x7b294b[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x7b294b[_0x104c('0x46')],_0x7b294b['query']);_0x93b84b[_0x104c('0x47')]=_[_0x104c('0x45')](_0x7b294b[_0x104c('0x46')],qs['fields'](_0x1aa0ae['query']['fields']));_0x93b84b['attributes']=_0x93b84b[_0x104c('0x47')][_0x104c('0x49')]?_0x93b84b[_0x104c('0x47')]:_0x7b294b[_0x104c('0x46')];if(!_0x1aa0ae[_0x104c('0x43')]['hasOwnProperty'](_0x104c('0x67'))){_0x93b84b[_0x104c('0x2e')]=qs['limit'](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x2e')]);_0x93b84b[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x2d')]);}_0x93b84b[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x4b')]);_0x93b84b['where']=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0x1aa0ae[_0x104c('0x43')],_0x7b294b['filters']));_0x93b84b[_0x104c('0x4c')][_0x104c('0x63')]=_0x1bcb01['id'];if(_0x1aa0ae[_0x104c('0x43')]['filter']){_0x93b84b[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x93b84b[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x93b84b['attributes'],function(_0x22713b){var _0x5e5a2f={};_0x5e5a2f[_0x22713b]={'$like':'%'+_0x1aa0ae[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x5e5a2f;})});}_0x93b84b=_[_0x104c('0x4f')]({},_0x93b84b,_0x1aa0ae[_0x104c('0x52')]);return db[_0x104c('0x70')][_0x104c('0x2f')]({'where':_0x93b84b[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x257cd8){_0x4f568f[_0x104c('0x2f')]=_0x257cd8;if(_0x1aa0ae[_0x104c('0x43')]['includeAll']){_0x93b84b[_0x104c('0x53')]=[{'model':db[_0x104c('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x104c('0x72'),'attributes':[_0x104c('0x3a'),_0x104c('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x104c('0x74'),'attributes':['id',_0x104c('0x3a'),_0x104c('0x75')],'where':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]?{'id':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]}:undefined,'required':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0x104c('0x54')](_0x93b84b);})[_0x104c('0x20')](function(_0x216154){_0x4f568f[_0x104c('0x55')]=_0x216154;return _0x4f568f;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x1db299,_0x93b84b))[_0x104c('0x29')](handleError(_0x1db299,null));};exports[_0x104c('0x77')]=function(_0x2a3fc3,_0x4aef40){var _0x4fd504=_0x2a3fc3[_0x104c('0x56')]['id'];var _0x302b70=_0x2a3fc3[_0x104c('0x59')];var _0x20eb71=0xc8;var _0x16dcfa=null;return db[_0x104c('0x78')][_0x104c('0x79')]({'isolationLevel':db[_0x104c('0x78')][_0x104c('0x7a')][_0x104c('0x7b')][_0x104c('0x7c')]},function(_0x226c83){return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x4fd504},'transaction':_0x226c83})[_0x104c('0x20')](function(_0x412b2f){if(_0x412b2f){return db['FaxApplication'][_0x104c('0x38')]({'where':{'FaxAccountId':_0x4fd504},'transaction':_0x226c83})['then'](function(){var _0x343189=_['map'](_0x302b70,function(_0x43b82b){_0x43b82b['FaxAccountId']=_0x4fd504;return _0x43b82b;});return db[_0x104c('0x7d')][_0x104c('0x7e')](_0x343189,{'transaction':_0x226c83});});}else{_0x20eb71=0x194;_0x16dcfa=[];}});})['then'](function(){if(_0x20eb71!==0x194){return db[_0x104c('0x7d')][_0x104c('0x7f')]({'where':{'FaxAccountId':_0x4fd504},'order':_0x104c('0x80')})['then'](function(_0x5cf3c0){_0x16dcfa=_0x5cf3c0;});}})[_0x104c('0x29')](function(_0x1ab46e){_0x20eb71=0x1f4;logger[_0x104c('0x26')](_0x1ab46e[_0x104c('0x39')]);if(_0x1ab46e[_0x104c('0x3a')]){delete _0x1ab46e['name'];}_0x16dcfa=_0x1ab46e;})[_0x104c('0x81')](function(){if(_0x16dcfa===null){_0x4aef40['sendStatus'](_0x20eb71);}else{if(_0x20eb71===0x1f4){_0x4aef40[_0x104c('0x30')](_0x20eb71)['send'](_0x16dcfa);}else{_0x4aef40[_0x104c('0x30')](_0x20eb71)['json'](_0x16dcfa);}}});};exports[_0x104c('0x82')]=function(_0x462d23,_0xf9d249,_0x31712c){var _0x3af778={};var _0x153331={};var _0x19ba6c;var _0x4c70b9;return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x462d23[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0xf9d249,null))[_0x104c('0x20')](function(_0x375661){if(_0x375661){_0x19ba6c=_0x375661;_0x153331[_0x104c('0x46')]=_[_0x104c('0x44')](db[_0x104c('0x7d')]['rawAttributes']);_0x153331[_0x104c('0x43')]=_[_0x104c('0x44')](_0x462d23[_0x104c('0x43')]);_0x153331['filters']=_[_0x104c('0x45')](_0x153331[_0x104c('0x46')],_0x153331['query']);_0x3af778[_0x104c('0x47')]=_[_0x104c('0x45')](_0x153331[_0x104c('0x46')],qs[_0x104c('0x48')](_0x462d23[_0x104c('0x43')]['fields']));_0x3af778[_0x104c('0x47')]=_0x3af778[_0x104c('0x47')][_0x104c('0x49')]?_0x3af778[_0x104c('0x47')]:_0x153331[_0x104c('0x46')];_0x3af778['order']=qs[_0x104c('0x4b')](_0x462d23[_0x104c('0x43')][_0x104c('0x4b')]);_0x3af778[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x462d23[_0x104c('0x43')],_0x153331['filters']));if(_0x462d23[_0x104c('0x43')][_0x104c('0x51')]){_0x3af778[_0x104c('0x4c')]=_['merge'](_0x3af778[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x3af778[_0x104c('0x47')],function(_0x10f79b){var _0x1dbcb3={};_0x1dbcb3[_0x10f79b]={'$like':'%'+_0x462d23[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x1dbcb3;})});}_0x3af778=_[_0x104c('0x4f')]({},_0x3af778,_0x462d23['options']);return _0x19ba6c['getApplications'](_0x3af778);}})[_0x104c('0x20')](function(_0x462dd5){if(_0x462dd5){_0x4c70b9=_0x462dd5[_0x104c('0x49')];if(!_0x462d23[_0x104c('0x43')]['hasOwnProperty'](_0x104c('0x67'))){_0x3af778['limit']=qs[_0x104c('0x2e')](_0x462d23['query'][_0x104c('0x2e')]);_0x3af778[_0x104c('0x2d')]=qs['offset'](_0x462d23[_0x104c('0x43')][_0x104c('0x2d')]);}return _0x19ba6c[_0x104c('0x82')](_0x3af778);}})[_0x104c('0x20')](function(_0xc479ea){if(_0xc479ea){return _0xc479ea?{'count':_0x4c70b9,'rows':_0xc479ea}:null;}})[_0x104c('0x20')](respondWithResult(_0xf9d249,null))[_0x104c('0x29')](handleError(_0xf9d249,null));};function Extension(_0x548c78,_0x1c9165,_0xb0c677,_0x2ac75e){this[_0x104c('0x83')]='from-voip-provider';this[_0x104c('0x84')]=_0x548c78[_0x104c('0x85')];this['app']=_0x2ac75e;this[_0x104c('0x50')]=_0x104c('0x86');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x548c78['id'];this[_0x104c('0x80')]=_0x1c9165;this['appdata']=_0xb0c677;}function createExtensionsReciveFax(_0x4b5dc2){var _0x34ddf5=0x1;var _0x367e6b=[];_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'',_0x104c('0x88')));_0x34ddf5+=0x1;_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'CDR(type)=inbound-fax',_0x104c('0x89')));_0x34ddf5+=0x1;for(var _0xb40300 in _0x4b5dc2){if(_0x4b5dc2[_0x104c('0x4a')](_0xb40300)&&(_0xb40300===_0x104c('0x8a')||_0xb40300===_0x104c('0x85')||_0xb40300===_0x104c('0x8b')||_0xb40300===_0x104c('0x8c')||_0xb40300==='headerinfo'||_0xb40300==='maxrate'||_0xb40300===_0x104c('0x8d')||_0xb40300===_0x104c('0x8e')||_0xb40300==='t38timeout')){_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'FAXOPT('+_0xb40300+')='+_0x4b5dc2[_0xb40300],'Set'));_0x34ddf5+=0x1;}}_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'6',_0x104c('0x8f')));_0x34ddf5+=0x1;_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,_0x104c('0x90'),_0x104c('0x91')));_0x34ddf5=0x0;return _0x367e6b;}exports[_0x104c('0x92')]=function(_0x421787,_0x329c0b,_0x1d44db){var _0x25f8db;return db['sequelize']['transaction'](function(_0x918669){return db[_0x104c('0x40')][_0x104c('0x58')](_0x421787[_0x104c('0x59')],{'transaction':_0x918669})['then'](function(_0x3d0de8){_0x25f8db=_0x3d0de8[_0x104c('0x35')]({'plain':!![]});return db['VoiceExtension'][_0x104c('0x7e')](createExtensionsReciveFax(_0x25f8db),{'transaction':_0x918669});});})[_0x104c('0x20')](function(){return _0x25f8db;})[_0x104c('0x20')](respondWithResult(_0x329c0b,null))['catch'](handleError(_0x329c0b,null));};exports[_0x104c('0x93')]=function(_0x14dbde,_0x114040,_0x2188b9){var _0x774bf1;return db[_0x104c('0x78')][_0x104c('0x79')](function(_0x248952){return db[_0x104c('0x40')][_0x104c('0x94')](_0x14dbde[_0x104c('0x59')],{'where':{'id':_0x14dbde[_0x104c('0x59')]['id']},'transaction':_0x248952})[_0x104c('0x20')](function(_0x178ae0){return db[_0x104c('0x95')]['destroy']({'where':{'FaxAccountId':_0x14dbde[_0x104c('0x59')]['id']},'transaction':_0x248952})[_0x104c('0x20')](function(_0x17e58f){return db['VoiceExtension'][_0x104c('0x7e')](createExtensionsReciveFax(_[_0x104c('0x6e')](_0x14dbde[_0x104c('0x59')],[_0x104c('0x96'),_0x104c('0x97'),_0x104c('0x98'),'updatedAt',_0x104c('0x99'),'ListId'])),{'transaction':_0x248952});});});})[_0x104c('0x20')](function(){return db[_0x104c('0x40')][_0x104c('0x9a')](_0x14dbde[_0x104c('0x59')]['id']);})[_0x104c('0x20')](respondWithResult(_0x114040,null))[_0x104c('0x29')](handleError(_0x114040,null));};exports['getMessages']=function(_0x496db4,_0x3785fc,_0x33ed63){var _0x1bde01={'raw':!![],'where':{}};var _0x38e3c7={};var _0x332737={'count':0x0,'rows':[]};return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x496db4[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x3785fc,null))[_0x104c('0x20')](function(_0x2559cb){if(_0x2559cb){_0x38e3c7[_0x104c('0x46')]=_[_0x104c('0x44')](db[_0x104c('0x9b')][_0x104c('0x41')]);_0x38e3c7[_0x104c('0x43')]=_[_0x104c('0x44')](_0x496db4['query']);_0x38e3c7[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x38e3c7[_0x104c('0x46')],_0x38e3c7['query']);_0x1bde01['attributes']=_['intersection'](_0x38e3c7['model'],qs[_0x104c('0x48')](_0x496db4[_0x104c('0x43')]['fields']));_0x1bde01[_0x104c('0x47')]=_0x1bde01[_0x104c('0x47')][_0x104c('0x49')]?_0x1bde01[_0x104c('0x47')]:_0x38e3c7['model'];if(!_0x496db4[_0x104c('0x43')]['hasOwnProperty']('nolimit')){_0x1bde01[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0x496db4[_0x104c('0x43')][_0x104c('0x2e')]);_0x1bde01[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x496db4[_0x104c('0x43')]['offset']);}_0x1bde01[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0x496db4[_0x104c('0x43')][_0x104c('0x4b')]);_0x1bde01[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x496db4[_0x104c('0x43')],_0x38e3c7[_0x104c('0x4d')]));_0x1bde01[_0x104c('0x4c')]['FaxAccountId']=_0x2559cb['id'];if(_0x496db4[_0x104c('0x43')][_0x104c('0x51')]){_0x1bde01[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x1bde01['where'],{'$or':_[_0x104c('0x3f')](_0x1bde01[_0x104c('0x47')],function(_0x4feeec){var _0xf226ef={};_0xf226ef[_0x4feeec]={'$like':'%'+_0x496db4[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0xf226ef;})});}if(_0x496db4[_0x104c('0x43')]['$gte']){var _0x15f8a2=_0x496db4[_0x104c('0x43')][_0x104c('0x9c')][_0x104c('0x9d')](',');var _0xe47ec7={};_0xe47ec7[_0x15f8a2[0x0]]={'$gte':moment(_0x15f8a2[0x1])[_0x104c('0x9e')](_0x104c('0x9f'))};_0x1bde01[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x1bde01[_0x104c('0x4c')],_0xe47ec7);}_0x1bde01=_[_0x104c('0x4f')]({},_0x1bde01,_0x496db4['options']);return db[_0x104c('0x9b')][_0x104c('0x2f')]({'where':_0x1bde01[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x28918c){_0x332737[_0x104c('0x2f')]=_0x28918c;if(_0x496db4['query'][_0x104c('0x57')]){_0x1bde01[_0x104c('0x53')]=[{'all':!![]}];}return db[_0x104c('0x9b')][_0x104c('0x54')](_0x1bde01);})[_0x104c('0x20')](function(_0x1dece8){_0x332737[_0x104c('0x55')]=_0x1dece8;return _0x332737;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x3785fc,_0x1bde01))['catch'](handleError(_0x3785fc,null));};exports[_0x104c('0x3b')]=function(_0x3da497,_0x2653ca,_0x13c990){var _0x3692a3,_0x1fd836={},_0x295ba2;if(_0x3da497[_0x104c('0x59')]['to']){_0x295ba2=_0x3da497[_0x104c('0x59')]['to'][0x0];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x3da497[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0xa0')],'as':_0x104c('0xa1'),'include':[{'model':db[_0x104c('0x71')],'as':'Contacts','where':{'fax':_0x295ba2},'limit':0x1,'order':[[_0x104c('0xa2'),_0x104c('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x2653ca,null))['then'](function(_0x3a5384){_0x3692a3=_0x3a5384;if(_0x3da497['body'][_0x104c('0xa4')]&&_0x3da497[_0x104c('0x59')]['attachments']['length']){for(var _0x5f2c02=0x0;_0x5f2c02<_0x3da497[_0x104c('0x59')]['attachments'][_0x104c('0x49')];_0x5f2c02+=0x1){_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02]={'filename':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][_0x5f2c02][_0x104c('0x3a')],'id':_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02]['id'],'path':path['join'](config[_0x104c('0xa5')],_0x104c('0xa6'),_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02][_0x104c('0xa7')])};}}return respondWithRpcPromise(_0x104c('0xa8'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x3da497['params']['id'])?undefined:_0x3da497[_0x104c('0x56')]['id'],'path':_['isNil'](_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xa9')])?undefined:_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xa9')],'fax':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')]['to'][0x0])?undefined:_0x3da497['body']['to'][0x0]},client9002);})['then'](function(){if(_0x3692a3){if(_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')][_0x104c('0xab')])){_0x3da497[_0x104c('0x59')][_0x104c('0xab')]=util[_0x104c('0x9e')](_0x104c('0xac'),_0x3692a3[_0x104c('0x3a')],_0x3692a3[_0x104c('0xad')]);}if(_0x3692a3[_0x104c('0xa1')]){if(_0x3692a3[_0x104c('0xa1')][_0x104c('0xae')][_0x104c('0x49')]){return _0x3692a3[_0x104c('0xa1')][_0x104c('0xae')][0x0];}else{return db['CmContact'][_0x104c('0x58')](_[_0x104c('0x19')](_0x3da497['body'],{'firstName':_0x3da497[_0x104c('0x59')]['to'][0x0],'phone':_0x3da497['body']['to'][0x0],'fax':_0x3da497['body']['to'][0x0],'ListId':_0x3692a3[_0x104c('0xaf')]}));}}else{throw new Error(_0x104c('0xb0'));}}else{throw new Error(_0x104c('0xb1'));}})[_0x104c('0x20')](function(_0x3e1d28){if(_0x3e1d28){return db[_0x104c('0x70')][_0x104c('0x5e')]({'where':{'ContactId':_0x3e1d28['id'],'closed':![],'FaxAccountId':_0x3692a3['id']}})['then'](function(_0x3123e9){if(_0x3123e9){return[_0x3123e9,![]];}return db[_0x104c('0x70')][_0x104c('0x58')]({'UserId':_0x3da497['user']['id'],'ContactId':_0x3e1d28['id'],'FaxAccountId':_0x3692a3['id'],'fax':_0x3da497[_0x104c('0x59')]['to'][0x0],'firstMsgDirection':_0x104c('0xb2'),'Messages':[_['merge'](_0x3da497[_0x104c('0x59')],{'read':![],'body':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xb3')],'FaxAccountId':_0x3692a3['id'],'UserId':_0x3da497['user']['id'],'ContactId':_0x3e1d28['id'],'AttachmentId':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x104c('0x9b')],'as':_0x104c('0xb4')}]})[_0x104c('0x20')](function(_0x2447cb){return[_0x2447cb,!![]];});});}else{throw new Error(_0x104c('0xb5'));}})[_0x104c('0xb6')](function(_0x877ba7,_0x3af9a7){if(_0x3af9a7){return _0x877ba7;}return db['FaxMessage'][_0x104c('0x58')]({'direction':_0x104c('0xb2'),'read':![],'body':_0x3da497['body'][_0x104c('0xa4')][0x0][_0x104c('0xb3')],'FaxAccountId':_0x3692a3['id'],'FaxInteractionId':_0x877ba7['id'],'UserId':_0x3da497[_0x104c('0x5c')]['id'],'ContactId':_0x877ba7[_0x104c('0xb7')],'AttachmentId':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0]['id']})[_0x104c('0x20')](function(_0x26f101){_0x877ba7['dataValues'][_0x104c('0xb4')]=[];_0x877ba7[_0x104c('0xb8')][_0x104c('0xb4')]['push'](_0x26f101['dataValues']);return _0x877ba7;});})[_0x104c('0x20')](function(_0x5ba752){respondWithRpcPromise(_0x104c('0xb9'),_0x104c('0xb9'),{'FaxAccountId':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x56')]['id'])?undefined:_0x3da497['params']['id'],'path':_[_0x104c('0xaa')](_0x3da497['body']['attachments'][0x0][_0x104c('0xa9')])?undefined:_0x3da497[_0x104c('0x59')]['attachments'][0x0][_0x104c('0xa9')],'fax':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')]['to'][0x0])?undefined:_0x3da497['body']['to'][0x0],'AttachmentId':_0x3da497['body']['attachments'][0x0]['id']},client9002)[_0x104c('0x20')](function(_0x314e4d){logger[_0x104c('0x21')](_0x104c('0xba'),_0x314e4d);})[_0x104c('0x29')](function(_0x1b94c1){logger['info'](_0x104c('0xba'),_0x1b94c1);});return _0x5ba752;})['then'](respondWithResult(_0x2653ca,null))[_0x104c('0x29')](handleError(_0x2653ca,null));};exports[_0x104c('0xbb')]=function(_0x525441,_0x3c4ca1,_0x4c76bc){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x525441[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x3c4ca1,null))[_0x104c('0x20')](function(_0x19023d){if(_0x19023d){return _0x19023d[_0x104c('0xbb')](_0x525441[_0x104c('0x59')][_0x104c('0x6d')],_[_0x104c('0x6e')](_0x525441[_0x104c('0x59')],[_0x104c('0x6d'),'id'])||{})[_0x104c('0xb6')](function(_0x2f183e){for(var _0x191ccb=0x0;_0x191ccb<_0x525441[_0x104c('0x59')]['ids'][_0x104c('0x49')];_0x191ccb+=0x1){socket[_0x104c('0xbc')](_0x104c('0xbd'),{'UserId':Number(_0x525441[_0x104c('0x59')]['ids'][_0x191ccb]),'FaxAccountId':Number(_0x525441[_0x104c('0x56')]['id'])});}return _0x2f183e;});}})[_0x104c('0x20')](respondWithResult(_0x3c4ca1,null))[_0x104c('0x29')](handleError(_0x3c4ca1,null));};exports[_0x104c('0xbe')]=function(_0x3ec774,_0x5c9a9a,_0x7b3d14){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x3ec774[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x5c9a9a,null))[_0x104c('0x20')](function(_0x22b167){if(_0x22b167){return _0x22b167['removeAgents'](_0x3ec774['query'][_0x104c('0x6d')])[_0x104c('0x20')](function(){if(_[_0x104c('0xbf')](_0x3ec774[_0x104c('0x43')][_0x104c('0x6d')])){for(var _0x1abae5=0x0;_0x1abae5<_0x3ec774['query'][_0x104c('0x6d')][_0x104c('0x49')];_0x1abae5+=0x1){socket[_0x104c('0xbc')](_0x104c('0xc0'),{'UserId':Number(_0x3ec774['query']['ids'][_0x1abae5]),'FaxAccountId':Number(_0x3ec774[_0x104c('0x56')]['id'])});}}else{socket[_0x104c('0xbc')](_0x104c('0xc0'),{'UserId':Number(_0x3ec774[_0x104c('0x43')][_0x104c('0x6d')]),'FaxAccountId':Number(_0x3ec774[_0x104c('0x56')]['id'])});}});}})[_0x104c('0x20')](respondWithStatusCode(_0x5c9a9a,null))[_0x104c('0x29')](handleError(_0x5c9a9a,null));};exports['getAgents']=function(_0x5b374e,_0x437061,_0x38e132){var _0xdc1d98={};var _0x4ca0bd={};var _0x2c427a;var _0x7daf55;return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x5b374e[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x437061,null))[_0x104c('0x20')](function(_0x4a7147){if(_0x4a7147){_0x2c427a=_0x4a7147;_0x4ca0bd[_0x104c('0x46')]=_[_0x104c('0x44')](db['User'][_0x104c('0x41')]);_0x4ca0bd[_0x104c('0x43')]=_[_0x104c('0x44')](_0x5b374e[_0x104c('0x43')]);_0x4ca0bd[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x4ca0bd[_0x104c('0x46')],_0x4ca0bd[_0x104c('0x43')]);_0xdc1d98[_0x104c('0x47')]=_[_0x104c('0x45')](_0x4ca0bd[_0x104c('0x46')],qs[_0x104c('0x48')](_0x5b374e[_0x104c('0x43')][_0x104c('0x48')]));_0xdc1d98[_0x104c('0x47')]=_0xdc1d98[_0x104c('0x47')][_0x104c('0x49')]?_0xdc1d98[_0x104c('0x47')]:_0x4ca0bd[_0x104c('0x46')];_0xdc1d98['order']=qs[_0x104c('0x4b')](_0x5b374e[_0x104c('0x43')][_0x104c('0x4b')]);_0xdc1d98[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x5b374e['query'],_0x4ca0bd[_0x104c('0x4d')]));if(_0x5b374e[_0x104c('0x43')][_0x104c('0x51')]){_0xdc1d98['where']=_['merge'](_0xdc1d98['where'],{'$or':_[_0x104c('0x3f')](_0xdc1d98[_0x104c('0x47')],function(_0x278822){var _0x517c2b={};_0x517c2b[_0x278822]={'$like':'%'+_0x5b374e[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x517c2b;})});}_0xdc1d98=_[_0x104c('0x4f')]({},_0xdc1d98,_0x5b374e[_0x104c('0x52')]);return _0x2c427a[_0x104c('0xc1')](_0xdc1d98);}})['then'](function(_0x5cf3cc){if(_0x5cf3cc){_0x7daf55=_0x5cf3cc['length'];if(!_0x5b374e['query'][_0x104c('0x4a')](_0x104c('0x67'))){_0xdc1d98['limit']=qs[_0x104c('0x2e')](_0x5b374e[_0x104c('0x43')][_0x104c('0x2e')]);_0xdc1d98[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x5b374e[_0x104c('0x43')][_0x104c('0x2d')]);}return _0x2c427a[_0x104c('0xc1')](_0xdc1d98);}})[_0x104c('0x20')](function(_0x30afb3){if(_0x30afb3){return _0x30afb3?{'count':_0x7daf55,'rows':_0x30afb3}:null;}})[_0x104c('0x20')](respondWithResult(_0x437061,null))[_0x104c('0x29')](handleError(_0x437061,null));}; \ No newline at end of file +var _0x9a6f=['defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','addInteraction','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','localstationid','app','system','description','appdata','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x185514,_0x1cfef2){var _0x3d3945=function(_0x26df83){while(--_0x26df83){_0x185514['push'](_0x185514['shift']());}};_0x3d3945(++_0x1cfef2);}(_0x9a6f,0xb3));var _0xf9a6=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x9a6f[_0x456fb1];return _0x4083d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf9a6('0x0'));var zipdir=require(_0xf9a6('0x1'));var jsonpatch=require(_0xf9a6('0x2'));var rp=require('request-promise');var moment=require(_0xf9a6('0x3'));var BPromise=require(_0xf9a6('0x4'));var Mustache=require('mustache');var util=require(_0xf9a6('0x5'));var path=require(_0xf9a6('0x6'));var sox=require('sox');var csv=require(_0xf9a6('0x7'));var ejs=require(_0xf9a6('0x8'));var fs=require('fs');var fs_extra=require(_0xf9a6('0x9'));var _=require(_0xf9a6('0xa'));var squel=require(_0xf9a6('0xb'));var crypto=require(_0xf9a6('0xc'));var jsforce=require(_0xf9a6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf9a6('0xe'));var Papa=require(_0xf9a6('0xf'));var Redis=require(_0xf9a6('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9a6('0x11'));var hardwareService=require(_0xf9a6('0x12'));var logger=require(_0xf9a6('0x13'))(_0xf9a6('0x14'));var utils=require(_0xf9a6('0x15'));var config=require(_0xf9a6('0x16'));var licenseUtil=require(_0xf9a6('0x17'));var db=require('../../mysqldb')['db'];config[_0xf9a6('0x18')]=_[_0xf9a6('0x19')](config[_0xf9a6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9a6('0x1a'))(new Redis(config[_0xf9a6('0x18')]));require(_0xf9a6('0x1b'))[_0xf9a6('0x1c')](socket);var jayson=require(_0xf9a6('0x1d'));var client=jayson[_0xf9a6('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0xf9a6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x44c149,_0x15313d,_0x598617,_0x2850f4){return new BPromise(function(_0x34741c,_0x48c03e){var _0x198c75=_0x2850f4||client;return _0x198c75[_0xf9a6('0x20')](_0x44c149,_0x598617)[_0xf9a6('0x21')](function(_0x360088){logger['info']('FaxAccount,\x20%s,\x20%s',_0x15313d,_0xf9a6('0x22'));logger[_0xf9a6('0x23')](_0xf9a6('0x24'),_0x15313d,'request\x20sent',JSON[_0xf9a6('0x25')](_0x360088));if(_0x360088[_0xf9a6('0x26')]){if(_0x360088[_0xf9a6('0x26')][_0xf9a6('0x27')]===0x1f4){logger[_0xf9a6('0x26')](_0xf9a6('0x28'),_0x15313d,_0x360088[_0xf9a6('0x26')][_0xf9a6('0x29')]);return _0x48c03e(_0x360088[_0xf9a6('0x26')]['message']);}logger[_0xf9a6('0x26')](_0xf9a6('0x28'),_0x15313d,_0x360088['error']['message']);return _0x34741c(_0x360088[_0xf9a6('0x26')][_0xf9a6('0x29')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x15313d,_0xf9a6('0x22'));_0x34741c(_0x360088[_0xf9a6('0x2a')][_0xf9a6('0x29')]);}})['catch'](function(_0x3cf7bb){logger[_0xf9a6('0x26')](_0xf9a6('0x28'),_0x15313d,_0x3cf7bb);_0x48c03e(_0x3cf7bb);});});}function respondWithStatusCode(_0x685b35,_0x5e14a8){_0x5e14a8=_0x5e14a8||0xcc;return function(_0x377051){if(_0x377051){return _0x685b35[_0xf9a6('0x2b')](_0x5e14a8);}return _0x685b35[_0xf9a6('0x2c')](_0x5e14a8)[_0xf9a6('0x2d')]();};}function respondWithResult(_0xd67320,_0x582a26){_0x582a26=_0x582a26||0xc8;return function(_0x47f0a6){if(_0x47f0a6){return _0xd67320[_0xf9a6('0x2c')](_0x582a26)[_0xf9a6('0x2e')](_0x47f0a6);}};}function respondWithFilteredResult(_0x1b7083,_0x25c76b){return function(_0x3cacee){if(_0x3cacee){var _0x54c77a=typeof _0x25c76b[_0xf9a6('0x2f')]===_0xf9a6('0x30')&&typeof _0x25c76b[_0xf9a6('0x31')]===_0xf9a6('0x30');var _0x5c1d84=_0x3cacee[_0xf9a6('0x32')];var _0x4a97e8=_0x54c77a?0x0:_0x25c76b[_0xf9a6('0x2f')];var _0x515384=_0x54c77a?_0x3cacee[_0xf9a6('0x32')]:_0x25c76b[_0xf9a6('0x2f')]+_0x25c76b[_0xf9a6('0x31')];var _0x5b9ea7;if(_0x515384>=_0x5c1d84){_0x515384=_0x5c1d84;_0x5b9ea7=0xc8;}else{_0x5b9ea7=0xce;}_0x1b7083['status'](_0x5b9ea7);return _0x1b7083[_0xf9a6('0x33')](_0xf9a6('0x34'),_0x4a97e8+'-'+_0x515384+'/'+_0x5c1d84)[_0xf9a6('0x2e')](_0x3cacee);}return null;};}function patchUpdates(_0x255be3){return function(_0x5f330a){try{jsonpatch['apply'](_0x5f330a,_0x255be3,!![]);}catch(_0xe78f22){return BPromise[_0xf9a6('0x35')](_0xe78f22);}return _0x5f330a[_0xf9a6('0x36')]();};}function saveUpdates(_0x146561,_0x2108c7){return function(_0x59a457){if(_0x59a457){return _0x59a457['update'](_0x146561)[_0xf9a6('0x21')](function(_0x350750){return _0x350750;});}return null;};}function removeEntity(_0x561d26,_0x33bde7){return function(_0x159c7d){if(_0x159c7d){return _0x159c7d['destroy']()['then'](function(){var _0xdc7924=_0x159c7d[_0xf9a6('0x37')]({'plain':!![]});var _0x455eb7='FaxAccounts';return db[_0xf9a6('0x38')]['destroy']({'where':{'type':_0x455eb7,'resourceId':_0xdc7924['id']}})['then'](function(){return _0x159c7d;});})[_0xf9a6('0x21')](function(){_0x561d26[_0xf9a6('0x2c')](0xcc)[_0xf9a6('0x2d')]();});}};}function handleEntityNotFound(_0x2dc6ff,_0x41b3ac){return function(_0x21eb20){if(!_0x21eb20){_0x2dc6ff[_0xf9a6('0x2b')](0x194);}return _0x21eb20;};}function handleError(_0x1f4cb0,_0x54a56b){_0x54a56b=_0x54a56b||0x1f4;return function(_0x255031){logger[_0xf9a6('0x26')](_0x255031[_0xf9a6('0x39')]);if(_0x255031[_0xf9a6('0x3a')]){delete _0x255031[_0xf9a6('0x3a')];}_0x1f4cb0[_0xf9a6('0x2c')](_0x54a56b)[_0xf9a6('0x3b')](_0x255031);};}exports[_0xf9a6('0x3c')]=function(_0x3fe401,_0x4fc9f2){var _0x211dbb={'include':[{'model':db[_0xf9a6('0x3d')],'as':_0xf9a6('0x3e')}]},_0x3f65c8={},_0x57d16d={'count':0x0,'rows':[]};var _0x4d6d7d=_[_0xf9a6('0x3f')](db[_0xf9a6('0x40')]['rawAttributes'],function(_0x4b8da6){return{'name':_0x4b8da6[_0xf9a6('0x41')],'type':_0x4b8da6[_0xf9a6('0x42')][_0xf9a6('0x43')]};});_0x3f65c8[_0xf9a6('0x44')]=_['map'](_0x4d6d7d,'name');_0x3f65c8[_0xf9a6('0x45')]=_['keys'](_0x3fe401[_0xf9a6('0x45')]);_0x3f65c8[_0xf9a6('0x46')]=_[_0xf9a6('0x47')](_0x3f65c8['model'],_0x3f65c8[_0xf9a6('0x45')]);_0x211dbb[_0xf9a6('0x48')]=_[_0xf9a6('0x47')](_0x3f65c8[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x3fe401['query'][_0xf9a6('0x49')]));_0x211dbb[_0xf9a6('0x48')]=_0x211dbb[_0xf9a6('0x48')][_0xf9a6('0x4a')]?_0x211dbb['attributes']:_0x3f65c8[_0xf9a6('0x44')];if(!_0x3fe401[_0xf9a6('0x45')][_0xf9a6('0x4b')](_0xf9a6('0x4c'))){_0x211dbb['limit']=qs['limit'](_0x3fe401[_0xf9a6('0x45')]['limit']);_0x211dbb[_0xf9a6('0x2f')]=qs[_0xf9a6('0x2f')](_0x3fe401[_0xf9a6('0x45')]['offset']);}_0x211dbb['order']=qs[_0xf9a6('0x4d')](_0x3fe401[_0xf9a6('0x45')][_0xf9a6('0x4d')]);_0x211dbb['where']=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x3fe401[_0xf9a6('0x45')],_0x3f65c8['filters']),_0x4d6d7d);if(_0x3fe401[_0xf9a6('0x45')][_0xf9a6('0x4f')]){_0x211dbb[_0xf9a6('0x50')]=_[_0xf9a6('0x51')](_0x211dbb[_0xf9a6('0x50')],{'$or':_['map'](_0x4d6d7d,function(_0x3644cb){if(_0x3644cb['type']!==_0xf9a6('0x52')){var _0x5e265a={};_0x5e265a[_0x3644cb[_0xf9a6('0x3a')]]={'$like':'%'+_0x3fe401[_0xf9a6('0x45')][_0xf9a6('0x4f')]+'%'};return _0x5e265a;}})});}_0x211dbb=_[_0xf9a6('0x51')]({},_0x211dbb,_0x3fe401[_0xf9a6('0x53')]);var _0x6c9cd6={'where':_0x211dbb['where']};return db['FaxAccount'][_0xf9a6('0x32')](_0x6c9cd6)[_0xf9a6('0x21')](function(_0x45cc07){_0x57d16d[_0xf9a6('0x32')]=_0x45cc07;if(_0x3fe401[_0xf9a6('0x45')][_0xf9a6('0x54')]){_0x211dbb['include']=[{'all':!![]}];}return db[_0xf9a6('0x40')][_0xf9a6('0x55')](_0x211dbb);})[_0xf9a6('0x21')](function(_0x15e7c1){_0x57d16d[_0xf9a6('0x56')]=_0x15e7c1;return _0x57d16d;})['then'](respondWithFilteredResult(_0x4fc9f2,_0x211dbb))[_0xf9a6('0x57')](handleError(_0x4fc9f2,null));};exports[_0xf9a6('0x58')]=function(_0x1c5182,_0x19abee){var _0x35673b={'raw':![],'where':{'id':_0x1c5182[_0xf9a6('0x59')]['id']},'include':[{'model':db[_0xf9a6('0x3d')],'as':_0xf9a6('0x3e')}]},_0x1f809b={};_0x1f809b[_0xf9a6('0x44')]=_[_0xf9a6('0x5a')](db[_0xf9a6('0x40')][_0xf9a6('0x5b')]);_0x1f809b[_0xf9a6('0x45')]=_[_0xf9a6('0x5a')](_0x1c5182[_0xf9a6('0x45')]);_0x1f809b[_0xf9a6('0x46')]=_['intersection'](_0x1f809b[_0xf9a6('0x44')],_0x1f809b[_0xf9a6('0x45')]);_0x35673b['attributes']=_[_0xf9a6('0x47')](_0x1f809b[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x1c5182[_0xf9a6('0x45')][_0xf9a6('0x49')]));_0x35673b[_0xf9a6('0x48')]=_0x35673b['attributes'][_0xf9a6('0x4a')]?_0x35673b['attributes']:_0x1f809b[_0xf9a6('0x44')];if(_0x1c5182['query']['includeAll']){_0x35673b[_0xf9a6('0x5c')]=[{'all':!![]}];}_0x35673b=_[_0xf9a6('0x51')]({},_0x35673b,_0x1c5182['options']);return db[_0xf9a6('0x40')]['find'](_0x35673b)[_0xf9a6('0x21')](handleEntityNotFound(_0x19abee,null))[_0xf9a6('0x21')](respondWithResult(_0x19abee,null))[_0xf9a6('0x57')](handleError(_0x19abee,null));};exports['create']=function(_0x877266,_0x248da5){return db[_0xf9a6('0x40')]['create'](_0x877266[_0xf9a6('0x5d')],{})[_0xf9a6('0x21')](function(_0x43938a){var _0x2da431=_0x877266[_0xf9a6('0x5e')][_0xf9a6('0x37')]({'plain':!![]});if(!_0x2da431)throw new Error(_0xf9a6('0x5f'));if(_0x2da431['role']===_0xf9a6('0x5e')){var _0x1d40cf=_0x43938a[_0xf9a6('0x37')]({'plain':!![]});var _0x330590=_0xf9a6('0x60');return db[_0xf9a6('0x61')][_0xf9a6('0x62')]({'where':{'name':_0x330590,'userProfileId':_0x2da431['userProfileId']},'raw':!![]})['then'](function(_0x4dd856){if(_0x4dd856&&_0x4dd856['autoAssociation']===0x0){return db[_0xf9a6('0x38')][_0xf9a6('0x63')]({'name':_0x1d40cf[_0xf9a6('0x3a')],'resourceId':_0x1d40cf['id'],'type':_0x4dd856['name'],'sectionId':_0x4dd856['id']},{})[_0xf9a6('0x21')](function(){return _0x43938a;});}else{return _0x43938a;}})[_0xf9a6('0x57')](function(_0x42f47a){logger['error'](_0xf9a6('0x64'),_0x42f47a);throw _0x42f47a;});}return _0x43938a;})[_0xf9a6('0x21')](respondWithResult(_0x248da5,0xc9))[_0xf9a6('0x57')](handleError(_0x248da5,null));};exports[_0xf9a6('0x65')]=function(_0x254424,_0x402172){if(_0x254424[_0xf9a6('0x5d')]['id']){delete _0x254424[_0xf9a6('0x5d')]['id'];}return db[_0xf9a6('0x40')]['find']({'where':{'id':_0x254424[_0xf9a6('0x59')]['id']},'include':[{'model':db[_0xf9a6('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x402172,null))[_0xf9a6('0x21')](saveUpdates(_0x254424['body'],null))[_0xf9a6('0x21')](respondWithResult(_0x402172,null))[_0xf9a6('0x57')](handleError(_0x402172,null));};exports[_0xf9a6('0x66')]=function(_0x30f69d,_0x3e1f47){return db[_0xf9a6('0x40')][_0xf9a6('0x62')]({'where':{'id':_0x30f69d[_0xf9a6('0x59')]['id']}})['then'](handleEntityNotFound(_0x3e1f47,null))[_0xf9a6('0x21')](removeEntity(_0x3e1f47,null))[_0xf9a6('0x57')](handleError(_0x3e1f47,null));};exports['describe']=function(_0x3a4915,_0x454906){return db['FaxAccount'][_0xf9a6('0x67')]()[_0xf9a6('0x21')](respondWithResult(_0x454906,null))[_0xf9a6('0x57')](handleError(_0x454906,null));};exports[_0xf9a6('0x68')]=function(_0x275175,_0x16e07a,_0x5c653b){if(_0x275175['body']['id']){delete _0x275175['body']['id'];}return db[_0xf9a6('0x40')][_0xf9a6('0x62')]({'where':{'id':_0x275175[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x16e07a,null))[_0xf9a6('0x21')](function(_0x425a1a){if(_0x425a1a){_0x275175['body']['FaxAccountId']=_0x425a1a['id'];return db[_0xf9a6('0x69')][_0xf9a6('0x63')](_0x275175['body']);}})[_0xf9a6('0x21')](respondWithResult(_0x16e07a,null))['catch'](handleError(_0x16e07a,null));};exports[_0xf9a6('0x6a')]=function(_0x1b2e1c,_0x3e7a5e,_0x1bce3f){var _0x2348fa={'raw':![],'where':{}};var _0x519cc3={};var _0x336d85={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf9a6('0x6b')]({'where':{'id':_0x1b2e1c[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x3e7a5e,null))[_0xf9a6('0x21')](function(_0x14e031){if(_0x14e031){_0x519cc3['model']=_[_0xf9a6('0x5a')](db[_0xf9a6('0x69')][_0xf9a6('0x5b')]);_0x519cc3['query']=_['keys'](_0x1b2e1c[_0xf9a6('0x45')]);_0x519cc3[_0xf9a6('0x46')]=_[_0xf9a6('0x47')](_0x519cc3[_0xf9a6('0x44')],_0x519cc3[_0xf9a6('0x45')]);_0x2348fa[_0xf9a6('0x48')]=_['intersection'](_0x519cc3['model'],qs['fields'](_0x1b2e1c[_0xf9a6('0x45')]['fields']));_0x2348fa[_0xf9a6('0x48')]=_0x2348fa[_0xf9a6('0x48')][_0xf9a6('0x4a')]?_0x2348fa['attributes']:_0x519cc3['model'];if(!_0x1b2e1c[_0xf9a6('0x45')][_0xf9a6('0x4b')]('nolimit')){_0x2348fa['limit']=qs['limit'](_0x1b2e1c[_0xf9a6('0x45')][_0xf9a6('0x31')]);_0x2348fa[_0xf9a6('0x2f')]=qs[_0xf9a6('0x2f')](_0x1b2e1c['query'][_0xf9a6('0x2f')]);}_0x2348fa['order']=qs[_0xf9a6('0x4d')](_0x1b2e1c[_0xf9a6('0x45')][_0xf9a6('0x4d')]);_0x2348fa[_0xf9a6('0x50')]=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x1b2e1c[_0xf9a6('0x45')],_0x519cc3[_0xf9a6('0x46')]));_0x2348fa[_0xf9a6('0x50')][_0xf9a6('0x6c')]=_0x14e031['id'];if(_0x1b2e1c[_0xf9a6('0x45')]['filter']){_0x2348fa[_0xf9a6('0x50')]=_[_0xf9a6('0x51')](_0x2348fa[_0xf9a6('0x50')],{'$or':_[_0xf9a6('0x3f')](_0x2348fa[_0xf9a6('0x48')],function(_0x458090){var _0xf2dc1e={};_0xf2dc1e[_0x458090]={'$like':'%'+_0x1b2e1c['query'][_0xf9a6('0x4f')]+'%'};return _0xf2dc1e;})});}_0x2348fa=_[_0xf9a6('0x51')]({},_0x2348fa,_0x1b2e1c[_0xf9a6('0x53')]);return db[_0xf9a6('0x69')][_0xf9a6('0x32')]({'where':_0x2348fa[_0xf9a6('0x50')]})[_0xf9a6('0x21')](function(_0x12ea21){_0x336d85[_0xf9a6('0x32')]=_0x12ea21;if(_0x1b2e1c[_0xf9a6('0x45')][_0xf9a6('0x54')]){_0x2348fa[_0xf9a6('0x5c')]=[{'all':!![]}];}return db[_0xf9a6('0x69')][_0xf9a6('0x55')](_0x2348fa);})['then'](function(_0x3fef20){_0x336d85['rows']=_0x3fef20;return _0x336d85;});}})[_0xf9a6('0x21')](respondWithFilteredResult(_0x3e7a5e,_0x2348fa))[_0xf9a6('0x57')](handleError(_0x3e7a5e,null));};exports[_0xf9a6('0x6d')]=function(_0x3e521b,_0x4572c6,_0x2d8693){return db[_0xf9a6('0x40')][_0xf9a6('0x62')]({'where':{'id':_0x3e521b[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x4572c6,null))[_0xf9a6('0x21')](function(_0x565655){if(_0x565655){return _0x565655[_0xf9a6('0x6d')](_0x3e521b[_0xf9a6('0x45')][_0xf9a6('0x6e')]);}})[_0xf9a6('0x21')](respondWithStatusCode(_0x4572c6,null))['catch'](handleError(_0x4572c6,null));};exports[_0xf9a6('0x6f')]=function(_0x4ccc76,_0x5770c5,_0x613535){if(_0x4ccc76[_0xf9a6('0x5d')]['id']){delete _0x4ccc76[_0xf9a6('0x5d')]['id'];}return db[_0xf9a6('0x40')]['find']({'where':{'id':_0x4ccc76[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x5770c5,null))[_0xf9a6('0x21')](function(_0x45c034){if(_0x45c034){_0x4ccc76['body'][_0xf9a6('0x6c')]=_0x45c034['id'];return db['CannedAnswer'][_0xf9a6('0x63')](_0x4ccc76['body']);}})[_0xf9a6('0x21')](respondWithResult(_0x5770c5,null))['catch'](handleError(_0x5770c5,null));};exports[_0xf9a6('0x70')]=function(_0x23e738,_0x2fe5b2,_0x4ef61e){var _0x5c2efa={'raw':![],'where':{}};var _0x52f9be={};var _0x32feb9={'count':0x0,'rows':[]};return db[_0xf9a6('0x40')]['findOne']({'where':{'id':_0x23e738['params']['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x2fe5b2,null))[_0xf9a6('0x21')](function(_0x5b4ea1){if(_0x5b4ea1){_0x52f9be['model']=_['keys'](db[_0xf9a6('0x71')][_0xf9a6('0x5b')]);_0x52f9be['query']=_[_0xf9a6('0x5a')](_0x23e738[_0xf9a6('0x45')]);_0x52f9be[_0xf9a6('0x46')]=_[_0xf9a6('0x47')](_0x52f9be[_0xf9a6('0x44')],_0x52f9be[_0xf9a6('0x45')]);_0x5c2efa['attributes']=_['intersection'](_0x52f9be[_0xf9a6('0x44')],qs['fields'](_0x23e738['query'][_0xf9a6('0x49')]));_0x5c2efa[_0xf9a6('0x48')]=_0x5c2efa[_0xf9a6('0x48')]['length']?_0x5c2efa[_0xf9a6('0x48')]:_0x52f9be[_0xf9a6('0x44')];if(!_0x23e738[_0xf9a6('0x45')][_0xf9a6('0x4b')]('nolimit')){_0x5c2efa[_0xf9a6('0x31')]=qs[_0xf9a6('0x31')](_0x23e738[_0xf9a6('0x45')][_0xf9a6('0x31')]);_0x5c2efa[_0xf9a6('0x2f')]=qs[_0xf9a6('0x2f')](_0x23e738['query']['offset']);}_0x5c2efa[_0xf9a6('0x72')]=qs[_0xf9a6('0x4d')](_0x23e738[_0xf9a6('0x45')]['sort']);_0x5c2efa[_0xf9a6('0x50')]=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x23e738[_0xf9a6('0x45')],_0x52f9be[_0xf9a6('0x46')]));_0x5c2efa[_0xf9a6('0x50')][_0xf9a6('0x6c')]=_0x5b4ea1['id'];if(_0x23e738[_0xf9a6('0x45')][_0xf9a6('0x4f')]){_0x5c2efa[_0xf9a6('0x50')]=_['merge'](_0x5c2efa[_0xf9a6('0x50')],{'$or':_[_0xf9a6('0x3f')](_0x5c2efa[_0xf9a6('0x48')],function(_0x129d9f){var _0x2ad88b={};_0x2ad88b[_0x129d9f]={'$like':'%'+_0x23e738[_0xf9a6('0x45')][_0xf9a6('0x4f')]+'%'};return _0x2ad88b;})});}_0x5c2efa=_[_0xf9a6('0x51')]({},_0x5c2efa,_0x23e738[_0xf9a6('0x53')]);return db['CannedAnswer'][_0xf9a6('0x32')]({'where':_0x5c2efa[_0xf9a6('0x50')]})[_0xf9a6('0x21')](function(_0x6d3de1){_0x32feb9[_0xf9a6('0x32')]=_0x6d3de1;if(_0x23e738[_0xf9a6('0x45')]['includeAll']){_0x5c2efa[_0xf9a6('0x5c')]=[{'all':!![]}];}return db[_0xf9a6('0x71')][_0xf9a6('0x55')](_0x5c2efa);})['then'](function(_0x2f1a76){_0x32feb9[_0xf9a6('0x56')]=_0x2f1a76;return _0x32feb9;});}})[_0xf9a6('0x21')](respondWithFilteredResult(_0x2fe5b2,_0x5c2efa))['catch'](handleError(_0x2fe5b2,null));};exports[_0xf9a6('0x73')]=function(_0x282b75,_0x2fdbf7,_0x2ea4dd){return db['FaxAccount'][_0xf9a6('0x62')]({'where':{'id':_0x282b75['params']['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x2fdbf7,null))[_0xf9a6('0x21')](function(_0x4feac3){if(_0x4feac3){return _0x4feac3['removeAnswers'](_0x282b75[_0xf9a6('0x45')][_0xf9a6('0x6e')]);}})['then'](respondWithStatusCode(_0x2fdbf7,null))['catch'](handleError(_0x2fdbf7,null));};exports[_0xf9a6('0x74')]=function(_0xd5fe92,_0x435541,_0x1e3f06){return db[_0xf9a6('0x75')][_0xf9a6('0x62')]({'where':{'id':_0xd5fe92['params']['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x435541,null))['then'](function(_0x2a1e19){if(_0x2a1e19){return _0x2a1e19['addInteraction'](_0xd5fe92['body'][_0xf9a6('0x6e')],_['omit'](_0xd5fe92[_0xf9a6('0x5d')],[_0xf9a6('0x6e'),'id'])||{});}})[_0xf9a6('0x21')](respondWithResult(_0x435541,null))[_0xf9a6('0x57')](handleError(_0x435541,null));};exports['getInteractions']=function(_0x4cea74,_0x4f1843,_0x3967b1){var _0x2191c4={'raw':![],'where':{}};var _0x303226={};var _0x2fb6cd={'count':0x0,'rows':[]};return db[_0xf9a6('0x40')][_0xf9a6('0x6b')]({'where':{'id':_0x4cea74[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x4f1843,null))[_0xf9a6('0x21')](function(_0x129b09){if(_0x129b09){_0x303226[_0xf9a6('0x44')]=_['keys'](db['FaxInteraction'][_0xf9a6('0x5b')]);_0x303226[_0xf9a6('0x45')]=_[_0xf9a6('0x5a')](_0x4cea74[_0xf9a6('0x45')]);_0x303226[_0xf9a6('0x46')]=_[_0xf9a6('0x47')](_0x303226['model'],_0x303226[_0xf9a6('0x45')]);_0x2191c4[_0xf9a6('0x48')]=_['intersection'](_0x303226[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x49')]));_0x2191c4['attributes']=_0x2191c4[_0xf9a6('0x48')]['length']?_0x2191c4[_0xf9a6('0x48')]:_0x303226[_0xf9a6('0x44')];if(!_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x4b')]('nolimit')){_0x2191c4[_0xf9a6('0x31')]=qs[_0xf9a6('0x31')](_0x4cea74['query'][_0xf9a6('0x31')]);_0x2191c4['offset']=qs[_0xf9a6('0x2f')](_0x4cea74['query']['offset']);}_0x2191c4[_0xf9a6('0x72')]=qs[_0xf9a6('0x4d')](_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x4d')]);_0x2191c4['where']=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x4cea74[_0xf9a6('0x45')],_0x303226[_0xf9a6('0x46')]));_0x2191c4[_0xf9a6('0x50')][_0xf9a6('0x6c')]=_0x129b09['id'];if(_0x4cea74['query']['filter']){_0x2191c4['where']=_['merge'](_0x2191c4['where'],{'$or':_['map'](_0x2191c4[_0xf9a6('0x48')],function(_0x27ddef){var _0x16d544={};_0x16d544[_0x27ddef]={'$like':'%'+_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x4f')]+'%'};return _0x16d544;})});}_0x2191c4=_[_0xf9a6('0x51')]({},_0x2191c4,_0x4cea74[_0xf9a6('0x53')]);return db[_0xf9a6('0x75')][_0xf9a6('0x32')]({'where':_0x2191c4['where']})['then'](function(_0x415d8d){_0x2fb6cd[_0xf9a6('0x32')]=_0x415d8d;if(_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x54')]){_0x2191c4[_0xf9a6('0x5c')]=[{'model':db[_0xf9a6('0x76')],'as':_0xf9a6('0x77'),'required':![]},{'model':db[_0xf9a6('0x78')],'as':_0xf9a6('0x79'),'attributes':[_0xf9a6('0x3a'),_0xf9a6('0x7a'),_0xf9a6('0x7b')],'required':![]},{'model':db[_0xf9a6('0x7c')],'as':_0xf9a6('0x7d'),'attributes':['id','name',_0xf9a6('0x7e')],'where':_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x7f')]?{'id':_0x4cea74[_0xf9a6('0x45')]['tag']}:undefined,'required':_0x4cea74[_0xf9a6('0x45')][_0xf9a6('0x7f')]?!![]:![]}];}return db[_0xf9a6('0x75')]['findAll'](_0x2191c4);})[_0xf9a6('0x21')](function(_0x35865a){_0x2fb6cd[_0xf9a6('0x56')]=_0x35865a;return _0x2fb6cd;});}})[_0xf9a6('0x21')](respondWithFilteredResult(_0x4f1843,_0x2191c4))[_0xf9a6('0x57')](handleError(_0x4f1843,null));};exports[_0xf9a6('0x80')]=function(_0x331a9d,_0x4c60e3){var _0x1d84d8=_0x331a9d[_0xf9a6('0x59')]['id'];var _0x1d24d5=_0x331a9d[_0xf9a6('0x5d')];var _0x354f88=0xc8;var _0x359444=null;return db[_0xf9a6('0x81')][_0xf9a6('0x82')]({'isolationLevel':db[_0xf9a6('0x81')][_0xf9a6('0x83')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5726c0){return db[_0xf9a6('0x40')][_0xf9a6('0x6b')]({'where':{'id':_0x1d84d8},'transaction':_0x5726c0})['then'](function(_0x3ad384){if(_0x3ad384){return db[_0xf9a6('0x84')]['destroy']({'where':{'FaxAccountId':_0x1d84d8},'transaction':_0x5726c0})[_0xf9a6('0x21')](function(){var _0x376f27=_[_0xf9a6('0x3f')](_0x1d24d5,function(_0x484b4f){_0x484b4f[_0xf9a6('0x6c')]=_0x1d84d8;return _0x484b4f;});return db[_0xf9a6('0x84')][_0xf9a6('0x85')](_0x376f27,{'transaction':_0x5726c0});});}else{_0x354f88=0x194;_0x359444=[];}});})['then'](function(){if(_0x354f88!==0x194){return db['FaxApplication'][_0xf9a6('0x86')]({'where':{'FaxAccountId':_0x1d84d8},'order':_0xf9a6('0x87')})[_0xf9a6('0x21')](function(_0x228dd2){_0x359444=_0x228dd2;});}})['catch'](function(_0x30ac41){_0x354f88=0x1f4;logger[_0xf9a6('0x26')](_0x30ac41[_0xf9a6('0x39')]);if(_0x30ac41[_0xf9a6('0x3a')]){delete _0x30ac41['name'];}_0x359444=_0x30ac41;})[_0xf9a6('0x88')](function(){if(_0x359444===null){_0x4c60e3[_0xf9a6('0x2b')](_0x354f88);}else{if(_0x354f88===0x1f4){_0x4c60e3['status'](_0x354f88)['send'](_0x359444);}else{_0x4c60e3['status'](_0x354f88)[_0xf9a6('0x2e')](_0x359444);}}});};exports['getApplications']=function(_0x446bf8,_0x1253cb,_0xf4e742){var _0x4c533f={};var _0x56dc6c={};var _0x47ea2d;var _0x43ae1d;return db[_0xf9a6('0x40')][_0xf9a6('0x6b')]({'where':{'id':_0x446bf8[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x1253cb,null))[_0xf9a6('0x21')](function(_0x2d6f28){if(_0x2d6f28){_0x47ea2d=_0x2d6f28;_0x56dc6c['model']=_[_0xf9a6('0x5a')](db[_0xf9a6('0x84')][_0xf9a6('0x5b')]);_0x56dc6c[_0xf9a6('0x45')]=_['keys'](_0x446bf8[_0xf9a6('0x45')]);_0x56dc6c[_0xf9a6('0x46')]=_[_0xf9a6('0x47')](_0x56dc6c[_0xf9a6('0x44')],_0x56dc6c['query']);_0x4c533f[_0xf9a6('0x48')]=_[_0xf9a6('0x47')](_0x56dc6c[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x446bf8[_0xf9a6('0x45')]['fields']));_0x4c533f[_0xf9a6('0x48')]=_0x4c533f[_0xf9a6('0x48')]['length']?_0x4c533f[_0xf9a6('0x48')]:_0x56dc6c[_0xf9a6('0x44')];_0x4c533f[_0xf9a6('0x72')]=qs[_0xf9a6('0x4d')](_0x446bf8[_0xf9a6('0x45')]['sort']);_0x4c533f[_0xf9a6('0x50')]=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x446bf8['query'],_0x56dc6c[_0xf9a6('0x46')]));if(_0x446bf8[_0xf9a6('0x45')][_0xf9a6('0x4f')]){_0x4c533f['where']=_[_0xf9a6('0x51')](_0x4c533f[_0xf9a6('0x50')],{'$or':_[_0xf9a6('0x3f')](_0x4c533f[_0xf9a6('0x48')],function(_0x27ee4f){var _0xa1f59e={};_0xa1f59e[_0x27ee4f]={'$like':'%'+_0x446bf8[_0xf9a6('0x45')]['filter']+'%'};return _0xa1f59e;})});}_0x4c533f=_[_0xf9a6('0x51')]({},_0x4c533f,_0x446bf8[_0xf9a6('0x53')]);return _0x47ea2d[_0xf9a6('0x89')](_0x4c533f);}})[_0xf9a6('0x21')](function(_0x379d99){if(_0x379d99){_0x43ae1d=_0x379d99[_0xf9a6('0x4a')];if(!_0x446bf8[_0xf9a6('0x45')][_0xf9a6('0x4b')](_0xf9a6('0x4c'))){_0x4c533f['limit']=qs[_0xf9a6('0x31')](_0x446bf8[_0xf9a6('0x45')][_0xf9a6('0x31')]);_0x4c533f[_0xf9a6('0x2f')]=qs[_0xf9a6('0x2f')](_0x446bf8[_0xf9a6('0x45')][_0xf9a6('0x2f')]);}return _0x47ea2d[_0xf9a6('0x89')](_0x4c533f);}})[_0xf9a6('0x21')](function(_0x18f228){if(_0x18f228){return _0x18f228?{'count':_0x43ae1d,'rows':_0x18f228}:null;}})[_0xf9a6('0x21')](respondWithResult(_0x1253cb,null))['catch'](handleError(_0x1253cb,null));};function Extension(_0x4fc94c,_0x5b6de5,_0x44044e,_0xf16738){this[_0xf9a6('0x8a')]=_0xf9a6('0x8b');this['exten']=_0x4fc94c[_0xf9a6('0x8c')];this[_0xf9a6('0x8d')]=_0xf16738;this[_0xf9a6('0x42')]=_0xf9a6('0x8e');this[_0xf9a6('0x8f')]='Fax\x20Extension';this[_0xf9a6('0x6c')]=_0x4fc94c['id'];this[_0xf9a6('0x87')]=_0x5b6de5;this[_0xf9a6('0x90')]=_0x44044e;}function createExtensionsReciveFax(_0x343571){var _0x2e9668=0x1;var _0x2f866f=[];_0x2f866f[_0xf9a6('0x91')](new Extension(_0x343571,_0x2e9668,'','Answer'));_0x2e9668+=0x1;_0x2f866f[_0xf9a6('0x91')](new Extension(_0x343571,_0x2e9668,_0xf9a6('0x92'),_0xf9a6('0x93')));_0x2e9668+=0x1;for(var _0x4b3cad in _0x343571){if(_0x343571[_0xf9a6('0x4b')](_0x4b3cad)&&(_0x4b3cad==='ecm'||_0x4b3cad===_0xf9a6('0x8c')||_0x4b3cad===_0xf9a6('0x94')||_0x4b3cad===_0xf9a6('0x95')||_0x4b3cad===_0xf9a6('0x96')||_0x4b3cad===_0xf9a6('0x97')||_0x4b3cad==='minrate'||_0x4b3cad===_0xf9a6('0x98')||_0x4b3cad===_0xf9a6('0x99'))){_0x2f866f[_0xf9a6('0x91')](new Extension(_0x343571,_0x2e9668,_0xf9a6('0x9a')+_0x4b3cad+')='+_0x343571[_0x4b3cad],_0xf9a6('0x93')));_0x2e9668+=0x1;}}_0x2f866f[_0xf9a6('0x91')](new Extension(_0x343571,_0x2e9668,'6',_0xf9a6('0x9b')));_0x2e9668+=0x1;_0x2f866f[_0xf9a6('0x91')](new Extension(_0x343571,_0x2e9668,_0xf9a6('0x9c'),_0xf9a6('0x9d')));_0x2e9668=0x0;return _0x2f866f;}exports[_0xf9a6('0x9e')]=function(_0xe9d7d1,_0x5591fb,_0xd6b71){var _0x5c1149;return db['sequelize'][_0xf9a6('0x82')](function(_0x456990){return db[_0xf9a6('0x40')][_0xf9a6('0x63')](_0xe9d7d1[_0xf9a6('0x5d')],{'transaction':_0x456990})['then'](function(_0x72dbcf){_0x5c1149=_0x72dbcf[_0xf9a6('0x37')]({'plain':!![]});return db[_0xf9a6('0x9f')]['bulkCreate'](createExtensionsReciveFax(_0x5c1149),{'transaction':_0x456990});});})[_0xf9a6('0x21')](function(){return _0x5c1149;})[_0xf9a6('0x21')](respondWithResult(_0x5591fb,null))[_0xf9a6('0x57')](handleError(_0x5591fb,null));};exports['updateAccountApplications']=function(_0x3a6d22,_0x248f78,_0x539c7f){var _0x165ccc;return db['sequelize'][_0xf9a6('0x82')](function(_0x68139d){return db['FaxAccount'][_0xf9a6('0x65')](_0x3a6d22[_0xf9a6('0x5d')],{'where':{'id':_0x3a6d22[_0xf9a6('0x5d')]['id']},'transaction':_0x68139d})['then'](function(_0x4b5dad){return db[_0xf9a6('0x9f')][_0xf9a6('0x66')]({'where':{'FaxAccountId':_0x3a6d22[_0xf9a6('0x5d')]['id']},'transaction':_0x68139d})[_0xf9a6('0x21')](function(_0x4a04b7){return db['VoiceExtension'][_0xf9a6('0x85')](createExtensionsReciveFax(_['omit'](_0x3a6d22[_0xf9a6('0x5d')],[_0xf9a6('0xa0'),'key',_0xf9a6('0xa1'),_0xf9a6('0xa2'),_0xf9a6('0xa3'),_0xf9a6('0xa4')])),{'transaction':_0x68139d});});});})['then'](function(){return db[_0xf9a6('0x40')][_0xf9a6('0xa5')](_0x3a6d22[_0xf9a6('0x5d')]['id']);})[_0xf9a6('0x21')](respondWithResult(_0x248f78,null))['catch'](handleError(_0x248f78,null));};exports['getMessages']=function(_0x2bd17c,_0x9ff8da,_0xa745ea){var _0x1c209b={'raw':!![],'where':{}};var _0x186a17={};var _0x381455={'count':0x0,'rows':[]};return db[_0xf9a6('0x40')][_0xf9a6('0x6b')]({'where':{'id':_0x2bd17c['params']['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x9ff8da,null))[_0xf9a6('0x21')](function(_0x139407){if(_0x139407){_0x186a17[_0xf9a6('0x44')]=_['keys'](db[_0xf9a6('0xa6')][_0xf9a6('0x5b')]);_0x186a17['query']=_[_0xf9a6('0x5a')](_0x2bd17c[_0xf9a6('0x45')]);_0x186a17[_0xf9a6('0x46')]=_['intersection'](_0x186a17[_0xf9a6('0x44')],_0x186a17['query']);_0x1c209b[_0xf9a6('0x48')]=_[_0xf9a6('0x47')](_0x186a17[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x2bd17c[_0xf9a6('0x45')]['fields']));_0x1c209b[_0xf9a6('0x48')]=_0x1c209b[_0xf9a6('0x48')][_0xf9a6('0x4a')]?_0x1c209b[_0xf9a6('0x48')]:_0x186a17[_0xf9a6('0x44')];if(!_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x4b')](_0xf9a6('0x4c'))){_0x1c209b['limit']=qs[_0xf9a6('0x31')](_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x31')]);_0x1c209b['offset']=qs['offset'](_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x2f')]);}_0x1c209b[_0xf9a6('0x72')]=qs[_0xf9a6('0x4d')](_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x4d')]);_0x1c209b[_0xf9a6('0x50')]=qs[_0xf9a6('0x46')](_[_0xf9a6('0x4e')](_0x2bd17c[_0xf9a6('0x45')],_0x186a17[_0xf9a6('0x46')]));_0x1c209b[_0xf9a6('0x50')][_0xf9a6('0x6c')]=_0x139407['id'];if(_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x4f')]){_0x1c209b['where']=_['merge'](_0x1c209b[_0xf9a6('0x50')],{'$or':_[_0xf9a6('0x3f')](_0x1c209b[_0xf9a6('0x48')],function(_0x3d0ec1){var _0x208e29={};_0x208e29[_0x3d0ec1]={'$like':'%'+_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x4f')]+'%'};return _0x208e29;})});}if(_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0xa7')]){var _0x181f1d=_0x2bd17c['query']['$gte'][_0xf9a6('0xa8')](',');var _0x3527c5={};_0x3527c5[_0x181f1d[0x0]]={'$gte':moment(_0x181f1d[0x1])[_0xf9a6('0xa9')](_0xf9a6('0xaa'))};_0x1c209b[_0xf9a6('0x50')]=_['merge'](_0x1c209b[_0xf9a6('0x50')],_0x3527c5);}_0x1c209b=_[_0xf9a6('0x51')]({},_0x1c209b,_0x2bd17c[_0xf9a6('0x53')]);return db[_0xf9a6('0xa6')][_0xf9a6('0x32')]({'where':_0x1c209b[_0xf9a6('0x50')]})['then'](function(_0x12ba44){_0x381455[_0xf9a6('0x32')]=_0x12ba44;if(_0x2bd17c[_0xf9a6('0x45')][_0xf9a6('0x54')]){_0x1c209b[_0xf9a6('0x5c')]=[{'all':!![]}];}return db[_0xf9a6('0xa6')][_0xf9a6('0x55')](_0x1c209b);})[_0xf9a6('0x21')](function(_0x31d4dc){_0x381455['rows']=_0x31d4dc;return _0x381455;});}})['then'](respondWithFilteredResult(_0x9ff8da,_0x1c209b))[_0xf9a6('0x57')](handleError(_0x9ff8da,null));};exports[_0xf9a6('0x3b')]=function(_0x2db52c,_0x2f8e9a,_0x5e0447){var _0x20169c,_0x5d183e={},_0x3478fe;if(_0x2db52c[_0xf9a6('0x5d')]['to']){_0x3478fe=_0x2db52c['body']['to'][0x0];}return db['FaxAccount'][_0xf9a6('0x62')]({'where':{'id':_0x2db52c[_0xf9a6('0x59')]['id']},'include':[{'model':db[_0xf9a6('0xab')],'as':_0xf9a6('0xac'),'include':[{'model':db[_0xf9a6('0x76')],'as':_0xf9a6('0xad'),'where':{'fax':_0x3478fe},'limit':0x1,'order':[[_0xf9a6('0xa2'),_0xf9a6('0xae')]]}]}]})['then'](handleEntityNotFound(_0x2f8e9a,null))[_0xf9a6('0x21')](function(_0x9c6cd){_0x20169c=_0x9c6cd;if(_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')]&&_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')]['length']){for(var _0x5a7fcb=0x0;_0x5a7fcb<_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][_0xf9a6('0x4a')];_0x5a7fcb+=0x1){_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][_0x5a7fcb]={'filename':_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][_0x5a7fcb]['name'],'id':_0x2db52c[_0xf9a6('0x5d')]['attachments'][_0x5a7fcb]['id'],'path':path[_0xf9a6('0xb0')](config[_0xf9a6('0xb1')],_0xf9a6('0xb2'),_0x2db52c['body']['attachments'][_0x5a7fcb][_0xf9a6('0xb3')])};}}return respondWithRpcPromise(_0xf9a6('0xb4'),_0xf9a6('0xb4'),{'FaxAccountId':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x59')]['id'])?undefined:_0x2db52c[_0xf9a6('0x59')]['id'],'path':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][0x0]['path'])?undefined:_0x2db52c[_0xf9a6('0x5d')]['attachments'][0x0]['path'],'fax':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x5d')]['to'][0x0])?undefined:_0x2db52c[_0xf9a6('0x5d')]['to'][0x0]},client9002);})[_0xf9a6('0x21')](function(){if(_0x20169c){if(_['isNil'](_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xb6')])){_0x2db52c[_0xf9a6('0x5d')]['from']=util[_0xf9a6('0xa9')](_0xf9a6('0xb7'),_0x20169c[_0xf9a6('0x3a')],_0x20169c[_0xf9a6('0xb8')]);}if(_0x20169c[_0xf9a6('0xac')]){if(_0x20169c['List'][_0xf9a6('0xad')][_0xf9a6('0x4a')]){return _0x20169c['List'][_0xf9a6('0xad')][0x0];}else{return db[_0xf9a6('0x76')]['create'](_[_0xf9a6('0x19')](_0x2db52c[_0xf9a6('0x5d')],{'firstName':_0x2db52c[_0xf9a6('0x5d')]['to'][0x0],'phone':_0x2db52c[_0xf9a6('0x5d')]['to'][0x0],'fax':_0x2db52c['body']['to'][0x0],'ListId':_0x20169c['ListId']}));}}else{throw new Error(_0xf9a6('0xb9'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0xc2243a){if(_0xc2243a){return db[_0xf9a6('0x75')][_0xf9a6('0x62')]({'where':{'ContactId':_0xc2243a['id'],'closed':![],'FaxAccountId':_0x20169c['id']}})[_0xf9a6('0x21')](function(_0x368169){if(_0x368169){return[_0x368169,![]];}return db['FaxInteraction'][_0xf9a6('0x63')]({'UserId':_0x2db52c[_0xf9a6('0x5e')]['id'],'ContactId':_0xc2243a['id'],'FaxAccountId':_0x20169c['id'],'fax':_0x2db52c[_0xf9a6('0x5d')]['to'][0x0],'firstMsgDirection':_0xf9a6('0xba'),'Messages':[_[_0xf9a6('0x51')](_0x2db52c['body'],{'read':![],'body':_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][0x0][_0xf9a6('0xbb')],'FaxAccountId':_0x20169c['id'],'UserId':_0x2db52c[_0xf9a6('0x5e')]['id'],'ContactId':_0xc2243a['id'],'AttachmentId':_0x2db52c['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xf9a6('0xa6')],'as':_0xf9a6('0xbc')}]})['then'](function(_0x4a0cc5){return[_0x4a0cc5,!![]];});});}else{throw new Error(_0xf9a6('0xbd'));}})[_0xf9a6('0xbe')](function(_0x43c389,_0x2caa11){if(_0x2caa11){return _0x43c389;}return db[_0xf9a6('0xa6')]['create']({'direction':_0xf9a6('0xba'),'read':![],'body':_0x2db52c[_0xf9a6('0x5d')]['attachments'][0x0][_0xf9a6('0xbb')],'FaxAccountId':_0x20169c['id'],'FaxInteractionId':_0x43c389['id'],'UserId':_0x2db52c['user']['id'],'ContactId':_0x43c389[_0xf9a6('0xbf')],'AttachmentId':_0x2db52c[_0xf9a6('0x5d')]['attachments'][0x0]['id']})['then'](function(_0x4ca5b7){_0x43c389[_0xf9a6('0xc0')][_0xf9a6('0xbc')]=[];_0x43c389[_0xf9a6('0xc0')][_0xf9a6('0xbc')][_0xf9a6('0x91')](_0x4ca5b7['dataValues']);return _0x43c389;});})[_0xf9a6('0x21')](function(_0x38bb25){respondWithRpcPromise(_0xf9a6('0xc1'),_0xf9a6('0xc1'),{'FaxAccountId':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x59')]['id'])?undefined:_0x2db52c[_0xf9a6('0x59')]['id'],'path':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][0x0]['path'])?undefined:_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][0x0][_0xf9a6('0x6')],'fax':_[_0xf9a6('0xb5')](_0x2db52c[_0xf9a6('0x5d')]['to'][0x0])?undefined:_0x2db52c[_0xf9a6('0x5d')]['to'][0x0],'AttachmentId':_0x2db52c[_0xf9a6('0x5d')][_0xf9a6('0xaf')][0x0]['id']},client9002)[_0xf9a6('0x21')](function(_0x30eeb5){logger[_0xf9a6('0xc2')](_0xf9a6('0xc3'),_0x30eeb5);})[_0xf9a6('0x57')](function(_0x1ecefa){logger[_0xf9a6('0xc2')](_0xf9a6('0xc3'),_0x1ecefa);});return _0x38bb25;})[_0xf9a6('0x21')](respondWithResult(_0x2f8e9a,null))[_0xf9a6('0x57')](handleError(_0x2f8e9a,null));};exports[_0xf9a6('0xc4')]=function(_0x428e4c,_0xa82820,_0x38cb93){return db['FaxAccount'][_0xf9a6('0x62')]({'where':{'id':_0x428e4c[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0xa82820,null))[_0xf9a6('0x21')](function(_0x1cf9cf){if(_0x1cf9cf){return _0x1cf9cf['addAgents'](_0x428e4c[_0xf9a6('0x5d')][_0xf9a6('0x6e')],_[_0xf9a6('0xc5')](_0x428e4c[_0xf9a6('0x5d')],['ids','id'])||{})[_0xf9a6('0xbe')](function(_0xa100ed){for(var _0x4caad2=0x0;_0x4caad2<_0x428e4c['body'][_0xf9a6('0x6e')][_0xf9a6('0x4a')];_0x4caad2+=0x1){socket[_0xf9a6('0xc6')](_0xf9a6('0xc7'),{'UserId':Number(_0x428e4c['body']['ids'][_0x4caad2]),'FaxAccountId':Number(_0x428e4c[_0xf9a6('0x59')]['id'])});}return _0xa100ed;});}})[_0xf9a6('0x21')](respondWithResult(_0xa82820,null))[_0xf9a6('0x57')](handleError(_0xa82820,null));};exports['removeAgents']=function(_0x23af11,_0x2b8ba4,_0x12251c){return db[_0xf9a6('0x40')][_0xf9a6('0x62')]({'where':{'id':_0x23af11[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x2b8ba4,null))['then'](function(_0x33085d){if(_0x33085d){return _0x33085d[_0xf9a6('0xc8')](_0x23af11[_0xf9a6('0x45')][_0xf9a6('0x6e')])[_0xf9a6('0x21')](function(){if(_[_0xf9a6('0xc9')](_0x23af11[_0xf9a6('0x45')][_0xf9a6('0x6e')])){for(var _0x446aa4=0x0;_0x446aa4<_0x23af11[_0xf9a6('0x45')]['ids'][_0xf9a6('0x4a')];_0x446aa4+=0x1){socket[_0xf9a6('0xc6')](_0xf9a6('0xca'),{'UserId':Number(_0x23af11[_0xf9a6('0x45')][_0xf9a6('0x6e')][_0x446aa4]),'FaxAccountId':Number(_0x23af11[_0xf9a6('0x59')]['id'])});}}else{socket[_0xf9a6('0xc6')](_0xf9a6('0xca'),{'UserId':Number(_0x23af11[_0xf9a6('0x45')]['ids']),'FaxAccountId':Number(_0x23af11[_0xf9a6('0x59')]['id'])});}});}})[_0xf9a6('0x21')](respondWithStatusCode(_0x2b8ba4,null))[_0xf9a6('0x57')](handleError(_0x2b8ba4,null));};exports['getAgents']=function(_0x372a12,_0x5b35ba,_0x1849a8){var _0x49b2a0={};var _0x53aa24={};var _0x516e49;var _0x1a4257;return db['FaxAccount']['findOne']({'where':{'id':_0x372a12[_0xf9a6('0x59')]['id']}})[_0xf9a6('0x21')](handleEntityNotFound(_0x5b35ba,null))[_0xf9a6('0x21')](function(_0xe6766e){if(_0xe6766e){_0x516e49=_0xe6766e;_0x53aa24[_0xf9a6('0x44')]=_['keys'](db[_0xf9a6('0x78')]['rawAttributes']);_0x53aa24[_0xf9a6('0x45')]=_[_0xf9a6('0x5a')](_0x372a12[_0xf9a6('0x45')]);_0x53aa24[_0xf9a6('0x46')]=_['intersection'](_0x53aa24[_0xf9a6('0x44')],_0x53aa24[_0xf9a6('0x45')]);_0x49b2a0['attributes']=_[_0xf9a6('0x47')](_0x53aa24[_0xf9a6('0x44')],qs[_0xf9a6('0x49')](_0x372a12[_0xf9a6('0x45')][_0xf9a6('0x49')]));_0x49b2a0['attributes']=_0x49b2a0['attributes']['length']?_0x49b2a0[_0xf9a6('0x48')]:_0x53aa24['model'];_0x49b2a0[_0xf9a6('0x72')]=qs['sort'](_0x372a12[_0xf9a6('0x45')][_0xf9a6('0x4d')]);_0x49b2a0['where']=qs[_0xf9a6('0x46')](_['pick'](_0x372a12['query'],_0x53aa24[_0xf9a6('0x46')]));if(_0x372a12[_0xf9a6('0x45')]['filter']){_0x49b2a0[_0xf9a6('0x50')]=_[_0xf9a6('0x51')](_0x49b2a0[_0xf9a6('0x50')],{'$or':_[_0xf9a6('0x3f')](_0x49b2a0[_0xf9a6('0x48')],function(_0x4e24b1){var _0x258535={};_0x258535[_0x4e24b1]={'$like':'%'+_0x372a12['query']['filter']+'%'};return _0x258535;})});}_0x49b2a0=_[_0xf9a6('0x51')]({},_0x49b2a0,_0x372a12[_0xf9a6('0x53')]);return _0x516e49[_0xf9a6('0xcb')](_0x49b2a0);}})['then'](function(_0x4988c2){if(_0x4988c2){_0x1a4257=_0x4988c2[_0xf9a6('0x4a')];if(!_0x372a12['query'][_0xf9a6('0x4b')](_0xf9a6('0x4c'))){_0x49b2a0[_0xf9a6('0x31')]=qs[_0xf9a6('0x31')](_0x372a12[_0xf9a6('0x45')][_0xf9a6('0x31')]);_0x49b2a0['offset']=qs['offset'](_0x372a12[_0xf9a6('0x45')][_0xf9a6('0x2f')]);}return _0x516e49['getAgents'](_0x49b2a0);}})[_0xf9a6('0x21')](function(_0x12ffe7){if(_0x12ffe7){return _0x12ffe7?{'count':_0x1a4257,'rows':_0x12ffe7}:null;}})[_0xf9a6('0x21')](respondWithResult(_0x5b35ba,null))[_0xf9a6('0x57')](handleError(_0x5b35ba,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index b33858a..25a3de5 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 _0x711a=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit'];(function(_0x4ca2ec,_0x1d1ed9){var _0x355d9b=function(_0x217e7b){while(--_0x217e7b){_0x4ca2ec['push'](_0x4ca2ec['shift']());}};_0x355d9b(++_0x1d1ed9);}(_0x711a,0xf3));var _0xa711=function(_0x3d55b2,_0x902089){_0x3d55b2=_0x3d55b2-0x0;var _0x13d8d1=_0x711a[_0x3d55b2];return _0x13d8d1;};'use strict';var EventEmitter=require(_0xa711('0x0'));var FaxAccount=require(_0xa711('0x1'))['db'][_0xa711('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa711('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa711('0x4'),'afterDestroy':_0xa711('0x5')};function emitEvent(_0x1a23c1){return function(_0xeba30e,_0x3b1865,_0x1d12dd){FaxAccountEvents[_0xa711('0x6')](_0x1a23c1+':'+_0xeba30e['id'],_0xeba30e);FaxAccountEvents[_0xa711('0x6')](_0x1a23c1,_0xeba30e);_0x1d12dd(null);};}for(var e in events){if(events[_0xa711('0x7')](e)){var event=events[e];FaxAccount[_0xa711('0x8')](e,emitEvent(event));}}module[_0xa711('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xdea1=['hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x543217,_0x35f5af){var _0x1e39cb=function(_0x33e611){while(--_0x33e611){_0x543217['push'](_0x543217['shift']());}};_0x1e39cb(++_0x35f5af);}(_0xdea1,0xdf));var _0x1dea=function(_0x124296,_0x313fe4){_0x124296=_0x124296-0x0;var _0x4a5921=_0xdea1[_0x124296];return _0x4a5921;};'use strict';var EventEmitter=require(_0x1dea('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x1dea('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1dea('0x2')](0x0);var events={'afterCreate':_0x1dea('0x3'),'afterUpdate':_0x1dea('0x4'),'afterDestroy':_0x1dea('0x5')};function emitEvent(_0xa59c3){return function(_0x5dddfa,_0x4d9dff,_0x3a79f3){FaxAccountEvents[_0x1dea('0x6')](_0xa59c3+':'+_0x5dddfa['id'],_0x5dddfa);FaxAccountEvents[_0x1dea('0x6')](_0xa59c3,_0x5dddfa);_0x3a79f3(null);};}for(var e in events){if(events[_0x1dea('0x7')](e)){var event=events[e];FaxAccount[_0x1dea('0x8')](e,emitEvent(event));}}module[_0x1dea('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 0e611fb..9ebc37b 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 _0x797f=['api','moment','bluebird','path','../../config/environment','exports','define','FaxAccount','fax_accounts','util','../../config/logger'];(function(_0x24870d,_0x1e9713){var _0x1f53a8=function(_0x2e193f){while(--_0x2e193f){_0x24870d['push'](_0x24870d['shift']());}};_0x1f53a8(++_0x1e9713);}(_0x797f,0xa3));var _0xf797=function(_0x70f4f,_0xf4fcc2){_0x70f4f=_0x70f4f-0x0;var _0x342ca7=_0x797f[_0x70f4f];return _0x342ca7;};'use strict';var _=require('lodash');var util=require(_0xf797('0x0'));var logger=require(_0xf797('0x1'))(_0xf797('0x2'));var moment=require(_0xf797('0x3'));var BPromise=require(_0xf797('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf797('0x5'));var rimraf=require('rimraf');var config=require(_0xf797('0x6'));var attributes=require('./faxAccount.attributes');module[_0xf797('0x7')]=function(_0x3fd61e,_0x3f2b08){return _0x3fd61e[_0xf797('0x8')](_0xf797('0x9'),attributes,{'tableName':_0xf797('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fae=['exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0x1f787a,_0x57ca00){var _0x400cbf=function(_0xb5801e){while(--_0xb5801e){_0x1f787a['push'](_0x1f787a['shift']());}};_0x400cbf(++_0x57ca00);}(_0x7fae,0x162));var _0xe7fa=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7fae[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xe7fa('0x0'));var util=require(_0xe7fa('0x1'));var logger=require(_0xe7fa('0x2'))(_0xe7fa('0x3'));var moment=require('moment');var BPromise=require(_0xe7fa('0x4'));var rp=require(_0xe7fa('0x5'));var fs=require('fs');var path=require(_0xe7fa('0x6'));var rimraf=require(_0xe7fa('0x7'));var config=require(_0xe7fa('0x8'));var attributes=require(_0xe7fa('0x9'));module[_0xe7fa('0xa')]=function(_0x5e7301,_0x1ac172){return _0x5e7301['define'](_0xe7fa('0xb'),attributes,{'tableName':_0xe7fa('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 dc22366..8f64351 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 _0xb11d=['Contacts','FaxApplication','Applications','List','list','applications','orderBy','priority','asc','length','create','find','Contact\x20not\x20found','spread','get','autoclose','push','close','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList'];(function(_0x2edbaa,_0xa3f50b){var _0x17c906=function(_0x36dcf9){while(--_0x36dcf9){_0x2edbaa['push'](_0x2edbaa['shift']());}};_0x17c906(++_0xa3f50b);}(_0xb11d,0x7d));var _0xdb11=function(_0x7d9d62,_0x59061b){_0x7d9d62=_0x7d9d62-0x0;var _0x3ed57a=_0xb11d[_0x7d9d62];return _0x3ed57a;};'use strict';var _=require(_0xdb11('0x0'));var util=require(_0xdb11('0x1'));var moment=require(_0xdb11('0x2'));var BPromise=require(_0xdb11('0x3'));var rs=require(_0xdb11('0x4'));var fs=require('fs');var Redis=require(_0xdb11('0x5'));var db=require(_0xdb11('0x6'))['db'];var utils=require(_0xdb11('0x7'));var logger=require(_0xdb11('0x8'))(_0xdb11('0x9'));var config=require(_0xdb11('0xa'));var jayson=require(_0xdb11('0xb'));var client=jayson[_0xdb11('0xc')][_0xdb11('0xd')]({'port':0x232c});config[_0xdb11('0xe')]=_[_0xdb11('0xf')](config[_0xdb11('0xe')],{'host':_0xdb11('0x10'),'port':0x18eb});var socket=require(_0xdb11('0x11'))(new Redis(config[_0xdb11('0xe')]));require(_0xdb11('0x12'))['register'](socket);function respondWithRpcPromise(_0x1e4da0,_0x5d2774,_0x53e806){return new BPromise(function(_0x594368,_0x13960e){return client[_0xdb11('0x13')](_0x1e4da0,_0x53e806)[_0xdb11('0x14')](function(_0x3a2958){logger[_0xdb11('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5d2774,_0xdb11('0x16'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d2774,_0xdb11('0x16'),JSON[_0xdb11('0x17')](_0x3a2958));if(_0x3a2958[_0xdb11('0x18')]){if(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x19')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5d2774,_0x3a2958[_0xdb11('0x18')]['message']);return _0x13960e(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x1a')]);}logger['error'](_0xdb11('0x1b'),_0x5d2774,_0x3a2958['error'][_0xdb11('0x1a')]);return _0x594368(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x1a')]);}else{logger[_0xdb11('0x15')](_0xdb11('0x1b'),_0x5d2774,'request\x20sent');_0x594368(_0x3a2958[_0xdb11('0x1c')][_0xdb11('0x1a')]);}})[_0xdb11('0x1d')](function(_0x371bfa){logger[_0xdb11('0x18')](_0xdb11('0x1b'),_0x5d2774,_0x371bfa);_0x13960e(_0x371bfa);});});}exports[_0xdb11('0x1e')]=function(_0x27bf61){var _0x37cf78=this;return new Promise(function(_0x501b64,_0x12d1d9){return db[_0xdb11('0x1f')][_0xdb11('0x20')]({'raw':_0x27bf61[_0xdb11('0x21')]?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x22')]===undefined?!![]:![]:!![],'where':_0x27bf61['options']?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x23')]||null:null,'attributes':_0x27bf61[_0xdb11('0x21')]?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x24')]||null:null,'limit':_0x27bf61[_0xdb11('0x21')]?_0x27bf61['options'][_0xdb11('0x25')]||null:null,'include':_0x27bf61[_0xdb11('0x21')]?_0x27bf61['options'][_0xdb11('0x26')]?_[_0xdb11('0x27')](_0x27bf61[_0xdb11('0x21')][_0xdb11('0x26')],function(_0x4cbed8){return{'model':db[_0x4cbed8['model']],'as':_0x4cbed8['as'],'attributes':_0x4cbed8[_0xdb11('0x24')],'include':_0x4cbed8[_0xdb11('0x26')]?_['map'](_0x4cbed8['include'],function(_0x38fedb){return{'model':db[_0x38fedb[_0xdb11('0x28')]],'as':_0x38fedb['as'],'attributes':_0x38fedb[_0xdb11('0x24')],'include':_0x38fedb['include']?_['map'](_0x38fedb[_0xdb11('0x26')],function(_0x1b40fc){return{'model':db[_0x1b40fc['model']],'as':_0x1b40fc['as'],'attributes':_0x1b40fc[_0xdb11('0x24')]};}):[]};}):[]};}):[]:[]})[_0xdb11('0x14')](function(_0x2b4cec){logger[_0xdb11('0x15')](_0xdb11('0x1e'),_0x27bf61);logger[_0xdb11('0x29')](_0xdb11('0x1e'),_0x27bf61,JSON[_0xdb11('0x17')](_0x2b4cec));_0x501b64(_0x2b4cec);})[_0xdb11('0x1d')](function(_0x5b00bc){logger[_0xdb11('0x18')](_0xdb11('0x1e'),_0x5b00bc[_0xdb11('0x1a')],_0x27bf61);_0x12d1d9(_0x37cf78[_0xdb11('0x18')](0x1f4,_0x5b00bc[_0xdb11('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x1b04f1,_0x37dd31,_0x205414){var _0x404cdb=this;return new Promise(function(_0x5e2944,_0x505eed){var _0x5a6d64={'body':_0x1b04f1[_0xdb11('0x2a')],'channel':_0xdb11('0x2b')};var _0x2aab87=[];var _0x9782ff=[];var _0x53a86c={};return db[_0xdb11('0x2c')][_0xdb11('0x2d')]()[_0xdb11('0x14')](function(_0x27ea2a){if(!_0x27ea2a){throw new db['Sequelize'][(_0xdb11('0x2e'))](_0xdb11('0x2f'));}_0x2aab87=_[_0xdb11('0x30')](_['keys'](_0x27ea2a),['createdAt',_0xdb11('0x31')]);_0x9782ff=_[_0xdb11('0x30')](_['keys'](_0x27ea2a),[_0xdb11('0x32'),'updatedAt',_0xdb11('0x33'),_0xdb11('0x34')]);if(_0x1b04f1[_0xdb11('0x2a')]['id']){delete _0x1b04f1['body']['id'];}if(_[_0xdb11('0x35')](_0x1b04f1['body'][_0xdb11('0x36')])){throw new db[(_0xdb11('0x37'))][(_0xdb11('0x2e'))](_0xdb11('0x38'));}if(_[_0xdb11('0x35')](_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')])||_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')]===''){throw new db[(_0xdb11('0x37'))][(_0xdb11('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdb11('0x35')](_0x1b04f1['body'][_0xdb11('0x39')])){throw new db[(_0xdb11('0x37'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9782ff);}if(!_['includes'](_0x9782ff,_0x1b04f1['body']['mapKey'])){throw new db['Sequelize'][(_0xdb11('0x2e'))](_0xdb11('0x3a')+_0x9782ff);}_0x53a86c[_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x39')]]=_0x1b04f1['body'][_0xdb11('0x36')];})[_0xdb11('0x14')](function(){return db[_0xdb11('0x1f')]['find']({'where':{'id':_0x1b04f1[_0xdb11('0x3b')]['id']},'include':[{'model':db[_0xdb11('0x3c')],'as':'List','include':[{'model':db[_0xdb11('0x2c')],'as':_0xdb11('0x3d'),'where':_0x53a86c,'limit':0x1,'order':[[_0xdb11('0x31'),'DESC']]}]},{'model':db[_0xdb11('0x3e')],'as':_0xdb11('0x3f')}]});})[_0xdb11('0x14')](function(_0x85332a){if(_0x85332a&&_0x85332a[_0xdb11('0x40')]){var _0x1b9c99=_0x85332a['get']({'plain':!![]});_0x5a6d64['account']=_0x1b9c99;_0x5a6d64['applications']=_0x1b9c99[_0xdb11('0x3f')];_0x5a6d64[_0xdb11('0x41')]=_0x1b9c99[_0xdb11('0x40')];_0x5a6d64[_0xdb11('0x42')]=_[_0xdb11('0x43')](_0x5a6d64['applications'],[_0xdb11('0x44')],[_0xdb11('0x45')]);if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x3f')]){delete _0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x3f')];}if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x40')]&&_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x40')][_0xdb11('0x3d')][_0xdb11('0x46')]){return _0x5a6d64['account'][_0xdb11('0x40')][_0xdb11('0x3d')][0x0];}var _0x100bea=_[_0xdb11('0xf')](_0x1b04f1['body'],{'firstName':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x36')],'ListId':_0x1b9c99[_0xdb11('0x34')]});_0x100bea[_0x1b04f1['body'][_0xdb11('0x39')]]=_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x36')];return db['CmContact'][_0xdb11('0x47')](_0x100bea,{'fields':_0x2aab87,'raw':!![]});}})['then'](function(_0x1a8c07){_0x5a6d64['contact']=_0x1a8c07;if(_0x1a8c07){var _0x2ade70={'ContactId':_0x1a8c07['id'],'FaxAccountId':_0x1b04f1[_0xdb11('0x3b')]['id'],'fax':_0x1a8c07['fax']};return db['FaxInteraction'][_0xdb11('0x48')]({'where':{'ContactId':_0x1a8c07['id'],'closed':![],'FaxAccountId':_0x1b04f1['account']['id']}})['then'](function(_0x38e15c){if(_0x38e15c){return[_0x38e15c,![]];}return db['FaxInteraction']['create'](_0x2ade70)['then'](function(_0x5efe99){return[_0x5efe99,!![]];});});}else{throw new Error(_0xdb11('0x49'));}})[_0xdb11('0x4a')](function(_0x4c8c5,_0x4a51e8){var _0x317282=_0x4c8c5[_0xdb11('0x4b')]({'plain':!![]});if(_0x4a51e8){if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x4c')]){_0x5a6d64[_0xdb11('0x42')][_0xdb11('0x4d')]({'id':0x0,'priority':_0x5a6d64['applications'][_0xdb11('0x46')]+0x1,'app':_0xdb11('0x4e'),'appdata':'unmanaged','interval':_0xdb11('0x4f')});}_0x317282[_0xdb11('0x50')]=!![];}else{_0x317282['created']=![];}_0x5a6d64['interaction']=_0x317282;return db[_0xdb11('0x51')][_0xdb11('0x47')]({'body':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')],'FaxAccountId':_0x1b04f1['account']['id'],'FaxInteractionId':_0x4c8c5['id'],'direction':'in','ContactId':_0x4c8c5[_0xdb11('0x52')],'AttachmentId':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x53')]});})[_0xdb11('0x14')](function(_0x33a53c){_0x5a6d64[_0xdb11('0x1a')]=_0x33a53c;if(_0x5a6d64['interaction'][_0xdb11('0x54')]){return db[_0xdb11('0x55')][_0xdb11('0x48')]({'attributes':['id',_0xdb11('0x56')],'where':{'id':_0x5a6d64[_0xdb11('0x57')][_0xdb11('0x54')]}})[_0xdb11('0x14')](function(_0x49559f){if(_0x49559f){_0x5a6d64[_0xdb11('0x42')][_0xdb11('0x58')]({'id':0x0,'priority':0x0,'app':_0xdb11('0x59'),'appdata':_0x49559f['name']+','+(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x5a')]||0xa),'interval':_0xdb11('0x4f')});}return respondWithRpcPromise(_0xdb11('0x5b'),_0xdb11('0x5c'),_0x5a6d64);});}return respondWithRpcPromise(_0xdb11('0x5b'),_0xdb11('0x5c'),_0x5a6d64);})[_0xdb11('0x14')](function(_0x45c019){_0x5e2944(_0x45c019);})[_0xdb11('0x1d')](function(_0x1c7643){_0x505eed(_0x404cdb[_0xdb11('0x18')](0x1f4,_0x1c7643[_0xdb11('0x1a')]));});});}; \ No newline at end of file +var _0x2f7f=['applications','list','priority','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','AttachmentId','interaction','UserId','User','name','unshift','waitForTheAssignedAgent','startRouting','Start','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','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','find','List','Contacts','DESC','Applications','get','account'];(function(_0x2062f8,_0x2f259d){var _0x2495b3=function(_0x4d2b92){while(--_0x4d2b92){_0x2062f8['push'](_0x2062f8['shift']());}};_0x2495b3(++_0x2f259d);}(_0x2f7f,0x181));var _0xf2f7=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x2f7f[_0x35d3a8];return _0x182378;};'use strict';var _=require('lodash');var util=require(_0xf2f7('0x0'));var moment=require('moment');var BPromise=require(_0xf2f7('0x1'));var rs=require(_0xf2f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2f7('0x4'))('rpc');var config=require(_0xf2f7('0x5'));var jayson=require(_0xf2f7('0x6'));var client=jayson[_0xf2f7('0x7')][_0xf2f7('0x8')]({'port':0x232c});config['redis']=_['defaults'](config[_0xf2f7('0x9')],{'host':_0xf2f7('0xa'),'port':0x18eb});var socket=require(_0xf2f7('0xb'))(new Redis(config['redis']));require(_0xf2f7('0xc'))[_0xf2f7('0xd')](socket);function respondWithRpcPromise(_0x1ce153,_0x4f6ded,_0x365d72){return new BPromise(function(_0x3e753b,_0x3c0410){return client[_0xf2f7('0xe')](_0x1ce153,_0x365d72)[_0xf2f7('0xf')](function(_0x475db1){logger[_0xf2f7('0x10')](_0xf2f7('0x11'),_0x4f6ded,_0xf2f7('0x12'));logger[_0xf2f7('0x13')](_0xf2f7('0x14'),_0x4f6ded,'request\x20sent',JSON[_0xf2f7('0x15')](_0x475db1));if(_0x475db1['error']){if(_0x475db1[_0xf2f7('0x16')]['code']===0x1f4){logger[_0xf2f7('0x16')](_0xf2f7('0x11'),_0x4f6ded,_0x475db1[_0xf2f7('0x16')]['message']);return _0x3c0410(_0x475db1[_0xf2f7('0x16')][_0xf2f7('0x17')]);}logger['error'](_0xf2f7('0x11'),_0x4f6ded,_0x475db1['error'][_0xf2f7('0x17')]);return _0x3e753b(_0x475db1['error']['message']);}else{logger[_0xf2f7('0x10')](_0xf2f7('0x11'),_0x4f6ded,_0xf2f7('0x12'));_0x3e753b(_0x475db1[_0xf2f7('0x18')]['message']);}})[_0xf2f7('0x19')](function(_0x21b428){logger['error'](_0xf2f7('0x11'),_0x4f6ded,_0x21b428);_0x3c0410(_0x21b428);});});}exports['GetFaxAccount']=function(_0x1ee8d9){var _0xbb5755=this;return new Promise(function(_0x2db7e4,_0x3e9407){return db[_0xf2f7('0x1a')][_0xf2f7('0x1b')]({'raw':_0x1ee8d9[_0xf2f7('0x1c')]?_0x1ee8d9[_0xf2f7('0x1c')][_0xf2f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ee8d9[_0xf2f7('0x1c')]?_0x1ee8d9[_0xf2f7('0x1c')][_0xf2f7('0x1e')]||null:null,'attributes':_0x1ee8d9['options']?_0x1ee8d9[_0xf2f7('0x1c')][_0xf2f7('0x1f')]||null:null,'limit':_0x1ee8d9[_0xf2f7('0x1c')]?_0x1ee8d9[_0xf2f7('0x1c')]['limit']||null:null,'include':_0x1ee8d9[_0xf2f7('0x1c')]?_0x1ee8d9[_0xf2f7('0x1c')][_0xf2f7('0x20')]?_[_0xf2f7('0x21')](_0x1ee8d9['options'][_0xf2f7('0x20')],function(_0x4f0342){return{'model':db[_0x4f0342['model']],'as':_0x4f0342['as'],'attributes':_0x4f0342[_0xf2f7('0x1f')],'include':_0x4f0342['include']?_[_0xf2f7('0x21')](_0x4f0342[_0xf2f7('0x20')],function(_0x2e5978){return{'model':db[_0x2e5978[_0xf2f7('0x22')]],'as':_0x2e5978['as'],'attributes':_0x2e5978[_0xf2f7('0x1f')],'include':_0x2e5978['include']?_['map'](_0x2e5978[_0xf2f7('0x20')],function(_0x4552d6){return{'model':db[_0x4552d6['model']],'as':_0x4552d6['as'],'attributes':_0x4552d6[_0xf2f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf2f7('0xf')](function(_0x323c64){logger[_0xf2f7('0x10')](_0xf2f7('0x23'),_0x1ee8d9);logger[_0xf2f7('0x13')](_0xf2f7('0x23'),_0x1ee8d9,JSON[_0xf2f7('0x15')](_0x323c64));_0x2db7e4(_0x323c64);})[_0xf2f7('0x19')](function(_0x1289df){logger[_0xf2f7('0x16')](_0xf2f7('0x23'),_0x1289df[_0xf2f7('0x17')],_0x1ee8d9);_0x3e9407(_0xbb5755['error'](0x1f4,_0x1289df[_0xf2f7('0x17')]));});});};exports[_0xf2f7('0x24')]=function(_0x4b761c,_0x3ebb4c,_0x37c42d){var _0x372f6d=this;return new Promise(function(_0x471817,_0x39a7ab){var _0x21688b={'body':_0x4b761c[_0xf2f7('0x25')],'channel':_0xf2f7('0x26')};var _0x5d922e=[];var _0x18c0d2=[];var _0x3eddcf={};return db[_0xf2f7('0x27')][_0xf2f7('0x28')]()[_0xf2f7('0xf')](function(_0x1e2468){if(!_0x1e2468){throw new db['Sequelize']['ValidationError'](_0xf2f7('0x29'));}_0x5d922e=_[_0xf2f7('0x2a')](_['keys'](_0x1e2468),[_0xf2f7('0x2b'),_0xf2f7('0x2c')]);_0x18c0d2=_[_0xf2f7('0x2a')](_[_0xf2f7('0x2d')](_0x1e2468),['createdAt',_0xf2f7('0x2c'),_0xf2f7('0x2e'),_0xf2f7('0x2f')]);if(_0x4b761c[_0xf2f7('0x25')]['id']){delete _0x4b761c['body']['id'];}if(_[_0xf2f7('0x30')](_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x31')])){throw new db[(_0xf2f7('0x32'))][(_0xf2f7('0x33'))](_0xf2f7('0x34'));}if(_[_0xf2f7('0x30')](_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x25')])||_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x25')]===''){throw new db[(_0xf2f7('0x32'))][(_0xf2f7('0x33'))](_0xf2f7('0x35'));}if(_[_0xf2f7('0x30')](_0x4b761c['body'][_0xf2f7('0x36')])){throw new db[(_0xf2f7('0x32'))]['ValidationError'](_0xf2f7('0x37')+_0x18c0d2);}if(!_[_0xf2f7('0x38')](_0x18c0d2,_0x4b761c[_0xf2f7('0x25')]['mapKey'])){throw new db['Sequelize'][(_0xf2f7('0x33'))](_0xf2f7('0x39')+_0x18c0d2);}_0x3eddcf[_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x36')]]=_0x4b761c['body'][_0xf2f7('0x31')];})[_0xf2f7('0xf')](function(){return db['FaxAccount'][_0xf2f7('0x3a')]({'where':{'id':_0x4b761c['account']['id']},'include':[{'model':db['CmList'],'as':_0xf2f7('0x3b'),'include':[{'model':db[_0xf2f7('0x27')],'as':_0xf2f7('0x3c'),'where':_0x3eddcf,'limit':0x1,'order':[['updatedAt',_0xf2f7('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0xf2f7('0x3e')}]});})['then'](function(_0x2e02fe){if(_0x2e02fe&&_0x2e02fe[_0xf2f7('0x3b')]){var _0x52580e=_0x2e02fe[_0xf2f7('0x3f')]({'plain':!![]});_0x21688b[_0xf2f7('0x40')]=_0x52580e;_0x21688b[_0xf2f7('0x41')]=_0x52580e['Applications'];_0x21688b[_0xf2f7('0x42')]=_0x52580e[_0xf2f7('0x3b')];_0x21688b[_0xf2f7('0x41')]=_['orderBy'](_0x21688b[_0xf2f7('0x41')],[_0xf2f7('0x43')],[_0xf2f7('0x44')]);if(_0x21688b[_0xf2f7('0x40')][_0xf2f7('0x3e')]){delete _0x21688b[_0xf2f7('0x40')][_0xf2f7('0x3e')];}if(_0x21688b[_0xf2f7('0x40')][_0xf2f7('0x3b')]&&_0x21688b['account'][_0xf2f7('0x3b')][_0xf2f7('0x3c')][_0xf2f7('0x45')]){return _0x21688b[_0xf2f7('0x40')][_0xf2f7('0x3b')][_0xf2f7('0x3c')][0x0];}var _0x597be5=_[_0xf2f7('0x46')](_0x4b761c[_0xf2f7('0x25')],{'firstName':_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x31')],'ListId':_0x52580e[_0xf2f7('0x2f')]});_0x597be5[_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x36')]]=_0x4b761c[_0xf2f7('0x25')]['from'];return db[_0xf2f7('0x27')][_0xf2f7('0x47')](_0x597be5,{'fields':_0x5d922e,'raw':!![]});}})[_0xf2f7('0xf')](function(_0x177312){_0x21688b[_0xf2f7('0x48')]=_0x177312;if(_0x177312){var _0x2a81f6={'ContactId':_0x177312['id'],'FaxAccountId':_0x4b761c[_0xf2f7('0x40')]['id'],'fax':_0x177312['fax']};return db[_0xf2f7('0x49')][_0xf2f7('0x3a')]({'where':{'ContactId':_0x177312['id'],'closed':![],'FaxAccountId':_0x4b761c[_0xf2f7('0x40')]['id']}})[_0xf2f7('0xf')](function(_0xe4246b){if(_0xe4246b){return[_0xe4246b,![]];}return db[_0xf2f7('0x49')][_0xf2f7('0x47')](_0x2a81f6)[_0xf2f7('0xf')](function(_0x161f7b){return[_0x161f7b,!![]];});});}else{throw new Error(_0xf2f7('0x4a'));}})[_0xf2f7('0x4b')](function(_0x1492e0,_0x426385){var _0x476f80=_0x1492e0[_0xf2f7('0x3f')]({'plain':!![]});if(_0x426385){if(_0x21688b[_0xf2f7('0x40')]['autoclose']){_0x21688b['applications'][_0xf2f7('0x4c')]({'id':0x0,'priority':_0x21688b['applications'][_0xf2f7('0x45')]+0x1,'app':_0xf2f7('0x4d'),'appdata':_0xf2f7('0x4e'),'interval':_0xf2f7('0x4f')});}_0x476f80[_0xf2f7('0x50')]=!![];}else{_0x476f80[_0xf2f7('0x50')]=![];}_0x21688b['interaction']=_0x476f80;return db['FaxMessage'][_0xf2f7('0x47')]({'body':_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x25')],'FaxAccountId':_0x4b761c[_0xf2f7('0x40')]['id'],'FaxInteractionId':_0x1492e0['id'],'direction':'in','ContactId':_0x1492e0['ContactId'],'AttachmentId':_0x4b761c[_0xf2f7('0x25')][_0xf2f7('0x51')]});})[_0xf2f7('0xf')](function(_0xb6b9cc){_0x21688b[_0xf2f7('0x17')]=_0xb6b9cc;if(_0x21688b[_0xf2f7('0x52')][_0xf2f7('0x53')]){return db[_0xf2f7('0x54')][_0xf2f7('0x3a')]({'attributes':['id',_0xf2f7('0x55')],'where':{'id':_0x21688b[_0xf2f7('0x52')][_0xf2f7('0x53')]}})[_0xf2f7('0xf')](function(_0x45c71e){if(_0x45c71e){_0x21688b[_0xf2f7('0x41')][_0xf2f7('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x45c71e[_0xf2f7('0x55')]+','+(_0x21688b['account'][_0xf2f7('0x57')]||0xa),'interval':_0xf2f7('0x4f')});}return respondWithRpcPromise('Start',_0xf2f7('0x58'),_0x21688b);});}return respondWithRpcPromise(_0xf2f7('0x59'),_0xf2f7('0x58'),_0x21688b);})[_0xf2f7('0xf')](function(_0x4db0b5){_0x471817(_0x4db0b5);})[_0xf2f7('0x19')](function(_0x70cc28){_0x39a7ab(_0x372f6d[_0xf2f7('0x16')](0x1f4,_0x70cc28['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index ebe58a9..e82d6a7 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 _0x1917=['save','remove','update','emit','removeListener','faxAccount:','./faxAccount.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1917,0x1aa));var _0x7191=function(_0xfff036,_0x24b67e){_0xfff036=_0xfff036-0x0;var _0x40e3da=_0x1917[_0xfff036];return _0x40e3da;};'use strict';var FaxAccountEvents=require(_0x7191('0x0'));var events=[_0x7191('0x1'),_0x7191('0x2'),_0x7191('0x3')];function createListener(_0x27662e,_0x1e269d){return function(_0x46e0a3){_0x1e269d[_0x7191('0x4')](_0x27662e,_0x46e0a3);};}function removeListener(_0x5d4290,_0x2869f4){return function(){FaxAccountEvents[_0x7191('0x5')](_0x5d4290,_0x2869f4);};}exports['register']=function(_0x5a7f8a){for(var _0x4ef5fe=0x0,_0x46565e=events['length'];_0x4ef5fe<_0x46565e;_0x4ef5fe++){var _0x1c6701=events[_0x4ef5fe];var _0x1bc3d2=createListener(_0x7191('0x6')+_0x1c6701,_0x5a7f8a);FaxAccountEvents['on'](_0x1c6701,_0x1bc3d2);}}; \ No newline at end of file +var _0xa889=['length','faxAccount:','./faxAccount.events','remove','emit','register'];(function(_0x105b65,_0x3b7d21){var _0xd8ff8c=function(_0x5acaf9){while(--_0x5acaf9){_0x105b65['push'](_0x105b65['shift']());}};_0xd8ff8c(++_0x3b7d21);}(_0xa889,0xc2));var _0x9a88=function(_0x2de869,_0xda6014){_0x2de869=_0x2de869-0x0;var _0x2b6241=_0xa889[_0x2de869];return _0x2b6241;};'use strict';var FaxAccountEvents=require(_0x9a88('0x0'));var events=['save',_0x9a88('0x1'),'update'];function createListener(_0x80f55e,_0xd372f7){return function(_0x36526e){_0xd372f7[_0x9a88('0x2')](_0x80f55e,_0x36526e);};}function removeListener(_0x5685cf,_0x5a0bd8){return function(){FaxAccountEvents['removeListener'](_0x5685cf,_0x5a0bd8);};}exports[_0x9a88('0x3')]=function(_0x1800ed){for(var _0x385837=0x0,_0x47b89d=events[_0x9a88('0x4')];_0x385837<_0x47b89d;_0x385837++){var _0x2ab013=events[_0x385837];var _0x4e5a4e=createListener(_0x9a88('0x5')+_0x2ab013,_0x1800ed);FaxAccountEvents['on'](_0x2ab013,_0x4e5a4e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 39d9515..fe8abcf 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(_0x4bc88a,_0x5f1427){var _0x5429c0=function(_0x36116f){while(--_0x36116f){_0x4bc88a['push'](_0x4bc88a['shift']());}};_0x5429c0(++_0x5f1427);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x4d9c59,_0x4e44c8){var _0x166b0b=function(_0x2c26bf){while(--_0x2c26bf){_0x4d9c59['push'](_0x4d9c59['shift']());}};_0x166b0b(++_0x4e44c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 acc81f5..7dbb2da 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 _0x9daf=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x404fd8,_0x136cac){var _0x330229=function(_0x375c2f){while(--_0x375c2f){_0x404fd8['push'](_0x404fd8['shift']());}};_0x330229(++_0x136cac);}(_0x9daf,0x145));var _0xf9da=function(_0x5bd60b,_0x13465a){_0x5bd60b=_0x5bd60b-0x0;var _0x2dcff0=_0x9daf[_0x5bd60b];return _0x2dcff0;};'use strict';var Sequelize=require(_0xf9da('0x0'));module[_0xf9da('0x1')]={'priority':{'type':Sequelize[_0xf9da('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf9da('0x3')],'allowNull':![],'defaultValue':_0xf9da('0x4')},'appdata':{'type':Sequelize[_0xf9da('0x5')]()},'description':{'type':Sequelize[_0xf9da('0x3')]},'interval':{'type':Sequelize[_0xf9da('0x3')],'defaultValue':_0xf9da('0x6')}}; \ No newline at end of file +var _0x7a26=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x3bb14a,_0x57329f){var _0x29fc8a=function(_0x202739){while(--_0x202739){_0x3bb14a['push'](_0x3bb14a['shift']());}};_0x29fc8a(++_0x57329f);}(_0x7a26,0x102));var _0x67a2=function(_0x348221,_0x52898e){_0x348221=_0x348221-0x0;var _0x463526=_0x7a26[_0x348221];return _0x463526;};'use strict';var Sequelize=require(_0x67a2('0x0'));module[_0x67a2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x67a2('0x2')],'allowNull':![],'defaultValue':_0x67a2('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x67a2('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x67a2('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e5f2019..26bbcb1 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 _0x4c31=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','FaxApplication','include','findAll','rows','catch','show','params','includeAll','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2873ab,_0x35f875){var _0x320348=function(_0x2a99ff){while(--_0x2a99ff){_0x2873ab['push'](_0x2873ab['shift']());}};_0x320348(++_0x35f875);}(_0x4c31,0x1df));var _0x14c3=function(_0x3e7392,_0x37a22d){_0x3e7392=_0x3e7392-0x0;var _0x50439d=_0x4c31[_0x3e7392];return _0x50439d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c3('0x1'));var rp=require(_0x14c3('0x2'));var moment=require(_0x14c3('0x3'));var BPromise=require(_0x14c3('0x4'));var Mustache=require(_0x14c3('0x5'));var util=require('util');var path=require(_0x14c3('0x6'));var sox=require(_0x14c3('0x7'));var csv=require(_0x14c3('0x8'));var ejs=require(_0x14c3('0x9'));var fs=require('fs');var fs_extra=require(_0x14c3('0xa'));var _=require(_0x14c3('0xb'));var squel=require('squel');var crypto=require(_0x14c3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x14c3('0x8'));var querystring=require(_0x14c3('0xd'));var Papa=require(_0x14c3('0xe'));var Redis=require('ioredis');var authService=require(_0x14c3('0xf'));var qs=require(_0x14c3('0x10'));var as=require(_0x14c3('0x11'));var hardwareService=require(_0x14c3('0x12'));var logger=require('../../config/logger')(_0x14c3('0x13'));var utils=require(_0x14c3('0x14'));var config=require(_0x14c3('0x15'));var licenseUtil=require(_0x14c3('0x16'));var db=require(_0x14c3('0x17'))['db'];function respondWithStatusCode(_0xe03528,_0x558a75){_0x558a75=_0x558a75||0xcc;return function(_0x343bbe){if(_0x343bbe){return _0xe03528[_0x14c3('0x18')](_0x558a75);}return _0xe03528['status'](_0x558a75)[_0x14c3('0x19')]();};}function respondWithResult(_0x3fc26a,_0x26a0a8){_0x26a0a8=_0x26a0a8||0xc8;return function(_0x482913){if(_0x482913){return _0x3fc26a[_0x14c3('0x1a')](_0x26a0a8)[_0x14c3('0x1b')](_0x482913);}};}function respondWithFilteredResult(_0x58c36f,_0x5189dc){return function(_0x263fd0){if(_0x263fd0){var _0x4f9244=typeof _0x5189dc[_0x14c3('0x1c')]===_0x14c3('0x1d')&&typeof _0x5189dc[_0x14c3('0x1e')]===_0x14c3('0x1d');var _0x593d5f=_0x263fd0[_0x14c3('0x1f')];var _0xf2435a=_0x4f9244?0x0:_0x5189dc[_0x14c3('0x1c')];var _0x43a07c=_0x4f9244?_0x263fd0[_0x14c3('0x1f')]:_0x5189dc[_0x14c3('0x1c')]+_0x5189dc[_0x14c3('0x1e')];var _0xc5d1d1;if(_0x43a07c>=_0x593d5f){_0x43a07c=_0x593d5f;_0xc5d1d1=0xc8;}else{_0xc5d1d1=0xce;}_0x58c36f[_0x14c3('0x1a')](_0xc5d1d1);return _0x58c36f[_0x14c3('0x20')](_0x14c3('0x21'),_0xf2435a+'-'+_0x43a07c+'/'+_0x593d5f)['json'](_0x263fd0);}return null;};}function patchUpdates(_0xa1989e){return function(_0x2d03a7){try{jsonpatch[_0x14c3('0x22')](_0x2d03a7,_0xa1989e,!![]);}catch(_0x53ade2){return BPromise[_0x14c3('0x23')](_0x53ade2);}return _0x2d03a7['save']();};}function saveUpdates(_0x14eb25,_0x51ec7e){return function(_0x78b730){if(_0x78b730){return _0x78b730[_0x14c3('0x24')](_0x14eb25)[_0x14c3('0x25')](function(_0x365f66){return _0x365f66;});}return null;};}function removeEntity(_0x5cb8ff,_0x1642d0){return function(_0x2ac275){if(_0x2ac275){return _0x2ac275[_0x14c3('0x26')]()[_0x14c3('0x25')](function(){_0x5cb8ff[_0x14c3('0x1a')](0xcc)[_0x14c3('0x19')]();});}};}function handleEntityNotFound(_0x170859,_0x31ab89){return function(_0x1318c1){if(!_0x1318c1){_0x170859[_0x14c3('0x18')](0x194);}return _0x1318c1;};}function handleError(_0x3f0cc2,_0xc69ab9){_0xc69ab9=_0xc69ab9||0x1f4;return function(_0xade6a2){logger[_0x14c3('0x27')](_0xade6a2['stack']);if(_0xade6a2[_0x14c3('0x28')]){delete _0xade6a2[_0x14c3('0x28')];}_0x3f0cc2['status'](_0xc69ab9)[_0x14c3('0x29')](_0xade6a2);};}exports[_0x14c3('0x2a')]=function(_0x3e013e,_0x246f12){var _0x29b19a={},_0x3cbc8a={},_0x935035={'count':0x0,'rows':[]};var _0x5be36f=_['map'](db['FaxApplication'][_0x14c3('0x2b')],function(_0x5f4b16){return{'name':_0x5f4b16['fieldName'],'type':_0x5f4b16['type']['key']};});_0x3cbc8a[_0x14c3('0x2c')]=_[_0x14c3('0x2d')](_0x5be36f,'name');_0x3cbc8a[_0x14c3('0x2e')]=_[_0x14c3('0x2f')](_0x3e013e[_0x14c3('0x2e')]);_0x3cbc8a[_0x14c3('0x30')]=_[_0x14c3('0x31')](_0x3cbc8a['model'],_0x3cbc8a['query']);_0x29b19a[_0x14c3('0x32')]=_[_0x14c3('0x31')](_0x3cbc8a[_0x14c3('0x2c')],qs[_0x14c3('0x33')](_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x33')]));_0x29b19a['attributes']=_0x29b19a[_0x14c3('0x32')][_0x14c3('0x34')]?_0x29b19a[_0x14c3('0x32')]:_0x3cbc8a[_0x14c3('0x2c')];if(!_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x35')]('nolimit')){_0x29b19a[_0x14c3('0x1e')]=qs[_0x14c3('0x1e')](_0x3e013e[_0x14c3('0x2e')]['limit']);_0x29b19a['offset']=qs['offset'](_0x3e013e['query'][_0x14c3('0x1c')]);}_0x29b19a[_0x14c3('0x36')]=qs[_0x14c3('0x37')](_0x3e013e['query'][_0x14c3('0x37')]);_0x29b19a[_0x14c3('0x38')]=qs[_0x14c3('0x30')](_[_0x14c3('0x39')](_0x3e013e[_0x14c3('0x2e')],_0x3cbc8a['filters']),_0x5be36f);if(_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x3a')]){_0x29b19a[_0x14c3('0x38')]=_[_0x14c3('0x3b')](_0x29b19a[_0x14c3('0x38')],{'$or':_['map'](_0x5be36f,function(_0x154388){if(_0x154388[_0x14c3('0x3c')]!=='VIRTUAL'){var _0x1a8acd={};_0x1a8acd[_0x154388[_0x14c3('0x28')]]={'$like':'%'+_0x3e013e['query'][_0x14c3('0x3a')]+'%'};return _0x1a8acd;}})});}_0x29b19a=_[_0x14c3('0x3b')]({},_0x29b19a,_0x3e013e[_0x14c3('0x3d')]);var _0x283d8a={'where':_0x29b19a[_0x14c3('0x38')]};return db[_0x14c3('0x3e')][_0x14c3('0x1f')](_0x283d8a)[_0x14c3('0x25')](function(_0x9f01c6){_0x935035[_0x14c3('0x1f')]=_0x9f01c6;if(_0x3e013e[_0x14c3('0x2e')]['includeAll']){_0x29b19a[_0x14c3('0x3f')]=[{'all':!![]}];}return db[_0x14c3('0x3e')][_0x14c3('0x40')](_0x29b19a);})[_0x14c3('0x25')](function(_0x2a2772){_0x935035[_0x14c3('0x41')]=_0x2a2772;return _0x935035;})[_0x14c3('0x25')](respondWithFilteredResult(_0x246f12,_0x29b19a))[_0x14c3('0x42')](handleError(_0x246f12,null));};exports[_0x14c3('0x43')]=function(_0x32b5a1,_0x19b549){var _0xc77195={'raw':!![],'where':{'id':_0x32b5a1[_0x14c3('0x44')]['id']}},_0x58341e={};_0x58341e[_0x14c3('0x2c')]=_['keys'](db['FaxApplication'][_0x14c3('0x2b')]);_0x58341e[_0x14c3('0x2e')]=_[_0x14c3('0x2f')](_0x32b5a1[_0x14c3('0x2e')]);_0x58341e[_0x14c3('0x30')]=_[_0x14c3('0x31')](_0x58341e[_0x14c3('0x2c')],_0x58341e[_0x14c3('0x2e')]);_0xc77195[_0x14c3('0x32')]=_[_0x14c3('0x31')](_0x58341e['model'],qs[_0x14c3('0x33')](_0x32b5a1[_0x14c3('0x2e')][_0x14c3('0x33')]));_0xc77195[_0x14c3('0x32')]=_0xc77195[_0x14c3('0x32')][_0x14c3('0x34')]?_0xc77195[_0x14c3('0x32')]:_0x58341e[_0x14c3('0x2c')];if(_0x32b5a1[_0x14c3('0x2e')][_0x14c3('0x45')]){_0xc77195[_0x14c3('0x3f')]=[{'all':!![]}];}_0xc77195=_[_0x14c3('0x3b')]({},_0xc77195,_0x32b5a1[_0x14c3('0x3d')]);return db[_0x14c3('0x3e')]['find'](_0xc77195)[_0x14c3('0x25')](handleEntityNotFound(_0x19b549,null))[_0x14c3('0x25')](respondWithResult(_0x19b549,null))[_0x14c3('0x42')](handleError(_0x19b549,null));};exports['create']=function(_0x52912d,_0x3f699b){return db['FaxApplication']['create'](_0x52912d[_0x14c3('0x46')],{})['then'](respondWithResult(_0x3f699b,0xc9))[_0x14c3('0x42')](handleError(_0x3f699b,null));};exports[_0x14c3('0x24')]=function(_0x1603a9,_0x1b0ebb){if(_0x1603a9[_0x14c3('0x46')]['id']){delete _0x1603a9[_0x14c3('0x46')]['id'];}return db[_0x14c3('0x3e')]['find']({'where':{'id':_0x1603a9[_0x14c3('0x44')]['id']}})[_0x14c3('0x25')](handleEntityNotFound(_0x1b0ebb,null))[_0x14c3('0x25')](saveUpdates(_0x1603a9[_0x14c3('0x46')],null))[_0x14c3('0x25')](respondWithResult(_0x1b0ebb,null))[_0x14c3('0x42')](handleError(_0x1b0ebb,null));};exports[_0x14c3('0x26')]=function(_0x1caa7a,_0x2b7fe1){return db[_0x14c3('0x3e')][_0x14c3('0x47')]({'where':{'id':_0x1caa7a[_0x14c3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b7fe1,null))[_0x14c3('0x25')](removeEntity(_0x2b7fe1,null))['catch'](handleError(_0x2b7fe1,null));}; \ No newline at end of file +var _0xa864=['includeAll','include','findAll','rows','show','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where'];(function(_0x62b0dd,_0x3011a4){var _0x4f874c=function(_0x5624e4){while(--_0x5624e4){_0x62b0dd['push'](_0x62b0dd['shift']());}};_0x4f874c(++_0x3011a4);}(_0xa864,0xa6));var _0x4a86=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xa864[_0x492535];return _0x256620;};'use strict';var emlformat=require(_0x4a86('0x0'));var rimraf=require(_0x4a86('0x1'));var zipdir=require(_0x4a86('0x2'));var jsonpatch=require(_0x4a86('0x3'));var rp=require(_0x4a86('0x4'));var moment=require(_0x4a86('0x5'));var BPromise=require(_0x4a86('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4a86('0x7'));var sox=require(_0x4a86('0x8'));var csv=require(_0x4a86('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a86('0xa'));var _=require(_0x4a86('0xb'));var squel=require(_0x4a86('0xc'));var crypto=require(_0x4a86('0xd'));var jsforce=require(_0x4a86('0xe'));var deskjs=require(_0x4a86('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4a86('0x10'));var Papa=require(_0x4a86('0x11'));var Redis=require(_0x4a86('0x12'));var authService=require(_0x4a86('0x13'));var qs=require(_0x4a86('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a86('0x15'));var logger=require(_0x4a86('0x16'))(_0x4a86('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a86('0x18'));var db=require(_0x4a86('0x19'))['db'];function respondWithStatusCode(_0x14083f,_0x280d1a){_0x280d1a=_0x280d1a||0xcc;return function(_0x1a280f){if(_0x1a280f){return _0x14083f[_0x4a86('0x1a')](_0x280d1a);}return _0x14083f['status'](_0x280d1a)[_0x4a86('0x1b')]();};}function respondWithResult(_0x217784,_0x3f28e1){_0x3f28e1=_0x3f28e1||0xc8;return function(_0x38846d){if(_0x38846d){return _0x217784[_0x4a86('0x1c')](_0x3f28e1)[_0x4a86('0x1d')](_0x38846d);}};}function respondWithFilteredResult(_0x29cfa5,_0x5df5ce){return function(_0x58cff3){if(_0x58cff3){var _0x4eb2e5=typeof _0x5df5ce[_0x4a86('0x1e')]===_0x4a86('0x1f')&&typeof _0x5df5ce['limit']===_0x4a86('0x1f');var _0x2220a8=_0x58cff3[_0x4a86('0x20')];var _0x48aa5b=_0x4eb2e5?0x0:_0x5df5ce[_0x4a86('0x1e')];var _0x98855e=_0x4eb2e5?_0x58cff3['count']:_0x5df5ce[_0x4a86('0x1e')]+_0x5df5ce[_0x4a86('0x21')];var _0x41601f;if(_0x98855e>=_0x2220a8){_0x98855e=_0x2220a8;_0x41601f=0xc8;}else{_0x41601f=0xce;}_0x29cfa5['status'](_0x41601f);return _0x29cfa5['set'](_0x4a86('0x22'),_0x48aa5b+'-'+_0x98855e+'/'+_0x2220a8)[_0x4a86('0x1d')](_0x58cff3);}return null;};}function patchUpdates(_0x3144b4){return function(_0x3a1c2f){try{jsonpatch['apply'](_0x3a1c2f,_0x3144b4,!![]);}catch(_0x3faef9){return BPromise[_0x4a86('0x23')](_0x3faef9);}return _0x3a1c2f['save']();};}function saveUpdates(_0x5b9dd6,_0x2fde91){return function(_0x3268aa){if(_0x3268aa){return _0x3268aa[_0x4a86('0x24')](_0x5b9dd6)[_0x4a86('0x25')](function(_0x5e8ca1){return _0x5e8ca1;});}return null;};}function removeEntity(_0xf42ba8,_0x19c370){return function(_0x5901f1){if(_0x5901f1){return _0x5901f1[_0x4a86('0x26')]()[_0x4a86('0x25')](function(){_0xf42ba8[_0x4a86('0x1c')](0xcc)[_0x4a86('0x1b')]();});}};}function handleEntityNotFound(_0x1953d3,_0x113d87){return function(_0x35eb60){if(!_0x35eb60){_0x1953d3[_0x4a86('0x1a')](0x194);}return _0x35eb60;};}function handleError(_0x557da5,_0xf355a5){_0xf355a5=_0xf355a5||0x1f4;return function(_0x97f09a){logger[_0x4a86('0x27')](_0x97f09a[_0x4a86('0x28')]);if(_0x97f09a['name']){delete _0x97f09a[_0x4a86('0x29')];}_0x557da5[_0x4a86('0x1c')](_0xf355a5)[_0x4a86('0x2a')](_0x97f09a);};}exports[_0x4a86('0x2b')]=function(_0x25e48b,_0xe1c7ab){var _0x5757e6={},_0x40df9d={},_0xcda655={'count':0x0,'rows':[]};var _0x590108=_['map'](db[_0x4a86('0x2c')][_0x4a86('0x2d')],function(_0x5938c6){return{'name':_0x5938c6[_0x4a86('0x2e')],'type':_0x5938c6[_0x4a86('0x2f')][_0x4a86('0x30')]};});_0x40df9d['model']=_[_0x4a86('0x31')](_0x590108,_0x4a86('0x29'));_0x40df9d['query']=_[_0x4a86('0x32')](_0x25e48b[_0x4a86('0x33')]);_0x40df9d['filters']=_[_0x4a86('0x34')](_0x40df9d[_0x4a86('0x35')],_0x40df9d[_0x4a86('0x33')]);_0x5757e6[_0x4a86('0x36')]=_[_0x4a86('0x34')](_0x40df9d[_0x4a86('0x35')],qs[_0x4a86('0x37')](_0x25e48b[_0x4a86('0x33')][_0x4a86('0x37')]));_0x5757e6[_0x4a86('0x36')]=_0x5757e6[_0x4a86('0x36')][_0x4a86('0x38')]?_0x5757e6[_0x4a86('0x36')]:_0x40df9d[_0x4a86('0x35')];if(!_0x25e48b[_0x4a86('0x33')][_0x4a86('0x39')](_0x4a86('0x3a'))){_0x5757e6['limit']=qs['limit'](_0x25e48b[_0x4a86('0x33')][_0x4a86('0x21')]);_0x5757e6[_0x4a86('0x1e')]=qs[_0x4a86('0x1e')](_0x25e48b['query'][_0x4a86('0x1e')]);}_0x5757e6[_0x4a86('0x3b')]=qs[_0x4a86('0x3c')](_0x25e48b['query'][_0x4a86('0x3c')]);_0x5757e6['where']=qs[_0x4a86('0x3d')](_[_0x4a86('0x3e')](_0x25e48b[_0x4a86('0x33')],_0x40df9d[_0x4a86('0x3d')]),_0x590108);if(_0x25e48b[_0x4a86('0x33')][_0x4a86('0x3f')]){_0x5757e6['where']=_[_0x4a86('0x40')](_0x5757e6['where'],{'$or':_[_0x4a86('0x31')](_0x590108,function(_0x1a37a2){if(_0x1a37a2[_0x4a86('0x2f')]!==_0x4a86('0x41')){var _0x266f30={};_0x266f30[_0x1a37a2[_0x4a86('0x29')]]={'$like':'%'+_0x25e48b[_0x4a86('0x33')][_0x4a86('0x3f')]+'%'};return _0x266f30;}})});}_0x5757e6=_[_0x4a86('0x40')]({},_0x5757e6,_0x25e48b[_0x4a86('0x42')]);var _0x48ab91={'where':_0x5757e6[_0x4a86('0x43')]};return db[_0x4a86('0x2c')][_0x4a86('0x20')](_0x48ab91)[_0x4a86('0x25')](function(_0x3f6f69){_0xcda655[_0x4a86('0x20')]=_0x3f6f69;if(_0x25e48b[_0x4a86('0x33')][_0x4a86('0x44')]){_0x5757e6[_0x4a86('0x45')]=[{'all':!![]}];}return db[_0x4a86('0x2c')][_0x4a86('0x46')](_0x5757e6);})[_0x4a86('0x25')](function(_0x27e278){_0xcda655[_0x4a86('0x47')]=_0x27e278;return _0xcda655;})[_0x4a86('0x25')](respondWithFilteredResult(_0xe1c7ab,_0x5757e6))['catch'](handleError(_0xe1c7ab,null));};exports[_0x4a86('0x48')]=function(_0x2598fb,_0x485ffc){var _0x3ba562={'raw':!![],'where':{'id':_0x2598fb['params']['id']}},_0x804c19={};_0x804c19['model']=_['keys'](db[_0x4a86('0x2c')]['rawAttributes']);_0x804c19[_0x4a86('0x33')]=_[_0x4a86('0x32')](_0x2598fb[_0x4a86('0x33')]);_0x804c19[_0x4a86('0x3d')]=_[_0x4a86('0x34')](_0x804c19[_0x4a86('0x35')],_0x804c19['query']);_0x3ba562['attributes']=_['intersection'](_0x804c19[_0x4a86('0x35')],qs['fields'](_0x2598fb[_0x4a86('0x33')]['fields']));_0x3ba562['attributes']=_0x3ba562['attributes'][_0x4a86('0x38')]?_0x3ba562['attributes']:_0x804c19[_0x4a86('0x35')];if(_0x2598fb[_0x4a86('0x33')][_0x4a86('0x44')]){_0x3ba562[_0x4a86('0x45')]=[{'all':!![]}];}_0x3ba562=_[_0x4a86('0x40')]({},_0x3ba562,_0x2598fb['options']);return db[_0x4a86('0x2c')]['find'](_0x3ba562)[_0x4a86('0x25')](handleEntityNotFound(_0x485ffc,null))[_0x4a86('0x25')](respondWithResult(_0x485ffc,null))[_0x4a86('0x49')](handleError(_0x485ffc,null));};exports[_0x4a86('0x4a')]=function(_0x560ba5,_0x474c79){return db[_0x4a86('0x2c')]['create'](_0x560ba5['body'],{})[_0x4a86('0x25')](respondWithResult(_0x474c79,0xc9))[_0x4a86('0x49')](handleError(_0x474c79,null));};exports[_0x4a86('0x24')]=function(_0x1d16de,_0xd8dbca){if(_0x1d16de[_0x4a86('0x4b')]['id']){delete _0x1d16de[_0x4a86('0x4b')]['id'];}return db[_0x4a86('0x2c')][_0x4a86('0x4c')]({'where':{'id':_0x1d16de['params']['id']}})[_0x4a86('0x25')](handleEntityNotFound(_0xd8dbca,null))[_0x4a86('0x25')](saveUpdates(_0x1d16de[_0x4a86('0x4b')],null))[_0x4a86('0x25')](respondWithResult(_0xd8dbca,null))['catch'](handleError(_0xd8dbca,null));};exports[_0x4a86('0x26')]=function(_0x4356ae,_0x3888c2){return db[_0x4a86('0x2c')][_0x4a86('0x4c')]({'where':{'id':_0x4356ae[_0x4a86('0x4d')]['id']}})[_0x4a86('0x25')](handleEntityNotFound(_0x3888c2,null))[_0x4a86('0x25')](removeEntity(_0x3888c2,null))['catch'](handleError(_0x3888c2,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e906abc..6dcdf51 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 _0x423d=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x449f15,_0x58f53c){var _0x111397=function(_0x3b245f){while(--_0x3b245f){_0x449f15['push'](_0x449f15['shift']());}};_0x111397(++_0x58f53c);}(_0x423d,0x125));var _0xd423=function(_0x45ad76,_0x1c40ea){_0x45ad76=_0x45ad76-0x0;var _0x47ee4b=_0x423d[_0x45ad76];return _0x47ee4b;};'use strict';var _=require('lodash');var util=require(_0xd423('0x0'));var logger=require(_0xd423('0x1'))('api');var moment=require(_0xd423('0x2'));var BPromise=require(_0xd423('0x3'));var rp=require(_0xd423('0x4'));var fs=require('fs');var path=require(_0xd423('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd423('0x6'));module[_0xd423('0x7')]=function(_0x32aa5b,_0x28e52f){return _0x32aa5b[_0xd423('0x8')](_0xd423('0x9'),attributes,{'tableName':_0xd423('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd423('0xb'),'collate':_0xd423('0xc')});}; \ No newline at end of file +var _0x7780=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./faxApplication.attributes','define'];(function(_0x5b1362,_0x4f7fa1){var _0x49cf4e=function(_0x57bd71){while(--_0x57bd71){_0x5b1362['push'](_0x5b1362['shift']());}};_0x49cf4e(++_0x4f7fa1);}(_0x7780,0x117));var _0x0778=function(_0x34756e,_0x3c036a){_0x34756e=_0x34756e-0x0;var _0x365e63=_0x7780[_0x34756e];return _0x365e63;};'use strict';var _=require(_0x0778('0x0'));var util=require(_0x0778('0x1'));var logger=require(_0x0778('0x2'))(_0x0778('0x3'));var moment=require(_0x0778('0x4'));var BPromise=require('bluebird');var rp=require(_0x0778('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0778('0x6'));var config=require('../../config/environment');var attributes=require(_0x0778('0x7'));module['exports']=function(_0x1ef992,_0x4010d6){return _0x1ef992[_0x0778('0x8')]('FaxApplication',attributes,{'tableName':_0x0778('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0778('0xa'),'collate':_0x0778('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e7a3733..eb53576 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 _0x9fce=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','options','raw','where','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2fca5a,_0x1f0491){var _0x6cf97b=function(_0x411430){while(--_0x411430){_0x2fca5a['push'](_0x2fca5a['shift']());}};_0x6cf97b(++_0x1f0491);}(_0x9fce,0x99));var _0xe9fc=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0x9fce[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0xe9fc('0x0'));var util=require(_0xe9fc('0x1'));var moment=require(_0xe9fc('0x2'));var BPromise=require(_0xe9fc('0x3'));var rs=require(_0xe9fc('0x4'));var fs=require('fs');var Redis=require(_0xe9fc('0x5'));var db=require(_0xe9fc('0x6'))['db'];var utils=require(_0xe9fc('0x7'));var logger=require(_0xe9fc('0x8'))(_0xe9fc('0x9'));var config=require(_0xe9fc('0xa'));var jayson=require(_0xe9fc('0xb'));var client=jayson[_0xe9fc('0xc')][_0xe9fc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a4d6b,_0x41c616,_0x35aa38){return new BPromise(function(_0x37be81,_0x58d864){return client[_0xe9fc('0xe')](_0x5a4d6b,_0x35aa38)[_0xe9fc('0xf')](function(_0x252fd1){logger[_0xe9fc('0x10')](_0xe9fc('0x11'),_0x41c616,_0xe9fc('0x12'));logger[_0xe9fc('0x13')](_0xe9fc('0x14'),_0x41c616,_0xe9fc('0x12'),JSON[_0xe9fc('0x15')](_0x252fd1));if(_0x252fd1['error']){if(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x17')]===0x1f4){logger[_0xe9fc('0x16')](_0xe9fc('0x11'),_0x41c616,_0x252fd1['error'][_0xe9fc('0x18')]);return _0x58d864(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x18')]);}logger[_0xe9fc('0x16')](_0xe9fc('0x11'),_0x41c616,_0x252fd1[_0xe9fc('0x16')]['message']);return _0x37be81(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x18')]);}else{logger[_0xe9fc('0x10')]('FaxApplication,\x20%s,\x20%s',_0x41c616,'request\x20sent');_0x37be81(_0x252fd1[_0xe9fc('0x19')]['message']);}})[_0xe9fc('0x1a')](function(_0x1cbcae){logger[_0xe9fc('0x16')]('FaxApplication,\x20%s,\x20%s',_0x41c616,_0x1cbcae);_0x58d864(_0x1cbcae);});});}exports['UpdateFaxApplication']=function(_0x1b11b7){var _0xcda88b=this;return new Promise(function(_0x37e789,_0x5bd0b1){return db[_0xe9fc('0x1b')][_0xe9fc('0x1c')](_0x1b11b7['body'],{'raw':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7[_0xe9fc('0x1d')][_0xe9fc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b11b7['options']?_0x1b11b7['options'][_0xe9fc('0x1f')]||null:null,'attributes':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7[_0xe9fc('0x1d')]['attributes']||null:null,'limit':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7['options'][_0xe9fc('0x20')]||null:null})[_0xe9fc('0xf')](function(_0x21e13e){logger[_0xe9fc('0x10')](_0xe9fc('0x21'),_0x1b11b7);logger['debug'](_0xe9fc('0x21'),_0x1b11b7,JSON['stringify'](_0x21e13e));_0x37e789(_0x21e13e);})['catch'](function(_0x2675a3){logger[_0xe9fc('0x16')]('UpdateFaxApplication',_0x2675a3[_0xe9fc('0x18')],_0x1b11b7);_0x5bd0b1(_0xcda88b[_0xe9fc('0x16')](0x1f4,_0x2675a3[_0xe9fc('0x18')]));});});}; \ No newline at end of file +var _0xe4cb=['request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxApplication','update','options','raw','where','limit','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xe4cb,0x12f));var _0xbe4c=function(_0x56d653,_0x52b010){_0x56d653=_0x56d653-0x0;var _0x5bea9c=_0xe4cb[_0x56d653];return _0x5bea9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbe4c('0x0'));var BPromise=require('bluebird');var rs=require(_0xbe4c('0x1'));var fs=require('fs');var Redis=require(_0xbe4c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe4c('0x3'));var logger=require(_0xbe4c('0x4'))(_0xbe4c('0x5'));var config=require(_0xbe4c('0x6'));var jayson=require(_0xbe4c('0x7'));var client=jayson[_0xbe4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404027,_0x10a291,_0x3eb484){return new BPromise(function(_0x2b3a27,_0x3d8c3d){return client[_0xbe4c('0x9')](_0x404027,_0x3eb484)['then'](function(_0x10576f){logger[_0xbe4c('0xa')](_0xbe4c('0xb'),_0x10a291,_0xbe4c('0xc'));logger[_0xbe4c('0xd')](_0xbe4c('0xe'),_0x10a291,_0xbe4c('0xc'),JSON[_0xbe4c('0xf')](_0x10576f));if(_0x10576f[_0xbe4c('0x10')]){if(_0x10576f[_0xbe4c('0x10')]['code']===0x1f4){logger['error'](_0xbe4c('0xb'),_0x10a291,_0x10576f[_0xbe4c('0x10')][_0xbe4c('0x11')]);return _0x3d8c3d(_0x10576f[_0xbe4c('0x10')][_0xbe4c('0x11')]);}logger[_0xbe4c('0x10')](_0xbe4c('0xb'),_0x10a291,_0x10576f[_0xbe4c('0x10')][_0xbe4c('0x11')]);return _0x2b3a27(_0x10576f[_0xbe4c('0x10')]['message']);}else{logger[_0xbe4c('0xa')](_0xbe4c('0xb'),_0x10a291,'request\x20sent');_0x2b3a27(_0x10576f[_0xbe4c('0x12')][_0xbe4c('0x11')]);}})['catch'](function(_0x23a1d7){logger[_0xbe4c('0x10')](_0xbe4c('0xb'),_0x10a291,_0x23a1d7);_0x3d8c3d(_0x23a1d7);});});}exports[_0xbe4c('0x13')]=function(_0x1c4753){var _0x18fe39=this;return new Promise(function(_0x1d4f2d,_0xf92b98){return db['FaxApplication'][_0xbe4c('0x14')](_0x1c4753['body'],{'raw':_0x1c4753['options']?_0x1c4753[_0xbe4c('0x15')][_0xbe4c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c4753[_0xbe4c('0x15')]?_0x1c4753['options'][_0xbe4c('0x17')]||null:null,'attributes':_0x1c4753['options']?_0x1c4753[_0xbe4c('0x15')]['attributes']||null:null,'limit':_0x1c4753[_0xbe4c('0x15')]?_0x1c4753['options'][_0xbe4c('0x18')]||null:null})['then'](function(_0x18e750){logger[_0xbe4c('0xa')](_0xbe4c('0x13'),_0x1c4753);logger[_0xbe4c('0xd')](_0xbe4c('0x13'),_0x1c4753,JSON['stringify'](_0x18e750));_0x1d4f2d(_0x18e750);})[_0xbe4c('0x19')](function(_0x28a7ff){logger[_0xbe4c('0x10')](_0xbe4c('0x13'),_0x28a7ff[_0xbe4c('0x11')],_0x1c4753);_0xf92b98(_0x18fe39[_0xbe4c('0x10')](0x1f4,_0x28a7ff[_0xbe4c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index aff81ba..0713f86 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 _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5c3588,_0x5150a9){var _0x4d6f46=function(_0x3e9757){while(--_0x3e9757){_0x5c3588['push'](_0x5c3588['shift']());}};_0x4d6f46(++_0x5150a9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5400b8,_0x3cb4cb){_0x5400b8=_0x5400b8-0x0;var _0x208f0b=_0xb03e[_0x5400b8];return _0x208f0b;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0xe5b5=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3410eb,_0x4613b8){var _0xe5ec6d=function(_0x49f8df){while(--_0x49f8df){_0x3410eb['push'](_0x3410eb['shift']());}};_0xe5ec6d(++_0x4613b8);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xe5b5[_0xa388a2];return _0x7ce7f6;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0x10')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0x12')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x13')]);router['delete'](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x14')]);module[_0x5e5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4ee87d4..e34ffc4 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 _0xdc98=['STRING','ENUM','exports','BOOLEAN','DATE'];(function(_0x519cd6,_0x1f07b4){var _0x26640b=function(_0x59c8c2){while(--_0x59c8c2){_0x519cd6['push'](_0x519cd6['shift']());}};_0x26640b(++_0x1f07b4);}(_0xdc98,0x14c));var _0x8dc9=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xdc98[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module[_0x8dc9('0x0')]={'closed':{'type':Sequelize[_0x8dc9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8dc9('0x2')]},'disposition':{'type':Sequelize[_0x8dc9('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8dc9('0x3')]},'note':{'type':Sequelize[_0x8dc9('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x8dc9('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8dc9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xad04=['ENUM','sequelize','exports','DATE','STRING'];(function(_0x829616,_0x5d9318){var _0x35857a=function(_0x502cb9){while(--_0x502cb9){_0x829616['push'](_0x829616['shift']());}};_0x35857a(++_0x5d9318);}(_0xad04,0x92));var _0x4ad0=function(_0x3aced2,_0x33fd66){_0x3aced2=_0x3aced2-0x0;var _0x2e9bce=_0xad04[_0x3aced2];return _0x2e9bce;};'use strict';var Sequelize=require(_0x4ad0('0x0'));module[_0x4ad0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4ad0('0x2')]},'disposition':{'type':Sequelize[_0x4ad0('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4ad0('0x3')]},'note':{'type':Sequelize[_0x4ad0('0x3')]},'read1stAt':{'type':Sequelize[_0x4ad0('0x2')]},'fax':{'type':Sequelize[_0x4ad0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4ad0('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4ad0('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 1b28155..b35c69e 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 _0x15ee=['Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','length','find','unreadMessages','value','having','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','intersection','includeAll','merge','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','sendStatus','error','stack','name','send'];(function(_0x28cd23,_0x2a69eb){var _0x5e220b=function(_0x2395db){while(--_0x2395db){_0x28cd23['push'](_0x28cd23['shift']());}};_0x5e220b(++_0x2a69eb);}(_0x15ee,0xac));var _0xe15e=function(_0x4d8744,_0x203345){_0x4d8744=_0x4d8744-0x0;var _0x17fb37=_0x15ee[_0x4d8744];return _0x17fb37;};'use strict';var emlformat=require(_0xe15e('0x0'));var rimraf=require(_0xe15e('0x1'));var zipdir=require(_0xe15e('0x2'));var jsonpatch=require(_0xe15e('0x3'));var rp=require(_0xe15e('0x4'));var moment=require(_0xe15e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe15e('0x6'));var path=require(_0xe15e('0x7'));var sox=require(_0xe15e('0x8'));var csv=require(_0xe15e('0x9'));var ejs=require(_0xe15e('0xa'));var fs=require('fs');var fs_extra=require(_0xe15e('0xb'));var _=require(_0xe15e('0xc'));var squel=require(_0xe15e('0xd'));var crypto=require(_0xe15e('0xe'));var jsforce=require(_0xe15e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe15e('0x9'));var querystring=require(_0xe15e('0x10'));var Papa=require(_0xe15e('0x11'));var Redis=require(_0xe15e('0x12'));var authService=require(_0xe15e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe15e('0x14'));var logger=require(_0xe15e('0x15'))(_0xe15e('0x16'));var utils=require(_0xe15e('0x17'));var config=require(_0xe15e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe15e('0x19'))['db'];config[_0xe15e('0x1a')]=_['defaults'](config[_0xe15e('0x1a')],{'host':_0xe15e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xe15e('0x1c')](socket);function respondWithStatusCode(_0x443321,_0x11acd8){_0x11acd8=_0x11acd8||0xcc;return function(_0x5ccd1a){if(_0x5ccd1a){return _0x443321['sendStatus'](_0x11acd8);}return _0x443321['status'](_0x11acd8)[_0xe15e('0x1d')]();};}function respondWithResult(_0x270449,_0x50e011){_0x50e011=_0x50e011||0xc8;return function(_0x2a1a2e){if(_0x2a1a2e){return _0x270449[_0xe15e('0x1e')](_0x50e011)['json'](_0x2a1a2e);}};}function respondWithFilteredResult(_0x15284c,_0x418032){return function(_0x205600){if(_0x205600){var _0x5e62d4=typeof _0x418032[_0xe15e('0x1f')]===_0xe15e('0x20')&&typeof _0x418032[_0xe15e('0x21')]===_0xe15e('0x20');var _0x3bb32c=_0x205600['count'];var _0x3f849d=_0x5e62d4?0x0:_0x418032[_0xe15e('0x1f')];var _0x5f5300=_0x5e62d4?_0x205600[_0xe15e('0x22')]:_0x418032['offset']+_0x418032['limit'];var _0x2d0c44;if(_0x5f5300>=_0x3bb32c){_0x5f5300=_0x3bb32c;_0x2d0c44=0xc8;}else{_0x2d0c44=0xce;}_0x15284c[_0xe15e('0x1e')](_0x2d0c44);return _0x15284c[_0xe15e('0x23')](_0xe15e('0x24'),_0x3f849d+'-'+_0x5f5300+'/'+_0x3bb32c)[_0xe15e('0x25')](_0x205600);}return null;};}function patchUpdates(_0x32721b){return function(_0x45f154){try{jsonpatch['apply'](_0x45f154,_0x32721b,!![]);}catch(_0x46a46b){return BPromise['reject'](_0x46a46b);}return _0x45f154[_0xe15e('0x26')]();};}function saveUpdates(_0x4f3c45,_0x7d27e6){return function(_0x1718c3){if(_0x1718c3){return _0x1718c3[_0xe15e('0x27')](_0x4f3c45)['then'](function(_0x5c94a4){return _0x5c94a4;});}return null;};}function removeEntity(_0x5b13ad,_0x4fdaf3){return function(_0x340df4){if(_0x340df4){return _0x340df4[_0xe15e('0x28')]()[_0xe15e('0x29')](function(){_0x5b13ad[_0xe15e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1226c5,_0xa1e55){return function(_0x5f55ec){if(!_0x5f55ec){_0x1226c5[_0xe15e('0x2a')](0x194);}return _0x5f55ec;};}function handleError(_0x41162,_0x216e84){_0x216e84=_0x216e84||0x1f4;return function(_0x156967){logger[_0xe15e('0x2b')](_0x156967[_0xe15e('0x2c')]);if(_0x156967[_0xe15e('0x2d')]){delete _0x156967[_0xe15e('0x2d')];}_0x41162[_0xe15e('0x1e')](_0x216e84)[_0xe15e('0x2e')](_0x156967);};}function getInteractionUsers(_0x38ae9d,_0x30a30b){return new BPromise(function(_0x3e1532,_0x67d362){try{if(_0x30a30b[_0x38ae9d['id']]){_0x38ae9d[_0xe15e('0x2f')]=_[_0xe15e('0x30')](_0x30a30b[_0x38ae9d['id']],function(_0xcd1e6){return{'id':_0xcd1e6['id'],'fullname':_0xcd1e6[_0xe15e('0x31')]};});}}catch(_0x2d6d44){_0x67d362(_0x2d6d44);}_0x3e1532(_0x38ae9d);});}function getInteractionTags(_0x46f0c7,_0x31d83d){return new BPromise(function(_0x3cf78a,_0x10ab5b){try{if(_0x46f0c7[_0xe15e('0x32')]){_0x46f0c7[_0xe15e('0x33')]=[];_0x46f0c7[_0xe15e('0x32')][_0xe15e('0x34')](',')[_0xe15e('0x35')](function(_0x1be241){_0x46f0c7['Tags'][_0xe15e('0x36')](_0x31d83d[_0x1be241]);});}delete _0x46f0c7[_0xe15e('0x32')];}catch(_0x54c4d6){_0x10ab5b(_0x54c4d6);}_0x3cf78a(_0x46f0c7);});}function updateFaxInteraction(_0xbed1ad,_0x256617,_0x40fa10){return new BPromise(function(_0x1721c4,_0xfff109){return getInteractionUsers(_0xbed1ad,_0x40fa10)[_0xe15e('0x29')](function(_0x43100a){return getInteractionTags(_0x43100a,_0x256617);})['then'](function(_0x3f2ed2){return getStateInteraction(_0x3f2ed2);})[_0xe15e('0x29')](function(_0x309b5c){_0x1721c4(_0x309b5c);})[_0xe15e('0x37')](function(_0x2e9eaf){_0xfff109(_0x2e9eaf);});});}function getStateInteraction(_0x49909c){return new BPromise(function(_0xbc1903){_0x49909c[_0xe15e('0x38')]=0x0;_0x49909c[_0xe15e('0x39')]=0x0;_0x49909c[_0xe15e('0x3a')]=0x0;_0x49909c[_0xe15e('0x3b')]=0x0;_0x49909c[_0xe15e('0x3c')]=0x0;if(!_0x49909c[_0xe15e('0x3d')]&&!_0x49909c[_0xe15e('0x3e')]){_0x49909c['waiting']+=0x1;}if(!_0x49909c[_0xe15e('0x3d')]&&_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x39')]+=0x1;if(_0x49909c[_0xe15e('0x38')]){_0x49909c['waiting']-=0x1;}}if(_0x49909c[_0xe15e('0x3d')]&&_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x3a')]+=0x1;if(_0x49909c[_0xe15e('0x39')]){_0x49909c[_0xe15e('0x39')]-=0x1;}}if(_0x49909c['closed']&&!_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x3b')]+=0x1;if(_0x49909c['waiting']){_0x49909c[_0xe15e('0x38')]-=0x1;}}_0x49909c[_0xe15e('0x3c')]+=0x1;_0xbc1903(_0x49909c);});}exports['index']=function(_0x147482,_0x5d3009){var _0x494ac8={},_0x81d7db={},_0x4bad9c={'count':0x0,'rows':[]};var _0x571c67=_[_0xe15e('0x30')](db[_0xe15e('0x3f')][_0xe15e('0x40')],function(_0x625566){return{'name':_0x625566[_0xe15e('0x41')],'type':_0x625566[_0xe15e('0x42')][_0xe15e('0x43')]};});_0x81d7db[_0xe15e('0x44')]=_['map'](_0x571c67,'name');_0x81d7db[_0xe15e('0x45')]=_[_0xe15e('0x46')](_0x147482['query']);_0x81d7db[_0xe15e('0x47')]=_['intersection'](_0x81d7db[_0xe15e('0x44')],_0x81d7db['query']);_0x494ac8[_0xe15e('0x48')]=_['intersection'](_0x81d7db[_0xe15e('0x44')],qs[_0xe15e('0x49')](_0x147482[_0xe15e('0x45')][_0xe15e('0x49')]));_0x494ac8[_0xe15e('0x48')]=_0x494ac8[_0xe15e('0x48')]['length']?_0x494ac8['attributes']:_0x81d7db[_0xe15e('0x44')];if(!_0x147482[_0xe15e('0x45')]['hasOwnProperty'](_0xe15e('0x4a'))){_0x494ac8[_0xe15e('0x21')]=qs[_0xe15e('0x21')](_0x147482[_0xe15e('0x45')][_0xe15e('0x21')]);_0x494ac8['offset']=qs['offset'](_0x147482[_0xe15e('0x45')]['offset']);}_0x494ac8['order']=qs[_0xe15e('0x4b')](_0x147482[_0xe15e('0x45')][_0xe15e('0x4b')]);_0x494ac8['where']=qs[_0xe15e('0x47')](_[_0xe15e('0x4c')](_0x147482[_0xe15e('0x45')],_0x81d7db[_0xe15e('0x47')]),_0x571c67);var _0x3c368e=[];var _0x4af5f1=squel[_0xe15e('0x4d')]()[_0xe15e('0x4e')]('id')[_0xe15e('0x4e')](_0xe15e('0x2d'))[_0xe15e('0x4e')](_0xe15e('0x4f'))[_0xe15e('0x50')](_0xe15e('0x51'));var _0xc50a40=squel['select']()[_0xe15e('0x4e')](_0xe15e('0x52'))[_0xe15e('0x4e')]('u.fullname')['field'](_0xe15e('0x53'))[_0xe15e('0x50')](_0xe15e('0x54'),'ui')[_0xe15e('0x55')](_0xe15e('0x56'),'u',_0xe15e('0x57'));var _0x45300b=squel[_0xe15e('0x4d')]()[_0xe15e('0x50')](_0xe15e('0x58'),'i')[_0xe15e('0x55')](_0xe15e('0x59'),'c',_0xe15e('0x5a'))[_0xe15e('0x55')](_0xe15e('0x56'),'o','o.id\x20=\x20i.UserId')[_0xe15e('0x55')](_0xe15e('0x5b'),'a',_0xe15e('0x5c'))['left_join'](_0xe15e('0x5d'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xe15e('0x55')](_0xe15e('0x5e'),'it',_0xe15e('0x5f'))[_0xe15e('0x55')](_0xe15e('0x51'),'t','t.id\x20=\x20it.TagId');var _0x41efcf=squel[_0xe15e('0x60')]();var _0x218e58=[];var _0x849779=squel['expr']();var _0x43f428;if(_0x147482[_0xe15e('0x45')][_0xe15e('0x61')]){_0x43f428=as[_0xe15e('0x62')](_0x147482[_0xe15e('0x45')][_0xe15e('0x61')]);var _0x4fe9e2=_0x43f428['sqlOperator'];for(var _0x5b82ce=0x0;_0x5b82ce<_0x43f428['conditions'][_0xe15e('0x63')];_0x5b82ce++){var _0x54e7e0=_0x43f428['conditions'][_0x5b82ce];var _0x214020='i';var _0x5278b7=_[_0xe15e('0x64')](_0x571c67,[_0xe15e('0x2d'),_0x54e7e0[_0xe15e('0x4e')]]);if(!_0x5278b7){switch(_0x54e7e0['field']){case _0xe15e('0x65'):if(_0x54e7e0[_0xe15e('0x66')]==0x1){_0x45300b[_0xe15e('0x67')]('`'+_0x54e7e0['field']+'`\x20=\x200');}else{_0x45300b['having']('`'+_0x54e7e0[_0xe15e('0x4e')]+'`\x20>\x200');}break;case'Contact':if(_0x54e7e0[_0xe15e('0x68')]==='$substring'){if(_0x54e7e0[_0xe15e('0x66')][_0xe15e('0x34')]('\x20')[_0xe15e('0x63')]>0x1){_0x41efcf[_0x4fe9e2](_0xe15e('0x69'),qs[_0xe15e('0x6a')](_0x54e7e0[_0xe15e('0x66')]),null);}else{var _0x3bbae3='%'+_0x54e7e0[_0xe15e('0x66')]+'%';_0x41efcf[_0x4fe9e2](_0xe15e('0x6b'),_0x3bbae3,_0x3bbae3,_0x3bbae3);}}else{_0x5278b7=_['find'](_0x571c67,['name',_0xe15e('0x6c')]);_0x54e7e0['field']=_0xe15e('0x6c');_0x1fde38=as[_0xe15e('0x6d')](_0x214020,_0x5278b7[_0xe15e('0x42')],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38['value']['start'],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);}break;case _0xe15e('0x6f'):var _0x454457=_0x54e7e0['value'][_0xe15e('0x34')](',')['map'](function(_0x2123ff){return Number(_0x2123ff);});_0x454457[_0xe15e('0x35')](function(_0x49b51e){_0x849779['or'](_0xe15e('0x70'),'%,'+_0x49b51e+',%');});_0x218e58=_['union'](_0x218e58,_0x454457);break;case _0xe15e('0x71'):if(_0x54e7e0[_0xe15e('0x68')]==='$substring'){_0x41efcf[_0x4fe9e2](_0xe15e('0x72'),'%'+_0x54e7e0[_0xe15e('0x66')]+'%',null);}else{_0x5278b7=_[_0xe15e('0x64')](_0x571c67,[_0xe15e('0x2d'),_0xe15e('0x3e')]);_0x54e7e0[_0xe15e('0x4e')]='UserId';_0x1fde38=as[_0xe15e('0x6d')](_0x214020,_0x5278b7['type'],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')]['end']);}break;case'body':_0x1fde38=as[_0xe15e('0x6d')]('me',null,_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);break;}}else{var _0x1fde38=as['buildExpression'](_0x214020,_0x5278b7[_0xe15e('0x42')],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38['value'][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);}}}else{var _0x35701b=_(_0x147482[_0xe15e('0x45')])['keys']()[_0xe15e('0x30')](function(_0x1405b5){return _[_0xe15e('0x74')](_0x571c67,[_0xe15e('0x2d'),_0x1405b5])?_0x1405b5:undefined;})[_0xe15e('0x75')]()['value']();if(!_[_0xe15e('0x76')](_0x35701b)){_0x35701b[_0xe15e('0x35')](function(_0x16631a){if(_0x16631a===_0xe15e('0x77')){_0x45300b[_0xe15e('0x78')](_0xe15e('0x79'),[]['concat'](_0x147482[_0xe15e('0x45')][_0x16631a]));}else if(_0x16631a===_0xe15e('0x7a')){var _0x348f08=JSON[_0xe15e('0x7b')](_0x147482['query'][_0x16631a])[_0xe15e('0x7c')];var _0x453202=JSON['parse'](_0x147482[_0xe15e('0x45')][_0x16631a])['$lte'];_0x45300b[_0xe15e('0x78')](_0xe15e('0x7d'),_0x348f08,_0x453202);}else{if(_0x147482[_0xe15e('0x45')][_0x16631a]==='null'){_0x45300b[_0xe15e('0x78')]('i.'+_0x16631a+_0xe15e('0x7e'));}else{_0x45300b[_0xe15e('0x78')]('i.'+_0x16631a+_0xe15e('0x7f'),_0x147482[_0xe15e('0x45')][_0x16631a]);}}});}if(_0x147482[_0xe15e('0x45')]['read']){if(_0x147482[_0xe15e('0x45')][_0xe15e('0x80')]==0x1){_0x45300b[_0xe15e('0x67')](_0xe15e('0x81'));}else{_0x45300b[_0xe15e('0x67')](_0xe15e('0x82'));}}if(_0x147482[_0xe15e('0x45')][_0xe15e('0x83')]){_0x218e58=_[_0xe15e('0x84')](_0x147482[_0xe15e('0x45')][_0xe15e('0x83')])?_0x147482['query'][_0xe15e('0x83')]:new Array(_0x147482[_0xe15e('0x45')][_0xe15e('0x83')]);_0x218e58[_0xe15e('0x35')](function(_0x1606d6){_0x849779['or'](_0xe15e('0x70'),'%,'+_0x1606d6+',%');});}if(_0x147482[_0xe15e('0x45')][_0xe15e('0x85')]){var _0x3a6161=_0x147482[_0xe15e('0x45')][_0xe15e('0x85')][_0xe15e('0x86')]('\x5c','\x5c\x5c')[_0xe15e('0x86')](/'/g,'\x27\x27');if(qs[_0xe15e('0x87')](_0x3a6161)){_0x41efcf['or']('i.id\x20LIKE\x20?',_0x3a6161+'%')['or'](_0xe15e('0x88'),_0x3a6161+'%');}_0x41efcf['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a6161+'%');}}_0x45300b[_0xe15e('0x78')](_0x41efcf);_0x45300b[_0xe15e('0x89')]('i.id');var _0x401111={'type':db[_0xe15e('0x8a')][_0xe15e('0x8b')]['SELECT'],'raw':!![]};var _0x122d50=_0x45300b[_0xe15e('0x8c')]();_0x122d50[_0xe15e('0x4e')](_0xe15e('0x8d'));_0x122d50[_0xe15e('0x4e')](_0xe15e('0x8e'),_0xe15e('0x65'));if(_0x494ac8[_0xe15e('0x8f')]){_0x494ac8['order'][_0xe15e('0x35')](function(_0x1c5d90){var _0x57a990=_0x1c5d90[0x0]===_0xe15e('0x90')?_0x1c5d90[0x0]:'i.'+_0x1c5d90[0x0];_0x45300b[_0xe15e('0x8f')](_0x57a990,_0x1c5d90[0x1]===_0xe15e('0x91')?![]:!![]);});}if(!_[_0xe15e('0x76')](_0x218e58)){_0x45300b[_0xe15e('0x67')](_0x849779);_0x122d50[_0xe15e('0x78')](_0xe15e('0x92'),_0x218e58);}BPromise[_0xe15e('0x93')]()['then'](function(){if(!_0x43f428){if(_0x147482[_0xe15e('0x45')][_0xe15e('0x77')])return;_0x122d50[_0xe15e('0x78')](_0xe15e('0x94'));_0x45300b['where'](_0xe15e('0x94'));return;}if(_0x147482[_0xe15e('0x95')][_0xe15e('0x96')]!==_0xe15e('0x97'))return;return _0x147482[_0xe15e('0x95')][_0xe15e('0x98')]({'attributes':['id'],'raw':!![]})[_0xe15e('0x29')](function(_0x14e83a){if(_[_0xe15e('0x76')](_0x14e83a)){_0x122d50[_0xe15e('0x78')](_0xe15e('0x99'));_0x45300b[_0xe15e('0x78')](_0xe15e('0x99'));}else{_0x122d50[_0xe15e('0x78')]('i.FaxAccountId\x20IN\x20?',_[_0xe15e('0x30')](_0x14e83a,'id'));_0x45300b['where']('i.FaxAccountId\x20IN\x20?',_[_0xe15e('0x30')](_0x14e83a,'id'));}});})['then'](function(){if(_0x147482[_0xe15e('0x95')][_0xe15e('0x96')]===_0xe15e('0x97')&&!_0x43f428&&!_0x147482[_0xe15e('0x45')][_0xe15e('0x77')])return[];return db['sequelize'][_0xe15e('0x45')](_0x122d50[_0xe15e('0x9a')](),_0x401111);})[_0xe15e('0x29')](function(_0x2ec7ec){_0x4bad9c[_0xe15e('0x22')]=_0x2ec7ec['length'];if(_0x4bad9c[_0xe15e('0x22')]===0x0)return[];return db['sequelize'][_0xe15e('0x45')](_0x4af5f1[_0xe15e('0x9a')](),_0x401111)[_0xe15e('0x29')](function(_0x2cbd70){_0x3c368e=_[_0xe15e('0x9b')](_0x2cbd70,'id');_0x401111=_['merge'](_0x401111,{'model':db[_0xe15e('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x147482[_0xe15e('0x45')]['fields']){_0x494ac8[_0xe15e('0x48')][_0xe15e('0x35')](function(_0x251c89){_0x45300b[_0xe15e('0x4e')]('i.'+_0x251c89);});}else{_0x45300b['field'](_0xe15e('0x8e'),_0xe15e('0x65'));_0x45300b[_0xe15e('0x4e')]('a.key',_0xe15e('0x9c'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0x9d'),_0xe15e('0x9e'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0x9f'),_0xe15e('0x90'));_0x45300b['field'](_0xe15e('0xa0'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa1'),'Contact.firstName');_0x45300b['field'](_0xe15e('0xa2'),_0xe15e('0xa3'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa4'),_0xe15e('0xa5'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa6'),'Contact.phone');_0x45300b[_0xe15e('0x4e')]('c.mobile',_0xe15e('0xa7'));_0x45300b[_0xe15e('0x4e')]('c.fax','Contact.fax');_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa8'),'Owner.fullname');_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa9'),_0xe15e('0xaa'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xab'),'TagIds');}if(_0x494ac8['limit'])_0x45300b[_0xe15e('0x21')](_0x494ac8['limit']);if(_0x494ac8[_0xe15e('0x1f')])_0x45300b[_0xe15e('0x1f')](_0x494ac8[_0xe15e('0x1f')]);return db[_0xe15e('0xac')][_0xe15e('0x45')](_0x45300b['toString'](),_0x401111);})[_0xe15e('0x29')](function(_0x71a0ea){if(_0x71a0ea[_0xe15e('0x63')]>0x0)_0xc50a40[_0xe15e('0x78')](_0xe15e('0xad'),_['map'](_0x71a0ea,'id'));return db['sequelize'][_0xe15e('0x45')](_0xc50a40[_0xe15e('0x9a')](),_0x401111)[_0xe15e('0x29')](function(_0x51233e){var _0x1e7316=_[_0xe15e('0xae')](_0x51233e,_0xe15e('0xaf'));var _0x1505c9=[];_0x71a0ea[_0xe15e('0x35')](function(_0x3fcb52){_0x1505c9['push'](updateFaxInteraction(_0x3fcb52,_0x3c368e,_0x1e7316));});return BPromise[_0xe15e('0xb0')](_0x1505c9);});});})[_0xe15e('0x29')](function(_0x24aab8){_0x4bad9c[_0xe15e('0xb1')]=_0x24aab8;return _0x4bad9c;})[_0xe15e('0x29')](respondWithFilteredResult(_0x5d3009,_0x494ac8))[_0xe15e('0x37')](handleError(_0x5d3009,null));};exports[_0xe15e('0xb2')]=function(_0x504ece,_0x556b73){var _0x3e7ec1={'raw':![],'where':{'id':_0x504ece[_0xe15e('0xb3')]['id']}},_0x2e52ef={};_0x2e52ef[_0xe15e('0x44')]=_[_0xe15e('0x46')](db[_0xe15e('0x3f')][_0xe15e('0x40')]);_0x2e52ef['query']=_[_0xe15e('0x46')](_0x504ece['query']);_0x2e52ef['filters']=_[_0xe15e('0xb4')](_0x2e52ef[_0xe15e('0x44')],_0x2e52ef[_0xe15e('0x45')]);_0x3e7ec1[_0xe15e('0x48')]=_[_0xe15e('0xb4')](_0x2e52ef[_0xe15e('0x44')],qs['fields'](_0x504ece['query'][_0xe15e('0x49')]));_0x3e7ec1[_0xe15e('0x48')]=_0x3e7ec1[_0xe15e('0x48')][_0xe15e('0x63')]?_0x3e7ec1['attributes']:_0x2e52ef[_0xe15e('0x44')];if(_0x504ece[_0xe15e('0x45')][_0xe15e('0xb5')]){_0x3e7ec1['include']=[{'all':!![]}];}_0x3e7ec1=_[_0xe15e('0xb6')]({},_0x3e7ec1,_0x504ece['options']);return db['FaxInteraction'][_0xe15e('0x64')](_0x3e7ec1)[_0xe15e('0x29')](handleEntityNotFound(_0x556b73,null))[_0xe15e('0x29')](respondWithResult(_0x556b73,null))[_0xe15e('0x37')](handleError(_0x556b73,null));};exports[_0xe15e('0xb7')]=function(_0x48542f,_0x30e3f9){return db[_0xe15e('0x3f')]['create'](_0x48542f[_0xe15e('0xb8')],{})['then'](respondWithResult(_0x30e3f9,0xc9))[_0xe15e('0x37')](handleError(_0x30e3f9,null));};exports[_0xe15e('0x27')]=function(_0x297888,_0x296438){if(_0x297888[_0xe15e('0xb8')]['id']){delete _0x297888[_0xe15e('0xb8')]['id'];}return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x297888[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x296438,null))[_0xe15e('0x29')](saveUpdates(_0x297888[_0xe15e('0xb8')],null))[_0xe15e('0x29')](respondWithResult(_0x296438,null))['catch'](handleError(_0x296438,null));};exports[_0xe15e('0x28')]=function(_0x196058,_0x3ef896){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x196058[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x3ef896,null))[_0xe15e('0x29')](removeEntity(_0x3ef896,null))[_0xe15e('0x37')](handleError(_0x3ef896,null));};exports[_0xe15e('0xb9')]=function(_0x3029dc,_0x528e0e){return db[_0xe15e('0x3f')][_0xe15e('0xb9')]()['then'](respondWithResult(_0x528e0e,null))['catch'](handleError(_0x528e0e,null));};exports[_0xe15e('0xba')]=function(_0x1f3b40,_0x126b92,_0x4e32e7){return db[_0xe15e('0xbb')][_0xe15e('0x64')]({'where':{'id':_0x1f3b40['params']['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x126b92,null))['then'](function(_0x3962f5){if(_0x3962f5){return _0x3962f5[_0xe15e('0xba')](_0x1f3b40['body']['ids'],_[_0xe15e('0xbc')](_0x1f3b40[_0xe15e('0xb8')],[_0xe15e('0xbd'),'id'])||{});}})[_0xe15e('0x29')](respondWithResult(_0x126b92,null))['catch'](handleError(_0x126b92,null));};exports[_0xe15e('0xbe')]=function(_0x47b9c9,_0x570cc7,_0x2020cc){var _0x9448f3={'raw':![],'where':{}};var _0x3f09c0={};var _0x24fbfc={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x47b9c9[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x570cc7,null))[_0xe15e('0x29')](function(_0x295ceb){if(_0x295ceb){_0x3f09c0['model']=_[_0xe15e('0x46')](db[_0xe15e('0xbb')][_0xe15e('0x40')]);_0x3f09c0[_0xe15e('0x45')]=_[_0xe15e('0x46')](_0x47b9c9[_0xe15e('0x45')]);_0x3f09c0[_0xe15e('0x47')]=_['intersection'](_0x3f09c0[_0xe15e('0x44')],_0x3f09c0[_0xe15e('0x45')]);_0x9448f3[_0xe15e('0x48')]=_[_0xe15e('0xb4')](_0x3f09c0[_0xe15e('0x44')],qs['fields'](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x49')]));_0x9448f3['attributes']=_0x9448f3[_0xe15e('0x48')][_0xe15e('0x63')]?_0x9448f3[_0xe15e('0x48')]:_0x3f09c0[_0xe15e('0x44')];if(!_0x47b9c9['query'][_0xe15e('0xbf')](_0xe15e('0x4a'))){_0x9448f3[_0xe15e('0x21')]=qs['limit'](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x21')]);_0x9448f3[_0xe15e('0x1f')]=qs[_0xe15e('0x1f')](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x1f')]);}_0x9448f3[_0xe15e('0x8f')]=qs[_0xe15e('0x4b')](_0x47b9c9['query'][_0xe15e('0x4b')]);_0x9448f3[_0xe15e('0x78')]=qs['filters'](_[_0xe15e('0x4c')](_0x47b9c9[_0xe15e('0x45')],_0x3f09c0[_0xe15e('0x47')]));_0x9448f3[_0xe15e('0x78')][_0xe15e('0xaf')]=_0x295ceb['id'];if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x85')]){_0x9448f3[_0xe15e('0x78')]=_['merge'](_0x9448f3[_0xe15e('0x78')],{'$or':_[_0xe15e('0x30')](_0x9448f3[_0xe15e('0x48')],function(_0x54ad96){var _0x166fc0={};_0x166fc0[_0x54ad96]={'$like':'%'+_0x47b9c9['query'][_0xe15e('0x85')]+'%'};return _0x166fc0;})});}if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x7c')]){var _0x10941f=_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x7c')][_0xe15e('0x34')](',');var _0x3f0dde={};_0x3f0dde[_0x10941f[0x0]]={'$gte':moment(_0x10941f[0x1])[_0xe15e('0xc0')](_0xe15e('0xc1'))};_0x9448f3[_0xe15e('0x78')]=_[_0xe15e('0xb6')](_0x9448f3[_0xe15e('0x78')],_0x3f0dde);}_0x9448f3=_['merge']({},_0x9448f3,_0x47b9c9['options']);return db[_0xe15e('0xbb')][_0xe15e('0x22')]({'where':_0x9448f3[_0xe15e('0x78')]})[_0xe15e('0x29')](function(_0x460358){_0x24fbfc[_0xe15e('0x22')]=_0x460358;if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0xb5')]){_0x9448f3[_0xe15e('0xc2')]=[{'all':!![]}];}return db[_0xe15e('0xbb')][_0xe15e('0xc3')](_0x9448f3);})[_0xe15e('0x29')](function(_0x2200dd){_0x24fbfc['rows']=_0x2200dd;return _0x24fbfc;});}})['then'](respondWithFilteredResult(_0x570cc7,_0x9448f3))['catch'](handleError(_0x570cc7,null));};exports['addTags']=function(_0x1fca8b,_0x265ff7,_0x392f77){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x1fca8b[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x265ff7,null))['then'](function(_0x1e1cac){if(_0x1e1cac){return _0x1e1cac[_0xe15e('0xc4')](_0x1fca8b[_0xe15e('0xb8')][_0xe15e('0xbd')],_[_0xe15e('0xbc')](_0x1fca8b[_0xe15e('0xb8')],[_0xe15e('0xbd'),'id'])||{})[_0xe15e('0xc5')](function(){return db[_0xe15e('0x6f')][_0xe15e('0xc3')]({'attributes':['id','name',_0xe15e('0x4f')],'where':{'id':_0x1fca8b[_0xe15e('0xb8')]['ids']}});})[_0xe15e('0x29')](function(_0x540ebb){socket[_0xe15e('0xc6')](_0xe15e('0xc7'),{'id':Number(_0x1fca8b[_0xe15e('0xb3')]['id']),'tags':_0x540ebb||[]});return{'id':Number(_0x1fca8b['params']['id']),'tags':_0x540ebb||[]};});}})[_0xe15e('0x29')](respondWithResult(_0x265ff7,null))[_0xe15e('0x37')](handleError(_0x265ff7,null));};exports[_0xe15e('0xc8')]=function(_0x168fc6,_0x7bfc6f,_0x179daa){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x168fc6[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x7bfc6f,null))[_0xe15e('0x29')](function(_0x153ad8){if(_0x153ad8){return _0x153ad8[_0xe15e('0xc8')](_0x168fc6[_0xe15e('0x45')][_0xe15e('0xbd')]);}})[_0xe15e('0x29')](respondWithStatusCode(_0x7bfc6f,null))[_0xe15e('0x37')](handleError(_0x7bfc6f,null));};exports[_0xe15e('0xc9')]=function(_0x553d72,_0x511445){var _0x5eb75f=moment()[_0xe15e('0xca')]()[_0xe15e('0x9a')]();var _0x37973d=path['join'](config[_0xe15e('0xcb')],_0xe15e('0xcc'),_0xe15e('0xcd'),_0xe15e('0xce'));var _0x7209d3=path[_0xe15e('0xcf')](config['root'],_0xe15e('0xcc'),_0xe15e('0xcd'),_0xe15e('0xd0'));var _0x2e2976=path[_0xe15e('0xcf')](_0x37973d,_0x5eb75f);var _0xda3a1a=util[_0xe15e('0xc0')](_0xe15e('0xd1'),_0x553d72[_0xe15e('0xb3')]['id'],_0x5eb75f);var _0x43353b=path[_0xe15e('0xcf')](_0x37973d,_0xda3a1a);var _0x1fb335=[];_0x1fb335[_0xe15e('0x36')]({'model':db[_0xe15e('0xd2')],'as':_0xe15e('0xd2'),'raw':!![]});var _0x4bc73f=[{'model':db[_0xe15e('0xbb')],'as':_0xe15e('0xd3'),'attributes':['id',_0xe15e('0xb8'),_0xe15e('0x7a')],'include':_0x1fb335}];return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x553d72[_0xe15e('0xb3')]['id']},'include':_0x4bc73f})[_0xe15e('0x29')](handleEntityNotFound(_0x511445,null))[_0xe15e('0x29')](function(_0x2722de){if(_0x2722de&&_0x2722de[_0xe15e('0xd3')]){var _0x22508f=_0x2722de[_0xe15e('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x2e2976);for(var _0x5c49f1=0x0;_0x5c49f1<_0x22508f[_0xe15e('0xd3')][_0xe15e('0x63')];_0x5c49f1++){var _0x26c82d=_0x22508f['Messages'][_0x5c49f1][_0xe15e('0xd2')];if(_0x26c82d){var _0x1f0e19=path[_0xe15e('0xcf')](_0x7209d3,_0x26c82d[_0xe15e('0xd5')]);if(fs[_0xe15e('0xd6')](_0x1f0e19)){fs['createReadStream'](_0x1f0e19)[_0xe15e('0xd7')](fs[_0xe15e('0xd8')](path[_0xe15e('0xcf')](_0x2e2976,_0x26c82d[_0xe15e('0xd5')])));}}}return BPromise[_0xe15e('0x93')]()[_0xe15e('0x29')](function(){return new BPromise(function(_0xe3fb2c,_0x3ddf41){zipdir(_0x2e2976,{'saveTo':_0x43353b},function(_0x972247,_0x181a70){if(_0x972247)return _0x3ddf41(_0x972247);return _0xe3fb2c(_0x181a70);});})[_0xe15e('0x29')](function(){return new BPromise(function(_0x88c4c8,_0x4cf912){rimraf(_0x2e2976,function(_0x239700){if(_0x239700)_0x4cf912(_0x239700);return _0x88c4c8();});});})[_0xe15e('0x29')](function(){return _0x511445[_0xe15e('0xc9')](_0x43353b,_0xda3a1a,function(_0x5dbddb){if(_0x5dbddb){console[_0xe15e('0xd9')](_0xe15e('0xda'),_0x5dbddb);}else{fs['unlinkSync'](_0x43353b);}});});});}else{return _0x511445[_0xe15e('0x2a')](0xc8);}})[_0xe15e('0x37')](handleError(_0x511445,null));}; \ No newline at end of file +var _0x02b8=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','undefined','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','total','closed','UserId','unmanaged','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','text','start','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','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','agent','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','all','rows','show','params','fields','includeAll','options','create','catch','describe','FaxMessage','addMessage','ids','omit','findOne','pick','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','emit','removeTags','download','join','root','tmp','files','transcript-%d-%s.zip','Attachment','get','basename','existsSync','createWriteStream','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv'];(function(_0x3fe8c2,_0x26abad){var _0x3256ce=function(_0x445985){while(--_0x445985){_0x3fe8c2['push'](_0x3fe8c2['shift']());}};_0x3256ce(++_0x26abad);}(_0x02b8,0x1a5));var _0x802b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x02b8[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x802b('0x0'));var rimraf=require(_0x802b('0x1'));var zipdir=require(_0x802b('0x2'));var jsonpatch=require(_0x802b('0x3'));var rp=require(_0x802b('0x4'));var moment=require(_0x802b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x802b('0x6'));var util=require('util');var path=require(_0x802b('0x7'));var sox=require('sox');var csv=require(_0x802b('0x8'));var ejs=require(_0x802b('0x9'));var fs=require('fs');var fs_extra=require(_0x802b('0xa'));var _=require(_0x802b('0xb'));var squel=require(_0x802b('0xc'));var crypto=require('crypto');var jsforce=require(_0x802b('0xd'));var deskjs=require(_0x802b('0xe'));var toCsv=require(_0x802b('0x8'));var querystring=require(_0x802b('0xf'));var Papa=require(_0x802b('0x10'));var Redis=require(_0x802b('0x11'));var authService=require(_0x802b('0x12'));var qs=require(_0x802b('0x13'));var as=require(_0x802b('0x14'));var hardwareService=require(_0x802b('0x15'));var logger=require(_0x802b('0x16'))('api');var utils=require(_0x802b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x802b('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x802b('0x19')](config[_0x802b('0x1a')],{'host':_0x802b('0x1b'),'port':0x18eb});var socket=require(_0x802b('0x1c'))(new Redis(config[_0x802b('0x1a')]));require(_0x802b('0x1d'))[_0x802b('0x1e')](socket);function respondWithStatusCode(_0x200771,_0x49a18d){_0x49a18d=_0x49a18d||0xcc;return function(_0xf939b5){if(_0xf939b5){return _0x200771['sendStatus'](_0x49a18d);}return _0x200771[_0x802b('0x1f')](_0x49a18d)[_0x802b('0x20')]();};}function respondWithResult(_0x22c11c,_0x15544c){_0x15544c=_0x15544c||0xc8;return function(_0x25ee2a){if(_0x25ee2a){return _0x22c11c[_0x802b('0x1f')](_0x15544c)[_0x802b('0x21')](_0x25ee2a);}};}function respondWithFilteredResult(_0x577a99,_0x21987c){return function(_0xea2322){if(_0xea2322){var _0x277f74=typeof _0x21987c['offset']==='undefined'&&typeof _0x21987c['limit']===_0x802b('0x22');var _0x256c2b=_0xea2322['count'];var _0xe9e61a=_0x277f74?0x0:_0x21987c['offset'];var _0x5cd6d6=_0x277f74?_0xea2322['count']:_0x21987c[_0x802b('0x23')]+_0x21987c[_0x802b('0x24')];var _0x39d82f;if(_0x5cd6d6>=_0x256c2b){_0x5cd6d6=_0x256c2b;_0x39d82f=0xc8;}else{_0x39d82f=0xce;}_0x577a99['status'](_0x39d82f);return _0x577a99['set'](_0x802b('0x25'),_0xe9e61a+'-'+_0x5cd6d6+'/'+_0x256c2b)[_0x802b('0x21')](_0xea2322);}return null;};}function patchUpdates(_0x2bb3dd){return function(_0x482408){try{jsonpatch[_0x802b('0x26')](_0x482408,_0x2bb3dd,!![]);}catch(_0x22b41f){return BPromise[_0x802b('0x27')](_0x22b41f);}return _0x482408['save']();};}function saveUpdates(_0x4c74f8,_0x2aceaf){return function(_0x59769d){if(_0x59769d){return _0x59769d[_0x802b('0x28')](_0x4c74f8)[_0x802b('0x29')](function(_0x1300e8){return _0x1300e8;});}return null;};}function removeEntity(_0x5c72ee,_0x55e40e){return function(_0x515cd5){if(_0x515cd5){return _0x515cd5[_0x802b('0x2a')]()['then'](function(){_0x5c72ee[_0x802b('0x1f')](0xcc)[_0x802b('0x20')]();});}};}function handleEntityNotFound(_0x3bd0f0,_0x46c608){return function(_0x4ff396){if(!_0x4ff396){_0x3bd0f0[_0x802b('0x2b')](0x194);}return _0x4ff396;};}function handleError(_0x33fd74,_0x2678f9){_0x2678f9=_0x2678f9||0x1f4;return function(_0x66a6c){logger[_0x802b('0x2c')](_0x66a6c['stack']);if(_0x66a6c[_0x802b('0x2d')]){delete _0x66a6c[_0x802b('0x2d')];}_0x33fd74[_0x802b('0x1f')](_0x2678f9)[_0x802b('0x2e')](_0x66a6c);};}function getInteractionUsers(_0x24bdba,_0x34d05b){return new BPromise(function(_0x14548b,_0x4f040c){try{if(_0x34d05b[_0x24bdba['id']]){_0x24bdba['Users']=_[_0x802b('0x2f')](_0x34d05b[_0x24bdba['id']],function(_0x2cdce7){return{'id':_0x2cdce7['id'],'fullname':_0x2cdce7[_0x802b('0x30')]};});}}catch(_0x2d8db4){_0x4f040c(_0x2d8db4);}_0x14548b(_0x24bdba);});}function getInteractionTags(_0x15eeac,_0xae8457){return new BPromise(function(_0x42d7c9,_0x10f43f){try{if(_0x15eeac[_0x802b('0x31')]){_0x15eeac[_0x802b('0x32')]=[];_0x15eeac[_0x802b('0x31')][_0x802b('0x33')](',')[_0x802b('0x34')](function(_0x4e5287){_0x15eeac[_0x802b('0x32')][_0x802b('0x35')](_0xae8457[_0x4e5287]);});}delete _0x15eeac[_0x802b('0x31')];}catch(_0x1ffcdd){_0x10f43f(_0x1ffcdd);}_0x42d7c9(_0x15eeac);});}function updateFaxInteraction(_0x3d5ef5,_0x116030,_0x7cc837){return new BPromise(function(_0xf2f2f2,_0x2fda9a){return getInteractionUsers(_0x3d5ef5,_0x7cc837)[_0x802b('0x29')](function(_0x46de7d){return getInteractionTags(_0x46de7d,_0x116030);})[_0x802b('0x29')](function(_0x18861b){return getStateInteraction(_0x18861b);})[_0x802b('0x29')](function(_0x3469d3){_0xf2f2f2(_0x3469d3);})['catch'](function(_0x26d109){_0x2fda9a(_0x26d109);});});}function getStateInteraction(_0x16863d){return new BPromise(function(_0x3d8c20){_0x16863d[_0x802b('0x36')]=0x0;_0x16863d[_0x802b('0x37')]=0x0;_0x16863d[_0x802b('0x38')]=0x0;_0x16863d['unmanaged']=0x0;_0x16863d[_0x802b('0x39')]=0x0;if(!_0x16863d[_0x802b('0x3a')]&&!_0x16863d[_0x802b('0x3b')]){_0x16863d['waiting']+=0x1;}if(!_0x16863d[_0x802b('0x3a')]&&_0x16863d[_0x802b('0x3b')]){_0x16863d['talking']+=0x1;if(_0x16863d[_0x802b('0x36')]){_0x16863d[_0x802b('0x36')]-=0x1;}}if(_0x16863d[_0x802b('0x3a')]&&_0x16863d['UserId']){_0x16863d[_0x802b('0x38')]+=0x1;if(_0x16863d[_0x802b('0x37')]){_0x16863d[_0x802b('0x37')]-=0x1;}}if(_0x16863d[_0x802b('0x3a')]&&!_0x16863d[_0x802b('0x3b')]){_0x16863d[_0x802b('0x3c')]+=0x1;if(_0x16863d[_0x802b('0x36')]){_0x16863d[_0x802b('0x36')]-=0x1;}}_0x16863d[_0x802b('0x39')]+=0x1;_0x3d8c20(_0x16863d);});}exports['index']=function(_0x25114c,_0x4c43a8){var _0x53f5fb={},_0x217911={},_0x164eda={'count':0x0,'rows':[]};var _0x29c174=_['map'](db[_0x802b('0x3d')][_0x802b('0x3e')],function(_0x151cd3){return{'name':_0x151cd3[_0x802b('0x3f')],'type':_0x151cd3[_0x802b('0x40')][_0x802b('0x41')]};});_0x217911['model']=_['map'](_0x29c174,'name');_0x217911[_0x802b('0x42')]=_[_0x802b('0x43')](_0x25114c[_0x802b('0x42')]);_0x217911[_0x802b('0x44')]=_[_0x802b('0x45')](_0x217911['model'],_0x217911['query']);_0x53f5fb[_0x802b('0x46')]=_[_0x802b('0x45')](_0x217911[_0x802b('0x47')],qs['fields'](_0x25114c[_0x802b('0x42')]['fields']));_0x53f5fb[_0x802b('0x46')]=_0x53f5fb[_0x802b('0x46')][_0x802b('0x48')]?_0x53f5fb[_0x802b('0x46')]:_0x217911['model'];if(!_0x25114c['query'][_0x802b('0x49')](_0x802b('0x4a'))){_0x53f5fb[_0x802b('0x24')]=qs[_0x802b('0x24')](_0x25114c[_0x802b('0x42')][_0x802b('0x24')]);_0x53f5fb[_0x802b('0x23')]=qs[_0x802b('0x23')](_0x25114c['query'][_0x802b('0x23')]);}_0x53f5fb[_0x802b('0x4b')]=qs['sort'](_0x25114c[_0x802b('0x42')][_0x802b('0x4c')]);_0x53f5fb[_0x802b('0x4d')]=qs[_0x802b('0x44')](_['pick'](_0x25114c['query'],_0x217911[_0x802b('0x44')]),_0x29c174);var _0x34ca09=[];var _0x20d5cc=squel[_0x802b('0x4e')]()[_0x802b('0x4f')]('id')['field'](_0x802b('0x2d'))[_0x802b('0x4f')](_0x802b('0x50'))[_0x802b('0x51')](_0x802b('0x52'));var _0x2ccfc0=squel[_0x802b('0x4e')]()[_0x802b('0x4f')]('u.id')['field']('u.fullname')[_0x802b('0x4f')](_0x802b('0x53'))['from'](_0x802b('0x54'),'ui')['left_join'](_0x802b('0x55'),'u',_0x802b('0x56'));var _0x4fc335=squel['select']()[_0x802b('0x51')]('fax_interactions','i')[_0x802b('0x57')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x802b('0x57')]('users','o','o.id\x20=\x20i.UserId')[_0x802b('0x57')](_0x802b('0x58'),'a',_0x802b('0x59'))[_0x802b('0x57')](_0x802b('0x5a'),'me',_0x802b('0x5b'))[_0x802b('0x57')]('fax_interaction_has_tags','it',_0x802b('0x5c'))[_0x802b('0x57')](_0x802b('0x52'),'t',_0x802b('0x5d'));var _0xc0a71f=squel[_0x802b('0x5e')]();var _0x99b6d5=[];var _0x39d6c4=squel[_0x802b('0x5e')]();var _0x10fd3c;if(_0x25114c['query'][_0x802b('0x5f')]){_0x10fd3c=as[_0x802b('0x60')](_0x25114c[_0x802b('0x42')][_0x802b('0x5f')]);var _0x2ba05a=_0x10fd3c['sqlOperator'];for(var _0x284d05=0x0;_0x284d05<_0x10fd3c[_0x802b('0x61')][_0x802b('0x48')];_0x284d05++){var _0x3afcc0=_0x10fd3c['conditions'][_0x284d05];var _0x59b708='i';var _0x208f73=_[_0x802b('0x62')](_0x29c174,['name',_0x3afcc0[_0x802b('0x4f')]]);if(!_0x208f73){switch(_0x3afcc0['field']){case _0x802b('0x63'):if(_0x3afcc0['value']==0x1){_0x4fc335[_0x802b('0x64')]('`'+_0x3afcc0[_0x802b('0x4f')]+_0x802b('0x65'));}else{_0x4fc335[_0x802b('0x64')]('`'+_0x3afcc0[_0x802b('0x4f')]+_0x802b('0x66'));}break;case _0x802b('0x67'):if(_0x3afcc0['operator']===_0x802b('0x68')){if(_0x3afcc0['value']['split']('\x20')['length']>0x1){_0xc0a71f[_0x2ba05a](_0x802b('0x69'),qs[_0x802b('0x6a')](_0x3afcc0[_0x802b('0x6b')]),null);}else{var _0x483ca0='%'+_0x3afcc0[_0x802b('0x6b')]+'%';_0xc0a71f[_0x2ba05a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x483ca0,_0x483ca0,_0x483ca0);}}else{_0x208f73=_[_0x802b('0x62')](_0x29c174,['name',_0x802b('0x6c')]);_0x3afcc0[_0x802b('0x4f')]=_0x802b('0x6c');_0x37f878=as['buildExpression'](_0x59b708,_0x208f73[_0x802b('0x40')],_0x3afcc0);_0xc0a71f[_0x2ba05a](_0x37f878[_0x802b('0x6d')],_0x37f878[_0x802b('0x6b')][_0x802b('0x6e')],_0x37f878[_0x802b('0x6b')][_0x802b('0x20')]);}break;case'Tag':var _0x2fc4a3=_0x3afcc0[_0x802b('0x6b')][_0x802b('0x33')](',')[_0x802b('0x2f')](function(_0x3d8475){return Number(_0x3d8475);});_0x2fc4a3[_0x802b('0x34')](function(_0x4bccf2){_0x39d6c4['or'](_0x802b('0x6f'),'%,'+_0x4bccf2+',%');});_0x99b6d5=_[_0x802b('0x70')](_0x99b6d5,_0x2fc4a3);break;case _0x802b('0x71'):if(_0x3afcc0['operator']==='$substring'){_0xc0a71f[_0x2ba05a](_0x802b('0x72'),'%'+_0x3afcc0[_0x802b('0x6b')]+'%',null);}else{_0x208f73=_[_0x802b('0x62')](_0x29c174,[_0x802b('0x2d'),_0x802b('0x3b')]);_0x3afcc0['field']='UserId';_0x37f878=as['buildExpression'](_0x59b708,_0x208f73['type'],_0x3afcc0);_0xc0a71f[_0x2ba05a](_0x37f878[_0x802b('0x6d')],_0x37f878[_0x802b('0x6b')][_0x802b('0x6e')],_0x37f878['value'][_0x802b('0x20')]);}break;case _0x802b('0x73'):_0x37f878=as[_0x802b('0x74')]('me',null,_0x3afcc0);_0xc0a71f[_0x2ba05a](_0x37f878[_0x802b('0x6d')],_0x37f878['value']['start'],_0x37f878[_0x802b('0x6b')][_0x802b('0x20')]);break;}}else{var _0x37f878=as['buildExpression'](_0x59b708,_0x208f73[_0x802b('0x40')],_0x3afcc0);_0xc0a71f[_0x2ba05a](_0x37f878['text'],_0x37f878[_0x802b('0x6b')]['start'],_0x37f878[_0x802b('0x6b')]['end']);}}}else{var _0x4447cd=_(_0x25114c['query'])[_0x802b('0x43')]()[_0x802b('0x2f')](function(_0x12b399){return _[_0x802b('0x75')](_0x29c174,[_0x802b('0x2d'),_0x12b399])?_0x12b399:undefined;})[_0x802b('0x76')]()[_0x802b('0x6b')]();if(!_[_0x802b('0x77')](_0x4447cd)){_0x4447cd[_0x802b('0x34')](function(_0x1ac681){if(_0x1ac681===_0x802b('0x78')){_0x4fc335[_0x802b('0x4d')](_0x802b('0x79'),[]['concat'](_0x25114c[_0x802b('0x42')][_0x1ac681]));}else if(_0x1ac681===_0x802b('0x7a')){var _0x34fb02=JSON['parse'](_0x25114c[_0x802b('0x42')][_0x1ac681])['$gte'];var _0xf155d2=JSON[_0x802b('0x7b')](_0x25114c[_0x802b('0x42')][_0x1ac681])[_0x802b('0x7c')];_0x4fc335[_0x802b('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x34fb02,_0xf155d2);}else{if(_0x25114c[_0x802b('0x42')][_0x1ac681]===_0x802b('0x7d')){_0x4fc335[_0x802b('0x4d')]('i.'+_0x1ac681+_0x802b('0x7e'));}else{_0x4fc335[_0x802b('0x4d')]('i.'+_0x1ac681+_0x802b('0x7f'),_0x25114c['query'][_0x1ac681]);}}});}if(_0x25114c['query'][_0x802b('0x80')]){if(_0x25114c[_0x802b('0x42')][_0x802b('0x80')]==0x1){_0x4fc335[_0x802b('0x64')](_0x802b('0x81'));}else{_0x4fc335['having'](_0x802b('0x82'));}}if(_0x25114c['query'][_0x802b('0x83')]){_0x99b6d5=_[_0x802b('0x84')](_0x25114c[_0x802b('0x42')][_0x802b('0x83')])?_0x25114c[_0x802b('0x42')][_0x802b('0x83')]:new Array(_0x25114c['query'][_0x802b('0x83')]);_0x99b6d5['forEach'](function(_0x1a6ef7){_0x39d6c4['or'](_0x802b('0x6f'),'%,'+_0x1a6ef7+',%');});}if(_0x25114c[_0x802b('0x42')][_0x802b('0x85')]){var _0xf2a42=_0x25114c[_0x802b('0x42')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x802b('0x86')](_0xf2a42)){_0xc0a71f['or'](_0x802b('0x87'),_0xf2a42+'%')['or'](_0x802b('0x88'),_0xf2a42+'%');}_0xc0a71f['or'](_0x802b('0x89'),_0xf2a42+'%');}}_0x4fc335[_0x802b('0x4d')](_0xc0a71f);_0x4fc335[_0x802b('0x8a')]('i.id');var _0x415c79={'type':db['Sequelize'][_0x802b('0x8b')]['SELECT'],'raw':!![]};var _0x1468a0=_0x4fc335[_0x802b('0x8c')]();_0x1468a0[_0x802b('0x4f')](_0x802b('0x8d'));_0x1468a0['field'](_0x802b('0x8e'),'unreadMessages');if(_0x53f5fb[_0x802b('0x4b')]){_0x53f5fb[_0x802b('0x4b')][_0x802b('0x34')](function(_0x2a1ed9){var _0x35a3a9=_0x2a1ed9[0x0]===_0x802b('0x8f')?_0x2a1ed9[0x0]:'i.'+_0x2a1ed9[0x0];_0x4fc335['order'](_0x35a3a9,_0x2a1ed9[0x1]===_0x802b('0x90')?![]:!![]);});}if(!_[_0x802b('0x77')](_0x99b6d5)){_0x4fc335[_0x802b('0x64')](_0x39d6c4);_0x1468a0[_0x802b('0x4d')](_0x802b('0x91'),_0x99b6d5);}BPromise[_0x802b('0x92')]()[_0x802b('0x29')](function(){if(!_0x10fd3c){if(_0x25114c[_0x802b('0x42')][_0x802b('0x78')])return;_0x1468a0['where'](_0x802b('0x93'));_0x4fc335[_0x802b('0x4d')](_0x802b('0x93'));return;}if(_0x25114c[_0x802b('0x94')][_0x802b('0x95')]!=='agent')return;return _0x25114c[_0x802b('0x94')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x802b('0x29')](function(_0x54d7d2){if(_[_0x802b('0x77')](_0x54d7d2)){_0x1468a0['where'](_0x802b('0x96'));_0x4fc335['where'](_0x802b('0x96'));}else{_0x1468a0[_0x802b('0x4d')]('i.FaxAccountId\x20IN\x20?',_[_0x802b('0x2f')](_0x54d7d2,'id'));_0x4fc335[_0x802b('0x4d')](_0x802b('0x79'),_[_0x802b('0x2f')](_0x54d7d2,'id'));}});})[_0x802b('0x29')](function(){if(_0x25114c[_0x802b('0x94')]['role']===_0x802b('0x97')&&!_0x10fd3c&&!_0x25114c[_0x802b('0x42')][_0x802b('0x78')])return[];return db[_0x802b('0x98')]['query'](_0x1468a0[_0x802b('0x99')](),_0x415c79);})['then'](function(_0x3c49a4){_0x164eda[_0x802b('0x9a')]=_0x3c49a4['length'];if(_0x164eda['count']===0x0)return[];return db[_0x802b('0x98')][_0x802b('0x42')](_0x20d5cc['toString'](),_0x415c79)[_0x802b('0x29')](function(_0x15468b){_0x34ca09=_[_0x802b('0x9b')](_0x15468b,'id');_0x415c79=_[_0x802b('0x9c')](_0x415c79,{'model':db[_0x802b('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25114c[_0x802b('0x42')]['fields']){_0x53f5fb[_0x802b('0x46')][_0x802b('0x34')](function(_0x52acf3){_0x4fc335[_0x802b('0x4f')]('i.'+_0x52acf3);});}else{_0x4fc335[_0x802b('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x802b('0x63'));_0x4fc335[_0x802b('0x4f')](_0x802b('0x9d'),_0x802b('0x9e'));_0x4fc335[_0x802b('0x4f')](_0x802b('0x9f'),_0x802b('0xa0'));_0x4fc335[_0x802b('0x4f')](_0x802b('0xa1'),'contactName');_0x4fc335['field']('i.*');_0x4fc335[_0x802b('0x4f')](_0x802b('0xa2'),_0x802b('0xa3'));_0x4fc335['field'](_0x802b('0xa4'),_0x802b('0xa5'));_0x4fc335[_0x802b('0x4f')](_0x802b('0xa6'),_0x802b('0xa7'));_0x4fc335[_0x802b('0x4f')](_0x802b('0xa8'),'Contact.phone');_0x4fc335[_0x802b('0x4f')](_0x802b('0xa9'),_0x802b('0xaa'));_0x4fc335[_0x802b('0x4f')](_0x802b('0xab'),_0x802b('0xac'));_0x4fc335[_0x802b('0x4f')]('o.fullname','Owner.fullname');_0x4fc335['field'](_0x802b('0xad'),_0x802b('0xae'));_0x4fc335[_0x802b('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x802b('0x31'));}if(_0x53f5fb['limit'])_0x4fc335['limit'](_0x53f5fb[_0x802b('0x24')]);if(_0x53f5fb[_0x802b('0x23')])_0x4fc335['offset'](_0x53f5fb[_0x802b('0x23')]);return db[_0x802b('0x98')][_0x802b('0x42')](_0x4fc335[_0x802b('0x99')](),_0x415c79);})['then'](function(_0x37400f){if(_0x37400f[_0x802b('0x48')]>0x0)_0x2ccfc0['where'](_0x802b('0xaf'),_[_0x802b('0x2f')](_0x37400f,'id'));return db[_0x802b('0x98')]['query'](_0x2ccfc0['toString'](),_0x415c79)[_0x802b('0x29')](function(_0x585875){var _0x4c8076=_['groupBy'](_0x585875,'FaxInteractionId');var _0x36536f=[];_0x37400f[_0x802b('0x34')](function(_0x18cbc1){_0x36536f[_0x802b('0x35')](updateFaxInteraction(_0x18cbc1,_0x34ca09,_0x4c8076));});return BPromise[_0x802b('0xb0')](_0x36536f);});});})[_0x802b('0x29')](function(_0x46b91b){_0x164eda[_0x802b('0xb1')]=_0x46b91b;return _0x164eda;})['then'](respondWithFilteredResult(_0x4c43a8,_0x53f5fb))['catch'](handleError(_0x4c43a8,null));};exports[_0x802b('0xb2')]=function(_0x54e2c6,_0x5bd9af){var _0x55797d={'raw':![],'where':{'id':_0x54e2c6[_0x802b('0xb3')]['id']}},_0x442b92={};_0x442b92[_0x802b('0x47')]=_[_0x802b('0x43')](db[_0x802b('0x3d')][_0x802b('0x3e')]);_0x442b92[_0x802b('0x42')]=_[_0x802b('0x43')](_0x54e2c6['query']);_0x442b92['filters']=_[_0x802b('0x45')](_0x442b92[_0x802b('0x47')],_0x442b92[_0x802b('0x42')]);_0x55797d[_0x802b('0x46')]=_[_0x802b('0x45')](_0x442b92[_0x802b('0x47')],qs[_0x802b('0xb4')](_0x54e2c6[_0x802b('0x42')][_0x802b('0xb4')]));_0x55797d[_0x802b('0x46')]=_0x55797d['attributes']['length']?_0x55797d[_0x802b('0x46')]:_0x442b92['model'];if(_0x54e2c6[_0x802b('0x42')][_0x802b('0xb5')]){_0x55797d['include']=[{'all':!![]}];}_0x55797d=_['merge']({},_0x55797d,_0x54e2c6[_0x802b('0xb6')]);return db[_0x802b('0x3d')][_0x802b('0x62')](_0x55797d)['then'](handleEntityNotFound(_0x5bd9af,null))['then'](respondWithResult(_0x5bd9af,null))['catch'](handleError(_0x5bd9af,null));};exports[_0x802b('0xb7')]=function(_0x4ca918,_0x3b3b5c){return db['FaxInteraction'][_0x802b('0xb7')](_0x4ca918['body'],{})[_0x802b('0x29')](respondWithResult(_0x3b3b5c,0xc9))[_0x802b('0xb8')](handleError(_0x3b3b5c,null));};exports['update']=function(_0x40da6c,_0x57af95){if(_0x40da6c[_0x802b('0x73')]['id']){delete _0x40da6c['body']['id'];}return db[_0x802b('0x3d')][_0x802b('0x62')]({'where':{'id':_0x40da6c[_0x802b('0xb3')]['id']}})[_0x802b('0x29')](handleEntityNotFound(_0x57af95,null))[_0x802b('0x29')](saveUpdates(_0x40da6c['body'],null))[_0x802b('0x29')](respondWithResult(_0x57af95,null))[_0x802b('0xb8')](handleError(_0x57af95,null));};exports[_0x802b('0x2a')]=function(_0x5adc25,_0x330439){return db['FaxInteraction']['find']({'where':{'id':_0x5adc25[_0x802b('0xb3')]['id']}})[_0x802b('0x29')](handleEntityNotFound(_0x330439,null))['then'](removeEntity(_0x330439,null))[_0x802b('0xb8')](handleError(_0x330439,null));};exports[_0x802b('0xb9')]=function(_0x9a637e,_0x366bdc){return db[_0x802b('0x3d')]['describe']()[_0x802b('0x29')](respondWithResult(_0x366bdc,null))[_0x802b('0xb8')](handleError(_0x366bdc,null));};exports['addMessage']=function(_0x38366f,_0x1ac136,_0x49d326){return db[_0x802b('0xba')][_0x802b('0x62')]({'where':{'id':_0x38366f[_0x802b('0xb3')]['id']}})[_0x802b('0x29')](handleEntityNotFound(_0x1ac136,null))[_0x802b('0x29')](function(_0x555917){if(_0x555917){return _0x555917[_0x802b('0xbb')](_0x38366f[_0x802b('0x73')][_0x802b('0xbc')],_[_0x802b('0xbd')](_0x38366f['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1ac136,null))[_0x802b('0xb8')](handleError(_0x1ac136,null));};exports['getMessages']=function(_0x314f48,_0x12a736,_0x5c82da){var _0x25d82a={'raw':![],'where':{}};var _0x352215={};var _0x15b25f={'count':0x0,'rows':[]};return db[_0x802b('0x3d')][_0x802b('0xbe')]({'where':{'id':_0x314f48[_0x802b('0xb3')]['id']}})[_0x802b('0x29')](handleEntityNotFound(_0x12a736,null))[_0x802b('0x29')](function(_0xc8d344){if(_0xc8d344){_0x352215[_0x802b('0x47')]=_[_0x802b('0x43')](db[_0x802b('0xba')][_0x802b('0x3e')]);_0x352215['query']=_['keys'](_0x314f48[_0x802b('0x42')]);_0x352215[_0x802b('0x44')]=_['intersection'](_0x352215[_0x802b('0x47')],_0x352215[_0x802b('0x42')]);_0x25d82a[_0x802b('0x46')]=_[_0x802b('0x45')](_0x352215['model'],qs[_0x802b('0xb4')](_0x314f48[_0x802b('0x42')][_0x802b('0xb4')]));_0x25d82a[_0x802b('0x46')]=_0x25d82a['attributes'][_0x802b('0x48')]?_0x25d82a[_0x802b('0x46')]:_0x352215[_0x802b('0x47')];if(!_0x314f48[_0x802b('0x42')][_0x802b('0x49')]('nolimit')){_0x25d82a[_0x802b('0x24')]=qs[_0x802b('0x24')](_0x314f48[_0x802b('0x42')][_0x802b('0x24')]);_0x25d82a[_0x802b('0x23')]=qs[_0x802b('0x23')](_0x314f48['query'][_0x802b('0x23')]);}_0x25d82a[_0x802b('0x4b')]=qs[_0x802b('0x4c')](_0x314f48[_0x802b('0x42')][_0x802b('0x4c')]);_0x25d82a[_0x802b('0x4d')]=qs[_0x802b('0x44')](_[_0x802b('0xbf')](_0x314f48['query'],_0x352215['filters']));_0x25d82a['where'][_0x802b('0xc0')]=_0xc8d344['id'];if(_0x314f48[_0x802b('0x42')][_0x802b('0x85')]){_0x25d82a['where']=_[_0x802b('0x9c')](_0x25d82a[_0x802b('0x4d')],{'$or':_['map'](_0x25d82a[_0x802b('0x46')],function(_0x192c60){var _0x1ca9ee={};_0x1ca9ee[_0x192c60]={'$like':'%'+_0x314f48[_0x802b('0x42')]['filter']+'%'};return _0x1ca9ee;})});}if(_0x314f48[_0x802b('0x42')][_0x802b('0xc1')]){var _0x57c072=_0x314f48[_0x802b('0x42')][_0x802b('0xc1')][_0x802b('0x33')](',');var _0x231d62={};_0x231d62[_0x57c072[0x0]]={'$gte':moment(_0x57c072[0x1])[_0x802b('0xc2')](_0x802b('0xc3'))};_0x25d82a[_0x802b('0x4d')]=_[_0x802b('0x9c')](_0x25d82a[_0x802b('0x4d')],_0x231d62);}_0x25d82a=_[_0x802b('0x9c')]({},_0x25d82a,_0x314f48[_0x802b('0xb6')]);return db['FaxMessage']['count']({'where':_0x25d82a[_0x802b('0x4d')]})[_0x802b('0x29')](function(_0x46fe22){_0x15b25f['count']=_0x46fe22;if(_0x314f48[_0x802b('0x42')][_0x802b('0xb5')]){_0x25d82a[_0x802b('0xc4')]=[{'all':!![]}];}return db[_0x802b('0xba')][_0x802b('0xc5')](_0x25d82a);})[_0x802b('0x29')](function(_0x37f512){_0x15b25f[_0x802b('0xb1')]=_0x37f512;return _0x15b25f;});}})[_0x802b('0x29')](respondWithFilteredResult(_0x12a736,_0x25d82a))[_0x802b('0xb8')](handleError(_0x12a736,null));};exports[_0x802b('0xc6')]=function(_0x137b0a,_0x226348,_0x3feb08){return db[_0x802b('0x3d')]['find']({'where':{'id':_0x137b0a[_0x802b('0xb3')]['id']}})['then'](handleEntityNotFound(_0x226348,null))[_0x802b('0x29')](function(_0x469974){if(_0x469974){return _0x469974[_0x802b('0xc7')](_0x137b0a[_0x802b('0x73')]['ids'],_[_0x802b('0xbd')](_0x137b0a[_0x802b('0x73')],[_0x802b('0xbc'),'id'])||{})['spread'](function(){return db['Tag'][_0x802b('0xc5')]({'attributes':['id',_0x802b('0x2d'),_0x802b('0x50')],'where':{'id':_0x137b0a['body'][_0x802b('0xbc')]}});})[_0x802b('0x29')](function(_0x518592){socket[_0x802b('0xc8')]('faxInteractionTags:save',{'id':Number(_0x137b0a[_0x802b('0xb3')]['id']),'tags':_0x518592||[]});return{'id':Number(_0x137b0a[_0x802b('0xb3')]['id']),'tags':_0x518592||[]};});}})[_0x802b('0x29')](respondWithResult(_0x226348,null))[_0x802b('0xb8')](handleError(_0x226348,null));};exports[_0x802b('0xc9')]=function(_0x5465ee,_0x5777ae,_0x864ca3){return db['FaxInteraction'][_0x802b('0x62')]({'where':{'id':_0x5465ee[_0x802b('0xb3')]['id']}})[_0x802b('0x29')](handleEntityNotFound(_0x5777ae,null))[_0x802b('0x29')](function(_0x15cb85){if(_0x15cb85){return _0x15cb85[_0x802b('0xc9')](_0x5465ee[_0x802b('0x42')][_0x802b('0xbc')]);}})['then'](respondWithStatusCode(_0x5777ae,null))[_0x802b('0xb8')](handleError(_0x5777ae,null));};exports[_0x802b('0xca')]=function(_0x3bbcda,_0x51f8cf){var _0xb29554=moment()['unix']()[_0x802b('0x99')]();var _0x4e4ddd=path[_0x802b('0xcb')](config[_0x802b('0xcc')],'server','files',_0x802b('0xcd'));var _0x1f04d2=path[_0x802b('0xcb')](config[_0x802b('0xcc')],'server',_0x802b('0xce'),'attachments');var _0x5e3c54=path[_0x802b('0xcb')](_0x4e4ddd,_0xb29554);var _0x3452a9=util[_0x802b('0xc2')](_0x802b('0xcf'),_0x3bbcda[_0x802b('0xb3')]['id'],_0xb29554);var _0x19686b=path['join'](_0x4e4ddd,_0x3452a9);var _0x512a92=[];_0x512a92['push']({'model':db['Attachment'],'as':_0x802b('0xd0'),'raw':!![]});var _0x1ad23a=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0x802b('0x7a')],'include':_0x512a92}];return db[_0x802b('0x3d')][_0x802b('0x62')]({'where':{'id':_0x3bbcda[_0x802b('0xb3')]['id']},'include':_0x1ad23a})[_0x802b('0x29')](handleEntityNotFound(_0x51f8cf,null))[_0x802b('0x29')](function(_0x39f596){if(_0x39f596&&_0x39f596['Messages']){var _0x39d3bc=_0x39f596[_0x802b('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x5e3c54);for(var _0x3dd628=0x0;_0x3dd628<_0x39d3bc['Messages'][_0x802b('0x48')];_0x3dd628++){var _0x2f91ce=_0x39d3bc['Messages'][_0x3dd628][_0x802b('0xd0')];if(_0x2f91ce){var _0x33a527=path[_0x802b('0xcb')](_0x1f04d2,_0x2f91ce[_0x802b('0xd2')]);if(fs[_0x802b('0xd3')](_0x33a527)){fs['createReadStream'](_0x33a527)['pipe'](fs[_0x802b('0xd4')](path['join'](_0x5e3c54,_0x2f91ce[_0x802b('0xd2')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x1def7e,_0x130465){zipdir(_0x5e3c54,{'saveTo':_0x19686b},function(_0x395d2b,_0x2b32b4){if(_0x395d2b)return _0x130465(_0x395d2b);return _0x1def7e(_0x2b32b4);});})['then'](function(){return new BPromise(function(_0x148449,_0x331c48){rimraf(_0x5e3c54,function(_0x4cf5bb){if(_0x4cf5bb)_0x331c48(_0x4cf5bb);return _0x148449();});});})[_0x802b('0x29')](function(){return _0x51f8cf[_0x802b('0xca')](_0x19686b,_0x3452a9,function(_0x4a1923){if(_0x4a1923){console[_0x802b('0xd5')]('err',_0x4a1923);}else{fs[_0x802b('0xd6')](_0x19686b);}});});});}else{return _0x51f8cf['sendStatus'](0xc8);}})['catch'](handleError(_0x51f8cf,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8c329eb..b81e628 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 _0xb48c=['remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x59b341,_0x122518){var _0x5690b1=function(_0x3e9204){while(--_0x3e9204){_0x59b341['push'](_0x59b341['shift']());}};_0x5690b1(++_0x122518);}(_0xb48c,0x1b5));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xcb48('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xcb48('0x0'))['db'][_0xcb48('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcb48('0x2')](0x0);var events={'afterCreate':_0xcb48('0x3'),'afterUpdate':_0xcb48('0x4'),'afterDestroy':_0xcb48('0x5')};function emitEvent(_0x485e88){return function(_0x52d436,_0x3ce3dd,_0x51a143){_0x52d436[_0xcb48('0x6')]({'attributes':['id'],'raw':!![]})[_0xcb48('0x7')](function(_0x1aefb1){_0x52d436['setDataValue'](_0xcb48('0x8'),_0x1aefb1[_0xcb48('0x9')](function(_0x39a942){return{'id':_0x39a942['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x52d436['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb48('0x7')](function(_0x43eb6d){_0x52d436[_0xcb48('0xa')](_0xcb48('0xb'),_0x43eb6d[_0xcb48('0xc')]);FaxInteractionEvents[_0xcb48('0xd')](_0x485e88+':'+_0x52d436['id'],_0x52d436);FaxInteractionEvents['emit'](_0x485e88,_0x52d436);_0x51a143(null);})[_0xcb48('0xe')](_0x51a143(null));};}for(var e in events){if(events[_0xcb48('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xcb48('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x20b3=['hook','events','../../mysqldb','FaxMessage','save','update','remove','then','setDataValue','Users','map','emit','hasOwnProperty'];(function(_0x5ab90e,_0x9d6d92){var _0x546739=function(_0x131d06){while(--_0x131d06){_0x5ab90e['push'](_0x5ab90e['shift']());}};_0x546739(++_0x9d6d92);}(_0x20b3,0xc4));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x320b('0x0'));var FaxInteraction=require(_0x320b('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x320b('0x1'))['db'][_0x320b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x320b('0x3'),'afterUpdate':_0x320b('0x4'),'afterDestroy':_0x320b('0x5')};function emitEvent(_0x527c64){return function(_0x2a38f4,_0x5135fe,_0xbcea6a){_0x2a38f4['getUsers']({'attributes':['id'],'raw':!![]})[_0x320b('0x6')](function(_0x4feb53){_0x2a38f4[_0x320b('0x7')](_0x320b('0x8'),_0x4feb53[_0x320b('0x9')](function(_0x5c025d){return{'id':_0x5c025d['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x2a38f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x320b('0x6')](function(_0x3197fa){_0x2a38f4[_0x320b('0x7')]('unreadMessages',_0x3197fa['length']);FaxInteractionEvents[_0x320b('0xa')](_0x527c64+':'+_0x2a38f4['id'],_0x2a38f4);FaxInteractionEvents[_0x320b('0xa')](_0x527c64,_0x2a38f4);_0xbcea6a(null);})['catch'](_0xbcea6a(null));};}for(var e in events){if(events[_0x320b('0xb')](e)){var event=events[e];FaxInteraction[_0x320b('0xc')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ed4d03d..244649b 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 _0xb5bf=['exports','define','FaxInteraction','fax_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x58d2ee,_0x443649){var _0x4f73ea=function(_0x45666f){while(--_0x45666f){_0x58d2ee['push'](_0x58d2ee['shift']());}};_0x4f73ea(++_0x443649);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb5bf[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var logger=require(_0xfb5b('0x2'))('api');var moment=require(_0xfb5b('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb5b('0x4'));var fs=require('fs');var path=require(_0xfb5b('0x5'));var rimraf=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var attributes=require(_0xfb5b('0x8'));module[_0xfb5b('0x9')]=function(_0x5a9c12,_0x42b1c5){return _0x5a9c12[_0xfb5b('0xa')](_0xfb5b('0xb'),attributes,{'tableName':_0xfb5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ac378,_0x5bd4ce,_0x570b34){if(_0x3ac378['changed']('closed')){_0x3ac378[_0xfb5b('0xd')]=moment()['format'](_0xfb5b('0xe'));}_0x570b34(null,_0x3ac378);}}});}; \ No newline at end of file +var _0xe2a7=['../../config/environment','define','FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xe2a7,0x12e));var _0x7e2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e2a('0x0'));var util=require(_0x7e2a('0x1'));var logger=require('../../config/logger')(_0x7e2a('0x2'));var moment=require(_0x7e2a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e2a('0x4'));var fs=require('fs');var path=require(_0x7e2a('0x5'));var rimraf=require('rimraf');var config=require(_0x7e2a('0x6'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0xa9a5a0,_0x2a30c0){return _0xa9a5a0[_0x7e2a('0x7')](_0x7e2a('0x8'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ce14,_0x59fcef,_0x1a4af1){if(_0x43ce14[_0x7e2a('0x9')](_0x7e2a('0xa'))){_0x43ce14[_0x7e2a('0xb')]=moment()[_0x7e2a('0xc')](_0x7e2a('0xd'));}_0x1a4af1(null,_0x43ce14);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 48ee8b8..07a2403 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 _0x8237=['jayson/promise','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','request\x20sent','catch','update','options','raw','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1a74c7,_0x3a05d9){var _0x5d9220=function(_0x128600){while(--_0x128600){_0x1a74c7['push'](_0x1a74c7['shift']());}};_0x5d9220(++_0x3a05d9);}(_0x8237,0x187));var _0x7823=function(_0x85fbc0,_0x5be0a6){_0x85fbc0=_0x85fbc0-0x0;var _0x29b4be=_0x8237[_0x85fbc0];return _0x29b4be;};'use strict';var _=require(_0x7823('0x0'));var util=require(_0x7823('0x1'));var moment=require(_0x7823('0x2'));var BPromise=require(_0x7823('0x3'));var rs=require(_0x7823('0x4'));var fs=require('fs');var Redis=require(_0x7823('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7823('0x6'));var logger=require(_0x7823('0x7'))('rpc');var config=require(_0x7823('0x8'));var jayson=require(_0x7823('0x9'));var client=jayson['client'][_0x7823('0xa')]({'port':0x232a});config[_0x7823('0xb')]=_['defaults'](config[_0x7823('0xb')],{'host':_0x7823('0xc'),'port':0x18eb});var socket=require(_0x7823('0xd'))(new Redis(config['redis']));require(_0x7823('0xe'))['register'](socket);function respondWithRpcPromise(_0x3372d0,_0x238b1b,_0x3d11cd){return new BPromise(function(_0x1a7c61,_0x5548f8){return client[_0x7823('0xf')](_0x3372d0,_0x3d11cd)[_0x7823('0x10')](function(_0x384e48){logger[_0x7823('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x238b1b,'request\x20sent');logger[_0x7823('0x12')](_0x7823('0x13'),_0x238b1b,'request\x20sent',JSON[_0x7823('0x14')](_0x384e48));if(_0x384e48[_0x7823('0x15')]){if(_0x384e48[_0x7823('0x15')][_0x7823('0x16')]===0x1f4){logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);return _0x5548f8(_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);}logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);return _0x1a7c61(_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);}else{logger[_0x7823('0x11')](_0x7823('0x17'),_0x238b1b,_0x7823('0x19'));_0x1a7c61(_0x384e48['result'][_0x7823('0x18')]);}})[_0x7823('0x1a')](function(_0x4c2ce8){logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x4c2ce8);_0x5548f8(_0x4c2ce8);});});}exports['UpdateFaxInteraction']=function(_0x3efd80){var _0x3168a0=this;return new Promise(function(_0x2a1e89,_0x1e67cc){return db['FaxInteraction'][_0x7823('0x1b')](_0x3efd80['body'],{'raw':_0x3efd80[_0x7823('0x1c')]?_0x3efd80['options'][_0x7823('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efd80[_0x7823('0x1c')]?_0x3efd80[_0x7823('0x1c')]['where']||null:null,'attributes':_0x3efd80['options']?_0x3efd80[_0x7823('0x1c')][_0x7823('0x1e')]||null:null,'limit':_0x3efd80[_0x7823('0x1c')]?_0x3efd80[_0x7823('0x1c')]['limit']||null:null})['then'](function(_0x4077a6){logger[_0x7823('0x11')](_0x7823('0x1f'),_0x3efd80);logger[_0x7823('0x12')](_0x7823('0x1f'),_0x3efd80,JSON['stringify'](_0x4077a6));_0x2a1e89(_0x4077a6);})[_0x7823('0x1a')](function(_0x38ca79){logger['error'](_0x7823('0x1f'),_0x38ca79['message'],_0x3efd80);_0x1e67cc(_0x3168a0[_0x7823('0x15')](0x1f4,_0x38ca79['message']));});});};exports[_0x7823('0x20')]=function(_0x69c80c){return new Promise(function(_0x2b8b81,_0x13d944){return db[_0x7823('0x21')]['find']({'where':_0x69c80c[_0x7823('0x1c')]?_0x69c80c[_0x7823('0x1c')]['where']||null:null})['then'](function(_0x5c01ce){if(_0x5c01ce){return _0x5c01ce[_0x7823('0x22')](_0x69c80c[_0x7823('0x23')][_0x7823('0x24')],_[_0x7823('0x25')](_0x69c80c[_0x7823('0x23')],[_0x7823('0x24'),'id'])||{});}})[_0x7823('0x26')](function(_0x454e16){logger[_0x7823('0x11')](_0x7823('0x27'),_0x69c80c);logger['debug']('AddTags',_0x69c80c,JSON[_0x7823('0x14')](_0x454e16));_0x2b8b81(_0x454e16);})['catch'](function(_0x8a23){logger[_0x7823('0x15')](_0x7823('0x27'),_0x8a23[_0x7823('0x18')],_0x69c80c);_0x13d944(_this['error'](0x1f4,_0x8a23[_0x7823('0x18')]));});});}; \ No newline at end of file +var _0x7baa=['result','catch','FaxInteraction','update','body','options','where','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x295a97,_0x4723bc){var _0x36d761=function(_0x14ceae){while(--_0x14ceae){_0x295a97['push'](_0x295a97['shift']());}};_0x36d761(++_0x4723bc);}(_0x7baa,0x181));var _0xa7ba=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x7baa[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0xa7ba('0x0'));var util=require(_0xa7ba('0x1'));var moment=require(_0xa7ba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7ba('0x3'));var db=require(_0xa7ba('0x4'))['db'];var utils=require(_0xa7ba('0x5'));var logger=require(_0xa7ba('0x6'))(_0xa7ba('0x7'));var config=require(_0xa7ba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7ba('0x9')][_0xa7ba('0xa')]({'port':0x232a});config[_0xa7ba('0xb')]=_[_0xa7ba('0xc')](config[_0xa7ba('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7ba('0xd'))(new Redis(config[_0xa7ba('0xb')]));require(_0xa7ba('0xe'))[_0xa7ba('0xf')](socket);function respondWithRpcPromise(_0xb33f43,_0x422f66,_0x53ce3e){return new BPromise(function(_0x1425f9,_0x31342c){return client[_0xa7ba('0x10')](_0xb33f43,_0x53ce3e)[_0xa7ba('0x11')](function(_0x5578c3){logger['info'](_0xa7ba('0x12'),_0x422f66,_0xa7ba('0x13'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x422f66,_0xa7ba('0x13'),JSON[_0xa7ba('0x14')](_0x5578c3));if(_0x5578c3[_0xa7ba('0x15')]){if(_0x5578c3[_0xa7ba('0x15')][_0xa7ba('0x16')]===0x1f4){logger[_0xa7ba('0x15')](_0xa7ba('0x12'),_0x422f66,_0x5578c3['error']['message']);return _0x31342c(_0x5578c3[_0xa7ba('0x15')]['message']);}logger[_0xa7ba('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x422f66,_0x5578c3[_0xa7ba('0x15')]['message']);return _0x1425f9(_0x5578c3[_0xa7ba('0x15')][_0xa7ba('0x17')]);}else{logger[_0xa7ba('0x18')](_0xa7ba('0x12'),_0x422f66,_0xa7ba('0x13'));_0x1425f9(_0x5578c3[_0xa7ba('0x19')][_0xa7ba('0x17')]);}})[_0xa7ba('0x1a')](function(_0xe8b3b){logger[_0xa7ba('0x15')](_0xa7ba('0x12'),_0x422f66,_0xe8b3b);_0x31342c(_0xe8b3b);});});}exports['UpdateFaxInteraction']=function(_0x517e0a){var _0x16a15b=this;return new Promise(function(_0x360932,_0x52a6ca){return db[_0xa7ba('0x1b')][_0xa7ba('0x1c')](_0x517e0a[_0xa7ba('0x1d')],{'raw':_0x517e0a[_0xa7ba('0x1e')]?_0x517e0a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x517e0a[_0xa7ba('0x1e')]?_0x517e0a[_0xa7ba('0x1e')][_0xa7ba('0x1f')]||null:null,'attributes':_0x517e0a['options']?_0x517e0a[_0xa7ba('0x1e')]['attributes']||null:null,'limit':_0x517e0a['options']?_0x517e0a[_0xa7ba('0x1e')][_0xa7ba('0x20')]||null:null})[_0xa7ba('0x11')](function(_0x27dba9){logger['info'](_0xa7ba('0x21'),_0x517e0a);logger['debug'](_0xa7ba('0x21'),_0x517e0a,JSON[_0xa7ba('0x14')](_0x27dba9));_0x360932(_0x27dba9);})['catch'](function(_0x2f7f63){logger['error'](_0xa7ba('0x21'),_0x2f7f63[_0xa7ba('0x17')],_0x517e0a);_0x52a6ca(_0x16a15b[_0xa7ba('0x15')](0x1f4,_0x2f7f63[_0xa7ba('0x17')]));});});};exports[_0xa7ba('0x22')]=function(_0x318a55){return new Promise(function(_0x201345,_0x25c503){return db[_0xa7ba('0x1b')][_0xa7ba('0x23')]({'where':_0x318a55[_0xa7ba('0x1e')]?_0x318a55['options'][_0xa7ba('0x1f')]||null:null})[_0xa7ba('0x11')](function(_0x53c73e){if(_0x53c73e){return _0x53c73e[_0xa7ba('0x24')](_0x318a55['body'][_0xa7ba('0x25')],_[_0xa7ba('0x26')](_0x318a55['body'],[_0xa7ba('0x25'),'id'])||{});}})[_0xa7ba('0x27')](function(_0x5861ca){logger[_0xa7ba('0x18')](_0xa7ba('0x28'),_0x318a55);logger['debug'](_0xa7ba('0x28'),_0x318a55,JSON[_0xa7ba('0x14')](_0x5861ca));_0x201345(_0x5861ca);})[_0xa7ba('0x1a')](function(_0x4c1d73){logger[_0xa7ba('0x15')](_0xa7ba('0x28'),_0x4c1d73[_0xa7ba('0x17')],_0x318a55);_0x25c503(_this[_0xa7ba('0x15')](0x1f4,_0x4c1d73['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 2abafdc..ca70b16 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 _0x6de3=['faxInteraction:','./faxInteraction.events','save','remove','update','register','length'];(function(_0x1f4c7f,_0x405623){var _0x3486c3=function(_0x266ea0){while(--_0x266ea0){_0x1f4c7f['push'](_0x1f4c7f['shift']());}};_0x3486c3(++_0x405623);}(_0x6de3,0x9b));var _0x36de=function(_0x26a052,_0x2f720d){_0x26a052=_0x26a052-0x0;var _0x5e1bac=_0x6de3[_0x26a052];return _0x5e1bac;};'use strict';var FaxInteractionEvents=require(_0x36de('0x0'));var events=[_0x36de('0x1'),_0x36de('0x2'),_0x36de('0x3')];function createListener(_0x3cedb1,_0x59420a){return function(_0x489227){_0x59420a['emit'](_0x3cedb1,_0x489227);};}function removeListener(_0x2a8075,_0x2a143e){return function(){FaxInteractionEvents['removeListener'](_0x2a8075,_0x2a143e);};}exports[_0x36de('0x4')]=function(_0x1478cc){for(var _0x3e049e=0x0,_0x2b84ea=events[_0x36de('0x5')];_0x3e049e<_0x2b84ea;_0x3e049e++){var _0x1233b5=events[_0x3e049e];var _0x5c787e=createListener(_0x36de('0x6')+_0x1233b5,_0x1478cc);FaxInteractionEvents['on'](_0x1233b5,_0x5c787e);}}; \ No newline at end of file +var _0x31e6=['./faxInteraction.events','save','remove','update','register','length','faxInteraction:'];(function(_0x16ee2c,_0x6cc549){var _0x33153c=function(_0x198046){while(--_0x198046){_0x16ee2c['push'](_0x16ee2c['shift']());}};_0x33153c(++_0x6cc549);}(_0x31e6,0xf5));var _0x631e=function(_0x3f1635,_0x31eaf8){_0x3f1635=_0x3f1635-0x0;var _0x5d8c33=_0x31e6[_0x3f1635];return _0x5d8c33;};'use strict';var FaxInteractionEvents=require(_0x631e('0x0'));var events=[_0x631e('0x1'),_0x631e('0x2'),_0x631e('0x3')];function createListener(_0x23dff9,_0x5564ee){return function(_0x3d844d){_0x5564ee['emit'](_0x23dff9,_0x3d844d);};}function removeListener(_0x25a3cf,_0x1fb9d1){return function(){FaxInteractionEvents['removeListener'](_0x25a3cf,_0x1fb9d1);};}exports[_0x631e('0x4')]=function(_0xb3a2c1){for(var _0x89e2d4=0x0,_0x5505b5=events[_0x631e('0x5')];_0x89e2d4<_0x5505b5;_0x89e2d4++){var _0x54c113=events[_0x89e2d4];var _0x11f4a4=createListener(_0x631e('0x6')+_0x54c113,_0xb3a2c1);FaxInteractionEvents['on'](_0x54c113,_0x11f4a4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index f2b4a2a..29ffa31 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 _0xdc59=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','fax','update','tracked','faxinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdc59,0x1a2));var _0x9dc5=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xdc59[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var path=require(_0x9dc5('0x2'));var timeout=require(_0x9dc5('0x3'));var express=require(_0x9dc5('0x4'));var router=express[_0x9dc5('0x5')]();var fs_extra=require(_0x9dc5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var controller=require(_0x9dc5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9dc5('0xa')]);router[_0x9dc5('0xb')](_0x9dc5('0xc'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0xe')]);router['get'](_0x9dc5('0xf'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x10')]);router['get']('/:id/messages',auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x11')]);router[_0x9dc5('0xb')](_0x9dc5('0x12'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x13')]);router[_0x9dc5('0x14')]('/',auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x15')]);router[_0x9dc5('0x14')](_0x9dc5('0x16'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x17')]);router[_0x9dc5('0x14')](_0x9dc5('0x18'),auth[_0x9dc5('0xd')](),interaction['tracked']('fax',_0x9dc5('0x19')),controller[_0x9dc5('0x1a')]);router[_0x9dc5('0x1b')](_0x9dc5('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x9dc5('0x1c'),'faxinteraction:update'),controller[_0x9dc5('0x1d')]);router['delete'](_0x9dc5('0xf'),auth['isAuthenticated'](),interaction[_0x9dc5('0x1e')]('fax',_0x9dc5('0x1f')),controller[_0x9dc5('0x20')]);router['delete'](_0x9dc5('0x18'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x21')]);module[_0x9dc5('0x22')]=router; \ No newline at end of file +var _0xdf10=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','post','addMessage','tracked','fax','faxinteraction:addtags','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x37cd68,_0x394d1f){var _0x3c3090=function(_0x5a2847){while(--_0x5a2847){_0x37cd68['push'](_0x37cd68['shift']());}};_0x3c3090(++_0x394d1f);}(_0xdf10,0x8c));var _0x0df1=function(_0x7df06a,_0x10ee7d){_0x7df06a=_0x7df06a-0x0;var _0x532abf=_0xdf10[_0x7df06a];return _0x532abf;};'use strict';var multer=require(_0x0df1('0x0'));var util=require(_0x0df1('0x1'));var path=require(_0x0df1('0x2'));var timeout=require(_0x0df1('0x3'));var express=require(_0x0df1('0x4'));var router=express['Router']();var fs_extra=require(_0x0df1('0x5'));var auth=require(_0x0df1('0x6'));var interaction=require(_0x0df1('0x7'));var config=require(_0x0df1('0x8'));var controller=require(_0x0df1('0x9'));router[_0x0df1('0xa')]('/',auth[_0x0df1('0xb')](),controller[_0x0df1('0xc')]);router[_0x0df1('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x0df1('0xd')]);router[_0x0df1('0xa')](_0x0df1('0xe'),auth[_0x0df1('0xb')](),controller[_0x0df1('0xf')]);router[_0x0df1('0xa')](_0x0df1('0x10'),auth[_0x0df1('0xb')](),controller['getMessages']);router['get'](_0x0df1('0x11'),auth[_0x0df1('0xb')](),controller['download']);router[_0x0df1('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0df1('0x12')](_0x0df1('0x10'),auth[_0x0df1('0xb')](),controller[_0x0df1('0x13')]);router[_0x0df1('0x12')]('/:id/tags',auth[_0x0df1('0xb')](),interaction[_0x0df1('0x14')](_0x0df1('0x15'),_0x0df1('0x16')),controller['addTags']);router['put'](_0x0df1('0xe'),auth[_0x0df1('0xb')](),interaction['tracked'](_0x0df1('0x15'),'faxinteraction:update'),controller[_0x0df1('0x17')]);router[_0x0df1('0x18')](_0x0df1('0xe'),auth['isAuthenticated'](),interaction[_0x0df1('0x14')](_0x0df1('0x15'),_0x0df1('0x19')),controller['destroy']);router[_0x0df1('0x18')](_0x0df1('0x1a'),auth[_0x0df1('0xb')](),controller[_0x0df1('0x1b')]);module[_0x0df1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6d8c254..d4ac384 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 _0x303a=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0x303a,0x1a0));var _0xa303=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0x303a[_0x3252b1];return _0x5f189d;};'use strict';var Sequelize=require(_0xa303('0x0'));module['exports']={'body':{'type':Sequelize[_0xa303('0x1')](_0xa303('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa303('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa303('0x4')]('in','out'),'defaultValue':_0xa303('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa303('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa303('0x6')]}}; \ No newline at end of file +var _0x684c=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x26effa,_0x205eff){var _0x2a747b=function(_0x33a521){while(--_0x33a521){_0x26effa['push'](_0x26effa['shift']());}};_0x2a747b(++_0x205eff);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc684('0x0'));module[_0xc684('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc684('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc684('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc684('0x4')]('in',_0xc684('0x5')),'defaultValue':_0xc684('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xc684('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 9d57cbc..2982afc 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 _0xa80f=['hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','find','body','describe','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT','motionChannel','rejectmessage','CmContact','findOne','Attachment','FaxAccountId','join','attachments','download','basename','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length'];(function(_0x41074c,_0x268379){var _0xef4759=function(_0x9f5076){while(--_0x9f5076){_0x41074c['push'](_0x41074c['shift']());}};_0xef4759(++_0x268379);}(_0xa80f,0xca));var _0xfa80=function(_0x8f15dd,_0x1b132c){_0x8f15dd=_0x8f15dd-0x0;var _0x6a2868=_0xa80f[_0x8f15dd];return _0x6a2868;};'use strict';var emlformat=require(_0xfa80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa80('0x1'));var jsonpatch=require(_0xfa80('0x2'));var rp=require(_0xfa80('0x3'));var moment=require('moment');var BPromise=require(_0xfa80('0x4'));var Mustache=require(_0xfa80('0x5'));var util=require(_0xfa80('0x6'));var path=require(_0xfa80('0x7'));var sox=require(_0xfa80('0x8'));var csv=require('to-csv');var ejs=require(_0xfa80('0x9'));var fs=require('fs');var fs_extra=require(_0xfa80('0xa'));var _=require(_0xfa80('0xb'));var squel=require(_0xfa80('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa80('0xd'));var deskjs=require(_0xfa80('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa80('0xf'));var Papa=require('papaparse');var Redis=require(_0xfa80('0x10'));var authService=require(_0xfa80('0x11'));var qs=require(_0xfa80('0x12'));var as=require(_0xfa80('0x13'));var hardwareService=require(_0xfa80('0x14'));var logger=require(_0xfa80('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa80('0x16'));var db=require(_0xfa80('0x17'))['db'];config[_0xfa80('0x18')]=_[_0xfa80('0x19')](config[_0xfa80('0x18')],{'host':_0xfa80('0x1a'),'port':0x18eb});var socket=require(_0xfa80('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfa80('0x1c')][_0xfa80('0x1d')]({'port':0x232c});var client9002=jayson[_0xfa80('0x1c')][_0xfa80('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xc9a4b4,_0x213805,_0x3b5884,_0x33df3d){return new BPromise(function(_0x11776d,_0x180204){var _0x45c059=_0x33df3d||client;return _0x45c059[_0xfa80('0x1e')](_0xc9a4b4,_0x3b5884)[_0xfa80('0x1f')](function(_0x6e56f7){logger['info']('FaxMessage,\x20%s,\x20%s',_0x213805,_0xfa80('0x20'));logger[_0xfa80('0x21')](_0xfa80('0x22'),_0x213805,_0xfa80('0x20'),JSON[_0xfa80('0x23')](_0x6e56f7));if(_0x6e56f7[_0xfa80('0x24')]){if(_0x6e56f7['error'][_0xfa80('0x25')]===0x1f4){logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x6e56f7['error'][_0xfa80('0x27')]);return _0x180204(_0x6e56f7[_0xfa80('0x24')]['message']);}logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x6e56f7['error']['message']);return _0x11776d(_0x6e56f7[_0xfa80('0x24')][_0xfa80('0x27')]);}else{logger[_0xfa80('0x28')](_0xfa80('0x26'),_0x213805,_0xfa80('0x20'));_0x11776d(_0x6e56f7[_0xfa80('0x29')][_0xfa80('0x27')]);}})[_0xfa80('0x2a')](function(_0x1a26e6){logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x1a26e6);_0x180204(_0x1a26e6);});});}function respondWithStatusCode(_0x311ee7,_0x457fea){_0x457fea=_0x457fea||0xcc;return function(_0x2edf6f){if(_0x2edf6f){return _0x311ee7[_0xfa80('0x2b')](_0x457fea);}return _0x311ee7[_0xfa80('0x2c')](_0x457fea)['end']();};}function respondWithResult(_0x24dcf4,_0x505a41){_0x505a41=_0x505a41||0xc8;return function(_0x381897){if(_0x381897){return _0x24dcf4[_0xfa80('0x2c')](_0x505a41)[_0xfa80('0x2d')](_0x381897);}};}function respondWithFilteredResult(_0x1188ae,_0x3f2c8b){return function(_0x254879){if(_0x254879){var _0xffddba=typeof _0x3f2c8b[_0xfa80('0x2e')]===_0xfa80('0x2f')&&typeof _0x3f2c8b['limit']===_0xfa80('0x2f');var _0x4165e3=_0x254879[_0xfa80('0x30')];var _0x4ad10d=_0xffddba?0x0:_0x3f2c8b[_0xfa80('0x2e')];var _0x187c08=_0xffddba?_0x254879[_0xfa80('0x30')]:_0x3f2c8b[_0xfa80('0x2e')]+_0x3f2c8b[_0xfa80('0x31')];var _0x4f953a;if(_0x187c08>=_0x4165e3){_0x187c08=_0x4165e3;_0x4f953a=0xc8;}else{_0x4f953a=0xce;}_0x1188ae[_0xfa80('0x2c')](_0x4f953a);return _0x1188ae[_0xfa80('0x32')]('Content-Range',_0x4ad10d+'-'+_0x187c08+'/'+_0x4165e3)[_0xfa80('0x2d')](_0x254879);}return null;};}function patchUpdates(_0x1df022){return function(_0x6878ee){try{jsonpatch[_0xfa80('0x33')](_0x6878ee,_0x1df022,!![]);}catch(_0x491d13){return BPromise['reject'](_0x491d13);}return _0x6878ee['save']();};}function saveUpdates(_0x458185,_0x6804b6){return function(_0x58d8ce){if(_0x58d8ce){return _0x58d8ce[_0xfa80('0x34')](_0x458185)['then'](function(_0x3fdc4e){return _0x3fdc4e;});}return null;};}function removeEntity(_0x1bc845,_0x371b75){return function(_0x367435){if(_0x367435){return _0x367435[_0xfa80('0x35')]()[_0xfa80('0x1f')](function(){_0x1bc845['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe4d34,_0x203e9e){return function(_0x2a973b){if(!_0x2a973b){_0xfe4d34[_0xfa80('0x2b')](0x194);}return _0x2a973b;};}function handleError(_0x1a037c,_0x473041){_0x473041=_0x473041||0x1f4;return function(_0x35e6b8){logger[_0xfa80('0x24')](_0x35e6b8[_0xfa80('0x36')]);if(_0x35e6b8[_0xfa80('0x37')]){delete _0x35e6b8[_0xfa80('0x37')];}_0x1a037c[_0xfa80('0x2c')](_0x473041)[_0xfa80('0x38')](_0x35e6b8);};}exports[_0xfa80('0x39')]=function(_0x582737,_0x3a764c){var _0x1b1f2f={},_0x4e64cb={},_0x117965={'count':0x0,'rows':[]};var _0x23d250=_[_0xfa80('0x3a')](db[_0xfa80('0x3b')][_0xfa80('0x3c')],function(_0xe8cdc9){return{'name':_0xe8cdc9[_0xfa80('0x3d')],'type':_0xe8cdc9[_0xfa80('0x3e')][_0xfa80('0x3f')]};});_0x4e64cb[_0xfa80('0x40')]=_[_0xfa80('0x3a')](_0x23d250,_0xfa80('0x37'));_0x4e64cb['query']=_[_0xfa80('0x41')](_0x582737['query']);_0x4e64cb[_0xfa80('0x42')]=_[_0xfa80('0x43')](_0x4e64cb[_0xfa80('0x40')],_0x4e64cb['query']);_0x1b1f2f[_0xfa80('0x44')]=_[_0xfa80('0x43')](_0x4e64cb[_0xfa80('0x40')],qs['fields'](_0x582737[_0xfa80('0x45')][_0xfa80('0x46')]));_0x1b1f2f[_0xfa80('0x44')]=_0x1b1f2f['attributes'][_0xfa80('0x47')]?_0x1b1f2f[_0xfa80('0x44')]:_0x4e64cb[_0xfa80('0x40')];if(!_0x582737[_0xfa80('0x45')][_0xfa80('0x48')]('nolimit')){_0x1b1f2f[_0xfa80('0x31')]=qs[_0xfa80('0x31')](_0x582737['query'][_0xfa80('0x31')]);_0x1b1f2f[_0xfa80('0x2e')]=qs[_0xfa80('0x2e')](_0x582737[_0xfa80('0x45')][_0xfa80('0x2e')]);}_0x1b1f2f[_0xfa80('0x49')]=qs[_0xfa80('0x4a')](_0x582737[_0xfa80('0x45')][_0xfa80('0x4a')]);_0x1b1f2f[_0xfa80('0x4b')]=qs[_0xfa80('0x42')](_[_0xfa80('0x4c')](_0x582737['query'],_0x4e64cb[_0xfa80('0x42')]),_0x23d250);if(_0x582737[_0xfa80('0x45')][_0xfa80('0x4d')]){_0x1b1f2f[_0xfa80('0x4b')]=_[_0xfa80('0x4e')](_0x1b1f2f['where'],{'$or':_[_0xfa80('0x3a')](_0x23d250,function(_0x3ef12f){if(_0x3ef12f[_0xfa80('0x3e')]!=='VIRTUAL'){var _0x4b5cc9={};_0x4b5cc9[_0x3ef12f[_0xfa80('0x37')]]={'$like':'%'+_0x582737['query'][_0xfa80('0x4d')]+'%'};return _0x4b5cc9;}})});}_0x1b1f2f=_[_0xfa80('0x4e')]({},_0x1b1f2f,_0x582737[_0xfa80('0x4f')]);var _0x194fb4={'where':_0x1b1f2f[_0xfa80('0x4b')]};return db[_0xfa80('0x3b')][_0xfa80('0x30')](_0x194fb4)[_0xfa80('0x1f')](function(_0xa6dd60){_0x117965[_0xfa80('0x30')]=_0xa6dd60;if(_0x582737[_0xfa80('0x45')]['includeAll']){_0x1b1f2f[_0xfa80('0x50')]=[{'all':!![]}];}return db[_0xfa80('0x3b')][_0xfa80('0x51')](_0x1b1f2f);})['then'](function(_0x1b0c62){_0x117965[_0xfa80('0x52')]=_0x1b0c62;return _0x117965;})[_0xfa80('0x1f')](respondWithFilteredResult(_0x3a764c,_0x1b1f2f))[_0xfa80('0x2a')](handleError(_0x3a764c,null));};exports['show']=function(_0x1910c3,_0x175c15){var _0x3364a9={'raw':!![],'where':{'id':_0x1910c3[_0xfa80('0x53')]['id']}},_0x10b4a7={};_0x10b4a7[_0xfa80('0x40')]=_['keys'](db[_0xfa80('0x3b')][_0xfa80('0x3c')]);_0x10b4a7[_0xfa80('0x45')]=_[_0xfa80('0x41')](_0x1910c3[_0xfa80('0x45')]);_0x10b4a7[_0xfa80('0x42')]=_[_0xfa80('0x43')](_0x10b4a7[_0xfa80('0x40')],_0x10b4a7[_0xfa80('0x45')]);_0x3364a9[_0xfa80('0x44')]=_[_0xfa80('0x43')](_0x10b4a7[_0xfa80('0x40')],qs[_0xfa80('0x46')](_0x1910c3[_0xfa80('0x45')][_0xfa80('0x46')]));_0x3364a9['attributes']=_0x3364a9[_0xfa80('0x44')][_0xfa80('0x47')]?_0x3364a9[_0xfa80('0x44')]:_0x10b4a7['model'];if(_0x1910c3[_0xfa80('0x45')]['includeAll']){_0x3364a9[_0xfa80('0x50')]=[{'all':!![]}];}_0x3364a9=_[_0xfa80('0x4e')]({},_0x3364a9,_0x1910c3[_0xfa80('0x4f')]);return db[_0xfa80('0x3b')][_0xfa80('0x54')](_0x3364a9)[_0xfa80('0x1f')](handleEntityNotFound(_0x175c15,null))[_0xfa80('0x1f')](respondWithResult(_0x175c15,null))[_0xfa80('0x2a')](handleError(_0x175c15,null));};exports[_0xfa80('0x34')]=function(_0x64c06d,_0x53cb45){if(_0x64c06d[_0xfa80('0x55')]['id']){delete _0x64c06d[_0xfa80('0x55')]['id'];}return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x64c06d[_0xfa80('0x53')]['id']}})[_0xfa80('0x1f')](handleEntityNotFound(_0x53cb45,null))[_0xfa80('0x1f')](saveUpdates(_0x64c06d['body'],null))[_0xfa80('0x1f')](respondWithResult(_0x53cb45,null))[_0xfa80('0x2a')](handleError(_0x53cb45,null));};exports[_0xfa80('0x35')]=function(_0xfd7b0b,_0x3aaa4e){return db[_0xfa80('0x3b')]['find']({'where':{'id':_0xfd7b0b['params']['id']}})[_0xfa80('0x1f')](handleEntityNotFound(_0x3aaa4e,null))[_0xfa80('0x1f')](removeEntity(_0x3aaa4e,null))[_0xfa80('0x2a')](handleError(_0x3aaa4e,null));};exports[_0xfa80('0x56')]=function(_0x20d72a,_0x416bda){return db[_0xfa80('0x3b')][_0xfa80('0x56')]()[_0xfa80('0x1f')](respondWithResult(_0x416bda,null))[_0xfa80('0x2a')](handleError(_0x416bda,null));};var interaction_log=require(_0xfa80('0x15'))('fax-interactions');exports[_0xfa80('0x57')]=function(_0x571b7a,_0x36b734,_0x33c15a){var _0x36a0b8={'agent':{},'channel':_0xfa80('0x58')};if(_0x571b7a[_0xfa80('0x55')]['id']){delete _0x571b7a['body']['id'];}_0x571b7a[_0xfa80('0x55')]['read']=!![];_0x571b7a['body'][_0xfa80('0x59')]=moment()[_0xfa80('0x5a')](_0xfa80('0x5b'));_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')]=_0x571b7a['body'][_0xfa80('0x5c')]||_0x571b7a[_0xfa80('0x5d')]['id'];_0x36a0b8[_0xfa80('0x5e')]['id']=_0x571b7a['body'][_0xfa80('0x5c')];return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x571b7a['params']['id'],'UserId':null}})[_0xfa80('0x1f')](handleEntityNotFound(_0x36b734,null))[_0xfa80('0x1f')](saveUpdates(_0x571b7a[_0xfa80('0x55')],null))[_0xfa80('0x1f')](function(_0xd552b2){if(_0xd552b2){_0x36a0b8['message']=_0xd552b2[_0xfa80('0x5f')]({'plain':!![]});return db[_0xfa80('0x60')][_0xfa80('0x54')]({'where':{'id':_0xd552b2['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x36b734,null))['then'](function(_0x3ef48f){if(_0x3ef48f){return _0x3ef48f['update']({'UserId':_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')],'read1stAt':_[_0xfa80('0x61')](_0x3ef48f[_0xfa80('0x62')])?moment()[_0xfa80('0x5a')](_0xfa80('0x5b')):undefined});}return null;})[_0xfa80('0x1f')](function(_0x5e0679){if(_0x5e0679){_0x36a0b8[_0xfa80('0x63')]=_0x5e0679['get']({'plain':!![]});interaction_log[_0xfa80('0x28')](_0xfa80('0x64'),_0x571b7a[_0xfa80('0x5d')]['id'],_0x571b7a[_0xfa80('0x5d')][_0xfa80('0x37')],_0x571b7a[_0xfa80('0x5d')][_0xfa80('0x65')],_0x36a0b8[_0xfa80('0x63')]['id'],_0x571b7a['body']?JSON[_0xfa80('0x23')](_0x571b7a[_0xfa80('0x55')]):'null');return respondWithRpcPromise(_0xfa80('0x66'),_0xfa80('0x67'),_0x36a0b8);}return null;})[_0xfa80('0x1f')](function(_0x270766){var _0x47f533=_0xfa80('0x68')+_0x270766[_0xfa80('0x27')][_0xfa80('0x69')];return db['sequelize'][_0xfa80('0x45')](_0x47f533,{'type':db[_0xfa80('0x6a')][_0xfa80('0x6b')]['SELECT'],'raw':!![]})[_0xfa80('0x1f')](function(_0x16c282){return _0x16c282;});})['then'](function(_0x454418){if(_0x454418){_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x6c')]=_0x454418[0x0];if(!_0x571b7a[_0xfa80('0x55')]['UserId'])return;return db[_0xfa80('0x6d')][_0xfa80('0x54')]({'where':{'id':_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')],'role':_0xfa80('0x5e')},'attributes':['id',_0xfa80('0x37'),_0xfa80('0x6e'),_0xfa80('0x6f'),_0xfa80('0x70')],'raw':!![]});}return null;})[_0xfa80('0x1f')](function(_0x107208){if(!_0x107208)return null;_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x5e')]=_0x107208;return _0x36a0b8;})[_0xfa80('0x1f')](function(_0x58b41c){if(_0x58b41c){if(_0x571b7a[_0xfa80('0x55')][_0xfa80('0x71')]){_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x72')]=util[_0xfa80('0x5a')](_0xfa80('0x73'),_0x571b7a[_0xfa80('0x5d')]['name']);_0x36a0b8['message']['channel']=_0x36a0b8[_0xfa80('0x74')];_0x36a0b8['message']['motionChannel']=_0x36a0b8[_0xfa80('0x74')];_0x36a0b8['message'][_0xfa80('0x75')]=_0xfa80('0x57');return respondWithRpcPromise(_0xfa80('0x76'),_0xfa80('0x76'),{'event':_0xfa80('0x77'),'message':_0x36a0b8[_0xfa80('0x27')]},client9002)[_0xfa80('0x1f')](function(){return _0x36a0b8;});}return _0x36a0b8;}return null;})[_0xfa80('0x1f')](respondWithResult(_0x36b734,null))[_0xfa80('0x2a')](handleError(_0x36b734,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xfa80('0x78')]=function(_0x5982b4,_0xadf09b,_0x1f84e1){var _0x52bc9a={'agent':{},'channel':'fax'};if(_0x5982b4[_0xfa80('0x55')]['id']){delete _0x5982b4[_0xfa80('0x55')]['id'];}_0x5982b4['body'][_0xfa80('0x5c')]=_0x5982b4['body'][_0xfa80('0x5c')]||_0x5982b4[_0xfa80('0x5d')]['id'];_0x52bc9a['agent']['id']=_0x5982b4[_0xfa80('0x55')]['UserId'];return db['FaxMessage'][_0xfa80('0x54')]({'where':{'id':_0x5982b4[_0xfa80('0x53')]['id'],'UserId':null}})[_0xfa80('0x1f')](handleEntityNotFound(_0xadf09b,null))[_0xfa80('0x1f')](function(_0x22a503){if(_0x22a503){_0x52bc9a[_0xfa80('0x27')]=_0x22a503[_0xfa80('0x5f')]({'plain':!![]});return db[_0xfa80('0x60')][_0xfa80('0x54')]({'where':{'id':_0x22a503[_0xfa80('0x79')]}});}return null;})['then'](handleEntityNotFound(_0xadf09b,null))[_0xfa80('0x1f')](function(_0x3557b2){if(_0x3557b2){_0x52bc9a['interaction']=_0x3557b2['get']({'plain':!![]});interaction_log[_0xfa80('0x28')](_0xfa80('0x7a'),_0x5982b4[_0xfa80('0x5d')]['id'],_0x5982b4[_0xfa80('0x5d')][_0xfa80('0x37')],_0x5982b4['user']['role'],_0x52bc9a[_0xfa80('0x63')]['id'],_0x5982b4[_0xfa80('0x55')]?JSON[_0xfa80('0x23')](_0x5982b4[_0xfa80('0x55')]):_0xfa80('0x7b'));return respondWithRpcPromise(_0xfa80('0x7c'),_0xfa80('0x7d'),_0x52bc9a);}return null;})['then'](function(_0x3778f6){var _0x43f8a1=_0xfa80('0x68')+_0x3778f6[_0xfa80('0x27')][_0xfa80('0x69')];return db['sequelize']['query'](_0x43f8a1,{'type':db[_0xfa80('0x6a')][_0xfa80('0x6b')][_0xfa80('0x7e')],'raw':!![]})['then'](function(_0x56f726){return _0x56f726;});})[_0xfa80('0x1f')](function(_0x5462bd){if(_0x5462bd){_0x52bc9a[_0xfa80('0x27')][_0xfa80('0x6c')]=_0x5462bd[0x0];if(!_0x5982b4[_0xfa80('0x55')][_0xfa80('0x5c')])return;return db['User'][_0xfa80('0x54')]({'where':{'id':_0x5982b4['body'][_0xfa80('0x5c')],'role':_0xfa80('0x5e')},'attributes':['id',_0xfa80('0x37'),'fullname',_0xfa80('0x6f'),_0xfa80('0x70')],'raw':!![]});}return null;})[_0xfa80('0x1f')](function(_0x12a565){if(!_0x12a565)return null;_0x52bc9a[_0xfa80('0x27')][_0xfa80('0x5e')]=_0x12a565;return _0x52bc9a;})[_0xfa80('0x1f')](function(_0x5ad1d5){if(_0x5ad1d5){_0x5ad1d5['message']['interface']=util[_0xfa80('0x5a')](_0xfa80('0x73'),_0x5982b4['user'][_0xfa80('0x37')]);_0x5ad1d5[_0xfa80('0x27')][_0xfa80('0x74')]=_0x52bc9a[_0xfa80('0x74')];_0x5ad1d5['message'][_0xfa80('0x7f')]=_0x52bc9a[_0xfa80('0x74')];_0x5ad1d5[_0xfa80('0x27')][_0xfa80('0x75')]=_0xfa80('0x78');respondWithRpcPromise(_0xfa80('0x76'),'EventManager',{'event':_0xfa80('0x80'),'message':_0x5ad1d5[_0xfa80('0x27')]},client9002);return _0x52bc9a;}return null;})[_0xfa80('0x1f')](respondWithResult(_0xadf09b,null))[_0xfa80('0x2a')](handleError(_0xadf09b,null));};exports['create']=function(_0x8d3501,_0x3605f7){var _0x2023e3;return db[_0xfa80('0x3b')]['create'](_0x8d3501[_0xfa80('0x55')],{})[_0xfa80('0x1f')](function(_0x3ff55c){_0x2023e3=_0x3ff55c;return db[_0xfa80('0x81')][_0xfa80('0x82')]({'where':{'id':_0x2023e3[_0xfa80('0x69')]}});})[_0xfa80('0x1f')](function(_0x459632){if(_[_0xfa80('0x61')](_0x459632)){return;}else{_0x2023e3[_0xfa80('0x58')]=_0x459632[_0xfa80('0x58')];return db[_0xfa80('0x83')]['findOne']({'where':{'id':_0x2023e3['AttachmentId']}});}})[_0xfa80('0x1f')](function(_0x2968e7){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xfa80('0x61')](_0x8d3501['body'])?undefined:_0x8d3501[_0xfa80('0x55')][_0xfa80('0x84')],'path':_[_0xfa80('0x61')](_0x2968e7)?undefined:util[_0xfa80('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x2968e7['basename']),'fax':_['isNil'](_0x2023e3[_0xfa80('0x58')])?undefined:_0x2023e3[_0xfa80('0x58')],'AttachmentId':_0x2023e3['AttachmentId']},client9002);})[_0xfa80('0x1f')](respondWithResult(_0x3605f7,0xc9))['catch'](handleError(_0x3605f7,null));};exports['download']=function(_0x5ad7db,_0x7356f6){var _0x1e09b6=path[_0xfa80('0x85')](config['root'],'server','files',_0xfa80('0x86'));return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x5ad7db[_0xfa80('0x53')]['id']},'include':[{'model':db[_0xfa80('0x83')],'as':_0xfa80('0x83')}]})[_0xfa80('0x1f')](handleEntityNotFound(_0x7356f6,null))[_0xfa80('0x1f')](function(_0x168272){if(_0x168272){return _0x7356f6[_0xfa80('0x87')](path[_0xfa80('0x85')](_0x1e09b6,_0x168272[_0xfa80('0x83')][_0xfa80('0x88')]));}})[_0xfa80('0x2a')](handleError(_0x7356f6,null));}; \ No newline at end of file +var _0xc5df=['find','body','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize','interface','rejectmessage','CmContact','findOne','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','server','attachments','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','intersection','include'];(function(_0x5dbb08,_0x34050e){var _0x10acdd=function(_0x22a538){while(--_0x22a538){_0x5dbb08['push'](_0x5dbb08['shift']());}};_0x10acdd(++_0x34050e);}(_0xc5df,0x14d));var _0xfc5d=function(_0x3d8c62,_0x107316){_0x3d8c62=_0x3d8c62-0x0;var _0x31deec=_0xc5df[_0x3d8c62];return _0x31deec;};'use strict';var emlformat=require(_0xfc5d('0x0'));var rimraf=require(_0xfc5d('0x1'));var zipdir=require(_0xfc5d('0x2'));var jsonpatch=require(_0xfc5d('0x3'));var rp=require(_0xfc5d('0x4'));var moment=require(_0xfc5d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc5d('0x6'));var util=require(_0xfc5d('0x7'));var path=require('path');var sox=require(_0xfc5d('0x8'));var csv=require(_0xfc5d('0x9'));var ejs=require(_0xfc5d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc5d('0xb'));var crypto=require(_0xfc5d('0xc'));var jsforce=require(_0xfc5d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0x9'));var querystring=require(_0xfc5d('0xe'));var Papa=require(_0xfc5d('0xf'));var Redis=require(_0xfc5d('0x10'));var authService=require(_0xfc5d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5d('0x13'))(_0xfc5d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc5d('0x15'))['db'];config[_0xfc5d('0x16')]=_['defaults'](config[_0xfc5d('0x16')],{'host':_0xfc5d('0x17'),'port':0x18eb});var socket=require(_0xfc5d('0x18'))(new Redis(config[_0xfc5d('0x16')]));require('./faxMessage.socket')[_0xfc5d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfc5d('0x1a')]({'port':0x232c});var client9002=jayson[_0xfc5d('0x1b')][_0xfc5d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x30035b,_0x2bfeeb,_0x5736d3,_0x2399f4){return new BPromise(function(_0x45445d,_0x1e52a4){var _0x7f857b=_0x2399f4||client;return _0x7f857b[_0xfc5d('0x1c')](_0x30035b,_0x5736d3)['then'](function(_0x438cff){logger[_0xfc5d('0x1d')](_0xfc5d('0x1e'),_0x2bfeeb,_0xfc5d('0x1f'));logger[_0xfc5d('0x20')](_0xfc5d('0x21'),_0x2bfeeb,_0xfc5d('0x1f'),JSON['stringify'](_0x438cff));if(_0x438cff[_0xfc5d('0x22')]){if(_0x438cff[_0xfc5d('0x22')][_0xfc5d('0x23')]===0x1f4){logger[_0xfc5d('0x22')](_0xfc5d('0x1e'),_0x2bfeeb,_0x438cff[_0xfc5d('0x22')][_0xfc5d('0x24')]);return _0x1e52a4(_0x438cff[_0xfc5d('0x22')]['message']);}logger[_0xfc5d('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2bfeeb,_0x438cff[_0xfc5d('0x22')]['message']);return _0x45445d(_0x438cff[_0xfc5d('0x22')][_0xfc5d('0x24')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2bfeeb,_0xfc5d('0x1f'));_0x45445d(_0x438cff['result'][_0xfc5d('0x24')]);}})[_0xfc5d('0x25')](function(_0x57d1ea){logger[_0xfc5d('0x22')](_0xfc5d('0x1e'),_0x2bfeeb,_0x57d1ea);_0x1e52a4(_0x57d1ea);});});}function respondWithStatusCode(_0x2c4e2c,_0x185634){_0x185634=_0x185634||0xcc;return function(_0x15152e){if(_0x15152e){return _0x2c4e2c[_0xfc5d('0x26')](_0x185634);}return _0x2c4e2c[_0xfc5d('0x27')](_0x185634)[_0xfc5d('0x28')]();};}function respondWithResult(_0x3ed8e5,_0x2a8460){_0x2a8460=_0x2a8460||0xc8;return function(_0x18a64e){if(_0x18a64e){return _0x3ed8e5[_0xfc5d('0x27')](_0x2a8460)[_0xfc5d('0x29')](_0x18a64e);}};}function respondWithFilteredResult(_0x580e88,_0xc4bc6e){return function(_0x46800c){if(_0x46800c){var _0x5c31fa=typeof _0xc4bc6e['offset']===_0xfc5d('0x2a')&&typeof _0xc4bc6e[_0xfc5d('0x2b')]===_0xfc5d('0x2a');var _0x404703=_0x46800c[_0xfc5d('0x2c')];var _0xc4ba8f=_0x5c31fa?0x0:_0xc4bc6e[_0xfc5d('0x2d')];var _0x4c1d43=_0x5c31fa?_0x46800c[_0xfc5d('0x2c')]:_0xc4bc6e[_0xfc5d('0x2d')]+_0xc4bc6e['limit'];var _0x45a710;if(_0x4c1d43>=_0x404703){_0x4c1d43=_0x404703;_0x45a710=0xc8;}else{_0x45a710=0xce;}_0x580e88[_0xfc5d('0x27')](_0x45a710);return _0x580e88[_0xfc5d('0x2e')](_0xfc5d('0x2f'),_0xc4ba8f+'-'+_0x4c1d43+'/'+_0x404703)[_0xfc5d('0x29')](_0x46800c);}return null;};}function patchUpdates(_0x2ae3cd){return function(_0xda7ce){try{jsonpatch['apply'](_0xda7ce,_0x2ae3cd,!![]);}catch(_0x5180d5){return BPromise[_0xfc5d('0x30')](_0x5180d5);}return _0xda7ce[_0xfc5d('0x31')]();};}function saveUpdates(_0x5dfcac,_0xcf8b58){return function(_0xeffe74){if(_0xeffe74){return _0xeffe74[_0xfc5d('0x32')](_0x5dfcac)[_0xfc5d('0x33')](function(_0x14249b){return _0x14249b;});}return null;};}function removeEntity(_0x252245,_0xe85219){return function(_0xcad453){if(_0xcad453){return _0xcad453[_0xfc5d('0x34')]()[_0xfc5d('0x33')](function(){_0x252245[_0xfc5d('0x27')](0xcc)[_0xfc5d('0x28')]();});}};}function handleEntityNotFound(_0x11dfa1,_0x501251){return function(_0xc9bd84){if(!_0xc9bd84){_0x11dfa1['sendStatus'](0x194);}return _0xc9bd84;};}function handleError(_0xc88154,_0x5cb887){_0x5cb887=_0x5cb887||0x1f4;return function(_0x13cbfa){logger[_0xfc5d('0x22')](_0x13cbfa[_0xfc5d('0x35')]);if(_0x13cbfa[_0xfc5d('0x36')]){delete _0x13cbfa[_0xfc5d('0x36')];}_0xc88154[_0xfc5d('0x27')](_0x5cb887)['send'](_0x13cbfa);};}exports[_0xfc5d('0x37')]=function(_0x53c37c,_0x597a76){var _0x235f13={},_0x316a5c={},_0x55b6cc={'count':0x0,'rows':[]};var _0x430a67=_[_0xfc5d('0x38')](db[_0xfc5d('0x39')][_0xfc5d('0x3a')],function(_0x367d1b){return{'name':_0x367d1b[_0xfc5d('0x3b')],'type':_0x367d1b[_0xfc5d('0x3c')]['key']};});_0x316a5c['model']=_[_0xfc5d('0x38')](_0x430a67,_0xfc5d('0x36'));_0x316a5c[_0xfc5d('0x3d')]=_['keys'](_0x53c37c[_0xfc5d('0x3d')]);_0x316a5c[_0xfc5d('0x3e')]=_['intersection'](_0x316a5c[_0xfc5d('0x3f')],_0x316a5c['query']);_0x235f13[_0xfc5d('0x40')]=_['intersection'](_0x316a5c['model'],qs[_0xfc5d('0x41')](_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x41')]));_0x235f13[_0xfc5d('0x40')]=_0x235f13[_0xfc5d('0x40')]['length']?_0x235f13['attributes']:_0x316a5c[_0xfc5d('0x3f')];if(!_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x42')](_0xfc5d('0x43'))){_0x235f13[_0xfc5d('0x2b')]=qs[_0xfc5d('0x2b')](_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x2b')]);_0x235f13[_0xfc5d('0x2d')]=qs['offset'](_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x2d')]);}_0x235f13[_0xfc5d('0x44')]=qs[_0xfc5d('0x45')](_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x45')]);_0x235f13[_0xfc5d('0x46')]=qs['filters'](_[_0xfc5d('0x47')](_0x53c37c[_0xfc5d('0x3d')],_0x316a5c[_0xfc5d('0x3e')]),_0x430a67);if(_0x53c37c['query'][_0xfc5d('0x48')]){_0x235f13[_0xfc5d('0x46')]=_[_0xfc5d('0x49')](_0x235f13[_0xfc5d('0x46')],{'$or':_[_0xfc5d('0x38')](_0x430a67,function(_0x385b67){if(_0x385b67[_0xfc5d('0x3c')]!==_0xfc5d('0x4a')){var _0x4c6000={};_0x4c6000[_0x385b67[_0xfc5d('0x36')]]={'$like':'%'+_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x48')]+'%'};return _0x4c6000;}})});}_0x235f13=_[_0xfc5d('0x49')]({},_0x235f13,_0x53c37c[_0xfc5d('0x4b')]);var _0x2c29a6={'where':_0x235f13[_0xfc5d('0x46')]};return db['FaxMessage'][_0xfc5d('0x2c')](_0x2c29a6)['then'](function(_0x542173){_0x55b6cc[_0xfc5d('0x2c')]=_0x542173;if(_0x53c37c[_0xfc5d('0x3d')][_0xfc5d('0x4c')]){_0x235f13['include']=[{'all':!![]}];}return db[_0xfc5d('0x39')][_0xfc5d('0x4d')](_0x235f13);})['then'](function(_0x2f4682){_0x55b6cc[_0xfc5d('0x4e')]=_0x2f4682;return _0x55b6cc;})[_0xfc5d('0x33')](respondWithFilteredResult(_0x597a76,_0x235f13))[_0xfc5d('0x25')](handleError(_0x597a76,null));};exports[_0xfc5d('0x4f')]=function(_0x5166af,_0x10f031){var _0x4bf918={'raw':!![],'where':{'id':_0x5166af[_0xfc5d('0x50')]['id']}},_0x539ec5={};_0x539ec5[_0xfc5d('0x3f')]=_[_0xfc5d('0x51')](db[_0xfc5d('0x39')][_0xfc5d('0x3a')]);_0x539ec5[_0xfc5d('0x3d')]=_[_0xfc5d('0x51')](_0x5166af[_0xfc5d('0x3d')]);_0x539ec5[_0xfc5d('0x3e')]=_[_0xfc5d('0x52')](_0x539ec5[_0xfc5d('0x3f')],_0x539ec5[_0xfc5d('0x3d')]);_0x4bf918['attributes']=_[_0xfc5d('0x52')](_0x539ec5[_0xfc5d('0x3f')],qs[_0xfc5d('0x41')](_0x5166af['query'][_0xfc5d('0x41')]));_0x4bf918[_0xfc5d('0x40')]=_0x4bf918[_0xfc5d('0x40')]['length']?_0x4bf918['attributes']:_0x539ec5[_0xfc5d('0x3f')];if(_0x5166af[_0xfc5d('0x3d')]['includeAll']){_0x4bf918[_0xfc5d('0x53')]=[{'all':!![]}];}_0x4bf918=_[_0xfc5d('0x49')]({},_0x4bf918,_0x5166af[_0xfc5d('0x4b')]);return db[_0xfc5d('0x39')][_0xfc5d('0x54')](_0x4bf918)[_0xfc5d('0x33')](handleEntityNotFound(_0x10f031,null))[_0xfc5d('0x33')](respondWithResult(_0x10f031,null))['catch'](handleError(_0x10f031,null));};exports[_0xfc5d('0x32')]=function(_0x119e07,_0x18495a){if(_0x119e07[_0xfc5d('0x55')]['id']){delete _0x119e07[_0xfc5d('0x55')]['id'];}return db[_0xfc5d('0x39')][_0xfc5d('0x54')]({'where':{'id':_0x119e07[_0xfc5d('0x50')]['id']}})['then'](handleEntityNotFound(_0x18495a,null))[_0xfc5d('0x33')](saveUpdates(_0x119e07[_0xfc5d('0x55')],null))[_0xfc5d('0x33')](respondWithResult(_0x18495a,null))['catch'](handleError(_0x18495a,null));};exports[_0xfc5d('0x34')]=function(_0x2af663,_0x20125a){return db[_0xfc5d('0x39')][_0xfc5d('0x54')]({'where':{'id':_0x2af663['params']['id']}})[_0xfc5d('0x33')](handleEntityNotFound(_0x20125a,null))[_0xfc5d('0x33')](removeEntity(_0x20125a,null))[_0xfc5d('0x25')](handleError(_0x20125a,null));};exports[_0xfc5d('0x56')]=function(_0x3afb0b,_0x134eb6){return db[_0xfc5d('0x39')][_0xfc5d('0x56')]()[_0xfc5d('0x33')](respondWithResult(_0x134eb6,null))[_0xfc5d('0x25')](handleError(_0x134eb6,null));};var interaction_log=require(_0xfc5d('0x13'))(_0xfc5d('0x57'));exports[_0xfc5d('0x58')]=function(_0x53335a,_0x488ef9,_0x46b0df){var _0x3f7d42={'agent':{},'channel':_0xfc5d('0x59')};if(_0x53335a[_0xfc5d('0x55')]['id']){delete _0x53335a['body']['id'];}_0x53335a[_0xfc5d('0x55')]['read']=!![];_0x53335a[_0xfc5d('0x55')]['readAt']=moment()[_0xfc5d('0x5a')](_0xfc5d('0x5b'));_0x53335a[_0xfc5d('0x55')][_0xfc5d('0x5c')]=_0x53335a['body']['UserId']||_0x53335a['user']['id'];_0x3f7d42[_0xfc5d('0x5d')]['id']=_0x53335a['body'][_0xfc5d('0x5c')];return db[_0xfc5d('0x39')]['find']({'where':{'id':_0x53335a[_0xfc5d('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x488ef9,null))[_0xfc5d('0x33')](saveUpdates(_0x53335a[_0xfc5d('0x55')],null))[_0xfc5d('0x33')](function(_0x379300){if(_0x379300){_0x3f7d42[_0xfc5d('0x24')]=_0x379300[_0xfc5d('0x5e')]({'plain':!![]});return db[_0xfc5d('0x5f')][_0xfc5d('0x54')]({'where':{'id':_0x379300[_0xfc5d('0x60')]}});}return null;})[_0xfc5d('0x33')](handleEntityNotFound(_0x488ef9,null))[_0xfc5d('0x33')](function(_0x2b50b4){if(_0x2b50b4){return _0x2b50b4[_0xfc5d('0x32')]({'UserId':_0x53335a[_0xfc5d('0x55')][_0xfc5d('0x5c')],'read1stAt':_[_0xfc5d('0x61')](_0x2b50b4['read1stAt'])?moment()[_0xfc5d('0x5a')](_0xfc5d('0x5b')):undefined});}return null;})[_0xfc5d('0x33')](function(_0x4e4b6b){if(_0x4e4b6b){_0x3f7d42[_0xfc5d('0x62')]=_0x4e4b6b[_0xfc5d('0x5e')]({'plain':!![]});interaction_log[_0xfc5d('0x1d')](_0xfc5d('0x63'),_0x53335a[_0xfc5d('0x64')]['id'],_0x53335a['user'][_0xfc5d('0x36')],_0x53335a[_0xfc5d('0x64')][_0xfc5d('0x65')],_0x3f7d42[_0xfc5d('0x62')]['id'],_0x53335a[_0xfc5d('0x55')]?JSON[_0xfc5d('0x66')](_0x53335a[_0xfc5d('0x55')]):'null');return respondWithRpcPromise(_0xfc5d('0x67'),_0xfc5d('0x68'),_0x3f7d42);}return null;})[_0xfc5d('0x33')](function(_0x4e1890){var _0x5460f6=_0xfc5d('0x69')+_0x4e1890[_0xfc5d('0x24')]['ContactId'];return db[_0xfc5d('0x6a')]['query'](_0x5460f6,{'type':db['Sequelize'][_0xfc5d('0x6b')][_0xfc5d('0x6c')],'raw':!![]})[_0xfc5d('0x33')](function(_0x293d78){return _0x293d78;});})[_0xfc5d('0x33')](function(_0x2dd74b){if(_0x2dd74b){_0x3f7d42[_0xfc5d('0x24')]['contact']=_0x2dd74b[0x0];if(!_0x53335a[_0xfc5d('0x55')][_0xfc5d('0x5c')])return;return db[_0xfc5d('0x6d')][_0xfc5d('0x54')]({'where':{'id':_0x53335a['body'][_0xfc5d('0x5c')],'role':_0xfc5d('0x5d')},'attributes':['id',_0xfc5d('0x36'),_0xfc5d('0x6e'),_0xfc5d('0x6f'),'internal'],'raw':!![]});}return null;})[_0xfc5d('0x33')](function(_0xe8078b){if(!_0xe8078b)return null;_0x3f7d42[_0xfc5d('0x24')][_0xfc5d('0x5d')]=_0xe8078b;return _0x3f7d42;})[_0xfc5d('0x33')](function(_0x2b46ad){if(_0x2b46ad){if(_0x53335a[_0xfc5d('0x55')][_0xfc5d('0x70')]){_0x3f7d42[_0xfc5d('0x24')]['interface']=util['format'](_0xfc5d('0x71'),_0x53335a[_0xfc5d('0x64')][_0xfc5d('0x36')]);_0x3f7d42['message'][_0xfc5d('0x72')]=_0x3f7d42[_0xfc5d('0x72')];_0x3f7d42[_0xfc5d('0x24')][_0xfc5d('0x73')]=_0x3f7d42['channel'];_0x3f7d42[_0xfc5d('0x24')][_0xfc5d('0x74')]=_0xfc5d('0x58');return respondWithRpcPromise('EventManager',_0xfc5d('0x75'),{'event':_0xfc5d('0x76'),'message':_0x3f7d42[_0xfc5d('0x24')]},client9002)[_0xfc5d('0x33')](function(){return _0x3f7d42;});}return _0x3f7d42;}return null;})[_0xfc5d('0x33')](respondWithResult(_0x488ef9,null))[_0xfc5d('0x25')](handleError(_0x488ef9,null));};var interaction_log=require(_0xfc5d('0x13'))(_0xfc5d('0x57'));exports[_0xfc5d('0x30')]=function(_0x1efcb0,_0x4d92ef,_0x58890a){var _0x2a8165={'agent':{},'channel':'fax'};if(_0x1efcb0['body']['id']){delete _0x1efcb0[_0xfc5d('0x55')]['id'];}_0x1efcb0[_0xfc5d('0x55')][_0xfc5d('0x5c')]=_0x1efcb0[_0xfc5d('0x55')][_0xfc5d('0x5c')]||_0x1efcb0['user']['id'];_0x2a8165['agent']['id']=_0x1efcb0[_0xfc5d('0x55')][_0xfc5d('0x5c')];return db[_0xfc5d('0x39')]['find']({'where':{'id':_0x1efcb0[_0xfc5d('0x50')]['id'],'UserId':null}})[_0xfc5d('0x33')](handleEntityNotFound(_0x4d92ef,null))[_0xfc5d('0x33')](function(_0x3bedfe){if(_0x3bedfe){_0x2a8165[_0xfc5d('0x24')]=_0x3bedfe['get']({'plain':!![]});return db[_0xfc5d('0x5f')][_0xfc5d('0x54')]({'where':{'id':_0x3bedfe[_0xfc5d('0x60')]}});}return null;})[_0xfc5d('0x33')](handleEntityNotFound(_0x4d92ef,null))[_0xfc5d('0x33')](function(_0x58b054){if(_0x58b054){_0x2a8165[_0xfc5d('0x62')]=_0x58b054[_0xfc5d('0x5e')]({'plain':!![]});interaction_log['info'](_0xfc5d('0x77'),_0x1efcb0[_0xfc5d('0x64')]['id'],_0x1efcb0[_0xfc5d('0x64')][_0xfc5d('0x36')],_0x1efcb0[_0xfc5d('0x64')][_0xfc5d('0x65')],_0x2a8165['interaction']['id'],_0x1efcb0[_0xfc5d('0x55')]?JSON['stringify'](_0x1efcb0[_0xfc5d('0x55')]):_0xfc5d('0x78'));return respondWithRpcPromise(_0xfc5d('0x79'),_0xfc5d('0x7a'),_0x2a8165);}return null;})[_0xfc5d('0x33')](function(_0x2b1939){var _0x9b8c65=_0xfc5d('0x69')+_0x2b1939[_0xfc5d('0x24')][_0xfc5d('0x7b')];return db['sequelize'][_0xfc5d('0x3d')](_0x9b8c65,{'type':db[_0xfc5d('0x7c')][_0xfc5d('0x6b')][_0xfc5d('0x6c')],'raw':!![]})[_0xfc5d('0x33')](function(_0x43765c){return _0x43765c;});})[_0xfc5d('0x33')](function(_0x5e597a){if(_0x5e597a){_0x2a8165['message']['contact']=_0x5e597a[0x0];if(!_0x1efcb0['body'][_0xfc5d('0x5c')])return;return db[_0xfc5d('0x6d')][_0xfc5d('0x54')]({'where':{'id':_0x1efcb0[_0xfc5d('0x55')]['UserId'],'role':_0xfc5d('0x5d')},'attributes':['id',_0xfc5d('0x36'),_0xfc5d('0x6e'),_0xfc5d('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5e9664){if(!_0x5e9664)return null;_0x2a8165[_0xfc5d('0x24')][_0xfc5d('0x5d')]=_0x5e9664;return _0x2a8165;})['then'](function(_0x5f3132){if(_0x5f3132){_0x5f3132[_0xfc5d('0x24')][_0xfc5d('0x7d')]=util['format']('SIP/%s',_0x1efcb0[_0xfc5d('0x64')][_0xfc5d('0x36')]);_0x5f3132[_0xfc5d('0x24')]['channel']=_0x2a8165['channel'];_0x5f3132['message'][_0xfc5d('0x73')]=_0x2a8165[_0xfc5d('0x72')];_0x5f3132[_0xfc5d('0x24')][_0xfc5d('0x74')]=_0xfc5d('0x30');respondWithRpcPromise(_0xfc5d('0x75'),'EventManager',{'event':_0xfc5d('0x7e'),'message':_0x5f3132[_0xfc5d('0x24')]},client9002);return _0x2a8165;}return null;})[_0xfc5d('0x33')](respondWithResult(_0x4d92ef,null))[_0xfc5d('0x25')](handleError(_0x4d92ef,null));};exports['create']=function(_0x17beb9,_0x332240){var _0x36a2a1;return db[_0xfc5d('0x39')]['create'](_0x17beb9[_0xfc5d('0x55')],{})[_0xfc5d('0x33')](function(_0x38e14c){_0x36a2a1=_0x38e14c;return db[_0xfc5d('0x7f')][_0xfc5d('0x80')]({'where':{'id':_0x36a2a1[_0xfc5d('0x7b')]}});})[_0xfc5d('0x33')](function(_0x28e20e){if(_[_0xfc5d('0x61')](_0x28e20e)){return;}else{_0x36a2a1['fax']=_0x28e20e[_0xfc5d('0x59')];return db['Attachment'][_0xfc5d('0x80')]({'where':{'id':_0x36a2a1['AttachmentId']}});}})[_0xfc5d('0x33')](function(_0x3937f5){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xfc5d('0x61')](_0x17beb9[_0xfc5d('0x55')])?undefined:_0x17beb9[_0xfc5d('0x55')][_0xfc5d('0x81')],'path':_['isNil'](_0x3937f5)?undefined:util[_0xfc5d('0x5a')](_0xfc5d('0x82'),_0x3937f5['basename']),'fax':_['isNil'](_0x36a2a1[_0xfc5d('0x59')])?undefined:_0x36a2a1['fax'],'AttachmentId':_0x36a2a1[_0xfc5d('0x83')]},client9002);})['then'](respondWithResult(_0x332240,0xc9))['catch'](handleError(_0x332240,null));};exports[_0xfc5d('0x84')]=function(_0x9888f5,_0x2a624c){var _0x21d003=path[_0xfc5d('0x85')](config[_0xfc5d('0x86')],_0xfc5d('0x87'),'files',_0xfc5d('0x88'));return db[_0xfc5d('0x39')][_0xfc5d('0x54')]({'where':{'id':_0x9888f5[_0xfc5d('0x50')]['id']},'include':[{'model':db[_0xfc5d('0x89')],'as':_0xfc5d('0x89')}]})['then'](handleEntityNotFound(_0x2a624c,null))[_0xfc5d('0x33')](function(_0xd608de){if(_0xd608de){return _0x2a624c[_0xfc5d('0x84')](path[_0xfc5d('0x85')](_0x21d003,_0xd608de[_0xfc5d('0x89')][_0xfc5d('0x8a')]));}})[_0xfc5d('0x25')](handleError(_0x2a624c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index a441a4f..4be6f65 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','FaxMessage','setMaxListeners','save'];(function(_0x2b3f17,_0x57fda3){var _0x3959d7=function(_0x5ea40e){while(--_0x5ea40e){_0x2b3f17['push'](_0x2b3f17['shift']());}};_0x3959d7(++_0x57fda3);}(_0xacf4,0xe7));var _0x4acf=function(_0x10bc9b,_0x435a4c){_0x10bc9b=_0x10bc9b-0x0;var _0x242240=_0xacf4[_0x10bc9b];return _0x242240;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4acf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){FaxMessageEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);FaxMessageEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];FaxMessage[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xfc4f=['save','update','remove','emit','hook','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x1c79a7,_0x38220e){var _0x4de69f=function(_0x569582){while(--_0x569582){_0x1c79a7['push'](_0x1c79a7['shift']());}};_0x4de69f(++_0x38220e);}(_0xfc4f,0x192));var _0xffc4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfc4f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xffc4('0x0'))['db'][_0xffc4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xffc4('0x2')](0x0);var events={'afterCreate':_0xffc4('0x3'),'afterUpdate':_0xffc4('0x4'),'afterDestroy':_0xffc4('0x5')};function emitEvent(_0x27bcf3){return function(_0x5943be,_0x289659,_0x211cfa){FaxMessageEvents[_0xffc4('0x6')](_0x27bcf3+':'+_0x5943be['id'],_0x5943be);FaxMessageEvents[_0xffc4('0x6')](_0x27bcf3,_0x5943be);_0x211cfa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xffc4('0x7')](e,emitEvent(event));}}module[_0xffc4('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 5b8f8b4..fc2038f 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 _0x96ae=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId'];(function(_0x4cf6b0,_0x120ce1){var _0x15d06e=function(_0x4366e1){while(--_0x4366e1){_0x4cf6b0['push'](_0x4cf6b0['shift']());}};_0x15d06e(++_0x120ce1);}(_0x96ae,0x19e));var _0xe96a=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0x96ae[_0x549d57];return _0x330291;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe96a('0x0'))(_0xe96a('0x1'));var moment=require(_0xe96a('0x2'));var BPromise=require(_0xe96a('0x3'));var rp=require(_0xe96a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe96a('0x5'));var config=require('../../config/environment');var attributes=require(_0xe96a('0x6'));module['exports']=function(_0x5d1839,_0x15a4d3){return _0x5d1839[_0xe96a('0x7')](_0xe96a('0x8'),attributes,{'tableName':_0xe96a('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xe96a('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43a1a9,_0x12f340,_0x383ced){var _0x5e83d6=_0x5d1839[_0xe96a('0xb')];var _0x5b98ba=_0x43a1a9[_0xe96a('0xc')]({'plain':!![]});if(_0x5b98ba[_0xe96a('0xd')]['toLowerCase']()==='in'||_0x5b98ba[_0xe96a('0xd')][_0xe96a('0xe')]()==='out'&&!_0x5b98ba[_0xe96a('0xf')]&&!_[_0xe96a('0x10')](_0x5b98ba[_0xe96a('0x11')])){_0x5e83d6[_0xe96a('0x12')][_0xe96a('0x13')]({'where':{'id':_0x5b98ba[_0xe96a('0x14')]}})[_0xe96a('0x15')](function(_0x3187b0){if(_0x3187b0){_0x3187b0[_0xe96a('0x16')]({'lastMsgAt':_0x5b98ba[_0xe96a('0x17')],'lastMsgDirection':_0x5b98ba[_0xe96a('0xd')]['toLowerCase']()});}})[_0xe96a('0x18')](function(_0x35bc2f){console['error'](_0x35bc2f);});}_0x383ced();}},'charset':_0xe96a('0x19'),'collate':_0xe96a('0x1a')});}; \ No newline at end of file +var _0x9719=['get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x397ecb,_0x411b9b){var _0x3e9af1=function(_0x5e6871){while(--_0x5e6871){_0x397ecb['push'](_0x397ecb['shift']());}};_0x3e9af1(++_0x411b9b);}(_0x9719,0x139));var _0x9971=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9719[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x9971('0x0'));var util=require(_0x9971('0x1'));var logger=require(_0x9971('0x2'))(_0x9971('0x3'));var moment=require(_0x9971('0x4'));var BPromise=require('bluebird');var rp=require(_0x9971('0x5'));var fs=require('fs');var path=require(_0x9971('0x6'));var rimraf=require(_0x9971('0x7'));var config=require(_0x9971('0x8'));var attributes=require(_0x9971('0x9'));module['exports']=function(_0x16dc7c,_0x35cd98){return _0x16dc7c[_0x9971('0xa')](_0x9971('0xb'),attributes,{'tableName':_0x9971('0xc'),'paranoid':![],'indexes':[{'name':_0x9971('0xd'),'fields':[_0x9971('0xe')],'type':_0x9971('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa32783,_0x338d57,_0x4b12bb){var _0x5cb7a8=_0x16dc7c[_0x9971('0x10')];var _0x5af02b=_0xa32783[_0x9971('0x11')]({'plain':!![]});if(_0x5af02b['direction']['toLowerCase']()==='in'||_0x5af02b[_0x9971('0x12')]['toLowerCase']()===_0x9971('0x13')&&!_0x5af02b[_0x9971('0x14')]&&!_[_0x9971('0x15')](_0x5af02b[_0x9971('0x16')])){_0x5cb7a8[_0x9971('0x17')][_0x9971('0x18')]({'where':{'id':_0x5af02b[_0x9971('0x19')]}})[_0x9971('0x1a')](function(_0x218ece){if(_0x218ece){_0x218ece[_0x9971('0x1b')]({'lastMsgAt':_0x5af02b[_0x9971('0x1c')],'lastMsgDirection':_0x5af02b['direction'][_0x9971('0x1d')]()});}})[_0x9971('0x1e')](function(_0x171e36){console[_0x9971('0x1f')](_0x171e36);});}_0x4b12bb();}},'charset':_0x9971('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6b2139b..5c513bd 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 _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23c66b,_0x4677b1){var _0x497414=function(_0x38fe0e){while(--_0x38fe0e){_0x23c66b['push'](_0x23c66b['shift']());}};_0x497414(++_0x4677b1);}(_0x84ab,0x12f));var _0xb84a=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x84ab[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file +var _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0x22c747,_0x40d99f){var _0x182960=function(_0xf3db4a){while(--_0xf3db4a){_0x22c747['push'](_0x22c747['shift']());}};_0x182960(++_0x40d99f);}(_0x55e0,0xdc));var _0x055e=function(_0xca531b,_0x2768eb){_0xca531b=_0xca531b-0x0;var _0x4c5ea0=_0x55e0[_0xca531b];return _0x4c5ea0;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 82d0b38..4aa2407 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 _0x20bc=['register','length','faxMessage:','save','remove','update','emit'];(function(_0x287cf3,_0x4de069){var _0x586ceb=function(_0xfec31f){while(--_0xfec31f){_0x287cf3['push'](_0x287cf3['shift']());}};_0x586ceb(++_0x4de069);}(_0x20bc,0x1d8));var _0xc20b=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x20bc[_0x1fc18b];return _0x16a351;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xc20b('0x0'),_0xc20b('0x1'),_0xc20b('0x2')];function createListener(_0xe0e61c,_0x59b77c){return function(_0x38f764){_0x59b77c[_0xc20b('0x3')](_0xe0e61c,_0x38f764);};}function removeListener(_0x2e20c8,_0x27e997){return function(){FaxMessageEvents['removeListener'](_0x2e20c8,_0x27e997);};}exports[_0xc20b('0x4')]=function(_0x1ed958){for(var _0x1ebc4b=0x0,_0x201482=events[_0xc20b('0x5')];_0x1ebc4b<_0x201482;_0x1ebc4b++){var _0x26b30c=events[_0x1ebc4b];var _0x35c120=createListener(_0xc20b('0x6')+_0x26b30c,_0x1ed958);FaxMessageEvents['on'](_0x26b30c,_0x35c120);}}; \ No newline at end of file +var _0x15db=['faxMessage:','save','remove','emit','removeListener','register','length'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x15db,0xcc));var _0xb15d=function(_0x4e0996,_0x3e552c){_0x4e0996=_0x4e0996-0x0;var _0x2e8e75=_0x15db[_0x4e0996];return _0x2e8e75;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb15d('0x0'),_0xb15d('0x1'),'update'];function createListener(_0x3438b1,_0x2ba314){return function(_0x5e0a8c){_0x2ba314[_0xb15d('0x2')](_0x3438b1,_0x5e0a8c);};}function removeListener(_0x5c4d26,_0x4ef4d6){return function(){FaxMessageEvents[_0xb15d('0x3')](_0x5c4d26,_0x4ef4d6);};}exports[_0xb15d('0x4')]=function(_0x2d06d7){for(var _0x46ad7e=0x0,_0x50fdaf=events[_0xb15d('0x5')];_0x46ad7e<_0x50fdaf;_0x46ad7e++){var _0x25ee1e=events[_0x46ad7e];var _0x28a104=createListener(_0xb15d('0x6')+_0x25ee1e,_0x2d06d7);FaxMessageEvents['on'](_0x25ee1e,_0x28a104);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c643217..e82365a 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 _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x5b6132,_0x83d338){var _0x5d3b6c=function(_0x4fecf9){while(--_0x4fecf9){_0x5b6132['push'](_0x5b6132['shift']());}};_0x5d3b6c(++_0x83d338);}(_0xd404,0x15b));var _0x4d40=function(_0x42a77f,_0x19335f){_0x42a77f=_0x42a77f-0x0;var _0x1a0785=_0xd404[_0x42a77f];return _0x1a0785;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file +var _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x2223f4,_0x277f80){var _0x840e7=function(_0x758837){while(--_0x758837){_0x2223f4['push'](_0x2223f4['shift']());}};_0x840e7(++_0x277f80);}(_0xd404,0x15b));var _0x4d40=function(_0x53cf4e,_0x580539){_0x53cf4e=_0x53cf4e-0x0;var _0x5bd484=_0xd404[_0x53cf4e];return _0x5bd484;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 015e7cf..238328a 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 _0x1c77=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x205372,_0x16b312){var _0x580941=function(_0x23ae05){while(--_0x23ae05){_0x205372['push'](_0x205372['shift']());}};_0x580941(++_0x16b312);}(_0x1c77,0xed));var _0x71c7=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x1c77[_0x462fe4];return _0x82b23a;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'name':{'type':Sequelize[_0x71c7('0x1')],'unique':_0x71c7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x71c7('0x1')]},'timeout':{'type':Sequelize[_0x71c7('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x71c7('0x4'),_0x71c7('0x5'),_0x71c7('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x71c7('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbddb=['INTEGER','ENUM','rrmemory','exports','name','STRING'];(function(_0x2ddf50,_0x5c58d9){var _0x168625=function(_0x444a2e){while(--_0x444a2e){_0x2ddf50['push'](_0x2ddf50['shift']());}};_0x168625(++_0x5c58d9);}(_0xbddb,0x11d));var _0xbbdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbddb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xbbdd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbbdd('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbbdd('0x2')]},'timeout':{'type':Sequelize[_0xbbdd('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbbdd('0x4')](_0xbbdd('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbbdd('0x3')],'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 c45581d..2bd1dbb 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 _0xd5d6=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','rows','format','SIP','Team','length','getTeams','hasOwnProperty','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','includes','all','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','get','FaxQueues','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x149225,_0x5869e2){var _0x21e6ac=function(_0x3bbef8){while(--_0x3bbef8){_0x149225['push'](_0x149225['shift']());}};_0x21e6ac(++_0x5869e2);}(_0xd5d6,0xcb));var _0x6d5d=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd5d6[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x6d5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d5d('0x1'));var jsonpatch=require(_0x6d5d('0x2'));var rp=require(_0x6d5d('0x3'));var moment=require(_0x6d5d('0x4'));var BPromise=require(_0x6d5d('0x5'));var Mustache=require(_0x6d5d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6d5d('0x7'));var csv=require(_0x6d5d('0x8'));var ejs=require(_0x6d5d('0x9'));var fs=require('fs');var fs_extra=require(_0x6d5d('0xa'));var _=require(_0x6d5d('0xb'));var squel=require(_0x6d5d('0xc'));var crypto=require(_0x6d5d('0xd'));var jsforce=require(_0x6d5d('0xe'));var deskjs=require(_0x6d5d('0xf'));var toCsv=require(_0x6d5d('0x8'));var querystring=require(_0x6d5d('0x10'));var Papa=require(_0x6d5d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6d5d('0x12'));var hardwareService=require(_0x6d5d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6d5d('0x14'));var config=require(_0x6d5d('0x15'));var licenseUtil=require(_0x6d5d('0x16'));var db=require(_0x6d5d('0x17'))['db'];config[_0x6d5d('0x18')]=_[_0x6d5d('0x19')](config['redis'],{'host':_0x6d5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d5d('0x18')]));require(_0x6d5d('0x1b'))[_0x6d5d('0x1c')](socket);function respondWithStatusCode(_0x588de6,_0xd48dc1){_0xd48dc1=_0xd48dc1||0xcc;return function(_0x247633){if(_0x247633){return _0x588de6[_0x6d5d('0x1d')](_0xd48dc1);}return _0x588de6[_0x6d5d('0x1e')](_0xd48dc1)['end']();};}function respondWithResult(_0xe5bf94,_0x246341){_0x246341=_0x246341||0xc8;return function(_0x125d29){if(_0x125d29){return _0xe5bf94[_0x6d5d('0x1e')](_0x246341)[_0x6d5d('0x1f')](_0x125d29);}};}function respondWithFilteredResult(_0x217eb3,_0x4ec500){return function(_0x2b98c4){if(_0x2b98c4){var _0x2e5fed=typeof _0x4ec500[_0x6d5d('0x20')]===_0x6d5d('0x21')&&typeof _0x4ec500[_0x6d5d('0x22')]===_0x6d5d('0x21');var _0xd41257=_0x2b98c4[_0x6d5d('0x23')];var _0x16c784=_0x2e5fed?0x0:_0x4ec500[_0x6d5d('0x20')];var _0x1ea929=_0x2e5fed?_0x2b98c4[_0x6d5d('0x23')]:_0x4ec500[_0x6d5d('0x20')]+_0x4ec500['limit'];var _0x4faedb;if(_0x1ea929>=_0xd41257){_0x1ea929=_0xd41257;_0x4faedb=0xc8;}else{_0x4faedb=0xce;}_0x217eb3['status'](_0x4faedb);return _0x217eb3['set']('Content-Range',_0x16c784+'-'+_0x1ea929+'/'+_0xd41257)['json'](_0x2b98c4);}return null;};}function patchUpdates(_0x19f13b){return function(_0x32ce28){try{jsonpatch[_0x6d5d('0x24')](_0x32ce28,_0x19f13b,!![]);}catch(_0x1d421e){return BPromise[_0x6d5d('0x25')](_0x1d421e);}return _0x32ce28[_0x6d5d('0x26')]();};}function saveUpdates(_0x3cf36a,_0x184781){return function(_0x356853){if(_0x356853){return _0x356853[_0x6d5d('0x27')](_0x3cf36a)[_0x6d5d('0x28')](function(_0x472ffa){return _0x472ffa;});}return null;};}function removeEntity(_0x5c366a,_0x5a35bc){return function(_0x486c41){if(_0x486c41){return _0x486c41['destroy']()['then'](function(){var _0x5b39ff=_0x486c41[_0x6d5d('0x29')]({'plain':!![]});var _0x3c1a21=_0x6d5d('0x2a');return db['UserProfileResource'][_0x6d5d('0x2b')]({'where':{'type':_0x3c1a21,'resourceId':_0x5b39ff['id']}})[_0x6d5d('0x28')](function(){return _0x486c41;});})[_0x6d5d('0x28')](function(){_0x5c366a[_0x6d5d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4cb6,_0x46b0ee){return function(_0x596db2){if(!_0x596db2){_0x2b4cb6[_0x6d5d('0x1d')](0x194);}return _0x596db2;};}function handleError(_0x2334b6,_0xc6301d){_0xc6301d=_0xc6301d||0x1f4;return function(_0x2c3a81){logger['error'](_0x2c3a81[_0x6d5d('0x2c')]);if(_0x2c3a81[_0x6d5d('0x2d')]){delete _0x2c3a81[_0x6d5d('0x2d')];}_0x2334b6[_0x6d5d('0x1e')](_0xc6301d)[_0x6d5d('0x2e')](_0x2c3a81);};}exports[_0x6d5d('0x2f')]=function(_0x172484,_0xd74feb){var _0x54b759={},_0x56b5bb={},_0x3b924d={'count':0x0,'rows':[]};var _0x42fc58=_[_0x6d5d('0x30')](db['FaxQueue'][_0x6d5d('0x31')],function(_0x46fd45){return{'name':_0x46fd45['fieldName'],'type':_0x46fd45[_0x6d5d('0x32')][_0x6d5d('0x33')]};});_0x56b5bb[_0x6d5d('0x34')]=_['map'](_0x42fc58,_0x6d5d('0x2d'));_0x56b5bb[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x172484['query']);_0x56b5bb[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x56b5bb['model'],_0x56b5bb['query']);_0x54b759[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x56b5bb[_0x6d5d('0x34')],qs['fields'](_0x172484['query'][_0x6d5d('0x3a')]));_0x54b759[_0x6d5d('0x39')]=_0x54b759['attributes']['length']?_0x54b759['attributes']:_0x56b5bb[_0x6d5d('0x34')];if(!_0x172484[_0x6d5d('0x35')]['hasOwnProperty'](_0x6d5d('0x3b'))){_0x54b759[_0x6d5d('0x22')]=qs[_0x6d5d('0x22')](_0x172484[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x54b759['offset']=qs['offset'](_0x172484['query'][_0x6d5d('0x20')]);}_0x54b759['order']=qs[_0x6d5d('0x3c')](_0x172484[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x54b759[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x172484[_0x6d5d('0x35')],_0x56b5bb[_0x6d5d('0x37')]),_0x42fc58);if(_0x172484[_0x6d5d('0x35')][_0x6d5d('0x3f')]){_0x54b759['where']=_[_0x6d5d('0x40')](_0x54b759[_0x6d5d('0x3d')],{'$or':_[_0x6d5d('0x30')](_0x42fc58,function(_0x3662fa){if(_0x3662fa['type']!==_0x6d5d('0x41')){var _0x31ea7f={};_0x31ea7f[_0x3662fa[_0x6d5d('0x2d')]]={'$like':'%'+_0x172484['query'][_0x6d5d('0x3f')]+'%'};return _0x31ea7f;}})});}_0x54b759=_[_0x6d5d('0x40')]({},_0x54b759,_0x172484[_0x6d5d('0x42')]);var _0x43d7d5={'where':_0x54b759['where']};return db[_0x6d5d('0x43')][_0x6d5d('0x23')](_0x43d7d5)[_0x6d5d('0x28')](function(_0x2a3f93){_0x3b924d[_0x6d5d('0x23')]=_0x2a3f93;if(_0x172484['query'][_0x6d5d('0x44')]){_0x54b759[_0x6d5d('0x45')]=[{'all':!![]}];}return db[_0x6d5d('0x43')][_0x6d5d('0x46')](_0x54b759);})[_0x6d5d('0x28')](function(_0x4d15bc){_0x3b924d['rows']=_0x4d15bc;return _0x3b924d;})[_0x6d5d('0x28')](respondWithFilteredResult(_0xd74feb,_0x54b759))['catch'](handleError(_0xd74feb,null));};exports['show']=function(_0x183330,_0x4594aa){var _0xca1a4={'raw':!![],'where':{'id':_0x183330[_0x6d5d('0x47')]['id']}},_0x42afbb={};_0x42afbb[_0x6d5d('0x34')]=_['keys'](db[_0x6d5d('0x43')][_0x6d5d('0x31')]);_0x42afbb[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x183330['query']);_0x42afbb[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x42afbb[_0x6d5d('0x34')],_0x42afbb[_0x6d5d('0x35')]);_0xca1a4[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x42afbb[_0x6d5d('0x34')],qs['fields'](_0x183330['query']['fields']));_0xca1a4[_0x6d5d('0x39')]=_0xca1a4['attributes']['length']?_0xca1a4[_0x6d5d('0x39')]:_0x42afbb[_0x6d5d('0x34')];if(_0x183330['query'][_0x6d5d('0x44')]){_0xca1a4[_0x6d5d('0x45')]=[{'all':!![]}];}_0xca1a4=_[_0x6d5d('0x40')]({},_0xca1a4,_0x183330[_0x6d5d('0x42')]);return db[_0x6d5d('0x43')][_0x6d5d('0x48')](_0xca1a4)['then'](handleEntityNotFound(_0x4594aa,null))[_0x6d5d('0x28')](respondWithResult(_0x4594aa,null))[_0x6d5d('0x49')](handleError(_0x4594aa,null));};exports[_0x6d5d('0x4a')]=function(_0x56205b,_0xf14d4){return db['FaxQueue'][_0x6d5d('0x4a')](_0x56205b['body'],{})['then'](function(_0x6e9f20){var _0x5a1d0a=_0x56205b[_0x6d5d('0x4b')]['get']({'plain':!![]});if(!_0x5a1d0a)throw new Error(_0x6d5d('0x4c'));if(_0x5a1d0a['role']===_0x6d5d('0x4b')){var _0x124a5e=_0x6e9f20[_0x6d5d('0x29')]({'plain':!![]});var _0x3e105b=_0x6d5d('0x2a');return db['UserProfileSection'][_0x6d5d('0x48')]({'where':{'name':_0x3e105b,'userProfileId':_0x5a1d0a[_0x6d5d('0x4d')]},'raw':!![]})[_0x6d5d('0x28')](function(_0xe7009f){if(_0xe7009f&&_0xe7009f[_0x6d5d('0x4e')]===0x0){return db[_0x6d5d('0x4f')]['create']({'name':_0x124a5e[_0x6d5d('0x2d')],'resourceId':_0x124a5e['id'],'type':_0xe7009f[_0x6d5d('0x2d')],'sectionId':_0xe7009f['id']},{})[_0x6d5d('0x28')](function(){return _0x6e9f20;});}else{return _0x6e9f20;}})[_0x6d5d('0x49')](function(_0x1bc026){logger[_0x6d5d('0x50')](_0x6d5d('0x51'),_0x1bc026);throw _0x1bc026;});}return _0x6e9f20;})[_0x6d5d('0x28')](respondWithResult(_0xf14d4,0xc9))[_0x6d5d('0x49')](handleError(_0xf14d4,null));};exports[_0x6d5d('0x27')]=function(_0x61008d,_0x380d0a){if(_0x61008d[_0x6d5d('0x52')]['id']){delete _0x61008d['body']['id'];}return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x61008d['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x380d0a,null))[_0x6d5d('0x28')](saveUpdates(_0x61008d['body'],null))[_0x6d5d('0x28')](respondWithResult(_0x380d0a,null))[_0x6d5d('0x49')](handleError(_0x380d0a,null));};exports['destroy']=function(_0x213f5f,_0x274ca8){return db['FaxQueue'][_0x6d5d('0x48')]({'where':{'id':_0x213f5f[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x274ca8,null))[_0x6d5d('0x28')](removeEntity(_0x274ca8,null))[_0x6d5d('0x49')](handleError(_0x274ca8,null));};exports['describe']=function(_0x2c6083,_0x315ad2){return db[_0x6d5d('0x43')]['describe']()['then'](respondWithResult(_0x315ad2,null))[_0x6d5d('0x49')](handleError(_0x315ad2,null));};exports['getMembers']=function(_0x2c6ed1,_0x510433,_0x45c943){var _0x56636b={'raw':!![],'where':{}},_0x83c373={},_0xf571c6;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x2c6ed1[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x510433,null))[_0x6d5d('0x28')](function(_0x3684f7){if(_0x3684f7){_0xf571c6=_0x3684f7[_0x6d5d('0x29')]({'plain':!![]});_0x83c373['model']=_[_0x6d5d('0x36')](db[_0x6d5d('0x54')][_0x6d5d('0x31')]);_0x83c373['query']=_[_0x6d5d('0x36')](_0x2c6ed1[_0x6d5d('0x35')]);_0x83c373[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x83c373[_0x6d5d('0x34')],_0x83c373[_0x6d5d('0x35')]);_0x56636b[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x83c373[_0x6d5d('0x34')],qs[_0x6d5d('0x3a')](_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x3a')]));_0x56636b[_0x6d5d('0x39')]=_0x56636b[_0x6d5d('0x39')]['length']?_0x56636b[_0x6d5d('0x39')]:_0x83c373[_0x6d5d('0x34')];if(!_0x2c6ed1[_0x6d5d('0x35')]['hasOwnProperty']('nolimit')){_0x56636b[_0x6d5d('0x22')]=qs[_0x6d5d('0x22')](_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x56636b[_0x6d5d('0x20')]=qs[_0x6d5d('0x20')](_0x2c6ed1[_0x6d5d('0x35')]['offset']);}_0x56636b[_0x6d5d('0x55')]=qs[_0x6d5d('0x3c')](_0x2c6ed1[_0x6d5d('0x35')]['sort']);_0x56636b[_0x6d5d('0x3d')]=qs['filters'](_['pick'](_0x2c6ed1[_0x6d5d('0x35')],_0x83c373[_0x6d5d('0x37')]));_0x56636b[_0x6d5d('0x3d')][_0x6d5d('0x56')]=_0x3684f7['id'];if(_0x2c6ed1[_0x6d5d('0x35')]['filter']){_0x56636b[_0x6d5d('0x3d')]=_[_0x6d5d('0x40')](_0x56636b['where'],{'$or':_[_0x6d5d('0x30')](_0x56636b[_0x6d5d('0x39')],function(_0x31f57a){var _0x5b12be={};_0x5b12be[_0x31f57a]={'$like':'%'+_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x3f')]+'%'};return _0x5b12be;})});}_0x56636b=_[_0x6d5d('0x40')]({},_0x56636b,_0x2c6ed1[_0x6d5d('0x42')]);return db['UserFaxQueue'][_0x6d5d('0x46')](_0x56636b);}})['then'](function(_0x10b289){if(_0x10b289){return db[_0x6d5d('0x57')][_0x6d5d('0x58')]({'where':{'id':_['map'](_0x10b289,'UserId'),'role':'agent'},'attributes':['id',_0x6d5d('0x2d'),_0x6d5d('0x59'),_0x6d5d('0x5a'),_0x6d5d('0x5b')]});}})[_0x6d5d('0x28')](function(_0x20746c){if(_0x20746c){return{'count':_0x20746c[_0x6d5d('0x23')],'rows':_[_0x6d5d('0x30')](_0x20746c[_0x6d5d('0x5c')],function(_0x20e823){return{'membername':_0x20e823[_0x6d5d('0x2d')],'UserId':_0x20e823['id'],'queue_name':_0xf571c6['name'],'FaxQueueId':_0xf571c6['id'],'interface':util[_0x6d5d('0x5d')]('%s/%s',_0x6d5d('0x5e'),_0x20e823[_0x6d5d('0x2d')]),'penalty':0x0,'paused':_0x20e823[_0x6d5d('0x59')],'createdAt':_0x20e823['createdAt'],'updatedAt':_0x20e823['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x510433,_0x56636b))[_0x6d5d('0x49')](handleError(_0x510433,null));};exports['getTeams']=function(_0x190a24,_0x3cce23,_0x25ad60){var _0x21b053={};var _0x2fb734={};var _0x1a55d6;var _0xe643ef;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x190a24[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x3cce23,null))[_0x6d5d('0x28')](function(_0x37186d){if(_0x37186d){_0x1a55d6=_0x37186d;_0x2fb734[_0x6d5d('0x34')]=_[_0x6d5d('0x36')](db[_0x6d5d('0x5f')][_0x6d5d('0x31')]);_0x2fb734[_0x6d5d('0x35')]=_['keys'](_0x190a24[_0x6d5d('0x35')]);_0x2fb734[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x2fb734[_0x6d5d('0x34')],_0x2fb734[_0x6d5d('0x35')]);_0x21b053['attributes']=_[_0x6d5d('0x38')](_0x2fb734['model'],qs[_0x6d5d('0x3a')](_0x190a24[_0x6d5d('0x35')]['fields']));_0x21b053[_0x6d5d('0x39')]=_0x21b053[_0x6d5d('0x39')][_0x6d5d('0x60')]?_0x21b053['attributes']:_0x2fb734[_0x6d5d('0x34')];_0x21b053['order']=qs['sort'](_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x21b053[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x190a24[_0x6d5d('0x35')],_0x2fb734[_0x6d5d('0x37')]));if(_0x190a24['query'][_0x6d5d('0x3f')]){_0x21b053['where']=_['merge'](_0x21b053[_0x6d5d('0x3d')],{'$or':_['map'](_0x21b053['attributes'],function(_0x5eb5e2){var _0x25eb32={};_0x25eb32[_0x5eb5e2]={'$like':'%'+_0x190a24[_0x6d5d('0x35')]['filter']+'%'};return _0x25eb32;})});}_0x21b053=_['merge']({},_0x21b053,_0x190a24['options']);return _0x1a55d6[_0x6d5d('0x61')](_0x21b053);}})['then'](function(_0x5872d){if(_0x5872d){_0xe643ef=_0x5872d[_0x6d5d('0x60')];if(!_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x62')](_0x6d5d('0x3b'))){_0x21b053['limit']=qs[_0x6d5d('0x22')](_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x21b053[_0x6d5d('0x20')]=qs[_0x6d5d('0x20')](_0x190a24['query'][_0x6d5d('0x20')]);}return _0x1a55d6[_0x6d5d('0x61')](_0x21b053);}})[_0x6d5d('0x28')](function(_0x49bcd0){if(_0x49bcd0){return _0x49bcd0?{'count':_0xe643ef,'rows':_0x49bcd0}:null;}})[_0x6d5d('0x28')](respondWithResult(_0x3cce23,null))['catch'](handleError(_0x3cce23,null));};exports[_0x6d5d('0x63')]=function(_0x59d8f2,_0x424e60,_0x51609c){var _0x27ba9e=_0x59d8f2[_0x6d5d('0x52')][_0x6d5d('0x64')];return db[_0x6d5d('0x5f')][_0x6d5d('0x46')]({'where':{'id':_0x27ba9e},'attributes':['id'],'include':[{'model':db[_0x6d5d('0x57')],'as':'Agents','attributes':['id',_0x6d5d('0x2d'),_0x6d5d('0x65'),_0x6d5d('0x66'),'interface'],'raw':!![]}]})[_0x6d5d('0x28')](function(_0xc98d07){if(_0xc98d07){var _0x275385=_['flatMap'](_0xc98d07,function(_0xcec27b){var _0x45bd66=_0xcec27b['get']({'plain':!![]});return _0x45bd66[_0x6d5d('0x67')];});return db['FaxQueue'][_0x6d5d('0x48')]({'where':{'id':_0x59d8f2['params']['id']}})[_0x6d5d('0x28')](function(_0x12400d){return db[_0x6d5d('0x68')][_0x6d5d('0x69')](function(_0x3320b1){return _0x12400d[_0x6d5d('0x63')](_0x27ba9e,{'transaction':_0x3320b1})[_0x6d5d('0x28')](function(){return BPromise[_0x6d5d('0x6a')](_0x275385,function(_0x2547fb){return db['UserFaxQueue'][_0x6d5d('0x6b')]({'where':{'UserId':_0x2547fb['id'],'FaxQueueId':_0x59d8f2[_0x6d5d('0x47')]['id']},'transaction':_0x3320b1});});})[_0x6d5d('0x28')](function(){_0x275385['forEach'](function(_0x435b79){socket[_0x6d5d('0x6c')]('userFaxQueue:save',{'UserId':_0x435b79['id'],'FaxQueueId':_0x12400d['id']});});});});});}})[_0x6d5d('0x28')](respondWithStatusCode(_0x424e60,null))[_0x6d5d('0x49')](handleError(_0x424e60,null));};exports[_0x6d5d('0x6d')]=function(_0x24ea7d,_0x7c44e3,_0x25b871){return db['Team'][_0x6d5d('0x46')]({'where':{'id':_0x24ea7d[_0x6d5d('0x35')][_0x6d5d('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6d5d('0x57')],'as':_0x6d5d('0x67'),'attributes':['id'],'raw':!![]}]})[_0x6d5d('0x28')](handleEntityNotFound(_0x7c44e3,null))[_0x6d5d('0x28')](function(_0x70e2f3){var _0x253aa7=_[_0x6d5d('0x30')](_0x70e2f3,'id');var _0x100eed=[];var _0x527637=[];var _0x38508d=squel['select']();_0x38508d[_0x6d5d('0x6e')](_0x6d5d('0x6f'))['from'](_0x6d5d('0x70'),'tq')[_0x6d5d('0x71')](_0x6d5d('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6d5d('0x73'),_0x24ea7d[_0x6d5d('0x47')]['id']);for(var _0x441008=0x0;_0x441008<_0x70e2f3[_0x6d5d('0x60')];_0x441008+=0x1){let _0x3bfe20=_0x70e2f3[_0x441008];for(var _0x1f3bc0=0x0;_0x1f3bc0<_0x3bfe20[_0x6d5d('0x67')][_0x6d5d('0x60')];_0x1f3bc0+=0x1){let _0x1c8795=_0x3bfe20['Agents'][_0x1f3bc0];var _0x313313=_0x38508d[_0x6d5d('0x74')]();_0x313313[_0x6d5d('0x3d')]('ut.UserId\x20=\x20?',_0x1c8795['id']);_0x527637[_0x6d5d('0x75')](db[_0x6d5d('0x68')][_0x6d5d('0x35')](_0x313313[_0x6d5d('0x76')](),{'type':db[_0x6d5d('0x68')][_0x6d5d('0x77')]['SELECT']})['then'](function(_0x49f4c6){if(_0x49f4c6[_0x6d5d('0x60')]===0x1){return _0x1c8795['id'];}else{var _0x1f2bbb=_['every'](_['map'](_0x49f4c6,'TeamId'),function(_0x280928){return _[_0x6d5d('0x78')](_0x253aa7,_0x280928);});if(_0x1f2bbb){return _0x1c8795['id'];}}}));}}return BPromise[_0x6d5d('0x79')](_0x527637)[_0x6d5d('0x28')](function(_0x8b15d){_0x100eed=_(_0x100eed)['union'](_0x8b15d)['compact']()[_0x6d5d('0x7a')]();return db['FaxQueue']['find']({'where':{'id':_0x24ea7d[_0x6d5d('0x47')]['id']}})['then'](function(_0x2514d0){return db[_0x6d5d('0x68')]['transaction'](function(_0x117955){return _0x2514d0[_0x6d5d('0x6d')](_0x24ea7d['query'][_0x6d5d('0x64')],{'transaction':_0x117955})[_0x6d5d('0x28')](function(){if(!_[_0x6d5d('0x7b')](_0x100eed)){return _0x2514d0[_0x6d5d('0x7c')](_0x100eed,{'transaction':_0x117955});}})['then'](function(){_0x100eed[_0x6d5d('0x7d')](function(_0x558f8d){socket[_0x6d5d('0x6c')](_0x6d5d('0x7e'),{'UserId':_0x558f8d,'FaxQueueId':_0x2514d0['id']});});});});});});})[_0x6d5d('0x28')](respondWithStatusCode(_0x7c44e3,null))['catch'](handleError(_0x7c44e3,null));};exports[_0x6d5d('0x7f')]=function(_0x481ae3,_0x5637fb,_0x111932){return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x481ae3[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x5637fb,null))['then'](function(_0x4eee61){if(_0x4eee61){return _0x4eee61[_0x6d5d('0x7f')](_0x481ae3['body'][_0x6d5d('0x64')],_[_0x6d5d('0x80')](_0x481ae3[_0x6d5d('0x52')],[_0x6d5d('0x64'),'id'])||{})['spread'](function(_0x7082f7){for(var _0x3f717e=0x0;_0x3f717e<_0x481ae3[_0x6d5d('0x52')][_0x6d5d('0x64')][_0x6d5d('0x60')];_0x3f717e+=0x1){socket[_0x6d5d('0x6c')]('userFaxQueue:save',{'UserId':Number(_0x481ae3[_0x6d5d('0x52')][_0x6d5d('0x64')][_0x3f717e]),'FaxQueueId':Number(_0x481ae3[_0x6d5d('0x47')]['id'])});}return _0x7082f7;});}})[_0x6d5d('0x28')](respondWithResult(_0x5637fb,null))['catch'](handleError(_0x5637fb,null));};exports[_0x6d5d('0x7c')]=function(_0x11eeb5,_0xfb2365,_0x35f9cc){return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x11eeb5['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0xfb2365,null))['then'](function(_0x1b902f){if(_0x1b902f){return _0x1b902f[_0x6d5d('0x7c')](_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')])[_0x6d5d('0x28')](function(){if(_[_0x6d5d('0x81')](_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')])){for(var _0x2f2b88=0x0;_0x2f2b88<_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')][_0x6d5d('0x60')];_0x2f2b88+=0x1){socket['emit'](_0x6d5d('0x7e'),{'UserId':Number(_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')][_0x2f2b88]),'FaxQueueId':Number(_0x11eeb5['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')]),'FaxQueueId':Number(_0x11eeb5['params']['id'])});}});}})[_0x6d5d('0x28')](respondWithStatusCode(_0xfb2365,null))[_0x6d5d('0x49')](handleError(_0xfb2365,null));};exports[_0x6d5d('0x82')]=function(_0x40c8ba,_0x3048b5,_0x1b115b){var _0x3f4f68={};var _0x246e05={};var _0x564b3f;var _0x3d8bc7;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x40c8ba['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x3048b5,null))[_0x6d5d('0x28')](function(_0x42a970){if(_0x42a970){_0x564b3f=_0x42a970;_0x246e05[_0x6d5d('0x34')]=_['keys'](db['User'][_0x6d5d('0x31')]);_0x246e05[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x40c8ba[_0x6d5d('0x35')]);_0x246e05['filters']=_[_0x6d5d('0x38')](_0x246e05[_0x6d5d('0x34')],_0x246e05[_0x6d5d('0x35')]);_0x3f4f68[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x246e05[_0x6d5d('0x34')],qs['fields'](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3a')]));_0x3f4f68[_0x6d5d('0x39')]=_0x3f4f68[_0x6d5d('0x39')]['length']?_0x3f4f68[_0x6d5d('0x39')]:_0x246e05[_0x6d5d('0x34')];_0x3f4f68['order']=qs[_0x6d5d('0x3c')](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x3f4f68[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x40c8ba[_0x6d5d('0x35')],_0x246e05[_0x6d5d('0x37')]));if(_0x40c8ba['query'][_0x6d5d('0x3f')]){_0x3f4f68[_0x6d5d('0x3d')]=_[_0x6d5d('0x40')](_0x3f4f68[_0x6d5d('0x3d')],{'$or':_[_0x6d5d('0x30')](_0x3f4f68[_0x6d5d('0x39')],function(_0x1ba9fd){var _0x4bf76a={};_0x4bf76a[_0x1ba9fd]={'$like':'%'+_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3f')]+'%'};return _0x4bf76a;})});}_0x3f4f68=_[_0x6d5d('0x40')]({},_0x3f4f68,_0x40c8ba['options']);return _0x564b3f[_0x6d5d('0x82')](_0x3f4f68);}})[_0x6d5d('0x28')](function(_0x128d54){if(_0x128d54){_0x3d8bc7=_0x128d54['length'];if(!_0x40c8ba['query'][_0x6d5d('0x62')](_0x6d5d('0x3b'))){_0x3f4f68['limit']=qs[_0x6d5d('0x22')](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x3f4f68[_0x6d5d('0x20')]=qs['offset'](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x20')]);}return _0x564b3f['getAgents'](_0x3f4f68);}})[_0x6d5d('0x28')](function(_0x3c6570){if(_0x3c6570){return _0x3c6570?{'count':_0x3d8bc7,'rows':_0x3c6570}:null;}})[_0x6d5d('0x28')](respondWithResult(_0x3048b5,null))['catch'](handleError(_0x3048b5,null));}; \ No newline at end of file +var _0xc24d=['desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','keys','length','include','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','params','describe','UserFaxQueue','nolimit','pick','User','findAndCountAll','UserId','updatedAt','createdAt','format','findOne','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','userFaxQueue:remove','addAgents','userFaxQueue:save','removeAgents','isArray','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x4c7dd2,_0x40f6d5){var _0x563573=function(_0x3d6524){while(--_0x3d6524){_0x4c7dd2['push'](_0x4c7dd2['shift']());}};_0x563573(++_0x40f6d5);}(_0xc24d,0x106));var _0xdc24=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xc24d[_0x547add];return _0x2ed1f3;};'use strict';var emlformat=require(_0xdc24('0x0'));var rimraf=require(_0xdc24('0x1'));var zipdir=require(_0xdc24('0x2'));var jsonpatch=require(_0xdc24('0x3'));var rp=require('request-promise');var moment=require(_0xdc24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdc24('0x5'));var util=require('util');var path=require(_0xdc24('0x6'));var sox=require(_0xdc24('0x7'));var csv=require(_0xdc24('0x8'));var ejs=require(_0xdc24('0x9'));var fs=require('fs');var fs_extra=require(_0xdc24('0xa'));var _=require('lodash');var squel=require(_0xdc24('0xb'));var crypto=require(_0xdc24('0xc'));var jsforce=require(_0xdc24('0xd'));var deskjs=require(_0xdc24('0xe'));var toCsv=require(_0xdc24('0x8'));var querystring=require('querystring');var Papa=require(_0xdc24('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdc24('0x10'));var as=require(_0xdc24('0x11'));var hardwareService=require(_0xdc24('0x12'));var logger=require(_0xdc24('0x13'))('api');var utils=require(_0xdc24('0x14'));var config=require(_0xdc24('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc24('0x16'))['db'];config['redis']=_['defaults'](config[_0xdc24('0x17')],{'host':_0xdc24('0x18'),'port':0x18eb});var socket=require(_0xdc24('0x19'))(new Redis(config[_0xdc24('0x17')]));require(_0xdc24('0x1a'))[_0xdc24('0x1b')](socket);function respondWithStatusCode(_0x3309e2,_0x239a45){_0x239a45=_0x239a45||0xcc;return function(_0x373cfb){if(_0x373cfb){return _0x3309e2[_0xdc24('0x1c')](_0x239a45);}return _0x3309e2[_0xdc24('0x1d')](_0x239a45)[_0xdc24('0x1e')]();};}function respondWithResult(_0x305e46,_0x59d573){_0x59d573=_0x59d573||0xc8;return function(_0x5510ea){if(_0x5510ea){return _0x305e46['status'](_0x59d573)[_0xdc24('0x1f')](_0x5510ea);}};}function respondWithFilteredResult(_0x533ac5,_0x3a6373){return function(_0x5136ac){if(_0x5136ac){var _0x25c9e0=typeof _0x3a6373['offset']==='undefined'&&typeof _0x3a6373[_0xdc24('0x20')]===_0xdc24('0x21');var _0x3a33d0=_0x5136ac[_0xdc24('0x22')];var _0x431f1e=_0x25c9e0?0x0:_0x3a6373[_0xdc24('0x23')];var _0xdf376a=_0x25c9e0?_0x5136ac['count']:_0x3a6373['offset']+_0x3a6373[_0xdc24('0x20')];var _0x21fc3e;if(_0xdf376a>=_0x3a33d0){_0xdf376a=_0x3a33d0;_0x21fc3e=0xc8;}else{_0x21fc3e=0xce;}_0x533ac5[_0xdc24('0x1d')](_0x21fc3e);return _0x533ac5[_0xdc24('0x24')]('Content-Range',_0x431f1e+'-'+_0xdf376a+'/'+_0x3a33d0)[_0xdc24('0x1f')](_0x5136ac);}return null;};}function patchUpdates(_0x6c2e9d){return function(_0x7a9dee){try{jsonpatch[_0xdc24('0x25')](_0x7a9dee,_0x6c2e9d,!![]);}catch(_0x394e40){return BPromise[_0xdc24('0x26')](_0x394e40);}return _0x7a9dee[_0xdc24('0x27')]();};}function saveUpdates(_0x59b7ec,_0x21222d){return function(_0x52d9c3){if(_0x52d9c3){return _0x52d9c3[_0xdc24('0x28')](_0x59b7ec)[_0xdc24('0x29')](function(_0x4ee8d9){return _0x4ee8d9;});}return null;};}function removeEntity(_0x1405a2,_0x4c055e){return function(_0x1c2471){if(_0x1c2471){return _0x1c2471[_0xdc24('0x2a')]()[_0xdc24('0x29')](function(){var _0x339c84=_0x1c2471['get']({'plain':!![]});var _0x216482=_0xdc24('0x2b');return db[_0xdc24('0x2c')][_0xdc24('0x2a')]({'where':{'type':_0x216482,'resourceId':_0x339c84['id']}})[_0xdc24('0x29')](function(){return _0x1c2471;});})[_0xdc24('0x29')](function(){_0x1405a2['status'](0xcc)[_0xdc24('0x1e')]();});}};}function handleEntityNotFound(_0x2e1efd,_0x371dd7){return function(_0x16ad90){if(!_0x16ad90){_0x2e1efd[_0xdc24('0x1c')](0x194);}return _0x16ad90;};}function handleError(_0x1c6b45,_0x2d0c70){_0x2d0c70=_0x2d0c70||0x1f4;return function(_0x45af0c){logger[_0xdc24('0x2d')](_0x45af0c[_0xdc24('0x2e')]);if(_0x45af0c[_0xdc24('0x2f')]){delete _0x45af0c[_0xdc24('0x2f')];}_0x1c6b45[_0xdc24('0x1d')](_0x2d0c70)[_0xdc24('0x30')](_0x45af0c);};}exports[_0xdc24('0x31')]=function(_0x54b694,_0xbe8e61){var _0x5f15d7={},_0x4566c4={},_0x399657={'count':0x0,'rows':[]};var _0x193007=_['map'](db[_0xdc24('0x32')][_0xdc24('0x33')],function(_0x3d77cb){return{'name':_0x3d77cb[_0xdc24('0x34')],'type':_0x3d77cb[_0xdc24('0x35')][_0xdc24('0x36')]};});_0x4566c4[_0xdc24('0x37')]=_[_0xdc24('0x38')](_0x193007,_0xdc24('0x2f'));_0x4566c4[_0xdc24('0x39')]=_['keys'](_0x54b694['query']);_0x4566c4[_0xdc24('0x3a')]=_['intersection'](_0x4566c4[_0xdc24('0x37')],_0x4566c4[_0xdc24('0x39')]);_0x5f15d7['attributes']=_[_0xdc24('0x3b')](_0x4566c4[_0xdc24('0x37')],qs[_0xdc24('0x3c')](_0x54b694[_0xdc24('0x39')]['fields']));_0x5f15d7[_0xdc24('0x3d')]=_0x5f15d7['attributes']['length']?_0x5f15d7[_0xdc24('0x3d')]:_0x4566c4['model'];if(!_0x54b694[_0xdc24('0x39')]['hasOwnProperty']('nolimit')){_0x5f15d7[_0xdc24('0x20')]=qs[_0xdc24('0x20')](_0x54b694[_0xdc24('0x39')]['limit']);_0x5f15d7[_0xdc24('0x23')]=qs['offset'](_0x54b694[_0xdc24('0x39')]['offset']);}_0x5f15d7[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0x54b694[_0xdc24('0x39')][_0xdc24('0x3f')]);_0x5f15d7[_0xdc24('0x40')]=qs[_0xdc24('0x3a')](_['pick'](_0x54b694[_0xdc24('0x39')],_0x4566c4[_0xdc24('0x3a')]),_0x193007);if(_0x54b694[_0xdc24('0x39')][_0xdc24('0x41')]){_0x5f15d7[_0xdc24('0x40')]=_[_0xdc24('0x42')](_0x5f15d7[_0xdc24('0x40')],{'$or':_[_0xdc24('0x38')](_0x193007,function(_0x2d3d9e){if(_0x2d3d9e[_0xdc24('0x35')]!==_0xdc24('0x43')){var _0x28b5c3={};_0x28b5c3[_0x2d3d9e[_0xdc24('0x2f')]]={'$like':'%'+_0x54b694[_0xdc24('0x39')]['filter']+'%'};return _0x28b5c3;}})});}_0x5f15d7=_[_0xdc24('0x42')]({},_0x5f15d7,_0x54b694['options']);var _0x532cac={'where':_0x5f15d7[_0xdc24('0x40')]};return db[_0xdc24('0x32')][_0xdc24('0x22')](_0x532cac)[_0xdc24('0x29')](function(_0x47eff8){_0x399657[_0xdc24('0x22')]=_0x47eff8;if(_0x54b694[_0xdc24('0x39')][_0xdc24('0x44')]){_0x5f15d7['include']=[{'all':!![]}];}return db['FaxQueue'][_0xdc24('0x45')](_0x5f15d7);})[_0xdc24('0x29')](function(_0x45a59b){_0x399657[_0xdc24('0x46')]=_0x45a59b;return _0x399657;})[_0xdc24('0x29')](respondWithFilteredResult(_0xbe8e61,_0x5f15d7))['catch'](handleError(_0xbe8e61,null));};exports[_0xdc24('0x47')]=function(_0x50833b,_0x1def9e){var _0x2d2b56={'raw':!![],'where':{'id':_0x50833b['params']['id']}},_0x3a7ba4={};_0x3a7ba4[_0xdc24('0x37')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x3a7ba4[_0xdc24('0x39')]=_[_0xdc24('0x48')](_0x50833b[_0xdc24('0x39')]);_0x3a7ba4[_0xdc24('0x3a')]=_['intersection'](_0x3a7ba4[_0xdc24('0x37')],_0x3a7ba4[_0xdc24('0x39')]);_0x2d2b56[_0xdc24('0x3d')]=_[_0xdc24('0x3b')](_0x3a7ba4[_0xdc24('0x37')],qs[_0xdc24('0x3c')](_0x50833b[_0xdc24('0x39')][_0xdc24('0x3c')]));_0x2d2b56[_0xdc24('0x3d')]=_0x2d2b56[_0xdc24('0x3d')][_0xdc24('0x49')]?_0x2d2b56['attributes']:_0x3a7ba4['model'];if(_0x50833b['query'][_0xdc24('0x44')]){_0x2d2b56[_0xdc24('0x4a')]=[{'all':!![]}];}_0x2d2b56=_[_0xdc24('0x42')]({},_0x2d2b56,_0x50833b[_0xdc24('0x4b')]);return db['FaxQueue']['find'](_0x2d2b56)['then'](handleEntityNotFound(_0x1def9e,null))[_0xdc24('0x29')](respondWithResult(_0x1def9e,null))[_0xdc24('0x4c')](handleError(_0x1def9e,null));};exports[_0xdc24('0x4d')]=function(_0x5375b1,_0x289d15){return db[_0xdc24('0x32')][_0xdc24('0x4d')](_0x5375b1[_0xdc24('0x4e')],{})[_0xdc24('0x29')](function(_0x5ead6a){var _0x1b1532=_0x5375b1[_0xdc24('0x4f')][_0xdc24('0x50')]({'plain':!![]});if(!_0x1b1532)throw new Error(_0xdc24('0x51'));if(_0x1b1532[_0xdc24('0x52')]===_0xdc24('0x4f')){var _0x56f308=_0x5ead6a[_0xdc24('0x50')]({'plain':!![]});var _0x1438e7=_0xdc24('0x2b');return db[_0xdc24('0x53')][_0xdc24('0x54')]({'where':{'name':_0x1438e7,'userProfileId':_0x1b1532['userProfileId']},'raw':!![]})[_0xdc24('0x29')](function(_0x57c5b3){if(_0x57c5b3&&_0x57c5b3[_0xdc24('0x55')]===0x0){return db[_0xdc24('0x2c')][_0xdc24('0x4d')]({'name':_0x56f308['name'],'resourceId':_0x56f308['id'],'type':_0x57c5b3[_0xdc24('0x2f')],'sectionId':_0x57c5b3['id']},{})[_0xdc24('0x29')](function(){return _0x5ead6a;});}else{return _0x5ead6a;}})['catch'](function(_0x3ab0f3){logger[_0xdc24('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f3);throw _0x3ab0f3;});}return _0x5ead6a;})[_0xdc24('0x29')](respondWithResult(_0x289d15,0xc9))[_0xdc24('0x4c')](handleError(_0x289d15,null));};exports[_0xdc24('0x28')]=function(_0x23f05b,_0xd091d7){if(_0x23f05b['body']['id']){delete _0x23f05b[_0xdc24('0x4e')]['id'];}return db[_0xdc24('0x32')][_0xdc24('0x54')]({'where':{'id':_0x23f05b[_0xdc24('0x56')]['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0xd091d7,null))[_0xdc24('0x29')](saveUpdates(_0x23f05b[_0xdc24('0x4e')],null))[_0xdc24('0x29')](respondWithResult(_0xd091d7,null))[_0xdc24('0x4c')](handleError(_0xd091d7,null));};exports[_0xdc24('0x2a')]=function(_0x13f678,_0x39f09c){return db[_0xdc24('0x32')][_0xdc24('0x54')]({'where':{'id':_0x13f678[_0xdc24('0x56')]['id']}})['then'](handleEntityNotFound(_0x39f09c,null))[_0xdc24('0x29')](removeEntity(_0x39f09c,null))[_0xdc24('0x4c')](handleError(_0x39f09c,null));};exports[_0xdc24('0x57')]=function(_0x536c8c,_0x1390eb){return db[_0xdc24('0x32')][_0xdc24('0x57')]()[_0xdc24('0x29')](respondWithResult(_0x1390eb,null))[_0xdc24('0x4c')](handleError(_0x1390eb,null));};exports['getMembers']=function(_0x2c6810,_0x3c5aab,_0x24a3c5){var _0x19bfd8={'raw':!![],'where':{}},_0x19643b={},_0x4acfd3;return db['FaxQueue']['findOne']({'where':{'id':_0x2c6810[_0xdc24('0x56')]['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0x3c5aab,null))[_0xdc24('0x29')](function(_0xa4c518){if(_0xa4c518){_0x4acfd3=_0xa4c518[_0xdc24('0x50')]({'plain':!![]});_0x19643b[_0xdc24('0x37')]=_['keys'](db[_0xdc24('0x58')]['rawAttributes']);_0x19643b[_0xdc24('0x39')]=_[_0xdc24('0x48')](_0x2c6810[_0xdc24('0x39')]);_0x19643b[_0xdc24('0x3a')]=_[_0xdc24('0x3b')](_0x19643b[_0xdc24('0x37')],_0x19643b[_0xdc24('0x39')]);_0x19bfd8['attributes']=_[_0xdc24('0x3b')](_0x19643b[_0xdc24('0x37')],qs[_0xdc24('0x3c')](_0x2c6810[_0xdc24('0x39')][_0xdc24('0x3c')]));_0x19bfd8[_0xdc24('0x3d')]=_0x19bfd8['attributes'][_0xdc24('0x49')]?_0x19bfd8[_0xdc24('0x3d')]:_0x19643b['model'];if(!_0x2c6810[_0xdc24('0x39')]['hasOwnProperty'](_0xdc24('0x59'))){_0x19bfd8['limit']=qs[_0xdc24('0x20')](_0x2c6810['query'][_0xdc24('0x20')]);_0x19bfd8[_0xdc24('0x23')]=qs[_0xdc24('0x23')](_0x2c6810[_0xdc24('0x39')][_0xdc24('0x23')]);}_0x19bfd8[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0x2c6810[_0xdc24('0x39')][_0xdc24('0x3f')]);_0x19bfd8['where']=qs['filters'](_[_0xdc24('0x5a')](_0x2c6810[_0xdc24('0x39')],_0x19643b[_0xdc24('0x3a')]));_0x19bfd8[_0xdc24('0x40')]['FaxQueueId']=_0xa4c518['id'];if(_0x2c6810[_0xdc24('0x39')][_0xdc24('0x41')]){_0x19bfd8[_0xdc24('0x40')]=_['merge'](_0x19bfd8['where'],{'$or':_[_0xdc24('0x38')](_0x19bfd8[_0xdc24('0x3d')],function(_0x3ea5d4){var _0x58ac66={};_0x58ac66[_0x3ea5d4]={'$like':'%'+_0x2c6810[_0xdc24('0x39')][_0xdc24('0x41')]+'%'};return _0x58ac66;})});}_0x19bfd8=_[_0xdc24('0x42')]({},_0x19bfd8,_0x2c6810[_0xdc24('0x4b')]);return db[_0xdc24('0x58')][_0xdc24('0x45')](_0x19bfd8);}})[_0xdc24('0x29')](function(_0x26d921){if(_0x26d921){return db[_0xdc24('0x5b')][_0xdc24('0x5c')]({'where':{'id':_['map'](_0x26d921,_0xdc24('0x5d')),'role':'agent'},'attributes':['id','name','faxPause',_0xdc24('0x5e'),_0xdc24('0x5f')]});}})['then'](function(_0x3f894c){if(_0x3f894c){return{'count':_0x3f894c[_0xdc24('0x22')],'rows':_[_0xdc24('0x38')](_0x3f894c['rows'],function(_0x2e5048){return{'membername':_0x2e5048[_0xdc24('0x2f')],'UserId':_0x2e5048['id'],'queue_name':_0x4acfd3['name'],'FaxQueueId':_0x4acfd3['id'],'interface':util[_0xdc24('0x60')]('%s/%s','SIP',_0x2e5048['name']),'penalty':0x0,'paused':_0x2e5048['faxPause'],'createdAt':_0x2e5048[_0xdc24('0x5f')],'updatedAt':_0x2e5048[_0xdc24('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c5aab,_0x19bfd8))[_0xdc24('0x4c')](handleError(_0x3c5aab,null));};exports['getTeams']=function(_0xcf10a,_0x469e98,_0x18cd06){var _0x2d5fa2={};var _0x5dc0d8={};var _0x4167ba;var _0x1c99f6;return db['FaxQueue'][_0xdc24('0x61')]({'where':{'id':_0xcf10a['params']['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0x469e98,null))[_0xdc24('0x29')](function(_0x5a78d8){if(_0x5a78d8){_0x4167ba=_0x5a78d8;_0x5dc0d8['model']=_[_0xdc24('0x48')](db[_0xdc24('0x62')]['rawAttributes']);_0x5dc0d8[_0xdc24('0x39')]=_[_0xdc24('0x48')](_0xcf10a[_0xdc24('0x39')]);_0x5dc0d8['filters']=_['intersection'](_0x5dc0d8[_0xdc24('0x37')],_0x5dc0d8['query']);_0x2d5fa2[_0xdc24('0x3d')]=_[_0xdc24('0x3b')](_0x5dc0d8['model'],qs[_0xdc24('0x3c')](_0xcf10a[_0xdc24('0x39')][_0xdc24('0x3c')]));_0x2d5fa2[_0xdc24('0x3d')]=_0x2d5fa2[_0xdc24('0x3d')][_0xdc24('0x49')]?_0x2d5fa2[_0xdc24('0x3d')]:_0x5dc0d8['model'];_0x2d5fa2[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0xcf10a[_0xdc24('0x39')]['sort']);_0x2d5fa2['where']=qs[_0xdc24('0x3a')](_[_0xdc24('0x5a')](_0xcf10a[_0xdc24('0x39')],_0x5dc0d8['filters']));if(_0xcf10a[_0xdc24('0x39')]['filter']){_0x2d5fa2[_0xdc24('0x40')]=_[_0xdc24('0x42')](_0x2d5fa2['where'],{'$or':_[_0xdc24('0x38')](_0x2d5fa2[_0xdc24('0x3d')],function(_0x1d28cc){var _0x5530b7={};_0x5530b7[_0x1d28cc]={'$like':'%'+_0xcf10a[_0xdc24('0x39')][_0xdc24('0x41')]+'%'};return _0x5530b7;})});}_0x2d5fa2=_[_0xdc24('0x42')]({},_0x2d5fa2,_0xcf10a[_0xdc24('0x4b')]);return _0x4167ba[_0xdc24('0x63')](_0x2d5fa2);}})['then'](function(_0x5446ff){if(_0x5446ff){_0x1c99f6=_0x5446ff['length'];if(!_0xcf10a['query']['hasOwnProperty'](_0xdc24('0x59'))){_0x2d5fa2[_0xdc24('0x20')]=qs[_0xdc24('0x20')](_0xcf10a['query'][_0xdc24('0x20')]);_0x2d5fa2['offset']=qs[_0xdc24('0x23')](_0xcf10a[_0xdc24('0x39')][_0xdc24('0x23')]);}return _0x4167ba[_0xdc24('0x63')](_0x2d5fa2);}})[_0xdc24('0x29')](function(_0x100358){if(_0x100358){return _0x100358?{'count':_0x1c99f6,'rows':_0x100358}:null;}})['then'](respondWithResult(_0x469e98,null))[_0xdc24('0x4c')](handleError(_0x469e98,null));};exports['addTeams']=function(_0x328de9,_0xbb051e,_0x13939d){var _0x545059=_0x328de9[_0xdc24('0x4e')][_0xdc24('0x64')];return db['Team'][_0xdc24('0x45')]({'where':{'id':_0x545059},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdc24('0x65'),'attributes':['id',_0xdc24('0x2f'),_0xdc24('0x66'),_0xdc24('0x67'),_0xdc24('0x68')],'raw':!![]}]})[_0xdc24('0x29')](function(_0x2836a9){if(_0x2836a9){var _0x26a693=_[_0xdc24('0x69')](_0x2836a9,function(_0x1ba032){var _0x182280=_0x1ba032[_0xdc24('0x50')]({'plain':!![]});return _0x182280[_0xdc24('0x65')];});return db[_0xdc24('0x32')][_0xdc24('0x54')]({'where':{'id':_0x328de9[_0xdc24('0x56')]['id']}})[_0xdc24('0x29')](function(_0x1e2d70){return db['sequelize'][_0xdc24('0x6a')](function(_0x4a6ecc){return _0x1e2d70[_0xdc24('0x6b')](_0x545059,{'transaction':_0x4a6ecc})['then'](function(){return BPromise[_0xdc24('0x6c')](_0x26a693,function(_0x11c0a8){return db[_0xdc24('0x58')][_0xdc24('0x6d')]({'where':{'UserId':_0x11c0a8['id'],'FaxQueueId':_0x328de9[_0xdc24('0x56')]['id']},'transaction':_0x4a6ecc});});})[_0xdc24('0x29')](function(){_0x26a693[_0xdc24('0x6e')](function(_0x586d68){socket[_0xdc24('0x6f')]('userFaxQueue:save',{'UserId':_0x586d68['id'],'FaxQueueId':_0x1e2d70['id']});});});});});}})[_0xdc24('0x29')](respondWithStatusCode(_0xbb051e,null))[_0xdc24('0x4c')](handleError(_0xbb051e,null));};exports['removeTeams']=function(_0x2bf7e7,_0x41c03d,_0x416abd){return db[_0xdc24('0x62')]['findAll']({'where':{'id':_0x2bf7e7[_0xdc24('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xdc24('0x5b')],'as':_0xdc24('0x65'),'attributes':['id'],'raw':!![]}]})[_0xdc24('0x29')](handleEntityNotFound(_0x41c03d,null))[_0xdc24('0x29')](function(_0x5c529e){var _0x1de575=_[_0xdc24('0x38')](_0x5c529e,'id');var _0x328d01=[];var _0x3a9551=[];var _0x1aa388=squel['select']();_0x1aa388['field'](_0xdc24('0x70'))[_0xdc24('0x71')]('team_has_fax_queues','tq')[_0xdc24('0x72')](_0xdc24('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xdc24('0x40')]('FaxQueueId\x20=\x20?',_0x2bf7e7[_0xdc24('0x56')]['id']);for(var _0x5bb143=0x0;_0x5bb143<_0x5c529e[_0xdc24('0x49')];_0x5bb143+=0x1){let _0x3252c7=_0x5c529e[_0x5bb143];for(var _0x17e2c3=0x0;_0x17e2c3<_0x3252c7[_0xdc24('0x65')][_0xdc24('0x49')];_0x17e2c3+=0x1){let _0x1a64c9=_0x3252c7['Agents'][_0x17e2c3];var _0x12d14d=_0x1aa388[_0xdc24('0x74')]();_0x12d14d[_0xdc24('0x40')](_0xdc24('0x75'),_0x1a64c9['id']);_0x3a9551[_0xdc24('0x76')](db[_0xdc24('0x77')][_0xdc24('0x39')](_0x12d14d[_0xdc24('0x78')](),{'type':db['sequelize'][_0xdc24('0x79')][_0xdc24('0x7a')]})[_0xdc24('0x29')](function(_0x19f497){if(_0x19f497[_0xdc24('0x49')]===0x1){return _0x1a64c9['id'];}else{var _0xc7942d=_[_0xdc24('0x7b')](_[_0xdc24('0x38')](_0x19f497,_0xdc24('0x7c')),function(_0x5766dc){return _[_0xdc24('0x7d')](_0x1de575,_0x5766dc);});if(_0xc7942d){return _0x1a64c9['id'];}}}));}}return BPromise[_0xdc24('0x7e')](_0x3a9551)[_0xdc24('0x29')](function(_0x34791d){_0x328d01=_(_0x328d01)[_0xdc24('0x7f')](_0x34791d)[_0xdc24('0x80')]()[_0xdc24('0x81')]();return db[_0xdc24('0x32')]['find']({'where':{'id':_0x2bf7e7['params']['id']}})[_0xdc24('0x29')](function(_0x31c94b){return db[_0xdc24('0x77')][_0xdc24('0x6a')](function(_0x44466b){return _0x31c94b[_0xdc24('0x82')](_0x2bf7e7['query'][_0xdc24('0x64')],{'transaction':_0x44466b})[_0xdc24('0x29')](function(){if(!_['isEmpty'](_0x328d01)){return _0x31c94b['removeAgents'](_0x328d01,{'transaction':_0x44466b});}})[_0xdc24('0x29')](function(){_0x328d01[_0xdc24('0x6e')](function(_0xdb5c88){socket[_0xdc24('0x6f')](_0xdc24('0x83'),{'UserId':_0xdb5c88,'FaxQueueId':_0x31c94b['id']});});});});});});})[_0xdc24('0x29')](respondWithStatusCode(_0x41c03d,null))['catch'](handleError(_0x41c03d,null));};exports[_0xdc24('0x84')]=function(_0x2f27f6,_0x99a77d,_0x1866b9){return db['FaxQueue'][_0xdc24('0x54')]({'where':{'id':_0x2f27f6['params']['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0x99a77d,null))[_0xdc24('0x29')](function(_0x336680){if(_0x336680){return _0x336680[_0xdc24('0x84')](_0x2f27f6['body'][_0xdc24('0x64')],_['omit'](_0x2f27f6[_0xdc24('0x4e')],[_0xdc24('0x64'),'id'])||{})['spread'](function(_0x38c4ee){for(var _0x90934b=0x0;_0x90934b<_0x2f27f6[_0xdc24('0x4e')][_0xdc24('0x64')][_0xdc24('0x49')];_0x90934b+=0x1){socket[_0xdc24('0x6f')](_0xdc24('0x85'),{'UserId':Number(_0x2f27f6[_0xdc24('0x4e')][_0xdc24('0x64')][_0x90934b]),'FaxQueueId':Number(_0x2f27f6[_0xdc24('0x56')]['id'])});}return _0x38c4ee;});}})[_0xdc24('0x29')](respondWithResult(_0x99a77d,null))[_0xdc24('0x4c')](handleError(_0x99a77d,null));};exports[_0xdc24('0x86')]=function(_0x1c08be,_0xa73fb2,_0x46bd55){return db[_0xdc24('0x32')][_0xdc24('0x54')]({'where':{'id':_0x1c08be[_0xdc24('0x56')]['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0xa73fb2,null))[_0xdc24('0x29')](function(_0x274f55){if(_0x274f55){return _0x274f55[_0xdc24('0x86')](_0x1c08be['query'][_0xdc24('0x64')])[_0xdc24('0x29')](function(){if(_[_0xdc24('0x87')](_0x1c08be['query']['ids'])){for(var _0x2f3b6f=0x0;_0x2f3b6f<_0x1c08be['query'][_0xdc24('0x64')][_0xdc24('0x49')];_0x2f3b6f+=0x1){socket['emit'](_0xdc24('0x83'),{'UserId':Number(_0x1c08be[_0xdc24('0x39')][_0xdc24('0x64')][_0x2f3b6f]),'FaxQueueId':Number(_0x1c08be[_0xdc24('0x56')]['id'])});}}else{socket['emit'](_0xdc24('0x83'),{'UserId':Number(_0x1c08be['query'][_0xdc24('0x64')]),'FaxQueueId':Number(_0x1c08be[_0xdc24('0x56')]['id'])});}});}})[_0xdc24('0x29')](respondWithStatusCode(_0xa73fb2,null))[_0xdc24('0x4c')](handleError(_0xa73fb2,null));};exports[_0xdc24('0x88')]=function(_0x5eca57,_0x9abaac,_0x25924c){var _0x9e1574={};var _0x31b3b3={};var _0x53914f;var _0x450736;return db[_0xdc24('0x32')][_0xdc24('0x61')]({'where':{'id':_0x5eca57['params']['id']}})[_0xdc24('0x29')](handleEntityNotFound(_0x9abaac,null))['then'](function(_0x518673){if(_0x518673){_0x53914f=_0x518673;_0x31b3b3[_0xdc24('0x37')]=_[_0xdc24('0x48')](db[_0xdc24('0x5b')][_0xdc24('0x33')]);_0x31b3b3[_0xdc24('0x39')]=_[_0xdc24('0x48')](_0x5eca57[_0xdc24('0x39')]);_0x31b3b3[_0xdc24('0x3a')]=_[_0xdc24('0x3b')](_0x31b3b3[_0xdc24('0x37')],_0x31b3b3[_0xdc24('0x39')]);_0x9e1574['attributes']=_[_0xdc24('0x3b')](_0x31b3b3[_0xdc24('0x37')],qs['fields'](_0x5eca57[_0xdc24('0x39')][_0xdc24('0x3c')]));_0x9e1574[_0xdc24('0x3d')]=_0x9e1574[_0xdc24('0x3d')][_0xdc24('0x49')]?_0x9e1574[_0xdc24('0x3d')]:_0x31b3b3[_0xdc24('0x37')];_0x9e1574[_0xdc24('0x3e')]=qs[_0xdc24('0x3f')](_0x5eca57[_0xdc24('0x39')]['sort']);_0x9e1574['where']=qs['filters'](_['pick'](_0x5eca57[_0xdc24('0x39')],_0x31b3b3['filters']));if(_0x5eca57[_0xdc24('0x39')]['filter']){_0x9e1574[_0xdc24('0x40')]=_[_0xdc24('0x42')](_0x9e1574[_0xdc24('0x40')],{'$or':_[_0xdc24('0x38')](_0x9e1574['attributes'],function(_0x228d4e){var _0x3e5743={};_0x3e5743[_0x228d4e]={'$like':'%'+_0x5eca57[_0xdc24('0x39')][_0xdc24('0x41')]+'%'};return _0x3e5743;})});}_0x9e1574=_[_0xdc24('0x42')]({},_0x9e1574,_0x5eca57[_0xdc24('0x4b')]);return _0x53914f['getAgents'](_0x9e1574);}})[_0xdc24('0x29')](function(_0x3428ce){if(_0x3428ce){_0x450736=_0x3428ce[_0xdc24('0x49')];if(!_0x5eca57[_0xdc24('0x39')][_0xdc24('0x89')]('nolimit')){_0x9e1574['limit']=qs[_0xdc24('0x20')](_0x5eca57['query'][_0xdc24('0x20')]);_0x9e1574[_0xdc24('0x23')]=qs[_0xdc24('0x23')](_0x5eca57[_0xdc24('0x39')][_0xdc24('0x23')]);}return _0x53914f[_0xdc24('0x88')](_0x9e1574);}})['then'](function(_0x5da59c){if(_0x5da59c){return _0x5da59c?{'count':_0x450736,'rows':_0x5da59c}:null;}})[_0xdc24('0x29')](respondWithResult(_0x9abaac,null))[_0xdc24('0x4c')](handleError(_0x9abaac,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3e1d83c..bda64c9 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 _0x7e60=['emit','hasOwnProperty','events','../../mysqldb','FaxQueue','save','update','remove'];(function(_0x52e359,_0x70089d){var _0x473cca=function(_0x2e4c10){while(--_0x2e4c10){_0x52e359['push'](_0x52e359['shift']());}};_0x473cca(++_0x70089d);}(_0x7e60,0x142));var _0x07e6=function(_0x51f3d6,_0x572b62){_0x51f3d6=_0x51f3d6-0x0;var _0x2f0dfa=_0x7e60[_0x51f3d6];return _0x2f0dfa;};'use strict';var EventEmitter=require(_0x07e6('0x0'));var FaxQueue=require(_0x07e6('0x1'))['db'][_0x07e6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07e6('0x3'),'afterUpdate':_0x07e6('0x4'),'afterDestroy':_0x07e6('0x5')};function emitEvent(_0x4dda6f){return function(_0x1b88c3,_0x3a7cab,_0x3113b5){FaxQueueEvents[_0x07e6('0x6')](_0x4dda6f+':'+_0x1b88c3['id'],_0x1b88c3);FaxQueueEvents[_0x07e6('0x6')](_0x4dda6f,_0x1b88c3);_0x3113b5(null);};}for(var e in events){if(events[_0x07e6('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xe149=['FaxQueue','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x165873,_0xf4b08c){var _0x45923b=function(_0x383083){while(--_0x383083){_0x165873['push'](_0x165873['shift']());}};_0x45923b(++_0xf4b08c);}(_0xe149,0xb4));var _0x9e14=function(_0x64d162,_0x4428cb){_0x64d162=_0x64d162-0x0;var _0x2a1889=_0xe149[_0x64d162];return _0x2a1889;};'use strict';var EventEmitter=require(_0x9e14('0x0'));var FaxQueue=require(_0x9e14('0x1'))['db'][_0x9e14('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10284e){return function(_0x2d5114,_0x3e7a14,_0x5be035){FaxQueueEvents[_0x9e14('0x3')](_0x10284e+':'+_0x2d5114['id'],_0x2d5114);FaxQueueEvents['emit'](_0x10284e,_0x2d5114);_0x5be035(null);};}for(var e in events){if(events[_0x9e14('0x4')](e)){var event=events[e];FaxQueue[_0x9e14('0x5')](e,emitEvent(event));}}module[_0x9e14('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ffef433..361de13 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 _0x24db=['./faxQueue.attributes','FaxQueue','lodash','util','../../config/logger','api','moment','path'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x24db,0xa2));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var util=require(_0xb24d('0x1'));var logger=require(_0xb24d('0x2'))(_0xb24d('0x3'));var moment=require(_0xb24d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb24d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb24d('0x6'));module['exports']=function(_0x1c2594,_0x8c709c){return _0x1c2594['define'](_0xb24d('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f1a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','lodash','../../config/logger'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x6f1a,0x8e));var _0xa6f1=function(_0x7e79bc,_0x795e31){_0x7e79bc=_0x7e79bc-0x0;var _0x49cd92=_0x6f1a[_0x7e79bc];return _0x49cd92;};'use strict';var _=require(_0xa6f1('0x0'));var util=require('util');var logger=require(_0xa6f1('0x1'))('api');var moment=require(_0xa6f1('0x2'));var BPromise=require(_0xa6f1('0x3'));var rp=require(_0xa6f1('0x4'));var fs=require('fs');var path=require(_0xa6f1('0x5'));var rimraf=require(_0xa6f1('0x6'));var config=require(_0xa6f1('0x7'));var attributes=require(_0xa6f1('0x8'));module[_0xa6f1('0x9')]=function(_0x416b1c,_0x5786b4){return _0x416b1c[_0xa6f1('0xa')](_0xa6f1('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 4ca2bb2..db81625 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 _0xfbc0=['register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','info','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x3431d3,_0x598e39){var _0x3ea7db=function(_0x2497d1){while(--_0x2497d1){_0x3431d3['push'](_0x3431d3['shift']());}};_0x3ea7db(++_0x598e39);}(_0xfbc0,0x103));var _0x0fbc=function(_0x568a34,_0x18e667){_0x568a34=_0x568a34-0x0;var _0x297ff4=_0xfbc0[_0x568a34];return _0x297ff4;};'use strict';var _=require(_0x0fbc('0x0'));var util=require('util');var moment=require(_0x0fbc('0x1'));var BPromise=require(_0x0fbc('0x2'));var rs=require(_0x0fbc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fbc('0x4'));var logger=require(_0x0fbc('0x5'))(_0x0fbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x0fbc('0x7'));var client=jayson[_0x0fbc('0x8')][_0x0fbc('0x9')]({'port':0x232a});config['redis']=_[_0x0fbc('0xa')](config['redis'],{'host':_0x0fbc('0xb'),'port':0x18eb});var socket=require(_0x0fbc('0xc'))(new Redis(config[_0x0fbc('0xd')]));require('./faxQueue.socket')[_0x0fbc('0xe')](socket);function respondWithRpcPromise(_0x3fbee7,_0x510e1c,_0x237a22){return new BPromise(function(_0x466506,_0x349fa1){return client[_0x0fbc('0xf')](_0x3fbee7,_0x237a22)[_0x0fbc('0x10')](function(_0x4c5288){logger['info'](_0x0fbc('0x11'),_0x510e1c,_0x0fbc('0x12'));logger[_0x0fbc('0x13')](_0x0fbc('0x14'),_0x510e1c,_0x0fbc('0x12'),JSON[_0x0fbc('0x15')](_0x4c5288));if(_0x4c5288[_0x0fbc('0x16')]){if(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x17')]===0x1f4){logger['error'](_0x0fbc('0x11'),_0x510e1c,_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);return _0x349fa1(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);}logger[_0x0fbc('0x16')]('FaxQueue,\x20%s,\x20%s',_0x510e1c,_0x4c5288[_0x0fbc('0x16')]['message']);return _0x466506(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);}else{logger['info'](_0x0fbc('0x11'),_0x510e1c,_0x0fbc('0x12'));_0x466506(_0x4c5288['result']['message']);}})[_0x0fbc('0x19')](function(_0x3c7d0e){logger['error'](_0x0fbc('0x11'),_0x510e1c,_0x3c7d0e);_0x349fa1(_0x3c7d0e);});});}exports[_0x0fbc('0x1a')]=function(_0x328315){var _0x588833=this;return new Promise(function(_0xd9023b,_0x19e591){return db[_0x0fbc('0x1b')]['findAll']({'raw':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x328315['options']?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1e')]||null:null,'attributes':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1f')]||null:null,'limit':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x20')]||null:null,'include':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x21')],function(_0x4f6326){return{'model':db[_0x4f6326[_0x0fbc('0x23')]],'as':_0x4f6326['as'],'attributes':_0x4f6326[_0x0fbc('0x1f')],'include':_0x4f6326[_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x4f6326['include'],function(_0x38267d){return{'model':db[_0x38267d[_0x0fbc('0x23')]],'as':_0x38267d['as'],'attributes':_0x38267d[_0x0fbc('0x1f')],'include':_0x38267d['include']?_[_0x0fbc('0x22')](_0x38267d['include'],function(_0x2707d9){return{'model':db[_0x2707d9[_0x0fbc('0x23')]],'as':_0x2707d9['as'],'attributes':_0x2707d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x0fbc('0x10')](function(_0x52dcf2){logger[_0x0fbc('0x24')]('GetFaxQueue',_0x328315);logger[_0x0fbc('0x13')](_0x0fbc('0x1a'),_0x328315,JSON[_0x0fbc('0x15')](_0x52dcf2));_0xd9023b(_0x52dcf2);})[_0x0fbc('0x19')](function(_0x255821){logger['error'](_0x0fbc('0x1a'),_0x255821['message'],_0x328315);_0x19e591(_0x588833[_0x0fbc('0x16')](0x1f4,_0x255821[_0x0fbc('0x18')]));});});};exports[_0x0fbc('0x25')]=function(_0x13210a){var _0x2b3ef0=this;return new Promise(function(_0x30da9d,_0x388e65){return db[_0x0fbc('0x1b')][_0x0fbc('0x26')]({'raw':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1e')]||null:null,'attributes':_0x13210a['options']?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1f')]||null:null,'include':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x13210a[_0x0fbc('0x1c')]['include'],function(_0x32fd8c){return{'model':db[_0x32fd8c[_0x0fbc('0x23')]],'as':_0x32fd8c['as'],'attributes':_0x32fd8c[_0x0fbc('0x1f')],'include':_0x32fd8c['include']?_[_0x0fbc('0x22')](_0x32fd8c[_0x0fbc('0x21')],function(_0x582005){return{'model':db[_0x582005[_0x0fbc('0x23')]],'as':_0x582005['as'],'attributes':_0x582005['attributes'],'include':_0x582005[_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x582005[_0x0fbc('0x21')],function(_0x372520){return{'model':db[_0x372520[_0x0fbc('0x23')]],'as':_0x372520['as'],'attributes':_0x372520[_0x0fbc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0fbc('0x10')](function(_0x19a91b){logger[_0x0fbc('0x24')](_0x0fbc('0x25'),_0x13210a);logger[_0x0fbc('0x13')](_0x0fbc('0x25'),_0x13210a,JSON[_0x0fbc('0x15')](_0x19a91b));_0x30da9d(_0x19a91b);})[_0x0fbc('0x19')](function(_0x1852f2){logger['error'](_0x0fbc('0x25'),_0x1852f2['message'],_0x13210a);_0x388e65(_0x2b3ef0['error'](0x1f4,_0x1852f2[_0x0fbc('0x18')]));});});}; \ No newline at end of file +var _0xfe88=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxQueue','ShowFaxQueue','find','stringify','lodash','util','moment','bluebird'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0xfe88,0xac));var _0x8fe8=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0xfe88[_0x578a80];return _0x4b4ba8;};'use strict';var _=require(_0x8fe8('0x0'));var util=require(_0x8fe8('0x1'));var moment=require(_0x8fe8('0x2'));var BPromise=require(_0x8fe8('0x3'));var rs=require(_0x8fe8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fe8('0x5'))['db'];var utils=require(_0x8fe8('0x6'));var logger=require(_0x8fe8('0x7'))(_0x8fe8('0x8'));var config=require(_0x8fe8('0x9'));var jayson=require(_0x8fe8('0xa'));var client=jayson[_0x8fe8('0xb')][_0x8fe8('0xc')]({'port':0x232a});config[_0x8fe8('0xd')]=_[_0x8fe8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8fe8('0xf'))(new Redis(config[_0x8fe8('0xd')]));require(_0x8fe8('0x10'))[_0x8fe8('0x11')](socket);function respondWithRpcPromise(_0x58c197,_0x2ccd92,_0x215e38){return new BPromise(function(_0x3071e9,_0x4e30dd){return client[_0x8fe8('0x12')](_0x58c197,_0x215e38)[_0x8fe8('0x13')](function(_0x5c0dca){logger[_0x8fe8('0x14')](_0x8fe8('0x15'),_0x2ccd92,_0x8fe8('0x16'));logger[_0x8fe8('0x17')](_0x8fe8('0x18'),_0x2ccd92,_0x8fe8('0x16'),JSON['stringify'](_0x5c0dca));if(_0x5c0dca[_0x8fe8('0x19')]){if(_0x5c0dca[_0x8fe8('0x19')][_0x8fe8('0x1a')]===0x1f4){logger[_0x8fe8('0x19')](_0x8fe8('0x15'),_0x2ccd92,_0x5c0dca[_0x8fe8('0x19')][_0x8fe8('0x1b')]);return _0x4e30dd(_0x5c0dca[_0x8fe8('0x19')][_0x8fe8('0x1b')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2ccd92,_0x5c0dca['error'][_0x8fe8('0x1b')]);return _0x3071e9(_0x5c0dca[_0x8fe8('0x19')]['message']);}else{logger[_0x8fe8('0x14')]('FaxQueue,\x20%s,\x20%s',_0x2ccd92,_0x8fe8('0x16'));_0x3071e9(_0x5c0dca[_0x8fe8('0x1c')]['message']);}})[_0x8fe8('0x1d')](function(_0x68ba2a){logger[_0x8fe8('0x19')](_0x8fe8('0x15'),_0x2ccd92,_0x68ba2a);_0x4e30dd(_0x68ba2a);});});}exports['GetFaxQueue']=function(_0x5f114c){var _0x2e8f9c=this;return new Promise(function(_0x363aa6,_0x3ec439){return db[_0x8fe8('0x1e')][_0x8fe8('0x1f')]({'raw':_0x5f114c[_0x8fe8('0x20')]?_0x5f114c[_0x8fe8('0x20')][_0x8fe8('0x21')]===undefined?!![]:![]:!![],'where':_0x5f114c[_0x8fe8('0x20')]?_0x5f114c['options'][_0x8fe8('0x22')]||null:null,'attributes':_0x5f114c['options']?_0x5f114c[_0x8fe8('0x20')][_0x8fe8('0x23')]||null:null,'limit':_0x5f114c[_0x8fe8('0x20')]?_0x5f114c[_0x8fe8('0x20')][_0x8fe8('0x24')]||null:null,'include':_0x5f114c[_0x8fe8('0x20')]?_0x5f114c[_0x8fe8('0x20')][_0x8fe8('0x25')]?_['map'](_0x5f114c[_0x8fe8('0x20')][_0x8fe8('0x25')],function(_0xff2f9a){return{'model':db[_0xff2f9a[_0x8fe8('0x26')]],'as':_0xff2f9a['as'],'attributes':_0xff2f9a[_0x8fe8('0x23')],'include':_0xff2f9a[_0x8fe8('0x25')]?_[_0x8fe8('0x27')](_0xff2f9a['include'],function(_0x36ca4d){return{'model':db[_0x36ca4d['model']],'as':_0x36ca4d['as'],'attributes':_0x36ca4d['attributes'],'include':_0x36ca4d['include']?_[_0x8fe8('0x27')](_0x36ca4d[_0x8fe8('0x25')],function(_0x400c98){return{'model':db[_0x400c98[_0x8fe8('0x26')]],'as':_0x400c98['as'],'attributes':_0x400c98[_0x8fe8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8fe8('0x13')](function(_0x557e74){logger[_0x8fe8('0x14')](_0x8fe8('0x28'),_0x5f114c);logger[_0x8fe8('0x17')]('GetFaxQueue',_0x5f114c,JSON['stringify'](_0x557e74));_0x363aa6(_0x557e74);})[_0x8fe8('0x1d')](function(_0x13a4d0){logger[_0x8fe8('0x19')]('GetFaxQueue',_0x13a4d0[_0x8fe8('0x1b')],_0x5f114c);_0x3ec439(_0x2e8f9c['error'](0x1f4,_0x13a4d0[_0x8fe8('0x1b')]));});});};exports[_0x8fe8('0x29')]=function(_0x51728b){var _0x4e8682=this;return new Promise(function(_0x1b9f11,_0x159632){return db[_0x8fe8('0x1e')][_0x8fe8('0x2a')]({'raw':_0x51728b[_0x8fe8('0x20')]?_0x51728b[_0x8fe8('0x20')][_0x8fe8('0x21')]===undefined?!![]:![]:!![],'where':_0x51728b[_0x8fe8('0x20')]?_0x51728b[_0x8fe8('0x20')][_0x8fe8('0x22')]||null:null,'attributes':_0x51728b[_0x8fe8('0x20')]?_0x51728b['options'][_0x8fe8('0x23')]||null:null,'include':_0x51728b['options']?_0x51728b['options']['include']?_[_0x8fe8('0x27')](_0x51728b[_0x8fe8('0x20')][_0x8fe8('0x25')],function(_0x173ade){return{'model':db[_0x173ade[_0x8fe8('0x26')]],'as':_0x173ade['as'],'attributes':_0x173ade[_0x8fe8('0x23')],'include':_0x173ade[_0x8fe8('0x25')]?_['map'](_0x173ade[_0x8fe8('0x25')],function(_0xe97600){return{'model':db[_0xe97600[_0x8fe8('0x26')]],'as':_0xe97600['as'],'attributes':_0xe97600['attributes'],'include':_0xe97600[_0x8fe8('0x25')]?_[_0x8fe8('0x27')](_0xe97600[_0x8fe8('0x25')],function(_0xa74cf1){return{'model':db[_0xa74cf1[_0x8fe8('0x26')]],'as':_0xa74cf1['as'],'attributes':_0xa74cf1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fe8('0x13')](function(_0x1663eb){logger[_0x8fe8('0x14')](_0x8fe8('0x29'),_0x51728b);logger[_0x8fe8('0x17')](_0x8fe8('0x29'),_0x51728b,JSON[_0x8fe8('0x2b')](_0x1663eb));_0x1b9f11(_0x1663eb);})['catch'](function(_0x4ef346){logger['error'](_0x8fe8('0x29'),_0x4ef346['message'],_0x51728b);_0x159632(_0x4e8682['error'](0x1f4,_0x4ef346['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7ef397b..7de5960 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 _0xaeab=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x496e8c,_0x589946){var _0x40d053=function(_0x312885){while(--_0x312885){_0x496e8c['push'](_0x496e8c['shift']());}};_0x40d053(++_0x589946);}(_0xaeab,0x91));var _0xbaea=function(_0x4502b9,_0x487ff0){_0x4502b9=_0x4502b9-0x0;var _0x24012f=_0xaeab[_0x4502b9];return _0x24012f;};'use strict';var FaxQueueEvents=require(_0xbaea('0x0'));var events=['save',_0xbaea('0x1'),'update'];function createListener(_0x2eb81e,_0x236fca){return function(_0x2e3da7){_0x236fca[_0xbaea('0x2')](_0x2eb81e,_0x2e3da7);};}function removeListener(_0x36e839,_0xbe1ff5){return function(){FaxQueueEvents[_0xbaea('0x3')](_0x36e839,_0xbe1ff5);};}exports[_0xbaea('0x4')]=function(_0x1ae44e){for(var _0x1e4331=0x0,_0x5bfed3=events[_0xbaea('0x5')];_0x1e4331<_0x5bfed3;_0x1e4331++){var _0x267afb=events[_0x1e4331];var _0x202d96=createListener(_0xbaea('0x6')+_0x267afb,_0x1ae44e);FaxQueueEvents['on'](_0x267afb,_0x202d96);}}; \ No newline at end of file +var _0xfd20=['register','faxQueue:','save','emit','removeListener'];(function(_0x5edeab,_0x50e246){var _0x19a78e=function(_0x4964e5){while(--_0x4964e5){_0x5edeab['push'](_0x5edeab['shift']());}};_0x19a78e(++_0x50e246);}(_0xfd20,0x66));var _0x0fd2=function(_0xa46cc9,_0x327f7d){_0xa46cc9=_0xa46cc9-0x0;var _0x5683ed=_0xfd20[_0xa46cc9];return _0x5683ed;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x0fd2('0x0'),'remove','update'];function createListener(_0x429df4,_0x28eb77){return function(_0x53caa3){_0x28eb77[_0x0fd2('0x1')](_0x429df4,_0x53caa3);};}function removeListener(_0x4c4975,_0x3661d3){return function(){FaxQueueEvents[_0x0fd2('0x2')](_0x4c4975,_0x3661d3);};}exports[_0x0fd2('0x3')]=function(_0xf25991){for(var _0x247d6e=0x0,_0x4d114c=events['length'];_0x247d6e<_0x4d114c;_0x247d6e++){var _0x32d460=events[_0x247d6e];var _0x15ba86=createListener(_0x0fd2('0x4')+_0x32d460,_0xf25991);FaxQueueEvents['on'](_0x32d460,_0x15ba86);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 54e525f..2515cc9 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 _0x71ab=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','create','post','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0x8')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0x8')]('/:id/members',auth[_0xb71a('0x9')](),controller['getMembers']);router[_0xb71a('0x8')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller['getTeams']);router[_0xb71a('0x8')]('/:id/users',auth[_0xb71a('0x9')](),controller['getAgents']);router['post']('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0x10')]);router[_0xb71a('0x11')](_0xb71a('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x13')]);router[_0xb71a('0x14')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x15')]);router[_0xb71a('0x16')](_0xb71a('0xd'),auth['isAuthenticated'](),controller[_0xb71a('0x17')]);router[_0xb71a('0x16')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x18')]);router[_0xb71a('0x16')](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x19')]);module[_0xb71a('0x1a')]=router; \ No newline at end of file +var _0x77a9=['../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x462c95,_0x4fca9c){var _0x2a99f5=function(_0x571bc4){while(--_0x571bc4){_0x462c95['push'](_0x462c95['shift']());}};_0x2a99f5(++_0x4fca9c);}(_0x77a9,0x19e));var _0x977a=function(_0x1cc197,_0xf3ac01){_0x1cc197=_0x1cc197-0x0;var _0x336d9f=_0x77a9[_0x1cc197];return _0x336d9f;};'use strict';var multer=require(_0x977a('0x0'));var util=require('util');var path=require(_0x977a('0x1'));var timeout=require('connect-timeout');var express=require(_0x977a('0x2'));var router=express[_0x977a('0x3')]();var fs_extra=require(_0x977a('0x4'));var auth=require(_0x977a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x977a('0x6'));var controller=require(_0x977a('0x7'));router[_0x977a('0x8')]('/',auth[_0x977a('0x9')](),controller[_0x977a('0xa')]);router['get']('/describe',auth[_0x977a('0x9')](),controller[_0x977a('0xb')]);router['get'](_0x977a('0xc'),auth[_0x977a('0x9')](),controller[_0x977a('0xd')]);router[_0x977a('0x8')](_0x977a('0xe'),auth[_0x977a('0x9')](),controller[_0x977a('0xf')]);router[_0x977a('0x8')](_0x977a('0x10'),auth[_0x977a('0x9')](),controller['getTeams']);router[_0x977a('0x8')](_0x977a('0x11'),auth[_0x977a('0x9')](),controller[_0x977a('0x12')]);router[_0x977a('0x13')]('/',auth[_0x977a('0x9')](),controller[_0x977a('0x14')]);router[_0x977a('0x13')](_0x977a('0x10'),auth[_0x977a('0x9')](),controller['addTeams']);router[_0x977a('0x13')]('/:id/users',auth[_0x977a('0x9')](),controller[_0x977a('0x15')]);router['put'](_0x977a('0xc'),auth[_0x977a('0x9')](),controller[_0x977a('0x16')]);router[_0x977a('0x17')]('/:id',auth[_0x977a('0x9')](),controller[_0x977a('0x18')]);router[_0x977a('0x17')]('/:id/teams',auth[_0x977a('0x9')](),controller[_0x977a('0x19')]);router['delete'](_0x977a('0x11'),auth['isAuthenticated'](),controller[_0x977a('0x1a')]);module[_0x977a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a7249ac..7b0f805 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 _0x45d4=['moment','exports','STRING','DATE'];(function(_0x2f15ee,_0x3b0aaa){var _0x35fcde=function(_0x37a659){while(--_0x37a659){_0x2f15ee['push'](_0x2f15ee['shift']());}};_0x35fcde(++_0x3b0aaa);}(_0x45d4,0x170));var _0x445d=function(_0x2c98f0,_0x3f204f){_0x2c98f0=_0x2c98f0-0x0;var _0x4eaf96=_0x45d4[_0x2c98f0];return _0x4eaf96;};'use strict';var moment=require(_0x445d('0x0'));var Sequelize=require('sequelize');module[_0x445d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x445d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x445d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x445d('0x2')]}}; \ No newline at end of file +var _0xf0cc=['exports','STRING','DATE','moment','sequelize'];(function(_0xb3c087,_0x1ccd90){var _0x4c0769=function(_0x293d7d){while(--_0x293d7d){_0xb3c087['push'](_0xb3c087['shift']());}};_0x4c0769(++_0x1ccd90);}(_0xf0cc,0xf3));var _0xcf0c=function(_0x565699,_0x1f6b75){_0x565699=_0x565699-0x0;var _0x425b8c=_0xf0cc[_0x565699];return _0x425b8c;};'use strict';var moment=require(_0xcf0c('0x0'));var Sequelize=require(_0xcf0c('0x1'));module[_0xcf0c('0x2')]={'uniqueid':{'type':Sequelize[_0xcf0c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcf0c('0x4')]},'leaveAt':{'type':Sequelize[_0xcf0c('0x4')]},'acceptAt':{'type':Sequelize[_0xcf0c('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcf0c('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f0694fa..627504e 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 _0x195e=['includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0x195e,0xfb));var _0xe195=function(_0xb7b10f,_0x174951){_0xb7b10f=_0xb7b10f-0x0;var _0x2b0dd0=_0x195e[_0xb7b10f];return _0x2b0dd0;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require(_0xe195('0x4'));var moment=require(_0xe195('0x5'));var BPromise=require(_0xe195('0x6'));var Mustache=require(_0xe195('0x7'));var util=require(_0xe195('0x8'));var path=require(_0xe195('0x9'));var sox=require(_0xe195('0xa'));var csv=require(_0xe195('0xb'));var ejs=require(_0xe195('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0xd'));var squel=require(_0xe195('0xe'));var crypto=require(_0xe195('0xf'));var jsforce=require(_0xe195('0x10'));var deskjs=require(_0xe195('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x16'))(_0xe195('0x17'));var utils=require(_0xe195('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe195('0x19'));var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0x5ae615,_0x3da7d9){_0x3da7d9=_0x3da7d9||0xcc;return function(_0x12fa0f){if(_0x12fa0f){return _0x5ae615[_0xe195('0x1b')](_0x3da7d9);}return _0x5ae615[_0xe195('0x1c')](_0x3da7d9)['end']();};}function respondWithResult(_0x52217d,_0x2e82d1){_0x2e82d1=_0x2e82d1||0xc8;return function(_0x555a6a){if(_0x555a6a){return _0x52217d['status'](_0x2e82d1)[_0xe195('0x1d')](_0x555a6a);}};}function respondWithFilteredResult(_0x5c444f,_0x232c57){return function(_0x542ac7){if(_0x542ac7){var _0x534879=typeof _0x232c57[_0xe195('0x1e')]===_0xe195('0x1f')&&typeof _0x232c57[_0xe195('0x20')]===_0xe195('0x1f');var _0x3a042f=_0x542ac7[_0xe195('0x21')];var _0x4784b1=_0x534879?0x0:_0x232c57[_0xe195('0x1e')];var _0x9c8ba5=_0x534879?_0x542ac7[_0xe195('0x21')]:_0x232c57['offset']+_0x232c57[_0xe195('0x20')];var _0x317d8b;if(_0x9c8ba5>=_0x3a042f){_0x9c8ba5=_0x3a042f;_0x317d8b=0xc8;}else{_0x317d8b=0xce;}_0x5c444f[_0xe195('0x1c')](_0x317d8b);return _0x5c444f[_0xe195('0x22')](_0xe195('0x23'),_0x4784b1+'-'+_0x9c8ba5+'/'+_0x3a042f)[_0xe195('0x1d')](_0x542ac7);}return null;};}function patchUpdates(_0x496722){return function(_0x1c5ac8){try{jsonpatch[_0xe195('0x24')](_0x1c5ac8,_0x496722,!![]);}catch(_0x334b4a){return BPromise[_0xe195('0x25')](_0x334b4a);}return _0x1c5ac8['save']();};}function saveUpdates(_0x4dab1a,_0x4e5f13){return function(_0x57ee33){if(_0x57ee33){return _0x57ee33[_0xe195('0x26')](_0x4dab1a)[_0xe195('0x27')](function(_0x2cb019){return _0x2cb019;});}return null;};}function removeEntity(_0x199148,_0x46b15b){return function(_0x40c6a2){if(_0x40c6a2){return _0x40c6a2[_0xe195('0x28')]()[_0xe195('0x27')](function(){_0x199148[_0xe195('0x1c')](0xcc)[_0xe195('0x29')]();});}};}function handleEntityNotFound(_0x55be2d,_0x36a566){return function(_0x58ea75){if(!_0x58ea75){_0x55be2d[_0xe195('0x1b')](0x194);}return _0x58ea75;};}function handleError(_0x334cb8,_0x147563){_0x147563=_0x147563||0x1f4;return function(_0x2a0504){logger[_0xe195('0x2a')](_0x2a0504[_0xe195('0x2b')]);if(_0x2a0504[_0xe195('0x2c')]){delete _0x2a0504[_0xe195('0x2c')];}_0x334cb8[_0xe195('0x1c')](_0x147563)[_0xe195('0x2d')](_0x2a0504);};}exports['index']=function(_0x33a08d,_0x3e228f){var _0x3199d0={},_0x1f72a2={},_0x283516={'count':0x0,'rows':[]};var _0x4e4d30=_['map'](db[_0xe195('0x2e')][_0xe195('0x2f')],function(_0x46b6f2){return{'name':_0x46b6f2[_0xe195('0x30')],'type':_0x46b6f2[_0xe195('0x31')][_0xe195('0x32')]};});_0x1f72a2['model']=_[_0xe195('0x33')](_0x4e4d30,_0xe195('0x2c'));_0x1f72a2[_0xe195('0x34')]=_['keys'](_0x33a08d[_0xe195('0x34')]);_0x1f72a2['filters']=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],_0x1f72a2['query']);_0x3199d0[_0xe195('0x37')]=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],qs['fields'](_0x33a08d[_0xe195('0x34')][_0xe195('0x38')]));_0x3199d0[_0xe195('0x37')]=_0x3199d0[_0xe195('0x37')][_0xe195('0x39')]?_0x3199d0[_0xe195('0x37')]:_0x1f72a2['model'];if(!_0x33a08d[_0xe195('0x34')][_0xe195('0x3a')](_0xe195('0x3b'))){_0x3199d0[_0xe195('0x20')]=qs[_0xe195('0x20')](_0x33a08d[_0xe195('0x34')][_0xe195('0x20')]);_0x3199d0['offset']=qs[_0xe195('0x1e')](_0x33a08d[_0xe195('0x34')]['offset']);}_0x3199d0[_0xe195('0x3c')]=qs[_0xe195('0x3d')](_0x33a08d['query'][_0xe195('0x3d')]);_0x3199d0['where']=qs[_0xe195('0x3e')](_[_0xe195('0x3f')](_0x33a08d[_0xe195('0x34')],_0x1f72a2[_0xe195('0x3e')]),_0x4e4d30);if(_0x33a08d[_0xe195('0x34')][_0xe195('0x40')]){_0x3199d0['where']=_[_0xe195('0x41')](_0x3199d0[_0xe195('0x42')],{'$or':_[_0xe195('0x33')](_0x4e4d30,function(_0x4d5b04){if(_0x4d5b04[_0xe195('0x31')]!==_0xe195('0x43')){var _0x5207e3={};_0x5207e3[_0x4d5b04[_0xe195('0x2c')]]={'$like':'%'+_0x33a08d[_0xe195('0x34')]['filter']+'%'};return _0x5207e3;}})});}_0x3199d0=_[_0xe195('0x41')]({},_0x3199d0,_0x33a08d[_0xe195('0x44')]);var _0x28ac42={'where':_0x3199d0['where']};return db[_0xe195('0x2e')][_0xe195('0x21')](_0x28ac42)[_0xe195('0x27')](function(_0x2ce54e){_0x283516[_0xe195('0x21')]=_0x2ce54e;if(_0x33a08d[_0xe195('0x34')][_0xe195('0x45')]){_0x3199d0[_0xe195('0x46')]=[{'all':!![]}];}return db[_0xe195('0x2e')][_0xe195('0x47')](_0x3199d0);})[_0xe195('0x27')](function(_0xff05fc){_0x283516['rows']=_0xff05fc;return _0x283516;})[_0xe195('0x27')](respondWithFilteredResult(_0x3e228f,_0x3199d0))[_0xe195('0x48')](handleError(_0x3e228f,null));};exports[_0xe195('0x49')]=function(_0x42a856,_0x15293a){var _0x4f66cd={'raw':!![],'where':{'id':_0x42a856['params']['id']}},_0x5d1059={};_0x5d1059['model']=_[_0xe195('0x4a')](db['FaxQueueReport'][_0xe195('0x2f')]);_0x5d1059['query']=_['keys'](_0x42a856[_0xe195('0x34')]);_0x5d1059[_0xe195('0x3e')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],_0x5d1059[_0xe195('0x34')]);_0x4f66cd[_0xe195('0x37')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],qs['fields'](_0x42a856['query'][_0xe195('0x38')]));_0x4f66cd[_0xe195('0x37')]=_0x4f66cd['attributes'][_0xe195('0x39')]?_0x4f66cd[_0xe195('0x37')]:_0x5d1059[_0xe195('0x36')];if(_0x42a856[_0xe195('0x34')][_0xe195('0x45')]){_0x4f66cd[_0xe195('0x46')]=[{'all':!![]}];}_0x4f66cd=_[_0xe195('0x41')]({},_0x4f66cd,_0x42a856[_0xe195('0x44')]);return db[_0xe195('0x2e')][_0xe195('0x4b')](_0x4f66cd)[_0xe195('0x27')](handleEntityNotFound(_0x15293a,null))[_0xe195('0x27')](respondWithResult(_0x15293a,null))['catch'](handleError(_0x15293a,null));};exports[_0xe195('0x4c')]=function(_0x3dc748,_0x1ebb32){return db[_0xe195('0x2e')][_0xe195('0x4c')](_0x3dc748[_0xe195('0x4d')],{})[_0xe195('0x27')](respondWithResult(_0x1ebb32,0xc9))[_0xe195('0x48')](handleError(_0x1ebb32,null));};exports[_0xe195('0x26')]=function(_0x19e744,_0x2b3d9b){if(_0x19e744['body']['id']){delete _0x19e744[_0xe195('0x4d')]['id'];}return db['FaxQueueReport'][_0xe195('0x4b')]({'where':{'id':_0x19e744[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x2b3d9b,null))['then'](saveUpdates(_0x19e744['body'],null))[_0xe195('0x27')](respondWithResult(_0x2b3d9b,null))[_0xe195('0x48')](handleError(_0x2b3d9b,null));};exports[_0xe195('0x28')]=function(_0x11aec8,_0x332126){return db[_0xe195('0x2e')][_0xe195('0x4b')]({'where':{'id':_0x11aec8[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x332126,null))[_0xe195('0x27')](removeEntity(_0x332126,null))[_0xe195('0x48')](handleError(_0x332126,null));};exports[_0xe195('0x4f')]=function(_0x68355f,_0x1b500e){return db[_0xe195('0x2e')][_0xe195('0x4f')]()[_0xe195('0x27')](respondWithResult(_0x1b500e,null))[_0xe195('0x48')](handleError(_0x1b500e,null));}; \ No newline at end of file +var _0x22a4=['fields','length','nolimit','order','sort','where','pick','merge','type','options','include','FaxQueueReport','findAll','catch','params','keys','rawAttributes','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','key','model','query','filters','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22a4,0x1cb));var _0x422a=function(_0x7ea44a,_0x401d2f){_0x7ea44a=_0x7ea44a-0x0;var _0x388deb=_0x22a4[_0x7ea44a];return _0x388deb;};'use strict';var emlformat=require(_0x422a('0x0'));var rimraf=require(_0x422a('0x1'));var zipdir=require(_0x422a('0x2'));var jsonpatch=require(_0x422a('0x3'));var rp=require(_0x422a('0x4'));var moment=require(_0x422a('0x5'));var BPromise=require(_0x422a('0x6'));var Mustache=require(_0x422a('0x7'));var util=require('util');var path=require(_0x422a('0x8'));var sox=require(_0x422a('0x9'));var csv=require(_0x422a('0xa'));var ejs=require(_0x422a('0xb'));var fs=require('fs');var fs_extra=require(_0x422a('0xc'));var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xa'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebe70d,_0x4dbed1){_0x4dbed1=_0x4dbed1||0xcc;return function(_0x5a0c59){if(_0x5a0c59){return _0xebe70d['sendStatus'](_0x4dbed1);}return _0xebe70d[_0x422a('0x1a')](_0x4dbed1)[_0x422a('0x1b')]();};}function respondWithResult(_0x11af1f,_0x2dc9b2){_0x2dc9b2=_0x2dc9b2||0xc8;return function(_0x147af5){if(_0x147af5){return _0x11af1f[_0x422a('0x1a')](_0x2dc9b2)[_0x422a('0x1c')](_0x147af5);}};}function respondWithFilteredResult(_0x3504bb,_0xf9fcf7){return function(_0x2ba53b){if(_0x2ba53b){var _0x30b6e9=typeof _0xf9fcf7[_0x422a('0x1d')]===_0x422a('0x1e')&&typeof _0xf9fcf7[_0x422a('0x1f')]===_0x422a('0x1e');var _0x2e8163=_0x2ba53b[_0x422a('0x20')];var _0x5e2507=_0x30b6e9?0x0:_0xf9fcf7[_0x422a('0x1d')];var _0x3c5d86=_0x30b6e9?_0x2ba53b['count']:_0xf9fcf7[_0x422a('0x1d')]+_0xf9fcf7['limit'];var _0x552048;if(_0x3c5d86>=_0x2e8163){_0x3c5d86=_0x2e8163;_0x552048=0xc8;}else{_0x552048=0xce;}_0x3504bb[_0x422a('0x1a')](_0x552048);return _0x3504bb[_0x422a('0x21')](_0x422a('0x22'),_0x5e2507+'-'+_0x3c5d86+'/'+_0x2e8163)[_0x422a('0x1c')](_0x2ba53b);}return null;};}function patchUpdates(_0x194c25){return function(_0x5f9720){try{jsonpatch[_0x422a('0x23')](_0x5f9720,_0x194c25,!![]);}catch(_0x26922a){return BPromise['reject'](_0x26922a);}return _0x5f9720[_0x422a('0x24')]();};}function saveUpdates(_0x3284ed,_0x211d93){return function(_0x3d3213){if(_0x3d3213){return _0x3d3213[_0x422a('0x25')](_0x3284ed)['then'](function(_0x837c81){return _0x837c81;});}return null;};}function removeEntity(_0x33bc88,_0x6e209d){return function(_0x5e3138){if(_0x5e3138){return _0x5e3138[_0x422a('0x26')]()[_0x422a('0x27')](function(){_0x33bc88[_0x422a('0x1a')](0xcc)[_0x422a('0x1b')]();});}};}function handleEntityNotFound(_0xfc8699,_0xa7e1dd){return function(_0xca7e3c){if(!_0xca7e3c){_0xfc8699[_0x422a('0x28')](0x194);}return _0xca7e3c;};}function handleError(_0x535888,_0x911cc9){_0x911cc9=_0x911cc9||0x1f4;return function(_0x15d2ab){logger['error'](_0x15d2ab[_0x422a('0x29')]);if(_0x15d2ab['name']){delete _0x15d2ab[_0x422a('0x2a')];}_0x535888[_0x422a('0x1a')](_0x911cc9)[_0x422a('0x2b')](_0x15d2ab);};}exports[_0x422a('0x2c')]=function(_0x4badf8,_0x3cb362){var _0x2f833e={},_0x50cc29={},_0x5826ac={'count':0x0,'rows':[]};var _0x3414ad=_[_0x422a('0x2d')](db['FaxQueueReport']['rawAttributes'],function(_0x4903d1){return{'name':_0x4903d1['fieldName'],'type':_0x4903d1['type'][_0x422a('0x2e')]};});_0x50cc29[_0x422a('0x2f')]=_[_0x422a('0x2d')](_0x3414ad,_0x422a('0x2a'));_0x50cc29[_0x422a('0x30')]=_['keys'](_0x4badf8[_0x422a('0x30')]);_0x50cc29[_0x422a('0x31')]=_[_0x422a('0x32')](_0x50cc29[_0x422a('0x2f')],_0x50cc29[_0x422a('0x30')]);_0x2f833e[_0x422a('0x33')]=_[_0x422a('0x32')](_0x50cc29['model'],qs[_0x422a('0x34')](_0x4badf8[_0x422a('0x30')][_0x422a('0x34')]));_0x2f833e[_0x422a('0x33')]=_0x2f833e['attributes'][_0x422a('0x35')]?_0x2f833e['attributes']:_0x50cc29[_0x422a('0x2f')];if(!_0x4badf8[_0x422a('0x30')]['hasOwnProperty'](_0x422a('0x36'))){_0x2f833e[_0x422a('0x1f')]=qs['limit'](_0x4badf8[_0x422a('0x30')][_0x422a('0x1f')]);_0x2f833e[_0x422a('0x1d')]=qs[_0x422a('0x1d')](_0x4badf8[_0x422a('0x30')][_0x422a('0x1d')]);}_0x2f833e[_0x422a('0x37')]=qs[_0x422a('0x38')](_0x4badf8['query']['sort']);_0x2f833e[_0x422a('0x39')]=qs[_0x422a('0x31')](_[_0x422a('0x3a')](_0x4badf8['query'],_0x50cc29[_0x422a('0x31')]),_0x3414ad);if(_0x4badf8[_0x422a('0x30')]['filter']){_0x2f833e['where']=_[_0x422a('0x3b')](_0x2f833e['where'],{'$or':_[_0x422a('0x2d')](_0x3414ad,function(_0x311fa7){if(_0x311fa7[_0x422a('0x3c')]!=='VIRTUAL'){var _0x36661b={};_0x36661b[_0x311fa7[_0x422a('0x2a')]]={'$like':'%'+_0x4badf8[_0x422a('0x30')]['filter']+'%'};return _0x36661b;}})});}_0x2f833e=_['merge']({},_0x2f833e,_0x4badf8[_0x422a('0x3d')]);var _0x424716={'where':_0x2f833e[_0x422a('0x39')]};return db['FaxQueueReport'][_0x422a('0x20')](_0x424716)[_0x422a('0x27')](function(_0x254f3f){_0x5826ac[_0x422a('0x20')]=_0x254f3f;if(_0x4badf8[_0x422a('0x30')]['includeAll']){_0x2f833e[_0x422a('0x3e')]=[{'all':!![]}];}return db[_0x422a('0x3f')][_0x422a('0x40')](_0x2f833e);})[_0x422a('0x27')](function(_0xfd39fa){_0x5826ac['rows']=_0xfd39fa;return _0x5826ac;})['then'](respondWithFilteredResult(_0x3cb362,_0x2f833e))[_0x422a('0x41')](handleError(_0x3cb362,null));};exports['show']=function(_0x4c2e63,_0x42bbc1){var _0x7a59f8={'raw':!![],'where':{'id':_0x4c2e63[_0x422a('0x42')]['id']}},_0x10302c={};_0x10302c[_0x422a('0x2f')]=_[_0x422a('0x43')](db['FaxQueueReport'][_0x422a('0x44')]);_0x10302c[_0x422a('0x30')]=_[_0x422a('0x43')](_0x4c2e63[_0x422a('0x30')]);_0x10302c[_0x422a('0x31')]=_[_0x422a('0x32')](_0x10302c[_0x422a('0x2f')],_0x10302c['query']);_0x7a59f8[_0x422a('0x33')]=_[_0x422a('0x32')](_0x10302c['model'],qs[_0x422a('0x34')](_0x4c2e63[_0x422a('0x30')][_0x422a('0x34')]));_0x7a59f8[_0x422a('0x33')]=_0x7a59f8[_0x422a('0x33')][_0x422a('0x35')]?_0x7a59f8[_0x422a('0x33')]:_0x10302c['model'];if(_0x4c2e63[_0x422a('0x30')][_0x422a('0x45')]){_0x7a59f8[_0x422a('0x3e')]=[{'all':!![]}];}_0x7a59f8=_[_0x422a('0x3b')]({},_0x7a59f8,_0x4c2e63[_0x422a('0x3d')]);return db[_0x422a('0x3f')][_0x422a('0x46')](_0x7a59f8)[_0x422a('0x27')](handleEntityNotFound(_0x42bbc1,null))[_0x422a('0x27')](respondWithResult(_0x42bbc1,null))[_0x422a('0x41')](handleError(_0x42bbc1,null));};exports['create']=function(_0x48917f,_0x3fd514){return db[_0x422a('0x3f')]['create'](_0x48917f[_0x422a('0x47')],{})[_0x422a('0x27')](respondWithResult(_0x3fd514,0xc9))[_0x422a('0x41')](handleError(_0x3fd514,null));};exports[_0x422a('0x25')]=function(_0x706497,_0x792783){if(_0x706497[_0x422a('0x47')]['id']){delete _0x706497[_0x422a('0x47')]['id'];}return db[_0x422a('0x3f')][_0x422a('0x46')]({'where':{'id':_0x706497['params']['id']}})['then'](handleEntityNotFound(_0x792783,null))[_0x422a('0x27')](saveUpdates(_0x706497[_0x422a('0x47')],null))['then'](respondWithResult(_0x792783,null))[_0x422a('0x41')](handleError(_0x792783,null));};exports[_0x422a('0x26')]=function(_0x20b4d3,_0x10de41){return db[_0x422a('0x3f')][_0x422a('0x46')]({'where':{'id':_0x20b4d3[_0x422a('0x42')]['id']}})['then'](handleEntityNotFound(_0x10de41,null))[_0x422a('0x27')](removeEntity(_0x10de41,null))[_0x422a('0x41')](handleError(_0x10de41,null));};exports[_0x422a('0x48')]=function(_0x41deb3,_0x139d54){return db[_0x422a('0x3f')]['describe']()['then'](respondWithResult(_0x139d54,null))[_0x422a('0x41')](handleError(_0x139d54,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c720b93..64e87ab 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x397cfd,_0x44277b){var _0x22c1b2=function(_0x4b083a){while(--_0x4b083a){_0x397cfd['push'](_0x397cfd['shift']());}};_0x22c1b2(++_0x44277b);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x39c867,_0x256214){var _0x411aa2=function(_0x421bb9){while(--_0x421bb9){_0x39c867['push'](_0x39c867['shift']());}};_0x411aa2(++_0x256214);}(_0x1261,0x144));var _0x1126=function(_0x436073,_0x11b1d6){_0x436073=_0x436073-0x0;var _0x564463=_0x1261[_0x436073];return _0x564463;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4eeeaff..0a53024 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 _0x916e=['UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','update','body','raw','where','attributes','limit'];(function(_0x2be9d6,_0x228020){var _0x27df8a=function(_0x2a11c9){while(--_0x2a11c9){_0x2be9d6['push'](_0x2be9d6['shift']());}};_0x27df8a(++_0x228020);}(_0x916e,0x1dd));var _0xe916=function(_0x281e1e,_0xc91fe0){_0x281e1e=_0x281e1e-0x0;var _0x312126=_0x916e[_0x281e1e];return _0x312126;};'use strict';var _=require(_0xe916('0x0'));var util=require('util');var moment=require(_0xe916('0x1'));var BPromise=require(_0xe916('0x2'));var rs=require(_0xe916('0x3'));var fs=require('fs');var Redis=require(_0xe916('0x4'));var db=require(_0xe916('0x5'))['db'];var utils=require(_0xe916('0x6'));var logger=require(_0xe916('0x7'))('rpc');var config=require(_0xe916('0x8'));var jayson=require(_0xe916('0x9'));var client=jayson['client'][_0xe916('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b1cb5,_0x106912,_0x1d9637){return new BPromise(function(_0x252a6f,_0x1cd480){return client[_0xe916('0xb')](_0x2b1cb5,_0x1d9637)[_0xe916('0xc')](function(_0x49fc2e){logger[_0xe916('0xd')](_0xe916('0xe'),_0x106912,_0xe916('0xf'));logger[_0xe916('0x10')](_0xe916('0x11'),_0x106912,'request\x20sent',JSON[_0xe916('0x12')](_0x49fc2e));if(_0x49fc2e[_0xe916('0x13')]){if(_0x49fc2e[_0xe916('0x13')]['code']===0x1f4){logger[_0xe916('0x13')](_0xe916('0xe'),_0x106912,_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);return _0x1cd480(_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);}logger['error'](_0xe916('0xe'),_0x106912,_0x49fc2e[_0xe916('0x13')]['message']);return _0x252a6f(_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);}else{logger[_0xe916('0xd')](_0xe916('0xe'),_0x106912,_0xe916('0xf'));_0x252a6f(_0x49fc2e[_0xe916('0x15')][_0xe916('0x14')]);}})[_0xe916('0x16')](function(_0x393db1){logger[_0xe916('0x13')](_0xe916('0xe'),_0x106912,_0x393db1);_0x1cd480(_0x393db1);});});}exports['CreateFaxQueueReport']=function(_0x58f2ce){var _0x494a05=this;return new Promise(function(_0x467a77,_0x47e767){return db[_0xe916('0x17')][_0xe916('0x18')](_0x58f2ce['body'],{'raw':_0x58f2ce['options']?_0x58f2ce[_0xe916('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8efc9d){logger[_0xe916('0xd')]('CreateFaxQueueReport',_0x58f2ce);logger[_0xe916('0x10')](_0xe916('0x1a'),_0x58f2ce,JSON['stringify'](_0x8efc9d));_0x467a77(_0x8efc9d);})['catch'](function(_0x345f4b){logger[_0xe916('0x13')](_0xe916('0x1a'),_0x345f4b[_0xe916('0x14')],_0x58f2ce);_0x47e767(_0x494a05['error'](0x1f4,_0x345f4b[_0xe916('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x4162bf){var _0x2c0faf=this;return new Promise(function(_0x13b0bd,_0x547a94){return db[_0xe916('0x17')][_0xe916('0x1b')](_0x4162bf[_0xe916('0x1c')],{'raw':_0x4162bf[_0xe916('0x19')]?_0x4162bf['options'][_0xe916('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4162bf['options']?_0x4162bf[_0xe916('0x19')][_0xe916('0x1e')]||null:null,'attributes':_0x4162bf[_0xe916('0x19')]?_0x4162bf['options'][_0xe916('0x1f')]||null:null,'limit':_0x4162bf[_0xe916('0x19')]?_0x4162bf[_0xe916('0x19')][_0xe916('0x20')]||null:null})[_0xe916('0xc')](function(_0x42d31f){logger['info'](_0xe916('0x21'),_0x4162bf);logger['debug'](_0xe916('0x21'),_0x4162bf,JSON[_0xe916('0x12')](_0x42d31f));_0x13b0bd(_0x42d31f);})[_0xe916('0x16')](function(_0x5e42b4){logger[_0xe916('0x13')]('UpdateFaxQueueReport',_0x5e42b4[_0xe916('0x14')],_0x4162bf);_0x547a94(_0x2c0faf[_0xe916('0x13')](0x1f4,_0x5e42b4[_0xe916('0x14')]));});});}; \ No newline at end of file +var _0xafca=['info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','update','raw','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message'];(function(_0x57c501,_0x319f03){var _0x4f15ba=function(_0x52e0c1){while(--_0x52e0c1){_0x57c501['push'](_0x57c501['shift']());}};_0x4f15ba(++_0x319f03);}(_0xafca,0x1cc));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xaafc('0x0'));var moment=require(_0xaafc('0x1'));var BPromise=require('bluebird');var rs=require(_0xaafc('0x2'));var fs=require('fs');var Redis=require(_0xaafc('0x3'));var db=require(_0xaafc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaafc('0x5'))(_0xaafc('0x6'));var config=require(_0xaafc('0x7'));var jayson=require(_0xaafc('0x8'));var client=jayson[_0xaafc('0x9')][_0xaafc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bcbe8,_0x1da2f5,_0x7f50e2){return new BPromise(function(_0x4e6e62,_0x257076){return client[_0xaafc('0xb')](_0x3bcbe8,_0x7f50e2)[_0xaafc('0xc')](function(_0x2f75dc){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1da2f5,_0xaafc('0xd'));logger[_0xaafc('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1da2f5,'request\x20sent',JSON[_0xaafc('0xf')](_0x2f75dc));if(_0x2f75dc[_0xaafc('0x10')]){if(_0x2f75dc['error'][_0xaafc('0x11')]===0x1f4){logger[_0xaafc('0x10')](_0xaafc('0x12'),_0x1da2f5,_0x2f75dc[_0xaafc('0x10')][_0xaafc('0x13')]);return _0x257076(_0x2f75dc[_0xaafc('0x10')][_0xaafc('0x13')]);}logger[_0xaafc('0x10')](_0xaafc('0x12'),_0x1da2f5,_0x2f75dc[_0xaafc('0x10')][_0xaafc('0x13')]);return _0x4e6e62(_0x2f75dc[_0xaafc('0x10')][_0xaafc('0x13')]);}else{logger[_0xaafc('0x14')](_0xaafc('0x12'),_0x1da2f5,_0xaafc('0xd'));_0x4e6e62(_0x2f75dc[_0xaafc('0x15')][_0xaafc('0x13')]);}})[_0xaafc('0x16')](function(_0x55a0fa){logger[_0xaafc('0x10')](_0xaafc('0x12'),_0x1da2f5,_0x55a0fa);_0x257076(_0x55a0fa);});});}exports[_0xaafc('0x17')]=function(_0x29072d){var _0x1fe750=this;return new Promise(function(_0x2d755c,_0x42dfa7){return db[_0xaafc('0x18')][_0xaafc('0x19')](_0x29072d[_0xaafc('0x1a')],{'raw':_0x29072d[_0xaafc('0x1b')]?_0x29072d[_0xaafc('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28f193){logger[_0xaafc('0x14')](_0xaafc('0x17'),_0x29072d);logger[_0xaafc('0xe')](_0xaafc('0x17'),_0x29072d,JSON[_0xaafc('0xf')](_0x28f193));_0x2d755c(_0x28f193);})[_0xaafc('0x16')](function(_0x571104){logger[_0xaafc('0x10')](_0xaafc('0x17'),_0x571104[_0xaafc('0x13')],_0x29072d);_0x42dfa7(_0x1fe750[_0xaafc('0x10')](0x1f4,_0x571104[_0xaafc('0x13')]));});});};exports[_0xaafc('0x1c')]=function(_0x1f69d1){var _0x55a672=this;return new Promise(function(_0x144baf,_0x47d1f5){return db[_0xaafc('0x18')][_0xaafc('0x1d')](_0x1f69d1['body'],{'raw':_0x1f69d1[_0xaafc('0x1b')]?_0x1f69d1[_0xaafc('0x1b')][_0xaafc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f69d1[_0xaafc('0x1b')]?_0x1f69d1[_0xaafc('0x1b')][_0xaafc('0x1f')]||null:null,'attributes':_0x1f69d1[_0xaafc('0x1b')]?_0x1f69d1[_0xaafc('0x1b')]['attributes']||null:null,'limit':_0x1f69d1[_0xaafc('0x1b')]?_0x1f69d1[_0xaafc('0x1b')]['limit']||null:null})['then'](function(_0x86bc5f){logger[_0xaafc('0x14')]('UpdateFaxQueueReport',_0x1f69d1);logger[_0xaafc('0xe')](_0xaafc('0x1c'),_0x1f69d1,JSON[_0xaafc('0xf')](_0x86bc5f));_0x144baf(_0x86bc5f);})[_0xaafc('0x16')](function(_0x216546){logger[_0xaafc('0x10')](_0xaafc('0x1c'),_0x216546[_0xaafc('0x13')],_0x1f69d1);_0x47d1f5(_0x55a672['error'](0x1f4,_0x216546[_0xaafc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 427ab44..a965422 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 _0x14bb=['fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x327906,_0x279cad){var _0x14de57=function(_0x9d4d52){while(--_0x9d4d52){_0x327906['push'](_0x327906['shift']());}};_0x14de57(++_0x279cad);}(_0x14bb,0x79));var _0xb14b=function(_0x29d463,_0x3e8f7e){_0x29d463=_0x29d463-0x0;var _0x5772c9=_0x14bb[_0x29d463];return _0x5772c9;};'use strict';var multer=require(_0xb14b('0x0'));var util=require(_0xb14b('0x1'));var path=require(_0xb14b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb14b('0x3'));var router=express[_0xb14b('0x4')]();var fs_extra=require(_0xb14b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb14b('0x6'));var config=require(_0xb14b('0x7'));var controller=require(_0xb14b('0x8'));router[_0xb14b('0x9')]('/',auth[_0xb14b('0xa')](),controller['index']);router['get']('/describe',auth[_0xb14b('0xa')](),controller['describe']);router['get'](_0xb14b('0xb'),auth[_0xb14b('0xa')](),controller[_0xb14b('0xc')]);router[_0xb14b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb14b('0xe')]('/:id',auth[_0xb14b('0xa')](),controller[_0xb14b('0xf')]);router[_0xb14b('0x10')]('/:id',auth[_0xb14b('0xa')](),controller['destroy']);module[_0xb14b('0x11')]=router; \ No newline at end of file +var _0xe4c3=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','update','delete','destroy','multer','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe4c3,0x154));var _0x3e4c=function(_0x50b4b6,_0x56b825){_0x50b4b6=_0x50b4b6-0x0;var _0x1b4c8c=_0xe4c3[_0x50b4b6];return _0x1b4c8c;};'use strict';var multer=require(_0x3e4c('0x0'));var util=require(_0x3e4c('0x1'));var path=require(_0x3e4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e4c('0x3'));var router=express[_0x3e4c('0x4')]();var fs_extra=require(_0x3e4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3e4c('0x6'));var config=require(_0x3e4c('0x7'));var controller=require('./faxQueueReport.controller');router[_0x3e4c('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e4c('0x9')]);router[_0x3e4c('0x8')](_0x3e4c('0xa'),auth[_0x3e4c('0xb')](),controller[_0x3e4c('0xc')]);router[_0x3e4c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3e4c('0xd')]);router[_0x3e4c('0xe')]('/',auth[_0x3e4c('0xb')](),controller['create']);router['put']('/:id',auth[_0x3e4c('0xb')](),controller[_0x3e4c('0xf')]);router[_0x3e4c('0x10')]('/:id',auth[_0x3e4c('0xb')](),controller[_0x3e4c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a457801..2de6bc2 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x34e8,0x12c));var _0x834e=function(_0x5aab30,_0xd2b6c1){_0x5aab30=_0x5aab30-0x0;var _0x236aa5=_0x34e8[_0x5aab30];return _0x236aa5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x314587,_0x1aed9f){var _0x3f6c2f=function(_0x5c9938){while(--_0x5c9938){_0x314587['push'](_0x314587['shift']());}};_0x3f6c2f(++_0x1aed9f);}(_0xedd9,0xfc));var _0x9edd=function(_0x52e862,_0x51b8dd){_0x52e862=_0x52e862-0x0;var _0x1cab0d=_0xedd9[_0x52e862];return _0x1cab0d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index edf573d..ec6aedc 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 _0x3cf1=['describe','eml-format','zip-dir','request-promise','mustache','path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','body'];(function(_0x54a3a0,_0x229245){var _0x625183=function(_0x176b00){while(--_0x176b00){_0x54a3a0['push'](_0x54a3a0['shift']());}};_0x625183(++_0x229245);}(_0x3cf1,0x193));var _0x13cf=function(_0x42389a,_0x33deb6){_0x42389a=_0x42389a-0x0;var _0x4d3de9=_0x3cf1[_0x42389a];return _0x4d3de9;};'use strict';var emlformat=require(_0x13cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13cf('0x3'));var util=require('util');var path=require(_0x13cf('0x4'));var sox=require('sox');var csv=require(_0x13cf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13cf('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13cf('0x7'));var jsforce=require(_0x13cf('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x13cf('0x5'));var querystring=require(_0x13cf('0x9'));var Papa=require(_0x13cf('0xa'));var Redis=require('ioredis');var authService=require(_0x13cf('0xb'));var qs=require(_0x13cf('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x13cf('0xd'));var config=require(_0x13cf('0xe'));var licenseUtil=require(_0x13cf('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbeeba8,_0x597a74){_0x597a74=_0x597a74||0xcc;return function(_0x269d58){if(_0x269d58){return _0xbeeba8[_0x13cf('0x10')](_0x597a74);}return _0xbeeba8[_0x13cf('0x11')](_0x597a74)[_0x13cf('0x12')]();};}function respondWithResult(_0x2d91a1,_0x33e490){_0x33e490=_0x33e490||0xc8;return function(_0x3778b8){if(_0x3778b8){return _0x2d91a1[_0x13cf('0x11')](_0x33e490)[_0x13cf('0x13')](_0x3778b8);}};}function respondWithFilteredResult(_0x6e7723,_0x1cb7ff){return function(_0x5a9c7d){if(_0x5a9c7d){var _0x18e9c7=typeof _0x1cb7ff[_0x13cf('0x14')]===_0x13cf('0x15')&&typeof _0x1cb7ff[_0x13cf('0x16')]===_0x13cf('0x15');var _0x37a864=_0x5a9c7d[_0x13cf('0x17')];var _0x12ecd6=_0x18e9c7?0x0:_0x1cb7ff[_0x13cf('0x14')];var _0x5bdba8=_0x18e9c7?_0x5a9c7d[_0x13cf('0x17')]:_0x1cb7ff[_0x13cf('0x14')]+_0x1cb7ff[_0x13cf('0x16')];var _0x20f148;if(_0x5bdba8>=_0x37a864){_0x5bdba8=_0x37a864;_0x20f148=0xc8;}else{_0x20f148=0xce;}_0x6e7723['status'](_0x20f148);return _0x6e7723[_0x13cf('0x18')](_0x13cf('0x19'),_0x12ecd6+'-'+_0x5bdba8+'/'+_0x37a864)['json'](_0x5a9c7d);}return null;};}function patchUpdates(_0xa00010){return function(_0x42b821){try{jsonpatch[_0x13cf('0x1a')](_0x42b821,_0xa00010,!![]);}catch(_0x544c30){return BPromise[_0x13cf('0x1b')](_0x544c30);}return _0x42b821[_0x13cf('0x1c')]();};}function saveUpdates(_0x204a9d,_0xc90ad){return function(_0x5edf57){if(_0x5edf57){return _0x5edf57['update'](_0x204a9d)[_0x13cf('0x1d')](function(_0x540604){return _0x540604;});}return null;};}function removeEntity(_0x4f09f4,_0x9ec13b){return function(_0x2b89db){if(_0x2b89db){return _0x2b89db[_0x13cf('0x1e')]()['then'](function(){_0x4f09f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4753ab,_0x5c9b58){return function(_0x23dc66){if(!_0x23dc66){_0x4753ab[_0x13cf('0x10')](0x194);}return _0x23dc66;};}function handleError(_0x3eda55,_0x57d3a7){_0x57d3a7=_0x57d3a7||0x1f4;return function(_0x15774e){logger[_0x13cf('0x1f')](_0x15774e[_0x13cf('0x20')]);if(_0x15774e['name']){delete _0x15774e['name'];}_0x3eda55['status'](_0x57d3a7)['send'](_0x15774e);};}exports[_0x13cf('0x21')]=function(_0x409ffd,_0x4ebb99){var _0x2b4667={},_0x14d5f4={},_0x1ddf29={'count':0x0,'rows':[]};var _0x31a2e6=_['map'](db[_0x13cf('0x22')][_0x13cf('0x23')],function(_0x123814){return{'name':_0x123814[_0x13cf('0x24')],'type':_0x123814[_0x13cf('0x25')][_0x13cf('0x26')]};});_0x14d5f4[_0x13cf('0x27')]=_[_0x13cf('0x28')](_0x31a2e6,_0x13cf('0x29'));_0x14d5f4['query']=_['keys'](_0x409ffd[_0x13cf('0x2a')]);_0x14d5f4['filters']=_[_0x13cf('0x2b')](_0x14d5f4[_0x13cf('0x27')],_0x14d5f4[_0x13cf('0x2a')]);_0x2b4667[_0x13cf('0x2c')]=_[_0x13cf('0x2b')](_0x14d5f4[_0x13cf('0x27')],qs[_0x13cf('0x2d')](_0x409ffd['query']['fields']));_0x2b4667[_0x13cf('0x2c')]=_0x2b4667[_0x13cf('0x2c')][_0x13cf('0x2e')]?_0x2b4667[_0x13cf('0x2c')]:_0x14d5f4[_0x13cf('0x27')];if(!_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x2f')](_0x13cf('0x30'))){_0x2b4667[_0x13cf('0x16')]=qs[_0x13cf('0x16')](_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x16')]);_0x2b4667['offset']=qs[_0x13cf('0x14')](_0x409ffd[_0x13cf('0x2a')]['offset']);}_0x2b4667['order']=qs[_0x13cf('0x31')](_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x31')]);_0x2b4667[_0x13cf('0x32')]=qs['filters'](_[_0x13cf('0x33')](_0x409ffd[_0x13cf('0x2a')],_0x14d5f4[_0x13cf('0x34')]),_0x31a2e6);if(_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x35')]){_0x2b4667[_0x13cf('0x32')]=_[_0x13cf('0x36')](_0x2b4667['where'],{'$or':_['map'](_0x31a2e6,function(_0x2882a8){if(_0x2882a8['type']!==_0x13cf('0x37')){var _0x1d8f17={};_0x1d8f17[_0x2882a8[_0x13cf('0x29')]]={'$like':'%'+_0x409ffd['query'][_0x13cf('0x35')]+'%'};return _0x1d8f17;}})});}_0x2b4667=_[_0x13cf('0x36')]({},_0x2b4667,_0x409ffd['options']);var _0x3d8e14={'where':_0x2b4667[_0x13cf('0x32')]};return db[_0x13cf('0x22')][_0x13cf('0x17')](_0x3d8e14)[_0x13cf('0x1d')](function(_0x572744){_0x1ddf29[_0x13cf('0x17')]=_0x572744;if(_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x38')]){_0x2b4667[_0x13cf('0x39')]=[{'all':!![]}];}return db[_0x13cf('0x22')][_0x13cf('0x3a')](_0x2b4667);})['then'](function(_0xfdfa22){_0x1ddf29[_0x13cf('0x3b')]=_0xfdfa22;return _0x1ddf29;})[_0x13cf('0x1d')](respondWithFilteredResult(_0x4ebb99,_0x2b4667))[_0x13cf('0x3c')](handleError(_0x4ebb99,null));};exports['show']=function(_0x5598a7,_0x2f57ce){var _0x3474da={'raw':!![],'where':{'id':_0x5598a7[_0x13cf('0x3d')]['id']}},_0x59011b={};_0x59011b[_0x13cf('0x27')]=_[_0x13cf('0x3e')](db[_0x13cf('0x22')][_0x13cf('0x23')]);_0x59011b[_0x13cf('0x2a')]=_['keys'](_0x5598a7[_0x13cf('0x2a')]);_0x59011b['filters']=_[_0x13cf('0x2b')](_0x59011b[_0x13cf('0x27')],_0x59011b[_0x13cf('0x2a')]);_0x3474da[_0x13cf('0x2c')]=_[_0x13cf('0x2b')](_0x59011b[_0x13cf('0x27')],qs['fields'](_0x5598a7['query'][_0x13cf('0x2d')]));_0x3474da[_0x13cf('0x2c')]=_0x3474da[_0x13cf('0x2c')]['length']?_0x3474da[_0x13cf('0x2c')]:_0x59011b[_0x13cf('0x27')];if(_0x5598a7['query']['includeAll']){_0x3474da['include']=[{'all':!![]}];}_0x3474da=_[_0x13cf('0x36')]({},_0x3474da,_0x5598a7['options']);return db['FaxTransferReport'][_0x13cf('0x3f')](_0x3474da)[_0x13cf('0x1d')](handleEntityNotFound(_0x2f57ce,null))[_0x13cf('0x1d')](respondWithResult(_0x2f57ce,null))[_0x13cf('0x3c')](handleError(_0x2f57ce,null));};exports[_0x13cf('0x40')]=function(_0x56f544,_0x125849){return db[_0x13cf('0x22')]['create'](_0x56f544[_0x13cf('0x41')],{})[_0x13cf('0x1d')](respondWithResult(_0x125849,0xc9))['catch'](handleError(_0x125849,null));};exports['update']=function(_0x4e491c,_0xdb92db){if(_0x4e491c[_0x13cf('0x41')]['id']){delete _0x4e491c[_0x13cf('0x41')]['id'];}return db[_0x13cf('0x22')][_0x13cf('0x3f')]({'where':{'id':_0x4e491c['params']['id']}})[_0x13cf('0x1d')](handleEntityNotFound(_0xdb92db,null))[_0x13cf('0x1d')](saveUpdates(_0x4e491c[_0x13cf('0x41')],null))[_0x13cf('0x1d')](respondWithResult(_0xdb92db,null))[_0x13cf('0x3c')](handleError(_0xdb92db,null));};exports[_0x13cf('0x1e')]=function(_0x1fade5,_0x56ca77){return db[_0x13cf('0x22')][_0x13cf('0x3f')]({'where':{'id':_0x1fade5[_0x13cf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56ca77,null))['then'](removeEntity(_0x56ca77,null))[_0x13cf('0x3c')](handleError(_0x56ca77,null));};exports[_0x13cf('0x42')]=function(_0x5ac306,_0x1dae9b){return db[_0x13cf('0x22')][_0x13cf('0x42')]()[_0x13cf('0x1d')](respondWithResult(_0x1dae9b,null))['catch'](handleError(_0x1dae9b,null));}; \ No newline at end of file +var _0xa229=['VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','error','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xa229,0x16b));var _0x9a22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa229[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9a22('0x0'));var rimraf=require(_0x9a22('0x1'));var zipdir=require(_0x9a22('0x2'));var jsonpatch=require(_0x9a22('0x3'));var rp=require(_0x9a22('0x4'));var moment=require(_0x9a22('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a22('0x6'));var util=require(_0x9a22('0x7'));var path=require('path');var sox=require(_0x9a22('0x8'));var csv=require(_0x9a22('0x9'));var ejs=require(_0x9a22('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a22('0xb'));var jsforce=require(_0x9a22('0xc'));var deskjs=require(_0x9a22('0xd'));var toCsv=require(_0x9a22('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9a22('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9a22('0xf'));var as=require(_0x9a22('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a22('0x11'))(_0x9a22('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9a22('0x13'));var db=require(_0x9a22('0x14'))['db'];function respondWithStatusCode(_0x115d31,_0x258a32){_0x258a32=_0x258a32||0xcc;return function(_0x376d00){if(_0x376d00){return _0x115d31[_0x9a22('0x15')](_0x258a32);}return _0x115d31['status'](_0x258a32)[_0x9a22('0x16')]();};}function respondWithResult(_0x4e974a,_0x203275){_0x203275=_0x203275||0xc8;return function(_0x397061){if(_0x397061){return _0x4e974a['status'](_0x203275)[_0x9a22('0x17')](_0x397061);}};}function respondWithFilteredResult(_0x16b5cc,_0x6c6c55){return function(_0x39cbe8){if(_0x39cbe8){var _0x4de43e=typeof _0x6c6c55['offset']==='undefined'&&typeof _0x6c6c55[_0x9a22('0x18')]==='undefined';var _0x355f31=_0x39cbe8[_0x9a22('0x19')];var _0x61ed3=_0x4de43e?0x0:_0x6c6c55[_0x9a22('0x1a')];var _0x591295=_0x4de43e?_0x39cbe8['count']:_0x6c6c55[_0x9a22('0x1a')]+_0x6c6c55[_0x9a22('0x18')];var _0x1f5684;if(_0x591295>=_0x355f31){_0x591295=_0x355f31;_0x1f5684=0xc8;}else{_0x1f5684=0xce;}_0x16b5cc['status'](_0x1f5684);return _0x16b5cc[_0x9a22('0x1b')](_0x9a22('0x1c'),_0x61ed3+'-'+_0x591295+'/'+_0x355f31)[_0x9a22('0x17')](_0x39cbe8);}return null;};}function patchUpdates(_0x2f6faf){return function(_0x60c002){try{jsonpatch[_0x9a22('0x1d')](_0x60c002,_0x2f6faf,!![]);}catch(_0x559513){return BPromise[_0x9a22('0x1e')](_0x559513);}return _0x60c002[_0x9a22('0x1f')]();};}function saveUpdates(_0xf801eb,_0x304367){return function(_0x43afd8){if(_0x43afd8){return _0x43afd8['update'](_0xf801eb)[_0x9a22('0x20')](function(_0x54918f){return _0x54918f;});}return null;};}function removeEntity(_0x5209bb,_0xea4d5c){return function(_0x319eb7){if(_0x319eb7){return _0x319eb7['destroy']()['then'](function(){_0x5209bb['status'](0xcc)[_0x9a22('0x16')]();});}};}function handleEntityNotFound(_0x2a6581,_0x3a23b4){return function(_0x215de3){if(!_0x215de3){_0x2a6581['sendStatus'](0x194);}return _0x215de3;};}function handleError(_0x3012e0,_0x33bdb6){_0x33bdb6=_0x33bdb6||0x1f4;return function(_0x4d7cdd){logger[_0x9a22('0x21')](_0x4d7cdd['stack']);if(_0x4d7cdd[_0x9a22('0x22')]){delete _0x4d7cdd['name'];}_0x3012e0['status'](_0x33bdb6)['send'](_0x4d7cdd);};}exports[_0x9a22('0x23')]=function(_0x41c085,_0x3d93cf){var _0x55ab17={},_0x153abe={},_0x378e11={'count':0x0,'rows':[]};var _0x84f4d7=_[_0x9a22('0x24')](db[_0x9a22('0x25')][_0x9a22('0x26')],function(_0xd2ed05){return{'name':_0xd2ed05[_0x9a22('0x27')],'type':_0xd2ed05[_0x9a22('0x28')][_0x9a22('0x29')]};});_0x153abe[_0x9a22('0x2a')]=_[_0x9a22('0x24')](_0x84f4d7,_0x9a22('0x22'));_0x153abe[_0x9a22('0x2b')]=_[_0x9a22('0x2c')](_0x41c085['query']);_0x153abe[_0x9a22('0x2d')]=_[_0x9a22('0x2e')](_0x153abe[_0x9a22('0x2a')],_0x153abe[_0x9a22('0x2b')]);_0x55ab17[_0x9a22('0x2f')]=_['intersection'](_0x153abe['model'],qs[_0x9a22('0x30')](_0x41c085[_0x9a22('0x2b')][_0x9a22('0x30')]));_0x55ab17[_0x9a22('0x2f')]=_0x55ab17[_0x9a22('0x2f')][_0x9a22('0x31')]?_0x55ab17['attributes']:_0x153abe['model'];if(!_0x41c085['query'][_0x9a22('0x32')](_0x9a22('0x33'))){_0x55ab17[_0x9a22('0x18')]=qs[_0x9a22('0x18')](_0x41c085[_0x9a22('0x2b')][_0x9a22('0x18')]);_0x55ab17[_0x9a22('0x1a')]=qs[_0x9a22('0x1a')](_0x41c085['query']['offset']);}_0x55ab17[_0x9a22('0x34')]=qs['sort'](_0x41c085[_0x9a22('0x2b')][_0x9a22('0x35')]);_0x55ab17[_0x9a22('0x36')]=qs[_0x9a22('0x2d')](_['pick'](_0x41c085['query'],_0x153abe[_0x9a22('0x2d')]),_0x84f4d7);if(_0x41c085['query'][_0x9a22('0x37')]){_0x55ab17['where']=_[_0x9a22('0x38')](_0x55ab17[_0x9a22('0x36')],{'$or':_['map'](_0x84f4d7,function(_0x48fdf5){if(_0x48fdf5[_0x9a22('0x28')]!==_0x9a22('0x39')){var _0xd40a46={};_0xd40a46[_0x48fdf5['name']]={'$like':'%'+_0x41c085[_0x9a22('0x2b')][_0x9a22('0x37')]+'%'};return _0xd40a46;}})});}_0x55ab17=_[_0x9a22('0x38')]({},_0x55ab17,_0x41c085[_0x9a22('0x3a')]);var _0x1b674f={'where':_0x55ab17['where']};return db[_0x9a22('0x25')][_0x9a22('0x19')](_0x1b674f)['then'](function(_0x2152e0){_0x378e11[_0x9a22('0x19')]=_0x2152e0;if(_0x41c085[_0x9a22('0x2b')][_0x9a22('0x3b')]){_0x55ab17[_0x9a22('0x3c')]=[{'all':!![]}];}return db[_0x9a22('0x25')][_0x9a22('0x3d')](_0x55ab17);})[_0x9a22('0x20')](function(_0x556e7f){_0x378e11[_0x9a22('0x3e')]=_0x556e7f;return _0x378e11;})[_0x9a22('0x20')](respondWithFilteredResult(_0x3d93cf,_0x55ab17))[_0x9a22('0x3f')](handleError(_0x3d93cf,null));};exports['show']=function(_0x34a03e,_0x3c2363){var _0x198a4f={'raw':!![],'where':{'id':_0x34a03e['params']['id']}},_0x530358={};_0x530358[_0x9a22('0x2a')]=_[_0x9a22('0x2c')](db['FaxTransferReport'][_0x9a22('0x26')]);_0x530358[_0x9a22('0x2b')]=_[_0x9a22('0x2c')](_0x34a03e['query']);_0x530358[_0x9a22('0x2d')]=_['intersection'](_0x530358['model'],_0x530358[_0x9a22('0x2b')]);_0x198a4f[_0x9a22('0x2f')]=_[_0x9a22('0x2e')](_0x530358[_0x9a22('0x2a')],qs['fields'](_0x34a03e[_0x9a22('0x2b')][_0x9a22('0x30')]));_0x198a4f[_0x9a22('0x2f')]=_0x198a4f[_0x9a22('0x2f')][_0x9a22('0x31')]?_0x198a4f[_0x9a22('0x2f')]:_0x530358[_0x9a22('0x2a')];if(_0x34a03e[_0x9a22('0x2b')][_0x9a22('0x3b')]){_0x198a4f[_0x9a22('0x3c')]=[{'all':!![]}];}_0x198a4f=_[_0x9a22('0x38')]({},_0x198a4f,_0x34a03e[_0x9a22('0x3a')]);return db[_0x9a22('0x25')][_0x9a22('0x40')](_0x198a4f)['then'](handleEntityNotFound(_0x3c2363,null))[_0x9a22('0x20')](respondWithResult(_0x3c2363,null))[_0x9a22('0x3f')](handleError(_0x3c2363,null));};exports[_0x9a22('0x41')]=function(_0x33b0d2,_0x47610a){return db['FaxTransferReport']['create'](_0x33b0d2['body'],{})['then'](respondWithResult(_0x47610a,0xc9))[_0x9a22('0x3f')](handleError(_0x47610a,null));};exports[_0x9a22('0x42')]=function(_0x2b67f2,_0x3f5128){if(_0x2b67f2[_0x9a22('0x43')]['id']){delete _0x2b67f2[_0x9a22('0x43')]['id'];}return db[_0x9a22('0x25')][_0x9a22('0x40')]({'where':{'id':_0x2b67f2[_0x9a22('0x44')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x3f5128,null))[_0x9a22('0x20')](saveUpdates(_0x2b67f2['body'],null))[_0x9a22('0x20')](respondWithResult(_0x3f5128,null))['catch'](handleError(_0x3f5128,null));};exports['destroy']=function(_0x300829,_0x306361){return db[_0x9a22('0x25')]['find']({'where':{'id':_0x300829[_0x9a22('0x44')]['id']}})[_0x9a22('0x20')](handleEntityNotFound(_0x306361,null))[_0x9a22('0x20')](removeEntity(_0x306361,null))[_0x9a22('0x3f')](handleError(_0x306361,null));};exports[_0x9a22('0x45')]=function(_0x4cbac7,_0x314451){return db[_0x9a22('0x25')][_0x9a22('0x45')]()[_0x9a22('0x20')](respondWithResult(_0x314451,null))[_0x9a22('0x3f')](handleError(_0x314451,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 95b8e14..f60b68b 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 _0x340e=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x2ed96a,_0x1c3d27){var _0x58efae=function(_0x23ae4c){while(--_0x23ae4c){_0x2ed96a['push'](_0x2ed96a['shift']());}};_0x58efae(++_0x1c3d27);}(_0x340e,0x1dc));var _0xe340=function(_0x374328,_0xfedbb4){_0x374328=_0x374328-0x0;var _0x101f88=_0x340e[_0x374328];return _0x101f88;};'use strict';var _=require(_0xe340('0x0'));var util=require('util');var logger=require(_0xe340('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe340('0x2'));var rp=require(_0xe340('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe340('0x4'));var config=require(_0xe340('0x5'));var attributes=require(_0xe340('0x6'));module['exports']=function(_0x3fedb8,_0x538fb9){return _0x3fedb8[_0xe340('0x7')](_0xe340('0x8'),attributes,{'tableName':_0xe340('0x9'),'paranoid':![],'indexes':[{'name':_0xe340('0xa'),'fields':[_0xe340('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfcf=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./faxTransferReport.attributes'];(function(_0x229ccd,_0x19abbc){var _0x4b6a73=function(_0x1910f4){while(--_0x1910f4){_0x229ccd['push'](_0x229ccd['shift']());}};_0x4b6a73(++_0x19abbc);}(_0xbfcf,0x1a9));var _0xfbfc=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xbfcf[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0xfbfc('0x0'));var util=require(_0xfbfc('0x1'));var logger=require(_0xfbfc('0x2'))(_0xfbfc('0x3'));var moment=require(_0xfbfc('0x4'));var BPromise=require('bluebird');var rp=require(_0xfbfc('0x5'));var fs=require('fs');var path=require(_0xfbfc('0x6'));var rimraf=require(_0xfbfc('0x7'));var config=require('../../config/environment');var attributes=require(_0xfbfc('0x8'));module[_0xfbfc('0x9')]=function(_0x16d76f,_0x18e501){return _0x16d76f[_0xfbfc('0xa')](_0xfbfc('0xb'),attributes,{'tableName':_0xfbfc('0xc'),'paranoid':![],'indexes':[{'name':_0xfbfc('0xd'),'fields':[_0xfbfc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 9a70b9f..f3ebbb0 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 _0x6eae=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0xc4e62c,_0x5b226e){var _0x44c950=function(_0x3c1298){while(--_0x3c1298){_0xc4e62c['push'](_0xc4e62c['shift']());}};_0x44c950(++_0x5b226e);}(_0x6eae,0x91));var _0xe6ea=function(_0x7edec0,_0x4a74fd){_0x7edec0=_0x7edec0-0x0;var _0x1553fb=_0x6eae[_0x7edec0];return _0x1553fb;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var moment=require(_0xe6ea('0x2'));var BPromise=require(_0xe6ea('0x3'));var rs=require(_0xe6ea('0x4'));var fs=require('fs');var Redis=require(_0xe6ea('0x5'));var db=require(_0xe6ea('0x6'))['db'];var utils=require(_0xe6ea('0x7'));var logger=require(_0xe6ea('0x8'))(_0xe6ea('0x9'));var config=require('../../config/environment');var jayson=require(_0xe6ea('0xa'));var client=jayson['client'][_0xe6ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b887,_0x40c7dd,_0x31aec5){return new BPromise(function(_0x201d32,_0x253397){return client[_0xe6ea('0xc')](_0x17b887,_0x31aec5)[_0xe6ea('0xd')](function(_0xb981aa){logger['info'](_0xe6ea('0xe'),_0x40c7dd,_0xe6ea('0xf'));logger[_0xe6ea('0x10')](_0xe6ea('0x11'),_0x40c7dd,_0xe6ea('0xf'),JSON['stringify'](_0xb981aa));if(_0xb981aa[_0xe6ea('0x12')]){if(_0xb981aa['error'][_0xe6ea('0x13')]===0x1f4){logger[_0xe6ea('0x12')](_0xe6ea('0xe'),_0x40c7dd,_0xb981aa['error'][_0xe6ea('0x14')]);return _0x253397(_0xb981aa['error'][_0xe6ea('0x14')]);}logger[_0xe6ea('0x12')](_0xe6ea('0xe'),_0x40c7dd,_0xb981aa[_0xe6ea('0x12')]['message']);return _0x201d32(_0xb981aa[_0xe6ea('0x12')][_0xe6ea('0x14')]);}else{logger[_0xe6ea('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x40c7dd,_0xe6ea('0xf'));_0x201d32(_0xb981aa[_0xe6ea('0x16')]['message']);}})[_0xe6ea('0x17')](function(_0x1fe390){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x40c7dd,_0x1fe390);_0x253397(_0x1fe390);});});} \ No newline at end of file +var _0xdcf7=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x41fffd,_0x597cc0){var _0xef53d7=function(_0x53f727){while(--_0x53f727){_0x41fffd['push'](_0x41fffd['shift']());}};_0xef53d7(++_0x597cc0);}(_0xdcf7,0x1a0));var _0x7dcf=function(_0x45afb6,_0x182bf1){_0x45afb6=_0x45afb6-0x0;var _0x1f51e5=_0xdcf7[_0x45afb6];return _0x1f51e5;};'use strict';var _=require(_0x7dcf('0x0'));var util=require(_0x7dcf('0x1'));var moment=require(_0x7dcf('0x2'));var BPromise=require(_0x7dcf('0x3'));var rs=require(_0x7dcf('0x4'));var fs=require('fs');var Redis=require(_0x7dcf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dcf('0x6'));var logger=require('../../config/logger')(_0x7dcf('0x7'));var config=require(_0x7dcf('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7dcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29cbe4,_0x56a2b8,_0x2d7e60){return new BPromise(function(_0x2d4ffe,_0x3efb2e){return client[_0x7dcf('0xa')](_0x29cbe4,_0x2d7e60)['then'](function(_0x40fa73){logger['info'](_0x7dcf('0xb'),_0x56a2b8,_0x7dcf('0xc'));logger['debug'](_0x7dcf('0xd'),_0x56a2b8,_0x7dcf('0xc'),JSON[_0x7dcf('0xe')](_0x40fa73));if(_0x40fa73[_0x7dcf('0xf')]){if(_0x40fa73['error'][_0x7dcf('0x10')]===0x1f4){logger['error'](_0x7dcf('0xb'),_0x56a2b8,_0x40fa73['error'][_0x7dcf('0x11')]);return _0x3efb2e(_0x40fa73[_0x7dcf('0xf')][_0x7dcf('0x11')]);}logger['error'](_0x7dcf('0xb'),_0x56a2b8,_0x40fa73[_0x7dcf('0xf')][_0x7dcf('0x11')]);return _0x2d4ffe(_0x40fa73['error']['message']);}else{logger['info'](_0x7dcf('0xb'),_0x56a2b8,_0x7dcf('0xc'));_0x2d4ffe(_0x40fa73['result'][_0x7dcf('0x11')]);}})[_0x7dcf('0x12')](function(_0x3ad21a){logger['error'](_0x7dcf('0xb'),_0x56a2b8,_0x3ad21a);_0x3efb2e(_0x3ad21a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 423e16a..8be1c69 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 _0x6480=['post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show'];(function(_0x435f2d,_0x1843f9){var _0x5992a7=function(_0x42d25e){while(--_0x42d25e){_0x435f2d['push'](_0x435f2d['shift']());}};_0x5992a7(++_0x1843f9);}(_0x6480,0x1ea));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0648('0x0'));var util=require('util');var path=require(_0x0648('0x1'));var timeout=require(_0x0648('0x2'));var express=require(_0x0648('0x3'));var router=express[_0x0648('0x4')]();var fs_extra=require(_0x0648('0x5'));var auth=require(_0x0648('0x6'));var interaction=require(_0x0648('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x0648('0x8')]('/',auth['isAuthenticated'](),controller[_0x0648('0x9')]);router[_0x0648('0x8')](_0x0648('0xa'),auth[_0x0648('0xb')](),controller[_0x0648('0xc')]);router[_0x0648('0x8')]('/:id',auth[_0x0648('0xb')](),controller[_0x0648('0xd')]);router[_0x0648('0xe')]('/',auth[_0x0648('0xb')](),controller[_0x0648('0xf')]);router['put'](_0x0648('0x10'),auth['isAuthenticated'](),controller[_0x0648('0x11')]);router[_0x0648('0x12')](_0x0648('0x10'),auth[_0x0648('0xb')](),controller[_0x0648('0x13')]);module[_0x0648('0x14')]=router; \ No newline at end of file +var _0x53f3=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','update'];(function(_0x385f5a,_0x320f47){var _0x2eff02=function(_0x22c675){while(--_0x22c675){_0x385f5a['push'](_0x385f5a['shift']());}};_0x2eff02(++_0x320f47);}(_0x53f3,0x95));var _0x353f=function(_0x28d1df,_0x6ee609){_0x28d1df=_0x28d1df-0x0;var _0x48e249=_0x53f3[_0x28d1df];return _0x48e249;};'use strict';var multer=require(_0x353f('0x0'));var util=require(_0x353f('0x1'));var path=require(_0x353f('0x2'));var timeout=require('connect-timeout');var express=require(_0x353f('0x3'));var router=express[_0x353f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x353f('0x5'));var interaction=require(_0x353f('0x6'));var config=require(_0x353f('0x7'));var controller=require(_0x353f('0x8'));router['get']('/',auth[_0x353f('0x9')](),controller[_0x353f('0xa')]);router['get'](_0x353f('0xb'),auth[_0x353f('0x9')](),controller[_0x353f('0xc')]);router[_0x353f('0xd')](_0x353f('0xe'),auth[_0x353f('0x9')](),controller[_0x353f('0xf')]);router[_0x353f('0x10')]('/',auth[_0x353f('0x9')](),controller[_0x353f('0x11')]);router['put'](_0x353f('0xe'),auth['isAuthenticated'](),controller[_0x353f('0x12')]);router[_0x353f('0x13')]('/:id',auth[_0x353f('0x9')](),controller['destroy']);module[_0x353f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0edcb96..be0dc8b 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 _0x5284=['getConfigurations','post','create','addConfiguration','put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5b1df5,_0x25e738){var _0x158df4=function(_0x63a762){while(--_0x63a762){_0x5b1df5['push'](_0x5b1df5['shift']());}};_0x158df4(++_0x25e738);}(_0x5284,0x14a));var _0x4528=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5284[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x4528('0x0'));var util=require(_0x4528('0x1'));var path=require(_0x4528('0x2'));var timeout=require('connect-timeout');var express=require(_0x4528('0x3'));var router=express[_0x4528('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4528('0x5'));var config=require('../../config/environment');var controller=require(_0x4528('0x6'));router[_0x4528('0x7')]('/',auth[_0x4528('0x8')](),controller[_0x4528('0x9')]);router[_0x4528('0x7')](_0x4528('0xa'),auth[_0x4528('0x8')](),controller[_0x4528('0xb')]);router[_0x4528('0x7')]('/:id/configurations',auth[_0x4528('0x8')](),controller[_0x4528('0xc')]);router[_0x4528('0x7')]('/:id/fields',auth[_0x4528('0x8')](),controller['getFields']);router[_0x4528('0xd')]('/',auth[_0x4528('0x8')](),controller[_0x4528('0xe')]);router[_0x4528('0xd')]('/:id/configurations',auth[_0x4528('0x8')](),controller[_0x4528('0xf')]);router[_0x4528('0x10')](_0x4528('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4528('0x11')](_0x4528('0xa'),auth[_0x4528('0x8')](),controller[_0x4528('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5517=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x5517,0x6a));var _0x7551=function(_0xc1cfb4,_0x147528){_0xc1cfb4=_0xc1cfb4-0x0;var _0x54aef6=_0x5517[_0xc1cfb4];return _0x54aef6;};'use strict';var multer=require(_0x7551('0x0'));var util=require('util');var path=require(_0x7551('0x1'));var timeout=require(_0x7551('0x2'));var express=require(_0x7551('0x3'));var router=express[_0x7551('0x4')]();var fs_extra=require(_0x7551('0x5'));var auth=require(_0x7551('0x6'));var interaction=require(_0x7551('0x7'));var config=require(_0x7551('0x8'));var controller=require(_0x7551('0x9'));router[_0x7551('0xa')]('/',auth[_0x7551('0xb')](),controller['index']);router[_0x7551('0xa')](_0x7551('0xc'),auth[_0x7551('0xb')](),controller['show']);router['get']('/:id/configurations',auth[_0x7551('0xb')](),controller[_0x7551('0xd')]);router[_0x7551('0xa')](_0x7551('0xe'),auth[_0x7551('0xb')](),controller[_0x7551('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7551('0x10')]);router[_0x7551('0x11')]('/:id/configurations',auth[_0x7551('0xb')](),controller[_0x7551('0x12')]);router['put'](_0x7551('0xc'),auth[_0x7551('0xb')](),controller[_0x7551('0x13')]);router[_0x7551('0x14')]('/:id',auth[_0x7551('0xb')](),controller[_0x7551('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 0d3ff0d..0bbefb2 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 _0xf9e7=['integrationTab','sequelize','exports','STRING','ENUM','basic','newTab'];(function(_0x1274c6,_0x2f7a97){var _0x113344=function(_0x4a4bee){while(--_0x4a4bee){_0x1274c6['push'](_0x1274c6['shift']());}};_0x113344(++_0x2f7a97);}(_0xf9e7,0x112));var _0x7f9e=function(_0x59a098,_0x2064c1){_0x59a098=_0x59a098-0x0;var _0x5d56dd=_0xf9e7[_0x59a098];return _0x5d56dd;};'use strict';var Sequelize=require(_0x7f9e('0x0'));module[_0x7f9e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f9e('0x2')]},'username':{'type':Sequelize[_0x7f9e('0x2')]},'remoteUri':{'type':Sequelize[_0x7f9e('0x2')]},'authType':{'type':Sequelize[_0x7f9e('0x3')](_0x7f9e('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7f9e('0x2')]},'consumerKey':{'type':Sequelize[_0x7f9e('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7f9e('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7f9e('0x3')]('integrationTab',_0x7f9e('0x5')),'defaultValue':_0x7f9e('0x6')}}; \ No newline at end of file +var _0xc3e7=['sequelize','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xc3e7,0x6c));var _0x7c3e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc3e7[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x7c3e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7c3e('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7c3e('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x7c3e('0x2')),'defaultValue':_0x7c3e('0x2')},'password':{'type':Sequelize[_0x7c3e('0x1')]},'consumerKey':{'type':Sequelize[_0x7c3e('0x1')]},'consumerSecret':{'type':Sequelize[_0x7c3e('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7c3e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7c3e('0x3')](_0x7c3e('0x4'),_0x7c3e('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2610c28..b133af6 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 _0xc3e2=['basic','headers','Authorization','Basic\x20%s','format','base64','concat','_embedded','active','label','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','length','find','create','body','catch','params','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','%s/custom_fields','application/json'];(function(_0x154d6f,_0x5b375e){var _0xe3ab9b=function(_0x40b8a6){while(--_0x40b8a6){_0x154d6f['push'](_0x154d6f['shift']());}};_0xe3ab9b(++_0x5b375e);}(_0xc3e2,0x154));var _0x2c3e=function(_0x1ee06d,_0x351e1c){_0x1ee06d=_0x1ee06d-0x0;var _0x422ccd=_0xc3e2[_0x1ee06d];return _0x422ccd;};'use strict';var emlformat=require(_0x2c3e('0x0'));var rimraf=require(_0x2c3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c3e('0x2'));var rp=require(_0x2c3e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c3e('0x4'));var path=require(_0x2c3e('0x5'));var sox=require('sox');var csv=require(_0x2c3e('0x6'));var ejs=require(_0x2c3e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c3e('0x8'));var squel=require(_0x2c3e('0x9'));var crypto=require(_0x2c3e('0xa'));var jsforce=require(_0x2c3e('0xb'));var deskjs=require(_0x2c3e('0xc'));var toCsv=require(_0x2c3e('0x6'));var querystring=require(_0x2c3e('0xd'));var Papa=require('papaparse');var Redis=require(_0x2c3e('0xe'));var authService=require(_0x2c3e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2c3e('0x10'));var hardwareService=require(_0x2c3e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2c3e('0x12'));var config=require(_0x2c3e('0x13'));var licenseUtil=require(_0x2c3e('0x14'));var db=require(_0x2c3e('0x15'))['db'];var integrations=require(_0x2c3e('0x16'));function respondWithStatusCode(_0x3a2db3,_0xd70fd6){_0xd70fd6=_0xd70fd6||0xcc;return function(_0x5174a8){if(_0x5174a8){return _0x3a2db3['sendStatus'](_0xd70fd6);}return _0x3a2db3[_0x2c3e('0x17')](_0xd70fd6)[_0x2c3e('0x18')]();};}function respondWithResult(_0x3e4907,_0x41de3c){_0x41de3c=_0x41de3c||0xc8;return function(_0x5327c8){if(_0x5327c8){return _0x3e4907[_0x2c3e('0x17')](_0x41de3c)[_0x2c3e('0x19')](_0x5327c8);}};}function respondWithFilteredResult(_0x1eebaf,_0x8579e1){return function(_0x2ffa7c){if(_0x2ffa7c){var _0x3c1073=typeof _0x8579e1[_0x2c3e('0x1a')]===_0x2c3e('0x1b')&&typeof _0x8579e1[_0x2c3e('0x1c')]==='undefined';var _0x5cb648=_0x2ffa7c[_0x2c3e('0x1d')];var _0x19ca88=_0x3c1073?0x0:_0x8579e1['offset'];var _0xc4306c=_0x3c1073?_0x2ffa7c[_0x2c3e('0x1d')]:_0x8579e1[_0x2c3e('0x1a')]+_0x8579e1[_0x2c3e('0x1c')];var _0x37684a;if(_0xc4306c>=_0x5cb648){_0xc4306c=_0x5cb648;_0x37684a=0xc8;}else{_0x37684a=0xce;}_0x1eebaf['status'](_0x37684a);return _0x1eebaf[_0x2c3e('0x1e')](_0x2c3e('0x1f'),_0x19ca88+'-'+_0xc4306c+'/'+_0x5cb648)['json'](_0x2ffa7c);}return null;};}function patchUpdates(_0x1ee5eb){return function(_0x17d651){try{jsonpatch[_0x2c3e('0x20')](_0x17d651,_0x1ee5eb,!![]);}catch(_0x8c8cf8){return BPromise[_0x2c3e('0x21')](_0x8c8cf8);}return _0x17d651['save']();};}function saveUpdates(_0x58981e,_0x7703ec){return function(_0x1ed922){if(_0x1ed922){return _0x1ed922[_0x2c3e('0x22')](_0x58981e)[_0x2c3e('0x23')](function(_0x2f21b7){return _0x2f21b7;});}return null;};}function removeEntity(_0x9dceac,_0x15f8e7){return function(_0x180279){if(_0x180279){return _0x180279['destroy']()[_0x2c3e('0x23')](function(){_0x9dceac[_0x2c3e('0x17')](0xcc)[_0x2c3e('0x18')]();});}};}function handleEntityNotFound(_0x10702d,_0x220b1f){return function(_0x46a807){if(!_0x46a807){_0x10702d[_0x2c3e('0x24')](0x194);}return _0x46a807;};}function handleError(_0x50ae64,_0x276cc6){_0x276cc6=_0x276cc6||0x1f4;return function(_0x4fd194){logger[_0x2c3e('0x25')](_0x4fd194[_0x2c3e('0x26')]);if(_0x4fd194['name']){delete _0x4fd194[_0x2c3e('0x27')];}_0x50ae64[_0x2c3e('0x17')](_0x276cc6)[_0x2c3e('0x28')](_0x4fd194);};}exports[_0x2c3e('0x29')]=function(_0x2d4276,_0x463b22){var _0x5ebb1e={},_0x544c3c={},_0x4575eb={'count':0x0,'rows':[]};var _0x305a75=_[_0x2c3e('0x2a')](db[_0x2c3e('0x2b')][_0x2c3e('0x2c')],function(_0xcb98ca){return{'name':_0xcb98ca['fieldName'],'type':_0xcb98ca[_0x2c3e('0x2d')][_0x2c3e('0x2e')]};});_0x544c3c[_0x2c3e('0x2f')]=_[_0x2c3e('0x2a')](_0x305a75,_0x2c3e('0x27'));_0x544c3c[_0x2c3e('0x30')]=_[_0x2c3e('0x31')](_0x2d4276['query']);_0x544c3c[_0x2c3e('0x32')]=_['intersection'](_0x544c3c[_0x2c3e('0x2f')],_0x544c3c[_0x2c3e('0x30')]);_0x5ebb1e[_0x2c3e('0x33')]=_[_0x2c3e('0x34')](_0x544c3c[_0x2c3e('0x2f')],qs[_0x2c3e('0x35')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x35')]));_0x5ebb1e[_0x2c3e('0x33')]=_0x5ebb1e['attributes']['length']?_0x5ebb1e['attributes']:_0x544c3c[_0x2c3e('0x2f')];if(!_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x36')](_0x2c3e('0x37'))){_0x5ebb1e['limit']=qs[_0x2c3e('0x1c')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x1c')]);_0x5ebb1e[_0x2c3e('0x1a')]=qs[_0x2c3e('0x1a')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x1a')]);}_0x5ebb1e['order']=qs[_0x2c3e('0x38')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x38')]);_0x5ebb1e[_0x2c3e('0x39')]=qs[_0x2c3e('0x32')](_[_0x2c3e('0x3a')](_0x2d4276[_0x2c3e('0x30')],_0x544c3c[_0x2c3e('0x32')]),_0x305a75);if(_0x2d4276[_0x2c3e('0x30')]['filter']){_0x5ebb1e['where']=_[_0x2c3e('0x3b')](_0x5ebb1e['where'],{'$or':_[_0x2c3e('0x2a')](_0x305a75,function(_0x25691f){if(_0x25691f[_0x2c3e('0x2d')]!==_0x2c3e('0x3c')){var _0x289a3f={};_0x289a3f[_0x25691f[_0x2c3e('0x27')]]={'$like':'%'+_0x2d4276['query'][_0x2c3e('0x3d')]+'%'};return _0x289a3f;}})});}_0x5ebb1e=_[_0x2c3e('0x3b')]({},_0x5ebb1e,_0x2d4276[_0x2c3e('0x3e')]);var _0x2803f5={'where':_0x5ebb1e[_0x2c3e('0x39')]};return db[_0x2c3e('0x2b')][_0x2c3e('0x1d')](_0x2803f5)['then'](function(_0x1eb737){_0x4575eb[_0x2c3e('0x1d')]=_0x1eb737;if(_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x3f')]){_0x5ebb1e[_0x2c3e('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x2c3e('0x41')](_0x5ebb1e);})['then'](function(_0x3afb7e){_0x4575eb[_0x2c3e('0x42')]=_0x3afb7e;return _0x4575eb;})[_0x2c3e('0x23')](respondWithFilteredResult(_0x463b22,_0x5ebb1e))['catch'](handleError(_0x463b22,null));};exports['show']=function(_0x3c0ee5,_0x5f1242){var _0x3b8c86={'raw':![],'where':{'id':_0x3c0ee5['params']['id']}},_0x3a3544={};_0x3a3544['model']=_['keys'](db[_0x2c3e('0x2b')]['rawAttributes']);_0x3a3544[_0x2c3e('0x30')]=_['keys'](_0x3c0ee5[_0x2c3e('0x30')]);_0x3a3544[_0x2c3e('0x32')]=_[_0x2c3e('0x34')](_0x3a3544[_0x2c3e('0x2f')],_0x3a3544[_0x2c3e('0x30')]);_0x3b8c86[_0x2c3e('0x33')]=_['intersection'](_0x3a3544['model'],qs[_0x2c3e('0x35')](_0x3c0ee5[_0x2c3e('0x30')]['fields']));_0x3b8c86[_0x2c3e('0x33')]=_0x3b8c86[_0x2c3e('0x33')][_0x2c3e('0x43')]?_0x3b8c86[_0x2c3e('0x33')]:_0x3a3544[_0x2c3e('0x2f')];if(_0x3c0ee5[_0x2c3e('0x30')][_0x2c3e('0x3f')]){_0x3b8c86[_0x2c3e('0x40')]=[{'all':!![]}];}_0x3b8c86=_[_0x2c3e('0x3b')]({},_0x3b8c86,_0x3c0ee5[_0x2c3e('0x3e')]);return db[_0x2c3e('0x2b')][_0x2c3e('0x44')](_0x3b8c86)[_0x2c3e('0x23')](handleEntityNotFound(_0x5f1242,null))[_0x2c3e('0x23')](respondWithResult(_0x5f1242,null))['catch'](handleError(_0x5f1242,null));};exports[_0x2c3e('0x45')]=function(_0x5bfd5e,_0x4ade95){return db[_0x2c3e('0x2b')][_0x2c3e('0x45')](_0x5bfd5e[_0x2c3e('0x46')],{})[_0x2c3e('0x23')](respondWithResult(_0x4ade95,0xc9))[_0x2c3e('0x47')](handleError(_0x4ade95,null));};exports[_0x2c3e('0x22')]=function(_0x503491,_0x5c50ee){if(_0x503491['body']['id']){delete _0x503491[_0x2c3e('0x46')]['id'];}return db[_0x2c3e('0x2b')][_0x2c3e('0x44')]({'where':{'id':_0x503491[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x5c50ee,null))[_0x2c3e('0x23')](saveUpdates(_0x503491['body'],null))['then'](respondWithResult(_0x5c50ee,null))[_0x2c3e('0x47')](handleError(_0x5c50ee,null));};exports[_0x2c3e('0x49')]=function(_0x5a86b3,_0x2cb503){return db[_0x2c3e('0x2b')][_0x2c3e('0x44')]({'where':{'id':_0x5a86b3[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x2cb503,null))[_0x2c3e('0x23')](removeEntity(_0x2cb503,null))[_0x2c3e('0x47')](handleError(_0x2cb503,null));};exports[_0x2c3e('0x4a')]=function(_0x561902,_0x25a59e,_0x529369){var _0x4f10b1={};var _0x5aed05={};var _0xb193db;var _0x5e39f2;return db[_0x2c3e('0x2b')][_0x2c3e('0x4b')]({'where':{'id':_0x561902[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x25a59e,null))['then'](function(_0x14e7c6){if(_0x14e7c6){_0xb193db=_0x14e7c6;_0x5aed05[_0x2c3e('0x2f')]=_[_0x2c3e('0x31')](db[_0x2c3e('0x4c')]['rawAttributes']);_0x5aed05[_0x2c3e('0x30')]=_['keys'](_0x561902[_0x2c3e('0x30')]);_0x5aed05[_0x2c3e('0x32')]=_[_0x2c3e('0x34')](_0x5aed05[_0x2c3e('0x2f')],_0x5aed05['query']);_0x4f10b1[_0x2c3e('0x33')]=_[_0x2c3e('0x34')](_0x5aed05[_0x2c3e('0x2f')],qs[_0x2c3e('0x35')](_0x561902[_0x2c3e('0x30')][_0x2c3e('0x35')]));_0x4f10b1[_0x2c3e('0x33')]=_0x4f10b1[_0x2c3e('0x33')][_0x2c3e('0x43')]?_0x4f10b1[_0x2c3e('0x33')]:_0x5aed05['model'];_0x4f10b1['order']=qs['sort'](_0x561902['query'][_0x2c3e('0x38')]);_0x4f10b1[_0x2c3e('0x39')]=qs[_0x2c3e('0x32')](_[_0x2c3e('0x3a')](_0x561902['query'],_0x5aed05[_0x2c3e('0x32')]));if(_0x561902[_0x2c3e('0x30')]['filter']){_0x4f10b1['where']=_[_0x2c3e('0x3b')](_0x4f10b1[_0x2c3e('0x39')],{'$or':_[_0x2c3e('0x2a')](_0x4f10b1[_0x2c3e('0x33')],function(_0x45c910){var _0x27b432={};_0x27b432[_0x45c910]={'$like':'%'+_0x561902[_0x2c3e('0x30')][_0x2c3e('0x3d')]+'%'};return _0x27b432;})});}_0x4f10b1=_[_0x2c3e('0x3b')]({},_0x4f10b1,_0x561902[_0x2c3e('0x3e')]);return _0xb193db['getConfigurations'](_0x4f10b1);}})[_0x2c3e('0x23')](function(_0x424b6e){if(_0x424b6e){_0x5e39f2=_0x424b6e[_0x2c3e('0x43')];if(!_0x561902[_0x2c3e('0x30')][_0x2c3e('0x36')]('nolimit')){_0x4f10b1[_0x2c3e('0x1c')]=qs[_0x2c3e('0x1c')](_0x561902['query'][_0x2c3e('0x1c')]);_0x4f10b1[_0x2c3e('0x1a')]=qs[_0x2c3e('0x1a')](_0x561902[_0x2c3e('0x30')]['offset']);}return _0xb193db[_0x2c3e('0x4a')](_0x4f10b1);}})[_0x2c3e('0x23')](function(_0xe5cfc5){if(_0xe5cfc5){return _0xe5cfc5?{'count':_0x5e39f2,'rows':_0xe5cfc5}:null;}})[_0x2c3e('0x23')](respondWithResult(_0x25a59e,null))[_0x2c3e('0x47')](handleError(_0x25a59e,null));};exports[_0x2c3e('0x4d')]=function(_0x508ae9,_0x3f56ed,_0x2a7d4e){if(_0x508ae9[_0x2c3e('0x46')]['id']){delete _0x508ae9[_0x2c3e('0x46')]['id'];}return db['DeskAccount'][_0x2c3e('0x4b')]({'where':{'id':_0x508ae9[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x3f56ed,null))[_0x2c3e('0x23')](function(_0x4bfc62){if(_0x4bfc62){_0x508ae9['body']['AccountId']=_0x4bfc62['id'];_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x4e')]=integrations[_0x2c3e('0x4f')](_0x508ae9['body'][_0x2c3e('0x50')],_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x2d')]);_0x508ae9[_0x2c3e('0x46')]['Descriptions']=integrations['getDescriptions'](_0x508ae9['body'][_0x2c3e('0x50')],_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x2d')]);return db[_0x2c3e('0x4c')]['create'](_0x508ae9['body'],{'include':[{'model':db[_0x2c3e('0x51')],'as':'Subjects'},{'model':db[_0x2c3e('0x51')],'as':_0x2c3e('0x52')}]});}return null;})[_0x2c3e('0x23')](respondWithResult(_0x3f56ed,null))[_0x2c3e('0x47')](handleError(_0x3f56ed,null));};exports[_0x2c3e('0x53')]=function(_0x3f7b36,_0xe80065,_0x56b165){var _0x55e729=[{'name':_0x2c3e('0x54'),'label':_0x2c3e('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1a6990='';return db['DeskAccount'][_0x2c3e('0x4b')]({'where':{'id':_0x3f7b36[_0x2c3e('0x48')]['id']},'attributes':['id',_0x2c3e('0x55'),_0x2c3e('0x56'),_0x2c3e('0x57'),_0x2c3e('0x58'),_0x2c3e('0x59'),'consumerSecret',_0x2c3e('0x5a'),_0x2c3e('0x5b')]})[_0x2c3e('0x23')](handleEntityNotFound(_0xe80065,null))[_0x2c3e('0x23')](function(_0x5b5496){if(_0x5b5496){_0x1a6990=_0x5b5496[_0x2c3e('0x55')];var _0x3bef32=_0x1a6990['slice'](-0x1);if(_0x3bef32==='/'){_0x1a6990=_0x1a6990[_0x2c3e('0x5c')](0x0,_0x1a6990[_0x2c3e('0x5d')](_0x3bef32));}var _0x488996={'method':'GET','uri':util['format'](_0x2c3e('0x5e'),_0x1a6990),'headers':{'Content-Type':'application/json','Accept':_0x2c3e('0x5f')},'json':!![]};if(_0x5b5496[_0x2c3e('0x56')]===_0x2c3e('0x60')){_0x488996[_0x2c3e('0x61')][_0x2c3e('0x62')]=util['format'](_0x2c3e('0x63'),new Buffer(util[_0x2c3e('0x64')]('%s:%s',_0x5b5496[_0x2c3e('0x57')],_0x5b5496[_0x2c3e('0x58')]))['toString'](_0x2c3e('0x65')));}return rp(_0x488996)[_0x2c3e('0x23')](function(_0x11025d){return _0x55e729[_0x2c3e('0x66')](_['map'](_0x11025d[_0x2c3e('0x67')]['entries'],function(_0x5a13ee){return{'id':_0x5a13ee[_0x2c3e('0x27')],'name':_0x5a13ee['name'],'type':_0x5a13ee[_0x2c3e('0x2d')],'active':_0x5a13ee[_0x2c3e('0x68')],'label':_0x5a13ee[_0x2c3e('0x69')],'custom':!![]};}));});}})[_0x2c3e('0x23')](function(_0x31fc8d){return{'count':_0x31fc8d[_0x2c3e('0x43')],'rows':_0x31fc8d};})[_0x2c3e('0x23')](respondWithResult(_0xe80065,null))['catch'](function(_0x1cd7d6){var _0x4fb42c=_0x3f7b36[_0x2c3e('0x30')][_0x2c3e('0x6a')]?0x1f4:_0x1cd7d6['statusCode']||0x1f4;logger[_0x2c3e('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x2c3e('0x53'),_0x4fb42c,JSON['stringify'](_0x1cd7d6));delete _0x1cd7d6['name'];if(_0x4fb42c===0x191){_0x4fb42c=0x190;}_0xe80065[_0x2c3e('0x17')](_0x4fb42c)[_0x2c3e('0x28')](_0x3f7b36[_0x2c3e('0x30')]['test']?{'message':_0x2c3e('0x6b'),'statusCode':_0x1cd7d6[_0x2c3e('0x6c')]}:_0x1cd7d6);});}; \ No newline at end of file +var _0x0c64=['then','destroy','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','findOne','remoteUri','authType','username','consumerKey','token','slice','GET','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','base64','_embedded','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','save','update'];(function(_0x680a2d,_0x4eb9d7){var _0x20ef0e=function(_0x45d9c9){while(--_0x45d9c9){_0x680a2d['push'](_0x680a2d['shift']());}};_0x20ef0e(++_0x4eb9d7);}(_0x0c64,0x18d));var _0x40c6=function(_0x17c097,_0x13a65d){_0x17c097=_0x17c097-0x0;var _0x1ac1ac=_0x0c64[_0x17c097];return _0x1ac1ac;};'use strict';var emlformat=require(_0x40c6('0x0'));var rimraf=require(_0x40c6('0x1'));var zipdir=require(_0x40c6('0x2'));var jsonpatch=require(_0x40c6('0x3'));var rp=require(_0x40c6('0x4'));var moment=require('moment');var BPromise=require(_0x40c6('0x5'));var Mustache=require(_0x40c6('0x6'));var util=require(_0x40c6('0x7'));var path=require(_0x40c6('0x8'));var sox=require(_0x40c6('0x9'));var csv=require(_0x40c6('0xa'));var ejs=require(_0x40c6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40c6('0xc'));var squel=require(_0x40c6('0xd'));var crypto=require(_0x40c6('0xe'));var jsforce=require(_0x40c6('0xf'));var deskjs=require(_0x40c6('0x10'));var toCsv=require(_0x40c6('0xa'));var querystring=require(_0x40c6('0x11'));var Papa=require(_0x40c6('0x12'));var Redis=require(_0x40c6('0x13'));var authService=require(_0x40c6('0x14'));var qs=require(_0x40c6('0x15'));var as=require(_0x40c6('0x16'));var hardwareService=require(_0x40c6('0x17'));var logger=require(_0x40c6('0x18'))(_0x40c6('0x19'));var utils=require('../../config/utils');var config=require(_0x40c6('0x1a'));var licenseUtil=require(_0x40c6('0x1b'));var db=require(_0x40c6('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59f5bf,_0x43fece){_0x43fece=_0x43fece||0xcc;return function(_0x4f3401){if(_0x4f3401){return _0x59f5bf['sendStatus'](_0x43fece);}return _0x59f5bf[_0x40c6('0x1d')](_0x43fece)[_0x40c6('0x1e')]();};}function respondWithResult(_0x52d99a,_0x4be5b5){_0x4be5b5=_0x4be5b5||0xc8;return function(_0x5bcca6){if(_0x5bcca6){return _0x52d99a[_0x40c6('0x1d')](_0x4be5b5)['json'](_0x5bcca6);}};}function respondWithFilteredResult(_0x423003,_0x2923ef){return function(_0x5e1b26){if(_0x5e1b26){var _0x49f703=typeof _0x2923ef[_0x40c6('0x1f')]===_0x40c6('0x20')&&typeof _0x2923ef['limit']===_0x40c6('0x20');var _0x5aa483=_0x5e1b26[_0x40c6('0x21')];var _0x5dbaef=_0x49f703?0x0:_0x2923ef['offset'];var _0x8929=_0x49f703?_0x5e1b26[_0x40c6('0x21')]:_0x2923ef[_0x40c6('0x1f')]+_0x2923ef[_0x40c6('0x22')];var _0x1c41ba;if(_0x8929>=_0x5aa483){_0x8929=_0x5aa483;_0x1c41ba=0xc8;}else{_0x1c41ba=0xce;}_0x423003[_0x40c6('0x1d')](_0x1c41ba);return _0x423003[_0x40c6('0x23')]('Content-Range',_0x5dbaef+'-'+_0x8929+'/'+_0x5aa483)[_0x40c6('0x24')](_0x5e1b26);}return null;};}function patchUpdates(_0x24d4dd){return function(_0x15580f){try{jsonpatch['apply'](_0x15580f,_0x24d4dd,!![]);}catch(_0x1c24f0){return BPromise['reject'](_0x1c24f0);}return _0x15580f[_0x40c6('0x25')]();};}function saveUpdates(_0x1f9006,_0x2bde3d){return function(_0x53d96e){if(_0x53d96e){return _0x53d96e[_0x40c6('0x26')](_0x1f9006)[_0x40c6('0x27')](function(_0x424024){return _0x424024;});}return null;};}function removeEntity(_0x481cd8,_0x51bb83){return function(_0x414ff6){if(_0x414ff6){return _0x414ff6[_0x40c6('0x28')]()['then'](function(){_0x481cd8[_0x40c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d7603,_0x171615){return function(_0x18bdcf){if(!_0x18bdcf){_0x5d7603[_0x40c6('0x29')](0x194);}return _0x18bdcf;};}function handleError(_0xd557ee,_0x210ce1){_0x210ce1=_0x210ce1||0x1f4;return function(_0x110c14){logger[_0x40c6('0x2a')](_0x110c14[_0x40c6('0x2b')]);if(_0x110c14[_0x40c6('0x2c')]){delete _0x110c14[_0x40c6('0x2c')];}_0xd557ee['status'](_0x210ce1)[_0x40c6('0x2d')](_0x110c14);};}exports['index']=function(_0x91bfdb,_0x2d21e5){var _0x590537={},_0x3365e2={},_0x5bc85d={'count':0x0,'rows':[]};var _0x4f24f1=_[_0x40c6('0x2e')](db[_0x40c6('0x2f')][_0x40c6('0x30')],function(_0x5b05fe){return{'name':_0x5b05fe[_0x40c6('0x31')],'type':_0x5b05fe['type']['key']};});_0x3365e2['model']=_['map'](_0x4f24f1,'name');_0x3365e2[_0x40c6('0x32')]=_['keys'](_0x91bfdb[_0x40c6('0x32')]);_0x3365e2['filters']=_[_0x40c6('0x33')](_0x3365e2[_0x40c6('0x34')],_0x3365e2['query']);_0x590537['attributes']=_[_0x40c6('0x33')](_0x3365e2['model'],qs['fields'](_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x35')]));_0x590537[_0x40c6('0x36')]=_0x590537[_0x40c6('0x36')][_0x40c6('0x37')]?_0x590537[_0x40c6('0x36')]:_0x3365e2[_0x40c6('0x34')];if(!_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x38')](_0x40c6('0x39'))){_0x590537[_0x40c6('0x22')]=qs[_0x40c6('0x22')](_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x22')]);_0x590537[_0x40c6('0x1f')]=qs[_0x40c6('0x1f')](_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x1f')]);}_0x590537[_0x40c6('0x3a')]=qs[_0x40c6('0x3b')](_0x91bfdb['query'][_0x40c6('0x3b')]);_0x590537[_0x40c6('0x3c')]=qs[_0x40c6('0x3d')](_[_0x40c6('0x3e')](_0x91bfdb[_0x40c6('0x32')],_0x3365e2[_0x40c6('0x3d')]),_0x4f24f1);if(_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x3f')]){_0x590537[_0x40c6('0x3c')]=_[_0x40c6('0x40')](_0x590537[_0x40c6('0x3c')],{'$or':_[_0x40c6('0x2e')](_0x4f24f1,function(_0x2bc7f3){if(_0x2bc7f3[_0x40c6('0x41')]!==_0x40c6('0x42')){var _0x510f6a={};_0x510f6a[_0x2bc7f3[_0x40c6('0x2c')]]={'$like':'%'+_0x91bfdb[_0x40c6('0x32')][_0x40c6('0x3f')]+'%'};return _0x510f6a;}})});}_0x590537=_[_0x40c6('0x40')]({},_0x590537,_0x91bfdb[_0x40c6('0x43')]);var _0x244798={'where':_0x590537[_0x40c6('0x3c')]};return db['DeskAccount'][_0x40c6('0x21')](_0x244798)[_0x40c6('0x27')](function(_0x38c65f){_0x5bc85d[_0x40c6('0x21')]=_0x38c65f;if(_0x91bfdb['query'][_0x40c6('0x44')]){_0x590537[_0x40c6('0x45')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x590537);})['then'](function(_0x1356fe){_0x5bc85d['rows']=_0x1356fe;return _0x5bc85d;})[_0x40c6('0x27')](respondWithFilteredResult(_0x2d21e5,_0x590537))[_0x40c6('0x46')](handleError(_0x2d21e5,null));};exports[_0x40c6('0x47')]=function(_0x7f7ba3,_0x36a4a8){var _0x2f7e35={'raw':![],'where':{'id':_0x7f7ba3[_0x40c6('0x48')]['id']}},_0x325b36={};_0x325b36[_0x40c6('0x34')]=_[_0x40c6('0x49')](db[_0x40c6('0x2f')][_0x40c6('0x30')]);_0x325b36['query']=_['keys'](_0x7f7ba3[_0x40c6('0x32')]);_0x325b36[_0x40c6('0x3d')]=_[_0x40c6('0x33')](_0x325b36[_0x40c6('0x34')],_0x325b36[_0x40c6('0x32')]);_0x2f7e35[_0x40c6('0x36')]=_[_0x40c6('0x33')](_0x325b36['model'],qs[_0x40c6('0x35')](_0x7f7ba3['query']['fields']));_0x2f7e35[_0x40c6('0x36')]=_0x2f7e35['attributes']['length']?_0x2f7e35['attributes']:_0x325b36['model'];if(_0x7f7ba3[_0x40c6('0x32')]['includeAll']){_0x2f7e35['include']=[{'all':!![]}];}_0x2f7e35=_[_0x40c6('0x40')]({},_0x2f7e35,_0x7f7ba3[_0x40c6('0x43')]);return db['DeskAccount'][_0x40c6('0x4a')](_0x2f7e35)[_0x40c6('0x27')](handleEntityNotFound(_0x36a4a8,null))['then'](respondWithResult(_0x36a4a8,null))[_0x40c6('0x46')](handleError(_0x36a4a8,null));};exports['create']=function(_0x4c9106,_0x42ad5f){return db[_0x40c6('0x2f')][_0x40c6('0x4b')](_0x4c9106[_0x40c6('0x4c')],{})[_0x40c6('0x27')](respondWithResult(_0x42ad5f,0xc9))['catch'](handleError(_0x42ad5f,null));};exports['update']=function(_0x2227fb,_0x2c4b44){if(_0x2227fb['body']['id']){delete _0x2227fb[_0x40c6('0x4c')]['id'];}return db[_0x40c6('0x2f')]['find']({'where':{'id':_0x2227fb[_0x40c6('0x48')]['id']}})[_0x40c6('0x27')](handleEntityNotFound(_0x2c4b44,null))[_0x40c6('0x27')](saveUpdates(_0x2227fb[_0x40c6('0x4c')],null))['then'](respondWithResult(_0x2c4b44,null))[_0x40c6('0x46')](handleError(_0x2c4b44,null));};exports['destroy']=function(_0x108e3d,_0x96f145){return db[_0x40c6('0x2f')][_0x40c6('0x4a')]({'where':{'id':_0x108e3d[_0x40c6('0x48')]['id']}})[_0x40c6('0x27')](handleEntityNotFound(_0x96f145,null))[_0x40c6('0x27')](removeEntity(_0x96f145,null))[_0x40c6('0x46')](handleError(_0x96f145,null));};exports['getConfigurations']=function(_0x31a91b,_0x1489c7,_0x57b1c1){var _0x33eaaf={};var _0x19157b={};var _0x5233df;var _0x5afd68;return db['DeskAccount']['findOne']({'where':{'id':_0x31a91b[_0x40c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1489c7,null))[_0x40c6('0x27')](function(_0x38ef9c){if(_0x38ef9c){_0x5233df=_0x38ef9c;_0x19157b[_0x40c6('0x34')]=_[_0x40c6('0x49')](db['DeskConfiguration'][_0x40c6('0x30')]);_0x19157b[_0x40c6('0x32')]=_[_0x40c6('0x49')](_0x31a91b[_0x40c6('0x32')]);_0x19157b[_0x40c6('0x3d')]=_['intersection'](_0x19157b['model'],_0x19157b['query']);_0x33eaaf[_0x40c6('0x36')]=_['intersection'](_0x19157b[_0x40c6('0x34')],qs[_0x40c6('0x35')](_0x31a91b[_0x40c6('0x32')][_0x40c6('0x35')]));_0x33eaaf[_0x40c6('0x36')]=_0x33eaaf[_0x40c6('0x36')]['length']?_0x33eaaf['attributes']:_0x19157b['model'];_0x33eaaf[_0x40c6('0x3a')]=qs[_0x40c6('0x3b')](_0x31a91b[_0x40c6('0x32')]['sort']);_0x33eaaf[_0x40c6('0x3c')]=qs[_0x40c6('0x3d')](_[_0x40c6('0x3e')](_0x31a91b[_0x40c6('0x32')],_0x19157b[_0x40c6('0x3d')]));if(_0x31a91b[_0x40c6('0x32')][_0x40c6('0x3f')]){_0x33eaaf[_0x40c6('0x3c')]=_[_0x40c6('0x40')](_0x33eaaf[_0x40c6('0x3c')],{'$or':_[_0x40c6('0x2e')](_0x33eaaf[_0x40c6('0x36')],function(_0x2a0c05){var _0x299845={};_0x299845[_0x2a0c05]={'$like':'%'+_0x31a91b[_0x40c6('0x32')][_0x40c6('0x3f')]+'%'};return _0x299845;})});}_0x33eaaf=_[_0x40c6('0x40')]({},_0x33eaaf,_0x31a91b['options']);return _0x5233df[_0x40c6('0x4d')](_0x33eaaf);}})[_0x40c6('0x27')](function(_0x26eced){if(_0x26eced){_0x5afd68=_0x26eced[_0x40c6('0x37')];if(!_0x31a91b[_0x40c6('0x32')][_0x40c6('0x38')](_0x40c6('0x39'))){_0x33eaaf['limit']=qs[_0x40c6('0x22')](_0x31a91b[_0x40c6('0x32')][_0x40c6('0x22')]);_0x33eaaf['offset']=qs[_0x40c6('0x1f')](_0x31a91b[_0x40c6('0x32')][_0x40c6('0x1f')]);}return _0x5233df['getConfigurations'](_0x33eaaf);}})[_0x40c6('0x27')](function(_0x3c82c9){if(_0x3c82c9){return _0x3c82c9?{'count':_0x5afd68,'rows':_0x3c82c9}:null;}})[_0x40c6('0x27')](respondWithResult(_0x1489c7,null))[_0x40c6('0x46')](handleError(_0x1489c7,null));};exports[_0x40c6('0x4e')]=function(_0x306e31,_0x55a798,_0x2c78e6){if(_0x306e31[_0x40c6('0x4c')]['id']){delete _0x306e31['body']['id'];}return db[_0x40c6('0x2f')]['findOne']({'where':{'id':_0x306e31[_0x40c6('0x48')]['id']}})[_0x40c6('0x27')](handleEntityNotFound(_0x55a798,null))['then'](function(_0x2abf1f){if(_0x2abf1f){_0x306e31[_0x40c6('0x4c')][_0x40c6('0x4f')]=_0x2abf1f['id'];_0x306e31[_0x40c6('0x4c')][_0x40c6('0x50')]=integrations['getSubjects'](_0x306e31[_0x40c6('0x4c')]['channel'],_0x306e31[_0x40c6('0x4c')][_0x40c6('0x41')]);_0x306e31['body'][_0x40c6('0x51')]=integrations[_0x40c6('0x52')](_0x306e31[_0x40c6('0x4c')][_0x40c6('0x53')],_0x306e31[_0x40c6('0x4c')][_0x40c6('0x41')]);return db['DeskConfiguration'][_0x40c6('0x4b')](_0x306e31['body'],{'include':[{'model':db[_0x40c6('0x54')],'as':_0x40c6('0x50')},{'model':db[_0x40c6('0x54')],'as':_0x40c6('0x51')}]});}return null;})[_0x40c6('0x27')](respondWithResult(_0x55a798,null))['catch'](handleError(_0x55a798,null));};exports[_0x40c6('0x55')]=function(_0x20a9cd,_0x3510e5,_0x53b196){var _0x5f5d63=[{'name':_0x40c6('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x194c40='';return db[_0x40c6('0x2f')][_0x40c6('0x57')]({'where':{'id':_0x20a9cd[_0x40c6('0x48')]['id']},'attributes':['id',_0x40c6('0x58'),_0x40c6('0x59'),_0x40c6('0x5a'),'password',_0x40c6('0x5b'),'consumerSecret',_0x40c6('0x5c'),'tokenSecret']})[_0x40c6('0x27')](handleEntityNotFound(_0x3510e5,null))[_0x40c6('0x27')](function(_0x102ca0){if(_0x102ca0){_0x194c40=_0x102ca0['remoteUri'];var _0x2ac6cc=_0x194c40[_0x40c6('0x5d')](-0x1);if(_0x2ac6cc==='/'){_0x194c40=_0x194c40['substring'](0x0,_0x194c40['lastIndexOf'](_0x2ac6cc));}var _0x4484c0={'method':_0x40c6('0x5e'),'uri':util['format'](_0x40c6('0x5f'),_0x194c40),'headers':{'Content-Type':'application/json','Accept':_0x40c6('0x60')},'json':!![]};if(_0x102ca0[_0x40c6('0x59')]===_0x40c6('0x61')){_0x4484c0[_0x40c6('0x62')]['Authorization']=util[_0x40c6('0x63')](_0x40c6('0x64'),new Buffer(util['format']('%s:%s',_0x102ca0[_0x40c6('0x5a')],_0x102ca0['password']))['toString'](_0x40c6('0x65')));}return rp(_0x4484c0)[_0x40c6('0x27')](function(_0x5e071b){return _0x5f5d63['concat'](_['map'](_0x5e071b[_0x40c6('0x66')]['entries'],function(_0x50e6f9){return{'id':_0x50e6f9['name'],'name':_0x50e6f9['name'],'type':_0x50e6f9[_0x40c6('0x41')],'active':_0x50e6f9[_0x40c6('0x67')],'label':_0x50e6f9[_0x40c6('0x68')],'custom':!![]};}));});}})['then'](function(_0x37f84d){return{'count':_0x37f84d[_0x40c6('0x37')],'rows':_0x37f84d};})[_0x40c6('0x27')](respondWithResult(_0x3510e5,null))[_0x40c6('0x46')](function(_0x1f86ba){var _0x2cfdad=_0x20a9cd[_0x40c6('0x32')][_0x40c6('0x69')]?0x1f4:_0x1f86ba[_0x40c6('0x6a')]||0x1f4;logger[_0x40c6('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0x40c6('0x55'),_0x2cfdad,JSON[_0x40c6('0x6b')](_0x1f86ba));delete _0x1f86ba[_0x40c6('0x2c')];if(_0x2cfdad===0x191){_0x2cfdad=0x190;}_0x3510e5['status'](_0x2cfdad)[_0x40c6('0x2d')](_0x20a9cd[_0x40c6('0x32')]['test']?{'message':_0x40c6('0x6c'),'statusCode':_0x1f86ba['statusCode']}:_0x1f86ba);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 994a364..5062726 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 _0x75c4=['int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x27418b,_0x16155a){var _0x147fc4=function(_0x1d50e0){while(--_0x1d50e0){_0x27418b['push'](_0x27418b['shift']());}};_0x147fc4(++_0x16155a);}(_0x75c4,0x1c9));var _0x475c=function(_0x385403,_0x27f102){_0x385403=_0x385403-0x0;var _0x8a8abf=_0x75c4[_0x385403];return _0x8a8abf;};'use strict';var _=require(_0x475c('0x0'));var util=require(_0x475c('0x1'));var logger=require(_0x475c('0x2'))(_0x475c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x475c('0x4'));var fs=require('fs');var path=require(_0x475c('0x5'));var rimraf=require('rimraf');var config=require(_0x475c('0x6'));var attributes=require(_0x475c('0x7'));var integrations=require(_0x475c('0x8'));module[_0x475c('0x9')]=function(_0x21f1f4,_0x1ec094){return _0x21f1f4['define'](_0x475c('0xa'),attributes,{'tableName':_0x475c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d2=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','api','request-promise'];(function(_0x5a357f,_0x3b5448){var _0x2e623f=function(_0xcef30b){while(--_0xcef30b){_0x5a357f['push'](_0x5a357f['shift']());}};_0x2e623f(++_0x3b5448);}(_0x21d2,0x178));var _0x221d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x21d2[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x221d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x221d('0x1'));var fs=require('fs');var path=require(_0x221d('0x2'));var rimraf=require(_0x221d('0x3'));var config=require(_0x221d('0x4'));var attributes=require(_0x221d('0x5'));var integrations=require(_0x221d('0x6'));module[_0x221d('0x7')]=function(_0x4a8dc0,_0x598e92){return _0x4a8dc0[_0x221d('0x8')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 74e3393..0c56363 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 _0x3e81=['where','attributes','limit','include','map','model','catch','ShowDeskAccount','DeskAccount','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','findAll','options','raw'];(function(_0x30741c,_0x475730){var _0x5b08d9=function(_0x26d0f3){while(--_0x26d0f3){_0x30741c['push'](_0x30741c['shift']());}};_0x5b08d9(++_0x475730);}(_0x3e81,0x132));var _0x13e8=function(_0x2473bb,_0x5ec86f){_0x2473bb=_0x2473bb-0x0;var _0x16a632=_0x3e81[_0x2473bb];return _0x16a632;};'use strict';var _=require(_0x13e8('0x0'));var util=require('util');var moment=require(_0x13e8('0x1'));var BPromise=require(_0x13e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13e8('0x3'))['db'];var utils=require(_0x13e8('0x4'));var logger=require(_0x13e8('0x5'))(_0x13e8('0x6'));var config=require(_0x13e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13e8('0x8')][_0x13e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bca21,_0x594aed,_0x1860eb){return new BPromise(function(_0xc7555f,_0x380fc0){return client['request'](_0x5bca21,_0x1860eb)[_0x13e8('0xa')](function(_0x28a44c){logger[_0x13e8('0xb')](_0x13e8('0xc'),_0x594aed,_0x13e8('0xd'));logger[_0x13e8('0xe')](_0x13e8('0xf'),_0x594aed,_0x13e8('0xd'),JSON[_0x13e8('0x10')](_0x28a44c));if(_0x28a44c[_0x13e8('0x11')]){if(_0x28a44c[_0x13e8('0x11')]['code']===0x1f4){logger[_0x13e8('0x11')](_0x13e8('0xc'),_0x594aed,_0x28a44c['error']['message']);return _0x380fc0(_0x28a44c[_0x13e8('0x11')]['message']);}logger[_0x13e8('0x11')](_0x13e8('0xc'),_0x594aed,_0x28a44c[_0x13e8('0x11')][_0x13e8('0x12')]);return _0xc7555f(_0x28a44c[_0x13e8('0x11')][_0x13e8('0x12')]);}else{logger[_0x13e8('0xb')]('DeskAccount,\x20%s,\x20%s',_0x594aed,_0x13e8('0xd'));_0xc7555f(_0x28a44c[_0x13e8('0x13')][_0x13e8('0x12')]);}})['catch'](function(_0x5301ae){logger['error']('DeskAccount,\x20%s,\x20%s',_0x594aed,_0x5301ae);_0x380fc0(_0x5301ae);});});}exports[_0x13e8('0x14')]=function(_0x28a0b5){var _0xd8a444=this;return new Promise(function(_0x1c2bfd,_0x1b8552){return db['DeskAccount'][_0x13e8('0x15')]({'raw':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x17')]===undefined?!![]:![]:!![],'where':_0x28a0b5[_0x13e8('0x16')]?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x18')]||null:null,'attributes':_0x28a0b5[_0x13e8('0x16')]?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x19')]||null:null,'limit':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1a')]||null:null,'include':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1b')],function(_0x2d2a8a){return{'model':db[_0x2d2a8a[_0x13e8('0x1d')]],'as':_0x2d2a8a['as'],'attributes':_0x2d2a8a[_0x13e8('0x19')],'include':_0x2d2a8a['include']?_['map'](_0x2d2a8a[_0x13e8('0x1b')],function(_0xdca1a4){return{'model':db[_0xdca1a4[_0x13e8('0x1d')]],'as':_0xdca1a4['as'],'attributes':_0xdca1a4['attributes'],'include':_0xdca1a4[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0xdca1a4[_0x13e8('0x1b')],function(_0x38d1cf){return{'model':db[_0x38d1cf[_0x13e8('0x1d')]],'as':_0x38d1cf['as'],'attributes':_0x38d1cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x13e8('0xa')](function(_0x3b0b27){logger['info'](_0x13e8('0x14'),_0x28a0b5);logger[_0x13e8('0xe')](_0x13e8('0x14'),_0x28a0b5,JSON[_0x13e8('0x10')](_0x3b0b27));_0x1c2bfd(_0x3b0b27);})[_0x13e8('0x1e')](function(_0x32a18e){logger[_0x13e8('0x11')](_0x13e8('0x14'),_0x32a18e['message'],_0x28a0b5);_0x1b8552(_0xd8a444['error'](0x1f4,_0x32a18e[_0x13e8('0x12')]));});});};exports[_0x13e8('0x1f')]=function(_0x4d48c5){var _0xc8717d=this;return new Promise(function(_0x4c74b9,_0x271525){return db[_0x13e8('0x20')]['find']({'raw':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x17')]===undefined?!![]:![]:!![],'where':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x18')]||null:null,'attributes':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x19')]||null:null,'include':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5[_0x13e8('0x16')][_0x13e8('0x1b')]?_['map'](_0x4d48c5[_0x13e8('0x16')][_0x13e8('0x1b')],function(_0x518e90){return{'model':db[_0x518e90[_0x13e8('0x1d')]],'as':_0x518e90['as'],'attributes':_0x518e90[_0x13e8('0x19')],'include':_0x518e90[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0x518e90[_0x13e8('0x1b')],function(_0xd15edc){return{'model':db[_0xd15edc[_0x13e8('0x1d')]],'as':_0xd15edc['as'],'attributes':_0xd15edc[_0x13e8('0x19')],'include':_0xd15edc[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0xd15edc[_0x13e8('0x1b')],function(_0x28757a){return{'model':db[_0x28757a[_0x13e8('0x1d')]],'as':_0x28757a['as'],'attributes':_0x28757a[_0x13e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x13e8('0xa')](function(_0x48f854){logger[_0x13e8('0xb')](_0x13e8('0x1f'),_0x4d48c5);logger[_0x13e8('0xe')](_0x13e8('0x1f'),_0x4d48c5,JSON[_0x13e8('0x10')](_0x48f854));_0x4c74b9(_0x48f854);})['catch'](function(_0x5c115d){logger[_0x13e8('0x11')](_0x13e8('0x1f'),_0x5c115d['message'],_0x4d48c5);_0x271525(_0xc8717d[_0x13e8('0x11')](0x1f4,_0x5c115d[_0x13e8('0x12')]));});});}; \ No newline at end of file +var _0x7d22=['../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','lodash','util','bluebird','ioredis'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x7d22,0xb6));var _0x27d2=function(_0x509caa,_0xf6214f){_0x509caa=_0x509caa-0x0;var _0x231cb1=_0x7d22[_0x509caa];return _0x231cb1;};'use strict';var _=require(_0x27d2('0x0'));var util=require(_0x27d2('0x1'));var moment=require('moment');var BPromise=require(_0x27d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x27d2('0x4'))(_0x27d2('0x5'));var config=require(_0x27d2('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x69cf71,_0x1a220a,_0xcec9de){return new BPromise(function(_0x22d319,_0x3ab34e){return client[_0x27d2('0x7')](_0x69cf71,_0xcec9de)[_0x27d2('0x8')](function(_0x48fb8c){logger[_0x27d2('0x9')](_0x27d2('0xa'),_0x1a220a,_0x27d2('0xb'));logger[_0x27d2('0xc')](_0x27d2('0xd'),_0x1a220a,_0x27d2('0xb'),JSON[_0x27d2('0xe')](_0x48fb8c));if(_0x48fb8c[_0x27d2('0xf')]){if(_0x48fb8c['error'][_0x27d2('0x10')]===0x1f4){logger[_0x27d2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x1a220a,_0x48fb8c['error'][_0x27d2('0x11')]);return _0x3ab34e(_0x48fb8c['error']['message']);}logger[_0x27d2('0xf')](_0x27d2('0xa'),_0x1a220a,_0x48fb8c[_0x27d2('0xf')]['message']);return _0x22d319(_0x48fb8c[_0x27d2('0xf')]['message']);}else{logger[_0x27d2('0x9')](_0x27d2('0xa'),_0x1a220a,'request\x20sent');_0x22d319(_0x48fb8c['result'][_0x27d2('0x11')]);}})[_0x27d2('0x12')](function(_0x4d9ce4){logger['error'](_0x27d2('0xa'),_0x1a220a,_0x4d9ce4);_0x3ab34e(_0x4d9ce4);});});}exports[_0x27d2('0x13')]=function(_0x908f1){var _0xdaafce=this;return new Promise(function(_0x55e687,_0x4dc072){return db[_0x27d2('0x14')][_0x27d2('0x15')]({'raw':_0x908f1[_0x27d2('0x16')]?_0x908f1[_0x27d2('0x16')][_0x27d2('0x17')]===undefined?!![]:![]:!![],'where':_0x908f1['options']?_0x908f1['options'][_0x27d2('0x18')]||null:null,'attributes':_0x908f1[_0x27d2('0x16')]?_0x908f1['options'][_0x27d2('0x19')]||null:null,'limit':_0x908f1['options']?_0x908f1[_0x27d2('0x16')][_0x27d2('0x1a')]||null:null,'include':_0x908f1[_0x27d2('0x16')]?_0x908f1[_0x27d2('0x16')][_0x27d2('0x1b')]?_[_0x27d2('0x1c')](_0x908f1[_0x27d2('0x16')][_0x27d2('0x1b')],function(_0xf8b6b0){return{'model':db[_0xf8b6b0[_0x27d2('0x1d')]],'as':_0xf8b6b0['as'],'attributes':_0xf8b6b0[_0x27d2('0x19')],'include':_0xf8b6b0[_0x27d2('0x1b')]?_['map'](_0xf8b6b0[_0x27d2('0x1b')],function(_0x1a9bf6){return{'model':db[_0x1a9bf6['model']],'as':_0x1a9bf6['as'],'attributes':_0x1a9bf6[_0x27d2('0x19')],'include':_0x1a9bf6['include']?_['map'](_0x1a9bf6['include'],function(_0x2627cc){return{'model':db[_0x2627cc[_0x27d2('0x1d')]],'as':_0x2627cc['as'],'attributes':_0x2627cc[_0x27d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27d2('0x8')](function(_0x1fff9e){logger[_0x27d2('0x9')]('GetDeskAccount',_0x908f1);logger[_0x27d2('0xc')](_0x27d2('0x13'),_0x908f1,JSON[_0x27d2('0xe')](_0x1fff9e));_0x55e687(_0x1fff9e);})['catch'](function(_0x24e2ba){logger[_0x27d2('0xf')]('GetDeskAccount',_0x24e2ba[_0x27d2('0x11')],_0x908f1);_0x4dc072(_0xdaafce['error'](0x1f4,_0x24e2ba['message']));});});};exports[_0x27d2('0x1e')]=function(_0x5aaabc){var _0x42ca96=this;return new Promise(function(_0x37ec82,_0x3b56e7){return db['DeskAccount']['find']({'raw':_0x5aaabc['options']?_0x5aaabc[_0x27d2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5aaabc[_0x27d2('0x16')]?_0x5aaabc[_0x27d2('0x16')][_0x27d2('0x18')]||null:null,'attributes':_0x5aaabc['options']?_0x5aaabc['options'][_0x27d2('0x19')]||null:null,'include':_0x5aaabc['options']?_0x5aaabc[_0x27d2('0x16')][_0x27d2('0x1b')]?_[_0x27d2('0x1c')](_0x5aaabc[_0x27d2('0x16')][_0x27d2('0x1b')],function(_0x21fbc6){return{'model':db[_0x21fbc6['model']],'as':_0x21fbc6['as'],'attributes':_0x21fbc6[_0x27d2('0x19')],'include':_0x21fbc6[_0x27d2('0x1b')]?_[_0x27d2('0x1c')](_0x21fbc6[_0x27d2('0x1b')],function(_0x5b01f3){return{'model':db[_0x5b01f3[_0x27d2('0x1d')]],'as':_0x5b01f3['as'],'attributes':_0x5b01f3[_0x27d2('0x19')],'include':_0x5b01f3[_0x27d2('0x1b')]?_['map'](_0x5b01f3['include'],function(_0x57a90b){return{'model':db[_0x57a90b[_0x27d2('0x1d')]],'as':_0x57a90b['as'],'attributes':_0x57a90b[_0x27d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27d2('0x8')](function(_0x437012){logger['info'](_0x27d2('0x1e'),_0x5aaabc);logger[_0x27d2('0xc')](_0x27d2('0x1e'),_0x5aaabc,JSON[_0x27d2('0xe')](_0x437012));_0x37ec82(_0x437012);})[_0x27d2('0x12')](function(_0x45e405){logger['error'](_0x27d2('0x1e'),_0x45e405[_0x27d2('0x11')],_0x5aaabc);_0x3b56e7(_0x42ca96[_0x27d2('0xf')](0x1f4,_0x45e405[_0x27d2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c34c0f8..d35e9c4 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44295c,_0x3afcb0){var _0x9e992c=function(_0x1f55cb){while(--_0x1f55cb){_0x44295c['push'](_0x44295c['shift']());}};_0x9e992c(++_0x3afcb0);}(_0x34e8,0x12c));var _0x834e=function(_0x348558,_0x554400){_0x348558=_0x348558-0x0;var _0x55a9d1=_0x34e8[_0x348558];return _0x55a9d1;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _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(_0x935388,_0x472019){var _0x5b1752=function(_0x362727){while(--_0x362727){_0x935388['push'](_0x935388['shift']());}};_0x5b1752(++_0x472019);}(_0x008c,0x188));var _0xc008=function(_0x1eeb45,_0x526bf0){_0x1eeb45=_0x1eeb45-0x0;var _0x541ed5=_0x008c[_0x1eeb45];return _0x541ed5;};'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 8ecf705..46de9cc 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 _0xa978=['exports'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xa978,0x14f));var _0x8a97=function(_0x18806c,_0x5143e2){_0x18806c=_0x18806c-0x0;var _0x417b8e=_0xa978[_0x18806c];return _0x417b8e;};'use strict';var Sequelize=require('sequelize');module[_0x8a97('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa2da=['STRING','sequelize'];(function(_0x4d5672,_0x4517e7){var _0x4a7aec=function(_0x29cd05){while(--_0x29cd05){_0x4d5672['push'](_0x4d5672['shift']());}};_0x4a7aec(++_0x4517e7);}(_0xa2da,0x75));var _0xaa2d=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0xa2da[_0x4812e0];return _0x252e0f;};'use strict';var Sequelize=require(_0xaa2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa2d('0x1')]},'description':{'type':Sequelize[_0xaa2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9971b21..1177265 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 _0xcbb3=['sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','error','stack','name','send','index','map','DeskConfiguration','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2a6059,_0x5388ae){var _0x4f1050=function(_0x29b2a8){while(--_0x29b2a8){_0x2a6059['push'](_0x2a6059['shift']());}};_0x4f1050(++_0x5388ae);}(_0xcbb3,0x1ea));var _0x3cbb=function(_0x34689d,_0x4b6403){_0x34689d=_0x34689d-0x0;var _0x3853c7=_0xcbb3[_0x34689d];return _0x3853c7;};'use strict';var emlformat=require(_0x3cbb('0x0'));var rimraf=require(_0x3cbb('0x1'));var zipdir=require(_0x3cbb('0x2'));var jsonpatch=require(_0x3cbb('0x3'));var rp=require(_0x3cbb('0x4'));var moment=require(_0x3cbb('0x5'));var BPromise=require(_0x3cbb('0x6'));var Mustache=require(_0x3cbb('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3cbb('0x8'));var csv=require('to-csv');var ejs=require(_0x3cbb('0x9'));var fs=require('fs');var fs_extra=require(_0x3cbb('0xa'));var _=require('lodash');var squel=require(_0x3cbb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3cbb('0xc'));var toCsv=require(_0x3cbb('0xd'));var querystring=require(_0x3cbb('0xe'));var Papa=require(_0x3cbb('0xf'));var Redis=require(_0x3cbb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3cbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cbb('0x12'));var logger=require(_0x3cbb('0x13'))(_0x3cbb('0x14'));var utils=require(_0x3cbb('0x15'));var config=require(_0x3cbb('0x16'));var licenseUtil=require(_0x3cbb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8cfe,_0x51e1c0){_0x51e1c0=_0x51e1c0||0xcc;return function(_0x4a4e35){if(_0x4a4e35){return _0x2a8cfe[_0x3cbb('0x18')](_0x51e1c0);}return _0x2a8cfe[_0x3cbb('0x19')](_0x51e1c0)[_0x3cbb('0x1a')]();};}function respondWithResult(_0x422e65,_0x2ffdac){_0x2ffdac=_0x2ffdac||0xc8;return function(_0x838e86){if(_0x838e86){return _0x422e65['status'](_0x2ffdac)[_0x3cbb('0x1b')](_0x838e86);}};}function respondWithFilteredResult(_0xbb0b3e,_0x24c379){return function(_0x43c795){if(_0x43c795){var _0x6a2231=typeof _0x24c379[_0x3cbb('0x1c')]==='undefined'&&typeof _0x24c379[_0x3cbb('0x1d')]===_0x3cbb('0x1e');var _0x5d8258=_0x43c795['count'];var _0x1f0022=_0x6a2231?0x0:_0x24c379[_0x3cbb('0x1c')];var _0xd6e6a7=_0x6a2231?_0x43c795[_0x3cbb('0x1f')]:_0x24c379[_0x3cbb('0x1c')]+_0x24c379[_0x3cbb('0x1d')];var _0x59beaf;if(_0xd6e6a7>=_0x5d8258){_0xd6e6a7=_0x5d8258;_0x59beaf=0xc8;}else{_0x59beaf=0xce;}_0xbb0b3e[_0x3cbb('0x19')](_0x59beaf);return _0xbb0b3e[_0x3cbb('0x20')]('Content-Range',_0x1f0022+'-'+_0xd6e6a7+'/'+_0x5d8258)[_0x3cbb('0x1b')](_0x43c795);}return null;};}function patchUpdates(_0x892276){return function(_0x3c367b){try{jsonpatch[_0x3cbb('0x21')](_0x3c367b,_0x892276,!![]);}catch(_0x183731){return BPromise[_0x3cbb('0x22')](_0x183731);}return _0x3c367b[_0x3cbb('0x23')]();};}function saveUpdates(_0x3633ef,_0x51d600){return function(_0x3e3855){if(_0x3e3855){return _0x3e3855['update'](_0x3633ef)['then'](function(_0x5046ce){return _0x5046ce;});}return null;};}function removeEntity(_0xd7c905,_0x4e2751){return function(_0x4f431e){if(_0x4f431e){return _0x4f431e[_0x3cbb('0x24')]()['then'](function(){_0xd7c905[_0x3cbb('0x19')](0xcc)[_0x3cbb('0x1a')]();});}};}function handleEntityNotFound(_0x1f9a7c,_0xcfb3a9){return function(_0x57fd2d){if(!_0x57fd2d){_0x1f9a7c['sendStatus'](0x194);}return _0x57fd2d;};}function handleError(_0x5ce034,_0x333f8a){_0x333f8a=_0x333f8a||0x1f4;return function(_0xf94890){logger[_0x3cbb('0x25')](_0xf94890[_0x3cbb('0x26')]);if(_0xf94890[_0x3cbb('0x27')]){delete _0xf94890[_0x3cbb('0x27')];}_0x5ce034[_0x3cbb('0x19')](_0x333f8a)[_0x3cbb('0x28')](_0xf94890);};}exports[_0x3cbb('0x29')]=function(_0x2b956b,_0x30d4f2){var _0x181fd3={},_0x2057ae={},_0x46c09={'count':0x0,'rows':[]};var _0x233e46=_[_0x3cbb('0x2a')](db[_0x3cbb('0x2b')]['rawAttributes'],function(_0x500df9){return{'name':_0x500df9['fieldName'],'type':_0x500df9['type'][_0x3cbb('0x2c')]};});_0x2057ae['model']=_[_0x3cbb('0x2a')](_0x233e46,_0x3cbb('0x27'));_0x2057ae['query']=_[_0x3cbb('0x2d')](_0x2b956b[_0x3cbb('0x2e')]);_0x2057ae[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x2057ae[_0x3cbb('0x31')],_0x2057ae[_0x3cbb('0x2e')]);_0x181fd3[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x2057ae['model'],qs[_0x3cbb('0x33')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x33')]));_0x181fd3[_0x3cbb('0x32')]=_0x181fd3[_0x3cbb('0x32')][_0x3cbb('0x34')]?_0x181fd3[_0x3cbb('0x32')]:_0x2057ae[_0x3cbb('0x31')];if(!_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x35')](_0x3cbb('0x36'))){_0x181fd3[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x1d')]);_0x181fd3[_0x3cbb('0x1c')]=qs['offset'](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}_0x181fd3['order']=qs[_0x3cbb('0x37')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x37')]);_0x181fd3['where']=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0x2b956b[_0x3cbb('0x2e')],_0x2057ae[_0x3cbb('0x2f')]),_0x233e46);if(_0x2b956b['query'][_0x3cbb('0x39')]){_0x181fd3[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x181fd3[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x233e46,function(_0x2fabd0){if(_0x2fabd0['type']!==_0x3cbb('0x3c')){var _0x1fa6cb={};_0x1fa6cb[_0x2fabd0[_0x3cbb('0x27')]]={'$like':'%'+_0x2b956b['query'][_0x3cbb('0x39')]+'%'};return _0x1fa6cb;}})});}_0x181fd3=_[_0x3cbb('0x3b')]({},_0x181fd3,_0x2b956b['options']);var _0x3fdc85={'where':_0x181fd3[_0x3cbb('0x3a')]};return db[_0x3cbb('0x2b')]['count'](_0x3fdc85)[_0x3cbb('0x3d')](function(_0x4eb627){_0x46c09[_0x3cbb('0x1f')]=_0x4eb627;if(_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x3e')]){_0x181fd3['include']=[{'all':!![]}];}return db[_0x3cbb('0x2b')][_0x3cbb('0x3f')](_0x181fd3);})[_0x3cbb('0x3d')](function(_0x2b244e){_0x46c09[_0x3cbb('0x40')]=_0x2b244e;return _0x46c09;})[_0x3cbb('0x3d')](respondWithFilteredResult(_0x30d4f2,_0x181fd3))['catch'](handleError(_0x30d4f2,null));};exports[_0x3cbb('0x41')]=function(_0x14ebcb,_0x56bf67){var _0x29dcec={'raw':![],'where':{'id':_0x14ebcb[_0x3cbb('0x42')]['id']}},_0x2ad7ca={};_0x2ad7ca['model']=_[_0x3cbb('0x2d')](db[_0x3cbb('0x2b')][_0x3cbb('0x43')]);_0x2ad7ca[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x14ebcb[_0x3cbb('0x2e')]);_0x2ad7ca[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x2ad7ca[_0x3cbb('0x31')],_0x2ad7ca[_0x3cbb('0x2e')]);_0x29dcec[_0x3cbb('0x32')]=_['intersection'](_0x2ad7ca[_0x3cbb('0x31')],qs['fields'](_0x14ebcb[_0x3cbb('0x2e')][_0x3cbb('0x33')]));_0x29dcec[_0x3cbb('0x32')]=_0x29dcec[_0x3cbb('0x32')]['length']?_0x29dcec[_0x3cbb('0x32')]:_0x2ad7ca[_0x3cbb('0x31')];if(_0x14ebcb[_0x3cbb('0x2e')]['includeAll']){_0x29dcec['include']=[{'all':!![]}];}_0x29dcec=_[_0x3cbb('0x3b')]({},_0x29dcec,_0x14ebcb[_0x3cbb('0x44')]);return db[_0x3cbb('0x2b')][_0x3cbb('0x45')](_0x29dcec)[_0x3cbb('0x3d')](handleEntityNotFound(_0x56bf67,null))['then'](respondWithResult(_0x56bf67,null))[_0x3cbb('0x46')](handleError(_0x56bf67,null));};exports[_0x3cbb('0x47')]=function(_0x4bace6,_0x12c94f){return db[_0x3cbb('0x2b')][_0x3cbb('0x47')](_0x4bace6[_0x3cbb('0x48')],{})[_0x3cbb('0x3d')](respondWithResult(_0x12c94f,0xc9))['catch'](handleError(_0x12c94f,null));};exports['update']=function(_0x434f55,_0x3c0cc1){if(_0x434f55[_0x3cbb('0x48')]['id']){delete _0x434f55['body']['id'];}return db[_0x3cbb('0x2b')][_0x3cbb('0x45')]({'where':{'id':_0x434f55[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x3c0cc1,null))[_0x3cbb('0x3d')](saveUpdates(_0x434f55[_0x3cbb('0x48')],null))[_0x3cbb('0x3d')](respondWithResult(_0x3c0cc1,null))[_0x3cbb('0x46')](handleError(_0x3c0cc1,null));};exports[_0x3cbb('0x24')]=function(_0x541402,_0x6ada0c){return db[_0x3cbb('0x2b')][_0x3cbb('0x45')]({'where':{'id':_0x541402[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x6ada0c,null))[_0x3cbb('0x3d')](removeEntity(_0x6ada0c,null))['catch'](handleError(_0x6ada0c,null));};exports['getFields']=function(_0x44ab56,_0x35604f,_0x44b08d){var _0xe3f8bb={};var _0x4e4b60={};var _0x4354c8;var _0x568d44;return db['DeskConfiguration'][_0x3cbb('0x49')]({'where':{'id':_0x44ab56[_0x3cbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x35604f,null))[_0x3cbb('0x3d')](function(_0x310430){if(_0x310430){_0x4354c8=_0x310430;_0x4e4b60[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x4a')][_0x3cbb('0x43')]);_0x4e4b60[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x44ab56[_0x3cbb('0x2e')]);_0x4e4b60[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x4e4b60[_0x3cbb('0x31')],_0x4e4b60[_0x3cbb('0x2e')]);_0xe3f8bb[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x4e4b60['model'],qs[_0x3cbb('0x33')](_0x44ab56['query'][_0x3cbb('0x33')]));_0xe3f8bb[_0x3cbb('0x32')]=_0xe3f8bb['attributes'][_0x3cbb('0x34')]?_0xe3f8bb[_0x3cbb('0x32')]:_0x4e4b60[_0x3cbb('0x31')];_0xe3f8bb[_0x3cbb('0x4b')]=qs['sort'](_0x44ab56[_0x3cbb('0x2e')]['sort']);_0xe3f8bb[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0x44ab56[_0x3cbb('0x2e')],_0x4e4b60[_0x3cbb('0x2f')]));if(_0x44ab56['query'][_0x3cbb('0x39')]){_0xe3f8bb[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0xe3f8bb[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0xe3f8bb[_0x3cbb('0x32')],function(_0x4e56c9){var _0x315414={};_0x315414[_0x4e56c9]={'$like':'%'+_0x44ab56['query'][_0x3cbb('0x39')]+'%'};return _0x315414;})});}_0xe3f8bb=_['merge']({},_0xe3f8bb,_0x44ab56[_0x3cbb('0x44')]);return _0x4354c8[_0x3cbb('0x4c')](_0xe3f8bb);}})[_0x3cbb('0x3d')](function(_0x2ff34e){if(_0x2ff34e){_0x568d44=_0x2ff34e[_0x3cbb('0x34')];if(!_0x44ab56['query'][_0x3cbb('0x35')]('nolimit')){_0xe3f8bb[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x44ab56[_0x3cbb('0x2e')]['limit']);_0xe3f8bb[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x44ab56['query'][_0x3cbb('0x1c')]);}return _0x4354c8[_0x3cbb('0x4c')](_0xe3f8bb);}})['then'](function(_0x7d7979){if(_0x7d7979){return _0x7d7979?{'count':_0x568d44,'rows':_0x7d7979}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x35604f,null))[_0x3cbb('0x46')](handleError(_0x35604f,null));};exports[_0x3cbb('0x4d')]=function(_0xceffe5,_0x2949fe,_0x405673){var _0x32e864={};var _0x21fc62={};var _0x1fe287;var _0x22448f;return db['DeskConfiguration']['findOne']({'where':{'id':_0xceffe5[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x2949fe,null))['then'](function(_0x3bfd32){if(_0x3bfd32){_0x1fe287=_0x3bfd32;_0x21fc62[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db['DeskField'][_0x3cbb('0x43')]);_0x21fc62['query']=_[_0x3cbb('0x2d')](_0xceffe5['query']);_0x21fc62[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x21fc62[_0x3cbb('0x31')],_0x21fc62[_0x3cbb('0x2e')]);_0x32e864[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x21fc62[_0x3cbb('0x31')],qs['fields'](_0xceffe5['query'][_0x3cbb('0x33')]));_0x32e864[_0x3cbb('0x32')]=_0x32e864[_0x3cbb('0x32')]['length']?_0x32e864['attributes']:_0x21fc62[_0x3cbb('0x31')];_0x32e864[_0x3cbb('0x4b')]=qs[_0x3cbb('0x37')](_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x37')]);_0x32e864[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0xceffe5[_0x3cbb('0x2e')],_0x21fc62[_0x3cbb('0x2f')]));if(_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x39')]){_0x32e864[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x32e864[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x32e864[_0x3cbb('0x32')],function(_0x33d433){var _0x5629d6={};_0x5629d6[_0x33d433]={'$like':'%'+_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x39')]+'%'};return _0x5629d6;})});}_0x32e864=_[_0x3cbb('0x3b')]({},_0x32e864,_0xceffe5[_0x3cbb('0x44')]);return _0x1fe287['getSubjects'](_0x32e864);}})[_0x3cbb('0x3d')](function(_0x3e96a8){if(_0x3e96a8){_0x22448f=_0x3e96a8[_0x3cbb('0x34')];if(!_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x35')](_0x3cbb('0x36'))){_0x32e864['limit']=qs[_0x3cbb('0x1d')](_0xceffe5['query'][_0x3cbb('0x1d')]);_0x32e864[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}return _0x1fe287[_0x3cbb('0x4d')](_0x32e864);}})[_0x3cbb('0x3d')](function(_0x58ac4b){if(_0x58ac4b){return _0x58ac4b?{'count':_0x22448f,'rows':_0x58ac4b}:null;}})['then'](respondWithResult(_0x2949fe,null))[_0x3cbb('0x46')](handleError(_0x2949fe,null));};exports[_0x3cbb('0x4e')]=function(_0x194979,_0x49d6b4,_0x17c2d1){var _0x2f3e33={};var _0x5c9153={};var _0x6d9501;var _0x4c2683;return db[_0x3cbb('0x2b')]['findOne']({'where':{'id':_0x194979[_0x3cbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x49d6b4,null))[_0x3cbb('0x3d')](function(_0x19eaac){if(_0x19eaac){_0x6d9501=_0x19eaac;_0x5c9153[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x4a')][_0x3cbb('0x43')]);_0x5c9153[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x194979['query']);_0x5c9153[_0x3cbb('0x2f')]=_['intersection'](_0x5c9153[_0x3cbb('0x31')],_0x5c9153['query']);_0x2f3e33[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x5c9153['model'],qs['fields'](_0x194979['query'][_0x3cbb('0x33')]));_0x2f3e33[_0x3cbb('0x32')]=_0x2f3e33[_0x3cbb('0x32')][_0x3cbb('0x34')]?_0x2f3e33[_0x3cbb('0x32')]:_0x5c9153[_0x3cbb('0x31')];_0x2f3e33['order']=qs['sort'](_0x194979[_0x3cbb('0x2e')]['sort']);_0x2f3e33[_0x3cbb('0x3a')]=qs['filters'](_['pick'](_0x194979[_0x3cbb('0x2e')],_0x5c9153[_0x3cbb('0x2f')]));if(_0x194979[_0x3cbb('0x2e')][_0x3cbb('0x39')]){_0x2f3e33['where']=_[_0x3cbb('0x3b')](_0x2f3e33[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x2f3e33[_0x3cbb('0x32')],function(_0x16c3fb){var _0x42a731={};_0x42a731[_0x16c3fb]={'$like':'%'+_0x194979['query'][_0x3cbb('0x39')]+'%'};return _0x42a731;})});}_0x2f3e33=_[_0x3cbb('0x3b')]({},_0x2f3e33,_0x194979['options']);return _0x6d9501[_0x3cbb('0x4e')](_0x2f3e33);}})[_0x3cbb('0x3d')](function(_0x4b082f){if(_0x4b082f){_0x4c2683=_0x4b082f['length'];if(!_0x194979[_0x3cbb('0x2e')][_0x3cbb('0x35')]('nolimit')){_0x2f3e33[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x194979[_0x3cbb('0x2e')]['limit']);_0x2f3e33[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x194979[_0x3cbb('0x2e')]['offset']);}return _0x6d9501[_0x3cbb('0x4e')](_0x2f3e33);}})['then'](function(_0x2679b5){if(_0x2679b5){return _0x2679b5?{'count':_0x4c2683,'rows':_0x2679b5}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x49d6b4,null))[_0x3cbb('0x46')](handleError(_0x49d6b4,null));};exports[_0x3cbb('0x4f')]=function(_0x7e8552,_0x204ccf,_0x19ee81){var _0x17c98c={};var _0x288522={};var _0x3a655c;var _0xfef92e;return db[_0x3cbb('0x2b')][_0x3cbb('0x49')]({'where':{'id':_0x7e8552['params']['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x204ccf,null))[_0x3cbb('0x3d')](function(_0x1d5b8f){if(_0x1d5b8f){_0x3a655c=_0x1d5b8f;_0x288522[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x50')]['rawAttributes']);_0x288522['query']=_[_0x3cbb('0x2d')](_0x7e8552[_0x3cbb('0x2e')]);_0x288522[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x288522['model'],_0x288522[_0x3cbb('0x2e')]);_0x17c98c['attributes']=_[_0x3cbb('0x30')](_0x288522['model'],qs[_0x3cbb('0x33')](_0x7e8552['query']['fields']));_0x17c98c[_0x3cbb('0x32')]=_0x17c98c[_0x3cbb('0x32')]['length']?_0x17c98c[_0x3cbb('0x32')]:_0x288522[_0x3cbb('0x31')];_0x17c98c['order']=qs['sort'](_0x7e8552['query'][_0x3cbb('0x37')]);_0x17c98c[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_['pick'](_0x7e8552[_0x3cbb('0x2e')],_0x288522[_0x3cbb('0x2f')]));if(_0x7e8552[_0x3cbb('0x2e')]['filter']){_0x17c98c[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x17c98c[_0x3cbb('0x3a')],{'$or':_['map'](_0x17c98c[_0x3cbb('0x32')],function(_0x50be6b){var _0x4244b5={};_0x4244b5[_0x50be6b]={'$like':'%'+_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x39')]+'%'};return _0x4244b5;})});}_0x17c98c=_[_0x3cbb('0x3b')]({},_0x17c98c,_0x7e8552[_0x3cbb('0x44')]);return _0x3a655c['getTags'](_0x17c98c);}})[_0x3cbb('0x3d')](function(_0x1b209f){if(_0x1b209f){_0xfef92e=_0x1b209f[_0x3cbb('0x34')];if(!_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x35')]('nolimit')){_0x17c98c[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x1d')]);_0x17c98c[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}return _0x3a655c[_0x3cbb('0x4f')](_0x17c98c);}})[_0x3cbb('0x3d')](function(_0x3ffbc0){if(_0x3ffbc0){return _0x3ffbc0?{'count':_0xfef92e,'rows':_0x3ffbc0}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x204ccf,null))[_0x3cbb('0x46')](handleError(_0x204ccf,null));};exports[_0x3cbb('0x51')]=function(_0x4dbb7d,_0x50f103,_0x177134){if(_0x4dbb7d[_0x3cbb('0x48')]['id']){delete _0x4dbb7d[_0x3cbb('0x48')]['id'];}return db['DeskConfiguration'][_0x3cbb('0x49')]({'where':{'id':_0x4dbb7d[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x50f103,null))[_0x3cbb('0x3d')](function(_0x29024a){if(_0x29024a){return _0x29024a['setTags'](_0x4dbb7d[_0x3cbb('0x48')][_0x3cbb('0x52')]||[]);}return null;})[_0x3cbb('0x3d')](respondWithResult(_0x50f103,null))[_0x3cbb('0x46')](handleError(_0x50f103,null));}; \ No newline at end of file +var _0xacee=['catch','create','body','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','find'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xacee,0xb1));var _0xeace=function(_0x5ced40,_0x5b5799){_0x5ced40=_0x5ced40-0x0;var _0x315605=_0xacee[_0x5ced40];return _0x315605;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeace('0x0'));var zipdir=require(_0xeace('0x1'));var jsonpatch=require(_0xeace('0x2'));var rp=require(_0xeace('0x3'));var moment=require('moment');var BPromise=require(_0xeace('0x4'));var Mustache=require(_0xeace('0x5'));var util=require(_0xeace('0x6'));var path=require(_0xeace('0x7'));var sox=require(_0xeace('0x8'));var csv=require(_0xeace('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeace('0xa'));var crypto=require(_0xeace('0xb'));var jsforce=require(_0xeace('0xc'));var deskjs=require(_0xeace('0xd'));var toCsv=require(_0xeace('0x9'));var querystring=require(_0xeace('0xe'));var Papa=require(_0xeace('0xf'));var Redis=require(_0xeace('0x10'));var authService=require(_0xeace('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeace('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeace('0x13'))(_0xeace('0x14'));var utils=require(_0xeace('0x15'));var config=require(_0xeace('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b0a3c,_0x555b04){_0x555b04=_0x555b04||0xcc;return function(_0x117fbc){if(_0x117fbc){return _0x1b0a3c[_0xeace('0x17')](_0x555b04);}return _0x1b0a3c[_0xeace('0x18')](_0x555b04)[_0xeace('0x19')]();};}function respondWithResult(_0x308e18,_0x3546af){_0x3546af=_0x3546af||0xc8;return function(_0x977a2){if(_0x977a2){return _0x308e18['status'](_0x3546af)[_0xeace('0x1a')](_0x977a2);}};}function respondWithFilteredResult(_0x1c312d,_0x49fa76){return function(_0x24f6ee){if(_0x24f6ee){var _0x13d514=typeof _0x49fa76['offset']===_0xeace('0x1b')&&typeof _0x49fa76['limit']===_0xeace('0x1b');var _0x2428cd=_0x24f6ee[_0xeace('0x1c')];var _0x10dcef=_0x13d514?0x0:_0x49fa76[_0xeace('0x1d')];var _0x316934=_0x13d514?_0x24f6ee[_0xeace('0x1c')]:_0x49fa76[_0xeace('0x1d')]+_0x49fa76['limit'];var _0xad8cf4;if(_0x316934>=_0x2428cd){_0x316934=_0x2428cd;_0xad8cf4=0xc8;}else{_0xad8cf4=0xce;}_0x1c312d['status'](_0xad8cf4);return _0x1c312d[_0xeace('0x1e')](_0xeace('0x1f'),_0x10dcef+'-'+_0x316934+'/'+_0x2428cd)[_0xeace('0x1a')](_0x24f6ee);}return null;};}function patchUpdates(_0x5b04ca){return function(_0x5e4af9){try{jsonpatch['apply'](_0x5e4af9,_0x5b04ca,!![]);}catch(_0x5e33e9){return BPromise[_0xeace('0x20')](_0x5e33e9);}return _0x5e4af9[_0xeace('0x21')]();};}function saveUpdates(_0x18bf0c,_0x33acc7){return function(_0xf71086){if(_0xf71086){return _0xf71086[_0xeace('0x22')](_0x18bf0c)[_0xeace('0x23')](function(_0x50d179){return _0x50d179;});}return null;};}function removeEntity(_0x5c899f,_0x176fd0){return function(_0x2b26ce){if(_0x2b26ce){return _0x2b26ce['destroy']()['then'](function(){_0x5c899f[_0xeace('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da585,_0x4f83d8){return function(_0xf24faa){if(!_0xf24faa){_0x4da585[_0xeace('0x17')](0x194);}return _0xf24faa;};}function handleError(_0x4406a4,_0x5962ac){_0x5962ac=_0x5962ac||0x1f4;return function(_0x5b8a8f){logger['error'](_0x5b8a8f[_0xeace('0x24')]);if(_0x5b8a8f[_0xeace('0x25')]){delete _0x5b8a8f['name'];}_0x4406a4['status'](_0x5962ac)[_0xeace('0x26')](_0x5b8a8f);};}exports[_0xeace('0x27')]=function(_0x2bad26,_0x1c04fa){var _0x34c203={},_0x6c6dfb={},_0x1d1e12={'count':0x0,'rows':[]};var _0xed5a99=_[_0xeace('0x28')](db['DeskConfiguration'][_0xeace('0x29')],function(_0x2b4d7f){return{'name':_0x2b4d7f[_0xeace('0x2a')],'type':_0x2b4d7f[_0xeace('0x2b')][_0xeace('0x2c')]};});_0x6c6dfb['model']=_[_0xeace('0x28')](_0xed5a99,_0xeace('0x25'));_0x6c6dfb[_0xeace('0x2d')]=_[_0xeace('0x2e')](_0x2bad26[_0xeace('0x2d')]);_0x6c6dfb[_0xeace('0x2f')]=_['intersection'](_0x6c6dfb[_0xeace('0x30')],_0x6c6dfb[_0xeace('0x2d')]);_0x34c203['attributes']=_[_0xeace('0x31')](_0x6c6dfb['model'],qs[_0xeace('0x32')](_0x2bad26[_0xeace('0x2d')]['fields']));_0x34c203['attributes']=_0x34c203[_0xeace('0x33')][_0xeace('0x34')]?_0x34c203[_0xeace('0x33')]:_0x6c6dfb['model'];if(!_0x2bad26[_0xeace('0x2d')][_0xeace('0x35')](_0xeace('0x36'))){_0x34c203['limit']=qs[_0xeace('0x37')](_0x2bad26[_0xeace('0x2d')]['limit']);_0x34c203[_0xeace('0x1d')]=qs[_0xeace('0x1d')](_0x2bad26[_0xeace('0x2d')]['offset']);}_0x34c203[_0xeace('0x38')]=qs['sort'](_0x2bad26[_0xeace('0x2d')][_0xeace('0x39')]);_0x34c203[_0xeace('0x3a')]=qs['filters'](_[_0xeace('0x3b')](_0x2bad26[_0xeace('0x2d')],_0x6c6dfb[_0xeace('0x2f')]),_0xed5a99);if(_0x2bad26[_0xeace('0x2d')][_0xeace('0x3c')]){_0x34c203[_0xeace('0x3a')]=_[_0xeace('0x3d')](_0x34c203['where'],{'$or':_['map'](_0xed5a99,function(_0x3537f6){if(_0x3537f6[_0xeace('0x2b')]!==_0xeace('0x3e')){var _0x10da80={};_0x10da80[_0x3537f6[_0xeace('0x25')]]={'$like':'%'+_0x2bad26['query'][_0xeace('0x3c')]+'%'};return _0x10da80;}})});}_0x34c203=_['merge']({},_0x34c203,_0x2bad26[_0xeace('0x3f')]);var _0x3e81c4={'where':_0x34c203['where']};return db[_0xeace('0x40')][_0xeace('0x1c')](_0x3e81c4)['then'](function(_0x13c094){_0x1d1e12[_0xeace('0x1c')]=_0x13c094;if(_0x2bad26['query'][_0xeace('0x41')]){_0x34c203[_0xeace('0x42')]=[{'all':!![]}];}return db[_0xeace('0x40')][_0xeace('0x43')](_0x34c203);})[_0xeace('0x23')](function(_0x252411){_0x1d1e12[_0xeace('0x44')]=_0x252411;return _0x1d1e12;})[_0xeace('0x23')](respondWithFilteredResult(_0x1c04fa,_0x34c203))['catch'](handleError(_0x1c04fa,null));};exports[_0xeace('0x45')]=function(_0x5d9d30,_0x42cf5d){var _0x1fc68d={'raw':![],'where':{'id':_0x5d9d30[_0xeace('0x46')]['id']}},_0x35a52a={};_0x35a52a[_0xeace('0x30')]=_['keys'](db[_0xeace('0x40')][_0xeace('0x29')]);_0x35a52a[_0xeace('0x2d')]=_[_0xeace('0x2e')](_0x5d9d30[_0xeace('0x2d')]);_0x35a52a[_0xeace('0x2f')]=_[_0xeace('0x31')](_0x35a52a['model'],_0x35a52a['query']);_0x1fc68d['attributes']=_[_0xeace('0x31')](_0x35a52a['model'],qs[_0xeace('0x32')](_0x5d9d30[_0xeace('0x2d')][_0xeace('0x32')]));_0x1fc68d[_0xeace('0x33')]=_0x1fc68d[_0xeace('0x33')][_0xeace('0x34')]?_0x1fc68d[_0xeace('0x33')]:_0x35a52a[_0xeace('0x30')];if(_0x5d9d30[_0xeace('0x2d')][_0xeace('0x41')]){_0x1fc68d[_0xeace('0x42')]=[{'all':!![]}];}_0x1fc68d=_[_0xeace('0x3d')]({},_0x1fc68d,_0x5d9d30[_0xeace('0x3f')]);return db[_0xeace('0x40')][_0xeace('0x47')](_0x1fc68d)[_0xeace('0x23')](handleEntityNotFound(_0x42cf5d,null))[_0xeace('0x23')](respondWithResult(_0x42cf5d,null))[_0xeace('0x48')](handleError(_0x42cf5d,null));};exports[_0xeace('0x49')]=function(_0x5e629a,_0x3813d3){return db[_0xeace('0x40')][_0xeace('0x49')](_0x5e629a[_0xeace('0x4a')],{})[_0xeace('0x23')](respondWithResult(_0x3813d3,0xc9))['catch'](handleError(_0x3813d3,null));};exports[_0xeace('0x22')]=function(_0x340e12,_0x5d7825){if(_0x340e12['body']['id']){delete _0x340e12[_0xeace('0x4a')]['id'];}return db[_0xeace('0x40')][_0xeace('0x47')]({'where':{'id':_0x340e12['params']['id']}})[_0xeace('0x23')](handleEntityNotFound(_0x5d7825,null))[_0xeace('0x23')](saveUpdates(_0x340e12[_0xeace('0x4a')],null))['then'](respondWithResult(_0x5d7825,null))[_0xeace('0x48')](handleError(_0x5d7825,null));};exports[_0xeace('0x4b')]=function(_0x562330,_0x2b4fe2){return db['DeskConfiguration'][_0xeace('0x47')]({'where':{'id':_0x562330[_0xeace('0x46')]['id']}})[_0xeace('0x23')](handleEntityNotFound(_0x2b4fe2,null))[_0xeace('0x23')](removeEntity(_0x2b4fe2,null))['catch'](handleError(_0x2b4fe2,null));};exports[_0xeace('0x4c')]=function(_0x1438d0,_0x54d13b,_0x2c7f42){var _0x1475e5={};var _0x1131d9={};var _0x2f104a;var _0xb7f837;return db[_0xeace('0x40')][_0xeace('0x4d')]({'where':{'id':_0x1438d0['params']['id']}})[_0xeace('0x23')](handleEntityNotFound(_0x54d13b,null))[_0xeace('0x23')](function(_0x298e3b){if(_0x298e3b){_0x2f104a=_0x298e3b;_0x1131d9[_0xeace('0x30')]=_['keys'](db[_0xeace('0x4e')][_0xeace('0x29')]);_0x1131d9['query']=_[_0xeace('0x2e')](_0x1438d0['query']);_0x1131d9[_0xeace('0x2f')]=_[_0xeace('0x31')](_0x1131d9[_0xeace('0x30')],_0x1131d9['query']);_0x1475e5[_0xeace('0x33')]=_['intersection'](_0x1131d9[_0xeace('0x30')],qs[_0xeace('0x32')](_0x1438d0[_0xeace('0x2d')][_0xeace('0x32')]));_0x1475e5['attributes']=_0x1475e5['attributes']['length']?_0x1475e5[_0xeace('0x33')]:_0x1131d9[_0xeace('0x30')];_0x1475e5[_0xeace('0x38')]=qs[_0xeace('0x39')](_0x1438d0[_0xeace('0x2d')][_0xeace('0x39')]);_0x1475e5[_0xeace('0x3a')]=qs[_0xeace('0x2f')](_[_0xeace('0x3b')](_0x1438d0[_0xeace('0x2d')],_0x1131d9[_0xeace('0x2f')]));if(_0x1438d0[_0xeace('0x2d')][_0xeace('0x3c')]){_0x1475e5[_0xeace('0x3a')]=_[_0xeace('0x3d')](_0x1475e5[_0xeace('0x3a')],{'$or':_['map'](_0x1475e5[_0xeace('0x33')],function(_0x3e543a){var _0x2c2da5={};_0x2c2da5[_0x3e543a]={'$like':'%'+_0x1438d0[_0xeace('0x2d')][_0xeace('0x3c')]+'%'};return _0x2c2da5;})});}_0x1475e5=_[_0xeace('0x3d')]({},_0x1475e5,_0x1438d0[_0xeace('0x3f')]);return _0x2f104a['getFields'](_0x1475e5);}})[_0xeace('0x23')](function(_0x130e89){if(_0x130e89){_0xb7f837=_0x130e89[_0xeace('0x34')];if(!_0x1438d0[_0xeace('0x2d')][_0xeace('0x35')](_0xeace('0x36'))){_0x1475e5[_0xeace('0x37')]=qs['limit'](_0x1438d0['query']['limit']);_0x1475e5[_0xeace('0x1d')]=qs[_0xeace('0x1d')](_0x1438d0[_0xeace('0x2d')][_0xeace('0x1d')]);}return _0x2f104a['getFields'](_0x1475e5);}})[_0xeace('0x23')](function(_0x301ce4){if(_0x301ce4){return _0x301ce4?{'count':_0xb7f837,'rows':_0x301ce4}:null;}})['then'](respondWithResult(_0x54d13b,null))['catch'](handleError(_0x54d13b,null));};exports['getSubjects']=function(_0xe03cb7,_0x36d88c,_0x2cc32b){var _0x3f49c0={};var _0x1b8113={};var _0x176874;var _0x595e34;return db['DeskConfiguration'][_0xeace('0x4d')]({'where':{'id':_0xe03cb7[_0xeace('0x46')]['id']}})[_0xeace('0x23')](handleEntityNotFound(_0x36d88c,null))[_0xeace('0x23')](function(_0x5bc235){if(_0x5bc235){_0x176874=_0x5bc235;_0x1b8113[_0xeace('0x30')]=_[_0xeace('0x2e')](db['DeskField'][_0xeace('0x29')]);_0x1b8113[_0xeace('0x2d')]=_[_0xeace('0x2e')](_0xe03cb7[_0xeace('0x2d')]);_0x1b8113[_0xeace('0x2f')]=_[_0xeace('0x31')](_0x1b8113[_0xeace('0x30')],_0x1b8113[_0xeace('0x2d')]);_0x3f49c0['attributes']=_[_0xeace('0x31')](_0x1b8113['model'],qs['fields'](_0xe03cb7['query'][_0xeace('0x32')]));_0x3f49c0[_0xeace('0x33')]=_0x3f49c0['attributes'][_0xeace('0x34')]?_0x3f49c0[_0xeace('0x33')]:_0x1b8113['model'];_0x3f49c0[_0xeace('0x38')]=qs[_0xeace('0x39')](_0xe03cb7[_0xeace('0x2d')]['sort']);_0x3f49c0[_0xeace('0x3a')]=qs[_0xeace('0x2f')](_[_0xeace('0x3b')](_0xe03cb7[_0xeace('0x2d')],_0x1b8113['filters']));if(_0xe03cb7[_0xeace('0x2d')][_0xeace('0x3c')]){_0x3f49c0[_0xeace('0x3a')]=_[_0xeace('0x3d')](_0x3f49c0[_0xeace('0x3a')],{'$or':_[_0xeace('0x28')](_0x3f49c0['attributes'],function(_0x57704c){var _0x135a9d={};_0x135a9d[_0x57704c]={'$like':'%'+_0xe03cb7[_0xeace('0x2d')][_0xeace('0x3c')]+'%'};return _0x135a9d;})});}_0x3f49c0=_[_0xeace('0x3d')]({},_0x3f49c0,_0xe03cb7[_0xeace('0x3f')]);return _0x176874[_0xeace('0x4f')](_0x3f49c0);}})['then'](function(_0x291981){if(_0x291981){_0x595e34=_0x291981[_0xeace('0x34')];if(!_0xe03cb7[_0xeace('0x2d')][_0xeace('0x35')]('nolimit')){_0x3f49c0[_0xeace('0x37')]=qs[_0xeace('0x37')](_0xe03cb7[_0xeace('0x2d')][_0xeace('0x37')]);_0x3f49c0[_0xeace('0x1d')]=qs[_0xeace('0x1d')](_0xe03cb7[_0xeace('0x2d')][_0xeace('0x1d')]);}return _0x176874[_0xeace('0x4f')](_0x3f49c0);}})['then'](function(_0x135f75){if(_0x135f75){return _0x135f75?{'count':_0x595e34,'rows':_0x135f75}:null;}})[_0xeace('0x23')](respondWithResult(_0x36d88c,null))['catch'](handleError(_0x36d88c,null));};exports[_0xeace('0x50')]=function(_0x1521ca,_0x26a58b,_0x3ef75e){var _0x475f94={};var _0x3f6de6={};var _0x101ea8;var _0x14daf6;return db[_0xeace('0x40')]['findOne']({'where':{'id':_0x1521ca['params']['id']}})['then'](handleEntityNotFound(_0x26a58b,null))[_0xeace('0x23')](function(_0x23e0ea){if(_0x23e0ea){_0x101ea8=_0x23e0ea;_0x3f6de6['model']=_[_0xeace('0x2e')](db[_0xeace('0x4e')][_0xeace('0x29')]);_0x3f6de6[_0xeace('0x2d')]=_['keys'](_0x1521ca['query']);_0x3f6de6[_0xeace('0x2f')]=_[_0xeace('0x31')](_0x3f6de6['model'],_0x3f6de6[_0xeace('0x2d')]);_0x475f94[_0xeace('0x33')]=_[_0xeace('0x31')](_0x3f6de6[_0xeace('0x30')],qs[_0xeace('0x32')](_0x1521ca['query'][_0xeace('0x32')]));_0x475f94[_0xeace('0x33')]=_0x475f94[_0xeace('0x33')][_0xeace('0x34')]?_0x475f94[_0xeace('0x33')]:_0x3f6de6[_0xeace('0x30')];_0x475f94[_0xeace('0x38')]=qs[_0xeace('0x39')](_0x1521ca[_0xeace('0x2d')][_0xeace('0x39')]);_0x475f94[_0xeace('0x3a')]=qs[_0xeace('0x2f')](_[_0xeace('0x3b')](_0x1521ca[_0xeace('0x2d')],_0x3f6de6[_0xeace('0x2f')]));if(_0x1521ca[_0xeace('0x2d')][_0xeace('0x3c')]){_0x475f94[_0xeace('0x3a')]=_['merge'](_0x475f94[_0xeace('0x3a')],{'$or':_[_0xeace('0x28')](_0x475f94[_0xeace('0x33')],function(_0x46bc41){var _0x27a5b2={};_0x27a5b2[_0x46bc41]={'$like':'%'+_0x1521ca[_0xeace('0x2d')][_0xeace('0x3c')]+'%'};return _0x27a5b2;})});}_0x475f94=_['merge']({},_0x475f94,_0x1521ca[_0xeace('0x3f')]);return _0x101ea8[_0xeace('0x50')](_0x475f94);}})[_0xeace('0x23')](function(_0x1b7301){if(_0x1b7301){_0x14daf6=_0x1b7301[_0xeace('0x34')];if(!_0x1521ca[_0xeace('0x2d')][_0xeace('0x35')]('nolimit')){_0x475f94[_0xeace('0x37')]=qs[_0xeace('0x37')](_0x1521ca[_0xeace('0x2d')]['limit']);_0x475f94[_0xeace('0x1d')]=qs[_0xeace('0x1d')](_0x1521ca[_0xeace('0x2d')][_0xeace('0x1d')]);}return _0x101ea8[_0xeace('0x50')](_0x475f94);}})[_0xeace('0x23')](function(_0x1f02e8){if(_0x1f02e8){return _0x1f02e8?{'count':_0x14daf6,'rows':_0x1f02e8}:null;}})[_0xeace('0x23')](respondWithResult(_0x26a58b,null))['catch'](handleError(_0x26a58b,null));};exports[_0xeace('0x51')]=function(_0x2964e4,_0x16c17c,_0x15b057){var _0x4fba4a={};var _0x369875={};var _0x5011db;var _0x5b54bd;return db[_0xeace('0x40')][_0xeace('0x4d')]({'where':{'id':_0x2964e4[_0xeace('0x46')]['id']}})[_0xeace('0x23')](handleEntityNotFound(_0x16c17c,null))[_0xeace('0x23')](function(_0x315a8c){if(_0x315a8c){_0x5011db=_0x315a8c;_0x369875[_0xeace('0x30')]=_[_0xeace('0x2e')](db['Tag']['rawAttributes']);_0x369875['query']=_[_0xeace('0x2e')](_0x2964e4[_0xeace('0x2d')]);_0x369875['filters']=_[_0xeace('0x31')](_0x369875[_0xeace('0x30')],_0x369875['query']);_0x4fba4a[_0xeace('0x33')]=_[_0xeace('0x31')](_0x369875[_0xeace('0x30')],qs[_0xeace('0x32')](_0x2964e4[_0xeace('0x2d')]['fields']));_0x4fba4a[_0xeace('0x33')]=_0x4fba4a[_0xeace('0x33')][_0xeace('0x34')]?_0x4fba4a['attributes']:_0x369875[_0xeace('0x30')];_0x4fba4a['order']=qs[_0xeace('0x39')](_0x2964e4[_0xeace('0x2d')][_0xeace('0x39')]);_0x4fba4a[_0xeace('0x3a')]=qs[_0xeace('0x2f')](_[_0xeace('0x3b')](_0x2964e4[_0xeace('0x2d')],_0x369875[_0xeace('0x2f')]));if(_0x2964e4[_0xeace('0x2d')][_0xeace('0x3c')]){_0x4fba4a[_0xeace('0x3a')]=_[_0xeace('0x3d')](_0x4fba4a[_0xeace('0x3a')],{'$or':_['map'](_0x4fba4a[_0xeace('0x33')],function(_0x93b76c){var _0x3623a8={};_0x3623a8[_0x93b76c]={'$like':'%'+_0x2964e4[_0xeace('0x2d')][_0xeace('0x3c')]+'%'};return _0x3623a8;})});}_0x4fba4a=_[_0xeace('0x3d')]({},_0x4fba4a,_0x2964e4['options']);return _0x5011db[_0xeace('0x51')](_0x4fba4a);}})['then'](function(_0x7153bd){if(_0x7153bd){_0x5b54bd=_0x7153bd[_0xeace('0x34')];if(!_0x2964e4[_0xeace('0x2d')][_0xeace('0x35')](_0xeace('0x36'))){_0x4fba4a[_0xeace('0x37')]=qs['limit'](_0x2964e4[_0xeace('0x2d')][_0xeace('0x37')]);_0x4fba4a[_0xeace('0x1d')]=qs[_0xeace('0x1d')](_0x2964e4[_0xeace('0x2d')]['offset']);}return _0x5011db[_0xeace('0x51')](_0x4fba4a);}})[_0xeace('0x23')](function(_0x54e9d5){if(_0x54e9d5){return _0x54e9d5?{'count':_0x5b54bd,'rows':_0x54e9d5}:null;}})[_0xeace('0x23')](respondWithResult(_0x16c17c,null))[_0xeace('0x48')](handleError(_0x16c17c,null));};exports[_0xeace('0x52')]=function(_0x271724,_0x2cc45b,_0x3c682c){if(_0x271724[_0xeace('0x4a')]['id']){delete _0x271724['body']['id'];}return db['DeskConfiguration'][_0xeace('0x4d')]({'where':{'id':_0x271724[_0xeace('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cc45b,null))[_0xeace('0x23')](function(_0x1d5690){if(_0x1d5690){return _0x1d5690[_0xeace('0x52')](_0x271724['body']['ids']||[]);}return null;})[_0xeace('0x23')](respondWithResult(_0x2cc45b,null))[_0xeace('0x48')](handleError(_0x2cc45b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b9ffad6..2d83026 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 _0x8262=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports'];(function(_0x3ceeed,_0x418e70){var _0x25f1b7=function(_0x5cd6e3){while(--_0x5cd6e3){_0x3ceeed['push'](_0x3ceeed['shift']());}};_0x25f1b7(++_0x418e70);}(_0x8262,0x9d));var _0x2826=function(_0x297add,_0x41d63){_0x297add=_0x297add-0x0;var _0x2cd8ba=_0x8262[_0x297add];return _0x2cd8ba;};'use strict';var _=require(_0x2826('0x0'));var util=require(_0x2826('0x1'));var logger=require(_0x2826('0x2'))(_0x2826('0x3'));var moment=require(_0x2826('0x4'));var BPromise=require(_0x2826('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2826('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x2826('0x7')]=function(_0x22d692,_0x2ba3ea){return _0x22d692[_0x2826('0x8')](_0x2826('0x9'),attributes,{'tableName':_0x2826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef0=['define','DeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0x1a4c39,_0x13aade){var _0x55b641=function(_0x222d9f){while(--_0x222d9f){_0x1a4c39['push'](_0x1a4c39['shift']());}};_0x55b641(++_0x13aade);}(_0x7ef0,0x122));var _0x07ef=function(_0x5ea73e,_0x95f262){_0x5ea73e=_0x5ea73e-0x0;var _0x9b7f32=_0x7ef0[_0x5ea73e];return _0x9b7f32;};'use strict';var _=require(_0x07ef('0x0'));var util=require(_0x07ef('0x1'));var logger=require(_0x07ef('0x2'))(_0x07ef('0x3'));var moment=require('moment');var BPromise=require(_0x07ef('0x4'));var rp=require(_0x07ef('0x5'));var fs=require('fs');var path=require(_0x07ef('0x6'));var rimraf=require(_0x07ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x07ef('0x8'));module[_0x07ef('0x9')]=function(_0x5081f7,_0x44e2e9){return _0x5081f7[_0x07ef('0xa')](_0x07ef('0xb'),attributes,{'tableName':'int_desk_configurations','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 c23b314..0cb6de2 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x28237e,_0x2a7f11){var _0x1c014b=function(_0xaa0d6d){while(--_0xaa0d6d){_0x28237e['push'](_0x28237e['shift']());}};_0x1c014b(++_0x2a7f11);}(_0x14a0,0x8e));var _0x014a=function(_0x723cce,_0x1740f9){_0x723cce=_0x723cce-0x0;var _0x1b3c1f=_0x14a0[_0x723cce];return _0x1b3c1f;};'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']('DeskConfiguration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('DeskConfiguration,\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')]('DeskConfiguration,\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);});});} \ No newline at end of file +var _0x6a18=['then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x47a768,_0x3357cc){var _0x5d756d=function(_0x3d89b4){while(--_0x3d89b4){_0x47a768['push'](_0x47a768['shift']());}};_0x5d756d(++_0x3357cc);}(_0x6a18,0x114));var _0x86a1=function(_0xb8d4b,_0x34f61c){_0xb8d4b=_0xb8d4b-0x0;var _0xf7f0b2=_0x6a18[_0xb8d4b];return _0xf7f0b2;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var moment=require(_0x86a1('0x2'));var BPromise=require(_0x86a1('0x3'));var rs=require(_0x86a1('0x4'));var fs=require('fs');var Redis=require(_0x86a1('0x5'));var db=require(_0x86a1('0x6'))['db'];var utils=require(_0x86a1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x86a1('0x8'));var jayson=require(_0x86a1('0x9'));var client=jayson[_0x86a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a5210,_0x189a52,_0xa44f84){return new BPromise(function(_0x4e93de,_0x228791){return client[_0x86a1('0xb')](_0x2a5210,_0xa44f84)[_0x86a1('0xc')](function(_0x37f26f){logger[_0x86a1('0xd')](_0x86a1('0xe'),_0x189a52,'request\x20sent');logger[_0x86a1('0xf')](_0x86a1('0x10'),_0x189a52,_0x86a1('0x11'),JSON[_0x86a1('0x12')](_0x37f26f));if(_0x37f26f[_0x86a1('0x13')]){if(_0x37f26f[_0x86a1('0x13')][_0x86a1('0x14')]===0x1f4){logger[_0x86a1('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x189a52,_0x37f26f[_0x86a1('0x13')][_0x86a1('0x15')]);return _0x228791(_0x37f26f[_0x86a1('0x13')]['message']);}logger[_0x86a1('0x13')](_0x86a1('0xe'),_0x189a52,_0x37f26f[_0x86a1('0x13')][_0x86a1('0x15')]);return _0x4e93de(_0x37f26f[_0x86a1('0x13')]['message']);}else{logger[_0x86a1('0xd')](_0x86a1('0xe'),_0x189a52,'request\x20sent');_0x4e93de(_0x37f26f[_0x86a1('0x16')][_0x86a1('0x15')]);}})[_0x86a1('0x17')](function(_0x10a995){logger[_0x86a1('0x13')](_0x86a1('0xe'),_0x189a52,_0x10a995);_0x228791(_0x10a995);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ec736c3..bdbbf71 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 _0xd023=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','multer','path','connect-timeout','Router','fs-extra'];(function(_0x6afbc,_0x5b6f76){var _0x4ac2dd=function(_0xe9f744){while(--_0xe9f744){_0x6afbc['push'](_0x6afbc['shift']());}};_0x4ac2dd(++_0x5b6f76);}(_0xd023,0x94));var _0x3d02=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xd023[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0x3d02('0x0'));var util=require('util');var path=require(_0x3d02('0x1'));var timeout=require(_0x3d02('0x2'));var express=require('express');var router=express[_0x3d02('0x3')]();var fs_extra=require(_0x3d02('0x4'));var auth=require(_0x3d02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d02('0x6'));var controller=require(_0x3d02('0x7'));router[_0x3d02('0x8')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xa')]);router[_0x3d02('0x8')]('/:id',auth[_0x3d02('0x9')](),controller[_0x3d02('0xb')]);router[_0x3d02('0xc')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xd')]);router['put']('/:id',auth[_0x3d02('0x9')](),controller[_0x3d02('0xe')]);router[_0x3d02('0xf')](_0x3d02('0x10'),auth[_0x3d02('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcdc2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x53bfdb,_0x8ecab3){var _0x469b15=function(_0x27f761){while(--_0x27f761){_0x53bfdb['push'](_0x53bfdb['shift']());}};_0x469b15(++_0x8ecab3);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x455c0b,_0x49f8fc){_0x455c0b=_0x455c0b-0x0;var _0x56245d=_0xcdc2[_0x455c0b];return _0x56245d;};'use strict';var multer=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var path=require(_0x2cdc('0x2'));var timeout=require(_0x2cdc('0x3'));var express=require(_0x2cdc('0x4'));var router=express[_0x2cdc('0x5')]();var fs_extra=require(_0x2cdc('0x6'));var auth=require(_0x2cdc('0x7'));var interaction=require(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var controller=require(_0x2cdc('0xa'));router[_0x2cdc('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cdc('0xb')]('/:id',auth[_0x2cdc('0xc')](),controller[_0x2cdc('0xd')]);router[_0x2cdc('0xe')]('/',auth['isAuthenticated'](),controller[_0x2cdc('0xf')]);router['put']('/:id',auth[_0x2cdc('0xc')](),controller['update']);router['delete'](_0x2cdc('0x10'),auth['isAuthenticated'](),controller[_0x2cdc('0x11')]);module[_0x2cdc('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 1ffdf1b..9a72bd8 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 _0x8b57=['variable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0x8b57,0x1ac));var _0x78b5=function(_0x73ceb3,_0x31df42){_0x73ceb3=_0x73ceb3-0x0;var _0x2c7bc6=_0x8b57[_0x73ceb3];return _0x2c7bc6;};'use strict';var Sequelize=require(_0x78b5('0x0'));module[_0x78b5('0x1')]={'type':{'type':Sequelize[_0x78b5('0x2')](_0x78b5('0x3'),_0x78b5('0x4'),'customVariable',_0x78b5('0x5'),_0x78b5('0x6')),'defaultValue':_0x78b5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x78b5('0x2')](_0x78b5('0x3'),_0x78b5('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x78b5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x78b5('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78b5('0x7')]}}; \ No newline at end of file +var _0x0dd4=['customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x18be7e,_0x32fd6c){var _0x44139b=function(_0x219c43){while(--_0x219c43){_0x18be7e['push'](_0x18be7e['shift']());}};_0x44139b(++_0x32fd6c);}(_0x0dd4,0x1dd));var _0x40dd=function(_0x459d87,_0x3b193a){_0x459d87=_0x459d87-0x0;var _0x20d5d1=_0x0dd4[_0x459d87];return _0x20d5d1;};'use strict';var Sequelize=require(_0x40dd('0x0'));module[_0x40dd('0x1')]={'type':{'type':Sequelize[_0x40dd('0x2')]('string','variable',_0x40dd('0x3'),'keyValue',_0x40dd('0x4')),'defaultValue':_0x40dd('0x5')},'content':{'type':Sequelize[_0x40dd('0x6')]},'key':{'type':Sequelize[_0x40dd('0x6')]},'keyType':{'type':Sequelize[_0x40dd('0x2')]('string','variable',_0x40dd('0x3'))},'keyContent':{'type':Sequelize[_0x40dd('0x6')]},'idField':{'type':Sequelize[_0x40dd('0x6')]},'nameField':{'type':Sequelize[_0x40dd('0x6')]},'customField':{'type':Sequelize[_0x40dd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x40dd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 4204e12..9f87741 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 _0x236d=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3dc6ce,_0x412f1b){var _0x26ea6c=function(_0x1311c1){while(--_0x1311c1){_0x3dc6ce['push'](_0x3dc6ce['shift']());}};_0x26ea6c(++_0x412f1b);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['DeskField'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));}; \ No newline at end of file +var _0xcf30=['catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options'];(function(_0x3685ef,_0x4f22cf){var _0x4df8e9=function(_0x345870){while(--_0x345870){_0x3685ef['push'](_0x3685ef['shift']());}};_0x4df8e9(++_0x4f22cf);}(_0xcf30,0x128));var _0x0cf3=function(_0x10883c,_0x1bce5c){_0x10883c=_0x10883c-0x0;var _0x3e7fe3=_0xcf30[_0x10883c];return _0x3e7fe3;};'use strict';var emlformat=require(_0x0cf3('0x0'));var rimraf=require(_0x0cf3('0x1'));var zipdir=require(_0x0cf3('0x2'));var jsonpatch=require(_0x0cf3('0x3'));var rp=require('request-promise');var moment=require(_0x0cf3('0x4'));var BPromise=require(_0x0cf3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0cf3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cf3('0x7'));var squel=require(_0x0cf3('0x8'));var crypto=require(_0x0cf3('0x9'));var jsforce=require(_0x0cf3('0xa'));var deskjs=require(_0x0cf3('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0cf3('0xc'));var Papa=require('papaparse');var Redis=require(_0x0cf3('0xd'));var authService=require(_0x0cf3('0xe'));var qs=require(_0x0cf3('0xf'));var as=require(_0x0cf3('0x10'));var hardwareService=require(_0x0cf3('0x11'));var logger=require(_0x0cf3('0x12'))(_0x0cf3('0x13'));var utils=require(_0x0cf3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0cf3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50df01,_0x5ecbe5){_0x5ecbe5=_0x5ecbe5||0xcc;return function(_0x24d1d4){if(_0x24d1d4){return _0x50df01[_0x0cf3('0x16')](_0x5ecbe5);}return _0x50df01['status'](_0x5ecbe5)['end']();};}function respondWithResult(_0x4d145c,_0x33a7a3){_0x33a7a3=_0x33a7a3||0xc8;return function(_0x20b7b0){if(_0x20b7b0){return _0x4d145c[_0x0cf3('0x17')](_0x33a7a3)[_0x0cf3('0x18')](_0x20b7b0);}};}function respondWithFilteredResult(_0x41d672,_0x4a5b42){return function(_0xdcaf22){if(_0xdcaf22){var _0x86f0d5=typeof _0x4a5b42['offset']===_0x0cf3('0x19')&&typeof _0x4a5b42[_0x0cf3('0x1a')]===_0x0cf3('0x19');var _0x431fde=_0xdcaf22[_0x0cf3('0x1b')];var _0x2ab930=_0x86f0d5?0x0:_0x4a5b42[_0x0cf3('0x1c')];var _0x139325=_0x86f0d5?_0xdcaf22['count']:_0x4a5b42[_0x0cf3('0x1c')]+_0x4a5b42[_0x0cf3('0x1a')];var _0x4e06f6;if(_0x139325>=_0x431fde){_0x139325=_0x431fde;_0x4e06f6=0xc8;}else{_0x4e06f6=0xce;}_0x41d672[_0x0cf3('0x17')](_0x4e06f6);return _0x41d672[_0x0cf3('0x1d')](_0x0cf3('0x1e'),_0x2ab930+'-'+_0x139325+'/'+_0x431fde)[_0x0cf3('0x18')](_0xdcaf22);}return null;};}function patchUpdates(_0x327694){return function(_0x5bb14e){try{jsonpatch[_0x0cf3('0x1f')](_0x5bb14e,_0x327694,!![]);}catch(_0x5cf070){return BPromise[_0x0cf3('0x20')](_0x5cf070);}return _0x5bb14e[_0x0cf3('0x21')]();};}function saveUpdates(_0x306307,_0x5ed4ba){return function(_0x267c28){if(_0x267c28){return _0x267c28[_0x0cf3('0x22')](_0x306307)['then'](function(_0x46d85a){return _0x46d85a;});}return null;};}function removeEntity(_0x5b9024,_0x45ae4f){return function(_0x4a6ed1){if(_0x4a6ed1){return _0x4a6ed1[_0x0cf3('0x23')]()[_0x0cf3('0x24')](function(){_0x5b9024['status'](0xcc)[_0x0cf3('0x25')]();});}};}function handleEntityNotFound(_0x3205c0,_0x57dc10){return function(_0x28c81){if(!_0x28c81){_0x3205c0[_0x0cf3('0x16')](0x194);}return _0x28c81;};}function handleError(_0x5be8c9,_0x5aed05){_0x5aed05=_0x5aed05||0x1f4;return function(_0x2ce8d9){logger[_0x0cf3('0x26')](_0x2ce8d9[_0x0cf3('0x27')]);if(_0x2ce8d9[_0x0cf3('0x28')]){delete _0x2ce8d9['name'];}_0x5be8c9[_0x0cf3('0x17')](_0x5aed05)[_0x0cf3('0x29')](_0x2ce8d9);};}exports['index']=function(_0x1a1e94,_0x19f1cf){var _0x4b78a0={},_0x1c2c1c={},_0x38a3c9={'count':0x0,'rows':[]};var _0x23707d=_[_0x0cf3('0x2a')](db[_0x0cf3('0x2b')][_0x0cf3('0x2c')],function(_0x4bd471){return{'name':_0x4bd471[_0x0cf3('0x2d')],'type':_0x4bd471[_0x0cf3('0x2e')][_0x0cf3('0x2f')]};});_0x1c2c1c[_0x0cf3('0x30')]=_['map'](_0x23707d,_0x0cf3('0x28'));_0x1c2c1c[_0x0cf3('0x31')]=_[_0x0cf3('0x32')](_0x1a1e94[_0x0cf3('0x31')]);_0x1c2c1c[_0x0cf3('0x33')]=_[_0x0cf3('0x34')](_0x1c2c1c[_0x0cf3('0x30')],_0x1c2c1c[_0x0cf3('0x31')]);_0x4b78a0['attributes']=_[_0x0cf3('0x34')](_0x1c2c1c[_0x0cf3('0x30')],qs['fields'](_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x35')]));_0x4b78a0['attributes']=_0x4b78a0[_0x0cf3('0x36')]['length']?_0x4b78a0['attributes']:_0x1c2c1c['model'];if(!_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x37')]('nolimit')){_0x4b78a0['limit']=qs[_0x0cf3('0x1a')](_0x1a1e94['query']['limit']);_0x4b78a0[_0x0cf3('0x1c')]=qs[_0x0cf3('0x1c')](_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x1c')]);}_0x4b78a0[_0x0cf3('0x38')]=qs['sort'](_0x1a1e94['query'][_0x0cf3('0x39')]);_0x4b78a0[_0x0cf3('0x3a')]=qs['filters'](_[_0x0cf3('0x3b')](_0x1a1e94['query'],_0x1c2c1c[_0x0cf3('0x33')]),_0x23707d);if(_0x1a1e94['query'][_0x0cf3('0x3c')]){_0x4b78a0[_0x0cf3('0x3a')]=_['merge'](_0x4b78a0[_0x0cf3('0x3a')],{'$or':_[_0x0cf3('0x2a')](_0x23707d,function(_0x21dd80){if(_0x21dd80[_0x0cf3('0x2e')]!=='VIRTUAL'){var _0x2c3c89={};_0x2c3c89[_0x21dd80[_0x0cf3('0x28')]]={'$like':'%'+_0x1a1e94['query'][_0x0cf3('0x3c')]+'%'};return _0x2c3c89;}})});}_0x4b78a0=_[_0x0cf3('0x3d')]({},_0x4b78a0,_0x1a1e94['options']);var _0x15ee24={'where':_0x4b78a0['where']};return db['DeskField']['count'](_0x15ee24)[_0x0cf3('0x24')](function(_0x4dac1b){_0x38a3c9[_0x0cf3('0x1b')]=_0x4dac1b;if(_0x1a1e94[_0x0cf3('0x31')][_0x0cf3('0x3e')]){_0x4b78a0['include']=[{'all':!![]}];}return db[_0x0cf3('0x2b')][_0x0cf3('0x3f')](_0x4b78a0);})[_0x0cf3('0x24')](function(_0xc6da07){_0x38a3c9[_0x0cf3('0x40')]=_0xc6da07;return _0x38a3c9;})[_0x0cf3('0x24')](respondWithFilteredResult(_0x19f1cf,_0x4b78a0))['catch'](handleError(_0x19f1cf,null));};exports[_0x0cf3('0x41')]=function(_0x434158,_0x2b29eb){var _0x4198ec={'raw':!![],'where':{'id':_0x434158[_0x0cf3('0x42')]['id']}},_0x3a487c={};_0x3a487c[_0x0cf3('0x30')]=_[_0x0cf3('0x32')](db['DeskField'][_0x0cf3('0x2c')]);_0x3a487c['query']=_['keys'](_0x434158['query']);_0x3a487c[_0x0cf3('0x33')]=_[_0x0cf3('0x34')](_0x3a487c[_0x0cf3('0x30')],_0x3a487c[_0x0cf3('0x31')]);_0x4198ec[_0x0cf3('0x36')]=_[_0x0cf3('0x34')](_0x3a487c['model'],qs[_0x0cf3('0x35')](_0x434158[_0x0cf3('0x31')][_0x0cf3('0x35')]));_0x4198ec[_0x0cf3('0x36')]=_0x4198ec[_0x0cf3('0x36')]['length']?_0x4198ec[_0x0cf3('0x36')]:_0x3a487c[_0x0cf3('0x30')];if(_0x434158[_0x0cf3('0x31')]['includeAll']){_0x4198ec[_0x0cf3('0x43')]=[{'all':!![]}];}_0x4198ec=_[_0x0cf3('0x3d')]({},_0x4198ec,_0x434158[_0x0cf3('0x44')]);return db['DeskField']['find'](_0x4198ec)['then'](handleEntityNotFound(_0x2b29eb,null))[_0x0cf3('0x24')](respondWithResult(_0x2b29eb,null))[_0x0cf3('0x45')](handleError(_0x2b29eb,null));};exports[_0x0cf3('0x46')]=function(_0x2c4819,_0xafeb5){return db['DeskField'][_0x0cf3('0x46')](_0x2c4819[_0x0cf3('0x47')],{})[_0x0cf3('0x24')](respondWithResult(_0xafeb5,0xc9))[_0x0cf3('0x45')](handleError(_0xafeb5,null));};exports['update']=function(_0x533f94,_0x1a3ef1){if(_0x533f94[_0x0cf3('0x47')]['id']){delete _0x533f94[_0x0cf3('0x47')]['id'];}return db[_0x0cf3('0x2b')][_0x0cf3('0x48')]({'where':{'id':_0x533f94['params']['id']}})[_0x0cf3('0x24')](handleEntityNotFound(_0x1a3ef1,null))[_0x0cf3('0x24')](saveUpdates(_0x533f94[_0x0cf3('0x47')],null))['then'](respondWithResult(_0x1a3ef1,null))[_0x0cf3('0x45')](handleError(_0x1a3ef1,null));};exports[_0x0cf3('0x23')]=function(_0x270a59,_0x4eb29a){return db[_0x0cf3('0x2b')][_0x0cf3('0x48')]({'where':{'id':_0x270a59[_0x0cf3('0x42')]['id']}})[_0x0cf3('0x24')](handleEntityNotFound(_0x4eb29a,null))['then'](removeEntity(_0x4eb29a,null))[_0x0cf3('0x45')](handleError(_0x4eb29a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4fdeddd..adb86ee 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 _0x84a7=['../../config/logger','api','moment','bluebird','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x273f88,_0x5d4150){var _0x177ca1=function(_0xf46ec4){while(--_0xf46ec4){_0x273f88['push'](_0x273f88['shift']());}};_0x177ca1(++_0x5d4150);}(_0x84a7,0xb6));var _0x784a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x784a('0x0'))(_0x784a('0x1'));var moment=require(_0x784a('0x2'));var BPromise=require(_0x784a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x784a('0x4'));var attributes=require(_0x784a('0x5'));module[_0x784a('0x6')]=function(_0x50ca70,_0x2ec465){return _0x50ca70[_0x784a('0x7')](_0x784a('0x8'),attributes,{'tableName':_0x784a('0x9'),'paranoid':![],'indexes':[{'name':_0x784a('0xa'),'fields':[_0x784a('0xb'),_0x784a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc84a=['FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField'];(function(_0x1f7f53,_0x349898){var _0x80c7d=function(_0x225af0){while(--_0x225af0){_0x1f7f53['push'](_0x1f7f53['shift']());}};_0x80c7d(++_0x349898);}(_0xc84a,0x13c));var _0xac84=function(_0x1f373e,_0x529f26){_0x1f373e=_0x1f373e-0x0;var _0x499e3c=_0xc84a[_0x1f373e];return _0x499e3c;};'use strict';var _=require(_0xac84('0x0'));var util=require(_0xac84('0x1'));var logger=require('../../config/logger')(_0xac84('0x2'));var moment=require(_0xac84('0x3'));var BPromise=require('bluebird');var rp=require(_0xac84('0x4'));var fs=require('fs');var path=require(_0xac84('0x5'));var rimraf=require(_0xac84('0x6'));var config=require(_0xac84('0x7'));var attributes=require(_0xac84('0x8'));module[_0xac84('0x9')]=function(_0x4d1cb1,_0x261e07){return _0x4d1cb1[_0xac84('0xa')](_0xac84('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xac84('0xc'),'fields':[_0xac84('0xd'),_0xac84('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 4b5981a..b21279b 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 _0xb9e0=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a31a3,_0x4ab30e){var _0x5e8a9e=function(_0x5b781f){while(--_0x5b781f){_0x5a31a3['push'](_0x5a31a3['shift']());}};_0x5e8a9e(++_0x4ab30e);}(_0xb9e0,0x13c));var _0x0b9e=function(_0x2c6464,_0x51817d){_0x2c6464=_0x2c6464-0x0;var _0x58e452=_0xb9e0[_0x2c6464];return _0x58e452;};'use strict';var _=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var moment=require('moment');var BPromise=require(_0x0b9e('0x2'));var rs=require(_0x0b9e('0x3'));var fs=require('fs');var Redis=require(_0x0b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b9e('0x5'));var logger=require(_0x0b9e('0x6'))(_0x0b9e('0x7'));var config=require(_0x0b9e('0x8'));var jayson=require(_0x0b9e('0x9'));var client=jayson[_0x0b9e('0xa')][_0x0b9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a80ad,_0x17ff25,_0x46c60b){return new BPromise(function(_0x17f7e2,_0x247e58){return client[_0x0b9e('0xc')](_0x4a80ad,_0x46c60b)[_0x0b9e('0xd')](function(_0x38a3ef){logger[_0x0b9e('0xe')](_0x0b9e('0xf'),_0x17ff25,_0x0b9e('0x10'));logger[_0x0b9e('0x11')](_0x0b9e('0x12'),_0x17ff25,_0x0b9e('0x10'),JSON[_0x0b9e('0x13')](_0x38a3ef));if(_0x38a3ef[_0x0b9e('0x14')]){if(_0x38a3ef['error'][_0x0b9e('0x15')]===0x1f4){logger['error'](_0x0b9e('0xf'),_0x17ff25,_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);return _0x247e58(_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);}logger[_0x0b9e('0x14')](_0x0b9e('0xf'),_0x17ff25,_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);return _0x17f7e2(_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);}else{logger[_0x0b9e('0xe')]('DeskField,\x20%s,\x20%s',_0x17ff25,_0x0b9e('0x10'));_0x17f7e2(_0x38a3ef['result'][_0x0b9e('0x16')]);}})[_0x0b9e('0x17')](function(_0x2e6cc9){logger[_0x0b9e('0x14')](_0x0b9e('0xf'),_0x17ff25,_0x2e6cc9);_0x247e58(_0x2e6cc9);});});} \ No newline at end of file +var _0xe022=['../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c2e87,_0x53bba1){var _0x11932a=function(_0x2bdbb6){while(--_0x2bdbb6){_0x5c2e87['push'](_0x5c2e87['shift']());}};_0x11932a(++_0x53bba1);}(_0xe022,0x70));var _0x2e02=function(_0xbd998a,_0x17fb80){_0xbd998a=_0xbd998a-0x0;var _0x2d2709=_0xe022[_0xbd998a];return _0x2d2709;};'use strict';var _=require(_0x2e02('0x0'));var util=require(_0x2e02('0x1'));var moment=require(_0x2e02('0x2'));var BPromise=require(_0x2e02('0x3'));var rs=require(_0x2e02('0x4'));var fs=require('fs');var Redis=require(_0x2e02('0x5'));var db=require(_0x2e02('0x6'))['db'];var utils=require(_0x2e02('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e02('0x8'));var jayson=require(_0x2e02('0x9'));var client=jayson[_0x2e02('0xa')][_0x2e02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52687b,_0x4b328d,_0x11703e){return new BPromise(function(_0x321371,_0x524199){return client[_0x2e02('0xc')](_0x52687b,_0x11703e)[_0x2e02('0xd')](function(_0xbb30f9){logger[_0x2e02('0xe')](_0x2e02('0xf'),_0x4b328d,_0x2e02('0x10'));logger['debug'](_0x2e02('0x11'),_0x4b328d,_0x2e02('0x10'),JSON[_0x2e02('0x12')](_0xbb30f9));if(_0xbb30f9[_0x2e02('0x13')]){if(_0xbb30f9[_0x2e02('0x13')][_0x2e02('0x14')]===0x1f4){logger[_0x2e02('0x13')]('DeskField,\x20%s,\x20%s',_0x4b328d,_0xbb30f9[_0x2e02('0x13')][_0x2e02('0x15')]);return _0x524199(_0xbb30f9[_0x2e02('0x13')][_0x2e02('0x15')]);}logger['error'](_0x2e02('0xf'),_0x4b328d,_0xbb30f9[_0x2e02('0x13')][_0x2e02('0x15')]);return _0x321371(_0xbb30f9[_0x2e02('0x13')][_0x2e02('0x15')]);}else{logger[_0x2e02('0xe')](_0x2e02('0xf'),_0x4b328d,_0x2e02('0x10'));_0x321371(_0xbb30f9[_0x2e02('0x16')]['message']);}})[_0x2e02('0x17')](function(_0x4da3d9){logger['error'](_0x2e02('0xf'),_0x4b328d,_0x4da3d9);_0x524199(_0x4da3d9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1022c59..0458783 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 _0x219f=['addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x219f,0x1ae));var _0xf219=function(_0x2a74ee,_0x31305d){_0x2a74ee=_0x2a74ee-0x0;var _0x505e0=_0x219f[_0x2a74ee];return _0x505e0;};'use strict';var multer=require(_0xf219('0x0'));var util=require(_0xf219('0x1'));var path=require(_0xf219('0x2'));var timeout=require(_0xf219('0x3'));var express=require(_0xf219('0x4'));var router=express[_0xf219('0x5')]();var fs_extra=require(_0xf219('0x6'));var auth=require(_0xf219('0x7'));var interaction=require(_0xf219('0x8'));var config=require(_0xf219('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xf219('0xa')](),controller[_0xf219('0xb')]);router[_0xf219('0xc')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller['show']);router[_0xf219('0xc')](_0xf219('0xe'),auth['isAuthenticated'](),controller[_0xf219('0xf')]);router[_0xf219('0xc')](_0xf219('0x10'),auth[_0xf219('0xa')](),controller[_0xf219('0x11')]);router[_0xf219('0x12')]('/',auth[_0xf219('0xa')](),controller[_0xf219('0x13')]);router[_0xf219('0x12')](_0xf219('0xe'),auth[_0xf219('0xa')](),controller[_0xf219('0x14')]);router[_0xf219('0x15')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0x16')]);router['delete'](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0x17')]);module[_0xf219('0x18')]=router; \ No newline at end of file +var _0x2ace=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x4dade6,_0x16b01d){var _0x513270=function(_0x1d4a7f){while(--_0x1d4a7f){_0x4dade6['push'](_0x4dade6['shift']());}};_0x513270(++_0x16b01d);}(_0x2ace,0x190));var _0xe2ac=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x2ace[_0x3a2e49];return _0x257140;};'use strict';var multer=require('multer');var util=require(_0xe2ac('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe2ac('0x1'));var router=express[_0xe2ac('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe2ac('0x3'));var interaction=require(_0xe2ac('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe2ac('0x5')]);router[_0xe2ac('0x6')](_0xe2ac('0x7'),auth[_0xe2ac('0x8')](),controller[_0xe2ac('0x9')]);router[_0xe2ac('0x6')](_0xe2ac('0xa'),auth[_0xe2ac('0x8')](),controller[_0xe2ac('0xb')]);router[_0xe2ac('0x6')](_0xe2ac('0xc'),auth[_0xe2ac('0x8')](),controller['getFields']);router[_0xe2ac('0xd')]('/',auth[_0xe2ac('0x8')](),controller[_0xe2ac('0xe')]);router['post'](_0xe2ac('0xa'),auth[_0xe2ac('0x8')](),controller[_0xe2ac('0xf')]);router[_0xe2ac('0x10')](_0xe2ac('0x7'),auth[_0xe2ac('0x8')](),controller[_0xe2ac('0x11')]);router[_0xe2ac('0x12')]('/:id',auth[_0xe2ac('0x8')](),controller[_0xe2ac('0x13')]);module[_0xe2ac('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 16e8c5a..839929a 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 _0x5c4b=['STRING','sequelize'];(function(_0x1fa226,_0x575465){var _0x3579a6=function(_0xf8a680){while(--_0xf8a680){_0x1fa226['push'](_0x1fa226['shift']());}};_0x3579a6(++_0x575465);}(_0x5c4b,0x6d));var _0xb5c4=function(_0x253961,_0x3e8075){_0x253961=_0x253961-0x0;var _0x367440=_0x5c4b[_0x253961];return _0x367440;};'use strict';var Sequelize=require(_0xb5c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5c4('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb5c4('0x1')]},'remoteUri':{'type':Sequelize[_0xb5c4('0x1')]},'tenantId':{'type':Sequelize[_0xb5c4('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb5c4('0x1')]},'serverUrl':{'type':Sequelize[_0xb5c4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb5c4('0x1')]}}; \ No newline at end of file +var _0x240b=['STRING'];(function(_0x539724,_0x555dd1){var _0x51b522=function(_0x2aa9c4){while(--_0x2aa9c4){_0x539724['push'](_0x539724['shift']());}};_0x51b522(++_0x555dd1);}(_0x240b,0x19e));var _0xb240=function(_0x23f6ba,_0x42f22e){_0x23f6ba=_0x23f6ba-0x0;var _0x1d1df4=_0x240b[_0x23f6ba];return _0x1d1df4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb240('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb240('0x0')]},'remoteUri':{'type':Sequelize[_0xb240('0x0')]},'tenantId':{'type':Sequelize[_0xb240('0x0')]},'clientId':{'type':Sequelize[_0xb240('0x0')]},'clientSecret':{'type':Sequelize[_0xb240('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 681ddf6..b103253 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 _0x495e=['%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','limit','undefined','offset','count','set','Content-Range','apply','save','update','destroy','error','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','where','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','then','rows','catch','show','params','find','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','order','sort','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','create','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','substring','format'];(function(_0x145331,_0x46af5d){var _0x1dd3c0=function(_0x1034c5){while(--_0x1034c5){_0x145331['push'](_0x145331['shift']());}};_0x1dd3c0(++_0x46af5d);}(_0x495e,0xfb));var _0xe495=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x495e[_0x32b122];return _0x4ad25a;};'use strict';var emlformat=require(_0xe495('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe495('0x1'));var rp=require(_0xe495('0x2'));var moment=require(_0xe495('0x3'));var BPromise=require(_0xe495('0x4'));var Mustache=require('mustache');var util=require(_0xe495('0x5'));var path=require(_0xe495('0x6'));var sox=require(_0xe495('0x7'));var csv=require(_0xe495('0x8'));var ejs=require(_0xe495('0x9'));var fs=require('fs');var fs_extra=require(_0xe495('0xa'));var _=require(_0xe495('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe495('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe495('0xd'));var Papa=require(_0xe495('0xe'));var Redis=require(_0xe495('0xf'));var authService=require(_0xe495('0x10'));var qs=require(_0xe495('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe495('0x12'));var logger=require(_0xe495('0x13'))(_0xe495('0x14'));var utils=require('../../config/utils');var config=require(_0xe495('0x15'));var licenseUtil=require(_0xe495('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d73a5,_0x13aedb){_0x13aedb=_0x13aedb||0xcc;return function(_0x5df017){if(_0x5df017){return _0x1d73a5[_0xe495('0x17')](_0x13aedb);}return _0x1d73a5[_0xe495('0x18')](_0x13aedb)[_0xe495('0x19')]();};}function respondWithResult(_0x14744d,_0x2b5e19){_0x2b5e19=_0x2b5e19||0xc8;return function(_0x593205){if(_0x593205){return _0x14744d[_0xe495('0x18')](_0x2b5e19)[_0xe495('0x1a')](_0x593205);}};}function respondWithFilteredResult(_0x19d096,_0x1c2d78){return function(_0x1ea256){if(_0x1ea256){var _0x48864f=typeof _0x1c2d78['offset']==='undefined'&&typeof _0x1c2d78[_0xe495('0x1b')]===_0xe495('0x1c');var _0x2aa692=_0x1ea256['count'];var _0x1e602c=_0x48864f?0x0:_0x1c2d78[_0xe495('0x1d')];var _0x3ba8cc=_0x48864f?_0x1ea256[_0xe495('0x1e')]:_0x1c2d78[_0xe495('0x1d')]+_0x1c2d78['limit'];var _0x4dfcb7;if(_0x3ba8cc>=_0x2aa692){_0x3ba8cc=_0x2aa692;_0x4dfcb7=0xc8;}else{_0x4dfcb7=0xce;}_0x19d096[_0xe495('0x18')](_0x4dfcb7);return _0x19d096[_0xe495('0x1f')](_0xe495('0x20'),_0x1e602c+'-'+_0x3ba8cc+'/'+_0x2aa692)[_0xe495('0x1a')](_0x1ea256);}return null;};}function patchUpdates(_0x5d5d35){return function(_0x3d4d3c){try{jsonpatch[_0xe495('0x21')](_0x3d4d3c,_0x5d5d35,!![]);}catch(_0x463ba9){return BPromise['reject'](_0x463ba9);}return _0x3d4d3c[_0xe495('0x22')]();};}function saveUpdates(_0x17d13f,_0x475a7e){return function(_0x22cbc3){if(_0x22cbc3){return _0x22cbc3[_0xe495('0x23')](_0x17d13f)['then'](function(_0x33f19){return _0x33f19;});}return null;};}function removeEntity(_0x4d836b,_0x181ead){return function(_0x39cff4){if(_0x39cff4){return _0x39cff4[_0xe495('0x24')]()['then'](function(){_0x4d836b[_0xe495('0x18')](0xcc)[_0xe495('0x19')]();});}};}function handleEntityNotFound(_0x740be5,_0x1db488){return function(_0x21513b){if(!_0x21513b){_0x740be5[_0xe495('0x17')](0x194);}return _0x21513b;};}function handleError(_0x1ffd8b,_0x48b2eb){_0x48b2eb=_0x48b2eb||0x1f4;return function(_0x5a2c68){logger[_0xe495('0x25')](_0x5a2c68['stack']);if(_0x5a2c68[_0xe495('0x26')]){delete _0x5a2c68[_0xe495('0x26')];}_0x1ffd8b['status'](_0x48b2eb)['send'](_0x5a2c68);};}exports[_0xe495('0x27')]=function(_0x620f00,_0xb2c47){var _0x8623c1={},_0x18c427={},_0x258d9c={'count':0x0,'rows':[]};var _0x181d26=_[_0xe495('0x28')](db['Dynamics365Account']['rawAttributes'],function(_0x37b75){return{'name':_0x37b75[_0xe495('0x29')],'type':_0x37b75[_0xe495('0x2a')][_0xe495('0x2b')]};});_0x18c427['model']=_[_0xe495('0x28')](_0x181d26,_0xe495('0x26'));_0x18c427[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x620f00[_0xe495('0x2c')]);_0x18c427[_0xe495('0x2e')]=_[_0xe495('0x2f')](_0x18c427[_0xe495('0x30')],_0x18c427[_0xe495('0x2c')]);_0x8623c1[_0xe495('0x31')]=_[_0xe495('0x2f')](_0x18c427[_0xe495('0x30')],qs[_0xe495('0x32')](_0x620f00[_0xe495('0x2c')][_0xe495('0x32')]));_0x8623c1['attributes']=_0x8623c1[_0xe495('0x31')][_0xe495('0x33')]?_0x8623c1['attributes']:_0x18c427[_0xe495('0x30')];if(!_0x620f00[_0xe495('0x2c')]['hasOwnProperty']('nolimit')){_0x8623c1[_0xe495('0x1b')]=qs[_0xe495('0x1b')](_0x620f00[_0xe495('0x2c')][_0xe495('0x1b')]);_0x8623c1['offset']=qs[_0xe495('0x1d')](_0x620f00[_0xe495('0x2c')][_0xe495('0x1d')]);}_0x8623c1['order']=qs['sort'](_0x620f00[_0xe495('0x2c')]['sort']);_0x8623c1[_0xe495('0x34')]=qs[_0xe495('0x2e')](_['pick'](_0x620f00['query'],_0x18c427[_0xe495('0x2e')]),_0x181d26);if(_0x620f00[_0xe495('0x2c')][_0xe495('0x35')]){_0x8623c1[_0xe495('0x34')]=_[_0xe495('0x36')](_0x8623c1[_0xe495('0x34')],{'$or':_[_0xe495('0x28')](_0x181d26,function(_0x43f94f){if(_0x43f94f[_0xe495('0x2a')]!==_0xe495('0x37')){var _0x4f566b={};_0x4f566b[_0x43f94f[_0xe495('0x26')]]={'$like':'%'+_0x620f00['query'][_0xe495('0x35')]+'%'};return _0x4f566b;}})});}_0x8623c1=_[_0xe495('0x36')]({},_0x8623c1,_0x620f00[_0xe495('0x38')]);var _0x6cb073={'where':_0x8623c1['where']};return db[_0xe495('0x39')][_0xe495('0x1e')](_0x6cb073)['then'](function(_0x49e4b4){_0x258d9c['count']=_0x49e4b4;if(_0x620f00[_0xe495('0x2c')][_0xe495('0x3a')]){_0x8623c1[_0xe495('0x3b')]=[{'all':!![]}];}return db[_0xe495('0x39')][_0xe495('0x3c')](_0x8623c1);})[_0xe495('0x3d')](function(_0x4df7d3){_0x258d9c[_0xe495('0x3e')]=_0x4df7d3;return _0x258d9c;})[_0xe495('0x3d')](respondWithFilteredResult(_0xb2c47,_0x8623c1))[_0xe495('0x3f')](handleError(_0xb2c47,null));};exports[_0xe495('0x40')]=function(_0x33d831,_0x2ff501){var _0x39ddda={'raw':![],'where':{'id':_0x33d831[_0xe495('0x41')]['id']}},_0x778cea={};_0x778cea['model']=_['keys'](db[_0xe495('0x39')]['rawAttributes']);_0x778cea[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x33d831['query']);_0x778cea[_0xe495('0x2e')]=_['intersection'](_0x778cea['model'],_0x778cea[_0xe495('0x2c')]);_0x39ddda['attributes']=_[_0xe495('0x2f')](_0x778cea['model'],qs[_0xe495('0x32')](_0x33d831[_0xe495('0x2c')][_0xe495('0x32')]));_0x39ddda[_0xe495('0x31')]=_0x39ddda[_0xe495('0x31')][_0xe495('0x33')]?_0x39ddda[_0xe495('0x31')]:_0x778cea[_0xe495('0x30')];if(_0x33d831[_0xe495('0x2c')][_0xe495('0x3a')]){_0x39ddda['include']=[{'all':!![]}];}_0x39ddda=_[_0xe495('0x36')]({},_0x39ddda,_0x33d831['options']);return db[_0xe495('0x39')][_0xe495('0x42')](_0x39ddda)[_0xe495('0x3d')](handleEntityNotFound(_0x2ff501,null))[_0xe495('0x3d')](respondWithResult(_0x2ff501,null))['catch'](handleError(_0x2ff501,null));};exports['create']=function(_0x54a346,_0x3b3fb1){return db[_0xe495('0x39')]['create'](_0x54a346[_0xe495('0x43')],{})[_0xe495('0x3d')](respondWithResult(_0x3b3fb1,0xc9))[_0xe495('0x3f')](handleError(_0x3b3fb1,null));};exports[_0xe495('0x23')]=function(_0x13fa96,_0x11f801){if(_0x13fa96[_0xe495('0x43')]['id']){delete _0x13fa96['body']['id'];}return db[_0xe495('0x39')][_0xe495('0x42')]({'where':{'id':_0x13fa96[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x11f801,null))[_0xe495('0x3d')](saveUpdates(_0x13fa96['body'],null))['then'](respondWithResult(_0x11f801,null))[_0xe495('0x3f')](handleError(_0x11f801,null));};exports[_0xe495('0x24')]=function(_0x1b81fd,_0x53cd3f){return db['Dynamics365Account'][_0xe495('0x42')]({'where':{'id':_0x1b81fd['params']['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x53cd3f,null))[_0xe495('0x3d')](removeEntity(_0x53cd3f,null))['catch'](handleError(_0x53cd3f,null));};exports[_0xe495('0x44')]=function(_0x3e03a2,_0xb3f987,_0x45813c){var _0x2161e2={};var _0xb8959a={};var _0x9b12f9;var _0x2dd789;return db[_0xe495('0x39')][_0xe495('0x45')]({'where':{'id':_0x3e03a2[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0xb3f987,null))['then'](function(_0x444bb1){if(_0x444bb1){_0x9b12f9=_0x444bb1;_0xb8959a[_0xe495('0x30')]=_[_0xe495('0x2d')](db[_0xe495('0x46')][_0xe495('0x47')]);_0xb8959a[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x3e03a2[_0xe495('0x2c')]);_0xb8959a[_0xe495('0x2e')]=_[_0xe495('0x2f')](_0xb8959a['model'],_0xb8959a['query']);_0x2161e2[_0xe495('0x31')]=_[_0xe495('0x2f')](_0xb8959a['model'],qs[_0xe495('0x32')](_0x3e03a2[_0xe495('0x2c')][_0xe495('0x32')]));_0x2161e2[_0xe495('0x31')]=_0x2161e2['attributes'][_0xe495('0x33')]?_0x2161e2[_0xe495('0x31')]:_0xb8959a[_0xe495('0x30')];_0x2161e2[_0xe495('0x48')]=qs[_0xe495('0x49')](_0x3e03a2[_0xe495('0x2c')]['sort']);_0x2161e2[_0xe495('0x34')]=qs['filters'](_[_0xe495('0x4a')](_0x3e03a2['query'],_0xb8959a[_0xe495('0x2e')]));if(_0x3e03a2['query'][_0xe495('0x35')]){_0x2161e2['where']=_[_0xe495('0x36')](_0x2161e2[_0xe495('0x34')],{'$or':_['map'](_0x2161e2[_0xe495('0x31')],function(_0x1ccb69){var _0x1371e9={};_0x1371e9[_0x1ccb69]={'$like':'%'+_0x3e03a2[_0xe495('0x2c')][_0xe495('0x35')]+'%'};return _0x1371e9;})});}_0x2161e2=_[_0xe495('0x36')]({},_0x2161e2,_0x3e03a2[_0xe495('0x38')]);return _0x9b12f9[_0xe495('0x44')](_0x2161e2);}})[_0xe495('0x3d')](function(_0x11906c){if(_0x11906c){_0x2dd789=_0x11906c[_0xe495('0x33')];if(!_0x3e03a2[_0xe495('0x2c')][_0xe495('0x4b')](_0xe495('0x4c'))){_0x2161e2[_0xe495('0x1b')]=qs[_0xe495('0x1b')](_0x3e03a2[_0xe495('0x2c')][_0xe495('0x1b')]);_0x2161e2[_0xe495('0x1d')]=qs[_0xe495('0x1d')](_0x3e03a2[_0xe495('0x2c')]['offset']);}return _0x9b12f9[_0xe495('0x44')](_0x2161e2);}})['then'](function(_0x3f0766){if(_0x3f0766){return _0x3f0766?{'count':_0x2dd789,'rows':_0x3f0766}:null;}})[_0xe495('0x3d')](respondWithResult(_0xb3f987,null))['catch'](handleError(_0xb3f987,null));};exports[_0xe495('0x4d')]=function(_0x5ea667,_0x518419,_0x23d962){if(_0x5ea667[_0xe495('0x43')]['id']){delete _0x5ea667['body']['id'];}return db[_0xe495('0x39')][_0xe495('0x45')]({'where':{'id':_0x5ea667[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x518419,null))['then'](function(_0x894486){if(_0x894486){_0x5ea667[_0xe495('0x43')][_0xe495('0x4e')]=_0x894486['id'];_0x5ea667[_0xe495('0x43')][_0xe495('0x4f')]=integrations['getSubjects'](_0x5ea667[_0xe495('0x43')][_0xe495('0x50')],_0x5ea667[_0xe495('0x43')][_0xe495('0x2a')]);_0x5ea667[_0xe495('0x43')]['Descriptions']=integrations['getDescriptions'](_0x5ea667[_0xe495('0x43')][_0xe495('0x50')],_0x5ea667[_0xe495('0x43')]['type']);return db[_0xe495('0x46')][_0xe495('0x51')](_0x5ea667[_0xe495('0x43')],{'include':[{'model':db[_0xe495('0x52')],'as':_0xe495('0x4f')},{'model':db[_0xe495('0x52')],'as':_0xe495('0x53')}]});}return null;})[_0xe495('0x3d')](respondWithResult(_0x518419,null))['catch'](handleError(_0x518419,null));};exports[_0xe495('0x54')]=function(_0xa73873,_0x23dc48,_0x1bf369){var _0x51ef2b=_0xa73873[_0xe495('0x2c')][_0xe495('0x55')];var _0x4beff2=_0x51ef2b==='incident'?_0xe495('0x56'):_0xe495('0x57');var _0x274aa4='';var _0x1aa3b5='';var _0x4059af='';var _0x3d5742='';var _0x4cdd91='';var _0x315ffd='';var _0x567f5b='';var _0xf8b70d='';var _0x1dfe93=[_0xe495('0x58'),_0xe495('0x59'),_0xe495('0x5a'),'ownerid',_0xe495('0x5b'),_0xe495('0x5c'),'phonenumber',_0xe495('0x5d'),_0xe495('0x5e'),'phonecall_activity_parties'];var _0x1c45b6=[_0xe495('0x5f'),_0xe495('0x60'),_0xe495('0x61'),_0xe495('0x62'),_0xe495('0x63'),_0xe495('0x64'),'contractdetailidname',_0xe495('0x65'),_0xe495('0x66'),'createdbyexternalpartyyominame',_0xe495('0x67'),_0xe495('0x68'),_0xe495('0x69'),_0xe495('0x6a'),'createdonbehalfbyyominame','customeridname',_0xe495('0x6b'),_0xe495('0x6c'),_0xe495('0x6d'),'entitlementidname',_0xe495('0x6e'),_0xe495('0x6f'),_0xe495('0x70'),_0xe495('0x71'),_0xe495('0x72'),_0xe495('0x73'),_0xe495('0x74'),_0xe495('0x75'),_0xe495('0x76'),_0xe495('0x77'),'masteridname','modifiedbyexternalpartyname',_0xe495('0x78'),_0xe495('0x79'),'modifiedbyyominame',_0xe495('0x7a'),_0xe495('0x7b'),_0xe495('0x7c'),_0xe495('0x7d'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0xe495('0x7e'),_0xe495('0x7f'),_0xe495('0x80'),_0xe495('0x81'),_0xe495('0x82'),_0xe495('0x83'),_0xe495('0x84'),_0xe495('0x85'),'productidname',_0xe495('0x86'),_0xe495('0x87'),_0xe495('0x88'),_0xe495('0x89'),_0xe495('0x8a'),_0xe495('0x8b'),_0xe495('0x8c'),_0xe495('0x8d'),_0xe495('0x8e'),_0xe495('0x8f'),_0xe495('0x90'),'statuscode',_0xe495('0x91'),_0xe495('0x92'),_0xe495('0x93'),_0xe495('0x94'),_0xe495('0x95'),_0xe495('0x96'),'versionnumber'];var _0xb07e72=_0x1dfe93[_0xe495('0x97')](_0x1c45b6);return db['Dynamics365Account'][_0xe495('0x45')]({'where':{'id':_0xa73873[_0xe495('0x41')]['id']},'attributes':['id',_0xe495('0x98'),_0xe495('0x99'),_0xe495('0x9a'),_0xe495('0x9b'),_0xe495('0x9c'),'clientSecret']})[_0xe495('0x3d')](handleEntityNotFound(_0x23dc48,null))['then'](function(_0x32e092){if(_0x32e092){_0xf8b70d=_0x32e092[_0xe495('0x9a')];var _0x222aec=_0xf8b70d['slice'](-0x1);if(_0x222aec==='/'){_0xf8b70d=_0xf8b70d[_0xe495('0x9d')](0x0,_0xf8b70d['lastIndexOf'](_0x222aec));}_0x567f5b=util[_0xe495('0x9e')](_0xe495('0x9f'),_0xf8b70d);var _0x1e2274={'method':_0xe495('0xa0'),'uri':_0xe495('0xa1')+_0x32e092[_0xe495('0x9b')]+_0xe495('0xa2'),'form':{'client_id':_0x32e092['clientId'],'resource':_0xf8b70d,'username':_0x32e092[_0xe495('0x98')],'password':_0x32e092[_0xe495('0x99')],'grant_type':_0xe495('0x99'),'client_secret':_0x32e092[_0xe495('0xa3')]},'json':!![]};return rp(_0x1e2274);}})[_0xe495('0x3d')](function(_0x56f658){_0x315ffd=_0x56f658[_0xe495('0xa4')];var _0xbb26a4={'method':_0xe495('0xa5'),'uri':encodeURI(_0x567f5b+_0xe495('0xa6')+_0x4beff2+'\x27'),'headers':{'Authorization':_0xe495('0xa7')+_0x315ffd,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0xbb26a4);})['then'](function(_0x3ff17f){var _0x234f6b=_0x3ff17f[_0xe495('0xa9')][0x0];var _0x2fe232=_0x234f6b[_0xe495('0xaa')];var _0x3f8db0={'method':_0xe495('0xa5'),'uri':_0x567f5b+_0xe495('0xab')+_0x2fe232+_0xe495('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x315ffd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f8db0);})[_0xe495('0x3d')](function(_0x8aae75){_0x274aa4=_0x8aae75;_0x1aa3b5=_0x274aa4['Attributes'];_0x1aa3b5=_['remove'](_0x1aa3b5,function(_0x3dbae9){return!_0xb07e72[_0xe495('0xad')](_0x3dbae9['LogicalName']);});var _0x3dfb1f=[];var _0x1729c3=[];_0x1aa3b5[_0xe495('0xae')](function(_0x293220){if(_0x293220['@odata.type']){var _0x1af49f=_0x293220[_0xe495('0xaf')][_0xe495('0x9d')](_0x293220[_0xe495('0xaf')][_0xe495('0xb0')]('.')+0x1);if(_0x1af49f===_0xe495('0xb1')){_0x3dfb1f['push'](getSelectList(_0x567f5b,_0x51ef2b,_0x1729c3,_0x274aa4[_0xe495('0xaa')],_0x293220[_0xe495('0xaa')],_0x315ffd));}}});return Promise['all'](_0x3dfb1f);})[_0xe495('0x3d')](function(_0x1018ae){_0x4059af=_0x1018ae[0x0];var _0x19db42=[];var _0x224124=[];_0x1aa3b5[_0xe495('0xae')](function(_0x362832){if(!_[_0xe495('0xb2')](_0x362832[_0xe495('0xaf')])){var _0x1139bf=_0x362832[_0xe495('0xaf')]['substring'](_0x362832[_0xe495('0xaf')][_0xe495('0xb0')]('.')+0x1);if(_0x1139bf===_0xe495('0xb3')){_0x19db42[_0xe495('0xb4')](getBooleanList(_0x567f5b,_0x51ef2b,_0x224124,_0x274aa4[_0xe495('0xaa')],_0x362832['MetadataId'],_0x315ffd));}}});return Promise[_0xe495('0xb5')](_0x19db42);})['then'](function(_0x33e691){_0x3d5742=_0x33e691[0x0];var _0x40f51a=[];var _0x1198f1=[];_0x1aa3b5[_0xe495('0xae')](function(_0x3be16d){if(_0x3be16d[_0xe495('0xaf')]){var _0x31b518=_0x3be16d[_0xe495('0xaf')][_0xe495('0x9d')](_0x3be16d[_0xe495('0xaf')]['lastIndexOf']('.')+0x1);if(_0x31b518==='StringAttributeMetadata'||_0x31b518===_0xe495('0xb6')||_0x31b518===_0xe495('0xb7')||_0x31b518==='IntegerAttributeMetadata'||_0x31b518==='MemoAttributeMetadata'||_0x31b518===_0xe495('0xb8')||_0x31b518===_0xe495('0xb9')||_0x31b518===_0xe495('0xba')||_0x31b518==='StateAttributeMetadata'||_0x31b518===_0xe495('0xbb')){_0x40f51a[_0xe495('0xb4')](getInputList(_0x567f5b,_0x51ef2b,_0x31b518,_0x1198f1,_0x274aa4['MetadataId'],_0x3be16d[_0xe495('0xaa')],_0x315ffd));}}});return Promise[_0xe495('0xb5')](_0x40f51a);})[_0xe495('0x3d')](function(_0x14a9df){_0x4cdd91=_0x14a9df[0x0];var _0x5d1cf4=_0x4059af[_0xe495('0x97')](_0x3d5742)[_0xe495('0x97')](_0x4cdd91);var _0x376e84={'count':_0x5d1cf4[_0xe495('0x33')],'rows':_0x5d1cf4};return _0x376e84;})['then'](respondWithResult(_0x23dc48,null))[_0xe495('0x3f')](function(_0x4631aa){var _0x4257a2=_0xa73873[_0xe495('0x2c')]['test']?0x1f4:_0x4631aa[_0xe495('0xbc')]||0x1f4;logger['error'](_0x4631aa['stack']);delete _0x4631aa[_0xe495('0x26')];if(_0x4257a2===0x191){_0x4257a2=0x190;}_0x23dc48[_0xe495('0x18')](_0x4257a2)[_0xe495('0xbd')](_0xa73873[_0xe495('0x2c')]['test']?{'message':_0xe495('0xbe'),'statusCode':_0x4631aa[_0xe495('0xbc')]}:_0x4631aa);});};function getSelectList(_0x5e91a9,_0x4ec144,_0x3d8eef,_0x218dd9,_0x38f480,_0x42d944){var _0x9f76e8={'method':_0xe495('0xa5'),'uri':_0x5e91a9+_0xe495('0xab')+_0x218dd9+_0xe495('0xbf')+_0x38f480+_0xe495('0xc0')+_0xe495('0xc1'),'headers':{'Authorization':_0xe495('0xa7')+_0x42d944,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x9f76e8)[_0xe495('0x3d')](function(_0x4e21dc){var _0xbf121f=[];var _0x58f3ad=_0x4e21dc[_0xe495('0xc2')][_0xe495('0xc3')];_0x58f3ad[_0xe495('0xae')](function(_0x35e91c){_0xbf121f[_0xe495('0xb4')]({'name':_0x35e91c[_0xe495('0xc4')][_0xe495('0xc5')][_0xe495('0xc4')],'value':String(_0x35e91c['Value'])});});var _0x5cee64={'id':_0x4ec144+'_'+_0x4e21dc[_0xe495('0xc6')],'name':_0x4e21dc[_0xe495('0xc7')]['UserLocalizedLabel'][_0xe495('0xc4')],'custom':![],'options':_0xbf121f};_0x3d8eef[_0xe495('0xb4')](_0x5cee64);return _0x3d8eef;});}function getBooleanList(_0x34d418,_0x536857,_0x44664b,_0x5837c4,_0xf6d54c,_0x180f5a){var _0x2c71ca={'method':_0xe495('0xa5'),'uri':_0x34d418+'EntityDefinitions('+_0x5837c4+_0xe495('0xbf')+_0xf6d54c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe495('0xa7')+_0x180f5a,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x2c71ca)[_0xe495('0x3d')](function(_0x4da1c5){var _0x13329a=[];_0x13329a['push']({'name':_0x4da1c5[_0xe495('0xc2')][_0xe495('0xc8')]['Label'][_0xe495('0xc5')][_0xe495('0xc4')],'value':_0xe495('0xc9')},{'name':_0x4da1c5[_0xe495('0xc2')][_0xe495('0xca')][_0xe495('0xc4')][_0xe495('0xc5')]['Label'],'value':_0xe495('0xcb')});var _0x17d8ba={'id':_0x536857+'_'+_0x4da1c5[_0xe495('0xc6')],'name':_0x4da1c5[_0xe495('0xc7')]['UserLocalizedLabel'][_0xe495('0xc4')],'custom':![],'options':_0x13329a};_0x44664b[_0xe495('0xb4')](_0x17d8ba);return _0x44664b;});}function getInputList(_0x4c38f5,_0xc45ce9,_0x3508f3,_0x59e594,_0x5e50b3,_0x48fa1f,_0x22a862){var _0x4c2a14={'method':'GET','uri':_0x4c38f5+_0xe495('0xab')+_0x5e50b3+_0xe495('0xbf')+_0x48fa1f+')/Microsoft.Dynamics.CRM.'+_0x3508f3+_0xe495('0xcc'),'headers':{'Authorization':_0xe495('0xa7')+_0x22a862,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x4c2a14)[_0xe495('0x3d')](function(_0x419a51){var _0x3a7e2b={'id':_0xc45ce9+'_'+_0x419a51['LogicalName'],'name':_0x419a51[_0xe495('0xc7')]['UserLocalizedLabel']?_0x419a51[_0xe495('0xc7')][_0xe495('0xc5')][_0xe495('0xc4')]:_0x419a51['LogicalName'],'custom':![],'options':[]};_0x59e594[_0xe495('0xb4')](_0x3a7e2b);return _0x59e594;});} \ No newline at end of file +var _0xad53=['modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','clientSecret','slice','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','MetadataId','forEach','isNil','substring','lastIndexOf','BooleanAttributeMetadata','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','error','stack','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','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','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','destroy','name','index','map','Dynamics365Account','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','body','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','create','Subjects','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','modifiedbyexternalpartyyominame','modifiedbyname'];(function(_0x4d459f,_0x39cf57){var _0x2d4882=function(_0x4bb830){while(--_0x4bb830){_0x4d459f['push'](_0x4d459f['shift']());}};_0x2d4882(++_0x39cf57);}(_0xad53,0x1ea));var _0x3ad5=function(_0x455c44,_0x490d0a){_0x455c44=_0x455c44-0x0;var _0x5be916=_0xad53[_0x455c44];return _0x5be916;};'use strict';var emlformat=require(_0x3ad5('0x0'));var rimraf=require(_0x3ad5('0x1'));var zipdir=require(_0x3ad5('0x2'));var jsonpatch=require(_0x3ad5('0x3'));var rp=require(_0x3ad5('0x4'));var moment=require(_0x3ad5('0x5'));var BPromise=require(_0x3ad5('0x6'));var Mustache=require(_0x3ad5('0x7'));var util=require('util');var path=require(_0x3ad5('0x8'));var sox=require(_0x3ad5('0x9'));var csv=require(_0x3ad5('0xa'));var ejs=require(_0x3ad5('0xb'));var fs=require('fs');var fs_extra=require(_0x3ad5('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3ad5('0xd'));var deskjs=require(_0x3ad5('0xe'));var toCsv=require(_0x3ad5('0xa'));var querystring=require(_0x3ad5('0xf'));var Papa=require(_0x3ad5('0x10'));var Redis=require(_0x3ad5('0x11'));var authService=require(_0x3ad5('0x12'));var qs=require(_0x3ad5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ad5('0x14'));var logger=require(_0x3ad5('0x15'))(_0x3ad5('0x16'));var utils=require(_0x3ad5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3ad5('0x18'));var db=require(_0x3ad5('0x19'))['db'];var integrations=require(_0x3ad5('0x1a'));function respondWithStatusCode(_0x542e82,_0x1bd82f){_0x1bd82f=_0x1bd82f||0xcc;return function(_0xfbc961){if(_0xfbc961){return _0x542e82[_0x3ad5('0x1b')](_0x1bd82f);}return _0x542e82[_0x3ad5('0x1c')](_0x1bd82f)[_0x3ad5('0x1d')]();};}function respondWithResult(_0x28d6ad,_0x50758e){_0x50758e=_0x50758e||0xc8;return function(_0x5bdecb){if(_0x5bdecb){return _0x28d6ad[_0x3ad5('0x1c')](_0x50758e)[_0x3ad5('0x1e')](_0x5bdecb);}};}function respondWithFilteredResult(_0xabcbc0,_0x70aec9){return function(_0x1d5868){if(_0x1d5868){var _0x365f38=typeof _0x70aec9['offset']==='undefined'&&typeof _0x70aec9[_0x3ad5('0x1f')]===_0x3ad5('0x20');var _0x5df744=_0x1d5868['count'];var _0x445741=_0x365f38?0x0:_0x70aec9[_0x3ad5('0x21')];var _0x179cda=_0x365f38?_0x1d5868[_0x3ad5('0x22')]:_0x70aec9['offset']+_0x70aec9[_0x3ad5('0x1f')];var _0x36780a;if(_0x179cda>=_0x5df744){_0x179cda=_0x5df744;_0x36780a=0xc8;}else{_0x36780a=0xce;}_0xabcbc0[_0x3ad5('0x1c')](_0x36780a);return _0xabcbc0[_0x3ad5('0x23')](_0x3ad5('0x24'),_0x445741+'-'+_0x179cda+'/'+_0x5df744)[_0x3ad5('0x1e')](_0x1d5868);}return null;};}function patchUpdates(_0x3aaef8){return function(_0x3a8960){try{jsonpatch[_0x3ad5('0x25')](_0x3a8960,_0x3aaef8,!![]);}catch(_0x5721e8){return BPromise[_0x3ad5('0x26')](_0x5721e8);}return _0x3a8960['save']();};}function saveUpdates(_0x936a29,_0x58a06f){return function(_0x88a840){if(_0x88a840){return _0x88a840[_0x3ad5('0x27')](_0x936a29)[_0x3ad5('0x28')](function(_0xeaf8f7){return _0xeaf8f7;});}return null;};}function removeEntity(_0x24d2ee,_0x26b402){return function(_0x4c59dc){if(_0x4c59dc){return _0x4c59dc[_0x3ad5('0x29')]()[_0x3ad5('0x28')](function(){_0x24d2ee['status'](0xcc)[_0x3ad5('0x1d')]();});}};}function handleEntityNotFound(_0x24f7e1,_0x42c242){return function(_0x494adf){if(!_0x494adf){_0x24f7e1[_0x3ad5('0x1b')](0x194);}return _0x494adf;};}function handleError(_0x429ea6,_0x40da5d){_0x40da5d=_0x40da5d||0x1f4;return function(_0x4d73b1){logger['error'](_0x4d73b1['stack']);if(_0x4d73b1[_0x3ad5('0x2a')]){delete _0x4d73b1[_0x3ad5('0x2a')];}_0x429ea6[_0x3ad5('0x1c')](_0x40da5d)['send'](_0x4d73b1);};}exports[_0x3ad5('0x2b')]=function(_0x1724fc,_0x489de6){var _0x4c66f7={},_0x2a402c={},_0x5c2d1e={'count':0x0,'rows':[]};var _0x180729=_[_0x3ad5('0x2c')](db[_0x3ad5('0x2d')][_0x3ad5('0x2e')],function(_0x1fb6f3){return{'name':_0x1fb6f3['fieldName'],'type':_0x1fb6f3['type'][_0x3ad5('0x2f')]};});_0x2a402c[_0x3ad5('0x30')]=_[_0x3ad5('0x2c')](_0x180729,_0x3ad5('0x2a'));_0x2a402c['query']=_[_0x3ad5('0x31')](_0x1724fc[_0x3ad5('0x32')]);_0x2a402c[_0x3ad5('0x33')]=_[_0x3ad5('0x34')](_0x2a402c[_0x3ad5('0x30')],_0x2a402c[_0x3ad5('0x32')]);_0x4c66f7[_0x3ad5('0x35')]=_[_0x3ad5('0x34')](_0x2a402c[_0x3ad5('0x30')],qs[_0x3ad5('0x36')](_0x1724fc['query'][_0x3ad5('0x36')]));_0x4c66f7[_0x3ad5('0x35')]=_0x4c66f7[_0x3ad5('0x35')][_0x3ad5('0x37')]?_0x4c66f7[_0x3ad5('0x35')]:_0x2a402c[_0x3ad5('0x30')];if(!_0x1724fc[_0x3ad5('0x32')]['hasOwnProperty']('nolimit')){_0x4c66f7[_0x3ad5('0x1f')]=qs[_0x3ad5('0x1f')](_0x1724fc['query'][_0x3ad5('0x1f')]);_0x4c66f7[_0x3ad5('0x21')]=qs[_0x3ad5('0x21')](_0x1724fc[_0x3ad5('0x32')][_0x3ad5('0x21')]);}_0x4c66f7[_0x3ad5('0x38')]=qs[_0x3ad5('0x39')](_0x1724fc[_0x3ad5('0x32')][_0x3ad5('0x39')]);_0x4c66f7[_0x3ad5('0x3a')]=qs[_0x3ad5('0x33')](_[_0x3ad5('0x3b')](_0x1724fc[_0x3ad5('0x32')],_0x2a402c['filters']),_0x180729);if(_0x1724fc[_0x3ad5('0x32')]['filter']){_0x4c66f7[_0x3ad5('0x3a')]=_[_0x3ad5('0x3c')](_0x4c66f7[_0x3ad5('0x3a')],{'$or':_[_0x3ad5('0x2c')](_0x180729,function(_0x1d9393){if(_0x1d9393[_0x3ad5('0x3d')]!==_0x3ad5('0x3e')){var _0x4a462f={};_0x4a462f[_0x1d9393['name']]={'$like':'%'+_0x1724fc[_0x3ad5('0x32')][_0x3ad5('0x3f')]+'%'};return _0x4a462f;}})});}_0x4c66f7=_[_0x3ad5('0x3c')]({},_0x4c66f7,_0x1724fc[_0x3ad5('0x40')]);var _0x35e090={'where':_0x4c66f7[_0x3ad5('0x3a')]};return db[_0x3ad5('0x2d')][_0x3ad5('0x22')](_0x35e090)[_0x3ad5('0x28')](function(_0x135fa0){_0x5c2d1e[_0x3ad5('0x22')]=_0x135fa0;if(_0x1724fc[_0x3ad5('0x32')][_0x3ad5('0x41')]){_0x4c66f7[_0x3ad5('0x42')]=[{'all':!![]}];}return db[_0x3ad5('0x2d')][_0x3ad5('0x43')](_0x4c66f7);})[_0x3ad5('0x28')](function(_0x29726b){_0x5c2d1e['rows']=_0x29726b;return _0x5c2d1e;})['then'](respondWithFilteredResult(_0x489de6,_0x4c66f7))[_0x3ad5('0x44')](handleError(_0x489de6,null));};exports[_0x3ad5('0x45')]=function(_0x550c1c,_0x6a73f3){var _0x47f797={'raw':![],'where':{'id':_0x550c1c[_0x3ad5('0x46')]['id']}},_0x543529={};_0x543529[_0x3ad5('0x30')]=_[_0x3ad5('0x31')](db[_0x3ad5('0x2d')][_0x3ad5('0x2e')]);_0x543529[_0x3ad5('0x32')]=_[_0x3ad5('0x31')](_0x550c1c['query']);_0x543529[_0x3ad5('0x33')]=_[_0x3ad5('0x34')](_0x543529[_0x3ad5('0x30')],_0x543529[_0x3ad5('0x32')]);_0x47f797[_0x3ad5('0x35')]=_['intersection'](_0x543529[_0x3ad5('0x30')],qs[_0x3ad5('0x36')](_0x550c1c[_0x3ad5('0x32')][_0x3ad5('0x36')]));_0x47f797['attributes']=_0x47f797['attributes']['length']?_0x47f797[_0x3ad5('0x35')]:_0x543529[_0x3ad5('0x30')];if(_0x550c1c[_0x3ad5('0x32')][_0x3ad5('0x41')]){_0x47f797['include']=[{'all':!![]}];}_0x47f797=_['merge']({},_0x47f797,_0x550c1c[_0x3ad5('0x40')]);return db[_0x3ad5('0x2d')][_0x3ad5('0x47')](_0x47f797)['then'](handleEntityNotFound(_0x6a73f3,null))[_0x3ad5('0x28')](respondWithResult(_0x6a73f3,null))[_0x3ad5('0x44')](handleError(_0x6a73f3,null));};exports['create']=function(_0x26acf4,_0x31f25c){return db[_0x3ad5('0x2d')]['create'](_0x26acf4['body'],{})[_0x3ad5('0x28')](respondWithResult(_0x31f25c,0xc9))['catch'](handleError(_0x31f25c,null));};exports[_0x3ad5('0x27')]=function(_0x5351d9,_0x2efc15){if(_0x5351d9[_0x3ad5('0x48')]['id']){delete _0x5351d9['body']['id'];}return db[_0x3ad5('0x2d')][_0x3ad5('0x47')]({'where':{'id':_0x5351d9[_0x3ad5('0x46')]['id']}})['then'](handleEntityNotFound(_0x2efc15,null))['then'](saveUpdates(_0x5351d9[_0x3ad5('0x48')],null))[_0x3ad5('0x28')](respondWithResult(_0x2efc15,null))[_0x3ad5('0x44')](handleError(_0x2efc15,null));};exports[_0x3ad5('0x29')]=function(_0x1b423c,_0x4e82c0){return db[_0x3ad5('0x2d')][_0x3ad5('0x47')]({'where':{'id':_0x1b423c['params']['id']}})[_0x3ad5('0x28')](handleEntityNotFound(_0x4e82c0,null))['then'](removeEntity(_0x4e82c0,null))[_0x3ad5('0x44')](handleError(_0x4e82c0,null));};exports[_0x3ad5('0x49')]=function(_0x28ca27,_0x13f65b,_0x38634a){var _0x204bae={};var _0x386f76={};var _0x3b4609;var _0x4506f6;return db[_0x3ad5('0x2d')]['findOne']({'where':{'id':_0x28ca27[_0x3ad5('0x46')]['id']}})[_0x3ad5('0x28')](handleEntityNotFound(_0x13f65b,null))['then'](function(_0x137b1d){if(_0x137b1d){_0x3b4609=_0x137b1d;_0x386f76['model']=_[_0x3ad5('0x31')](db['Dynamics365Configuration'][_0x3ad5('0x2e')]);_0x386f76[_0x3ad5('0x32')]=_['keys'](_0x28ca27[_0x3ad5('0x32')]);_0x386f76['filters']=_[_0x3ad5('0x34')](_0x386f76[_0x3ad5('0x30')],_0x386f76[_0x3ad5('0x32')]);_0x204bae['attributes']=_[_0x3ad5('0x34')](_0x386f76['model'],qs[_0x3ad5('0x36')](_0x28ca27['query'][_0x3ad5('0x36')]));_0x204bae[_0x3ad5('0x35')]=_0x204bae[_0x3ad5('0x35')][_0x3ad5('0x37')]?_0x204bae['attributes']:_0x386f76['model'];_0x204bae[_0x3ad5('0x38')]=qs[_0x3ad5('0x39')](_0x28ca27[_0x3ad5('0x32')]['sort']);_0x204bae['where']=qs[_0x3ad5('0x33')](_[_0x3ad5('0x3b')](_0x28ca27[_0x3ad5('0x32')],_0x386f76[_0x3ad5('0x33')]));if(_0x28ca27['query'][_0x3ad5('0x3f')]){_0x204bae[_0x3ad5('0x3a')]=_[_0x3ad5('0x3c')](_0x204bae[_0x3ad5('0x3a')],{'$or':_[_0x3ad5('0x2c')](_0x204bae[_0x3ad5('0x35')],function(_0x5b5845){var _0x49bb31={};_0x49bb31[_0x5b5845]={'$like':'%'+_0x28ca27[_0x3ad5('0x32')][_0x3ad5('0x3f')]+'%'};return _0x49bb31;})});}_0x204bae=_[_0x3ad5('0x3c')]({},_0x204bae,_0x28ca27['options']);return _0x3b4609['getConfigurations'](_0x204bae);}})['then'](function(_0x4b321e){if(_0x4b321e){_0x4506f6=_0x4b321e['length'];if(!_0x28ca27['query'][_0x3ad5('0x4a')]('nolimit')){_0x204bae[_0x3ad5('0x1f')]=qs['limit'](_0x28ca27[_0x3ad5('0x32')][_0x3ad5('0x1f')]);_0x204bae[_0x3ad5('0x21')]=qs[_0x3ad5('0x21')](_0x28ca27[_0x3ad5('0x32')][_0x3ad5('0x21')]);}return _0x3b4609['getConfigurations'](_0x204bae);}})[_0x3ad5('0x28')](function(_0x4801cd){if(_0x4801cd){return _0x4801cd?{'count':_0x4506f6,'rows':_0x4801cd}:null;}})['then'](respondWithResult(_0x13f65b,null))['catch'](handleError(_0x13f65b,null));};exports[_0x3ad5('0x4b')]=function(_0x3121d1,_0x24f4fa,_0x15bf13){if(_0x3121d1[_0x3ad5('0x48')]['id']){delete _0x3121d1[_0x3ad5('0x48')]['id'];}return db['Dynamics365Account'][_0x3ad5('0x4c')]({'where':{'id':_0x3121d1[_0x3ad5('0x46')]['id']}})[_0x3ad5('0x28')](handleEntityNotFound(_0x24f4fa,null))[_0x3ad5('0x28')](function(_0x395f10){if(_0x395f10){_0x3121d1[_0x3ad5('0x48')][_0x3ad5('0x4d')]=_0x395f10['id'];_0x3121d1[_0x3ad5('0x48')]['Subjects']=integrations[_0x3ad5('0x4e')](_0x3121d1['body'][_0x3ad5('0x4f')],_0x3121d1[_0x3ad5('0x48')][_0x3ad5('0x3d')]);_0x3121d1[_0x3ad5('0x48')][_0x3ad5('0x50')]=integrations[_0x3ad5('0x51')](_0x3121d1[_0x3ad5('0x48')][_0x3ad5('0x4f')],_0x3121d1['body']['type']);return db[_0x3ad5('0x52')][_0x3ad5('0x53')](_0x3121d1['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x3ad5('0x54')},{'model':db[_0x3ad5('0x55')],'as':_0x3ad5('0x50')}]});}return null;})['then'](respondWithResult(_0x24f4fa,null))[_0x3ad5('0x44')](handleError(_0x24f4fa,null));};exports[_0x3ad5('0x56')]=function(_0x45ace8,_0x50f562,_0x5777df){var _0x41ed33=_0x45ace8[_0x3ad5('0x32')][_0x3ad5('0x57')];var _0x45de70=_0x41ed33===_0x3ad5('0x58')?_0x3ad5('0x59'):_0x3ad5('0x5a');var _0x2d0670='';var _0x269ee1='';var _0x41e409='';var _0x220335='';var _0x6dd459='';var _0x7a08dd='';var _0x473e66='';var _0x35619b='';var _0x2d483b=['title',_0x3ad5('0x5b'),_0x3ad5('0x5c'),'ownerid',_0x3ad5('0x5d'),_0x3ad5('0x5e'),_0x3ad5('0x5f'),_0x3ad5('0x60'),_0x3ad5('0x61'),'phonecall_activity_parties'];var _0x120a09=['accountidname','accountidyominame',_0x3ad5('0x62'),'billedserviceunits',_0x3ad5('0x63'),'contactidyominame',_0x3ad5('0x64'),_0x3ad5('0x65'),_0x3ad5('0x66'),_0x3ad5('0x67'),_0x3ad5('0x68'),'createdbyyominame','createdon',_0x3ad5('0x69'),_0x3ad5('0x6a'),_0x3ad5('0x6b'),_0x3ad5('0x6c'),'customeridyominame',_0x3ad5('0x6d'),_0x3ad5('0x6e'),_0x3ad5('0x6f'),_0x3ad5('0x70'),_0x3ad5('0x71'),_0x3ad5('0x72'),_0x3ad5('0x73'),'followupby','importsequencenumber',_0x3ad5('0x74'),'kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname',_0x3ad5('0x75'),_0x3ad5('0x76'),_0x3ad5('0x77'),_0x3ad5('0x78'),_0x3ad5('0x79'),_0x3ad5('0x7a'),_0x3ad5('0x7b'),_0x3ad5('0x7c'),_0x3ad5('0x7d'),'onholdtime',_0x3ad5('0x7e'),_0x3ad5('0x7f'),_0x3ad5('0x80'),_0x3ad5('0x81'),_0x3ad5('0x82'),_0x3ad5('0x83'),_0x3ad5('0x84'),_0x3ad5('0x85'),_0x3ad5('0x86'),'productserialnumber',_0x3ad5('0x87'),'resolvebykpiidname',_0x3ad5('0x88'),_0x3ad5('0x89'),_0x3ad5('0x8a'),_0x3ad5('0x8b'),_0x3ad5('0x8c'),'slaname','socialprofileidname',_0x3ad5('0x8d'),_0x3ad5('0x8e'),_0x3ad5('0x8f'),_0x3ad5('0x90'),'timezoneruleversionnumber',_0x3ad5('0x91'),_0x3ad5('0x92'),'utcconversiontimezonecode',_0x3ad5('0x93')];var _0xcff7d3=_0x2d483b[_0x3ad5('0x94')](_0x120a09);return db['Dynamics365Account'][_0x3ad5('0x4c')]({'where':{'id':_0x45ace8['params']['id']},'attributes':['id',_0x3ad5('0x95'),_0x3ad5('0x96'),_0x3ad5('0x97'),'tenantId','clientId',_0x3ad5('0x98')]})[_0x3ad5('0x28')](handleEntityNotFound(_0x50f562,null))['then'](function(_0x594b92){if(_0x594b92){_0x35619b=_0x594b92[_0x3ad5('0x97')];var _0x3c007c=_0x35619b[_0x3ad5('0x99')](-0x1);if(_0x3c007c==='/'){_0x35619b=_0x35619b['substring'](0x0,_0x35619b['lastIndexOf'](_0x3c007c));}_0x473e66=util['format'](_0x3ad5('0x9a'),_0x35619b);var _0x1954d4={'method':_0x3ad5('0x9b'),'uri':_0x3ad5('0x9c')+_0x594b92[_0x3ad5('0x9d')]+_0x3ad5('0x9e'),'form':{'client_id':_0x594b92[_0x3ad5('0x9f')],'resource':_0x35619b,'username':_0x594b92[_0x3ad5('0x95')],'password':_0x594b92[_0x3ad5('0x96')],'grant_type':'password','client_secret':_0x594b92[_0x3ad5('0x98')]},'json':!![]};return rp(_0x1954d4);}})[_0x3ad5('0x28')](function(_0x28e800){_0x7a08dd=_0x28e800['access_token'];var _0x595879={'method':_0x3ad5('0xa0'),'uri':encodeURI(_0x473e66+_0x3ad5('0xa1')+_0x45de70+'\x27'),'headers':{'Authorization':_0x3ad5('0xa2')+_0x7a08dd,'If-None-Match':null,'OData-Version':_0x3ad5('0xa3')},'json':!![]};return rp(_0x595879);})[_0x3ad5('0x28')](function(_0x32e899){var _0x372afb=_0x32e899[_0x3ad5('0xa4')][0x0];var _0xa3fe7c=_0x372afb['MetadataId'];var _0x16947f={'method':_0x3ad5('0xa0'),'uri':_0x473e66+_0x3ad5('0xa5')+_0xa3fe7c+_0x3ad5('0xa6'),'headers':{'Authorization':'Bearer\x20'+_0x7a08dd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16947f);})[_0x3ad5('0x28')](function(_0x114b4d){_0x2d0670=_0x114b4d;_0x269ee1=_0x2d0670['Attributes'];_0x269ee1=_[_0x3ad5('0xa7')](_0x269ee1,function(_0x56709e){return!_0xcff7d3[_0x3ad5('0xa8')](_0x56709e[_0x3ad5('0xa9')]);});var _0x1a3f57=[];var _0x16f6e4=[];_0x269ee1['forEach'](function(_0x37c35c){if(_0x37c35c[_0x3ad5('0xaa')]){var _0x52eebb=_0x37c35c['@odata.type']['substring'](_0x37c35c[_0x3ad5('0xaa')]['lastIndexOf']('.')+0x1);if(_0x52eebb===_0x3ad5('0xab')){_0x1a3f57['push'](getSelectList(_0x473e66,_0x41ed33,_0x16f6e4,_0x2d0670['MetadataId'],_0x37c35c[_0x3ad5('0xac')],_0x7a08dd));}}});return Promise['all'](_0x1a3f57);})[_0x3ad5('0x28')](function(_0x2a8f1){_0x41e409=_0x2a8f1[0x0];var _0x375747=[];var _0x39b461=[];_0x269ee1[_0x3ad5('0xad')](function(_0x34f6d2){if(!_[_0x3ad5('0xae')](_0x34f6d2[_0x3ad5('0xaa')])){var _0x4c9994=_0x34f6d2[_0x3ad5('0xaa')][_0x3ad5('0xaf')](_0x34f6d2[_0x3ad5('0xaa')][_0x3ad5('0xb0')]('.')+0x1);if(_0x4c9994===_0x3ad5('0xb1')){_0x375747[_0x3ad5('0xb2')](getBooleanList(_0x473e66,_0x41ed33,_0x39b461,_0x2d0670[_0x3ad5('0xac')],_0x34f6d2[_0x3ad5('0xac')],_0x7a08dd));}}});return Promise['all'](_0x375747);})[_0x3ad5('0x28')](function(_0x196d83){_0x220335=_0x196d83[0x0];var _0x5c9049=[];var _0x58b706=[];_0x269ee1[_0x3ad5('0xad')](function(_0x55abe3){if(_0x55abe3[_0x3ad5('0xaa')]){var _0x500ace=_0x55abe3[_0x3ad5('0xaa')][_0x3ad5('0xaf')](_0x55abe3['@odata.type'][_0x3ad5('0xb0')]('.')+0x1);if(_0x500ace==='StringAttributeMetadata'||_0x500ace===_0x3ad5('0xb3')||_0x500ace===_0x3ad5('0xb4')||_0x500ace===_0x3ad5('0xb5')||_0x500ace===_0x3ad5('0xb6')||_0x500ace==='DateTimeAttributeMetadata'||_0x500ace===_0x3ad5('0xb7')||_0x500ace===_0x3ad5('0xb8')||_0x500ace===_0x3ad5('0xb9')||_0x500ace==='DecimalAttributeMetadata'){_0x5c9049[_0x3ad5('0xb2')](getInputList(_0x473e66,_0x41ed33,_0x500ace,_0x58b706,_0x2d0670['MetadataId'],_0x55abe3[_0x3ad5('0xac')],_0x7a08dd));}}});return Promise['all'](_0x5c9049);})[_0x3ad5('0x28')](function(_0x373818){_0x6dd459=_0x373818[0x0];var _0x2c06ac=_0x41e409[_0x3ad5('0x94')](_0x220335)['concat'](_0x6dd459);var _0x20f75a={'count':_0x2c06ac[_0x3ad5('0x37')],'rows':_0x2c06ac};return _0x20f75a;})[_0x3ad5('0x28')](respondWithResult(_0x50f562,null))[_0x3ad5('0x44')](function(_0x4009e7){var _0x38fc64=_0x45ace8[_0x3ad5('0x32')][_0x3ad5('0xba')]?0x1f4:_0x4009e7['statusCode']||0x1f4;logger[_0x3ad5('0xbb')](_0x4009e7[_0x3ad5('0xbc')]);delete _0x4009e7['name'];if(_0x38fc64===0x191){_0x38fc64=0x190;}_0x50f562[_0x3ad5('0x1c')](_0x38fc64)[_0x3ad5('0xbd')](_0x45ace8[_0x3ad5('0x32')][_0x3ad5('0xba')]?{'message':_0x3ad5('0xbe'),'statusCode':_0x4009e7[_0x3ad5('0xbf')]}:_0x4009e7);});};function getSelectList(_0x509f71,_0x194030,_0x42e3f8,_0x4970d6,_0xb7b958,_0x227dcb){var _0x43de5b={'method':_0x3ad5('0xa0'),'uri':_0x509f71+_0x3ad5('0xa5')+_0x4970d6+_0x3ad5('0xc0')+_0xb7b958+_0x3ad5('0xc1')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x227dcb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x43de5b)[_0x3ad5('0x28')](function(_0x57f1ae){var _0x20b6af=[];var _0x58fb0c=_0x57f1ae[_0x3ad5('0xc2')]['Options'];_0x58fb0c[_0x3ad5('0xad')](function(_0x3c3d6c){_0x20b6af['push']({'name':_0x3c3d6c[_0x3ad5('0xc3')][_0x3ad5('0xc4')][_0x3ad5('0xc3')],'value':String(_0x3c3d6c['Value'])});});var _0x253b7d={'id':_0x194030+'_'+_0x57f1ae[_0x3ad5('0xa9')],'name':_0x57f1ae[_0x3ad5('0xc5')]['UserLocalizedLabel'][_0x3ad5('0xc3')],'custom':![],'options':_0x20b6af};_0x42e3f8['push'](_0x253b7d);return _0x42e3f8;});}function getBooleanList(_0x5ab6d3,_0x26e149,_0x320b88,_0x22b548,_0x5dee23,_0xe66d9a){var _0x3dad={'method':_0x3ad5('0xa0'),'uri':_0x5ab6d3+_0x3ad5('0xa5')+_0x22b548+')/Attributes('+_0x5dee23+_0x3ad5('0xc6'),'headers':{'Authorization':_0x3ad5('0xa2')+_0xe66d9a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3dad)[_0x3ad5('0x28')](function(_0xf362c2){var _0x387fc2=[];_0x387fc2[_0x3ad5('0xb2')]({'name':_0xf362c2[_0x3ad5('0xc2')][_0x3ad5('0xc7')]['Label'][_0x3ad5('0xc4')][_0x3ad5('0xc3')],'value':_0x3ad5('0xc8')},{'name':_0xf362c2['OptionSet'][_0x3ad5('0xc9')][_0x3ad5('0xc3')][_0x3ad5('0xc4')][_0x3ad5('0xc3')],'value':'false'});var _0x53829d={'id':_0x26e149+'_'+_0xf362c2[_0x3ad5('0xa9')],'name':_0xf362c2[_0x3ad5('0xc5')][_0x3ad5('0xc4')]['Label'],'custom':![],'options':_0x387fc2};_0x320b88[_0x3ad5('0xb2')](_0x53829d);return _0x320b88;});}function getInputList(_0x55db44,_0x1048a4,_0x11a02a,_0x411225,_0x4bb705,_0x23e856,_0x112841){var _0x59c4ce={'method':'GET','uri':_0x55db44+_0x3ad5('0xa5')+_0x4bb705+_0x3ad5('0xc0')+_0x23e856+')/Microsoft.Dynamics.CRM.'+_0x11a02a+_0x3ad5('0xca'),'headers':{'Authorization':'Bearer\x20'+_0x112841,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x59c4ce)[_0x3ad5('0x28')](function(_0xa0f010){var _0x1ec706={'id':_0x1048a4+'_'+_0xa0f010[_0x3ad5('0xa9')],'name':_0xa0f010[_0x3ad5('0xc5')][_0x3ad5('0xc4')]?_0xa0f010[_0x3ad5('0xc5')][_0x3ad5('0xc4')]['Label']:_0xa0f010[_0x3ad5('0xa9')],'custom':![],'options':[]};_0x411225[_0x3ad5('0xb2')](_0x1ec706);return _0x411225;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 93eed02..85b155f 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x55be03,_0x58375a){var _0x745919=function(_0x147e34){while(--_0x147e34){_0x55be03['push'](_0x55be03['shift']());}};_0x745919(++_0x58375a);}(_0xe706,0xa3));var _0x6e70=function(_0x2d778d,_0x453b15){_0x2d778d=_0x2d778d-0x0;var _0x41d05b=_0xe706[_0x2d778d];return _0x41d05b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x103a7e,_0x5b8ac5){var _0x49f447=function(_0x52a522){while(--_0x52a522){_0x103a7e['push'](_0x103a7e['shift']());}};_0x49f447(++_0x5b8ac5);}(_0x757a,0xde));var _0xa757=function(_0x29a267,_0x15f9e0){_0x29a267=_0x29a267-0x0;var _0x467410=_0x757a[_0x29a267];return _0x467410;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 e0b0f61..63103a3 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 _0x819a=['../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','then','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x819a,0xaf));var _0xa819=function(_0x11eec5,_0x49c834){_0x11eec5=_0x11eec5-0x0;var _0x184378=_0x819a[_0x11eec5];return _0x184378;};'use strict';var _=require(_0xa819('0x0'));var util=require('util');var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var rs=require(_0xa819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa819('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa819('0x5'))(_0xa819('0x6'));var config=require(_0xa819('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa819('0x8')][_0xa819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a277,_0xeafdf9,_0x5b8519){return new BPromise(function(_0x53e7a2,_0x18a552){return client[_0xa819('0xa')](_0x51a277,_0x5b8519)['then'](function(_0x44d4ca){logger[_0xa819('0xb')](_0xa819('0xc'),_0xeafdf9,'request\x20sent');logger[_0xa819('0xd')](_0xa819('0xe'),_0xeafdf9,_0xa819('0xf'),JSON['stringify'](_0x44d4ca));if(_0x44d4ca['error']){if(_0x44d4ca[_0xa819('0x10')][_0xa819('0x11')]===0x1f4){logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x18a552(_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);}logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x53e7a2(_0x44d4ca['error'][_0xa819('0x12')]);}else{logger['info'](_0xa819('0xc'),_0xeafdf9,'request\x20sent');_0x53e7a2(_0x44d4ca[_0xa819('0x13')][_0xa819('0x12')]);}})[_0xa819('0x14')](function(_0x1fa750){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xeafdf9,_0x1fa750);_0x18a552(_0x1fa750);});});}exports['GetDynamics365Account']=function(_0x4c3a17){var _0x354c5a=this;return new Promise(function(_0x4f72c2,_0x4096ee){return db[_0xa819('0x15')][_0xa819('0x16')]({'raw':_0x4c3a17['options']?_0x4c3a17['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x18')]||null:null,'attributes':_0x4c3a17['options']?_0x4c3a17[_0xa819('0x17')][_0xa819('0x19')]||null:null,'limit':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x1a')]||null:null,'include':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x4c3a17[_0xa819('0x17')]['include'],function(_0x5cf98d){return{'model':db[_0x5cf98d[_0xa819('0x1d')]],'as':_0x5cf98d['as'],'attributes':_0x5cf98d[_0xa819('0x19')],'include':_0x5cf98d[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x5cf98d[_0xa819('0x1b')],function(_0x322e1f){return{'model':db[_0x322e1f['model']],'as':_0x322e1f['as'],'attributes':_0x322e1f[_0xa819('0x19')],'include':_0x322e1f[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x322e1f['include'],function(_0x488459){return{'model':db[_0x488459['model']],'as':_0x488459['as'],'attributes':_0x488459[_0xa819('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa819('0x1e')](function(_0x3941ec){logger[_0xa819('0xb')](_0xa819('0x1f'),_0x4c3a17);logger[_0xa819('0xd')]('GetDynamics365Account',_0x4c3a17,JSON[_0xa819('0x20')](_0x3941ec));_0x4f72c2(_0x3941ec);})[_0xa819('0x14')](function(_0x1a4bb3){logger['error'](_0xa819('0x1f'),_0x1a4bb3[_0xa819('0x12')],_0x4c3a17);_0x4096ee(_0x354c5a[_0xa819('0x10')](0x1f4,_0x1a4bb3[_0xa819('0x12')]));});});};exports[_0xa819('0x21')]=function(_0x580b21){var _0x1bfebc=this;return new Promise(function(_0x275afc,_0x451561){return db[_0xa819('0x15')][_0xa819('0x22')]({'raw':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x23')]===undefined?!![]:![]:!![],'where':_0x580b21['options']?_0x580b21[_0xa819('0x17')][_0xa819('0x18')]||null:null,'attributes':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x19')]||null:null,'include':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x580b21['options'][_0xa819('0x1b')],function(_0x2c0e98){return{'model':db[_0x2c0e98[_0xa819('0x1d')]],'as':_0x2c0e98['as'],'attributes':_0x2c0e98[_0xa819('0x19')],'include':_0x2c0e98['include']?_[_0xa819('0x1c')](_0x2c0e98[_0xa819('0x1b')],function(_0x40309f){return{'model':db[_0x40309f[_0xa819('0x1d')]],'as':_0x40309f['as'],'attributes':_0x40309f[_0xa819('0x19')],'include':_0x40309f[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x40309f[_0xa819('0x1b')],function(_0x28876e){return{'model':db[_0x28876e[_0xa819('0x1d')]],'as':_0x28876e['as'],'attributes':_0x28876e[_0xa819('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa819('0x1e')](function(_0x514397){logger[_0xa819('0xb')]('ShowDynamics365Account',_0x580b21);logger[_0xa819('0xd')](_0xa819('0x21'),_0x580b21,JSON[_0xa819('0x20')](_0x514397));_0x275afc(_0x514397);})[_0xa819('0x14')](function(_0x56ce4d){logger[_0xa819('0x10')](_0xa819('0x21'),_0x56ce4d[_0xa819('0x12')],_0x580b21);_0x451561(_0x1bfebc['error'](0x1f4,_0x56ce4d[_0xa819('0x12')]));});});}; \ No newline at end of file +var _0x1794=['where','attributes','limit','map','include','model','debug','catch','Dynamics365Account','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','findAll','options','raw'];(function(_0x4873fa,_0x373a5c){var _0x525fd6=function(_0x3791f4){while(--_0x3791f4){_0x4873fa['push'](_0x4873fa['shift']());}};_0x525fd6(++_0x373a5c);}(_0x1794,0x1ba));var _0x4179=function(_0x39a6a6,_0x5ef86e){_0x39a6a6=_0x39a6a6-0x0;var _0x34489e=_0x1794[_0x39a6a6];return _0x34489e;};'use strict';var _=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var moment=require(_0x4179('0x2'));var BPromise=require(_0x4179('0x3'));var rs=require(_0x4179('0x4'));var fs=require('fs');var Redis=require(_0x4179('0x5'));var db=require(_0x4179('0x6'))['db'];var utils=require(_0x4179('0x7'));var logger=require(_0x4179('0x8'))(_0x4179('0x9'));var config=require(_0x4179('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4179('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43ee02,_0x511624,_0x1e9d33){return new BPromise(function(_0x4dfef9,_0x388e18){return client['request'](_0x43ee02,_0x1e9d33)[_0x4179('0xc')](function(_0x1b6c41){logger[_0x4179('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x511624,_0x4179('0xe'));logger['debug'](_0x4179('0xf'),_0x511624,_0x4179('0xe'),JSON[_0x4179('0x10')](_0x1b6c41));if(_0x1b6c41[_0x4179('0x11')]){if(_0x1b6c41[_0x4179('0x11')][_0x4179('0x12')]===0x1f4){logger[_0x4179('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x511624,_0x1b6c41[_0x4179('0x11')][_0x4179('0x13')]);return _0x388e18(_0x1b6c41[_0x4179('0x11')][_0x4179('0x13')]);}logger[_0x4179('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x511624,_0x1b6c41[_0x4179('0x11')][_0x4179('0x13')]);return _0x4dfef9(_0x1b6c41[_0x4179('0x11')][_0x4179('0x13')]);}else{logger[_0x4179('0xd')](_0x4179('0x14'),_0x511624,'request\x20sent');_0x4dfef9(_0x1b6c41[_0x4179('0x15')]['message']);}})['catch'](function(_0x5cf637){logger[_0x4179('0x11')](_0x4179('0x14'),_0x511624,_0x5cf637);_0x388e18(_0x5cf637);});});}exports[_0x4179('0x16')]=function(_0x314369){var _0x307100=this;return new Promise(function(_0x82b83b,_0x45223f){return db['Dynamics365Account'][_0x4179('0x17')]({'raw':_0x314369[_0x4179('0x18')]?_0x314369[_0x4179('0x18')][_0x4179('0x19')]===undefined?!![]:![]:!![],'where':_0x314369[_0x4179('0x18')]?_0x314369[_0x4179('0x18')][_0x4179('0x1a')]||null:null,'attributes':_0x314369[_0x4179('0x18')]?_0x314369[_0x4179('0x18')][_0x4179('0x1b')]||null:null,'limit':_0x314369[_0x4179('0x18')]?_0x314369[_0x4179('0x18')][_0x4179('0x1c')]||null:null,'include':_0x314369['options']?_0x314369[_0x4179('0x18')]['include']?_[_0x4179('0x1d')](_0x314369[_0x4179('0x18')][_0x4179('0x1e')],function(_0xeb549f){return{'model':db[_0xeb549f[_0x4179('0x1f')]],'as':_0xeb549f['as'],'attributes':_0xeb549f[_0x4179('0x1b')],'include':_0xeb549f[_0x4179('0x1e')]?_[_0x4179('0x1d')](_0xeb549f['include'],function(_0x5cb433){return{'model':db[_0x5cb433[_0x4179('0x1f')]],'as':_0x5cb433['as'],'attributes':_0x5cb433[_0x4179('0x1b')],'include':_0x5cb433[_0x4179('0x1e')]?_[_0x4179('0x1d')](_0x5cb433[_0x4179('0x1e')],function(_0x2b681b){return{'model':db[_0x2b681b[_0x4179('0x1f')]],'as':_0x2b681b['as'],'attributes':_0x2b681b[_0x4179('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4179('0xc')](function(_0x4a9f65){logger[_0x4179('0xd')]('GetDynamics365Account',_0x314369);logger[_0x4179('0x20')]('GetDynamics365Account',_0x314369,JSON[_0x4179('0x10')](_0x4a9f65));_0x82b83b(_0x4a9f65);})[_0x4179('0x21')](function(_0x545bc4){logger[_0x4179('0x11')](_0x4179('0x16'),_0x545bc4['message'],_0x314369);_0x45223f(_0x307100[_0x4179('0x11')](0x1f4,_0x545bc4[_0x4179('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x57576a){var _0x28f636=this;return new Promise(function(_0x6ff2,_0x4f9e73){return db[_0x4179('0x22')]['find']({'raw':_0x57576a['options']?_0x57576a['options'][_0x4179('0x19')]===undefined?!![]:![]:!![],'where':_0x57576a['options']?_0x57576a[_0x4179('0x18')][_0x4179('0x1a')]||null:null,'attributes':_0x57576a[_0x4179('0x18')]?_0x57576a['options'][_0x4179('0x1b')]||null:null,'include':_0x57576a[_0x4179('0x18')]?_0x57576a[_0x4179('0x18')][_0x4179('0x1e')]?_['map'](_0x57576a[_0x4179('0x18')][_0x4179('0x1e')],function(_0x554174){return{'model':db[_0x554174['model']],'as':_0x554174['as'],'attributes':_0x554174['attributes'],'include':_0x554174[_0x4179('0x1e')]?_[_0x4179('0x1d')](_0x554174[_0x4179('0x1e')],function(_0x10333d){return{'model':db[_0x10333d['model']],'as':_0x10333d['as'],'attributes':_0x10333d['attributes'],'include':_0x10333d['include']?_[_0x4179('0x1d')](_0x10333d[_0x4179('0x1e')],function(_0x43cc9){return{'model':db[_0x43cc9[_0x4179('0x1f')]],'as':_0x43cc9['as'],'attributes':_0x43cc9[_0x4179('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x72e104){logger[_0x4179('0xd')](_0x4179('0x23'),_0x57576a);logger['debug'](_0x4179('0x23'),_0x57576a,JSON[_0x4179('0x10')](_0x72e104));_0x6ff2(_0x72e104);})[_0x4179('0x21')](function(_0x4a3ce7){logger['error'](_0x4179('0x23'),_0x4a3ce7[_0x4179('0x13')],_0x57576a);_0x4f9e73(_0x28f636[_0x4179('0x11')](0x1f4,_0x4a3ce7[_0x4179('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 17d9d15..c45380a 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 _0x30fc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x20ac35,_0x278bff){var _0x147230=function(_0xe5cc5c){while(--_0xe5cc5c){_0x20ac35['push'](_0x20ac35['shift']());}};_0x147230(++_0x278bff);}(_0x30fc,0x64));var _0xc30f=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x30fc[_0x1ee5be];return _0x177140;};'use strict';var multer=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var path=require('path');var timeout=require(_0xc30f('0x2'));var express=require(_0xc30f('0x3'));var router=express[_0xc30f('0x4')]();var fs_extra=require(_0xc30f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var controller=require(_0xc30f('0x8'));router[_0xc30f('0x9')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0xb')]);router['get'](_0xc30f('0xc'),auth[_0xc30f('0xa')](),controller[_0xc30f('0xd')]);router[_0xc30f('0x9')](_0xc30f('0xe'),auth[_0xc30f('0xa')](),controller[_0xc30f('0xf')]);router[_0xc30f('0x9')](_0xc30f('0x10'),auth['isAuthenticated'](),controller[_0xc30f('0x11')]);router['get'](_0xc30f('0x12'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x13')]);router[_0xc30f('0x14')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0x15')]);router['put']('/:id',auth[_0xc30f('0xa')](),controller[_0xc30f('0x16')]);router[_0xc30f('0x17')](_0xc30f('0xc'),auth['isAuthenticated'](),controller[_0xc30f('0x18')]);module[_0xc30f('0x19')]=router; \ No newline at end of file +var _0x0e5a=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update'];(function(_0x28e8df,_0x31367c){var _0x561dbf=function(_0x2950a7){while(--_0x2950a7){_0x28e8df['push'](_0x28e8df['shift']());}};_0x561dbf(++_0x31367c);}(_0x0e5a,0x70));var _0xa0e5=function(_0x2e85f8,_0x44753c){_0x2e85f8=_0x2e85f8-0x0;var _0xb91c44=_0x0e5a[_0x2e85f8];return _0xb91c44;};'use strict';var multer=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0e5('0x2'));var router=express[_0xa0e5('0x3')]();var fs_extra=require(_0xa0e5('0x4'));var auth=require(_0xa0e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa0e5('0x6'));var controller=require(_0xa0e5('0x7'));router[_0xa0e5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0e5('0x8')](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xb')]);router[_0xa0e5('0x8')](_0xa0e5('0xc'),auth[_0xa0e5('0xa')](),controller[_0xa0e5('0xd')]);router[_0xa0e5('0x8')](_0xa0e5('0xe'),auth['isAuthenticated'](),controller[_0xa0e5('0xf')]);router[_0xa0e5('0x8')](_0xa0e5('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xa0e5('0xa')](),controller[_0xa0e5('0x11')]);router[_0xa0e5('0x12')](_0xa0e5('0x9'),auth['isAuthenticated'](),controller[_0xa0e5('0x13')]);router['delete'](_0xa0e5('0x9'),auth[_0xa0e5('0xa')](),controller[_0xa0e5('0x14')]);module[_0xa0e5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 374c643..95eb175 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 _0x38d0=['phonecall','incident','contact','sequelize','exports','STRING'];(function(_0xdadd1f,_0x4b7d8e){var _0x27fc0a=function(_0x51335f){while(--_0x51335f){_0xdadd1f['push'](_0xdadd1f['shift']());}};_0x27fc0a(++_0x4b7d8e);}(_0x38d0,0x11d));var _0x038d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x38d0[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x038d('0x0'));module[_0x038d('0x1')]={'name':{'type':Sequelize[_0x038d('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0x038d('0x3')),'defaultValue':_0x038d('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x038d('0x5'),'nothing'),'defaultValue':_0x038d('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xeaa8=['phonecall','incident','contact','exports','STRING','ENUM'];(function(_0x1ee04b,_0x554b3d){var _0x412848=function(_0x11917a){while(--_0x11917a){_0x1ee04b['push'](_0x1ee04b['shift']());}};_0x412848(++_0x554b3d);}(_0xeaa8,0xe1));var _0x8eaa=function(_0x54cc5f,_0x4ca651){_0x54cc5f=_0x54cc5f-0x0;var _0x2578de=_0xeaa8[_0x54cc5f];return _0x2578de;};'use strict';var Sequelize=require('sequelize');module[_0x8eaa('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8eaa('0x1')]},'ticketType':{'type':Sequelize[_0x8eaa('0x2')]('incident',_0x8eaa('0x3')),'defaultValue':_0x8eaa('0x4')},'moduleCreate':{'type':Sequelize[_0x8eaa('0x2')](_0x8eaa('0x5'),'nothing'),'defaultValue':_0x8eaa('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8b2915c..7f3a881 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 _0x5da5=['status','end','json','offset','undefined','count','apply','reject','save','then','destroy','stack','name','send','index','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','map','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','getFields','findOne','Dynamics365Field','filter','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x118726,_0xe87a30){var _0x2f1062=function(_0x2910b6){while(--_0x2910b6){_0x118726['push'](_0x118726['shift']());}};_0x2f1062(++_0xe87a30);}(_0x5da5,0xcc));var _0x55da=function(_0x4da1a5,_0x2bedc7){_0x4da1a5=_0x4da1a5-0x0;var _0x3f5a9e=_0x5da5[_0x4da1a5];return _0x3f5a9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55da('0x0'));var zipdir=require(_0x55da('0x1'));var jsonpatch=require(_0x55da('0x2'));var rp=require(_0x55da('0x3'));var moment=require(_0x55da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55da('0x5'));var util=require(_0x55da('0x6'));var path=require('path');var sox=require(_0x55da('0x7'));var csv=require('to-csv');var ejs=require(_0x55da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55da('0x9'));var squel=require('squel');var crypto=require(_0x55da('0xa'));var jsforce=require(_0x55da('0xb'));var deskjs=require(_0x55da('0xc'));var toCsv=require(_0x55da('0xd'));var querystring=require('querystring');var Papa=require(_0x55da('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55da('0xf'));var hardwareService=require(_0x55da('0x10'));var logger=require(_0x55da('0x11'))('api');var utils=require(_0x55da('0x12'));var config=require(_0x55da('0x13'));var licenseUtil=require(_0x55da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50416b,_0x4a0185){_0x4a0185=_0x4a0185||0xcc;return function(_0x4c0691){if(_0x4c0691){return _0x50416b['sendStatus'](_0x4a0185);}return _0x50416b[_0x55da('0x15')](_0x4a0185)[_0x55da('0x16')]();};}function respondWithResult(_0x3cf497,_0x1b8d0f){_0x1b8d0f=_0x1b8d0f||0xc8;return function(_0x17eba5){if(_0x17eba5){return _0x3cf497[_0x55da('0x15')](_0x1b8d0f)[_0x55da('0x17')](_0x17eba5);}};}function respondWithFilteredResult(_0x3a73da,_0x427d8c){return function(_0x438ffc){if(_0x438ffc){var _0x46a4c5=typeof _0x427d8c[_0x55da('0x18')]==='undefined'&&typeof _0x427d8c['limit']===_0x55da('0x19');var _0xd809c6=_0x438ffc['count'];var _0x3ebfb1=_0x46a4c5?0x0:_0x427d8c[_0x55da('0x18')];var _0x3fa6d4=_0x46a4c5?_0x438ffc[_0x55da('0x1a')]:_0x427d8c[_0x55da('0x18')]+_0x427d8c['limit'];var _0xea6d0c;if(_0x3fa6d4>=_0xd809c6){_0x3fa6d4=_0xd809c6;_0xea6d0c=0xc8;}else{_0xea6d0c=0xce;}_0x3a73da[_0x55da('0x15')](_0xea6d0c);return _0x3a73da['set']('Content-Range',_0x3ebfb1+'-'+_0x3fa6d4+'/'+_0xd809c6)[_0x55da('0x17')](_0x438ffc);}return null;};}function patchUpdates(_0x4a40f6){return function(_0x4219cd){try{jsonpatch[_0x55da('0x1b')](_0x4219cd,_0x4a40f6,!![]);}catch(_0x19ba8c){return BPromise[_0x55da('0x1c')](_0x19ba8c);}return _0x4219cd[_0x55da('0x1d')]();};}function saveUpdates(_0x25b951,_0x318f3a){return function(_0x130ced){if(_0x130ced){return _0x130ced['update'](_0x25b951)[_0x55da('0x1e')](function(_0x1647bf){return _0x1647bf;});}return null;};}function removeEntity(_0x2d5489,_0x4485e6){return function(_0x31ec42){if(_0x31ec42){return _0x31ec42[_0x55da('0x1f')]()['then'](function(){_0x2d5489['status'](0xcc)[_0x55da('0x16')]();});}};}function handleEntityNotFound(_0xdd8c6c,_0x350845){return function(_0x59d2f5){if(!_0x59d2f5){_0xdd8c6c['sendStatus'](0x194);}return _0x59d2f5;};}function handleError(_0x732f8a,_0x21c5fc){_0x21c5fc=_0x21c5fc||0x1f4;return function(_0x3eca8b){logger['error'](_0x3eca8b[_0x55da('0x20')]);if(_0x3eca8b[_0x55da('0x21')]){delete _0x3eca8b[_0x55da('0x21')];}_0x732f8a[_0x55da('0x15')](_0x21c5fc)[_0x55da('0x22')](_0x3eca8b);};}exports[_0x55da('0x23')]=function(_0x316b9a,_0x4cbd96){var _0x39bccc={},_0x315fdc={},_0x37b27c={'count':0x0,'rows':[]};var _0x10a04e=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x2f1d53){return{'name':_0x2f1d53[_0x55da('0x24')],'type':_0x2f1d53[_0x55da('0x25')]['key']};});_0x315fdc['model']=_['map'](_0x10a04e,_0x55da('0x21'));_0x315fdc[_0x55da('0x26')]=_[_0x55da('0x27')](_0x316b9a[_0x55da('0x26')]);_0x315fdc[_0x55da('0x28')]=_[_0x55da('0x29')](_0x315fdc['model'],_0x315fdc[_0x55da('0x26')]);_0x39bccc[_0x55da('0x2a')]=_[_0x55da('0x29')](_0x315fdc[_0x55da('0x2b')],qs[_0x55da('0x2c')](_0x316b9a[_0x55da('0x26')]['fields']));_0x39bccc[_0x55da('0x2a')]=_0x39bccc[_0x55da('0x2a')][_0x55da('0x2d')]?_0x39bccc[_0x55da('0x2a')]:_0x315fdc[_0x55da('0x2b')];if(!_0x316b9a[_0x55da('0x26')][_0x55da('0x2e')](_0x55da('0x2f'))){_0x39bccc[_0x55da('0x30')]=qs[_0x55da('0x30')](_0x316b9a[_0x55da('0x26')][_0x55da('0x30')]);_0x39bccc['offset']=qs['offset'](_0x316b9a[_0x55da('0x26')][_0x55da('0x18')]);}_0x39bccc[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x316b9a[_0x55da('0x26')]['sort']);_0x39bccc[_0x55da('0x33')]=qs[_0x55da('0x28')](_['pick'](_0x316b9a['query'],_0x315fdc[_0x55da('0x28')]),_0x10a04e);if(_0x316b9a[_0x55da('0x26')]['filter']){_0x39bccc['where']=_['merge'](_0x39bccc[_0x55da('0x33')],{'$or':_[_0x55da('0x34')](_0x10a04e,function(_0x30b951){if(_0x30b951[_0x55da('0x25')]!==_0x55da('0x35')){var _0x40817f={};_0x40817f[_0x30b951['name']]={'$like':'%'+_0x316b9a['query']['filter']+'%'};return _0x40817f;}})});}_0x39bccc=_[_0x55da('0x36')]({},_0x39bccc,_0x316b9a[_0x55da('0x37')]);var _0x58ff1e={'where':_0x39bccc['where']};return db[_0x55da('0x38')][_0x55da('0x1a')](_0x58ff1e)[_0x55da('0x1e')](function(_0x123675){_0x37b27c[_0x55da('0x1a')]=_0x123675;if(_0x316b9a['query'][_0x55da('0x39')]){_0x39bccc[_0x55da('0x3a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x55da('0x3b')](_0x39bccc);})[_0x55da('0x1e')](function(_0x1d256d){_0x37b27c[_0x55da('0x3c')]=_0x1d256d;return _0x37b27c;})[_0x55da('0x1e')](respondWithFilteredResult(_0x4cbd96,_0x39bccc))[_0x55da('0x3d')](handleError(_0x4cbd96,null));};exports['show']=function(_0x98434e,_0x1758b4){var _0x8e68d5={'raw':![],'where':{'id':_0x98434e['params']['id']}},_0x119936={};_0x119936[_0x55da('0x2b')]=_[_0x55da('0x27')](db['Dynamics365Configuration'][_0x55da('0x3e')]);_0x119936[_0x55da('0x26')]=_[_0x55da('0x27')](_0x98434e[_0x55da('0x26')]);_0x119936['filters']=_[_0x55da('0x29')](_0x119936[_0x55da('0x2b')],_0x119936[_0x55da('0x26')]);_0x8e68d5[_0x55da('0x2a')]=_['intersection'](_0x119936[_0x55da('0x2b')],qs['fields'](_0x98434e[_0x55da('0x26')][_0x55da('0x2c')]));_0x8e68d5[_0x55da('0x2a')]=_0x8e68d5[_0x55da('0x2a')][_0x55da('0x2d')]?_0x8e68d5[_0x55da('0x2a')]:_0x119936['model'];if(_0x98434e[_0x55da('0x26')][_0x55da('0x39')]){_0x8e68d5[_0x55da('0x3a')]=[{'all':!![]}];}_0x8e68d5=_[_0x55da('0x36')]({},_0x8e68d5,_0x98434e[_0x55da('0x37')]);return db[_0x55da('0x38')][_0x55da('0x3f')](_0x8e68d5)[_0x55da('0x1e')](handleEntityNotFound(_0x1758b4,null))[_0x55da('0x1e')](respondWithResult(_0x1758b4,null))[_0x55da('0x3d')](handleError(_0x1758b4,null));};exports[_0x55da('0x40')]=function(_0x2451e4,_0x382932){return db[_0x55da('0x38')][_0x55da('0x40')](_0x2451e4[_0x55da('0x41')],{})[_0x55da('0x1e')](respondWithResult(_0x382932,0xc9))[_0x55da('0x3d')](handleError(_0x382932,null));};exports[_0x55da('0x42')]=function(_0x50405c,_0x452e9f){if(_0x50405c['body']['id']){delete _0x50405c[_0x55da('0x41')]['id'];}return db['Dynamics365Configuration'][_0x55da('0x3f')]({'where':{'id':_0x50405c[_0x55da('0x43')]['id']}})['then'](handleEntityNotFound(_0x452e9f,null))['then'](saveUpdates(_0x50405c[_0x55da('0x41')],null))[_0x55da('0x1e')](respondWithResult(_0x452e9f,null))[_0x55da('0x3d')](handleError(_0x452e9f,null));};exports['destroy']=function(_0x2323a2,_0x2c62c6){return db['Dynamics365Configuration']['find']({'where':{'id':_0x2323a2['params']['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x2c62c6,null))['then'](removeEntity(_0x2c62c6,null))[_0x55da('0x3d')](handleError(_0x2c62c6,null));};exports[_0x55da('0x44')]=function(_0x2b2e81,_0x5e18f8,_0x429b78){var _0x2ab6ee={};var _0x409117={};var _0x3d9667;var _0x28cb51;return db['Dynamics365Configuration'][_0x55da('0x45')]({'where':{'id':_0x2b2e81[_0x55da('0x43')]['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x5e18f8,null))[_0x55da('0x1e')](function(_0xccbef0){if(_0xccbef0){_0x3d9667=_0xccbef0;_0x409117['model']=_[_0x55da('0x27')](db[_0x55da('0x46')][_0x55da('0x3e')]);_0x409117[_0x55da('0x26')]=_['keys'](_0x2b2e81[_0x55da('0x26')]);_0x409117[_0x55da('0x28')]=_[_0x55da('0x29')](_0x409117[_0x55da('0x2b')],_0x409117[_0x55da('0x26')]);_0x2ab6ee['attributes']=_[_0x55da('0x29')](_0x409117[_0x55da('0x2b')],qs['fields'](_0x2b2e81[_0x55da('0x26')]['fields']));_0x2ab6ee['attributes']=_0x2ab6ee['attributes'][_0x55da('0x2d')]?_0x2ab6ee[_0x55da('0x2a')]:_0x409117['model'];_0x2ab6ee['order']=qs[_0x55da('0x32')](_0x2b2e81[_0x55da('0x26')]['sort']);_0x2ab6ee[_0x55da('0x33')]=qs['filters'](_['pick'](_0x2b2e81[_0x55da('0x26')],_0x409117[_0x55da('0x28')]));if(_0x2b2e81[_0x55da('0x26')][_0x55da('0x47')]){_0x2ab6ee['where']=_[_0x55da('0x36')](_0x2ab6ee[_0x55da('0x33')],{'$or':_[_0x55da('0x34')](_0x2ab6ee[_0x55da('0x2a')],function(_0x589602){var _0x5c0f1e={};_0x5c0f1e[_0x589602]={'$like':'%'+_0x2b2e81[_0x55da('0x26')][_0x55da('0x47')]+'%'};return _0x5c0f1e;})});}_0x2ab6ee=_['merge']({},_0x2ab6ee,_0x2b2e81['options']);return _0x3d9667[_0x55da('0x44')](_0x2ab6ee);}})[_0x55da('0x1e')](function(_0x586f2b){if(_0x586f2b){_0x28cb51=_0x586f2b[_0x55da('0x2d')];if(!_0x2b2e81[_0x55da('0x26')][_0x55da('0x2e')](_0x55da('0x2f'))){_0x2ab6ee[_0x55da('0x30')]=qs['limit'](_0x2b2e81[_0x55da('0x26')][_0x55da('0x30')]);_0x2ab6ee['offset']=qs['offset'](_0x2b2e81['query'][_0x55da('0x18')]);}return _0x3d9667[_0x55da('0x44')](_0x2ab6ee);}})[_0x55da('0x1e')](function(_0x208351){if(_0x208351){return _0x208351?{'count':_0x28cb51,'rows':_0x208351}:null;}})[_0x55da('0x1e')](respondWithResult(_0x5e18f8,null))[_0x55da('0x3d')](handleError(_0x5e18f8,null));};exports['getSubjects']=function(_0x345cbf,_0x1cb1a3,_0x2617f3){var _0x42af61={};var _0x122b2a={};var _0x324854;var _0x3d4f1e;return db[_0x55da('0x38')][_0x55da('0x45')]({'where':{'id':_0x345cbf['params']['id']}})['then'](handleEntityNotFound(_0x1cb1a3,null))[_0x55da('0x1e')](function(_0x5a9430){if(_0x5a9430){_0x324854=_0x5a9430;_0x122b2a[_0x55da('0x2b')]=_[_0x55da('0x27')](db[_0x55da('0x46')]['rawAttributes']);_0x122b2a[_0x55da('0x26')]=_[_0x55da('0x27')](_0x345cbf['query']);_0x122b2a[_0x55da('0x28')]=_[_0x55da('0x29')](_0x122b2a['model'],_0x122b2a[_0x55da('0x26')]);_0x42af61['attributes']=_[_0x55da('0x29')](_0x122b2a['model'],qs[_0x55da('0x2c')](_0x345cbf['query'][_0x55da('0x2c')]));_0x42af61[_0x55da('0x2a')]=_0x42af61['attributes'][_0x55da('0x2d')]?_0x42af61[_0x55da('0x2a')]:_0x122b2a['model'];_0x42af61[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x345cbf[_0x55da('0x26')][_0x55da('0x32')]);_0x42af61[_0x55da('0x33')]=qs[_0x55da('0x28')](_['pick'](_0x345cbf['query'],_0x122b2a['filters']));if(_0x345cbf[_0x55da('0x26')][_0x55da('0x47')]){_0x42af61[_0x55da('0x33')]=_[_0x55da('0x36')](_0x42af61['where'],{'$or':_[_0x55da('0x34')](_0x42af61['attributes'],function(_0x49685a){var _0xca728e={};_0xca728e[_0x49685a]={'$like':'%'+_0x345cbf[_0x55da('0x26')][_0x55da('0x47')]+'%'};return _0xca728e;})});}_0x42af61=_[_0x55da('0x36')]({},_0x42af61,_0x345cbf[_0x55da('0x37')]);return _0x324854[_0x55da('0x48')](_0x42af61);}})['then'](function(_0x37ba90){if(_0x37ba90){_0x3d4f1e=_0x37ba90['length'];if(!_0x345cbf[_0x55da('0x26')][_0x55da('0x2e')]('nolimit')){_0x42af61[_0x55da('0x30')]=qs['limit'](_0x345cbf[_0x55da('0x26')][_0x55da('0x30')]);_0x42af61[_0x55da('0x18')]=qs[_0x55da('0x18')](_0x345cbf[_0x55da('0x26')]['offset']);}return _0x324854['getSubjects'](_0x42af61);}})[_0x55da('0x1e')](function(_0x368268){if(_0x368268){return _0x368268?{'count':_0x3d4f1e,'rows':_0x368268}:null;}})['then'](respondWithResult(_0x1cb1a3,null))[_0x55da('0x3d')](handleError(_0x1cb1a3,null));};exports['getDescriptions']=function(_0x22d798,_0x4fb23c,_0x4b8f1f){var _0x446a99={};var _0x91b02={};var _0x5cea75;var _0x5b7f59;return db[_0x55da('0x38')][_0x55da('0x45')]({'where':{'id':_0x22d798[_0x55da('0x43')]['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x4fb23c,null))[_0x55da('0x1e')](function(_0x2f1f7f){if(_0x2f1f7f){_0x5cea75=_0x2f1f7f;_0x91b02[_0x55da('0x2b')]=_['keys'](db[_0x55da('0x46')][_0x55da('0x3e')]);_0x91b02[_0x55da('0x26')]=_[_0x55da('0x27')](_0x22d798[_0x55da('0x26')]);_0x91b02[_0x55da('0x28')]=_[_0x55da('0x29')](_0x91b02['model'],_0x91b02[_0x55da('0x26')]);_0x446a99[_0x55da('0x2a')]=_[_0x55da('0x29')](_0x91b02['model'],qs[_0x55da('0x2c')](_0x22d798[_0x55da('0x26')][_0x55da('0x2c')]));_0x446a99['attributes']=_0x446a99[_0x55da('0x2a')]['length']?_0x446a99[_0x55da('0x2a')]:_0x91b02[_0x55da('0x2b')];_0x446a99[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x22d798[_0x55da('0x26')][_0x55da('0x32')]);_0x446a99['where']=qs[_0x55da('0x28')](_[_0x55da('0x49')](_0x22d798[_0x55da('0x26')],_0x91b02[_0x55da('0x28')]));if(_0x22d798['query'][_0x55da('0x47')]){_0x446a99[_0x55da('0x33')]=_[_0x55da('0x36')](_0x446a99['where'],{'$or':_[_0x55da('0x34')](_0x446a99['attributes'],function(_0x670b34){var _0x1be76b={};_0x1be76b[_0x670b34]={'$like':'%'+_0x22d798['query']['filter']+'%'};return _0x1be76b;})});}_0x446a99=_['merge']({},_0x446a99,_0x22d798['options']);return _0x5cea75[_0x55da('0x4a')](_0x446a99);}})[_0x55da('0x1e')](function(_0x5c3cc3){if(_0x5c3cc3){_0x5b7f59=_0x5c3cc3['length'];if(!_0x22d798['query']['hasOwnProperty'](_0x55da('0x2f'))){_0x446a99[_0x55da('0x30')]=qs[_0x55da('0x30')](_0x22d798[_0x55da('0x26')][_0x55da('0x30')]);_0x446a99[_0x55da('0x18')]=qs[_0x55da('0x18')](_0x22d798['query'][_0x55da('0x18')]);}return _0x5cea75['getDescriptions'](_0x446a99);}})[_0x55da('0x1e')](function(_0x457f1b){if(_0x457f1b){return _0x457f1b?{'count':_0x5b7f59,'rows':_0x457f1b}:null;}})[_0x55da('0x1e')](respondWithResult(_0x4fb23c,null))[_0x55da('0x3d')](handleError(_0x4fb23c,null));}; \ No newline at end of file +var _0xd4b3=['getFields','Dynamics365Field','order','sort','getSubjects','findOne','getDescriptions','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body'];(function(_0x27d771,_0x1a50b2){var _0x2ba087=function(_0x1fcfa4){while(--_0x1fcfa4){_0x27d771['push'](_0x27d771['shift']());}};_0x2ba087(++_0x1a50b2);}(_0xd4b3,0x163));var _0x3d4b=function(_0x2ad873,_0x2ec8e8){_0x2ad873=_0x2ad873-0x0;var _0x1e218f=_0xd4b3[_0x2ad873];return _0x1e218f;};'use strict';var emlformat=require(_0x3d4b('0x0'));var rimraf=require(_0x3d4b('0x1'));var zipdir=require(_0x3d4b('0x2'));var jsonpatch=require(_0x3d4b('0x3'));var rp=require(_0x3d4b('0x4'));var moment=require(_0x3d4b('0x5'));var BPromise=require(_0x3d4b('0x6'));var Mustache=require(_0x3d4b('0x7'));var util=require(_0x3d4b('0x8'));var path=require(_0x3d4b('0x9'));var sox=require(_0x3d4b('0xa'));var csv=require(_0x3d4b('0xb'));var ejs=require(_0x3d4b('0xc'));var fs=require('fs');var fs_extra=require(_0x3d4b('0xd'));var _=require(_0x3d4b('0xe'));var squel=require(_0x3d4b('0xf'));var crypto=require(_0x3d4b('0x10'));var jsforce=require(_0x3d4b('0x11'));var deskjs=require(_0x3d4b('0x12'));var toCsv=require(_0x3d4b('0xb'));var querystring=require(_0x3d4b('0x13'));var Papa=require(_0x3d4b('0x14'));var Redis=require('ioredis');var authService=require(_0x3d4b('0x15'));var qs=require(_0x3d4b('0x16'));var as=require(_0x3d4b('0x17'));var hardwareService=require(_0x3d4b('0x18'));var logger=require('../../config/logger')(_0x3d4b('0x19'));var utils=require(_0x3d4b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x3d4b('0x1b'));var db=require(_0x3d4b('0x1c'))['db'];function respondWithStatusCode(_0x12301a,_0x1d04d1){_0x1d04d1=_0x1d04d1||0xcc;return function(_0x37c55d){if(_0x37c55d){return _0x12301a['sendStatus'](_0x1d04d1);}return _0x12301a[_0x3d4b('0x1d')](_0x1d04d1)[_0x3d4b('0x1e')]();};}function respondWithResult(_0x489fe9,_0x2f9529){_0x2f9529=_0x2f9529||0xc8;return function(_0x225393){if(_0x225393){return _0x489fe9[_0x3d4b('0x1d')](_0x2f9529)[_0x3d4b('0x1f')](_0x225393);}};}function respondWithFilteredResult(_0x17bc29,_0x1cc872){return function(_0x508db6){if(_0x508db6){var _0x33ba8c=typeof _0x1cc872[_0x3d4b('0x20')]===_0x3d4b('0x21')&&typeof _0x1cc872[_0x3d4b('0x22')]===_0x3d4b('0x21');var _0x746391=_0x508db6['count'];var _0x56454a=_0x33ba8c?0x0:_0x1cc872['offset'];var _0x505b96=_0x33ba8c?_0x508db6['count']:_0x1cc872[_0x3d4b('0x20')]+_0x1cc872[_0x3d4b('0x22')];var _0x16ee8f;if(_0x505b96>=_0x746391){_0x505b96=_0x746391;_0x16ee8f=0xc8;}else{_0x16ee8f=0xce;}_0x17bc29['status'](_0x16ee8f);return _0x17bc29[_0x3d4b('0x23')](_0x3d4b('0x24'),_0x56454a+'-'+_0x505b96+'/'+_0x746391)[_0x3d4b('0x1f')](_0x508db6);}return null;};}function patchUpdates(_0x12104d){return function(_0x47f707){try{jsonpatch[_0x3d4b('0x25')](_0x47f707,_0x12104d,!![]);}catch(_0xcde918){return BPromise[_0x3d4b('0x26')](_0xcde918);}return _0x47f707['save']();};}function saveUpdates(_0x445ea0,_0x449205){return function(_0x3f1019){if(_0x3f1019){return _0x3f1019['update'](_0x445ea0)[_0x3d4b('0x27')](function(_0x4774e4){return _0x4774e4;});}return null;};}function removeEntity(_0x49133f,_0x3597fc){return function(_0x31fe71){if(_0x31fe71){return _0x31fe71[_0x3d4b('0x28')]()[_0x3d4b('0x27')](function(){_0x49133f[_0x3d4b('0x1d')](0xcc)[_0x3d4b('0x1e')]();});}};}function handleEntityNotFound(_0x780dd7,_0x1a6021){return function(_0xa56a09){if(!_0xa56a09){_0x780dd7[_0x3d4b('0x29')](0x194);}return _0xa56a09;};}function handleError(_0x46270b,_0x40b57e){_0x40b57e=_0x40b57e||0x1f4;return function(_0x310cea){logger[_0x3d4b('0x2a')](_0x310cea[_0x3d4b('0x2b')]);if(_0x310cea['name']){delete _0x310cea['name'];}_0x46270b['status'](_0x40b57e)[_0x3d4b('0x2c')](_0x310cea);};}exports[_0x3d4b('0x2d')]=function(_0x2e6e6c,_0xadd959){var _0x4b9ab2={},_0x425b76={},_0x35878e={'count':0x0,'rows':[]};var _0x187ae3=_[_0x3d4b('0x2e')](db[_0x3d4b('0x2f')][_0x3d4b('0x30')],function(_0x5710b7){return{'name':_0x5710b7[_0x3d4b('0x31')],'type':_0x5710b7[_0x3d4b('0x32')][_0x3d4b('0x33')]};});_0x425b76['model']=_[_0x3d4b('0x2e')](_0x187ae3,_0x3d4b('0x34'));_0x425b76[_0x3d4b('0x35')]=_[_0x3d4b('0x36')](_0x2e6e6c[_0x3d4b('0x35')]);_0x425b76[_0x3d4b('0x37')]=_[_0x3d4b('0x38')](_0x425b76['model'],_0x425b76[_0x3d4b('0x35')]);_0x4b9ab2[_0x3d4b('0x39')]=_[_0x3d4b('0x38')](_0x425b76[_0x3d4b('0x3a')],qs[_0x3d4b('0x3b')](_0x2e6e6c[_0x3d4b('0x35')]['fields']));_0x4b9ab2[_0x3d4b('0x39')]=_0x4b9ab2['attributes']['length']?_0x4b9ab2[_0x3d4b('0x39')]:_0x425b76[_0x3d4b('0x3a')];if(!_0x2e6e6c[_0x3d4b('0x35')][_0x3d4b('0x3c')](_0x3d4b('0x3d'))){_0x4b9ab2[_0x3d4b('0x22')]=qs[_0x3d4b('0x22')](_0x2e6e6c[_0x3d4b('0x35')][_0x3d4b('0x22')]);_0x4b9ab2[_0x3d4b('0x20')]=qs[_0x3d4b('0x20')](_0x2e6e6c[_0x3d4b('0x35')][_0x3d4b('0x20')]);}_0x4b9ab2['order']=qs['sort'](_0x2e6e6c[_0x3d4b('0x35')]['sort']);_0x4b9ab2[_0x3d4b('0x3e')]=qs['filters'](_[_0x3d4b('0x3f')](_0x2e6e6c[_0x3d4b('0x35')],_0x425b76[_0x3d4b('0x37')]),_0x187ae3);if(_0x2e6e6c[_0x3d4b('0x35')][_0x3d4b('0x40')]){_0x4b9ab2[_0x3d4b('0x3e')]=_['merge'](_0x4b9ab2['where'],{'$or':_[_0x3d4b('0x2e')](_0x187ae3,function(_0x2122ac){if(_0x2122ac[_0x3d4b('0x32')]!==_0x3d4b('0x41')){var _0x5b1265={};_0x5b1265[_0x2122ac[_0x3d4b('0x34')]]={'$like':'%'+_0x2e6e6c[_0x3d4b('0x35')]['filter']+'%'};return _0x5b1265;}})});}_0x4b9ab2=_[_0x3d4b('0x42')]({},_0x4b9ab2,_0x2e6e6c['options']);var _0x1e40f3={'where':_0x4b9ab2[_0x3d4b('0x3e')]};return db[_0x3d4b('0x2f')]['count'](_0x1e40f3)[_0x3d4b('0x27')](function(_0x51d29d){_0x35878e[_0x3d4b('0x43')]=_0x51d29d;if(_0x2e6e6c[_0x3d4b('0x35')][_0x3d4b('0x44')]){_0x4b9ab2[_0x3d4b('0x45')]=[{'all':!![]}];}return db[_0x3d4b('0x2f')][_0x3d4b('0x46')](_0x4b9ab2);})[_0x3d4b('0x27')](function(_0x4b9273){_0x35878e[_0x3d4b('0x47')]=_0x4b9273;return _0x35878e;})['then'](respondWithFilteredResult(_0xadd959,_0x4b9ab2))[_0x3d4b('0x48')](handleError(_0xadd959,null));};exports[_0x3d4b('0x49')]=function(_0x41d529,_0x42d8e8){var _0x282f8c={'raw':![],'where':{'id':_0x41d529[_0x3d4b('0x4a')]['id']}},_0x47a10d={};_0x47a10d[_0x3d4b('0x3a')]=_[_0x3d4b('0x36')](db[_0x3d4b('0x2f')][_0x3d4b('0x30')]);_0x47a10d[_0x3d4b('0x35')]=_[_0x3d4b('0x36')](_0x41d529[_0x3d4b('0x35')]);_0x47a10d['filters']=_[_0x3d4b('0x38')](_0x47a10d[_0x3d4b('0x3a')],_0x47a10d[_0x3d4b('0x35')]);_0x282f8c[_0x3d4b('0x39')]=_['intersection'](_0x47a10d[_0x3d4b('0x3a')],qs['fields'](_0x41d529['query'][_0x3d4b('0x3b')]));_0x282f8c[_0x3d4b('0x39')]=_0x282f8c[_0x3d4b('0x39')][_0x3d4b('0x4b')]?_0x282f8c[_0x3d4b('0x39')]:_0x47a10d[_0x3d4b('0x3a')];if(_0x41d529[_0x3d4b('0x35')]['includeAll']){_0x282f8c[_0x3d4b('0x45')]=[{'all':!![]}];}_0x282f8c=_['merge']({},_0x282f8c,_0x41d529[_0x3d4b('0x4c')]);return db[_0x3d4b('0x2f')][_0x3d4b('0x4d')](_0x282f8c)[_0x3d4b('0x27')](handleEntityNotFound(_0x42d8e8,null))[_0x3d4b('0x27')](respondWithResult(_0x42d8e8,null))['catch'](handleError(_0x42d8e8,null));};exports[_0x3d4b('0x4e')]=function(_0x409acd,_0x298842){return db[_0x3d4b('0x2f')][_0x3d4b('0x4e')](_0x409acd[_0x3d4b('0x4f')],{})['then'](respondWithResult(_0x298842,0xc9))['catch'](handleError(_0x298842,null));};exports['update']=function(_0x19c1f0,_0x98bc96){if(_0x19c1f0[_0x3d4b('0x4f')]['id']){delete _0x19c1f0[_0x3d4b('0x4f')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x19c1f0[_0x3d4b('0x4a')]['id']}})[_0x3d4b('0x27')](handleEntityNotFound(_0x98bc96,null))[_0x3d4b('0x27')](saveUpdates(_0x19c1f0['body'],null))[_0x3d4b('0x27')](respondWithResult(_0x98bc96,null))[_0x3d4b('0x48')](handleError(_0x98bc96,null));};exports[_0x3d4b('0x28')]=function(_0x277fe1,_0x3a93a2){return db[_0x3d4b('0x2f')][_0x3d4b('0x4d')]({'where':{'id':_0x277fe1[_0x3d4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a93a2,null))[_0x3d4b('0x27')](removeEntity(_0x3a93a2,null))['catch'](handleError(_0x3a93a2,null));};exports[_0x3d4b('0x50')]=function(_0x32e46b,_0x603995,_0x482e27){var _0x455a34={};var _0x198509={};var _0x41e2b6;var _0x282c50;return db[_0x3d4b('0x2f')]['findOne']({'where':{'id':_0x32e46b[_0x3d4b('0x4a')]['id']}})[_0x3d4b('0x27')](handleEntityNotFound(_0x603995,null))[_0x3d4b('0x27')](function(_0x267150){if(_0x267150){_0x41e2b6=_0x267150;_0x198509[_0x3d4b('0x3a')]=_[_0x3d4b('0x36')](db[_0x3d4b('0x51')]['rawAttributes']);_0x198509[_0x3d4b('0x35')]=_[_0x3d4b('0x36')](_0x32e46b['query']);_0x198509[_0x3d4b('0x37')]=_[_0x3d4b('0x38')](_0x198509['model'],_0x198509[_0x3d4b('0x35')]);_0x455a34['attributes']=_[_0x3d4b('0x38')](_0x198509[_0x3d4b('0x3a')],qs[_0x3d4b('0x3b')](_0x32e46b[_0x3d4b('0x35')][_0x3d4b('0x3b')]));_0x455a34[_0x3d4b('0x39')]=_0x455a34[_0x3d4b('0x39')][_0x3d4b('0x4b')]?_0x455a34[_0x3d4b('0x39')]:_0x198509[_0x3d4b('0x3a')];_0x455a34[_0x3d4b('0x52')]=qs[_0x3d4b('0x53')](_0x32e46b[_0x3d4b('0x35')]['sort']);_0x455a34[_0x3d4b('0x3e')]=qs[_0x3d4b('0x37')](_['pick'](_0x32e46b[_0x3d4b('0x35')],_0x198509[_0x3d4b('0x37')]));if(_0x32e46b[_0x3d4b('0x35')][_0x3d4b('0x40')]){_0x455a34[_0x3d4b('0x3e')]=_[_0x3d4b('0x42')](_0x455a34[_0x3d4b('0x3e')],{'$or':_['map'](_0x455a34[_0x3d4b('0x39')],function(_0x3649af){var _0x33b34f={};_0x33b34f[_0x3649af]={'$like':'%'+_0x32e46b['query'][_0x3d4b('0x40')]+'%'};return _0x33b34f;})});}_0x455a34=_['merge']({},_0x455a34,_0x32e46b[_0x3d4b('0x4c')]);return _0x41e2b6[_0x3d4b('0x50')](_0x455a34);}})[_0x3d4b('0x27')](function(_0x142586){if(_0x142586){_0x282c50=_0x142586[_0x3d4b('0x4b')];if(!_0x32e46b['query']['hasOwnProperty'](_0x3d4b('0x3d'))){_0x455a34['limit']=qs[_0x3d4b('0x22')](_0x32e46b[_0x3d4b('0x35')][_0x3d4b('0x22')]);_0x455a34[_0x3d4b('0x20')]=qs[_0x3d4b('0x20')](_0x32e46b[_0x3d4b('0x35')][_0x3d4b('0x20')]);}return _0x41e2b6[_0x3d4b('0x50')](_0x455a34);}})[_0x3d4b('0x27')](function(_0x47f81){if(_0x47f81){return _0x47f81?{'count':_0x282c50,'rows':_0x47f81}:null;}})[_0x3d4b('0x27')](respondWithResult(_0x603995,null))[_0x3d4b('0x48')](handleError(_0x603995,null));};exports[_0x3d4b('0x54')]=function(_0x52b639,_0x4b559a,_0x46ba6d){var _0x116adb={};var _0x19ad3e={};var _0x1d212f;var _0x2c1f00;return db[_0x3d4b('0x2f')][_0x3d4b('0x55')]({'where':{'id':_0x52b639[_0x3d4b('0x4a')]['id']}})[_0x3d4b('0x27')](handleEntityNotFound(_0x4b559a,null))[_0x3d4b('0x27')](function(_0x2c9a7f){if(_0x2c9a7f){_0x1d212f=_0x2c9a7f;_0x19ad3e[_0x3d4b('0x3a')]=_[_0x3d4b('0x36')](db[_0x3d4b('0x51')][_0x3d4b('0x30')]);_0x19ad3e[_0x3d4b('0x35')]=_[_0x3d4b('0x36')](_0x52b639[_0x3d4b('0x35')]);_0x19ad3e['filters']=_[_0x3d4b('0x38')](_0x19ad3e[_0x3d4b('0x3a')],_0x19ad3e['query']);_0x116adb[_0x3d4b('0x39')]=_[_0x3d4b('0x38')](_0x19ad3e['model'],qs[_0x3d4b('0x3b')](_0x52b639[_0x3d4b('0x35')][_0x3d4b('0x3b')]));_0x116adb[_0x3d4b('0x39')]=_0x116adb[_0x3d4b('0x39')]['length']?_0x116adb[_0x3d4b('0x39')]:_0x19ad3e[_0x3d4b('0x3a')];_0x116adb[_0x3d4b('0x52')]=qs[_0x3d4b('0x53')](_0x52b639['query'][_0x3d4b('0x53')]);_0x116adb[_0x3d4b('0x3e')]=qs[_0x3d4b('0x37')](_[_0x3d4b('0x3f')](_0x52b639[_0x3d4b('0x35')],_0x19ad3e['filters']));if(_0x52b639[_0x3d4b('0x35')][_0x3d4b('0x40')]){_0x116adb['where']=_[_0x3d4b('0x42')](_0x116adb['where'],{'$or':_['map'](_0x116adb[_0x3d4b('0x39')],function(_0x545c6a){var _0x138575={};_0x138575[_0x545c6a]={'$like':'%'+_0x52b639['query'][_0x3d4b('0x40')]+'%'};return _0x138575;})});}_0x116adb=_[_0x3d4b('0x42')]({},_0x116adb,_0x52b639['options']);return _0x1d212f['getSubjects'](_0x116adb);}})[_0x3d4b('0x27')](function(_0x2a46e8){if(_0x2a46e8){_0x2c1f00=_0x2a46e8[_0x3d4b('0x4b')];if(!_0x52b639['query'][_0x3d4b('0x3c')](_0x3d4b('0x3d'))){_0x116adb['limit']=qs[_0x3d4b('0x22')](_0x52b639[_0x3d4b('0x35')][_0x3d4b('0x22')]);_0x116adb[_0x3d4b('0x20')]=qs['offset'](_0x52b639[_0x3d4b('0x35')][_0x3d4b('0x20')]);}return _0x1d212f[_0x3d4b('0x54')](_0x116adb);}})[_0x3d4b('0x27')](function(_0x4e389a){if(_0x4e389a){return _0x4e389a?{'count':_0x2c1f00,'rows':_0x4e389a}:null;}})[_0x3d4b('0x27')](respondWithResult(_0x4b559a,null))[_0x3d4b('0x48')](handleError(_0x4b559a,null));};exports[_0x3d4b('0x56')]=function(_0x39a121,_0xa2fb20,_0x27fd6b){var _0x41b6fb={};var _0x57f883={};var _0x35a8f5;var _0x379c90;return db[_0x3d4b('0x2f')][_0x3d4b('0x55')]({'where':{'id':_0x39a121['params']['id']}})[_0x3d4b('0x27')](handleEntityNotFound(_0xa2fb20,null))[_0x3d4b('0x27')](function(_0x532b34){if(_0x532b34){_0x35a8f5=_0x532b34;_0x57f883[_0x3d4b('0x3a')]=_[_0x3d4b('0x36')](db[_0x3d4b('0x51')][_0x3d4b('0x30')]);_0x57f883[_0x3d4b('0x35')]=_[_0x3d4b('0x36')](_0x39a121[_0x3d4b('0x35')]);_0x57f883['filters']=_['intersection'](_0x57f883['model'],_0x57f883[_0x3d4b('0x35')]);_0x41b6fb[_0x3d4b('0x39')]=_[_0x3d4b('0x38')](_0x57f883[_0x3d4b('0x3a')],qs['fields'](_0x39a121[_0x3d4b('0x35')][_0x3d4b('0x3b')]));_0x41b6fb[_0x3d4b('0x39')]=_0x41b6fb[_0x3d4b('0x39')][_0x3d4b('0x4b')]?_0x41b6fb[_0x3d4b('0x39')]:_0x57f883[_0x3d4b('0x3a')];_0x41b6fb[_0x3d4b('0x52')]=qs[_0x3d4b('0x53')](_0x39a121['query']['sort']);_0x41b6fb[_0x3d4b('0x3e')]=qs[_0x3d4b('0x37')](_[_0x3d4b('0x3f')](_0x39a121[_0x3d4b('0x35')],_0x57f883[_0x3d4b('0x37')]));if(_0x39a121[_0x3d4b('0x35')]['filter']){_0x41b6fb[_0x3d4b('0x3e')]=_['merge'](_0x41b6fb[_0x3d4b('0x3e')],{'$or':_['map'](_0x41b6fb[_0x3d4b('0x39')],function(_0xa06b4b){var _0x2d808a={};_0x2d808a[_0xa06b4b]={'$like':'%'+_0x39a121[_0x3d4b('0x35')][_0x3d4b('0x40')]+'%'};return _0x2d808a;})});}_0x41b6fb=_['merge']({},_0x41b6fb,_0x39a121['options']);return _0x35a8f5[_0x3d4b('0x56')](_0x41b6fb);}})[_0x3d4b('0x27')](function(_0xde90e8){if(_0xde90e8){_0x379c90=_0xde90e8[_0x3d4b('0x4b')];if(!_0x39a121[_0x3d4b('0x35')][_0x3d4b('0x3c')](_0x3d4b('0x3d'))){_0x41b6fb[_0x3d4b('0x22')]=qs['limit'](_0x39a121['query'][_0x3d4b('0x22')]);_0x41b6fb['offset']=qs['offset'](_0x39a121[_0x3d4b('0x35')][_0x3d4b('0x20')]);}return _0x35a8f5[_0x3d4b('0x56')](_0x41b6fb);}})[_0x3d4b('0x27')](function(_0xe31ec8){if(_0xe31ec8){return _0xe31ec8?{'count':_0x379c90,'rows':_0xe31ec8}:null;}})[_0x3d4b('0x27')](respondWithResult(_0xa2fb20,null))[_0x3d4b('0x48')](handleError(_0xa2fb20,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 427fddc..5914461 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x18737e,_0x35f807){var _0x519414=function(_0x2d32a2){while(--_0x2d32a2){_0x18737e['push'](_0x18737e['shift']());}};_0x519414(++_0x35f807);}(_0x9f62,0x154));var _0x29f6=function(_0x53b65a,_0x583d3d){_0x53b65a=_0x53b65a-0x0;var _0x4aee4c=_0x9f62[_0x53b65a];return _0x4aee4c;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x2cf676,_0x528711){var _0x55ba=function(_0x22e9a9){while(--_0x22e9a9){_0x2cf676['push'](_0x2cf676['shift']());}};_0x55ba(++_0x528711);}(_0x34e8,0x12c));var _0x834e=function(_0x170332,_0x571e7c){_0x170332=_0x170332-0x0;var _0xa14191=_0x34e8[_0x170332];return _0xa14191;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 927c16a..f4e9652 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 _0xebc0=['../../config/environment','http','request','then','info','debug','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xebc0,0x150));var _0x0ebc=function(_0x1ed164,_0x3080f7){_0x1ed164=_0x1ed164-0x0;var _0x263181=_0xebc0[_0x1ed164];return _0x263181;};'use strict';var _=require(_0x0ebc('0x0'));var util=require(_0x0ebc('0x1'));var moment=require(_0x0ebc('0x2'));var BPromise=require(_0x0ebc('0x3'));var rs=require(_0x0ebc('0x4'));var fs=require('fs');var Redis=require(_0x0ebc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ebc('0x6'));var logger=require(_0x0ebc('0x7'))(_0x0ebc('0x8'));var config=require(_0x0ebc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ebc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b3591,_0x5e746c,_0x29859a){return new BPromise(function(_0x5a8adb,_0x4dd04b){return client[_0x0ebc('0xb')](_0x4b3591,_0x29859a)[_0x0ebc('0xc')](function(_0x127cae){logger[_0x0ebc('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5e746c,'request\x20sent');logger[_0x0ebc('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5e746c,_0x0ebc('0xf'),JSON[_0x0ebc('0x10')](_0x127cae));if(_0x127cae[_0x0ebc('0x11')]){if(_0x127cae['error'][_0x0ebc('0x12')]===0x1f4){logger['error'](_0x0ebc('0x13'),_0x5e746c,_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);return _0x4dd04b(_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);}logger[_0x0ebc('0x11')](_0x0ebc('0x13'),_0x5e746c,_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);return _0x5a8adb(_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);}else{logger['info'](_0x0ebc('0x13'),_0x5e746c,_0x0ebc('0xf'));_0x5a8adb(_0x127cae[_0x0ebc('0x15')][_0x0ebc('0x14')]);}})[_0x0ebc('0x16')](function(_0x18e8ce){logger[_0x0ebc('0x11')](_0x0ebc('0x13'),_0x5e746c,_0x18e8ce);_0x4dd04b(_0x18e8ce);});});} \ No newline at end of file +var _0xdb0e=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdb0e,0xa6));var _0xedb0=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xdb0e[_0x516927];return _0x30749b;};'use strict';var _=require(_0xedb0('0x0'));var util=require(_0xedb0('0x1'));var moment=require(_0xedb0('0x2'));var BPromise=require(_0xedb0('0x3'));var rs=require(_0xedb0('0x4'));var fs=require('fs');var Redis=require(_0xedb0('0x5'));var db=require(_0xedb0('0x6'))['db'];var utils=require(_0xedb0('0x7'));var logger=require(_0xedb0('0x8'))('rpc');var config=require(_0xedb0('0x9'));var jayson=require(_0xedb0('0xa'));var client=jayson['client'][_0xedb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412cec,_0xf1161,_0x172262){return new BPromise(function(_0x5c6389,_0x4b9caa){return client[_0xedb0('0xc')](_0x412cec,_0x172262)[_0xedb0('0xd')](function(_0x45e020){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0xf1161,_0xedb0('0xe'));logger[_0xedb0('0xf')](_0xedb0('0x10'),_0xf1161,_0xedb0('0xe'),JSON[_0xedb0('0x11')](_0x45e020));if(_0x45e020[_0xedb0('0x12')]){if(_0x45e020[_0xedb0('0x12')][_0xedb0('0x13')]===0x1f4){logger['error'](_0xedb0('0x14'),_0xf1161,_0x45e020[_0xedb0('0x12')]['message']);return _0x4b9caa(_0x45e020['error'][_0xedb0('0x15')]);}logger[_0xedb0('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0xf1161,_0x45e020[_0xedb0('0x12')]['message']);return _0x5c6389(_0x45e020['error']['message']);}else{logger['info'](_0xedb0('0x14'),_0xf1161,_0xedb0('0xe'));_0x5c6389(_0x45e020['result'][_0xedb0('0x15')]);}})[_0xedb0('0x16')](function(_0x53097d){logger[_0xedb0('0x12')](_0xedb0('0x14'),_0xf1161,_0x53097d);_0x4b9caa(_0x53097d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9450295..1009a8a 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 _0x69df=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0xbb711,_0x307980){var _0x50ce1b=function(_0x3cc732){while(--_0x3cc732){_0xbb711['push'](_0xbb711['shift']());}};_0x50ce1b(++_0x307980);}(_0x69df,0x76));var _0xf69d=function(_0xead859,_0x3682ba){_0xead859=_0xead859-0x0;var _0x5ae5bb=_0x69df[_0xead859];return _0x5ae5bb;};'use strict';var multer=require(_0xf69d('0x0'));var util=require(_0xf69d('0x1'));var path=require(_0xf69d('0x2'));var timeout=require(_0xf69d('0x3'));var express=require(_0xf69d('0x4'));var router=express[_0xf69d('0x5')]();var fs_extra=require(_0xf69d('0x6'));var auth=require(_0xf69d('0x7'));var interaction=require(_0xf69d('0x8'));var config=require(_0xf69d('0x9'));var controller=require('./intDynamics365Field.controller');router[_0xf69d('0xa')]('/',auth[_0xf69d('0xb')](),controller[_0xf69d('0xc')]);router[_0xf69d('0xa')](_0xf69d('0xd'),auth[_0xf69d('0xb')](),controller[_0xf69d('0xe')]);router[_0xf69d('0xf')]('/',auth[_0xf69d('0xb')](),controller[_0xf69d('0x10')]);router[_0xf69d('0x11')]('/:id',auth[_0xf69d('0xb')](),controller[_0xf69d('0x12')]);router['delete'](_0xf69d('0xd'),auth[_0xf69d('0xb')](),controller['destroy']);module[_0xf69d('0x13')]=router; \ No newline at end of file +var _0xf746=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete'];(function(_0x50cea6,_0x5e4421){var _0x46d5c9=function(_0x23b449){while(--_0x23b449){_0x50cea6['push'](_0x50cea6['shift']());}};_0x46d5c9(++_0x5e4421);}(_0xf746,0x1b6));var _0x6f74=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xf746[_0x34021d];return _0x16597b;};'use strict';var multer=require(_0x6f74('0x0'));var util=require(_0x6f74('0x1'));var path=require(_0x6f74('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f74('0x3'));var router=express[_0x6f74('0x4')]();var fs_extra=require(_0x6f74('0x5'));var auth=require(_0x6f74('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f74('0x7'));var controller=require(_0x6f74('0x8'));router[_0x6f74('0x9')]('/',auth[_0x6f74('0xa')](),controller['index']);router['get']('/:id',auth[_0x6f74('0xa')](),controller[_0x6f74('0xb')]);router[_0x6f74('0xc')]('/',auth[_0x6f74('0xa')](),controller[_0x6f74('0xd')]);router[_0x6f74('0xe')](_0x6f74('0xf'),auth[_0x6f74('0xa')](),controller[_0x6f74('0x10')]);router[_0x6f74('0x11')](_0x6f74('0xf'),auth[_0x6f74('0xa')](),controller[_0x6f74('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 446f6c2..14a838a 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 _0xd0c0=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x5e02f9,_0x2f90d7){var _0x363710=function(_0x290742){while(--_0x290742){_0x5e02f9['push'](_0x5e02f9['shift']());}};_0x363710(++_0x2f90d7);}(_0xd0c0,0x12f));var _0x0d0c=function(_0x2aaa68,_0x158cf3){_0x2aaa68=_0x2aaa68-0x0;var _0x27c3a9=_0xd0c0[_0x2aaa68];return _0x27c3a9;};'use strict';var Sequelize=require(_0x0d0c('0x0'));module['exports']={'type':{'type':Sequelize[_0x0d0c('0x1')](_0x0d0c('0x2'),'variable',_0x0d0c('0x3'),_0x0d0c('0x4'),_0x0d0c('0x5')),'defaultValue':_0x0d0c('0x2')},'content':{'type':Sequelize[_0x0d0c('0x6')]},'key':{'type':Sequelize[_0x0d0c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0d0c('0x2'),_0x0d0c('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x0d0c('0x6')]},'idField':{'type':Sequelize[_0x0d0c('0x6')]},'nameField':{'type':Sequelize[_0x0d0c('0x6')]},'customField':{'type':Sequelize[_0x0d0c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d0c('0x6')]}}; \ No newline at end of file +var _0xeb1d=['keyValue','picklist','ENUM','variable','STRING','exports','string','customVariable'];(function(_0x5e2be0,_0x51090e){var _0x23d711=function(_0x397316){while(--_0x397316){_0x5e2be0['push'](_0x5e2be0['shift']());}};_0x23d711(++_0x51090e);}(_0xeb1d,0x16d));var _0xdeb1=function(_0x27834e,_0x5146c3){_0x27834e=_0x27834e-0x0;var _0x45943b=_0xeb1d[_0x27834e];return _0x45943b;};'use strict';var Sequelize=require('sequelize');module[_0xdeb1('0x0')]={'type':{'type':Sequelize['ENUM'](_0xdeb1('0x1'),'variable',_0xdeb1('0x2'),_0xdeb1('0x3'),_0xdeb1('0x4')),'defaultValue':_0xdeb1('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdeb1('0x5')](_0xdeb1('0x1'),_0xdeb1('0x6'),_0xdeb1('0x2'))},'keyContent':{'type':Sequelize[_0xdeb1('0x7')]},'idField':{'type':Sequelize[_0xdeb1('0x7')]},'nameField':{'type':Sequelize[_0xdeb1('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdeb1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 4314702..de81a4c 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 _0xff67=['mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','Dynamics365Field','include','findAll','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','request-promise','moment'];(function(_0x5c3fc7,_0x11f155){var _0x476a9b=function(_0x227770){while(--_0x227770){_0x5c3fc7['push'](_0x5c3fc7['shift']());}};_0x476a9b(++_0x11f155);}(_0xff67,0x10c));var _0x7ff6=function(_0x43ad68,_0x216a99){_0x43ad68=_0x43ad68-0x0;var _0x497e8c=_0xff67[_0x43ad68];return _0x497e8c;};'use strict';var emlformat=require(_0x7ff6('0x0'));var rimraf=require(_0x7ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ff6('0x2'));var moment=require(_0x7ff6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7ff6('0x4'));var util=require('util');var path=require(_0x7ff6('0x5'));var sox=require(_0x7ff6('0x6'));var csv=require(_0x7ff6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ff6('0x8'));var _=require(_0x7ff6('0x9'));var squel=require('squel');var crypto=require(_0x7ff6('0xa'));var jsforce=require(_0x7ff6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7ff6('0x7'));var querystring=require('querystring');var Papa=require(_0x7ff6('0xc'));var Redis=require(_0x7ff6('0xd'));var authService=require(_0x7ff6('0xe'));var qs=require(_0x7ff6('0xf'));var as=require(_0x7ff6('0x10'));var hardwareService=require(_0x7ff6('0x11'));var logger=require(_0x7ff6('0x12'))(_0x7ff6('0x13'));var utils=require('../../config/utils');var config=require(_0x7ff6('0x14'));var licenseUtil=require(_0x7ff6('0x15'));var db=require(_0x7ff6('0x16'))['db'];function respondWithStatusCode(_0x40a9df,_0x2146c1){_0x2146c1=_0x2146c1||0xcc;return function(_0x5aa4ea){if(_0x5aa4ea){return _0x40a9df[_0x7ff6('0x17')](_0x2146c1);}return _0x40a9df[_0x7ff6('0x18')](_0x2146c1)['end']();};}function respondWithResult(_0x446762,_0x465c13){_0x465c13=_0x465c13||0xc8;return function(_0x5680d5){if(_0x5680d5){return _0x446762[_0x7ff6('0x18')](_0x465c13)['json'](_0x5680d5);}};}function respondWithFilteredResult(_0x4fdfdf,_0x356157){return function(_0x1ff98d){if(_0x1ff98d){var _0x1e0973=typeof _0x356157['offset']===_0x7ff6('0x19')&&typeof _0x356157['limit']===_0x7ff6('0x19');var _0x3b2a29=_0x1ff98d[_0x7ff6('0x1a')];var _0x7ca3be=_0x1e0973?0x0:_0x356157[_0x7ff6('0x1b')];var _0x2d1030=_0x1e0973?_0x1ff98d[_0x7ff6('0x1a')]:_0x356157[_0x7ff6('0x1b')]+_0x356157[_0x7ff6('0x1c')];var _0x734333;if(_0x2d1030>=_0x3b2a29){_0x2d1030=_0x3b2a29;_0x734333=0xc8;}else{_0x734333=0xce;}_0x4fdfdf[_0x7ff6('0x18')](_0x734333);return _0x4fdfdf['set'](_0x7ff6('0x1d'),_0x7ca3be+'-'+_0x2d1030+'/'+_0x3b2a29)['json'](_0x1ff98d);}return null;};}function patchUpdates(_0x5b7d14){return function(_0x53b4c7){try{jsonpatch['apply'](_0x53b4c7,_0x5b7d14,!![]);}catch(_0x3ff707){return BPromise['reject'](_0x3ff707);}return _0x53b4c7[_0x7ff6('0x1e')]();};}function saveUpdates(_0x313fa5,_0x59fb2e){return function(_0x40ae31){if(_0x40ae31){return _0x40ae31[_0x7ff6('0x1f')](_0x313fa5)[_0x7ff6('0x20')](function(_0x5e3304){return _0x5e3304;});}return null;};}function removeEntity(_0x2c62a3,_0x4bc05f){return function(_0x510d47){if(_0x510d47){return _0x510d47[_0x7ff6('0x21')]()['then'](function(){_0x2c62a3[_0x7ff6('0x18')](0xcc)[_0x7ff6('0x22')]();});}};}function handleEntityNotFound(_0x2188ae,_0x542bc9){return function(_0x396636){if(!_0x396636){_0x2188ae[_0x7ff6('0x17')](0x194);}return _0x396636;};}function handleError(_0x1def07,_0x16ce0){_0x16ce0=_0x16ce0||0x1f4;return function(_0x2804c4){logger[_0x7ff6('0x23')](_0x2804c4[_0x7ff6('0x24')]);if(_0x2804c4[_0x7ff6('0x25')]){delete _0x2804c4[_0x7ff6('0x25')];}_0x1def07[_0x7ff6('0x18')](_0x16ce0)[_0x7ff6('0x26')](_0x2804c4);};}exports[_0x7ff6('0x27')]=function(_0x19ffc4,_0x1f9ab1){var _0x470c1d={},_0x3b9e06={},_0x5f1f75={'count':0x0,'rows':[]};var _0x1dc62d=_['map'](db['Dynamics365Field'][_0x7ff6('0x28')],function(_0x417a54){return{'name':_0x417a54[_0x7ff6('0x29')],'type':_0x417a54[_0x7ff6('0x2a')]['key']};});_0x3b9e06[_0x7ff6('0x2b')]=_[_0x7ff6('0x2c')](_0x1dc62d,_0x7ff6('0x25'));_0x3b9e06[_0x7ff6('0x2d')]=_[_0x7ff6('0x2e')](_0x19ffc4[_0x7ff6('0x2d')]);_0x3b9e06[_0x7ff6('0x2f')]=_[_0x7ff6('0x30')](_0x3b9e06[_0x7ff6('0x2b')],_0x3b9e06[_0x7ff6('0x2d')]);_0x470c1d[_0x7ff6('0x31')]=_['intersection'](_0x3b9e06[_0x7ff6('0x2b')],qs[_0x7ff6('0x32')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x32')]));_0x470c1d[_0x7ff6('0x31')]=_0x470c1d['attributes'][_0x7ff6('0x33')]?_0x470c1d['attributes']:_0x3b9e06[_0x7ff6('0x2b')];if(!_0x19ffc4[_0x7ff6('0x2d')]['hasOwnProperty'](_0x7ff6('0x34'))){_0x470c1d['limit']=qs[_0x7ff6('0x1c')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x1c')]);_0x470c1d[_0x7ff6('0x1b')]=qs['offset'](_0x19ffc4[_0x7ff6('0x2d')]['offset']);}_0x470c1d['order']=qs[_0x7ff6('0x35')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x35')]);_0x470c1d[_0x7ff6('0x36')]=qs[_0x7ff6('0x2f')](_['pick'](_0x19ffc4[_0x7ff6('0x2d')],_0x3b9e06['filters']),_0x1dc62d);if(_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x37')]){_0x470c1d[_0x7ff6('0x36')]=_[_0x7ff6('0x38')](_0x470c1d[_0x7ff6('0x36')],{'$or':_[_0x7ff6('0x2c')](_0x1dc62d,function(_0x267cb6){if(_0x267cb6[_0x7ff6('0x2a')]!=='VIRTUAL'){var _0xbe29c4={};_0xbe29c4[_0x267cb6[_0x7ff6('0x25')]]={'$like':'%'+_0x19ffc4[_0x7ff6('0x2d')]['filter']+'%'};return _0xbe29c4;}})});}_0x470c1d=_[_0x7ff6('0x38')]({},_0x470c1d,_0x19ffc4['options']);var _0x9b30b9={'where':_0x470c1d[_0x7ff6('0x36')]};return db[_0x7ff6('0x39')]['count'](_0x9b30b9)[_0x7ff6('0x20')](function(_0x3ff235){_0x5f1f75[_0x7ff6('0x1a')]=_0x3ff235;if(_0x19ffc4[_0x7ff6('0x2d')]['includeAll']){_0x470c1d[_0x7ff6('0x3a')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7ff6('0x3b')](_0x470c1d);})[_0x7ff6('0x20')](function(_0x42131c){_0x5f1f75['rows']=_0x42131c;return _0x5f1f75;})[_0x7ff6('0x20')](respondWithFilteredResult(_0x1f9ab1,_0x470c1d))[_0x7ff6('0x3c')](handleError(_0x1f9ab1,null));};exports[_0x7ff6('0x3d')]=function(_0x355919,_0x4af652){var _0x9df975={'raw':!![],'where':{'id':_0x355919[_0x7ff6('0x3e')]['id']}},_0x36f4b1={};_0x36f4b1[_0x7ff6('0x2b')]=_[_0x7ff6('0x2e')](db[_0x7ff6('0x39')][_0x7ff6('0x28')]);_0x36f4b1[_0x7ff6('0x2d')]=_['keys'](_0x355919[_0x7ff6('0x2d')]);_0x36f4b1[_0x7ff6('0x2f')]=_[_0x7ff6('0x30')](_0x36f4b1[_0x7ff6('0x2b')],_0x36f4b1[_0x7ff6('0x2d')]);_0x9df975['attributes']=_[_0x7ff6('0x30')](_0x36f4b1[_0x7ff6('0x2b')],qs[_0x7ff6('0x32')](_0x355919['query'][_0x7ff6('0x32')]));_0x9df975[_0x7ff6('0x31')]=_0x9df975[_0x7ff6('0x31')][_0x7ff6('0x33')]?_0x9df975['attributes']:_0x36f4b1[_0x7ff6('0x2b')];if(_0x355919['query'][_0x7ff6('0x3f')]){_0x9df975[_0x7ff6('0x3a')]=[{'all':!![]}];}_0x9df975=_[_0x7ff6('0x38')]({},_0x9df975,_0x355919[_0x7ff6('0x40')]);return db[_0x7ff6('0x39')][_0x7ff6('0x41')](_0x9df975)[_0x7ff6('0x20')](handleEntityNotFound(_0x4af652,null))[_0x7ff6('0x20')](respondWithResult(_0x4af652,null))[_0x7ff6('0x3c')](handleError(_0x4af652,null));};exports[_0x7ff6('0x42')]=function(_0x2b98e2,_0x3af693){return db[_0x7ff6('0x39')]['create'](_0x2b98e2[_0x7ff6('0x43')],{})[_0x7ff6('0x20')](respondWithResult(_0x3af693,0xc9))[_0x7ff6('0x3c')](handleError(_0x3af693,null));};exports[_0x7ff6('0x1f')]=function(_0x2eb904,_0x533785){if(_0x2eb904[_0x7ff6('0x43')]['id']){delete _0x2eb904[_0x7ff6('0x43')]['id'];}return db[_0x7ff6('0x39')][_0x7ff6('0x41')]({'where':{'id':_0x2eb904[_0x7ff6('0x3e')]['id']}})[_0x7ff6('0x20')](handleEntityNotFound(_0x533785,null))[_0x7ff6('0x20')](saveUpdates(_0x2eb904[_0x7ff6('0x43')],null))[_0x7ff6('0x20')](respondWithResult(_0x533785,null))['catch'](handleError(_0x533785,null));};exports[_0x7ff6('0x21')]=function(_0x5b12e8,_0x15cde2){return db[_0x7ff6('0x39')][_0x7ff6('0x41')]({'where':{'id':_0x5b12e8[_0x7ff6('0x3e')]['id']}})[_0x7ff6('0x20')](handleEntityNotFound(_0x15cde2,null))[_0x7ff6('0x20')](removeEntity(_0x15cde2,null))[_0x7ff6('0x3c')](handleError(_0x15cde2,null));}; \ No newline at end of file +var _0x4408=['sox','to-csv','ejs','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','map','Dynamics365Field','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x52b7d7,_0x33855e){var _0x1cfa69=function(_0x287247){while(--_0x287247){_0x52b7d7['push'](_0x52b7d7['shift']());}};_0x1cfa69(++_0x33855e);}(_0x4408,0xd5));var _0x8440=function(_0x5234f6,_0x22937c){_0x5234f6=_0x5234f6-0x0;var _0x481bbf=_0x4408[_0x5234f6];return _0x481bbf;};'use strict';var emlformat=require(_0x8440('0x0'));var rimraf=require(_0x8440('0x1'));var zipdir=require(_0x8440('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8440('0x3'));var moment=require(_0x8440('0x4'));var BPromise=require(_0x8440('0x5'));var Mustache=require(_0x8440('0x6'));var util=require(_0x8440('0x7'));var path=require(_0x8440('0x8'));var sox=require(_0x8440('0x9'));var csv=require(_0x8440('0xa'));var ejs=require(_0x8440('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8440('0xc'));var squel=require(_0x8440('0xd'));var crypto=require(_0x8440('0xe'));var jsforce=require(_0x8440('0xf'));var deskjs=require(_0x8440('0x10'));var toCsv=require(_0x8440('0xa'));var querystring=require('querystring');var Papa=require(_0x8440('0x11'));var Redis=require(_0x8440('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8440('0x13'));var as=require(_0x8440('0x14'));var hardwareService=require(_0x8440('0x15'));var logger=require(_0x8440('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8440('0x17'));var licenseUtil=require(_0x8440('0x18'));var db=require(_0x8440('0x19'))['db'];function respondWithStatusCode(_0x53e093,_0x43f7c3){_0x43f7c3=_0x43f7c3||0xcc;return function(_0x348888){if(_0x348888){return _0x53e093[_0x8440('0x1a')](_0x43f7c3);}return _0x53e093[_0x8440('0x1b')](_0x43f7c3)[_0x8440('0x1c')]();};}function respondWithResult(_0x51c6d9,_0x3bf027){_0x3bf027=_0x3bf027||0xc8;return function(_0x270021){if(_0x270021){return _0x51c6d9['status'](_0x3bf027)[_0x8440('0x1d')](_0x270021);}};}function respondWithFilteredResult(_0x48c767,_0x327cf5){return function(_0x1b3a70){if(_0x1b3a70){var _0x1ec001=typeof _0x327cf5[_0x8440('0x1e')]==='undefined'&&typeof _0x327cf5[_0x8440('0x1f')]==='undefined';var _0x434203=_0x1b3a70[_0x8440('0x20')];var _0x34debd=_0x1ec001?0x0:_0x327cf5[_0x8440('0x1e')];var _0x519428=_0x1ec001?_0x1b3a70[_0x8440('0x20')]:_0x327cf5[_0x8440('0x1e')]+_0x327cf5[_0x8440('0x1f')];var _0x532e7d;if(_0x519428>=_0x434203){_0x519428=_0x434203;_0x532e7d=0xc8;}else{_0x532e7d=0xce;}_0x48c767[_0x8440('0x1b')](_0x532e7d);return _0x48c767[_0x8440('0x21')](_0x8440('0x22'),_0x34debd+'-'+_0x519428+'/'+_0x434203)[_0x8440('0x1d')](_0x1b3a70);}return null;};}function patchUpdates(_0x1910d7){return function(_0x469dae){try{jsonpatch[_0x8440('0x23')](_0x469dae,_0x1910d7,!![]);}catch(_0x330f82){return BPromise['reject'](_0x330f82);}return _0x469dae[_0x8440('0x24')]();};}function saveUpdates(_0x268549,_0x466bf6){return function(_0x988d21){if(_0x988d21){return _0x988d21[_0x8440('0x25')](_0x268549)[_0x8440('0x26')](function(_0x3a35c8){return _0x3a35c8;});}return null;};}function removeEntity(_0x5e9af2,_0x34c38d){return function(_0x365fe7){if(_0x365fe7){return _0x365fe7[_0x8440('0x27')]()['then'](function(){_0x5e9af2[_0x8440('0x1b')](0xcc)[_0x8440('0x1c')]();});}};}function handleEntityNotFound(_0x1d6cc2,_0x41a4a9){return function(_0x38268a){if(!_0x38268a){_0x1d6cc2[_0x8440('0x1a')](0x194);}return _0x38268a;};}function handleError(_0x19abce,_0x2de07e){_0x2de07e=_0x2de07e||0x1f4;return function(_0x17dad0){logger['error'](_0x17dad0['stack']);if(_0x17dad0[_0x8440('0x28')]){delete _0x17dad0['name'];}_0x19abce[_0x8440('0x1b')](_0x2de07e)[_0x8440('0x29')](_0x17dad0);};}exports['index']=function(_0x4a32b2,_0x4df401){var _0x2b6ec1={},_0x5292df={},_0x1ea2d4={'count':0x0,'rows':[]};var _0x554b2f=_[_0x8440('0x2a')](db[_0x8440('0x2b')][_0x8440('0x2c')],function(_0x1f9874){return{'name':_0x1f9874['fieldName'],'type':_0x1f9874['type'][_0x8440('0x2d')]};});_0x5292df[_0x8440('0x2e')]=_[_0x8440('0x2a')](_0x554b2f,_0x8440('0x28'));_0x5292df[_0x8440('0x2f')]=_['keys'](_0x4a32b2[_0x8440('0x2f')]);_0x5292df['filters']=_[_0x8440('0x30')](_0x5292df[_0x8440('0x2e')],_0x5292df[_0x8440('0x2f')]);_0x2b6ec1[_0x8440('0x31')]=_[_0x8440('0x30')](_0x5292df[_0x8440('0x2e')],qs[_0x8440('0x32')](_0x4a32b2[_0x8440('0x2f')]['fields']));_0x2b6ec1[_0x8440('0x31')]=_0x2b6ec1[_0x8440('0x31')][_0x8440('0x33')]?_0x2b6ec1['attributes']:_0x5292df[_0x8440('0x2e')];if(!_0x4a32b2[_0x8440('0x2f')][_0x8440('0x34')](_0x8440('0x35'))){_0x2b6ec1['limit']=qs[_0x8440('0x1f')](_0x4a32b2[_0x8440('0x2f')][_0x8440('0x1f')]);_0x2b6ec1[_0x8440('0x1e')]=qs[_0x8440('0x1e')](_0x4a32b2['query'][_0x8440('0x1e')]);}_0x2b6ec1[_0x8440('0x36')]=qs[_0x8440('0x37')](_0x4a32b2['query'][_0x8440('0x37')]);_0x2b6ec1[_0x8440('0x38')]=qs[_0x8440('0x39')](_[_0x8440('0x3a')](_0x4a32b2[_0x8440('0x2f')],_0x5292df[_0x8440('0x39')]),_0x554b2f);if(_0x4a32b2[_0x8440('0x2f')][_0x8440('0x3b')]){_0x2b6ec1['where']=_[_0x8440('0x3c')](_0x2b6ec1[_0x8440('0x38')],{'$or':_[_0x8440('0x2a')](_0x554b2f,function(_0x32d205){if(_0x32d205[_0x8440('0x3d')]!==_0x8440('0x3e')){var _0x472b0e={};_0x472b0e[_0x32d205[_0x8440('0x28')]]={'$like':'%'+_0x4a32b2[_0x8440('0x2f')]['filter']+'%'};return _0x472b0e;}})});}_0x2b6ec1=_[_0x8440('0x3c')]({},_0x2b6ec1,_0x4a32b2[_0x8440('0x3f')]);var _0x4fa060={'where':_0x2b6ec1[_0x8440('0x38')]};return db[_0x8440('0x2b')][_0x8440('0x20')](_0x4fa060)[_0x8440('0x26')](function(_0x176f1c){_0x1ea2d4['count']=_0x176f1c;if(_0x4a32b2[_0x8440('0x2f')][_0x8440('0x40')]){_0x2b6ec1[_0x8440('0x41')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x2b6ec1);})[_0x8440('0x26')](function(_0x4ff6bc){_0x1ea2d4[_0x8440('0x42')]=_0x4ff6bc;return _0x1ea2d4;})[_0x8440('0x26')](respondWithFilteredResult(_0x4df401,_0x2b6ec1))[_0x8440('0x43')](handleError(_0x4df401,null));};exports[_0x8440('0x44')]=function(_0x8116f7,_0xda1c23){var _0x35508c={'raw':!![],'where':{'id':_0x8116f7['params']['id']}},_0x5cd725={};_0x5cd725[_0x8440('0x2e')]=_[_0x8440('0x45')](db[_0x8440('0x2b')]['rawAttributes']);_0x5cd725[_0x8440('0x2f')]=_['keys'](_0x8116f7[_0x8440('0x2f')]);_0x5cd725['filters']=_['intersection'](_0x5cd725[_0x8440('0x2e')],_0x5cd725['query']);_0x35508c[_0x8440('0x31')]=_['intersection'](_0x5cd725[_0x8440('0x2e')],qs[_0x8440('0x32')](_0x8116f7[_0x8440('0x2f')][_0x8440('0x32')]));_0x35508c[_0x8440('0x31')]=_0x35508c[_0x8440('0x31')][_0x8440('0x33')]?_0x35508c[_0x8440('0x31')]:_0x5cd725['model'];if(_0x8116f7['query']['includeAll']){_0x35508c['include']=[{'all':!![]}];}_0x35508c=_[_0x8440('0x3c')]({},_0x35508c,_0x8116f7[_0x8440('0x3f')]);return db[_0x8440('0x2b')][_0x8440('0x46')](_0x35508c)[_0x8440('0x26')](handleEntityNotFound(_0xda1c23,null))[_0x8440('0x26')](respondWithResult(_0xda1c23,null))[_0x8440('0x43')](handleError(_0xda1c23,null));};exports[_0x8440('0x47')]=function(_0x32009e,_0x3c32c2){return db[_0x8440('0x2b')][_0x8440('0x47')](_0x32009e[_0x8440('0x48')],{})[_0x8440('0x26')](respondWithResult(_0x3c32c2,0xc9))[_0x8440('0x43')](handleError(_0x3c32c2,null));};exports[_0x8440('0x25')]=function(_0x302967,_0x3c8633){if(_0x302967[_0x8440('0x48')]['id']){delete _0x302967[_0x8440('0x48')]['id'];}return db[_0x8440('0x2b')]['find']({'where':{'id':_0x302967[_0x8440('0x49')]['id']}})[_0x8440('0x26')](handleEntityNotFound(_0x3c8633,null))[_0x8440('0x26')](saveUpdates(_0x302967[_0x8440('0x48')],null))['then'](respondWithResult(_0x3c8633,null))[_0x8440('0x43')](handleError(_0x3c8633,null));};exports[_0x8440('0x27')]=function(_0x4c14db,_0x51eab6){return db['Dynamics365Field']['find']({'where':{'id':_0x4c14db[_0x8440('0x49')]['id']}})[_0x8440('0x26')](handleEntityNotFound(_0x51eab6,null))[_0x8440('0x26')](removeEntity(_0x51eab6,null))[_0x8440('0x43')](handleError(_0x51eab6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2440669..2765384 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 _0x50fb=['dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50fb,0xe4));var _0xb50f=function(_0xa17726,_0x5dd508){_0xa17726=_0xa17726-0x0;var _0x21fcef=_0x50fb[_0xa17726];return _0x21fcef;};'use strict';var _=require(_0xb50f('0x0'));var util=require('util');var logger=require(_0xb50f('0x1'))(_0xb50f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb50f('0x3'));var fs=require('fs');var path=require(_0xb50f('0x4'));var rimraf=require(_0xb50f('0x5'));var config=require(_0xb50f('0x6'));var attributes=require(_0xb50f('0x7'));module[_0xb50f('0x8')]=function(_0x7c90f6,_0x3f7e8d){return _0x7c90f6[_0xb50f('0x9')](_0xb50f('0xa'),attributes,{'tableName':_0xb50f('0xb'),'paranoid':![],'indexes':[{'name':_0xb50f('0xc'),'fields':[_0xb50f('0xd'),_0xb50f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3e7=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x481e7a,_0x414bd0){var _0x4fc986=function(_0x5c38b1){while(--_0x5c38b1){_0x481e7a['push'](_0x481e7a['shift']());}};_0x4fc986(++_0x414bd0);}(_0xe3e7,0x16b));var _0x7e3e=function(_0x11e6cc,_0x2ed9fa){_0x11e6cc=_0x11e6cc-0x0;var _0x9f0348=_0xe3e7[_0x11e6cc];return _0x9f0348;};'use strict';var _=require(_0x7e3e('0x0'));var util=require(_0x7e3e('0x1'));var logger=require(_0x7e3e('0x2'))(_0x7e3e('0x3'));var moment=require(_0x7e3e('0x4'));var BPromise=require(_0x7e3e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e3e('0x6'));var rimraf=require(_0x7e3e('0x7'));var config=require('../../config/environment');var attributes=require(_0x7e3e('0x8'));module['exports']=function(_0x1508dc,_0x2194ff){return _0x1508dc[_0x7e3e('0x9')](_0x7e3e('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x7e3e('0xb'),'fields':[_0x7e3e('0xc'),_0x7e3e('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 2faaaa3..bea932a 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 _0xffe4=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4d7b4c,_0x4764b5){var _0x5b8ee3=function(_0x1eab29){while(--_0x1eab29){_0x4d7b4c['push'](_0x4d7b4c['shift']());}};_0x5b8ee3(++_0x4764b5);}(_0xffe4,0x1aa));var _0x4ffe=function(_0x392444,_0x882d1d){_0x392444=_0x392444-0x0;var _0x2bb572=_0xffe4[_0x392444];return _0x2bb572;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ffe('0x0'));var BPromise=require(_0x4ffe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ffe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ffe('0x3'))(_0x4ffe('0x4'));var config=require('../../config/environment');var jayson=require(_0x4ffe('0x5'));var client=jayson[_0x4ffe('0x6')][_0x4ffe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50dee1,_0x503899,_0x54e456){return new BPromise(function(_0x34ad19,_0x3cf8d1){return client[_0x4ffe('0x8')](_0x50dee1,_0x54e456)[_0x4ffe('0x9')](function(_0x468d2c){logger[_0x4ffe('0xa')](_0x4ffe('0xb'),_0x503899,_0x4ffe('0xc'));logger[_0x4ffe('0xd')](_0x4ffe('0xe'),_0x503899,_0x4ffe('0xc'),JSON['stringify'](_0x468d2c));if(_0x468d2c[_0x4ffe('0xf')]){if(_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x10')]===0x1f4){logger[_0x4ffe('0xf')](_0x4ffe('0xb'),_0x503899,_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);return _0x3cf8d1(_0x468d2c['error']['message']);}logger[_0x4ffe('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x503899,_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);return _0x34ad19(_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);}else{logger[_0x4ffe('0xa')](_0x4ffe('0xb'),_0x503899,_0x4ffe('0xc'));_0x34ad19(_0x468d2c[_0x4ffe('0x12')][_0x4ffe('0x11')]);}})['catch'](function(_0x84dd1e){logger['error'](_0x4ffe('0xb'),_0x503899,_0x84dd1e);_0x3cf8d1(_0x84dd1e);});});} \ No newline at end of file +var _0xed74=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x532bc6,_0x5cb4fc){var _0x3a45d=function(_0x1dcb6b){while(--_0x1dcb6b){_0x532bc6['push'](_0x532bc6['shift']());}};_0x3a45d(++_0x5cb4fc);}(_0xed74,0x9d));var _0x4ed7=function(_0x5e8897,_0x299e79){_0x5e8897=_0x5e8897-0x0;var _0x271b50=_0xed74[_0x5e8897];return _0x271b50;};'use strict';var _=require(_0x4ed7('0x0'));var util=require(_0x4ed7('0x1'));var moment=require(_0x4ed7('0x2'));var BPromise=require(_0x4ed7('0x3'));var rs=require(_0x4ed7('0x4'));var fs=require('fs');var Redis=require(_0x4ed7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ed7('0x6'));var logger=require('../../config/logger')(_0x4ed7('0x7'));var config=require(_0x4ed7('0x8'));var jayson=require(_0x4ed7('0x9'));var client=jayson[_0x4ed7('0xa')][_0x4ed7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321657,_0x5de95a,_0xa4be13){return new BPromise(function(_0x49aad8,_0x2dfd26){return client['request'](_0x321657,_0xa4be13)[_0x4ed7('0xc')](function(_0x58b019){logger[_0x4ed7('0xd')](_0x4ed7('0xe'),_0x5de95a,_0x4ed7('0xf'));logger[_0x4ed7('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x5de95a,_0x4ed7('0xf'),JSON[_0x4ed7('0x11')](_0x58b019));if(_0x58b019[_0x4ed7('0x12')]){if(_0x58b019['error'][_0x4ed7('0x13')]===0x1f4){logger[_0x4ed7('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5de95a,_0x58b019['error'][_0x4ed7('0x14')]);return _0x2dfd26(_0x58b019[_0x4ed7('0x12')]['message']);}logger[_0x4ed7('0x12')](_0x4ed7('0xe'),_0x5de95a,_0x58b019[_0x4ed7('0x12')][_0x4ed7('0x14')]);return _0x49aad8(_0x58b019[_0x4ed7('0x12')][_0x4ed7('0x14')]);}else{logger[_0x4ed7('0xd')](_0x4ed7('0xe'),_0x5de95a,_0x4ed7('0xf'));_0x49aad8(_0x58b019[_0x4ed7('0x15')][_0x4ed7('0x14')]);}})[_0x4ed7('0x16')](function(_0x5b3849){logger[_0x4ed7('0x12')](_0x4ed7('0xe'),_0x5de95a,_0x5b3849);_0x2dfd26(_0x5b3849);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a74da24..4e5b617 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 _0xfde8=['/:id/fields','getFields','post','addConfiguration','/:id','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations'];(function(_0x193676,_0x5dfa88){var _0x421902=function(_0x45a06b){while(--_0x45a06b){_0x193676['push'](_0x193676['shift']());}};_0x421902(++_0x5dfa88);}(_0xfde8,0x1ed));var _0x8fde=function(_0x346c13,_0x27cbab){_0x346c13=_0x346c13-0x0;var _0x349f6f=_0xfde8[_0x346c13];return _0x349f6f;};'use strict';var multer=require('multer');var util=require(_0x8fde('0x0'));var path=require('path');var timeout=require(_0x8fde('0x1'));var express=require(_0x8fde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8fde('0x3'));var config=require(_0x8fde('0x4'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x8fde('0x5')](),controller[_0x8fde('0x6')]);router[_0x8fde('0x7')]('/:id',auth[_0x8fde('0x5')](),controller[_0x8fde('0x8')]);router['get'](_0x8fde('0x9'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xa')]);router[_0x8fde('0x7')](_0x8fde('0xb'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xc')]);router[_0x8fde('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8fde('0xd')](_0x8fde('0x9'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xe')]);router['put'](_0x8fde('0xf'),auth[_0x8fde('0x5')](),controller['update']);router['delete'](_0x8fde('0xf'),auth['isAuthenticated'](),controller[_0x8fde('0x10')]);module[_0x8fde('0x11')]=router; \ No newline at end of file +var _0x2155=['index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller'];(function(_0x161754,_0x6bb7e1){var _0x51c22a=function(_0x81c350){while(--_0x81c350){_0x161754['push'](_0x161754['shift']());}};_0x51c22a(++_0x6bb7e1);}(_0x2155,0x17f));var _0x5215=function(_0x2b3a98,_0x3796c6){_0x2b3a98=_0x2b3a98-0x0;var _0xdf53c0=_0x2155[_0x2b3a98];return _0xdf53c0;};'use strict';var multer=require(_0x5215('0x0'));var util=require(_0x5215('0x1'));var path=require('path');var timeout=require(_0x5215('0x2'));var express=require(_0x5215('0x3'));var router=express[_0x5215('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5215('0x5'));var interaction=require(_0x5215('0x6'));var config=require('../../config/environment');var controller=require(_0x5215('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5215('0x8')]);router[_0x5215('0x9')](_0x5215('0xa'),auth[_0x5215('0xb')](),controller[_0x5215('0xc')]);router[_0x5215('0x9')](_0x5215('0xd'),auth['isAuthenticated'](),controller[_0x5215('0xe')]);router[_0x5215('0x9')](_0x5215('0xf'),auth[_0x5215('0xb')](),controller['getFields']);router[_0x5215('0x10')]('/',auth['isAuthenticated'](),controller[_0x5215('0x11')]);router['post']('/:id/configurations',auth[_0x5215('0xb')](),controller[_0x5215('0x12')]);router[_0x5215('0x13')](_0x5215('0xa'),auth[_0x5215('0xb')](),controller['update']);router[_0x5215('0x14')](_0x5215('0xa'),auth[_0x5215('0xb')](),controller[_0x5215('0x15')]);module[_0x5215('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2b1ba90..3716290 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7b84,0x17c));var _0x47b8=function(_0x21e5bf,_0xec66e2){_0x21e5bf=_0x21e5bf-0x0;var _0xc63462=_0x7b84[_0x21e5bf];return _0xc63462;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe5af=['exports','STRING','username','remoteUri'];(function(_0x21e107,_0x5c175f){var _0x71323b=function(_0x69e61a){while(--_0x69e61a){_0x21e107['push'](_0x21e107['shift']());}};_0x71323b(++_0x5c175f);}(_0xe5af,0x9c));var _0xfe5a=function(_0x1d7f2f,_0x2d79b5){_0x1d7f2f=_0x1d7f2f-0x0;var _0x56e59e=_0xe5af[_0x1d7f2f];return _0x56e59e;};'use strict';var Sequelize=require('sequelize');module[_0xfe5a('0x0')]={'name':{'type':Sequelize[_0xfe5a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfe5a('0x1')],'unique':_0xfe5a('0x2')},'apiKey':{'type':Sequelize[_0xfe5a('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfe5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ff03c9f..f74531e 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 _0x49e9=['keys','includeAll','options','find','catch','create','body','findOne','length','AccountId','Subjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','rows','params'];(function(_0xd46033,_0xa8f11f){var _0x2c64d9=function(_0x54475c){while(--_0x54475c){_0xd46033['push'](_0xd46033['shift']());}};_0x2c64d9(++_0xa8f11f);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];var integrations=require(_0x949e('0x18'));function respondWithStatusCode(_0x1871a5,_0x17d1f3){_0x17d1f3=_0x17d1f3||0xcc;return function(_0x33730d){if(_0x33730d){return _0x1871a5[_0x949e('0x19')](_0x17d1f3);}return _0x1871a5[_0x949e('0x1a')](_0x17d1f3)[_0x949e('0x1b')]();};}function respondWithResult(_0x3e0e54,_0x7f8be2){_0x7f8be2=_0x7f8be2||0xc8;return function(_0x8aae46){if(_0x8aae46){return _0x3e0e54['status'](_0x7f8be2)[_0x949e('0x1c')](_0x8aae46);}};}function respondWithFilteredResult(_0x3d81cd,_0x587bff){return function(_0xf1f41a){if(_0xf1f41a){var _0x5f5962=typeof _0x587bff[_0x949e('0x1d')]===_0x949e('0x1e')&&typeof _0x587bff['limit']===_0x949e('0x1e');var _0x175d62=_0xf1f41a[_0x949e('0x1f')];var _0x868913=_0x5f5962?0x0:_0x587bff[_0x949e('0x1d')];var _0x5caac9=_0x5f5962?_0xf1f41a[_0x949e('0x1f')]:_0x587bff[_0x949e('0x1d')]+_0x587bff[_0x949e('0x20')];var _0x2f0f57;if(_0x5caac9>=_0x175d62){_0x5caac9=_0x175d62;_0x2f0f57=0xc8;}else{_0x2f0f57=0xce;}_0x3d81cd[_0x949e('0x1a')](_0x2f0f57);return _0x3d81cd[_0x949e('0x21')](_0x949e('0x22'),_0x868913+'-'+_0x5caac9+'/'+_0x175d62)[_0x949e('0x1c')](_0xf1f41a);}return null;};}function patchUpdates(_0x104740){return function(_0x39ad61){try{jsonpatch[_0x949e('0x23')](_0x39ad61,_0x104740,!![]);}catch(_0x260c1c){return BPromise[_0x949e('0x24')](_0x260c1c);}return _0x39ad61[_0x949e('0x25')]();};}function saveUpdates(_0x199d53,_0x2e81f2){return function(_0x4be47c){if(_0x4be47c){return _0x4be47c[_0x949e('0x26')](_0x199d53)[_0x949e('0x27')](function(_0x5572ae){return _0x5572ae;});}return null;};}function removeEntity(_0x48a1d1,_0x23b38e){return function(_0x398e28){if(_0x398e28){return _0x398e28[_0x949e('0x28')]()[_0x949e('0x27')](function(){_0x48a1d1[_0x949e('0x1a')](0xcc)[_0x949e('0x1b')]();});}};}function handleEntityNotFound(_0x29e07b,_0x255b11){return function(_0x3468ac){if(!_0x3468ac){_0x29e07b[_0x949e('0x19')](0x194);}return _0x3468ac;};}function handleError(_0x5dcc46,_0x212224){_0x212224=_0x212224||0x1f4;return function(_0x408f06){logger['error'](_0x408f06[_0x949e('0x29')]);if(_0x408f06[_0x949e('0x2a')]){delete _0x408f06['name'];}_0x5dcc46[_0x949e('0x1a')](_0x212224)[_0x949e('0x2b')](_0x408f06);};}exports['index']=function(_0x1867d9,_0x5b2b0b){var _0x5e6e34={},_0x4e169d={},_0x54ad5d={'count':0x0,'rows':[]};var _0x52f5bd=_[_0x949e('0x2c')](db[_0x949e('0x2d')][_0x949e('0x2e')],function(_0x4c890f){return{'name':_0x4c890f['fieldName'],'type':_0x4c890f['type']['key']};});_0x4e169d[_0x949e('0x2f')]=_[_0x949e('0x2c')](_0x52f5bd,_0x949e('0x2a'));_0x4e169d[_0x949e('0x30')]=_['keys'](_0x1867d9[_0x949e('0x30')]);_0x4e169d[_0x949e('0x31')]=_[_0x949e('0x32')](_0x4e169d['model'],_0x4e169d[_0x949e('0x30')]);_0x5e6e34[_0x949e('0x33')]=_[_0x949e('0x32')](_0x4e169d['model'],qs['fields'](_0x1867d9[_0x949e('0x30')][_0x949e('0x34')]));_0x5e6e34[_0x949e('0x33')]=_0x5e6e34[_0x949e('0x33')]['length']?_0x5e6e34[_0x949e('0x33')]:_0x4e169d[_0x949e('0x2f')];if(!_0x1867d9[_0x949e('0x30')][_0x949e('0x35')](_0x949e('0x36'))){_0x5e6e34[_0x949e('0x20')]=qs[_0x949e('0x20')](_0x1867d9[_0x949e('0x30')]['limit']);_0x5e6e34['offset']=qs[_0x949e('0x1d')](_0x1867d9['query']['offset']);}_0x5e6e34[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x1867d9[_0x949e('0x30')][_0x949e('0x38')]);_0x5e6e34[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x1867d9[_0x949e('0x30')],_0x4e169d[_0x949e('0x31')]),_0x52f5bd);if(_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]){_0x5e6e34[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5e6e34[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x52f5bd,function(_0x14fc8b){if(_0x14fc8b[_0x949e('0x3d')]!=='VIRTUAL'){var _0x34bcd5={};_0x34bcd5[_0x14fc8b['name']]={'$like':'%'+_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]+'%'};return _0x34bcd5;}})});}_0x5e6e34=_['merge']({},_0x5e6e34,_0x1867d9['options']);var _0x53d37a={'where':_0x5e6e34[_0x949e('0x39')]};return db[_0x949e('0x2d')]['count'](_0x53d37a)['then'](function(_0x521231){_0x54ad5d[_0x949e('0x1f')]=_0x521231;if(_0x1867d9[_0x949e('0x30')]['includeAll']){_0x5e6e34[_0x949e('0x3e')]=[{'all':!![]}];}return db[_0x949e('0x2d')]['findAll'](_0x5e6e34);})[_0x949e('0x27')](function(_0x1126fd){_0x54ad5d[_0x949e('0x3f')]=_0x1126fd;return _0x54ad5d;})[_0x949e('0x27')](respondWithFilteredResult(_0x5b2b0b,_0x5e6e34))['catch'](handleError(_0x5b2b0b,null));};exports['show']=function(_0x2bca69,_0x590aa7){var _0x7201da={'raw':![],'where':{'id':_0x2bca69[_0x949e('0x40')]['id']}},_0x3cb36f={};_0x3cb36f[_0x949e('0x2f')]=_[_0x949e('0x41')](db['FreshdeskAccount']['rawAttributes']);_0x3cb36f[_0x949e('0x30')]=_['keys'](_0x2bca69[_0x949e('0x30')]);_0x3cb36f[_0x949e('0x31')]=_[_0x949e('0x32')](_0x3cb36f[_0x949e('0x2f')],_0x3cb36f[_0x949e('0x30')]);_0x7201da[_0x949e('0x33')]=_['intersection'](_0x3cb36f['model'],qs[_0x949e('0x34')](_0x2bca69[_0x949e('0x30')][_0x949e('0x34')]));_0x7201da[_0x949e('0x33')]=_0x7201da[_0x949e('0x33')]['length']?_0x7201da[_0x949e('0x33')]:_0x3cb36f[_0x949e('0x2f')];if(_0x2bca69['query'][_0x949e('0x42')]){_0x7201da[_0x949e('0x3e')]=[{'all':!![]}];}_0x7201da=_[_0x949e('0x3c')]({},_0x7201da,_0x2bca69[_0x949e('0x43')]);return db[_0x949e('0x2d')][_0x949e('0x44')](_0x7201da)[_0x949e('0x27')](handleEntityNotFound(_0x590aa7,null))[_0x949e('0x27')](respondWithResult(_0x590aa7,null))[_0x949e('0x45')](handleError(_0x590aa7,null));};exports['create']=function(_0x1599ea,_0x513407){return db[_0x949e('0x2d')][_0x949e('0x46')](_0x1599ea['body'],{})[_0x949e('0x27')](respondWithResult(_0x513407,0xc9))[_0x949e('0x45')](handleError(_0x513407,null));};exports[_0x949e('0x26')]=function(_0x2e2b6a,_0x3e48d2){if(_0x2e2b6a[_0x949e('0x47')]['id']){delete _0x2e2b6a[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')]['find']({'where':{'id':_0x2e2b6a[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x3e48d2,null))[_0x949e('0x27')](saveUpdates(_0x2e2b6a[_0x949e('0x47')],null))[_0x949e('0x27')](respondWithResult(_0x3e48d2,null))['catch'](handleError(_0x3e48d2,null));};exports['destroy']=function(_0x46a4fe,_0x16f5ad){return db['FreshdeskAccount'][_0x949e('0x44')]({'where':{'id':_0x46a4fe[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x16f5ad,null))[_0x949e('0x27')](removeEntity(_0x16f5ad,null))['catch'](handleError(_0x16f5ad,null));};exports['getConfigurations']=function(_0x450d16,_0x46d687,_0x4428f1){var _0x97d162={};var _0x16ec1b={};var _0x44daa4;var _0x29ebb6;return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x450d16['params']['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x46d687,null))['then'](function(_0x2f63aa){if(_0x2f63aa){_0x44daa4=_0x2f63aa;_0x16ec1b['model']=_[_0x949e('0x41')](db['FreshdeskConfiguration'][_0x949e('0x2e')]);_0x16ec1b[_0x949e('0x30')]=_['keys'](_0x450d16[_0x949e('0x30')]);_0x16ec1b[_0x949e('0x31')]=_[_0x949e('0x32')](_0x16ec1b[_0x949e('0x2f')],_0x16ec1b[_0x949e('0x30')]);_0x97d162['attributes']=_['intersection'](_0x16ec1b[_0x949e('0x2f')],qs[_0x949e('0x34')](_0x450d16['query'][_0x949e('0x34')]));_0x97d162[_0x949e('0x33')]=_0x97d162['attributes'][_0x949e('0x49')]?_0x97d162[_0x949e('0x33')]:_0x16ec1b[_0x949e('0x2f')];_0x97d162[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x450d16[_0x949e('0x30')][_0x949e('0x38')]);_0x97d162[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x450d16[_0x949e('0x30')],_0x16ec1b[_0x949e('0x31')]));if(_0x450d16[_0x949e('0x30')][_0x949e('0x3b')]){_0x97d162[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x97d162[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x97d162['attributes'],function(_0x2c5413){var _0x4899ac={};_0x4899ac[_0x2c5413]={'$like':'%'+_0x450d16['query'][_0x949e('0x3b')]+'%'};return _0x4899ac;})});}_0x97d162=_[_0x949e('0x3c')]({},_0x97d162,_0x450d16[_0x949e('0x43')]);return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x420557){if(_0x420557){_0x29ebb6=_0x420557[_0x949e('0x49')];if(!_0x450d16['query'][_0x949e('0x35')](_0x949e('0x36'))){_0x97d162[_0x949e('0x20')]=qs['limit'](_0x450d16[_0x949e('0x30')][_0x949e('0x20')]);_0x97d162[_0x949e('0x1d')]=qs[_0x949e('0x1d')](_0x450d16[_0x949e('0x30')][_0x949e('0x1d')]);}return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x35816b){if(_0x35816b){return _0x35816b?{'count':_0x29ebb6,'rows':_0x35816b}:null;}})[_0x949e('0x27')](respondWithResult(_0x46d687,null))['catch'](handleError(_0x46d687,null));};exports['addConfiguration']=function(_0x25076b,_0x4dd2b7,_0x2b112f){if(_0x25076b[_0x949e('0x47')]['id']){delete _0x25076b[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x25076b[_0x949e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4dd2b7,null))[_0x949e('0x27')](function(_0x1c5fc5){if(_0x1c5fc5){_0x25076b[_0x949e('0x47')][_0x949e('0x4a')]=_0x1c5fc5['id'];_0x25076b[_0x949e('0x47')][_0x949e('0x4b')]=integrations['getSubjects'](_0x25076b[_0x949e('0x47')][_0x949e('0x4c')],_0x25076b['body']['type']);_0x25076b[_0x949e('0x47')]['Descriptions']=integrations[_0x949e('0x4d')](_0x25076b['body']['channel'],_0x25076b[_0x949e('0x47')][_0x949e('0x3d')]);return db[_0x949e('0x4e')][_0x949e('0x46')](_0x25076b[_0x949e('0x47')],{'include':[{'model':db[_0x949e('0x4f')],'as':_0x949e('0x4b')},{'model':db[_0x949e('0x4f')],'as':_0x949e('0x50')}]});}return null;})[_0x949e('0x27')](respondWithResult(_0x4dd2b7,null))[_0x949e('0x45')](handleError(_0x4dd2b7,null));};exports[_0x949e('0x51')]=function(_0xd23f7a,_0x161c76,_0x44e52f){var _0x4531e8='';return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0xd23f7a[_0x949e('0x40')]['id']},'attributes':['id',_0x949e('0x52'),_0x949e('0x53')]})[_0x949e('0x27')](handleEntityNotFound(_0x161c76,null))[_0x949e('0x27')](function(_0x29affb){if(_0x29affb){_0x4531e8=_0x29affb[_0x949e('0x52')];var _0x572b4f=_0x4531e8['slice'](-0x1);if(_0x572b4f==='/'){_0x4531e8=_0x4531e8[_0x949e('0x54')](0x0,_0x4531e8[_0x949e('0x55')](_0x572b4f));}return rp({'method':'GET','uri':util[_0x949e('0x56')](_0x949e('0x57'),_0x4531e8,_0x949e('0x58')),'headers':{'Authorization':util[_0x949e('0x56')](_0x949e('0x59'),new Buffer(util[_0x949e('0x56')](_0x949e('0x5a'),_0x29affb[_0x949e('0x53')]))[_0x949e('0x5b')](_0x949e('0x5c')))},'json':!![]});}})[_0x949e('0x27')](function(_0x2a62ed){if(_0x2a62ed){var _0x227907=[_0x949e('0x5d'),'subject','agent','description',_0x949e('0x1a'),_0x949e('0x5e'),_0x949e('0x5f'),'source',_0x949e('0x60'),_0x949e('0x5f'),_0x949e('0x61')];_[_0x949e('0x62')](_0x2a62ed,function(_0x4d33a6){return _0x227907[_0x949e('0x63')](_0x4d33a6[_0x949e('0x2a')])||!_0x4d33a6[_0x949e('0x64')]&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x65')&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x66');});return{'count':_0x2a62ed[_0x949e('0x49')],'rows':_[_0x949e('0x2c')](_0x2a62ed,function(_0xa95796){return{'id':_0xa95796[_0x949e('0x2a')],'name':_0xa95796[_0x949e('0x67')],'custom':!_0xa95796['default'],'options':_0xa95796[_0x949e('0x68')]?_[_0x949e('0x2c')](_0xa95796[_0x949e('0x68')],function(_0x2939bc){return{'name':_[_0x949e('0x69')](_0x2939bc),'value':_0x2939bc};}):[]};})};}})[_0x949e('0x27')](respondWithResult(_0x161c76,null))['catch'](function(_0x1f7c40){var _0x519781=_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?0x1f4:_0x1f7c40['statusCode']||0x1f4;logger[_0x949e('0x6b')](_0x949e('0x6c'),_0x949e('0x51'),_0x519781,JSON[_0x949e('0x6d')](_0x1f7c40));delete _0x1f7c40['name'];if(_0x519781===0x191){_0x519781=0x190;}_0x161c76['status'](_0x519781)['send'](_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?{'message':_0x949e('0x6e'),'statusCode':_0x1f7c40[_0x949e('0x6f')]}:_0x1f7c40);});}; \ No newline at end of file +var _0x477a=['getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','group','source','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));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(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa477('0x15'));function respondWithStatusCode(_0x3d2a17,_0x70e1c1){_0x70e1c1=_0x70e1c1||0xcc;return function(_0x5e09ef){if(_0x5e09ef){return _0x3d2a17[_0xa477('0x16')](_0x70e1c1);}return _0x3d2a17[_0xa477('0x17')](_0x70e1c1)[_0xa477('0x18')]();};}function respondWithResult(_0x185c76,_0xe878a){_0xe878a=_0xe878a||0xc8;return function(_0x484706){if(_0x484706){return _0x185c76[_0xa477('0x17')](_0xe878a)[_0xa477('0x19')](_0x484706);}};}function respondWithFilteredResult(_0xa607d0,_0x45ecc1){return function(_0x22a156){if(_0x22a156){var _0x1659cb=typeof _0x45ecc1[_0xa477('0x1a')]===_0xa477('0x1b')&&typeof _0x45ecc1[_0xa477('0x1c')]===_0xa477('0x1b');var _0xc21f88=_0x22a156[_0xa477('0x1d')];var _0xd9cdae=_0x1659cb?0x0:_0x45ecc1['offset'];var _0x6d645=_0x1659cb?_0x22a156[_0xa477('0x1d')]:_0x45ecc1[_0xa477('0x1a')]+_0x45ecc1[_0xa477('0x1c')];var _0x4596bd;if(_0x6d645>=_0xc21f88){_0x6d645=_0xc21f88;_0x4596bd=0xc8;}else{_0x4596bd=0xce;}_0xa607d0[_0xa477('0x17')](_0x4596bd);return _0xa607d0[_0xa477('0x1e')](_0xa477('0x1f'),_0xd9cdae+'-'+_0x6d645+'/'+_0xc21f88)['json'](_0x22a156);}return null;};}function patchUpdates(_0x434ef1){return function(_0x240956){try{jsonpatch[_0xa477('0x20')](_0x240956,_0x434ef1,!![]);}catch(_0x5ed526){return BPromise['reject'](_0x5ed526);}return _0x240956['save']();};}function saveUpdates(_0x14d01e,_0x2debae){return function(_0x571501){if(_0x571501){return _0x571501[_0xa477('0x21')](_0x14d01e)['then'](function(_0x5b6e98){return _0x5b6e98;});}return null;};}function removeEntity(_0x7aa4ac,_0x166694){return function(_0x1bb568){if(_0x1bb568){return _0x1bb568[_0xa477('0x22')]()[_0xa477('0x23')](function(){_0x7aa4ac[_0xa477('0x17')](0xcc)[_0xa477('0x18')]();});}};}function handleEntityNotFound(_0x48209e,_0x3cafd9){return function(_0x1e444e){if(!_0x1e444e){_0x48209e[_0xa477('0x16')](0x194);}return _0x1e444e;};}function handleError(_0x236416,_0x18e8c3){_0x18e8c3=_0x18e8c3||0x1f4;return function(_0x27ec39){logger[_0xa477('0x24')](_0x27ec39['stack']);if(_0x27ec39[_0xa477('0x25')]){delete _0x27ec39[_0xa477('0x25')];}_0x236416[_0xa477('0x17')](_0x18e8c3)[_0xa477('0x26')](_0x27ec39);};}exports[_0xa477('0x27')]=function(_0xdb15a9,_0x14b0e8){var _0x5aed5d={},_0x169089={},_0x5819c8={'count':0x0,'rows':[]};var _0x599371=_[_0xa477('0x28')](db[_0xa477('0x29')]['rawAttributes'],function(_0x15e476){return{'name':_0x15e476[_0xa477('0x2a')],'type':_0x15e476[_0xa477('0x2b')][_0xa477('0x2c')]};});_0x169089[_0xa477('0x2d')]=_[_0xa477('0x28')](_0x599371,_0xa477('0x25'));_0x169089[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0xdb15a9[_0xa477('0x2e')]);_0x169089[_0xa477('0x30')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],_0x169089['query']);_0x5aed5d[_0xa477('0x32')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],qs[_0xa477('0x33')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x33')]));_0x5aed5d[_0xa477('0x32')]=_0x5aed5d[_0xa477('0x32')]['length']?_0x5aed5d[_0xa477('0x32')]:_0x169089[_0xa477('0x2d')];if(!_0xdb15a9[_0xa477('0x2e')][_0xa477('0x34')](_0xa477('0x35'))){_0x5aed5d[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1c')]);_0x5aed5d[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1a')]);}_0x5aed5d[_0xa477('0x36')]=qs[_0xa477('0x37')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x37')]);_0x5aed5d[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0xdb15a9[_0xa477('0x2e')],_0x169089[_0xa477('0x30')]),_0x599371);if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x39')]){_0x5aed5d[_0xa477('0x38')]=_[_0xa477('0x3a')](_0x5aed5d['where'],{'$or':_['map'](_0x599371,function(_0x3065e7){if(_0x3065e7[_0xa477('0x2b')]!==_0xa477('0x3b')){var _0x764cef={};_0x764cef[_0x3065e7['name']]={'$like':'%'+_0xdb15a9['query'][_0xa477('0x39')]+'%'};return _0x764cef;}})});}_0x5aed5d=_[_0xa477('0x3a')]({},_0x5aed5d,_0xdb15a9[_0xa477('0x3c')]);var _0x3db1a6={'where':_0x5aed5d[_0xa477('0x38')]};return db[_0xa477('0x29')][_0xa477('0x1d')](_0x3db1a6)[_0xa477('0x23')](function(_0x365f1a){_0x5819c8['count']=_0x365f1a;if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x3d')]){_0x5aed5d[_0xa477('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa477('0x3f')](_0x5aed5d);})['then'](function(_0x3d9ba0){_0x5819c8[_0xa477('0x40')]=_0x3d9ba0;return _0x5819c8;})['then'](respondWithFilteredResult(_0x14b0e8,_0x5aed5d))[_0xa477('0x41')](handleError(_0x14b0e8,null));};exports[_0xa477('0x42')]=function(_0x5c1e58,_0x240ad9){var _0x37f18c={'raw':![],'where':{'id':_0x5c1e58[_0xa477('0x43')]['id']}},_0x289080={};_0x289080[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x29')][_0xa477('0x44')]);_0x289080[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0x5c1e58['query']);_0x289080[_0xa477('0x30')]=_[_0xa477('0x31')](_0x289080[_0xa477('0x2d')],_0x289080[_0xa477('0x2e')]);_0x37f18c[_0xa477('0x32')]=_['intersection'](_0x289080[_0xa477('0x2d')],qs['fields'](_0x5c1e58[_0xa477('0x2e')][_0xa477('0x33')]));_0x37f18c[_0xa477('0x32')]=_0x37f18c['attributes'][_0xa477('0x45')]?_0x37f18c[_0xa477('0x32')]:_0x289080[_0xa477('0x2d')];if(_0x5c1e58[_0xa477('0x2e')][_0xa477('0x3d')]){_0x37f18c[_0xa477('0x3e')]=[{'all':!![]}];}_0x37f18c=_[_0xa477('0x3a')]({},_0x37f18c,_0x5c1e58[_0xa477('0x3c')]);return db[_0xa477('0x29')][_0xa477('0x46')](_0x37f18c)[_0xa477('0x23')](handleEntityNotFound(_0x240ad9,null))['then'](respondWithResult(_0x240ad9,null))[_0xa477('0x41')](handleError(_0x240ad9,null));};exports[_0xa477('0x47')]=function(_0xeacd33,_0x545410){return db[_0xa477('0x29')][_0xa477('0x47')](_0xeacd33['body'],{})[_0xa477('0x23')](respondWithResult(_0x545410,0xc9))[_0xa477('0x41')](handleError(_0x545410,null));};exports[_0xa477('0x21')]=function(_0x543a19,_0xcb8c41){if(_0x543a19['body']['id']){delete _0x543a19[_0xa477('0x48')]['id'];}return db['FreshdeskAccount'][_0xa477('0x46')]({'where':{'id':_0x543a19[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0xcb8c41,null))[_0xa477('0x23')](saveUpdates(_0x543a19['body'],null))[_0xa477('0x23')](respondWithResult(_0xcb8c41,null))[_0xa477('0x41')](handleError(_0xcb8c41,null));};exports[_0xa477('0x22')]=function(_0x59b17a,_0x4fb38b){return db[_0xa477('0x29')][_0xa477('0x46')]({'where':{'id':_0x59b17a[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x4fb38b,null))[_0xa477('0x23')](removeEntity(_0x4fb38b,null))[_0xa477('0x41')](handleError(_0x4fb38b,null));};exports[_0xa477('0x49')]=function(_0x3f03c0,_0x596eb5,_0x53e55e){var _0x4052e0={};var _0x16f491={};var _0x2c1d27;var _0xadf7b9;return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3f03c0['params']['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x596eb5,null))[_0xa477('0x23')](function(_0x219417){if(_0x219417){_0x2c1d27=_0x219417;_0x16f491[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x4b')][_0xa477('0x44')]);_0x16f491['query']=_['keys'](_0x3f03c0[_0xa477('0x2e')]);_0x16f491[_0xa477('0x30')]=_[_0xa477('0x31')](_0x16f491['model'],_0x16f491[_0xa477('0x2e')]);_0x4052e0[_0xa477('0x32')]=_[_0xa477('0x31')](_0x16f491['model'],qs[_0xa477('0x33')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x33')]));_0x4052e0[_0xa477('0x32')]=_0x4052e0[_0xa477('0x32')][_0xa477('0x45')]?_0x4052e0[_0xa477('0x32')]:_0x16f491[_0xa477('0x2d')];_0x4052e0['order']=qs['sort'](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x37')]);_0x4052e0[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0x3f03c0['query'],_0x16f491[_0xa477('0x30')]));if(_0x3f03c0[_0xa477('0x2e')][_0xa477('0x39')]){_0x4052e0[_0xa477('0x38')]=_['merge'](_0x4052e0[_0xa477('0x38')],{'$or':_['map'](_0x4052e0['attributes'],function(_0x460ccf){var _0x2e20ca={};_0x2e20ca[_0x460ccf]={'$like':'%'+_0x3f03c0[_0xa477('0x2e')]['filter']+'%'};return _0x2e20ca;})});}_0x4052e0=_[_0xa477('0x3a')]({},_0x4052e0,_0x3f03c0['options']);return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})['then'](function(_0x1a0b6b){if(_0x1a0b6b){_0xadf7b9=_0x1a0b6b[_0xa477('0x45')];if(!_0x3f03c0[_0xa477('0x2e')]['hasOwnProperty'](_0xa477('0x35'))){_0x4052e0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x1c')]);_0x4052e0[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x3f03c0[_0xa477('0x2e')]['offset']);}return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})[_0xa477('0x23')](function(_0x31cde3){if(_0x31cde3){return _0x31cde3?{'count':_0xadf7b9,'rows':_0x31cde3}:null;}})[_0xa477('0x23')](respondWithResult(_0x596eb5,null))['catch'](handleError(_0x596eb5,null));};exports[_0xa477('0x4c')]=function(_0x5a4eb2,_0x48189b,_0x3df3bf){if(_0x5a4eb2[_0xa477('0x48')]['id']){delete _0x5a4eb2['body']['id'];}return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x5a4eb2[_0xa477('0x43')]['id']}})['then'](handleEntityNotFound(_0x48189b,null))[_0xa477('0x23')](function(_0x578d64){if(_0x578d64){_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4d')]=_0x578d64['id'];_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4e')]=integrations[_0xa477('0x4f')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')][_0xa477('0x2b')]);_0x5a4eb2[_0xa477('0x48')]['Descriptions']=integrations[_0xa477('0x50')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x5a4eb2[_0xa477('0x48')],{'include':[{'model':db[_0xa477('0x51')],'as':_0xa477('0x4e')},{'model':db[_0xa477('0x51')],'as':_0xa477('0x52')}]});}return null;})[_0xa477('0x23')](respondWithResult(_0x48189b,null))['catch'](handleError(_0x48189b,null));};exports[_0xa477('0x53')]=function(_0x3378a1,_0x1254fd,_0x4eb045){var _0x2b9139='';return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3378a1['params']['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x1254fd,null))[_0xa477('0x23')](function(_0x452834){if(_0x452834){_0x2b9139=_0x452834[_0xa477('0x54')];var _0x1a48a4=_0x2b9139[_0xa477('0x55')](-0x1);if(_0x1a48a4==='/'){_0x2b9139=_0x2b9139[_0xa477('0x56')](0x0,_0x2b9139['lastIndexOf'](_0x1a48a4));}return rp({'method':_0xa477('0x57'),'uri':util['format'](_0xa477('0x58'),_0x2b9139,_0xa477('0x59')),'headers':{'Authorization':util[_0xa477('0x5a')](_0xa477('0x5b'),new Buffer(util[_0xa477('0x5a')](_0xa477('0x5c'),_0x452834[_0xa477('0x5d')]))[_0xa477('0x5e')](_0xa477('0x5f')))},'json':!![]});}})['then'](function(_0x16fcec){if(_0x16fcec){var _0x47be0a=[_0xa477('0x60'),'subject',_0xa477('0x61'),'description',_0xa477('0x17'),_0xa477('0x62'),_0xa477('0x63'),_0xa477('0x64'),'ticket_type',_0xa477('0x63'),'company'];_[_0xa477('0x65')](_0x16fcec,function(_0x3c8b35){return _0x47be0a['includes'](_0x3c8b35[_0xa477('0x25')])||!_0x3c8b35[_0xa477('0x66')]&&_0x3c8b35[_0xa477('0x2b')]!==_0xa477('0x67')&&_0x3c8b35['type']!==_0xa477('0x68');});return{'count':_0x16fcec[_0xa477('0x45')],'rows':_[_0xa477('0x28')](_0x16fcec,function(_0x4596ce){return{'id':_0x4596ce[_0xa477('0x25')],'name':_0x4596ce[_0xa477('0x69')],'custom':!_0x4596ce[_0xa477('0x66')],'options':_0x4596ce['choices']?_[_0xa477('0x28')](_0x4596ce[_0xa477('0x6a')],function(_0x7a28a7){return{'name':_[_0xa477('0x6b')](_0x7a28a7),'value':_0x7a28a7};}):[]};})};}})['then'](respondWithResult(_0x1254fd,null))[_0xa477('0x41')](function(_0x23dd79){var _0xa25710=_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?0x1f4:_0x23dd79[_0xa477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa477('0x53'),_0xa25710,JSON['stringify'](_0x23dd79));delete _0x23dd79['name'];if(_0xa25710===0x191){_0xa25710=0x190;}_0x1254fd[_0xa477('0x17')](_0xa25710)[_0xa477('0x26')](_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?{'message':_0xa477('0x6e'),'statusCode':_0x23dd79[_0xa477('0x6d')]}:_0x23dd79);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 47590fc..a0296dd 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 _0x81fc=['define','FreshdeskAccount','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa8cb3e,_0x190c95){var _0x56e02e=function(_0xe4191a){while(--_0xe4191a){_0xa8cb3e['push'](_0xa8cb3e['shift']());}};_0x56e02e(++_0x190c95);}(_0x81fc,0x13a));var _0xc81f=function(_0x5ce3af,_0x461522){_0x5ce3af=_0x5ce3af-0x0;var _0x122b27=_0x81fc[_0x5ce3af];return _0x122b27;};'use strict';var _=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var logger=require(_0xc81f('0x2'))('api');var moment=require(_0xc81f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc81f('0x4'));var fs=require('fs');var path=require(_0xc81f('0x5'));var rimraf=require(_0xc81f('0x6'));var config=require(_0xc81f('0x7'));var attributes=require(_0xc81f('0x8'));var integrations=require(_0xc81f('0x9'));module[_0xc81f('0xa')]=function(_0x41dabb,_0x1c8358){return _0x41dabb[_0xc81f('0xb')](_0xc81f('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c57=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount'];(function(_0x1d6777,_0xaa85e){var _0x5cdef1=function(_0x411e8b){while(--_0x411e8b){_0x1d6777['push'](_0x1d6777['shift']());}};_0x5cdef1(++_0xaa85e);}(_0x3c57,0x1c8));var _0x73c5=function(_0x270ae1,_0xd6e2a3){_0x270ae1=_0x270ae1-0x0;var _0x1f6729=_0x3c57[_0x270ae1];return _0x1f6729;};'use strict';var _=require(_0x73c5('0x0'));var util=require(_0x73c5('0x1'));var logger=require(_0x73c5('0x2'))(_0x73c5('0x3'));var moment=require(_0x73c5('0x4'));var BPromise=require(_0x73c5('0x5'));var rp=require(_0x73c5('0x6'));var fs=require('fs');var path=require(_0x73c5('0x7'));var rimraf=require('rimraf');var config=require(_0x73c5('0x8'));var attributes=require(_0x73c5('0x9'));var integrations=require(_0x73c5('0xa'));module['exports']=function(_0x6fbe2e,_0x3b4662){return _0x6fbe2e['define'](_0x73c5('0xb'),attributes,{'tableName':_0x73c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 6c00cc3..4387567 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 _0xad86=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xad86,0x194));var _0x6ad8=function(_0x419a45,_0x1d94e5){_0x419a45=_0x419a45-0x0;var _0x23e394=_0xad86[_0x419a45];return _0x23e394;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecf3f,_0x44b48e,_0x44f61a){return new BPromise(function(_0x1f0fd3,_0x5cce0d){return client['request'](_0x1ecf3f,_0x44f61a)[_0x6ad8('0xa')](function(_0x164208){logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,_0x6ad8('0xd'));logger[_0x6ad8('0xe')](_0x6ad8('0xf'),_0x44b48e,_0x6ad8('0xd'),JSON[_0x6ad8('0x10')](_0x164208));if(_0x164208['error']){if(_0x164208['error']['code']===0x1f4){logger[_0x6ad8('0x11')](_0x6ad8('0xc'),_0x44b48e,_0x164208['error'][_0x6ad8('0x12')]);return _0x5cce0d(_0x164208['error'][_0x6ad8('0x12')]);}logger[_0x6ad8('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x44b48e,_0x164208[_0x6ad8('0x11')]['message']);return _0x1f0fd3(_0x164208[_0x6ad8('0x11')][_0x6ad8('0x12')]);}else{logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,'request\x20sent');_0x1f0fd3(_0x164208[_0x6ad8('0x13')][_0x6ad8('0x12')]);}})[_0x6ad8('0x14')](function(_0x300b8d){logger['error'](_0x6ad8('0xc'),_0x44b48e,_0x300b8d);_0x5cce0d(_0x300b8d);});});}exports[_0x6ad8('0x15')]=function(_0x4c2445){var _0x4404da=this;return new Promise(function(_0x4ef013,_0x1de457){return db[_0x6ad8('0x16')][_0x6ad8('0x17')]({'raw':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445['options'][_0x6ad8('0x19')]===undefined?!![]:![]:!![],'where':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1a')]||null:null,'attributes':_0x4c2445['options']?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1b')]||null:null,'limit':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1c')]||null:null,'include':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1d')]?_['map'](_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1d')],function(_0x5de250){return{'model':db[_0x5de250['model']],'as':_0x5de250['as'],'attributes':_0x5de250[_0x6ad8('0x1b')],'include':_0x5de250[_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x5de250[_0x6ad8('0x1d')],function(_0x1297e4){return{'model':db[_0x1297e4[_0x6ad8('0x1f')]],'as':_0x1297e4['as'],'attributes':_0x1297e4[_0x6ad8('0x1b')],'include':_0x1297e4[_0x6ad8('0x1d')]?_['map'](_0x1297e4['include'],function(_0x2303e1){return{'model':db[_0x2303e1[_0x6ad8('0x1f')]],'as':_0x2303e1['as'],'attributes':_0x2303e1[_0x6ad8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad8('0xa')](function(_0x503184){logger[_0x6ad8('0xb')]('GetFreshdeskAccount',_0x4c2445);logger[_0x6ad8('0xe')](_0x6ad8('0x15'),_0x4c2445,JSON[_0x6ad8('0x10')](_0x503184));_0x4ef013(_0x503184);})[_0x6ad8('0x14')](function(_0x42551a){logger[_0x6ad8('0x11')](_0x6ad8('0x15'),_0x42551a['message'],_0x4c2445);_0x1de457(_0x4404da['error'](0x1f4,_0x42551a[_0x6ad8('0x12')]));});});};exports[_0x6ad8('0x20')]=function(_0x4d2cc6){var _0x4ab967=this;return new Promise(function(_0x10eccd,_0x3b70a7){return db[_0x6ad8('0x16')][_0x6ad8('0x21')]({'raw':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6['options'][_0x6ad8('0x19')]===undefined?!![]:![]:!![],'where':_0x4d2cc6['options']?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1a')]||null:null,'attributes':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1b')]||null:null,'include':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1d')],function(_0x1e5360){return{'model':db[_0x1e5360['model']],'as':_0x1e5360['as'],'attributes':_0x1e5360[_0x6ad8('0x1b')],'include':_0x1e5360[_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x1e5360[_0x6ad8('0x1d')],function(_0x511986){return{'model':db[_0x511986[_0x6ad8('0x1f')]],'as':_0x511986['as'],'attributes':_0x511986[_0x6ad8('0x1b')],'include':_0x511986['include']?_['map'](_0x511986[_0x6ad8('0x1d')],function(_0x964b3a){return{'model':db[_0x964b3a[_0x6ad8('0x1f')]],'as':_0x964b3a['as'],'attributes':_0x964b3a[_0x6ad8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad8('0xa')](function(_0x4bc222){logger[_0x6ad8('0xb')](_0x6ad8('0x20'),_0x4d2cc6);logger[_0x6ad8('0xe')](_0x6ad8('0x20'),_0x4d2cc6,JSON[_0x6ad8('0x10')](_0x4bc222));_0x10eccd(_0x4bc222);})['catch'](function(_0x237091){logger['error'](_0x6ad8('0x20'),_0x237091[_0x6ad8('0x12')],_0x4d2cc6);_0x3b70a7(_0x4ab967[_0x6ad8('0x11')](0x1f4,_0x237091[_0x6ad8('0x12')]));});});}; \ No newline at end of file +var _0x8d94=['FreshdeskAccount','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','limit','map','include','attributes','model','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8d94,0x9c));var _0x48d9=function(_0x4fc699,_0x2f8b1b){_0x4fc699=_0x4fc699-0x0;var _0x501826=_0x8d94[_0x4fc699];return _0x501826;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48d9('0x0'));var fs=require('fs');var Redis=require(_0x48d9('0x1'));var db=require(_0x48d9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x48d9('0x3'))(_0x48d9('0x4'));var config=require(_0x48d9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x48d9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd20a,_0x109962,_0x5b45b2){return new BPromise(function(_0x508baa,_0x2f512c){return client['request'](_0x1bd20a,_0x5b45b2)[_0x48d9('0x7')](function(_0x213339){logger[_0x48d9('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x109962,_0x48d9('0x9'));logger[_0x48d9('0xa')](_0x48d9('0xb'),_0x109962,'request\x20sent',JSON[_0x48d9('0xc')](_0x213339));if(_0x213339['error']){if(_0x213339[_0x48d9('0xd')][_0x48d9('0xe')]===0x1f4){logger[_0x48d9('0xd')](_0x48d9('0xf'),_0x109962,_0x213339[_0x48d9('0xd')][_0x48d9('0x10')]);return _0x2f512c(_0x213339[_0x48d9('0xd')][_0x48d9('0x10')]);}logger[_0x48d9('0xd')](_0x48d9('0xf'),_0x109962,_0x213339[_0x48d9('0xd')]['message']);return _0x508baa(_0x213339[_0x48d9('0xd')][_0x48d9('0x10')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x109962,_0x48d9('0x9'));_0x508baa(_0x213339[_0x48d9('0x11')][_0x48d9('0x10')]);}})[_0x48d9('0x12')](function(_0x340878){logger[_0x48d9('0xd')](_0x48d9('0xf'),_0x109962,_0x340878);_0x2f512c(_0x340878);});});}exports['GetFreshdeskAccount']=function(_0xf94448){var _0xa1f839=this;return new Promise(function(_0x58f2ac,_0x1cb3fb){return db['FreshdeskAccount'][_0x48d9('0x13')]({'raw':_0xf94448[_0x48d9('0x14')]?_0xf94448[_0x48d9('0x14')][_0x48d9('0x15')]===undefined?!![]:![]:!![],'where':_0xf94448['options']?_0xf94448[_0x48d9('0x14')][_0x48d9('0x16')]||null:null,'attributes':_0xf94448[_0x48d9('0x14')]?_0xf94448[_0x48d9('0x14')]['attributes']||null:null,'limit':_0xf94448[_0x48d9('0x14')]?_0xf94448['options'][_0x48d9('0x17')]||null:null,'include':_0xf94448[_0x48d9('0x14')]?_0xf94448['options']['include']?_[_0x48d9('0x18')](_0xf94448[_0x48d9('0x14')][_0x48d9('0x19')],function(_0x4b7e1a){return{'model':db[_0x4b7e1a['model']],'as':_0x4b7e1a['as'],'attributes':_0x4b7e1a[_0x48d9('0x1a')],'include':_0x4b7e1a[_0x48d9('0x19')]?_[_0x48d9('0x18')](_0x4b7e1a['include'],function(_0x4f58fd){return{'model':db[_0x4f58fd[_0x48d9('0x1b')]],'as':_0x4f58fd['as'],'attributes':_0x4f58fd[_0x48d9('0x1a')],'include':_0x4f58fd[_0x48d9('0x19')]?_[_0x48d9('0x18')](_0x4f58fd['include'],function(_0x266545){return{'model':db[_0x266545[_0x48d9('0x1b')]],'as':_0x266545['as'],'attributes':_0x266545['attributes']};}):[]};}):[]};}):[]:[]})[_0x48d9('0x7')](function(_0x5c793d){logger[_0x48d9('0x8')](_0x48d9('0x1c'),_0xf94448);logger[_0x48d9('0xa')](_0x48d9('0x1c'),_0xf94448,JSON[_0x48d9('0xc')](_0x5c793d));_0x58f2ac(_0x5c793d);})[_0x48d9('0x12')](function(_0x46d35a){logger[_0x48d9('0xd')]('GetFreshdeskAccount',_0x46d35a[_0x48d9('0x10')],_0xf94448);_0x1cb3fb(_0xa1f839[_0x48d9('0xd')](0x1f4,_0x46d35a[_0x48d9('0x10')]));});});};exports[_0x48d9('0x1d')]=function(_0x2d17b5){var _0x5e3b58=this;return new Promise(function(_0x1f518d,_0x4381d9){return db[_0x48d9('0x1e')]['find']({'raw':_0x2d17b5['options']?_0x2d17b5[_0x48d9('0x14')][_0x48d9('0x15')]===undefined?!![]:![]:!![],'where':_0x2d17b5[_0x48d9('0x14')]?_0x2d17b5['options'][_0x48d9('0x16')]||null:null,'attributes':_0x2d17b5[_0x48d9('0x14')]?_0x2d17b5[_0x48d9('0x14')]['attributes']||null:null,'include':_0x2d17b5['options']?_0x2d17b5[_0x48d9('0x14')][_0x48d9('0x19')]?_[_0x48d9('0x18')](_0x2d17b5[_0x48d9('0x14')][_0x48d9('0x19')],function(_0x1ebe97){return{'model':db[_0x1ebe97[_0x48d9('0x1b')]],'as':_0x1ebe97['as'],'attributes':_0x1ebe97[_0x48d9('0x1a')],'include':_0x1ebe97[_0x48d9('0x19')]?_[_0x48d9('0x18')](_0x1ebe97[_0x48d9('0x19')],function(_0x1a7bf2){return{'model':db[_0x1a7bf2['model']],'as':_0x1a7bf2['as'],'attributes':_0x1a7bf2['attributes'],'include':_0x1a7bf2[_0x48d9('0x19')]?_[_0x48d9('0x18')](_0x1a7bf2[_0x48d9('0x19')],function(_0x371ade){return{'model':db[_0x371ade[_0x48d9('0x1b')]],'as':_0x371ade['as'],'attributes':_0x371ade[_0x48d9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x48d9('0x7')](function(_0x18d864){logger[_0x48d9('0x8')](_0x48d9('0x1d'),_0x2d17b5);logger['debug']('ShowFreshdeskAccount',_0x2d17b5,JSON[_0x48d9('0xc')](_0x18d864));_0x1f518d(_0x18d864);})[_0x48d9('0x12')](function(_0x38f3bb){logger['error'](_0x48d9('0x1d'),_0x38f3bb['message'],_0x2d17b5);_0x4381d9(_0x5e3b58['error'](0x1f4,_0x38f3bb['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c011fcc..00bd6e2 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 _0x658b=['getTags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x5a8ca0,_0x145ad1){var _0x23b212=function(_0x360d10){while(--_0x360d10){_0x5a8ca0['push'](_0x5a8ca0['shift']());}};_0x23b212(++_0x145ad1);}(_0x658b,0xb0));var _0xb658=function(_0x5b4c9d,_0x32380c){_0x5b4c9d=_0x5b4c9d-0x0;var _0x32d062=_0x658b[_0x5b4c9d];return _0x32d062;};'use strict';var multer=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var path=require(_0xb658('0x2'));var timeout=require(_0xb658('0x3'));var express=require(_0xb658('0x4'));var router=express[_0xb658('0x5')]();var fs_extra=require(_0xb658('0x6'));var auth=require(_0xb658('0x7'));var interaction=require(_0xb658('0x8'));var config=require(_0xb658('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xb658('0xa')](),controller[_0xb658('0xb')]);router[_0xb658('0xc')](_0xb658('0xd'),auth['isAuthenticated'](),controller[_0xb658('0xe')]);router[_0xb658('0xc')](_0xb658('0xf'),auth[_0xb658('0xa')](),controller[_0xb658('0x10')]);router[_0xb658('0xc')]('/:id/subjects',auth[_0xb658('0xa')](),controller['getSubjects']);router[_0xb658('0xc')](_0xb658('0x11'),auth[_0xb658('0xa')](),controller[_0xb658('0x12')]);router[_0xb658('0xc')](_0xb658('0x13'),auth[_0xb658('0xa')](),controller[_0xb658('0x14')]);router[_0xb658('0x15')]('/',auth[_0xb658('0xa')](),controller[_0xb658('0x16')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0xb658('0x17')]);router[_0xb658('0x18')]('/:id',auth[_0xb658('0xa')](),controller[_0xb658('0x19')]);router[_0xb658('0x1a')](_0xb658('0xd'),auth['isAuthenticated'](),controller[_0xb658('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xfe58=['getTags','post','create','setTags','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1046ba,_0x17699d){var _0x31ae08=function(_0x4c737d){while(--_0x4c737d){_0x1046ba['push'](_0x1046ba['shift']());}};_0x31ae08(++_0x17699d);}(_0xfe58,0x1e8));var _0x8fe5=function(_0x5ad5ca,_0x5f33fa){_0x5ad5ca=_0x5ad5ca-0x0;var _0x54f99b=_0xfe58[_0x5ad5ca];return _0x54f99b;};'use strict';var multer=require(_0x8fe5('0x0'));var util=require('util');var path=require(_0x8fe5('0x1'));var timeout=require(_0x8fe5('0x2'));var express=require('express');var router=express[_0x8fe5('0x3')]();var fs_extra=require(_0x8fe5('0x4'));var auth=require(_0x8fe5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8fe5('0x6'));router[_0x8fe5('0x7')]('/',auth[_0x8fe5('0x8')](),controller['index']);router[_0x8fe5('0x7')](_0x8fe5('0x9'),auth[_0x8fe5('0x8')](),controller['show']);router['get'](_0x8fe5('0xa'),auth[_0x8fe5('0x8')](),controller[_0x8fe5('0xb')]);router[_0x8fe5('0x7')](_0x8fe5('0xc'),auth[_0x8fe5('0x8')](),controller[_0x8fe5('0xd')]);router[_0x8fe5('0x7')](_0x8fe5('0xe'),auth[_0x8fe5('0x8')](),controller['getDescriptions']);router[_0x8fe5('0x7')](_0x8fe5('0xf'),auth[_0x8fe5('0x8')](),controller[_0x8fe5('0x10')]);router[_0x8fe5('0x11')]('/',auth[_0x8fe5('0x8')](),controller[_0x8fe5('0x12')]);router[_0x8fe5('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8fe5('0x13')]);router[_0x8fe5('0x14')](_0x8fe5('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x8fe5('0x15')](_0x8fe5('0x9'),auth[_0x8fe5('0x8')](),controller[_0x8fe5('0x16')]);module[_0x8fe5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4ce9e0e..63047a4 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 _0x4bfa=['sequelize','exports','STRING'];(function(_0x258a40,_0x19e206){var _0xee8e2=function(_0x152c0b){while(--_0x152c0b){_0x258a40['push'](_0x258a40['shift']());}};_0xee8e2(++_0x19e206);}(_0x4bfa,0xff));var _0xa4bf=function(_0x1a681c,_0x4decba){_0x1a681c=_0x1a681c-0x0;var _0x45643c=_0x4bfa[_0x1a681c];return _0x45643c;};'use strict';var Sequelize=require(_0xa4bf('0x0'));module[_0xa4bf('0x1')]={'name':{'type':Sequelize[_0xa4bf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa1a6=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1a6,0x77));var _0x6a1a=function(_0xe7281f,_0x2d77c3){_0xe7281f=_0xe7281f-0x0;var _0x90dc99=_0xa1a6[_0xe7281f];return _0x90dc99;};'use strict';var Sequelize=require(_0x6a1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a1a('0x1')]},'description':{'type':Sequelize[_0x6a1a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f6f7914..7edbea5 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 _0xf671=['error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy'];(function(_0x499344,_0x44654e){var _0x559fdc=function(_0x72299d){while(--_0x72299d){_0x499344['push'](_0x499344['shift']());}};_0x559fdc(++_0x44654e);}(_0xf671,0x118));var _0x1f67=function(_0x55ee74,_0x487aff){_0x55ee74=_0x55ee74-0x0;var _0x1a70d4=_0xf671[_0x55ee74];return _0x1a70d4;};'use strict';var emlformat=require(_0x1f67('0x0'));var rimraf=require(_0x1f67('0x1'));var zipdir=require(_0x1f67('0x2'));var jsonpatch=require(_0x1f67('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f67('0x4'));var util=require(_0x1f67('0x5'));var path=require('path');var sox=require(_0x1f67('0x6'));var csv=require(_0x1f67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f67('0x8'));var squel=require(_0x1f67('0x9'));var crypto=require(_0x1f67('0xa'));var jsforce=require(_0x1f67('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f67('0x7'));var querystring=require(_0x1f67('0xc'));var Papa=require(_0x1f67('0xd'));var Redis=require(_0x1f67('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f67('0xf'));var hardwareService=require(_0x1f67('0x10'));var logger=require(_0x1f67('0x11'))(_0x1f67('0x12'));var utils=require(_0x1f67('0x13'));var config=require(_0x1f67('0x14'));var licenseUtil=require(_0x1f67('0x15'));var db=require(_0x1f67('0x16'))['db'];function respondWithStatusCode(_0x7bdbad,_0x86bdfa){_0x86bdfa=_0x86bdfa||0xcc;return function(_0xa71e93){if(_0xa71e93){return _0x7bdbad['sendStatus'](_0x86bdfa);}return _0x7bdbad[_0x1f67('0x17')](_0x86bdfa)[_0x1f67('0x18')]();};}function respondWithResult(_0x2d312b,_0x431211){_0x431211=_0x431211||0xc8;return function(_0x59e08a){if(_0x59e08a){return _0x2d312b['status'](_0x431211)[_0x1f67('0x19')](_0x59e08a);}};}function respondWithFilteredResult(_0x3c1436,_0x230464){return function(_0x598945){if(_0x598945){var _0x152d45=typeof _0x230464['offset']==='undefined'&&typeof _0x230464['limit']===_0x1f67('0x1a');var _0x202d2e=_0x598945[_0x1f67('0x1b')];var _0x587fce=_0x152d45?0x0:_0x230464['offset'];var _0x5824e3=_0x152d45?_0x598945['count']:_0x230464[_0x1f67('0x1c')]+_0x230464[_0x1f67('0x1d')];var _0x46556c;if(_0x5824e3>=_0x202d2e){_0x5824e3=_0x202d2e;_0x46556c=0xc8;}else{_0x46556c=0xce;}_0x3c1436['status'](_0x46556c);return _0x3c1436['set']('Content-Range',_0x587fce+'-'+_0x5824e3+'/'+_0x202d2e)[_0x1f67('0x19')](_0x598945);}return null;};}function patchUpdates(_0x70ff29){return function(_0x1f3279){try{jsonpatch[_0x1f67('0x1e')](_0x1f3279,_0x70ff29,!![]);}catch(_0x700872){return BPromise[_0x1f67('0x1f')](_0x700872);}return _0x1f3279[_0x1f67('0x20')]();};}function saveUpdates(_0x4211b4,_0x53336a){return function(_0x52b521){if(_0x52b521){return _0x52b521[_0x1f67('0x21')](_0x4211b4)[_0x1f67('0x22')](function(_0x5349c9){return _0x5349c9;});}return null;};}function removeEntity(_0x453209,_0x5612aa){return function(_0x14f177){if(_0x14f177){return _0x14f177[_0x1f67('0x23')]()[_0x1f67('0x22')](function(){_0x453209[_0x1f67('0x17')](0xcc)[_0x1f67('0x18')]();});}};}function handleEntityNotFound(_0x40f748,_0x43aed6){return function(_0x1bcc3e){if(!_0x1bcc3e){_0x40f748['sendStatus'](0x194);}return _0x1bcc3e;};}function handleError(_0x2db57f,_0x1fea10){_0x1fea10=_0x1fea10||0x1f4;return function(_0x3511c1){logger[_0x1f67('0x24')](_0x3511c1[_0x1f67('0x25')]);if(_0x3511c1[_0x1f67('0x26')]){delete _0x3511c1[_0x1f67('0x26')];}_0x2db57f[_0x1f67('0x17')](_0x1fea10)['send'](_0x3511c1);};}exports[_0x1f67('0x27')]=function(_0x4e8ea5,_0x4cab3b){var _0x9bc50b={},_0x39d00f={},_0x223eb4={'count':0x0,'rows':[]};var _0x47f702=_[_0x1f67('0x28')](db[_0x1f67('0x29')][_0x1f67('0x2a')],function(_0x1dcc00){return{'name':_0x1dcc00['fieldName'],'type':_0x1dcc00[_0x1f67('0x2b')]['key']};});_0x39d00f[_0x1f67('0x2c')]=_['map'](_0x47f702,'name');_0x39d00f[_0x1f67('0x2d')]=_[_0x1f67('0x2e')](_0x4e8ea5['query']);_0x39d00f[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x39d00f[_0x1f67('0x2c')],_0x39d00f[_0x1f67('0x2d')]);_0x9bc50b[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x39d00f[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x9bc50b[_0x1f67('0x31')]=_0x9bc50b[_0x1f67('0x31')]['length']?_0x9bc50b[_0x1f67('0x31')]:_0x39d00f[_0x1f67('0x2c')];if(!_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x33')]('nolimit')){_0x9bc50b[_0x1f67('0x1d')]=qs['limit'](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x9bc50b[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x1c')]);}_0x9bc50b[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x35')]);_0x9bc50b[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x4e8ea5['query'],_0x39d00f[_0x1f67('0x2f')]),_0x47f702);if(_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x38')]){_0x9bc50b['where']=_[_0x1f67('0x39')](_0x9bc50b[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x47f702,function(_0x39579d){if(_0x39579d[_0x1f67('0x2b')]!==_0x1f67('0x3a')){var _0x5c966c={};_0x5c966c[_0x39579d[_0x1f67('0x26')]]={'$like':'%'+_0x4e8ea5['query'][_0x1f67('0x38')]+'%'};return _0x5c966c;}})});}_0x9bc50b=_[_0x1f67('0x39')]({},_0x9bc50b,_0x4e8ea5[_0x1f67('0x3b')]);var _0x6e3b24={'where':_0x9bc50b[_0x1f67('0x36')]};return db[_0x1f67('0x29')]['count'](_0x6e3b24)[_0x1f67('0x22')](function(_0x2d8e45){_0x223eb4[_0x1f67('0x1b')]=_0x2d8e45;if(_0x4e8ea5[_0x1f67('0x2d')]['includeAll']){_0x9bc50b[_0x1f67('0x3c')]=[{'all':!![]}];}return db[_0x1f67('0x29')][_0x1f67('0x3d')](_0x9bc50b);})[_0x1f67('0x22')](function(_0x3b0a01){_0x223eb4[_0x1f67('0x3e')]=_0x3b0a01;return _0x223eb4;})[_0x1f67('0x22')](respondWithFilteredResult(_0x4cab3b,_0x9bc50b))[_0x1f67('0x3f')](handleError(_0x4cab3b,null));};exports[_0x1f67('0x40')]=function(_0x4db9f0,_0x199bab){var _0xe1c82b={'raw':![],'where':{'id':_0x4db9f0[_0x1f67('0x41')]['id']}},_0x1b3c7c={};_0x1b3c7c['model']=_['keys'](db[_0x1f67('0x29')]['rawAttributes']);_0x1b3c7c[_0x1f67('0x2d')]=_['keys'](_0x4db9f0['query']);_0x1b3c7c[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x1b3c7c[_0x1f67('0x2c')],_0x1b3c7c['query']);_0xe1c82b[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x1b3c7c[_0x1f67('0x2c')],qs['fields'](_0x4db9f0['query'][_0x1f67('0x32')]));_0xe1c82b[_0x1f67('0x31')]=_0xe1c82b[_0x1f67('0x31')][_0x1f67('0x42')]?_0xe1c82b[_0x1f67('0x31')]:_0x1b3c7c[_0x1f67('0x2c')];if(_0x4db9f0['query']['includeAll']){_0xe1c82b[_0x1f67('0x3c')]=[{'all':!![]}];}_0xe1c82b=_[_0x1f67('0x39')]({},_0xe1c82b,_0x4db9f0['options']);return db['FreshdeskConfiguration'][_0x1f67('0x43')](_0xe1c82b)['then'](handleEntityNotFound(_0x199bab,null))[_0x1f67('0x22')](respondWithResult(_0x199bab,null))[_0x1f67('0x3f')](handleError(_0x199bab,null));};exports[_0x1f67('0x44')]=function(_0x4698b7,_0x4bbc1e){return db['FreshdeskConfiguration'][_0x1f67('0x44')](_0x4698b7[_0x1f67('0x45')],{})[_0x1f67('0x22')](respondWithResult(_0x4bbc1e,0xc9))['catch'](handleError(_0x4bbc1e,null));};exports[_0x1f67('0x21')]=function(_0x51e278,_0x40ee2f){if(_0x51e278[_0x1f67('0x45')]['id']){delete _0x51e278['body']['id'];}return db[_0x1f67('0x29')][_0x1f67('0x43')]({'where':{'id':_0x51e278['params']['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x40ee2f,null))['then'](saveUpdates(_0x51e278['body'],null))[_0x1f67('0x22')](respondWithResult(_0x40ee2f,null))[_0x1f67('0x3f')](handleError(_0x40ee2f,null));};exports[_0x1f67('0x23')]=function(_0x59e107,_0x17f20b){return db[_0x1f67('0x29')][_0x1f67('0x43')]({'where':{'id':_0x59e107[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x17f20b,null))['then'](removeEntity(_0x17f20b,null))[_0x1f67('0x3f')](handleError(_0x17f20b,null));};exports[_0x1f67('0x46')]=function(_0x5b2b45,_0x1d5c2d,_0x283ee9){var _0x41e5bc={};var _0x35b63e={};var _0x14be1b;var _0x3777b4;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x5b2b45['params']['id']}})['then'](handleEntityNotFound(_0x1d5c2d,null))[_0x1f67('0x22')](function(_0x2ae7f6){if(_0x2ae7f6){_0x14be1b=_0x2ae7f6;_0x35b63e[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db[_0x1f67('0x48')]['rawAttributes']);_0x35b63e['query']=_['keys'](_0x5b2b45['query']);_0x35b63e['filters']=_['intersection'](_0x35b63e['model'],_0x35b63e[_0x1f67('0x2d')]);_0x41e5bc[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x35b63e[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x41e5bc[_0x1f67('0x31')]=_0x41e5bc[_0x1f67('0x31')][_0x1f67('0x42')]?_0x41e5bc[_0x1f67('0x31')]:_0x35b63e[_0x1f67('0x2c')];_0x41e5bc['order']=qs['sort'](_0x5b2b45['query'][_0x1f67('0x35')]);_0x41e5bc['where']=qs[_0x1f67('0x2f')](_['pick'](_0x5b2b45['query'],_0x35b63e[_0x1f67('0x2f')]));if(_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x38')]){_0x41e5bc[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x41e5bc[_0x1f67('0x36')],{'$or':_['map'](_0x41e5bc[_0x1f67('0x31')],function(_0x277b90){var _0x12d855={};_0x12d855[_0x277b90]={'$like':'%'+_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x38')]+'%'};return _0x12d855;})});}_0x41e5bc=_[_0x1f67('0x39')]({},_0x41e5bc,_0x5b2b45['options']);return _0x14be1b['getFields'](_0x41e5bc);}})[_0x1f67('0x22')](function(_0xdc1274){if(_0xdc1274){_0x3777b4=_0xdc1274[_0x1f67('0x42')];if(!_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x41e5bc[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x5b2b45[_0x1f67('0x2d')]['limit']);_0x41e5bc[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x5b2b45[_0x1f67('0x2d')]['offset']);}return _0x14be1b[_0x1f67('0x46')](_0x41e5bc);}})[_0x1f67('0x22')](function(_0x5e85be){if(_0x5e85be){return _0x5e85be?{'count':_0x3777b4,'rows':_0x5e85be}:null;}})[_0x1f67('0x22')](respondWithResult(_0x1d5c2d,null))[_0x1f67('0x3f')](handleError(_0x1d5c2d,null));};exports['getSubjects']=function(_0x45aef3,_0x150249,_0x4c3bb0){var _0x384f0d={};var _0x933da0={};var _0x4ac781;var _0x1a9415;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x45aef3['params']['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x150249,null))[_0x1f67('0x22')](function(_0x3a030b){if(_0x3a030b){_0x4ac781=_0x3a030b;_0x933da0[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db['FreshdeskField']['rawAttributes']);_0x933da0['query']=_[_0x1f67('0x2e')](_0x45aef3[_0x1f67('0x2d')]);_0x933da0[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x933da0[_0x1f67('0x2c')],_0x933da0[_0x1f67('0x2d')]);_0x384f0d[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x933da0[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x384f0d['attributes']=_0x384f0d['attributes']['length']?_0x384f0d[_0x1f67('0x31')]:_0x933da0['model'];_0x384f0d[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x45aef3['query']['sort']);_0x384f0d[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x45aef3[_0x1f67('0x2d')],_0x933da0['filters']));if(_0x45aef3[_0x1f67('0x2d')]['filter']){_0x384f0d['where']=_[_0x1f67('0x39')](_0x384f0d[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x384f0d['attributes'],function(_0x3b1077){var _0x5db688={};_0x5db688[_0x3b1077]={'$like':'%'+_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x38')]+'%'};return _0x5db688;})});}_0x384f0d=_[_0x1f67('0x39')]({},_0x384f0d,_0x45aef3['options']);return _0x4ac781[_0x1f67('0x4a')](_0x384f0d);}})[_0x1f67('0x22')](function(_0x4d2ef8){if(_0x4d2ef8){_0x1a9415=_0x4d2ef8[_0x1f67('0x42')];if(!_0x45aef3['query'][_0x1f67('0x33')](_0x1f67('0x49'))){_0x384f0d[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x45aef3[_0x1f67('0x2d')]['limit']);_0x384f0d[_0x1f67('0x1c')]=qs['offset'](_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x4ac781[_0x1f67('0x4a')](_0x384f0d);}})['then'](function(_0x4530b2){if(_0x4530b2){return _0x4530b2?{'count':_0x1a9415,'rows':_0x4530b2}:null;}})[_0x1f67('0x22')](respondWithResult(_0x150249,null))[_0x1f67('0x3f')](handleError(_0x150249,null));};exports[_0x1f67('0x4b')]=function(_0x25cda3,_0x5f0f1c,_0x108d20){var _0x283dd4={};var _0x5f1294={};var _0x18d9c5;var _0x101e00;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x25cda3[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x5f0f1c,null))[_0x1f67('0x22')](function(_0x8af54){if(_0x8af54){_0x18d9c5=_0x8af54;_0x5f1294[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db[_0x1f67('0x48')]['rawAttributes']);_0x5f1294[_0x1f67('0x2d')]=_['keys'](_0x25cda3['query']);_0x5f1294['filters']=_['intersection'](_0x5f1294['model'],_0x5f1294[_0x1f67('0x2d')]);_0x283dd4['attributes']=_[_0x1f67('0x30')](_0x5f1294['model'],qs[_0x1f67('0x32')](_0x25cda3['query'][_0x1f67('0x32')]));_0x283dd4[_0x1f67('0x31')]=_0x283dd4[_0x1f67('0x31')][_0x1f67('0x42')]?_0x283dd4['attributes']:_0x5f1294[_0x1f67('0x2c')];_0x283dd4[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x35')]);_0x283dd4[_0x1f67('0x36')]=qs['filters'](_[_0x1f67('0x37')](_0x25cda3[_0x1f67('0x2d')],_0x5f1294['filters']));if(_0x25cda3['query']['filter']){_0x283dd4[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x283dd4[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x283dd4[_0x1f67('0x31')],function(_0x3e65de){var _0x420364={};_0x420364[_0x3e65de]={'$like':'%'+_0x25cda3[_0x1f67('0x2d')]['filter']+'%'};return _0x420364;})});}_0x283dd4=_['merge']({},_0x283dd4,_0x25cda3['options']);return _0x18d9c5[_0x1f67('0x4b')](_0x283dd4);}})[_0x1f67('0x22')](function(_0x474d7d){if(_0x474d7d){_0x101e00=_0x474d7d[_0x1f67('0x42')];if(!_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x283dd4[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x283dd4[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x18d9c5[_0x1f67('0x4b')](_0x283dd4);}})[_0x1f67('0x22')](function(_0x1f00fa){if(_0x1f00fa){return _0x1f00fa?{'count':_0x101e00,'rows':_0x1f00fa}:null;}})[_0x1f67('0x22')](respondWithResult(_0x5f0f1c,null))['catch'](handleError(_0x5f0f1c,null));};exports[_0x1f67('0x4c')]=function(_0x34dc8d,_0x38446f,_0x140939){var _0x33bd2e={};var _0x4368dc={};var _0x277e91;var _0x5df314;return db['FreshdeskConfiguration'][_0x1f67('0x47')]({'where':{'id':_0x34dc8d[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x38446f,null))['then'](function(_0x5a2317){if(_0x5a2317){_0x277e91=_0x5a2317;_0x4368dc['model']=_[_0x1f67('0x2e')](db[_0x1f67('0x4d')][_0x1f67('0x2a')]);_0x4368dc['query']=_[_0x1f67('0x2e')](_0x34dc8d[_0x1f67('0x2d')]);_0x4368dc['filters']=_['intersection'](_0x4368dc[_0x1f67('0x2c')],_0x4368dc[_0x1f67('0x2d')]);_0x33bd2e['attributes']=_[_0x1f67('0x30')](_0x4368dc[_0x1f67('0x2c')],qs['fields'](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x33bd2e[_0x1f67('0x31')]=_0x33bd2e[_0x1f67('0x31')][_0x1f67('0x42')]?_0x33bd2e[_0x1f67('0x31')]:_0x4368dc[_0x1f67('0x2c')];_0x33bd2e['order']=qs['sort'](_0x34dc8d['query'][_0x1f67('0x35')]);_0x33bd2e[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x34dc8d['query'],_0x4368dc[_0x1f67('0x2f')]));if(_0x34dc8d['query'][_0x1f67('0x38')]){_0x33bd2e[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x33bd2e['where'],{'$or':_[_0x1f67('0x28')](_0x33bd2e[_0x1f67('0x31')],function(_0x723917){var _0x3c79b4={};_0x3c79b4[_0x723917]={'$like':'%'+_0x34dc8d[_0x1f67('0x2d')]['filter']+'%'};return _0x3c79b4;})});}_0x33bd2e=_[_0x1f67('0x39')]({},_0x33bd2e,_0x34dc8d['options']);return _0x277e91['getTags'](_0x33bd2e);}})[_0x1f67('0x22')](function(_0x4b37a4){if(_0x4b37a4){_0x5df314=_0x4b37a4[_0x1f67('0x42')];if(!_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x33bd2e[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x33bd2e[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x277e91[_0x1f67('0x4c')](_0x33bd2e);}})['then'](function(_0x37b5b1){if(_0x37b5b1){return _0x37b5b1?{'count':_0x5df314,'rows':_0x37b5b1}:null;}})['then'](respondWithResult(_0x38446f,null))[_0x1f67('0x3f')](handleError(_0x38446f,null));};exports[_0x1f67('0x4e')]=function(_0x3bfedb,_0x3bb857,_0xa0fbfb){if(_0x3bfedb[_0x1f67('0x45')]['id']){delete _0x3bfedb[_0x1f67('0x45')]['id'];}return db[_0x1f67('0x29')]['findOne']({'where':{'id':_0x3bfedb[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x3bb857,null))[_0x1f67('0x22')](function(_0x54fe53){if(_0x54fe53){return _0x54fe53[_0x1f67('0x4e')](_0x3bfedb[_0x1f67('0x45')]['ids']||[]);}return null;})[_0x1f67('0x22')](respondWithResult(_0x3bb857,null))[_0x1f67('0x3f')](handleError(_0x3bb857,null));}; \ No newline at end of file +var _0x0ca4=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','undefined','count','offset','set','Content-Range','apply','then','destroy','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','key','query','filters','model','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','attributes','find','body','update','findOne','FreshdeskField','getFields','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','rimraf','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4c978c,_0xbd7d69){var _0x48db9c=function(_0x4127c8){while(--_0x4127c8){_0x4c978c['push'](_0x4c978c['shift']());}};_0x48db9c(++_0xbd7d69);}(_0x0ca4,0x1c4));var _0x40ca=function(_0x2ca6db,_0x11094d){_0x2ca6db=_0x2ca6db-0x0;var _0x526a86=_0x0ca4[_0x2ca6db];return _0x526a86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x40ca('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40ca('0x2'));var path=require('path');var sox=require(_0x40ca('0x3'));var csv=require(_0x40ca('0x4'));var ejs=require(_0x40ca('0x5'));var fs=require('fs');var fs_extra=require(_0x40ca('0x6'));var _=require(_0x40ca('0x7'));var squel=require('squel');var crypto=require(_0x40ca('0x8'));var jsforce=require(_0x40ca('0x9'));var deskjs=require(_0x40ca('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40ca('0xb'));var Papa=require(_0x40ca('0xc'));var Redis=require(_0x40ca('0xd'));var authService=require(_0x40ca('0xe'));var qs=require(_0x40ca('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40ca('0x10'));var logger=require(_0x40ca('0x11'))(_0x40ca('0x12'));var utils=require(_0x40ca('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x40ca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd0e38a,_0xd78c24){_0xd78c24=_0xd78c24||0xcc;return function(_0xde102e){if(_0xde102e){return _0xd0e38a[_0x40ca('0x15')](_0xd78c24);}return _0xd0e38a['status'](_0xd78c24)[_0x40ca('0x16')]();};}function respondWithResult(_0x269928,_0x3c6be3){_0x3c6be3=_0x3c6be3||0xc8;return function(_0x4a77ed){if(_0x4a77ed){return _0x269928[_0x40ca('0x17')](_0x3c6be3)['json'](_0x4a77ed);}};}function respondWithFilteredResult(_0x572d41,_0x2744a2){return function(_0x8a5022){if(_0x8a5022){var _0x564c80=typeof _0x2744a2['offset']===_0x40ca('0x18')&&typeof _0x2744a2['limit']===_0x40ca('0x18');var _0x12013e=_0x8a5022[_0x40ca('0x19')];var _0x315db9=_0x564c80?0x0:_0x2744a2[_0x40ca('0x1a')];var _0xcb2ade=_0x564c80?_0x8a5022['count']:_0x2744a2[_0x40ca('0x1a')]+_0x2744a2['limit'];var _0x40c7ca;if(_0xcb2ade>=_0x12013e){_0xcb2ade=_0x12013e;_0x40c7ca=0xc8;}else{_0x40c7ca=0xce;}_0x572d41[_0x40ca('0x17')](_0x40c7ca);return _0x572d41[_0x40ca('0x1b')](_0x40ca('0x1c'),_0x315db9+'-'+_0xcb2ade+'/'+_0x12013e)['json'](_0x8a5022);}return null;};}function patchUpdates(_0x21a033){return function(_0x3c7b94){try{jsonpatch[_0x40ca('0x1d')](_0x3c7b94,_0x21a033,!![]);}catch(_0x595432){return BPromise['reject'](_0x595432);}return _0x3c7b94['save']();};}function saveUpdates(_0x30744c,_0x1352e7){return function(_0x4fe841){if(_0x4fe841){return _0x4fe841['update'](_0x30744c)[_0x40ca('0x1e')](function(_0x3ce2a0){return _0x3ce2a0;});}return null;};}function removeEntity(_0x283d55,_0x409816){return function(_0x1958cc){if(_0x1958cc){return _0x1958cc[_0x40ca('0x1f')]()[_0x40ca('0x1e')](function(){_0x283d55['status'](0xcc)[_0x40ca('0x16')]();});}};}function handleEntityNotFound(_0x2f6e85,_0x120816){return function(_0x430d79){if(!_0x430d79){_0x2f6e85[_0x40ca('0x15')](0x194);}return _0x430d79;};}function handleError(_0x170cd0,_0xf2e9c4){_0xf2e9c4=_0xf2e9c4||0x1f4;return function(_0x579f1a){logger['error'](_0x579f1a[_0x40ca('0x20')]);if(_0x579f1a[_0x40ca('0x21')]){delete _0x579f1a[_0x40ca('0x21')];}_0x170cd0[_0x40ca('0x17')](_0xf2e9c4)['send'](_0x579f1a);};}exports[_0x40ca('0x22')]=function(_0x1cf1ae,_0x4458c4){var _0xc24fad={},_0x97b6d1={},_0x25a8ef={'count':0x0,'rows':[]};var _0x50d807=_['map'](db[_0x40ca('0x23')][_0x40ca('0x24')],function(_0x1bc0d4){return{'name':_0x1bc0d4[_0x40ca('0x25')],'type':_0x1bc0d4['type'][_0x40ca('0x26')]};});_0x97b6d1['model']=_['map'](_0x50d807,_0x40ca('0x21'));_0x97b6d1['query']=_['keys'](_0x1cf1ae[_0x40ca('0x27')]);_0x97b6d1[_0x40ca('0x28')]=_['intersection'](_0x97b6d1[_0x40ca('0x29')],_0x97b6d1[_0x40ca('0x27')]);_0xc24fad['attributes']=_[_0x40ca('0x2a')](_0x97b6d1[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0x1cf1ae[_0x40ca('0x27')]['fields']));_0xc24fad['attributes']=_0xc24fad['attributes'][_0x40ca('0x2c')]?_0xc24fad['attributes']:_0x97b6d1[_0x40ca('0x29')];if(!_0x1cf1ae[_0x40ca('0x27')][_0x40ca('0x2d')](_0x40ca('0x2e'))){_0xc24fad[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x1cf1ae[_0x40ca('0x27')][_0x40ca('0x2f')]);_0xc24fad['offset']=qs[_0x40ca('0x1a')](_0x1cf1ae[_0x40ca('0x27')]['offset']);}_0xc24fad['order']=qs[_0x40ca('0x30')](_0x1cf1ae[_0x40ca('0x27')][_0x40ca('0x30')]);_0xc24fad[_0x40ca('0x31')]=qs['filters'](_[_0x40ca('0x32')](_0x1cf1ae['query'],_0x97b6d1['filters']),_0x50d807);if(_0x1cf1ae['query'][_0x40ca('0x33')]){_0xc24fad[_0x40ca('0x31')]=_[_0x40ca('0x34')](_0xc24fad[_0x40ca('0x31')],{'$or':_[_0x40ca('0x35')](_0x50d807,function(_0x48c023){if(_0x48c023[_0x40ca('0x36')]!==_0x40ca('0x37')){var _0x274310={};_0x274310[_0x48c023[_0x40ca('0x21')]]={'$like':'%'+_0x1cf1ae['query'][_0x40ca('0x33')]+'%'};return _0x274310;}})});}_0xc24fad=_[_0x40ca('0x34')]({},_0xc24fad,_0x1cf1ae[_0x40ca('0x38')]);var _0x31eef0={'where':_0xc24fad['where']};return db[_0x40ca('0x23')][_0x40ca('0x19')](_0x31eef0)[_0x40ca('0x1e')](function(_0x4dd893){_0x25a8ef[_0x40ca('0x19')]=_0x4dd893;if(_0x1cf1ae['query'][_0x40ca('0x39')]){_0xc24fad[_0x40ca('0x3a')]=[{'all':!![]}];}return db[_0x40ca('0x23')]['findAll'](_0xc24fad);})[_0x40ca('0x1e')](function(_0x2f9726){_0x25a8ef[_0x40ca('0x3b')]=_0x2f9726;return _0x25a8ef;})[_0x40ca('0x1e')](respondWithFilteredResult(_0x4458c4,_0xc24fad))[_0x40ca('0x3c')](handleError(_0x4458c4,null));};exports[_0x40ca('0x3d')]=function(_0x398d88,_0x5b299a){var _0x5aee4d={'raw':![],'where':{'id':_0x398d88[_0x40ca('0x3e')]['id']}},_0x434729={};_0x434729[_0x40ca('0x29')]=_[_0x40ca('0x3f')](db[_0x40ca('0x23')][_0x40ca('0x24')]);_0x434729[_0x40ca('0x27')]=_[_0x40ca('0x3f')](_0x398d88[_0x40ca('0x27')]);_0x434729[_0x40ca('0x28')]=_[_0x40ca('0x2a')](_0x434729[_0x40ca('0x29')],_0x434729[_0x40ca('0x27')]);_0x5aee4d[_0x40ca('0x40')]=_[_0x40ca('0x2a')](_0x434729[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0x398d88[_0x40ca('0x27')][_0x40ca('0x2b')]));_0x5aee4d[_0x40ca('0x40')]=_0x5aee4d[_0x40ca('0x40')][_0x40ca('0x2c')]?_0x5aee4d[_0x40ca('0x40')]:_0x434729[_0x40ca('0x29')];if(_0x398d88[_0x40ca('0x27')][_0x40ca('0x39')]){_0x5aee4d['include']=[{'all':!![]}];}_0x5aee4d=_[_0x40ca('0x34')]({},_0x5aee4d,_0x398d88[_0x40ca('0x38')]);return db['FreshdeskConfiguration'][_0x40ca('0x41')](_0x5aee4d)['then'](handleEntityNotFound(_0x5b299a,null))[_0x40ca('0x1e')](respondWithResult(_0x5b299a,null))[_0x40ca('0x3c')](handleError(_0x5b299a,null));};exports['create']=function(_0x1e7662,_0x21d609){return db[_0x40ca('0x23')]['create'](_0x1e7662[_0x40ca('0x42')],{})[_0x40ca('0x1e')](respondWithResult(_0x21d609,0xc9))[_0x40ca('0x3c')](handleError(_0x21d609,null));};exports[_0x40ca('0x43')]=function(_0x382b3e,_0x13651a){if(_0x382b3e[_0x40ca('0x42')]['id']){delete _0x382b3e[_0x40ca('0x42')]['id'];}return db[_0x40ca('0x23')][_0x40ca('0x41')]({'where':{'id':_0x382b3e[_0x40ca('0x3e')]['id']}})[_0x40ca('0x1e')](handleEntityNotFound(_0x13651a,null))[_0x40ca('0x1e')](saveUpdates(_0x382b3e['body'],null))['then'](respondWithResult(_0x13651a,null))[_0x40ca('0x3c')](handleError(_0x13651a,null));};exports['destroy']=function(_0x4f321a,_0x58634c){return db['FreshdeskConfiguration'][_0x40ca('0x41')]({'where':{'id':_0x4f321a[_0x40ca('0x3e')]['id']}})[_0x40ca('0x1e')](handleEntityNotFound(_0x58634c,null))['then'](removeEntity(_0x58634c,null))[_0x40ca('0x3c')](handleError(_0x58634c,null));};exports['getFields']=function(_0xc3b52b,_0x31f80f,_0x2811c9){var _0x18ace0={};var _0x2ff5ba={};var _0x1464a9;var _0x32afd8;return db[_0x40ca('0x23')][_0x40ca('0x44')]({'where':{'id':_0xc3b52b[_0x40ca('0x3e')]['id']}})[_0x40ca('0x1e')](handleEntityNotFound(_0x31f80f,null))[_0x40ca('0x1e')](function(_0x154d27){if(_0x154d27){_0x1464a9=_0x154d27;_0x2ff5ba[_0x40ca('0x29')]=_['keys'](db[_0x40ca('0x45')]['rawAttributes']);_0x2ff5ba[_0x40ca('0x27')]=_[_0x40ca('0x3f')](_0xc3b52b[_0x40ca('0x27')]);_0x2ff5ba[_0x40ca('0x28')]=_['intersection'](_0x2ff5ba[_0x40ca('0x29')],_0x2ff5ba['query']);_0x18ace0[_0x40ca('0x40')]=_[_0x40ca('0x2a')](_0x2ff5ba[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0xc3b52b[_0x40ca('0x27')][_0x40ca('0x2b')]));_0x18ace0[_0x40ca('0x40')]=_0x18ace0[_0x40ca('0x40')]['length']?_0x18ace0[_0x40ca('0x40')]:_0x2ff5ba[_0x40ca('0x29')];_0x18ace0['order']=qs['sort'](_0xc3b52b[_0x40ca('0x27')]['sort']);_0x18ace0[_0x40ca('0x31')]=qs[_0x40ca('0x28')](_[_0x40ca('0x32')](_0xc3b52b[_0x40ca('0x27')],_0x2ff5ba[_0x40ca('0x28')]));if(_0xc3b52b[_0x40ca('0x27')]['filter']){_0x18ace0[_0x40ca('0x31')]=_[_0x40ca('0x34')](_0x18ace0['where'],{'$or':_[_0x40ca('0x35')](_0x18ace0[_0x40ca('0x40')],function(_0x2354ec){var _0x2b150e={};_0x2b150e[_0x2354ec]={'$like':'%'+_0xc3b52b['query'][_0x40ca('0x33')]+'%'};return _0x2b150e;})});}_0x18ace0=_[_0x40ca('0x34')]({},_0x18ace0,_0xc3b52b[_0x40ca('0x38')]);return _0x1464a9['getFields'](_0x18ace0);}})[_0x40ca('0x1e')](function(_0x5604f4){if(_0x5604f4){_0x32afd8=_0x5604f4['length'];if(!_0xc3b52b[_0x40ca('0x27')]['hasOwnProperty'](_0x40ca('0x2e'))){_0x18ace0['limit']=qs[_0x40ca('0x2f')](_0xc3b52b[_0x40ca('0x27')][_0x40ca('0x2f')]);_0x18ace0[_0x40ca('0x1a')]=qs['offset'](_0xc3b52b[_0x40ca('0x27')]['offset']);}return _0x1464a9[_0x40ca('0x46')](_0x18ace0);}})[_0x40ca('0x1e')](function(_0x1c3e15){if(_0x1c3e15){return _0x1c3e15?{'count':_0x32afd8,'rows':_0x1c3e15}:null;}})[_0x40ca('0x1e')](respondWithResult(_0x31f80f,null))[_0x40ca('0x3c')](handleError(_0x31f80f,null));};exports[_0x40ca('0x47')]=function(_0x4aebf5,_0x2854fb,_0x446532){var _0x43a23f={};var _0x1a17d5={};var _0x161450;var _0x18fd6a;return db[_0x40ca('0x23')][_0x40ca('0x44')]({'where':{'id':_0x4aebf5[_0x40ca('0x3e')]['id']}})[_0x40ca('0x1e')](handleEntityNotFound(_0x2854fb,null))[_0x40ca('0x1e')](function(_0x2a0d07){if(_0x2a0d07){_0x161450=_0x2a0d07;_0x1a17d5[_0x40ca('0x29')]=_[_0x40ca('0x3f')](db[_0x40ca('0x45')][_0x40ca('0x24')]);_0x1a17d5[_0x40ca('0x27')]=_['keys'](_0x4aebf5['query']);_0x1a17d5[_0x40ca('0x28')]=_[_0x40ca('0x2a')](_0x1a17d5[_0x40ca('0x29')],_0x1a17d5[_0x40ca('0x27')]);_0x43a23f[_0x40ca('0x40')]=_[_0x40ca('0x2a')](_0x1a17d5[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0x4aebf5[_0x40ca('0x27')][_0x40ca('0x2b')]));_0x43a23f[_0x40ca('0x40')]=_0x43a23f[_0x40ca('0x40')]['length']?_0x43a23f['attributes']:_0x1a17d5[_0x40ca('0x29')];_0x43a23f[_0x40ca('0x48')]=qs['sort'](_0x4aebf5[_0x40ca('0x27')][_0x40ca('0x30')]);_0x43a23f[_0x40ca('0x31')]=qs['filters'](_[_0x40ca('0x32')](_0x4aebf5[_0x40ca('0x27')],_0x1a17d5[_0x40ca('0x28')]));if(_0x4aebf5[_0x40ca('0x27')][_0x40ca('0x33')]){_0x43a23f[_0x40ca('0x31')]=_[_0x40ca('0x34')](_0x43a23f[_0x40ca('0x31')],{'$or':_[_0x40ca('0x35')](_0x43a23f[_0x40ca('0x40')],function(_0x330cbe){var _0x5cc8f3={};_0x5cc8f3[_0x330cbe]={'$like':'%'+_0x4aebf5[_0x40ca('0x27')]['filter']+'%'};return _0x5cc8f3;})});}_0x43a23f=_[_0x40ca('0x34')]({},_0x43a23f,_0x4aebf5['options']);return _0x161450[_0x40ca('0x47')](_0x43a23f);}})[_0x40ca('0x1e')](function(_0x253222){if(_0x253222){_0x18fd6a=_0x253222[_0x40ca('0x2c')];if(!_0x4aebf5[_0x40ca('0x27')]['hasOwnProperty'](_0x40ca('0x2e'))){_0x43a23f[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x4aebf5[_0x40ca('0x27')][_0x40ca('0x2f')]);_0x43a23f['offset']=qs[_0x40ca('0x1a')](_0x4aebf5[_0x40ca('0x27')][_0x40ca('0x1a')]);}return _0x161450[_0x40ca('0x47')](_0x43a23f);}})[_0x40ca('0x1e')](function(_0x419222){if(_0x419222){return _0x419222?{'count':_0x18fd6a,'rows':_0x419222}:null;}})[_0x40ca('0x1e')](respondWithResult(_0x2854fb,null))['catch'](handleError(_0x2854fb,null));};exports[_0x40ca('0x49')]=function(_0x3954a7,_0x264524,_0x10c1fb){var _0x4be344={};var _0x3dba2b={};var _0x2ea023;var _0x33b254;return db[_0x40ca('0x23')][_0x40ca('0x44')]({'where':{'id':_0x3954a7[_0x40ca('0x3e')]['id']}})[_0x40ca('0x1e')](handleEntityNotFound(_0x264524,null))[_0x40ca('0x1e')](function(_0x452e13){if(_0x452e13){_0x2ea023=_0x452e13;_0x3dba2b['model']=_[_0x40ca('0x3f')](db[_0x40ca('0x45')][_0x40ca('0x24')]);_0x3dba2b[_0x40ca('0x27')]=_[_0x40ca('0x3f')](_0x3954a7[_0x40ca('0x27')]);_0x3dba2b[_0x40ca('0x28')]=_[_0x40ca('0x2a')](_0x3dba2b[_0x40ca('0x29')],_0x3dba2b[_0x40ca('0x27')]);_0x4be344['attributes']=_[_0x40ca('0x2a')](_0x3dba2b[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0x3954a7[_0x40ca('0x27')][_0x40ca('0x2b')]));_0x4be344['attributes']=_0x4be344[_0x40ca('0x40')][_0x40ca('0x2c')]?_0x4be344[_0x40ca('0x40')]:_0x3dba2b[_0x40ca('0x29')];_0x4be344[_0x40ca('0x48')]=qs['sort'](_0x3954a7['query']['sort']);_0x4be344[_0x40ca('0x31')]=qs['filters'](_['pick'](_0x3954a7[_0x40ca('0x27')],_0x3dba2b[_0x40ca('0x28')]));if(_0x3954a7[_0x40ca('0x27')][_0x40ca('0x33')]){_0x4be344['where']=_[_0x40ca('0x34')](_0x4be344['where'],{'$or':_[_0x40ca('0x35')](_0x4be344[_0x40ca('0x40')],function(_0x56dab1){var _0x38f0e7={};_0x38f0e7[_0x56dab1]={'$like':'%'+_0x3954a7['query'][_0x40ca('0x33')]+'%'};return _0x38f0e7;})});}_0x4be344=_['merge']({},_0x4be344,_0x3954a7[_0x40ca('0x38')]);return _0x2ea023[_0x40ca('0x49')](_0x4be344);}})[_0x40ca('0x1e')](function(_0xef4941){if(_0xef4941){_0x33b254=_0xef4941[_0x40ca('0x2c')];if(!_0x3954a7[_0x40ca('0x27')][_0x40ca('0x2d')](_0x40ca('0x2e'))){_0x4be344[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x3954a7[_0x40ca('0x27')][_0x40ca('0x2f')]);_0x4be344['offset']=qs[_0x40ca('0x1a')](_0x3954a7[_0x40ca('0x27')][_0x40ca('0x1a')]);}return _0x2ea023[_0x40ca('0x49')](_0x4be344);}})[_0x40ca('0x1e')](function(_0x56145a){if(_0x56145a){return _0x56145a?{'count':_0x33b254,'rows':_0x56145a}:null;}})[_0x40ca('0x1e')](respondWithResult(_0x264524,null))['catch'](handleError(_0x264524,null));};exports[_0x40ca('0x4a')]=function(_0x176447,_0x1256b4,_0x948e07){var _0x313b5d={};var _0x18aa4d={};var _0x51ef53;var _0x3cec86;return db[_0x40ca('0x23')][_0x40ca('0x44')]({'where':{'id':_0x176447[_0x40ca('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1256b4,null))[_0x40ca('0x1e')](function(_0xc2acf1){if(_0xc2acf1){_0x51ef53=_0xc2acf1;_0x18aa4d['model']=_[_0x40ca('0x3f')](db[_0x40ca('0x4b')][_0x40ca('0x24')]);_0x18aa4d['query']=_['keys'](_0x176447[_0x40ca('0x27')]);_0x18aa4d[_0x40ca('0x28')]=_[_0x40ca('0x2a')](_0x18aa4d[_0x40ca('0x29')],_0x18aa4d['query']);_0x313b5d[_0x40ca('0x40')]=_[_0x40ca('0x2a')](_0x18aa4d[_0x40ca('0x29')],qs[_0x40ca('0x2b')](_0x176447['query']['fields']));_0x313b5d[_0x40ca('0x40')]=_0x313b5d['attributes'][_0x40ca('0x2c')]?_0x313b5d[_0x40ca('0x40')]:_0x18aa4d[_0x40ca('0x29')];_0x313b5d[_0x40ca('0x48')]=qs[_0x40ca('0x30')](_0x176447[_0x40ca('0x27')][_0x40ca('0x30')]);_0x313b5d[_0x40ca('0x31')]=qs[_0x40ca('0x28')](_[_0x40ca('0x32')](_0x176447[_0x40ca('0x27')],_0x18aa4d[_0x40ca('0x28')]));if(_0x176447[_0x40ca('0x27')][_0x40ca('0x33')]){_0x313b5d[_0x40ca('0x31')]=_[_0x40ca('0x34')](_0x313b5d['where'],{'$or':_[_0x40ca('0x35')](_0x313b5d[_0x40ca('0x40')],function(_0x73bdcc){var _0x2d4b71={};_0x2d4b71[_0x73bdcc]={'$like':'%'+_0x176447[_0x40ca('0x27')][_0x40ca('0x33')]+'%'};return _0x2d4b71;})});}_0x313b5d=_['merge']({},_0x313b5d,_0x176447['options']);return _0x51ef53[_0x40ca('0x4a')](_0x313b5d);}})[_0x40ca('0x1e')](function(_0x50f877){if(_0x50f877){_0x3cec86=_0x50f877['length'];if(!_0x176447[_0x40ca('0x27')][_0x40ca('0x2d')](_0x40ca('0x2e'))){_0x313b5d[_0x40ca('0x2f')]=qs[_0x40ca('0x2f')](_0x176447[_0x40ca('0x27')][_0x40ca('0x2f')]);_0x313b5d[_0x40ca('0x1a')]=qs[_0x40ca('0x1a')](_0x176447[_0x40ca('0x27')][_0x40ca('0x1a')]);}return _0x51ef53[_0x40ca('0x4a')](_0x313b5d);}})[_0x40ca('0x1e')](function(_0x506266){if(_0x506266){return _0x506266?{'count':_0x3cec86,'rows':_0x506266}:null;}})[_0x40ca('0x1e')](respondWithResult(_0x1256b4,null))[_0x40ca('0x3c')](handleError(_0x1256b4,null));};exports[_0x40ca('0x4c')]=function(_0x1e2696,_0x59156a,_0x410693){if(_0x1e2696[_0x40ca('0x42')]['id']){delete _0x1e2696[_0x40ca('0x42')]['id'];}return db['FreshdeskConfiguration'][_0x40ca('0x44')]({'where':{'id':_0x1e2696[_0x40ca('0x3e')]['id']}})['then'](handleEntityNotFound(_0x59156a,null))[_0x40ca('0x1e')](function(_0x288b0a){if(_0x288b0a){return _0x288b0a['setTags'](_0x1e2696[_0x40ca('0x42')][_0x40ca('0x4d')]||[]);}return null;})['then'](respondWithResult(_0x59156a,null))[_0x40ca('0x3c')](handleError(_0x59156a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c60a2de..eb1b84e 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 _0xfff0=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e4f85,_0x49cbb1){var _0x130195=function(_0x20b34){while(--_0x20b34){_0x5e4f85['push'](_0x5e4f85['shift']());}};_0x130195(++_0x49cbb1);}(_0xfff0,0x192));var _0x0fff=function(_0x407b41,_0x55e601){_0x407b41=_0x407b41-0x0;var _0x2eaf78=_0xfff0[_0x407b41];return _0x2eaf78;};'use strict';var _=require(_0x0fff('0x0'));var util=require(_0x0fff('0x1'));var logger=require(_0x0fff('0x2'))('api');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var rp=require(_0x0fff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x37490c,_0x101c14){return _0x37490c['define'](_0x0fff('0x8'),attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f47=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','rimraf'];(function(_0x1b3a53,_0x7ff46){var _0x3edd9a=function(_0x16a83f){while(--_0x16a83f){_0x1b3a53['push'](_0x1b3a53['shift']());}};_0x3edd9a(++_0x7ff46);}(_0x3f47,0x109));var _0x73f4=function(_0x28d8ee,_0x5869c7){_0x28d8ee=_0x28d8ee-0x0;var _0x51b217=_0x3f47[_0x28d8ee];return _0x51b217;};'use strict';var _=require(_0x73f4('0x0'));var util=require('util');var logger=require(_0x73f4('0x1'))('api');var moment=require(_0x73f4('0x2'));var BPromise=require(_0x73f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x73f4('0x4'));var config=require(_0x73f4('0x5'));var attributes=require(_0x73f4('0x6'));module[_0x73f4('0x7')]=function(_0x5e6dd0,_0x177ebd){return _0x5e6dd0[_0x73f4('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x73f4('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 7556041..0d2b905 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 _0xb511=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','ioredis'];(function(_0x58ea14,_0x5530d3){var _0x5dc1a9=function(_0x20ce5d){while(--_0x20ce5d){_0x58ea14['push'](_0x58ea14['shift']());}};_0x5dc1a9(++_0x5530d3);}(_0xb511,0x176));var _0x1b51=function(_0x18099a,_0x3ae9c2){_0x18099a=_0x18099a-0x0;var _0x5a53cd=_0xb511[_0x18099a];return _0x5a53cd;};'use strict';var _=require('lodash');var util=require(_0x1b51('0x0'));var moment=require('moment');var BPromise=require(_0x1b51('0x1'));var rs=require(_0x1b51('0x2'));var fs=require('fs');var Redis=require(_0x1b51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b51('0x4'));var logger=require(_0x1b51('0x5'))(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var jayson=require(_0x1b51('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b2e1,_0x3a79d7,_0x594ba7){return new BPromise(function(_0x55c9a0,_0x31cecf){return client[_0x1b51('0x9')](_0x14b2e1,_0x594ba7)[_0x1b51('0xa')](function(_0x10757f){logger[_0x1b51('0xb')](_0x1b51('0xc'),_0x3a79d7,'request\x20sent');logger[_0x1b51('0xd')](_0x1b51('0xe'),_0x3a79d7,'request\x20sent',JSON[_0x1b51('0xf')](_0x10757f));if(_0x10757f[_0x1b51('0x10')]){if(_0x10757f[_0x1b51('0x10')][_0x1b51('0x11')]===0x1f4){logger['error'](_0x1b51('0xc'),_0x3a79d7,_0x10757f['error']['message']);return _0x31cecf(_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);}logger[_0x1b51('0x10')](_0x1b51('0xc'),_0x3a79d7,_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);return _0x55c9a0(_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);}else{logger[_0x1b51('0xb')](_0x1b51('0xc'),_0x3a79d7,_0x1b51('0x13'));_0x55c9a0(_0x10757f['result'][_0x1b51('0x12')]);}})[_0x1b51('0x14')](function(_0x430f48){logger[_0x1b51('0x10')](_0x1b51('0xc'),_0x3a79d7,_0x430f48);_0x31cecf(_0x430f48);});});} \ No newline at end of file +var _0x3aca=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3aca,0xe6));var _0xa3ac=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x3aca[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0xa3ac('0x0'));var util=require('util');var moment=require(_0xa3ac('0x1'));var BPromise=require(_0xa3ac('0x2'));var rs=require(_0xa3ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ac('0x4'))['db'];var utils=require(_0xa3ac('0x5'));var logger=require(_0xa3ac('0x6'))(_0xa3ac('0x7'));var config=require(_0xa3ac('0x8'));var jayson=require(_0xa3ac('0x9'));var client=jayson[_0xa3ac('0xa')][_0xa3ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fcbab,_0x252a22,_0x5366d9){return new BPromise(function(_0x84a4e3,_0x580f63){return client['request'](_0x1fcbab,_0x5366d9)['then'](function(_0x31c69f){logger[_0xa3ac('0xc')](_0xa3ac('0xd'),_0x252a22,_0xa3ac('0xe'));logger[_0xa3ac('0xf')](_0xa3ac('0x10'),_0x252a22,_0xa3ac('0xe'),JSON[_0xa3ac('0x11')](_0x31c69f));if(_0x31c69f['error']){if(_0x31c69f['error'][_0xa3ac('0x12')]===0x1f4){logger[_0xa3ac('0x13')](_0xa3ac('0xd'),_0x252a22,_0x31c69f[_0xa3ac('0x13')][_0xa3ac('0x14')]);return _0x580f63(_0x31c69f[_0xa3ac('0x13')][_0xa3ac('0x14')]);}logger[_0xa3ac('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x252a22,_0x31c69f[_0xa3ac('0x13')]['message']);return _0x84a4e3(_0x31c69f['error'][_0xa3ac('0x14')]);}else{logger[_0xa3ac('0xc')](_0xa3ac('0xd'),_0x252a22,_0xa3ac('0xe'));_0x84a4e3(_0x31c69f[_0xa3ac('0x15')]['message']);}})[_0xa3ac('0x16')](function(_0x18ee16){logger[_0xa3ac('0x13')](_0xa3ac('0xd'),_0x252a22,_0x18ee16);_0x580f63(_0x18ee16);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d125b82..d1b3056 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 _0x1060=['show','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x17cdcc,_0x29d5de){var _0x38f5f6=function(_0x55f444){while(--_0x55f444){_0x17cdcc['push'](_0x17cdcc['shift']());}};_0x38f5f6(++_0x29d5de);}(_0x1060,0x181));var _0x0106=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x1060[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require(_0x0106('0x0'));var path=require(_0x0106('0x1'));var timeout=require(_0x0106('0x2'));var express=require('express');var router=express[_0x0106('0x3')]();var fs_extra=require(_0x0106('0x4'));var auth=require(_0x0106('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0106('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x0106('0x7')]('/',auth[_0x0106('0x8')](),controller[_0x0106('0x9')]);router[_0x0106('0x7')](_0x0106('0xa'),auth[_0x0106('0x8')](),controller[_0x0106('0xb')]);router['post']('/',auth[_0x0106('0x8')](),controller[_0x0106('0xc')]);router[_0x0106('0xd')](_0x0106('0xa'),auth[_0x0106('0x8')](),controller[_0x0106('0xe')]);router[_0x0106('0xf')]('/:id',auth[_0x0106('0x8')](),controller[_0x0106('0x10')]);module[_0x0106('0x11')]=router; \ No newline at end of file +var _0xfa6f=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','index','/:id','show','post','create','put','delete','isAuthenticated','destroy'];(function(_0x5ed3b5,_0x43e211){var _0x477dc2=function(_0x192d00){while(--_0x192d00){_0x5ed3b5['push'](_0x5ed3b5['shift']());}};_0x477dc2(++_0x43e211);}(_0xfa6f,0x1c9));var _0xffa6=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xfa6f[_0x5c9307];return _0x373e29;};'use strict';var multer=require(_0xffa6('0x0'));var util=require(_0xffa6('0x1'));var path=require('path');var timeout=require(_0xffa6('0x2'));var express=require(_0xffa6('0x3'));var router=express[_0xffa6('0x4')]();var fs_extra=require(_0xffa6('0x5'));var auth=require(_0xffa6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffa6('0x7'));router[_0xffa6('0x8')]('/',auth['isAuthenticated'](),controller[_0xffa6('0x9')]);router[_0xffa6('0x8')](_0xffa6('0xa'),auth['isAuthenticated'](),controller[_0xffa6('0xb')]);router[_0xffa6('0xc')]('/',auth['isAuthenticated'](),controller[_0xffa6('0xd')]);router[_0xffa6('0xe')](_0xffa6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xffa6('0xf')](_0xffa6('0xa'),auth[_0xffa6('0x10')](),controller[_0xffa6('0x11')]);module[_0xffa6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 645882f..f11eabd 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 _0x45cc=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x1b7b7e,_0x416817){var _0x233a00=function(_0x7a85d8){while(--_0x7a85d8){_0x1b7b7e['push'](_0x1b7b7e['shift']());}};_0x233a00(++_0x416817);}(_0x45cc,0x189));var _0xc45c=function(_0x4a9b0e,_0x13ae85){_0x4a9b0e=_0x4a9b0e-0x0;var _0x4e83a9=_0x45cc[_0x4a9b0e];return _0x4e83a9;};'use strict';var Sequelize=require(_0xc45c('0x0'));module[_0xc45c('0x1')]={'type':{'type':Sequelize[_0xc45c('0x2')](_0xc45c('0x3'),'variable',_0xc45c('0x4'),_0xc45c('0x5'),_0xc45c('0x6')),'defaultValue':_0xc45c('0x3')},'content':{'type':Sequelize[_0xc45c('0x7')]},'key':{'type':Sequelize[_0xc45c('0x7')]},'keyType':{'type':Sequelize[_0xc45c('0x2')](_0xc45c('0x3'),_0xc45c('0x8'),_0xc45c('0x4'))},'keyContent':{'type':Sequelize[_0xc45c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc45c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa088=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','variable','STRING'];(function(_0x5830db,_0x5a3fd6){var _0x438b32=function(_0x1b948c){while(--_0x1b948c){_0x5830db['push'](_0x5830db['shift']());}};_0x438b32(++_0x5a3fd6);}(_0xa088,0x145));var _0x8a08=function(_0x7b5a6d,_0x1e8af7){_0x7b5a6d=_0x7b5a6d-0x0;var _0x46ae40=_0xa088[_0x7b5a6d];return _0x46ae40;};'use strict';var Sequelize=require(_0x8a08('0x0'));module[_0x8a08('0x1')]={'type':{'type':Sequelize[_0x8a08('0x2')](_0x8a08('0x3'),'variable',_0x8a08('0x4'),_0x8a08('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a08('0x2')](_0x8a08('0x3'),_0x8a08('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a08('0x7')]},'idField':{'type':Sequelize[_0x8a08('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8a08('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a08('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 02ae6b7..d79c29a 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 _0x9c00=['key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','type','VIRTUAL','filter','options','where','then','include','findAll','rows','catch','show','params','keys','includeAll','merge','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes'];(function(_0x248e67,_0x1da42f){var _0x39aaa7=function(_0x1849a9){while(--_0x1849a9){_0x248e67['push'](_0x248e67['shift']());}};_0x39aaa7(++_0x1da42f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x58df23,_0x3e9eb9){_0x58df23=_0x58df23-0x0;var _0x2fcd18=_0x9c00[_0x58df23];return _0x2fcd18;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x56d883,_0x2c7202){return function(_0x163a59){if(!_0x163a59){_0x56d883[_0x09c0('0x1b')](0x194);}return _0x163a59;};}function handleError(_0x30c2a1,_0x1f8131){_0x1f8131=_0x1f8131||0x1f4;return function(_0x1d2d9d){logger[_0x09c0('0x27')](_0x1d2d9d[_0x09c0('0x28')]);if(_0x1d2d9d[_0x09c0('0x29')]){delete _0x1d2d9d[_0x09c0('0x29')];}_0x30c2a1[_0x09c0('0x1c')](_0x1f8131)['send'](_0x1d2d9d);};}exports[_0x09c0('0x2a')]=function(_0x1bdde9,_0x53a7b8){var _0x1d09e0={},_0x5aa0b9={},_0x3f5b10={'count':0x0,'rows':[]};var _0x4d6bdc=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x4159bc){return{'name':_0x4159bc['fieldName'],'type':_0x4159bc['type'][_0x09c0('0x2e')]};});_0x5aa0b9[_0x09c0('0x2f')]=_[_0x09c0('0x2b')](_0x4d6bdc,'name');_0x5aa0b9[_0x09c0('0x30')]=_['keys'](_0x1bdde9[_0x09c0('0x30')]);_0x5aa0b9[_0x09c0('0x31')]=_[_0x09c0('0x32')](_0x5aa0b9['model'],_0x5aa0b9[_0x09c0('0x30')]);_0x1d09e0[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x5aa0b9[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x34')]));_0x1d09e0['attributes']=_0x1d09e0[_0x09c0('0x33')][_0x09c0('0x35')]?_0x1d09e0[_0x09c0('0x33')]:_0x5aa0b9[_0x09c0('0x2f')];if(!_0x1bdde9[_0x09c0('0x30')]['hasOwnProperty'](_0x09c0('0x36'))){_0x1d09e0[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x20')]);_0x1d09e0['offset']=qs[_0x09c0('0x37')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x37')]);}_0x1d09e0[_0x09c0('0x38')]=qs[_0x09c0('0x39')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x39')]);_0x1d09e0['where']=qs[_0x09c0('0x31')](_[_0x09c0('0x3a')](_0x1bdde9[_0x09c0('0x30')],_0x5aa0b9[_0x09c0('0x31')]),_0x4d6bdc);if(_0x1bdde9[_0x09c0('0x30')]['filter']){_0x1d09e0['where']=_['merge'](_0x1d09e0['where'],{'$or':_[_0x09c0('0x2b')](_0x4d6bdc,function(_0x15c631){if(_0x15c631[_0x09c0('0x3b')]!==_0x09c0('0x3c')){var _0x1a8c0c={};_0x1a8c0c[_0x15c631['name']]={'$like':'%'+_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x3d')]+'%'};return _0x1a8c0c;}})});}_0x1d09e0=_['merge']({},_0x1d09e0,_0x1bdde9[_0x09c0('0x3e')]);var _0x5d50b9={'where':_0x1d09e0[_0x09c0('0x3f')]};return db['FreshdeskField'][_0x09c0('0x21')](_0x5d50b9)[_0x09c0('0x40')](function(_0x56a511){_0x3f5b10[_0x09c0('0x21')]=_0x56a511;if(_0x1bdde9[_0x09c0('0x30')]['includeAll']){_0x1d09e0[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1d09e0);})[_0x09c0('0x40')](function(_0xeb8191){_0x3f5b10[_0x09c0('0x43')]=_0xeb8191;return _0x3f5b10;})['then'](respondWithFilteredResult(_0x53a7b8,_0x1d09e0))[_0x09c0('0x44')](handleError(_0x53a7b8,null));};exports[_0x09c0('0x45')]=function(_0x2d6344,_0x57835c){var _0x193ed2={'raw':!![],'where':{'id':_0x2d6344[_0x09c0('0x46')]['id']}},_0x30c0c5={};_0x30c0c5['model']=_[_0x09c0('0x47')](db[_0x09c0('0x2c')]['rawAttributes']);_0x30c0c5['query']=_[_0x09c0('0x47')](_0x2d6344[_0x09c0('0x30')]);_0x30c0c5['filters']=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],_0x30c0c5['query']);_0x193ed2[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x2d6344[_0x09c0('0x30')]['fields']));_0x193ed2[_0x09c0('0x33')]=_0x193ed2['attributes']['length']?_0x193ed2[_0x09c0('0x33')]:_0x30c0c5[_0x09c0('0x2f')];if(_0x2d6344[_0x09c0('0x30')][_0x09c0('0x48')]){_0x193ed2[_0x09c0('0x41')]=[{'all':!![]}];}_0x193ed2=_[_0x09c0('0x49')]({},_0x193ed2,_0x2d6344['options']);return db['FreshdeskField']['find'](_0x193ed2)[_0x09c0('0x40')](handleEntityNotFound(_0x57835c,null))[_0x09c0('0x40')](respondWithResult(_0x57835c,null))[_0x09c0('0x44')](handleError(_0x57835c,null));};exports['create']=function(_0xdf1553,_0xff9650){return db[_0x09c0('0x2c')][_0x09c0('0x4a')](_0xdf1553[_0x09c0('0x4b')],{})[_0x09c0('0x40')](respondWithResult(_0xff9650,0xc9))[_0x09c0('0x44')](handleError(_0xff9650,null));};exports[_0x09c0('0x25')]=function(_0x3f6d14,_0x38085c){if(_0x3f6d14[_0x09c0('0x4b')]['id']){delete _0x3f6d14[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x3f6d14[_0x09c0('0x46')]['id']}})[_0x09c0('0x40')](handleEntityNotFound(_0x38085c,null))[_0x09c0('0x40')](saveUpdates(_0x3f6d14[_0x09c0('0x4b')],null))[_0x09c0('0x40')](respondWithResult(_0x38085c,null))[_0x09c0('0x44')](handleError(_0x38085c,null));};exports['destroy']=function(_0x4acf54,_0x44befb){return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x4acf54[_0x09c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44befb,null))[_0x09c0('0x40')](removeEntity(_0x44befb,null))[_0x09c0('0x44')](handleError(_0x44befb,null));}; \ No newline at end of file +var _0x6308=['path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util'];(function(_0xf443fb,_0x486026){var _0x1174e5=function(_0x37174e){while(--_0x37174e){_0xf443fb['push'](_0xf443fb['shift']());}};_0x1174e5(++_0x486026);}(_0x6308,0x1f2));var _0x8630=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6308[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x8630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8630('0x2'));var BPromise=require(_0x8630('0x3'));var Mustache=require(_0x8630('0x4'));var util=require(_0x8630('0x5'));var path=require(_0x8630('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8630('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8630('0x8'));var squel=require(_0x8630('0x9'));var crypto=require(_0x8630('0xa'));var jsforce=require(_0x8630('0xb'));var deskjs=require(_0x8630('0xc'));var toCsv=require(_0x8630('0xd'));var querystring=require('querystring');var Papa=require(_0x8630('0xe'));var Redis=require('ioredis');var authService=require(_0x8630('0xf'));var qs=require(_0x8630('0x10'));var as=require(_0x8630('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8630('0x12'))(_0x8630('0x13'));var utils=require(_0x8630('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8630('0x15'));var db=require(_0x8630('0x16'))['db'];function respondWithStatusCode(_0x5b6d75,_0x54073b){_0x54073b=_0x54073b||0xcc;return function(_0x303e3a){if(_0x303e3a){return _0x5b6d75[_0x8630('0x17')](_0x54073b);}return _0x5b6d75['status'](_0x54073b)[_0x8630('0x18')]();};}function respondWithResult(_0x4db686,_0xf31c17){_0xf31c17=_0xf31c17||0xc8;return function(_0x4cc542){if(_0x4cc542){return _0x4db686[_0x8630('0x19')](_0xf31c17)['json'](_0x4cc542);}};}function respondWithFilteredResult(_0x53f236,_0x29a42d){return function(_0x86c262){if(_0x86c262){var _0x49fce1=typeof _0x29a42d['offset']===_0x8630('0x1a')&&typeof _0x29a42d['limit']===_0x8630('0x1a');var _0x18a874=_0x86c262[_0x8630('0x1b')];var _0x20f462=_0x49fce1?0x0:_0x29a42d[_0x8630('0x1c')];var _0x1e9780=_0x49fce1?_0x86c262[_0x8630('0x1b')]:_0x29a42d[_0x8630('0x1c')]+_0x29a42d[_0x8630('0x1d')];var _0x5dd2e0;if(_0x1e9780>=_0x18a874){_0x1e9780=_0x18a874;_0x5dd2e0=0xc8;}else{_0x5dd2e0=0xce;}_0x53f236['status'](_0x5dd2e0);return _0x53f236[_0x8630('0x1e')](_0x8630('0x1f'),_0x20f462+'-'+_0x1e9780+'/'+_0x18a874)['json'](_0x86c262);}return null;};}function patchUpdates(_0x5cff5c){return function(_0x1325dc){try{jsonpatch[_0x8630('0x20')](_0x1325dc,_0x5cff5c,!![]);}catch(_0x1ac046){return BPromise['reject'](_0x1ac046);}return _0x1325dc['save']();};}function saveUpdates(_0xcc7454,_0x58c0b5){return function(_0x30fb4d){if(_0x30fb4d){return _0x30fb4d[_0x8630('0x21')](_0xcc7454)[_0x8630('0x22')](function(_0x469de3){return _0x469de3;});}return null;};}function removeEntity(_0x4c2851,_0x37c224){return function(_0xf24c11){if(_0xf24c11){return _0xf24c11[_0x8630('0x23')]()[_0x8630('0x22')](function(){_0x4c2851[_0x8630('0x19')](0xcc)[_0x8630('0x18')]();});}};}function handleEntityNotFound(_0x37b7aa,_0x5c0a22){return function(_0x5b2823){if(!_0x5b2823){_0x37b7aa[_0x8630('0x17')](0x194);}return _0x5b2823;};}function handleError(_0x41b79d,_0x439b33){_0x439b33=_0x439b33||0x1f4;return function(_0xf97e31){logger[_0x8630('0x24')](_0xf97e31[_0x8630('0x25')]);if(_0xf97e31[_0x8630('0x26')]){delete _0xf97e31[_0x8630('0x26')];}_0x41b79d[_0x8630('0x19')](_0x439b33)[_0x8630('0x27')](_0xf97e31);};}exports[_0x8630('0x28')]=function(_0x41f74c,_0xc18164){var _0x4285ee={},_0xbb1a58={},_0x190216={'count':0x0,'rows':[]};var _0x2d3f0b=_['map'](db[_0x8630('0x29')][_0x8630('0x2a')],function(_0x24d85d){return{'name':_0x24d85d[_0x8630('0x2b')],'type':_0x24d85d['type'][_0x8630('0x2c')]};});_0xbb1a58[_0x8630('0x2d')]=_[_0x8630('0x2e')](_0x2d3f0b,_0x8630('0x26'));_0xbb1a58[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x41f74c['query']);_0xbb1a58[_0x8630('0x31')]=_[_0x8630('0x32')](_0xbb1a58[_0x8630('0x2d')],_0xbb1a58['query']);_0x4285ee[_0x8630('0x33')]=_[_0x8630('0x32')](_0xbb1a58[_0x8630('0x2d')],qs[_0x8630('0x34')](_0x41f74c[_0x8630('0x2f')][_0x8630('0x34')]));_0x4285ee['attributes']=_0x4285ee[_0x8630('0x33')][_0x8630('0x35')]?_0x4285ee[_0x8630('0x33')]:_0xbb1a58[_0x8630('0x2d')];if(!_0x41f74c[_0x8630('0x2f')][_0x8630('0x36')](_0x8630('0x37'))){_0x4285ee[_0x8630('0x1d')]=qs[_0x8630('0x1d')](_0x41f74c[_0x8630('0x2f')][_0x8630('0x1d')]);_0x4285ee[_0x8630('0x1c')]=qs[_0x8630('0x1c')](_0x41f74c[_0x8630('0x2f')][_0x8630('0x1c')]);}_0x4285ee[_0x8630('0x38')]=qs[_0x8630('0x39')](_0x41f74c['query'][_0x8630('0x39')]);_0x4285ee[_0x8630('0x3a')]=qs['filters'](_['pick'](_0x41f74c[_0x8630('0x2f')],_0xbb1a58[_0x8630('0x31')]),_0x2d3f0b);if(_0x41f74c[_0x8630('0x2f')][_0x8630('0x3b')]){_0x4285ee[_0x8630('0x3a')]=_['merge'](_0x4285ee[_0x8630('0x3a')],{'$or':_[_0x8630('0x2e')](_0x2d3f0b,function(_0x38ee10){if(_0x38ee10[_0x8630('0x3c')]!=='VIRTUAL'){var _0xac2876={};_0xac2876[_0x38ee10[_0x8630('0x26')]]={'$like':'%'+_0x41f74c[_0x8630('0x2f')][_0x8630('0x3b')]+'%'};return _0xac2876;}})});}_0x4285ee=_[_0x8630('0x3d')]({},_0x4285ee,_0x41f74c[_0x8630('0x3e')]);var _0x2fbb8c={'where':_0x4285ee['where']};return db[_0x8630('0x29')][_0x8630('0x1b')](_0x2fbb8c)[_0x8630('0x22')](function(_0xe3f392){_0x190216[_0x8630('0x1b')]=_0xe3f392;if(_0x41f74c[_0x8630('0x2f')][_0x8630('0x3f')]){_0x4285ee[_0x8630('0x40')]=[{'all':!![]}];}return db[_0x8630('0x29')][_0x8630('0x41')](_0x4285ee);})['then'](function(_0x358431){_0x190216['rows']=_0x358431;return _0x190216;})[_0x8630('0x22')](respondWithFilteredResult(_0xc18164,_0x4285ee))[_0x8630('0x42')](handleError(_0xc18164,null));};exports[_0x8630('0x43')]=function(_0x7c3dc5,_0x193bae){var _0x2f1fec={'raw':!![],'where':{'id':_0x7c3dc5[_0x8630('0x44')]['id']}},_0x5bcf39={};_0x5bcf39[_0x8630('0x2d')]=_[_0x8630('0x30')](db['FreshdeskField'][_0x8630('0x2a')]);_0x5bcf39[_0x8630('0x2f')]=_[_0x8630('0x30')](_0x7c3dc5[_0x8630('0x2f')]);_0x5bcf39[_0x8630('0x31')]=_[_0x8630('0x32')](_0x5bcf39['model'],_0x5bcf39[_0x8630('0x2f')]);_0x2f1fec[_0x8630('0x33')]=_[_0x8630('0x32')](_0x5bcf39['model'],qs[_0x8630('0x34')](_0x7c3dc5[_0x8630('0x2f')]['fields']));_0x2f1fec[_0x8630('0x33')]=_0x2f1fec[_0x8630('0x33')][_0x8630('0x35')]?_0x2f1fec['attributes']:_0x5bcf39['model'];if(_0x7c3dc5[_0x8630('0x2f')]['includeAll']){_0x2f1fec['include']=[{'all':!![]}];}_0x2f1fec=_[_0x8630('0x3d')]({},_0x2f1fec,_0x7c3dc5['options']);return db[_0x8630('0x29')][_0x8630('0x45')](_0x2f1fec)['then'](handleEntityNotFound(_0x193bae,null))[_0x8630('0x22')](respondWithResult(_0x193bae,null))[_0x8630('0x42')](handleError(_0x193bae,null));};exports[_0x8630('0x46')]=function(_0x5d8149,_0x121e83){return db['FreshdeskField'][_0x8630('0x46')](_0x5d8149[_0x8630('0x47')],{})['then'](respondWithResult(_0x121e83,0xc9))[_0x8630('0x42')](handleError(_0x121e83,null));};exports[_0x8630('0x21')]=function(_0x3ff20b,_0x47aa03){if(_0x3ff20b[_0x8630('0x47')]['id']){delete _0x3ff20b[_0x8630('0x47')]['id'];}return db[_0x8630('0x29')][_0x8630('0x45')]({'where':{'id':_0x3ff20b[_0x8630('0x44')]['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x47aa03,null))[_0x8630('0x22')](saveUpdates(_0x3ff20b[_0x8630('0x47')],null))[_0x8630('0x22')](respondWithResult(_0x47aa03,null))['catch'](handleError(_0x47aa03,null));};exports['destroy']=function(_0x1b8328,_0x13326d){return db[_0x8630('0x29')][_0x8630('0x45')]({'where':{'id':_0x1b8328[_0x8630('0x44')]['id']}})[_0x8630('0x22')](handleEntityNotFound(_0x13326d,null))[_0x8630('0x22')](removeEntity(_0x13326d,null))['catch'](handleError(_0x13326d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 29baf90..9ba4ac1 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 _0xd847=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField'];(function(_0x2a0308,_0x405fbf){var _0x5507e3=function(_0x4bb043){while(--_0x4bb043){_0x2a0308['push'](_0x2a0308['shift']());}};_0x5507e3(++_0x405fbf);}(_0xd847,0x18a));var _0x7d84=function(_0x3ea537,_0x5d6a52){_0x3ea537=_0x3ea537-0x0;var _0x264abf=_0xd847[_0x3ea537];return _0x264abf;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d84('0x4'));var fs=require('fs');var path=require(_0x7d84('0x5'));var rimraf=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var attributes=require(_0x7d84('0x8'));module['exports']=function(_0x1544e7,_0x5d8f76){return _0x1544e7[_0x7d84('0x9')](_0x7d84('0xa'),attributes,{'tableName':_0x7d84('0xb'),'paranoid':![],'indexes':[{'name':_0x7d84('0xc'),'fields':[_0x7d84('0xd'),_0x7d84('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7edf=['FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x96f0f5,_0x3153e6){var _0xc8606a=function(_0x492f33){while(--_0x492f33){_0x96f0f5['push'](_0x96f0f5['shift']());}};_0xc8606a(++_0x3153e6);}(_0x7edf,0x71));var _0xf7ed=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x7edf[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0xf7ed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7ed('0x1'));var moment=require(_0xf7ed('0x2'));var BPromise=require(_0xf7ed('0x3'));var rp=require(_0xf7ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7ed('0x5'));var config=require(_0xf7ed('0x6'));var attributes=require(_0xf7ed('0x7'));module['exports']=function(_0x5eae52,_0x2981c8){return _0x5eae52[_0xf7ed('0x8')](_0xf7ed('0x9'),attributes,{'tableName':_0xf7ed('0xa'),'paranoid':![],'indexes':[{'name':_0xf7ed('0xb'),'fields':[_0xf7ed('0xc'),_0xf7ed('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index d4570f2..1cbdf5f 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 _0x6318=['FreshdeskField,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x491bd4,_0x18f776){var _0x3ef7d2=function(_0x3387c8){while(--_0x3387c8){_0x491bd4['push'](_0x491bd4['shift']());}};_0x3ef7d2(++_0x18f776);}(_0x6318,0x16e));var _0x8631=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x6318[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8631('0x0'));var BPromise=require(_0x8631('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8631('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8631('0x3'));var logger=require(_0x8631('0x4'))(_0x8631('0x5'));var config=require(_0x8631('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8631('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33dcbc,_0x2fda7b,_0x217eeb){return new BPromise(function(_0x367389,_0x449888){return client[_0x8631('0x8')](_0x33dcbc,_0x217eeb)['then'](function(_0x3d9f58){logger[_0x8631('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x2fda7b,_0x8631('0xa'));logger[_0x8631('0xb')](_0x8631('0xc'),_0x2fda7b,_0x8631('0xa'),JSON[_0x8631('0xd')](_0x3d9f58));if(_0x3d9f58['error']){if(_0x3d9f58['error']['code']===0x1f4){logger['error'](_0x8631('0xe'),_0x2fda7b,_0x3d9f58[_0x8631('0xf')][_0x8631('0x10')]);return _0x449888(_0x3d9f58[_0x8631('0xf')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2fda7b,_0x3d9f58[_0x8631('0xf')]['message']);return _0x367389(_0x3d9f58[_0x8631('0xf')][_0x8631('0x10')]);}else{logger[_0x8631('0x9')](_0x8631('0xe'),_0x2fda7b,_0x8631('0xa'));_0x367389(_0x3d9f58[_0x8631('0x11')]['message']);}})[_0x8631('0x12')](function(_0x13a50f){logger[_0x8631('0xf')](_0x8631('0xe'),_0x2fda7b,_0x13a50f);_0x449888(_0x13a50f);});});} \ No newline at end of file +var _0x17fc=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x33553a,_0x3e3d4a){var _0x3da1fa=function(_0x794a1c){while(--_0x794a1c){_0x33553a['push'](_0x33553a['shift']());}};_0x3da1fa(++_0x3e3d4a);}(_0x17fc,0x1e3));var _0xc17f=function(_0x2c112a,_0x4cfa30){_0x2c112a=_0x2c112a-0x0;var _0x13bfd1=_0x17fc[_0x2c112a];return _0x13bfd1;};'use strict';var _=require(_0xc17f('0x0'));var util=require(_0xc17f('0x1'));var moment=require('moment');var BPromise=require(_0xc17f('0x2'));var rs=require(_0xc17f('0x3'));var fs=require('fs');var Redis=require(_0xc17f('0x4'));var db=require(_0xc17f('0x5'))['db'];var utils=require(_0xc17f('0x6'));var logger=require('../../config/logger')(_0xc17f('0x7'));var config=require(_0xc17f('0x8'));var jayson=require(_0xc17f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6df30,_0x2be0a8,_0x25c1ba){return new BPromise(function(_0x267fdb,_0xae0d01){return client[_0xc17f('0xa')](_0x6df30,_0x25c1ba)[_0xc17f('0xb')](function(_0x4944a1){logger[_0xc17f('0xc')](_0xc17f('0xd'),_0x2be0a8,_0xc17f('0xe'));logger[_0xc17f('0xf')](_0xc17f('0x10'),_0x2be0a8,_0xc17f('0xe'),JSON[_0xc17f('0x11')](_0x4944a1));if(_0x4944a1['error']){if(_0x4944a1[_0xc17f('0x12')][_0xc17f('0x13')]===0x1f4){logger[_0xc17f('0x12')](_0xc17f('0xd'),_0x2be0a8,_0x4944a1[_0xc17f('0x12')]['message']);return _0xae0d01(_0x4944a1[_0xc17f('0x12')]['message']);}logger[_0xc17f('0x12')](_0xc17f('0xd'),_0x2be0a8,_0x4944a1[_0xc17f('0x12')]['message']);return _0x267fdb(_0x4944a1[_0xc17f('0x12')][_0xc17f('0x14')]);}else{logger[_0xc17f('0xc')](_0xc17f('0xd'),_0x2be0a8,'request\x20sent');_0x267fdb(_0x4944a1[_0xc17f('0x15')][_0xc17f('0x14')]);}})['catch'](function(_0x5691dc){logger[_0xc17f('0x12')](_0xc17f('0xd'),_0x2be0a8,_0x5691dc);_0xae0d01(_0x5691dc);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index da34a03..0c65423 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 _0x97c1=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getFields']);router[_0x197c('0xf')]('/',auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0xf')](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0x11')]);router[_0x197c('0x12')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x14')]);module[_0x197c('0x15')]=router; \ No newline at end of file +var _0x7334=['put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0xf29579,_0x1af46f){var _0x275338=function(_0x50cff7){while(--_0x50cff7){_0xf29579['push'](_0xf29579['shift']());}};_0x275338(++_0x1af46f);}(_0x7334,0x184));var _0x4733=function(_0x369bde,_0x20f03c){_0x369bde=_0x369bde-0x0;var _0x172bf4=_0x7334[_0x369bde];return _0x172bf4;};'use strict';var multer=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var path=require(_0x4733('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4733('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4733('0x4'));var interaction=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var controller=require(_0x4733('0x7'));router[_0x4733('0x8')]('/',auth[_0x4733('0x9')](),controller[_0x4733('0xa')]);router[_0x4733('0x8')](_0x4733('0xb'),auth[_0x4733('0x9')](),controller[_0x4733('0xc')]);router[_0x4733('0x8')](_0x4733('0xd'),auth[_0x4733('0x9')](),controller[_0x4733('0xe')]);router[_0x4733('0x8')](_0x4733('0xf'),auth['isAuthenticated'](),controller[_0x4733('0x10')]);router[_0x4733('0x11')]('/',auth['isAuthenticated'](),controller[_0x4733('0x12')]);router['post'](_0x4733('0xd'),auth[_0x4733('0x9')](),controller[_0x4733('0x13')]);router[_0x4733('0x14')](_0x4733('0xb'),auth[_0x4733('0x9')](),controller[_0x4733('0x15')]);router['delete'](_0x4733('0xb'),auth['isAuthenticated'](),controller[_0x4733('0x16')]);module[_0x4733('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c11a2d2..16acb0c 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 _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x38ecf4,_0x3e6d03){var _0x3f3950=function(_0x3ea44a){while(--_0x3ea44a){_0x38ecf4['push'](_0x38ecf4['shift']());}};_0x3f3950(++_0x3e6d03);}(_0x7916,0x128));var _0x6791=function(_0x262fd4,_0x4fb43d){_0x262fd4=_0x262fd4-0x0;var _0x5b0242=_0x7916[_0x262fd4];return _0x5b0242;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x39a754,_0x2c3d44){var _0x13c655=function(_0x4002cc){while(--_0x4002cc){_0x39a754['push'](_0x39a754['shift']());}};_0x13c655(++_0x2c3d44);}(_0x9f0e,0x116));var _0xe9f0=function(_0xcb34c0,_0x43fefe){_0xcb34c0=_0xcb34c0-0x0;var _0x2bcce3=_0x9f0e[_0xcb34c0];return _0x2bcce3;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 83edf8a..828c711 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 _0x94bc=['FreshsalesConfiguration','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x137138,_0x28e56d){var _0x4b5038=function(_0x23cb65){while(--_0x23cb65){_0x137138['push'](_0x137138['shift']());}};_0x4b5038(++_0x28e56d);}(_0x94bc,0xdd));var _0xc94b=function(_0x245d76,_0x1c2c6f){_0x245d76=_0x245d76-0x0;var _0x4516f7=_0x94bc[_0x245d76];return _0x4516f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc94b('0x0'));var jsonpatch=require(_0xc94b('0x1'));var rp=require(_0xc94b('0x2'));var moment=require(_0xc94b('0x3'));var BPromise=require(_0xc94b('0x4'));var Mustache=require(_0xc94b('0x5'));var util=require('util');var path=require(_0xc94b('0x6'));var sox=require(_0xc94b('0x7'));var csv=require('to-csv');var ejs=require(_0xc94b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc94b('0x9'));var squel=require(_0xc94b('0xa'));var crypto=require('crypto');var jsforce=require(_0xc94b('0xb'));var deskjs=require(_0xc94b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc94b('0xd'));var Redis=require(_0xc94b('0xe'));var authService=require(_0xc94b('0xf'));var qs=require(_0xc94b('0x10'));var as=require(_0xc94b('0x11'));var hardwareService=require(_0xc94b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc94b('0x13'));var config=require(_0xc94b('0x14'));var licenseUtil=require(_0xc94b('0x15'));var db=require(_0xc94b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e4443,_0x375046){_0x375046=_0x375046||0xcc;return function(_0x3b8de3){if(_0x3b8de3){return _0x2e4443['sendStatus'](_0x375046);}return _0x2e4443[_0xc94b('0x17')](_0x375046)[_0xc94b('0x18')]();};}function respondWithResult(_0xe90465,_0xda76db){_0xda76db=_0xda76db||0xc8;return function(_0x399d94){if(_0x399d94){return _0xe90465[_0xc94b('0x17')](_0xda76db)[_0xc94b('0x19')](_0x399d94);}};}function respondWithFilteredResult(_0x19bf84,_0x508fbf){return function(_0x24e340){if(_0x24e340){var _0x2efbc0=typeof _0x508fbf[_0xc94b('0x1a')]===_0xc94b('0x1b')&&typeof _0x508fbf[_0xc94b('0x1c')]===_0xc94b('0x1b');var _0x101256=_0x24e340[_0xc94b('0x1d')];var _0x1bd3f9=_0x2efbc0?0x0:_0x508fbf[_0xc94b('0x1a')];var _0x4a5513=_0x2efbc0?_0x24e340[_0xc94b('0x1d')]:_0x508fbf[_0xc94b('0x1a')]+_0x508fbf['limit'];var _0x195867;if(_0x4a5513>=_0x101256){_0x4a5513=_0x101256;_0x195867=0xc8;}else{_0x195867=0xce;}_0x19bf84['status'](_0x195867);return _0x19bf84[_0xc94b('0x1e')](_0xc94b('0x1f'),_0x1bd3f9+'-'+_0x4a5513+'/'+_0x101256)[_0xc94b('0x19')](_0x24e340);}return null;};}function patchUpdates(_0x59612f){return function(_0x4dfeea){try{jsonpatch[_0xc94b('0x20')](_0x4dfeea,_0x59612f,!![]);}catch(_0x99f837){return BPromise[_0xc94b('0x21')](_0x99f837);}return _0x4dfeea[_0xc94b('0x22')]();};}function saveUpdates(_0x2054cc,_0x460454){return function(_0x551441){if(_0x551441){return _0x551441[_0xc94b('0x23')](_0x2054cc)[_0xc94b('0x24')](function(_0x1e0f67){return _0x1e0f67;});}return null;};}function removeEntity(_0x3f543d,_0x242c6a){return function(_0x2a855c){if(_0x2a855c){return _0x2a855c['destroy']()[_0xc94b('0x24')](function(){_0x3f543d[_0xc94b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178809,_0x5659d3){return function(_0x1afcad){if(!_0x1afcad){_0x178809['sendStatus'](0x194);}return _0x1afcad;};}function handleError(_0x343522,_0x1e2ad0){_0x1e2ad0=_0x1e2ad0||0x1f4;return function(_0x84cf72){logger[_0xc94b('0x25')](_0x84cf72['stack']);if(_0x84cf72[_0xc94b('0x26')]){delete _0x84cf72[_0xc94b('0x26')];}_0x343522[_0xc94b('0x17')](_0x1e2ad0)[_0xc94b('0x27')](_0x84cf72);};}exports[_0xc94b('0x28')]=function(_0x55b12e,_0x589310){var _0x160671={},_0x3efdfb={},_0x1d6161={'count':0x0,'rows':[]};var _0x17af29=_[_0xc94b('0x29')](db['FreshsalesAccount'][_0xc94b('0x2a')],function(_0x4eaaa9){return{'name':_0x4eaaa9[_0xc94b('0x2b')],'type':_0x4eaaa9[_0xc94b('0x2c')][_0xc94b('0x2d')]};});_0x3efdfb['model']=_[_0xc94b('0x29')](_0x17af29,'name');_0x3efdfb[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x55b12e['query']);_0x3efdfb[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x3efdfb['model'],_0x3efdfb[_0xc94b('0x2e')]);_0x160671[_0xc94b('0x32')]=_['intersection'](_0x3efdfb['model'],qs[_0xc94b('0x33')](_0x55b12e['query']['fields']));_0x160671['attributes']=_0x160671[_0xc94b('0x32')][_0xc94b('0x34')]?_0x160671[_0xc94b('0x32')]:_0x3efdfb[_0xc94b('0x35')];if(!_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x36')](_0xc94b('0x37'))){_0x160671['limit']=qs[_0xc94b('0x1c')](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x1c')]);_0x160671[_0xc94b('0x1a')]=qs[_0xc94b('0x1a')](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x1a')]);}_0x160671[_0xc94b('0x38')]=qs['sort'](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x39')]);_0x160671[_0xc94b('0x3a')]=qs[_0xc94b('0x30')](_[_0xc94b('0x3b')](_0x55b12e['query'],_0x3efdfb[_0xc94b('0x30')]),_0x17af29);if(_0x55b12e['query'][_0xc94b('0x3c')]){_0x160671[_0xc94b('0x3a')]=_[_0xc94b('0x3d')](_0x160671[_0xc94b('0x3a')],{'$or':_['map'](_0x17af29,function(_0x5eb7f8){if(_0x5eb7f8['type']!==_0xc94b('0x3e')){var _0x4231a5={};_0x4231a5[_0x5eb7f8[_0xc94b('0x26')]]={'$like':'%'+_0x55b12e[_0xc94b('0x2e')]['filter']+'%'};return _0x4231a5;}})});}_0x160671=_[_0xc94b('0x3d')]({},_0x160671,_0x55b12e['options']);var _0x419ec9={'where':_0x160671[_0xc94b('0x3a')]};return db[_0xc94b('0x3f')][_0xc94b('0x1d')](_0x419ec9)['then'](function(_0x48305e){_0x1d6161[_0xc94b('0x1d')]=_0x48305e;if(_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x40')]){_0x160671[_0xc94b('0x41')]=[{'all':!![]}];}return db[_0xc94b('0x3f')][_0xc94b('0x42')](_0x160671);})['then'](function(_0x13c0be){_0x1d6161[_0xc94b('0x43')]=_0x13c0be;return _0x1d6161;})['then'](respondWithFilteredResult(_0x589310,_0x160671))[_0xc94b('0x44')](handleError(_0x589310,null));};exports[_0xc94b('0x45')]=function(_0x95cef1,_0x49ef2e){var _0x6bf968={'raw':![],'where':{'id':_0x95cef1[_0xc94b('0x46')]['id']}},_0x489e49={};_0x489e49[_0xc94b('0x35')]=_[_0xc94b('0x2f')](db[_0xc94b('0x3f')]['rawAttributes']);_0x489e49[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x95cef1[_0xc94b('0x2e')]);_0x489e49[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x489e49[_0xc94b('0x35')],_0x489e49[_0xc94b('0x2e')]);_0x6bf968[_0xc94b('0x32')]=_[_0xc94b('0x31')](_0x489e49[_0xc94b('0x35')],qs[_0xc94b('0x33')](_0x95cef1[_0xc94b('0x2e')][_0xc94b('0x33')]));_0x6bf968[_0xc94b('0x32')]=_0x6bf968[_0xc94b('0x32')][_0xc94b('0x34')]?_0x6bf968[_0xc94b('0x32')]:_0x489e49[_0xc94b('0x35')];if(_0x95cef1[_0xc94b('0x2e')]['includeAll']){_0x6bf968[_0xc94b('0x41')]=[{'all':!![]}];}_0x6bf968=_[_0xc94b('0x3d')]({},_0x6bf968,_0x95cef1[_0xc94b('0x47')]);return db['FreshsalesAccount'][_0xc94b('0x48')](_0x6bf968)[_0xc94b('0x24')](handleEntityNotFound(_0x49ef2e,null))['then'](respondWithResult(_0x49ef2e,null))[_0xc94b('0x44')](handleError(_0x49ef2e,null));};exports[_0xc94b('0x49')]=function(_0x26c6ea,_0x531467){return db[_0xc94b('0x3f')][_0xc94b('0x49')](_0x26c6ea[_0xc94b('0x4a')],{})[_0xc94b('0x24')](respondWithResult(_0x531467,0xc9))['catch'](handleError(_0x531467,null));};exports[_0xc94b('0x23')]=function(_0x3101d5,_0x49d723){if(_0x3101d5['body']['id']){delete _0x3101d5[_0xc94b('0x4a')]['id'];}return db[_0xc94b('0x3f')]['find']({'where':{'id':_0x3101d5['params']['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x49d723,null))[_0xc94b('0x24')](saveUpdates(_0x3101d5[_0xc94b('0x4a')],null))[_0xc94b('0x24')](respondWithResult(_0x49d723,null))[_0xc94b('0x44')](handleError(_0x49d723,null));};exports[_0xc94b('0x4b')]=function(_0x80152e,_0x2f6440){return db['FreshsalesAccount'][_0xc94b('0x48')]({'where':{'id':_0x80152e[_0xc94b('0x46')]['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x2f6440,null))[_0xc94b('0x24')](removeEntity(_0x2f6440,null))['catch'](handleError(_0x2f6440,null));};exports[_0xc94b('0x4c')]=function(_0x70361a,_0x487b93,_0x505316){var _0xfea91a={};var _0x554441={};var _0x1ba334;var _0x52369e;return db[_0xc94b('0x3f')]['findOne']({'where':{'id':_0x70361a[_0xc94b('0x46')]['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x487b93,null))['then'](function(_0x3c788a){if(_0x3c788a){_0x1ba334=_0x3c788a;_0x554441[_0xc94b('0x35')]=_[_0xc94b('0x2f')](db['FreshsalesConfiguration'][_0xc94b('0x2a')]);_0x554441[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x70361a['query']);_0x554441[_0xc94b('0x30')]=_['intersection'](_0x554441[_0xc94b('0x35')],_0x554441[_0xc94b('0x2e')]);_0xfea91a[_0xc94b('0x32')]=_[_0xc94b('0x31')](_0x554441['model'],qs[_0xc94b('0x33')](_0x70361a[_0xc94b('0x2e')]['fields']));_0xfea91a[_0xc94b('0x32')]=_0xfea91a[_0xc94b('0x32')]['length']?_0xfea91a[_0xc94b('0x32')]:_0x554441[_0xc94b('0x35')];_0xfea91a[_0xc94b('0x38')]=qs[_0xc94b('0x39')](_0x70361a[_0xc94b('0x2e')][_0xc94b('0x39')]);_0xfea91a[_0xc94b('0x3a')]=qs['filters'](_[_0xc94b('0x3b')](_0x70361a[_0xc94b('0x2e')],_0x554441['filters']));if(_0x70361a[_0xc94b('0x2e')][_0xc94b('0x3c')]){_0xfea91a[_0xc94b('0x3a')]=_[_0xc94b('0x3d')](_0xfea91a['where'],{'$or':_[_0xc94b('0x29')](_0xfea91a[_0xc94b('0x32')],function(_0x45417a){var _0x2738d0={};_0x2738d0[_0x45417a]={'$like':'%'+_0x70361a[_0xc94b('0x2e')][_0xc94b('0x3c')]+'%'};return _0x2738d0;})});}_0xfea91a=_[_0xc94b('0x3d')]({},_0xfea91a,_0x70361a[_0xc94b('0x47')]);return _0x1ba334[_0xc94b('0x4c')](_0xfea91a);}})['then'](function(_0x4d03d1){if(_0x4d03d1){_0x52369e=_0x4d03d1['length'];if(!_0x70361a['query'][_0xc94b('0x36')](_0xc94b('0x37'))){_0xfea91a[_0xc94b('0x1c')]=qs[_0xc94b('0x1c')](_0x70361a[_0xc94b('0x2e')][_0xc94b('0x1c')]);_0xfea91a[_0xc94b('0x1a')]=qs[_0xc94b('0x1a')](_0x70361a[_0xc94b('0x2e')]['offset']);}return _0x1ba334[_0xc94b('0x4c')](_0xfea91a);}})[_0xc94b('0x24')](function(_0x2be4ed){if(_0x2be4ed){return _0x2be4ed?{'count':_0x52369e,'rows':_0x2be4ed}:null;}})[_0xc94b('0x24')](respondWithResult(_0x487b93,null))[_0xc94b('0x44')](handleError(_0x487b93,null));};exports[_0xc94b('0x4d')]=function(_0x5e212c,_0x369c52,_0x50b22e){if(_0x5e212c[_0xc94b('0x4a')]['id']){delete _0x5e212c[_0xc94b('0x4a')]['id'];}return db[_0xc94b('0x3f')][_0xc94b('0x4e')]({'where':{'id':_0x5e212c['params']['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x369c52,null))['then'](function(_0x2d4ccd){if(_0x2d4ccd){_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x4f')]=_0x2d4ccd['id'];_0x5e212c['body'][_0xc94b('0x50')]=integrations[_0xc94b('0x51')](_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x52')],_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x2c')]);_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x53')]=integrations[_0xc94b('0x54')](_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x52')],_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x2c')]);return db[_0xc94b('0x55')][_0xc94b('0x49')](_0x5e212c[_0xc94b('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0xc94b('0x50')},{'model':db['FreshsalesField'],'as':_0xc94b('0x53')}]});}return null;})[_0xc94b('0x24')](respondWithResult(_0x369c52,null))['catch'](handleError(_0x369c52,null));};exports['getFields']=function(_0x1792fc,_0x2028df,_0x58f0f8){var _0x273ea7='';var _0x2b908f='';return db['FreshsalesAccount'][_0xc94b('0x4e')]({'where':{'id':_0x1792fc[_0xc94b('0x46')]['id']},'attributes':['id',_0xc94b('0x56'),_0xc94b('0x57'),_0xc94b('0x58')]})[_0xc94b('0x24')](handleEntityNotFound(_0x2028df,null))[_0xc94b('0x24')](function(_0x471b05){if(_0x471b05){_0x2b908f=_0x471b05['username'];_0x273ea7=_0x471b05[_0xc94b('0x57')];var _0x1c82dc=_0x471b05[_0xc94b('0x57')][_0xc94b('0x59')](-0x1);if(_0x1c82dc==='/'){_0x273ea7=_0x273ea7['substring'](0x0,_0x273ea7[_0xc94b('0x5a')](_0x1c82dc));}return rp({'method':_0xc94b('0x5b'),'uri':util[_0xc94b('0x5c')]('%s%s',_0x273ea7,_0xc94b('0x5d')),'headers':{'Authorization':_0xc94b('0x5e')+_0x471b05[_0xc94b('0x58')]},'json':!![]});}})[_0xc94b('0x24')](function(_0xd3dfbd){if(_0xd3dfbd){var _0x2c3c9d=_0xd3dfbd[_0xc94b('0x5f')];var _0x93428=![];var _0x923e85=null;for(_0x923e85=0x0;_0x923e85<_0x2c3c9d[_0xc94b('0x34')];_0x923e85++){if(_0x2c3c9d[_0x923e85]['email']===_0x2b908f){_0x93428=!![];}}if(_0x93428){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc94b('0x60')});}}})[_0xc94b('0x24')](respondWithResult(_0x2028df,null))[_0xc94b('0x44')](function(_0x1c68ba){var _0x956328=_0x1792fc[_0xc94b('0x2e')][_0xc94b('0x61')]?0x1f4:_0x1c68ba['statusCode']||0x1f4;logger[_0xc94b('0x25')](_0xc94b('0x62'),_0xc94b('0x63'),_0x956328,JSON[_0xc94b('0x64')](_0x1c68ba));delete _0x1c68ba[_0xc94b('0x26')];if(_0x956328===0x191){_0x956328=0x190;}_0x2028df['status'](_0x956328)[_0xc94b('0x27')](_0x1792fc['query'][_0xc94b('0x61')]?{'message':_0xc94b('0x65'),'statusCode':_0x1c68ba['statusCode']}:_0x1c68ba);});}; \ No newline at end of file +var _0x145a=['eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','then','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','slice','substring','GET','%s%s','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x145a,0x132));var _0xa145=function(_0x4ea96b,_0x383d5b){_0x4ea96b=_0x4ea96b-0x0;var _0x1334c1=_0x145a[_0x4ea96b];return _0x1334c1;};'use strict';var emlformat=require(_0xa145('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa145('0x1'));var rp=require(_0xa145('0x2'));var moment=require(_0xa145('0x3'));var BPromise=require(_0xa145('0x4'));var Mustache=require('mustache');var util=require(_0xa145('0x5'));var path=require(_0xa145('0x6'));var sox=require('sox');var csv=require(_0xa145('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa145('0x8'));var _=require('lodash');var squel=require(_0xa145('0x9'));var crypto=require(_0xa145('0xa'));var jsforce=require(_0xa145('0xb'));var deskjs=require(_0xa145('0xc'));var toCsv=require(_0xa145('0x7'));var querystring=require('querystring');var Papa=require(_0xa145('0xd'));var Redis=require(_0xa145('0xe'));var authService=require(_0xa145('0xf'));var qs=require(_0xa145('0x10'));var as=require(_0xa145('0x11'));var hardwareService=require(_0xa145('0x12'));var logger=require(_0xa145('0x13'))('api');var utils=require(_0xa145('0x14'));var config=require(_0xa145('0x15'));var licenseUtil=require(_0xa145('0x16'));var db=require(_0xa145('0x17'))['db'];var integrations=require(_0xa145('0x18'));function respondWithStatusCode(_0x4640d0,_0xe8e75){_0xe8e75=_0xe8e75||0xcc;return function(_0x5567ae){if(_0x5567ae){return _0x4640d0[_0xa145('0x19')](_0xe8e75);}return _0x4640d0[_0xa145('0x1a')](_0xe8e75)[_0xa145('0x1b')]();};}function respondWithResult(_0x425e70,_0x49e36d){_0x49e36d=_0x49e36d||0xc8;return function(_0x5ebf05){if(_0x5ebf05){return _0x425e70[_0xa145('0x1a')](_0x49e36d)[_0xa145('0x1c')](_0x5ebf05);}};}function respondWithFilteredResult(_0x1557f5,_0x955df1){return function(_0x461174){if(_0x461174){var _0x550b9b=typeof _0x955df1[_0xa145('0x1d')]===_0xa145('0x1e')&&typeof _0x955df1[_0xa145('0x1f')]===_0xa145('0x1e');var _0x49ae08=_0x461174['count'];var _0x16cd45=_0x550b9b?0x0:_0x955df1['offset'];var _0x4005b8=_0x550b9b?_0x461174[_0xa145('0x20')]:_0x955df1[_0xa145('0x1d')]+_0x955df1[_0xa145('0x1f')];var _0x4690fd;if(_0x4005b8>=_0x49ae08){_0x4005b8=_0x49ae08;_0x4690fd=0xc8;}else{_0x4690fd=0xce;}_0x1557f5['status'](_0x4690fd);return _0x1557f5[_0xa145('0x21')](_0xa145('0x22'),_0x16cd45+'-'+_0x4005b8+'/'+_0x49ae08)[_0xa145('0x1c')](_0x461174);}return null;};}function patchUpdates(_0x22e37f){return function(_0xd00ae){try{jsonpatch[_0xa145('0x23')](_0xd00ae,_0x22e37f,!![]);}catch(_0x2d8730){return BPromise[_0xa145('0x24')](_0x2d8730);}return _0xd00ae['save']();};}function saveUpdates(_0xfd4fb,_0x5ef18d){return function(_0x5bb87a){if(_0x5bb87a){return _0x5bb87a[_0xa145('0x25')](_0xfd4fb)['then'](function(_0x3418d4){return _0x3418d4;});}return null;};}function removeEntity(_0xc1fc51,_0x19dd62){return function(_0x21f7a1){if(_0x21f7a1){return _0x21f7a1[_0xa145('0x26')]()['then'](function(){_0xc1fc51[_0xa145('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdcac18,_0x3c91c2){return function(_0x1d0dd1){if(!_0x1d0dd1){_0xdcac18[_0xa145('0x19')](0x194);}return _0x1d0dd1;};}function handleError(_0xc4a318,_0x1e5d30){_0x1e5d30=_0x1e5d30||0x1f4;return function(_0x128204){logger['error'](_0x128204[_0xa145('0x27')]);if(_0x128204[_0xa145('0x28')]){delete _0x128204['name'];}_0xc4a318[_0xa145('0x1a')](_0x1e5d30)[_0xa145('0x29')](_0x128204);};}exports[_0xa145('0x2a')]=function(_0x358a2a,_0x244f33){var _0x5c9603={},_0x242797={},_0x197dbd={'count':0x0,'rows':[]};var _0x1adf0b=_[_0xa145('0x2b')](db[_0xa145('0x2c')][_0xa145('0x2d')],function(_0x1b76be){return{'name':_0x1b76be[_0xa145('0x2e')],'type':_0x1b76be[_0xa145('0x2f')][_0xa145('0x30')]};});_0x242797['model']=_[_0xa145('0x2b')](_0x1adf0b,'name');_0x242797[_0xa145('0x31')]=_['keys'](_0x358a2a[_0xa145('0x31')]);_0x242797[_0xa145('0x32')]=_[_0xa145('0x33')](_0x242797['model'],_0x242797['query']);_0x5c9603[_0xa145('0x34')]=_[_0xa145('0x33')](_0x242797[_0xa145('0x35')],qs[_0xa145('0x36')](_0x358a2a['query'][_0xa145('0x36')]));_0x5c9603[_0xa145('0x34')]=_0x5c9603[_0xa145('0x34')][_0xa145('0x37')]?_0x5c9603[_0xa145('0x34')]:_0x242797[_0xa145('0x35')];if(!_0x358a2a[_0xa145('0x31')][_0xa145('0x38')](_0xa145('0x39'))){_0x5c9603[_0xa145('0x1f')]=qs[_0xa145('0x1f')](_0x358a2a[_0xa145('0x31')]['limit']);_0x5c9603['offset']=qs[_0xa145('0x1d')](_0x358a2a[_0xa145('0x31')][_0xa145('0x1d')]);}_0x5c9603['order']=qs[_0xa145('0x3a')](_0x358a2a[_0xa145('0x31')][_0xa145('0x3a')]);_0x5c9603['where']=qs[_0xa145('0x32')](_[_0xa145('0x3b')](_0x358a2a[_0xa145('0x31')],_0x242797[_0xa145('0x32')]),_0x1adf0b);if(_0x358a2a['query']['filter']){_0x5c9603[_0xa145('0x3c')]=_[_0xa145('0x3d')](_0x5c9603[_0xa145('0x3c')],{'$or':_[_0xa145('0x2b')](_0x1adf0b,function(_0x181111){if(_0x181111[_0xa145('0x2f')]!=='VIRTUAL'){var _0x5ba32d={};_0x5ba32d[_0x181111['name']]={'$like':'%'+_0x358a2a[_0xa145('0x31')][_0xa145('0x3e')]+'%'};return _0x5ba32d;}})});}_0x5c9603=_[_0xa145('0x3d')]({},_0x5c9603,_0x358a2a[_0xa145('0x3f')]);var _0x33554c={'where':_0x5c9603['where']};return db['FreshsalesAccount'][_0xa145('0x20')](_0x33554c)[_0xa145('0x40')](function(_0x68b2d2){_0x197dbd['count']=_0x68b2d2;if(_0x358a2a[_0xa145('0x31')]['includeAll']){_0x5c9603[_0xa145('0x41')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xa145('0x42')](_0x5c9603);})[_0xa145('0x40')](function(_0x17ebab){_0x197dbd[_0xa145('0x43')]=_0x17ebab;return _0x197dbd;})[_0xa145('0x40')](respondWithFilteredResult(_0x244f33,_0x5c9603))[_0xa145('0x44')](handleError(_0x244f33,null));};exports[_0xa145('0x45')]=function(_0x3d7c03,_0x4c9671){var _0x3753d1={'raw':![],'where':{'id':_0x3d7c03[_0xa145('0x46')]['id']}},_0x254166={};_0x254166['model']=_[_0xa145('0x47')](db[_0xa145('0x2c')][_0xa145('0x2d')]);_0x254166[_0xa145('0x31')]=_[_0xa145('0x47')](_0x3d7c03[_0xa145('0x31')]);_0x254166[_0xa145('0x32')]=_[_0xa145('0x33')](_0x254166[_0xa145('0x35')],_0x254166['query']);_0x3753d1[_0xa145('0x34')]=_['intersection'](_0x254166[_0xa145('0x35')],qs['fields'](_0x3d7c03[_0xa145('0x31')][_0xa145('0x36')]));_0x3753d1[_0xa145('0x34')]=_0x3753d1[_0xa145('0x34')][_0xa145('0x37')]?_0x3753d1['attributes']:_0x254166[_0xa145('0x35')];if(_0x3d7c03[_0xa145('0x31')][_0xa145('0x48')]){_0x3753d1['include']=[{'all':!![]}];}_0x3753d1=_[_0xa145('0x3d')]({},_0x3753d1,_0x3d7c03[_0xa145('0x3f')]);return db[_0xa145('0x2c')][_0xa145('0x49')](_0x3753d1)[_0xa145('0x40')](handleEntityNotFound(_0x4c9671,null))['then'](respondWithResult(_0x4c9671,null))[_0xa145('0x44')](handleError(_0x4c9671,null));};exports[_0xa145('0x4a')]=function(_0x4aeab6,_0x4ff7ad){return db['FreshsalesAccount'][_0xa145('0x4a')](_0x4aeab6[_0xa145('0x4b')],{})[_0xa145('0x40')](respondWithResult(_0x4ff7ad,0xc9))['catch'](handleError(_0x4ff7ad,null));};exports['update']=function(_0xc23543,_0x828074){if(_0xc23543[_0xa145('0x4b')]['id']){delete _0xc23543[_0xa145('0x4b')]['id'];}return db[_0xa145('0x2c')]['find']({'where':{'id':_0xc23543[_0xa145('0x46')]['id']}})[_0xa145('0x40')](handleEntityNotFound(_0x828074,null))[_0xa145('0x40')](saveUpdates(_0xc23543[_0xa145('0x4b')],null))[_0xa145('0x40')](respondWithResult(_0x828074,null))['catch'](handleError(_0x828074,null));};exports['destroy']=function(_0x5b3dfe,_0x26a4f9){return db[_0xa145('0x2c')][_0xa145('0x49')]({'where':{'id':_0x5b3dfe[_0xa145('0x46')]['id']}})[_0xa145('0x40')](handleEntityNotFound(_0x26a4f9,null))['then'](removeEntity(_0x26a4f9,null))[_0xa145('0x44')](handleError(_0x26a4f9,null));};exports[_0xa145('0x4c')]=function(_0x1f93ed,_0x5d066f,_0x13e5a5){var _0x3c991a={};var _0x393c8e={};var _0x2415ef;var _0x258c66;return db[_0xa145('0x2c')][_0xa145('0x4d')]({'where':{'id':_0x1f93ed[_0xa145('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d066f,null))[_0xa145('0x40')](function(_0x1c9e4f){if(_0x1c9e4f){_0x2415ef=_0x1c9e4f;_0x393c8e[_0xa145('0x35')]=_[_0xa145('0x47')](db['FreshsalesConfiguration'][_0xa145('0x2d')]);_0x393c8e[_0xa145('0x31')]=_[_0xa145('0x47')](_0x1f93ed[_0xa145('0x31')]);_0x393c8e[_0xa145('0x32')]=_[_0xa145('0x33')](_0x393c8e['model'],_0x393c8e[_0xa145('0x31')]);_0x3c991a[_0xa145('0x34')]=_[_0xa145('0x33')](_0x393c8e[_0xa145('0x35')],qs['fields'](_0x1f93ed[_0xa145('0x31')][_0xa145('0x36')]));_0x3c991a[_0xa145('0x34')]=_0x3c991a[_0xa145('0x34')]['length']?_0x3c991a['attributes']:_0x393c8e[_0xa145('0x35')];_0x3c991a[_0xa145('0x4e')]=qs[_0xa145('0x3a')](_0x1f93ed[_0xa145('0x31')][_0xa145('0x3a')]);_0x3c991a['where']=qs['filters'](_[_0xa145('0x3b')](_0x1f93ed[_0xa145('0x31')],_0x393c8e[_0xa145('0x32')]));if(_0x1f93ed[_0xa145('0x31')][_0xa145('0x3e')]){_0x3c991a[_0xa145('0x3c')]=_[_0xa145('0x3d')](_0x3c991a[_0xa145('0x3c')],{'$or':_[_0xa145('0x2b')](_0x3c991a[_0xa145('0x34')],function(_0x4284d9){var _0x47f171={};_0x47f171[_0x4284d9]={'$like':'%'+_0x1f93ed[_0xa145('0x31')]['filter']+'%'};return _0x47f171;})});}_0x3c991a=_[_0xa145('0x3d')]({},_0x3c991a,_0x1f93ed['options']);return _0x2415ef['getConfigurations'](_0x3c991a);}})['then'](function(_0x2e0186){if(_0x2e0186){_0x258c66=_0x2e0186[_0xa145('0x37')];if(!_0x1f93ed[_0xa145('0x31')][_0xa145('0x38')](_0xa145('0x39'))){_0x3c991a[_0xa145('0x1f')]=qs[_0xa145('0x1f')](_0x1f93ed[_0xa145('0x31')][_0xa145('0x1f')]);_0x3c991a[_0xa145('0x1d')]=qs['offset'](_0x1f93ed[_0xa145('0x31')][_0xa145('0x1d')]);}return _0x2415ef[_0xa145('0x4c')](_0x3c991a);}})[_0xa145('0x40')](function(_0x5ca1e6){if(_0x5ca1e6){return _0x5ca1e6?{'count':_0x258c66,'rows':_0x5ca1e6}:null;}})['then'](respondWithResult(_0x5d066f,null))['catch'](handleError(_0x5d066f,null));};exports[_0xa145('0x4f')]=function(_0x4d6827,_0x37281a,_0x21ce09){if(_0x4d6827['body']['id']){delete _0x4d6827[_0xa145('0x4b')]['id'];}return db[_0xa145('0x2c')]['findOne']({'where':{'id':_0x4d6827[_0xa145('0x46')]['id']}})[_0xa145('0x40')](handleEntityNotFound(_0x37281a,null))[_0xa145('0x40')](function(_0x43badd){if(_0x43badd){_0x4d6827[_0xa145('0x4b')][_0xa145('0x50')]=_0x43badd['id'];_0x4d6827['body'][_0xa145('0x51')]=integrations[_0xa145('0x52')](_0x4d6827['body']['channel'],_0x4d6827['body'][_0xa145('0x2f')]);_0x4d6827['body'][_0xa145('0x53')]=integrations[_0xa145('0x54')](_0x4d6827[_0xa145('0x4b')][_0xa145('0x55')],_0x4d6827[_0xa145('0x4b')]['type']);return db[_0xa145('0x56')]['create'](_0x4d6827[_0xa145('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':_0xa145('0x51')},{'model':db[_0xa145('0x57')],'as':_0xa145('0x53')}]});}return null;})[_0xa145('0x40')](respondWithResult(_0x37281a,null))[_0xa145('0x44')](handleError(_0x37281a,null));};exports['getFields']=function(_0x17cfff,_0x212b8a,_0x4c01cf){var _0xe91265='';var _0x5b1f49='';return db[_0xa145('0x2c')][_0xa145('0x4d')]({'where':{'id':_0x17cfff[_0xa145('0x46')]['id']},'attributes':['id',_0xa145('0x58'),_0xa145('0x59'),_0xa145('0x5a')]})[_0xa145('0x40')](handleEntityNotFound(_0x212b8a,null))['then'](function(_0xa49664){if(_0xa49664){_0x5b1f49=_0xa49664['username'];_0xe91265=_0xa49664[_0xa145('0x59')];var _0x262eeb=_0xa49664[_0xa145('0x59')][_0xa145('0x5b')](-0x1);if(_0x262eeb==='/'){_0xe91265=_0xe91265[_0xa145('0x5c')](0x0,_0xe91265['lastIndexOf'](_0x262eeb));}return rp({'method':_0xa145('0x5d'),'uri':util['format'](_0xa145('0x5e'),_0xe91265,'/api/selector/owners'),'headers':{'Authorization':_0xa145('0x5f')+_0xa49664['apiKey']},'json':!![]});}})[_0xa145('0x40')](function(_0x939740){if(_0x939740){var _0x54061c=_0x939740['users'];var _0x34e253=![];var _0x45ec01=null;for(_0x45ec01=0x0;_0x45ec01<_0x54061c[_0xa145('0x37')];_0x45ec01++){if(_0x54061c[_0x45ec01][_0xa145('0x60')]===_0x5b1f49){_0x34e253=!![];}}if(_0x34e253){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa145('0x61')});}}})[_0xa145('0x40')](respondWithResult(_0x212b8a,null))['catch'](function(_0x37ec75){var _0xa23afd=_0x17cfff[_0xa145('0x31')]['test']?0x1f4:_0x37ec75[_0xa145('0x62')]||0x1f4;logger['error'](_0xa145('0x63'),_0xa145('0x64'),_0xa23afd,JSON['stringify'](_0x37ec75));delete _0x37ec75['name'];if(_0xa23afd===0x191){_0xa23afd=0x190;}_0x212b8a[_0xa145('0x1a')](_0xa23afd)['send'](_0x17cfff[_0xa145('0x31')]['test']?{'message':_0xa145('0x65'),'statusCode':_0x37ec75[_0xa145('0x62')]}:_0x37ec75);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index bf9dd3c..6aeee5a 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 _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'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'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd6=['path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4fc55b,_0xcfe664){var _0x4a0f37=function(_0x57d8b6){while(--_0x57d8b6){_0x4fc55b['push'](_0x4fc55b['shift']());}};_0x4a0f37(++_0xcfe664);}(_0xffd6,0x97));var _0x6ffd=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0xffd6[_0x5192de];return _0x4e287e;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));var integrations=require(_0x6ffd('0x8'));module[_0x6ffd('0x9')]=function(_0x561055,_0x122b71){return _0x561055[_0x6ffd('0xa')](_0x6ffd('0xb'),attributes,{'tableName':_0x6ffd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 16532ad..403846a 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 _0x6050=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5ae89c,_0x1d183a){var _0x566bfc=function(_0x425371){while(--_0x425371){_0x5ae89c['push'](_0x5ae89c['shift']());}};_0x566bfc(++_0x1d183a);}(_0x6050,0x196));var _0x0605=function(_0x5daea4,_0x533cc6){_0x5daea4=_0x5daea4-0x0;var _0xbb5fa=_0x6050[_0x5daea4];return _0xbb5fa;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});}exports[_0x0605('0x16')]=function(_0x2b7b5a){var _0x1d57ba=this;return new Promise(function(_0x193520,_0x40abb2){return db[_0x0605('0x17')][_0x0605('0x18')]({'raw':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'limit':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1c')]||null:null,'include':_0x2b7b5a['options']?_0x2b7b5a[_0x0605('0x19')]['include']?_[_0x0605('0x1d')](_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1e')],function(_0xf182c4){return{'model':db[_0xf182c4[_0x0605('0x1f')]],'as':_0xf182c4['as'],'attributes':_0xf182c4[_0x0605('0x1b')],'include':_0xf182c4[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0xf182c4[_0x0605('0x1e')],function(_0x2896d7){return{'model':db[_0x2896d7[_0x0605('0x1f')]],'as':_0x2896d7['as'],'attributes':_0x2896d7[_0x0605('0x1b')],'include':_0x2896d7['include']?_[_0x0605('0x1d')](_0x2896d7[_0x0605('0x1e')],function(_0x4b1e0c){return{'model':db[_0x4b1e0c['model']],'as':_0x4b1e0c['as'],'attributes':_0x4b1e0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x226825){logger[_0x0605('0x14')](_0x0605('0x16'),_0x2b7b5a);logger[_0x0605('0xe')](_0x0605('0x16'),_0x2b7b5a,JSON['stringify'](_0x226825));_0x193520(_0x226825);})[_0x0605('0x15')](function(_0x5daef6){logger[_0x0605('0x11')](_0x0605('0x16'),_0x5daef6[_0x0605('0x13')],_0x2b7b5a);_0x40abb2(_0x1d57ba[_0x0605('0x11')](0x1f4,_0x5daef6[_0x0605('0x13')]));});});};exports[_0x0605('0x20')]=function(_0x56dd1a){var _0x165a0c=this;return new Promise(function(_0xf885cc,_0x2764b6){return db[_0x0605('0x17')][_0x0605('0x21')]({'raw':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x22')]===undefined?!![]:![]:!![],'where':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'include':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')],function(_0x3a1c75){return{'model':db[_0x3a1c75[_0x0605('0x1f')]],'as':_0x3a1c75['as'],'attributes':_0x3a1c75[_0x0605('0x1b')],'include':_0x3a1c75[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x3a1c75[_0x0605('0x1e')],function(_0xe7701d){return{'model':db[_0xe7701d['model']],'as':_0xe7701d['as'],'attributes':_0xe7701d[_0x0605('0x1b')],'include':_0xe7701d[_0x0605('0x1e')]?_['map'](_0xe7701d[_0x0605('0x1e')],function(_0x128428){return{'model':db[_0x128428['model']],'as':_0x128428['as'],'attributes':_0x128428[_0x0605('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x239e8f){logger[_0x0605('0x14')](_0x0605('0x20'),_0x56dd1a);logger[_0x0605('0xe')]('ShowFreshsalesAccount',_0x56dd1a,JSON['stringify'](_0x239e8f));_0xf885cc(_0x239e8f);})[_0x0605('0x15')](function(_0x18f7f2){logger[_0x0605('0x11')]('ShowFreshsalesAccount',_0x18f7f2[_0x0605('0x13')],_0x56dd1a);_0x2764b6(_0x165a0c['error'](0x1f4,_0x18f7f2[_0x0605('0x13')]));});});}; \ No newline at end of file +var _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7ee1,0x8d));var _0x17ee=function(_0x189a5a,_0x51c41e){_0x189a5a=_0x189a5a-0x0;var _0x22e5b7=_0x7ee1[_0x189a5a];return _0x22e5b7;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 5daea7a..cbd1ff9 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 _0xbd87=['../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbd87,0xb6));var _0x7bd8=function(_0x5314c9,_0x232b58){_0x5314c9=_0x5314c9-0x0;var _0x54b066=_0xbd87[_0x5314c9];return _0x54b066;};'use strict';var multer=require(_0x7bd8('0x0'));var util=require(_0x7bd8('0x1'));var path=require(_0x7bd8('0x2'));var timeout=require(_0x7bd8('0x3'));var express=require(_0x7bd8('0x4'));var router=express[_0x7bd8('0x5')]();var fs_extra=require(_0x7bd8('0x6'));var auth=require(_0x7bd8('0x7'));var interaction=require(_0x7bd8('0x8'));var config=require('../../config/environment');var controller=require(_0x7bd8('0x9'));router[_0x7bd8('0xa')]('/',auth[_0x7bd8('0xb')](),controller[_0x7bd8('0xc')]);router[_0x7bd8('0xa')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0xe')]);router['get'](_0x7bd8('0xf'),auth['isAuthenticated'](),controller[_0x7bd8('0x10')]);router[_0x7bd8('0xa')](_0x7bd8('0x11'),auth[_0x7bd8('0xb')](),controller['getDescriptions']);router['get'](_0x7bd8('0x12'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x13')]);router[_0x7bd8('0x14')]('/',auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x15')]);router[_0x7bd8('0x16')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x17')]);router[_0x7bd8('0x18')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x19')]);module[_0x7bd8('0x1a')]=router; \ No newline at end of file +var _0x8f71=['index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x6020c7,_0x9ed152){var _0x2ea5cb=function(_0x509bce){while(--_0x509bce){_0x6020c7['push'](_0x6020c7['shift']());}};_0x2ea5cb(++_0x9ed152);}(_0x8f71,0x113));var _0x18f7=function(_0x372dd5,_0x23c1d5){_0x372dd5=_0x372dd5-0x0;var _0x3c935e=_0x8f71[_0x372dd5];return _0x3c935e;};'use strict';var multer=require(_0x18f7('0x0'));var util=require(_0x18f7('0x1'));var path=require(_0x18f7('0x2'));var timeout=require(_0x18f7('0x3'));var express=require(_0x18f7('0x4'));var router=express[_0x18f7('0x5')]();var fs_extra=require(_0x18f7('0x6'));var auth=require(_0x18f7('0x7'));var interaction=require(_0x18f7('0x8'));var config=require(_0x18f7('0x9'));var controller=require(_0x18f7('0xa'));router[_0x18f7('0xb')]('/',auth[_0x18f7('0xc')](),controller[_0x18f7('0xd')]);router['get'](_0x18f7('0xe'),auth[_0x18f7('0xc')](),controller['show']);router[_0x18f7('0xb')](_0x18f7('0xf'),auth[_0x18f7('0xc')](),controller[_0x18f7('0x10')]);router[_0x18f7('0xb')](_0x18f7('0x11'),auth[_0x18f7('0xc')](),controller['getDescriptions']);router[_0x18f7('0xb')]('/:id/fields',auth[_0x18f7('0xc')](),controller[_0x18f7('0x12')]);router[_0x18f7('0x13')]('/',auth['isAuthenticated'](),controller[_0x18f7('0x14')]);router['put'](_0x18f7('0xe'),auth['isAuthenticated'](),controller[_0x18f7('0x15')]);router[_0x18f7('0x16')]('/:id',auth[_0x18f7('0xc')](),controller[_0x18f7('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 47d2f7b..d55db55 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 _0x92e3=['STRING','sequelize'];(function(_0x16f05d,_0x2d6fc0){var _0x3b9219=function(_0x325e1f){while(--_0x325e1f){_0x16f05d['push'](_0x16f05d['shift']());}};_0x3b9219(++_0x2d6fc0);}(_0x92e3,0xd9));var _0x392e=function(_0x24ee98,_0x24ffe6){_0x24ee98=_0x24ee98-0x0;var _0x203983=_0x92e3[_0x24ee98];return _0x203983;};'use strict';var Sequelize=require(_0x392e('0x0'));module['exports']={'name':{'type':Sequelize[_0x392e('0x1')]},'description':{'type':Sequelize[_0x392e('0x1')]}}; \ No newline at end of file +var _0x76b6=['exports','STRING'];(function(_0x86e96f,_0x2ebc1b){var _0x335d08=function(_0x2773a4){while(--_0x2773a4){_0x86e96f['push'](_0x86e96f['shift']());}};_0x335d08(++_0x2ebc1b);}(_0x76b6,0x138));var _0x676b=function(_0x50d2d3,_0x4da9ee){_0x50d2d3=_0x50d2d3-0x0;var _0x12f6ac=_0x76b6[_0x50d2d3];return _0x12f6ac;};'use strict';var Sequelize=require('sequelize');module[_0x676b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x676b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f05087b..0793496 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 _0x6c65=['index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','findOne','FreshsalesField','pick','hasOwnProperty','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','send'];(function(_0x2110a0,_0x3ef1cb){var _0x2c00b1=function(_0x4e8f2a){while(--_0x4e8f2a){_0x2110a0['push'](_0x2110a0['shift']());}};_0x2c00b1(++_0x3ef1cb);}(_0x6c65,0x78));var _0x56c6=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0x6c65[_0x236912];return _0x582904;};'use strict';var emlformat=require(_0x56c6('0x0'));var rimraf=require(_0x56c6('0x1'));var zipdir=require(_0x56c6('0x2'));var jsonpatch=require(_0x56c6('0x3'));var rp=require(_0x56c6('0x4'));var moment=require(_0x56c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56c6('0x6'));var util=require(_0x56c6('0x7'));var path=require(_0x56c6('0x8'));var sox=require(_0x56c6('0x9'));var csv=require(_0x56c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56c6('0xb'));var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0xa'));var querystring=require(_0x56c6('0x10'));var Papa=require(_0x56c6('0x11'));var Redis=require('ioredis');var authService=require(_0x56c6('0x12'));var qs=require(_0x56c6('0x13'));var as=require(_0x56c6('0x14'));var hardwareService=require(_0x56c6('0x15'));var logger=require(_0x56c6('0x16'))(_0x56c6('0x17'));var utils=require('../../config/utils');var config=require(_0x56c6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7c67,_0x2bb84e){_0x2bb84e=_0x2bb84e||0xcc;return function(_0x3310ed){if(_0x3310ed){return _0x1d7c67[_0x56c6('0x19')](_0x2bb84e);}return _0x1d7c67['status'](_0x2bb84e)[_0x56c6('0x1a')]();};}function respondWithResult(_0x511316,_0x17f72e){_0x17f72e=_0x17f72e||0xc8;return function(_0x59b7b5){if(_0x59b7b5){return _0x511316[_0x56c6('0x1b')](_0x17f72e)['json'](_0x59b7b5);}};}function respondWithFilteredResult(_0x557189,_0x4b47ce){return function(_0x4d0838){if(_0x4d0838){var _0x3e6082=typeof _0x4b47ce['offset']===_0x56c6('0x1c')&&typeof _0x4b47ce['limit']===_0x56c6('0x1c');var _0x49fff5=_0x4d0838[_0x56c6('0x1d')];var _0x5625f2=_0x3e6082?0x0:_0x4b47ce[_0x56c6('0x1e')];var _0x288325=_0x3e6082?_0x4d0838['count']:_0x4b47ce[_0x56c6('0x1e')]+_0x4b47ce[_0x56c6('0x1f')];var _0x27b5b0;if(_0x288325>=_0x49fff5){_0x288325=_0x49fff5;_0x27b5b0=0xc8;}else{_0x27b5b0=0xce;}_0x557189[_0x56c6('0x1b')](_0x27b5b0);return _0x557189['set'](_0x56c6('0x20'),_0x5625f2+'-'+_0x288325+'/'+_0x49fff5)[_0x56c6('0x21')](_0x4d0838);}return null;};}function patchUpdates(_0x413ca7){return function(_0x137570){try{jsonpatch[_0x56c6('0x22')](_0x137570,_0x413ca7,!![]);}catch(_0x58bc6f){return BPromise[_0x56c6('0x23')](_0x58bc6f);}return _0x137570[_0x56c6('0x24')]();};}function saveUpdates(_0x55271c,_0x40d7be){return function(_0x4d33f7){if(_0x4d33f7){return _0x4d33f7['update'](_0x55271c)[_0x56c6('0x25')](function(_0x1f1bb1){return _0x1f1bb1;});}return null;};}function removeEntity(_0x17dd94,_0x5c6682){return function(_0x27806e){if(_0x27806e){return _0x27806e[_0x56c6('0x26')]()[_0x56c6('0x25')](function(){_0x17dd94[_0x56c6('0x1b')](0xcc)[_0x56c6('0x1a')]();});}};}function handleEntityNotFound(_0x207f05,_0x50d7ee){return function(_0x4be5df){if(!_0x4be5df){_0x207f05[_0x56c6('0x19')](0x194);}return _0x4be5df;};}function handleError(_0x44164c,_0x5cb361){_0x5cb361=_0x5cb361||0x1f4;return function(_0x33f95e){logger['error'](_0x33f95e[_0x56c6('0x27')]);if(_0x33f95e['name']){delete _0x33f95e[_0x56c6('0x28')];}_0x44164c['status'](_0x5cb361)[_0x56c6('0x29')](_0x33f95e);};}exports[_0x56c6('0x2a')]=function(_0x24fb02,_0x2e6b07){var _0x1acdcf={},_0x67fec3={},_0x14094b={'count':0x0,'rows':[]};var _0x3938d4=_[_0x56c6('0x2b')](db[_0x56c6('0x2c')][_0x56c6('0x2d')],function(_0x492d80){return{'name':_0x492d80[_0x56c6('0x2e')],'type':_0x492d80[_0x56c6('0x2f')]['key']};});_0x67fec3['model']=_[_0x56c6('0x2b')](_0x3938d4,'name');_0x67fec3[_0x56c6('0x30')]=_['keys'](_0x24fb02[_0x56c6('0x30')]);_0x67fec3[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x67fec3['model'],_0x67fec3[_0x56c6('0x30')]);_0x1acdcf[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x67fec3[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x35')]));_0x1acdcf[_0x56c6('0x33')]=_0x1acdcf[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1acdcf['attributes']:_0x67fec3[_0x56c6('0x34')];if(!_0x24fb02[_0x56c6('0x30')]['hasOwnProperty'](_0x56c6('0x37'))){_0x1acdcf[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1acdcf[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x24fb02['query'][_0x56c6('0x1e')]);}_0x1acdcf[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1acdcf[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x24fb02['query'],_0x67fec3[_0x56c6('0x31')]),_0x3938d4);if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1acdcf[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1acdcf[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x3938d4,function(_0xbc92e){if(_0xbc92e[_0x56c6('0x2f')]!==_0x56c6('0x3d')){var _0x493865={};_0x493865[_0xbc92e[_0x56c6('0x28')]]={'$like':'%'+_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x493865;}})});}_0x1acdcf=_['merge']({},_0x1acdcf,_0x24fb02[_0x56c6('0x3e')]);var _0x74516a={'where':_0x1acdcf[_0x56c6('0x3a')]};return db['FreshsalesConfiguration']['count'](_0x74516a)[_0x56c6('0x25')](function(_0x2dea5d){_0x14094b[_0x56c6('0x1d')]=_0x2dea5d;if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1acdcf[_0x56c6('0x40')]=[{'all':!![]}];}return db[_0x56c6('0x2c')][_0x56c6('0x41')](_0x1acdcf);})[_0x56c6('0x25')](function(_0x295522){_0x14094b[_0x56c6('0x42')]=_0x295522;return _0x14094b;})[_0x56c6('0x25')](respondWithFilteredResult(_0x2e6b07,_0x1acdcf))[_0x56c6('0x43')](handleError(_0x2e6b07,null));};exports['show']=function(_0x217723,_0x851bbe){var _0x1e6b10={'raw':![],'where':{'id':_0x217723[_0x56c6('0x44')]['id']}},_0x5968ac={};_0x5968ac[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x2c')][_0x56c6('0x2d')]);_0x5968ac[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x217723[_0x56c6('0x30')]);_0x5968ac['filters']=_[_0x56c6('0x32')](_0x5968ac['model'],_0x5968ac['query']);_0x1e6b10[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x5968ac[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x217723['query'][_0x56c6('0x35')]));_0x1e6b10[_0x56c6('0x33')]=_0x1e6b10[_0x56c6('0x33')]['length']?_0x1e6b10[_0x56c6('0x33')]:_0x5968ac[_0x56c6('0x34')];if(_0x217723[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1e6b10[_0x56c6('0x40')]=[{'all':!![]}];}_0x1e6b10=_['merge']({},_0x1e6b10,_0x217723[_0x56c6('0x3e')]);return db[_0x56c6('0x2c')][_0x56c6('0x46')](_0x1e6b10)[_0x56c6('0x25')](handleEntityNotFound(_0x851bbe,null))[_0x56c6('0x25')](respondWithResult(_0x851bbe,null))[_0x56c6('0x43')](handleError(_0x851bbe,null));};exports[_0x56c6('0x47')]=function(_0x1b6ac4,_0x4529df){return db[_0x56c6('0x2c')][_0x56c6('0x47')](_0x1b6ac4['body'],{})[_0x56c6('0x25')](respondWithResult(_0x4529df,0xc9))['catch'](handleError(_0x4529df,null));};exports[_0x56c6('0x48')]=function(_0x58cfa5,_0x5b449f){if(_0x58cfa5[_0x56c6('0x49')]['id']){delete _0x58cfa5[_0x56c6('0x49')]['id'];}return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x58cfa5[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x5b449f,null))[_0x56c6('0x25')](saveUpdates(_0x58cfa5[_0x56c6('0x49')],null))[_0x56c6('0x25')](respondWithResult(_0x5b449f,null))[_0x56c6('0x43')](handleError(_0x5b449f,null));};exports['destroy']=function(_0x2b1ff0,_0x20598b){return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x2b1ff0['params']['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x20598b,null))[_0x56c6('0x25')](removeEntity(_0x20598b,null))[_0x56c6('0x43')](handleError(_0x20598b,null));};exports['getSubjects']=function(_0x438674,_0xacbb0d,_0x2967e6){var _0x133f18={};var _0x4f02d8={};var _0x3323f5;var _0xf4cf37;return db[_0x56c6('0x2c')][_0x56c6('0x4a')]({'where':{'id':_0x438674[_0x56c6('0x44')]['id']}})['then'](handleEntityNotFound(_0xacbb0d,null))['then'](function(_0x475f04){if(_0x475f04){_0x3323f5=_0x475f04;_0x4f02d8[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x4b')][_0x56c6('0x2d')]);_0x4f02d8[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x438674[_0x56c6('0x30')]);_0x4f02d8['filters']=_[_0x56c6('0x32')](_0x4f02d8['model'],_0x4f02d8[_0x56c6('0x30')]);_0x133f18['attributes']=_[_0x56c6('0x32')](_0x4f02d8['model'],qs[_0x56c6('0x35')](_0x438674[_0x56c6('0x30')][_0x56c6('0x35')]));_0x133f18[_0x56c6('0x33')]=_0x133f18[_0x56c6('0x33')][_0x56c6('0x36')]?_0x133f18['attributes']:_0x4f02d8[_0x56c6('0x34')];_0x133f18['order']=qs[_0x56c6('0x39')](_0x438674['query'][_0x56c6('0x39')]);_0x133f18[_0x56c6('0x3a')]=qs['filters'](_[_0x56c6('0x4c')](_0x438674['query'],_0x4f02d8['filters']));if(_0x438674[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x133f18[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x133f18[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x133f18['attributes'],function(_0x52a42e){var _0x4ae745={};_0x4ae745[_0x52a42e]={'$like':'%'+_0x438674[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x4ae745;})});}_0x133f18=_[_0x56c6('0x3c')]({},_0x133f18,_0x438674[_0x56c6('0x3e')]);return _0x3323f5['getSubjects'](_0x133f18);}})[_0x56c6('0x25')](function(_0x34eb29){if(_0x34eb29){_0xf4cf37=_0x34eb29[_0x56c6('0x36')];if(!_0x438674['query'][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x133f18[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x438674['query']['limit']);_0x133f18['offset']=qs['offset'](_0x438674[_0x56c6('0x30')][_0x56c6('0x1e')]);}return _0x3323f5[_0x56c6('0x4e')](_0x133f18);}})[_0x56c6('0x25')](function(_0x40bd9f){if(_0x40bd9f){return _0x40bd9f?{'count':_0xf4cf37,'rows':_0x40bd9f}:null;}})[_0x56c6('0x25')](respondWithResult(_0xacbb0d,null))[_0x56c6('0x43')](handleError(_0xacbb0d,null));};exports[_0x56c6('0x4f')]=function(_0x35223e,_0x6b9cf5,_0x5f11bd){var _0x1e1dde={};var _0xef9e83={};var _0x18b6ab;var _0x13d572;return db['FreshsalesConfiguration'][_0x56c6('0x4a')]({'where':{'id':_0x35223e['params']['id']}})['then'](handleEntityNotFound(_0x6b9cf5,null))[_0x56c6('0x25')](function(_0x79a0ad){if(_0x79a0ad){_0x18b6ab=_0x79a0ad;_0xef9e83['model']=_['keys'](db[_0x56c6('0x4b')][_0x56c6('0x2d')]);_0xef9e83[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x35223e['query']);_0xef9e83[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0xef9e83['model'],_0xef9e83[_0x56c6('0x30')]);_0x1e1dde[_0x56c6('0x33')]=_['intersection'](_0xef9e83[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x35223e['query']['fields']));_0x1e1dde['attributes']=_0x1e1dde[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1e1dde[_0x56c6('0x33')]:_0xef9e83[_0x56c6('0x34')];_0x1e1dde[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x35223e[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1e1dde[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x35223e[_0x56c6('0x30')],_0xef9e83[_0x56c6('0x31')]));if(_0x35223e[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1e1dde[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1e1dde[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x1e1dde[_0x56c6('0x33')],function(_0x406574){var _0x316b75={};_0x316b75[_0x406574]={'$like':'%'+_0x35223e[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x316b75;})});}_0x1e1dde=_[_0x56c6('0x3c')]({},_0x1e1dde,_0x35223e[_0x56c6('0x3e')]);return _0x18b6ab['getDescriptions'](_0x1e1dde);}})['then'](function(_0x1b89d6){if(_0x1b89d6){_0x13d572=_0x1b89d6[_0x56c6('0x36')];if(!_0x35223e['query'][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x1e1dde[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x35223e[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1e1dde[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x35223e['query']['offset']);}return _0x18b6ab[_0x56c6('0x4f')](_0x1e1dde);}})['then'](function(_0x268a59){if(_0x268a59){return _0x268a59?{'count':_0x13d572,'rows':_0x268a59}:null;}})['then'](respondWithResult(_0x6b9cf5,null))[_0x56c6('0x43')](handleError(_0x6b9cf5,null));};exports[_0x56c6('0x50')]=function(_0x2c133c,_0x12d438,_0xd4f9c3){var _0x64d662={};var _0x36cfa8={};var _0x2d2562;var _0x4027b3;return db[_0x56c6('0x2c')][_0x56c6('0x4a')]({'where':{'id':_0x2c133c[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x12d438,null))[_0x56c6('0x25')](function(_0x3637b1){if(_0x3637b1){_0x2d2562=_0x3637b1;_0x36cfa8[_0x56c6('0x34')]=_[_0x56c6('0x45')](db['FreshsalesField'][_0x56c6('0x2d')]);_0x36cfa8[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x2c133c['query']);_0x36cfa8[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x36cfa8['model'],_0x36cfa8[_0x56c6('0x30')]);_0x64d662[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x36cfa8[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x2c133c['query'][_0x56c6('0x35')]));_0x64d662[_0x56c6('0x33')]=_0x64d662[_0x56c6('0x33')][_0x56c6('0x36')]?_0x64d662[_0x56c6('0x33')]:_0x36cfa8['model'];_0x64d662[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x39')]);_0x64d662[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_[_0x56c6('0x4c')](_0x2c133c[_0x56c6('0x30')],_0x36cfa8[_0x56c6('0x31')]));if(_0x2c133c[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x64d662[_0x56c6('0x3a')]=_['merge'](_0x64d662[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x64d662[_0x56c6('0x33')],function(_0x38aaaa){var _0x10a15b={};_0x10a15b[_0x38aaaa]={'$like':'%'+_0x2c133c[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x10a15b;})});}_0x64d662=_['merge']({},_0x64d662,_0x2c133c[_0x56c6('0x3e')]);return _0x2d2562[_0x56c6('0x50')](_0x64d662);}})[_0x56c6('0x25')](function(_0xe780cf){if(_0xe780cf){_0x4027b3=_0xe780cf['length'];if(!_0x2c133c[_0x56c6('0x30')][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x64d662[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x64d662['offset']=qs['offset'](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x1e')]);}return _0x2d2562['getFields'](_0x64d662);}})[_0x56c6('0x25')](function(_0x50ca63){if(_0x50ca63){return _0x50ca63?{'count':_0x4027b3,'rows':_0x50ca63}:null;}})['then'](respondWithResult(_0x12d438,null))[_0x56c6('0x43')](handleError(_0x12d438,null));}; \ No newline at end of file +var _0x8456=['zip-dir','fast-json-patch','request-promise','moment','mustache','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/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','destroy','then','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','body','update','params','getSubjects','findOne','FreshsalesField','pick','filter','getDescriptions','getFields','eml-format','rimraf'];(function(_0x171797,_0x1e596c){var _0x4c3dd4=function(_0xbdf365){while(--_0xbdf365){_0x171797['push'](_0x171797['shift']());}};_0x4c3dd4(++_0x1e596c);}(_0x8456,0x189));var _0x6845=function(_0x76dc95,_0x41df3e){_0x76dc95=_0x76dc95-0x0;var _0x124fb5=_0x8456[_0x76dc95];return _0x124fb5;};'use strict';var emlformat=require(_0x6845('0x0'));var rimraf=require(_0x6845('0x1'));var zipdir=require(_0x6845('0x2'));var jsonpatch=require(_0x6845('0x3'));var rp=require(_0x6845('0x4'));var moment=require(_0x6845('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6845('0x6'));var util=require(_0x6845('0x7'));var path=require('path');var sox=require(_0x6845('0x8'));var csv=require(_0x6845('0x9'));var ejs=require(_0x6845('0xa'));var fs=require('fs');var fs_extra=require(_0x6845('0xb'));var _=require(_0x6845('0xc'));var squel=require(_0x6845('0xd'));var crypto=require(_0x6845('0xe'));var jsforce=require(_0x6845('0xf'));var deskjs=require(_0x6845('0x10'));var toCsv=require(_0x6845('0x9'));var querystring=require('querystring');var Papa=require(_0x6845('0x11'));var Redis=require(_0x6845('0x12'));var authService=require(_0x6845('0x13'));var qs=require(_0x6845('0x14'));var as=require(_0x6845('0x15'));var hardwareService=require(_0x6845('0x16'));var logger=require('../../config/logger')(_0x6845('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6845('0x18'));var db=require(_0x6845('0x19'))['db'];function respondWithStatusCode(_0x14d296,_0x5d0961){_0x5d0961=_0x5d0961||0xcc;return function(_0x3898d3){if(_0x3898d3){return _0x14d296[_0x6845('0x1a')](_0x5d0961);}return _0x14d296[_0x6845('0x1b')](_0x5d0961)[_0x6845('0x1c')]();};}function respondWithResult(_0x1cb4ab,_0x1578d3){_0x1578d3=_0x1578d3||0xc8;return function(_0x3b544c){if(_0x3b544c){return _0x1cb4ab['status'](_0x1578d3)[_0x6845('0x1d')](_0x3b544c);}};}function respondWithFilteredResult(_0x58f9c1,_0x10f53d){return function(_0x4cc893){if(_0x4cc893){var _0x523424=typeof _0x10f53d['offset']===_0x6845('0x1e')&&typeof _0x10f53d[_0x6845('0x1f')]===_0x6845('0x1e');var _0x37f24d=_0x4cc893[_0x6845('0x20')];var _0x2a4525=_0x523424?0x0:_0x10f53d[_0x6845('0x21')];var _0x402889=_0x523424?_0x4cc893[_0x6845('0x20')]:_0x10f53d[_0x6845('0x21')]+_0x10f53d[_0x6845('0x1f')];var _0x2c9820;if(_0x402889>=_0x37f24d){_0x402889=_0x37f24d;_0x2c9820=0xc8;}else{_0x2c9820=0xce;}_0x58f9c1['status'](_0x2c9820);return _0x58f9c1['set'](_0x6845('0x22'),_0x2a4525+'-'+_0x402889+'/'+_0x37f24d)[_0x6845('0x1d')](_0x4cc893);}return null;};}function patchUpdates(_0x22267b){return function(_0x1942a0){try{jsonpatch[_0x6845('0x23')](_0x1942a0,_0x22267b,!![]);}catch(_0x307877){return BPromise['reject'](_0x307877);}return _0x1942a0['save']();};}function saveUpdates(_0x5abe40,_0x9f3979){return function(_0x55e5ba){if(_0x55e5ba){return _0x55e5ba['update'](_0x5abe40)['then'](function(_0x3edb7f){return _0x3edb7f;});}return null;};}function removeEntity(_0x500f5d,_0x2da7cd){return function(_0x1d493e){if(_0x1d493e){return _0x1d493e[_0x6845('0x24')]()[_0x6845('0x25')](function(){_0x500f5d[_0x6845('0x1b')](0xcc)[_0x6845('0x1c')]();});}};}function handleEntityNotFound(_0x51442f,_0x3c981d){return function(_0x18f070){if(!_0x18f070){_0x51442f[_0x6845('0x1a')](0x194);}return _0x18f070;};}function handleError(_0x544369,_0x3b52ea){_0x3b52ea=_0x3b52ea||0x1f4;return function(_0x480549){logger['error'](_0x480549[_0x6845('0x26')]);if(_0x480549[_0x6845('0x27')]){delete _0x480549['name'];}_0x544369[_0x6845('0x1b')](_0x3b52ea)[_0x6845('0x28')](_0x480549);};}exports[_0x6845('0x29')]=function(_0x52b340,_0x10d5f0){var _0x13e6cb={},_0x111a53={},_0x1880a4={'count':0x0,'rows':[]};var _0x3ed715=_[_0x6845('0x2a')](db[_0x6845('0x2b')][_0x6845('0x2c')],function(_0x4ac714){return{'name':_0x4ac714['fieldName'],'type':_0x4ac714[_0x6845('0x2d')][_0x6845('0x2e')]};});_0x111a53[_0x6845('0x2f')]=_['map'](_0x3ed715,_0x6845('0x27'));_0x111a53[_0x6845('0x30')]=_[_0x6845('0x31')](_0x52b340['query']);_0x111a53[_0x6845('0x32')]=_[_0x6845('0x33')](_0x111a53['model'],_0x111a53['query']);_0x13e6cb[_0x6845('0x34')]=_[_0x6845('0x33')](_0x111a53[_0x6845('0x2f')],qs['fields'](_0x52b340[_0x6845('0x30')][_0x6845('0x35')]));_0x13e6cb[_0x6845('0x34')]=_0x13e6cb[_0x6845('0x34')][_0x6845('0x36')]?_0x13e6cb[_0x6845('0x34')]:_0x111a53[_0x6845('0x2f')];if(!_0x52b340[_0x6845('0x30')][_0x6845('0x37')](_0x6845('0x38'))){_0x13e6cb[_0x6845('0x1f')]=qs[_0x6845('0x1f')](_0x52b340[_0x6845('0x30')][_0x6845('0x1f')]);_0x13e6cb['offset']=qs[_0x6845('0x21')](_0x52b340[_0x6845('0x30')][_0x6845('0x21')]);}_0x13e6cb[_0x6845('0x39')]=qs[_0x6845('0x3a')](_0x52b340['query'][_0x6845('0x3a')]);_0x13e6cb[_0x6845('0x3b')]=qs[_0x6845('0x32')](_['pick'](_0x52b340[_0x6845('0x30')],_0x111a53[_0x6845('0x32')]),_0x3ed715);if(_0x52b340[_0x6845('0x30')]['filter']){_0x13e6cb[_0x6845('0x3b')]=_[_0x6845('0x3c')](_0x13e6cb['where'],{'$or':_[_0x6845('0x2a')](_0x3ed715,function(_0x50d28f){if(_0x50d28f[_0x6845('0x2d')]!==_0x6845('0x3d')){var _0x3680de={};_0x3680de[_0x50d28f[_0x6845('0x27')]]={'$like':'%'+_0x52b340[_0x6845('0x30')]['filter']+'%'};return _0x3680de;}})});}_0x13e6cb=_['merge']({},_0x13e6cb,_0x52b340[_0x6845('0x3e')]);var _0xe6d0c6={'where':_0x13e6cb[_0x6845('0x3b')]};return db[_0x6845('0x2b')][_0x6845('0x20')](_0xe6d0c6)[_0x6845('0x25')](function(_0x1bbf43){_0x1880a4[_0x6845('0x20')]=_0x1bbf43;if(_0x52b340[_0x6845('0x30')]['includeAll']){_0x13e6cb[_0x6845('0x3f')]=[{'all':!![]}];}return db[_0x6845('0x2b')]['findAll'](_0x13e6cb);})[_0x6845('0x25')](function(_0x3b9364){_0x1880a4[_0x6845('0x40')]=_0x3b9364;return _0x1880a4;})['then'](respondWithFilteredResult(_0x10d5f0,_0x13e6cb))[_0x6845('0x41')](handleError(_0x10d5f0,null));};exports[_0x6845('0x42')]=function(_0x4471b1,_0x5406c4){var _0x545884={'raw':![],'where':{'id':_0x4471b1['params']['id']}},_0x28dde4={};_0x28dde4[_0x6845('0x2f')]=_[_0x6845('0x31')](db[_0x6845('0x2b')][_0x6845('0x2c')]);_0x28dde4[_0x6845('0x30')]=_[_0x6845('0x31')](_0x4471b1['query']);_0x28dde4[_0x6845('0x32')]=_[_0x6845('0x33')](_0x28dde4[_0x6845('0x2f')],_0x28dde4[_0x6845('0x30')]);_0x545884[_0x6845('0x34')]=_[_0x6845('0x33')](_0x28dde4[_0x6845('0x2f')],qs[_0x6845('0x35')](_0x4471b1[_0x6845('0x30')][_0x6845('0x35')]));_0x545884['attributes']=_0x545884[_0x6845('0x34')][_0x6845('0x36')]?_0x545884['attributes']:_0x28dde4[_0x6845('0x2f')];if(_0x4471b1[_0x6845('0x30')][_0x6845('0x43')]){_0x545884['include']=[{'all':!![]}];}_0x545884=_[_0x6845('0x3c')]({},_0x545884,_0x4471b1['options']);return db[_0x6845('0x2b')][_0x6845('0x44')](_0x545884)['then'](handleEntityNotFound(_0x5406c4,null))[_0x6845('0x25')](respondWithResult(_0x5406c4,null))[_0x6845('0x41')](handleError(_0x5406c4,null));};exports['create']=function(_0x42b053,_0x14425b){return db[_0x6845('0x2b')]['create'](_0x42b053[_0x6845('0x45')],{})[_0x6845('0x25')](respondWithResult(_0x14425b,0xc9))[_0x6845('0x41')](handleError(_0x14425b,null));};exports[_0x6845('0x46')]=function(_0x2c3745,_0x56ccbd){if(_0x2c3745[_0x6845('0x45')]['id']){delete _0x2c3745['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2c3745[_0x6845('0x47')]['id']}})['then'](handleEntityNotFound(_0x56ccbd,null))[_0x6845('0x25')](saveUpdates(_0x2c3745[_0x6845('0x45')],null))['then'](respondWithResult(_0x56ccbd,null))[_0x6845('0x41')](handleError(_0x56ccbd,null));};exports[_0x6845('0x24')]=function(_0x1110ee,_0x4da8ed){return db[_0x6845('0x2b')][_0x6845('0x44')]({'where':{'id':_0x1110ee[_0x6845('0x47')]['id']}})[_0x6845('0x25')](handleEntityNotFound(_0x4da8ed,null))[_0x6845('0x25')](removeEntity(_0x4da8ed,null))[_0x6845('0x41')](handleError(_0x4da8ed,null));};exports[_0x6845('0x48')]=function(_0x3dc34a,_0x60178e,_0xcfc1f2){var _0x4d80c2={};var _0x1a7d5f={};var _0x1e56ce;var _0x15a3d8;return db[_0x6845('0x2b')][_0x6845('0x49')]({'where':{'id':_0x3dc34a[_0x6845('0x47')]['id']}})[_0x6845('0x25')](handleEntityNotFound(_0x60178e,null))[_0x6845('0x25')](function(_0x2faef4){if(_0x2faef4){_0x1e56ce=_0x2faef4;_0x1a7d5f[_0x6845('0x2f')]=_[_0x6845('0x31')](db[_0x6845('0x4a')]['rawAttributes']);_0x1a7d5f[_0x6845('0x30')]=_[_0x6845('0x31')](_0x3dc34a['query']);_0x1a7d5f['filters']=_[_0x6845('0x33')](_0x1a7d5f[_0x6845('0x2f')],_0x1a7d5f[_0x6845('0x30')]);_0x4d80c2[_0x6845('0x34')]=_['intersection'](_0x1a7d5f[_0x6845('0x2f')],qs['fields'](_0x3dc34a['query'][_0x6845('0x35')]));_0x4d80c2[_0x6845('0x34')]=_0x4d80c2['attributes'][_0x6845('0x36')]?_0x4d80c2[_0x6845('0x34')]:_0x1a7d5f[_0x6845('0x2f')];_0x4d80c2[_0x6845('0x39')]=qs[_0x6845('0x3a')](_0x3dc34a[_0x6845('0x30')]['sort']);_0x4d80c2[_0x6845('0x3b')]=qs[_0x6845('0x32')](_[_0x6845('0x4b')](_0x3dc34a[_0x6845('0x30')],_0x1a7d5f[_0x6845('0x32')]));if(_0x3dc34a[_0x6845('0x30')][_0x6845('0x4c')]){_0x4d80c2[_0x6845('0x3b')]=_[_0x6845('0x3c')](_0x4d80c2[_0x6845('0x3b')],{'$or':_[_0x6845('0x2a')](_0x4d80c2[_0x6845('0x34')],function(_0x1ee3dc){var _0x53756f={};_0x53756f[_0x1ee3dc]={'$like':'%'+_0x3dc34a[_0x6845('0x30')]['filter']+'%'};return _0x53756f;})});}_0x4d80c2=_['merge']({},_0x4d80c2,_0x3dc34a[_0x6845('0x3e')]);return _0x1e56ce[_0x6845('0x48')](_0x4d80c2);}})[_0x6845('0x25')](function(_0x170264){if(_0x170264){_0x15a3d8=_0x170264[_0x6845('0x36')];if(!_0x3dc34a[_0x6845('0x30')][_0x6845('0x37')]('nolimit')){_0x4d80c2[_0x6845('0x1f')]=qs['limit'](_0x3dc34a['query'][_0x6845('0x1f')]);_0x4d80c2[_0x6845('0x21')]=qs[_0x6845('0x21')](_0x3dc34a[_0x6845('0x30')][_0x6845('0x21')]);}return _0x1e56ce[_0x6845('0x48')](_0x4d80c2);}})[_0x6845('0x25')](function(_0x7720cb){if(_0x7720cb){return _0x7720cb?{'count':_0x15a3d8,'rows':_0x7720cb}:null;}})[_0x6845('0x25')](respondWithResult(_0x60178e,null))['catch'](handleError(_0x60178e,null));};exports[_0x6845('0x4d')]=function(_0x54b7d2,_0xc95f0f,_0x25cf53){var _0x3b53ba={};var _0x4f3e18={};var _0x41b347;var _0x206cc6;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x54b7d2[_0x6845('0x47')]['id']}})['then'](handleEntityNotFound(_0xc95f0f,null))[_0x6845('0x25')](function(_0x4c1e95){if(_0x4c1e95){_0x41b347=_0x4c1e95;_0x4f3e18['model']=_[_0x6845('0x31')](db[_0x6845('0x4a')]['rawAttributes']);_0x4f3e18[_0x6845('0x30')]=_[_0x6845('0x31')](_0x54b7d2[_0x6845('0x30')]);_0x4f3e18['filters']=_[_0x6845('0x33')](_0x4f3e18['model'],_0x4f3e18[_0x6845('0x30')]);_0x3b53ba[_0x6845('0x34')]=_[_0x6845('0x33')](_0x4f3e18[_0x6845('0x2f')],qs[_0x6845('0x35')](_0x54b7d2[_0x6845('0x30')][_0x6845('0x35')]));_0x3b53ba[_0x6845('0x34')]=_0x3b53ba[_0x6845('0x34')][_0x6845('0x36')]?_0x3b53ba[_0x6845('0x34')]:_0x4f3e18[_0x6845('0x2f')];_0x3b53ba['order']=qs[_0x6845('0x3a')](_0x54b7d2[_0x6845('0x30')][_0x6845('0x3a')]);_0x3b53ba['where']=qs['filters'](_[_0x6845('0x4b')](_0x54b7d2[_0x6845('0x30')],_0x4f3e18[_0x6845('0x32')]));if(_0x54b7d2[_0x6845('0x30')][_0x6845('0x4c')]){_0x3b53ba[_0x6845('0x3b')]=_[_0x6845('0x3c')](_0x3b53ba[_0x6845('0x3b')],{'$or':_['map'](_0x3b53ba[_0x6845('0x34')],function(_0x50a9ff){var _0x4e7ad3={};_0x4e7ad3[_0x50a9ff]={'$like':'%'+_0x54b7d2[_0x6845('0x30')][_0x6845('0x4c')]+'%'};return _0x4e7ad3;})});}_0x3b53ba=_[_0x6845('0x3c')]({},_0x3b53ba,_0x54b7d2[_0x6845('0x3e')]);return _0x41b347['getDescriptions'](_0x3b53ba);}})[_0x6845('0x25')](function(_0x543ad3){if(_0x543ad3){_0x206cc6=_0x543ad3[_0x6845('0x36')];if(!_0x54b7d2[_0x6845('0x30')][_0x6845('0x37')](_0x6845('0x38'))){_0x3b53ba[_0x6845('0x1f')]=qs['limit'](_0x54b7d2[_0x6845('0x30')][_0x6845('0x1f')]);_0x3b53ba[_0x6845('0x21')]=qs[_0x6845('0x21')](_0x54b7d2['query'][_0x6845('0x21')]);}return _0x41b347[_0x6845('0x4d')](_0x3b53ba);}})['then'](function(_0x186a85){if(_0x186a85){return _0x186a85?{'count':_0x206cc6,'rows':_0x186a85}:null;}})[_0x6845('0x25')](respondWithResult(_0xc95f0f,null))[_0x6845('0x41')](handleError(_0xc95f0f,null));};exports[_0x6845('0x4e')]=function(_0x10c896,_0x2efed4,_0x7d09f8){var _0xb49361={};var _0x237d03={};var _0x313a27;var _0x2ed53f;return db[_0x6845('0x2b')]['findOne']({'where':{'id':_0x10c896['params']['id']}})[_0x6845('0x25')](handleEntityNotFound(_0x2efed4,null))['then'](function(_0x50f5eb){if(_0x50f5eb){_0x313a27=_0x50f5eb;_0x237d03['model']=_[_0x6845('0x31')](db[_0x6845('0x4a')][_0x6845('0x2c')]);_0x237d03['query']=_[_0x6845('0x31')](_0x10c896[_0x6845('0x30')]);_0x237d03[_0x6845('0x32')]=_[_0x6845('0x33')](_0x237d03['model'],_0x237d03['query']);_0xb49361[_0x6845('0x34')]=_['intersection'](_0x237d03[_0x6845('0x2f')],qs[_0x6845('0x35')](_0x10c896[_0x6845('0x30')][_0x6845('0x35')]));_0xb49361[_0x6845('0x34')]=_0xb49361[_0x6845('0x34')]['length']?_0xb49361[_0x6845('0x34')]:_0x237d03[_0x6845('0x2f')];_0xb49361['order']=qs[_0x6845('0x3a')](_0x10c896[_0x6845('0x30')][_0x6845('0x3a')]);_0xb49361[_0x6845('0x3b')]=qs[_0x6845('0x32')](_[_0x6845('0x4b')](_0x10c896[_0x6845('0x30')],_0x237d03[_0x6845('0x32')]));if(_0x10c896[_0x6845('0x30')][_0x6845('0x4c')]){_0xb49361['where']=_['merge'](_0xb49361[_0x6845('0x3b')],{'$or':_['map'](_0xb49361[_0x6845('0x34')],function(_0x3e7cd1){var _0x80f096={};_0x80f096[_0x3e7cd1]={'$like':'%'+_0x10c896['query'][_0x6845('0x4c')]+'%'};return _0x80f096;})});}_0xb49361=_[_0x6845('0x3c')]({},_0xb49361,_0x10c896['options']);return _0x313a27[_0x6845('0x4e')](_0xb49361);}})[_0x6845('0x25')](function(_0x1f73a7){if(_0x1f73a7){_0x2ed53f=_0x1f73a7['length'];if(!_0x10c896['query'][_0x6845('0x37')]('nolimit')){_0xb49361['limit']=qs['limit'](_0x10c896[_0x6845('0x30')][_0x6845('0x1f')]);_0xb49361[_0x6845('0x21')]=qs['offset'](_0x10c896[_0x6845('0x30')][_0x6845('0x21')]);}return _0x313a27['getFields'](_0xb49361);}})['then'](function(_0x1eaa26){if(_0x1eaa26){return _0x1eaa26?{'count':_0x2ed53f,'rows':_0x1eaa26}:null;}})[_0x6845('0x25')](respondWithResult(_0x2efed4,null))[_0x6845('0x41')](handleError(_0x2efed4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9294c81..4d44522 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 _0xd59e=['int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd59e,0x6d));var _0xed59=function(_0x26770b,_0x599900){_0x26770b=_0x26770b-0x0;var _0x2b7cfb=_0xd59e[_0x26770b];return _0x2b7cfb;};'use strict';var _=require(_0xed59('0x0'));var util=require(_0xed59('0x1'));var logger=require(_0xed59('0x2'))(_0xed59('0x3'));var moment=require('moment');var BPromise=require(_0xed59('0x4'));var rp=require(_0xed59('0x5'));var fs=require('fs');var path=require(_0xed59('0x6'));var rimraf=require(_0xed59('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xed59('0x8')]=function(_0xacce50,_0x54da22){return _0xacce50[_0xed59('0x9')](_0xed59('0xa'),attributes,{'tableName':_0xed59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c1c=['define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x18df07,_0x23e441){var _0xe4eab9=function(_0x29e5ae){while(--_0x29e5ae){_0x18df07['push'](_0x18df07['shift']());}};_0xe4eab9(++_0x23e441);}(_0x3c1c,0xd4));var _0xc3c1=function(_0x79b53e,_0x108f8d){_0x79b53e=_0x79b53e-0x0;var _0x2d4d6c=_0x3c1c[_0x79b53e];return _0x2d4d6c;};'use strict';var _=require(_0xc3c1('0x0'));var util=require(_0xc3c1('0x1'));var logger=require(_0xc3c1('0x2'))(_0xc3c1('0x3'));var moment=require(_0xc3c1('0x4'));var BPromise=require(_0xc3c1('0x5'));var rp=require(_0xc3c1('0x6'));var fs=require('fs');var path=require(_0xc3c1('0x7'));var rimraf=require(_0xc3c1('0x8'));var config=require(_0xc3c1('0x9'));var attributes=require(_0xc3c1('0xa'));module[_0xc3c1('0xb')]=function(_0x5bd63c,_0x55631d){return _0x5bd63c[_0xc3c1('0xc')]('FreshsalesConfiguration',attributes,{'tableName':_0xc3c1('0xd'),'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 b0c0c09..469f319 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 _0x35e6=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e7f78,_0x27351e){var _0x4ce8e2=function(_0x4df71e){while(--_0x4df71e){_0x2e7f78['push'](_0x2e7f78['shift']());}};_0x4ce8e2(++_0x27351e);}(_0x35e6,0xc8));var _0x635e=function(_0x14082b,_0x3672d6){_0x14082b=_0x14082b-0x0;var _0x53a93d=_0x35e6[_0x14082b];return _0x53a93d;};'use strict';var _=require('lodash');var util=require(_0x635e('0x0'));var moment=require('moment');var BPromise=require(_0x635e('0x1'));var rs=require(_0x635e('0x2'));var fs=require('fs');var Redis=require(_0x635e('0x3'));var db=require(_0x635e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x635e('0x5'))(_0x635e('0x6'));var config=require(_0x635e('0x7'));var jayson=require(_0x635e('0x8'));var client=jayson['client'][_0x635e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x434730,_0x4e0b73,_0x24dd30){return new BPromise(function(_0x63d9f1,_0x23baec){return client[_0x635e('0xa')](_0x434730,_0x24dd30)[_0x635e('0xb')](function(_0x2a0a17){logger[_0x635e('0xc')](_0x635e('0xd'),_0x4e0b73,_0x635e('0xe'));logger[_0x635e('0xf')](_0x635e('0x10'),_0x4e0b73,_0x635e('0xe'),JSON['stringify'](_0x2a0a17));if(_0x2a0a17[_0x635e('0x11')]){if(_0x2a0a17[_0x635e('0x11')][_0x635e('0x12')]===0x1f4){logger[_0x635e('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4e0b73,_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);return _0x23baec(_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);}logger[_0x635e('0x11')](_0x635e('0xd'),_0x4e0b73,_0x2a0a17['error'][_0x635e('0x13')]);return _0x63d9f1(_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);}else{logger[_0x635e('0xc')](_0x635e('0xd'),_0x4e0b73,_0x635e('0xe'));_0x63d9f1(_0x2a0a17[_0x635e('0x14')][_0x635e('0x13')]);}})['catch'](function(_0x2443b3){logger[_0x635e('0x11')](_0x635e('0xd'),_0x4e0b73,_0x2443b3);_0x23baec(_0x2443b3);});});} \ No newline at end of file +var _0x0a44=['jayson/promise','client','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x36efd8,_0x4923cf){var _0x500c8a=function(_0x2fccc9){while(--_0x2fccc9){_0x36efd8['push'](_0x36efd8['shift']());}};_0x500c8a(++_0x4923cf);}(_0x0a44,0xbd));var _0x40a4=function(_0x59e45a,_0x4d704f){_0x59e45a=_0x59e45a-0x0;var _0x3e1c91=_0x0a44[_0x59e45a];return _0x3e1c91;};'use strict';var _=require(_0x40a4('0x0'));var util=require('util');var moment=require(_0x40a4('0x1'));var BPromise=require(_0x40a4('0x2'));var rs=require(_0x40a4('0x3'));var fs=require('fs');var Redis=require(_0x40a4('0x4'));var db=require(_0x40a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40a4('0x6'))(_0x40a4('0x7'));var config=require(_0x40a4('0x8'));var jayson=require(_0x40a4('0x9'));var client=jayson[_0x40a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50304b,_0x59c867,_0x263dc2){return new BPromise(function(_0x33c0fa,_0x2bfa17){return client['request'](_0x50304b,_0x263dc2)['then'](function(_0x8d6bce){logger[_0x40a4('0xb')](_0x40a4('0xc'),_0x59c867,_0x40a4('0xd'));logger[_0x40a4('0xe')](_0x40a4('0xf'),_0x59c867,_0x40a4('0xd'),JSON[_0x40a4('0x10')](_0x8d6bce));if(_0x8d6bce[_0x40a4('0x11')]){if(_0x8d6bce[_0x40a4('0x11')][_0x40a4('0x12')]===0x1f4){logger[_0x40a4('0x11')](_0x40a4('0xc'),_0x59c867,_0x8d6bce[_0x40a4('0x11')][_0x40a4('0x13')]);return _0x2bfa17(_0x8d6bce['error'][_0x40a4('0x13')]);}logger[_0x40a4('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x59c867,_0x8d6bce[_0x40a4('0x11')]['message']);return _0x33c0fa(_0x8d6bce[_0x40a4('0x11')]['message']);}else{logger[_0x40a4('0xb')](_0x40a4('0xc'),_0x59c867,'request\x20sent');_0x33c0fa(_0x8d6bce[_0x40a4('0x14')]['message']);}})[_0x40a4('0x15')](function(_0x3c478d){logger[_0x40a4('0x11')](_0x40a4('0xc'),_0x59c867,_0x3c478d);_0x2bfa17(_0x3c478d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 101eb2e..64504fb 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 _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0xe455e7,_0x29fb65){var _0xfc683e=function(_0x10ee38){while(--_0x10ee38){_0xe455e7['push'](_0xe455e7['shift']());}};_0xfc683e(++_0x29fb65);}(_0xbec5,0xe5));var _0x5bec=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xbec5[_0x207a02];return _0xd995c3;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file +var _0x4bd1=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','delete','exports'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x4bd1,0x90));var _0x14bd=function(_0x4cba56,_0x5b2c44){_0x4cba56=_0x4cba56-0x0;var _0x3cc9f3=_0x4bd1[_0x4cba56];return _0x3cc9f3;};'use strict';var multer=require('multer');var util=require(_0x14bd('0x0'));var path=require('path');var timeout=require(_0x14bd('0x1'));var express=require(_0x14bd('0x2'));var router=express['Router']();var fs_extra=require(_0x14bd('0x3'));var auth=require(_0x14bd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14bd('0x5'));var controller=require(_0x14bd('0x6'));router[_0x14bd('0x7')]('/',auth[_0x14bd('0x8')](),controller['index']);router[_0x14bd('0x7')](_0x14bd('0x9'),auth[_0x14bd('0x8')](),controller[_0x14bd('0xa')]);router[_0x14bd('0xb')]('/',auth[_0x14bd('0x8')](),controller[_0x14bd('0xc')]);router[_0x14bd('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x14bd('0xe')](_0x14bd('0x9'),auth[_0x14bd('0x8')](),controller['destroy']);module[_0x14bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f16cf2d..757a250 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 _0x9c8e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c8e,0x1aa));var _0xe9c8=function(_0x203efb,_0x5abed2){_0x203efb=_0x203efb-0x0;var _0xf67f98=_0x9c8e[_0x203efb];return _0xf67f98;};'use strict';var Sequelize=require(_0xe9c8('0x0'));module[_0xe9c8('0x1')]={'type':{'type':Sequelize[_0xe9c8('0x2')](_0xe9c8('0x3'),'variable',_0xe9c8('0x4'),_0xe9c8('0x5'),_0xe9c8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe9c8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe9c8('0x2')](_0xe9c8('0x3'),_0xe9c8('0x8'),_0xe9c8('0x4'))},'keyContent':{'type':Sequelize[_0xe9c8('0x7')]},'idField':{'type':Sequelize[_0xe9c8('0x7')]},'nameField':{'type':Sequelize[_0xe9c8('0x7')]},'customField':{'type':Sequelize[_0xe9c8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9c8('0x7')]}}; \ No newline at end of file +var _0x33cb=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x33cb,0xc6));var _0xb33c=function(_0x2812d7,_0x139e6f){_0x2812d7=_0x2812d7-0x0;var _0x39bc1e=_0x33cb[_0x2812d7];return _0x39bc1e;};'use strict';var Sequelize=require(_0xb33c('0x0'));module['exports']={'type':{'type':Sequelize[_0xb33c('0x1')](_0xb33c('0x2'),_0xb33c('0x3'),_0xb33c('0x4'),'keyValue',_0xb33c('0x5')),'defaultValue':_0xb33c('0x2')},'content':{'type':Sequelize[_0xb33c('0x6')]},'key':{'type':Sequelize[_0xb33c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb33c('0x2'),'variable',_0xb33c('0x4'))},'keyContent':{'type':Sequelize[_0xb33c('0x6')]},'idField':{'type':Sequelize[_0xb33c('0x6')]},'nameField':{'type':Sequelize[_0xb33c('0x6')]},'customField':{'type':Sequelize[_0xb33c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb33c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a1c45a9..8ac9f9e 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 _0xb38d=['../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api'];(function(_0x3d3a83,_0x45f2b6){var _0x4569dc=function(_0x582cf7){while(--_0x582cf7){_0x3d3a83['push'](_0x3d3a83['shift']());}};_0x4569dc(++_0x45f2b6);}(_0xb38d,0x14c));var _0xdb38=function(_0x34a459,_0x136cd9){_0x34a459=_0x34a459-0x0;var _0x500f8b=_0xb38d[_0x34a459];return _0x500f8b;};'use strict';var emlformat=require(_0xdb38('0x0'));var rimraf=require(_0xdb38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb38('0x2'));var rp=require('request-promise');var moment=require(_0xdb38('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb38('0x4'));var util=require(_0xdb38('0x5'));var path=require(_0xdb38('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb38('0x7'));var _=require('lodash');var squel=require(_0xdb38('0x8'));var crypto=require(_0xdb38('0x9'));var jsforce=require(_0xdb38('0xa'));var deskjs=require(_0xdb38('0xb'));var toCsv=require(_0xdb38('0xc'));var querystring=require(_0xdb38('0xd'));var Papa=require(_0xdb38('0xe'));var Redis=require(_0xdb38('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdb38('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb38('0x11'));var utils=require(_0xdb38('0x12'));var config=require(_0xdb38('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252a66,_0x4760e3){_0x4760e3=_0x4760e3||0xcc;return function(_0x381123){if(_0x381123){return _0x252a66[_0xdb38('0x14')](_0x4760e3);}return _0x252a66[_0xdb38('0x15')](_0x4760e3)['end']();};}function respondWithResult(_0x1f108b,_0x4b20cb){_0x4b20cb=_0x4b20cb||0xc8;return function(_0x1859a3){if(_0x1859a3){return _0x1f108b['status'](_0x4b20cb)[_0xdb38('0x16')](_0x1859a3);}};}function respondWithFilteredResult(_0x5a0cdc,_0xd0d80e){return function(_0x4fea4e){if(_0x4fea4e){var _0x564cc5=typeof _0xd0d80e[_0xdb38('0x17')]===_0xdb38('0x18')&&typeof _0xd0d80e[_0xdb38('0x19')]===_0xdb38('0x18');var _0xf2f4dc=_0x4fea4e[_0xdb38('0x1a')];var _0x285a58=_0x564cc5?0x0:_0xd0d80e[_0xdb38('0x17')];var _0x3eba7b=_0x564cc5?_0x4fea4e['count']:_0xd0d80e[_0xdb38('0x17')]+_0xd0d80e[_0xdb38('0x19')];var _0x29fc1a;if(_0x3eba7b>=_0xf2f4dc){_0x3eba7b=_0xf2f4dc;_0x29fc1a=0xc8;}else{_0x29fc1a=0xce;}_0x5a0cdc['status'](_0x29fc1a);return _0x5a0cdc[_0xdb38('0x1b')](_0xdb38('0x1c'),_0x285a58+'-'+_0x3eba7b+'/'+_0xf2f4dc)[_0xdb38('0x16')](_0x4fea4e);}return null;};}function patchUpdates(_0x2fd553){return function(_0x5a9a17){try{jsonpatch[_0xdb38('0x1d')](_0x5a9a17,_0x2fd553,!![]);}catch(_0x5ca033){return BPromise[_0xdb38('0x1e')](_0x5ca033);}return _0x5a9a17[_0xdb38('0x1f')]();};}function saveUpdates(_0x45b4c7,_0x52d94d){return function(_0x481078){if(_0x481078){return _0x481078[_0xdb38('0x20')](_0x45b4c7)['then'](function(_0x4aaaa2){return _0x4aaaa2;});}return null;};}function removeEntity(_0x3d3402,_0x264fd9){return function(_0x20d3ed){if(_0x20d3ed){return _0x20d3ed[_0xdb38('0x21')]()[_0xdb38('0x22')](function(){_0x3d3402[_0xdb38('0x15')](0xcc)[_0xdb38('0x23')]();});}};}function handleEntityNotFound(_0x3c628a,_0x5135cb){return function(_0x469f5c){if(!_0x469f5c){_0x3c628a[_0xdb38('0x14')](0x194);}return _0x469f5c;};}function handleError(_0x24d0ea,_0x57053c){_0x57053c=_0x57053c||0x1f4;return function(_0x30402e){logger['error'](_0x30402e[_0xdb38('0x24')]);if(_0x30402e[_0xdb38('0x25')]){delete _0x30402e[_0xdb38('0x25')];}_0x24d0ea[_0xdb38('0x15')](_0x57053c)[_0xdb38('0x26')](_0x30402e);};}exports[_0xdb38('0x27')]=function(_0x1f5d29,_0x2f621e){var _0x82fdd1={},_0x36f12d={},_0x128ac6={'count':0x0,'rows':[]};var _0x101818=_[_0xdb38('0x28')](db[_0xdb38('0x29')][_0xdb38('0x2a')],function(_0x4aff04){return{'name':_0x4aff04[_0xdb38('0x2b')],'type':_0x4aff04[_0xdb38('0x2c')][_0xdb38('0x2d')]};});_0x36f12d[_0xdb38('0x2e')]=_[_0xdb38('0x28')](_0x101818,_0xdb38('0x25'));_0x36f12d['query']=_['keys'](_0x1f5d29[_0xdb38('0x2f')]);_0x36f12d[_0xdb38('0x30')]=_[_0xdb38('0x31')](_0x36f12d['model'],_0x36f12d[_0xdb38('0x2f')]);_0x82fdd1[_0xdb38('0x32')]=_[_0xdb38('0x31')](_0x36f12d[_0xdb38('0x2e')],qs[_0xdb38('0x33')](_0x1f5d29['query'][_0xdb38('0x33')]));_0x82fdd1[_0xdb38('0x32')]=_0x82fdd1[_0xdb38('0x32')][_0xdb38('0x34')]?_0x82fdd1[_0xdb38('0x32')]:_0x36f12d[_0xdb38('0x2e')];if(!_0x1f5d29[_0xdb38('0x2f')]['hasOwnProperty'](_0xdb38('0x35'))){_0x82fdd1['limit']=qs[_0xdb38('0x19')](_0x1f5d29[_0xdb38('0x2f')][_0xdb38('0x19')]);_0x82fdd1[_0xdb38('0x17')]=qs[_0xdb38('0x17')](_0x1f5d29[_0xdb38('0x2f')]['offset']);}_0x82fdd1['order']=qs['sort'](_0x1f5d29['query']['sort']);_0x82fdd1['where']=qs['filters'](_[_0xdb38('0x36')](_0x1f5d29[_0xdb38('0x2f')],_0x36f12d['filters']),_0x101818);if(_0x1f5d29[_0xdb38('0x2f')][_0xdb38('0x37')]){_0x82fdd1['where']=_[_0xdb38('0x38')](_0x82fdd1[_0xdb38('0x39')],{'$or':_['map'](_0x101818,function(_0x3513d2){if(_0x3513d2[_0xdb38('0x2c')]!==_0xdb38('0x3a')){var _0x5771c5={};_0x5771c5[_0x3513d2['name']]={'$like':'%'+_0x1f5d29[_0xdb38('0x2f')]['filter']+'%'};return _0x5771c5;}})});}_0x82fdd1=_[_0xdb38('0x38')]({},_0x82fdd1,_0x1f5d29[_0xdb38('0x3b')]);var _0x1c2202={'where':_0x82fdd1[_0xdb38('0x39')]};return db['FreshsalesField'][_0xdb38('0x1a')](_0x1c2202)[_0xdb38('0x22')](function(_0x24de90){_0x128ac6[_0xdb38('0x1a')]=_0x24de90;if(_0x1f5d29['query'][_0xdb38('0x3c')]){_0x82fdd1[_0xdb38('0x3d')]=[{'all':!![]}];}return db[_0xdb38('0x29')]['findAll'](_0x82fdd1);})[_0xdb38('0x22')](function(_0x3cd0af){_0x128ac6[_0xdb38('0x3e')]=_0x3cd0af;return _0x128ac6;})['then'](respondWithFilteredResult(_0x2f621e,_0x82fdd1))[_0xdb38('0x3f')](handleError(_0x2f621e,null));};exports[_0xdb38('0x40')]=function(_0x2575e0,_0x13c293){var _0x157c36={'raw':!![],'where':{'id':_0x2575e0[_0xdb38('0x41')]['id']}},_0x4ef412={};_0x4ef412[_0xdb38('0x2e')]=_[_0xdb38('0x42')](db[_0xdb38('0x29')]['rawAttributes']);_0x4ef412[_0xdb38('0x2f')]=_[_0xdb38('0x42')](_0x2575e0[_0xdb38('0x2f')]);_0x4ef412['filters']=_['intersection'](_0x4ef412['model'],_0x4ef412[_0xdb38('0x2f')]);_0x157c36[_0xdb38('0x32')]=_[_0xdb38('0x31')](_0x4ef412[_0xdb38('0x2e')],qs[_0xdb38('0x33')](_0x2575e0[_0xdb38('0x2f')]['fields']));_0x157c36['attributes']=_0x157c36[_0xdb38('0x32')]['length']?_0x157c36[_0xdb38('0x32')]:_0x4ef412[_0xdb38('0x2e')];if(_0x2575e0[_0xdb38('0x2f')][_0xdb38('0x3c')]){_0x157c36['include']=[{'all':!![]}];}_0x157c36=_[_0xdb38('0x38')]({},_0x157c36,_0x2575e0[_0xdb38('0x3b')]);return db['FreshsalesField']['find'](_0x157c36)[_0xdb38('0x22')](handleEntityNotFound(_0x13c293,null))[_0xdb38('0x22')](respondWithResult(_0x13c293,null))[_0xdb38('0x3f')](handleError(_0x13c293,null));};exports[_0xdb38('0x43')]=function(_0x24287b,_0x3b6e52){return db[_0xdb38('0x29')][_0xdb38('0x43')](_0x24287b[_0xdb38('0x44')],{})[_0xdb38('0x22')](respondWithResult(_0x3b6e52,0xc9))[_0xdb38('0x3f')](handleError(_0x3b6e52,null));};exports[_0xdb38('0x20')]=function(_0x29b828,_0x4d8099){if(_0x29b828[_0xdb38('0x44')]['id']){delete _0x29b828[_0xdb38('0x44')]['id'];}return db[_0xdb38('0x29')]['find']({'where':{'id':_0x29b828[_0xdb38('0x41')]['id']}})[_0xdb38('0x22')](handleEntityNotFound(_0x4d8099,null))[_0xdb38('0x22')](saveUpdates(_0x29b828[_0xdb38('0x44')],null))['then'](respondWithResult(_0x4d8099,null))[_0xdb38('0x3f')](handleError(_0x4d8099,null));};exports['destroy']=function(_0x1f3ed9,_0x59c936){return db[_0xdb38('0x29')][_0xdb38('0x45')]({'where':{'id':_0x1f3ed9[_0xdb38('0x41')]['id']}})[_0xdb38('0x22')](handleEntityNotFound(_0x59c936,null))[_0xdb38('0x22')](removeEntity(_0x59c936,null))[_0xdb38('0x3f')](handleError(_0x59c936,null));}; \ No newline at end of file +var _0xa354=['length','find','create','body','rimraf','fast-json-patch','bluebird','mustache','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','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x2438b9,_0x39cfaa){var _0x1206cd=function(_0x3e2ef2){while(--_0x3e2ef2){_0x2438b9['push'](_0x2438b9['shift']());}};_0x1206cd(++_0x39cfaa);}(_0xa354,0x9a));var _0x4a35=function(_0x4f699c,_0x2f7136){_0x4f699c=_0x4f699c-0x0;var _0x29cc21=_0xa354[_0x4f699c];return _0x29cc21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a35('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4a35('0x2'));var Mustache=require(_0x4a35('0x3'));var util=require(_0x4a35('0x4'));var path=require('path');var sox=require(_0x4a35('0x5'));var csv=require(_0x4a35('0x6'));var ejs=require(_0x4a35('0x7'));var fs=require('fs');var fs_extra=require(_0x4a35('0x8'));var _=require(_0x4a35('0x9'));var squel=require(_0x4a35('0xa'));var crypto=require(_0x4a35('0xb'));var jsforce=require(_0x4a35('0xc'));var deskjs=require(_0x4a35('0xd'));var toCsv=require(_0x4a35('0x6'));var querystring=require('querystring');var Papa=require(_0x4a35('0xe'));var Redis=require(_0x4a35('0xf'));var authService=require(_0x4a35('0x10'));var qs=require(_0x4a35('0x11'));var as=require(_0x4a35('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a35('0x13'))(_0x4a35('0x14'));var utils=require(_0x4a35('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4a35('0x16'))['db'];function respondWithStatusCode(_0x4fbebd,_0x758d6c){_0x758d6c=_0x758d6c||0xcc;return function(_0x52d3b4){if(_0x52d3b4){return _0x4fbebd[_0x4a35('0x17')](_0x758d6c);}return _0x4fbebd['status'](_0x758d6c)[_0x4a35('0x18')]();};}function respondWithResult(_0x215376,_0x2b5710){_0x2b5710=_0x2b5710||0xc8;return function(_0x219d49){if(_0x219d49){return _0x215376[_0x4a35('0x19')](_0x2b5710)[_0x4a35('0x1a')](_0x219d49);}};}function respondWithFilteredResult(_0xf92732,_0xb55b97){return function(_0x217a83){if(_0x217a83){var _0x440d22=typeof _0xb55b97[_0x4a35('0x1b')]===_0x4a35('0x1c')&&typeof _0xb55b97[_0x4a35('0x1d')]==='undefined';var _0x53f162=_0x217a83[_0x4a35('0x1e')];var _0x5dbe80=_0x440d22?0x0:_0xb55b97[_0x4a35('0x1b')];var _0x27ce9a=_0x440d22?_0x217a83[_0x4a35('0x1e')]:_0xb55b97['offset']+_0xb55b97[_0x4a35('0x1d')];var _0x328c58;if(_0x27ce9a>=_0x53f162){_0x27ce9a=_0x53f162;_0x328c58=0xc8;}else{_0x328c58=0xce;}_0xf92732[_0x4a35('0x19')](_0x328c58);return _0xf92732[_0x4a35('0x1f')]('Content-Range',_0x5dbe80+'-'+_0x27ce9a+'/'+_0x53f162)[_0x4a35('0x1a')](_0x217a83);}return null;};}function patchUpdates(_0x1e1220){return function(_0x5b2f51){try{jsonpatch[_0x4a35('0x20')](_0x5b2f51,_0x1e1220,!![]);}catch(_0x3f3d16){return BPromise['reject'](_0x3f3d16);}return _0x5b2f51[_0x4a35('0x21')]();};}function saveUpdates(_0x1f4e42,_0x11ed4b){return function(_0x1c8fe7){if(_0x1c8fe7){return _0x1c8fe7[_0x4a35('0x22')](_0x1f4e42)['then'](function(_0x5f2183){return _0x5f2183;});}return null;};}function removeEntity(_0xdc717,_0x4a3d39){return function(_0x24426f){if(_0x24426f){return _0x24426f[_0x4a35('0x23')]()[_0x4a35('0x24')](function(){_0xdc717[_0x4a35('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d7e0,_0x46caff){return function(_0xe662eb){if(!_0xe662eb){_0x48d7e0[_0x4a35('0x17')](0x194);}return _0xe662eb;};}function handleError(_0x5b5ec7,_0x56e334){_0x56e334=_0x56e334||0x1f4;return function(_0xa06fb0){logger[_0x4a35('0x25')](_0xa06fb0[_0x4a35('0x26')]);if(_0xa06fb0[_0x4a35('0x27')]){delete _0xa06fb0['name'];}_0x5b5ec7[_0x4a35('0x19')](_0x56e334)[_0x4a35('0x28')](_0xa06fb0);};}exports[_0x4a35('0x29')]=function(_0x57c85a,_0x3c160a){var _0x4165fc={},_0x4dc2e4={},_0x3fbb3c={'count':0x0,'rows':[]};var _0x83a139=_[_0x4a35('0x2a')](db[_0x4a35('0x2b')][_0x4a35('0x2c')],function(_0x5360a4){return{'name':_0x5360a4[_0x4a35('0x2d')],'type':_0x5360a4[_0x4a35('0x2e')][_0x4a35('0x2f')]};});_0x4dc2e4[_0x4a35('0x30')]=_['map'](_0x83a139,_0x4a35('0x27'));_0x4dc2e4[_0x4a35('0x31')]=_[_0x4a35('0x32')](_0x57c85a['query']);_0x4dc2e4[_0x4a35('0x33')]=_[_0x4a35('0x34')](_0x4dc2e4[_0x4a35('0x30')],_0x4dc2e4[_0x4a35('0x31')]);_0x4165fc[_0x4a35('0x35')]=_[_0x4a35('0x34')](_0x4dc2e4[_0x4a35('0x30')],qs[_0x4a35('0x36')](_0x57c85a[_0x4a35('0x31')][_0x4a35('0x36')]));_0x4165fc[_0x4a35('0x35')]=_0x4165fc[_0x4a35('0x35')]['length']?_0x4165fc[_0x4a35('0x35')]:_0x4dc2e4['model'];if(!_0x57c85a[_0x4a35('0x31')][_0x4a35('0x37')](_0x4a35('0x38'))){_0x4165fc['limit']=qs['limit'](_0x57c85a[_0x4a35('0x31')][_0x4a35('0x1d')]);_0x4165fc[_0x4a35('0x1b')]=qs[_0x4a35('0x1b')](_0x57c85a[_0x4a35('0x31')][_0x4a35('0x1b')]);}_0x4165fc[_0x4a35('0x39')]=qs['sort'](_0x57c85a['query'][_0x4a35('0x3a')]);_0x4165fc[_0x4a35('0x3b')]=qs[_0x4a35('0x33')](_[_0x4a35('0x3c')](_0x57c85a[_0x4a35('0x31')],_0x4dc2e4[_0x4a35('0x33')]),_0x83a139);if(_0x57c85a['query']['filter']){_0x4165fc[_0x4a35('0x3b')]=_[_0x4a35('0x3d')](_0x4165fc['where'],{'$or':_[_0x4a35('0x2a')](_0x83a139,function(_0x224347){if(_0x224347[_0x4a35('0x2e')]!=='VIRTUAL'){var _0x44d0e3={};_0x44d0e3[_0x224347[_0x4a35('0x27')]]={'$like':'%'+_0x57c85a[_0x4a35('0x31')][_0x4a35('0x3e')]+'%'};return _0x44d0e3;}})});}_0x4165fc=_[_0x4a35('0x3d')]({},_0x4165fc,_0x57c85a[_0x4a35('0x3f')]);var _0xb39a01={'where':_0x4165fc[_0x4a35('0x3b')]};return db[_0x4a35('0x2b')]['count'](_0xb39a01)[_0x4a35('0x24')](function(_0x2b9993){_0x3fbb3c[_0x4a35('0x1e')]=_0x2b9993;if(_0x57c85a[_0x4a35('0x31')][_0x4a35('0x40')]){_0x4165fc[_0x4a35('0x41')]=[{'all':!![]}];}return db[_0x4a35('0x2b')][_0x4a35('0x42')](_0x4165fc);})['then'](function(_0x20aa26){_0x3fbb3c[_0x4a35('0x43')]=_0x20aa26;return _0x3fbb3c;})[_0x4a35('0x24')](respondWithFilteredResult(_0x3c160a,_0x4165fc))[_0x4a35('0x44')](handleError(_0x3c160a,null));};exports[_0x4a35('0x45')]=function(_0x28df5b,_0x14d8d6){var _0x511f82={'raw':!![],'where':{'id':_0x28df5b[_0x4a35('0x46')]['id']}},_0xf9a1b0={};_0xf9a1b0['model']=_[_0x4a35('0x32')](db[_0x4a35('0x2b')]['rawAttributes']);_0xf9a1b0[_0x4a35('0x31')]=_[_0x4a35('0x32')](_0x28df5b[_0x4a35('0x31')]);_0xf9a1b0[_0x4a35('0x33')]=_[_0x4a35('0x34')](_0xf9a1b0['model'],_0xf9a1b0[_0x4a35('0x31')]);_0x511f82['attributes']=_[_0x4a35('0x34')](_0xf9a1b0[_0x4a35('0x30')],qs[_0x4a35('0x36')](_0x28df5b[_0x4a35('0x31')][_0x4a35('0x36')]));_0x511f82[_0x4a35('0x35')]=_0x511f82['attributes'][_0x4a35('0x47')]?_0x511f82[_0x4a35('0x35')]:_0xf9a1b0[_0x4a35('0x30')];if(_0x28df5b[_0x4a35('0x31')][_0x4a35('0x40')]){_0x511f82[_0x4a35('0x41')]=[{'all':!![]}];}_0x511f82=_[_0x4a35('0x3d')]({},_0x511f82,_0x28df5b[_0x4a35('0x3f')]);return db[_0x4a35('0x2b')][_0x4a35('0x48')](_0x511f82)['then'](handleEntityNotFound(_0x14d8d6,null))[_0x4a35('0x24')](respondWithResult(_0x14d8d6,null))['catch'](handleError(_0x14d8d6,null));};exports[_0x4a35('0x49')]=function(_0x3a2dbf,_0x3a547d){return db['FreshsalesField']['create'](_0x3a2dbf[_0x4a35('0x4a')],{})['then'](respondWithResult(_0x3a547d,0xc9))[_0x4a35('0x44')](handleError(_0x3a547d,null));};exports[_0x4a35('0x22')]=function(_0x3b178f,_0x991b04){if(_0x3b178f[_0x4a35('0x4a')]['id']){delete _0x3b178f[_0x4a35('0x4a')]['id'];}return db[_0x4a35('0x2b')][_0x4a35('0x48')]({'where':{'id':_0x3b178f[_0x4a35('0x46')]['id']}})[_0x4a35('0x24')](handleEntityNotFound(_0x991b04,null))['then'](saveUpdates(_0x3b178f[_0x4a35('0x4a')],null))[_0x4a35('0x24')](respondWithResult(_0x991b04,null))[_0x4a35('0x44')](handleError(_0x991b04,null));};exports[_0x4a35('0x23')]=function(_0x2c6ca2,_0x8bac02){return db[_0x4a35('0x2b')][_0x4a35('0x48')]({'where':{'id':_0x2c6ca2['params']['id']}})[_0x4a35('0x24')](handleEntityNotFound(_0x8bac02,null))[_0x4a35('0x24')](removeEntity(_0x8bac02,null))[_0x4a35('0x44')](handleError(_0x8bac02,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6e139d2..a9bea96 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 _0xdfb1=['api','bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x58b36b,_0x3c03de){_0x58b36b=_0x58b36b-0x0;var _0x24de76=_0xdfb1[_0x58b36b];return _0x24de76;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('FreshsalesField',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[{'name':_0x1dfb('0xa'),'fields':[_0x1dfb('0xb'),_0x1dfb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd5a2=['freshsales_unique_index','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x4c3a86,_0x344c87){var _0x46dcf9=function(_0x4a5991){while(--_0x4a5991){_0x4c3a86['push'](_0x4c3a86['shift']());}};_0x46dcf9(++_0x344c87);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x2a9859,_0x42003b){_0x2a9859=_0x2a9859-0x0;var _0x58d5ec=_0xd5a2[_0x2a9859];return _0x58d5ec;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var logger=require(_0x2d5a('0x1'))(_0x2d5a('0x2'));var moment=require(_0x2d5a('0x3'));var BPromise=require(_0x2d5a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d5a('0x5'));var rimraf=require(_0x2d5a('0x6'));var config=require(_0x2d5a('0x7'));var attributes=require(_0x2d5a('0x8'));module[_0x2d5a('0x9')]=function(_0x1187b5,_0x923c29){return _0x1187b5[_0x2d5a('0xa')](_0x2d5a('0xb'),attributes,{'tableName':_0x2d5a('0xc'),'paranoid':![],'indexes':[{'name':_0x2d5a('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 5f85535..fee1a08 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 _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x814b,0x1a2));var _0xb814=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x814b[_0xa46b86];return _0x417360;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20574a,_0x546324){var _0x445590=function(_0x3845c9){while(--_0x3845c9){_0x20574a['push'](_0x20574a['shift']());}};_0x445590(++_0x546324);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1b76be,_0x2db988){_0x1b76be=_0x1b76be-0x0;var _0xdea8e1=_0xb4c7[_0x1b76be];return _0xdea8e1;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2eab2c9..7bc3428 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1145f1,_0x2f82b6){var _0x201c07=function(_0x2413cc){while(--_0x2413cc){_0x1145f1['push'](_0x1145f1['shift']());}};_0x201c07(++_0x2f82b6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3ca233,_0x1ea7b9){var _0x353e98=function(_0x137357){while(--_0x137357){_0x3ca233['push'](_0x3ca233['shift']());}};_0x353e98(++_0x1ea7b9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a95ed88..9135d30 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 _0xb158=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb158,0xfc));var _0x8b15=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb158[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x8b15('0x0'));module[_0x8b15('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b15('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8b15('0x3')},'remoteUri':{'type':Sequelize[_0x8b15('0x2')]},'password':{'type':Sequelize[_0x8b15('0x2')]},'clientId':{'type':Sequelize[_0x8b15('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8b15('0x2')]},'serverUrl':{'type':Sequelize[_0x8b15('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8b15('0x4')](_0x8b15('0x5'),_0x8b15('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xeb0f=['integrationTab','newTab','sequelize','STRING','username','ENUM'];(function(_0x50726c,_0x4fdec4){var _0x325e0c=function(_0x4ef3cb){while(--_0x4ef3cb){_0x50726c['push'](_0x50726c['shift']());}};_0x325e0c(++_0x4fdec4);}(_0xeb0f,0x176));var _0xfeb0=function(_0x251379,_0x534ae4){_0x251379=_0x251379-0x0;var _0x194816=_0xeb0f[_0x251379];return _0x194816;};'use strict';var Sequelize=require(_0xfeb0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfeb0('0x1')]},'description':{'type':Sequelize[_0xfeb0('0x1')]},'username':{'type':Sequelize[_0xfeb0('0x1')],'unique':_0xfeb0('0x2')},'remoteUri':{'type':Sequelize[_0xfeb0('0x1')]},'password':{'type':Sequelize[_0xfeb0('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xfeb0('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfeb0('0x3')](_0xfeb0('0x4'),_0xfeb0('0x5')),'defaultValue':_0xfeb0('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5cd77e8..6e46afb 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 _0xe012=['sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','Connection','login','username','password','concat','ticketType'];(function(_0x1c873d,_0x1b3094){var _0x27ad73=function(_0x58a656){while(--_0x58a656){_0x1c873d['push'](_0x1c873d['shift']());}};_0x27ad73(++_0x1b3094);}(_0xe012,0x98));var _0x2e01=function(_0x5aaba9,_0x1c4282){_0x5aaba9=_0x5aaba9-0x0;var _0x469349=_0xe012[_0x5aaba9];return _0x469349;};'use strict';var emlformat=require(_0x2e01('0x0'));var rimraf=require(_0x2e01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e01('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2e01('0x3'));var util=require(_0x2e01('0x4'));var path=require(_0x2e01('0x5'));var sox=require(_0x2e01('0x6'));var csv=require(_0x2e01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e01('0x8'));var _=require(_0x2e01('0x9'));var squel=require(_0x2e01('0xa'));var crypto=require(_0x2e01('0xb'));var jsforce=require(_0x2e01('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2e01('0x7'));var querystring=require('querystring');var Papa=require(_0x2e01('0xd'));var Redis=require(_0x2e01('0xe'));var authService=require(_0x2e01('0xf'));var qs=require(_0x2e01('0x10'));var as=require(_0x2e01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e01('0x12'))('api');var utils=require(_0x2e01('0x13'));var config=require(_0x2e01('0x14'));var licenseUtil=require(_0x2e01('0x15'));var db=require(_0x2e01('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x35bcb9,_0x429735){_0x429735=_0x429735||0xcc;return function(_0x5909c4){if(_0x5909c4){return _0x35bcb9[_0x2e01('0x17')](_0x429735);}return _0x35bcb9[_0x2e01('0x18')](_0x429735)['end']();};}function respondWithResult(_0x21a05f,_0x129678){_0x129678=_0x129678||0xc8;return function(_0x4c35de){if(_0x4c35de){return _0x21a05f[_0x2e01('0x18')](_0x129678)['json'](_0x4c35de);}};}function respondWithFilteredResult(_0x49edc9,_0x291412){return function(_0x3b1a4d){if(_0x3b1a4d){var _0x6a1ae2=typeof _0x291412[_0x2e01('0x19')]===_0x2e01('0x1a')&&typeof _0x291412[_0x2e01('0x1b')]===_0x2e01('0x1a');var _0x1743e4=_0x3b1a4d['count'];var _0x5a0a4b=_0x6a1ae2?0x0:_0x291412[_0x2e01('0x19')];var _0x5995c0=_0x6a1ae2?_0x3b1a4d[_0x2e01('0x1c')]:_0x291412[_0x2e01('0x19')]+_0x291412['limit'];var _0x5c6136;if(_0x5995c0>=_0x1743e4){_0x5995c0=_0x1743e4;_0x5c6136=0xc8;}else{_0x5c6136=0xce;}_0x49edc9[_0x2e01('0x18')](_0x5c6136);return _0x49edc9['set'](_0x2e01('0x1d'),_0x5a0a4b+'-'+_0x5995c0+'/'+_0x1743e4)[_0x2e01('0x1e')](_0x3b1a4d);}return null;};}function patchUpdates(_0x5c7ad0){return function(_0x339d69){try{jsonpatch[_0x2e01('0x1f')](_0x339d69,_0x5c7ad0,!![]);}catch(_0x39c3a6){return BPromise[_0x2e01('0x20')](_0x39c3a6);}return _0x339d69['save']();};}function saveUpdates(_0x1e7594,_0x2cd63c){return function(_0xaf3d03){if(_0xaf3d03){return _0xaf3d03[_0x2e01('0x21')](_0x1e7594)['then'](function(_0x1f4818){return _0x1f4818;});}return null;};}function removeEntity(_0x22185b,_0x565d0c){return function(_0x577052){if(_0x577052){return _0x577052[_0x2e01('0x22')]()[_0x2e01('0x23')](function(){_0x22185b[_0x2e01('0x18')](0xcc)[_0x2e01('0x24')]();});}};}function handleEntityNotFound(_0x22642e,_0x11d5d5){return function(_0x315cb8){if(!_0x315cb8){_0x22642e[_0x2e01('0x17')](0x194);}return _0x315cb8;};}function handleError(_0x428dae,_0x182e2e){_0x182e2e=_0x182e2e||0x1f4;return function(_0x307f0c){logger[_0x2e01('0x25')](_0x307f0c[_0x2e01('0x26')]);if(_0x307f0c[_0x2e01('0x27')]){delete _0x307f0c[_0x2e01('0x27')];}_0x428dae[_0x2e01('0x18')](_0x182e2e)['send'](_0x307f0c);};}exports[_0x2e01('0x28')]=function(_0x4107fa,_0xb8c111){var _0xbe6b72={},_0x4874fe={},_0x5da447={'count':0x0,'rows':[]};var _0x288c4d=_[_0x2e01('0x29')](db[_0x2e01('0x2a')][_0x2e01('0x2b')],function(_0x10f891){return{'name':_0x10f891[_0x2e01('0x2c')],'type':_0x10f891[_0x2e01('0x2d')][_0x2e01('0x2e')]};});_0x4874fe[_0x2e01('0x2f')]=_[_0x2e01('0x29')](_0x288c4d,_0x2e01('0x27'));_0x4874fe[_0x2e01('0x30')]=_[_0x2e01('0x31')](_0x4107fa[_0x2e01('0x30')]);_0x4874fe[_0x2e01('0x32')]=_[_0x2e01('0x33')](_0x4874fe[_0x2e01('0x2f')],_0x4874fe[_0x2e01('0x30')]);_0xbe6b72[_0x2e01('0x34')]=_[_0x2e01('0x33')](_0x4874fe[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x35')]));_0xbe6b72[_0x2e01('0x34')]=_0xbe6b72['attributes'][_0x2e01('0x36')]?_0xbe6b72[_0x2e01('0x34')]:_0x4874fe[_0x2e01('0x2f')];if(!_0x4107fa[_0x2e01('0x30')][_0x2e01('0x37')](_0x2e01('0x38'))){_0xbe6b72[_0x2e01('0x1b')]=qs[_0x2e01('0x1b')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x1b')]);_0xbe6b72['offset']=qs[_0x2e01('0x19')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x19')]);}_0xbe6b72[_0x2e01('0x39')]=qs[_0x2e01('0x3a')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x3a')]);_0xbe6b72[_0x2e01('0x3b')]=qs[_0x2e01('0x32')](_[_0x2e01('0x3c')](_0x4107fa[_0x2e01('0x30')],_0x4874fe[_0x2e01('0x32')]),_0x288c4d);if(_0x4107fa['query'][_0x2e01('0x3d')]){_0xbe6b72['where']=_['merge'](_0xbe6b72[_0x2e01('0x3b')],{'$or':_['map'](_0x288c4d,function(_0x3bea73){if(_0x3bea73[_0x2e01('0x2d')]!==_0x2e01('0x3e')){var _0xa83420={};_0xa83420[_0x3bea73[_0x2e01('0x27')]]={'$like':'%'+_0x4107fa['query']['filter']+'%'};return _0xa83420;}})});}_0xbe6b72=_[_0x2e01('0x3f')]({},_0xbe6b72,_0x4107fa[_0x2e01('0x40')]);var _0x24947d={'where':_0xbe6b72[_0x2e01('0x3b')]};return db[_0x2e01('0x2a')]['count'](_0x24947d)['then'](function(_0x10f298){_0x5da447[_0x2e01('0x1c')]=_0x10f298;if(_0x4107fa[_0x2e01('0x30')]['includeAll']){_0xbe6b72[_0x2e01('0x41')]=[{'all':!![]}];}return db[_0x2e01('0x2a')]['findAll'](_0xbe6b72);})[_0x2e01('0x23')](function(_0x251ce2){_0x5da447[_0x2e01('0x42')]=_0x251ce2;return _0x5da447;})[_0x2e01('0x23')](respondWithFilteredResult(_0xb8c111,_0xbe6b72))['catch'](handleError(_0xb8c111,null));};exports[_0x2e01('0x43')]=function(_0x264cd1,_0x2cd974){var _0x556426={'raw':![],'where':{'id':_0x264cd1[_0x2e01('0x44')]['id']}},_0x124e34={};_0x124e34[_0x2e01('0x2f')]=_[_0x2e01('0x31')](db[_0x2e01('0x2a')][_0x2e01('0x2b')]);_0x124e34[_0x2e01('0x30')]=_['keys'](_0x264cd1['query']);_0x124e34[_0x2e01('0x32')]=_['intersection'](_0x124e34[_0x2e01('0x2f')],_0x124e34['query']);_0x556426[_0x2e01('0x34')]=_[_0x2e01('0x33')](_0x124e34[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x264cd1[_0x2e01('0x30')]['fields']));_0x556426[_0x2e01('0x34')]=_0x556426['attributes'][_0x2e01('0x36')]?_0x556426[_0x2e01('0x34')]:_0x124e34['model'];if(_0x264cd1[_0x2e01('0x30')][_0x2e01('0x45')]){_0x556426[_0x2e01('0x41')]=[{'all':!![]}];}_0x556426=_[_0x2e01('0x3f')]({},_0x556426,_0x264cd1[_0x2e01('0x40')]);return db['SalesforceAccount'][_0x2e01('0x46')](_0x556426)[_0x2e01('0x23')](handleEntityNotFound(_0x2cd974,null))[_0x2e01('0x23')](respondWithResult(_0x2cd974,null))[_0x2e01('0x47')](handleError(_0x2cd974,null));};exports[_0x2e01('0x48')]=function(_0x38694d,_0x58aa06){return db[_0x2e01('0x2a')][_0x2e01('0x48')](_0x38694d[_0x2e01('0x49')],{})[_0x2e01('0x23')](respondWithResult(_0x58aa06,0xc9))[_0x2e01('0x47')](handleError(_0x58aa06,null));};exports['update']=function(_0x5729ed,_0x543cd3){if(_0x5729ed[_0x2e01('0x49')]['id']){delete _0x5729ed[_0x2e01('0x49')]['id'];}return db[_0x2e01('0x2a')][_0x2e01('0x46')]({'where':{'id':_0x5729ed[_0x2e01('0x44')]['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x543cd3,null))[_0x2e01('0x23')](saveUpdates(_0x5729ed[_0x2e01('0x49')],null))['then'](respondWithResult(_0x543cd3,null))[_0x2e01('0x47')](handleError(_0x543cd3,null));};exports['destroy']=function(_0x3e2f74,_0x32300e){return db['SalesforceAccount'][_0x2e01('0x46')]({'where':{'id':_0x3e2f74['params']['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x32300e,null))['then'](removeEntity(_0x32300e,null))[_0x2e01('0x47')](handleError(_0x32300e,null));};exports['getConfigurations']=function(_0x47ca69,_0x1bb2eb,_0x1121b6){var _0x3a48f0={};var _0x490327={};var _0x38546d;var _0x96f34a;return db[_0x2e01('0x2a')][_0x2e01('0x4a')]({'where':{'id':_0x47ca69['params']['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x1bb2eb,null))[_0x2e01('0x23')](function(_0x5e0931){if(_0x5e0931){_0x38546d=_0x5e0931;_0x490327[_0x2e01('0x2f')]=_[_0x2e01('0x31')](db['SalesforceConfiguration'][_0x2e01('0x2b')]);_0x490327[_0x2e01('0x30')]=_[_0x2e01('0x31')](_0x47ca69['query']);_0x490327[_0x2e01('0x32')]=_[_0x2e01('0x33')](_0x490327[_0x2e01('0x2f')],_0x490327[_0x2e01('0x30')]);_0x3a48f0['attributes']=_[_0x2e01('0x33')](_0x490327[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x47ca69['query'][_0x2e01('0x35')]));_0x3a48f0['attributes']=_0x3a48f0['attributes']['length']?_0x3a48f0['attributes']:_0x490327['model'];_0x3a48f0[_0x2e01('0x39')]=qs[_0x2e01('0x3a')](_0x47ca69[_0x2e01('0x30')][_0x2e01('0x3a')]);_0x3a48f0[_0x2e01('0x3b')]=qs[_0x2e01('0x32')](_[_0x2e01('0x3c')](_0x47ca69[_0x2e01('0x30')],_0x490327[_0x2e01('0x32')]));if(_0x47ca69['query'][_0x2e01('0x3d')]){_0x3a48f0[_0x2e01('0x3b')]=_[_0x2e01('0x3f')](_0x3a48f0[_0x2e01('0x3b')],{'$or':_['map'](_0x3a48f0[_0x2e01('0x34')],function(_0x486a09){var _0x3b2770={};_0x3b2770[_0x486a09]={'$like':'%'+_0x47ca69[_0x2e01('0x30')][_0x2e01('0x3d')]+'%'};return _0x3b2770;})});}_0x3a48f0=_[_0x2e01('0x3f')]({},_0x3a48f0,_0x47ca69[_0x2e01('0x40')]);return _0x38546d[_0x2e01('0x4b')](_0x3a48f0);}})[_0x2e01('0x23')](function(_0x1844d3){if(_0x1844d3){_0x96f34a=_0x1844d3['length'];if(!_0x47ca69[_0x2e01('0x30')]['hasOwnProperty'](_0x2e01('0x38'))){_0x3a48f0[_0x2e01('0x1b')]=qs['limit'](_0x47ca69[_0x2e01('0x30')][_0x2e01('0x1b')]);_0x3a48f0['offset']=qs['offset'](_0x47ca69['query'][_0x2e01('0x19')]);}return _0x38546d[_0x2e01('0x4b')](_0x3a48f0);}})[_0x2e01('0x23')](function(_0x20a07a){if(_0x20a07a){return _0x20a07a?{'count':_0x96f34a,'rows':_0x20a07a}:null;}})[_0x2e01('0x23')](respondWithResult(_0x1bb2eb,null))[_0x2e01('0x47')](handleError(_0x1bb2eb,null));};exports[_0x2e01('0x4c')]=function(_0x4faeca,_0x24cd88,_0x30e2e6){if(_0x4faeca[_0x2e01('0x49')]['id']){delete _0x4faeca[_0x2e01('0x49')]['id'];}return db[_0x2e01('0x2a')]['findOne']({'where':{'id':_0x4faeca[_0x2e01('0x44')]['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x24cd88,null))[_0x2e01('0x23')](function(_0x2385a8){if(_0x2385a8){_0x4faeca[_0x2e01('0x49')][_0x2e01('0x4d')]=_0x2385a8['id'];_0x4faeca[_0x2e01('0x49')][_0x2e01('0x4e')]=integrations[_0x2e01('0x4f')](_0x4faeca[_0x2e01('0x49')]['channel'],_0x4faeca[_0x2e01('0x49')][_0x2e01('0x2d')]);_0x4faeca[_0x2e01('0x49')][_0x2e01('0x50')]=integrations[_0x2e01('0x51')](_0x4faeca['body'][_0x2e01('0x52')],_0x4faeca['body'][_0x2e01('0x2d')]);return db[_0x2e01('0x53')][_0x2e01('0x48')](_0x4faeca[_0x2e01('0x49')],{'include':[{'model':db[_0x2e01('0x54')],'as':_0x2e01('0x4e')},{'model':db['SalesforceField'],'as':_0x2e01('0x50')}]});}return null;})[_0x2e01('0x23')](respondWithResult(_0x24cd88,null))[_0x2e01('0x47')](handleError(_0x24cd88,null));};exports['getFields']=function(_0x542c9c,_0x234d2c,_0x15f23f){var _0x11620b;var _0xb25d62='';var _0x27de6d='Task';return db[_0x2e01('0x2a')][_0x2e01('0x4a')]({'where':{'id':_0x542c9c[_0x2e01('0x44')]['id']},'attributes':['id',_0x2e01('0x55'),_0x2e01('0x56'),_0x2e01('0x57'),'username','password',_0x2e01('0x58')]})[_0x2e01('0x23')](handleEntityNotFound(_0x234d2c,null))['then'](function(_0x45cc53){if(_0x45cc53){_0xb25d62=_0x45cc53[_0x2e01('0x55')];var _0x196793=_0xb25d62[_0x2e01('0x59')](-0x1);if(_0x196793==='/'){_0xb25d62=_0xb25d62[_0x2e01('0x5a')](0x0,_0xb25d62[_0x2e01('0x5b')](_0x196793));}_0x11620b=new jsforce[(_0x2e01('0x5c'))]({'oauth2':{'loginUrl':_0xb25d62,'clientId':_0x45cc53[_0x2e01('0x56')],'clientSecret':_0x45cc53[_0x2e01('0x57')]}});return _0x11620b[_0x2e01('0x5d')](_0x45cc53[_0x2e01('0x5e')],_0x45cc53[_0x2e01('0x5f')][_0x2e01('0x60')](_0x45cc53[_0x2e01('0x58')]));}})['then'](function(_0x565109){if(_0x565109){if(!_['isNil'](_0x542c9c[_0x2e01('0x30')]['ticketType'])){_0x27de6d=_0x542c9c['query'][_0x2e01('0x61')];}return _0x11620b[_0x2e01('0x62')](_0x27de6d)[_0x2e01('0x63')]();}})[_0x2e01('0x23')](function(_0x321c7b){var _0x186d0c=[_0x2e01('0x64'),_0x2e01('0x65'),_0x2e01('0x66'),'IsRecurrence',_0x2e01('0x67'),'Description'];var _0x409122=[_0x2e01('0x68'),_0x2e01('0x69'),_0x2e01('0x6a'),_0x2e01('0x6b'),_0x2e01('0x6c'),_0x2e01('0x6d'),_0x2e01('0x6e')];if(_0x321c7b){_[_0x2e01('0x6f')](_0x321c7b[_0x2e01('0x35')],function(_0x20ae75){return _0x186d0c[_0x2e01('0x70')](_0x20ae75[_0x2e01('0x27')])||!_0x409122[_0x2e01('0x70')](_0x20ae75[_0x2e01('0x2d')]);});return{'count':_0x321c7b['fields']['length'],'rows':_[_0x2e01('0x29')](_0x321c7b[_0x2e01('0x35')],function(_0x13d970){return{'id':_0x13d970[_0x2e01('0x27')],'name':_0x13d970['label'],'custom':_0x13d970[_0x2e01('0x71')],'options':_0x13d970['picklistValues'][_0x2e01('0x36')]>0x0?_[_0x2e01('0x29')](_0x13d970[_0x2e01('0x72')],function(_0x447c23){return{'name':_0x447c23[_0x2e01('0x73')],'value':_0x447c23[_0x2e01('0x74')]};}):_0x13d970[_0x2e01('0x2d')]==_0x2e01('0x6b')?[{'name':'True','value':_0x2e01('0x75')},{'name':_0x2e01('0x76'),'value':_0x2e01('0x77')}]:[]};})};}})[_0x2e01('0x23')](respondWithResult(_0x234d2c,null))[_0x2e01('0x47')](function(_0x29c0f8){var _0x19e267=_0x542c9c[_0x2e01('0x30')]['test']?0x1f4:_0x29c0f8[_0x2e01('0x78')]||0x1f4;logger[_0x2e01('0x25')](_0x2e01('0x79'),'getFields',_0x19e267,JSON['stringify'](_0x29c0f8));delete _0x29c0f8[_0x2e01('0x27')];if(_0x19e267===0x191){_0x19e267=0x190;}_0x234d2c['status'](_0x19e267)[_0x2e01('0x7a')](_0x542c9c[_0x2e01('0x30')][_0x2e01('0x7b')]?{'message':_0x2e01('0x7c'),'statusCode':_0x29c0f8[_0x2e01('0x78')]}:_0x29c0f8);});}; \ No newline at end of file +var _0x436f=['email','textarea','remove','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','sendStatus','error','name','send','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','where','filter','type','merge','options','includeAll','include','rows','show','params','find','create','body','catch','destroy','getConfigurations','findOne','SalesforceConfiguration','filters','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','remoteUri','clientId','username','password','slice','lastIndexOf','Connection','clientSecret','login','concat','securityToken','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x436f,0x175));var _0xf436=function(_0x3eace8,_0x28bc1c){_0x3eace8=_0x3eace8-0x0;var _0x4372d6=_0x436f[_0x3eace8];return _0x4372d6;};'use strict';var emlformat=require(_0xf436('0x0'));var rimraf=require(_0xf436('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf436('0x2'));var rp=require('request-promise');var moment=require(_0xf436('0x3'));var BPromise=require(_0xf436('0x4'));var Mustache=require('mustache');var util=require(_0xf436('0x5'));var path=require(_0xf436('0x6'));var sox=require(_0xf436('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf436('0x8'));var _=require(_0xf436('0x9'));var squel=require(_0xf436('0xa'));var crypto=require('crypto');var jsforce=require(_0xf436('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf436('0xc'));var querystring=require(_0xf436('0xd'));var Papa=require(_0xf436('0xe'));var Redis=require(_0xf436('0xf'));var authService=require(_0xf436('0x10'));var qs=require(_0xf436('0x11'));var as=require(_0xf436('0x12'));var hardwareService=require(_0xf436('0x13'));var logger=require(_0xf436('0x14'))('api');var utils=require(_0xf436('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf436('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf436('0x17'));function respondWithStatusCode(_0x2b4e0c,_0x29a833){_0x29a833=_0x29a833||0xcc;return function(_0x20b6d1){if(_0x20b6d1){return _0x2b4e0c['sendStatus'](_0x29a833);}return _0x2b4e0c[_0xf436('0x18')](_0x29a833)[_0xf436('0x19')]();};}function respondWithResult(_0x208e0b,_0x3d4366){_0x3d4366=_0x3d4366||0xc8;return function(_0x152ace){if(_0x152ace){return _0x208e0b['status'](_0x3d4366)[_0xf436('0x1a')](_0x152ace);}};}function respondWithFilteredResult(_0x3abbc1,_0x6e38f5){return function(_0x525e15){if(_0x525e15){var _0xd96880=typeof _0x6e38f5[_0xf436('0x1b')]===_0xf436('0x1c')&&typeof _0x6e38f5[_0xf436('0x1d')]==='undefined';var _0x74f433=_0x525e15[_0xf436('0x1e')];var _0x23bb3e=_0xd96880?0x0:_0x6e38f5['offset'];var _0xff094a=_0xd96880?_0x525e15['count']:_0x6e38f5[_0xf436('0x1b')]+_0x6e38f5[_0xf436('0x1d')];var _0x538914;if(_0xff094a>=_0x74f433){_0xff094a=_0x74f433;_0x538914=0xc8;}else{_0x538914=0xce;}_0x3abbc1[_0xf436('0x18')](_0x538914);return _0x3abbc1[_0xf436('0x1f')](_0xf436('0x20'),_0x23bb3e+'-'+_0xff094a+'/'+_0x74f433)[_0xf436('0x1a')](_0x525e15);}return null;};}function patchUpdates(_0x557356){return function(_0xef401){try{jsonpatch['apply'](_0xef401,_0x557356,!![]);}catch(_0xcd632e){return BPromise[_0xf436('0x21')](_0xcd632e);}return _0xef401['save']();};}function saveUpdates(_0x23184b,_0x590c3f){return function(_0x55bc51){if(_0x55bc51){return _0x55bc51['update'](_0x23184b)[_0xf436('0x22')](function(_0x172592){return _0x172592;});}return null;};}function removeEntity(_0x454e68,_0x239c3f){return function(_0x42a97a){if(_0x42a97a){return _0x42a97a['destroy']()['then'](function(){_0x454e68['status'](0xcc)[_0xf436('0x19')]();});}};}function handleEntityNotFound(_0x20cd8c,_0xaed663){return function(_0x39fd58){if(!_0x39fd58){_0x20cd8c[_0xf436('0x23')](0x194);}return _0x39fd58;};}function handleError(_0x2bec3c,_0x437ec7){_0x437ec7=_0x437ec7||0x1f4;return function(_0x59afb2){logger[_0xf436('0x24')](_0x59afb2['stack']);if(_0x59afb2[_0xf436('0x25')]){delete _0x59afb2[_0xf436('0x25')];}_0x2bec3c['status'](_0x437ec7)[_0xf436('0x26')](_0x59afb2);};}exports['index']=function(_0x2210bd,_0xe5b4d2){var _0x4e0f46={},_0x28ed1e={},_0x5ebdad={'count':0x0,'rows':[]};var _0x1505d6=_['map'](db[_0xf436('0x27')][_0xf436('0x28')],function(_0x1c5daa){return{'name':_0x1c5daa[_0xf436('0x29')],'type':_0x1c5daa['type'][_0xf436('0x2a')]};});_0x28ed1e[_0xf436('0x2b')]=_[_0xf436('0x2c')](_0x1505d6,'name');_0x28ed1e[_0xf436('0x2d')]=_[_0xf436('0x2e')](_0x2210bd[_0xf436('0x2d')]);_0x28ed1e['filters']=_[_0xf436('0x2f')](_0x28ed1e[_0xf436('0x2b')],_0x28ed1e[_0xf436('0x2d')]);_0x4e0f46[_0xf436('0x30')]=_[_0xf436('0x2f')](_0x28ed1e[_0xf436('0x2b')],qs[_0xf436('0x31')](_0x2210bd['query']['fields']));_0x4e0f46[_0xf436('0x30')]=_0x4e0f46['attributes'][_0xf436('0x32')]?_0x4e0f46[_0xf436('0x30')]:_0x28ed1e['model'];if(!_0x2210bd[_0xf436('0x2d')]['hasOwnProperty']('nolimit')){_0x4e0f46[_0xf436('0x1d')]=qs[_0xf436('0x1d')](_0x2210bd[_0xf436('0x2d')]['limit']);_0x4e0f46['offset']=qs[_0xf436('0x1b')](_0x2210bd[_0xf436('0x2d')][_0xf436('0x1b')]);}_0x4e0f46[_0xf436('0x33')]=qs[_0xf436('0x34')](_0x2210bd[_0xf436('0x2d')]['sort']);_0x4e0f46[_0xf436('0x35')]=qs['filters'](_['pick'](_0x2210bd[_0xf436('0x2d')],_0x28ed1e['filters']),_0x1505d6);if(_0x2210bd[_0xf436('0x2d')][_0xf436('0x36')]){_0x4e0f46[_0xf436('0x35')]=_['merge'](_0x4e0f46['where'],{'$or':_[_0xf436('0x2c')](_0x1505d6,function(_0xc553d6){if(_0xc553d6[_0xf436('0x37')]!=='VIRTUAL'){var _0x316409={};_0x316409[_0xc553d6[_0xf436('0x25')]]={'$like':'%'+_0x2210bd[_0xf436('0x2d')]['filter']+'%'};return _0x316409;}})});}_0x4e0f46=_[_0xf436('0x38')]({},_0x4e0f46,_0x2210bd[_0xf436('0x39')]);var _0x29b085={'where':_0x4e0f46['where']};return db[_0xf436('0x27')][_0xf436('0x1e')](_0x29b085)['then'](function(_0x578504){_0x5ebdad[_0xf436('0x1e')]=_0x578504;if(_0x2210bd[_0xf436('0x2d')][_0xf436('0x3a')]){_0x4e0f46[_0xf436('0x3b')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x4e0f46);})[_0xf436('0x22')](function(_0xdfe61f){_0x5ebdad[_0xf436('0x3c')]=_0xdfe61f;return _0x5ebdad;})[_0xf436('0x22')](respondWithFilteredResult(_0xe5b4d2,_0x4e0f46))['catch'](handleError(_0xe5b4d2,null));};exports[_0xf436('0x3d')]=function(_0x23c811,_0x56d2ba){var _0x18c0f5={'raw':![],'where':{'id':_0x23c811[_0xf436('0x3e')]['id']}},_0x28e077={};_0x28e077[_0xf436('0x2b')]=_[_0xf436('0x2e')](db[_0xf436('0x27')]['rawAttributes']);_0x28e077[_0xf436('0x2d')]=_[_0xf436('0x2e')](_0x23c811[_0xf436('0x2d')]);_0x28e077['filters']=_[_0xf436('0x2f')](_0x28e077['model'],_0x28e077[_0xf436('0x2d')]);_0x18c0f5[_0xf436('0x30')]=_[_0xf436('0x2f')](_0x28e077[_0xf436('0x2b')],qs[_0xf436('0x31')](_0x23c811[_0xf436('0x2d')][_0xf436('0x31')]));_0x18c0f5[_0xf436('0x30')]=_0x18c0f5[_0xf436('0x30')][_0xf436('0x32')]?_0x18c0f5[_0xf436('0x30')]:_0x28e077[_0xf436('0x2b')];if(_0x23c811[_0xf436('0x2d')]['includeAll']){_0x18c0f5[_0xf436('0x3b')]=[{'all':!![]}];}_0x18c0f5=_[_0xf436('0x38')]({},_0x18c0f5,_0x23c811[_0xf436('0x39')]);return db['SalesforceAccount'][_0xf436('0x3f')](_0x18c0f5)[_0xf436('0x22')](handleEntityNotFound(_0x56d2ba,null))[_0xf436('0x22')](respondWithResult(_0x56d2ba,null))['catch'](handleError(_0x56d2ba,null));};exports[_0xf436('0x40')]=function(_0x3739f0,_0x2abc22){return db[_0xf436('0x27')][_0xf436('0x40')](_0x3739f0[_0xf436('0x41')],{})[_0xf436('0x22')](respondWithResult(_0x2abc22,0xc9))[_0xf436('0x42')](handleError(_0x2abc22,null));};exports['update']=function(_0xa940e4,_0x37e4f8){if(_0xa940e4[_0xf436('0x41')]['id']){delete _0xa940e4[_0xf436('0x41')]['id'];}return db[_0xf436('0x27')]['find']({'where':{'id':_0xa940e4[_0xf436('0x3e')]['id']}})[_0xf436('0x22')](handleEntityNotFound(_0x37e4f8,null))[_0xf436('0x22')](saveUpdates(_0xa940e4['body'],null))[_0xf436('0x22')](respondWithResult(_0x37e4f8,null))[_0xf436('0x42')](handleError(_0x37e4f8,null));};exports[_0xf436('0x43')]=function(_0x203e9f,_0x5dedde){return db[_0xf436('0x27')][_0xf436('0x3f')]({'where':{'id':_0x203e9f['params']['id']}})[_0xf436('0x22')](handleEntityNotFound(_0x5dedde,null))['then'](removeEntity(_0x5dedde,null))[_0xf436('0x42')](handleError(_0x5dedde,null));};exports[_0xf436('0x44')]=function(_0x1aa928,_0x4e3dca,_0x3d7bec){var _0x5689d8={};var _0x49293f={};var _0x532fa0;var _0x27677e;return db[_0xf436('0x27')][_0xf436('0x45')]({'where':{'id':_0x1aa928[_0xf436('0x3e')]['id']}})[_0xf436('0x22')](handleEntityNotFound(_0x4e3dca,null))['then'](function(_0x39c4ea){if(_0x39c4ea){_0x532fa0=_0x39c4ea;_0x49293f[_0xf436('0x2b')]=_[_0xf436('0x2e')](db[_0xf436('0x46')][_0xf436('0x28')]);_0x49293f[_0xf436('0x2d')]=_['keys'](_0x1aa928[_0xf436('0x2d')]);_0x49293f['filters']=_[_0xf436('0x2f')](_0x49293f[_0xf436('0x2b')],_0x49293f[_0xf436('0x2d')]);_0x5689d8[_0xf436('0x30')]=_[_0xf436('0x2f')](_0x49293f[_0xf436('0x2b')],qs[_0xf436('0x31')](_0x1aa928[_0xf436('0x2d')]['fields']));_0x5689d8[_0xf436('0x30')]=_0x5689d8[_0xf436('0x30')][_0xf436('0x32')]?_0x5689d8[_0xf436('0x30')]:_0x49293f[_0xf436('0x2b')];_0x5689d8[_0xf436('0x33')]=qs['sort'](_0x1aa928[_0xf436('0x2d')][_0xf436('0x34')]);_0x5689d8[_0xf436('0x35')]=qs[_0xf436('0x47')](_[_0xf436('0x48')](_0x1aa928['query'],_0x49293f['filters']));if(_0x1aa928[_0xf436('0x2d')][_0xf436('0x36')]){_0x5689d8[_0xf436('0x35')]=_[_0xf436('0x38')](_0x5689d8[_0xf436('0x35')],{'$or':_[_0xf436('0x2c')](_0x5689d8[_0xf436('0x30')],function(_0x4434dd){var _0x561e9d={};_0x561e9d[_0x4434dd]={'$like':'%'+_0x1aa928[_0xf436('0x2d')][_0xf436('0x36')]+'%'};return _0x561e9d;})});}_0x5689d8=_[_0xf436('0x38')]({},_0x5689d8,_0x1aa928[_0xf436('0x39')]);return _0x532fa0[_0xf436('0x44')](_0x5689d8);}})[_0xf436('0x22')](function(_0xdb7a40){if(_0xdb7a40){_0x27677e=_0xdb7a40['length'];if(!_0x1aa928['query'][_0xf436('0x49')](_0xf436('0x4a'))){_0x5689d8[_0xf436('0x1d')]=qs[_0xf436('0x1d')](_0x1aa928[_0xf436('0x2d')]['limit']);_0x5689d8[_0xf436('0x1b')]=qs[_0xf436('0x1b')](_0x1aa928[_0xf436('0x2d')]['offset']);}return _0x532fa0['getConfigurations'](_0x5689d8);}})[_0xf436('0x22')](function(_0x4641d7){if(_0x4641d7){return _0x4641d7?{'count':_0x27677e,'rows':_0x4641d7}:null;}})['then'](respondWithResult(_0x4e3dca,null))[_0xf436('0x42')](handleError(_0x4e3dca,null));};exports[_0xf436('0x4b')]=function(_0x1703fc,_0x19087e,_0x31b3c7){if(_0x1703fc[_0xf436('0x41')]['id']){delete _0x1703fc[_0xf436('0x41')]['id'];}return db['SalesforceAccount'][_0xf436('0x45')]({'where':{'id':_0x1703fc[_0xf436('0x3e')]['id']}})[_0xf436('0x22')](handleEntityNotFound(_0x19087e,null))[_0xf436('0x22')](function(_0xbd0274){if(_0xbd0274){_0x1703fc[_0xf436('0x41')][_0xf436('0x4c')]=_0xbd0274['id'];_0x1703fc[_0xf436('0x41')][_0xf436('0x4d')]=integrations['getSubjects'](_0x1703fc[_0xf436('0x41')][_0xf436('0x4e')],_0x1703fc[_0xf436('0x41')][_0xf436('0x37')]);_0x1703fc[_0xf436('0x41')]['Descriptions']=integrations[_0xf436('0x4f')](_0x1703fc[_0xf436('0x41')][_0xf436('0x4e')],_0x1703fc[_0xf436('0x41')][_0xf436('0x37')]);return db[_0xf436('0x46')][_0xf436('0x40')](_0x1703fc[_0xf436('0x41')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0xf436('0x50')],'as':_0xf436('0x51')}]});}return null;})['then'](respondWithResult(_0x19087e,null))[_0xf436('0x42')](handleError(_0x19087e,null));};exports[_0xf436('0x52')]=function(_0x13142f,_0x149f39,_0x1f33e6){var _0x3fa9fc;var _0x3e20d9='';var _0x2b5bd2='Task';return db[_0xf436('0x27')]['findOne']({'where':{'id':_0x13142f[_0xf436('0x3e')]['id']},'attributes':['id',_0xf436('0x53'),_0xf436('0x54'),'clientSecret',_0xf436('0x55'),_0xf436('0x56'),'securityToken']})[_0xf436('0x22')](handleEntityNotFound(_0x149f39,null))['then'](function(_0x4bd6cf){if(_0x4bd6cf){_0x3e20d9=_0x4bd6cf['remoteUri'];var _0x5547f4=_0x3e20d9[_0xf436('0x57')](-0x1);if(_0x5547f4==='/'){_0x3e20d9=_0x3e20d9['substring'](0x0,_0x3e20d9[_0xf436('0x58')](_0x5547f4));}_0x3fa9fc=new jsforce[(_0xf436('0x59'))]({'oauth2':{'loginUrl':_0x3e20d9,'clientId':_0x4bd6cf[_0xf436('0x54')],'clientSecret':_0x4bd6cf[_0xf436('0x5a')]}});return _0x3fa9fc[_0xf436('0x5b')](_0x4bd6cf[_0xf436('0x55')],_0x4bd6cf['password'][_0xf436('0x5c')](_0x4bd6cf[_0xf436('0x5d')]));}})[_0xf436('0x22')](function(_0x18b698){if(_0x18b698){if(!_['isNil'](_0x13142f[_0xf436('0x2d')]['ticketType'])){_0x2b5bd2=_0x13142f[_0xf436('0x2d')]['ticketType'];}return _0x3fa9fc['sobject'](_0x2b5bd2)[_0xf436('0x5e')]();}})['then'](function(_0x5e43a5){var _0x399f00=[_0xf436('0x5f'),_0xf436('0x60'),_0xf436('0x61'),_0xf436('0x62'),_0xf436('0x63'),'Description'];var _0x3bed3f=[_0xf436('0x64'),'int',_0xf436('0x65'),_0xf436('0x66'),_0xf436('0x67'),_0xf436('0x68'),'phone'];if(_0x5e43a5){_[_0xf436('0x69')](_0x5e43a5[_0xf436('0x31')],function(_0x3dc1f3){return _0x399f00['includes'](_0x3dc1f3[_0xf436('0x25')])||!_0x3bed3f['includes'](_0x3dc1f3['type']);});return{'count':_0x5e43a5[_0xf436('0x31')][_0xf436('0x32')],'rows':_[_0xf436('0x2c')](_0x5e43a5['fields'],function(_0x457f3d){return{'id':_0x457f3d[_0xf436('0x25')],'name':_0x457f3d[_0xf436('0x6a')],'custom':_0x457f3d[_0xf436('0x6b')],'options':_0x457f3d[_0xf436('0x6c')][_0xf436('0x32')]>0x0?_[_0xf436('0x2c')](_0x457f3d[_0xf436('0x6c')],function(_0x480b7b){return{'name':_0x480b7b[_0xf436('0x6a')],'value':_0x480b7b[_0xf436('0x6d')]};}):_0x457f3d[_0xf436('0x37')]==_0xf436('0x66')?[{'name':_0xf436('0x6e'),'value':_0xf436('0x6f')},{'name':_0xf436('0x70'),'value':_0xf436('0x71')}]:[]};})};}})[_0xf436('0x22')](respondWithResult(_0x149f39,null))['catch'](function(_0x14e567){var _0x2b5695=_0x13142f[_0xf436('0x2d')][_0xf436('0x72')]?0x1f4:_0x14e567[_0xf436('0x73')]||0x1f4;logger[_0xf436('0x24')](_0xf436('0x74'),'getFields',_0x2b5695,JSON[_0xf436('0x75')](_0x14e567));delete _0x14e567[_0xf436('0x25')];if(_0x2b5695===0x191){_0x2b5695=0x190;}_0x149f39['status'](_0x2b5695)[_0xf436('0x26')](_0x13142f[_0xf436('0x2d')][_0xf436('0x72')]?{'message':_0xf436('0x76'),'statusCode':_0x14e567[_0xf436('0x73')]}:_0x14e567);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 678c0e6..da0437e 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 _0xa376=['exports','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa376,0x88));var _0x6a37=function(_0x1e9bec,_0x2c9986){_0x1e9bec=_0x1e9bec-0x0;var _0x51172e=_0xa376[_0x1e9bec];return _0x51172e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a37('0x0'))('api');var moment=require(_0x6a37('0x1'));var BPromise=require(_0x6a37('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6a37('0x3'));var config=require(_0x6a37('0x4'));var attributes=require(_0x6a37('0x5'));var integrations=require(_0x6a37('0x6'));module[_0x6a37('0x7')]=function(_0x58a562,_0x247887){return _0x58a562[_0x6a37('0x8')](_0x6a37('0x9'),attributes,{'tableName':_0x6a37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['util','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x340d75,_0x561cb0){var _0x3f1114=function(_0x2e2bcf){while(--_0x2e2bcf){_0x340d75['push'](_0x340d75['shift']());}};_0x3f1114(++_0x561cb0);}(_0xe14b,0xbf));var _0xbe14=function(_0x5ec193,_0x24ee84){_0x5ec193=_0x5ec193-0x0;var _0x1cb2c5=_0xe14b[_0x5ec193];return _0x1cb2c5;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require(_0xbe14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x5'));var rimraf=require(_0xbe14('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xbe14('0x7'));module[_0xbe14('0x8')]=function(_0x489cfb,_0x2e51eb){return _0x489cfb[_0xbe14('0x9')](_0xbe14('0xa'),attributes,{'tableName':_0xbe14('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4018247..c5360e7 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 _0x3936=['client','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56ca12,_0x1f679a){var _0x321a0c=function(_0xb582a2){while(--_0xb582a2){_0x56ca12['push'](_0x56ca12['shift']());}};_0x321a0c(++_0x1f679a);}(_0x3936,0x18c));var _0x6393=function(_0xb87d55,_0x578ce1){_0xb87d55=_0xb87d55-0x0;var _0x1c31c8=_0x3936[_0xb87d55];return _0x1c31c8;};'use strict';var _=require(_0x6393('0x0'));var util=require('util');var moment=require(_0x6393('0x1'));var BPromise=require(_0x6393('0x2'));var rs=require(_0x6393('0x3'));var fs=require('fs');var Redis=require(_0x6393('0x4'));var db=require(_0x6393('0x5'))['db'];var utils=require(_0x6393('0x6'));var logger=require(_0x6393('0x7'))(_0x6393('0x8'));var config=require(_0x6393('0x9'));var jayson=require(_0x6393('0xa'));var client=jayson[_0x6393('0xb')][_0x6393('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193d2f,_0x474e10,_0x94b4d5){return new BPromise(function(_0x17bd31,_0x5b369a){return client['request'](_0x193d2f,_0x94b4d5)[_0x6393('0xd')](function(_0x4448a9){logger[_0x6393('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x474e10,_0x6393('0xf'));logger[_0x6393('0x10')](_0x6393('0x11'),_0x474e10,_0x6393('0xf'),JSON[_0x6393('0x12')](_0x4448a9));if(_0x4448a9['error']){if(_0x4448a9[_0x6393('0x13')][_0x6393('0x14')]===0x1f4){logger[_0x6393('0x13')](_0x6393('0x15'),_0x474e10,_0x4448a9[_0x6393('0x13')]['message']);return _0x5b369a(_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);}logger[_0x6393('0x13')](_0x6393('0x15'),_0x474e10,_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);return _0x17bd31(_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);}else{logger[_0x6393('0xe')](_0x6393('0x15'),_0x474e10,_0x6393('0xf'));_0x17bd31(_0x4448a9[_0x6393('0x17')]['message']);}})[_0x6393('0x18')](function(_0x3652cf){logger[_0x6393('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x474e10,_0x3652cf);_0x5b369a(_0x3652cf);});});}exports[_0x6393('0x19')]=function(_0x273374){var _0x48573b=this;return new Promise(function(_0x499870,_0x3e3fa5){return db['SalesforceAccount'][_0x6393('0x1a')]({'raw':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')][_0x6393('0x1c')]===undefined?!![]:![]:!![],'where':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')][_0x6393('0x1d')]||null:null,'attributes':_0x273374['options']?_0x273374[_0x6393('0x1b')][_0x6393('0x1e')]||null:null,'limit':_0x273374[_0x6393('0x1b')]?_0x273374['options'][_0x6393('0x1f')]||null:null,'include':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')]['include']?_[_0x6393('0x20')](_0x273374[_0x6393('0x1b')][_0x6393('0x21')],function(_0x46635b){return{'model':db[_0x46635b['model']],'as':_0x46635b['as'],'attributes':_0x46635b[_0x6393('0x1e')],'include':_0x46635b['include']?_[_0x6393('0x20')](_0x46635b[_0x6393('0x21')],function(_0x3d72ae){return{'model':db[_0x3d72ae['model']],'as':_0x3d72ae['as'],'attributes':_0x3d72ae[_0x6393('0x1e')],'include':_0x3d72ae[_0x6393('0x21')]?_[_0x6393('0x20')](_0x3d72ae[_0x6393('0x21')],function(_0x46e193){return{'model':db[_0x46e193[_0x6393('0x22')]],'as':_0x46e193['as'],'attributes':_0x46e193[_0x6393('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6393('0xd')](function(_0x470eb4){logger[_0x6393('0xe')](_0x6393('0x19'),_0x273374);logger[_0x6393('0x10')](_0x6393('0x19'),_0x273374,JSON[_0x6393('0x12')](_0x470eb4));_0x499870(_0x470eb4);})[_0x6393('0x18')](function(_0x3b2c32){logger[_0x6393('0x13')](_0x6393('0x19'),_0x3b2c32['message'],_0x273374);_0x3e3fa5(_0x48573b['error'](0x1f4,_0x3b2c32[_0x6393('0x16')]));});});};exports[_0x6393('0x23')]=function(_0x4e0b33){var _0x439acf=this;return new Promise(function(_0x28fce7,_0x8fc2d2){return db['SalesforceAccount'][_0x6393('0x24')]({'raw':_0x4e0b33['options']?_0x4e0b33['options'][_0x6393('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33['options']['where']||null:null,'attributes':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33[_0x6393('0x1b')][_0x6393('0x1e')]||null:null,'include':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33[_0x6393('0x1b')][_0x6393('0x21')]?_['map'](_0x4e0b33[_0x6393('0x1b')][_0x6393('0x21')],function(_0xd04497){return{'model':db[_0xd04497[_0x6393('0x22')]],'as':_0xd04497['as'],'attributes':_0xd04497[_0x6393('0x1e')],'include':_0xd04497['include']?_[_0x6393('0x20')](_0xd04497['include'],function(_0x1b2041){return{'model':db[_0x1b2041['model']],'as':_0x1b2041['as'],'attributes':_0x1b2041['attributes'],'include':_0x1b2041[_0x6393('0x21')]?_[_0x6393('0x20')](_0x1b2041[_0x6393('0x21')],function(_0x5a1821){return{'model':db[_0x5a1821['model']],'as':_0x5a1821['as'],'attributes':_0x5a1821['attributes']};}):[]};}):[]};}):[]:[]})[_0x6393('0xd')](function(_0x2b1fc5){logger[_0x6393('0xe')]('ShowSalesforceAccount',_0x4e0b33);logger[_0x6393('0x10')]('ShowSalesforceAccount',_0x4e0b33,JSON['stringify'](_0x2b1fc5));_0x28fce7(_0x2b1fc5);})[_0x6393('0x18')](function(_0x291709){logger['error']('ShowSalesforceAccount',_0x291709[_0x6393('0x16')],_0x4e0b33);_0x8fc2d2(_0x439acf[_0x6393('0x13')](0x1f4,_0x291709[_0x6393('0x16')]));});});}; \ No newline at end of file +var _0x77d6=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SalesforceAccount,\x20%s,\x20%s','message','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','moment','bluebird'];(function(_0xb25437,_0x5b1b42){var _0x105ba2=function(_0x2c9873){while(--_0x2c9873){_0xb25437['push'](_0xb25437['shift']());}};_0x105ba2(++_0x5b1b42);}(_0x77d6,0x17f));var _0x677d=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x77d6[_0x56ba92];return _0x8fe94d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x677d('0x0'));var BPromise=require(_0x677d('0x1'));var rs=require(_0x677d('0x2'));var fs=require('fs');var Redis=require(_0x677d('0x3'));var db=require(_0x677d('0x4'))['db'];var utils=require(_0x677d('0x5'));var logger=require('../../config/logger')(_0x677d('0x6'));var config=require(_0x677d('0x7'));var jayson=require(_0x677d('0x8'));var client=jayson[_0x677d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ceb1,_0x1e888f,_0x50e45b){return new BPromise(function(_0x11bdf3,_0x1d73d9){return client[_0x677d('0xa')](_0x30ceb1,_0x50e45b)[_0x677d('0xb')](function(_0x5b42b5){logger[_0x677d('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x1e888f,_0x677d('0xd'));logger[_0x677d('0xe')](_0x677d('0xf'),_0x1e888f,'request\x20sent',JSON[_0x677d('0x10')](_0x5b42b5));if(_0x5b42b5['error']){if(_0x5b42b5['error'][_0x677d('0x11')]===0x1f4){logger[_0x677d('0x12')](_0x677d('0x13'),_0x1e888f,_0x5b42b5['error'][_0x677d('0x14')]);return _0x1d73d9(_0x5b42b5[_0x677d('0x12')][_0x677d('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1e888f,_0x5b42b5[_0x677d('0x12')]['message']);return _0x11bdf3(_0x5b42b5['error'][_0x677d('0x14')]);}else{logger[_0x677d('0xc')](_0x677d('0x13'),_0x1e888f,_0x677d('0xd'));_0x11bdf3(_0x5b42b5['result'][_0x677d('0x14')]);}})[_0x677d('0x15')](function(_0x1e0d9a){logger[_0x677d('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x1e888f,_0x1e0d9a);_0x1d73d9(_0x1e0d9a);});});}exports[_0x677d('0x16')]=function(_0x1ca474){var _0x26ee74=this;return new Promise(function(_0x3c54c4,_0x1616e8){return db['SalesforceAccount'][_0x677d('0x17')]({'raw':_0x1ca474[_0x677d('0x18')]?_0x1ca474[_0x677d('0x18')][_0x677d('0x19')]===undefined?!![]:![]:!![],'where':_0x1ca474['options']?_0x1ca474[_0x677d('0x18')][_0x677d('0x1a')]||null:null,'attributes':_0x1ca474[_0x677d('0x18')]?_0x1ca474[_0x677d('0x18')][_0x677d('0x1b')]||null:null,'limit':_0x1ca474['options']?_0x1ca474[_0x677d('0x18')][_0x677d('0x1c')]||null:null,'include':_0x1ca474[_0x677d('0x18')]?_0x1ca474[_0x677d('0x18')][_0x677d('0x1d')]?_[_0x677d('0x1e')](_0x1ca474[_0x677d('0x18')][_0x677d('0x1d')],function(_0x184d37){return{'model':db[_0x184d37[_0x677d('0x1f')]],'as':_0x184d37['as'],'attributes':_0x184d37[_0x677d('0x1b')],'include':_0x184d37[_0x677d('0x1d')]?_[_0x677d('0x1e')](_0x184d37[_0x677d('0x1d')],function(_0x4da507){return{'model':db[_0x4da507[_0x677d('0x1f')]],'as':_0x4da507['as'],'attributes':_0x4da507[_0x677d('0x1b')],'include':_0x4da507[_0x677d('0x1d')]?_[_0x677d('0x1e')](_0x4da507['include'],function(_0x23ffce){return{'model':db[_0x23ffce['model']],'as':_0x23ffce['as'],'attributes':_0x23ffce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e2eb7){logger[_0x677d('0xc')](_0x677d('0x16'),_0x1ca474);logger[_0x677d('0xe')]('GetSalesforceAccount',_0x1ca474,JSON['stringify'](_0x5e2eb7));_0x3c54c4(_0x5e2eb7);})['catch'](function(_0x62e060){logger['error'](_0x677d('0x16'),_0x62e060['message'],_0x1ca474);_0x1616e8(_0x26ee74[_0x677d('0x12')](0x1f4,_0x62e060[_0x677d('0x14')]));});});};exports[_0x677d('0x20')]=function(_0x3e8674){var _0x3f3a1e=this;return new Promise(function(_0x28174e,_0x366ab0){return db[_0x677d('0x21')][_0x677d('0x22')]({'raw':_0x3e8674['options']?_0x3e8674[_0x677d('0x18')][_0x677d('0x19')]===undefined?!![]:![]:!![],'where':_0x3e8674[_0x677d('0x18')]?_0x3e8674['options'][_0x677d('0x1a')]||null:null,'attributes':_0x3e8674['options']?_0x3e8674[_0x677d('0x18')]['attributes']||null:null,'include':_0x3e8674[_0x677d('0x18')]?_0x3e8674[_0x677d('0x18')]['include']?_[_0x677d('0x1e')](_0x3e8674[_0x677d('0x18')][_0x677d('0x1d')],function(_0x12e81d){return{'model':db[_0x12e81d[_0x677d('0x1f')]],'as':_0x12e81d['as'],'attributes':_0x12e81d[_0x677d('0x1b')],'include':_0x12e81d[_0x677d('0x1d')]?_[_0x677d('0x1e')](_0x12e81d[_0x677d('0x1d')],function(_0x113f36){return{'model':db[_0x113f36['model']],'as':_0x113f36['as'],'attributes':_0x113f36[_0x677d('0x1b')],'include':_0x113f36[_0x677d('0x1d')]?_[_0x677d('0x1e')](_0x113f36[_0x677d('0x1d')],function(_0x314a35){return{'model':db[_0x314a35[_0x677d('0x1f')]],'as':_0x314a35['as'],'attributes':_0x314a35['attributes']};}):[]};}):[]};}):[]:[]})[_0x677d('0xb')](function(_0x38650d){logger[_0x677d('0xc')](_0x677d('0x20'),_0x3e8674);logger[_0x677d('0xe')](_0x677d('0x20'),_0x3e8674,JSON[_0x677d('0x10')](_0x38650d));_0x28174e(_0x38650d);})[_0x677d('0x15')](function(_0x56ab43){logger[_0x677d('0x12')](_0x677d('0x20'),_0x56ab43[_0x677d('0x14')],_0x3e8674);_0x366ab0(_0x3f3a1e[_0x677d('0x12')](0x1f4,_0x56ab43[_0x677d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0dff2ec..fc6fc2e 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x4c5f15,_0x5e5bed){var _0x4aa336=function(_0x46129f){while(--_0x46129f){_0x4c5f15['push'](_0x4c5f15['shift']());}};_0x4aa336(++_0x5e5bed);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3c0dcc,_0x18c419){_0x3c0dcc=_0x3c0dcc-0x0;var _0x1a224c=_0x0b0e[_0x3c0dcc];return _0x1a224c;};'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 3cd1edd..dbed2df 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 _0x4747=['lead','sequelize','STRING','ENUM','Task','contact_lead','contact','account_contact_lead','account','nothing'];(function(_0x3b5c4f,_0x3f20c5){var _0x258626=function(_0x373a58){while(--_0x373a58){_0x3b5c4f['push'](_0x3b5c4f['shift']());}};_0x258626(++_0x3f20c5);}(_0x4747,0xc9));var _0x7474=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0x4747[_0x4289ed];return _0x2f5317;};'use strict';var Sequelize=require(_0x7474('0x0'));module['exports']={'name':{'type':Sequelize[_0x7474('0x1')]},'description':{'type':Sequelize[_0x7474('0x1')]},'ticketType':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x3'),'Case'),'defaultValue':_0x7474('0x3')},'moduleSearch':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x4'),_0x7474('0x5'),'lead',_0x7474('0x6'),_0x7474('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x8'),_0x7474('0x5'),_0x7474('0x9'),_0x7474('0x7')),'defaultValue':_0x7474('0x9')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x7474('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x7474('0x1')]}}; \ No newline at end of file +var _0xf642=['ENUM','contact_lead','contact','lead','account_contact_lead','account','nothing','STRING','sequelize','exports','Task','Case'];(function(_0x6e1bb0,_0x20a43e){var _0x469e2c=function(_0x2ca5db){while(--_0x2ca5db){_0x6e1bb0['push'](_0x6e1bb0['shift']());}};_0x469e2c(++_0x20a43e);}(_0xf642,0xbc));var _0x2f64=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xf642[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0x2f64('0x0'));module[_0x2f64('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x2f64('0x2'),_0x2f64('0x3')),'defaultValue':_0x2f64('0x2')},'moduleSearch':{'type':Sequelize[_0x2f64('0x4')](_0x2f64('0x5'),_0x2f64('0x6'),_0x2f64('0x7'),_0x2f64('0x8'),_0x2f64('0x9')),'defaultValue':_0x2f64('0x5')},'moduleCreate':{'type':Sequelize[_0x2f64('0x4')](_0x2f64('0xa'),_0x2f64('0x6'),_0x2f64('0x7'),'account'),'defaultValue':_0x2f64('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x2f64('0xb')]},'additionalSearchContact':{'type':Sequelize[_0x2f64('0xb')]},'additionalSearchLead':{'type':Sequelize[_0x2f64('0xb')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 66df05a..1d7fafa 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 _0x40fa=['VIRTUAL','filter','options','include','findAll','then','catch','show','params','includeAll','create','body','find','getFields','nolimit','getSubjects','SalesforceField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','error','name','send','SalesforceConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x40fa,0x194));var _0xa40f=function(_0x40e126,_0x53b489){_0x40e126=_0x40e126-0x0;var _0x42ff66=_0x40fa[_0x40e126];return _0x42ff66;};'use strict';var emlformat=require(_0xa40f('0x0'));var rimraf=require(_0xa40f('0x1'));var zipdir=require(_0xa40f('0x2'));var jsonpatch=require(_0xa40f('0x3'));var rp=require(_0xa40f('0x4'));var moment=require('moment');var BPromise=require(_0xa40f('0x5'));var Mustache=require(_0xa40f('0x6'));var util=require('util');var path=require(_0xa40f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa40f('0x8'));var fs=require('fs');var fs_extra=require(_0xa40f('0x9'));var _=require(_0xa40f('0xa'));var squel=require(_0xa40f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa40f('0xc'));var deskjs=require(_0xa40f('0xd'));var toCsv=require(_0xa40f('0xe'));var querystring=require('querystring');var Papa=require(_0xa40f('0xf'));var Redis=require(_0xa40f('0x10'));var authService=require(_0xa40f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa40f('0x12'));var hardwareService=require(_0xa40f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa40f('0x14'));var licenseUtil=require(_0xa40f('0x15'));var db=require(_0xa40f('0x16'))['db'];function respondWithStatusCode(_0x147aff,_0x3a5379){_0x3a5379=_0x3a5379||0xcc;return function(_0x14e792){if(_0x14e792){return _0x147aff[_0xa40f('0x17')](_0x3a5379);}return _0x147aff[_0xa40f('0x18')](_0x3a5379)[_0xa40f('0x19')]();};}function respondWithResult(_0x3bf431,_0x5852c8){_0x5852c8=_0x5852c8||0xc8;return function(_0x46767e){if(_0x46767e){return _0x3bf431[_0xa40f('0x18')](_0x5852c8)[_0xa40f('0x1a')](_0x46767e);}};}function respondWithFilteredResult(_0x5629a7,_0xea7c33){return function(_0x4105c9){if(_0x4105c9){var _0x19f007=typeof _0xea7c33['offset']===_0xa40f('0x1b')&&typeof _0xea7c33[_0xa40f('0x1c')]==='undefined';var _0x352760=_0x4105c9[_0xa40f('0x1d')];var _0xfe8c6=_0x19f007?0x0:_0xea7c33[_0xa40f('0x1e')];var _0x40d94a=_0x19f007?_0x4105c9[_0xa40f('0x1d')]:_0xea7c33['offset']+_0xea7c33[_0xa40f('0x1c')];var _0x4da313;if(_0x40d94a>=_0x352760){_0x40d94a=_0x352760;_0x4da313=0xc8;}else{_0x4da313=0xce;}_0x5629a7['status'](_0x4da313);return _0x5629a7[_0xa40f('0x1f')](_0xa40f('0x20'),_0xfe8c6+'-'+_0x40d94a+'/'+_0x352760)['json'](_0x4105c9);}return null;};}function patchUpdates(_0x3046d6){return function(_0x1a4117){try{jsonpatch[_0xa40f('0x21')](_0x1a4117,_0x3046d6,!![]);}catch(_0x3efd52){return BPromise['reject'](_0x3efd52);}return _0x1a4117[_0xa40f('0x22')]();};}function saveUpdates(_0x422588,_0x15e583){return function(_0x1f68b5){if(_0x1f68b5){return _0x1f68b5[_0xa40f('0x23')](_0x422588)['then'](function(_0x23839e){return _0x23839e;});}return null;};}function removeEntity(_0x328ab4,_0x2aa915){return function(_0x15c6ca){if(_0x15c6ca){return _0x15c6ca[_0xa40f('0x24')]()['then'](function(){_0x328ab4[_0xa40f('0x18')](0xcc)[_0xa40f('0x19')]();});}};}function handleEntityNotFound(_0x5c0851,_0x305fb4){return function(_0x1cf7b8){if(!_0x1cf7b8){_0x5c0851[_0xa40f('0x17')](0x194);}return _0x1cf7b8;};}function handleError(_0xbb2e6e,_0x10473e){_0x10473e=_0x10473e||0x1f4;return function(_0x53e467){logger[_0xa40f('0x25')](_0x53e467['stack']);if(_0x53e467[_0xa40f('0x26')]){delete _0x53e467[_0xa40f('0x26')];}_0xbb2e6e[_0xa40f('0x18')](_0x10473e)[_0xa40f('0x27')](_0x53e467);};}exports['index']=function(_0x27714d,_0x48dbfe){var _0x28ffe2={},_0x1d17c3={},_0x17c67b={'count':0x0,'rows':[]};var _0x5a9e56=_['map'](db[_0xa40f('0x28')][_0xa40f('0x29')],function(_0x378fd6){return{'name':_0x378fd6['fieldName'],'type':_0x378fd6[_0xa40f('0x2a')][_0xa40f('0x2b')]};});_0x1d17c3[_0xa40f('0x2c')]=_[_0xa40f('0x2d')](_0x5a9e56,_0xa40f('0x26'));_0x1d17c3[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x27714d[_0xa40f('0x2e')]);_0x1d17c3[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x1d17c3[_0xa40f('0x2c')],_0x1d17c3[_0xa40f('0x2e')]);_0x28ffe2[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x1d17c3[_0xa40f('0x2c')],qs[_0xa40f('0x33')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x28ffe2[_0xa40f('0x32')]=_0x28ffe2[_0xa40f('0x32')][_0xa40f('0x34')]?_0x28ffe2[_0xa40f('0x32')]:_0x1d17c3[_0xa40f('0x2c')];if(!_0x27714d[_0xa40f('0x2e')][_0xa40f('0x35')]('nolimit')){_0x28ffe2['limit']=qs[_0xa40f('0x1c')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x1c')]);_0x28ffe2[_0xa40f('0x1e')]=qs['offset'](_0x27714d[_0xa40f('0x2e')]['offset']);}_0x28ffe2[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x28ffe2[_0xa40f('0x38')]=qs[_0xa40f('0x30')](_['pick'](_0x27714d[_0xa40f('0x2e')],_0x1d17c3[_0xa40f('0x30')]),_0x5a9e56);if(_0x27714d['query']['filter']){_0x28ffe2[_0xa40f('0x38')]=_[_0xa40f('0x39')](_0x28ffe2[_0xa40f('0x38')],{'$or':_[_0xa40f('0x2d')](_0x5a9e56,function(_0x3c48f0){if(_0x3c48f0[_0xa40f('0x2a')]!==_0xa40f('0x3a')){var _0x75d414={};_0x75d414[_0x3c48f0[_0xa40f('0x26')]]={'$like':'%'+_0x27714d[_0xa40f('0x2e')][_0xa40f('0x3b')]+'%'};return _0x75d414;}})});}_0x28ffe2=_['merge']({},_0x28ffe2,_0x27714d[_0xa40f('0x3c')]);var _0x2ff1d3={'where':_0x28ffe2['where']};return db['SalesforceConfiguration'][_0xa40f('0x1d')](_0x2ff1d3)['then'](function(_0x2efd52){_0x17c67b[_0xa40f('0x1d')]=_0x2efd52;if(_0x27714d[_0xa40f('0x2e')]['includeAll']){_0x28ffe2[_0xa40f('0x3d')]=[{'all':!![]}];}return db[_0xa40f('0x28')][_0xa40f('0x3e')](_0x28ffe2);})[_0xa40f('0x3f')](function(_0x334b34){_0x17c67b['rows']=_0x334b34;return _0x17c67b;})['then'](respondWithFilteredResult(_0x48dbfe,_0x28ffe2))[_0xa40f('0x40')](handleError(_0x48dbfe,null));};exports[_0xa40f('0x41')]=function(_0x562a25,_0x164d5a){var _0x3d0ae1={'raw':![],'where':{'id':_0x562a25[_0xa40f('0x42')]['id']}},_0x222720={};_0x222720[_0xa40f('0x2c')]=_['keys'](db[_0xa40f('0x28')][_0xa40f('0x29')]);_0x222720[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x562a25['query']);_0x222720[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x222720['model'],_0x222720[_0xa40f('0x2e')]);_0x3d0ae1['attributes']=_[_0xa40f('0x31')](_0x222720[_0xa40f('0x2c')],qs['fields'](_0x562a25[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x3d0ae1['attributes']=_0x3d0ae1[_0xa40f('0x32')]['length']?_0x3d0ae1['attributes']:_0x222720[_0xa40f('0x2c')];if(_0x562a25[_0xa40f('0x2e')][_0xa40f('0x43')]){_0x3d0ae1[_0xa40f('0x3d')]=[{'all':!![]}];}_0x3d0ae1=_[_0xa40f('0x39')]({},_0x3d0ae1,_0x562a25[_0xa40f('0x3c')]);return db[_0xa40f('0x28')]['find'](_0x3d0ae1)[_0xa40f('0x3f')](handleEntityNotFound(_0x164d5a,null))[_0xa40f('0x3f')](respondWithResult(_0x164d5a,null))[_0xa40f('0x40')](handleError(_0x164d5a,null));};exports[_0xa40f('0x44')]=function(_0x2fa522,_0x96eeca){return db['SalesforceConfiguration'][_0xa40f('0x44')](_0x2fa522[_0xa40f('0x45')],{})[_0xa40f('0x3f')](respondWithResult(_0x96eeca,0xc9))['catch'](handleError(_0x96eeca,null));};exports[_0xa40f('0x23')]=function(_0x310e04,_0x4861f9){if(_0x310e04[_0xa40f('0x45')]['id']){delete _0x310e04[_0xa40f('0x45')]['id'];}return db[_0xa40f('0x28')]['find']({'where':{'id':_0x310e04['params']['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x4861f9,null))[_0xa40f('0x3f')](saveUpdates(_0x310e04[_0xa40f('0x45')],null))[_0xa40f('0x3f')](respondWithResult(_0x4861f9,null))[_0xa40f('0x40')](handleError(_0x4861f9,null));};exports[_0xa40f('0x24')]=function(_0x3396e8,_0x146773){return db[_0xa40f('0x28')][_0xa40f('0x46')]({'where':{'id':_0x3396e8[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x146773,null))[_0xa40f('0x3f')](removeEntity(_0x146773,null))[_0xa40f('0x40')](handleError(_0x146773,null));};exports[_0xa40f('0x47')]=function(_0x297c1a,_0x4ddf5c,_0x416fcf){var _0x4e3914={};var _0x5e1d21={};var _0x1a9681;var _0x438407;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x297c1a[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x4ddf5c,null))['then'](function(_0x5352a3){if(_0x5352a3){_0x1a9681=_0x5352a3;_0x5e1d21['model']=_[_0xa40f('0x2f')](db['SalesforceField']['rawAttributes']);_0x5e1d21['query']=_[_0xa40f('0x2f')](_0x297c1a[_0xa40f('0x2e')]);_0x5e1d21['filters']=_[_0xa40f('0x31')](_0x5e1d21[_0xa40f('0x2c')],_0x5e1d21[_0xa40f('0x2e')]);_0x4e3914[_0xa40f('0x32')]=_['intersection'](_0x5e1d21[_0xa40f('0x2c')],qs[_0xa40f('0x33')](_0x297c1a['query'][_0xa40f('0x33')]));_0x4e3914['attributes']=_0x4e3914['attributes'][_0xa40f('0x34')]?_0x4e3914[_0xa40f('0x32')]:_0x5e1d21['model'];_0x4e3914[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x4e3914[_0xa40f('0x38')]=qs[_0xa40f('0x30')](_['pick'](_0x297c1a[_0xa40f('0x2e')],_0x5e1d21['filters']));if(_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x3b')]){_0x4e3914['where']=_[_0xa40f('0x39')](_0x4e3914[_0xa40f('0x38')],{'$or':_['map'](_0x4e3914[_0xa40f('0x32')],function(_0x3f1e6c){var _0x5d0e74={};_0x5d0e74[_0x3f1e6c]={'$like':'%'+_0x297c1a['query'][_0xa40f('0x3b')]+'%'};return _0x5d0e74;})});}_0x4e3914=_[_0xa40f('0x39')]({},_0x4e3914,_0x297c1a[_0xa40f('0x3c')]);return _0x1a9681[_0xa40f('0x47')](_0x4e3914);}})[_0xa40f('0x3f')](function(_0x4cec24){if(_0x4cec24){_0x438407=_0x4cec24[_0xa40f('0x34')];if(!_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x35')](_0xa40f('0x48'))){_0x4e3914[_0xa40f('0x1c')]=qs['limit'](_0x297c1a['query'][_0xa40f('0x1c')]);_0x4e3914[_0xa40f('0x1e')]=qs[_0xa40f('0x1e')](_0x297c1a[_0xa40f('0x2e')]['offset']);}return _0x1a9681['getFields'](_0x4e3914);}})[_0xa40f('0x3f')](function(_0x332456){if(_0x332456){return _0x332456?{'count':_0x438407,'rows':_0x332456}:null;}})['then'](respondWithResult(_0x4ddf5c,null))[_0xa40f('0x40')](handleError(_0x4ddf5c,null));};exports[_0xa40f('0x49')]=function(_0x2e4346,_0x3cc5df,_0x16009c){var _0x42b948={};var _0x4f16e4={};var _0x4f1695;var _0x5ea5bf;return db[_0xa40f('0x28')]['findOne']({'where':{'id':_0x2e4346['params']['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x3cc5df,null))['then'](function(_0x1dd20d){if(_0x1dd20d){_0x4f1695=_0x1dd20d;_0x4f16e4[_0xa40f('0x2c')]=_[_0xa40f('0x2f')](db[_0xa40f('0x4a')][_0xa40f('0x29')]);_0x4f16e4[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x2e4346['query']);_0x4f16e4[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x4f16e4[_0xa40f('0x2c')],_0x4f16e4[_0xa40f('0x2e')]);_0x42b948[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x4f16e4[_0xa40f('0x2c')],qs['fields'](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x42b948[_0xa40f('0x32')]=_0x42b948[_0xa40f('0x32')][_0xa40f('0x34')]?_0x42b948[_0xa40f('0x32')]:_0x4f16e4[_0xa40f('0x2c')];_0x42b948[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x42b948[_0xa40f('0x38')]=qs['filters'](_[_0xa40f('0x4b')](_0x2e4346[_0xa40f('0x2e')],_0x4f16e4[_0xa40f('0x30')]));if(_0x2e4346['query'][_0xa40f('0x3b')]){_0x42b948[_0xa40f('0x38')]=_['merge'](_0x42b948[_0xa40f('0x38')],{'$or':_[_0xa40f('0x2d')](_0x42b948[_0xa40f('0x32')],function(_0x3785b4){var _0x21187d={};_0x21187d[_0x3785b4]={'$like':'%'+_0x2e4346['query']['filter']+'%'};return _0x21187d;})});}_0x42b948=_[_0xa40f('0x39')]({},_0x42b948,_0x2e4346['options']);return _0x4f1695['getSubjects'](_0x42b948);}})['then'](function(_0x3e900c){if(_0x3e900c){_0x5ea5bf=_0x3e900c[_0xa40f('0x34')];if(!_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x35')](_0xa40f('0x48'))){_0x42b948[_0xa40f('0x1c')]=qs['limit'](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x1c')]);_0x42b948['offset']=qs[_0xa40f('0x1e')](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x1e')]);}return _0x4f1695['getSubjects'](_0x42b948);}})[_0xa40f('0x3f')](function(_0xaf44cf){if(_0xaf44cf){return _0xaf44cf?{'count':_0x5ea5bf,'rows':_0xaf44cf}:null;}})['then'](respondWithResult(_0x3cc5df,null))[_0xa40f('0x40')](handleError(_0x3cc5df,null));};exports[_0xa40f('0x4c')]=function(_0xb39e79,_0x312b45,_0x39b0df){var _0x227622={};var _0x581b4c={};var _0x129725;var _0x597435;return db[_0xa40f('0x28')]['findOne']({'where':{'id':_0xb39e79[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x312b45,null))[_0xa40f('0x3f')](function(_0x5a21b5){if(_0x5a21b5){_0x129725=_0x5a21b5;_0x581b4c[_0xa40f('0x2c')]=_[_0xa40f('0x2f')](db[_0xa40f('0x4a')][_0xa40f('0x29')]);_0x581b4c[_0xa40f('0x2e')]=_['keys'](_0xb39e79[_0xa40f('0x2e')]);_0x581b4c[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x581b4c[_0xa40f('0x2c')],_0x581b4c[_0xa40f('0x2e')]);_0x227622[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x581b4c['model'],qs[_0xa40f('0x33')](_0xb39e79['query']['fields']));_0x227622['attributes']=_0x227622['attributes'][_0xa40f('0x34')]?_0x227622[_0xa40f('0x32')]:_0x581b4c[_0xa40f('0x2c')];_0x227622[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0xb39e79['query']['sort']);_0x227622['where']=qs[_0xa40f('0x30')](_[_0xa40f('0x4b')](_0xb39e79[_0xa40f('0x2e')],_0x581b4c[_0xa40f('0x30')]));if(_0xb39e79[_0xa40f('0x2e')]['filter']){_0x227622[_0xa40f('0x38')]=_[_0xa40f('0x39')](_0x227622['where'],{'$or':_[_0xa40f('0x2d')](_0x227622['attributes'],function(_0x4a65bb){var _0x3e3697={};_0x3e3697[_0x4a65bb]={'$like':'%'+_0xb39e79[_0xa40f('0x2e')]['filter']+'%'};return _0x3e3697;})});}_0x227622=_[_0xa40f('0x39')]({},_0x227622,_0xb39e79['options']);return _0x129725[_0xa40f('0x4c')](_0x227622);}})[_0xa40f('0x3f')](function(_0x4c7306){if(_0x4c7306){_0x597435=_0x4c7306['length'];if(!_0xb39e79[_0xa40f('0x2e')]['hasOwnProperty'](_0xa40f('0x48'))){_0x227622[_0xa40f('0x1c')]=qs['limit'](_0xb39e79[_0xa40f('0x2e')]['limit']);_0x227622[_0xa40f('0x1e')]=qs[_0xa40f('0x1e')](_0xb39e79[_0xa40f('0x2e')][_0xa40f('0x1e')]);}return _0x129725[_0xa40f('0x4c')](_0x227622);}})[_0xa40f('0x3f')](function(_0x1bd047){if(_0x1bd047){return _0x1bd047?{'count':_0x597435,'rows':_0x1bd047}:null;}})[_0xa40f('0x3f')](respondWithResult(_0x312b45,null))[_0xa40f('0x40')](handleError(_0x312b45,null));}; \ No newline at end of file +var _0x8ae8=['model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','fields','find','create','body','params','findOne','SalesforceField','sort','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','undefined','limit','count','offset','Content-Range','apply','update','destroy','then','end','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x8ae8,0x163));var _0x88ae=function(_0x11d684,_0x4d4123){_0x11d684=_0x11d684-0x0;var _0x78a301=_0x8ae8[_0x11d684];return _0x78a301;};'use strict';var emlformat=require(_0x88ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ae('0x1'));var jsonpatch=require(_0x88ae('0x2'));var rp=require(_0x88ae('0x3'));var moment=require(_0x88ae('0x4'));var BPromise=require(_0x88ae('0x5'));var Mustache=require(_0x88ae('0x6'));var util=require(_0x88ae('0x7'));var path=require(_0x88ae('0x8'));var sox=require('sox');var csv=require(_0x88ae('0x9'));var ejs=require(_0x88ae('0xa'));var fs=require('fs');var fs_extra=require(_0x88ae('0xb'));var _=require(_0x88ae('0xc'));var squel=require(_0x88ae('0xd'));var crypto=require('crypto');var jsforce=require(_0x88ae('0xe'));var deskjs=require(_0x88ae('0xf'));var toCsv=require(_0x88ae('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x88ae('0x10'));var authService=require(_0x88ae('0x11'));var qs=require(_0x88ae('0x12'));var as=require(_0x88ae('0x13'));var hardwareService=require(_0x88ae('0x14'));var logger=require(_0x88ae('0x15'))(_0x88ae('0x16'));var utils=require('../../config/utils');var config=require(_0x88ae('0x17'));var licenseUtil=require(_0x88ae('0x18'));var db=require(_0x88ae('0x19'))['db'];function respondWithStatusCode(_0x2488e1,_0x8c98db){_0x8c98db=_0x8c98db||0xcc;return function(_0x3cafbc){if(_0x3cafbc){return _0x2488e1[_0x88ae('0x1a')](_0x8c98db);}return _0x2488e1['status'](_0x8c98db)['end']();};}function respondWithResult(_0x3ba575,_0x4adcd4){_0x4adcd4=_0x4adcd4||0xc8;return function(_0x5b6840){if(_0x5b6840){return _0x3ba575[_0x88ae('0x1b')](_0x4adcd4)[_0x88ae('0x1c')](_0x5b6840);}};}function respondWithFilteredResult(_0xd5dc86,_0x281fba){return function(_0x2ac4f6){if(_0x2ac4f6){var _0x3c3e1e=typeof _0x281fba['offset']===_0x88ae('0x1d')&&typeof _0x281fba[_0x88ae('0x1e')]===_0x88ae('0x1d');var _0x5af0f3=_0x2ac4f6[_0x88ae('0x1f')];var _0x15806e=_0x3c3e1e?0x0:_0x281fba[_0x88ae('0x20')];var _0x2c800e=_0x3c3e1e?_0x2ac4f6[_0x88ae('0x1f')]:_0x281fba[_0x88ae('0x20')]+_0x281fba[_0x88ae('0x1e')];var _0x1a6de1;if(_0x2c800e>=_0x5af0f3){_0x2c800e=_0x5af0f3;_0x1a6de1=0xc8;}else{_0x1a6de1=0xce;}_0xd5dc86[_0x88ae('0x1b')](_0x1a6de1);return _0xd5dc86['set'](_0x88ae('0x21'),_0x15806e+'-'+_0x2c800e+'/'+_0x5af0f3)[_0x88ae('0x1c')](_0x2ac4f6);}return null;};}function patchUpdates(_0x20f50e){return function(_0x1f4eeb){try{jsonpatch[_0x88ae('0x22')](_0x1f4eeb,_0x20f50e,!![]);}catch(_0x54337c){return BPromise['reject'](_0x54337c);}return _0x1f4eeb['save']();};}function saveUpdates(_0x558811,_0xac525c){return function(_0x28c839){if(_0x28c839){return _0x28c839[_0x88ae('0x23')](_0x558811)['then'](function(_0x50011e){return _0x50011e;});}return null;};}function removeEntity(_0x460088,_0x1805cd){return function(_0x24c4fb){if(_0x24c4fb){return _0x24c4fb[_0x88ae('0x24')]()[_0x88ae('0x25')](function(){_0x460088['status'](0xcc)[_0x88ae('0x26')]();});}};}function handleEntityNotFound(_0x29fa02,_0x59cd77){return function(_0x2814f4){if(!_0x2814f4){_0x29fa02['sendStatus'](0x194);}return _0x2814f4;};}function handleError(_0x266b8b,_0x31a7cf){_0x31a7cf=_0x31a7cf||0x1f4;return function(_0xb4263b){logger[_0x88ae('0x27')](_0xb4263b[_0x88ae('0x28')]);if(_0xb4263b[_0x88ae('0x29')]){delete _0xb4263b[_0x88ae('0x29')];}_0x266b8b[_0x88ae('0x1b')](_0x31a7cf)[_0x88ae('0x2a')](_0xb4263b);};}exports[_0x88ae('0x2b')]=function(_0x16e444,_0x49e6e3){var _0x489d80={},_0x21e2ac={},_0x2756ee={'count':0x0,'rows':[]};var _0x4da5ec=_[_0x88ae('0x2c')](db[_0x88ae('0x2d')][_0x88ae('0x2e')],function(_0x552f47){return{'name':_0x552f47[_0x88ae('0x2f')],'type':_0x552f47[_0x88ae('0x30')][_0x88ae('0x31')]};});_0x21e2ac[_0x88ae('0x32')]=_[_0x88ae('0x2c')](_0x4da5ec,_0x88ae('0x29'));_0x21e2ac[_0x88ae('0x33')]=_['keys'](_0x16e444[_0x88ae('0x33')]);_0x21e2ac['filters']=_[_0x88ae('0x34')](_0x21e2ac[_0x88ae('0x32')],_0x21e2ac[_0x88ae('0x33')]);_0x489d80[_0x88ae('0x35')]=_['intersection'](_0x21e2ac[_0x88ae('0x32')],qs['fields'](_0x16e444[_0x88ae('0x33')]['fields']));_0x489d80[_0x88ae('0x35')]=_0x489d80[_0x88ae('0x35')][_0x88ae('0x36')]?_0x489d80['attributes']:_0x21e2ac[_0x88ae('0x32')];if(!_0x16e444[_0x88ae('0x33')][_0x88ae('0x37')](_0x88ae('0x38'))){_0x489d80['limit']=qs[_0x88ae('0x1e')](_0x16e444[_0x88ae('0x33')][_0x88ae('0x1e')]);_0x489d80[_0x88ae('0x20')]=qs[_0x88ae('0x20')](_0x16e444['query'][_0x88ae('0x20')]);}_0x489d80[_0x88ae('0x39')]=qs['sort'](_0x16e444['query']['sort']);_0x489d80[_0x88ae('0x3a')]=qs['filters'](_[_0x88ae('0x3b')](_0x16e444['query'],_0x21e2ac[_0x88ae('0x3c')]),_0x4da5ec);if(_0x16e444[_0x88ae('0x33')][_0x88ae('0x3d')]){_0x489d80[_0x88ae('0x3a')]=_[_0x88ae('0x3e')](_0x489d80[_0x88ae('0x3a')],{'$or':_['map'](_0x4da5ec,function(_0x4c0b46){if(_0x4c0b46[_0x88ae('0x30')]!==_0x88ae('0x3f')){var _0x386531={};_0x386531[_0x4c0b46[_0x88ae('0x29')]]={'$like':'%'+_0x16e444['query'][_0x88ae('0x3d')]+'%'};return _0x386531;}})});}_0x489d80=_[_0x88ae('0x3e')]({},_0x489d80,_0x16e444[_0x88ae('0x40')]);var _0x209aa9={'where':_0x489d80['where']};return db[_0x88ae('0x2d')]['count'](_0x209aa9)[_0x88ae('0x25')](function(_0x5a6922){_0x2756ee[_0x88ae('0x1f')]=_0x5a6922;if(_0x16e444[_0x88ae('0x33')][_0x88ae('0x41')]){_0x489d80['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x88ae('0x42')](_0x489d80);})['then'](function(_0x43e882){_0x2756ee['rows']=_0x43e882;return _0x2756ee;})[_0x88ae('0x25')](respondWithFilteredResult(_0x49e6e3,_0x489d80))[_0x88ae('0x43')](handleError(_0x49e6e3,null));};exports[_0x88ae('0x44')]=function(_0x2cefd3,_0x2f3ebb){var _0x2a3bc1={'raw':![],'where':{'id':_0x2cefd3['params']['id']}},_0x5e4b9d={};_0x5e4b9d[_0x88ae('0x32')]=_[_0x88ae('0x45')](db[_0x88ae('0x2d')][_0x88ae('0x2e')]);_0x5e4b9d[_0x88ae('0x33')]=_[_0x88ae('0x45')](_0x2cefd3[_0x88ae('0x33')]);_0x5e4b9d[_0x88ae('0x3c')]=_[_0x88ae('0x34')](_0x5e4b9d[_0x88ae('0x32')],_0x5e4b9d['query']);_0x2a3bc1['attributes']=_[_0x88ae('0x34')](_0x5e4b9d[_0x88ae('0x32')],qs[_0x88ae('0x46')](_0x2cefd3[_0x88ae('0x33')][_0x88ae('0x46')]));_0x2a3bc1[_0x88ae('0x35')]=_0x2a3bc1[_0x88ae('0x35')]['length']?_0x2a3bc1[_0x88ae('0x35')]:_0x5e4b9d[_0x88ae('0x32')];if(_0x2cefd3[_0x88ae('0x33')][_0x88ae('0x41')]){_0x2a3bc1['include']=[{'all':!![]}];}_0x2a3bc1=_[_0x88ae('0x3e')]({},_0x2a3bc1,_0x2cefd3[_0x88ae('0x40')]);return db[_0x88ae('0x2d')][_0x88ae('0x47')](_0x2a3bc1)[_0x88ae('0x25')](handleEntityNotFound(_0x2f3ebb,null))['then'](respondWithResult(_0x2f3ebb,null))['catch'](handleError(_0x2f3ebb,null));};exports['create']=function(_0x12ee0d,_0x55a2d9){return db[_0x88ae('0x2d')][_0x88ae('0x48')](_0x12ee0d[_0x88ae('0x49')],{})[_0x88ae('0x25')](respondWithResult(_0x55a2d9,0xc9))[_0x88ae('0x43')](handleError(_0x55a2d9,null));};exports[_0x88ae('0x23')]=function(_0x38b4c4,_0x3c899b){if(_0x38b4c4['body']['id']){delete _0x38b4c4[_0x88ae('0x49')]['id'];}return db[_0x88ae('0x2d')][_0x88ae('0x47')]({'where':{'id':_0x38b4c4[_0x88ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c899b,null))[_0x88ae('0x25')](saveUpdates(_0x38b4c4['body'],null))[_0x88ae('0x25')](respondWithResult(_0x3c899b,null))['catch'](handleError(_0x3c899b,null));};exports[_0x88ae('0x24')]=function(_0x5ecefe,_0x13acc9){return db[_0x88ae('0x2d')][_0x88ae('0x47')]({'where':{'id':_0x5ecefe['params']['id']}})[_0x88ae('0x25')](handleEntityNotFound(_0x13acc9,null))[_0x88ae('0x25')](removeEntity(_0x13acc9,null))['catch'](handleError(_0x13acc9,null));};exports['getFields']=function(_0xabd65d,_0x5e7e40,_0x37baa5){var _0x2a06f1={};var _0x75dff4={};var _0x1c08ae;var _0x1db605;return db[_0x88ae('0x2d')][_0x88ae('0x4b')]({'where':{'id':_0xabd65d['params']['id']}})['then'](handleEntityNotFound(_0x5e7e40,null))[_0x88ae('0x25')](function(_0x47bcc0){if(_0x47bcc0){_0x1c08ae=_0x47bcc0;_0x75dff4['model']=_[_0x88ae('0x45')](db[_0x88ae('0x4c')][_0x88ae('0x2e')]);_0x75dff4['query']=_['keys'](_0xabd65d[_0x88ae('0x33')]);_0x75dff4[_0x88ae('0x3c')]=_[_0x88ae('0x34')](_0x75dff4[_0x88ae('0x32')],_0x75dff4[_0x88ae('0x33')]);_0x2a06f1['attributes']=_[_0x88ae('0x34')](_0x75dff4[_0x88ae('0x32')],qs['fields'](_0xabd65d[_0x88ae('0x33')][_0x88ae('0x46')]));_0x2a06f1[_0x88ae('0x35')]=_0x2a06f1[_0x88ae('0x35')][_0x88ae('0x36')]?_0x2a06f1[_0x88ae('0x35')]:_0x75dff4[_0x88ae('0x32')];_0x2a06f1[_0x88ae('0x39')]=qs['sort'](_0xabd65d[_0x88ae('0x33')][_0x88ae('0x4d')]);_0x2a06f1[_0x88ae('0x3a')]=qs[_0x88ae('0x3c')](_[_0x88ae('0x3b')](_0xabd65d[_0x88ae('0x33')],_0x75dff4[_0x88ae('0x3c')]));if(_0xabd65d[_0x88ae('0x33')]['filter']){_0x2a06f1[_0x88ae('0x3a')]=_[_0x88ae('0x3e')](_0x2a06f1[_0x88ae('0x3a')],{'$or':_[_0x88ae('0x2c')](_0x2a06f1['attributes'],function(_0x3dda1f){var _0x7d331f={};_0x7d331f[_0x3dda1f]={'$like':'%'+_0xabd65d[_0x88ae('0x33')][_0x88ae('0x3d')]+'%'};return _0x7d331f;})});}_0x2a06f1=_[_0x88ae('0x3e')]({},_0x2a06f1,_0xabd65d[_0x88ae('0x40')]);return _0x1c08ae[_0x88ae('0x4e')](_0x2a06f1);}})['then'](function(_0x41070b){if(_0x41070b){_0x1db605=_0x41070b[_0x88ae('0x36')];if(!_0xabd65d['query'][_0x88ae('0x37')](_0x88ae('0x38'))){_0x2a06f1[_0x88ae('0x1e')]=qs[_0x88ae('0x1e')](_0xabd65d['query'][_0x88ae('0x1e')]);_0x2a06f1[_0x88ae('0x20')]=qs['offset'](_0xabd65d[_0x88ae('0x33')]['offset']);}return _0x1c08ae[_0x88ae('0x4e')](_0x2a06f1);}})[_0x88ae('0x25')](function(_0x2f55d6){if(_0x2f55d6){return _0x2f55d6?{'count':_0x1db605,'rows':_0x2f55d6}:null;}})[_0x88ae('0x25')](respondWithResult(_0x5e7e40,null))[_0x88ae('0x43')](handleError(_0x5e7e40,null));};exports['getSubjects']=function(_0x5ca070,_0x2bc7ec,_0x29d44e){var _0x4f213c={};var _0x4d0f63={};var _0x2280ad;var _0x58d7f9;return db[_0x88ae('0x2d')]['findOne']({'where':{'id':_0x5ca070[_0x88ae('0x4a')]['id']}})[_0x88ae('0x25')](handleEntityNotFound(_0x2bc7ec,null))[_0x88ae('0x25')](function(_0x517703){if(_0x517703){_0x2280ad=_0x517703;_0x4d0f63[_0x88ae('0x32')]=_[_0x88ae('0x45')](db[_0x88ae('0x4c')][_0x88ae('0x2e')]);_0x4d0f63[_0x88ae('0x33')]=_[_0x88ae('0x45')](_0x5ca070[_0x88ae('0x33')]);_0x4d0f63['filters']=_[_0x88ae('0x34')](_0x4d0f63['model'],_0x4d0f63[_0x88ae('0x33')]);_0x4f213c[_0x88ae('0x35')]=_[_0x88ae('0x34')](_0x4d0f63['model'],qs[_0x88ae('0x46')](_0x5ca070[_0x88ae('0x33')]['fields']));_0x4f213c[_0x88ae('0x35')]=_0x4f213c[_0x88ae('0x35')]['length']?_0x4f213c['attributes']:_0x4d0f63['model'];_0x4f213c[_0x88ae('0x39')]=qs[_0x88ae('0x4d')](_0x5ca070['query'][_0x88ae('0x4d')]);_0x4f213c[_0x88ae('0x3a')]=qs[_0x88ae('0x3c')](_[_0x88ae('0x3b')](_0x5ca070[_0x88ae('0x33')],_0x4d0f63[_0x88ae('0x3c')]));if(_0x5ca070[_0x88ae('0x33')][_0x88ae('0x3d')]){_0x4f213c[_0x88ae('0x3a')]=_['merge'](_0x4f213c[_0x88ae('0x3a')],{'$or':_[_0x88ae('0x2c')](_0x4f213c[_0x88ae('0x35')],function(_0x10fe34){var _0x4ec7d4={};_0x4ec7d4[_0x10fe34]={'$like':'%'+_0x5ca070[_0x88ae('0x33')][_0x88ae('0x3d')]+'%'};return _0x4ec7d4;})});}_0x4f213c=_[_0x88ae('0x3e')]({},_0x4f213c,_0x5ca070[_0x88ae('0x40')]);return _0x2280ad[_0x88ae('0x4f')](_0x4f213c);}})['then'](function(_0x36b3cb){if(_0x36b3cb){_0x58d7f9=_0x36b3cb[_0x88ae('0x36')];if(!_0x5ca070[_0x88ae('0x33')][_0x88ae('0x37')](_0x88ae('0x38'))){_0x4f213c[_0x88ae('0x1e')]=qs[_0x88ae('0x1e')](_0x5ca070[_0x88ae('0x33')]['limit']);_0x4f213c[_0x88ae('0x20')]=qs[_0x88ae('0x20')](_0x5ca070[_0x88ae('0x33')][_0x88ae('0x20')]);}return _0x2280ad[_0x88ae('0x4f')](_0x4f213c);}})['then'](function(_0x308537){if(_0x308537){return _0x308537?{'count':_0x58d7f9,'rows':_0x308537}:null;}})['then'](respondWithResult(_0x2bc7ec,null))[_0x88ae('0x43')](handleError(_0x2bc7ec,null));};exports[_0x88ae('0x50')]=function(_0x340b1f,_0x1b3cde,_0x6b34e9){var _0x478630={};var _0x2f0216={};var _0x27ba32;var _0x3405a3;return db[_0x88ae('0x2d')][_0x88ae('0x4b')]({'where':{'id':_0x340b1f['params']['id']}})[_0x88ae('0x25')](handleEntityNotFound(_0x1b3cde,null))['then'](function(_0x63f653){if(_0x63f653){_0x27ba32=_0x63f653;_0x2f0216[_0x88ae('0x32')]=_['keys'](db[_0x88ae('0x4c')][_0x88ae('0x2e')]);_0x2f0216[_0x88ae('0x33')]=_[_0x88ae('0x45')](_0x340b1f['query']);_0x2f0216[_0x88ae('0x3c')]=_[_0x88ae('0x34')](_0x2f0216[_0x88ae('0x32')],_0x2f0216[_0x88ae('0x33')]);_0x478630[_0x88ae('0x35')]=_['intersection'](_0x2f0216[_0x88ae('0x32')],qs['fields'](_0x340b1f[_0x88ae('0x33')][_0x88ae('0x46')]));_0x478630[_0x88ae('0x35')]=_0x478630[_0x88ae('0x35')]['length']?_0x478630[_0x88ae('0x35')]:_0x2f0216[_0x88ae('0x32')];_0x478630[_0x88ae('0x39')]=qs[_0x88ae('0x4d')](_0x340b1f[_0x88ae('0x33')][_0x88ae('0x4d')]);_0x478630[_0x88ae('0x3a')]=qs['filters'](_[_0x88ae('0x3b')](_0x340b1f['query'],_0x2f0216[_0x88ae('0x3c')]));if(_0x340b1f['query'][_0x88ae('0x3d')]){_0x478630[_0x88ae('0x3a')]=_['merge'](_0x478630['where'],{'$or':_[_0x88ae('0x2c')](_0x478630[_0x88ae('0x35')],function(_0x42471a){var _0x14ccf0={};_0x14ccf0[_0x42471a]={'$like':'%'+_0x340b1f['query']['filter']+'%'};return _0x14ccf0;})});}_0x478630=_[_0x88ae('0x3e')]({},_0x478630,_0x340b1f[_0x88ae('0x40')]);return _0x27ba32[_0x88ae('0x50')](_0x478630);}})[_0x88ae('0x25')](function(_0x2b3e49){if(_0x2b3e49){_0x3405a3=_0x2b3e49[_0x88ae('0x36')];if(!_0x340b1f[_0x88ae('0x33')]['hasOwnProperty'](_0x88ae('0x38'))){_0x478630[_0x88ae('0x1e')]=qs[_0x88ae('0x1e')](_0x340b1f[_0x88ae('0x33')][_0x88ae('0x1e')]);_0x478630[_0x88ae('0x20')]=qs[_0x88ae('0x20')](_0x340b1f[_0x88ae('0x33')][_0x88ae('0x20')]);}return _0x27ba32[_0x88ae('0x50')](_0x478630);}})[_0x88ae('0x25')](function(_0x1b0b21){if(_0x1b0b21){return _0x1b0b21?{'count':_0x3405a3,'rows':_0x1b0b21}:null;}})[_0x88ae('0x25')](respondWithResult(_0x1b3cde,null))[_0x88ae('0x43')](handleError(_0x1b3cde,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7c6f7c4..3532860 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 _0xea95=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xea95,0x9a));var _0x5ea9=function(_0x2d770f,_0x97eaac){_0x2d770f=_0x2d770f-0x0;var _0xaa1f57=_0xea95[_0x2d770f];return _0xaa1f57;};'use strict';var _=require(_0x5ea9('0x0'));var util=require('util');var logger=require(_0x5ea9('0x1'))(_0x5ea9('0x2'));var moment=require('moment');var BPromise=require(_0x5ea9('0x3'));var rp=require(_0x5ea9('0x4'));var fs=require('fs');var path=require(_0x5ea9('0x5'));var rimraf=require(_0x5ea9('0x6'));var config=require(_0x5ea9('0x7'));var attributes=require(_0x5ea9('0x8'));module[_0x5ea9('0x9')]=function(_0x4d1875,_0x162e18){return _0x4d1875[_0x5ea9('0xa')](_0x5ea9('0xb'),attributes,{'tableName':_0x5ea9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x718c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations'];(function(_0x2d16f8,_0x3f7013){var _0x257ac1=function(_0x34aa46){while(--_0x34aa46){_0x2d16f8['push'](_0x2d16f8['shift']());}};_0x257ac1(++_0x3f7013);}(_0x718c,0xd0));var _0xc718=function(_0x23bc17,_0x12336c){_0x23bc17=_0x23bc17-0x0;var _0x3afcde=_0x718c[_0x23bc17];return _0x3afcde;};'use strict';var _=require(_0xc718('0x0'));var util=require(_0xc718('0x1'));var logger=require('../../config/logger')(_0xc718('0x2'));var moment=require(_0xc718('0x3'));var BPromise=require(_0xc718('0x4'));var rp=require(_0xc718('0x5'));var fs=require('fs');var path=require(_0xc718('0x6'));var rimraf=require(_0xc718('0x7'));var config=require(_0xc718('0x8'));var attributes=require(_0xc718('0x9'));module[_0xc718('0xa')]=function(_0x111667,_0x41bc31){return _0x111667[_0xc718('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0xc718('0xc'),'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 dc2447d..65b2540 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 _0xf69a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf69a,0x139));var _0xaf69=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0xf69a[_0x4ed37d];return _0x4fb2c5;};'use strict';var _=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var moment=require(_0xaf69('0x2'));var BPromise=require(_0xaf69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf69('0x4'));var db=require(_0xaf69('0x5'))['db'];var utils=require(_0xaf69('0x6'));var logger=require(_0xaf69('0x7'))(_0xaf69('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf69('0x9'));var client=jayson['client'][_0xaf69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f65,_0x257d99,_0x572e4e){return new BPromise(function(_0x543bde,_0x23bafb){return client[_0xaf69('0xb')](_0x2a2f65,_0x572e4e)[_0xaf69('0xc')](function(_0x1ca823){logger[_0xaf69('0xd')](_0xaf69('0xe'),_0x257d99,_0xaf69('0xf'));logger[_0xaf69('0x10')](_0xaf69('0x11'),_0x257d99,_0xaf69('0xf'),JSON[_0xaf69('0x12')](_0x1ca823));if(_0x1ca823[_0xaf69('0x13')]){if(_0x1ca823['error'][_0xaf69('0x14')]===0x1f4){logger['error'](_0xaf69('0xe'),_0x257d99,_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);return _0x23bafb(_0x1ca823[_0xaf69('0x13')]['message']);}logger[_0xaf69('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x257d99,_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);return _0x543bde(_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);}else{logger[_0xaf69('0xd')](_0xaf69('0xe'),_0x257d99,_0xaf69('0xf'));_0x543bde(_0x1ca823[_0xaf69('0x16')][_0xaf69('0x15')]);}})[_0xaf69('0x17')](function(_0x2415b9){logger[_0xaf69('0x13')](_0xaf69('0xe'),_0x257d99,_0x2415b9);_0x23bafb(_0x2415b9);});});} \ No newline at end of file +var _0xee69=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x40ec4e,_0x5d8b1b){var _0x333401=function(_0x348098){while(--_0x348098){_0x40ec4e['push'](_0x40ec4e['shift']());}};_0x333401(++_0x5d8b1b);}(_0xee69,0x10b));var _0x9ee6=function(_0x23853f,_0x4b7199){_0x23853f=_0x23853f-0x0;var _0x2cc339=_0xee69[_0x23853f];return _0x2cc339;};'use strict';var _=require(_0x9ee6('0x0'));var util=require('util');var moment=require(_0x9ee6('0x1'));var BPromise=require(_0x9ee6('0x2'));var rs=require(_0x9ee6('0x3'));var fs=require('fs');var Redis=require(_0x9ee6('0x4'));var db=require(_0x9ee6('0x5'))['db'];var utils=require(_0x9ee6('0x6'));var logger=require('../../config/logger')(_0x9ee6('0x7'));var config=require('../../config/environment');var jayson=require(_0x9ee6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59f736,_0x7a7edd,_0x14e24c){return new BPromise(function(_0x2c54a6,_0x17b7c1){return client[_0x9ee6('0x9')](_0x59f736,_0x14e24c)[_0x9ee6('0xa')](function(_0x28dbbc){logger[_0x9ee6('0xb')](_0x9ee6('0xc'),_0x7a7edd,_0x9ee6('0xd'));logger[_0x9ee6('0xe')](_0x9ee6('0xf'),_0x7a7edd,_0x9ee6('0xd'),JSON[_0x9ee6('0x10')](_0x28dbbc));if(_0x28dbbc[_0x9ee6('0x11')]){if(_0x28dbbc[_0x9ee6('0x11')]['code']===0x1f4){logger[_0x9ee6('0x11')](_0x9ee6('0xc'),_0x7a7edd,_0x28dbbc[_0x9ee6('0x11')]['message']);return _0x17b7c1(_0x28dbbc[_0x9ee6('0x11')]['message']);}logger[_0x9ee6('0x11')](_0x9ee6('0xc'),_0x7a7edd,_0x28dbbc['error'][_0x9ee6('0x12')]);return _0x2c54a6(_0x28dbbc[_0x9ee6('0x11')][_0x9ee6('0x12')]);}else{logger[_0x9ee6('0xb')](_0x9ee6('0xc'),_0x7a7edd,'request\x20sent');_0x2c54a6(_0x28dbbc['result'][_0x9ee6('0x12')]);}})[_0x9ee6('0x13')](function(_0x3ed1f8){logger['error'](_0x9ee6('0xc'),_0x7a7edd,_0x3ed1f8);_0x17b7c1(_0x3ed1f8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4c4b8fd..8ed2410 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 _0x7072=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7072,0x11b));var _0x2707=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x7072[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x2707('0x0'));var util=require(_0x2707('0x1'));var path=require('path');var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require(_0x2707('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x6'));var config=require(_0x2707('0x7'));var controller=require(_0x2707('0x8'));router[_0x2707('0x9')]('/',auth[_0x2707('0xa')](),controller['index']);router[_0x2707('0x9')](_0x2707('0xb'),auth[_0x2707('0xa')](),controller[_0x2707('0xc')]);router[_0x2707('0xd')]('/',auth[_0x2707('0xa')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')](_0x2707('0xb'),auth[_0x2707('0xa')](),controller[_0x2707('0x10')]);router[_0x2707('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2707('0x12')]=router; \ No newline at end of file +var _0xaf23=['connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','util'];(function(_0x400eb6,_0x75423a){var _0x27d855=function(_0x4aa412){while(--_0x4aa412){_0x400eb6['push'](_0x400eb6['shift']());}};_0x27d855(++_0x75423a);}(_0xaf23,0x164));var _0x3af2=function(_0x37fff5,_0x2e32a4){_0x37fff5=_0x37fff5-0x0;var _0x51c788=_0xaf23[_0x37fff5];return _0x51c788;};'use strict';var multer=require('multer');var util=require(_0x3af2('0x0'));var path=require('path');var timeout=require(_0x3af2('0x1'));var express=require(_0x3af2('0x2'));var router=express[_0x3af2('0x3')]();var fs_extra=require(_0x3af2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3af2('0x5'));var controller=require(_0x3af2('0x6'));router[_0x3af2('0x7')]('/',auth[_0x3af2('0x8')](),controller[_0x3af2('0x9')]);router[_0x3af2('0x7')](_0x3af2('0xa'),auth[_0x3af2('0x8')](),controller['show']);router[_0x3af2('0xb')]('/',auth['isAuthenticated'](),controller[_0x3af2('0xc')]);router[_0x3af2('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3af2('0xe')]);router[_0x3af2('0xf')]('/:id',auth[_0x3af2('0x8')](),controller['destroy']);module[_0x3af2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b95cfc7..1a50570 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 _0xafed=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3d526f,_0x223456){var _0x3985ae=function(_0xad80d3){while(--_0xad80d3){_0x3d526f['push'](_0x3d526f['shift']());}};_0x3985ae(++_0x223456);}(_0xafed,0x1e8));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdafe('0x0'));module[_0xdafe('0x1')]={'type':{'type':Sequelize[_0xdafe('0x2')]('string',_0xdafe('0x3'),_0xdafe('0x4'),_0xdafe('0x5'),_0xdafe('0x6')),'defaultValue':_0xdafe('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdafe('0x8')]},'keyType':{'type':Sequelize[_0xdafe('0x2')](_0xdafe('0x7'),'variable',_0xdafe('0x4'))},'keyContent':{'type':Sequelize[_0xdafe('0x8')]},'idField':{'type':Sequelize[_0xdafe('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x504b=['customVariable','sequelize','exports','ENUM','string','picklist','STRING','variable'];(function(_0x3371fd,_0x138183){var _0x9a94f2=function(_0x3797ee){while(--_0x3797ee){_0x3371fd['push'](_0x3371fd['shift']());}};_0x9a94f2(++_0x138183);}(_0x504b,0x1b9));var _0xb504=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x504b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xb504('0x0'));module[_0xb504('0x1')]={'type':{'type':Sequelize[_0xb504('0x2')](_0xb504('0x3'),'variable','customVariable','keyValue',_0xb504('0x4')),'defaultValue':_0xb504('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb504('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xb504('0x3'),_0xb504('0x6'),_0xb504('0x7'))},'keyContent':{'type':Sequelize[_0xb504('0x5')]},'idField':{'type':Sequelize[_0xb504('0x5')]},'variableName':{'type':Sequelize[_0xb504('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index b1b6b0e..f8b19ee 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 _0x5965=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length'];(function(_0x57f345,_0x316929){var _0x255e43=function(_0x619f61){while(--_0x619f61){_0x57f345['push'](_0x57f345['shift']());}};_0x255e43(++_0x316929);}(_0x5965,0x1d5));var _0x5596=function(_0x50e0e2,_0x270d21){_0x50e0e2=_0x50e0e2-0x0;var _0x1bf6b8=_0x5965[_0x50e0e2];return _0x1bf6b8;};'use strict';var emlformat=require(_0x5596('0x0'));var rimraf=require(_0x5596('0x1'));var zipdir=require(_0x5596('0x2'));var jsonpatch=require(_0x5596('0x3'));var rp=require(_0x5596('0x4'));var moment=require('moment');var BPromise=require(_0x5596('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5596('0x6'));var csv=require('to-csv');var ejs=require(_0x5596('0x7'));var fs=require('fs');var fs_extra=require(_0x5596('0x8'));var _=require(_0x5596('0x9'));var squel=require(_0x5596('0xa'));var crypto=require(_0x5596('0xb'));var jsforce=require(_0x5596('0xc'));var deskjs=require(_0x5596('0xd'));var toCsv=require(_0x5596('0xe'));var querystring=require(_0x5596('0xf'));var Papa=require('papaparse');var Redis=require(_0x5596('0x10'));var authService=require(_0x5596('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5596('0x12'));var logger=require(_0x5596('0x13'))('api');var utils=require(_0x5596('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5596('0x15'));var db=require(_0x5596('0x16'))['db'];function respondWithStatusCode(_0xd75af9,_0x13810d){_0x13810d=_0x13810d||0xcc;return function(_0x1e3ca4){if(_0x1e3ca4){return _0xd75af9[_0x5596('0x17')](_0x13810d);}return _0xd75af9['status'](_0x13810d)[_0x5596('0x18')]();};}function respondWithResult(_0x2191ea,_0x4811bd){_0x4811bd=_0x4811bd||0xc8;return function(_0x5e5c2e){if(_0x5e5c2e){return _0x2191ea[_0x5596('0x19')](_0x4811bd)[_0x5596('0x1a')](_0x5e5c2e);}};}function respondWithFilteredResult(_0x6cc123,_0x31a577){return function(_0x6f241a){if(_0x6f241a){var _0x329c05=typeof _0x31a577['offset']===_0x5596('0x1b')&&typeof _0x31a577[_0x5596('0x1c')]===_0x5596('0x1b');var _0x2eecac=_0x6f241a[_0x5596('0x1d')];var _0x5216f1=_0x329c05?0x0:_0x31a577[_0x5596('0x1e')];var _0x1ba35c=_0x329c05?_0x6f241a[_0x5596('0x1d')]:_0x31a577[_0x5596('0x1e')]+_0x31a577[_0x5596('0x1c')];var _0x103676;if(_0x1ba35c>=_0x2eecac){_0x1ba35c=_0x2eecac;_0x103676=0xc8;}else{_0x103676=0xce;}_0x6cc123[_0x5596('0x19')](_0x103676);return _0x6cc123['set']('Content-Range',_0x5216f1+'-'+_0x1ba35c+'/'+_0x2eecac)[_0x5596('0x1a')](_0x6f241a);}return null;};}function patchUpdates(_0x4ffccc){return function(_0x4e9139){try{jsonpatch[_0x5596('0x1f')](_0x4e9139,_0x4ffccc,!![]);}catch(_0x14f256){return BPromise[_0x5596('0x20')](_0x14f256);}return _0x4e9139[_0x5596('0x21')]();};}function saveUpdates(_0x393da9,_0x382f54){return function(_0x47fb0f){if(_0x47fb0f){return _0x47fb0f[_0x5596('0x22')](_0x393da9)['then'](function(_0x1e0727){return _0x1e0727;});}return null;};}function removeEntity(_0x1df1ad,_0x15b989){return function(_0x574121){if(_0x574121){return _0x574121[_0x5596('0x23')]()[_0x5596('0x24')](function(){_0x1df1ad[_0x5596('0x19')](0xcc)[_0x5596('0x18')]();});}};}function handleEntityNotFound(_0x4be86c,_0xdddbd0){return function(_0x4933b7){if(!_0x4933b7){_0x4be86c[_0x5596('0x17')](0x194);}return _0x4933b7;};}function handleError(_0x4abb76,_0xf20716){_0xf20716=_0xf20716||0x1f4;return function(_0x10b889){logger[_0x5596('0x25')](_0x10b889[_0x5596('0x26')]);if(_0x10b889[_0x5596('0x27')]){delete _0x10b889[_0x5596('0x27')];}_0x4abb76[_0x5596('0x19')](_0xf20716)[_0x5596('0x28')](_0x10b889);};}exports[_0x5596('0x29')]=function(_0x27d975,_0x1794f7){var _0x582f88={},_0x665dc0={},_0x4e80ce={'count':0x0,'rows':[]};var _0x86b954=_['map'](db[_0x5596('0x2a')][_0x5596('0x2b')],function(_0x1623ca){return{'name':_0x1623ca[_0x5596('0x2c')],'type':_0x1623ca[_0x5596('0x2d')][_0x5596('0x2e')]};});_0x665dc0[_0x5596('0x2f')]=_[_0x5596('0x30')](_0x86b954,'name');_0x665dc0['query']=_[_0x5596('0x31')](_0x27d975['query']);_0x665dc0[_0x5596('0x32')]=_[_0x5596('0x33')](_0x665dc0[_0x5596('0x2f')],_0x665dc0[_0x5596('0x34')]);_0x582f88[_0x5596('0x35')]=_['intersection'](_0x665dc0[_0x5596('0x2f')],qs['fields'](_0x27d975[_0x5596('0x34')][_0x5596('0x36')]));_0x582f88[_0x5596('0x35')]=_0x582f88[_0x5596('0x35')][_0x5596('0x37')]?_0x582f88['attributes']:_0x665dc0['model'];if(!_0x27d975[_0x5596('0x34')][_0x5596('0x38')](_0x5596('0x39'))){_0x582f88[_0x5596('0x1c')]=qs[_0x5596('0x1c')](_0x27d975[_0x5596('0x34')][_0x5596('0x1c')]);_0x582f88['offset']=qs['offset'](_0x27d975[_0x5596('0x34')][_0x5596('0x1e')]);}_0x582f88[_0x5596('0x3a')]=qs['sort'](_0x27d975[_0x5596('0x34')][_0x5596('0x3b')]);_0x582f88['where']=qs[_0x5596('0x32')](_[_0x5596('0x3c')](_0x27d975[_0x5596('0x34')],_0x665dc0['filters']),_0x86b954);if(_0x27d975[_0x5596('0x34')][_0x5596('0x3d')]){_0x582f88[_0x5596('0x3e')]=_[_0x5596('0x3f')](_0x582f88['where'],{'$or':_[_0x5596('0x30')](_0x86b954,function(_0x56796b){if(_0x56796b[_0x5596('0x2d')]!==_0x5596('0x40')){var _0x3c9f76={};_0x3c9f76[_0x56796b[_0x5596('0x27')]]={'$like':'%'+_0x27d975[_0x5596('0x34')][_0x5596('0x3d')]+'%'};return _0x3c9f76;}})});}_0x582f88=_[_0x5596('0x3f')]({},_0x582f88,_0x27d975[_0x5596('0x41')]);var _0x5b98e9={'where':_0x582f88[_0x5596('0x3e')]};return db[_0x5596('0x2a')][_0x5596('0x1d')](_0x5b98e9)[_0x5596('0x24')](function(_0x42ca4d){_0x4e80ce[_0x5596('0x1d')]=_0x42ca4d;if(_0x27d975[_0x5596('0x34')][_0x5596('0x42')]){_0x582f88[_0x5596('0x43')]=[{'all':!![]}];}return db['SalesforceField'][_0x5596('0x44')](_0x582f88);})['then'](function(_0x5b1764){_0x4e80ce[_0x5596('0x45')]=_0x5b1764;return _0x4e80ce;})[_0x5596('0x24')](respondWithFilteredResult(_0x1794f7,_0x582f88))[_0x5596('0x46')](handleError(_0x1794f7,null));};exports['show']=function(_0x13faa5,_0x63120){var _0x593c7c={'raw':!![],'where':{'id':_0x13faa5[_0x5596('0x47')]['id']}},_0x4da1e8={};_0x4da1e8[_0x5596('0x2f')]=_[_0x5596('0x31')](db[_0x5596('0x2a')][_0x5596('0x2b')]);_0x4da1e8[_0x5596('0x34')]=_[_0x5596('0x31')](_0x13faa5[_0x5596('0x34')]);_0x4da1e8[_0x5596('0x32')]=_[_0x5596('0x33')](_0x4da1e8[_0x5596('0x2f')],_0x4da1e8[_0x5596('0x34')]);_0x593c7c[_0x5596('0x35')]=_[_0x5596('0x33')](_0x4da1e8[_0x5596('0x2f')],qs[_0x5596('0x36')](_0x13faa5[_0x5596('0x34')][_0x5596('0x36')]));_0x593c7c[_0x5596('0x35')]=_0x593c7c[_0x5596('0x35')][_0x5596('0x37')]?_0x593c7c[_0x5596('0x35')]:_0x4da1e8[_0x5596('0x2f')];if(_0x13faa5[_0x5596('0x34')][_0x5596('0x42')]){_0x593c7c[_0x5596('0x43')]=[{'all':!![]}];}_0x593c7c=_[_0x5596('0x3f')]({},_0x593c7c,_0x13faa5[_0x5596('0x41')]);return db[_0x5596('0x2a')][_0x5596('0x48')](_0x593c7c)[_0x5596('0x24')](handleEntityNotFound(_0x63120,null))[_0x5596('0x24')](respondWithResult(_0x63120,null))['catch'](handleError(_0x63120,null));};exports[_0x5596('0x49')]=function(_0x331b0c,_0x355c9a){return db[_0x5596('0x2a')][_0x5596('0x49')](_0x331b0c[_0x5596('0x4a')],{})[_0x5596('0x24')](respondWithResult(_0x355c9a,0xc9))[_0x5596('0x46')](handleError(_0x355c9a,null));};exports['update']=function(_0x411012,_0x3a900d){if(_0x411012[_0x5596('0x4a')]['id']){delete _0x411012[_0x5596('0x4a')]['id'];}return db[_0x5596('0x2a')][_0x5596('0x48')]({'where':{'id':_0x411012[_0x5596('0x47')]['id']}})[_0x5596('0x24')](handleEntityNotFound(_0x3a900d,null))[_0x5596('0x24')](saveUpdates(_0x411012[_0x5596('0x4a')],null))[_0x5596('0x24')](respondWithResult(_0x3a900d,null))[_0x5596('0x46')](handleError(_0x3a900d,null));};exports[_0x5596('0x23')]=function(_0x10fee7,_0x387cc5){return db[_0x5596('0x2a')][_0x5596('0x48')]({'where':{'id':_0x10fee7[_0x5596('0x47')]['id']}})[_0x5596('0x24')](handleEntityNotFound(_0x387cc5,null))['then'](removeEntity(_0x387cc5,null))[_0x5596('0x46')](handleError(_0x387cc5,null));}; \ No newline at end of file +var _0x2fb1=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','reject','save','update','then','destroy','error','stack','name','send','SalesforceField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis'];(function(_0x386623,_0xe07904){var _0x52bacc=function(_0x4d39dc){while(--_0x4d39dc){_0x386623['push'](_0x386623['shift']());}};_0x52bacc(++_0xe07904);}(_0x2fb1,0xcb));var _0x12fb=function(_0x563021,_0x266b80){_0x563021=_0x563021-0x0;var _0x22d77d=_0x2fb1[_0x563021];return _0x22d77d;};'use strict';var emlformat=require(_0x12fb('0x0'));var rimraf=require(_0x12fb('0x1'));var zipdir=require(_0x12fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12fb('0x3'));var moment=require(_0x12fb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x12fb('0x5'));var path=require(_0x12fb('0x6'));var sox=require(_0x12fb('0x7'));var csv=require(_0x12fb('0x8'));var ejs=require(_0x12fb('0x9'));var fs=require('fs');var fs_extra=require(_0x12fb('0xa'));var _=require(_0x12fb('0xb'));var squel=require(_0x12fb('0xc'));var crypto=require(_0x12fb('0xd'));var jsforce=require(_0x12fb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x12fb('0xf'));var authService=require(_0x12fb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x12fb('0x11'));var hardwareService=require(_0x12fb('0x12'));var logger=require(_0x12fb('0x13'))(_0x12fb('0x14'));var utils=require(_0x12fb('0x15'));var config=require(_0x12fb('0x16'));var licenseUtil=require(_0x12fb('0x17'));var db=require(_0x12fb('0x18'))['db'];function respondWithStatusCode(_0x250f03,_0x4874cc){_0x4874cc=_0x4874cc||0xcc;return function(_0x480b91){if(_0x480b91){return _0x250f03[_0x12fb('0x19')](_0x4874cc);}return _0x250f03['status'](_0x4874cc)['end']();};}function respondWithResult(_0x2f962b,_0x137e0e){_0x137e0e=_0x137e0e||0xc8;return function(_0x1c936c){if(_0x1c936c){return _0x2f962b['status'](_0x137e0e)[_0x12fb('0x1a')](_0x1c936c);}};}function respondWithFilteredResult(_0x5162bb,_0x3da624){return function(_0x3b64e8){if(_0x3b64e8){var _0x5a3eae=typeof _0x3da624[_0x12fb('0x1b')]==='undefined'&&typeof _0x3da624['limit']===_0x12fb('0x1c');var _0x4a68c9=_0x3b64e8[_0x12fb('0x1d')];var _0x86af2a=_0x5a3eae?0x0:_0x3da624[_0x12fb('0x1b')];var _0x190f28=_0x5a3eae?_0x3b64e8[_0x12fb('0x1d')]:_0x3da624[_0x12fb('0x1b')]+_0x3da624[_0x12fb('0x1e')];var _0x43fcec;if(_0x190f28>=_0x4a68c9){_0x190f28=_0x4a68c9;_0x43fcec=0xc8;}else{_0x43fcec=0xce;}_0x5162bb[_0x12fb('0x1f')](_0x43fcec);return _0x5162bb[_0x12fb('0x20')]('Content-Range',_0x86af2a+'-'+_0x190f28+'/'+_0x4a68c9)[_0x12fb('0x1a')](_0x3b64e8);}return null;};}function patchUpdates(_0x5e5cba){return function(_0x12f24b){try{jsonpatch['apply'](_0x12f24b,_0x5e5cba,!![]);}catch(_0x1baa2c){return BPromise[_0x12fb('0x21')](_0x1baa2c);}return _0x12f24b[_0x12fb('0x22')]();};}function saveUpdates(_0x315ca1,_0x46b338){return function(_0x202902){if(_0x202902){return _0x202902[_0x12fb('0x23')](_0x315ca1)[_0x12fb('0x24')](function(_0x5cb775){return _0x5cb775;});}return null;};}function removeEntity(_0x168cf5,_0x4272ec){return function(_0xba2d7a){if(_0xba2d7a){return _0xba2d7a[_0x12fb('0x25')]()['then'](function(){_0x168cf5[_0x12fb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ece4,_0x5ec7f8){return function(_0x59595f){if(!_0x59595f){_0x31ece4[_0x12fb('0x19')](0x194);}return _0x59595f;};}function handleError(_0x132bb0,_0x3c7a31){_0x3c7a31=_0x3c7a31||0x1f4;return function(_0x3ea29b){logger[_0x12fb('0x26')](_0x3ea29b[_0x12fb('0x27')]);if(_0x3ea29b[_0x12fb('0x28')]){delete _0x3ea29b[_0x12fb('0x28')];}_0x132bb0[_0x12fb('0x1f')](_0x3c7a31)[_0x12fb('0x29')](_0x3ea29b);};}exports['index']=function(_0x456769,_0xabf281){var _0x3fdacd={},_0x362445={},_0x3c1278={'count':0x0,'rows':[]};var _0x5828dd=_['map'](db[_0x12fb('0x2a')][_0x12fb('0x2b')],function(_0x365a52){return{'name':_0x365a52[_0x12fb('0x2c')],'type':_0x365a52[_0x12fb('0x2d')][_0x12fb('0x2e')]};});_0x362445[_0x12fb('0x2f')]=_[_0x12fb('0x30')](_0x5828dd,'name');_0x362445[_0x12fb('0x31')]=_['keys'](_0x456769[_0x12fb('0x31')]);_0x362445[_0x12fb('0x32')]=_[_0x12fb('0x33')](_0x362445[_0x12fb('0x2f')],_0x362445[_0x12fb('0x31')]);_0x3fdacd['attributes']=_[_0x12fb('0x33')](_0x362445[_0x12fb('0x2f')],qs[_0x12fb('0x34')](_0x456769[_0x12fb('0x31')]['fields']));_0x3fdacd[_0x12fb('0x35')]=_0x3fdacd[_0x12fb('0x35')][_0x12fb('0x36')]?_0x3fdacd[_0x12fb('0x35')]:_0x362445[_0x12fb('0x2f')];if(!_0x456769['query'][_0x12fb('0x37')]('nolimit')){_0x3fdacd[_0x12fb('0x1e')]=qs[_0x12fb('0x1e')](_0x456769['query'][_0x12fb('0x1e')]);_0x3fdacd[_0x12fb('0x1b')]=qs['offset'](_0x456769[_0x12fb('0x31')][_0x12fb('0x1b')]);}_0x3fdacd[_0x12fb('0x38')]=qs['sort'](_0x456769[_0x12fb('0x31')][_0x12fb('0x39')]);_0x3fdacd[_0x12fb('0x3a')]=qs['filters'](_[_0x12fb('0x3b')](_0x456769[_0x12fb('0x31')],_0x362445[_0x12fb('0x32')]),_0x5828dd);if(_0x456769[_0x12fb('0x31')][_0x12fb('0x3c')]){_0x3fdacd[_0x12fb('0x3a')]=_['merge'](_0x3fdacd[_0x12fb('0x3a')],{'$or':_[_0x12fb('0x30')](_0x5828dd,function(_0x56bfcb){if(_0x56bfcb[_0x12fb('0x2d')]!=='VIRTUAL'){var _0x5dfef3={};_0x5dfef3[_0x56bfcb[_0x12fb('0x28')]]={'$like':'%'+_0x456769[_0x12fb('0x31')][_0x12fb('0x3c')]+'%'};return _0x5dfef3;}})});}_0x3fdacd=_[_0x12fb('0x3d')]({},_0x3fdacd,_0x456769[_0x12fb('0x3e')]);var _0x3c4b4d={'where':_0x3fdacd[_0x12fb('0x3a')]};return db['SalesforceField'][_0x12fb('0x1d')](_0x3c4b4d)['then'](function(_0x14ce26){_0x3c1278[_0x12fb('0x1d')]=_0x14ce26;if(_0x456769['query'][_0x12fb('0x3f')]){_0x3fdacd[_0x12fb('0x40')]=[{'all':!![]}];}return db[_0x12fb('0x2a')]['findAll'](_0x3fdacd);})[_0x12fb('0x24')](function(_0x57b6e6){_0x3c1278[_0x12fb('0x41')]=_0x57b6e6;return _0x3c1278;})[_0x12fb('0x24')](respondWithFilteredResult(_0xabf281,_0x3fdacd))[_0x12fb('0x42')](handleError(_0xabf281,null));};exports[_0x12fb('0x43')]=function(_0x4036a6,_0x1d7440){var _0x34d872={'raw':!![],'where':{'id':_0x4036a6[_0x12fb('0x44')]['id']}},_0x57678b={};_0x57678b['model']=_[_0x12fb('0x45')](db[_0x12fb('0x2a')]['rawAttributes']);_0x57678b[_0x12fb('0x31')]=_[_0x12fb('0x45')](_0x4036a6[_0x12fb('0x31')]);_0x57678b['filters']=_['intersection'](_0x57678b['model'],_0x57678b[_0x12fb('0x31')]);_0x34d872[_0x12fb('0x35')]=_['intersection'](_0x57678b['model'],qs['fields'](_0x4036a6[_0x12fb('0x31')][_0x12fb('0x34')]));_0x34d872['attributes']=_0x34d872[_0x12fb('0x35')][_0x12fb('0x36')]?_0x34d872[_0x12fb('0x35')]:_0x57678b[_0x12fb('0x2f')];if(_0x4036a6['query'][_0x12fb('0x3f')]){_0x34d872[_0x12fb('0x40')]=[{'all':!![]}];}_0x34d872=_[_0x12fb('0x3d')]({},_0x34d872,_0x4036a6['options']);return db[_0x12fb('0x2a')][_0x12fb('0x46')](_0x34d872)[_0x12fb('0x24')](handleEntityNotFound(_0x1d7440,null))[_0x12fb('0x24')](respondWithResult(_0x1d7440,null))[_0x12fb('0x42')](handleError(_0x1d7440,null));};exports['create']=function(_0x247571,_0x2cec03){return db[_0x12fb('0x2a')][_0x12fb('0x47')](_0x247571[_0x12fb('0x48')],{})[_0x12fb('0x24')](respondWithResult(_0x2cec03,0xc9))['catch'](handleError(_0x2cec03,null));};exports['update']=function(_0x2aa0c0,_0x40efae){if(_0x2aa0c0[_0x12fb('0x48')]['id']){delete _0x2aa0c0[_0x12fb('0x48')]['id'];}return db[_0x12fb('0x2a')][_0x12fb('0x46')]({'where':{'id':_0x2aa0c0[_0x12fb('0x44')]['id']}})[_0x12fb('0x24')](handleEntityNotFound(_0x40efae,null))[_0x12fb('0x24')](saveUpdates(_0x2aa0c0[_0x12fb('0x48')],null))[_0x12fb('0x24')](respondWithResult(_0x40efae,null))['catch'](handleError(_0x40efae,null));};exports['destroy']=function(_0x389e59,_0x49dc8e){return db[_0x12fb('0x2a')][_0x12fb('0x46')]({'where':{'id':_0x389e59['params']['id']}})['then'](handleEntityNotFound(_0x49dc8e,null))[_0x12fb('0x24')](removeEntity(_0x49dc8e,null))[_0x12fb('0x42')](handleError(_0x49dc8e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1c09d52..b248665 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 _0x0c34=['define','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x355ff0,_0x5a555e){var _0x1dcf16=function(_0x3f0804){while(--_0x3f0804){_0x355ff0['push'](_0x355ff0['shift']());}};_0x1dcf16(++_0x5a555e);}(_0x0c34,0x17c));var _0x40c3=function(_0x54d0a8,_0xf7ddbf){_0x54d0a8=_0x54d0a8-0x0;var _0x17f18e=_0x0c34[_0x54d0a8];return _0x17f18e;};'use strict';var _=require(_0x40c3('0x0'));var util=require(_0x40c3('0x1'));var logger=require(_0x40c3('0x2'))(_0x40c3('0x3'));var moment=require(_0x40c3('0x4'));var BPromise=require('bluebird');var rp=require(_0x40c3('0x5'));var fs=require('fs');var path=require(_0x40c3('0x6'));var rimraf=require(_0x40c3('0x7'));var config=require(_0x40c3('0x8'));var attributes=require(_0x40c3('0x9'));module['exports']=function(_0x286a2b,_0x49919e){return _0x286a2b[_0x40c3('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x40c3('0xb'),'fields':['idField',_0x40c3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56bc=['FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SalesforceField','int_salesforce_fields','idField'];(function(_0x59bbba,_0x17d18f){var _0x31e930=function(_0x4e8708){while(--_0x4e8708){_0x59bbba['push'](_0x59bbba['shift']());}};_0x31e930(++_0x17d18f);}(_0x56bc,0xc5));var _0xc56b=function(_0xcc2d5b,_0x2e5c9e){_0xcc2d5b=_0xcc2d5b-0x0;var _0x55c377=_0x56bc[_0xcc2d5b];return _0x55c377;};'use strict';var _=require('lodash');var util=require(_0xc56b('0x0'));var logger=require(_0xc56b('0x1'))(_0xc56b('0x2'));var moment=require(_0xc56b('0x3'));var BPromise=require(_0xc56b('0x4'));var rp=require(_0xc56b('0x5'));var fs=require('fs');var path=require(_0xc56b('0x6'));var rimraf=require(_0xc56b('0x7'));var config=require(_0xc56b('0x8'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0xd866b7,_0x266aa7){return _0xd866b7[_0xc56b('0x9')](_0xc56b('0xa'),attributes,{'tableName':_0xc56b('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xc56b('0xc'),_0xc56b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 6845dc8..17204c2 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 _0x6841=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x6841,0x80));var _0x1684=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6841[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x1684('0x0'));var util=require(_0x1684('0x1'));var moment=require('moment');var BPromise=require(_0x1684('0x2'));var rs=require(_0x1684('0x3'));var fs=require('fs');var Redis=require(_0x1684('0x4'));var db=require(_0x1684('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1684('0x6'));var config=require('../../config/environment');var jayson=require(_0x1684('0x7'));var client=jayson[_0x1684('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13c546,_0x402fac,_0x4d78e3){return new BPromise(function(_0x335bbe,_0x2f1f88){return client[_0x1684('0x9')](_0x13c546,_0x4d78e3)[_0x1684('0xa')](function(_0x18ead7){logger['info'](_0x1684('0xb'),_0x402fac,_0x1684('0xc'));logger[_0x1684('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x402fac,_0x1684('0xc'),JSON[_0x1684('0xe')](_0x18ead7));if(_0x18ead7[_0x1684('0xf')]){if(_0x18ead7[_0x1684('0xf')][_0x1684('0x10')]===0x1f4){logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x18ead7[_0x1684('0xf')]['message']);return _0x2f1f88(_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);}logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);return _0x335bbe(_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);}else{logger['info'](_0x1684('0xb'),_0x402fac,_0x1684('0xc'));_0x335bbe(_0x18ead7[_0x1684('0x12')]['message']);}})[_0x1684('0x13')](function(_0x121957){logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x121957);_0x2f1f88(_0x121957);});});} \ No newline at end of file +var _0x9931=['stringify','error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x226e55,_0x2b4262){var _0xff48a5=function(_0xb7f95b){while(--_0xb7f95b){_0x226e55['push'](_0x226e55['shift']());}};_0xff48a5(++_0x2b4262);}(_0x9931,0x77));var _0x1993=function(_0x214aed,_0x3fcbc5){_0x214aed=_0x214aed-0x0;var _0x95e18e=_0x9931[_0x214aed];return _0x95e18e;};'use strict';var _=require(_0x1993('0x0'));var util=require(_0x1993('0x1'));var moment=require('moment');var BPromise=require(_0x1993('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1993('0x3'));var logger=require(_0x1993('0x4'))('rpc');var config=require(_0x1993('0x5'));var jayson=require(_0x1993('0x6'));var client=jayson[_0x1993('0x7')][_0x1993('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x240b84,_0x493c84,_0xd5c67c){return new BPromise(function(_0x266930,_0x43f346){return client[_0x1993('0x9')](_0x240b84,_0xd5c67c)['then'](function(_0x5985fe){logger[_0x1993('0xa')](_0x1993('0xb'),_0x493c84,_0x1993('0xc'));logger['debug'](_0x1993('0xd'),_0x493c84,_0x1993('0xc'),JSON[_0x1993('0xe')](_0x5985fe));if(_0x5985fe[_0x1993('0xf')]){if(_0x5985fe[_0x1993('0xf')]['code']===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x493c84,_0x5985fe[_0x1993('0xf')][_0x1993('0x10')]);return _0x43f346(_0x5985fe[_0x1993('0xf')][_0x1993('0x10')]);}logger['error'](_0x1993('0xb'),_0x493c84,_0x5985fe['error'][_0x1993('0x10')]);return _0x266930(_0x5985fe[_0x1993('0xf')][_0x1993('0x10')]);}else{logger[_0x1993('0xa')]('SalesforceField,\x20%s,\x20%s',_0x493c84,'request\x20sent');_0x266930(_0x5985fe[_0x1993('0x11')]['message']);}})[_0x1993('0x12')](function(_0x4c01a7){logger['error'](_0x1993('0xb'),_0x493c84,_0x4c01a7);_0x43f346(_0x4c01a7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 031fb10..1c8c262 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 _0x58df=['post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields'];(function(_0x5be5f9,_0x327830){var _0x2c8e64=function(_0x972432){while(--_0x972432){_0x5be5f9['push'](_0x5be5f9['shift']());}};_0x2c8e64(++_0x327830);}(_0x58df,0xb2));var _0xf58d=function(_0x41382e,_0x5d4d1a){_0x41382e=_0x41382e-0x0;var _0x4be918=_0x58df[_0x41382e];return _0x4be918;};'use strict';var multer=require(_0xf58d('0x0'));var util=require('util');var path=require(_0xf58d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf58d('0x2')]();var fs_extra=require(_0xf58d('0x3'));var auth=require(_0xf58d('0x4'));var interaction=require(_0xf58d('0x5'));var config=require(_0xf58d('0x6'));var controller=require(_0xf58d('0x7'));router[_0xf58d('0x8')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xa')]);router['get']('/:id',auth[_0xf58d('0x9')](),controller[_0xf58d('0xb')]);router[_0xf58d('0x8')]('/:id/configurations',auth[_0xf58d('0x9')](),controller[_0xf58d('0xc')]);router[_0xf58d('0x8')]('/:id/fields',auth[_0xf58d('0x9')](),controller[_0xf58d('0xd')]);router[_0xf58d('0xe')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xf')]);router['post'](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x11')]);router[_0xf58d('0x12')](_0xf58d('0x13'),auth['isAuthenticated'](),controller[_0xf58d('0x14')]);router[_0xf58d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf58d('0x16')]);module[_0xf58d('0x17')]=router; \ No newline at end of file +var _0xd0ae=['/:id','show','/:id/configurations','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xd0ae,0x1ae));var _0xed0a=function(_0x4c3022,_0x1b3a71){_0x4c3022=_0x4c3022-0x0;var _0x260223=_0xd0ae[_0x4c3022];return _0x260223;};'use strict';var multer=require(_0xed0a('0x0'));var util=require(_0xed0a('0x1'));var path=require(_0xed0a('0x2'));var timeout=require(_0xed0a('0x3'));var express=require('express');var router=express[_0xed0a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed0a('0x5'));var interaction=require(_0xed0a('0x6'));var config=require(_0xed0a('0x7'));var controller=require(_0xed0a('0x8'));router[_0xed0a('0x9')]('/',auth[_0xed0a('0xa')](),controller['index']);router[_0xed0a('0x9')](_0xed0a('0xb'),auth[_0xed0a('0xa')](),controller[_0xed0a('0xc')]);router[_0xed0a('0x9')](_0xed0a('0xd'),auth[_0xed0a('0xa')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xed0a('0xe')]);router[_0xed0a('0xf')]('/',auth[_0xed0a('0xa')](),controller[_0xed0a('0x10')]);router['post'](_0xed0a('0xd'),auth[_0xed0a('0xa')](),controller['addConfiguration']);router[_0xed0a('0x11')](_0xed0a('0xb'),auth['isAuthenticated'](),controller[_0xed0a('0x12')]);router[_0xed0a('0x13')](_0xed0a('0xb'),auth[_0xed0a('0xa')](),controller[_0xed0a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f730140..1628749 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 _0x89a2=['username','remoteUri','sequelize','exports','STRING'];(function(_0x422797,_0x4379b7){var _0x4f8a67=function(_0x3a258f){while(--_0x3a258f){_0x422797['push'](_0x422797['shift']());}};_0x4f8a67(++_0x4379b7);}(_0x89a2,0x89));var _0x289a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x89a2[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x289a('0x0'));module[_0x289a('0x1')]={'name':{'type':Sequelize[_0x289a('0x2')]},'description':{'type':Sequelize[_0x289a('0x2')]},'username':{'type':Sequelize[_0x289a('0x2')],'unique':_0x289a('0x3')},'password':{'type':Sequelize[_0x289a('0x2')]},'email':{'type':Sequelize[_0x289a('0x2')]},'remoteUri':{'type':Sequelize[_0x289a('0x2')],'unique':_0x289a('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x870b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x58cc8d,_0x40bbd6){var _0xdbe727=function(_0x1c8dcd){while(--_0x1c8dcd){_0x58cc8d['push'](_0x58cc8d['shift']());}};_0xdbe727(++_0x40bbd6);}(_0x870b,0xce));var _0xb870=function(_0x28e633,_0x36a77e){_0x28e633=_0x28e633-0x0;var _0x24cd64=_0x870b[_0x28e633];return _0x24cd64;};'use strict';var Sequelize=require(_0xb870('0x0'));module[_0xb870('0x1')]={'name':{'type':Sequelize[_0xb870('0x2')]},'description':{'type':Sequelize[_0xb870('0x2')]},'username':{'type':Sequelize[_0xb870('0x2')],'unique':_0xb870('0x3')},'password':{'type':Sequelize[_0xb870('0x2')]},'email':{'type':Sequelize[_0xb870('0x2')]},'remoteUri':{'type':Sequelize[_0xb870('0x2')],'unique':_0xb870('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7d8da62..57bfa05 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 _0x27ed=['options','includeAll','include','findAll','rows','catch','find','create','body','update','params','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','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','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','work_start','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','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','remove','forEach','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x3805ab,_0x20904f){var _0x227191=function(_0x488318){while(--_0x488318){_0x3805ab['push'](_0x3805ab['shift']());}};_0x227191(++_0x20904f);}(_0x27ed,0x13a));var _0xd27e=function(_0x3ceb0a,_0x4bad2d){_0x3ceb0a=_0x3ceb0a-0x0;var _0x80ce2f=_0x27ed[_0x3ceb0a];return _0x80ce2f;};'use strict';var emlformat=require(_0xd27e('0x0'));var rimraf=require(_0xd27e('0x1'));var zipdir=require(_0xd27e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd27e('0x3'));var moment=require(_0xd27e('0x4'));var BPromise=require(_0xd27e('0x5'));var Mustache=require(_0xd27e('0x6'));var util=require(_0xd27e('0x7'));var path=require(_0xd27e('0x8'));var sox=require('sox');var csv=require(_0xd27e('0x9'));var ejs=require(_0xd27e('0xa'));var fs=require('fs');var fs_extra=require(_0xd27e('0xb'));var _=require(_0xd27e('0xc'));var squel=require(_0xd27e('0xd'));var crypto=require(_0xd27e('0xe'));var jsforce=require(_0xd27e('0xf'));var deskjs=require(_0xd27e('0x10'));var toCsv=require(_0xd27e('0x9'));var querystring=require(_0xd27e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd27e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd27e('0x13'));var as=require(_0xd27e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd27e('0x15'))(_0xd27e('0x16'));var utils=require(_0xd27e('0x17'));var config=require(_0xd27e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fd6d9,_0x4bd774){_0x4bd774=_0x4bd774||0xcc;return function(_0x3b302d){if(_0x3b302d){return _0x3fd6d9[_0xd27e('0x19')](_0x4bd774);}return _0x3fd6d9[_0xd27e('0x1a')](_0x4bd774)[_0xd27e('0x1b')]();};}function respondWithResult(_0x3abdac,_0x523662){_0x523662=_0x523662||0xc8;return function(_0x4af11b){if(_0x4af11b){return _0x3abdac[_0xd27e('0x1a')](_0x523662)[_0xd27e('0x1c')](_0x4af11b);}};}function respondWithFilteredResult(_0x506c5a,_0xc5919f){return function(_0x342171){if(_0x342171){var _0x493138=typeof _0xc5919f[_0xd27e('0x1d')]===_0xd27e('0x1e')&&typeof _0xc5919f[_0xd27e('0x1f')]==='undefined';var _0x32b30d=_0x342171['count'];var _0x441e0d=_0x493138?0x0:_0xc5919f[_0xd27e('0x1d')];var _0x543b99=_0x493138?_0x342171[_0xd27e('0x20')]:_0xc5919f['offset']+_0xc5919f[_0xd27e('0x1f')];var _0x2c1100;if(_0x543b99>=_0x32b30d){_0x543b99=_0x32b30d;_0x2c1100=0xc8;}else{_0x2c1100=0xce;}_0x506c5a[_0xd27e('0x1a')](_0x2c1100);return _0x506c5a[_0xd27e('0x21')](_0xd27e('0x22'),_0x441e0d+'-'+_0x543b99+'/'+_0x32b30d)[_0xd27e('0x1c')](_0x342171);}return null;};}function patchUpdates(_0xdc3de3){return function(_0x270dbe){try{jsonpatch['apply'](_0x270dbe,_0xdc3de3,!![]);}catch(_0x2f663e){return BPromise['reject'](_0x2f663e);}return _0x270dbe[_0xd27e('0x23')]();};}function saveUpdates(_0x4328f0,_0x439cf6){return function(_0x11440c){if(_0x11440c){return _0x11440c['update'](_0x4328f0)[_0xd27e('0x24')](function(_0x1baae3){return _0x1baae3;});}return null;};}function removeEntity(_0x62b724,_0x4274f6){return function(_0x3183e4){if(_0x3183e4){return _0x3183e4[_0xd27e('0x25')]()['then'](function(){_0x62b724[_0xd27e('0x1a')](0xcc)[_0xd27e('0x1b')]();});}};}function handleEntityNotFound(_0x53a158,_0x2af7ca){return function(_0x4554f7){if(!_0x4554f7){_0x53a158['sendStatus'](0x194);}return _0x4554f7;};}function handleError(_0x43fcef,_0x13b9ac){_0x13b9ac=_0x13b9ac||0x1f4;return function(_0x5265aa){logger['error'](_0x5265aa[_0xd27e('0x26')]);if(_0x5265aa[_0xd27e('0x27')]){delete _0x5265aa['name'];}_0x43fcef[_0xd27e('0x1a')](_0x13b9ac)[_0xd27e('0x28')](_0x5265aa);};}exports[_0xd27e('0x29')]=function(_0x4d4845,_0x3d3929){var _0x46d9af={},_0x1e4f16={},_0x50c044={'count':0x0,'rows':[]};var _0x2af63a=_[_0xd27e('0x2a')](db[_0xd27e('0x2b')][_0xd27e('0x2c')],function(_0x18b4a4){return{'name':_0x18b4a4[_0xd27e('0x2d')],'type':_0x18b4a4['type']['key']};});_0x1e4f16[_0xd27e('0x2e')]=_[_0xd27e('0x2a')](_0x2af63a,_0xd27e('0x27'));_0x1e4f16[_0xd27e('0x2f')]=_[_0xd27e('0x30')](_0x4d4845['query']);_0x1e4f16[_0xd27e('0x31')]=_[_0xd27e('0x32')](_0x1e4f16[_0xd27e('0x2e')],_0x1e4f16[_0xd27e('0x2f')]);_0x46d9af[_0xd27e('0x33')]=_[_0xd27e('0x32')](_0x1e4f16[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x46d9af[_0xd27e('0x33')]=_0x46d9af[_0xd27e('0x33')][_0xd27e('0x35')]?_0x46d9af['attributes']:_0x1e4f16[_0xd27e('0x2e')];if(!_0x4d4845['query'][_0xd27e('0x36')](_0xd27e('0x37'))){_0x46d9af[_0xd27e('0x1f')]=qs[_0xd27e('0x1f')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x1f')]);_0x46d9af['offset']=qs[_0xd27e('0x1d')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x1d')]);}_0x46d9af[_0xd27e('0x38')]=qs[_0xd27e('0x39')](_0x4d4845['query'][_0xd27e('0x39')]);_0x46d9af['where']=qs[_0xd27e('0x31')](_[_0xd27e('0x3a')](_0x4d4845[_0xd27e('0x2f')],_0x1e4f16[_0xd27e('0x31')]),_0x2af63a);if(_0x4d4845['query'][_0xd27e('0x3b')]){_0x46d9af[_0xd27e('0x3c')]=_[_0xd27e('0x3d')](_0x46d9af[_0xd27e('0x3c')],{'$or':_[_0xd27e('0x2a')](_0x2af63a,function(_0x209aa6){if(_0x209aa6['type']!=='VIRTUAL'){var _0x16c8c3={};_0x16c8c3[_0x209aa6[_0xd27e('0x27')]]={'$like':'%'+_0x4d4845['query'][_0xd27e('0x3b')]+'%'};return _0x16c8c3;}})});}_0x46d9af=_[_0xd27e('0x3d')]({},_0x46d9af,_0x4d4845[_0xd27e('0x3e')]);var _0x5c6fe9={'where':_0x46d9af[_0xd27e('0x3c')]};return db[_0xd27e('0x2b')][_0xd27e('0x20')](_0x5c6fe9)['then'](function(_0x5affbb){_0x50c044[_0xd27e('0x20')]=_0x5affbb;if(_0x4d4845['query'][_0xd27e('0x3f')]){_0x46d9af[_0xd27e('0x40')]=[{'all':!![]}];}return db[_0xd27e('0x2b')][_0xd27e('0x41')](_0x46d9af);})['then'](function(_0x3d744b){_0x50c044[_0xd27e('0x42')]=_0x3d744b;return _0x50c044;})[_0xd27e('0x24')](respondWithFilteredResult(_0x3d3929,_0x46d9af))[_0xd27e('0x43')](handleError(_0x3d3929,null));};exports['show']=function(_0xdadda4,_0x5824c3){var _0x270427={'raw':![],'where':{'id':_0xdadda4['params']['id']}},_0x3d4af7={};_0x3d4af7[_0xd27e('0x2e')]=_['keys'](db[_0xd27e('0x2b')][_0xd27e('0x2c')]);_0x3d4af7[_0xd27e('0x2f')]=_['keys'](_0xdadda4['query']);_0x3d4af7['filters']=_[_0xd27e('0x32')](_0x3d4af7[_0xd27e('0x2e')],_0x3d4af7[_0xd27e('0x2f')]);_0x270427[_0xd27e('0x33')]=_[_0xd27e('0x32')](_0x3d4af7[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0xdadda4[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x270427['attributes']=_0x270427[_0xd27e('0x33')][_0xd27e('0x35')]?_0x270427[_0xd27e('0x33')]:_0x3d4af7[_0xd27e('0x2e')];if(_0xdadda4[_0xd27e('0x2f')][_0xd27e('0x3f')]){_0x270427[_0xd27e('0x40')]=[{'all':!![]}];}_0x270427=_[_0xd27e('0x3d')]({},_0x270427,_0xdadda4[_0xd27e('0x3e')]);return db[_0xd27e('0x2b')][_0xd27e('0x44')](_0x270427)[_0xd27e('0x24')](handleEntityNotFound(_0x5824c3,null))[_0xd27e('0x24')](respondWithResult(_0x5824c3,null))[_0xd27e('0x43')](handleError(_0x5824c3,null));};exports[_0xd27e('0x45')]=function(_0x57983a,_0x4d301c){return db[_0xd27e('0x2b')][_0xd27e('0x45')](_0x57983a[_0xd27e('0x46')],{})['then'](respondWithResult(_0x4d301c,0xc9))[_0xd27e('0x43')](handleError(_0x4d301c,null));};exports[_0xd27e('0x47')]=function(_0x2bd161,_0x1fa156){if(_0x2bd161[_0xd27e('0x46')]['id']){delete _0x2bd161[_0xd27e('0x46')]['id'];}return db[_0xd27e('0x2b')][_0xd27e('0x44')]({'where':{'id':_0x2bd161[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x1fa156,null))['then'](saveUpdates(_0x2bd161[_0xd27e('0x46')],null))[_0xd27e('0x24')](respondWithResult(_0x1fa156,null))[_0xd27e('0x43')](handleError(_0x1fa156,null));};exports[_0xd27e('0x25')]=function(_0x14a24c,_0xedccdd){return db[_0xd27e('0x2b')][_0xd27e('0x44')]({'where':{'id':_0x14a24c[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0xedccdd,null))[_0xd27e('0x24')](removeEntity(_0xedccdd,null))[_0xd27e('0x43')](handleError(_0xedccdd,null));};exports[_0xd27e('0x49')]=function(_0x37caa5,_0x5448c0,_0x3de783){var _0x52684d={};var _0x176f14={};var _0x5ab10;var _0x51853c;return db['ServicenowAccount']['findOne']({'where':{'id':_0x37caa5[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x5448c0,null))[_0xd27e('0x24')](function(_0x14de50){if(_0x14de50){_0x5ab10=_0x14de50;_0x176f14[_0xd27e('0x2e')]=_['keys'](db[_0xd27e('0x4a')][_0xd27e('0x2c')]);_0x176f14[_0xd27e('0x2f')]=_[_0xd27e('0x30')](_0x37caa5[_0xd27e('0x2f')]);_0x176f14['filters']=_[_0xd27e('0x32')](_0x176f14[_0xd27e('0x2e')],_0x176f14[_0xd27e('0x2f')]);_0x52684d['attributes']=_[_0xd27e('0x32')](_0x176f14[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x52684d[_0xd27e('0x33')]=_0x52684d[_0xd27e('0x33')][_0xd27e('0x35')]?_0x52684d[_0xd27e('0x33')]:_0x176f14[_0xd27e('0x2e')];_0x52684d[_0xd27e('0x38')]=qs[_0xd27e('0x39')](_0x37caa5['query'][_0xd27e('0x39')]);_0x52684d[_0xd27e('0x3c')]=qs[_0xd27e('0x31')](_['pick'](_0x37caa5[_0xd27e('0x2f')],_0x176f14['filters']));if(_0x37caa5[_0xd27e('0x2f')]['filter']){_0x52684d[_0xd27e('0x3c')]=_[_0xd27e('0x3d')](_0x52684d['where'],{'$or':_[_0xd27e('0x2a')](_0x52684d['attributes'],function(_0x3f743f){var _0x4548bf={};_0x4548bf[_0x3f743f]={'$like':'%'+_0x37caa5[_0xd27e('0x2f')]['filter']+'%'};return _0x4548bf;})});}_0x52684d=_['merge']({},_0x52684d,_0x37caa5[_0xd27e('0x3e')]);return _0x5ab10[_0xd27e('0x49')](_0x52684d);}})[_0xd27e('0x24')](function(_0x5b3413){if(_0x5b3413){_0x51853c=_0x5b3413[_0xd27e('0x35')];if(!_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x36')](_0xd27e('0x37'))){_0x52684d[_0xd27e('0x1f')]=qs[_0xd27e('0x1f')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x1f')]);_0x52684d[_0xd27e('0x1d')]=qs[_0xd27e('0x1d')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x1d')]);}return _0x5ab10[_0xd27e('0x49')](_0x52684d);}})[_0xd27e('0x24')](function(_0x2029fb){if(_0x2029fb){return _0x2029fb?{'count':_0x51853c,'rows':_0x2029fb}:null;}})['then'](respondWithResult(_0x5448c0,null))['catch'](handleError(_0x5448c0,null));};exports[_0xd27e('0x4b')]=function(_0x359c09,_0x4eee4d,_0x4e45e4){if(_0x359c09[_0xd27e('0x46')]['id']){delete _0x359c09[_0xd27e('0x46')]['id'];}return db[_0xd27e('0x2b')][_0xd27e('0x4c')]({'where':{'id':_0x359c09[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x4eee4d,null))[_0xd27e('0x24')](function(_0x49b08e){if(_0x49b08e){_0x359c09['body'][_0xd27e('0x4d')]=_0x49b08e['id'];_0x359c09[_0xd27e('0x46')][_0xd27e('0x4e')]=integrations[_0xd27e('0x4f')](_0x359c09['body']['channel'],_0x359c09[_0xd27e('0x46')][_0xd27e('0x50')]);_0x359c09[_0xd27e('0x46')][_0xd27e('0x51')]=integrations[_0xd27e('0x52')](_0x359c09[_0xd27e('0x46')][_0xd27e('0x53')],_0x359c09['body'][_0xd27e('0x50')]);return db['ServicenowConfiguration']['create'](_0x359c09[_0xd27e('0x46')],{'include':[{'model':db['ServicenowField'],'as':_0xd27e('0x4e')},{'model':db[_0xd27e('0x54')],'as':_0xd27e('0x51')}]});}return null;})[_0xd27e('0x24')](respondWithResult(_0x4eee4d,null))['catch'](handleError(_0x4eee4d,null));};exports[_0xd27e('0x55')]=function(_0x2cabdf,_0x312fe6,_0x52b908){var _0x32b166=[_0xd27e('0x56'),_0xd27e('0x57'),'knowledge',_0xd27e('0x58'),'close_code',_0xd27e('0x59'),_0xd27e('0x5a'),'severity',_0xd27e('0x5b')];var _0xe4587a=[_0xd27e('0x5c'),_0xd27e('0x56'),_0xd27e('0x5d'),_0xd27e('0x5e'),_0xd27e('0x5f'),_0xd27e('0x60'),'child_incidents',_0xd27e('0x57'),'approval_history',_0xd27e('0x61'),'resolved_by',_0xd27e('0x62'),_0xd27e('0x63'),_0xd27e('0x64'),_0xd27e('0x65'),_0xd27e('0x66'),_0xd27e('0x67'),_0xd27e('0x68'),'knowledge',_0xd27e('0x38'),_0xd27e('0x69'),_0xd27e('0x6a'),_0xd27e('0x6b'),_0xd27e('0x6c'),_0xd27e('0x6d'),_0xd27e('0x6e'),_0xd27e('0x6f'),_0xd27e('0x70'),'priority',_0xd27e('0x71'),_0xd27e('0x72'),_0xd27e('0x73'),_0xd27e('0x74'),_0xd27e('0x75'),_0xd27e('0x76'),'group_list',_0xd27e('0x77'),_0xd27e('0x78'),_0xd27e('0x79'),_0xd27e('0x7a'),_0xd27e('0x7b'),_0xd27e('0x58'),_0xd27e('0x7c'),_0xd27e('0x7d'),_0xd27e('0x7e'),_0xd27e('0x7f'),'delivery_task',_0xd27e('0x80'),'assignment_group',_0xd27e('0x81'),'additional_assignee_list',_0xd27e('0x82'),_0xd27e('0x83'),'notify',_0xd27e('0x84'),_0xd27e('0x85'),'closed_by',_0xd27e('0x86'),_0xd27e('0x87'),'sys_id',_0xd27e('0x88'),_0xd27e('0x89'),_0xd27e('0x5a'),_0xd27e('0x8a'),'problem_id',_0xd27e('0x8b'),_0xd27e('0x8c'),'activity_due',_0xd27e('0x8d'),_0xd27e('0x8e'),'comments',_0xd27e('0x8f'),_0xd27e('0x90'),_0xd27e('0x91'),_0xd27e('0x92'),_0xd27e('0x93'),_0xd27e('0x94'),_0xd27e('0x95'),_0xd27e('0x96'),_0xd27e('0x97'),_0xd27e('0x98'),_0xd27e('0x99'),'category'];var _0x48004b='';var _0x573c84='';var _0x3c4140=[];var _0x5138a0='';var _0x380d59='';var _0x17987f=[];var _0xcf14ef='';var _0x20d892='';var _0x388c21={};var _0x617b9d='';return db[_0xd27e('0x2b')]['findOne']({'where':{'id':_0x2cabdf[_0xd27e('0x48')]['id']},'attributes':['id',_0xd27e('0x9a'),_0xd27e('0x9b'),_0xd27e('0x9c'),_0xd27e('0x9d'),_0xd27e('0x9e')]})[_0xd27e('0x24')](handleEntityNotFound(_0x312fe6,null))['then'](function(_0x32e9b9){if(_0x32e9b9){_0x617b9d=_0x32e9b9[_0xd27e('0x9d')];var _0x131189=_0x617b9d[_0xd27e('0x9f')](-0x1);if(_0x131189==='/'){_0x617b9d=_0x617b9d[_0xd27e('0xa0')](0x0,_0x617b9d[_0xd27e('0xa1')](_0x131189));}_0x20d892=util[_0xd27e('0xa2')](_0xd27e('0xa3'),_0x617b9d);_0xcf14ef=util[_0xd27e('0xa2')](_0xd27e('0xa4'),_0x617b9d);_0x388c21={'user':_0x32e9b9[_0xd27e('0x9a')],'pass':_0x32e9b9['password']};var _0x3c3246={'method':_0xd27e('0xa5'),'uri':_0x20d892+_0xd27e('0xa6'),'auth':_0x388c21,'json':!![]};return rp(_0x3c3246);}})[_0xd27e('0x24')](function(_0x3ee4e4){if(_0x3ee4e4[_0xd27e('0xa7')][_0xd27e('0x35')]>0x0){_0x48004b=_0x3ee4e4[_0xd27e('0xa7')];}console[_0xd27e('0xa8')](_0xd27e('0xa9'),_0x48004b);_0x17987f=[];_0x573c84=Object['assign']([],_0x48004b);_[_0xd27e('0xaa')](_0x573c84,function(_0x5c0c31){return!_0x32b166['includes'](_0x5c0c31[_0xd27e('0x27')]);});_0x573c84[_0xd27e('0xab')](function(_0x4771a9){var _0x4a75e9=createFieldObject(_0xcf14ef,_0x388c21,_0x4771a9['internalType'],_0x4771a9[_0xd27e('0x27')],_0x4771a9[_0xd27e('0xac')],![]);_0x17987f[_0xd27e('0xad')](_0x4a75e9);});return Promise[_0xd27e('0xae')](_0x17987f);})[_0xd27e('0x24')](function(_0xc4cc7a){_0x3c4140=_0xc4cc7a;_0x5138a0=Object['assign']([],_0x48004b);console[_0xd27e('0xa8')]('TCL:\x20_object',_0x48004b);_[_0xd27e('0xaa')](_0x5138a0,function(_0x755b7e){return _0xe4587a['includes'](_0x755b7e['name']);});console['log'](_0xd27e('0xaf'),_0x5138a0);_0x17987f=[];_0x5138a0[_0xd27e('0xab')](function(_0x572fdd){var _0x559f68=createFieldObject(_0xcf14ef,_0x388c21,_0x572fdd[_0xd27e('0xb0')],_0x572fdd[_0xd27e('0x27')],_0x572fdd[_0xd27e('0xac')],!![]);_0x17987f[_0xd27e('0xad')](_0x559f68);});return Promise[_0xd27e('0xae')](_0x17987f);})['then'](function(_0x525d3a){_0x380d59=_0x525d3a;var _0x3219b2=_0x3c4140[_0xd27e('0xb1')](_0x380d59);return{'count':_0x3219b2[_0xd27e('0x35')],'rows':_0x3219b2};})['then'](respondWithResult(_0x312fe6,null))[_0xd27e('0x43')](function(_0x24ae5d){console[_0xd27e('0xa8')](_0xd27e('0xb2')+_0x24ae5d);var _0x3d6ad6=_0x2cabdf[_0xd27e('0x2f')][_0xd27e('0xb3')]?0x1f4:_0x24ae5d[_0xd27e('0xb4')]||0x1f4;logger[_0xd27e('0xb5')](_0x24ae5d['stack']);delete _0x24ae5d[_0xd27e('0x27')];if(_0x3d6ad6===0x191){_0x3d6ad6=0x190;}_0x312fe6['status'](_0x3d6ad6)[_0xd27e('0x28')](_0x2cabdf[_0xd27e('0x2f')][_0xd27e('0xb3')]?{'message':_0xd27e('0xb6'),'statusCode':_0x24ae5d[_0xd27e('0xb4')]}:_0x24ae5d);});};function createFieldObject(_0x1410d6,_0x4a413e,_0x1bae05,_0x479725,_0x27bf2a,_0x30c74b){return new Promise(function(_0x1541f8,_0x1f9b50){var _0x55326d={'id':_0x479725,'name':_0x27bf2a,'custom':_0x30c74b};if(_0x1bae05===_0xd27e('0xb7')){_0x55326d[_0xd27e('0x3e')]=[{'name':'True','value':'true'},{'name':'False','value':'false'}];_0x1541f8(_0x55326d);}else{var _0x21e929={'method':_0xd27e('0xa5'),'uri':_0x1410d6+_0xd27e('0xb8')+_0x479725,'auth':_0x4a413e,'json':!![]};return rp(_0x21e929)[_0xd27e('0x24')](function(_0x5c7eb3){var _0x24e2e9=[];if(_0x5c7eb3[_0xd27e('0xa7')]['length']>0x0){_0x5c7eb3[_0xd27e('0xa7')][_0xd27e('0xab')](function(_0x15f272){if(_0x15f272[_0xd27e('0xb9')]===_0xd27e('0xba')){var _0x3c6b73={'name':_0x15f272[_0xd27e('0xac')],'value':_0x15f272[_0xd27e('0xbb')]};_0x24e2e9[_0xd27e('0xad')](_0x3c6b73);}});}_0x55326d['options']=_0x24e2e9;if(_0x55326d[_0xd27e('0x3e')][_0xd27e('0x35')]>0x0){_0x1541f8(_0x55326d);}else{if(_0x30c74b==![]){_0x1541f8();}else{_0x1541f8(_0x55326d);}}});}});} \ No newline at end of file +var _0xf161=['user_input','sys_created_on','state','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','forEach','internalType','label','assign','log','TCL:\x20_object','includes','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','True','False','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','destroy','then','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','ServicenowConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by'];(function(_0x3c57c7,_0x18e494){var _0x9c2cbb=function(_0x4195d0){while(--_0x4195d0){_0x3c57c7['push'](_0x3c57c7['shift']());}};_0x9c2cbb(++_0x18e494);}(_0xf161,0x1bc));var _0x1f16=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xf161[_0x519756];return _0x37047e;};'use strict';var emlformat=require(_0x1f16('0x0'));var rimraf=require(_0x1f16('0x1'));var zipdir=require(_0x1f16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f16('0x3'));var moment=require(_0x1f16('0x4'));var BPromise=require(_0x1f16('0x5'));var Mustache=require(_0x1f16('0x6'));var util=require(_0x1f16('0x7'));var path=require(_0x1f16('0x8'));var sox=require(_0x1f16('0x9'));var csv=require(_0x1f16('0xa'));var ejs=require(_0x1f16('0xb'));var fs=require('fs');var fs_extra=require(_0x1f16('0xc'));var _=require(_0x1f16('0xd'));var squel=require(_0x1f16('0xe'));var crypto=require('crypto');var jsforce=require(_0x1f16('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1f16('0xa'));var querystring=require(_0x1f16('0x10'));var Papa=require(_0x1f16('0x11'));var Redis=require(_0x1f16('0x12'));var authService=require(_0x1f16('0x13'));var qs=require(_0x1f16('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f16('0x15'));var logger=require(_0x1f16('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1f16('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f16('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x498f8d,_0x2159c8){_0x2159c8=_0x2159c8||0xcc;return function(_0x3d7993){if(_0x3d7993){return _0x498f8d[_0x1f16('0x19')](_0x2159c8);}return _0x498f8d[_0x1f16('0x1a')](_0x2159c8)[_0x1f16('0x1b')]();};}function respondWithResult(_0x11e3b4,_0x1c9c8a){_0x1c9c8a=_0x1c9c8a||0xc8;return function(_0x28cf2d){if(_0x28cf2d){return _0x11e3b4[_0x1f16('0x1a')](_0x1c9c8a)[_0x1f16('0x1c')](_0x28cf2d);}};}function respondWithFilteredResult(_0x10e4f9,_0x26e742){return function(_0x4c317d){if(_0x4c317d){var _0x48f799=typeof _0x26e742['offset']===_0x1f16('0x1d')&&typeof _0x26e742[_0x1f16('0x1e')]===_0x1f16('0x1d');var _0x543018=_0x4c317d['count'];var _0x416e23=_0x48f799?0x0:_0x26e742['offset'];var _0xd8b56f=_0x48f799?_0x4c317d[_0x1f16('0x1f')]:_0x26e742[_0x1f16('0x20')]+_0x26e742[_0x1f16('0x1e')];var _0x1023cc;if(_0xd8b56f>=_0x543018){_0xd8b56f=_0x543018;_0x1023cc=0xc8;}else{_0x1023cc=0xce;}_0x10e4f9['status'](_0x1023cc);return _0x10e4f9[_0x1f16('0x21')]('Content-Range',_0x416e23+'-'+_0xd8b56f+'/'+_0x543018)[_0x1f16('0x1c')](_0x4c317d);}return null;};}function patchUpdates(_0x457e31){return function(_0x427d6f){try{jsonpatch['apply'](_0x427d6f,_0x457e31,!![]);}catch(_0x2da782){return BPromise[_0x1f16('0x22')](_0x2da782);}return _0x427d6f[_0x1f16('0x23')]();};}function saveUpdates(_0x5aebe0,_0x2c7ade){return function(_0x22cc9a){if(_0x22cc9a){return _0x22cc9a['update'](_0x5aebe0)['then'](function(_0x58c033){return _0x58c033;});}return null;};}function removeEntity(_0x41e8ba,_0xc94658){return function(_0x292b50){if(_0x292b50){return _0x292b50[_0x1f16('0x24')]()[_0x1f16('0x25')](function(){_0x41e8ba['status'](0xcc)[_0x1f16('0x1b')]();});}};}function handleEntityNotFound(_0x333947,_0x35bf84){return function(_0x23733f){if(!_0x23733f){_0x333947['sendStatus'](0x194);}return _0x23733f;};}function handleError(_0x207b72,_0x4ee37d){_0x4ee37d=_0x4ee37d||0x1f4;return function(_0x33e7c7){logger['error'](_0x33e7c7[_0x1f16('0x26')]);if(_0x33e7c7['name']){delete _0x33e7c7[_0x1f16('0x27')];}_0x207b72[_0x1f16('0x1a')](_0x4ee37d)[_0x1f16('0x28')](_0x33e7c7);};}exports['index']=function(_0x17f79e,_0x24376e){var _0x46903c={},_0x1a812f={},_0x4edcf3={'count':0x0,'rows':[]};var _0x12acf5=_[_0x1f16('0x29')](db[_0x1f16('0x2a')][_0x1f16('0x2b')],function(_0x259c2a){return{'name':_0x259c2a[_0x1f16('0x2c')],'type':_0x259c2a[_0x1f16('0x2d')][_0x1f16('0x2e')]};});_0x1a812f[_0x1f16('0x2f')]=_[_0x1f16('0x29')](_0x12acf5,_0x1f16('0x27'));_0x1a812f[_0x1f16('0x30')]=_[_0x1f16('0x31')](_0x17f79e[_0x1f16('0x30')]);_0x1a812f['filters']=_[_0x1f16('0x32')](_0x1a812f['model'],_0x1a812f[_0x1f16('0x30')]);_0x46903c[_0x1f16('0x33')]=_[_0x1f16('0x32')](_0x1a812f['model'],qs[_0x1f16('0x34')](_0x17f79e['query']['fields']));_0x46903c[_0x1f16('0x33')]=_0x46903c[_0x1f16('0x33')][_0x1f16('0x35')]?_0x46903c['attributes']:_0x1a812f[_0x1f16('0x2f')];if(!_0x17f79e[_0x1f16('0x30')][_0x1f16('0x36')](_0x1f16('0x37'))){_0x46903c[_0x1f16('0x1e')]=qs[_0x1f16('0x1e')](_0x17f79e[_0x1f16('0x30')][_0x1f16('0x1e')]);_0x46903c[_0x1f16('0x20')]=qs[_0x1f16('0x20')](_0x17f79e[_0x1f16('0x30')]['offset']);}_0x46903c[_0x1f16('0x38')]=qs['sort'](_0x17f79e[_0x1f16('0x30')][_0x1f16('0x39')]);_0x46903c[_0x1f16('0x3a')]=qs[_0x1f16('0x3b')](_['pick'](_0x17f79e[_0x1f16('0x30')],_0x1a812f[_0x1f16('0x3b')]),_0x12acf5);if(_0x17f79e[_0x1f16('0x30')][_0x1f16('0x3c')]){_0x46903c[_0x1f16('0x3a')]=_[_0x1f16('0x3d')](_0x46903c[_0x1f16('0x3a')],{'$or':_[_0x1f16('0x29')](_0x12acf5,function(_0x1900eb){if(_0x1900eb[_0x1f16('0x2d')]!=='VIRTUAL'){var _0x79c44a={};_0x79c44a[_0x1900eb[_0x1f16('0x27')]]={'$like':'%'+_0x17f79e[_0x1f16('0x30')][_0x1f16('0x3c')]+'%'};return _0x79c44a;}})});}_0x46903c=_[_0x1f16('0x3d')]({},_0x46903c,_0x17f79e[_0x1f16('0x3e')]);var _0x1a1552={'where':_0x46903c[_0x1f16('0x3a')]};return db['ServicenowAccount']['count'](_0x1a1552)['then'](function(_0x9fb7){_0x4edcf3[_0x1f16('0x1f')]=_0x9fb7;if(_0x17f79e[_0x1f16('0x30')][_0x1f16('0x3f')]){_0x46903c['include']=[{'all':!![]}];}return db[_0x1f16('0x2a')][_0x1f16('0x40')](_0x46903c);})[_0x1f16('0x25')](function(_0x3d8c42){_0x4edcf3[_0x1f16('0x41')]=_0x3d8c42;return _0x4edcf3;})['then'](respondWithFilteredResult(_0x24376e,_0x46903c))['catch'](handleError(_0x24376e,null));};exports[_0x1f16('0x42')]=function(_0x3f41f3,_0x1f5ddf){var _0x5198b0={'raw':![],'where':{'id':_0x3f41f3[_0x1f16('0x43')]['id']}},_0x5e82df={};_0x5e82df['model']=_[_0x1f16('0x31')](db[_0x1f16('0x2a')][_0x1f16('0x2b')]);_0x5e82df[_0x1f16('0x30')]=_['keys'](_0x3f41f3['query']);_0x5e82df[_0x1f16('0x3b')]=_[_0x1f16('0x32')](_0x5e82df[_0x1f16('0x2f')],_0x5e82df[_0x1f16('0x30')]);_0x5198b0[_0x1f16('0x33')]=_['intersection'](_0x5e82df['model'],qs[_0x1f16('0x34')](_0x3f41f3['query'][_0x1f16('0x34')]));_0x5198b0['attributes']=_0x5198b0[_0x1f16('0x33')]['length']?_0x5198b0[_0x1f16('0x33')]:_0x5e82df[_0x1f16('0x2f')];if(_0x3f41f3[_0x1f16('0x30')]['includeAll']){_0x5198b0[_0x1f16('0x44')]=[{'all':!![]}];}_0x5198b0=_[_0x1f16('0x3d')]({},_0x5198b0,_0x3f41f3[_0x1f16('0x3e')]);return db['ServicenowAccount'][_0x1f16('0x45')](_0x5198b0)[_0x1f16('0x25')](handleEntityNotFound(_0x1f5ddf,null))[_0x1f16('0x25')](respondWithResult(_0x1f5ddf,null))[_0x1f16('0x46')](handleError(_0x1f5ddf,null));};exports['create']=function(_0x204f33,_0x18016a){return db[_0x1f16('0x2a')][_0x1f16('0x47')](_0x204f33[_0x1f16('0x48')],{})[_0x1f16('0x25')](respondWithResult(_0x18016a,0xc9))[_0x1f16('0x46')](handleError(_0x18016a,null));};exports['update']=function(_0x13d201,_0x40d7a5){if(_0x13d201[_0x1f16('0x48')]['id']){delete _0x13d201[_0x1f16('0x48')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x13d201[_0x1f16('0x43')]['id']}})[_0x1f16('0x25')](handleEntityNotFound(_0x40d7a5,null))[_0x1f16('0x25')](saveUpdates(_0x13d201['body'],null))[_0x1f16('0x25')](respondWithResult(_0x40d7a5,null))[_0x1f16('0x46')](handleError(_0x40d7a5,null));};exports[_0x1f16('0x24')]=function(_0x4c6df5,_0x818b89){return db[_0x1f16('0x2a')]['find']({'where':{'id':_0x4c6df5[_0x1f16('0x43')]['id']}})[_0x1f16('0x25')](handleEntityNotFound(_0x818b89,null))[_0x1f16('0x25')](removeEntity(_0x818b89,null))[_0x1f16('0x46')](handleError(_0x818b89,null));};exports[_0x1f16('0x49')]=function(_0x29cda0,_0x59b56f,_0x1fa85f){var _0x3c98dc={};var _0x4f1f65={};var _0x414e0d;var _0x327d7c;return db['ServicenowAccount']['findOne']({'where':{'id':_0x29cda0[_0x1f16('0x43')]['id']}})[_0x1f16('0x25')](handleEntityNotFound(_0x59b56f,null))[_0x1f16('0x25')](function(_0xea2695){if(_0xea2695){_0x414e0d=_0xea2695;_0x4f1f65[_0x1f16('0x2f')]=_['keys'](db[_0x1f16('0x4a')][_0x1f16('0x2b')]);_0x4f1f65['query']=_['keys'](_0x29cda0['query']);_0x4f1f65[_0x1f16('0x3b')]=_[_0x1f16('0x32')](_0x4f1f65[_0x1f16('0x2f')],_0x4f1f65['query']);_0x3c98dc[_0x1f16('0x33')]=_[_0x1f16('0x32')](_0x4f1f65[_0x1f16('0x2f')],qs[_0x1f16('0x34')](_0x29cda0[_0x1f16('0x30')]['fields']));_0x3c98dc[_0x1f16('0x33')]=_0x3c98dc[_0x1f16('0x33')]['length']?_0x3c98dc[_0x1f16('0x33')]:_0x4f1f65[_0x1f16('0x2f')];_0x3c98dc[_0x1f16('0x38')]=qs[_0x1f16('0x39')](_0x29cda0[_0x1f16('0x30')][_0x1f16('0x39')]);_0x3c98dc[_0x1f16('0x3a')]=qs['filters'](_[_0x1f16('0x4b')](_0x29cda0[_0x1f16('0x30')],_0x4f1f65[_0x1f16('0x3b')]));if(_0x29cda0[_0x1f16('0x30')][_0x1f16('0x3c')]){_0x3c98dc[_0x1f16('0x3a')]=_[_0x1f16('0x3d')](_0x3c98dc['where'],{'$or':_[_0x1f16('0x29')](_0x3c98dc['attributes'],function(_0x240e27){var _0x6ee8de={};_0x6ee8de[_0x240e27]={'$like':'%'+_0x29cda0[_0x1f16('0x30')][_0x1f16('0x3c')]+'%'};return _0x6ee8de;})});}_0x3c98dc=_[_0x1f16('0x3d')]({},_0x3c98dc,_0x29cda0[_0x1f16('0x3e')]);return _0x414e0d[_0x1f16('0x49')](_0x3c98dc);}})[_0x1f16('0x25')](function(_0x3e5936){if(_0x3e5936){_0x327d7c=_0x3e5936[_0x1f16('0x35')];if(!_0x29cda0['query'][_0x1f16('0x36')](_0x1f16('0x37'))){_0x3c98dc[_0x1f16('0x1e')]=qs[_0x1f16('0x1e')](_0x29cda0[_0x1f16('0x30')][_0x1f16('0x1e')]);_0x3c98dc[_0x1f16('0x20')]=qs[_0x1f16('0x20')](_0x29cda0[_0x1f16('0x30')][_0x1f16('0x20')]);}return _0x414e0d[_0x1f16('0x49')](_0x3c98dc);}})[_0x1f16('0x25')](function(_0x2225b0){if(_0x2225b0){return _0x2225b0?{'count':_0x327d7c,'rows':_0x2225b0}:null;}})[_0x1f16('0x25')](respondWithResult(_0x59b56f,null))[_0x1f16('0x46')](handleError(_0x59b56f,null));};exports[_0x1f16('0x4c')]=function(_0x5901fb,_0x4e4157,_0x3770c2){if(_0x5901fb['body']['id']){delete _0x5901fb[_0x1f16('0x48')]['id'];}return db[_0x1f16('0x2a')][_0x1f16('0x4d')]({'where':{'id':_0x5901fb[_0x1f16('0x43')]['id']}})[_0x1f16('0x25')](handleEntityNotFound(_0x4e4157,null))['then'](function(_0x3b5620){if(_0x3b5620){_0x5901fb[_0x1f16('0x48')][_0x1f16('0x4e')]=_0x3b5620['id'];_0x5901fb[_0x1f16('0x48')]['Subjects']=integrations[_0x1f16('0x4f')](_0x5901fb[_0x1f16('0x48')][_0x1f16('0x50')],_0x5901fb[_0x1f16('0x48')][_0x1f16('0x2d')]);_0x5901fb['body'][_0x1f16('0x51')]=integrations[_0x1f16('0x52')](_0x5901fb['body'][_0x1f16('0x50')],_0x5901fb[_0x1f16('0x48')]['type']);return db[_0x1f16('0x4a')][_0x1f16('0x47')](_0x5901fb[_0x1f16('0x48')],{'include':[{'model':db[_0x1f16('0x53')],'as':_0x1f16('0x54')},{'model':db[_0x1f16('0x53')],'as':_0x1f16('0x51')}]});}return null;})[_0x1f16('0x25')](respondWithResult(_0x4e4157,null))[_0x1f16('0x46')](handleError(_0x4e4157,null));};exports[_0x1f16('0x55')]=function(_0x165ecd,_0x3f2ed6,_0x3cc104){var _0x450ccd=[_0x1f16('0x56'),_0x1f16('0x57'),_0x1f16('0x58'),_0x1f16('0x59'),_0x1f16('0x5a'),_0x1f16('0x5b'),_0x1f16('0x5c'),_0x1f16('0x5d'),'category'];var _0x34e722=[_0x1f16('0x5e'),_0x1f16('0x56'),_0x1f16('0x5f'),'watch_list','upon_reject',_0x1f16('0x60'),_0x1f16('0x61'),_0x1f16('0x57'),_0x1f16('0x62'),_0x1f16('0x63'),_0x1f16('0x64'),'sys_updated_by',_0x1f16('0x65'),_0x1f16('0x66'),_0x1f16('0x67'),'sys_domain',_0x1f16('0x68'),'sys_created_by','knowledge',_0x1f16('0x38'),'calendar_stc',_0x1f16('0x69'),_0x1f16('0x6a'),_0x1f16('0x6b'),_0x1f16('0x6c'),_0x1f16('0x6d'),'work_notes_list',_0x1f16('0x6e'),_0x1f16('0x6f'),_0x1f16('0x70'),'rfc',_0x1f16('0x71'),_0x1f16('0x72'),_0x1f16('0x73'),_0x1f16('0x74'),'group_list',_0x1f16('0x75'),_0x1f16('0x76'),'resolved_at',_0x1f16('0x77'),_0x1f16('0x78'),_0x1f16('0x59'),_0x1f16('0x79'),_0x1f16('0x7a'),_0x1f16('0x5a'),_0x1f16('0x7b'),_0x1f16('0x7c'),_0x1f16('0x7d'),'assignment_group',_0x1f16('0x7e'),_0x1f16('0x7f'),'description',_0x1f16('0x80'),_0x1f16('0x5b'),_0x1f16('0x81'),_0x1f16('0x82'),_0x1f16('0x83'),_0x1f16('0x84'),_0x1f16('0x85'),_0x1f16('0x86'),_0x1f16('0x87'),_0x1f16('0x88'),_0x1f16('0x5c'),'urgency',_0x1f16('0x89'),_0x1f16('0x8a'),'reassignment_count',_0x1f16('0x8b'),_0x1f16('0x8c'),'severity',_0x1f16('0x8d'),_0x1f16('0x8e'),_0x1f16('0x8f'),_0x1f16('0x90'),_0x1f16('0x91'),'sys_mod_count',_0x1f16('0x92'),'sys_tags',_0x1f16('0x93'),'upon_approval',_0x1f16('0x94'),_0x1f16('0x95'),'category'];var _0xb9d56d='';var _0x3303ec='';var _0x2b00e6=[];var _0x2d4762='';var _0x13d2d9='';var _0x1dc9e7=[];var _0x2559f6='';var _0x4f09f6='';var _0x3378ba={};var _0x304039='';return db[_0x1f16('0x2a')][_0x1f16('0x4d')]({'where':{'id':_0x165ecd[_0x1f16('0x43')]['id']},'attributes':['id',_0x1f16('0x96'),_0x1f16('0x97'),'email',_0x1f16('0x98'),_0x1f16('0x99')]})[_0x1f16('0x25')](handleEntityNotFound(_0x3f2ed6,null))[_0x1f16('0x25')](function(_0x2e0dd8){if(_0x2e0dd8){_0x304039=_0x2e0dd8['remoteUri'];var _0x43f92d=_0x304039[_0x1f16('0x9a')](-0x1);if(_0x43f92d==='/'){_0x304039=_0x304039[_0x1f16('0x9b')](0x0,_0x304039[_0x1f16('0x9c')](_0x43f92d));}_0x4f09f6=util[_0x1f16('0x9d')](_0x1f16('0x9e'),_0x304039);_0x2559f6=util[_0x1f16('0x9d')]('%s/api/now/table/',_0x304039);_0x3378ba={'user':_0x2e0dd8[_0x1f16('0x96')],'pass':_0x2e0dd8[_0x1f16('0x97')]};var _0x4b9bfa={'method':_0x1f16('0x9f'),'uri':_0x4f09f6+_0x1f16('0xa0'),'auth':_0x3378ba,'json':!![]};return rp(_0x4b9bfa);}})['then'](function(_0x3df6ba){if(_0x3df6ba[_0x1f16('0xa1')][_0x1f16('0x35')]>0x0){_0xb9d56d=_0x3df6ba[_0x1f16('0xa1')];}console['log'](_0x1f16('0xa2'),_0xb9d56d);_0x1dc9e7=[];_0x3303ec=Object['assign']([],_0xb9d56d);_['remove'](_0x3303ec,function(_0x5c156d){return!_0x450ccd['includes'](_0x5c156d['name']);});_0x3303ec[_0x1f16('0xa3')](function(_0x5c4ba8){var _0xd934ca=createFieldObject(_0x2559f6,_0x3378ba,_0x5c4ba8[_0x1f16('0xa4')],_0x5c4ba8[_0x1f16('0x27')],_0x5c4ba8[_0x1f16('0xa5')],![]);_0x1dc9e7['push'](_0xd934ca);});return Promise['all'](_0x1dc9e7);})['then'](function(_0x5d87e2){_0x2b00e6=_0x5d87e2;_0x2d4762=Object[_0x1f16('0xa6')]([],_0xb9d56d);console[_0x1f16('0xa7')](_0x1f16('0xa8'),_0xb9d56d);_['remove'](_0x2d4762,function(_0x287895){return _0x34e722[_0x1f16('0xa9')](_0x287895['name']);});console[_0x1f16('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x2d4762);_0x1dc9e7=[];_0x2d4762[_0x1f16('0xa3')](function(_0xf5adfe){var _0x470e9e=createFieldObject(_0x2559f6,_0x3378ba,_0xf5adfe[_0x1f16('0xa4')],_0xf5adfe[_0x1f16('0x27')],_0xf5adfe[_0x1f16('0xa5')],!![]);_0x1dc9e7[_0x1f16('0xaa')](_0x470e9e);});return Promise['all'](_0x1dc9e7);})['then'](function(_0x2da884){_0x13d2d9=_0x2da884;var _0x158e98=_0x2b00e6[_0x1f16('0xab')](_0x13d2d9);return{'count':_0x158e98['length'],'rows':_0x158e98};})[_0x1f16('0x25')](respondWithResult(_0x3f2ed6,null))['catch'](function(_0x5d0bf1){console[_0x1f16('0xa7')](_0x1f16('0xac')+_0x5d0bf1);var _0x50cb28=_0x165ecd[_0x1f16('0x30')][_0x1f16('0xad')]?0x1f4:_0x5d0bf1[_0x1f16('0xae')]||0x1f4;logger[_0x1f16('0xaf')](_0x5d0bf1[_0x1f16('0x26')]);delete _0x5d0bf1['name'];if(_0x50cb28===0x191){_0x50cb28=0x190;}_0x3f2ed6[_0x1f16('0x1a')](_0x50cb28)[_0x1f16('0x28')](_0x165ecd[_0x1f16('0x30')]['test']?{'message':_0x1f16('0xb0'),'statusCode':_0x5d0bf1[_0x1f16('0xae')]}:_0x5d0bf1);});};function createFieldObject(_0x5803cf,_0x2e233d,_0x4ee886,_0x25791d,_0x10be27,_0x3ff5d0){return new Promise(function(_0x39e0c8,_0x16c807){var _0xa8b8fc={'id':_0x25791d,'name':_0x10be27,'custom':_0x3ff5d0};if(_0x4ee886===_0x1f16('0xb1')){_0xa8b8fc[_0x1f16('0x3e')]=[{'name':_0x1f16('0xb2'),'value':'true'},{'name':_0x1f16('0xb3'),'value':_0x1f16('0xb4')}];_0x39e0c8(_0xa8b8fc);}else{var _0x536b0f={'method':_0x1f16('0x9f'),'uri':_0x5803cf+'sys_choice?sysparm_query=name=incident^element='+_0x25791d,'auth':_0x2e233d,'json':!![]};return rp(_0x536b0f)['then'](function(_0xc2ad79){var _0x5a2528=[];if(_0xc2ad79['result'][_0x1f16('0x35')]>0x0){_0xc2ad79['result'][_0x1f16('0xa3')](function(_0x411a48){if(_0x411a48['inactive']===_0x1f16('0xb4')){var _0x2e2150={'name':_0x411a48['label'],'value':_0x411a48[_0x1f16('0xb5')]};_0x5a2528[_0x1f16('0xaa')](_0x2e2150);}});}_0xa8b8fc[_0x1f16('0x3e')]=_0x5a2528;if(_0xa8b8fc[_0x1f16('0x3e')][_0x1f16('0x35')]>0x0){_0x39e0c8(_0xa8b8fc);}else{if(_0x3ff5d0==![]){_0x39e0c8();}else{_0x39e0c8(_0xa8b8fc);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7763e92..0d99c91 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 _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x80acc5,_0x3698fd){var _0x1dbd9e=function(_0x5945f5){while(--_0x5945f5){_0x80acc5['push'](_0x80acc5['shift']());}};_0x1dbd9e(++_0x3698fd);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4488cc,_0x45c59e){_0x4488cc=_0x4488cc-0x0;var _0xdeac84=_0xd8fb[_0x4488cc];return _0xdeac84;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x2b39af,_0x5562f1){var _0x5a5c60=function(_0x4fd7a5){while(--_0x4fd7a5){_0x2b39af['push'](_0x2b39af['shift']());}};_0x5a5c60(++_0x5562f1);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 2f7e4d2..dbdbeb3 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 _0x610c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','attributes','include','map','model','find','raw','where','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x508e60,_0x47d27c){var _0x46148f=function(_0x49a6b4){while(--_0x49a6b4){_0x508e60['push'](_0x508e60['shift']());}};_0x46148f(++_0x47d27c);}(_0x610c,0xd8));var _0xc610=function(_0x5ade06,_0x321e8a){_0x5ade06=_0x5ade06-0x0;var _0xccce41=_0x610c[_0x5ade06];return _0xccce41;};'use strict';var _=require(_0xc610('0x0'));var util=require(_0xc610('0x1'));var moment=require('moment');var BPromise=require(_0xc610('0x2'));var rs=require(_0xc610('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc610('0x4'))['db'];var utils=require(_0xc610('0x5'));var logger=require(_0xc610('0x6'))(_0xc610('0x7'));var config=require(_0xc610('0x8'));var jayson=require(_0xc610('0x9'));var client=jayson[_0xc610('0xa')][_0xc610('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1774f0,_0x19cbe5,_0x52c039){return new BPromise(function(_0x36c94b,_0x2617b8){return client[_0xc610('0xc')](_0x1774f0,_0x52c039)[_0xc610('0xd')](function(_0x5e9c55){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x19cbe5,_0xc610('0xe'));logger[_0xc610('0xf')](_0xc610('0x10'),_0x19cbe5,'request\x20sent',JSON[_0xc610('0x11')](_0x5e9c55));if(_0x5e9c55[_0xc610('0x12')]){if(_0x5e9c55['error'][_0xc610('0x13')]===0x1f4){logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);return _0x2617b8(_0x5e9c55[_0xc610('0x12')]['message']);}logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);return _0x36c94b(_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);}else{logger[_0xc610('0x16')](_0xc610('0x14'),_0x19cbe5,_0xc610('0xe'));_0x36c94b(_0x5e9c55[_0xc610('0x17')]['message']);}})[_0xc610('0x18')](function(_0x31107a){logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x31107a);_0x2617b8(_0x31107a);});});}exports[_0xc610('0x19')]=function(_0x4e8745){var _0x4bbbf1=this;return new Promise(function(_0x1c86a3,_0x509316){return db[_0xc610('0x1a')][_0xc610('0x1b')]({'raw':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e8745['options']?_0x4e8745[_0xc610('0x1c')]['where']||null:null,'attributes':_0x4e8745[_0xc610('0x1c')]?_0x4e8745['options'][_0xc610('0x1d')]||null:null,'limit':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')]['limit']||null:null,'include':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')][_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x4e8745['options'][_0xc610('0x1e')],function(_0x270e66){return{'model':db[_0x270e66[_0xc610('0x20')]],'as':_0x270e66['as'],'attributes':_0x270e66['attributes'],'include':_0x270e66[_0xc610('0x1e')]?_['map'](_0x270e66['include'],function(_0x4ad09d){return{'model':db[_0x4ad09d['model']],'as':_0x4ad09d['as'],'attributes':_0x4ad09d[_0xc610('0x1d')],'include':_0x4ad09d[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x4ad09d[_0xc610('0x1e')],function(_0x50eadc){return{'model':db[_0x50eadc[_0xc610('0x20')]],'as':_0x50eadc['as'],'attributes':_0x50eadc[_0xc610('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc610('0xd')](function(_0x558ab0){logger['info']('GetServicenowAccount',_0x4e8745);logger[_0xc610('0xf')](_0xc610('0x19'),_0x4e8745,JSON['stringify'](_0x558ab0));_0x1c86a3(_0x558ab0);})[_0xc610('0x18')](function(_0x2b60b9){logger[_0xc610('0x12')](_0xc610('0x19'),_0x2b60b9[_0xc610('0x15')],_0x4e8745);_0x509316(_0x4bbbf1['error'](0x1f4,_0x2b60b9[_0xc610('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x5cde3b){var _0x21d2e3=this;return new Promise(function(_0x249465,_0x42c753){return db[_0xc610('0x1a')][_0xc610('0x21')]({'raw':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x22')]===undefined?!![]:![]:!![],'where':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x23')]||null:null,'attributes':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x1d')]||null:null,'include':_0x5cde3b['options']?_0x5cde3b['options'][_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x5cde3b[_0xc610('0x1c')]['include'],function(_0x2eec39){return{'model':db[_0x2eec39[_0xc610('0x20')]],'as':_0x2eec39['as'],'attributes':_0x2eec39['attributes'],'include':_0x2eec39[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x2eec39[_0xc610('0x1e')],function(_0x40e665){return{'model':db[_0x40e665[_0xc610('0x20')]],'as':_0x40e665['as'],'attributes':_0x40e665[_0xc610('0x1d')],'include':_0x40e665[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x40e665['include'],function(_0xdbb0f6){return{'model':db[_0xdbb0f6[_0xc610('0x20')]],'as':_0xdbb0f6['as'],'attributes':_0xdbb0f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33bbb2){logger[_0xc610('0x16')](_0xc610('0x24'),_0x5cde3b);logger[_0xc610('0xf')](_0xc610('0x24'),_0x5cde3b,JSON[_0xc610('0x11')](_0x33bbb2));_0x249465(_0x33bbb2);})[_0xc610('0x18')](function(_0x87a45){logger[_0xc610('0x12')](_0xc610('0x24'),_0x87a45[_0xc610('0x15')],_0x5cde3b);_0x42c753(_0x21d2e3[_0xc610('0x12')](0x1f4,_0x87a45[_0xc610('0x15')]));});});}; \ No newline at end of file +var _0xe57c=['model','attributes','GetServicenowAccount','ShowServicenowAccount','find','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','ServicenowAccount','findAll','options','raw','where','limit','include','map'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe57c,0x91));var _0xce57=function(_0x7862d6,_0x317528){_0x7862d6=_0x7862d6-0x0;var _0x44251e=_0xe57c[_0x7862d6];return _0x44251e;};'use strict';var _=require(_0xce57('0x0'));var util=require(_0xce57('0x1'));var moment=require('moment');var BPromise=require(_0xce57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce57('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce57('0x4'));var logger=require(_0xce57('0x5'))(_0xce57('0x6'));var config=require(_0xce57('0x7'));var jayson=require(_0xce57('0x8'));var client=jayson[_0xce57('0x9')][_0xce57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a905b,_0x4123d8,_0xa2805c){return new BPromise(function(_0x52f06f,_0x70b011){return client[_0xce57('0xb')](_0x2a905b,_0xa2805c)[_0xce57('0xc')](function(_0x38151d){logger['info'](_0xce57('0xd'),_0x4123d8,_0xce57('0xe'));logger[_0xce57('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4123d8,'request\x20sent',JSON['stringify'](_0x38151d));if(_0x38151d[_0xce57('0x10')]){if(_0x38151d['error'][_0xce57('0x11')]===0x1f4){logger[_0xce57('0x10')](_0xce57('0xd'),_0x4123d8,_0x38151d[_0xce57('0x10')]['message']);return _0x70b011(_0x38151d[_0xce57('0x10')][_0xce57('0x12')]);}logger['error'](_0xce57('0xd'),_0x4123d8,_0x38151d[_0xce57('0x10')][_0xce57('0x12')]);return _0x52f06f(_0x38151d['error'][_0xce57('0x12')]);}else{logger[_0xce57('0x13')](_0xce57('0xd'),_0x4123d8,'request\x20sent');_0x52f06f(_0x38151d[_0xce57('0x14')][_0xce57('0x12')]);}})[_0xce57('0x15')](function(_0x4997d9){logger['error'](_0xce57('0xd'),_0x4123d8,_0x4997d9);_0x70b011(_0x4997d9);});});}exports['GetServicenowAccount']=function(_0x4fb00d){var _0x16d10c=this;return new Promise(function(_0x55192e,_0x4762b9){return db[_0xce57('0x16')][_0xce57('0x17')]({'raw':_0x4fb00d[_0xce57('0x18')]?_0x4fb00d[_0xce57('0x18')][_0xce57('0x19')]===undefined?!![]:![]:!![],'where':_0x4fb00d[_0xce57('0x18')]?_0x4fb00d['options'][_0xce57('0x1a')]||null:null,'attributes':_0x4fb00d['options']?_0x4fb00d[_0xce57('0x18')]['attributes']||null:null,'limit':_0x4fb00d[_0xce57('0x18')]?_0x4fb00d['options'][_0xce57('0x1b')]||null:null,'include':_0x4fb00d[_0xce57('0x18')]?_0x4fb00d['options'][_0xce57('0x1c')]?_[_0xce57('0x1d')](_0x4fb00d[_0xce57('0x18')][_0xce57('0x1c')],function(_0x343c21){return{'model':db[_0x343c21[_0xce57('0x1e')]],'as':_0x343c21['as'],'attributes':_0x343c21[_0xce57('0x1f')],'include':_0x343c21[_0xce57('0x1c')]?_['map'](_0x343c21[_0xce57('0x1c')],function(_0x442f7f){return{'model':db[_0x442f7f['model']],'as':_0x442f7f['as'],'attributes':_0x442f7f[_0xce57('0x1f')],'include':_0x442f7f[_0xce57('0x1c')]?_[_0xce57('0x1d')](_0x442f7f[_0xce57('0x1c')],function(_0x3e05f0){return{'model':db[_0x3e05f0[_0xce57('0x1e')]],'as':_0x3e05f0['as'],'attributes':_0x3e05f0[_0xce57('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xce57('0xc')](function(_0x1b50b6){logger[_0xce57('0x13')](_0xce57('0x20'),_0x4fb00d);logger[_0xce57('0xf')](_0xce57('0x20'),_0x4fb00d,JSON['stringify'](_0x1b50b6));_0x55192e(_0x1b50b6);})[_0xce57('0x15')](function(_0xa6cb91){logger['error']('GetServicenowAccount',_0xa6cb91[_0xce57('0x12')],_0x4fb00d);_0x4762b9(_0x16d10c[_0xce57('0x10')](0x1f4,_0xa6cb91[_0xce57('0x12')]));});});};exports[_0xce57('0x21')]=function(_0x5a9a4b){var _0x5548ef=this;return new Promise(function(_0x2fb818,_0x568b5c){return db[_0xce57('0x16')][_0xce57('0x22')]({'raw':_0x5a9a4b[_0xce57('0x18')]?_0x5a9a4b[_0xce57('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a9a4b[_0xce57('0x18')]?_0x5a9a4b[_0xce57('0x18')]['where']||null:null,'attributes':_0x5a9a4b[_0xce57('0x18')]?_0x5a9a4b[_0xce57('0x18')][_0xce57('0x1f')]||null:null,'include':_0x5a9a4b[_0xce57('0x18')]?_0x5a9a4b[_0xce57('0x18')][_0xce57('0x1c')]?_[_0xce57('0x1d')](_0x5a9a4b[_0xce57('0x18')][_0xce57('0x1c')],function(_0x4e575f){return{'model':db[_0x4e575f[_0xce57('0x1e')]],'as':_0x4e575f['as'],'attributes':_0x4e575f[_0xce57('0x1f')],'include':_0x4e575f[_0xce57('0x1c')]?_['map'](_0x4e575f[_0xce57('0x1c')],function(_0xef29ec){return{'model':db[_0xef29ec[_0xce57('0x1e')]],'as':_0xef29ec['as'],'attributes':_0xef29ec[_0xce57('0x1f')],'include':_0xef29ec['include']?_[_0xce57('0x1d')](_0xef29ec[_0xce57('0x1c')],function(_0x5f109a){return{'model':db[_0x5f109a[_0xce57('0x1e')]],'as':_0x5f109a['as'],'attributes':_0x5f109a[_0xce57('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xce57('0xc')](function(_0x3d789f){logger['info'](_0xce57('0x21'),_0x5a9a4b);logger[_0xce57('0xf')](_0xce57('0x21'),_0x5a9a4b,JSON['stringify'](_0x3d789f));_0x2fb818(_0x3d789f);})['catch'](function(_0x4a23b4){logger['error'](_0xce57('0x21'),_0x4a23b4[_0xce57('0x12')],_0x5a9a4b);_0x568b5c(_0x5548ef[_0xce57('0x10')](0x1f4,_0x4a23b4['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 828c14d..b7d43b9 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 _0x54ab=['./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment'];(function(_0x3000c3,_0x50d95e){var _0x5c8bf0=function(_0x12da32){while(--_0x12da32){_0x3000c3['push'](_0x3000c3['shift']());}};_0x5c8bf0(++_0x50d95e);}(_0x54ab,0x102));var _0xb54a=function(_0x9570f3,_0x19cc4c){_0x9570f3=_0x9570f3-0x0;var _0x79c1a=_0x54ab[_0x9570f3];return _0x79c1a;};'use strict';var multer=require(_0xb54a('0x0'));var util=require(_0xb54a('0x1'));var path=require(_0xb54a('0x2'));var timeout=require(_0xb54a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb54a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb54a('0x5'));var controller=require(_0xb54a('0x6'));router[_0xb54a('0x7')]('/',auth[_0xb54a('0x8')](),controller[_0xb54a('0x9')]);router[_0xb54a('0x7')](_0xb54a('0xa'),auth[_0xb54a('0x8')](),controller[_0xb54a('0xb')]);router[_0xb54a('0x7')]('/:id/fields',auth[_0xb54a('0x8')](),controller[_0xb54a('0xc')]);router[_0xb54a('0x7')](_0xb54a('0xd'),auth[_0xb54a('0x8')](),controller[_0xb54a('0xe')]);router[_0xb54a('0x7')](_0xb54a('0xf'),auth['isAuthenticated'](),controller[_0xb54a('0x10')]);router[_0xb54a('0x11')]('/',auth[_0xb54a('0x8')](),controller[_0xb54a('0x12')]);router[_0xb54a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb54a('0x14')]);router[_0xb54a('0x15')](_0xb54a('0xa'),auth[_0xb54a('0x8')](),controller[_0xb54a('0x16')]);module[_0xb54a('0x17')]=router; \ No newline at end of file +var _0xd608=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x105d0d,_0x2b9b29){var _0x5eb3b8=function(_0x34a1fe){while(--_0x34a1fe){_0x105d0d['push'](_0x105d0d['shift']());}};_0x5eb3b8(++_0x2b9b29);}(_0xd608,0x10f));var _0x8d60=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd608[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8d60('0x0'));var util=require(_0x8d60('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d60('0x2'));var router=express['Router']();var fs_extra=require(_0x8d60('0x3'));var auth=require(_0x8d60('0x4'));var interaction=require(_0x8d60('0x5'));var config=require(_0x8d60('0x6'));var controller=require(_0x8d60('0x7'));router[_0x8d60('0x8')]('/',auth[_0x8d60('0x9')](),controller[_0x8d60('0xa')]);router[_0x8d60('0x8')](_0x8d60('0xb'),auth['isAuthenticated'](),controller[_0x8d60('0xc')]);router[_0x8d60('0x8')](_0x8d60('0xd'),auth[_0x8d60('0x9')](),controller[_0x8d60('0xe')]);router[_0x8d60('0x8')](_0x8d60('0xf'),auth[_0x8d60('0x9')](),controller[_0x8d60('0x10')]);router[_0x8d60('0x8')](_0x8d60('0x11'),auth['isAuthenticated'](),controller[_0x8d60('0x12')]);router[_0x8d60('0x13')]('/',auth[_0x8d60('0x9')](),controller[_0x8d60('0x14')]);router[_0x8d60('0x15')](_0x8d60('0xb'),auth[_0x8d60('0x9')](),controller[_0x8d60('0x16')]);router[_0x8d60('0x17')](_0x8d60('0xb'),auth[_0x8d60('0x9')](),controller[_0x8d60('0x18')]);module[_0x8d60('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index dd4afe8..779d60e 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 _0x6b20=['sequelize','exports','STRING'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x6b20,0x1c5));var _0x06b2=function(_0x4e04d1,_0x3fb544){_0x4e04d1=_0x4e04d1-0x0;var _0x555200=_0x6b20[_0x4e04d1];return _0x555200;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x06b2('0x2')]}}; \ No newline at end of file +var _0xcc04=['exports','STRING','sequelize'];(function(_0x59fb57,_0x39b3b1){var _0x38c111=function(_0x1ec183){while(--_0x1ec183){_0x59fb57['push'](_0x59fb57['shift']());}};_0x38c111(++_0x39b3b1);}(_0xcc04,0x1b2));var _0x4cc0=function(_0x3ea19a,_0x54dc41){_0x3ea19a=_0x3ea19a-0x0;var _0x1f821d=_0xcc04[_0x3ea19a];return _0x1f821d;};'use strict';var Sequelize=require(_0x4cc0('0x0'));module[_0x4cc0('0x1')]={'name':{'type':Sequelize[_0x4cc0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0bf8e1a..65e9ab3 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 _0x5ae0=['end','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show','params','fields','find','create','body','getFields','findOne','ServicenowField','options','getSubjects','getDescriptions','eml-format','rimraf','moment','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x79f17d,_0x265f13){var _0x399ef1=function(_0x2d37df){while(--_0x2d37df){_0x79f17d['push'](_0x79f17d['shift']());}};_0x399ef1(++_0x265f13);}(_0x5ae0,0xbe));var _0x05ae=function(_0x1ef396,_0x48a379){_0x1ef396=_0x1ef396-0x0;var _0x2f4170=_0x5ae0[_0x1ef396];return _0x2f4170;};'use strict';var emlformat=require(_0x05ae('0x0'));var rimraf=require(_0x05ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x05ae('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x05ae('0x3'));var util=require('util');var path=require(_0x05ae('0x4'));var sox=require(_0x05ae('0x5'));var csv=require(_0x05ae('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05ae('0x7'));var _=require(_0x05ae('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05ae('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x05ae('0xa'));var Redis=require(_0x05ae('0xb'));var authService=require(_0x05ae('0xc'));var qs=require(_0x05ae('0xd'));var as=require(_0x05ae('0xe'));var hardwareService=require(_0x05ae('0xf'));var logger=require(_0x05ae('0x10'))(_0x05ae('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x05ae('0x12'))['db'];function respondWithStatusCode(_0x457b3b,_0x1ee901){_0x1ee901=_0x1ee901||0xcc;return function(_0x1d77b2){if(_0x1d77b2){return _0x457b3b['sendStatus'](_0x1ee901);}return _0x457b3b[_0x05ae('0x13')](_0x1ee901)['end']();};}function respondWithResult(_0x34eafe,_0x2b43c7){_0x2b43c7=_0x2b43c7||0xc8;return function(_0x49bc91){if(_0x49bc91){return _0x34eafe[_0x05ae('0x13')](_0x2b43c7)[_0x05ae('0x14')](_0x49bc91);}};}function respondWithFilteredResult(_0x45e0c7,_0x1841d6){return function(_0xd79d32){if(_0xd79d32){var _0x3da232=typeof _0x1841d6[_0x05ae('0x15')]===_0x05ae('0x16')&&typeof _0x1841d6[_0x05ae('0x17')]===_0x05ae('0x16');var _0x1d1f59=_0xd79d32[_0x05ae('0x18')];var _0x47abf2=_0x3da232?0x0:_0x1841d6[_0x05ae('0x15')];var _0x1351e9=_0x3da232?_0xd79d32['count']:_0x1841d6[_0x05ae('0x15')]+_0x1841d6[_0x05ae('0x17')];var _0x3c6358;if(_0x1351e9>=_0x1d1f59){_0x1351e9=_0x1d1f59;_0x3c6358=0xc8;}else{_0x3c6358=0xce;}_0x45e0c7['status'](_0x3c6358);return _0x45e0c7[_0x05ae('0x19')](_0x05ae('0x1a'),_0x47abf2+'-'+_0x1351e9+'/'+_0x1d1f59)[_0x05ae('0x14')](_0xd79d32);}return null;};}function patchUpdates(_0x1863be){return function(_0x55b386){try{jsonpatch[_0x05ae('0x1b')](_0x55b386,_0x1863be,!![]);}catch(_0x416586){return BPromise[_0x05ae('0x1c')](_0x416586);}return _0x55b386[_0x05ae('0x1d')]();};}function saveUpdates(_0x1de7fa,_0x34c7ea){return function(_0x4c2c5a){if(_0x4c2c5a){return _0x4c2c5a[_0x05ae('0x1e')](_0x1de7fa)[_0x05ae('0x1f')](function(_0x139d64){return _0x139d64;});}return null;};}function removeEntity(_0x52e331,_0x3db056){return function(_0x1cabdd){if(_0x1cabdd){return _0x1cabdd['destroy']()[_0x05ae('0x1f')](function(){_0x52e331[_0x05ae('0x13')](0xcc)[_0x05ae('0x20')]();});}};}function handleEntityNotFound(_0x4a43a4,_0x2d5ea4){return function(_0x28ff7c){if(!_0x28ff7c){_0x4a43a4[_0x05ae('0x21')](0x194);}return _0x28ff7c;};}function handleError(_0x6c6086,_0x1d1c42){_0x1d1c42=_0x1d1c42||0x1f4;return function(_0x49c46a){logger[_0x05ae('0x22')](_0x49c46a[_0x05ae('0x23')]);if(_0x49c46a[_0x05ae('0x24')]){delete _0x49c46a[_0x05ae('0x24')];}_0x6c6086[_0x05ae('0x13')](_0x1d1c42)['send'](_0x49c46a);};}exports[_0x05ae('0x25')]=function(_0x5aa771,_0x42a002){var _0x21a753={},_0x350e6d={},_0x1f4eea={'count':0x0,'rows':[]};var _0x294079=_[_0x05ae('0x26')](db[_0x05ae('0x27')][_0x05ae('0x28')],function(_0x300e83){return{'name':_0x300e83[_0x05ae('0x29')],'type':_0x300e83[_0x05ae('0x2a')]['key']};});_0x350e6d['model']=_[_0x05ae('0x26')](_0x294079,_0x05ae('0x24'));_0x350e6d['query']=_[_0x05ae('0x2b')](_0x5aa771['query']);_0x350e6d[_0x05ae('0x2c')]=_[_0x05ae('0x2d')](_0x350e6d[_0x05ae('0x2e')],_0x350e6d['query']);_0x21a753[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x350e6d[_0x05ae('0x2e')],qs['fields'](_0x5aa771[_0x05ae('0x30')]['fields']));_0x21a753[_0x05ae('0x2f')]=_0x21a753[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x21a753['attributes']:_0x350e6d[_0x05ae('0x2e')];if(!_0x5aa771[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x21a753[_0x05ae('0x17')]=qs[_0x05ae('0x17')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x17')]);_0x21a753[_0x05ae('0x15')]=qs[_0x05ae('0x15')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x15')]);}_0x21a753[_0x05ae('0x34')]=qs[_0x05ae('0x35')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x35')]);_0x21a753[_0x05ae('0x36')]=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0x5aa771[_0x05ae('0x30')],_0x350e6d[_0x05ae('0x2c')]),_0x294079);if(_0x5aa771['query']['filter']){_0x21a753[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x21a753[_0x05ae('0x36')],{'$or':_[_0x05ae('0x26')](_0x294079,function(_0x26fdd7){if(_0x26fdd7[_0x05ae('0x2a')]!=='VIRTUAL'){var _0x175748={};_0x175748[_0x26fdd7[_0x05ae('0x24')]]={'$like':'%'+_0x5aa771[_0x05ae('0x30')][_0x05ae('0x39')]+'%'};return _0x175748;}})});}_0x21a753=_[_0x05ae('0x38')]({},_0x21a753,_0x5aa771['options']);var _0x17e4d6={'where':_0x21a753['where']};return db[_0x05ae('0x27')]['count'](_0x17e4d6)[_0x05ae('0x1f')](function(_0x39bfef){_0x1f4eea[_0x05ae('0x18')]=_0x39bfef;if(_0x5aa771[_0x05ae('0x30')][_0x05ae('0x3a')]){_0x21a753[_0x05ae('0x3b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x05ae('0x3c')](_0x21a753);})[_0x05ae('0x1f')](function(_0x171104){_0x1f4eea['rows']=_0x171104;return _0x1f4eea;})[_0x05ae('0x1f')](respondWithFilteredResult(_0x42a002,_0x21a753))[_0x05ae('0x3d')](handleError(_0x42a002,null));};exports[_0x05ae('0x3e')]=function(_0x4aaa9d,_0x2904fc){var _0x15446f={'raw':![],'where':{'id':_0x4aaa9d[_0x05ae('0x3f')]['id']}},_0x4d00e9={};_0x4d00e9[_0x05ae('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x05ae('0x28')]);_0x4d00e9[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0x4aaa9d['query']);_0x4d00e9[_0x05ae('0x2c')]=_[_0x05ae('0x2d')](_0x4d00e9[_0x05ae('0x2e')],_0x4d00e9[_0x05ae('0x30')]);_0x15446f[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x4d00e9[_0x05ae('0x2e')],qs['fields'](_0x4aaa9d[_0x05ae('0x30')][_0x05ae('0x40')]));_0x15446f['attributes']=_0x15446f[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x15446f[_0x05ae('0x2f')]:_0x4d00e9[_0x05ae('0x2e')];if(_0x4aaa9d[_0x05ae('0x30')]['includeAll']){_0x15446f[_0x05ae('0x3b')]=[{'all':!![]}];}_0x15446f=_[_0x05ae('0x38')]({},_0x15446f,_0x4aaa9d['options']);return db[_0x05ae('0x27')][_0x05ae('0x41')](_0x15446f)[_0x05ae('0x1f')](handleEntityNotFound(_0x2904fc,null))[_0x05ae('0x1f')](respondWithResult(_0x2904fc,null))[_0x05ae('0x3d')](handleError(_0x2904fc,null));};exports[_0x05ae('0x42')]=function(_0x4cd0d0,_0xf4613c){return db[_0x05ae('0x27')][_0x05ae('0x42')](_0x4cd0d0[_0x05ae('0x43')],{})[_0x05ae('0x1f')](respondWithResult(_0xf4613c,0xc9))[_0x05ae('0x3d')](handleError(_0xf4613c,null));};exports[_0x05ae('0x1e')]=function(_0x266039,_0x7f65d7){if(_0x266039[_0x05ae('0x43')]['id']){delete _0x266039[_0x05ae('0x43')]['id'];}return db[_0x05ae('0x27')][_0x05ae('0x41')]({'where':{'id':_0x266039[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x7f65d7,null))['then'](saveUpdates(_0x266039['body'],null))[_0x05ae('0x1f')](respondWithResult(_0x7f65d7,null))[_0x05ae('0x3d')](handleError(_0x7f65d7,null));};exports['destroy']=function(_0x65d11,_0x28fa0b){return db['ServicenowConfiguration'][_0x05ae('0x41')]({'where':{'id':_0x65d11[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x28fa0b,null))[_0x05ae('0x1f')](removeEntity(_0x28fa0b,null))[_0x05ae('0x3d')](handleError(_0x28fa0b,null));};exports[_0x05ae('0x44')]=function(_0xb432b3,_0x5aed1b,_0xa08616){var _0x525037={};var _0x50d5a5={};var _0xbf4f35;var _0x1dc7c8;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0xb432b3[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x5aed1b,null))['then'](function(_0x5de254){if(_0x5de254){_0xbf4f35=_0x5de254;_0x50d5a5['model']=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x50d5a5[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0xb432b3[_0x05ae('0x30')]);_0x50d5a5['filters']=_[_0x05ae('0x2d')](_0x50d5a5[_0x05ae('0x2e')],_0x50d5a5[_0x05ae('0x30')]);_0x525037[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x50d5a5['model'],qs[_0x05ae('0x40')](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x40')]));_0x525037[_0x05ae('0x2f')]=_0x525037['attributes'][_0x05ae('0x31')]?_0x525037[_0x05ae('0x2f')]:_0x50d5a5[_0x05ae('0x2e')];_0x525037[_0x05ae('0x34')]=qs[_0x05ae('0x35')](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x35')]);_0x525037['where']=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0xb432b3[_0x05ae('0x30')],_0x50d5a5['filters']));if(_0xb432b3['query'][_0x05ae('0x39')]){_0x525037[_0x05ae('0x36')]=_['merge'](_0x525037['where'],{'$or':_[_0x05ae('0x26')](_0x525037['attributes'],function(_0x1069a8){var _0x4e54ac={};_0x4e54ac[_0x1069a8]={'$like':'%'+_0xb432b3[_0x05ae('0x30')][_0x05ae('0x39')]+'%'};return _0x4e54ac;})});}_0x525037=_[_0x05ae('0x38')]({},_0x525037,_0xb432b3[_0x05ae('0x47')]);return _0xbf4f35['getFields'](_0x525037);}})[_0x05ae('0x1f')](function(_0xb8801a){if(_0xb8801a){_0x1dc7c8=_0xb8801a[_0x05ae('0x31')];if(!_0xb432b3[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x525037[_0x05ae('0x17')]=qs['limit'](_0xb432b3['query'][_0x05ae('0x17')]);_0x525037[_0x05ae('0x15')]=qs['offset'](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0xbf4f35[_0x05ae('0x44')](_0x525037);}})[_0x05ae('0x1f')](function(_0x5d2572){if(_0x5d2572){return _0x5d2572?{'count':_0x1dc7c8,'rows':_0x5d2572}:null;}})[_0x05ae('0x1f')](respondWithResult(_0x5aed1b,null))[_0x05ae('0x3d')](handleError(_0x5aed1b,null));};exports[_0x05ae('0x48')]=function(_0x1089e1,_0x1dfeff,_0x4e0fd6){var _0x1e883f={};var _0x1794a1={};var _0x4b3ed5;var _0x201d45;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0x1089e1[_0x05ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1dfeff,null))[_0x05ae('0x1f')](function(_0x4b9e7e){if(_0x4b9e7e){_0x4b3ed5=_0x4b9e7e;_0x1794a1['model']=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x1794a1['query']=_[_0x05ae('0x2b')](_0x1089e1[_0x05ae('0x30')]);_0x1794a1[_0x05ae('0x2c')]=_['intersection'](_0x1794a1[_0x05ae('0x2e')],_0x1794a1['query']);_0x1e883f[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x1794a1[_0x05ae('0x2e')],qs[_0x05ae('0x40')](_0x1089e1[_0x05ae('0x30')][_0x05ae('0x40')]));_0x1e883f[_0x05ae('0x2f')]=_0x1e883f[_0x05ae('0x2f')]['length']?_0x1e883f[_0x05ae('0x2f')]:_0x1794a1[_0x05ae('0x2e')];_0x1e883f['order']=qs[_0x05ae('0x35')](_0x1089e1['query'][_0x05ae('0x35')]);_0x1e883f[_0x05ae('0x36')]=qs['filters'](_[_0x05ae('0x37')](_0x1089e1[_0x05ae('0x30')],_0x1794a1[_0x05ae('0x2c')]));if(_0x1089e1[_0x05ae('0x30')][_0x05ae('0x39')]){_0x1e883f[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x1e883f['where'],{'$or':_[_0x05ae('0x26')](_0x1e883f[_0x05ae('0x2f')],function(_0x1c0111){var _0x51e15a={};_0x51e15a[_0x1c0111]={'$like':'%'+_0x1089e1[_0x05ae('0x30')]['filter']+'%'};return _0x51e15a;})});}_0x1e883f=_[_0x05ae('0x38')]({},_0x1e883f,_0x1089e1['options']);return _0x4b3ed5[_0x05ae('0x48')](_0x1e883f);}})[_0x05ae('0x1f')](function(_0x35d655){if(_0x35d655){_0x201d45=_0x35d655['length'];if(!_0x1089e1[_0x05ae('0x30')]['hasOwnProperty']('nolimit')){_0x1e883f['limit']=qs[_0x05ae('0x17')](_0x1089e1['query'][_0x05ae('0x17')]);_0x1e883f['offset']=qs[_0x05ae('0x15')](_0x1089e1[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0x4b3ed5[_0x05ae('0x48')](_0x1e883f);}})['then'](function(_0x10aa93){if(_0x10aa93){return _0x10aa93?{'count':_0x201d45,'rows':_0x10aa93}:null;}})[_0x05ae('0x1f')](respondWithResult(_0x1dfeff,null))[_0x05ae('0x3d')](handleError(_0x1dfeff,null));};exports[_0x05ae('0x49')]=function(_0x48e9a3,_0x57611f,_0x2b3a4b){var _0x360bcc={};var _0x50cf0f={};var _0x5384a5;var _0x47641f;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0x48e9a3[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x57611f,null))['then'](function(_0x551f0e){if(_0x551f0e){_0x5384a5=_0x551f0e;_0x50cf0f[_0x05ae('0x2e')]=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x50cf0f[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0x48e9a3[_0x05ae('0x30')]);_0x50cf0f['filters']=_[_0x05ae('0x2d')](_0x50cf0f[_0x05ae('0x2e')],_0x50cf0f[_0x05ae('0x30')]);_0x360bcc[_0x05ae('0x2f')]=_['intersection'](_0x50cf0f['model'],qs[_0x05ae('0x40')](_0x48e9a3['query']['fields']));_0x360bcc[_0x05ae('0x2f')]=_0x360bcc[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x360bcc['attributes']:_0x50cf0f['model'];_0x360bcc['order']=qs[_0x05ae('0x35')](_0x48e9a3['query'][_0x05ae('0x35')]);_0x360bcc[_0x05ae('0x36')]=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0x48e9a3[_0x05ae('0x30')],_0x50cf0f[_0x05ae('0x2c')]));if(_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x39')]){_0x360bcc[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x360bcc[_0x05ae('0x36')],{'$or':_['map'](_0x360bcc[_0x05ae('0x2f')],function(_0x3aaf5a){var _0x320d1d={};_0x320d1d[_0x3aaf5a]={'$like':'%'+_0x48e9a3['query']['filter']+'%'};return _0x320d1d;})});}_0x360bcc=_['merge']({},_0x360bcc,_0x48e9a3['options']);return _0x5384a5['getDescriptions'](_0x360bcc);}})[_0x05ae('0x1f')](function(_0x4c4eed){if(_0x4c4eed){_0x47641f=_0x4c4eed[_0x05ae('0x31')];if(!_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x360bcc[_0x05ae('0x17')]=qs[_0x05ae('0x17')](_0x48e9a3[_0x05ae('0x30')]['limit']);_0x360bcc[_0x05ae('0x15')]=qs[_0x05ae('0x15')](_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0x5384a5[_0x05ae('0x49')](_0x360bcc);}})[_0x05ae('0x1f')](function(_0x3518d0){if(_0x3518d0){return _0x3518d0?{'count':_0x47641f,'rows':_0x3518d0}:null;}})['then'](respondWithResult(_0x57611f,null))[_0x05ae('0x3d')](handleError(_0x57611f,null));}; \ No newline at end of file +var _0xf6de=['json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','status','error','name','send','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xf4a6f3,_0x557061){var _0x1be067=function(_0x59bd76){while(--_0x59bd76){_0xf4a6f3['push'](_0xf4a6f3['shift']());}};_0x1be067(++_0x557061);}(_0xf6de,0x1ca));var _0xef6d=function(_0x59145a,_0x1f60f1){_0x59145a=_0x59145a-0x0;var _0xf04d7=_0xf6de[_0x59145a];return _0xf04d7;};'use strict';var emlformat=require(_0xef6d('0x0'));var rimraf=require(_0xef6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef6d('0x2'));var rp=require(_0xef6d('0x3'));var moment=require(_0xef6d('0x4'));var BPromise=require(_0xef6d('0x5'));var Mustache=require(_0xef6d('0x6'));var util=require('util');var path=require(_0xef6d('0x7'));var sox=require(_0xef6d('0x8'));var csv=require(_0xef6d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef6d('0xa'));var _=require(_0xef6d('0xb'));var squel=require(_0xef6d('0xc'));var crypto=require(_0xef6d('0xd'));var jsforce=require(_0xef6d('0xe'));var deskjs=require(_0xef6d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xef6d('0x10'));var Papa=require(_0xef6d('0x11'));var Redis=require(_0xef6d('0x12'));var authService=require(_0xef6d('0x13'));var qs=require(_0xef6d('0x14'));var as=require(_0xef6d('0x15'));var hardwareService=require(_0xef6d('0x16'));var logger=require(_0xef6d('0x17'))('api');var utils=require(_0xef6d('0x18'));var config=require(_0xef6d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xef6d('0x1a'))['db'];function respondWithStatusCode(_0x429d45,_0x593eea){_0x593eea=_0x593eea||0xcc;return function(_0x17ab1d){if(_0x17ab1d){return _0x429d45[_0xef6d('0x1b')](_0x593eea);}return _0x429d45['status'](_0x593eea)['end']();};}function respondWithResult(_0x274cbc,_0x4e29e5){_0x4e29e5=_0x4e29e5||0xc8;return function(_0x6435cd){if(_0x6435cd){return _0x274cbc['status'](_0x4e29e5)[_0xef6d('0x1c')](_0x6435cd);}};}function respondWithFilteredResult(_0x462558,_0x3fd83f){return function(_0x4a72b3){if(_0x4a72b3){var _0x3e8eb5=typeof _0x3fd83f['offset']==='undefined'&&typeof _0x3fd83f[_0xef6d('0x1d')]===_0xef6d('0x1e');var _0xede4cc=_0x4a72b3[_0xef6d('0x1f')];var _0xf859c5=_0x3e8eb5?0x0:_0x3fd83f['offset'];var _0x848155=_0x3e8eb5?_0x4a72b3[_0xef6d('0x1f')]:_0x3fd83f[_0xef6d('0x20')]+_0x3fd83f[_0xef6d('0x1d')];var _0x10d20c;if(_0x848155>=_0xede4cc){_0x848155=_0xede4cc;_0x10d20c=0xc8;}else{_0x10d20c=0xce;}_0x462558['status'](_0x10d20c);return _0x462558[_0xef6d('0x21')](_0xef6d('0x22'),_0xf859c5+'-'+_0x848155+'/'+_0xede4cc)['json'](_0x4a72b3);}return null;};}function patchUpdates(_0x12531d){return function(_0x20ca20){try{jsonpatch['apply'](_0x20ca20,_0x12531d,!![]);}catch(_0x4fe203){return BPromise[_0xef6d('0x23')](_0x4fe203);}return _0x20ca20[_0xef6d('0x24')]();};}function saveUpdates(_0x46d821,_0x4f3796){return function(_0x11a05f){if(_0x11a05f){return _0x11a05f[_0xef6d('0x25')](_0x46d821)[_0xef6d('0x26')](function(_0xf8b78d){return _0xf8b78d;});}return null;};}function removeEntity(_0x1e9c2b,_0x3387e){return function(_0x15fbf8){if(_0x15fbf8){return _0x15fbf8[_0xef6d('0x27')]()[_0xef6d('0x26')](function(){_0x1e9c2b[_0xef6d('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a38b2,_0xb9416b){return function(_0x14eee4){if(!_0x14eee4){_0x3a38b2[_0xef6d('0x1b')](0x194);}return _0x14eee4;};}function handleError(_0x491d21,_0x1f6e83){_0x1f6e83=_0x1f6e83||0x1f4;return function(_0x23f66e){logger[_0xef6d('0x29')](_0x23f66e['stack']);if(_0x23f66e['name']){delete _0x23f66e[_0xef6d('0x2a')];}_0x491d21[_0xef6d('0x28')](_0x1f6e83)[_0xef6d('0x2b')](_0x23f66e);};}exports['index']=function(_0x2854fb,_0x2565bc){var _0x299bbe={},_0x2a8776={},_0x1b7305={'count':0x0,'rows':[]};var _0x2186d4=_[_0xef6d('0x2c')](db[_0xef6d('0x2d')]['rawAttributes'],function(_0x176ba7){return{'name':_0x176ba7[_0xef6d('0x2e')],'type':_0x176ba7[_0xef6d('0x2f')][_0xef6d('0x30')]};});_0x2a8776[_0xef6d('0x31')]=_[_0xef6d('0x2c')](_0x2186d4,_0xef6d('0x2a'));_0x2a8776[_0xef6d('0x32')]=_[_0xef6d('0x33')](_0x2854fb['query']);_0x2a8776[_0xef6d('0x34')]=_[_0xef6d('0x35')](_0x2a8776[_0xef6d('0x31')],_0x2a8776[_0xef6d('0x32')]);_0x299bbe[_0xef6d('0x36')]=_['intersection'](_0x2a8776[_0xef6d('0x31')],qs[_0xef6d('0x37')](_0x2854fb[_0xef6d('0x32')][_0xef6d('0x37')]));_0x299bbe['attributes']=_0x299bbe[_0xef6d('0x36')][_0xef6d('0x38')]?_0x299bbe['attributes']:_0x2a8776[_0xef6d('0x31')];if(!_0x2854fb[_0xef6d('0x32')][_0xef6d('0x39')](_0xef6d('0x3a'))){_0x299bbe['limit']=qs['limit'](_0x2854fb[_0xef6d('0x32')]['limit']);_0x299bbe['offset']=qs[_0xef6d('0x20')](_0x2854fb[_0xef6d('0x32')][_0xef6d('0x20')]);}_0x299bbe[_0xef6d('0x3b')]=qs[_0xef6d('0x3c')](_0x2854fb[_0xef6d('0x32')][_0xef6d('0x3c')]);_0x299bbe[_0xef6d('0x3d')]=qs['filters'](_[_0xef6d('0x3e')](_0x2854fb[_0xef6d('0x32')],_0x2a8776[_0xef6d('0x34')]),_0x2186d4);if(_0x2854fb[_0xef6d('0x32')][_0xef6d('0x3f')]){_0x299bbe[_0xef6d('0x3d')]=_['merge'](_0x299bbe[_0xef6d('0x3d')],{'$or':_[_0xef6d('0x2c')](_0x2186d4,function(_0x53be05){if(_0x53be05[_0xef6d('0x2f')]!=='VIRTUAL'){var _0x5a253={};_0x5a253[_0x53be05[_0xef6d('0x2a')]]={'$like':'%'+_0x2854fb['query'][_0xef6d('0x3f')]+'%'};return _0x5a253;}})});}_0x299bbe=_[_0xef6d('0x40')]({},_0x299bbe,_0x2854fb[_0xef6d('0x41')]);var _0x360e0b={'where':_0x299bbe['where']};return db[_0xef6d('0x2d')][_0xef6d('0x1f')](_0x360e0b)[_0xef6d('0x26')](function(_0x4ca672){_0x1b7305[_0xef6d('0x1f')]=_0x4ca672;if(_0x2854fb[_0xef6d('0x32')][_0xef6d('0x42')]){_0x299bbe[_0xef6d('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xef6d('0x44')](_0x299bbe);})['then'](function(_0x5df818){_0x1b7305['rows']=_0x5df818;return _0x1b7305;})[_0xef6d('0x26')](respondWithFilteredResult(_0x2565bc,_0x299bbe))['catch'](handleError(_0x2565bc,null));};exports[_0xef6d('0x45')]=function(_0x1d90f8,_0x1638f6){var _0x15807b={'raw':![],'where':{'id':_0x1d90f8[_0xef6d('0x46')]['id']}},_0x2214ae={};_0x2214ae[_0xef6d('0x31')]=_[_0xef6d('0x33')](db[_0xef6d('0x2d')][_0xef6d('0x47')]);_0x2214ae['query']=_[_0xef6d('0x33')](_0x1d90f8['query']);_0x2214ae[_0xef6d('0x34')]=_[_0xef6d('0x35')](_0x2214ae[_0xef6d('0x31')],_0x2214ae[_0xef6d('0x32')]);_0x15807b[_0xef6d('0x36')]=_[_0xef6d('0x35')](_0x2214ae['model'],qs[_0xef6d('0x37')](_0x1d90f8[_0xef6d('0x32')][_0xef6d('0x37')]));_0x15807b[_0xef6d('0x36')]=_0x15807b['attributes'][_0xef6d('0x38')]?_0x15807b[_0xef6d('0x36')]:_0x2214ae[_0xef6d('0x31')];if(_0x1d90f8['query'][_0xef6d('0x42')]){_0x15807b[_0xef6d('0x43')]=[{'all':!![]}];}_0x15807b=_[_0xef6d('0x40')]({},_0x15807b,_0x1d90f8['options']);return db[_0xef6d('0x2d')][_0xef6d('0x48')](_0x15807b)[_0xef6d('0x26')](handleEntityNotFound(_0x1638f6,null))[_0xef6d('0x26')](respondWithResult(_0x1638f6,null))[_0xef6d('0x49')](handleError(_0x1638f6,null));};exports[_0xef6d('0x4a')]=function(_0x25fa92,_0x16ead4){return db[_0xef6d('0x2d')][_0xef6d('0x4a')](_0x25fa92[_0xef6d('0x4b')],{})[_0xef6d('0x26')](respondWithResult(_0x16ead4,0xc9))[_0xef6d('0x49')](handleError(_0x16ead4,null));};exports[_0xef6d('0x25')]=function(_0x394d96,_0x41ebc1){if(_0x394d96[_0xef6d('0x4b')]['id']){delete _0x394d96['body']['id'];}return db[_0xef6d('0x2d')][_0xef6d('0x48')]({'where':{'id':_0x394d96[_0xef6d('0x46')]['id']}})[_0xef6d('0x26')](handleEntityNotFound(_0x41ebc1,null))[_0xef6d('0x26')](saveUpdates(_0x394d96[_0xef6d('0x4b')],null))[_0xef6d('0x26')](respondWithResult(_0x41ebc1,null))[_0xef6d('0x49')](handleError(_0x41ebc1,null));};exports['destroy']=function(_0x245325,_0x526fa7){return db[_0xef6d('0x2d')][_0xef6d('0x48')]({'where':{'id':_0x245325['params']['id']}})[_0xef6d('0x26')](handleEntityNotFound(_0x526fa7,null))[_0xef6d('0x26')](removeEntity(_0x526fa7,null))[_0xef6d('0x49')](handleError(_0x526fa7,null));};exports['getFields']=function(_0x4f6e0a,_0x992734,_0x318187){var _0x5d39fc={};var _0x37ec94={};var _0x412405;var _0x4984c1;return db[_0xef6d('0x2d')][_0xef6d('0x4c')]({'where':{'id':_0x4f6e0a[_0xef6d('0x46')]['id']}})[_0xef6d('0x26')](handleEntityNotFound(_0x992734,null))[_0xef6d('0x26')](function(_0x360d0b){if(_0x360d0b){_0x412405=_0x360d0b;_0x37ec94[_0xef6d('0x31')]=_[_0xef6d('0x33')](db[_0xef6d('0x4d')]['rawAttributes']);_0x37ec94['query']=_[_0xef6d('0x33')](_0x4f6e0a[_0xef6d('0x32')]);_0x37ec94['filters']=_[_0xef6d('0x35')](_0x37ec94[_0xef6d('0x31')],_0x37ec94['query']);_0x5d39fc[_0xef6d('0x36')]=_[_0xef6d('0x35')](_0x37ec94[_0xef6d('0x31')],qs[_0xef6d('0x37')](_0x4f6e0a[_0xef6d('0x32')][_0xef6d('0x37')]));_0x5d39fc[_0xef6d('0x36')]=_0x5d39fc[_0xef6d('0x36')]['length']?_0x5d39fc[_0xef6d('0x36')]:_0x37ec94[_0xef6d('0x31')];_0x5d39fc[_0xef6d('0x3b')]=qs['sort'](_0x4f6e0a['query'][_0xef6d('0x3c')]);_0x5d39fc['where']=qs[_0xef6d('0x34')](_[_0xef6d('0x3e')](_0x4f6e0a[_0xef6d('0x32')],_0x37ec94[_0xef6d('0x34')]));if(_0x4f6e0a[_0xef6d('0x32')][_0xef6d('0x3f')]){_0x5d39fc[_0xef6d('0x3d')]=_['merge'](_0x5d39fc[_0xef6d('0x3d')],{'$or':_[_0xef6d('0x2c')](_0x5d39fc[_0xef6d('0x36')],function(_0x555344){var _0x46dbb7={};_0x46dbb7[_0x555344]={'$like':'%'+_0x4f6e0a[_0xef6d('0x32')][_0xef6d('0x3f')]+'%'};return _0x46dbb7;})});}_0x5d39fc=_[_0xef6d('0x40')]({},_0x5d39fc,_0x4f6e0a[_0xef6d('0x41')]);return _0x412405[_0xef6d('0x4e')](_0x5d39fc);}})['then'](function(_0x319739){if(_0x319739){_0x4984c1=_0x319739[_0xef6d('0x38')];if(!_0x4f6e0a['query'][_0xef6d('0x39')](_0xef6d('0x3a'))){_0x5d39fc[_0xef6d('0x1d')]=qs[_0xef6d('0x1d')](_0x4f6e0a[_0xef6d('0x32')][_0xef6d('0x1d')]);_0x5d39fc[_0xef6d('0x20')]=qs[_0xef6d('0x20')](_0x4f6e0a[_0xef6d('0x32')][_0xef6d('0x20')]);}return _0x412405[_0xef6d('0x4e')](_0x5d39fc);}})[_0xef6d('0x26')](function(_0x1751e3){if(_0x1751e3){return _0x1751e3?{'count':_0x4984c1,'rows':_0x1751e3}:null;}})['then'](respondWithResult(_0x992734,null))['catch'](handleError(_0x992734,null));};exports[_0xef6d('0x4f')]=function(_0x16353b,_0x3175ce,_0xe72568){var _0x22770e={};var _0x37af42={};var _0x43b34f;var _0x2b33f1;return db[_0xef6d('0x2d')][_0xef6d('0x4c')]({'where':{'id':_0x16353b[_0xef6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3175ce,null))['then'](function(_0x26388e){if(_0x26388e){_0x43b34f=_0x26388e;_0x37af42[_0xef6d('0x31')]=_[_0xef6d('0x33')](db[_0xef6d('0x4d')][_0xef6d('0x47')]);_0x37af42['query']=_['keys'](_0x16353b[_0xef6d('0x32')]);_0x37af42[_0xef6d('0x34')]=_[_0xef6d('0x35')](_0x37af42[_0xef6d('0x31')],_0x37af42[_0xef6d('0x32')]);_0x22770e['attributes']=_['intersection'](_0x37af42[_0xef6d('0x31')],qs[_0xef6d('0x37')](_0x16353b[_0xef6d('0x32')]['fields']));_0x22770e[_0xef6d('0x36')]=_0x22770e[_0xef6d('0x36')][_0xef6d('0x38')]?_0x22770e[_0xef6d('0x36')]:_0x37af42[_0xef6d('0x31')];_0x22770e[_0xef6d('0x3b')]=qs[_0xef6d('0x3c')](_0x16353b[_0xef6d('0x32')][_0xef6d('0x3c')]);_0x22770e[_0xef6d('0x3d')]=qs[_0xef6d('0x34')](_[_0xef6d('0x3e')](_0x16353b['query'],_0x37af42[_0xef6d('0x34')]));if(_0x16353b[_0xef6d('0x32')][_0xef6d('0x3f')]){_0x22770e['where']=_[_0xef6d('0x40')](_0x22770e['where'],{'$or':_[_0xef6d('0x2c')](_0x22770e[_0xef6d('0x36')],function(_0x3c1649){var _0x3f0c6c={};_0x3f0c6c[_0x3c1649]={'$like':'%'+_0x16353b[_0xef6d('0x32')][_0xef6d('0x3f')]+'%'};return _0x3f0c6c;})});}_0x22770e=_[_0xef6d('0x40')]({},_0x22770e,_0x16353b[_0xef6d('0x41')]);return _0x43b34f['getSubjects'](_0x22770e);}})[_0xef6d('0x26')](function(_0xf27386){if(_0xf27386){_0x2b33f1=_0xf27386[_0xef6d('0x38')];if(!_0x16353b[_0xef6d('0x32')][_0xef6d('0x39')](_0xef6d('0x3a'))){_0x22770e['limit']=qs[_0xef6d('0x1d')](_0x16353b[_0xef6d('0x32')][_0xef6d('0x1d')]);_0x22770e[_0xef6d('0x20')]=qs[_0xef6d('0x20')](_0x16353b[_0xef6d('0x32')][_0xef6d('0x20')]);}return _0x43b34f[_0xef6d('0x4f')](_0x22770e);}})[_0xef6d('0x26')](function(_0x97a041){if(_0x97a041){return _0x97a041?{'count':_0x2b33f1,'rows':_0x97a041}:null;}})[_0xef6d('0x26')](respondWithResult(_0x3175ce,null))[_0xef6d('0x49')](handleError(_0x3175ce,null));};exports[_0xef6d('0x50')]=function(_0x227433,_0x2fa704,_0x424d1d){var _0x41c45d={};var _0x3d6c26={};var _0x48929f;var _0x2e104e;return db['ServicenowConfiguration'][_0xef6d('0x4c')]({'where':{'id':_0x227433[_0xef6d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fa704,null))[_0xef6d('0x26')](function(_0x15d0af){if(_0x15d0af){_0x48929f=_0x15d0af;_0x3d6c26[_0xef6d('0x31')]=_[_0xef6d('0x33')](db[_0xef6d('0x4d')]['rawAttributes']);_0x3d6c26[_0xef6d('0x32')]=_[_0xef6d('0x33')](_0x227433[_0xef6d('0x32')]);_0x3d6c26[_0xef6d('0x34')]=_['intersection'](_0x3d6c26['model'],_0x3d6c26[_0xef6d('0x32')]);_0x41c45d['attributes']=_[_0xef6d('0x35')](_0x3d6c26['model'],qs[_0xef6d('0x37')](_0x227433[_0xef6d('0x32')]['fields']));_0x41c45d[_0xef6d('0x36')]=_0x41c45d[_0xef6d('0x36')][_0xef6d('0x38')]?_0x41c45d['attributes']:_0x3d6c26[_0xef6d('0x31')];_0x41c45d[_0xef6d('0x3b')]=qs[_0xef6d('0x3c')](_0x227433[_0xef6d('0x32')][_0xef6d('0x3c')]);_0x41c45d[_0xef6d('0x3d')]=qs[_0xef6d('0x34')](_[_0xef6d('0x3e')](_0x227433['query'],_0x3d6c26[_0xef6d('0x34')]));if(_0x227433[_0xef6d('0x32')][_0xef6d('0x3f')]){_0x41c45d[_0xef6d('0x3d')]=_[_0xef6d('0x40')](_0x41c45d['where'],{'$or':_['map'](_0x41c45d[_0xef6d('0x36')],function(_0x46d27d){var _0x4aab04={};_0x4aab04[_0x46d27d]={'$like':'%'+_0x227433[_0xef6d('0x32')][_0xef6d('0x3f')]+'%'};return _0x4aab04;})});}_0x41c45d=_[_0xef6d('0x40')]({},_0x41c45d,_0x227433['options']);return _0x48929f[_0xef6d('0x50')](_0x41c45d);}})[_0xef6d('0x26')](function(_0x49a720){if(_0x49a720){_0x2e104e=_0x49a720[_0xef6d('0x38')];if(!_0x227433[_0xef6d('0x32')]['hasOwnProperty']('nolimit')){_0x41c45d[_0xef6d('0x1d')]=qs[_0xef6d('0x1d')](_0x227433[_0xef6d('0x32')][_0xef6d('0x1d')]);_0x41c45d[_0xef6d('0x20')]=qs[_0xef6d('0x20')](_0x227433[_0xef6d('0x32')]['offset']);}return _0x48929f[_0xef6d('0x50')](_0x41c45d);}})[_0xef6d('0x26')](function(_0x4c495d){if(_0x4c495d){return _0x4c495d?{'count':_0x2e104e,'rows':_0x4c495d}:null;}})[_0xef6d('0x26')](respondWithResult(_0x2fa704,null))[_0xef6d('0x49')](handleError(_0x2fa704,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 04e1f65..452b5d4 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 _0x6f59=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xecf746,_0x390352){var _0x5baa86=function(_0x339fe6){while(--_0x339fe6){_0xecf746['push'](_0xecf746['shift']());}};_0x5baa86(++_0x390352);}(_0x6f59,0x1be));var _0x96f5=function(_0x339300,_0x37a347){_0x339300=_0x339300-0x0;var _0x4b74f7=_0x6f59[_0x339300];return _0x4b74f7;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var logger=require(_0x96f5('0x2'))(_0x96f5('0x3'));var moment=require(_0x96f5('0x4'));var BPromise=require(_0x96f5('0x5'));var rp=require(_0x96f5('0x6'));var fs=require('fs');var path=require(_0x96f5('0x7'));var rimraf=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var attributes=require(_0x96f5('0xa'));module[_0x96f5('0xb')]=function(_0x598154,_0xf6cd7d){return _0x598154['define'](_0x96f5('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4c9=['rimraf','./intServicenowConfiguration.attributes','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3c0ee1,_0x3702ce){var _0x35d80f=function(_0x5cec83){while(--_0x5cec83){_0x3c0ee1['push'](_0x3c0ee1['shift']());}};_0x35d80f(++_0x3702ce);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf4c9[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var logger=require(_0x9f4c('0x2'))('api');var moment=require(_0x9f4c('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f4c('0x4'));var fs=require('fs');var path=require(_0x9f4c('0x5'));var rimraf=require(_0x9f4c('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f4c('0x7'));module['exports']=function(_0x42cd40,_0x48dc53){return _0x42cd40['define']('ServicenowConfiguration',attributes,{'tableName':_0x9f4c('0x8'),'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 0d1d4d1..4f5c59a 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 _0x2a64=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a64,0xc1));var _0x42a6=function(_0x191313,_0x400f2c){_0x191313=_0x191313-0x0;var _0x1997ed=_0x2a64[_0x191313];return _0x1997ed;};'use strict';var _=require(_0x42a6('0x0'));var util=require(_0x42a6('0x1'));var moment=require(_0x42a6('0x2'));var BPromise=require(_0x42a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42a6('0x4'));var db=require(_0x42a6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42a6('0x6'))(_0x42a6('0x7'));var config=require(_0x42a6('0x8'));var jayson=require(_0x42a6('0x9'));var client=jayson[_0x42a6('0xa')][_0x42a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aba6e,_0x5c08d9,_0x1ea89c){return new BPromise(function(_0x347c36,_0x5f4616){return client[_0x42a6('0xc')](_0x5aba6e,_0x1ea89c)[_0x42a6('0xd')](function(_0x1bad6a){logger[_0x42a6('0xe')](_0x42a6('0xf'),_0x5c08d9,_0x42a6('0x10'));logger[_0x42a6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5c08d9,'request\x20sent',JSON['stringify'](_0x1bad6a));if(_0x1bad6a[_0x42a6('0x12')]){if(_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x13')]===0x1f4){logger[_0x42a6('0x12')](_0x42a6('0xf'),_0x5c08d9,_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x14')]);return _0x5f4616(_0x1bad6a[_0x42a6('0x12')]['message']);}logger['error'](_0x42a6('0xf'),_0x5c08d9,_0x1bad6a['error'][_0x42a6('0x14')]);return _0x347c36(_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x14')]);}else{logger[_0x42a6('0xe')](_0x42a6('0xf'),_0x5c08d9,'request\x20sent');_0x347c36(_0x1bad6a[_0x42a6('0x15')]['message']);}})[_0x42a6('0x16')](function(_0x57ce04){logger[_0x42a6('0x12')](_0x42a6('0xf'),_0x5c08d9,_0x57ce04);_0x5f4616(_0x57ce04);});});} \ No newline at end of file +var _0xa9e5=['client','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','ServicenowConfiguration,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4280dd,_0x20749e){var _0xbd785c=function(_0x3795e1){while(--_0x3795e1){_0x4280dd['push'](_0x4280dd['shift']());}};_0xbd785c(++_0x20749e);}(_0xa9e5,0xfc));var _0x5a9e=function(_0x3cf80a,_0x3ac05a){_0x3cf80a=_0x3cf80a-0x0;var _0x3dc131=_0xa9e5[_0x3cf80a];return _0x3dc131;};'use strict';var _=require('lodash');var util=require(_0x5a9e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a9e('0x1'));var fs=require('fs');var Redis=require(_0x5a9e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a9e('0x3'));var logger=require(_0x5a9e('0x4'))(_0x5a9e('0x5'));var config=require(_0x5a9e('0x6'));var jayson=require(_0x5a9e('0x7'));var client=jayson[_0x5a9e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x334e05,_0x2f5428,_0x2e2d97){return new BPromise(function(_0x3bbcbd,_0x5018f7){return client[_0x5a9e('0x9')](_0x334e05,_0x2e2d97)[_0x5a9e('0xa')](function(_0xf1139){logger[_0x5a9e('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2f5428,'request\x20sent');logger[_0x5a9e('0xc')](_0x5a9e('0xd'),_0x2f5428,_0x5a9e('0xe'),JSON['stringify'](_0xf1139));if(_0xf1139['error']){if(_0xf1139['error'][_0x5a9e('0xf')]===0x1f4){logger[_0x5a9e('0x10')](_0x5a9e('0x11'),_0x2f5428,_0xf1139[_0x5a9e('0x10')][_0x5a9e('0x12')]);return _0x5018f7(_0xf1139[_0x5a9e('0x10')][_0x5a9e('0x12')]);}logger['error'](_0x5a9e('0x11'),_0x2f5428,_0xf1139[_0x5a9e('0x10')]['message']);return _0x3bbcbd(_0xf1139['error'][_0x5a9e('0x12')]);}else{logger[_0x5a9e('0xb')](_0x5a9e('0x11'),_0x2f5428,_0x5a9e('0xe'));_0x3bbcbd(_0xf1139['result'][_0x5a9e('0x12')]);}})[_0x5a9e('0x13')](function(_0x120cfa){logger[_0x5a9e('0x10')](_0x5a9e('0x11'),_0x2f5428,_0x120cfa);_0x5018f7(_0x120cfa);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7e10206..f6c682c 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 _0x9318=['get','/:id','show','post','create','put','update','destroy','util','path','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x45ff76,_0x494070){var _0x3c7050=function(_0x2164a9){while(--_0x2164a9){_0x45ff76['push'](_0x45ff76['shift']());}};_0x3c7050(++_0x494070);}(_0x9318,0x152));var _0x8931=function(_0x203451,_0x36cdd9){_0x203451=_0x203451-0x0;var _0x23dc34=_0x9318[_0x203451];return _0x23dc34;};'use strict';var multer=require('multer');var util=require(_0x8931('0x0'));var path=require(_0x8931('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8931('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8931('0x3'));var config=require(_0x8931('0x4'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x8931('0x5')](),controller[_0x8931('0x6')]);router[_0x8931('0x7')](_0x8931('0x8'),auth['isAuthenticated'](),controller[_0x8931('0x9')]);router[_0x8931('0xa')]('/',auth[_0x8931('0x5')](),controller[_0x8931('0xb')]);router[_0x8931('0xc')](_0x8931('0x8'),auth['isAuthenticated'](),controller[_0x8931('0xd')]);router['delete'](_0x8931('0x8'),auth[_0x8931('0x5')](),controller[_0x8931('0xe')]);module['exports']=router; \ No newline at end of file +var _0x33f1=['put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','create'];(function(_0x591366,_0x16d636){var _0x2a9146=function(_0x9ac84f){while(--_0x9ac84f){_0x591366['push'](_0x591366['shift']());}};_0x2a9146(++_0x16d636);}(_0x33f1,0x85));var _0x133f=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x33f1[_0x99ff94];return _0x1b5bc0;};'use strict';var multer=require(_0x133f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x133f('0x1'));var express=require(_0x133f('0x2'));var router=express['Router']();var fs_extra=require(_0x133f('0x3'));var auth=require(_0x133f('0x4'));var interaction=require(_0x133f('0x5'));var config=require(_0x133f('0x6'));var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x133f('0x7')]);router['get'](_0x133f('0x8'),auth[_0x133f('0x9')](),controller['show']);router['post']('/',auth[_0x133f('0x9')](),controller[_0x133f('0xa')]);router[_0x133f('0xb')]('/:id',auth[_0x133f('0x9')](),controller[_0x133f('0xc')]);router[_0x133f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x133f('0xe')]);module[_0x133f('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 deff5d9..a7e379f 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 _0x59cf=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x59cf,0x8a));var _0xf59c=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x59cf[_0x336ca2];return _0xda59a6;};'use strict';var Sequelize=require(_0xf59c('0x0'));module[_0xf59c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf59c('0x2'),_0xf59c('0x3'),_0xf59c('0x4'),_0xf59c('0x5'),'picklist'),'defaultValue':_0xf59c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf59c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf59c('0x2'),'variable',_0xf59c('0x4'))},'keyContent':{'type':Sequelize[_0xf59c('0x6')]},'idField':{'type':Sequelize[_0xf59c('0x6')]},'nameField':{'type':Sequelize[_0xf59c('0x6')]},'customField':{'type':Sequelize[_0xf59c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2904=['customVariable','BOOLEAN','sequelize','exports','string','variable','STRING','ENUM'];(function(_0x3dc440,_0x21a7f2){var _0x141de0=function(_0xa26b2){while(--_0xa26b2){_0x3dc440['push'](_0x3dc440['shift']());}};_0x141de0(++_0x21a7f2);}(_0x2904,0xca));var _0x4290=function(_0x2b9df5,_0x3a2d86){_0x2b9df5=_0x2b9df5-0x0;var _0x8b77a8=_0x2904[_0x2b9df5];return _0x8b77a8;};'use strict';var Sequelize=require(_0x4290('0x0'));module[_0x4290('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4290('0x2'),_0x4290('0x3'),'customVariable','keyValue','picklist'),'defaultValue':_0x4290('0x2')},'content':{'type':Sequelize[_0x4290('0x4')]},'key':{'type':Sequelize[_0x4290('0x4')]},'keyType':{'type':Sequelize[_0x4290('0x5')](_0x4290('0x2'),_0x4290('0x3'),_0x4290('0x6'))},'keyContent':{'type':Sequelize[_0x4290('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4290('0x4')]},'customField':{'type':Sequelize[_0x4290('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4290('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index d689a4b..db701d7 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 _0x9d62=['json','offset','undefined','limit','count','Content-Range','save','update','then','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9d62,0x153));var _0x29d6=function(_0x49b6b0,_0x1e0cb3){_0x49b6b0=_0x49b6b0-0x0;var _0x1742c1=_0x9d62[_0x49b6b0];return _0x1742c1;};'use strict';var emlformat=require(_0x29d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29d6('0x1'));var rp=require(_0x29d6('0x2'));var moment=require(_0x29d6('0x3'));var BPromise=require(_0x29d6('0x4'));var Mustache=require(_0x29d6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x29d6('0x6'));var ejs=require(_0x29d6('0x7'));var fs=require('fs');var fs_extra=require(_0x29d6('0x8'));var _=require(_0x29d6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29d6('0xa'));var deskjs=require(_0x29d6('0xb'));var toCsv=require(_0x29d6('0x6'));var querystring=require(_0x29d6('0xc'));var Papa=require('papaparse');var Redis=require(_0x29d6('0xd'));var authService=require(_0x29d6('0xe'));var qs=require(_0x29d6('0xf'));var as=require(_0x29d6('0x10'));var hardwareService=require(_0x29d6('0x11'));var logger=require('../../config/logger')(_0x29d6('0x12'));var utils=require(_0x29d6('0x13'));var config=require(_0x29d6('0x14'));var licenseUtil=require(_0x29d6('0x15'));var db=require(_0x29d6('0x16'))['db'];function respondWithStatusCode(_0xc5f794,_0x3f6a2a){_0x3f6a2a=_0x3f6a2a||0xcc;return function(_0x3de382){if(_0x3de382){return _0xc5f794[_0x29d6('0x17')](_0x3f6a2a);}return _0xc5f794[_0x29d6('0x18')](_0x3f6a2a)[_0x29d6('0x19')]();};}function respondWithResult(_0xcd18ae,_0x1171f5){_0x1171f5=_0x1171f5||0xc8;return function(_0x52f389){if(_0x52f389){return _0xcd18ae[_0x29d6('0x18')](_0x1171f5)[_0x29d6('0x1a')](_0x52f389);}};}function respondWithFilteredResult(_0x5e0dc9,_0x5d83d5){return function(_0x3915f4){if(_0x3915f4){var _0x332819=typeof _0x5d83d5[_0x29d6('0x1b')]===_0x29d6('0x1c')&&typeof _0x5d83d5[_0x29d6('0x1d')]===_0x29d6('0x1c');var _0x3d16d6=_0x3915f4[_0x29d6('0x1e')];var _0x17230b=_0x332819?0x0:_0x5d83d5['offset'];var _0x21443e=_0x332819?_0x3915f4[_0x29d6('0x1e')]:_0x5d83d5[_0x29d6('0x1b')]+_0x5d83d5['limit'];var _0x41942a;if(_0x21443e>=_0x3d16d6){_0x21443e=_0x3d16d6;_0x41942a=0xc8;}else{_0x41942a=0xce;}_0x5e0dc9[_0x29d6('0x18')](_0x41942a);return _0x5e0dc9['set'](_0x29d6('0x1f'),_0x17230b+'-'+_0x21443e+'/'+_0x3d16d6)[_0x29d6('0x1a')](_0x3915f4);}return null;};}function patchUpdates(_0x47040f){return function(_0x46a13d){try{jsonpatch['apply'](_0x46a13d,_0x47040f,!![]);}catch(_0x2f443a){return BPromise['reject'](_0x2f443a);}return _0x46a13d[_0x29d6('0x20')]();};}function saveUpdates(_0xa4be4e,_0x570ffe){return function(_0x2dc204){if(_0x2dc204){return _0x2dc204[_0x29d6('0x21')](_0xa4be4e)[_0x29d6('0x22')](function(_0x5b1a10){return _0x5b1a10;});}return null;};}function removeEntity(_0x41827f,_0x3d7d46){return function(_0x178dc6){if(_0x178dc6){return _0x178dc6['destroy']()[_0x29d6('0x22')](function(){_0x41827f['status'](0xcc)[_0x29d6('0x19')]();});}};}function handleEntityNotFound(_0x2787b9,_0x42ce8a){return function(_0x5c9acf){if(!_0x5c9acf){_0x2787b9['sendStatus'](0x194);}return _0x5c9acf;};}function handleError(_0x2b1898,_0x1f001b){_0x1f001b=_0x1f001b||0x1f4;return function(_0x39ff05){logger[_0x29d6('0x23')](_0x39ff05[_0x29d6('0x24')]);if(_0x39ff05[_0x29d6('0x25')]){delete _0x39ff05[_0x29d6('0x25')];}_0x2b1898[_0x29d6('0x18')](_0x1f001b)[_0x29d6('0x26')](_0x39ff05);};}exports['index']=function(_0x2c4d7a,_0x27f539){var _0x103b8c={},_0x18388b={},_0x3da089={'count':0x0,'rows':[]};var _0x52a56c=_['map'](db[_0x29d6('0x27')][_0x29d6('0x28')],function(_0x5a4c78){return{'name':_0x5a4c78[_0x29d6('0x29')],'type':_0x5a4c78[_0x29d6('0x2a')][_0x29d6('0x2b')]};});_0x18388b[_0x29d6('0x2c')]=_[_0x29d6('0x2d')](_0x52a56c,_0x29d6('0x25'));_0x18388b[_0x29d6('0x2e')]=_[_0x29d6('0x2f')](_0x2c4d7a[_0x29d6('0x2e')]);_0x18388b[_0x29d6('0x30')]=_['intersection'](_0x18388b['model'],_0x18388b[_0x29d6('0x2e')]);_0x103b8c[_0x29d6('0x31')]=_[_0x29d6('0x32')](_0x18388b['model'],qs[_0x29d6('0x33')](_0x2c4d7a['query'][_0x29d6('0x33')]));_0x103b8c[_0x29d6('0x31')]=_0x103b8c[_0x29d6('0x31')][_0x29d6('0x34')]?_0x103b8c[_0x29d6('0x31')]:_0x18388b[_0x29d6('0x2c')];if(!_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x35')](_0x29d6('0x36'))){_0x103b8c[_0x29d6('0x1d')]=qs[_0x29d6('0x1d')](_0x2c4d7a[_0x29d6('0x2e')]['limit']);_0x103b8c[_0x29d6('0x1b')]=qs[_0x29d6('0x1b')](_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x1b')]);}_0x103b8c[_0x29d6('0x37')]=qs[_0x29d6('0x38')](_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x38')]);_0x103b8c[_0x29d6('0x39')]=qs[_0x29d6('0x30')](_[_0x29d6('0x3a')](_0x2c4d7a[_0x29d6('0x2e')],_0x18388b['filters']),_0x52a56c);if(_0x2c4d7a[_0x29d6('0x2e')]['filter']){_0x103b8c[_0x29d6('0x39')]=_[_0x29d6('0x3b')](_0x103b8c[_0x29d6('0x39')],{'$or':_[_0x29d6('0x2d')](_0x52a56c,function(_0x411e6b){if(_0x411e6b['type']!=='VIRTUAL'){var _0x9cd742={};_0x9cd742[_0x411e6b['name']]={'$like':'%'+_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x3c')]+'%'};return _0x9cd742;}})});}_0x103b8c=_[_0x29d6('0x3b')]({},_0x103b8c,_0x2c4d7a[_0x29d6('0x3d')]);var _0x432146={'where':_0x103b8c['where']};return db[_0x29d6('0x27')]['count'](_0x432146)[_0x29d6('0x22')](function(_0x4b2d44){_0x3da089['count']=_0x4b2d44;if(_0x2c4d7a[_0x29d6('0x2e')]['includeAll']){_0x103b8c[_0x29d6('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0x29d6('0x3f')](_0x103b8c);})[_0x29d6('0x22')](function(_0x3d4ddd){_0x3da089[_0x29d6('0x40')]=_0x3d4ddd;return _0x3da089;})[_0x29d6('0x22')](respondWithFilteredResult(_0x27f539,_0x103b8c))['catch'](handleError(_0x27f539,null));};exports[_0x29d6('0x41')]=function(_0x1476cc,_0x1bc9af){var _0x2d91df={'raw':!![],'where':{'id':_0x1476cc[_0x29d6('0x42')]['id']}},_0x1c4bcc={};_0x1c4bcc[_0x29d6('0x2c')]=_[_0x29d6('0x2f')](db[_0x29d6('0x27')][_0x29d6('0x28')]);_0x1c4bcc[_0x29d6('0x2e')]=_['keys'](_0x1476cc[_0x29d6('0x2e')]);_0x1c4bcc[_0x29d6('0x30')]=_[_0x29d6('0x32')](_0x1c4bcc[_0x29d6('0x2c')],_0x1c4bcc['query']);_0x2d91df[_0x29d6('0x31')]=_[_0x29d6('0x32')](_0x1c4bcc[_0x29d6('0x2c')],qs[_0x29d6('0x33')](_0x1476cc['query'][_0x29d6('0x33')]));_0x2d91df[_0x29d6('0x31')]=_0x2d91df[_0x29d6('0x31')][_0x29d6('0x34')]?_0x2d91df[_0x29d6('0x31')]:_0x1c4bcc['model'];if(_0x1476cc['query'][_0x29d6('0x43')]){_0x2d91df[_0x29d6('0x3e')]=[{'all':!![]}];}_0x2d91df=_['merge']({},_0x2d91df,_0x1476cc[_0x29d6('0x3d')]);return db[_0x29d6('0x27')][_0x29d6('0x44')](_0x2d91df)['then'](handleEntityNotFound(_0x1bc9af,null))['then'](respondWithResult(_0x1bc9af,null))[_0x29d6('0x45')](handleError(_0x1bc9af,null));};exports[_0x29d6('0x46')]=function(_0x131135,_0x213a38){return db['ServicenowField'][_0x29d6('0x46')](_0x131135[_0x29d6('0x47')],{})[_0x29d6('0x22')](respondWithResult(_0x213a38,0xc9))[_0x29d6('0x45')](handleError(_0x213a38,null));};exports['update']=function(_0x2ed427,_0x56c68f){if(_0x2ed427[_0x29d6('0x47')]['id']){delete _0x2ed427[_0x29d6('0x47')]['id'];}return db[_0x29d6('0x27')][_0x29d6('0x44')]({'where':{'id':_0x2ed427[_0x29d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x56c68f,null))[_0x29d6('0x22')](saveUpdates(_0x2ed427['body'],null))[_0x29d6('0x22')](respondWithResult(_0x56c68f,null))['catch'](handleError(_0x56c68f,null));};exports[_0x29d6('0x48')]=function(_0x54cb49,_0x10f66c){return db['ServicenowField'][_0x29d6('0x44')]({'where':{'id':_0x54cb49[_0x29d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x10f66c,null))['then'](removeEntity(_0x10f66c,null))[_0x29d6('0x45')](handleError(_0x10f66c,null));}; \ No newline at end of file +var _0xae52=['destroy','name','send','index','map','ServicenowField','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then'];(function(_0x182efc,_0x481dad){var _0x215115=function(_0x10919b){while(--_0x10919b){_0x182efc['push'](_0x182efc['shift']());}};_0x215115(++_0x481dad);}(_0xae52,0x18c));var _0x2ae5=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0xae52[_0x3df223];return _0x562d11;};'use strict';var emlformat=require(_0x2ae5('0x0'));var rimraf=require(_0x2ae5('0x1'));var zipdir=require(_0x2ae5('0x2'));var jsonpatch=require(_0x2ae5('0x3'));var rp=require('request-promise');var moment=require(_0x2ae5('0x4'));var BPromise=require(_0x2ae5('0x5'));var Mustache=require(_0x2ae5('0x6'));var util=require(_0x2ae5('0x7'));var path=require(_0x2ae5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2ae5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ae5('0xa'));var squel=require(_0x2ae5('0xb'));var crypto=require(_0x2ae5('0xc'));var jsforce=require(_0x2ae5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2ae5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ae5('0xf'));var qs=require(_0x2ae5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ae5('0x11'));var logger=require(_0x2ae5('0x12'))(_0x2ae5('0x13'));var utils=require(_0x2ae5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2ae5('0x15'));var db=require(_0x2ae5('0x16'))['db'];function respondWithStatusCode(_0x18498a,_0x539a8b){_0x539a8b=_0x539a8b||0xcc;return function(_0x41bacc){if(_0x41bacc){return _0x18498a[_0x2ae5('0x17')](_0x539a8b);}return _0x18498a['status'](_0x539a8b)[_0x2ae5('0x18')]();};}function respondWithResult(_0x4a5cc3,_0x53a5ce){_0x53a5ce=_0x53a5ce||0xc8;return function(_0x57ac12){if(_0x57ac12){return _0x4a5cc3[_0x2ae5('0x19')](_0x53a5ce)[_0x2ae5('0x1a')](_0x57ac12);}};}function respondWithFilteredResult(_0x34de98,_0x219aa3){return function(_0x5981c6){if(_0x5981c6){var _0xc8b4e1=typeof _0x219aa3[_0x2ae5('0x1b')]===_0x2ae5('0x1c')&&typeof _0x219aa3[_0x2ae5('0x1d')]===_0x2ae5('0x1c');var _0x2ded34=_0x5981c6['count'];var _0x89ab77=_0xc8b4e1?0x0:_0x219aa3[_0x2ae5('0x1b')];var _0x118cd9=_0xc8b4e1?_0x5981c6[_0x2ae5('0x1e')]:_0x219aa3[_0x2ae5('0x1b')]+_0x219aa3[_0x2ae5('0x1d')];var _0x598bb1;if(_0x118cd9>=_0x2ded34){_0x118cd9=_0x2ded34;_0x598bb1=0xc8;}else{_0x598bb1=0xce;}_0x34de98[_0x2ae5('0x19')](_0x598bb1);return _0x34de98[_0x2ae5('0x1f')](_0x2ae5('0x20'),_0x89ab77+'-'+_0x118cd9+'/'+_0x2ded34)[_0x2ae5('0x1a')](_0x5981c6);}return null;};}function patchUpdates(_0x53aa4b){return function(_0x2faf88){try{jsonpatch['apply'](_0x2faf88,_0x53aa4b,!![]);}catch(_0x4d8d31){return BPromise['reject'](_0x4d8d31);}return _0x2faf88[_0x2ae5('0x21')]();};}function saveUpdates(_0x25604e,_0x1ec57b){return function(_0x49b950){if(_0x49b950){return _0x49b950[_0x2ae5('0x22')](_0x25604e)[_0x2ae5('0x23')](function(_0x220b14){return _0x220b14;});}return null;};}function removeEntity(_0x4e05db,_0x4f7c29){return function(_0x51176b){if(_0x51176b){return _0x51176b[_0x2ae5('0x24')]()[_0x2ae5('0x23')](function(){_0x4e05db['status'](0xcc)[_0x2ae5('0x18')]();});}};}function handleEntityNotFound(_0x89ee84,_0x2f965b){return function(_0x2c5e56){if(!_0x2c5e56){_0x89ee84[_0x2ae5('0x17')](0x194);}return _0x2c5e56;};}function handleError(_0x46d62c,_0x3b15e7){_0x3b15e7=_0x3b15e7||0x1f4;return function(_0x40001b){logger['error'](_0x40001b['stack']);if(_0x40001b[_0x2ae5('0x25')]){delete _0x40001b['name'];}_0x46d62c['status'](_0x3b15e7)[_0x2ae5('0x26')](_0x40001b);};}exports[_0x2ae5('0x27')]=function(_0x5549e1,_0x7fcf47){var _0x507a80={},_0x2b4718={},_0x29383d={'count':0x0,'rows':[]};var _0x19350d=_[_0x2ae5('0x28')](db[_0x2ae5('0x29')]['rawAttributes'],function(_0x1286fe){return{'name':_0x1286fe['fieldName'],'type':_0x1286fe['type'][_0x2ae5('0x2a')]};});_0x2b4718[_0x2ae5('0x2b')]=_[_0x2ae5('0x28')](_0x19350d,_0x2ae5('0x25'));_0x2b4718[_0x2ae5('0x2c')]=_[_0x2ae5('0x2d')](_0x5549e1[_0x2ae5('0x2c')]);_0x2b4718[_0x2ae5('0x2e')]=_['intersection'](_0x2b4718[_0x2ae5('0x2b')],_0x2b4718['query']);_0x507a80['attributes']=_['intersection'](_0x2b4718[_0x2ae5('0x2b')],qs[_0x2ae5('0x2f')](_0x5549e1['query'][_0x2ae5('0x2f')]));_0x507a80['attributes']=_0x507a80[_0x2ae5('0x30')][_0x2ae5('0x31')]?_0x507a80[_0x2ae5('0x30')]:_0x2b4718[_0x2ae5('0x2b')];if(!_0x5549e1['query'][_0x2ae5('0x32')](_0x2ae5('0x33'))){_0x507a80['limit']=qs[_0x2ae5('0x1d')](_0x5549e1['query'][_0x2ae5('0x1d')]);_0x507a80['offset']=qs[_0x2ae5('0x1b')](_0x5549e1[_0x2ae5('0x2c')][_0x2ae5('0x1b')]);}_0x507a80['order']=qs['sort'](_0x5549e1['query'][_0x2ae5('0x34')]);_0x507a80[_0x2ae5('0x35')]=qs[_0x2ae5('0x2e')](_[_0x2ae5('0x36')](_0x5549e1[_0x2ae5('0x2c')],_0x2b4718[_0x2ae5('0x2e')]),_0x19350d);if(_0x5549e1['query'][_0x2ae5('0x37')]){_0x507a80[_0x2ae5('0x35')]=_['merge'](_0x507a80[_0x2ae5('0x35')],{'$or':_['map'](_0x19350d,function(_0x28b3bf){if(_0x28b3bf[_0x2ae5('0x38')]!==_0x2ae5('0x39')){var _0x23602c={};_0x23602c[_0x28b3bf['name']]={'$like':'%'+_0x5549e1[_0x2ae5('0x2c')]['filter']+'%'};return _0x23602c;}})});}_0x507a80=_[_0x2ae5('0x3a')]({},_0x507a80,_0x5549e1[_0x2ae5('0x3b')]);var _0x189b7f={'where':_0x507a80['where']};return db[_0x2ae5('0x29')][_0x2ae5('0x1e')](_0x189b7f)[_0x2ae5('0x23')](function(_0x2a6907){_0x29383d[_0x2ae5('0x1e')]=_0x2a6907;if(_0x5549e1['query'][_0x2ae5('0x3c')]){_0x507a80['include']=[{'all':!![]}];}return db['ServicenowField'][_0x2ae5('0x3d')](_0x507a80);})[_0x2ae5('0x23')](function(_0xa2d5f3){_0x29383d[_0x2ae5('0x3e')]=_0xa2d5f3;return _0x29383d;})[_0x2ae5('0x23')](respondWithFilteredResult(_0x7fcf47,_0x507a80))[_0x2ae5('0x3f')](handleError(_0x7fcf47,null));};exports[_0x2ae5('0x40')]=function(_0x17c8b6,_0x3af92a){var _0x4c02a4={'raw':!![],'where':{'id':_0x17c8b6[_0x2ae5('0x41')]['id']}},_0x5563dc={};_0x5563dc[_0x2ae5('0x2b')]=_[_0x2ae5('0x2d')](db[_0x2ae5('0x29')][_0x2ae5('0x42')]);_0x5563dc[_0x2ae5('0x2c')]=_['keys'](_0x17c8b6[_0x2ae5('0x2c')]);_0x5563dc['filters']=_['intersection'](_0x5563dc[_0x2ae5('0x2b')],_0x5563dc[_0x2ae5('0x2c')]);_0x4c02a4[_0x2ae5('0x30')]=_[_0x2ae5('0x43')](_0x5563dc[_0x2ae5('0x2b')],qs[_0x2ae5('0x2f')](_0x17c8b6[_0x2ae5('0x2c')]['fields']));_0x4c02a4[_0x2ae5('0x30')]=_0x4c02a4['attributes'][_0x2ae5('0x31')]?_0x4c02a4[_0x2ae5('0x30')]:_0x5563dc['model'];if(_0x17c8b6[_0x2ae5('0x2c')][_0x2ae5('0x3c')]){_0x4c02a4[_0x2ae5('0x44')]=[{'all':!![]}];}_0x4c02a4=_[_0x2ae5('0x3a')]({},_0x4c02a4,_0x17c8b6[_0x2ae5('0x3b')]);return db['ServicenowField'][_0x2ae5('0x45')](_0x4c02a4)[_0x2ae5('0x23')](handleEntityNotFound(_0x3af92a,null))[_0x2ae5('0x23')](respondWithResult(_0x3af92a,null))[_0x2ae5('0x3f')](handleError(_0x3af92a,null));};exports[_0x2ae5('0x46')]=function(_0x39465d,_0x220343){return db[_0x2ae5('0x29')]['create'](_0x39465d[_0x2ae5('0x47')],{})[_0x2ae5('0x23')](respondWithResult(_0x220343,0xc9))[_0x2ae5('0x3f')](handleError(_0x220343,null));};exports['update']=function(_0x55f03d,_0x2c7736){if(_0x55f03d[_0x2ae5('0x47')]['id']){delete _0x55f03d[_0x2ae5('0x47')]['id'];}return db[_0x2ae5('0x29')]['find']({'where':{'id':_0x55f03d['params']['id']}})[_0x2ae5('0x23')](handleEntityNotFound(_0x2c7736,null))[_0x2ae5('0x23')](saveUpdates(_0x55f03d['body'],null))[_0x2ae5('0x23')](respondWithResult(_0x2c7736,null))[_0x2ae5('0x3f')](handleError(_0x2c7736,null));};exports[_0x2ae5('0x24')]=function(_0x14b62d,_0x64817){return db['ServicenowField']['find']({'where':{'id':_0x14b62d[_0x2ae5('0x41')]['id']}})[_0x2ae5('0x23')](handleEntityNotFound(_0x64817,null))['then'](removeEntity(_0x64817,null))[_0x2ae5('0x3f')](handleError(_0x64817,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8e502d0..8add1fa 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 _0x17ed=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0xb32b6c,_0x5b7251){var _0x3d68bc=function(_0x2ffdf5){while(--_0x2ffdf5){_0xb32b6c['push'](_0xb32b6c['shift']());}};_0x3d68bc(++_0x5b7251);}(_0x17ed,0xeb));var _0xd17e=function(_0x11b098,_0x2f119e){_0x11b098=_0x11b098-0x0;var _0x183075=_0x17ed[_0x11b098];return _0x183075;};'use strict';var _=require('lodash');var util=require(_0xd17e('0x0'));var logger=require(_0xd17e('0x1'))(_0xd17e('0x2'));var moment=require(_0xd17e('0x3'));var BPromise=require(_0xd17e('0x4'));var rp=require(_0xd17e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd17e('0x6'));var config=require(_0xd17e('0x7'));var attributes=require(_0xd17e('0x8'));module[_0xd17e('0x9')]=function(_0x4abb54,_0x5bb4d6){return _0x4abb54[_0xd17e('0xa')]('ServicenowField',attributes,{'tableName':_0xd17e('0xb'),'paranoid':![],'indexes':[{'name':_0xd17e('0xc'),'fields':[_0xd17e('0xd'),_0xd17e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ab5=['../../config/environment','./intServicenowField.attributes','exports','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x2ab5,0x95));var _0x52ab=function(_0x1e2efe,_0x49137a){_0x1e2efe=_0x1e2efe-0x0;var _0x3a6bce=_0x2ab5[_0x1e2efe];return _0x3a6bce;};'use strict';var _=require(_0x52ab('0x0'));var util=require(_0x52ab('0x1'));var logger=require(_0x52ab('0x2'))('api');var moment=require(_0x52ab('0x3'));var BPromise=require(_0x52ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52ab('0x5'));var rimraf=require(_0x52ab('0x6'));var config=require(_0x52ab('0x7'));var attributes=require(_0x52ab('0x8'));module[_0x52ab('0x9')]=function(_0x4d2125,_0x474204){return _0x4d2125['define']('ServicenowField',attributes,{'tableName':_0x52ab('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x52ab('0xb'),_0x52ab('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 811ffa7..f0ae4c1 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xda3f,0xec));var _0xfda3=function(_0xc139d3,_0x56f873){_0xc139d3=_0xc139d3-0x0;var _0x2eaf4c=_0xda3f[_0xc139d3];return _0x2eaf4c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3e0e406..7ed71b8 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(_0x7fe90f,_0x2565d6){var _0x3831dc=function(_0x1618a8){while(--_0x1618a8){_0x7fe90f['push'](_0x7fe90f['shift']());}};_0x3831dc(++_0x2565d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x31d4f0,_0x8dbb91){var _0x25833c=function(_0xc33b53){while(--_0xc33b53){_0x31d4f0['push'](_0x31d4f0['shift']());}};_0x25833c(++_0x8dbb91);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5cf8003..acb24d7 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(_0x2be26c,_0x4355b3){var _0xc7e5b5=function(_0x1c47c2){while(--_0x1c47c2){_0x2be26c['push'](_0x2be26c['shift']());}};_0xc7e5b5(++_0x4355b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x5b6e7e,_0x4c4295){var _0x5b8cc5=function(_0x672525){while(--_0x672525){_0x5b6e7e['push'](_0x5b6e7e['shift']());}};_0x5b8cc5(++_0x4c4295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 b3cf4c8..2721310 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 _0x6970=['stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6970,0x1f2));var _0x0697=function(_0x18d9f4,_0x52aa17){_0x18d9f4=_0x18d9f4-0x0;var _0x2617ce=_0x6970[_0x18d9f4];return _0x2617ce;};'use strict';var emlformat=require(_0x0697('0x0'));var rimraf=require(_0x0697('0x1'));var zipdir=require(_0x0697('0x2'));var jsonpatch=require(_0x0697('0x3'));var rp=require(_0x0697('0x4'));var moment=require('moment');var BPromise=require(_0x0697('0x5'));var Mustache=require(_0x0697('0x6'));var util=require(_0x0697('0x7'));var path=require('path');var sox=require(_0x0697('0x8'));var csv=require(_0x0697('0x9'));var ejs=require(_0x0697('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0697('0xb'));var squel=require('squel');var crypto=require(_0x0697('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0697('0xd'));var toCsv=require(_0x0697('0x9'));var querystring=require(_0x0697('0xe'));var Papa=require(_0x0697('0xf'));var Redis=require(_0x0697('0x10'));var authService=require(_0x0697('0x11'));var qs=require(_0x0697('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0697('0x13'));var logger=require(_0x0697('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0697('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a2b55,_0x13fe6c){_0x13fe6c=_0x13fe6c||0xcc;return function(_0xa68be4){if(_0xa68be4){return _0x4a2b55['sendStatus'](_0x13fe6c);}return _0x4a2b55['status'](_0x13fe6c)[_0x0697('0x16')]();};}function respondWithResult(_0x4dc2ee,_0x1133d7){_0x1133d7=_0x1133d7||0xc8;return function(_0x414c7a){if(_0x414c7a){return _0x4dc2ee['status'](_0x1133d7)[_0x0697('0x17')](_0x414c7a);}};}function respondWithFilteredResult(_0x462314,_0x4aa204){return function(_0x3de802){if(_0x3de802){var _0x16fcbf=typeof _0x4aa204[_0x0697('0x18')]===_0x0697('0x19')&&typeof _0x4aa204['limit']===_0x0697('0x19');var _0x81f6be=_0x3de802['count'];var _0x120b18=_0x16fcbf?0x0:_0x4aa204[_0x0697('0x18')];var _0x31f1db=_0x16fcbf?_0x3de802[_0x0697('0x1a')]:_0x4aa204['offset']+_0x4aa204['limit'];var _0x46ee15;if(_0x31f1db>=_0x81f6be){_0x31f1db=_0x81f6be;_0x46ee15=0xc8;}else{_0x46ee15=0xce;}_0x462314[_0x0697('0x1b')](_0x46ee15);return _0x462314[_0x0697('0x1c')](_0x0697('0x1d'),_0x120b18+'-'+_0x31f1db+'/'+_0x81f6be)[_0x0697('0x17')](_0x3de802);}return null;};}function patchUpdates(_0x3315d8){return function(_0x9d24cf){try{jsonpatch[_0x0697('0x1e')](_0x9d24cf,_0x3315d8,!![]);}catch(_0x4b9227){return BPromise[_0x0697('0x1f')](_0x4b9227);}return _0x9d24cf[_0x0697('0x20')]();};}function saveUpdates(_0x5087e7,_0x68ab67){return function(_0x555679){if(_0x555679){return _0x555679[_0x0697('0x21')](_0x5087e7)[_0x0697('0x22')](function(_0x3ea5da){return _0x3ea5da;});}return null;};}function removeEntity(_0x2e1fdd,_0x1ba53f){return function(_0x231deb){if(_0x231deb){return _0x231deb[_0x0697('0x23')]()['then'](function(){_0x2e1fdd['status'](0xcc)[_0x0697('0x16')]();});}};}function handleEntityNotFound(_0x2b3744,_0x7a8157){return function(_0x29762d){if(!_0x29762d){_0x2b3744[_0x0697('0x24')](0x194);}return _0x29762d;};}function handleError(_0x35693e,_0x170b73){_0x170b73=_0x170b73||0x1f4;return function(_0x252017){logger['error'](_0x252017[_0x0697('0x25')]);if(_0x252017[_0x0697('0x26')]){delete _0x252017['name'];}_0x35693e[_0x0697('0x1b')](_0x170b73)[_0x0697('0x27')](_0x252017);};}exports[_0x0697('0x28')]=function(_0x12a915,_0x182f2c){var _0x4b307d={},_0x1b8452={},_0x42040a={'count':0x0,'rows':[]};var _0x17e58e=_[_0x0697('0x29')](db[_0x0697('0x2a')][_0x0697('0x2b')],function(_0x18dc3f){return{'name':_0x18dc3f[_0x0697('0x2c')],'type':_0x18dc3f[_0x0697('0x2d')][_0x0697('0x2e')]};});_0x1b8452[_0x0697('0x2f')]=_['map'](_0x17e58e,'name');_0x1b8452[_0x0697('0x30')]=_[_0x0697('0x31')](_0x12a915[_0x0697('0x30')]);_0x1b8452['filters']=_[_0x0697('0x32')](_0x1b8452['model'],_0x1b8452['query']);_0x4b307d['attributes']=_['intersection'](_0x1b8452['model'],qs[_0x0697('0x33')](_0x12a915[_0x0697('0x30')]['fields']));_0x4b307d['attributes']=_0x4b307d[_0x0697('0x34')][_0x0697('0x35')]?_0x4b307d[_0x0697('0x34')]:_0x1b8452[_0x0697('0x2f')];if(!_0x12a915[_0x0697('0x30')][_0x0697('0x36')](_0x0697('0x37'))){_0x4b307d['limit']=qs[_0x0697('0x38')](_0x12a915['query'][_0x0697('0x38')]);_0x4b307d['offset']=qs[_0x0697('0x18')](_0x12a915[_0x0697('0x30')][_0x0697('0x18')]);}_0x4b307d[_0x0697('0x39')]=qs[_0x0697('0x3a')](_0x12a915['query'][_0x0697('0x3a')]);_0x4b307d['where']=qs[_0x0697('0x3b')](_[_0x0697('0x3c')](_0x12a915['query'],_0x1b8452[_0x0697('0x3b')]),_0x17e58e);if(_0x12a915[_0x0697('0x30')][_0x0697('0x3d')]){_0x4b307d[_0x0697('0x3e')]=_[_0x0697('0x3f')](_0x4b307d['where'],{'$or':_[_0x0697('0x29')](_0x17e58e,function(_0x1b3606){if(_0x1b3606['type']!==_0x0697('0x40')){var _0x14f8db={};_0x14f8db[_0x1b3606['name']]={'$like':'%'+_0x12a915[_0x0697('0x30')][_0x0697('0x3d')]+'%'};return _0x14f8db;}})});}_0x4b307d=_[_0x0697('0x3f')]({},_0x4b307d,_0x12a915[_0x0697('0x41')]);var _0x111c39={'where':_0x4b307d[_0x0697('0x3e')]};return db[_0x0697('0x2a')][_0x0697('0x1a')](_0x111c39)[_0x0697('0x22')](function(_0x38adec){_0x42040a[_0x0697('0x1a')]=_0x38adec;if(_0x12a915[_0x0697('0x30')][_0x0697('0x42')]){_0x4b307d[_0x0697('0x43')]=[{'all':!![]}];}return db[_0x0697('0x2a')][_0x0697('0x44')](_0x4b307d);})[_0x0697('0x22')](function(_0x239426){_0x42040a[_0x0697('0x45')]=_0x239426;return _0x42040a;})[_0x0697('0x22')](respondWithFilteredResult(_0x182f2c,_0x4b307d))[_0x0697('0x46')](handleError(_0x182f2c,null));};exports[_0x0697('0x47')]=function(_0xdde320,_0x16f5bd){var _0x2b111a={'raw':![],'where':{'id':_0xdde320[_0x0697('0x48')]['id']}},_0x2ec74d={};_0x2ec74d[_0x0697('0x2f')]=_[_0x0697('0x31')](db[_0x0697('0x2a')][_0x0697('0x2b')]);_0x2ec74d[_0x0697('0x30')]=_['keys'](_0xdde320['query']);_0x2ec74d[_0x0697('0x3b')]=_[_0x0697('0x32')](_0x2ec74d[_0x0697('0x2f')],_0x2ec74d[_0x0697('0x30')]);_0x2b111a['attributes']=_[_0x0697('0x32')](_0x2ec74d[_0x0697('0x2f')],qs['fields'](_0xdde320[_0x0697('0x30')][_0x0697('0x33')]));_0x2b111a[_0x0697('0x34')]=_0x2b111a[_0x0697('0x34')][_0x0697('0x35')]?_0x2b111a['attributes']:_0x2ec74d[_0x0697('0x2f')];if(_0xdde320[_0x0697('0x30')][_0x0697('0x42')]){_0x2b111a[_0x0697('0x43')]=[{'all':!![]}];}_0x2b111a=_[_0x0697('0x3f')]({},_0x2b111a,_0xdde320['options']);return db[_0x0697('0x2a')][_0x0697('0x49')](_0x2b111a)[_0x0697('0x22')](handleEntityNotFound(_0x16f5bd,null))['then'](respondWithResult(_0x16f5bd,null))['catch'](handleError(_0x16f5bd,null));};exports[_0x0697('0x4a')]=function(_0x5250d5,_0x156247){return db[_0x0697('0x2a')][_0x0697('0x4a')](_0x5250d5['body'],{})['then'](respondWithResult(_0x156247,0xc9))['catch'](handleError(_0x156247,null));};exports[_0x0697('0x21')]=function(_0x5dd9a4,_0x5334c5){if(_0x5dd9a4[_0x0697('0x4b')]['id']){delete _0x5dd9a4[_0x0697('0x4b')]['id'];}return db[_0x0697('0x2a')]['find']({'where':{'id':_0x5dd9a4['params']['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x5334c5,null))[_0x0697('0x22')](saveUpdates(_0x5dd9a4[_0x0697('0x4b')],null))['then'](respondWithResult(_0x5334c5,null))[_0x0697('0x46')](handleError(_0x5334c5,null));};exports[_0x0697('0x23')]=function(_0x4c5664,_0x180719){return db['SugarcrmAccount'][_0x0697('0x49')]({'where':{'id':_0x4c5664[_0x0697('0x48')]['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x180719,null))['then'](removeEntity(_0x180719,null))[_0x0697('0x46')](handleError(_0x180719,null));};exports[_0x0697('0x4c')]=function(_0x3a57c,_0x38e955,_0x53645b){var _0xaeb5f5={};var _0x18a7b4={};var _0x44c307;var _0x565a61;return db['SugarcrmAccount'][_0x0697('0x4d')]({'where':{'id':_0x3a57c['params']['id']}})['then'](handleEntityNotFound(_0x38e955,null))[_0x0697('0x22')](function(_0x5a73bb){if(_0x5a73bb){_0x44c307=_0x5a73bb;_0x18a7b4[_0x0697('0x2f')]=_[_0x0697('0x31')](db[_0x0697('0x4e')][_0x0697('0x2b')]);_0x18a7b4[_0x0697('0x30')]=_[_0x0697('0x31')](_0x3a57c[_0x0697('0x30')]);_0x18a7b4[_0x0697('0x3b')]=_['intersection'](_0x18a7b4['model'],_0x18a7b4[_0x0697('0x30')]);_0xaeb5f5[_0x0697('0x34')]=_[_0x0697('0x32')](_0x18a7b4['model'],qs[_0x0697('0x33')](_0x3a57c[_0x0697('0x30')][_0x0697('0x33')]));_0xaeb5f5[_0x0697('0x34')]=_0xaeb5f5[_0x0697('0x34')]['length']?_0xaeb5f5['attributes']:_0x18a7b4[_0x0697('0x2f')];_0xaeb5f5['order']=qs[_0x0697('0x3a')](_0x3a57c['query'][_0x0697('0x3a')]);_0xaeb5f5[_0x0697('0x3e')]=qs['filters'](_[_0x0697('0x3c')](_0x3a57c[_0x0697('0x30')],_0x18a7b4[_0x0697('0x3b')]));if(_0x3a57c[_0x0697('0x30')]['filter']){_0xaeb5f5[_0x0697('0x3e')]=_[_0x0697('0x3f')](_0xaeb5f5[_0x0697('0x3e')],{'$or':_[_0x0697('0x29')](_0xaeb5f5[_0x0697('0x34')],function(_0x587235){var _0x351bae={};_0x351bae[_0x587235]={'$like':'%'+_0x3a57c[_0x0697('0x30')][_0x0697('0x3d')]+'%'};return _0x351bae;})});}_0xaeb5f5=_[_0x0697('0x3f')]({},_0xaeb5f5,_0x3a57c[_0x0697('0x41')]);return _0x44c307[_0x0697('0x4c')](_0xaeb5f5);}})['then'](function(_0x58b14a){if(_0x58b14a){_0x565a61=_0x58b14a[_0x0697('0x35')];if(!_0x3a57c['query'][_0x0697('0x36')](_0x0697('0x37'))){_0xaeb5f5[_0x0697('0x38')]=qs[_0x0697('0x38')](_0x3a57c['query'][_0x0697('0x38')]);_0xaeb5f5[_0x0697('0x18')]=qs['offset'](_0x3a57c[_0x0697('0x30')][_0x0697('0x18')]);}return _0x44c307[_0x0697('0x4c')](_0xaeb5f5);}})[_0x0697('0x22')](function(_0x161ea9){if(_0x161ea9){return _0x161ea9?{'count':_0x565a61,'rows':_0x161ea9}:null;}})[_0x0697('0x22')](respondWithResult(_0x38e955,null))[_0x0697('0x46')](handleError(_0x38e955,null));};exports[_0x0697('0x4f')]=function(_0x29fe5d,_0x4e646e,_0x2aa917){if(_0x29fe5d['body']['id']){delete _0x29fe5d['body']['id'];}return db[_0x0697('0x2a')][_0x0697('0x4d')]({'where':{'id':_0x29fe5d[_0x0697('0x48')]['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x4e646e,null))['then'](function(_0x456573){if(_0x456573){_0x29fe5d[_0x0697('0x4b')][_0x0697('0x50')]=_0x456573['id'];_0x29fe5d[_0x0697('0x4b')]['Subjects']=integrations[_0x0697('0x51')](_0x29fe5d[_0x0697('0x4b')][_0x0697('0x52')],_0x29fe5d[_0x0697('0x4b')][_0x0697('0x2d')]);_0x29fe5d[_0x0697('0x4b')][_0x0697('0x53')]=integrations['getDescriptions'](_0x29fe5d[_0x0697('0x4b')][_0x0697('0x52')],_0x29fe5d[_0x0697('0x4b')][_0x0697('0x2d')]);return db[_0x0697('0x4e')][_0x0697('0x4a')](_0x29fe5d[_0x0697('0x4b')],{'include':[{'model':db[_0x0697('0x54')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x0697('0x53')}]});}return null;})['then'](respondWithResult(_0x4e646e,null))[_0x0697('0x46')](handleError(_0x4e646e,null));};exports[_0x0697('0x55')]=function(_0x297dec,_0x5e62f6,_0x577292){var _0x3fea23='';var _0x8126d3=['id',_0x0697('0x26'),_0x0697('0x56'),_0x0697('0x57'),_0x0697('0x58'),_0x0697('0x59'),'duration_hours',_0x0697('0x5a'),_0x0697('0x5b'),_0x0697('0x5c'),_0x0697('0x5d'),'direction'];return db[_0x0697('0x2a')][_0x0697('0x4d')]({'where':{'id':_0x297dec['params']['id']},'attributes':['id','username',_0x0697('0x5e'),_0x0697('0x5f')]})['then'](handleEntityNotFound(_0x5e62f6,null))[_0x0697('0x22')](function(_0x1604bb){if(_0x1604bb){_0x3fea23=_0x1604bb[_0x0697('0x5f')];var _0x46b3ca=_0x3fea23[_0x0697('0x60')](-0x1);if(_0x46b3ca==='/'){_0x3fea23=_0x3fea23[_0x0697('0x61')](0x0,_0x3fea23[_0x0697('0x62')](_0x46b3ca));}return rp({'method':_0x0697('0x63'),'uri':util[_0x0697('0x64')](_0x0697('0x65'),_0x3fea23,_0x0697('0x66')),'json':!![],'form':{'method':'login','input_type':_0x0697('0x67'),'response_type':_0x0697('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1604bb[_0x0697('0x68')],'password':_0x1604bb[_0x0697('0x5e')],'encryption':_0x0697('0x69')},'application':_0x0697('0x6a')})}});}})[_0x0697('0x22')](function(_0x3478b8){if(_0x3478b8&&_0x3478b8[_0x0697('0x26')]!==_0x0697('0x6b')&&_0x3478b8[_0x0697('0x26')]!==_0x0697('0x6c')){return rp({'method':'POST','uri':util[_0x0697('0x64')]('%s%s',_0x3fea23,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0697('0x6d'),'input_type':_0x0697('0x67'),'response_type':_0x0697('0x67'),'rest_data':JSON['stringify']({'session':_0x3478b8['id'],'module_name':_0x0697('0x6e')})}})[_0x0697('0x22')](function(_0x39f7a1){if(_0x39f7a1){var _0x8da5d2=_[_0x0697('0x6f')](_0x39f7a1[_0x0697('0x70')]);_[_0x0697('0x71')](_0x8da5d2,function(_0x3113b8){return _0x8126d3[_0x0697('0x72')](_0x3113b8[_0x0697('0x26')]);});return{'count':_0x8da5d2['length'],'rows':_[_0x0697('0x29')](_0x8da5d2,function(_0x5c53b8){return{'id':_0x5c53b8[_0x0697('0x26')],'name':_0x5c53b8[_0x0697('0x73')],'custom':_[_0x0697('0x74')](_0x5c53b8[_0x0697('0x26')],'_c')?!![]:![],'options':_0x5c53b8[_0x0697('0x41')]?_['map'](_[_0x0697('0x6f')](_0x5c53b8['options']),function(_0x340f51){return{'name':_0x340f51[_0x0697('0x75')],'value':_0x340f51[_0x0697('0x26')]};}):[]};})};}})[_0x0697('0x22')](respondWithResult(_0x5e62f6,null))['catch'](function(_0x5110f5){var _0x5401fb=_0x297dec[_0x0697('0x30')][_0x0697('0x76')]?0x1f4:_0x5110f5[_0x0697('0x77')]||0x1f4;logger[_0x0697('0x78')](_0x0697('0x79'),_0x0697('0x55'),_0x5401fb,JSON[_0x0697('0x7a')](_0x5110f5));delete _0x5110f5['name'];if(_0x5401fb===0x191){_0x5401fb=0x190;}_0x5e62f6[_0x0697('0x1b')](_0x5401fb)[_0x0697('0x27')](_0x297dec['query'][_0x0697('0x76')]?{'message':_0x0697('0x7b'),'statusCode':_0x5110f5[_0x0697('0x77')]}:_0x5110f5);});}else{var _0x1736c7=0x1f4;_0x5e62f6[_0x0697('0x1b')](_0x1736c7)[_0x0697('0x27')]({'message':_0x0697('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4930=['model','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','catch','show','keys','intersection','find','create','body','params','destroy','getConfigurations','SugarcrmConfiguration','length','order','getSubjects','getDescriptions','channel','SugarcrmField','Subjects','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','findOne','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key'];(function(_0x2c0f35,_0x14db9a){var _0x185496=function(_0x5b6e37){while(--_0x5b6e37){_0x2c0f35['push'](_0x2c0f35['shift']());}};_0x185496(++_0x14db9a);}(_0x4930,0x1b1));var _0x0493=function(_0x490bb3,_0x6665ab){_0x490bb3=_0x490bb3-0x0;var _0x26bd46=_0x4930[_0x490bb3];return _0x26bd46;};'use strict';var emlformat=require(_0x0493('0x0'));var rimraf=require(_0x0493('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0493('0x2'));var rp=require(_0x0493('0x3'));var moment=require(_0x0493('0x4'));var BPromise=require(_0x0493('0x5'));var Mustache=require(_0x0493('0x6'));var util=require(_0x0493('0x7'));var path=require(_0x0493('0x8'));var sox=require(_0x0493('0x9'));var csv=require(_0x0493('0xa'));var ejs=require(_0x0493('0xb'));var fs=require('fs');var fs_extra=require(_0x0493('0xc'));var _=require(_0x0493('0xd'));var squel=require('squel');var crypto=require(_0x0493('0xe'));var jsforce=require(_0x0493('0xf'));var deskjs=require(_0x0493('0x10'));var toCsv=require(_0x0493('0xa'));var querystring=require(_0x0493('0x11'));var Papa=require(_0x0493('0x12'));var Redis=require(_0x0493('0x13'));var authService=require(_0x0493('0x14'));var qs=require(_0x0493('0x15'));var as=require(_0x0493('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0493('0x17'));var utils=require(_0x0493('0x18'));var config=require(_0x0493('0x19'));var licenseUtil=require(_0x0493('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0493('0x1b'));function respondWithStatusCode(_0x2b774c,_0x156a23){_0x156a23=_0x156a23||0xcc;return function(_0x16220b){if(_0x16220b){return _0x2b774c['sendStatus'](_0x156a23);}return _0x2b774c[_0x0493('0x1c')](_0x156a23)[_0x0493('0x1d')]();};}function respondWithResult(_0x1bd13b,_0xa8280f){_0xa8280f=_0xa8280f||0xc8;return function(_0x5026a8){if(_0x5026a8){return _0x1bd13b['status'](_0xa8280f)[_0x0493('0x1e')](_0x5026a8);}};}function respondWithFilteredResult(_0x83107e,_0x4c81f3){return function(_0x128546){if(_0x128546){var _0x2e189f=typeof _0x4c81f3['offset']===_0x0493('0x1f')&&typeof _0x4c81f3[_0x0493('0x20')]===_0x0493('0x1f');var _0x1d78c6=_0x128546['count'];var _0x3acc00=_0x2e189f?0x0:_0x4c81f3[_0x0493('0x21')];var _0x418ed1=_0x2e189f?_0x128546[_0x0493('0x22')]:_0x4c81f3[_0x0493('0x21')]+_0x4c81f3['limit'];var _0x21a84c;if(_0x418ed1>=_0x1d78c6){_0x418ed1=_0x1d78c6;_0x21a84c=0xc8;}else{_0x21a84c=0xce;}_0x83107e[_0x0493('0x1c')](_0x21a84c);return _0x83107e[_0x0493('0x23')](_0x0493('0x24'),_0x3acc00+'-'+_0x418ed1+'/'+_0x1d78c6)['json'](_0x128546);}return null;};}function patchUpdates(_0x5888fe){return function(_0x4046a2){try{jsonpatch[_0x0493('0x25')](_0x4046a2,_0x5888fe,!![]);}catch(_0x3d4ce6){return BPromise[_0x0493('0x26')](_0x3d4ce6);}return _0x4046a2['save']();};}function saveUpdates(_0x1e4af4,_0x5514c5){return function(_0x350122){if(_0x350122){return _0x350122[_0x0493('0x27')](_0x1e4af4)['then'](function(_0x1eb5a8){return _0x1eb5a8;});}return null;};}function removeEntity(_0x4fc155,_0x177d8f){return function(_0x31e022){if(_0x31e022){return _0x31e022['destroy']()[_0x0493('0x28')](function(){_0x4fc155['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51250c,_0xd490f){return function(_0x15d140){if(!_0x15d140){_0x51250c['sendStatus'](0x194);}return _0x15d140;};}function handleError(_0x42ba74,_0x136ebb){_0x136ebb=_0x136ebb||0x1f4;return function(_0xb2cdde){logger[_0x0493('0x29')](_0xb2cdde[_0x0493('0x2a')]);if(_0xb2cdde['name']){delete _0xb2cdde[_0x0493('0x2b')];}_0x42ba74['status'](_0x136ebb)[_0x0493('0x2c')](_0xb2cdde);};}exports[_0x0493('0x2d')]=function(_0x2ca685,_0x590679){var _0x4a8e25={},_0x33d428={},_0x4716e7={'count':0x0,'rows':[]};var _0x467663=_[_0x0493('0x2e')](db[_0x0493('0x2f')][_0x0493('0x30')],function(_0x1194b5){return{'name':_0x1194b5['fieldName'],'type':_0x1194b5[_0x0493('0x31')][_0x0493('0x32')]};});_0x33d428[_0x0493('0x33')]=_['map'](_0x467663,_0x0493('0x2b'));_0x33d428[_0x0493('0x34')]=_['keys'](_0x2ca685[_0x0493('0x34')]);_0x33d428['filters']=_['intersection'](_0x33d428['model'],_0x33d428[_0x0493('0x34')]);_0x4a8e25[_0x0493('0x35')]=_['intersection'](_0x33d428['model'],qs[_0x0493('0x36')](_0x2ca685[_0x0493('0x34')]['fields']));_0x4a8e25['attributes']=_0x4a8e25[_0x0493('0x35')]['length']?_0x4a8e25[_0x0493('0x35')]:_0x33d428[_0x0493('0x33')];if(!_0x2ca685[_0x0493('0x34')][_0x0493('0x37')](_0x0493('0x38'))){_0x4a8e25[_0x0493('0x20')]=qs['limit'](_0x2ca685[_0x0493('0x34')][_0x0493('0x20')]);_0x4a8e25[_0x0493('0x21')]=qs[_0x0493('0x21')](_0x2ca685[_0x0493('0x34')][_0x0493('0x21')]);}_0x4a8e25['order']=qs[_0x0493('0x39')](_0x2ca685[_0x0493('0x34')][_0x0493('0x39')]);_0x4a8e25['where']=qs[_0x0493('0x3a')](_[_0x0493('0x3b')](_0x2ca685['query'],_0x33d428['filters']),_0x467663);if(_0x2ca685[_0x0493('0x34')]['filter']){_0x4a8e25[_0x0493('0x3c')]=_['merge'](_0x4a8e25[_0x0493('0x3c')],{'$or':_[_0x0493('0x2e')](_0x467663,function(_0x4a25ed){if(_0x4a25ed[_0x0493('0x31')]!==_0x0493('0x3d')){var _0x32ab8e={};_0x32ab8e[_0x4a25ed['name']]={'$like':'%'+_0x2ca685[_0x0493('0x34')][_0x0493('0x3e')]+'%'};return _0x32ab8e;}})});}_0x4a8e25=_[_0x0493('0x3f')]({},_0x4a8e25,_0x2ca685[_0x0493('0x40')]);var _0x415e34={'where':_0x4a8e25['where']};return db['SugarcrmAccount'][_0x0493('0x22')](_0x415e34)[_0x0493('0x28')](function(_0x197c94){_0x4716e7[_0x0493('0x22')]=_0x197c94;if(_0x2ca685['query'][_0x0493('0x41')]){_0x4a8e25[_0x0493('0x42')]=[{'all':!![]}];}return db[_0x0493('0x2f')]['findAll'](_0x4a8e25);})[_0x0493('0x28')](function(_0x305fa6){_0x4716e7['rows']=_0x305fa6;return _0x4716e7;})[_0x0493('0x28')](respondWithFilteredResult(_0x590679,_0x4a8e25))[_0x0493('0x43')](handleError(_0x590679,null));};exports[_0x0493('0x44')]=function(_0x11b262,_0x2aebfe){var _0x139d79={'raw':![],'where':{'id':_0x11b262['params']['id']}},_0x556a4c={};_0x556a4c[_0x0493('0x33')]=_[_0x0493('0x45')](db[_0x0493('0x2f')][_0x0493('0x30')]);_0x556a4c[_0x0493('0x34')]=_['keys'](_0x11b262[_0x0493('0x34')]);_0x556a4c[_0x0493('0x3a')]=_['intersection'](_0x556a4c[_0x0493('0x33')],_0x556a4c[_0x0493('0x34')]);_0x139d79[_0x0493('0x35')]=_[_0x0493('0x46')](_0x556a4c['model'],qs[_0x0493('0x36')](_0x11b262[_0x0493('0x34')]['fields']));_0x139d79[_0x0493('0x35')]=_0x139d79[_0x0493('0x35')]['length']?_0x139d79[_0x0493('0x35')]:_0x556a4c[_0x0493('0x33')];if(_0x11b262[_0x0493('0x34')][_0x0493('0x41')]){_0x139d79['include']=[{'all':!![]}];}_0x139d79=_['merge']({},_0x139d79,_0x11b262[_0x0493('0x40')]);return db[_0x0493('0x2f')][_0x0493('0x47')](_0x139d79)[_0x0493('0x28')](handleEntityNotFound(_0x2aebfe,null))[_0x0493('0x28')](respondWithResult(_0x2aebfe,null))['catch'](handleError(_0x2aebfe,null));};exports[_0x0493('0x48')]=function(_0x4eb3bc,_0xf7a9e7){return db[_0x0493('0x2f')][_0x0493('0x48')](_0x4eb3bc[_0x0493('0x49')],{})[_0x0493('0x28')](respondWithResult(_0xf7a9e7,0xc9))[_0x0493('0x43')](handleError(_0xf7a9e7,null));};exports['update']=function(_0x4409c7,_0x2d3109){if(_0x4409c7[_0x0493('0x49')]['id']){delete _0x4409c7[_0x0493('0x49')]['id'];}return db[_0x0493('0x2f')]['find']({'where':{'id':_0x4409c7[_0x0493('0x4a')]['id']}})[_0x0493('0x28')](handleEntityNotFound(_0x2d3109,null))[_0x0493('0x28')](saveUpdates(_0x4409c7[_0x0493('0x49')],null))[_0x0493('0x28')](respondWithResult(_0x2d3109,null))[_0x0493('0x43')](handleError(_0x2d3109,null));};exports[_0x0493('0x4b')]=function(_0x509759,_0xd9b085){return db[_0x0493('0x2f')][_0x0493('0x47')]({'where':{'id':_0x509759[_0x0493('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd9b085,null))[_0x0493('0x28')](removeEntity(_0xd9b085,null))[_0x0493('0x43')](handleError(_0xd9b085,null));};exports[_0x0493('0x4c')]=function(_0x418d9d,_0x410548,_0x30226a){var _0x906969={};var _0x5fb7db={};var _0x252df6;var _0x1453c5;return db[_0x0493('0x2f')]['findOne']({'where':{'id':_0x418d9d[_0x0493('0x4a')]['id']}})[_0x0493('0x28')](handleEntityNotFound(_0x410548,null))[_0x0493('0x28')](function(_0x270959){if(_0x270959){_0x252df6=_0x270959;_0x5fb7db[_0x0493('0x33')]=_[_0x0493('0x45')](db[_0x0493('0x4d')]['rawAttributes']);_0x5fb7db['query']=_['keys'](_0x418d9d['query']);_0x5fb7db[_0x0493('0x3a')]=_[_0x0493('0x46')](_0x5fb7db['model'],_0x5fb7db[_0x0493('0x34')]);_0x906969[_0x0493('0x35')]=_[_0x0493('0x46')](_0x5fb7db[_0x0493('0x33')],qs[_0x0493('0x36')](_0x418d9d[_0x0493('0x34')]['fields']));_0x906969[_0x0493('0x35')]=_0x906969['attributes'][_0x0493('0x4e')]?_0x906969[_0x0493('0x35')]:_0x5fb7db[_0x0493('0x33')];_0x906969[_0x0493('0x4f')]=qs[_0x0493('0x39')](_0x418d9d[_0x0493('0x34')][_0x0493('0x39')]);_0x906969[_0x0493('0x3c')]=qs[_0x0493('0x3a')](_[_0x0493('0x3b')](_0x418d9d[_0x0493('0x34')],_0x5fb7db[_0x0493('0x3a')]));if(_0x418d9d['query'][_0x0493('0x3e')]){_0x906969['where']=_[_0x0493('0x3f')](_0x906969[_0x0493('0x3c')],{'$or':_[_0x0493('0x2e')](_0x906969[_0x0493('0x35')],function(_0x1b61e3){var _0x4fa20f={};_0x4fa20f[_0x1b61e3]={'$like':'%'+_0x418d9d['query'][_0x0493('0x3e')]+'%'};return _0x4fa20f;})});}_0x906969=_['merge']({},_0x906969,_0x418d9d[_0x0493('0x40')]);return _0x252df6[_0x0493('0x4c')](_0x906969);}})[_0x0493('0x28')](function(_0x2df5ba){if(_0x2df5ba){_0x1453c5=_0x2df5ba[_0x0493('0x4e')];if(!_0x418d9d[_0x0493('0x34')][_0x0493('0x37')]('nolimit')){_0x906969[_0x0493('0x20')]=qs[_0x0493('0x20')](_0x418d9d['query'][_0x0493('0x20')]);_0x906969[_0x0493('0x21')]=qs[_0x0493('0x21')](_0x418d9d[_0x0493('0x34')]['offset']);}return _0x252df6[_0x0493('0x4c')](_0x906969);}})[_0x0493('0x28')](function(_0x9ebe68){if(_0x9ebe68){return _0x9ebe68?{'count':_0x1453c5,'rows':_0x9ebe68}:null;}})[_0x0493('0x28')](respondWithResult(_0x410548,null))['catch'](handleError(_0x410548,null));};exports['addConfiguration']=function(_0x703efc,_0xe4712c,_0x45d1f8){if(_0x703efc[_0x0493('0x49')]['id']){delete _0x703efc[_0x0493('0x49')]['id'];}return db[_0x0493('0x2f')]['findOne']({'where':{'id':_0x703efc[_0x0493('0x4a')]['id']}})[_0x0493('0x28')](handleEntityNotFound(_0xe4712c,null))[_0x0493('0x28')](function(_0x2b761f){if(_0x2b761f){_0x703efc['body']['AccountId']=_0x2b761f['id'];_0x703efc[_0x0493('0x49')]['Subjects']=integrations[_0x0493('0x50')](_0x703efc['body']['channel'],_0x703efc[_0x0493('0x49')][_0x0493('0x31')]);_0x703efc[_0x0493('0x49')]['Descriptions']=integrations[_0x0493('0x51')](_0x703efc[_0x0493('0x49')][_0x0493('0x52')],_0x703efc[_0x0493('0x49')][_0x0493('0x31')]);return db[_0x0493('0x4d')][_0x0493('0x48')](_0x703efc[_0x0493('0x49')],{'include':[{'model':db[_0x0493('0x53')],'as':_0x0493('0x54')},{'model':db[_0x0493('0x53')],'as':_0x0493('0x55')}]});}return null;})['then'](respondWithResult(_0xe4712c,null))[_0x0493('0x43')](handleError(_0xe4712c,null));};exports[_0x0493('0x56')]=function(_0xc3ecf8,_0x160891,_0x7dc3fe){var _0x18c1c4='';var _0x489fe1=['id',_0x0493('0x2b'),_0x0493('0x57'),_0x0493('0x58'),_0x0493('0x59'),_0x0493('0x5a'),_0x0493('0x5b'),_0x0493('0x5c'),_0x0493('0x5d'),_0x0493('0x5e'),_0x0493('0x5f'),_0x0493('0x60')];return db[_0x0493('0x2f')][_0x0493('0x61')]({'where':{'id':_0xc3ecf8[_0x0493('0x4a')]['id']},'attributes':['id',_0x0493('0x62'),_0x0493('0x63'),_0x0493('0x64')]})['then'](handleEntityNotFound(_0x160891,null))['then'](function(_0x13e0ca){if(_0x13e0ca){_0x18c1c4=_0x13e0ca['remoteUri'];var _0x4d1e44=_0x18c1c4['slice'](-0x1);if(_0x4d1e44==='/'){_0x18c1c4=_0x18c1c4[_0x0493('0x65')](0x0,_0x18c1c4['lastIndexOf'](_0x4d1e44));}return rp({'method':_0x0493('0x66'),'uri':util[_0x0493('0x67')](_0x0493('0x68'),_0x18c1c4,_0x0493('0x69')),'json':!![],'form':{'method':_0x0493('0x6a'),'input_type':_0x0493('0x6b'),'response_type':'JSON','rest_data':JSON[_0x0493('0x6c')]({'user_auth':{'user_name':_0x13e0ca[_0x0493('0x62')],'password':_0x13e0ca['password'],'encryption':'PLAIN'},'application':_0x0493('0x6d')})}});}})[_0x0493('0x28')](function(_0x2c4ce4){if(_0x2c4ce4&&_0x2c4ce4[_0x0493('0x2b')]!=='Invalid\x20Login'&&_0x2c4ce4[_0x0493('0x2b')]!==_0x0493('0x6e')){return rp({'method':_0x0493('0x66'),'uri':util['format'](_0x0493('0x68'),_0x18c1c4,_0x0493('0x69')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0493('0x6b'),'response_type':_0x0493('0x6b'),'rest_data':JSON[_0x0493('0x6c')]({'session':_0x2c4ce4['id'],'module_name':_0x0493('0x6f')})}})[_0x0493('0x28')](function(_0x12fb21){if(_0x12fb21){var _0x4e7e07=_[_0x0493('0x70')](_0x12fb21[_0x0493('0x71')]);_['remove'](_0x4e7e07,function(_0x2144aa){return _0x489fe1['includes'](_0x2144aa[_0x0493('0x2b')]);});return{'count':_0x4e7e07[_0x0493('0x4e')],'rows':_[_0x0493('0x2e')](_0x4e7e07,function(_0x856155){return{'id':_0x856155[_0x0493('0x2b')],'name':_0x856155[_0x0493('0x72')],'custom':_[_0x0493('0x73')](_0x856155['name'],'_c')?!![]:![],'options':_0x856155[_0x0493('0x40')]?_[_0x0493('0x2e')](_[_0x0493('0x70')](_0x856155[_0x0493('0x40')]),function(_0x48c2bd){return{'name':_0x48c2bd[_0x0493('0x74')],'value':_0x48c2bd[_0x0493('0x2b')]};}):[]};})};}})['then'](respondWithResult(_0x160891,null))[_0x0493('0x43')](function(_0x16ceab){var _0x231571=_0xc3ecf8['query'][_0x0493('0x75')]?0x1f4:_0x16ceab[_0x0493('0x76')]||0x1f4;logger[_0x0493('0x29')](_0x0493('0x77'),_0x0493('0x56'),_0x231571,JSON[_0x0493('0x6c')](_0x16ceab));delete _0x16ceab['name'];if(_0x231571===0x191){_0x231571=0x190;}_0x160891[_0x0493('0x1c')](_0x231571)[_0x0493('0x2c')](_0xc3ecf8['query']['test']?{'message':_0x0493('0x78'),'statusCode':_0x16ceab[_0x0493('0x76')]}:_0x16ceab);});}else{var _0xe9dbad=0x1f4;_0x160891[_0x0493('0x1c')](_0xe9dbad)[_0x0493('0x2c')]({'message':_0x0493('0x78'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 3295c92..aa331b9 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 _0xc09e=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x4dde9b,_0x51de1d){var _0x1d9b04=function(_0x37f51d){while(--_0x37f51d){_0x4dde9b['push'](_0x4dde9b['shift']());}};_0x1d9b04(++_0x51de1d);}(_0xc09e,0x6f));var _0xec09=function(_0x337d17,_0x2b74d1){_0x337d17=_0x337d17-0x0;var _0x5a34f2=_0xc09e[_0x337d17];return _0x5a34f2;};'use strict';var _=require(_0xec09('0x0'));var util=require('util');var logger=require(_0xec09('0x1'))(_0xec09('0x2'));var moment=require(_0xec09('0x3'));var BPromise=require(_0xec09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec09('0x5'));var rimraf=require('rimraf');var config=require(_0xec09('0x6'));var attributes=require(_0xec09('0x7'));var integrations=require(_0xec09('0x8'));module[_0xec09('0x9')]=function(_0x551bda,_0xa9a183){return _0x551bda[_0xec09('0xa')](_0xec09('0xb'),attributes,{'tableName':_0xec09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc9a=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x269261,_0x4b38f2){var _0x4b80c6=function(_0x1dfda2){while(--_0x1dfda2){_0x269261['push'](_0x269261['shift']());}};_0x4b80c6(++_0x4b38f2);}(_0xfc9a,0x83));var _0xafc9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfc9a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xafc9('0x0'));var util=require(_0xafc9('0x1'));var logger=require(_0xafc9('0x2'))(_0xafc9('0x3'));var moment=require(_0xafc9('0x4'));var BPromise=require(_0xafc9('0x5'));var rp=require(_0xafc9('0x6'));var fs=require('fs');var path=require(_0xafc9('0x7'));var rimraf=require(_0xafc9('0x8'));var config=require(_0xafc9('0x9'));var attributes=require(_0xafc9('0xa'));var integrations=require(_0xafc9('0xb'));module[_0xafc9('0xc')]=function(_0x35e4b5,_0x5c0db2){return _0x35e4b5[_0xafc9('0xd')](_0xafc9('0xe'),attributes,{'tableName':_0xafc9('0xf'),'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 e8ac1d5..f7f2d39 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 _0x2fae=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0x51228b,_0x2560d2){var _0x1c3dd7=function(_0x44a334){while(--_0x44a334){_0x51228b['push'](_0x51228b['shift']());}};_0x1c3dd7(++_0x2560d2);}(_0x2fae,0xb7));var _0xe2fa=function(_0x22051f,_0x2623ce){_0x22051f=_0x22051f-0x0;var _0x260526=_0x2fae[_0x22051f];return _0x260526;};'use strict';var _=require(_0xe2fa('0x0'));var util=require(_0xe2fa('0x1'));var moment=require(_0xe2fa('0x2'));var BPromise=require(_0xe2fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2fa('0x5'));var config=require(_0xe2fa('0x6'));var jayson=require(_0xe2fa('0x7'));var client=jayson['client'][_0xe2fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298ccb,_0x3264b2,_0x59da4e){return new BPromise(function(_0x2efe26,_0x2becec){return client[_0xe2fa('0x9')](_0x298ccb,_0x59da4e)['then'](function(_0x40ef9c){logger[_0xe2fa('0xa')](_0xe2fa('0xb'),_0x3264b2,_0xe2fa('0xc'));logger[_0xe2fa('0xd')](_0xe2fa('0xe'),_0x3264b2,_0xe2fa('0xc'),JSON['stringify'](_0x40ef9c));if(_0x40ef9c[_0xe2fa('0xf')]){if(_0x40ef9c[_0xe2fa('0xf')]['code']===0x1f4){logger[_0xe2fa('0xf')](_0xe2fa('0xb'),_0x3264b2,_0x40ef9c[_0xe2fa('0xf')]['message']);return _0x2becec(_0x40ef9c[_0xe2fa('0xf')][_0xe2fa('0x10')]);}logger[_0xe2fa('0xf')](_0xe2fa('0xb'),_0x3264b2,_0x40ef9c['error'][_0xe2fa('0x10')]);return _0x2efe26(_0x40ef9c[_0xe2fa('0xf')][_0xe2fa('0x10')]);}else{logger[_0xe2fa('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x3264b2,'request\x20sent');_0x2efe26(_0x40ef9c[_0xe2fa('0x11')][_0xe2fa('0x10')]);}})[_0xe2fa('0x12')](function(_0xf3b30b){logger['error'](_0xe2fa('0xb'),_0x3264b2,_0xf3b30b);_0x2becec(_0xf3b30b);});});}exports[_0xe2fa('0x13')]=function(_0x2a3b46){var _0x19e818=this;return new Promise(function(_0x22e0e3,_0x1920e0){return db[_0xe2fa('0x14')][_0xe2fa('0x15')]({'raw':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46['options'][_0xe2fa('0x17')]===undefined?!![]:![]:!![],'where':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46['options'][_0xe2fa('0x18')]||null:null,'attributes':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46[_0xe2fa('0x16')]['attributes']||null:null,'limit':_0x2a3b46['options']?_0x2a3b46[_0xe2fa('0x16')][_0xe2fa('0x19')]||null:null,'include':_0x2a3b46['options']?_0x2a3b46[_0xe2fa('0x16')][_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x2a3b46[_0xe2fa('0x16')]['include'],function(_0x343718){return{'model':db[_0x343718[_0xe2fa('0x1c')]],'as':_0x343718['as'],'attributes':_0x343718[_0xe2fa('0x1d')],'include':_0x343718[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x343718[_0xe2fa('0x1a')],function(_0xa1296c){return{'model':db[_0xa1296c[_0xe2fa('0x1c')]],'as':_0xa1296c['as'],'attributes':_0xa1296c[_0xe2fa('0x1d')],'include':_0xa1296c[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0xa1296c[_0xe2fa('0x1a')],function(_0x57a904){return{'model':db[_0x57a904[_0xe2fa('0x1c')]],'as':_0x57a904['as'],'attributes':_0x57a904[_0xe2fa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0x1e')](function(_0x2e0e6d){logger[_0xe2fa('0xa')](_0xe2fa('0x13'),_0x2a3b46);logger[_0xe2fa('0xd')](_0xe2fa('0x13'),_0x2a3b46,JSON['stringify'](_0x2e0e6d));_0x22e0e3(_0x2e0e6d);})[_0xe2fa('0x12')](function(_0x4ff8f3){logger['error'](_0xe2fa('0x13'),_0x4ff8f3[_0xe2fa('0x10')],_0x2a3b46);_0x1920e0(_0x19e818[_0xe2fa('0xf')](0x1f4,_0x4ff8f3[_0xe2fa('0x10')]));});});};exports[_0xe2fa('0x1f')]=function(_0x326fd5){var _0x4a0459=this;return new Promise(function(_0x5482b1,_0x576a91){return db['SugarcrmAccount']['find']({'raw':_0x326fd5['options']?_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x17')]===undefined?!![]:![]:!![],'where':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x18')]||null:null,'attributes':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5['options'][_0xe2fa('0x1d')]||null:null,'include':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5['options'][_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x1a')],function(_0x1810ae){return{'model':db[_0x1810ae[_0xe2fa('0x1c')]],'as':_0x1810ae['as'],'attributes':_0x1810ae['attributes'],'include':_0x1810ae['include']?_[_0xe2fa('0x1b')](_0x1810ae['include'],function(_0x6f873f){return{'model':db[_0x6f873f[_0xe2fa('0x1c')]],'as':_0x6f873f['as'],'attributes':_0x6f873f[_0xe2fa('0x1d')],'include':_0x6f873f[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x6f873f[_0xe2fa('0x1a')],function(_0x1210fc){return{'model':db[_0x1210fc[_0xe2fa('0x1c')]],'as':_0x1210fc['as'],'attributes':_0x1210fc[_0xe2fa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0x1e')](function(_0x111bc2){logger[_0xe2fa('0xa')]('ShowSugarcrmAccount',_0x326fd5);logger['debug'](_0xe2fa('0x1f'),_0x326fd5,JSON['stringify'](_0x111bc2));_0x5482b1(_0x111bc2);})[_0xe2fa('0x12')](function(_0x57a974){logger['error'](_0xe2fa('0x1f'),_0x57a974[_0xe2fa('0x10')],_0x326fd5);_0x576a91(_0x4a0459[_0xe2fa('0xf')](0x1f4,_0x57a974[_0xe2fa('0x10')]));});});}; \ No newline at end of file +var _0xcc24=['debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmAccount','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xcc24,0x1e0));var _0x4cc2=function(_0x50f502,_0x5921ea){_0x50f502=_0x50f502-0x0;var _0x357226=_0xcc24[_0x50f502];return _0x357226;};'use strict';var _=require(_0x4cc2('0x0'));var util=require(_0x4cc2('0x1'));var moment=require(_0x4cc2('0x2'));var BPromise=require(_0x4cc2('0x3'));var rs=require(_0x4cc2('0x4'));var fs=require('fs');var Redis=require(_0x4cc2('0x5'));var db=require(_0x4cc2('0x6'))['db'];var utils=require(_0x4cc2('0x7'));var logger=require(_0x4cc2('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cc2('0x9'));var client=jayson['client'][_0x4cc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2d8d,_0xb80f33,_0x5c8b5d){return new BPromise(function(_0x5721fc,_0x54b160){return client['request'](_0x3a2d8d,_0x5c8b5d)[_0x4cc2('0xb')](function(_0xc28b82){logger[_0x4cc2('0xc')](_0x4cc2('0xd'),_0xb80f33,_0x4cc2('0xe'));logger[_0x4cc2('0xf')](_0x4cc2('0x10'),_0xb80f33,_0x4cc2('0xe'),JSON[_0x4cc2('0x11')](_0xc28b82));if(_0xc28b82['error']){if(_0xc28b82['error']['code']===0x1f4){logger[_0x4cc2('0x12')](_0x4cc2('0xd'),_0xb80f33,_0xc28b82[_0x4cc2('0x12')][_0x4cc2('0x13')]);return _0x54b160(_0xc28b82[_0x4cc2('0x12')][_0x4cc2('0x13')]);}logger['error'](_0x4cc2('0xd'),_0xb80f33,_0xc28b82['error'][_0x4cc2('0x13')]);return _0x5721fc(_0xc28b82['error'][_0x4cc2('0x13')]);}else{logger[_0x4cc2('0xc')](_0x4cc2('0xd'),_0xb80f33,_0x4cc2('0xe'));_0x5721fc(_0xc28b82['result'][_0x4cc2('0x13')]);}})['catch'](function(_0x4610e6){logger[_0x4cc2('0x12')](_0x4cc2('0xd'),_0xb80f33,_0x4610e6);_0x54b160(_0x4610e6);});});}exports['GetSugarcrmAccount']=function(_0x56388b){var _0x3a6b97=this;return new Promise(function(_0x3334bb,_0x6ce446){return db[_0x4cc2('0x14')]['findAll']({'raw':_0x56388b[_0x4cc2('0x15')]?_0x56388b[_0x4cc2('0x15')][_0x4cc2('0x16')]===undefined?!![]:![]:!![],'where':_0x56388b['options']?_0x56388b[_0x4cc2('0x15')]['where']||null:null,'attributes':_0x56388b[_0x4cc2('0x15')]?_0x56388b[_0x4cc2('0x15')][_0x4cc2('0x17')]||null:null,'limit':_0x56388b[_0x4cc2('0x15')]?_0x56388b[_0x4cc2('0x15')][_0x4cc2('0x18')]||null:null,'include':_0x56388b[_0x4cc2('0x15')]?_0x56388b[_0x4cc2('0x15')][_0x4cc2('0x19')]?_[_0x4cc2('0x1a')](_0x56388b[_0x4cc2('0x15')]['include'],function(_0x33a40c){return{'model':db[_0x33a40c['model']],'as':_0x33a40c['as'],'attributes':_0x33a40c[_0x4cc2('0x17')],'include':_0x33a40c[_0x4cc2('0x19')]?_['map'](_0x33a40c[_0x4cc2('0x19')],function(_0x4eec55){return{'model':db[_0x4eec55[_0x4cc2('0x1b')]],'as':_0x4eec55['as'],'attributes':_0x4eec55[_0x4cc2('0x17')],'include':_0x4eec55[_0x4cc2('0x19')]?_[_0x4cc2('0x1a')](_0x4eec55[_0x4cc2('0x19')],function(_0x1e73b6){return{'model':db[_0x1e73b6[_0x4cc2('0x1b')]],'as':_0x1e73b6['as'],'attributes':_0x1e73b6[_0x4cc2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x419977){logger['info'](_0x4cc2('0x1c'),_0x56388b);logger[_0x4cc2('0xf')](_0x4cc2('0x1c'),_0x56388b,JSON[_0x4cc2('0x11')](_0x419977));_0x3334bb(_0x419977);})[_0x4cc2('0x1d')](function(_0x234c63){logger[_0x4cc2('0x12')]('GetSugarcrmAccount',_0x234c63['message'],_0x56388b);_0x6ce446(_0x3a6b97[_0x4cc2('0x12')](0x1f4,_0x234c63['message']));});});};exports[_0x4cc2('0x1e')]=function(_0x165c51){var _0x3938ee=this;return new Promise(function(_0x53dd41,_0x4ec9b9){return db[_0x4cc2('0x14')][_0x4cc2('0x1f')]({'raw':_0x165c51[_0x4cc2('0x15')]?_0x165c51[_0x4cc2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x165c51['options']?_0x165c51[_0x4cc2('0x15')][_0x4cc2('0x20')]||null:null,'attributes':_0x165c51[_0x4cc2('0x15')]?_0x165c51[_0x4cc2('0x15')]['attributes']||null:null,'include':_0x165c51['options']?_0x165c51['options'][_0x4cc2('0x19')]?_[_0x4cc2('0x1a')](_0x165c51['options'][_0x4cc2('0x19')],function(_0x646642){return{'model':db[_0x646642['model']],'as':_0x646642['as'],'attributes':_0x646642[_0x4cc2('0x17')],'include':_0x646642['include']?_['map'](_0x646642[_0x4cc2('0x19')],function(_0x573dc9){return{'model':db[_0x573dc9[_0x4cc2('0x1b')]],'as':_0x573dc9['as'],'attributes':_0x573dc9[_0x4cc2('0x17')],'include':_0x573dc9[_0x4cc2('0x19')]?_[_0x4cc2('0x1a')](_0x573dc9['include'],function(_0x1ac7c5){return{'model':db[_0x1ac7c5['model']],'as':_0x1ac7c5['as'],'attributes':_0x1ac7c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x507668){logger[_0x4cc2('0xc')]('ShowSugarcrmAccount',_0x165c51);logger['debug']('ShowSugarcrmAccount',_0x165c51,JSON[_0x4cc2('0x11')](_0x507668));_0x53dd41(_0x507668);})[_0x4cc2('0x1d')](function(_0x42c373){logger[_0x4cc2('0x12')](_0x4cc2('0x1e'),_0x42c373[_0x4cc2('0x13')],_0x165c51);_0x4ec9b9(_0x3938ee['error'](0x1f4,_0x42c373[_0x4cc2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0a1ef38..9b76be2 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 _0xa9c3=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id/fields'];(function(_0x29c94c,_0x17ebfc){var _0x3cf13b=function(_0x5d02bb){while(--_0x5d02bb){_0x29c94c['push'](_0x29c94c['shift']());}};_0x3cf13b(++_0x17ebfc);}(_0xa9c3,0x1d4));var _0x3a9c=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xa9c3[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x3a9c('0x0'));var util=require('util');var path=require(_0x3a9c('0x1'));var timeout=require(_0x3a9c('0x2'));var express=require(_0x3a9c('0x3'));var router=express[_0x3a9c('0x4')]();var fs_extra=require(_0x3a9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a9c('0x6'));var config=require(_0x3a9c('0x7'));var controller=require(_0x3a9c('0x8'));router[_0x3a9c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3a9c('0xa')](),controller['show']);router[_0x3a9c('0x9')](_0x3a9c('0xb'),auth['isAuthenticated'](),controller[_0x3a9c('0xc')]);router[_0x3a9c('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3a9c('0xd')]);router['get'](_0x3a9c('0xe'),auth['isAuthenticated'](),controller[_0x3a9c('0xf')]);router[_0x3a9c('0x10')]('/',auth[_0x3a9c('0xa')](),controller[_0x3a9c('0x11')]);router[_0x3a9c('0x12')](_0x3a9c('0x13'),auth['isAuthenticated'](),controller[_0x3a9c('0x14')]);router[_0x3a9c('0x15')](_0x3a9c('0x13'),auth[_0x3a9c('0xa')](),controller[_0x3a9c('0x16')]);module[_0x3a9c('0x17')]=router; \ No newline at end of file +var _0x8ed2=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated'];(function(_0x2806f6,_0x294105){var _0x32ebb1=function(_0x5e875d){while(--_0x5e875d){_0x2806f6['push'](_0x2806f6['shift']());}};_0x32ebb1(++_0x294105);}(_0x8ed2,0x1da));var _0x28ed=function(_0x1fe556,_0x3df54b){_0x1fe556=_0x1fe556-0x0;var _0x362598=_0x8ed2[_0x1fe556];return _0x362598;};'use strict';var multer=require('multer');var util=require(_0x28ed('0x0'));var path=require(_0x28ed('0x1'));var timeout=require(_0x28ed('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x28ed('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x28ed('0x4'));var config=require(_0x28ed('0x5'));var controller=require(_0x28ed('0x6'));router[_0x28ed('0x7')]('/',auth['isAuthenticated'](),controller[_0x28ed('0x8')]);router[_0x28ed('0x7')]('/:id',auth[_0x28ed('0x9')](),controller[_0x28ed('0xa')]);router[_0x28ed('0x7')](_0x28ed('0xb'),auth['isAuthenticated'](),controller[_0x28ed('0xc')]);router[_0x28ed('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x28ed('0xd')]);router['get'](_0x28ed('0xe'),auth[_0x28ed('0x9')](),controller['getDescriptions']);router[_0x28ed('0xf')]('/',auth['isAuthenticated'](),controller[_0x28ed('0x10')]);router[_0x28ed('0x11')]('/:id',auth[_0x28ed('0x9')](),controller[_0x28ed('0x12')]);router['delete'](_0x28ed('0x13'),auth[_0x28ed('0x9')](),controller[_0x28ed('0x14')]);module[_0x28ed('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0384b3f..ea884ed 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 _0x23c7=['exports','STRING','sequelize'];(function(_0x27eac4,_0x1b3ca5){var _0x3cb1f1=function(_0xda30d8){while(--_0xda30d8){_0x27eac4['push'](_0x27eac4['shift']());}};_0x3cb1f1(++_0x1b3ca5);}(_0x23c7,0xa4));var _0x723c=function(_0x49eee5,_0x5340e7){_0x49eee5=_0x49eee5-0x0;var _0x18b29b=_0x23c7[_0x49eee5];return _0x18b29b;};'use strict';var Sequelize=require(_0x723c('0x0'));module[_0x723c('0x1')]={'name':{'type':Sequelize[_0x723c('0x2')]},'description':{'type':Sequelize[_0x723c('0x2')]}}; \ No newline at end of file +var _0x45eb=['STRING','sequelize'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x45eb,0x159));var _0xb45e=function(_0xcdf822,_0x9baffe){_0xcdf822=_0xcdf822-0x0;var _0x28fe0e=_0x45eb[_0xcdf822];return _0x28fe0e;};'use strict';var Sequelize=require(_0xb45e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb45e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2d68ff3..c1caedf 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 _0xec3e=['rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','status','reject','update','then','destroy','error','name','send','index','SugarcrmConfiguration','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','catch','show','rawAttributes','fields','body','find','params','getFields','hasOwnProperty','getSubjects','findOne','SugarcrmField','options','getDescriptions'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0xec3e,0x1c8));var _0xeec3=function(_0x2de692,_0x4573d5){_0x2de692=_0x2de692-0x0;var _0x5f1883=_0xec3e[_0x2de692];return _0x5f1883;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeec3('0x0'));var zipdir=require(_0xeec3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeec3('0x2'));var moment=require(_0xeec3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeec3('0x4'));var path=require(_0xeec3('0x5'));var sox=require(_0xeec3('0x6'));var csv=require(_0xeec3('0x7'));var ejs=require(_0xeec3('0x8'));var fs=require('fs');var fs_extra=require(_0xeec3('0x9'));var _=require(_0xeec3('0xa'));var squel=require(_0xeec3('0xb'));var crypto=require(_0xeec3('0xc'));var jsforce=require(_0xeec3('0xd'));var deskjs=require(_0xeec3('0xe'));var toCsv=require(_0xeec3('0x7'));var querystring=require(_0xeec3('0xf'));var Papa=require('papaparse');var Redis=require(_0xeec3('0x10'));var authService=require(_0xeec3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeec3('0x12'));var logger=require(_0xeec3('0x13'))('api');var utils=require(_0xeec3('0x14'));var config=require(_0xeec3('0x15'));var licenseUtil=require(_0xeec3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f7e4,_0x4a64eb){_0x4a64eb=_0x4a64eb||0xcc;return function(_0x3062e7){if(_0x3062e7){return _0x58f7e4[_0xeec3('0x17')](_0x4a64eb);}return _0x58f7e4['status'](_0x4a64eb)[_0xeec3('0x18')]();};}function respondWithResult(_0x2f0c6d,_0x11f4a5){_0x11f4a5=_0x11f4a5||0xc8;return function(_0x38f525){if(_0x38f525){return _0x2f0c6d['status'](_0x11f4a5)[_0xeec3('0x19')](_0x38f525);}};}function respondWithFilteredResult(_0x41cb57,_0x23f74a){return function(_0xd953d5){if(_0xd953d5){var _0x31ff38=typeof _0x23f74a[_0xeec3('0x1a')]===_0xeec3('0x1b')&&typeof _0x23f74a[_0xeec3('0x1c')]===_0xeec3('0x1b');var _0x22b206=_0xd953d5['count'];var _0x426983=_0x31ff38?0x0:_0x23f74a[_0xeec3('0x1a')];var _0x511296=_0x31ff38?_0xd953d5['count']:_0x23f74a['offset']+_0x23f74a[_0xeec3('0x1c')];var _0x348591;if(_0x511296>=_0x22b206){_0x511296=_0x22b206;_0x348591=0xc8;}else{_0x348591=0xce;}_0x41cb57[_0xeec3('0x1d')](_0x348591);return _0x41cb57['set']('Content-Range',_0x426983+'-'+_0x511296+'/'+_0x22b206)[_0xeec3('0x19')](_0xd953d5);}return null;};}function patchUpdates(_0xfbb6){return function(_0x56dc8b){try{jsonpatch['apply'](_0x56dc8b,_0xfbb6,!![]);}catch(_0x4bc8ed){return BPromise[_0xeec3('0x1e')](_0x4bc8ed);}return _0x56dc8b['save']();};}function saveUpdates(_0x27fc97,_0x5c2224){return function(_0x3502a2){if(_0x3502a2){return _0x3502a2[_0xeec3('0x1f')](_0x27fc97)[_0xeec3('0x20')](function(_0x409fed){return _0x409fed;});}return null;};}function removeEntity(_0x19a372,_0x250aac){return function(_0x53c342){if(_0x53c342){return _0x53c342[_0xeec3('0x21')]()[_0xeec3('0x20')](function(){_0x19a372['status'](0xcc)[_0xeec3('0x18')]();});}};}function handleEntityNotFound(_0x1ac18e,_0x173b2d){return function(_0x4d58b2){if(!_0x4d58b2){_0x1ac18e[_0xeec3('0x17')](0x194);}return _0x4d58b2;};}function handleError(_0x5097f8,_0x2ef410){_0x2ef410=_0x2ef410||0x1f4;return function(_0x2476ed){logger[_0xeec3('0x22')](_0x2476ed['stack']);if(_0x2476ed[_0xeec3('0x23')]){delete _0x2476ed[_0xeec3('0x23')];}_0x5097f8['status'](_0x2ef410)[_0xeec3('0x24')](_0x2476ed);};}exports[_0xeec3('0x25')]=function(_0x407259,_0x4c75cb){var _0x3529aa={},_0x2f1a58={},_0x3da757={'count':0x0,'rows':[]};var _0x4353cf=_['map'](db[_0xeec3('0x26')]['rawAttributes'],function(_0x24141a){return{'name':_0x24141a[_0xeec3('0x27')],'type':_0x24141a['type'][_0xeec3('0x28')]};});_0x2f1a58[_0xeec3('0x29')]=_[_0xeec3('0x2a')](_0x4353cf,_0xeec3('0x23'));_0x2f1a58[_0xeec3('0x2b')]=_[_0xeec3('0x2c')](_0x407259['query']);_0x2f1a58[_0xeec3('0x2d')]=_['intersection'](_0x2f1a58[_0xeec3('0x29')],_0x2f1a58[_0xeec3('0x2b')]);_0x3529aa[_0xeec3('0x2e')]=_[_0xeec3('0x2f')](_0x2f1a58['model'],qs['fields'](_0x407259[_0xeec3('0x2b')]['fields']));_0x3529aa[_0xeec3('0x2e')]=_0x3529aa['attributes'][_0xeec3('0x30')]?_0x3529aa['attributes']:_0x2f1a58[_0xeec3('0x29')];if(!_0x407259[_0xeec3('0x2b')]['hasOwnProperty'](_0xeec3('0x31'))){_0x3529aa['limit']=qs[_0xeec3('0x1c')](_0x407259['query'][_0xeec3('0x1c')]);_0x3529aa[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x407259[_0xeec3('0x2b')]['offset']);}_0x3529aa[_0xeec3('0x32')]=qs['sort'](_0x407259[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x3529aa[_0xeec3('0x34')]=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x407259[_0xeec3('0x2b')],_0x2f1a58[_0xeec3('0x2d')]),_0x4353cf);if(_0x407259[_0xeec3('0x2b')][_0xeec3('0x36')]){_0x3529aa['where']=_[_0xeec3('0x37')](_0x3529aa[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x4353cf,function(_0x5adf7d){if(_0x5adf7d[_0xeec3('0x38')]!==_0xeec3('0x39')){var _0x5e2280={};_0x5e2280[_0x5adf7d[_0xeec3('0x23')]]={'$like':'%'+_0x407259[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x5e2280;}})});}_0x3529aa=_['merge']({},_0x3529aa,_0x407259['options']);var _0x2b2b6e={'where':_0x3529aa['where']};return db[_0xeec3('0x26')][_0xeec3('0x3a')](_0x2b2b6e)['then'](function(_0x53e960){_0x3da757[_0xeec3('0x3a')]=_0x53e960;if(_0x407259['query'][_0xeec3('0x3b')]){_0x3529aa[_0xeec3('0x3c')]=[{'all':!![]}];}return db[_0xeec3('0x26')][_0xeec3('0x3d')](_0x3529aa);})[_0xeec3('0x20')](function(_0x5e478d){_0x3da757['rows']=_0x5e478d;return _0x3da757;})[_0xeec3('0x20')](respondWithFilteredResult(_0x4c75cb,_0x3529aa))[_0xeec3('0x3e')](handleError(_0x4c75cb,null));};exports[_0xeec3('0x3f')]=function(_0x161d4a,_0x416e5f){var _0x1a3bb1={'raw':![],'where':{'id':_0x161d4a['params']['id']}},_0xf5160f={};_0xf5160f[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x26')][_0xeec3('0x40')]);_0xf5160f[_0xeec3('0x2b')]=_[_0xeec3('0x2c')](_0x161d4a[_0xeec3('0x2b')]);_0xf5160f[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0xf5160f[_0xeec3('0x29')],_0xf5160f['query']);_0x1a3bb1['attributes']=_['intersection'](_0xf5160f[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x161d4a[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x1a3bb1['attributes']=_0x1a3bb1['attributes'][_0xeec3('0x30')]?_0x1a3bb1[_0xeec3('0x2e')]:_0xf5160f[_0xeec3('0x29')];if(_0x161d4a[_0xeec3('0x2b')][_0xeec3('0x3b')]){_0x1a3bb1[_0xeec3('0x3c')]=[{'all':!![]}];}_0x1a3bb1=_[_0xeec3('0x37')]({},_0x1a3bb1,_0x161d4a['options']);return db[_0xeec3('0x26')]['find'](_0x1a3bb1)[_0xeec3('0x20')](handleEntityNotFound(_0x416e5f,null))[_0xeec3('0x20')](respondWithResult(_0x416e5f,null))[_0xeec3('0x3e')](handleError(_0x416e5f,null));};exports['create']=function(_0x449dce,_0x2c186b){return db[_0xeec3('0x26')]['create'](_0x449dce[_0xeec3('0x42')],{})[_0xeec3('0x20')](respondWithResult(_0x2c186b,0xc9))[_0xeec3('0x3e')](handleError(_0x2c186b,null));};exports[_0xeec3('0x1f')]=function(_0xe85427,_0x329595){if(_0xe85427[_0xeec3('0x42')]['id']){delete _0xe85427['body']['id'];}return db[_0xeec3('0x26')][_0xeec3('0x43')]({'where':{'id':_0xe85427[_0xeec3('0x44')]['id']}})['then'](handleEntityNotFound(_0x329595,null))['then'](saveUpdates(_0xe85427[_0xeec3('0x42')],null))[_0xeec3('0x20')](respondWithResult(_0x329595,null))[_0xeec3('0x3e')](handleError(_0x329595,null));};exports[_0xeec3('0x21')]=function(_0x41b4cc,_0x4d4745){return db[_0xeec3('0x26')][_0xeec3('0x43')]({'where':{'id':_0x41b4cc[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x4d4745,null))['then'](removeEntity(_0x4d4745,null))[_0xeec3('0x3e')](handleError(_0x4d4745,null));};exports[_0xeec3('0x45')]=function(_0x14fc41,_0xccb40d,_0x277791){var _0x20a081={};var _0x3afa16={};var _0x100824;var _0x421465;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x14fc41[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0xccb40d,null))['then'](function(_0x5c3d42){if(_0x5c3d42){_0x100824=_0x5c3d42;_0x3afa16[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db['SugarcrmField'][_0xeec3('0x40')]);_0x3afa16['query']=_[_0xeec3('0x2c')](_0x14fc41[_0xeec3('0x2b')]);_0x3afa16[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x3afa16['model'],_0x3afa16[_0xeec3('0x2b')]);_0x20a081[_0xeec3('0x2e')]=_['intersection'](_0x3afa16[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x14fc41[_0xeec3('0x2b')]['fields']));_0x20a081['attributes']=_0x20a081[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x20a081['attributes']:_0x3afa16[_0xeec3('0x29')];_0x20a081['order']=qs[_0xeec3('0x33')](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x20a081['where']=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x14fc41['query'],_0x3afa16[_0xeec3('0x2d')]));if(_0x14fc41[_0xeec3('0x2b')]['filter']){_0x20a081[_0xeec3('0x34')]=_['merge'](_0x20a081[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x20a081['attributes'],function(_0x13db02){var _0x2e32e7={};_0x2e32e7[_0x13db02]={'$like':'%'+_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2e32e7;})});}_0x20a081=_[_0xeec3('0x37')]({},_0x20a081,_0x14fc41['options']);return _0x100824[_0xeec3('0x45')](_0x20a081);}})[_0xeec3('0x20')](function(_0x51f700){if(_0x51f700){_0x421465=_0x51f700[_0xeec3('0x30')];if(!_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x20a081[_0xeec3('0x1c')]=qs['limit'](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x20a081[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x100824[_0xeec3('0x45')](_0x20a081);}})[_0xeec3('0x20')](function(_0x395bea){if(_0x395bea){return _0x395bea?{'count':_0x421465,'rows':_0x395bea}:null;}})[_0xeec3('0x20')](respondWithResult(_0xccb40d,null))[_0xeec3('0x3e')](handleError(_0xccb40d,null));};exports[_0xeec3('0x47')]=function(_0x1cde0d,_0x3967c2,_0xe62e45){var _0x4096fd={};var _0x215cf5={};var _0x17a6ef;var _0x43be06;return db[_0xeec3('0x26')][_0xeec3('0x48')]({'where':{'id':_0x1cde0d[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x3967c2,null))[_0xeec3('0x20')](function(_0x4d0bb5){if(_0x4d0bb5){_0x17a6ef=_0x4d0bb5;_0x215cf5[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x49')][_0xeec3('0x40')]);_0x215cf5[_0xeec3('0x2b')]=_['keys'](_0x1cde0d[_0xeec3('0x2b')]);_0x215cf5[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x215cf5['model'],_0x215cf5[_0xeec3('0x2b')]);_0x4096fd[_0xeec3('0x2e')]=_[_0xeec3('0x2f')](_0x215cf5[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x4096fd['attributes']=_0x4096fd[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x4096fd['attributes']:_0x215cf5[_0xeec3('0x29')];_0x4096fd[_0xeec3('0x32')]=qs[_0xeec3('0x33')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x4096fd[_0xeec3('0x34')]=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x1cde0d['query'],_0x215cf5[_0xeec3('0x2d')]));if(_0x1cde0d['query'][_0xeec3('0x36')]){_0x4096fd[_0xeec3('0x34')]=_['merge'](_0x4096fd['where'],{'$or':_[_0xeec3('0x2a')](_0x4096fd[_0xeec3('0x2e')],function(_0x5b7b8e){var _0x2b9a80={};_0x2b9a80[_0x5b7b8e]={'$like':'%'+_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2b9a80;})});}_0x4096fd=_[_0xeec3('0x37')]({},_0x4096fd,_0x1cde0d[_0xeec3('0x4a')]);return _0x17a6ef[_0xeec3('0x47')](_0x4096fd);}})['then'](function(_0x37b667){if(_0x37b667){_0x43be06=_0x37b667[_0xeec3('0x30')];if(!_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x4096fd[_0xeec3('0x1c')]=qs[_0xeec3('0x1c')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x4096fd['offset']=qs[_0xeec3('0x1a')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x17a6ef[_0xeec3('0x47')](_0x4096fd);}})[_0xeec3('0x20')](function(_0xcd6523){if(_0xcd6523){return _0xcd6523?{'count':_0x43be06,'rows':_0xcd6523}:null;}})[_0xeec3('0x20')](respondWithResult(_0x3967c2,null))[_0xeec3('0x3e')](handleError(_0x3967c2,null));};exports[_0xeec3('0x4b')]=function(_0x16cdbb,_0x2d6fb7,_0x3c62e1){var _0x32b373={};var _0x4baae5={};var _0x247471;var _0x881a0c;return db[_0xeec3('0x26')]['findOne']({'where':{'id':_0x16cdbb['params']['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x2d6fb7,null))['then'](function(_0x5cf9e5){if(_0x5cf9e5){_0x247471=_0x5cf9e5;_0x4baae5[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x49')][_0xeec3('0x40')]);_0x4baae5['query']=_['keys'](_0x16cdbb[_0xeec3('0x2b')]);_0x4baae5[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x4baae5[_0xeec3('0x29')],_0x4baae5[_0xeec3('0x2b')]);_0x32b373['attributes']=_['intersection'](_0x4baae5['model'],qs[_0xeec3('0x41')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x32b373[_0xeec3('0x2e')]=_0x32b373[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x32b373[_0xeec3('0x2e')]:_0x4baae5['model'];_0x32b373['order']=qs[_0xeec3('0x33')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x32b373['where']=qs[_0xeec3('0x2d')](_['pick'](_0x16cdbb[_0xeec3('0x2b')],_0x4baae5[_0xeec3('0x2d')]));if(_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x36')]){_0x32b373[_0xeec3('0x34')]=_[_0xeec3('0x37')](_0x32b373[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x32b373[_0xeec3('0x2e')],function(_0x558708){var _0x2cd704={};_0x2cd704[_0x558708]={'$like':'%'+_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2cd704;})});}_0x32b373=_[_0xeec3('0x37')]({},_0x32b373,_0x16cdbb[_0xeec3('0x4a')]);return _0x247471[_0xeec3('0x4b')](_0x32b373);}})[_0xeec3('0x20')](function(_0x27863b){if(_0x27863b){_0x881a0c=_0x27863b[_0xeec3('0x30')];if(!_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x32b373['limit']=qs['limit'](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x32b373[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x247471[_0xeec3('0x4b')](_0x32b373);}})[_0xeec3('0x20')](function(_0x20f14d){if(_0x20f14d){return _0x20f14d?{'count':_0x881a0c,'rows':_0x20f14d}:null;}})['then'](respondWithResult(_0x2d6fb7,null))['catch'](handleError(_0x2d6fb7,null));}; \ No newline at end of file +var _0x6722=['sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','body','params','find','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order'];(function(_0x55e3d9,_0x29c5c4){var _0x2b16c8=function(_0xf6c00f){while(--_0xf6c00f){_0x55e3d9['push'](_0x55e3d9['shift']());}};_0x2b16c8(++_0x29c5c4);}(_0x6722,0x108));var _0x2672=function(_0x5cfdad,_0x1864ca){_0x5cfdad=_0x5cfdad-0x0;var _0x485874=_0x6722[_0x5cfdad];return _0x485874;};'use strict';var emlformat=require(_0x2672('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2672('0x1'));var jsonpatch=require(_0x2672('0x2'));var rp=require(_0x2672('0x3'));var moment=require(_0x2672('0x4'));var BPromise=require(_0x2672('0x5'));var Mustache=require(_0x2672('0x6'));var util=require(_0x2672('0x7'));var path=require(_0x2672('0x8'));var sox=require(_0x2672('0x9'));var csv=require(_0x2672('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2672('0xb'));var _=require(_0x2672('0xc'));var squel=require('squel');var crypto=require(_0x2672('0xd'));var jsforce=require(_0x2672('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2672('0xa'));var querystring=require('querystring');var Papa=require(_0x2672('0xf'));var Redis=require(_0x2672('0x10'));var authService=require(_0x2672('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2672('0x12'))(_0x2672('0x13'));var utils=require('../../config/utils');var config=require(_0x2672('0x14'));var licenseUtil=require(_0x2672('0x15'));var db=require(_0x2672('0x16'))['db'];function respondWithStatusCode(_0xcf6597,_0x304a49){_0x304a49=_0x304a49||0xcc;return function(_0x260f29){if(_0x260f29){return _0xcf6597[_0x2672('0x17')](_0x304a49);}return _0xcf6597[_0x2672('0x18')](_0x304a49)[_0x2672('0x19')]();};}function respondWithResult(_0x482df8,_0x273630){_0x273630=_0x273630||0xc8;return function(_0x22a9d1){if(_0x22a9d1){return _0x482df8[_0x2672('0x18')](_0x273630)['json'](_0x22a9d1);}};}function respondWithFilteredResult(_0x1738e2,_0x182e5e){return function(_0x1a425a){if(_0x1a425a){var _0x28fb89=typeof _0x182e5e[_0x2672('0x1a')]===_0x2672('0x1b')&&typeof _0x182e5e[_0x2672('0x1c')]==='undefined';var _0x4b242f=_0x1a425a[_0x2672('0x1d')];var _0x385647=_0x28fb89?0x0:_0x182e5e['offset'];var _0x3a57eb=_0x28fb89?_0x1a425a[_0x2672('0x1d')]:_0x182e5e[_0x2672('0x1a')]+_0x182e5e[_0x2672('0x1c')];var _0x583f8b;if(_0x3a57eb>=_0x4b242f){_0x3a57eb=_0x4b242f;_0x583f8b=0xc8;}else{_0x583f8b=0xce;}_0x1738e2[_0x2672('0x18')](_0x583f8b);return _0x1738e2[_0x2672('0x1e')](_0x2672('0x1f'),_0x385647+'-'+_0x3a57eb+'/'+_0x4b242f)[_0x2672('0x20')](_0x1a425a);}return null;};}function patchUpdates(_0x52d08e){return function(_0xc1f627){try{jsonpatch['apply'](_0xc1f627,_0x52d08e,!![]);}catch(_0x4fed73){return BPromise[_0x2672('0x21')](_0x4fed73);}return _0xc1f627[_0x2672('0x22')]();};}function saveUpdates(_0xd33ebd,_0x419d2f){return function(_0x225bdf){if(_0x225bdf){return _0x225bdf[_0x2672('0x23')](_0xd33ebd)['then'](function(_0xf990a9){return _0xf990a9;});}return null;};}function removeEntity(_0x43a7b1,_0x98461f){return function(_0x291902){if(_0x291902){return _0x291902[_0x2672('0x24')]()[_0x2672('0x25')](function(){_0x43a7b1[_0x2672('0x18')](0xcc)[_0x2672('0x19')]();});}};}function handleEntityNotFound(_0x314211,_0x58a620){return function(_0xafc094){if(!_0xafc094){_0x314211['sendStatus'](0x194);}return _0xafc094;};}function handleError(_0x13fda8,_0x4de834){_0x4de834=_0x4de834||0x1f4;return function(_0x11999b){logger[_0x2672('0x26')](_0x11999b[_0x2672('0x27')]);if(_0x11999b[_0x2672('0x28')]){delete _0x11999b[_0x2672('0x28')];}_0x13fda8['status'](_0x4de834)['send'](_0x11999b);};}exports[_0x2672('0x29')]=function(_0x33a4b3,_0x3f7439){var _0x71fe33={},_0x2983b4={},_0x100502={'count':0x0,'rows':[]};var _0x5b4fde=_[_0x2672('0x2a')](db[_0x2672('0x2b')][_0x2672('0x2c')],function(_0x499145){return{'name':_0x499145['fieldName'],'type':_0x499145[_0x2672('0x2d')][_0x2672('0x2e')]};});_0x2983b4[_0x2672('0x2f')]=_['map'](_0x5b4fde,_0x2672('0x28'));_0x2983b4['query']=_[_0x2672('0x30')](_0x33a4b3[_0x2672('0x31')]);_0x2983b4['filters']=_[_0x2672('0x32')](_0x2983b4[_0x2672('0x2f')],_0x2983b4[_0x2672('0x31')]);_0x71fe33[_0x2672('0x33')]=_[_0x2672('0x32')](_0x2983b4[_0x2672('0x2f')],qs[_0x2672('0x34')](_0x33a4b3['query']['fields']));_0x71fe33[_0x2672('0x33')]=_0x71fe33['attributes'][_0x2672('0x35')]?_0x71fe33[_0x2672('0x33')]:_0x2983b4[_0x2672('0x2f')];if(!_0x33a4b3[_0x2672('0x31')]['hasOwnProperty'](_0x2672('0x36'))){_0x71fe33['limit']=qs['limit'](_0x33a4b3['query'][_0x2672('0x1c')]);_0x71fe33[_0x2672('0x1a')]=qs[_0x2672('0x1a')](_0x33a4b3[_0x2672('0x31')][_0x2672('0x1a')]);}_0x71fe33[_0x2672('0x37')]=qs['sort'](_0x33a4b3['query'][_0x2672('0x38')]);_0x71fe33['where']=qs[_0x2672('0x39')](_[_0x2672('0x3a')](_0x33a4b3[_0x2672('0x31')],_0x2983b4[_0x2672('0x39')]),_0x5b4fde);if(_0x33a4b3[_0x2672('0x31')][_0x2672('0x3b')]){_0x71fe33[_0x2672('0x3c')]=_[_0x2672('0x3d')](_0x71fe33[_0x2672('0x3c')],{'$or':_[_0x2672('0x2a')](_0x5b4fde,function(_0x5551f6){if(_0x5551f6[_0x2672('0x2d')]!==_0x2672('0x3e')){var _0xcef96={};_0xcef96[_0x5551f6[_0x2672('0x28')]]={'$like':'%'+_0x33a4b3[_0x2672('0x31')][_0x2672('0x3b')]+'%'};return _0xcef96;}})});}_0x71fe33=_[_0x2672('0x3d')]({},_0x71fe33,_0x33a4b3[_0x2672('0x3f')]);var _0xa2fccd={'where':_0x71fe33[_0x2672('0x3c')]};return db[_0x2672('0x2b')]['count'](_0xa2fccd)[_0x2672('0x25')](function(_0x599eb7){_0x100502['count']=_0x599eb7;if(_0x33a4b3[_0x2672('0x31')]['includeAll']){_0x71fe33[_0x2672('0x40')]=[{'all':!![]}];}return db[_0x2672('0x2b')][_0x2672('0x41')](_0x71fe33);})['then'](function(_0x562b3a){_0x100502[_0x2672('0x42')]=_0x562b3a;return _0x100502;})[_0x2672('0x25')](respondWithFilteredResult(_0x3f7439,_0x71fe33))[_0x2672('0x43')](handleError(_0x3f7439,null));};exports[_0x2672('0x44')]=function(_0x2d9894,_0x479d38){var _0x14ec95={'raw':![],'where':{'id':_0x2d9894['params']['id']}},_0x102f43={};_0x102f43[_0x2672('0x2f')]=_['keys'](db[_0x2672('0x2b')][_0x2672('0x2c')]);_0x102f43[_0x2672('0x31')]=_['keys'](_0x2d9894['query']);_0x102f43[_0x2672('0x39')]=_[_0x2672('0x32')](_0x102f43['model'],_0x102f43[_0x2672('0x31')]);_0x14ec95[_0x2672('0x33')]=_[_0x2672('0x32')](_0x102f43[_0x2672('0x2f')],qs['fields'](_0x2d9894['query'][_0x2672('0x34')]));_0x14ec95[_0x2672('0x33')]=_0x14ec95[_0x2672('0x33')][_0x2672('0x35')]?_0x14ec95[_0x2672('0x33')]:_0x102f43[_0x2672('0x2f')];if(_0x2d9894[_0x2672('0x31')][_0x2672('0x45')]){_0x14ec95['include']=[{'all':!![]}];}_0x14ec95=_[_0x2672('0x3d')]({},_0x14ec95,_0x2d9894[_0x2672('0x3f')]);return db['SugarcrmConfiguration']['find'](_0x14ec95)[_0x2672('0x25')](handleEntityNotFound(_0x479d38,null))['then'](respondWithResult(_0x479d38,null))['catch'](handleError(_0x479d38,null));};exports[_0x2672('0x46')]=function(_0x471f11,_0x5a2d44){return db[_0x2672('0x2b')][_0x2672('0x46')](_0x471f11['body'],{})[_0x2672('0x25')](respondWithResult(_0x5a2d44,0xc9))[_0x2672('0x43')](handleError(_0x5a2d44,null));};exports[_0x2672('0x23')]=function(_0xee2ebe,_0x51bc8a){if(_0xee2ebe[_0x2672('0x47')]['id']){delete _0xee2ebe[_0x2672('0x47')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0xee2ebe[_0x2672('0x48')]['id']}})[_0x2672('0x25')](handleEntityNotFound(_0x51bc8a,null))['then'](saveUpdates(_0xee2ebe[_0x2672('0x47')],null))[_0x2672('0x25')](respondWithResult(_0x51bc8a,null))[_0x2672('0x43')](handleError(_0x51bc8a,null));};exports[_0x2672('0x24')]=function(_0x614cf6,_0xce7368){return db[_0x2672('0x2b')][_0x2672('0x49')]({'where':{'id':_0x614cf6[_0x2672('0x48')]['id']}})[_0x2672('0x25')](handleEntityNotFound(_0xce7368,null))[_0x2672('0x25')](removeEntity(_0xce7368,null))['catch'](handleError(_0xce7368,null));};exports[_0x2672('0x4a')]=function(_0x1d6d01,_0x4d13bc,_0x3fd836){var _0x446ca6={};var _0x491351={};var _0x40de31;var _0x34ff5c;return db[_0x2672('0x2b')][_0x2672('0x4b')]({'where':{'id':_0x1d6d01[_0x2672('0x48')]['id']}})[_0x2672('0x25')](handleEntityNotFound(_0x4d13bc,null))[_0x2672('0x25')](function(_0x5902b8){if(_0x5902b8){_0x40de31=_0x5902b8;_0x491351[_0x2672('0x2f')]=_[_0x2672('0x30')](db[_0x2672('0x4c')]['rawAttributes']);_0x491351[_0x2672('0x31')]=_[_0x2672('0x30')](_0x1d6d01[_0x2672('0x31')]);_0x491351[_0x2672('0x39')]=_['intersection'](_0x491351[_0x2672('0x2f')],_0x491351[_0x2672('0x31')]);_0x446ca6[_0x2672('0x33')]=_[_0x2672('0x32')](_0x491351[_0x2672('0x2f')],qs[_0x2672('0x34')](_0x1d6d01[_0x2672('0x31')][_0x2672('0x34')]));_0x446ca6['attributes']=_0x446ca6[_0x2672('0x33')][_0x2672('0x35')]?_0x446ca6[_0x2672('0x33')]:_0x491351[_0x2672('0x2f')];_0x446ca6[_0x2672('0x37')]=qs[_0x2672('0x38')](_0x1d6d01[_0x2672('0x31')][_0x2672('0x38')]);_0x446ca6[_0x2672('0x3c')]=qs[_0x2672('0x39')](_[_0x2672('0x3a')](_0x1d6d01['query'],_0x491351[_0x2672('0x39')]));if(_0x1d6d01[_0x2672('0x31')]['filter']){_0x446ca6[_0x2672('0x3c')]=_['merge'](_0x446ca6['where'],{'$or':_[_0x2672('0x2a')](_0x446ca6[_0x2672('0x33')],function(_0x230fee){var _0x50e40d={};_0x50e40d[_0x230fee]={'$like':'%'+_0x1d6d01[_0x2672('0x31')][_0x2672('0x3b')]+'%'};return _0x50e40d;})});}_0x446ca6=_[_0x2672('0x3d')]({},_0x446ca6,_0x1d6d01[_0x2672('0x3f')]);return _0x40de31['getFields'](_0x446ca6);}})[_0x2672('0x25')](function(_0x49eb53){if(_0x49eb53){_0x34ff5c=_0x49eb53['length'];if(!_0x1d6d01[_0x2672('0x31')][_0x2672('0x4d')](_0x2672('0x36'))){_0x446ca6[_0x2672('0x1c')]=qs[_0x2672('0x1c')](_0x1d6d01[_0x2672('0x31')][_0x2672('0x1c')]);_0x446ca6[_0x2672('0x1a')]=qs[_0x2672('0x1a')](_0x1d6d01['query'][_0x2672('0x1a')]);}return _0x40de31['getFields'](_0x446ca6);}})[_0x2672('0x25')](function(_0x1d5dc5){if(_0x1d5dc5){return _0x1d5dc5?{'count':_0x34ff5c,'rows':_0x1d5dc5}:null;}})[_0x2672('0x25')](respondWithResult(_0x4d13bc,null))[_0x2672('0x43')](handleError(_0x4d13bc,null));};exports[_0x2672('0x4e')]=function(_0x121c61,_0xf7465b,_0xd5155e){var _0x4dd545={};var _0x2055ee={};var _0x2fa42b;var _0x2b353f;return db[_0x2672('0x2b')][_0x2672('0x4b')]({'where':{'id':_0x121c61[_0x2672('0x48')]['id']}})[_0x2672('0x25')](handleEntityNotFound(_0xf7465b,null))['then'](function(_0x1ff91d){if(_0x1ff91d){_0x2fa42b=_0x1ff91d;_0x2055ee[_0x2672('0x2f')]=_[_0x2672('0x30')](db[_0x2672('0x4c')][_0x2672('0x2c')]);_0x2055ee['query']=_[_0x2672('0x30')](_0x121c61[_0x2672('0x31')]);_0x2055ee[_0x2672('0x39')]=_[_0x2672('0x32')](_0x2055ee[_0x2672('0x2f')],_0x2055ee['query']);_0x4dd545['attributes']=_[_0x2672('0x32')](_0x2055ee[_0x2672('0x2f')],qs[_0x2672('0x34')](_0x121c61[_0x2672('0x31')][_0x2672('0x34')]));_0x4dd545[_0x2672('0x33')]=_0x4dd545[_0x2672('0x33')][_0x2672('0x35')]?_0x4dd545['attributes']:_0x2055ee[_0x2672('0x2f')];_0x4dd545[_0x2672('0x37')]=qs[_0x2672('0x38')](_0x121c61[_0x2672('0x31')]['sort']);_0x4dd545[_0x2672('0x3c')]=qs['filters'](_[_0x2672('0x3a')](_0x121c61[_0x2672('0x31')],_0x2055ee['filters']));if(_0x121c61[_0x2672('0x31')][_0x2672('0x3b')]){_0x4dd545[_0x2672('0x3c')]=_['merge'](_0x4dd545[_0x2672('0x3c')],{'$or':_['map'](_0x4dd545[_0x2672('0x33')],function(_0x1c9e22){var _0x3d9f1f={};_0x3d9f1f[_0x1c9e22]={'$like':'%'+_0x121c61['query'][_0x2672('0x3b')]+'%'};return _0x3d9f1f;})});}_0x4dd545=_['merge']({},_0x4dd545,_0x121c61[_0x2672('0x3f')]);return _0x2fa42b['getSubjects'](_0x4dd545);}})[_0x2672('0x25')](function(_0x4c4ffc){if(_0x4c4ffc){_0x2b353f=_0x4c4ffc[_0x2672('0x35')];if(!_0x121c61[_0x2672('0x31')][_0x2672('0x4d')](_0x2672('0x36'))){_0x4dd545['limit']=qs['limit'](_0x121c61[_0x2672('0x31')][_0x2672('0x1c')]);_0x4dd545[_0x2672('0x1a')]=qs['offset'](_0x121c61[_0x2672('0x31')][_0x2672('0x1a')]);}return _0x2fa42b['getSubjects'](_0x4dd545);}})['then'](function(_0x789101){if(_0x789101){return _0x789101?{'count':_0x2b353f,'rows':_0x789101}:null;}})[_0x2672('0x25')](respondWithResult(_0xf7465b,null))[_0x2672('0x43')](handleError(_0xf7465b,null));};exports[_0x2672('0x4f')]=function(_0x2f472c,_0x34839a,_0x5dabe7){var _0x3fc3a3={};var _0x4d8812={};var _0x4b347d;var _0x197c82;return db[_0x2672('0x2b')][_0x2672('0x4b')]({'where':{'id':_0x2f472c[_0x2672('0x48')]['id']}})[_0x2672('0x25')](handleEntityNotFound(_0x34839a,null))[_0x2672('0x25')](function(_0xe86ad4){if(_0xe86ad4){_0x4b347d=_0xe86ad4;_0x4d8812['model']=_[_0x2672('0x30')](db['SugarcrmField'][_0x2672('0x2c')]);_0x4d8812[_0x2672('0x31')]=_[_0x2672('0x30')](_0x2f472c[_0x2672('0x31')]);_0x4d8812['filters']=_['intersection'](_0x4d8812[_0x2672('0x2f')],_0x4d8812[_0x2672('0x31')]);_0x3fc3a3[_0x2672('0x33')]=_['intersection'](_0x4d8812['model'],qs[_0x2672('0x34')](_0x2f472c['query'][_0x2672('0x34')]));_0x3fc3a3[_0x2672('0x33')]=_0x3fc3a3['attributes'][_0x2672('0x35')]?_0x3fc3a3[_0x2672('0x33')]:_0x4d8812[_0x2672('0x2f')];_0x3fc3a3[_0x2672('0x37')]=qs['sort'](_0x2f472c[_0x2672('0x31')][_0x2672('0x38')]);_0x3fc3a3[_0x2672('0x3c')]=qs[_0x2672('0x39')](_[_0x2672('0x3a')](_0x2f472c[_0x2672('0x31')],_0x4d8812[_0x2672('0x39')]));if(_0x2f472c[_0x2672('0x31')][_0x2672('0x3b')]){_0x3fc3a3[_0x2672('0x3c')]=_[_0x2672('0x3d')](_0x3fc3a3[_0x2672('0x3c')],{'$or':_[_0x2672('0x2a')](_0x3fc3a3[_0x2672('0x33')],function(_0x50d158){var _0x252238={};_0x252238[_0x50d158]={'$like':'%'+_0x2f472c['query'][_0x2672('0x3b')]+'%'};return _0x252238;})});}_0x3fc3a3=_[_0x2672('0x3d')]({},_0x3fc3a3,_0x2f472c[_0x2672('0x3f')]);return _0x4b347d['getDescriptions'](_0x3fc3a3);}})[_0x2672('0x25')](function(_0x14a2b3){if(_0x14a2b3){_0x197c82=_0x14a2b3[_0x2672('0x35')];if(!_0x2f472c['query'][_0x2672('0x4d')]('nolimit')){_0x3fc3a3[_0x2672('0x1c')]=qs[_0x2672('0x1c')](_0x2f472c[_0x2672('0x31')][_0x2672('0x1c')]);_0x3fc3a3['offset']=qs[_0x2672('0x1a')](_0x2f472c[_0x2672('0x31')]['offset']);}return _0x4b347d[_0x2672('0x4f')](_0x3fc3a3);}})[_0x2672('0x25')](function(_0xb0914d){if(_0xb0914d){return _0xb0914d?{'count':_0x197c82,'rows':_0xb0914d}:null;}})['then'](respondWithResult(_0x34839a,null))[_0x2672('0x43')](handleError(_0x34839a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f566295..33b187b 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 _0xc183=['../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x247f36,_0x1ed18b){var _0x166946=function(_0x447eab){while(--_0x447eab){_0x247f36['push'](_0x247f36['shift']());}};_0x166946(++_0x1ed18b);}(_0xc183,0x17f));var _0x3c18=function(_0xf41ca5,_0x107e15){_0xf41ca5=_0xf41ca5-0x0;var _0x1fb25e=_0xc183[_0xf41ca5];return _0x1fb25e;};'use strict';var _=require(_0x3c18('0x0'));var util=require(_0x3c18('0x1'));var logger=require(_0x3c18('0x2'))(_0x3c18('0x3'));var moment=require(_0x3c18('0x4'));var BPromise=require(_0x3c18('0x5'));var rp=require(_0x3c18('0x6'));var fs=require('fs');var path=require(_0x3c18('0x7'));var rimraf=require(_0x3c18('0x8'));var config=require(_0x3c18('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3c18('0xa')]=function(_0x270435,_0x371dcc){return _0x270435[_0x3c18('0xb')](_0x3c18('0xc'),attributes,{'tableName':_0x3c18('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb344=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb344,0x150));var _0x4b34=function(_0x3fe05c,_0x325126){_0x3fe05c=_0x3fe05c-0x0;var _0x166aac=_0xb344[_0x3fe05c];return _0x166aac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b34('0x0'))(_0x4b34('0x1'));var moment=require(_0x4b34('0x2'));var BPromise=require(_0x4b34('0x3'));var rp=require(_0x4b34('0x4'));var fs=require('fs');var path=require(_0x4b34('0x5'));var rimraf=require(_0x4b34('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b34('0x7'));module[_0x4b34('0x8')]=function(_0xa09244,_0x20f445){return _0xa09244['define'](_0x4b34('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 18c1d00..af7822d 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 _0xcdb1=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x483e99,_0x42418e){var _0x237cc4=function(_0x1be496){while(--_0x1be496){_0x483e99['push'](_0x483e99['shift']());}};_0x237cc4(++_0x42418e);}(_0xcdb1,0xd5));var _0x1cdb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcdb1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var moment=require(_0x1cdb('0x2'));var BPromise=require(_0x1cdb('0x3'));var rs=require(_0x1cdb('0x4'));var fs=require('fs');var Redis=require(_0x1cdb('0x5'));var db=require(_0x1cdb('0x6'))['db'];var utils=require(_0x1cdb('0x7'));var logger=require(_0x1cdb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1cdb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36fdbf,_0x2b890d,_0x151946){return new BPromise(function(_0xecbca5,_0x16cbdd){return client['request'](_0x36fdbf,_0x151946)[_0x1cdb('0xa')](function(_0x527880){logger['info'](_0x1cdb('0xb'),_0x2b890d,_0x1cdb('0xc'));logger[_0x1cdb('0xd')](_0x1cdb('0xe'),_0x2b890d,_0x1cdb('0xc'),JSON[_0x1cdb('0xf')](_0x527880));if(_0x527880[_0x1cdb('0x10')]){if(_0x527880[_0x1cdb('0x10')]['code']===0x1f4){logger[_0x1cdb('0x10')](_0x1cdb('0xb'),_0x2b890d,_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);return _0x16cbdd(_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);}logger[_0x1cdb('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2b890d,_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);return _0xecbca5(_0x527880['error'][_0x1cdb('0x11')]);}else{logger['info'](_0x1cdb('0xb'),_0x2b890d,'request\x20sent');_0xecbca5(_0x527880[_0x1cdb('0x12')][_0x1cdb('0x11')]);}})['catch'](function(_0x297868){logger[_0x1cdb('0x10')](_0x1cdb('0xb'),_0x2b890d,_0x297868);_0x16cbdd(_0x297868);});});} \ No newline at end of file +var _0x10f8=['SugarcrmConfiguration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x44de03,_0x28e6d6){var _0x320e3a=function(_0x564d04){while(--_0x564d04){_0x44de03['push'](_0x44de03['shift']());}};_0x320e3a(++_0x28e6d6);}(_0x10f8,0x7c));var _0x810f=function(_0x501695,_0xda9d02){_0x501695=_0x501695-0x0;var _0xca4b6c=_0x10f8[_0x501695];return _0xca4b6c;};'use strict';var _=require(_0x810f('0x0'));var util=require(_0x810f('0x1'));var moment=require('moment');var BPromise=require(_0x810f('0x2'));var rs=require(_0x810f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x810f('0x4'));var logger=require(_0x810f('0x5'))(_0x810f('0x6'));var config=require(_0x810f('0x7'));var jayson=require(_0x810f('0x8'));var client=jayson[_0x810f('0x9')][_0x810f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdedb4,_0x3d0de3,_0x4e41c8){return new BPromise(function(_0x45db18,_0x2127fb){return client[_0x810f('0xb')](_0xbdedb4,_0x4e41c8)[_0x810f('0xc')](function(_0x51748f){logger[_0x810f('0xd')](_0x810f('0xe'),_0x3d0de3,'request\x20sent');logger[_0x810f('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3d0de3,'request\x20sent',JSON[_0x810f('0x10')](_0x51748f));if(_0x51748f[_0x810f('0x11')]){if(_0x51748f[_0x810f('0x11')][_0x810f('0x12')]===0x1f4){logger[_0x810f('0x11')](_0x810f('0xe'),_0x3d0de3,_0x51748f['error']['message']);return _0x2127fb(_0x51748f[_0x810f('0x11')][_0x810f('0x13')]);}logger[_0x810f('0x11')](_0x810f('0xe'),_0x3d0de3,_0x51748f[_0x810f('0x11')][_0x810f('0x13')]);return _0x45db18(_0x51748f[_0x810f('0x11')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x3d0de3,_0x810f('0x14'));_0x45db18(_0x51748f[_0x810f('0x15')][_0x810f('0x13')]);}})[_0x810f('0x16')](function(_0x30f846){logger['error'](_0x810f('0xe'),_0x3d0de3,_0x30f846);_0x2127fb(_0x30f846);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4612455..497e78c 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 _0x2c07=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','post'];(function(_0x1c7ad0,_0x448315){var _0x27314b=function(_0x49bd56){while(--_0x49bd56){_0x1c7ad0['push'](_0x1c7ad0['shift']());}};_0x27314b(++_0x448315);}(_0x2c07,0xcb));var _0x72c0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2c07[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x72c0('0x0'));var util=require(_0x72c0('0x1'));var path=require(_0x72c0('0x2'));var timeout=require(_0x72c0('0x3'));var express=require('express');var router=express[_0x72c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72c0('0x5'));var interaction=require(_0x72c0('0x6'));var config=require(_0x72c0('0x7'));var controller=require(_0x72c0('0x8'));router[_0x72c0('0x9')]('/',auth[_0x72c0('0xa')](),controller['index']);router[_0x72c0('0x9')](_0x72c0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x72c0('0xc')]('/',auth[_0x72c0('0xa')](),controller[_0x72c0('0xd')]);router[_0x72c0('0xe')](_0x72c0('0xb'),auth[_0x72c0('0xa')](),controller[_0x72c0('0xf')]);router[_0x72c0('0x10')](_0x72c0('0xb'),auth[_0x72c0('0xa')](),controller['destroy']);module[_0x72c0('0x11')]=router; \ No newline at end of file +var _0x05e0=['../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5411d6,_0x2fac44){var _0x1d7a86=function(_0x363ec3){while(--_0x363ec3){_0x5411d6['push'](_0x5411d6['shift']());}};_0x1d7a86(++_0x2fac44);}(_0x05e0,0x1f2));var _0x005e=function(_0x7dfb21,_0x54cbb5){_0x7dfb21=_0x7dfb21-0x0;var _0x544f45=_0x05e0[_0x7dfb21];return _0x544f45;};'use strict';var multer=require(_0x005e('0x0'));var util=require(_0x005e('0x1'));var path=require(_0x005e('0x2'));var timeout=require(_0x005e('0x3'));var express=require(_0x005e('0x4'));var router=express['Router']();var fs_extra=require(_0x005e('0x5'));var auth=require(_0x005e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x005e('0x7'));var controller=require(_0x005e('0x8'));router[_0x005e('0x9')]('/',auth['isAuthenticated'](),controller[_0x005e('0xa')]);router[_0x005e('0x9')](_0x005e('0xb'),auth[_0x005e('0xc')](),controller['show']);router[_0x005e('0xd')]('/',auth[_0x005e('0xc')](),controller[_0x005e('0xe')]);router[_0x005e('0xf')](_0x005e('0xb'),auth[_0x005e('0xc')](),controller['update']);router['delete'](_0x005e('0xb'),auth[_0x005e('0xc')](),controller[_0x005e('0x10')]);module[_0x005e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ea49e65..ac1cdc0 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 _0x5dc7=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x138b54,_0x3a678c){var _0x387a2b=function(_0x1c5328){while(--_0x1c5328){_0x138b54['push'](_0x138b54['shift']());}};_0x387a2b(++_0x3a678c);}(_0x5dc7,0xbb));var _0x75dc=function(_0x5d36e6,_0x1a7786){_0x5d36e6=_0x5d36e6-0x0;var _0x120cb1=_0x5dc7[_0x5d36e6];return _0x120cb1;};'use strict';var Sequelize=require(_0x75dc('0x0'));module[_0x75dc('0x1')]={'type':{'type':Sequelize[_0x75dc('0x2')](_0x75dc('0x3'),_0x75dc('0x4'),_0x75dc('0x5'),_0x75dc('0x6'),_0x75dc('0x7')),'defaultValue':_0x75dc('0x3')},'content':{'type':Sequelize[_0x75dc('0x8')]},'key':{'type':Sequelize[_0x75dc('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x75dc('0x3'),'variable',_0x75dc('0x5'))},'keyContent':{'type':Sequelize[_0x75dc('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x75dc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75dc('0x8')]}}; \ No newline at end of file +var _0x8d15=['variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x172127,_0x2cd369){var _0x37187b=function(_0x2da0e2){while(--_0x2da0e2){_0x172127['push'](_0x172127['shift']());}};_0x37187b(++_0x2cd369);}(_0x8d15,0x85));var _0x58d1=function(_0x5683c8,_0x1b4d8c){_0x5683c8=_0x5683c8-0x0;var _0x27f4aa=_0x8d15[_0x5683c8];return _0x27f4aa;};'use strict';var Sequelize=require('sequelize');module[_0x58d1('0x0')]={'type':{'type':Sequelize[_0x58d1('0x1')](_0x58d1('0x2'),_0x58d1('0x3'),_0x58d1('0x4'),_0x58d1('0x5'),'picklist'),'defaultValue':_0x58d1('0x2')},'content':{'type':Sequelize[_0x58d1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x58d1('0x2'),'variable',_0x58d1('0x4'))},'keyContent':{'type':Sequelize[_0x58d1('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x58d1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x58d1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4aaf12a..3de8cb5 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 _0xa747=['util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2c27d5,_0xd810c9){var _0x23de81=function(_0x496df0){while(--_0x496df0){_0x2c27d5['push'](_0x2c27d5['shift']());}};_0x23de81(++_0xd810c9);}(_0xa747,0x12d));var _0x7a74=function(_0x102f63,_0x3e8b3d){_0x102f63=_0x102f63-0x0;var _0x29e07c=_0xa747[_0x102f63];return _0x29e07c;};'use strict';var emlformat=require(_0x7a74('0x0'));var rimraf=require(_0x7a74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a74('0x2'));var rp=require(_0x7a74('0x3'));var moment=require(_0x7a74('0x4'));var BPromise=require(_0x7a74('0x5'));var Mustache=require(_0x7a74('0x6'));var util=require(_0x7a74('0x7'));var path=require(_0x7a74('0x8'));var sox=require(_0x7a74('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a74('0xa'));var _=require(_0x7a74('0xb'));var squel=require(_0x7a74('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a74('0xd'));var deskjs=require(_0x7a74('0xe'));var toCsv=require(_0x7a74('0xf'));var querystring=require('querystring');var Papa=require(_0x7a74('0x10'));var Redis=require(_0x7a74('0x11'));var authService=require(_0x7a74('0x12'));var qs=require(_0x7a74('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a74('0x14'))(_0x7a74('0x15'));var utils=require(_0x7a74('0x16'));var config=require(_0x7a74('0x17'));var licenseUtil=require(_0x7a74('0x18'));var db=require(_0x7a74('0x19'))['db'];function respondWithStatusCode(_0x5d9d8a,_0x20cee7){_0x20cee7=_0x20cee7||0xcc;return function(_0x5ea8e7){if(_0x5ea8e7){return _0x5d9d8a[_0x7a74('0x1a')](_0x20cee7);}return _0x5d9d8a['status'](_0x20cee7)[_0x7a74('0x1b')]();};}function respondWithResult(_0x8cd735,_0x2e6948){_0x2e6948=_0x2e6948||0xc8;return function(_0x56647f){if(_0x56647f){return _0x8cd735[_0x7a74('0x1c')](_0x2e6948)['json'](_0x56647f);}};}function respondWithFilteredResult(_0x109b8a,_0x642774){return function(_0x5874a2){if(_0x5874a2){var _0x1ff3b9=typeof _0x642774[_0x7a74('0x1d')]===_0x7a74('0x1e')&&typeof _0x642774[_0x7a74('0x1f')]===_0x7a74('0x1e');var _0x394269=_0x5874a2[_0x7a74('0x20')];var _0x12b07e=_0x1ff3b9?0x0:_0x642774[_0x7a74('0x1d')];var _0x3289e9=_0x1ff3b9?_0x5874a2['count']:_0x642774[_0x7a74('0x1d')]+_0x642774[_0x7a74('0x1f')];var _0x432b0d;if(_0x3289e9>=_0x394269){_0x3289e9=_0x394269;_0x432b0d=0xc8;}else{_0x432b0d=0xce;}_0x109b8a[_0x7a74('0x1c')](_0x432b0d);return _0x109b8a['set'](_0x7a74('0x21'),_0x12b07e+'-'+_0x3289e9+'/'+_0x394269)[_0x7a74('0x22')](_0x5874a2);}return null;};}function patchUpdates(_0x51a44d){return function(_0xd45ec5){try{jsonpatch[_0x7a74('0x23')](_0xd45ec5,_0x51a44d,!![]);}catch(_0x52a025){return BPromise[_0x7a74('0x24')](_0x52a025);}return _0xd45ec5[_0x7a74('0x25')]();};}function saveUpdates(_0x250216,_0x488ed5){return function(_0x144367){if(_0x144367){return _0x144367[_0x7a74('0x26')](_0x250216)[_0x7a74('0x27')](function(_0xf798e1){return _0xf798e1;});}return null;};}function removeEntity(_0x58edaf,_0x51598a){return function(_0x3325af){if(_0x3325af){return _0x3325af[_0x7a74('0x28')]()[_0x7a74('0x27')](function(){_0x58edaf[_0x7a74('0x1c')](0xcc)[_0x7a74('0x1b')]();});}};}function handleEntityNotFound(_0x1e75d7,_0x43702c){return function(_0x1ad1ae){if(!_0x1ad1ae){_0x1e75d7['sendStatus'](0x194);}return _0x1ad1ae;};}function handleError(_0x34cd42,_0x10c564){_0x10c564=_0x10c564||0x1f4;return function(_0x5e0e0a){logger[_0x7a74('0x29')](_0x5e0e0a[_0x7a74('0x2a')]);if(_0x5e0e0a['name']){delete _0x5e0e0a[_0x7a74('0x2b')];}_0x34cd42[_0x7a74('0x1c')](_0x10c564)[_0x7a74('0x2c')](_0x5e0e0a);};}exports['index']=function(_0x40f577,_0x31d039){var _0x21857d={},_0x32b441={},_0x470e8c={'count':0x0,'rows':[]};var _0x2c22e4=_[_0x7a74('0x2d')](db[_0x7a74('0x2e')][_0x7a74('0x2f')],function(_0x439651){return{'name':_0x439651[_0x7a74('0x30')],'type':_0x439651[_0x7a74('0x31')][_0x7a74('0x32')]};});_0x32b441[_0x7a74('0x33')]=_[_0x7a74('0x2d')](_0x2c22e4,_0x7a74('0x2b'));_0x32b441[_0x7a74('0x34')]=_[_0x7a74('0x35')](_0x40f577[_0x7a74('0x34')]);_0x32b441['filters']=_[_0x7a74('0x36')](_0x32b441[_0x7a74('0x33')],_0x32b441[_0x7a74('0x34')]);_0x21857d['attributes']=_['intersection'](_0x32b441['model'],qs[_0x7a74('0x37')](_0x40f577[_0x7a74('0x34')][_0x7a74('0x37')]));_0x21857d[_0x7a74('0x38')]=_0x21857d[_0x7a74('0x38')][_0x7a74('0x39')]?_0x21857d[_0x7a74('0x38')]:_0x32b441['model'];if(!_0x40f577[_0x7a74('0x34')][_0x7a74('0x3a')](_0x7a74('0x3b'))){_0x21857d[_0x7a74('0x1f')]=qs['limit'](_0x40f577['query'][_0x7a74('0x1f')]);_0x21857d[_0x7a74('0x1d')]=qs['offset'](_0x40f577[_0x7a74('0x34')][_0x7a74('0x1d')]);}_0x21857d[_0x7a74('0x3c')]=qs[_0x7a74('0x3d')](_0x40f577['query'][_0x7a74('0x3d')]);_0x21857d['where']=qs[_0x7a74('0x3e')](_[_0x7a74('0x3f')](_0x40f577[_0x7a74('0x34')],_0x32b441[_0x7a74('0x3e')]),_0x2c22e4);if(_0x40f577['query'][_0x7a74('0x40')]){_0x21857d[_0x7a74('0x41')]=_[_0x7a74('0x42')](_0x21857d['where'],{'$or':_[_0x7a74('0x2d')](_0x2c22e4,function(_0x4b161c){if(_0x4b161c['type']!==_0x7a74('0x43')){var _0x5af1ff={};_0x5af1ff[_0x4b161c['name']]={'$like':'%'+_0x40f577[_0x7a74('0x34')][_0x7a74('0x40')]+'%'};return _0x5af1ff;}})});}_0x21857d=_['merge']({},_0x21857d,_0x40f577[_0x7a74('0x44')]);var _0x11f3c8={'where':_0x21857d[_0x7a74('0x41')]};return db[_0x7a74('0x2e')][_0x7a74('0x20')](_0x11f3c8)[_0x7a74('0x27')](function(_0x58a996){_0x470e8c[_0x7a74('0x20')]=_0x58a996;if(_0x40f577[_0x7a74('0x34')][_0x7a74('0x45')]){_0x21857d[_0x7a74('0x46')]=[{'all':!![]}];}return db[_0x7a74('0x2e')]['findAll'](_0x21857d);})[_0x7a74('0x27')](function(_0x246091){_0x470e8c['rows']=_0x246091;return _0x470e8c;})[_0x7a74('0x27')](respondWithFilteredResult(_0x31d039,_0x21857d))[_0x7a74('0x47')](handleError(_0x31d039,null));};exports[_0x7a74('0x48')]=function(_0x29bf7e,_0x3667d5){var _0x387222={'raw':!![],'where':{'id':_0x29bf7e[_0x7a74('0x49')]['id']}},_0x5cf1bb={};_0x5cf1bb[_0x7a74('0x33')]=_[_0x7a74('0x35')](db[_0x7a74('0x2e')][_0x7a74('0x2f')]);_0x5cf1bb[_0x7a74('0x34')]=_[_0x7a74('0x35')](_0x29bf7e['query']);_0x5cf1bb[_0x7a74('0x3e')]=_[_0x7a74('0x36')](_0x5cf1bb[_0x7a74('0x33')],_0x5cf1bb[_0x7a74('0x34')]);_0x387222[_0x7a74('0x38')]=_['intersection'](_0x5cf1bb['model'],qs[_0x7a74('0x37')](_0x29bf7e[_0x7a74('0x34')][_0x7a74('0x37')]));_0x387222[_0x7a74('0x38')]=_0x387222[_0x7a74('0x38')]['length']?_0x387222['attributes']:_0x5cf1bb[_0x7a74('0x33')];if(_0x29bf7e['query']['includeAll']){_0x387222[_0x7a74('0x46')]=[{'all':!![]}];}_0x387222=_[_0x7a74('0x42')]({},_0x387222,_0x29bf7e['options']);return db[_0x7a74('0x2e')][_0x7a74('0x4a')](_0x387222)['then'](handleEntityNotFound(_0x3667d5,null))[_0x7a74('0x27')](respondWithResult(_0x3667d5,null))['catch'](handleError(_0x3667d5,null));};exports[_0x7a74('0x4b')]=function(_0x356454,_0x43a262){return db[_0x7a74('0x2e')][_0x7a74('0x4b')](_0x356454[_0x7a74('0x4c')],{})[_0x7a74('0x27')](respondWithResult(_0x43a262,0xc9))[_0x7a74('0x47')](handleError(_0x43a262,null));};exports[_0x7a74('0x26')]=function(_0x522b85,_0xbff7f9){if(_0x522b85[_0x7a74('0x4c')]['id']){delete _0x522b85['body']['id'];}return db[_0x7a74('0x2e')][_0x7a74('0x4a')]({'where':{'id':_0x522b85['params']['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0xbff7f9,null))[_0x7a74('0x27')](saveUpdates(_0x522b85[_0x7a74('0x4c')],null))['then'](respondWithResult(_0xbff7f9,null))[_0x7a74('0x47')](handleError(_0xbff7f9,null));};exports[_0x7a74('0x28')]=function(_0x58e0d1,_0x3577cd){return db[_0x7a74('0x2e')][_0x7a74('0x4a')]({'where':{'id':_0x58e0d1[_0x7a74('0x49')]['id']}})['then'](handleEntityNotFound(_0x3577cd,null))[_0x7a74('0x27')](removeEntity(_0x3577cd,null))[_0x7a74('0x47')](handleError(_0x3577cd,null));}; \ No newline at end of file +var _0xc34e=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','includeAll','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','end','error','stack','name','send','map','SugarcrmField','rawAttributes','type','key'];(function(_0x434c79,_0x2cf957){var _0x3224b1=function(_0x245118){while(--_0x245118){_0x434c79['push'](_0x434c79['shift']());}};_0x3224b1(++_0x2cf957);}(_0xc34e,0xb6));var _0xec34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec34('0x0'));var rimraf=require(_0xec34('0x1'));var zipdir=require(_0xec34('0x2'));var jsonpatch=require(_0xec34('0x3'));var rp=require(_0xec34('0x4'));var moment=require(_0xec34('0x5'));var BPromise=require(_0xec34('0x6'));var Mustache=require(_0xec34('0x7'));var util=require('util');var path=require('path');var sox=require(_0xec34('0x8'));var csv=require(_0xec34('0x9'));var ejs=require(_0xec34('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec34('0xb'));var squel=require(_0xec34('0xc'));var crypto=require(_0xec34('0xd'));var jsforce=require(_0xec34('0xe'));var deskjs=require(_0xec34('0xf'));var toCsv=require(_0xec34('0x9'));var querystring=require(_0xec34('0x10'));var Papa=require('papaparse');var Redis=require(_0xec34('0x11'));var authService=require(_0xec34('0x12'));var qs=require(_0xec34('0x13'));var as=require(_0xec34('0x14'));var hardwareService=require(_0xec34('0x15'));var logger=require('../../config/logger')(_0xec34('0x16'));var utils=require(_0xec34('0x17'));var config=require(_0xec34('0x18'));var licenseUtil=require(_0xec34('0x19'));var db=require(_0xec34('0x1a'))['db'];function respondWithStatusCode(_0x2e1370,_0x1ac2cb){_0x1ac2cb=_0x1ac2cb||0xcc;return function(_0x12f1fb){if(_0x12f1fb){return _0x2e1370[_0xec34('0x1b')](_0x1ac2cb);}return _0x2e1370[_0xec34('0x1c')](_0x1ac2cb)['end']();};}function respondWithResult(_0xd56814,_0x334943){_0x334943=_0x334943||0xc8;return function(_0x1fb364){if(_0x1fb364){return _0xd56814[_0xec34('0x1c')](_0x334943)[_0xec34('0x1d')](_0x1fb364);}};}function respondWithFilteredResult(_0x1b6a89,_0xd6505d){return function(_0x214878){if(_0x214878){var _0x31172b=typeof _0xd6505d['offset']===_0xec34('0x1e')&&typeof _0xd6505d[_0xec34('0x1f')]===_0xec34('0x1e');var _0x106bb4=_0x214878[_0xec34('0x20')];var _0x5678cd=_0x31172b?0x0:_0xd6505d['offset'];var _0x26bc98=_0x31172b?_0x214878[_0xec34('0x20')]:_0xd6505d[_0xec34('0x21')]+_0xd6505d['limit'];var _0x26f4c1;if(_0x26bc98>=_0x106bb4){_0x26bc98=_0x106bb4;_0x26f4c1=0xc8;}else{_0x26f4c1=0xce;}_0x1b6a89[_0xec34('0x1c')](_0x26f4c1);return _0x1b6a89[_0xec34('0x22')](_0xec34('0x23'),_0x5678cd+'-'+_0x26bc98+'/'+_0x106bb4)['json'](_0x214878);}return null;};}function patchUpdates(_0x3bb924){return function(_0x572819){try{jsonpatch['apply'](_0x572819,_0x3bb924,!![]);}catch(_0x3f769f){return BPromise[_0xec34('0x24')](_0x3f769f);}return _0x572819['save']();};}function saveUpdates(_0x586c3a,_0xe3449c){return function(_0x263b51){if(_0x263b51){return _0x263b51[_0xec34('0x25')](_0x586c3a)[_0xec34('0x26')](function(_0x12380c){return _0x12380c;});}return null;};}function removeEntity(_0x1b6b58,_0x2a6785){return function(_0x5c4ca1){if(_0x5c4ca1){return _0x5c4ca1['destroy']()[_0xec34('0x26')](function(){_0x1b6b58[_0xec34('0x1c')](0xcc)[_0xec34('0x27')]();});}};}function handleEntityNotFound(_0x58bcb8,_0x86b494){return function(_0x3c10f3){if(!_0x3c10f3){_0x58bcb8[_0xec34('0x1b')](0x194);}return _0x3c10f3;};}function handleError(_0x13ed47,_0x508096){_0x508096=_0x508096||0x1f4;return function(_0x2cbe6b){logger[_0xec34('0x28')](_0x2cbe6b[_0xec34('0x29')]);if(_0x2cbe6b[_0xec34('0x2a')]){delete _0x2cbe6b[_0xec34('0x2a')];}_0x13ed47[_0xec34('0x1c')](_0x508096)[_0xec34('0x2b')](_0x2cbe6b);};}exports['index']=function(_0x4c07fa,_0xc35aae){var _0x22d515={},_0x2dc0b1={},_0x5b733c={'count':0x0,'rows':[]};var _0x372b2e=_[_0xec34('0x2c')](db[_0xec34('0x2d')][_0xec34('0x2e')],function(_0x4d6f8b){return{'name':_0x4d6f8b['fieldName'],'type':_0x4d6f8b[_0xec34('0x2f')][_0xec34('0x30')]};});_0x2dc0b1[_0xec34('0x31')]=_['map'](_0x372b2e,_0xec34('0x2a'));_0x2dc0b1[_0xec34('0x32')]=_[_0xec34('0x33')](_0x4c07fa['query']);_0x2dc0b1[_0xec34('0x34')]=_[_0xec34('0x35')](_0x2dc0b1[_0xec34('0x31')],_0x2dc0b1[_0xec34('0x32')]);_0x22d515['attributes']=_[_0xec34('0x35')](_0x2dc0b1[_0xec34('0x31')],qs['fields'](_0x4c07fa[_0xec34('0x32')][_0xec34('0x36')]));_0x22d515[_0xec34('0x37')]=_0x22d515[_0xec34('0x37')][_0xec34('0x38')]?_0x22d515[_0xec34('0x37')]:_0x2dc0b1[_0xec34('0x31')];if(!_0x4c07fa[_0xec34('0x32')][_0xec34('0x39')](_0xec34('0x3a'))){_0x22d515[_0xec34('0x1f')]=qs['limit'](_0x4c07fa[_0xec34('0x32')][_0xec34('0x1f')]);_0x22d515['offset']=qs[_0xec34('0x21')](_0x4c07fa[_0xec34('0x32')]['offset']);}_0x22d515[_0xec34('0x3b')]=qs[_0xec34('0x3c')](_0x4c07fa[_0xec34('0x32')][_0xec34('0x3c')]);_0x22d515[_0xec34('0x3d')]=qs[_0xec34('0x34')](_[_0xec34('0x3e')](_0x4c07fa[_0xec34('0x32')],_0x2dc0b1[_0xec34('0x34')]),_0x372b2e);if(_0x4c07fa['query'][_0xec34('0x3f')]){_0x22d515['where']=_[_0xec34('0x40')](_0x22d515[_0xec34('0x3d')],{'$or':_['map'](_0x372b2e,function(_0xef8852){if(_0xef8852[_0xec34('0x2f')]!==_0xec34('0x41')){var _0x3c81eb={};_0x3c81eb[_0xef8852[_0xec34('0x2a')]]={'$like':'%'+_0x4c07fa[_0xec34('0x32')]['filter']+'%'};return _0x3c81eb;}})});}_0x22d515=_[_0xec34('0x40')]({},_0x22d515,_0x4c07fa[_0xec34('0x42')]);var _0x510584={'where':_0x22d515[_0xec34('0x3d')]};return db['SugarcrmField'][_0xec34('0x20')](_0x510584)[_0xec34('0x26')](function(_0x5c1f63){_0x5b733c['count']=_0x5c1f63;if(_0x4c07fa[_0xec34('0x32')]['includeAll']){_0x22d515[_0xec34('0x43')]=[{'all':!![]}];}return db[_0xec34('0x2d')]['findAll'](_0x22d515);})['then'](function(_0x2de781){_0x5b733c[_0xec34('0x44')]=_0x2de781;return _0x5b733c;})['then'](respondWithFilteredResult(_0xc35aae,_0x22d515))[_0xec34('0x45')](handleError(_0xc35aae,null));};exports[_0xec34('0x46')]=function(_0x54f4ec,_0x14c816){var _0x506e04={'raw':!![],'where':{'id':_0x54f4ec['params']['id']}},_0x917524={};_0x917524[_0xec34('0x31')]=_[_0xec34('0x33')](db[_0xec34('0x2d')][_0xec34('0x2e')]);_0x917524[_0xec34('0x32')]=_[_0xec34('0x33')](_0x54f4ec['query']);_0x917524[_0xec34('0x34')]=_[_0xec34('0x35')](_0x917524[_0xec34('0x31')],_0x917524[_0xec34('0x32')]);_0x506e04[_0xec34('0x37')]=_[_0xec34('0x35')](_0x917524[_0xec34('0x31')],qs[_0xec34('0x36')](_0x54f4ec['query'][_0xec34('0x36')]));_0x506e04[_0xec34('0x37')]=_0x506e04[_0xec34('0x37')]['length']?_0x506e04[_0xec34('0x37')]:_0x917524[_0xec34('0x31')];if(_0x54f4ec[_0xec34('0x32')][_0xec34('0x47')]){_0x506e04['include']=[{'all':!![]}];}_0x506e04=_[_0xec34('0x40')]({},_0x506e04,_0x54f4ec[_0xec34('0x42')]);return db[_0xec34('0x2d')][_0xec34('0x48')](_0x506e04)['then'](handleEntityNotFound(_0x14c816,null))[_0xec34('0x26')](respondWithResult(_0x14c816,null))[_0xec34('0x45')](handleError(_0x14c816,null));};exports[_0xec34('0x49')]=function(_0x56897e,_0x5328ee){return db[_0xec34('0x2d')][_0xec34('0x49')](_0x56897e['body'],{})[_0xec34('0x26')](respondWithResult(_0x5328ee,0xc9))[_0xec34('0x45')](handleError(_0x5328ee,null));};exports[_0xec34('0x25')]=function(_0x1074c2,_0x9a6e29){if(_0x1074c2[_0xec34('0x4a')]['id']){delete _0x1074c2[_0xec34('0x4a')]['id'];}return db['SugarcrmField'][_0xec34('0x48')]({'where':{'id':_0x1074c2[_0xec34('0x4b')]['id']}})[_0xec34('0x26')](handleEntityNotFound(_0x9a6e29,null))[_0xec34('0x26')](saveUpdates(_0x1074c2[_0xec34('0x4a')],null))[_0xec34('0x26')](respondWithResult(_0x9a6e29,null))['catch'](handleError(_0x9a6e29,null));};exports[_0xec34('0x4c')]=function(_0x5c1ef7,_0x2e9bf1){return db['SugarcrmField']['find']({'where':{'id':_0x5c1ef7['params']['id']}})[_0xec34('0x26')](handleEntityNotFound(_0x2e9bf1,null))['then'](removeEntity(_0x2e9bf1,null))['catch'](handleError(_0x2e9bf1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1d16592..58b2430 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 _0xb97d=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb97d,0x101));var _0xdb97=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xb97d[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xdb97('0x0'));var util=require('util');var logger=require(_0xdb97('0x1'))(_0xdb97('0x2'));var moment=require(_0xdb97('0x3'));var BPromise=require(_0xdb97('0x4'));var rp=require(_0xdb97('0x5'));var fs=require('fs');var path=require(_0xdb97('0x6'));var rimraf=require('rimraf');var config=require(_0xdb97('0x7'));var attributes=require(_0xdb97('0x8'));module['exports']=function(_0x10b556,_0x4766bd){return _0x10b556['define'](_0xdb97('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xdb97('0xa'),'fields':[_0xdb97('0xb'),_0xdb97('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9928=['moment','request-promise','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api'];(function(_0x4080a2,_0x322e13){var _0x5b89b6=function(_0xbc8191){while(--_0xbc8191){_0x4080a2['push'](_0x4080a2['shift']());}};_0x5b89b6(++_0x322e13);}(_0x9928,0xc0));var _0x8992=function(_0x545e86,_0x46a2ed){_0x545e86=_0x545e86-0x0;var _0xa98055=_0x9928[_0x545e86];return _0xa98055;};'use strict';var _=require(_0x8992('0x0'));var util=require(_0x8992('0x1'));var logger=require('../../config/logger')(_0x8992('0x2'));var moment=require(_0x8992('0x3'));var BPromise=require('bluebird');var rp=require(_0x8992('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8992('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x8992('0x6')]=function(_0x311f1b,_0x4dddee){return _0x311f1b[_0x8992('0x7')](_0x8992('0x8'),attributes,{'tableName':_0x8992('0x9'),'paranoid':![],'indexes':[{'name':_0x8992('0xa'),'fields':[_0x8992('0xb'),_0x8992('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 02d3a7d..006d04d 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 _0x964b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SugarcrmField,\x20%s,\x20%s','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x57cd0d,_0x3f9781){var _0x131b38=function(_0x376b20){while(--_0x376b20){_0x57cd0d['push'](_0x57cd0d['shift']());}};_0x131b38(++_0x3f9781);}(_0x964b,0x146));var _0xb964=function(_0x5f37aa,_0x48ff20){_0x5f37aa=_0x5f37aa-0x0;var _0xccc4a0=_0x964b[_0x5f37aa];return _0xccc4a0;};'use strict';var _=require(_0xb964('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb964('0x1'));var fs=require('fs');var Redis=require(_0xb964('0x2'));var db=require(_0xb964('0x3'))['db'];var utils=require(_0xb964('0x4'));var logger=require(_0xb964('0x5'))(_0xb964('0x6'));var config=require(_0xb964('0x7'));var jayson=require(_0xb964('0x8'));var client=jayson[_0xb964('0x9')][_0xb964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bdd3e,_0x5a8fe8,_0x2537f9){return new BPromise(function(_0x5e66db,_0xb2385){return client[_0xb964('0xb')](_0x4bdd3e,_0x2537f9)[_0xb964('0xc')](function(_0x20beec){logger[_0xb964('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,'request\x20sent');logger[_0xb964('0xe')](_0xb964('0xf'),_0x5a8fe8,_0xb964('0x10'),JSON['stringify'](_0x20beec));if(_0x20beec['error']){if(_0x20beec[_0xb964('0x11')][_0xb964('0x12')]===0x1f4){logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);return _0xb2385(_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);}logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);return _0x5e66db(_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);}else{logger[_0xb964('0xd')](_0xb964('0x14'),_0x5a8fe8,_0xb964('0x10'));_0x5e66db(_0x20beec['result'][_0xb964('0x13')]);}})[_0xb964('0x15')](function(_0x5b9a9b){logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x5b9a9b);_0xb2385(_0x5b9a9b);});});} \ No newline at end of file +var _0x9e7c=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4ae5e4,_0x101e79){var _0x46ba7b=function(_0x3c8b75){while(--_0x3c8b75){_0x4ae5e4['push'](_0x4ae5e4['shift']());}};_0x46ba7b(++_0x101e79);}(_0x9e7c,0x1d0));var _0xc9e7=function(_0x32b94e,_0x113a65){_0x32b94e=_0x32b94e-0x0;var _0x4e8544=_0x9e7c[_0x32b94e];return _0x4e8544;};'use strict';var _=require(_0xc9e7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc9e7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9e7('0x2'))['db'];var utils=require(_0xc9e7('0x3'));var logger=require(_0xc9e7('0x4'))('rpc');var config=require(_0xc9e7('0x5'));var jayson=require(_0xc9e7('0x6'));var client=jayson['client'][_0xc9e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4ee7a0,_0xe8d76d,_0x3aee28){return new BPromise(function(_0x5a5d5a,_0x4c770d){return client[_0xc9e7('0x8')](_0x4ee7a0,_0x3aee28)[_0xc9e7('0x9')](function(_0x5c8da2){logger[_0xc9e7('0xa')](_0xc9e7('0xb'),_0xe8d76d,_0xc9e7('0xc'));logger[_0xc9e7('0xd')](_0xc9e7('0xe'),_0xe8d76d,_0xc9e7('0xc'),JSON['stringify'](_0x5c8da2));if(_0x5c8da2[_0xc9e7('0xf')]){if(_0x5c8da2['error'][_0xc9e7('0x10')]===0x1f4){logger[_0xc9e7('0xf')](_0xc9e7('0xb'),_0xe8d76d,_0x5c8da2[_0xc9e7('0xf')][_0xc9e7('0x11')]);return _0x4c770d(_0x5c8da2[_0xc9e7('0xf')][_0xc9e7('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0xe8d76d,_0x5c8da2[_0xc9e7('0xf')][_0xc9e7('0x11')]);return _0x5a5d5a(_0x5c8da2['error'][_0xc9e7('0x11')]);}else{logger[_0xc9e7('0xa')](_0xc9e7('0xb'),_0xe8d76d,'request\x20sent');_0x5a5d5a(_0x5c8da2['result']['message']);}})[_0xc9e7('0x12')](function(_0x3509bf){logger[_0xc9e7('0xf')](_0xc9e7('0xb'),_0xe8d76d,_0x3509bf);_0x4c770d(_0x3509bf);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f4dcace..48be3db 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 _0xdad2=['show','/:id/configurations','getConfigurations','post','put','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xdad2,0x14c));var _0x2dad=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdad2[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x2dad('0x0'));var path=require(_0x2dad('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dad('0x2'));var router=express[_0x2dad('0x3')]();var fs_extra=require(_0x2dad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x2dad('0x7')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0x9')]);router[_0x2dad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2dad('0xa')]);router[_0x2dad('0x7')](_0x2dad('0xb'),auth[_0x2dad('0x8')](),controller[_0x2dad('0xc')]);router[_0x2dad('0x7')]('/:id/fields',auth[_0x2dad('0x8')](),controller['getFields']);router[_0x2dad('0xd')]('/',auth[_0x2dad('0x8')](),controller['create']);router[_0x2dad('0xd')](_0x2dad('0xb'),auth[_0x2dad('0x8')](),controller['addConfiguration']);router[_0x2dad('0xe')](_0x2dad('0xf'),auth['isAuthenticated'](),controller[_0x2dad('0x10')]);router[_0x2dad('0x11')](_0x2dad('0xf'),auth[_0x2dad('0x8')](),controller['destroy']);module[_0x2dad('0x12')]=router; \ No newline at end of file +var _0xb0b9=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb0e41e,_0x3a9a70){var _0x4ee7bc=function(_0xc139dd){while(--_0xc139dd){_0xb0e41e['push'](_0xb0e41e['shift']());}};_0x4ee7bc(++_0x3a9a70);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x379fc3,_0x3a3e2b){_0x379fc3=_0x379fc3-0x0;var _0x301660=_0xb0b9[_0x379fc3];return _0x301660;};'use strict';var multer=require(_0x9b0b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b0b('0x1'));var express=require(_0x9b0b('0x2'));var router=express[_0x9b0b('0x3')]();var fs_extra=require(_0x9b0b('0x4'));var auth=require(_0x9b0b('0x5'));var interaction=require(_0x9b0b('0x6'));var config=require(_0x9b0b('0x7'));var controller=require(_0x9b0b('0x8'));router[_0x9b0b('0x9')]('/',auth[_0x9b0b('0xa')](),controller[_0x9b0b('0xb')]);router[_0x9b0b('0x9')](_0x9b0b('0xc'),auth[_0x9b0b('0xa')](),controller['show']);router['get'](_0x9b0b('0xd'),auth[_0x9b0b('0xa')](),controller[_0x9b0b('0xe')]);router[_0x9b0b('0x9')](_0x9b0b('0xf'),auth[_0x9b0b('0xa')](),controller['getFields']);router[_0x9b0b('0x10')]('/',auth[_0x9b0b('0xa')](),controller[_0x9b0b('0x11')]);router[_0x9b0b('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x9b0b('0x12')]);router['put'](_0x9b0b('0xc'),auth['isAuthenticated'](),controller[_0x9b0b('0x13')]);router[_0x9b0b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9b0b('0x15')]);module[_0x9b0b('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 01028e5..e598603 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 _0x87ac=['HelpDesk','sequelize','STRING'];(function(_0x5268d4,_0x3c84b2){var _0x5eddb9=function(_0x40d176){while(--_0x40d176){_0x5268d4['push'](_0x5268d4['shift']());}};_0x5eddb9(++_0x3c84b2);}(_0x87ac,0x115));var _0xc87a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x87ac[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xc87a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc87a('0x1')]},'username':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![],'defaultValue':_0xc87a('0x2')},'remoteUri':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x58cf=['HelpDesk','sequelize','exports','STRING'];(function(_0x3d0fcc,_0x31174f){var _0x578c5b=function(_0x237680){while(--_0x237680){_0x3d0fcc['push'](_0x3d0fcc['shift']());}};_0x578c5b(++_0x31174f);}(_0x58cf,0x1dd));var _0xf58c=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x58cf[_0x20b29c];return _0x20d81b;};'use strict';var Sequelize=require(_0xf58c('0x0'));module[_0xf58c('0x1')]={'name':{'type':Sequelize[_0xf58c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf58c('0x2')]},'username':{'type':Sequelize[_0xf58c('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf58c('0x3')},'remoteUri':{'type':Sequelize[_0xf58c('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 48c4317..a20192f 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 _0xf6bf=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf6bf,0xe6));var _0xff6b=function(_0x3df6b5,_0x461ce2){_0x3df6b5=_0x3df6b5-0x0;var _0x1246f1=_0xf6bf[_0x3df6b5];return _0x1246f1;};'use strict';var emlformat=require(_0xff6b('0x0'));var rimraf=require(_0xff6b('0x1'));var zipdir=require(_0xff6b('0x2'));var jsonpatch=require(_0xff6b('0x3'));var rp=require('request-promise');var moment=require(_0xff6b('0x4'));var BPromise=require(_0xff6b('0x5'));var Mustache=require('mustache');var util=require(_0xff6b('0x6'));var path=require(_0xff6b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff6b('0x8'));var fs=require('fs');var fs_extra=require(_0xff6b('0x9'));var _=require(_0xff6b('0xa'));var squel=require(_0xff6b('0xb'));var crypto=require(_0xff6b('0xc'));var jsforce=require(_0xff6b('0xd'));var deskjs=require(_0xff6b('0xe'));var toCsv=require(_0xff6b('0xf'));var querystring=require('querystring');var Papa=require(_0xff6b('0x10'));var Redis=require('ioredis');var authService=require(_0xff6b('0x11'));var qs=require(_0xff6b('0x12'));var as=require(_0xff6b('0x13'));var hardwareService=require(_0xff6b('0x14'));var logger=require(_0xff6b('0x15'))('api');var utils=require(_0xff6b('0x16'));var config=require(_0xff6b('0x17'));var licenseUtil=require(_0xff6b('0x18'));var db=require(_0xff6b('0x19'))['db'];var integrations=require(_0xff6b('0x1a'));function respondWithStatusCode(_0x4b1d61,_0x44588e){_0x44588e=_0x44588e||0xcc;return function(_0x452693){if(_0x452693){return _0x4b1d61[_0xff6b('0x1b')](_0x44588e);}return _0x4b1d61['status'](_0x44588e)[_0xff6b('0x1c')]();};}function respondWithResult(_0x2ef323,_0x56a17f){_0x56a17f=_0x56a17f||0xc8;return function(_0x564557){if(_0x564557){return _0x2ef323[_0xff6b('0x1d')](_0x56a17f)[_0xff6b('0x1e')](_0x564557);}};}function respondWithFilteredResult(_0x5c5295,_0x1c87ad){return function(_0x3fdc6d){if(_0x3fdc6d){var _0x5b7187=typeof _0x1c87ad[_0xff6b('0x1f')]===_0xff6b('0x20')&&typeof _0x1c87ad[_0xff6b('0x21')]==='undefined';var _0x197942=_0x3fdc6d[_0xff6b('0x22')];var _0x118547=_0x5b7187?0x0:_0x1c87ad['offset'];var _0x158900=_0x5b7187?_0x3fdc6d[_0xff6b('0x22')]:_0x1c87ad['offset']+_0x1c87ad[_0xff6b('0x21')];var _0x686d1f;if(_0x158900>=_0x197942){_0x158900=_0x197942;_0x686d1f=0xc8;}else{_0x686d1f=0xce;}_0x5c5295[_0xff6b('0x1d')](_0x686d1f);return _0x5c5295[_0xff6b('0x23')](_0xff6b('0x24'),_0x118547+'-'+_0x158900+'/'+_0x197942)[_0xff6b('0x1e')](_0x3fdc6d);}return null;};}function patchUpdates(_0x16d6b4){return function(_0xa01936){try{jsonpatch[_0xff6b('0x25')](_0xa01936,_0x16d6b4,!![]);}catch(_0x267530){return BPromise['reject'](_0x267530);}return _0xa01936[_0xff6b('0x26')]();};}function saveUpdates(_0x225508,_0x304fad){return function(_0x5a8d13){if(_0x5a8d13){return _0x5a8d13[_0xff6b('0x27')](_0x225508)[_0xff6b('0x28')](function(_0x4a2638){return _0x4a2638;});}return null;};}function removeEntity(_0x3ed040,_0x12f12d){return function(_0x3d704c){if(_0x3d704c){return _0x3d704c[_0xff6b('0x29')]()[_0xff6b('0x28')](function(){_0x3ed040[_0xff6b('0x1d')](0xcc)[_0xff6b('0x1c')]();});}};}function handleEntityNotFound(_0x1c6051,_0x94af8c){return function(_0x3cd2ee){if(!_0x3cd2ee){_0x1c6051[_0xff6b('0x1b')](0x194);}return _0x3cd2ee;};}function handleError(_0x306ae3,_0x554ce7){_0x554ce7=_0x554ce7||0x1f4;return function(_0x470c85){logger[_0xff6b('0x2a')](_0x470c85[_0xff6b('0x2b')]);if(_0x470c85['name']){delete _0x470c85[_0xff6b('0x2c')];}_0x306ae3[_0xff6b('0x1d')](_0x554ce7)[_0xff6b('0x2d')](_0x470c85);};}exports['index']=function(_0x56a657,_0x2f1d9b){var _0x5ef1e6={},_0x15c64e={},_0x4f58ec={'count':0x0,'rows':[]};var _0x4d7c67=_[_0xff6b('0x2e')](db[_0xff6b('0x2f')][_0xff6b('0x30')],function(_0x9f8bd4){return{'name':_0x9f8bd4[_0xff6b('0x31')],'type':_0x9f8bd4[_0xff6b('0x32')][_0xff6b('0x33')]};});_0x15c64e['model']=_[_0xff6b('0x2e')](_0x4d7c67,'name');_0x15c64e[_0xff6b('0x34')]=_[_0xff6b('0x35')](_0x56a657[_0xff6b('0x34')]);_0x15c64e[_0xff6b('0x36')]=_[_0xff6b('0x37')](_0x15c64e[_0xff6b('0x38')],_0x15c64e[_0xff6b('0x34')]);_0x5ef1e6[_0xff6b('0x39')]=_[_0xff6b('0x37')](_0x15c64e[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x56a657[_0xff6b('0x34')]['fields']));_0x5ef1e6['attributes']=_0x5ef1e6[_0xff6b('0x39')]['length']?_0x5ef1e6[_0xff6b('0x39')]:_0x15c64e['model'];if(!_0x56a657[_0xff6b('0x34')][_0xff6b('0x3b')]('nolimit')){_0x5ef1e6[_0xff6b('0x21')]=qs[_0xff6b('0x21')](_0x56a657[_0xff6b('0x34')][_0xff6b('0x21')]);_0x5ef1e6[_0xff6b('0x1f')]=qs[_0xff6b('0x1f')](_0x56a657[_0xff6b('0x34')][_0xff6b('0x1f')]);}_0x5ef1e6[_0xff6b('0x3c')]=qs[_0xff6b('0x3d')](_0x56a657['query'][_0xff6b('0x3d')]);_0x5ef1e6[_0xff6b('0x3e')]=qs[_0xff6b('0x36')](_[_0xff6b('0x3f')](_0x56a657['query'],_0x15c64e['filters']),_0x4d7c67);if(_0x56a657[_0xff6b('0x34')][_0xff6b('0x40')]){_0x5ef1e6[_0xff6b('0x3e')]=_[_0xff6b('0x41')](_0x5ef1e6[_0xff6b('0x3e')],{'$or':_[_0xff6b('0x2e')](_0x4d7c67,function(_0x3002ef){if(_0x3002ef['type']!==_0xff6b('0x42')){var _0x4e6756={};_0x4e6756[_0x3002ef[_0xff6b('0x2c')]]={'$like':'%'+_0x56a657['query']['filter']+'%'};return _0x4e6756;}})});}_0x5ef1e6=_[_0xff6b('0x41')]({},_0x5ef1e6,_0x56a657[_0xff6b('0x43')]);var _0x34415c={'where':_0x5ef1e6['where']};return db['VtigerAccount'][_0xff6b('0x22')](_0x34415c)[_0xff6b('0x28')](function(_0x1dcb8a){_0x4f58ec[_0xff6b('0x22')]=_0x1dcb8a;if(_0x56a657[_0xff6b('0x34')][_0xff6b('0x44')]){_0x5ef1e6[_0xff6b('0x45')]=[{'all':!![]}];}return db[_0xff6b('0x2f')]['findAll'](_0x5ef1e6);})['then'](function(_0x35ab34){_0x4f58ec[_0xff6b('0x46')]=_0x35ab34;return _0x4f58ec;})[_0xff6b('0x28')](respondWithFilteredResult(_0x2f1d9b,_0x5ef1e6))[_0xff6b('0x47')](handleError(_0x2f1d9b,null));};exports['show']=function(_0x58fa63,_0x18962f){var _0x55e401={'raw':![],'where':{'id':_0x58fa63[_0xff6b('0x48')]['id']}},_0x4fd7c9={};_0x4fd7c9[_0xff6b('0x38')]=_['keys'](db['VtigerAccount'][_0xff6b('0x30')]);_0x4fd7c9[_0xff6b('0x34')]=_[_0xff6b('0x35')](_0x58fa63[_0xff6b('0x34')]);_0x4fd7c9[_0xff6b('0x36')]=_[_0xff6b('0x37')](_0x4fd7c9['model'],_0x4fd7c9[_0xff6b('0x34')]);_0x55e401[_0xff6b('0x39')]=_['intersection'](_0x4fd7c9[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x58fa63['query'][_0xff6b('0x3a')]));_0x55e401[_0xff6b('0x39')]=_0x55e401['attributes'][_0xff6b('0x49')]?_0x55e401[_0xff6b('0x39')]:_0x4fd7c9[_0xff6b('0x38')];if(_0x58fa63[_0xff6b('0x34')][_0xff6b('0x44')]){_0x55e401[_0xff6b('0x45')]=[{'all':!![]}];}_0x55e401=_[_0xff6b('0x41')]({},_0x55e401,_0x58fa63['options']);return db[_0xff6b('0x2f')][_0xff6b('0x4a')](_0x55e401)[_0xff6b('0x28')](handleEntityNotFound(_0x18962f,null))[_0xff6b('0x28')](respondWithResult(_0x18962f,null))['catch'](handleError(_0x18962f,null));};exports[_0xff6b('0x4b')]=function(_0x5d8b70,_0x16c38c){return db[_0xff6b('0x2f')][_0xff6b('0x4b')](_0x5d8b70['body'],{})[_0xff6b('0x28')](respondWithResult(_0x16c38c,0xc9))[_0xff6b('0x47')](handleError(_0x16c38c,null));};exports[_0xff6b('0x27')]=function(_0x55bb96,_0x471bb7){if(_0x55bb96[_0xff6b('0x4c')]['id']){delete _0x55bb96[_0xff6b('0x4c')]['id'];}return db[_0xff6b('0x2f')][_0xff6b('0x4a')]({'where':{'id':_0x55bb96[_0xff6b('0x48')]['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x471bb7,null))['then'](saveUpdates(_0x55bb96[_0xff6b('0x4c')],null))[_0xff6b('0x28')](respondWithResult(_0x471bb7,null))['catch'](handleError(_0x471bb7,null));};exports[_0xff6b('0x29')]=function(_0x1662ac,_0x941d74){return db[_0xff6b('0x2f')]['find']({'where':{'id':_0x1662ac[_0xff6b('0x48')]['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x941d74,null))[_0xff6b('0x28')](removeEntity(_0x941d74,null))['catch'](handleError(_0x941d74,null));};exports[_0xff6b('0x4d')]=function(_0x1f4f65,_0x5e25be,_0x50227c){var _0x4d9a1c={};var _0x23bbc2={};var _0x372ea0;var _0x2314c8;return db[_0xff6b('0x2f')][_0xff6b('0x4e')]({'where':{'id':_0x1f4f65[_0xff6b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e25be,null))[_0xff6b('0x28')](function(_0x332053){if(_0x332053){_0x372ea0=_0x332053;_0x23bbc2['model']=_[_0xff6b('0x35')](db[_0xff6b('0x4f')][_0xff6b('0x30')]);_0x23bbc2['query']=_[_0xff6b('0x35')](_0x1f4f65[_0xff6b('0x34')]);_0x23bbc2['filters']=_['intersection'](_0x23bbc2[_0xff6b('0x38')],_0x23bbc2[_0xff6b('0x34')]);_0x4d9a1c[_0xff6b('0x39')]=_[_0xff6b('0x37')](_0x23bbc2[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x1f4f65[_0xff6b('0x34')]['fields']));_0x4d9a1c['attributes']=_0x4d9a1c['attributes'][_0xff6b('0x49')]?_0x4d9a1c[_0xff6b('0x39')]:_0x23bbc2[_0xff6b('0x38')];_0x4d9a1c[_0xff6b('0x3c')]=qs['sort'](_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x3d')]);_0x4d9a1c[_0xff6b('0x3e')]=qs['filters'](_[_0xff6b('0x3f')](_0x1f4f65['query'],_0x23bbc2[_0xff6b('0x36')]));if(_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x40')]){_0x4d9a1c[_0xff6b('0x3e')]=_[_0xff6b('0x41')](_0x4d9a1c[_0xff6b('0x3e')],{'$or':_[_0xff6b('0x2e')](_0x4d9a1c[_0xff6b('0x39')],function(_0xdba0a9){var _0x996089={};_0x996089[_0xdba0a9]={'$like':'%'+_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x40')]+'%'};return _0x996089;})});}_0x4d9a1c=_[_0xff6b('0x41')]({},_0x4d9a1c,_0x1f4f65[_0xff6b('0x43')]);return _0x372ea0['getConfigurations'](_0x4d9a1c);}})['then'](function(_0x3d60d6){if(_0x3d60d6){_0x2314c8=_0x3d60d6[_0xff6b('0x49')];if(!_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x3b')]('nolimit')){_0x4d9a1c[_0xff6b('0x21')]=qs[_0xff6b('0x21')](_0x1f4f65['query'][_0xff6b('0x21')]);_0x4d9a1c[_0xff6b('0x1f')]=qs[_0xff6b('0x1f')](_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x1f')]);}return _0x372ea0[_0xff6b('0x4d')](_0x4d9a1c);}})['then'](function(_0xfc007c){if(_0xfc007c){return _0xfc007c?{'count':_0x2314c8,'rows':_0xfc007c}:null;}})['then'](respondWithResult(_0x5e25be,null))[_0xff6b('0x47')](handleError(_0x5e25be,null));};exports[_0xff6b('0x50')]=function(_0x354386,_0x1b8c6e,_0x2adbf9){if(_0x354386[_0xff6b('0x4c')]['id']){delete _0x354386[_0xff6b('0x4c')]['id'];}return db['VtigerAccount'][_0xff6b('0x4e')]({'where':{'id':_0x354386['params']['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x1b8c6e,null))[_0xff6b('0x28')](function(_0x48c0d9){if(_0x48c0d9){_0x354386['body'][_0xff6b('0x51')]=_0x48c0d9['id'];_0x354386['body'][_0xff6b('0x52')]=integrations['getSubjects'](_0x354386[_0xff6b('0x4c')][_0xff6b('0x53')],_0x354386[_0xff6b('0x4c')][_0xff6b('0x32')]);_0x354386[_0xff6b('0x4c')][_0xff6b('0x54')]=integrations[_0xff6b('0x55')](_0x354386[_0xff6b('0x4c')][_0xff6b('0x53')],_0x354386[_0xff6b('0x4c')]['type']);return db[_0xff6b('0x4f')][_0xff6b('0x4b')](_0x354386[_0xff6b('0x4c')],{'include':[{'model':db[_0xff6b('0x56')],'as':_0xff6b('0x52')},{'model':db[_0xff6b('0x56')],'as':_0xff6b('0x54')}]});}return null;})['then'](respondWithResult(_0x1b8c6e,null))[_0xff6b('0x47')](handleError(_0x1b8c6e,null));};var md5=require(_0xff6b('0x57'));exports[_0xff6b('0x58')]=function(_0x4b0153,_0x5f3202,_0x3c3a75){var _0x232e8a=null;var _0x3c17b3=null;var _0x32ac7c=null;var _0x42edff=null;var _0x5686a9='';return db['VtigerAccount'][_0xff6b('0x4e')]({'where':{'id':_0x4b0153['params']['id']},'attributes':['id',_0xff6b('0x2c'),_0xff6b('0x59'),_0xff6b('0x5a'),_0xff6b('0x5b'),_0xff6b('0x5c'),_0xff6b('0x5d'),'accessKey']})['then'](handleEntityNotFound(_0x5f3202,null))[_0xff6b('0x28')](function(_0x4084b5){if(_0x4084b5){_0x232e8a=_0x4084b5['username'];_0x3c17b3=_0x4084b5[_0xff6b('0x5e')];_0x32ac7c=_0x4084b5[_0xff6b('0x5b')];_0x5686a9=_0x4084b5[_0xff6b('0x5c')];var _0x5e88dd=_0x5686a9['slice'](-0x1);if(_0x5e88dd==='/'){_0x5686a9=_0x5686a9['substring'](0x0,_0x5686a9[_0xff6b('0x5f')](_0x5e88dd));}_0x42edff=util['format'](_0xff6b('0x60'),_0x5686a9);var _0x230691={'method':_0xff6b('0x61'),'uri':_0x42edff,'qs':{'operation':_0xff6b('0x62'),'username':_0x4084b5[_0xff6b('0x59')]},'json':!![]};return rp(_0x230691);}})[_0xff6b('0x28')](function(_0x4604ff){if(_0x4604ff['success']){var _0x8e1d45={'method':_0xff6b('0x63'),'uri':_0x42edff,'form':{'operation':_0xff6b('0x64'),'username':_0x232e8a,'accessKey':md5(_0x4604ff[_0xff6b('0x65')][_0xff6b('0x66')]+_0x3c17b3)},'json':!![]};return rp(_0x8e1d45);}})['then'](function(_0x3f8e9d){if(_0x3f8e9d[_0xff6b('0x67')]){var _0x393288={'method':'GET','uri':_0x42edff,'qs':{'operation':'describe','username':_0x232e8a,'sessionName':_0x3f8e9d[_0xff6b('0x65')][_0xff6b('0x68')],'elementType':_0x32ac7c},'json':!![]};return rp(_0x393288);}})['then'](function(_0x2178e8){if(_0x2178e8[_0xff6b('0x67')]){var _0x5a2f75=[_0xff6b('0x69'),_0xff6b('0x6a'),_0xff6b('0x6b')];_[_0xff6b('0x6c')](_0x2178e8['result']['fields'],function(_0x247138){return _0x5a2f75['includes'](_0x247138[_0xff6b('0x32')][_0xff6b('0x2c')]);});_['remove'](_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')],function(_0x6a6f71){return _0x6a6f71['editable']===_0xff6b('0x6d');});return{'count':_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')][_0xff6b('0x49')],'rows':_[_0xff6b('0x2e')](_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')],function(_0x10f08e){return{'id':_0x10f08e[_0xff6b('0x2c')],'name':_0x10f08e[_0xff6b('0x6e')],'custom':_['startsWith'](_0x10f08e[_0xff6b('0x2c')],_0xff6b('0x6f'))?!![]:![],'options':_0x10f08e['type'][_0xff6b('0x2c')]==='picklist'&&_0x10f08e[_0xff6b('0x32')][_0xff6b('0x70')][_0xff6b('0x49')]>0x0?_[_0xff6b('0x2e')](_0x10f08e[_0xff6b('0x32')][_0xff6b('0x70')],function(_0x741019){return{'name':_0x741019[_0xff6b('0x6e')],'value':_0x741019[_0xff6b('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x5f3202,null))[_0xff6b('0x47')](function(_0x7aedf0){console[_0xff6b('0x72')](_0xff6b('0x73')+_0x7aedf0);var _0x4e731c=_0x4b0153[_0xff6b('0x34')][_0xff6b('0x74')]?0x1f4:_0x7aedf0[_0xff6b('0x75')]||0x1f4;logger[_0xff6b('0x2a')](_0xff6b('0x76'),_0xff6b('0x58'),_0x4e731c,JSON[_0xff6b('0x77')](_0x7aedf0));delete _0x7aedf0[_0xff6b('0x2c')];if(_0x4e731c===0x191){_0x4e731c=0x190;}_0x5f3202[_0xff6b('0x1d')](_0x4e731c)[_0xff6b('0x2d')](_0x4b0153[_0xff6b('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x7aedf0[_0xff6b('0x75')]}:_0x7aedf0);});}; \ No newline at end of file +var _0x2167=['Content-Range','apply','update','then','destroy','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','length','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body','getConfigurations','findOne','order','sort','pick','addConfiguration','getSubjects','channel','type','Descriptions','create','VtigerField','Subjects','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','owner','includes','editable','label','startsWith','cf_','picklistValues','log','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','set'];(function(_0x9ace37,_0x4d1159){var _0x23ecc0=function(_0xda11a){while(--_0xda11a){_0x9ace37['push'](_0x9ace37['shift']());}};_0x23ecc0(++_0x4d1159);}(_0x2167,0x136));var _0x7216=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x2167[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0x7216('0x0'));var rimraf=require(_0x7216('0x1'));var zipdir=require(_0x7216('0x2'));var jsonpatch=require(_0x7216('0x3'));var rp=require(_0x7216('0x4'));var moment=require(_0x7216('0x5'));var BPromise=require(_0x7216('0x6'));var Mustache=require('mustache');var util=require(_0x7216('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7216('0x8'));var ejs=require(_0x7216('0x9'));var fs=require('fs');var fs_extra=require(_0x7216('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7216('0xb'));var jsforce=require(_0x7216('0xc'));var deskjs=require(_0x7216('0xd'));var toCsv=require(_0x7216('0x8'));var querystring=require(_0x7216('0xe'));var Papa=require(_0x7216('0xf'));var Redis=require(_0x7216('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7216('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7216('0x12'));var logger=require(_0x7216('0x13'))('api');var utils=require(_0x7216('0x14'));var config=require(_0x7216('0x15'));var licenseUtil=require(_0x7216('0x16'));var db=require(_0x7216('0x17'))['db'];var integrations=require(_0x7216('0x18'));function respondWithStatusCode(_0x608017,_0x224cda){_0x224cda=_0x224cda||0xcc;return function(_0x2d3041){if(_0x2d3041){return _0x608017[_0x7216('0x19')](_0x224cda);}return _0x608017['status'](_0x224cda)[_0x7216('0x1a')]();};}function respondWithResult(_0x333b52,_0x2a37e3){_0x2a37e3=_0x2a37e3||0xc8;return function(_0x13942d){if(_0x13942d){return _0x333b52[_0x7216('0x1b')](_0x2a37e3)['json'](_0x13942d);}};}function respondWithFilteredResult(_0x9dee89,_0x4aea53){return function(_0x4e13f1){if(_0x4e13f1){var _0x4c0c58=typeof _0x4aea53[_0x7216('0x1c')]==='undefined'&&typeof _0x4aea53[_0x7216('0x1d')]==='undefined';var _0xe1cbe6=_0x4e13f1[_0x7216('0x1e')];var _0x54a202=_0x4c0c58?0x0:_0x4aea53[_0x7216('0x1c')];var _0x1f189d=_0x4c0c58?_0x4e13f1['count']:_0x4aea53[_0x7216('0x1c')]+_0x4aea53[_0x7216('0x1d')];var _0x292bdf;if(_0x1f189d>=_0xe1cbe6){_0x1f189d=_0xe1cbe6;_0x292bdf=0xc8;}else{_0x292bdf=0xce;}_0x9dee89[_0x7216('0x1b')](_0x292bdf);return _0x9dee89[_0x7216('0x1f')](_0x7216('0x20'),_0x54a202+'-'+_0x1f189d+'/'+_0xe1cbe6)['json'](_0x4e13f1);}return null;};}function patchUpdates(_0x4528d2){return function(_0x4ce384){try{jsonpatch[_0x7216('0x21')](_0x4ce384,_0x4528d2,!![]);}catch(_0x39065f){return BPromise['reject'](_0x39065f);}return _0x4ce384['save']();};}function saveUpdates(_0x22b2d5,_0x2162b2){return function(_0x540882){if(_0x540882){return _0x540882[_0x7216('0x22')](_0x22b2d5)[_0x7216('0x23')](function(_0x4996d7){return _0x4996d7;});}return null;};}function removeEntity(_0x5c38fe,_0x2858ba){return function(_0x5565e7){if(_0x5565e7){return _0x5565e7[_0x7216('0x24')]()[_0x7216('0x23')](function(){_0x5c38fe[_0x7216('0x1b')](0xcc)[_0x7216('0x1a')]();});}};}function handleEntityNotFound(_0x32fd39,_0x16959b){return function(_0x4be723){if(!_0x4be723){_0x32fd39[_0x7216('0x19')](0x194);}return _0x4be723;};}function handleError(_0x410488,_0x4b7aef){_0x4b7aef=_0x4b7aef||0x1f4;return function(_0x2541f0){logger['error'](_0x2541f0['stack']);if(_0x2541f0[_0x7216('0x25')]){delete _0x2541f0['name'];}_0x410488['status'](_0x4b7aef)[_0x7216('0x26')](_0x2541f0);};}exports['index']=function(_0x2896a2,_0x2012c2){var _0x483dc4={},_0x34ef07={},_0x1942ed={'count':0x0,'rows':[]};var _0x7cc112=_[_0x7216('0x27')](db[_0x7216('0x28')][_0x7216('0x29')],function(_0x59c63f){return{'name':_0x59c63f[_0x7216('0x2a')],'type':_0x59c63f['type'][_0x7216('0x2b')]};});_0x34ef07[_0x7216('0x2c')]=_[_0x7216('0x27')](_0x7cc112,_0x7216('0x25'));_0x34ef07['query']=_[_0x7216('0x2d')](_0x2896a2[_0x7216('0x2e')]);_0x34ef07[_0x7216('0x2f')]=_['intersection'](_0x34ef07[_0x7216('0x2c')],_0x34ef07[_0x7216('0x2e')]);_0x483dc4[_0x7216('0x30')]=_['intersection'](_0x34ef07[_0x7216('0x2c')],qs['fields'](_0x2896a2[_0x7216('0x2e')][_0x7216('0x31')]));_0x483dc4[_0x7216('0x30')]=_0x483dc4[_0x7216('0x30')][_0x7216('0x32')]?_0x483dc4[_0x7216('0x30')]:_0x34ef07[_0x7216('0x2c')];if(!_0x2896a2[_0x7216('0x2e')]['hasOwnProperty'](_0x7216('0x33'))){_0x483dc4[_0x7216('0x1d')]=qs[_0x7216('0x1d')](_0x2896a2[_0x7216('0x2e')][_0x7216('0x1d')]);_0x483dc4['offset']=qs['offset'](_0x2896a2['query']['offset']);}_0x483dc4['order']=qs['sort'](_0x2896a2['query']['sort']);_0x483dc4[_0x7216('0x34')]=qs[_0x7216('0x2f')](_['pick'](_0x2896a2[_0x7216('0x2e')],_0x34ef07['filters']),_0x7cc112);if(_0x2896a2['query']['filter']){_0x483dc4['where']=_[_0x7216('0x35')](_0x483dc4[_0x7216('0x34')],{'$or':_['map'](_0x7cc112,function(_0x4bb3cc){if(_0x4bb3cc['type']!==_0x7216('0x36')){var _0x2aebec={};_0x2aebec[_0x4bb3cc['name']]={'$like':'%'+_0x2896a2[_0x7216('0x2e')][_0x7216('0x37')]+'%'};return _0x2aebec;}})});}_0x483dc4=_[_0x7216('0x35')]({},_0x483dc4,_0x2896a2[_0x7216('0x38')]);var _0x277ddb={'where':_0x483dc4['where']};return db[_0x7216('0x28')][_0x7216('0x1e')](_0x277ddb)[_0x7216('0x23')](function(_0x217373){_0x1942ed[_0x7216('0x1e')]=_0x217373;if(_0x2896a2[_0x7216('0x2e')][_0x7216('0x39')]){_0x483dc4[_0x7216('0x3a')]=[{'all':!![]}];}return db[_0x7216('0x28')][_0x7216('0x3b')](_0x483dc4);})[_0x7216('0x23')](function(_0x5d5b81){_0x1942ed[_0x7216('0x3c')]=_0x5d5b81;return _0x1942ed;})[_0x7216('0x23')](respondWithFilteredResult(_0x2012c2,_0x483dc4))[_0x7216('0x3d')](handleError(_0x2012c2,null));};exports[_0x7216('0x3e')]=function(_0x37eb77,_0x2145c5){var _0x30da43={'raw':![],'where':{'id':_0x37eb77[_0x7216('0x3f')]['id']}},_0x1c6fbc={};_0x1c6fbc[_0x7216('0x2c')]=_[_0x7216('0x2d')](db[_0x7216('0x28')][_0x7216('0x29')]);_0x1c6fbc['query']=_[_0x7216('0x2d')](_0x37eb77[_0x7216('0x2e')]);_0x1c6fbc[_0x7216('0x2f')]=_[_0x7216('0x40')](_0x1c6fbc[_0x7216('0x2c')],_0x1c6fbc['query']);_0x30da43['attributes']=_[_0x7216('0x40')](_0x1c6fbc[_0x7216('0x2c')],qs[_0x7216('0x31')](_0x37eb77[_0x7216('0x2e')][_0x7216('0x31')]));_0x30da43[_0x7216('0x30')]=_0x30da43[_0x7216('0x30')][_0x7216('0x32')]?_0x30da43[_0x7216('0x30')]:_0x1c6fbc[_0x7216('0x2c')];if(_0x37eb77[_0x7216('0x2e')][_0x7216('0x39')]){_0x30da43[_0x7216('0x3a')]=[{'all':!![]}];}_0x30da43=_[_0x7216('0x35')]({},_0x30da43,_0x37eb77[_0x7216('0x38')]);return db[_0x7216('0x28')][_0x7216('0x41')](_0x30da43)[_0x7216('0x23')](handleEntityNotFound(_0x2145c5,null))[_0x7216('0x23')](respondWithResult(_0x2145c5,null))[_0x7216('0x3d')](handleError(_0x2145c5,null));};exports['create']=function(_0x2661c4,_0xf08522){return db['VtigerAccount']['create'](_0x2661c4[_0x7216('0x42')],{})[_0x7216('0x23')](respondWithResult(_0xf08522,0xc9))[_0x7216('0x3d')](handleError(_0xf08522,null));};exports['update']=function(_0x3c0d9e,_0x587501){if(_0x3c0d9e['body']['id']){delete _0x3c0d9e[_0x7216('0x42')]['id'];}return db[_0x7216('0x28')]['find']({'where':{'id':_0x3c0d9e['params']['id']}})['then'](handleEntityNotFound(_0x587501,null))[_0x7216('0x23')](saveUpdates(_0x3c0d9e['body'],null))['then'](respondWithResult(_0x587501,null))[_0x7216('0x3d')](handleError(_0x587501,null));};exports['destroy']=function(_0x1b797f,_0x3e1985){return db[_0x7216('0x28')][_0x7216('0x41')]({'where':{'id':_0x1b797f[_0x7216('0x3f')]['id']}})[_0x7216('0x23')](handleEntityNotFound(_0x3e1985,null))[_0x7216('0x23')](removeEntity(_0x3e1985,null))[_0x7216('0x3d')](handleError(_0x3e1985,null));};exports[_0x7216('0x43')]=function(_0x2358ca,_0x4abf43,_0x3ba12a){var _0x904dde={};var _0x4f9dcc={};var _0x16a2e8;var _0x523bf9;return db[_0x7216('0x28')][_0x7216('0x44')]({'where':{'id':_0x2358ca[_0x7216('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4abf43,null))['then'](function(_0x8801c6){if(_0x8801c6){_0x16a2e8=_0x8801c6;_0x4f9dcc[_0x7216('0x2c')]=_[_0x7216('0x2d')](db['VtigerConfiguration'][_0x7216('0x29')]);_0x4f9dcc[_0x7216('0x2e')]=_[_0x7216('0x2d')](_0x2358ca[_0x7216('0x2e')]);_0x4f9dcc['filters']=_[_0x7216('0x40')](_0x4f9dcc[_0x7216('0x2c')],_0x4f9dcc[_0x7216('0x2e')]);_0x904dde[_0x7216('0x30')]=_[_0x7216('0x40')](_0x4f9dcc[_0x7216('0x2c')],qs[_0x7216('0x31')](_0x2358ca[_0x7216('0x2e')]['fields']));_0x904dde['attributes']=_0x904dde[_0x7216('0x30')][_0x7216('0x32')]?_0x904dde[_0x7216('0x30')]:_0x4f9dcc[_0x7216('0x2c')];_0x904dde[_0x7216('0x45')]=qs[_0x7216('0x46')](_0x2358ca[_0x7216('0x2e')][_0x7216('0x46')]);_0x904dde[_0x7216('0x34')]=qs['filters'](_[_0x7216('0x47')](_0x2358ca[_0x7216('0x2e')],_0x4f9dcc[_0x7216('0x2f')]));if(_0x2358ca[_0x7216('0x2e')][_0x7216('0x37')]){_0x904dde[_0x7216('0x34')]=_[_0x7216('0x35')](_0x904dde[_0x7216('0x34')],{'$or':_['map'](_0x904dde[_0x7216('0x30')],function(_0x21fff5){var _0x2c3b4d={};_0x2c3b4d[_0x21fff5]={'$like':'%'+_0x2358ca['query'][_0x7216('0x37')]+'%'};return _0x2c3b4d;})});}_0x904dde=_[_0x7216('0x35')]({},_0x904dde,_0x2358ca['options']);return _0x16a2e8[_0x7216('0x43')](_0x904dde);}})[_0x7216('0x23')](function(_0x30a6f8){if(_0x30a6f8){_0x523bf9=_0x30a6f8[_0x7216('0x32')];if(!_0x2358ca[_0x7216('0x2e')]['hasOwnProperty'](_0x7216('0x33'))){_0x904dde['limit']=qs[_0x7216('0x1d')](_0x2358ca[_0x7216('0x2e')]['limit']);_0x904dde[_0x7216('0x1c')]=qs[_0x7216('0x1c')](_0x2358ca[_0x7216('0x2e')][_0x7216('0x1c')]);}return _0x16a2e8[_0x7216('0x43')](_0x904dde);}})[_0x7216('0x23')](function(_0x51a998){if(_0x51a998){return _0x51a998?{'count':_0x523bf9,'rows':_0x51a998}:null;}})[_0x7216('0x23')](respondWithResult(_0x4abf43,null))['catch'](handleError(_0x4abf43,null));};exports[_0x7216('0x48')]=function(_0x58e783,_0x4038bb,_0x404f5e){if(_0x58e783[_0x7216('0x42')]['id']){delete _0x58e783[_0x7216('0x42')]['id'];}return db[_0x7216('0x28')]['findOne']({'where':{'id':_0x58e783[_0x7216('0x3f')]['id']}})[_0x7216('0x23')](handleEntityNotFound(_0x4038bb,null))[_0x7216('0x23')](function(_0x270a51){if(_0x270a51){_0x58e783[_0x7216('0x42')]['AccountId']=_0x270a51['id'];_0x58e783[_0x7216('0x42')]['Subjects']=integrations[_0x7216('0x49')](_0x58e783[_0x7216('0x42')][_0x7216('0x4a')],_0x58e783['body'][_0x7216('0x4b')]);_0x58e783[_0x7216('0x42')][_0x7216('0x4c')]=integrations['getDescriptions'](_0x58e783['body'][_0x7216('0x4a')],_0x58e783[_0x7216('0x42')][_0x7216('0x4b')]);return db['VtigerConfiguration'][_0x7216('0x4d')](_0x58e783[_0x7216('0x42')],{'include':[{'model':db[_0x7216('0x4e')],'as':_0x7216('0x4f')},{'model':db[_0x7216('0x4e')],'as':_0x7216('0x4c')}]});}return null;})['then'](respondWithResult(_0x4038bb,null))['catch'](handleError(_0x4038bb,null));};var md5=require('md5');exports['getFields']=function(_0x2a15be,_0xed3777,_0x1782e8){var _0x721fbb=null;var _0x4919bc=null;var _0x236441=null;var _0x367b1c=null;var _0x319ac8='';return db['VtigerAccount'][_0x7216('0x44')]({'where':{'id':_0x2a15be[_0x7216('0x3f')]['id']},'attributes':['id',_0x7216('0x25'),_0x7216('0x50'),_0x7216('0x51'),_0x7216('0x52'),_0x7216('0x53'),_0x7216('0x54'),'accessKey']})[_0x7216('0x23')](handleEntityNotFound(_0xed3777,null))[_0x7216('0x23')](function(_0x4c6866){if(_0x4c6866){_0x721fbb=_0x4c6866[_0x7216('0x50')];_0x4919bc=_0x4c6866[_0x7216('0x55')];_0x236441=_0x4c6866[_0x7216('0x52')];_0x319ac8=_0x4c6866[_0x7216('0x53')];var _0x259f2e=_0x319ac8['slice'](-0x1);if(_0x259f2e==='/'){_0x319ac8=_0x319ac8[_0x7216('0x56')](0x0,_0x319ac8[_0x7216('0x57')](_0x259f2e));}_0x367b1c=util[_0x7216('0x58')](_0x7216('0x59'),_0x319ac8);var _0x3144c4={'method':'GET','uri':_0x367b1c,'qs':{'operation':_0x7216('0x5a'),'username':_0x4c6866['username']},'json':!![]};return rp(_0x3144c4);}})[_0x7216('0x23')](function(_0x481ff1){if(_0x481ff1[_0x7216('0x5b')]){var _0x90e63a={'method':_0x7216('0x5c'),'uri':_0x367b1c,'form':{'operation':_0x7216('0x5d'),'username':_0x721fbb,'accessKey':md5(_0x481ff1[_0x7216('0x5e')]['token']+_0x4919bc)},'json':!![]};return rp(_0x90e63a);}})[_0x7216('0x23')](function(_0x52907a){if(_0x52907a['success']){var _0x2730da={'method':'GET','uri':_0x367b1c,'qs':{'operation':_0x7216('0x5f'),'username':_0x721fbb,'sessionName':_0x52907a[_0x7216('0x5e')][_0x7216('0x60')],'elementType':_0x236441},'json':!![]};return rp(_0x2730da);}})['then'](function(_0x3489c1){if(_0x3489c1['success']){var _0x15201f=[_0x7216('0x61'),_0x7216('0x62'),_0x7216('0x63')];_['remove'](_0x3489c1['result'][_0x7216('0x31')],function(_0x1db99b){return _0x15201f[_0x7216('0x64')](_0x1db99b[_0x7216('0x4b')][_0x7216('0x25')]);});_['remove'](_0x3489c1[_0x7216('0x5e')][_0x7216('0x31')],function(_0x40817c){return _0x40817c[_0x7216('0x65')]==='false';});return{'count':_0x3489c1[_0x7216('0x5e')][_0x7216('0x31')][_0x7216('0x32')],'rows':_['map'](_0x3489c1[_0x7216('0x5e')]['fields'],function(_0x12596d){return{'id':_0x12596d[_0x7216('0x25')],'name':_0x12596d[_0x7216('0x66')],'custom':_[_0x7216('0x67')](_0x12596d[_0x7216('0x25')],_0x7216('0x68'))?!![]:![],'options':_0x12596d[_0x7216('0x4b')][_0x7216('0x25')]==='picklist'&&_0x12596d[_0x7216('0x4b')][_0x7216('0x69')][_0x7216('0x32')]>0x0?_['map'](_0x12596d[_0x7216('0x4b')][_0x7216('0x69')],function(_0x38a300){return{'name':_0x38a300[_0x7216('0x66')],'value':_0x38a300['value']};}):[]};})};}})[_0x7216('0x23')](respondWithResult(_0xed3777,null))[_0x7216('0x3d')](function(_0x333b92){console[_0x7216('0x6a')]('vTiger\x20error:\x20'+_0x333b92);var _0x5b45b9=_0x2a15be['query'][_0x7216('0x6b')]?0x1f4:_0x333b92[_0x7216('0x6c')]||0x1f4;logger[_0x7216('0x6d')](_0x7216('0x6e'),_0x7216('0x6f'),_0x5b45b9,JSON[_0x7216('0x70')](_0x333b92));delete _0x333b92['name'];if(_0x5b45b9===0x191){_0x5b45b9=0x190;}_0xed3777['status'](_0x5b45b9)[_0x7216('0x26')](_0x2a15be[_0x7216('0x2e')][_0x7216('0x6b')]?{'message':_0x7216('0x71'),'statusCode':_0x333b92[_0x7216('0x6c')]}:_0x333b92);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 965092c..3d4b56b 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 _0x95fa=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','rimraf','./intVtigerAccount.attributes','exports'];(function(_0x1ed943,_0x3838f7){var _0x380136=function(_0x505f4d){while(--_0x505f4d){_0x1ed943['push'](_0x1ed943['shift']());}};_0x380136(++_0x3838f7);}(_0x95fa,0xc9));var _0xa95f=function(_0x447bd2,_0x2875b3){_0x447bd2=_0x447bd2-0x0;var _0x2f9765=_0x95fa[_0x447bd2];return _0x2f9765;};'use strict';var _=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var logger=require(_0xa95f('0x2'))('api');var moment=require(_0xa95f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa95f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa95f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa95f('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xa95f('0x7')]=function(_0x2ac85c,_0x2480c6){return _0x2ac85c[_0xa95f('0x8')](_0xa95f('0x9'),attributes,{'tableName':_0xa95f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaef0=['VtigerAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4b59cf,_0x11e2f5){var _0x4a9ca6=function(_0x40d895){while(--_0x40d895){_0x4b59cf['push'](_0x4b59cf['shift']());}};_0x4a9ca6(++_0x11e2f5);}(_0xaef0,0x1c8));var _0x0aef=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xaef0[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require(_0x0aef('0x0'));var util=require('util');var logger=require(_0x0aef('0x1'))(_0x0aef('0x2'));var moment=require(_0x0aef('0x3'));var BPromise=require(_0x0aef('0x4'));var rp=require(_0x0aef('0x5'));var fs=require('fs');var path=require(_0x0aef('0x6'));var rimraf=require(_0x0aef('0x7'));var config=require(_0x0aef('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x0aef('0x9'));module[_0x0aef('0xa')]=function(_0x2b1ecc,_0x5b16cd){return _0x2b1ecc[_0x0aef('0xb')](_0x0aef('0xc'),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 2c26054..1e7fe8e 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 _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1131d6,_0x1303b1){var _0x3d6b22=function(_0x3885ad){while(--_0x3885ad){_0x1131d6['push'](_0x1131d6['shift']());}};_0x3d6b22(++_0x1303b1);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2ee58f,_0x3ca606){_0x2ee58f=_0x2ee58f-0x0;var _0x5c235f=_0xf7b4[_0x2ee58f];return _0x5c235f;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file +var _0x39cb=['request','then','info','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','map','include','model','debug','ShowVtigerAccount','raw','where','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3130a0,_0x58866e){var _0x59c1a6=function(_0x490f9d){while(--_0x490f9d){_0x3130a0['push'](_0x3130a0['shift']());}};_0x59c1a6(++_0x58866e);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});}exports[_0xb39c('0x16')]=function(_0x4e02cf){var _0x35dade=this;return new Promise(function(_0x2eeae6,_0x559ad6){return db[_0xb39c('0x17')][_0xb39c('0x18')]({'raw':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['where']||null:null,'attributes':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1a')]||null:null,'limit':_0x4e02cf['options']?_0x4e02cf['options'][_0xb39c('0x1b')]||null:null,'include':_0x4e02cf[_0xb39c('0x19')]?_0x4e02cf[_0xb39c('0x19')]['include']?_[_0xb39c('0x1c')](_0x4e02cf[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x16f3b0){return{'model':db[_0x16f3b0[_0xb39c('0x1e')]],'as':_0x16f3b0['as'],'attributes':_0x16f3b0['attributes'],'include':_0x16f3b0[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x16f3b0['include'],function(_0x1fd145){return{'model':db[_0x1fd145[_0xb39c('0x1e')]],'as':_0x1fd145['as'],'attributes':_0x1fd145[_0xb39c('0x1a')],'include':_0x1fd145[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x1fd145['include'],function(_0x23a2f1){return{'model':db[_0x23a2f1[_0xb39c('0x1e')]],'as':_0x23a2f1['as'],'attributes':_0x23a2f1[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41fff2){logger[_0xb39c('0xc')]('GetVtigerAccount',_0x4e02cf);logger[_0xb39c('0x1f')](_0xb39c('0x16'),_0x4e02cf,JSON[_0xb39c('0xf')](_0x41fff2));_0x2eeae6(_0x41fff2);})['catch'](function(_0x714d20){logger[_0xb39c('0x10')]('GetVtigerAccount',_0x714d20[_0xb39c('0x13')],_0x4e02cf);_0x559ad6(_0x35dade['error'](0x1f4,_0x714d20[_0xb39c('0x13')]));});});};exports[_0xb39c('0x20')]=function(_0x309697){var _0x7339b4=this;return new Promise(function(_0x17eb7b,_0x52e642){return db[_0xb39c('0x17')]['find']({'raw':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x21')]===undefined?!![]:![]:!![],'where':_0x309697[_0xb39c('0x19')]?_0x309697[_0xb39c('0x19')][_0xb39c('0x22')]||null:null,'attributes':_0x309697['options']?_0x309697['options'][_0xb39c('0x1a')]||null:null,'include':_0x309697[_0xb39c('0x19')]?_0x309697['options'][_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x309697[_0xb39c('0x19')][_0xb39c('0x1d')],function(_0x14a92f){return{'model':db[_0x14a92f[_0xb39c('0x1e')]],'as':_0x14a92f['as'],'attributes':_0x14a92f[_0xb39c('0x1a')],'include':_0x14a92f[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x14a92f[_0xb39c('0x1d')],function(_0x15882d){return{'model':db[_0x15882d[_0xb39c('0x1e')]],'as':_0x15882d['as'],'attributes':_0x15882d[_0xb39c('0x1a')],'include':_0x15882d[_0xb39c('0x1d')]?_[_0xb39c('0x1c')](_0x15882d[_0xb39c('0x1d')],function(_0x8e5a74){return{'model':db[_0x8e5a74[_0xb39c('0x1e')]],'as':_0x8e5a74['as'],'attributes':_0x8e5a74[_0xb39c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c2b40){logger[_0xb39c('0xc')]('ShowVtigerAccount',_0x309697);logger['debug']('ShowVtigerAccount',_0x309697,JSON[_0xb39c('0xf')](_0x2c2b40));_0x17eb7b(_0x2c2b40);})[_0xb39c('0x15')](function(_0xe6bc2e){logger['error'](_0xb39c('0x20'),_0xe6bc2e[_0xb39c('0x13')],_0x309697);_0x52e642(_0x7339b4[_0xb39c('0x10')](0x1f4,_0xe6bc2e[_0xb39c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c972bf7..984c1aa 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 _0x6381=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x34e0c5,_0x5b2fb2){var _0x5c10e3=function(_0x112c32){while(--_0x112c32){_0x34e0c5['push'](_0x34e0c5['shift']());}};_0x5c10e3(++_0x5b2fb2);}(_0x6381,0x122));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1638('0x0'));var path=require(_0x1638('0x1'));var timeout=require(_0x1638('0x2'));var express=require(_0x1638('0x3'));var router=express[_0x1638('0x4')]();var fs_extra=require(_0x1638('0x5'));var auth=require(_0x1638('0x6'));var interaction=require(_0x1638('0x7'));var config=require(_0x1638('0x8'));var controller=require(_0x1638('0x9'));router[_0x1638('0xa')]('/',auth[_0x1638('0xb')](),controller[_0x1638('0xc')]);router['get'](_0x1638('0xd'),auth[_0x1638('0xb')](),controller[_0x1638('0xe')]);router[_0x1638('0xa')](_0x1638('0xf'),auth[_0x1638('0xb')](),controller[_0x1638('0x10')]);router[_0x1638('0xa')](_0x1638('0x11'),auth[_0x1638('0xb')](),controller['getSubjects']);router[_0x1638('0xa')](_0x1638('0x12'),auth[_0x1638('0xb')](),controller[_0x1638('0x13')]);router['post']('/',auth[_0x1638('0xb')](),controller[_0x1638('0x14')]);router[_0x1638('0x15')](_0x1638('0xd'),auth[_0x1638('0xb')](),controller['update']);router[_0x1638('0x16')]('/:id',auth[_0x1638('0xb')](),controller[_0x1638('0x17')]);module[_0x1638('0x18')]=router; \ No newline at end of file +var _0x1b6c=['/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x2008cb,_0x4666cb){var _0x1f9647=function(_0x17f83c){while(--_0x17f83c){_0x2008cb['push'](_0x2008cb['shift']());}};_0x1f9647(++_0x4666cb);}(_0x1b6c,0x12c));var _0xc1b6=function(_0x39b007,_0x45f4a8){_0x39b007=_0x39b007-0x0;var _0x26f00d=_0x1b6c[_0x39b007];return _0x26f00d;};'use strict';var multer=require(_0xc1b6('0x0'));var util=require(_0xc1b6('0x1'));var path=require(_0xc1b6('0x2'));var timeout=require(_0xc1b6('0x3'));var express=require('express');var router=express[_0xc1b6('0x4')]();var fs_extra=require(_0xc1b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1b6('0x6'));var config=require(_0xc1b6('0x7'));var controller=require(_0xc1b6('0x8'));router[_0xc1b6('0x9')]('/',auth[_0xc1b6('0xa')](),controller[_0xc1b6('0xb')]);router['get'](_0xc1b6('0xc'),auth[_0xc1b6('0xa')](),controller[_0xc1b6('0xd')]);router[_0xc1b6('0x9')](_0xc1b6('0xe'),auth[_0xc1b6('0xa')](),controller['getFields']);router[_0xc1b6('0x9')](_0xc1b6('0xf'),auth[_0xc1b6('0xa')](),controller[_0xc1b6('0x10')]);router[_0xc1b6('0x9')](_0xc1b6('0x11'),auth[_0xc1b6('0xa')](),controller['getDescriptions']);router[_0xc1b6('0x12')]('/',auth[_0xc1b6('0xa')](),controller['create']);router[_0xc1b6('0x13')](_0xc1b6('0xc'),auth[_0xc1b6('0xa')](),controller[_0xc1b6('0x14')]);router[_0xc1b6('0x15')](_0xc1b6('0xc'),auth[_0xc1b6('0xa')](),controller[_0xc1b6('0x16')]);module[_0xc1b6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4cfa64f..7ec03e1 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 _0x98a2=['STRING','sequelize','exports'];(function(_0x3e69e0,_0x2189b1){var _0x705b19=function(_0x3e8d00){while(--_0x3e8d00){_0x3e69e0['push'](_0x3e69e0['shift']());}};_0x705b19(++_0x2189b1);}(_0x98a2,0xb2));var _0x298a=function(_0x2dd7c5,_0xb656f9){_0x2dd7c5=_0x2dd7c5-0x0;var _0x152a45=_0x98a2[_0x2dd7c5];return _0x152a45;};'use strict';var Sequelize=require(_0x298a('0x0'));module[_0x298a('0x1')]={'name':{'type':Sequelize[_0x298a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x736a=['STRING','exports'];(function(_0x1b8448,_0x47e0a4){var _0x8954e1=function(_0x4cecd4){while(--_0x4cecd4){_0x1b8448['push'](_0x1b8448['shift']());}};_0x8954e1(++_0x47e0a4);}(_0x736a,0x149));var _0xa736=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x736a[_0x556bb1];return _0x45455f;};'use strict';var Sequelize=require('sequelize');module[_0xa736('0x0')]={'name':{'type':Sequelize[_0xa736('0x1')]},'description':{'type':Sequelize[_0xa736('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 15659a1..008e49b 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 _0x8bdf=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','show','rawAttributes','keys','filters','find','catch','create','body','update','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','then','destroy','stack','name','send','map','type','key','query','intersection'];(function(_0x57ee4f,_0x1e45cd){var _0x2724d2=function(_0x2f669d){while(--_0x2f669d){_0x57ee4f['push'](_0x57ee4f['shift']());}};_0x2724d2(++_0x1e45cd);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x8bdf[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xf8bd('0x0'));var rimraf=require(_0xf8bd('0x1'));var zipdir=require(_0xf8bd('0x2'));var jsonpatch=require(_0xf8bd('0x3'));var rp=require(_0xf8bd('0x4'));var moment=require('moment');var BPromise=require(_0xf8bd('0x5'));var Mustache=require(_0xf8bd('0x6'));var util=require(_0xf8bd('0x7'));var path=require(_0xf8bd('0x8'));var sox=require(_0xf8bd('0x9'));var csv=require(_0xf8bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf8bd('0xb'));var crypto=require(_0xf8bd('0xc'));var jsforce=require(_0xf8bd('0xd'));var deskjs=require(_0xf8bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8bd('0xf'));var Papa=require(_0xf8bd('0x10'));var Redis=require('ioredis');var authService=require(_0xf8bd('0x11'));var qs=require(_0xf8bd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8bd('0x13'));var logger=require(_0xf8bd('0x14'))(_0xf8bd('0x15'));var utils=require(_0xf8bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf8bd('0x17'));var db=require(_0xf8bd('0x18'))['db'];function respondWithStatusCode(_0x5ec9ad,_0x1a009e){_0x1a009e=_0x1a009e||0xcc;return function(_0x49e8c6){if(_0x49e8c6){return _0x5ec9ad[_0xf8bd('0x19')](_0x1a009e);}return _0x5ec9ad[_0xf8bd('0x1a')](_0x1a009e)[_0xf8bd('0x1b')]();};}function respondWithResult(_0x172c5e,_0x43d517){_0x43d517=_0x43d517||0xc8;return function(_0xa0ee74){if(_0xa0ee74){return _0x172c5e['status'](_0x43d517)['json'](_0xa0ee74);}};}function respondWithFilteredResult(_0x49478a,_0x13350a){return function(_0x33facf){if(_0x33facf){var _0x54dc30=typeof _0x13350a[_0xf8bd('0x1c')]===_0xf8bd('0x1d')&&typeof _0x13350a[_0xf8bd('0x1e')]===_0xf8bd('0x1d');var _0x54cf43=_0x33facf[_0xf8bd('0x1f')];var _0x3e69be=_0x54dc30?0x0:_0x13350a['offset'];var _0x2c006c=_0x54dc30?_0x33facf[_0xf8bd('0x1f')]:_0x13350a[_0xf8bd('0x1c')]+_0x13350a[_0xf8bd('0x1e')];var _0xf06524;if(_0x2c006c>=_0x54cf43){_0x2c006c=_0x54cf43;_0xf06524=0xc8;}else{_0xf06524=0xce;}_0x49478a[_0xf8bd('0x1a')](_0xf06524);return _0x49478a['set'](_0xf8bd('0x20'),_0x3e69be+'-'+_0x2c006c+'/'+_0x54cf43)[_0xf8bd('0x21')](_0x33facf);}return null;};}function patchUpdates(_0x5bd4fe){return function(_0x116946){try{jsonpatch['apply'](_0x116946,_0x5bd4fe,!![]);}catch(_0x30d533){return BPromise[_0xf8bd('0x22')](_0x30d533);}return _0x116946['save']();};}function saveUpdates(_0x469813,_0x45eb2d){return function(_0x4c575f){if(_0x4c575f){return _0x4c575f['update'](_0x469813)[_0xf8bd('0x23')](function(_0x4c6ff){return _0x4c6ff;});}return null;};}function removeEntity(_0x4edd5a,_0x280b5b){return function(_0x59d0b9){if(_0x59d0b9){return _0x59d0b9[_0xf8bd('0x24')]()[_0xf8bd('0x23')](function(){_0x4edd5a['status'](0xcc)[_0xf8bd('0x1b')]();});}};}function handleEntityNotFound(_0x4de830,_0x1dd9bd){return function(_0x5b85f5){if(!_0x5b85f5){_0x4de830[_0xf8bd('0x19')](0x194);}return _0x5b85f5;};}function handleError(_0x480bc8,_0x136bd2){_0x136bd2=_0x136bd2||0x1f4;return function(_0x4fe184){logger['error'](_0x4fe184[_0xf8bd('0x25')]);if(_0x4fe184['name']){delete _0x4fe184[_0xf8bd('0x26')];}_0x480bc8[_0xf8bd('0x1a')](_0x136bd2)[_0xf8bd('0x27')](_0x4fe184);};}exports['index']=function(_0x258d09,_0x3974ff){var _0xa3ff13={},_0x3aa54a={},_0x4fc088={'count':0x0,'rows':[]};var _0x4bff64=_[_0xf8bd('0x28')](db['VtigerConfiguration']['rawAttributes'],function(_0x5407f9){return{'name':_0x5407f9['fieldName'],'type':_0x5407f9[_0xf8bd('0x29')][_0xf8bd('0x2a')]};});_0x3aa54a['model']=_[_0xf8bd('0x28')](_0x4bff64,_0xf8bd('0x26'));_0x3aa54a['query']=_['keys'](_0x258d09[_0xf8bd('0x2b')]);_0x3aa54a['filters']=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],_0x3aa54a[_0xf8bd('0x2b')]);_0xa3ff13[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],qs['fields'](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0xa3ff13['attributes']=_0xa3ff13['attributes'][_0xf8bd('0x30')]?_0xa3ff13[_0xf8bd('0x2e')]:_0x3aa54a['model'];if(!_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x31')](_0xf8bd('0x32'))){_0xa3ff13[_0xf8bd('0x1e')]=qs[_0xf8bd('0x1e')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0xa3ff13['offset']=qs[_0xf8bd('0x1c')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1c')]);}_0xa3ff13[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x34')]);_0xa3ff13['where']=qs['filters'](_[_0xf8bd('0x35')](_0x258d09['query'],_0x3aa54a['filters']),_0x4bff64);if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x36')]){_0xa3ff13[_0xf8bd('0x37')]=_[_0xf8bd('0x38')](_0xa3ff13[_0xf8bd('0x37')],{'$or':_['map'](_0x4bff64,function(_0x477be8){if(_0x477be8[_0xf8bd('0x29')]!==_0xf8bd('0x39')){var _0x4e0e7e={};_0x4e0e7e[_0x477be8['name']]={'$like':'%'+_0x258d09[_0xf8bd('0x2b')]['filter']+'%'};return _0x4e0e7e;}})});}_0xa3ff13=_['merge']({},_0xa3ff13,_0x258d09[_0xf8bd('0x3a')]);var _0x4a53fb={'where':_0xa3ff13[_0xf8bd('0x37')]};return db[_0xf8bd('0x3b')][_0xf8bd('0x1f')](_0x4a53fb)[_0xf8bd('0x23')](function(_0x21ab29){_0x4fc088[_0xf8bd('0x1f')]=_0x21ab29;if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0xa3ff13[_0xf8bd('0x3d')]=[{'all':!![]}];}return db[_0xf8bd('0x3b')]['findAll'](_0xa3ff13);})[_0xf8bd('0x23')](function(_0x2deecd){_0x4fc088[_0xf8bd('0x3e')]=_0x2deecd;return _0x4fc088;})[_0xf8bd('0x23')](respondWithFilteredResult(_0x3974ff,_0xa3ff13))['catch'](handleError(_0x3974ff,null));};exports[_0xf8bd('0x3f')]=function(_0x1f11f8,_0x46e7d4){var _0x282a35={'raw':![],'where':{'id':_0x1f11f8['params']['id']}},_0x504366={};_0x504366['model']=_['keys'](db['VtigerConfiguration'][_0xf8bd('0x40')]);_0x504366[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x1f11f8[_0xf8bd('0x2b')]);_0x504366[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],_0x504366[_0xf8bd('0x2b')]);_0x282a35['attributes']=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],qs[_0xf8bd('0x2f')](_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x282a35[_0xf8bd('0x2e')]=_0x282a35[_0xf8bd('0x2e')][_0xf8bd('0x30')]?_0x282a35[_0xf8bd('0x2e')]:_0x504366['model'];if(_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0x282a35[_0xf8bd('0x3d')]=[{'all':!![]}];}_0x282a35=_[_0xf8bd('0x38')]({},_0x282a35,_0x1f11f8[_0xf8bd('0x3a')]);return db[_0xf8bd('0x3b')][_0xf8bd('0x43')](_0x282a35)['then'](handleEntityNotFound(_0x46e7d4,null))[_0xf8bd('0x23')](respondWithResult(_0x46e7d4,null))[_0xf8bd('0x44')](handleError(_0x46e7d4,null));};exports[_0xf8bd('0x45')]=function(_0x57e228,_0x1d6912){return db['VtigerConfiguration'][_0xf8bd('0x45')](_0x57e228[_0xf8bd('0x46')],{})[_0xf8bd('0x23')](respondWithResult(_0x1d6912,0xc9))['catch'](handleError(_0x1d6912,null));};exports[_0xf8bd('0x47')]=function(_0x411023,_0x29b5a5){if(_0x411023[_0xf8bd('0x46')]['id']){delete _0x411023[_0xf8bd('0x46')]['id'];}return db[_0xf8bd('0x3b')][_0xf8bd('0x43')]({'where':{'id':_0x411023[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x29b5a5,null))[_0xf8bd('0x23')](saveUpdates(_0x411023[_0xf8bd('0x46')],null))[_0xf8bd('0x23')](respondWithResult(_0x29b5a5,null))[_0xf8bd('0x44')](handleError(_0x29b5a5,null));};exports[_0xf8bd('0x24')]=function(_0x13dbe6,_0x2b0cb9){return db[_0xf8bd('0x3b')]['find']({'where':{'id':_0x13dbe6[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x2b0cb9,null))[_0xf8bd('0x23')](removeEntity(_0x2b0cb9,null))[_0xf8bd('0x44')](handleError(_0x2b0cb9,null));};exports[_0xf8bd('0x49')]=function(_0x20d1c1,_0x283dfe,_0xcf4b86){var _0x2d88a8={};var _0x524299={};var _0x2ea54a;var _0x324d5b;return db[_0xf8bd('0x3b')][_0xf8bd('0x4a')]({'where':{'id':_0x20d1c1[_0xf8bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x283dfe,null))[_0xf8bd('0x23')](function(_0x1d004d){if(_0x1d004d){_0x2ea54a=_0x1d004d;_0x524299[_0xf8bd('0x2d')]=_[_0xf8bd('0x41')](db[_0xf8bd('0x4b')]['rawAttributes']);_0x524299[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x20d1c1[_0xf8bd('0x2b')]);_0x524299[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x524299['model'],_0x524299[_0xf8bd('0x2b')]);_0x2d88a8['attributes']=_[_0xf8bd('0x2c')](_0x524299[_0xf8bd('0x2d')],qs['fields'](_0x20d1c1['query']['fields']));_0x2d88a8['attributes']=_0x2d88a8[_0xf8bd('0x2e')]['length']?_0x2d88a8[_0xf8bd('0x2e')]:_0x524299[_0xf8bd('0x2d')];_0x2d88a8[_0xf8bd('0x33')]=qs['sort'](_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x34')]);_0x2d88a8[_0xf8bd('0x37')]=qs[_0xf8bd('0x42')](_['pick'](_0x20d1c1['query'],_0x524299['filters']));if(_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x36')]){_0x2d88a8[_0xf8bd('0x37')]=_[_0xf8bd('0x38')](_0x2d88a8[_0xf8bd('0x37')],{'$or':_['map'](_0x2d88a8[_0xf8bd('0x2e')],function(_0x457f19){var _0x5427d1={};_0x5427d1[_0x457f19]={'$like':'%'+_0x20d1c1[_0xf8bd('0x2b')]['filter']+'%'};return _0x5427d1;})});}_0x2d88a8=_[_0xf8bd('0x38')]({},_0x2d88a8,_0x20d1c1[_0xf8bd('0x3a')]);return _0x2ea54a['getFields'](_0x2d88a8);}})[_0xf8bd('0x23')](function(_0x98993b){if(_0x98993b){_0x324d5b=_0x98993b[_0xf8bd('0x30')];if(!_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x31')]('nolimit')){_0x2d88a8[_0xf8bd('0x1e')]=qs[_0xf8bd('0x1e')](_0x20d1c1[_0xf8bd('0x2b')]['limit']);_0x2d88a8['offset']=qs['offset'](_0x20d1c1[_0xf8bd('0x2b')]['offset']);}return _0x2ea54a['getFields'](_0x2d88a8);}})[_0xf8bd('0x23')](function(_0x141994){if(_0x141994){return _0x141994?{'count':_0x324d5b,'rows':_0x141994}:null;}})[_0xf8bd('0x23')](respondWithResult(_0x283dfe,null))[_0xf8bd('0x44')](handleError(_0x283dfe,null));};exports[_0xf8bd('0x4c')]=function(_0x5fedee,_0x2d7b2d,_0x34f50c){var _0x4b9970={};var _0x16fa16={};var _0x1af941;var _0x1df41;return db[_0xf8bd('0x3b')]['findOne']({'where':{'id':_0x5fedee[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x2d7b2d,null))[_0xf8bd('0x23')](function(_0x1fc2e6){if(_0x1fc2e6){_0x1af941=_0x1fc2e6;_0x16fa16[_0xf8bd('0x2d')]=_['keys'](db[_0xf8bd('0x4b')][_0xf8bd('0x40')]);_0x16fa16[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x5fedee[_0xf8bd('0x2b')]);_0x16fa16[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x16fa16[_0xf8bd('0x2d')],_0x16fa16[_0xf8bd('0x2b')]);_0x4b9970[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x16fa16[_0xf8bd('0x2d')],qs[_0xf8bd('0x2f')](_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x4b9970['attributes']=_0x4b9970[_0xf8bd('0x2e')][_0xf8bd('0x30')]?_0x4b9970['attributes']:_0x16fa16[_0xf8bd('0x2d')];_0x4b9970[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0x5fedee[_0xf8bd('0x2b')]['sort']);_0x4b9970['where']=qs[_0xf8bd('0x42')](_[_0xf8bd('0x35')](_0x5fedee[_0xf8bd('0x2b')],_0x16fa16[_0xf8bd('0x42')]));if(_0x5fedee['query'][_0xf8bd('0x36')]){_0x4b9970[_0xf8bd('0x37')]=_['merge'](_0x4b9970[_0xf8bd('0x37')],{'$or':_[_0xf8bd('0x28')](_0x4b9970[_0xf8bd('0x2e')],function(_0x1d30a2){var _0x5e7e26={};_0x5e7e26[_0x1d30a2]={'$like':'%'+_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x36')]+'%'};return _0x5e7e26;})});}_0x4b9970=_['merge']({},_0x4b9970,_0x5fedee[_0xf8bd('0x3a')]);return _0x1af941['getSubjects'](_0x4b9970);}})[_0xf8bd('0x23')](function(_0x1ed0b1){if(_0x1ed0b1){_0x1df41=_0x1ed0b1[_0xf8bd('0x30')];if(!_0x5fedee['query']['hasOwnProperty']('nolimit')){_0x4b9970['limit']=qs[_0xf8bd('0x1e')](_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0x4b9970['offset']=qs[_0xf8bd('0x1c')](_0x5fedee[_0xf8bd('0x2b')]['offset']);}return _0x1af941['getSubjects'](_0x4b9970);}})['then'](function(_0xda6b60){if(_0xda6b60){return _0xda6b60?{'count':_0x1df41,'rows':_0xda6b60}:null;}})['then'](respondWithResult(_0x2d7b2d,null))['catch'](handleError(_0x2d7b2d,null));};exports[_0xf8bd('0x4d')]=function(_0xb6c48f,_0xbbb2a5,_0x137fe5){var _0x58085e={};var _0x52c4db={};var _0x3bb231;var _0x43d143;return db[_0xf8bd('0x3b')][_0xf8bd('0x4a')]({'where':{'id':_0xb6c48f[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0xbbb2a5,null))[_0xf8bd('0x23')](function(_0x2b8f2d){if(_0x2b8f2d){_0x3bb231=_0x2b8f2d;_0x52c4db['model']=_[_0xf8bd('0x41')](db['VtigerField'][_0xf8bd('0x40')]);_0x52c4db[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0xb6c48f[_0xf8bd('0x2b')]);_0x52c4db['filters']=_[_0xf8bd('0x2c')](_0x52c4db[_0xf8bd('0x2d')],_0x52c4db[_0xf8bd('0x2b')]);_0x58085e[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x52c4db[_0xf8bd('0x2d')],qs['fields'](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x58085e[_0xf8bd('0x2e')]=_0x58085e['attributes'][_0xf8bd('0x30')]?_0x58085e[_0xf8bd('0x2e')]:_0x52c4db['model'];_0x58085e[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0xb6c48f['query'][_0xf8bd('0x34')]);_0x58085e[_0xf8bd('0x37')]=qs[_0xf8bd('0x42')](_[_0xf8bd('0x35')](_0xb6c48f[_0xf8bd('0x2b')],_0x52c4db['filters']));if(_0xb6c48f['query'][_0xf8bd('0x36')]){_0x58085e[_0xf8bd('0x37')]=_['merge'](_0x58085e[_0xf8bd('0x37')],{'$or':_[_0xf8bd('0x28')](_0x58085e['attributes'],function(_0x3d2312){var _0x1b4598={};_0x1b4598[_0x3d2312]={'$like':'%'+_0xb6c48f['query'][_0xf8bd('0x36')]+'%'};return _0x1b4598;})});}_0x58085e=_[_0xf8bd('0x38')]({},_0x58085e,_0xb6c48f[_0xf8bd('0x3a')]);return _0x3bb231['getDescriptions'](_0x58085e);}})[_0xf8bd('0x23')](function(_0x4be5cb){if(_0x4be5cb){_0x43d143=_0x4be5cb['length'];if(!_0xb6c48f[_0xf8bd('0x2b')]['hasOwnProperty'](_0xf8bd('0x32'))){_0x58085e['limit']=qs['limit'](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0x58085e[_0xf8bd('0x1c')]=qs[_0xf8bd('0x1c')](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x1c')]);}return _0x3bb231[_0xf8bd('0x4d')](_0x58085e);}})[_0xf8bd('0x23')](function(_0x5a2414){if(_0x5a2414){return _0x5a2414?{'count':_0x43d143,'rows':_0x5a2414}:null;}})[_0xf8bd('0x23')](respondWithResult(_0xbbb2a5,null))[_0xf8bd('0x44')](handleError(_0xbbb2a5,null));}; \ No newline at end of file +var _0x0ccc=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','findOne','VtigerField','pick','getFields','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x58398b,_0x595eff){var _0x28f423=function(_0x53041f){while(--_0x53041f){_0x58398b['push'](_0x58398b['shift']());}};_0x28f423(++_0x595eff);}(_0x0ccc,0x90));var _0xc0cc=function(_0x5ad0b3,_0x4a2a52){_0x5ad0b3=_0x5ad0b3-0x0;var _0x5d0bb5=_0x0ccc[_0x5ad0b3];return _0x5d0bb5;};'use strict';var emlformat=require(_0xc0cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0cc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0cc('0x3'));var util=require(_0xc0cc('0x4'));var path=require(_0xc0cc('0x5'));var sox=require(_0xc0cc('0x6'));var csv=require(_0xc0cc('0x7'));var ejs=require(_0xc0cc('0x8'));var fs=require('fs');var fs_extra=require(_0xc0cc('0x9'));var _=require('lodash');var squel=require(_0xc0cc('0xa'));var crypto=require(_0xc0cc('0xb'));var jsforce=require(_0xc0cc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc0cc('0xd'));var Papa=require('papaparse');var Redis=require(_0xc0cc('0xe'));var authService=require(_0xc0cc('0xf'));var qs=require(_0xc0cc('0x10'));var as=require(_0xc0cc('0x11'));var hardwareService=require(_0xc0cc('0x12'));var logger=require(_0xc0cc('0x13'))(_0xc0cc('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc0cc('0x15'));var db=require(_0xc0cc('0x16'))['db'];function respondWithStatusCode(_0x278e28,_0x5ebcb9){_0x5ebcb9=_0x5ebcb9||0xcc;return function(_0x5578d9){if(_0x5578d9){return _0x278e28['sendStatus'](_0x5ebcb9);}return _0x278e28[_0xc0cc('0x17')](_0x5ebcb9)['end']();};}function respondWithResult(_0xdff6be,_0x143c7e){_0x143c7e=_0x143c7e||0xc8;return function(_0x497a92){if(_0x497a92){return _0xdff6be[_0xc0cc('0x17')](_0x143c7e)['json'](_0x497a92);}};}function respondWithFilteredResult(_0x3b3f59,_0x153034){return function(_0x552ab0){if(_0x552ab0){var _0x3b0a68=typeof _0x153034[_0xc0cc('0x18')]===_0xc0cc('0x19')&&typeof _0x153034[_0xc0cc('0x1a')]==='undefined';var _0x3f359c=_0x552ab0[_0xc0cc('0x1b')];var _0x1bfcb8=_0x3b0a68?0x0:_0x153034['offset'];var _0xc0a8af=_0x3b0a68?_0x552ab0[_0xc0cc('0x1b')]:_0x153034[_0xc0cc('0x18')]+_0x153034['limit'];var _0x1f5c38;if(_0xc0a8af>=_0x3f359c){_0xc0a8af=_0x3f359c;_0x1f5c38=0xc8;}else{_0x1f5c38=0xce;}_0x3b3f59['status'](_0x1f5c38);return _0x3b3f59[_0xc0cc('0x1c')](_0xc0cc('0x1d'),_0x1bfcb8+'-'+_0xc0a8af+'/'+_0x3f359c)[_0xc0cc('0x1e')](_0x552ab0);}return null;};}function patchUpdates(_0x2a7a84){return function(_0xf6fa8a){try{jsonpatch[_0xc0cc('0x1f')](_0xf6fa8a,_0x2a7a84,!![]);}catch(_0x59fb2d){return BPromise[_0xc0cc('0x20')](_0x59fb2d);}return _0xf6fa8a['save']();};}function saveUpdates(_0x402aa2,_0x3616f9){return function(_0x414e16){if(_0x414e16){return _0x414e16[_0xc0cc('0x21')](_0x402aa2)[_0xc0cc('0x22')](function(_0x5eca8){return _0x5eca8;});}return null;};}function removeEntity(_0x34b529,_0x46015d){return function(_0x145d3c){if(_0x145d3c){return _0x145d3c[_0xc0cc('0x23')]()['then'](function(){_0x34b529[_0xc0cc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149926,_0x4d6cb5){return function(_0x357ed3){if(!_0x357ed3){_0x149926['sendStatus'](0x194);}return _0x357ed3;};}function handleError(_0x5b033f,_0xa8942d){_0xa8942d=_0xa8942d||0x1f4;return function(_0x58c308){logger[_0xc0cc('0x24')](_0x58c308[_0xc0cc('0x25')]);if(_0x58c308[_0xc0cc('0x26')]){delete _0x58c308['name'];}_0x5b033f[_0xc0cc('0x17')](_0xa8942d)['send'](_0x58c308);};}exports[_0xc0cc('0x27')]=function(_0x479f80,_0xc2f435){var _0x1e0b91={},_0x458e31={},_0x48f707={'count':0x0,'rows':[]};var _0x7bb30f=_[_0xc0cc('0x28')](db[_0xc0cc('0x29')][_0xc0cc('0x2a')],function(_0x3dda06){return{'name':_0x3dda06[_0xc0cc('0x2b')],'type':_0x3dda06[_0xc0cc('0x2c')][_0xc0cc('0x2d')]};});_0x458e31[_0xc0cc('0x2e')]=_[_0xc0cc('0x28')](_0x7bb30f,'name');_0x458e31[_0xc0cc('0x2f')]=_['keys'](_0x479f80[_0xc0cc('0x2f')]);_0x458e31[_0xc0cc('0x30')]=_['intersection'](_0x458e31[_0xc0cc('0x2e')],_0x458e31['query']);_0x1e0b91[_0xc0cc('0x31')]=_[_0xc0cc('0x32')](_0x458e31[_0xc0cc('0x2e')],qs['fields'](_0x479f80[_0xc0cc('0x2f')][_0xc0cc('0x33')]));_0x1e0b91[_0xc0cc('0x31')]=_0x1e0b91[_0xc0cc('0x31')]['length']?_0x1e0b91[_0xc0cc('0x31')]:_0x458e31[_0xc0cc('0x2e')];if(!_0x479f80[_0xc0cc('0x2f')][_0xc0cc('0x34')]('nolimit')){_0x1e0b91[_0xc0cc('0x1a')]=qs[_0xc0cc('0x1a')](_0x479f80['query']['limit']);_0x1e0b91[_0xc0cc('0x18')]=qs[_0xc0cc('0x18')](_0x479f80[_0xc0cc('0x2f')][_0xc0cc('0x18')]);}_0x1e0b91[_0xc0cc('0x35')]=qs[_0xc0cc('0x36')](_0x479f80[_0xc0cc('0x2f')][_0xc0cc('0x36')]);_0x1e0b91[_0xc0cc('0x37')]=qs['filters'](_['pick'](_0x479f80[_0xc0cc('0x2f')],_0x458e31['filters']),_0x7bb30f);if(_0x479f80['query'][_0xc0cc('0x38')]){_0x1e0b91['where']=_[_0xc0cc('0x39')](_0x1e0b91['where'],{'$or':_[_0xc0cc('0x28')](_0x7bb30f,function(_0x266290){if(_0x266290[_0xc0cc('0x2c')]!==_0xc0cc('0x3a')){var _0x5dfc06={};_0x5dfc06[_0x266290[_0xc0cc('0x26')]]={'$like':'%'+_0x479f80['query'][_0xc0cc('0x38')]+'%'};return _0x5dfc06;}})});}_0x1e0b91=_[_0xc0cc('0x39')]({},_0x1e0b91,_0x479f80[_0xc0cc('0x3b')]);var _0x332d52={'where':_0x1e0b91[_0xc0cc('0x37')]};return db[_0xc0cc('0x29')][_0xc0cc('0x1b')](_0x332d52)[_0xc0cc('0x22')](function(_0x20d67b){_0x48f707[_0xc0cc('0x1b')]=_0x20d67b;if(_0x479f80[_0xc0cc('0x2f')][_0xc0cc('0x3c')]){_0x1e0b91['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x1e0b91);})['then'](function(_0x340960){_0x48f707[_0xc0cc('0x3d')]=_0x340960;return _0x48f707;})[_0xc0cc('0x22')](respondWithFilteredResult(_0xc2f435,_0x1e0b91))[_0xc0cc('0x3e')](handleError(_0xc2f435,null));};exports[_0xc0cc('0x3f')]=function(_0x5bda84,_0x547ef6){var _0x13d9a9={'raw':![],'where':{'id':_0x5bda84[_0xc0cc('0x40')]['id']}},_0x5c1d1c={};_0x5c1d1c['model']=_[_0xc0cc('0x41')](db[_0xc0cc('0x29')]['rawAttributes']);_0x5c1d1c[_0xc0cc('0x2f')]=_[_0xc0cc('0x41')](_0x5bda84[_0xc0cc('0x2f')]);_0x5c1d1c['filters']=_[_0xc0cc('0x32')](_0x5c1d1c[_0xc0cc('0x2e')],_0x5c1d1c[_0xc0cc('0x2f')]);_0x13d9a9[_0xc0cc('0x31')]=_['intersection'](_0x5c1d1c[_0xc0cc('0x2e')],qs[_0xc0cc('0x33')](_0x5bda84[_0xc0cc('0x2f')][_0xc0cc('0x33')]));_0x13d9a9[_0xc0cc('0x31')]=_0x13d9a9[_0xc0cc('0x31')][_0xc0cc('0x42')]?_0x13d9a9['attributes']:_0x5c1d1c[_0xc0cc('0x2e')];if(_0x5bda84[_0xc0cc('0x2f')]['includeAll']){_0x13d9a9[_0xc0cc('0x43')]=[{'all':!![]}];}_0x13d9a9=_[_0xc0cc('0x39')]({},_0x13d9a9,_0x5bda84[_0xc0cc('0x3b')]);return db[_0xc0cc('0x29')][_0xc0cc('0x44')](_0x13d9a9)[_0xc0cc('0x22')](handleEntityNotFound(_0x547ef6,null))[_0xc0cc('0x22')](respondWithResult(_0x547ef6,null))[_0xc0cc('0x3e')](handleError(_0x547ef6,null));};exports[_0xc0cc('0x45')]=function(_0x1a4621,_0x247d2f){return db[_0xc0cc('0x29')]['create'](_0x1a4621[_0xc0cc('0x46')],{})['then'](respondWithResult(_0x247d2f,0xc9))[_0xc0cc('0x3e')](handleError(_0x247d2f,null));};exports['update']=function(_0x46eda2,_0x492732){if(_0x46eda2[_0xc0cc('0x46')]['id']){delete _0x46eda2[_0xc0cc('0x46')]['id'];}return db[_0xc0cc('0x29')]['find']({'where':{'id':_0x46eda2['params']['id']}})[_0xc0cc('0x22')](handleEntityNotFound(_0x492732,null))[_0xc0cc('0x22')](saveUpdates(_0x46eda2[_0xc0cc('0x46')],null))['then'](respondWithResult(_0x492732,null))['catch'](handleError(_0x492732,null));};exports['destroy']=function(_0x424809,_0x4c445c){return db[_0xc0cc('0x29')][_0xc0cc('0x44')]({'where':{'id':_0x424809['params']['id']}})[_0xc0cc('0x22')](handleEntityNotFound(_0x4c445c,null))[_0xc0cc('0x22')](removeEntity(_0x4c445c,null))[_0xc0cc('0x3e')](handleError(_0x4c445c,null));};exports['getFields']=function(_0x49cf34,_0xf85387,_0x114e85){var _0x52e766={};var _0x1e9852={};var _0x51f562;var _0x127d96;return db[_0xc0cc('0x29')][_0xc0cc('0x47')]({'where':{'id':_0x49cf34[_0xc0cc('0x40')]['id']}})[_0xc0cc('0x22')](handleEntityNotFound(_0xf85387,null))[_0xc0cc('0x22')](function(_0x58eaab){if(_0x58eaab){_0x51f562=_0x58eaab;_0x1e9852['model']=_[_0xc0cc('0x41')](db[_0xc0cc('0x48')][_0xc0cc('0x2a')]);_0x1e9852['query']=_[_0xc0cc('0x41')](_0x49cf34[_0xc0cc('0x2f')]);_0x1e9852[_0xc0cc('0x30')]=_[_0xc0cc('0x32')](_0x1e9852[_0xc0cc('0x2e')],_0x1e9852[_0xc0cc('0x2f')]);_0x52e766[_0xc0cc('0x31')]=_['intersection'](_0x1e9852[_0xc0cc('0x2e')],qs[_0xc0cc('0x33')](_0x49cf34[_0xc0cc('0x2f')]['fields']));_0x52e766[_0xc0cc('0x31')]=_0x52e766['attributes']['length']?_0x52e766[_0xc0cc('0x31')]:_0x1e9852['model'];_0x52e766['order']=qs[_0xc0cc('0x36')](_0x49cf34['query']['sort']);_0x52e766['where']=qs[_0xc0cc('0x30')](_[_0xc0cc('0x49')](_0x49cf34['query'],_0x1e9852['filters']));if(_0x49cf34[_0xc0cc('0x2f')][_0xc0cc('0x38')]){_0x52e766[_0xc0cc('0x37')]=_['merge'](_0x52e766['where'],{'$or':_[_0xc0cc('0x28')](_0x52e766[_0xc0cc('0x31')],function(_0x3038a7){var _0x4d0841={};_0x4d0841[_0x3038a7]={'$like':'%'+_0x49cf34[_0xc0cc('0x2f')]['filter']+'%'};return _0x4d0841;})});}_0x52e766=_[_0xc0cc('0x39')]({},_0x52e766,_0x49cf34['options']);return _0x51f562[_0xc0cc('0x4a')](_0x52e766);}})['then'](function(_0x402495){if(_0x402495){_0x127d96=_0x402495[_0xc0cc('0x42')];if(!_0x49cf34[_0xc0cc('0x2f')]['hasOwnProperty'](_0xc0cc('0x4b'))){_0x52e766[_0xc0cc('0x1a')]=qs['limit'](_0x49cf34[_0xc0cc('0x2f')]['limit']);_0x52e766[_0xc0cc('0x18')]=qs['offset'](_0x49cf34[_0xc0cc('0x2f')][_0xc0cc('0x18')]);}return _0x51f562[_0xc0cc('0x4a')](_0x52e766);}})[_0xc0cc('0x22')](function(_0x97ff0){if(_0x97ff0){return _0x97ff0?{'count':_0x127d96,'rows':_0x97ff0}:null;}})[_0xc0cc('0x22')](respondWithResult(_0xf85387,null))[_0xc0cc('0x3e')](handleError(_0xf85387,null));};exports[_0xc0cc('0x4c')]=function(_0x234764,_0x5e366b,_0xbe0cbe){var _0x5cc561={};var _0x59f464={};var _0x1d04d0;var _0x40478a;return db[_0xc0cc('0x29')][_0xc0cc('0x47')]({'where':{'id':_0x234764[_0xc0cc('0x40')]['id']}})[_0xc0cc('0x22')](handleEntityNotFound(_0x5e366b,null))[_0xc0cc('0x22')](function(_0x30b6e0){if(_0x30b6e0){_0x1d04d0=_0x30b6e0;_0x59f464[_0xc0cc('0x2e')]=_[_0xc0cc('0x41')](db['VtigerField'][_0xc0cc('0x2a')]);_0x59f464[_0xc0cc('0x2f')]=_[_0xc0cc('0x41')](_0x234764[_0xc0cc('0x2f')]);_0x59f464['filters']=_[_0xc0cc('0x32')](_0x59f464[_0xc0cc('0x2e')],_0x59f464['query']);_0x5cc561[_0xc0cc('0x31')]=_[_0xc0cc('0x32')](_0x59f464[_0xc0cc('0x2e')],qs[_0xc0cc('0x33')](_0x234764[_0xc0cc('0x2f')]['fields']));_0x5cc561['attributes']=_0x5cc561['attributes'][_0xc0cc('0x42')]?_0x5cc561['attributes']:_0x59f464['model'];_0x5cc561[_0xc0cc('0x35')]=qs[_0xc0cc('0x36')](_0x234764['query'][_0xc0cc('0x36')]);_0x5cc561[_0xc0cc('0x37')]=qs[_0xc0cc('0x30')](_[_0xc0cc('0x49')](_0x234764['query'],_0x59f464[_0xc0cc('0x30')]));if(_0x234764['query'][_0xc0cc('0x38')]){_0x5cc561[_0xc0cc('0x37')]=_[_0xc0cc('0x39')](_0x5cc561[_0xc0cc('0x37')],{'$or':_[_0xc0cc('0x28')](_0x5cc561['attributes'],function(_0x3fa456){var _0x1f8310={};_0x1f8310[_0x3fa456]={'$like':'%'+_0x234764[_0xc0cc('0x2f')][_0xc0cc('0x38')]+'%'};return _0x1f8310;})});}_0x5cc561=_[_0xc0cc('0x39')]({},_0x5cc561,_0x234764[_0xc0cc('0x3b')]);return _0x1d04d0[_0xc0cc('0x4c')](_0x5cc561);}})[_0xc0cc('0x22')](function(_0x2cd09f){if(_0x2cd09f){_0x40478a=_0x2cd09f[_0xc0cc('0x42')];if(!_0x234764[_0xc0cc('0x2f')][_0xc0cc('0x34')](_0xc0cc('0x4b'))){_0x5cc561[_0xc0cc('0x1a')]=qs['limit'](_0x234764[_0xc0cc('0x2f')][_0xc0cc('0x1a')]);_0x5cc561[_0xc0cc('0x18')]=qs[_0xc0cc('0x18')](_0x234764[_0xc0cc('0x2f')]['offset']);}return _0x1d04d0[_0xc0cc('0x4c')](_0x5cc561);}})[_0xc0cc('0x22')](function(_0x10eacc){if(_0x10eacc){return _0x10eacc?{'count':_0x40478a,'rows':_0x10eacc}:null;}})['then'](respondWithResult(_0x5e366b,null))['catch'](handleError(_0x5e366b,null));};exports['getDescriptions']=function(_0x334076,_0x546016,_0x520b9f){var _0x111991={};var _0x417533={};var _0x24984f;var _0x322ed0;return db['VtigerConfiguration'][_0xc0cc('0x47')]({'where':{'id':_0x334076[_0xc0cc('0x40')]['id']}})['then'](handleEntityNotFound(_0x546016,null))['then'](function(_0x4f3507){if(_0x4f3507){_0x24984f=_0x4f3507;_0x417533[_0xc0cc('0x2e')]=_[_0xc0cc('0x41')](db[_0xc0cc('0x48')]['rawAttributes']);_0x417533['query']=_[_0xc0cc('0x41')](_0x334076[_0xc0cc('0x2f')]);_0x417533[_0xc0cc('0x30')]=_[_0xc0cc('0x32')](_0x417533[_0xc0cc('0x2e')],_0x417533['query']);_0x111991[_0xc0cc('0x31')]=_[_0xc0cc('0x32')](_0x417533['model'],qs['fields'](_0x334076['query']['fields']));_0x111991[_0xc0cc('0x31')]=_0x111991[_0xc0cc('0x31')][_0xc0cc('0x42')]?_0x111991['attributes']:_0x417533[_0xc0cc('0x2e')];_0x111991[_0xc0cc('0x35')]=qs[_0xc0cc('0x36')](_0x334076[_0xc0cc('0x2f')]['sort']);_0x111991['where']=qs[_0xc0cc('0x30')](_[_0xc0cc('0x49')](_0x334076[_0xc0cc('0x2f')],_0x417533[_0xc0cc('0x30')]));if(_0x334076['query'][_0xc0cc('0x38')]){_0x111991[_0xc0cc('0x37')]=_[_0xc0cc('0x39')](_0x111991[_0xc0cc('0x37')],{'$or':_[_0xc0cc('0x28')](_0x111991['attributes'],function(_0x397101){var _0x5327f7={};_0x5327f7[_0x397101]={'$like':'%'+_0x334076['query'][_0xc0cc('0x38')]+'%'};return _0x5327f7;})});}_0x111991=_['merge']({},_0x111991,_0x334076[_0xc0cc('0x3b')]);return _0x24984f[_0xc0cc('0x4d')](_0x111991);}})[_0xc0cc('0x22')](function(_0x28936b){if(_0x28936b){_0x322ed0=_0x28936b[_0xc0cc('0x42')];if(!_0x334076[_0xc0cc('0x2f')][_0xc0cc('0x34')](_0xc0cc('0x4b'))){_0x111991[_0xc0cc('0x1a')]=qs['limit'](_0x334076[_0xc0cc('0x2f')][_0xc0cc('0x1a')]);_0x111991[_0xc0cc('0x18')]=qs['offset'](_0x334076[_0xc0cc('0x2f')][_0xc0cc('0x18')]);}return _0x24984f[_0xc0cc('0x4d')](_0x111991);}})[_0xc0cc('0x22')](function(_0x14b824){if(_0x14b824){return _0x14b824?{'count':_0x322ed0,'rows':_0x14b824}:null;}})[_0xc0cc('0x22')](respondWithResult(_0x546016,null))[_0xc0cc('0x3e')](handleError(_0x546016,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 81a3b6e..fa7d233 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 _0xd6ff=['api','moment','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash'];(function(_0x56a1af,_0x292ac7){var _0x48b496=function(_0x2b83c7){while(--_0x2b83c7){_0x56a1af['push'](_0x56a1af['shift']());}};_0x48b496(++_0x292ac7);}(_0xd6ff,0x1ca));var _0xfd6f=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0xd6ff[_0xde8111];return _0x29af0b;};'use strict';var _=require(_0xfd6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfd6f('0x1'));var moment=require(_0xfd6f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd6f('0x3'));var rimraf=require('rimraf');var config=require(_0xfd6f('0x4'));var attributes=require(_0xfd6f('0x5'));module[_0xfd6f('0x6')]=function(_0xf9c132,_0x1764be){return _0xf9c132[_0xfd6f('0x7')](_0xfd6f('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcaa=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xbcaa,0x1a3));var _0xabca=function(_0x4ed067,_0x4a63db){_0x4ed067=_0x4ed067-0x0;var _0x26c10f=_0xbcaa[_0x4ed067];return _0x26c10f;};'use strict';var _=require(_0xabca('0x0'));var util=require(_0xabca('0x1'));var logger=require(_0xabca('0x2'))('api');var moment=require(_0xabca('0x3'));var BPromise=require(_0xabca('0x4'));var rp=require(_0xabca('0x5'));var fs=require('fs');var path=require(_0xabca('0x6'));var rimraf=require(_0xabca('0x7'));var config=require(_0xabca('0x8'));var attributes=require(_0xabca('0x9'));module[_0xabca('0xa')]=function(_0x520c47,_0x4a95fb){return _0x520c47[_0xabca('0xb')](_0xabca('0xc'),attributes,{'tableName':_0xabca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index cb22660..ce40f32 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 _0xa9fb=['result','catch','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xa9fb,0xbd));var _0xba9f=function(_0x1a5de6,_0x35e934){_0x1a5de6=_0x1a5de6-0x0;var _0x1199f6=_0xa9fb[_0x1a5de6];return _0x1199f6;};'use strict';var _=require('lodash');var util=require(_0xba9f('0x0'));var moment=require(_0xba9f('0x1'));var BPromise=require(_0xba9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba9f('0x3'))('rpc');var config=require(_0xba9f('0x4'));var jayson=require(_0xba9f('0x5'));var client=jayson['client'][_0xba9f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x398573,_0x441ec6,_0x43e4cd){return new BPromise(function(_0x55668e,_0x2d9d59){return client[_0xba9f('0x7')](_0x398573,_0x43e4cd)['then'](function(_0x5cc5eb){logger[_0xba9f('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x441ec6,_0xba9f('0x9'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x441ec6,_0xba9f('0x9'),JSON[_0xba9f('0xa')](_0x5cc5eb));if(_0x5cc5eb[_0xba9f('0xb')]){if(_0x5cc5eb[_0xba9f('0xb')][_0xba9f('0xc')]===0x1f4){logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x5cc5eb[_0xba9f('0xb')][_0xba9f('0xe')]);return _0x2d9d59(_0x5cc5eb['error'][_0xba9f('0xe')]);}logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x5cc5eb['error'][_0xba9f('0xe')]);return _0x55668e(_0x5cc5eb['error'][_0xba9f('0xe')]);}else{logger[_0xba9f('0x8')](_0xba9f('0xd'),_0x441ec6,'request\x20sent');_0x55668e(_0x5cc5eb[_0xba9f('0xf')][_0xba9f('0xe')]);}})[_0xba9f('0x10')](function(_0x56467e){logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x56467e);_0x2d9d59(_0x56467e);});});} \ No newline at end of file +var _0x0d98=['stringify','code','error','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2f1537,_0xd53627){var _0x57f27e=function(_0x5a4b73){while(--_0x5a4b73){_0x2f1537['push'](_0x2f1537['shift']());}};_0x57f27e(++_0xd53627);}(_0x0d98,0xae));var _0x80d9=function(_0x9a30be,_0x3194d4){_0x9a30be=_0x9a30be-0x0;var _0x4541d5=_0x0d98[_0x9a30be];return _0x4541d5;};'use strict';var _=require('lodash');var util=require(_0x80d9('0x0'));var moment=require(_0x80d9('0x1'));var BPromise=require(_0x80d9('0x2'));var rs=require(_0x80d9('0x3'));var fs=require('fs');var Redis=require(_0x80d9('0x4'));var db=require(_0x80d9('0x5'))['db'];var utils=require(_0x80d9('0x6'));var logger=require(_0x80d9('0x7'))(_0x80d9('0x8'));var config=require(_0x80d9('0x9'));var jayson=require(_0x80d9('0xa'));var client=jayson[_0x80d9('0xb')][_0x80d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22c417,_0x77fe13,_0x332b40){return new BPromise(function(_0x5f4c92,_0x42782d){return client[_0x80d9('0xd')](_0x22c417,_0x332b40)[_0x80d9('0xe')](function(_0x2bb30b){logger['info'](_0x80d9('0xf'),_0x77fe13,_0x80d9('0x10'));logger['debug'](_0x80d9('0x11'),_0x77fe13,'request\x20sent',JSON[_0x80d9('0x12')](_0x2bb30b));if(_0x2bb30b['error']){if(_0x2bb30b['error'][_0x80d9('0x13')]===0x1f4){logger[_0x80d9('0x14')](_0x80d9('0xf'),_0x77fe13,_0x2bb30b['error'][_0x80d9('0x15')]);return _0x42782d(_0x2bb30b['error'][_0x80d9('0x15')]);}logger['error'](_0x80d9('0xf'),_0x77fe13,_0x2bb30b[_0x80d9('0x14')][_0x80d9('0x15')]);return _0x5f4c92(_0x2bb30b[_0x80d9('0x14')][_0x80d9('0x15')]);}else{logger[_0x80d9('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x77fe13,'request\x20sent');_0x5f4c92(_0x2bb30b[_0x80d9('0x17')][_0x80d9('0x15')]);}})['catch'](function(_0x5e4726){logger[_0x80d9('0x14')](_0x80d9('0xf'),_0x77fe13,_0x5e4726);_0x42782d(_0x5e4726);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4cce1b0..30a37dc 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 _0x997b=['get','index','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x997b,0x1d8));var _0xb997=function(_0x1305aa,_0x6ac1a7){_0x1305aa=_0x1305aa-0x0;var _0x32e378=_0x997b[_0x1305aa];return _0x32e378;};'use strict';var multer=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var path=require(_0xb997('0x2'));var timeout=require(_0xb997('0x3'));var express=require(_0xb997('0x4'));var router=express[_0xb997('0x5')]();var fs_extra=require(_0xb997('0x6'));var auth=require(_0xb997('0x7'));var interaction=require(_0xb997('0x8'));var config=require(_0xb997('0x9'));var controller=require(_0xb997('0xa'));router[_0xb997('0xb')]('/',auth['isAuthenticated'](),controller[_0xb997('0xc')]);router[_0xb997('0xb')](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0xf')]);router[_0xb997('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0x11')]);router[_0xb997('0x12')](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0x13')]);module[_0xb997('0x14')]=router; \ No newline at end of file +var _0x7e2f=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','put'];(function(_0x5f18d7,_0x15b0dc){var _0x4f0f58=function(_0x313ccd){while(--_0x313ccd){_0x5f18d7['push'](_0x5f18d7['shift']());}};_0x4f0f58(++_0x15b0dc);}(_0x7e2f,0x1c5));var _0xf7e2=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x7e2f[_0x1e9424];return _0x1bd96c;};'use strict';var multer=require(_0xf7e2('0x0'));var util=require(_0xf7e2('0x1'));var path=require('path');var timeout=require(_0xf7e2('0x2'));var express=require(_0xf7e2('0x3'));var router=express[_0xf7e2('0x4')]();var fs_extra=require(_0xf7e2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf7e2('0x6'));var config=require(_0xf7e2('0x7'));var controller=require(_0xf7e2('0x8'));router[_0xf7e2('0x9')]('/',auth[_0xf7e2('0xa')](),controller['index']);router[_0xf7e2('0x9')](_0xf7e2('0xb'),auth[_0xf7e2('0xa')](),controller[_0xf7e2('0xc')]);router[_0xf7e2('0xd')]('/',auth[_0xf7e2('0xa')](),controller['create']);router[_0xf7e2('0xe')](_0xf7e2('0xb'),auth[_0xf7e2('0xa')](),controller[_0xf7e2('0xf')]);router['delete']('/:id',auth[_0xf7e2('0xa')](),controller[_0xf7e2('0x10')]);module[_0xf7e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c400767..4adec43 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 _0x2e4f=['BOOLEAN','sequelize','exports','keyValue','picklist','string','STRING','ENUM','variable'];(function(_0x39597a,_0x4a11c0){var _0x135aba=function(_0x79f73){while(--_0x79f73){_0x39597a['push'](_0x39597a['shift']());}};_0x135aba(++_0x4a11c0);}(_0x2e4f,0xeb));var _0xf2e4=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x2e4f[_0x543c51];return _0x360555;};'use strict';var Sequelize=require(_0xf2e4('0x0'));module[_0xf2e4('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xf2e4('0x2'),_0xf2e4('0x3')),'defaultValue':_0xf2e4('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf2e4('0x5')]},'keyType':{'type':Sequelize[_0xf2e4('0x6')]('string',_0xf2e4('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf2e4('0x5')]},'nameField':{'type':Sequelize[_0xf2e4('0x5')]},'customField':{'type':Sequelize[_0xf2e4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf2e4('0x5')]}}; \ No newline at end of file +var _0x2d4b=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2d4b,0xc3));var _0xb2d4=function(_0x1ea551,_0x47616c){_0x1ea551=_0x1ea551-0x0;var _0x53112a=_0x2d4b[_0x1ea551];return _0x53112a;};'use strict';var Sequelize=require(_0xb2d4('0x0'));module[_0xb2d4('0x1')]={'type':{'type':Sequelize[_0xb2d4('0x2')](_0xb2d4('0x3'),'variable',_0xb2d4('0x4'),'keyValue',_0xb2d4('0x5')),'defaultValue':_0xb2d4('0x3')},'content':{'type':Sequelize[_0xb2d4('0x6')]},'key':{'type':Sequelize[_0xb2d4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xb2d4('0x3'),'variable',_0xb2d4('0x4'))},'keyContent':{'type':Sequelize[_0xb2d4('0x6')]},'idField':{'type':Sequelize[_0xb2d4('0x6')]},'nameField':{'type':Sequelize[_0xb2d4('0x6')]},'customField':{'type':Sequelize[_0xb2d4('0x7')],'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 08a23d2..807bb32 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 _0xb3b5=['update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VtigerField','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','json','reject','save'];(function(_0x13c237,_0x49d6e2){var _0x4e593f=function(_0x50565b){while(--_0x50565b){_0x13c237['push'](_0x13c237['shift']());}};_0x4e593f(++_0x49d6e2);}(_0xb3b5,0x160));var _0x5b3b=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xb3b5[_0x34e752];return _0x7c6347;};'use strict';var emlformat=require(_0x5b3b('0x0'));var rimraf=require(_0x5b3b('0x1'));var zipdir=require(_0x5b3b('0x2'));var jsonpatch=require(_0x5b3b('0x3'));var rp=require(_0x5b3b('0x4'));var moment=require(_0x5b3b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5b3b('0x6'));var util=require(_0x5b3b('0x7'));var path=require(_0x5b3b('0x8'));var sox=require(_0x5b3b('0x9'));var csv=require(_0x5b3b('0xa'));var ejs=require(_0x5b3b('0xb'));var fs=require('fs');var fs_extra=require(_0x5b3b('0xc'));var _=require(_0x5b3b('0xd'));var squel=require(_0x5b3b('0xe'));var crypto=require(_0x5b3b('0xf'));var jsforce=require(_0x5b3b('0x10'));var deskjs=require(_0x5b3b('0x11'));var toCsv=require(_0x5b3b('0xa'));var querystring=require('querystring');var Papa=require(_0x5b3b('0x12'));var Redis=require(_0x5b3b('0x13'));var authService=require(_0x5b3b('0x14'));var qs=require(_0x5b3b('0x15'));var as=require(_0x5b3b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b3b('0x17'))(_0x5b3b('0x18'));var utils=require(_0x5b3b('0x19'));var config=require(_0x5b3b('0x1a'));var licenseUtil=require(_0x5b3b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54a69e,_0xd34601){_0xd34601=_0xd34601||0xcc;return function(_0x1dce36){if(_0x1dce36){return _0x54a69e[_0x5b3b('0x1c')](_0xd34601);}return _0x54a69e['status'](_0xd34601)[_0x5b3b('0x1d')]();};}function respondWithResult(_0x40b8c9,_0x2df775){_0x2df775=_0x2df775||0xc8;return function(_0x10df6a){if(_0x10df6a){return _0x40b8c9[_0x5b3b('0x1e')](_0x2df775)['json'](_0x10df6a);}};}function respondWithFilteredResult(_0x2054f,_0x10aa5f){return function(_0x54ff25){if(_0x54ff25){var _0x3ee046=typeof _0x10aa5f[_0x5b3b('0x1f')]===_0x5b3b('0x20')&&typeof _0x10aa5f[_0x5b3b('0x21')]==='undefined';var _0x2989cc=_0x54ff25[_0x5b3b('0x22')];var _0x459f51=_0x3ee046?0x0:_0x10aa5f[_0x5b3b('0x1f')];var _0x16e428=_0x3ee046?_0x54ff25[_0x5b3b('0x22')]:_0x10aa5f[_0x5b3b('0x1f')]+_0x10aa5f['limit'];var _0xf1baea;if(_0x16e428>=_0x2989cc){_0x16e428=_0x2989cc;_0xf1baea=0xc8;}else{_0xf1baea=0xce;}_0x2054f['status'](_0xf1baea);return _0x2054f['set']('Content-Range',_0x459f51+'-'+_0x16e428+'/'+_0x2989cc)[_0x5b3b('0x23')](_0x54ff25);}return null;};}function patchUpdates(_0x1f2ce9){return function(_0x20f4e7){try{jsonpatch['apply'](_0x20f4e7,_0x1f2ce9,!![]);}catch(_0x558a7c){return BPromise[_0x5b3b('0x24')](_0x558a7c);}return _0x20f4e7[_0x5b3b('0x25')]();};}function saveUpdates(_0x5478c3,_0x573228){return function(_0x1d2d98){if(_0x1d2d98){return _0x1d2d98[_0x5b3b('0x26')](_0x5478c3)[_0x5b3b('0x27')](function(_0x15d908){return _0x15d908;});}return null;};}function removeEntity(_0x2ef693,_0x41893d){return function(_0x9e677){if(_0x9e677){return _0x9e677['destroy']()[_0x5b3b('0x27')](function(){_0x2ef693['status'](0xcc)[_0x5b3b('0x1d')]();});}};}function handleEntityNotFound(_0x3b8252,_0x42b141){return function(_0xfc25fe){if(!_0xfc25fe){_0x3b8252[_0x5b3b('0x1c')](0x194);}return _0xfc25fe;};}function handleError(_0x1f3c66,_0x3160e8){_0x3160e8=_0x3160e8||0x1f4;return function(_0x3a862b){logger[_0x5b3b('0x28')](_0x3a862b[_0x5b3b('0x29')]);if(_0x3a862b[_0x5b3b('0x2a')]){delete _0x3a862b[_0x5b3b('0x2a')];}_0x1f3c66[_0x5b3b('0x1e')](_0x3160e8)['send'](_0x3a862b);};}exports[_0x5b3b('0x2b')]=function(_0x7ac2f6,_0x15f5af){var _0x58a710={},_0x49929b={},_0x11e597={'count':0x0,'rows':[]};var _0x5edbbb=_['map'](db['VtigerField'][_0x5b3b('0x2c')],function(_0x5ed718){return{'name':_0x5ed718[_0x5b3b('0x2d')],'type':_0x5ed718[_0x5b3b('0x2e')][_0x5b3b('0x2f')]};});_0x49929b[_0x5b3b('0x30')]=_[_0x5b3b('0x31')](_0x5edbbb,_0x5b3b('0x2a'));_0x49929b['query']=_[_0x5b3b('0x32')](_0x7ac2f6[_0x5b3b('0x33')]);_0x49929b[_0x5b3b('0x34')]=_[_0x5b3b('0x35')](_0x49929b[_0x5b3b('0x30')],_0x49929b[_0x5b3b('0x33')]);_0x58a710[_0x5b3b('0x36')]=_['intersection'](_0x49929b[_0x5b3b('0x30')],qs['fields'](_0x7ac2f6['query'][_0x5b3b('0x37')]));_0x58a710[_0x5b3b('0x36')]=_0x58a710[_0x5b3b('0x36')][_0x5b3b('0x38')]?_0x58a710[_0x5b3b('0x36')]:_0x49929b['model'];if(!_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x39')](_0x5b3b('0x3a'))){_0x58a710[_0x5b3b('0x21')]=qs['limit'](_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x21')]);_0x58a710['offset']=qs['offset'](_0x7ac2f6[_0x5b3b('0x33')]['offset']);}_0x58a710[_0x5b3b('0x3b')]=qs[_0x5b3b('0x3c')](_0x7ac2f6[_0x5b3b('0x33')]['sort']);_0x58a710[_0x5b3b('0x3d')]=qs[_0x5b3b('0x34')](_[_0x5b3b('0x3e')](_0x7ac2f6['query'],_0x49929b[_0x5b3b('0x34')]),_0x5edbbb);if(_0x7ac2f6[_0x5b3b('0x33')]['filter']){_0x58a710[_0x5b3b('0x3d')]=_[_0x5b3b('0x3f')](_0x58a710[_0x5b3b('0x3d')],{'$or':_[_0x5b3b('0x31')](_0x5edbbb,function(_0xce86e6){if(_0xce86e6[_0x5b3b('0x2e')]!==_0x5b3b('0x40')){var _0x424507={};_0x424507[_0xce86e6[_0x5b3b('0x2a')]]={'$like':'%'+_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x41')]+'%'};return _0x424507;}})});}_0x58a710=_[_0x5b3b('0x3f')]({},_0x58a710,_0x7ac2f6[_0x5b3b('0x42')]);var _0x53735c={'where':_0x58a710[_0x5b3b('0x3d')]};return db[_0x5b3b('0x43')][_0x5b3b('0x22')](_0x53735c)[_0x5b3b('0x27')](function(_0x1dffc2){_0x11e597['count']=_0x1dffc2;if(_0x7ac2f6['query']['includeAll']){_0x58a710[_0x5b3b('0x44')]=[{'all':!![]}];}return db[_0x5b3b('0x43')][_0x5b3b('0x45')](_0x58a710);})[_0x5b3b('0x27')](function(_0x3f2522){_0x11e597[_0x5b3b('0x46')]=_0x3f2522;return _0x11e597;})['then'](respondWithFilteredResult(_0x15f5af,_0x58a710))[_0x5b3b('0x47')](handleError(_0x15f5af,null));};exports['show']=function(_0x549d21,_0x4c7591){var _0x247490={'raw':!![],'where':{'id':_0x549d21[_0x5b3b('0x48')]['id']}},_0x4e7d46={};_0x4e7d46[_0x5b3b('0x30')]=_[_0x5b3b('0x32')](db['VtigerField'][_0x5b3b('0x2c')]);_0x4e7d46[_0x5b3b('0x33')]=_[_0x5b3b('0x32')](_0x549d21[_0x5b3b('0x33')]);_0x4e7d46[_0x5b3b('0x34')]=_['intersection'](_0x4e7d46[_0x5b3b('0x30')],_0x4e7d46['query']);_0x247490[_0x5b3b('0x36')]=_[_0x5b3b('0x35')](_0x4e7d46[_0x5b3b('0x30')],qs[_0x5b3b('0x37')](_0x549d21[_0x5b3b('0x33')][_0x5b3b('0x37')]));_0x247490[_0x5b3b('0x36')]=_0x247490[_0x5b3b('0x36')][_0x5b3b('0x38')]?_0x247490[_0x5b3b('0x36')]:_0x4e7d46[_0x5b3b('0x30')];if(_0x549d21['query'][_0x5b3b('0x49')]){_0x247490[_0x5b3b('0x44')]=[{'all':!![]}];}_0x247490=_[_0x5b3b('0x3f')]({},_0x247490,_0x549d21[_0x5b3b('0x42')]);return db[_0x5b3b('0x43')][_0x5b3b('0x4a')](_0x247490)[_0x5b3b('0x27')](handleEntityNotFound(_0x4c7591,null))[_0x5b3b('0x27')](respondWithResult(_0x4c7591,null))['catch'](handleError(_0x4c7591,null));};exports[_0x5b3b('0x4b')]=function(_0x2acd47,_0x3af8a1){return db[_0x5b3b('0x43')][_0x5b3b('0x4b')](_0x2acd47[_0x5b3b('0x4c')],{})[_0x5b3b('0x27')](respondWithResult(_0x3af8a1,0xc9))[_0x5b3b('0x47')](handleError(_0x3af8a1,null));};exports['update']=function(_0x4a105b,_0x18424d){if(_0x4a105b['body']['id']){delete _0x4a105b[_0x5b3b('0x4c')]['id'];}return db[_0x5b3b('0x43')][_0x5b3b('0x4a')]({'where':{'id':_0x4a105b['params']['id']}})[_0x5b3b('0x27')](handleEntityNotFound(_0x18424d,null))[_0x5b3b('0x27')](saveUpdates(_0x4a105b[_0x5b3b('0x4c')],null))[_0x5b3b('0x27')](respondWithResult(_0x18424d,null))['catch'](handleError(_0x18424d,null));};exports[_0x5b3b('0x4d')]=function(_0x11fc7b,_0x3aebe3){return db['VtigerField']['find']({'where':{'id':_0x11fc7b['params']['id']}})['then'](handleEntityNotFound(_0x3aebe3,null))[_0x5b3b('0x27')](removeEntity(_0x3aebe3,null))[_0x5b3b('0x47')](handleError(_0x3aebe3,null));}; \ No newline at end of file +var _0xacfb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','params','length','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x327e5e,_0x789c83){var _0x75f53d=function(_0x250a29){while(--_0x250a29){_0x327e5e['push'](_0x327e5e['shift']());}};_0x75f53d(++_0x789c83);}(_0xacfb,0xca));var _0xbacf=function(_0x39e8e0,_0x5aa6ed){_0x39e8e0=_0x39e8e0-0x0;var _0x415581=_0xacfb[_0x39e8e0];return _0x415581;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbacf('0x0'));var zipdir=require(_0xbacf('0x1'));var jsonpatch=require(_0xbacf('0x2'));var rp=require('request-promise');var moment=require(_0xbacf('0x3'));var BPromise=require(_0xbacf('0x4'));var Mustache=require(_0xbacf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbacf('0x6'));var csv=require(_0xbacf('0x7'));var ejs=require(_0xbacf('0x8'));var fs=require('fs');var fs_extra=require(_0xbacf('0x9'));var _=require('lodash');var squel=require(_0xbacf('0xa'));var crypto=require(_0xbacf('0xb'));var jsforce=require(_0xbacf('0xc'));var deskjs=require(_0xbacf('0xd'));var toCsv=require(_0xbacf('0x7'));var querystring=require('querystring');var Papa=require(_0xbacf('0xe'));var Redis=require(_0xbacf('0xf'));var authService=require(_0xbacf('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbacf('0x11'));var logger=require(_0xbacf('0x12'))(_0xbacf('0x13'));var utils=require(_0xbacf('0x14'));var config=require(_0xbacf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbacf('0x16'))['db'];function respondWithStatusCode(_0x770e70,_0x6dbfec){_0x6dbfec=_0x6dbfec||0xcc;return function(_0x4f864c){if(_0x4f864c){return _0x770e70[_0xbacf('0x17')](_0x6dbfec);}return _0x770e70[_0xbacf('0x18')](_0x6dbfec)[_0xbacf('0x19')]();};}function respondWithResult(_0x443700,_0x2cd92a){_0x2cd92a=_0x2cd92a||0xc8;return function(_0x1941c9){if(_0x1941c9){return _0x443700[_0xbacf('0x18')](_0x2cd92a)['json'](_0x1941c9);}};}function respondWithFilteredResult(_0x4301e8,_0x308058){return function(_0x4de54d){if(_0x4de54d){var _0xe1ae9=typeof _0x308058[_0xbacf('0x1a')]===_0xbacf('0x1b')&&typeof _0x308058[_0xbacf('0x1c')]===_0xbacf('0x1b');var _0x105b46=_0x4de54d[_0xbacf('0x1d')];var _0x39b5e6=_0xe1ae9?0x0:_0x308058[_0xbacf('0x1a')];var _0x4d11ff=_0xe1ae9?_0x4de54d[_0xbacf('0x1d')]:_0x308058[_0xbacf('0x1a')]+_0x308058[_0xbacf('0x1c')];var _0xe2793c;if(_0x4d11ff>=_0x105b46){_0x4d11ff=_0x105b46;_0xe2793c=0xc8;}else{_0xe2793c=0xce;}_0x4301e8[_0xbacf('0x18')](_0xe2793c);return _0x4301e8[_0xbacf('0x1e')](_0xbacf('0x1f'),_0x39b5e6+'-'+_0x4d11ff+'/'+_0x105b46)[_0xbacf('0x20')](_0x4de54d);}return null;};}function patchUpdates(_0x4b9502){return function(_0x43ff73){try{jsonpatch[_0xbacf('0x21')](_0x43ff73,_0x4b9502,!![]);}catch(_0x4931bb){return BPromise['reject'](_0x4931bb);}return _0x43ff73[_0xbacf('0x22')]();};}function saveUpdates(_0x45a461,_0xd61369){return function(_0x12cba0){if(_0x12cba0){return _0x12cba0['update'](_0x45a461)['then'](function(_0x12bfec){return _0x12bfec;});}return null;};}function removeEntity(_0x2a9a0f,_0x425cd8){return function(_0x7951f3){if(_0x7951f3){return _0x7951f3[_0xbacf('0x23')]()[_0xbacf('0x24')](function(){_0x2a9a0f[_0xbacf('0x18')](0xcc)[_0xbacf('0x19')]();});}};}function handleEntityNotFound(_0x5ce98e,_0x4ce5ef){return function(_0x297b86){if(!_0x297b86){_0x5ce98e[_0xbacf('0x17')](0x194);}return _0x297b86;};}function handleError(_0x3b9938,_0x3f21d2){_0x3f21d2=_0x3f21d2||0x1f4;return function(_0x454aa3){logger[_0xbacf('0x25')](_0x454aa3[_0xbacf('0x26')]);if(_0x454aa3[_0xbacf('0x27')]){delete _0x454aa3[_0xbacf('0x27')];}_0x3b9938[_0xbacf('0x18')](_0x3f21d2)['send'](_0x454aa3);};}exports[_0xbacf('0x28')]=function(_0x510651,_0xb841b2){var _0x2b4187={},_0x291298={},_0x2d417f={'count':0x0,'rows':[]};var _0x4a28ed=_[_0xbacf('0x29')](db['VtigerField'][_0xbacf('0x2a')],function(_0x816248){return{'name':_0x816248['fieldName'],'type':_0x816248[_0xbacf('0x2b')][_0xbacf('0x2c')]};});_0x291298[_0xbacf('0x2d')]=_['map'](_0x4a28ed,_0xbacf('0x27'));_0x291298['query']=_[_0xbacf('0x2e')](_0x510651[_0xbacf('0x2f')]);_0x291298['filters']=_[_0xbacf('0x30')](_0x291298[_0xbacf('0x2d')],_0x291298[_0xbacf('0x2f')]);_0x2b4187[_0xbacf('0x31')]=_[_0xbacf('0x30')](_0x291298[_0xbacf('0x2d')],qs[_0xbacf('0x32')](_0x510651[_0xbacf('0x2f')][_0xbacf('0x32')]));_0x2b4187[_0xbacf('0x31')]=_0x2b4187[_0xbacf('0x31')]['length']?_0x2b4187[_0xbacf('0x31')]:_0x291298[_0xbacf('0x2d')];if(!_0x510651[_0xbacf('0x2f')][_0xbacf('0x33')](_0xbacf('0x34'))){_0x2b4187['limit']=qs[_0xbacf('0x1c')](_0x510651[_0xbacf('0x2f')]['limit']);_0x2b4187[_0xbacf('0x1a')]=qs['offset'](_0x510651[_0xbacf('0x2f')][_0xbacf('0x1a')]);}_0x2b4187[_0xbacf('0x35')]=qs['sort'](_0x510651[_0xbacf('0x2f')][_0xbacf('0x36')]);_0x2b4187['where']=qs['filters'](_['pick'](_0x510651[_0xbacf('0x2f')],_0x291298[_0xbacf('0x37')]),_0x4a28ed);if(_0x510651[_0xbacf('0x2f')][_0xbacf('0x38')]){_0x2b4187['where']=_[_0xbacf('0x39')](_0x2b4187[_0xbacf('0x3a')],{'$or':_[_0xbacf('0x29')](_0x4a28ed,function(_0x2b2394){if(_0x2b2394[_0xbacf('0x2b')]!==_0xbacf('0x3b')){var _0x47e9c3={};_0x47e9c3[_0x2b2394[_0xbacf('0x27')]]={'$like':'%'+_0x510651[_0xbacf('0x2f')][_0xbacf('0x38')]+'%'};return _0x47e9c3;}})});}_0x2b4187=_[_0xbacf('0x39')]({},_0x2b4187,_0x510651[_0xbacf('0x3c')]);var _0x281904={'where':_0x2b4187[_0xbacf('0x3a')]};return db[_0xbacf('0x3d')][_0xbacf('0x1d')](_0x281904)[_0xbacf('0x24')](function(_0x1cd901){_0x2d417f['count']=_0x1cd901;if(_0x510651[_0xbacf('0x2f')][_0xbacf('0x3e')]){_0x2b4187[_0xbacf('0x3f')]=[{'all':!![]}];}return db[_0xbacf('0x3d')][_0xbacf('0x40')](_0x2b4187);})['then'](function(_0x1d5cd8){_0x2d417f[_0xbacf('0x41')]=_0x1d5cd8;return _0x2d417f;})[_0xbacf('0x24')](respondWithFilteredResult(_0xb841b2,_0x2b4187))['catch'](handleError(_0xb841b2,null));};exports['show']=function(_0x568221,_0x22e959){var _0x8bce22={'raw':!![],'where':{'id':_0x568221[_0xbacf('0x42')]['id']}},_0xb58ef2={};_0xb58ef2[_0xbacf('0x2d')]=_[_0xbacf('0x2e')](db[_0xbacf('0x3d')][_0xbacf('0x2a')]);_0xb58ef2[_0xbacf('0x2f')]=_[_0xbacf('0x2e')](_0x568221[_0xbacf('0x2f')]);_0xb58ef2[_0xbacf('0x37')]=_[_0xbacf('0x30')](_0xb58ef2[_0xbacf('0x2d')],_0xb58ef2[_0xbacf('0x2f')]);_0x8bce22[_0xbacf('0x31')]=_[_0xbacf('0x30')](_0xb58ef2['model'],qs[_0xbacf('0x32')](_0x568221[_0xbacf('0x2f')][_0xbacf('0x32')]));_0x8bce22['attributes']=_0x8bce22[_0xbacf('0x31')][_0xbacf('0x43')]?_0x8bce22[_0xbacf('0x31')]:_0xb58ef2['model'];if(_0x568221[_0xbacf('0x2f')]['includeAll']){_0x8bce22[_0xbacf('0x3f')]=[{'all':!![]}];}_0x8bce22=_[_0xbacf('0x39')]({},_0x8bce22,_0x568221[_0xbacf('0x3c')]);return db[_0xbacf('0x3d')][_0xbacf('0x44')](_0x8bce22)[_0xbacf('0x24')](handleEntityNotFound(_0x22e959,null))[_0xbacf('0x24')](respondWithResult(_0x22e959,null))[_0xbacf('0x45')](handleError(_0x22e959,null));};exports[_0xbacf('0x46')]=function(_0x55abb3,_0x56f8b5){return db['VtigerField'][_0xbacf('0x46')](_0x55abb3[_0xbacf('0x47')],{})['then'](respondWithResult(_0x56f8b5,0xc9))['catch'](handleError(_0x56f8b5,null));};exports[_0xbacf('0x48')]=function(_0x5a5330,_0x279e30){if(_0x5a5330[_0xbacf('0x47')]['id']){delete _0x5a5330[_0xbacf('0x47')]['id'];}return db[_0xbacf('0x3d')][_0xbacf('0x44')]({'where':{'id':_0x5a5330[_0xbacf('0x42')]['id']}})['then'](handleEntityNotFound(_0x279e30,null))[_0xbacf('0x24')](saveUpdates(_0x5a5330['body'],null))[_0xbacf('0x24')](respondWithResult(_0x279e30,null))[_0xbacf('0x45')](handleError(_0x279e30,null));};exports['destroy']=function(_0x1616dc,_0x24b5b7){return db['VtigerField'][_0xbacf('0x44')]({'where':{'id':_0x1616dc[_0xbacf('0x42')]['id']}})[_0xbacf('0x24')](handleEntityNotFound(_0x24b5b7,null))['then'](removeEntity(_0x24b5b7,null))[_0xbacf('0x45')](handleError(_0x24b5b7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5ec2da2..e843078 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 _0xcf56=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcf56,0x13a));var _0x6cf5=function(_0x4965ce,_0x51c0bd){_0x4965ce=_0x4965ce-0x0;var _0x286b20=_0xcf56[_0x4965ce];return _0x286b20;};'use strict';var _=require(_0x6cf5('0x0'));var util=require(_0x6cf5('0x1'));var logger=require(_0x6cf5('0x2'))(_0x6cf5('0x3'));var moment=require(_0x6cf5('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf5('0x6'));var config=require(_0x6cf5('0x7'));var attributes=require(_0x6cf5('0x8'));module[_0x6cf5('0x9')]=function(_0x2269e5,_0x2e89e9){return _0x2269e5[_0x6cf5('0xa')](_0x6cf5('0xb'),attributes,{'tableName':_0x6cf5('0xc'),'paranoid':![],'indexes':[{'name':_0x6cf5('0xd'),'fields':[_0x6cf5('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb022=['define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5cba6d,_0x16c6ca){var _0x57aae4=function(_0x2de051){while(--_0x2de051){_0x5cba6d['push'](_0x5cba6d['shift']());}};_0x57aae4(++_0x16c6ca);}(_0xb022,0xac));var _0x2b02=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xb022[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var logger=require(_0x2b02('0x2'))('api');var moment=require(_0x2b02('0x3'));var BPromise=require(_0x2b02('0x4'));var rp=require(_0x2b02('0x5'));var fs=require('fs');var path=require(_0x2b02('0x6'));var rimraf=require('rimraf');var config=require(_0x2b02('0x7'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x2308f2,_0x5d3b98){return _0x2308f2[_0x2b02('0x8')](_0x2b02('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x2b02('0xa'),'fields':[_0x2b02('0xb'),'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 1174eff..0d481a0 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 _0xa6a6=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x129056,_0x3ea106){var _0x455cc5=function(_0x3c725e){while(--_0x3c725e){_0x129056['push'](_0x129056['shift']());}};_0x455cc5(++_0x3ea106);}(_0xa6a6,0x1d4));var _0x6a6a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa6a6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6a6a('0x0'));var util=require(_0x6a6a('0x1'));var moment=require('moment');var BPromise=require(_0x6a6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a6a('0x3'));var db=require(_0x6a6a('0x4'))['db'];var utils=require(_0x6a6a('0x5'));var logger=require(_0x6a6a('0x6'))('rpc');var config=require(_0x6a6a('0x7'));var jayson=require(_0x6a6a('0x8'));var client=jayson['client'][_0x6a6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c024,_0xac12fe,_0x435483){return new BPromise(function(_0x5f15a6,_0x49f34e){return client[_0x6a6a('0xa')](_0x49c024,_0x435483)['then'](function(_0x152f91){logger[_0x6a6a('0xb')](_0x6a6a('0xc'),_0xac12fe,'request\x20sent');logger[_0x6a6a('0xd')](_0x6a6a('0xe'),_0xac12fe,_0x6a6a('0xf'),JSON[_0x6a6a('0x10')](_0x152f91));if(_0x152f91[_0x6a6a('0x11')]){if(_0x152f91['error'][_0x6a6a('0x12')]===0x1f4){logger[_0x6a6a('0x11')](_0x6a6a('0xc'),_0xac12fe,_0x152f91[_0x6a6a('0x11')]['message']);return _0x49f34e(_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);}logger[_0x6a6a('0x11')](_0x6a6a('0xc'),_0xac12fe,_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);return _0x5f15a6(_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);}else{logger[_0x6a6a('0xb')]('VtigerField,\x20%s,\x20%s',_0xac12fe,_0x6a6a('0xf'));_0x5f15a6(_0x152f91['result'][_0x6a6a('0x13')]);}})[_0x6a6a('0x14')](function(_0x470374){logger[_0x6a6a('0x11')]('VtigerField,\x20%s,\x20%s',_0xac12fe,_0x470374);_0x49f34e(_0x470374);});});} \ No newline at end of file +var _0xb201=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4dcfd5,_0x30c662){var _0xbaf1ec=function(_0x13e068){while(--_0x13e068){_0x4dcfd5['push'](_0x4dcfd5['shift']());}};_0xbaf1ec(++_0x30c662);}(_0xb201,0x1b1));var _0x1b20=function(_0x5cc294,_0x3cdfe9){_0x5cc294=_0x5cc294-0x0;var _0x247220=_0xb201[_0x5cc294];return _0x247220;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var moment=require(_0x1b20('0x1'));var BPromise=require(_0x1b20('0x2'));var rs=require(_0x1b20('0x3'));var fs=require('fs');var Redis=require(_0x1b20('0x4'));var db=require(_0x1b20('0x5'))['db'];var utils=require(_0x1b20('0x6'));var logger=require('../../config/logger')(_0x1b20('0x7'));var config=require(_0x1b20('0x8'));var jayson=require(_0x1b20('0x9'));var client=jayson['client'][_0x1b20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50cdbc,_0x34304b,_0x2a184f){return new BPromise(function(_0x3cc600,_0x426ae9){return client['request'](_0x50cdbc,_0x2a184f)[_0x1b20('0xb')](function(_0x1f5ae4){logger[_0x1b20('0xc')]('VtigerField,\x20%s,\x20%s',_0x34304b,_0x1b20('0xd'));logger['debug'](_0x1b20('0xe'),_0x34304b,'request\x20sent',JSON['stringify'](_0x1f5ae4));if(_0x1f5ae4[_0x1b20('0xf')]){if(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x10')]===0x1f4){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x426ae9(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x3cc600(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}else{logger['info'](_0x1b20('0x11'),_0x34304b,'request\x20sent');_0x3cc600(_0x1f5ae4[_0x1b20('0x13')][_0x1b20('0x12')]);}})['catch'](function(_0x44e713){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x44e713);_0x426ae9(_0x44e713);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index dfc809a..11854dc 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 _0x5502=['./intZendeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x411eb3,_0x5ee8bd){var _0x226d64=function(_0x4144ad){while(--_0x4144ad){_0x411eb3['push'](_0x411eb3['shift']());}};_0x226d64(++_0x5ee8bd);}(_0x5502,0x69));var _0x2550=function(_0x26c80d,_0x20001f){_0x26c80d=_0x26c80d-0x0;var _0x5dbd87=_0x5502[_0x26c80d];return _0x5dbd87;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express[_0x2550('0x5')]();var fs_extra=require(_0x2550('0x6'));var auth=require(_0x2550('0x7'));var interaction=require(_0x2550('0x8'));var config=require(_0x2550('0x9'));var controller=require(_0x2550('0xa'));router[_0x2550('0xb')]('/',auth[_0x2550('0xc')](),controller['index']);router[_0x2550('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2550('0xd')]);router[_0x2550('0xb')]('/:id/configurations',auth[_0x2550('0xc')](),controller['getConfigurations']);router[_0x2550('0xb')](_0x2550('0xe'),auth[_0x2550('0xc')](),controller[_0x2550('0xf')]);router[_0x2550('0x10')]('/',auth[_0x2550('0xc')](),controller['create']);router[_0x2550('0x10')](_0x2550('0x11'),auth[_0x2550('0xc')](),controller[_0x2550('0x12')]);router['put'](_0x2550('0x13'),auth[_0x2550('0xc')](),controller['update']);router[_0x2550('0x14')](_0x2550('0x13'),auth[_0x2550('0xc')](),controller[_0x2550('0x15')]);module[_0x2550('0x16')]=router; \ No newline at end of file +var _0x1cfe=['getFields','post','create','addConfiguration','put','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields'];(function(_0x136d4f,_0x187d63){var _0x5166b2=function(_0x569116){while(--_0x569116){_0x136d4f['push'](_0x136d4f['shift']());}};_0x5166b2(++_0x187d63);}(_0x1cfe,0xcf));var _0xe1cf=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1cfe[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xe1cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe1cf('0x1'));var express=require(_0xe1cf('0x2'));var router=express[_0xe1cf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe1cf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe1cf('0x5'));var controller=require(_0xe1cf('0x6'));router[_0xe1cf('0x7')]('/',auth[_0xe1cf('0x8')](),controller[_0xe1cf('0x9')]);router[_0xe1cf('0x7')](_0xe1cf('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe1cf('0xb'),auth[_0xe1cf('0x8')](),controller['getConfigurations']);router[_0xe1cf('0x7')](_0xe1cf('0xc'),auth[_0xe1cf('0x8')](),controller[_0xe1cf('0xd')]);router[_0xe1cf('0xe')]('/',auth[_0xe1cf('0x8')](),controller[_0xe1cf('0xf')]);router[_0xe1cf('0xe')](_0xe1cf('0xb'),auth[_0xe1cf('0x8')](),controller[_0xe1cf('0x10')]);router[_0xe1cf('0x11')](_0xe1cf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe1cf('0x12')](_0xe1cf('0xa'),auth[_0xe1cf('0x8')](),controller['destroy']);module[_0xe1cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index d61bf94..b966e6e 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 _0x2542=['newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab'];(function(_0x4c8df2,_0xb5cb33){var _0x5e1433=function(_0x5edcc3){while(--_0x5edcc3){_0x4c8df2['push'](_0x4c8df2['shift']());}};_0x5e1433(++_0xb5cb33);}(_0x2542,0x169));var _0x2254=function(_0xc1d0f0,_0xbea429){_0xc1d0f0=_0xc1d0f0-0x0;var _0x4bc573=_0x2542[_0xc1d0f0];return _0x4bc573;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2254('0x2')]},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'authType':{'type':Sequelize[_0x2254('0x5')](_0x2254('0x6'),'token'),'defaultValue':_0x2254('0x6')},'serverUrl':{'type':Sequelize[_0x2254('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x5')](_0x2254('0x7'),_0x2254('0x8')),'defaultValue':_0x2254('0x7')}}; \ No newline at end of file +var _0x1623=['password','integrationTab','newTab','sequelize','STRING','username','ENUM','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1623,0xab));var _0x3162=function(_0x5697ab,_0x4a5c3c){_0x5697ab=_0x5697ab-0x0;var _0x33e5b4=_0x1623[_0x5697ab];return _0x33e5b4;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3162('0x1')]},'username':{'type':Sequelize[_0x3162('0x1')],'unique':_0x3162('0x2')},'password':{'type':Sequelize[_0x3162('0x1')]},'token':{'type':Sequelize[_0x3162('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3162('0x3')]('password',_0x3162('0x4')),'defaultValue':_0x3162('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x6'),_0x3162('0x7')),'defaultValue':_0x3162('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 5d699a3..2318c2d 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 _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0x45b962,_0x4aa1d5){var _0x59dc7d=function(_0x5f2f84){while(--_0x5f2f84){_0x45b962['push'](_0x45b962['shift']());}};_0x59dc7d(++_0x4aa1d5);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x12d1cb,_0x4ad88e){_0x12d1cb=_0x12d1cb-0x0;var _0x4437bb=_0xe1e3[_0x12d1cb];return _0x4437bb;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file +var _0x2f68=['find','create','body','catch','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','username','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x17296b,_0x72a2b0){var _0x471c5f=function(_0x33b433){while(--_0x33b433){_0x17296b['push'](_0x17296b['shift']());}};_0x471c5f(++_0x72a2b0);}(_0x2f68,0x9a));var _0x82f6=function(_0xe55924,_0xf33e29){_0xe55924=_0xe55924-0x0;var _0x5d4663=_0x2f68[_0xe55924];return _0x5d4663;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];var integrations=require(_0x82f6('0x15'));function respondWithStatusCode(_0x4cc967,_0x194da7){_0x194da7=_0x194da7||0xcc;return function(_0x1f8bf5){if(_0x1f8bf5){return _0x4cc967[_0x82f6('0x16')](_0x194da7);}return _0x4cc967[_0x82f6('0x17')](_0x194da7)[_0x82f6('0x18')]();};}function respondWithResult(_0xa00275,_0x115c7b){_0x115c7b=_0x115c7b||0xc8;return function(_0x171815){if(_0x171815){return _0xa00275[_0x82f6('0x17')](_0x115c7b)['json'](_0x171815);}};}function respondWithFilteredResult(_0x389949,_0x5d0827){return function(_0x249222){if(_0x249222){var _0x1d0263=typeof _0x5d0827[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x5d0827[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x326378=_0x249222[_0x82f6('0x1c')];var _0x4072f0=_0x1d0263?0x0:_0x5d0827[_0x82f6('0x19')];var _0x1c79f9=_0x1d0263?_0x249222[_0x82f6('0x1c')]:_0x5d0827[_0x82f6('0x19')]+_0x5d0827[_0x82f6('0x1b')];var _0x3a8269;if(_0x1c79f9>=_0x326378){_0x1c79f9=_0x326378;_0x3a8269=0xc8;}else{_0x3a8269=0xce;}_0x389949['status'](_0x3a8269);return _0x389949[_0x82f6('0x1d')](_0x82f6('0x1e'),_0x4072f0+'-'+_0x1c79f9+'/'+_0x326378)['json'](_0x249222);}return null;};}function patchUpdates(_0x2b03ad){return function(_0x4b9f0){try{jsonpatch[_0x82f6('0x1f')](_0x4b9f0,_0x2b03ad,!![]);}catch(_0x25cae6){return BPromise['reject'](_0x25cae6);}return _0x4b9f0[_0x82f6('0x20')]();};}function saveUpdates(_0x4beccf,_0x8668bb){return function(_0x2a0ce6){if(_0x2a0ce6){return _0x2a0ce6['update'](_0x4beccf)['then'](function(_0x3af5f7){return _0x3af5f7;});}return null;};}function removeEntity(_0x1d96d5,_0x4c57c5){return function(_0x5a5059){if(_0x5a5059){return _0x5a5059[_0x82f6('0x21')]()[_0x82f6('0x22')](function(){_0x1d96d5['status'](0xcc)[_0x82f6('0x18')]();});}};}function handleEntityNotFound(_0x304e83,_0x5037f8){return function(_0x57ac0d){if(!_0x57ac0d){_0x304e83[_0x82f6('0x16')](0x194);}return _0x57ac0d;};}function handleError(_0x5187d0,_0x469b6b){_0x469b6b=_0x469b6b||0x1f4;return function(_0x5a6d69){logger['error'](_0x5a6d69[_0x82f6('0x23')]);if(_0x5a6d69[_0x82f6('0x24')]){delete _0x5a6d69[_0x82f6('0x24')];}_0x5187d0[_0x82f6('0x17')](_0x469b6b)['send'](_0x5a6d69);};}exports[_0x82f6('0x25')]=function(_0x1fb461,_0x14a309){var _0x400137={},_0x271c28={},_0x328707={'count':0x0,'rows':[]};var _0x27e473=_[_0x82f6('0x26')](db[_0x82f6('0x27')][_0x82f6('0x28')],function(_0x3c9419){return{'name':_0x3c9419[_0x82f6('0x29')],'type':_0x3c9419[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x271c28['model']=_[_0x82f6('0x26')](_0x27e473,_0x82f6('0x24'));_0x271c28[_0x82f6('0x2c')]=_['keys'](_0x1fb461[_0x82f6('0x2c')]);_0x271c28[_0x82f6('0x2d')]=_[_0x82f6('0x2e')](_0x271c28[_0x82f6('0x2f')],_0x271c28[_0x82f6('0x2c')]);_0x400137[_0x82f6('0x30')]=_[_0x82f6('0x2e')](_0x271c28[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x31')]));_0x400137[_0x82f6('0x30')]=_0x400137[_0x82f6('0x30')][_0x82f6('0x32')]?_0x400137['attributes']:_0x271c28[_0x82f6('0x2f')];if(!_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x33')](_0x82f6('0x34'))){_0x400137[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x1b')]);_0x400137[_0x82f6('0x19')]=qs[_0x82f6('0x19')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x19')]);}_0x400137[_0x82f6('0x35')]=qs[_0x82f6('0x36')](_0x1fb461['query'][_0x82f6('0x36')]);_0x400137['where']=qs['filters'](_[_0x82f6('0x37')](_0x1fb461[_0x82f6('0x2c')],_0x271c28['filters']),_0x27e473);if(_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x38')]){_0x400137[_0x82f6('0x39')]=_['merge'](_0x400137[_0x82f6('0x39')],{'$or':_['map'](_0x27e473,function(_0x2be8cf){if(_0x2be8cf['type']!==_0x82f6('0x3a')){var _0x47ef9e={};_0x47ef9e[_0x2be8cf[_0x82f6('0x24')]]={'$like':'%'+_0x1fb461[_0x82f6('0x2c')]['filter']+'%'};return _0x47ef9e;}})});}_0x400137=_[_0x82f6('0x3b')]({},_0x400137,_0x1fb461[_0x82f6('0x3c')]);var _0x3e7c53={'where':_0x400137[_0x82f6('0x39')]};return db['ZendeskAccount'][_0x82f6('0x1c')](_0x3e7c53)[_0x82f6('0x22')](function(_0x23ea04){_0x328707[_0x82f6('0x1c')]=_0x23ea04;if(_0x1fb461['query'][_0x82f6('0x3d')]){_0x400137[_0x82f6('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x82f6('0x3f')](_0x400137);})[_0x82f6('0x22')](function(_0x2d7509){_0x328707[_0x82f6('0x40')]=_0x2d7509;return _0x328707;})[_0x82f6('0x22')](respondWithFilteredResult(_0x14a309,_0x400137))['catch'](handleError(_0x14a309,null));};exports[_0x82f6('0x41')]=function(_0x5786ce,_0x139614){var _0x38e82d={'raw':![],'where':{'id':_0x5786ce[_0x82f6('0x42')]['id']}},_0x32d6b5={};_0x32d6b5[_0x82f6('0x2f')]=_[_0x82f6('0x43')](db[_0x82f6('0x27')]['rawAttributes']);_0x32d6b5[_0x82f6('0x2c')]=_[_0x82f6('0x43')](_0x5786ce[_0x82f6('0x2c')]);_0x32d6b5[_0x82f6('0x2d')]=_['intersection'](_0x32d6b5[_0x82f6('0x2f')],_0x32d6b5['query']);_0x38e82d[_0x82f6('0x30')]=_[_0x82f6('0x2e')](_0x32d6b5[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x5786ce[_0x82f6('0x2c')][_0x82f6('0x31')]));_0x38e82d['attributes']=_0x38e82d[_0x82f6('0x30')][_0x82f6('0x32')]?_0x38e82d[_0x82f6('0x30')]:_0x32d6b5[_0x82f6('0x2f')];if(_0x5786ce[_0x82f6('0x2c')][_0x82f6('0x3d')]){_0x38e82d[_0x82f6('0x3e')]=[{'all':!![]}];}_0x38e82d=_[_0x82f6('0x3b')]({},_0x38e82d,_0x5786ce['options']);return db[_0x82f6('0x27')][_0x82f6('0x44')](_0x38e82d)['then'](handleEntityNotFound(_0x139614,null))[_0x82f6('0x22')](respondWithResult(_0x139614,null))['catch'](handleError(_0x139614,null));};exports[_0x82f6('0x45')]=function(_0x5e3321,_0x227ab8){return db[_0x82f6('0x27')][_0x82f6('0x45')](_0x5e3321[_0x82f6('0x46')],{})[_0x82f6('0x22')](respondWithResult(_0x227ab8,0xc9))[_0x82f6('0x47')](handleError(_0x227ab8,null));};exports['update']=function(_0x3cb1f0,_0xdc77ca){if(_0x3cb1f0['body']['id']){delete _0x3cb1f0['body']['id'];}return db[_0x82f6('0x27')][_0x82f6('0x44')]({'where':{'id':_0x3cb1f0[_0x82f6('0x42')]['id']}})['then'](handleEntityNotFound(_0xdc77ca,null))[_0x82f6('0x22')](saveUpdates(_0x3cb1f0[_0x82f6('0x46')],null))[_0x82f6('0x22')](respondWithResult(_0xdc77ca,null))[_0x82f6('0x47')](handleError(_0xdc77ca,null));};exports['destroy']=function(_0x495400,_0x1695ea){return db[_0x82f6('0x27')][_0x82f6('0x44')]({'where':{'id':_0x495400['params']['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x1695ea,null))[_0x82f6('0x22')](removeEntity(_0x1695ea,null))['catch'](handleError(_0x1695ea,null));};exports['getConfigurations']=function(_0x4fa2ca,_0x2e6b03,_0x4a63a6){var _0x259d83={};var _0x57c023={};var _0x33c359;var _0x4f69de;return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x4fa2ca[_0x82f6('0x42')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x2e6b03,null))[_0x82f6('0x22')](function(_0x1633cf){if(_0x1633cf){_0x33c359=_0x1633cf;_0x57c023[_0x82f6('0x2f')]=_[_0x82f6('0x43')](db['ZendeskConfiguration'][_0x82f6('0x28')]);_0x57c023[_0x82f6('0x2c')]=_[_0x82f6('0x43')](_0x4fa2ca['query']);_0x57c023['filters']=_[_0x82f6('0x2e')](_0x57c023[_0x82f6('0x2f')],_0x57c023[_0x82f6('0x2c')]);_0x259d83[_0x82f6('0x30')]=_['intersection'](_0x57c023[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x4fa2ca[_0x82f6('0x2c')]['fields']));_0x259d83['attributes']=_0x259d83['attributes'][_0x82f6('0x32')]?_0x259d83[_0x82f6('0x30')]:_0x57c023[_0x82f6('0x2f')];_0x259d83[_0x82f6('0x35')]=qs[_0x82f6('0x36')](_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x36')]);_0x259d83[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x37')](_0x4fa2ca[_0x82f6('0x2c')],_0x57c023[_0x82f6('0x2d')]));if(_0x4fa2ca[_0x82f6('0x2c')]['filter']){_0x259d83['where']=_[_0x82f6('0x3b')](_0x259d83[_0x82f6('0x39')],{'$or':_['map'](_0x259d83[_0x82f6('0x30')],function(_0xa12f6e){var _0x404d09={};_0x404d09[_0xa12f6e]={'$like':'%'+_0x4fa2ca['query'][_0x82f6('0x38')]+'%'};return _0x404d09;})});}_0x259d83=_[_0x82f6('0x3b')]({},_0x259d83,_0x4fa2ca[_0x82f6('0x3c')]);return _0x33c359[_0x82f6('0x48')](_0x259d83);}})[_0x82f6('0x22')](function(_0x41da7f){if(_0x41da7f){_0x4f69de=_0x41da7f['length'];if(!_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x33')](_0x82f6('0x34'))){_0x259d83[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x4fa2ca['query'][_0x82f6('0x1b')]);_0x259d83[_0x82f6('0x19')]=qs[_0x82f6('0x19')](_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x19')]);}return _0x33c359[_0x82f6('0x48')](_0x259d83);}})[_0x82f6('0x22')](function(_0x17389a){if(_0x17389a){return _0x17389a?{'count':_0x4f69de,'rows':_0x17389a}:null;}})['then'](respondWithResult(_0x2e6b03,null))[_0x82f6('0x47')](handleError(_0x2e6b03,null));};exports['addConfiguration']=function(_0x3f0337,_0x85ea2e,_0x4e51a6){if(_0x3f0337[_0x82f6('0x46')]['id']){delete _0x3f0337[_0x82f6('0x46')]['id'];}return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x3f0337['params']['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x85ea2e,null))[_0x82f6('0x22')](function(_0x58b96b){if(_0x58b96b){_0x3f0337['body'][_0x82f6('0x49')]=_0x58b96b['id'];_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4a')]=integrations[_0x82f6('0x4b')](_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4c')],_0x3f0337[_0x82f6('0x46')][_0x82f6('0x2a')]);_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4d')]=integrations[_0x82f6('0x4e')](_0x3f0337[_0x82f6('0x46')]['channel'],_0x3f0337[_0x82f6('0x46')][_0x82f6('0x2a')]);return db[_0x82f6('0x4f')][_0x82f6('0x45')](_0x3f0337[_0x82f6('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x82f6('0x4a')},{'model':db[_0x82f6('0x50')],'as':_0x82f6('0x4d')}]});}return null;})['then'](respondWithResult(_0x85ea2e,null))[_0x82f6('0x47')](handleError(_0x85ea2e,null));};exports[_0x82f6('0x51')]=function(_0x17924d,_0x27a79c,_0xeec407){var _0x39a4b3='';return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x17924d[_0x82f6('0x42')]['id']},'attributes':['id','username',_0x82f6('0x52'),_0x82f6('0x53'),_0x82f6('0x54'),_0x82f6('0x55')]})[_0x82f6('0x22')](handleEntityNotFound(_0x27a79c,null))[_0x82f6('0x22')](function(_0x2d8721){if(_0x2d8721){_0x39a4b3=_0x2d8721[_0x82f6('0x55')];var _0x30b903=_0x39a4b3['slice'](-0x1);if(_0x30b903==='/'){_0x39a4b3=_0x39a4b3[_0x82f6('0x56')](0x0,_0x39a4b3[_0x82f6('0x57')](_0x30b903));}var _0x33cc55={'method':_0x82f6('0x58'),'uri':util[_0x82f6('0x59')](_0x82f6('0x5a'),_0x39a4b3,'ticket_fields'),'json':!![]};switch(_0x2d8721[_0x82f6('0x54')]){case _0x82f6('0x52'):_0x33cc55['headers']={'Authorization':util['format'](_0x82f6('0x5b'),new Buffer(util[_0x82f6('0x59')](_0x82f6('0x5c'),_0x2d8721[_0x82f6('0x5d')],_0x2d8721[_0x82f6('0x52')]))[_0x82f6('0x5e')]('base64'))};break;case _0x82f6('0x53'):_0x33cc55['headers']={'Authorization':util[_0x82f6('0x59')]('Basic\x20%s',new Buffer(util[_0x82f6('0x59')]('%s/token:%s',_0x2d8721[_0x82f6('0x5d')],_0x2d8721[_0x82f6('0x53')]))[_0x82f6('0x5e')]('base64'))};break;default:throw new db[(_0x82f6('0x5f'))]['ValidationError'](_0x82f6('0x60'));}return rp(_0x33cc55);}})[_0x82f6('0x22')](function(_0x3e69f6){if(_0x3e69f6){var _0x4d1bfd=[_0x82f6('0x61'),_0x82f6('0x62'),_0x82f6('0x63'),'assignee'];_['remove'](_0x3e69f6[_0x82f6('0x64')],function(_0x30327a){return _0x4d1bfd[_0x82f6('0x65')](_0x30327a[_0x82f6('0x2a')]);});return{'count':_0x3e69f6[_0x82f6('0x64')][_0x82f6('0x32')],'rows':_[_0x82f6('0x26')](_0x3e69f6[_0x82f6('0x64')],function(_0x4df767){return{'id':_0x4df767['id'],'name':_0x4df767[_0x82f6('0x66')]>0x7?_0x4df767[_0x82f6('0x67')]:_0x4df767['type'],'custom':_0x4df767[_0x82f6('0x66')]>0x7?!![]:![],'options':_0x4df767[_0x82f6('0x68')]?_0x4df767[_0x82f6('0x68')]:_0x4df767['custom_field_options']?_0x4df767[_0x82f6('0x69')]:[]};})};}})[_0x82f6('0x22')](respondWithResult(_0x27a79c,null))[_0x82f6('0x47')](function(_0x2cc906){var _0x50ab5c=_0x17924d[_0x82f6('0x2c')][_0x82f6('0x6a')]?0x1f4:_0x2cc906[_0x82f6('0x6b')]||0x1f4;logger[_0x82f6('0x6c')](_0x82f6('0x6d'),_0x82f6('0x51'),_0x50ab5c,JSON['stringify'](_0x2cc906));delete _0x2cc906[_0x82f6('0x24')];if(_0x50ab5c===0x191){_0x50ab5c=0x190;}_0x27a79c[_0x82f6('0x17')](_0x50ab5c)[_0x82f6('0x6e')](_0x17924d[_0x82f6('0x2c')][_0x82f6('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x2cc906[_0x82f6('0x6b')]}:_0x2cc906);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7969af5..30408ec 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 _0x59a7=['exports','define','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1d8fde,_0xaa0599){var _0x37ea1b=function(_0x5df7c1){while(--_0x5df7c1){_0x1d8fde['push'](_0x1d8fde['shift']());}};_0x37ea1b(++_0xaa0599);}(_0x59a7,0x1b0));var _0x759a=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0x59a7[_0x1903aa];return _0x51fe28;};'use strict';var _=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var logger=require('../../config/logger')(_0x759a('0x2'));var moment=require(_0x759a('0x3'));var BPromise=require(_0x759a('0x4'));var rp=require(_0x759a('0x5'));var fs=require('fs');var path=require(_0x759a('0x6'));var rimraf=require(_0x759a('0x7'));var config=require('../../config/environment');var attributes=require(_0x759a('0x8'));var integrations=require(_0x759a('0x9'));module[_0x759a('0xa')]=function(_0x401aab,_0x3b3042){return _0x401aab[_0x759a('0xb')]('ZendeskAccount',attributes,{'tableName':_0x759a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f39=['ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x499b72,_0x39ddd1){var _0x4c922e=function(_0x24dd8b){while(--_0x24dd8b){_0x499b72['push'](_0x499b72['shift']());}};_0x4c922e(++_0x39ddd1);}(_0x9f39,0x92));var _0x99f3=function(_0x4ca8b1,_0x383cb4){_0x4ca8b1=_0x4ca8b1-0x0;var _0x23757b=_0x9f39[_0x4ca8b1];return _0x23757b;};'use strict';var _=require(_0x99f3('0x0'));var util=require(_0x99f3('0x1'));var logger=require(_0x99f3('0x2'))(_0x99f3('0x3'));var moment=require(_0x99f3('0x4'));var BPromise=require('bluebird');var rp=require(_0x99f3('0x5'));var fs=require('fs');var path=require(_0x99f3('0x6'));var rimraf=require(_0x99f3('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x99f3('0x8')]=function(_0x430b1d,_0x53ffd6){return _0x430b1d[_0x99f3('0x9')](_0x99f3('0xa'),attributes,{'tableName':_0x99f3('0xb'),'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 aa119d0..ce75cbc 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 _0xbf54=['raw','where','attributes','include','map','model','then','info','GetZendeskAccount','debug','ShowZendeskAccount','ZendeskAccount','find','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','findAll','options'];(function(_0x4ced8d,_0x5805ad){var _0x596a46=function(_0x4aea8c){while(--_0x4aea8c){_0x4ced8d['push'](_0x4ced8d['shift']());}};_0x596a46(++_0x5805ad);}(_0xbf54,0x18f));var _0x4bf5=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xbf54[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x4bf5('0x0'));var util=require('util');var moment=require(_0x4bf5('0x1'));var BPromise=require(_0x4bf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bf5('0x3'))['db'];var utils=require(_0x4bf5('0x4'));var logger=require(_0x4bf5('0x5'))(_0x4bf5('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bf5('0x7'));var client=jayson[_0x4bf5('0x8')][_0x4bf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33df19,_0x3c4f3b,_0x38814e){return new BPromise(function(_0xea63df,_0x6297a){return client[_0x4bf5('0xa')](_0x33df19,_0x38814e)['then'](function(_0x369189){logger['info'](_0x4bf5('0xb'),_0x3c4f3b,_0x4bf5('0xc'));logger['debug'](_0x4bf5('0xd'),_0x3c4f3b,'request\x20sent',JSON['stringify'](_0x369189));if(_0x369189['error']){if(_0x369189['error'][_0x4bf5('0xe')]===0x1f4){logger[_0x4bf5('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0x6297a(_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);}logger[_0x4bf5('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0xea63df(_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);}else{logger['info'](_0x4bf5('0xb'),_0x3c4f3b,'request\x20sent');_0xea63df(_0x369189[_0x4bf5('0x11')]['message']);}})[_0x4bf5('0x12')](function(_0x1d451b){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x1d451b);_0x6297a(_0x1d451b);});});}exports['GetZendeskAccount']=function(_0x451acb){var _0x36c32e=this;return new Promise(function(_0x2cb398,_0x1ce1b8){return db['ZendeskAccount'][_0x4bf5('0x13')]({'raw':_0x451acb[_0x4bf5('0x14')]?_0x451acb['options'][_0x4bf5('0x15')]===undefined?!![]:![]:!![],'where':_0x451acb[_0x4bf5('0x14')]?_0x451acb['options'][_0x4bf5('0x16')]||null:null,'attributes':_0x451acb[_0x4bf5('0x14')]?_0x451acb[_0x4bf5('0x14')][_0x4bf5('0x17')]||null:null,'limit':_0x451acb['options']?_0x451acb[_0x4bf5('0x14')]['limit']||null:null,'include':_0x451acb['options']?_0x451acb[_0x4bf5('0x14')][_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x451acb[_0x4bf5('0x14')]['include'],function(_0x51970e){return{'model':db[_0x51970e['model']],'as':_0x51970e['as'],'attributes':_0x51970e[_0x4bf5('0x17')],'include':_0x51970e[_0x4bf5('0x18')]?_['map'](_0x51970e[_0x4bf5('0x18')],function(_0x4ac8e7){return{'model':db[_0x4ac8e7[_0x4bf5('0x1a')]],'as':_0x4ac8e7['as'],'attributes':_0x4ac8e7['attributes'],'include':_0x4ac8e7['include']?_[_0x4bf5('0x19')](_0x4ac8e7[_0x4bf5('0x18')],function(_0x20adad){return{'model':db[_0x20adad[_0x4bf5('0x1a')]],'as':_0x20adad['as'],'attributes':_0x20adad[_0x4bf5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4bf5('0x1b')](function(_0x24d756){logger[_0x4bf5('0x1c')](_0x4bf5('0x1d'),_0x451acb);logger[_0x4bf5('0x1e')](_0x4bf5('0x1d'),_0x451acb,JSON['stringify'](_0x24d756));_0x2cb398(_0x24d756);})['catch'](function(_0x2acb3a){logger[_0x4bf5('0xf')](_0x4bf5('0x1d'),_0x2acb3a[_0x4bf5('0x10')],_0x451acb);_0x1ce1b8(_0x36c32e[_0x4bf5('0xf')](0x1f4,_0x2acb3a[_0x4bf5('0x10')]));});});};exports[_0x4bf5('0x1f')]=function(_0x2da774){var _0x38f169=this;return new Promise(function(_0x3c1fa9,_0x4c0293){return db[_0x4bf5('0x20')][_0x4bf5('0x21')]({'raw':_0x2da774[_0x4bf5('0x14')]?_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x15')]===undefined?!![]:![]:!![],'where':_0x2da774[_0x4bf5('0x14')]?_0x2da774['options']['where']||null:null,'attributes':_0x2da774[_0x4bf5('0x14')]?_0x2da774['options'][_0x4bf5('0x17')]||null:null,'include':_0x2da774[_0x4bf5('0x14')]?_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x18')],function(_0x3f6a55){return{'model':db[_0x3f6a55[_0x4bf5('0x1a')]],'as':_0x3f6a55['as'],'attributes':_0x3f6a55['attributes'],'include':_0x3f6a55[_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x3f6a55[_0x4bf5('0x18')],function(_0x55e722){return{'model':db[_0x55e722[_0x4bf5('0x1a')]],'as':_0x55e722['as'],'attributes':_0x55e722[_0x4bf5('0x17')],'include':_0x55e722[_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x55e722[_0x4bf5('0x18')],function(_0x50ee1d){return{'model':db[_0x50ee1d[_0x4bf5('0x1a')]],'as':_0x50ee1d['as'],'attributes':_0x50ee1d[_0x4bf5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4bf5('0x1b')](function(_0x20d392){logger[_0x4bf5('0x1c')](_0x4bf5('0x1f'),_0x2da774);logger[_0x4bf5('0x1e')]('ShowZendeskAccount',_0x2da774,JSON[_0x4bf5('0x22')](_0x20d392));_0x3c1fa9(_0x20d392);})[_0x4bf5('0x12')](function(_0xa19388){logger['error'](_0x4bf5('0x1f'),_0xa19388['message'],_0x2da774);_0x4c0293(_0x38f169[_0x4bf5('0xf')](0x1f4,_0xa19388[_0x4bf5('0x10')]));});});}; \ No newline at end of file +var _0x9583=['debug','catch','ShowZendeskAccount','find','raw','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x9583,0xcb));var _0x3958=function(_0x26bbda,_0x530b36){_0x26bbda=_0x26bbda-0x0;var _0x2bf75c=_0x9583[_0x26bbda];return _0x2bf75c;};'use strict';var _=require(_0x3958('0x0'));var util=require(_0x3958('0x1'));var moment=require(_0x3958('0x2'));var BPromise=require('bluebird');var rs=require(_0x3958('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3958('0x4'))(_0x3958('0x5'));var config=require(_0x3958('0x6'));var jayson=require(_0x3958('0x7'));var client=jayson[_0x3958('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce826,_0x7e525e,_0x5d1980){return new BPromise(function(_0x1fed59,_0x3f362a){return client[_0x3958('0x9')](_0x1ce826,_0x5d1980)[_0x3958('0xa')](function(_0x40ce3d){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x7e525e,_0x3958('0xb'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x7e525e,_0x3958('0xb'),JSON[_0x3958('0xc')](_0x40ce3d));if(_0x40ce3d[_0x3958('0xd')]){if(_0x40ce3d['error']['code']===0x1f4){logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x40ce3d['error']['message']);return _0x3f362a(_0x40ce3d[_0x3958('0xd')]['message']);}logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x40ce3d['error'][_0x3958('0xf')]);return _0x1fed59(_0x40ce3d[_0x3958('0xd')][_0x3958('0xf')]);}else{logger[_0x3958('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x7e525e,'request\x20sent');_0x1fed59(_0x40ce3d[_0x3958('0x11')][_0x3958('0xf')]);}})['catch'](function(_0x4d9839){logger[_0x3958('0xd')](_0x3958('0xe'),_0x7e525e,_0x4d9839);_0x3f362a(_0x4d9839);});});}exports[_0x3958('0x12')]=function(_0x20a6bc){var _0x50e1bf=this;return new Promise(function(_0x146a70,_0x27b13d){return db[_0x3958('0x13')][_0x3958('0x14')]({'raw':_0x20a6bc['options']?_0x20a6bc['options']['raw']===undefined?!![]:![]:!![],'where':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x16')]||null:null,'attributes':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x17')]||null:null,'limit':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x18')]||null:null,'include':_0x20a6bc[_0x3958('0x15')]?_0x20a6bc[_0x3958('0x15')][_0x3958('0x19')]?_['map'](_0x20a6bc['options'][_0x3958('0x19')],function(_0xb018db){return{'model':db[_0xb018db['model']],'as':_0xb018db['as'],'attributes':_0xb018db[_0x3958('0x17')],'include':_0xb018db[_0x3958('0x19')]?_[_0x3958('0x1a')](_0xb018db[_0x3958('0x19')],function(_0x131b33){return{'model':db[_0x131b33['model']],'as':_0x131b33['as'],'attributes':_0x131b33[_0x3958('0x17')],'include':_0x131b33['include']?_[_0x3958('0x1a')](_0x131b33['include'],function(_0x3c4ce9){return{'model':db[_0x3c4ce9[_0x3958('0x1b')]],'as':_0x3c4ce9['as'],'attributes':_0x3c4ce9[_0x3958('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3958('0xa')](function(_0x4c9db5){logger[_0x3958('0x10')](_0x3958('0x12'),_0x20a6bc);logger[_0x3958('0x1c')]('GetZendeskAccount',_0x20a6bc,JSON[_0x3958('0xc')](_0x4c9db5));_0x146a70(_0x4c9db5);})[_0x3958('0x1d')](function(_0x2e4599){logger[_0x3958('0xd')](_0x3958('0x12'),_0x2e4599[_0x3958('0xf')],_0x20a6bc);_0x27b13d(_0x50e1bf['error'](0x1f4,_0x2e4599[_0x3958('0xf')]));});});};exports[_0x3958('0x1e')]=function(_0x4d459f){var _0x663593=this;return new Promise(function(_0x3e3193,_0x1c2f79){return db[_0x3958('0x13')][_0x3958('0x1f')]({'raw':_0x4d459f['options']?_0x4d459f[_0x3958('0x15')][_0x3958('0x20')]===undefined?!![]:![]:!![],'where':_0x4d459f[_0x3958('0x15')]?_0x4d459f['options']['where']||null:null,'attributes':_0x4d459f['options']?_0x4d459f[_0x3958('0x15')][_0x3958('0x17')]||null:null,'include':_0x4d459f[_0x3958('0x15')]?_0x4d459f['options'][_0x3958('0x19')]?_['map'](_0x4d459f['options'][_0x3958('0x19')],function(_0x5cfd45){return{'model':db[_0x5cfd45[_0x3958('0x1b')]],'as':_0x5cfd45['as'],'attributes':_0x5cfd45['attributes'],'include':_0x5cfd45[_0x3958('0x19')]?_[_0x3958('0x1a')](_0x5cfd45['include'],function(_0x5abfba){return{'model':db[_0x5abfba[_0x3958('0x1b')]],'as':_0x5abfba['as'],'attributes':_0x5abfba[_0x3958('0x17')],'include':_0x5abfba[_0x3958('0x19')]?_[_0x3958('0x1a')](_0x5abfba[_0x3958('0x19')],function(_0x7f5309){return{'model':db[_0x7f5309[_0x3958('0x1b')]],'as':_0x7f5309['as'],'attributes':_0x7f5309[_0x3958('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e529){logger[_0x3958('0x10')](_0x3958('0x1e'),_0x4d459f);logger['debug'](_0x3958('0x1e'),_0x4d459f,JSON[_0x3958('0xc')](_0x13e529));_0x3e3193(_0x13e529);})[_0x3958('0x1d')](function(_0x4705d3){logger['error'](_0x3958('0x1e'),_0x4705d3[_0x3958('0xf')],_0x4d459f);_0x1c2f79(_0x663593['error'](0x1f4,_0x4705d3[_0x3958('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9e4630d..79fa363 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x4ee9a5,_0x120085){var _0x2f9796=function(_0x127923){while(--_0x127923){_0x4ee9a5['push'](_0x4ee9a5['shift']());}};_0x2f9796(++_0x120085);}(_0x750a,0x140));var _0xa750=function(_0x3415af,_0x476d88){_0x3415af=_0x3415af-0x0;var _0x535b99=_0x750a[_0x3415af];return _0x535b99;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x5c82f7,_0x55360f){var _0x192f84=function(_0x5d55d7){while(--_0x5d55d7){_0x5c82f7['push'](_0x5c82f7['shift']());}};_0x192f84(++_0x55360f);}(_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['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 03c756c..1a18516 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 _0x2a4d=['sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2a4d,0x126));var _0xd2a4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2a4d[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xd2a4('0x0'));module[_0xd2a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd2a4('0x2')]}}; \ No newline at end of file +var _0x5341=['STRING','exports'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x5341,0xf1));var _0x1534=function(_0x29e8f0,_0x116a12){_0x29e8f0=_0x29e8f0-0x0;var _0x18005c=_0x5341[_0x29e8f0];return _0x18005c;};'use strict';var Sequelize=require('sequelize');module[_0x1534('0x0')]={'name':{'type':Sequelize[_0x1534('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 d0ff81c..c7f94e1 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 _0x1d5b=['then','destroy','end','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update'];(function(_0x4f6070,_0xfbc9cb){var _0x14dfe5=function(_0x1af74e){while(--_0x1af74e){_0x4f6070['push'](_0x4f6070['shift']());}};_0x14dfe5(++_0xfbc9cb);}(_0x1d5b,0x1cd));var _0xb1d5=function(_0x370d2f,_0x1dcf08){_0x370d2f=_0x370d2f-0x0;var _0x49bc67=_0x1d5b[_0x370d2f];return _0x49bc67;};'use strict';var emlformat=require(_0xb1d5('0x0'));var rimraf=require(_0xb1d5('0x1'));var zipdir=require(_0xb1d5('0x2'));var jsonpatch=require(_0xb1d5('0x3'));var rp=require('request-promise');var moment=require(_0xb1d5('0x4'));var BPromise=require(_0xb1d5('0x5'));var Mustache=require(_0xb1d5('0x6'));var util=require(_0xb1d5('0x7'));var path=require(_0xb1d5('0x8'));var sox=require(_0xb1d5('0x9'));var csv=require(_0xb1d5('0xa'));var ejs=require(_0xb1d5('0xb'));var fs=require('fs');var fs_extra=require(_0xb1d5('0xc'));var _=require(_0xb1d5('0xd'));var squel=require(_0xb1d5('0xe'));var crypto=require(_0xb1d5('0xf'));var jsforce=require(_0xb1d5('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb1d5('0x11'));var Papa=require('papaparse');var Redis=require(_0xb1d5('0x12'));var authService=require(_0xb1d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb1d5('0x14'));var hardwareService=require(_0xb1d5('0x15'));var logger=require(_0xb1d5('0x16'))(_0xb1d5('0x17'));var utils=require(_0xb1d5('0x18'));var config=require(_0xb1d5('0x19'));var licenseUtil=require(_0xb1d5('0x1a'));var db=require(_0xb1d5('0x1b'))['db'];function respondWithStatusCode(_0x18ac32,_0x38a21b){_0x38a21b=_0x38a21b||0xcc;return function(_0x5b2fea){if(_0x5b2fea){return _0x18ac32[_0xb1d5('0x1c')](_0x38a21b);}return _0x18ac32[_0xb1d5('0x1d')](_0x38a21b)['end']();};}function respondWithResult(_0x28137d,_0x29722d){_0x29722d=_0x29722d||0xc8;return function(_0x926ad7){if(_0x926ad7){return _0x28137d['status'](_0x29722d)[_0xb1d5('0x1e')](_0x926ad7);}};}function respondWithFilteredResult(_0x3f1780,_0x311323){return function(_0x270142){if(_0x270142){var _0x185df3=typeof _0x311323[_0xb1d5('0x1f')]==='undefined'&&typeof _0x311323[_0xb1d5('0x20')]==='undefined';var _0x1bbc64=_0x270142['count'];var _0x2793d0=_0x185df3?0x0:_0x311323[_0xb1d5('0x1f')];var _0x5ee3b5=_0x185df3?_0x270142['count']:_0x311323[_0xb1d5('0x1f')]+_0x311323[_0xb1d5('0x20')];var _0x466ea2;if(_0x5ee3b5>=_0x1bbc64){_0x5ee3b5=_0x1bbc64;_0x466ea2=0xc8;}else{_0x466ea2=0xce;}_0x3f1780['status'](_0x466ea2);return _0x3f1780['set']('Content-Range',_0x2793d0+'-'+_0x5ee3b5+'/'+_0x1bbc64)[_0xb1d5('0x1e')](_0x270142);}return null;};}function patchUpdates(_0x51cf9a){return function(_0xa88159){try{jsonpatch[_0xb1d5('0x21')](_0xa88159,_0x51cf9a,!![]);}catch(_0x2a047e){return BPromise[_0xb1d5('0x22')](_0x2a047e);}return _0xa88159[_0xb1d5('0x23')]();};}function saveUpdates(_0x189d8a,_0x5e2b35){return function(_0x438d65){if(_0x438d65){return _0x438d65[_0xb1d5('0x24')](_0x189d8a)[_0xb1d5('0x25')](function(_0x50b18e){return _0x50b18e;});}return null;};}function removeEntity(_0x5e6d99,_0x3fd98d){return function(_0x1f3750){if(_0x1f3750){return _0x1f3750[_0xb1d5('0x26')]()[_0xb1d5('0x25')](function(){_0x5e6d99['status'](0xcc)[_0xb1d5('0x27')]();});}};}function handleEntityNotFound(_0x4c728a,_0x5705b5){return function(_0x217aa4){if(!_0x217aa4){_0x4c728a[_0xb1d5('0x1c')](0x194);}return _0x217aa4;};}function handleError(_0x496693,_0x295040){_0x295040=_0x295040||0x1f4;return function(_0x4ceab8){logger['error'](_0x4ceab8[_0xb1d5('0x28')]);if(_0x4ceab8[_0xb1d5('0x29')]){delete _0x4ceab8['name'];}_0x496693[_0xb1d5('0x1d')](_0x295040)[_0xb1d5('0x2a')](_0x4ceab8);};}exports['index']=function(_0x17bb60,_0x917068){var _0x132c13={},_0x44a726={},_0x47203d={'count':0x0,'rows':[]};var _0x118b5d=_[_0xb1d5('0x2b')](db[_0xb1d5('0x2c')][_0xb1d5('0x2d')],function(_0x25f9f1){return{'name':_0x25f9f1['fieldName'],'type':_0x25f9f1[_0xb1d5('0x2e')]['key']};});_0x44a726['model']=_[_0xb1d5('0x2b')](_0x118b5d,_0xb1d5('0x29'));_0x44a726[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x17bb60[_0xb1d5('0x2f')]);_0x44a726[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x44a726[_0xb1d5('0x33')],_0x44a726[_0xb1d5('0x2f')]);_0x132c13['attributes']=_[_0xb1d5('0x32')](_0x44a726[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x17bb60['query'][_0xb1d5('0x34')]));_0x132c13[_0xb1d5('0x35')]=_0x132c13[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x132c13[_0xb1d5('0x35')]:_0x44a726[_0xb1d5('0x33')];if(!_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x132c13['limit']=qs[_0xb1d5('0x20')](_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x132c13[_0xb1d5('0x1f')]=qs[_0xb1d5('0x1f')](_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}_0x132c13[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x17bb60['query'][_0xb1d5('0x3a')]);_0x132c13[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x17bb60[_0xb1d5('0x2f')],_0x44a726['filters']),_0x118b5d);if(_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x132c13[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x132c13[_0xb1d5('0x3b')],{'$or':_['map'](_0x118b5d,function(_0xfbefbf){if(_0xfbefbf[_0xb1d5('0x2e')]!=='VIRTUAL'){var _0x195bc1={};_0x195bc1[_0xfbefbf[_0xb1d5('0x29')]]={'$like':'%'+_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0x195bc1;}})});}_0x132c13=_['merge']({},_0x132c13,_0x17bb60[_0xb1d5('0x3f')]);var _0x5cb7e2={'where':_0x132c13[_0xb1d5('0x3b')]};return db[_0xb1d5('0x2c')]['count'](_0x5cb7e2)[_0xb1d5('0x25')](function(_0x46c343){_0x47203d[_0xb1d5('0x40')]=_0x46c343;if(_0x17bb60['query'][_0xb1d5('0x41')]){_0x132c13[_0xb1d5('0x42')]=[{'all':!![]}];}return db[_0xb1d5('0x2c')][_0xb1d5('0x43')](_0x132c13);})[_0xb1d5('0x25')](function(_0x26d03d){_0x47203d[_0xb1d5('0x44')]=_0x26d03d;return _0x47203d;})[_0xb1d5('0x25')](respondWithFilteredResult(_0x917068,_0x132c13))[_0xb1d5('0x45')](handleError(_0x917068,null));};exports['show']=function(_0x4047ab,_0xd9812e){var _0x539a35={'raw':![],'where':{'id':_0x4047ab[_0xb1d5('0x46')]['id']}},_0x43a4dc={};_0x43a4dc[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db['ZendeskConfiguration'][_0xb1d5('0x2d')]);_0x43a4dc[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x4047ab[_0xb1d5('0x2f')]);_0x43a4dc['filters']=_[_0xb1d5('0x32')](_0x43a4dc[_0xb1d5('0x33')],_0x43a4dc[_0xb1d5('0x2f')]);_0x539a35[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x43a4dc[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x4047ab[_0xb1d5('0x2f')][_0xb1d5('0x34')]));_0x539a35['attributes']=_0x539a35['attributes'][_0xb1d5('0x36')]?_0x539a35[_0xb1d5('0x35')]:_0x43a4dc[_0xb1d5('0x33')];if(_0x4047ab[_0xb1d5('0x2f')]['includeAll']){_0x539a35[_0xb1d5('0x42')]=[{'all':!![]}];}_0x539a35=_[_0xb1d5('0x3e')]({},_0x539a35,_0x4047ab[_0xb1d5('0x3f')]);return db[_0xb1d5('0x2c')][_0xb1d5('0x47')](_0x539a35)[_0xb1d5('0x25')](handleEntityNotFound(_0xd9812e,null))[_0xb1d5('0x25')](respondWithResult(_0xd9812e,null))[_0xb1d5('0x45')](handleError(_0xd9812e,null));};exports['create']=function(_0x50b80e,_0x21603c){return db[_0xb1d5('0x2c')][_0xb1d5('0x48')](_0x50b80e[_0xb1d5('0x49')],{})[_0xb1d5('0x25')](respondWithResult(_0x21603c,0xc9))[_0xb1d5('0x45')](handleError(_0x21603c,null));};exports[_0xb1d5('0x24')]=function(_0x3d188f,_0x40b907){if(_0x3d188f['body']['id']){delete _0x3d188f[_0xb1d5('0x49')]['id'];}return db[_0xb1d5('0x2c')][_0xb1d5('0x47')]({'where':{'id':_0x3d188f['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x40b907,null))[_0xb1d5('0x25')](saveUpdates(_0x3d188f[_0xb1d5('0x49')],null))['then'](respondWithResult(_0x40b907,null))[_0xb1d5('0x45')](handleError(_0x40b907,null));};exports[_0xb1d5('0x26')]=function(_0x5e4923,_0x5d023f){return db['ZendeskConfiguration']['find']({'where':{'id':_0x5e4923['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x5d023f,null))['then'](removeEntity(_0x5d023f,null))['catch'](handleError(_0x5d023f,null));};exports[_0xb1d5('0x4a')]=function(_0x41e78e,_0x344f2b,_0x155eba){var _0x523804={};var _0x25a80b={};var _0x20aba1;var _0x28821a;return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x41e78e['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x344f2b,null))[_0xb1d5('0x25')](function(_0x43d86e){if(_0x43d86e){_0x20aba1=_0x43d86e;_0x25a80b[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')][_0xb1d5('0x2d')]);_0x25a80b[_0xb1d5('0x2f')]=_['keys'](_0x41e78e[_0xb1d5('0x2f')]);_0x25a80b[_0xb1d5('0x31')]=_['intersection'](_0x25a80b[_0xb1d5('0x33')],_0x25a80b[_0xb1d5('0x2f')]);_0x523804['attributes']=_['intersection'](_0x25a80b[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x34')]));_0x523804['attributes']=_0x523804[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x523804[_0xb1d5('0x35')]:_0x25a80b['model'];_0x523804[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x41e78e['query'][_0xb1d5('0x3a')]);_0x523804[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_['pick'](_0x41e78e[_0xb1d5('0x2f')],_0x25a80b[_0xb1d5('0x31')]));if(_0x41e78e[_0xb1d5('0x2f')]['filter']){_0x523804[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x523804[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x523804[_0xb1d5('0x35')],function(_0x42f744){var _0x4fe025={};_0x4fe025[_0x42f744]={'$like':'%'+_0x41e78e['query']['filter']+'%'};return _0x4fe025;})});}_0x523804=_[_0xb1d5('0x3e')]({},_0x523804,_0x41e78e[_0xb1d5('0x3f')]);return _0x20aba1[_0xb1d5('0x4a')](_0x523804);}})['then'](function(_0x389818){if(_0x389818){_0x28821a=_0x389818[_0xb1d5('0x36')];if(!_0x41e78e['query'][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x523804[_0xb1d5('0x20')]=qs[_0xb1d5('0x20')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x523804[_0xb1d5('0x1f')]=qs[_0xb1d5('0x1f')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x20aba1[_0xb1d5('0x4a')](_0x523804);}})[_0xb1d5('0x25')](function(_0x3f7efa){if(_0x3f7efa){return _0x3f7efa?{'count':_0x28821a,'rows':_0x3f7efa}:null;}})[_0xb1d5('0x25')](respondWithResult(_0x344f2b,null))['catch'](handleError(_0x344f2b,null));};exports[_0xb1d5('0x4d')]=function(_0x1f2ed8,_0x11f5e4,_0x16e309){var _0x240a50={};var _0x1a3ba9={};var _0xb087c5;var _0x4e7abc;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1f2ed8[_0xb1d5('0x46')]['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x11f5e4,null))[_0xb1d5('0x25')](function(_0x6c9052){if(_0x6c9052){_0xb087c5=_0x6c9052;_0x1a3ba9[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')]['rawAttributes']);_0x1a3ba9[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x1f2ed8[_0xb1d5('0x2f')]);_0x1a3ba9[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x1a3ba9['model'],_0x1a3ba9[_0xb1d5('0x2f')]);_0x240a50[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x1a3ba9[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x1f2ed8['query']['fields']));_0x240a50[_0xb1d5('0x35')]=_0x240a50[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x240a50[_0xb1d5('0x35')]:_0x1a3ba9[_0xb1d5('0x33')];_0x240a50[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x240a50['where']=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x1f2ed8[_0xb1d5('0x2f')],_0x1a3ba9['filters']));if(_0x1f2ed8['query'][_0xb1d5('0x3d')]){_0x240a50[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x240a50[_0xb1d5('0x3b')],{'$or':_['map'](_0x240a50[_0xb1d5('0x35')],function(_0x5e4fa7){var _0x530518={};_0x530518[_0x5e4fa7]={'$like':'%'+_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0x530518;})});}_0x240a50=_[_0xb1d5('0x3e')]({},_0x240a50,_0x1f2ed8[_0xb1d5('0x3f')]);return _0xb087c5['getSubjects'](_0x240a50);}})[_0xb1d5('0x25')](function(_0xb2435b){if(_0xb2435b){_0x4e7abc=_0xb2435b[_0xb1d5('0x36')];if(!_0x1f2ed8['query']['hasOwnProperty'](_0xb1d5('0x38'))){_0x240a50[_0xb1d5('0x20')]=qs['limit'](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x240a50['offset']=qs[_0xb1d5('0x1f')](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0xb087c5[_0xb1d5('0x4d')](_0x240a50);}})['then'](function(_0x1f3334){if(_0x1f3334){return _0x1f3334?{'count':_0x4e7abc,'rows':_0x1f3334}:null;}})['then'](respondWithResult(_0x11f5e4,null))['catch'](handleError(_0x11f5e4,null));};exports[_0xb1d5('0x4e')]=function(_0x3fbbdf,_0x89fb10,_0x337200){var _0x5ec3a1={};var _0x4c4b47={};var _0x3b64ca;var _0x20d02a;return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x3fbbdf[_0xb1d5('0x46')]['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x89fb10,null))[_0xb1d5('0x25')](function(_0x1ad1da){if(_0x1ad1da){_0x3b64ca=_0x1ad1da;_0x4c4b47[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')][_0xb1d5('0x2d')]);_0x4c4b47['query']=_[_0xb1d5('0x30')](_0x3fbbdf[_0xb1d5('0x2f')]);_0x4c4b47['filters']=_[_0xb1d5('0x32')](_0x4c4b47[_0xb1d5('0x33')],_0x4c4b47[_0xb1d5('0x2f')]);_0x5ec3a1[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x4c4b47[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x3fbbdf['query'][_0xb1d5('0x34')]));_0x5ec3a1[_0xb1d5('0x35')]=_0x5ec3a1[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x5ec3a1[_0xb1d5('0x35')]:_0x4c4b47[_0xb1d5('0x33')];_0x5ec3a1[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x5ec3a1['where']=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x3fbbdf['query'],_0x4c4b47[_0xb1d5('0x31')]));if(_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x5ec3a1[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x5ec3a1[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x5ec3a1[_0xb1d5('0x35')],function(_0x14271e){var _0x5ea042={};_0x5ea042[_0x14271e]={'$like':'%'+_0x3fbbdf[_0xb1d5('0x2f')]['filter']+'%'};return _0x5ea042;})});}_0x5ec3a1=_['merge']({},_0x5ec3a1,_0x3fbbdf[_0xb1d5('0x3f')]);return _0x3b64ca[_0xb1d5('0x4e')](_0x5ec3a1);}})[_0xb1d5('0x25')](function(_0x3f87b5){if(_0x3f87b5){_0x20d02a=_0x3f87b5[_0xb1d5('0x36')];if(!_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x5ec3a1[_0xb1d5('0x20')]=qs[_0xb1d5('0x20')](_0x3fbbdf['query']['limit']);_0x5ec3a1[_0xb1d5('0x1f')]=qs['offset'](_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x3b64ca[_0xb1d5('0x4e')](_0x5ec3a1);}})['then'](function(_0x34d69b){if(_0x34d69b){return _0x34d69b?{'count':_0x20d02a,'rows':_0x34d69b}:null;}})[_0xb1d5('0x25')](respondWithResult(_0x89fb10,null))[_0xb1d5('0x45')](handleError(_0x89fb10,null));};exports[_0xb1d5('0x4f')]=function(_0x52df97,_0xe4bf52,_0x2482be){var _0x293438={};var _0x457f5a={};var _0x55ca9c;var _0x14a9bd;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x52df97[_0xb1d5('0x46')]['id']}})['then'](handleEntityNotFound(_0xe4bf52,null))[_0xb1d5('0x25')](function(_0x40913c){if(_0x40913c){_0x55ca9c=_0x40913c;_0x457f5a[_0xb1d5('0x33')]=_['keys'](db[_0xb1d5('0x50')]['rawAttributes']);_0x457f5a[_0xb1d5('0x2f')]=_['keys'](_0x52df97[_0xb1d5('0x2f')]);_0x457f5a[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x457f5a[_0xb1d5('0x33')],_0x457f5a[_0xb1d5('0x2f')]);_0x293438[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x457f5a[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x52df97['query'][_0xb1d5('0x34')]));_0x293438[_0xb1d5('0x35')]=_0x293438[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x293438[_0xb1d5('0x35')]:_0x457f5a['model'];_0x293438[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x293438[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x52df97['query'],_0x457f5a[_0xb1d5('0x31')]));if(_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x293438[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x293438[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x293438['attributes'],function(_0x2470ed){var _0xc54833={};_0xc54833[_0x2470ed]={'$like':'%'+_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0xc54833;})});}_0x293438=_[_0xb1d5('0x3e')]({},_0x293438,_0x52df97[_0xb1d5('0x3f')]);return _0x55ca9c['getTags'](_0x293438);}})['then'](function(_0x55aff7){if(_0x55aff7){_0x14a9bd=_0x55aff7['length'];if(!_0x52df97['query'][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x293438[_0xb1d5('0x20')]=qs['limit'](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x293438[_0xb1d5('0x1f')]=qs['offset'](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x55ca9c['getTags'](_0x293438);}})[_0xb1d5('0x25')](function(_0x3cfe67){if(_0x3cfe67){return _0x3cfe67?{'count':_0x14a9bd,'rows':_0x3cfe67}:null;}})[_0xb1d5('0x25')](respondWithResult(_0xe4bf52,null))['catch'](handleError(_0xe4bf52,null));};exports['setTags']=function(_0x334d12,_0x57fdd4,_0x5cb306){if(_0x334d12[_0xb1d5('0x49')]['id']){delete _0x334d12[_0xb1d5('0x49')]['id'];}return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x334d12[_0xb1d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x57fdd4,null))[_0xb1d5('0x25')](function(_0xbb5490){if(_0xbb5490){return _0xbb5490[_0xb1d5('0x51')](_0x334d12[_0xb1d5('0x49')][_0xb1d5('0x52')]||[]);}return null;})[_0xb1d5('0x25')](respondWithResult(_0x57fdd4,null))['catch'](handleError(_0x57fdd4,null));}; \ No newline at end of file +var _0x7406=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','find','catch','create','body','params','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x2372b9,_0xccd0aa){var _0x181e26=function(_0x4bc5ca){while(--_0x4bc5ca){_0x2372b9['push'](_0x2372b9['shift']());}};_0x181e26(++_0xccd0aa);}(_0x7406,0x139));var _0x6740=function(_0x57f152,_0x34be17){_0x57f152=_0x57f152-0x0;var _0x283d82=_0x7406[_0x57f152];return _0x283d82;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6740('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6740('0x1'));var moment=require('moment');var BPromise=require(_0x6740('0x2'));var Mustache=require(_0x6740('0x3'));var util=require('util');var path=require(_0x6740('0x4'));var sox=require(_0x6740('0x5'));var csv=require(_0x6740('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6740('0x7'));var _=require('lodash');var squel=require(_0x6740('0x8'));var crypto=require(_0x6740('0x9'));var jsforce=require(_0x6740('0xa'));var deskjs=require(_0x6740('0xb'));var toCsv=require(_0x6740('0x6'));var querystring=require(_0x6740('0xc'));var Papa=require(_0x6740('0xd'));var Redis=require('ioredis');var authService=require(_0x6740('0xe'));var qs=require(_0x6740('0xf'));var as=require(_0x6740('0x10'));var hardwareService=require(_0x6740('0x11'));var logger=require(_0x6740('0x12'))(_0x6740('0x13'));var utils=require('../../config/utils');var config=require(_0x6740('0x14'));var licenseUtil=require(_0x6740('0x15'));var db=require(_0x6740('0x16'))['db'];function respondWithStatusCode(_0x31e00d,_0x5633ea){_0x5633ea=_0x5633ea||0xcc;return function(_0x30bb06){if(_0x30bb06){return _0x31e00d[_0x6740('0x17')](_0x5633ea);}return _0x31e00d[_0x6740('0x18')](_0x5633ea)[_0x6740('0x19')]();};}function respondWithResult(_0xfc5d77,_0x5422b1){_0x5422b1=_0x5422b1||0xc8;return function(_0x2c4f2a){if(_0x2c4f2a){return _0xfc5d77[_0x6740('0x18')](_0x5422b1)['json'](_0x2c4f2a);}};}function respondWithFilteredResult(_0x27106e,_0x1f5caf){return function(_0x2de476){if(_0x2de476){var _0x37ad42=typeof _0x1f5caf['offset']==='undefined'&&typeof _0x1f5caf['limit']===_0x6740('0x1a');var _0x78d66f=_0x2de476[_0x6740('0x1b')];var _0x17eb2d=_0x37ad42?0x0:_0x1f5caf[_0x6740('0x1c')];var _0xa620dc=_0x37ad42?_0x2de476['count']:_0x1f5caf[_0x6740('0x1c')]+_0x1f5caf[_0x6740('0x1d')];var _0x319c16;if(_0xa620dc>=_0x78d66f){_0xa620dc=_0x78d66f;_0x319c16=0xc8;}else{_0x319c16=0xce;}_0x27106e[_0x6740('0x18')](_0x319c16);return _0x27106e[_0x6740('0x1e')]('Content-Range',_0x17eb2d+'-'+_0xa620dc+'/'+_0x78d66f)[_0x6740('0x1f')](_0x2de476);}return null;};}function patchUpdates(_0x3fbe2d){return function(_0x2f1400){try{jsonpatch[_0x6740('0x20')](_0x2f1400,_0x3fbe2d,!![]);}catch(_0x4f3a9c){return BPromise[_0x6740('0x21')](_0x4f3a9c);}return _0x2f1400[_0x6740('0x22')]();};}function saveUpdates(_0xc0f600,_0x288c7d){return function(_0x56b088){if(_0x56b088){return _0x56b088[_0x6740('0x23')](_0xc0f600)[_0x6740('0x24')](function(_0x38eb57){return _0x38eb57;});}return null;};}function removeEntity(_0x2a3716,_0x4be36d){return function(_0x40a5dc){if(_0x40a5dc){return _0x40a5dc[_0x6740('0x25')]()[_0x6740('0x24')](function(){_0x2a3716['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48522b,_0x32f609){return function(_0x15d4a3){if(!_0x15d4a3){_0x48522b[_0x6740('0x17')](0x194);}return _0x15d4a3;};}function handleError(_0x22cc59,_0x291ce2){_0x291ce2=_0x291ce2||0x1f4;return function(_0x3e202c){logger[_0x6740('0x26')](_0x3e202c['stack']);if(_0x3e202c[_0x6740('0x27')]){delete _0x3e202c[_0x6740('0x27')];}_0x22cc59['status'](_0x291ce2)[_0x6740('0x28')](_0x3e202c);};}exports[_0x6740('0x29')]=function(_0x371033,_0x3474f8){var _0x1080b0={},_0x26ee48={},_0x198d41={'count':0x0,'rows':[]};var _0xd0b264=_[_0x6740('0x2a')](db[_0x6740('0x2b')][_0x6740('0x2c')],function(_0x38a823){return{'name':_0x38a823['fieldName'],'type':_0x38a823[_0x6740('0x2d')][_0x6740('0x2e')]};});_0x26ee48[_0x6740('0x2f')]=_[_0x6740('0x2a')](_0xd0b264,_0x6740('0x27'));_0x26ee48[_0x6740('0x30')]=_[_0x6740('0x31')](_0x371033[_0x6740('0x30')]);_0x26ee48[_0x6740('0x32')]=_[_0x6740('0x33')](_0x26ee48[_0x6740('0x2f')],_0x26ee48[_0x6740('0x30')]);_0x1080b0['attributes']=_[_0x6740('0x33')](_0x26ee48[_0x6740('0x2f')],qs[_0x6740('0x34')](_0x371033['query'][_0x6740('0x34')]));_0x1080b0['attributes']=_0x1080b0[_0x6740('0x35')][_0x6740('0x36')]?_0x1080b0['attributes']:_0x26ee48[_0x6740('0x2f')];if(!_0x371033[_0x6740('0x30')][_0x6740('0x37')](_0x6740('0x38'))){_0x1080b0[_0x6740('0x1d')]=qs[_0x6740('0x1d')](_0x371033[_0x6740('0x30')][_0x6740('0x1d')]);_0x1080b0[_0x6740('0x1c')]=qs[_0x6740('0x1c')](_0x371033[_0x6740('0x30')][_0x6740('0x1c')]);}_0x1080b0[_0x6740('0x39')]=qs['sort'](_0x371033[_0x6740('0x30')][_0x6740('0x3a')]);_0x1080b0[_0x6740('0x3b')]=qs[_0x6740('0x32')](_[_0x6740('0x3c')](_0x371033[_0x6740('0x30')],_0x26ee48[_0x6740('0x32')]),_0xd0b264);if(_0x371033[_0x6740('0x30')]['filter']){_0x1080b0[_0x6740('0x3b')]=_[_0x6740('0x3d')](_0x1080b0[_0x6740('0x3b')],{'$or':_[_0x6740('0x2a')](_0xd0b264,function(_0x104555){if(_0x104555[_0x6740('0x2d')]!==_0x6740('0x3e')){var _0x10ca1c={};_0x10ca1c[_0x104555[_0x6740('0x27')]]={'$like':'%'+_0x371033[_0x6740('0x30')][_0x6740('0x3f')]+'%'};return _0x10ca1c;}})});}_0x1080b0=_[_0x6740('0x3d')]({},_0x1080b0,_0x371033[_0x6740('0x40')]);var _0x21f55b={'where':_0x1080b0[_0x6740('0x3b')]};return db[_0x6740('0x2b')]['count'](_0x21f55b)[_0x6740('0x24')](function(_0x1a3ecd){_0x198d41['count']=_0x1a3ecd;if(_0x371033[_0x6740('0x30')][_0x6740('0x41')]){_0x1080b0[_0x6740('0x42')]=[{'all':!![]}];}return db[_0x6740('0x2b')]['findAll'](_0x1080b0);})['then'](function(_0x10ad7d){_0x198d41[_0x6740('0x43')]=_0x10ad7d;return _0x198d41;})[_0x6740('0x24')](respondWithFilteredResult(_0x3474f8,_0x1080b0))['catch'](handleError(_0x3474f8,null));};exports['show']=function(_0x4c9144,_0x1b3d28){var _0x1613d1={'raw':![],'where':{'id':_0x4c9144['params']['id']}},_0x614eeb={};_0x614eeb[_0x6740('0x2f')]=_[_0x6740('0x31')](db[_0x6740('0x2b')]['rawAttributes']);_0x614eeb[_0x6740('0x30')]=_[_0x6740('0x31')](_0x4c9144['query']);_0x614eeb['filters']=_[_0x6740('0x33')](_0x614eeb[_0x6740('0x2f')],_0x614eeb[_0x6740('0x30')]);_0x1613d1['attributes']=_[_0x6740('0x33')](_0x614eeb[_0x6740('0x2f')],qs['fields'](_0x4c9144[_0x6740('0x30')][_0x6740('0x34')]));_0x1613d1['attributes']=_0x1613d1[_0x6740('0x35')]['length']?_0x1613d1[_0x6740('0x35')]:_0x614eeb['model'];if(_0x4c9144['query'][_0x6740('0x41')]){_0x1613d1[_0x6740('0x42')]=[{'all':!![]}];}_0x1613d1=_[_0x6740('0x3d')]({},_0x1613d1,_0x4c9144[_0x6740('0x40')]);return db[_0x6740('0x2b')][_0x6740('0x44')](_0x1613d1)[_0x6740('0x24')](handleEntityNotFound(_0x1b3d28,null))['then'](respondWithResult(_0x1b3d28,null))[_0x6740('0x45')](handleError(_0x1b3d28,null));};exports[_0x6740('0x46')]=function(_0x433200,_0x1270c9){return db[_0x6740('0x2b')][_0x6740('0x46')](_0x433200[_0x6740('0x47')],{})[_0x6740('0x24')](respondWithResult(_0x1270c9,0xc9))[_0x6740('0x45')](handleError(_0x1270c9,null));};exports[_0x6740('0x23')]=function(_0x8fa7b,_0x302cc1){if(_0x8fa7b[_0x6740('0x47')]['id']){delete _0x8fa7b[_0x6740('0x47')]['id'];}return db[_0x6740('0x2b')][_0x6740('0x44')]({'where':{'id':_0x8fa7b['params']['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x302cc1,null))[_0x6740('0x24')](saveUpdates(_0x8fa7b[_0x6740('0x47')],null))[_0x6740('0x24')](respondWithResult(_0x302cc1,null))[_0x6740('0x45')](handleError(_0x302cc1,null));};exports[_0x6740('0x25')]=function(_0x361afa,_0x47b8df){return db[_0x6740('0x2b')][_0x6740('0x44')]({'where':{'id':_0x361afa[_0x6740('0x48')]['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x47b8df,null))[_0x6740('0x24')](removeEntity(_0x47b8df,null))[_0x6740('0x45')](handleError(_0x47b8df,null));};exports[_0x6740('0x49')]=function(_0x4f4068,_0x5365b1,_0x4c696b){var _0x17ffc2={};var _0x168592={};var _0x5ab95a;var _0x5ca65c;return db[_0x6740('0x2b')]['findOne']({'where':{'id':_0x4f4068[_0x6740('0x48')]['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x5365b1,null))[_0x6740('0x24')](function(_0xbc3422){if(_0xbc3422){_0x5ab95a=_0xbc3422;_0x168592[_0x6740('0x2f')]=_[_0x6740('0x31')](db[_0x6740('0x4a')][_0x6740('0x2c')]);_0x168592[_0x6740('0x30')]=_[_0x6740('0x31')](_0x4f4068['query']);_0x168592[_0x6740('0x32')]=_[_0x6740('0x33')](_0x168592['model'],_0x168592[_0x6740('0x30')]);_0x17ffc2[_0x6740('0x35')]=_[_0x6740('0x33')](_0x168592['model'],qs[_0x6740('0x34')](_0x4f4068[_0x6740('0x30')]['fields']));_0x17ffc2[_0x6740('0x35')]=_0x17ffc2[_0x6740('0x35')][_0x6740('0x36')]?_0x17ffc2[_0x6740('0x35')]:_0x168592[_0x6740('0x2f')];_0x17ffc2[_0x6740('0x39')]=qs[_0x6740('0x3a')](_0x4f4068['query'][_0x6740('0x3a')]);_0x17ffc2[_0x6740('0x3b')]=qs[_0x6740('0x32')](_['pick'](_0x4f4068[_0x6740('0x30')],_0x168592[_0x6740('0x32')]));if(_0x4f4068[_0x6740('0x30')][_0x6740('0x3f')]){_0x17ffc2[_0x6740('0x3b')]=_[_0x6740('0x3d')](_0x17ffc2['where'],{'$or':_[_0x6740('0x2a')](_0x17ffc2['attributes'],function(_0x849d1){var _0x3e72d2={};_0x3e72d2[_0x849d1]={'$like':'%'+_0x4f4068[_0x6740('0x30')]['filter']+'%'};return _0x3e72d2;})});}_0x17ffc2=_['merge']({},_0x17ffc2,_0x4f4068['options']);return _0x5ab95a['getFields'](_0x17ffc2);}})[_0x6740('0x24')](function(_0x58552f){if(_0x58552f){_0x5ca65c=_0x58552f[_0x6740('0x36')];if(!_0x4f4068[_0x6740('0x30')]['hasOwnProperty'](_0x6740('0x38'))){_0x17ffc2[_0x6740('0x1d')]=qs[_0x6740('0x1d')](_0x4f4068['query'][_0x6740('0x1d')]);_0x17ffc2[_0x6740('0x1c')]=qs[_0x6740('0x1c')](_0x4f4068[_0x6740('0x30')][_0x6740('0x1c')]);}return _0x5ab95a['getFields'](_0x17ffc2);}})[_0x6740('0x24')](function(_0x465a90){if(_0x465a90){return _0x465a90?{'count':_0x5ca65c,'rows':_0x465a90}:null;}})[_0x6740('0x24')](respondWithResult(_0x5365b1,null))['catch'](handleError(_0x5365b1,null));};exports[_0x6740('0x4b')]=function(_0x203360,_0x22078f,_0x2a7a38){var _0x850a27={};var _0xe950ce={};var _0x124eef;var _0x1dc7a8;return db[_0x6740('0x2b')][_0x6740('0x4c')]({'where':{'id':_0x203360[_0x6740('0x48')]['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x22078f,null))['then'](function(_0x24b653){if(_0x24b653){_0x124eef=_0x24b653;_0xe950ce[_0x6740('0x2f')]=_[_0x6740('0x31')](db['ZendeskField'][_0x6740('0x2c')]);_0xe950ce[_0x6740('0x30')]=_[_0x6740('0x31')](_0x203360[_0x6740('0x30')]);_0xe950ce['filters']=_[_0x6740('0x33')](_0xe950ce['model'],_0xe950ce['query']);_0x850a27[_0x6740('0x35')]=_['intersection'](_0xe950ce[_0x6740('0x2f')],qs['fields'](_0x203360[_0x6740('0x30')][_0x6740('0x34')]));_0x850a27[_0x6740('0x35')]=_0x850a27[_0x6740('0x35')][_0x6740('0x36')]?_0x850a27[_0x6740('0x35')]:_0xe950ce[_0x6740('0x2f')];_0x850a27[_0x6740('0x39')]=qs[_0x6740('0x3a')](_0x203360[_0x6740('0x30')][_0x6740('0x3a')]);_0x850a27[_0x6740('0x3b')]=qs[_0x6740('0x32')](_['pick'](_0x203360[_0x6740('0x30')],_0xe950ce[_0x6740('0x32')]));if(_0x203360[_0x6740('0x30')][_0x6740('0x3f')]){_0x850a27['where']=_[_0x6740('0x3d')](_0x850a27[_0x6740('0x3b')],{'$or':_[_0x6740('0x2a')](_0x850a27['attributes'],function(_0x2b29c1){var _0x3191a6={};_0x3191a6[_0x2b29c1]={'$like':'%'+_0x203360[_0x6740('0x30')][_0x6740('0x3f')]+'%'};return _0x3191a6;})});}_0x850a27=_[_0x6740('0x3d')]({},_0x850a27,_0x203360[_0x6740('0x40')]);return _0x124eef['getSubjects'](_0x850a27);}})['then'](function(_0x4a7956){if(_0x4a7956){_0x1dc7a8=_0x4a7956[_0x6740('0x36')];if(!_0x203360[_0x6740('0x30')][_0x6740('0x37')](_0x6740('0x38'))){_0x850a27['limit']=qs[_0x6740('0x1d')](_0x203360[_0x6740('0x30')][_0x6740('0x1d')]);_0x850a27[_0x6740('0x1c')]=qs['offset'](_0x203360[_0x6740('0x30')][_0x6740('0x1c')]);}return _0x124eef['getSubjects'](_0x850a27);}})[_0x6740('0x24')](function(_0x198c66){if(_0x198c66){return _0x198c66?{'count':_0x1dc7a8,'rows':_0x198c66}:null;}})[_0x6740('0x24')](respondWithResult(_0x22078f,null))[_0x6740('0x45')](handleError(_0x22078f,null));};exports['getDescriptions']=function(_0x40b83b,_0x12bb97,_0x37d4f1){var _0x116076={};var _0x2ccac2={};var _0x1e5c2c;var _0x5b64e1;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x40b83b[_0x6740('0x48')]['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x12bb97,null))['then'](function(_0xbdbfec){if(_0xbdbfec){_0x1e5c2c=_0xbdbfec;_0x2ccac2['model']=_[_0x6740('0x31')](db['ZendeskField'][_0x6740('0x2c')]);_0x2ccac2[_0x6740('0x30')]=_[_0x6740('0x31')](_0x40b83b[_0x6740('0x30')]);_0x2ccac2[_0x6740('0x32')]=_[_0x6740('0x33')](_0x2ccac2[_0x6740('0x2f')],_0x2ccac2[_0x6740('0x30')]);_0x116076[_0x6740('0x35')]=_[_0x6740('0x33')](_0x2ccac2[_0x6740('0x2f')],qs['fields'](_0x40b83b['query']['fields']));_0x116076[_0x6740('0x35')]=_0x116076[_0x6740('0x35')]['length']?_0x116076[_0x6740('0x35')]:_0x2ccac2[_0x6740('0x2f')];_0x116076[_0x6740('0x39')]=qs[_0x6740('0x3a')](_0x40b83b[_0x6740('0x30')]['sort']);_0x116076[_0x6740('0x3b')]=qs['filters'](_[_0x6740('0x3c')](_0x40b83b['query'],_0x2ccac2[_0x6740('0x32')]));if(_0x40b83b[_0x6740('0x30')][_0x6740('0x3f')]){_0x116076[_0x6740('0x3b')]=_['merge'](_0x116076[_0x6740('0x3b')],{'$or':_['map'](_0x116076[_0x6740('0x35')],function(_0x151948){var _0x533b93={};_0x533b93[_0x151948]={'$like':'%'+_0x40b83b[_0x6740('0x30')][_0x6740('0x3f')]+'%'};return _0x533b93;})});}_0x116076=_[_0x6740('0x3d')]({},_0x116076,_0x40b83b[_0x6740('0x40')]);return _0x1e5c2c[_0x6740('0x4d')](_0x116076);}})[_0x6740('0x24')](function(_0x42897e){if(_0x42897e){_0x5b64e1=_0x42897e['length'];if(!_0x40b83b['query'][_0x6740('0x37')]('nolimit')){_0x116076[_0x6740('0x1d')]=qs[_0x6740('0x1d')](_0x40b83b[_0x6740('0x30')]['limit']);_0x116076[_0x6740('0x1c')]=qs[_0x6740('0x1c')](_0x40b83b['query']['offset']);}return _0x1e5c2c[_0x6740('0x4d')](_0x116076);}})[_0x6740('0x24')](function(_0x4ea704){if(_0x4ea704){return _0x4ea704?{'count':_0x5b64e1,'rows':_0x4ea704}:null;}})[_0x6740('0x24')](respondWithResult(_0x12bb97,null))[_0x6740('0x45')](handleError(_0x12bb97,null));};exports[_0x6740('0x4e')]=function(_0xb38b0c,_0x3a635b,_0x473782){var _0x3b837f={};var _0x7e5ce2={};var _0x2dbfb8;var _0x29c1a5;return db['ZendeskConfiguration'][_0x6740('0x4c')]({'where':{'id':_0xb38b0c['params']['id']}})[_0x6740('0x24')](handleEntityNotFound(_0x3a635b,null))['then'](function(_0x3658bd){if(_0x3658bd){_0x2dbfb8=_0x3658bd;_0x7e5ce2[_0x6740('0x2f')]=_['keys'](db[_0x6740('0x4f')]['rawAttributes']);_0x7e5ce2['query']=_[_0x6740('0x31')](_0xb38b0c[_0x6740('0x30')]);_0x7e5ce2[_0x6740('0x32')]=_[_0x6740('0x33')](_0x7e5ce2[_0x6740('0x2f')],_0x7e5ce2[_0x6740('0x30')]);_0x3b837f[_0x6740('0x35')]=_[_0x6740('0x33')](_0x7e5ce2['model'],qs[_0x6740('0x34')](_0xb38b0c[_0x6740('0x30')]['fields']));_0x3b837f[_0x6740('0x35')]=_0x3b837f[_0x6740('0x35')]['length']?_0x3b837f[_0x6740('0x35')]:_0x7e5ce2[_0x6740('0x2f')];_0x3b837f[_0x6740('0x39')]=qs[_0x6740('0x3a')](_0xb38b0c[_0x6740('0x30')][_0x6740('0x3a')]);_0x3b837f[_0x6740('0x3b')]=qs[_0x6740('0x32')](_['pick'](_0xb38b0c[_0x6740('0x30')],_0x7e5ce2[_0x6740('0x32')]));if(_0xb38b0c[_0x6740('0x30')]['filter']){_0x3b837f[_0x6740('0x3b')]=_[_0x6740('0x3d')](_0x3b837f['where'],{'$or':_[_0x6740('0x2a')](_0x3b837f[_0x6740('0x35')],function(_0x5bcbb8){var _0x45aef5={};_0x45aef5[_0x5bcbb8]={'$like':'%'+_0xb38b0c[_0x6740('0x30')][_0x6740('0x3f')]+'%'};return _0x45aef5;})});}_0x3b837f=_[_0x6740('0x3d')]({},_0x3b837f,_0xb38b0c[_0x6740('0x40')]);return _0x2dbfb8[_0x6740('0x4e')](_0x3b837f);}})[_0x6740('0x24')](function(_0x2535ed){if(_0x2535ed){_0x29c1a5=_0x2535ed[_0x6740('0x36')];if(!_0xb38b0c['query'][_0x6740('0x37')]('nolimit')){_0x3b837f['limit']=qs[_0x6740('0x1d')](_0xb38b0c[_0x6740('0x30')][_0x6740('0x1d')]);_0x3b837f[_0x6740('0x1c')]=qs[_0x6740('0x1c')](_0xb38b0c[_0x6740('0x30')][_0x6740('0x1c')]);}return _0x2dbfb8['getTags'](_0x3b837f);}})[_0x6740('0x24')](function(_0x530a75){if(_0x530a75){return _0x530a75?{'count':_0x29c1a5,'rows':_0x530a75}:null;}})['then'](respondWithResult(_0x3a635b,null))[_0x6740('0x45')](handleError(_0x3a635b,null));};exports[_0x6740('0x50')]=function(_0x50c866,_0xb0bae1,_0x5c58fd){if(_0x50c866['body']['id']){delete _0x50c866[_0x6740('0x47')]['id'];}return db[_0x6740('0x2b')]['findOne']({'where':{'id':_0x50c866['params']['id']}})[_0x6740('0x24')](handleEntityNotFound(_0xb0bae1,null))[_0x6740('0x24')](function(_0x4ef6ce){if(_0x4ef6ce){return _0x4ef6ce['setTags'](_0x50c866[_0x6740('0x47')][_0x6740('0x51')]||[]);}return null;})[_0x6740('0x24')](respondWithResult(_0xb0bae1,null))[_0x6740('0x45')](handleError(_0xb0bae1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 42c3927..8be0df3 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 _0x9354=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9354,0x96));var _0x4935=function(_0x49aab7,_0x1d6397){_0x49aab7=_0x49aab7-0x0;var _0x587b6f=_0x9354[_0x49aab7];return _0x587b6f;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['moment','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x4281ab,_0x29af8d){var _0x4c3dbd=function(_0x5e893d){while(--_0x5e893d){_0x4281ab['push'](_0x4281ab['shift']());}};_0x4c3dbd(++_0x29af8d);}(_0xef0f,0x168));var _0xfef0=function(_0x4d1867,_0x2990d7){_0x4d1867=_0x4d1867-0x0;var _0x179ad3=_0xef0f[_0x4d1867];return _0x179ad3;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),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 07d01af..8a8b655 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 _0xc91e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x29f3cf,_0x2b64eb){var _0x9cc938=function(_0x29f584){while(--_0x29f584){_0x29f3cf['push'](_0x29f3cf['shift']());}};_0x9cc938(++_0x2b64eb);}(_0xc91e,0x89));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec91('0x0'));var util=require(_0xec91('0x1'));var moment=require(_0xec91('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec91('0x3'));var db=require(_0xec91('0x4'))['db'];var utils=require(_0xec91('0x5'));var logger=require(_0xec91('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec91('0x7')][_0xec91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54dcd5,_0x207d3f,_0x58939e){return new BPromise(function(_0xbefc63,_0x59c43d){return client[_0xec91('0x9')](_0x54dcd5,_0x58939e)[_0xec91('0xa')](function(_0x47fa7b){logger[_0xec91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0xec91('0xc'));logger[_0xec91('0xd')](_0xec91('0xe'),_0x207d3f,'request\x20sent',JSON['stringify'](_0x47fa7b));if(_0x47fa7b[_0xec91('0xf')]){if(_0x47fa7b[_0xec91('0xf')]['code']===0x1f4){logger[_0xec91('0xf')](_0xec91('0x10'),_0x207d3f,_0x47fa7b['error']['message']);return _0x59c43d(_0x47fa7b['error'][_0xec91('0x11')]);}logger[_0xec91('0xf')](_0xec91('0x10'),_0x207d3f,_0x47fa7b['error'][_0xec91('0x11')]);return _0xbefc63(_0x47fa7b['error'][_0xec91('0x11')]);}else{logger[_0xec91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0xec91('0xc'));_0xbefc63(_0x47fa7b[_0xec91('0x12')][_0xec91('0x11')]);}})[_0xec91('0x13')](function(_0x715d12){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0x715d12);_0x59c43d(_0x715d12);});});} \ No newline at end of file +var _0xc7ae=['http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x4ee1ac,_0x5082d2){var _0x42a3a0=function(_0x40a43c){while(--_0x40a43c){_0x4ee1ac['push'](_0x4ee1ac['shift']());}};_0x42a3a0(++_0x5082d2);}(_0xc7ae,0x76));var _0xec7a=function(_0x2f5f8f,_0x58e168){_0x2f5f8f=_0x2f5f8f-0x0;var _0x252b9c=_0xc7ae[_0x2f5f8f];return _0x252b9c;};'use strict';var _=require(_0xec7a('0x0'));var util=require('util');var moment=require(_0xec7a('0x1'));var BPromise=require('bluebird');var rs=require(_0xec7a('0x2'));var fs=require('fs');var Redis=require(_0xec7a('0x3'));var db=require(_0xec7a('0x4'))['db'];var utils=require(_0xec7a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xec7a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec7a('0x7')][_0xec7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26ead1,_0x3f7e39,_0x447fa9){return new BPromise(function(_0xa1e88a,_0x4da25f){return client['request'](_0x26ead1,_0x447fa9)[_0xec7a('0x9')](function(_0x3afb04){logger['info'](_0xec7a('0xa'),_0x3f7e39,_0xec7a('0xb'));logger[_0xec7a('0xc')](_0xec7a('0xd'),_0x3f7e39,_0xec7a('0xb'),JSON[_0xec7a('0xe')](_0x3afb04));if(_0x3afb04[_0xec7a('0xf')]){if(_0x3afb04[_0xec7a('0xf')][_0xec7a('0x10')]===0x1f4){logger[_0xec7a('0xf')](_0xec7a('0xa'),_0x3f7e39,_0x3afb04[_0xec7a('0xf')]['message']);return _0x4da25f(_0x3afb04[_0xec7a('0xf')][_0xec7a('0x11')]);}logger[_0xec7a('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3f7e39,_0x3afb04[_0xec7a('0xf')][_0xec7a('0x11')]);return _0xa1e88a(_0x3afb04['error'][_0xec7a('0x11')]);}else{logger[_0xec7a('0x12')](_0xec7a('0xa'),_0x3f7e39,_0xec7a('0xb'));_0xa1e88a(_0x3afb04[_0xec7a('0x13')][_0xec7a('0x11')]);}})[_0xec7a('0x14')](function(_0x4202d1){logger[_0xec7a('0xf')](_0xec7a('0xa'),_0x3f7e39,_0x4202d1);_0x4da25f(_0x4202d1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3b4ab44..8997a8a 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 _0x5afc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x10ecbe,_0x636711){var _0xa61172=function(_0x355310){while(--_0x355310){_0x10ecbe['push'](_0x10ecbe['shift']());}};_0xa61172(++_0x636711);}(_0x5afc,0x1d7));var _0xc5af=function(_0x10dc48,_0x1d3322){_0x10dc48=_0x10dc48-0x0;var _0x432b93=_0x5afc[_0x10dc48];return _0x432b93;};'use strict';var multer=require(_0xc5af('0x0'));var util=require('util');var path=require(_0xc5af('0x1'));var timeout=require('connect-timeout');var express=require(_0xc5af('0x2'));var router=express['Router']();var fs_extra=require(_0xc5af('0x3'));var auth=require(_0xc5af('0x4'));var interaction=require(_0xc5af('0x5'));var config=require(_0xc5af('0x6'));var controller=require('./intZendeskField.controller');router[_0xc5af('0x7')]('/',auth['isAuthenticated'](),controller[_0xc5af('0x8')]);router[_0xc5af('0x7')]('/:id',auth[_0xc5af('0x9')](),controller[_0xc5af('0xa')]);router[_0xc5af('0xb')]('/',auth[_0xc5af('0x9')](),controller[_0xc5af('0xc')]);router[_0xc5af('0xd')](_0xc5af('0xe'),auth['isAuthenticated'](),controller[_0xc5af('0xf')]);router[_0xc5af('0x10')](_0xc5af('0xe'),auth[_0xc5af('0x9')](),controller[_0xc5af('0x11')]);module[_0xc5af('0x12')]=router; \ No newline at end of file +var _0xe4dc=['multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports'];(function(_0x3e943f,_0xea1cc9){var _0x42e28f=function(_0x48a24f){while(--_0x48a24f){_0x3e943f['push'](_0x3e943f['shift']());}};_0x42e28f(++_0xea1cc9);}(_0xe4dc,0x66));var _0xce4d=function(_0x37a4d1,_0x5b5556){_0x37a4d1=_0x37a4d1-0x0;var _0x5237cf=_0xe4dc[_0x37a4d1];return _0x5237cf;};'use strict';var multer=require(_0xce4d('0x0'));var util=require('util');var path=require(_0xce4d('0x1'));var timeout=require('connect-timeout');var express=require(_0xce4d('0x2'));var router=express[_0xce4d('0x3')]();var fs_extra=require(_0xce4d('0x4'));var auth=require(_0xce4d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce4d('0x6'));var controller=require(_0xce4d('0x7'));router[_0xce4d('0x8')]('/',auth[_0xce4d('0x9')](),controller['index']);router[_0xce4d('0x8')](_0xce4d('0xa'),auth[_0xce4d('0x9')](),controller[_0xce4d('0xb')]);router[_0xce4d('0xc')]('/',auth[_0xce4d('0x9')](),controller['create']);router['put'](_0xce4d('0xa'),auth[_0xce4d('0x9')](),controller[_0xce4d('0xd')]);router[_0xce4d('0xe')](_0xce4d('0xa'),auth[_0xce4d('0x9')](),controller[_0xce4d('0xf')]);module[_0xce4d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 63cc9eb..5095feb 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 _0x1a8a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1a8a,0x154));var _0xa1a8=function(_0x523671,_0x4657fc){_0x523671=_0x523671-0x0;var _0x5b0bdc=_0x1a8a[_0x523671];return _0x5b0bdc;};'use strict';var Sequelize=require(_0xa1a8('0x0'));module[_0xa1a8('0x1')]={'type':{'type':Sequelize[_0xa1a8('0x2')](_0xa1a8('0x3'),_0xa1a8('0x4'),_0xa1a8('0x5'),_0xa1a8('0x6'),_0xa1a8('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa1a8('0x8')]},'key':{'type':Sequelize[_0xa1a8('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xa1a8('0x3'),'variable',_0xa1a8('0x5'))},'keyContent':{'type':Sequelize[_0xa1a8('0x8')]},'idField':{'type':Sequelize[_0xa1a8('0x8')]},'nameField':{'type':Sequelize[_0xa1a8('0x8')]},'customField':{'type':Sequelize[_0xa1a8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa1a8('0x8')]}}; \ No newline at end of file +var _0xc5bb=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xc5bb,0x92));var _0xbc5b=function(_0x475257,_0x59735f){_0x475257=_0x475257-0x0;var _0x33a403=_0xc5bb[_0x475257];return _0x33a403;};'use strict';var Sequelize=require(_0xbc5b('0x0'));module[_0xbc5b('0x1')]={'type':{'type':Sequelize[_0xbc5b('0x2')]('string',_0xbc5b('0x3'),'customVariable',_0xbc5b('0x4'),_0xbc5b('0x5')),'defaultValue':_0xbc5b('0x6')},'content':{'type':Sequelize[_0xbc5b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbc5b('0x2')](_0xbc5b('0x6'),_0xbc5b('0x3'),_0xbc5b('0x8'))},'keyContent':{'type':Sequelize[_0xbc5b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbc5b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 98ad02a..a40c0bf 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 _0x4676=['stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x4676,0x1e4));var _0x6467=function(_0xba5275,_0x2d3154){_0xba5275=_0xba5275-0x0;var _0x76015b=_0x4676[_0xba5275];return _0x76015b;};'use strict';var emlformat=require(_0x6467('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6467('0x1'));var jsonpatch=require(_0x6467('0x2'));var rp=require(_0x6467('0x3'));var moment=require(_0x6467('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6467('0x5'));var util=require(_0x6467('0x6'));var path=require(_0x6467('0x7'));var sox=require(_0x6467('0x8'));var csv=require(_0x6467('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6467('0xa'));var squel=require(_0x6467('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6467('0xc'));var toCsv=require(_0x6467('0x9'));var querystring=require(_0x6467('0xd'));var Papa=require(_0x6467('0xe'));var Redis=require(_0x6467('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6467('0x10'));var as=require(_0x6467('0x11'));var hardwareService=require(_0x6467('0x12'));var logger=require(_0x6467('0x13'))(_0x6467('0x14'));var utils=require(_0x6467('0x15'));var config=require(_0x6467('0x16'));var licenseUtil=require(_0x6467('0x17'));var db=require(_0x6467('0x18'))['db'];function respondWithStatusCode(_0x96012d,_0x1f6984){_0x1f6984=_0x1f6984||0xcc;return function(_0x41be48){if(_0x41be48){return _0x96012d[_0x6467('0x19')](_0x1f6984);}return _0x96012d[_0x6467('0x1a')](_0x1f6984)[_0x6467('0x1b')]();};}function respondWithResult(_0x272eca,_0x428ba8){_0x428ba8=_0x428ba8||0xc8;return function(_0x5a90c9){if(_0x5a90c9){return _0x272eca[_0x6467('0x1a')](_0x428ba8)[_0x6467('0x1c')](_0x5a90c9);}};}function respondWithFilteredResult(_0x383f85,_0x86e55e){return function(_0x599a96){if(_0x599a96){var _0xf89d03=typeof _0x86e55e[_0x6467('0x1d')]===_0x6467('0x1e')&&typeof _0x86e55e[_0x6467('0x1f')]==='undefined';var _0x4b0def=_0x599a96[_0x6467('0x20')];var _0x51edbd=_0xf89d03?0x0:_0x86e55e['offset'];var _0xefba83=_0xf89d03?_0x599a96['count']:_0x86e55e['offset']+_0x86e55e[_0x6467('0x1f')];var _0x420002;if(_0xefba83>=_0x4b0def){_0xefba83=_0x4b0def;_0x420002=0xc8;}else{_0x420002=0xce;}_0x383f85[_0x6467('0x1a')](_0x420002);return _0x383f85[_0x6467('0x21')]('Content-Range',_0x51edbd+'-'+_0xefba83+'/'+_0x4b0def)[_0x6467('0x1c')](_0x599a96);}return null;};}function patchUpdates(_0x3c3054){return function(_0x56d637){try{jsonpatch[_0x6467('0x22')](_0x56d637,_0x3c3054,!![]);}catch(_0x4f8161){return BPromise[_0x6467('0x23')](_0x4f8161);}return _0x56d637[_0x6467('0x24')]();};}function saveUpdates(_0x3658d2,_0x976daf){return function(_0x272e3e){if(_0x272e3e){return _0x272e3e[_0x6467('0x25')](_0x3658d2)[_0x6467('0x26')](function(_0x19fce0){return _0x19fce0;});}return null;};}function removeEntity(_0x3090ee,_0x3378b6){return function(_0x2764b3){if(_0x2764b3){return _0x2764b3[_0x6467('0x27')]()[_0x6467('0x26')](function(){_0x3090ee[_0x6467('0x1a')](0xcc)[_0x6467('0x1b')]();});}};}function handleEntityNotFound(_0x5bd104,_0x2f9008){return function(_0x515c16){if(!_0x515c16){_0x5bd104[_0x6467('0x19')](0x194);}return _0x515c16;};}function handleError(_0x27866e,_0x5bef58){_0x5bef58=_0x5bef58||0x1f4;return function(_0x36785f){logger[_0x6467('0x28')](_0x36785f[_0x6467('0x29')]);if(_0x36785f[_0x6467('0x2a')]){delete _0x36785f[_0x6467('0x2a')];}_0x27866e[_0x6467('0x1a')](_0x5bef58)['send'](_0x36785f);};}exports[_0x6467('0x2b')]=function(_0x19655d,_0x20da00){var _0x5b1add={},_0x2d7fcd={},_0x214f6e={'count':0x0,'rows':[]};var _0x48bd24=_[_0x6467('0x2c')](db[_0x6467('0x2d')][_0x6467('0x2e')],function(_0x2450d8){return{'name':_0x2450d8[_0x6467('0x2f')],'type':_0x2450d8['type'][_0x6467('0x30')]};});_0x2d7fcd[_0x6467('0x31')]=_[_0x6467('0x2c')](_0x48bd24,'name');_0x2d7fcd[_0x6467('0x32')]=_[_0x6467('0x33')](_0x19655d[_0x6467('0x32')]);_0x2d7fcd[_0x6467('0x34')]=_['intersection'](_0x2d7fcd[_0x6467('0x31')],_0x2d7fcd['query']);_0x5b1add[_0x6467('0x35')]=_[_0x6467('0x36')](_0x2d7fcd[_0x6467('0x31')],qs[_0x6467('0x37')](_0x19655d[_0x6467('0x32')][_0x6467('0x37')]));_0x5b1add[_0x6467('0x35')]=_0x5b1add[_0x6467('0x35')]['length']?_0x5b1add[_0x6467('0x35')]:_0x2d7fcd[_0x6467('0x31')];if(!_0x19655d[_0x6467('0x32')]['hasOwnProperty'](_0x6467('0x38'))){_0x5b1add[_0x6467('0x1f')]=qs[_0x6467('0x1f')](_0x19655d[_0x6467('0x32')][_0x6467('0x1f')]);_0x5b1add[_0x6467('0x1d')]=qs[_0x6467('0x1d')](_0x19655d[_0x6467('0x32')][_0x6467('0x1d')]);}_0x5b1add[_0x6467('0x39')]=qs[_0x6467('0x3a')](_0x19655d['query'][_0x6467('0x3a')]);_0x5b1add[_0x6467('0x3b')]=qs[_0x6467('0x34')](_[_0x6467('0x3c')](_0x19655d[_0x6467('0x32')],_0x2d7fcd[_0x6467('0x34')]),_0x48bd24);if(_0x19655d[_0x6467('0x32')]['filter']){_0x5b1add['where']=_[_0x6467('0x3d')](_0x5b1add[_0x6467('0x3b')],{'$or':_[_0x6467('0x2c')](_0x48bd24,function(_0x59274d){if(_0x59274d[_0x6467('0x3e')]!==_0x6467('0x3f')){var _0x853582={};_0x853582[_0x59274d[_0x6467('0x2a')]]={'$like':'%'+_0x19655d[_0x6467('0x32')][_0x6467('0x40')]+'%'};return _0x853582;}})});}_0x5b1add=_[_0x6467('0x3d')]({},_0x5b1add,_0x19655d[_0x6467('0x41')]);var _0x1fb437={'where':_0x5b1add[_0x6467('0x3b')]};return db['ZendeskField'][_0x6467('0x20')](_0x1fb437)[_0x6467('0x26')](function(_0x4c168f){_0x214f6e[_0x6467('0x20')]=_0x4c168f;if(_0x19655d['query'][_0x6467('0x42')]){_0x5b1add[_0x6467('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x6467('0x44')](_0x5b1add);})[_0x6467('0x26')](function(_0x2a3753){_0x214f6e['rows']=_0x2a3753;return _0x214f6e;})[_0x6467('0x26')](respondWithFilteredResult(_0x20da00,_0x5b1add))['catch'](handleError(_0x20da00,null));};exports[_0x6467('0x45')]=function(_0x3ff983,_0x42cd63){var _0x2c69e0={'raw':!![],'where':{'id':_0x3ff983[_0x6467('0x46')]['id']}},_0x4d5079={};_0x4d5079[_0x6467('0x31')]=_[_0x6467('0x33')](db[_0x6467('0x2d')][_0x6467('0x2e')]);_0x4d5079[_0x6467('0x32')]=_[_0x6467('0x33')](_0x3ff983[_0x6467('0x32')]);_0x4d5079[_0x6467('0x34')]=_[_0x6467('0x36')](_0x4d5079[_0x6467('0x31')],_0x4d5079['query']);_0x2c69e0[_0x6467('0x35')]=_[_0x6467('0x36')](_0x4d5079[_0x6467('0x31')],qs[_0x6467('0x37')](_0x3ff983[_0x6467('0x32')][_0x6467('0x37')]));_0x2c69e0[_0x6467('0x35')]=_0x2c69e0['attributes']['length']?_0x2c69e0[_0x6467('0x35')]:_0x4d5079[_0x6467('0x31')];if(_0x3ff983[_0x6467('0x32')][_0x6467('0x42')]){_0x2c69e0[_0x6467('0x43')]=[{'all':!![]}];}_0x2c69e0=_[_0x6467('0x3d')]({},_0x2c69e0,_0x3ff983[_0x6467('0x41')]);return db[_0x6467('0x2d')][_0x6467('0x47')](_0x2c69e0)['then'](handleEntityNotFound(_0x42cd63,null))[_0x6467('0x26')](respondWithResult(_0x42cd63,null))['catch'](handleError(_0x42cd63,null));};exports[_0x6467('0x48')]=function(_0x18d991,_0x50a727){return db[_0x6467('0x2d')]['create'](_0x18d991[_0x6467('0x49')],{})[_0x6467('0x26')](respondWithResult(_0x50a727,0xc9))[_0x6467('0x4a')](handleError(_0x50a727,null));};exports[_0x6467('0x25')]=function(_0x1fb47d,_0x3fea3e){if(_0x1fb47d[_0x6467('0x49')]['id']){delete _0x1fb47d['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x1fb47d['params']['id']}})['then'](handleEntityNotFound(_0x3fea3e,null))[_0x6467('0x26')](saveUpdates(_0x1fb47d[_0x6467('0x49')],null))[_0x6467('0x26')](respondWithResult(_0x3fea3e,null))[_0x6467('0x4a')](handleError(_0x3fea3e,null));};exports[_0x6467('0x27')]=function(_0x477d78,_0x5debc3){return db[_0x6467('0x2d')]['find']({'where':{'id':_0x477d78['params']['id']}})['then'](handleEntityNotFound(_0x5debc3,null))[_0x6467('0x26')](removeEntity(_0x5debc3,null))[_0x6467('0x4a')](handleError(_0x5debc3,null));}; \ No newline at end of file +var _0xa5cb=['map','ZendeskField','rawAttributes','fieldName','type','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','send','index'];(function(_0x1bf8cd,_0x50c7b9){var _0x47d4f1=function(_0x24ec8a){while(--_0x24ec8a){_0x1bf8cd['push'](_0x1bf8cd['shift']());}};_0x47d4f1(++_0x50c7b9);}(_0xa5cb,0x17e));var _0xba5c=function(_0xb88256,_0x5afd55){_0xb88256=_0xb88256-0x0;var _0x460c54=_0xa5cb[_0xb88256];return _0x460c54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba5c('0x0'));var zipdir=require(_0xba5c('0x1'));var jsonpatch=require(_0xba5c('0x2'));var rp=require(_0xba5c('0x3'));var moment=require('moment');var BPromise=require(_0xba5c('0x4'));var Mustache=require(_0xba5c('0x5'));var util=require(_0xba5c('0x6'));var path=require('path');var sox=require(_0xba5c('0x7'));var csv=require(_0xba5c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba5c('0x9'));var _=require('lodash');var squel=require(_0xba5c('0xa'));var crypto=require(_0xba5c('0xb'));var jsforce=require(_0xba5c('0xc'));var deskjs=require(_0xba5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba5c('0xe'));var Papa=require('papaparse');var Redis=require(_0xba5c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba5c('0x10'));var as=require(_0xba5c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba5c('0x12'))(_0xba5c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xba5c('0x14'));var db=require(_0xba5c('0x15'))['db'];function respondWithStatusCode(_0x439ed4,_0x2ac516){_0x2ac516=_0x2ac516||0xcc;return function(_0x39f1f9){if(_0x39f1f9){return _0x439ed4[_0xba5c('0x16')](_0x2ac516);}return _0x439ed4[_0xba5c('0x17')](_0x2ac516)[_0xba5c('0x18')]();};}function respondWithResult(_0x471427,_0x533b1d){_0x533b1d=_0x533b1d||0xc8;return function(_0x1452aa){if(_0x1452aa){return _0x471427['status'](_0x533b1d)[_0xba5c('0x19')](_0x1452aa);}};}function respondWithFilteredResult(_0x4dd1e5,_0x3eeb9f){return function(_0x43ce8d){if(_0x43ce8d){var _0x4e3c8f=typeof _0x3eeb9f[_0xba5c('0x1a')]===_0xba5c('0x1b')&&typeof _0x3eeb9f[_0xba5c('0x1c')]===_0xba5c('0x1b');var _0x128271=_0x43ce8d['count'];var _0x38c2b4=_0x4e3c8f?0x0:_0x3eeb9f['offset'];var _0x1c998e=_0x4e3c8f?_0x43ce8d[_0xba5c('0x1d')]:_0x3eeb9f[_0xba5c('0x1a')]+_0x3eeb9f['limit'];var _0x26b474;if(_0x1c998e>=_0x128271){_0x1c998e=_0x128271;_0x26b474=0xc8;}else{_0x26b474=0xce;}_0x4dd1e5[_0xba5c('0x17')](_0x26b474);return _0x4dd1e5[_0xba5c('0x1e')](_0xba5c('0x1f'),_0x38c2b4+'-'+_0x1c998e+'/'+_0x128271)['json'](_0x43ce8d);}return null;};}function patchUpdates(_0x224869){return function(_0x3b085c){try{jsonpatch[_0xba5c('0x20')](_0x3b085c,_0x224869,!![]);}catch(_0x41ccc0){return BPromise[_0xba5c('0x21')](_0x41ccc0);}return _0x3b085c['save']();};}function saveUpdates(_0x125eaf,_0x1b97d5){return function(_0x234c2){if(_0x234c2){return _0x234c2[_0xba5c('0x22')](_0x125eaf)['then'](function(_0x369866){return _0x369866;});}return null;};}function removeEntity(_0x4d76e8,_0x3073cb){return function(_0x19ef05){if(_0x19ef05){return _0x19ef05['destroy']()[_0xba5c('0x23')](function(){_0x4d76e8[_0xba5c('0x17')](0xcc)[_0xba5c('0x18')]();});}};}function handleEntityNotFound(_0x505780,_0x252585){return function(_0x5f386c){if(!_0x5f386c){_0x505780[_0xba5c('0x16')](0x194);}return _0x5f386c;};}function handleError(_0x1ca9fb,_0x48c035){_0x48c035=_0x48c035||0x1f4;return function(_0x40cfa1){logger['error'](_0x40cfa1['stack']);if(_0x40cfa1['name']){delete _0x40cfa1['name'];}_0x1ca9fb[_0xba5c('0x17')](_0x48c035)[_0xba5c('0x24')](_0x40cfa1);};}exports[_0xba5c('0x25')]=function(_0x23160e,_0x2f1739){var _0x559126={},_0x21f7dd={},_0x19e72d={'count':0x0,'rows':[]};var _0x5976a6=_[_0xba5c('0x26')](db[_0xba5c('0x27')][_0xba5c('0x28')],function(_0x44346b){return{'name':_0x44346b[_0xba5c('0x29')],'type':_0x44346b[_0xba5c('0x2a')]['key']};});_0x21f7dd[_0xba5c('0x2b')]=_[_0xba5c('0x26')](_0x5976a6,_0xba5c('0x2c'));_0x21f7dd[_0xba5c('0x2d')]=_['keys'](_0x23160e[_0xba5c('0x2d')]);_0x21f7dd['filters']=_[_0xba5c('0x2e')](_0x21f7dd['model'],_0x21f7dd['query']);_0x559126[_0xba5c('0x2f')]=_[_0xba5c('0x2e')](_0x21f7dd[_0xba5c('0x2b')],qs['fields'](_0x23160e['query'][_0xba5c('0x30')]));_0x559126[_0xba5c('0x2f')]=_0x559126['attributes'][_0xba5c('0x31')]?_0x559126[_0xba5c('0x2f')]:_0x21f7dd[_0xba5c('0x2b')];if(!_0x23160e[_0xba5c('0x2d')][_0xba5c('0x32')](_0xba5c('0x33'))){_0x559126[_0xba5c('0x1c')]=qs['limit'](_0x23160e['query'][_0xba5c('0x1c')]);_0x559126['offset']=qs[_0xba5c('0x1a')](_0x23160e[_0xba5c('0x2d')]['offset']);}_0x559126[_0xba5c('0x34')]=qs[_0xba5c('0x35')](_0x23160e[_0xba5c('0x2d')]['sort']);_0x559126[_0xba5c('0x36')]=qs[_0xba5c('0x37')](_[_0xba5c('0x38')](_0x23160e[_0xba5c('0x2d')],_0x21f7dd['filters']),_0x5976a6);if(_0x23160e[_0xba5c('0x2d')]['filter']){_0x559126[_0xba5c('0x36')]=_[_0xba5c('0x39')](_0x559126[_0xba5c('0x36')],{'$or':_[_0xba5c('0x26')](_0x5976a6,function(_0x3c909b){if(_0x3c909b[_0xba5c('0x2a')]!=='VIRTUAL'){var _0x485651={};_0x485651[_0x3c909b[_0xba5c('0x2c')]]={'$like':'%'+_0x23160e[_0xba5c('0x2d')]['filter']+'%'};return _0x485651;}})});}_0x559126=_[_0xba5c('0x39')]({},_0x559126,_0x23160e[_0xba5c('0x3a')]);var _0xeb5e11={'where':_0x559126['where']};return db[_0xba5c('0x27')]['count'](_0xeb5e11)[_0xba5c('0x23')](function(_0x2badef){_0x19e72d[_0xba5c('0x1d')]=_0x2badef;if(_0x23160e['query'][_0xba5c('0x3b')]){_0x559126[_0xba5c('0x3c')]=[{'all':!![]}];}return db[_0xba5c('0x27')][_0xba5c('0x3d')](_0x559126);})[_0xba5c('0x23')](function(_0x4ee074){_0x19e72d[_0xba5c('0x3e')]=_0x4ee074;return _0x19e72d;})['then'](respondWithFilteredResult(_0x2f1739,_0x559126))[_0xba5c('0x3f')](handleError(_0x2f1739,null));};exports['show']=function(_0x417589,_0x353e0d){var _0x5a097d={'raw':!![],'where':{'id':_0x417589[_0xba5c('0x40')]['id']}},_0x4896fc={};_0x4896fc[_0xba5c('0x2b')]=_[_0xba5c('0x41')](db[_0xba5c('0x27')][_0xba5c('0x28')]);_0x4896fc[_0xba5c('0x2d')]=_['keys'](_0x417589[_0xba5c('0x2d')]);_0x4896fc[_0xba5c('0x37')]=_['intersection'](_0x4896fc[_0xba5c('0x2b')],_0x4896fc[_0xba5c('0x2d')]);_0x5a097d['attributes']=_[_0xba5c('0x2e')](_0x4896fc[_0xba5c('0x2b')],qs['fields'](_0x417589[_0xba5c('0x2d')][_0xba5c('0x30')]));_0x5a097d[_0xba5c('0x2f')]=_0x5a097d[_0xba5c('0x2f')][_0xba5c('0x31')]?_0x5a097d[_0xba5c('0x2f')]:_0x4896fc[_0xba5c('0x2b')];if(_0x417589[_0xba5c('0x2d')]['includeAll']){_0x5a097d[_0xba5c('0x3c')]=[{'all':!![]}];}_0x5a097d=_[_0xba5c('0x39')]({},_0x5a097d,_0x417589[_0xba5c('0x3a')]);return db[_0xba5c('0x27')]['find'](_0x5a097d)[_0xba5c('0x23')](handleEntityNotFound(_0x353e0d,null))[_0xba5c('0x23')](respondWithResult(_0x353e0d,null))[_0xba5c('0x3f')](handleError(_0x353e0d,null));};exports[_0xba5c('0x42')]=function(_0x482500,_0x342580){return db['ZendeskField'][_0xba5c('0x42')](_0x482500[_0xba5c('0x43')],{})[_0xba5c('0x23')](respondWithResult(_0x342580,0xc9))[_0xba5c('0x3f')](handleError(_0x342580,null));};exports[_0xba5c('0x22')]=function(_0x55261a,_0x3512f8){if(_0x55261a[_0xba5c('0x43')]['id']){delete _0x55261a['body']['id'];}return db[_0xba5c('0x27')][_0xba5c('0x44')]({'where':{'id':_0x55261a[_0xba5c('0x40')]['id']}})[_0xba5c('0x23')](handleEntityNotFound(_0x3512f8,null))[_0xba5c('0x23')](saveUpdates(_0x55261a[_0xba5c('0x43')],null))[_0xba5c('0x23')](respondWithResult(_0x3512f8,null))['catch'](handleError(_0x3512f8,null));};exports[_0xba5c('0x45')]=function(_0x2b186b,_0x1bd5a5){return db[_0xba5c('0x27')][_0xba5c('0x44')]({'where':{'id':_0x2b186b[_0xba5c('0x40')]['id']}})[_0xba5c('0x23')](handleEntityNotFound(_0x1bd5a5,null))[_0xba5c('0x23')](removeEntity(_0x1bd5a5,null))[_0xba5c('0x3f')](handleError(_0x1bd5a5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index a1978a8..834ead4 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 _0x163a=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x163a,0x129));var _0xa163=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x163a[_0x409deb];return _0x15a4f7;};'use strict';var _=require('lodash');var util=require(_0xa163('0x0'));var logger=require(_0xa163('0x1'))(_0xa163('0x2'));var moment=require('moment');var BPromise=require(_0xa163('0x3'));var rp=require(_0xa163('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa163('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4de606,_0x520e14){return _0x4de606['define'](_0xa163('0x6'),attributes,{'tableName':_0xa163('0x7'),'paranoid':![],'indexes':[{'name':_0xa163('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4daa=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x47aff3,_0x44c5b2){var _0x41df14=function(_0x18fe17){while(--_0x18fe17){_0x47aff3['push'](_0x47aff3['shift']());}};_0x41df14(++_0x44c5b2);}(_0x4daa,0xf0));var _0xa4da=function(_0x43c3db,_0x36ea7b){_0x43c3db=_0x43c3db-0x0;var _0x45e6b0=_0x4daa[_0x43c3db];return _0x45e6b0;};'use strict';var _=require(_0xa4da('0x0'));var util=require(_0xa4da('0x1'));var logger=require(_0xa4da('0x2'))(_0xa4da('0x3'));var moment=require('moment');var BPromise=require(_0xa4da('0x4'));var rp=require(_0xa4da('0x5'));var fs=require('fs');var path=require(_0xa4da('0x6'));var rimraf=require(_0xa4da('0x7'));var config=require(_0xa4da('0x8'));var attributes=require(_0xa4da('0x9'));module[_0xa4da('0xa')]=function(_0x2f0e5b,_0x284ee8){return _0x2f0e5b[_0xa4da('0xb')](_0xa4da('0xc'),attributes,{'tableName':_0xa4da('0xd'),'paranoid':![],'indexes':[{'name':_0xa4da('0xe'),'fields':[_0xa4da('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index b9f49f2..313bcca 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 _0xe1a2=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskField,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2bca33,_0x220c00){var _0x290fea=function(_0x569e15){while(--_0x569e15){_0x2bca33['push'](_0x2bca33['shift']());}};_0x290fea(++_0x220c00);}(_0xe1a2,0x1cf));var _0x2e1a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe1a2[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x2e1a('0x0'));var util=require('util');var moment=require(_0x2e1a('0x1'));var BPromise=require(_0x2e1a('0x2'));var rs=require(_0x2e1a('0x3'));var fs=require('fs');var Redis=require(_0x2e1a('0x4'));var db=require(_0x2e1a('0x5'))['db'];var utils=require(_0x2e1a('0x6'));var logger=require(_0x2e1a('0x7'))(_0x2e1a('0x8'));var config=require(_0x2e1a('0x9'));var jayson=require(_0x2e1a('0xa'));var client=jayson[_0x2e1a('0xb')][_0x2e1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114897,_0x339415,_0x3fdd46){return new BPromise(function(_0x10bee6,_0x354ae8){return client[_0x2e1a('0xd')](_0x114897,_0x3fdd46)[_0x2e1a('0xe')](function(_0x1c15f9){logger[_0x2e1a('0xf')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x2e1a('0x10'));logger[_0x2e1a('0x11')](_0x2e1a('0x12'),_0x339415,_0x2e1a('0x10'),JSON[_0x2e1a('0x13')](_0x1c15f9));if(_0x1c15f9[_0x2e1a('0x14')]){if(_0x1c15f9[_0x2e1a('0x14')]['code']===0x1f4){logger[_0x2e1a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);return _0x354ae8(_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);}logger[_0x2e1a('0x14')](_0x2e1a('0x16'),_0x339415,_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);return _0x10bee6(_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);}else{logger[_0x2e1a('0xf')](_0x2e1a('0x16'),_0x339415,_0x2e1a('0x10'));_0x10bee6(_0x1c15f9[_0x2e1a('0x17')]['message']);}})['catch'](function(_0x2d40b6){logger[_0x2e1a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x2d40b6);_0x354ae8(_0x2d40b6);});});} \ No newline at end of file +var _0x0839=['../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0839,0x134));var _0x9083=function(_0x1f47f4,_0x1d6631){_0x1f47f4=_0x1f47f4-0x0;var _0x175921=_0x0839[_0x1f47f4];return _0x175921;};'use strict';var _=require(_0x9083('0x0'));var util=require(_0x9083('0x1'));var moment=require(_0x9083('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9083('0x3'));var db=require(_0x9083('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9083('0x5'))(_0x9083('0x6'));var config=require(_0x9083('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9083('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d02e,_0x1c56a0,_0x5dd798){return new BPromise(function(_0x3b42e3,_0x36900b){return client[_0x9083('0x9')](_0x25d02e,_0x5dd798)[_0x9083('0xa')](function(_0x1899c9){logger[_0x9083('0xb')](_0x9083('0xc'),_0x1c56a0,_0x9083('0xd'));logger[_0x9083('0xe')](_0x9083('0xf'),_0x1c56a0,_0x9083('0xd'),JSON[_0x9083('0x10')](_0x1899c9));if(_0x1899c9[_0x9083('0x11')]){if(_0x1899c9[_0x9083('0x11')][_0x9083('0x12')]===0x1f4){logger[_0x9083('0x11')]('ZendeskField,\x20%s,\x20%s',_0x1c56a0,_0x1899c9[_0x9083('0x11')]['message']);return _0x36900b(_0x1899c9['error']['message']);}logger[_0x9083('0x11')]('ZendeskField,\x20%s,\x20%s',_0x1c56a0,_0x1899c9[_0x9083('0x11')][_0x9083('0x13')]);return _0x3b42e3(_0x1899c9['error'][_0x9083('0x13')]);}else{logger[_0x9083('0xb')](_0x9083('0xc'),_0x1c56a0,_0x9083('0xd'));_0x3b42e3(_0x1899c9[_0x9083('0x14')][_0x9083('0x13')]);}})['catch'](function(_0x48a2b5){logger[_0x9083('0x11')](_0x9083('0xc'),_0x1c56a0,_0x48a2b5);_0x36900b(_0x48a2b5);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 95a4c49..ef33816 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 _0x9e10=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','get'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x9e10,0x78));var _0x09e1=function(_0x197ae1,_0x52b99f){_0x197ae1=_0x197ae1-0x0;var _0xe837c5=_0x9e10[_0x197ae1];return _0xe837c5;};'use strict';var multer=require(_0x09e1('0x0'));var util=require(_0x09e1('0x1'));var path=require(_0x09e1('0x2'));var timeout=require(_0x09e1('0x3'));var express=require('express');var router=express[_0x09e1('0x4')]();var fs_extra=require(_0x09e1('0x5'));var auth=require(_0x09e1('0x6'));var interaction=require(_0x09e1('0x7'));var config=require(_0x09e1('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x09e1('0x9')](),controller['index']);router['get']('/:id',auth[_0x09e1('0x9')](),controller[_0x09e1('0xa')]);router[_0x09e1('0xb')](_0x09e1('0xc'),auth['isAuthenticated'](),controller[_0x09e1('0xd')]);router[_0x09e1('0xb')](_0x09e1('0xe'),auth[_0x09e1('0x9')](),controller[_0x09e1('0xf')]);router['post']('/',auth[_0x09e1('0x9')](),controller[_0x09e1('0x10')]);router[_0x09e1('0x11')](_0x09e1('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x09e1('0x12'),auth[_0x09e1('0x9')](),controller[_0x09e1('0x13')]);router['delete']('/:id',auth[_0x09e1('0x9')](),controller[_0x09e1('0x14')]);module[_0x09e1('0x15')]=router; \ No newline at end of file +var _0xa0cf=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','update','exports','multer'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xa0cf,0x164));var _0xfa0c=function(_0x3df31d,_0x5081ff){_0x3df31d=_0x3df31d-0x0;var _0x352dbc=_0xa0cf[_0x3df31d];return _0x352dbc;};'use strict';var multer=require(_0xfa0c('0x0'));var util=require(_0xfa0c('0x1'));var path=require(_0xfa0c('0x2'));var timeout=require(_0xfa0c('0x3'));var express=require(_0xfa0c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfa0c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa0c('0x6'));var controller=require(_0xfa0c('0x7'));router[_0xfa0c('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa0c('0x9')]);router[_0xfa0c('0x8')]('/:id',auth[_0xfa0c('0xa')](),controller[_0xfa0c('0xb')]);router[_0xfa0c('0x8')](_0xfa0c('0xc'),auth[_0xfa0c('0xa')](),controller[_0xfa0c('0xd')]);router['get'](_0xfa0c('0xe'),auth[_0xfa0c('0xa')](),controller[_0xfa0c('0xf')]);router[_0xfa0c('0x10')]('/',auth[_0xfa0c('0xa')](),controller['create']);router[_0xfa0c('0x10')]('/:id/configurations',auth[_0xfa0c('0xa')](),controller['addConfiguration']);router[_0xfa0c('0x11')](_0xfa0c('0x12'),auth['isAuthenticated'](),controller[_0xfa0c('0x13')]);router['delete'](_0xfa0c('0x12'),auth[_0xfa0c('0xa')](),controller['destroy']);module[_0xfa0c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5054ff4..b6dfe73 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 _0x4522=['STRING'];(function(_0x416590,_0x3546fd){var _0x531efd=function(_0x5e9eb0){while(--_0x5e9eb0){_0x416590['push'](_0x416590['shift']());}};_0x531efd(++_0x3546fd);}(_0x4522,0x1a0));var _0x2452=function(_0x2ec6be,_0x504fd6){_0x2ec6be=_0x2ec6be-0x0;var _0xdda31d=_0x4522[_0x2ec6be];return _0xdda31d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file +var _0xe5b3=['STRING','exports'];(function(_0xd315d8,_0x5e5a96){var _0x506efe=function(_0x566199){while(--_0x566199){_0xd315d8['push'](_0xd315d8['shift']());}};_0x506efe(++_0x5e5a96);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ed08e,_0x31e039){_0x2ed08e=_0x2ed08e-0x0;var _0x5d98cb=_0xe5b3[_0x2ed08e];return _0x5d98cb;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 0f9782f..3abf0de 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 _0x202d=['stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','merge','catch','create','update','body','find','getConfigurations','findOne','ZohoConfiguration','map','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','code','zoho.eu','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x263674,_0x14dd6f){var _0x397fff=function(_0x94410c){while(--_0x94410c){_0x263674['push'](_0x263674['shift']());}};_0x397fff(++_0x14dd6f);}(_0x202d,0x18c));var _0xd202=function(_0x4f5409,_0x522de0){_0x4f5409=_0x4f5409-0x0;var _0x5722c8=_0x202d[_0x4f5409];return _0x5722c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd202('0x0'));var zipdir=require(_0xd202('0x1'));var jsonpatch=require(_0xd202('0x2'));var rp=require(_0xd202('0x3'));var moment=require('moment');var BPromise=require(_0xd202('0x4'));var Mustache=require(_0xd202('0x5'));var util=require(_0xd202('0x6'));var path=require(_0xd202('0x7'));var sox=require('sox');var csv=require(_0xd202('0x8'));var ejs=require(_0xd202('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd202('0xa'));var squel=require(_0xd202('0xb'));var crypto=require(_0xd202('0xc'));var jsforce=require(_0xd202('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd202('0xe'));var Papa=require(_0xd202('0xf'));var Redis=require(_0xd202('0x10'));var authService=require(_0xd202('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd202('0x12'));var hardwareService=require(_0xd202('0x13'));var logger=require(_0xd202('0x14'))(_0xd202('0x15'));var utils=require(_0xd202('0x16'));var config=require(_0xd202('0x17'));var licenseUtil=require(_0xd202('0x18'));var db=require(_0xd202('0x19'))['db'];var integrations=require(_0xd202('0x1a'));function respondWithStatusCode(_0x3a832b,_0x3c84c2){_0x3c84c2=_0x3c84c2||0xcc;return function(_0x5bf670){if(_0x5bf670){return _0x3a832b[_0xd202('0x1b')](_0x3c84c2);}return _0x3a832b[_0xd202('0x1c')](_0x3c84c2)[_0xd202('0x1d')]();};}function respondWithResult(_0x4e5f42,_0x5ce8d9){_0x5ce8d9=_0x5ce8d9||0xc8;return function(_0x25804b){if(_0x25804b){return _0x4e5f42[_0xd202('0x1c')](_0x5ce8d9)['json'](_0x25804b);}};}function respondWithFilteredResult(_0x336cee,_0x41f263){return function(_0x383c31){if(_0x383c31){var _0x5588df=typeof _0x41f263[_0xd202('0x1e')]===_0xd202('0x1f')&&typeof _0x41f263[_0xd202('0x20')]===_0xd202('0x1f');var _0xdf4fa2=_0x383c31[_0xd202('0x21')];var _0x16d633=_0x5588df?0x0:_0x41f263['offset'];var _0x550035=_0x5588df?_0x383c31['count']:_0x41f263[_0xd202('0x1e')]+_0x41f263[_0xd202('0x20')];var _0x2953e4;if(_0x550035>=_0xdf4fa2){_0x550035=_0xdf4fa2;_0x2953e4=0xc8;}else{_0x2953e4=0xce;}_0x336cee[_0xd202('0x1c')](_0x2953e4);return _0x336cee[_0xd202('0x22')]('Content-Range',_0x16d633+'-'+_0x550035+'/'+_0xdf4fa2)[_0xd202('0x23')](_0x383c31);}return null;};}function patchUpdates(_0x70c2c7){return function(_0x367efc){try{jsonpatch[_0xd202('0x24')](_0x367efc,_0x70c2c7,!![]);}catch(_0x51df92){return BPromise[_0xd202('0x25')](_0x51df92);}return _0x367efc[_0xd202('0x26')]();};}function saveUpdates(_0x3997d5,_0x4d7b8f){return function(_0x1c4ecd){if(_0x1c4ecd){return _0x1c4ecd['update'](_0x3997d5)[_0xd202('0x27')](function(_0x338de1){return _0x338de1;});}return null;};}function removeEntity(_0x172faa,_0x1c2d09){return function(_0x20683d){if(_0x20683d){return _0x20683d[_0xd202('0x28')]()[_0xd202('0x27')](function(){_0x172faa[_0xd202('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442825,_0x40bad6){return function(_0x23ad6a){if(!_0x23ad6a){_0x442825[_0xd202('0x1b')](0x194);}return _0x23ad6a;};}function handleError(_0x31eec6,_0x31bc47){_0x31bc47=_0x31bc47||0x1f4;return function(_0x1f60af){logger['error'](_0x1f60af[_0xd202('0x29')]);if(_0x1f60af[_0xd202('0x2a')]){delete _0x1f60af[_0xd202('0x2a')];}_0x31eec6[_0xd202('0x1c')](_0x31bc47)['send'](_0x1f60af);};}exports[_0xd202('0x2b')]=function(_0x294e8f,_0x1ace49){var _0xc2fa1={},_0x2492be={},_0x5b6e9f={'count':0x0,'rows':[]};var _0x11bf54=_['map'](db[_0xd202('0x2c')][_0xd202('0x2d')],function(_0x43c104){return{'name':_0x43c104[_0xd202('0x2e')],'type':_0x43c104[_0xd202('0x2f')][_0xd202('0x30')]};});_0x2492be[_0xd202('0x31')]=_['map'](_0x11bf54,_0xd202('0x2a'));_0x2492be[_0xd202('0x32')]=_[_0xd202('0x33')](_0x294e8f[_0xd202('0x32')]);_0x2492be[_0xd202('0x34')]=_[_0xd202('0x35')](_0x2492be[_0xd202('0x31')],_0x2492be[_0xd202('0x32')]);_0xc2fa1['attributes']=_[_0xd202('0x35')](_0x2492be['model'],qs[_0xd202('0x36')](_0x294e8f[_0xd202('0x32')][_0xd202('0x36')]));_0xc2fa1[_0xd202('0x37')]=_0xc2fa1['attributes'][_0xd202('0x38')]?_0xc2fa1[_0xd202('0x37')]:_0x2492be[_0xd202('0x31')];if(!_0x294e8f[_0xd202('0x32')][_0xd202('0x39')](_0xd202('0x3a'))){_0xc2fa1['limit']=qs['limit'](_0x294e8f[_0xd202('0x32')][_0xd202('0x20')]);_0xc2fa1[_0xd202('0x1e')]=qs['offset'](_0x294e8f[_0xd202('0x32')][_0xd202('0x1e')]);}_0xc2fa1[_0xd202('0x3b')]=qs[_0xd202('0x3c')](_0x294e8f[_0xd202('0x32')]['sort']);_0xc2fa1[_0xd202('0x3d')]=qs['filters'](_[_0xd202('0x3e')](_0x294e8f[_0xd202('0x32')],_0x2492be['filters']),_0x11bf54);if(_0x294e8f[_0xd202('0x32')][_0xd202('0x3f')]){_0xc2fa1[_0xd202('0x3d')]=_['merge'](_0xc2fa1[_0xd202('0x3d')],{'$or':_['map'](_0x11bf54,function(_0x4180df){if(_0x4180df['type']!==_0xd202('0x40')){var _0x41c166={};_0x41c166[_0x4180df['name']]={'$like':'%'+_0x294e8f[_0xd202('0x32')][_0xd202('0x3f')]+'%'};return _0x41c166;}})});}_0xc2fa1=_['merge']({},_0xc2fa1,_0x294e8f[_0xd202('0x41')]);var _0x4b820e={'where':_0xc2fa1[_0xd202('0x3d')]};return db[_0xd202('0x2c')][_0xd202('0x21')](_0x4b820e)[_0xd202('0x27')](function(_0x325bb3){_0x5b6e9f['count']=_0x325bb3;if(_0x294e8f[_0xd202('0x32')][_0xd202('0x42')]){_0xc2fa1[_0xd202('0x43')]=[{'all':!![]}];}return db[_0xd202('0x2c')][_0xd202('0x44')](_0xc2fa1);})[_0xd202('0x27')](function(_0x5d948b){_0x5b6e9f['rows']=_0x5d948b;return _0x5b6e9f;})['then'](respondWithFilteredResult(_0x1ace49,_0xc2fa1))['catch'](handleError(_0x1ace49,null));};exports[_0xd202('0x45')]=function(_0x43c51d,_0x3d4613){var _0x58f4f7={'raw':![],'where':{'id':_0x43c51d[_0xd202('0x46')]['id']}},_0xbfaedb={};_0xbfaedb[_0xd202('0x31')]=_[_0xd202('0x33')](db[_0xd202('0x2c')][_0xd202('0x2d')]);_0xbfaedb[_0xd202('0x32')]=_[_0xd202('0x33')](_0x43c51d[_0xd202('0x32')]);_0xbfaedb[_0xd202('0x34')]=_[_0xd202('0x35')](_0xbfaedb['model'],_0xbfaedb[_0xd202('0x32')]);_0x58f4f7['attributes']=_[_0xd202('0x35')](_0xbfaedb[_0xd202('0x31')],qs[_0xd202('0x36')](_0x43c51d['query'][_0xd202('0x36')]));_0x58f4f7['attributes']=_0x58f4f7[_0xd202('0x37')][_0xd202('0x38')]?_0x58f4f7['attributes']:_0xbfaedb[_0xd202('0x31')];if(_0x43c51d[_0xd202('0x32')]['includeAll']){_0x58f4f7['include']=[{'all':!![]}];}_0x58f4f7=_[_0xd202('0x47')]({},_0x58f4f7,_0x43c51d[_0xd202('0x41')]);return db[_0xd202('0x2c')]['find'](_0x58f4f7)[_0xd202('0x27')](handleEntityNotFound(_0x3d4613,null))['then'](respondWithResult(_0x3d4613,null))[_0xd202('0x48')](handleError(_0x3d4613,null));};exports['create']=function(_0xc8fc89,_0x170f36){return db['ZohoAccount'][_0xd202('0x49')](_0xc8fc89['body'],{})[_0xd202('0x27')](respondWithResult(_0x170f36,0xc9))[_0xd202('0x48')](handleError(_0x170f36,null));};exports[_0xd202('0x4a')]=function(_0x40d5d6,_0x314a97){if(_0x40d5d6[_0xd202('0x4b')]['id']){delete _0x40d5d6[_0xd202('0x4b')]['id'];}return db[_0xd202('0x2c')]['find']({'where':{'id':_0x40d5d6[_0xd202('0x46')]['id']}})['then'](handleEntityNotFound(_0x314a97,null))[_0xd202('0x27')](saveUpdates(_0x40d5d6['body'],null))['then'](respondWithResult(_0x314a97,null))[_0xd202('0x48')](handleError(_0x314a97,null));};exports['destroy']=function(_0x53ef30,_0x195b7b){return db[_0xd202('0x2c')][_0xd202('0x4c')]({'where':{'id':_0x53ef30['params']['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x195b7b,null))[_0xd202('0x27')](removeEntity(_0x195b7b,null))[_0xd202('0x48')](handleError(_0x195b7b,null));};exports[_0xd202('0x4d')]=function(_0x2f9964,_0x44bcbb,_0x44695e){var _0x10daf4={};var _0x55b368={};var _0x482508;var _0x4fa787;return db['ZohoAccount'][_0xd202('0x4e')]({'where':{'id':_0x2f9964[_0xd202('0x46')]['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x44bcbb,null))[_0xd202('0x27')](function(_0x3a9b61){if(_0x3a9b61){_0x482508=_0x3a9b61;_0x55b368[_0xd202('0x31')]=_[_0xd202('0x33')](db[_0xd202('0x4f')][_0xd202('0x2d')]);_0x55b368[_0xd202('0x32')]=_[_0xd202('0x33')](_0x2f9964[_0xd202('0x32')]);_0x55b368[_0xd202('0x34')]=_[_0xd202('0x35')](_0x55b368[_0xd202('0x31')],_0x55b368['query']);_0x10daf4['attributes']=_[_0xd202('0x35')](_0x55b368['model'],qs[_0xd202('0x36')](_0x2f9964[_0xd202('0x32')]['fields']));_0x10daf4['attributes']=_0x10daf4[_0xd202('0x37')][_0xd202('0x38')]?_0x10daf4['attributes']:_0x55b368[_0xd202('0x31')];_0x10daf4[_0xd202('0x3b')]=qs['sort'](_0x2f9964[_0xd202('0x32')]['sort']);_0x10daf4[_0xd202('0x3d')]=qs[_0xd202('0x34')](_[_0xd202('0x3e')](_0x2f9964[_0xd202('0x32')],_0x55b368[_0xd202('0x34')]));if(_0x2f9964[_0xd202('0x32')][_0xd202('0x3f')]){_0x10daf4[_0xd202('0x3d')]=_[_0xd202('0x47')](_0x10daf4[_0xd202('0x3d')],{'$or':_[_0xd202('0x50')](_0x10daf4[_0xd202('0x37')],function(_0x1eb2cf){var _0x3a57de={};_0x3a57de[_0x1eb2cf]={'$like':'%'+_0x2f9964[_0xd202('0x32')][_0xd202('0x3f')]+'%'};return _0x3a57de;})});}_0x10daf4=_[_0xd202('0x47')]({},_0x10daf4,_0x2f9964[_0xd202('0x41')]);return _0x482508[_0xd202('0x4d')](_0x10daf4);}})[_0xd202('0x27')](function(_0x99d716){if(_0x99d716){_0x4fa787=_0x99d716['length'];if(!_0x2f9964['query'][_0xd202('0x39')]('nolimit')){_0x10daf4['limit']=qs[_0xd202('0x20')](_0x2f9964[_0xd202('0x32')]['limit']);_0x10daf4[_0xd202('0x1e')]=qs['offset'](_0x2f9964[_0xd202('0x32')][_0xd202('0x1e')]);}return _0x482508[_0xd202('0x4d')](_0x10daf4);}})[_0xd202('0x27')](function(_0xac25fe){if(_0xac25fe){return _0xac25fe?{'count':_0x4fa787,'rows':_0xac25fe}:null;}})['then'](respondWithResult(_0x44bcbb,null))['catch'](handleError(_0x44bcbb,null));};exports[_0xd202('0x51')]=function(_0x272402,_0x5749dc,_0x1cd00d){if(_0x272402[_0xd202('0x4b')]['id']){delete _0x272402[_0xd202('0x4b')]['id'];}return db['ZohoAccount'][_0xd202('0x4e')]({'where':{'id':_0x272402[_0xd202('0x46')]['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x5749dc,null))[_0xd202('0x27')](function(_0x180d60){if(_0x180d60){_0x272402['body']['AccountId']=_0x180d60['id'];_0x272402['body'][_0xd202('0x52')]=integrations['getSubjects'](_0x272402[_0xd202('0x4b')][_0xd202('0x53')],_0x272402[_0xd202('0x4b')][_0xd202('0x2f')]);_0x272402[_0xd202('0x4b')][_0xd202('0x54')]=integrations[_0xd202('0x55')](_0x272402[_0xd202('0x4b')][_0xd202('0x53')],_0x272402[_0xd202('0x4b')][_0xd202('0x2f')]);return db[_0xd202('0x4f')]['create'](_0x272402['body'],{'include':[{'model':db[_0xd202('0x56')],'as':_0xd202('0x52')},{'model':db[_0xd202('0x56')],'as':_0xd202('0x54')}]});}return null;})['then'](respondWithResult(_0x5749dc,null))[_0xd202('0x48')](handleError(_0x5749dc,null));};function getAccessToken(_0x4c5bd3){return new Promise(function(_0xffbb92,_0x728a85){var _0x225fce;switch(_0x4c5bd3[_0xd202('0x57')]){case'US':_0x225fce='https://accounts.zoho.com';break;case'AU':_0x225fce='https://accounts.zoho.com.au';break;case'EU':_0x225fce=_0xd202('0x58');break;case'IN':_0x225fce=_0xd202('0x59');break;case'CN':_0x225fce=_0xd202('0x5a');break;default:_0x225fce='https://accounts.zoho.eu';break;}var _0x16713a={'method':_0xd202('0x5b'),'uri':_0x225fce+'/oauth/v2/token','qs':{'refresh_token':_0x4c5bd3[_0xd202('0x5c')],'client_id':_0x4c5bd3['clientId'],'client_secret':_0x4c5bd3['clientSecret'],'grant_type':_0xd202('0x5d')},'json':!![]};return rp(_0x16713a)['then'](function(_0x3d6aac){if(_0x3d6aac[_0xd202('0x5e')]){_0xffbb92(_0x3d6aac[_0xd202('0x5e')]);}else{_0x728a85(_0xd202('0x5f'));}})[_0xd202('0x48')](function(_0x24275b){_0x728a85(_0x24275b);});});}exports[_0xd202('0x60')]=function(_0x25423a,_0x1481e2,_0x1a4eed){var _0x3c858e,_0x2b2b4c,_0x545229,_0x4730f1,_0x215719;return db[_0xd202('0x2c')][_0xd202('0x4e')]({'where':{'id':_0x25423a[_0xd202('0x46')]['id']},'attributes':['id',_0xd202('0x61'),'zone','clientId',_0xd202('0x62'),'serverUrl',_0xd202('0x63'),_0xd202('0x5c')]})[_0xd202('0x27')](handleEntityNotFound(_0x1481e2,null))['then'](function(_0x35cdd9){_0x215719=_0x35cdd9;_0x3c858e=_0x215719[_0xd202('0x61')];_0x2b2b4c=_0x3c858e===_0xd202('0x64')?'eu':'com';_0x545229=_0x215719[_0xd202('0x65')];var _0x3ddbc3=_0x545229[_0xd202('0x66')](-0x1);if(_0x3ddbc3==='/'||_0x3ddbc3==='\x5c'||_0x3ddbc3===':'){_0x545229=_0x545229['substring'](0x0,_0x545229[_0xd202('0x67')](_0x3ddbc3));}if(!_0x215719[_0xd202('0x5c')]){throw new Error(_0xd202('0x68'));}return getAccessToken(_0x215719);})[_0xd202('0x27')](function(_0x44bd62){if(_0x44bd62){return rp({'method':_0xd202('0x69'),'uri':util[_0xd202('0x6a')](_0xd202('0x6b'),_0x2b2b4c),'qs':{'module':_0xd202('0x6c')},'headers':{'Authorization':_0xd202('0x6d')+_0x44bd62},'json':!![]});}})['then'](function(_0x3aed4b){if(_0x3aed4b){if(_0x3aed4b['response']&&_0x3aed4b[_0xd202('0x6e')][_0xd202('0x6f')]){throw new Error(_0x3aed4b['response']['error']['message']);}var _0x17551d=[];var _0x48ae20=[];var _0x3c5d64=[_0xd202('0x70'),_0xd202('0x71'),_0xd202('0x72'),'WhoId','Call_Duration',_0xd202('0x73'),'Call_Start_Time',_0xd202('0x74')];_0x48ae20=_[_0xd202('0x75')](_0x3aed4b[_0xd202('0x36')],function(_0x3cff12){return _0x3c5d64[_0xd202('0x76')](_0x3cff12[_0xd202('0x77')]);});for(var _0x221a4e=0x0;_0x221a4e<_0x48ae20[_0xd202('0x38')];_0x221a4e++){if(_0x48ae20[_0x221a4e]['system_mandatory']===![]){_0x17551d[_0xd202('0x78')]({'id':_0x48ae20[_0x221a4e]['id'],'name':_0x48ae20[_0x221a4e][_0xd202('0x79')],'custom':_0x48ae20[_0x221a4e][_0xd202('0x7a')],'options':_0x48ae20[_0x221a4e][_0xd202('0x7b')]==='picklist'&&_0x48ae20[_0x221a4e][_0xd202('0x7c')][_0xd202('0x38')]>-0x1?_[_0xd202('0x50')](_0x48ae20[_0x221a4e][_0xd202('0x7c')],function(_0x730f6e){return{'name':_0x730f6e,'value':_0x730f6e};}):[]});}}return{'count':_0x17551d['length'],'rows':_0x17551d};}else{return{'count':0x0,'rows':[]};}})[_0xd202('0x27')](respondWithResult(_0x1481e2,null))[_0xd202('0x48')](function(_0x33987a){var _0x227239=_0x25423a[_0xd202('0x32')][_0xd202('0x7d')]?0x1f4:_0x33987a[_0xd202('0x7e')]||0x1f4;logger[_0xd202('0x6f')](_0xd202('0x7f'),'getFields',_0x227239,JSON[_0xd202('0x80')](_0x33987a));delete _0x33987a['name'];if(_0x227239===0x191){_0x227239=0x190;}_0x1481e2[_0xd202('0x1c')](_0x227239)[_0xd202('0x81')](_0x25423a['query']['test']?{'message':_0xd202('0x82'),'statusCode':_0x33987a[_0xd202('0x7e')]}:_0x33987a);});}; \ No newline at end of file +var _0x9daf=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','show','params','include','catch','create','body','find','destroy','getConfigurations','findOne','nolimit','AccountId','getSubjects','channel','getDescriptions','ZohoConfiguration','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','code','refreshToken','zoho.eu','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9daf,0x16d));var _0xf9da=function(_0x2107a6,_0xe8360d){_0x2107a6=_0x2107a6-0x0;var _0x2f09ef=_0x9daf[_0x2107a6];return _0x2f09ef;};'use strict';var emlformat=require(_0xf9da('0x0'));var rimraf=require(_0xf9da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9da('0x2'));var rp=require(_0xf9da('0x3'));var moment=require(_0xf9da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf9da('0x5'));var util=require(_0xf9da('0x6'));var path=require(_0xf9da('0x7'));var sox=require(_0xf9da('0x8'));var csv=require(_0xf9da('0x9'));var ejs=require(_0xf9da('0xa'));var fs=require('fs');var fs_extra=require(_0xf9da('0xb'));var _=require(_0xf9da('0xc'));var squel=require(_0xf9da('0xd'));var crypto=require(_0xf9da('0xe'));var jsforce=require(_0xf9da('0xf'));var deskjs=require(_0xf9da('0x10'));var toCsv=require(_0xf9da('0x9'));var querystring=require(_0xf9da('0x11'));var Papa=require(_0xf9da('0x12'));var Redis=require(_0xf9da('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9da('0x15'))(_0xf9da('0x16'));var utils=require(_0xf9da('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x250a01,_0x396adf){_0x396adf=_0x396adf||0xcc;return function(_0x32fabb){if(_0x32fabb){return _0x250a01['sendStatus'](_0x396adf);}return _0x250a01[_0xf9da('0x18')](_0x396adf)[_0xf9da('0x19')]();};}function respondWithResult(_0x11dcaa,_0x300e8c){_0x300e8c=_0x300e8c||0xc8;return function(_0x205a0a){if(_0x205a0a){return _0x11dcaa['status'](_0x300e8c)[_0xf9da('0x1a')](_0x205a0a);}};}function respondWithFilteredResult(_0x49762d,_0x41e86b){return function(_0x3f0a6a){if(_0x3f0a6a){var _0x29c5b1=typeof _0x41e86b[_0xf9da('0x1b')]===_0xf9da('0x1c')&&typeof _0x41e86b['limit']===_0xf9da('0x1c');var _0x601327=_0x3f0a6a[_0xf9da('0x1d')];var _0x48ac4c=_0x29c5b1?0x0:_0x41e86b['offset'];var _0x590076=_0x29c5b1?_0x3f0a6a[_0xf9da('0x1d')]:_0x41e86b[_0xf9da('0x1b')]+_0x41e86b[_0xf9da('0x1e')];var _0x147c1b;if(_0x590076>=_0x601327){_0x590076=_0x601327;_0x147c1b=0xc8;}else{_0x147c1b=0xce;}_0x49762d[_0xf9da('0x18')](_0x147c1b);return _0x49762d['set'](_0xf9da('0x1f'),_0x48ac4c+'-'+_0x590076+'/'+_0x601327)['json'](_0x3f0a6a);}return null;};}function patchUpdates(_0x4f72bc){return function(_0xdd9efc){try{jsonpatch[_0xf9da('0x20')](_0xdd9efc,_0x4f72bc,!![]);}catch(_0x266a0e){return BPromise[_0xf9da('0x21')](_0x266a0e);}return _0xdd9efc[_0xf9da('0x22')]();};}function saveUpdates(_0x47d605,_0x3c53aa){return function(_0x3e749c){if(_0x3e749c){return _0x3e749c[_0xf9da('0x23')](_0x47d605)[_0xf9da('0x24')](function(_0x55f477){return _0x55f477;});}return null;};}function removeEntity(_0x707ffe,_0x2f45a0){return function(_0x372ba8){if(_0x372ba8){return _0x372ba8['destroy']()['then'](function(){_0x707ffe[_0xf9da('0x18')](0xcc)[_0xf9da('0x19')]();});}};}function handleEntityNotFound(_0x38ba5f,_0x4aa092){return function(_0x303e96){if(!_0x303e96){_0x38ba5f[_0xf9da('0x25')](0x194);}return _0x303e96;};}function handleError(_0x27aa1b,_0xd04ea){_0xd04ea=_0xd04ea||0x1f4;return function(_0xa77ec4){logger[_0xf9da('0x26')](_0xa77ec4[_0xf9da('0x27')]);if(_0xa77ec4[_0xf9da('0x28')]){delete _0xa77ec4[_0xf9da('0x28')];}_0x27aa1b[_0xf9da('0x18')](_0xd04ea)[_0xf9da('0x29')](_0xa77ec4);};}exports[_0xf9da('0x2a')]=function(_0x442f51,_0x2a32ff){var _0x418f29={},_0x37d10d={},_0x4680af={'count':0x0,'rows':[]};var _0x150120=_[_0xf9da('0x2b')](db[_0xf9da('0x2c')][_0xf9da('0x2d')],function(_0x56324b){return{'name':_0x56324b[_0xf9da('0x2e')],'type':_0x56324b[_0xf9da('0x2f')]['key']};});_0x37d10d[_0xf9da('0x30')]=_[_0xf9da('0x2b')](_0x150120,_0xf9da('0x28'));_0x37d10d['query']=_[_0xf9da('0x31')](_0x442f51['query']);_0x37d10d[_0xf9da('0x32')]=_[_0xf9da('0x33')](_0x37d10d[_0xf9da('0x30')],_0x37d10d[_0xf9da('0x34')]);_0x418f29['attributes']=_[_0xf9da('0x33')](_0x37d10d[_0xf9da('0x30')],qs['fields'](_0x442f51[_0xf9da('0x34')][_0xf9da('0x35')]));_0x418f29[_0xf9da('0x36')]=_0x418f29[_0xf9da('0x36')][_0xf9da('0x37')]?_0x418f29[_0xf9da('0x36')]:_0x37d10d[_0xf9da('0x30')];if(!_0x442f51[_0xf9da('0x34')][_0xf9da('0x38')]('nolimit')){_0x418f29['limit']=qs[_0xf9da('0x1e')](_0x442f51['query'][_0xf9da('0x1e')]);_0x418f29[_0xf9da('0x1b')]=qs[_0xf9da('0x1b')](_0x442f51[_0xf9da('0x34')][_0xf9da('0x1b')]);}_0x418f29[_0xf9da('0x39')]=qs[_0xf9da('0x3a')](_0x442f51[_0xf9da('0x34')][_0xf9da('0x3a')]);_0x418f29[_0xf9da('0x3b')]=qs[_0xf9da('0x32')](_['pick'](_0x442f51[_0xf9da('0x34')],_0x37d10d['filters']),_0x150120);if(_0x442f51['query']['filter']){_0x418f29['where']=_[_0xf9da('0x3c')](_0x418f29[_0xf9da('0x3b')],{'$or':_[_0xf9da('0x2b')](_0x150120,function(_0x426e9c){if(_0x426e9c[_0xf9da('0x2f')]!=='VIRTUAL'){var _0x410e07={};_0x410e07[_0x426e9c[_0xf9da('0x28')]]={'$like':'%'+_0x442f51[_0xf9da('0x34')][_0xf9da('0x3d')]+'%'};return _0x410e07;}})});}_0x418f29=_[_0xf9da('0x3c')]({},_0x418f29,_0x442f51[_0xf9da('0x3e')]);var _0x445dd9={'where':_0x418f29[_0xf9da('0x3b')]};return db[_0xf9da('0x2c')]['count'](_0x445dd9)[_0xf9da('0x24')](function(_0xa6ea25){_0x4680af[_0xf9da('0x1d')]=_0xa6ea25;if(_0x442f51['query'][_0xf9da('0x3f')]){_0x418f29['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x418f29);})['then'](function(_0x4f7c9d){_0x4680af['rows']=_0x4f7c9d;return _0x4680af;})[_0xf9da('0x24')](respondWithFilteredResult(_0x2a32ff,_0x418f29))['catch'](handleError(_0x2a32ff,null));};exports[_0xf9da('0x40')]=function(_0x40ad5d,_0x7b9aba){var _0x3ef355={'raw':![],'where':{'id':_0x40ad5d[_0xf9da('0x41')]['id']}},_0x4cb749={};_0x4cb749['model']=_[_0xf9da('0x31')](db[_0xf9da('0x2c')][_0xf9da('0x2d')]);_0x4cb749[_0xf9da('0x34')]=_['keys'](_0x40ad5d[_0xf9da('0x34')]);_0x4cb749[_0xf9da('0x32')]=_[_0xf9da('0x33')](_0x4cb749[_0xf9da('0x30')],_0x4cb749[_0xf9da('0x34')]);_0x3ef355[_0xf9da('0x36')]=_['intersection'](_0x4cb749[_0xf9da('0x30')],qs[_0xf9da('0x35')](_0x40ad5d[_0xf9da('0x34')]['fields']));_0x3ef355[_0xf9da('0x36')]=_0x3ef355[_0xf9da('0x36')][_0xf9da('0x37')]?_0x3ef355[_0xf9da('0x36')]:_0x4cb749[_0xf9da('0x30')];if(_0x40ad5d['query'][_0xf9da('0x3f')]){_0x3ef355[_0xf9da('0x42')]=[{'all':!![]}];}_0x3ef355=_[_0xf9da('0x3c')]({},_0x3ef355,_0x40ad5d[_0xf9da('0x3e')]);return db[_0xf9da('0x2c')]['find'](_0x3ef355)[_0xf9da('0x24')](handleEntityNotFound(_0x7b9aba,null))[_0xf9da('0x24')](respondWithResult(_0x7b9aba,null))[_0xf9da('0x43')](handleError(_0x7b9aba,null));};exports[_0xf9da('0x44')]=function(_0x5de5f0,_0x3f13e1){return db['ZohoAccount']['create'](_0x5de5f0['body'],{})[_0xf9da('0x24')](respondWithResult(_0x3f13e1,0xc9))[_0xf9da('0x43')](handleError(_0x3f13e1,null));};exports[_0xf9da('0x23')]=function(_0x3d0377,_0x3d2fe9){if(_0x3d0377[_0xf9da('0x45')]['id']){delete _0x3d0377[_0xf9da('0x45')]['id'];}return db['ZohoAccount'][_0xf9da('0x46')]({'where':{'id':_0x3d0377[_0xf9da('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d2fe9,null))[_0xf9da('0x24')](saveUpdates(_0x3d0377['body'],null))[_0xf9da('0x24')](respondWithResult(_0x3d2fe9,null))[_0xf9da('0x43')](handleError(_0x3d2fe9,null));};exports[_0xf9da('0x47')]=function(_0x30277a,_0x1ae622){return db[_0xf9da('0x2c')][_0xf9da('0x46')]({'where':{'id':_0x30277a[_0xf9da('0x41')]['id']}})[_0xf9da('0x24')](handleEntityNotFound(_0x1ae622,null))['then'](removeEntity(_0x1ae622,null))[_0xf9da('0x43')](handleError(_0x1ae622,null));};exports[_0xf9da('0x48')]=function(_0x1c04f7,_0x4f6495,_0x1b8d76){var _0xa479bb={};var _0x3447f3={};var _0x5bd148;var _0x36d424;return db[_0xf9da('0x2c')][_0xf9da('0x49')]({'where':{'id':_0x1c04f7[_0xf9da('0x41')]['id']}})[_0xf9da('0x24')](handleEntityNotFound(_0x4f6495,null))[_0xf9da('0x24')](function(_0xe99000){if(_0xe99000){_0x5bd148=_0xe99000;_0x3447f3[_0xf9da('0x30')]=_[_0xf9da('0x31')](db['ZohoConfiguration'][_0xf9da('0x2d')]);_0x3447f3[_0xf9da('0x34')]=_[_0xf9da('0x31')](_0x1c04f7[_0xf9da('0x34')]);_0x3447f3[_0xf9da('0x32')]=_[_0xf9da('0x33')](_0x3447f3['model'],_0x3447f3[_0xf9da('0x34')]);_0xa479bb[_0xf9da('0x36')]=_[_0xf9da('0x33')](_0x3447f3[_0xf9da('0x30')],qs[_0xf9da('0x35')](_0x1c04f7[_0xf9da('0x34')][_0xf9da('0x35')]));_0xa479bb[_0xf9da('0x36')]=_0xa479bb[_0xf9da('0x36')][_0xf9da('0x37')]?_0xa479bb[_0xf9da('0x36')]:_0x3447f3[_0xf9da('0x30')];_0xa479bb['order']=qs['sort'](_0x1c04f7[_0xf9da('0x34')][_0xf9da('0x3a')]);_0xa479bb[_0xf9da('0x3b')]=qs['filters'](_['pick'](_0x1c04f7[_0xf9da('0x34')],_0x3447f3['filters']));if(_0x1c04f7['query'][_0xf9da('0x3d')]){_0xa479bb[_0xf9da('0x3b')]=_[_0xf9da('0x3c')](_0xa479bb[_0xf9da('0x3b')],{'$or':_[_0xf9da('0x2b')](_0xa479bb[_0xf9da('0x36')],function(_0x274e24){var _0x55ca89={};_0x55ca89[_0x274e24]={'$like':'%'+_0x1c04f7['query'][_0xf9da('0x3d')]+'%'};return _0x55ca89;})});}_0xa479bb=_[_0xf9da('0x3c')]({},_0xa479bb,_0x1c04f7['options']);return _0x5bd148['getConfigurations'](_0xa479bb);}})['then'](function(_0x3a4899){if(_0x3a4899){_0x36d424=_0x3a4899[_0xf9da('0x37')];if(!_0x1c04f7[_0xf9da('0x34')][_0xf9da('0x38')](_0xf9da('0x4a'))){_0xa479bb['limit']=qs[_0xf9da('0x1e')](_0x1c04f7[_0xf9da('0x34')][_0xf9da('0x1e')]);_0xa479bb[_0xf9da('0x1b')]=qs['offset'](_0x1c04f7[_0xf9da('0x34')][_0xf9da('0x1b')]);}return _0x5bd148[_0xf9da('0x48')](_0xa479bb);}})['then'](function(_0x925969){if(_0x925969){return _0x925969?{'count':_0x36d424,'rows':_0x925969}:null;}})[_0xf9da('0x24')](respondWithResult(_0x4f6495,null))[_0xf9da('0x43')](handleError(_0x4f6495,null));};exports['addConfiguration']=function(_0x1b0239,_0xbbc0bf,_0x55ec31){if(_0x1b0239['body']['id']){delete _0x1b0239['body']['id'];}return db[_0xf9da('0x2c')]['findOne']({'where':{'id':_0x1b0239[_0xf9da('0x41')]['id']}})[_0xf9da('0x24')](handleEntityNotFound(_0xbbc0bf,null))[_0xf9da('0x24')](function(_0x5f5b54){if(_0x5f5b54){_0x1b0239[_0xf9da('0x45')][_0xf9da('0x4b')]=_0x5f5b54['id'];_0x1b0239['body']['Subjects']=integrations[_0xf9da('0x4c')](_0x1b0239[_0xf9da('0x45')][_0xf9da('0x4d')],_0x1b0239['body']['type']);_0x1b0239['body']['Descriptions']=integrations[_0xf9da('0x4e')](_0x1b0239['body'][_0xf9da('0x4d')],_0x1b0239['body'][_0xf9da('0x2f')]);return db[_0xf9da('0x4f')][_0xf9da('0x44')](_0x1b0239['body'],{'include':[{'model':db[_0xf9da('0x50')],'as':_0xf9da('0x51')},{'model':db[_0xf9da('0x50')],'as':'Descriptions'}]});}return null;})[_0xf9da('0x24')](respondWithResult(_0xbbc0bf,null))[_0xf9da('0x43')](handleError(_0xbbc0bf,null));};function getAccessToken(_0x29c0f3){return new Promise(function(_0x1d4264,_0x2a39c6){var _0x25362d;switch(_0x29c0f3['zone']){case'US':_0x25362d=_0xf9da('0x52');break;case'AU':_0x25362d='https://accounts.zoho.com.au';break;case'EU':_0x25362d=_0xf9da('0x53');break;case'IN':_0x25362d='https://accounts.zoho.in';break;case'CN':_0x25362d=_0xf9da('0x54');break;default:_0x25362d=_0xf9da('0x53');break;}var _0x55ffff={'method':_0xf9da('0x55'),'uri':_0x25362d+'/oauth/v2/token','qs':{'refresh_token':_0x29c0f3['refreshToken'],'client_id':_0x29c0f3[_0xf9da('0x56')],'client_secret':_0x29c0f3[_0xf9da('0x57')],'grant_type':_0xf9da('0x58')},'json':!![]};return rp(_0x55ffff)[_0xf9da('0x24')](function(_0x3e2aa9){if(_0x3e2aa9['access_token']){_0x1d4264(_0x3e2aa9[_0xf9da('0x59')]);}else{_0x2a39c6('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xf9da('0x43')](function(_0x5c1b8b){_0x2a39c6(_0x5c1b8b);});});}exports[_0xf9da('0x5a')]=function(_0x19492d,_0x1a2f4d,_0x2a1b71){var _0x49613d,_0x26f597,_0xa25481,_0x447ac0,_0x1b79b6;return db[_0xf9da('0x2c')]['findOne']({'where':{'id':_0x19492d[_0xf9da('0x41')]['id']},'attributes':['id',_0xf9da('0x5b'),_0xf9da('0x5c'),_0xf9da('0x56'),_0xf9da('0x57'),_0xf9da('0x5d'),_0xf9da('0x5e'),_0xf9da('0x5f')]})[_0xf9da('0x24')](handleEntityNotFound(_0x1a2f4d,null))['then'](function(_0x37ad38){_0x1b79b6=_0x37ad38;_0x49613d=_0x1b79b6['host'];_0x26f597=_0x49613d===_0xf9da('0x60')?'eu':'com';_0xa25481=_0x1b79b6['serverUrl'];var _0x922908=_0xa25481[_0xf9da('0x61')](-0x1);if(_0x922908==='/'||_0x922908==='\x5c'||_0x922908===':'){_0xa25481=_0xa25481['substring'](0x0,_0xa25481[_0xf9da('0x62')](_0x922908));}if(!_0x1b79b6[_0xf9da('0x5f')]){throw new Error(_0xf9da('0x63'));}return getAccessToken(_0x1b79b6);})[_0xf9da('0x24')](function(_0x1f474c){if(_0x1f474c){return rp({'method':'GET','uri':util[_0xf9da('0x64')](_0xf9da('0x65'),_0x26f597),'qs':{'module':_0xf9da('0x66')},'headers':{'Authorization':_0xf9da('0x67')+_0x1f474c},'json':!![]});}})[_0xf9da('0x24')](function(_0x53553b){if(_0x53553b){if(_0x53553b['response']&&_0x53553b['response'][_0xf9da('0x26')]){throw new Error(_0x53553b[_0xf9da('0x68')]['error'][_0xf9da('0x69')]);}var _0x2cd97b=[];var _0x55b3d1=[];var _0x151008=['Owner',_0xf9da('0x6a'),_0xf9da('0x6b'),_0xf9da('0x6c'),_0xf9da('0x6d'),_0xf9da('0x6e'),_0xf9da('0x6f'),_0xf9da('0x70')];_0x55b3d1=_[_0xf9da('0x71')](_0x53553b['fields'],function(_0x3c3b82){return _0x151008[_0xf9da('0x72')](_0x3c3b82[_0xf9da('0x73')]);});for(var _0x296799=0x0;_0x296799<_0x55b3d1[_0xf9da('0x37')];_0x296799++){if(_0x55b3d1[_0x296799][_0xf9da('0x74')]===![]){_0x2cd97b[_0xf9da('0x75')]({'id':_0x55b3d1[_0x296799]['id'],'name':_0x55b3d1[_0x296799]['display_label'],'custom':_0x55b3d1[_0x296799][_0xf9da('0x76')],'options':_0x55b3d1[_0x296799][_0xf9da('0x77')]===_0xf9da('0x78')&&_0x55b3d1[_0x296799][_0xf9da('0x79')][_0xf9da('0x37')]>-0x1?_[_0xf9da('0x2b')](_0x55b3d1[_0x296799][_0xf9da('0x79')],function(_0x5a6d22){return{'name':_0x5a6d22,'value':_0x5a6d22};}):[]});}}return{'count':_0x2cd97b['length'],'rows':_0x2cd97b};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1a2f4d,null))['catch'](function(_0x19b677){var _0x8e190a=_0x19492d[_0xf9da('0x34')][_0xf9da('0x7a')]?0x1f4:_0x19b677[_0xf9da('0x7b')]||0x1f4;logger['error'](_0xf9da('0x7c'),_0xf9da('0x5a'),_0x8e190a,JSON[_0xf9da('0x7d')](_0x19b677));delete _0x19b677['name'];if(_0x8e190a===0x191){_0x8e190a=0x190;}_0x1a2f4d[_0xf9da('0x18')](_0x8e190a)[_0xf9da('0x29')](_0x19492d['query'][_0xf9da('0x7a')]?{'message':_0xf9da('0x7e'),'statusCode':_0x19b677['statusCode']}:_0x19b677);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b310460..d91de48 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 _0x0002=['host','serverUrl','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','changed','zone','clientId','clientSecret','code'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x0002,0xaa));var _0x2000=function(_0x4a8300,_0x9b2099){_0x4a8300=_0x4a8300-0x0;var _0x5cb965=_0x0002[_0x4a8300];return _0x5cb965;};'use strict';var _=require('lodash');var util=require(_0x2000('0x0'));var logger=require(_0x2000('0x1'))(_0x2000('0x2'));var moment=require('moment');var BPromise=require(_0x2000('0x3'));var rp=require(_0x2000('0x4'));var fs=require('fs');var path=require(_0x2000('0x5'));var rimraf=require(_0x2000('0x6'));var config=require(_0x2000('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2000('0x8')]=function(_0x46d1e9,_0x3ac0a3){return _0x46d1e9[_0x2000('0x9')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x208306,_0x3bb55d,_0x313946){if(_0x208306[_0x2000('0xa')](_0x2000('0xb'))||_0x208306[_0x2000('0xa')]('serverUrl')||_0x208306[_0x2000('0xa')](_0x2000('0xc'))||_0x208306[_0x2000('0xa')](_0x2000('0xd'))||_0x208306[_0x2000('0xa')](_0x2000('0xe'))||_0x208306['changed'](_0x2000('0xf'))){var _0x6163ec,_0x56cdb9;_0x6163ec=_0x208306[_0x2000('0x10')];var _0x158a3f=_0x6163ec[_0x2000('0x11')](-0x1);if(_0x158a3f==='/'||_0x158a3f==='\x5c'||_0x158a3f===':'){_0x6163ec=_0x6163ec['substring'](0x0,_0x6163ec['lastIndexOf'](_0x158a3f));}switch(_0x208306[_0x2000('0xb')]){case'US':_0x56cdb9=_0x2000('0x12');break;case'AU':_0x56cdb9=_0x2000('0x13');break;case'IN':_0x56cdb9=_0x2000('0x14');break;case'CN':_0x56cdb9=_0x2000('0x15');break;default:_0x56cdb9=_0x2000('0x16');break;}var _0x13c650={'method':_0x2000('0x17'),'uri':_0x56cdb9+_0x2000('0x18'),'form':{'grant_type':_0x2000('0x19'),'client_id':_0x208306[_0x2000('0xc')],'client_secret':_0x208306[_0x2000('0xd')],'redirect_uri':_0x208306[_0x2000('0x10')],'code':_0x208306[_0x2000('0xe')]},'headers':{'Content-Type':_0x2000('0x1a')}};return rp(_0x13c650)[_0x2000('0x1b')](function(_0x1dd6d5){var _0x56bbf7=JSON[_0x2000('0x1c')](_0x1dd6d5);if(_0x56bbf7[_0x2000('0x1d')]){_0x208306[_0x2000('0x1e')]=_0x56bbf7[_0x2000('0x1d')];logger['info'](util[_0x2000('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x208306[_0x2000('0x20')],_0x208306['id']));}else{logger[_0x2000('0x21')](util[_0x2000('0x1f')](_0x2000('0x22'),_0x208306[_0x2000('0x20')],_0x208306['id']),util['inspect'](_0x56bbf7,{'showHidden':![],'depth':null}));}return _0x313946(null,_0x3bb55d);})['catch'](function(_0x34398e){logger['error'](util[_0x2000('0x1f')](_0x2000('0x22'),_0x208306[_0x2000('0x20')],_0x208306['id']),util[_0x2000('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x313946(_0x34398e);});}else{return _0x313946(null,_0x3bb55d);}},'beforeUpdate':function(_0x161beb,_0x11a7cd,_0x1b6f66){if(_0x161beb['changed'](_0x2000('0xb'))||_0x161beb[_0x2000('0xa')](_0x2000('0x10'))||_0x161beb[_0x2000('0xa')](_0x2000('0xc'))||_0x161beb[_0x2000('0xa')](_0x2000('0xd'))||_0x161beb[_0x2000('0xa')](_0x2000('0xe'))||_0x161beb[_0x2000('0xa')]('host')){var _0x884c25,_0x48a6b6;_0x884c25=_0x161beb[_0x2000('0x10')];var _0x4ff991=_0x884c25[_0x2000('0x11')](-0x1);if(_0x4ff991==='/'||_0x4ff991==='\x5c'||_0x4ff991===':'){_0x884c25=_0x884c25['substring'](0x0,_0x884c25['lastIndexOf'](_0x4ff991));}switch(_0x161beb[_0x2000('0xb')]){case'US':_0x48a6b6='https://accounts.zoho.com';break;case'AU':_0x48a6b6='https://accounts.zoho.com.au';break;case'IN':_0x48a6b6=_0x2000('0x14');break;case'CN':_0x48a6b6=_0x2000('0x15');break;default:_0x48a6b6=_0x2000('0x16');break;}var _0x4443bd={'method':'POST','uri':_0x48a6b6+_0x2000('0x18'),'form':{'grant_type':_0x2000('0x19'),'client_id':_0x161beb[_0x2000('0xc')],'client_secret':_0x161beb[_0x2000('0xd')],'redirect_uri':_0x161beb[_0x2000('0x10')],'code':_0x161beb[_0x2000('0xe')]},'headers':{'Content-Type':_0x2000('0x1a')}};return rp(_0x4443bd)[_0x2000('0x1b')](function(_0x4c7ea6){var _0x3777b6=JSON[_0x2000('0x1c')](_0x4c7ea6);if(_0x3777b6['refresh_token']){_0x161beb[_0x2000('0x1e')]=_0x3777b6['refresh_token'];logger['info'](util[_0x2000('0x1f')](_0x2000('0x24'),_0x161beb[_0x2000('0x20')],_0x161beb['id']));}else{logger[_0x2000('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x161beb['name'],_0x161beb['id']),util[_0x2000('0x23')](_0x3777b6,{'showHidden':![],'depth':null}));}return _0x1b6f66(null,_0x11a7cd);})['catch'](function(_0xa3d584){logger[_0x2000('0x21')](util[_0x2000('0x1f')](_0x2000('0x22'),_0x161beb[_0x2000('0x20')],_0x161beb['id']),util[_0x2000('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1b6f66(_0xa3d584);});}else{return _0x1b6f66(null,_0x11a7cd);}}}});}; \ No newline at end of file +var _0x0ce5=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientId','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','zone','host','https://accounts.zoho.com','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','parse','refreshToken','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x35f6b4,_0x505966){var _0x10f072=function(_0x20e563){while(--_0x20e563){_0x35f6b4['push'](_0x35f6b4['shift']());}};_0x10f072(++_0x505966);}(_0x0ce5,0x79));var _0x50ce=function(_0x4f6610,_0x11d9ae){_0x4f6610=_0x4f6610-0x0;var _0x44e7d3=_0x0ce5[_0x4f6610];return _0x44e7d3;};'use strict';var _=require(_0x50ce('0x0'));var util=require('util');var logger=require(_0x50ce('0x1'))(_0x50ce('0x2'));var moment=require('moment');var BPromise=require(_0x50ce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50ce('0x4'));var config=require('../../config/environment');var attributes=require(_0x50ce('0x5'));var integrations=require(_0x50ce('0x6'));module[_0x50ce('0x7')]=function(_0x39c876,_0x56a392){return _0x39c876[_0x50ce('0x8')](_0x50ce('0x9'),attributes,{'tableName':_0x50ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x214a07,_0x17ba1d,_0x1837d9){if(_0x214a07[_0x50ce('0xb')]('zone')||_0x214a07[_0x50ce('0xb')](_0x50ce('0xc'))||_0x214a07[_0x50ce('0xb')]('clientId')||_0x214a07[_0x50ce('0xb')](_0x50ce('0xd'))||_0x214a07[_0x50ce('0xb')](_0x50ce('0xe'))||_0x214a07[_0x50ce('0xb')]('host')){var _0x1f9d60,_0x37eab4;_0x1f9d60=_0x214a07[_0x50ce('0xc')];var _0x5ea215=_0x1f9d60[_0x50ce('0xf')](-0x1);if(_0x5ea215==='/'||_0x5ea215==='\x5c'||_0x5ea215===':'){_0x1f9d60=_0x1f9d60[_0x50ce('0x10')](0x0,_0x1f9d60[_0x50ce('0x11')](_0x5ea215));}switch(_0x214a07['zone']){case'US':_0x37eab4='https://accounts.zoho.com';break;case'AU':_0x37eab4=_0x50ce('0x12');break;case'IN':_0x37eab4=_0x50ce('0x13');break;case'CN':_0x37eab4=_0x50ce('0x14');break;default:_0x37eab4='https://accounts.zoho.eu';break;}var _0x364831={'method':_0x50ce('0x15'),'uri':_0x37eab4+'/oauth/v2/token','form':{'grant_type':_0x50ce('0x16'),'client_id':_0x214a07[_0x50ce('0x17')],'client_secret':_0x214a07[_0x50ce('0xd')],'redirect_uri':_0x214a07[_0x50ce('0xc')],'code':_0x214a07[_0x50ce('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x364831)[_0x50ce('0x18')](function(_0x433720){var _0x37e617=JSON['parse'](_0x433720);if(_0x37e617[_0x50ce('0x19')]){_0x214a07['refreshToken']=_0x37e617['refresh_token'];logger[_0x50ce('0x1a')](util[_0x50ce('0x1b')](_0x50ce('0x1c'),_0x214a07[_0x50ce('0x1d')],_0x214a07['id']));}else{logger[_0x50ce('0x1e')](util[_0x50ce('0x1b')](_0x50ce('0x1f'),_0x214a07[_0x50ce('0x1d')],_0x214a07['id']),util[_0x50ce('0x20')](_0x37e617,{'showHidden':![],'depth':null}));}return _0x1837d9(null,_0x17ba1d);})[_0x50ce('0x21')](function(_0x5a099b){logger[_0x50ce('0x1e')](util[_0x50ce('0x1b')](_0x50ce('0x1f'),_0x214a07[_0x50ce('0x1d')],_0x214a07['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1837d9(_0x5a099b);});}else{return _0x1837d9(null,_0x17ba1d);}},'beforeUpdate':function(_0x4e982f,_0x513c64,_0x1b281d){if(_0x4e982f[_0x50ce('0xb')](_0x50ce('0x22'))||_0x4e982f['changed'](_0x50ce('0xc'))||_0x4e982f[_0x50ce('0xb')]('clientId')||_0x4e982f['changed']('clientSecret')||_0x4e982f[_0x50ce('0xb')]('code')||_0x4e982f['changed'](_0x50ce('0x23'))){var _0x457490,_0xa326a3;_0x457490=_0x4e982f[_0x50ce('0xc')];var _0x5062d6=_0x457490[_0x50ce('0xf')](-0x1);if(_0x5062d6==='/'||_0x5062d6==='\x5c'||_0x5062d6===':'){_0x457490=_0x457490[_0x50ce('0x10')](0x0,_0x457490[_0x50ce('0x11')](_0x5062d6));}switch(_0x4e982f['zone']){case'US':_0xa326a3=_0x50ce('0x24');break;case'AU':_0xa326a3=_0x50ce('0x12');break;case'IN':_0xa326a3=_0x50ce('0x13');break;case'CN':_0xa326a3=_0x50ce('0x14');break;default:_0xa326a3=_0x50ce('0x25');break;}var _0x2d21de={'method':_0x50ce('0x15'),'uri':_0xa326a3+_0x50ce('0x26'),'form':{'grant_type':_0x50ce('0x16'),'client_id':_0x4e982f['clientId'],'client_secret':_0x4e982f[_0x50ce('0xd')],'redirect_uri':_0x4e982f[_0x50ce('0xc')],'code':_0x4e982f[_0x50ce('0xe')]},'headers':{'Content-Type':_0x50ce('0x27')}};return rp(_0x2d21de)['then'](function(_0x45ac7f){var _0x110d5b=JSON[_0x50ce('0x28')](_0x45ac7f);if(_0x110d5b[_0x50ce('0x19')]){_0x4e982f[_0x50ce('0x29')]=_0x110d5b['refresh_token'];logger[_0x50ce('0x1a')](util[_0x50ce('0x1b')](_0x50ce('0x1c'),_0x4e982f[_0x50ce('0x1d')],_0x4e982f['id']));}else{logger[_0x50ce('0x1e')](util[_0x50ce('0x1b')](_0x50ce('0x1f'),_0x4e982f[_0x50ce('0x1d')],_0x4e982f['id']),util[_0x50ce('0x20')](_0x110d5b,{'showHidden':![],'depth':null}));}return _0x1b281d(null,_0x513c64);})[_0x50ce('0x21')](function(_0x4167fc){logger['error'](util[_0x50ce('0x1b')](_0x50ce('0x1f'),_0x4e982f[_0x50ce('0x1d')],_0x4e982f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1b281d(_0x4167fc);});}else{return _0x1b281d(null,_0x513c64);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 902d242..52ae8f2 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 _0xceef=['attributes','include','map','model','ShowZohoAccount','find','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where'];(function(_0x3423c6,_0xd3946e){var _0x218515=function(_0x38bd2b){while(--_0x38bd2b){_0x3423c6['push'](_0x3423c6['shift']());}};_0x218515(++_0xd3946e);}(_0xceef,0xf6));var _0xfcee=function(_0xd9ce1,_0x517167){_0xd9ce1=_0xd9ce1-0x0;var _0x54be53=_0xceef[_0xd9ce1];return _0x54be53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcee('0x0'));var BPromise=require(_0xfcee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcee('0x3'));var logger=require(_0xfcee('0x4'))('rpc');var config=require(_0xfcee('0x5'));var jayson=require(_0xfcee('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35234a,_0xfbfb75,_0xd69040){return new BPromise(function(_0x5b0d2c,_0x513a59){return client[_0xfcee('0x7')](_0x35234a,_0xd69040)[_0xfcee('0x8')](function(_0xcea858){logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));logger[_0xfcee('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xfbfb75,_0xfcee('0xb'),JSON[_0xfcee('0xd')](_0xcea858));if(_0xcea858[_0xfcee('0xe')]){if(_0xcea858[_0xfcee('0xe')][_0xfcee('0xf')]===0x1f4){logger[_0xfcee('0xe')](_0xfcee('0xa'),_0xfbfb75,_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);return _0x513a59(_0xcea858['error'][_0xfcee('0x10')]);}logger[_0xfcee('0xe')]('ZohoAccount,\x20%s,\x20%s',_0xfbfb75,_0xcea858['error'][_0xfcee('0x10')]);return _0x5b0d2c(_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);}else{logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));_0x5b0d2c(_0xcea858['result'][_0xfcee('0x10')]);}})[_0xfcee('0x11')](function(_0x38a971){logger['error'](_0xfcee('0xa'),_0xfbfb75,_0x38a971);_0x513a59(_0x38a971);});});}exports[_0xfcee('0x12')]=function(_0x45c690){var _0x47ddd8=this;return new Promise(function(_0x37fa9c,_0x13ec8b){return db[_0xfcee('0x13')][_0xfcee('0x14')]({'raw':_0x45c690['options']?_0x45c690['options'][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x17')]||null:null,'attributes':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x18')]||null:null,'limit':_0x45c690['options']?_0x45c690[_0xfcee('0x16')]['limit']||null:null,'include':_0x45c690['options']?_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')],function(_0x463df4){return{'model':db[_0x463df4[_0xfcee('0x1b')]],'as':_0x463df4['as'],'attributes':_0x463df4[_0xfcee('0x18')],'include':_0x463df4[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x463df4[_0xfcee('0x19')],function(_0x475a48){return{'model':db[_0x475a48[_0xfcee('0x1b')]],'as':_0x475a48['as'],'attributes':_0x475a48[_0xfcee('0x18')],'include':_0x475a48[_0xfcee('0x19')]?_['map'](_0x475a48['include'],function(_0x56c9f7){return{'model':db[_0x56c9f7[_0xfcee('0x1b')]],'as':_0x56c9f7['as'],'attributes':_0x56c9f7[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x2e7e74){logger[_0xfcee('0x9')](_0xfcee('0x12'),_0x45c690);logger[_0xfcee('0xc')](_0xfcee('0x12'),_0x45c690,JSON[_0xfcee('0xd')](_0x2e7e74));_0x37fa9c(_0x2e7e74);})['catch'](function(_0x2dc32){logger[_0xfcee('0xe')](_0xfcee('0x12'),_0x2dc32[_0xfcee('0x10')],_0x45c690);_0x13ec8b(_0x47ddd8[_0xfcee('0xe')](0x1f4,_0x2dc32[_0xfcee('0x10')]));});});};exports[_0xfcee('0x1c')]=function(_0x5ed336){var _0x329ff0=this;return new Promise(function(_0x27c6fc,_0x397629){return db[_0xfcee('0x13')][_0xfcee('0x1d')]({'raw':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['where']||null:null,'attributes':_0x5ed336[_0xfcee('0x16')]?_0x5ed336['options'][_0xfcee('0x18')]||null:null,'include':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['include']?_['map'](_0x5ed336[_0xfcee('0x16')]['include'],function(_0x4625ff){return{'model':db[_0x4625ff[_0xfcee('0x1b')]],'as':_0x4625ff['as'],'attributes':_0x4625ff[_0xfcee('0x18')],'include':_0x4625ff[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x4625ff[_0xfcee('0x19')],function(_0x43fe34){return{'model':db[_0x43fe34['model']],'as':_0x43fe34['as'],'attributes':_0x43fe34['attributes'],'include':_0x43fe34[_0xfcee('0x19')]?_['map'](_0x43fe34[_0xfcee('0x19')],function(_0x22ebf4){return{'model':db[_0x22ebf4[_0xfcee('0x1b')]],'as':_0x22ebf4['as'],'attributes':_0x22ebf4[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x5de47d){logger['info'](_0xfcee('0x1c'),_0x5ed336);logger[_0xfcee('0xc')](_0xfcee('0x1c'),_0x5ed336,JSON[_0xfcee('0xd')](_0x5de47d));_0x27c6fc(_0x5de47d);})[_0xfcee('0x11')](function(_0x9a5c7f){logger[_0xfcee('0xe')]('ShowZohoAccount',_0x9a5c7f['message'],_0x5ed336);_0x397629(_0x329ff0[_0xfcee('0xe')](0x1f4,_0x9a5c7f[_0xfcee('0x10')]));});});}; \ No newline at end of file +var _0x762e=['raw','then','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','options','where','attributes','limit','include','model','map','ShowZohoAccount','ZohoAccount','find'];(function(_0x461f4e,_0x1aaa52){var _0x134807=function(_0x430881){while(--_0x430881){_0x461f4e['push'](_0x461f4e['shift']());}};_0x134807(++_0x1aaa52);}(_0x762e,0xea));var _0xe762=function(_0x26e0d9,_0x3bbeff){_0x26e0d9=_0x26e0d9-0x0;var _0x3ed4bb=_0x762e[_0x26e0d9];return _0x3ed4bb;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4726,_0x7a1740,_0x2511ad){return new BPromise(function(_0xf20548,_0x26a4fc){return client[_0xe762('0x8')](_0x1f4726,_0x2511ad)['then'](function(_0x50dd96){logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));logger[_0xe762('0xc')](_0xe762('0xd'),_0x7a1740,_0xe762('0xb'),JSON['stringify'](_0x50dd96));if(_0x50dd96[_0xe762('0xe')]){if(_0x50dd96[_0xe762('0xe')][_0xe762('0xf')]===0x1f4){logger['error'](_0xe762('0xa'),_0x7a1740,_0x50dd96['error'][_0xe762('0x10')]);return _0x26a4fc(_0x50dd96['error'][_0xe762('0x10')]);}logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x50dd96['error']['message']);return _0xf20548(_0x50dd96[_0xe762('0xe')][_0xe762('0x10')]);}else{logger[_0xe762('0x9')](_0xe762('0xa'),_0x7a1740,_0xe762('0xb'));_0xf20548(_0x50dd96[_0xe762('0x11')][_0xe762('0x10')]);}})[_0xe762('0x12')](function(_0x531587){logger[_0xe762('0xe')](_0xe762('0xa'),_0x7a1740,_0x531587);_0x26a4fc(_0x531587);});});}exports[_0xe762('0x13')]=function(_0x27c2cf){var _0x57850f=this;return new Promise(function(_0xd2cb26,_0x157de2){return db['ZohoAccount']['findAll']({'raw':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf['options'][_0xe762('0x15')]||null:null,'attributes':_0x27c2cf['options']?_0x27c2cf[_0xe762('0x14')][_0xe762('0x16')]||null:null,'limit':_0x27c2cf[_0xe762('0x14')]?_0x27c2cf[_0xe762('0x14')][_0xe762('0x17')]||null:null,'include':_0x27c2cf['options']?_0x27c2cf['options']['include']?_['map'](_0x27c2cf[_0xe762('0x14')][_0xe762('0x18')],function(_0x31ac1a){return{'model':db[_0x31ac1a[_0xe762('0x19')]],'as':_0x31ac1a['as'],'attributes':_0x31ac1a[_0xe762('0x16')],'include':_0x31ac1a['include']?_[_0xe762('0x1a')](_0x31ac1a[_0xe762('0x18')],function(_0x407d1e){return{'model':db[_0x407d1e[_0xe762('0x19')]],'as':_0x407d1e['as'],'attributes':_0x407d1e[_0xe762('0x16')],'include':_0x407d1e[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x407d1e[_0xe762('0x18')],function(_0xc05eb8){return{'model':db[_0xc05eb8[_0xe762('0x19')]],'as':_0xc05eb8['as'],'attributes':_0xc05eb8[_0xe762('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bfe46){logger[_0xe762('0x9')]('GetZohoAccount',_0x27c2cf);logger[_0xe762('0xc')](_0xe762('0x13'),_0x27c2cf,JSON['stringify'](_0x5bfe46));_0xd2cb26(_0x5bfe46);})[_0xe762('0x12')](function(_0xa39b64){logger[_0xe762('0xe')](_0xe762('0x13'),_0xa39b64[_0xe762('0x10')],_0x27c2cf);_0x157de2(_0x57850f[_0xe762('0xe')](0x1f4,_0xa39b64[_0xe762('0x10')]));});});};exports[_0xe762('0x1b')]=function(_0x26dbd3){var _0x79604b=this;return new Promise(function(_0x5f135b,_0x3bf093){return db[_0xe762('0x1c')][_0xe762('0x1d')]({'raw':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x1e')]===undefined?!![]:![]:!![],'where':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')]['where']||null:null,'attributes':_0x26dbd3['options']?_0x26dbd3[_0xe762('0x14')][_0xe762('0x16')]||null:null,'include':_0x26dbd3[_0xe762('0x14')]?_0x26dbd3[_0xe762('0x14')][_0xe762('0x18')]?_[_0xe762('0x1a')](_0x26dbd3[_0xe762('0x14')]['include'],function(_0x40eedf){return{'model':db[_0x40eedf[_0xe762('0x19')]],'as':_0x40eedf['as'],'attributes':_0x40eedf[_0xe762('0x16')],'include':_0x40eedf['include']?_[_0xe762('0x1a')](_0x40eedf[_0xe762('0x18')],function(_0x249d01){return{'model':db[_0x249d01[_0xe762('0x19')]],'as':_0x249d01['as'],'attributes':_0x249d01[_0xe762('0x16')],'include':_0x249d01[_0xe762('0x18')]?_[_0xe762('0x1a')](_0x249d01[_0xe762('0x18')],function(_0x37cc8b){return{'model':db[_0x37cc8b[_0xe762('0x19')]],'as':_0x37cc8b['as'],'attributes':_0x37cc8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xe762('0x1f')](function(_0x25ec08){logger[_0xe762('0x9')](_0xe762('0x1b'),_0x26dbd3);logger[_0xe762('0xc')](_0xe762('0x1b'),_0x26dbd3,JSON[_0xe762('0x20')](_0x25ec08));_0x5f135b(_0x25ec08);})[_0xe762('0x12')](function(_0x3e17d9){logger[_0xe762('0xe')](_0xe762('0x1b'),_0x3e17d9[_0xe762('0x10')],_0x26dbd3);_0x3bf093(_0x79604b[_0xe762('0xe')](0x1f4,_0x3e17d9[_0xe762('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fc2b96f..39dc67e 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 _0xda80=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields'];(function(_0x46454b,_0x240c1b){var _0x47ba7e=function(_0x3b30c2){while(--_0x3b30c2){_0x46454b['push'](_0x46454b['shift']());}};_0x47ba7e(++_0x240c1b);}(_0xda80,0x11d));var _0x0da8=function(_0x37052c,_0x51f7db){_0x37052c=_0x37052c-0x0;var _0x5ba164=_0xda80[_0x37052c];return _0x5ba164;};'use strict';var multer=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0da8('0x2'));var router=express[_0x0da8('0x3')]();var fs_extra=require(_0x0da8('0x4'));var auth=require(_0x0da8('0x5'));var interaction=require(_0x0da8('0x6'));var config=require(_0x0da8('0x7'));var controller=require(_0x0da8('0x8'));router['get']('/',auth[_0x0da8('0x9')](),controller[_0x0da8('0xa')]);router[_0x0da8('0xb')](_0x0da8('0xc'),auth[_0x0da8('0x9')](),controller['show']);router[_0x0da8('0xb')](_0x0da8('0xd'),auth[_0x0da8('0x9')](),controller[_0x0da8('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x0da8('0xf')]);router[_0x0da8('0xb')](_0x0da8('0x10'),auth[_0x0da8('0x9')](),controller[_0x0da8('0x11')]);router[_0x0da8('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0da8('0x13')](_0x0da8('0xc'),auth[_0x0da8('0x9')](),controller['update']);router[_0x0da8('0x14')]('/:id',auth[_0x0da8('0x9')](),controller[_0x0da8('0x15')]);module[_0x0da8('0x16')]=router; \ No newline at end of file +var _0x6f8e=['./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d87ee,_0x5575e1){var _0x4badf9=function(_0x24a486){while(--_0x24a486){_0x5d87ee['push'](_0x5d87ee['shift']());}};_0x4badf9(++_0x5575e1);}(_0x6f8e,0xa8));var _0xe6f8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6f8e[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xe6f8('0x0'));var util=require(_0xe6f8('0x1'));var path=require(_0xe6f8('0x2'));var timeout=require(_0xe6f8('0x3'));var express=require('express');var router=express[_0xe6f8('0x4')]();var fs_extra=require(_0xe6f8('0x5'));var auth=require(_0xe6f8('0x6'));var interaction=require(_0xe6f8('0x7'));var config=require('../../config/environment');var controller=require(_0xe6f8('0x8'));router[_0xe6f8('0x9')]('/',auth[_0xe6f8('0xa')](),controller[_0xe6f8('0xb')]);router[_0xe6f8('0x9')](_0xe6f8('0xc'),auth[_0xe6f8('0xa')](),controller[_0xe6f8('0xd')]);router[_0xe6f8('0x9')](_0xe6f8('0xe'),auth[_0xe6f8('0xa')](),controller['getFields']);router[_0xe6f8('0x9')](_0xe6f8('0xf'),auth[_0xe6f8('0xa')](),controller[_0xe6f8('0x10')]);router['get']('/:id/descriptions',auth[_0xe6f8('0xa')](),controller['getDescriptions']);router[_0xe6f8('0x11')]('/',auth['isAuthenticated'](),controller[_0xe6f8('0x12')]);router[_0xe6f8('0x13')](_0xe6f8('0xc'),auth[_0xe6f8('0xa')](),controller['update']);router['delete']('/:id',auth[_0xe6f8('0xa')](),controller[_0xe6f8('0x14')]);module[_0xe6f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e3bb026..154389a 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 _0xbd5c=['lead','contact','nothing','contact_lead','STRING','sequelize','exports','ENUM'];(function(_0x3cc31a,_0x1531e8){var _0x145808=function(_0x3fb234){while(--_0x3fb234){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0x145808(++_0x1531e8);}(_0xbd5c,0x1cd));var _0xcbd5=function(_0x348b86,_0x114364){_0x348b86=_0x348b86-0x0;var _0x2bf3f2=_0xbd5c[_0x348b86];return _0x2bf3f2;};'use strict';var Sequelize=require(_0xcbd5('0x0'));module[_0xcbd5('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xcbd5('0x2')](_0xcbd5('0x3'),_0xcbd5('0x4'),_0xcbd5('0x5')),'defaultValue':_0xcbd5('0x3')},'moduleSearch':{'type':Sequelize[_0xcbd5('0x2')](_0xcbd5('0x6'),_0xcbd5('0x4'),'lead'),'defaultValue':_0xcbd5('0x6')},'description':{'type':Sequelize[_0xcbd5('0x7')]}}; \ No newline at end of file +var _0xdf07=['lead','contact','nothing','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xdf07,0x174));var _0x7df0=function(_0x3deae7,_0x3732f5){_0x3deae7=_0x3deae7-0x0;var _0x50479b=_0xdf07[_0x3deae7];return _0x50479b;};'use strict';var Sequelize=require(_0x7df0('0x0'));module[_0x7df0('0x1')]={'name':{'type':Sequelize[_0x7df0('0x2')]},'moduleCreate':{'type':Sequelize[_0x7df0('0x3')](_0x7df0('0x4'),_0x7df0('0x5'),_0x7df0('0x6')),'defaultValue':_0x7df0('0x4')},'moduleSearch':{'type':Sequelize[_0x7df0('0x3')](_0x7df0('0x7'),_0x7df0('0x5'),_0x7df0('0x4')),'defaultValue':_0x7df0('0x7')},'description':{'type':Sequelize[_0x7df0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 42898c3..ec24840 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 _0xbf53=['getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','ZohoField','nolimit'];(function(_0x444e44,_0x37be34){var _0xdd22e2=function(_0x2cd83d){while(--_0x2cd83d){_0x444e44['push'](_0x444e44['shift']());}};_0xdd22e2(++_0x37be34);}(_0xbf53,0x1e8));var _0x3bf5=function(_0x2496da,_0x3fe1fc){_0x2496da=_0x2496da-0x0;var _0x4caae0=_0xbf53[_0x2496da];return _0x4caae0;};'use strict';var emlformat=require(_0x3bf5('0x0'));var rimraf=require(_0x3bf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bf5('0x2'));var rp=require(_0x3bf5('0x3'));var moment=require(_0x3bf5('0x4'));var BPromise=require(_0x3bf5('0x5'));var Mustache=require(_0x3bf5('0x6'));var util=require(_0x3bf5('0x7'));var path=require(_0x3bf5('0x8'));var sox=require(_0x3bf5('0x9'));var csv=require(_0x3bf5('0xa'));var ejs=require(_0x3bf5('0xb'));var fs=require('fs');var fs_extra=require(_0x3bf5('0xc'));var _=require(_0x3bf5('0xd'));var squel=require('squel');var crypto=require(_0x3bf5('0xe'));var jsforce=require(_0x3bf5('0xf'));var deskjs=require(_0x3bf5('0x10'));var toCsv=require(_0x3bf5('0xa'));var querystring=require(_0x3bf5('0x11'));var Papa=require('papaparse');var Redis=require(_0x3bf5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3bf5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bf5('0x14'))(_0x3bf5('0x15'));var utils=require('../../config/utils');var config=require(_0x3bf5('0x16'));var licenseUtil=require(_0x3bf5('0x17'));var db=require(_0x3bf5('0x18'))['db'];function respondWithStatusCode(_0x473e78,_0x929568){_0x929568=_0x929568||0xcc;return function(_0x58c217){if(_0x58c217){return _0x473e78['sendStatus'](_0x929568);}return _0x473e78['status'](_0x929568)['end']();};}function respondWithResult(_0x33bc85,_0x222ead){_0x222ead=_0x222ead||0xc8;return function(_0x11b19a){if(_0x11b19a){return _0x33bc85[_0x3bf5('0x19')](_0x222ead)[_0x3bf5('0x1a')](_0x11b19a);}};}function respondWithFilteredResult(_0x1e3912,_0x3ed3d9){return function(_0x4f5814){if(_0x4f5814){var _0x247acd=typeof _0x3ed3d9[_0x3bf5('0x1b')]===_0x3bf5('0x1c')&&typeof _0x3ed3d9[_0x3bf5('0x1d')]==='undefined';var _0x1989e1=_0x4f5814[_0x3bf5('0x1e')];var _0x4bc834=_0x247acd?0x0:_0x3ed3d9[_0x3bf5('0x1b')];var _0x34b90e=_0x247acd?_0x4f5814[_0x3bf5('0x1e')]:_0x3ed3d9[_0x3bf5('0x1b')]+_0x3ed3d9[_0x3bf5('0x1d')];var _0x38cafc;if(_0x34b90e>=_0x1989e1){_0x34b90e=_0x1989e1;_0x38cafc=0xc8;}else{_0x38cafc=0xce;}_0x1e3912['status'](_0x38cafc);return _0x1e3912[_0x3bf5('0x1f')](_0x3bf5('0x20'),_0x4bc834+'-'+_0x34b90e+'/'+_0x1989e1)[_0x3bf5('0x1a')](_0x4f5814);}return null;};}function patchUpdates(_0x55ef49){return function(_0x47ca2d){try{jsonpatch['apply'](_0x47ca2d,_0x55ef49,!![]);}catch(_0x523ad4){return BPromise['reject'](_0x523ad4);}return _0x47ca2d['save']();};}function saveUpdates(_0x21bf8e,_0x203724){return function(_0x2b9798){if(_0x2b9798){return _0x2b9798[_0x3bf5('0x21')](_0x21bf8e)[_0x3bf5('0x22')](function(_0x1e7655){return _0x1e7655;});}return null;};}function removeEntity(_0x307ece,_0x402d28){return function(_0x2ddcd8){if(_0x2ddcd8){return _0x2ddcd8['destroy']()[_0x3bf5('0x22')](function(){_0x307ece[_0x3bf5('0x19')](0xcc)[_0x3bf5('0x23')]();});}};}function handleEntityNotFound(_0x406c82,_0x270af7){return function(_0x478f4){if(!_0x478f4){_0x406c82[_0x3bf5('0x24')](0x194);}return _0x478f4;};}function handleError(_0x99598b,_0x54bf04){_0x54bf04=_0x54bf04||0x1f4;return function(_0x20512b){logger[_0x3bf5('0x25')](_0x20512b[_0x3bf5('0x26')]);if(_0x20512b[_0x3bf5('0x27')]){delete _0x20512b['name'];}_0x99598b[_0x3bf5('0x19')](_0x54bf04)[_0x3bf5('0x28')](_0x20512b);};}exports[_0x3bf5('0x29')]=function(_0x613888,_0x96173b){var _0x3c5319={},_0x293572={},_0x5786aa={'count':0x0,'rows':[]};var _0xd9fe00=_['map'](db[_0x3bf5('0x2a')][_0x3bf5('0x2b')],function(_0x1214b8){return{'name':_0x1214b8[_0x3bf5('0x2c')],'type':_0x1214b8[_0x3bf5('0x2d')][_0x3bf5('0x2e')]};});_0x293572['model']=_[_0x3bf5('0x2f')](_0xd9fe00,_0x3bf5('0x27'));_0x293572['query']=_[_0x3bf5('0x30')](_0x613888[_0x3bf5('0x31')]);_0x293572['filters']=_[_0x3bf5('0x32')](_0x293572[_0x3bf5('0x33')],_0x293572[_0x3bf5('0x31')]);_0x3c5319['attributes']=_[_0x3bf5('0x32')](_0x293572['model'],qs['fields'](_0x613888[_0x3bf5('0x31')][_0x3bf5('0x34')]));_0x3c5319['attributes']=_0x3c5319[_0x3bf5('0x35')]['length']?_0x3c5319[_0x3bf5('0x35')]:_0x293572[_0x3bf5('0x33')];if(!_0x613888[_0x3bf5('0x31')][_0x3bf5('0x36')]('nolimit')){_0x3c5319['limit']=qs[_0x3bf5('0x1d')](_0x613888['query']['limit']);_0x3c5319[_0x3bf5('0x1b')]=qs[_0x3bf5('0x1b')](_0x613888['query']['offset']);}_0x3c5319[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x613888[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x3c5319[_0x3bf5('0x39')]=qs['filters'](_[_0x3bf5('0x3a')](_0x613888[_0x3bf5('0x31')],_0x293572[_0x3bf5('0x3b')]),_0xd9fe00);if(_0x613888[_0x3bf5('0x31')][_0x3bf5('0x3c')]){_0x3c5319['where']=_['merge'](_0x3c5319[_0x3bf5('0x39')],{'$or':_['map'](_0xd9fe00,function(_0x8240a9){if(_0x8240a9['type']!==_0x3bf5('0x3d')){var _0x186495={};_0x186495[_0x8240a9[_0x3bf5('0x27')]]={'$like':'%'+_0x613888['query']['filter']+'%'};return _0x186495;}})});}_0x3c5319=_[_0x3bf5('0x3e')]({},_0x3c5319,_0x613888[_0x3bf5('0x3f')]);var _0x2d98fe={'where':_0x3c5319['where']};return db[_0x3bf5('0x2a')][_0x3bf5('0x1e')](_0x2d98fe)[_0x3bf5('0x22')](function(_0xee22e4){_0x5786aa[_0x3bf5('0x1e')]=_0xee22e4;if(_0x613888[_0x3bf5('0x31')]['includeAll']){_0x3c5319[_0x3bf5('0x40')]=[{'all':!![]}];}return db[_0x3bf5('0x2a')][_0x3bf5('0x41')](_0x3c5319);})[_0x3bf5('0x22')](function(_0x16b1a3){_0x5786aa[_0x3bf5('0x42')]=_0x16b1a3;return _0x5786aa;})['then'](respondWithFilteredResult(_0x96173b,_0x3c5319))[_0x3bf5('0x43')](handleError(_0x96173b,null));};exports[_0x3bf5('0x44')]=function(_0x1479ef,_0x184c8e){var _0x3a7886={'raw':![],'where':{'id':_0x1479ef[_0x3bf5('0x45')]['id']}},_0x74476f={};_0x74476f[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x2a')]['rawAttributes']);_0x74476f[_0x3bf5('0x31')]=_[_0x3bf5('0x30')](_0x1479ef[_0x3bf5('0x31')]);_0x74476f[_0x3bf5('0x3b')]=_['intersection'](_0x74476f[_0x3bf5('0x33')],_0x74476f[_0x3bf5('0x31')]);_0x3a7886[_0x3bf5('0x35')]=_['intersection'](_0x74476f[_0x3bf5('0x33')],qs[_0x3bf5('0x34')](_0x1479ef[_0x3bf5('0x31')]['fields']));_0x3a7886[_0x3bf5('0x35')]=_0x3a7886['attributes'][_0x3bf5('0x46')]?_0x3a7886[_0x3bf5('0x35')]:_0x74476f[_0x3bf5('0x33')];if(_0x1479ef[_0x3bf5('0x31')]['includeAll']){_0x3a7886[_0x3bf5('0x40')]=[{'all':!![]}];}_0x3a7886=_[_0x3bf5('0x3e')]({},_0x3a7886,_0x1479ef[_0x3bf5('0x3f')]);return db[_0x3bf5('0x2a')][_0x3bf5('0x47')](_0x3a7886)[_0x3bf5('0x22')](handleEntityNotFound(_0x184c8e,null))[_0x3bf5('0x22')](respondWithResult(_0x184c8e,null))[_0x3bf5('0x43')](handleError(_0x184c8e,null));};exports[_0x3bf5('0x48')]=function(_0x2344af,_0x4601c8){return db['ZohoConfiguration'][_0x3bf5('0x48')](_0x2344af['body'],{})['then'](respondWithResult(_0x4601c8,0xc9))[_0x3bf5('0x43')](handleError(_0x4601c8,null));};exports[_0x3bf5('0x21')]=function(_0x2f529f,_0x6e85f8){if(_0x2f529f[_0x3bf5('0x49')]['id']){delete _0x2f529f[_0x3bf5('0x49')]['id'];}return db[_0x3bf5('0x2a')]['find']({'where':{'id':_0x2f529f[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x6e85f8,null))[_0x3bf5('0x22')](saveUpdates(_0x2f529f[_0x3bf5('0x49')],null))[_0x3bf5('0x22')](respondWithResult(_0x6e85f8,null))[_0x3bf5('0x43')](handleError(_0x6e85f8,null));};exports[_0x3bf5('0x4a')]=function(_0xc5281b,_0x4a9c84){return db[_0x3bf5('0x2a')][_0x3bf5('0x47')]({'where':{'id':_0xc5281b['params']['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x4a9c84,null))[_0x3bf5('0x22')](removeEntity(_0x4a9c84,null))[_0x3bf5('0x43')](handleError(_0x4a9c84,null));};exports[_0x3bf5('0x4b')]=function(_0x45433a,_0x2c8479,_0xf42b4){var _0x336751={};var _0x549d52={};var _0x119fa5;var _0x8c049d;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x45433a[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x2c8479,null))[_0x3bf5('0x22')](function(_0x36a5cc){if(_0x36a5cc){_0x119fa5=_0x36a5cc;_0x549d52['model']=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x549d52[_0x3bf5('0x31')]=_['keys'](_0x45433a[_0x3bf5('0x31')]);_0x549d52[_0x3bf5('0x3b')]=_['intersection'](_0x549d52[_0x3bf5('0x33')],_0x549d52[_0x3bf5('0x31')]);_0x336751[_0x3bf5('0x35')]=_[_0x3bf5('0x32')](_0x549d52[_0x3bf5('0x33')],qs['fields'](_0x45433a['query']['fields']));_0x336751[_0x3bf5('0x35')]=_0x336751['attributes'][_0x3bf5('0x46')]?_0x336751[_0x3bf5('0x35')]:_0x549d52[_0x3bf5('0x33')];_0x336751[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x336751[_0x3bf5('0x39')]=qs[_0x3bf5('0x3b')](_[_0x3bf5('0x3a')](_0x45433a[_0x3bf5('0x31')],_0x549d52[_0x3bf5('0x3b')]));if(_0x45433a['query'][_0x3bf5('0x3c')]){_0x336751[_0x3bf5('0x39')]=_[_0x3bf5('0x3e')](_0x336751[_0x3bf5('0x39')],{'$or':_['map'](_0x336751[_0x3bf5('0x35')],function(_0x332bf8){var _0x49fd5d={};_0x49fd5d[_0x332bf8]={'$like':'%'+_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x49fd5d;})});}_0x336751=_[_0x3bf5('0x3e')]({},_0x336751,_0x45433a[_0x3bf5('0x3f')]);return _0x119fa5[_0x3bf5('0x4b')](_0x336751);}})[_0x3bf5('0x22')](function(_0x2e8a69){if(_0x2e8a69){_0x8c049d=_0x2e8a69[_0x3bf5('0x46')];if(!_0x45433a['query'][_0x3bf5('0x36')](_0x3bf5('0x4e'))){_0x336751[_0x3bf5('0x1d')]=qs['limit'](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x336751['offset']=qs[_0x3bf5('0x1b')](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x1b')]);}return _0x119fa5[_0x3bf5('0x4b')](_0x336751);}})['then'](function(_0x245292){if(_0x245292){return _0x245292?{'count':_0x8c049d,'rows':_0x245292}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x2c8479,null))[_0x3bf5('0x43')](handleError(_0x2c8479,null));};exports[_0x3bf5('0x4f')]=function(_0x482354,_0x205e9a,_0x1626a5){var _0x411e39={};var _0x333363={};var _0x248575;var _0x5ea53a;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x482354[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x205e9a,null))[_0x3bf5('0x22')](function(_0x2de707){if(_0x2de707){_0x248575=_0x2de707;_0x333363[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x333363[_0x3bf5('0x31')]=_[_0x3bf5('0x30')](_0x482354[_0x3bf5('0x31')]);_0x333363[_0x3bf5('0x3b')]=_[_0x3bf5('0x32')](_0x333363[_0x3bf5('0x33')],_0x333363[_0x3bf5('0x31')]);_0x411e39[_0x3bf5('0x35')]=_[_0x3bf5('0x32')](_0x333363[_0x3bf5('0x33')],qs['fields'](_0x482354[_0x3bf5('0x31')]['fields']));_0x411e39['attributes']=_0x411e39[_0x3bf5('0x35')]['length']?_0x411e39[_0x3bf5('0x35')]:_0x333363[_0x3bf5('0x33')];_0x411e39[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x482354[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x411e39['where']=qs[_0x3bf5('0x3b')](_['pick'](_0x482354['query'],_0x333363['filters']));if(_0x482354[_0x3bf5('0x31')]['filter']){_0x411e39[_0x3bf5('0x39')]=_['merge'](_0x411e39[_0x3bf5('0x39')],{'$or':_[_0x3bf5('0x2f')](_0x411e39[_0x3bf5('0x35')],function(_0x74c1ba){var _0x441d9c={};_0x441d9c[_0x74c1ba]={'$like':'%'+_0x482354[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x441d9c;})});}_0x411e39=_[_0x3bf5('0x3e')]({},_0x411e39,_0x482354[_0x3bf5('0x3f')]);return _0x248575[_0x3bf5('0x4f')](_0x411e39);}})[_0x3bf5('0x22')](function(_0x3adfca){if(_0x3adfca){_0x5ea53a=_0x3adfca[_0x3bf5('0x46')];if(!_0x482354[_0x3bf5('0x31')]['hasOwnProperty'](_0x3bf5('0x4e'))){_0x411e39[_0x3bf5('0x1d')]=qs[_0x3bf5('0x1d')](_0x482354[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x411e39[_0x3bf5('0x1b')]=qs[_0x3bf5('0x1b')](_0x482354[_0x3bf5('0x31')]['offset']);}return _0x248575[_0x3bf5('0x4f')](_0x411e39);}})[_0x3bf5('0x22')](function(_0x5d89af){if(_0x5d89af){return _0x5d89af?{'count':_0x5ea53a,'rows':_0x5d89af}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x205e9a,null))[_0x3bf5('0x43')](handleError(_0x205e9a,null));};exports[_0x3bf5('0x50')]=function(_0x51a55e,_0x47fb42,_0x2b9366){var _0x5a421b={};var _0x37e5cb={};var _0x5a27c8;var _0x296793;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x51a55e['params']['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x47fb42,null))[_0x3bf5('0x22')](function(_0x4e49bc){if(_0x4e49bc){_0x5a27c8=_0x4e49bc;_0x37e5cb[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x37e5cb['query']=_['keys'](_0x51a55e['query']);_0x37e5cb[_0x3bf5('0x3b')]=_[_0x3bf5('0x32')](_0x37e5cb['model'],_0x37e5cb[_0x3bf5('0x31')]);_0x5a421b['attributes']=_[_0x3bf5('0x32')](_0x37e5cb[_0x3bf5('0x33')],qs[_0x3bf5('0x34')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x34')]));_0x5a421b['attributes']=_0x5a421b[_0x3bf5('0x35')][_0x3bf5('0x46')]?_0x5a421b['attributes']:_0x37e5cb[_0x3bf5('0x33')];_0x5a421b[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x5a421b[_0x3bf5('0x39')]=qs[_0x3bf5('0x3b')](_[_0x3bf5('0x3a')](_0x51a55e[_0x3bf5('0x31')],_0x37e5cb['filters']));if(_0x51a55e['query'][_0x3bf5('0x3c')]){_0x5a421b[_0x3bf5('0x39')]=_[_0x3bf5('0x3e')](_0x5a421b[_0x3bf5('0x39')],{'$or':_[_0x3bf5('0x2f')](_0x5a421b['attributes'],function(_0x3509f2){var _0x2f7d2b={};_0x2f7d2b[_0x3509f2]={'$like':'%'+_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x2f7d2b;})});}_0x5a421b=_[_0x3bf5('0x3e')]({},_0x5a421b,_0x51a55e[_0x3bf5('0x3f')]);return _0x5a27c8[_0x3bf5('0x50')](_0x5a421b);}})[_0x3bf5('0x22')](function(_0x38a0c3){if(_0x38a0c3){_0x296793=_0x38a0c3[_0x3bf5('0x46')];if(!_0x51a55e[_0x3bf5('0x31')]['hasOwnProperty'](_0x3bf5('0x4e'))){_0x5a421b['limit']=qs['limit'](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x5a421b['offset']=qs[_0x3bf5('0x1b')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x1b')]);}return _0x5a27c8[_0x3bf5('0x50')](_0x5a421b);}})[_0x3bf5('0x22')](function(_0x351661){if(_0x351661){return _0x351661?{'count':_0x296793,'rows':_0x351661}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x47fb42,null))[_0x3bf5('0x43')](handleError(_0x47fb42,null));}; \ No newline at end of file +var _0x6080=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','include','findAll','rows','catch','show','includeAll','options','find','create','body','update','params','findOne','filter','getFields','getSubjects','ZohoField','hasOwnProperty','getDescriptions','eml-format'];(function(_0x305c4f,_0x397f4e){var _0x4c858a=function(_0x397950){while(--_0x397950){_0x305c4f['push'](_0x305c4f['shift']());}};_0x4c858a(++_0x397f4e);}(_0x6080,0xf5));var _0x0608=function(_0x1ac206,_0x565166){_0x1ac206=_0x1ac206-0x0;var _0x1fec81=_0x6080[_0x1ac206];return _0x1fec81;};'use strict';var emlformat=require(_0x0608('0x0'));var rimraf=require(_0x0608('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0608('0x2'));var rp=require('request-promise');var moment=require(_0x0608('0x3'));var BPromise=require(_0x0608('0x4'));var Mustache=require(_0x0608('0x5'));var util=require(_0x0608('0x6'));var path=require(_0x0608('0x7'));var sox=require(_0x0608('0x8'));var csv=require('to-csv');var ejs=require(_0x0608('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0608('0xa'));var squel=require(_0x0608('0xb'));var crypto=require(_0x0608('0xc'));var jsforce=require(_0x0608('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0608('0xe'));var querystring=require(_0x0608('0xf'));var Papa=require(_0x0608('0x10'));var Redis=require(_0x0608('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0608('0x12'));var hardwareService=require(_0x0608('0x13'));var logger=require(_0x0608('0x14'))('api');var utils=require(_0x0608('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0608('0x16'));var db=require(_0x0608('0x17'))['db'];function respondWithStatusCode(_0x5c6c7d,_0x3cf236){_0x3cf236=_0x3cf236||0xcc;return function(_0x1a270e){if(_0x1a270e){return _0x5c6c7d[_0x0608('0x18')](_0x3cf236);}return _0x5c6c7d[_0x0608('0x19')](_0x3cf236)[_0x0608('0x1a')]();};}function respondWithResult(_0x5a631f,_0x1828da){_0x1828da=_0x1828da||0xc8;return function(_0x172ee1){if(_0x172ee1){return _0x5a631f[_0x0608('0x19')](_0x1828da)[_0x0608('0x1b')](_0x172ee1);}};}function respondWithFilteredResult(_0x247a09,_0x4d6b2d){return function(_0x4c174a){if(_0x4c174a){var _0x160439=typeof _0x4d6b2d[_0x0608('0x1c')]==='undefined'&&typeof _0x4d6b2d[_0x0608('0x1d')]===_0x0608('0x1e');var _0x1fb0ad=_0x4c174a['count'];var _0x3b98e6=_0x160439?0x0:_0x4d6b2d[_0x0608('0x1c')];var _0x3ef496=_0x160439?_0x4c174a[_0x0608('0x1f')]:_0x4d6b2d['offset']+_0x4d6b2d[_0x0608('0x1d')];var _0x48181a;if(_0x3ef496>=_0x1fb0ad){_0x3ef496=_0x1fb0ad;_0x48181a=0xc8;}else{_0x48181a=0xce;}_0x247a09[_0x0608('0x19')](_0x48181a);return _0x247a09[_0x0608('0x20')](_0x0608('0x21'),_0x3b98e6+'-'+_0x3ef496+'/'+_0x1fb0ad)[_0x0608('0x1b')](_0x4c174a);}return null;};}function patchUpdates(_0x371566){return function(_0x364e09){try{jsonpatch[_0x0608('0x22')](_0x364e09,_0x371566,!![]);}catch(_0x35d4b0){return BPromise['reject'](_0x35d4b0);}return _0x364e09[_0x0608('0x23')]();};}function saveUpdates(_0x39778b,_0x12a2ef){return function(_0x2a997b){if(_0x2a997b){return _0x2a997b['update'](_0x39778b)[_0x0608('0x24')](function(_0x5689e3){return _0x5689e3;});}return null;};}function removeEntity(_0x4fc56f,_0x4250f6){return function(_0x18c8f2){if(_0x18c8f2){return _0x18c8f2[_0x0608('0x25')]()[_0x0608('0x24')](function(){_0x4fc56f[_0x0608('0x19')](0xcc)[_0x0608('0x1a')]();});}};}function handleEntityNotFound(_0x5f4f5a,_0x30e107){return function(_0x4a8b87){if(!_0x4a8b87){_0x5f4f5a[_0x0608('0x18')](0x194);}return _0x4a8b87;};}function handleError(_0x3c438c,_0x4eb122){_0x4eb122=_0x4eb122||0x1f4;return function(_0x102a4d){logger[_0x0608('0x26')](_0x102a4d[_0x0608('0x27')]);if(_0x102a4d[_0x0608('0x28')]){delete _0x102a4d[_0x0608('0x28')];}_0x3c438c['status'](_0x4eb122)[_0x0608('0x29')](_0x102a4d);};}exports[_0x0608('0x2a')]=function(_0x223688,_0x16cea5){var _0x4e2822={},_0x466806={},_0x15fb9b={'count':0x0,'rows':[]};var _0x3267cd=_[_0x0608('0x2b')](db[_0x0608('0x2c')][_0x0608('0x2d')],function(_0x633ac4){return{'name':_0x633ac4[_0x0608('0x2e')],'type':_0x633ac4[_0x0608('0x2f')][_0x0608('0x30')]};});_0x466806[_0x0608('0x31')]=_[_0x0608('0x2b')](_0x3267cd,_0x0608('0x28'));_0x466806[_0x0608('0x32')]=_[_0x0608('0x33')](_0x223688['query']);_0x466806[_0x0608('0x34')]=_[_0x0608('0x35')](_0x466806[_0x0608('0x31')],_0x466806['query']);_0x4e2822[_0x0608('0x36')]=_[_0x0608('0x35')](_0x466806[_0x0608('0x31')],qs[_0x0608('0x37')](_0x223688['query'][_0x0608('0x37')]));_0x4e2822[_0x0608('0x36')]=_0x4e2822[_0x0608('0x36')][_0x0608('0x38')]?_0x4e2822[_0x0608('0x36')]:_0x466806[_0x0608('0x31')];if(!_0x223688[_0x0608('0x32')]['hasOwnProperty'](_0x0608('0x39'))){_0x4e2822[_0x0608('0x1d')]=qs[_0x0608('0x1d')](_0x223688[_0x0608('0x32')][_0x0608('0x1d')]);_0x4e2822[_0x0608('0x1c')]=qs[_0x0608('0x1c')](_0x223688[_0x0608('0x32')]['offset']);}_0x4e2822[_0x0608('0x3a')]=qs[_0x0608('0x3b')](_0x223688[_0x0608('0x32')][_0x0608('0x3b')]);_0x4e2822[_0x0608('0x3c')]=qs[_0x0608('0x34')](_[_0x0608('0x3d')](_0x223688[_0x0608('0x32')],_0x466806['filters']),_0x3267cd);if(_0x223688[_0x0608('0x32')]['filter']){_0x4e2822['where']=_['merge'](_0x4e2822['where'],{'$or':_['map'](_0x3267cd,function(_0x21fe02){if(_0x21fe02[_0x0608('0x2f')]!=='VIRTUAL'){var _0x1a4934={};_0x1a4934[_0x21fe02[_0x0608('0x28')]]={'$like':'%'+_0x223688[_0x0608('0x32')]['filter']+'%'};return _0x1a4934;}})});}_0x4e2822=_[_0x0608('0x3e')]({},_0x4e2822,_0x223688['options']);var _0x20cc8d={'where':_0x4e2822[_0x0608('0x3c')]};return db['ZohoConfiguration']['count'](_0x20cc8d)['then'](function(_0x5973ed){_0x15fb9b[_0x0608('0x1f')]=_0x5973ed;if(_0x223688['query']['includeAll']){_0x4e2822[_0x0608('0x3f')]=[{'all':!![]}];}return db[_0x0608('0x2c')][_0x0608('0x40')](_0x4e2822);})[_0x0608('0x24')](function(_0x52f3bb){_0x15fb9b[_0x0608('0x41')]=_0x52f3bb;return _0x15fb9b;})[_0x0608('0x24')](respondWithFilteredResult(_0x16cea5,_0x4e2822))[_0x0608('0x42')](handleError(_0x16cea5,null));};exports[_0x0608('0x43')]=function(_0x26f3c6,_0x33c89c){var _0xef2816={'raw':![],'where':{'id':_0x26f3c6['params']['id']}},_0x2b427c={};_0x2b427c[_0x0608('0x31')]=_[_0x0608('0x33')](db[_0x0608('0x2c')][_0x0608('0x2d')]);_0x2b427c[_0x0608('0x32')]=_[_0x0608('0x33')](_0x26f3c6[_0x0608('0x32')]);_0x2b427c[_0x0608('0x34')]=_[_0x0608('0x35')](_0x2b427c[_0x0608('0x31')],_0x2b427c['query']);_0xef2816['attributes']=_['intersection'](_0x2b427c['model'],qs[_0x0608('0x37')](_0x26f3c6[_0x0608('0x32')][_0x0608('0x37')]));_0xef2816['attributes']=_0xef2816[_0x0608('0x36')][_0x0608('0x38')]?_0xef2816['attributes']:_0x2b427c[_0x0608('0x31')];if(_0x26f3c6[_0x0608('0x32')][_0x0608('0x44')]){_0xef2816[_0x0608('0x3f')]=[{'all':!![]}];}_0xef2816=_[_0x0608('0x3e')]({},_0xef2816,_0x26f3c6[_0x0608('0x45')]);return db[_0x0608('0x2c')][_0x0608('0x46')](_0xef2816)[_0x0608('0x24')](handleEntityNotFound(_0x33c89c,null))['then'](respondWithResult(_0x33c89c,null))[_0x0608('0x42')](handleError(_0x33c89c,null));};exports[_0x0608('0x47')]=function(_0x2490f9,_0x432d5d){return db[_0x0608('0x2c')][_0x0608('0x47')](_0x2490f9[_0x0608('0x48')],{})[_0x0608('0x24')](respondWithResult(_0x432d5d,0xc9))[_0x0608('0x42')](handleError(_0x432d5d,null));};exports[_0x0608('0x49')]=function(_0x283344,_0x3711f0){if(_0x283344['body']['id']){delete _0x283344[_0x0608('0x48')]['id'];}return db['ZohoConfiguration'][_0x0608('0x46')]({'where':{'id':_0x283344[_0x0608('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3711f0,null))[_0x0608('0x24')](saveUpdates(_0x283344['body'],null))[_0x0608('0x24')](respondWithResult(_0x3711f0,null))['catch'](handleError(_0x3711f0,null));};exports['destroy']=function(_0x3696e0,_0x405a35){return db[_0x0608('0x2c')][_0x0608('0x46')]({'where':{'id':_0x3696e0['params']['id']}})[_0x0608('0x24')](handleEntityNotFound(_0x405a35,null))[_0x0608('0x24')](removeEntity(_0x405a35,null))[_0x0608('0x42')](handleError(_0x405a35,null));};exports['getFields']=function(_0x186189,_0x29e4d7,_0x19cdcb){var _0x47365a={};var _0x4d1a54={};var _0x59bbf3;var _0x5529d0;return db['ZohoConfiguration'][_0x0608('0x4b')]({'where':{'id':_0x186189[_0x0608('0x4a')]['id']}})[_0x0608('0x24')](handleEntityNotFound(_0x29e4d7,null))['then'](function(_0x5143dd){if(_0x5143dd){_0x59bbf3=_0x5143dd;_0x4d1a54['model']=_['keys'](db['ZohoField'][_0x0608('0x2d')]);_0x4d1a54[_0x0608('0x32')]=_[_0x0608('0x33')](_0x186189[_0x0608('0x32')]);_0x4d1a54[_0x0608('0x34')]=_[_0x0608('0x35')](_0x4d1a54['model'],_0x4d1a54[_0x0608('0x32')]);_0x47365a['attributes']=_[_0x0608('0x35')](_0x4d1a54[_0x0608('0x31')],qs[_0x0608('0x37')](_0x186189['query'][_0x0608('0x37')]));_0x47365a[_0x0608('0x36')]=_0x47365a[_0x0608('0x36')][_0x0608('0x38')]?_0x47365a['attributes']:_0x4d1a54['model'];_0x47365a['order']=qs[_0x0608('0x3b')](_0x186189[_0x0608('0x32')][_0x0608('0x3b')]);_0x47365a[_0x0608('0x3c')]=qs[_0x0608('0x34')](_['pick'](_0x186189[_0x0608('0x32')],_0x4d1a54[_0x0608('0x34')]));if(_0x186189[_0x0608('0x32')][_0x0608('0x4c')]){_0x47365a['where']=_[_0x0608('0x3e')](_0x47365a[_0x0608('0x3c')],{'$or':_[_0x0608('0x2b')](_0x47365a[_0x0608('0x36')],function(_0x40fbcc){var _0x1c4c00={};_0x1c4c00[_0x40fbcc]={'$like':'%'+_0x186189['query'][_0x0608('0x4c')]+'%'};return _0x1c4c00;})});}_0x47365a=_[_0x0608('0x3e')]({},_0x47365a,_0x186189['options']);return _0x59bbf3[_0x0608('0x4d')](_0x47365a);}})['then'](function(_0x2cd619){if(_0x2cd619){_0x5529d0=_0x2cd619[_0x0608('0x38')];if(!_0x186189['query']['hasOwnProperty']('nolimit')){_0x47365a['limit']=qs[_0x0608('0x1d')](_0x186189['query'][_0x0608('0x1d')]);_0x47365a[_0x0608('0x1c')]=qs[_0x0608('0x1c')](_0x186189[_0x0608('0x32')]['offset']);}return _0x59bbf3['getFields'](_0x47365a);}})[_0x0608('0x24')](function(_0x1a66c1){if(_0x1a66c1){return _0x1a66c1?{'count':_0x5529d0,'rows':_0x1a66c1}:null;}})[_0x0608('0x24')](respondWithResult(_0x29e4d7,null))[_0x0608('0x42')](handleError(_0x29e4d7,null));};exports[_0x0608('0x4e')]=function(_0x2af993,_0x41782a,_0x13d610){var _0x286bc7={};var _0x2155a7={};var _0x3e73b6;var _0x1cca8b;return db[_0x0608('0x2c')][_0x0608('0x4b')]({'where':{'id':_0x2af993[_0x0608('0x4a')]['id']}})[_0x0608('0x24')](handleEntityNotFound(_0x41782a,null))['then'](function(_0x24248c){if(_0x24248c){_0x3e73b6=_0x24248c;_0x2155a7[_0x0608('0x31')]=_[_0x0608('0x33')](db[_0x0608('0x4f')][_0x0608('0x2d')]);_0x2155a7[_0x0608('0x32')]=_[_0x0608('0x33')](_0x2af993[_0x0608('0x32')]);_0x2155a7['filters']=_[_0x0608('0x35')](_0x2155a7[_0x0608('0x31')],_0x2155a7[_0x0608('0x32')]);_0x286bc7[_0x0608('0x36')]=_[_0x0608('0x35')](_0x2155a7[_0x0608('0x31')],qs['fields'](_0x2af993['query'][_0x0608('0x37')]));_0x286bc7[_0x0608('0x36')]=_0x286bc7[_0x0608('0x36')][_0x0608('0x38')]?_0x286bc7[_0x0608('0x36')]:_0x2155a7[_0x0608('0x31')];_0x286bc7['order']=qs[_0x0608('0x3b')](_0x2af993[_0x0608('0x32')]['sort']);_0x286bc7[_0x0608('0x3c')]=qs[_0x0608('0x34')](_[_0x0608('0x3d')](_0x2af993['query'],_0x2155a7[_0x0608('0x34')]));if(_0x2af993[_0x0608('0x32')][_0x0608('0x4c')]){_0x286bc7[_0x0608('0x3c')]=_[_0x0608('0x3e')](_0x286bc7[_0x0608('0x3c')],{'$or':_[_0x0608('0x2b')](_0x286bc7[_0x0608('0x36')],function(_0x4a99d6){var _0x4641d2={};_0x4641d2[_0x4a99d6]={'$like':'%'+_0x2af993['query'][_0x0608('0x4c')]+'%'};return _0x4641d2;})});}_0x286bc7=_[_0x0608('0x3e')]({},_0x286bc7,_0x2af993['options']);return _0x3e73b6[_0x0608('0x4e')](_0x286bc7);}})[_0x0608('0x24')](function(_0x4f4061){if(_0x4f4061){_0x1cca8b=_0x4f4061[_0x0608('0x38')];if(!_0x2af993[_0x0608('0x32')][_0x0608('0x50')](_0x0608('0x39'))){_0x286bc7[_0x0608('0x1d')]=qs[_0x0608('0x1d')](_0x2af993[_0x0608('0x32')][_0x0608('0x1d')]);_0x286bc7[_0x0608('0x1c')]=qs[_0x0608('0x1c')](_0x2af993[_0x0608('0x32')][_0x0608('0x1c')]);}return _0x3e73b6['getSubjects'](_0x286bc7);}})[_0x0608('0x24')](function(_0x1a6cd2){if(_0x1a6cd2){return _0x1a6cd2?{'count':_0x1cca8b,'rows':_0x1a6cd2}:null;}})[_0x0608('0x24')](respondWithResult(_0x41782a,null))[_0x0608('0x42')](handleError(_0x41782a,null));};exports[_0x0608('0x51')]=function(_0x131cfc,_0x459982,_0x442ae5){var _0x59ae4d={};var _0x481692={};var _0x1617b9;var _0x1400bc;return db[_0x0608('0x2c')]['findOne']({'where':{'id':_0x131cfc['params']['id']}})[_0x0608('0x24')](handleEntityNotFound(_0x459982,null))[_0x0608('0x24')](function(_0x303bfc){if(_0x303bfc){_0x1617b9=_0x303bfc;_0x481692[_0x0608('0x31')]=_[_0x0608('0x33')](db['ZohoField'][_0x0608('0x2d')]);_0x481692[_0x0608('0x32')]=_['keys'](_0x131cfc[_0x0608('0x32')]);_0x481692[_0x0608('0x34')]=_[_0x0608('0x35')](_0x481692['model'],_0x481692[_0x0608('0x32')]);_0x59ae4d[_0x0608('0x36')]=_[_0x0608('0x35')](_0x481692['model'],qs[_0x0608('0x37')](_0x131cfc[_0x0608('0x32')][_0x0608('0x37')]));_0x59ae4d[_0x0608('0x36')]=_0x59ae4d[_0x0608('0x36')]['length']?_0x59ae4d[_0x0608('0x36')]:_0x481692[_0x0608('0x31')];_0x59ae4d[_0x0608('0x3a')]=qs[_0x0608('0x3b')](_0x131cfc[_0x0608('0x32')][_0x0608('0x3b')]);_0x59ae4d[_0x0608('0x3c')]=qs[_0x0608('0x34')](_[_0x0608('0x3d')](_0x131cfc[_0x0608('0x32')],_0x481692[_0x0608('0x34')]));if(_0x131cfc[_0x0608('0x32')][_0x0608('0x4c')]){_0x59ae4d[_0x0608('0x3c')]=_[_0x0608('0x3e')](_0x59ae4d[_0x0608('0x3c')],{'$or':_[_0x0608('0x2b')](_0x59ae4d['attributes'],function(_0x3990db){var _0x58acfc={};_0x58acfc[_0x3990db]={'$like':'%'+_0x131cfc['query']['filter']+'%'};return _0x58acfc;})});}_0x59ae4d=_[_0x0608('0x3e')]({},_0x59ae4d,_0x131cfc[_0x0608('0x45')]);return _0x1617b9[_0x0608('0x51')](_0x59ae4d);}})[_0x0608('0x24')](function(_0x4716f4){if(_0x4716f4){_0x1400bc=_0x4716f4['length'];if(!_0x131cfc[_0x0608('0x32')][_0x0608('0x50')](_0x0608('0x39'))){_0x59ae4d['limit']=qs[_0x0608('0x1d')](_0x131cfc['query']['limit']);_0x59ae4d[_0x0608('0x1c')]=qs[_0x0608('0x1c')](_0x131cfc[_0x0608('0x32')]['offset']);}return _0x1617b9[_0x0608('0x51')](_0x59ae4d);}})[_0x0608('0x24')](function(_0x864749){if(_0x864749){return _0x864749?{'count':_0x1400bc,'rows':_0x864749}:null;}})[_0x0608('0x24')](respondWithResult(_0x459982,null))[_0x0608('0x42')](handleError(_0x459982,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 58475a3..72b4531 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 _0x6eba=['moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x44a905,_0x134b44){var _0x5e8292=function(_0x695b17){while(--_0x695b17){_0x44a905['push'](_0x44a905['shift']());}};_0x5e8292(++_0x134b44);}(_0x6eba,0x6a));var _0xa6eb=function(_0x36f30c,_0x54a8b2){_0x36f30c=_0x36f30c-0x0;var _0x554716=_0x6eba[_0x36f30c];return _0x554716;};'use strict';var _=require(_0xa6eb('0x0'));var util=require(_0xa6eb('0x1'));var logger=require(_0xa6eb('0x2'))(_0xa6eb('0x3'));var moment=require(_0xa6eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6eb('0x5'));var fs=require('fs');var path=require(_0xa6eb('0x6'));var rimraf=require(_0xa6eb('0x7'));var config=require(_0xa6eb('0x8'));var attributes=require(_0xa6eb('0x9'));module['exports']=function(_0x25fea1,_0x8baaa8){return _0x25fea1['define']('ZohoConfiguration',attributes,{'tableName':_0xa6eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a65=['int_zoho_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x1fac66,_0x54fc1a){var _0x45880f=function(_0x38732f){while(--_0x38732f){_0x1fac66['push'](_0x1fac66['shift']());}};_0x45880f(++_0x54fc1a);}(_0x5a65,0x18d));var _0x55a6=function(_0x5d010f,_0x3215e7){_0x5d010f=_0x5d010f-0x0;var _0x5ed276=_0x5a65[_0x5d010f];return _0x5ed276;};'use strict';var _=require(_0x55a6('0x0'));var util=require('util');var logger=require(_0x55a6('0x1'))('api');var moment=require(_0x55a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x55a6('0x3'));var fs=require('fs');var path=require(_0x55a6('0x4'));var rimraf=require(_0x55a6('0x5'));var config=require(_0x55a6('0x6'));var attributes=require(_0x55a6('0x7'));module[_0x55a6('0x8')]=function(_0x2af432,_0x1ec569){return _0x2af432[_0x55a6('0x9')](_0x55a6('0xa'),attributes,{'tableName':_0x55a6('0xb'),'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 43aad94..259d2f7 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 _0x46a9=['client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1478c1,_0x377fc7){var _0x2fa2e2=function(_0x2823c4){while(--_0x2823c4){_0x1478c1['push'](_0x1478c1['shift']());}};_0x2fa2e2(++_0x377fc7);}(_0x46a9,0x1af));var _0x946a=function(_0x582ef9,_0x154ea1){_0x582ef9=_0x582ef9-0x0;var _0x8d14fb=_0x46a9[_0x582ef9];return _0x8d14fb;};'use strict';var _=require('lodash');var util=require(_0x946a('0x0'));var moment=require(_0x946a('0x1'));var BPromise=require(_0x946a('0x2'));var rs=require(_0x946a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x946a('0x4'))['db'];var utils=require(_0x946a('0x5'));var logger=require(_0x946a('0x6'))(_0x946a('0x7'));var config=require(_0x946a('0x8'));var jayson=require(_0x946a('0x9'));var client=jayson[_0x946a('0xa')][_0x946a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e2625,_0x8331c0,_0x2f9489){return new BPromise(function(_0x2284e3,_0x293b8c){return client['request'](_0x1e2625,_0x2f9489)['then'](function(_0x413502){logger[_0x946a('0xc')](_0x946a('0xd'),_0x8331c0,_0x946a('0xe'));logger['debug'](_0x946a('0xf'),_0x8331c0,_0x946a('0xe'),JSON[_0x946a('0x10')](_0x413502));if(_0x413502['error']){if(_0x413502[_0x946a('0x11')]['code']===0x1f4){logger[_0x946a('0x11')](_0x946a('0xd'),_0x8331c0,_0x413502['error'][_0x946a('0x12')]);return _0x293b8c(_0x413502['error']['message']);}logger[_0x946a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x8331c0,_0x413502['error'][_0x946a('0x12')]);return _0x2284e3(_0x413502[_0x946a('0x11')][_0x946a('0x12')]);}else{logger['info'](_0x946a('0xd'),_0x8331c0,'request\x20sent');_0x2284e3(_0x413502[_0x946a('0x13')]['message']);}})[_0x946a('0x14')](function(_0x413e06){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x8331c0,_0x413e06);_0x293b8c(_0x413e06);});});} \ No newline at end of file +var _0x94e6=['../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e6,0xe0));var _0x694e=function(_0x906b6c,_0x475164){_0x906b6c=_0x906b6c-0x0;var _0x6146a8=_0x94e6[_0x906b6c];return _0x6146a8;};'use strict';var _=require('lodash');var util=require(_0x694e('0x0'));var moment=require(_0x694e('0x1'));var BPromise=require(_0x694e('0x2'));var rs=require(_0x694e('0x3'));var fs=require('fs');var Redis=require(_0x694e('0x4'));var db=require(_0x694e('0x5'))['db'];var utils=require(_0x694e('0x6'));var logger=require('../../config/logger')(_0x694e('0x7'));var config=require('../../config/environment');var jayson=require(_0x694e('0x8'));var client=jayson[_0x694e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f4bc5,_0x4c0ccf,_0x560095){return new BPromise(function(_0x28628f,_0x132e86){return client[_0x694e('0xa')](_0x4f4bc5,_0x560095)[_0x694e('0xb')](function(_0x31247b){logger[_0x694e('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x4c0ccf,_0x694e('0xd'));logger[_0x694e('0xe')](_0x694e('0xf'),_0x4c0ccf,_0x694e('0xd'),JSON[_0x694e('0x10')](_0x31247b));if(_0x31247b['error']){if(_0x31247b['error'][_0x694e('0x11')]===0x1f4){logger[_0x694e('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4c0ccf,_0x31247b[_0x694e('0x12')][_0x694e('0x13')]);return _0x132e86(_0x31247b[_0x694e('0x12')][_0x694e('0x13')]);}logger[_0x694e('0x12')](_0x694e('0x14'),_0x4c0ccf,_0x31247b[_0x694e('0x12')][_0x694e('0x13')]);return _0x28628f(_0x31247b['error'][_0x694e('0x13')]);}else{logger[_0x694e('0xc')](_0x694e('0x14'),_0x4c0ccf,_0x694e('0xd'));_0x28628f(_0x31247b[_0x694e('0x15')][_0x694e('0x13')]);}})[_0x694e('0x16')](function(_0x1736ad){logger[_0x694e('0x12')](_0x694e('0x14'),_0x4c0ccf,_0x1736ad);_0x132e86(_0x1736ad);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 6500ff4..5669a26 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 _0x64e1=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./intZohoField.controller'];(function(_0x286e51,_0x25ba9d){var _0x5cf65b=function(_0x47ce9c){while(--_0x47ce9c){_0x286e51['push'](_0x286e51['shift']());}};_0x5cf65b(++_0x25ba9d);}(_0x64e1,0x9a));var _0x164e=function(_0x5e9c5c,_0x30c837){_0x5e9c5c=_0x5e9c5c-0x0;var _0x323ea5=_0x64e1[_0x5e9c5c];return _0x323ea5;};'use strict';var multer=require(_0x164e('0x0'));var util=require(_0x164e('0x1'));var path=require(_0x164e('0x2'));var timeout=require(_0x164e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x164e('0x4'));var config=require('../../config/environment');var controller=require(_0x164e('0x5'));router[_0x164e('0x6')]('/',auth[_0x164e('0x7')](),controller[_0x164e('0x8')]);router[_0x164e('0x6')](_0x164e('0x9'),auth[_0x164e('0x7')](),controller[_0x164e('0xa')]);router[_0x164e('0xb')]('/',auth[_0x164e('0x7')](),controller[_0x164e('0xc')]);router['put'](_0x164e('0x9'),auth[_0x164e('0x7')](),controller['update']);router[_0x164e('0xd')](_0x164e('0x9'),auth[_0x164e('0x7')](),controller[_0x164e('0xe')]);module[_0x164e('0xf')]=router; \ No newline at end of file +var _0x5e65=['get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x56a616,_0x5a3c7c){var _0xe94844=function(_0x1d3816){while(--_0x1d3816){_0x56a616['push'](_0x56a616['shift']());}};_0xe94844(++_0x5a3c7c);}(_0x5e65,0xdb));var _0x55e6=function(_0x5429bf,_0x559689){_0x5429bf=_0x5429bf-0x0;var _0x843559=_0x5e65[_0x5429bf];return _0x843559;};'use strict';var multer=require('multer');var util=require(_0x55e6('0x0'));var path=require(_0x55e6('0x1'));var timeout=require(_0x55e6('0x2'));var express=require('express');var router=express[_0x55e6('0x3')]();var fs_extra=require(_0x55e6('0x4'));var auth=require(_0x55e6('0x5'));var interaction=require(_0x55e6('0x6'));var config=require(_0x55e6('0x7'));var controller=require(_0x55e6('0x8'));router[_0x55e6('0x9')]('/',auth['isAuthenticated'](),controller[_0x55e6('0xa')]);router[_0x55e6('0x9')](_0x55e6('0xb'),auth[_0x55e6('0xc')](),controller[_0x55e6('0xd')]);router[_0x55e6('0xe')]('/',auth[_0x55e6('0xc')](),controller[_0x55e6('0xf')]);router[_0x55e6('0x10')](_0x55e6('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x55e6('0x11')](_0x55e6('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x55e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index aa54ad2..fdb611f 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 _0x57bc=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x4ff16c,_0x40dbff){var _0x54c9df=function(_0xb24a16){while(--_0xb24a16){_0x4ff16c['push'](_0x4ff16c['shift']());}};_0x54c9df(++_0x40dbff);}(_0x57bc,0x1b0));var _0xc57b=function(_0x35b997,_0x59981e){_0x35b997=_0x35b997-0x0;var _0x11d0d5=_0x57bc[_0x35b997];return _0x11d0d5;};'use strict';var Sequelize=require(_0xc57b('0x0'));module['exports']={'type':{'type':Sequelize[_0xc57b('0x1')](_0xc57b('0x2'),_0xc57b('0x3'),'customVariable',_0xc57b('0x4'),_0xc57b('0x5')),'defaultValue':_0xc57b('0x2')},'content':{'type':Sequelize[_0xc57b('0x6')]},'key':{'type':Sequelize[_0xc57b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc57b('0x2'),_0xc57b('0x3'),_0xc57b('0x7'))},'keyContent':{'type':Sequelize[_0xc57b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc57b('0x6')]},'customField':{'type':Sequelize[_0xc57b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc57b('0x6')]}}; \ No newline at end of file +var _0x9a05=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0xa41559,_0x30e1f6){var _0x46561b=function(_0x9bca54){while(--_0x9bca54){_0xa41559['push'](_0xa41559['shift']());}};_0x46561b(++_0x30e1f6);}(_0x9a05,0xb8));var _0x59a0=function(_0x590c79,_0x8e80ce){_0x590c79=_0x590c79-0x0;var _0x39431e=_0x9a05[_0x590c79];return _0x39431e;};'use strict';var Sequelize=require(_0x59a0('0x0'));module[_0x59a0('0x1')]={'type':{'type':Sequelize[_0x59a0('0x2')](_0x59a0('0x3'),_0x59a0('0x4'),_0x59a0('0x5'),'keyValue',_0x59a0('0x6')),'defaultValue':_0x59a0('0x3')},'content':{'type':Sequelize[_0x59a0('0x7')]},'key':{'type':Sequelize[_0x59a0('0x7')]},'keyType':{'type':Sequelize[_0x59a0('0x2')](_0x59a0('0x3'),_0x59a0('0x4'),_0x59a0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x59a0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 9a2759f..2390ff7 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 _0x6018=['where','pick','merge','count','include','findAll','rows','params','rawAttributes','filters','includeAll','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','limit','undefined','offset','status','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZohoField','type','key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x16d7af,_0x485d45){var _0x4697cf=function(_0x173039){while(--_0x173039){_0x16d7af['push'](_0x16d7af['shift']());}};_0x4697cf(++_0x485d45);}(_0x6018,0x1cc));var _0x8601=function(_0x2cdbef,_0x837a3b){_0x2cdbef=_0x2cdbef-0x0;var _0x1ba576=_0x6018[_0x2cdbef];return _0x1ba576;};'use strict';var emlformat=require(_0x8601('0x0'));var rimraf=require(_0x8601('0x1'));var zipdir=require(_0x8601('0x2'));var jsonpatch=require(_0x8601('0x3'));var rp=require(_0x8601('0x4'));var moment=require(_0x8601('0x5'));var BPromise=require(_0x8601('0x6'));var Mustache=require(_0x8601('0x7'));var util=require(_0x8601('0x8'));var path=require('path');var sox=require(_0x8601('0x9'));var csv=require(_0x8601('0xa'));var ejs=require(_0x8601('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8601('0xc'));var squel=require(_0x8601('0xd'));var crypto=require(_0x8601('0xe'));var jsforce=require(_0x8601('0xf'));var deskjs=require(_0x8601('0x10'));var toCsv=require(_0x8601('0xa'));var querystring=require(_0x8601('0x11'));var Papa=require('papaparse');var Redis=require(_0x8601('0x12'));var authService=require(_0x8601('0x13'));var qs=require(_0x8601('0x14'));var as=require(_0x8601('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8601('0x16'))(_0x8601('0x17'));var utils=require('../../config/utils');var config=require(_0x8601('0x18'));var licenseUtil=require(_0x8601('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346186,_0xe7ba77){_0xe7ba77=_0xe7ba77||0xcc;return function(_0x2d0a40){if(_0x2d0a40){return _0x346186[_0x8601('0x1a')](_0xe7ba77);}return _0x346186['status'](_0xe7ba77)['end']();};}function respondWithResult(_0x56b204,_0x35e94b){_0x35e94b=_0x35e94b||0xc8;return function(_0x5aba59){if(_0x5aba59){return _0x56b204['status'](_0x35e94b)[_0x8601('0x1b')](_0x5aba59);}};}function respondWithFilteredResult(_0x308cc1,_0x2f5f0e){return function(_0x1f2a8c){if(_0x1f2a8c){var _0x3276c4=typeof _0x2f5f0e['offset']==='undefined'&&typeof _0x2f5f0e[_0x8601('0x1c')]===_0x8601('0x1d');var _0x4ed486=_0x1f2a8c['count'];var _0x5dabb3=_0x3276c4?0x0:_0x2f5f0e['offset'];var _0x36f0aa=_0x3276c4?_0x1f2a8c['count']:_0x2f5f0e[_0x8601('0x1e')]+_0x2f5f0e[_0x8601('0x1c')];var _0x2729b5;if(_0x36f0aa>=_0x4ed486){_0x36f0aa=_0x4ed486;_0x2729b5=0xc8;}else{_0x2729b5=0xce;}_0x308cc1[_0x8601('0x1f')](_0x2729b5);return _0x308cc1[_0x8601('0x20')]('Content-Range',_0x5dabb3+'-'+_0x36f0aa+'/'+_0x4ed486)[_0x8601('0x1b')](_0x1f2a8c);}return null;};}function patchUpdates(_0x7a76e0){return function(_0x11bcc4){try{jsonpatch[_0x8601('0x21')](_0x11bcc4,_0x7a76e0,!![]);}catch(_0x1bae72){return BPromise[_0x8601('0x22')](_0x1bae72);}return _0x11bcc4[_0x8601('0x23')]();};}function saveUpdates(_0x19d0e3,_0x463475){return function(_0x427dc0){if(_0x427dc0){return _0x427dc0[_0x8601('0x24')](_0x19d0e3)[_0x8601('0x25')](function(_0x316fbb){return _0x316fbb;});}return null;};}function removeEntity(_0x23b416,_0x3f614f){return function(_0x32648d){if(_0x32648d){return _0x32648d[_0x8601('0x26')]()[_0x8601('0x25')](function(){_0x23b416[_0x8601('0x1f')](0xcc)[_0x8601('0x27')]();});}};}function handleEntityNotFound(_0x44ebea,_0x1a3fe0){return function(_0x36909b){if(!_0x36909b){_0x44ebea[_0x8601('0x1a')](0x194);}return _0x36909b;};}function handleError(_0x31c062,_0x5f5533){_0x5f5533=_0x5f5533||0x1f4;return function(_0x469be5){logger['error'](_0x469be5[_0x8601('0x28')]);if(_0x469be5[_0x8601('0x29')]){delete _0x469be5[_0x8601('0x29')];}_0x31c062[_0x8601('0x1f')](_0x5f5533)[_0x8601('0x2a')](_0x469be5);};}exports[_0x8601('0x2b')]=function(_0x580e19,_0x197867){var _0x4029f9={},_0x5a12b2={},_0x4f272b={'count':0x0,'rows':[]};var _0x26c2e7=_[_0x8601('0x2c')](db[_0x8601('0x2d')]['rawAttributes'],function(_0x16b512){return{'name':_0x16b512['fieldName'],'type':_0x16b512[_0x8601('0x2e')][_0x8601('0x2f')]};});_0x5a12b2['model']=_[_0x8601('0x2c')](_0x26c2e7,'name');_0x5a12b2['query']=_[_0x8601('0x30')](_0x580e19['query']);_0x5a12b2['filters']=_[_0x8601('0x31')](_0x5a12b2['model'],_0x5a12b2[_0x8601('0x32')]);_0x4029f9[_0x8601('0x33')]=_[_0x8601('0x31')](_0x5a12b2[_0x8601('0x34')],qs[_0x8601('0x35')](_0x580e19['query']['fields']));_0x4029f9['attributes']=_0x4029f9[_0x8601('0x33')][_0x8601('0x36')]?_0x4029f9[_0x8601('0x33')]:_0x5a12b2[_0x8601('0x34')];if(!_0x580e19[_0x8601('0x32')][_0x8601('0x37')](_0x8601('0x38'))){_0x4029f9[_0x8601('0x1c')]=qs[_0x8601('0x1c')](_0x580e19[_0x8601('0x32')]['limit']);_0x4029f9[_0x8601('0x1e')]=qs['offset'](_0x580e19['query'][_0x8601('0x1e')]);}_0x4029f9['order']=qs['sort'](_0x580e19[_0x8601('0x32')][_0x8601('0x39')]);_0x4029f9[_0x8601('0x3a')]=qs['filters'](_[_0x8601('0x3b')](_0x580e19[_0x8601('0x32')],_0x5a12b2['filters']),_0x26c2e7);if(_0x580e19['query']['filter']){_0x4029f9['where']=_[_0x8601('0x3c')](_0x4029f9['where'],{'$or':_[_0x8601('0x2c')](_0x26c2e7,function(_0x592551){if(_0x592551[_0x8601('0x2e')]!=='VIRTUAL'){var _0x121d0f={};_0x121d0f[_0x592551['name']]={'$like':'%'+_0x580e19['query']['filter']+'%'};return _0x121d0f;}})});}_0x4029f9=_[_0x8601('0x3c')]({},_0x4029f9,_0x580e19['options']);var _0x405a9f={'where':_0x4029f9['where']};return db['ZohoField'][_0x8601('0x3d')](_0x405a9f)[_0x8601('0x25')](function(_0x2225cf){_0x4f272b[_0x8601('0x3d')]=_0x2225cf;if(_0x580e19['query']['includeAll']){_0x4029f9[_0x8601('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0x8601('0x3f')](_0x4029f9);})[_0x8601('0x25')](function(_0x19619b){_0x4f272b[_0x8601('0x40')]=_0x19619b;return _0x4f272b;})[_0x8601('0x25')](respondWithFilteredResult(_0x197867,_0x4029f9))['catch'](handleError(_0x197867,null));};exports['show']=function(_0x5df72d,_0x8efd96){var _0xa93afb={'raw':!![],'where':{'id':_0x5df72d[_0x8601('0x41')]['id']}},_0xe3d51={};_0xe3d51[_0x8601('0x34')]=_[_0x8601('0x30')](db['ZohoField'][_0x8601('0x42')]);_0xe3d51['query']=_[_0x8601('0x30')](_0x5df72d['query']);_0xe3d51[_0x8601('0x43')]=_[_0x8601('0x31')](_0xe3d51['model'],_0xe3d51[_0x8601('0x32')]);_0xa93afb[_0x8601('0x33')]=_['intersection'](_0xe3d51['model'],qs[_0x8601('0x35')](_0x5df72d[_0x8601('0x32')]['fields']));_0xa93afb['attributes']=_0xa93afb[_0x8601('0x33')][_0x8601('0x36')]?_0xa93afb[_0x8601('0x33')]:_0xe3d51['model'];if(_0x5df72d[_0x8601('0x32')][_0x8601('0x44')]){_0xa93afb[_0x8601('0x3e')]=[{'all':!![]}];}_0xa93afb=_['merge']({},_0xa93afb,_0x5df72d[_0x8601('0x45')]);return db['ZohoField']['find'](_0xa93afb)[_0x8601('0x25')](handleEntityNotFound(_0x8efd96,null))[_0x8601('0x25')](respondWithResult(_0x8efd96,null))[_0x8601('0x46')](handleError(_0x8efd96,null));};exports[_0x8601('0x47')]=function(_0x4751db,_0x3d5b49){return db[_0x8601('0x2d')][_0x8601('0x47')](_0x4751db['body'],{})[_0x8601('0x25')](respondWithResult(_0x3d5b49,0xc9))[_0x8601('0x46')](handleError(_0x3d5b49,null));};exports[_0x8601('0x24')]=function(_0x2ca114,_0x4b882d){if(_0x2ca114[_0x8601('0x48')]['id']){delete _0x2ca114[_0x8601('0x48')]['id'];}return db[_0x8601('0x2d')][_0x8601('0x49')]({'where':{'id':_0x2ca114[_0x8601('0x41')]['id']}})[_0x8601('0x25')](handleEntityNotFound(_0x4b882d,null))[_0x8601('0x25')](saveUpdates(_0x2ca114[_0x8601('0x48')],null))['then'](respondWithResult(_0x4b882d,null))[_0x8601('0x46')](handleError(_0x4b882d,null));};exports[_0x8601('0x26')]=function(_0x89a6c7,_0x4110fa){return db[_0x8601('0x2d')][_0x8601('0x49')]({'where':{'id':_0x89a6c7[_0x8601('0x41')]['id']}})[_0x8601('0x25')](handleEntityNotFound(_0x4110fa,null))['then'](removeEntity(_0x4110fa,null))['catch'](handleError(_0x4110fa,null));}; \ No newline at end of file +var _0x1448=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x1448,0x140));var _0x8144=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1448[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8144('0x0'));var zipdir=require(_0x8144('0x1'));var jsonpatch=require(_0x8144('0x2'));var rp=require(_0x8144('0x3'));var moment=require('moment');var BPromise=require(_0x8144('0x4'));var Mustache=require(_0x8144('0x5'));var util=require(_0x8144('0x6'));var path=require('path');var sox=require(_0x8144('0x7'));var csv=require(_0x8144('0x8'));var ejs=require(_0x8144('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8144('0xa'));var squel=require(_0x8144('0xb'));var crypto=require(_0x8144('0xc'));var jsforce=require(_0x8144('0xd'));var deskjs=require(_0x8144('0xe'));var toCsv=require(_0x8144('0x8'));var querystring=require(_0x8144('0xf'));var Papa=require(_0x8144('0x10'));var Redis=require(_0x8144('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8144('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8144('0x13'));var logger=require('../../config/logger')(_0x8144('0x14'));var utils=require(_0x8144('0x15'));var config=require(_0x8144('0x16'));var licenseUtil=require(_0x8144('0x17'));var db=require(_0x8144('0x18'))['db'];function respondWithStatusCode(_0xcabbcd,_0x486c96){_0x486c96=_0x486c96||0xcc;return function(_0x2e5885){if(_0x2e5885){return _0xcabbcd['sendStatus'](_0x486c96);}return _0xcabbcd[_0x8144('0x19')](_0x486c96)[_0x8144('0x1a')]();};}function respondWithResult(_0x57e1a7,_0x2f2fa3){_0x2f2fa3=_0x2f2fa3||0xc8;return function(_0x2814d6){if(_0x2814d6){return _0x57e1a7[_0x8144('0x19')](_0x2f2fa3)['json'](_0x2814d6);}};}function respondWithFilteredResult(_0x53a3a9,_0x1d36d3){return function(_0x2dba35){if(_0x2dba35){var _0x5f2942=typeof _0x1d36d3['offset']===_0x8144('0x1b')&&typeof _0x1d36d3[_0x8144('0x1c')]===_0x8144('0x1b');var _0x52ab9f=_0x2dba35[_0x8144('0x1d')];var _0x56d1e5=_0x5f2942?0x0:_0x1d36d3[_0x8144('0x1e')];var _0x5a04d6=_0x5f2942?_0x2dba35[_0x8144('0x1d')]:_0x1d36d3[_0x8144('0x1e')]+_0x1d36d3[_0x8144('0x1c')];var _0x3b58c3;if(_0x5a04d6>=_0x52ab9f){_0x5a04d6=_0x52ab9f;_0x3b58c3=0xc8;}else{_0x3b58c3=0xce;}_0x53a3a9['status'](_0x3b58c3);return _0x53a3a9['set']('Content-Range',_0x56d1e5+'-'+_0x5a04d6+'/'+_0x52ab9f)[_0x8144('0x1f')](_0x2dba35);}return null;};}function patchUpdates(_0x27d313){return function(_0x7ca9cd){try{jsonpatch[_0x8144('0x20')](_0x7ca9cd,_0x27d313,!![]);}catch(_0x49043f){return BPromise[_0x8144('0x21')](_0x49043f);}return _0x7ca9cd[_0x8144('0x22')]();};}function saveUpdates(_0x249abf,_0x464dbf){return function(_0x2aa6a4){if(_0x2aa6a4){return _0x2aa6a4['update'](_0x249abf)['then'](function(_0x334a13){return _0x334a13;});}return null;};}function removeEntity(_0x34a11a,_0x237b14){return function(_0x2f4985){if(_0x2f4985){return _0x2f4985[_0x8144('0x23')]()[_0x8144('0x24')](function(){_0x34a11a[_0x8144('0x19')](0xcc)[_0x8144('0x1a')]();});}};}function handleEntityNotFound(_0x19b49f,_0x31a55e){return function(_0x1a7385){if(!_0x1a7385){_0x19b49f[_0x8144('0x25')](0x194);}return _0x1a7385;};}function handleError(_0xbeaea3,_0x2c5d19){_0x2c5d19=_0x2c5d19||0x1f4;return function(_0x2b44c7){logger[_0x8144('0x26')](_0x2b44c7[_0x8144('0x27')]);if(_0x2b44c7[_0x8144('0x28')]){delete _0x2b44c7[_0x8144('0x28')];}_0xbeaea3[_0x8144('0x19')](_0x2c5d19)['send'](_0x2b44c7);};}exports[_0x8144('0x29')]=function(_0xe3ac2d,_0x40aef7){var _0x19e869={},_0x4538e1={},_0x3fa41d={'count':0x0,'rows':[]};var _0x51f7d8=_[_0x8144('0x2a')](db[_0x8144('0x2b')][_0x8144('0x2c')],function(_0x213f03){return{'name':_0x213f03[_0x8144('0x2d')],'type':_0x213f03[_0x8144('0x2e')]['key']};});_0x4538e1[_0x8144('0x2f')]=_[_0x8144('0x2a')](_0x51f7d8,_0x8144('0x28'));_0x4538e1['query']=_['keys'](_0xe3ac2d[_0x8144('0x30')]);_0x4538e1[_0x8144('0x31')]=_[_0x8144('0x32')](_0x4538e1[_0x8144('0x2f')],_0x4538e1[_0x8144('0x30')]);_0x19e869['attributes']=_['intersection'](_0x4538e1[_0x8144('0x2f')],qs['fields'](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x33')]));_0x19e869[_0x8144('0x34')]=_0x19e869[_0x8144('0x34')][_0x8144('0x35')]?_0x19e869[_0x8144('0x34')]:_0x4538e1[_0x8144('0x2f')];if(!_0xe3ac2d[_0x8144('0x30')][_0x8144('0x36')](_0x8144('0x37'))){_0x19e869[_0x8144('0x1c')]=qs['limit'](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x1c')]);_0x19e869['offset']=qs[_0x8144('0x1e')](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x1e')]);}_0x19e869[_0x8144('0x38')]=qs[_0x8144('0x39')](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x39')]);_0x19e869[_0x8144('0x3a')]=qs[_0x8144('0x31')](_[_0x8144('0x3b')](_0xe3ac2d['query'],_0x4538e1['filters']),_0x51f7d8);if(_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3c')]){_0x19e869[_0x8144('0x3a')]=_[_0x8144('0x3d')](_0x19e869[_0x8144('0x3a')],{'$or':_['map'](_0x51f7d8,function(_0x52988c){if(_0x52988c[_0x8144('0x2e')]!=='VIRTUAL'){var _0x4c8624={};_0x4c8624[_0x52988c['name']]={'$like':'%'+_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3c')]+'%'};return _0x4c8624;}})});}_0x19e869=_['merge']({},_0x19e869,_0xe3ac2d[_0x8144('0x3e')]);var _0x2a9187={'where':_0x19e869[_0x8144('0x3a')]};return db['ZohoField'][_0x8144('0x1d')](_0x2a9187)[_0x8144('0x24')](function(_0x364821){_0x3fa41d[_0x8144('0x1d')]=_0x364821;if(_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3f')]){_0x19e869[_0x8144('0x40')]=[{'all':!![]}];}return db[_0x8144('0x2b')][_0x8144('0x41')](_0x19e869);})[_0x8144('0x24')](function(_0x39fd69){_0x3fa41d[_0x8144('0x42')]=_0x39fd69;return _0x3fa41d;})[_0x8144('0x24')](respondWithFilteredResult(_0x40aef7,_0x19e869))[_0x8144('0x43')](handleError(_0x40aef7,null));};exports[_0x8144('0x44')]=function(_0x2a95cc,_0x1bfa76){var _0x57ee3={'raw':!![],'where':{'id':_0x2a95cc[_0x8144('0x45')]['id']}},_0x1cd4c4={};_0x1cd4c4[_0x8144('0x2f')]=_[_0x8144('0x46')](db['ZohoField'][_0x8144('0x2c')]);_0x1cd4c4['query']=_[_0x8144('0x46')](_0x2a95cc[_0x8144('0x30')]);_0x1cd4c4[_0x8144('0x31')]=_['intersection'](_0x1cd4c4[_0x8144('0x2f')],_0x1cd4c4[_0x8144('0x30')]);_0x57ee3[_0x8144('0x34')]=_[_0x8144('0x32')](_0x1cd4c4['model'],qs['fields'](_0x2a95cc[_0x8144('0x30')][_0x8144('0x33')]));_0x57ee3[_0x8144('0x34')]=_0x57ee3[_0x8144('0x34')][_0x8144('0x35')]?_0x57ee3[_0x8144('0x34')]:_0x1cd4c4['model'];if(_0x2a95cc['query'][_0x8144('0x3f')]){_0x57ee3[_0x8144('0x40')]=[{'all':!![]}];}_0x57ee3=_[_0x8144('0x3d')]({},_0x57ee3,_0x2a95cc[_0x8144('0x3e')]);return db['ZohoField'][_0x8144('0x47')](_0x57ee3)['then'](handleEntityNotFound(_0x1bfa76,null))[_0x8144('0x24')](respondWithResult(_0x1bfa76,null))[_0x8144('0x43')](handleError(_0x1bfa76,null));};exports[_0x8144('0x48')]=function(_0x11df83,_0x22183d){return db['ZohoField'][_0x8144('0x48')](_0x11df83[_0x8144('0x49')],{})[_0x8144('0x24')](respondWithResult(_0x22183d,0xc9))[_0x8144('0x43')](handleError(_0x22183d,null));};exports[_0x8144('0x4a')]=function(_0x215bef,_0x37be38){if(_0x215bef['body']['id']){delete _0x215bef[_0x8144('0x49')]['id'];}return db[_0x8144('0x2b')][_0x8144('0x47')]({'where':{'id':_0x215bef['params']['id']}})[_0x8144('0x24')](handleEntityNotFound(_0x37be38,null))['then'](saveUpdates(_0x215bef[_0x8144('0x49')],null))['then'](respondWithResult(_0x37be38,null))['catch'](handleError(_0x37be38,null));};exports[_0x8144('0x23')]=function(_0x2ae52e,_0x3c0385){return db[_0x8144('0x2b')][_0x8144('0x47')]({'where':{'id':_0x2ae52e[_0x8144('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c0385,null))['then'](removeEntity(_0x3c0385,null))[_0x8144('0x43')](handleError(_0x3c0385,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ab9a8f3..2f030ac 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 _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x34cff6,_0x2cda92){var _0x2c8155=function(_0x325edb){while(--_0x325edb){_0x34cff6['push'](_0x34cff6['shift']());}};_0x2c8155(++_0x2cda92);}(_0x0424,0x159));var _0x4042=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x0424[_0x252d7e];return _0x2afaba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x588811,_0x2d5f0b){var _0x431309=function(_0xa2cbec){while(--_0xa2cbec){_0x588811['push'](_0x588811['shift']());}};_0x431309(++_0x2d5f0b);}(_0x187d,0x93));var _0xd187=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x187d[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xd'),_0xd187('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 7a18728..f180b04 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 _0xd1aa=['request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xd1aa,0x1af));var _0xad1a=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xd1aa[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0xad1a('0x0'));var util=require(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var BPromise=require(_0xad1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xad1a('0x4'))(_0xad1a('0x5'));var config=require(_0xad1a('0x6'));var jayson=require(_0xad1a('0x7'));var client=jayson['client'][_0xad1a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x547e92,_0x516a2e,_0x3cfbfa){return new BPromise(function(_0x497b5e,_0x17ce76){return client[_0xad1a('0x9')](_0x547e92,_0x3cfbfa)[_0xad1a('0xa')](function(_0x31880b){logger['info'](_0xad1a('0xb'),_0x516a2e,_0xad1a('0xc'));logger[_0xad1a('0xd')](_0xad1a('0xe'),_0x516a2e,_0xad1a('0xc'),JSON[_0xad1a('0xf')](_0x31880b));if(_0x31880b[_0xad1a('0x10')]){if(_0x31880b[_0xad1a('0x10')][_0xad1a('0x11')]===0x1f4){logger['error'](_0xad1a('0xb'),_0x516a2e,_0x31880b['error'][_0xad1a('0x12')]);return _0x17ce76(_0x31880b['error'][_0xad1a('0x12')]);}logger[_0xad1a('0x10')](_0xad1a('0xb'),_0x516a2e,_0x31880b[_0xad1a('0x10')]['message']);return _0x497b5e(_0x31880b[_0xad1a('0x10')][_0xad1a('0x12')]);}else{logger[_0xad1a('0x13')](_0xad1a('0xb'),_0x516a2e,_0xad1a('0xc'));_0x497b5e(_0x31880b[_0xad1a('0x14')]['message']);}})[_0xad1a('0x15')](function(_0x4c115f){logger[_0xad1a('0x10')](_0xad1a('0xb'),_0x516a2e,_0x4c115f);_0x17ce76(_0x4c115f);});});} \ No newline at end of file +var _0x164f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../config/utils'];(function(_0x366455,_0x45dd1d){var _0x11b025=function(_0x405777){while(--_0x405777){_0x366455['push'](_0x366455['shift']());}};_0x11b025(++_0x45dd1d);}(_0x164f,0x15c));var _0xf164=function(_0x147aef,_0x548f7b){_0x147aef=_0x147aef-0x0;var _0x125b35=_0x164f[_0x147aef];return _0x125b35;};'use strict';var _=require(_0xf164('0x0'));var util=require(_0xf164('0x1'));var moment=require(_0xf164('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf164('0x3'));var logger=require(_0xf164('0x4'))(_0xf164('0x5'));var config=require(_0xf164('0x6'));var jayson=require(_0xf164('0x7'));var client=jayson[_0xf164('0x8')][_0xf164('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55c606,_0x2f712e,_0x102fce){return new BPromise(function(_0x5cf61c,_0x2d77be){return client[_0xf164('0xa')](_0x55c606,_0x102fce)[_0xf164('0xb')](function(_0x27156e){logger[_0xf164('0xc')](_0xf164('0xd'),_0x2f712e,_0xf164('0xe'));logger['debug'](_0xf164('0xf'),_0x2f712e,_0xf164('0xe'),JSON[_0xf164('0x10')](_0x27156e));if(_0x27156e[_0xf164('0x11')]){if(_0x27156e[_0xf164('0x11')][_0xf164('0x12')]===0x1f4){logger[_0xf164('0x11')](_0xf164('0xd'),_0x2f712e,_0x27156e[_0xf164('0x11')]['message']);return _0x2d77be(_0x27156e['error'][_0xf164('0x13')]);}logger[_0xf164('0x11')](_0xf164('0xd'),_0x2f712e,_0x27156e[_0xf164('0x11')][_0xf164('0x13')]);return _0x5cf61c(_0x27156e[_0xf164('0x11')][_0xf164('0x13')]);}else{logger['info'](_0xf164('0xd'),_0x2f712e,'request\x20sent');_0x5cf61c(_0x27156e[_0xf164('0x14')]['message']);}})[_0xf164('0x15')](function(_0x2312f1){logger[_0xf164('0x11')](_0xf164('0xd'),_0x2f712e,_0x2312f1);_0x2d77be(_0x2312f1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 038b39c..0c64ac2 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5022f1,_0x25f497){var _0x545b48=function(_0x5a64b3){while(--_0x5a64b3){_0x5022f1['push'](_0x5022f1['shift']());}};_0x545b48(++_0x25f497);}(_0x70e0,0x17b));var _0x070e=function(_0x30db75,_0x22bddd){_0x30db75=_0x30db75-0x0;var _0x28b887=_0x70e0[_0x30db75];return _0x28b887;};'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(_0x5012f0,_0x177f7d){var _0x2c451e=function(_0x420627){while(--_0x420627){_0x5012f0['push'](_0x5012f0['shift']());}};_0x2c451e(++_0x177f7d);}(_0xe706,0xa3));var _0x6e70=function(_0x3984a6,_0x4adaba){_0x3984a6=_0x3984a6-0x0;var _0x2cc75f=_0xe706[_0x3984a6];return _0x2cc75f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9168b73..9049e1b 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 _0x159b=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x5a6d3b,_0x15a93b){var _0x3aaf17=function(_0xc74bd7){while(--_0xc74bd7){_0x5a6d3b['push'](_0x5a6d3b['shift']());}};_0x3aaf17(++_0x15a93b);}(_0x159b,0x181));var _0xb159=function(_0x54a90e,_0x109563){_0x54a90e=_0x54a90e-0x0;var _0x4bf667=_0x159b[_0x54a90e];return _0x4bf667;};'use strict';var Sequelize=require(_0xb159('0x0'));module[_0xb159('0x1')]={'name':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'unique':_0xb159('0x3')},'version':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'unique':_0xb159('0x3')},'main':{'type':Sequelize[_0xb159('0x2')],'defaultValue':_0xb159('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xb159('0x2')]},'type':{'type':Sequelize[_0xb159('0x2')]},'size':{'type':Sequelize[_0xb159('0x5')]},'active':{'type':Sequelize[_0xb159('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xb159('0x2')]},'state':{'type':Sequelize[_0xb159('0x2')],'unique':_0xb159('0x7')},'description':{'type':Sequelize[_0xb159('0x2')]},'title':{'type':Sequelize[_0xb159('0x2')]},'remoteUri':{'type':Sequelize[_0xb159('0x2')]},'link':{'type':Sequelize[_0xb159('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4849=['exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x5aa141,_0x2d6e3a){var _0x446d2f=function(_0x11bb05){while(--_0x11bb05){_0x5aa141['push'](_0x5aa141['shift']());}};_0x446d2f(++_0x2d6e3a);}(_0x4849,0x181));var _0x9484=function(_0x358394,_0x4406a2){_0x358394=_0x358394-0x0;var _0x2d6bec=_0x4849[_0x358394];return _0x2d6bec;};'use strict';var Sequelize=require('sequelize');module[_0x9484('0x0')]={'name':{'type':Sequelize[_0x9484('0x1')],'allowNull':![],'unique':_0x9484('0x2')},'version':{'type':Sequelize[_0x9484('0x1')],'allowNull':![],'unique':_0x9484('0x2')},'main':{'type':Sequelize[_0x9484('0x1')],'defaultValue':_0x9484('0x3')},'filename':{'type':Sequelize[_0x9484('0x1')]},'path':{'type':Sequelize[_0x9484('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x9484('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9484('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x9484('0x1')]},'title':{'type':Sequelize[_0x9484('0x1')]},'remoteUri':{'type':Sequelize[_0x9484('0x1')]},'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 f37a18e..9f3dbce 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(_0x1a12f9,_0x26e0bd){var _0x3f6024=function(_0x97c61f){while(--_0x97c61f){_0x1a12f9['push'](_0x1a12f9['shift']());}};_0x3f6024(++_0x26e0bd);}(_0x4975,0x86));var _0x5497=function(_0x4e9da5,_0x35b077){_0x4e9da5=_0x4e9da5-0x0;var _0x47a626=_0x4975[_0x4e9da5];return _0x47a626;};'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 _0x2a07=['name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x2a07,0x74));var _0x72a0=function(_0xe22f40,_0x3331e2){_0xe22f40=_0xe22f40-0x0;var _0x226c12=_0x2a07[_0xe22f40];return _0x226c12;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['Integration'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['Integration']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 50c7a53..8d390c9 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 _0xa21e=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa21e,0x1ec));var _0xea21=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xa21e[_0x57d13b];return _0x467696;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var logger=require(_0xea21('0x2'))(_0xea21('0x3'));var moment=require('moment');var BPromise=require(_0xea21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea21('0x5'));var rimraf=require(_0xea21('0x6'));var config=require(_0xea21('0x7'));var attributes=require(_0xea21('0x8'));module[_0xea21('0x9')]=function(_0x44def0,_0x205bfc){return _0x44def0[_0xea21('0xa')]('Integration',attributes,{'tableName':_0xea21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa955=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash'];(function(_0x2d88de,_0x4346b7){var _0x410a8c=function(_0x26f6d9){while(--_0x26f6d9){_0x2d88de['push'](_0x2d88de['shift']());}};_0x410a8c(++_0x4346b7);}(_0xa955,0xfc));var _0x5a95=function(_0x508c93,_0x4b53c4){_0x508c93=_0x508c93-0x0;var _0x3e9a86=_0xa955[_0x508c93];return _0x3e9a86;};'use strict';var _=require(_0x5a95('0x0'));var util=require('util');var logger=require(_0x5a95('0x1'))('api');var moment=require(_0x5a95('0x2'));var BPromise=require(_0x5a95('0x3'));var rp=require(_0x5a95('0x4'));var fs=require('fs');var path=require(_0x5a95('0x5'));var rimraf=require('rimraf');var config=require(_0x5a95('0x6'));var attributes=require(_0x5a95('0x7'));module[_0x5a95('0x8')]=function(_0x1ef654,_0x2542ba){return _0x1ef654['define'](_0x5a95('0x9'),attributes,{'tableName':_0x5a95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 28f41bb..ceedd9a 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 _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x4c3350,_0x1be49){var _0x394d5d=function(_0x485e78){while(--_0x485e78){_0x4c3350['push'](_0x4c3350['shift']());}};_0x394d5d(++_0x1be49);}(_0x66fa,0x117));var _0xa66f=function(_0x345922,_0x12104d){_0x345922=_0x345922-0x0;var _0x4509c1=_0x66fa[_0x345922];return _0x4509c1;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4975,0x86));var _0x5497=function(_0x5ecbbf,_0xc9291f){_0x5ecbbf=_0x5ecbbf-0x0;var _0x5d1f26=_0x4975[_0x5ecbbf];return _0x5d1f26;};'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')]('Integration,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9a066ca..15de16e 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 _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xd943,0x15d));var _0x3d94=function(_0x5d010c,_0x143b93){_0x5d010c=_0x5d010c-0x0;var _0x5cf7d9=_0xd943[_0x5d010c];return _0x5cf7d9;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2128c4e..4cb85ef 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 _0xa68c=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x56ab38,_0x5666e3){var _0x2df5b8=function(_0x156026){while(--_0x156026){_0x56ab38['push'](_0x56ab38['shift']());}};_0x2df5b8(++_0x5666e3);}(_0xa68c,0x187));var _0xca68=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa68c[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0xca68('0x0'));module[_0xca68('0x1')]={'integration':{'type':Sequelize[_0xca68('0x2')]},'eventChannel':{'type':Sequelize[_0xca68('0x2')]},'exitStatus':{'type':Sequelize[_0xca68('0x2')]},'ticketId':{'type':Sequelize[_0xca68('0x2')]},'integrationId':{'type':Sequelize[_0xca68('0x3')]},'contacts':{'type':Sequelize[_0xca68('0x2')]},'uniqueid':{'type':Sequelize[_0xca68('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xca68('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xca68('0x2')]},'agentcalledAt':{'type':Sequelize[_0xca68('0x4')]},'agentconnectAt':{'type':Sequelize[_0xca68('0x4')]},'holdtime':{'type':Sequelize[_0xca68('0x3')]},'agentcomplete':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xca68('0x4')]},'talktime':{'type':Sequelize[_0xca68('0x3')]},'agentacw':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xca68('0x3')]},'reason':{'type':Sequelize[_0xca68('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xca68('0x4')]},'agentdump':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xca68('0x2')]},'channelstate':{'type':Sequelize[_0xca68('0x3')]},'channelstatedesc':{'type':Sequelize[_0xca68('0x2')]},'connectedlinenum':{'type':Sequelize[_0xca68('0x2')]},'connectedlinename':{'type':Sequelize[_0xca68('0x2')]},'language':{'type':Sequelize[_0xca68('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xca68('0x2')]},'exten':{'type':Sequelize[_0xca68('0x2')]},'priority':{'type':Sequelize[_0xca68('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xca68('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xca68('0x2')]},'destcalleridname':{'type':Sequelize[_0xca68('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xca68('0x2')]},'destaccountcode':{'type':Sequelize[_0xca68('0x2')]},'destcontext':{'type':Sequelize[_0xca68('0x2')]},'destexten':{'type':Sequelize[_0xca68('0x2')]},'destpriority':{'type':Sequelize[_0xca68('0x2')]},'destuniqueid':{'type':Sequelize[_0xca68('0x2')]},'messageId':{'type':Sequelize[_0xca68('0x2')]},'inReplyTo':{'type':Sequelize[_0xca68('0x2')]},'subject':{'type':Sequelize[_0xca68('0x2')]},'from':{'type':Sequelize[_0xca68('0x2')]},'to':{'type':Sequelize[_0xca68('0x2')]},'cc':{'type':Sequelize[_0xca68('0x2')]},'attachment':{'type':Sequelize[_0xca68('0x6')]},'html':{'type':Sequelize[_0xca68('0x6')]},'text':{'type':Sequelize[_0xca68('0x6')]},'status':{'type':Sequelize[_0xca68('0x7')]('SENT',_0xca68('0x8'),'RECEIVED',_0xca68('0x9'))},'url':{'type':Sequelize[_0xca68('0x2')]},'app':{'type':Sequelize[_0xca68('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfec6=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3d9312,_0x3363fc){var _0x3a0a42=function(_0x58cad2){while(--_0x58cad2){_0x3d9312['push'](_0x3d9312['shift']());}};_0x3a0a42(++_0x3363fc);}(_0xfec6,0x1aa));var _0x6fec=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfec6[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x6fec('0x0'));module[_0x6fec('0x1')]={'integration':{'type':Sequelize[_0x6fec('0x2')]},'eventChannel':{'type':Sequelize[_0x6fec('0x2')]},'exitStatus':{'type':Sequelize[_0x6fec('0x2')]},'ticketId':{'type':Sequelize[_0x6fec('0x2')]},'integrationId':{'type':Sequelize[_0x6fec('0x3')]},'contacts':{'type':Sequelize[_0x6fec('0x2')]},'uniqueid':{'type':Sequelize[_0x6fec('0x2')]},'calleridnum':{'type':Sequelize[_0x6fec('0x2')]},'calleridname':{'type':Sequelize[_0x6fec('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x6fec('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6fec('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6fec('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6fec('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6fec('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6fec('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6fec('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6fec('0x4')]},'agentdump':{'type':Sequelize[_0x6fec('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6fec('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x6fec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6fec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6fec('0x2')]},'language':{'type':Sequelize[_0x6fec('0x2')]},'accountcode':{'type':Sequelize[_0x6fec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6fec('0x2')]},'priority':{'type':Sequelize[_0x6fec('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x6fec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6fec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6fec('0x2')]},'destlanguage':{'type':Sequelize[_0x6fec('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x6fec('0x2')]},'destexten':{'type':Sequelize[_0x6fec('0x2')]},'destpriority':{'type':Sequelize[_0x6fec('0x2')]},'destuniqueid':{'type':Sequelize[_0x6fec('0x2')]},'messageId':{'type':Sequelize[_0x6fec('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x6fec('0x2')]},'from':{'type':Sequelize[_0x6fec('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6fec('0x2')]},'attachment':{'type':Sequelize[_0x6fec('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6fec('0x6')]},'status':{'type':Sequelize[_0x6fec('0x7')](_0x6fec('0x8'),_0x6fec('0x9'),_0x6fec('0xa'),_0x6fec('0xb'))},'url':{'type':Sequelize[_0x6fec('0x2')]},'app':{'type':Sequelize[_0x6fec('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6fec('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 749307e..7a0d2ca 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 _0xb653=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','IntegrationReport','include','findAll','catch','params','includeAll','find','create','body','update','destroy','describe','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys'];(function(_0xd7ecb1,_0x430db6){var _0x42e7d4=function(_0x5487a0){while(--_0x5487a0){_0xd7ecb1['push'](_0xd7ecb1['shift']());}};_0x42e7d4(++_0x430db6);}(_0xb653,0x134));var _0x3b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb653[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b65('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b65('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3b65('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b65('0x3'));var sox=require(_0x3b65('0x4'));var csv=require(_0x3b65('0x5'));var ejs=require(_0x3b65('0x6'));var fs=require('fs');var fs_extra=require(_0x3b65('0x7'));var _=require(_0x3b65('0x8'));var squel=require('squel');var crypto=require(_0x3b65('0x9'));var jsforce=require(_0x3b65('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b65('0xb'));var Papa=require('papaparse');var Redis=require(_0x3b65('0xc'));var authService=require(_0x3b65('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3b65('0xe'));var hardwareService=require(_0x3b65('0xf'));var logger=require(_0x3b65('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3b65('0x11'));var licenseUtil=require(_0x3b65('0x12'));var db=require(_0x3b65('0x13'))['db'];function respondWithStatusCode(_0x564409,_0x5088dd){_0x5088dd=_0x5088dd||0xcc;return function(_0x422f04){if(_0x422f04){return _0x564409[_0x3b65('0x14')](_0x5088dd);}return _0x564409[_0x3b65('0x15')](_0x5088dd)[_0x3b65('0x16')]();};}function respondWithResult(_0x196739,_0x491ae7){_0x491ae7=_0x491ae7||0xc8;return function(_0x450189){if(_0x450189){return _0x196739[_0x3b65('0x15')](_0x491ae7)['json'](_0x450189);}};}function respondWithFilteredResult(_0x1b7faf,_0x2ee335){return function(_0x1f9f7e){if(_0x1f9f7e){var _0x1b13b4=typeof _0x2ee335['offset']==='undefined'&&typeof _0x2ee335['limit']==='undefined';var _0x514dc6=_0x1f9f7e[_0x3b65('0x17')];var _0x86f8f8=_0x1b13b4?0x0:_0x2ee335['offset'];var _0x2bbe0a=_0x1b13b4?_0x1f9f7e[_0x3b65('0x17')]:_0x2ee335[_0x3b65('0x18')]+_0x2ee335['limit'];var _0x1e17cb;if(_0x2bbe0a>=_0x514dc6){_0x2bbe0a=_0x514dc6;_0x1e17cb=0xc8;}else{_0x1e17cb=0xce;}_0x1b7faf['status'](_0x1e17cb);return _0x1b7faf[_0x3b65('0x19')](_0x3b65('0x1a'),_0x86f8f8+'-'+_0x2bbe0a+'/'+_0x514dc6)[_0x3b65('0x1b')](_0x1f9f7e);}return null;};}function patchUpdates(_0x42a41e){return function(_0x326173){try{jsonpatch[_0x3b65('0x1c')](_0x326173,_0x42a41e,!![]);}catch(_0x521992){return BPromise[_0x3b65('0x1d')](_0x521992);}return _0x326173[_0x3b65('0x1e')]();};}function saveUpdates(_0x519d5c,_0x529f5a){return function(_0x3a1844){if(_0x3a1844){return _0x3a1844['update'](_0x519d5c)[_0x3b65('0x1f')](function(_0x12bad6){return _0x12bad6;});}return null;};}function removeEntity(_0x5835a7,_0x4a2a68){return function(_0x57c167){if(_0x57c167){return _0x57c167['destroy']()['then'](function(){_0x5835a7[_0x3b65('0x15')](0xcc)[_0x3b65('0x16')]();});}};}function handleEntityNotFound(_0x2ebd12,_0x3d884f){return function(_0x2961d2){if(!_0x2961d2){_0x2ebd12['sendStatus'](0x194);}return _0x2961d2;};}function handleError(_0x2c20e2,_0x4c38c1){_0x4c38c1=_0x4c38c1||0x1f4;return function(_0xfc941f){logger[_0x3b65('0x20')](_0xfc941f[_0x3b65('0x21')]);if(_0xfc941f[_0x3b65('0x22')]){delete _0xfc941f[_0x3b65('0x22')];}_0x2c20e2['status'](_0x4c38c1)[_0x3b65('0x23')](_0xfc941f);};}exports['index']=function(_0x177023,_0x3dad21){var _0x217784={},_0x36f4ae={},_0x96e272={'count':0x0,'rows':[]};var _0x4fe421=_['map'](db['IntegrationReport'][_0x3b65('0x24')],function(_0x23db1d){return{'name':_0x23db1d[_0x3b65('0x25')],'type':_0x23db1d[_0x3b65('0x26')][_0x3b65('0x27')]};});_0x36f4ae['model']=_['map'](_0x4fe421,_0x3b65('0x22'));_0x36f4ae[_0x3b65('0x28')]=_[_0x3b65('0x29')](_0x177023[_0x3b65('0x28')]);_0x36f4ae['filters']=_[_0x3b65('0x2a')](_0x36f4ae[_0x3b65('0x2b')],_0x36f4ae[_0x3b65('0x28')]);_0x217784[_0x3b65('0x2c')]=_[_0x3b65('0x2a')](_0x36f4ae['model'],qs[_0x3b65('0x2d')](_0x177023['query'][_0x3b65('0x2d')]));_0x217784[_0x3b65('0x2c')]=_0x217784['attributes'][_0x3b65('0x2e')]?_0x217784['attributes']:_0x36f4ae['model'];if(!_0x177023[_0x3b65('0x28')][_0x3b65('0x2f')](_0x3b65('0x30'))){_0x217784[_0x3b65('0x31')]=qs[_0x3b65('0x31')](_0x177023['query'][_0x3b65('0x31')]);_0x217784[_0x3b65('0x18')]=qs[_0x3b65('0x18')](_0x177023[_0x3b65('0x28')]['offset']);}_0x217784[_0x3b65('0x32')]=qs[_0x3b65('0x33')](_0x177023[_0x3b65('0x28')][_0x3b65('0x33')]);_0x217784['where']=qs[_0x3b65('0x34')](_[_0x3b65('0x35')](_0x177023[_0x3b65('0x28')],_0x36f4ae[_0x3b65('0x34')]),_0x4fe421);if(_0x177023[_0x3b65('0x28')][_0x3b65('0x36')]){_0x217784[_0x3b65('0x37')]=_[_0x3b65('0x38')](_0x217784['where'],{'$or':_['map'](_0x4fe421,function(_0x3b0d0a){if(_0x3b0d0a[_0x3b65('0x26')]!=='VIRTUAL'){var _0x496fdf={};_0x496fdf[_0x3b0d0a[_0x3b65('0x22')]]={'$like':'%'+_0x177023['query'][_0x3b65('0x36')]+'%'};return _0x496fdf;}})});}_0x217784=_[_0x3b65('0x38')]({},_0x217784,_0x177023[_0x3b65('0x39')]);var _0x2d0124={'where':_0x217784[_0x3b65('0x37')]};return db[_0x3b65('0x3a')][_0x3b65('0x17')](_0x2d0124)[_0x3b65('0x1f')](function(_0x11c4e6){_0x96e272['count']=_0x11c4e6;if(_0x177023[_0x3b65('0x28')]['includeAll']){_0x217784[_0x3b65('0x3b')]=[{'all':!![]}];}return db[_0x3b65('0x3a')][_0x3b65('0x3c')](_0x217784);})[_0x3b65('0x1f')](function(_0x3054c4){_0x96e272['rows']=_0x3054c4;return _0x96e272;})['then'](respondWithFilteredResult(_0x3dad21,_0x217784))[_0x3b65('0x3d')](handleError(_0x3dad21,null));};exports['show']=function(_0x1264e3,_0x5994db){var _0x56168f={'raw':![],'where':{'id':_0x1264e3[_0x3b65('0x3e')]['id']}},_0x2d17c9={};_0x2d17c9['model']=_[_0x3b65('0x29')](db[_0x3b65('0x3a')]['rawAttributes']);_0x2d17c9[_0x3b65('0x28')]=_['keys'](_0x1264e3[_0x3b65('0x28')]);_0x2d17c9[_0x3b65('0x34')]=_[_0x3b65('0x2a')](_0x2d17c9[_0x3b65('0x2b')],_0x2d17c9['query']);_0x56168f[_0x3b65('0x2c')]=_[_0x3b65('0x2a')](_0x2d17c9[_0x3b65('0x2b')],qs[_0x3b65('0x2d')](_0x1264e3[_0x3b65('0x28')]['fields']));_0x56168f['attributes']=_0x56168f[_0x3b65('0x2c')]['length']?_0x56168f[_0x3b65('0x2c')]:_0x2d17c9[_0x3b65('0x2b')];if(_0x1264e3[_0x3b65('0x28')][_0x3b65('0x3f')]){_0x56168f[_0x3b65('0x3b')]=[{'all':!![]}];}_0x56168f=_[_0x3b65('0x38')]({},_0x56168f,_0x1264e3[_0x3b65('0x39')]);return db[_0x3b65('0x3a')][_0x3b65('0x40')](_0x56168f)[_0x3b65('0x1f')](handleEntityNotFound(_0x5994db,null))[_0x3b65('0x1f')](respondWithResult(_0x5994db,null))[_0x3b65('0x3d')](handleError(_0x5994db,null));};exports[_0x3b65('0x41')]=function(_0x45d2de,_0x21a042){return db[_0x3b65('0x3a')][_0x3b65('0x41')](_0x45d2de[_0x3b65('0x42')],{})[_0x3b65('0x1f')](respondWithResult(_0x21a042,0xc9))[_0x3b65('0x3d')](handleError(_0x21a042,null));};exports[_0x3b65('0x43')]=function(_0x2199a4,_0x17db70){if(_0x2199a4[_0x3b65('0x42')]['id']){delete _0x2199a4[_0x3b65('0x42')]['id'];}return db[_0x3b65('0x3a')][_0x3b65('0x40')]({'where':{'id':_0x2199a4[_0x3b65('0x3e')]['id']}})[_0x3b65('0x1f')](handleEntityNotFound(_0x17db70,null))[_0x3b65('0x1f')](saveUpdates(_0x2199a4[_0x3b65('0x42')],null))[_0x3b65('0x1f')](respondWithResult(_0x17db70,null))[_0x3b65('0x3d')](handleError(_0x17db70,null));};exports[_0x3b65('0x44')]=function(_0x2e63ec,_0x4e0b6a){return db[_0x3b65('0x3a')][_0x3b65('0x40')]({'where':{'id':_0x2e63ec[_0x3b65('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e0b6a,null))[_0x3b65('0x1f')](removeEntity(_0x4e0b6a,null))[_0x3b65('0x3d')](handleError(_0x4e0b6a,null));};exports[_0x3b65('0x45')]=function(_0xe4b7cc,_0x641549){return db[_0x3b65('0x3a')]['describe']()['then'](respondWithResult(_0x641549,null))[_0x3b65('0x3d')](handleError(_0x641549,null));}; \ No newline at end of file +var _0x9949=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','create','update','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0xd5ed38,_0x1a5ffe){var _0x57ac23=function(_0x156a2d){while(--_0x156a2d){_0xd5ed38['push'](_0xd5ed38['shift']());}};_0x57ac23(++_0x1a5ffe);}(_0x9949,0x127));var _0x9994=function(_0x5199ba,_0x1cc536){_0x5199ba=_0x5199ba-0x0;var _0xdb80f1=_0x9949[_0x5199ba];return _0xdb80f1;};'use strict';var emlformat=require(_0x9994('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9994('0x1'));var jsonpatch=require(_0x9994('0x2'));var rp=require('request-promise');var moment=require(_0x9994('0x3'));var BPromise=require(_0x9994('0x4'));var Mustache=require(_0x9994('0x5'));var util=require(_0x9994('0x6'));var path=require(_0x9994('0x7'));var sox=require(_0x9994('0x8'));var csv=require(_0x9994('0x9'));var ejs=require(_0x9994('0xa'));var fs=require('fs');var fs_extra=require(_0x9994('0xb'));var _=require('lodash');var squel=require(_0x9994('0xc'));var crypto=require(_0x9994('0xd'));var jsforce=require(_0x9994('0xe'));var deskjs=require(_0x9994('0xf'));var toCsv=require(_0x9994('0x9'));var querystring=require('querystring');var Papa=require(_0x9994('0x10'));var Redis=require('ioredis');var authService=require(_0x9994('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9994('0x12'));var hardwareService=require(_0x9994('0x13'));var logger=require(_0x9994('0x14'))('api');var utils=require(_0x9994('0x15'));var config=require(_0x9994('0x16'));var licenseUtil=require(_0x9994('0x17'));var db=require(_0x9994('0x18'))['db'];function respondWithStatusCode(_0x1d0162,_0x433fa2){_0x433fa2=_0x433fa2||0xcc;return function(_0x39ab51){if(_0x39ab51){return _0x1d0162['sendStatus'](_0x433fa2);}return _0x1d0162[_0x9994('0x19')](_0x433fa2)[_0x9994('0x1a')]();};}function respondWithResult(_0x580876,_0x352fdb){_0x352fdb=_0x352fdb||0xc8;return function(_0x51a576){if(_0x51a576){return _0x580876['status'](_0x352fdb)[_0x9994('0x1b')](_0x51a576);}};}function respondWithFilteredResult(_0x404e82,_0x43ec30){return function(_0x4b09c7){if(_0x4b09c7){var _0x557399=typeof _0x43ec30[_0x9994('0x1c')]===_0x9994('0x1d')&&typeof _0x43ec30[_0x9994('0x1e')]==='undefined';var _0x3fe7cd=_0x4b09c7[_0x9994('0x1f')];var _0x5bbc3a=_0x557399?0x0:_0x43ec30['offset'];var _0x25b19a=_0x557399?_0x4b09c7[_0x9994('0x1f')]:_0x43ec30[_0x9994('0x1c')]+_0x43ec30['limit'];var _0x5739a5;if(_0x25b19a>=_0x3fe7cd){_0x25b19a=_0x3fe7cd;_0x5739a5=0xc8;}else{_0x5739a5=0xce;}_0x404e82['status'](_0x5739a5);return _0x404e82[_0x9994('0x20')](_0x9994('0x21'),_0x5bbc3a+'-'+_0x25b19a+'/'+_0x3fe7cd)[_0x9994('0x1b')](_0x4b09c7);}return null;};}function patchUpdates(_0x3abfa2){return function(_0x199fb4){try{jsonpatch[_0x9994('0x22')](_0x199fb4,_0x3abfa2,!![]);}catch(_0x2e5f72){return BPromise[_0x9994('0x23')](_0x2e5f72);}return _0x199fb4[_0x9994('0x24')]();};}function saveUpdates(_0x1e957a,_0x636aeb){return function(_0x14dbcd){if(_0x14dbcd){return _0x14dbcd['update'](_0x1e957a)[_0x9994('0x25')](function(_0x30e607){return _0x30e607;});}return null;};}function removeEntity(_0x2f885f,_0x2a37f7){return function(_0x50b143){if(_0x50b143){return _0x50b143['destroy']()[_0x9994('0x25')](function(){_0x2f885f[_0x9994('0x19')](0xcc)[_0x9994('0x1a')]();});}};}function handleEntityNotFound(_0x136c32,_0x75147f){return function(_0x9b1127){if(!_0x9b1127){_0x136c32[_0x9994('0x26')](0x194);}return _0x9b1127;};}function handleError(_0x257ad3,_0x5af77c){_0x5af77c=_0x5af77c||0x1f4;return function(_0x4b5147){logger[_0x9994('0x27')](_0x4b5147[_0x9994('0x28')]);if(_0x4b5147[_0x9994('0x29')]){delete _0x4b5147[_0x9994('0x29')];}_0x257ad3[_0x9994('0x19')](_0x5af77c)['send'](_0x4b5147);};}exports['index']=function(_0x1127fe,_0x444012){var _0x3c27d1={},_0x123d91={},_0x34a038={'count':0x0,'rows':[]};var _0x4cda30=_[_0x9994('0x2a')](db[_0x9994('0x2b')][_0x9994('0x2c')],function(_0x2ccc12){return{'name':_0x2ccc12[_0x9994('0x2d')],'type':_0x2ccc12[_0x9994('0x2e')][_0x9994('0x2f')]};});_0x123d91[_0x9994('0x30')]=_[_0x9994('0x2a')](_0x4cda30,_0x9994('0x29'));_0x123d91[_0x9994('0x31')]=_[_0x9994('0x32')](_0x1127fe[_0x9994('0x31')]);_0x123d91[_0x9994('0x33')]=_['intersection'](_0x123d91[_0x9994('0x30')],_0x123d91['query']);_0x3c27d1[_0x9994('0x34')]=_[_0x9994('0x35')](_0x123d91[_0x9994('0x30')],qs[_0x9994('0x36')](_0x1127fe[_0x9994('0x31')]['fields']));_0x3c27d1[_0x9994('0x34')]=_0x3c27d1[_0x9994('0x34')][_0x9994('0x37')]?_0x3c27d1['attributes']:_0x123d91[_0x9994('0x30')];if(!_0x1127fe[_0x9994('0x31')][_0x9994('0x38')](_0x9994('0x39'))){_0x3c27d1[_0x9994('0x1e')]=qs[_0x9994('0x1e')](_0x1127fe[_0x9994('0x31')][_0x9994('0x1e')]);_0x3c27d1['offset']=qs[_0x9994('0x1c')](_0x1127fe[_0x9994('0x31')][_0x9994('0x1c')]);}_0x3c27d1[_0x9994('0x3a')]=qs['sort'](_0x1127fe[_0x9994('0x31')][_0x9994('0x3b')]);_0x3c27d1[_0x9994('0x3c')]=qs[_0x9994('0x33')](_[_0x9994('0x3d')](_0x1127fe['query'],_0x123d91[_0x9994('0x33')]),_0x4cda30);if(_0x1127fe[_0x9994('0x31')][_0x9994('0x3e')]){_0x3c27d1[_0x9994('0x3c')]=_[_0x9994('0x3f')](_0x3c27d1[_0x9994('0x3c')],{'$or':_[_0x9994('0x2a')](_0x4cda30,function(_0x41295b){if(_0x41295b[_0x9994('0x2e')]!==_0x9994('0x40')){var _0x5d770b={};_0x5d770b[_0x41295b[_0x9994('0x29')]]={'$like':'%'+_0x1127fe[_0x9994('0x31')][_0x9994('0x3e')]+'%'};return _0x5d770b;}})});}_0x3c27d1=_[_0x9994('0x3f')]({},_0x3c27d1,_0x1127fe[_0x9994('0x41')]);var _0x180818={'where':_0x3c27d1[_0x9994('0x3c')]};return db['IntegrationReport'][_0x9994('0x1f')](_0x180818)[_0x9994('0x25')](function(_0x5ec5a7){_0x34a038['count']=_0x5ec5a7;if(_0x1127fe[_0x9994('0x31')]['includeAll']){_0x3c27d1[_0x9994('0x42')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x3c27d1);})['then'](function(_0x11bbc9){_0x34a038[_0x9994('0x43')]=_0x11bbc9;return _0x34a038;})[_0x9994('0x25')](respondWithFilteredResult(_0x444012,_0x3c27d1))[_0x9994('0x44')](handleError(_0x444012,null));};exports[_0x9994('0x45')]=function(_0x2a3bae,_0x115091){var _0x1d1687={'raw':![],'where':{'id':_0x2a3bae['params']['id']}},_0xc41583={};_0xc41583[_0x9994('0x30')]=_['keys'](db[_0x9994('0x2b')][_0x9994('0x2c')]);_0xc41583[_0x9994('0x31')]=_[_0x9994('0x32')](_0x2a3bae['query']);_0xc41583['filters']=_[_0x9994('0x35')](_0xc41583['model'],_0xc41583[_0x9994('0x31')]);_0x1d1687[_0x9994('0x34')]=_['intersection'](_0xc41583['model'],qs[_0x9994('0x36')](_0x2a3bae[_0x9994('0x31')][_0x9994('0x36')]));_0x1d1687[_0x9994('0x34')]=_0x1d1687[_0x9994('0x34')][_0x9994('0x37')]?_0x1d1687[_0x9994('0x34')]:_0xc41583['model'];if(_0x2a3bae[_0x9994('0x31')]['includeAll']){_0x1d1687[_0x9994('0x42')]=[{'all':!![]}];}_0x1d1687=_[_0x9994('0x3f')]({},_0x1d1687,_0x2a3bae['options']);return db[_0x9994('0x2b')]['find'](_0x1d1687)['then'](handleEntityNotFound(_0x115091,null))[_0x9994('0x25')](respondWithResult(_0x115091,null))[_0x9994('0x44')](handleError(_0x115091,null));};exports[_0x9994('0x46')]=function(_0x446ab8,_0x43bdc1){return db[_0x9994('0x2b')][_0x9994('0x46')](_0x446ab8['body'],{})['then'](respondWithResult(_0x43bdc1,0xc9))[_0x9994('0x44')](handleError(_0x43bdc1,null));};exports[_0x9994('0x47')]=function(_0x1b1ae1,_0x22fedf){if(_0x1b1ae1[_0x9994('0x48')]['id']){delete _0x1b1ae1[_0x9994('0x48')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x1b1ae1[_0x9994('0x49')]['id']}})[_0x9994('0x25')](handleEntityNotFound(_0x22fedf,null))['then'](saveUpdates(_0x1b1ae1[_0x9994('0x48')],null))['then'](respondWithResult(_0x22fedf,null))[_0x9994('0x44')](handleError(_0x22fedf,null));};exports[_0x9994('0x4a')]=function(_0x143ea9,_0x4cd47c){return db[_0x9994('0x2b')]['find']({'where':{'id':_0x143ea9[_0x9994('0x49')]['id']}})['then'](handleEntityNotFound(_0x4cd47c,null))[_0x9994('0x25')](removeEntity(_0x4cd47c,null))[_0x9994('0x44')](handleError(_0x4cd47c,null));};exports['describe']=function(_0xe01636,_0x411c7a){return db[_0x9994('0x2b')][_0x9994('0x4b')]()[_0x9994('0x25')](respondWithResult(_0x411c7a,null))['catch'](handleError(_0x411c7a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f084adb..fc6840f 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 _0x324e=['exports','define','IntegrationReport','report_integration','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0x324e,0xd5));var _0xe324=function(_0x58503e,_0xe16afc){_0x58503e=_0x58503e-0x0;var _0x4fdffa=_0x324e[_0x58503e];return _0x4fdffa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe324('0x0'));var moment=require(_0xe324('0x1'));var BPromise=require(_0xe324('0x2'));var rp=require(_0xe324('0x3'));var fs=require('fs');var path=require(_0xe324('0x4'));var rimraf=require(_0xe324('0x5'));var config=require('../../config/environment');var attributes=require(_0xe324('0x6'));module[_0xe324('0x7')]=function(_0x41d2e9,_0xdad4c9){return _0x41d2e9[_0xe324('0x8')](_0xe324('0x9'),attributes,{'tableName':_0xe324('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcca4=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xcca4,0x12b));var _0x4cca=function(_0x36ad09,_0x2c290d){_0x36ad09=_0x36ad09-0x0;var _0x2ae9db=_0xcca4[_0x36ad09];return _0x2ae9db;};'use strict';var _=require(_0x4cca('0x0'));var util=require(_0x4cca('0x1'));var logger=require(_0x4cca('0x2'))(_0x4cca('0x3'));var moment=require(_0x4cca('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cca('0x6'));var config=require(_0x4cca('0x7'));var attributes=require(_0x4cca('0x8'));module[_0x4cca('0x9')]=function(_0x15fbb1,_0x58ff00){return _0x15fbb1[_0x4cca('0xa')](_0x4cca('0xb'),attributes,{'tableName':_0x4cca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 45080d4..46e8db9 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc2c7,0x134));var _0x7c2c=function(_0x45f0d7,_0x3b7077){_0x45f0d7=_0x45f0d7-0x0;var _0x15b853=_0xc2c7[_0x45f0d7];return _0x15b853;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 460490a..98b8f8e 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 _0x544f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x3f713a,_0x32b533){var _0x1222ae=function(_0x3b4c80){while(--_0x3b4c80){_0x3f713a['push'](_0x3f713a['shift']());}};_0x1222ae(++_0x32b533);}(_0x544f,0x104));var _0xf544=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x544f[_0x271060];return _0x40540b;};'use strict';var multer=require('multer');var util=require(_0xf544('0x0'));var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf544('0x4'));var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./interval.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router['get']('/:id',auth[_0xf544('0x8')](),controller[_0xf544('0x9')]);router[_0xf544('0x7')]('/:id/sub_intervals',auth[_0xf544('0x8')](),controller[_0xf544('0xa')]);router[_0xf544('0xb')]('/',auth[_0xf544('0x8')](),controller[_0xf544('0xc')]);router[_0xf544('0xb')](_0xf544('0xd'),auth[_0xf544('0x8')](),controller[_0xf544('0xe')]);router[_0xf544('0xb')](_0xf544('0xf'),auth[_0xf544('0x8')](),controller[_0xf544('0x10')]);router[_0xf544('0x11')](_0xf544('0x12'),auth[_0xf544('0x8')](),controller[_0xf544('0x13')]);router[_0xf544('0x14')](_0xf544('0x12'),auth[_0xf544('0x8')](),controller[_0xf544('0x15')]);module['exports']=router; \ No newline at end of file +var _0xcf30=['show','post','create','/:id/sub_intervals','addInterval','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./interval.controller','get','/:id','isAuthenticated'];(function(_0x56a1f1,_0x1ed556){var _0x29d489=function(_0x192017){while(--_0x192017){_0x56a1f1['push'](_0x56a1f1['shift']());}};_0x29d489(++_0x1ed556);}(_0xcf30,0x128));var _0x0cf3=function(_0x32c590,_0x430bc7){_0x32c590=_0x32c590-0x0;var _0x9b74f6=_0xcf30[_0x32c590];return _0x9b74f6;};'use strict';var multer=require(_0x0cf3('0x0'));var util=require(_0x0cf3('0x1'));var path=require(_0x0cf3('0x2'));var timeout=require(_0x0cf3('0x3'));var express=require('express');var router=express[_0x0cf3('0x4')]();var fs_extra=require(_0x0cf3('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0cf3('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0cf3('0x7')](_0x0cf3('0x8'),auth[_0x0cf3('0x9')](),controller[_0x0cf3('0xa')]);router[_0x0cf3('0x7')]('/:id/sub_intervals',auth[_0x0cf3('0x9')](),controller['getIntervals']);router[_0x0cf3('0xb')]('/',auth[_0x0cf3('0x9')](),controller[_0x0cf3('0xc')]);router[_0x0cf3('0xb')](_0x0cf3('0xd'),auth[_0x0cf3('0x9')](),controller[_0x0cf3('0xe')]);router[_0x0cf3('0xb')]('/:id/sub_intervals/create_many',auth[_0x0cf3('0x9')](),controller['addIntervals']);router['put']('/:id',auth[_0x0cf3('0x9')](),controller[_0x0cf3('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0cf3('0x10')]);module[_0x0cf3('0x11')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index baef36e..dba08ae 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 _0xc342=['STRING','sequelize'];(function(_0x3e437d,_0x4aa837){var _0x578bd0=function(_0x10a810){while(--_0x10a810){_0x3e437d['push'](_0x3e437d['shift']());}};_0x578bd0(++_0x4aa837);}(_0xc342,0x1e7));var _0x2c34=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0xc342[_0x2e4a0f];return _0x25a3cd;};'use strict';var Sequelize=require(_0x2c34('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c34('0x1')]},'description':{'type':Sequelize[_0x2c34('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf8d9=['exports','STRING','sequelize'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xf8d9,0x1c7));var _0x9f8d=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0xf8d9[_0x340e24];return _0x1808a;};'use strict';var Sequelize=require(_0x9f8d('0x0'));module[_0x9f8d('0x1')]={'name':{'type':Sequelize[_0x9f8d('0x2')]},'description':{'type':Sequelize[_0x9f8d('0x2')]},'interval':{'type':Sequelize[_0x9f8d('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7de3f38..2a89b2b 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 _0x584c=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','getIntervals','nolimit','transaction','IntervalId','bulkCreate','findAll','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Interval','includeAll','include','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x21d7da,_0x252a56){var _0x12e9c8=function(_0x15080e){while(--_0x15080e){_0x21d7da['push'](_0x21d7da['shift']());}};_0x12e9c8(++_0x252a56);}(_0x584c,0x6d));var _0xc584=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0x584c[_0x458848];return _0x20469e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc584('0x0'));var rp=require(_0xc584('0x1'));var moment=require('moment');var BPromise=require(_0xc584('0x2'));var Mustache=require('mustache');var util=require(_0xc584('0x3'));var path=require(_0xc584('0x4'));var sox=require(_0xc584('0x5'));var csv=require(_0xc584('0x6'));var ejs=require(_0xc584('0x7'));var fs=require('fs');var fs_extra=require(_0xc584('0x8'));var _=require(_0xc584('0x9'));var squel=require(_0xc584('0xa'));var crypto=require(_0xc584('0xb'));var jsforce=require(_0xc584('0xc'));var deskjs=require(_0xc584('0xd'));var toCsv=require(_0xc584('0x6'));var querystring=require(_0xc584('0xe'));var Papa=require(_0xc584('0xf'));var Redis=require(_0xc584('0x10'));var authService=require(_0xc584('0x11'));var qs=require(_0xc584('0x12'));var as=require(_0xc584('0x13'));var hardwareService=require(_0xc584('0x14'));var logger=require(_0xc584('0x15'))(_0xc584('0x16'));var utils=require(_0xc584('0x17'));var config=require(_0xc584('0x18'));var licenseUtil=require(_0xc584('0x19'));var db=require(_0xc584('0x1a'))['db'];var extensions=require(_0xc584('0x1b'));function respondWithStatusCode(_0x249ce8,_0x2c8014){_0x2c8014=_0x2c8014||0xcc;return function(_0x50c114){if(_0x50c114){return _0x249ce8[_0xc584('0x1c')](_0x2c8014);}return _0x249ce8[_0xc584('0x1d')](_0x2c8014)['end']();};}function respondWithResult(_0x5846f2,_0x3be439){_0x3be439=_0x3be439||0xc8;return function(_0x167ac2){if(_0x167ac2){return _0x5846f2[_0xc584('0x1d')](_0x3be439)[_0xc584('0x1e')](_0x167ac2);}};}function respondWithFilteredResult(_0x136f48,_0x50c9dc){return function(_0x28dc8b){if(_0x28dc8b){var _0xfec0bc=typeof _0x50c9dc['offset']===_0xc584('0x1f')&&typeof _0x50c9dc[_0xc584('0x20')]===_0xc584('0x1f');var _0x12ac91=_0x28dc8b[_0xc584('0x21')];var _0x2a3caa=_0xfec0bc?0x0:_0x50c9dc[_0xc584('0x22')];var _0x2fc9a1=_0xfec0bc?_0x28dc8b[_0xc584('0x21')]:_0x50c9dc[_0xc584('0x22')]+_0x50c9dc['limit'];var _0x3c768;if(_0x2fc9a1>=_0x12ac91){_0x2fc9a1=_0x12ac91;_0x3c768=0xc8;}else{_0x3c768=0xce;}_0x136f48[_0xc584('0x1d')](_0x3c768);return _0x136f48[_0xc584('0x23')](_0xc584('0x24'),_0x2a3caa+'-'+_0x2fc9a1+'/'+_0x12ac91)[_0xc584('0x1e')](_0x28dc8b);}return null;};}function patchUpdates(_0x55c626){return function(_0x3c341b){try{jsonpatch['apply'](_0x3c341b,_0x55c626,!![]);}catch(_0xf7c2f8){return BPromise[_0xc584('0x25')](_0xf7c2f8);}return _0x3c341b[_0xc584('0x26')]();};}function saveUpdates(_0x558be4,_0x5ac287){return function(_0x41f711){if(_0x41f711){return _0x41f711[_0xc584('0x27')](_0x558be4)[_0xc584('0x28')](function(_0x2ea015){return _0x2ea015;});}return null;};}function removeEntity(_0x4d4f7d,_0x1e70f7){return function(_0x562910){if(_0x562910){return _0x562910[_0xc584('0x29')]()['then'](function(){var _0x22a66a=_0x562910[_0xc584('0x2a')]({'plain':!![]});var _0x51ec91=_0xc584('0x2b');return db[_0xc584('0x2c')]['destroy']({'where':{'type':_0x51ec91,'resourceId':_0x22a66a['id']}})[_0xc584('0x28')](function(){return _0x562910;});})['then'](function(){_0x4d4f7d['status'](0xcc)[_0xc584('0x2d')]();});}};}function handleEntityNotFound(_0x162b6a,_0x502583){return function(_0x35bf2){if(!_0x35bf2){_0x162b6a[_0xc584('0x1c')](0x194);}return _0x35bf2;};}function handleError(_0x151558,_0x178072){_0x178072=_0x178072||0x1f4;return function(_0x564663){logger[_0xc584('0x2e')](_0x564663[_0xc584('0x2f')]);if(_0x564663['name']){delete _0x564663[_0xc584('0x30')];}_0x151558[_0xc584('0x1d')](_0x178072)[_0xc584('0x31')](_0x564663);};}exports[_0xc584('0x32')]=function(_0x40537b,_0x31ad4a){var _0x5514f9={},_0x37a5e3={},_0x54ee62={'count':0x0,'rows':[]};var _0x25605b=_[_0xc584('0x33')](db['Interval'][_0xc584('0x34')],function(_0x10c1bd){return{'name':_0x10c1bd[_0xc584('0x35')],'type':_0x10c1bd['type'][_0xc584('0x36')]};});_0x37a5e3[_0xc584('0x37')]=_[_0xc584('0x33')](_0x25605b,_0xc584('0x30'));_0x37a5e3['query']=_[_0xc584('0x38')](_0x40537b[_0xc584('0x39')]);_0x37a5e3[_0xc584('0x3a')]=_[_0xc584('0x3b')](_0x37a5e3[_0xc584('0x37')],_0x37a5e3[_0xc584('0x39')]);_0x5514f9[_0xc584('0x3c')]=_['intersection'](_0x37a5e3[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x40537b[_0xc584('0x39')][_0xc584('0x3d')]));_0x5514f9[_0xc584('0x3c')]=_0x5514f9[_0xc584('0x3c')][_0xc584('0x3e')]?_0x5514f9['attributes']:_0x37a5e3[_0xc584('0x37')];if(!_0x40537b[_0xc584('0x39')][_0xc584('0x3f')]('nolimit')){_0x5514f9[_0xc584('0x20')]=qs[_0xc584('0x20')](_0x40537b['query'][_0xc584('0x20')]);_0x5514f9[_0xc584('0x22')]=qs[_0xc584('0x22')](_0x40537b[_0xc584('0x39')][_0xc584('0x22')]);}_0x5514f9[_0xc584('0x40')]=qs['sort'](_0x40537b[_0xc584('0x39')][_0xc584('0x41')]);_0x5514f9[_0xc584('0x42')]=qs[_0xc584('0x3a')](_[_0xc584('0x43')](_0x40537b['query'],_0x37a5e3[_0xc584('0x3a')]),_0x25605b);if(_0x40537b[_0xc584('0x39')][_0xc584('0x44')]){_0x5514f9[_0xc584('0x42')]=_[_0xc584('0x45')](_0x5514f9['where'],{'$or':_['map'](_0x25605b,function(_0x18e546){if(_0x18e546[_0xc584('0x46')]!==_0xc584('0x47')){var _0x1fd29e={};_0x1fd29e[_0x18e546[_0xc584('0x30')]]={'$like':'%'+_0x40537b['query'][_0xc584('0x44')]+'%'};return _0x1fd29e;}})});}_0x5514f9=_[_0xc584('0x45')]({},_0x5514f9,_0x40537b[_0xc584('0x48')]);var _0x11883d={'where':_0x5514f9[_0xc584('0x42')]};return db[_0xc584('0x49')][_0xc584('0x21')](_0x11883d)[_0xc584('0x28')](function(_0x188b32){_0x54ee62[_0xc584('0x21')]=_0x188b32;if(_0x40537b[_0xc584('0x39')][_0xc584('0x4a')]){_0x5514f9[_0xc584('0x4b')]=[{'all':!![]}];}return db[_0xc584('0x49')]['findAll'](_0x5514f9);})['then'](function(_0x2d713d){_0x54ee62[_0xc584('0x4c')]=_0x2d713d;return _0x54ee62;})[_0xc584('0x28')](respondWithFilteredResult(_0x31ad4a,_0x5514f9))['catch'](handleError(_0x31ad4a,null));};exports[_0xc584('0x4d')]=function(_0x167d2e,_0x56eb31){var _0x33fc33={'raw':!![],'where':{'id':_0x167d2e[_0xc584('0x4e')]['id']}},_0x19dcdc={};_0x19dcdc[_0xc584('0x37')]=_[_0xc584('0x38')](db[_0xc584('0x49')][_0xc584('0x34')]);_0x19dcdc[_0xc584('0x39')]=_[_0xc584('0x38')](_0x167d2e['query']);_0x19dcdc['filters']=_[_0xc584('0x3b')](_0x19dcdc[_0xc584('0x37')],_0x19dcdc[_0xc584('0x39')]);_0x33fc33[_0xc584('0x3c')]=_[_0xc584('0x3b')](_0x19dcdc[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x167d2e[_0xc584('0x39')]['fields']));_0x33fc33[_0xc584('0x3c')]=_0x33fc33[_0xc584('0x3c')]['length']?_0x33fc33[_0xc584('0x3c')]:_0x19dcdc[_0xc584('0x37')];if(_0x167d2e[_0xc584('0x39')][_0xc584('0x4a')]){_0x33fc33[_0xc584('0x4b')]=[{'all':!![]}];}_0x33fc33=_[_0xc584('0x45')]({},_0x33fc33,_0x167d2e['options']);return db['Interval'][_0xc584('0x4f')](_0x33fc33)['then'](handleEntityNotFound(_0x56eb31,null))[_0xc584('0x28')](respondWithResult(_0x56eb31,null))[_0xc584('0x50')](handleError(_0x56eb31,null));};exports[_0xc584('0x51')]=function(_0x316203,_0x736f43){return db['Interval'][_0xc584('0x51')](_0x316203['body'],{})['then'](function(_0x204d92){var _0x673c16=_0x316203[_0xc584('0x52')]['get']({'plain':!![]});if(!_0x673c16)throw new Error(_0xc584('0x53'));if(_0x673c16[_0xc584('0x54')]==='user'){var _0x5430e3=_0x204d92[_0xc584('0x2a')]({'plain':!![]});var _0x7478df=_0xc584('0x2b');return db[_0xc584('0x55')]['find']({'where':{'name':_0x7478df,'userProfileId':_0x673c16[_0xc584('0x56')]},'raw':!![]})['then'](function(_0x13d9e5){if(_0x13d9e5&&_0x13d9e5[_0xc584('0x57')]===0x0){return db['UserProfileResource'][_0xc584('0x51')]({'name':_0x5430e3[_0xc584('0x30')],'resourceId':_0x5430e3['id'],'type':_0x13d9e5[_0xc584('0x30')],'sectionId':_0x13d9e5['id']},{})['then'](function(){return _0x204d92;});}else{return _0x204d92;}})[_0xc584('0x50')](function(_0x3cb3fd){logger[_0xc584('0x2e')](_0xc584('0x58'),_0x3cb3fd);throw _0x3cb3fd;});}return _0x204d92;})[_0xc584('0x28')](respondWithResult(_0x736f43,0xc9))[_0xc584('0x50')](handleError(_0x736f43,null));};exports[_0xc584('0x27')]=function(_0x22e6ea,_0x317040){if(_0x22e6ea['body']['id']){delete _0x22e6ea[_0xc584('0x59')]['id'];}return db[_0xc584('0x49')][_0xc584('0x4f')]({'where':{'id':_0x22e6ea[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x317040,null))[_0xc584('0x28')](saveUpdates(_0x22e6ea[_0xc584('0x59')],null))['then'](respondWithResult(_0x317040,null))[_0xc584('0x50')](handleError(_0x317040,null));};exports[_0xc584('0x29')]=function(_0x22530d,_0x5c36ed){return db['Interval']['find']({'where':{'id':_0x22530d[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x5c36ed,null))[_0xc584('0x28')](removeEntity(_0x5c36ed,null))['catch'](handleError(_0x5c36ed,null));};exports['addInterval']=function(_0x18ae84,_0x5f1315,_0x783e01){if(_0x18ae84[_0xc584('0x59')]['id']){delete _0x18ae84['body']['id'];}return db[_0xc584('0x49')][_0xc584('0x4f')]({'where':{'id':_0x18ae84[_0xc584('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f1315,null))[_0xc584('0x28')](function(_0x10903a){if(_0x10903a){_0x18ae84[_0xc584('0x59')]['IntervalId']=_0x10903a['id'];return db[_0xc584('0x49')][_0xc584('0x51')](_0x18ae84[_0xc584('0x59')]);}})[_0xc584('0x28')](respondWithResult(_0x5f1315,null))[_0xc584('0x50')](handleError(_0x5f1315,null));};exports['getIntervals']=function(_0x5a8d70,_0x1ff36f,_0x314c84){var _0x47e093={};var _0x24a6f1={};var _0x56f550;var _0x448d27;return db[_0xc584('0x49')][_0xc584('0x5a')]({'where':{'id':_0x5a8d70[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x1ff36f,null))[_0xc584('0x28')](function(_0x47b3d6){if(_0x47b3d6){_0x56f550=_0x47b3d6;_0x24a6f1[_0xc584('0x37')]=_[_0xc584('0x38')](db['Interval'][_0xc584('0x34')]);_0x24a6f1[_0xc584('0x39')]=_['keys'](_0x5a8d70[_0xc584('0x39')]);_0x24a6f1[_0xc584('0x3a')]=_[_0xc584('0x3b')](_0x24a6f1[_0xc584('0x37')],_0x24a6f1['query']);_0x47e093[_0xc584('0x3c')]=_['intersection'](_0x24a6f1[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x5a8d70[_0xc584('0x39')][_0xc584('0x3d')]));_0x47e093['attributes']=_0x47e093[_0xc584('0x3c')][_0xc584('0x3e')]?_0x47e093[_0xc584('0x3c')]:_0x24a6f1['model'];_0x47e093[_0xc584('0x40')]=qs[_0xc584('0x41')](_0x5a8d70['query'][_0xc584('0x41')]);_0x47e093['where']=qs[_0xc584('0x3a')](_['pick'](_0x5a8d70[_0xc584('0x39')],_0x24a6f1[_0xc584('0x3a')]));if(_0x5a8d70[_0xc584('0x39')][_0xc584('0x44')]){_0x47e093[_0xc584('0x42')]=_['merge'](_0x47e093[_0xc584('0x42')],{'$or':_[_0xc584('0x33')](_0x47e093[_0xc584('0x3c')],function(_0x53dbd7){var _0x2a4c16={};_0x2a4c16[_0x53dbd7]={'$like':'%'+_0x5a8d70[_0xc584('0x39')]['filter']+'%'};return _0x2a4c16;})});}_0x47e093=_[_0xc584('0x45')]({},_0x47e093,_0x5a8d70[_0xc584('0x48')]);return _0x56f550[_0xc584('0x5b')](_0x47e093);}})['then'](function(_0x496eeb){if(_0x496eeb){_0x448d27=_0x496eeb[_0xc584('0x3e')];if(!_0x5a8d70[_0xc584('0x39')][_0xc584('0x3f')](_0xc584('0x5c'))){_0x47e093['limit']=qs[_0xc584('0x20')](_0x5a8d70['query'][_0xc584('0x20')]);_0x47e093[_0xc584('0x22')]=qs[_0xc584('0x22')](_0x5a8d70[_0xc584('0x39')][_0xc584('0x22')]);}return _0x56f550[_0xc584('0x5b')](_0x47e093);}})[_0xc584('0x28')](function(_0x2b7c10){if(_0x2b7c10){return _0x2b7c10?{'count':_0x448d27,'rows':_0x2b7c10}:null;}})[_0xc584('0x28')](respondWithResult(_0x1ff36f,null))[_0xc584('0x50')](handleError(_0x1ff36f,null));};exports['addIntervals']=function(_0x12e851,_0x5472da,_0x8e9823){return db['Interval'][_0xc584('0x5a')]({'where':{'id':_0x12e851[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x5472da,null))[_0xc584('0x28')](function(_0x18a270){if(_0x18a270){return db['sequelize'][_0xc584('0x5d')](function(_0x5e0fed){return db['Interval']['destroy']({'where':{'IntervalId':_0x12e851[_0xc584('0x4e')]['id']},'transaction':_0x5e0fed})['then'](function(_0x337f2e){var _0xc81a3b=_[_0xc584('0x33')](_0x12e851[_0xc584('0x59')],function(_0x662a87){delete _0x662a87['id'];_0x662a87[_0xc584('0x5e')]=_0x12e851[_0xc584('0x4e')]['id'];return _0x662a87;});return db[_0xc584('0x49')][_0xc584('0x5f')](_0xc81a3b,{'transaction':_0x5e0fed});});})[_0xc584('0x28')](function(){return db[_0xc584('0x49')][_0xc584('0x60')]({'where':{'IntervalId':_0x12e851[_0xc584('0x4e')]['id']}});});}})[_0xc584('0x28')](respondWithResult(_0x5472da,null))[_0xc584('0x50')](handleError(_0x5472da,null));}; \ No newline at end of file +var _0xb600=['find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','sort','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','count','findAll','rows','params','includeAll','options'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0xb600,0x130));var _0x0b60=function(_0x45b1b3,_0x224dce){_0x45b1b3=_0x45b1b3-0x0;var _0x8f20cc=_0xb600[_0x45b1b3];return _0x8f20cc;};'use strict';var emlformat=require(_0x0b60('0x0'));var rimraf=require(_0x0b60('0x1'));var zipdir=require(_0x0b60('0x2'));var jsonpatch=require(_0x0b60('0x3'));var rp=require(_0x0b60('0x4'));var moment=require(_0x0b60('0x5'));var BPromise=require(_0x0b60('0x6'));var Mustache=require('mustache');var util=require(_0x0b60('0x7'));var path=require('path');var sox=require(_0x0b60('0x8'));var csv=require('to-csv');var ejs=require(_0x0b60('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b60('0xa'));var squel=require(_0x0b60('0xb'));var crypto=require('crypto');var jsforce=require(_0x0b60('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0b60('0xd'));var querystring=require(_0x0b60('0xe'));var Papa=require(_0x0b60('0xf'));var Redis=require(_0x0b60('0x10'));var authService=require(_0x0b60('0x11'));var qs=require(_0x0b60('0x12'));var as=require(_0x0b60('0x13'));var hardwareService=require(_0x0b60('0x14'));var logger=require('../../config/logger')(_0x0b60('0x15'));var utils=require(_0x0b60('0x16'));var config=require(_0x0b60('0x17'));var licenseUtil=require(_0x0b60('0x18'));var db=require(_0x0b60('0x19'))['db'];var extensions=require(_0x0b60('0x1a'));function respondWithStatusCode(_0x920f00,_0x5c714b){_0x5c714b=_0x5c714b||0xcc;return function(_0xe683ad){if(_0xe683ad){return _0x920f00['sendStatus'](_0x5c714b);}return _0x920f00[_0x0b60('0x1b')](_0x5c714b)[_0x0b60('0x1c')]();};}function respondWithResult(_0x4785c8,_0x2d4c7a){_0x2d4c7a=_0x2d4c7a||0xc8;return function(_0x1a399d){if(_0x1a399d){return _0x4785c8[_0x0b60('0x1b')](_0x2d4c7a)[_0x0b60('0x1d')](_0x1a399d);}};}function respondWithFilteredResult(_0x16c4ea,_0x5a9cea){return function(_0x5dc48b){if(_0x5dc48b){var _0x47248c=typeof _0x5a9cea[_0x0b60('0x1e')]===_0x0b60('0x1f')&&typeof _0x5a9cea[_0x0b60('0x20')]===_0x0b60('0x1f');var _0x1ed9b5=_0x5dc48b['count'];var _0x24bf8d=_0x47248c?0x0:_0x5a9cea['offset'];var _0x27212f=_0x47248c?_0x5dc48b['count']:_0x5a9cea[_0x0b60('0x1e')]+_0x5a9cea[_0x0b60('0x20')];var _0x5c3021;if(_0x27212f>=_0x1ed9b5){_0x27212f=_0x1ed9b5;_0x5c3021=0xc8;}else{_0x5c3021=0xce;}_0x16c4ea[_0x0b60('0x1b')](_0x5c3021);return _0x16c4ea[_0x0b60('0x21')](_0x0b60('0x22'),_0x24bf8d+'-'+_0x27212f+'/'+_0x1ed9b5)[_0x0b60('0x1d')](_0x5dc48b);}return null;};}function patchUpdates(_0x560312){return function(_0x4e0860){try{jsonpatch[_0x0b60('0x23')](_0x4e0860,_0x560312,!![]);}catch(_0x479e4e){return BPromise[_0x0b60('0x24')](_0x479e4e);}return _0x4e0860[_0x0b60('0x25')]();};}function saveUpdates(_0x597634,_0x194b58){return function(_0x4c6fee){if(_0x4c6fee){return _0x4c6fee[_0x0b60('0x26')](_0x597634)['then'](function(_0x40bc8f){return _0x40bc8f;});}return null;};}function removeEntity(_0x3ee2d6,_0x36f6a0){return function(_0x13f8db){if(_0x13f8db){return _0x13f8db[_0x0b60('0x27')]()['then'](function(){var _0x359810=_0x13f8db[_0x0b60('0x28')]({'plain':!![]});var _0x1920cd='Intervals';return db[_0x0b60('0x29')][_0x0b60('0x27')]({'where':{'type':_0x1920cd,'resourceId':_0x359810['id']}})[_0x0b60('0x2a')](function(){return _0x13f8db;});})[_0x0b60('0x2a')](function(){_0x3ee2d6[_0x0b60('0x1b')](0xcc)[_0x0b60('0x1c')]();});}};}function handleEntityNotFound(_0x4833da,_0x1fb23d){return function(_0x291507){if(!_0x291507){_0x4833da[_0x0b60('0x2b')](0x194);}return _0x291507;};}function handleError(_0x1c359e,_0x12a2f0){_0x12a2f0=_0x12a2f0||0x1f4;return function(_0x3f9b2d){logger[_0x0b60('0x2c')](_0x3f9b2d[_0x0b60('0x2d')]);if(_0x3f9b2d[_0x0b60('0x2e')]){delete _0x3f9b2d[_0x0b60('0x2e')];}_0x1c359e['status'](_0x12a2f0)['send'](_0x3f9b2d);};}exports[_0x0b60('0x2f')]=function(_0xe9ae0d,_0x4b9da1){var _0x1ab3bb={},_0x57acc9={},_0x55f02e={'count':0x0,'rows':[]};var _0x1182f6=_[_0x0b60('0x30')](db[_0x0b60('0x31')][_0x0b60('0x32')],function(_0x4c73c8){return{'name':_0x4c73c8[_0x0b60('0x33')],'type':_0x4c73c8[_0x0b60('0x34')][_0x0b60('0x35')]};});_0x57acc9[_0x0b60('0x36')]=_[_0x0b60('0x30')](_0x1182f6,_0x0b60('0x2e'));_0x57acc9[_0x0b60('0x37')]=_[_0x0b60('0x38')](_0xe9ae0d[_0x0b60('0x37')]);_0x57acc9[_0x0b60('0x39')]=_[_0x0b60('0x3a')](_0x57acc9['model'],_0x57acc9[_0x0b60('0x37')]);_0x1ab3bb[_0x0b60('0x3b')]=_[_0x0b60('0x3a')](_0x57acc9[_0x0b60('0x36')],qs['fields'](_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x3c')]));_0x1ab3bb[_0x0b60('0x3b')]=_0x1ab3bb[_0x0b60('0x3b')][_0x0b60('0x3d')]?_0x1ab3bb[_0x0b60('0x3b')]:_0x57acc9['model'];if(!_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x3e')](_0x0b60('0x3f'))){_0x1ab3bb[_0x0b60('0x20')]=qs[_0x0b60('0x20')](_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x20')]);_0x1ab3bb[_0x0b60('0x1e')]=qs['offset'](_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x1e')]);}_0x1ab3bb[_0x0b60('0x40')]=qs['sort'](_0xe9ae0d[_0x0b60('0x37')]['sort']);_0x1ab3bb[_0x0b60('0x41')]=qs[_0x0b60('0x39')](_[_0x0b60('0x42')](_0xe9ae0d[_0x0b60('0x37')],_0x57acc9[_0x0b60('0x39')]),_0x1182f6);if(_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x43')]){_0x1ab3bb[_0x0b60('0x41')]=_[_0x0b60('0x44')](_0x1ab3bb[_0x0b60('0x41')],{'$or':_['map'](_0x1182f6,function(_0x3a91ce){if(_0x3a91ce[_0x0b60('0x34')]!==_0x0b60('0x45')){var _0x2d2a08={};_0x2d2a08[_0x3a91ce[_0x0b60('0x2e')]]={'$like':'%'+_0xe9ae0d[_0x0b60('0x37')][_0x0b60('0x43')]+'%'};return _0x2d2a08;}})});}_0x1ab3bb=_[_0x0b60('0x44')]({},_0x1ab3bb,_0xe9ae0d['options']);var _0x4d1166={'where':_0x1ab3bb[_0x0b60('0x41')]};return db['Interval'][_0x0b60('0x46')](_0x4d1166)['then'](function(_0x5e4029){_0x55f02e[_0x0b60('0x46')]=_0x5e4029;if(_0xe9ae0d[_0x0b60('0x37')]['includeAll']){_0x1ab3bb['include']=[{'all':!![]}];}return db[_0x0b60('0x31')][_0x0b60('0x47')](_0x1ab3bb);})[_0x0b60('0x2a')](function(_0x5765d2){_0x55f02e[_0x0b60('0x48')]=_0x5765d2;return _0x55f02e;})[_0x0b60('0x2a')](respondWithFilteredResult(_0x4b9da1,_0x1ab3bb))['catch'](handleError(_0x4b9da1,null));};exports['show']=function(_0x5748db,_0x48b799){var _0x54b467={'raw':!![],'where':{'id':_0x5748db[_0x0b60('0x49')]['id']}},_0x3fef53={};_0x3fef53[_0x0b60('0x36')]=_[_0x0b60('0x38')](db['Interval']['rawAttributes']);_0x3fef53[_0x0b60('0x37')]=_[_0x0b60('0x38')](_0x5748db['query']);_0x3fef53[_0x0b60('0x39')]=_[_0x0b60('0x3a')](_0x3fef53[_0x0b60('0x36')],_0x3fef53[_0x0b60('0x37')]);_0x54b467['attributes']=_[_0x0b60('0x3a')](_0x3fef53['model'],qs[_0x0b60('0x3c')](_0x5748db[_0x0b60('0x37')]['fields']));_0x54b467[_0x0b60('0x3b')]=_0x54b467['attributes'][_0x0b60('0x3d')]?_0x54b467[_0x0b60('0x3b')]:_0x3fef53[_0x0b60('0x36')];if(_0x5748db[_0x0b60('0x37')][_0x0b60('0x4a')]){_0x54b467['include']=[{'all':!![]}];}_0x54b467=_[_0x0b60('0x44')]({},_0x54b467,_0x5748db[_0x0b60('0x4b')]);return db[_0x0b60('0x31')][_0x0b60('0x4c')](_0x54b467)[_0x0b60('0x2a')](handleEntityNotFound(_0x48b799,null))['then'](respondWithResult(_0x48b799,null))['catch'](handleError(_0x48b799,null));};exports[_0x0b60('0x4d')]=function(_0x3680e5,_0x257185){return db[_0x0b60('0x31')][_0x0b60('0x4d')](_0x3680e5['body'],{})[_0x0b60('0x2a')](function(_0x5c8574){var _0x2ce38f=_0x3680e5[_0x0b60('0x4e')][_0x0b60('0x28')]({'plain':!![]});if(!_0x2ce38f)throw new Error(_0x0b60('0x4f'));if(_0x2ce38f[_0x0b60('0x50')]===_0x0b60('0x4e')){var _0x88e71=_0x5c8574['get']({'plain':!![]});var _0x3a22dd=_0x0b60('0x51');return db[_0x0b60('0x52')][_0x0b60('0x4c')]({'where':{'name':_0x3a22dd,'userProfileId':_0x2ce38f['userProfileId']},'raw':!![]})[_0x0b60('0x2a')](function(_0x22dbbf){if(_0x22dbbf&&_0x22dbbf[_0x0b60('0x53')]===0x0){return db[_0x0b60('0x29')]['create']({'name':_0x88e71['name'],'resourceId':_0x88e71['id'],'type':_0x22dbbf[_0x0b60('0x2e')],'sectionId':_0x22dbbf['id']},{})[_0x0b60('0x2a')](function(){return _0x5c8574;});}else{return _0x5c8574;}})[_0x0b60('0x54')](function(_0x40123b){logger[_0x0b60('0x2c')](_0x0b60('0x55'),_0x40123b);throw _0x40123b;});}return _0x5c8574;})[_0x0b60('0x2a')](respondWithResult(_0x257185,0xc9))[_0x0b60('0x54')](handleError(_0x257185,null));};exports[_0x0b60('0x26')]=function(_0x240c68,_0x1022a4){if(_0x240c68[_0x0b60('0x56')]['id']){delete _0x240c68[_0x0b60('0x56')]['id'];}return db['Interval'][_0x0b60('0x4c')]({'where':{'id':_0x240c68[_0x0b60('0x49')]['id']}})[_0x0b60('0x2a')](handleEntityNotFound(_0x1022a4,null))[_0x0b60('0x2a')](saveUpdates(_0x240c68[_0x0b60('0x56')],null))[_0x0b60('0x2a')](respondWithResult(_0x1022a4,null))['catch'](handleError(_0x1022a4,null));};exports[_0x0b60('0x27')]=function(_0x42445f,_0x4c2d45){return db[_0x0b60('0x31')][_0x0b60('0x4c')]({'where':{'id':_0x42445f['params']['id']}})[_0x0b60('0x2a')](handleEntityNotFound(_0x4c2d45,null))[_0x0b60('0x2a')](removeEntity(_0x4c2d45,null))[_0x0b60('0x54')](handleError(_0x4c2d45,null));};exports[_0x0b60('0x57')]=function(_0x263be4,_0x4e9ad8,_0x1076c6){if(_0x263be4[_0x0b60('0x56')]['id']){delete _0x263be4['body']['id'];}return db[_0x0b60('0x31')][_0x0b60('0x4c')]({'where':{'id':_0x263be4['params']['id']}})['then'](handleEntityNotFound(_0x4e9ad8,null))[_0x0b60('0x2a')](function(_0x517e91){if(_0x517e91){_0x263be4['body'][_0x0b60('0x58')]=_0x517e91['id'];return db['Interval'][_0x0b60('0x4d')](_0x263be4[_0x0b60('0x56')]);}})[_0x0b60('0x2a')](respondWithResult(_0x4e9ad8,null))[_0x0b60('0x54')](handleError(_0x4e9ad8,null));};exports[_0x0b60('0x59')]=function(_0x5b3596,_0x2adf15,_0x5ceeba){var _0x325e48={};var _0x157e6a={};var _0x4b19fd;var _0x26a8ee;return db['Interval'][_0x0b60('0x5a')]({'where':{'id':_0x5b3596['params']['id']}})[_0x0b60('0x2a')](handleEntityNotFound(_0x2adf15,null))[_0x0b60('0x2a')](function(_0x4964c0){if(_0x4964c0){_0x4b19fd=_0x4964c0;_0x157e6a[_0x0b60('0x36')]=_['keys'](db['Interval'][_0x0b60('0x32')]);_0x157e6a[_0x0b60('0x37')]=_[_0x0b60('0x38')](_0x5b3596[_0x0b60('0x37')]);_0x157e6a[_0x0b60('0x39')]=_[_0x0b60('0x3a')](_0x157e6a[_0x0b60('0x36')],_0x157e6a['query']);_0x325e48['attributes']=_['intersection'](_0x157e6a[_0x0b60('0x36')],qs[_0x0b60('0x3c')](_0x5b3596[_0x0b60('0x37')][_0x0b60('0x3c')]));_0x325e48[_0x0b60('0x3b')]=_0x325e48[_0x0b60('0x3b')]['length']?_0x325e48['attributes']:_0x157e6a[_0x0b60('0x36')];_0x325e48[_0x0b60('0x40')]=qs[_0x0b60('0x5b')](_0x5b3596[_0x0b60('0x37')][_0x0b60('0x5b')]);_0x325e48['where']=qs[_0x0b60('0x39')](_['pick'](_0x5b3596['query'],_0x157e6a[_0x0b60('0x39')]));if(_0x5b3596[_0x0b60('0x37')][_0x0b60('0x43')]){_0x325e48[_0x0b60('0x41')]=_[_0x0b60('0x44')](_0x325e48[_0x0b60('0x41')],{'$or':_[_0x0b60('0x30')](_0x325e48[_0x0b60('0x3b')],function(_0x2c26d2){var _0x592373={};_0x592373[_0x2c26d2]={'$like':'%'+_0x5b3596[_0x0b60('0x37')]['filter']+'%'};return _0x592373;})});}_0x325e48=_[_0x0b60('0x44')]({},_0x325e48,_0x5b3596[_0x0b60('0x4b')]);return _0x4b19fd['getIntervals'](_0x325e48);}})[_0x0b60('0x2a')](function(_0x237d13){if(_0x237d13){_0x26a8ee=_0x237d13['length'];if(!_0x5b3596[_0x0b60('0x37')][_0x0b60('0x3e')](_0x0b60('0x3f'))){_0x325e48[_0x0b60('0x20')]=qs[_0x0b60('0x20')](_0x5b3596[_0x0b60('0x37')]['limit']);_0x325e48['offset']=qs[_0x0b60('0x1e')](_0x5b3596[_0x0b60('0x37')]['offset']);}return _0x4b19fd[_0x0b60('0x59')](_0x325e48);}})[_0x0b60('0x2a')](function(_0x3631b2){if(_0x3631b2){return _0x3631b2?{'count':_0x26a8ee,'rows':_0x3631b2}:null;}})['then'](respondWithResult(_0x2adf15,null))[_0x0b60('0x54')](handleError(_0x2adf15,null));};exports[_0x0b60('0x5c')]=function(_0x226dcc,_0xfc01f2,_0x4dad34){return db[_0x0b60('0x31')][_0x0b60('0x5a')]({'where':{'id':_0x226dcc['params']['id']}})[_0x0b60('0x2a')](handleEntityNotFound(_0xfc01f2,null))['then'](function(_0x144f3b){if(_0x144f3b){return db[_0x0b60('0x5d')]['transaction'](function(_0x238165){return db[_0x0b60('0x31')][_0x0b60('0x27')]({'where':{'IntervalId':_0x226dcc[_0x0b60('0x49')]['id']},'transaction':_0x238165})['then'](function(_0x249393){var _0x4d7525=_[_0x0b60('0x30')](_0x226dcc[_0x0b60('0x56')],function(_0x4b40f4){delete _0x4b40f4['id'];_0x4b40f4[_0x0b60('0x58')]=_0x226dcc[_0x0b60('0x49')]['id'];return _0x4b40f4;});return db['Interval'][_0x0b60('0x5e')](_0x4d7525,{'transaction':_0x238165});});})['then'](function(){return db[_0x0b60('0x31')][_0x0b60('0x47')]({'where':{'IntervalId':_0x226dcc[_0x0b60('0x49')]['id']}});});}})[_0x0b60('0x2a')](respondWithResult(_0xfc01f2,null))['catch'](handleError(_0xfc01f2,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b9ac19b..d377c5e 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 _0x1f24=['Interval','tools_intervals','rewrite','lodash','api','moment','request-promise','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x465c8d,_0x308d2e){var _0x3e64a8=function(_0x4ded4e){while(--_0x4ded4e){_0x465c8d['push'](_0x465c8d['shift']());}};_0x3e64a8(++_0x308d2e);}(_0x1f24,0x12f));var _0x41f2=function(_0x40dbbe,_0x3ccb0b){_0x40dbbe=_0x40dbbe-0x0;var _0x3c9acf=_0x1f24[_0x40dbbe];return _0x3c9acf;};'use strict';var _=require(_0x41f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41f2('0x1'));var moment=require(_0x41f2('0x2'));var BPromise=require('bluebird');var rp=require(_0x41f2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41f2('0x4'));var config=require('../../config/environment');var attributes=require(_0x41f2('0x5'));var extensions=require(_0x41f2('0x6'));module[_0x41f2('0x7')]=function(_0x2e3631,_0x3f0028){return _0x2e3631[_0x41f2('0x8')](_0x41f2('0x9'),attributes,{'tableName':_0x41f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x346458,_0x4d4fed){extensions[_0x41f2('0xb')](_0x2e3631,_0x346458);},'afterBulkCreate':function(_0x3cf14a,_0x34ea0a,_0x36e9ba){_0x36e9ba();extensions[_0x41f2('0xb')](_0x2e3631,_0x3cf14a[0x0]);},'afterUpdate':function(_0x3454f0,_0x5583da){extensions[_0x41f2('0xb')](_0x2e3631,_0x3454f0);},'afterDestroy':function(_0x2acd2f,_0x58642a){extensions[_0x41f2('0xb')](_0x2e3631,_0x2acd2f);}}});}; \ No newline at end of file +var _0x51d1=['./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12e817,_0x118514){var _0x5ad3f0=function(_0x2efcda){while(--_0x2efcda){_0x12e817['push'](_0x12e817['shift']());}};_0x5ad3f0(++_0x118514);}(_0x51d1,0x1d6));var _0x151d=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0x51d1[_0x1f6691];return _0xf786b6;};'use strict';var _=require(_0x151d('0x0'));var util=require(_0x151d('0x1'));var logger=require(_0x151d('0x2'))(_0x151d('0x3'));var moment=require(_0x151d('0x4'));var BPromise=require(_0x151d('0x5'));var rp=require(_0x151d('0x6'));var fs=require('fs');var path=require(_0x151d('0x7'));var rimraf=require(_0x151d('0x8'));var config=require(_0x151d('0x9'));var attributes=require(_0x151d('0xa'));var extensions=require('../../components/extensions/rewrite');module[_0x151d('0xb')]=function(_0x3a7ebb,_0x483d1f){return _0x3a7ebb[_0x151d('0xc')](_0x151d('0xd'),attributes,{'tableName':_0x151d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b48f5,_0xb6f9b3){extensions[_0x151d('0xf')](_0x3a7ebb,_0x2b48f5);},'afterBulkCreate':function(_0x5400b5,_0x4c7826,_0x2848c3){_0x2848c3();extensions[_0x151d('0xf')](_0x3a7ebb,_0x5400b5[0x0]);},'afterUpdate':function(_0x5f051d,_0x16f935){extensions[_0x151d('0xf')](_0x3a7ebb,_0x5f051d);},'afterDestroy':function(_0x977470,_0x1d3ce0){extensions[_0x151d('0xf')](_0x3a7ebb,_0x977470);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fb9407f..c278869 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(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 00894b7..49f3398 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x83c716,_0x25152d){var _0xab9893=function(_0x9b3f0a){while(--_0x9b3f0a){_0x83c716['push'](_0x83c716['shift']());}};_0xab9893(++_0x25152d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ba421,_0x110abc){_0x5ba421=_0x5ba421-0x0;var _0x3fd420=_0x5f2f[_0x5ba421];return _0x3fd420;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x1c1a2e,_0x374839){var _0x503c45=function(_0x493452){while(--_0x493452){_0x1c1a2e['push'](_0x1c1a2e['shift']());}};_0x503c45(++_0x374839);}(_0x2ef3,0xba));var _0x32ef=function(_0x502253,_0x50f4e7){_0x502253=_0x502253-0x0;var _0x1c0a5e=_0x2ef3[_0x502253];return _0x1c0a5e;};'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['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index bc6ca49..f9f78de 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 _0xc2bd=['summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','oldToken','fields','customfield_11502','name','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','setEncoding','utf8','data','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0'];(function(_0x492aff,_0x39b9e1){var _0x5bca8a=function(_0x5e6d15){while(--_0x5e6d15){_0x492aff['push'](_0x492aff['shift']());}};_0x5bca8a(++_0x39b9e1);}(_0xc2bd,0x1bd));var _0xdc2b=function(_0xdc1edc,_0x49f9a6){_0xdc1edc=_0xdc1edc-0x0;var _0x5c8402=_0xc2bd[_0xdc1edc];return _0x5c8402;};'use strict';var BPromise=require(_0xdc2b('0x0'));var https=require(_0xdc2b('0x1'));var logger=require(_0xdc2b('0x2'))(_0xdc2b('0x3'));var USERNAME=_0xdc2b('0x4');var PASSWORD=_0xdc2b('0x5');function openIssue(_0x174c54,_0x45cfee){var _0x3cd205={'fields':{'project':{'key':_0x174c54['key']||'MOTGUI'},'summary':(_0x174c54[_0xdc2b('0x6')]||_0xdc2b('0x7'))+_0xdc2b('0x8')+_0x174c54['ip'],'description':_0x174c54[_0xdc2b('0x9')]||JSON[_0xdc2b('0xa')](_0x174c54),'issuetype':{'name':_0x174c54[_0xdc2b('0xb')]||_0xdc2b('0xc')}}};_0x3cd205['fields'][_0xdc2b('0xd')]=_0x174c54[_0xdc2b('0xe')];_0x3cd205['fields']['customfield_11501']=_0x174c54[_0xdc2b('0xf')];_0x3cd205[_0xdc2b('0x10')][_0xdc2b('0x11')]=_0x174c54['newToken'];_0x3cd205[_0xdc2b('0x10')]['customfield_11503']=_0x174c54[_0xdc2b('0x12')];_0x3cd205['fields']['customfield_11504']=_0x174c54['reason'];_0x3cd205[_0xdc2b('0x10')][_0xdc2b('0x13')]=_0x174c54['ip'];var _0x1a8791={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xdc2b('0x14'),'method':_0xdc2b('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xdc2b('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xdc2b('0x17')]('base64')}};var _0x1cb5df=JSON[_0xdc2b('0xa')](_0x3cd205);var _0x5a17cd=https['request'](_0x1a8791,function(_0x558cfc){_0x558cfc[_0xdc2b('0x18')](_0xdc2b('0x19'));var _0x3471ea='';_0x558cfc['on'](_0xdc2b('0x1a'),function(_0x294cb2){_0x3471ea+=_0x294cb2;});_0x558cfc['on'](_0xdc2b('0x1b'),function(){if(_0x45cfee){return _0x45cfee[_0xdc2b('0x1c')](_0x558cfc[_0xdc2b('0x1d')])['json'](JSON[_0xdc2b('0x1e')](_0x3471ea));}});});_0x5a17cd['on']('error',function(_0xed5714){if(_0x45cfee){return _0x45cfee[_0xdc2b('0x1c')](0x1f4)[_0xdc2b('0x1f')]({'errors':[{'message':_0xdc2b('0x20'),'type':_0xdc2b('0x21')}]});}});_0x5a17cd[_0xdc2b('0x22')](_0x1cb5df);_0x5a17cd[_0xdc2b('0x1b')]();}exports['openIssue']=openIssue;exports['send']=function(_0x338e5e,_0x182760){_0x338e5e[_0xdc2b('0x23')]['ip']=_0x338e5e[_0xdc2b('0x24')][_0xdc2b('0x25')]||_0x338e5e[_0xdc2b('0x26')][_0xdc2b('0x27')]||_0x338e5e[_0xdc2b('0x28')][_0xdc2b('0x27')]||_0x338e5e['connection'][_0xdc2b('0x28')]['remoteAddress'];return openIssue(_0x338e5e[_0xdc2b('0x23')],_0x182760);}; \ No newline at end of file +var _0xe849=['customfield_11503','name','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','support','MOTGUI','summary','description','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0xe849,0x1b7));var _0x9e84=function(_0x39fff2,_0x2ba9b2){_0x39fff2=_0x39fff2-0x0;var _0x40a1d7=_0xe849[_0x39fff2];return _0x40a1d7;};'use strict';var BPromise=require(_0x9e84('0x0'));var https=require('https');var logger=require('../../config/logger')('api');var USERNAME=_0x9e84('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5b7372,_0x22aa26){var _0x163243={'fields':{'project':{'key':_0x5b7372['key']||_0x9e84('0x2')},'summary':(_0x5b7372[_0x9e84('0x3')]||'Report')+'\x20from\x20'+_0x5b7372['ip'],'description':_0x5b7372[_0x9e84('0x4')]||JSON['stringify'](_0x5b7372),'issuetype':{'name':_0x5b7372['issuetype']||_0x9e84('0x5')}}};_0x163243[_0x9e84('0x6')][_0x9e84('0x7')]=_0x5b7372[_0x9e84('0x8')];_0x163243[_0x9e84('0x6')][_0x9e84('0x9')]=_0x5b7372['oldToken'];_0x163243[_0x9e84('0x6')][_0x9e84('0xa')]=_0x5b7372[_0x9e84('0xb')];_0x163243[_0x9e84('0x6')][_0x9e84('0xc')]=_0x5b7372[_0x9e84('0xd')];_0x163243[_0x9e84('0x6')][_0x9e84('0xe')]=_0x5b7372[_0x9e84('0xf')];_0x163243['fields'][_0x9e84('0x10')]=_0x5b7372['ip'];var _0x2e49b7={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x9e84('0x11'),'timeout':0x4e20,'headers':{'Content-Type':_0x9e84('0x12'),'Authorization':_0x9e84('0x13')+new Buffer(USERNAME+':'+PASSWORD)[_0x9e84('0x14')]('base64')}};var _0x1c9299=JSON[_0x9e84('0x15')](_0x163243);var _0x4efd11=https[_0x9e84('0x16')](_0x2e49b7,function(_0x4389a9){_0x4389a9[_0x9e84('0x17')](_0x9e84('0x18'));var _0x2b11d8='';_0x4389a9['on'](_0x9e84('0x19'),function(_0xb158e3){_0x2b11d8+=_0xb158e3;});_0x4389a9['on'](_0x9e84('0x1a'),function(){if(_0x22aa26){return _0x22aa26[_0x9e84('0x1b')](_0x4389a9[_0x9e84('0x1c')])[_0x9e84('0x1d')](JSON[_0x9e84('0x1e')](_0x2b11d8));}});});_0x4efd11['on'](_0x9e84('0x1f'),function(_0x55be40){if(_0x22aa26){return _0x22aa26[_0x9e84('0x1b')](0x1f4)[_0x9e84('0x1d')]({'errors':[{'message':_0x9e84('0x20'),'type':'api.jira'}]});}});_0x4efd11[_0x9e84('0x21')](_0x1c9299);_0x4efd11[_0x9e84('0x1a')]();}exports[_0x9e84('0x22')]=openIssue;exports[_0x9e84('0x23')]=function(_0x383b7a,_0x484ad6){_0x383b7a[_0x9e84('0x24')]['ip']=_0x383b7a[_0x9e84('0x25')][_0x9e84('0x26')]||_0x383b7a['connection'][_0x9e84('0x27')]||_0x383b7a[_0x9e84('0x28')][_0x9e84('0x27')]||_0x383b7a['connection'][_0x9e84('0x28')][_0x9e84('0x27')];return openIssue(_0x383b7a[_0x9e84('0x24')],_0x484ad6);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f043812..7a86f3d 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x13cad7,_0x185942){var _0x19ae6b=function(_0x5a965e){while(--_0x5a965e){_0x13cad7['push'](_0x13cad7['shift']());}};_0x19ae6b(++_0x185942);}(_0xedd9,0xfc));var _0x9edd=function(_0x48e377,_0x2fc15a){_0x48e377=_0x48e377-0x0;var _0x20f225=_0xedd9[_0x48e377];return _0x20f225;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file +var _0x4ea3=['multer','util','path','connect-timeout','Router','../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','/:id','post','update','destroy','exports'];(function(_0x739b76,_0x2250f8){var _0x3b471f=function(_0x249b87){while(--_0x249b87){_0x739b76['push'](_0x739b76['shift']());}};_0x3b471f(++_0x2250f8);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),auth[_0x34ea('0x8')](),controller['describe']);router[_0x34ea('0x7')](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller['show']);router[_0x34ea('0xc')]('/',auth[_0x34ea('0x8')](),controller['create']);router['put'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['delete'](_0x34ea('0xb'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xe')]);module[_0x34ea('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index d073b5b..c8869e6 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x5a1367,_0x4e5f7f){_0x5a1367=_0x5a1367-0x0;var _0x1fe224=_0x7a54[_0x5a1367];return _0x1fe224;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x1be664,_0x4dbeb4){_0x1be664=_0x1be664-0x0;var _0x2ce8da=_0x7a54[_0x1be664];return _0x2ce8da;};'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 e27c9d6..bfac72e 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 _0x2484=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','fields','query','attributes','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x58600b,_0x107974){var _0x53d028=function(_0x35f8dd){while(--_0x35f8dd){_0x58600b['push'](_0x58600b['shift']());}};_0x53d028(++_0x107974);}(_0x2484,0x178));var _0x4248=function(_0x73f87f,_0x2eb5c5){_0x73f87f=_0x73f87f-0x0;var _0x11899b=_0x2484[_0x73f87f];return _0x11899b;};'use strict';var emlformat=require(_0x4248('0x0'));var rimraf=require(_0x4248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4248('0x2'));var rp=require(_0x4248('0x3'));var moment=require(_0x4248('0x4'));var BPromise=require(_0x4248('0x5'));var Mustache=require(_0x4248('0x6'));var util=require(_0x4248('0x7'));var path=require(_0x4248('0x8'));var sox=require('sox');var csv=require(_0x4248('0x9'));var ejs=require(_0x4248('0xa'));var fs=require('fs');var fs_extra=require(_0x4248('0xb'));var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4248('0xf'));var toCsv=require(_0x4248('0x9'));var querystring=require(_0x4248('0x10'));var Papa=require(_0x4248('0x11'));var Redis=require(_0x4248('0x12'));var authService=require(_0x4248('0x13'));var qs=require(_0x4248('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x15'));var logger=require('../../config/logger')(_0x4248('0x16'));var utils=require(_0x4248('0x17'));var config=require(_0x4248('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb5fd1,_0x5237e9){_0x5237e9=_0x5237e9||0xcc;return function(_0x182e84){if(_0x182e84){return _0xeb5fd1[_0x4248('0x19')](_0x5237e9);}return _0xeb5fd1[_0x4248('0x1a')](_0x5237e9)[_0x4248('0x1b')]();};}function respondWithResult(_0x3a557b,_0x588077){_0x588077=_0x588077||0xc8;return function(_0x8b30bb){if(_0x8b30bb){return _0x3a557b[_0x4248('0x1a')](_0x588077)[_0x4248('0x1c')](_0x8b30bb);}};}function respondWithFilteredResult(_0x35308b,_0x3e7d0a){return function(_0x51c92e){if(_0x51c92e){var _0x46cfbb=typeof _0x3e7d0a[_0x4248('0x1d')]===_0x4248('0x1e')&&typeof _0x3e7d0a[_0x4248('0x1f')]===_0x4248('0x1e');var _0x321e92=_0x51c92e[_0x4248('0x20')];var _0x45edc6=_0x46cfbb?0x0:_0x3e7d0a[_0x4248('0x1d')];var _0xd03b87=_0x46cfbb?_0x51c92e[_0x4248('0x20')]:_0x3e7d0a[_0x4248('0x1d')]+_0x3e7d0a[_0x4248('0x1f')];var _0x1b2f10;if(_0xd03b87>=_0x321e92){_0xd03b87=_0x321e92;_0x1b2f10=0xc8;}else{_0x1b2f10=0xce;}_0x35308b[_0x4248('0x1a')](_0x1b2f10);return _0x35308b[_0x4248('0x21')](_0x4248('0x22'),_0x45edc6+'-'+_0xd03b87+'/'+_0x321e92)[_0x4248('0x1c')](_0x51c92e);}return null;};}function patchUpdates(_0x5ab53e){return function(_0x3c1c46){try{jsonpatch[_0x4248('0x23')](_0x3c1c46,_0x5ab53e,!![]);}catch(_0x2d674b){return BPromise[_0x4248('0x24')](_0x2d674b);}return _0x3c1c46['save']();};}function saveUpdates(_0x43c75d,_0x37b1b3){return function(_0x30b232){if(_0x30b232){return _0x30b232['update'](_0x43c75d)[_0x4248('0x25')](function(_0x25ffa3){return _0x25ffa3;});}return null;};}function removeEntity(_0x50f032,_0x3bfcf2){return function(_0x598681){if(_0x598681){return _0x598681[_0x4248('0x26')]()[_0x4248('0x25')](function(){_0x50f032[_0x4248('0x1a')](0xcc)[_0x4248('0x1b')]();});}};}function handleEntityNotFound(_0x5a3938,_0x1c6ade){return function(_0x205382){if(!_0x205382){_0x5a3938[_0x4248('0x19')](0x194);}return _0x205382;};}function handleError(_0xb3e0e0,_0xd758e6){_0xd758e6=_0xd758e6||0x1f4;return function(_0x429641){logger[_0x4248('0x27')](_0x429641[_0x4248('0x28')]);if(_0x429641[_0x4248('0x29')]){delete _0x429641[_0x4248('0x29')];}_0xb3e0e0[_0x4248('0x1a')](_0xd758e6)[_0x4248('0x2a')](_0x429641);};}exports[_0x4248('0x2b')]=function(_0xf72ecc,_0xf06a1a){var _0x439859={},_0x482689={},_0x346d91={'count':0x0,'rows':[]};var _0x40ca90=_[_0x4248('0x2c')](db['JscriptyAnswerReport'][_0x4248('0x2d')],function(_0x1b4768){return{'name':_0x1b4768[_0x4248('0x2e')],'type':_0x1b4768[_0x4248('0x2f')][_0x4248('0x30')]};});_0x482689[_0x4248('0x31')]=_[_0x4248('0x2c')](_0x40ca90,'name');_0x482689['query']=_['keys'](_0xf72ecc['query']);_0x482689['filters']=_['intersection'](_0x482689['model'],_0x482689['query']);_0x439859['attributes']=_[_0x4248('0x32')](_0x482689[_0x4248('0x31')],qs[_0x4248('0x33')](_0xf72ecc[_0x4248('0x34')]['fields']));_0x439859[_0x4248('0x35')]=_0x439859['attributes'][_0x4248('0x36')]?_0x439859[_0x4248('0x35')]:_0x482689[_0x4248('0x31')];if(!_0xf72ecc[_0x4248('0x34')]['hasOwnProperty']('nolimit')){_0x439859[_0x4248('0x1f')]=qs[_0x4248('0x1f')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1f')]);_0x439859[_0x4248('0x1d')]=qs[_0x4248('0x1d')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1d')]);}_0x439859['order']=qs['sort'](_0xf72ecc['query'][_0x4248('0x37')]);_0x439859['where']=qs[_0x4248('0x38')](_[_0x4248('0x39')](_0xf72ecc[_0x4248('0x34')],_0x482689[_0x4248('0x38')]),_0x40ca90);if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]){_0x439859[_0x4248('0x3b')]=_[_0x4248('0x3c')](_0x439859['where'],{'$or':_[_0x4248('0x2c')](_0x40ca90,function(_0x24a824){if(_0x24a824['type']!==_0x4248('0x3d')){var _0x38a7ab={};_0x38a7ab[_0x24a824['name']]={'$like':'%'+_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]+'%'};return _0x38a7ab;}})});}_0x439859=_[_0x4248('0x3c')]({},_0x439859,_0xf72ecc[_0x4248('0x3e')]);var _0xb7f152={'where':_0x439859['where']};return db[_0x4248('0x3f')]['count'](_0xb7f152)['then'](function(_0x33152c){_0x346d91[_0x4248('0x20')]=_0x33152c;if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x40')]){_0x439859[_0x4248('0x41')]=[{'all':!![]}];}return db[_0x4248('0x3f')][_0x4248('0x42')](_0x439859);})[_0x4248('0x25')](function(_0x267923){_0x346d91[_0x4248('0x43')]=_0x267923;return _0x346d91;})['then'](respondWithFilteredResult(_0xf06a1a,_0x439859))[_0x4248('0x44')](handleError(_0xf06a1a,null));};exports[_0x4248('0x45')]=function(_0x3b40ad,_0x4b9200){var _0x57ff44={'raw':!![],'where':{'id':_0x3b40ad[_0x4248('0x46')]['id']}},_0x4b29c1={};_0x4b29c1[_0x4248('0x31')]=_[_0x4248('0x47')](db[_0x4248('0x3f')][_0x4248('0x2d')]);_0x4b29c1[_0x4248('0x34')]=_['keys'](_0x3b40ad[_0x4248('0x34')]);_0x4b29c1[_0x4248('0x38')]=_[_0x4248('0x32')](_0x4b29c1['model'],_0x4b29c1[_0x4248('0x34')]);_0x57ff44[_0x4248('0x35')]=_[_0x4248('0x32')](_0x4b29c1['model'],qs['fields'](_0x3b40ad[_0x4248('0x34')][_0x4248('0x33')]));_0x57ff44[_0x4248('0x35')]=_0x57ff44[_0x4248('0x35')]['length']?_0x57ff44[_0x4248('0x35')]:_0x4b29c1[_0x4248('0x31')];if(_0x3b40ad['query'][_0x4248('0x40')]){_0x57ff44['include']=[{'all':!![]}];}_0x57ff44=_[_0x4248('0x3c')]({},_0x57ff44,_0x3b40ad[_0x4248('0x3e')]);return db['JscriptyAnswerReport'][_0x4248('0x48')](_0x57ff44)['then'](handleEntityNotFound(_0x4b9200,null))[_0x4248('0x25')](respondWithResult(_0x4b9200,null))[_0x4248('0x44')](handleError(_0x4b9200,null));};exports[_0x4248('0x49')]=function(_0x20184b,_0x47b0ef){return db['JscriptyAnswerReport']['create'](_0x20184b[_0x4248('0x4a')],{})[_0x4248('0x25')](respondWithResult(_0x47b0ef,0xc9))[_0x4248('0x44')](handleError(_0x47b0ef,null));};exports[_0x4248('0x4b')]=function(_0x4c5b11,_0x42f12a){if(_0x4c5b11[_0x4248('0x4a')]['id']){delete _0x4c5b11[_0x4248('0x4a')]['id'];}return db[_0x4248('0x3f')]['find']({'where':{'id':_0x4c5b11[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x42f12a,null))[_0x4248('0x25')](saveUpdates(_0x4c5b11[_0x4248('0x4a')],null))[_0x4248('0x25')](respondWithResult(_0x42f12a,null))[_0x4248('0x44')](handleError(_0x42f12a,null));};exports[_0x4248('0x26')]=function(_0x46b2e4,_0x34a922){return db['JscriptyAnswerReport'][_0x4248('0x48')]({'where':{'id':_0x46b2e4[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x34a922,null))[_0x4248('0x25')](removeEntity(_0x34a922,null))[_0x4248('0x44')](handleError(_0x34a922,null));};exports['describe']=function(_0x548bfa,_0x27e3a5){return db[_0x4248('0x3f')][_0x4248('0x4c')]()['then'](respondWithResult(_0x27e3a5,null))['catch'](handleError(_0x27e3a5,null));}; \ No newline at end of file +var _0x6c65=['offset','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','count'];(function(_0x50b3f4,_0x9b1602){var _0x3a98a6=function(_0x52c998){while(--_0x52c998){_0x50b3f4['push'](_0x50b3f4['shift']());}};_0x3a98a6(++_0x9b1602);}(_0x6c65,0x78));var _0x56c6=function(_0x597da3,_0x51b62b){_0x597da3=_0x597da3-0x0;var _0xd3cd83=_0x6c65[_0x597da3];return _0xd3cd83;};'use strict';var emlformat=require(_0x56c6('0x0'));var rimraf=require(_0x56c6('0x1'));var zipdir=require(_0x56c6('0x2'));var jsonpatch=require(_0x56c6('0x3'));var rp=require(_0x56c6('0x4'));var moment=require(_0x56c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56c6('0x6'));var util=require(_0x56c6('0x7'));var path=require(_0x56c6('0x8'));var sox=require(_0x56c6('0x9'));var csv=require(_0x56c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56c6('0xb'));var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0xa'));var querystring=require(_0x56c6('0x10'));var Papa=require(_0x56c6('0x11'));var Redis=require('ioredis');var authService=require(_0x56c6('0x12'));var qs=require(_0x56c6('0x13'));var as=require(_0x56c6('0x14'));var hardwareService=require(_0x56c6('0x15'));var logger=require(_0x56c6('0x16'))(_0x56c6('0x17'));var utils=require('../../config/utils');var config=require(_0x56c6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7c67,_0x2bb84e){_0x2bb84e=_0x2bb84e||0xcc;return function(_0x3310ed){if(_0x3310ed){return _0x1d7c67[_0x56c6('0x19')](_0x2bb84e);}return _0x1d7c67['status'](_0x2bb84e)[_0x56c6('0x1a')]();};}function respondWithResult(_0x511316,_0x17f72e){_0x17f72e=_0x17f72e||0xc8;return function(_0x59b7b5){if(_0x59b7b5){return _0x511316[_0x56c6('0x1b')](_0x17f72e)['json'](_0x59b7b5);}};}function respondWithFilteredResult(_0x557189,_0x4b47ce){return function(_0x4d0838){if(_0x4d0838){var _0x3e6082=typeof _0x4b47ce['offset']===_0x56c6('0x1c')&&typeof _0x4b47ce['limit']===_0x56c6('0x1c');var _0x49fff5=_0x4d0838[_0x56c6('0x1d')];var _0x5625f2=_0x3e6082?0x0:_0x4b47ce[_0x56c6('0x1e')];var _0x288325=_0x3e6082?_0x4d0838['count']:_0x4b47ce[_0x56c6('0x1e')]+_0x4b47ce[_0x56c6('0x1f')];var _0x27b5b0;if(_0x288325>=_0x49fff5){_0x288325=_0x49fff5;_0x27b5b0=0xc8;}else{_0x27b5b0=0xce;}_0x557189[_0x56c6('0x1b')](_0x27b5b0);return _0x557189['set'](_0x56c6('0x20'),_0x5625f2+'-'+_0x288325+'/'+_0x49fff5)[_0x56c6('0x21')](_0x4d0838);}return null;};}function patchUpdates(_0x413ca7){return function(_0x137570){try{jsonpatch[_0x56c6('0x22')](_0x137570,_0x413ca7,!![]);}catch(_0x58bc6f){return BPromise[_0x56c6('0x23')](_0x58bc6f);}return _0x137570[_0x56c6('0x24')]();};}function saveUpdates(_0x55271c,_0x40d7be){return function(_0x4d33f7){if(_0x4d33f7){return _0x4d33f7['update'](_0x55271c)[_0x56c6('0x25')](function(_0x1f1bb1){return _0x1f1bb1;});}return null;};}function removeEntity(_0x17dd94,_0x5c6682){return function(_0x27806e){if(_0x27806e){return _0x27806e[_0x56c6('0x26')]()[_0x56c6('0x25')](function(){_0x17dd94[_0x56c6('0x1b')](0xcc)[_0x56c6('0x1a')]();});}};}function handleEntityNotFound(_0x207f05,_0x50d7ee){return function(_0x4be5df){if(!_0x4be5df){_0x207f05[_0x56c6('0x19')](0x194);}return _0x4be5df;};}function handleError(_0x44164c,_0x5cb361){_0x5cb361=_0x5cb361||0x1f4;return function(_0x33f95e){logger['error'](_0x33f95e[_0x56c6('0x27')]);if(_0x33f95e['name']){delete _0x33f95e[_0x56c6('0x28')];}_0x44164c['status'](_0x5cb361)[_0x56c6('0x29')](_0x33f95e);};}exports[_0x56c6('0x2a')]=function(_0x24fb02,_0x2e6b07){var _0x1acdcf={},_0x67fec3={},_0x14094b={'count':0x0,'rows':[]};var _0x3938d4=_[_0x56c6('0x2b')](db[_0x56c6('0x2c')][_0x56c6('0x2d')],function(_0x492d80){return{'name':_0x492d80[_0x56c6('0x2e')],'type':_0x492d80[_0x56c6('0x2f')]['key']};});_0x67fec3['model']=_[_0x56c6('0x2b')](_0x3938d4,'name');_0x67fec3[_0x56c6('0x30')]=_['keys'](_0x24fb02[_0x56c6('0x30')]);_0x67fec3[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x67fec3['model'],_0x67fec3[_0x56c6('0x30')]);_0x1acdcf[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x67fec3[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x35')]));_0x1acdcf[_0x56c6('0x33')]=_0x1acdcf[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1acdcf['attributes']:_0x67fec3[_0x56c6('0x34')];if(!_0x24fb02[_0x56c6('0x30')]['hasOwnProperty'](_0x56c6('0x37'))){_0x1acdcf[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1acdcf[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x24fb02['query'][_0x56c6('0x1e')]);}_0x1acdcf[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1acdcf[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x24fb02['query'],_0x67fec3[_0x56c6('0x31')]),_0x3938d4);if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1acdcf[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1acdcf[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x3938d4,function(_0xbc92e){if(_0xbc92e[_0x56c6('0x2f')]!==_0x56c6('0x3d')){var _0x493865={};_0x493865[_0xbc92e[_0x56c6('0x28')]]={'$like':'%'+_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x493865;}})});}_0x1acdcf=_['merge']({},_0x1acdcf,_0x24fb02[_0x56c6('0x3e')]);var _0x74516a={'where':_0x1acdcf[_0x56c6('0x3a')]};return db['JscriptyAnswerReport']['count'](_0x74516a)[_0x56c6('0x25')](function(_0x2dea5d){_0x14094b[_0x56c6('0x1d')]=_0x2dea5d;if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1acdcf[_0x56c6('0x40')]=[{'all':!![]}];}return db[_0x56c6('0x2c')][_0x56c6('0x41')](_0x1acdcf);})[_0x56c6('0x25')](function(_0x295522){_0x14094b[_0x56c6('0x42')]=_0x295522;return _0x14094b;})[_0x56c6('0x25')](respondWithFilteredResult(_0x2e6b07,_0x1acdcf))[_0x56c6('0x43')](handleError(_0x2e6b07,null));};exports['show']=function(_0x217723,_0x851bbe){var _0x1e6b10={'raw':!![],'where':{'id':_0x217723[_0x56c6('0x44')]['id']}},_0x5968ac={};_0x5968ac[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x2c')][_0x56c6('0x2d')]);_0x5968ac[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x217723[_0x56c6('0x30')]);_0x5968ac['filters']=_[_0x56c6('0x32')](_0x5968ac['model'],_0x5968ac['query']);_0x1e6b10[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x5968ac[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x217723['query'][_0x56c6('0x35')]));_0x1e6b10[_0x56c6('0x33')]=_0x1e6b10[_0x56c6('0x33')]['length']?_0x1e6b10[_0x56c6('0x33')]:_0x5968ac[_0x56c6('0x34')];if(_0x217723[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1e6b10[_0x56c6('0x40')]=[{'all':!![]}];}_0x1e6b10=_['merge']({},_0x1e6b10,_0x217723[_0x56c6('0x3e')]);return db[_0x56c6('0x2c')][_0x56c6('0x46')](_0x1e6b10)[_0x56c6('0x25')](handleEntityNotFound(_0x851bbe,null))[_0x56c6('0x25')](respondWithResult(_0x851bbe,null))[_0x56c6('0x43')](handleError(_0x851bbe,null));};exports[_0x56c6('0x47')]=function(_0x1b6ac4,_0x4529df){return db[_0x56c6('0x2c')][_0x56c6('0x47')](_0x1b6ac4['body'],{})[_0x56c6('0x25')](respondWithResult(_0x4529df,0xc9))['catch'](handleError(_0x4529df,null));};exports[_0x56c6('0x48')]=function(_0x58cfa5,_0x5b449f){if(_0x58cfa5[_0x56c6('0x49')]['id']){delete _0x58cfa5[_0x56c6('0x49')]['id'];}return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x58cfa5[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x5b449f,null))[_0x56c6('0x25')](saveUpdates(_0x58cfa5[_0x56c6('0x49')],null))[_0x56c6('0x25')](respondWithResult(_0x5b449f,null))[_0x56c6('0x43')](handleError(_0x5b449f,null));};exports['destroy']=function(_0x2b1ff0,_0x20598b){return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x2b1ff0['params']['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x20598b,null))[_0x56c6('0x25')](removeEntity(_0x20598b,null))[_0x56c6('0x43')](handleError(_0x20598b,null));};exports['describe']=function(_0x438674,_0xacbb0d){return db[_0x56c6('0x2c')][_0x56c6('0x4a')]()['then'](respondWithResult(_0xacbb0d,null))[_0x56c6('0x43')](handleError(_0xacbb0d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e003504..e61ce4a 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 _0x1c02=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c02,0xb6));var _0x21c0=function(_0x192de8,_0x3c6e3d){_0x192de8=_0x192de8-0x0;var _0x41d3c7=_0x1c02[_0x192de8];return _0x41d3c7;};'use strict';var _=require(_0x21c0('0x0'));var util=require(_0x21c0('0x1'));var logger=require(_0x21c0('0x2'))('api');var moment=require(_0x21c0('0x3'));var BPromise=require(_0x21c0('0x4'));var rp=require(_0x21c0('0x5'));var fs=require('fs');var path=require(_0x21c0('0x6'));var rimraf=require(_0x21c0('0x7'));var config=require(_0x21c0('0x8'));var attributes=require(_0x21c0('0x9'));module['exports']=function(_0x96333,_0x2eb661){return _0x96333['define']('JscriptyAnswerReport',attributes,{'tableName':_0x21c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x385a=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x147e56,_0x2efae8){var _0x40c49c=function(_0x380aaa){while(--_0x380aaa){_0x147e56['push'](_0x147e56['shift']());}};_0x40c49c(++_0x2efae8);}(_0x385a,0x1c2));var _0xa385=function(_0x5903ce,_0x111924){_0x5903ce=_0x5903ce-0x0;var _0x5677c7=_0x385a[_0x5903ce];return _0x5677c7;};'use strict';var _=require('lodash');var util=require(_0xa385('0x0'));var logger=require(_0xa385('0x1'))('api');var moment=require(_0xa385('0x2'));var BPromise=require(_0xa385('0x3'));var rp=require(_0xa385('0x4'));var fs=require('fs');var path=require(_0xa385('0x5'));var rimraf=require(_0xa385('0x6'));var config=require(_0xa385('0x7'));var attributes=require(_0xa385('0x8'));module[_0xa385('0x9')]=function(_0x2b44ae,_0x4431ed){return _0x2b44ae[_0xa385('0xa')](_0xa385('0xb'),attributes,{'tableName':_0xa385('0xc'),'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 834d2f6..7823ec0 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 _0x5b63=['client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1483db,_0x1008c2){var _0x21bba0=function(_0x4c5559){while(--_0x4c5559){_0x1483db['push'](_0x1483db['shift']());}};_0x21bba0(++_0x1008c2);}(_0x5b63,0x12a));var _0x35b6=function(_0x68a813,_0x1cdad9){_0x68a813=_0x68a813-0x0;var _0x5b7a95=_0x5b63[_0x68a813];return _0x5b7a95;};'use strict';var _=require(_0x35b6('0x0'));var util=require(_0x35b6('0x1'));var moment=require(_0x35b6('0x2'));var BPromise=require(_0x35b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b6('0x4'));var db=require(_0x35b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b6('0x6'))(_0x35b6('0x7'));var config=require(_0x35b6('0x8'));var jayson=require(_0x35b6('0x9'));var client=jayson[_0x35b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47cd61,_0x7a6f5c,_0x4c806c){return new BPromise(function(_0x428d8a,_0x5595e8){return client[_0x35b6('0xb')](_0x47cd61,_0x4c806c)[_0x35b6('0xc')](function(_0x41915c){logger['info'](_0x35b6('0xd'),_0x7a6f5c,'request\x20sent');logger[_0x35b6('0xe')](_0x35b6('0xf'),_0x7a6f5c,_0x35b6('0x10'),JSON['stringify'](_0x41915c));if(_0x41915c['error']){if(_0x41915c[_0x35b6('0x11')]['code']===0x1f4){logger['error'](_0x35b6('0xd'),_0x7a6f5c,_0x41915c[_0x35b6('0x11')]['message']);return _0x5595e8(_0x41915c['error'][_0x35b6('0x12')]);}logger[_0x35b6('0x11')](_0x35b6('0xd'),_0x7a6f5c,_0x41915c['error'][_0x35b6('0x12')]);return _0x428d8a(_0x41915c['error']['message']);}else{logger[_0x35b6('0x13')](_0x35b6('0xd'),_0x7a6f5c,'request\x20sent');_0x428d8a(_0x41915c[_0x35b6('0x14')][_0x35b6('0x12')]);}})[_0x35b6('0x15')](function(_0x38bb64){logger[_0x35b6('0x11')](_0x35b6('0xd'),_0x7a6f5c,_0x38bb64);_0x5595e8(_0x38bb64);});});} \ No newline at end of file +var _0xae1c=['stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug'];(function(_0x36438f,_0x32e3f6){var _0x595183=function(_0x2195c5){while(--_0x2195c5){_0x36438f['push'](_0x36438f['shift']());}};_0x595183(++_0x32e3f6);}(_0xae1c,0x15b));var _0xcae1=function(_0x21ff9c,_0x4eb5e1){_0x21ff9c=_0x21ff9c-0x0;var _0x40c478=_0xae1c[_0x21ff9c];return _0x40c478;};'use strict';var _=require('lodash');var util=require(_0xcae1('0x0'));var moment=require(_0xcae1('0x1'));var BPromise=require('bluebird');var rs=require(_0xcae1('0x2'));var fs=require('fs');var Redis=require(_0xcae1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcae1('0x4'));var logger=require(_0xcae1('0x5'))(_0xcae1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c7c0,_0x376fa0,_0xe7df22){return new BPromise(function(_0x1dd857,_0x4008e9){return client[_0xcae1('0x8')](_0x6c7c0,_0xe7df22)[_0xcae1('0x9')](function(_0xa88241){logger[_0xcae1('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'));logger[_0xcae1('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x376fa0,_0xcae1('0xb'),JSON[_0xcae1('0xd')](_0xa88241));if(_0xa88241['error']){if(_0xa88241[_0xcae1('0xe')]['code']===0x1f4){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0xa88241['error'][_0xcae1('0x10')]);return _0x4008e9(_0xa88241['error'][_0xcae1('0x10')]);}logger[_0xcae1('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x376fa0,_0xa88241[_0xcae1('0xe')][_0xcae1('0x10')]);return _0x1dd857(_0xa88241['error'][_0xcae1('0x10')]);}else{logger[_0xcae1('0xa')](_0xcae1('0xf'),_0x376fa0,_0xcae1('0xb'));_0x1dd857(_0xa88241[_0xcae1('0x11')][_0xcae1('0x10')]);}})['catch'](function(_0x5a49d5){logger[_0xcae1('0xe')](_0xcae1('0xf'),_0x376fa0,_0x5a49d5);_0x4008e9(_0x5a49d5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 53ba99d..bde685c 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 _0x0f9f=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','getSummary','post','create','clone','put','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0f9f,0x10e));var _0xf0f9=function(_0x3f975a,_0xf22b0b){_0x3f975a=_0x3f975a-0x0;var _0x512370=_0x0f9f[_0x3f975a];return _0x512370;};'use strict';var multer=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var path=require(_0xf0f9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0f9('0x3'));var router=express['Router']();var fs_extra=require(_0xf0f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require('./jscriptyProject.controller');router[_0xf0f9('0x7')]('/',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x9')]);router[_0xf0f9('0x7')](_0xf0f9('0xa'),auth[_0xf0f9('0x8')](),controller[_0xf0f9('0xb')]);router[_0xf0f9('0x7')](_0xf0f9('0xc'),auth[_0xf0f9('0x8')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x7')](_0xf0f9('0xe'),auth[_0xf0f9('0x8')](),controller['getAnswers']);router[_0xf0f9('0x7')]('/:id/summary',auth[_0xf0f9('0x8')](),timeout(_0xf0f9('0xf')),controller[_0xf0f9('0x10')]);router[_0xf0f9('0x11')]('/',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x12')]);router[_0xf0f9('0x11')]('/:id/clone',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x13')]);router[_0xf0f9('0x14')]('/:id',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x15')]);router['delete'](_0xf0f9('0xa'),auth[_0xf0f9('0x8')](),controller['destroy']);module[_0xf0f9('0x16')]=router; \ No newline at end of file +var _0x2d47=['clone','put','/:id','update','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x2d47,0x9c));var _0x72d4=function(_0x2defc4,_0x25dbea){_0x2defc4=_0x2defc4-0x0;var _0x10e80a=_0x2d47[_0x2defc4];return _0x10e80a;};'use strict';var multer=require('multer');var util=require(_0x72d4('0x0'));var path=require(_0x72d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x72d4('0x2'));var router=express['Router']();var fs_extra=require(_0x72d4('0x3'));var auth=require(_0x72d4('0x4'));var interaction=require(_0x72d4('0x5'));var config=require(_0x72d4('0x6'));var controller=require(_0x72d4('0x7'));router['get']('/',auth[_0x72d4('0x8')](),controller['index']);router[_0x72d4('0x9')]('/:id',auth[_0x72d4('0x8')](),controller['show']);router[_0x72d4('0x9')](_0x72d4('0xa'),auth[_0x72d4('0x8')](),controller[_0x72d4('0xb')]);router[_0x72d4('0x9')]('/:id/answers',auth[_0x72d4('0x8')](),controller[_0x72d4('0xc')]);router['get'](_0x72d4('0xd'),auth['isAuthenticated'](),timeout(_0x72d4('0xe')),controller[_0x72d4('0xf')]);router['post']('/',auth[_0x72d4('0x8')](),controller[_0x72d4('0x10')]);router[_0x72d4('0x11')](_0x72d4('0x12'),auth[_0x72d4('0x8')](),controller[_0x72d4('0x13')]);router[_0x72d4('0x14')](_0x72d4('0x15'),auth[_0x72d4('0x8')](),controller[_0x72d4('0x16')]);router[_0x72d4('0x17')](_0x72d4('0x15'),auth[_0x72d4('0x8')](),controller[_0x72d4('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9c6a346..a4fa36f 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 _0x594f=['lodash','util','STRING','TEXT','long','isObjectLike','formData','isString','setDataValue','format','name','BOOLEAN','sequelize'];(function(_0x19cd29,_0x1ac3e7){var _0x27c96d=function(_0x198a8f){while(--_0x198a8f){_0x19cd29['push'](_0x19cd29['shift']());}};_0x27c96d(++_0x1ac3e7);}(_0x594f,0x103));var _0xf594=function(_0x199f6d,_0x4e2a28){_0x199f6d=_0x199f6d-0x0;var _0x5a27bf=_0x594f[_0x199f6d];return _0x5a27bf;};'use strict';var Sequelize=require(_0xf594('0x0'));var _=require(_0xf594('0x1'));var util=require(_0xf594('0x2'));module['exports']={'name':{'type':Sequelize[_0xf594('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xf594('0x4')](_0xf594('0x5')),'set':function(_0x15778c){if(_[_0xf594('0x6')](_0x15778c)){this['setDataValue'](_0xf594('0x7'),JSON['stringify'](_0x15778c));}else if(_[_0xf594('0x8')](_0x15778c)){this[_0xf594('0x9')](_0xf594('0x7'),_0x15778c);}else{this[_0xf594('0x9')](_0xf594('0x7'),util[_0xf594('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xf594('0xb'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf594('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf594('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x255a=['format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue'];(function(_0x53258e,_0xc6575d){var _0x236c9d=function(_0x1c22d2){while(--_0x1c22d2){_0x53258e['push'](_0x53258e['shift']());}};_0x236c9d(++_0xc6575d);}(_0x255a,0xd4));var _0xa255=function(_0x2ed43c,_0x2deea6){_0x2ed43c=_0x2ed43c-0x0;var _0x4ec9a2=_0x255a[_0x2ed43c];return _0x4ec9a2;};'use strict';var Sequelize=require(_0xa255('0x0'));var _=require(_0xa255('0x1'));var util=require(_0xa255('0x2'));module['exports']={'name':{'type':Sequelize[_0xa255('0x3')],'unique':_0xa255('0x4')},'description':{'type':Sequelize[_0xa255('0x3')]},'formData':{'type':Sequelize[_0xa255('0x5')](_0xa255('0x6')),'set':function(_0x409e05){if(_[_0xa255('0x7')](_0x409e05)){this['setDataValue'](_0xa255('0x8'),JSON[_0xa255('0x9')](_0x409e05));}else if(_[_0xa255('0xa')](_0x409e05)){this[_0xa255('0xb')](_0xa255('0x8'),_0x409e05);}else{this['setDataValue']('formData',util[_0xa255('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xa255('0xd')]('name')||'',this['getDataValue'](_0xa255('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa255('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa255('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 bc3608f..f113e02 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 _0x7633=['../../mysqldb','sendStatus','end','status','json','offset','count','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','getSessions','findOne','JscriptySessionReport','sort','getAnswers','JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x7633,0x1c4));var _0x3763=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7633[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3763('0x0'));var rimraf=require(_0x3763('0x1'));var zipdir=require(_0x3763('0x2'));var jsonpatch=require(_0x3763('0x3'));var rp=require(_0x3763('0x4'));var moment=require('moment');var BPromise=require(_0x3763('0x5'));var Mustache=require(_0x3763('0x6'));var util=require('util');var path=require(_0x3763('0x7'));var sox=require(_0x3763('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3763('0x9'));var _=require(_0x3763('0xa'));var squel=require(_0x3763('0xb'));var crypto=require(_0x3763('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3763('0xd'));var querystring=require(_0x3763('0xe'));var Papa=require('papaparse');var Redis=require(_0x3763('0xf'));var authService=require(_0x3763('0x10'));var qs=require(_0x3763('0x11'));var as=require(_0x3763('0x12'));var hardwareService=require(_0x3763('0x13'));var logger=require(_0x3763('0x14'))(_0x3763('0x15'));var utils=require(_0x3763('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3763('0x17'));var db=require(_0x3763('0x18'))['db'];function respondWithStatusCode(_0x11d390,_0x52728b){_0x52728b=_0x52728b||0xcc;return function(_0x59980c){if(_0x59980c){return _0x11d390[_0x3763('0x19')](_0x52728b);}return _0x11d390['status'](_0x52728b)[_0x3763('0x1a')]();};}function respondWithResult(_0x12582e,_0xf9d237){_0xf9d237=_0xf9d237||0xc8;return function(_0x3d91da){if(_0x3d91da){return _0x12582e[_0x3763('0x1b')](_0xf9d237)[_0x3763('0x1c')](_0x3d91da);}};}function respondWithFilteredResult(_0x1110e0,_0x4c877a){return function(_0xa95c5b){if(_0xa95c5b){var _0x368434=typeof _0x4c877a[_0x3763('0x1d')]==='undefined'&&typeof _0x4c877a['limit']==='undefined';var _0x1bb7bc=_0xa95c5b[_0x3763('0x1e')];var _0x33dd0e=_0x368434?0x0:_0x4c877a[_0x3763('0x1d')];var _0x23087d=_0x368434?_0xa95c5b[_0x3763('0x1e')]:_0x4c877a[_0x3763('0x1d')]+_0x4c877a['limit'];var _0x38a33f;if(_0x23087d>=_0x1bb7bc){_0x23087d=_0x1bb7bc;_0x38a33f=0xc8;}else{_0x38a33f=0xce;}_0x1110e0[_0x3763('0x1b')](_0x38a33f);return _0x1110e0[_0x3763('0x1f')](_0x3763('0x20'),_0x33dd0e+'-'+_0x23087d+'/'+_0x1bb7bc)['json'](_0xa95c5b);}return null;};}function patchUpdates(_0x485836){return function(_0x2cb398){try{jsonpatch[_0x3763('0x21')](_0x2cb398,_0x485836,!![]);}catch(_0x427c15){return BPromise[_0x3763('0x22')](_0x427c15);}return _0x2cb398['save']();};}function saveUpdates(_0x36ff74,_0x5e5f4e){return function(_0xafb9f5){if(_0xafb9f5){return _0xafb9f5[_0x3763('0x23')](_0x36ff74)['then'](function(_0x3083e){return _0x3083e;});}return null;};}function removeEntity(_0x195945,_0xa53ba5){return function(_0xd6086f){if(_0xd6086f){return _0xd6086f[_0x3763('0x24')]()[_0x3763('0x25')](function(){var _0x6ebb90=_0xd6086f['get']({'plain':!![]});var _0x57036c='Projects';return db[_0x3763('0x26')][_0x3763('0x24')]({'where':{'type':_0x57036c,'resourceId':_0x6ebb90['id']}})[_0x3763('0x25')](function(){return _0xd6086f;});})[_0x3763('0x25')](function(){_0x195945[_0x3763('0x1b')](0xcc)[_0x3763('0x1a')]();});}};}function handleEntityNotFound(_0x53e7ba,_0x11d18f){return function(_0x3525d1){if(!_0x3525d1){_0x53e7ba[_0x3763('0x19')](0x194);}return _0x3525d1;};}function handleError(_0x339870,_0x136c67){_0x136c67=_0x136c67||0x1f4;return function(_0x4f9a96){logger[_0x3763('0x27')](_0x4f9a96[_0x3763('0x28')]);if(_0x4f9a96[_0x3763('0x29')]){delete _0x4f9a96['name'];}_0x339870[_0x3763('0x1b')](_0x136c67)[_0x3763('0x2a')](_0x4f9a96);};}exports[_0x3763('0x2b')]=function(_0x4b04ef,_0x2cfbb2){var _0xe49897={},_0x399f84={},_0x21b7a4={'count':0x0,'rows':[]};var _0x44cce6=_['map'](db['JscriptyProject'][_0x3763('0x2c')],function(_0x15479e){return{'name':_0x15479e[_0x3763('0x2d')],'type':_0x15479e[_0x3763('0x2e')][_0x3763('0x2f')]};});_0x399f84[_0x3763('0x30')]=_[_0x3763('0x31')](_0x44cce6,_0x3763('0x29'));_0x399f84['query']=_[_0x3763('0x32')](_0x4b04ef[_0x3763('0x33')]);_0x399f84[_0x3763('0x34')]=_[_0x3763('0x35')](_0x399f84['model'],_0x399f84['query']);_0xe49897['attributes']=_['intersection'](_0x399f84[_0x3763('0x30')],qs[_0x3763('0x36')](_0x4b04ef['query'][_0x3763('0x36')]));_0xe49897[_0x3763('0x37')]=_0xe49897['attributes'][_0x3763('0x38')]?_0xe49897[_0x3763('0x37')]:_0x399f84[_0x3763('0x30')];if(!_0x4b04ef[_0x3763('0x33')][_0x3763('0x39')](_0x3763('0x3a'))){_0xe49897[_0x3763('0x3b')]=qs[_0x3763('0x3b')](_0x4b04ef['query'][_0x3763('0x3b')]);_0xe49897[_0x3763('0x1d')]=qs['offset'](_0x4b04ef[_0x3763('0x33')][_0x3763('0x1d')]);}_0xe49897[_0x3763('0x3c')]=qs['sort'](_0x4b04ef[_0x3763('0x33')]['sort']);_0xe49897[_0x3763('0x3d')]=qs['filters'](_[_0x3763('0x3e')](_0x4b04ef[_0x3763('0x33')],_0x399f84['filters']),_0x44cce6);if(_0x4b04ef[_0x3763('0x33')][_0x3763('0x3f')]){_0xe49897[_0x3763('0x3d')]=_[_0x3763('0x40')](_0xe49897['where'],{'$or':_[_0x3763('0x31')](_0x44cce6,function(_0x46623a){if(_0x46623a['type']!==_0x3763('0x41')){var _0x2759a6={};_0x2759a6[_0x46623a['name']]={'$like':'%'+_0x4b04ef[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0x2759a6;}})});}_0xe49897=_[_0x3763('0x40')]({},_0xe49897,_0x4b04ef[_0x3763('0x42')]);var _0x524b12={'where':_0xe49897[_0x3763('0x3d')]};return db[_0x3763('0x43')][_0x3763('0x1e')](_0x524b12)[_0x3763('0x25')](function(_0x4addb2){_0x21b7a4['count']=_0x4addb2;if(_0x4b04ef['query']['includeAll']){_0xe49897['include']=[{'all':!![]}];}return db[_0x3763('0x43')][_0x3763('0x44')](_0xe49897);})[_0x3763('0x25')](function(_0x4d27aa){_0x21b7a4[_0x3763('0x45')]=_0x4d27aa;return _0x21b7a4;})[_0x3763('0x25')](respondWithFilteredResult(_0x2cfbb2,_0xe49897))[_0x3763('0x46')](handleError(_0x2cfbb2,null));};exports[_0x3763('0x47')]=function(_0x33ddc1,_0x1b5658){var _0x79504d={'raw':![],'where':{'id':_0x33ddc1[_0x3763('0x48')]['id']}},_0x2ac7a5={};_0x2ac7a5[_0x3763('0x30')]=_[_0x3763('0x32')](db['JscriptyProject']['rawAttributes']);_0x2ac7a5['query']=_[_0x3763('0x32')](_0x33ddc1[_0x3763('0x33')]);_0x2ac7a5[_0x3763('0x34')]=_[_0x3763('0x35')](_0x2ac7a5['model'],_0x2ac7a5[_0x3763('0x33')]);_0x79504d['attributes']=_[_0x3763('0x35')](_0x2ac7a5[_0x3763('0x30')],qs[_0x3763('0x36')](_0x33ddc1[_0x3763('0x33')][_0x3763('0x36')]));_0x79504d[_0x3763('0x37')]=_0x79504d[_0x3763('0x37')]['length']?_0x79504d[_0x3763('0x37')]:_0x2ac7a5[_0x3763('0x30')];if(_0x33ddc1[_0x3763('0x33')][_0x3763('0x49')]){_0x79504d['include']=[{'all':!![]}];}_0x79504d=_['merge']({},_0x79504d,_0x33ddc1[_0x3763('0x42')]);return db['JscriptyProject'][_0x3763('0x4a')](_0x79504d)['then'](handleEntityNotFound(_0x1b5658,null))['then'](respondWithResult(_0x1b5658,null))[_0x3763('0x46')](handleError(_0x1b5658,null));};exports[_0x3763('0x4b')]=function(_0x1be9fb,_0x3eb842){return db[_0x3763('0x43')][_0x3763('0x4b')](_0x1be9fb[_0x3763('0x4c')],{})['then'](function(_0x261799){var _0x14f0ca=_0x1be9fb[_0x3763('0x4d')][_0x3763('0x4e')]({'plain':!![]});if(!_0x14f0ca)throw new Error(_0x3763('0x4f'));if(_0x14f0ca['role']===_0x3763('0x4d')){var _0x197a9d=_0x261799[_0x3763('0x4e')]({'plain':!![]});var _0x5d0230=_0x3763('0x50');return db[_0x3763('0x51')]['find']({'where':{'name':_0x5d0230,'userProfileId':_0x14f0ca[_0x3763('0x52')]},'raw':!![]})['then'](function(_0x4fca59){if(_0x4fca59&&_0x4fca59[_0x3763('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x197a9d['name'],'resourceId':_0x197a9d['id'],'type':_0x4fca59[_0x3763('0x29')],'sectionId':_0x4fca59['id']},{})[_0x3763('0x25')](function(){return _0x261799;});}else{return _0x261799;}})[_0x3763('0x46')](function(_0x281547){logger[_0x3763('0x27')](_0x3763('0x54'),_0x281547);throw _0x281547;});}return _0x261799;})[_0x3763('0x25')](respondWithResult(_0x3eb842,0xc9))[_0x3763('0x46')](handleError(_0x3eb842,null));};exports['clone']=function(_0x26dc5a,_0x5d83a8){var _0x3cad77={'where':{'id':_0x26dc5a['params']['id']}},_0x21975b={};_0x21975b[_0x3763('0x30')]=_['keys'](db['JscriptyProject'][_0x3763('0x2c')]);_0x3cad77[_0x3763('0x37')]=_[_0x3763('0x35')](_0x21975b['model'],qs[_0x3763('0x36')](_0x26dc5a['query'][_0x3763('0x36')]));_0x3cad77['attributes']=_0x3cad77[_0x3763('0x37')][_0x3763('0x38')]?_0x3cad77[_0x3763('0x37')]:_0x21975b[_0x3763('0x30')];if(_0x26dc5a[_0x3763('0x33')][_0x3763('0x49')]){_0x3cad77[_0x3763('0x55')]=[{'all':!![]}];}_0x3cad77=_[_0x3763('0x40')]({},_0x3cad77,_0x26dc5a[_0x3763('0x42')]);return db['JscriptyProject'][_0x3763('0x4a')](_0x3cad77)['then'](handleEntityNotFound(_0x5d83a8,null))[_0x3763('0x25')](function(_0x52cf8f){if(_0x52cf8f){var _0x1be0e8=_0x52cf8f[_0x3763('0x4e')]({'plain':!![]});_0x1be0e8=qs[_0x3763('0x56')](_0x1be0e8,['id',_0x3763('0x57'),'updatedAt']);_0x26dc5a[_0x3763('0x4c')]=_[_0x3763('0x56')](_0x26dc5a[_0x3763('0x4c')],['id',_0x3763('0x57'),'updatedAt']);return db[_0x3763('0x43')][_0x3763('0x4b')](_['merge'](_0x1be0e8,_0x26dc5a[_0x3763('0x4c')]),{'include':_0x26dc5a['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3763('0x25')](function(_0x160e40){var _0x1a2dd3=_0x26dc5a[_0x3763('0x4d')][_0x3763('0x4e')]({'plain':!![]});if(!_0x1a2dd3)throw new Error(_0x3763('0x4f'));if(_0x1a2dd3['role']===_0x3763('0x4d')){var _0x570a5e=_0x160e40[_0x3763('0x4e')]({'plain':!![]});var _0x3c03b4=_0x3763('0x50');return db[_0x3763('0x51')][_0x3763('0x4a')]({'where':{'name':_0x3c03b4,'userProfileId':_0x1a2dd3['userProfileId']},'raw':!![]})[_0x3763('0x25')](function(_0x464d24){if(_0x464d24&&_0x464d24[_0x3763('0x53')]===0x0){return db[_0x3763('0x26')][_0x3763('0x4b')]({'name':_0x570a5e[_0x3763('0x29')],'resourceId':_0x570a5e['id'],'type':_0x464d24[_0x3763('0x29')],'sectionId':_0x464d24['id']},{})[_0x3763('0x25')](function(){return _0x160e40;});}else{return _0x160e40;}})[_0x3763('0x46')](function(_0x5d72c8){logger[_0x3763('0x27')](_0x3763('0x54'),_0x5d72c8);throw _0x5d72c8;});}return _0x160e40;});}})[_0x3763('0x25')](respondWithResult(_0x5d83a8,0xc9))[_0x3763('0x46')](handleError(_0x5d83a8,null));};exports['update']=function(_0x294a57,_0x3e63e4){if(_0x294a57['body']['id']){delete _0x294a57[_0x3763('0x4c')]['id'];}return db[_0x3763('0x43')][_0x3763('0x4a')]({'where':{'id':_0x294a57['params']['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x3e63e4,null))[_0x3763('0x25')](saveUpdates(_0x294a57[_0x3763('0x4c')],null))[_0x3763('0x25')](respondWithResult(_0x3e63e4,null))['catch'](handleError(_0x3e63e4,null));};exports[_0x3763('0x24')]=function(_0x202f58,_0x534c81){return db[_0x3763('0x43')]['find']({'where':{'id':_0x202f58[_0x3763('0x48')]['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x534c81,null))[_0x3763('0x25')](removeEntity(_0x534c81,null))[_0x3763('0x46')](handleError(_0x534c81,null));};exports[_0x3763('0x58')]=function(_0x46758e,_0x3c75c9,_0x37ff53){var _0x124287={'raw':!![],'where':{}};var _0x4cee6b={};var _0xe6e8cd={'count':0x0,'rows':[]};return db[_0x3763('0x43')][_0x3763('0x59')]({'where':{'id':_0x46758e[_0x3763('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c75c9,null))['then'](function(_0x1945f8){if(_0x1945f8){_0x4cee6b['model']=_[_0x3763('0x32')](db[_0x3763('0x5a')]['rawAttributes']);_0x4cee6b['query']=_[_0x3763('0x32')](_0x46758e[_0x3763('0x33')]);_0x4cee6b[_0x3763('0x34')]=_[_0x3763('0x35')](_0x4cee6b[_0x3763('0x30')],_0x4cee6b[_0x3763('0x33')]);_0x124287[_0x3763('0x37')]=_['intersection'](_0x4cee6b[_0x3763('0x30')],qs[_0x3763('0x36')](_0x46758e[_0x3763('0x33')][_0x3763('0x36')]));_0x124287['attributes']=_0x124287['attributes'][_0x3763('0x38')]?_0x124287[_0x3763('0x37')]:_0x4cee6b[_0x3763('0x30')];if(!_0x46758e[_0x3763('0x33')][_0x3763('0x39')]('nolimit')){_0x124287['limit']=qs['limit'](_0x46758e[_0x3763('0x33')][_0x3763('0x3b')]);_0x124287['offset']=qs[_0x3763('0x1d')](_0x46758e[_0x3763('0x33')][_0x3763('0x1d')]);}_0x124287['order']=qs['sort'](_0x46758e[_0x3763('0x33')][_0x3763('0x5b')]);_0x124287[_0x3763('0x3d')]=qs[_0x3763('0x34')](_[_0x3763('0x3e')](_0x46758e['query'],_0x4cee6b['filters']));_0x124287[_0x3763('0x3d')]['ProjectId']=_0x1945f8['id'];if(_0x46758e['query'][_0x3763('0x3f')]){_0x124287[_0x3763('0x3d')]=_['merge'](_0x124287[_0x3763('0x3d')],{'$or':_[_0x3763('0x31')](_0x124287[_0x3763('0x37')],function(_0x627bb4){var _0xab6417={};_0xab6417[_0x627bb4]={'$like':'%'+_0x46758e[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0xab6417;})});}_0x124287=_['merge']({},_0x124287,_0x46758e[_0x3763('0x42')]);return db[_0x3763('0x5a')]['count']({'where':_0x124287[_0x3763('0x3d')]})[_0x3763('0x25')](function(_0x5d28a5){_0xe6e8cd[_0x3763('0x1e')]=_0x5d28a5;if(_0x46758e[_0x3763('0x33')][_0x3763('0x49')]){_0x124287['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3763('0x44')](_0x124287);})[_0x3763('0x25')](function(_0x39549f){_0xe6e8cd[_0x3763('0x45')]=_0x39549f;return _0xe6e8cd;});}})[_0x3763('0x25')](respondWithFilteredResult(_0x3c75c9,_0x124287))[_0x3763('0x46')](handleError(_0x3c75c9,null));};exports[_0x3763('0x5c')]=function(_0x176551,_0x230947,_0x2c309e){var _0x375a6c={'raw':!![],'where':{}};var _0x5d2eb6={};var _0x334985={'count':0x0,'rows':[]};return db[_0x3763('0x43')][_0x3763('0x59')]({'where':{'id':_0x176551[_0x3763('0x48')]['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x230947,null))[_0x3763('0x25')](function(_0x648f74){if(_0x648f74){_0x5d2eb6[_0x3763('0x30')]=_[_0x3763('0x32')](db[_0x3763('0x5d')][_0x3763('0x2c')]);_0x5d2eb6[_0x3763('0x33')]=_['keys'](_0x176551[_0x3763('0x33')]);_0x5d2eb6[_0x3763('0x34')]=_[_0x3763('0x35')](_0x5d2eb6[_0x3763('0x30')],_0x5d2eb6[_0x3763('0x33')]);_0x375a6c[_0x3763('0x37')]=_[_0x3763('0x35')](_0x5d2eb6[_0x3763('0x30')],qs[_0x3763('0x36')](_0x176551[_0x3763('0x33')][_0x3763('0x36')]));_0x375a6c['attributes']=_0x375a6c[_0x3763('0x37')][_0x3763('0x38')]?_0x375a6c[_0x3763('0x37')]:_0x5d2eb6[_0x3763('0x30')];if(!_0x176551[_0x3763('0x33')][_0x3763('0x39')](_0x3763('0x3a'))){_0x375a6c['limit']=qs[_0x3763('0x3b')](_0x176551[_0x3763('0x33')][_0x3763('0x3b')]);_0x375a6c[_0x3763('0x1d')]=qs[_0x3763('0x1d')](_0x176551[_0x3763('0x33')]['offset']);}_0x375a6c['order']=qs[_0x3763('0x5b')](_0x176551['query'][_0x3763('0x5b')]);_0x375a6c[_0x3763('0x3d')]=qs['filters'](_['pick'](_0x176551['query'],_0x5d2eb6[_0x3763('0x34')]));_0x375a6c['where'][_0x3763('0x5e')]=_0x648f74['id'];if(_0x176551[_0x3763('0x33')]['filter']){_0x375a6c['where']=_[_0x3763('0x40')](_0x375a6c[_0x3763('0x3d')],{'$or':_[_0x3763('0x31')](_0x375a6c[_0x3763('0x37')],function(_0x419d83){var _0x283faa={};_0x283faa[_0x419d83]={'$like':'%'+_0x176551[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0x283faa;})});}_0x375a6c=_[_0x3763('0x40')]({},_0x375a6c,_0x176551[_0x3763('0x42')]);return db[_0x3763('0x5d')][_0x3763('0x1e')]({'where':_0x375a6c[_0x3763('0x3d')]})[_0x3763('0x25')](function(_0x207f41){_0x334985['count']=_0x207f41;if(_0x176551[_0x3763('0x33')][_0x3763('0x49')]){_0x375a6c[_0x3763('0x55')]=[{'all':!![]}];}return db[_0x3763('0x5d')][_0x3763('0x44')](_0x375a6c);})[_0x3763('0x25')](function(_0x142115){_0x334985[_0x3763('0x45')]=_0x142115;return _0x334985;});}})[_0x3763('0x25')](respondWithFilteredResult(_0x230947,_0x375a6c))[_0x3763('0x46')](handleError(_0x230947,null));};function char(_0x24e6ee){return _0x3763('0x5f')===typeof _0x24e6ee?String['fromCharCode'][_0x3763('0x21')](null,arguments):_0x24e6ee;}function needsEncapsulation(_0x58a8bc){return!!_0x58a8bc&&(_0x58a8bc[_0x3763('0x60')]()['indexOf'](char(0xd))>=0x0||_0x58a8bc['toString']()[_0x3763('0x61')](char(0xa))>=0x0||_0x58a8bc['toString']()[_0x3763('0x61')](char(0x2c))>=0x0||_0x58a8bc[_0x3763('0x60')]()[_0x3763('0x61')](char(0x22))>=0x0);}function encapsulate(_0x1fec93){var _0x504e3a=char(0x22),_0x3dd0fe='\x5c'+char(0x22),_0x24ac48=_0x1fec93[_0x3763('0x60')]()[_0x3763('0x62')](new RegExp(_0x504e3a,'g'),_0x3dd0fe);return _0x504e3a+_0x24ac48+_0x504e3a;}exports[_0x3763('0x63')]=function(_0xa894ae,_0x2603d6,_0x3d412d){var _0x3267cb,_0x2e8930;var _0x1ae5da={'where':{'ProjectId':_0xa894ae[_0x3763('0x48')]['id']}};if(_0xa894ae[_0x3763('0x33')][_0x3763('0x64')]){_0x1ae5da[_0x3763('0x3d')][_0x3763('0x65')]=JSON[_0x3763('0x66')](_0xa894ae[_0x3763('0x33')][_0x3763('0x64')]);}return db['JscriptySessionReport'][_0x3763('0x44')](_0x1ae5da)[_0x3763('0x25')](handleEntityNotFound(_0x2603d6,null))['then'](function(_0x381926){if(_0x381926){_0x3267cb=_0x381926;return db[_0x3763('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x3763('0x31')](_0x3267cb,'id')},'ProjectId':_0xa894ae[_0x3763('0x48')]['id']},'order':_0x3763('0x68')});}})[_0x3763('0x25')](handleEntityNotFound(_0x2603d6,null))[_0x3763('0x25')](function(_0x446fb5){if(_0x446fb5){_0x2e8930=_0x446fb5;var _0x12da24={};for(var _0x9dcfea=0x0,_0x405d9a=_0x2e8930[_0x3763('0x38')];_0x9dcfea<_0x405d9a;_0x9dcfea++){if(!_0x12da24[_0x3763('0x39')](_0x2e8930[_0x9dcfea][_0x3763('0x69')])){_0x12da24[_0x2e8930[_0x9dcfea][_0x3763('0x69')]]=needsEncapsulation(_0x2e8930[_0x9dcfea][_0x3763('0x6a')])?encapsulate(_0x2e8930[_0x9dcfea][_0x3763('0x6a')]):_0x2e8930[_0x9dcfea]['question'];}}var _0x11160e=[],_0x59e7c3={};for(var _0x5ec730=0x0,_0x10316f=_0x3267cb[_0x3763('0x38')];_0x5ec730<_0x10316f;_0x5ec730++){_0x59e7c3={'ProjectId':_0xa894ae[_0x3763('0x48')]['id'],'SessionId':_0x3267cb[_0x5ec730]['id'],'StartTime':moment(_0x3267cb[_0x5ec730][_0x3763('0x65')])[_0x3763('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x51c501=0x0,_0x6aceb3=_0x2e8930[_0x3763('0x38')];_0x51c501<_0x6aceb3;_0x51c501++){if(_0x2e8930[_0x51c501][_0x3763('0x6c')]==_0x3267cb[_0x5ec730]['id']&&_0x12da24['hasOwnProperty'](_0x2e8930[_0x51c501][_0x3763('0x69')])){_0x59e7c3[_0x12da24[_0x2e8930[_0x51c501][_0x3763('0x69')]]]=_0x2e8930[_0x51c501][_0x3763('0x6d')];}}for(var _0x58fd89 in _0x12da24){if(!_0x59e7c3[_0x3763('0x39')](_0x12da24[_0x58fd89])){_0x59e7c3[_0x12da24[_0x58fd89]]=null;}}_0x11160e['push'](_0x59e7c3);}return _0x11160e;}})[_0x3763('0x25')](function(_0x2fee74){if(!_[_0x3763('0x6e')](_0x2fee74)){var _0x198323=toCsv(_0x2fee74);var _0x238b48=Date[_0x3763('0x6f')]();fs['writeFileSync'](util[_0x3763('0x6b')](_0x3763('0x70'),_0xa894ae[_0x3763('0x48')]['id'],_0x238b48),_0x198323);_0x2603d6['setHeader'](_0x3763('0x71'),'attachment;\x20filename='+util[_0x3763('0x6b')](_0x3763('0x72'),_0xa894ae[_0x3763('0x48')]['id'],_0x238b48));_0x2603d6[_0x3763('0x73')](_0x3763('0x74'),_0x3763('0x75'));return _0x2603d6[_0x3763('0x76')](util[_0x3763('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa894ae[_0x3763('0x48')]['id'],_0x238b48));}else{return _0x2603d6['sendStatus'](0xcc);}})[_0x3763('0x46')](handleError(_0x2603d6,null));}; \ No newline at end of file +var _0xd004=['findOne','JscriptySessionReport','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','update'];(function(_0x5d0b83,_0x533cd6){var _0x56eaa2=function(_0x4f25c2){while(--_0x4f25c2){_0x5d0b83['push'](_0x5d0b83['shift']());}};_0x56eaa2(++_0x533cd6);}(_0xd004,0x181));var _0x4d00=function(_0x2411ea,_0x4e2188){_0x2411ea=_0x2411ea-0x0;var _0x4b9644=_0xd004[_0x2411ea];return _0x4b9644;};'use strict';var emlformat=require(_0x4d00('0x0'));var rimraf=require(_0x4d00('0x1'));var zipdir=require(_0x4d00('0x2'));var jsonpatch=require(_0x4d00('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d00('0x4'));var Mustache=require(_0x4d00('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4d00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d00('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4d00('0x8'));var deskjs=require(_0x4d00('0x9'));var toCsv=require(_0x4d00('0x6'));var querystring=require(_0x4d00('0xa'));var Papa=require(_0x4d00('0xb'));var Redis=require('ioredis');var authService=require(_0x4d00('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4d00('0xd'));var hardwareService=require(_0x4d00('0xe'));var logger=require('../../config/logger')(_0x4d00('0xf'));var utils=require(_0x4d00('0x10'));var config=require(_0x4d00('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eaeac,_0x38ff0e){_0x38ff0e=_0x38ff0e||0xcc;return function(_0x47726e){if(_0x47726e){return _0x3eaeac[_0x4d00('0x12')](_0x38ff0e);}return _0x3eaeac['status'](_0x38ff0e)[_0x4d00('0x13')]();};}function respondWithResult(_0x39d68c,_0x5124c3){_0x5124c3=_0x5124c3||0xc8;return function(_0x588c31){if(_0x588c31){return _0x39d68c['status'](_0x5124c3)[_0x4d00('0x14')](_0x588c31);}};}function respondWithFilteredResult(_0x233de3,_0x30f3f4){return function(_0x58d56a){if(_0x58d56a){var _0x433a7b=typeof _0x30f3f4[_0x4d00('0x15')]===_0x4d00('0x16')&&typeof _0x30f3f4[_0x4d00('0x17')]===_0x4d00('0x16');var _0x433b1b=_0x58d56a[_0x4d00('0x18')];var _0x398a08=_0x433a7b?0x0:_0x30f3f4[_0x4d00('0x15')];var _0x2bf553=_0x433a7b?_0x58d56a[_0x4d00('0x18')]:_0x30f3f4[_0x4d00('0x15')]+_0x30f3f4[_0x4d00('0x17')];var _0x827890;if(_0x2bf553>=_0x433b1b){_0x2bf553=_0x433b1b;_0x827890=0xc8;}else{_0x827890=0xce;}_0x233de3[_0x4d00('0x19')](_0x827890);return _0x233de3[_0x4d00('0x1a')](_0x4d00('0x1b'),_0x398a08+'-'+_0x2bf553+'/'+_0x433b1b)['json'](_0x58d56a);}return null;};}function patchUpdates(_0x522066){return function(_0x17877b){try{jsonpatch[_0x4d00('0x1c')](_0x17877b,_0x522066,!![]);}catch(_0x38b460){return BPromise[_0x4d00('0x1d')](_0x38b460);}return _0x17877b[_0x4d00('0x1e')]();};}function saveUpdates(_0x102213,_0x58c7c7){return function(_0x4bf02e){if(_0x4bf02e){return _0x4bf02e['update'](_0x102213)[_0x4d00('0x1f')](function(_0xf70e8e){return _0xf70e8e;});}return null;};}function removeEntity(_0x2a2c74,_0x32a910){return function(_0x3e3d7f){if(_0x3e3d7f){return _0x3e3d7f[_0x4d00('0x20')]()[_0x4d00('0x1f')](function(){var _0x38b95e=_0x3e3d7f[_0x4d00('0x21')]({'plain':!![]});var _0x1a4553='Projects';return db[_0x4d00('0x22')][_0x4d00('0x20')]({'where':{'type':_0x1a4553,'resourceId':_0x38b95e['id']}})['then'](function(){return _0x3e3d7f;});})[_0x4d00('0x1f')](function(){_0x2a2c74[_0x4d00('0x19')](0xcc)[_0x4d00('0x13')]();});}};}function handleEntityNotFound(_0x3640ab,_0x6b106c){return function(_0x6df58c){if(!_0x6df58c){_0x3640ab[_0x4d00('0x12')](0x194);}return _0x6df58c;};}function handleError(_0x29a045,_0x85a5dd){_0x85a5dd=_0x85a5dd||0x1f4;return function(_0x7ae64d){logger['error'](_0x7ae64d['stack']);if(_0x7ae64d[_0x4d00('0x23')]){delete _0x7ae64d[_0x4d00('0x23')];}_0x29a045[_0x4d00('0x19')](_0x85a5dd)[_0x4d00('0x24')](_0x7ae64d);};}exports[_0x4d00('0x25')]=function(_0x1de92d,_0x703ce1){var _0x1b7adf={},_0x2649c2={},_0x461b6a={'count':0x0,'rows':[]};var _0x16e714=_[_0x4d00('0x26')](db[_0x4d00('0x27')][_0x4d00('0x28')],function(_0x4f4e9a){return{'name':_0x4f4e9a[_0x4d00('0x29')],'type':_0x4f4e9a[_0x4d00('0x2a')]['key']};});_0x2649c2['model']=_['map'](_0x16e714,_0x4d00('0x23'));_0x2649c2['query']=_[_0x4d00('0x2b')](_0x1de92d[_0x4d00('0x2c')]);_0x2649c2['filters']=_[_0x4d00('0x2d')](_0x2649c2['model'],_0x2649c2[_0x4d00('0x2c')]);_0x1b7adf[_0x4d00('0x2e')]=_[_0x4d00('0x2d')](_0x2649c2[_0x4d00('0x2f')],qs[_0x4d00('0x30')](_0x1de92d[_0x4d00('0x2c')]['fields']));_0x1b7adf['attributes']=_0x1b7adf[_0x4d00('0x2e')][_0x4d00('0x31')]?_0x1b7adf['attributes']:_0x2649c2['model'];if(!_0x1de92d['query'][_0x4d00('0x32')](_0x4d00('0x33'))){_0x1b7adf[_0x4d00('0x17')]=qs[_0x4d00('0x17')](_0x1de92d['query'][_0x4d00('0x17')]);_0x1b7adf['offset']=qs[_0x4d00('0x15')](_0x1de92d[_0x4d00('0x2c')][_0x4d00('0x15')]);}_0x1b7adf[_0x4d00('0x34')]=qs['sort'](_0x1de92d[_0x4d00('0x2c')][_0x4d00('0x35')]);_0x1b7adf['where']=qs['filters'](_[_0x4d00('0x36')](_0x1de92d[_0x4d00('0x2c')],_0x2649c2[_0x4d00('0x37')]),_0x16e714);if(_0x1de92d['query']['filter']){_0x1b7adf[_0x4d00('0x38')]=_['merge'](_0x1b7adf[_0x4d00('0x38')],{'$or':_[_0x4d00('0x26')](_0x16e714,function(_0x248d0e){if(_0x248d0e[_0x4d00('0x2a')]!==_0x4d00('0x39')){var _0x5291ed={};_0x5291ed[_0x248d0e['name']]={'$like':'%'+_0x1de92d['query'][_0x4d00('0x3a')]+'%'};return _0x5291ed;}})});}_0x1b7adf=_[_0x4d00('0x3b')]({},_0x1b7adf,_0x1de92d[_0x4d00('0x3c')]);var _0xdaebc8={'where':_0x1b7adf[_0x4d00('0x38')]};return db[_0x4d00('0x27')][_0x4d00('0x18')](_0xdaebc8)[_0x4d00('0x1f')](function(_0x341ee7){_0x461b6a[_0x4d00('0x18')]=_0x341ee7;if(_0x1de92d[_0x4d00('0x2c')]['includeAll']){_0x1b7adf[_0x4d00('0x3d')]=[{'all':!![]}];}return db[_0x4d00('0x27')][_0x4d00('0x3e')](_0x1b7adf);})['then'](function(_0x2162cc){_0x461b6a['rows']=_0x2162cc;return _0x461b6a;})[_0x4d00('0x1f')](respondWithFilteredResult(_0x703ce1,_0x1b7adf))[_0x4d00('0x3f')](handleError(_0x703ce1,null));};exports[_0x4d00('0x40')]=function(_0x3b08f5,_0x140864){var _0x30143f={'raw':![],'where':{'id':_0x3b08f5[_0x4d00('0x41')]['id']}},_0x4be1b2={};_0x4be1b2[_0x4d00('0x2f')]=_[_0x4d00('0x2b')](db[_0x4d00('0x27')][_0x4d00('0x28')]);_0x4be1b2[_0x4d00('0x2c')]=_['keys'](_0x3b08f5[_0x4d00('0x2c')]);_0x4be1b2[_0x4d00('0x37')]=_[_0x4d00('0x2d')](_0x4be1b2[_0x4d00('0x2f')],_0x4be1b2[_0x4d00('0x2c')]);_0x30143f[_0x4d00('0x2e')]=_[_0x4d00('0x2d')](_0x4be1b2[_0x4d00('0x2f')],qs['fields'](_0x3b08f5[_0x4d00('0x2c')][_0x4d00('0x30')]));_0x30143f[_0x4d00('0x2e')]=_0x30143f['attributes'][_0x4d00('0x31')]?_0x30143f[_0x4d00('0x2e')]:_0x4be1b2['model'];if(_0x3b08f5[_0x4d00('0x2c')]['includeAll']){_0x30143f[_0x4d00('0x3d')]=[{'all':!![]}];}_0x30143f=_[_0x4d00('0x3b')]({},_0x30143f,_0x3b08f5['options']);return db['JscriptyProject'][_0x4d00('0x42')](_0x30143f)[_0x4d00('0x1f')](handleEntityNotFound(_0x140864,null))[_0x4d00('0x1f')](respondWithResult(_0x140864,null))[_0x4d00('0x3f')](handleError(_0x140864,null));};exports[_0x4d00('0x43')]=function(_0x316136,_0x5b29e5){return db['JscriptyProject']['create'](_0x316136[_0x4d00('0x44')],{})[_0x4d00('0x1f')](function(_0x5ed0d2){var _0x13bf4f=_0x316136[_0x4d00('0x45')][_0x4d00('0x21')]({'plain':!![]});if(!_0x13bf4f)throw new Error(_0x4d00('0x46'));if(_0x13bf4f[_0x4d00('0x47')]===_0x4d00('0x45')){var _0x3ee807=_0x5ed0d2[_0x4d00('0x21')]({'plain':!![]});var _0x8cf582=_0x4d00('0x48');return db[_0x4d00('0x49')][_0x4d00('0x42')]({'where':{'name':_0x8cf582,'userProfileId':_0x13bf4f[_0x4d00('0x4a')]},'raw':!![]})['then'](function(_0x3110d9){if(_0x3110d9&&_0x3110d9[_0x4d00('0x4b')]===0x0){return db[_0x4d00('0x22')]['create']({'name':_0x3ee807[_0x4d00('0x23')],'resourceId':_0x3ee807['id'],'type':_0x3110d9[_0x4d00('0x23')],'sectionId':_0x3110d9['id']},{})['then'](function(){return _0x5ed0d2;});}else{return _0x5ed0d2;}})[_0x4d00('0x3f')](function(_0x533bcb){logger[_0x4d00('0x4c')](_0x4d00('0x4d'),_0x533bcb);throw _0x533bcb;});}return _0x5ed0d2;})[_0x4d00('0x1f')](respondWithResult(_0x5b29e5,0xc9))[_0x4d00('0x3f')](handleError(_0x5b29e5,null));};exports[_0x4d00('0x4e')]=function(_0x1a6943,_0xffb7b2){var _0x671e6d={'where':{'id':_0x1a6943[_0x4d00('0x41')]['id']}},_0x42959b={};_0x42959b['model']=_[_0x4d00('0x2b')](db[_0x4d00('0x27')]['rawAttributes']);_0x671e6d[_0x4d00('0x2e')]=_[_0x4d00('0x2d')](_0x42959b['model'],qs['fields'](_0x1a6943[_0x4d00('0x2c')][_0x4d00('0x30')]));_0x671e6d[_0x4d00('0x2e')]=_0x671e6d[_0x4d00('0x2e')][_0x4d00('0x31')]?_0x671e6d[_0x4d00('0x2e')]:_0x42959b['model'];if(_0x1a6943[_0x4d00('0x2c')][_0x4d00('0x4f')]){_0x671e6d[_0x4d00('0x3d')]=[{'all':!![]}];}_0x671e6d=_['merge']({},_0x671e6d,_0x1a6943[_0x4d00('0x3c')]);return db[_0x4d00('0x27')]['find'](_0x671e6d)[_0x4d00('0x1f')](handleEntityNotFound(_0xffb7b2,null))[_0x4d00('0x1f')](function(_0x4eb78c){if(_0x4eb78c){var _0x3ae133=_0x4eb78c[_0x4d00('0x21')]({'plain':!![]});_0x3ae133=qs['omit'](_0x3ae133,['id','createdAt','updatedAt']);_0x1a6943[_0x4d00('0x44')]=_[_0x4d00('0x50')](_0x1a6943[_0x4d00('0x44')],['id',_0x4d00('0x51'),'updatedAt']);return db[_0x4d00('0x27')]['create'](_[_0x4d00('0x3b')](_0x3ae133,_0x1a6943[_0x4d00('0x44')]),{'include':_0x1a6943[_0x4d00('0x2c')][_0x4d00('0x4f')]?[{'all':!![]}]:undefined})[_0x4d00('0x1f')](function(_0x5710f6){var _0x1756df=_0x1a6943[_0x4d00('0x45')][_0x4d00('0x21')]({'plain':!![]});if(!_0x1756df)throw new Error(_0x4d00('0x46'));if(_0x1756df[_0x4d00('0x47')]===_0x4d00('0x45')){var _0x5df86b=_0x5710f6[_0x4d00('0x21')]({'plain':!![]});var _0x2f206d=_0x4d00('0x48');return db['UserProfileSection'][_0x4d00('0x42')]({'where':{'name':_0x2f206d,'userProfileId':_0x1756df[_0x4d00('0x4a')]},'raw':!![]})[_0x4d00('0x1f')](function(_0x95567d){if(_0x95567d&&_0x95567d['autoAssociation']===0x0){return db[_0x4d00('0x22')]['create']({'name':_0x5df86b[_0x4d00('0x23')],'resourceId':_0x5df86b['id'],'type':_0x95567d[_0x4d00('0x23')],'sectionId':_0x95567d['id']},{})[_0x4d00('0x1f')](function(){return _0x5710f6;});}else{return _0x5710f6;}})['catch'](function(_0x15aeeb){logger[_0x4d00('0x4c')](_0x4d00('0x4d'),_0x15aeeb);throw _0x15aeeb;});}return _0x5710f6;});}})[_0x4d00('0x1f')](respondWithResult(_0xffb7b2,0xc9))[_0x4d00('0x3f')](handleError(_0xffb7b2,null));};exports[_0x4d00('0x52')]=function(_0x271fac,_0x843471){if(_0x271fac[_0x4d00('0x44')]['id']){delete _0x271fac['body']['id'];}return db[_0x4d00('0x27')]['find']({'where':{'id':_0x271fac['params']['id']}})[_0x4d00('0x1f')](handleEntityNotFound(_0x843471,null))['then'](saveUpdates(_0x271fac[_0x4d00('0x44')],null))['then'](respondWithResult(_0x843471,null))[_0x4d00('0x3f')](handleError(_0x843471,null));};exports[_0x4d00('0x20')]=function(_0x1065b5,_0x4c6958){return db[_0x4d00('0x27')][_0x4d00('0x42')]({'where':{'id':_0x1065b5[_0x4d00('0x41')]['id']}})[_0x4d00('0x1f')](handleEntityNotFound(_0x4c6958,null))['then'](removeEntity(_0x4c6958,null))[_0x4d00('0x3f')](handleError(_0x4c6958,null));};exports['getSessions']=function(_0x456eaa,_0x5e2ee2,_0x1a7a64){var _0x539790={'raw':!![],'where':{}};var _0x3aa893={};var _0x1cfb25={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4d00('0x53')]({'where':{'id':_0x456eaa[_0x4d00('0x41')]['id']}})[_0x4d00('0x1f')](handleEntityNotFound(_0x5e2ee2,null))[_0x4d00('0x1f')](function(_0xb12a37){if(_0xb12a37){_0x3aa893[_0x4d00('0x2f')]=_[_0x4d00('0x2b')](db[_0x4d00('0x54')][_0x4d00('0x28')]);_0x3aa893[_0x4d00('0x2c')]=_[_0x4d00('0x2b')](_0x456eaa[_0x4d00('0x2c')]);_0x3aa893['filters']=_[_0x4d00('0x2d')](_0x3aa893[_0x4d00('0x2f')],_0x3aa893[_0x4d00('0x2c')]);_0x539790[_0x4d00('0x2e')]=_['intersection'](_0x3aa893[_0x4d00('0x2f')],qs[_0x4d00('0x30')](_0x456eaa[_0x4d00('0x2c')][_0x4d00('0x30')]));_0x539790[_0x4d00('0x2e')]=_0x539790[_0x4d00('0x2e')][_0x4d00('0x31')]?_0x539790[_0x4d00('0x2e')]:_0x3aa893[_0x4d00('0x2f')];if(!_0x456eaa[_0x4d00('0x2c')]['hasOwnProperty'](_0x4d00('0x33'))){_0x539790['limit']=qs['limit'](_0x456eaa[_0x4d00('0x2c')][_0x4d00('0x17')]);_0x539790[_0x4d00('0x15')]=qs[_0x4d00('0x15')](_0x456eaa[_0x4d00('0x2c')]['offset']);}_0x539790[_0x4d00('0x34')]=qs[_0x4d00('0x35')](_0x456eaa[_0x4d00('0x2c')][_0x4d00('0x35')]);_0x539790[_0x4d00('0x38')]=qs['filters'](_[_0x4d00('0x36')](_0x456eaa[_0x4d00('0x2c')],_0x3aa893['filters']));_0x539790[_0x4d00('0x38')][_0x4d00('0x55')]=_0xb12a37['id'];if(_0x456eaa['query'][_0x4d00('0x3a')]){_0x539790['where']=_[_0x4d00('0x3b')](_0x539790['where'],{'$or':_[_0x4d00('0x26')](_0x539790[_0x4d00('0x2e')],function(_0x32b109){var _0x13b511={};_0x13b511[_0x32b109]={'$like':'%'+_0x456eaa['query'][_0x4d00('0x3a')]+'%'};return _0x13b511;})});}_0x539790=_[_0x4d00('0x3b')]({},_0x539790,_0x456eaa['options']);return db['JscriptySessionReport'][_0x4d00('0x18')]({'where':_0x539790[_0x4d00('0x38')]})['then'](function(_0x2add61){_0x1cfb25[_0x4d00('0x18')]=_0x2add61;if(_0x456eaa[_0x4d00('0x2c')][_0x4d00('0x4f')]){_0x539790[_0x4d00('0x3d')]=[{'all':!![]}];}return db[_0x4d00('0x54')][_0x4d00('0x3e')](_0x539790);})[_0x4d00('0x1f')](function(_0x1473a3){_0x1cfb25[_0x4d00('0x56')]=_0x1473a3;return _0x1cfb25;});}})[_0x4d00('0x1f')](respondWithFilteredResult(_0x5e2ee2,_0x539790))[_0x4d00('0x3f')](handleError(_0x5e2ee2,null));};exports[_0x4d00('0x57')]=function(_0x5a6da4,_0x446039,_0x3a64c5){var _0x4f3e2c={'raw':!![],'where':{}};var _0x5a2a74={};var _0x4f2791={'count':0x0,'rows':[]};return db[_0x4d00('0x27')]['findOne']({'where':{'id':_0x5a6da4['params']['id']}})[_0x4d00('0x1f')](handleEntityNotFound(_0x446039,null))[_0x4d00('0x1f')](function(_0x14df34){if(_0x14df34){_0x5a2a74[_0x4d00('0x2f')]=_[_0x4d00('0x2b')](db[_0x4d00('0x58')][_0x4d00('0x28')]);_0x5a2a74[_0x4d00('0x2c')]=_['keys'](_0x5a6da4[_0x4d00('0x2c')]);_0x5a2a74[_0x4d00('0x37')]=_[_0x4d00('0x2d')](_0x5a2a74[_0x4d00('0x2f')],_0x5a2a74[_0x4d00('0x2c')]);_0x4f3e2c[_0x4d00('0x2e')]=_['intersection'](_0x5a2a74[_0x4d00('0x2f')],qs[_0x4d00('0x30')](_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x30')]));_0x4f3e2c[_0x4d00('0x2e')]=_0x4f3e2c['attributes'][_0x4d00('0x31')]?_0x4f3e2c[_0x4d00('0x2e')]:_0x5a2a74[_0x4d00('0x2f')];if(!_0x5a6da4['query']['hasOwnProperty'](_0x4d00('0x33'))){_0x4f3e2c[_0x4d00('0x17')]=qs['limit'](_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x17')]);_0x4f3e2c[_0x4d00('0x15')]=qs['offset'](_0x5a6da4['query'][_0x4d00('0x15')]);}_0x4f3e2c[_0x4d00('0x34')]=qs[_0x4d00('0x35')](_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x35')]);_0x4f3e2c[_0x4d00('0x38')]=qs[_0x4d00('0x37')](_[_0x4d00('0x36')](_0x5a6da4[_0x4d00('0x2c')],_0x5a2a74[_0x4d00('0x37')]));_0x4f3e2c[_0x4d00('0x38')]['ProjectId']=_0x14df34['id'];if(_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x3a')]){_0x4f3e2c[_0x4d00('0x38')]=_[_0x4d00('0x3b')](_0x4f3e2c[_0x4d00('0x38')],{'$or':_[_0x4d00('0x26')](_0x4f3e2c[_0x4d00('0x2e')],function(_0x2c99c4){var _0x52b938={};_0x52b938[_0x2c99c4]={'$like':'%'+_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x3a')]+'%'};return _0x52b938;})});}_0x4f3e2c=_[_0x4d00('0x3b')]({},_0x4f3e2c,_0x5a6da4[_0x4d00('0x3c')]);return db[_0x4d00('0x58')][_0x4d00('0x18')]({'where':_0x4f3e2c[_0x4d00('0x38')]})[_0x4d00('0x1f')](function(_0xfc9e0f){_0x4f2791['count']=_0xfc9e0f;if(_0x5a6da4[_0x4d00('0x2c')][_0x4d00('0x4f')]){_0x4f3e2c[_0x4d00('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4d00('0x3e')](_0x4f3e2c);})[_0x4d00('0x1f')](function(_0x213554){_0x4f2791[_0x4d00('0x56')]=_0x213554;return _0x4f2791;});}})['then'](respondWithFilteredResult(_0x446039,_0x4f3e2c))[_0x4d00('0x3f')](handleError(_0x446039,null));};function char(_0x106dc1){return _0x4d00('0x59')===typeof _0x106dc1?String[_0x4d00('0x5a')][_0x4d00('0x1c')](null,arguments):_0x106dc1;}function needsEncapsulation(_0x515ae6){return!!_0x515ae6&&(_0x515ae6[_0x4d00('0x5b')]()[_0x4d00('0x5c')](char(0xd))>=0x0||_0x515ae6[_0x4d00('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x515ae6[_0x4d00('0x5b')]()['indexOf'](char(0x2c))>=0x0||_0x515ae6[_0x4d00('0x5b')]()[_0x4d00('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x547f65){var _0x366e32=char(0x22),_0x3822a0='\x5c'+char(0x22),_0x9bac0b=_0x547f65[_0x4d00('0x5b')]()[_0x4d00('0x5d')](new RegExp(_0x366e32,'g'),_0x3822a0);return _0x366e32+_0x9bac0b+_0x366e32;}exports['getSummary']=function(_0x325dc5,_0x40a8c4,_0x95d9aa){var _0x5914c5,_0x162170;var _0x535a02={'where':{'ProjectId':_0x325dc5[_0x4d00('0x41')]['id']}};if(_0x325dc5[_0x4d00('0x2c')][_0x4d00('0x5e')]){_0x535a02[_0x4d00('0x38')][_0x4d00('0x5f')]=JSON[_0x4d00('0x60')](_0x325dc5[_0x4d00('0x2c')][_0x4d00('0x5e')]);}return db[_0x4d00('0x54')][_0x4d00('0x3e')](_0x535a02)[_0x4d00('0x1f')](handleEntityNotFound(_0x40a8c4,null))[_0x4d00('0x1f')](function(_0x6780df){if(_0x6780df){_0x5914c5=_0x6780df;return db[_0x4d00('0x61')][_0x4d00('0x3e')]({'where':{'SessionId':{'$in':_[_0x4d00('0x26')](_0x5914c5,'id')},'ProjectId':_0x325dc5[_0x4d00('0x41')]['id']},'order':_0x4d00('0x62')});}})[_0x4d00('0x1f')](handleEntityNotFound(_0x40a8c4,null))[_0x4d00('0x1f')](function(_0x1cf577){if(_0x1cf577){_0x162170=_0x1cf577;var _0x499ce4={};for(var _0x4e801c=0x0,_0x3beeeb=_0x162170['length'];_0x4e801c<_0x3beeeb;_0x4e801c++){if(!_0x499ce4['hasOwnProperty'](_0x162170[_0x4e801c]['questionId'])){_0x499ce4[_0x162170[_0x4e801c][_0x4d00('0x63')]]=needsEncapsulation(_0x162170[_0x4e801c]['question'])?encapsulate(_0x162170[_0x4e801c][_0x4d00('0x64')]):_0x162170[_0x4e801c][_0x4d00('0x64')];}}var _0x1f5e4c=[],_0x594397={};for(var _0x34eda6=0x0,_0x50a2fb=_0x5914c5['length'];_0x34eda6<_0x50a2fb;_0x34eda6++){_0x594397={'ProjectId':_0x325dc5[_0x4d00('0x41')]['id'],'SessionId':_0x5914c5[_0x34eda6]['id'],'StartTime':moment(_0x5914c5[_0x34eda6][_0x4d00('0x5f')])[_0x4d00('0x65')](_0x4d00('0x66'))};for(var _0x4af27b=0x0,_0x26a803=_0x162170[_0x4d00('0x31')];_0x4af27b<_0x26a803;_0x4af27b++){if(_0x162170[_0x4af27b][_0x4d00('0x67')]==_0x5914c5[_0x34eda6]['id']&&_0x499ce4[_0x4d00('0x32')](_0x162170[_0x4af27b]['questionId'])){_0x594397[_0x499ce4[_0x162170[_0x4af27b][_0x4d00('0x63')]]]=_0x162170[_0x4af27b][_0x4d00('0x68')];}}for(var _0x74dce4 in _0x499ce4){if(!_0x594397[_0x4d00('0x32')](_0x499ce4[_0x74dce4])){_0x594397[_0x499ce4[_0x74dce4]]=null;}}_0x1f5e4c[_0x4d00('0x69')](_0x594397);}return _0x1f5e4c;}})[_0x4d00('0x1f')](function(_0x597aff){if(!_[_0x4d00('0x6a')](_0x597aff)){var _0x80c016=toCsv(_0x597aff);var _0x4b933a=Date[_0x4d00('0x6b')]();fs[_0x4d00('0x6c')](util[_0x4d00('0x65')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x325dc5[_0x4d00('0x41')]['id'],_0x4b933a),_0x80c016);_0x40a8c4[_0x4d00('0x6d')](_0x4d00('0x6e'),_0x4d00('0x6f')+util[_0x4d00('0x65')](_0x4d00('0x70'),_0x325dc5[_0x4d00('0x41')]['id'],_0x4b933a));_0x40a8c4[_0x4d00('0x6d')](_0x4d00('0x71'),_0x4d00('0x72'));return _0x40a8c4[_0x4d00('0x73')](util[_0x4d00('0x65')](_0x4d00('0x74'),_0x325dc5[_0x4d00('0x41')]['id'],_0x4b933a));}else{return _0x40a8c4['sendStatus'](0xcc);}})[_0x4d00('0x3f')](handleError(_0x40a8c4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 9fe5c4d..57f44cc 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 _0x9973=['define','JscriptyProject','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x9973,0x157));var _0x3997=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9973[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var logger=require(_0x3997('0x1'))('api');var moment=require(_0x3997('0x2'));var BPromise=require(_0x3997('0x3'));var rp=require(_0x3997('0x4'));var fs=require('fs');var path=require(_0x3997('0x5'));var rimraf=require(_0x3997('0x6'));var config=require(_0x3997('0x7'));var attributes=require(_0x3997('0x8'));module['exports']=function(_0x48c26c,_0x320340){return _0x48c26c[_0x3997('0x9')](_0x3997('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x3e0a8e,_0x1fbd88){var _0x6ce713=function(_0x542c29){while(--_0x542c29){_0x3e0a8e['push'](_0x3e0a8e['shift']());}};_0x6ce713(++_0x1fbd88);}(_0xac31,0xca));var _0x1ac3=function(_0x3cfbc1,_0x590b67){_0x3cfbc1=_0x3cfbc1-0x0;var _0x14ed3d=_0xac31[_0x3cfbc1];return _0x14ed3d;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 56d571f..9888229 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x301486,_0x27b799){var _0x418d16=function(_0x5f0d58){while(--_0x5f0d58){_0x301486['push'](_0x301486['shift']());}};_0x418d16(++_0x27b799);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xaa88[_0x2a6809];return _0x11c371;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xaa88,0x137));var _0x8aa8=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0xaa88[_0x330414];return _0x99dbff;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 98a2007..364851e 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 _0xba2c=['../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xba2c,0x160));var _0xcba2=function(_0x2b1eb1,_0x33c2bb){_0x2b1eb1=_0x2b1eb1-0x0;var _0x47fb04=_0xba2c[_0x2b1eb1];return _0x47fb04;};'use strict';var multer=require('multer');var util=require(_0xcba2('0x0'));var path=require(_0xcba2('0x1'));var timeout=require(_0xcba2('0x2'));var express=require(_0xcba2('0x3'));var router=express[_0xcba2('0x4')]();var fs_extra=require(_0xcba2('0x5'));var auth=require(_0xcba2('0x6'));var interaction=require(_0xcba2('0x7'));var config=require(_0xcba2('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0xcba2('0x9')]('/',auth[_0xcba2('0xa')](),controller['index']);router[_0xcba2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcba2('0xb')]);router[_0xcba2('0x9')](_0xcba2('0xc'),auth[_0xcba2('0xa')](),controller[_0xcba2('0xd')]);router[_0xcba2('0xe')]('/',auth[_0xcba2('0xa')](),controller[_0xcba2('0xf')]);router[_0xcba2('0x10')](_0xcba2('0xc'),auth[_0xcba2('0xa')](),controller[_0xcba2('0x11')]);router[_0xcba2('0x12')]('/:id',auth[_0xcba2('0xa')](),controller[_0xcba2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbd2b=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x53a6b1,_0x29455b){var _0x358f81=function(_0x1a34e0){while(--_0x1a34e0){_0x53a6b1['push'](_0x53a6b1['shift']());}};_0x358f81(++_0x29455b);}(_0xbd2b,0x19a));var _0xbbd2=function(_0x3d0381,_0x576645){_0x3d0381=_0x3d0381-0x0;var _0x358b9a=_0xbd2b[_0x3d0381];return _0x358b9a;};'use strict';var multer=require(_0xbbd2('0x0'));var util=require(_0xbbd2('0x1'));var path=require(_0xbbd2('0x2'));var timeout=require(_0xbbd2('0x3'));var express=require(_0xbbd2('0x4'));var router=express[_0xbbd2('0x5')]();var fs_extra=require(_0xbbd2('0x6'));var auth=require(_0xbbd2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd2('0x8'));var controller=require(_0xbbd2('0x9'));router[_0xbbd2('0xa')]('/',auth[_0xbbd2('0xb')](),controller[_0xbbd2('0xc')]);router[_0xbbd2('0xa')]('/describe',auth[_0xbbd2('0xb')](),controller[_0xbbd2('0xd')]);router[_0xbbd2('0xa')](_0xbbd2('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbbd2('0xf')]);router[_0xbbd2('0x10')](_0xbbd2('0xe'),auth[_0xbbd2('0xb')](),controller[_0xbbd2('0x11')]);router['delete'](_0xbbd2('0xe'),auth[_0xbbd2('0xb')](),controller[_0xbbd2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 37668b6..35f1e25 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x3cdeec,_0x3cb773){_0x3cdeec=_0x3cdeec-0x0;var _0x11d3cb=_0x7a54[_0x3cdeec];return _0x11d3cb;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x55d591,_0x516fec){_0x55d591=_0x55d591-0x0;var _0x10253f=_0x7a54[_0x55d591];return _0x10253f;};'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 9d9d221..f1d9beb 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 _0xd012=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','intersection','find','create','body','describe','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd012,0xe3));var _0x2d01=function(_0x2fa9b8,_0x11d0c8){_0x2fa9b8=_0x2fa9b8-0x0;var _0x4e63e0=_0xd012[_0x2fa9b8];return _0x4e63e0;};'use strict';var emlformat=require(_0x2d01('0x0'));var rimraf=require(_0x2d01('0x1'));var zipdir=require(_0x2d01('0x2'));var jsonpatch=require(_0x2d01('0x3'));var rp=require(_0x2d01('0x4'));var moment=require(_0x2d01('0x5'));var BPromise=require(_0x2d01('0x6'));var Mustache=require(_0x2d01('0x7'));var util=require(_0x2d01('0x8'));var path=require(_0x2d01('0x9'));var sox=require(_0x2d01('0xa'));var csv=require(_0x2d01('0xb'));var ejs=require(_0x2d01('0xc'));var fs=require('fs');var fs_extra=require(_0x2d01('0xd'));var _=require('lodash');var squel=require(_0x2d01('0xe'));var crypto=require(_0x2d01('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d01('0xb'));var querystring=require('querystring');var Papa=require(_0x2d01('0x10'));var Redis=require(_0x2d01('0x11'));var authService=require(_0x2d01('0x12'));var qs=require(_0x2d01('0x13'));var as=require(_0x2d01('0x14'));var hardwareService=require(_0x2d01('0x15'));var logger=require(_0x2d01('0x16'))('api');var utils=require(_0x2d01('0x17'));var config=require(_0x2d01('0x18'));var licenseUtil=require(_0x2d01('0x19'));var db=require(_0x2d01('0x1a'))['db'];function respondWithStatusCode(_0x21dff5,_0x55157f){_0x55157f=_0x55157f||0xcc;return function(_0x13ddd8){if(_0x13ddd8){return _0x21dff5['sendStatus'](_0x55157f);}return _0x21dff5[_0x2d01('0x1b')](_0x55157f)[_0x2d01('0x1c')]();};}function respondWithResult(_0x5623d6,_0x3dd18a){_0x3dd18a=_0x3dd18a||0xc8;return function(_0x3fd13d){if(_0x3fd13d){return _0x5623d6['status'](_0x3dd18a)[_0x2d01('0x1d')](_0x3fd13d);}};}function respondWithFilteredResult(_0x3744c5,_0x421734){return function(_0x213973){if(_0x213973){var _0x5129b3=typeof _0x421734[_0x2d01('0x1e')]===_0x2d01('0x1f')&&typeof _0x421734[_0x2d01('0x20')]==='undefined';var _0x3b758b=_0x213973[_0x2d01('0x21')];var _0x1ec1d9=_0x5129b3?0x0:_0x421734[_0x2d01('0x1e')];var _0x57a878=_0x5129b3?_0x213973[_0x2d01('0x21')]:_0x421734[_0x2d01('0x1e')]+_0x421734[_0x2d01('0x20')];var _0x2441f7;if(_0x57a878>=_0x3b758b){_0x57a878=_0x3b758b;_0x2441f7=0xc8;}else{_0x2441f7=0xce;}_0x3744c5[_0x2d01('0x1b')](_0x2441f7);return _0x3744c5[_0x2d01('0x22')](_0x2d01('0x23'),_0x1ec1d9+'-'+_0x57a878+'/'+_0x3b758b)[_0x2d01('0x1d')](_0x213973);}return null;};}function patchUpdates(_0x289b79){return function(_0x58c455){try{jsonpatch['apply'](_0x58c455,_0x289b79,!![]);}catch(_0x5aa3a0){return BPromise['reject'](_0x5aa3a0);}return _0x58c455['save']();};}function saveUpdates(_0x4e96e1,_0x376b24){return function(_0x14f598){if(_0x14f598){return _0x14f598[_0x2d01('0x24')](_0x4e96e1)['then'](function(_0x654085){return _0x654085;});}return null;};}function removeEntity(_0x198202,_0x3e0026){return function(_0x3f1dc7){if(_0x3f1dc7){return _0x3f1dc7[_0x2d01('0x25')]()[_0x2d01('0x26')](function(){_0x198202['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cde51,_0xe46947){return function(_0x140f43){if(!_0x140f43){_0x4cde51['sendStatus'](0x194);}return _0x140f43;};}function handleError(_0x44cb12,_0x14035f){_0x14035f=_0x14035f||0x1f4;return function(_0x2b351a){logger[_0x2d01('0x27')](_0x2b351a[_0x2d01('0x28')]);if(_0x2b351a[_0x2d01('0x29')]){delete _0x2b351a[_0x2d01('0x29')];}_0x44cb12[_0x2d01('0x1b')](_0x14035f)[_0x2d01('0x2a')](_0x2b351a);};}exports[_0x2d01('0x2b')]=function(_0x393f0b,_0x413242){var _0x4edebd={},_0x17fa49={},_0x13186e={'count':0x0,'rows':[]};var _0x24f16c=_[_0x2d01('0x2c')](db[_0x2d01('0x2d')][_0x2d01('0x2e')],function(_0x4fdffd){return{'name':_0x4fdffd[_0x2d01('0x2f')],'type':_0x4fdffd[_0x2d01('0x30')][_0x2d01('0x31')]};});_0x17fa49[_0x2d01('0x32')]=_[_0x2d01('0x2c')](_0x24f16c,_0x2d01('0x29'));_0x17fa49[_0x2d01('0x33')]=_[_0x2d01('0x34')](_0x393f0b[_0x2d01('0x33')]);_0x17fa49[_0x2d01('0x35')]=_['intersection'](_0x17fa49[_0x2d01('0x32')],_0x17fa49[_0x2d01('0x33')]);_0x4edebd[_0x2d01('0x36')]=_['intersection'](_0x17fa49[_0x2d01('0x32')],qs[_0x2d01('0x37')](_0x393f0b[_0x2d01('0x33')][_0x2d01('0x37')]));_0x4edebd[_0x2d01('0x36')]=_0x4edebd[_0x2d01('0x36')][_0x2d01('0x38')]?_0x4edebd[_0x2d01('0x36')]:_0x17fa49[_0x2d01('0x32')];if(!_0x393f0b[_0x2d01('0x33')][_0x2d01('0x39')](_0x2d01('0x3a'))){_0x4edebd[_0x2d01('0x20')]=qs[_0x2d01('0x20')](_0x393f0b['query'][_0x2d01('0x20')]);_0x4edebd[_0x2d01('0x1e')]=qs[_0x2d01('0x1e')](_0x393f0b[_0x2d01('0x33')]['offset']);}_0x4edebd[_0x2d01('0x3b')]=qs[_0x2d01('0x3c')](_0x393f0b[_0x2d01('0x33')][_0x2d01('0x3c')]);_0x4edebd[_0x2d01('0x3d')]=qs[_0x2d01('0x35')](_['pick'](_0x393f0b[_0x2d01('0x33')],_0x17fa49[_0x2d01('0x35')]),_0x24f16c);if(_0x393f0b[_0x2d01('0x33')]['filter']){_0x4edebd[_0x2d01('0x3d')]=_[_0x2d01('0x3e')](_0x4edebd[_0x2d01('0x3d')],{'$or':_[_0x2d01('0x2c')](_0x24f16c,function(_0x2befe2){if(_0x2befe2[_0x2d01('0x30')]!==_0x2d01('0x3f')){var _0x71ddbe={};_0x71ddbe[_0x2befe2['name']]={'$like':'%'+_0x393f0b['query'][_0x2d01('0x40')]+'%'};return _0x71ddbe;}})});}_0x4edebd=_['merge']({},_0x4edebd,_0x393f0b[_0x2d01('0x41')]);var _0x5221bb={'where':_0x4edebd['where']};return db[_0x2d01('0x2d')]['count'](_0x5221bb)[_0x2d01('0x26')](function(_0x27e32c){_0x13186e['count']=_0x27e32c;if(_0x393f0b[_0x2d01('0x33')]['includeAll']){_0x4edebd[_0x2d01('0x42')]=[{'all':!![]}];}return db[_0x2d01('0x2d')]['findAll'](_0x4edebd);})[_0x2d01('0x26')](function(_0x433bc8){_0x13186e[_0x2d01('0x43')]=_0x433bc8;return _0x13186e;})[_0x2d01('0x26')](respondWithFilteredResult(_0x413242,_0x4edebd))[_0x2d01('0x44')](handleError(_0x413242,null));};exports[_0x2d01('0x45')]=function(_0x48f664,_0x3f72b6){var _0x224190={'raw':!![],'where':{'id':_0x48f664[_0x2d01('0x46')]['id']}},_0x2e1275={};_0x2e1275[_0x2d01('0x32')]=_['keys'](db[_0x2d01('0x2d')][_0x2d01('0x2e')]);_0x2e1275[_0x2d01('0x33')]=_[_0x2d01('0x34')](_0x48f664[_0x2d01('0x33')]);_0x2e1275[_0x2d01('0x35')]=_[_0x2d01('0x47')](_0x2e1275['model'],_0x2e1275[_0x2d01('0x33')]);_0x224190[_0x2d01('0x36')]=_[_0x2d01('0x47')](_0x2e1275[_0x2d01('0x32')],qs[_0x2d01('0x37')](_0x48f664[_0x2d01('0x33')][_0x2d01('0x37')]));_0x224190[_0x2d01('0x36')]=_0x224190[_0x2d01('0x36')]['length']?_0x224190[_0x2d01('0x36')]:_0x2e1275[_0x2d01('0x32')];if(_0x48f664['query']['includeAll']){_0x224190['include']=[{'all':!![]}];}_0x224190=_[_0x2d01('0x3e')]({},_0x224190,_0x48f664[_0x2d01('0x41')]);return db['JscriptyQuestionReport'][_0x2d01('0x48')](_0x224190)[_0x2d01('0x26')](handleEntityNotFound(_0x3f72b6,null))[_0x2d01('0x26')](respondWithResult(_0x3f72b6,null))[_0x2d01('0x44')](handleError(_0x3f72b6,null));};exports['create']=function(_0x123e72,_0x56b1d8){return db[_0x2d01('0x2d')][_0x2d01('0x49')](_0x123e72[_0x2d01('0x4a')],{})[_0x2d01('0x26')](respondWithResult(_0x56b1d8,0xc9))[_0x2d01('0x44')](handleError(_0x56b1d8,null));};exports[_0x2d01('0x24')]=function(_0x5d3e26,_0x5e8685){if(_0x5d3e26['body']['id']){delete _0x5d3e26[_0x2d01('0x4a')]['id'];}return db[_0x2d01('0x2d')]['find']({'where':{'id':_0x5d3e26[_0x2d01('0x46')]['id']}})[_0x2d01('0x26')](handleEntityNotFound(_0x5e8685,null))['then'](saveUpdates(_0x5d3e26[_0x2d01('0x4a')],null))[_0x2d01('0x26')](respondWithResult(_0x5e8685,null))[_0x2d01('0x44')](handleError(_0x5e8685,null));};exports[_0x2d01('0x25')]=function(_0x31e9ff,_0xf2d311){return db[_0x2d01('0x2d')][_0x2d01('0x48')]({'where':{'id':_0x31e9ff['params']['id']}})['then'](handleEntityNotFound(_0xf2d311,null))[_0x2d01('0x26')](removeEntity(_0xf2d311,null))[_0x2d01('0x44')](handleError(_0xf2d311,null));};exports[_0x2d01('0x4b')]=function(_0xa78234,_0x8021cd){return db['JscriptyQuestionReport']['describe']()[_0x2d01('0x26')](respondWithResult(_0x8021cd,null))[_0x2d01('0x44')](handleError(_0x8021cd,null));}; \ No newline at end of file +var _0x60fe=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2a6501,_0x9c5a0e){var _0x34d3ae=function(_0x204c8b){while(--_0x204c8b){_0x2a6501['push'](_0x2a6501['shift']());}};_0x34d3ae(++_0x9c5a0e);}(_0x60fe,0x120));var _0xe60f=function(_0x2e846d,_0x370cd6){_0x2e846d=_0x2e846d-0x0;var _0x10a6ab=_0x60fe[_0x2e846d];return _0x10a6ab;};'use strict';var emlformat=require(_0xe60f('0x0'));var rimraf=require(_0xe60f('0x1'));var zipdir=require(_0xe60f('0x2'));var jsonpatch=require(_0xe60f('0x3'));var rp=require(_0xe60f('0x4'));var moment=require('moment');var BPromise=require(_0xe60f('0x5'));var Mustache=require('mustache');var util=require(_0xe60f('0x6'));var path=require(_0xe60f('0x7'));var sox=require(_0xe60f('0x8'));var csv=require(_0xe60f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe60f('0xa'));var _=require(_0xe60f('0xb'));var squel=require(_0xe60f('0xc'));var crypto=require(_0xe60f('0xd'));var jsforce=require(_0xe60f('0xe'));var deskjs=require(_0xe60f('0xf'));var toCsv=require(_0xe60f('0x9'));var querystring=require(_0xe60f('0x10'));var Papa=require(_0xe60f('0x11'));var Redis=require(_0xe60f('0x12'));var authService=require(_0xe60f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe60f('0x14'));var hardwareService=require(_0xe60f('0x15'));var logger=require(_0xe60f('0x16'))(_0xe60f('0x17'));var utils=require(_0xe60f('0x18'));var config=require(_0xe60f('0x19'));var licenseUtil=require(_0xe60f('0x1a'));var db=require(_0xe60f('0x1b'))['db'];function respondWithStatusCode(_0x7bb291,_0x3424a8){_0x3424a8=_0x3424a8||0xcc;return function(_0x354d1a){if(_0x354d1a){return _0x7bb291['sendStatus'](_0x3424a8);}return _0x7bb291[_0xe60f('0x1c')](_0x3424a8)[_0xe60f('0x1d')]();};}function respondWithResult(_0x2d7f7b,_0x453014){_0x453014=_0x453014||0xc8;return function(_0x2d44f7){if(_0x2d44f7){return _0x2d7f7b['status'](_0x453014)[_0xe60f('0x1e')](_0x2d44f7);}};}function respondWithFilteredResult(_0x1befa0,_0x51ea64){return function(_0x1cbc56){if(_0x1cbc56){var _0x19c3c1=typeof _0x51ea64[_0xe60f('0x1f')]===_0xe60f('0x20')&&typeof _0x51ea64['limit']===_0xe60f('0x20');var _0x30c950=_0x1cbc56[_0xe60f('0x21')];var _0x17deb9=_0x19c3c1?0x0:_0x51ea64[_0xe60f('0x1f')];var _0x507168=_0x19c3c1?_0x1cbc56[_0xe60f('0x21')]:_0x51ea64[_0xe60f('0x1f')]+_0x51ea64['limit'];var _0x18e52c;if(_0x507168>=_0x30c950){_0x507168=_0x30c950;_0x18e52c=0xc8;}else{_0x18e52c=0xce;}_0x1befa0['status'](_0x18e52c);return _0x1befa0[_0xe60f('0x22')](_0xe60f('0x23'),_0x17deb9+'-'+_0x507168+'/'+_0x30c950)[_0xe60f('0x1e')](_0x1cbc56);}return null;};}function patchUpdates(_0x31973e){return function(_0x264601){try{jsonpatch['apply'](_0x264601,_0x31973e,!![]);}catch(_0xc9249){return BPromise['reject'](_0xc9249);}return _0x264601[_0xe60f('0x24')]();};}function saveUpdates(_0x309433,_0x25d13b){return function(_0xbe1163){if(_0xbe1163){return _0xbe1163[_0xe60f('0x25')](_0x309433)[_0xe60f('0x26')](function(_0x3ee56c){return _0x3ee56c;});}return null;};}function removeEntity(_0x5ebd91,_0x5180ab){return function(_0x395a5e){if(_0x395a5e){return _0x395a5e[_0xe60f('0x27')]()['then'](function(){_0x5ebd91[_0xe60f('0x1c')](0xcc)[_0xe60f('0x1d')]();});}};}function handleEntityNotFound(_0x3b3e51,_0x1497ec){return function(_0xbe8f80){if(!_0xbe8f80){_0x3b3e51[_0xe60f('0x28')](0x194);}return _0xbe8f80;};}function handleError(_0x2c65d9,_0x44abe5){_0x44abe5=_0x44abe5||0x1f4;return function(_0x8c2bf4){logger[_0xe60f('0x29')](_0x8c2bf4[_0xe60f('0x2a')]);if(_0x8c2bf4[_0xe60f('0x2b')]){delete _0x8c2bf4[_0xe60f('0x2b')];}_0x2c65d9['status'](_0x44abe5)['send'](_0x8c2bf4);};}exports['index']=function(_0x24eba6,_0x9cba77){var _0x47c141={},_0x5424c3={},_0x4f6cd8={'count':0x0,'rows':[]};var _0x289204=_['map'](db[_0xe60f('0x2c')][_0xe60f('0x2d')],function(_0x2094a1){return{'name':_0x2094a1[_0xe60f('0x2e')],'type':_0x2094a1['type'][_0xe60f('0x2f')]};});_0x5424c3[_0xe60f('0x30')]=_[_0xe60f('0x31')](_0x289204,_0xe60f('0x2b'));_0x5424c3[_0xe60f('0x32')]=_['keys'](_0x24eba6['query']);_0x5424c3['filters']=_[_0xe60f('0x33')](_0x5424c3[_0xe60f('0x30')],_0x5424c3['query']);_0x47c141['attributes']=_[_0xe60f('0x33')](_0x5424c3[_0xe60f('0x30')],qs[_0xe60f('0x34')](_0x24eba6[_0xe60f('0x32')][_0xe60f('0x34')]));_0x47c141[_0xe60f('0x35')]=_0x47c141[_0xe60f('0x35')][_0xe60f('0x36')]?_0x47c141[_0xe60f('0x35')]:_0x5424c3['model'];if(!_0x24eba6[_0xe60f('0x32')][_0xe60f('0x37')](_0xe60f('0x38'))){_0x47c141[_0xe60f('0x39')]=qs['limit'](_0x24eba6[_0xe60f('0x32')]['limit']);_0x47c141['offset']=qs[_0xe60f('0x1f')](_0x24eba6[_0xe60f('0x32')][_0xe60f('0x1f')]);}_0x47c141[_0xe60f('0x3a')]=qs[_0xe60f('0x3b')](_0x24eba6['query'][_0xe60f('0x3b')]);_0x47c141[_0xe60f('0x3c')]=qs[_0xe60f('0x3d')](_['pick'](_0x24eba6[_0xe60f('0x32')],_0x5424c3['filters']),_0x289204);if(_0x24eba6[_0xe60f('0x32')][_0xe60f('0x3e')]){_0x47c141[_0xe60f('0x3c')]=_[_0xe60f('0x3f')](_0x47c141[_0xe60f('0x3c')],{'$or':_[_0xe60f('0x31')](_0x289204,function(_0xbb6358){if(_0xbb6358['type']!==_0xe60f('0x40')){var _0x643d28={};_0x643d28[_0xbb6358[_0xe60f('0x2b')]]={'$like':'%'+_0x24eba6[_0xe60f('0x32')][_0xe60f('0x3e')]+'%'};return _0x643d28;}})});}_0x47c141=_['merge']({},_0x47c141,_0x24eba6[_0xe60f('0x41')]);var _0x32d190={'where':_0x47c141[_0xe60f('0x3c')]};return db[_0xe60f('0x2c')][_0xe60f('0x21')](_0x32d190)['then'](function(_0x1e2613){_0x4f6cd8['count']=_0x1e2613;if(_0x24eba6['query'][_0xe60f('0x42')]){_0x47c141['include']=[{'all':!![]}];}return db[_0xe60f('0x2c')][_0xe60f('0x43')](_0x47c141);})[_0xe60f('0x26')](function(_0x30fda4){_0x4f6cd8[_0xe60f('0x44')]=_0x30fda4;return _0x4f6cd8;})[_0xe60f('0x26')](respondWithFilteredResult(_0x9cba77,_0x47c141))[_0xe60f('0x45')](handleError(_0x9cba77,null));};exports[_0xe60f('0x46')]=function(_0x517ee4,_0x3ee614){var _0x5d1738={'raw':!![],'where':{'id':_0x517ee4[_0xe60f('0x47')]['id']}},_0x1e2e42={};_0x1e2e42['model']=_[_0xe60f('0x48')](db[_0xe60f('0x2c')][_0xe60f('0x2d')]);_0x1e2e42[_0xe60f('0x32')]=_[_0xe60f('0x48')](_0x517ee4[_0xe60f('0x32')]);_0x1e2e42[_0xe60f('0x3d')]=_['intersection'](_0x1e2e42[_0xe60f('0x30')],_0x1e2e42[_0xe60f('0x32')]);_0x5d1738['attributes']=_[_0xe60f('0x33')](_0x1e2e42[_0xe60f('0x30')],qs[_0xe60f('0x34')](_0x517ee4[_0xe60f('0x32')]['fields']));_0x5d1738[_0xe60f('0x35')]=_0x5d1738['attributes'][_0xe60f('0x36')]?_0x5d1738[_0xe60f('0x35')]:_0x1e2e42['model'];if(_0x517ee4[_0xe60f('0x32')][_0xe60f('0x42')]){_0x5d1738[_0xe60f('0x49')]=[{'all':!![]}];}_0x5d1738=_[_0xe60f('0x3f')]({},_0x5d1738,_0x517ee4['options']);return db[_0xe60f('0x2c')][_0xe60f('0x4a')](_0x5d1738)[_0xe60f('0x26')](handleEntityNotFound(_0x3ee614,null))[_0xe60f('0x26')](respondWithResult(_0x3ee614,null))['catch'](handleError(_0x3ee614,null));};exports[_0xe60f('0x4b')]=function(_0x44cdec,_0x3f1275){return db['JscriptyQuestionReport'][_0xe60f('0x4b')](_0x44cdec[_0xe60f('0x4c')],{})[_0xe60f('0x26')](respondWithResult(_0x3f1275,0xc9))['catch'](handleError(_0x3f1275,null));};exports[_0xe60f('0x25')]=function(_0x1fcce1,_0x426c80){if(_0x1fcce1[_0xe60f('0x4c')]['id']){delete _0x1fcce1['body']['id'];}return db[_0xe60f('0x2c')][_0xe60f('0x4a')]({'where':{'id':_0x1fcce1[_0xe60f('0x47')]['id']}})[_0xe60f('0x26')](handleEntityNotFound(_0x426c80,null))[_0xe60f('0x26')](saveUpdates(_0x1fcce1[_0xe60f('0x4c')],null))[_0xe60f('0x26')](respondWithResult(_0x426c80,null))['catch'](handleError(_0x426c80,null));};exports[_0xe60f('0x27')]=function(_0x216ba4,_0x1c1720){return db[_0xe60f('0x2c')][_0xe60f('0x4a')]({'where':{'id':_0x216ba4[_0xe60f('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c1720,null))[_0xe60f('0x26')](removeEntity(_0x1c1720,null))[_0xe60f('0x45')](handleError(_0x1c1720,null));};exports[_0xe60f('0x4d')]=function(_0x116b93,_0x49a78e){return db['JscriptyQuestionReport'][_0xe60f('0x4d')]()['then'](respondWithResult(_0x49a78e,null))[_0xe60f('0x45')](handleError(_0x49a78e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e3ddc9d..3a86a89 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 _0x4746=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4746,0xa3));var _0x6474=function(_0x584a31,_0x221fed){_0x584a31=_0x584a31-0x0;var _0x93733c=_0x4746[_0x584a31];return _0x93733c;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require(_0x6474('0x2'))(_0x6474('0x3'));var moment=require(_0x6474('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x221484,_0x50860f){return _0x221484[_0x6474('0x8')](_0x6474('0x9'),attributes,{'tableName':_0x6474('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af4=['report_jscripty_questions','lodash','util','api','moment','bluebird','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x4af4,0x1c1));var _0x44af=function(_0x5613bc,_0x4521b3){_0x5613bc=_0x5613bc-0x0;var _0x4fee66=_0x4af4[_0x5613bc];return _0x4fee66;};'use strict';var _=require(_0x44af('0x0'));var util=require(_0x44af('0x1'));var logger=require('../../config/logger')(_0x44af('0x2'));var moment=require(_0x44af('0x3'));var BPromise=require(_0x44af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44af('0x5'));var attributes=require(_0x44af('0x6'));module['exports']=function(_0x5a2281,_0x13f438){return _0x5a2281['define']('JscriptyQuestionReport',attributes,{'tableName':_0x44af('0x7'),'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 b14a5eb..3352c4b 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 _0xd1ca=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e6aed,_0x97a2f1){var _0x3220dd=function(_0x252cd2){while(--_0x252cd2){_0x3e6aed['push'](_0x3e6aed['shift']());}};_0x3220dd(++_0x97a2f1);}(_0xd1ca,0xa4));var _0xad1c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd1ca[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var moment=require(_0xad1c('0x2'));var BPromise=require('bluebird');var rs=require(_0xad1c('0x3'));var fs=require('fs');var Redis=require(_0xad1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad1c('0x5'));var logger=require(_0xad1c('0x6'))('rpc');var config=require(_0xad1c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xad1c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad847,_0x2535c4,_0x3a0be9){return new BPromise(function(_0x388b4a,_0x4c055d){return client[_0xad1c('0x9')](_0x4ad847,_0x3a0be9)['then'](function(_0x438cc3){logger['info'](_0xad1c('0xa'),_0x2535c4,_0xad1c('0xb'));logger[_0xad1c('0xc')](_0xad1c('0xd'),_0x2535c4,_0xad1c('0xb'),JSON['stringify'](_0x438cc3));if(_0x438cc3[_0xad1c('0xe')]){if(_0x438cc3[_0xad1c('0xe')][_0xad1c('0xf')]===0x1f4){logger[_0xad1c('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2535c4,_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);return _0x4c055d(_0x438cc3[_0xad1c('0xe')]['message']);}logger[_0xad1c('0xe')](_0xad1c('0xa'),_0x2535c4,_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);return _0x388b4a(_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);}else{logger[_0xad1c('0x11')](_0xad1c('0xa'),_0x2535c4,_0xad1c('0xb'));_0x388b4a(_0x438cc3[_0xad1c('0x12')][_0xad1c('0x10')]);}})[_0xad1c('0x13')](function(_0x10d74a){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2535c4,_0x10d74a);_0x4c055d(_0x10d74a);});});} \ No newline at end of file +var _0x623b=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x32a254,_0x14e1d0){var _0x799afb=function(_0x47e462){while(--_0x47e462){_0x32a254['push'](_0x32a254['shift']());}};_0x799afb(++_0x14e1d0);}(_0x623b,0x135));var _0xb623=function(_0x48b5a2,_0x5014c7){_0x48b5a2=_0x48b5a2-0x0;var _0xc7f542=_0x623b[_0x48b5a2];return _0xc7f542;};'use strict';var _=require(_0xb623('0x0'));var util=require(_0xb623('0x1'));var moment=require(_0xb623('0x2'));var BPromise=require(_0xb623('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb623('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb623('0x5'))(_0xb623('0x6'));var config=require(_0xb623('0x7'));var jayson=require(_0xb623('0x8'));var client=jayson[_0xb623('0x9')][_0xb623('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4372d6,_0x346851,_0x3c983d){return new BPromise(function(_0x3a10c1,_0x41096e){return client[_0xb623('0xb')](_0x4372d6,_0x3c983d)[_0xb623('0xc')](function(_0x246e03){logger['info'](_0xb623('0xd'),_0x346851,_0xb623('0xe'));logger['debug'](_0xb623('0xf'),_0x346851,_0xb623('0xe'),JSON['stringify'](_0x246e03));if(_0x246e03['error']){if(_0x246e03[_0xb623('0x10')][_0xb623('0x11')]===0x1f4){logger[_0xb623('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x346851,_0x246e03[_0xb623('0x10')][_0xb623('0x12')]);return _0x41096e(_0x246e03[_0xb623('0x10')][_0xb623('0x12')]);}logger[_0xb623('0x10')](_0xb623('0xd'),_0x346851,_0x246e03['error']['message']);return _0x3a10c1(_0x246e03['error']['message']);}else{logger[_0xb623('0x13')](_0xb623('0xd'),_0x346851,_0xb623('0xe'));_0x3a10c1(_0x246e03[_0xb623('0x14')]['message']);}})[_0xb623('0x15')](function(_0x5045fb){logger['error'](_0xb623('0xd'),_0x346851,_0x5045fb);_0x41096e(_0x5045fb);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5aa8529..c07b53b 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 _0x40f6=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports'];(function(_0x2a7813,_0x2d564d){var _0x1b8b5b=function(_0x5bf853){while(--_0x5bf853){_0x2a7813['push'](_0x2a7813['shift']());}};_0x1b8b5b(++_0x2d564d);}(_0x40f6,0xfd));var _0x640f=function(_0x3d044f,_0x32ed81){_0x3d044f=_0x3d044f-0x0;var _0x4d113d=_0x40f6[_0x3d044f];return _0x4d113d;};'use strict';var multer=require(_0x640f('0x0'));var util=require('util');var path=require(_0x640f('0x1'));var timeout=require(_0x640f('0x2'));var express=require(_0x640f('0x3'));var router=express[_0x640f('0x4')]();var fs_extra=require(_0x640f('0x5'));var auth=require(_0x640f('0x6'));var interaction=require(_0x640f('0x7'));var config=require('../../config/environment');var controller=require(_0x640f('0x8'));router['get']('/',auth[_0x640f('0x9')](),controller[_0x640f('0xa')]);router['get'](_0x640f('0xb'),auth[_0x640f('0x9')](),controller['describe']);router[_0x640f('0xc')](_0x640f('0xd'),auth[_0x640f('0x9')](),controller[_0x640f('0xe')]);router[_0x640f('0xc')](_0x640f('0xf'),auth[_0x640f('0x9')](),controller[_0x640f('0x10')]);router[_0x640f('0x11')]('/',auth[_0x640f('0x9')](),controller[_0x640f('0x12')]);router[_0x640f('0x13')](_0x640f('0xd'),auth[_0x640f('0x9')](),controller[_0x640f('0x14')]);router['delete'](_0x640f('0xd'),auth['isAuthenticated'](),controller[_0x640f('0x15')]);module[_0x640f('0x16')]=router; \ No newline at end of file +var _0x273e=['index','/describe','describe','/:id','show','/:id/questions','isAuthenticated','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get'];(function(_0x2a8a9,_0x2cd671){var _0x1d8af0=function(_0x351196){while(--_0x351196){_0x2a8a9['push'](_0x2a8a9['shift']());}};_0x1d8af0(++_0x2cd671);}(_0x273e,0x158));var _0xe273=function(_0x333ed0,_0x24e1a9){_0x333ed0=_0x333ed0-0x0;var _0x558ab7=_0x273e[_0x333ed0];return _0x558ab7;};'use strict';var multer=require(_0xe273('0x0'));var util=require(_0xe273('0x1'));var path=require(_0xe273('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe273('0x3')]();var fs_extra=require(_0xe273('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe273('0x5'));var config=require('../../config/environment');var controller=require(_0xe273('0x6'));router[_0xe273('0x7')]('/',auth['isAuthenticated'](),controller[_0xe273('0x8')]);router[_0xe273('0x7')](_0xe273('0x9'),auth['isAuthenticated'](),controller[_0xe273('0xa')]);router['get'](_0xe273('0xb'),auth['isAuthenticated'](),controller[_0xe273('0xc')]);router[_0xe273('0x7')](_0xe273('0xd'),auth[_0xe273('0xe')](),controller[_0xe273('0xf')]);router[_0xe273('0x10')]('/',auth[_0xe273('0xe')](),controller['create']);router[_0xe273('0x11')](_0xe273('0xb'),auth[_0xe273('0xe')](),controller[_0xe273('0x12')]);router[_0xe273('0x13')](_0xe273('0xb'),auth[_0xe273('0xe')](),controller[_0xe273('0x14')]);module[_0xe273('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3eb02cd..0cf4a9b 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 _0x3951=['endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports','setDataValue','starttime'];(function(_0xdbd5ac,_0x568e65){var _0x4cd244=function(_0x114d58){while(--_0x114d58){_0xdbd5ac['push'](_0xdbd5ac['shift']());}};_0x4cd244(++_0x568e65);}(_0x3951,0xdd));var _0x1395=function(_0x34404e,_0x4261e5){_0x34404e=_0x34404e-0x0;var _0x3f260d=_0x3951[_0x34404e];return _0x3f260d;};'use strict';var moment=require(_0x1395('0x0'));var Sequelize=require('sequelize');module[_0x1395('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x249d81){this[_0x1395('0x2')](_0x1395('0x3'),_0x249d81);this[_0x1395('0x2')](_0x1395('0x4'),moment()['format'](_0x1395('0x5')));}},'endtime':{'type':Sequelize[_0x1395('0x6')]},'membername':{'type':Sequelize[_0x1395('0x7')]},'projectname':{'type':Sequelize[_0x1395('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1395('0x7')]},'calleridname':{'type':Sequelize[_0x1395('0x7')]},'calleridnum':{'type':Sequelize[_0x1395('0x7')]},'completed':{'type':Sequelize[_0x1395('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x20f2=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x20f2,0x1e6));var _0x220f=function(_0xb8245e,_0x41ab7a){_0xb8245e=_0xb8245e-0x0;var _0x2f5a62=_0x20f2[_0xb8245e];return _0x2f5a62;};'use strict';var moment=require(_0x220f('0x0'));var Sequelize=require(_0x220f('0x1'));module[_0x220f('0x2')]={'starttime':{'type':Sequelize[_0x220f('0x3')],'set':function(_0x3c55d0){this[_0x220f('0x4')](_0x220f('0x5'),_0x3c55d0);this[_0x220f('0x4')](_0x220f('0x6'),moment()[_0x220f('0x7')](_0x220f('0x8')));}},'endtime':{'type':Sequelize[_0x220f('0x3')]},'membername':{'type':Sequelize[_0x220f('0x9')]},'projectname':{'type':Sequelize[_0x220f('0x9')]},'queue':{'type':Sequelize[_0x220f('0x9')]},'uniqueid':{'type':Sequelize[_0x220f('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x220f('0x9')]},'completed':{'type':Sequelize[_0x220f('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2946e3a..63fe8ec 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 _0xe71c=['apply','reject','save','then','destroy','status','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filters','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','intersection','order','sort','SessionId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','set','Content-Range'];(function(_0xdfe0e2,_0x4db65c){var _0x128349=function(_0x405ee6){while(--_0x405ee6){_0xdfe0e2['push'](_0xdfe0e2['shift']());}};_0x128349(++_0x4db65c);}(_0xe71c,0x180));var _0xce71=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe71c[_0x37a7c6];return _0x539905;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce71('0x0'));var zipdir=require(_0xce71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce71('0x2'));var moment=require(_0xce71('0x3'));var BPromise=require(_0xce71('0x4'));var Mustache=require(_0xce71('0x5'));var util=require(_0xce71('0x6'));var path=require('path');var sox=require(_0xce71('0x7'));var csv=require(_0xce71('0x8'));var ejs=require(_0xce71('0x9'));var fs=require('fs');var fs_extra=require(_0xce71('0xa'));var _=require(_0xce71('0xb'));var squel=require(_0xce71('0xc'));var crypto=require(_0xce71('0xd'));var jsforce=require(_0xce71('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce71('0xf'));var Papa=require(_0xce71('0x10'));var Redis=require(_0xce71('0x11'));var authService=require(_0xce71('0x12'));var qs=require(_0xce71('0x13'));var as=require(_0xce71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xce71('0x15'));var config=require(_0xce71('0x16'));var licenseUtil=require(_0xce71('0x17'));var db=require(_0xce71('0x18'))['db'];function respondWithStatusCode(_0x65c8f4,_0x3ce4b9){_0x3ce4b9=_0x3ce4b9||0xcc;return function(_0x5581df){if(_0x5581df){return _0x65c8f4['sendStatus'](_0x3ce4b9);}return _0x65c8f4['status'](_0x3ce4b9)['end']();};}function respondWithResult(_0x29c8c3,_0x149b03){_0x149b03=_0x149b03||0xc8;return function(_0x314413){if(_0x314413){return _0x29c8c3['status'](_0x149b03)[_0xce71('0x19')](_0x314413);}};}function respondWithFilteredResult(_0x3e5d4b,_0x147035){return function(_0x5eb051){if(_0x5eb051){var _0x390fbf=typeof _0x147035[_0xce71('0x1a')]===_0xce71('0x1b')&&typeof _0x147035[_0xce71('0x1c')]===_0xce71('0x1b');var _0x15e14a=_0x5eb051['count'];var _0x42d2b1=_0x390fbf?0x0:_0x147035[_0xce71('0x1a')];var _0x1ab618=_0x390fbf?_0x5eb051['count']:_0x147035['offset']+_0x147035[_0xce71('0x1c')];var _0xe026ea;if(_0x1ab618>=_0x15e14a){_0x1ab618=_0x15e14a;_0xe026ea=0xc8;}else{_0xe026ea=0xce;}_0x3e5d4b['status'](_0xe026ea);return _0x3e5d4b[_0xce71('0x1d')](_0xce71('0x1e'),_0x42d2b1+'-'+_0x1ab618+'/'+_0x15e14a)['json'](_0x5eb051);}return null;};}function patchUpdates(_0x2c7330){return function(_0x3e54b3){try{jsonpatch[_0xce71('0x1f')](_0x3e54b3,_0x2c7330,!![]);}catch(_0x45bf65){return BPromise[_0xce71('0x20')](_0x45bf65);}return _0x3e54b3[_0xce71('0x21')]();};}function saveUpdates(_0x5021f6,_0x3dec2c){return function(_0xdbcdd1){if(_0xdbcdd1){return _0xdbcdd1['update'](_0x5021f6)[_0xce71('0x22')](function(_0x3e189f){return _0x3e189f;});}return null;};}function removeEntity(_0x3583c8,_0x255ffe){return function(_0x17932a){if(_0x17932a){return _0x17932a[_0xce71('0x23')]()[_0xce71('0x22')](function(){_0x3583c8[_0xce71('0x24')](0xcc)[_0xce71('0x25')]();});}};}function handleEntityNotFound(_0x1583be,_0x406e80){return function(_0x3255fe){if(!_0x3255fe){_0x1583be[_0xce71('0x26')](0x194);}return _0x3255fe;};}function handleError(_0x511498,_0x11ccf8){_0x11ccf8=_0x11ccf8||0x1f4;return function(_0x1fef60){logger[_0xce71('0x27')](_0x1fef60[_0xce71('0x28')]);if(_0x1fef60[_0xce71('0x29')]){delete _0x1fef60[_0xce71('0x29')];}_0x511498['status'](_0x11ccf8)[_0xce71('0x2a')](_0x1fef60);};}exports[_0xce71('0x2b')]=function(_0x3bdace,_0x16b2af){var _0x514f10={},_0x250c18={},_0x6ec4bf={'count':0x0,'rows':[]};var _0x31ebae=_[_0xce71('0x2c')](db[_0xce71('0x2d')][_0xce71('0x2e')],function(_0x20b8bc){return{'name':_0x20b8bc['fieldName'],'type':_0x20b8bc[_0xce71('0x2f')][_0xce71('0x30')]};});_0x250c18[_0xce71('0x31')]=_[_0xce71('0x2c')](_0x31ebae,_0xce71('0x29'));_0x250c18[_0xce71('0x32')]=_['keys'](_0x3bdace[_0xce71('0x32')]);_0x250c18['filters']=_['intersection'](_0x250c18[_0xce71('0x31')],_0x250c18['query']);_0x514f10[_0xce71('0x33')]=_['intersection'](_0x250c18[_0xce71('0x31')],qs['fields'](_0x3bdace['query'][_0xce71('0x34')]));_0x514f10[_0xce71('0x33')]=_0x514f10[_0xce71('0x33')][_0xce71('0x35')]?_0x514f10['attributes']:_0x250c18[_0xce71('0x31')];if(!_0x3bdace['query'][_0xce71('0x36')](_0xce71('0x37'))){_0x514f10[_0xce71('0x1c')]=qs[_0xce71('0x1c')](_0x3bdace[_0xce71('0x32')][_0xce71('0x1c')]);_0x514f10[_0xce71('0x1a')]=qs['offset'](_0x3bdace['query'][_0xce71('0x1a')]);}_0x514f10['order']=qs['sort'](_0x3bdace[_0xce71('0x32')]['sort']);_0x514f10[_0xce71('0x38')]=qs['filters'](_[_0xce71('0x39')](_0x3bdace[_0xce71('0x32')],_0x250c18[_0xce71('0x3a')]),_0x31ebae);if(_0x3bdace[_0xce71('0x32')]['filter']){_0x514f10['where']=_[_0xce71('0x3b')](_0x514f10['where'],{'$or':_[_0xce71('0x2c')](_0x31ebae,function(_0x3e2cfd){if(_0x3e2cfd['type']!==_0xce71('0x3c')){var _0x1dd2c3={};_0x1dd2c3[_0x3e2cfd['name']]={'$like':'%'+_0x3bdace[_0xce71('0x32')][_0xce71('0x3d')]+'%'};return _0x1dd2c3;}})});}_0x514f10=_[_0xce71('0x3b')]({},_0x514f10,_0x3bdace[_0xce71('0x3e')]);var _0x4164bb={'where':_0x514f10['where']};return db[_0xce71('0x2d')][_0xce71('0x3f')](_0x4164bb)['then'](function(_0x509758){_0x6ec4bf[_0xce71('0x3f')]=_0x509758;if(_0x3bdace[_0xce71('0x32')]['includeAll']){_0x514f10[_0xce71('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xce71('0x41')](_0x514f10);})[_0xce71('0x22')](function(_0x5938e0){_0x6ec4bf[_0xce71('0x42')]=_0x5938e0;return _0x6ec4bf;})[_0xce71('0x22')](respondWithFilteredResult(_0x16b2af,_0x514f10))[_0xce71('0x43')](handleError(_0x16b2af,null));};exports[_0xce71('0x44')]=function(_0x4f86c3,_0x5d2498){var _0x5d9c99={'raw':!![],'where':{'id':_0x4f86c3[_0xce71('0x45')]['id']}},_0x3178af={};_0x3178af[_0xce71('0x31')]=_[_0xce71('0x46')](db['JscriptySessionReport'][_0xce71('0x2e')]);_0x3178af[_0xce71('0x32')]=_[_0xce71('0x46')](_0x4f86c3[_0xce71('0x32')]);_0x3178af[_0xce71('0x3a')]=_['intersection'](_0x3178af[_0xce71('0x31')],_0x3178af[_0xce71('0x32')]);_0x5d9c99['attributes']=_['intersection'](_0x3178af['model'],qs['fields'](_0x4f86c3['query'][_0xce71('0x34')]));_0x5d9c99[_0xce71('0x33')]=_0x5d9c99[_0xce71('0x33')][_0xce71('0x35')]?_0x5d9c99[_0xce71('0x33')]:_0x3178af[_0xce71('0x31')];if(_0x4f86c3['query']['includeAll']){_0x5d9c99['include']=[{'all':!![]}];}_0x5d9c99=_[_0xce71('0x3b')]({},_0x5d9c99,_0x4f86c3[_0xce71('0x3e')]);return db[_0xce71('0x2d')][_0xce71('0x47')](_0x5d9c99)[_0xce71('0x22')](handleEntityNotFound(_0x5d2498,null))[_0xce71('0x22')](respondWithResult(_0x5d2498,null))[_0xce71('0x43')](handleError(_0x5d2498,null));};exports[_0xce71('0x48')]=function(_0x544361,_0x501068){return db[_0xce71('0x2d')][_0xce71('0x48')](_0x544361[_0xce71('0x49')],{})[_0xce71('0x22')](respondWithResult(_0x501068,0xc9))[_0xce71('0x43')](handleError(_0x501068,null));};exports[_0xce71('0x4a')]=function(_0x255f7c,_0xd2f6cb){if(_0x255f7c['body']['id']){delete _0x255f7c[_0xce71('0x49')]['id'];}return db[_0xce71('0x2d')][_0xce71('0x47')]({'where':{'id':_0x255f7c['params']['id']}})[_0xce71('0x22')](handleEntityNotFound(_0xd2f6cb,null))[_0xce71('0x22')](saveUpdates(_0x255f7c[_0xce71('0x49')],null))[_0xce71('0x22')](respondWithResult(_0xd2f6cb,null))[_0xce71('0x43')](handleError(_0xd2f6cb,null));};exports[_0xce71('0x23')]=function(_0x230b3e,_0xbf67ca){return db[_0xce71('0x2d')]['find']({'where':{'id':_0x230b3e[_0xce71('0x45')]['id']}})[_0xce71('0x22')](handleEntityNotFound(_0xbf67ca,null))[_0xce71('0x22')](removeEntity(_0xbf67ca,null))[_0xce71('0x43')](handleError(_0xbf67ca,null));};exports[_0xce71('0x4b')]=function(_0x20402a,_0x3e2486){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x3e2486,null))[_0xce71('0x43')](handleError(_0x3e2486,null));};exports[_0xce71('0x4c')]=function(_0x7f3532,_0x2d9df1,_0x45a110){var _0x39c531={'raw':!![],'where':{}};var _0x5ebc25={};var _0x7f1a3d={'count':0x0,'rows':[]};return db[_0xce71('0x2d')][_0xce71('0x4d')]({'where':{'id':_0x7f3532[_0xce71('0x45')]['id']}})[_0xce71('0x22')](handleEntityNotFound(_0x2d9df1,null))['then'](function(_0x15ff96){if(_0x15ff96){_0x5ebc25[_0xce71('0x31')]=_['keys'](db[_0xce71('0x4e')][_0xce71('0x2e')]);_0x5ebc25[_0xce71('0x32')]=_[_0xce71('0x46')](_0x7f3532[_0xce71('0x32')]);_0x5ebc25[_0xce71('0x3a')]=_[_0xce71('0x4f')](_0x5ebc25['model'],_0x5ebc25[_0xce71('0x32')]);_0x39c531[_0xce71('0x33')]=_['intersection'](_0x5ebc25['model'],qs[_0xce71('0x34')](_0x7f3532[_0xce71('0x32')]['fields']));_0x39c531[_0xce71('0x33')]=_0x39c531['attributes']['length']?_0x39c531[_0xce71('0x33')]:_0x5ebc25[_0xce71('0x31')];if(!_0x7f3532[_0xce71('0x32')]['hasOwnProperty'](_0xce71('0x37'))){_0x39c531[_0xce71('0x1c')]=qs[_0xce71('0x1c')](_0x7f3532[_0xce71('0x32')][_0xce71('0x1c')]);_0x39c531[_0xce71('0x1a')]=qs['offset'](_0x7f3532[_0xce71('0x32')][_0xce71('0x1a')]);}_0x39c531[_0xce71('0x50')]=qs[_0xce71('0x51')](_0x7f3532[_0xce71('0x32')]['sort']);_0x39c531['where']=qs[_0xce71('0x3a')](_[_0xce71('0x39')](_0x7f3532['query'],_0x5ebc25['filters']));_0x39c531[_0xce71('0x38')][_0xce71('0x52')]=_0x15ff96['id'];if(_0x7f3532[_0xce71('0x32')][_0xce71('0x3d')]){_0x39c531['where']=_['merge'](_0x39c531[_0xce71('0x38')],{'$or':_[_0xce71('0x2c')](_0x39c531[_0xce71('0x33')],function(_0x2101c8){var _0x3665b3={};_0x3665b3[_0x2101c8]={'$like':'%'+_0x7f3532[_0xce71('0x32')][_0xce71('0x3d')]+'%'};return _0x3665b3;})});}_0x39c531=_['merge']({},_0x39c531,_0x7f3532['options']);return db['JscriptyQuestionReport']['count']({'where':_0x39c531[_0xce71('0x38')]})[_0xce71('0x22')](function(_0x47f5ae){_0x7f1a3d['count']=_0x47f5ae;if(_0x7f3532['query']['includeAll']){_0x39c531[_0xce71('0x40')]=[{'all':!![]}];}return db[_0xce71('0x4e')]['findAll'](_0x39c531);})[_0xce71('0x22')](function(_0x280189){_0x7f1a3d[_0xce71('0x42')]=_0x280189;return _0x7f1a3d;});}})[_0xce71('0x22')](respondWithFilteredResult(_0x2d9df1,_0x39c531))[_0xce71('0x43')](handleError(_0x2d9df1,null));}; \ No newline at end of file +var _0x289c=['params','find','catch','create','body','describe','getQuestions','findOne','SessionId','filter','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show'];(function(_0x370281,_0x50b615){var _0x33a7ae=function(_0x111586){while(--_0x111586){_0x370281['push'](_0x370281['shift']());}};_0x33a7ae(++_0x50b615);}(_0x289c,0xa3));var _0xc289=function(_0x2c6d74,_0x450a5b){_0x2c6d74=_0x2c6d74-0x0;var _0x3bd411=_0x289c[_0x2c6d74];return _0x3bd411;};'use strict';var emlformat=require(_0xc289('0x0'));var rimraf=require(_0xc289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc289('0x2'));var rp=require(_0xc289('0x3'));var moment=require(_0xc289('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc289('0x5'));var path=require(_0xc289('0x6'));var sox=require(_0xc289('0x7'));var csv=require(_0xc289('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc289('0x9'));var _=require('lodash');var squel=require(_0xc289('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc289('0xb'));var toCsv=require(_0xc289('0x8'));var querystring=require(_0xc289('0xc'));var Papa=require(_0xc289('0xd'));var Redis=require(_0xc289('0xe'));var authService=require(_0xc289('0xf'));var qs=require(_0xc289('0x10'));var as=require(_0xc289('0x11'));var hardwareService=require(_0xc289('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc289('0x13'));var config=require(_0xc289('0x14'));var licenseUtil=require(_0xc289('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a8af9,_0x46f672){_0x46f672=_0x46f672||0xcc;return function(_0x423264){if(_0x423264){return _0x5a8af9[_0xc289('0x16')](_0x46f672);}return _0x5a8af9['status'](_0x46f672)[_0xc289('0x17')]();};}function respondWithResult(_0x2def6d,_0x236e28){_0x236e28=_0x236e28||0xc8;return function(_0x13863a){if(_0x13863a){return _0x2def6d['status'](_0x236e28)[_0xc289('0x18')](_0x13863a);}};}function respondWithFilteredResult(_0x28ab12,_0x4f6a7a){return function(_0x11f42a){if(_0x11f42a){var _0x296b26=typeof _0x4f6a7a['offset']===_0xc289('0x19')&&typeof _0x4f6a7a[_0xc289('0x1a')]===_0xc289('0x19');var _0x2350f3=_0x11f42a[_0xc289('0x1b')];var _0xcec38f=_0x296b26?0x0:_0x4f6a7a[_0xc289('0x1c')];var _0x29b831=_0x296b26?_0x11f42a[_0xc289('0x1b')]:_0x4f6a7a[_0xc289('0x1c')]+_0x4f6a7a[_0xc289('0x1a')];var _0x286d81;if(_0x29b831>=_0x2350f3){_0x29b831=_0x2350f3;_0x286d81=0xc8;}else{_0x286d81=0xce;}_0x28ab12['status'](_0x286d81);return _0x28ab12[_0xc289('0x1d')](_0xc289('0x1e'),_0xcec38f+'-'+_0x29b831+'/'+_0x2350f3)[_0xc289('0x18')](_0x11f42a);}return null;};}function patchUpdates(_0x178dd9){return function(_0x1bcf54){try{jsonpatch['apply'](_0x1bcf54,_0x178dd9,!![]);}catch(_0x1ba58){return BPromise[_0xc289('0x1f')](_0x1ba58);}return _0x1bcf54[_0xc289('0x20')]();};}function saveUpdates(_0x4bfd6f,_0x12f9ba){return function(_0x3c51d2){if(_0x3c51d2){return _0x3c51d2[_0xc289('0x21')](_0x4bfd6f)[_0xc289('0x22')](function(_0x2def57){return _0x2def57;});}return null;};}function removeEntity(_0x2c93fd,_0x46dad8){return function(_0x2e9ac5){if(_0x2e9ac5){return _0x2e9ac5[_0xc289('0x23')]()[_0xc289('0x22')](function(){_0x2c93fd['status'](0xcc)[_0xc289('0x17')]();});}};}function handleEntityNotFound(_0x394ecf,_0x2219a4){return function(_0x341043){if(!_0x341043){_0x394ecf[_0xc289('0x16')](0x194);}return _0x341043;};}function handleError(_0x327c93,_0x5870a1){_0x5870a1=_0x5870a1||0x1f4;return function(_0x2bd9f8){logger[_0xc289('0x24')](_0x2bd9f8['stack']);if(_0x2bd9f8[_0xc289('0x25')]){delete _0x2bd9f8[_0xc289('0x25')];}_0x327c93['status'](_0x5870a1)[_0xc289('0x26')](_0x2bd9f8);};}exports[_0xc289('0x27')]=function(_0x250aa1,_0x4d42f9){var _0x38e10f={},_0x15145e={},_0x2ad104={'count':0x0,'rows':[]};var _0x3fdd91=_[_0xc289('0x28')](db[_0xc289('0x29')][_0xc289('0x2a')],function(_0xc213d7){return{'name':_0xc213d7[_0xc289('0x2b')],'type':_0xc213d7[_0xc289('0x2c')][_0xc289('0x2d')]};});_0x15145e[_0xc289('0x2e')]=_[_0xc289('0x28')](_0x3fdd91,_0xc289('0x25'));_0x15145e[_0xc289('0x2f')]=_[_0xc289('0x30')](_0x250aa1[_0xc289('0x2f')]);_0x15145e[_0xc289('0x31')]=_[_0xc289('0x32')](_0x15145e[_0xc289('0x2e')],_0x15145e['query']);_0x38e10f[_0xc289('0x33')]=_[_0xc289('0x32')](_0x15145e[_0xc289('0x2e')],qs[_0xc289('0x34')](_0x250aa1[_0xc289('0x2f')][_0xc289('0x34')]));_0x38e10f[_0xc289('0x33')]=_0x38e10f[_0xc289('0x33')]['length']?_0x38e10f[_0xc289('0x33')]:_0x15145e['model'];if(!_0x250aa1[_0xc289('0x2f')]['hasOwnProperty'](_0xc289('0x35'))){_0x38e10f[_0xc289('0x1a')]=qs[_0xc289('0x1a')](_0x250aa1[_0xc289('0x2f')][_0xc289('0x1a')]);_0x38e10f[_0xc289('0x1c')]=qs[_0xc289('0x1c')](_0x250aa1[_0xc289('0x2f')][_0xc289('0x1c')]);}_0x38e10f[_0xc289('0x36')]=qs[_0xc289('0x37')](_0x250aa1[_0xc289('0x2f')]['sort']);_0x38e10f[_0xc289('0x38')]=qs[_0xc289('0x31')](_[_0xc289('0x39')](_0x250aa1['query'],_0x15145e['filters']),_0x3fdd91);if(_0x250aa1[_0xc289('0x2f')]['filter']){_0x38e10f[_0xc289('0x38')]=_[_0xc289('0x3a')](_0x38e10f[_0xc289('0x38')],{'$or':_[_0xc289('0x28')](_0x3fdd91,function(_0xe77779){if(_0xe77779[_0xc289('0x2c')]!==_0xc289('0x3b')){var _0x5cc506={};_0x5cc506[_0xe77779[_0xc289('0x25')]]={'$like':'%'+_0x250aa1[_0xc289('0x2f')]['filter']+'%'};return _0x5cc506;}})});}_0x38e10f=_[_0xc289('0x3a')]({},_0x38e10f,_0x250aa1[_0xc289('0x3c')]);var _0x5a1141={'where':_0x38e10f['where']};return db['JscriptySessionReport'][_0xc289('0x1b')](_0x5a1141)['then'](function(_0x2b484e){_0x2ad104[_0xc289('0x1b')]=_0x2b484e;if(_0x250aa1['query'][_0xc289('0x3d')]){_0x38e10f[_0xc289('0x3e')]=[{'all':!![]}];}return db[_0xc289('0x29')]['findAll'](_0x38e10f);})[_0xc289('0x22')](function(_0x5cc565){_0x2ad104[_0xc289('0x3f')]=_0x5cc565;return _0x2ad104;})['then'](respondWithFilteredResult(_0x4d42f9,_0x38e10f))['catch'](handleError(_0x4d42f9,null));};exports[_0xc289('0x40')]=function(_0x1afdfa,_0x1a37ac){var _0x14cbe3={'raw':!![],'where':{'id':_0x1afdfa[_0xc289('0x41')]['id']}},_0x1f9a89={};_0x1f9a89[_0xc289('0x2e')]=_[_0xc289('0x30')](db[_0xc289('0x29')][_0xc289('0x2a')]);_0x1f9a89['query']=_[_0xc289('0x30')](_0x1afdfa['query']);_0x1f9a89['filters']=_[_0xc289('0x32')](_0x1f9a89[_0xc289('0x2e')],_0x1f9a89[_0xc289('0x2f')]);_0x14cbe3['attributes']=_[_0xc289('0x32')](_0x1f9a89[_0xc289('0x2e')],qs['fields'](_0x1afdfa[_0xc289('0x2f')][_0xc289('0x34')]));_0x14cbe3[_0xc289('0x33')]=_0x14cbe3['attributes']['length']?_0x14cbe3[_0xc289('0x33')]:_0x1f9a89['model'];if(_0x1afdfa[_0xc289('0x2f')][_0xc289('0x3d')]){_0x14cbe3[_0xc289('0x3e')]=[{'all':!![]}];}_0x14cbe3=_['merge']({},_0x14cbe3,_0x1afdfa[_0xc289('0x3c')]);return db[_0xc289('0x29')][_0xc289('0x42')](_0x14cbe3)['then'](handleEntityNotFound(_0x1a37ac,null))[_0xc289('0x22')](respondWithResult(_0x1a37ac,null))[_0xc289('0x43')](handleError(_0x1a37ac,null));};exports[_0xc289('0x44')]=function(_0x1bfaa1,_0x5a4846){return db[_0xc289('0x29')][_0xc289('0x44')](_0x1bfaa1[_0xc289('0x45')],{})[_0xc289('0x22')](respondWithResult(_0x5a4846,0xc9))['catch'](handleError(_0x5a4846,null));};exports[_0xc289('0x21')]=function(_0xd2ff1e,_0x16ca52){if(_0xd2ff1e[_0xc289('0x45')]['id']){delete _0xd2ff1e[_0xc289('0x45')]['id'];}return db[_0xc289('0x29')][_0xc289('0x42')]({'where':{'id':_0xd2ff1e[_0xc289('0x41')]['id']}})[_0xc289('0x22')](handleEntityNotFound(_0x16ca52,null))[_0xc289('0x22')](saveUpdates(_0xd2ff1e[_0xc289('0x45')],null))[_0xc289('0x22')](respondWithResult(_0x16ca52,null))[_0xc289('0x43')](handleError(_0x16ca52,null));};exports[_0xc289('0x23')]=function(_0x1ff735,_0x57469a){return db['JscriptySessionReport'][_0xc289('0x42')]({'where':{'id':_0x1ff735[_0xc289('0x41')]['id']}})['then'](handleEntityNotFound(_0x57469a,null))[_0xc289('0x22')](removeEntity(_0x57469a,null))[_0xc289('0x43')](handleError(_0x57469a,null));};exports['describe']=function(_0x281fb,_0x5c1492){return db[_0xc289('0x29')][_0xc289('0x46')]()[_0xc289('0x22')](respondWithResult(_0x5c1492,null))[_0xc289('0x43')](handleError(_0x5c1492,null));};exports[_0xc289('0x47')]=function(_0xbfb6a9,_0x526a42,_0x39da0c){var _0x1a1914={'raw':!![],'where':{}};var _0x2cca36={};var _0x37c651={'count':0x0,'rows':[]};return db[_0xc289('0x29')][_0xc289('0x48')]({'where':{'id':_0xbfb6a9['params']['id']}})['then'](handleEntityNotFound(_0x526a42,null))['then'](function(_0x1911c8){if(_0x1911c8){_0x2cca36[_0xc289('0x2e')]=_[_0xc289('0x30')](db['JscriptyQuestionReport'][_0xc289('0x2a')]);_0x2cca36[_0xc289('0x2f')]=_[_0xc289('0x30')](_0xbfb6a9[_0xc289('0x2f')]);_0x2cca36['filters']=_[_0xc289('0x32')](_0x2cca36[_0xc289('0x2e')],_0x2cca36['query']);_0x1a1914['attributes']=_[_0xc289('0x32')](_0x2cca36['model'],qs[_0xc289('0x34')](_0xbfb6a9[_0xc289('0x2f')][_0xc289('0x34')]));_0x1a1914[_0xc289('0x33')]=_0x1a1914[_0xc289('0x33')]['length']?_0x1a1914[_0xc289('0x33')]:_0x2cca36[_0xc289('0x2e')];if(!_0xbfb6a9['query']['hasOwnProperty'](_0xc289('0x35'))){_0x1a1914[_0xc289('0x1a')]=qs[_0xc289('0x1a')](_0xbfb6a9[_0xc289('0x2f')][_0xc289('0x1a')]);_0x1a1914[_0xc289('0x1c')]=qs[_0xc289('0x1c')](_0xbfb6a9[_0xc289('0x2f')][_0xc289('0x1c')]);}_0x1a1914[_0xc289('0x36')]=qs[_0xc289('0x37')](_0xbfb6a9['query'][_0xc289('0x37')]);_0x1a1914[_0xc289('0x38')]=qs[_0xc289('0x31')](_[_0xc289('0x39')](_0xbfb6a9[_0xc289('0x2f')],_0x2cca36[_0xc289('0x31')]));_0x1a1914[_0xc289('0x38')][_0xc289('0x49')]=_0x1911c8['id'];if(_0xbfb6a9[_0xc289('0x2f')][_0xc289('0x4a')]){_0x1a1914['where']=_[_0xc289('0x3a')](_0x1a1914[_0xc289('0x38')],{'$or':_[_0xc289('0x28')](_0x1a1914[_0xc289('0x33')],function(_0x1d2e9e){var _0x22b7b5={};_0x22b7b5[_0x1d2e9e]={'$like':'%'+_0xbfb6a9[_0xc289('0x2f')][_0xc289('0x4a')]+'%'};return _0x22b7b5;})});}_0x1a1914=_['merge']({},_0x1a1914,_0xbfb6a9[_0xc289('0x3c')]);return db['JscriptyQuestionReport'][_0xc289('0x1b')]({'where':_0x1a1914[_0xc289('0x38')]})[_0xc289('0x22')](function(_0x4ba381){_0x37c651[_0xc289('0x1b')]=_0x4ba381;if(_0xbfb6a9[_0xc289('0x2f')]['includeAll']){_0x1a1914[_0xc289('0x3e')]=[{'all':!![]}];}return db[_0xc289('0x4b')]['findAll'](_0x1a1914);})[_0xc289('0x22')](function(_0x3d7e8e){_0x37c651['rows']=_0x3d7e8e;return _0x37c651;});}})['then'](respondWithFilteredResult(_0x526a42,_0x1a1914))[_0xc289('0x43')](handleError(_0x526a42,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5a47ba8..7d28bb0 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 _0x3eea=['exports','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x45a5ae,_0x2d811c){var _0x597a83=function(_0xb8bcee){while(--_0xb8bcee){_0x45a5ae['push'](_0x45a5ae['shift']());}};_0x597a83(++_0x2d811c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x33a080,_0x479b75){_0x33a080=_0x33a080-0x0;var _0x24af39=_0x3eea[_0x33a080];return _0x24af39;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1fcf6c,_0x1613c0){_0x1fcf6c=_0x1fcf6c-0x0;var _0x40c5da=_0xb4c7[_0x1fcf6c];return _0x40c5da;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('0xb'),'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 e9de7f6..d58f292 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 _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x332985,_0x216420){var _0x1a77c1=function(_0x5a64fb){while(--_0x5a64fb){_0x332985['push'](_0x332985['shift']());}};_0x1a77c1(++_0x216420);}(_0x32b6,0x1d1));var _0x632b=function(_0x4f16ff,_0x247dc3){_0x4f16ff=_0x4f16ff-0x0;var _0xbdd1ed=_0x32b6[_0x4f16ff];return _0xbdd1ed;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file +var _0x1261=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x23b3df,_0x21ca6a){var _0x26488a=function(_0xf3d2dd){while(--_0xf3d2dd){_0x23b3df['push'](_0x23b3df['shift']());}};_0x26488a(++_0x21ca6a);}(_0x1261,0x144));var _0x1126=function(_0x3d5df9,_0x5b3623){_0x3d5df9=_0x3d5df9-0x0;var _0x50ba39=_0x1261[_0x3d5df9];return _0x50ba39;};'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')]('JscriptySessionReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cd07ad8..b0ed8c7 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 _0xdc3e=['/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','put','/:id','isAuthenticated','update'];(function(_0x1c4188,_0x257099){var _0x26dbba=function(_0x33a9a5){while(--_0x33a9a5){_0x1c4188['push'](_0x1c4188['shift']());}};_0x26dbba(++_0x257099);}(_0xdc3e,0x113));var _0xedc3=function(_0x2e58ff,_0x187c44){_0x2e58ff=_0x2e58ff-0x0;var _0x477b02=_0xdc3e[_0x2e58ff];return _0x477b02;};'use strict';var multer=require(_0xedc3('0x0'));var util=require('util');var path=require(_0xedc3('0x1'));var timeout=require(_0xedc3('0x2'));var express=require(_0xedc3('0x3'));var router=express[_0xedc3('0x4')]();var fs_extra=require(_0xedc3('0x5'));var auth=require(_0xedc3('0x6'));var interaction=require(_0xedc3('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xedc3('0x8')]('/',controller['index']);router[_0xedc3('0x9')](_0xedc3('0xa'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xc')]);router[_0xedc3('0x8')](_0xedc3('0xd'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xe')]);module[_0xedc3('0xf')]=router; \ No newline at end of file +var _0xba12=['Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','multer','util','path','connect-timeout'];(function(_0x7b68ba,_0x4c4b0d){var _0x2dda4c=function(_0x16b5d6){while(--_0x16b5d6){_0x7b68ba['push'](_0x7b68ba['shift']());}};_0x2dda4c(++_0x4c4b0d);}(_0xba12,0x16c));var _0x2ba1=function(_0x3ab0d0,_0x946c4e){_0x3ab0d0=_0x3ab0d0-0x0;var _0x3ee9a7=_0xba12[_0x3ab0d0];return _0x3ee9a7;};'use strict';var multer=require(_0x2ba1('0x0'));var util=require(_0x2ba1('0x1'));var path=require(_0x2ba1('0x2'));var timeout=require(_0x2ba1('0x3'));var express=require('express');var router=express[_0x2ba1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ba1('0x5'));var config=require(_0x2ba1('0x6'));var controller=require(_0x2ba1('0x7'));router[_0x2ba1('0x8')]('/',controller[_0x2ba1('0x9')]);router[_0x2ba1('0xa')](_0x2ba1('0xb'),auth[_0x2ba1('0xc')](),controller[_0x2ba1('0xd')]);router[_0x2ba1('0x8')]('/download_log_file',auth['isAuthenticated'](),controller[_0x2ba1('0xe')]);module[_0x2ba1('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 fdde17c..368af07 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 _0x87bd=['exports','TEXT','STRING','INTEGER'];(function(_0xe064bc,_0x2addbd){var _0x1839ba=function(_0x36bc39){while(--_0x36bc39){_0xe064bc['push'](_0xe064bc['shift']());}};_0x1839ba(++_0x2addbd);}(_0x87bd,0x1c8));var _0xd87b=function(_0x2ee71f,_0x35b42e){_0x2ee71f=_0x2ee71f-0x0;var _0xf95c54=_0x87bd[_0x2ee71f];return _0xf95c54;};'use strict';var Sequelize=require('sequelize');module[_0xd87b('0x0')]={'license':{'type':Sequelize[_0xd87b('0x1')]},'data1':{'type':Sequelize[_0xd87b('0x2')]},'data2':{'type':Sequelize[_0xd87b('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9119=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x28763e,_0x8fcea5){var _0x550795=function(_0x5eb7af){while(--_0x5eb7af){_0x28763e['push'](_0x28763e['shift']());}};_0x550795(++_0x8fcea5);}(_0x9119,0x1f1));var _0x9911=function(_0x3c3388,_0xdf58a0){_0x3c3388=_0x3c3388-0x0;var _0x570040=_0x9119[_0x3c3388];return _0x570040;};'use strict';var Sequelize=require(_0x9911('0x0'));module[_0x9911('0x1')]={'license':{'type':Sequelize[_0x9911('0x2')]},'data1':{'type':Sequelize[_0x9911('0x3')]},'data2':{'type':Sequelize[_0x9911('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x9911('0x4')],'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 cdeb232..6e80425 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 _0x88d5=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','then','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x11777c,_0x2c4318){var _0xc7fa8e=function(_0x2ee785){while(--_0x2ee785){_0x11777c['push'](_0x11777c['shift']());}};_0xc7fa8e(++_0x2c4318);}(_0x88d5,0x83));var _0x588d=function(_0x1ed78f,_0x5ab61b){_0x1ed78f=_0x1ed78f-0x0;var _0x46f620=_0x88d5[_0x1ed78f];return _0x46f620;};'use strict';var emlformat=require(_0x588d('0x0'));var rimraf=require(_0x588d('0x1'));var zipdir=require(_0x588d('0x2'));var jsonpatch=require(_0x588d('0x3'));var rp=require(_0x588d('0x4'));var moment=require(_0x588d('0x5'));var BPromise=require(_0x588d('0x6'));var Mustache=require(_0x588d('0x7'));var util=require(_0x588d('0x8'));var path=require(_0x588d('0x9'));var sox=require(_0x588d('0xa'));var csv=require(_0x588d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x588d('0xc'));var _=require(_0x588d('0xd'));var squel=require('squel');var crypto=require(_0x588d('0xe'));var jsforce=require(_0x588d('0xf'));var deskjs=require(_0x588d('0x10'));var toCsv=require(_0x588d('0xb'));var querystring=require(_0x588d('0x11'));var Papa=require(_0x588d('0x12'));var Redis=require(_0x588d('0x13'));var authService=require(_0x588d('0x14'));var qs=require(_0x588d('0x15'));var as=require(_0x588d('0x16'));var hardwareService=require(_0x588d('0x17'));var logger=require(_0x588d('0x18'))(_0x588d('0x19'));var utils=require(_0x588d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x588d('0x1b'));var db=require(_0x588d('0x1c'))['db'];function respondWithStatusCode(_0x3781c2,_0x4ff490){_0x4ff490=_0x4ff490||0xcc;return function(_0x34491e){if(_0x34491e){return _0x3781c2[_0x588d('0x1d')](_0x4ff490);}return _0x3781c2['status'](_0x4ff490)[_0x588d('0x1e')]();};}function respondWithResult(_0x149a9e,_0x3949ba){_0x3949ba=_0x3949ba||0xc8;return function(_0x12869e){if(_0x12869e){return _0x149a9e['status'](_0x3949ba)[_0x588d('0x1f')](_0x12869e);}};}function respondWithFilteredResult(_0x4013d0,_0x2d01dd){return function(_0x482c94){if(_0x482c94){var _0x4401cc=typeof _0x2d01dd[_0x588d('0x20')]===_0x588d('0x21')&&typeof _0x2d01dd[_0x588d('0x22')]===_0x588d('0x21');var _0x1ad40a=_0x482c94[_0x588d('0x23')];var _0x1f9f5d=_0x4401cc?0x0:_0x2d01dd['offset'];var _0x285f8f=_0x4401cc?_0x482c94[_0x588d('0x23')]:_0x2d01dd[_0x588d('0x20')]+_0x2d01dd['limit'];var _0x408018;if(_0x285f8f>=_0x1ad40a){_0x285f8f=_0x1ad40a;_0x408018=0xc8;}else{_0x408018=0xce;}_0x4013d0[_0x588d('0x24')](_0x408018);return _0x4013d0[_0x588d('0x25')](_0x588d('0x26'),_0x1f9f5d+'-'+_0x285f8f+'/'+_0x1ad40a)[_0x588d('0x1f')](_0x482c94);}return null;};}function patchUpdates(_0x31758a){return function(_0x52a5f1){try{jsonpatch['apply'](_0x52a5f1,_0x31758a,!![]);}catch(_0x2a4144){return BPromise[_0x588d('0x27')](_0x2a4144);}return _0x52a5f1[_0x588d('0x28')]();};}function saveUpdates(_0x569376,_0x2f4f8e){return function(_0x5a24f5){if(_0x5a24f5){return _0x5a24f5[_0x588d('0x29')](_0x569376)['then'](function(_0x563de6){return _0x563de6;});}return null;};}function removeEntity(_0x458622,_0x523db9){return function(_0x480fc6){if(_0x480fc6){return _0x480fc6[_0x588d('0x2a')]()['then'](function(){_0x458622[_0x588d('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126af0,_0x3d6734){return function(_0xceb173){if(!_0xceb173){_0x126af0[_0x588d('0x1d')](0x194);}return _0xceb173;};}function handleError(_0x3209c6,_0x2c862f){_0x2c862f=_0x2c862f||0x1f4;return function(_0x3badf7){logger[_0x588d('0x2b')](_0x3badf7[_0x588d('0x2c')]);if(_0x3badf7['name']){delete _0x3badf7[_0x588d('0x2d')];}_0x3209c6['status'](_0x2c862f)['send'](_0x3badf7);};}var utilLicense=require(_0x588d('0x1b'));exports[_0x588d('0x2e')]=function(_0x43ba2c,_0x4e58a5){var _0x8e9a3a={'raw':!![],'where':{'id':0x1}},_0x346b64={};_0x346b64[_0x588d('0x2f')]=_[_0x588d('0x30')](db[_0x588d('0x31')][_0x588d('0x32')]);_0x346b64[_0x588d('0x33')]=_[_0x588d('0x30')](_0x43ba2c[_0x588d('0x33')]);_0x346b64['filters']=_[_0x588d('0x34')](_0x346b64[_0x588d('0x2f')],_0x346b64[_0x588d('0x33')]);_0x8e9a3a[_0x588d('0x35')]=_['intersection'](_0x346b64[_0x588d('0x2f')],qs[_0x588d('0x36')](_0x43ba2c[_0x588d('0x33')][_0x588d('0x36')]));_0x8e9a3a[_0x588d('0x35')]=_0x8e9a3a['attributes'][_0x588d('0x37')]?_0x8e9a3a[_0x588d('0x35')]:_0x346b64[_0x588d('0x2f')];_0x8e9a3a=_[_0x588d('0x38')]({},_0x8e9a3a,_0x43ba2c[_0x588d('0x39')]);return utilLicense[_0x588d('0x3a')](_0x8e9a3a)['then'](respondWithResult(_0x4e58a5,null))[_0x588d('0x3b')](handleError(_0x4e58a5,null));};exports[_0x588d('0x29')]=function(_0x3261ec,_0x24e3aa){if(_0x3261ec[_0x588d('0x3c')]['id']){delete _0x3261ec[_0x588d('0x3c')]['id'];}return db['License'][_0x588d('0x3d')]({'where':{'id':_0x3261ec[_0x588d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24e3aa,null))['then'](function(_0x430ca5){var _0x379133=_0x430ca5['get']({'plain':!![]});return utilLicense[_0x588d('0x3f')](_0x379133,_0x3261ec['body'][_0x588d('0x40')]);})[_0x588d('0x41')](function(_0x4ceed1){if(!_0x4ceed1[_0x588d('0x42')]){return saveUpdates(_0x3261ec[_0x588d('0x3c')],null);}return _0x4ceed1;})['then'](respondWithResult(_0x24e3aa,null))['catch'](handleError(_0x24e3aa,null));};exports[_0x588d('0x43')]=function(_0x252f68,_0x14a613){var _0x2bf55d=_0x588d('0x44');var _0x530468=path[_0x588d('0x45')](_0x588d('0x46'),_0x588d('0x47'),_0x588d('0x48'),_0x2bf55d);_0x14a613['setHeader'](_0x588d('0x49'),'attachment;\x20filename='+_0x2bf55d);_0x14a613['set']('Content-Type',_0x588d('0x4a'));_0x14a613[_0x588d('0x4b')](_0x530468);}; \ No newline at end of file +var _0x9e4d=['key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','name','send','index','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','params','checkLicense'];(function(_0x232ca6,_0xd7fe4c){var _0x3787c6=function(_0x268ae2){while(--_0x268ae2){_0x232ca6['push'](_0x232ca6['shift']());}};_0x3787c6(++_0xd7fe4c);}(_0x9e4d,0xa1));var _0xd9e4=function(_0x3b6beb,_0xefcd2b){_0x3b6beb=_0x3b6beb-0x0;var _0x20b5dc=_0x9e4d[_0x3b6beb];return _0x20b5dc;};'use strict';var emlformat=require(_0xd9e4('0x0'));var rimraf=require(_0xd9e4('0x1'));var zipdir=require(_0xd9e4('0x2'));var jsonpatch=require(_0xd9e4('0x3'));var rp=require(_0xd9e4('0x4'));var moment=require(_0xd9e4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd9e4('0x6'));var path=require(_0xd9e4('0x7'));var sox=require(_0xd9e4('0x8'));var csv=require(_0xd9e4('0x9'));var ejs=require(_0xd9e4('0xa'));var fs=require('fs');var fs_extra=require(_0xd9e4('0xb'));var _=require(_0xd9e4('0xc'));var squel=require(_0xd9e4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd9e4('0xe'));var toCsv=require(_0xd9e4('0x9'));var querystring=require(_0xd9e4('0xf'));var Papa=require('papaparse');var Redis=require(_0xd9e4('0x10'));var authService=require(_0xd9e4('0x11'));var qs=require(_0xd9e4('0x12'));var as=require(_0xd9e4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9e4('0x14'))(_0xd9e4('0x15'));var utils=require(_0xd9e4('0x16'));var config=require(_0xd9e4('0x17'));var licenseUtil=require(_0xd9e4('0x18'));var db=require(_0xd9e4('0x19'))['db'];function respondWithStatusCode(_0x197977,_0x285dea){_0x285dea=_0x285dea||0xcc;return function(_0x294d24){if(_0x294d24){return _0x197977[_0xd9e4('0x1a')](_0x285dea);}return _0x197977['status'](_0x285dea)['end']();};}function respondWithResult(_0x41f85f,_0x108232){_0x108232=_0x108232||0xc8;return function(_0x291d5d){if(_0x291d5d){return _0x41f85f[_0xd9e4('0x1b')](_0x108232)[_0xd9e4('0x1c')](_0x291d5d);}};}function respondWithFilteredResult(_0x44ffb4,_0x38746e){return function(_0x2df8b2){if(_0x2df8b2){var _0x595de3=typeof _0x38746e[_0xd9e4('0x1d')]===_0xd9e4('0x1e')&&typeof _0x38746e[_0xd9e4('0x1f')]===_0xd9e4('0x1e');var _0xbe05f4=_0x2df8b2[_0xd9e4('0x20')];var _0x543a9b=_0x595de3?0x0:_0x38746e[_0xd9e4('0x1d')];var _0x116ba4=_0x595de3?_0x2df8b2['count']:_0x38746e[_0xd9e4('0x1d')]+_0x38746e['limit'];var _0x46b063;if(_0x116ba4>=_0xbe05f4){_0x116ba4=_0xbe05f4;_0x46b063=0xc8;}else{_0x46b063=0xce;}_0x44ffb4[_0xd9e4('0x1b')](_0x46b063);return _0x44ffb4[_0xd9e4('0x21')]('Content-Range',_0x543a9b+'-'+_0x116ba4+'/'+_0xbe05f4)[_0xd9e4('0x1c')](_0x2df8b2);}return null;};}function patchUpdates(_0x4a82d1){return function(_0x338925){try{jsonpatch[_0xd9e4('0x22')](_0x338925,_0x4a82d1,!![]);}catch(_0x43325a){return BPromise[_0xd9e4('0x23')](_0x43325a);}return _0x338925[_0xd9e4('0x24')]();};}function saveUpdates(_0x41d736,_0xbdbeb8){return function(_0x144e78){if(_0x144e78){return _0x144e78[_0xd9e4('0x25')](_0x41d736)[_0xd9e4('0x26')](function(_0xc2f819){return _0xc2f819;});}return null;};}function removeEntity(_0x5c2bf5,_0x8eeb1c){return function(_0x11b2c1){if(_0x11b2c1){return _0x11b2c1[_0xd9e4('0x27')]()[_0xd9e4('0x26')](function(){_0x5c2bf5['status'](0xcc)[_0xd9e4('0x28')]();});}};}function handleEntityNotFound(_0x5d3753,_0x35e936){return function(_0x4a63c4){if(!_0x4a63c4){_0x5d3753[_0xd9e4('0x1a')](0x194);}return _0x4a63c4;};}function handleError(_0x223e41,_0x4d628d){_0x4d628d=_0x4d628d||0x1f4;return function(_0x19e0e9){logger[_0xd9e4('0x29')](_0x19e0e9['stack']);if(_0x19e0e9[_0xd9e4('0x2a')]){delete _0x19e0e9['name'];}_0x223e41[_0xd9e4('0x1b')](_0x4d628d)[_0xd9e4('0x2b')](_0x19e0e9);};}var utilLicense=require('../../config/license/util');exports[_0xd9e4('0x2c')]=function(_0x4e4346,_0x37849a){var _0x40f34f={'raw':!![],'where':{'id':0x1}},_0xbf2b95={};_0xbf2b95['model']=_['keys'](db[_0xd9e4('0x2d')][_0xd9e4('0x2e')]);_0xbf2b95[_0xd9e4('0x2f')]=_['keys'](_0x4e4346[_0xd9e4('0x2f')]);_0xbf2b95[_0xd9e4('0x30')]=_[_0xd9e4('0x31')](_0xbf2b95[_0xd9e4('0x32')],_0xbf2b95[_0xd9e4('0x2f')]);_0x40f34f[_0xd9e4('0x33')]=_[_0xd9e4('0x31')](_0xbf2b95[_0xd9e4('0x32')],qs[_0xd9e4('0x34')](_0x4e4346['query'][_0xd9e4('0x34')]));_0x40f34f[_0xd9e4('0x33')]=_0x40f34f[_0xd9e4('0x33')][_0xd9e4('0x35')]?_0x40f34f['attributes']:_0xbf2b95[_0xd9e4('0x32')];_0x40f34f=_[_0xd9e4('0x36')]({},_0x40f34f,_0x4e4346[_0xd9e4('0x37')]);return utilLicense[_0xd9e4('0x38')](_0x40f34f)[_0xd9e4('0x26')](respondWithResult(_0x37849a,null))[_0xd9e4('0x39')](handleError(_0x37849a,null));};exports['update']=function(_0x31152d,_0x8ec5cd){if(_0x31152d['body']['id']){delete _0x31152d[_0xd9e4('0x3a')]['id'];}return db['License']['find']({'where':{'id':_0x31152d[_0xd9e4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x8ec5cd,null))[_0xd9e4('0x26')](function(_0x4afb88){var _0x3231c0=_0x4afb88['get']({'plain':!![]});return utilLicense[_0xd9e4('0x3c')](_0x3231c0,_0x31152d[_0xd9e4('0x3a')][_0xd9e4('0x3d')]);})[_0xd9e4('0x26')](function(_0x4b197f){if(!_0x4b197f[_0xd9e4('0x3e')]){return saveUpdates(_0x31152d['body'],null);}return _0x4b197f;})[_0xd9e4('0x26')](respondWithResult(_0x8ec5cd,null))['catch'](handleError(_0x8ec5cd,null));};exports[_0xd9e4('0x3f')]=function(_0x405ec6,_0x321427){var _0x291354='license-info.log';var _0x14ac5c=path[_0xd9e4('0x40')](_0xd9e4('0x41'),_0xd9e4('0x42'),_0xd9e4('0x43'),_0x291354);_0x321427[_0xd9e4('0x44')](_0xd9e4('0x45'),_0xd9e4('0x46')+_0x291354);_0x321427['set'](_0xd9e4('0x47'),_0xd9e4('0x48'));_0x321427[_0xd9e4('0x49')](_0x14ac5c);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b896459..cc04949 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 _0x5722=['rimraf','../../config/environment','exports','define','License','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x545abf,_0xe28ec8){var _0x115ca4=function(_0x561f23){while(--_0x561f23){_0x545abf['push'](_0x545abf['shift']());}};_0x115ca4(++_0xe28ec8);}(_0x5722,0xf7));var _0x2572=function(_0x1d723d,_0x1a064c){_0x1d723d=_0x1d723d-0x0;var _0x30cec1=_0x5722[_0x1d723d];return _0x30cec1;};'use strict';var _=require(_0x2572('0x0'));var util=require(_0x2572('0x1'));var logger=require(_0x2572('0x2'))(_0x2572('0x3'));var moment=require('moment');var BPromise=require(_0x2572('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2572('0x5'));var rimraf=require(_0x2572('0x6'));var config=require(_0x2572('0x7'));var attributes=require('./license.attributes');module[_0x2572('0x8')]=function(_0x38d4c2,_0x383f81){return _0x38d4c2[_0x2572('0x9')](_0x2572('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e14=['path','../../config/environment','./license.attributes','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1929b3,_0x4ca74f){var _0x445020=function(_0x28ba31){while(--_0x28ba31){_0x1929b3['push'](_0x1929b3['shift']());}};_0x445020(++_0x4ca74f);}(_0x5e14,0xaf));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var logger=require(_0x45e1('0x2'))(_0x45e1('0x3'));var moment=require(_0x45e1('0x4'));var BPromise=require(_0x45e1('0x5'));var rp=require(_0x45e1('0x6'));var fs=require('fs');var path=require(_0x45e1('0x7'));var rimraf=require('rimraf');var config=require(_0x45e1('0x8'));var attributes=require(_0x45e1('0x9'));module[_0x45e1('0xa')]=function(_0x4d2ec4,_0x366ee7){return _0x4d2ec4['define'](_0x45e1('0xb'),attributes,{'tableName':_0x45e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index d0b2928..99659ad 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 _0xfa00=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfa00,0x79));var _0x0fa0=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfa00[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x0fa0('0x0'));var util=require(_0x0fa0('0x1'));var moment=require(_0x0fa0('0x2'));var BPromise=require(_0x0fa0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fa0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fa0('0x5'))(_0x0fa0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fa0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301e5e,_0x32667e,_0x56b963){return new BPromise(function(_0x3430c2,_0x44c0ee){return client[_0x0fa0('0x8')](_0x301e5e,_0x56b963)[_0x0fa0('0x9')](function(_0x5fae08){logger[_0x0fa0('0xa')](_0x0fa0('0xb'),_0x32667e,_0x0fa0('0xc'));logger[_0x0fa0('0xd')](_0x0fa0('0xe'),_0x32667e,_0x0fa0('0xc'),JSON[_0x0fa0('0xf')](_0x5fae08));if(_0x5fae08['error']){if(_0x5fae08[_0x0fa0('0x10')]['code']===0x1f4){logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x5fae08[_0x0fa0('0x10')][_0x0fa0('0x11')]);return _0x44c0ee(_0x5fae08['error'][_0x0fa0('0x11')]);}logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x5fae08[_0x0fa0('0x10')][_0x0fa0('0x11')]);return _0x3430c2(_0x5fae08[_0x0fa0('0x10')]['message']);}else{logger[_0x0fa0('0xa')](_0x0fa0('0xb'),_0x32667e,_0x0fa0('0xc'));_0x3430c2(_0x5fae08[_0x0fa0('0x12')][_0x0fa0('0x11')]);}})['catch'](function(_0x433c7c){logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x433c7c);_0x44c0ee(_0x433c7c);});});} \ No newline at end of file +var _0xb8b7=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash'];(function(_0x47e3f6,_0xb76105){var _0x41259d=function(_0x59e90a){while(--_0x59e90a){_0x47e3f6['push'](_0x47e3f6['shift']());}};_0x41259d(++_0xb76105);}(_0xb8b7,0x1cd));var _0x7b8b=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb8b7[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x7b8b('0x0'));var util=require(_0x7b8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b8b('0x2'));var fs=require('fs');var Redis=require(_0x7b8b('0x3'));var db=require(_0x7b8b('0x4'))['db'];var utils=require(_0x7b8b('0x5'));var logger=require(_0x7b8b('0x6'))('rpc');var config=require(_0x7b8b('0x7'));var jayson=require(_0x7b8b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x895db8,_0x59e1d3,_0x353326){return new BPromise(function(_0x4e1ac3,_0xec09f){return client[_0x7b8b('0x9')](_0x895db8,_0x353326)[_0x7b8b('0xa')](function(_0x1b73df){logger[_0x7b8b('0xb')](_0x7b8b('0xc'),_0x59e1d3,'request\x20sent');logger[_0x7b8b('0xd')](_0x7b8b('0xe'),_0x59e1d3,'request\x20sent',JSON[_0x7b8b('0xf')](_0x1b73df));if(_0x1b73df['error']){if(_0x1b73df[_0x7b8b('0x10')]['code']===0x1f4){logger[_0x7b8b('0x10')]('License,\x20%s,\x20%s',_0x59e1d3,_0x1b73df[_0x7b8b('0x10')][_0x7b8b('0x11')]);return _0xec09f(_0x1b73df[_0x7b8b('0x10')]['message']);}logger[_0x7b8b('0x10')]('License,\x20%s,\x20%s',_0x59e1d3,_0x1b73df[_0x7b8b('0x10')][_0x7b8b('0x11')]);return _0x4e1ac3(_0x1b73df[_0x7b8b('0x10')][_0x7b8b('0x11')]);}else{logger[_0x7b8b('0xb')](_0x7b8b('0xc'),_0x59e1d3,_0x7b8b('0x12'));_0x4e1ac3(_0x1b73df[_0x7b8b('0x13')][_0x7b8b('0x11')]);}})[_0x7b8b('0x14')](function(_0x393c72){logger[_0x7b8b('0x10')](_0x7b8b('0xc'),_0x59e1d3,_0x393c72);_0xec09f(_0x393c72);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 46d7967..fec4aa8 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 _0xf8bb=['addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','/:id/applications','addApplications','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xf8bb,0x6d));var _0xbf8b=function(_0x220ec8,_0x56bf7c){_0x220ec8=_0x220ec8-0x0;var _0x27b087=_0xf8bb[_0x220ec8];return _0x27b087;};'use strict';var multer=require(_0xbf8b('0x0'));var util=require(_0xbf8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf8b('0x2'));var router=express[_0xbf8b('0x3')]();var fs_extra=require(_0xbf8b('0x4'));var auth=require(_0xbf8b('0x5'));var interaction=require(_0xbf8b('0x6'));var config=require(_0xbf8b('0x7'));var controller=require(_0xbf8b('0x8'));router[_0xbf8b('0x9')]('/',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0xb')]);router[_0xbf8b('0x9')](_0xbf8b('0xc'),auth['isAuthenticated'](),controller[_0xbf8b('0xd')]);router[_0xbf8b('0x9')](_0xbf8b('0xe'),auth[_0xbf8b('0xa')](),controller['show']);router[_0xbf8b('0x9')](_0xbf8b('0xf'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x10')]);router[_0xbf8b('0x9')]('/:id/canned_answers',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x11')]);router[_0xbf8b('0x9')](_0xbf8b('0x12'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x13')]);router[_0xbf8b('0x9')](_0xbf8b('0x14'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x15')]);router[_0xbf8b('0x9')](_0xbf8b('0x16'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x17')]);router[_0xbf8b('0x9')]('/:id/applications',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x18')]);router['get'](_0xbf8b('0x19'),auth['isAuthenticated'](),controller[_0xbf8b('0x1a')]);router[_0xbf8b('0x9')]('/:id/verify',auth[_0xbf8b('0xa')](),controller['verifySmtp']);router[_0xbf8b('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf8b('0x1b')]);router[_0xbf8b('0x1c')](_0xbf8b('0xf'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x1d')]);router[_0xbf8b('0x1c')](_0xbf8b('0x1e'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x1f')]);router[_0xbf8b('0x1c')]('/',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x20')]);router[_0xbf8b('0x1c')](_0xbf8b('0x12'),auth[_0xbf8b('0xa')](),controller['addImap']);router['post'](_0xbf8b('0x14'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x21')]);router[_0xbf8b('0x1c')](_0xbf8b('0x16'),auth[_0xbf8b('0xa')](),controller['addInteraction']);router[_0xbf8b('0x1c')](_0xbf8b('0x22'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x23')]);router[_0xbf8b('0x1c')]('/:id/send',auth['isAuthenticated'](),controller[_0xbf8b('0x24')]);router['post'](_0xbf8b('0x25'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbf8b('0x26')](_0xbf8b('0xe'),auth['isAuthenticated'](),controller[_0xbf8b('0x27')]);router[_0xbf8b('0x28')]('/:id/dispositions',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x29')]);router[_0xbf8b('0x28')](_0xbf8b('0x1e'),auth['isAuthenticated'](),controller[_0xbf8b('0x2a')]);router['delete'](_0xbf8b('0x12'),auth['isAuthenticated'](),controller[_0xbf8b('0x2b')]);router[_0xbf8b('0x28')]('/:id/out_servers',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x2c')]);router['delete'](_0xbf8b('0xe'),auth['isAuthenticated'](),controller[_0xbf8b('0x2d')]);router[_0xbf8b('0x28')](_0xbf8b('0x25'),auth[_0xbf8b('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9f73=['/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x4fad60,_0x289704){var _0x2e84c=function(_0x3d025d){while(--_0x3d025d){_0x4fad60['push'](_0x4fad60['shift']());}};_0x2e84c(++_0x289704);}(_0x9f73,0x7e));var _0x39f7=function(_0x3c382d,_0x2c7964){_0x3c382d=_0x3c382d-0x0;var _0x3c852f=_0x9f73[_0x3c382d];return _0x3c852f;};'use strict';var multer=require(_0x39f7('0x0'));var util=require(_0x39f7('0x1'));var path=require(_0x39f7('0x2'));var timeout=require(_0x39f7('0x3'));var express=require(_0x39f7('0x4'));var router=express[_0x39f7('0x5')]();var fs_extra=require(_0x39f7('0x6'));var auth=require(_0x39f7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39f7('0x8'));router[_0x39f7('0x9')]('/',auth[_0x39f7('0xa')](),controller['index']);router[_0x39f7('0x9')](_0x39f7('0xb'),auth[_0x39f7('0xa')](),controller[_0x39f7('0xc')]);router[_0x39f7('0x9')](_0x39f7('0xd'),auth['isAuthenticated'](),controller[_0x39f7('0xe')]);router['get'](_0x39f7('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x39f7('0x9')](_0x39f7('0x10'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x11')]);router[_0x39f7('0x9')](_0x39f7('0x12'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x13')]);router[_0x39f7('0x9')](_0x39f7('0x14'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x15')]);router[_0x39f7('0x9')](_0x39f7('0x16'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x17')]);router['get'](_0x39f7('0x18'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x19')]);router[_0x39f7('0x9')](_0x39f7('0x1a'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x1b')]);router[_0x39f7('0x9')](_0x39f7('0x1c'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x1d')]);router[_0x39f7('0x9')](_0x39f7('0x1e'),auth[_0x39f7('0xa')](),controller['getAgents']);router[_0x39f7('0x1f')](_0x39f7('0xf'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x20')]);router[_0x39f7('0x1f')](_0x39f7('0x10'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x21')]);router[_0x39f7('0x1f')]('/',auth[_0x39f7('0xa')](),controller[_0x39f7('0x22')]);router[_0x39f7('0x1f')](_0x39f7('0x12'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x23')]);router[_0x39f7('0x1f')](_0x39f7('0x14'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x24')]);router['post'](_0x39f7('0x16'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x25')]);router[_0x39f7('0x1f')](_0x39f7('0x18'),auth['isAuthenticated'](),controller[_0x39f7('0x26')]);router[_0x39f7('0x1f')](_0x39f7('0x27'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x28')]);router[_0x39f7('0x1f')](_0x39f7('0x1e'),auth['isAuthenticated'](),controller[_0x39f7('0x29')]);router[_0x39f7('0x2a')](_0x39f7('0xd'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x2b')]);router[_0x39f7('0x2c')](_0x39f7('0xf'),auth[_0x39f7('0xa')](),controller[_0x39f7('0x2d')]);router[_0x39f7('0x2c')]('/:id/canned_answers',auth[_0x39f7('0xa')](),controller[_0x39f7('0x2e')]);router['delete'](_0x39f7('0x12'),auth['isAuthenticated'](),controller[_0x39f7('0x2f')]);router['delete'](_0x39f7('0x14'),auth['isAuthenticated'](),controller[_0x39f7('0x30')]);router[_0x39f7('0x2c')](_0x39f7('0xd'),auth[_0x39f7('0xa')](),controller['destroy']);router['delete']('/:id/users',auth[_0x39f7('0xa')](),controller['removeAgents']);module[_0x39f7('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6fa95e0..6025321 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 _0xce42=['ENUM','gmail','hotmail','outlook365','getDataValue','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0xce42,0xf6));var _0x2ce4=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xce42[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require('sequelize');module[_0x2ce4('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2ce4('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x2ce4('0x3')]},'markAsUnread':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![],'defaultValue':_0x2ce4('0x4')},'fontSize':{'type':Sequelize[_0x2ce4('0x5')](0x2)[_0x2ce4('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ce4('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x2ce4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![],'comment':_0x2ce4('0x8'),'set':function(_0x15ec87){if(!_0x15ec87)this[_0x2ce4('0x9')]('mandatoryDispositionPauseId',null);this[_0x2ce4('0x9')]('mandatoryDisposition',_0x15ec87);}},'provider':{'type':Sequelize[_0x2ce4('0xa')](_0x2ce4('0xb'),_0x2ce4('0xc'),'yahoo',_0x2ce4('0xd')),'defaultValue':null,'get':function(){if(!this[_0x2ce4('0xe')](_0x2ce4('0xf')))return'custom';return this['getDataValue']('provider');},'set':function(_0x594608){if(_0x594608==='custom')_0x594608=null;return this['setDataValue'](_0x2ce4('0xf'),_0x594608);}}}; \ No newline at end of file +var _0x2a60=['custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider'];(function(_0x4349ec,_0x123fca){var _0x4b343b=function(_0x4c0727){while(--_0x4c0727){_0x4349ec['push'](_0x4349ec['shift']());}};_0x4b343b(++_0x123fca);}(_0x2a60,0xb5));var _0x02a6=function(_0x258238,_0x219494){_0x258238=_0x258238-0x0;var _0x126c77=_0x2a60[_0x258238];return _0x126c77;};'use strict';var Sequelize=require(_0x02a6('0x0'));module[_0x02a6('0x1')]={'description':{'type':Sequelize[_0x02a6('0x2')]},'name':{'type':Sequelize[_0x02a6('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x02a6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x02a6('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x02a6('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x02a6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x02a6('0x4')},'fontSize':{'type':Sequelize[_0x02a6('0x5')](0x2)[_0x02a6('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x02a6('0x7')],'defaultValue':function(){return _0x02a6('0x8');}},'notificationSound':{'type':Sequelize[_0x02a6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x02a6('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x02a6('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x02a6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x02a6('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x02a6('0x9'),'set':function(_0x4ff0b0){if(!_0x4ff0b0)this['setDataValue'](_0x02a6('0xa'),null);this[_0x02a6('0xb')](_0x02a6('0xc'),_0x4ff0b0);}},'provider':{'type':Sequelize['ENUM'](_0x02a6('0xd'),_0x02a6('0xe'),_0x02a6('0xf'),_0x02a6('0x10')),'defaultValue':null,'get':function(){if(!this[_0x02a6('0x11')](_0x02a6('0x12')))return _0x02a6('0x13');return this['getDataValue'](_0x02a6('0x12'));},'set':function(_0x564354){if(_0x564354===_0x02a6('0x13'))_0x564354=null;return this[_0x02a6('0xb')](_0x02a6('0x12'),_0x564354);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index dcbf729..38f45ec 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 _0x2632=['Smtp','mandatoryDispositionPause','map','fieldName','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','MailAccount','include','findAll','rows','show','params','Pause','keys','fields','find','catch','body','modernAuthentication','MailServerIn','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rawAttributes','order','removeAnswers','ids','provider','custom','email','isNil','active','user','username','password','pass','CloudProviderId','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','Contact','User','Owner','fullname','internal','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','send','getApplications','$gte','split','format','inlineCss','true','CmList','List','CmContact','Contacts','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','service','secure','auth','SendMail','sendMail','defaults','ListId','messageId','subject','out','Interaction','MailMessage','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','util','path','juice','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','stack','name','index','Imap','MailServerOut'];(function(_0x5c557c,_0x3d601c){var _0x357a76=function(_0x23e99e){while(--_0x23e99e){_0x5c557c['push'](_0x5c557c['shift']());}};_0x357a76(++_0x3d601c);}(_0x2632,0x1ec));var _0x2263=function(_0x1a6dfd,_0x273173){_0x1a6dfd=_0x1a6dfd-0x0;var _0x4f0315=_0x2632[_0x1a6dfd];return _0x4f0315;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2263('0x0'));var path=require(_0x2263('0x1'));var _=require('lodash');var juice=require(_0x2263('0x2'));var Redis=require(_0x2263('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x2263('0x4'));var db=require(_0x2263('0x5'))['db'];config[_0x2263('0x6')]=_['defaults'](config[_0x2263('0x6')],{'host':_0x2263('0x7'),'port':0x18eb});var socket=require(_0x2263('0x8'))(new Redis(config[_0x2263('0x6')]));require('./mailAccount.socket')[_0x2263('0x9')](socket);var jayson=require(_0x2263('0xa'));var client=jayson[_0x2263('0xb')][_0x2263('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x17ee0b,_0x2d63fa,_0x9afa61,_0x5a7408){return new BPromise(function(_0x3ef7f1,_0x5ec45){var _0x17e33e=_0x5a7408||client;return _0x17e33e[_0x2263('0xd')](_0x17ee0b,_0x9afa61)[_0x2263('0xe')](function(_0x2c3424){logger[_0x2263('0xf')](_0x2263('0x10'),_0x2d63fa,_0x2263('0x11'));logger['debug'](_0x2263('0x12'),_0x2d63fa,_0x2263('0x11'),JSON[_0x2263('0x13')](_0x2c3424));if(_0x2c3424[_0x2263('0x14')]){if(_0x2c3424[_0x2263('0x14')]['code']===0x1f4){logger[_0x2263('0x14')](_0x2263('0x10'),_0x2d63fa,_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);return _0x5ec45(_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);}logger[_0x2263('0x14')]('MailAccount,\x20%s,\x20%s',_0x2d63fa,_0x2c3424[_0x2263('0x14')]['message']);return _0x3ef7f1(_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);}else{logger[_0x2263('0xf')](_0x2263('0x10'),_0x2d63fa,'request\x20sent');_0x3ef7f1(_0x2c3424['result'][_0x2263('0x15')]);}})['catch'](function(_0x38c83f){logger[_0x2263('0x14')](_0x2263('0x10'),_0x2d63fa,_0x38c83f);_0x5ec45(_0x38c83f);});});}function respondWithStatusCode(_0x1bb8bf,_0x11bc14){_0x11bc14=_0x11bc14||0xcc;return function(_0x532e80){if(_0x532e80){return _0x1bb8bf[_0x2263('0x16')](_0x11bc14);}return _0x1bb8bf['status'](_0x11bc14)[_0x2263('0x17')]();};}function respondWithResult(_0x481bc4,_0x3ca33e){_0x3ca33e=_0x3ca33e||0xc8;return function(_0x14f53b){if(_0x14f53b){return _0x481bc4[_0x2263('0x18')](_0x3ca33e)['json'](_0x14f53b);}};}function respondWithFilteredResult(_0x116d95,_0x26f7a2){return function(_0x198950){if(_0x198950){var _0xef9c7f=typeof _0x26f7a2[_0x2263('0x19')]===_0x2263('0x1a')&&typeof _0x26f7a2[_0x2263('0x1b')]===_0x2263('0x1a');var _0xc90c81=_0x198950[_0x2263('0x1c')];var _0x2e5481=_0xef9c7f?0x0:_0x26f7a2[_0x2263('0x19')];var _0xe23849=_0xef9c7f?_0x198950[_0x2263('0x1c')]:_0x26f7a2[_0x2263('0x19')]+_0x26f7a2[_0x2263('0x1b')];var _0x40176d;if(_0xe23849>=_0xc90c81){_0xe23849=_0xc90c81;_0x40176d=0xc8;}else{_0x40176d=0xce;}_0x116d95[_0x2263('0x18')](_0x40176d);return _0x116d95[_0x2263('0x1d')](_0x2263('0x1e'),_0x2e5481+'-'+_0xe23849+'/'+_0xc90c81)[_0x2263('0x1f')](_0x198950);}return null;};}function saveUpdates(_0x3ff293){return function(_0x227f41){if(_0x227f41){return _0x227f41[_0x2263('0x20')](_0x3ff293)[_0x2263('0xe')](function(_0x97c9c6){return _0x97c9c6;});}return null;};}function removeEntity(_0x281887){return function(_0x65c45f){if(_0x65c45f){return _0x65c45f['destroy']()[_0x2263('0xe')](function(){var _0x107d17=_0x65c45f[_0x2263('0x21')]({'plain':!![]});var _0x348381=_0x2263('0x22');return db[_0x2263('0x23')][_0x2263('0x24')]({'where':{'type':_0x348381,'resourceId':_0x107d17['id']}})[_0x2263('0xe')](function(){return _0x65c45f;});})[_0x2263('0xe')](function(){_0x281887[_0x2263('0x18')](0xcc)[_0x2263('0x17')]();});}};}function handleEntityNotFound(_0x55f9a7){return function(_0x18be3e){if(!_0x18be3e){_0x55f9a7['sendStatus'](0x194);}return _0x18be3e;};}function handleError(_0x62a53a,_0x401a5e){_0x401a5e=_0x401a5e||0x1f4;return function(_0x5057ec){logger[_0x2263('0x14')](_0x5057ec[_0x2263('0x25')]);if(_0x5057ec[_0x2263('0x26')]){delete _0x5057ec[_0x2263('0x26')];}_0x62a53a[_0x2263('0x18')](_0x401a5e)['send'](_0x5057ec);};}exports[_0x2263('0x27')]=function(_0xd1ef68,_0x2f93a6){var _0x45e586={'include':[{'model':db['MailServerIn'],'as':_0x2263('0x28')},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db['Pause'],'as':_0x2263('0x2b')}]},_0x41b4d2={},_0x2f845f={'count':0x0,'rows':[]};var _0x9a73e2=_[_0x2263('0x2c')](db['MailAccount']['rawAttributes'],function(_0x5d8fc8){return{'name':_0x5d8fc8[_0x2263('0x2d')],'type':_0x5d8fc8['type'][_0x2263('0x2e')]};});_0x41b4d2['model']=_[_0x2263('0x2c')](_0x9a73e2,'name');_0x41b4d2[_0x2263('0x2f')]=_['keys'](_0xd1ef68[_0x2263('0x2f')]);_0x41b4d2[_0x2263('0x30')]=_['intersection'](_0x41b4d2[_0x2263('0x31')],_0x41b4d2[_0x2263('0x2f')]);_0x45e586[_0x2263('0x32')]=_[_0x2263('0x33')](_0x41b4d2[_0x2263('0x31')],qs['fields'](_0xd1ef68['query']['fields']));_0x45e586['attributes']=_0x45e586[_0x2263('0x32')][_0x2263('0x34')]?_0x45e586['attributes']:_0x41b4d2[_0x2263('0x31')];if(!_0xd1ef68[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x45e586[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0xd1ef68[_0x2263('0x2f')][_0x2263('0x1b')]);_0x45e586[_0x2263('0x19')]=qs['offset'](_0xd1ef68['query'][_0x2263('0x19')]);}_0x45e586['order']=qs[_0x2263('0x37')](_0xd1ef68[_0x2263('0x2f')]['sort']);_0x45e586['where']=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0xd1ef68[_0x2263('0x2f')],_0x41b4d2[_0x2263('0x30')]),_0x9a73e2);if(_0xd1ef68[_0x2263('0x2f')][_0x2263('0x39')]){_0x45e586[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x45e586[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x9a73e2,function(_0x2ed48b){if(_0x2ed48b[_0x2263('0x3c')]!=='VIRTUAL'){var _0x125bc2={};_0x125bc2[_0x2ed48b['name']]={'$like':'%'+_0xd1ef68['query'][_0x2263('0x39')]+'%'};return _0x125bc2;}})});}_0x45e586=_[_0x2263('0x3b')]({},_0x45e586,_0xd1ef68[_0x2263('0x3d')]);var _0x3b5f97={'where':_0x45e586[_0x2263('0x3a')]};return db[_0x2263('0x3e')][_0x2263('0x1c')](_0x3b5f97)[_0x2263('0xe')](function(_0x41c8a0){_0x2f845f[_0x2263('0x1c')]=_0x41c8a0;if(_0xd1ef68[_0x2263('0x2f')]['includeAll']){_0x45e586[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x3e')][_0x2263('0x40')](_0x45e586);})[_0x2263('0xe')](function(_0x274168){_0x2f845f[_0x2263('0x41')]=_0x274168;return _0x2f845f;})['then'](respondWithFilteredResult(_0x2f93a6,_0x45e586))['catch'](handleError(_0x2f93a6,null));};exports[_0x2263('0x42')]=function(_0x5735af,_0x43a7b3){var _0x2c8b21={'raw':![],'where':{'id':_0x5735af[_0x2263('0x43')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2263('0x28')},{'model':db['MailServerOut'],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x44')],'as':_0x2263('0x2b')}]},_0x462ca1={};_0x462ca1['model']=_[_0x2263('0x45')](db[_0x2263('0x3e')]['rawAttributes']);_0x462ca1[_0x2263('0x2f')]=_['keys'](_0x5735af[_0x2263('0x2f')]);_0x462ca1[_0x2263('0x30')]=_[_0x2263('0x33')](_0x462ca1[_0x2263('0x31')],_0x462ca1['query']);_0x2c8b21[_0x2263('0x32')]=_[_0x2263('0x33')](_0x462ca1['model'],qs['fields'](_0x5735af[_0x2263('0x2f')][_0x2263('0x46')]));_0x2c8b21[_0x2263('0x32')]=_0x2c8b21['attributes'][_0x2263('0x34')]?_0x2c8b21[_0x2263('0x32')]:_0x462ca1['model'];if(_0x5735af['query']['includeAll']){_0x2c8b21[_0x2263('0x3f')]=[{'all':!![]}];}_0x2c8b21=_['merge']({},_0x2c8b21,_0x5735af['options']);return db[_0x2263('0x3e')][_0x2263('0x47')](_0x2c8b21)[_0x2263('0xe')](handleEntityNotFound(_0x43a7b3,null))[_0x2263('0xe')](respondWithResult(_0x43a7b3,null))[_0x2263('0x48')](handleError(_0x43a7b3,null));};exports[_0x2263('0x20')]=function(_0x309245,_0x5e2861){if(_0x309245[_0x2263('0x49')]['id']){delete _0x309245[_0x2263('0x49')]['id'];}if(_0x309245[_0x2263('0x49')][_0x2263('0x28')]){if(!_0x309245[_0x2263('0x49')][_0x2263('0x28')][_0x2263('0x4a')]){_0x309245[_0x2263('0x49')]['Imap']['CloudProviderId']=null;}}if(_0x309245['body'][_0x2263('0x2a')]){if(!_0x309245[_0x2263('0x49')][_0x2263('0x2a')][_0x2263('0x4a')]){_0x309245[_0x2263('0x49')]['Smtp']['CloudProviderId']=null;}}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x309245['params']['id']},'include':[{'model':db[_0x2263('0x4b')],'as':'Imap'},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x44')],'as':_0x2263('0x2b')}]})[_0x2263('0xe')](handleEntityNotFound(_0x5e2861,null))['then'](saveUpdates(_0x309245[_0x2263('0x49')],null))[_0x2263('0xe')](function(_0x3537da){if(_0x3537da&&_0x309245['body'][_0x2263('0x28')]){return db[_0x2263('0x4b')][_0x2263('0x20')](_0x309245[_0x2263('0x49')]['Imap'],{'where':{'MailAccountId':_0x3537da['id']}})[_0x2263('0xe')](function(){return _0x3537da;});}return _0x3537da;})[_0x2263('0xe')](function(_0x2b466d){if(_0x2b466d&&_0x309245[_0x2263('0x49')][_0x2263('0x2a')]){return db['MailServerOut'][_0x2263('0x20')](_0x309245[_0x2263('0x49')]['Smtp'],{'where':{'MailAccountId':_0x2b466d['id']}})[_0x2263('0xe')](function(){return _0x2b466d;});}return _0x2b466d;})[_0x2263('0xe')](respondWithResult(_0x5e2861,null))[_0x2263('0x48')](handleError(_0x5e2861,null));};exports[_0x2263('0x4c')]=function(_0x509f20,_0x470922){return db[_0x2263('0x3e')]['describe']()['then'](respondWithResult(_0x470922,null))[_0x2263('0x48')](handleError(_0x470922,null));};exports[_0x2263('0x4d')]=function(_0x1c6fe0,_0x42b119){if(_0x1c6fe0['body']['id']){delete _0x1c6fe0['body']['id'];}return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1c6fe0[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x42b119,null))[_0x2263('0xe')](function(_0x326984){if(_0x326984){_0x1c6fe0[_0x2263('0x49')][_0x2263('0x4e')]=_0x326984['id'];return db[_0x2263('0x4f')][_0x2263('0x50')](_0x1c6fe0[_0x2263('0x49')]);}})[_0x2263('0xe')](respondWithResult(_0x42b119,null))['catch'](handleError(_0x42b119,null));};exports[_0x2263('0x51')]=function(_0x2a9ab5,_0x5bb700){var _0x3c43a5={'raw':![],'where':{}};var _0x3eb555={};var _0x49ef0d={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x2a9ab5[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x5bb700,null))[_0x2263('0xe')](function(_0x4eda72){if(_0x4eda72){_0x3eb555['model']=_[_0x2263('0x45')](db[_0x2263('0x4f')]['rawAttributes']);_0x3eb555['query']=_[_0x2263('0x45')](_0x2a9ab5[_0x2263('0x2f')]);_0x3eb555[_0x2263('0x30')]=_[_0x2263('0x33')](_0x3eb555[_0x2263('0x31')],_0x3eb555[_0x2263('0x2f')]);_0x3c43a5[_0x2263('0x32')]=_[_0x2263('0x33')](_0x3eb555['model'],qs[_0x2263('0x46')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x46')]));_0x3c43a5[_0x2263('0x32')]=_0x3c43a5[_0x2263('0x32')]['length']?_0x3c43a5[_0x2263('0x32')]:_0x3eb555[_0x2263('0x31')];if(!_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x3c43a5[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x2a9ab5['query'][_0x2263('0x1b')]);_0x3c43a5['offset']=qs[_0x2263('0x19')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x19')]);}_0x3c43a5['order']=qs[_0x2263('0x37')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x37')]);_0x3c43a5[_0x2263('0x3a')]=qs['filters'](_[_0x2263('0x38')](_0x2a9ab5[_0x2263('0x2f')],_0x3eb555[_0x2263('0x30')]));_0x3c43a5['where'][_0x2263('0x4e')]=_0x4eda72['id'];if(_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x39')]){_0x3c43a5['where']=_['merge'](_0x3c43a5[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x3c43a5[_0x2263('0x32')],function(_0x4f13e3){var _0x1d61e0={};_0x1d61e0[_0x4f13e3]={'$like':'%'+_0x2a9ab5['query'][_0x2263('0x39')]+'%'};return _0x1d61e0;})});}_0x3c43a5=_[_0x2263('0x3b')]({},_0x3c43a5,_0x2a9ab5['options']);return db[_0x2263('0x4f')][_0x2263('0x1c')]({'where':_0x3c43a5[_0x2263('0x3a')]})['then'](function(_0x2e0f1c){_0x49ef0d[_0x2263('0x1c')]=_0x2e0f1c;if(_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x53')]){_0x3c43a5[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x4f')][_0x2263('0x40')](_0x3c43a5);})[_0x2263('0xe')](function(_0x4c82fb){_0x49ef0d[_0x2263('0x41')]=_0x4c82fb;return _0x49ef0d;});}})[_0x2263('0xe')](respondWithFilteredResult(_0x5bb700,_0x3c43a5))[_0x2263('0x48')](handleError(_0x5bb700,null));};exports[_0x2263('0x54')]=function(_0x42d79a,_0x2559d9){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x42d79a['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x2559d9,null))[_0x2263('0xe')](function(_0x44b872){if(_0x44b872){return _0x44b872[_0x2263('0x54')](_0x42d79a[_0x2263('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x2559d9,null))[_0x2263('0x48')](handleError(_0x2559d9,null));};exports[_0x2263('0x55')]=function(_0x52b77a,_0x355287){if(_0x52b77a[_0x2263('0x49')]['id']){delete _0x52b77a[_0x2263('0x49')]['id'];}return db['MailAccount'][_0x2263('0x47')]({'where':{'id':_0x52b77a['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x355287,null))[_0x2263('0xe')](function(_0x414490){if(_0x414490){_0x52b77a[_0x2263('0x49')][_0x2263('0x4e')]=_0x414490['id'];return db[_0x2263('0x56')][_0x2263('0x50')](_0x52b77a['body']);}})[_0x2263('0xe')](respondWithResult(_0x355287,null))['catch'](handleError(_0x355287,null));};exports[_0x2263('0x57')]=function(_0x78e386,_0x1fa2fd){var _0x976a67={'raw':![],'where':{}};var _0x350b9f={};var _0x962c74={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x78e386['params']['id']}})['then'](handleEntityNotFound(_0x1fa2fd,null))[_0x2263('0xe')](function(_0x380fab){if(_0x380fab){_0x350b9f[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x56')][_0x2263('0x58')]);_0x350b9f[_0x2263('0x2f')]=_[_0x2263('0x45')](_0x78e386[_0x2263('0x2f')]);_0x350b9f['filters']=_[_0x2263('0x33')](_0x350b9f[_0x2263('0x31')],_0x350b9f[_0x2263('0x2f')]);_0x976a67[_0x2263('0x32')]=_[_0x2263('0x33')](_0x350b9f[_0x2263('0x31')],qs[_0x2263('0x46')](_0x78e386[_0x2263('0x2f')]['fields']));_0x976a67['attributes']=_0x976a67[_0x2263('0x32')]['length']?_0x976a67['attributes']:_0x350b9f[_0x2263('0x31')];if(!_0x78e386['query']['hasOwnProperty']('nolimit')){_0x976a67[_0x2263('0x1b')]=qs['limit'](_0x78e386[_0x2263('0x2f')][_0x2263('0x1b')]);_0x976a67[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x78e386[_0x2263('0x2f')][_0x2263('0x19')]);}_0x976a67[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x78e386['query'][_0x2263('0x37')]);_0x976a67['where']=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0x78e386['query'],_0x350b9f['filters']));_0x976a67['where'][_0x2263('0x4e')]=_0x380fab['id'];if(_0x78e386[_0x2263('0x2f')]['filter']){_0x976a67['where']=_['merge'](_0x976a67['where'],{'$or':_[_0x2263('0x2c')](_0x976a67[_0x2263('0x32')],function(_0x163c96){var _0x48ce0a={};_0x48ce0a[_0x163c96]={'$like':'%'+_0x78e386['query'][_0x2263('0x39')]+'%'};return _0x48ce0a;})});}_0x976a67=_[_0x2263('0x3b')]({},_0x976a67,_0x78e386['options']);return db[_0x2263('0x56')][_0x2263('0x1c')]({'where':_0x976a67[_0x2263('0x3a')]})['then'](function(_0x1feb57){_0x962c74['count']=_0x1feb57;if(_0x78e386[_0x2263('0x2f')][_0x2263('0x53')]){_0x976a67[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x56')][_0x2263('0x40')](_0x976a67);})[_0x2263('0xe')](function(_0x1ee504){_0x962c74[_0x2263('0x41')]=_0x1ee504;return _0x962c74;});}})[_0x2263('0xe')](respondWithFilteredResult(_0x1fa2fd,_0x976a67))[_0x2263('0x48')](handleError(_0x1fa2fd,null));};exports[_0x2263('0x5a')]=function(_0xd9f0,_0x5d146d){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0xd9f0[_0x2263('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d146d,null))[_0x2263('0xe')](function(_0x1cefc3){if(_0x1cefc3){return _0x1cefc3[_0x2263('0x5a')](_0xd9f0[_0x2263('0x2f')][_0x2263('0x5b')]);}})[_0x2263('0xe')](respondWithStatusCode(_0x5d146d,null))[_0x2263('0x48')](handleError(_0x5d146d,null));};exports[_0x2263('0x50')]=function(_0x146768,_0x11d6a6){var _0x45b22c={'name':_0x146768[_0x2263('0x49')][_0x2263('0x26')],'key':_0x146768[_0x2263('0x49')]['key'],'provider':_0x146768['body'][_0x2263('0x5c')]===_0x2263('0x5d')?null:_0x146768[_0x2263('0x49')][_0x2263('0x5c')],'email':_0x146768[_0x2263('0x49')][_0x2263('0x5e')],'ListId':_0x146768[_0x2263('0x49')]['ListId'],'active':!_[_0x2263('0x5f')](_0x146768[_0x2263('0x49')][_0x2263('0x60')])?_0x146768[_0x2263('0x49')]['active']:!![],'description':_0x146768[_0x2263('0x49')]['description']||null,'Imap':{},'Smtp':{}};if(_0x45b22c['provider']){_0x45b22c[_0x2263('0x28')][_0x2263('0x61')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x61')]=_0x146768[_0x2263('0x49')][_0x2263('0x62')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=_0x146768[_0x2263('0x49')][_0x2263('0x63')];if(_0x146768[_0x2263('0x49')][_0x2263('0x4a')]){_0x45b22c[_0x2263('0x28')]['modernAuthentication']=_0x45b22c[_0x2263('0x2a')]['modernAuthentication']=!![];_0x45b22c[_0x2263('0x28')][_0x2263('0x65')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x65')]=_0x146768[_0x2263('0x49')][_0x2263('0x65')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=null;}else{_0x45b22c[_0x2263('0x28')][_0x2263('0x65')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x65')]=null;}_0x45b22c[_0x2263('0x28')]['service']=_0x45b22c[_0x2263('0x2a')]['service']=null;_0x45b22c[_0x2263('0x28')][_0x2263('0x66')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x66')]=null;_0x45b22c[_0x2263('0x28')]['port']=_0x45b22c['Smtp'][_0x2263('0x67')]=null;}else{if(_0x146768[_0x2263('0x49')]['authentication']){_0x45b22c[_0x2263('0x28')][_0x2263('0x61')]=_0x45b22c['Smtp']['user']=_0x146768['body'][_0x2263('0x62')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x64')]=_0x146768[_0x2263('0x49')][_0x2263('0x63')];}else{_0x45b22c['Imap'][_0x2263('0x68')]=_0x45b22c[_0x2263('0x2a')]['authentication']=![];_0x45b22c['Imap']['user']=_0x45b22c[_0x2263('0x2a')]['user']=null;_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=null;}_0x45b22c[_0x2263('0x28')][_0x2263('0x66')]=_0x146768[_0x2263('0x49')]['Imap'][_0x2263('0x66')];_0x45b22c['Imap'][_0x2263('0x67')]=_0x146768[_0x2263('0x49')][_0x2263('0x28')][_0x2263('0x67')];_0x45b22c[_0x2263('0x2a')][_0x2263('0x66')]=_0x146768[_0x2263('0x49')][_0x2263('0x2a')][_0x2263('0x66')];_0x45b22c[_0x2263('0x2a')][_0x2263('0x67')]=_0x146768['body'][_0x2263('0x2a')][_0x2263('0x67')];}return db[_0x2263('0x3e')]['create'](_0x45b22c,{'include':[{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x4b')],'as':_0x2263('0x28')}]})['then'](function(_0x5ee9c6){var _0x3ef0b5=_0x146768[_0x2263('0x61')][_0x2263('0x21')]({'plain':!![]});if(!_0x3ef0b5)throw new Error(_0x2263('0x69'));if(_0x3ef0b5[_0x2263('0x6a')]===_0x2263('0x61')){var _0x1f7bff=_0x5ee9c6[_0x2263('0x21')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x3ef0b5[_0x2263('0x6b')]},'raw':!![]})[_0x2263('0xe')](function(_0x27acf5){if(_0x27acf5&&_0x27acf5[_0x2263('0x6c')]===0x0){return db[_0x2263('0x23')]['create']({'name':_0x1f7bff[_0x2263('0x26')],'resourceId':_0x1f7bff['id'],'type':_0x27acf5[_0x2263('0x26')],'sectionId':_0x27acf5['id']},{})['then'](function(){return _0x5ee9c6;});}else{return _0x5ee9c6;}})[_0x2263('0x48')](function(_0xa5b3c5){logger[_0x2263('0x14')](_0x2263('0x6d'),_0xa5b3c5);throw _0xa5b3c5;});}return _0x5ee9c6;})[_0x2263('0xe')](respondWithResult(_0x11d6a6,0xc9))['catch'](handleError(_0x11d6a6,null));};exports['getImap']=function(_0x547aea,_0x24547b){return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x547aea[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x24547b,null))['then'](function(_0x58716f){if(_0x58716f){return _0x58716f[_0x2263('0x6e')]();}return null;})['then'](respondWithResult(_0x24547b,null))[_0x2263('0x48')](handleError(_0x24547b,null));};exports[_0x2263('0x6f')]=function(_0x223314,_0x22111d){if(_0x223314[_0x2263('0x49')]['id']){delete _0x223314[_0x2263('0x49')]['id'];}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x223314[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x22111d,null))[_0x2263('0xe')](function(_0x2c577e){if(_0x2c577e){_0x223314[_0x2263('0x49')][_0x2263('0x4e')]=_0x2c577e['id'];return db[_0x2263('0x4b')]['create'](_0x223314['body']);}})[_0x2263('0xe')](respondWithResult(_0x22111d,null))['catch'](handleError(_0x22111d,null));};exports[_0x2263('0x70')]=function(_0x4a0709,_0x3f1323){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x4a0709['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x3f1323,null))['then'](function(_0x514394){if(_0x514394){return _0x514394[_0x2263('0x71')](null);}return null;})[_0x2263('0xe')](respondWithStatusCode(_0x3f1323,null))[_0x2263('0x48')](handleError(_0x3f1323,null));};exports[_0x2263('0x72')]=function(_0x2aa112,_0x470c17){return db[_0x2263('0x3e')]['findOne']({'where':{'id':_0x2aa112[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x470c17,null))[_0x2263('0xe')](function(_0x5f2ede){if(_0x5f2ede){return _0x5f2ede['getSmtp']();}return null;})[_0x2263('0xe')](respondWithResult(_0x470c17,null))[_0x2263('0x48')](handleError(_0x470c17,null));};exports['addSmtp']=function(_0x198577,_0x420239){if(_0x198577[_0x2263('0x49')]['id']){delete _0x198577['body']['id'];}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x198577[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x420239,null))[_0x2263('0xe')](function(_0x490efb){if(_0x490efb){_0x198577[_0x2263('0x49')][_0x2263('0x4e')]=_0x490efb['id'];return db[_0x2263('0x29')][_0x2263('0x50')](_0x198577[_0x2263('0x49')]);}})[_0x2263('0xe')](respondWithResult(_0x420239,null))[_0x2263('0x48')](handleError(_0x420239,null));};exports[_0x2263('0x73')]=function(_0x345255,_0x450e10){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x345255[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x450e10,null))[_0x2263('0xe')](function(_0x21723e){if(_0x21723e){return _0x21723e[_0x2263('0x74')](null);}return null;})[_0x2263('0xe')](respondWithStatusCode(_0x450e10,null))[_0x2263('0x48')](handleError(_0x450e10,null));};exports[_0x2263('0x75')]=function(_0xf30ddb,_0x3a8088){return db[_0x2263('0x76')]['find']({'where':{'id':_0xf30ddb['params']['id']}})['then'](handleEntityNotFound(_0x3a8088,null))[_0x2263('0xe')](function(_0x5ea9fd){if(_0x5ea9fd){return _0x5ea9fd[_0x2263('0x75')](_0xf30ddb[_0x2263('0x49')][_0x2263('0x5b')],_['omit'](_0xf30ddb['body'],[_0x2263('0x5b'),'id'])||{});}})[_0x2263('0xe')](respondWithResult(_0x3a8088,null))[_0x2263('0x48')](handleError(_0x3a8088,null));};exports['getInteractions']=function(_0x58019c,_0x1fb4b0){var _0x1b5c96={'raw':![],'where':{}};var _0x27e4e0={};var _0x4c994a={'count':0x0,'rows':[]};return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x58019c[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x1fb4b0,null))['then'](function(_0x8d457c){if(_0x8d457c){_0x27e4e0['model']=_['keys'](db[_0x2263('0x76')]['rawAttributes']);_0x27e4e0['query']=_[_0x2263('0x45')](_0x58019c['query']);_0x27e4e0[_0x2263('0x30')]=_[_0x2263('0x33')](_0x27e4e0['model'],_0x27e4e0[_0x2263('0x2f')]);_0x1b5c96[_0x2263('0x32')]=_[_0x2263('0x33')](_0x27e4e0[_0x2263('0x31')],qs[_0x2263('0x46')](_0x58019c[_0x2263('0x2f')]['fields']));_0x1b5c96[_0x2263('0x32')]=_0x1b5c96[_0x2263('0x32')][_0x2263('0x34')]?_0x1b5c96[_0x2263('0x32')]:_0x27e4e0[_0x2263('0x31')];if(!_0x58019c[_0x2263('0x2f')][_0x2263('0x35')]('nolimit')){_0x1b5c96[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x58019c[_0x2263('0x2f')][_0x2263('0x1b')]);_0x1b5c96[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x58019c[_0x2263('0x2f')][_0x2263('0x19')]);}_0x1b5c96[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x58019c['query'][_0x2263('0x37')]);_0x1b5c96[_0x2263('0x3a')]=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0x58019c[_0x2263('0x2f')],_0x27e4e0[_0x2263('0x30')]));_0x1b5c96[_0x2263('0x3a')][_0x2263('0x4e')]=_0x8d457c['id'];if(_0x58019c['query'][_0x2263('0x39')]){_0x1b5c96['where']=_[_0x2263('0x3b')](_0x1b5c96[_0x2263('0x3a')],{'$or':_['map'](_0x1b5c96[_0x2263('0x32')],function(_0x5c7902){var _0x53a4ae={};_0x53a4ae[_0x5c7902]={'$like':'%'+_0x58019c[_0x2263('0x2f')]['filter']+'%'};return _0x53a4ae;})});}_0x1b5c96=_[_0x2263('0x3b')]({},_0x1b5c96,_0x58019c['options']);return db[_0x2263('0x76')]['count']({'where':_0x1b5c96[_0x2263('0x3a')]})[_0x2263('0xe')](function(_0x17fe65){_0x4c994a[_0x2263('0x1c')]=_0x17fe65;if(_0x58019c[_0x2263('0x2f')][_0x2263('0x53')]){_0x1b5c96[_0x2263('0x3f')]=[{'model':db['CmContact'],'as':_0x2263('0x77'),'required':![]},{'model':db[_0x2263('0x78')],'as':_0x2263('0x79'),'attributes':['name',_0x2263('0x7a'),_0x2263('0x7b')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2263('0x26'),_0x2263('0x7c')],'where':_0x58019c[_0x2263('0x2f')]['tag']?{'id':_0x58019c[_0x2263('0x2f')][_0x2263('0x7d')]}:undefined,'required':_0x58019c['query'][_0x2263('0x7d')]?!![]:![]}];}return db[_0x2263('0x76')][_0x2263('0x40')](_0x1b5c96);})[_0x2263('0xe')](function(_0x161ae6){_0x4c994a[_0x2263('0x41')]=_0x161ae6;return _0x4c994a;});}})['then'](respondWithFilteredResult(_0x1fb4b0,_0x1b5c96))[_0x2263('0x48')](handleError(_0x1fb4b0,null));};exports['addApplications']=function addApplications(_0x32144f,_0x5e3342){var _0x3ba66d=_0x32144f['params']['id'];var _0x554aba=_0x32144f[_0x2263('0x49')];var _0x3869aa=0xc8;var _0x214f2d=null;return db[_0x2263('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x2263('0x7f')][_0x2263('0x80')][_0x2263('0x81')]},function(_0x1ac2a9){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x3ba66d},'transaction':_0x1ac2a9})[_0x2263('0xe')](function(_0x132c5d){if(_0x132c5d){return db[_0x2263('0x82')][_0x2263('0x24')]({'where':{'MailAccountId':_0x3ba66d},'transaction':_0x1ac2a9})[_0x2263('0xe')](function(){var _0x19fbd4=_[_0x2263('0x2c')](_0x554aba,function(_0x1b1cff){_0x1b1cff[_0x2263('0x4e')]=_0x3ba66d;return _0x1b1cff;});return db[_0x2263('0x82')]['bulkCreate'](_0x19fbd4,{'transaction':_0x1ac2a9});});}else{_0x3869aa=0x194;_0x214f2d=[];}});})[_0x2263('0xe')](function(){if(_0x3869aa!==0x194){return db[_0x2263('0x82')][_0x2263('0x83')]({'where':{'MailAccountId':_0x3ba66d},'order':'priority'})['then'](function(_0x265b2d){_0x214f2d=_0x265b2d;});}})[_0x2263('0x48')](function(_0x257c37){_0x3869aa=0x1f4;logger['error'](_0x257c37['stack']);if(_0x257c37['name']){delete _0x257c37[_0x2263('0x26')];}_0x214f2d=_0x257c37;})[_0x2263('0x84')](function(){if(_0x214f2d===null){_0x5e3342[_0x2263('0x16')](_0x3869aa);}else{if(_0x3869aa===0x1f4){_0x5e3342['status'](_0x3869aa)[_0x2263('0x85')](_0x214f2d);}else{_0x5e3342[_0x2263('0x18')](_0x3869aa)[_0x2263('0x1f')](_0x214f2d);}}});};exports[_0x2263('0x86')]=function(_0x4188c8,_0x2a75fd){var _0x454508={};var _0x45dcb6={};var _0xf3770d;var _0x30b66d;return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x4188c8[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x2a75fd,null))[_0x2263('0xe')](function(_0x1e6bc9){if(_0x1e6bc9){_0xf3770d=_0x1e6bc9;_0x45dcb6[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x82')]['rawAttributes']);_0x45dcb6['query']=_[_0x2263('0x45')](_0x4188c8[_0x2263('0x2f')]);_0x45dcb6[_0x2263('0x30')]=_[_0x2263('0x33')](_0x45dcb6[_0x2263('0x31')],_0x45dcb6[_0x2263('0x2f')]);_0x454508[_0x2263('0x32')]=_[_0x2263('0x33')](_0x45dcb6[_0x2263('0x31')],qs[_0x2263('0x46')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x46')]));_0x454508[_0x2263('0x32')]=_0x454508[_0x2263('0x32')][_0x2263('0x34')]?_0x454508['attributes']:_0x45dcb6['model'];_0x454508[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x4188c8['query'][_0x2263('0x37')]);_0x454508[_0x2263('0x3a')]=qs['filters'](_['pick'](_0x4188c8[_0x2263('0x2f')],_0x45dcb6[_0x2263('0x30')]));if(_0x4188c8[_0x2263('0x2f')][_0x2263('0x39')]){_0x454508[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x454508[_0x2263('0x3a')],{'$or':_['map'](_0x454508['attributes'],function(_0x20db0e){var _0x1431dc={};_0x1431dc[_0x20db0e]={'$like':'%'+_0x4188c8[_0x2263('0x2f')][_0x2263('0x39')]+'%'};return _0x1431dc;})});}_0x454508=_[_0x2263('0x3b')]({},_0x454508,_0x4188c8['options']);return _0xf3770d[_0x2263('0x86')](_0x454508);}})[_0x2263('0xe')](function(_0xc385cd){if(_0xc385cd){_0x30b66d=_0xc385cd['length'];if(!_0x4188c8[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x454508[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x1b')]);_0x454508[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x19')]);}return _0xf3770d['getApplications'](_0x454508);}})[_0x2263('0xe')](function(_0x13c764){if(_0x13c764){return _0x13c764?{'count':_0x30b66d,'rows':_0x13c764}:null;}})[_0x2263('0xe')](respondWithResult(_0x2a75fd,null))['catch'](handleError(_0x2a75fd,null));};exports['getMessages']=function(_0x58c4a2,_0x7ccce4){var _0x388548={'raw':!![],'where':{}};var _0x511626={};var _0x4824b6={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x58c4a2['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x7ccce4,null))[_0x2263('0xe')](function(_0x3e5476){if(_0x3e5476){_0x511626['model']=_[_0x2263('0x45')](db['MailMessage'][_0x2263('0x58')]);_0x511626['query']=_[_0x2263('0x45')](_0x58c4a2['query']);_0x511626[_0x2263('0x30')]=_[_0x2263('0x33')](_0x511626[_0x2263('0x31')],_0x511626[_0x2263('0x2f')]);_0x388548[_0x2263('0x32')]=_[_0x2263('0x33')](_0x511626['model'],qs[_0x2263('0x46')](_0x58c4a2['query'][_0x2263('0x46')]));_0x388548[_0x2263('0x32')]=_0x388548[_0x2263('0x32')]['length']?_0x388548['attributes']:_0x511626[_0x2263('0x31')];if(!_0x58c4a2[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x388548[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x58c4a2[_0x2263('0x2f')][_0x2263('0x1b')]);_0x388548[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x58c4a2[_0x2263('0x2f')][_0x2263('0x19')]);}_0x388548['order']=qs[_0x2263('0x37')](_0x58c4a2['query'][_0x2263('0x37')]);_0x388548['where']=qs['filters'](_[_0x2263('0x38')](_0x58c4a2[_0x2263('0x2f')],_0x511626[_0x2263('0x30')]));_0x388548[_0x2263('0x3a')][_0x2263('0x4e')]=_0x3e5476['id'];if(_0x58c4a2[_0x2263('0x2f')][_0x2263('0x39')]){_0x388548[_0x2263('0x3a')]=_['merge'](_0x388548[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x388548[_0x2263('0x32')],function(_0x41b8f3){var _0x3330e8={};_0x3330e8[_0x41b8f3]={'$like':'%'+_0x58c4a2['query']['filter']+'%'};return _0x3330e8;})});}if(_0x58c4a2[_0x2263('0x2f')]['$gte']){var _0x15d4fe=_0x58c4a2[_0x2263('0x2f')][_0x2263('0x87')][_0x2263('0x88')](',');var _0x1320f2={};_0x1320f2[_0x15d4fe[0x0]]={'$gte':moment(_0x15d4fe[0x1])[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss')};_0x388548[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x388548[_0x2263('0x3a')],_0x1320f2);}_0x388548=_[_0x2263('0x3b')]({},_0x388548,_0x58c4a2['options']);return db['MailMessage']['count']({'where':_0x388548[_0x2263('0x3a')]})[_0x2263('0xe')](function(_0x573f82){_0x4824b6[_0x2263('0x1c')]=_0x573f82;if(_0x58c4a2['query'][_0x2263('0x53')]){_0x388548[_0x2263('0x3f')]=[{'all':!![]}];}return db['MailMessage'][_0x2263('0x40')](_0x388548);})[_0x2263('0xe')](function(_0x2ee04f){if(_0x58c4a2['query'][_0x2263('0x8a')]===_0x2263('0x8b')){for(var _0x4bb8f7=0x0;_0x4bb8f7<_0x2ee04f[_0x2263('0x34')];_0x4bb8f7++){_0x2ee04f[_0x4bb8f7][_0x2263('0x49')]=juice(_0x2ee04f[_0x4bb8f7][_0x2263('0x49')]);}}_0x4824b6[_0x2263('0x41')]=_0x2ee04f;return _0x4824b6;});}})['then'](respondWithFilteredResult(_0x7ccce4,_0x388548))[_0x2263('0x48')](handleError(_0x7ccce4,null));};exports[_0x2263('0x85')]=function(_0x523a90,_0x28fcb9){var _0x50c5db,_0xed6453={},_0x3ce4e3;if(_0x523a90['body']['to']){_0x3ce4e3=_0x523a90['body']['to'][_0x2263('0x88')](',')[0x0];}return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x523a90[_0x2263('0x43')]['id']},'include':[{'model':db[_0x2263('0x8c')],'as':_0x2263('0x8d'),'include':[{'model':db[_0x2263('0x8e')],'as':_0x2263('0x8f'),'where':{'email':_0x3ce4e3},'limit':0x1,'order':[['updatedAt',_0x2263('0x90')]]}]},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a'),'raw':!![]}]})[_0x2263('0xe')](handleEntityNotFound(_0x28fcb9,null))[_0x2263('0xe')](function(_0xaacfd7){if(_0xaacfd7){_0x50c5db=_0xaacfd7;if(_0xaacfd7[_0x2263('0x2a')]){if(_[_0x2263('0x5f')](_0x523a90[_0x2263('0x49')][_0x2263('0x91')])){_0x523a90[_0x2263('0x49')]['from']=util[_0x2263('0x89')](_0x2263('0x92'),_0xaacfd7[_0x2263('0x26')],_0xaacfd7['email']||_0xaacfd7['Smtp']['user']);}if(_0x523a90['body'][_0x2263('0x93')]&&_0x523a90[_0x2263('0x49')]['attachments'][_0x2263('0x34')]){for(var _0x45c951=0x0;_0x45c951<_0x523a90[_0x2263('0x49')]['attachments']['length'];_0x45c951+=0x1){_0x523a90[_0x2263('0x49')]['attachments'][_0x45c951]={'filename':_0x523a90[_0x2263('0x49')][_0x2263('0x93')][_0x45c951]['name'],'path':path['join'](config['root'],_0x2263('0x94'),_0x523a90['body'][_0x2263('0x93')][_0x45c951][_0x2263('0x95')])};}}var _0x5ecd73={'tls':{'rejectUnauthorized':![]}};if(_[_0x2263('0x5f')](_0xaacfd7[_0x2263('0x2a')][_0x2263('0x96')])){if(_0xaacfd7['Smtp'][_0x2263('0x68')]){_0x5ecd73['auth']={'user':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x64')]};}_0x5ecd73[_0x2263('0x66')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x66')];_0x5ecd73[_0x2263('0x67')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x67')];_0x5ecd73[_0x2263('0x97')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x97')];}else{_0x5ecd73['service']=_0xaacfd7['Smtp']['service'];_0x5ecd73[_0x2263('0x98')]={'user':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0xaacfd7[_0x2263('0x2a')]['pass']};}return respondWithRpcPromise(_0x2263('0x99'),_0x2263('0x9a'),{'account':_0x5ecd73,'message':_0x523a90[_0x2263('0x49')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2263('0xe')](function(_0x4e9ea8){if(_0x4e9ea8){_0xed6453=_0x4e9ea8;if(_0x50c5db[_0x2263('0x8d')]){if(_0x50c5db[_0x2263('0x8d')][_0x2263('0x8f')]['length']){return _0x50c5db['List'][_0x2263('0x8f')][0x0];}else{return db[_0x2263('0x8e')][_0x2263('0x50')](_[_0x2263('0x9b')](_0x523a90[_0x2263('0x49')],{'firstName':_0x523a90[_0x2263('0x49')]['to'],'email':_0x523a90['body']['to'],'phone':_0x523a90[_0x2263('0x49')]['to'],'ListId':_0x50c5db[_0x2263('0x9c')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x2263('0xe')](function(_0x21781f){if(_0x21781f){var _0x4c17ca={'UserId':_0x523a90['user']['id'],'ContactId':_0x21781f['id'],'MailAccountId':_0x50c5db['id'],'inReplyTo':_0xed6453[_0x2263('0x9d')],'to':_0x523a90['body'][_0x2263('0x91')],'cc':_0x523a90[_0x2263('0x49')]['cc'],'subject':_0x523a90['body'][_0x2263('0x9e')],'attach':_0x523a90[_0x2263('0x49')]['attach'],'firstMsgDirection':_0x2263('0x9f'),'lastMsgAt':moment()[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2263('0x9f'),'Messages':[_[_0x2263('0x3b')](_0x523a90['body'],{'messageId':_0xed6453[_0x2263('0x9d')],'sentAt':moment()[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x50c5db['id'],'UserId':_0x523a90[_0x2263('0x61')]['id'],'ContactId':_0x21781f['id']})]};if(_0x523a90[_0x2263('0x49')]['Interaction']){_0x4c17ca=_[_0x2263('0x3b')](_0x4c17ca,_0x523a90[_0x2263('0x49')][_0x2263('0xa0')]);}return db[_0x2263('0x76')][_0x2263('0x50')](_0x4c17ca,{'include':[{'model':db[_0x2263('0xa1')],'as':'Messages'}]});}})[_0x2263('0xe')](respondWithResult(_0x28fcb9,null))[_0x2263('0x48')](handleError(_0x28fcb9,null));};exports[_0x2263('0xa2')]=function(_0x256bda,_0x5ddb27){return db['MailAccount']['find']({'where':{'id':_0x256bda[_0x2263('0x43')]['id']},'include':[{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2263('0xa3'),'raw':!![]}]}]})[_0x2263('0xe')](handleEntityNotFound(_0x5ddb27,null))[_0x2263('0xe')](function(_0x1cb5bb){if(!_0x1cb5bb['Smtp'])return;var _0x641301={'id':_0x1cb5bb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1cb5bb[_0x2263('0x5c')]!==_0x2263('0x5d')){_0x641301[_0x2263('0x96')]=_0x1cb5bb[_0x2263('0x5c')];}else{_0x641301['host']=_0x1cb5bb[_0x2263('0x2a')]['host'];_0x641301[_0x2263('0x67')]=_0x1cb5bb['Smtp']['port'];_0x641301[_0x2263('0x97')]=_0x1cb5bb['Smtp'][_0x2263('0x97')];}if(_0x1cb5bb['Smtp'][_0x2263('0x68')]){if(_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x4a')]){_0x641301[_0x2263('0x98')]={'type':_0x2263('0xa4'),'user':_0x1cb5bb['Smtp'][_0x2263('0x61')],'accessToken':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0xa3')][_0x2263('0xa5')]};}else{_0x641301['auth']={'user':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x64')]};}}return respondWithRpcPromise(_0x2263('0xa6'),_0x2263('0xa2'),{'account':_0x641301});})[_0x2263('0xe')](respondWithResult(_0x5ddb27,null))['catch'](handleError(_0x5ddb27,null));};exports[_0x2263('0x24')]=function(_0x1d0bee,_0x5f1d2a){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1d0bee['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x5f1d2a,null))['then'](function(_0xbbc74){if(_0xbbc74&&_0xbbc74['service']){throw new db['Sequelize'][(_0x2263('0xa7'))](_0x2263('0xa8'));}return _0xbbc74;})[_0x2263('0xe')](removeEntity(_0x5f1d2a,null))['catch'](handleError(_0x5f1d2a,null));};exports['addAgents']=function(_0x1c05e3,_0x1339f7){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1c05e3[_0x2263('0x43')]['id']}})['then'](handleEntityNotFound(_0x1339f7,null))[_0x2263('0xe')](function(_0x231dd0){if(_0x231dd0){return _0x231dd0[_0x2263('0xa9')](_0x1c05e3[_0x2263('0x49')][_0x2263('0x5b')],_[_0x2263('0xaa')](_0x1c05e3[_0x2263('0x49')],[_0x2263('0x5b'),'id'])||{})[_0x2263('0xab')](function(_0x46c403){for(var _0x588b70=0x0;_0x588b70<_0x1c05e3[_0x2263('0x49')]['ids']['length'];_0x588b70+=0x1){socket['emit'](_0x2263('0xac'),{'UserId':Number(_0x1c05e3['body']['ids'][_0x588b70]),'MailAccountId':Number(_0x1c05e3[_0x2263('0x43')]['id'])});}return _0x46c403;});}})['then'](respondWithResult(_0x1339f7,null))['catch'](handleError(_0x1339f7,null));};exports['removeAgents']=function(_0x435882,_0x549cae){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x435882[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x549cae,null))[_0x2263('0xe')](function(_0x8fa089){if(_0x8fa089){return _0x8fa089[_0x2263('0xad')](_0x435882[_0x2263('0x2f')][_0x2263('0x5b')])[_0x2263('0xe')](function(){if(_[_0x2263('0xae')](_0x435882[_0x2263('0x2f')][_0x2263('0x5b')])){for(var _0x1175e1=0x0;_0x1175e1<_0x435882[_0x2263('0x2f')][_0x2263('0x5b')][_0x2263('0x34')];_0x1175e1+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x435882[_0x2263('0x2f')][_0x2263('0x5b')][_0x1175e1]),'MailAccountId':Number(_0x435882['params']['id'])});}}else{socket[_0x2263('0xaf')](_0x2263('0xb0'),{'UserId':Number(_0x435882['query'][_0x2263('0x5b')]),'MailAccountId':Number(_0x435882[_0x2263('0x43')]['id'])});}});}})[_0x2263('0xe')](respondWithStatusCode(_0x549cae,null))[_0x2263('0x48')](handleError(_0x549cae,null));};exports['getAgents']=function(_0x1230f7,_0x110d2f){var _0x34130e={};var _0x5abf4a={};var _0x10a2e4;var _0x248121;return db[_0x2263('0x3e')]['findOne']({'where':{'id':_0x1230f7[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x110d2f,null))[_0x2263('0xe')](function(_0x767dcd){if(_0x767dcd){_0x10a2e4=_0x767dcd;_0x5abf4a[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x78')][_0x2263('0x58')]);_0x5abf4a[_0x2263('0x2f')]=_['keys'](_0x1230f7[_0x2263('0x2f')]);_0x5abf4a['filters']=_[_0x2263('0x33')](_0x5abf4a[_0x2263('0x31')],_0x5abf4a[_0x2263('0x2f')]);_0x34130e[_0x2263('0x32')]=_[_0x2263('0x33')](_0x5abf4a['model'],qs[_0x2263('0x46')](_0x1230f7[_0x2263('0x2f')][_0x2263('0x46')]));_0x34130e[_0x2263('0x32')]=_0x34130e[_0x2263('0x32')][_0x2263('0x34')]?_0x34130e[_0x2263('0x32')]:_0x5abf4a[_0x2263('0x31')];_0x34130e[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x1230f7[_0x2263('0x2f')]['sort']);_0x34130e[_0x2263('0x3a')]=qs[_0x2263('0x30')](_['pick'](_0x1230f7[_0x2263('0x2f')],_0x5abf4a[_0x2263('0x30')]));if(_0x1230f7['query'][_0x2263('0x39')]){_0x34130e[_0x2263('0x3a')]=_['merge'](_0x34130e[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x34130e[_0x2263('0x32')],function(_0x25110a){var _0x4a520d={};_0x4a520d[_0x25110a]={'$like':'%'+_0x1230f7[_0x2263('0x2f')]['filter']+'%'};return _0x4a520d;})});}_0x34130e=_[_0x2263('0x3b')]({},_0x34130e,_0x1230f7['options']);return _0x10a2e4[_0x2263('0xb1')](_0x34130e);}})[_0x2263('0xe')](function(_0x147885){if(_0x147885){_0x248121=_0x147885['length'];if(!_0x1230f7[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x34130e['limit']=qs[_0x2263('0x1b')](_0x1230f7[_0x2263('0x2f')][_0x2263('0x1b')]);_0x34130e[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x1230f7['query']['offset']);}return _0x10a2e4[_0x2263('0xb1')](_0x34130e);}})[_0x2263('0xe')](function(_0x3cd1e3){if(_0x3cd1e3){return _0x3cd1e3?{'count':_0x248121,'rows':_0x3cd1e3}:null;}})['then'](respondWithResult(_0x110d2f,null))['catch'](handleError(_0x110d2f,null));}; \ No newline at end of file +var _0x6105=['Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','SendMail','sendMail','CmContact','List\x20not\x20found','attach','out','messageId','Messages','verifySmtp','CloudProvider','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','include','findAll','rows','catch','params','Smtp','fields','includeAll','find','body','modernAuthentication','CloudProviderId','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','order','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','provider','custom','email','isNil','active','description','user','username','password','pass','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List'];(function(_0x1fed06,_0x1cf619){var _0x20707b=function(_0x52b56a){while(--_0x52b56a){_0x1fed06['push'](_0x1fed06['shift']());}};_0x20707b(++_0x1cf619);}(_0x6105,0xd7));var _0x5610=function(_0x3bea3,_0x4d6961){_0x3bea3=_0x3bea3-0x0;var _0x45046e=_0x6105[_0x3bea3];return _0x45046e;};'use strict';var moment=require('moment');var BPromise=require(_0x5610('0x0'));var util=require(_0x5610('0x1'));var path=require('path');var _=require(_0x5610('0x2'));var juice=require(_0x5610('0x3'));var Redis=require(_0x5610('0x4'));var qs=require(_0x5610('0x5'));var logger=require(_0x5610('0x6'))('api');var config=require(_0x5610('0x7'));var db=require(_0x5610('0x8'))['db'];config[_0x5610('0x9')]=_[_0x5610('0xa')](config['redis'],{'host':_0x5610('0xb'),'port':0x18eb});var socket=require(_0x5610('0xc'))(new Redis(config[_0x5610('0x9')]));require(_0x5610('0xd'))['register'](socket);var jayson=require(_0x5610('0xe'));var client=jayson[_0x5610('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4ed7f3,_0xdac82e,_0x9cd410,_0x2f86d2){return new BPromise(function(_0x40ddec,_0x163f13){var _0xd9e605=_0x2f86d2||client;return _0xd9e605[_0x5610('0x10')](_0x4ed7f3,_0x9cd410)[_0x5610('0x11')](function(_0x45c1f3){logger[_0x5610('0x12')]('MailAccount,\x20%s,\x20%s',_0xdac82e,_0x5610('0x13'));logger[_0x5610('0x14')](_0x5610('0x15'),_0xdac82e,'request\x20sent',JSON[_0x5610('0x16')](_0x45c1f3));if(_0x45c1f3[_0x5610('0x17')]){if(_0x45c1f3[_0x5610('0x17')][_0x5610('0x18')]===0x1f4){logger[_0x5610('0x17')](_0x5610('0x19'),_0xdac82e,_0x45c1f3['error'][_0x5610('0x1a')]);return _0x163f13(_0x45c1f3[_0x5610('0x17')][_0x5610('0x1a')]);}logger[_0x5610('0x17')](_0x5610('0x19'),_0xdac82e,_0x45c1f3[_0x5610('0x17')]['message']);return _0x40ddec(_0x45c1f3[_0x5610('0x17')][_0x5610('0x1a')]);}else{logger[_0x5610('0x12')](_0x5610('0x19'),_0xdac82e,_0x5610('0x13'));_0x40ddec(_0x45c1f3[_0x5610('0x1b')][_0x5610('0x1a')]);}})['catch'](function(_0x42183f){logger[_0x5610('0x17')](_0x5610('0x19'),_0xdac82e,_0x42183f);_0x163f13(_0x42183f);});});}function respondWithStatusCode(_0x13f2ff,_0x217232){_0x217232=_0x217232||0xcc;return function(_0x125253){if(_0x125253){return _0x13f2ff[_0x5610('0x1c')](_0x217232);}return _0x13f2ff['status'](_0x217232)[_0x5610('0x1d')]();};}function respondWithResult(_0x331200,_0x4c7824){_0x4c7824=_0x4c7824||0xc8;return function(_0x589e32){if(_0x589e32){return _0x331200[_0x5610('0x1e')](_0x4c7824)[_0x5610('0x1f')](_0x589e32);}};}function respondWithFilteredResult(_0x1002c8,_0x327a4b){return function(_0x28c50b){if(_0x28c50b){var _0x16436d=typeof _0x327a4b[_0x5610('0x20')]==='undefined'&&typeof _0x327a4b[_0x5610('0x21')]===_0x5610('0x22');var _0xee9f8d=_0x28c50b[_0x5610('0x23')];var _0x570364=_0x16436d?0x0:_0x327a4b['offset'];var _0x2ad27f=_0x16436d?_0x28c50b['count']:_0x327a4b[_0x5610('0x20')]+_0x327a4b[_0x5610('0x21')];var _0x51e4e2;if(_0x2ad27f>=_0xee9f8d){_0x2ad27f=_0xee9f8d;_0x51e4e2=0xc8;}else{_0x51e4e2=0xce;}_0x1002c8[_0x5610('0x1e')](_0x51e4e2);return _0x1002c8['set'](_0x5610('0x24'),_0x570364+'-'+_0x2ad27f+'/'+_0xee9f8d)[_0x5610('0x1f')](_0x28c50b);}return null;};}function saveUpdates(_0x3a4332){return function(_0x3e4aba){if(_0x3e4aba){return _0x3e4aba[_0x5610('0x25')](_0x3a4332)[_0x5610('0x11')](function(_0x26fe98){return _0x26fe98;});}return null;};}function removeEntity(_0x261679){return function(_0x593fdc){if(_0x593fdc){return _0x593fdc[_0x5610('0x26')]()[_0x5610('0x11')](function(){var _0x28c053=_0x593fdc[_0x5610('0x27')]({'plain':!![]});var _0x453d83=_0x5610('0x28');return db[_0x5610('0x29')][_0x5610('0x26')]({'where':{'type':_0x453d83,'resourceId':_0x28c053['id']}})['then'](function(){return _0x593fdc;});})[_0x5610('0x11')](function(){_0x261679[_0x5610('0x1e')](0xcc)[_0x5610('0x1d')]();});}};}function handleEntityNotFound(_0x343a5d){return function(_0x3c67ad){if(!_0x3c67ad){_0x343a5d[_0x5610('0x1c')](0x194);}return _0x3c67ad;};}function handleError(_0x48214c,_0x3f4087){_0x3f4087=_0x3f4087||0x1f4;return function(_0x88a09d){logger['error'](_0x88a09d[_0x5610('0x2a')]);if(_0x88a09d[_0x5610('0x2b')]){delete _0x88a09d['name'];}_0x48214c[_0x5610('0x1e')](_0x3f4087)[_0x5610('0x2c')](_0x88a09d);};}exports['index']=function(_0x58bd38,_0x15e720){var _0x48791a={'include':[{'model':db[_0x5610('0x2d')],'as':_0x5610('0x2e')},{'model':db[_0x5610('0x2f')],'as':'Smtp'},{'model':db[_0x5610('0x30')],'as':_0x5610('0x31')}]},_0x3b4a7b={},_0x3fd7f1={'count':0x0,'rows':[]};var _0x19e924=_[_0x5610('0x32')](db[_0x5610('0x33')]['rawAttributes'],function(_0x3b1f32){return{'name':_0x3b1f32[_0x5610('0x34')],'type':_0x3b1f32['type'][_0x5610('0x35')]};});_0x3b4a7b[_0x5610('0x36')]=_[_0x5610('0x32')](_0x19e924,_0x5610('0x2b'));_0x3b4a7b[_0x5610('0x37')]=_[_0x5610('0x38')](_0x58bd38[_0x5610('0x37')]);_0x3b4a7b[_0x5610('0x39')]=_['intersection'](_0x3b4a7b[_0x5610('0x36')],_0x3b4a7b['query']);_0x48791a[_0x5610('0x3a')]=_[_0x5610('0x3b')](_0x3b4a7b[_0x5610('0x36')],qs['fields'](_0x58bd38[_0x5610('0x37')]['fields']));_0x48791a[_0x5610('0x3a')]=_0x48791a[_0x5610('0x3a')][_0x5610('0x3c')]?_0x48791a[_0x5610('0x3a')]:_0x3b4a7b[_0x5610('0x36')];if(!_0x58bd38[_0x5610('0x37')][_0x5610('0x3d')](_0x5610('0x3e'))){_0x48791a['limit']=qs[_0x5610('0x21')](_0x58bd38[_0x5610('0x37')]['limit']);_0x48791a[_0x5610('0x20')]=qs[_0x5610('0x20')](_0x58bd38[_0x5610('0x37')][_0x5610('0x20')]);}_0x48791a['order']=qs[_0x5610('0x3f')](_0x58bd38['query'][_0x5610('0x3f')]);_0x48791a[_0x5610('0x40')]=qs['filters'](_[_0x5610('0x41')](_0x58bd38[_0x5610('0x37')],_0x3b4a7b[_0x5610('0x39')]),_0x19e924);if(_0x58bd38[_0x5610('0x37')]['filter']){_0x48791a[_0x5610('0x40')]=_['merge'](_0x48791a[_0x5610('0x40')],{'$or':_[_0x5610('0x32')](_0x19e924,function(_0x1a0ca5){if(_0x1a0ca5['type']!=='VIRTUAL'){var _0x244800={};_0x244800[_0x1a0ca5[_0x5610('0x2b')]]={'$like':'%'+_0x58bd38[_0x5610('0x37')]['filter']+'%'};return _0x244800;}})});}_0x48791a=_[_0x5610('0x42')]({},_0x48791a,_0x58bd38[_0x5610('0x43')]);var _0x4c1755={'where':_0x48791a[_0x5610('0x40')]};return db['MailAccount'][_0x5610('0x23')](_0x4c1755)[_0x5610('0x11')](function(_0x38eb95){_0x3fd7f1[_0x5610('0x23')]=_0x38eb95;if(_0x58bd38['query']['includeAll']){_0x48791a[_0x5610('0x44')]=[{'all':!![]}];}return db[_0x5610('0x33')][_0x5610('0x45')](_0x48791a);})['then'](function(_0x5502b2){_0x3fd7f1[_0x5610('0x46')]=_0x5502b2;return _0x3fd7f1;})[_0x5610('0x11')](respondWithFilteredResult(_0x15e720,_0x48791a))[_0x5610('0x47')](handleError(_0x15e720,null));};exports['show']=function(_0x13d4c0,_0xd9d2b8){var _0x21dee2={'raw':![],'where':{'id':_0x13d4c0[_0x5610('0x48')]['id']},'include':[{'model':db[_0x5610('0x2d')],'as':_0x5610('0x2e')},{'model':db[_0x5610('0x2f')],'as':_0x5610('0x49')},{'model':db['Pause'],'as':_0x5610('0x31')}]},_0x330760={};_0x330760[_0x5610('0x36')]=_[_0x5610('0x38')](db['MailAccount']['rawAttributes']);_0x330760[_0x5610('0x37')]=_[_0x5610('0x38')](_0x13d4c0[_0x5610('0x37')]);_0x330760[_0x5610('0x39')]=_[_0x5610('0x3b')](_0x330760[_0x5610('0x36')],_0x330760[_0x5610('0x37')]);_0x21dee2['attributes']=_[_0x5610('0x3b')](_0x330760[_0x5610('0x36')],qs[_0x5610('0x4a')](_0x13d4c0[_0x5610('0x37')]['fields']));_0x21dee2[_0x5610('0x3a')]=_0x21dee2['attributes']['length']?_0x21dee2[_0x5610('0x3a')]:_0x330760[_0x5610('0x36')];if(_0x13d4c0[_0x5610('0x37')][_0x5610('0x4b')]){_0x21dee2['include']=[{'all':!![]}];}_0x21dee2=_[_0x5610('0x42')]({},_0x21dee2,_0x13d4c0[_0x5610('0x43')]);return db['MailAccount'][_0x5610('0x4c')](_0x21dee2)[_0x5610('0x11')](handleEntityNotFound(_0xd9d2b8,null))['then'](respondWithResult(_0xd9d2b8,null))[_0x5610('0x47')](handleError(_0xd9d2b8,null));};exports[_0x5610('0x25')]=function(_0x4c59aa,_0x3eea22){if(_0x4c59aa[_0x5610('0x4d')]['id']){delete _0x4c59aa[_0x5610('0x4d')]['id'];}if(_0x4c59aa[_0x5610('0x4d')][_0x5610('0x2e')]){if(!_0x4c59aa[_0x5610('0x4d')][_0x5610('0x2e')][_0x5610('0x4e')]){_0x4c59aa[_0x5610('0x4d')][_0x5610('0x2e')][_0x5610('0x4f')]=null;}}if(_0x4c59aa[_0x5610('0x4d')][_0x5610('0x49')]){if(!_0x4c59aa[_0x5610('0x4d')][_0x5610('0x49')][_0x5610('0x4e')]){_0x4c59aa['body'][_0x5610('0x49')][_0x5610('0x4f')]=null;}}return db['MailAccount'][_0x5610('0x4c')]({'where':{'id':_0x4c59aa[_0x5610('0x48')]['id']},'include':[{'model':db[_0x5610('0x2d')],'as':'Imap'},{'model':db[_0x5610('0x2f')],'as':_0x5610('0x49')},{'model':db[_0x5610('0x30')],'as':_0x5610('0x31')}]})[_0x5610('0x11')](handleEntityNotFound(_0x3eea22,null))[_0x5610('0x11')](saveUpdates(_0x4c59aa[_0x5610('0x4d')],null))[_0x5610('0x11')](function(_0x5b292c){if(_0x5b292c&&_0x4c59aa[_0x5610('0x4d')][_0x5610('0x2e')]){return db[_0x5610('0x2d')][_0x5610('0x25')](_0x4c59aa[_0x5610('0x4d')][_0x5610('0x2e')],{'where':{'MailAccountId':_0x5b292c['id']}})['then'](function(){return _0x5b292c;});}return _0x5b292c;})[_0x5610('0x11')](function(_0x581a8a){if(_0x581a8a&&_0x4c59aa[_0x5610('0x4d')]['Smtp']){return db[_0x5610('0x2f')][_0x5610('0x25')](_0x4c59aa[_0x5610('0x4d')][_0x5610('0x49')],{'where':{'MailAccountId':_0x581a8a['id']}})['then'](function(){return _0x581a8a;});}return _0x581a8a;})['then'](respondWithResult(_0x3eea22,null))[_0x5610('0x47')](handleError(_0x3eea22,null));};exports['describe']=function(_0x15251c,_0x56d672){return db[_0x5610('0x33')]['describe']()[_0x5610('0x11')](respondWithResult(_0x56d672,null))[_0x5610('0x47')](handleError(_0x56d672,null));};exports[_0x5610('0x50')]=function(_0xc33124,_0x19260f){if(_0xc33124['body']['id']){delete _0xc33124[_0x5610('0x4d')]['id'];}return db[_0x5610('0x33')]['find']({'where':{'id':_0xc33124[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x19260f,null))[_0x5610('0x11')](function(_0x4ab4e2){if(_0x4ab4e2){_0xc33124[_0x5610('0x4d')][_0x5610('0x51')]=_0x4ab4e2['id'];return db[_0x5610('0x52')][_0x5610('0x53')](_0xc33124[_0x5610('0x4d')]);}})[_0x5610('0x11')](respondWithResult(_0x19260f,null))[_0x5610('0x47')](handleError(_0x19260f,null));};exports[_0x5610('0x54')]=function(_0x3d5ba1,_0x40f370){var _0x131d51={'raw':![],'where':{}};var _0x50ec55={};var _0x25f8d5={'count':0x0,'rows':[]};return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x3d5ba1['params']['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x40f370,null))[_0x5610('0x11')](function(_0x1fc6b8){if(_0x1fc6b8){_0x50ec55[_0x5610('0x36')]=_['keys'](db[_0x5610('0x52')][_0x5610('0x56')]);_0x50ec55[_0x5610('0x37')]=_['keys'](_0x3d5ba1[_0x5610('0x37')]);_0x50ec55['filters']=_[_0x5610('0x3b')](_0x50ec55['model'],_0x50ec55['query']);_0x131d51[_0x5610('0x3a')]=_['intersection'](_0x50ec55[_0x5610('0x36')],qs[_0x5610('0x4a')](_0x3d5ba1[_0x5610('0x37')]['fields']));_0x131d51[_0x5610('0x3a')]=_0x131d51[_0x5610('0x3a')][_0x5610('0x3c')]?_0x131d51[_0x5610('0x3a')]:_0x50ec55[_0x5610('0x36')];if(!_0x3d5ba1[_0x5610('0x37')][_0x5610('0x3d')](_0x5610('0x3e'))){_0x131d51[_0x5610('0x21')]=qs[_0x5610('0x21')](_0x3d5ba1['query'][_0x5610('0x21')]);_0x131d51[_0x5610('0x20')]=qs[_0x5610('0x20')](_0x3d5ba1[_0x5610('0x37')][_0x5610('0x20')]);}_0x131d51[_0x5610('0x57')]=qs[_0x5610('0x3f')](_0x3d5ba1[_0x5610('0x37')]['sort']);_0x131d51['where']=qs[_0x5610('0x39')](_[_0x5610('0x41')](_0x3d5ba1[_0x5610('0x37')],_0x50ec55[_0x5610('0x39')]));_0x131d51[_0x5610('0x40')][_0x5610('0x51')]=_0x1fc6b8['id'];if(_0x3d5ba1[_0x5610('0x37')][_0x5610('0x58')]){_0x131d51[_0x5610('0x40')]=_['merge'](_0x131d51[_0x5610('0x40')],{'$or':_[_0x5610('0x32')](_0x131d51['attributes'],function(_0x9a0ae){var _0x5ee2f3={};_0x5ee2f3[_0x9a0ae]={'$like':'%'+_0x3d5ba1[_0x5610('0x37')]['filter']+'%'};return _0x5ee2f3;})});}_0x131d51=_['merge']({},_0x131d51,_0x3d5ba1[_0x5610('0x43')]);return db[_0x5610('0x52')][_0x5610('0x23')]({'where':_0x131d51['where']})['then'](function(_0x22bec0){_0x25f8d5[_0x5610('0x23')]=_0x22bec0;if(_0x3d5ba1[_0x5610('0x37')][_0x5610('0x4b')]){_0x131d51[_0x5610('0x44')]=[{'all':!![]}];}return db[_0x5610('0x52')]['findAll'](_0x131d51);})[_0x5610('0x11')](function(_0x393569){_0x25f8d5[_0x5610('0x46')]=_0x393569;return _0x25f8d5;});}})[_0x5610('0x11')](respondWithFilteredResult(_0x40f370,_0x131d51))[_0x5610('0x47')](handleError(_0x40f370,null));};exports[_0x5610('0x59')]=function(_0x318732,_0x52c8e6){return db['MailAccount'][_0x5610('0x4c')]({'where':{'id':_0x318732[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x52c8e6,null))[_0x5610('0x11')](function(_0x1b8f57){if(_0x1b8f57){return _0x1b8f57['removeDispositions'](_0x318732['query'][_0x5610('0x5a')]);}})['then'](respondWithStatusCode(_0x52c8e6,null))['catch'](handleError(_0x52c8e6,null));};exports[_0x5610('0x5b')]=function(_0x3c5a73,_0x5a2dbf){if(_0x3c5a73['body']['id']){delete _0x3c5a73[_0x5610('0x4d')]['id'];}return db[_0x5610('0x33')][_0x5610('0x4c')]({'where':{'id':_0x3c5a73['params']['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x5a2dbf,null))['then'](function(_0x1d9e19){if(_0x1d9e19){_0x3c5a73[_0x5610('0x4d')][_0x5610('0x51')]=_0x1d9e19['id'];return db['CannedAnswer'][_0x5610('0x53')](_0x3c5a73['body']);}})[_0x5610('0x11')](respondWithResult(_0x5a2dbf,null))['catch'](handleError(_0x5a2dbf,null));};exports[_0x5610('0x5c')]=function(_0x405faa,_0xb1c34){var _0xf7ca25={'raw':![],'where':{}};var _0x2a2a01={};var _0x1cf9d1={'count':0x0,'rows':[]};return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x405faa[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0xb1c34,null))['then'](function(_0x3374bc){if(_0x3374bc){_0x2a2a01[_0x5610('0x36')]=_[_0x5610('0x38')](db[_0x5610('0x5d')][_0x5610('0x56')]);_0x2a2a01[_0x5610('0x37')]=_[_0x5610('0x38')](_0x405faa['query']);_0x2a2a01[_0x5610('0x39')]=_[_0x5610('0x3b')](_0x2a2a01['model'],_0x2a2a01[_0x5610('0x37')]);_0xf7ca25[_0x5610('0x3a')]=_[_0x5610('0x3b')](_0x2a2a01[_0x5610('0x36')],qs['fields'](_0x405faa[_0x5610('0x37')][_0x5610('0x4a')]));_0xf7ca25[_0x5610('0x3a')]=_0xf7ca25['attributes'][_0x5610('0x3c')]?_0xf7ca25['attributes']:_0x2a2a01[_0x5610('0x36')];if(!_0x405faa['query'][_0x5610('0x3d')](_0x5610('0x3e'))){_0xf7ca25[_0x5610('0x21')]=qs[_0x5610('0x21')](_0x405faa[_0x5610('0x37')][_0x5610('0x21')]);_0xf7ca25[_0x5610('0x20')]=qs[_0x5610('0x20')](_0x405faa[_0x5610('0x37')][_0x5610('0x20')]);}_0xf7ca25[_0x5610('0x57')]=qs['sort'](_0x405faa[_0x5610('0x37')][_0x5610('0x3f')]);_0xf7ca25[_0x5610('0x40')]=qs[_0x5610('0x39')](_['pick'](_0x405faa['query'],_0x2a2a01[_0x5610('0x39')]));_0xf7ca25[_0x5610('0x40')][_0x5610('0x51')]=_0x3374bc['id'];if(_0x405faa[_0x5610('0x37')]['filter']){_0xf7ca25[_0x5610('0x40')]=_[_0x5610('0x42')](_0xf7ca25[_0x5610('0x40')],{'$or':_[_0x5610('0x32')](_0xf7ca25['attributes'],function(_0x54ebfe){var _0x1bcfa5={};_0x1bcfa5[_0x54ebfe]={'$like':'%'+_0x405faa[_0x5610('0x37')]['filter']+'%'};return _0x1bcfa5;})});}_0xf7ca25=_[_0x5610('0x42')]({},_0xf7ca25,_0x405faa[_0x5610('0x43')]);return db[_0x5610('0x5d')][_0x5610('0x23')]({'where':_0xf7ca25[_0x5610('0x40')]})[_0x5610('0x11')](function(_0x56e5bc){_0x1cf9d1[_0x5610('0x23')]=_0x56e5bc;if(_0x405faa['query'][_0x5610('0x4b')]){_0xf7ca25['include']=[{'all':!![]}];}return db[_0x5610('0x5d')][_0x5610('0x45')](_0xf7ca25);})['then'](function(_0x5f5ce3){_0x1cf9d1[_0x5610('0x46')]=_0x5f5ce3;return _0x1cf9d1;});}})['then'](respondWithFilteredResult(_0xb1c34,_0xf7ca25))['catch'](handleError(_0xb1c34,null));};exports['removeAnswers']=function(_0x48c673,_0x3d1e59){return db[_0x5610('0x33')][_0x5610('0x4c')]({'where':{'id':_0x48c673[_0x5610('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d1e59,null))['then'](function(_0x4f39d9){if(_0x4f39d9){return _0x4f39d9[_0x5610('0x5e')](_0x48c673['query']['ids']);}})[_0x5610('0x11')](respondWithStatusCode(_0x3d1e59,null))[_0x5610('0x47')](handleError(_0x3d1e59,null));};exports[_0x5610('0x53')]=function(_0x210666,_0x33201b){var _0x43fe0e={'name':_0x210666['body'][_0x5610('0x2b')],'key':_0x210666[_0x5610('0x4d')][_0x5610('0x35')],'provider':_0x210666['body'][_0x5610('0x5f')]===_0x5610('0x60')?null:_0x210666[_0x5610('0x4d')]['provider'],'email':_0x210666['body'][_0x5610('0x61')],'ListId':_0x210666[_0x5610('0x4d')]['ListId'],'active':!_[_0x5610('0x62')](_0x210666['body'][_0x5610('0x63')])?_0x210666[_0x5610('0x4d')]['active']:!![],'description':_0x210666['body'][_0x5610('0x64')]||null,'Imap':{},'Smtp':{}};if(_0x43fe0e[_0x5610('0x5f')]){_0x43fe0e[_0x5610('0x2e')]['user']=_0x43fe0e[_0x5610('0x49')][_0x5610('0x65')]=_0x210666[_0x5610('0x4d')][_0x5610('0x66')];_0x43fe0e[_0x5610('0x2e')][_0x5610('0x67')]=_0x43fe0e['Smtp'][_0x5610('0x68')]=_0x210666[_0x5610('0x4d')][_0x5610('0x67')];if(_0x210666[_0x5610('0x4d')][_0x5610('0x4e')]){_0x43fe0e[_0x5610('0x2e')][_0x5610('0x4e')]=_0x43fe0e[_0x5610('0x49')][_0x5610('0x4e')]=!![];_0x43fe0e[_0x5610('0x2e')][_0x5610('0x4f')]=_0x43fe0e['Smtp'][_0x5610('0x4f')]=_0x210666[_0x5610('0x4d')][_0x5610('0x4f')];_0x43fe0e[_0x5610('0x2e')]['password']=_0x43fe0e[_0x5610('0x49')]['pass']=null;}else{_0x43fe0e['Imap']['CloudProviderId']=_0x43fe0e[_0x5610('0x49')][_0x5610('0x4f')]=null;}_0x43fe0e[_0x5610('0x2e')]['service']=_0x43fe0e[_0x5610('0x49')][_0x5610('0x69')]=null;_0x43fe0e[_0x5610('0x2e')][_0x5610('0x6a')]=_0x43fe0e[_0x5610('0x49')]['host']=null;_0x43fe0e[_0x5610('0x2e')][_0x5610('0x6b')]=_0x43fe0e[_0x5610('0x49')][_0x5610('0x6b')]=null;}else{if(_0x210666[_0x5610('0x4d')][_0x5610('0x6c')]){_0x43fe0e[_0x5610('0x2e')][_0x5610('0x65')]=_0x43fe0e[_0x5610('0x49')][_0x5610('0x65')]=_0x210666['body']['username'];_0x43fe0e['Imap'][_0x5610('0x67')]=_0x43fe0e[_0x5610('0x49')][_0x5610('0x68')]=_0x210666[_0x5610('0x4d')][_0x5610('0x67')];}else{_0x43fe0e[_0x5610('0x2e')][_0x5610('0x6c')]=_0x43fe0e[_0x5610('0x49')][_0x5610('0x6c')]=![];_0x43fe0e[_0x5610('0x2e')][_0x5610('0x65')]=_0x43fe0e['Smtp'][_0x5610('0x65')]=null;_0x43fe0e[_0x5610('0x2e')]['password']=_0x43fe0e[_0x5610('0x49')]['pass']=null;}_0x43fe0e[_0x5610('0x2e')][_0x5610('0x6a')]=_0x210666[_0x5610('0x4d')]['Imap']['host'];_0x43fe0e[_0x5610('0x2e')][_0x5610('0x6b')]=_0x210666[_0x5610('0x4d')][_0x5610('0x2e')][_0x5610('0x6b')];_0x43fe0e['Smtp']['host']=_0x210666['body'][_0x5610('0x49')]['host'];_0x43fe0e[_0x5610('0x49')][_0x5610('0x6b')]=_0x210666[_0x5610('0x4d')][_0x5610('0x49')][_0x5610('0x6b')];}return db['MailAccount']['create'](_0x43fe0e,{'include':[{'model':db['MailServerOut'],'as':_0x5610('0x49')},{'model':db[_0x5610('0x2d')],'as':'Imap'}]})[_0x5610('0x11')](function(_0x2227dc){var _0x53182c=_0x210666[_0x5610('0x65')]['get']({'plain':!![]});if(!_0x53182c)throw new Error(_0x5610('0x6d'));if(_0x53182c[_0x5610('0x6e')]===_0x5610('0x65')){var _0x412fc5=_0x2227dc[_0x5610('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x5610('0x4c')]({'where':{'name':_0x5610('0x28'),'userProfileId':_0x53182c[_0x5610('0x6f')]},'raw':!![]})['then'](function(_0x1da2f6){if(_0x1da2f6&&_0x1da2f6[_0x5610('0x70')]===0x0){return db[_0x5610('0x29')][_0x5610('0x53')]({'name':_0x412fc5[_0x5610('0x2b')],'resourceId':_0x412fc5['id'],'type':_0x1da2f6[_0x5610('0x2b')],'sectionId':_0x1da2f6['id']},{})[_0x5610('0x11')](function(){return _0x2227dc;});}else{return _0x2227dc;}})[_0x5610('0x47')](function(_0x45f39f){logger[_0x5610('0x17')](_0x5610('0x71'),_0x45f39f);throw _0x45f39f;});}return _0x2227dc;})['then'](respondWithResult(_0x33201b,0xc9))['catch'](handleError(_0x33201b,null));};exports[_0x5610('0x72')]=function(_0x215f30,_0x29d09c){return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x215f30[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x29d09c,null))[_0x5610('0x11')](function(_0x3db971){if(_0x3db971){return _0x3db971['getImap']();}return null;})['then'](respondWithResult(_0x29d09c,null))[_0x5610('0x47')](handleError(_0x29d09c,null));};exports['addImap']=function(_0x1a3858,_0x43546c){if(_0x1a3858[_0x5610('0x4d')]['id']){delete _0x1a3858[_0x5610('0x4d')]['id'];}return db['MailAccount'][_0x5610('0x4c')]({'where':{'id':_0x1a3858[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x43546c,null))[_0x5610('0x11')](function(_0x23e3df){if(_0x23e3df){_0x1a3858['body'][_0x5610('0x51')]=_0x23e3df['id'];return db[_0x5610('0x2d')]['create'](_0x1a3858['body']);}})[_0x5610('0x11')](respondWithResult(_0x43546c,null))[_0x5610('0x47')](handleError(_0x43546c,null));};exports[_0x5610('0x73')]=function(_0x940923,_0xc4b444){return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x940923['params']['id']}})[_0x5610('0x11')](handleEntityNotFound(_0xc4b444,null))[_0x5610('0x11')](function(_0x3b74f5){if(_0x3b74f5){return _0x3b74f5[_0x5610('0x74')](null);}return null;})[_0x5610('0x11')](respondWithStatusCode(_0xc4b444,null))['catch'](handleError(_0xc4b444,null));};exports[_0x5610('0x75')]=function(_0x21920f,_0x3ffb64){return db['MailAccount'][_0x5610('0x55')]({'where':{'id':_0x21920f[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x3ffb64,null))[_0x5610('0x11')](function(_0x4dd54f){if(_0x4dd54f){return _0x4dd54f[_0x5610('0x75')]();}return null;})[_0x5610('0x11')](respondWithResult(_0x3ffb64,null))[_0x5610('0x47')](handleError(_0x3ffb64,null));};exports[_0x5610('0x76')]=function(_0x53292d,_0x48ea08){if(_0x53292d[_0x5610('0x4d')]['id']){delete _0x53292d[_0x5610('0x4d')]['id'];}return db[_0x5610('0x33')]['find']({'where':{'id':_0x53292d[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x48ea08,null))['then'](function(_0x403b77){if(_0x403b77){_0x53292d[_0x5610('0x4d')][_0x5610('0x51')]=_0x403b77['id'];return db[_0x5610('0x2f')][_0x5610('0x53')](_0x53292d[_0x5610('0x4d')]);}})[_0x5610('0x11')](respondWithResult(_0x48ea08,null))[_0x5610('0x47')](handleError(_0x48ea08,null));};exports[_0x5610('0x77')]=function(_0x5e4013,_0x240e4a){return db[_0x5610('0x33')]['findOne']({'where':{'id':_0x5e4013[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x240e4a,null))[_0x5610('0x11')](function(_0x3a4972){if(_0x3a4972){return _0x3a4972[_0x5610('0x78')](null);}return null;})[_0x5610('0x11')](respondWithStatusCode(_0x240e4a,null))['catch'](handleError(_0x240e4a,null));};exports['addInteraction']=function(_0xb9da89,_0x4dff89){return db[_0x5610('0x79')][_0x5610('0x4c')]({'where':{'id':_0xb9da89[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x4dff89,null))[_0x5610('0x11')](function(_0x254da9){if(_0x254da9){return _0x254da9[_0x5610('0x7a')](_0xb9da89[_0x5610('0x4d')][_0x5610('0x5a')],_[_0x5610('0x7b')](_0xb9da89[_0x5610('0x4d')],[_0x5610('0x5a'),'id'])||{});}})['then'](respondWithResult(_0x4dff89,null))[_0x5610('0x47')](handleError(_0x4dff89,null));};exports['getInteractions']=function(_0x524aa5,_0x24df85){var _0x20be93={'raw':![],'where':{}};var _0x33b793={};var _0x47bba2={'count':0x0,'rows':[]};return db['MailAccount'][_0x5610('0x55')]({'where':{'id':_0x524aa5[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x24df85,null))[_0x5610('0x11')](function(_0x2860b1){if(_0x2860b1){_0x33b793[_0x5610('0x36')]=_[_0x5610('0x38')](db[_0x5610('0x79')][_0x5610('0x56')]);_0x33b793['query']=_[_0x5610('0x38')](_0x524aa5[_0x5610('0x37')]);_0x33b793[_0x5610('0x39')]=_['intersection'](_0x33b793[_0x5610('0x36')],_0x33b793['query']);_0x20be93[_0x5610('0x3a')]=_[_0x5610('0x3b')](_0x33b793[_0x5610('0x36')],qs[_0x5610('0x4a')](_0x524aa5[_0x5610('0x37')][_0x5610('0x4a')]));_0x20be93[_0x5610('0x3a')]=_0x20be93[_0x5610('0x3a')][_0x5610('0x3c')]?_0x20be93[_0x5610('0x3a')]:_0x33b793[_0x5610('0x36')];if(!_0x524aa5[_0x5610('0x37')][_0x5610('0x3d')](_0x5610('0x3e'))){_0x20be93[_0x5610('0x21')]=qs[_0x5610('0x21')](_0x524aa5[_0x5610('0x37')][_0x5610('0x21')]);_0x20be93['offset']=qs['offset'](_0x524aa5[_0x5610('0x37')][_0x5610('0x20')]);}_0x20be93[_0x5610('0x57')]=qs[_0x5610('0x3f')](_0x524aa5[_0x5610('0x37')]['sort']);_0x20be93[_0x5610('0x40')]=qs[_0x5610('0x39')](_[_0x5610('0x41')](_0x524aa5['query'],_0x33b793['filters']));_0x20be93['where']['MailAccountId']=_0x2860b1['id'];if(_0x524aa5[_0x5610('0x37')][_0x5610('0x58')]){_0x20be93[_0x5610('0x40')]=_[_0x5610('0x42')](_0x20be93[_0x5610('0x40')],{'$or':_['map'](_0x20be93[_0x5610('0x3a')],function(_0x2c0fbd){var _0x4fe7f0={};_0x4fe7f0[_0x2c0fbd]={'$like':'%'+_0x524aa5[_0x5610('0x37')]['filter']+'%'};return _0x4fe7f0;})});}_0x20be93=_[_0x5610('0x42')]({},_0x20be93,_0x524aa5['options']);return db['MailInteraction'][_0x5610('0x23')]({'where':_0x20be93[_0x5610('0x40')]})[_0x5610('0x11')](function(_0xa52123){_0x47bba2[_0x5610('0x23')]=_0xa52123;if(_0x524aa5[_0x5610('0x37')][_0x5610('0x4b')]){_0x20be93['include']=[{'model':db['CmContact'],'as':_0x5610('0x7c'),'required':![]},{'model':db[_0x5610('0x7d')],'as':_0x5610('0x7e'),'attributes':['name','fullname',_0x5610('0x7f')],'required':![]},{'model':db[_0x5610('0x80')],'as':_0x5610('0x81'),'attributes':['id',_0x5610('0x2b'),_0x5610('0x82')],'where':_0x524aa5[_0x5610('0x37')][_0x5610('0x83')]?{'id':_0x524aa5[_0x5610('0x37')][_0x5610('0x83')]}:undefined,'required':_0x524aa5[_0x5610('0x37')][_0x5610('0x83')]?!![]:![]}];}return db['MailInteraction'][_0x5610('0x45')](_0x20be93);})[_0x5610('0x11')](function(_0x1c0935){_0x47bba2[_0x5610('0x46')]=_0x1c0935;return _0x47bba2;});}})['then'](respondWithFilteredResult(_0x24df85,_0x20be93))['catch'](handleError(_0x24df85,null));};exports[_0x5610('0x84')]=function addApplications(_0x1e34a9,_0x4d42e9){var _0x12568e=_0x1e34a9['params']['id'];var _0x1f51b6=_0x1e34a9[_0x5610('0x4d')];var _0xd8007a=0xc8;var _0xd253af=null;return db[_0x5610('0x85')][_0x5610('0x86')]({'isolationLevel':db['sequelize'][_0x5610('0x87')][_0x5610('0x88')][_0x5610('0x89')]},function(_0x261492){return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x12568e},'transaction':_0x261492})['then'](function(_0x7e508a){if(_0x7e508a){return db[_0x5610('0x8a')][_0x5610('0x26')]({'where':{'MailAccountId':_0x12568e},'transaction':_0x261492})[_0x5610('0x11')](function(){var _0x3178cf=_[_0x5610('0x32')](_0x1f51b6,function(_0x2938f9){_0x2938f9[_0x5610('0x51')]=_0x12568e;return _0x2938f9;});return db[_0x5610('0x8a')][_0x5610('0x8b')](_0x3178cf,{'transaction':_0x261492});});}else{_0xd8007a=0x194;_0xd253af=[];}});})[_0x5610('0x11')](function(){if(_0xd8007a!==0x194){return db[_0x5610('0x8a')][_0x5610('0x8c')]({'where':{'MailAccountId':_0x12568e},'order':_0x5610('0x8d')})[_0x5610('0x11')](function(_0x5cf3c6){_0xd253af=_0x5cf3c6;});}})[_0x5610('0x47')](function(_0x261406){_0xd8007a=0x1f4;logger['error'](_0x261406['stack']);if(_0x261406[_0x5610('0x2b')]){delete _0x261406[_0x5610('0x2b')];}_0xd253af=_0x261406;})[_0x5610('0x8e')](function(){if(_0xd253af===null){_0x4d42e9[_0x5610('0x1c')](_0xd8007a);}else{if(_0xd8007a===0x1f4){_0x4d42e9[_0x5610('0x1e')](_0xd8007a)[_0x5610('0x2c')](_0xd253af);}else{_0x4d42e9['status'](_0xd8007a)[_0x5610('0x1f')](_0xd253af);}}});};exports[_0x5610('0x8f')]=function(_0x4a70a9,_0x4c693e){var _0x891540={};var _0x337b32={};var _0x30dc12;var _0x43d0aa;return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x4a70a9[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x4c693e,null))['then'](function(_0x56d91b){if(_0x56d91b){_0x30dc12=_0x56d91b;_0x337b32[_0x5610('0x36')]=_[_0x5610('0x38')](db[_0x5610('0x8a')]['rawAttributes']);_0x337b32[_0x5610('0x37')]=_[_0x5610('0x38')](_0x4a70a9['query']);_0x337b32[_0x5610('0x39')]=_[_0x5610('0x3b')](_0x337b32[_0x5610('0x36')],_0x337b32[_0x5610('0x37')]);_0x891540[_0x5610('0x3a')]=_[_0x5610('0x3b')](_0x337b32[_0x5610('0x36')],qs[_0x5610('0x4a')](_0x4a70a9['query'][_0x5610('0x4a')]));_0x891540['attributes']=_0x891540['attributes']['length']?_0x891540[_0x5610('0x3a')]:_0x337b32[_0x5610('0x36')];_0x891540['order']=qs[_0x5610('0x3f')](_0x4a70a9[_0x5610('0x37')][_0x5610('0x3f')]);_0x891540[_0x5610('0x40')]=qs['filters'](_[_0x5610('0x41')](_0x4a70a9[_0x5610('0x37')],_0x337b32[_0x5610('0x39')]));if(_0x4a70a9['query']['filter']){_0x891540['where']=_[_0x5610('0x42')](_0x891540[_0x5610('0x40')],{'$or':_['map'](_0x891540['attributes'],function(_0x2b59fe){var _0x4da537={};_0x4da537[_0x2b59fe]={'$like':'%'+_0x4a70a9[_0x5610('0x37')][_0x5610('0x58')]+'%'};return _0x4da537;})});}_0x891540=_[_0x5610('0x42')]({},_0x891540,_0x4a70a9[_0x5610('0x43')]);return _0x30dc12[_0x5610('0x8f')](_0x891540);}})[_0x5610('0x11')](function(_0x4237c7){if(_0x4237c7){_0x43d0aa=_0x4237c7[_0x5610('0x3c')];if(!_0x4a70a9['query']['hasOwnProperty'](_0x5610('0x3e'))){_0x891540[_0x5610('0x21')]=qs[_0x5610('0x21')](_0x4a70a9[_0x5610('0x37')][_0x5610('0x21')]);_0x891540[_0x5610('0x20')]=qs[_0x5610('0x20')](_0x4a70a9[_0x5610('0x37')][_0x5610('0x20')]);}return _0x30dc12[_0x5610('0x8f')](_0x891540);}})['then'](function(_0x1b222a){if(_0x1b222a){return _0x1b222a?{'count':_0x43d0aa,'rows':_0x1b222a}:null;}})[_0x5610('0x11')](respondWithResult(_0x4c693e,null))['catch'](handleError(_0x4c693e,null));};exports['getMessages']=function(_0x13b855,_0x25b07c){var _0x14299c={'raw':!![],'where':{}};var _0x3a022b={};var _0x39e037={'count':0x0,'rows':[]};return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x13b855['params']['id']}})['then'](handleEntityNotFound(_0x25b07c,null))[_0x5610('0x11')](function(_0x1caaff){if(_0x1caaff){_0x3a022b[_0x5610('0x36')]=_[_0x5610('0x38')](db[_0x5610('0x90')][_0x5610('0x56')]);_0x3a022b[_0x5610('0x37')]=_['keys'](_0x13b855[_0x5610('0x37')]);_0x3a022b[_0x5610('0x39')]=_[_0x5610('0x3b')](_0x3a022b[_0x5610('0x36')],_0x3a022b[_0x5610('0x37')]);_0x14299c[_0x5610('0x3a')]=_[_0x5610('0x3b')](_0x3a022b[_0x5610('0x36')],qs['fields'](_0x13b855[_0x5610('0x37')][_0x5610('0x4a')]));_0x14299c[_0x5610('0x3a')]=_0x14299c[_0x5610('0x3a')][_0x5610('0x3c')]?_0x14299c[_0x5610('0x3a')]:_0x3a022b[_0x5610('0x36')];if(!_0x13b855['query']['hasOwnProperty'](_0x5610('0x3e'))){_0x14299c[_0x5610('0x21')]=qs['limit'](_0x13b855[_0x5610('0x37')][_0x5610('0x21')]);_0x14299c[_0x5610('0x20')]=qs[_0x5610('0x20')](_0x13b855['query'][_0x5610('0x20')]);}_0x14299c[_0x5610('0x57')]=qs[_0x5610('0x3f')](_0x13b855[_0x5610('0x37')][_0x5610('0x3f')]);_0x14299c[_0x5610('0x40')]=qs[_0x5610('0x39')](_[_0x5610('0x41')](_0x13b855[_0x5610('0x37')],_0x3a022b[_0x5610('0x39')]));_0x14299c['where'][_0x5610('0x51')]=_0x1caaff['id'];if(_0x13b855[_0x5610('0x37')][_0x5610('0x58')]){_0x14299c[_0x5610('0x40')]=_[_0x5610('0x42')](_0x14299c[_0x5610('0x40')],{'$or':_[_0x5610('0x32')](_0x14299c['attributes'],function(_0x2a4c78){var _0x309f85={};_0x309f85[_0x2a4c78]={'$like':'%'+_0x13b855[_0x5610('0x37')]['filter']+'%'};return _0x309f85;})});}if(_0x13b855[_0x5610('0x37')][_0x5610('0x91')]){var _0xcbe1a4=_0x13b855[_0x5610('0x37')][_0x5610('0x91')][_0x5610('0x92')](',');var _0x5d8eb0={};_0x5d8eb0[_0xcbe1a4[0x0]]={'$gte':moment(_0xcbe1a4[0x1])[_0x5610('0x93')](_0x5610('0x94'))};_0x14299c[_0x5610('0x40')]=_[_0x5610('0x42')](_0x14299c['where'],_0x5d8eb0);}_0x14299c=_[_0x5610('0x42')]({},_0x14299c,_0x13b855[_0x5610('0x43')]);return db[_0x5610('0x90')][_0x5610('0x23')]({'where':_0x14299c['where']})[_0x5610('0x11')](function(_0x22c31f){_0x39e037['count']=_0x22c31f;if(_0x13b855[_0x5610('0x37')][_0x5610('0x4b')]){_0x14299c[_0x5610('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0x5610('0x45')](_0x14299c);})[_0x5610('0x11')](function(_0x4e5c42){if(_0x13b855['query'][_0x5610('0x95')]===_0x5610('0x96')){for(var _0x4d26f2=0x0;_0x4d26f2<_0x4e5c42[_0x5610('0x3c')];_0x4d26f2++){_0x4e5c42[_0x4d26f2][_0x5610('0x4d')]=juice(_0x4e5c42[_0x4d26f2][_0x5610('0x4d')]);}}_0x39e037[_0x5610('0x46')]=_0x4e5c42;return _0x39e037;});}})['then'](respondWithFilteredResult(_0x25b07c,_0x14299c))[_0x5610('0x47')](handleError(_0x25b07c,null));};exports[_0x5610('0x2c')]=function(_0x49f84a,_0x1eef53){var _0x480b7d,_0x4d114b={},_0x274558;if(_0x49f84a[_0x5610('0x4d')]['to']){_0x274558=_0x49f84a[_0x5610('0x4d')]['to'][_0x5610('0x92')](',')[0x0];}return db['MailAccount'][_0x5610('0x4c')]({'where':{'id':_0x49f84a[_0x5610('0x48')]['id']},'include':[{'model':db[_0x5610('0x97')],'as':_0x5610('0x98'),'include':[{'model':db['CmContact'],'as':_0x5610('0x99'),'where':{'email':_0x274558},'limit':0x1,'order':[[_0x5610('0x9a'),_0x5610('0x9b')]]}]},{'model':db['MailServerOut'],'as':_0x5610('0x49'),'raw':!![]}]})[_0x5610('0x11')](handleEntityNotFound(_0x1eef53,null))['then'](function(_0x3fbe7d){if(_0x3fbe7d){_0x480b7d=_0x3fbe7d;if(_0x3fbe7d[_0x5610('0x49')]){if(_['isNil'](_0x49f84a['body'][_0x5610('0x9c')])){_0x49f84a['body'][_0x5610('0x9c')]=util[_0x5610('0x93')](_0x5610('0x9d'),_0x3fbe7d[_0x5610('0x2b')],_0x3fbe7d[_0x5610('0x61')]||_0x3fbe7d[_0x5610('0x49')][_0x5610('0x65')]);}if(_0x49f84a[_0x5610('0x4d')][_0x5610('0x9e')]&&_0x49f84a['body']['attachments']['length']){for(var _0x3b2a50=0x0;_0x3b2a50<_0x49f84a[_0x5610('0x4d')][_0x5610('0x9e')][_0x5610('0x3c')];_0x3b2a50+=0x1){_0x49f84a['body'][_0x5610('0x9e')][_0x3b2a50]={'filename':_0x49f84a[_0x5610('0x4d')][_0x5610('0x9e')][_0x3b2a50][_0x5610('0x2b')],'path':path[_0x5610('0x9f')](config[_0x5610('0xa0')],_0x5610('0xa1'),_0x49f84a[_0x5610('0x4d')]['attachments'][_0x3b2a50]['basename'])};}}var _0x5a1380={'tls':{'rejectUnauthorized':![]}};if(_[_0x5610('0x62')](_0x3fbe7d['Smtp']['service'])){if(_0x3fbe7d[_0x5610('0x49')][_0x5610('0x6c')]){_0x5a1380[_0x5610('0xa2')]={'user':_0x3fbe7d[_0x5610('0x49')][_0x5610('0x65')],'pass':_0x3fbe7d[_0x5610('0x49')][_0x5610('0x68')]};}_0x5a1380[_0x5610('0x6a')]=_0x3fbe7d[_0x5610('0x49')][_0x5610('0x6a')];_0x5a1380[_0x5610('0x6b')]=_0x3fbe7d[_0x5610('0x49')]['port'];_0x5a1380[_0x5610('0xa3')]=_0x3fbe7d[_0x5610('0x49')][_0x5610('0xa3')];}else{_0x5a1380[_0x5610('0x69')]=_0x3fbe7d[_0x5610('0x49')][_0x5610('0x69')];_0x5a1380[_0x5610('0xa2')]={'user':_0x3fbe7d[_0x5610('0x49')][_0x5610('0x65')],'pass':_0x3fbe7d[_0x5610('0x49')][_0x5610('0x68')]};}return respondWithRpcPromise(_0x5610('0xa4'),_0x5610('0xa5'),{'account':_0x5a1380,'message':_0x49f84a[_0x5610('0x4d')]});}else{throw new Error('List\x20not\x20found');}}})[_0x5610('0x11')](function(_0x235c3b){if(_0x235c3b){_0x4d114b=_0x235c3b;if(_0x480b7d[_0x5610('0x98')]){if(_0x480b7d[_0x5610('0x98')][_0x5610('0x99')][_0x5610('0x3c')]){return _0x480b7d[_0x5610('0x98')]['Contacts'][0x0];}else{return db[_0x5610('0xa6')]['create'](_[_0x5610('0xa')](_0x49f84a[_0x5610('0x4d')],{'firstName':_0x49f84a['body']['to'],'email':_0x49f84a[_0x5610('0x4d')]['to'],'phone':_0x49f84a[_0x5610('0x4d')]['to'],'ListId':_0x480b7d['ListId']}));}}else{throw new Error(_0x5610('0xa7'));}}})[_0x5610('0x11')](function(_0x33ac86){if(_0x33ac86){var _0xff1690={'UserId':_0x49f84a['user']['id'],'ContactId':_0x33ac86['id'],'MailAccountId':_0x480b7d['id'],'inReplyTo':_0x4d114b['messageId'],'to':_0x49f84a[_0x5610('0x4d')]['from'],'cc':_0x49f84a[_0x5610('0x4d')]['cc'],'subject':_0x49f84a['body']['subject'],'attach':_0x49f84a[_0x5610('0x4d')][_0x5610('0xa8')],'firstMsgDirection':_0x5610('0xa9'),'lastMsgAt':moment()[_0x5610('0x93')](_0x5610('0x94')),'lastMsgDirection':_0x5610('0xa9'),'Messages':[_[_0x5610('0x42')](_0x49f84a[_0x5610('0x4d')],{'messageId':_0x4d114b[_0x5610('0xaa')],'sentAt':moment()[_0x5610('0x93')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x480b7d['id'],'UserId':_0x49f84a[_0x5610('0x65')]['id'],'ContactId':_0x33ac86['id']})]};if(_0x49f84a[_0x5610('0x4d')]['Interaction']){_0xff1690=_[_0x5610('0x42')](_0xff1690,_0x49f84a[_0x5610('0x4d')]['Interaction']);}return db['MailInteraction'][_0x5610('0x53')](_0xff1690,{'include':[{'model':db[_0x5610('0x90')],'as':_0x5610('0xab')}]});}})['then'](respondWithResult(_0x1eef53,null))[_0x5610('0x47')](handleError(_0x1eef53,null));};exports[_0x5610('0xac')]=function(_0x3f6130,_0x353152){return db[_0x5610('0x33')][_0x5610('0x4c')]({'where':{'id':_0x3f6130[_0x5610('0x48')]['id']},'include':[{'model':db[_0x5610('0x2f')],'as':_0x5610('0x49'),'raw':!![],'include':[{'model':db[_0x5610('0xad')],'as':_0x5610('0xad'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x353152,null))[_0x5610('0x11')](function(_0x499dea){if(!_0x499dea['Smtp'])return;var _0x1f2a30={'id':_0x499dea['id'],'tls':{'rejectUnauthorized':![]}};if(_0x499dea[_0x5610('0x5f')]!==_0x5610('0x60')){_0x1f2a30['service']=_0x499dea[_0x5610('0x5f')];}else{_0x1f2a30[_0x5610('0x6a')]=_0x499dea[_0x5610('0x49')]['host'];_0x1f2a30[_0x5610('0x6b')]=_0x499dea[_0x5610('0x49')][_0x5610('0x6b')];_0x1f2a30[_0x5610('0xa3')]=_0x499dea[_0x5610('0x49')][_0x5610('0xa3')];}if(_0x499dea['Smtp'][_0x5610('0x6c')]){if(_0x499dea[_0x5610('0x49')][_0x5610('0x4e')]){_0x1f2a30[_0x5610('0xa2')]={'type':'OAuth2','user':_0x499dea[_0x5610('0x49')][_0x5610('0x65')],'accessToken':_0x499dea[_0x5610('0x49')][_0x5610('0xad')]['data5']};}else{_0x1f2a30[_0x5610('0xa2')]={'user':_0x499dea[_0x5610('0x49')][_0x5610('0x65')],'pass':_0x499dea['Smtp'][_0x5610('0x68')]};}}return respondWithRpcPromise('VerifySmtp',_0x5610('0xac'),{'account':_0x1f2a30});})['then'](respondWithResult(_0x353152,null))['catch'](handleError(_0x353152,null));};exports[_0x5610('0x26')]=function(_0x4bba49,_0x32b125){return db[_0x5610('0x33')]['find']({'where':{'id':_0x4bba49['params']['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x32b125,null))[_0x5610('0x11')](function(_0x4e5eea){if(_0x4e5eea&&_0x4e5eea[_0x5610('0x69')]){throw new db[(_0x5610('0xae'))][(_0x5610('0xaf'))](_0x5610('0xb0'));}return _0x4e5eea;})[_0x5610('0x11')](removeEntity(_0x32b125,null))['catch'](handleError(_0x32b125,null));};exports[_0x5610('0xb1')]=function(_0x9d15c9,_0x280174){return db[_0x5610('0x33')]['find']({'where':{'id':_0x9d15c9[_0x5610('0x48')]['id']}})['then'](handleEntityNotFound(_0x280174,null))[_0x5610('0x11')](function(_0x3621cd){if(_0x3621cd){return _0x3621cd[_0x5610('0xb1')](_0x9d15c9['body'][_0x5610('0x5a')],_[_0x5610('0x7b')](_0x9d15c9['body'],[_0x5610('0x5a'),'id'])||{})['spread'](function(_0x1ca9a5){for(var _0x8b1447=0x0;_0x8b1447<_0x9d15c9['body']['ids'][_0x5610('0x3c')];_0x8b1447+=0x1){socket[_0x5610('0xb2')](_0x5610('0xb3'),{'UserId':Number(_0x9d15c9[_0x5610('0x4d')][_0x5610('0x5a')][_0x8b1447]),'MailAccountId':Number(_0x9d15c9[_0x5610('0x48')]['id'])});}return _0x1ca9a5;});}})[_0x5610('0x11')](respondWithResult(_0x280174,null))['catch'](handleError(_0x280174,null));};exports[_0x5610('0xb4')]=function(_0x2910e5,_0x5c20f4){return db[_0x5610('0x33')]['find']({'where':{'id':_0x2910e5['params']['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x5c20f4,null))[_0x5610('0x11')](function(_0x3052ba){if(_0x3052ba){return _0x3052ba[_0x5610('0xb4')](_0x2910e5['query'][_0x5610('0x5a')])['then'](function(){if(_[_0x5610('0xb5')](_0x2910e5[_0x5610('0x37')][_0x5610('0x5a')])){for(var _0x402350=0x0;_0x402350<_0x2910e5[_0x5610('0x37')][_0x5610('0x5a')][_0x5610('0x3c')];_0x402350+=0x1){socket['emit'](_0x5610('0xb6'),{'UserId':Number(_0x2910e5[_0x5610('0x37')][_0x5610('0x5a')][_0x402350]),'MailAccountId':Number(_0x2910e5['params']['id'])});}}else{socket['emit'](_0x5610('0xb6'),{'UserId':Number(_0x2910e5[_0x5610('0x37')]['ids']),'MailAccountId':Number(_0x2910e5[_0x5610('0x48')]['id'])});}});}})[_0x5610('0x11')](respondWithStatusCode(_0x5c20f4,null))['catch'](handleError(_0x5c20f4,null));};exports['getAgents']=function(_0x42c23f,_0x37e985){var _0x2ed8c4={};var _0x4c4db1={};var _0x4772ac;var _0x59c149;return db[_0x5610('0x33')][_0x5610('0x55')]({'where':{'id':_0x42c23f[_0x5610('0x48')]['id']}})[_0x5610('0x11')](handleEntityNotFound(_0x37e985,null))['then'](function(_0x4fe4ff){if(_0x4fe4ff){_0x4772ac=_0x4fe4ff;_0x4c4db1[_0x5610('0x36')]=_[_0x5610('0x38')](db[_0x5610('0x7d')]['rawAttributes']);_0x4c4db1['query']=_[_0x5610('0x38')](_0x42c23f[_0x5610('0x37')]);_0x4c4db1[_0x5610('0x39')]=_[_0x5610('0x3b')](_0x4c4db1[_0x5610('0x36')],_0x4c4db1[_0x5610('0x37')]);_0x2ed8c4['attributes']=_[_0x5610('0x3b')](_0x4c4db1[_0x5610('0x36')],qs[_0x5610('0x4a')](_0x42c23f[_0x5610('0x37')][_0x5610('0x4a')]));_0x2ed8c4['attributes']=_0x2ed8c4[_0x5610('0x3a')]['length']?_0x2ed8c4[_0x5610('0x3a')]:_0x4c4db1[_0x5610('0x36')];_0x2ed8c4[_0x5610('0x57')]=qs[_0x5610('0x3f')](_0x42c23f[_0x5610('0x37')]['sort']);_0x2ed8c4[_0x5610('0x40')]=qs[_0x5610('0x39')](_[_0x5610('0x41')](_0x42c23f['query'],_0x4c4db1[_0x5610('0x39')]));if(_0x42c23f[_0x5610('0x37')]['filter']){_0x2ed8c4[_0x5610('0x40')]=_[_0x5610('0x42')](_0x2ed8c4[_0x5610('0x40')],{'$or':_['map'](_0x2ed8c4[_0x5610('0x3a')],function(_0xa28c7e){var _0x58644b={};_0x58644b[_0xa28c7e]={'$like':'%'+_0x42c23f[_0x5610('0x37')][_0x5610('0x58')]+'%'};return _0x58644b;})});}_0x2ed8c4=_[_0x5610('0x42')]({},_0x2ed8c4,_0x42c23f[_0x5610('0x43')]);return _0x4772ac[_0x5610('0xb7')](_0x2ed8c4);}})['then'](function(_0x1cc80c){if(_0x1cc80c){_0x59c149=_0x1cc80c[_0x5610('0x3c')];if(!_0x42c23f['query'][_0x5610('0x3d')]('nolimit')){_0x2ed8c4[_0x5610('0x21')]=qs[_0x5610('0x21')](_0x42c23f['query'][_0x5610('0x21')]);_0x2ed8c4['offset']=qs[_0x5610('0x20')](_0x42c23f[_0x5610('0x37')]['offset']);}return _0x4772ac[_0x5610('0xb7')](_0x2ed8c4);}})[_0x5610('0x11')](function(_0x38371e){if(_0x38371e){return _0x38371e?{'count':_0x59c149,'rows':_0x38371e}:null;}})[_0x5610('0x11')](respondWithResult(_0x37e985,null))[_0x5610('0x47')](handleError(_0x37e985,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ab36c53..e2ae7d0 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 _0x59f2=['update','remove','emit','hook','exports','setMaxListeners'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x59f2,0xb3));var _0x259f=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x59f2[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x259f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x259f('0x1'),'afterDestroy':_0x259f('0x2')};function emitEvent(_0x4334a3){return function(_0xad60c2,_0x587d71,_0x3a5a8b){MailAccountEvents[_0x259f('0x3')](_0x4334a3+':'+_0xad60c2['id'],_0xad60c2);MailAccountEvents['emit'](_0x4334a3,_0xad60c2);_0x3a5a8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x259f('0x4')](e,emitEvent(event));}}module[_0x259f('0x5')]=MailAccountEvents; \ No newline at end of file +var _0xbf07=['hook','exports','events','MailAccount','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x51e8d0,_0x1fe6cf){var _0x451174=function(_0x241802){while(--_0x241802){_0x51e8d0['push'](_0x51e8d0['shift']());}};_0x451174(++_0x1fe6cf);}(_0xbf07,0x17a));var _0x7bf0=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xbf07[_0x26fc81];return _0x9feece;};'use strict';var EventEmitter=require(_0x7bf0('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x7bf0('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7bf0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bf0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44f677){return function(_0x57f19e,_0x21f58c,_0x1c7d51){MailAccountEvents[_0x7bf0('0x4')](_0x44f677+':'+_0x57f19e['id'],_0x57f19e);MailAccountEvents['emit'](_0x44f677,_0x57f19e);_0x1c7d51(null);};}for(var e in events){if(events[_0x7bf0('0x5')](e)){var event=events[e];MailAccount[_0x7bf0('0x6')](e,emitEvent(event));}}module[_0x7bf0('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4b78617..855c515 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 _0xeb9b=['exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x335eff,_0x22d79c){var _0x2d608c=function(_0x20b494){while(--_0x20b494){_0x335eff['push'](_0x335eff['shift']());}};_0x2d608c(++_0x22d79c);}(_0xeb9b,0x145));var _0xbeb9=function(_0x24a15e,_0x4862ce){_0x24a15e=_0x24a15e-0x0;var _0x10256f=_0xeb9b[_0x24a15e];return _0x10256f;};'use strict';var _=require(_0xbeb9('0x0'));var util=require(_0xbeb9('0x1'));var logger=require(_0xbeb9('0x2'))(_0xbeb9('0x3'));var moment=require(_0xbeb9('0x4'));var BPromise=require(_0xbeb9('0x5'));var rp=require(_0xbeb9('0x6'));var fs=require('fs');var path=require(_0xbeb9('0x7'));var rimraf=require(_0xbeb9('0x8'));var config=require(_0xbeb9('0x9'));var attributes=require(_0xbeb9('0xa'));module[_0xbeb9('0xb')]=function(_0x5761f8,_0x141338){return _0x5761f8['define'](_0xbeb9('0xc'),attributes,{'tableName':_0xbeb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb785=['MailAccount','mail_accounts','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1e5111,_0x3d0a12){var _0x2a6bb9=function(_0x3adf85){while(--_0x3adf85){_0x1e5111['push'](_0x1e5111['shift']());}};_0x2a6bb9(++_0x3d0a12);}(_0xb785,0x1ba));var _0x5b78=function(_0x382883,_0x3b3326){_0x382883=_0x382883-0x0;var _0x56a70c=_0xb785[_0x382883];return _0x56a70c;};'use strict';var _=require(_0x5b78('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b78('0x1'));var BPromise=require(_0x5b78('0x2'));var rp=require(_0x5b78('0x3'));var fs=require('fs');var path=require(_0x5b78('0x4'));var rimraf=require(_0x5b78('0x5'));var config=require(_0x5b78('0x6'));var attributes=require('./mailAccount.attributes');module[_0x5b78('0x7')]=function(_0x9cb374,_0x133403){return _0x9cb374['define'](_0x5b78('0x8'),attributes,{'tableName':_0x5b78('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 eb38eba..823411f 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 _0x2181=['generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','spread','update','format','get','interaction','created','attachments','originTo','originCc','bcc','ChatOfflineMessageId','Attachment','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','request\x20sent','stringify','error','message','MailAccount,\x20%s,\x20%s','info','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','account','omit','applications','list','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x2181,0x80));var _0x1218=function(_0x4410df,_0x4cac68){_0x4410df=_0x4410df-0x0;var _0x5cfbcc=_0x2181[_0x4410df];return _0x5cfbcc;};'use strict';var _=require(_0x1218('0x0'));var util=require(_0x1218('0x1'));var moment=require(_0x1218('0x2'));var BPromise=require(_0x1218('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1218('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1218('0x5'))(_0x1218('0x6'));var config=require('../../config/environment');var jayson=require(_0x1218('0x7'));var client=jayson[_0x1218('0x8')][_0x1218('0x9')]({'port':0x232c});config[_0x1218('0xa')]=_[_0x1218('0xb')](config[_0x1218('0xa')],{'host':_0x1218('0xc'),'port':0x18eb});var socket=require(_0x1218('0xd'))(new Redis(config[_0x1218('0xa')]));require(_0x1218('0xe'))['register'](socket);function respondWithRpcPromise(_0x2da3e6,_0x1cb29b,_0x275994){return new BPromise(function(_0x48fdf7,_0x72dc1a){return client[_0x1218('0xf')](_0x2da3e6,_0x275994)[_0x1218('0x10')](function(_0x52bc99){logger['info']('MailAccount,\x20%s,\x20%s',_0x1cb29b,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1cb29b,_0x1218('0x11'),JSON[_0x1218('0x12')](_0x52bc99));if(_0x52bc99[_0x1218('0x13')]){if(_0x52bc99[_0x1218('0x13')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1cb29b,_0x52bc99['error'][_0x1218('0x14')]);return _0x72dc1a(_0x52bc99[_0x1218('0x13')][_0x1218('0x14')]);}logger[_0x1218('0x13')](_0x1218('0x15'),_0x1cb29b,_0x52bc99['error'][_0x1218('0x14')]);return _0x48fdf7(_0x52bc99['error'][_0x1218('0x14')]);}else{logger[_0x1218('0x16')](_0x1218('0x15'),_0x1cb29b,_0x1218('0x11'));_0x48fdf7(_0x52bc99[_0x1218('0x17')][_0x1218('0x14')]);}})[_0x1218('0x18')](function(_0x3b670c){logger[_0x1218('0x13')](_0x1218('0x15'),_0x1cb29b,_0x3b670c);_0x72dc1a(_0x3b670c);});});}exports[_0x1218('0x19')]=function(_0x3a2a80){var _0x145375=this;return new Promise(function(_0x502913,_0x37192e){return db['MailAccount'][_0x1218('0x1a')]({'raw':_0x3a2a80['options']?_0x3a2a80['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80[_0x1218('0x1b')][_0x1218('0x1c')]||null:null,'attributes':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80[_0x1218('0x1b')][_0x1218('0x1d')]||null:null,'limit':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80['options'][_0x1218('0x1e')]||null:null,'include':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80['options'][_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3a2a80['options'][_0x1218('0x1f')],function(_0x19da0b){return{'model':db[_0x19da0b[_0x1218('0x21')]],'as':_0x19da0b['as'],'attributes':_0x19da0b[_0x1218('0x1d')],'include':_0x19da0b['include']?_['map'](_0x19da0b[_0x1218('0x1f')],function(_0x3767f6){return{'model':db[_0x3767f6[_0x1218('0x21')]],'as':_0x3767f6['as'],'attributes':_0x3767f6['attributes'],'include':_0x3767f6[_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3767f6[_0x1218('0x1f')],function(_0x4a0151){return{'model':db[_0x4a0151[_0x1218('0x21')]],'as':_0x4a0151['as'],'attributes':_0x4a0151[_0x1218('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231b11){logger[_0x1218('0x16')](_0x1218('0x19'),_0x3a2a80);logger[_0x1218('0x22')]('GetMailAccount',_0x3a2a80,JSON[_0x1218('0x12')](_0x231b11));_0x502913(_0x231b11);})['catch'](function(_0x2872fe){logger[_0x1218('0x13')](_0x1218('0x19'),_0x2872fe[_0x1218('0x14')],_0x3a2a80);_0x37192e(_0x145375[_0x1218('0x13')](0x1f4,_0x2872fe[_0x1218('0x14')]));});});};exports[_0x1218('0x23')]=function(_0x3170f1){var _0x436e75=this;return new Promise(function(_0xaa5c58,_0x273594){return db[_0x1218('0x24')][_0x1218('0x25')]({'raw':_0x3170f1[_0x1218('0x1b')]?_0x3170f1[_0x1218('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3170f1[_0x1218('0x1b')]?_0x3170f1['options'][_0x1218('0x1c')]||null:null,'attributes':_0x3170f1['options']?_0x3170f1['options']['attributes']||null:null,'include':_0x3170f1['options']?_0x3170f1['options'][_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3170f1[_0x1218('0x1b')][_0x1218('0x1f')],function(_0x29304e){return{'model':db[_0x29304e[_0x1218('0x21')]],'as':_0x29304e['as'],'attributes':_0x29304e[_0x1218('0x1d')],'include':_0x29304e['include']?_[_0x1218('0x20')](_0x29304e[_0x1218('0x1f')],function(_0x50e6cc){return{'model':db[_0x50e6cc[_0x1218('0x21')]],'as':_0x50e6cc['as'],'attributes':_0x50e6cc[_0x1218('0x1d')],'include':_0x50e6cc[_0x1218('0x1f')]?_[_0x1218('0x20')](_0x50e6cc[_0x1218('0x1f')],function(_0x136c96){return{'model':db[_0x136c96[_0x1218('0x21')]],'as':_0x136c96['as'],'attributes':_0x136c96[_0x1218('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1218('0x10')](function(_0x3adf18){logger[_0x1218('0x16')](_0x1218('0x23'),_0x3170f1);logger['debug']('ShowMailAccount',_0x3170f1,JSON['stringify'](_0x3adf18));_0xaa5c58(_0x3adf18);})[_0x1218('0x18')](function(_0xe01e05){logger['error'](_0x1218('0x23'),_0xe01e05[_0x1218('0x14')],_0x3170f1);_0x273594(_0x436e75['error'](0x1f4,_0xe01e05[_0x1218('0x14')]));});});};exports[_0x1218('0x26')]=function(_0x3eba8f){var _0x3eace6=this;return new Promise(function(_0x22e3c4,_0x1c296b){var _0x112868={'body':_0x3eba8f[_0x1218('0x27')],'channel':_0x1218('0x28')};var _0x4b87b2=_[_0x1218('0x29')](_['keys'](db[_0x1218('0x2a')][_0x1218('0x2b')]),[_0x1218('0x2c'),'updatedAt',_0x1218('0x2d'),'ListId']);var _0x2956e2=![];if(_0x3eba8f[_0x1218('0x27')]['id']){delete _0x3eba8f[_0x1218('0x27')]['id'];}if(_[_0x1218('0x2e')](_0x3eba8f['body'][_0x1218('0x2f')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x30')));}if(_[_0x1218('0x2e')](_0x3eba8f[_0x1218('0x27')][_0x1218('0x27')])||_0x3eba8f[_0x1218('0x27')]['body']===''){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x31')));}if(_[_0x1218('0x2e')](_0x3eba8f[_0x1218('0x27')][_0x1218('0x32')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b87b2));}if(!_[_0x1218('0x33')](_0x4b87b2,_0x3eba8f[_0x1218('0x27')][_0x1218('0x32')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x34')+_0x4b87b2));}var _0x57f987={};_0x57f987[_0x3eba8f['body'][_0x1218('0x32')]]=_0x3eba8f['body'][_0x1218('0x2f')];return db[_0x1218('0x24')][_0x1218('0x25')]({'where':{'id':_0x3eba8f['account']['id']},'include':[{'model':db[_0x1218('0x35')],'as':_0x1218('0x36'),'include':[{'model':db[_0x1218('0x2a')],'as':_0x1218('0x37'),'where':_0x57f987,'limit':0x1,'order':[[_0x1218('0x38'),_0x1218('0x39')]]}]},{'model':db[_0x1218('0x3a')],'as':_0x1218('0x3b')},{'model':db[_0x1218('0x3c')],'as':'Smtp'}]})[_0x1218('0x10')](function(_0x3db2bf){if(_0x3db2bf&&_0x3db2bf[_0x1218('0x36')]){var _0x377e91=_0x3db2bf['get']({'plain':!![]});_0x112868[_0x1218('0x3d')]=_[_0x1218('0x3e')](_0x377e91,['Applications',_0x1218('0x36')]);_0x112868[_0x1218('0x3f')]=_0x377e91[_0x1218('0x3b')];_0x112868[_0x1218('0x40')]=_0x377e91[_0x1218('0x36')];_0x112868[_0x1218('0x3f')]=_[_0x1218('0x41')](_0x112868[_0x1218('0x3f')],['priority'],[_0x1218('0x42')]);if(_0x112868[_0x1218('0x3d')]&&_0x112868[_0x1218('0x3d')][_0x1218('0x43')]){_0x112868['applications'][_0x1218('0x44')]({'id':0x0,'priority':_0x112868[_0x1218('0x3f')][_0x1218('0x45')]+0x1,'app':_0x1218('0x46'),'appdata':_0x1218('0x43'),'interval':_0x1218('0x47')});}if(_0x112868[_0x1218('0x3d')][_0x1218('0x3b')]){delete _0x112868[_0x1218('0x3d')][_0x1218('0x3b')];}if(_0x112868[_0x1218('0x3d')][_0x1218('0x36')]){delete _0x112868['account'][_0x1218('0x36')];}if(_0x377e91[_0x1218('0x36')]['Contacts'][_0x1218('0x45')]){return _0x377e91[_0x1218('0x36')][_0x1218('0x37')][0x0];}var _0x127bb7=_['defaults'](_0x3eba8f[_0x1218('0x27')],{'firstName':_0x3eba8f[_0x1218('0x27')][_0x1218('0x2f')],'ListId':_0x377e91['ListId']});_0x127bb7[_0x3eba8f['body'][_0x1218('0x32')]]=_0x3eba8f[_0x1218('0x27')][_0x1218('0x2f')];return db[_0x1218('0x2a')][_0x1218('0x48')](_0x127bb7);}else{throw new Error(_0x1218('0x49'));}})[_0x1218('0x10')](function(_0x2a4d1a){_0x112868[_0x1218('0x4a')]=_0x2a4d1a;if(_0x2a4d1a){if(!_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4b')]){_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['messageId']=rs[_0x1218('0x4c')]()+'\x20'+_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x2f')];}var _0x38ef33={'ContactId':_0x2a4d1a['id'],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id'],'inReplyTo':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4b')],'to':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x2f')],'cc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['cc'],'subject':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4e')],'lastMsgAt':moment()['format'](_0x1218('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1218('0x25')]({'where':{'closed':![],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id']},'include':[{'model':db[_0x1218('0x50')],'as':_0x1218('0x51'),'attributes':['messageId'],'where':{'messageId':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x52')]}}]})[_0x1218('0x10')](function(_0x530736){if(_0x530736){return[_0x530736,![]];}return db['MailInteraction'][_0x1218('0x48')](_0x38ef33)[_0x1218('0x10')](function(_0xc78dbc){return[_0xc78dbc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1218('0x53')](function(_0xa02ad8,_0x2663ae){if(_0xa02ad8){_0x2956e2=_0x2663ae;if(!_0x2663ae){return _0xa02ad8[_0x1218('0x54')]({'inReplyTo':_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4b')],'to':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x2f')],'cc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['cc'],'subject':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0xa02ad8[_0x1218('0x4e')]?_0xa02ad8['attach']:_0x3eba8f[_0x1218('0x27')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x1218('0x55')](_0x1218('0x4f')),'lastMsgAt':moment()[_0x1218('0x55')](_0x1218('0x4f')),'lastMsgDirection':'in'});}else{return _0xa02ad8;}}})[_0x1218('0x10')](function(_0x532885){_0x112868['interaction']=_0x532885[_0x1218('0x56')]({'plain':!![]});_0x112868[_0x1218('0x57')][_0x1218('0x58')]=_0x2956e2;return db[_0x1218('0x50')][_0x1218('0x48')]({'body':_0x3eba8f[_0x1218('0x27')][_0x1218('0x27')],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id'],'MailInteractionId':_0x532885['id'],'direction':'in','ContactId':_0x112868[_0x1218('0x4a')]['id'],'messageId':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4b')],'from':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x2f')],'to':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['to'],'cc':_0x3eba8f['body'][_0x1218('0x14')]['cc'],'subject':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4e')],'Attachments':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x59')],'originTo':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5a')],'originCc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5b')],'bcc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5c')],'ChatWebsiteId':_0x3eba8f['body'][_0x1218('0x14')]['ChatWebsiteId']||null,'originChannel':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['originChannel']||'Email','ChatOfflineMessageId':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x5d')]||null},{'include':[{'model':db[_0x1218('0x5e')],'as':'Attachments'}]});})[_0x1218('0x10')](function(_0xb7c118){_0x112868['message']=_0xb7c118;if(_0x112868['interaction'][_0x1218('0x5f')]){return db[_0x1218('0x60')]['find']({'attributes':['id',_0x1218('0x61')],'where':{'id':_0x112868['interaction']['UserId']}})[_0x1218('0x10')](function(_0xcfe1b1){if(_0xcfe1b1){_0x112868[_0x1218('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1218('0x62'),'appdata':_0xcfe1b1[_0x1218('0x61')]+','+(_0x112868[_0x1218('0x3d')][_0x1218('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1218('0x64'),_0x1218('0x65'),_0x112868);});}return respondWithRpcPromise('Start','startRouting',_0x112868);})[_0x1218('0x10')](function(_0x38c311){_0x22e3c4(_0x38c311);})[_0x1218('0x18')](function(_0xad3685){_0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0xad3685[_0x1218('0x14')]));});});}; \ No newline at end of file +var _0x0a29=['rawAttributes','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','Applications','MailServerOut','Smtp','List','get','omit','applications','list','orderBy','priority','asc','autoclose','close','*,*,*,*','length','create','List\x20not\x20found','messageId','subject','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','format','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','debug','mail','keys','CmContact'];(function(_0xd720d0,_0x2e05e6){var _0x7a2a44=function(_0x5c3d8b){while(--_0x5c3d8b){_0xd720d0['push'](_0xd720d0['shift']());}};_0x7a2a44(++_0x2e05e6);}(_0x0a29,0x1ce));var _0x90a2=function(_0xdb3239,_0x40b209){_0xdb3239=_0xdb3239-0x0;var _0x402a23=_0x0a29[_0xdb3239];return _0x402a23;};'use strict';var _=require(_0x90a2('0x0'));var util=require(_0x90a2('0x1'));var moment=require(_0x90a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90a2('0x3'));var db=require(_0x90a2('0x4'))['db'];var utils=require(_0x90a2('0x5'));var logger=require(_0x90a2('0x6'))('rpc');var config=require(_0x90a2('0x7'));var jayson=require(_0x90a2('0x8'));var client=jayson['client'][_0x90a2('0x9')]({'port':0x232c});config[_0x90a2('0xa')]=_[_0x90a2('0xb')](config[_0x90a2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x90a2('0xc'))(new Redis(config[_0x90a2('0xa')]));require(_0x90a2('0xd'))[_0x90a2('0xe')](socket);function respondWithRpcPromise(_0x496b5f,_0x2c232b,_0x5d990e){return new BPromise(function(_0x50efdb,_0x367602){return client[_0x90a2('0xf')](_0x496b5f,_0x5d990e)[_0x90a2('0x10')](function(_0x2a654c){logger[_0x90a2('0x11')]('MailAccount,\x20%s,\x20%s',_0x2c232b,_0x90a2('0x12'));logger['debug'](_0x90a2('0x13'),_0x2c232b,_0x90a2('0x12'),JSON[_0x90a2('0x14')](_0x2a654c));if(_0x2a654c[_0x90a2('0x15')]){if(_0x2a654c[_0x90a2('0x15')][_0x90a2('0x16')]===0x1f4){logger[_0x90a2('0x15')](_0x90a2('0x17'),_0x2c232b,_0x2a654c[_0x90a2('0x15')]['message']);return _0x367602(_0x2a654c[_0x90a2('0x15')][_0x90a2('0x18')]);}logger[_0x90a2('0x15')](_0x90a2('0x17'),_0x2c232b,_0x2a654c[_0x90a2('0x15')][_0x90a2('0x18')]);return _0x50efdb(_0x2a654c[_0x90a2('0x15')][_0x90a2('0x18')]);}else{logger['info'](_0x90a2('0x17'),_0x2c232b,_0x90a2('0x12'));_0x50efdb(_0x2a654c['result'][_0x90a2('0x18')]);}})[_0x90a2('0x19')](function(_0x2c016a){logger[_0x90a2('0x15')](_0x90a2('0x17'),_0x2c232b,_0x2c016a);_0x367602(_0x2c016a);});});}exports['GetMailAccount']=function(_0x5c3016){var _0x2af3a4=this;return new Promise(function(_0x15b247,_0x242c1f){return db[_0x90a2('0x1a')][_0x90a2('0x1b')]({'raw':_0x5c3016[_0x90a2('0x1c')]?_0x5c3016[_0x90a2('0x1c')][_0x90a2('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c3016[_0x90a2('0x1c')]?_0x5c3016[_0x90a2('0x1c')][_0x90a2('0x1e')]||null:null,'attributes':_0x5c3016[_0x90a2('0x1c')]?_0x5c3016['options'][_0x90a2('0x1f')]||null:null,'limit':_0x5c3016[_0x90a2('0x1c')]?_0x5c3016[_0x90a2('0x1c')][_0x90a2('0x20')]||null:null,'include':_0x5c3016[_0x90a2('0x1c')]?_0x5c3016[_0x90a2('0x1c')][_0x90a2('0x21')]?_[_0x90a2('0x22')](_0x5c3016[_0x90a2('0x1c')][_0x90a2('0x21')],function(_0xc39be1){return{'model':db[_0xc39be1['model']],'as':_0xc39be1['as'],'attributes':_0xc39be1[_0x90a2('0x1f')],'include':_0xc39be1[_0x90a2('0x21')]?_[_0x90a2('0x22')](_0xc39be1['include'],function(_0x489fcd){return{'model':db[_0x489fcd[_0x90a2('0x23')]],'as':_0x489fcd['as'],'attributes':_0x489fcd['attributes'],'include':_0x489fcd[_0x90a2('0x21')]?_['map'](_0x489fcd[_0x90a2('0x21')],function(_0x372ced){return{'model':db[_0x372ced[_0x90a2('0x23')]],'as':_0x372ced['as'],'attributes':_0x372ced[_0x90a2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x90a2('0x10')](function(_0x8763d3){logger['info'](_0x90a2('0x24'),_0x5c3016);logger['debug']('GetMailAccount',_0x5c3016,JSON[_0x90a2('0x14')](_0x8763d3));_0x15b247(_0x8763d3);})[_0x90a2('0x19')](function(_0x371a97){logger[_0x90a2('0x15')](_0x90a2('0x24'),_0x371a97[_0x90a2('0x18')],_0x5c3016);_0x242c1f(_0x2af3a4[_0x90a2('0x15')](0x1f4,_0x371a97['message']));});});};exports[_0x90a2('0x25')]=function(_0x1d7da9){var _0x4a3505=this;return new Promise(function(_0x534667,_0x47b76d){return db[_0x90a2('0x1a')][_0x90a2('0x26')]({'raw':_0x1d7da9['options']?_0x1d7da9[_0x90a2('0x1c')][_0x90a2('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d7da9[_0x90a2('0x1c')]?_0x1d7da9[_0x90a2('0x1c')][_0x90a2('0x1e')]||null:null,'attributes':_0x1d7da9[_0x90a2('0x1c')]?_0x1d7da9['options'][_0x90a2('0x1f')]||null:null,'include':_0x1d7da9[_0x90a2('0x1c')]?_0x1d7da9[_0x90a2('0x1c')]['include']?_[_0x90a2('0x22')](_0x1d7da9[_0x90a2('0x1c')][_0x90a2('0x21')],function(_0x5829b6){return{'model':db[_0x5829b6['model']],'as':_0x5829b6['as'],'attributes':_0x5829b6[_0x90a2('0x1f')],'include':_0x5829b6['include']?_['map'](_0x5829b6['include'],function(_0x269bac){return{'model':db[_0x269bac['model']],'as':_0x269bac['as'],'attributes':_0x269bac[_0x90a2('0x1f')],'include':_0x269bac[_0x90a2('0x21')]?_['map'](_0x269bac[_0x90a2('0x21')],function(_0x937fd6){return{'model':db[_0x937fd6[_0x90a2('0x23')]],'as':_0x937fd6['as'],'attributes':_0x937fd6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c49e){logger[_0x90a2('0x11')](_0x90a2('0x25'),_0x1d7da9);logger[_0x90a2('0x27')]('ShowMailAccount',_0x1d7da9,JSON[_0x90a2('0x14')](_0x22c49e));_0x534667(_0x22c49e);})[_0x90a2('0x19')](function(_0x468aee){logger[_0x90a2('0x15')](_0x90a2('0x25'),_0x468aee[_0x90a2('0x18')],_0x1d7da9);_0x47b76d(_0x4a3505[_0x90a2('0x15')](0x1f4,_0x468aee['message']));});});};exports['NotifyMailAccount']=function(_0x14c1ea){var _0x15c184=this;return new Promise(function(_0x137b5f,_0x499e28){var _0x58cb2e={'body':_0x14c1ea['body'],'channel':_0x90a2('0x28')};var _0x2287be=_['difference'](_[_0x90a2('0x29')](db[_0x90a2('0x2a')][_0x90a2('0x2b')]),['createdAt',_0x90a2('0x2c'),_0x90a2('0x2d'),_0x90a2('0x2e')]);var _0xdd6f78=![];if(_0x14c1ea[_0x90a2('0x2f')]['id']){delete _0x14c1ea[_0x90a2('0x2f')]['id'];}if(_[_0x90a2('0x30')](_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x31')])){return _0x499e28(_0x15c184['error'](0x1f4,_0x90a2('0x32')));}if(_[_0x90a2('0x30')](_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x2f')])||_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x2f')]===''){return _0x499e28(_0x15c184[_0x90a2('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x90a2('0x30')](_0x14c1ea['body'][_0x90a2('0x33')])){return _0x499e28(_0x15c184[_0x90a2('0x15')](0x1f4,_0x90a2('0x34')+_0x2287be));}if(!_['includes'](_0x2287be,_0x14c1ea[_0x90a2('0x2f')]['mapKey'])){return _0x499e28(_0x15c184[_0x90a2('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2287be));}var _0x325a1c={};_0x325a1c[_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x33')]]=_0x14c1ea['body']['from'];return db[_0x90a2('0x1a')][_0x90a2('0x26')]({'where':{'id':_0x14c1ea[_0x90a2('0x35')]['id']},'include':[{'model':db[_0x90a2('0x36')],'as':'List','include':[{'model':db[_0x90a2('0x2a')],'as':_0x90a2('0x37'),'where':_0x325a1c,'limit':0x1,'order':[[_0x90a2('0x2c'),_0x90a2('0x38')]]}]},{'model':db['MailApplication'],'as':_0x90a2('0x39')},{'model':db[_0x90a2('0x3a')],'as':_0x90a2('0x3b')}]})[_0x90a2('0x10')](function(_0x20ce57){if(_0x20ce57&&_0x20ce57[_0x90a2('0x3c')]){var _0x2a09d1=_0x20ce57[_0x90a2('0x3d')]({'plain':!![]});_0x58cb2e[_0x90a2('0x35')]=_[_0x90a2('0x3e')](_0x2a09d1,[_0x90a2('0x39'),_0x90a2('0x3c')]);_0x58cb2e[_0x90a2('0x3f')]=_0x2a09d1[_0x90a2('0x39')];_0x58cb2e[_0x90a2('0x40')]=_0x2a09d1[_0x90a2('0x3c')];_0x58cb2e['applications']=_[_0x90a2('0x41')](_0x58cb2e[_0x90a2('0x3f')],[_0x90a2('0x42')],[_0x90a2('0x43')]);if(_0x58cb2e[_0x90a2('0x35')]&&_0x58cb2e['account'][_0x90a2('0x44')]){_0x58cb2e[_0x90a2('0x3f')]['push']({'id':0x0,'priority':_0x58cb2e[_0x90a2('0x3f')]['length']+0x1,'app':_0x90a2('0x45'),'appdata':_0x90a2('0x44'),'interval':_0x90a2('0x46')});}if(_0x58cb2e['account'][_0x90a2('0x39')]){delete _0x58cb2e['account']['Applications'];}if(_0x58cb2e[_0x90a2('0x35')]['List']){delete _0x58cb2e[_0x90a2('0x35')][_0x90a2('0x3c')];}if(_0x2a09d1[_0x90a2('0x3c')][_0x90a2('0x37')][_0x90a2('0x47')]){return _0x2a09d1[_0x90a2('0x3c')][_0x90a2('0x37')][0x0];}var _0x14b5a9=_[_0x90a2('0xb')](_0x14c1ea[_0x90a2('0x2f')],{'firstName':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x31')],'ListId':_0x2a09d1[_0x90a2('0x2e')]});_0x14b5a9[_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x33')]]=_0x14c1ea[_0x90a2('0x2f')]['from'];return db[_0x90a2('0x2a')][_0x90a2('0x48')](_0x14b5a9);}else{throw new Error(_0x90a2('0x49'));}})[_0x90a2('0x10')](function(_0x12c6d4){_0x58cb2e['contact']=_0x12c6d4;if(_0x12c6d4){if(!_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4a')]){_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4a')]=rs['generate']()+'\x20'+_0x14c1ea['body']['message'][_0x90a2('0x31')];}var _0x257936={'ContactId':_0x12c6d4['id'],'MailAccountId':_0x14c1ea[_0x90a2('0x35')]['id'],'inReplyTo':_0x14c1ea[_0x90a2('0x2f')]['message'][_0x90a2('0x4a')],'to':_0x14c1ea[_0x90a2('0x2f')]['message'][_0x90a2('0x31')],'cc':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')]['cc'],'subject':_0x14c1ea['body']['message'][_0x90a2('0x4b')],'attach':_0x14c1ea['body'][_0x90a2('0x18')]['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x90a2('0x4c')]['find']({'where':{'closed':![],'MailAccountId':_0x14c1ea[_0x90a2('0x35')]['id']},'include':[{'model':db[_0x90a2('0x4d')],'as':_0x90a2('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4f')]}}]})[_0x90a2('0x10')](function(_0x4b4e2a){if(_0x4b4e2a){return[_0x4b4e2a,![]];}return db[_0x90a2('0x4c')][_0x90a2('0x48')](_0x257936)['then'](function(_0x5b8156){return[_0x5b8156,!![]];});});}else{throw new Error(_0x90a2('0x50'));}})[_0x90a2('0x51')](function(_0x5a6c22,_0x1422cf){if(_0x5a6c22){_0xdd6f78=_0x1422cf;if(!_0x1422cf){return _0x5a6c22[_0x90a2('0x52')]({'inReplyTo':_0x14c1ea[_0x90a2('0x2f')]['message'][_0x90a2('0x4a')],'to':_0x14c1ea['body'][_0x90a2('0x18')][_0x90a2('0x31')],'cc':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')]['cc'],'subject':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4b')],'attach':_0x5a6c22['attach']?_0x5a6c22[_0x90a2('0x53')]:_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x90a2('0x54')](_0x90a2('0x55')),'lastMsgAt':moment()[_0x90a2('0x54')](_0x90a2('0x55')),'lastMsgDirection':'in'});}else{return _0x5a6c22;}}})[_0x90a2('0x10')](function(_0x5d5d3f){_0x58cb2e[_0x90a2('0x56')]=_0x5d5d3f[_0x90a2('0x3d')]({'plain':!![]});_0x58cb2e[_0x90a2('0x56')]['created']=_0xdd6f78;return db[_0x90a2('0x4d')][_0x90a2('0x48')]({'body':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x2f')],'MailAccountId':_0x14c1ea[_0x90a2('0x35')]['id'],'MailInteractionId':_0x5d5d3f['id'],'direction':'in','ContactId':_0x58cb2e[_0x90a2('0x57')]['id'],'messageId':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4a')],'from':_0x14c1ea['body'][_0x90a2('0x18')]['from'],'to':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')]['to'],'cc':_0x14c1ea[_0x90a2('0x2f')]['message']['cc'],'subject':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x4b')],'attach':_0x14c1ea[_0x90a2('0x2f')]['message']['attach'],'Attachments':_0x14c1ea['body'][_0x90a2('0x18')]['attachments'],'originTo':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')]['originTo'],'originCc':_0x14c1ea['body'][_0x90a2('0x18')]['originCc'],'bcc':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x58')],'ChatWebsiteId':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x59')]||null,'originChannel':_0x14c1ea[_0x90a2('0x2f')][_0x90a2('0x18')][_0x90a2('0x5a')]||_0x90a2('0x5b'),'ChatOfflineMessageId':_0x14c1ea['body']['message'][_0x90a2('0x5c')]||null},{'include':[{'model':db['Attachment'],'as':_0x90a2('0x5d')}]});})['then'](function(_0xc958f0){_0x58cb2e['message']=_0xc958f0;if(_0x58cb2e[_0x90a2('0x56')][_0x90a2('0x5e')]){return db[_0x90a2('0x5f')][_0x90a2('0x26')]({'attributes':['id','name'],'where':{'id':_0x58cb2e[_0x90a2('0x56')][_0x90a2('0x5e')]}})[_0x90a2('0x10')](function(_0x29dc6e){if(_0x29dc6e){_0x58cb2e['applications'][_0x90a2('0x60')]({'id':0x0,'priority':0x0,'app':_0x90a2('0x61'),'appdata':_0x29dc6e[_0x90a2('0x62')]+','+(_0x58cb2e[_0x90a2('0x35')][_0x90a2('0x63')]||0xa),'interval':_0x90a2('0x46')});}return respondWithRpcPromise('Start','startRouting',_0x58cb2e);});}return respondWithRpcPromise('Start',_0x90a2('0x64'),_0x58cb2e);})[_0x90a2('0x10')](function(_0xc1d315){_0x137b5f(_0xc1d315);})[_0x90a2('0x19')](function(_0x4ab288){_0x499e28(_0x15c184[_0x90a2('0x15')](0x1f4,_0x4ab288[_0x90a2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c2f53e9..e7936ad 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 _0xce9f=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xce9f,0x137));var _0xfce9=function(_0x5df533,_0x26ba22){_0x5df533=_0x5df533-0x0;var _0x4b283e=_0xce9f[_0x5df533];return _0x4b283e;};'use strict';var MailAccountEvents=require(_0xfce9('0x0'));var events=[_0xfce9('0x1'),_0xfce9('0x2'),_0xfce9('0x3')];function createListener(_0x4a3821,_0x13079a){return function(_0x3b2760){_0x13079a[_0xfce9('0x4')](_0x4a3821,_0x3b2760);};}function removeListener(_0x30b750,_0x38fa2c){return function(){MailAccountEvents[_0xfce9('0x5')](_0x30b750,_0x38fa2c);};}exports[_0xfce9('0x6')]=function(_0x5d4f0d){for(var _0x4af193=0x0,_0x3b95df=events[_0xfce9('0x7')];_0x4af193<_0x3b95df;_0x4af193++){var _0x5d04c9=events[_0x4af193];var _0x5a24ef=createListener(_0xfce9('0x8')+_0x5d04c9,_0x5d4f0d);MailAccountEvents['on'](_0x5d04c9,_0x5a24ef);}}; \ No newline at end of file +var _0x3266=['mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3266,0x6a));var _0x6326=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x3266[_0x2261ce];return _0x524640;};'use strict';var MailAccountEvents=require(_0x6326('0x0'));var events=[_0x6326('0x1'),_0x6326('0x2'),_0x6326('0x3')];function createListener(_0x545df7,_0x6b67c0){return function(_0x29aef3){_0x6b67c0[_0x6326('0x4')](_0x545df7,_0x29aef3);};}function removeListener(_0x265264,_0x5a6b4d){return function(){MailAccountEvents[_0x6326('0x5')](_0x265264,_0x5a6b4d);};}exports['register']=function(_0x25ecd8){for(var _0x44460c=0x0,_0x14208e=events['length'];_0x44460c<_0x14208e;_0x44460c++){var _0x161f4e=events[_0x44460c];var _0x5730e7=createListener(_0x6326('0x6')+_0x161f4e,_0x25ecd8);MailAccountEvents['on'](_0x161f4e,_0x5730e7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6c38f1a..4a30491 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 _0x8293=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','express'];(function(_0x55e84d,_0xd42252){var _0x154dca=function(_0x316420){while(--_0x316420){_0x55e84d['push'](_0x55e84d['shift']());}};_0x154dca(++_0xd42252);}(_0x8293,0x1b7));var _0x3829=function(_0x28644f,_0x6f5392){_0x28644f=_0x28644f-0x0;var _0x253dc9=_0x8293[_0x28644f];return _0x253dc9;};'use strict';var multer=require('multer');var util=require(_0x3829('0x0'));var path=require(_0x3829('0x1'));var timeout=require('connect-timeout');var express=require(_0x3829('0x2'));var router=express[_0x3829('0x3')]();var fs_extra=require(_0x3829('0x4'));var auth=require(_0x3829('0x5'));var interaction=require(_0x3829('0x6'));var config=require('../../config/environment');var controller=require(_0x3829('0x7'));router[_0x3829('0x8')](_0x3829('0x9'),auth[_0x3829('0xa')](),controller[_0x3829('0xb')]);router[_0x3829('0xc')](_0x3829('0x9'),auth[_0x3829('0xa')](),controller[_0x3829('0xd')]);router[_0x3829('0xe')](_0x3829('0x9'),auth['isAuthenticated'](),controller[_0x3829('0xf')]);module[_0x3829('0x10')]=router; \ No newline at end of file +var _0xf14b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','multer','util','path','connect-timeout'];(function(_0x1e7aff,_0x1c843b){var _0x2a16bf=function(_0x2eceee){while(--_0x2eceee){_0x1e7aff['push'](_0x1e7aff['shift']());}};_0x2a16bf(++_0x1c843b);}(_0xf14b,0x1be));var _0xbf14=function(_0x275f08,_0x44cddf){_0x275f08=_0x275f08-0x0;var _0x275290=_0xf14b[_0x275f08];return _0x275290;};'use strict';var multer=require(_0xbf14('0x0'));var util=require(_0xbf14('0x1'));var path=require(_0xbf14('0x2'));var timeout=require(_0xbf14('0x3'));var express=require(_0xbf14('0x4'));var router=express[_0xbf14('0x5')]();var fs_extra=require(_0xbf14('0x6'));var auth=require(_0xbf14('0x7'));var interaction=require(_0xbf14('0x8'));var config=require(_0xbf14('0x9'));var controller=require(_0xbf14('0xa'));router[_0xbf14('0xb')](_0xbf14('0xc'),auth[_0xbf14('0xd')](),controller[_0xbf14('0xe')]);router[_0xbf14('0xf')](_0xbf14('0xc'),auth[_0xbf14('0xd')](),controller[_0xbf14('0x10')]);router[_0xbf14('0x11')](_0xbf14('0xc'),auth[_0xbf14('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 07d0762..224a75c 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 _0x65fa=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x65fa,0x1b0));var _0xa65f=function(_0x40ea20,_0x11010b){_0x40ea20=_0x40ea20-0x0;var _0xe5483d=_0x65fa[_0x40ea20];return _0xe5483d;};'use strict';var Sequelize=require(_0xa65f('0x0'));module[_0xa65f('0x1')]={'priority':{'type':Sequelize[_0xa65f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa65f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa65f('0x4')]()},'description':{'type':Sequelize[_0xa65f('0x3')]},'interval':{'type':Sequelize[_0xa65f('0x3')],'defaultValue':_0xa65f('0x5')}}; \ No newline at end of file +var _0xe574=['noop','TEXT','INTEGER','STRING'];(function(_0x2b69ad,_0x1b898e){var _0x3e0891=function(_0x28ee98){while(--_0x28ee98){_0x2b69ad['push'](_0x2b69ad['shift']());}};_0x3e0891(++_0x1b898e);}(_0xe574,0x1ea));var _0x4e57=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe574[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x4e57('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x4e57('0x1')],'allowNull':![],'defaultValue':_0x4e57('0x2')},'appdata':{'type':Sequelize[_0x4e57('0x3')]()},'description':{'type':Sequelize[_0x4e57('0x1')]},'interval':{'type':Sequelize[_0x4e57('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a79c28f..6f10966 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4b3661,_0x1be781){_0x4b3661=_0x4b3661-0x0;var _0x582d0c=_0xbdb7[_0x4b3661];return _0x582d0c;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,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(_0x4cad9a,_0x365b74){var _0x29ffb5=function(_0x13e2cf){while(--_0x13e2cf){_0x4cad9a['push'](_0x4cad9a['shift']());}};_0x29ffb5(++_0x365b74);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1809c5,_0x46cabc){_0x1809c5=_0x1809c5-0x0;var _0x5254a4=_0xcb91[_0x1809c5];return _0x5254a4;};'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 275be6b..fd828b7 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 _0xe4d4=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3a023f,_0x3a0789){var _0x1de363=function(_0x239e8e){while(--_0x239e8e){_0x3a023f['push'](_0x3a023f['shift']());}};_0x1de363(++_0x3a0789);}(_0xe4d4,0x173));var _0x4e4d=function(_0x272238,_0x4598e4){_0x272238=_0x272238-0x0;var _0x5b898c=_0xe4d4[_0x272238];return _0x5b898c;};'use strict';var _=require(_0x4e4d('0x0'));var util=require(_0x4e4d('0x1'));var logger=require('../../config/logger')(_0x4e4d('0x2'));var moment=require(_0x4e4d('0x3'));var BPromise=require(_0x4e4d('0x4'));var rp=require(_0x4e4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e4d('0x6'));var config=require(_0x4e4d('0x7'));var attributes=require(_0x4e4d('0x8'));module[_0x4e4d('0x9')]=function(_0x59294f,_0x28489d){return _0x59294f[_0x4e4d('0xa')](_0x4e4d('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4e4d('0xc')});}; \ No newline at end of file +var _0xa879=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','util','api','moment','bluebird','request-promise','path'];(function(_0x565411,_0x7415b0){var _0x439dfb=function(_0x48711c){while(--_0x48711c){_0x565411['push'](_0x565411['shift']());}};_0x439dfb(++_0x7415b0);}(_0xa879,0x166));var _0x9a87=function(_0x1c3d59,_0x111d08){_0x1c3d59=_0x1c3d59-0x0;var _0x3eff34=_0xa879[_0x1c3d59];return _0x3eff34;};'use strict';var _=require('lodash');var util=require(_0x9a87('0x0'));var logger=require('../../config/logger')(_0x9a87('0x1'));var moment=require(_0x9a87('0x2'));var BPromise=require(_0x9a87('0x3'));var rp=require(_0x9a87('0x4'));var fs=require('fs');var path=require(_0x9a87('0x5'));var rimraf=require(_0x9a87('0x6'));var config=require(_0x9a87('0x7'));var attributes=require(_0x9a87('0x8'));module[_0x9a87('0x9')]=function(_0x6621af,_0x24f44c){return _0x6621af[_0x9a87('0xa')](_0x9a87('0xb'),attributes,{'tableName':_0x9a87('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 69309e4..284718b 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 _0x6743=['where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailApplication','MailApplication','update','body','raw','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6743,0xd0));var _0x3674=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x6743[_0x494d1f];return _0x457b6e;};'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')]('MailApplication,\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']('MailApplication,\x20%s,\x20%s',_0xe063ab,_0x419649);_0x3382af(_0x419649);});});}exports[_0x3674('0x18')]=function(_0x633a88){var _0x1927b7=this;return new Promise(function(_0x58fe59,_0x37bcaa){return db[_0x3674('0x19')][_0x3674('0x1a')](_0x633a88[_0x3674('0x1b')],{'raw':_0x633a88['options']?_0x633a88['options'][_0x3674('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x1e')]||null:null,'attributes':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x1f')]||null:null,'limit':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x20')]||null:null})[_0x3674('0xd')](function(_0xec7d40){logger[_0x3674('0x16')]('UpdateMailApplication',_0x633a88);logger['debug'](_0x3674('0x18'),_0x633a88,JSON[_0x3674('0x12')](_0xec7d40));_0x58fe59(_0xec7d40);})[_0x3674('0x21')](function(_0x2b63b4){logger[_0x3674('0x13')](_0x3674('0x18'),_0x2b63b4[_0x3674('0x15')],_0x633a88);_0x37bcaa(_0x1927b7[_0x3674('0x13')](0x1f4,_0x2b63b4[_0x3674('0x15')]));});});}; \ No newline at end of file +var _0xf057=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message','info','result','catch','MailApplication','update','body','options','raw','where','attributes','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d431e,_0x4ca651){var _0x443bab=function(_0x2c99d0){while(--_0x2c99d0){_0x2d431e['push'](_0x2d431e['shift']());}};_0x443bab(++_0x4ca651);}(_0xf057,0x16e));var _0x7f05=function(_0x242878,_0x64cce6){_0x242878=_0x242878-0x0;var _0x506e22=_0xf057[_0x242878];return _0x506e22;};'use strict';var _=require(_0x7f05('0x0'));var util=require(_0x7f05('0x1'));var moment=require(_0x7f05('0x2'));var BPromise=require(_0x7f05('0x3'));var rs=require(_0x7f05('0x4'));var fs=require('fs');var Redis=require(_0x7f05('0x5'));var db=require(_0x7f05('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f05('0x7'))(_0x7f05('0x8'));var config=require(_0x7f05('0x9'));var jayson=require(_0x7f05('0xa'));var client=jayson[_0x7f05('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a07dc,_0x474f3f,_0x243e93){return new BPromise(function(_0x420bec,_0xdc6224){return client['request'](_0x1a07dc,_0x243e93)[_0x7f05('0xc')](function(_0x4069ed){logger['info']('MailApplication,\x20%s,\x20%s',_0x474f3f,_0x7f05('0xd'));logger[_0x7f05('0xe')](_0x7f05('0xf'),_0x474f3f,'request\x20sent',JSON[_0x7f05('0x10')](_0x4069ed));if(_0x4069ed[_0x7f05('0x11')]){if(_0x4069ed[_0x7f05('0x11')]['code']===0x1f4){logger[_0x7f05('0x11')](_0x7f05('0x12'),_0x474f3f,_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);return _0xdc6224(_0x4069ed['error'][_0x7f05('0x13')]);}logger['error'](_0x7f05('0x12'),_0x474f3f,_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);return _0x420bec(_0x4069ed[_0x7f05('0x11')][_0x7f05('0x13')]);}else{logger[_0x7f05('0x14')](_0x7f05('0x12'),_0x474f3f,_0x7f05('0xd'));_0x420bec(_0x4069ed[_0x7f05('0x15')][_0x7f05('0x13')]);}})[_0x7f05('0x16')](function(_0x34a5ec){logger[_0x7f05('0x11')](_0x7f05('0x12'),_0x474f3f,_0x34a5ec);_0xdc6224(_0x34a5ec);});});}exports['UpdateMailApplication']=function(_0x2caa49){var _0x47261a=this;return new Promise(function(_0x1ac544,_0x115b22){return db[_0x7f05('0x17')][_0x7f05('0x18')](_0x2caa49[_0x7f05('0x19')],{'raw':_0x2caa49[_0x7f05('0x1a')]?_0x2caa49[_0x7f05('0x1a')][_0x7f05('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2caa49[_0x7f05('0x1a')]?_0x2caa49[_0x7f05('0x1a')][_0x7f05('0x1c')]||null:null,'attributes':_0x2caa49[_0x7f05('0x1a')]?_0x2caa49[_0x7f05('0x1a')][_0x7f05('0x1d')]||null:null,'limit':_0x2caa49[_0x7f05('0x1a')]?_0x2caa49[_0x7f05('0x1a')]['limit']||null:null})['then'](function(_0x3ec091){logger['info']('UpdateMailApplication',_0x2caa49);logger[_0x7f05('0xe')]('UpdateMailApplication',_0x2caa49,JSON['stringify'](_0x3ec091));_0x1ac544(_0x3ec091);})[_0x7f05('0x16')](function(_0x54d76d){logger[_0x7f05('0x11')](_0x7f05('0x1e'),_0x54d76d['message'],_0x2caa49);_0x115b22(_0x47261a['error'](0x1f4,_0x54d76d[_0x7f05('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fef5f73..dcd3b5b 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 _0x78c6=['post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0xd15914,_0x25b6e9){var _0x276584=function(_0xf45666){while(--_0xf45666){_0xd15914['push'](_0xd15914['shift']());}};_0x276584(++_0x25b6e9);}(_0x78c6,0x1de));var _0x678c=function(_0x8d2071,_0x1092fb){_0x8d2071=_0x8d2071-0x0;var _0xe67f73=_0x78c6[_0x8d2071];return _0xe67f73;};'use strict';var express=require(_0x678c('0x0'));var router=express[_0x678c('0x1')]();var auth=require(_0x678c('0x2'));var interaction=require(_0x678c('0x3'));var controller=require(_0x678c('0x4'));router[_0x678c('0x5')]('/',auth[_0x678c('0x6')](),controller[_0x678c('0x7')]);router[_0x678c('0x5')](_0x678c('0x8'),auth[_0x678c('0x6')](),controller[_0x678c('0x9')]);router[_0x678c('0x5')](_0x678c('0xa'),auth[_0x678c('0x6')](),controller['show']);router[_0x678c('0x5')](_0x678c('0xb'),auth[_0x678c('0x6')](),controller[_0x678c('0xc')]);router[_0x678c('0x5')](_0x678c('0xd'),auth[_0x678c('0x6')](),controller[_0x678c('0xe')]);router[_0x678c('0xf')]('/',auth[_0x678c('0x6')](),controller[_0x678c('0x10')]);router['post'](_0x678c('0xb'),auth[_0x678c('0x6')](),controller[_0x678c('0x11')]);router[_0x678c('0xf')](_0x678c('0x12'),auth[_0x678c('0x6')](),interaction[_0x678c('0x13')](_0x678c('0x14'),'mailinteraction:addtags'),controller[_0x678c('0x15')]);router[_0x678c('0x16')](_0x678c('0xa'),auth[_0x678c('0x6')](),interaction['tracked'](_0x678c('0x14'),_0x678c('0x17')),controller[_0x678c('0x18')]);router[_0x678c('0x19')](_0x678c('0xa'),auth[_0x678c('0x6')](),interaction[_0x678c('0x13')](_0x678c('0x14'),_0x678c('0x1a')),controller['destroy']);router['delete'](_0x678c('0x12'),auth[_0x678c('0x6')](),controller[_0x678c('0x1b')]);module[_0x678c('0x1c')]=router; \ No newline at end of file +var _0x1dd2=['index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mail','destroy','delete','removeTags','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x4c37d9,_0x187c40){var _0x2208f8=function(_0x338639){while(--_0x338639){_0x4c37d9['push'](_0x4c37d9['shift']());}};_0x2208f8(++_0x187c40);}(_0x1dd2,0x159));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x21dd('0x0')]();var auth=require(_0x21dd('0x1'));var interaction=require(_0x21dd('0x2'));var controller=require(_0x21dd('0x3'));router[_0x21dd('0x4')]('/',auth[_0x21dd('0x5')](),controller[_0x21dd('0x6')]);router[_0x21dd('0x4')](_0x21dd('0x7'),auth['isAuthenticated'](),controller[_0x21dd('0x8')]);router[_0x21dd('0x4')]('/:id',auth[_0x21dd('0x5')](),controller[_0x21dd('0x9')]);router[_0x21dd('0x4')](_0x21dd('0xa'),auth['isAuthenticated'](),controller[_0x21dd('0xb')]);router['get'](_0x21dd('0xc'),auth[_0x21dd('0x5')](),controller[_0x21dd('0xd')]);router[_0x21dd('0xe')]('/',auth['isAuthenticated'](),controller[_0x21dd('0xf')]);router['post'](_0x21dd('0xa'),auth[_0x21dd('0x5')](),controller[_0x21dd('0x10')]);router[_0x21dd('0xe')](_0x21dd('0x11'),auth[_0x21dd('0x5')](),interaction[_0x21dd('0x12')]('mail',_0x21dd('0x13')),controller[_0x21dd('0x14')]);router[_0x21dd('0x15')](_0x21dd('0x16'),auth[_0x21dd('0x5')](),interaction[_0x21dd('0x12')](_0x21dd('0x17'),'mailinteraction:update'),controller['update']);router['delete'](_0x21dd('0x16'),auth[_0x21dd('0x5')](),interaction[_0x21dd('0x12')](_0x21dd('0x17'),'mailinteraction:destroy'),controller[_0x21dd('0x18')]);router[_0x21dd('0x19')](_0x21dd('0x11'),auth['isAuthenticated'](),controller[_0x21dd('0x1a')]);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 9f049c5..e51233a 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 _0xb64d=['ENUM','out','sequelize','exports','BOOLEAN','STRING','long','TEXT','DATE'];(function(_0x477fa4,_0xff101a){var _0x5cbb9c=function(_0x172884){while(--_0x172884){_0x477fa4['push'](_0x477fa4['shift']());}};_0x5cbb9c(++_0xff101a);}(_0xb64d,0x122));var _0xdb64=function(_0x28ddd0,_0x3cf080){_0x28ddd0=_0x28ddd0-0x0;var _0x3ca689=_0xb64d[_0x28ddd0];return _0x3ca689;};'use strict';var Sequelize=require(_0xdb64('0x0'));var iconv=require('iconv');module[_0xdb64('0x1')]={'closed':{'type':Sequelize[_0xdb64('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdb64('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdb64('0x3')]},'note':{'type':Sequelize[_0xdb64('0x3')]},'inReplyTo':{'type':Sequelize[_0xdb64('0x3')](0x1fe)},'to':{'type':Sequelize[_0xdb64('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xdb64('0x4'))},'subject':{'type':Sequelize[_0xdb64('0x5')]()},'attach':{'type':Sequelize[_0xdb64('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdb64('0x6')]},'substatus':{'type':Sequelize[_0xdb64('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdb64('0x7')]('in',_0xdb64('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdb64('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb3f6=['long','out','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0xdc5ca7,_0x4ca4eb){var _0x25b991=function(_0x5ec606){while(--_0x5ec606){_0xdc5ca7['push'](_0xdc5ca7['shift']());}};_0x25b991(++_0x4ca4eb);}(_0xb3f6,0x18a));var _0x6b3f=function(_0x514984,_0x3bd51a){_0x514984=_0x514984-0x0;var _0x49faec=_0xb3f6[_0x514984];return _0x49faec;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x6b3f('0x0'));module[_0x6b3f('0x1')]={'closed':{'type':Sequelize[_0x6b3f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b3f('0x3')]},'disposition':{'type':Sequelize[_0x6b3f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6b3f('0x4')](0x1fe)},'to':{'type':Sequelize[_0x6b3f('0x4')]},'cc':{'type':Sequelize[_0x6b3f('0x5')](_0x6b3f('0x6'))},'subject':{'type':Sequelize[_0x6b3f('0x5')]()},'attach':{'type':Sequelize[_0x6b3f('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x6b3f('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x6b3f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6b3f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6b3f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6b3f('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fd5b63b..135c4e8 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 _0x7e4b=['getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','options','create','body','params','describe','ids','omit','getMessages','rawAttributes','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','inlineCss','true','spread','emit','mailInteractionTags:save','removeTags','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','trimStart','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','MailInteraction','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7e4b,0x84));var _0xb7e4=function(_0x2475f3,_0x57ce6c){_0x2475f3=_0x2475f3-0x0;var _0x3b9092=_0x7e4b[_0x2475f3];return _0x3b9092;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var moment=require(_0xb7e4('0x2'));var BPromise=require(_0xb7e4('0x3'));var util=require('util');var path=require(_0xb7e4('0x4'));var fs=require('fs');var _=require(_0xb7e4('0x5'));var squel=require(_0xb7e4('0x6'));var juice=require(_0xb7e4('0x7'));var Redis=require(_0xb7e4('0x8'));var qs=require(_0xb7e4('0x9'));var as=require(_0xb7e4('0xa'));var logger=require(_0xb7e4('0xb'))(_0xb7e4('0xc'));var config=require('../../config/environment');var db=require(_0xb7e4('0xd'))['db'];var htmlEntities=require('html-entities');config[_0xb7e4('0xe')]=_[_0xb7e4('0xf')](config[_0xb7e4('0xe')],{'host':_0xb7e4('0x10'),'port':0x18eb});var socket=require(_0xb7e4('0x11'))(new Redis(config[_0xb7e4('0xe')]));require(_0xb7e4('0x12'))[_0xb7e4('0x13')](socket);function respondWithStatusCode(_0xd998a1,_0x4555ce){_0x4555ce=_0x4555ce||0xcc;return function(_0x3179b3){if(_0x3179b3){return _0xd998a1[_0xb7e4('0x14')](_0x4555ce);}return _0xd998a1[_0xb7e4('0x15')](_0x4555ce)['end']();};}function respondWithResult(_0x50466e,_0xb7fe30){_0xb7fe30=_0xb7fe30||0xc8;return function(_0x1b80aa){if(_0x1b80aa){return _0x50466e['status'](_0xb7fe30)[_0xb7e4('0x16')](_0x1b80aa);}};}function respondWithFilteredResult(_0x18fcb6,_0xc8a777){return function(_0xc2be7d){if(_0xc2be7d){var _0x2acf77=typeof _0xc8a777[_0xb7e4('0x17')]===_0xb7e4('0x18')&&typeof _0xc8a777[_0xb7e4('0x19')]===_0xb7e4('0x18');var _0x3600be=_0xc2be7d[_0xb7e4('0x1a')];var _0x983d60=_0x2acf77?0x0:_0xc8a777[_0xb7e4('0x17')];var _0x3a08f1=_0x2acf77?_0xc2be7d['count']:_0xc8a777[_0xb7e4('0x17')]+_0xc8a777[_0xb7e4('0x19')];var _0x2957da;if(_0x3a08f1>=_0x3600be){_0x3a08f1=_0x3600be;_0x2957da=0xc8;}else{_0x2957da=0xce;}_0x18fcb6[_0xb7e4('0x15')](_0x2957da);return _0x18fcb6[_0xb7e4('0x1b')](_0xb7e4('0x1c'),_0x983d60+'-'+_0x3a08f1+'/'+_0x3600be)[_0xb7e4('0x16')](_0xc2be7d);}return null;};}function saveUpdates(_0x23d919){return function(_0x48aaaf){if(_0x48aaaf){return _0x48aaaf[_0xb7e4('0x1d')](_0x23d919)['then'](function(_0x3385de){return _0x3385de;});}return null;};}function removeEntity(_0x45fa11){return function(_0x2857e3){if(_0x2857e3){return _0x2857e3[_0xb7e4('0x1e')]()[_0xb7e4('0x1f')](function(){_0x45fa11['status'](0xcc)[_0xb7e4('0x20')]();});}};}function handleEntityNotFound(_0x172329){return function(_0x3d4172){if(!_0x3d4172){_0x172329[_0xb7e4('0x14')](0x194);}return _0x3d4172;};}function handleError(_0x18e4fb,_0xba07f){_0xba07f=_0xba07f||0x1f4;return function(_0x58544e){logger[_0xb7e4('0x21')](_0x58544e[_0xb7e4('0x22')]);if(_0x58544e[_0xb7e4('0x23')]){delete _0x58544e[_0xb7e4('0x23')];}_0x18e4fb['status'](_0xba07f)[_0xb7e4('0x24')](_0x58544e);};}function getInteractionUsers(_0x3d2e88,_0x56d9cc){return new BPromise(function(_0x435816,_0xedb514){try{if(_0x56d9cc[_0x3d2e88['id']]){_0x3d2e88[_0xb7e4('0x25')]=_['map'](_0x56d9cc[_0x3d2e88['id']],function(_0x3d5198){return{'id':_0x3d5198['id'],'fullname':_0x3d5198[_0xb7e4('0x26')]};});}}catch(_0x4cff42){_0xedb514(_0x4cff42);}_0x435816(_0x3d2e88);});}function getInteractionTags(_0x29715c,_0x37421a){return new BPromise(function(_0x4f260f,_0x1a9d1c){try{if(_0x29715c[_0xb7e4('0x27')]){_0x29715c[_0xb7e4('0x28')]=[];_0x29715c['TagIds'][_0xb7e4('0x29')](',')[_0xb7e4('0x2a')](function(_0x248cc0){_0x29715c[_0xb7e4('0x28')][_0xb7e4('0x2b')](_0x37421a[_0x248cc0]);});}delete _0x29715c[_0xb7e4('0x27')];}catch(_0x2cd691){_0x1a9d1c(_0x2cd691);}_0x4f260f(_0x29715c);});}function getLastMessageText(_0x317297){return new BPromise(function(_0x914a18,_0x1f7436){return db[_0xb7e4('0x2c')][_0xb7e4('0x2d')]({'where':{'$and':[{'MailInteractionId':_0x317297['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb7e4('0x2e')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xb7e4('0x2f'),'raw':!![]})[_0xb7e4('0x1f')](function(_0x3452b4){if(_0x3452b4&&_0x3452b4[_0xb7e4('0x30')]){_0x317297['lastMsgText']=_[_0xb7e4('0x31')](_0x3452b4[_0xb7e4('0x30')]);}_0x914a18(_0x317297);})[_0xb7e4('0x32')](function(_0x2287fc){_0x1f7436(_0x2287fc);});});}function updateMailInteraction(_0x7404b3,_0x490945,_0x1fe213,_0x4aea5d){return new BPromise(function(_0x787aa6,_0xffa6b4){return getInteractionUsers(_0x7404b3,_0x1fe213)[_0xb7e4('0x1f')](function(_0x2245a1){return getInteractionTags(_0x2245a1,_0x490945);})[_0xb7e4('0x1f')](function(_0x836f96){return getStateInteraction(_0x836f96);})[_0xb7e4('0x1f')](function(_0x38d510){if(_0x4aea5d){_0x787aa6(getLastMessageText(_0x38d510));}else{_0x787aa6(_0x38d510);}})[_0xb7e4('0x32')](function(_0x5ea49f){_0xffa6b4(_0x5ea49f);});});}function getStateInteraction(_0x2289bc){return new BPromise(function(_0x16c01f){_0x2289bc[_0xb7e4('0x33')]=0x0;_0x2289bc[_0xb7e4('0x34')]=0x0;_0x2289bc[_0xb7e4('0x35')]=0x0;_0x2289bc['unmanaged']=0x0;_0x2289bc[_0xb7e4('0x36')]=0x0;if(!_0x2289bc[_0xb7e4('0x37')]&&!_0x2289bc['UserId']){_0x2289bc[_0xb7e4('0x33')]+=0x1;}if(!_0x2289bc['closed']&&_0x2289bc['UserId']){_0x2289bc[_0xb7e4('0x34')]+=0x1;if(_0x2289bc[_0xb7e4('0x33')]){_0x2289bc['waiting']-=0x1;}}if(_0x2289bc[_0xb7e4('0x37')]&&_0x2289bc[_0xb7e4('0x38')]){_0x2289bc[_0xb7e4('0x35')]+=0x1;if(_0x2289bc[_0xb7e4('0x34')]){_0x2289bc[_0xb7e4('0x34')]-=0x1;}}if(_0x2289bc[_0xb7e4('0x37')]&&!_0x2289bc[_0xb7e4('0x38')]){_0x2289bc[_0xb7e4('0x39')]+=0x1;if(_0x2289bc['waiting']){_0x2289bc['waiting']-=0x1;}}_0x2289bc[_0xb7e4('0x36')]+=0x1;_0x16c01f(_0x2289bc);});}exports[_0xb7e4('0x3a')]=function(_0x2b2514,_0x4cf4ea){var _0x10dc8e={},_0x438028={},_0x540dab={'count':0x0,'rows':[]};var _0x46099b=_['map'](db[_0xb7e4('0x3b')]['rawAttributes'],function(_0x18f231){return{'name':_0x18f231[_0xb7e4('0x3c')],'type':_0x18f231[_0xb7e4('0x3d')][_0xb7e4('0x3e')]};});_0x438028['model']=_[_0xb7e4('0x3f')](_0x46099b,'name');_0x438028[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x2b2514['query']);_0x438028[_0xb7e4('0x42')]=_[_0xb7e4('0x43')](_0x438028[_0xb7e4('0x44')],_0x438028['query']);_0x10dc8e[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x438028['model'],qs[_0xb7e4('0x46')](_0x2b2514[_0xb7e4('0x40')]['fields']));_0x10dc8e[_0xb7e4('0x45')]=_0x10dc8e['attributes']['length']?_0x10dc8e[_0xb7e4('0x45')]:_0x438028[_0xb7e4('0x44')];if(!_0x2b2514['query'][_0xb7e4('0x47')](_0xb7e4('0x48'))){_0x10dc8e[_0xb7e4('0x19')]=qs[_0xb7e4('0x19')](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x19')]);_0x10dc8e[_0xb7e4('0x17')]=qs['offset'](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x17')]);}_0x10dc8e[_0xb7e4('0x49')]=qs[_0xb7e4('0x4a')](_0x2b2514['query'][_0xb7e4('0x4a')]);_0x10dc8e[_0xb7e4('0x4b')]=qs[_0xb7e4('0x42')](_[_0xb7e4('0x4c')](_0x2b2514[_0xb7e4('0x40')],_0x438028[_0xb7e4('0x42')]),_0x46099b);var _0x271a84=[];var _0x1a6720=squel[_0xb7e4('0x4d')]()[_0xb7e4('0x4e')]('id')[_0xb7e4('0x4e')](_0xb7e4('0x23'))[_0xb7e4('0x4e')](_0xb7e4('0x4f'))[_0xb7e4('0x50')]('tools_tags');var _0x10b657=squel[_0xb7e4('0x4d')]()[_0xb7e4('0x4e')](_0xb7e4('0x51'))[_0xb7e4('0x4e')](_0xb7e4('0x52'))[_0xb7e4('0x4e')]('ui.MailInteractionId')[_0xb7e4('0x50')]('user_has_mail_interactions','ui')[_0xb7e4('0x53')](_0xb7e4('0x54'),'u',_0xb7e4('0x55'));var _0x1f324d=squel['select']()[_0xb7e4('0x50')](_0xb7e4('0x56'),'i')[_0xb7e4('0x53')](_0xb7e4('0x57'),'c',_0xb7e4('0x58'))[_0xb7e4('0x53')]('users','o',_0xb7e4('0x59'))[_0xb7e4('0x53')](_0xb7e4('0x5a'),'a',_0xb7e4('0x5b'))[_0xb7e4('0x53')](_0xb7e4('0x5c'),'me',_0xb7e4('0x5d'))[_0xb7e4('0x53')]('mail_interaction_has_tags','it',_0xb7e4('0x5e'))[_0xb7e4('0x53')]('tools_tags','t',_0xb7e4('0x5f'));var _0x59708c=squel[_0xb7e4('0x60')]();var _0x3737f8=[];var _0x41b8b0=squel[_0xb7e4('0x60')]();var _0x2dc919;if(_0x2b2514['query'][_0xb7e4('0x61')]){_0x2dc919=as[_0xb7e4('0x62')](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x61')]);var _0x47a367=_0x2dc919[_0xb7e4('0x63')];for(var _0x42a5cd=0x0;_0x42a5cd<_0x2dc919[_0xb7e4('0x64')][_0xb7e4('0x65')];_0x42a5cd++){var _0x3dbf14=_0x2dc919[_0xb7e4('0x64')][_0x42a5cd];var _0xeda5dd='i';var _0x169b29=_[_0xb7e4('0x66')](_0x46099b,[_0xb7e4('0x23'),_0x3dbf14['field']]);if(!_0x169b29){switch(_0x3dbf14['field']){case _0xb7e4('0x67'):if(_0x3dbf14[_0xb7e4('0x68')]==0x1){_0x1f324d[_0xb7e4('0x69')]('`'+_0x3dbf14[_0xb7e4('0x4e')]+'`\x20=\x200');}else{_0x1f324d['having']('`'+_0x3dbf14[_0xb7e4('0x4e')]+_0xb7e4('0x6a'));}break;case'Contact':if(_0x3dbf14[_0xb7e4('0x6b')]===_0xb7e4('0x6c')){if(_0x3dbf14[_0xb7e4('0x68')][_0xb7e4('0x29')]('\x20')[_0xb7e4('0x65')]>0x1){_0x59708c[_0x47a367](_0xb7e4('0x6d'),qs[_0xb7e4('0x6e')](_0x3dbf14['value']),null);}else{var _0x112d50='%'+_0x3dbf14[_0xb7e4('0x68')]+'%';_0x59708c[_0x47a367](_0xb7e4('0x6f'),_0x112d50,_0x112d50,_0x112d50);}}else{_0x169b29=_['find'](_0x46099b,[_0xb7e4('0x23'),_0xb7e4('0x70')]);_0x3dbf14[_0xb7e4('0x4e')]='ContactId';_0x6a7f93=as['buildExpression'](_0xeda5dd,_0x169b29[_0xb7e4('0x3d')],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x72')],_0x6a7f93[_0xb7e4('0x68')]['end']);}break;case _0xb7e4('0x73'):var _0x499b40=_0x3dbf14[_0xb7e4('0x68')]['split'](',')[_0xb7e4('0x3f')](function(_0x9ee872){return Number(_0x9ee872);});_0x499b40[_0xb7e4('0x2a')](function(_0x161bad){_0x41b8b0['or'](_0xb7e4('0x74'),'%,'+_0x161bad+',%');});_0x3737f8=_[_0xb7e4('0x75')](_0x3737f8,_0x499b40);break;case _0xb7e4('0x76'):if(_0x3dbf14[_0xb7e4('0x6b')]===_0xb7e4('0x6c')){_0x59708c[_0x47a367](_0xb7e4('0x77'),'%'+_0x3dbf14[_0xb7e4('0x68')]+'%',null);}else{_0x169b29=_['find'](_0x46099b,[_0xb7e4('0x23'),_0xb7e4('0x38')]);_0x3dbf14[_0xb7e4('0x4e')]=_0xb7e4('0x38');_0x6a7f93=as[_0xb7e4('0x78')](_0xeda5dd,_0x169b29['type'],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')]['start'],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x20')]);}break;case _0xb7e4('0x30'):_0x6a7f93=as[_0xb7e4('0x78')]('me',null,_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93['value'][_0xb7e4('0x72')],_0x6a7f93[_0xb7e4('0x68')]['end']);break;}}else{var _0x6a7f93=as[_0xb7e4('0x78')](_0xeda5dd,_0x169b29[_0xb7e4('0x3d')],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x72')],_0x6a7f93['value'][_0xb7e4('0x20')]);}}}else{var _0x1790e1=_(_0x2b2514[_0xb7e4('0x40')])[_0xb7e4('0x41')]()[_0xb7e4('0x3f')](function(_0x45f279){return _['some'](_0x46099b,[_0xb7e4('0x23'),_0x45f279])?_0x45f279:undefined;})[_0xb7e4('0x79')]()['value']();if(!_[_0xb7e4('0x7a')](_0x1790e1)){_0x1790e1[_0xb7e4('0x2a')](function(_0x2dd900){if(_0x2dd900===_0xb7e4('0x7b')){_0x1f324d['where'](_0xb7e4('0x7c'),[][_0xb7e4('0x7d')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900]));}else if(_0x2dd900===_0xb7e4('0x7e')){var _0x1d39a3=JSON[_0xb7e4('0x7f')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900])['$gte'];var _0x540388=JSON[_0xb7e4('0x7f')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900])['$lte'];_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x80'),_0x1d39a3,_0x540388);}else{if(_0x2b2514[_0xb7e4('0x40')][_0x2dd900]===_0xb7e4('0x81')){_0x1f324d[_0xb7e4('0x4b')]('i.'+_0x2dd900+'\x20IS\x20NULL');}else{_0x1f324d[_0xb7e4('0x4b')]('i.'+_0x2dd900+_0xb7e4('0x82'),_0x2b2514['query'][_0x2dd900]);}}});}if(_0x2b2514['query'][_0xb7e4('0x83')]){if(_0x2b2514[_0xb7e4('0x40')]['read']==0x1){_0x1f324d[_0xb7e4('0x69')](_0xb7e4('0x84'));}else{_0x1f324d['having'](_0xb7e4('0x85'));}}if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]){_0x3737f8=_['isArray'](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')])?_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]:new Array(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]);_0x3737f8[_0xb7e4('0x2a')](function(_0x49b60c){_0x41b8b0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49b60c+',%');});}if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x87')]){var _0x552f2b=_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x87')][_0xb7e4('0x88')]('\x5c','\x5c\x5c')[_0xb7e4('0x88')](/'/g,'\x27\x27');if(qs[_0xb7e4('0x89')](_0x552f2b)){_0x59708c['or'](_0xb7e4('0x8a'),_0x552f2b+'%');}else if(qs[_0xb7e4('0x8b')](_0x552f2b)){_0x59708c['or']('c.email\x20LIKE\x20?',_0x552f2b+'%');}else{_0x59708c['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x552f2b))['or'](_0xb7e4('0x8c'),qs[_0xb7e4('0x6e')](_0x552f2b));}}}_0x1f324d[_0xb7e4('0x4b')](_0x59708c);_0x1f324d[_0xb7e4('0x8d')](_0xb7e4('0x8e'));var _0x15d423={'type':db[_0xb7e4('0x8f')][_0xb7e4('0x90')]['SELECT'],'raw':!![]};var _0x3058f7=_0x1f324d[_0xb7e4('0x91')]();_0x3058f7[_0xb7e4('0x4e')](_0xb7e4('0x8e'));_0x3058f7[_0xb7e4('0x4e')](_0xb7e4('0x92'),_0xb7e4('0x67'));if(_0x10dc8e['order']){_0x10dc8e[_0xb7e4('0x49')][_0xb7e4('0x2a')](function(_0x58a45a){var _0x3bf685=_0x58a45a[0x0]==='contactName'?_0x58a45a[0x0]:'i.'+_0x58a45a[0x0];_0x1f324d[_0xb7e4('0x49')](_0x3bf685,_0x58a45a[0x1]===_0xb7e4('0x93')?![]:!![]);});}if(!_[_0xb7e4('0x7a')](_0x3737f8)){_0x1f324d[_0xb7e4('0x69')](_0x41b8b0);_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x94'),_0x3737f8);}BPromise['resolve']()[_0xb7e4('0x1f')](function(){if(!_0x2dc919){if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x7b')])return;_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x95'));_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x95'));return;}if(_0x2b2514[_0xb7e4('0x96')]['role']!==_0xb7e4('0x97'))return;return _0x2b2514['user'][_0xb7e4('0x98')]({'attributes':['id'],'raw':!![]})[_0xb7e4('0x1f')](function(_0x272b8d){if(_['isEmpty'](_0x272b8d)){_0x3058f7[_0xb7e4('0x4b')]('i.MailAccountId\x20IS\x20NULL');_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x99'));}else{_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x7c'),_[_0xb7e4('0x3f')](_0x272b8d,'id'));_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x7c'),_['map'](_0x272b8d,'id'));}});})[_0xb7e4('0x1f')](function(){if(_0x2b2514[_0xb7e4('0x96')]['role']===_0xb7e4('0x97')&&!_0x2dc919&&!_0x2b2514[_0xb7e4('0x40')]['MailAccountId'])return[];return db['sequelize'][_0xb7e4('0x40')](_0x3058f7[_0xb7e4('0x9a')](),_0x15d423);})['then'](function(_0x150834){_0x540dab['count']=_0x150834[_0xb7e4('0x65')];if(_0x540dab[_0xb7e4('0x1a')]===0x0)return[];return db['sequelize'][_0xb7e4('0x40')](_0x1a6720[_0xb7e4('0x9a')](),_0x15d423)[_0xb7e4('0x1f')](function(_0x37ba22){_0x271a84=_[_0xb7e4('0x9b')](_0x37ba22,'id');_0x15d423=_[_0xb7e4('0x9c')](_0x15d423,{'model':db[_0xb7e4('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b2514['query']['fields']){_0x10dc8e[_0xb7e4('0x45')]['forEach'](function(_0x34ee6b){_0x1f324d[_0xb7e4('0x4e')]('i.'+_0x34ee6b);});}else{_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x92'),_0xb7e4('0x67'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x9d'),_0xb7e4('0x9e'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x9f'),_0xb7e4('0xa0'));_0x1f324d['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',_0xb7e4('0xa1'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x8e'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa2'));_0x1f324d['field']('i.updatedAt');_0x1f324d[_0xb7e4('0x4e')]('i.closed');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa3'));_0x1f324d['field'](_0xb7e4('0xa4'));_0x1f324d['field'](_0xb7e4('0xa5'));_0x1f324d[_0xb7e4('0x4e')]('i.lastMsgDirection');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa6'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa7'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa8'));_0x1f324d[_0xb7e4('0x4e')]('i.thirdDisposition');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa9'));_0x1f324d['field'](_0xb7e4('0xaa'));_0x1f324d['field'](_0xb7e4('0xab'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xac'));_0x1f324d[_0xb7e4('0x4e')]('i.UserId');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xad'),_0xb7e4('0xae'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xaf'),_0xb7e4('0xb0'));_0x1f324d['field'](_0xb7e4('0xb1'),_0xb7e4('0xb2'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xb3'),_0xb7e4('0xb4'));_0x1f324d['field'](_0xb7e4('0xb5'),'Contact.mobile');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xb6'),_0xb7e4('0xb7'));_0x1f324d[_0xb7e4('0x4e')]('o.fullname',_0xb7e4('0xb8'));_0x1f324d[_0xb7e4('0x4e')]('o.internal',_0xb7e4('0xb9'));_0x1f324d['field'](_0xb7e4('0xba'),_0xb7e4('0x27'));}if(_0x10dc8e['limit'])_0x1f324d[_0xb7e4('0x19')](_0x10dc8e[_0xb7e4('0x19')]);if(_0x10dc8e[_0xb7e4('0x17')])_0x1f324d['offset'](_0x10dc8e[_0xb7e4('0x17')]);return db[_0xb7e4('0xbb')]['query'](_0x1f324d[_0xb7e4('0x9a')](),_0x15d423);})['then'](function(_0x27c2e9){if(_0x27c2e9[_0xb7e4('0x65')]>0x0)_0x10b657[_0xb7e4('0x4b')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x27c2e9,'id'));return db[_0xb7e4('0xbb')][_0xb7e4('0x40')](_0x10b657['toString'](),_0x15d423)[_0xb7e4('0x1f')](function(_0x4e67da){var _0x5cad96=_[_0xb7e4('0xbc')](_0x4e67da,_0xb7e4('0xbd'));var _0x34ea13=[];return db[_0xb7e4('0xbe')][_0xb7e4('0x2d')]({'attributes':[_0xb7e4('0xbf')],'raw':!![]})['then'](function(_0x159dd9){var _0x40491e=_0x159dd9[_0xb7e4('0xbf')];_0x27c2e9['forEach'](function(_0x277d36){_0x34ea13['push'](updateMailInteraction(_0x277d36,_0x271a84,_0x5cad96,_0x40491e));});return BPromise[_0xb7e4('0xc0')](_0x34ea13);});});});})['then'](function(_0x453b60){_0x540dab[_0xb7e4('0xc1')]=_0x453b60;return _0x540dab;})[_0xb7e4('0x1f')](respondWithFilteredResult(_0x4cf4ea,_0x10dc8e))[_0xb7e4('0x32')](handleError(_0x4cf4ea,null));};exports[_0xb7e4('0xc2')]=function(_0x2cf0d8,_0x271bba){var _0x29cc28={'raw':![],'where':{'id':_0x2cf0d8['params']['id']}},_0x477b85={};_0x477b85['model']=_[_0xb7e4('0x41')](db[_0xb7e4('0x3b')]['rawAttributes']);_0x477b85[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x2cf0d8[_0xb7e4('0x40')]);_0x477b85[_0xb7e4('0x42')]=_[_0xb7e4('0x43')](_0x477b85[_0xb7e4('0x44')],_0x477b85[_0xb7e4('0x40')]);_0x29cc28[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x477b85[_0xb7e4('0x44')],qs['fields'](_0x2cf0d8['query'][_0xb7e4('0x46')]));_0x29cc28['attributes']=_0x29cc28[_0xb7e4('0x45')]['length']?_0x29cc28[_0xb7e4('0x45')]:_0x477b85[_0xb7e4('0x44')];if(_0x2cf0d8[_0xb7e4('0x40')]['includeAll']){_0x29cc28['include']=[{'all':!![]}];}_0x29cc28=_[_0xb7e4('0x9c')]({},_0x29cc28,_0x2cf0d8[_0xb7e4('0xc3')]);return db[_0xb7e4('0x3b')][_0xb7e4('0x66')](_0x29cc28)[_0xb7e4('0x1f')](handleEntityNotFound(_0x271bba,null))[_0xb7e4('0x1f')](respondWithResult(_0x271bba,null))[_0xb7e4('0x32')](handleError(_0x271bba,null));};exports[_0xb7e4('0xc4')]=function(_0x306534,_0x1c3e09){return db['MailInteraction'][_0xb7e4('0xc4')](_0x306534['body'],{})[_0xb7e4('0x1f')](respondWithResult(_0x1c3e09,0xc9))[_0xb7e4('0x32')](handleError(_0x1c3e09,null));};exports[_0xb7e4('0x1d')]=function(_0x32e12a,_0x3e9a23){if(_0x32e12a[_0xb7e4('0xc5')]['id']){delete _0x32e12a[_0xb7e4('0xc5')]['id'];}return db[_0xb7e4('0x3b')]['find']({'where':{'id':_0x32e12a[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x3e9a23,null))[_0xb7e4('0x1f')](saveUpdates(_0x32e12a[_0xb7e4('0xc5')],null))['then'](respondWithResult(_0x3e9a23,null))['catch'](handleError(_0x3e9a23,null));};exports[_0xb7e4('0x1e')]=function(_0x476178,_0x597e37){return db['MailInteraction'][_0xb7e4('0x66')]({'where':{'id':_0x476178[_0xb7e4('0xc6')]['id']}})['then'](handleEntityNotFound(_0x597e37,null))['then'](removeEntity(_0x597e37,null))[_0xb7e4('0x32')](handleError(_0x597e37,null));};exports[_0xb7e4('0xc7')]=function(_0x1f541b,_0x4c4185){return db[_0xb7e4('0x3b')][_0xb7e4('0xc7')]()[_0xb7e4('0x1f')](respondWithResult(_0x4c4185,null))[_0xb7e4('0x32')](handleError(_0x4c4185,null));};exports['addMessage']=function(_0x3252da,_0xe2a683){return db[_0xb7e4('0x2c')][_0xb7e4('0x66')]({'where':{'id':_0x3252da[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0xe2a683,null))['then'](function(_0x3d2e8b){if(_0x3d2e8b){return _0x3d2e8b['addMessage'](_0x3252da[_0xb7e4('0xc5')][_0xb7e4('0xc8')],_[_0xb7e4('0xc9')](_0x3252da['body'],[_0xb7e4('0xc8'),'id'])||{});}})[_0xb7e4('0x1f')](respondWithResult(_0xe2a683,null))['catch'](handleError(_0xe2a683,null));};exports[_0xb7e4('0xca')]=function(_0x550170,_0x1997bc){var _0x42928b={'raw':![],'where':{}};var _0x3ec88c={};var _0x2bcf5f={'count':0x0,'rows':[]};return db[_0xb7e4('0x3b')][_0xb7e4('0x2d')]({'where':{'id':_0x550170[_0xb7e4('0xc6')]['id']}})['then'](handleEntityNotFound(_0x1997bc,null))['then'](function(_0x13d80e){if(_0x13d80e){_0x3ec88c[_0xb7e4('0x44')]=_[_0xb7e4('0x41')](db[_0xb7e4('0x2c')][_0xb7e4('0xcb')]);_0x3ec88c[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x550170[_0xb7e4('0x40')]);_0x3ec88c[_0xb7e4('0x42')]=_['intersection'](_0x3ec88c['model'],_0x3ec88c['query']);_0x42928b[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x3ec88c[_0xb7e4('0x44')],qs[_0xb7e4('0x46')](_0x550170[_0xb7e4('0x40')][_0xb7e4('0x46')]));_0x42928b[_0xb7e4('0x45')]=_0x42928b['attributes']['length']?_0x42928b[_0xb7e4('0x45')]:_0x3ec88c['model'];if(!_0x550170[_0xb7e4('0x40')][_0xb7e4('0x47')](_0xb7e4('0x48'))){_0x42928b['limit']=qs[_0xb7e4('0x19')](_0x550170['query']['limit']);_0x42928b[_0xb7e4('0x17')]=qs[_0xb7e4('0x17')](_0x550170[_0xb7e4('0x40')][_0xb7e4('0x17')]);}_0x42928b[_0xb7e4('0x49')]=qs['sort'](_0x550170['query'][_0xb7e4('0x4a')]);_0x42928b[_0xb7e4('0x4b')]=qs[_0xb7e4('0x42')](_['pick'](_0x550170[_0xb7e4('0x40')],_0x3ec88c[_0xb7e4('0x42')]));_0x42928b[_0xb7e4('0x4b')]['MailInteractionId']=_0x13d80e['id'];if(_0x550170[_0xb7e4('0x40')][_0xb7e4('0x87')]){_0x42928b[_0xb7e4('0x4b')]=_[_0xb7e4('0x9c')](_0x42928b[_0xb7e4('0x4b')],{'$or':_['map'](_0x42928b[_0xb7e4('0x45')],function(_0x3da9a7){var _0x3e1625={};_0x3e1625[_0x3da9a7]={'$like':'%'+_0x550170[_0xb7e4('0x40')]['filter']+'%'};return _0x3e1625;})});}if(_0x550170[_0xb7e4('0x40')][_0xb7e4('0xcc')]){var _0x2cc578=_0x550170[_0xb7e4('0x40')]['$gte'][_0xb7e4('0x29')](',');var _0x380f5d={};_0x380f5d[_0x2cc578[0x0]]={'$gte':moment(_0x2cc578[0x1])[_0xb7e4('0xcd')](_0xb7e4('0xce'))};_0x42928b['where']=_[_0xb7e4('0x9c')](_0x42928b['where'],_0x380f5d);}_0x42928b=_[_0xb7e4('0x9c')]({},_0x42928b,_0x550170['options']);return db[_0xb7e4('0x2c')]['count']({'where':_0x42928b['where']})[_0xb7e4('0x1f')](function(_0x5268d4){_0x2bcf5f[_0xb7e4('0x1a')]=_0x5268d4;if(_0x550170['query'][_0xb7e4('0xcf')]){_0x42928b[_0xb7e4('0xd0')]=[{'all':!![]}];}return db[_0xb7e4('0x2c')][_0xb7e4('0xd1')](_0x42928b);})['then'](function(_0x1c0526){if(_0x550170['query'][_0xb7e4('0xd2')]===_0xb7e4('0xd3')){for(var _0x183b24=0x0;_0x183b24<_0x1c0526[_0xb7e4('0x65')];_0x183b24++){_0x1c0526[_0x183b24]['body']=juice(_0x1c0526[_0x183b24][_0xb7e4('0xc5')]);}}_0x2bcf5f[_0xb7e4('0xc1')]=_0x1c0526;return _0x2bcf5f;});}})['then'](respondWithFilteredResult(_0x1997bc,_0x42928b))['catch'](handleError(_0x1997bc,null));};exports['addTags']=function(_0x3bdfbe,_0x59968e){return db[_0xb7e4('0x3b')]['find']({'where':{'id':_0x3bdfbe[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x59968e,null))[_0xb7e4('0x1f')](function(_0x23997c){if(_0x23997c){return _0x23997c['setTags'](_0x3bdfbe[_0xb7e4('0xc5')][_0xb7e4('0xc8')],_['omit'](_0x3bdfbe[_0xb7e4('0xc5')],[_0xb7e4('0xc8'),'id'])||{})[_0xb7e4('0xd4')](function(){return db[_0xb7e4('0x73')][_0xb7e4('0xd1')]({'attributes':['id','name',_0xb7e4('0x4f')],'where':{'id':_0x3bdfbe[_0xb7e4('0xc5')]['ids']}});})[_0xb7e4('0x1f')](function(_0x503a66){socket[_0xb7e4('0xd5')](_0xb7e4('0xd6'),{'id':Number(_0x3bdfbe[_0xb7e4('0xc6')]['id']),'tags':_0x503a66||[]});return{'id':Number(_0x3bdfbe[_0xb7e4('0xc6')]['id']),'tags':_0x503a66||[]};});}})[_0xb7e4('0x1f')](respondWithResult(_0x59968e,null))[_0xb7e4('0x32')](handleError(_0x59968e,null));};exports[_0xb7e4('0xd7')]=function(_0x323861,_0x35a0ec){return db['MailInteraction'][_0xb7e4('0x66')]({'where':{'id':_0x323861[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x35a0ec,null))[_0xb7e4('0x1f')](function(_0x364ec7){if(_0x364ec7){return _0x364ec7['removeTags'](_0x323861[_0xb7e4('0x40')][_0xb7e4('0xc8')]);}})[_0xb7e4('0x1f')](respondWithStatusCode(_0x35a0ec,null))[_0xb7e4('0x32')](handleError(_0x35a0ec,null));};exports['download']=function(_0x53ee09,_0x1e24e2){var _0x1ae16d=moment()['unix']()[_0xb7e4('0x9a')]();var _0x4cf9aa=path[_0xb7e4('0xd8')](config[_0xb7e4('0xd9')],_0xb7e4('0xda'),_0xb7e4('0xdb'),_0xb7e4('0xdc'));var _0x5f0884=path['join'](config[_0xb7e4('0xd9')],_0xb7e4('0xda'),'files','attachments');var _0x89b0da=path[_0xb7e4('0xd8')](_0x4cf9aa,_0x1ae16d);var _0xc94235=util['format'](_0xb7e4('0xdd'),_0x53ee09[_0xb7e4('0xc6')]['id'],_0x1ae16d);var _0x304d49=path[_0xb7e4('0xd8')](_0x4cf9aa,_0xc94235);var _0x539440=[];if(_0x53ee09[_0xb7e4('0x40')][_0xb7e4('0xde')]){_0x539440[_0xb7e4('0x2b')]({'model':db[_0xb7e4('0xdf')],'as':_0xb7e4('0xe0'),'raw':!![]});}var _0x34acaa=[{'model':db[_0xb7e4('0x2c')],'as':_0xb7e4('0xe1'),'attributes':['id','body',_0xb7e4('0x50'),'to','cc','bcc','subject',_0xb7e4('0x7e')],'where':{'secret':![]},'order':qs[_0xb7e4('0x4a')]('id'),'include':_0x539440}];return db[_0xb7e4('0x3b')][_0xb7e4('0x66')]({'where':{'id':_0x53ee09[_0xb7e4('0xc6')]['id']},'include':_0x34acaa})[_0xb7e4('0x1f')](handleEntityNotFound(_0x1e24e2,null))[_0xb7e4('0x1f')](function(_0x3decfa){if(_0x3decfa&&_0x3decfa[_0xb7e4('0xe1')]){var _0xbe6d27=_0x3decfa[_0xb7e4('0xe2')]({'plain':!![]});fs[_0xb7e4('0xe3')](_0x89b0da);return BPromise[_0xb7e4('0xe4')](_0xbe6d27[_0xb7e4('0xe1')],function(_0x40358a,_0x5ce7f2){var _0x714fb2={'from':_0x40358a[_0xb7e4('0x50')],'to':_0x40358a['to'],'subject':_0x40358a[_0xb7e4('0xe5')],'html':htmlEntities[_0xb7e4('0xe6')](_0x40358a[_0xb7e4('0xc5')]),'headers':{'Date':moment(_0x40358a[_0xb7e4('0x7e')])[_0xb7e4('0xcd')](_0xb7e4('0xe7'))},'attachments':[]};if(_0x40358a['cc']){_0x714fb2[_0xb7e4('0xe8')]['Cc']=_0x40358a['cc'];}if(_0x40358a[_0xb7e4('0xe9')]){_0x714fb2[_0xb7e4('0xe8')][_0xb7e4('0xea')]=_0x40358a[_0xb7e4('0xe9')];}return new BPromise(function(_0x2a2c8f,_0x4312fb){if(_0x40358a['Attachments']){for(var _0x501329=0x0;_0x501329<_0x40358a[_0xb7e4('0xe0')][_0xb7e4('0x65')];_0x501329++){var _0x32cd1b=_0x40358a[_0xb7e4('0xe0')][_0x501329];var _0x3b8c8d=path[_0xb7e4('0xd8')](_0x5f0884,_0x32cd1b[_0xb7e4('0xeb')]);if(fs['existsSync'](_0x3b8c8d)){_0x714fb2['attachments'][_0xb7e4('0x2b')]({'name':_0x32cd1b[_0xb7e4('0x23')],'contentType':_0x32cd1b['type'],'data':fs[_0xb7e4('0xec')](_0x3b8c8d)});}}}emlformat[_0xb7e4('0xed')](_0x714fb2,function(_0x3f3b6c,_0x5268c2){if(_0x3f3b6c)return _0x4312fb(_0x3f3b6c);fs[_0xb7e4('0xee')](path[_0xb7e4('0xd8')](_0x89b0da,util[_0xb7e4('0xcd')](_0xb7e4('0xef'),_0x5ce7f2)),_0x5268c2);return _0x2a2c8f(_0x5268c2);});});})[_0xb7e4('0x1f')](function(){return new BPromise(function(_0x27768b,_0x4e9fb0){zipdir(_0x89b0da,{'saveTo':_0x304d49},function(_0xf9e987,_0x3f06e7){if(_0xf9e987)return _0x4e9fb0(_0xf9e987);return _0x27768b(_0x3f06e7);});})['then'](function(){return new BPromise(function(_0x166a6e,_0xd30902){rimraf(_0x89b0da,function(_0x396e54){if(_0x396e54)_0xd30902(_0x396e54);return _0x166a6e();});});})[_0xb7e4('0x1f')](function(){return _0x1e24e2[_0xb7e4('0xf0')](_0x304d49,_0xc94235,function(_0x3f873d){if(!_0x3f873d)fs[_0xb7e4('0xf1')](_0x304d49);});});});}else{return _0x1e24e2[_0xb7e4('0x14')](0xc8);}})['catch'](handleError(_0x1e24e2,null));}; \ No newline at end of file +var _0x2675=['concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','MailAccountId','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.MailAccountId','c.firstName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','enableEmailPreview','push','all','show','rawAttributes','includeAll','include','options','create','body','update','params','describe','addMessage','MailMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','spread','findAll','color','mailInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','transcript-%d-%s.zip','attachments','bcc','subject','Messages','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','socket.io-emitter','./mailInteraction.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','sendStatus','send','Users','map','TagIds','split','forEach','Tags','findOne','out','plainBody','lastMsgText','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','MailInteraction','fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','field','from','select','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','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','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','keys','some','isEmpty','where','i.MailAccountId\x20IN\x20?'];(function(_0x491082,_0x28f78b){var _0x5797d9=function(_0x20d0ba){while(--_0x20d0ba){_0x491082['push'](_0x491082['shift']());}};_0x5797d9(++_0x28f78b);}(_0x2675,0x75));var _0x5267=function(_0x3983a0,_0x37a2ab){_0x3983a0=_0x3983a0-0x0;var _0x1c06ff=_0x2675[_0x3983a0];return _0x1c06ff;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x5267('0x1'));var util=require(_0x5267('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x5267('0x3'));var squel=require(_0x5267('0x4'));var juice=require('juice');var Redis=require(_0x5267('0x5'));var qs=require(_0x5267('0x6'));var as=require(_0x5267('0x7'));var logger=require(_0x5267('0x8'))(_0x5267('0x9'));var config=require(_0x5267('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x5267('0xb'));config[_0x5267('0xc')]=_['defaults'](config[_0x5267('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5267('0xd'))(new Redis(config[_0x5267('0xc')]));require(_0x5267('0xe'))['register'](socket);function respondWithStatusCode(_0x3e6964,_0x5060b3){_0x5060b3=_0x5060b3||0xcc;return function(_0x445151){if(_0x445151){return _0x3e6964['sendStatus'](_0x5060b3);}return _0x3e6964[_0x5267('0xf')](_0x5060b3)[_0x5267('0x10')]();};}function respondWithResult(_0x268a8a,_0x1f9be3){_0x1f9be3=_0x1f9be3||0xc8;return function(_0x1d7090){if(_0x1d7090){return _0x268a8a[_0x5267('0xf')](_0x1f9be3)[_0x5267('0x11')](_0x1d7090);}};}function respondWithFilteredResult(_0x36dc17,_0x3e19e4){return function(_0x1e2d3b){if(_0x1e2d3b){var _0x16e5a7=typeof _0x3e19e4[_0x5267('0x12')]===_0x5267('0x13')&&typeof _0x3e19e4['limit']==='undefined';var _0xa593fb=_0x1e2d3b[_0x5267('0x14')];var _0x38a147=_0x16e5a7?0x0:_0x3e19e4[_0x5267('0x12')];var _0x46b2c2=_0x16e5a7?_0x1e2d3b[_0x5267('0x14')]:_0x3e19e4[_0x5267('0x12')]+_0x3e19e4[_0x5267('0x15')];var _0x15d81e;if(_0x46b2c2>=_0xa593fb){_0x46b2c2=_0xa593fb;_0x15d81e=0xc8;}else{_0x15d81e=0xce;}_0x36dc17[_0x5267('0xf')](_0x15d81e);return _0x36dc17[_0x5267('0x16')](_0x5267('0x17'),_0x38a147+'-'+_0x46b2c2+'/'+_0xa593fb)['json'](_0x1e2d3b);}return null;};}function saveUpdates(_0x18f32e){return function(_0x2afd38){if(_0x2afd38){return _0x2afd38['update'](_0x18f32e)[_0x5267('0x18')](function(_0x56733e){return _0x56733e;});}return null;};}function removeEntity(_0x1cf835){return function(_0x1019e7){if(_0x1019e7){return _0x1019e7[_0x5267('0x19')]()[_0x5267('0x18')](function(){_0x1cf835[_0x5267('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100fcd){return function(_0x5aebdd){if(!_0x5aebdd){_0x100fcd[_0x5267('0x1a')](0x194);}return _0x5aebdd;};}function handleError(_0x420fb8,_0x3b53ac){_0x3b53ac=_0x3b53ac||0x1f4;return function(_0x56dd95){logger['error'](_0x56dd95['stack']);if(_0x56dd95['name']){delete _0x56dd95['name'];}_0x420fb8[_0x5267('0xf')](_0x3b53ac)[_0x5267('0x1b')](_0x56dd95);};}function getInteractionUsers(_0x2d761d,_0x279377){return new BPromise(function(_0x11c8ea,_0x40d1be){try{if(_0x279377[_0x2d761d['id']]){_0x2d761d[_0x5267('0x1c')]=_[_0x5267('0x1d')](_0x279377[_0x2d761d['id']],function(_0x2cdc45){return{'id':_0x2cdc45['id'],'fullname':_0x2cdc45['fullname']};});}}catch(_0x5cb64f){_0x40d1be(_0x5cb64f);}_0x11c8ea(_0x2d761d);});}function getInteractionTags(_0x354111,_0x472938){return new BPromise(function(_0x5abf95,_0x45373e){try{if(_0x354111['TagIds']){_0x354111['Tags']=[];_0x354111[_0x5267('0x1e')][_0x5267('0x1f')](',')[_0x5267('0x20')](function(_0x2d2ace){_0x354111[_0x5267('0x21')]['push'](_0x472938[_0x2d2ace]);});}delete _0x354111['TagIds'];}catch(_0x18020c){_0x45373e(_0x18020c);}_0x5abf95(_0x354111);});}function getLastMessageText(_0x10a68c){return new BPromise(function(_0x24496d,_0x549a66){return db['MailMessage'][_0x5267('0x22')]({'where':{'$and':[{'MailInteractionId':_0x10a68c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5267('0x23')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5267('0x24')],'order':'-id','raw':!![]})['then'](function(_0x2249a1){if(_0x2249a1&&_0x2249a1[_0x5267('0x24')]){_0x10a68c[_0x5267('0x25')]=_[_0x5267('0x26')](_0x2249a1['plainBody']);}_0x24496d(_0x10a68c);})[_0x5267('0x27')](function(_0x1a7f4b){_0x549a66(_0x1a7f4b);});});}function updateMailInteraction(_0x4344c5,_0xf8d7a3,_0x1eb8d8,_0xd65cb1){return new BPromise(function(_0x341bae,_0x1dda95){return getInteractionUsers(_0x4344c5,_0x1eb8d8)['then'](function(_0x4f372c){return getInteractionTags(_0x4f372c,_0xf8d7a3);})[_0x5267('0x18')](function(_0x51c372){return getStateInteraction(_0x51c372);})[_0x5267('0x18')](function(_0x100097){if(_0xd65cb1){_0x341bae(getLastMessageText(_0x100097));}else{_0x341bae(_0x100097);}})[_0x5267('0x27')](function(_0x3a729c){_0x1dda95(_0x3a729c);});});}function getStateInteraction(_0x4ac4a0){return new BPromise(function(_0x305863){_0x4ac4a0[_0x5267('0x28')]=0x0;_0x4ac4a0[_0x5267('0x29')]=0x0;_0x4ac4a0[_0x5267('0x2a')]=0x0;_0x4ac4a0[_0x5267('0x2b')]=0x0;_0x4ac4a0[_0x5267('0x2c')]=0x0;if(!_0x4ac4a0[_0x5267('0x2d')]&&!_0x4ac4a0[_0x5267('0x2e')]){_0x4ac4a0['waiting']+=0x1;}if(!_0x4ac4a0[_0x5267('0x2d')]&&_0x4ac4a0['UserId']){_0x4ac4a0[_0x5267('0x29')]+=0x1;if(_0x4ac4a0[_0x5267('0x28')]){_0x4ac4a0[_0x5267('0x28')]-=0x1;}}if(_0x4ac4a0[_0x5267('0x2d')]&&_0x4ac4a0[_0x5267('0x2e')]){_0x4ac4a0[_0x5267('0x2a')]+=0x1;if(_0x4ac4a0[_0x5267('0x29')]){_0x4ac4a0['talking']-=0x1;}}if(_0x4ac4a0[_0x5267('0x2d')]&&!_0x4ac4a0[_0x5267('0x2e')]){_0x4ac4a0[_0x5267('0x2b')]+=0x1;if(_0x4ac4a0[_0x5267('0x28')]){_0x4ac4a0[_0x5267('0x28')]-=0x1;}}_0x4ac4a0[_0x5267('0x2c')]+=0x1;_0x305863(_0x4ac4a0);});}exports[_0x5267('0x2f')]=function(_0x487dfc,_0x2dc5cc){var _0x5ef02e={},_0x3db34d={},_0x5c0cdf={'count':0x0,'rows':[]};var _0x4dee66=_['map'](db[_0x5267('0x30')]['rawAttributes'],function(_0xf33688){return{'name':_0xf33688[_0x5267('0x31')],'type':_0xf33688[_0x5267('0x32')][_0x5267('0x33')]};});_0x3db34d['model']=_[_0x5267('0x1d')](_0x4dee66,_0x5267('0x34'));_0x3db34d['query']=_['keys'](_0x487dfc[_0x5267('0x35')]);_0x3db34d['filters']=_[_0x5267('0x36')](_0x3db34d[_0x5267('0x37')],_0x3db34d[_0x5267('0x35')]);_0x5ef02e[_0x5267('0x38')]=_[_0x5267('0x36')](_0x3db34d[_0x5267('0x37')],qs[_0x5267('0x39')](_0x487dfc['query']['fields']));_0x5ef02e[_0x5267('0x38')]=_0x5ef02e['attributes'][_0x5267('0x3a')]?_0x5ef02e[_0x5267('0x38')]:_0x3db34d['model'];if(!_0x487dfc[_0x5267('0x35')][_0x5267('0x3b')](_0x5267('0x3c'))){_0x5ef02e[_0x5267('0x15')]=qs[_0x5267('0x15')](_0x487dfc[_0x5267('0x35')][_0x5267('0x15')]);_0x5ef02e[_0x5267('0x12')]=qs[_0x5267('0x12')](_0x487dfc['query'][_0x5267('0x12')]);}_0x5ef02e[_0x5267('0x3d')]=qs[_0x5267('0x3e')](_0x487dfc[_0x5267('0x35')][_0x5267('0x3e')]);_0x5ef02e['where']=qs[_0x5267('0x3f')](_['pick'](_0x487dfc[_0x5267('0x35')],_0x3db34d['filters']),_0x4dee66);var _0x4ae9f9=[];var _0x37ec6c=squel['select']()[_0x5267('0x40')]('id')[_0x5267('0x40')](_0x5267('0x34'))[_0x5267('0x40')]('color')[_0x5267('0x41')]('tools_tags');var _0x4b8db5=squel[_0x5267('0x42')]()[_0x5267('0x40')]('u.id')['field'](_0x5267('0x43'))[_0x5267('0x40')](_0x5267('0x44'))[_0x5267('0x41')](_0x5267('0x45'),'ui')[_0x5267('0x46')](_0x5267('0x47'),'u',_0x5267('0x48'));var _0x4332c7=squel[_0x5267('0x42')]()[_0x5267('0x41')](_0x5267('0x49'),'i')[_0x5267('0x46')](_0x5267('0x4a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5267('0x46')](_0x5267('0x47'),'o',_0x5267('0x4b'))['left_join'](_0x5267('0x4c'),'a',_0x5267('0x4d'))[_0x5267('0x46')](_0x5267('0x4e'),'me',_0x5267('0x4f'))[_0x5267('0x46')]('mail_interaction_has_tags','it',_0x5267('0x50'))['left_join'](_0x5267('0x51'),'t',_0x5267('0x52'));var _0xa49fd7=squel[_0x5267('0x53')]();var _0x91b932=[];var _0x3f9664=squel[_0x5267('0x53')]();var _0x577c1a;if(_0x487dfc['query'][_0x5267('0x54')]){_0x577c1a=as[_0x5267('0x55')](_0x487dfc['query'][_0x5267('0x54')]);var _0x578e4e=_0x577c1a['sqlOperator'];for(var _0x1eeb21=0x0;_0x1eeb21<_0x577c1a[_0x5267('0x56')][_0x5267('0x3a')];_0x1eeb21++){var _0x194519=_0x577c1a[_0x5267('0x56')][_0x1eeb21];var _0x3e7e6a='i';var _0xe33b95=_[_0x5267('0x57')](_0x4dee66,[_0x5267('0x34'),_0x194519[_0x5267('0x40')]]);if(!_0xe33b95){switch(_0x194519['field']){case _0x5267('0x58'):if(_0x194519[_0x5267('0x59')]==0x1){_0x4332c7[_0x5267('0x5a')]('`'+_0x194519[_0x5267('0x40')]+_0x5267('0x5b'));}else{_0x4332c7[_0x5267('0x5a')]('`'+_0x194519['field']+_0x5267('0x5c'));}break;case'Contact':if(_0x194519[_0x5267('0x5d')]===_0x5267('0x5e')){if(_0x194519[_0x5267('0x59')]['split']('\x20')[_0x5267('0x3a')]>0x1){_0xa49fd7[_0x578e4e](_0x5267('0x5f'),qs[_0x5267('0x60')](_0x194519[_0x5267('0x59')]),null);}else{var _0x316988='%'+_0x194519[_0x5267('0x59')]+'%';_0xa49fd7[_0x578e4e]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x316988,_0x316988,_0x316988);}}else{_0xe33b95=_[_0x5267('0x57')](_0x4dee66,[_0x5267('0x34'),_0x5267('0x61')]);_0x194519[_0x5267('0x40')]='ContactId';_0x3745b3=as['buildExpression'](_0x3e7e6a,_0xe33b95[_0x5267('0x32')],_0x194519);_0xa49fd7[_0x578e4e](_0x3745b3['text'],_0x3745b3[_0x5267('0x59')][_0x5267('0x62')],_0x3745b3['value']['end']);}break;case _0x5267('0x63'):var _0x1f01e4=_0x194519[_0x5267('0x59')]['split'](',')[_0x5267('0x1d')](function(_0xc88193){return Number(_0xc88193);});_0x1f01e4[_0x5267('0x20')](function(_0x2043e8){_0x3f9664['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2043e8+',%');});_0x91b932=_['union'](_0x91b932,_0x1f01e4);break;case'User':if(_0x194519[_0x5267('0x5d')]===_0x5267('0x5e')){_0xa49fd7[_0x578e4e](_0x5267('0x64'),'%'+_0x194519[_0x5267('0x59')]+'%',null);}else{_0xe33b95=_[_0x5267('0x57')](_0x4dee66,[_0x5267('0x34'),_0x5267('0x2e')]);_0x194519[_0x5267('0x40')]='UserId';_0x3745b3=as[_0x5267('0x65')](_0x3e7e6a,_0xe33b95[_0x5267('0x32')],_0x194519);_0xa49fd7[_0x578e4e](_0x3745b3['text'],_0x3745b3[_0x5267('0x59')][_0x5267('0x62')],_0x3745b3[_0x5267('0x59')][_0x5267('0x10')]);}break;case _0x5267('0x24'):_0x3745b3=as[_0x5267('0x65')]('me',null,_0x194519);_0xa49fd7[_0x578e4e](_0x3745b3['text'],_0x3745b3[_0x5267('0x59')][_0x5267('0x62')],_0x3745b3[_0x5267('0x59')][_0x5267('0x10')]);break;}}else{var _0x3745b3=as[_0x5267('0x65')](_0x3e7e6a,_0xe33b95['type'],_0x194519);_0xa49fd7[_0x578e4e](_0x3745b3[_0x5267('0x66')],_0x3745b3[_0x5267('0x59')][_0x5267('0x62')],_0x3745b3[_0x5267('0x59')][_0x5267('0x10')]);}}}else{var _0x3384c6=_(_0x487dfc['query'])[_0x5267('0x67')]()[_0x5267('0x1d')](function(_0x9aef0){return _[_0x5267('0x68')](_0x4dee66,['name',_0x9aef0])?_0x9aef0:undefined;})['compact']()['value']();if(!_[_0x5267('0x69')](_0x3384c6)){_0x3384c6['forEach'](function(_0xd7789e){if(_0xd7789e==='MailAccountId'){_0x4332c7[_0x5267('0x6a')](_0x5267('0x6b'),[][_0x5267('0x6c')](_0x487dfc[_0x5267('0x35')][_0xd7789e]));}else if(_0xd7789e===_0x5267('0x6d')){var _0xa92aa5=JSON[_0x5267('0x6e')](_0x487dfc[_0x5267('0x35')][_0xd7789e])['$gte'];var _0x489f46=JSON['parse'](_0x487dfc[_0x5267('0x35')][_0xd7789e])[_0x5267('0x6f')];_0x4332c7[_0x5267('0x6a')](_0x5267('0x70'),_0xa92aa5,_0x489f46);}else{if(_0x487dfc['query'][_0xd7789e]===_0x5267('0x71')){_0x4332c7[_0x5267('0x6a')]('i.'+_0xd7789e+_0x5267('0x72'));}else{_0x4332c7[_0x5267('0x6a')]('i.'+_0xd7789e+'\x20=\x20?',_0x487dfc[_0x5267('0x35')][_0xd7789e]);}}});}if(_0x487dfc[_0x5267('0x35')]['read']){if(_0x487dfc[_0x5267('0x35')][_0x5267('0x73')]==0x1){_0x4332c7['having']('`unreadMessages`\x20=\x200');}else{_0x4332c7[_0x5267('0x5a')](_0x5267('0x74'));}}if(_0x487dfc['query']['tag']){_0x91b932=_[_0x5267('0x75')](_0x487dfc[_0x5267('0x35')][_0x5267('0x76')])?_0x487dfc[_0x5267('0x35')][_0x5267('0x76')]:new Array(_0x487dfc['query'][_0x5267('0x76')]);_0x91b932[_0x5267('0x20')](function(_0x538786){_0x3f9664['or'](_0x5267('0x77'),'%,'+_0x538786+',%');});}if(_0x487dfc[_0x5267('0x35')][_0x5267('0x78')]){var _0xb6f237=_0x487dfc[_0x5267('0x35')][_0x5267('0x78')][_0x5267('0x79')]('\x5c','\x5c\x5c')[_0x5267('0x79')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xb6f237)){_0xa49fd7['or']('i.id\x20LIKE\x20?',_0xb6f237+'%');}else if(qs[_0x5267('0x7a')](_0xb6f237)){_0xa49fd7['or'](_0x5267('0x7b'),_0xb6f237+'%');}else{_0xa49fd7['or'](_0x5267('0x7c'),qs[_0x5267('0x60')](_0xb6f237))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5267('0x60')](_0xb6f237));}}}_0x4332c7['where'](_0xa49fd7);_0x4332c7[_0x5267('0x7d')](_0x5267('0x7e'));var _0x1bf43a={'type':db[_0x5267('0x7f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3a67a0=_0x4332c7[_0x5267('0x80')]();_0x3a67a0[_0x5267('0x40')](_0x5267('0x7e'));_0x3a67a0[_0x5267('0x40')](_0x5267('0x81'),'unreadMessages');if(_0x5ef02e[_0x5267('0x3d')]){_0x5ef02e['order'][_0x5267('0x20')](function(_0x5b8026){var _0x2c2b95=_0x5b8026[0x0]===_0x5267('0x82')?_0x5b8026[0x0]:'i.'+_0x5b8026[0x0];_0x4332c7[_0x5267('0x3d')](_0x2c2b95,_0x5b8026[0x1]===_0x5267('0x83')?![]:!![]);});}if(!_[_0x5267('0x69')](_0x91b932)){_0x4332c7[_0x5267('0x5a')](_0x3f9664);_0x3a67a0[_0x5267('0x6a')](_0x5267('0x84'),_0x91b932);}BPromise[_0x5267('0x85')]()[_0x5267('0x18')](function(){if(!_0x577c1a){if(_0x487dfc[_0x5267('0x35')]['MailAccountId'])return;_0x3a67a0[_0x5267('0x6a')](_0x5267('0x86'));_0x4332c7['where'](_0x5267('0x86'));return;}if(_0x487dfc[_0x5267('0x87')][_0x5267('0x88')]!==_0x5267('0x89'))return;return _0x487dfc[_0x5267('0x87')][_0x5267('0x8a')]({'attributes':['id'],'raw':!![]})[_0x5267('0x18')](function(_0x49ad09){if(_[_0x5267('0x69')](_0x49ad09)){_0x3a67a0[_0x5267('0x6a')](_0x5267('0x8b'));_0x4332c7[_0x5267('0x6a')](_0x5267('0x8b'));}else{_0x3a67a0['where']('i.MailAccountId\x20IN\x20?',_[_0x5267('0x1d')](_0x49ad09,'id'));_0x4332c7[_0x5267('0x6a')](_0x5267('0x6b'),_[_0x5267('0x1d')](_0x49ad09,'id'));}});})['then'](function(){if(_0x487dfc[_0x5267('0x87')][_0x5267('0x88')]===_0x5267('0x89')&&!_0x577c1a&&!_0x487dfc[_0x5267('0x35')][_0x5267('0x8c')])return[];return db[_0x5267('0x8d')][_0x5267('0x35')](_0x3a67a0[_0x5267('0x8e')](),_0x1bf43a);})[_0x5267('0x18')](function(_0x22875c){_0x5c0cdf[_0x5267('0x14')]=_0x22875c[_0x5267('0x3a')];if(_0x5c0cdf[_0x5267('0x14')]===0x0)return[];return db['sequelize'][_0x5267('0x35')](_0x37ec6c[_0x5267('0x8e')](),_0x1bf43a)[_0x5267('0x18')](function(_0x16374d){_0x4ae9f9=_[_0x5267('0x8f')](_0x16374d,'id');_0x1bf43a=_[_0x5267('0x90')](_0x1bf43a,{'model':db[_0x5267('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x487dfc[_0x5267('0x35')][_0x5267('0x39')]){_0x5ef02e[_0x5267('0x38')][_0x5267('0x20')](function(_0x24058e){_0x4332c7[_0x5267('0x40')]('i.'+_0x24058e);});}else{_0x4332c7[_0x5267('0x40')](_0x5267('0x81'),_0x5267('0x58'));_0x4332c7[_0x5267('0x40')](_0x5267('0x91'),_0x5267('0x92'));_0x4332c7[_0x5267('0x40')](_0x5267('0x93'),_0x5267('0x94'));_0x4332c7[_0x5267('0x40')]('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',_0x5267('0x82'));_0x4332c7[_0x5267('0x40')](_0x5267('0x7e'));_0x4332c7[_0x5267('0x40')](_0x5267('0x95'));_0x4332c7['field'](_0x5267('0x96'));_0x4332c7[_0x5267('0x40')]('i.closed');_0x4332c7['field']('i.closedAt');_0x4332c7[_0x5267('0x40')]('i.attach');_0x4332c7[_0x5267('0x40')]('i.lastMsgAt');_0x4332c7['field'](_0x5267('0x97'));_0x4332c7[_0x5267('0x40')](_0x5267('0x98'));_0x4332c7[_0x5267('0x40')](_0x5267('0x99'));_0x4332c7['field']('i.secondDisposition');_0x4332c7[_0x5267('0x40')](_0x5267('0x9a'));_0x4332c7[_0x5267('0x40')](_0x5267('0x9b'));_0x4332c7[_0x5267('0x40')]('i.to');_0x4332c7[_0x5267('0x40')]('i.ContactId');_0x4332c7['field'](_0x5267('0x9c'));_0x4332c7['field']('i.UserId');_0x4332c7[_0x5267('0x40')](_0x5267('0x9d'),'Contact.firstName');_0x4332c7['field']('c.lastName',_0x5267('0x9e'));_0x4332c7['field'](_0x5267('0x9f'),'Contact.email');_0x4332c7[_0x5267('0x40')](_0x5267('0xa0'),'Contact.phone');_0x4332c7[_0x5267('0x40')](_0x5267('0xa1'),_0x5267('0xa2'));_0x4332c7[_0x5267('0x40')](_0x5267('0xa3'),_0x5267('0xa4'));_0x4332c7['field']('o.fullname',_0x5267('0xa5'));_0x4332c7['field']('o.internal',_0x5267('0xa6'));_0x4332c7['field'](_0x5267('0xa7'),'TagIds');}if(_0x5ef02e[_0x5267('0x15')])_0x4332c7['limit'](_0x5ef02e[_0x5267('0x15')]);if(_0x5ef02e[_0x5267('0x12')])_0x4332c7[_0x5267('0x12')](_0x5ef02e[_0x5267('0x12')]);return db[_0x5267('0x8d')][_0x5267('0x35')](_0x4332c7[_0x5267('0x8e')](),_0x1bf43a);})['then'](function(_0x4df99f){if(_0x4df99f[_0x5267('0x3a')]>0x0)_0x4b8db5['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x4df99f,'id'));return db['sequelize']['query'](_0x4b8db5['toString'](),_0x1bf43a)[_0x5267('0x18')](function(_0x43d554){var _0x15a05a=_[_0x5267('0xa8')](_0x43d554,_0x5267('0xa9'));var _0xe2cde4=[];return db[_0x5267('0xaa')][_0x5267('0x22')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x5e2a93){var _0x25d4e1=_0x5e2a93[_0x5267('0xab')];_0x4df99f['forEach'](function(_0x216107){_0xe2cde4[_0x5267('0xac')](updateMailInteraction(_0x216107,_0x4ae9f9,_0x15a05a,_0x25d4e1));});return BPromise[_0x5267('0xad')](_0xe2cde4);});});});})[_0x5267('0x18')](function(_0x535422){_0x5c0cdf['rows']=_0x535422;return _0x5c0cdf;})[_0x5267('0x18')](respondWithFilteredResult(_0x2dc5cc,_0x5ef02e))[_0x5267('0x27')](handleError(_0x2dc5cc,null));};exports[_0x5267('0xae')]=function(_0x96fba5,_0x3e4240){var _0x174e2b={'raw':![],'where':{'id':_0x96fba5['params']['id']}},_0x3fd3f1={};_0x3fd3f1['model']=_['keys'](db[_0x5267('0x30')][_0x5267('0xaf')]);_0x3fd3f1[_0x5267('0x35')]=_[_0x5267('0x67')](_0x96fba5[_0x5267('0x35')]);_0x3fd3f1[_0x5267('0x3f')]=_['intersection'](_0x3fd3f1[_0x5267('0x37')],_0x3fd3f1['query']);_0x174e2b[_0x5267('0x38')]=_[_0x5267('0x36')](_0x3fd3f1[_0x5267('0x37')],qs[_0x5267('0x39')](_0x96fba5[_0x5267('0x35')]['fields']));_0x174e2b[_0x5267('0x38')]=_0x174e2b[_0x5267('0x38')][_0x5267('0x3a')]?_0x174e2b['attributes']:_0x3fd3f1['model'];if(_0x96fba5['query'][_0x5267('0xb0')]){_0x174e2b[_0x5267('0xb1')]=[{'all':!![]}];}_0x174e2b=_[_0x5267('0x90')]({},_0x174e2b,_0x96fba5[_0x5267('0xb2')]);return db['MailInteraction']['find'](_0x174e2b)[_0x5267('0x18')](handleEntityNotFound(_0x3e4240,null))[_0x5267('0x18')](respondWithResult(_0x3e4240,null))['catch'](handleError(_0x3e4240,null));};exports[_0x5267('0xb3')]=function(_0x3f4659,_0x55021c){return db['MailInteraction'][_0x5267('0xb3')](_0x3f4659[_0x5267('0xb4')],{})['then'](respondWithResult(_0x55021c,0xc9))[_0x5267('0x27')](handleError(_0x55021c,null));};exports[_0x5267('0xb5')]=function(_0x445a49,_0x1291bc){if(_0x445a49[_0x5267('0xb4')]['id']){delete _0x445a49[_0x5267('0xb4')]['id'];}return db[_0x5267('0x30')][_0x5267('0x57')]({'where':{'id':_0x445a49[_0x5267('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1291bc,null))['then'](saveUpdates(_0x445a49[_0x5267('0xb4')],null))['then'](respondWithResult(_0x1291bc,null))[_0x5267('0x27')](handleError(_0x1291bc,null));};exports[_0x5267('0x19')]=function(_0x2722f9,_0x20c270){return db[_0x5267('0x30')][_0x5267('0x57')]({'where':{'id':_0x2722f9[_0x5267('0xb6')]['id']}})[_0x5267('0x18')](handleEntityNotFound(_0x20c270,null))[_0x5267('0x18')](removeEntity(_0x20c270,null))[_0x5267('0x27')](handleError(_0x20c270,null));};exports[_0x5267('0xb7')]=function(_0x11acb9,_0x5909b3){return db[_0x5267('0x30')]['describe']()['then'](respondWithResult(_0x5909b3,null))[_0x5267('0x27')](handleError(_0x5909b3,null));};exports[_0x5267('0xb8')]=function(_0x1d7987,_0x59efe1){return db[_0x5267('0xb9')][_0x5267('0x57')]({'where':{'id':_0x1d7987[_0x5267('0xb6')]['id']}})[_0x5267('0x18')](handleEntityNotFound(_0x59efe1,null))[_0x5267('0x18')](function(_0x46c79e){if(_0x46c79e){return _0x46c79e[_0x5267('0xb8')](_0x1d7987[_0x5267('0xb4')][_0x5267('0xba')],_[_0x5267('0xbb')](_0x1d7987[_0x5267('0xb4')],[_0x5267('0xba'),'id'])||{});}})['then'](respondWithResult(_0x59efe1,null))[_0x5267('0x27')](handleError(_0x59efe1,null));};exports[_0x5267('0xbc')]=function(_0x53d571,_0x262af9){var _0x37b08e={'raw':![],'where':{}};var _0x2da5ea={};var _0x3cdf6b={'count':0x0,'rows':[]};return db['MailInteraction'][_0x5267('0x22')]({'where':{'id':_0x53d571[_0x5267('0xb6')]['id']}})[_0x5267('0x18')](handleEntityNotFound(_0x262af9,null))['then'](function(_0x3fdb4d){if(_0x3fdb4d){_0x2da5ea[_0x5267('0x37')]=_[_0x5267('0x67')](db[_0x5267('0xb9')][_0x5267('0xaf')]);_0x2da5ea[_0x5267('0x35')]=_[_0x5267('0x67')](_0x53d571[_0x5267('0x35')]);_0x2da5ea[_0x5267('0x3f')]=_['intersection'](_0x2da5ea[_0x5267('0x37')],_0x2da5ea[_0x5267('0x35')]);_0x37b08e['attributes']=_[_0x5267('0x36')](_0x2da5ea['model'],qs[_0x5267('0x39')](_0x53d571['query'][_0x5267('0x39')]));_0x37b08e[_0x5267('0x38')]=_0x37b08e['attributes']['length']?_0x37b08e[_0x5267('0x38')]:_0x2da5ea[_0x5267('0x37')];if(!_0x53d571[_0x5267('0x35')][_0x5267('0x3b')](_0x5267('0x3c'))){_0x37b08e['limit']=qs[_0x5267('0x15')](_0x53d571['query']['limit']);_0x37b08e['offset']=qs[_0x5267('0x12')](_0x53d571[_0x5267('0x35')][_0x5267('0x12')]);}_0x37b08e[_0x5267('0x3d')]=qs[_0x5267('0x3e')](_0x53d571[_0x5267('0x35')][_0x5267('0x3e')]);_0x37b08e['where']=qs['filters'](_[_0x5267('0xbd')](_0x53d571[_0x5267('0x35')],_0x2da5ea[_0x5267('0x3f')]));_0x37b08e[_0x5267('0x6a')][_0x5267('0xa9')]=_0x3fdb4d['id'];if(_0x53d571['query'][_0x5267('0x78')]){_0x37b08e[_0x5267('0x6a')]=_[_0x5267('0x90')](_0x37b08e[_0x5267('0x6a')],{'$or':_[_0x5267('0x1d')](_0x37b08e['attributes'],function(_0x3ab097){var _0x24e500={};_0x24e500[_0x3ab097]={'$like':'%'+_0x53d571[_0x5267('0x35')]['filter']+'%'};return _0x24e500;})});}if(_0x53d571[_0x5267('0x35')]['$gte']){var _0x2017e9=_0x53d571[_0x5267('0x35')]['$gte'][_0x5267('0x1f')](',');var _0x5cadcd={};_0x5cadcd[_0x2017e9[0x0]]={'$gte':moment(_0x2017e9[0x1])[_0x5267('0xbe')](_0x5267('0xbf'))};_0x37b08e['where']=_[_0x5267('0x90')](_0x37b08e[_0x5267('0x6a')],_0x5cadcd);}_0x37b08e=_['merge']({},_0x37b08e,_0x53d571[_0x5267('0xb2')]);return db[_0x5267('0xb9')][_0x5267('0x14')]({'where':_0x37b08e[_0x5267('0x6a')]})[_0x5267('0x18')](function(_0x4ebfec){_0x3cdf6b['count']=_0x4ebfec;if(_0x53d571[_0x5267('0x35')][_0x5267('0xb0')]){_0x37b08e['include']=[{'all':!![]}];}return db[_0x5267('0xb9')]['findAll'](_0x37b08e);})[_0x5267('0x18')](function(_0x43b941){if(_0x53d571[_0x5267('0x35')][_0x5267('0xc0')]===_0x5267('0xc1')){for(var _0xc5908b=0x0;_0xc5908b<_0x43b941[_0x5267('0x3a')];_0xc5908b++){_0x43b941[_0xc5908b][_0x5267('0xb4')]=juice(_0x43b941[_0xc5908b][_0x5267('0xb4')]);}}_0x3cdf6b[_0x5267('0xc2')]=_0x43b941;return _0x3cdf6b;});}})[_0x5267('0x18')](respondWithFilteredResult(_0x262af9,_0x37b08e))[_0x5267('0x27')](handleError(_0x262af9,null));};exports['addTags']=function(_0x176709,_0xeb1871){return db[_0x5267('0x30')][_0x5267('0x57')]({'where':{'id':_0x176709[_0x5267('0xb6')]['id']}})[_0x5267('0x18')](handleEntityNotFound(_0xeb1871,null))[_0x5267('0x18')](function(_0x1c1719){if(_0x1c1719){return _0x1c1719[_0x5267('0xc3')](_0x176709[_0x5267('0xb4')][_0x5267('0xba')],_[_0x5267('0xbb')](_0x176709[_0x5267('0xb4')],[_0x5267('0xba'),'id'])||{})[_0x5267('0xc4')](function(){return db['Tag'][_0x5267('0xc5')]({'attributes':['id',_0x5267('0x34'),_0x5267('0xc6')],'where':{'id':_0x176709['body']['ids']}});})[_0x5267('0x18')](function(_0x5cb1a9){socket['emit'](_0x5267('0xc7'),{'id':Number(_0x176709[_0x5267('0xb6')]['id']),'tags':_0x5cb1a9||[]});return{'id':Number(_0x176709['params']['id']),'tags':_0x5cb1a9||[]};});}})['then'](respondWithResult(_0xeb1871,null))[_0x5267('0x27')](handleError(_0xeb1871,null));};exports[_0x5267('0xc8')]=function(_0x29ecb9,_0x43db60){return db['MailInteraction'][_0x5267('0x57')]({'where':{'id':_0x29ecb9[_0x5267('0xb6')]['id']}})['then'](handleEntityNotFound(_0x43db60,null))[_0x5267('0x18')](function(_0x2f6c0e){if(_0x2f6c0e){return _0x2f6c0e[_0x5267('0xc8')](_0x29ecb9[_0x5267('0x35')][_0x5267('0xba')]);}})[_0x5267('0x18')](respondWithStatusCode(_0x43db60,null))[_0x5267('0x27')](handleError(_0x43db60,null));};exports[_0x5267('0xc9')]=function(_0x3937fe,_0x3529ae){var _0x3c39d4=moment()[_0x5267('0xca')]()[_0x5267('0x8e')]();var _0x220ae7=path[_0x5267('0xcb')](config[_0x5267('0xcc')],'server',_0x5267('0xcd'),_0x5267('0xce'));var _0x3c6cbf=path[_0x5267('0xcb')](config[_0x5267('0xcc')],_0x5267('0xcf'),_0x5267('0xcd'),'attachments');var _0x12b78b=path['join'](_0x220ae7,_0x3c39d4);var _0x1e8fa8=util[_0x5267('0xbe')](_0x5267('0xd0'),_0x3937fe[_0x5267('0xb6')]['id'],_0x3c39d4);var _0x5f698c=path['join'](_0x220ae7,_0x1e8fa8);var _0x252dfc=[];if(_0x3937fe[_0x5267('0x35')][_0x5267('0xd1')]){_0x252dfc[_0x5267('0xac')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x25d517=[{'model':db[_0x5267('0xb9')],'as':'Messages','attributes':['id',_0x5267('0xb4'),_0x5267('0x41'),'to','cc',_0x5267('0xd2'),_0x5267('0xd3'),'createdAt'],'where':{'secret':![]},'order':qs[_0x5267('0x3e')]('id'),'include':_0x252dfc}];return db['MailInteraction']['find']({'where':{'id':_0x3937fe[_0x5267('0xb6')]['id']},'include':_0x25d517})[_0x5267('0x18')](handleEntityNotFound(_0x3529ae,null))[_0x5267('0x18')](function(_0x4e0b1c){if(_0x4e0b1c&&_0x4e0b1c[_0x5267('0xd4')]){var _0x297d06=_0x4e0b1c['get']({'plain':!![]});fs[_0x5267('0xd5')](_0x12b78b);return BPromise['each'](_0x297d06['Messages'],function(_0x599091,_0x26620c){var _0x160389={'from':_0x599091['from'],'to':_0x599091['to'],'subject':_0x599091[_0x5267('0xd3')],'html':htmlEntities[_0x5267('0xd6')](_0x599091[_0x5267('0xb4')]),'headers':{'Date':moment(_0x599091[_0x5267('0x6d')])[_0x5267('0xbe')](_0x5267('0xd7'))},'attachments':[]};if(_0x599091['cc']){_0x160389[_0x5267('0xd8')]['Cc']=_0x599091['cc'];}if(_0x599091[_0x5267('0xd2')]){_0x160389[_0x5267('0xd8')][_0x5267('0xd9')]=_0x599091[_0x5267('0xd2')];}return new BPromise(function(_0x5aa880,_0x36afed){if(_0x599091['Attachments']){for(var _0xbed87e=0x0;_0xbed87e<_0x599091[_0x5267('0xda')][_0x5267('0x3a')];_0xbed87e++){var _0x379585=_0x599091[_0x5267('0xda')][_0xbed87e];var _0x23389c=path['join'](_0x3c6cbf,_0x379585[_0x5267('0xdb')]);if(fs[_0x5267('0xdc')](_0x23389c)){_0x160389[_0x5267('0xd1')]['push']({'name':_0x379585[_0x5267('0x34')],'contentType':_0x379585[_0x5267('0x32')],'data':fs['readFileSync'](_0x23389c)});}}}emlformat[_0x5267('0xdd')](_0x160389,function(_0x464dea,_0x30ef21){if(_0x464dea)return _0x36afed(_0x464dea);fs[_0x5267('0xde')](path[_0x5267('0xcb')](_0x12b78b,util['format'](_0x5267('0xdf'),_0x26620c)),_0x30ef21);return _0x5aa880(_0x30ef21);});});})[_0x5267('0x18')](function(){return new BPromise(function(_0x3ee247,_0x487224){zipdir(_0x12b78b,{'saveTo':_0x5f698c},function(_0x107993,_0x2880ba){if(_0x107993)return _0x487224(_0x107993);return _0x3ee247(_0x2880ba);});})[_0x5267('0x18')](function(){return new BPromise(function(_0x2db95e,_0x730f99){rimraf(_0x12b78b,function(_0x1ca1d1){if(_0x1ca1d1)_0x730f99(_0x1ca1d1);return _0x2db95e();});});})[_0x5267('0x18')](function(){return _0x3529ae[_0x5267('0xc9')](_0x5f698c,_0x1e8fa8,function(_0x17c6a7){if(!_0x17c6a7)fs[_0x5267('0xe0')](_0x5f698c);});});});}else{return _0x3529ae['sendStatus'](0xc8);}})['catch'](handleError(_0x3529ae,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8ba8487..9403d18 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 _0xa4b3=['events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','emit','catch','hasOwnProperty','hook','exports'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xa4b3,0x1d1));var _0x3a4b=function(_0x34ff52,_0x3fbcce){_0x34ff52=_0x34ff52-0x0;var _0x4fe35f=_0xa4b3[_0x34ff52];return _0x4fe35f;};'use strict';var EventEmitter=require(_0x3a4b('0x0'));var MailInteraction=require(_0x3a4b('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x3a4b('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3a4b('0x2')](0x0);var events={'afterCreate':_0x3a4b('0x3'),'afterUpdate':_0x3a4b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c3ba7){return function(_0x280bbb,_0x4fe382,_0x152d9b){_0x280bbb[_0x3a4b('0x5')]({'attributes':['id'],'raw':!![]})[_0x3a4b('0x6')](function(_0x2d266f){_0x280bbb[_0x3a4b('0x7')]('Users',_0x2d266f[_0x3a4b('0x8')](function(_0x505b17){return{'id':_0x505b17['id']};}));return MailMessage[_0x3a4b('0x9')]({'where':{'MailInteractionId':_0x280bbb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a4b('0x6')](function(_0x5eadc0){_0x280bbb['setDataValue']('unreadMessages',_0x5eadc0['length']);MailInteractionEvents[_0x3a4b('0xa')](_0x5c3ba7+':'+_0x280bbb['id'],_0x280bbb);MailInteractionEvents[_0x3a4b('0xa')](_0x5c3ba7,_0x280bbb);_0x152d9b(null);})[_0x3a4b('0xb')](_0x152d9b(null));};}for(var e in events){if(events[_0x3a4b('0xc')](e)){var event=events[e];MailInteraction[_0x3a4b('0xd')](e,emitEvent(event));}}module[_0x3a4b('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xea30=['MailInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4b9699,_0x23af6b){var _0x2515ec=function(_0x41a5cc){while(--_0x41a5cc){_0x4b9699['push'](_0x4b9699['shift']());}};_0x2515ec(++_0x23af6b);}(_0xea30,0x9f));var _0x0ea3=function(_0x437e1a,_0x3bcab7){_0x437e1a=_0x437e1a-0x0;var _0x5536cd=_0xea30[_0x437e1a];return _0x5536cd;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x0ea3('0x0'))['db'][_0x0ea3('0x1')];var MailMessage=require(_0x0ea3('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x0ea3('0x2')](0x0);var events={'afterCreate':_0x0ea3('0x3'),'afterUpdate':'update','afterDestroy':_0x0ea3('0x4')};function emitEvent(_0x44e057){return function(_0xb94945,_0xe9843b,_0x2c1614){_0xb94945[_0x0ea3('0x5')]({'attributes':['id'],'raw':!![]})[_0x0ea3('0x6')](function(_0x3857cf){_0xb94945[_0x0ea3('0x7')](_0x0ea3('0x8'),_0x3857cf[_0x0ea3('0x9')](function(_0x29dd34){return{'id':_0x29dd34['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0xb94945['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ea3('0x6')](function(_0x4b5658){_0xb94945[_0x0ea3('0x7')]('unreadMessages',_0x4b5658[_0x0ea3('0xa')]);MailInteractionEvents[_0x0ea3('0xb')](_0x44e057+':'+_0xb94945['id'],_0xb94945);MailInteractionEvents[_0x0ea3('0xb')](_0x44e057,_0xb94945);_0x2c1614(null);})[_0x0ea3('0xc')](_0x2c1614(null));};}for(var e in events){if(events[_0x0ea3('0xd')](e)){var event=events[e];MailInteraction[_0x0ea3('0xe')](e,emitEvent(event));}}module[_0x0ea3('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bb2030c..640acf2 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 _0x2757=['models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus'];(function(_0xf72d8,_0x1eac81){var _0x224e1c=function(_0x746f38){while(--_0x746f38){_0xf72d8['push'](_0xf72d8['shift']());}};_0x224e1c(++_0x1eac81);}(_0x2757,0x18f));var _0x7275=function(_0x5dfa4a,_0x181c31){_0x5dfa4a=_0x5dfa4a-0x0;var _0x2608f1=_0x2757[_0x5dfa4a];return _0x2608f1;};'use strict';var _=require(_0x7275('0x0'));var util=require(_0x7275('0x1'));var logger=require(_0x7275('0x2'))(_0x7275('0x3'));var moment=require(_0x7275('0x4'));var BPromise=require(_0x7275('0x5'));var rp=require(_0x7275('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7275('0x7'));module['exports']=function(_0x485113,_0x3d1d07){return _0x485113[_0x7275('0x8')](_0x7275('0x9'),attributes,{'tableName':_0x7275('0xa'),'paranoid':![],'indexes':[{'name':_0x7275('0xb'),'fields':[_0x7275('0xc'),'to'],'type':_0x7275('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e0a4e,_0x5a183d,_0x3522fa){if(_0x1e0a4e['substatus']){_0x1e0a4e[_0x7275('0xe')]=moment()[_0x7275('0xf')](_0x7275('0x10'));}if(_0x1e0a4e[_0x7275('0x11')]){_0x1e0a4e[_0x7275('0x12')]=moment()['format'](_0x7275('0x10'));}_0x3522fa(null,_0x5a183d);},'beforeUpdate':function(_0x3efef8,_0x77777d,_0x4afa0c){if(_0x3efef8[_0x7275('0x13')](_0x7275('0x14'))){_0x3efef8[_0x7275('0xe')]=_0x3efef8[_0x7275('0x14')]?moment()[_0x7275('0xf')](_0x7275('0x10')):null;}if(_0x3efef8[_0x7275('0x13')](_0x7275('0x11'))){_0x3efef8[_0x7275('0x12')]=moment()[_0x7275('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x3efef8['substatus']=null;_0x3efef8[_0x7275('0xe')]=null;}_0x4afa0c(null,_0x3efef8);},'afterUpdate':function(_0x58674d,_0x3b1b22,_0x133da7){var _0x82f831=_0x485113[_0x7275('0x15')];var _0x256658=_0x58674d[_0x7275('0x16')]({'plain':!![]});if(_0x256658[_0x7275('0x11')]){return _0x82f831[_0x7275('0x17')][_0x7275('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x256658['id']}})[_0x7275('0x19')](function(){_0x133da7();})['catch'](function(_0x23a8c9){_0x133da7(_0x23a8c9);});}else{_0x133da7();}}},'charset':_0x7275('0x1a'),'collate':_0x7275('0x1b')});}; \ No newline at end of file +var _0x8b00=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x8b00,0x1b9));var _0x08b0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b00[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x08b0('0x0'));var util=require(_0x08b0('0x1'));var logger=require(_0x08b0('0x2'))(_0x08b0('0x3'));var moment=require('moment');var BPromise=require(_0x08b0('0x4'));var rp=require(_0x08b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x08b0('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x08b0('0x7')]=function(_0x1fc156,_0x4e15ee){return _0x1fc156[_0x08b0('0x8')]('MailInteraction',attributes,{'tableName':_0x08b0('0x9'),'paranoid':![],'indexes':[{'name':_0x08b0('0xa'),'fields':[_0x08b0('0xb'),'to'],'type':_0x08b0('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28ce9e,_0x3631f3,_0x2da46d){if(_0x28ce9e[_0x08b0('0xd')]){_0x28ce9e[_0x08b0('0xe')]=moment()[_0x08b0('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x28ce9e['closed']){_0x28ce9e[_0x08b0('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2da46d(null,_0x3631f3);},'beforeUpdate':function(_0x535435,_0x5467bd,_0x161b1a){if(_0x535435['changed'](_0x08b0('0xd'))){_0x535435[_0x08b0('0xe')]=_0x535435[_0x08b0('0xd')]?moment()[_0x08b0('0xf')](_0x08b0('0x11')):null;}if(_0x535435[_0x08b0('0x12')](_0x08b0('0x13'))){_0x535435[_0x08b0('0x10')]=moment()[_0x08b0('0xf')](_0x08b0('0x11'));_0x535435[_0x08b0('0xd')]=null;_0x535435['substatusAt']=null;}_0x161b1a(null,_0x535435);},'afterUpdate':function(_0x1392f3,_0x5ea814,_0x5ad250){var _0x5c2b26=_0x1fc156[_0x08b0('0x14')];var _0x403953=_0x1392f3[_0x08b0('0x15')]({'plain':!![]});if(_0x403953[_0x08b0('0x13')]){return _0x5c2b26[_0x08b0('0x16')][_0x08b0('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x403953['id']}})[_0x08b0('0x18')](function(){_0x5ad250();})['catch'](function(_0x309ab8){_0x5ad250(_0x309ab8);});}else{_0x5ad250();}}},'charset':'utf8mb4','collate':_0x08b0('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 289f09e..660be88 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 _0x060c=['where','attributes','limit','catch','AddTagsToMailInteraction','MailInteraction','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','update','body','options'];(function(_0x343dcf,_0x261e21){var _0x28c659=function(_0x347566){while(--_0x347566){_0x343dcf['push'](_0x343dcf['shift']());}};_0x28c659(++_0x261e21);}(_0x060c,0x1e4));var _0xc060=function(_0x559a59,_0x5c3d18){_0x559a59=_0x559a59-0x0;var _0x2e4300=_0x060c[_0x559a59];return _0x2e4300;};'use strict';var _=require(_0xc060('0x0'));var util=require(_0xc060('0x1'));var moment=require(_0xc060('0x2'));var BPromise=require(_0xc060('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc060('0x4'));var db=require(_0xc060('0x5'))['db'];var utils=require(_0xc060('0x6'));var logger=require(_0xc060('0x7'))(_0xc060('0x8'));var config=require(_0xc060('0x9'));var jayson=require(_0xc060('0xa'));var client=jayson[_0xc060('0xb')][_0xc060('0xc')]({'port':0x232a});config[_0xc060('0xd')]=_['defaults'](config['redis'],{'host':_0xc060('0xe'),'port':0x18eb});var socket=require(_0xc060('0xf'))(new Redis(config[_0xc060('0xd')]));require(_0xc060('0x10'))[_0xc060('0x11')](socket);function respondWithRpcPromise(_0x361c4c,_0x48e5d4,_0x34bb74){return new BPromise(function(_0xf5216c,_0x1bcda8){return client[_0xc060('0x12')](_0x361c4c,_0x34bb74)[_0xc060('0x13')](function(_0x40fb4c){logger[_0xc060('0x14')](_0xc060('0x15'),_0x48e5d4,_0xc060('0x16'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x48e5d4,_0xc060('0x16'),JSON[_0xc060('0x17')](_0x40fb4c));if(_0x40fb4c['error']){if(_0x40fb4c[_0xc060('0x18')][_0xc060('0x19')]===0x1f4){logger[_0xc060('0x18')](_0xc060('0x15'),_0x48e5d4,_0x40fb4c[_0xc060('0x18')][_0xc060('0x1a')]);return _0x1bcda8(_0x40fb4c[_0xc060('0x18')]['message']);}logger[_0xc060('0x18')]('MailInteraction,\x20%s,\x20%s',_0x48e5d4,_0x40fb4c[_0xc060('0x18')][_0xc060('0x1a')]);return _0xf5216c(_0x40fb4c['error']['message']);}else{logger[_0xc060('0x14')](_0xc060('0x15'),_0x48e5d4,_0xc060('0x16'));_0xf5216c(_0x40fb4c[_0xc060('0x1b')][_0xc060('0x1a')]);}})['catch'](function(_0x2e1e0d){logger['error'](_0xc060('0x15'),_0x48e5d4,_0x2e1e0d);_0x1bcda8(_0x2e1e0d);});});}exports[_0xc060('0x1c')]=function(_0x188746){var _0x1ade15=this;return new Promise(function(_0x473f39,_0x177fc6){return db['MailInteraction'][_0xc060('0x1d')](_0x188746[_0xc060('0x1e')],{'raw':_0x188746['options']?_0x188746[_0xc060('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188746[_0xc060('0x1f')]?_0x188746[_0xc060('0x1f')][_0xc060('0x20')]||null:null,'attributes':_0x188746[_0xc060('0x1f')]?_0x188746['options'][_0xc060('0x21')]||null:null,'limit':_0x188746[_0xc060('0x1f')]?_0x188746['options'][_0xc060('0x22')]||null:null})[_0xc060('0x13')](function(_0x28fdbc){logger[_0xc060('0x14')](_0xc060('0x1c'),_0x188746);logger['debug']('UpdateMailInteraction',_0x188746,JSON[_0xc060('0x17')](_0x28fdbc));_0x473f39(_0x28fdbc);})[_0xc060('0x23')](function(_0x5b8745){logger[_0xc060('0x18')](_0xc060('0x1c'),_0x5b8745[_0xc060('0x1a')],_0x188746);_0x177fc6(_0x1ade15[_0xc060('0x18')](0x1f4,_0x5b8745[_0xc060('0x1a')]));});});};exports[_0xc060('0x24')]=function(_0x2413e7){return new Promise(function(_0x44d65d,_0x33e579){return db[_0xc060('0x25')]['find']({'where':_0x2413e7['options']?_0x2413e7[_0xc060('0x1f')][_0xc060('0x20')]||null:null})[_0xc060('0x13')](function(_0x5692bd){if(_0x5692bd){return _0x5692bd['addTags'](_0x2413e7[_0xc060('0x1e')][_0xc060('0x26')],_[_0xc060('0x27')](_0x2413e7[_0xc060('0x1e')],[_0xc060('0x26'),'id'])||{});}})[_0xc060('0x28')](function(_0x52be5d){logger[_0xc060('0x14')](_0xc060('0x29'),_0x2413e7);logger[_0xc060('0x2a')](_0xc060('0x29'),_0x2413e7,JSON[_0xc060('0x17')](_0x52be5d));_0x44d65d(_0x52be5d);})[_0xc060('0x23')](function(_0x2095bf){logger[_0xc060('0x18')](_0xc060('0x29'),_0x2095bf[_0xc060('0x1a')],_0x2413e7);_0x33e579(_this['error'](0x1f4,_0x2095bf[_0xc060('0x1a')]));});});}; \ No newline at end of file +var _0x591d=['options','raw','where','attributes','limit','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body'];(function(_0x17bb78,_0x38ab21){var _0x558d02=function(_0x4776e0){while(--_0x4776e0){_0x17bb78['push'](_0x17bb78['shift']());}};_0x558d02(++_0x38ab21);}(_0x591d,0x171));var _0xd591=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x591d[_0x34325b];return _0x3da348;};'use strict';var _=require('lodash');var util=require(_0xd591('0x0'));var moment=require(_0xd591('0x1'));var BPromise=require(_0xd591('0x2'));var rs=require(_0xd591('0x3'));var fs=require('fs');var Redis=require(_0xd591('0x4'));var db=require(_0xd591('0x5'))['db'];var utils=require(_0xd591('0x6'));var logger=require(_0xd591('0x7'))(_0xd591('0x8'));var config=require('../../config/environment');var jayson=require(_0xd591('0x9'));var client=jayson[_0xd591('0xa')][_0xd591('0xb')]({'port':0x232a});config[_0xd591('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd591('0xc')]));require(_0xd591('0xd'))[_0xd591('0xe')](socket);function respondWithRpcPromise(_0xa02ab1,_0xf266bf,_0x365194){return new BPromise(function(_0x5cd09c,_0x294ea5){return client[_0xd591('0xf')](_0xa02ab1,_0x365194)[_0xd591('0x10')](function(_0xbc799){logger[_0xd591('0x11')](_0xd591('0x12'),_0xf266bf,_0xd591('0x13'));logger[_0xd591('0x14')](_0xd591('0x15'),_0xf266bf,_0xd591('0x13'),JSON[_0xd591('0x16')](_0xbc799));if(_0xbc799[_0xd591('0x17')]){if(_0xbc799[_0xd591('0x17')]['code']===0x1f4){logger[_0xd591('0x17')](_0xd591('0x12'),_0xf266bf,_0xbc799['error'][_0xd591('0x18')]);return _0x294ea5(_0xbc799[_0xd591('0x17')]['message']);}logger[_0xd591('0x17')](_0xd591('0x12'),_0xf266bf,_0xbc799[_0xd591('0x17')]['message']);return _0x5cd09c(_0xbc799[_0xd591('0x17')][_0xd591('0x18')]);}else{logger[_0xd591('0x11')]('MailInteraction,\x20%s,\x20%s',_0xf266bf,_0xd591('0x13'));_0x5cd09c(_0xbc799[_0xd591('0x19')]['message']);}})[_0xd591('0x1a')](function(_0x324ac7){logger[_0xd591('0x17')](_0xd591('0x12'),_0xf266bf,_0x324ac7);_0x294ea5(_0x324ac7);});});}exports[_0xd591('0x1b')]=function(_0x274b4d){var _0x1070f6=this;return new Promise(function(_0x28caa5,_0x1c1afa){return db[_0xd591('0x1c')][_0xd591('0x1d')](_0x274b4d[_0xd591('0x1e')],{'raw':_0x274b4d[_0xd591('0x1f')]?_0x274b4d[_0xd591('0x1f')][_0xd591('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x274b4d[_0xd591('0x1f')]?_0x274b4d[_0xd591('0x1f')][_0xd591('0x21')]||null:null,'attributes':_0x274b4d[_0xd591('0x1f')]?_0x274b4d[_0xd591('0x1f')][_0xd591('0x22')]||null:null,'limit':_0x274b4d[_0xd591('0x1f')]?_0x274b4d[_0xd591('0x1f')][_0xd591('0x23')]||null:null})[_0xd591('0x10')](function(_0x2f729c){logger[_0xd591('0x11')](_0xd591('0x1b'),_0x274b4d);logger[_0xd591('0x14')]('UpdateMailInteraction',_0x274b4d,JSON[_0xd591('0x16')](_0x2f729c));_0x28caa5(_0x2f729c);})[_0xd591('0x1a')](function(_0x28514b){logger[_0xd591('0x17')](_0xd591('0x1b'),_0x28514b[_0xd591('0x18')],_0x274b4d);_0x1c1afa(_0x1070f6[_0xd591('0x17')](0x1f4,_0x28514b[_0xd591('0x18')]));});});};exports['AddTagsToMailInteraction']=function(_0x1bc029){return new Promise(function(_0x4ab9c4,_0x65a3f1){return db[_0xd591('0x1c')]['find']({'where':_0x1bc029[_0xd591('0x1f')]?_0x1bc029[_0xd591('0x1f')]['where']||null:null})[_0xd591('0x10')](function(_0x1fc7c2){if(_0x1fc7c2){return _0x1fc7c2[_0xd591('0x24')](_0x1bc029[_0xd591('0x1e')][_0xd591('0x25')],_[_0xd591('0x26')](_0x1bc029[_0xd591('0x1e')],[_0xd591('0x25'),'id'])||{});}})['spread'](function(_0x36f427){logger[_0xd591('0x11')](_0xd591('0x27'),_0x1bc029);logger[_0xd591('0x14')]('AddTags',_0x1bc029,JSON['stringify'](_0x36f427));_0x4ab9c4(_0x36f427);})['catch'](function(_0x5b6fbb){logger[_0xd591('0x17')](_0xd591('0x27'),_0x5b6fbb[_0xd591('0x18')],_0x1bc029);_0x65a3f1(_this[_0xd591('0x17')](0x1f4,_0x5b6fbb[_0xd591('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 08dc9c4..529d522 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 _0xa560=['save','remove','update','removeListener','length','mailInteraction:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa560,0x1c2));var _0x0a56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa560[_0x20a584];return _0x4b41a8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x0a56('0x0'),_0x0a56('0x1'),_0x0a56('0x2')];function createListener(_0x580645,_0x59240c){return function(_0x297705){_0x59240c['emit'](_0x580645,_0x297705);};}function removeListener(_0x5d893a,_0x14db3){return function(){MailInteractionEvents[_0x0a56('0x3')](_0x5d893a,_0x14db3);};}exports['register']=function(_0x1d5408){for(var _0xcac023=0x0,_0xda1bf2=events[_0x0a56('0x4')];_0xcac023<_0xda1bf2;_0xcac023++){var _0xfd14bc=events[_0xcac023];var _0x56661a=createListener(_0x0a56('0x5')+_0xfd14bc,_0x1d5408);MailInteractionEvents['on'](_0xfd14bc,_0x56661a);}}; \ No newline at end of file +var _0xa52a=['update','emit','removeListener','register','length','./mailInteraction.events','save'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xa52a,0x194));var _0xaa52=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0xa52a[_0x5caabb];return _0x2929d8;};'use strict';var MailInteractionEvents=require(_0xaa52('0x0'));var events=[_0xaa52('0x1'),'remove',_0xaa52('0x2')];function createListener(_0x2baf6e,_0x335f07){return function(_0x4e969b){_0x335f07[_0xaa52('0x3')](_0x2baf6e,_0x4e969b);};}function removeListener(_0x1f84da,_0x25a95d){return function(){MailInteractionEvents[_0xaa52('0x4')](_0x1f84da,_0x25a95d);};}exports[_0xaa52('0x5')]=function(_0x2deb50){for(var _0x72923a=0x0,_0x201d94=events[_0xaa52('0x6')];_0x72923a<_0x201d94;_0x72923a++){var _0x18bd48=events[_0x72923a];var _0xb56d3=createListener('mailInteraction:'+_0x18bd48,_0x2deb50);MailInteractionEvents['on'](_0x18bd48,_0xb56d3);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f1f01ab..69e986a 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 _0xae7b=['/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','/:id/accept','accept','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x54e18b,_0x139423){var _0x53b132=function(_0x5c53ca){while(--_0x5c53ca){_0x54e18b['push'](_0x54e18b['shift']());}};_0x53b132(++_0x139423);}(_0xae7b,0xbe));var _0xbae7=function(_0x240700,_0x13e7d9){_0x240700=_0x240700-0x0;var _0x51530c=_0xae7b[_0x240700];return _0x51530c;};'use strict';var multer=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var path=require(_0xbae7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbae7('0x3')]();var fs_extra=require(_0xbae7('0x4'));var auth=require(_0xbae7('0x5'));var interaction=require(_0xbae7('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbae7('0x7')]('/',auth[_0xbae7('0x8')](),controller[_0xbae7('0x9')]);router['get'](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0xb')]);router[_0xbae7('0x7')](_0xbae7('0xc'),auth['isAuthenticated'](),controller[_0xbae7('0xd')]);router['get'](_0xbae7('0xe'),auth[_0xbae7('0x8')](),controller[_0xbae7('0xf')]);router[_0xbae7('0x10')]('/',auth['isAuthenticated'](),interaction[_0xbae7('0x11')](_0xbae7('0x12'),'mailmessage:create'),controller[_0xbae7('0x13')]);router['put'](_0xbae7('0xc'),auth[_0xbae7('0x8')](),controller['update']);router['put'](_0xbae7('0x14'),auth[_0xbae7('0x8')](),controller[_0xbae7('0x15')]);router[_0xbae7('0x16')]('/:id/reject',auth[_0xbae7('0x8')](),controller['reject']);router['delete'](_0xbae7('0xc'),auth[_0xbae7('0x8')](),controller[_0xbae7('0x17')]);module[_0xbae7('0x18')]=router; \ No newline at end of file +var _0x0f94=['/:id','update','/:id/accept','/:id/reject','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','/describe','describe','show','download','post','tracked','mailmessage:create','create'];(function(_0x1f1fb4,_0x15a561){var _0x12fa15=function(_0x5ecc9b){while(--_0x5ecc9b){_0x1f1fb4['push'](_0x1f1fb4['shift']());}};_0x12fa15(++_0x15a561);}(_0x0f94,0x1ad));var _0x40f9=function(_0x518b93,_0x5a5dfc){_0x518b93=_0x518b93-0x0;var _0x416763=_0x0f94[_0x518b93];return _0x416763;};'use strict';var multer=require(_0x40f9('0x0'));var util=require(_0x40f9('0x1'));var path=require(_0x40f9('0x2'));var timeout=require(_0x40f9('0x3'));var express=require(_0x40f9('0x4'));var router=express[_0x40f9('0x5')]();var fs_extra=require(_0x40f9('0x6'));var auth=require(_0x40f9('0x7'));var interaction=require(_0x40f9('0x8'));var config=require(_0x40f9('0x9'));var controller=require(_0x40f9('0xa'));router['get']('/',auth[_0x40f9('0xb')](),controller['index']);router[_0x40f9('0xc')](_0x40f9('0xd'),auth['isAuthenticated'](),controller[_0x40f9('0xe')]);router['get']('/:id',auth[_0x40f9('0xb')](),controller[_0x40f9('0xf')]);router[_0x40f9('0xc')]('/:id/download',auth['isAuthenticated'](),controller[_0x40f9('0x10')]);router[_0x40f9('0x11')]('/',auth['isAuthenticated'](),interaction[_0x40f9('0x12')]('mail',_0x40f9('0x13')),controller[_0x40f9('0x14')]);router['put'](_0x40f9('0x15'),auth['isAuthenticated'](),controller[_0x40f9('0x16')]);router['put'](_0x40f9('0x17'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x40f9('0x18'),auth[_0x40f9('0xb')](),controller['reject']);router['delete']('/:id',auth[_0x40f9('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 251d609..2c85a4c 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 _0x787c=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','Email','Chat','sequelize'];(function(_0xa1be4f,_0x10a675){var _0x25bcce=function(_0x2523da){while(--_0x2523da){_0xa1be4f['push'](_0xa1be4f['shift']());}};_0x25bcce(++_0x10a675);}(_0x787c,0xcf));var _0xc787=function(_0xb0253a,_0x26513d){_0xb0253a=_0xb0253a-0x0;var _0x1e9458=_0x787c[_0xb0253a];return _0x1e9458;};'use strict';var Sequelize=require(_0xc787('0x0'));var _=require(_0xc787('0x1'));module[_0xc787('0x2')]={'body':{'type':Sequelize[_0xc787('0x3')](_0xc787('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xc787('0x5'))},'read':{'type':Sequelize[_0xc787('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc787('0x7')]('in',_0xc787('0x8')),'defaultValue':_0xc787('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xc787('0x9')]},'to':{'type':Sequelize['TEXT'](_0xc787('0x4'))},'cc':{'type':Sequelize[_0xc787('0x3')]('long')},'bcc':{'type':Sequelize[_0xc787('0x3')]('long')},'subject':{'type':Sequelize[_0xc787('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xc787('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc787('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0xc787('0x4'))},'originCc':{'type':Sequelize[_0xc787('0x3')]('long')},'originChannel':{'type':Sequelize[_0xc787('0x7')](_0xc787('0xb'),_0xc787('0xc')),'defaultValue':_0xc787('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xeef0=['DATE','Email','Chat','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0xeef0,0x121));var _0x0eef=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xeef0[_0x56916d];return _0x2b7f1f;};'use strict';var Sequelize=require(_0x0eef('0x0'));var _=require(_0x0eef('0x1'));module[_0x0eef('0x2')]={'body':{'type':Sequelize['TEXT'](_0x0eef('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0eef('0x4')](_0x0eef('0x5'))},'read':{'type':Sequelize[_0x0eef('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0eef('0x7')]('in','out'),'defaultValue':_0x0eef('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0eef('0x9')](0x1fe)},'from':{'type':Sequelize[_0x0eef('0x9')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize['TEXT'](_0x0eef('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x0eef('0x3'))},'subject':{'type':Sequelize[_0x0eef('0x4')]},'sentAt':{'type':Sequelize[_0x0eef('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0eef('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0eef('0xa')]},'originTo':{'type':Sequelize[_0x0eef('0x4')](_0x0eef('0x3'))},'originCc':{'type':Sequelize[_0x0eef('0x4')](_0x0eef('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x0eef('0xb'),_0x0eef('0xc')),'defaultValue':_0x0eef('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d5868a7..721e43d 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 _0x97de=['html-to-text','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','MailMessage','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','include','options','find','body','params','describe','create','direction','out','split','CmList','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','pass','auth','user','attachments','root','server/files/attachments','List','CmContact','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','reject','rejectmessage','download','unix','join','tmp','server','files','message-%s.eml','from','bcc','createdAt','Attachments','decode','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x97de,0x13c));var _0xe97d=function(_0xfb963,_0x1b14de){_0xfb963=_0xfb963-0x0;var _0x38f03b=_0x97de[_0xfb963];return _0x38f03b;};'use strict';var emlformat=require(_0xe97d('0x0'));var moment=require(_0xe97d('0x1'));var BPromise=require(_0xe97d('0x2'));var util=require(_0xe97d('0x3'));var path=require(_0xe97d('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe97d('0x5'));var htmlToText=require(_0xe97d('0x6'));var qs=require(_0xe97d('0x7'));var logger=require('../../config/logger')(_0xe97d('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xe97d('0x9'));var db=require(_0xe97d('0xa'))['db'];config[_0xe97d('0xb')]=_['defaults'](config[_0xe97d('0xb')],{'host':_0xe97d('0xc'),'port':0x18eb});var socket=require(_0xe97d('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xe97d('0xe'))[_0xe97d('0xf')](socket);var jayson=require(_0xe97d('0x10'));var client=jayson[_0xe97d('0x11')][_0xe97d('0x12')]({'port':0x232c});var client9003=jayson[_0xe97d('0x11')][_0xe97d('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xe97d('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5e48f9,_0x179bde,_0x4721e2,_0x618e06){return new BPromise(function(_0x4d6136,_0x1afb68){var _0x117c9a=_0x618e06||client;return _0x117c9a[_0xe97d('0x13')](_0x5e48f9,_0x4721e2)[_0xe97d('0x14')](function(_0x5d332e){logger[_0xe97d('0x15')](_0xe97d('0x16'),_0x179bde,_0xe97d('0x17'));logger[_0xe97d('0x18')](_0xe97d('0x19'),_0x179bde,_0xe97d('0x17'),JSON[_0xe97d('0x1a')](_0x5d332e));if(_0x5d332e[_0xe97d('0x1b')]){if(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1c')]===0x1f4){logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);return _0x1afb68(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);}logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);return _0x4d6136(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);}else{logger[_0xe97d('0x15')](_0xe97d('0x16'),_0x179bde,_0xe97d('0x17'));_0x4d6136(_0x5d332e['result']['message']);}})['catch'](function(_0x39c815){logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x39c815);_0x1afb68(_0x39c815);});});}function respondWithResult(_0x33fd27,_0x585bb7){_0x585bb7=_0x585bb7||0xc8;return function(_0x1f5f4a){if(_0x1f5f4a){return _0x33fd27[_0xe97d('0x1e')](_0x585bb7)[_0xe97d('0x1f')](_0x1f5f4a);}};}function respondWithFilteredResult(_0x13b377,_0x33c405){return function(_0x28a58c){if(_0x28a58c){var _0x20df76=typeof _0x33c405[_0xe97d('0x20')]==='undefined'&&typeof _0x33c405[_0xe97d('0x21')]===_0xe97d('0x22');var _0x69b15=_0x28a58c[_0xe97d('0x23')];var _0xfe4030=_0x20df76?0x0:_0x33c405['offset'];var _0x5ed8a0=_0x20df76?_0x28a58c[_0xe97d('0x23')]:_0x33c405['offset']+_0x33c405['limit'];var _0x470654;if(_0x5ed8a0>=_0x69b15){_0x5ed8a0=_0x69b15;_0x470654=0xc8;}else{_0x470654=0xce;}_0x13b377[_0xe97d('0x1e')](_0x470654);return _0x13b377[_0xe97d('0x24')](_0xe97d('0x25'),_0xfe4030+'-'+_0x5ed8a0+'/'+_0x69b15)[_0xe97d('0x1f')](_0x28a58c);}return null;};}function saveUpdates(_0x233fd3){return function(_0x2faabc){if(_0x2faabc){return _0x2faabc[_0xe97d('0x26')](_0x233fd3)[_0xe97d('0x14')](function(_0x960812){return _0x960812;});}return null;};}function removeEntity(_0x58c2d5){return function(_0x29ea41){if(_0x29ea41){return _0x29ea41[_0xe97d('0x27')]()[_0xe97d('0x14')](function(){_0x58c2d5['status'](0xcc)[_0xe97d('0x28')]();});}};}function handleEntityNotFound(_0x3e460b){return function(_0x3f2094){if(!_0x3f2094){_0x3e460b[_0xe97d('0x29')](0x194);}return _0x3f2094;};}function handleError(_0x9bca80,_0x9cc3a7){_0x9cc3a7=_0x9cc3a7||0x1f4;return function(_0x24f464){logger[_0xe97d('0x1b')](_0x24f464[_0xe97d('0x2a')]);if(_0x24f464[_0xe97d('0x2b')]){delete _0x24f464[_0xe97d('0x2b')];}_0x9bca80['status'](_0x9cc3a7)['send'](_0x24f464);};}exports[_0xe97d('0x2c')]=function(_0x17757b,_0x257e0a){var _0x3347a0={},_0x2db2e1={},_0x5e7600={'count':0x0,'rows':[]};var _0x48c676=_['map'](db[_0xe97d('0x2d')][_0xe97d('0x2e')],function(_0x22c249){return{'name':_0x22c249['fieldName'],'type':_0x22c249['type'][_0xe97d('0x2f')]};});_0x2db2e1[_0xe97d('0x30')]=_[_0xe97d('0x31')](_0x48c676,_0xe97d('0x2b'));_0x2db2e1[_0xe97d('0x32')]=_[_0xe97d('0x33')](_0x17757b[_0xe97d('0x32')]);_0x2db2e1[_0xe97d('0x34')]=_[_0xe97d('0x35')](_0x2db2e1['model'],_0x2db2e1[_0xe97d('0x32')]);_0x3347a0['attributes']=_['intersection'](_0x2db2e1['model'],qs[_0xe97d('0x36')](_0x17757b[_0xe97d('0x32')]['fields']));_0x3347a0[_0xe97d('0x37')]=_0x3347a0[_0xe97d('0x37')][_0xe97d('0x38')]?_0x3347a0['attributes']:_0x2db2e1['model'];if(!_0x17757b['query'][_0xe97d('0x39')](_0xe97d('0x3a'))){_0x3347a0[_0xe97d('0x21')]=qs[_0xe97d('0x21')](_0x17757b['query'][_0xe97d('0x21')]);_0x3347a0[_0xe97d('0x20')]=qs['offset'](_0x17757b[_0xe97d('0x32')]['offset']);}_0x3347a0[_0xe97d('0x3b')]=qs[_0xe97d('0x3c')](_0x17757b[_0xe97d('0x32')]['sort']);_0x3347a0[_0xe97d('0x3d')]=qs[_0xe97d('0x34')](_[_0xe97d('0x3e')](_0x17757b[_0xe97d('0x32')],_0x2db2e1[_0xe97d('0x34')]),_0x48c676);if(_0x17757b['query'][_0xe97d('0x3f')]){_0x3347a0[_0xe97d('0x3d')]=_[_0xe97d('0x40')](_0x3347a0[_0xe97d('0x3d')],{'$or':_['map'](_0x48c676,function(_0x180b06){if(_0x180b06[_0xe97d('0x41')]!==_0xe97d('0x42')){var _0x563da5={};_0x563da5[_0x180b06[_0xe97d('0x2b')]]={'$like':'%'+_0x17757b[_0xe97d('0x32')][_0xe97d('0x3f')]+'%'};return _0x563da5;}})});}_0x3347a0=_[_0xe97d('0x40')]({},_0x3347a0,_0x17757b['options']);var _0x473c0a={'where':_0x3347a0[_0xe97d('0x3d')]};return db[_0xe97d('0x2d')][_0xe97d('0x23')](_0x473c0a)[_0xe97d('0x14')](function(_0x59f466){_0x5e7600[_0xe97d('0x23')]=_0x59f466;if(_0x17757b[_0xe97d('0x32')]['includeAll']){_0x3347a0['include']=[{'all':!![]}];}return db[_0xe97d('0x2d')][_0xe97d('0x43')](_0x3347a0);})[_0xe97d('0x14')](function(_0x3c7cd3){_0x5e7600[_0xe97d('0x44')]=_0x3c7cd3;return _0x5e7600;})['then'](respondWithFilteredResult(_0x257e0a,_0x3347a0))[_0xe97d('0x45')](handleError(_0x257e0a,null));};exports[_0xe97d('0x46')]=function(_0x227180,_0x57141b){var _0x171f4e={'raw':!![],'where':{'id':_0x227180['params']['id']}},_0x350655={};_0x350655['model']=_[_0xe97d('0x33')](db['MailMessage'][_0xe97d('0x2e')]);_0x350655['query']=_['keys'](_0x227180[_0xe97d('0x32')]);_0x350655[_0xe97d('0x34')]=_[_0xe97d('0x35')](_0x350655['model'],_0x350655[_0xe97d('0x32')]);_0x171f4e[_0xe97d('0x37')]=_[_0xe97d('0x35')](_0x350655[_0xe97d('0x30')],qs[_0xe97d('0x36')](_0x227180[_0xe97d('0x32')][_0xe97d('0x36')]));_0x171f4e[_0xe97d('0x37')]=_0x171f4e[_0xe97d('0x37')][_0xe97d('0x38')]?_0x171f4e[_0xe97d('0x37')]:_0x350655['model'];if(_0x227180['query']['includeAll']){_0x171f4e[_0xe97d('0x47')]=[{'all':!![]}];}_0x171f4e=_['merge']({},_0x171f4e,_0x227180[_0xe97d('0x48')]);return db[_0xe97d('0x2d')][_0xe97d('0x49')](_0x171f4e)[_0xe97d('0x14')](handleEntityNotFound(_0x57141b,null))[_0xe97d('0x14')](respondWithResult(_0x57141b,null))['catch'](handleError(_0x57141b,null));};exports[_0xe97d('0x26')]=function(_0x2d4f3e,_0x4ea40c){if(_0x2d4f3e[_0xe97d('0x4a')]['id']){delete _0x2d4f3e['body']['id'];}return db['MailMessage'][_0xe97d('0x49')]({'where':{'id':_0x2d4f3e['params']['id']}})[_0xe97d('0x14')](handleEntityNotFound(_0x4ea40c,null))['then'](saveUpdates(_0x2d4f3e['body'],null))[_0xe97d('0x14')](respondWithResult(_0x4ea40c,null))[_0xe97d('0x45')](handleError(_0x4ea40c,null));};exports[_0xe97d('0x27')]=function(_0x3e6219,_0x570ab7){return db['MailMessage'][_0xe97d('0x49')]({'where':{'id':_0x3e6219[_0xe97d('0x4b')]['id']}})[_0xe97d('0x14')](handleEntityNotFound(_0x570ab7,null))[_0xe97d('0x14')](removeEntity(_0x570ab7,null))[_0xe97d('0x45')](handleError(_0x570ab7,null));};exports['describe']=function(_0x328096,_0xa79b11){return db[_0xe97d('0x2d')][_0xe97d('0x4c')]()[_0xe97d('0x14')](respondWithResult(_0xa79b11,null))['catch'](handleError(_0xa79b11,null));};exports[_0xe97d('0x4d')]=function(_0x4257ef,_0x4bb78d){return db[_0xe97d('0x2d')][_0xe97d('0x4d')](_0x4257ef['body'])['then'](function(_0x2aaa7e){if(_0x2aaa7e){if(_0x2aaa7e[_0xe97d('0x4e')]===_0xe97d('0x4f')&&!_0x2aaa7e['secret']){var _0x2977a8,_0x337968,_0x10dee3;if(_0x4257ef[_0xe97d('0x4a')]['to']){_0x337968=_0x4257ef[_0xe97d('0x4a')]['to'][_0xe97d('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2aaa7e['MailAccountId']},'include':[{'model':db[_0xe97d('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe97d('0x52'),'where':{'email':_0x337968},'limit':0x1,'order':[['updatedAt',_0xe97d('0x53')]]}]},{'model':db[_0xe97d('0x54')],'as':_0xe97d('0x55'),'raw':!![]}]})['then'](function(_0x2b7e8d){_0x2977a8=_0x2b7e8d;if(_0x2977a8&&_0x2977a8[_0xe97d('0x55')]){var _0x1fe002={'tls':{'rejectUnauthorized':![]}};if(_[_0xe97d('0x56')](_0x2977a8[_0xe97d('0x55')][_0xe97d('0x57')])){_0x1fe002['host']=_0x2977a8[_0xe97d('0x55')][_0xe97d('0x58')];_0x1fe002[_0xe97d('0x59')]=_0x2977a8['Smtp'][_0xe97d('0x59')];_0x1fe002[_0xe97d('0x5a')]=_0x2977a8['Smtp'][_0xe97d('0x5a')];if(_0x2977a8['Smtp']['authentication']){_0x1fe002['auth']={'user':_0x2977a8['Smtp']['user'],'pass':_0x2977a8['Smtp'][_0xe97d('0x5b')]};}}else{_0x1fe002[_0xe97d('0x57')]=_0x2977a8[_0xe97d('0x55')][_0xe97d('0x57')];_0x1fe002[_0xe97d('0x5c')]={'user':_0x2977a8[_0xe97d('0x55')][_0xe97d('0x5d')],'pass':_0x2977a8[_0xe97d('0x55')][_0xe97d('0x5b')]};_0x1fe002[_0xe97d('0x5a')]=_0x2977a8['Smtp'][_0xe97d('0x5a')];}if(_0x4257ef[_0xe97d('0x4a')]['attachments']&&_0x4257ef[_0xe97d('0x4a')][_0xe97d('0x5e')][_0xe97d('0x38')]){for(var _0x461fc0=0x0;_0x461fc0<_0x4257ef[_0xe97d('0x4a')]['attachments'][_0xe97d('0x38')];_0x461fc0+=0x1){_0x4257ef[_0xe97d('0x4a')]['attachments'][_0x461fc0]={'filename':_0x4257ef[_0xe97d('0x4a')][_0xe97d('0x5e')][_0x461fc0][_0xe97d('0x2b')],'path':path['join'](config[_0xe97d('0x5f')],_0xe97d('0x60'),_0x4257ef['body'][_0xe97d('0x5e')][_0x461fc0]['basename'])};}}_0x10dee3={'account':_0x1fe002,'message':_0x4257ef[_0xe97d('0x4a')]};return;}})[_0xe97d('0x14')](function(){if(_0x2977a8[_0xe97d('0x61')]){if(_0x2977a8[_0xe97d('0x61')][_0xe97d('0x52')][_0xe97d('0x38')]){return _0x2977a8[_0xe97d('0x61')]['Contacts'][0x0];}else{return db[_0xe97d('0x62')][_0xe97d('0x4d')](_['defaults'](_0x4257ef['body'],{'firstName':_0x4257ef[_0xe97d('0x4a')]['to'],'email':_0x4257ef[_0xe97d('0x4a')]['to'],'phone':_0x4257ef[_0xe97d('0x4a')]['to'],'ListId':_0x2977a8[_0xe97d('0x63')]}));}}else{throw new Error(_0xe97d('0x64'));}})[_0xe97d('0x14')](function(){if(_0x10dee3){return respondWithRpcPromise(_0xe97d('0x65'),'sendMail',_0x10dee3,client9003)[_0xe97d('0x14')](function(_0x4171bb){return _0x2aaa7e[_0xe97d('0x26')]({'read':!![],'messageId':_0x4171bb['messageId'],'sentAt':moment()[_0xe97d('0x66')](_0xe97d('0x67'))});})[_0xe97d('0x45')](function(_0x73f152){logger['error']('%s',JSON[_0xe97d('0x1a')](_0x73f152));return _0x2aaa7e;});}return _0x2aaa7e;});}return _0x2aaa7e;}})[_0xe97d('0x14')](respondWithResult(_0x4bb78d,0xc9))[_0xe97d('0x45')](handleError(_0x4bb78d,null));};exports[_0xe97d('0x68')]=function(_0x15c300,_0x43fac9){var _0x30f004={'agent':{},'channel':_0xe97d('0x69')};if(_0x15c300[_0xe97d('0x4a')]['id']){delete _0x15c300[_0xe97d('0x4a')]['id'];}_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6a')]=!![];_0x15c300['body'][_0xe97d('0x6b')]=moment()[_0xe97d('0x66')](_0xe97d('0x67'));_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6c')]=_0x15c300['body'][_0xe97d('0x6c')]||_0x15c300['user']['id'];_0x30f004[_0xe97d('0x6d')]['id']=_0x15c300[_0xe97d('0x4a')]['UserId'];return db[_0xe97d('0x2d')]['find']({'where':{'id':_0x15c300[_0xe97d('0x4b')]['id'],'UserId':null}})[_0xe97d('0x14')](handleEntityNotFound(_0x43fac9,null))[_0xe97d('0x14')](saveUpdates(_0x15c300['body'],null))[_0xe97d('0x14')](function(_0x183312){if(_0x183312){_0x30f004['message']=_0x183312[_0xe97d('0x6e')]({'plain':!![]});return db[_0xe97d('0x6f')][_0xe97d('0x49')]({'where':{'id':_0x183312[_0xe97d('0x70')]}});}return null;})[_0xe97d('0x14')](handleEntityNotFound(_0x43fac9,null))[_0xe97d('0x14')](function(_0x4a1b11){if(_0x4a1b11){return _0x4a1b11['update']({'UserId':_0x15c300['body'][_0xe97d('0x6c')],'read1stAt':_['isNil'](_0x4a1b11[_0xe97d('0x71')])?moment()[_0xe97d('0x66')](_0xe97d('0x67')):undefined});}return null;})[_0xe97d('0x14')](function(_0x5bcefa){if(_0x5bcefa){_0x30f004['interaction']=_0x5bcefa['get']({'plain':!![]});interaction_log[_0xe97d('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15c300[_0xe97d('0x5d')]['id'],_0x15c300[_0xe97d('0x5d')][_0xe97d('0x2b')],_0x15c300[_0xe97d('0x5d')]['role'],_0x30f004[_0xe97d('0x72')]['id'],_0x15c300[_0xe97d('0x4a')]?JSON[_0xe97d('0x1a')](_0x15c300['body']):'null');return respondWithRpcPromise(_0xe97d('0x73'),'acceptMessage',_0x30f004);}return null;})[_0xe97d('0x14')](function(_0x56a31c){var _0x127f3e=_0xe97d('0x74')+_0x56a31c['message'][_0xe97d('0x75')];return db[_0xe97d('0x76')][_0xe97d('0x32')](_0x127f3e,{'type':db[_0xe97d('0x77')][_0xe97d('0x78')][_0xe97d('0x79')],'raw':!![]})[_0xe97d('0x14')](function(_0x8c6517){return _0x8c6517;});})[_0xe97d('0x14')](function(_0x325ccb){if(_0x325ccb){_0x30f004[_0xe97d('0x1d')][_0xe97d('0x7a')]=_0x325ccb[0x0];if(!_0x15c300['body'][_0xe97d('0x6c')])return;return db['User'][_0xe97d('0x49')]({'where':{'id':_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6c')],'role':_0xe97d('0x6d')},'attributes':['id',_0xe97d('0x2b'),_0xe97d('0x7b'),_0xe97d('0x7c'),_0xe97d('0x7d')],'raw':!![]});}return null;})[_0xe97d('0x14')](function(_0x5121cc){if(!_0x5121cc)return null;_0x30f004[_0xe97d('0x1d')][_0xe97d('0x6d')]=_0x5121cc;return _0x30f004;})[_0xe97d('0x14')](function(_0x6f16a1){if(_0x6f16a1){if(_0x15c300['body'][_0xe97d('0x7e')]){_0x30f004[_0xe97d('0x1d')]['interface']=util[_0xe97d('0x66')]('SIP/%s',_0x15c300['user'][_0xe97d('0x2b')]);_0x30f004[_0xe97d('0x1d')][_0xe97d('0x7f')]=_0x30f004[_0xe97d('0x7f')];_0x30f004[_0xe97d('0x1d')][_0xe97d('0x80')]=_0x30f004[_0xe97d('0x7f')];_0x30f004[_0xe97d('0x1d')][_0xe97d('0x81')]='accept';_0x30f004[_0xe97d('0x1d')][_0xe97d('0x4a')]=htmlToText[_0xe97d('0x82')](_0x30f004[_0xe97d('0x1d')][_0xe97d('0x4a')]);return respondWithRpcPromise(_0xe97d('0x83'),'EventManager',{'event':_0xe97d('0x84'),'message':_0x30f004[_0xe97d('0x1d')]},client9002)['then'](function(){return _0x30f004;});}return _0x30f004;}return null;})[_0xe97d('0x14')](respondWithResult(_0x43fac9,null))[_0xe97d('0x45')](handleError(_0x43fac9,null));};exports['reject']=function(_0x1f3e06,_0x5413de){var _0x2466c7={'agent':{},'channel':_0xe97d('0x69')};if(_0x1f3e06['body']['id']){delete _0x1f3e06[_0xe97d('0x4a')]['id'];}_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')]=_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')]||_0x1f3e06['user']['id'];_0x2466c7[_0xe97d('0x6d')]['id']=_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')];return db[_0xe97d('0x2d')][_0xe97d('0x49')]({'where':{'id':_0x1f3e06[_0xe97d('0x4b')]['id'],'UserId':null}})[_0xe97d('0x14')](handleEntityNotFound(_0x5413de,null))[_0xe97d('0x14')](function(_0x30944b){if(_0x30944b){_0x2466c7[_0xe97d('0x1d')]=_0x30944b['get']({'plain':!![]});return db[_0xe97d('0x6f')][_0xe97d('0x49')]({'where':{'id':_0x30944b['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5413de,null))['then'](function(_0x1eca84){if(_0x1eca84){_0x2466c7[_0xe97d('0x72')]=_0x1eca84[_0xe97d('0x6e')]({'plain':!![]});interaction_log[_0xe97d('0x15')](_0xe97d('0x85'),_0x1f3e06[_0xe97d('0x5d')]['id'],_0x1f3e06['user'][_0xe97d('0x2b')],_0x1f3e06['user'][_0xe97d('0x86')],_0x2466c7['interaction']['id'],_0x1f3e06[_0xe97d('0x4a')]?JSON[_0xe97d('0x1a')](_0x1f3e06[_0xe97d('0x4a')]):_0xe97d('0x87'));return respondWithRpcPromise(_0xe97d('0x88'),_0xe97d('0x89'),_0x2466c7);}return null;})[_0xe97d('0x14')](function(_0x10d55c){var _0x155316=_0xe97d('0x74')+_0x10d55c[_0xe97d('0x1d')][_0xe97d('0x75')];return db[_0xe97d('0x76')][_0xe97d('0x32')](_0x155316,{'type':db[_0xe97d('0x77')][_0xe97d('0x78')][_0xe97d('0x79')],'raw':!![]})['then'](function(_0x4e7f58){return _0x4e7f58;});})[_0xe97d('0x14')](function(_0x104e6d){if(_0x104e6d){_0x2466c7['message'][_0xe97d('0x7a')]=_0x104e6d[0x0];if(!_0x1f3e06[_0xe97d('0x4a')]['UserId'])return;return db[_0xe97d('0x8a')][_0xe97d('0x49')]({'where':{'id':_0x1f3e06['body']['UserId'],'role':_0xe97d('0x6d')},'attributes':['id',_0xe97d('0x2b'),_0xe97d('0x7b'),_0xe97d('0x7c'),'internal'],'raw':!![]});}return null;})[_0xe97d('0x14')](function(_0x34f7d4){if(!_0x34f7d4)return null;_0x2466c7[_0xe97d('0x1d')]['agent']=_0x34f7d4;return _0x2466c7;})[_0xe97d('0x14')](function(_0x439653){if(_0x439653){_0x439653[_0xe97d('0x1d')]['interface']=util['format']('SIP/%s',_0x1f3e06[_0xe97d('0x5d')][_0xe97d('0x2b')]);_0x439653[_0xe97d('0x1d')][_0xe97d('0x7f')]=_0x2466c7[_0xe97d('0x7f')];_0x439653[_0xe97d('0x1d')]['motionChannel']=_0x2466c7[_0xe97d('0x7f')];_0x439653[_0xe97d('0x1d')][_0xe97d('0x81')]=_0xe97d('0x8b');_0x439653[_0xe97d('0x1d')][_0xe97d('0x4a')]=htmlToText[_0xe97d('0x82')](_0x2466c7[_0xe97d('0x1d')]['body']);respondWithRpcPromise('EventManager',_0xe97d('0x83'),{'event':_0xe97d('0x8c'),'message':_0x439653['message']},client9002);return _0x2466c7;}return null;})[_0xe97d('0x14')](respondWithResult(_0x5413de,null))[_0xe97d('0x45')](handleError(_0x5413de,null));};exports[_0xe97d('0x8d')]=function(_0x4fbd3b,_0xf389be){var _0x588654=moment()[_0xe97d('0x8e')]()['toString']();var _0x39a2ac=path[_0xe97d('0x8f')](config[_0xe97d('0x5f')],'server','files',_0xe97d('0x90'));var _0x47afb2=path['join'](config['root'],_0xe97d('0x91'),_0xe97d('0x92'),_0xe97d('0x5e'));var _0x2737da=util['format'](_0xe97d('0x93'),_0x588654);return db[_0xe97d('0x2d')]['find']({'where':{'id':_0x4fbd3b[_0xe97d('0x4b')]['id']},'attributes':['id',_0xe97d('0x4a'),_0xe97d('0x94'),'to','cc',_0xe97d('0x95'),'subject',_0xe97d('0x96')],'include':_0x4fbd3b['query'][_0xe97d('0x5e')]?[{'model':db['Attachment'],'as':_0xe97d('0x97')}]:undefined})['then'](handleEntityNotFound(_0xf389be,null))['then'](function(_0x13fd5b){if(_0x13fd5b){var _0x5cdb61=_0x13fd5b;var _0x76c843={'from':_0x5cdb61[_0xe97d('0x94')],'to':_0x5cdb61['to'],'subject':_0x5cdb61['subject'],'html':htmlEntities[_0xe97d('0x98')](_0x5cdb61[_0xe97d('0x4a')]),'headers':{'Date':moment(_0x5cdb61[_0xe97d('0x96')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x13fd5b['cc']){_0x76c843['headers']['Cc']=_0x13fd5b['cc'];}if(_0x13fd5b[_0xe97d('0x95')]){_0x76c843[_0xe97d('0x99')][_0xe97d('0x9a')]=_0x13fd5b[_0xe97d('0x95')];}return new BPromise(function(_0xf25297,_0x361b0e){if(_0x13fd5b['Attachments']){for(var _0x2ff7f1=0x0;_0x2ff7f1<_0x13fd5b[_0xe97d('0x97')]['length'];_0x2ff7f1++){var _0x5739e4=_0x13fd5b[_0xe97d('0x97')][_0x2ff7f1];var _0x8f631e=path[_0xe97d('0x8f')](_0x47afb2,_0x5739e4[_0xe97d('0x9b')]);if(fs[_0xe97d('0x9c')](_0x8f631e)){_0x76c843[_0xe97d('0x5e')]['push']({'name':_0x5739e4[_0xe97d('0x2b')],'contentType':_0x5739e4[_0xe97d('0x41')],'data':fs[_0xe97d('0x9d')](_0x8f631e)});}}}emlformat[_0xe97d('0x9e')](_0x76c843,function(_0x5e35cd,_0x4dae30){if(_0x5e35cd)return _0x361b0e(_0x5e35cd);fs[_0xe97d('0x9f')](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da),_0x4dae30);return _0xf25297(_0x4dae30);});});}})['then'](function(_0x4b6a99){if(_0x4b6a99){return _0xf389be['download'](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da),_0x2737da,function(_0x115c72){if(!_0x115c72)fs[_0xe97d('0xa0')](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da));});}})[_0xe97d('0x45')](handleError(_0xf389be,null));}; \ No newline at end of file +var _0x1137=['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','catch','status','offset','undefined','limit','count','set','Content-Range','json','destroy','end','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','update','body','describe','create','direction','out','secret','MailAccount','findOne','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','MailInteractionId','isNil','read1stAt','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','EventManager','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','QueryTypes','User','event','rejectmessage','download','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','moment','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket'];(function(_0x1ae4cf,_0x486600){var _0x5c1b93=function(_0x293126){while(--_0x293126){_0x1ae4cf['push'](_0x1ae4cf['shift']());}};_0x5c1b93(++_0x486600);}(_0x1137,0x1d6));var _0x7113=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x1137[_0x387dc1];return _0x17567c;};'use strict';var emlformat=require('eml-format');var moment=require(_0x7113('0x0'));var BPromise=require(_0x7113('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x7113('0x2'));var Redis=require(_0x7113('0x3'));var htmlToText=require('html-to-text');var qs=require(_0x7113('0x4'));var logger=require(_0x7113('0x5'))(_0x7113('0x6'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require('../../config/environment');var db=require(_0x7113('0x7'))['db'];config[_0x7113('0x8')]=_['defaults'](config['redis'],{'host':_0x7113('0x9'),'port':0x18eb});var socket=require(_0x7113('0xa'))(new Redis(config[_0x7113('0x8')]));var htmlEntities=require(_0x7113('0xb'));require(_0x7113('0xc'))[_0x7113('0xd')](socket);var jayson=require(_0x7113('0xe'));var client=jayson[_0x7113('0xf')][_0x7113('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x7113('0x10')]({'port':0x232b});var client9002=jayson[_0x7113('0xf')][_0x7113('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x22045c,_0x48a550,_0x329cb0,_0x25df6a){return new BPromise(function(_0x124343,_0x5d9159){var _0x3a11c5=_0x25df6a||client;return _0x3a11c5['request'](_0x22045c,_0x329cb0)[_0x7113('0x11')](function(_0x435d48){logger[_0x7113('0x12')](_0x7113('0x13'),_0x48a550,_0x7113('0x14'));logger[_0x7113('0x15')](_0x7113('0x16'),_0x48a550,_0x7113('0x14'),JSON[_0x7113('0x17')](_0x435d48));if(_0x435d48[_0x7113('0x18')]){if(_0x435d48[_0x7113('0x18')][_0x7113('0x19')]===0x1f4){logger[_0x7113('0x18')](_0x7113('0x13'),_0x48a550,_0x435d48[_0x7113('0x18')][_0x7113('0x1a')]);return _0x5d9159(_0x435d48[_0x7113('0x18')][_0x7113('0x1a')]);}logger[_0x7113('0x18')]('MailMessage,\x20%s,\x20%s',_0x48a550,_0x435d48[_0x7113('0x18')][_0x7113('0x1a')]);return _0x124343(_0x435d48[_0x7113('0x18')][_0x7113('0x1a')]);}else{logger[_0x7113('0x12')]('MailMessage,\x20%s,\x20%s',_0x48a550,_0x7113('0x14'));_0x124343(_0x435d48[_0x7113('0x1b')]['message']);}})[_0x7113('0x1c')](function(_0x3d00f3){logger[_0x7113('0x18')]('MailMessage,\x20%s,\x20%s',_0x48a550,_0x3d00f3);_0x5d9159(_0x3d00f3);});});}function respondWithResult(_0xd03e54,_0x1636c2){_0x1636c2=_0x1636c2||0xc8;return function(_0x2f698c){if(_0x2f698c){return _0xd03e54[_0x7113('0x1d')](_0x1636c2)['json'](_0x2f698c);}};}function respondWithFilteredResult(_0x1d002b,_0x2c09dc){return function(_0x25fdaf){if(_0x25fdaf){var _0x45dc80=typeof _0x2c09dc[_0x7113('0x1e')]===_0x7113('0x1f')&&typeof _0x2c09dc[_0x7113('0x20')]===_0x7113('0x1f');var _0x110f0d=_0x25fdaf['count'];var _0x318148=_0x45dc80?0x0:_0x2c09dc[_0x7113('0x1e')];var _0x29bd88=_0x45dc80?_0x25fdaf[_0x7113('0x21')]:_0x2c09dc[_0x7113('0x1e')]+_0x2c09dc[_0x7113('0x20')];var _0x52e22c;if(_0x29bd88>=_0x110f0d){_0x29bd88=_0x110f0d;_0x52e22c=0xc8;}else{_0x52e22c=0xce;}_0x1d002b[_0x7113('0x1d')](_0x52e22c);return _0x1d002b[_0x7113('0x22')](_0x7113('0x23'),_0x318148+'-'+_0x29bd88+'/'+_0x110f0d)[_0x7113('0x24')](_0x25fdaf);}return null;};}function saveUpdates(_0x598180){return function(_0x378847){if(_0x378847){return _0x378847['update'](_0x598180)[_0x7113('0x11')](function(_0x1ac210){return _0x1ac210;});}return null;};}function removeEntity(_0x506839){return function(_0x57c198){if(_0x57c198){return _0x57c198[_0x7113('0x25')]()['then'](function(){_0x506839[_0x7113('0x1d')](0xcc)[_0x7113('0x26')]();});}};}function handleEntityNotFound(_0x383cbf){return function(_0x470b34){if(!_0x470b34){_0x383cbf['sendStatus'](0x194);}return _0x470b34;};}function handleError(_0x5a6f55,_0x4fdaca){_0x4fdaca=_0x4fdaca||0x1f4;return function(_0x184ba9){logger[_0x7113('0x18')](_0x184ba9['stack']);if(_0x184ba9[_0x7113('0x27')]){delete _0x184ba9['name'];}_0x5a6f55[_0x7113('0x1d')](_0x4fdaca)['send'](_0x184ba9);};}exports[_0x7113('0x28')]=function(_0x4cf9f7,_0x3844f0){var _0x5f3213={},_0x159f3a={},_0x4e5e61={'count':0x0,'rows':[]};var _0x264653=_[_0x7113('0x29')](db[_0x7113('0x2a')][_0x7113('0x2b')],function(_0x8bdbb6){return{'name':_0x8bdbb6[_0x7113('0x2c')],'type':_0x8bdbb6[_0x7113('0x2d')][_0x7113('0x2e')]};});_0x159f3a[_0x7113('0x2f')]=_[_0x7113('0x29')](_0x264653,_0x7113('0x27'));_0x159f3a['query']=_['keys'](_0x4cf9f7['query']);_0x159f3a[_0x7113('0x30')]=_[_0x7113('0x31')](_0x159f3a[_0x7113('0x2f')],_0x159f3a[_0x7113('0x32')]);_0x5f3213['attributes']=_[_0x7113('0x31')](_0x159f3a[_0x7113('0x2f')],qs['fields'](_0x4cf9f7[_0x7113('0x32')][_0x7113('0x33')]));_0x5f3213[_0x7113('0x34')]=_0x5f3213[_0x7113('0x34')][_0x7113('0x35')]?_0x5f3213[_0x7113('0x34')]:_0x159f3a[_0x7113('0x2f')];if(!_0x4cf9f7[_0x7113('0x32')][_0x7113('0x36')]('nolimit')){_0x5f3213[_0x7113('0x20')]=qs[_0x7113('0x20')](_0x4cf9f7['query'][_0x7113('0x20')]);_0x5f3213[_0x7113('0x1e')]=qs['offset'](_0x4cf9f7['query'][_0x7113('0x1e')]);}_0x5f3213[_0x7113('0x37')]=qs[_0x7113('0x38')](_0x4cf9f7[_0x7113('0x32')][_0x7113('0x38')]);_0x5f3213[_0x7113('0x39')]=qs[_0x7113('0x30')](_[_0x7113('0x3a')](_0x4cf9f7[_0x7113('0x32')],_0x159f3a[_0x7113('0x30')]),_0x264653);if(_0x4cf9f7[_0x7113('0x32')][_0x7113('0x3b')]){_0x5f3213[_0x7113('0x39')]=_[_0x7113('0x3c')](_0x5f3213['where'],{'$or':_[_0x7113('0x29')](_0x264653,function(_0xb25667){if(_0xb25667[_0x7113('0x2d')]!==_0x7113('0x3d')){var _0x33084b={};_0x33084b[_0xb25667['name']]={'$like':'%'+_0x4cf9f7[_0x7113('0x32')][_0x7113('0x3b')]+'%'};return _0x33084b;}})});}_0x5f3213=_['merge']({},_0x5f3213,_0x4cf9f7[_0x7113('0x3e')]);var _0x2dd5f8={'where':_0x5f3213['where']};return db[_0x7113('0x2a')][_0x7113('0x21')](_0x2dd5f8)['then'](function(_0x3d32ef){_0x4e5e61[_0x7113('0x21')]=_0x3d32ef;if(_0x4cf9f7[_0x7113('0x32')][_0x7113('0x3f')]){_0x5f3213[_0x7113('0x40')]=[{'all':!![]}];}return db['MailMessage'][_0x7113('0x41')](_0x5f3213);})[_0x7113('0x11')](function(_0x520ceb){_0x4e5e61[_0x7113('0x42')]=_0x520ceb;return _0x4e5e61;})['then'](respondWithFilteredResult(_0x3844f0,_0x5f3213))['catch'](handleError(_0x3844f0,null));};exports['show']=function(_0x2a1330,_0x34bb20){var _0x900940={'raw':!![],'where':{'id':_0x2a1330[_0x7113('0x43')]['id']}},_0x38e3d1={};_0x38e3d1[_0x7113('0x2f')]=_[_0x7113('0x44')](db['MailMessage'][_0x7113('0x2b')]);_0x38e3d1[_0x7113('0x32')]=_[_0x7113('0x44')](_0x2a1330[_0x7113('0x32')]);_0x38e3d1['filters']=_[_0x7113('0x31')](_0x38e3d1[_0x7113('0x2f')],_0x38e3d1[_0x7113('0x32')]);_0x900940[_0x7113('0x34')]=_[_0x7113('0x31')](_0x38e3d1[_0x7113('0x2f')],qs[_0x7113('0x33')](_0x2a1330['query'][_0x7113('0x33')]));_0x900940[_0x7113('0x34')]=_0x900940[_0x7113('0x34')]['length']?_0x900940[_0x7113('0x34')]:_0x38e3d1[_0x7113('0x2f')];if(_0x2a1330[_0x7113('0x32')][_0x7113('0x3f')]){_0x900940[_0x7113('0x40')]=[{'all':!![]}];}_0x900940=_[_0x7113('0x3c')]({},_0x900940,_0x2a1330[_0x7113('0x3e')]);return db[_0x7113('0x2a')][_0x7113('0x45')](_0x900940)[_0x7113('0x11')](handleEntityNotFound(_0x34bb20,null))[_0x7113('0x11')](respondWithResult(_0x34bb20,null))['catch'](handleError(_0x34bb20,null));};exports[_0x7113('0x46')]=function(_0xf0e4f0,_0x5c5010){if(_0xf0e4f0['body']['id']){delete _0xf0e4f0[_0x7113('0x47')]['id'];}return db['MailMessage']['find']({'where':{'id':_0xf0e4f0['params']['id']}})[_0x7113('0x11')](handleEntityNotFound(_0x5c5010,null))[_0x7113('0x11')](saveUpdates(_0xf0e4f0[_0x7113('0x47')],null))['then'](respondWithResult(_0x5c5010,null))['catch'](handleError(_0x5c5010,null));};exports[_0x7113('0x25')]=function(_0x5de41d,_0x13312e){return db['MailMessage'][_0x7113('0x45')]({'where':{'id':_0x5de41d[_0x7113('0x43')]['id']}})['then'](handleEntityNotFound(_0x13312e,null))[_0x7113('0x11')](removeEntity(_0x13312e,null))[_0x7113('0x1c')](handleError(_0x13312e,null));};exports[_0x7113('0x48')]=function(_0x64b55f,_0x2d88ca){return db[_0x7113('0x2a')][_0x7113('0x48')]()[_0x7113('0x11')](respondWithResult(_0x2d88ca,null))[_0x7113('0x1c')](handleError(_0x2d88ca,null));};exports['create']=function(_0x271f69,_0x5b2cab){return db[_0x7113('0x2a')][_0x7113('0x49')](_0x271f69[_0x7113('0x47')])[_0x7113('0x11')](function(_0x32cd2e){if(_0x32cd2e){if(_0x32cd2e[_0x7113('0x4a')]===_0x7113('0x4b')&&!_0x32cd2e[_0x7113('0x4c')]){var _0x5caac9,_0x4f6d90,_0x5010b3;if(_0x271f69[_0x7113('0x47')]['to']){_0x4f6d90=_0x271f69[_0x7113('0x47')]['to']['split'](',')[0x0];}return db[_0x7113('0x4d')][_0x7113('0x4e')]({'where':{'id':_0x32cd2e['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x7113('0x4f'),'include':[{'model':db[_0x7113('0x50')],'as':_0x7113('0x51'),'where':{'email':_0x4f6d90},'limit':0x1,'order':[[_0x7113('0x52'),_0x7113('0x53')]]}]},{'model':db[_0x7113('0x54')],'as':_0x7113('0x55'),'raw':!![]}]})[_0x7113('0x11')](function(_0x18c281){_0x5caac9=_0x18c281;if(_0x5caac9&&_0x5caac9[_0x7113('0x55')]){var _0x550fac={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5caac9[_0x7113('0x55')][_0x7113('0x56')])){_0x550fac[_0x7113('0x57')]=_0x5caac9['Smtp'][_0x7113('0x57')];_0x550fac[_0x7113('0x58')]=_0x5caac9[_0x7113('0x55')][_0x7113('0x58')];_0x550fac[_0x7113('0x59')]=_0x5caac9[_0x7113('0x55')][_0x7113('0x59')];if(_0x5caac9[_0x7113('0x55')][_0x7113('0x5a')]){_0x550fac[_0x7113('0x5b')]={'user':_0x5caac9[_0x7113('0x55')]['user'],'pass':_0x5caac9['Smtp'][_0x7113('0x5c')]};}}else{_0x550fac['service']=_0x5caac9['Smtp'][_0x7113('0x56')];_0x550fac[_0x7113('0x5b')]={'user':_0x5caac9[_0x7113('0x55')][_0x7113('0x5d')],'pass':_0x5caac9[_0x7113('0x55')][_0x7113('0x5c')]};_0x550fac['secure']=_0x5caac9[_0x7113('0x55')][_0x7113('0x59')];}if(_0x271f69[_0x7113('0x47')][_0x7113('0x5e')]&&_0x271f69[_0x7113('0x47')][_0x7113('0x5e')][_0x7113('0x35')]){for(var _0x46f4b0=0x0;_0x46f4b0<_0x271f69[_0x7113('0x47')]['attachments'][_0x7113('0x35')];_0x46f4b0+=0x1){_0x271f69[_0x7113('0x47')][_0x7113('0x5e')][_0x46f4b0]={'filename':_0x271f69[_0x7113('0x47')]['attachments'][_0x46f4b0][_0x7113('0x27')],'path':path[_0x7113('0x5f')](config[_0x7113('0x60')],_0x7113('0x61'),_0x271f69[_0x7113('0x47')][_0x7113('0x5e')][_0x46f4b0][_0x7113('0x62')])};}}_0x5010b3={'account':_0x550fac,'message':_0x271f69[_0x7113('0x47')]};return;}})[_0x7113('0x11')](function(){if(_0x5caac9[_0x7113('0x4f')]){if(_0x5caac9[_0x7113('0x4f')][_0x7113('0x51')][_0x7113('0x35')]){return _0x5caac9[_0x7113('0x4f')]['Contacts'][0x0];}else{return db[_0x7113('0x50')][_0x7113('0x49')](_['defaults'](_0x271f69['body'],{'firstName':_0x271f69[_0x7113('0x47')]['to'],'email':_0x271f69[_0x7113('0x47')]['to'],'phone':_0x271f69[_0x7113('0x47')]['to'],'ListId':_0x5caac9[_0x7113('0x63')]}));}}else{throw new Error(_0x7113('0x64'));}})[_0x7113('0x11')](function(){if(_0x5010b3){return respondWithRpcPromise('SendMail',_0x7113('0x65'),_0x5010b3,client9003)[_0x7113('0x11')](function(_0x3639bb){return _0x32cd2e[_0x7113('0x46')]({'read':!![],'messageId':_0x3639bb['messageId'],'sentAt':moment()[_0x7113('0x66')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x479919){logger[_0x7113('0x18')]('%s',JSON['stringify'](_0x479919));return _0x32cd2e;});}return _0x32cd2e;});}return _0x32cd2e;}})[_0x7113('0x11')](respondWithResult(_0x5b2cab,0xc9))['catch'](handleError(_0x5b2cab,null));};exports[_0x7113('0x67')]=function(_0x4298a8,_0x5524a8){var _0x39c022={'agent':{},'channel':'mail'};if(_0x4298a8['body']['id']){delete _0x4298a8[_0x7113('0x47')]['id'];}_0x4298a8[_0x7113('0x47')][_0x7113('0x68')]=!![];_0x4298a8[_0x7113('0x47')][_0x7113('0x69')]=moment()[_0x7113('0x66')](_0x7113('0x6a'));_0x4298a8[_0x7113('0x47')][_0x7113('0x6b')]=_0x4298a8[_0x7113('0x47')][_0x7113('0x6b')]||_0x4298a8[_0x7113('0x5d')]['id'];_0x39c022[_0x7113('0x6c')]['id']=_0x4298a8[_0x7113('0x47')]['UserId'];return db[_0x7113('0x2a')][_0x7113('0x45')]({'where':{'id':_0x4298a8[_0x7113('0x43')]['id'],'UserId':null}})[_0x7113('0x11')](handleEntityNotFound(_0x5524a8,null))[_0x7113('0x11')](saveUpdates(_0x4298a8[_0x7113('0x47')],null))['then'](function(_0x5be1a0){if(_0x5be1a0){_0x39c022[_0x7113('0x1a')]=_0x5be1a0['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5be1a0[_0x7113('0x6d')]}});}return null;})[_0x7113('0x11')](handleEntityNotFound(_0x5524a8,null))[_0x7113('0x11')](function(_0x38d0e3){if(_0x38d0e3){return _0x38d0e3[_0x7113('0x46')]({'UserId':_0x4298a8['body']['UserId'],'read1stAt':_[_0x7113('0x6e')](_0x38d0e3[_0x7113('0x6f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7113('0x11')](function(_0x23c868){if(_0x23c868){_0x39c022['interaction']=_0x23c868[_0x7113('0x70')]({'plain':!![]});interaction_log['info'](_0x7113('0x71'),_0x4298a8['user']['id'],_0x4298a8[_0x7113('0x5d')][_0x7113('0x27')],_0x4298a8[_0x7113('0x5d')][_0x7113('0x72')],_0x39c022[_0x7113('0x73')]['id'],_0x4298a8[_0x7113('0x47')]?JSON[_0x7113('0x17')](_0x4298a8[_0x7113('0x47')]):_0x7113('0x74'));return respondWithRpcPromise('AcceptMessage',_0x7113('0x75'),_0x39c022);}return null;})[_0x7113('0x11')](function(_0x5e6d53){var _0x326b01=_0x7113('0x76')+_0x5e6d53[_0x7113('0x1a')]['ContactId'];return db[_0x7113('0x77')][_0x7113('0x32')](_0x326b01,{'type':db[_0x7113('0x78')]['QueryTypes'][_0x7113('0x79')],'raw':!![]})['then'](function(_0x9a4d4){return _0x9a4d4;});})[_0x7113('0x11')](function(_0x37b44e){if(_0x37b44e){_0x39c022[_0x7113('0x1a')][_0x7113('0x7a')]=_0x37b44e[0x0];if(!_0x4298a8[_0x7113('0x47')][_0x7113('0x6b')])return;return db['User'][_0x7113('0x45')]({'where':{'id':_0x4298a8[_0x7113('0x47')][_0x7113('0x6b')],'role':_0x7113('0x6c')},'attributes':['id',_0x7113('0x27'),_0x7113('0x7b'),'email',_0x7113('0x7c')],'raw':!![]});}return null;})['then'](function(_0x409ec2){if(!_0x409ec2)return null;_0x39c022[_0x7113('0x1a')][_0x7113('0x6c')]=_0x409ec2;return _0x39c022;})['then'](function(_0x4d11c5){if(_0x4d11c5){if(_0x4298a8[_0x7113('0x47')][_0x7113('0x7d')]){_0x39c022[_0x7113('0x1a')][_0x7113('0x7e')]=util['format'](_0x7113('0x7f'),_0x4298a8[_0x7113('0x5d')][_0x7113('0x27')]);_0x39c022[_0x7113('0x1a')][_0x7113('0x80')]=_0x39c022[_0x7113('0x80')];_0x39c022[_0x7113('0x1a')][_0x7113('0x81')]=_0x39c022[_0x7113('0x80')];_0x39c022[_0x7113('0x1a')]['event']=_0x7113('0x67');_0x39c022['message'][_0x7113('0x47')]=htmlToText[_0x7113('0x82')](_0x39c022[_0x7113('0x1a')][_0x7113('0x47')]);return respondWithRpcPromise(_0x7113('0x83'),_0x7113('0x83'),{'event':'acceptmessage','message':_0x39c022[_0x7113('0x1a')]},client9002)[_0x7113('0x11')](function(){return _0x39c022;});}return _0x39c022;}return null;})[_0x7113('0x11')](respondWithResult(_0x5524a8,null))[_0x7113('0x1c')](handleError(_0x5524a8,null));};exports['reject']=function(_0x10d931,_0x4c3369){var _0x498c23={'agent':{},'channel':'mail'};if(_0x10d931['body']['id']){delete _0x10d931[_0x7113('0x47')]['id'];}_0x10d931[_0x7113('0x47')][_0x7113('0x6b')]=_0x10d931['body'][_0x7113('0x6b')]||_0x10d931[_0x7113('0x5d')]['id'];_0x498c23[_0x7113('0x6c')]['id']=_0x10d931[_0x7113('0x47')]['UserId'];return db['MailMessage'][_0x7113('0x45')]({'where':{'id':_0x10d931[_0x7113('0x43')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c3369,null))[_0x7113('0x11')](function(_0x54323d){if(_0x54323d){_0x498c23['message']=_0x54323d[_0x7113('0x70')]({'plain':!![]});return db[_0x7113('0x84')][_0x7113('0x45')]({'where':{'id':_0x54323d[_0x7113('0x6d')]}});}return null;})[_0x7113('0x11')](handleEntityNotFound(_0x4c3369,null))['then'](function(_0x298c4e){if(_0x298c4e){_0x498c23[_0x7113('0x73')]=_0x298c4e[_0x7113('0x70')]({'plain':!![]});interaction_log['info'](_0x7113('0x85'),_0x10d931['user']['id'],_0x10d931[_0x7113('0x5d')][_0x7113('0x27')],_0x10d931[_0x7113('0x5d')][_0x7113('0x72')],_0x498c23[_0x7113('0x73')]['id'],_0x10d931[_0x7113('0x47')]?JSON[_0x7113('0x17')](_0x10d931[_0x7113('0x47')]):_0x7113('0x74'));return respondWithRpcPromise(_0x7113('0x86'),_0x7113('0x87'),_0x498c23);}return null;})[_0x7113('0x11')](function(_0x44ab3d){var _0x3d41df=_0x7113('0x76')+_0x44ab3d[_0x7113('0x1a')][_0x7113('0x88')];return db[_0x7113('0x77')][_0x7113('0x32')](_0x3d41df,{'type':db[_0x7113('0x78')][_0x7113('0x89')][_0x7113('0x79')],'raw':!![]})[_0x7113('0x11')](function(_0x6d7bb2){return _0x6d7bb2;});})[_0x7113('0x11')](function(_0x5596f9){if(_0x5596f9){_0x498c23['message']['contact']=_0x5596f9[0x0];if(!_0x10d931['body'][_0x7113('0x6b')])return;return db[_0x7113('0x8a')][_0x7113('0x45')]({'where':{'id':_0x10d931[_0x7113('0x47')][_0x7113('0x6b')],'role':_0x7113('0x6c')},'attributes':['id',_0x7113('0x27'),'fullname','email',_0x7113('0x7c')],'raw':!![]});}return null;})[_0x7113('0x11')](function(_0x1e8981){if(!_0x1e8981)return null;_0x498c23[_0x7113('0x1a')]['agent']=_0x1e8981;return _0x498c23;})['then'](function(_0x3843e8){if(_0x3843e8){_0x3843e8[_0x7113('0x1a')][_0x7113('0x7e')]=util[_0x7113('0x66')]('SIP/%s',_0x10d931['user'][_0x7113('0x27')]);_0x3843e8[_0x7113('0x1a')]['channel']=_0x498c23[_0x7113('0x80')];_0x3843e8[_0x7113('0x1a')]['motionChannel']=_0x498c23[_0x7113('0x80')];_0x3843e8[_0x7113('0x1a')][_0x7113('0x8b')]='reject';_0x3843e8['message'][_0x7113('0x47')]=htmlToText[_0x7113('0x82')](_0x498c23[_0x7113('0x1a')][_0x7113('0x47')]);respondWithRpcPromise('EventManager',_0x7113('0x83'),{'event':_0x7113('0x8c'),'message':_0x3843e8[_0x7113('0x1a')]},client9002);return _0x498c23;}return null;})[_0x7113('0x11')](respondWithResult(_0x4c3369,null))[_0x7113('0x1c')](handleError(_0x4c3369,null));};exports[_0x7113('0x8d')]=function(_0x5d2f75,_0xbda6f4){var _0x379140=moment()['unix']()[_0x7113('0x8e')]();var _0x5a2724=path['join'](config[_0x7113('0x60')],_0x7113('0x8f'),_0x7113('0x90'),'tmp');var _0x338b98=path[_0x7113('0x5f')](config[_0x7113('0x60')],'server',_0x7113('0x90'),_0x7113('0x5e'));var _0x4008aa=util[_0x7113('0x66')](_0x7113('0x91'),_0x379140);return db[_0x7113('0x2a')]['find']({'where':{'id':_0x5d2f75['params']['id']},'attributes':['id','body',_0x7113('0x92'),'to','cc',_0x7113('0x93'),_0x7113('0x94'),_0x7113('0x95')],'include':_0x5d2f75[_0x7113('0x32')][_0x7113('0x5e')]?[{'model':db[_0x7113('0x96')],'as':_0x7113('0x97')}]:undefined})['then'](handleEntityNotFound(_0xbda6f4,null))[_0x7113('0x11')](function(_0xda9dea){if(_0xda9dea){var _0x42f2a9=_0xda9dea;var _0x152483={'from':_0x42f2a9[_0x7113('0x92')],'to':_0x42f2a9['to'],'subject':_0x42f2a9[_0x7113('0x94')],'html':htmlEntities[_0x7113('0x98')](_0x42f2a9[_0x7113('0x47')]),'headers':{'Date':moment(_0x42f2a9[_0x7113('0x95')])[_0x7113('0x66')](_0x7113('0x99'))},'attachments':[]};if(_0xda9dea['cc']){_0x152483[_0x7113('0x9a')]['Cc']=_0xda9dea['cc'];}if(_0xda9dea[_0x7113('0x93')]){_0x152483[_0x7113('0x9a')][_0x7113('0x9b')]=_0xda9dea[_0x7113('0x93')];}return new BPromise(function(_0x214508,_0x23e931){if(_0xda9dea['Attachments']){for(var _0x36c54d=0x0;_0x36c54d<_0xda9dea[_0x7113('0x97')]['length'];_0x36c54d++){var _0x4d18af=_0xda9dea[_0x7113('0x97')][_0x36c54d];var _0x17453f=path[_0x7113('0x5f')](_0x338b98,_0x4d18af[_0x7113('0x62')]);if(fs[_0x7113('0x9c')](_0x17453f)){_0x152483['attachments'][_0x7113('0x9d')]({'name':_0x4d18af[_0x7113('0x27')],'contentType':_0x4d18af[_0x7113('0x2d')],'data':fs['readFileSync'](_0x17453f)});}}}emlformat[_0x7113('0x9e')](_0x152483,function(_0x4fb186,_0x9beb8e){if(_0x4fb186)return _0x23e931(_0x4fb186);fs[_0x7113('0x9f')](path[_0x7113('0x5f')](_0x5a2724,_0x4008aa),_0x9beb8e);return _0x214508(_0x9beb8e);});});}})[_0x7113('0x11')](function(_0x3d3fc3){if(_0x3d3fc3){return _0xbda6f4[_0x7113('0x8d')](path[_0x7113('0x5f')](_0x5a2724,_0x4008aa),_0x4008aa,function(_0x4f4f0c){if(!_0x4f4f0c)fs[_0x7113('0xa0')](path[_0x7113('0x5f')](_0x5a2724,_0x4008aa));});}})[_0x7113('0x1c')](handleError(_0xbda6f4,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 37dcfd0..f68113c 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 _0xfee5=['exports','events','../../mysqldb','MailMessage','save','remove','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfee5,0x121));var _0x5fee=function(_0x3cf1eb,_0x474bf6){_0x3cf1eb=_0x3cf1eb-0x0;var _0x230397=_0xfee5[_0x3cf1eb];return _0x230397;};'use strict';var EventEmitter=require(_0x5fee('0x0'));var MailMessage=require(_0x5fee('0x1'))['db'][_0x5fee('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fee('0x3'),'afterUpdate':'update','afterDestroy':_0x5fee('0x4')};function emitEvent(_0x391f77){return function(_0x5e2dc7,_0x3df84e,_0x40b07f){MailMessageEvents[_0x5fee('0x5')](_0x391f77+':'+_0x5e2dc7['id'],_0x5e2dc7);MailMessageEvents[_0x5fee('0x5')](_0x391f77,_0x5e2dc7);_0x40b07f(null);};}for(var e in events){if(events[_0x5fee('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x5fee('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x1d5c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1e744a,_0xa8fdb1){var _0x1ac4d0=function(_0x13a75d){while(--_0x13a75d){_0x1e744a['push'](_0x1e744a['shift']());}};_0x1ac4d0(++_0xa8fdb1);}(_0x1d5c,0xbc));var _0xc1d5=function(_0x458775,_0x523411){_0x458775=_0x458775-0x0;var _0x48eb06=_0x1d5c[_0x458775];return _0x48eb06;};'use strict';var EventEmitter=require(_0xc1d5('0x0'));var MailMessage=require(_0xc1d5('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc1d5('0x2')](0x0);var events={'afterCreate':_0xc1d5('0x3'),'afterUpdate':_0xc1d5('0x4'),'afterDestroy':_0xc1d5('0x5')};function emitEvent(_0x1d1b90){return function(_0x592047,_0x101496,_0x2036b3){MailMessageEvents[_0xc1d5('0x6')](_0x1d1b90+':'+_0x592047['id'],_0x592047);MailMessageEvents[_0xc1d5('0x6')](_0x1d1b90,_0x592047);_0x2036b3(null);};}for(var e in events){if(events[_0xc1d5('0x7')](e)){var event=events[e];MailMessage[_0xc1d5('0x8')](e,emitEvent(event));}}module[_0xc1d5('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 19fa4dd..91630c3 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 _0x3818=['body','fromString','models','get','toLowerCase','direction','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','messageId','plainBody','subject'];(function(_0x5046ce,_0x30cbe0){var _0x5c283b=function(_0x5e3902){while(--_0x5e3902){_0x5046ce['push'](_0x5046ce['shift']());}};_0x5c283b(++_0x30cbe0);}(_0x3818,0x1d2));var _0x8381=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3818[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8381('0x0'));var logger=require(_0x8381('0x1'))(_0x8381('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8381('0x3'));var htmlToText=require(_0x8381('0x4'));var fs=require('fs');var path=require(_0x8381('0x5'));var rimraf=require(_0x8381('0x6'));var config=require(_0x8381('0x7'));var attributes=require(_0x8381('0x8'));module[_0x8381('0x9')]=function(_0xd93c50,_0x4ea06a){return _0xd93c50[_0x8381('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8381('0xb')]},{'name':'fti_mail_messages','fields':[_0x8381('0xc'),_0x8381('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x462935,_0x326c95,_0x8f7f6f){if(_0x462935[_0x8381('0xe')]){_0x462935[_0x8381('0xc')]=htmlToText[_0x8381('0xf')](_0x462935[_0x8381('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x8f7f6f(null,_0x326c95);},'afterCreate':function(_0x5a37e5,_0x502dd8,_0x577858){var _0x2f4b72=_0xd93c50[_0x8381('0x10')];var _0x53257d=_0x5a37e5[_0x8381('0x11')]({'plain':!![]});if(_0x53257d['direction'][_0x8381('0x12')]()==='in'||_0x53257d[_0x8381('0x13')]['toLowerCase']()===_0x8381('0x14')&&!_0x53257d[_0x8381('0x15')]&&!_['isNil'](_0x53257d[_0x8381('0x16')])){_0x2f4b72[_0x8381('0x17')][_0x8381('0x18')]({'where':{'id':_0x53257d[_0x8381('0x19')]}})[_0x8381('0x1a')](function(_0x561361){if(_0x561361){_0x561361[_0x8381('0x1b')]({'lastMsgAt':_0x53257d['createdAt'],'lastMsgDirection':_0x53257d[_0x8381('0x13')][_0x8381('0x12')]()});}})[_0x8381('0x1c')](function(_0x1e5dad){console[_0x8381('0x1d')](_0x1e5dad);});}_0x577858();}},'charset':_0x8381('0x1e'),'collate':_0x8381('0x1f')});}; \ No newline at end of file +var _0xb034=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb034,0x1a4));var _0x4b03=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xb034[_0x50f392];return _0x5926f2;};'use strict';var _=require(_0x4b03('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4b03('0x1'));var BPromise=require(_0x4b03('0x2'));var rp=require(_0x4b03('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b03('0x4'));var config=require(_0x4b03('0x5'));var attributes=require('./mailMessage.attributes');module[_0x4b03('0x6')]=function(_0x33dc54,_0x2a39f2){return _0x33dc54['define'](_0x4b03('0x7'),attributes,{'tableName':_0x4b03('0x8'),'paranoid':![],'indexes':[{'name':_0x4b03('0x9'),'fields':[_0x4b03('0x9')]},{'name':_0x4b03('0xa'),'fields':['plainBody','subject'],'type':_0x4b03('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d9191,_0x1572be,_0x41096c){if(_0x3d9191[_0x4b03('0xc')]){_0x3d9191['plainBody']=htmlToText[_0x4b03('0xd')](_0x3d9191[_0x4b03('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x41096c(null,_0x1572be);},'afterCreate':function(_0xaa6aa,_0x5779fe,_0xae495d){var _0x4c9189=_0x33dc54[_0x4b03('0xe')];var _0x2ffefd=_0xaa6aa[_0x4b03('0xf')]({'plain':!![]});if(_0x2ffefd['direction'][_0x4b03('0x10')]()==='in'||_0x2ffefd[_0x4b03('0x11')][_0x4b03('0x10')]()===_0x4b03('0x12')&&!_0x2ffefd[_0x4b03('0x13')]&&!_[_0x4b03('0x14')](_0x2ffefd[_0x4b03('0x15')])){_0x4c9189[_0x4b03('0x16')]['findOne']({'where':{'id':_0x2ffefd[_0x4b03('0x17')]}})[_0x4b03('0x18')](function(_0x39ef72){if(_0x39ef72){_0x39ef72[_0x4b03('0x19')]({'lastMsgAt':_0x2ffefd[_0x4b03('0x1a')],'lastMsgDirection':_0x2ffefd[_0x4b03('0x11')][_0x4b03('0x10')]()});}})[_0x4b03('0x1b')](function(_0x57df39){console[_0x4b03('0x1c')](_0x57df39);});}_0xae495d();}},'charset':'utf8mb4','collate':_0x4b03('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d2df720..781fc24 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 _0x3423=['./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x25c57f,_0x1a3564){var _0x3c86ac=function(_0x5842ca){while(--_0x5842ca){_0x25c57f['push'](_0x25c57f['shift']());}};_0x3c86ac(++_0x1a3564);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});config[_0x3342('0xc')]=_[_0x3342('0xd')](config[_0x3342('0xc')],{'host':_0x3342('0xe'),'port':0x18eb});var socket=require(_0x3342('0xf'))(new Redis(config[_0x3342('0xc')]));require(_0x3342('0x10'))['register'](socket);function respondWithRpcPromise(_0x582c37,_0x2d0cb0,_0x481a17){return new BPromise(function(_0x5a1fba,_0x51b276){return client['request'](_0x582c37,_0x481a17)[_0x3342('0x11')](function(_0x2f3c47){logger['info'](_0x3342('0x12'),_0x2d0cb0,'request\x20sent');logger[_0x3342('0x13')](_0x3342('0x14'),_0x2d0cb0,'request\x20sent',JSON[_0x3342('0x15')](_0x2f3c47));if(_0x2f3c47[_0x3342('0x16')]){if(_0x2f3c47[_0x3342('0x16')][_0x3342('0x17')]===0x1f4){logger[_0x3342('0x16')](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x51b276(_0x2f3c47[_0x3342('0x16')][_0x3342('0x18')]);}logger['error'](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x5a1fba(_0x2f3c47['error'][_0x3342('0x18')]);}else{logger[_0x3342('0x19')](_0x3342('0x12'),_0x2d0cb0,_0x3342('0x1a'));_0x5a1fba(_0x2f3c47[_0x3342('0x1b')][_0x3342('0x18')]);}})[_0x3342('0x1c')](function(_0x3ebf6b){logger[_0x3342('0x16')]('MailMessage,\x20%s,\x20%s',_0x2d0cb0,_0x3ebf6b);_0x51b276(_0x3ebf6b);});});}exports[_0x3342('0x1d')]=function(_0xda235a){var _0x2f6395=this;return new Promise(function(_0x5e05f5,_0x3cb86f){return db[_0x3342('0x1e')]['create'](_0xda235a[_0x3342('0x1f')],{'raw':_0xda235a[_0x3342('0x20')]?_0xda235a['options'][_0x3342('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3f271c){logger[_0x3342('0x19')](_0x3342('0x1d'),_0xda235a);logger[_0x3342('0x13')](_0x3342('0x1d'),_0xda235a,JSON[_0x3342('0x15')](_0x3f271c));_0x5e05f5(_0x3f271c);})[_0x3342('0x1c')](function(_0x2d8622){logger['error'](_0x3342('0x1d'),_0x2d8622['message'],_0xda235a);_0x3cb86f(_0x2f6395['error'](0x1f4,_0x2d8622[_0x3342('0x18')]));});});}; \ No newline at end of file +var _0x1a37=['debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent'];(function(_0x33cb6a,_0x2d70ed){var _0x56a428=function(_0x1478d3){while(--_0x1478d3){_0x33cb6a['push'](_0x33cb6a['shift']());}};_0x56a428(++_0x2d70ed);}(_0x1a37,0xb4));var _0x71a3=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x1a37[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});}exports[_0x71a3('0x1b')]=function(_0x1c4ec2){var _0x4a7980=this;return new Promise(function(_0x596328,_0x1ab947){return db[_0x71a3('0x1c')][_0x71a3('0x1d')](_0x1c4ec2[_0x71a3('0x1e')],{'raw':_0x1c4ec2[_0x71a3('0x1f')]?_0x1c4ec2['options'][_0x71a3('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3bf78e){logger[_0x71a3('0x19')](_0x71a3('0x1b'),_0x1c4ec2);logger[_0x71a3('0x12')](_0x71a3('0x1b'),_0x1c4ec2,JSON[_0x71a3('0x14')](_0x3bf78e));_0x596328(_0x3bf78e);})['catch'](function(_0x26e6e7){logger[_0x71a3('0x15')](_0x71a3('0x1b'),_0x26e6e7[_0x71a3('0x18')],_0x1c4ec2);_0x1ab947(_0x4a7980[_0x71a3('0x15')](0x1f4,_0x26e6e7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 75ddf8a..2047c78 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 _0xbfb8=['remove','update','emit','register','length','./mailMessage.events','save'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xbfb8,0x194));var _0x8bfb=function(_0x48a202,_0x5ca151){_0x48a202=_0x48a202-0x0;var _0x5f5599=_0xbfb8[_0x48a202];return _0x5f5599;};'use strict';var MailMessageEvents=require(_0x8bfb('0x0'));var events=[_0x8bfb('0x1'),_0x8bfb('0x2'),_0x8bfb('0x3')];function createListener(_0xa341d5,_0x339a46){return function(_0x595804){_0x339a46[_0x8bfb('0x4')](_0xa341d5,_0x595804);};}function removeListener(_0x41c5d1,_0x5b3558){return function(){MailMessageEvents['removeListener'](_0x41c5d1,_0x5b3558);};}exports[_0x8bfb('0x5')]=function(_0x539ff2){for(var _0x4bf6c2=0x0,_0xc8aa1f=events[_0x8bfb('0x6')];_0x4bf6c2<_0xc8aa1f;_0x4bf6c2++){var _0x187a10=events[_0x4bf6c2];var _0xc44f90=createListener('mailMessage:'+_0x187a10,_0x539ff2);MailMessageEvents['on'](_0x187a10,_0xc44f90);}}; \ No newline at end of file +var _0x6250=['save','update','emit','removeListener'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x6250,0x1b0));var _0x0625=function(_0x2c665a,_0x330ba9){_0x2c665a=_0x2c665a-0x0;var _0x5d9f89=_0x6250[_0x2c665a];return _0x5d9f89;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x0625('0x0'),'remove',_0x0625('0x1')];function createListener(_0x5829a6,_0x40a53f){return function(_0x526c0e){_0x40a53f[_0x0625('0x2')](_0x5829a6,_0x526c0e);};}function removeListener(_0x367123,_0x529303){return function(){MailMessageEvents[_0x0625('0x3')](_0x367123,_0x529303);};}exports['register']=function(_0x111571){for(var _0x22ad4c=0x0,_0x42bb48=events['length'];_0x22ad4c<_0x42bb48;_0x22ad4c++){var _0x14a80a=events[_0x22ad4c];var _0x595d0e=createListener('mailMessage:'+_0x14a80a,_0x111571);MailMessageEvents['on'](_0x14a80a,_0x595d0e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5e2bba1..378831f 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 _0x8cac=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','exports','multer'];(function(_0x37e227,_0xd8424a){var _0x3e2a86=function(_0xaf4ace){while(--_0xaf4ace){_0x37e227['push'](_0x37e227['shift']());}};_0x3e2a86(++_0xd8424a);}(_0x8cac,0xe7));var _0xc8ca=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x8cac[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0xc8ca('0x0'));var util=require(_0xc8ca('0x1'));var path=require(_0xc8ca('0x2'));var timeout=require(_0xc8ca('0x3'));var express=require('express');var router=express[_0xc8ca('0x4')]();var fs_extra=require(_0xc8ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8ca('0x6'));var config=require(_0xc8ca('0x7'));var controller=require(_0xc8ca('0x8'));router[_0xc8ca('0x9')]('/',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0xb')]);router['get'](_0xc8ca('0xc'),auth[_0xc8ca('0xa')](),controller['describe']);router['get'](_0xc8ca('0xd'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0xe')]);router['get'](_0xc8ca('0xf'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x10')]);router[_0xc8ca('0x9')]('/:id/teams',auth[_0xc8ca('0xa')](),controller['getTeams']);router[_0xc8ca('0x9')](_0xc8ca('0x11'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x12')]);router[_0xc8ca('0x13')]('/',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x14')]);router[_0xc8ca('0x13')]('/:id/teams',auth[_0xc8ca('0xa')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xc8ca('0x15')]);router[_0xc8ca('0x16')]('/:id',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x17')]);router[_0xc8ca('0x18')](_0xc8ca('0xd'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x19')]);router[_0xc8ca('0x18')](_0xc8ca('0x1a'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x1b')]);router['delete'](_0xc8ca('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc8ca('0x1c')]=router; \ No newline at end of file +var _0x2101=['addTeams','/:id/users','addAgents','put','destroy','removeAgents','util','path','connect-timeout','express','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','getAgents','post'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x2101,0xca));var _0x1210=function(_0xd04987,_0x308e24){_0xd04987=_0xd04987-0x0;var _0x57e30d=_0x2101[_0xd04987];return _0x57e30d;};'use strict';var multer=require('multer');var util=require(_0x1210('0x0'));var path=require(_0x1210('0x1'));var timeout=require(_0x1210('0x2'));var express=require(_0x1210('0x3'));var router=express['Router']();var fs_extra=require(_0x1210('0x4'));var auth=require(_0x1210('0x5'));var interaction=require(_0x1210('0x6'));var config=require(_0x1210('0x7'));var controller=require(_0x1210('0x8'));router[_0x1210('0x9')]('/',auth[_0x1210('0xa')](),controller[_0x1210('0xb')]);router[_0x1210('0x9')](_0x1210('0xc'),auth['isAuthenticated'](),controller[_0x1210('0xd')]);router[_0x1210('0x9')](_0x1210('0xe'),auth[_0x1210('0xa')](),controller[_0x1210('0xf')]);router[_0x1210('0x9')](_0x1210('0x10'),auth[_0x1210('0xa')](),controller[_0x1210('0x11')]);router[_0x1210('0x9')](_0x1210('0x12'),auth[_0x1210('0xa')](),controller[_0x1210('0x13')]);router[_0x1210('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x1210('0x14')]);router[_0x1210('0x15')]('/',auth[_0x1210('0xa')](),controller['create']);router[_0x1210('0x15')](_0x1210('0x12'),auth[_0x1210('0xa')](),controller[_0x1210('0x16')]);router[_0x1210('0x15')](_0x1210('0x17'),auth['isAuthenticated'](),controller[_0x1210('0x18')]);router[_0x1210('0x19')](_0x1210('0xe'),auth[_0x1210('0xa')](),controller['update']);router['delete'](_0x1210('0xe'),auth[_0x1210('0xa')](),controller[_0x1210('0x1a')]);router['delete'](_0x1210('0x12'),auth[_0x1210('0xa')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x1210('0xa')](),controller[_0x1210('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 16695de..4e2133c 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 _0xc638=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0xc638,0xd1));var _0x8c63=function(_0x39b8ca,_0x2b9313){_0x39b8ca=_0x39b8ca-0x0;var _0xd05f7=_0xc638[_0x39b8ca];return _0xd05f7;};'use strict';var Sequelize=require(_0x8c63('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c63('0x1')],'unique':_0x8c63('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8c63('0x1')]},'timeout':{'type':Sequelize[_0x8c63('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c63('0x4')](_0x8c63('0x5'),'beepall',_0x8c63('0x6'))}}; \ No newline at end of file +var _0xcc5a=['beepall','roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x128c41,_0x44a378){var _0xbbd946=function(_0x1b01e9){while(--_0x1b01e9){_0x128c41['push'](_0x128c41['shift']());}};_0xbbd946(++_0x44a378);}(_0xcc5a,0x14b));var _0xacc5=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xcc5a[_0x1d70db];return _0x3060c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xacc5('0x0')],'unique':_0xacc5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xacc5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xacc5('0x3')](_0xacc5('0x4'),_0xacc5('0x5'),_0xacc5('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index c618d42..2168062 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 _0x8e44=['tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','all','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','error','stack','name','map','MailQueue','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','User','UserId','agent','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','findOne','getTeams','Team','Agents','online','voicePause','interface','sequelize','addTeams','each','forEach','userMailQueue:save','removeTeams','ids','select','field'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8e44,0x1ac));var _0x48e4=function(_0x2747b2,_0x10dce8){_0x2747b2=_0x2747b2-0x0;var _0x540db0=_0x8e44[_0x2747b2];return _0x540db0;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];config[_0x48e4('0x18')]=_['defaults'](config[_0x48e4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x48e4('0x19'))(new Redis(config[_0x48e4('0x18')]));require(_0x48e4('0x1a'))[_0x48e4('0x1b')](socket);function respondWithStatusCode(_0x12f7af,_0x39bd10){_0x39bd10=_0x39bd10||0xcc;return function(_0x1ede64){if(_0x1ede64){return _0x12f7af['sendStatus'](_0x39bd10);}return _0x12f7af[_0x48e4('0x1c')](_0x39bd10)[_0x48e4('0x1d')]();};}function respondWithResult(_0x5c8fe5,_0x171f89){_0x171f89=_0x171f89||0xc8;return function(_0x35a599){if(_0x35a599){return _0x5c8fe5['status'](_0x171f89)[_0x48e4('0x1e')](_0x35a599);}};}function respondWithFilteredResult(_0x627366,_0x12fc37){return function(_0x4ffc0d){if(_0x4ffc0d){var _0x231dcd=typeof _0x12fc37[_0x48e4('0x1f')]===_0x48e4('0x20')&&typeof _0x12fc37['limit']===_0x48e4('0x20');var _0x565916=_0x4ffc0d['count'];var _0x113ff4=_0x231dcd?0x0:_0x12fc37[_0x48e4('0x1f')];var _0x25ecba=_0x231dcd?_0x4ffc0d[_0x48e4('0x21')]:_0x12fc37[_0x48e4('0x1f')]+_0x12fc37['limit'];var _0x59eff5;if(_0x25ecba>=_0x565916){_0x25ecba=_0x565916;_0x59eff5=0xc8;}else{_0x59eff5=0xce;}_0x627366[_0x48e4('0x1c')](_0x59eff5);return _0x627366[_0x48e4('0x22')](_0x48e4('0x23'),_0x113ff4+'-'+_0x25ecba+'/'+_0x565916)[_0x48e4('0x1e')](_0x4ffc0d);}return null;};}function patchUpdates(_0x846128){return function(_0x377249){try{jsonpatch[_0x48e4('0x24')](_0x377249,_0x846128,!![]);}catch(_0x378573){return BPromise[_0x48e4('0x25')](_0x378573);}return _0x377249[_0x48e4('0x26')]();};}function saveUpdates(_0x1a80ed,_0x5cc3e6){return function(_0x160e3b){if(_0x160e3b){return _0x160e3b[_0x48e4('0x27')](_0x1a80ed)['then'](function(_0x2beac2){return _0x2beac2;});}return null;};}function removeEntity(_0x23b2ba,_0x4abfbc){return function(_0x9a1c6d){if(_0x9a1c6d){return _0x9a1c6d[_0x48e4('0x28')]()[_0x48e4('0x29')](function(){var _0xc113e3=_0x9a1c6d[_0x48e4('0x2a')]({'plain':!![]});var _0x11bc8a=_0x48e4('0x2b');return db['UserProfileResource'][_0x48e4('0x28')]({'where':{'type':_0x11bc8a,'resourceId':_0xc113e3['id']}})[_0x48e4('0x29')](function(){return _0x9a1c6d;});})['then'](function(){_0x23b2ba['status'](0xcc)[_0x48e4('0x1d')]();});}};}function handleEntityNotFound(_0x4b8f3c,_0x346765){return function(_0x214def){if(!_0x214def){_0x4b8f3c['sendStatus'](0x194);}return _0x214def;};}function handleError(_0x3012b3,_0x28c1){_0x28c1=_0x28c1||0x1f4;return function(_0x14b545){logger[_0x48e4('0x2c')](_0x14b545[_0x48e4('0x2d')]);if(_0x14b545['name']){delete _0x14b545[_0x48e4('0x2e')];}_0x3012b3['status'](_0x28c1)['send'](_0x14b545);};}exports['index']=function(_0x1ee7ef,_0x1450cb){var _0xf2f1cf={},_0x4725ab={},_0x2432ab={'count':0x0,'rows':[]};var _0x403b21=_[_0x48e4('0x2f')](db[_0x48e4('0x30')][_0x48e4('0x31')],function(_0x12af4d){return{'name':_0x12af4d[_0x48e4('0x32')],'type':_0x12af4d['type']['key']};});_0x4725ab['model']=_[_0x48e4('0x2f')](_0x403b21,_0x48e4('0x2e'));_0x4725ab['query']=_[_0x48e4('0x33')](_0x1ee7ef[_0x48e4('0x34')]);_0x4725ab['filters']=_[_0x48e4('0x35')](_0x4725ab[_0x48e4('0x36')],_0x4725ab[_0x48e4('0x34')]);_0xf2f1cf[_0x48e4('0x37')]=_['intersection'](_0x4725ab[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1ee7ef['query']['fields']));_0xf2f1cf[_0x48e4('0x37')]=_0xf2f1cf[_0x48e4('0x37')][_0x48e4('0x39')]?_0xf2f1cf['attributes']:_0x4725ab[_0x48e4('0x36')];if(!_0x1ee7ef[_0x48e4('0x34')]['hasOwnProperty'](_0x48e4('0x3a'))){_0xf2f1cf[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x3b')]);_0xf2f1cf['offset']=qs[_0x48e4('0x1f')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x1f')]);}_0xf2f1cf['order']=qs[_0x48e4('0x3c')](_0x1ee7ef['query'][_0x48e4('0x3c')]);_0xf2f1cf[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0x1ee7ef[_0x48e4('0x34')],_0x4725ab[_0x48e4('0x3e')]),_0x403b21);if(_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]){_0xf2f1cf[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0xf2f1cf[_0x48e4('0x3d')],{'$or':_['map'](_0x403b21,function(_0x3cdafb){if(_0x3cdafb[_0x48e4('0x42')]!==_0x48e4('0x43')){var _0x1e54d9={};_0x1e54d9[_0x3cdafb[_0x48e4('0x2e')]]={'$like':'%'+_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x1e54d9;}})});}_0xf2f1cf=_['merge']({},_0xf2f1cf,_0x1ee7ef[_0x48e4('0x44')]);var _0x1e5317={'where':_0xf2f1cf[_0x48e4('0x3d')]};return db['MailQueue'][_0x48e4('0x21')](_0x1e5317)[_0x48e4('0x29')](function(_0x3cc197){_0x2432ab['count']=_0x3cc197;if(_0x1ee7ef['query'][_0x48e4('0x45')]){_0xf2f1cf[_0x48e4('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x48e4('0x47')](_0xf2f1cf);})['then'](function(_0x4f1714){_0x2432ab['rows']=_0x4f1714;return _0x2432ab;})['then'](respondWithFilteredResult(_0x1450cb,_0xf2f1cf))[_0x48e4('0x48')](handleError(_0x1450cb,null));};exports[_0x48e4('0x49')]=function(_0x1c5456,_0x124cb1){var _0x4144fa={'raw':!![],'where':{'id':_0x1c5456['params']['id']}},_0x410b8e={};_0x410b8e[_0x48e4('0x36')]=_[_0x48e4('0x33')](db['MailQueue']['rawAttributes']);_0x410b8e[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x1c5456[_0x48e4('0x34')]);_0x410b8e[_0x48e4('0x3e')]=_['intersection'](_0x410b8e[_0x48e4('0x36')],_0x410b8e[_0x48e4('0x34')]);_0x4144fa[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x410b8e[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1c5456['query'][_0x48e4('0x38')]));_0x4144fa[_0x48e4('0x37')]=_0x4144fa[_0x48e4('0x37')][_0x48e4('0x39')]?_0x4144fa[_0x48e4('0x37')]:_0x410b8e[_0x48e4('0x36')];if(_0x1c5456[_0x48e4('0x34')][_0x48e4('0x45')]){_0x4144fa[_0x48e4('0x46')]=[{'all':!![]}];}_0x4144fa=_[_0x48e4('0x41')]({},_0x4144fa,_0x1c5456[_0x48e4('0x44')]);return db['MailQueue'][_0x48e4('0x4a')](_0x4144fa)['then'](handleEntityNotFound(_0x124cb1,null))['then'](respondWithResult(_0x124cb1,null))[_0x48e4('0x48')](handleError(_0x124cb1,null));};exports['create']=function(_0x98d025,_0x14511b){return db[_0x48e4('0x30')][_0x48e4('0x4b')](_0x98d025[_0x48e4('0x4c')],{})[_0x48e4('0x29')](function(_0x10eb0c){var _0x57c9e5=_0x98d025['user'][_0x48e4('0x2a')]({'plain':!![]});if(!_0x57c9e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c9e5[_0x48e4('0x4d')]===_0x48e4('0x4e')){var _0x2bbf8f=_0x10eb0c['get']({'plain':!![]});var _0x14ed52=_0x48e4('0x2b');return db[_0x48e4('0x4f')]['find']({'where':{'name':_0x14ed52,'userProfileId':_0x57c9e5[_0x48e4('0x50')]},'raw':!![]})[_0x48e4('0x29')](function(_0x91b42d){if(_0x91b42d&&_0x91b42d[_0x48e4('0x51')]===0x0){return db[_0x48e4('0x52')]['create']({'name':_0x2bbf8f[_0x48e4('0x2e')],'resourceId':_0x2bbf8f['id'],'type':_0x91b42d[_0x48e4('0x2e')],'sectionId':_0x91b42d['id']},{})['then'](function(){return _0x10eb0c;});}else{return _0x10eb0c;}})[_0x48e4('0x48')](function(_0x43e3ba){logger[_0x48e4('0x2c')](_0x48e4('0x53'),_0x43e3ba);throw _0x43e3ba;});}return _0x10eb0c;})['then'](respondWithResult(_0x14511b,0xc9))['catch'](handleError(_0x14511b,null));};exports['update']=function(_0x55ab36,_0x2be063){if(_0x55ab36[_0x48e4('0x4c')]['id']){delete _0x55ab36[_0x48e4('0x4c')]['id'];}return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x55ab36[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2be063,null))[_0x48e4('0x29')](saveUpdates(_0x55ab36[_0x48e4('0x4c')],null))[_0x48e4('0x29')](respondWithResult(_0x2be063,null))[_0x48e4('0x48')](handleError(_0x2be063,null));};exports[_0x48e4('0x28')]=function(_0x180ae4,_0x4e07e9){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x180ae4[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x4e07e9,null))[_0x48e4('0x29')](removeEntity(_0x4e07e9,null))[_0x48e4('0x48')](handleError(_0x4e07e9,null));};exports[_0x48e4('0x55')]=function(_0x450baf,_0x1f5e67){return db[_0x48e4('0x30')][_0x48e4('0x55')]()[_0x48e4('0x29')](respondWithResult(_0x1f5e67,null))['catch'](handleError(_0x1f5e67,null));};exports['getMembers']=function(_0xc114a,_0x1da690,_0x2b0be2){var _0x1a30eb={'raw':!![],'where':{}},_0x4147b4={},_0x599988;return db[_0x48e4('0x30')]['findOne']({'where':{'id':_0xc114a[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x1da690,null))[_0x48e4('0x29')](function(_0x573d41){if(_0x573d41){_0x599988=_0x573d41[_0x48e4('0x2a')]({'plain':!![]});_0x4147b4[_0x48e4('0x36')]=_[_0x48e4('0x33')](db[_0x48e4('0x56')][_0x48e4('0x31')]);_0x4147b4[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0xc114a['query']);_0x4147b4[_0x48e4('0x3e')]=_[_0x48e4('0x35')](_0x4147b4[_0x48e4('0x36')],_0x4147b4['query']);_0x1a30eb[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x4147b4['model'],qs['fields'](_0xc114a['query'][_0x48e4('0x38')]));_0x1a30eb[_0x48e4('0x37')]=_0x1a30eb['attributes'][_0x48e4('0x39')]?_0x1a30eb[_0x48e4('0x37')]:_0x4147b4[_0x48e4('0x36')];if(!_0xc114a[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x1a30eb[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0xc114a[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x1a30eb['offset']=qs['offset'](_0xc114a['query'][_0x48e4('0x1f')]);}_0x1a30eb[_0x48e4('0x58')]=qs['sort'](_0xc114a[_0x48e4('0x34')]['sort']);_0x1a30eb[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0xc114a[_0x48e4('0x34')],_0x4147b4[_0x48e4('0x3e')]));_0x1a30eb[_0x48e4('0x3d')][_0x48e4('0x59')]=_0x573d41['id'];if(_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]){_0x1a30eb[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x1a30eb[_0x48e4('0x3d')],{'$or':_['map'](_0x1a30eb['attributes'],function(_0x3dc914){var _0x57555d={};_0x57555d[_0x3dc914]={'$like':'%'+_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x57555d;})});}_0x1a30eb=_['merge']({},_0x1a30eb,_0xc114a[_0x48e4('0x44')]);return db[_0x48e4('0x56')][_0x48e4('0x47')](_0x1a30eb);}})[_0x48e4('0x29')](function(_0x492ab0){if(_0x492ab0){return db[_0x48e4('0x5a')]['findAndCountAll']({'where':{'id':_[_0x48e4('0x2f')](_0x492ab0,_0x48e4('0x5b')),'role':_0x48e4('0x5c')},'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x5d'),'updatedAt',_0x48e4('0x5e')]});}})['then'](function(_0x21be9c){if(_0x21be9c){return{'count':_0x21be9c[_0x48e4('0x21')],'rows':_[_0x48e4('0x2f')](_0x21be9c[_0x48e4('0x5f')],function(_0x1fe0f9){return{'membername':_0x1fe0f9['name'],'UserId':_0x1fe0f9['id'],'queue_name':_0x599988[_0x48e4('0x2e')],'MailQueueId':_0x599988['id'],'interface':util[_0x48e4('0x60')](_0x48e4('0x61'),_0x48e4('0x62'),_0x1fe0f9[_0x48e4('0x2e')]),'penalty':0x0,'paused':_0x1fe0f9[_0x48e4('0x5d')],'createdAt':_0x1fe0f9[_0x48e4('0x5e')],'updatedAt':_0x1fe0f9[_0x48e4('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x48e4('0x29')](respondWithFilteredResult(_0x1da690,_0x1a30eb))[_0x48e4('0x48')](handleError(_0x1da690,null));};exports['getTeams']=function(_0x4b7106,_0x2f71e8,_0x5d6d17){var _0x4bc126={};var _0x2fbb3e={};var _0x5bd779;var _0xb0dea2;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x4b7106['params']['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2f71e8,null))[_0x48e4('0x29')](function(_0x7ef265){if(_0x7ef265){_0x5bd779=_0x7ef265;_0x2fbb3e['model']=_['keys'](db['Team'][_0x48e4('0x31')]);_0x2fbb3e['query']=_[_0x48e4('0x33')](_0x4b7106[_0x48e4('0x34')]);_0x2fbb3e[_0x48e4('0x3e')]=_['intersection'](_0x2fbb3e[_0x48e4('0x36')],_0x2fbb3e[_0x48e4('0x34')]);_0x4bc126[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x2fbb3e['model'],qs[_0x48e4('0x38')](_0x4b7106[_0x48e4('0x34')]['fields']));_0x4bc126['attributes']=_0x4bc126[_0x48e4('0x37')]['length']?_0x4bc126['attributes']:_0x2fbb3e[_0x48e4('0x36')];_0x4bc126[_0x48e4('0x58')]=qs[_0x48e4('0x3c')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x4bc126['where']=qs['filters'](_[_0x48e4('0x3f')](_0x4b7106[_0x48e4('0x34')],_0x2fbb3e[_0x48e4('0x3e')]));if(_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]){_0x4bc126[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x4bc126['where'],{'$or':_[_0x48e4('0x2f')](_0x4bc126['attributes'],function(_0x4d2de2){var _0x2db92a={};_0x2db92a[_0x4d2de2]={'$like':'%'+_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x2db92a;})});}_0x4bc126=_[_0x48e4('0x41')]({},_0x4bc126,_0x4b7106[_0x48e4('0x44')]);return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x4ffc74){if(_0x4ffc74){_0xb0dea2=_0x4ffc74[_0x48e4('0x39')];if(!_0x4b7106[_0x48e4('0x34')]['hasOwnProperty']('nolimit')){_0x4bc126[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x4bc126[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x7a1d9b){if(_0x7a1d9b){return _0x7a1d9b?{'count':_0xb0dea2,'rows':_0x7a1d9b}:null;}})[_0x48e4('0x29')](respondWithResult(_0x2f71e8,null))[_0x48e4('0x48')](handleError(_0x2f71e8,null));};exports['addTeams']=function(_0x5c3dfb,_0x3cef34,_0x1a9d62){var _0x18be38=_0x5c3dfb[_0x48e4('0x4c')]['ids'];return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x18be38},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x68'),_0x48e4('0x69'),_0x48e4('0x6a')],'raw':!![]}]})[_0x48e4('0x29')](function(_0x1c0e65){if(_0x1c0e65){var _0x26006a=_['flatMap'](_0x1c0e65,function(_0x37ed49){var _0xaafa73=_0x37ed49[_0x48e4('0x2a')]({'plain':!![]});return _0xaafa73[_0x48e4('0x67')];});return db[_0x48e4('0x30')]['find']({'where':{'id':_0x5c3dfb['params']['id']}})[_0x48e4('0x29')](function(_0x3d7192){return db[_0x48e4('0x6b')]['transaction'](function(_0x110f79){return _0x3d7192[_0x48e4('0x6c')](_0x18be38,{'transaction':_0x110f79})[_0x48e4('0x29')](function(){return BPromise[_0x48e4('0x6d')](_0x26006a,function(_0x35819c){return db[_0x48e4('0x56')]['findOrCreate']({'where':{'UserId':_0x35819c['id'],'MailQueueId':_0x5c3dfb[_0x48e4('0x54')]['id']},'transaction':_0x110f79});});})[_0x48e4('0x29')](function(){_0x26006a[_0x48e4('0x6e')](function(_0x235a36){socket['emit'](_0x48e4('0x6f'),{'UserId':_0x235a36['id'],'MailQueueId':_0x3d7192['id']});});});});});}})[_0x48e4('0x29')](respondWithStatusCode(_0x3cef34,null))[_0x48e4('0x48')](handleError(_0x3cef34,null));};exports[_0x48e4('0x70')]=function(_0x1cd791,_0x1e3c73,_0xb9c24d){return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x1cd791[_0x48e4('0x34')][_0x48e4('0x71')]},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e3c73,null))[_0x48e4('0x29')](function(_0xe8ba4f){var _0x18b21a=_[_0x48e4('0x2f')](_0xe8ba4f,'id');var _0x2d9326=[];var _0x3108e1=[];var _0x28f23c=squel[_0x48e4('0x72')]();_0x28f23c[_0x48e4('0x73')](_0x48e4('0x74'))[_0x48e4('0x75')](_0x48e4('0x76'),'tq')[_0x48e4('0x77')](_0x48e4('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x1cd791['params']['id']);for(var _0x4bafc9=0x0;_0x4bafc9<_0xe8ba4f[_0x48e4('0x39')];_0x4bafc9+=0x1){let _0x486c6e=_0xe8ba4f[_0x4bafc9];for(var _0x40b3d8=0x0;_0x40b3d8<_0x486c6e[_0x48e4('0x67')][_0x48e4('0x39')];_0x40b3d8+=0x1){let _0x234372=_0x486c6e[_0x48e4('0x67')][_0x40b3d8];var _0x3de23a=_0x28f23c[_0x48e4('0x79')]();_0x3de23a[_0x48e4('0x3d')](_0x48e4('0x7a'),_0x234372['id']);_0x3108e1[_0x48e4('0x7b')](db['sequelize'][_0x48e4('0x34')](_0x3de23a['toString'](),{'type':db['sequelize']['QueryTypes'][_0x48e4('0x7c')]})['then'](function(_0x2065e2){if(_0x2065e2[_0x48e4('0x39')]===0x1){return _0x234372['id'];}else{var _0x37d1ca=_['every'](_[_0x48e4('0x2f')](_0x2065e2,_0x48e4('0x7d')),function(_0x25b7df){return _['includes'](_0x18b21a,_0x25b7df);});if(_0x37d1ca){return _0x234372['id'];}}}));}}return BPromise[_0x48e4('0x7e')](_0x3108e1)[_0x48e4('0x29')](function(_0x405a80){_0x2d9326=_(_0x2d9326)['union'](_0x405a80)['compact']()['value']();return db['MailQueue'][_0x48e4('0x4a')]({'where':{'id':_0x1cd791[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](function(_0x2b89b7){return db[_0x48e4('0x6b')][_0x48e4('0x7f')](function(_0x2aa04b){return _0x2b89b7['removeTeams'](_0x1cd791['query'][_0x48e4('0x71')],{'transaction':_0x2aa04b})[_0x48e4('0x29')](function(){if(!_['isEmpty'](_0x2d9326)){return _0x2b89b7[_0x48e4('0x80')](_0x2d9326,{'transaction':_0x2aa04b});}})[_0x48e4('0x29')](function(){_0x2d9326[_0x48e4('0x6e')](function(_0x4903c9){socket['emit'](_0x48e4('0x81'),{'UserId':_0x4903c9,'MailQueueId':_0x2b89b7['id']});});});});});});})[_0x48e4('0x29')](respondWithStatusCode(_0x1e3c73,null))[_0x48e4('0x48')](handleError(_0x1e3c73,null));};exports[_0x48e4('0x82')]=function(_0x49883b,_0x2fc6c3,_0x47774a){return db[_0x48e4('0x30')]['find']({'where':{'id':_0x49883b[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2fc6c3,null))[_0x48e4('0x29')](function(_0x13e465){if(_0x13e465){return _0x13e465[_0x48e4('0x82')](_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')],_[_0x48e4('0x83')](_0x49883b[_0x48e4('0x4c')],[_0x48e4('0x71'),'id'])||{})[_0x48e4('0x84')](function(_0x388835){for(var _0x5f0905=0x0;_0x5f0905<_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')][_0x48e4('0x39')];_0x5f0905+=0x1){socket[_0x48e4('0x85')](_0x48e4('0x6f'),{'UserId':Number(_0x49883b[_0x48e4('0x4c')]['ids'][_0x5f0905]),'MailQueueId':Number(_0x49883b[_0x48e4('0x54')]['id'])});}return _0x388835;});}})[_0x48e4('0x29')](respondWithResult(_0x2fc6c3,null))[_0x48e4('0x48')](handleError(_0x2fc6c3,null));};exports[_0x48e4('0x80')]=function(_0x4c8717,_0x133a0d,_0x237faf){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x4c8717[_0x48e4('0x54')]['id']}})['then'](handleEntityNotFound(_0x133a0d,null))[_0x48e4('0x29')](function(_0x2b3e12){if(_0x2b3e12){return _0x2b3e12[_0x48e4('0x80')](_0x4c8717['query']['ids'])[_0x48e4('0x29')](function(){if(_[_0x48e4('0x86')](_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')])){for(var _0x190714=0x0;_0x190714<_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')][_0x48e4('0x39')];_0x190714+=0x1){socket[_0x48e4('0x85')]('userMailQueue:remove',{'UserId':Number(_0x4c8717[_0x48e4('0x34')]['ids'][_0x190714]),'MailQueueId':Number(_0x4c8717[_0x48e4('0x54')]['id'])});}}else{socket[_0x48e4('0x85')](_0x48e4('0x81'),{'UserId':Number(_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')]),'MailQueueId':Number(_0x4c8717['params']['id'])});}});}})[_0x48e4('0x29')](respondWithStatusCode(_0x133a0d,null))['catch'](handleError(_0x133a0d,null));};exports[_0x48e4('0x87')]=function(_0x17d045,_0x9d66b2,_0x14c8f6){var _0x51a43c={};var _0x26bd73={};var _0x3f966a;var _0x268ab6;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x17d045[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x9d66b2,null))[_0x48e4('0x29')](function(_0x35af85){if(_0x35af85){_0x3f966a=_0x35af85;_0x26bd73['model']=_[_0x48e4('0x33')](db[_0x48e4('0x5a')][_0x48e4('0x31')]);_0x26bd73[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x17d045['query']);_0x26bd73['filters']=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],_0x26bd73[_0x48e4('0x34')]);_0x51a43c[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x38')]));_0x51a43c['attributes']=_0x51a43c[_0x48e4('0x37')][_0x48e4('0x39')]?_0x51a43c[_0x48e4('0x37')]:_0x26bd73[_0x48e4('0x36')];_0x51a43c[_0x48e4('0x58')]=qs['sort'](_0x17d045[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x51a43c[_0x48e4('0x3d')]=qs['filters'](_[_0x48e4('0x3f')](_0x17d045[_0x48e4('0x34')],_0x26bd73[_0x48e4('0x3e')]));if(_0x17d045[_0x48e4('0x34')][_0x48e4('0x40')]){_0x51a43c[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x51a43c[_0x48e4('0x3d')],{'$or':_['map'](_0x51a43c[_0x48e4('0x37')],function(_0x212b2e){var _0x311de3={};_0x311de3[_0x212b2e]={'$like':'%'+_0x17d045[_0x48e4('0x34')]['filter']+'%'};return _0x311de3;})});}_0x51a43c=_[_0x48e4('0x41')]({},_0x51a43c,_0x17d045[_0x48e4('0x44')]);return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})['then'](function(_0x437262){if(_0x437262){_0x268ab6=_0x437262['length'];if(!_0x17d045[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x51a43c['limit']=qs[_0x48e4('0x3b')](_0x17d045[_0x48e4('0x34')]['limit']);_0x51a43c[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})[_0x48e4('0x29')](function(_0x2ead71){if(_0x2ead71){return _0x2ead71?{'count':_0x268ab6,'rows':_0x2ead71}:null;}})[_0x48e4('0x29')](respondWithResult(_0x9d66b2,null))['catch'](handleError(_0x9d66b2,null));}; \ No newline at end of file +var _0x0c24=['agent','mailPause','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','userMailQueue:save','removeTeams','Agents','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailQueue.socket','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','map','MailQueue','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','get','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','UserId'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x0c24,0x13b));var _0x40c2=function(_0x4fab3f,_0x5b0e8a){_0x4fab3f=_0x4fab3f-0x0;var _0x27364e=_0x0c24[_0x4fab3f];return _0x27364e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x40c2('0x0'));var jsonpatch=require(_0x40c2('0x1'));var rp=require('request-promise');var moment=require(_0x40c2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40c2('0x3'));var path=require(_0x40c2('0x4'));var sox=require(_0x40c2('0x5'));var csv=require('to-csv');var ejs=require(_0x40c2('0x6'));var fs=require('fs');var fs_extra=require(_0x40c2('0x7'));var _=require(_0x40c2('0x8'));var squel=require(_0x40c2('0x9'));var crypto=require(_0x40c2('0xa'));var jsforce=require(_0x40c2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40c2('0xc'));var querystring=require(_0x40c2('0xd'));var Papa=require(_0x40c2('0xe'));var Redis=require(_0x40c2('0xf'));var authService=require(_0x40c2('0x10'));var qs=require(_0x40c2('0x11'));var as=require(_0x40c2('0x12'));var hardwareService=require(_0x40c2('0x13'));var logger=require(_0x40c2('0x14'))(_0x40c2('0x15'));var utils=require('../../config/utils');var config=require(_0x40c2('0x16'));var licenseUtil=require(_0x40c2('0x17'));var db=require(_0x40c2('0x18'))['db'];config[_0x40c2('0x19')]=_[_0x40c2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40c2('0x19')]));require(_0x40c2('0x1b'))['register'](socket);function respondWithStatusCode(_0x527ce3,_0x4a49f9){_0x4a49f9=_0x4a49f9||0xcc;return function(_0x21dc2b){if(_0x21dc2b){return _0x527ce3['sendStatus'](_0x4a49f9);}return _0x527ce3[_0x40c2('0x1c')](_0x4a49f9)[_0x40c2('0x1d')]();};}function respondWithResult(_0x21c6e8,_0x23d976){_0x23d976=_0x23d976||0xc8;return function(_0x505b32){if(_0x505b32){return _0x21c6e8['status'](_0x23d976)[_0x40c2('0x1e')](_0x505b32);}};}function respondWithFilteredResult(_0x513b40,_0x1c9a81){return function(_0x5cda21){if(_0x5cda21){var _0x210e8b=typeof _0x1c9a81['offset']===_0x40c2('0x1f')&&typeof _0x1c9a81['limit']==='undefined';var _0x3f3840=_0x5cda21[_0x40c2('0x20')];var _0x4acaca=_0x210e8b?0x0:_0x1c9a81[_0x40c2('0x21')];var _0x21d445=_0x210e8b?_0x5cda21[_0x40c2('0x20')]:_0x1c9a81[_0x40c2('0x21')]+_0x1c9a81[_0x40c2('0x22')];var _0x578e50;if(_0x21d445>=_0x3f3840){_0x21d445=_0x3f3840;_0x578e50=0xc8;}else{_0x578e50=0xce;}_0x513b40['status'](_0x578e50);return _0x513b40[_0x40c2('0x23')](_0x40c2('0x24'),_0x4acaca+'-'+_0x21d445+'/'+_0x3f3840)[_0x40c2('0x1e')](_0x5cda21);}return null;};}function patchUpdates(_0x8d2e11){return function(_0x4354d7){try{jsonpatch[_0x40c2('0x25')](_0x4354d7,_0x8d2e11,!![]);}catch(_0x52ef28){return BPromise[_0x40c2('0x26')](_0x52ef28);}return _0x4354d7['save']();};}function saveUpdates(_0x2e097a,_0x4a320d){return function(_0x5b68f3){if(_0x5b68f3){return _0x5b68f3[_0x40c2('0x27')](_0x2e097a)[_0x40c2('0x28')](function(_0x2bd8df){return _0x2bd8df;});}return null;};}function removeEntity(_0x538a89,_0x1c25f3){return function(_0x30b2c8){if(_0x30b2c8){return _0x30b2c8[_0x40c2('0x29')]()[_0x40c2('0x28')](function(){var _0x2e4e66=_0x30b2c8['get']({'plain':!![]});var _0x350218='MailQueues';return db[_0x40c2('0x2a')][_0x40c2('0x29')]({'where':{'type':_0x350218,'resourceId':_0x2e4e66['id']}})[_0x40c2('0x28')](function(){return _0x30b2c8;});})[_0x40c2('0x28')](function(){_0x538a89[_0x40c2('0x1c')](0xcc)[_0x40c2('0x1d')]();});}};}function handleEntityNotFound(_0x373572,_0x371b62){return function(_0x38f2b5){if(!_0x38f2b5){_0x373572[_0x40c2('0x2b')](0x194);}return _0x38f2b5;};}function handleError(_0x422a6a,_0x3a7760){_0x3a7760=_0x3a7760||0x1f4;return function(_0x22ac07){logger[_0x40c2('0x2c')](_0x22ac07[_0x40c2('0x2d')]);if(_0x22ac07[_0x40c2('0x2e')]){delete _0x22ac07['name'];}_0x422a6a[_0x40c2('0x1c')](_0x3a7760)['send'](_0x22ac07);};}exports['index']=function(_0x578cb4,_0x56068f){var _0x3f2d36={},_0xbe83b3={},_0x427d40={'count':0x0,'rows':[]};var _0x209f05=_[_0x40c2('0x2f')](db[_0x40c2('0x30')]['rawAttributes'],function(_0x389818){return{'name':_0x389818['fieldName'],'type':_0x389818[_0x40c2('0x31')][_0x40c2('0x32')]};});_0xbe83b3[_0x40c2('0x33')]=_[_0x40c2('0x2f')](_0x209f05,_0x40c2('0x2e'));_0xbe83b3['query']=_[_0x40c2('0x34')](_0x578cb4[_0x40c2('0x35')]);_0xbe83b3[_0x40c2('0x36')]=_[_0x40c2('0x37')](_0xbe83b3[_0x40c2('0x33')],_0xbe83b3[_0x40c2('0x35')]);_0x3f2d36['attributes']=_[_0x40c2('0x37')](_0xbe83b3[_0x40c2('0x33')],qs['fields'](_0x578cb4[_0x40c2('0x35')][_0x40c2('0x38')]));_0x3f2d36[_0x40c2('0x39')]=_0x3f2d36[_0x40c2('0x39')][_0x40c2('0x3a')]?_0x3f2d36[_0x40c2('0x39')]:_0xbe83b3['model'];if(!_0x578cb4[_0x40c2('0x35')][_0x40c2('0x3b')]('nolimit')){_0x3f2d36[_0x40c2('0x22')]=qs['limit'](_0x578cb4['query']['limit']);_0x3f2d36[_0x40c2('0x21')]=qs[_0x40c2('0x21')](_0x578cb4[_0x40c2('0x35')][_0x40c2('0x21')]);}_0x3f2d36[_0x40c2('0x3c')]=qs['sort'](_0x578cb4[_0x40c2('0x35')][_0x40c2('0x3d')]);_0x3f2d36[_0x40c2('0x3e')]=qs[_0x40c2('0x36')](_[_0x40c2('0x3f')](_0x578cb4['query'],_0xbe83b3[_0x40c2('0x36')]),_0x209f05);if(_0x578cb4[_0x40c2('0x35')][_0x40c2('0x40')]){_0x3f2d36[_0x40c2('0x3e')]=_[_0x40c2('0x41')](_0x3f2d36[_0x40c2('0x3e')],{'$or':_['map'](_0x209f05,function(_0x143c57){if(_0x143c57[_0x40c2('0x31')]!==_0x40c2('0x42')){var _0x1129ac={};_0x1129ac[_0x143c57['name']]={'$like':'%'+_0x578cb4[_0x40c2('0x35')]['filter']+'%'};return _0x1129ac;}})});}_0x3f2d36=_[_0x40c2('0x41')]({},_0x3f2d36,_0x578cb4[_0x40c2('0x43')]);var _0x115ed3={'where':_0x3f2d36[_0x40c2('0x3e')]};return db[_0x40c2('0x30')][_0x40c2('0x20')](_0x115ed3)[_0x40c2('0x28')](function(_0x45b20b){_0x427d40[_0x40c2('0x20')]=_0x45b20b;if(_0x578cb4[_0x40c2('0x35')]['includeAll']){_0x3f2d36[_0x40c2('0x44')]=[{'all':!![]}];}return db[_0x40c2('0x30')][_0x40c2('0x45')](_0x3f2d36);})[_0x40c2('0x28')](function(_0x18e220){_0x427d40[_0x40c2('0x46')]=_0x18e220;return _0x427d40;})['then'](respondWithFilteredResult(_0x56068f,_0x3f2d36))[_0x40c2('0x47')](handleError(_0x56068f,null));};exports[_0x40c2('0x48')]=function(_0x525cdc,_0x3db732){var _0xdfc92c={'raw':!![],'where':{'id':_0x525cdc['params']['id']}},_0x1b1d0f={};_0x1b1d0f[_0x40c2('0x33')]=_['keys'](db[_0x40c2('0x30')]['rawAttributes']);_0x1b1d0f[_0x40c2('0x35')]=_['keys'](_0x525cdc[_0x40c2('0x35')]);_0x1b1d0f['filters']=_[_0x40c2('0x37')](_0x1b1d0f['model'],_0x1b1d0f[_0x40c2('0x35')]);_0xdfc92c[_0x40c2('0x39')]=_[_0x40c2('0x37')](_0x1b1d0f[_0x40c2('0x33')],qs[_0x40c2('0x38')](_0x525cdc[_0x40c2('0x35')]['fields']));_0xdfc92c[_0x40c2('0x39')]=_0xdfc92c['attributes'][_0x40c2('0x3a')]?_0xdfc92c[_0x40c2('0x39')]:_0x1b1d0f['model'];if(_0x525cdc['query'][_0x40c2('0x49')]){_0xdfc92c['include']=[{'all':!![]}];}_0xdfc92c=_[_0x40c2('0x41')]({},_0xdfc92c,_0x525cdc['options']);return db[_0x40c2('0x30')][_0x40c2('0x4a')](_0xdfc92c)['then'](handleEntityNotFound(_0x3db732,null))['then'](respondWithResult(_0x3db732,null))[_0x40c2('0x47')](handleError(_0x3db732,null));};exports[_0x40c2('0x4b')]=function(_0x46764e,_0x116e9f){return db['MailQueue'][_0x40c2('0x4b')](_0x46764e[_0x40c2('0x4c')],{})[_0x40c2('0x28')](function(_0x4d873d){var _0x3abaa5=_0x46764e[_0x40c2('0x4d')][_0x40c2('0x4e')]({'plain':!![]});if(!_0x3abaa5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abaa5[_0x40c2('0x4f')]===_0x40c2('0x4d')){var _0x1215f1=_0x4d873d[_0x40c2('0x4e')]({'plain':!![]});var _0x94f11c=_0x40c2('0x50');return db[_0x40c2('0x51')][_0x40c2('0x4a')]({'where':{'name':_0x94f11c,'userProfileId':_0x3abaa5[_0x40c2('0x52')]},'raw':!![]})['then'](function(_0x110b9f){if(_0x110b9f&&_0x110b9f[_0x40c2('0x53')]===0x0){return db[_0x40c2('0x2a')][_0x40c2('0x4b')]({'name':_0x1215f1[_0x40c2('0x2e')],'resourceId':_0x1215f1['id'],'type':_0x110b9f[_0x40c2('0x2e')],'sectionId':_0x110b9f['id']},{})[_0x40c2('0x28')](function(){return _0x4d873d;});}else{return _0x4d873d;}})[_0x40c2('0x47')](function(_0x25a7bb){logger[_0x40c2('0x2c')](_0x40c2('0x54'),_0x25a7bb);throw _0x25a7bb;});}return _0x4d873d;})[_0x40c2('0x28')](respondWithResult(_0x116e9f,0xc9))['catch'](handleError(_0x116e9f,null));};exports[_0x40c2('0x27')]=function(_0x35ad8d,_0x232a14){if(_0x35ad8d['body']['id']){delete _0x35ad8d[_0x40c2('0x4c')]['id'];}return db[_0x40c2('0x30')][_0x40c2('0x4a')]({'where':{'id':_0x35ad8d[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0x232a14,null))[_0x40c2('0x28')](saveUpdates(_0x35ad8d[_0x40c2('0x4c')],null))['then'](respondWithResult(_0x232a14,null))['catch'](handleError(_0x232a14,null));};exports[_0x40c2('0x29')]=function(_0x5c2681,_0x2400e4){return db[_0x40c2('0x30')][_0x40c2('0x4a')]({'where':{'id':_0x5c2681['params']['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0x2400e4,null))[_0x40c2('0x28')](removeEntity(_0x2400e4,null))[_0x40c2('0x47')](handleError(_0x2400e4,null));};exports[_0x40c2('0x56')]=function(_0x5f51fb,_0xe49f52){return db[_0x40c2('0x30')]['describe']()['then'](respondWithResult(_0xe49f52,null))[_0x40c2('0x47')](handleError(_0xe49f52,null));};exports[_0x40c2('0x57')]=function(_0x20d6d0,_0xbd6137,_0x206491){var _0x375993={'raw':!![],'where':{}},_0x12f1c7={},_0x2d4962;return db[_0x40c2('0x30')][_0x40c2('0x58')]({'where':{'id':_0x20d6d0[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0xbd6137,null))[_0x40c2('0x28')](function(_0x420c15){if(_0x420c15){_0x2d4962=_0x420c15[_0x40c2('0x4e')]({'plain':!![]});_0x12f1c7['model']=_[_0x40c2('0x34')](db['UserMailQueue']['rawAttributes']);_0x12f1c7[_0x40c2('0x35')]=_[_0x40c2('0x34')](_0x20d6d0[_0x40c2('0x35')]);_0x12f1c7[_0x40c2('0x36')]=_['intersection'](_0x12f1c7[_0x40c2('0x33')],_0x12f1c7['query']);_0x375993['attributes']=_[_0x40c2('0x37')](_0x12f1c7[_0x40c2('0x33')],qs[_0x40c2('0x38')](_0x20d6d0[_0x40c2('0x35')][_0x40c2('0x38')]));_0x375993[_0x40c2('0x39')]=_0x375993[_0x40c2('0x39')][_0x40c2('0x3a')]?_0x375993[_0x40c2('0x39')]:_0x12f1c7[_0x40c2('0x33')];if(!_0x20d6d0[_0x40c2('0x35')][_0x40c2('0x3b')]('nolimit')){_0x375993[_0x40c2('0x22')]=qs[_0x40c2('0x22')](_0x20d6d0[_0x40c2('0x35')][_0x40c2('0x22')]);_0x375993[_0x40c2('0x21')]=qs[_0x40c2('0x21')](_0x20d6d0[_0x40c2('0x35')]['offset']);}_0x375993[_0x40c2('0x3c')]=qs[_0x40c2('0x3d')](_0x20d6d0[_0x40c2('0x35')]['sort']);_0x375993['where']=qs[_0x40c2('0x36')](_[_0x40c2('0x3f')](_0x20d6d0[_0x40c2('0x35')],_0x12f1c7['filters']));_0x375993['where'][_0x40c2('0x59')]=_0x420c15['id'];if(_0x20d6d0[_0x40c2('0x35')][_0x40c2('0x40')]){_0x375993[_0x40c2('0x3e')]=_[_0x40c2('0x41')](_0x375993[_0x40c2('0x3e')],{'$or':_['map'](_0x375993[_0x40c2('0x39')],function(_0x2c2ad2){var _0x2350f8={};_0x2350f8[_0x2c2ad2]={'$like':'%'+_0x20d6d0[_0x40c2('0x35')][_0x40c2('0x40')]+'%'};return _0x2350f8;})});}_0x375993=_['merge']({},_0x375993,_0x20d6d0['options']);return db[_0x40c2('0x5a')][_0x40c2('0x45')](_0x375993);}})[_0x40c2('0x28')](function(_0x32206b){if(_0x32206b){return db[_0x40c2('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x32206b,_0x40c2('0x5c')),'role':_0x40c2('0x5d')},'attributes':['id','name',_0x40c2('0x5e'),_0x40c2('0x5f'),_0x40c2('0x60')]});}})['then'](function(_0x551278){if(_0x551278){return{'count':_0x551278[_0x40c2('0x20')],'rows':_['map'](_0x551278[_0x40c2('0x46')],function(_0x2317e3){return{'membername':_0x2317e3[_0x40c2('0x2e')],'UserId':_0x2317e3['id'],'queue_name':_0x2d4962[_0x40c2('0x2e')],'MailQueueId':_0x2d4962['id'],'interface':util['format']('%s/%s',_0x40c2('0x61'),_0x2317e3[_0x40c2('0x2e')]),'penalty':0x0,'paused':_0x2317e3[_0x40c2('0x5e')],'createdAt':_0x2317e3['createdAt'],'updatedAt':_0x2317e3[_0x40c2('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x40c2('0x28')](respondWithFilteredResult(_0xbd6137,_0x375993))['catch'](handleError(_0xbd6137,null));};exports[_0x40c2('0x62')]=function(_0x249ff7,_0x392c9e,_0x7dd18c){var _0x256942={};var _0x46e7f0={};var _0x3a690c;var _0x27b521;return db['MailQueue'][_0x40c2('0x58')]({'where':{'id':_0x249ff7[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0x392c9e,null))['then'](function(_0x3aa3a2){if(_0x3aa3a2){_0x3a690c=_0x3aa3a2;_0x46e7f0[_0x40c2('0x33')]=_[_0x40c2('0x34')](db[_0x40c2('0x63')]['rawAttributes']);_0x46e7f0[_0x40c2('0x35')]=_[_0x40c2('0x34')](_0x249ff7['query']);_0x46e7f0[_0x40c2('0x36')]=_[_0x40c2('0x37')](_0x46e7f0[_0x40c2('0x33')],_0x46e7f0[_0x40c2('0x35')]);_0x256942[_0x40c2('0x39')]=_['intersection'](_0x46e7f0[_0x40c2('0x33')],qs['fields'](_0x249ff7[_0x40c2('0x35')]['fields']));_0x256942[_0x40c2('0x39')]=_0x256942[_0x40c2('0x39')][_0x40c2('0x3a')]?_0x256942[_0x40c2('0x39')]:_0x46e7f0[_0x40c2('0x33')];_0x256942['order']=qs[_0x40c2('0x3d')](_0x249ff7[_0x40c2('0x35')][_0x40c2('0x3d')]);_0x256942[_0x40c2('0x3e')]=qs[_0x40c2('0x36')](_[_0x40c2('0x3f')](_0x249ff7['query'],_0x46e7f0['filters']));if(_0x249ff7[_0x40c2('0x35')]['filter']){_0x256942[_0x40c2('0x3e')]=_[_0x40c2('0x41')](_0x256942[_0x40c2('0x3e')],{'$or':_[_0x40c2('0x2f')](_0x256942[_0x40c2('0x39')],function(_0x570608){var _0x2588f6={};_0x2588f6[_0x570608]={'$like':'%'+_0x249ff7[_0x40c2('0x35')][_0x40c2('0x40')]+'%'};return _0x2588f6;})});}_0x256942=_[_0x40c2('0x41')]({},_0x256942,_0x249ff7[_0x40c2('0x43')]);return _0x3a690c[_0x40c2('0x62')](_0x256942);}})[_0x40c2('0x28')](function(_0x13cb63){if(_0x13cb63){_0x27b521=_0x13cb63['length'];if(!_0x249ff7[_0x40c2('0x35')][_0x40c2('0x3b')](_0x40c2('0x64'))){_0x256942['limit']=qs['limit'](_0x249ff7[_0x40c2('0x35')][_0x40c2('0x22')]);_0x256942[_0x40c2('0x21')]=qs[_0x40c2('0x21')](_0x249ff7['query']['offset']);}return _0x3a690c['getTeams'](_0x256942);}})[_0x40c2('0x28')](function(_0x36b713){if(_0x36b713){return _0x36b713?{'count':_0x27b521,'rows':_0x36b713}:null;}})[_0x40c2('0x28')](respondWithResult(_0x392c9e,null))[_0x40c2('0x47')](handleError(_0x392c9e,null));};exports[_0x40c2('0x65')]=function(_0x22fba3,_0x523f8d,_0x90cfa7){var _0x3d0292=_0x22fba3[_0x40c2('0x4c')][_0x40c2('0x66')];return db['Team'][_0x40c2('0x45')]({'where':{'id':_0x3d0292},'attributes':['id'],'include':[{'model':db[_0x40c2('0x5b')],'as':'Agents','attributes':['id',_0x40c2('0x2e'),_0x40c2('0x67'),_0x40c2('0x68'),_0x40c2('0x69')],'raw':!![]}]})[_0x40c2('0x28')](function(_0x3fc552){if(_0x3fc552){var _0x2df2a4=_['flatMap'](_0x3fc552,function(_0x1a72b8){var _0x431d38=_0x1a72b8[_0x40c2('0x4e')]({'plain':!![]});return _0x431d38['Agents'];});return db[_0x40c2('0x30')][_0x40c2('0x4a')]({'where':{'id':_0x22fba3[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](function(_0xc5e3fd){return db[_0x40c2('0x6a')][_0x40c2('0x6b')](function(_0x3e0fce){return _0xc5e3fd[_0x40c2('0x65')](_0x3d0292,{'transaction':_0x3e0fce})[_0x40c2('0x28')](function(){return BPromise['each'](_0x2df2a4,function(_0x5719a5){return db['UserMailQueue'][_0x40c2('0x6c')]({'where':{'UserId':_0x5719a5['id'],'MailQueueId':_0x22fba3[_0x40c2('0x55')]['id']},'transaction':_0x3e0fce});});})[_0x40c2('0x28')](function(){_0x2df2a4['forEach'](function(_0x461180){socket[_0x40c2('0x6d')](_0x40c2('0x6e'),{'UserId':_0x461180['id'],'MailQueueId':_0xc5e3fd['id']});});});});});}})[_0x40c2('0x28')](respondWithStatusCode(_0x523f8d,null))[_0x40c2('0x47')](handleError(_0x523f8d,null));};exports[_0x40c2('0x6f')]=function(_0x13013e,_0x343e7e,_0x1bee3f){return db[_0x40c2('0x63')][_0x40c2('0x45')]({'where':{'id':_0x13013e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x40c2('0x5b')],'as':_0x40c2('0x70'),'attributes':['id'],'raw':!![]}]})[_0x40c2('0x28')](handleEntityNotFound(_0x343e7e,null))[_0x40c2('0x28')](function(_0x10fb63){var _0x5a1500=_[_0x40c2('0x2f')](_0x10fb63,'id');var _0x4a1168=[];var _0xe85e65=[];var _0x305198=squel['select']();_0x305198[_0x40c2('0x71')](_0x40c2('0x72'))['from'](_0x40c2('0x73'),'tq')['join'](_0x40c2('0x74'),'ut',_0x40c2('0x75'))[_0x40c2('0x3e')]('MailQueueId\x20=\x20?',_0x13013e[_0x40c2('0x55')]['id']);for(var _0x1f0f7e=0x0;_0x1f0f7e<_0x10fb63[_0x40c2('0x3a')];_0x1f0f7e+=0x1){let _0x2c3b52=_0x10fb63[_0x1f0f7e];for(var _0x1d110e=0x0;_0x1d110e<_0x2c3b52['Agents'][_0x40c2('0x3a')];_0x1d110e+=0x1){let _0x64ba89=_0x2c3b52['Agents'][_0x1d110e];var _0x56f294=_0x305198[_0x40c2('0x76')]();_0x56f294['where'](_0x40c2('0x77'),_0x64ba89['id']);_0xe85e65[_0x40c2('0x78')](db[_0x40c2('0x6a')][_0x40c2('0x35')](_0x56f294['toString'](),{'type':db['sequelize']['QueryTypes'][_0x40c2('0x79')]})[_0x40c2('0x28')](function(_0x3c6fdf){if(_0x3c6fdf[_0x40c2('0x3a')]===0x1){return _0x64ba89['id'];}else{var _0x1095ac=_[_0x40c2('0x7a')](_['map'](_0x3c6fdf,_0x40c2('0x7b')),function(_0xb74490){return _['includes'](_0x5a1500,_0xb74490);});if(_0x1095ac){return _0x64ba89['id'];}}}));}}return BPromise[_0x40c2('0x7c')](_0xe85e65)[_0x40c2('0x28')](function(_0x40f265){_0x4a1168=_(_0x4a1168)[_0x40c2('0x7d')](_0x40f265)[_0x40c2('0x7e')]()[_0x40c2('0x7f')]();return db['MailQueue'][_0x40c2('0x4a')]({'where':{'id':_0x13013e[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](function(_0x44ac25){return db[_0x40c2('0x6a')][_0x40c2('0x6b')](function(_0x1bfe28){return _0x44ac25[_0x40c2('0x6f')](_0x13013e[_0x40c2('0x35')][_0x40c2('0x66')],{'transaction':_0x1bfe28})['then'](function(){if(!_[_0x40c2('0x80')](_0x4a1168)){return _0x44ac25[_0x40c2('0x81')](_0x4a1168,{'transaction':_0x1bfe28});}})[_0x40c2('0x28')](function(){_0x4a1168['forEach'](function(_0x43118f){socket[_0x40c2('0x6d')](_0x40c2('0x82'),{'UserId':_0x43118f,'MailQueueId':_0x44ac25['id']});});});});});});})[_0x40c2('0x28')](respondWithStatusCode(_0x343e7e,null))[_0x40c2('0x47')](handleError(_0x343e7e,null));};exports[_0x40c2('0x83')]=function(_0x44de75,_0x38aadd,_0x367819){return db[_0x40c2('0x30')]['find']({'where':{'id':_0x44de75[_0x40c2('0x55')]['id']}})['then'](handleEntityNotFound(_0x38aadd,null))['then'](function(_0x19b805){if(_0x19b805){return _0x19b805[_0x40c2('0x83')](_0x44de75[_0x40c2('0x4c')][_0x40c2('0x66')],_[_0x40c2('0x84')](_0x44de75[_0x40c2('0x4c')],[_0x40c2('0x66'),'id'])||{})[_0x40c2('0x85')](function(_0xe6e7b){for(var _0x19c3e9=0x0;_0x19c3e9<_0x44de75[_0x40c2('0x4c')][_0x40c2('0x66')][_0x40c2('0x3a')];_0x19c3e9+=0x1){socket[_0x40c2('0x6d')]('userMailQueue:save',{'UserId':Number(_0x44de75[_0x40c2('0x4c')][_0x40c2('0x66')][_0x19c3e9]),'MailQueueId':Number(_0x44de75['params']['id'])});}return _0xe6e7b;});}})[_0x40c2('0x28')](respondWithResult(_0x38aadd,null))['catch'](handleError(_0x38aadd,null));};exports[_0x40c2('0x81')]=function(_0x249f93,_0x4b208b,_0x518875){return db['MailQueue'][_0x40c2('0x4a')]({'where':{'id':_0x249f93['params']['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0x4b208b,null))[_0x40c2('0x28')](function(_0x235021){if(_0x235021){return _0x235021['removeAgents'](_0x249f93[_0x40c2('0x35')][_0x40c2('0x66')])[_0x40c2('0x28')](function(){if(_[_0x40c2('0x86')](_0x249f93[_0x40c2('0x35')][_0x40c2('0x66')])){for(var _0x4f743d=0x0;_0x4f743d<_0x249f93[_0x40c2('0x35')][_0x40c2('0x66')][_0x40c2('0x3a')];_0x4f743d+=0x1){socket[_0x40c2('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x249f93[_0x40c2('0x35')]['ids'][_0x4f743d]),'MailQueueId':Number(_0x249f93['params']['id'])});}}else{socket['emit'](_0x40c2('0x82'),{'UserId':Number(_0x249f93['query'][_0x40c2('0x66')]),'MailQueueId':Number(_0x249f93['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b208b,null))[_0x40c2('0x47')](handleError(_0x4b208b,null));};exports[_0x40c2('0x87')]=function(_0x178c23,_0x40ce96,_0x4c96cf){var _0x216e8b={};var _0x42c1b1={};var _0x5edf7f;var _0x5db097;return db['MailQueue'][_0x40c2('0x58')]({'where':{'id':_0x178c23[_0x40c2('0x55')]['id']}})[_0x40c2('0x28')](handleEntityNotFound(_0x40ce96,null))[_0x40c2('0x28')](function(_0x3dd775){if(_0x3dd775){_0x5edf7f=_0x3dd775;_0x42c1b1['model']=_[_0x40c2('0x34')](db['User']['rawAttributes']);_0x42c1b1['query']=_[_0x40c2('0x34')](_0x178c23['query']);_0x42c1b1['filters']=_[_0x40c2('0x37')](_0x42c1b1[_0x40c2('0x33')],_0x42c1b1[_0x40c2('0x35')]);_0x216e8b[_0x40c2('0x39')]=_['intersection'](_0x42c1b1[_0x40c2('0x33')],qs[_0x40c2('0x38')](_0x178c23[_0x40c2('0x35')][_0x40c2('0x38')]));_0x216e8b['attributes']=_0x216e8b[_0x40c2('0x39')][_0x40c2('0x3a')]?_0x216e8b[_0x40c2('0x39')]:_0x42c1b1[_0x40c2('0x33')];_0x216e8b[_0x40c2('0x3c')]=qs[_0x40c2('0x3d')](_0x178c23[_0x40c2('0x35')][_0x40c2('0x3d')]);_0x216e8b[_0x40c2('0x3e')]=qs['filters'](_[_0x40c2('0x3f')](_0x178c23[_0x40c2('0x35')],_0x42c1b1[_0x40c2('0x36')]));if(_0x178c23[_0x40c2('0x35')][_0x40c2('0x40')]){_0x216e8b[_0x40c2('0x3e')]=_[_0x40c2('0x41')](_0x216e8b['where'],{'$or':_[_0x40c2('0x2f')](_0x216e8b[_0x40c2('0x39')],function(_0x10ad77){var _0x154c59={};_0x154c59[_0x10ad77]={'$like':'%'+_0x178c23[_0x40c2('0x35')]['filter']+'%'};return _0x154c59;})});}_0x216e8b=_[_0x40c2('0x41')]({},_0x216e8b,_0x178c23[_0x40c2('0x43')]);return _0x5edf7f['getAgents'](_0x216e8b);}})[_0x40c2('0x28')](function(_0x1ee452){if(_0x1ee452){_0x5db097=_0x1ee452['length'];if(!_0x178c23['query'][_0x40c2('0x3b')](_0x40c2('0x64'))){_0x216e8b[_0x40c2('0x22')]=qs[_0x40c2('0x22')](_0x178c23[_0x40c2('0x35')][_0x40c2('0x22')]);_0x216e8b[_0x40c2('0x21')]=qs[_0x40c2('0x21')](_0x178c23[_0x40c2('0x35')]['offset']);}return _0x5edf7f[_0x40c2('0x87')](_0x216e8b);}})[_0x40c2('0x28')](function(_0x447872){if(_0x447872){return _0x447872?{'count':_0x5db097,'rows':_0x447872}:null;}})['then'](respondWithResult(_0x40ce96,null))[_0x40c2('0x47')](handleError(_0x40ce96,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1f9b4b6..8d826c4 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 _0x64e7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0xdd8586,_0x35215e){var _0x176c5b=function(_0x40fc4c){while(--_0x40fc4c){_0xdd8586['push'](_0xdd8586['shift']());}};_0x176c5b(++_0x35215e);}(_0x64e7,0x1c6));var _0x764e=function(_0x5b7365,_0x2111bb){_0x5b7365=_0x5b7365-0x0;var _0x433c84=_0x64e7[_0x5b7365];return _0x433c84;};'use strict';var EventEmitter=require(_0x764e('0x0'));var MailQueue=require(_0x764e('0x1'))['db'][_0x764e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x764e('0x3')](0x0);var events={'afterCreate':_0x764e('0x4'),'afterUpdate':_0x764e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1553a6){return function(_0x56874b,_0x1c937f,_0x3927f0){MailQueueEvents[_0x764e('0x6')](_0x1553a6+':'+_0x56874b['id'],_0x56874b);MailQueueEvents[_0x764e('0x6')](_0x1553a6,_0x56874b);_0x3927f0(null);};}for(var e in events){if(events[_0x764e('0x7')](e)){var event=events[e];MailQueue[_0x764e('0x8')](e,emitEvent(event));}}module[_0x764e('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xbf14=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1ed298,_0x514c16){var _0xdc6426=function(_0x4fd404){while(--_0x4fd404){_0x1ed298['push'](_0x1ed298['shift']());}};_0xdc6426(++_0x514c16);}(_0xbf14,0x164));var _0x4bf1=function(_0x5dbfe6,_0x1d132e){_0x5dbfe6=_0x5dbfe6-0x0;var _0x24f9b9=_0xbf14[_0x5dbfe6];return _0x24f9b9;};'use strict';var EventEmitter=require(_0x4bf1('0x0'));var MailQueue=require(_0x4bf1('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x4bf1('0x2')](0x0);var events={'afterCreate':_0x4bf1('0x3'),'afterUpdate':_0x4bf1('0x4'),'afterDestroy':_0x4bf1('0x5')};function emitEvent(_0x50e315){return function(_0x48668d,_0x190e31,_0xeefb2c){MailQueueEvents[_0x4bf1('0x6')](_0x50e315+':'+_0x48668d['id'],_0x48668d);MailQueueEvents[_0x4bf1('0x6')](_0x50e315,_0x48668d);_0xeefb2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x4bf1('0x7')](e,emitEvent(event));}}module[_0x4bf1('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 f6aea34..e8f5dd1 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 _0xe7a3=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailQueue.attributes'];(function(_0x4f1243,_0x196c03){var _0xfc3783=function(_0x4c2aa7){while(--_0x4c2aa7){_0x4f1243['push'](_0x4f1243['shift']());}};_0xfc3783(++_0x196c03);}(_0xe7a3,0x137));var _0x3e7a=function(_0x1c2f57,_0x33d4f9){_0x1c2f57=_0x1c2f57-0x0;var _0x161a43=_0xe7a3[_0x1c2f57];return _0x161a43;};'use strict';var _=require(_0x3e7a('0x0'));var util=require(_0x3e7a('0x1'));var logger=require(_0x3e7a('0x2'))(_0x3e7a('0x3'));var moment=require(_0x3e7a('0x4'));var BPromise=require(_0x3e7a('0x5'));var rp=require(_0x3e7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7a('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e7a('0x8'));module[_0x3e7a('0x9')]=function(_0x864d7c,_0x53a20a){return _0x864d7c['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f8a=['../../config/logger','api','moment','path','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash'];(function(_0x4506a3,_0x383514){var _0x3a112c=function(_0x53097d){while(--_0x53097d){_0x4506a3['push'](_0x4506a3['shift']());}};_0x3a112c(++_0x383514);}(_0x9f8a,0x171));var _0xa9f8=function(_0x1673d4,_0x31b681){_0x1673d4=_0x1673d4-0x0;var _0x481d97=_0x9f8a[_0x1673d4];return _0x481d97;};'use strict';var _=require(_0xa9f8('0x0'));var util=require('util');var logger=require(_0xa9f8('0x1'))(_0xa9f8('0x2'));var moment=require(_0xa9f8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f8('0x4'));var rimraf=require('rimraf');var config=require(_0xa9f8('0x5'));var attributes=require(_0xa9f8('0x6'));module[_0xa9f8('0x7')]=function(_0x59546e,_0x5d6a1f){return _0x59546e['define'](_0xa9f8('0x8'),attributes,{'tableName':_0xa9f8('0x9'),'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 9d2b07f..dee85e0 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 _0xc1aa=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./mailQueue.socket','request','info','request\x20sent','debug'];(function(_0x2714c4,_0x28b388){var _0x5626c8=function(_0x26a6cd){while(--_0x26a6cd){_0x2714c4['push'](_0x2714c4['shift']());}};_0x5626c8(++_0x28b388);}(_0xc1aa,0xa9));var _0xac1a=function(_0x328eca,_0x3ae0f4){_0x328eca=_0x328eca-0x0;var _0xeb6aff=_0xc1aa[_0x328eca];return _0xeb6aff;};'use strict';var _=require(_0xac1a('0x0'));var util=require('util');var moment=require(_0xac1a('0x1'));var BPromise=require(_0xac1a('0x2'));var rs=require(_0xac1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac1a('0x4'))['db'];var utils=require(_0xac1a('0x5'));var logger=require('../../config/logger')(_0xac1a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xac1a('0x7')]({'port':0x232a});config[_0xac1a('0x8')]=_[_0xac1a('0x9')](config[_0xac1a('0x8')],{'host':_0xac1a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xac1a('0xb'))['register'](socket);function respondWithRpcPromise(_0x330545,_0x209577,_0x4535c6){return new BPromise(function(_0x6d12ba,_0x6defc7){return client[_0xac1a('0xc')](_0x330545,_0x4535c6)['then'](function(_0x46201c){logger[_0xac1a('0xd')]('MailQueue,\x20%s,\x20%s',_0x209577,_0xac1a('0xe'));logger[_0xac1a('0xf')](_0xac1a('0x10'),_0x209577,'request\x20sent',JSON[_0xac1a('0x11')](_0x46201c));if(_0x46201c['error']){if(_0x46201c[_0xac1a('0x12')][_0xac1a('0x13')]===0x1f4){logger[_0xac1a('0x12')](_0xac1a('0x14'),_0x209577,_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);return _0x6defc7(_0x46201c['error'][_0xac1a('0x15')]);}logger[_0xac1a('0x12')]('MailQueue,\x20%s,\x20%s',_0x209577,_0x46201c[_0xac1a('0x12')]['message']);return _0x6d12ba(_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x209577,'request\x20sent');_0x6d12ba(_0x46201c['result'][_0xac1a('0x15')]);}})[_0xac1a('0x16')](function(_0x3ac392){logger[_0xac1a('0x12')]('MailQueue,\x20%s,\x20%s',_0x209577,_0x3ac392);_0x6defc7(_0x3ac392);});});}exports[_0xac1a('0x17')]=function(_0x4c66ad){var _0x4f45fc=this;return new Promise(function(_0x3a3916,_0x368093){return db[_0xac1a('0x18')][_0xac1a('0x19')]({'raw':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1c')]||null:null,'attributes':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1d')]||null:null,'limit':_0x4c66ad['options']?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1e')]||null:null,'include':_0x4c66ad['options']?_0x4c66ad['options'][_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1f')],function(_0x101f24){return{'model':db[_0x101f24[_0xac1a('0x21')]],'as':_0x101f24['as'],'attributes':_0x101f24[_0xac1a('0x1d')],'include':_0x101f24[_0xac1a('0x1f')]?_['map'](_0x101f24[_0xac1a('0x1f')],function(_0x5bb306){return{'model':db[_0x5bb306[_0xac1a('0x21')]],'as':_0x5bb306['as'],'attributes':_0x5bb306[_0xac1a('0x1d')],'include':_0x5bb306[_0xac1a('0x1f')]?_['map'](_0x5bb306[_0xac1a('0x1f')],function(_0x2567a5){return{'model':db[_0x2567a5[_0xac1a('0x21')]],'as':_0x2567a5['as'],'attributes':_0x2567a5[_0xac1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac1a('0x22')](function(_0x1a9129){logger[_0xac1a('0xd')](_0xac1a('0x17'),_0x4c66ad);logger[_0xac1a('0xf')](_0xac1a('0x17'),_0x4c66ad,JSON[_0xac1a('0x11')](_0x1a9129));_0x3a3916(_0x1a9129);})[_0xac1a('0x16')](function(_0x5cf9d2){logger[_0xac1a('0x12')](_0xac1a('0x17'),_0x5cf9d2[_0xac1a('0x15')],_0x4c66ad);_0x368093(_0x4f45fc[_0xac1a('0x12')](0x1f4,_0x5cf9d2[_0xac1a('0x15')]));});});};exports[_0xac1a('0x23')]=function(_0x392233){var _0x1ddd9d=this;return new Promise(function(_0x34a871,_0x505fc5){return db[_0xac1a('0x18')][_0xac1a('0x24')]({'raw':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x392233[_0xac1a('0x1a')]?_0x392233['options']['where']||null:null,'attributes':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1d')]||null:null,'include':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x392233[_0xac1a('0x1a')][_0xac1a('0x1f')],function(_0x476cb6){return{'model':db[_0x476cb6[_0xac1a('0x21')]],'as':_0x476cb6['as'],'attributes':_0x476cb6[_0xac1a('0x1d')],'include':_0x476cb6[_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x476cb6[_0xac1a('0x1f')],function(_0x4f3f7a){return{'model':db[_0x4f3f7a[_0xac1a('0x21')]],'as':_0x4f3f7a['as'],'attributes':_0x4f3f7a[_0xac1a('0x1d')],'include':_0x4f3f7a[_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x4f3f7a['include'],function(_0x5835e3){return{'model':db[_0x5835e3[_0xac1a('0x21')]],'as':_0x5835e3['as'],'attributes':_0x5835e3[_0xac1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac1a('0x22')](function(_0x1cf627){logger[_0xac1a('0xd')](_0xac1a('0x23'),_0x392233);logger[_0xac1a('0xf')](_0xac1a('0x23'),_0x392233,JSON[_0xac1a('0x11')](_0x1cf627));_0x34a871(_0x1cf627);})[_0xac1a('0x16')](function(_0x226a13){logger[_0xac1a('0x12')]('ShowMailQueue',_0x226a13['message'],_0x392233);_0x505fc5(_0x1ddd9d['error'](0x1f4,_0x226a13['message']));});});}; \ No newline at end of file +var _0x4c73=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetMailQueue','find','ShowMailQueue','lodash','util','moment','bluebird'];(function(_0x150e14,_0x3a7c0a){var _0x2d26fc=function(_0x33103b){while(--_0x33103b){_0x150e14['push'](_0x150e14['shift']());}};_0x2d26fc(++_0x3a7c0a);}(_0x4c73,0x14c));var _0x34c7=function(_0x33b7bd,_0x8ddb4d){_0x33b7bd=_0x33b7bd-0x0;var _0x1059c6=_0x4c73[_0x33b7bd];return _0x1059c6;};'use strict';var _=require(_0x34c7('0x0'));var util=require(_0x34c7('0x1'));var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rs=require(_0x34c7('0x4'));var fs=require('fs');var Redis=require(_0x34c7('0x5'));var db=require(_0x34c7('0x6'))['db'];var utils=require(_0x34c7('0x7'));var logger=require('../../config/logger')(_0x34c7('0x8'));var config=require(_0x34c7('0x9'));var jayson=require(_0x34c7('0xa'));var client=jayson[_0x34c7('0xb')][_0x34c7('0xc')]({'port':0x232a});config[_0x34c7('0xd')]=_['defaults'](config[_0x34c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x34c7('0xe'))(new Redis(config[_0x34c7('0xd')]));require('./mailQueue.socket')[_0x34c7('0xf')](socket);function respondWithRpcPromise(_0x56a95b,_0x3d0adc,_0x11ed76){return new BPromise(function(_0x3e3d3c,_0x45f3db){return client[_0x34c7('0x10')](_0x56a95b,_0x11ed76)[_0x34c7('0x11')](function(_0x31e24f){logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));logger[_0x34c7('0x15')](_0x34c7('0x16'),_0x3d0adc,_0x34c7('0x14'),JSON[_0x34c7('0x17')](_0x31e24f));if(_0x31e24f[_0x34c7('0x18')]){if(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x19')]===0x1f4){logger[_0x34c7('0x18')]('MailQueue,\x20%s,\x20%s',_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x45f3db(_0x31e24f['error'][_0x34c7('0x1a')]);}logger[_0x34c7('0x18')](_0x34c7('0x13'),_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x3e3d3c(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);}else{logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));_0x3e3d3c(_0x31e24f[_0x34c7('0x1b')][_0x34c7('0x1a')]);}})[_0x34c7('0x1c')](function(_0x484405){logger[_0x34c7('0x18')]('MailQueue,\x20%s,\x20%s',_0x3d0adc,_0x484405);_0x45f3db(_0x484405);});});}exports['GetMailQueue']=function(_0x548e71){var _0x3e6af1=this;return new Promise(function(_0x5ae135,_0x3bee56){return db[_0x34c7('0x1d')][_0x34c7('0x1e')]({'raw':_0x548e71[_0x34c7('0x1f')]?_0x548e71[_0x34c7('0x1f')][_0x34c7('0x20')]===undefined?!![]:![]:!![],'where':_0x548e71[_0x34c7('0x1f')]?_0x548e71['options'][_0x34c7('0x21')]||null:null,'attributes':_0x548e71[_0x34c7('0x1f')]?_0x548e71[_0x34c7('0x1f')]['attributes']||null:null,'limit':_0x548e71[_0x34c7('0x1f')]?_0x548e71[_0x34c7('0x1f')][_0x34c7('0x22')]||null:null,'include':_0x548e71[_0x34c7('0x1f')]?_0x548e71[_0x34c7('0x1f')][_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x548e71[_0x34c7('0x1f')][_0x34c7('0x23')],function(_0x13c113){return{'model':db[_0x13c113[_0x34c7('0x25')]],'as':_0x13c113['as'],'attributes':_0x13c113[_0x34c7('0x26')],'include':_0x13c113[_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x13c113[_0x34c7('0x23')],function(_0x754bf){return{'model':db[_0x754bf['model']],'as':_0x754bf['as'],'attributes':_0x754bf[_0x34c7('0x26')],'include':_0x754bf[_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x754bf[_0x34c7('0x23')],function(_0x1c42b7){return{'model':db[_0x1c42b7[_0x34c7('0x25')]],'as':_0x1c42b7['as'],'attributes':_0x1c42b7[_0x34c7('0x26')]};}):[]};}):[]};}):[]:[]})[_0x34c7('0x11')](function(_0x4e6ce2){logger['info'](_0x34c7('0x27'),_0x548e71);logger[_0x34c7('0x15')](_0x34c7('0x27'),_0x548e71,JSON['stringify'](_0x4e6ce2));_0x5ae135(_0x4e6ce2);})[_0x34c7('0x1c')](function(_0x57a99e){logger[_0x34c7('0x18')](_0x34c7('0x27'),_0x57a99e['message'],_0x548e71);_0x3bee56(_0x3e6af1['error'](0x1f4,_0x57a99e['message']));});});};exports['ShowMailQueue']=function(_0x321a1f){var _0xf36996=this;return new Promise(function(_0x45317f,_0xabaa96){return db['MailQueue'][_0x34c7('0x28')]({'raw':_0x321a1f[_0x34c7('0x1f')]?_0x321a1f[_0x34c7('0x1f')][_0x34c7('0x20')]===undefined?!![]:![]:!![],'where':_0x321a1f[_0x34c7('0x1f')]?_0x321a1f[_0x34c7('0x1f')]['where']||null:null,'attributes':_0x321a1f[_0x34c7('0x1f')]?_0x321a1f[_0x34c7('0x1f')][_0x34c7('0x26')]||null:null,'include':_0x321a1f[_0x34c7('0x1f')]?_0x321a1f[_0x34c7('0x1f')][_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x321a1f['options']['include'],function(_0x1ef14d){return{'model':db[_0x1ef14d[_0x34c7('0x25')]],'as':_0x1ef14d['as'],'attributes':_0x1ef14d[_0x34c7('0x26')],'include':_0x1ef14d[_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x1ef14d[_0x34c7('0x23')],function(_0x4d0685){return{'model':db[_0x4d0685[_0x34c7('0x25')]],'as':_0x4d0685['as'],'attributes':_0x4d0685[_0x34c7('0x26')],'include':_0x4d0685[_0x34c7('0x23')]?_[_0x34c7('0x24')](_0x4d0685[_0x34c7('0x23')],function(_0x4ca72b){return{'model':db[_0x4ca72b[_0x34c7('0x25')]],'as':_0x4ca72b['as'],'attributes':_0x4ca72b[_0x34c7('0x26')]};}):[]};}):[]};}):[]:[]})[_0x34c7('0x11')](function(_0x3dd065){logger[_0x34c7('0x12')](_0x34c7('0x29'),_0x321a1f);logger['debug'](_0x34c7('0x29'),_0x321a1f,JSON[_0x34c7('0x17')](_0x3dd065));_0x45317f(_0x3dd065);})['catch'](function(_0x580c27){logger[_0x34c7('0x18')]('ShowMailQueue',_0x580c27[_0x34c7('0x1a')],_0x321a1f);_0xabaa96(_0xf36996[_0x34c7('0x18')](0x1f4,_0x580c27[_0x34c7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4cf0061..cb9f8f0 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 _0x6000=['removeListener','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x1009e5,_0x366a75){var _0x2b89df=function(_0x4b0954){while(--_0x4b0954){_0x1009e5['push'](_0x1009e5['shift']());}};_0x2b89df(++_0x366a75);}(_0x6000,0x17c));var _0x0600=function(_0x365c7c,_0x2f02ba){_0x365c7c=_0x365c7c-0x0;var _0x76bb19=_0x6000[_0x365c7c];return _0x76bb19;};'use strict';var MailQueueEvents=require(_0x0600('0x0'));var events=[_0x0600('0x1'),_0x0600('0x2'),_0x0600('0x3')];function createListener(_0x37e04c,_0x2b0ffd){return function(_0x5cf86c){_0x2b0ffd[_0x0600('0x4')](_0x37e04c,_0x5cf86c);};}function removeListener(_0x347b82,_0x534e6e){return function(){MailQueueEvents[_0x0600('0x5')](_0x347b82,_0x534e6e);};}exports['register']=function(_0x38f630){for(var _0xc18208=0x0,_0x89927a=events['length'];_0xc18208<_0x89927a;_0xc18208++){var _0x45e348=events[_0xc18208];var _0x5730b2=createListener(_0x0600('0x6')+_0x45e348,_0x38f630);MailQueueEvents['on'](_0x45e348,_0x5730b2);}}; \ No newline at end of file +var _0x8eba=['save','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x57e212,_0xb2da96){var _0x1e9cf7=function(_0xd06dd5){while(--_0xd06dd5){_0x57e212['push'](_0x57e212['shift']());}};_0x1e9cf7(++_0xb2da96);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x8eba[_0x1911ed];return _0x11edaa;};'use strict';var MailQueueEvents=require(_0xa8eb('0x0'));var events=[_0xa8eb('0x1'),'remove','update'];function createListener(_0x4b3a3e,_0x3894f8){return function(_0x322799){_0x3894f8[_0xa8eb('0x2')](_0x4b3a3e,_0x322799);};}function removeListener(_0x2cdf40,_0x52533a){return function(){MailQueueEvents[_0xa8eb('0x3')](_0x2cdf40,_0x52533a);};}exports[_0xa8eb('0x4')]=function(_0x5abab9){for(var _0x321f2f=0x0,_0x5ece80=events[_0xa8eb('0x5')];_0x321f2f<_0x5ece80;_0x321f2f++){var _0x225307=events[_0x321f2f];var _0x509b54=createListener(_0xa8eb('0x6')+_0x225307,_0x5abab9);MailQueueEvents['on'](_0x225307,_0x509b54);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4380d78..a5c6332 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 _0x8bbe=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x8bbe,0x73));var _0xe8bb=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x8bbe[_0x5235a6];return _0x1cf37e;};'use strict';var multer=require(_0xe8bb('0x0'));var util=require('util');var path=require(_0xe8bb('0x1'));var timeout=require(_0xe8bb('0x2'));var express=require(_0xe8bb('0x3'));var router=express[_0xe8bb('0x4')]();var fs_extra=require(_0xe8bb('0x5'));var auth=require(_0xe8bb('0x6'));var interaction=require(_0xe8bb('0x7'));var config=require(_0xe8bb('0x8'));var controller=require('./mailQueueReport.controller');router[_0xe8bb('0x9')]('/',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xb')]);router[_0xe8bb('0x9')](_0xe8bb('0xc'),auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xd')]);router[_0xe8bb('0x9')](_0xe8bb('0xe'),auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xf')]);router[_0xe8bb('0x10')]('/',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0x11')]);router[_0xe8bb('0x12')](_0xe8bb('0xe'),auth[_0xe8bb('0xa')](),controller['update']);router[_0xe8bb('0x13')]('/:id',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd80f=['create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','show','post'];(function(_0x102bec,_0x4ff431){var _0x473ee7=function(_0x192dea){while(--_0x192dea){_0x102bec['push'](_0x102bec['shift']());}};_0x473ee7(++_0x4ff431);}(_0xd80f,0xbb));var _0xfd80=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd80f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd80('0x0'));var timeout=require(_0xfd80('0x1'));var express=require(_0xfd80('0x2'));var router=express[_0xfd80('0x3')]();var fs_extra=require(_0xfd80('0x4'));var auth=require(_0xfd80('0x5'));var interaction=require(_0xfd80('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xfd80('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd80('0x7')](_0xfd80('0x8'),auth[_0xfd80('0x9')](),controller[_0xfd80('0xa')]);router['get']('/:id',auth[_0xfd80('0x9')](),controller[_0xfd80('0xb')]);router[_0xfd80('0xc')]('/',auth['isAuthenticated'](),controller[_0xfd80('0xd')]);router[_0xfd80('0xe')](_0xfd80('0xf'),auth[_0xfd80('0x9')](),controller[_0xfd80('0x10')]);router[_0xfd80('0x11')](_0xfd80('0xf'),auth['isAuthenticated'](),controller[_0xfd80('0x12')]);module[_0xfd80('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 5e0dde2..82f2f05 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 _0xb584=['DATE','sequelize','exports','STRING'];(function(_0x30515b,_0x323391){var _0x1b188d=function(_0x2c8938){while(--_0x2c8938){_0x30515b['push'](_0x30515b['shift']());}};_0x1b188d(++_0x323391);}(_0xb584,0x91));var _0x4b58=function(_0x14a994,_0xbf8d9b){_0x14a994=_0x14a994-0x0;var _0x135c82=_0xb584[_0x14a994];return _0x135c82;};'use strict';var moment=require('moment');var Sequelize=require(_0x4b58('0x0'));module[_0x4b58('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4b58('0x2')]},'joinAt':{'type':Sequelize[_0x4b58('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4b58('0x3')]},'reason':{'type':Sequelize[_0x4b58('0x2')]}}; \ No newline at end of file +var _0x49c5=['STRING','DATE','moment','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x49c5,0x183));var _0x549c=function(_0x48f29a,_0x4d8874){_0x48f29a=_0x48f29a-0x0;var _0x31feae=_0x49c5[_0x48f29a];return _0x31feae;};'use strict';var moment=require(_0x549c('0x0'));var Sequelize=require(_0x549c('0x1'));module[_0x549c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x549c('0x3')]},'joinAt':{'type':Sequelize[_0x549c('0x4')]},'leaveAt':{'type':Sequelize[_0x549c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'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 6f5fb27..dd4882a 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x59fd02,_0x4cb9de){var _0x1e7aa5=function(_0x14acec){while(--_0x14acec){_0x59fd02['push'](_0x59fd02['shift']());}};_0x1e7aa5(++_0x4cb9de);}(_0x7a54,0x106));var _0x47a5=function(_0x87c88e,_0x370017){_0x87c88e=_0x87c88e-0x0;var _0x3ceabe=_0x7a54[_0x87c88e];return _0x3ceabe;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['MailQueueReport'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['MailQueueReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['MailQueueReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0xedf8e6,_0x3408ac){var _0x21ef95=function(_0x58f99f){while(--_0x58f99f){_0xedf8e6['push'](_0xedf8e6['shift']());}};_0x21ef95(++_0x3408ac);}(_0x8aad,0x146));var _0xd8aa=function(_0x5ae3a7,_0x104846){_0x5ae3a7=_0x5ae3a7-0x0;var _0x506b45=_0x8aad[_0x5ae3a7];return _0x506b45;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8ebda7a..958de2e 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 _0x1331=['./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x54c454,_0x25b922){var _0x378f08=function(_0x484ffb){while(--_0x484ffb){_0x54c454['push'](_0x54c454['shift']());}};_0x378f08(++_0x25b922);}(_0x1331,0x67));var _0x1133=function(_0x44156b,_0x1e64eb){_0x44156b=_0x44156b-0x0;var _0x3ede17=_0x1331[_0x44156b];return _0x3ede17;};'use strict';var _=require(_0x1133('0x0'));var util=require(_0x1133('0x1'));var logger=require(_0x1133('0x2'))(_0x1133('0x3'));var moment=require(_0x1133('0x4'));var BPromise=require('bluebird');var rp=require(_0x1133('0x5'));var fs=require('fs');var path=require(_0x1133('0x6'));var rimraf=require(_0x1133('0x7'));var config=require(_0x1133('0x8'));var attributes=require(_0x1133('0x9'));module[_0x1133('0xa')]=function(_0x2bce7b,_0x37be7a){return _0x2bce7b['define'](_0x1133('0xb'),attributes,{'tableName':_0x1133('0xc'),'paranoid':![],'indexes':[{'name':_0x1133('0xd'),'fields':[_0x1133('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb21=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x612267,_0x363a1f){var _0x46b502=function(_0x32791a){while(--_0x32791a){_0x612267['push'](_0x612267['shift']());}};_0x46b502(++_0x363a1f);}(_0xdb21,0x135));var _0x1db2=function(_0x5b4daa,_0xc385e4){_0x5b4daa=_0x5b4daa-0x0;var _0x9b569c=_0xdb21[_0x5b4daa];return _0x9b569c;};'use strict';var _=require(_0x1db2('0x0'));var util=require(_0x1db2('0x1'));var logger=require(_0x1db2('0x2'))(_0x1db2('0x3'));var moment=require(_0x1db2('0x4'));var BPromise=require(_0x1db2('0x5'));var rp=require(_0x1db2('0x6'));var fs=require('fs');var path=require(_0x1db2('0x7'));var rimraf=require(_0x1db2('0x8'));var config=require('../../config/environment');var attributes=require(_0x1db2('0x9'));module['exports']=function(_0x5a7099,_0x174343){return _0x5a7099[_0x1db2('0xa')](_0x1db2('0xb'),attributes,{'tableName':_0x1db2('0xc'),'paranoid':![],'indexes':[{'name':_0x1db2('0xd'),'fields':[_0x1db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e95ea81..8fb4e5d 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(_0x2c9332,_0x745b0c){var _0x4a14a9=function(_0x29bc9c){while(--_0x29bc9c){_0x2c9332['push'](_0x2c9332['shift']());}};_0x4a14a9(++_0x745b0c);}(_0xdb28,0x106));var _0x8db2=function(_0x50ee6d,_0x5f084b){_0x50ee6d=_0x50ee6d-0x0;var _0x691f0a=_0xdb28[_0x50ee6d];return _0x691f0a;};'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(_0x297a40,_0x24cbe0){var _0x4f2752=function(_0x21ed5a){while(--_0x21ed5a){_0x297a40['push'](_0x297a40['shift']());}};_0x4f2752(++_0x24cbe0);}(_0x1261,0x144));var _0x1126=function(_0x3cdf50,_0x3e8eb2){_0x3cdf50=_0x3cdf50-0x0;var _0x22d47a=_0x1261[_0x3cdf50];return _0x22d47a;};'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 9f43623..f9c47e8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11afe7,_0x2dcbae){var _0x2967b5=function(_0x534484){while(--_0x534484){_0x11afe7['push'](_0x11afe7['shift']());}};_0x2967b5(++_0x2dcbae);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5bb077,_0x314590){var _0x487afc=function(_0x1293b3){while(--_0x1293b3){_0x5bb077['push'](_0x5bb077['shift']());}};_0x487afc(++_0x314590);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 32a27cb..291cec3 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 _0x6689=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x43eb95,_0x2dc0e6){var _0x4ea40e=function(_0x489768){while(--_0x489768){_0x43eb95['push'](_0x43eb95['shift']());}};_0x4ea40e(++_0x2dc0e6);}(_0x6689,0x179));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9668('0x0')]={'description':{'type':Sequelize[_0x9668('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x9668('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9668('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9668('0x3')]},'tls':{'type':Sequelize[_0x9668('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9668('0x1')],'defaultValue':_0x9668('0x4')},'connTimeout':{'type':Sequelize[_0x9668('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9668('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9668('0x1')]},'modernAuthentication':{'type':Sequelize[_0x9668('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa8ce=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x4fc300,_0x51ecb4){var _0x318890=function(_0x5d9bc6){while(--_0x5d9bc6){_0x4fc300['push'](_0x4fc300['shift']());}};_0x318890(++_0x51ecb4);}(_0xa8ce,0x1d8));var _0xea8c=function(_0x3e4c70,_0x202c0c){_0x3e4c70=_0x3e4c70-0x0;var _0x26c67e=_0xa8ce[_0x3e4c70];return _0x26c67e;};'use strict';var Sequelize=require('sequelize');module[_0xea8c('0x0')]={'description':{'type':Sequelize[_0xea8c('0x1')]},'host':{'type':Sequelize[_0xea8c('0x1')]},'authentication':{'type':Sequelize[_0xea8c('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xea8c('0x1')]},'password':{'type':Sequelize[_0xea8c('0x1')]},'port':{'type':Sequelize[_0xea8c('0x3')]},'tls':{'type':Sequelize[_0xea8c('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xea8c('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xea8c('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xea8c('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5d19b65..7806171 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 _0x9fed=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x407d50,_0x1c258b){var _0x13e7cb=function(_0x3e7b1e){while(--_0x3e7b1e){_0x407d50['push'](_0x407d50['shift']());}};_0x13e7cb(++_0x1c258b);}(_0x9fed,0x126));var _0xd9fe=function(_0x586cb1,_0xeb36d){_0x586cb1=_0x586cb1-0x0;var _0x58cc8c=_0x9fed[_0x586cb1];return _0x58cc8c;};'use strict';var _=require('lodash');var util=require(_0xd9fe('0x0'));var logger=require(_0xd9fe('0x1'))(_0xd9fe('0x2'));var moment=require(_0xd9fe('0x3'));var BPromise=require(_0xd9fe('0x4'));var rp=require(_0xd9fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9fe('0x6'));var config=require(_0xd9fe('0x7'));var attributes=require(_0xd9fe('0x8'));module[_0xd9fe('0x9')]=function(_0x5adebd,_0x45e9d0){return _0x5adebd[_0xd9fe('0xa')]('MailServerIn',attributes,{'tableName':_0xd9fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e0=['util','../../config/logger','moment','bluebird','rimraf','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash'];(function(_0x5a5b05,_0x2b2b39){var _0x2d7680=function(_0xe0b893){while(--_0xe0b893){_0x5a5b05['push'](_0x5a5b05['shift']());}};_0x2d7680(++_0x2b2b39);}(_0xa1e0,0x17b));var _0x0a1e=function(_0x367058,_0x53da31){_0x367058=_0x367058-0x0;var _0x1f557a=_0xa1e0[_0x367058];return _0x1f557a;};'use strict';var _=require(_0x0a1e('0x0'));var util=require(_0x0a1e('0x1'));var logger=require(_0x0a1e('0x2'))('api');var moment=require(_0x0a1e('0x3'));var BPromise=require(_0x0a1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a1e('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a1e('0x6'));module['exports']=function(_0x54fb9a,_0x5e450e){return _0x54fb9a[_0x0a1e('0x7')](_0x0a1e('0x8'),attributes,{'tableName':_0x0a1e('0x9'),'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 97dce92..b2f4a31 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 _0xbb53=['options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','stringify','error','message','MailServerIn,\x20%s,\x20%s','result','GetMailServerIn'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xbb53,0x121));var _0x3bb5=function(_0x54574f,_0x1b4743){_0x54574f=_0x54574f-0x0;var _0x8ddf1d=_0xbb53[_0x54574f];return _0x8ddf1d;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('MailServerIn,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('MailServerIn,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});}exports[_0x3bb5('0x14')]=function(_0x48bc25){var _0x13cb3a=this;return new Promise(function(_0x1109d0,_0x289177){return db['MailServerIn']['findAll']({'raw':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x16')]===undefined?!![]:![]:!![],'where':_0x48bc25['options']?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x17')]||null:null,'attributes':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x18')]||null:null,'limit':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25['options'][_0x3bb5('0x19')]||null:null,'include':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')],function(_0x58c10f){return{'model':db[_0x58c10f[_0x3bb5('0x1c')]],'as':_0x58c10f['as'],'attributes':_0x58c10f[_0x3bb5('0x18')],'include':_0x58c10f['include']?_['map'](_0x58c10f[_0x3bb5('0x1a')],function(_0x36cfda){return{'model':db[_0x36cfda['model']],'as':_0x36cfda['as'],'attributes':_0x36cfda['attributes'],'include':_0x36cfda[_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x36cfda[_0x3bb5('0x1a')],function(_0xc1c149){return{'model':db[_0xc1c149['model']],'as':_0xc1c149['as'],'attributes':_0xc1c149['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bb5('0xc')](function(_0x4e8c65){logger[_0x3bb5('0xd')](_0x3bb5('0x14'),_0x48bc25);logger[_0x3bb5('0x1d')]('GetMailServerIn',_0x48bc25,JSON['stringify'](_0x4e8c65));_0x1109d0(_0x4e8c65);})[_0x3bb5('0x1e')](function(_0x39f1ad){logger[_0x3bb5('0x10')](_0x3bb5('0x14'),_0x39f1ad[_0x3bb5('0x11')],_0x48bc25);_0x289177(_0x13cb3a[_0x3bb5('0x10')](0x1f4,_0x39f1ad[_0x3bb5('0x11')]));});});}; \ No newline at end of file +var _0x0eaa=['limit','include','model','attributes','map','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x5b756c,_0x3621b6){_0x5b756c=_0x5b756c-0x0;var _0x2e0952=_0x0eaa[_0x5b756c];return _0x2e0952;};'use strict';var _=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0ea('0x2'));var fs=require('fs');var Redis=require(_0xa0ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ea('0x4'));var logger=require(_0xa0ea('0x5'))(_0xa0ea('0x6'));var config=require(_0xa0ea('0x7'));var jayson=require(_0xa0ea('0x8'));var client=jayson['client'][_0xa0ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521881,_0x4b8856,_0x361178){return new BPromise(function(_0x8632a1,_0x5b2adc){return client['request'](_0x521881,_0x361178)[_0xa0ea('0xa')](function(_0x2746f2){logger[_0xa0ea('0xb')](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));logger['debug'](_0xa0ea('0xe'),_0x4b8856,_0xa0ea('0xd'),JSON[_0xa0ea('0xf')](_0x2746f2));if(_0x2746f2[_0xa0ea('0x10')]){if(_0x2746f2['error'][_0xa0ea('0x11')]===0x1f4){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x5b2adc(_0x2746f2['error'][_0xa0ea('0x12')]);}logger[_0xa0ea('0x10')]('MailServerIn,\x20%s,\x20%s',_0x4b8856,_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);return _0x8632a1(_0x2746f2[_0xa0ea('0x10')][_0xa0ea('0x12')]);}else{logger['info'](_0xa0ea('0xc'),_0x4b8856,_0xa0ea('0xd'));_0x8632a1(_0x2746f2[_0xa0ea('0x13')][_0xa0ea('0x12')]);}})[_0xa0ea('0x14')](function(_0x34b94c){logger[_0xa0ea('0x10')](_0xa0ea('0xc'),_0x4b8856,_0x34b94c);_0x5b2adc(_0x34b94c);});});}exports[_0xa0ea('0x15')]=function(_0x405f7f){var _0x581f59=this;return new Promise(function(_0x4ca082,_0xe116e2){return db[_0xa0ea('0x16')][_0xa0ea('0x17')]({'raw':_0x405f7f[_0xa0ea('0x18')]?_0x405f7f[_0xa0ea('0x18')][_0xa0ea('0x19')]===undefined?!![]:![]:!![],'where':_0x405f7f[_0xa0ea('0x18')]?_0x405f7f['options'][_0xa0ea('0x1a')]||null:null,'attributes':_0x405f7f[_0xa0ea('0x18')]?_0x405f7f[_0xa0ea('0x18')]['attributes']||null:null,'limit':_0x405f7f[_0xa0ea('0x18')]?_0x405f7f[_0xa0ea('0x18')][_0xa0ea('0x1b')]||null:null,'include':_0x405f7f[_0xa0ea('0x18')]?_0x405f7f[_0xa0ea('0x18')][_0xa0ea('0x1c')]?_['map'](_0x405f7f[_0xa0ea('0x18')]['include'],function(_0x4d494e){return{'model':db[_0x4d494e[_0xa0ea('0x1d')]],'as':_0x4d494e['as'],'attributes':_0x4d494e[_0xa0ea('0x1e')],'include':_0x4d494e[_0xa0ea('0x1c')]?_['map'](_0x4d494e[_0xa0ea('0x1c')],function(_0x5d2d73){return{'model':db[_0x5d2d73[_0xa0ea('0x1d')]],'as':_0x5d2d73['as'],'attributes':_0x5d2d73[_0xa0ea('0x1e')],'include':_0x5d2d73[_0xa0ea('0x1c')]?_[_0xa0ea('0x1f')](_0x5d2d73[_0xa0ea('0x1c')],function(_0x3b4e62){return{'model':db[_0x3b4e62[_0xa0ea('0x1d')]],'as':_0x3b4e62['as'],'attributes':_0x3b4e62[_0xa0ea('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa0ea('0xa')](function(_0x208c8){logger['info'](_0xa0ea('0x15'),_0x405f7f);logger['debug'](_0xa0ea('0x15'),_0x405f7f,JSON[_0xa0ea('0xf')](_0x208c8));_0x4ca082(_0x208c8);})[_0xa0ea('0x14')](function(_0x705022){logger[_0xa0ea('0x10')](_0xa0ea('0x15'),_0x705022['message'],_0x405f7f);_0xe116e2(_0x581f59[_0xa0ea('0x10')](0x1f4,_0x705022['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ead759a..7500025 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x36e77d,_0x1df135){_0x36e77d=_0x36e77d-0x0;var _0x4d3f06=_0x7a54[_0x36e77d];return _0x4d3f06;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7a54,0x106));var _0x47a5=function(_0x420540,_0x15a734){_0x420540=_0x420540-0x0;var _0x51dbd1=_0x7a54[_0x420540];return _0x51dbd1;};'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 97d6da2..066c19f 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 _0x0713=['BOOLEAN','STRING','INTEGER'];(function(_0x519100,_0x329efd){var _0x5e0f0c=function(_0x18bed6){while(--_0x18bed6){_0x519100['push'](_0x519100['shift']());}};_0x5e0f0c(++_0x329efd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3071('0x0')]},'host':{'type':Sequelize[_0x3071('0x0')]},'user':{'type':Sequelize[_0x3071('0x0')]},'pass':{'type':Sequelize[_0x3071('0x0')]},'port':{'type':Sequelize[_0x3071('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3071('0x0')]},'authentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xeffd=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x1328bf,_0x1cc5d0){var _0x1a6f27=function(_0x36992f){while(--_0x36992f){_0x1328bf['push'](_0x1328bf['shift']());}};_0x1a6f27(++_0x1cc5d0);}(_0xeffd,0x6b));var _0xdeff=function(_0x190f12,_0x32e3ca){_0x190f12=_0x190f12-0x0;var _0x1ebfd9=_0xeffd[_0x190f12];return _0x1ebfd9;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'description':{'type':Sequelize[_0xdeff('0x1')]},'host':{'type':Sequelize[_0xdeff('0x1')]},'user':{'type':Sequelize[_0xdeff('0x1')]},'pass':{'type':Sequelize[_0xdeff('0x1')]},'port':{'type':Sequelize[_0xdeff('0x2')]},'secure':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xdeff('0x1')]},'authentication':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xdeff('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 3790dc6..b9d390f 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 _0x98e1=['status','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','options','includeAll','MailServerOut','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x37a2b0,_0xce4597){var _0x18d27e=function(_0x830319){while(--_0x830319){_0x37a2b0['push'](_0x37a2b0['shift']());}};_0x18d27e(++_0xce4597);}(_0x98e1,0x78));var _0x198e=function(_0x261ea0,_0x5b4d2a){_0x261ea0=_0x261ea0-0x0;var _0x414ad6=_0x98e1[_0x261ea0];return _0x414ad6;};'use strict';var emlformat=require(_0x198e('0x0'));var rimraf=require(_0x198e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x198e('0x2'));var rp=require(_0x198e('0x3'));var moment=require('moment');var BPromise=require(_0x198e('0x4'));var Mustache=require(_0x198e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x198e('0x6'));var csv=require(_0x198e('0x7'));var ejs=require(_0x198e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x198e('0x9'));var squel=require(_0x198e('0xa'));var crypto=require(_0x198e('0xb'));var jsforce=require(_0x198e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x198e('0x7'));var querystring=require(_0x198e('0xd'));var Papa=require(_0x198e('0xe'));var Redis=require(_0x198e('0xf'));var authService=require(_0x198e('0x10'));var qs=require(_0x198e('0x11'));var as=require(_0x198e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x198e('0x13'))(_0x198e('0x14'));var utils=require(_0x198e('0x15'));var config=require(_0x198e('0x16'));var licenseUtil=require(_0x198e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b794,_0x168123){_0x168123=_0x168123||0xcc;return function(_0x390b0b){if(_0x390b0b){return _0x38b794[_0x198e('0x18')](_0x168123);}return _0x38b794['status'](_0x168123)[_0x198e('0x19')]();};}function respondWithResult(_0x58d45e,_0x191cc4){_0x191cc4=_0x191cc4||0xc8;return function(_0x29f0d2){if(_0x29f0d2){return _0x58d45e[_0x198e('0x1a')](_0x191cc4)[_0x198e('0x1b')](_0x29f0d2);}};}function respondWithFilteredResult(_0x308335,_0x2ec84d){return function(_0x15dcd1){if(_0x15dcd1){var _0x586a1d=typeof _0x2ec84d[_0x198e('0x1c')]==='undefined'&&typeof _0x2ec84d[_0x198e('0x1d')]==='undefined';var _0xe8eca0=_0x15dcd1[_0x198e('0x1e')];var _0x4fd6d6=_0x586a1d?0x0:_0x2ec84d[_0x198e('0x1c')];var _0x2f38d4=_0x586a1d?_0x15dcd1[_0x198e('0x1e')]:_0x2ec84d[_0x198e('0x1c')]+_0x2ec84d[_0x198e('0x1d')];var _0x323e6d;if(_0x2f38d4>=_0xe8eca0){_0x2f38d4=_0xe8eca0;_0x323e6d=0xc8;}else{_0x323e6d=0xce;}_0x308335[_0x198e('0x1a')](_0x323e6d);return _0x308335['set'](_0x198e('0x1f'),_0x4fd6d6+'-'+_0x2f38d4+'/'+_0xe8eca0)[_0x198e('0x1b')](_0x15dcd1);}return null;};}function patchUpdates(_0x1fb0c3){return function(_0x20b12b){try{jsonpatch['apply'](_0x20b12b,_0x1fb0c3,!![]);}catch(_0x4c9733){return BPromise[_0x198e('0x20')](_0x4c9733);}return _0x20b12b[_0x198e('0x21')]();};}function saveUpdates(_0x51b727,_0x49be0e){return function(_0x3b758a){if(_0x3b758a){return _0x3b758a[_0x198e('0x22')](_0x51b727)[_0x198e('0x23')](function(_0x432947){return _0x432947;});}return null;};}function removeEntity(_0x32eb49,_0x3cc917){return function(_0x52b613){if(_0x52b613){return _0x52b613[_0x198e('0x24')]()[_0x198e('0x23')](function(){_0x32eb49[_0x198e('0x1a')](0xcc)[_0x198e('0x19')]();});}};}function handleEntityNotFound(_0x452864,_0x2e4f76){return function(_0x2fb15d){if(!_0x2fb15d){_0x452864[_0x198e('0x18')](0x194);}return _0x2fb15d;};}function handleError(_0x84b90,_0xc6b87e){_0xc6b87e=_0xc6b87e||0x1f4;return function(_0x4728f7){logger[_0x198e('0x25')](_0x4728f7[_0x198e('0x26')]);if(_0x4728f7[_0x198e('0x27')]){delete _0x4728f7[_0x198e('0x27')];}_0x84b90['status'](_0xc6b87e)[_0x198e('0x28')](_0x4728f7);};}exports[_0x198e('0x29')]=function(_0x30bc8,_0x41b1a9){var _0x5d4d08={},_0x3f8e7={},_0x2e3e92={'count':0x0,'rows':[]};var _0x5c7c4a=_[_0x198e('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x1473ce){return{'name':_0x1473ce[_0x198e('0x2b')],'type':_0x1473ce['type'][_0x198e('0x2c')]};});_0x3f8e7[_0x198e('0x2d')]=_['map'](_0x5c7c4a,_0x198e('0x27'));_0x3f8e7[_0x198e('0x2e')]=_['keys'](_0x30bc8[_0x198e('0x2e')]);_0x3f8e7[_0x198e('0x2f')]=_[_0x198e('0x30')](_0x3f8e7['model'],_0x3f8e7[_0x198e('0x2e')]);_0x5d4d08['attributes']=_[_0x198e('0x30')](_0x3f8e7[_0x198e('0x2d')],qs[_0x198e('0x31')](_0x30bc8['query'][_0x198e('0x31')]));_0x5d4d08[_0x198e('0x32')]=_0x5d4d08[_0x198e('0x32')]['length']?_0x5d4d08['attributes']:_0x3f8e7[_0x198e('0x2d')];if(!_0x30bc8['query'][_0x198e('0x33')](_0x198e('0x34'))){_0x5d4d08['limit']=qs[_0x198e('0x1d')](_0x30bc8['query'][_0x198e('0x1d')]);_0x5d4d08[_0x198e('0x1c')]=qs[_0x198e('0x1c')](_0x30bc8['query'][_0x198e('0x1c')]);}_0x5d4d08['order']=qs[_0x198e('0x35')](_0x30bc8[_0x198e('0x2e')][_0x198e('0x35')]);_0x5d4d08['where']=qs['filters'](_[_0x198e('0x36')](_0x30bc8['query'],_0x3f8e7[_0x198e('0x2f')]),_0x5c7c4a);if(_0x30bc8['query']['filter']){_0x5d4d08[_0x198e('0x37')]=_[_0x198e('0x38')](_0x5d4d08['where'],{'$or':_[_0x198e('0x2a')](_0x5c7c4a,function(_0x1c29dd){if(_0x1c29dd[_0x198e('0x39')]!=='VIRTUAL'){var _0x4ddc75={};_0x4ddc75[_0x1c29dd[_0x198e('0x27')]]={'$like':'%'+_0x30bc8[_0x198e('0x2e')][_0x198e('0x3a')]+'%'};return _0x4ddc75;}})});}_0x5d4d08=_[_0x198e('0x38')]({},_0x5d4d08,_0x30bc8[_0x198e('0x3b')]);var _0x1349d3={'where':_0x5d4d08['where']};return db['MailServerOut']['count'](_0x1349d3)[_0x198e('0x23')](function(_0x5371e8){_0x2e3e92[_0x198e('0x1e')]=_0x5371e8;if(_0x30bc8[_0x198e('0x2e')][_0x198e('0x3c')]){_0x5d4d08['include']=[{'all':!![]}];}return db[_0x198e('0x3d')]['findAll'](_0x5d4d08);})['then'](function(_0x155443){_0x2e3e92[_0x198e('0x3e')]=_0x155443;return _0x2e3e92;})[_0x198e('0x23')](respondWithFilteredResult(_0x41b1a9,_0x5d4d08))[_0x198e('0x3f')](handleError(_0x41b1a9,null));};exports[_0x198e('0x40')]=function(_0x4c6c25,_0x323bab){var _0xbe51fa={'raw':!![],'where':{'id':_0x4c6c25[_0x198e('0x41')]['id']}},_0xeb3803={};_0xeb3803[_0x198e('0x2d')]=_[_0x198e('0x42')](db[_0x198e('0x3d')][_0x198e('0x43')]);_0xeb3803[_0x198e('0x2e')]=_[_0x198e('0x42')](_0x4c6c25[_0x198e('0x2e')]);_0xeb3803[_0x198e('0x2f')]=_[_0x198e('0x30')](_0xeb3803[_0x198e('0x2d')],_0xeb3803['query']);_0xbe51fa['attributes']=_[_0x198e('0x30')](_0xeb3803[_0x198e('0x2d')],qs[_0x198e('0x31')](_0x4c6c25[_0x198e('0x2e')]['fields']));_0xbe51fa[_0x198e('0x32')]=_0xbe51fa['attributes'][_0x198e('0x44')]?_0xbe51fa['attributes']:_0xeb3803[_0x198e('0x2d')];if(_0x4c6c25[_0x198e('0x2e')][_0x198e('0x3c')]){_0xbe51fa[_0x198e('0x45')]=[{'all':!![]}];}_0xbe51fa=_[_0x198e('0x38')]({},_0xbe51fa,_0x4c6c25['options']);return db[_0x198e('0x3d')][_0x198e('0x46')](_0xbe51fa)['then'](handleEntityNotFound(_0x323bab,null))[_0x198e('0x23')](respondWithResult(_0x323bab,null))[_0x198e('0x3f')](handleError(_0x323bab,null));};exports[_0x198e('0x47')]=function(_0x2ef36c,_0x2537e2){return db[_0x198e('0x3d')][_0x198e('0x47')](_0x2ef36c['body'],{})[_0x198e('0x23')](respondWithResult(_0x2537e2,0xc9))[_0x198e('0x3f')](handleError(_0x2537e2,null));};exports[_0x198e('0x22')]=function(_0x2827f5,_0x2843f3){if(_0x2827f5[_0x198e('0x48')]['id']){delete _0x2827f5[_0x198e('0x48')]['id'];}return db[_0x198e('0x3d')][_0x198e('0x46')]({'where':{'id':_0x2827f5['params']['id']}})[_0x198e('0x23')](handleEntityNotFound(_0x2843f3,null))[_0x198e('0x23')](saveUpdates(_0x2827f5[_0x198e('0x48')],null))[_0x198e('0x23')](respondWithResult(_0x2843f3,null))[_0x198e('0x3f')](handleError(_0x2843f3,null));};exports[_0x198e('0x24')]=function(_0x8d1b6f,_0x2090bf){return db[_0x198e('0x3d')][_0x198e('0x46')]({'where':{'id':_0x8d1b6f['params']['id']}})['then'](handleEntityNotFound(_0x2090bf,null))[_0x198e('0x23')](removeEntity(_0x2090bf,null))[_0x198e('0x3f')](handleError(_0x2090bf,null));}; \ No newline at end of file +var _0xb3f2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','MailServerOut','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0xb3f2,0x116));var _0x2b3f=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb3f2[_0x36ed48];return _0x51c63a;};'use strict';var emlformat=require(_0x2b3f('0x0'));var rimraf=require(_0x2b3f('0x1'));var zipdir=require(_0x2b3f('0x2'));var jsonpatch=require(_0x2b3f('0x3'));var rp=require(_0x2b3f('0x4'));var moment=require(_0x2b3f('0x5'));var BPromise=require(_0x2b3f('0x6'));var Mustache=require(_0x2b3f('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2b3f('0x8'));var ejs=require(_0x2b3f('0x9'));var fs=require('fs');var fs_extra=require(_0x2b3f('0xa'));var _=require(_0x2b3f('0xb'));var squel=require('squel');var crypto=require(_0x2b3f('0xc'));var jsforce=require(_0x2b3f('0xd'));var deskjs=require(_0x2b3f('0xe'));var toCsv=require(_0x2b3f('0x8'));var querystring=require(_0x2b3f('0xf'));var Papa=require(_0x2b3f('0x10'));var Redis=require(_0x2b3f('0x11'));var authService=require(_0x2b3f('0x12'));var qs=require(_0x2b3f('0x13'));var as=require(_0x2b3f('0x14'));var hardwareService=require(_0x2b3f('0x15'));var logger=require(_0x2b3f('0x16'))(_0x2b3f('0x17'));var utils=require('../../config/utils');var config=require(_0x2b3f('0x18'));var licenseUtil=require(_0x2b3f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xacc982,_0x60de03){_0x60de03=_0x60de03||0xcc;return function(_0x28b753){if(_0x28b753){return _0xacc982[_0x2b3f('0x1a')](_0x60de03);}return _0xacc982['status'](_0x60de03)['end']();};}function respondWithResult(_0x45be12,_0x287d73){_0x287d73=_0x287d73||0xc8;return function(_0x37121f){if(_0x37121f){return _0x45be12[_0x2b3f('0x1b')](_0x287d73)[_0x2b3f('0x1c')](_0x37121f);}};}function respondWithFilteredResult(_0x5283da,_0x1c3573){return function(_0x5d5393){if(_0x5d5393){var _0x250634=typeof _0x1c3573[_0x2b3f('0x1d')]==='undefined'&&typeof _0x1c3573[_0x2b3f('0x1e')]==='undefined';var _0x4e6966=_0x5d5393[_0x2b3f('0x1f')];var _0x121e55=_0x250634?0x0:_0x1c3573[_0x2b3f('0x1d')];var _0x3378f7=_0x250634?_0x5d5393[_0x2b3f('0x1f')]:_0x1c3573[_0x2b3f('0x1d')]+_0x1c3573[_0x2b3f('0x1e')];var _0x67bb04;if(_0x3378f7>=_0x4e6966){_0x3378f7=_0x4e6966;_0x67bb04=0xc8;}else{_0x67bb04=0xce;}_0x5283da[_0x2b3f('0x1b')](_0x67bb04);return _0x5283da[_0x2b3f('0x20')](_0x2b3f('0x21'),_0x121e55+'-'+_0x3378f7+'/'+_0x4e6966)[_0x2b3f('0x1c')](_0x5d5393);}return null;};}function patchUpdates(_0x5f15df){return function(_0x3612d5){try{jsonpatch[_0x2b3f('0x22')](_0x3612d5,_0x5f15df,!![]);}catch(_0x3cc913){return BPromise[_0x2b3f('0x23')](_0x3cc913);}return _0x3612d5[_0x2b3f('0x24')]();};}function saveUpdates(_0x382835,_0x509477){return function(_0x27d515){if(_0x27d515){return _0x27d515[_0x2b3f('0x25')](_0x382835)[_0x2b3f('0x26')](function(_0x2d3a0e){return _0x2d3a0e;});}return null;};}function removeEntity(_0x325ab9,_0x325915){return function(_0x16b841){if(_0x16b841){return _0x16b841[_0x2b3f('0x27')]()[_0x2b3f('0x26')](function(){_0x325ab9[_0x2b3f('0x1b')](0xcc)[_0x2b3f('0x28')]();});}};}function handleEntityNotFound(_0x1dca3f,_0x32c1d1){return function(_0x5befb9){if(!_0x5befb9){_0x1dca3f[_0x2b3f('0x1a')](0x194);}return _0x5befb9;};}function handleError(_0x35c7cc,_0xc86987){_0xc86987=_0xc86987||0x1f4;return function(_0x286237){logger['error'](_0x286237['stack']);if(_0x286237[_0x2b3f('0x29')]){delete _0x286237[_0x2b3f('0x29')];}_0x35c7cc['status'](_0xc86987)[_0x2b3f('0x2a')](_0x286237);};}exports[_0x2b3f('0x2b')]=function(_0x5c9e6f,_0x29ea3d){var _0x36b4c2={},_0x176d97={},_0x4626e5={'count':0x0,'rows':[]};var _0x4bd8a8=_[_0x2b3f('0x2c')](db[_0x2b3f('0x2d')][_0x2b3f('0x2e')],function(_0x14b878){return{'name':_0x14b878['fieldName'],'type':_0x14b878[_0x2b3f('0x2f')][_0x2b3f('0x30')]};});_0x176d97[_0x2b3f('0x31')]=_[_0x2b3f('0x2c')](_0x4bd8a8,_0x2b3f('0x29'));_0x176d97['query']=_[_0x2b3f('0x32')](_0x5c9e6f[_0x2b3f('0x33')]);_0x176d97[_0x2b3f('0x34')]=_[_0x2b3f('0x35')](_0x176d97['model'],_0x176d97['query']);_0x36b4c2[_0x2b3f('0x36')]=_[_0x2b3f('0x35')](_0x176d97['model'],qs[_0x2b3f('0x37')](_0x5c9e6f[_0x2b3f('0x33')]['fields']));_0x36b4c2[_0x2b3f('0x36')]=_0x36b4c2[_0x2b3f('0x36')][_0x2b3f('0x38')]?_0x36b4c2[_0x2b3f('0x36')]:_0x176d97[_0x2b3f('0x31')];if(!_0x5c9e6f[_0x2b3f('0x33')]['hasOwnProperty'](_0x2b3f('0x39'))){_0x36b4c2[_0x2b3f('0x1e')]=qs[_0x2b3f('0x1e')](_0x5c9e6f[_0x2b3f('0x33')]['limit']);_0x36b4c2[_0x2b3f('0x1d')]=qs['offset'](_0x5c9e6f[_0x2b3f('0x33')][_0x2b3f('0x1d')]);}_0x36b4c2['order']=qs['sort'](_0x5c9e6f['query'][_0x2b3f('0x3a')]);_0x36b4c2[_0x2b3f('0x3b')]=qs[_0x2b3f('0x34')](_[_0x2b3f('0x3c')](_0x5c9e6f[_0x2b3f('0x33')],_0x176d97[_0x2b3f('0x34')]),_0x4bd8a8);if(_0x5c9e6f['query']['filter']){_0x36b4c2[_0x2b3f('0x3b')]=_[_0x2b3f('0x3d')](_0x36b4c2[_0x2b3f('0x3b')],{'$or':_[_0x2b3f('0x2c')](_0x4bd8a8,function(_0x4d64ce){if(_0x4d64ce[_0x2b3f('0x2f')]!==_0x2b3f('0x3e')){var _0x44c4c5={};_0x44c4c5[_0x4d64ce['name']]={'$like':'%'+_0x5c9e6f[_0x2b3f('0x33')]['filter']+'%'};return _0x44c4c5;}})});}_0x36b4c2=_[_0x2b3f('0x3d')]({},_0x36b4c2,_0x5c9e6f[_0x2b3f('0x3f')]);var _0xdc456b={'where':_0x36b4c2[_0x2b3f('0x3b')]};return db['MailServerOut']['count'](_0xdc456b)[_0x2b3f('0x26')](function(_0x28586e){_0x4626e5[_0x2b3f('0x1f')]=_0x28586e;if(_0x5c9e6f[_0x2b3f('0x33')][_0x2b3f('0x40')]){_0x36b4c2['include']=[{'all':!![]}];}return db[_0x2b3f('0x2d')][_0x2b3f('0x41')](_0x36b4c2);})[_0x2b3f('0x26')](function(_0x45e1a5){_0x4626e5[_0x2b3f('0x42')]=_0x45e1a5;return _0x4626e5;})[_0x2b3f('0x26')](respondWithFilteredResult(_0x29ea3d,_0x36b4c2))[_0x2b3f('0x43')](handleError(_0x29ea3d,null));};exports[_0x2b3f('0x44')]=function(_0xb9b1c4,_0x1aba07){var _0x4eaa3c={'raw':!![],'where':{'id':_0xb9b1c4[_0x2b3f('0x45')]['id']}},_0x2a60b4={};_0x2a60b4['model']=_['keys'](db[_0x2b3f('0x2d')][_0x2b3f('0x2e')]);_0x2a60b4[_0x2b3f('0x33')]=_[_0x2b3f('0x32')](_0xb9b1c4[_0x2b3f('0x33')]);_0x2a60b4[_0x2b3f('0x34')]=_['intersection'](_0x2a60b4['model'],_0x2a60b4[_0x2b3f('0x33')]);_0x4eaa3c['attributes']=_[_0x2b3f('0x35')](_0x2a60b4[_0x2b3f('0x31')],qs[_0x2b3f('0x37')](_0xb9b1c4[_0x2b3f('0x33')][_0x2b3f('0x37')]));_0x4eaa3c['attributes']=_0x4eaa3c[_0x2b3f('0x36')][_0x2b3f('0x38')]?_0x4eaa3c[_0x2b3f('0x36')]:_0x2a60b4[_0x2b3f('0x31')];if(_0xb9b1c4[_0x2b3f('0x33')][_0x2b3f('0x40')]){_0x4eaa3c[_0x2b3f('0x46')]=[{'all':!![]}];}_0x4eaa3c=_[_0x2b3f('0x3d')]({},_0x4eaa3c,_0xb9b1c4['options']);return db[_0x2b3f('0x2d')][_0x2b3f('0x47')](_0x4eaa3c)['then'](handleEntityNotFound(_0x1aba07,null))[_0x2b3f('0x26')](respondWithResult(_0x1aba07,null))['catch'](handleError(_0x1aba07,null));};exports[_0x2b3f('0x48')]=function(_0x44da99,_0x4272d9){return db[_0x2b3f('0x2d')][_0x2b3f('0x48')](_0x44da99[_0x2b3f('0x49')],{})[_0x2b3f('0x26')](respondWithResult(_0x4272d9,0xc9))['catch'](handleError(_0x4272d9,null));};exports[_0x2b3f('0x25')]=function(_0x5311eb,_0x536a51){if(_0x5311eb[_0x2b3f('0x49')]['id']){delete _0x5311eb[_0x2b3f('0x49')]['id'];}return db[_0x2b3f('0x2d')]['find']({'where':{'id':_0x5311eb[_0x2b3f('0x45')]['id']}})['then'](handleEntityNotFound(_0x536a51,null))[_0x2b3f('0x26')](saveUpdates(_0x5311eb['body'],null))[_0x2b3f('0x26')](respondWithResult(_0x536a51,null))['catch'](handleError(_0x536a51,null));};exports['destroy']=function(_0x5a6a3c,_0x328175){return db['MailServerOut']['find']({'where':{'id':_0x5a6a3c[_0x2b3f('0x45')]['id']}})[_0x2b3f('0x26')](handleEntityNotFound(_0x328175,null))[_0x2b3f('0x26')](removeEntity(_0x328175,null))[_0x2b3f('0x43')](handleError(_0x328175,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index cf732f2..d779e43 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 _0x343e=['MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x343e,0x18e));var _0xe343=function(_0x4fa3e1,_0x49d70d){_0x4fa3e1=_0x4fa3e1-0x0;var _0x558250=_0x343e[_0x4fa3e1];return _0x558250;};'use strict';var _=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var logger=require('../../config/logger')(_0xe343('0x2'));var moment=require(_0xe343('0x3'));var BPromise=require(_0xe343('0x4'));var rp=require(_0xe343('0x5'));var fs=require('fs');var path=require(_0xe343('0x6'));var rimraf=require(_0xe343('0x7'));var config=require('../../config/environment');var attributes=require(_0xe343('0x8'));module[_0xe343('0x9')]=function(_0x47e1e8,_0xafd9f5){return _0x47e1e8['define'](_0xe343('0xa'),attributes,{'tableName':_0xe343('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1dc=['MailServerOut','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x5618d6,_0x41e5ed){var _0x50e819=function(_0x52875e){while(--_0x52875e){_0x5618d6['push'](_0x5618d6['shift']());}};_0x50e819(++_0x41e5ed);}(_0xc1dc,0x155));var _0xcc1d=function(_0x4f55ca,_0x57b6a1){_0x4f55ca=_0x4f55ca-0x0;var _0x389d66=_0xc1dc[_0x4f55ca];return _0x389d66;};'use strict';var _=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var logger=require(_0xcc1d('0x2'))(_0xcc1d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc1d('0x5'));var config=require(_0xcc1d('0x6'));var attributes=require(_0xcc1d('0x7'));module[_0xcc1d('0x8')]=function(_0xf3fbe,_0x3ce555){return _0xf3fbe['define'](_0xcc1d('0x9'),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 bdc0f3b..7b78332 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2405d1,_0x74a236){var _0x128cbc=function(_0x4a046a){while(--_0x4a046a){_0x2405d1['push'](_0x2405d1['shift']());}};_0x128cbc(++_0x74a236);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1608cc,_0x50aae9){var _0x150b3e=function(_0x35ffbb){while(--_0x35ffbb){_0x1608cc['push'](_0x1608cc['shift']());}};_0x150b3e(++_0x50aae9);}(_0xdb28,0x106));var _0x8db2=function(_0x27a0de,_0x57da30){_0x27a0de=_0x27a0de-0x0;var _0x1499be=_0xdb28[_0x27a0de];return _0x1499be;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b59da05..1e63c58 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 _0x1da7=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x290e87,_0x245e4e){var _0x307d6d=function(_0x4a4338){while(--_0x4a4338){_0x290e87['push'](_0x290e87['shift']());}};_0x307d6d(++_0x245e4e);}(_0x1da7,0x1d1));var _0x71da=function(_0x52f297,_0x387093){_0x52f297=_0x52f297-0x0;var _0x2ed2d5=_0x1da7[_0x52f297];return _0x2ed2d5;};'use strict';var multer=require(_0x71da('0x0'));var util=require(_0x71da('0x1'));var path=require(_0x71da('0x2'));var timeout=require(_0x71da('0x3'));var express=require(_0x71da('0x4'));var router=express[_0x71da('0x5')]();var fs_extra=require(_0x71da('0x6'));var auth=require(_0x71da('0x7'));var interaction=require(_0x71da('0x8'));var config=require('../../config/environment');var controller=require(_0x71da('0x9'));router[_0x71da('0xa')]('/',auth[_0x71da('0xb')](),controller['index']);router[_0x71da('0xa')](_0x71da('0xc'),auth[_0x71da('0xb')](),controller['describe']);router[_0x71da('0xa')](_0x71da('0xd'),auth['isAuthenticated'](),controller[_0x71da('0xe')]);router[_0x71da('0xf')]('/',auth['isAuthenticated'](),controller[_0x71da('0x10')]);router[_0x71da('0x11')](_0x71da('0xd'),auth[_0x71da('0xb')](),controller[_0x71da('0x12')]);router['delete']('/:id',auth[_0x71da('0xb')](),controller['destroy']);module[_0x71da('0x13')]=router; \ No newline at end of file +var _0x2810=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','post','create','update','delete','/:id','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x2810,0xb8));var _0x0281=function(_0x214747,_0x13fc3d){_0x214747=_0x214747-0x0;var _0x4dfcef=_0x2810[_0x214747];return _0x4dfcef;};'use strict';var multer=require(_0x0281('0x0'));var util=require(_0x0281('0x1'));var path=require(_0x0281('0x2'));var timeout=require('connect-timeout');var express=require(_0x0281('0x3'));var router=express['Router']();var fs_extra=require(_0x0281('0x4'));var auth=require(_0x0281('0x5'));var interaction=require(_0x0281('0x6'));var config=require(_0x0281('0x7'));var controller=require(_0x0281('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0281('0x9')]);router[_0x0281('0xa')](_0x0281('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0281('0xa')]('/:id',auth[_0x0281('0xc')](),controller['show']);router[_0x0281('0xd')]('/',auth[_0x0281('0xc')](),controller[_0x0281('0xe')]);router['put']('/:id',auth[_0x0281('0xc')](),controller[_0x0281('0xf')]);router[_0x0281('0x10')](_0x0281('0x11'),auth[_0x0281('0xc')](),controller['destroy']);module[_0x0281('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 75c9e08..130c170 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 _0xeda8=['sequelize','exports','name','STRING'];(function(_0x4d40e3,_0x426460){var _0x4c9f04=function(_0x546be0){while(--_0x546be0){_0x4d40e3['push'](_0x4d40e3['shift']());}};_0x4c9f04(++_0x426460);}(_0xeda8,0x104));var _0x8eda=function(_0x367d3f,_0x245c21){_0x367d3f=_0x367d3f-0x0;var _0x4bec1e=_0xeda8[_0x367d3f];return _0x4bec1e;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eda('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file +var _0x06f4=['name','STRING','sequelize','exports'];(function(_0x20f5ff,_0x519f7d){var _0x5ce199=function(_0x2be018){while(--_0x2be018){_0x20f5ff['push'](_0x20f5ff['shift']());}};_0x5ce199(++_0x519f7d);}(_0x06f4,0x136));var _0x406f=function(_0xb0cb31,_0x23d6a2){_0xb0cb31=_0xb0cb31-0x0;var _0x5eeb4d=_0x06f4[_0xb0cb31];return _0x5eeb4d;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x406f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1331f8b..d7d1bff 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 _0x378b=['count','offset','set','Content-Range','apply','reject','update','then','status','end','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x378b,0x117));var _0xb378=function(_0x165787,_0x2e893d){_0x165787=_0x165787-0x0;var _0x3058bc=_0x378b[_0x165787];return _0x3058bc;};'use strict';var emlformat=require(_0xb378('0x0'));var rimraf=require(_0xb378('0x1'));var zipdir=require(_0xb378('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb378('0x3'));var BPromise=require(_0xb378('0x4'));var Mustache=require(_0xb378('0x5'));var util=require(_0xb378('0x6'));var path=require(_0xb378('0x7'));var sox=require(_0xb378('0x8'));var csv=require(_0xb378('0x9'));var ejs=require(_0xb378('0xa'));var fs=require('fs');var fs_extra=require(_0xb378('0xb'));var _=require(_0xb378('0xc'));var squel=require(_0xb378('0xd'));var crypto=require(_0xb378('0xe'));var jsforce=require(_0xb378('0xf'));var deskjs=require(_0xb378('0x10'));var toCsv=require(_0xb378('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb378('0x11'));var authService=require(_0xb378('0x12'));var qs=require(_0xb378('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb378('0x14'));var logger=require('../../config/logger')(_0xb378('0x15'));var utils=require('../../config/utils');var config=require(_0xb378('0x16'));var licenseUtil=require(_0xb378('0x17'));var db=require(_0xb378('0x18'))['db'];function respondWithStatusCode(_0x4e4d01,_0xb01963){_0xb01963=_0xb01963||0xcc;return function(_0x481324){if(_0x481324){return _0x4e4d01[_0xb378('0x19')](_0xb01963);}return _0x4e4d01['status'](_0xb01963)['end']();};}function respondWithResult(_0x41a52e,_0x18dfb4){_0x18dfb4=_0x18dfb4||0xc8;return function(_0x1c5dde){if(_0x1c5dde){return _0x41a52e['status'](_0x18dfb4)[_0xb378('0x1a')](_0x1c5dde);}};}function respondWithFilteredResult(_0x2108b0,_0x51783c){return function(_0x796075){if(_0x796075){var _0x4e5a62=typeof _0x51783c['offset']===_0xb378('0x1b')&&typeof _0x51783c[_0xb378('0x1c')]===_0xb378('0x1b');var _0x15b479=_0x796075[_0xb378('0x1d')];var _0x3049f8=_0x4e5a62?0x0:_0x51783c[_0xb378('0x1e')];var _0x380b20=_0x4e5a62?_0x796075[_0xb378('0x1d')]:_0x51783c[_0xb378('0x1e')]+_0x51783c[_0xb378('0x1c')];var _0x44a266;if(_0x380b20>=_0x15b479){_0x380b20=_0x15b479;_0x44a266=0xc8;}else{_0x44a266=0xce;}_0x2108b0['status'](_0x44a266);return _0x2108b0[_0xb378('0x1f')](_0xb378('0x20'),_0x3049f8+'-'+_0x380b20+'/'+_0x15b479)[_0xb378('0x1a')](_0x796075);}return null;};}function patchUpdates(_0xeae546){return function(_0x599c99){try{jsonpatch[_0xb378('0x21')](_0x599c99,_0xeae546,!![]);}catch(_0x7fa992){return BPromise[_0xb378('0x22')](_0x7fa992);}return _0x599c99['save']();};}function saveUpdates(_0x59b5a5,_0x1196ab){return function(_0x4e7b00){if(_0x4e7b00){return _0x4e7b00[_0xb378('0x23')](_0x59b5a5)[_0xb378('0x24')](function(_0x305715){return _0x305715;});}return null;};}function removeEntity(_0x5a6cb4,_0x36eaec){return function(_0x3b27e7){if(_0x3b27e7){return _0x3b27e7['destroy']()['then'](function(){_0x5a6cb4[_0xb378('0x25')](0xcc)[_0xb378('0x26')]();});}};}function handleEntityNotFound(_0x518fb3,_0x11f468){return function(_0x60c55b){if(!_0x60c55b){_0x518fb3['sendStatus'](0x194);}return _0x60c55b;};}function handleError(_0x4814f5,_0x447c66){_0x447c66=_0x447c66||0x1f4;return function(_0x20ca9a){logger['error'](_0x20ca9a[_0xb378('0x27')]);if(_0x20ca9a[_0xb378('0x28')]){delete _0x20ca9a[_0xb378('0x28')];}_0x4814f5[_0xb378('0x25')](_0x447c66)[_0xb378('0x29')](_0x20ca9a);};}exports[_0xb378('0x2a')]=function(_0x28273c,_0x522a5c){var _0xaf8814={},_0x2e49f4={},_0x45f85c={'count':0x0,'rows':[]};var _0x58df69=_[_0xb378('0x2b')](db[_0xb378('0x2c')][_0xb378('0x2d')],function(_0x2cedae){return{'name':_0x2cedae[_0xb378('0x2e')],'type':_0x2cedae[_0xb378('0x2f')][_0xb378('0x30')]};});_0x2e49f4[_0xb378('0x31')]=_[_0xb378('0x2b')](_0x58df69,_0xb378('0x28'));_0x2e49f4[_0xb378('0x32')]=_[_0xb378('0x33')](_0x28273c[_0xb378('0x32')]);_0x2e49f4['filters']=_[_0xb378('0x34')](_0x2e49f4[_0xb378('0x31')],_0x2e49f4['query']);_0xaf8814[_0xb378('0x35')]=_[_0xb378('0x34')](_0x2e49f4[_0xb378('0x31')],qs[_0xb378('0x36')](_0x28273c[_0xb378('0x32')][_0xb378('0x36')]));_0xaf8814[_0xb378('0x35')]=_0xaf8814['attributes'][_0xb378('0x37')]?_0xaf8814[_0xb378('0x35')]:_0x2e49f4[_0xb378('0x31')];if(!_0x28273c[_0xb378('0x32')][_0xb378('0x38')]('nolimit')){_0xaf8814[_0xb378('0x1c')]=qs[_0xb378('0x1c')](_0x28273c[_0xb378('0x32')][_0xb378('0x1c')]);_0xaf8814['offset']=qs[_0xb378('0x1e')](_0x28273c[_0xb378('0x32')][_0xb378('0x1e')]);}_0xaf8814[_0xb378('0x39')]=qs[_0xb378('0x3a')](_0x28273c[_0xb378('0x32')][_0xb378('0x3a')]);_0xaf8814[_0xb378('0x3b')]=qs[_0xb378('0x3c')](_[_0xb378('0x3d')](_0x28273c[_0xb378('0x32')],_0x2e49f4[_0xb378('0x3c')]),_0x58df69);if(_0x28273c[_0xb378('0x32')][_0xb378('0x3e')]){_0xaf8814['where']=_[_0xb378('0x3f')](_0xaf8814['where'],{'$or':_['map'](_0x58df69,function(_0x1204f4){if(_0x1204f4[_0xb378('0x2f')]!==_0xb378('0x40')){var _0x3b64d4={};_0x3b64d4[_0x1204f4[_0xb378('0x28')]]={'$like':'%'+_0x28273c['query'][_0xb378('0x3e')]+'%'};return _0x3b64d4;}})});}_0xaf8814=_[_0xb378('0x3f')]({},_0xaf8814,_0x28273c[_0xb378('0x41')]);var _0x527872={'where':_0xaf8814[_0xb378('0x3b')]};return db[_0xb378('0x2c')][_0xb378('0x1d')](_0x527872)[_0xb378('0x24')](function(_0x52a9ca){_0x45f85c['count']=_0x52a9ca;if(_0x28273c[_0xb378('0x32')][_0xb378('0x42')]){_0xaf8814['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xb378('0x43')](_0xaf8814);})[_0xb378('0x24')](function(_0x3c299e){_0x45f85c[_0xb378('0x44')]=_0x3c299e;return _0x45f85c;})[_0xb378('0x24')](respondWithFilteredResult(_0x522a5c,_0xaf8814))[_0xb378('0x45')](handleError(_0x522a5c,null));};exports[_0xb378('0x46')]=function(_0x4e42a5,_0x51ea42){var _0x3f9cce={'raw':!![],'where':{'id':_0x4e42a5[_0xb378('0x47')]['id']}},_0x4a27c2={};_0x4a27c2['model']=_[_0xb378('0x33')](db[_0xb378('0x2c')]['rawAttributes']);_0x4a27c2[_0xb378('0x32')]=_[_0xb378('0x33')](_0x4e42a5['query']);_0x4a27c2[_0xb378('0x3c')]=_[_0xb378('0x34')](_0x4a27c2[_0xb378('0x31')],_0x4a27c2[_0xb378('0x32')]);_0x3f9cce[_0xb378('0x35')]=_[_0xb378('0x34')](_0x4a27c2[_0xb378('0x31')],qs[_0xb378('0x36')](_0x4e42a5[_0xb378('0x32')][_0xb378('0x36')]));_0x3f9cce['attributes']=_0x3f9cce['attributes']['length']?_0x3f9cce[_0xb378('0x35')]:_0x4a27c2[_0xb378('0x31')];if(_0x4e42a5[_0xb378('0x32')][_0xb378('0x42')]){_0x3f9cce['include']=[{'all':!![]}];}_0x3f9cce=_['merge']({},_0x3f9cce,_0x4e42a5['options']);return db[_0xb378('0x2c')][_0xb378('0x48')](_0x3f9cce)[_0xb378('0x24')](handleEntityNotFound(_0x51ea42,null))[_0xb378('0x24')](respondWithResult(_0x51ea42,null))[_0xb378('0x45')](handleError(_0x51ea42,null));};exports[_0xb378('0x49')]=function(_0x2ac236,_0x297b5d){return db['MailSubstatus'][_0xb378('0x49')](_0x2ac236['body'],{})[_0xb378('0x24')](respondWithResult(_0x297b5d,0xc9))[_0xb378('0x45')](handleError(_0x297b5d,null));};exports['update']=function(_0x32634a,_0xda602e){if(_0x32634a[_0xb378('0x4a')]['id']){delete _0x32634a['body']['id'];}return db[_0xb378('0x2c')][_0xb378('0x48')]({'where':{'id':_0x32634a[_0xb378('0x47')]['id']}})[_0xb378('0x24')](handleEntityNotFound(_0xda602e,null))[_0xb378('0x24')](saveUpdates(_0x32634a[_0xb378('0x4a')],null))[_0xb378('0x24')](respondWithResult(_0xda602e,null))[_0xb378('0x45')](handleError(_0xda602e,null));};exports[_0xb378('0x4b')]=function(_0x2fd5e3,_0x475c09){return db[_0xb378('0x2c')][_0xb378('0x48')]({'where':{'id':_0x2fd5e3[_0xb378('0x47')]['id']}})[_0xb378('0x24')](handleEntityNotFound(_0x475c09,null))[_0xb378('0x24')](removeEntity(_0x475c09,null))[_0xb378('0x45')](handleError(_0x475c09,null));};exports[_0xb378('0x4c')]=function(_0x378399,_0x2960e8){return db[_0xb378('0x2c')][_0xb378('0x4c')]()['then'](respondWithResult(_0x2960e8,null))[_0xb378('0x45')](handleError(_0x2960e8,null));}; \ No newline at end of file +var _0x84ad=['findAll','rows','show','params','includeAll','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','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','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x84ad,0x18c));var _0xd84a=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x84ad[_0x487496];return _0x539dc8;};'use strict';var emlformat=require(_0xd84a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd84a('0x1'));var jsonpatch=require(_0xd84a('0x2'));var rp=require(_0xd84a('0x3'));var moment=require('moment');var BPromise=require(_0xd84a('0x4'));var Mustache=require(_0xd84a('0x5'));var util=require(_0xd84a('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd84a('0x7'));var fs=require('fs');var fs_extra=require(_0xd84a('0x8'));var _=require(_0xd84a('0x9'));var squel=require('squel');var crypto=require(_0xd84a('0xa'));var jsforce=require(_0xd84a('0xb'));var deskjs=require(_0xd84a('0xc'));var toCsv=require(_0xd84a('0xd'));var querystring=require(_0xd84a('0xe'));var Papa=require('papaparse');var Redis=require(_0xd84a('0xf'));var authService=require(_0xd84a('0x10'));var qs=require(_0xd84a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd84a('0x12'));var logger=require(_0xd84a('0x13'))(_0xd84a('0x14'));var utils=require(_0xd84a('0x15'));var config=require(_0xd84a('0x16'));var licenseUtil=require(_0xd84a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3cea,_0x3bb0b9){_0x3bb0b9=_0x3bb0b9||0xcc;return function(_0x3c47b4){if(_0x3c47b4){return _0x5b3cea[_0xd84a('0x18')](_0x3bb0b9);}return _0x5b3cea['status'](_0x3bb0b9)['end']();};}function respondWithResult(_0x507bc6,_0x4004e0){_0x4004e0=_0x4004e0||0xc8;return function(_0x12d995){if(_0x12d995){return _0x507bc6[_0xd84a('0x19')](_0x4004e0)[_0xd84a('0x1a')](_0x12d995);}};}function respondWithFilteredResult(_0x232fd4,_0x550ac6){return function(_0x483b2d){if(_0x483b2d){var _0x5ef893=typeof _0x550ac6[_0xd84a('0x1b')]==='undefined'&&typeof _0x550ac6['limit']===_0xd84a('0x1c');var _0x5de6d2=_0x483b2d[_0xd84a('0x1d')];var _0xe4aa02=_0x5ef893?0x0:_0x550ac6[_0xd84a('0x1b')];var _0x22e8cb=_0x5ef893?_0x483b2d['count']:_0x550ac6['offset']+_0x550ac6['limit'];var _0x45cc09;if(_0x22e8cb>=_0x5de6d2){_0x22e8cb=_0x5de6d2;_0x45cc09=0xc8;}else{_0x45cc09=0xce;}_0x232fd4[_0xd84a('0x19')](_0x45cc09);return _0x232fd4[_0xd84a('0x1e')](_0xd84a('0x1f'),_0xe4aa02+'-'+_0x22e8cb+'/'+_0x5de6d2)[_0xd84a('0x1a')](_0x483b2d);}return null;};}function patchUpdates(_0x265d92){return function(_0x1c21a7){try{jsonpatch[_0xd84a('0x20')](_0x1c21a7,_0x265d92,!![]);}catch(_0x20c5a0){return BPromise['reject'](_0x20c5a0);}return _0x1c21a7[_0xd84a('0x21')]();};}function saveUpdates(_0x1ec407,_0x2df2ee){return function(_0x30cf3e){if(_0x30cf3e){return _0x30cf3e['update'](_0x1ec407)[_0xd84a('0x22')](function(_0x3af83c){return _0x3af83c;});}return null;};}function removeEntity(_0x589243,_0x9d1033){return function(_0xd693b3){if(_0xd693b3){return _0xd693b3[_0xd84a('0x23')]()[_0xd84a('0x22')](function(){_0x589243[_0xd84a('0x19')](0xcc)[_0xd84a('0x24')]();});}};}function handleEntityNotFound(_0x2c5647,_0x2aaea5){return function(_0xf24dfe){if(!_0xf24dfe){_0x2c5647['sendStatus'](0x194);}return _0xf24dfe;};}function handleError(_0xbc5d01,_0xb1f5a8){_0xb1f5a8=_0xb1f5a8||0x1f4;return function(_0x209318){logger[_0xd84a('0x25')](_0x209318[_0xd84a('0x26')]);if(_0x209318[_0xd84a('0x27')]){delete _0x209318[_0xd84a('0x27')];}_0xbc5d01[_0xd84a('0x19')](_0xb1f5a8)[_0xd84a('0x28')](_0x209318);};}exports['index']=function(_0x34f35e,_0x23124d){var _0x356c18={},_0x38f065={},_0x400efe={'count':0x0,'rows':[]};var _0x3e35bf=_[_0xd84a('0x29')](db[_0xd84a('0x2a')][_0xd84a('0x2b')],function(_0x533e9e){return{'name':_0x533e9e[_0xd84a('0x2c')],'type':_0x533e9e['type'][_0xd84a('0x2d')]};});_0x38f065[_0xd84a('0x2e')]=_[_0xd84a('0x29')](_0x3e35bf,_0xd84a('0x27'));_0x38f065[_0xd84a('0x2f')]=_[_0xd84a('0x30')](_0x34f35e[_0xd84a('0x2f')]);_0x38f065[_0xd84a('0x31')]=_[_0xd84a('0x32')](_0x38f065[_0xd84a('0x2e')],_0x38f065[_0xd84a('0x2f')]);_0x356c18['attributes']=_[_0xd84a('0x32')](_0x38f065[_0xd84a('0x2e')],qs[_0xd84a('0x33')](_0x34f35e[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x356c18[_0xd84a('0x34')]=_0x356c18[_0xd84a('0x34')][_0xd84a('0x35')]?_0x356c18['attributes']:_0x38f065[_0xd84a('0x2e')];if(!_0x34f35e[_0xd84a('0x2f')][_0xd84a('0x36')](_0xd84a('0x37'))){_0x356c18[_0xd84a('0x38')]=qs[_0xd84a('0x38')](_0x34f35e[_0xd84a('0x2f')][_0xd84a('0x38')]);_0x356c18[_0xd84a('0x1b')]=qs[_0xd84a('0x1b')](_0x34f35e[_0xd84a('0x2f')]['offset']);}_0x356c18[_0xd84a('0x39')]=qs[_0xd84a('0x3a')](_0x34f35e[_0xd84a('0x2f')][_0xd84a('0x3a')]);_0x356c18[_0xd84a('0x3b')]=qs[_0xd84a('0x31')](_[_0xd84a('0x3c')](_0x34f35e[_0xd84a('0x2f')],_0x38f065[_0xd84a('0x31')]),_0x3e35bf);if(_0x34f35e[_0xd84a('0x2f')][_0xd84a('0x3d')]){_0x356c18[_0xd84a('0x3b')]=_['merge'](_0x356c18[_0xd84a('0x3b')],{'$or':_[_0xd84a('0x29')](_0x3e35bf,function(_0x1bb8f0){if(_0x1bb8f0[_0xd84a('0x3e')]!==_0xd84a('0x3f')){var _0x588cd0={};_0x588cd0[_0x1bb8f0[_0xd84a('0x27')]]={'$like':'%'+_0x34f35e['query'][_0xd84a('0x3d')]+'%'};return _0x588cd0;}})});}_0x356c18=_[_0xd84a('0x40')]({},_0x356c18,_0x34f35e[_0xd84a('0x41')]);var _0xa1e55d={'where':_0x356c18['where']};return db[_0xd84a('0x2a')][_0xd84a('0x1d')](_0xa1e55d)[_0xd84a('0x22')](function(_0x13b218){_0x400efe[_0xd84a('0x1d')]=_0x13b218;if(_0x34f35e[_0xd84a('0x2f')]['includeAll']){_0x356c18['include']=[{'all':!![]}];}return db[_0xd84a('0x2a')][_0xd84a('0x42')](_0x356c18);})['then'](function(_0x5e75d9){_0x400efe[_0xd84a('0x43')]=_0x5e75d9;return _0x400efe;})[_0xd84a('0x22')](respondWithFilteredResult(_0x23124d,_0x356c18))['catch'](handleError(_0x23124d,null));};exports[_0xd84a('0x44')]=function(_0x5a854e,_0x464d50){var _0x5e3705={'raw':!![],'where':{'id':_0x5a854e[_0xd84a('0x45')]['id']}},_0x548010={};_0x548010['model']=_[_0xd84a('0x30')](db[_0xd84a('0x2a')][_0xd84a('0x2b')]);_0x548010[_0xd84a('0x2f')]=_[_0xd84a('0x30')](_0x5a854e['query']);_0x548010['filters']=_['intersection'](_0x548010[_0xd84a('0x2e')],_0x548010[_0xd84a('0x2f')]);_0x5e3705[_0xd84a('0x34')]=_['intersection'](_0x548010[_0xd84a('0x2e')],qs[_0xd84a('0x33')](_0x5a854e['query'][_0xd84a('0x33')]));_0x5e3705[_0xd84a('0x34')]=_0x5e3705['attributes'][_0xd84a('0x35')]?_0x5e3705[_0xd84a('0x34')]:_0x548010[_0xd84a('0x2e')];if(_0x5a854e[_0xd84a('0x2f')][_0xd84a('0x46')]){_0x5e3705[_0xd84a('0x47')]=[{'all':!![]}];}_0x5e3705=_['merge']({},_0x5e3705,_0x5a854e[_0xd84a('0x41')]);return db[_0xd84a('0x2a')]['find'](_0x5e3705)[_0xd84a('0x22')](handleEntityNotFound(_0x464d50,null))[_0xd84a('0x22')](respondWithResult(_0x464d50,null))[_0xd84a('0x48')](handleError(_0x464d50,null));};exports[_0xd84a('0x49')]=function(_0x1e50a3,_0x10dfa5){return db[_0xd84a('0x2a')]['create'](_0x1e50a3[_0xd84a('0x4a')],{})[_0xd84a('0x22')](respondWithResult(_0x10dfa5,0xc9))[_0xd84a('0x48')](handleError(_0x10dfa5,null));};exports['update']=function(_0x7de79a,_0x851a7){if(_0x7de79a[_0xd84a('0x4a')]['id']){delete _0x7de79a[_0xd84a('0x4a')]['id'];}return db['MailSubstatus'][_0xd84a('0x4b')]({'where':{'id':_0x7de79a[_0xd84a('0x45')]['id']}})['then'](handleEntityNotFound(_0x851a7,null))[_0xd84a('0x22')](saveUpdates(_0x7de79a['body'],null))[_0xd84a('0x22')](respondWithResult(_0x851a7,null))[_0xd84a('0x48')](handleError(_0x851a7,null));};exports['destroy']=function(_0x421de9,_0x1928ec){return db['MailSubstatus'][_0xd84a('0x4b')]({'where':{'id':_0x421de9['params']['id']}})[_0xd84a('0x22')](handleEntityNotFound(_0x1928ec,null))['then'](removeEntity(_0x1928ec,null))[_0xd84a('0x48')](handleError(_0x1928ec,null));};exports[_0xd84a('0x4c')]=function(_0x406a59,_0x3d5905){return db[_0xd84a('0x2a')]['describe']()['then'](respondWithResult(_0x3d5905,null))[_0xd84a('0x48')](handleError(_0x3d5905,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5e1f49c..9ff14b5 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 _0x9710=['events','update','emit','hasOwnProperty','hook','exports'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9710,0x14a));var _0x0971=function(_0x2b67ca,_0x4ea0d8){_0x2b67ca=_0x2b67ca-0x0;var _0x1b1cf5=_0x9710[_0x2b67ca];return _0x1b1cf5;};'use strict';var EventEmitter=require(_0x0971('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x0971('0x1')};function emitEvent(_0x5bd88f){return function(_0x340204,_0x27b3d3,_0x4241ff){MailSubstatusEvents[_0x0971('0x2')](_0x5bd88f+':'+_0x340204['id'],_0x340204);MailSubstatusEvents[_0x0971('0x2')](_0x5bd88f,_0x340204);_0x4241ff(null);};}for(var e in events){if(events[_0x0971('0x3')](e)){var event=events[e];MailSubstatus[_0x0971('0x4')](e,emitEvent(event));}}module[_0x0971('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xd13c=['setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus'];(function(_0x4668de,_0x22f7e1){var _0x40ac23=function(_0x1172e3){while(--_0x1172e3){_0x4668de['push'](_0x4668de['shift']());}};_0x40ac23(++_0x22f7e1);}(_0xd13c,0x154));var _0xcd13=function(_0x494848,_0x216dc5){_0x494848=_0x494848-0x0;var _0x18792b=_0xd13c[_0x494848];return _0x18792b;};'use strict';var EventEmitter=require(_0xcd13('0x0'));var MailSubstatus=require(_0xcd13('0x1'))['db'][_0xcd13('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcd13('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x83f712){return function(_0x1f5c36,_0x410354,_0x3f0deb){MailSubstatusEvents[_0xcd13('0x4')](_0x83f712+':'+_0x1f5c36['id'],_0x1f5c36);MailSubstatusEvents[_0xcd13('0x4')](_0x83f712,_0x1f5c36);_0x3f0deb(null);};}for(var e in events){if(events[_0xcd13('0x5')](e)){var event=events[e];MailSubstatus[_0xcd13('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 34d5a9f..5324a56 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 _0x822f=['update','name','_previousDataValues','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses'];(function(_0x2472c3,_0x4534af){var _0xe00fb1=function(_0x14ad95){while(--_0x14ad95){_0x2472c3['push'](_0x2472c3['shift']());}};_0xe00fb1(++_0x4534af);}(_0x822f,0x79));var _0xf822=function(_0xf79f8,_0x693d9c){_0xf79f8=_0xf79f8-0x0;var _0x2e6a15=_0x822f[_0xf79f8];return _0x2e6a15;};'use strict';var attributes=require(_0xf822('0x0'));module['exports']=function(_0x3afd95){var _0x492565=_0x3afd95[_0xf822('0x1')];return _0x3afd95[_0xf822('0x2')](_0xf822('0x3'),attributes,{'tableName':_0xf822('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x9ecde3,_0x293940,_0x373486){return _0x492565['Condition'][_0xf822('0x5')]({'value':_0x9ecde3[_0xf822('0x6')]},{'where':{'field':'mailSubstatus','value':_0x9ecde3[_0xf822('0x7')][_0xf822('0x6')]}})['then'](function(){_0x373486();})[_0xf822('0x8')](function(_0xf39f70){_0x373486(_0xf39f70);});}}});}; \ No newline at end of file +var _0x991a=['Condition','update','name','_previousDataValues','exports','models','MailSubstatus','mail_substatuses'];(function(_0x4ce860,_0x24ca0c){var _0x587afc=function(_0xc1a4e8){while(--_0xc1a4e8){_0x4ce860['push'](_0x4ce860['shift']());}};_0x587afc(++_0x24ca0c);}(_0x991a,0xd4));var _0xa991=function(_0x3c5915,_0x5c7f81){_0x3c5915=_0x3c5915-0x0;var _0x4daa59=_0x991a[_0x3c5915];return _0x4daa59;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xa991('0x0')]=function(_0x6fa35f){var _0x4af501=_0x6fa35f[_0xa991('0x1')];return _0x6fa35f['define'](_0xa991('0x2'),attributes,{'tableName':_0xa991('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x157c79,_0x30db65,_0x30cca6){return _0x4af501[_0xa991('0x4')][_0xa991('0x5')]({'value':_0x157c79[_0xa991('0x6')]},{'where':{'field':'mailSubstatus','value':_0x157c79[_0xa991('0x7')][_0xa991('0x6')]}})['then'](function(){_0x30cca6();})['catch'](function(_0x2a0636){_0x30cca6(_0x2a0636);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0b156fe..db6d5e4 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 _0xe484=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4bc677,_0xf5eaa9){var _0x38654e=function(_0x2126d0){while(--_0x2126d0){_0x4bc677['push'](_0x4bc677['shift']());}};_0x38654e(++_0xf5eaa9);}(_0xe484,0x118));var _0x4e48=function(_0x3f9f02,_0x456b67){_0x3f9f02=_0x3f9f02-0x0;var _0x57d3d8=_0xe484[_0x3f9f02];return _0x57d3d8;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var Redis=require(_0x4e48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e48('0x6'));var logger=require(_0x4e48('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e48('0x8'));var client=jayson[_0x4e48('0x9')][_0x4e48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3b44c,_0x1e6448,_0x44881c){return new BPromise(function(_0x587e0e,_0x52b02d){return client[_0x4e48('0xb')](_0xc3b44c,_0x44881c)[_0x4e48('0xc')](function(_0x2baac2){logger['info'](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));logger['debug'](_0x4e48('0xf'),_0x1e6448,_0x4e48('0xe'),JSON[_0x4e48('0x10')](_0x2baac2));if(_0x2baac2[_0x4e48('0x11')]){if(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x12')]===0x1f4){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x52b02d(_0x2baac2[_0x4e48('0x11')]['message']);}logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x587e0e(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);}else{logger[_0x4e48('0x14')](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));_0x587e0e(_0x2baac2['result'][_0x4e48('0x13')]);}})[_0x4e48('0x15')](function(_0x1ac90d){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x1ac90d);_0x52b02d(_0x1ac90d);});});} \ No newline at end of file +var _0x9dc6=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9dc6,0xe0));var _0x69dc=function(_0x2fbd46,_0x512536){_0x2fbd46=_0x2fbd46-0x0;var _0x9f1dd1=_0x9dc6[_0x2fbd46];return _0x9f1dd1;};'use strict';var _=require(_0x69dc('0x0'));var util=require(_0x69dc('0x1'));var moment=require(_0x69dc('0x2'));var BPromise=require(_0x69dc('0x3'));var rs=require(_0x69dc('0x4'));var fs=require('fs');var Redis=require(_0x69dc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x69dc('0x6'));var logger=require('../../config/logger')(_0x69dc('0x7'));var config=require(_0x69dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e85ce,_0x4d5265,_0x395691){return new BPromise(function(_0x526c09,_0x213304){return client[_0x69dc('0xa')](_0x5e85ce,_0x395691)[_0x69dc('0xb')](function(_0x217ac5){logger['info'](_0x69dc('0xc'),_0x4d5265,_0x69dc('0xd'));logger[_0x69dc('0xe')](_0x69dc('0xf'),_0x4d5265,_0x69dc('0xd'),JSON[_0x69dc('0x10')](_0x217ac5));if(_0x217ac5[_0x69dc('0x11')]){if(_0x217ac5[_0x69dc('0x11')]['code']===0x1f4){logger[_0x69dc('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4d5265,_0x217ac5[_0x69dc('0x11')][_0x69dc('0x12')]);return _0x213304(_0x217ac5[_0x69dc('0x11')][_0x69dc('0x12')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4d5265,_0x217ac5[_0x69dc('0x11')][_0x69dc('0x12')]);return _0x526c09(_0x217ac5[_0x69dc('0x11')][_0x69dc('0x12')]);}else{logger[_0x69dc('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x4d5265,_0x69dc('0xd'));_0x526c09(_0x217ac5[_0x69dc('0x14')][_0x69dc('0x12')]);}})[_0x69dc('0x15')](function(_0x11a92e){logger[_0x69dc('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4d5265,_0x11a92e);_0x213304(_0x11a92e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e6cfe3b..1b06a7a 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 _0xde88=['/describe','describe','show','create','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x2e5558,_0x500bb3){var _0x2afa4e=function(_0x1baa13){while(--_0x1baa13){_0x2e5558['push'](_0x2e5558['shift']());}};_0x2afa4e(++_0x500bb3);}(_0xde88,0xda));var _0x8de8=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xde88[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0x8de8('0x0'));var util=require(_0x8de8('0x1'));var path=require(_0x8de8('0x2'));var timeout=require('connect-timeout');var express=require(_0x8de8('0x3'));var router=express[_0x8de8('0x4')]();var fs_extra=require(_0x8de8('0x5'));var auth=require(_0x8de8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x8de8('0x7')]('/',auth[_0x8de8('0x8')](),controller[_0x8de8('0x9')]);router[_0x8de8('0x7')](_0x8de8('0xa'),auth[_0x8de8('0x8')](),controller[_0x8de8('0xb')]);router[_0x8de8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8de8('0xc')]);router['post']('/',auth[_0x8de8('0x8')](),controller[_0x8de8('0xd')]);router[_0x8de8('0xe')](_0x8de8('0xf'),auth[_0x8de8('0x8')](),controller[_0x8de8('0x10')]);router[_0x8de8('0x11')]('/:id',auth[_0x8de8('0x8')](),controller['destroy']);module[_0x8de8('0x12')]=router; \ No newline at end of file +var _0x8f38=['./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f38,0xb3));var _0x88f3=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x8f38[_0xeff2c3];return _0x2cade6;};'use strict';var multer=require(_0x88f3('0x0'));var util=require(_0x88f3('0x1'));var path=require(_0x88f3('0x2'));var timeout=require(_0x88f3('0x3'));var express=require(_0x88f3('0x4'));var router=express[_0x88f3('0x5')]();var fs_extra=require(_0x88f3('0x6'));var auth=require(_0x88f3('0x7'));var interaction=require(_0x88f3('0x8'));var config=require(_0x88f3('0x9'));var controller=require(_0x88f3('0xa'));router[_0x88f3('0xb')]('/',auth[_0x88f3('0xc')](),controller[_0x88f3('0xd')]);router['get'](_0x88f3('0xe'),auth[_0x88f3('0xc')](),controller[_0x88f3('0xf')]);router[_0x88f3('0xb')](_0x88f3('0x10'),auth[_0x88f3('0xc')](),controller['show']);router[_0x88f3('0x11')]('/',auth[_0x88f3('0xc')](),controller[_0x88f3('0x12')]);router['put']('/:id',auth[_0x88f3('0xc')](),controller[_0x88f3('0x13')]);router['delete'](_0x88f3('0x10'),auth[_0x88f3('0xc')](),controller[_0x88f3('0x14')]);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 7e4e69d..6b30a77 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x14537f,_0x3cfbe2){var _0x13196d=function(_0x55824f){while(--_0x55824f){_0x14537f['push'](_0x14537f['shift']());}};_0x13196d(++_0x3cfbe2);}(_0x008c,0x188));var _0xc008=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x008c[_0x5e8282];return _0x5cd37d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xb43b,0x1b2));var _0xbb43=function(_0x380921,_0x555d3f){_0x380921=_0x380921-0x0;var _0xd7f479=_0xb43b[_0x380921];return _0xd7f479;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1ec4909..aee854a 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 _0x141f=['crypto','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','MailTransferReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','catch','show','rawAttributes','includeAll','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel'];(function(_0x5b560b,_0x56f6bc){var _0x21a148=function(_0x6857a3){while(--_0x6857a3){_0x5b560b['push'](_0x5b560b['shift']());}};_0x21a148(++_0x56f6bc);}(_0x141f,0x193));var _0xf141=function(_0x11f083,_0x38a7dd){_0x11f083=_0x11f083-0x0;var _0x1a41f3=_0x141f[_0x11f083];return _0x1a41f3;};'use strict';var emlformat=require(_0xf141('0x0'));var rimraf=require(_0xf141('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf141('0x2'));var rp=require(_0xf141('0x3'));var moment=require('moment');var BPromise=require(_0xf141('0x4'));var Mustache=require(_0xf141('0x5'));var util=require('util');var path=require(_0xf141('0x6'));var sox=require(_0xf141('0x7'));var csv=require(_0xf141('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf141('0x9'));var squel=require(_0xf141('0xa'));var crypto=require(_0xf141('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf141('0xc'));var toCsv=require(_0xf141('0x8'));var querystring=require(_0xf141('0xd'));var Papa=require('papaparse');var Redis=require(_0xf141('0xe'));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(_0xf141('0xf'))(_0xf141('0x10'));var utils=require(_0xf141('0x11'));var config=require(_0xf141('0x12'));var licenseUtil=require(_0xf141('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45cf94,_0x5f0fa0){_0x5f0fa0=_0x5f0fa0||0xcc;return function(_0x2890b1){if(_0x2890b1){return _0x45cf94[_0xf141('0x14')](_0x5f0fa0);}return _0x45cf94[_0xf141('0x15')](_0x5f0fa0)[_0xf141('0x16')]();};}function respondWithResult(_0x1cb0b0,_0x82da40){_0x82da40=_0x82da40||0xc8;return function(_0x4f3cae){if(_0x4f3cae){return _0x1cb0b0['status'](_0x82da40)[_0xf141('0x17')](_0x4f3cae);}};}function respondWithFilteredResult(_0x27af81,_0x3eb504){return function(_0x59af36){if(_0x59af36){var _0x8b6c36=typeof _0x3eb504['offset']==='undefined'&&typeof _0x3eb504[_0xf141('0x18')]==='undefined';var _0xd3b6e8=_0x59af36[_0xf141('0x19')];var _0xf961fc=_0x8b6c36?0x0:_0x3eb504[_0xf141('0x1a')];var _0x44cfee=_0x8b6c36?_0x59af36[_0xf141('0x19')]:_0x3eb504[_0xf141('0x1a')]+_0x3eb504[_0xf141('0x18')];var _0x3cb087;if(_0x44cfee>=_0xd3b6e8){_0x44cfee=_0xd3b6e8;_0x3cb087=0xc8;}else{_0x3cb087=0xce;}_0x27af81['status'](_0x3cb087);return _0x27af81[_0xf141('0x1b')](_0xf141('0x1c'),_0xf961fc+'-'+_0x44cfee+'/'+_0xd3b6e8)[_0xf141('0x17')](_0x59af36);}return null;};}function patchUpdates(_0x5a1b82){return function(_0x4e1f64){try{jsonpatch[_0xf141('0x1d')](_0x4e1f64,_0x5a1b82,!![]);}catch(_0x209830){return BPromise[_0xf141('0x1e')](_0x209830);}return _0x4e1f64['save']();};}function saveUpdates(_0x1ae1f0,_0x3820af){return function(_0x2b73e4){if(_0x2b73e4){return _0x2b73e4[_0xf141('0x1f')](_0x1ae1f0)[_0xf141('0x20')](function(_0x492fbf){return _0x492fbf;});}return null;};}function removeEntity(_0x497234,_0x46b758){return function(_0x2c37da){if(_0x2c37da){return _0x2c37da[_0xf141('0x21')]()[_0xf141('0x20')](function(){_0x497234[_0xf141('0x15')](0xcc)[_0xf141('0x16')]();});}};}function handleEntityNotFound(_0x259751,_0x2b0d2b){return function(_0x3d5df1){if(!_0x3d5df1){_0x259751[_0xf141('0x14')](0x194);}return _0x3d5df1;};}function handleError(_0x811f89,_0x2809df){_0x2809df=_0x2809df||0x1f4;return function(_0x1bcb5f){logger[_0xf141('0x22')](_0x1bcb5f['stack']);if(_0x1bcb5f[_0xf141('0x23')]){delete _0x1bcb5f[_0xf141('0x23')];}_0x811f89[_0xf141('0x15')](_0x2809df)[_0xf141('0x24')](_0x1bcb5f);};}exports['index']=function(_0x46afe6,_0x1f68de){var _0x13ddb8={},_0x44f14c={},_0x38d659={'count':0x0,'rows':[]};var _0x20057d=_[_0xf141('0x25')](db[_0xf141('0x26')]['rawAttributes'],function(_0x21eb55){return{'name':_0x21eb55[_0xf141('0x27')],'type':_0x21eb55[_0xf141('0x28')]['key']};});_0x44f14c[_0xf141('0x29')]=_[_0xf141('0x25')](_0x20057d,_0xf141('0x23'));_0x44f14c[_0xf141('0x2a')]=_[_0xf141('0x2b')](_0x46afe6[_0xf141('0x2a')]);_0x44f14c[_0xf141('0x2c')]=_[_0xf141('0x2d')](_0x44f14c[_0xf141('0x29')],_0x44f14c[_0xf141('0x2a')]);_0x13ddb8['attributes']=_[_0xf141('0x2d')](_0x44f14c['model'],qs[_0xf141('0x2e')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x2e')]));_0x13ddb8[_0xf141('0x2f')]=_0x13ddb8[_0xf141('0x2f')][_0xf141('0x30')]?_0x13ddb8[_0xf141('0x2f')]:_0x44f14c[_0xf141('0x29')];if(!_0x46afe6[_0xf141('0x2a')][_0xf141('0x31')](_0xf141('0x32'))){_0x13ddb8['limit']=qs[_0xf141('0x18')](_0x46afe6['query']['limit']);_0x13ddb8[_0xf141('0x1a')]=qs[_0xf141('0x1a')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x1a')]);}_0x13ddb8[_0xf141('0x33')]=qs[_0xf141('0x34')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x34')]);_0x13ddb8[_0xf141('0x35')]=qs[_0xf141('0x2c')](_[_0xf141('0x36')](_0x46afe6[_0xf141('0x2a')],_0x44f14c[_0xf141('0x2c')]),_0x20057d);if(_0x46afe6['query'][_0xf141('0x37')]){_0x13ddb8['where']=_['merge'](_0x13ddb8[_0xf141('0x35')],{'$or':_[_0xf141('0x25')](_0x20057d,function(_0x4c2bc5){if(_0x4c2bc5['type']!==_0xf141('0x38')){var _0x15e53c={};_0x15e53c[_0x4c2bc5['name']]={'$like':'%'+_0x46afe6['query']['filter']+'%'};return _0x15e53c;}})});}_0x13ddb8=_[_0xf141('0x39')]({},_0x13ddb8,_0x46afe6['options']);var _0x5e56bb={'where':_0x13ddb8[_0xf141('0x35')]};return db[_0xf141('0x26')][_0xf141('0x19')](_0x5e56bb)['then'](function(_0xb73079){_0x38d659['count']=_0xb73079;if(_0x46afe6[_0xf141('0x2a')]['includeAll']){_0x13ddb8[_0xf141('0x3a')]=[{'all':!![]}];}return db[_0xf141('0x26')]['findAll'](_0x13ddb8);})['then'](function(_0x276226){_0x38d659['rows']=_0x276226;return _0x38d659;})['then'](respondWithFilteredResult(_0x1f68de,_0x13ddb8))[_0xf141('0x3b')](handleError(_0x1f68de,null));};exports[_0xf141('0x3c')]=function(_0x477366,_0x447f5e){var _0x4e5867={'raw':!![],'where':{'id':_0x477366['params']['id']}},_0x127432={};_0x127432[_0xf141('0x29')]=_['keys'](db['MailTransferReport'][_0xf141('0x3d')]);_0x127432[_0xf141('0x2a')]=_[_0xf141('0x2b')](_0x477366[_0xf141('0x2a')]);_0x127432['filters']=_[_0xf141('0x2d')](_0x127432[_0xf141('0x29')],_0x127432['query']);_0x4e5867[_0xf141('0x2f')]=_[_0xf141('0x2d')](_0x127432['model'],qs['fields'](_0x477366['query']['fields']));_0x4e5867[_0xf141('0x2f')]=_0x4e5867['attributes']['length']?_0x4e5867[_0xf141('0x2f')]:_0x127432[_0xf141('0x29')];if(_0x477366[_0xf141('0x2a')][_0xf141('0x3e')]){_0x4e5867[_0xf141('0x3a')]=[{'all':!![]}];}_0x4e5867=_[_0xf141('0x39')]({},_0x4e5867,_0x477366[_0xf141('0x3f')]);return db[_0xf141('0x26')][_0xf141('0x40')](_0x4e5867)['then'](handleEntityNotFound(_0x447f5e,null))[_0xf141('0x20')](respondWithResult(_0x447f5e,null))['catch'](handleError(_0x447f5e,null));};exports['create']=function(_0x558851,_0x5d5892){return db[_0xf141('0x26')][_0xf141('0x41')](_0x558851[_0xf141('0x42')],{})[_0xf141('0x20')](respondWithResult(_0x5d5892,0xc9))[_0xf141('0x3b')](handleError(_0x5d5892,null));};exports[_0xf141('0x1f')]=function(_0x5f5143,_0x4acf08){if(_0x5f5143[_0xf141('0x42')]['id']){delete _0x5f5143[_0xf141('0x42')]['id'];}return db['MailTransferReport'][_0xf141('0x40')]({'where':{'id':_0x5f5143['params']['id']}})[_0xf141('0x20')](handleEntityNotFound(_0x4acf08,null))[_0xf141('0x20')](saveUpdates(_0x5f5143[_0xf141('0x42')],null))['then'](respondWithResult(_0x4acf08,null))['catch'](handleError(_0x4acf08,null));};exports[_0xf141('0x21')]=function(_0x5b99d5,_0x5cf091){return db['MailTransferReport'][_0xf141('0x40')]({'where':{'id':_0x5b99d5[_0xf141('0x43')]['id']}})[_0xf141('0x20')](handleEntityNotFound(_0x5cf091,null))[_0xf141('0x20')](removeEntity(_0x5cf091,null))[_0xf141('0x3b')](handleError(_0x5cf091,null));};exports[_0xf141('0x44')]=function(_0x2e697e,_0x5592f1){return db['MailTransferReport'][_0xf141('0x44')]()['then'](respondWithResult(_0x5592f1,null))[_0xf141('0x3b')](handleError(_0x5592f1,null));}; \ No newline at end of file +var _0xc46c=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','create','body','params','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','save','update','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0xc46c,0x1b9));var _0xcc46=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0xc46c[_0x59eacf];return _0x5d74f2;};'use strict';var emlformat=require(_0xcc46('0x0'));var rimraf=require(_0xcc46('0x1'));var zipdir=require(_0xcc46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcc46('0x3'));var BPromise=require(_0xcc46('0x4'));var Mustache=require(_0xcc46('0x5'));var util=require(_0xcc46('0x6'));var path=require(_0xcc46('0x7'));var sox=require(_0xcc46('0x8'));var csv=require(_0xcc46('0x9'));var ejs=require(_0xcc46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc46('0xb'));var crypto=require(_0xcc46('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcc46('0xd'));var toCsv=require(_0xcc46('0x9'));var querystring=require(_0xcc46('0xe'));var Papa=require(_0xcc46('0xf'));var Redis=require(_0xcc46('0x10'));var authService=require(_0xcc46('0x11'));var qs=require(_0xcc46('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc46('0x13'));var logger=require(_0xcc46('0x14'))(_0xcc46('0x15'));var utils=require(_0xcc46('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc46('0x17'));var db=require(_0xcc46('0x18'))['db'];function respondWithStatusCode(_0x83f72d,_0x3da6a5){_0x3da6a5=_0x3da6a5||0xcc;return function(_0x1f042c){if(_0x1f042c){return _0x83f72d[_0xcc46('0x19')](_0x3da6a5);}return _0x83f72d[_0xcc46('0x1a')](_0x3da6a5)['end']();};}function respondWithResult(_0xe2217c,_0x31ad9a){_0x31ad9a=_0x31ad9a||0xc8;return function(_0xab9b51){if(_0xab9b51){return _0xe2217c[_0xcc46('0x1a')](_0x31ad9a)[_0xcc46('0x1b')](_0xab9b51);}};}function respondWithFilteredResult(_0x2fdcb0,_0x5398f3){return function(_0x1249cd){if(_0x1249cd){var _0x2857d0=typeof _0x5398f3[_0xcc46('0x1c')]===_0xcc46('0x1d')&&typeof _0x5398f3[_0xcc46('0x1e')]===_0xcc46('0x1d');var _0x5a3794=_0x1249cd[_0xcc46('0x1f')];var _0x34ab03=_0x2857d0?0x0:_0x5398f3[_0xcc46('0x1c')];var _0x166f57=_0x2857d0?_0x1249cd[_0xcc46('0x1f')]:_0x5398f3['offset']+_0x5398f3[_0xcc46('0x1e')];var _0x595100;if(_0x166f57>=_0x5a3794){_0x166f57=_0x5a3794;_0x595100=0xc8;}else{_0x595100=0xce;}_0x2fdcb0[_0xcc46('0x1a')](_0x595100);return _0x2fdcb0['set']('Content-Range',_0x34ab03+'-'+_0x166f57+'/'+_0x5a3794)[_0xcc46('0x1b')](_0x1249cd);}return null;};}function patchUpdates(_0x2c9c4d){return function(_0x251dfb){try{jsonpatch['apply'](_0x251dfb,_0x2c9c4d,!![]);}catch(_0x1b9380){return BPromise['reject'](_0x1b9380);}return _0x251dfb[_0xcc46('0x20')]();};}function saveUpdates(_0x55b1a5,_0x31deeb){return function(_0x39baeb){if(_0x39baeb){return _0x39baeb[_0xcc46('0x21')](_0x55b1a5)[_0xcc46('0x22')](function(_0x59b9b0){return _0x59b9b0;});}return null;};}function removeEntity(_0x56f829,_0x358bbb){return function(_0x51d33b){if(_0x51d33b){return _0x51d33b['destroy']()[_0xcc46('0x22')](function(){_0x56f829[_0xcc46('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f1b7,_0x136622){return function(_0x42fbe6){if(!_0x42fbe6){_0x29f1b7['sendStatus'](0x194);}return _0x42fbe6;};}function handleError(_0x1b71e7,_0x1adc78){_0x1adc78=_0x1adc78||0x1f4;return function(_0x361dfb){logger[_0xcc46('0x23')](_0x361dfb[_0xcc46('0x24')]);if(_0x361dfb['name']){delete _0x361dfb[_0xcc46('0x25')];}_0x1b71e7[_0xcc46('0x1a')](_0x1adc78)[_0xcc46('0x26')](_0x361dfb);};}exports[_0xcc46('0x27')]=function(_0x46e397,_0x40bfb0){var _0x8e9478={},_0xa6db5b={},_0x1f0be3={'count':0x0,'rows':[]};var _0x3c9562=_[_0xcc46('0x28')](db[_0xcc46('0x29')][_0xcc46('0x2a')],function(_0x15ffcc){return{'name':_0x15ffcc[_0xcc46('0x2b')],'type':_0x15ffcc[_0xcc46('0x2c')]['key']};});_0xa6db5b[_0xcc46('0x2d')]=_[_0xcc46('0x28')](_0x3c9562,_0xcc46('0x25'));_0xa6db5b[_0xcc46('0x2e')]=_[_0xcc46('0x2f')](_0x46e397['query']);_0xa6db5b['filters']=_[_0xcc46('0x30')](_0xa6db5b[_0xcc46('0x2d')],_0xa6db5b['query']);_0x8e9478[_0xcc46('0x31')]=_[_0xcc46('0x30')](_0xa6db5b[_0xcc46('0x2d')],qs['fields'](_0x46e397[_0xcc46('0x2e')][_0xcc46('0x32')]));_0x8e9478['attributes']=_0x8e9478[_0xcc46('0x31')][_0xcc46('0x33')]?_0x8e9478[_0xcc46('0x31')]:_0xa6db5b[_0xcc46('0x2d')];if(!_0x46e397['query']['hasOwnProperty'](_0xcc46('0x34'))){_0x8e9478[_0xcc46('0x1e')]=qs[_0xcc46('0x1e')](_0x46e397[_0xcc46('0x2e')][_0xcc46('0x1e')]);_0x8e9478[_0xcc46('0x1c')]=qs['offset'](_0x46e397[_0xcc46('0x2e')][_0xcc46('0x1c')]);}_0x8e9478[_0xcc46('0x35')]=qs[_0xcc46('0x36')](_0x46e397['query'][_0xcc46('0x36')]);_0x8e9478[_0xcc46('0x37')]=qs[_0xcc46('0x38')](_[_0xcc46('0x39')](_0x46e397[_0xcc46('0x2e')],_0xa6db5b[_0xcc46('0x38')]),_0x3c9562);if(_0x46e397[_0xcc46('0x2e')][_0xcc46('0x3a')]){_0x8e9478['where']=_[_0xcc46('0x3b')](_0x8e9478['where'],{'$or':_[_0xcc46('0x28')](_0x3c9562,function(_0x162aa1){if(_0x162aa1[_0xcc46('0x2c')]!==_0xcc46('0x3c')){var _0xa4a887={};_0xa4a887[_0x162aa1[_0xcc46('0x25')]]={'$like':'%'+_0x46e397[_0xcc46('0x2e')][_0xcc46('0x3a')]+'%'};return _0xa4a887;}})});}_0x8e9478=_[_0xcc46('0x3b')]({},_0x8e9478,_0x46e397[_0xcc46('0x3d')]);var _0xdf1531={'where':_0x8e9478[_0xcc46('0x37')]};return db[_0xcc46('0x29')][_0xcc46('0x1f')](_0xdf1531)[_0xcc46('0x22')](function(_0x29fb6a){_0x1f0be3[_0xcc46('0x1f')]=_0x29fb6a;if(_0x46e397[_0xcc46('0x2e')][_0xcc46('0x3e')]){_0x8e9478[_0xcc46('0x3f')]=[{'all':!![]}];}return db[_0xcc46('0x29')][_0xcc46('0x40')](_0x8e9478);})[_0xcc46('0x22')](function(_0x5610ba){_0x1f0be3['rows']=_0x5610ba;return _0x1f0be3;})[_0xcc46('0x22')](respondWithFilteredResult(_0x40bfb0,_0x8e9478))['catch'](handleError(_0x40bfb0,null));};exports['show']=function(_0x11f235,_0x4dd313){var _0x596d4c={'raw':!![],'where':{'id':_0x11f235['params']['id']}},_0x45c6fa={};_0x45c6fa[_0xcc46('0x2d')]=_[_0xcc46('0x2f')](db['MailTransferReport']['rawAttributes']);_0x45c6fa['query']=_[_0xcc46('0x2f')](_0x11f235['query']);_0x45c6fa[_0xcc46('0x38')]=_[_0xcc46('0x30')](_0x45c6fa[_0xcc46('0x2d')],_0x45c6fa[_0xcc46('0x2e')]);_0x596d4c[_0xcc46('0x31')]=_['intersection'](_0x45c6fa['model'],qs[_0xcc46('0x32')](_0x11f235[_0xcc46('0x2e')][_0xcc46('0x32')]));_0x596d4c['attributes']=_0x596d4c[_0xcc46('0x31')][_0xcc46('0x33')]?_0x596d4c[_0xcc46('0x31')]:_0x45c6fa['model'];if(_0x11f235[_0xcc46('0x2e')][_0xcc46('0x3e')]){_0x596d4c[_0xcc46('0x3f')]=[{'all':!![]}];}_0x596d4c=_[_0xcc46('0x3b')]({},_0x596d4c,_0x11f235['options']);return db[_0xcc46('0x29')]['find'](_0x596d4c)[_0xcc46('0x22')](handleEntityNotFound(_0x4dd313,null))[_0xcc46('0x22')](respondWithResult(_0x4dd313,null))[_0xcc46('0x41')](handleError(_0x4dd313,null));};exports[_0xcc46('0x42')]=function(_0x3f7bf1,_0x6e2ba){return db['MailTransferReport'][_0xcc46('0x42')](_0x3f7bf1[_0xcc46('0x43')],{})[_0xcc46('0x22')](respondWithResult(_0x6e2ba,0xc9))[_0xcc46('0x41')](handleError(_0x6e2ba,null));};exports[_0xcc46('0x21')]=function(_0x218007,_0x8b1eaa){if(_0x218007[_0xcc46('0x43')]['id']){delete _0x218007['body']['id'];}return db[_0xcc46('0x29')]['find']({'where':{'id':_0x218007[_0xcc46('0x44')]['id']}})['then'](handleEntityNotFound(_0x8b1eaa,null))['then'](saveUpdates(_0x218007[_0xcc46('0x43')],null))['then'](respondWithResult(_0x8b1eaa,null))['catch'](handleError(_0x8b1eaa,null));};exports['destroy']=function(_0x481463,_0x3cba11){return db[_0xcc46('0x29')][_0xcc46('0x45')]({'where':{'id':_0x481463['params']['id']}})[_0xcc46('0x22')](handleEntityNotFound(_0x3cba11,null))[_0xcc46('0x22')](removeEntity(_0x3cba11,null))[_0xcc46('0x41')](handleError(_0x3cba11,null));};exports[_0xcc46('0x46')]=function(_0x59e2c9,_0x3bad35){return db[_0xcc46('0x29')][_0xcc46('0x46')]()['then'](respondWithResult(_0x3bad35,null))['catch'](handleError(_0x3bad35,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 02c9af7..078338a 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 _0x6523=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3c7a7b,_0x12a673){var _0x27980c=function(_0x5bfafe){while(--_0x5bfafe){_0x3c7a7b['push'](_0x3c7a7b['shift']());}};_0x27980c(++_0x12a673);}(_0x6523,0x1a6));var _0x3652=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x6523[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var logger=require('../../config/logger')(_0x3652('0x2'));var moment=require(_0x3652('0x3'));var BPromise=require(_0x3652('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3652('0x5'));var rimraf=require(_0x3652('0x6'));var config=require(_0x3652('0x7'));var attributes=require(_0x3652('0x8'));module['exports']=function(_0x204f81,_0x18f1c3){return _0x204f81[_0x3652('0x9')](_0x3652('0xa'),attributes,{'tableName':_0x3652('0xb'),'paranoid':![],'indexes':[{'name':_0x3652('0xc'),'fields':[_0x3652('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a4=['report_mail_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailTransferReport'];(function(_0x4ec4f8,_0x1098cc){var _0x573b24=function(_0x10addc){while(--_0x10addc){_0x4ec4f8['push'](_0x4ec4f8['shift']());}};_0x573b24(++_0x1098cc);}(_0xc0a4,0x147));var _0x4c0a=function(_0x54397b,_0x1c2899){_0x54397b=_0x54397b-0x0;var _0x3cd405=_0xc0a4[_0x54397b];return _0x3cd405;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var logger=require(_0x4c0a('0x1'))(_0x4c0a('0x2'));var moment=require('moment');var BPromise=require(_0x4c0a('0x3'));var rp=require(_0x4c0a('0x4'));var fs=require('fs');var path=require(_0x4c0a('0x5'));var rimraf=require(_0x4c0a('0x6'));var config=require(_0x4c0a('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x4c0a('0x8')]=function(_0x1a78a1,_0x12af4b){return _0x1a78a1[_0x4c0a('0x9')](_0x4c0a('0xa'),attributes,{'tableName':_0x4c0a('0xb'),'paranoid':![],'indexes':[{'name':_0x4c0a('0xc'),'fields':[_0x4c0a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index f435061..f0090ba 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 _0x97d6=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x278f67,_0x4c6407){var _0x3d8f9d=function(_0x11ad67){while(--_0x11ad67){_0x278f67['push'](_0x278f67['shift']());}};_0x3d8f9d(++_0x4c6407);}(_0x97d6,0x7b));var _0x697d=function(_0x4a8eaf,_0x39ce59){_0x4a8eaf=_0x4a8eaf-0x0;var _0x5a658f=_0x97d6[_0x4a8eaf];return _0x5a658f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x697d('0x0'));var BPromise=require(_0x697d('0x1'));var rs=require(_0x697d('0x2'));var fs=require('fs');var Redis=require(_0x697d('0x3'));var db=require(_0x697d('0x4'))['db'];var utils=require(_0x697d('0x5'));var logger=require(_0x697d('0x6'))(_0x697d('0x7'));var config=require(_0x697d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x697d('0x9')][_0x697d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x505399,_0x5203af,_0x4906f7){return new BPromise(function(_0x5b79b4,_0x1d0e2e){return client[_0x697d('0xb')](_0x505399,_0x4906f7)[_0x697d('0xc')](function(_0x4367de){logger[_0x697d('0xd')](_0x697d('0xe'),_0x5203af,_0x697d('0xf'));logger['debug'](_0x697d('0x10'),_0x5203af,'request\x20sent',JSON['stringify'](_0x4367de));if(_0x4367de['error']){if(_0x4367de[_0x697d('0x11')][_0x697d('0x12')]===0x1f4){logger[_0x697d('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5203af,_0x4367de[_0x697d('0x11')][_0x697d('0x13')]);return _0x1d0e2e(_0x4367de['error'][_0x697d('0x13')]);}logger[_0x697d('0x11')](_0x697d('0xe'),_0x5203af,_0x4367de[_0x697d('0x11')][_0x697d('0x13')]);return _0x5b79b4(_0x4367de[_0x697d('0x11')]['message']);}else{logger[_0x697d('0xd')](_0x697d('0xe'),_0x5203af,_0x697d('0xf'));_0x5b79b4(_0x4367de[_0x697d('0x14')][_0x697d('0x13')]);}})[_0x697d('0x15')](function(_0x232919){logger[_0x697d('0x11')](_0x697d('0xe'),_0x5203af,_0x232919);_0x1d0e2e(_0x232919);});});} \ No newline at end of file +var _0x2f8a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x13eed4,_0x87b2d9){var _0xa34c29=function(_0x507f60){while(--_0x507f60){_0x13eed4['push'](_0x13eed4['shift']());}};_0xa34c29(++_0x87b2d9);}(_0x2f8a,0x18c));var _0xa2f8=function(_0x220349,_0x4034dd){_0x220349=_0x220349-0x0;var _0x21347c=_0x2f8a[_0x220349];return _0x21347c;};'use strict';var _=require('lodash');var util=require(_0xa2f8('0x0'));var moment=require(_0xa2f8('0x1'));var BPromise=require(_0xa2f8('0x2'));var rs=require(_0xa2f8('0x3'));var fs=require('fs');var Redis=require(_0xa2f8('0x4'));var db=require(_0xa2f8('0x5'))['db'];var utils=require(_0xa2f8('0x6'));var logger=require(_0xa2f8('0x7'))(_0xa2f8('0x8'));var config=require(_0xa2f8('0x9'));var jayson=require(_0xa2f8('0xa'));var client=jayson[_0xa2f8('0xb')][_0xa2f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x215d10,_0x4e631f,_0x10e833){return new BPromise(function(_0x626636,_0x5d089c){return client[_0xa2f8('0xd')](_0x215d10,_0x10e833)[_0xa2f8('0xe')](function(_0x34be98){logger[_0xa2f8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4e631f,_0xa2f8('0x10'));logger['debug'](_0xa2f8('0x11'),_0x4e631f,_0xa2f8('0x10'),JSON[_0xa2f8('0x12')](_0x34be98));if(_0x34be98[_0xa2f8('0x13')]){if(_0x34be98['error'][_0xa2f8('0x14')]===0x1f4){logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x4e631f,_0x34be98[_0xa2f8('0x13')][_0xa2f8('0x16')]);return _0x5d089c(_0x34be98[_0xa2f8('0x13')][_0xa2f8('0x16')]);}logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x4e631f,_0x34be98[_0xa2f8('0x13')][_0xa2f8('0x16')]);return _0x626636(_0x34be98[_0xa2f8('0x13')][_0xa2f8('0x16')]);}else{logger[_0xa2f8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4e631f,'request\x20sent');_0x626636(_0x34be98[_0xa2f8('0x17')][_0xa2f8('0x16')]);}})[_0xa2f8('0x18')](function(_0x417974){logger[_0xa2f8('0x13')](_0xa2f8('0x15'),_0x4e631f,_0x417974);_0x5d089c(_0x417974);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0e579b3..21f0659 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 _0xddb4=['get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x48c272,_0x115e4c){var _0x2ee9c7=function(_0x2af7df){while(--_0x2af7df){_0x48c272['push'](_0x48c272['shift']());}};_0x2ee9c7(++_0x115e4c);}(_0xddb4,0x19a));var _0x4ddb=function(_0xfb5b41,_0x5cbf71){_0xfb5b41=_0xfb5b41-0x0;var _0x53b1d1=_0xddb4[_0xfb5b41];return _0x53b1d1;};'use strict';var multer=require(_0x4ddb('0x0'));var util=require(_0x4ddb('0x1'));var path=require(_0x4ddb('0x2'));var timeout=require(_0x4ddb('0x3'));var express=require(_0x4ddb('0x4'));var router=express[_0x4ddb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ddb('0x6'));var interaction=require(_0x4ddb('0x7'));var config=require(_0x4ddb('0x8'));var controller=require(_0x4ddb('0x9'));router[_0x4ddb('0xa')]('/',auth[_0x4ddb('0xb')](),controller[_0x4ddb('0xc')]);router[_0x4ddb('0xa')](_0x4ddb('0xd'),auth[_0x4ddb('0xb')](),controller['describe']);router[_0x4ddb('0xa')](_0x4ddb('0xe'),auth[_0x4ddb('0xb')](),controller[_0x4ddb('0xf')]);router[_0x4ddb('0x10')]('/',auth[_0x4ddb('0xb')](),controller['create']);router[_0x4ddb('0x11')](_0x4ddb('0xe'),auth['isAuthenticated'](),controller[_0x4ddb('0x12')]);router[_0x4ddb('0x13')](_0x4ddb('0xe'),auth[_0x4ddb('0xb')](),controller[_0x4ddb('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc752=['get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc0eacc,_0x1ef0ad){var _0x1742a8=function(_0x3c413d){while(--_0x3c413d){_0xc0eacc['push'](_0xc0eacc['shift']());}};_0x1742a8(++_0x1ef0ad);}(_0xc752,0xa6));var _0x2c75=function(_0x4aad42,_0x4b065a){_0x4aad42=_0x4aad42-0x0;var _0x24fb73=_0xc752[_0x4aad42];return _0x24fb73;};'use strict';var multer=require(_0x2c75('0x0'));var util=require(_0x2c75('0x1'));var path=require(_0x2c75('0x2'));var timeout=require(_0x2c75('0x3'));var express=require(_0x2c75('0x4'));var router=express[_0x2c75('0x5')]();var fs_extra=require(_0x2c75('0x6'));var auth=require(_0x2c75('0x7'));var interaction=require(_0x2c75('0x8'));var config=require(_0x2c75('0x9'));var controller=require('./memberReport.controller');router[_0x2c75('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c75('0xa')](_0x2c75('0xb'),auth[_0x2c75('0xc')](),controller[_0x2c75('0xd')]);router[_0x2c75('0xa')](_0x2c75('0xe'),auth[_0x2c75('0xc')](),controller[_0x2c75('0xf')]);router[_0x2c75('0x10')]('/',auth[_0x2c75('0xc')](),controller[_0x2c75('0x11')]);router[_0x2c75('0x12')](_0x2c75('0xe'),auth[_0x2c75('0xc')](),controller[_0x2c75('0x13')]);router['delete'](_0x2c75('0xe'),auth[_0x2c75('0xc')](),controller[_0x2c75('0x14')]);module[_0x2c75('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d400e13..f7e5336 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 _0x8089=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','STRING'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0x8089,0x1de));var _0x9808=function(_0x84e97e,_0x101944){_0x84e97e=_0x84e97e-0x0;var _0x5c5c5a=_0x8089[_0x84e97e];return _0x5c5c5a;};'use strict';var Sequelize=require(_0x9808('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x9808('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9808('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x9808('0x2'),'comment':_0x9808('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9808('0x4')]},'exitAt':{'type':Sequelize[_0x9808('0x4')],'set':function(_0x2cd546){var _0x3eb6a1=moment(_0x2cd546);var _0x345e24=moment(this[_0x9808('0x5')](_0x9808('0x6')));var _0x139e95=_0x3eb6a1[_0x9808('0x7')](_0x345e24,_0x9808('0x8'));this[_0x9808('0x9')]('exitAt',_0x2cd546);this[_0x9808('0x9')](_0x9808('0xa'),_0x139e95>=0x0?_0x139e95:null);}},'data1':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x9808('0xc')},'data3':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xd')},'data4':{'type':Sequelize[_0x9808('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xe')},'role':{'type':Sequelize[_0x9808('0x1')]},'internal':{'type':Sequelize[_0x9808('0xf')]},'uniqueid':{'type':Sequelize[_0x9808('0x1')]}}; \ No newline at end of file +var _0x64c4=['INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0xb3275c,_0x2623c3){var _0x58e50b=function(_0x2303a3){while(--_0x2303a3){_0xb3275c['push'](_0xb3275c['shift']());}};_0x58e50b(++_0x2623c3);}(_0x64c4,0x11b));var _0x464c=function(_0x44b2f8,_0x988781){_0x44b2f8=_0x44b2f8-0x0;var _0x535c56=_0x64c4[_0x44b2f8];return _0x535c56;};'use strict';var Sequelize=require(_0x464c('0x0'));var moment=require(_0x464c('0x1'));module[_0x464c('0x2')]={'channel':{'type':Sequelize[_0x464c('0x3')]},'membername':{'type':Sequelize[_0x464c('0x3')]},'interface':{'type':Sequelize[_0x464c('0x3')]},'type':{'type':Sequelize[_0x464c('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x464c('0x4')},'duration':{'type':Sequelize[_0x464c('0x5')]},'enterAt':{'type':Sequelize[_0x464c('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x50f541){var _0x1ddd0b=moment(_0x50f541);var _0x5518bd=moment(this[_0x464c('0x7')](_0x464c('0x8')));var _0x1100b0=_0x1ddd0b['diff'](_0x5518bd,_0x464c('0x9'));this[_0x464c('0xa')]('exitAt',_0x50f541);this[_0x464c('0xa')](_0x464c('0xb'),_0x1100b0>=0x0?_0x1100b0:null);}},'data1':{'type':Sequelize[_0x464c('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x464c('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x464c('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x464c('0xe')},'data5':{'type':Sequelize[_0x464c('0x3')],'comment':_0x464c('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x464c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e2caf88..888a991 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x2eed14,_0x47b7d2){_0x2eed14=_0x2eed14-0x0;var _0x4408cd=_0xedd9[_0x2eed14];return _0x4408cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x333159,_0x68262e){var _0x2e29ac=function(_0xf4f1f){while(--_0xf4f1f){_0x333159['push'](_0x333159['shift']());}};_0x2e29ac(++_0x68262e);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index fe30de4..2dec9f1 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 _0xb1d2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MemberReport','../../config/logger','api'];(function(_0x598f1f,_0xa7d1c){var _0x26d77d=function(_0x176e50){while(--_0x176e50){_0x598f1f['push'](_0x598f1f['shift']());}};_0x26d77d(++_0xa7d1c);}(_0xb1d2,0x116));var _0x2b1d=function(_0x1d73cd,_0x3cdd69){_0x1d73cd=_0x1d73cd-0x0;var _0x5babb8=_0xb1d2[_0x1d73cd];return _0x5babb8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b1d('0x0'))(_0x2b1d('0x1'));var moment=require(_0x2b1d('0x2'));var BPromise=require(_0x2b1d('0x3'));var rp=require(_0x2b1d('0x4'));var fs=require('fs');var path=require(_0x2b1d('0x5'));var rimraf=require(_0x2b1d('0x6'));var config=require(_0x2b1d('0x7'));var attributes=require('./memberReport.attributes');module[_0x2b1d('0x8')]=function(_0x40f0ac,_0x35cc51){return _0x40f0ac['define'](_0x2b1d('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x42d4=['util','moment','bluebird','request-promise','rimraf','exports','define','report_member','membername_interface','membername','interface','lodash'];(function(_0x2d8b31,_0x3d216e){var _0x3e02b5=function(_0x44e9f4){while(--_0x44e9f4){_0x2d8b31['push'](_0x2d8b31['shift']());}};_0x3e02b5(++_0x3d216e);}(_0x42d4,0x8f));var _0x442d=function(_0x345284,_0xc566d7){_0x345284=_0x345284-0x0;var _0x5b6f42=_0x42d4[_0x345284];return _0x5b6f42;};'use strict';var _=require(_0x442d('0x0'));var util=require(_0x442d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x442d('0x2'));var BPromise=require(_0x442d('0x3'));var rp=require(_0x442d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x442d('0x5'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x442d('0x6')]=function(_0x4d4471,_0x225e94){return _0x4d4471[_0x442d('0x7')]('MemberReport',attributes,{'tableName':_0x442d('0x8'),'paranoid':![],'indexes':[{'name':_0x442d('0x9'),'fields':[_0x442d('0xa'),_0x442d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4bd3acf..9c75dd6 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 _0x535d=['result','catch','MemberReport','options','raw','limit','include','model','attributes','map','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x535d,0xe8));var _0xd535=function(_0x2ba9c2,_0x28dc65){_0x2ba9c2=_0x2ba9c2-0x0;var _0x50ee9f=_0x535d[_0x2ba9c2];return _0x50ee9f;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var moment=require('moment');var BPromise=require(_0xd535('0x2'));var rs=require(_0xd535('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd535('0x4'));var logger=require(_0xd535('0x5'))(_0xd535('0x6'));var config=require(_0xd535('0x7'));var jayson=require(_0xd535('0x8'));var client=jayson[_0xd535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52cbc5,_0x44e2bb,_0x20b2ae){return new BPromise(function(_0x4fba4f,_0x1c092f){return client['request'](_0x52cbc5,_0x20b2ae)[_0xd535('0xa')](function(_0x156eea){logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,'request\x20sent');logger[_0xd535('0xd')](_0xd535('0xe'),_0x44e2bb,_0xd535('0xf'),JSON[_0xd535('0x10')](_0x156eea));if(_0x156eea['error']){if(_0x156eea[_0xd535('0x11')][_0xd535('0x12')]===0x1f4){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x156eea[_0xd535('0x11')][_0xd535('0x13')]);return _0x1c092f(_0x156eea[_0xd535('0x11')]['message']);}logger[_0xd535('0x11')]('MemberReport,\x20%s,\x20%s',_0x44e2bb,_0x156eea['error'][_0xd535('0x13')]);return _0x4fba4f(_0x156eea[_0xd535('0x11')]['message']);}else{logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,_0xd535('0xf'));_0x4fba4f(_0x156eea[_0xd535('0x14')]['message']);}})[_0xd535('0x15')](function(_0x2b0f32){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x2b0f32);_0x1c092f(_0x2b0f32);});});}exports['GetMemberReport']=function(_0x921b2e){var _0x54ff85=this;return new Promise(function(_0x22d4e2,_0x4f2039){return db[_0xd535('0x16')]['findAll']({'raw':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x18')]===undefined?!![]:![]:!![],'where':_0x921b2e[_0xd535('0x17')]?_0x921b2e['options']['where']||null:null,'attributes':_0x921b2e[_0xd535('0x17')]?_0x921b2e['options']['attributes']||null:null,'limit':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x19')]||null:null,'include':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x1a')]?_['map'](_0x921b2e[_0xd535('0x17')][_0xd535('0x1a')],function(_0x42008f){return{'model':db[_0x42008f[_0xd535('0x1b')]],'as':_0x42008f['as'],'attributes':_0x42008f[_0xd535('0x1c')],'include':_0x42008f['include']?_['map'](_0x42008f[_0xd535('0x1a')],function(_0x1abfec){return{'model':db[_0x1abfec['model']],'as':_0x1abfec['as'],'attributes':_0x1abfec['attributes'],'include':_0x1abfec[_0xd535('0x1a')]?_[_0xd535('0x1d')](_0x1abfec[_0xd535('0x1a')],function(_0x551a99){return{'model':db[_0x551a99['model']],'as':_0x551a99['as'],'attributes':_0x551a99[_0xd535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd535('0xa')](function(_0x15769b){logger[_0xd535('0xb')](_0xd535('0x1e'),_0x921b2e);logger[_0xd535('0xd')](_0xd535('0x1e'),_0x921b2e,JSON['stringify'](_0x15769b));_0x22d4e2(_0x15769b);})[_0xd535('0x15')](function(_0x3ea7f7){logger['error']('GetMemberReport',_0x3ea7f7['message'],_0x921b2e);_0x4f2039(_0x54ff85[_0xd535('0x11')](0x1f4,_0x3ea7f7[_0xd535('0x13')]));});});};exports[_0xd535('0x1f')]=function(_0x2e6aff){var _0x3e4021=this;return new Promise(function(_0x47d5e2,_0x51ff66){return db[_0xd535('0x16')][_0xd535('0x20')](_0x2e6aff[_0xd535('0x21')],{'raw':_0x2e6aff[_0xd535('0x17')]?_0x2e6aff['options'][_0xd535('0x18')]===undefined?!![]:![]:!![]})[_0xd535('0xa')](function(_0x3f9b69){logger[_0xd535('0xb')](_0xd535('0x1f'),_0x2e6aff);logger[_0xd535('0xd')]('CreateMemberReport',_0x2e6aff,JSON[_0xd535('0x10')](_0x3f9b69));_0x47d5e2(_0x3f9b69);})[_0xd535('0x15')](function(_0xb4fef2){logger['error'](_0xd535('0x1f'),_0xb4fef2[_0xd535('0x13')],_0x2e6aff);_0x51ff66(_0x3e4021[_0xd535('0x11')](0x1f4,_0xb4fef2[_0xd535('0x13')]));});});};exports[_0xd535('0x22')]=function(_0x53d6c7){var _0x5204aa=this;return new Promise(function(_0x4effab,_0x17bf49){return db[_0xd535('0x16')][_0xd535('0x23')](_0x53d6c7[_0xd535('0x21')],{'raw':_0x53d6c7[_0xd535('0x17')]?_0x53d6c7[_0xd535('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d6c7['options']?_0x53d6c7[_0xd535('0x17')]['where']||null:null,'attributes':_0x53d6c7[_0xd535('0x17')]?_0x53d6c7['options'][_0xd535('0x1c')]||null:null,'limit':_0x53d6c7['options']?_0x53d6c7[_0xd535('0x17')]['limit']||null:null})[_0xd535('0xa')](function(_0x2624bc){logger[_0xd535('0xb')](_0xd535('0x22'),_0x53d6c7);logger['debug'](_0xd535('0x22'),_0x53d6c7,JSON[_0xd535('0x10')](_0x2624bc));_0x4effab(_0x2624bc);})['catch'](function(_0x3b3645){logger[_0xd535('0x11')](_0xd535('0x22'),_0x3b3645[_0xd535('0x13')],_0x53d6c7);_0x17bf49(_0x5204aa[_0xd535('0x11')](0x1f4,_0x3b3645[_0xd535('0x13')]));});});}; \ No newline at end of file +var _0xfcbe=['info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','debug','CreateMemberReport','UpdateMemberReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then'];(function(_0x3f4822,_0x310403){var _0xb8f85=function(_0x2772a2){while(--_0x2772a2){_0x3f4822['push'](_0x3f4822['shift']());}};_0xb8f85(++_0x310403);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x2ebe0a,_0x3b0570){_0x2ebe0a=_0x2ebe0a-0x0;var _0x29ca01=_0xfcbe[_0x2ebe0a];return _0x29ca01;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var moment=require(_0xefcb('0x1'));var BPromise=require(_0xefcb('0x2'));var rs=require(_0xefcb('0x3'));var fs=require('fs');var Redis=require(_0xefcb('0x4'));var db=require(_0xefcb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefcb('0x6'))(_0xefcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefcb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e15ab,_0x4bacb4,_0x4697fe){return new BPromise(function(_0x55cad2,_0x100aa1){return client[_0xefcb('0x9')](_0x4e15ab,_0x4697fe)[_0xefcb('0xa')](function(_0x5dc9cd){logger[_0xefcb('0xb')](_0xefcb('0xc'),_0x4bacb4,'request\x20sent');logger['debug'](_0xefcb('0xd'),_0x4bacb4,_0xefcb('0xe'),JSON[_0xefcb('0xf')](_0x5dc9cd));if(_0x5dc9cd[_0xefcb('0x10')]){if(_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x11')]===0x1f4){logger['error'](_0xefcb('0xc'),_0x4bacb4,_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);return _0x100aa1(_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x4bacb4,_0x5dc9cd[_0xefcb('0x10')][_0xefcb('0x12')]);return _0x55cad2(_0x5dc9cd['error'][_0xefcb('0x12')]);}else{logger['info'](_0xefcb('0xc'),_0x4bacb4,'request\x20sent');_0x55cad2(_0x5dc9cd[_0xefcb('0x13')][_0xefcb('0x12')]);}})[_0xefcb('0x14')](function(_0x187f0f){logger[_0xefcb('0x10')](_0xefcb('0xc'),_0x4bacb4,_0x187f0f);_0x100aa1(_0x187f0f);});});}exports['GetMemberReport']=function(_0x15fbec){var _0x8de41a=this;return new Promise(function(_0xe922c7,_0x4884be){return db[_0xefcb('0x15')][_0xefcb('0x16')]({'raw':_0x15fbec[_0xefcb('0x17')]?_0x15fbec['options'][_0xefcb('0x18')]===undefined?!![]:![]:!![],'where':_0x15fbec[_0xefcb('0x17')]?_0x15fbec['options'][_0xefcb('0x19')]||null:null,'attributes':_0x15fbec[_0xefcb('0x17')]?_0x15fbec[_0xefcb('0x17')][_0xefcb('0x1a')]||null:null,'limit':_0x15fbec[_0xefcb('0x17')]?_0x15fbec['options'][_0xefcb('0x1b')]||null:null,'include':_0x15fbec[_0xefcb('0x17')]?_0x15fbec[_0xefcb('0x17')][_0xefcb('0x1c')]?_[_0xefcb('0x1d')](_0x15fbec[_0xefcb('0x17')][_0xefcb('0x1c')],function(_0x2a74f6){return{'model':db[_0x2a74f6['model']],'as':_0x2a74f6['as'],'attributes':_0x2a74f6['attributes'],'include':_0x2a74f6['include']?_[_0xefcb('0x1d')](_0x2a74f6[_0xefcb('0x1c')],function(_0x457ff6){return{'model':db[_0x457ff6[_0xefcb('0x1e')]],'as':_0x457ff6['as'],'attributes':_0x457ff6[_0xefcb('0x1a')],'include':_0x457ff6[_0xefcb('0x1c')]?_[_0xefcb('0x1d')](_0x457ff6['include'],function(_0x3029d1){return{'model':db[_0x3029d1[_0xefcb('0x1e')]],'as':_0x3029d1['as'],'attributes':_0x3029d1[_0xefcb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xefcb('0xa')](function(_0x18f4ef){logger[_0xefcb('0xb')](_0xefcb('0x1f'),_0x15fbec);logger[_0xefcb('0x20')](_0xefcb('0x1f'),_0x15fbec,JSON[_0xefcb('0xf')](_0x18f4ef));_0xe922c7(_0x18f4ef);})[_0xefcb('0x14')](function(_0x160782){logger[_0xefcb('0x10')](_0xefcb('0x1f'),_0x160782[_0xefcb('0x12')],_0x15fbec);_0x4884be(_0x8de41a['error'](0x1f4,_0x160782[_0xefcb('0x12')]));});});};exports[_0xefcb('0x21')]=function(_0x296427){var _0x232d45=this;return new Promise(function(_0x301daa,_0xc83f28){return db[_0xefcb('0x15')]['create'](_0x296427['body'],{'raw':_0x296427[_0xefcb('0x17')]?_0x296427[_0xefcb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xefcb('0xa')](function(_0x3b4f33){logger[_0xefcb('0xb')]('CreateMemberReport',_0x296427);logger[_0xefcb('0x20')](_0xefcb('0x21'),_0x296427,JSON[_0xefcb('0xf')](_0x3b4f33));_0x301daa(_0x3b4f33);})['catch'](function(_0x4fb22f){logger['error']('CreateMemberReport',_0x4fb22f[_0xefcb('0x12')],_0x296427);_0xc83f28(_0x232d45[_0xefcb('0x10')](0x1f4,_0x4fb22f[_0xefcb('0x12')]));});});};exports[_0xefcb('0x22')]=function(_0x2b1759){var _0x352db0=this;return new Promise(function(_0x32562b,_0x293176){return db[_0xefcb('0x15')][_0xefcb('0x23')](_0x2b1759[_0xefcb('0x24')],{'raw':_0x2b1759[_0xefcb('0x17')]?_0x2b1759[_0xefcb('0x17')][_0xefcb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1759[_0xefcb('0x17')]?_0x2b1759[_0xefcb('0x17')]['where']||null:null,'attributes':_0x2b1759[_0xefcb('0x17')]?_0x2b1759[_0xefcb('0x17')][_0xefcb('0x1a')]||null:null,'limit':_0x2b1759[_0xefcb('0x17')]?_0x2b1759['options'][_0xefcb('0x1b')]||null:null})['then'](function(_0x2ca1ee){logger[_0xefcb('0xb')](_0xefcb('0x22'),_0x2b1759);logger[_0xefcb('0x20')]('UpdateMemberReport',_0x2b1759,JSON[_0xefcb('0xf')](_0x2ca1ee));_0x32562b(_0x2ca1ee);})[_0xefcb('0x14')](function(_0x31e7c3){logger['error'](_0xefcb('0x22'),_0x31e7c3[_0xefcb('0x12')],_0x2b1759);_0x293176(_0x352db0[_0xefcb('0x10')](0x1f4,_0x31e7c3['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 52b8454..68588db 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 _0x7b14=['exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x11ea4e,_0x8f6455){var _0x4fe430=function(_0x5d8a7b){while(--_0x5d8a7b){_0x11ea4e['push'](_0x11ea4e['shift']());}};_0x4fe430(++_0x8f6455);}(_0x7b14,0x91));var _0x47b1=function(_0x64727e,_0x52fee0){_0x64727e=_0x64727e-0x0;var _0x30eea0=_0x7b14[_0x64727e];return _0x30eea0;};'use strict';var multer=require(_0x47b1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47b1('0x1')]();var fs_extra=require(_0x47b1('0x2'));var auth=require(_0x47b1('0x3'));var interaction=require(_0x47b1('0x4'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x47b1('0x5')]('/',controller[_0x47b1('0x6')]);module[_0x47b1('0x7')]=router; \ No newline at end of file +var _0x58bd=['../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util','path','express','../../components/auth/service'];(function(_0x273ca4,_0xf2e8c6){var _0x5800fb=function(_0x16ff4a){while(--_0x16ff4a){_0x273ca4['push'](_0x273ca4['shift']());}};_0x5800fb(++_0xf2e8c6);}(_0x58bd,0x18b));var _0xd58b=function(_0x17c092,_0x1b64f4){_0x17c092=_0x17c092-0x0;var _0x5f0e19=_0x58bd[_0x17c092];return _0x5f0e19;};'use strict';var multer=require(_0xd58b('0x0'));var util=require(_0xd58b('0x1'));var path=require(_0xd58b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd58b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd58b('0x4'));var interaction=require(_0xd58b('0x5'));var config=require(_0xd58b('0x6'));var controller=require(_0xd58b('0x7'));router[_0xd58b('0x8')]('/',controller['index']);module[_0xd58b('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 9a4f29d..5756416 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 _0x4e23=['STRING','version','sequelize'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0x4e23,0xb3));var _0x34e2=function(_0x458a3f,_0x207fc6){_0x458a3f=_0x458a3f-0x0;var _0x481b96=_0x4e23[_0x458a3f];return _0x481b96;};'use strict';var Sequelize=require(_0x34e2('0x0'));module['exports']={'version':{'type':Sequelize[_0x34e2('0x1')],'unique':_0x34e2('0x2')}}; \ No newline at end of file +var _0xa783=['STRING','version','sequelize'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xa783,0x18e));var _0x3a78=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xa783[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0x3a78('0x0'));module['exports']={'version':{'type':Sequelize[_0x3a78('0x1')],'unique':_0x3a78('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 0ab0cfe..07817df 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 _0x3a32=['limit','count','set','Content-Range','json','reject','update','then','sendStatus','stack','name','index','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','Migration','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined'];(function(_0x301813,_0x32ee63){var _0x54b093=function(_0x4f86d9){while(--_0x4f86d9){_0x301813['push'](_0x301813['shift']());}};_0x54b093(++_0x32ee63);}(_0x3a32,0x65));var _0x23a3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x3a32[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x23a3('0x0'));var rimraf=require(_0x23a3('0x1'));var zipdir=require(_0x23a3('0x2'));var jsonpatch=require(_0x23a3('0x3'));var rp=require(_0x23a3('0x4'));var moment=require('moment');var BPromise=require(_0x23a3('0x5'));var Mustache=require(_0x23a3('0x6'));var util=require(_0x23a3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x23a3('0x8'));var ejs=require(_0x23a3('0x9'));var fs=require('fs');var fs_extra=require(_0x23a3('0xa'));var _=require(_0x23a3('0xb'));var squel=require(_0x23a3('0xc'));var crypto=require(_0x23a3('0xd'));var jsforce=require(_0x23a3('0xe'));var deskjs=require(_0x23a3('0xf'));var toCsv=require(_0x23a3('0x8'));var querystring=require(_0x23a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x23a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x23a3('0x12'));var as=require(_0x23a3('0x13'));var hardwareService=require(_0x23a3('0x14'));var logger=require(_0x23a3('0x15'))(_0x23a3('0x16'));var utils=require(_0x23a3('0x17'));var config=require(_0x23a3('0x18'));var licenseUtil=require(_0x23a3('0x19'));var db=require(_0x23a3('0x1a'))['db'];function respondWithStatusCode(_0x3861a8,_0x32aa83){_0x32aa83=_0x32aa83||0xcc;return function(_0xa162dd){if(_0xa162dd){return _0x3861a8['sendStatus'](_0x32aa83);}return _0x3861a8['status'](_0x32aa83)[_0x23a3('0x1b')]();};}function respondWithResult(_0x435264,_0x16ad4a){_0x16ad4a=_0x16ad4a||0xc8;return function(_0x50e690){if(_0x50e690){return _0x435264[_0x23a3('0x1c')](_0x16ad4a)['json'](_0x50e690);}};}function respondWithFilteredResult(_0x4d2bad,_0x4cbfda){return function(_0x1b1c56){if(_0x1b1c56){var _0x7bc65c=typeof _0x4cbfda[_0x23a3('0x1d')]===_0x23a3('0x1e')&&typeof _0x4cbfda[_0x23a3('0x1f')]===_0x23a3('0x1e');var _0x23aa6b=_0x1b1c56[_0x23a3('0x20')];var _0x451df4=_0x7bc65c?0x0:_0x4cbfda[_0x23a3('0x1d')];var _0x19ce9a=_0x7bc65c?_0x1b1c56['count']:_0x4cbfda['offset']+_0x4cbfda[_0x23a3('0x1f')];var _0x406aed;if(_0x19ce9a>=_0x23aa6b){_0x19ce9a=_0x23aa6b;_0x406aed=0xc8;}else{_0x406aed=0xce;}_0x4d2bad[_0x23a3('0x1c')](_0x406aed);return _0x4d2bad[_0x23a3('0x21')](_0x23a3('0x22'),_0x451df4+'-'+_0x19ce9a+'/'+_0x23aa6b)[_0x23a3('0x23')](_0x1b1c56);}return null;};}function patchUpdates(_0x475a79){return function(_0x875223){try{jsonpatch['apply'](_0x875223,_0x475a79,!![]);}catch(_0xd99e0){return BPromise[_0x23a3('0x24')](_0xd99e0);}return _0x875223['save']();};}function saveUpdates(_0x39badf,_0x883ffd){return function(_0x4a3b75){if(_0x4a3b75){return _0x4a3b75[_0x23a3('0x25')](_0x39badf)[_0x23a3('0x26')](function(_0x3704ea){return _0x3704ea;});}return null;};}function removeEntity(_0x51dbae,_0x5e543d){return function(_0x25c6b1){if(_0x25c6b1){return _0x25c6b1['destroy']()[_0x23a3('0x26')](function(){_0x51dbae[_0x23a3('0x1c')](0xcc)[_0x23a3('0x1b')]();});}};}function handleEntityNotFound(_0x4fa840,_0x5c3654){return function(_0x36b9b2){if(!_0x36b9b2){_0x4fa840[_0x23a3('0x27')](0x194);}return _0x36b9b2;};}function handleError(_0x10a6c6,_0x100ce1){_0x100ce1=_0x100ce1||0x1f4;return function(_0x58bd4d){logger['error'](_0x58bd4d[_0x23a3('0x28')]);if(_0x58bd4d[_0x23a3('0x29')]){delete _0x58bd4d['name'];}_0x10a6c6[_0x23a3('0x1c')](_0x100ce1)['send'](_0x58bd4d);};}exports[_0x23a3('0x2a')]=function(_0x39b1d9,_0x3e4dd8){var _0x3b4334={},_0x2051f9={},_0x12ed1c={'count':0x0,'rows':[]};var _0x46d535=_['map'](db['Migration'][_0x23a3('0x2b')],function(_0x430a11){return{'name':_0x430a11['fieldName'],'type':_0x430a11[_0x23a3('0x2c')]['key']};});_0x2051f9[_0x23a3('0x2d')]=_[_0x23a3('0x2e')](_0x46d535,_0x23a3('0x29'));_0x2051f9['query']=_[_0x23a3('0x2f')](_0x39b1d9[_0x23a3('0x30')]);_0x2051f9[_0x23a3('0x31')]=_['intersection'](_0x2051f9[_0x23a3('0x2d')],_0x2051f9[_0x23a3('0x30')]);_0x3b4334['attributes']=_[_0x23a3('0x32')](_0x2051f9['model'],qs[_0x23a3('0x33')](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x33')]));_0x3b4334[_0x23a3('0x34')]=_0x3b4334[_0x23a3('0x34')]['length']?_0x3b4334[_0x23a3('0x34')]:_0x2051f9[_0x23a3('0x2d')];if(!_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x35')](_0x23a3('0x36'))){_0x3b4334[_0x23a3('0x1f')]=qs[_0x23a3('0x1f')](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x1f')]);_0x3b4334[_0x23a3('0x1d')]=qs['offset'](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x1d')]);}_0x3b4334[_0x23a3('0x37')]=qs['sort'](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x38')]);_0x3b4334[_0x23a3('0x39')]=qs['filters'](_['pick'](_0x39b1d9[_0x23a3('0x30')],_0x2051f9[_0x23a3('0x31')]),_0x46d535);if(_0x39b1d9['query'][_0x23a3('0x3a')]){_0x3b4334[_0x23a3('0x39')]=_['merge'](_0x3b4334[_0x23a3('0x39')],{'$or':_[_0x23a3('0x2e')](_0x46d535,function(_0x3e35cb){if(_0x3e35cb[_0x23a3('0x2c')]!=='VIRTUAL'){var _0x48a1db={};_0x48a1db[_0x3e35cb['name']]={'$like':'%'+_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x3a')]+'%'};return _0x48a1db;}})});}_0x3b4334=_[_0x23a3('0x3b')]({},_0x3b4334,_0x39b1d9[_0x23a3('0x3c')]);var _0x2279b6={'where':_0x3b4334[_0x23a3('0x39')]};return db['Migration'][_0x23a3('0x20')](_0x2279b6)[_0x23a3('0x26')](function(_0x4b648b){_0x12ed1c[_0x23a3('0x20')]=_0x4b648b;if(_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x3d')]){_0x3b4334[_0x23a3('0x3e')]=[{'all':!![]}];}return db[_0x23a3('0x3f')]['findAll'](_0x3b4334);})[_0x23a3('0x26')](function(_0x10a353){_0x12ed1c[_0x23a3('0x40')]=_0x10a353;return _0x12ed1c;})['then'](respondWithFilteredResult(_0x3e4dd8,_0x3b4334))[_0x23a3('0x41')](handleError(_0x3e4dd8,null));}; \ No newline at end of file +var _0x4b26=['merge','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x4a25a8,_0x4d1fcb){var _0x350106=function(_0x19a846){while(--_0x19a846){_0x4a25a8['push'](_0x4a25a8['shift']());}};_0x350106(++_0x4d1fcb);}(_0x4b26,0x123));var _0x64b2=function(_0x58fc37,_0x2eaa0a){_0x58fc37=_0x58fc37-0x0;var _0x48d716=_0x4b26[_0x58fc37];return _0x48d716;};'use strict';var emlformat=require(_0x64b2('0x0'));var rimraf=require(_0x64b2('0x1'));var zipdir=require(_0x64b2('0x2'));var jsonpatch=require(_0x64b2('0x3'));var rp=require(_0x64b2('0x4'));var moment=require(_0x64b2('0x5'));var BPromise=require(_0x64b2('0x6'));var Mustache=require(_0x64b2('0x7'));var util=require(_0x64b2('0x8'));var path=require('path');var sox=require(_0x64b2('0x9'));var csv=require('to-csv');var ejs=require(_0x64b2('0xa'));var fs=require('fs');var fs_extra=require(_0x64b2('0xb'));var _=require('lodash');var squel=require(_0x64b2('0xc'));var crypto=require(_0x64b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x64b2('0xe'));var toCsv=require(_0x64b2('0xf'));var querystring=require('querystring');var Papa=require(_0x64b2('0x10'));var Redis=require('ioredis');var authService=require(_0x64b2('0x11'));var qs=require(_0x64b2('0x12'));var as=require(_0x64b2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64b2('0x14'))(_0x64b2('0x15'));var utils=require(_0x64b2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64b2('0x17'))['db'];function respondWithStatusCode(_0x16065e,_0xa57540){_0xa57540=_0xa57540||0xcc;return function(_0x4baf31){if(_0x4baf31){return _0x16065e[_0x64b2('0x18')](_0xa57540);}return _0x16065e[_0x64b2('0x19')](_0xa57540)[_0x64b2('0x1a')]();};}function respondWithResult(_0x468c18,_0x20e4bc){_0x20e4bc=_0x20e4bc||0xc8;return function(_0x182174){if(_0x182174){return _0x468c18['status'](_0x20e4bc)[_0x64b2('0x1b')](_0x182174);}};}function respondWithFilteredResult(_0x4fd45e,_0x2469a8){return function(_0x17e00){if(_0x17e00){var _0x5b38bc=typeof _0x2469a8['offset']===_0x64b2('0x1c')&&typeof _0x2469a8[_0x64b2('0x1d')]===_0x64b2('0x1c');var _0x222d86=_0x17e00[_0x64b2('0x1e')];var _0x102868=_0x5b38bc?0x0:_0x2469a8['offset'];var _0x41fbde=_0x5b38bc?_0x17e00['count']:_0x2469a8[_0x64b2('0x1f')]+_0x2469a8[_0x64b2('0x1d')];var _0x4d4e7c;if(_0x41fbde>=_0x222d86){_0x41fbde=_0x222d86;_0x4d4e7c=0xc8;}else{_0x4d4e7c=0xce;}_0x4fd45e[_0x64b2('0x19')](_0x4d4e7c);return _0x4fd45e[_0x64b2('0x20')]('Content-Range',_0x102868+'-'+_0x41fbde+'/'+_0x222d86)['json'](_0x17e00);}return null;};}function patchUpdates(_0x44b93f){return function(_0x4e5324){try{jsonpatch[_0x64b2('0x21')](_0x4e5324,_0x44b93f,!![]);}catch(_0x44b21a){return BPromise[_0x64b2('0x22')](_0x44b21a);}return _0x4e5324[_0x64b2('0x23')]();};}function saveUpdates(_0x231ecf,_0x21dda2){return function(_0x52912d){if(_0x52912d){return _0x52912d[_0x64b2('0x24')](_0x231ecf)['then'](function(_0x1409a6){return _0x1409a6;});}return null;};}function removeEntity(_0x2c646b,_0x31b926){return function(_0x3c39b4){if(_0x3c39b4){return _0x3c39b4['destroy']()[_0x64b2('0x25')](function(){_0x2c646b[_0x64b2('0x19')](0xcc)[_0x64b2('0x1a')]();});}};}function handleEntityNotFound(_0x38ff34,_0x4c7515){return function(_0x1b4ed8){if(!_0x1b4ed8){_0x38ff34['sendStatus'](0x194);}return _0x1b4ed8;};}function handleError(_0x32684c,_0x222eba){_0x222eba=_0x222eba||0x1f4;return function(_0x5db5de){logger[_0x64b2('0x26')](_0x5db5de[_0x64b2('0x27')]);if(_0x5db5de[_0x64b2('0x28')]){delete _0x5db5de[_0x64b2('0x28')];}_0x32684c[_0x64b2('0x19')](_0x222eba)[_0x64b2('0x29')](_0x5db5de);};}exports[_0x64b2('0x2a')]=function(_0x3b2034,_0x25d5dd){var _0x573200={},_0x4b10e1={},_0x558bb3={'count':0x0,'rows':[]};var _0x53be6d=_[_0x64b2('0x2b')](db[_0x64b2('0x2c')][_0x64b2('0x2d')],function(_0x28ebee){return{'name':_0x28ebee[_0x64b2('0x2e')],'type':_0x28ebee[_0x64b2('0x2f')][_0x64b2('0x30')]};});_0x4b10e1['model']=_[_0x64b2('0x2b')](_0x53be6d,_0x64b2('0x28'));_0x4b10e1[_0x64b2('0x31')]=_[_0x64b2('0x32')](_0x3b2034['query']);_0x4b10e1[_0x64b2('0x33')]=_['intersection'](_0x4b10e1[_0x64b2('0x34')],_0x4b10e1[_0x64b2('0x31')]);_0x573200[_0x64b2('0x35')]=_[_0x64b2('0x36')](_0x4b10e1[_0x64b2('0x34')],qs[_0x64b2('0x37')](_0x3b2034['query']['fields']));_0x573200[_0x64b2('0x35')]=_0x573200[_0x64b2('0x35')][_0x64b2('0x38')]?_0x573200['attributes']:_0x4b10e1[_0x64b2('0x34')];if(!_0x3b2034[_0x64b2('0x31')][_0x64b2('0x39')](_0x64b2('0x3a'))){_0x573200[_0x64b2('0x1d')]=qs[_0x64b2('0x1d')](_0x3b2034[_0x64b2('0x31')][_0x64b2('0x1d')]);_0x573200['offset']=qs[_0x64b2('0x1f')](_0x3b2034['query']['offset']);}_0x573200[_0x64b2('0x3b')]=qs['sort'](_0x3b2034[_0x64b2('0x31')][_0x64b2('0x3c')]);_0x573200[_0x64b2('0x3d')]=qs[_0x64b2('0x33')](_[_0x64b2('0x3e')](_0x3b2034[_0x64b2('0x31')],_0x4b10e1[_0x64b2('0x33')]),_0x53be6d);if(_0x3b2034[_0x64b2('0x31')][_0x64b2('0x3f')]){_0x573200[_0x64b2('0x3d')]=_[_0x64b2('0x40')](_0x573200[_0x64b2('0x3d')],{'$or':_[_0x64b2('0x2b')](_0x53be6d,function(_0xc50eb0){if(_0xc50eb0['type']!==_0x64b2('0x41')){var _0x364d91={};_0x364d91[_0xc50eb0[_0x64b2('0x28')]]={'$like':'%'+_0x3b2034['query'][_0x64b2('0x3f')]+'%'};return _0x364d91;}})});}_0x573200=_[_0x64b2('0x40')]({},_0x573200,_0x3b2034[_0x64b2('0x42')]);var _0x5b4c78={'where':_0x573200[_0x64b2('0x3d')]};return db[_0x64b2('0x2c')]['count'](_0x5b4c78)[_0x64b2('0x25')](function(_0x3c75f1){_0x558bb3[_0x64b2('0x1e')]=_0x3c75f1;if(_0x3b2034[_0x64b2('0x31')][_0x64b2('0x43')]){_0x573200[_0x64b2('0x44')]=[{'all':!![]}];}return db['Migration'][_0x64b2('0x45')](_0x573200);})[_0x64b2('0x25')](function(_0x2edd06){_0x558bb3[_0x64b2('0x46')]=_0x2edd06;return _0x558bb3;})[_0x64b2('0x25')](respondWithFilteredResult(_0x25d5dd,_0x573200))['catch'](handleError(_0x25d5dd,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4c7f326..6f18c73 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 _0xc2f5=['path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0xc2f5,0xd7));var _0x5c2f=function(_0x47d1d,_0x21feb6){_0x47d1d=_0x47d1d-0x0;var _0x47ce4e=_0xc2f5[_0x47d1d];return _0x47ce4e;};'use strict';var _=require(_0x5c2f('0x0'));var util=require(_0x5c2f('0x1'));var logger=require(_0x5c2f('0x2'))(_0x5c2f('0x3'));var moment=require(_0x5c2f('0x4'));var BPromise=require('bluebird');var rp=require(_0x5c2f('0x5'));var fs=require('fs');var path=require(_0x5c2f('0x6'));var rimraf=require(_0x5c2f('0x7'));var config=require(_0x5c2f('0x8'));var attributes=require(_0x5c2f('0x9'));module[_0x5c2f('0xa')]=function(_0xff34a7,_0x1133b7){return _0xff34a7['define'](_0x5c2f('0xb'),attributes,{'tableName':_0x5c2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b95=['rimraf','../../config/environment','exports','define','migrations','lodash','util','../../config/logger','api','request-promise'];(function(_0x2d570c,_0x36afb2){var _0x226026=function(_0xdbc7ea){while(--_0xdbc7ea){_0x2d570c['push'](_0x2d570c['shift']());}};_0x226026(++_0x36afb2);}(_0x3b95,0xa5));var _0x53b9=function(_0x339fd4,_0xf1cb71){_0x339fd4=_0x339fd4-0x0;var _0x3cffe4=_0x3b95[_0x339fd4];return _0x3cffe4;};'use strict';var _=require(_0x53b9('0x0'));var util=require(_0x53b9('0x1'));var logger=require(_0x53b9('0x2'))(_0x53b9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x53b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53b9('0x5'));var config=require(_0x53b9('0x6'));var attributes=require('./migration.attributes');module[_0x53b9('0x7')]=function(_0x429207,_0x5cfd2b){return _0x429207[_0x53b9('0x8')]('Migration',attributes,{'tableName':_0x53b9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ca83d1b..ea915dc 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 _0xa74d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa74d,0x1cf));var _0xda74=function(_0x483e1d,_0xfeab58){_0x483e1d=_0x483e1d-0x0;var _0x10cd26=_0xa74d[_0x483e1d];return _0x10cd26;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});} \ No newline at end of file +var _0x8f37=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8f37,0x190));var _0x78f3=function(_0x3932b4,_0x214db7){_0x3932b4=_0x3932b4-0x0;var _0xc5126c=_0x8f37[_0x3932b4];return _0xc5126c;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var moment=require(_0x78f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f3('0x3'));var db=require(_0x78f3('0x4'))['db'];var utils=require(_0x78f3('0x5'));var logger=require('../../config/logger')(_0x78f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x78f3('0x7'));var client=jayson['client'][_0x78f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc185,_0x492dc7,_0x58bd73){return new BPromise(function(_0x55e353,_0x35d861){return client[_0x78f3('0x9')](_0x3dc185,_0x58bd73)['then'](function(_0x20c081){logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));logger[_0x78f3('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x492dc7,_0x78f3('0xc'),JSON[_0x78f3('0xe')](_0x20c081));if(_0x20c081['error']){if(_0x20c081[_0x78f3('0xf')][_0x78f3('0x10')]===0x1f4){logger[_0x78f3('0xf')]('Migration,\x20%s,\x20%s',_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x35d861(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x55e353(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}else{logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));_0x55e353(_0x20c081[_0x78f3('0x12')][_0x78f3('0x11')]);}})[_0x78f3('0x13')](function(_0x39adfc){logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x39adfc);_0x35d861(_0x39adfc);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e2bc4aa..308bfbf 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 _0x85e6=['show','post','create','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85e6,0x1a5));var _0x685e=function(_0x104dfa,_0x5bd273){_0x104dfa=_0x104dfa-0x0;var _0x12ee10=_0x85e6[_0x104dfa];return _0x12ee10;};'use strict';var multer=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var path=require('path');var timeout=require(_0x685e('0x2'));var express=require(_0x685e('0x3'));var router=express['Router']();var fs_extra=require(_0x685e('0x4'));var auth=require(_0x685e('0x5'));var interaction=require(_0x685e('0x6'));var config=require('../../config/environment');var controller=require(_0x685e('0x7'));router['get']('/',auth[_0x685e('0x8')](),controller[_0x685e('0x9')]);router[_0x685e('0xa')]('/:id',auth[_0x685e('0x8')](),controller[_0x685e('0xb')]);router[_0x685e('0xc')]('/',auth[_0x685e('0x8')](),controller[_0x685e('0xd')]);router['put'](_0x685e('0xe'),auth['isAuthenticated'](),controller[_0x685e('0xf')]);router['delete'](_0x685e('0xe'),auth[_0x685e('0x8')](),controller[_0x685e('0x10')]);module[_0x685e('0x11')]=router; \ No newline at end of file +var _0x9f89=['../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e3005,_0x14f0ec){var _0x36ca7d=function(_0x41275e){while(--_0x41275e){_0x4e3005['push'](_0x4e3005['shift']());}};_0x36ca7d(++_0x14f0ec);}(_0x9f89,0x13d));var _0x99f8=function(_0x312cbb,_0x501f44){_0x312cbb=_0x312cbb-0x0;var _0x29c288=_0x9f89[_0x312cbb];return _0x29c288;};'use strict';var multer=require('multer');var util=require(_0x99f8('0x0'));var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require(_0x99f8('0x2'));var router=express[_0x99f8('0x3')]();var fs_extra=require(_0x99f8('0x4'));var auth=require(_0x99f8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x99f8('0x6'));var controller=require(_0x99f8('0x7'));router[_0x99f8('0x8')]('/',auth[_0x99f8('0x9')](),controller[_0x99f8('0xa')]);router[_0x99f8('0x8')](_0x99f8('0xb'),auth['isAuthenticated'](),controller[_0x99f8('0xc')]);router[_0x99f8('0xd')]('/',auth[_0x99f8('0x9')](),controller[_0x99f8('0xe')]);router['put'](_0x99f8('0xb'),auth[_0x99f8('0x9')](),controller[_0x99f8('0xf')]);router[_0x99f8('0x10')]('/:id',auth[_0x99f8('0x9')](),controller[_0x99f8('0x11')]);module[_0x99f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d4df522..eb2612d 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 _0x14a9=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x49f432,_0x70af7){var _0x5928df=function(_0x4c2484){while(--_0x4c2484){_0x49f432['push'](_0x49f432['shift']());}};_0x5928df(++_0x70af7);}(_0x14a9,0x164));var _0x914a=function(_0x3ab16e,_0x5bafcb){_0x3ab16e=_0x3ab16e-0x0;var _0x218b01=_0x14a9[_0x3ab16e];return _0x218b01;};'use strict';var Sequelize=require('sequelize');module[_0x914a('0x0')]={'type':{'type':Sequelize[_0x914a('0x1')](_0x914a('0x2'),_0x914a('0x3'),_0x914a('0x4'),_0x914a('0x5'))},'value':{'type':Sequelize[_0x914a('0x6')]},'username':{'type':Sequelize[_0x914a('0x6')]},'password':{'type':Sequelize[_0x914a('0x6')]}}; \ No newline at end of file +var _0x510a=['externip','stun','STRING','sequelize','localnet'];(function(_0xc06762,_0x115b96){var _0x48e797=function(_0x154c06){while(--_0x154c06){_0xc06762['push'](_0xc06762['shift']());}};_0x48e797(++_0x115b96);}(_0x510a,0x166));var _0xa510=function(_0x4815b,_0xbcd7ac){_0x4815b=_0x4815b-0x0;var _0x2cbc26=_0x510a[_0x4815b];return _0x2cbc26;};'use strict';var Sequelize=require(_0xa510('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa510('0x1'),_0xa510('0x2'),_0xa510('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa510('0x4')]},'password':{'type':Sequelize[_0xa510('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index cc535cc..e3f1a37 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 _0x1828=['catch','sendStatus','status','end','json','limit','undefined','offset','count','set','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','include','Network','findAll','rows','show','params','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','sequelize','STUN','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1828,0xb0));var _0x8182=function(_0x4d31ac,_0x1c3169){_0x4d31ac=_0x4d31ac-0x0;var _0x75d8a9=_0x1828[_0x4d31ac];return _0x75d8a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8182('0x0'));var jsonpatch=require(_0x8182('0x1'));var rp=require(_0x8182('0x2'));var moment=require(_0x8182('0x3'));var BPromise=require(_0x8182('0x4'));var Mustache=require('mustache');var util=require(_0x8182('0x5'));var path=require(_0x8182('0x6'));var sox=require(_0x8182('0x7'));var csv=require(_0x8182('0x8'));var ejs=require(_0x8182('0x9'));var fs=require('fs');var fs_extra=require(_0x8182('0xa'));var _=require(_0x8182('0xb'));var squel=require(_0x8182('0xc'));var crypto=require(_0x8182('0xd'));var jsforce=require(_0x8182('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8182('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8182('0xf'));var authService=require(_0x8182('0x10'));var qs=require(_0x8182('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8182('0x12'))(_0x8182('0x13'));var utils=require(_0x8182('0x14'));var config=require(_0x8182('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x8182('0x16'));var client=jayson['client'][_0x8182('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x37ba55,_0x2ad0d7,_0xc19afd,_0x2052fa){return new BPromise(function(_0x3e5ebe,_0x1796ba){var _0x5d34f5=_0x2052fa||client;return _0x5d34f5[_0x8182('0x18')](_0x37ba55,_0xc19afd)[_0x8182('0x19')](function(_0x5f46ff){logger[_0x8182('0x1a')](_0x8182('0x1b'),_0x2ad0d7,_0x8182('0x1c'));logger[_0x8182('0x1d')](_0x8182('0x1e'),_0x2ad0d7,'request\x20sent',JSON[_0x8182('0x1f')](_0x5f46ff));if(_0x5f46ff['error']){if(_0x5f46ff[_0x8182('0x20')][_0x8182('0x21')]===0x1f4){logger[_0x8182('0x20')](_0x8182('0x1b'),_0x2ad0d7,_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);return _0x1796ba(_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);}logger['error'](_0x8182('0x1b'),_0x2ad0d7,_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);return _0x3e5ebe(_0x5f46ff[_0x8182('0x20')]['message']);}else{logger[_0x8182('0x1a')](_0x8182('0x1b'),_0x2ad0d7,_0x8182('0x1c'));_0x3e5ebe(_0x5f46ff[_0x8182('0x23')][_0x8182('0x22')]);}})[_0x8182('0x24')](function(_0x3a66a5){logger['error'](_0x8182('0x1b'),_0x2ad0d7,_0x3a66a5);_0x1796ba(_0x3a66a5);});});}function respondWithStatusCode(_0x2bfd11,_0x51712f){_0x51712f=_0x51712f||0xcc;return function(_0x25cc49){if(_0x25cc49){return _0x2bfd11[_0x8182('0x25')](_0x51712f);}return _0x2bfd11[_0x8182('0x26')](_0x51712f)[_0x8182('0x27')]();};}function respondWithResult(_0x5afd59,_0x2e09a1){_0x2e09a1=_0x2e09a1||0xc8;return function(_0x22ef08){if(_0x22ef08){return _0x5afd59[_0x8182('0x26')](_0x2e09a1)[_0x8182('0x28')](_0x22ef08);}};}function respondWithFilteredResult(_0xe91e62,_0x295cc5){return function(_0x2eae3f){if(_0x2eae3f){var _0x20bb6c=typeof _0x295cc5['offset']==='undefined'&&typeof _0x295cc5[_0x8182('0x29')]===_0x8182('0x2a');var _0x4f7f96=_0x2eae3f['count'];var _0x4744f5=_0x20bb6c?0x0:_0x295cc5[_0x8182('0x2b')];var _0x5c8903=_0x20bb6c?_0x2eae3f[_0x8182('0x2c')]:_0x295cc5[_0x8182('0x2b')]+_0x295cc5['limit'];var _0x240d54;if(_0x5c8903>=_0x4f7f96){_0x5c8903=_0x4f7f96;_0x240d54=0xc8;}else{_0x240d54=0xce;}_0xe91e62['status'](_0x240d54);return _0xe91e62[_0x8182('0x2d')]('Content-Range',_0x4744f5+'-'+_0x5c8903+'/'+_0x4f7f96)[_0x8182('0x28')](_0x2eae3f);}return null;};}function patchUpdates(_0x5ac94f){return function(_0x2059f4){try{jsonpatch['apply'](_0x2059f4,_0x5ac94f,!![]);}catch(_0xfc8862){return BPromise[_0x8182('0x2e')](_0xfc8862);}return _0x2059f4[_0x8182('0x2f')]();};}function saveUpdates(_0x5efedf,_0x2804a6){return function(_0x31fff9){if(_0x31fff9){return _0x31fff9[_0x8182('0x30')](_0x5efedf)[_0x8182('0x19')](function(_0x7bda3e){return _0x7bda3e;});}return null;};}function removeEntity(_0x4c9b77,_0x1ecf41){return function(_0x26fd47){if(_0x26fd47){return _0x26fd47[_0x8182('0x31')]()[_0x8182('0x19')](function(){_0x4c9b77[_0x8182('0x26')](0xcc)[_0x8182('0x27')]();});}};}function handleEntityNotFound(_0x17984e,_0x3f5d1e){return function(_0x1b46d4){if(!_0x1b46d4){_0x17984e[_0x8182('0x25')](0x194);}return _0x1b46d4;};}function handleError(_0x563c0f,_0x2a71b6){_0x2a71b6=_0x2a71b6||0x1f4;return function(_0x55eeaa){logger['error'](_0x55eeaa[_0x8182('0x32')]);if(_0x55eeaa[_0x8182('0x33')]){delete _0x55eeaa[_0x8182('0x33')];}_0x563c0f[_0x8182('0x26')](_0x2a71b6)[_0x8182('0x34')](_0x55eeaa);};}exports[_0x8182('0x35')]=function(_0x389abe,_0x50a194){var _0x45e283={},_0x3094d7={},_0x541c97={'count':0x0,'rows':[]};var _0x75f7f8=_[_0x8182('0x36')](db['Network'][_0x8182('0x37')],function(_0x260039){return{'name':_0x260039[_0x8182('0x38')],'type':_0x260039['type'][_0x8182('0x39')]};});_0x3094d7['model']=_[_0x8182('0x36')](_0x75f7f8,_0x8182('0x33'));_0x3094d7[_0x8182('0x3a')]=_[_0x8182('0x3b')](_0x389abe[_0x8182('0x3a')]);_0x3094d7['filters']=_[_0x8182('0x3c')](_0x3094d7[_0x8182('0x3d')],_0x3094d7['query']);_0x45e283[_0x8182('0x3e')]=_['intersection'](_0x3094d7[_0x8182('0x3d')],qs[_0x8182('0x3f')](_0x389abe['query'][_0x8182('0x3f')]));_0x45e283[_0x8182('0x3e')]=_0x45e283['attributes'][_0x8182('0x40')]?_0x45e283['attributes']:_0x3094d7['model'];if(!_0x389abe[_0x8182('0x3a')][_0x8182('0x41')](_0x8182('0x42'))){_0x45e283[_0x8182('0x29')]=qs[_0x8182('0x29')](_0x389abe[_0x8182('0x3a')][_0x8182('0x29')]);_0x45e283[_0x8182('0x2b')]=qs['offset'](_0x389abe['query'][_0x8182('0x2b')]);}_0x45e283[_0x8182('0x43')]=qs[_0x8182('0x44')](_0x389abe[_0x8182('0x3a')][_0x8182('0x44')]);_0x45e283[_0x8182('0x45')]=qs[_0x8182('0x46')](_['pick'](_0x389abe[_0x8182('0x3a')],_0x3094d7[_0x8182('0x46')]),_0x75f7f8);if(_0x389abe['query']['filter']){_0x45e283[_0x8182('0x45')]=_[_0x8182('0x47')](_0x45e283[_0x8182('0x45')],{'$or':_[_0x8182('0x36')](_0x75f7f8,function(_0x3fa3f9){if(_0x3fa3f9[_0x8182('0x48')]!==_0x8182('0x49')){var _0xfa049a={};_0xfa049a[_0x3fa3f9[_0x8182('0x33')]]={'$like':'%'+_0x389abe[_0x8182('0x3a')][_0x8182('0x4a')]+'%'};return _0xfa049a;}})});}_0x45e283=_[_0x8182('0x47')]({},_0x45e283,_0x389abe[_0x8182('0x4b')]);var _0x6f13b5={'where':_0x45e283[_0x8182('0x45')]};return db['Network'][_0x8182('0x2c')](_0x6f13b5)['then'](function(_0x52f4c3){_0x541c97[_0x8182('0x2c')]=_0x52f4c3;if(_0x389abe['query']['includeAll']){_0x45e283[_0x8182('0x4c')]=[{'all':!![]}];}return db[_0x8182('0x4d')][_0x8182('0x4e')](_0x45e283);})[_0x8182('0x19')](function(_0x25b4d8){_0x541c97[_0x8182('0x4f')]=_0x25b4d8;return _0x541c97;})[_0x8182('0x19')](respondWithFilteredResult(_0x50a194,_0x45e283))[_0x8182('0x24')](handleError(_0x50a194,null));};exports[_0x8182('0x50')]=function(_0x40534f,_0xd4c8a){var _0x1bed10={'raw':!![],'where':{'id':_0x40534f[_0x8182('0x51')]['id']}},_0xd59bd0={};_0xd59bd0[_0x8182('0x3d')]=_['keys'](db[_0x8182('0x4d')][_0x8182('0x37')]);_0xd59bd0[_0x8182('0x3a')]=_[_0x8182('0x3b')](_0x40534f['query']);_0xd59bd0['filters']=_[_0x8182('0x3c')](_0xd59bd0['model'],_0xd59bd0[_0x8182('0x3a')]);_0x1bed10[_0x8182('0x3e')]=_[_0x8182('0x3c')](_0xd59bd0[_0x8182('0x3d')],qs['fields'](_0x40534f[_0x8182('0x3a')]['fields']));_0x1bed10['attributes']=_0x1bed10['attributes'][_0x8182('0x40')]?_0x1bed10[_0x8182('0x3e')]:_0xd59bd0[_0x8182('0x3d')];if(_0x40534f[_0x8182('0x3a')]['includeAll']){_0x1bed10[_0x8182('0x4c')]=[{'all':!![]}];}_0x1bed10=_[_0x8182('0x47')]({},_0x1bed10,_0x40534f[_0x8182('0x4b')]);return db[_0x8182('0x4d')][_0x8182('0x52')](_0x1bed10)[_0x8182('0x19')](handleEntityNotFound(_0xd4c8a,null))[_0x8182('0x19')](respondWithResult(_0xd4c8a,null))[_0x8182('0x24')](handleError(_0xd4c8a,null));};exports[_0x8182('0x53')]=function(_0x19491b,_0x1526ad,_0x52e09a){var _0x444a20;return db['sequelize']['transaction'](function(_0x3cb802){return db[_0x8182('0x4d')][_0x8182('0x53')](_0x19491b['body'],{'raw':!![]})[_0x8182('0x19')](function(_0xfb9d7e){_0x444a20=_0xfb9d7e;return db[_0x8182('0x4d')][_0x8182('0x4e')]({'where':{'type':_0x19491b[_0x8182('0x54')]['type']},'raw':!![]});})['then'](function(_0x990b96){if(_0x444a20['type'][_0x8182('0x55')]()=='STUN'){var _0x168b46=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x59')),_0x8182('0x5a'));var _0x383c8d=ejs[_0x8182('0x5b')](_0x168b46,{'networks':_0x990b96||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0x383c8d);return respondWithRpcPromise('Reload',_0x8182('0x53'),{'module':_0x8182('0x5e')});}else if(_0x444a20[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x5f')){var _0x3f7310=fs[_0x8182('0x56')](path[_0x8182('0x57')](config['root'],_0x8182('0x60')),'utf8');var _0x16b34c=ejs[_0x8182('0x5b')](_0x3f7310,{'networks':_0x990b96||[]});fs['writeFileSync'](_0x8182('0x61'),_0x16b34c);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x53'),{'module':_0x8182('0x5e')});}else{var _0x140881=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x42012f=ejs[_0x8182('0x5b')](_0x140881,{'networks':_0x990b96||[]});fs[_0x8182('0x5c')](util[_0x8182('0x64')](_0x8182('0x65'),_0x19491b[_0x8182('0x54')]['type']['toLowerCase']()),_0x42012f);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x53'),{'module':_0x8182('0x66')});}return null;})[_0x8182('0x19')](function(){return _0x444a20;});})[_0x8182('0x19')](respondWithResult(_0x1526ad,0xc9))[_0x8182('0x24')](handleError(_0x1526ad,null));};exports[_0x8182('0x30')]=function(_0x51720b,_0x48ee79,_0x1e3d4f){var _0x42e07f;return db[_0x8182('0x67')]['transaction'](function(_0x175b3e){return db[_0x8182('0x4d')]['find']({'where':{'id':_0x51720b[_0x8182('0x51')]['id']}})[_0x8182('0x19')](handleEntityNotFound(_0x48ee79,null))[_0x8182('0x19')](saveUpdates(_0x51720b[_0x8182('0x54')],null))[_0x8182('0x19')](function(_0x5374af){if(_0x5374af){_0x42e07f=_0x5374af;return db[_0x8182('0x4d')][_0x8182('0x4e')]({'where':{'type':_0x42e07f['type']},'raw':!![]});}return null;})[_0x8182('0x19')](function(_0x4dd724){if(_0x42e07f[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x68')){var _0x243518=fs[_0x8182('0x56')](path['join'](config[_0x8182('0x58')],_0x8182('0x59')),_0x8182('0x5a'));var _0x9adf40=ejs[_0x8182('0x5b')](_0x243518,{'networks':_0x4dd724||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0x9adf40);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x30'),{'module':_0x8182('0x5e')});}else if(_0x42e07f[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x5f')){var _0x354650=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x60')),_0x8182('0x5a'));var _0x57228d=ejs[_0x8182('0x5b')](_0x354650,{'networks':_0x4dd724||[]});fs[_0x8182('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x57228d);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x30'),{'module':_0x8182('0x5e')});}else{var _0x5001d7=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x4e79df=ejs[_0x8182('0x5b')](_0x5001d7,{'networks':_0x4dd724||[]});fs['writeFileSync'](util[_0x8182('0x64')](_0x8182('0x65'),_0x51720b[_0x8182('0x54')][_0x8182('0x48')][_0x8182('0x69')]()),_0x4e79df);return respondWithRpcPromise(_0x8182('0x62'),'update',{'module':_0x8182('0x66')});}return null;})[_0x8182('0x19')](function(_0x1d17ee){if(_0x1d17ee){return _0x42e07f;}return null;});})[_0x8182('0x19')](respondWithResult(_0x48ee79,null))[_0x8182('0x24')](handleError(_0x48ee79,null));};exports['destroy']=function(_0x27f2ec,_0x89661e,_0x174596){var _0x2dd09f;return db[_0x8182('0x4d')][_0x8182('0x52')]({'where':{'id':_0x27f2ec[_0x8182('0x51')]['id']}})[_0x8182('0x19')](function(_0x50bcbf){_0x2dd09f=_0x50bcbf;return _0x50bcbf;})[_0x8182('0x19')](handleEntityNotFound(_0x89661e,null))[_0x8182('0x19')](removeEntity(_0x89661e,null))['then'](function(){if(_0x2dd09f){return db['Network'][_0x8182('0x4e')]({'where':{'type':_0x2dd09f[_0x8182('0x48')]},'raw':!![]});}})[_0x8182('0x19')](function(_0x1384c0){if(_0x2dd09f['type']['toUpperCase']()==_0x8182('0x68')){var _0x42760f=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],'server/files/templates/stun_multiple.ejs'),_0x8182('0x5a'));var _0xb2c64=ejs[_0x8182('0x5b')](_0x42760f,{'networks':_0x1384c0||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0xb2c64);return respondWithRpcPromise('Reload',_0x8182('0x31'),{'module':_0x8182('0x5e')});}else if(_0x2dd09f[_0x8182('0x48')][_0x8182('0x55')]()==_0x8182('0x5f')){var _0x6323df=fs[_0x8182('0x56')](path[_0x8182('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8182('0x5a'));var _0x1033d0=ejs[_0x8182('0x5b')](_0x6323df,{'networks':_0x1384c0||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1033d0);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x31'),{'module':_0x8182('0x5e')});}else{var _0x36a859=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x915458=ejs[_0x8182('0x5b')](_0x36a859,{'networks':_0x1384c0||[]});fs[_0x8182('0x5c')](util[_0x8182('0x64')](_0x8182('0x65'),_0x27f2ec['body'][_0x8182('0x48')][_0x8182('0x69')]()),_0x915458);return respondWithRpcPromise(_0x8182('0x62'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x8182('0x24')](handleError(_0x89661e,null));}; \ No newline at end of file +var _0x4226=['end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','length','includeAll','find','create','transaction','body','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','sequelize','server/files/templates/stun_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/turn_xcally.conf','rimraf','moment','bluebird','util','path','sox','to-csv','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','../../mysqldb','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status'];(function(_0x5a6fb9,_0x26154b){var _0x591b12=function(_0x4759c3){while(--_0x4759c3){_0x5a6fb9['push'](_0x5a6fb9['shift']());}};_0x591b12(++_0x26154b);}(_0x4226,0x1dc));var _0x6422=function(_0x98828d,_0xe82cc4){_0x98828d=_0x98828d-0x0;var _0x215bf3=_0x4226[_0x98828d];return _0x215bf3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6422('0x1'));var BPromise=require(_0x6422('0x2'));var Mustache=require('mustache');var util=require(_0x6422('0x3'));var path=require(_0x6422('0x4'));var sox=require(_0x6422('0x5'));var csv=require(_0x6422('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6422('0x7'));var crypto=require('crypto');var jsforce=require(_0x6422('0x8'));var deskjs=require(_0x6422('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6422('0xa'));var Papa=require(_0x6422('0xb'));var Redis=require('ioredis');var authService=require(_0x6422('0xc'));var qs=require(_0x6422('0xd'));var as=require(_0x6422('0xe'));var hardwareService=require(_0x6422('0xf'));var logger=require(_0x6422('0x10'))(_0x6422('0x11'));var utils=require(_0x6422('0x12'));var config=require(_0x6422('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6422('0x14'))['db'];var jayson=require(_0x6422('0x15'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x399362,_0x2e4b66,_0x47caf2,_0x31afe5){return new BPromise(function(_0x52c5a9,_0xa810b4){var _0x44421e=_0x31afe5||client;return _0x44421e[_0x6422('0x16')](_0x399362,_0x47caf2)[_0x6422('0x17')](function(_0x5e7103){logger[_0x6422('0x18')](_0x6422('0x19'),_0x2e4b66,_0x6422('0x1a'));logger[_0x6422('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x2e4b66,_0x6422('0x1a'),JSON['stringify'](_0x5e7103));if(_0x5e7103[_0x6422('0x1c')]){if(_0x5e7103['error'][_0x6422('0x1d')]===0x1f4){logger[_0x6422('0x1c')](_0x6422('0x19'),_0x2e4b66,_0x5e7103[_0x6422('0x1c')][_0x6422('0x1e')]);return _0xa810b4(_0x5e7103[_0x6422('0x1c')]['message']);}logger['error'](_0x6422('0x19'),_0x2e4b66,_0x5e7103[_0x6422('0x1c')][_0x6422('0x1e')]);return _0x52c5a9(_0x5e7103[_0x6422('0x1c')][_0x6422('0x1e')]);}else{logger[_0x6422('0x18')](_0x6422('0x19'),_0x2e4b66,_0x6422('0x1a'));_0x52c5a9(_0x5e7103['result']['message']);}})[_0x6422('0x1f')](function(_0x531199){logger[_0x6422('0x1c')](_0x6422('0x19'),_0x2e4b66,_0x531199);_0xa810b4(_0x531199);});});}function respondWithStatusCode(_0xb0e33a,_0x5c5ae1){_0x5c5ae1=_0x5c5ae1||0xcc;return function(_0x198ad7){if(_0x198ad7){return _0xb0e33a[_0x6422('0x20')](_0x5c5ae1);}return _0xb0e33a[_0x6422('0x21')](_0x5c5ae1)[_0x6422('0x22')]();};}function respondWithResult(_0x4a16b9,_0x55d714){_0x55d714=_0x55d714||0xc8;return function(_0xfd0571){if(_0xfd0571){return _0x4a16b9[_0x6422('0x21')](_0x55d714)[_0x6422('0x23')](_0xfd0571);}};}function respondWithFilteredResult(_0xca8eb2,_0x277f1a){return function(_0x47c073){if(_0x47c073){var _0x2ae5c3=typeof _0x277f1a[_0x6422('0x24')]===_0x6422('0x25')&&typeof _0x277f1a['limit']===_0x6422('0x25');var _0x26c68e=_0x47c073[_0x6422('0x26')];var _0x551346=_0x2ae5c3?0x0:_0x277f1a[_0x6422('0x24')];var _0x4d8c5c=_0x2ae5c3?_0x47c073['count']:_0x277f1a['offset']+_0x277f1a[_0x6422('0x27')];var _0x2bc665;if(_0x4d8c5c>=_0x26c68e){_0x4d8c5c=_0x26c68e;_0x2bc665=0xc8;}else{_0x2bc665=0xce;}_0xca8eb2[_0x6422('0x21')](_0x2bc665);return _0xca8eb2[_0x6422('0x28')]('Content-Range',_0x551346+'-'+_0x4d8c5c+'/'+_0x26c68e)[_0x6422('0x23')](_0x47c073);}return null;};}function patchUpdates(_0x153402){return function(_0x334f30){try{jsonpatch[_0x6422('0x29')](_0x334f30,_0x153402,!![]);}catch(_0x55ecae){return BPromise[_0x6422('0x2a')](_0x55ecae);}return _0x334f30[_0x6422('0x2b')]();};}function saveUpdates(_0x1aa79a,_0x3b990e){return function(_0x492438){if(_0x492438){return _0x492438[_0x6422('0x2c')](_0x1aa79a)[_0x6422('0x17')](function(_0x504848){return _0x504848;});}return null;};}function removeEntity(_0x5ab495,_0x3fa6cc){return function(_0x4f9b96){if(_0x4f9b96){return _0x4f9b96[_0x6422('0x2d')]()[_0x6422('0x17')](function(){_0x5ab495['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262fc9,_0x173d27){return function(_0x5d0aa6){if(!_0x5d0aa6){_0x262fc9[_0x6422('0x20')](0x194);}return _0x5d0aa6;};}function handleError(_0x39a935,_0x46b047){_0x46b047=_0x46b047||0x1f4;return function(_0xb4727){logger[_0x6422('0x1c')](_0xb4727[_0x6422('0x2e')]);if(_0xb4727['name']){delete _0xb4727[_0x6422('0x2f')];}_0x39a935['status'](_0x46b047)[_0x6422('0x30')](_0xb4727);};}exports[_0x6422('0x31')]=function(_0x287b8c,_0x51865b){var _0x40a4e2={},_0x165d85={},_0x6ba22f={'count':0x0,'rows':[]};var _0xfc3fea=_[_0x6422('0x32')](db[_0x6422('0x33')][_0x6422('0x34')],function(_0x4e29bb){return{'name':_0x4e29bb[_0x6422('0x35')],'type':_0x4e29bb[_0x6422('0x36')][_0x6422('0x37')]};});_0x165d85[_0x6422('0x38')]=_[_0x6422('0x32')](_0xfc3fea,_0x6422('0x2f'));_0x165d85[_0x6422('0x39')]=_[_0x6422('0x3a')](_0x287b8c['query']);_0x165d85[_0x6422('0x3b')]=_['intersection'](_0x165d85['model'],_0x165d85[_0x6422('0x39')]);_0x40a4e2[_0x6422('0x3c')]=_[_0x6422('0x3d')](_0x165d85[_0x6422('0x38')],qs['fields'](_0x287b8c[_0x6422('0x39')][_0x6422('0x3e')]));_0x40a4e2[_0x6422('0x3c')]=_0x40a4e2['attributes']['length']?_0x40a4e2['attributes']:_0x165d85['model'];if(!_0x287b8c[_0x6422('0x39')]['hasOwnProperty'](_0x6422('0x3f'))){_0x40a4e2['limit']=qs[_0x6422('0x27')](_0x287b8c[_0x6422('0x39')][_0x6422('0x27')]);_0x40a4e2[_0x6422('0x24')]=qs[_0x6422('0x24')](_0x287b8c[_0x6422('0x39')]['offset']);}_0x40a4e2[_0x6422('0x40')]=qs[_0x6422('0x41')](_0x287b8c[_0x6422('0x39')][_0x6422('0x41')]);_0x40a4e2[_0x6422('0x42')]=qs[_0x6422('0x3b')](_['pick'](_0x287b8c[_0x6422('0x39')],_0x165d85['filters']),_0xfc3fea);if(_0x287b8c['query']['filter']){_0x40a4e2['where']=_[_0x6422('0x43')](_0x40a4e2[_0x6422('0x42')],{'$or':_['map'](_0xfc3fea,function(_0x5b66b5){if(_0x5b66b5[_0x6422('0x36')]!==_0x6422('0x44')){var _0x35b9fb={};_0x35b9fb[_0x5b66b5[_0x6422('0x2f')]]={'$like':'%'+_0x287b8c[_0x6422('0x39')][_0x6422('0x45')]+'%'};return _0x35b9fb;}})});}_0x40a4e2=_[_0x6422('0x43')]({},_0x40a4e2,_0x287b8c[_0x6422('0x46')]);var _0x2eba78={'where':_0x40a4e2[_0x6422('0x42')]};return db[_0x6422('0x33')]['count'](_0x2eba78)[_0x6422('0x17')](function(_0x325f86){_0x6ba22f[_0x6422('0x26')]=_0x325f86;if(_0x287b8c[_0x6422('0x39')]['includeAll']){_0x40a4e2['include']=[{'all':!![]}];}return db['Network'][_0x6422('0x47')](_0x40a4e2);})['then'](function(_0x1d0bb4){_0x6ba22f[_0x6422('0x48')]=_0x1d0bb4;return _0x6ba22f;})['then'](respondWithFilteredResult(_0x51865b,_0x40a4e2))[_0x6422('0x1f')](handleError(_0x51865b,null));};exports[_0x6422('0x49')]=function(_0x10ace8,_0x22f1fe){var _0x3d915d={'raw':!![],'where':{'id':_0x10ace8[_0x6422('0x4a')]['id']}},_0x2fe87f={};_0x2fe87f[_0x6422('0x38')]=_[_0x6422('0x3a')](db[_0x6422('0x33')][_0x6422('0x34')]);_0x2fe87f[_0x6422('0x39')]=_[_0x6422('0x3a')](_0x10ace8[_0x6422('0x39')]);_0x2fe87f[_0x6422('0x3b')]=_[_0x6422('0x3d')](_0x2fe87f['model'],_0x2fe87f[_0x6422('0x39')]);_0x3d915d[_0x6422('0x3c')]=_[_0x6422('0x3d')](_0x2fe87f[_0x6422('0x38')],qs[_0x6422('0x3e')](_0x10ace8[_0x6422('0x39')]['fields']));_0x3d915d['attributes']=_0x3d915d[_0x6422('0x3c')][_0x6422('0x4b')]?_0x3d915d['attributes']:_0x2fe87f[_0x6422('0x38')];if(_0x10ace8[_0x6422('0x39')][_0x6422('0x4c')]){_0x3d915d['include']=[{'all':!![]}];}_0x3d915d=_[_0x6422('0x43')]({},_0x3d915d,_0x10ace8[_0x6422('0x46')]);return db[_0x6422('0x33')][_0x6422('0x4d')](_0x3d915d)['then'](handleEntityNotFound(_0x22f1fe,null))[_0x6422('0x17')](respondWithResult(_0x22f1fe,null))['catch'](handleError(_0x22f1fe,null));};exports[_0x6422('0x4e')]=function(_0x16b735,_0x3c7eee,_0x42df6f){var _0x3a2a6c;return db['sequelize'][_0x6422('0x4f')](function(_0x59d930){return db[_0x6422('0x33')][_0x6422('0x4e')](_0x16b735[_0x6422('0x50')],{'raw':!![]})[_0x6422('0x17')](function(_0x57112f){_0x3a2a6c=_0x57112f;return db[_0x6422('0x33')][_0x6422('0x47')]({'where':{'type':_0x16b735['body']['type']},'raw':!![]});})[_0x6422('0x17')](function(_0x38762f){if(_0x3a2a6c[_0x6422('0x36')]['toUpperCase']()==_0x6422('0x51')){var _0x44324e=fs['readFileSync'](path[_0x6422('0x52')](config[_0x6422('0x53')],'server/files/templates/stun_multiple.ejs'),_0x6422('0x54'));var _0x3fa118=ejs[_0x6422('0x55')](_0x44324e,{'networks':_0x38762f||[]});fs[_0x6422('0x56')](_0x6422('0x57'),_0x3fa118);return respondWithRpcPromise(_0x6422('0x58'),_0x6422('0x4e'),{'module':_0x6422('0x59')});}else if(_0x3a2a6c[_0x6422('0x36')][_0x6422('0x5a')]()==_0x6422('0x5b')){var _0x323e33=fs[_0x6422('0x5c')](path['join'](config[_0x6422('0x53')],_0x6422('0x5d')),_0x6422('0x54'));var _0x50b813=ejs[_0x6422('0x55')](_0x323e33,{'networks':_0x38762f||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x50b813);return respondWithRpcPromise(_0x6422('0x58'),_0x6422('0x4e'),{'module':_0x6422('0x59')});}else{var _0x3b1792=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],_0x6422('0x5e')),_0x6422('0x54'));var _0x2848e6=ejs['render'](_0x3b1792,{'networks':_0x38762f||[]});fs[_0x6422('0x56')](util[_0x6422('0x5f')]('/etc/asterisk/sip_xcally_%s.conf',_0x16b735['body'][_0x6422('0x36')][_0x6422('0x60')]()),_0x2848e6);return respondWithRpcPromise('Reload',_0x6422('0x4e'),{'module':'chan_sip.so'});}return null;})[_0x6422('0x17')](function(){return _0x3a2a6c;});})['then'](respondWithResult(_0x3c7eee,0xc9))[_0x6422('0x1f')](handleError(_0x3c7eee,null));};exports[_0x6422('0x2c')]=function(_0x4808dd,_0x291ee2,_0x3f4f5f){var _0x1091db;return db[_0x6422('0x61')][_0x6422('0x4f')](function(_0x3ec3b4){return db[_0x6422('0x33')]['find']({'where':{'id':_0x4808dd[_0x6422('0x4a')]['id']}})['then'](handleEntityNotFound(_0x291ee2,null))['then'](saveUpdates(_0x4808dd[_0x6422('0x50')],null))['then'](function(_0x177f1b){if(_0x177f1b){_0x1091db=_0x177f1b;return db['Network'][_0x6422('0x47')]({'where':{'type':_0x1091db[_0x6422('0x36')]},'raw':!![]});}return null;})[_0x6422('0x17')](function(_0x2836bc){if(_0x1091db[_0x6422('0x36')][_0x6422('0x5a')]()==_0x6422('0x51')){var _0x485e59=fs[_0x6422('0x5c')](path['join'](config['root'],_0x6422('0x62')),_0x6422('0x54'));var _0x2a44e7=ejs['render'](_0x485e59,{'networks':_0x2836bc||[]});fs[_0x6422('0x56')](_0x6422('0x57'),_0x2a44e7);return respondWithRpcPromise(_0x6422('0x58'),'update',{'module':_0x6422('0x59')});}else if(_0x1091db[_0x6422('0x36')][_0x6422('0x5a')]()==_0x6422('0x5b')){var _0x5e9f08=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],_0x6422('0x5d')),_0x6422('0x54'));var _0xebdf9e=ejs['render'](_0x5e9f08,{'networks':_0x2836bc||[]});fs[_0x6422('0x56')]('/etc/asterisk/turn_xcally.conf',_0xebdf9e);return respondWithRpcPromise(_0x6422('0x58'),'update',{'module':_0x6422('0x59')});}else{var _0x4a14cd=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],'server/files/templates/network.ejs'),_0x6422('0x54'));var _0x4dcc7f=ejs[_0x6422('0x55')](_0x4a14cd,{'networks':_0x2836bc||[]});fs['writeFileSync'](util[_0x6422('0x5f')](_0x6422('0x63'),_0x4808dd[_0x6422('0x50')][_0x6422('0x36')][_0x6422('0x60')]()),_0x4dcc7f);return respondWithRpcPromise('Reload','update',{'module':_0x6422('0x64')});}return null;})['then'](function(_0x177e30){if(_0x177e30){return _0x1091db;}return null;});})['then'](respondWithResult(_0x291ee2,null))[_0x6422('0x1f')](handleError(_0x291ee2,null));};exports['destroy']=function(_0x2f4adf,_0x486e6c,_0x268a98){var _0x19e1a0;return db['Network']['find']({'where':{'id':_0x2f4adf[_0x6422('0x4a')]['id']}})[_0x6422('0x17')](function(_0x2dc0bc){_0x19e1a0=_0x2dc0bc;return _0x2dc0bc;})[_0x6422('0x17')](handleEntityNotFound(_0x486e6c,null))['then'](removeEntity(_0x486e6c,null))[_0x6422('0x17')](function(){if(_0x19e1a0){return db[_0x6422('0x33')][_0x6422('0x47')]({'where':{'type':_0x19e1a0[_0x6422('0x36')]},'raw':!![]});}})['then'](function(_0x46e38e){if(_0x19e1a0[_0x6422('0x36')]['toUpperCase']()=='STUN'){var _0x3a981c=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],'server/files/templates/stun_multiple.ejs'),_0x6422('0x54'));var _0x584cdc=ejs['render'](_0x3a981c,{'networks':_0x46e38e||[]});fs['writeFileSync'](_0x6422('0x57'),_0x584cdc);return respondWithRpcPromise(_0x6422('0x58'),_0x6422('0x2d'),{'module':'res_stun_monitor.so'});}else if(_0x19e1a0[_0x6422('0x36')][_0x6422('0x5a')]()=='TURN'){var _0x27807e=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],'server/files/templates/turn_multiple.ejs'),_0x6422('0x54'));var _0x4d6b1f=ejs['render'](_0x27807e,{'networks':_0x46e38e||[]});fs[_0x6422('0x56')](_0x6422('0x65'),_0x4d6b1f);return respondWithRpcPromise(_0x6422('0x58'),_0x6422('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x1d393c=fs[_0x6422('0x5c')](path[_0x6422('0x52')](config[_0x6422('0x53')],_0x6422('0x5e')),_0x6422('0x54'));var _0x125f0c=ejs['render'](_0x1d393c,{'networks':_0x46e38e||[]});fs[_0x6422('0x56')](util[_0x6422('0x5f')](_0x6422('0x63'),_0x2f4adf['body'][_0x6422('0x36')][_0x6422('0x60')]()),_0x125f0c);return respondWithRpcPromise(_0x6422('0x58'),_0x6422('0x2d'),{'module':_0x6422('0x64')});}return null;})[_0x6422('0x1f')](handleError(_0x486e6c,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f9dcc57..4ed5a99 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 _0xb469=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb469,0x13b));var _0x9b46=function(_0x56da03,_0x2efc96){_0x56da03=_0x56da03-0x0;var _0x1e997f=_0xb469[_0x56da03];return _0x1e997f;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var moment=require(_0x9b46('0x4'));var BPromise=require(_0x9b46('0x5'));var rp=require(_0x9b46('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var attributes=require('./network.attributes');module[_0x9b46('0x9')]=function(_0x405d1c,_0x50b49e){return _0x405d1c[_0x9b46('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe02=['exports','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbe02,0x146));var _0x2be0=function(_0x1a5d3c,_0x121970){_0x1a5d3c=_0x1a5d3c-0x0;var _0x5d2e0b=_0xbe02[_0x1a5d3c];return _0x5d2e0b;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var rp=require(_0x2be0('0x5'));var fs=require('fs');var path=require(_0x2be0('0x6'));var rimraf=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var attributes=require(_0x2be0('0x9'));module[_0x2be0('0xa')]=function(_0x474a35,_0x39a2ca){return _0x474a35['define']('Network',attributes,{'tableName':_0x2be0('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 3503261..18637e0 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x488c7f,_0x1dcb1c){_0x488c7f=_0x488c7f-0x0;var _0x18e37c=_0x7a54[_0x488c7f];return _0x18e37c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x4e50f8,_0x1fbcd7){_0x4e50f8=_0x4e50f8-0x0;var _0x3540af=_0x7a54[_0x4e50f8];return _0x3540af;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e247398..37f584d 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 _0x19ec=['removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x19ec,0x10d));var _0xc19e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x19ec[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0xc19e('0x0'));var path=require('path');var timeout=require(_0xc19e('0x1'));var express=require(_0xc19e('0x2'));var router=express[_0xc19e('0x3')]();var fs_extra=require(_0xc19e('0x4'));var auth=require(_0xc19e('0x5'));var interaction=require(_0xc19e('0x6'));var config=require('../../config/environment');var controller=require(_0xc19e('0x7'));router['get']('/',auth[_0xc19e('0x8')](),controller[_0xc19e('0x9')]);router[_0xc19e('0xa')](_0xc19e('0xb'),auth['isAuthenticated'](),controller[_0xc19e('0xc')]);router[_0xc19e('0xa')](_0xc19e('0xd'),auth[_0xc19e('0x8')](),controller[_0xc19e('0xe')]);router['get'](_0xc19e('0xf'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x10')]);router['get'](_0xc19e('0x11'),auth['isAuthenticated'](),controller[_0xc19e('0x12')]);router[_0xc19e('0xa')]('/:id/applications',auth[_0xc19e('0x8')](),controller[_0xc19e('0x13')]);router[_0xc19e('0xa')](_0xc19e('0x14'),auth['isAuthenticated'](),controller[_0xc19e('0x15')]);router['get'](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller['getAgents']);router[_0xc19e('0x17')]('/',auth['isAuthenticated'](),controller[_0xc19e('0x18')]);router[_0xc19e('0x17')]('/:id/dispositions',auth[_0xc19e('0x8')](),controller[_0xc19e('0x19')]);router['post'](_0xc19e('0x11'),auth[_0xc19e('0x8')](),controller['addAnswer']);router[_0xc19e('0x17')](_0xc19e('0x1a'),controller['notify']);router[_0xc19e('0x17')]('/:id/applications',auth[_0xc19e('0x8')](),controller[_0xc19e('0x1b')]);router['post'](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x1c')]);router[_0xc19e('0x17')](_0xc19e('0x1d'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x1e')]);router[_0xc19e('0x1f')](_0xc19e('0xd'),auth['isAuthenticated'](),controller[_0xc19e('0x20')]);router[_0xc19e('0x21')](_0xc19e('0xd'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x22')]);router[_0xc19e('0x21')](_0xc19e('0xf'),auth[_0xc19e('0x8')](),controller['removeDispositions']);router[_0xc19e('0x21')](_0xc19e('0x11'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x23')]);router[_0xc19e('0x21')](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x24')]);module[_0xc19e('0x25')]=router; \ No newline at end of file +var _0x7e93=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','addApplications','send','/:id','update','destroy','delete','removeAgents','exports','multer','util','express'];(function(_0x475d45,_0x2cfe44){var _0x46b50e=function(_0x18ddc6){while(--_0x18ddc6){_0x475d45['push'](_0x475d45['shift']());}};_0x46b50e(++_0x2cfe44);}(_0x7e93,0xac));var _0x37e9=function(_0x1c2ff9,_0x2bbc97){_0x1c2ff9=_0x1c2ff9-0x0;var _0x5cc4d3=_0x7e93[_0x1c2ff9];return _0x5cc4d3;};'use strict';var multer=require(_0x37e9('0x0'));var util=require(_0x37e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x37e9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x37e9('0x3'));var interaction=require(_0x37e9('0x4'));var config=require(_0x37e9('0x5'));var controller=require(_0x37e9('0x6'));router[_0x37e9('0x7')]('/',auth[_0x37e9('0x8')](),controller[_0x37e9('0x9')]);router[_0x37e9('0x7')]('/describe',auth[_0x37e9('0x8')](),controller[_0x37e9('0xa')]);router[_0x37e9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x37e9('0xb')]);router[_0x37e9('0x7')](_0x37e9('0xc'),auth[_0x37e9('0x8')](),controller[_0x37e9('0xd')]);router[_0x37e9('0x7')](_0x37e9('0xe'),auth[_0x37e9('0x8')](),controller[_0x37e9('0xf')]);router[_0x37e9('0x7')](_0x37e9('0x10'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x11')]);router[_0x37e9('0x7')](_0x37e9('0x12'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x13')]);router[_0x37e9('0x7')](_0x37e9('0x14'),auth['isAuthenticated'](),controller[_0x37e9('0x15')]);router['post']('/',auth[_0x37e9('0x8')](),controller[_0x37e9('0x16')]);router['post'](_0x37e9('0xc'),auth[_0x37e9('0x8')](),controller['addDisposition']);router[_0x37e9('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x37e9('0x18')]);router[_0x37e9('0x17')](_0x37e9('0x19'),controller[_0x37e9('0x1a')]);router[_0x37e9('0x17')](_0x37e9('0x10'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x1b')]);router[_0x37e9('0x17')](_0x37e9('0x14'),auth[_0x37e9('0x8')](),controller['addAgents']);router[_0x37e9('0x17')]('/:id/send',auth[_0x37e9('0x8')](),controller[_0x37e9('0x1c')]);router['put'](_0x37e9('0x1d'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x1e')]);router['delete'](_0x37e9('0x1d'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x1f')]);router[_0x37e9('0x20')]('/:id/dispositions',auth[_0x37e9('0x8')](),controller['removeDispositions']);router[_0x37e9('0x20')](_0x37e9('0xe'),auth[_0x37e9('0x8')](),controller['removeAnswers']);router['delete'](_0x37e9('0x14'),auth[_0x37e9('0x8')](),controller[_0x37e9('0x21')]);module[_0x37e9('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5111b24..d9cfd10 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 _0x7f7c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x8d33b5,_0x256e21){var _0x3e2ed7=function(_0x1a01c1){while(--_0x1a01c1){_0x8d33b5['push'](_0x8d33b5['shift']());}};_0x3e2ed7(++_0x256e21);}(_0x7f7c,0x1b0));var _0xc7f7=function(_0x1f11d8,_0x20bd3e){_0x1f11d8=_0x1f11d8-0x0;var _0x972b4c=_0x7f7c[_0x1f11d8];return _0x972b4c;};'use strict';var Sequelize=require(_0xc7f7('0x0'));var rs=require(_0xc7f7('0x1'));module[_0xc7f7('0x2')]={'name':{'type':Sequelize[_0xc7f7('0x3')],'unique':_0xc7f7('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc7f7('0x3')]},'token':{'type':Sequelize[_0xc7f7('0x3')],'defaultValue':function(){return rs[_0xc7f7('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc7f7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc7f7('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc7f7('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc7f7('0xa'),'set':function(_0x4e1ea0){if(!_0x4e1ea0)this[_0xc7f7('0xb')]('mandatoryDispositionPauseId',null);this[_0xc7f7('0xb')](_0xc7f7('0xc'),_0x4e1ea0);}}}; \ No newline at end of file +var _0x01b0=['sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition'];(function(_0x59e9b0,_0x13187c){var _0x30941e=function(_0x501396){while(--_0x501396){_0x59e9b0['push'](_0x59e9b0['shift']());}};_0x30941e(++_0x13187c);}(_0x01b0,0x18c));var _0x001b=function(_0x4f7dcb,_0x693382){_0x4f7dcb=_0x4f7dcb-0x0;var _0x4537a1=_0x01b0[_0x4f7dcb];return _0x4537a1;};'use strict';var Sequelize=require(_0x001b('0x0'));var rs=require(_0x001b('0x1'));module[_0x001b('0x2')]={'name':{'type':Sequelize[_0x001b('0x3')],'unique':_0x001b('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x001b('0x3')]},'token':{'type':Sequelize[_0x001b('0x3')],'defaultValue':function(){return rs[_0x001b('0x5')]();}},'replyUri':{'type':Sequelize[_0x001b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x001b('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x001b('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x001b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x001b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x001b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x001b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x001b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x001b('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x001b('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b8736){if(!_0x2b8736)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x001b('0xa'),_0x2b8736);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 84ef7db..6587384 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 _0xb14a=['merge','VIRTUAL','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','nolimit','map','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','difference','updatedAt','createdAt','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','list','applications','orderBy','priority','asc','account','ListId','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','spread','dataValues','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x1c3d50,_0x4c7da4){var _0x30f991=function(_0xbd818c){while(--_0xbd818c){_0x1c3d50['push'](_0x1c3d50['shift']());}};_0x30f991(++_0x4c7da4);}(_0xb14a,0x72));var _0xab14=function(_0x51bbda,_0x5f572f){_0x51bbda=_0x51bbda-0x0;var _0x535172=_0xb14a[_0x51bbda];return _0x535172;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab14('0x0'));var zipdir=require(_0xab14('0x1'));var jsonpatch=require(_0xab14('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab14('0x3'));var Mustache=require(_0xab14('0x4'));var util=require(_0xab14('0x5'));var path=require(_0xab14('0x6'));var sox=require(_0xab14('0x7'));var csv=require(_0xab14('0x8'));var ejs=require(_0xab14('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab14('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab14('0xb'));var toCsv=require(_0xab14('0x8'));var querystring=require(_0xab14('0xc'));var Papa=require(_0xab14('0xd'));var Redis=require('ioredis');var authService=require(_0xab14('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xab14('0xf'));var hardwareService=require(_0xab14('0x10'));var logger=require(_0xab14('0x11'))('api');var utils=require(_0xab14('0x12'));var config=require(_0xab14('0x13'));var licenseUtil=require(_0xab14('0x14'));var db=require(_0xab14('0x15'))['db'];config[_0xab14('0x16')]=_[_0xab14('0x17')](config[_0xab14('0x16')],{'host':_0xab14('0x18'),'port':0x18eb});var socket=require(_0xab14('0x19'))(new Redis(config[_0xab14('0x16')]));require(_0xab14('0x1a'))[_0xab14('0x1b')](socket);var jayson=require(_0xab14('0x1c'));var client=jayson[_0xab14('0x1d')][_0xab14('0x1e')]({'port':0x232c});var client9002=jayson[_0xab14('0x1d')][_0xab14('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x30417f,_0x668955,_0x3a95e5,_0x31a517){return new BPromise(function(_0x39f124,_0x52b460){var _0x4a11ea=_0x31a517||client;return _0x4a11ea[_0xab14('0x1f')](_0x30417f,_0x3a95e5)[_0xab14('0x20')](function(_0x5610f7){logger[_0xab14('0x21')](_0xab14('0x22'),_0x668955,_0xab14('0x23'));logger[_0xab14('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x668955,_0xab14('0x23'),JSON[_0xab14('0x25')](_0x5610f7));if(_0x5610f7[_0xab14('0x26')]){if(_0x5610f7[_0xab14('0x26')]['code']===0x1f4){logger['error'](_0xab14('0x22'),_0x668955,_0x5610f7[_0xab14('0x26')][_0xab14('0x27')]);return _0x52b460(_0x5610f7['error'][_0xab14('0x27')]);}logger[_0xab14('0x26')](_0xab14('0x22'),_0x668955,_0x5610f7[_0xab14('0x26')][_0xab14('0x27')]);return _0x39f124(_0x5610f7['error'][_0xab14('0x27')]);}else{logger['info'](_0xab14('0x22'),_0x668955,'request\x20sent');_0x39f124(_0x5610f7[_0xab14('0x28')][_0xab14('0x27')]);}})[_0xab14('0x29')](function(_0x2d745e){logger[_0xab14('0x26')](_0xab14('0x22'),_0x668955,_0x2d745e);_0x52b460(_0x2d745e);});});}function respondWithStatusCode(_0x2b1c7a,_0x1848ad){_0x1848ad=_0x1848ad||0xcc;return function(_0x3a9c98){if(_0x3a9c98){return _0x2b1c7a[_0xab14('0x2a')](_0x1848ad);}return _0x2b1c7a['status'](_0x1848ad)['end']();};}function respondWithResult(_0x5a707c,_0x463e8a){_0x463e8a=_0x463e8a||0xc8;return function(_0x1ef1af){if(_0x1ef1af){return _0x5a707c[_0xab14('0x2b')](_0x463e8a)[_0xab14('0x2c')](_0x1ef1af);}};}function respondWithFilteredResult(_0x4a9aee,_0x1da46f){return function(_0x118b2d){if(_0x118b2d){var _0x76e4f8=typeof _0x1da46f[_0xab14('0x2d')]===_0xab14('0x2e')&&typeof _0x1da46f[_0xab14('0x2f')]==='undefined';var _0x743391=_0x118b2d[_0xab14('0x30')];var _0x22e776=_0x76e4f8?0x0:_0x1da46f[_0xab14('0x2d')];var _0xbec8bb=_0x76e4f8?_0x118b2d[_0xab14('0x30')]:_0x1da46f[_0xab14('0x2d')]+_0x1da46f[_0xab14('0x2f')];var _0x390da1;if(_0xbec8bb>=_0x743391){_0xbec8bb=_0x743391;_0x390da1=0xc8;}else{_0x390da1=0xce;}_0x4a9aee['status'](_0x390da1);return _0x4a9aee[_0xab14('0x31')](_0xab14('0x32'),_0x22e776+'-'+_0xbec8bb+'/'+_0x743391)['json'](_0x118b2d);}return null;};}function patchUpdates(_0x356f40){return function(_0x48a001){try{jsonpatch[_0xab14('0x33')](_0x48a001,_0x356f40,!![]);}catch(_0x84f3a5){return BPromise[_0xab14('0x34')](_0x84f3a5);}return _0x48a001['save']();};}function saveUpdates(_0x42051f,_0x2bc6c7){return function(_0xd70253){if(_0xd70253){return _0xd70253[_0xab14('0x35')](_0x42051f)[_0xab14('0x20')](function(_0x174b8a){return _0x174b8a;});}return null;};}function removeEntity(_0x3ef925,_0x1c3e94){return function(_0x544394){if(_0x544394){return _0x544394[_0xab14('0x36')]()['then'](function(){var _0x4bf74f=_0x544394['get']({'plain':!![]});var _0x34e697=_0xab14('0x37');return db[_0xab14('0x38')]['destroy']({'where':{'type':_0x34e697,'resourceId':_0x4bf74f['id']}})[_0xab14('0x20')](function(){return _0x544394;});})['then'](function(){_0x3ef925[_0xab14('0x2b')](0xcc)[_0xab14('0x39')]();});}};}function handleEntityNotFound(_0x3dce26,_0x3c05e4){return function(_0x9e1d27){if(!_0x9e1d27){_0x3dce26[_0xab14('0x2a')](0x194);}return _0x9e1d27;};}function handleError(_0x41656c,_0x25fbcf){_0x25fbcf=_0x25fbcf||0x1f4;return function(_0x30a785){logger[_0xab14('0x26')](_0x30a785[_0xab14('0x3a')]);if(_0x30a785[_0xab14('0x3b')]){delete _0x30a785['name'];}_0x41656c[_0xab14('0x2b')](_0x25fbcf)[_0xab14('0x3c')](_0x30a785);};}exports[_0xab14('0x3d')]=function(_0x2455f2,_0xf6a1ec){var _0x508939={'include':[{'model':db[_0xab14('0x3e')],'as':'mandatoryDispositionPause'}]},_0x17be32={},_0x6d53bc={'count':0x0,'rows':[]};var _0x268c25=_['map'](db[_0xab14('0x3f')][_0xab14('0x40')],function(_0x5167af){return{'name':_0x5167af[_0xab14('0x41')],'type':_0x5167af[_0xab14('0x42')][_0xab14('0x43')]};});_0x17be32['model']=_['map'](_0x268c25,_0xab14('0x3b'));_0x17be32[_0xab14('0x44')]=_[_0xab14('0x45')](_0x2455f2[_0xab14('0x44')]);_0x17be32[_0xab14('0x46')]=_[_0xab14('0x47')](_0x17be32[_0xab14('0x48')],_0x17be32[_0xab14('0x44')]);_0x508939[_0xab14('0x49')]=_['intersection'](_0x17be32[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x2455f2['query']['fields']));_0x508939[_0xab14('0x49')]=_0x508939[_0xab14('0x49')][_0xab14('0x4b')]?_0x508939[_0xab14('0x49')]:_0x17be32[_0xab14('0x48')];if(!_0x2455f2['query'][_0xab14('0x4c')]('nolimit')){_0x508939[_0xab14('0x2f')]=qs['limit'](_0x2455f2[_0xab14('0x44')][_0xab14('0x2f')]);_0x508939[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x2455f2['query'][_0xab14('0x2d')]);}_0x508939[_0xab14('0x4d')]=qs['sort'](_0x2455f2[_0xab14('0x44')][_0xab14('0x4e')]);_0x508939['where']=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x2455f2['query'],_0x17be32[_0xab14('0x46')]),_0x268c25);if(_0x2455f2[_0xab14('0x44')][_0xab14('0x50')]){_0x508939[_0xab14('0x51')]=_[_0xab14('0x52')](_0x508939[_0xab14('0x51')],{'$or':_['map'](_0x268c25,function(_0x3e84fd){if(_0x3e84fd[_0xab14('0x42')]!==_0xab14('0x53')){var _0x1e9650={};_0x1e9650[_0x3e84fd[_0xab14('0x3b')]]={'$like':'%'+_0x2455f2['query'][_0xab14('0x50')]+'%'};return _0x1e9650;}})});}_0x508939=_[_0xab14('0x52')]({},_0x508939,_0x2455f2['options']);var _0x42bae7={'where':_0x508939[_0xab14('0x51')]};return db[_0xab14('0x3f')][_0xab14('0x30')](_0x42bae7)['then'](function(_0xb0d9a6){_0x6d53bc[_0xab14('0x30')]=_0xb0d9a6;if(_0x2455f2[_0xab14('0x44')][_0xab14('0x54')]){_0x508939[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x3f')][_0xab14('0x56')](_0x508939);})[_0xab14('0x20')](function(_0x5727bc){_0x6d53bc[_0xab14('0x57')]=_0x5727bc;return _0x6d53bc;})['then'](respondWithFilteredResult(_0xf6a1ec,_0x508939))[_0xab14('0x29')](handleError(_0xf6a1ec,null));};exports['show']=function(_0x2e5de6,_0x2d8326){var _0x56253b={'raw':![],'where':{'id':_0x2e5de6[_0xab14('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xab14('0x59')}]},_0x3f30f4={};_0x3f30f4[_0xab14('0x48')]=_['keys'](db['OpenchannelAccount'][_0xab14('0x40')]);_0x3f30f4[_0xab14('0x44')]=_[_0xab14('0x45')](_0x2e5de6[_0xab14('0x44')]);_0x3f30f4['filters']=_[_0xab14('0x47')](_0x3f30f4['model'],_0x3f30f4['query']);_0x56253b['attributes']=_[_0xab14('0x47')](_0x3f30f4[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x2e5de6['query'][_0xab14('0x4a')]));_0x56253b['attributes']=_0x56253b[_0xab14('0x49')][_0xab14('0x4b')]?_0x56253b[_0xab14('0x49')]:_0x3f30f4[_0xab14('0x48')];if(_0x2e5de6['query'][_0xab14('0x54')]){_0x56253b[_0xab14('0x55')]=[{'all':!![]}];}_0x56253b=_[_0xab14('0x52')]({},_0x56253b,_0x2e5de6['options']);return db[_0xab14('0x3f')][_0xab14('0x5a')](_0x56253b)['then'](handleEntityNotFound(_0x2d8326,null))[_0xab14('0x20')](respondWithResult(_0x2d8326,null))[_0xab14('0x29')](handleError(_0x2d8326,null));};exports[_0xab14('0x5b')]=function(_0x379ceb,_0x572df6){return db[_0xab14('0x3f')][_0xab14('0x5b')](_0x379ceb[_0xab14('0x5c')],{})['then'](function(_0x220ffc){var _0x13ed3e=_0x379ceb[_0xab14('0x5d')][_0xab14('0x5e')]({'plain':!![]});if(!_0x13ed3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13ed3e[_0xab14('0x5f')]==='user'){var _0x4562f4=_0x220ffc[_0xab14('0x5e')]({'plain':!![]});var _0x4ffe41=_0xab14('0x37');return db[_0xab14('0x60')][_0xab14('0x5a')]({'where':{'name':_0x4ffe41,'userProfileId':_0x13ed3e[_0xab14('0x61')]},'raw':!![]})[_0xab14('0x20')](function(_0x4ed29e){if(_0x4ed29e&&_0x4ed29e[_0xab14('0x62')]===0x0){return db[_0xab14('0x38')][_0xab14('0x5b')]({'name':_0x4562f4[_0xab14('0x3b')],'resourceId':_0x4562f4['id'],'type':_0x4ed29e[_0xab14('0x3b')],'sectionId':_0x4ed29e['id']},{})[_0xab14('0x20')](function(){return _0x220ffc;});}else{return _0x220ffc;}})[_0xab14('0x29')](function(_0x1831f4){logger[_0xab14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1831f4);throw _0x1831f4;});}return _0x220ffc;})[_0xab14('0x20')](respondWithResult(_0x572df6,0xc9))[_0xab14('0x29')](handleError(_0x572df6,null));};exports[_0xab14('0x35')]=function(_0x164e60,_0x3c2a39){if(_0x164e60[_0xab14('0x5c')]['id']){delete _0x164e60['body']['id'];}return db['OpenchannelAccount'][_0xab14('0x5a')]({'where':{'id':_0x164e60[_0xab14('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xab14('0x59')}]})[_0xab14('0x20')](handleEntityNotFound(_0x3c2a39,null))[_0xab14('0x20')](saveUpdates(_0x164e60['body'],null))[_0xab14('0x20')](respondWithResult(_0x3c2a39,null))[_0xab14('0x29')](handleError(_0x3c2a39,null));};exports[_0xab14('0x36')]=function(_0x38d297,_0x3bb383){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x38d297['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x3bb383,null))['then'](removeEntity(_0x3bb383,null))['catch'](handleError(_0x3bb383,null));};exports[_0xab14('0x63')]=function(_0x2cffe3,_0x54a2c5){return db[_0xab14('0x3f')]['describe']()[_0xab14('0x20')](respondWithResult(_0x54a2c5,null))[_0xab14('0x29')](handleError(_0x54a2c5,null));};exports[_0xab14('0x64')]=function(_0x18b8c1,_0x7c1263,_0x35d29c){if(_0x18b8c1[_0xab14('0x5c')]['id']){delete _0x18b8c1[_0xab14('0x5c')]['id'];}return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x18b8c1[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x7c1263,null))[_0xab14('0x20')](function(_0x4d9cad){if(_0x4d9cad){_0x18b8c1[_0xab14('0x5c')][_0xab14('0x65')]=_0x4d9cad['id'];return db['Disposition'][_0xab14('0x5b')](_0x18b8c1['body']);}})[_0xab14('0x20')](respondWithResult(_0x7c1263,null))[_0xab14('0x29')](handleError(_0x7c1263,null));};exports[_0xab14('0x66')]=function(_0x6bf8b1,_0x496edb,_0x4fb50e){var _0x3c3624={'raw':![],'where':{}};var _0x4446df={};var _0x3c4aff={'count':0x0,'rows':[]};return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x6bf8b1['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x496edb,null))[_0xab14('0x20')](function(_0xced43a){if(_0xced43a){_0x4446df[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0x68')][_0xab14('0x40')]);_0x4446df[_0xab14('0x44')]=_[_0xab14('0x45')](_0x6bf8b1[_0xab14('0x44')]);_0x4446df[_0xab14('0x46')]=_[_0xab14('0x47')](_0x4446df['model'],_0x4446df[_0xab14('0x44')]);_0x3c3624[_0xab14('0x49')]=_['intersection'](_0x4446df[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x4a')]));_0x3c3624['attributes']=_0x3c3624['attributes'][_0xab14('0x4b')]?_0x3c3624[_0xab14('0x49')]:_0x4446df['model'];if(!_0x6bf8b1['query']['hasOwnProperty'](_0xab14('0x69'))){_0x3c3624[_0xab14('0x2f')]=qs[_0xab14('0x2f')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x2f')]);_0x3c3624[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x2d')]);}_0x3c3624['order']=qs[_0xab14('0x4e')](_0x6bf8b1['query'][_0xab14('0x4e')]);_0x3c3624[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x6bf8b1[_0xab14('0x44')],_0x4446df[_0xab14('0x46')]));_0x3c3624[_0xab14('0x51')][_0xab14('0x65')]=_0xced43a['id'];if(_0x6bf8b1[_0xab14('0x44')][_0xab14('0x50')]){_0x3c3624[_0xab14('0x51')]=_[_0xab14('0x52')](_0x3c3624[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x3c3624[_0xab14('0x49')],function(_0x37c038){var _0x5b68eb={};_0x5b68eb[_0x37c038]={'$like':'%'+_0x6bf8b1[_0xab14('0x44')]['filter']+'%'};return _0x5b68eb;})});}_0x3c3624=_[_0xab14('0x52')]({},_0x3c3624,_0x6bf8b1[_0xab14('0x6b')]);return db['Disposition']['count']({'where':_0x3c3624[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x27094f){_0x3c4aff[_0xab14('0x30')]=_0x27094f;if(_0x6bf8b1['query'][_0xab14('0x54')]){_0x3c3624[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x68')][_0xab14('0x56')](_0x3c3624);})[_0xab14('0x20')](function(_0x316691){_0x3c4aff[_0xab14('0x57')]=_0x316691;return _0x3c4aff;});}})['then'](respondWithFilteredResult(_0x496edb,_0x3c3624))['catch'](handleError(_0x496edb,null));};exports['removeDispositions']=function(_0x4ac6e0,_0x5dd0b3,_0x2d1832){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x4ac6e0[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x5dd0b3,null))[_0xab14('0x20')](function(_0x5f7c99){if(_0x5f7c99){return _0x5f7c99[_0xab14('0x6c')](_0x4ac6e0[_0xab14('0x44')][_0xab14('0x6d')]);}})[_0xab14('0x20')](respondWithStatusCode(_0x5dd0b3,null))[_0xab14('0x29')](handleError(_0x5dd0b3,null));};exports[_0xab14('0x6e')]=function(_0x489b20,_0x3f34ae,_0x1f4741){if(_0x489b20[_0xab14('0x5c')]['id']){delete _0x489b20['body']['id'];}return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x489b20[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x3f34ae,null))[_0xab14('0x20')](function(_0x27f2bf){if(_0x27f2bf){_0x489b20[_0xab14('0x5c')]['OpenchannelAccountId']=_0x27f2bf['id'];return db[_0xab14('0x6f')][_0xab14('0x5b')](_0x489b20[_0xab14('0x5c')]);}})[_0xab14('0x20')](respondWithResult(_0x3f34ae,null))[_0xab14('0x29')](handleError(_0x3f34ae,null));};exports[_0xab14('0x70')]=function(_0x25e2eb,_0x2a0ff3,_0x22b3bf){var _0x4d936e={'raw':![],'where':{}};var _0x3c993e={};var _0x508d3a={'count':0x0,'rows':[]};return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x25e2eb[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a0ff3,null))[_0xab14('0x20')](function(_0x38d54c){if(_0x38d54c){_0x3c993e[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0x6f')]['rawAttributes']);_0x3c993e[_0xab14('0x44')]=_[_0xab14('0x45')](_0x25e2eb[_0xab14('0x44')]);_0x3c993e[_0xab14('0x46')]=_['intersection'](_0x3c993e[_0xab14('0x48')],_0x3c993e[_0xab14('0x44')]);_0x4d936e[_0xab14('0x49')]=_[_0xab14('0x47')](_0x3c993e[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x25e2eb[_0xab14('0x44')]['fields']));_0x4d936e[_0xab14('0x49')]=_0x4d936e[_0xab14('0x49')][_0xab14('0x4b')]?_0x4d936e[_0xab14('0x49')]:_0x3c993e[_0xab14('0x48')];if(!_0x25e2eb[_0xab14('0x44')]['hasOwnProperty']('nolimit')){_0x4d936e[_0xab14('0x2f')]=qs['limit'](_0x25e2eb[_0xab14('0x44')][_0xab14('0x2f')]);_0x4d936e[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x25e2eb['query'][_0xab14('0x2d')]);}_0x4d936e[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0x25e2eb[_0xab14('0x44')][_0xab14('0x4e')]);_0x4d936e[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x25e2eb[_0xab14('0x44')],_0x3c993e[_0xab14('0x46')]));_0x4d936e['where'][_0xab14('0x65')]=_0x38d54c['id'];if(_0x25e2eb['query'][_0xab14('0x50')]){_0x4d936e[_0xab14('0x51')]=_[_0xab14('0x52')](_0x4d936e[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x4d936e[_0xab14('0x49')],function(_0xf35073){var _0x1d8b4b={};_0x1d8b4b[_0xf35073]={'$like':'%'+_0x25e2eb[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x1d8b4b;})});}_0x4d936e=_[_0xab14('0x52')]({},_0x4d936e,_0x25e2eb[_0xab14('0x6b')]);return db[_0xab14('0x6f')][_0xab14('0x30')]({'where':_0x4d936e[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x5f53f8){_0x508d3a[_0xab14('0x30')]=_0x5f53f8;if(_0x25e2eb[_0xab14('0x44')][_0xab14('0x54')]){_0x4d936e[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x6f')]['findAll'](_0x4d936e);})['then'](function(_0x3773f8){_0x508d3a[_0xab14('0x57')]=_0x3773f8;return _0x508d3a;});}})[_0xab14('0x20')](respondWithFilteredResult(_0x2a0ff3,_0x4d936e))[_0xab14('0x29')](handleError(_0x2a0ff3,null));};exports['removeAnswers']=function(_0x20d6c9,_0x2ac1f4,_0xeca0a7){return db[_0xab14('0x3f')]['find']({'where':{'id':_0x20d6c9[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ac1f4,null))[_0xab14('0x20')](function(_0x5d6df8){if(_0x5d6df8){return _0x5d6df8[_0xab14('0x71')](_0x20d6c9[_0xab14('0x44')][_0xab14('0x6d')]);}})[_0xab14('0x20')](respondWithStatusCode(_0x2ac1f4,null))['catch'](handleError(_0x2ac1f4,null));};exports[_0xab14('0x72')]=function(_0x12b230,_0x6de50b,_0x43bbfb){var _0x5f01e6={'body':_0x12b230[_0xab14('0x5c')],'channel':_0xab14('0x73')};var _0x162e19=[];var _0x29358b=[];var _0x51f19b={};var _0xf32527=![];return db['CmContact'][_0xab14('0x63')]()['then'](function(_0x530240){if(!_0x530240){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))]('no\x20available\x20attributes');}_0x162e19=_[_0xab14('0x76')](_['keys'](_0x530240),['createdAt',_0xab14('0x77')]);_0x29358b=_[_0xab14('0x76')](_[_0xab14('0x45')](_0x530240),[_0xab14('0x78'),'updatedAt','CompanyId','ListId']);if(_0x12b230[_0xab14('0x5c')]['id']){delete _0x12b230[_0xab14('0x5c')]['id'];}if(_[_0xab14('0x79')](_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')])){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))](_0xab14('0x7b'));}if(_[_0xab14('0x79')](_0x12b230[_0xab14('0x5c')][_0xab14('0x5c')])||_0x12b230[_0xab14('0x5c')][_0xab14('0x5c')]===''){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xab14('0x79')](_0x12b230['body'][_0xab14('0x7c')])){throw new db[(_0xab14('0x74'))]['ValidationError'](_0xab14('0x7d')+_0x29358b);}if(!_[_0xab14('0x7e')](_0x29358b,_0x12b230[_0xab14('0x5c')][_0xab14('0x7c')])){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))](_0xab14('0x7f')+_0x29358b);}_0x51f19b[_0x12b230[_0xab14('0x5c')][_0xab14('0x7c')]]=_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x12b230['params']['id']},'include':[{'model':db[_0xab14('0x80')],'as':_0xab14('0x81'),'include':[{'model':db['CmContact'],'as':_0xab14('0x82'),'where':_0x51f19b,'limit':0x1,'order':[[_0xab14('0x77'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xab14('0x20')](handleEntityNotFound(_0x6de50b,null))['then'](function(_0x57dab0){if(_0x57dab0&&_0x57dab0[_0xab14('0x81')]){_0x5f01e6['account']=_0x57dab0;_0x5f01e6['applications']=_0x57dab0[_0xab14('0x83')];_0x5f01e6[_0xab14('0x84')]=_0x57dab0[_0xab14('0x81')];_0x5f01e6[_0xab14('0x85')]=_[_0xab14('0x86')](_0x5f01e6['applications'],[_0xab14('0x87')],[_0xab14('0x88')]);if(_0x5f01e6['account'][_0xab14('0x83')]){delete _0x5f01e6['account']['Applications'];}if(_0x5f01e6[_0xab14('0x89')][_0xab14('0x81')]&&_0x5f01e6['account'][_0xab14('0x81')][_0xab14('0x82')]['length']){return _0x5f01e6[_0xab14('0x89')][_0xab14('0x81')]['Contacts'][0x0];}var _0x4901ef=_[_0xab14('0x17')](_0x12b230['body'],{'firstName':_0x12b230[_0xab14('0x5c')]['from'],'ListId':_0x57dab0[_0xab14('0x8a')]});_0x4901ef[_0x12b230[_0xab14('0x5c')]['mapKey']]=_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')];return db[_0xab14('0x8b')]['create'](_0x4901ef,{'fields':_0x162e19,'raw':!![]});}})[_0xab14('0x20')](handleEntityNotFound(_0x6de50b,null))['then'](function(_0x214937){_0x5f01e6[_0xab14('0x8c')]=_0x214937;if(_0x214937){var _0x564d3d={'ContactId':_0x214937['id'],'OpenchannelAccountId':_0x12b230['params']['id'],'from':(_0x214937[_0xab14('0x8d')]||'')+'\x20'+(_0x214937[_0xab14('0x8e')]||'')};var _0x47e652={'OpenchannelAccountId':_0x12b230[_0xab14('0x58')]['id'],'closed':![]};if(_0x12b230['body']['threadId']){_0x47e652[_0xab14('0x8f')]=_0x12b230['body'][_0xab14('0x8f')];return db[_0xab14('0x90')][_0xab14('0x5a')]({'where':_0x47e652})[_0xab14('0x20')](function(_0x1e7d16){if(_0x1e7d16){return[_0x1e7d16,![]];}_0x564d3d[_0xab14('0x8f')]=_0x12b230['body'][_0xab14('0x8f')];_0x564d3d[_0xab14('0x91')]=_0x12b230[_0xab14('0x5c')][_0xab14('0x91')];return db[_0xab14('0x90')]['create'](_0x564d3d)[_0xab14('0x20')](function(_0x406d81){return[_0x406d81,!![]];});});}else{_0x47e652[_0xab14('0x8f')]=null;}_0x47e652[_0xab14('0x92')]=_0x214937['id'];return db[_0xab14('0x90')][_0xab14('0x5a')]({'where':_0x47e652})[_0xab14('0x20')](function(_0x11218d){if(_0x11218d){return[_0x11218d,![]];}return db[_0xab14('0x90')]['create'](_0x564d3d)[_0xab14('0x20')](function(_0x83ea2b){return[_0x83ea2b,!![]];});});}})['spread'](function(_0x48a420,_0x57a579){if(_0x48a420){_0xf32527=_0x57a579;if(!_0x57a579){var _0x109fcc={'from':(_0x5f01e6[_0xab14('0x8c')][_0xab14('0x8d')]||'')+'\x20'+(_0x5f01e6[_0xab14('0x8c')][_0xab14('0x8e')]||'')};if(_0x12b230[_0xab14('0x5c')]['threadId']&&_0x12b230[_0xab14('0x5c')]['messageId']&&_0x12b230[_0xab14('0x5c')][_0xab14('0x8f')]!=_0x12b230[_0xab14('0x5c')][_0xab14('0x93')]){_0x109fcc['threadId']=_0x12b230[_0xab14('0x5c')][_0xab14('0x93')];}return _0x48a420[_0xab14('0x35')](_0x109fcc);}else{return _0x48a420;}}})[_0xab14('0x20')](function(_0x164575){_0x5f01e6[_0xab14('0x94')]=_0x164575[_0xab14('0x5e')]({'plain':!![]});_0x5f01e6[_0xab14('0x94')][_0xab14('0x95')]=_0xf32527;if(_0x5f01e6[_0xab14('0x94')][_0xab14('0x95')]){if(_0x5f01e6['account'][_0xab14('0x96')]){_0x5f01e6[_0xab14('0x85')][_0xab14('0x97')]({'id':0x0,'priority':_0x5f01e6['applications']['length']+0x1,'app':_0xab14('0x98'),'appdata':_0xab14('0x99'),'interval':_0xab14('0x9a')});}}return db[_0xab14('0x9b')][_0xab14('0x5b')]({'body':_0x12b230['body'][_0xab14('0x5c')],'OpenchannelAccountId':_0x12b230[_0xab14('0x58')]['id'],'OpenchannelInteractionId':_0x164575['id'],'direction':'in','ContactId':_0x5f01e6[_0xab14('0x8c')]['id'],'AttachmentId':_0x12b230[_0xab14('0x5c')][_0xab14('0x9c')]});})[_0xab14('0x20')](function(_0xf6fd07){_0x5f01e6['message']=_0xf6fd07;if(_0x5f01e6[_0xab14('0x94')][_0xab14('0x9d')]){return db[_0xab14('0x9e')][_0xab14('0x5a')]({'attributes':['id',_0xab14('0x3b')],'where':{'id':_0x5f01e6[_0xab14('0x94')][_0xab14('0x9d')]}})['then'](function(_0x40989d){if(_0x40989d){_0x5f01e6['applications'][_0xab14('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40989d[_0xab14('0x3b')]+','+(_0x5f01e6[_0xab14('0x89')][_0xab14('0xa0')]||0xa),'interval':'*,*,*,*'});_0x5f01e6[_0xab14('0xa1')]=![];}return respondWithRpcPromise(_0xab14('0xa2'),_0xab14('0xa3'),_0x5f01e6);});}return respondWithRpcPromise(_0xab14('0xa2'),_0xab14('0xa3'),_0x5f01e6);})['then'](function(_0x37e961){respondWithRpcPromise('EventManager','EventManager',{'event':_0xab14('0x72'),'message':_0x37e961},client9002);return _0x37e961;})[_0xab14('0x20')](respondWithResult(_0x6de50b,null))[_0xab14('0x29')](handleError(_0x6de50b,null));};exports['addApplications']=function(_0x2156b2,_0x595d2a){var _0x5f338d=_0x2156b2[_0xab14('0x58')]['id'];var _0x2ff17f=_0x2156b2[_0xab14('0x5c')];var _0x35cead=0xc8;var _0x15ca31=null;return db[_0xab14('0xa4')][_0xab14('0xa5')]({'isolationLevel':db[_0xab14('0xa4')][_0xab14('0xa6')][_0xab14('0xa7')][_0xab14('0xa8')]},function(_0x79b4fd){return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x5f338d},'transaction':_0x79b4fd})[_0xab14('0x20')](function(_0x4f296a){if(_0x4f296a){return db['OpenchannelApplication'][_0xab14('0x36')]({'where':{'OpenchannelAccountId':_0x5f338d},'transaction':_0x79b4fd})[_0xab14('0x20')](function(){var _0x3a4bdd=_[_0xab14('0x6a')](_0x2ff17f,function(_0x1f6814){_0x1f6814[_0xab14('0x65')]=_0x5f338d;return _0x1f6814;});return db[_0xab14('0xa9')][_0xab14('0xaa')](_0x3a4bdd,{'transaction':_0x79b4fd});});}else{_0x35cead=0x194;_0x15ca31=[];}});})['then'](function(){if(_0x35cead!==0x194){return db[_0xab14('0xa9')][_0xab14('0xab')]({'where':{'OpenchannelAccountId':_0x5f338d},'order':_0xab14('0x87')})[_0xab14('0x20')](function(_0x5729bb){_0x15ca31=_0x5729bb;});}})[_0xab14('0x29')](function(_0x5168f5){_0x35cead=0x1f4;logger['error'](_0x5168f5[_0xab14('0x3a')]);if(_0x5168f5[_0xab14('0x3b')]){delete _0x5168f5[_0xab14('0x3b')];}_0x15ca31=_0x5168f5;})[_0xab14('0xac')](function(){if(_0x15ca31===null){_0x595d2a[_0xab14('0x2a')](_0x35cead);}else{if(_0x35cead===0x1f4){_0x595d2a[_0xab14('0x2b')](_0x35cead)[_0xab14('0x3c')](_0x15ca31);}else{_0x595d2a['status'](_0x35cead)[_0xab14('0x2c')](_0x15ca31);}}});};exports[_0xab14('0xad')]=function(_0x26e6f2,_0x51c823,_0x5e39a9){var _0x41b6aa={};var _0x2d7462={};var _0x3bb115;var _0xe3faec;return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x26e6f2['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x51c823,null))['then'](function(_0x44fd42){if(_0x44fd42){_0x3bb115=_0x44fd42;_0x2d7462[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0xa9')][_0xab14('0x40')]);_0x2d7462[_0xab14('0x44')]=_[_0xab14('0x45')](_0x26e6f2[_0xab14('0x44')]);_0x2d7462[_0xab14('0x46')]=_[_0xab14('0x47')](_0x2d7462['model'],_0x2d7462['query']);_0x41b6aa[_0xab14('0x49')]=_[_0xab14('0x47')](_0x2d7462[_0xab14('0x48')],qs['fields'](_0x26e6f2[_0xab14('0x44')]['fields']));_0x41b6aa[_0xab14('0x49')]=_0x41b6aa[_0xab14('0x49')][_0xab14('0x4b')]?_0x41b6aa[_0xab14('0x49')]:_0x2d7462['model'];_0x41b6aa['order']=qs[_0xab14('0x4e')](_0x26e6f2[_0xab14('0x44')][_0xab14('0x4e')]);_0x41b6aa[_0xab14('0x51')]=qs['filters'](_[_0xab14('0x4f')](_0x26e6f2[_0xab14('0x44')],_0x2d7462['filters']));if(_0x26e6f2[_0xab14('0x44')][_0xab14('0x50')]){_0x41b6aa['where']=_[_0xab14('0x52')](_0x41b6aa[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x41b6aa[_0xab14('0x49')],function(_0x5cc8ce){var _0x80c850={};_0x80c850[_0x5cc8ce]={'$like':'%'+_0x26e6f2[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x80c850;})});}_0x41b6aa=_[_0xab14('0x52')]({},_0x41b6aa,_0x26e6f2[_0xab14('0x6b')]);return _0x3bb115[_0xab14('0xad')](_0x41b6aa);}})[_0xab14('0x20')](function(_0x4fd5fd){if(_0x4fd5fd){_0xe3faec=_0x4fd5fd['length'];if(!_0x26e6f2['query'][_0xab14('0x4c')](_0xab14('0x69'))){_0x41b6aa[_0xab14('0x2f')]=qs['limit'](_0x26e6f2[_0xab14('0x44')][_0xab14('0x2f')]);_0x41b6aa[_0xab14('0x2d')]=qs['offset'](_0x26e6f2[_0xab14('0x44')][_0xab14('0x2d')]);}return _0x3bb115[_0xab14('0xad')](_0x41b6aa);}})[_0xab14('0x20')](function(_0xa66754){if(_0xa66754){return _0xa66754?{'count':_0xe3faec,'rows':_0xa66754}:null;}})[_0xab14('0x20')](respondWithResult(_0x51c823,null))['catch'](handleError(_0x51c823,null));};exports[_0xab14('0xae')]=function(_0x5ad3d6,_0x2e147e,_0xbce34d){var _0x512c33={'raw':![],'where':{}};var _0x1cd0ce={};var _0x25da2f={'count':0x0,'rows':[]};return db[_0xab14('0x3f')]['findOne']({'where':{'id':_0x5ad3d6[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x2e147e,null))[_0xab14('0x20')](function(_0x25c547){if(_0x25c547){_0x1cd0ce['model']=_[_0xab14('0x45')](db[_0xab14('0x90')][_0xab14('0x40')]);_0x1cd0ce[_0xab14('0x44')]=_[_0xab14('0x45')](_0x5ad3d6['query']);_0x1cd0ce[_0xab14('0x46')]=_[_0xab14('0x47')](_0x1cd0ce[_0xab14('0x48')],_0x1cd0ce[_0xab14('0x44')]);_0x512c33[_0xab14('0x49')]=_['intersection'](_0x1cd0ce[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x5ad3d6[_0xab14('0x44')][_0xab14('0x4a')]));_0x512c33[_0xab14('0x49')]=_0x512c33[_0xab14('0x49')][_0xab14('0x4b')]?_0x512c33[_0xab14('0x49')]:_0x1cd0ce['model'];if(!_0x5ad3d6['query'][_0xab14('0x4c')](_0xab14('0x69'))){_0x512c33[_0xab14('0x2f')]=qs[_0xab14('0x2f')](_0x5ad3d6[_0xab14('0x44')]['limit']);_0x512c33[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x5ad3d6['query'][_0xab14('0x2d')]);}_0x512c33[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0x5ad3d6[_0xab14('0x44')]['sort']);_0x512c33[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x5ad3d6[_0xab14('0x44')],_0x1cd0ce['filters']));_0x512c33[_0xab14('0x51')]['OpenchannelAccountId']=_0x25c547['id'];if(_0x5ad3d6[_0xab14('0x44')][_0xab14('0x50')]){_0x512c33[_0xab14('0x51')]=_['merge'](_0x512c33[_0xab14('0x51')],{'$or':_['map'](_0x512c33['attributes'],function(_0x491349){var _0x2b2a33={};_0x2b2a33[_0x491349]={'$like':'%'+_0x5ad3d6[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x2b2a33;})});}_0x512c33=_[_0xab14('0x52')]({},_0x512c33,_0x5ad3d6[_0xab14('0x6b')]);return db['OpenchannelInteraction']['count']({'where':_0x512c33[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x504f9a){_0x25da2f['count']=_0x504f9a;if(_0x5ad3d6[_0xab14('0x44')][_0xab14('0x54')]){_0x512c33[_0xab14('0x55')]=[{'model':db[_0xab14('0x8b')],'as':_0xab14('0xaf'),'required':![]},{'model':db[_0xab14('0x9e')],'as':'Owner','attributes':[_0xab14('0x3b'),_0xab14('0xb0'),_0xab14('0xb1')],'required':![]},{'model':db[_0xab14('0xb2')],'as':_0xab14('0xb3'),'attributes':['id',_0xab14('0x3b'),_0xab14('0xb4')],'where':_0x5ad3d6['query'][_0xab14('0xb5')]?{'id':_0x5ad3d6[_0xab14('0x44')]['tag']}:undefined,'required':_0x5ad3d6[_0xab14('0x44')][_0xab14('0xb5')]?!![]:![]}];}return db[_0xab14('0x90')][_0xab14('0x56')](_0x512c33);})[_0xab14('0x20')](function(_0x2688c9){_0x25da2f['rows']=_0x2688c9;return _0x25da2f;});}})[_0xab14('0x20')](respondWithFilteredResult(_0x2e147e,_0x512c33))[_0xab14('0x29')](handleError(_0x2e147e,null));};exports[_0xab14('0xb6')]=function(_0x26d288,_0x46d48a,_0x10bf0c){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x26d288[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x46d48a,null))[_0xab14('0x20')](function(_0xca981c){if(_0xca981c){return _0xca981c[_0xab14('0xb6')](_0x26d288[_0xab14('0x5c')][_0xab14('0x6d')],_[_0xab14('0xb7')](_0x26d288[_0xab14('0x5c')],[_0xab14('0x6d'),'id'])||{})['spread'](function(_0x232e33){for(var _0x51e6cf=0x0;_0x51e6cf<_0x26d288[_0xab14('0x5c')]['ids'][_0xab14('0x4b')];_0x51e6cf+=0x1){socket[_0xab14('0xb8')](_0xab14('0xb9'),{'UserId':Number(_0x26d288[_0xab14('0x5c')][_0xab14('0x6d')][_0x51e6cf]),'OpenchannelAccountId':Number(_0x26d288[_0xab14('0x58')]['id'])});}return _0x232e33;});}})[_0xab14('0x20')](respondWithResult(_0x46d48a,null))[_0xab14('0x29')](handleError(_0x46d48a,null));};exports['removeAgents']=function(_0x3145e6,_0x4ba6e4,_0x155b2c){return db['OpenchannelAccount']['find']({'where':{'id':_0x3145e6[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x4ba6e4,null))[_0xab14('0x20')](function(_0x237ac4){if(_0x237ac4){return _0x237ac4[_0xab14('0xba')](_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')])[_0xab14('0x20')](function(){if(_[_0xab14('0xbb')](_0x3145e6['query'][_0xab14('0x6d')])){for(var _0x1c9fd1=0x0;_0x1c9fd1<_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')][_0xab14('0x4b')];_0x1c9fd1+=0x1){socket[_0xab14('0xb8')](_0xab14('0xbc'),{'UserId':Number(_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')][_0x1c9fd1]),'OpenchannelAccountId':Number(_0x3145e6[_0xab14('0x58')]['id'])});}}else{socket[_0xab14('0xb8')](_0xab14('0xbc'),{'UserId':Number(_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')]),'OpenchannelAccountId':Number(_0x3145e6[_0xab14('0x58')]['id'])});}});}})[_0xab14('0x20')](respondWithStatusCode(_0x4ba6e4,null))[_0xab14('0x29')](handleError(_0x4ba6e4,null));};exports['getAgents']=function(_0xbed4b3,_0x454408,_0x5867a3){var _0x4caea1={};var _0x2d7668={};var _0x304a00;var _0x40e79b;return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0xbed4b3[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x454408,null))[_0xab14('0x20')](function(_0x309f2f){if(_0x309f2f){_0x304a00=_0x309f2f;_0x2d7668[_0xab14('0x48')]=_[_0xab14('0x45')](db['User']['rawAttributes']);_0x2d7668['query']=_[_0xab14('0x45')](_0xbed4b3[_0xab14('0x44')]);_0x2d7668[_0xab14('0x46')]=_[_0xab14('0x47')](_0x2d7668[_0xab14('0x48')],_0x2d7668['query']);_0x4caea1['attributes']=_[_0xab14('0x47')](_0x2d7668['model'],qs['fields'](_0xbed4b3[_0xab14('0x44')]['fields']));_0x4caea1[_0xab14('0x49')]=_0x4caea1[_0xab14('0x49')][_0xab14('0x4b')]?_0x4caea1[_0xab14('0x49')]:_0x2d7668[_0xab14('0x48')];_0x4caea1[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0xbed4b3[_0xab14('0x44')][_0xab14('0x4e')]);_0x4caea1[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0xbed4b3[_0xab14('0x44')],_0x2d7668[_0xab14('0x46')]));if(_0xbed4b3[_0xab14('0x44')][_0xab14('0x50')]){_0x4caea1['where']=_['merge'](_0x4caea1[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x4caea1[_0xab14('0x49')],function(_0x1fc062){var _0x1636b7={};_0x1636b7[_0x1fc062]={'$like':'%'+_0xbed4b3[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x1636b7;})});}_0x4caea1=_[_0xab14('0x52')]({},_0x4caea1,_0xbed4b3[_0xab14('0x6b')]);return _0x304a00[_0xab14('0xbd')](_0x4caea1);}})[_0xab14('0x20')](function(_0x281fcd){if(_0x281fcd){_0x40e79b=_0x281fcd['length'];if(!_0xbed4b3[_0xab14('0x44')][_0xab14('0x4c')](_0xab14('0x69'))){_0x4caea1[_0xab14('0x2f')]=qs['limit'](_0xbed4b3[_0xab14('0x44')][_0xab14('0x2f')]);_0x4caea1[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0xbed4b3[_0xab14('0x44')][_0xab14('0x2d')]);}return _0x304a00['getAgents'](_0x4caea1);}})[_0xab14('0x20')](function(_0x2acef0){if(_0x2acef0){return _0x2acef0?{'count':_0x40e79b,'rows':_0x2acef0}:null;}})[_0xab14('0x20')](respondWithResult(_0x454408,null))['catch'](handleError(_0x454408,null));};exports[_0xab14('0x3c')]=function(_0x20f2ff,_0x1a313e,_0x3482d7){var _0x552a36,_0x18f6c1,_0x1ff8c0;if(_['isNil'](_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')])||_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')]===''){throw new db['Sequelize'][(_0xab14('0x75'))](_0xab14('0xbe'));}if(_[_0xab14('0x79')](_0x20f2ff[_0xab14('0x5c')]['to'])){}_0x552a36=_0x20f2ff['body']['to'];return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x20f2ff[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x474275){if(_0x474275){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x474275['id']},'include':[{'model':db['CmList'],'as':_0xab14('0x81'),'include':[{'model':db[_0xab14('0x8b')],'as':_0xab14('0x82'),'where':{[_0x474275[_0xab14('0x7c')]]:_0x552a36},'limit':0x1,'order':[[_0xab14('0x77'),_0xab14('0xbf')]]}]}]})['then'](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x372f87){if(_0x372f87&&_0x372f87[_0xab14('0x81')]){_0x18f6c1=_0x372f87[_0xab14('0x5e')]({'plain':!![]});if(_0x18f6c1[_0xab14('0x81')]&&_0x18f6c1['List'][_0xab14('0x82')]['length']){return _0x18f6c1['List'][_0xab14('0x82')][0x0];}return db['CmContact']['create'](_[_0xab14('0x17')](_0x20f2ff['body'],{'firstName':_0x552a36,[_0x372f87[_0xab14('0x7c')]]:_0x552a36,'phone':_0x552a36,'ListId':_0x18f6c1['ListId']}));}})[_0xab14('0x20')](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x52b427){if(_0x52b427){_0x1ff8c0=_0x52b427;return db[_0xab14('0x90')]['find']({'where':{'ContactId':_0x1ff8c0['id'],'closed':![],'OpenchannelAccountId':_0x18f6c1['id']}})[_0xab14('0x20')](function(_0x134dbb){if(_0x134dbb){return[_0x134dbb,![]];}return db['OpenchannelInteraction'][_0xab14('0x5b')]({'UserId':_0x20f2ff['user']['id'],'ContactId':_0x1ff8c0['id'],'OpenchannelAccountId':_0x18f6c1['id'],'lastMsgDirection':_0xab14('0xc0'),'Messages':[_['merge'](_0x20f2ff[_0xab14('0x5c')],{'read':![],'body':_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')],'OpenchannelAccountId':_0x18f6c1['id'],'UserId':_0x20f2ff[_0xab14('0x5d')]['id'],'ContactId':_0x1ff8c0['id']})]},{'include':[{'model':db[_0xab14('0x9b')],'as':_0xab14('0xc1')}]})[_0xab14('0x20')](function(_0x431a9e){return[_0x431a9e,!![]];});});}})[_0xab14('0xc2')](function(_0xddacbf,_0x39b984){if(_0x39b984){return _0xddacbf;}return db[_0xab14('0x9b')][_0xab14('0x5b')](_[_0xab14('0x52')](_0x20f2ff[_0xab14('0x5c')],{'read':![],'body':_0x20f2ff[_0xab14('0x5c')]['body'],'OpenchannelAccountId':_0x18f6c1['id'],'OpenchannelInteractionId':_0xddacbf['id'],'UserId':_0x20f2ff[_0xab14('0x5d')]['id'],'ContactId':_0x1ff8c0['id']}))[_0xab14('0x20')](function(_0x486d99){_0xddacbf['dataValues']['Messages']=[];_0xddacbf[_0xab14('0xc3')][_0xab14('0xc1')]['push'](_0x486d99[_0xab14('0xc3')]);return _0xddacbf;});});}})[_0xab14('0x20')](respondWithResult(_0x1a313e,null))[_0xab14('0x29')](handleError(_0x1a313e,null));}; \ No newline at end of file +var _0x01ac=['fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','from','CmContact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','update','interaction','created','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','util','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelAccount.socket','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes'];(function(_0x56426b,_0x365a0a){var _0x2fc3d8=function(_0x12535a){while(--_0x12535a){_0x56426b['push'](_0x56426b['shift']());}};_0x2fc3d8(++_0x365a0a);}(_0x01ac,0x7e));var _0xc01a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x01ac[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xc01a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc01a('0x1'));var jsonpatch=require(_0xc01a('0x2'));var rp=require(_0xc01a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc01a('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc01a('0x5'));var fs=require('fs');var fs_extra=require(_0xc01a('0x6'));var _=require(_0xc01a('0x7'));var squel=require(_0xc01a('0x8'));var crypto=require(_0xc01a('0x9'));var jsforce=require(_0xc01a('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc01a('0xb'));var Papa=require(_0xc01a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc01a('0xd'));var hardwareService=require(_0xc01a('0xe'));var logger=require(_0xc01a('0xf'))('api');var utils=require(_0xc01a('0x10'));var config=require(_0xc01a('0x11'));var licenseUtil=require(_0xc01a('0x12'));var db=require(_0xc01a('0x13'))['db'];config['redis']=_[_0xc01a('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc01a('0x15'))(new Redis(config[_0xc01a('0x16')]));require(_0xc01a('0x17'))['register'](socket);var jayson=require(_0xc01a('0x18'));var client=jayson['client'][_0xc01a('0x19')]({'port':0x232c});var client9002=jayson[_0xc01a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x354b9c,_0x3610fb,_0x252709,_0xb428c0){return new BPromise(function(_0x4455eb,_0x402356){var _0x22f382=_0xb428c0||client;return _0x22f382['request'](_0x354b9c,_0x252709)[_0xc01a('0x1b')](function(_0x328a06){logger[_0xc01a('0x1c')]('OpenchannelAccount,\x20%s,\x20%s',_0x3610fb,'request\x20sent');logger['debug'](_0xc01a('0x1d'),_0x3610fb,_0xc01a('0x1e'),JSON['stringify'](_0x328a06));if(_0x328a06[_0xc01a('0x1f')]){if(_0x328a06[_0xc01a('0x1f')]['code']===0x1f4){logger[_0xc01a('0x1f')](_0xc01a('0x20'),_0x3610fb,_0x328a06['error'][_0xc01a('0x21')]);return _0x402356(_0x328a06[_0xc01a('0x1f')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3610fb,_0x328a06[_0xc01a('0x1f')]['message']);return _0x4455eb(_0x328a06[_0xc01a('0x1f')][_0xc01a('0x21')]);}else{logger[_0xc01a('0x1c')]('OpenchannelAccount,\x20%s,\x20%s',_0x3610fb,_0xc01a('0x1e'));_0x4455eb(_0x328a06['result'][_0xc01a('0x21')]);}})[_0xc01a('0x22')](function(_0x4205ec){logger['error'](_0xc01a('0x20'),_0x3610fb,_0x4205ec);_0x402356(_0x4205ec);});});}function respondWithStatusCode(_0x46b8d9,_0x53dfd1){_0x53dfd1=_0x53dfd1||0xcc;return function(_0x5e2632){if(_0x5e2632){return _0x46b8d9['sendStatus'](_0x53dfd1);}return _0x46b8d9[_0xc01a('0x23')](_0x53dfd1)[_0xc01a('0x24')]();};}function respondWithResult(_0xdefc1a,_0x3109df){_0x3109df=_0x3109df||0xc8;return function(_0x4681b1){if(_0x4681b1){return _0xdefc1a[_0xc01a('0x23')](_0x3109df)['json'](_0x4681b1);}};}function respondWithFilteredResult(_0x256530,_0x8bec92){return function(_0x178b18){if(_0x178b18){var _0x393b68=typeof _0x8bec92[_0xc01a('0x25')]===_0xc01a('0x26')&&typeof _0x8bec92[_0xc01a('0x27')]===_0xc01a('0x26');var _0x59ffaf=_0x178b18[_0xc01a('0x28')];var _0x59e31d=_0x393b68?0x0:_0x8bec92[_0xc01a('0x25')];var _0x397171=_0x393b68?_0x178b18[_0xc01a('0x28')]:_0x8bec92['offset']+_0x8bec92[_0xc01a('0x27')];var _0x318949;if(_0x397171>=_0x59ffaf){_0x397171=_0x59ffaf;_0x318949=0xc8;}else{_0x318949=0xce;}_0x256530[_0xc01a('0x23')](_0x318949);return _0x256530[_0xc01a('0x29')](_0xc01a('0x2a'),_0x59e31d+'-'+_0x397171+'/'+_0x59ffaf)[_0xc01a('0x2b')](_0x178b18);}return null;};}function patchUpdates(_0xa1db95){return function(_0x4d35ce){try{jsonpatch['apply'](_0x4d35ce,_0xa1db95,!![]);}catch(_0x8d67b3){return BPromise[_0xc01a('0x2c')](_0x8d67b3);}return _0x4d35ce['save']();};}function saveUpdates(_0x5f34b5,_0xff6a54){return function(_0x347c1f){if(_0x347c1f){return _0x347c1f['update'](_0x5f34b5)[_0xc01a('0x1b')](function(_0x3c1042){return _0x3c1042;});}return null;};}function removeEntity(_0x198015,_0x4b7dbc){return function(_0x5390ab){if(_0x5390ab){return _0x5390ab['destroy']()[_0xc01a('0x1b')](function(){var _0x4cb8fa=_0x5390ab['get']({'plain':!![]});var _0x1eaf8d=_0xc01a('0x2d');return db[_0xc01a('0x2e')][_0xc01a('0x2f')]({'where':{'type':_0x1eaf8d,'resourceId':_0x4cb8fa['id']}})[_0xc01a('0x1b')](function(){return _0x5390ab;});})[_0xc01a('0x1b')](function(){_0x198015[_0xc01a('0x23')](0xcc)[_0xc01a('0x24')]();});}};}function handleEntityNotFound(_0x8e441,_0x552d49){return function(_0x443bdf){if(!_0x443bdf){_0x8e441[_0xc01a('0x30')](0x194);}return _0x443bdf;};}function handleError(_0x578417,_0x2404d6){_0x2404d6=_0x2404d6||0x1f4;return function(_0xef3dcf){logger[_0xc01a('0x1f')](_0xef3dcf['stack']);if(_0xef3dcf[_0xc01a('0x31')]){delete _0xef3dcf[_0xc01a('0x31')];}_0x578417['status'](_0x2404d6)[_0xc01a('0x32')](_0xef3dcf);};}exports[_0xc01a('0x33')]=function(_0x312dde,_0x565303){var _0x5e814a={'include':[{'model':db[_0xc01a('0x34')],'as':_0xc01a('0x35')}]},_0x4e30e1={},_0x2e7324={'count':0x0,'rows':[]};var _0x3a6559=_[_0xc01a('0x36')](db[_0xc01a('0x37')][_0xc01a('0x38')],function(_0x241546){return{'name':_0x241546[_0xc01a('0x39')],'type':_0x241546[_0xc01a('0x3a')][_0xc01a('0x3b')]};});_0x4e30e1['model']=_[_0xc01a('0x36')](_0x3a6559,'name');_0x4e30e1['query']=_[_0xc01a('0x3c')](_0x312dde[_0xc01a('0x3d')]);_0x4e30e1[_0xc01a('0x3e')]=_[_0xc01a('0x3f')](_0x4e30e1[_0xc01a('0x40')],_0x4e30e1[_0xc01a('0x3d')]);_0x5e814a['attributes']=_[_0xc01a('0x3f')](_0x4e30e1[_0xc01a('0x40')],qs['fields'](_0x312dde['query'][_0xc01a('0x41')]));_0x5e814a[_0xc01a('0x42')]=_0x5e814a[_0xc01a('0x42')][_0xc01a('0x43')]?_0x5e814a[_0xc01a('0x42')]:_0x4e30e1['model'];if(!_0x312dde[_0xc01a('0x3d')]['hasOwnProperty'](_0xc01a('0x44'))){_0x5e814a['limit']=qs[_0xc01a('0x27')](_0x312dde[_0xc01a('0x3d')]['limit']);_0x5e814a[_0xc01a('0x25')]=qs[_0xc01a('0x25')](_0x312dde[_0xc01a('0x3d')][_0xc01a('0x25')]);}_0x5e814a[_0xc01a('0x45')]=qs[_0xc01a('0x46')](_0x312dde[_0xc01a('0x3d')]['sort']);_0x5e814a['where']=qs[_0xc01a('0x3e')](_[_0xc01a('0x47')](_0x312dde[_0xc01a('0x3d')],_0x4e30e1[_0xc01a('0x3e')]),_0x3a6559);if(_0x312dde['query'][_0xc01a('0x48')]){_0x5e814a[_0xc01a('0x49')]=_[_0xc01a('0x4a')](_0x5e814a['where'],{'$or':_[_0xc01a('0x36')](_0x3a6559,function(_0x50f1c1){if(_0x50f1c1['type']!=='VIRTUAL'){var _0x3ef3ec={};_0x3ef3ec[_0x50f1c1['name']]={'$like':'%'+_0x312dde[_0xc01a('0x3d')][_0xc01a('0x48')]+'%'};return _0x3ef3ec;}})});}_0x5e814a=_[_0xc01a('0x4a')]({},_0x5e814a,_0x312dde[_0xc01a('0x4b')]);var _0x9da877={'where':_0x5e814a[_0xc01a('0x49')]};return db['OpenchannelAccount'][_0xc01a('0x28')](_0x9da877)[_0xc01a('0x1b')](function(_0x1cfebc){_0x2e7324[_0xc01a('0x28')]=_0x1cfebc;if(_0x312dde[_0xc01a('0x3d')][_0xc01a('0x4c')]){_0x5e814a[_0xc01a('0x4d')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xc01a('0x4e')](_0x5e814a);})[_0xc01a('0x1b')](function(_0x11f719){_0x2e7324[_0xc01a('0x4f')]=_0x11f719;return _0x2e7324;})[_0xc01a('0x1b')](respondWithFilteredResult(_0x565303,_0x5e814a))[_0xc01a('0x22')](handleError(_0x565303,null));};exports[_0xc01a('0x50')]=function(_0xc761cf,_0x77e4ee){var _0x3c9fed={'raw':![],'where':{'id':_0xc761cf[_0xc01a('0x51')]['id']},'include':[{'model':db[_0xc01a('0x34')],'as':_0xc01a('0x35')}]},_0x439b21={};_0x439b21['model']=_[_0xc01a('0x3c')](db['OpenchannelAccount'][_0xc01a('0x38')]);_0x439b21[_0xc01a('0x3d')]=_[_0xc01a('0x3c')](_0xc761cf[_0xc01a('0x3d')]);_0x439b21[_0xc01a('0x3e')]=_['intersection'](_0x439b21[_0xc01a('0x40')],_0x439b21[_0xc01a('0x3d')]);_0x3c9fed[_0xc01a('0x42')]=_[_0xc01a('0x3f')](_0x439b21[_0xc01a('0x40')],qs[_0xc01a('0x41')](_0xc761cf[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x3c9fed[_0xc01a('0x42')]=_0x3c9fed['attributes'][_0xc01a('0x43')]?_0x3c9fed[_0xc01a('0x42')]:_0x439b21['model'];if(_0xc761cf[_0xc01a('0x3d')][_0xc01a('0x4c')]){_0x3c9fed['include']=[{'all':!![]}];}_0x3c9fed=_[_0xc01a('0x4a')]({},_0x3c9fed,_0xc761cf[_0xc01a('0x4b')]);return db[_0xc01a('0x37')][_0xc01a('0x52')](_0x3c9fed)[_0xc01a('0x1b')](handleEntityNotFound(_0x77e4ee,null))[_0xc01a('0x1b')](respondWithResult(_0x77e4ee,null))['catch'](handleError(_0x77e4ee,null));};exports[_0xc01a('0x53')]=function(_0x40e6ce,_0x3865fb){return db[_0xc01a('0x37')][_0xc01a('0x53')](_0x40e6ce['body'],{})[_0xc01a('0x1b')](function(_0x583f2d){var _0x18b955=_0x40e6ce['user']['get']({'plain':!![]});if(!_0x18b955)throw new Error(_0xc01a('0x54'));if(_0x18b955[_0xc01a('0x55')]===_0xc01a('0x56')){var _0x404c86=_0x583f2d[_0xc01a('0x57')]({'plain':!![]});var _0x395e4a=_0xc01a('0x2d');return db[_0xc01a('0x58')][_0xc01a('0x52')]({'where':{'name':_0x395e4a,'userProfileId':_0x18b955[_0xc01a('0x59')]},'raw':!![]})[_0xc01a('0x1b')](function(_0xead024){if(_0xead024&&_0xead024['autoAssociation']===0x0){return db[_0xc01a('0x2e')][_0xc01a('0x53')]({'name':_0x404c86['name'],'resourceId':_0x404c86['id'],'type':_0xead024[_0xc01a('0x31')],'sectionId':_0xead024['id']},{})[_0xc01a('0x1b')](function(){return _0x583f2d;});}else{return _0x583f2d;}})['catch'](function(_0xd46be1){logger[_0xc01a('0x1f')](_0xc01a('0x5a'),_0xd46be1);throw _0xd46be1;});}return _0x583f2d;})[_0xc01a('0x1b')](respondWithResult(_0x3865fb,0xc9))[_0xc01a('0x22')](handleError(_0x3865fb,null));};exports['update']=function(_0x2acccf,_0x11fc14){if(_0x2acccf[_0xc01a('0x5b')]['id']){delete _0x2acccf[_0xc01a('0x5b')]['id'];}return db['OpenchannelAccount'][_0xc01a('0x52')]({'where':{'id':_0x2acccf[_0xc01a('0x51')]['id']},'include':[{'model':db[_0xc01a('0x34')],'as':_0xc01a('0x35')}]})[_0xc01a('0x1b')](handleEntityNotFound(_0x11fc14,null))[_0xc01a('0x1b')](saveUpdates(_0x2acccf[_0xc01a('0x5b')],null))[_0xc01a('0x1b')](respondWithResult(_0x11fc14,null))[_0xc01a('0x22')](handleError(_0x11fc14,null));};exports['destroy']=function(_0x30f30f,_0x30156d){return db[_0xc01a('0x37')][_0xc01a('0x52')]({'where':{'id':_0x30f30f['params']['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x30156d,null))['then'](removeEntity(_0x30156d,null))[_0xc01a('0x22')](handleError(_0x30156d,null));};exports[_0xc01a('0x5c')]=function(_0x4769ca,_0xea9ac8){return db[_0xc01a('0x37')][_0xc01a('0x5c')]()[_0xc01a('0x1b')](respondWithResult(_0xea9ac8,null))[_0xc01a('0x22')](handleError(_0xea9ac8,null));};exports['addDisposition']=function(_0x315360,_0x120075,_0x20cb53){if(_0x315360['body']['id']){delete _0x315360['body']['id'];}return db[_0xc01a('0x37')][_0xc01a('0x52')]({'where':{'id':_0x315360[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x120075,null))[_0xc01a('0x1b')](function(_0x37131e){if(_0x37131e){_0x315360['body'][_0xc01a('0x5d')]=_0x37131e['id'];return db[_0xc01a('0x5e')][_0xc01a('0x53')](_0x315360[_0xc01a('0x5b')]);}})[_0xc01a('0x1b')](respondWithResult(_0x120075,null))[_0xc01a('0x22')](handleError(_0x120075,null));};exports[_0xc01a('0x5f')]=function(_0x17f04a,_0x2871b5,_0x350287){var _0x40aefa={'raw':![],'where':{}};var _0x4b8c12={};var _0x315da8={'count':0x0,'rows':[]};return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x17f04a[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x2871b5,null))[_0xc01a('0x1b')](function(_0x3c4a31){if(_0x3c4a31){_0x4b8c12[_0xc01a('0x40')]=_[_0xc01a('0x3c')](db[_0xc01a('0x5e')][_0xc01a('0x38')]);_0x4b8c12[_0xc01a('0x3d')]=_[_0xc01a('0x3c')](_0x17f04a[_0xc01a('0x3d')]);_0x4b8c12['filters']=_['intersection'](_0x4b8c12['model'],_0x4b8c12[_0xc01a('0x3d')]);_0x40aefa[_0xc01a('0x42')]=_[_0xc01a('0x3f')](_0x4b8c12[_0xc01a('0x40')],qs[_0xc01a('0x41')](_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x40aefa[_0xc01a('0x42')]=_0x40aefa[_0xc01a('0x42')][_0xc01a('0x43')]?_0x40aefa[_0xc01a('0x42')]:_0x4b8c12[_0xc01a('0x40')];if(!_0x17f04a[_0xc01a('0x3d')]['hasOwnProperty'](_0xc01a('0x44'))){_0x40aefa['limit']=qs[_0xc01a('0x27')](_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x27')]);_0x40aefa['offset']=qs[_0xc01a('0x25')](_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x25')]);}_0x40aefa[_0xc01a('0x45')]=qs[_0xc01a('0x46')](_0x17f04a[_0xc01a('0x3d')]['sort']);_0x40aefa[_0xc01a('0x49')]=qs[_0xc01a('0x3e')](_['pick'](_0x17f04a['query'],_0x4b8c12[_0xc01a('0x3e')]));_0x40aefa[_0xc01a('0x49')][_0xc01a('0x5d')]=_0x3c4a31['id'];if(_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x48')]){_0x40aefa[_0xc01a('0x49')]=_['merge'](_0x40aefa[_0xc01a('0x49')],{'$or':_[_0xc01a('0x36')](_0x40aefa[_0xc01a('0x42')],function(_0x3f39b4){var _0x1de799={};_0x1de799[_0x3f39b4]={'$like':'%'+_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x48')]+'%'};return _0x1de799;})});}_0x40aefa=_[_0xc01a('0x4a')]({},_0x40aefa,_0x17f04a['options']);return db[_0xc01a('0x5e')][_0xc01a('0x28')]({'where':_0x40aefa[_0xc01a('0x49')]})[_0xc01a('0x1b')](function(_0x2f017d){_0x315da8[_0xc01a('0x28')]=_0x2f017d;if(_0x17f04a[_0xc01a('0x3d')][_0xc01a('0x4c')]){_0x40aefa[_0xc01a('0x4d')]=[{'all':!![]}];}return db[_0xc01a('0x5e')][_0xc01a('0x4e')](_0x40aefa);})[_0xc01a('0x1b')](function(_0x3dc849){_0x315da8[_0xc01a('0x4f')]=_0x3dc849;return _0x315da8;});}})[_0xc01a('0x1b')](respondWithFilteredResult(_0x2871b5,_0x40aefa))[_0xc01a('0x22')](handleError(_0x2871b5,null));};exports[_0xc01a('0x61')]=function(_0x1380f3,_0x56bf60,_0x1ff445){return db[_0xc01a('0x37')][_0xc01a('0x52')]({'where':{'id':_0x1380f3[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x56bf60,null))[_0xc01a('0x1b')](function(_0x397215){if(_0x397215){return _0x397215[_0xc01a('0x61')](_0x1380f3['query'][_0xc01a('0x62')]);}})[_0xc01a('0x1b')](respondWithStatusCode(_0x56bf60,null))[_0xc01a('0x22')](handleError(_0x56bf60,null));};exports[_0xc01a('0x63')]=function(_0x353932,_0x386f0a,_0x3bfd17){if(_0x353932[_0xc01a('0x5b')]['id']){delete _0x353932[_0xc01a('0x5b')]['id'];}return db[_0xc01a('0x37')]['find']({'where':{'id':_0x353932[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x386f0a,null))[_0xc01a('0x1b')](function(_0x2e3209){if(_0x2e3209){_0x353932[_0xc01a('0x5b')][_0xc01a('0x5d')]=_0x2e3209['id'];return db[_0xc01a('0x64')][_0xc01a('0x53')](_0x353932[_0xc01a('0x5b')]);}})[_0xc01a('0x1b')](respondWithResult(_0x386f0a,null))[_0xc01a('0x22')](handleError(_0x386f0a,null));};exports[_0xc01a('0x65')]=function(_0x2ac7ce,_0x4f1334,_0x2bcff8){var _0x61d889={'raw':![],'where':{}};var _0x4de037={};var _0x5bd836={'count':0x0,'rows':[]};return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x2ac7ce[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x4f1334,null))[_0xc01a('0x1b')](function(_0x11dc8e){if(_0x11dc8e){_0x4de037[_0xc01a('0x40')]=_[_0xc01a('0x3c')](db[_0xc01a('0x64')][_0xc01a('0x38')]);_0x4de037['query']=_['keys'](_0x2ac7ce[_0xc01a('0x3d')]);_0x4de037[_0xc01a('0x3e')]=_['intersection'](_0x4de037[_0xc01a('0x40')],_0x4de037['query']);_0x61d889['attributes']=_['intersection'](_0x4de037[_0xc01a('0x40')],qs[_0xc01a('0x41')](_0x2ac7ce[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x61d889[_0xc01a('0x42')]=_0x61d889[_0xc01a('0x42')][_0xc01a('0x43')]?_0x61d889[_0xc01a('0x42')]:_0x4de037['model'];if(!_0x2ac7ce[_0xc01a('0x3d')][_0xc01a('0x66')](_0xc01a('0x44'))){_0x61d889[_0xc01a('0x27')]=qs[_0xc01a('0x27')](_0x2ac7ce[_0xc01a('0x3d')][_0xc01a('0x27')]);_0x61d889[_0xc01a('0x25')]=qs['offset'](_0x2ac7ce[_0xc01a('0x3d')]['offset']);}_0x61d889[_0xc01a('0x45')]=qs[_0xc01a('0x46')](_0x2ac7ce[_0xc01a('0x3d')][_0xc01a('0x46')]);_0x61d889[_0xc01a('0x49')]=qs[_0xc01a('0x3e')](_[_0xc01a('0x47')](_0x2ac7ce[_0xc01a('0x3d')],_0x4de037['filters']));_0x61d889[_0xc01a('0x49')][_0xc01a('0x5d')]=_0x11dc8e['id'];if(_0x2ac7ce[_0xc01a('0x3d')]['filter']){_0x61d889[_0xc01a('0x49')]=_['merge'](_0x61d889[_0xc01a('0x49')],{'$or':_['map'](_0x61d889[_0xc01a('0x42')],function(_0x3de0e4){var _0x2e8ce3={};_0x2e8ce3[_0x3de0e4]={'$like':'%'+_0x2ac7ce[_0xc01a('0x3d')][_0xc01a('0x48')]+'%'};return _0x2e8ce3;})});}_0x61d889=_[_0xc01a('0x4a')]({},_0x61d889,_0x2ac7ce[_0xc01a('0x4b')]);return db[_0xc01a('0x64')][_0xc01a('0x28')]({'where':_0x61d889[_0xc01a('0x49')]})['then'](function(_0xf51e92){_0x5bd836[_0xc01a('0x28')]=_0xf51e92;if(_0x2ac7ce['query'][_0xc01a('0x4c')]){_0x61d889[_0xc01a('0x4d')]=[{'all':!![]}];}return db[_0xc01a('0x64')][_0xc01a('0x4e')](_0x61d889);})['then'](function(_0x2ec3ba){_0x5bd836['rows']=_0x2ec3ba;return _0x5bd836;});}})[_0xc01a('0x1b')](respondWithFilteredResult(_0x4f1334,_0x61d889))[_0xc01a('0x22')](handleError(_0x4f1334,null));};exports[_0xc01a('0x67')]=function(_0xbf7c24,_0x34d0dd,_0x11af4a){return db['OpenchannelAccount']['find']({'where':{'id':_0xbf7c24[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x34d0dd,null))[_0xc01a('0x1b')](function(_0x509a01){if(_0x509a01){return _0x509a01['removeAnswers'](_0xbf7c24[_0xc01a('0x3d')][_0xc01a('0x62')]);}})[_0xc01a('0x1b')](respondWithStatusCode(_0x34d0dd,null))[_0xc01a('0x22')](handleError(_0x34d0dd,null));};exports[_0xc01a('0x68')]=function(_0x3257e8,_0x280d3c,_0x1f2c5e){var _0x39a7a0={'body':_0x3257e8[_0xc01a('0x5b')],'channel':_0xc01a('0x69')};var _0x2a0d11=[];var _0x5d1e57=[];var _0x3ac316={};var _0x20389c=![];return db['CmContact'][_0xc01a('0x5c')]()['then'](function(_0x2a8350){if(!_0x2a8350){throw new db[(_0xc01a('0x6a'))][(_0xc01a('0x6b'))](_0xc01a('0x6c'));}_0x2a0d11=_[_0xc01a('0x6d')](_[_0xc01a('0x3c')](_0x2a8350),[_0xc01a('0x6e'),'updatedAt']);_0x5d1e57=_[_0xc01a('0x6d')](_[_0xc01a('0x3c')](_0x2a8350),['createdAt',_0xc01a('0x6f'),_0xc01a('0x70'),_0xc01a('0x71')]);if(_0x3257e8[_0xc01a('0x5b')]['id']){delete _0x3257e8[_0xc01a('0x5b')]['id'];}if(_[_0xc01a('0x72')](_0x3257e8[_0xc01a('0x5b')]['from'])){throw new db['Sequelize'][(_0xc01a('0x6b'))](_0xc01a('0x73'));}if(_[_0xc01a('0x72')](_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x5b')])||_0x3257e8['body'][_0xc01a('0x5b')]===''){throw new db[(_0xc01a('0x6a'))][(_0xc01a('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc01a('0x72')](_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x74')])){throw new db['Sequelize'][(_0xc01a('0x6b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d1e57);}if(!_[_0xc01a('0x75')](_0x5d1e57,_0x3257e8['body'][_0xc01a('0x74')])){throw new db['Sequelize']['ValidationError'](_0xc01a('0x76')+_0x5d1e57);}_0x3ac316[_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x74')]]=_0x3257e8[_0xc01a('0x5b')]['from'];})[_0xc01a('0x1b')](function(){return db[_0xc01a('0x37')][_0xc01a('0x52')]({'where':{'id':_0x3257e8['params']['id']},'include':[{'model':db[_0xc01a('0x77')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc01a('0x78'),'where':_0x3ac316,'limit':0x1,'order':[[_0xc01a('0x6f'),_0xc01a('0x79')]]}]},{'model':db[_0xc01a('0x7a')],'as':_0xc01a('0x7b')}]});})[_0xc01a('0x1b')](handleEntityNotFound(_0x280d3c,null))[_0xc01a('0x1b')](function(_0x55e71b){if(_0x55e71b&&_0x55e71b[_0xc01a('0x7c')]){_0x39a7a0[_0xc01a('0x7d')]=_0x55e71b;_0x39a7a0[_0xc01a('0x7e')]=_0x55e71b[_0xc01a('0x7b')];_0x39a7a0[_0xc01a('0x7f')]=_0x55e71b['List'];_0x39a7a0[_0xc01a('0x7e')]=_[_0xc01a('0x80')](_0x39a7a0[_0xc01a('0x7e')],[_0xc01a('0x81')],['asc']);if(_0x39a7a0[_0xc01a('0x7d')][_0xc01a('0x7b')]){delete _0x39a7a0['account'][_0xc01a('0x7b')];}if(_0x39a7a0[_0xc01a('0x7d')][_0xc01a('0x7c')]&&_0x39a7a0['account'][_0xc01a('0x7c')][_0xc01a('0x78')][_0xc01a('0x43')]){return _0x39a7a0[_0xc01a('0x7d')][_0xc01a('0x7c')][_0xc01a('0x78')][0x0];}var _0x1cd7f8=_['defaults'](_0x3257e8[_0xc01a('0x5b')],{'firstName':_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x82')],'ListId':_0x55e71b[_0xc01a('0x71')]});_0x1cd7f8[_0x3257e8['body'][_0xc01a('0x74')]]=_0x3257e8[_0xc01a('0x5b')]['from'];return db[_0xc01a('0x83')][_0xc01a('0x53')](_0x1cd7f8,{'fields':_0x2a0d11,'raw':!![]});}})[_0xc01a('0x1b')](handleEntityNotFound(_0x280d3c,null))[_0xc01a('0x1b')](function(_0x4d90f7){_0x39a7a0['contact']=_0x4d90f7;if(_0x4d90f7){var _0x5d5602={'ContactId':_0x4d90f7['id'],'OpenchannelAccountId':_0x3257e8['params']['id'],'from':(_0x4d90f7[_0xc01a('0x84')]||'')+'\x20'+(_0x4d90f7['lastName']||'')};var _0x582b07={'OpenchannelAccountId':_0x3257e8[_0xc01a('0x51')]['id'],'closed':![]};if(_0x3257e8[_0xc01a('0x5b')]['threadId']){_0x582b07[_0xc01a('0x85')]=_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x85')];return db[_0xc01a('0x86')][_0xc01a('0x52')]({'where':_0x582b07})['then'](function(_0x379a12){if(_0x379a12){return[_0x379a12,![]];}_0x5d5602[_0xc01a('0x85')]=_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x85')];_0x5d5602[_0xc01a('0x87')]=_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x87')];return db['OpenchannelInteraction'][_0xc01a('0x53')](_0x5d5602)[_0xc01a('0x1b')](function(_0x4209fc){return[_0x4209fc,!![]];});});}else{_0x582b07[_0xc01a('0x85')]=null;}_0x582b07['ContactId']=_0x4d90f7['id'];return db[_0xc01a('0x86')]['find']({'where':_0x582b07})[_0xc01a('0x1b')](function(_0x3ed450){if(_0x3ed450){return[_0x3ed450,![]];}return db[_0xc01a('0x86')][_0xc01a('0x53')](_0x5d5602)[_0xc01a('0x1b')](function(_0x35ed9f){return[_0x35ed9f,!![]];});});}})[_0xc01a('0x88')](function(_0xba9749,_0x96110){if(_0xba9749){_0x20389c=_0x96110;if(!_0x96110){var _0x33c4ab={'from':(_0x39a7a0[_0xc01a('0x89')][_0xc01a('0x84')]||'')+'\x20'+(_0x39a7a0['contact'][_0xc01a('0x8a')]||'')};if(_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x85')]&&_0x3257e8['body'][_0xc01a('0x8b')]&&_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x85')]!=_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x8b')]){_0x33c4ab[_0xc01a('0x85')]=_0x3257e8[_0xc01a('0x5b')]['messageId'];}return _0xba9749[_0xc01a('0x8c')](_0x33c4ab);}else{return _0xba9749;}}})[_0xc01a('0x1b')](function(_0x264c89){_0x39a7a0[_0xc01a('0x8d')]=_0x264c89[_0xc01a('0x57')]({'plain':!![]});_0x39a7a0[_0xc01a('0x8d')][_0xc01a('0x8e')]=_0x20389c;if(_0x39a7a0[_0xc01a('0x8d')][_0xc01a('0x8e')]){if(_0x39a7a0['account']['autoclose']){_0x39a7a0[_0xc01a('0x7e')]['push']({'id':0x0,'priority':_0x39a7a0[_0xc01a('0x7e')][_0xc01a('0x43')]+0x1,'app':_0xc01a('0x8f'),'appdata':_0xc01a('0x90'),'interval':_0xc01a('0x91')});}}return db[_0xc01a('0x92')]['create']({'body':_0x3257e8['body'][_0xc01a('0x5b')],'OpenchannelAccountId':_0x3257e8[_0xc01a('0x51')]['id'],'OpenchannelInteractionId':_0x264c89['id'],'direction':'in','ContactId':_0x39a7a0[_0xc01a('0x89')]['id'],'AttachmentId':_0x3257e8[_0xc01a('0x5b')][_0xc01a('0x93')]});})[_0xc01a('0x1b')](function(_0x15d20a){_0x39a7a0[_0xc01a('0x21')]=_0x15d20a;if(_0x39a7a0[_0xc01a('0x8d')]['UserId']){return db[_0xc01a('0x94')][_0xc01a('0x52')]({'attributes':['id',_0xc01a('0x31')],'where':{'id':_0x39a7a0[_0xc01a('0x8d')]['UserId']}})[_0xc01a('0x1b')](function(_0x1626c6){if(_0x1626c6){_0x39a7a0[_0xc01a('0x7e')][_0xc01a('0x95')]({'id':0x0,'priority':0x0,'app':_0xc01a('0x96'),'appdata':_0x1626c6[_0xc01a('0x31')]+','+(_0x39a7a0[_0xc01a('0x7d')][_0xc01a('0x97')]||0xa),'interval':_0xc01a('0x91')});_0x39a7a0[_0xc01a('0x98')]=![];}return respondWithRpcPromise(_0xc01a('0x99'),_0xc01a('0x9a'),_0x39a7a0);});}return respondWithRpcPromise(_0xc01a('0x99'),_0xc01a('0x9a'),_0x39a7a0);})[_0xc01a('0x1b')](function(_0x3a63b2){respondWithRpcPromise(_0xc01a('0x9b'),'EventManager',{'event':_0xc01a('0x68'),'message':_0x3a63b2},client9002);return _0x3a63b2;})[_0xc01a('0x1b')](respondWithResult(_0x280d3c,null))['catch'](handleError(_0x280d3c,null));};exports[_0xc01a('0x9c')]=function(_0x488d06,_0xfc1292){var _0x46674b=_0x488d06[_0xc01a('0x51')]['id'];var _0x35d90f=_0x488d06[_0xc01a('0x5b')];var _0x19bd0e=0xc8;var _0x4e2b8c=null;return db[_0xc01a('0x9d')][_0xc01a('0x9e')]({'isolationLevel':db['sequelize'][_0xc01a('0x9f')][_0xc01a('0xa0')][_0xc01a('0xa1')]},function(_0x458a9d){return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x46674b},'transaction':_0x458a9d})[_0xc01a('0x1b')](function(_0xa7f217){if(_0xa7f217){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x46674b},'transaction':_0x458a9d})['then'](function(){var _0x54e1bc=_[_0xc01a('0x36')](_0x35d90f,function(_0x23dd4e){_0x23dd4e[_0xc01a('0x5d')]=_0x46674b;return _0x23dd4e;});return db[_0xc01a('0x7a')][_0xc01a('0xa2')](_0x54e1bc,{'transaction':_0x458a9d});});}else{_0x19bd0e=0x194;_0x4e2b8c=[];}});})['then'](function(){if(_0x19bd0e!==0x194){return db['OpenchannelApplication'][_0xc01a('0xa3')]({'where':{'OpenchannelAccountId':_0x46674b},'order':'priority'})[_0xc01a('0x1b')](function(_0x243861){_0x4e2b8c=_0x243861;});}})[_0xc01a('0x22')](function(_0x3a156d){_0x19bd0e=0x1f4;logger[_0xc01a('0x1f')](_0x3a156d['stack']);if(_0x3a156d[_0xc01a('0x31')]){delete _0x3a156d[_0xc01a('0x31')];}_0x4e2b8c=_0x3a156d;})[_0xc01a('0xa4')](function(){if(_0x4e2b8c===null){_0xfc1292['sendStatus'](_0x19bd0e);}else{if(_0x19bd0e===0x1f4){_0xfc1292[_0xc01a('0x23')](_0x19bd0e)[_0xc01a('0x32')](_0x4e2b8c);}else{_0xfc1292[_0xc01a('0x23')](_0x19bd0e)['json'](_0x4e2b8c);}}});};exports[_0xc01a('0xa5')]=function(_0x19dd80,_0x2ba8c4,_0x1ba2f8){var _0x1ef821={};var _0x109acb={};var _0x2ef3a9;var _0x1df86d;return db['OpenchannelAccount'][_0xc01a('0x60')]({'where':{'id':_0x19dd80[_0xc01a('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ba8c4,null))[_0xc01a('0x1b')](function(_0x3a0bf0){if(_0x3a0bf0){_0x2ef3a9=_0x3a0bf0;_0x109acb[_0xc01a('0x40')]=_[_0xc01a('0x3c')](db[_0xc01a('0x7a')][_0xc01a('0x38')]);_0x109acb[_0xc01a('0x3d')]=_['keys'](_0x19dd80['query']);_0x109acb[_0xc01a('0x3e')]=_[_0xc01a('0x3f')](_0x109acb[_0xc01a('0x40')],_0x109acb[_0xc01a('0x3d')]);_0x1ef821[_0xc01a('0x42')]=_[_0xc01a('0x3f')](_0x109acb['model'],qs[_0xc01a('0x41')](_0x19dd80[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x1ef821[_0xc01a('0x42')]=_0x1ef821[_0xc01a('0x42')][_0xc01a('0x43')]?_0x1ef821['attributes']:_0x109acb[_0xc01a('0x40')];_0x1ef821[_0xc01a('0x45')]=qs[_0xc01a('0x46')](_0x19dd80['query'][_0xc01a('0x46')]);_0x1ef821[_0xc01a('0x49')]=qs[_0xc01a('0x3e')](_[_0xc01a('0x47')](_0x19dd80[_0xc01a('0x3d')],_0x109acb['filters']));if(_0x19dd80['query']['filter']){_0x1ef821[_0xc01a('0x49')]=_[_0xc01a('0x4a')](_0x1ef821[_0xc01a('0x49')],{'$or':_[_0xc01a('0x36')](_0x1ef821[_0xc01a('0x42')],function(_0x50ef33){var _0x441fbf={};_0x441fbf[_0x50ef33]={'$like':'%'+_0x19dd80[_0xc01a('0x3d')][_0xc01a('0x48')]+'%'};return _0x441fbf;})});}_0x1ef821=_[_0xc01a('0x4a')]({},_0x1ef821,_0x19dd80[_0xc01a('0x4b')]);return _0x2ef3a9[_0xc01a('0xa5')](_0x1ef821);}})[_0xc01a('0x1b')](function(_0x379208){if(_0x379208){_0x1df86d=_0x379208[_0xc01a('0x43')];if(!_0x19dd80['query'][_0xc01a('0x66')](_0xc01a('0x44'))){_0x1ef821[_0xc01a('0x27')]=qs['limit'](_0x19dd80[_0xc01a('0x3d')]['limit']);_0x1ef821[_0xc01a('0x25')]=qs[_0xc01a('0x25')](_0x19dd80[_0xc01a('0x3d')][_0xc01a('0x25')]);}return _0x2ef3a9[_0xc01a('0xa5')](_0x1ef821);}})['then'](function(_0x8a4816){if(_0x8a4816){return _0x8a4816?{'count':_0x1df86d,'rows':_0x8a4816}:null;}})['then'](respondWithResult(_0x2ba8c4,null))[_0xc01a('0x22')](handleError(_0x2ba8c4,null));};exports['getInteractions']=function(_0x2c4ab5,_0x52ce71,_0x1b1b77){var _0x4ee00c={'raw':![],'where':{}};var _0x52b3cf={};var _0x3c806b={'count':0x0,'rows':[]};return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x2c4ab5[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x52ce71,null))['then'](function(_0x48b92b){if(_0x48b92b){_0x52b3cf['model']=_[_0xc01a('0x3c')](db[_0xc01a('0x86')]['rawAttributes']);_0x52b3cf[_0xc01a('0x3d')]=_[_0xc01a('0x3c')](_0x2c4ab5['query']);_0x52b3cf[_0xc01a('0x3e')]=_[_0xc01a('0x3f')](_0x52b3cf[_0xc01a('0x40')],_0x52b3cf[_0xc01a('0x3d')]);_0x4ee00c[_0xc01a('0x42')]=_[_0xc01a('0x3f')](_0x52b3cf['model'],qs[_0xc01a('0x41')](_0x2c4ab5[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x4ee00c[_0xc01a('0x42')]=_0x4ee00c['attributes'][_0xc01a('0x43')]?_0x4ee00c['attributes']:_0x52b3cf[_0xc01a('0x40')];if(!_0x2c4ab5[_0xc01a('0x3d')][_0xc01a('0x66')](_0xc01a('0x44'))){_0x4ee00c[_0xc01a('0x27')]=qs[_0xc01a('0x27')](_0x2c4ab5[_0xc01a('0x3d')][_0xc01a('0x27')]);_0x4ee00c[_0xc01a('0x25')]=qs[_0xc01a('0x25')](_0x2c4ab5['query'][_0xc01a('0x25')]);}_0x4ee00c[_0xc01a('0x45')]=qs[_0xc01a('0x46')](_0x2c4ab5[_0xc01a('0x3d')][_0xc01a('0x46')]);_0x4ee00c['where']=qs[_0xc01a('0x3e')](_[_0xc01a('0x47')](_0x2c4ab5[_0xc01a('0x3d')],_0x52b3cf['filters']));_0x4ee00c['where'][_0xc01a('0x5d')]=_0x48b92b['id'];if(_0x2c4ab5[_0xc01a('0x3d')]['filter']){_0x4ee00c['where']=_[_0xc01a('0x4a')](_0x4ee00c[_0xc01a('0x49')],{'$or':_['map'](_0x4ee00c[_0xc01a('0x42')],function(_0x1ed0e1){var _0x301b49={};_0x301b49[_0x1ed0e1]={'$like':'%'+_0x2c4ab5['query'][_0xc01a('0x48')]+'%'};return _0x301b49;})});}_0x4ee00c=_[_0xc01a('0x4a')]({},_0x4ee00c,_0x2c4ab5[_0xc01a('0x4b')]);return db[_0xc01a('0x86')][_0xc01a('0x28')]({'where':_0x4ee00c[_0xc01a('0x49')]})[_0xc01a('0x1b')](function(_0x17e12e){_0x3c806b[_0xc01a('0x28')]=_0x17e12e;if(_0x2c4ab5['query'][_0xc01a('0x4c')]){_0x4ee00c[_0xc01a('0x4d')]=[{'model':db[_0xc01a('0x83')],'as':_0xc01a('0xa6'),'required':![]},{'model':db[_0xc01a('0x94')],'as':_0xc01a('0xa7'),'attributes':[_0xc01a('0x31'),_0xc01a('0xa8'),_0xc01a('0xa9')],'required':![]},{'model':db[_0xc01a('0xaa')],'as':'Tags','attributes':['id',_0xc01a('0x31'),_0xc01a('0xab')],'where':_0x2c4ab5['query']['tag']?{'id':_0x2c4ab5['query'][_0xc01a('0xac')]}:undefined,'required':_0x2c4ab5[_0xc01a('0x3d')][_0xc01a('0xac')]?!![]:![]}];}return db[_0xc01a('0x86')][_0xc01a('0x4e')](_0x4ee00c);})[_0xc01a('0x1b')](function(_0x5f2578){_0x3c806b[_0xc01a('0x4f')]=_0x5f2578;return _0x3c806b;});}})[_0xc01a('0x1b')](respondWithFilteredResult(_0x52ce71,_0x4ee00c))[_0xc01a('0x22')](handleError(_0x52ce71,null));};exports[_0xc01a('0xad')]=function(_0x21ca57,_0x228978,_0xa7b31e){return db['OpenchannelAccount'][_0xc01a('0x52')]({'where':{'id':_0x21ca57['params']['id']}})['then'](handleEntityNotFound(_0x228978,null))['then'](function(_0x3c6a34){if(_0x3c6a34){return _0x3c6a34['addAgents'](_0x21ca57[_0xc01a('0x5b')][_0xc01a('0x62')],_[_0xc01a('0xae')](_0x21ca57[_0xc01a('0x5b')],[_0xc01a('0x62'),'id'])||{})[_0xc01a('0x88')](function(_0x99ed91){for(var _0x1a8df1=0x0;_0x1a8df1<_0x21ca57[_0xc01a('0x5b')][_0xc01a('0x62')][_0xc01a('0x43')];_0x1a8df1+=0x1){socket[_0xc01a('0xaf')]('userOpenchannelAccount:save',{'UserId':Number(_0x21ca57[_0xc01a('0x5b')][_0xc01a('0x62')][_0x1a8df1]),'OpenchannelAccountId':Number(_0x21ca57[_0xc01a('0x51')]['id'])});}return _0x99ed91;});}})[_0xc01a('0x1b')](respondWithResult(_0x228978,null))[_0xc01a('0x22')](handleError(_0x228978,null));};exports[_0xc01a('0xb0')]=function(_0x5486eb,_0x202b84,_0xeb8072){return db[_0xc01a('0x37')]['find']({'where':{'id':_0x5486eb['params']['id']}})['then'](handleEntityNotFound(_0x202b84,null))['then'](function(_0x534c6d){if(_0x534c6d){return _0x534c6d['removeAgents'](_0x5486eb['query'][_0xc01a('0x62')])['then'](function(){if(_[_0xc01a('0xb1')](_0x5486eb[_0xc01a('0x3d')]['ids'])){for(var _0x4f7f5a=0x0;_0x4f7f5a<_0x5486eb['query'][_0xc01a('0x62')][_0xc01a('0x43')];_0x4f7f5a+=0x1){socket[_0xc01a('0xaf')](_0xc01a('0xb2'),{'UserId':Number(_0x5486eb[_0xc01a('0x3d')][_0xc01a('0x62')][_0x4f7f5a]),'OpenchannelAccountId':Number(_0x5486eb[_0xc01a('0x51')]['id'])});}}else{socket[_0xc01a('0xaf')](_0xc01a('0xb2'),{'UserId':Number(_0x5486eb[_0xc01a('0x3d')][_0xc01a('0x62')]),'OpenchannelAccountId':Number(_0x5486eb[_0xc01a('0x51')]['id'])});}});}})[_0xc01a('0x1b')](respondWithStatusCode(_0x202b84,null))[_0xc01a('0x22')](handleError(_0x202b84,null));};exports['getAgents']=function(_0x1c255c,_0x13dd38,_0x38e6df){var _0x1949d1={};var _0x7d8930={};var _0x176bd1;var _0x3b8ab1;return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x1c255c[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x13dd38,null))['then'](function(_0xb2ff58){if(_0xb2ff58){_0x176bd1=_0xb2ff58;_0x7d8930['model']=_[_0xc01a('0x3c')](db[_0xc01a('0x94')][_0xc01a('0x38')]);_0x7d8930[_0xc01a('0x3d')]=_[_0xc01a('0x3c')](_0x1c255c[_0xc01a('0x3d')]);_0x7d8930[_0xc01a('0x3e')]=_[_0xc01a('0x3f')](_0x7d8930[_0xc01a('0x40')],_0x7d8930[_0xc01a('0x3d')]);_0x1949d1['attributes']=_['intersection'](_0x7d8930['model'],qs['fields'](_0x1c255c[_0xc01a('0x3d')][_0xc01a('0x41')]));_0x1949d1[_0xc01a('0x42')]=_0x1949d1[_0xc01a('0x42')][_0xc01a('0x43')]?_0x1949d1['attributes']:_0x7d8930[_0xc01a('0x40')];_0x1949d1[_0xc01a('0x45')]=qs['sort'](_0x1c255c[_0xc01a('0x3d')][_0xc01a('0x46')]);_0x1949d1[_0xc01a('0x49')]=qs[_0xc01a('0x3e')](_[_0xc01a('0x47')](_0x1c255c[_0xc01a('0x3d')],_0x7d8930['filters']));if(_0x1c255c[_0xc01a('0x3d')]['filter']){_0x1949d1['where']=_['merge'](_0x1949d1[_0xc01a('0x49')],{'$or':_[_0xc01a('0x36')](_0x1949d1[_0xc01a('0x42')],function(_0x24146b){var _0x285b0a={};_0x285b0a[_0x24146b]={'$like':'%'+_0x1c255c[_0xc01a('0x3d')][_0xc01a('0x48')]+'%'};return _0x285b0a;})});}_0x1949d1=_[_0xc01a('0x4a')]({},_0x1949d1,_0x1c255c[_0xc01a('0x4b')]);return _0x176bd1[_0xc01a('0xb3')](_0x1949d1);}})['then'](function(_0x264652){if(_0x264652){_0x3b8ab1=_0x264652[_0xc01a('0x43')];if(!_0x1c255c[_0xc01a('0x3d')][_0xc01a('0x66')](_0xc01a('0x44'))){_0x1949d1[_0xc01a('0x27')]=qs[_0xc01a('0x27')](_0x1c255c[_0xc01a('0x3d')]['limit']);_0x1949d1[_0xc01a('0x25')]=qs['offset'](_0x1c255c[_0xc01a('0x3d')][_0xc01a('0x25')]);}return _0x176bd1[_0xc01a('0xb3')](_0x1949d1);}})[_0xc01a('0x1b')](function(_0x163b03){if(_0x163b03){return _0x163b03?{'count':_0x3b8ab1,'rows':_0x163b03}:null;}})[_0xc01a('0x1b')](respondWithResult(_0x13dd38,null))[_0xc01a('0x22')](handleError(_0x13dd38,null));};exports['send']=function(_0x3c8d5b,_0x278a78,_0x1cb779){var _0x52bee1,_0x5a8e4f,_0x6d5bba;if(_[_0xc01a('0x72')](_0x3c8d5b[_0xc01a('0x5b')][_0xc01a('0x5b')])||_0x3c8d5b[_0xc01a('0x5b')]['body']===''){throw new db[(_0xc01a('0x6a'))][(_0xc01a('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3c8d5b[_0xc01a('0x5b')]['to'])){}_0x52bee1=_0x3c8d5b[_0xc01a('0x5b')]['to'];return db[_0xc01a('0x37')][_0xc01a('0x60')]({'where':{'id':_0x3c8d5b[_0xc01a('0x51')]['id']}})[_0xc01a('0x1b')](handleEntityNotFound(_0x278a78,null))['then'](function(_0x1f5045){if(_0x1f5045){return db['OpenchannelAccount']['find']({'where':{'id':_0x1f5045['id']},'include':[{'model':db['CmList'],'as':_0xc01a('0x7c'),'include':[{'model':db[_0xc01a('0x83')],'as':_0xc01a('0x78'),'where':{[_0x1f5045[_0xc01a('0x74')]]:_0x52bee1},'limit':0x1,'order':[[_0xc01a('0x6f'),_0xc01a('0x79')]]}]}]})[_0xc01a('0x1b')](handleEntityNotFound(_0x278a78,null))[_0xc01a('0x1b')](function(_0x37809f){if(_0x37809f&&_0x37809f[_0xc01a('0x7c')]){_0x5a8e4f=_0x37809f[_0xc01a('0x57')]({'plain':!![]});if(_0x5a8e4f['List']&&_0x5a8e4f[_0xc01a('0x7c')][_0xc01a('0x78')][_0xc01a('0x43')]){return _0x5a8e4f['List']['Contacts'][0x0];}return db['CmContact'][_0xc01a('0x53')](_[_0xc01a('0x14')](_0x3c8d5b['body'],{'firstName':_0x52bee1,[_0x37809f[_0xc01a('0x74')]]:_0x52bee1,'phone':_0x52bee1,'ListId':_0x5a8e4f[_0xc01a('0x71')]}));}})[_0xc01a('0x1b')](handleEntityNotFound(_0x278a78,null))['then'](function(_0x309615){if(_0x309615){_0x6d5bba=_0x309615;return db[_0xc01a('0x86')]['find']({'where':{'ContactId':_0x6d5bba['id'],'closed':![],'OpenchannelAccountId':_0x5a8e4f['id']}})['then'](function(_0x204f5e){if(_0x204f5e){return[_0x204f5e,![]];}return db[_0xc01a('0x86')][_0xc01a('0x53')]({'UserId':_0x3c8d5b[_0xc01a('0x56')]['id'],'ContactId':_0x6d5bba['id'],'OpenchannelAccountId':_0x5a8e4f['id'],'lastMsgDirection':'out','Messages':[_[_0xc01a('0x4a')](_0x3c8d5b[_0xc01a('0x5b')],{'read':![],'body':_0x3c8d5b['body'][_0xc01a('0x5b')],'OpenchannelAccountId':_0x5a8e4f['id'],'UserId':_0x3c8d5b['user']['id'],'ContactId':_0x6d5bba['id']})]},{'include':[{'model':db[_0xc01a('0x92')],'as':_0xc01a('0xb4')}]})['then'](function(_0xa2e447){return[_0xa2e447,!![]];});});}})[_0xc01a('0x88')](function(_0x17894b,_0x302fa1){if(_0x302fa1){return _0x17894b;}return db[_0xc01a('0x92')]['create'](_[_0xc01a('0x4a')](_0x3c8d5b[_0xc01a('0x5b')],{'read':![],'body':_0x3c8d5b['body']['body'],'OpenchannelAccountId':_0x5a8e4f['id'],'OpenchannelInteractionId':_0x17894b['id'],'UserId':_0x3c8d5b[_0xc01a('0x56')]['id'],'ContactId':_0x6d5bba['id']}))['then'](function(_0x3b26a1){_0x17894b[_0xc01a('0xb5')]['Messages']=[];_0x17894b['dataValues'][_0xc01a('0xb4')][_0xc01a('0xb6')](_0x3b26a1[_0xc01a('0xb5')]);return _0x17894b;});});}})[_0xc01a('0x1b')](respondWithResult(_0x278a78,null))[_0xc01a('0x22')](handleError(_0x278a78,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 983ca73..fb287dc 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d9be4,_0x5df4b6){var _0x44650b=function(_0x105191){while(--_0x105191){_0x5d9be4['push'](_0x5d9be4['shift']());}};_0x44650b(++_0x5df4b6);}(_0x750a,0x140));var _0xa750=function(_0x93fc2c,_0x5e8ef0){_0x93fc2c=_0x93fc2c-0x0;var _0x221c5d=_0x750a[_0x93fc2c];return _0x221c5d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x5ae8bb,_0x7be596){var _0x44606c=function(_0x3e65c3){while(--_0x3e65c3){_0x5ae8bb['push'](_0x5ae8bb['shift']());}};_0x44606c(++_0x7be596);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 03fb579..15244e0 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(_0x54cfc0,_0x199b1c){var _0xfb2c8b=function(_0x5499b3){while(--_0x5499b3){_0x54cfc0['push'](_0x54cfc0['shift']());}};_0xfb2c8b(++_0x199b1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0xed7ec3,_0x4010d6){var _0x16e8db=function(_0x1027d4){while(--_0x1027d4){_0xed7ec3['push'](_0xed7ec3['shift']());}};_0x16e8db(++_0x4010d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 5d680cd..2050279 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5efe95,_0x30917d){var _0x338c80=function(_0x4e8eae){while(--_0x4e8eae){_0x5efe95['push'](_0x5efe95['shift']());}};_0x338c80(++_0x30917d);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x0fd9[_0x5eaa0b];return _0x28b295;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});config['redis']=_[_0x90fd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90fd('0xb'))(new Redis(config[_0x90fd('0xc')]));require('./openchannelAccount.socket')[_0x90fd('0xd')](socket);function respondWithRpcPromise(_0x464236,_0x3c0592,_0x3262f6){return new BPromise(function(_0x289693,_0x3be346){return client[_0x90fd('0xe')](_0x464236,_0x3262f6)[_0x90fd('0xf')](function(_0x3c541e){logger['info'](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));logger['debug'](_0x90fd('0x12'),_0x3c0592,_0x90fd('0x11'),JSON[_0x90fd('0x13')](_0x3c541e));if(_0x3c541e['error']){if(_0x3c541e[_0x90fd('0x14')]['code']===0x1f4){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);return _0x3be346(_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);}logger[_0x90fd('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c0592,_0x3c541e['error'][_0x90fd('0x15')]);return _0x289693(_0x3c541e[_0x90fd('0x14')]['message']);}else{logger[_0x90fd('0x16')](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));_0x289693(_0x3c541e['result'][_0x90fd('0x15')]);}})[_0x90fd('0x17')](function(_0x16d8a7){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x16d8a7);_0x3be346(_0x16d8a7);});});} \ No newline at end of file +var _0x80df=['OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','error','code'];(function(_0x6debee,_0x2a11a9){var _0x25424c=function(_0x4e4b1d){while(--_0x4e4b1d){_0x6debee['push'](_0x6debee['shift']());}};_0x25424c(++_0x2a11a9);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});config[_0xf80d('0xd')]=_['defaults'](config[_0xf80d('0xd')],{'host':_0xf80d('0xe'),'port':0x18eb});var socket=require(_0xf80d('0xf'))(new Redis(config[_0xf80d('0xd')]));require(_0xf80d('0x10'))[_0xf80d('0x11')](socket);function respondWithRpcPromise(_0x41595f,_0x45d290,_0x2fddc2){return new BPromise(function(_0x2ef5d1,_0x30df95){return client[_0xf80d('0x12')](_0x41595f,_0x2fddc2)[_0xf80d('0x13')](function(_0x29bd2c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'));logger[_0xf80d('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'),JSON['stringify'](_0x29bd2c));if(_0x29bd2c[_0xf80d('0x16')]){if(_0x29bd2c['error'][_0xf80d('0x17')]===0x1f4){logger['error'](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x30df95(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}logger[_0xf80d('0x16')](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x2ef5d1(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}else{logger[_0xf80d('0x1a')](_0xf80d('0x18'),_0x45d290,_0xf80d('0x14'));_0x2ef5d1(_0x29bd2c[_0xf80d('0x1b')][_0xf80d('0x19')]);}})[_0xf80d('0x1c')](function(_0x124174){logger[_0xf80d('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0x124174);_0x30df95(_0x124174);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index bab5b76..d6f5ca7 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 _0xce9b=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x20adc6,_0x3b3d3a){var _0x362885=function(_0x4a1ef1){while(--_0x4a1ef1){_0x20adc6['push'](_0x20adc6['shift']());}};_0x362885(++_0x3b3d3a);}(_0xce9b,0xc6));var _0xbce9=function(_0x48e0d4,_0x4ae82f){_0x48e0d4=_0x48e0d4-0x0;var _0x3a39d6=_0xce9b[_0x48e0d4];return _0x3a39d6;};'use strict';var OpenchannelAccountEvents=require(_0xbce9('0x0'));var events=[_0xbce9('0x1'),_0xbce9('0x2'),_0xbce9('0x3')];function createListener(_0x403c53,_0x81b4e1){return function(_0xa8a2e6){_0x81b4e1[_0xbce9('0x4')](_0x403c53,_0xa8a2e6);};}function removeListener(_0x54ef29,_0x2461ee){return function(){OpenchannelAccountEvents[_0xbce9('0x5')](_0x54ef29,_0x2461ee);};}exports[_0xbce9('0x6')]=function(_0x256ce6){for(var _0x1c40fa=0x0,_0x2c336a=events[_0xbce9('0x7')];_0x1c40fa<_0x2c336a;_0x1c40fa++){var _0x562634=events[_0x1c40fa];var _0x5d92c3=createListener(_0xbce9('0x8')+_0x562634,_0x256ce6);OpenchannelAccountEvents['on'](_0x562634,_0x5d92c3);}}; \ No newline at end of file +var _0xb677=['remove','update','emit','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x1a5f2b,_0x51a8b8){var _0xcc90e4=function(_0x155660){while(--_0x155660){_0x1a5f2b['push'](_0x1a5f2b['shift']());}};_0xcc90e4(++_0x51a8b8);}(_0xb677,0x119));var _0x7b67=function(_0x53013d,_0x583c2a){_0x53013d=_0x53013d-0x0;var _0x1b5377=_0xb677[_0x53013d];return _0x1b5377;};'use strict';var OpenchannelAccountEvents=require(_0x7b67('0x0'));var events=['save',_0x7b67('0x1'),_0x7b67('0x2')];function createListener(_0x388b87,_0x749563){return function(_0x13f678){_0x749563[_0x7b67('0x3')](_0x388b87,_0x13f678);};}function removeListener(_0x927eee,_0x28e9f6){return function(){OpenchannelAccountEvents['removeListener'](_0x927eee,_0x28e9f6);};}exports[_0x7b67('0x4')]=function(_0x21ccf2){for(var _0x2beadb=0x0,_0x3b7a82=events['length'];_0x2beadb<_0x3b7a82;_0x2beadb++){var _0x5af161=events[_0x2beadb];var _0x560eea=createListener(_0x7b67('0x5')+_0x5af161,_0x21ccf2);OpenchannelAccountEvents['on'](_0x5af161,_0x560eea);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b6bbeb4..85e5764 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 _0xa7a4=['exports','multer','util','connect-timeout','express','fs-extra','./openchannelApplication.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x4e0187,_0xf730a7){var _0x50dd33=function(_0xad081b){while(--_0xad081b){_0x4e0187['push'](_0x4e0187['shift']());}};_0x50dd33(++_0xf730a7);}(_0xa7a4,0x91));var _0x4a7a=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xa7a4[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x4a7a('0x0'));var util=require(_0x4a7a('0x1'));var path=require('path');var timeout=require(_0x4a7a('0x2'));var express=require(_0x4a7a('0x3'));var router=express['Router']();var fs_extra=require(_0x4a7a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a7a('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4a7a('0x6')](_0x4a7a('0x7'),auth[_0x4a7a('0x8')](),controller[_0x4a7a('0x9')]);router[_0x4a7a('0xa')]('/',auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xb')]);router['put']('/:id',auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xc')]);router[_0x4a7a('0xd')](_0x4a7a('0x7'),auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xe')]);module[_0x4a7a('0xf')]=router; \ No newline at end of file +var _0x03a8=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x5d2f44,_0x148a36){var _0xc0883b=function(_0x5c7950){while(--_0x5c7950){_0x5d2f44['push'](_0x5d2f44['shift']());}};_0xc0883b(++_0x148a36);}(_0x03a8,0x1ec));var _0x803a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03a8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x803a('0x0'));var util=require('util');var path=require(_0x803a('0x1'));var timeout=require(_0x803a('0x2'));var express=require('express');var router=express[_0x803a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x803a('0x4'));var interaction=require(_0x803a('0x5'));var config=require(_0x803a('0x6'));var controller=require('./openchannelApplication.controller');router[_0x803a('0x7')]('/',auth[_0x803a('0x8')](),controller['index']);router[_0x803a('0x7')](_0x803a('0x9'),auth[_0x803a('0x8')](),controller[_0x803a('0xa')]);router[_0x803a('0xb')]('/',auth['isAuthenticated'](),controller[_0x803a('0xc')]);router[_0x803a('0xd')](_0x803a('0x9'),auth[_0x803a('0x8')](),controller['update']);router[_0x803a('0xe')](_0x803a('0x9'),auth[_0x803a('0x8')](),controller[_0x803a('0xf')]);module[_0x803a('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 613fa94..8bbb00c 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 _0xb286=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x48ea38,_0xb5b397){var _0xa6780=function(_0x1888ee){while(--_0x1888ee){_0x48ea38['push'](_0x48ea38['shift']());}};_0xa6780(++_0xb5b397);}(_0xb286,0xee));var _0x6b28=function(_0x19efa4,_0x4cef94){_0x19efa4=_0x19efa4-0x0;var _0x3ae34d=_0xb286[_0x19efa4];return _0x3ae34d;};'use strict';var Sequelize=require(_0x6b28('0x0'));module[_0x6b28('0x1')]={'priority':{'type':Sequelize[_0x6b28('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6b28('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6b28('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6b28('0x3')],'defaultValue':_0x6b28('0x5')}}; \ No newline at end of file +var _0x6b6d=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x3d2f6a,_0x3e4923){var _0x5c4851=function(_0x213ba1){while(--_0x213ba1){_0x3d2f6a['push'](_0x3d2f6a['shift']());}};_0x5c4851(++_0x3e4923);}(_0x6b6d,0x124));var _0xd6b6=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x6b6d[_0x2fee96];return _0x2e6ad1;};'use strict';var Sequelize=require('sequelize');module[_0xd6b6('0x0')]={'priority':{'type':Sequelize[_0xd6b6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd6b6('0x2')],'allowNull':![],'defaultValue':_0xd6b6('0x3')},'appdata':{'type':Sequelize[_0xd6b6('0x4')]()},'description':{'type':Sequelize[_0xd6b6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 17329e5..bbc1e80 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 _0xa0ab=['Content-Range','apply','reject','update','then','error','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa0ab,0x1e0));var _0xba0a=function(_0x262588,_0x42d3b6){_0x262588=_0x262588-0x0;var _0x55ae16=_0xa0ab[_0x262588];return _0x55ae16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba0a('0x0'));var zipdir=require(_0xba0a('0x1'));var jsonpatch=require(_0xba0a('0x2'));var rp=require('request-promise');var moment=require(_0xba0a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba0a('0x4'));var path=require(_0xba0a('0x5'));var sox=require(_0xba0a('0x6'));var csv=require(_0xba0a('0x7'));var ejs=require(_0xba0a('0x8'));var fs=require('fs');var fs_extra=require(_0xba0a('0x9'));var _=require(_0xba0a('0xa'));var squel=require('squel');var crypto=require(_0xba0a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xba0a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xba0a('0xd'));var Papa=require(_0xba0a('0xe'));var Redis=require('ioredis');var authService=require(_0xba0a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba0a('0x10'));var hardwareService=require(_0xba0a('0x11'));var logger=require(_0xba0a('0x12'))(_0xba0a('0x13'));var utils=require(_0xba0a('0x14'));var config=require(_0xba0a('0x15'));var licenseUtil=require(_0xba0a('0x16'));var db=require(_0xba0a('0x17'))['db'];function respondWithStatusCode(_0x5a1f1a,_0x1e6135){_0x1e6135=_0x1e6135||0xcc;return function(_0x4fe608){if(_0x4fe608){return _0x5a1f1a[_0xba0a('0x18')](_0x1e6135);}return _0x5a1f1a['status'](_0x1e6135)[_0xba0a('0x19')]();};}function respondWithResult(_0x5e5909,_0x4e02e1){_0x4e02e1=_0x4e02e1||0xc8;return function(_0x2d61fa){if(_0x2d61fa){return _0x5e5909[_0xba0a('0x1a')](_0x4e02e1)[_0xba0a('0x1b')](_0x2d61fa);}};}function respondWithFilteredResult(_0x340333,_0x425b78){return function(_0x256cb8){if(_0x256cb8){var _0x2e16a4=typeof _0x425b78[_0xba0a('0x1c')]===_0xba0a('0x1d')&&typeof _0x425b78['limit']==='undefined';var _0x44c2ba=_0x256cb8[_0xba0a('0x1e')];var _0x3a56bd=_0x2e16a4?0x0:_0x425b78[_0xba0a('0x1c')];var _0xabe442=_0x2e16a4?_0x256cb8[_0xba0a('0x1e')]:_0x425b78[_0xba0a('0x1c')]+_0x425b78['limit'];var _0x1034b4;if(_0xabe442>=_0x44c2ba){_0xabe442=_0x44c2ba;_0x1034b4=0xc8;}else{_0x1034b4=0xce;}_0x340333[_0xba0a('0x1a')](_0x1034b4);return _0x340333['set'](_0xba0a('0x1f'),_0x3a56bd+'-'+_0xabe442+'/'+_0x44c2ba)[_0xba0a('0x1b')](_0x256cb8);}return null;};}function patchUpdates(_0x4f4e31){return function(_0x42a457){try{jsonpatch[_0xba0a('0x20')](_0x42a457,_0x4f4e31,!![]);}catch(_0x3a40f2){return BPromise[_0xba0a('0x21')](_0x3a40f2);}return _0x42a457['save']();};}function saveUpdates(_0x581b0c,_0x20cdf6){return function(_0x4d8f02){if(_0x4d8f02){return _0x4d8f02[_0xba0a('0x22')](_0x581b0c)[_0xba0a('0x23')](function(_0x52cb20){return _0x52cb20;});}return null;};}function removeEntity(_0x452867,_0x2cc2bc){return function(_0x4d75c5){if(_0x4d75c5){return _0x4d75c5['destroy']()[_0xba0a('0x23')](function(){_0x452867[_0xba0a('0x1a')](0xcc)[_0xba0a('0x19')]();});}};}function handleEntityNotFound(_0x1fbb3e,_0x42137e){return function(_0x1eb969){if(!_0x1eb969){_0x1fbb3e[_0xba0a('0x18')](0x194);}return _0x1eb969;};}function handleError(_0x5badfe,_0x570d7a){_0x570d7a=_0x570d7a||0x1f4;return function(_0x316593){logger[_0xba0a('0x24')](_0x316593['stack']);if(_0x316593[_0xba0a('0x25')]){delete _0x316593[_0xba0a('0x25')];}_0x5badfe[_0xba0a('0x1a')](_0x570d7a)[_0xba0a('0x26')](_0x316593);};}exports['index']=function(_0x18f55a,_0x1ffb33){var _0x69b3f1={},_0x1db900={},_0x11eec1={'count':0x0,'rows':[]};var _0xb5ebec=_[_0xba0a('0x27')](db[_0xba0a('0x28')]['rawAttributes'],function(_0xe7c274){return{'name':_0xe7c274[_0xba0a('0x29')],'type':_0xe7c274[_0xba0a('0x2a')][_0xba0a('0x2b')]};});_0x1db900[_0xba0a('0x2c')]=_[_0xba0a('0x27')](_0xb5ebec,'name');_0x1db900[_0xba0a('0x2d')]=_[_0xba0a('0x2e')](_0x18f55a[_0xba0a('0x2d')]);_0x1db900[_0xba0a('0x2f')]=_['intersection'](_0x1db900['model'],_0x1db900['query']);_0x69b3f1[_0xba0a('0x30')]=_[_0xba0a('0x31')](_0x1db900['model'],qs[_0xba0a('0x32')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x32')]));_0x69b3f1[_0xba0a('0x30')]=_0x69b3f1[_0xba0a('0x30')][_0xba0a('0x33')]?_0x69b3f1[_0xba0a('0x30')]:_0x1db900[_0xba0a('0x2c')];if(!_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x34')](_0xba0a('0x35'))){_0x69b3f1[_0xba0a('0x36')]=qs[_0xba0a('0x36')](_0x18f55a[_0xba0a('0x2d')]['limit']);_0x69b3f1['offset']=qs[_0xba0a('0x1c')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x1c')]);}_0x69b3f1[_0xba0a('0x37')]=qs[_0xba0a('0x38')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x38')]);_0x69b3f1['where']=qs[_0xba0a('0x2f')](_[_0xba0a('0x39')](_0x18f55a[_0xba0a('0x2d')],_0x1db900['filters']),_0xb5ebec);if(_0x18f55a['query'][_0xba0a('0x3a')]){_0x69b3f1[_0xba0a('0x3b')]=_[_0xba0a('0x3c')](_0x69b3f1['where'],{'$or':_['map'](_0xb5ebec,function(_0xd2e61f){if(_0xd2e61f['type']!=='VIRTUAL'){var _0x523df7={};_0x523df7[_0xd2e61f['name']]={'$like':'%'+_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x3a')]+'%'};return _0x523df7;}})});}_0x69b3f1=_['merge']({},_0x69b3f1,_0x18f55a[_0xba0a('0x3d')]);var _0x4d1747={'where':_0x69b3f1['where']};return db[_0xba0a('0x28')]['count'](_0x4d1747)[_0xba0a('0x23')](function(_0x40a8cc){_0x11eec1[_0xba0a('0x1e')]=_0x40a8cc;if(_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x3e')]){_0x69b3f1[_0xba0a('0x3f')]=[{'all':!![]}];}return db[_0xba0a('0x28')][_0xba0a('0x40')](_0x69b3f1);})[_0xba0a('0x23')](function(_0x1b0468){_0x11eec1[_0xba0a('0x41')]=_0x1b0468;return _0x11eec1;})['then'](respondWithFilteredResult(_0x1ffb33,_0x69b3f1))[_0xba0a('0x42')](handleError(_0x1ffb33,null));};exports['show']=function(_0x120bf9,_0x234c1d){var _0x5a41a7={'raw':!![],'where':{'id':_0x120bf9['params']['id']}},_0x2b8345={};_0x2b8345[_0xba0a('0x2c')]=_[_0xba0a('0x2e')](db[_0xba0a('0x28')][_0xba0a('0x43')]);_0x2b8345[_0xba0a('0x2d')]=_['keys'](_0x120bf9['query']);_0x2b8345['filters']=_[_0xba0a('0x31')](_0x2b8345[_0xba0a('0x2c')],_0x2b8345[_0xba0a('0x2d')]);_0x5a41a7[_0xba0a('0x30')]=_['intersection'](_0x2b8345['model'],qs['fields'](_0x120bf9['query'][_0xba0a('0x32')]));_0x5a41a7[_0xba0a('0x30')]=_0x5a41a7[_0xba0a('0x30')][_0xba0a('0x33')]?_0x5a41a7[_0xba0a('0x30')]:_0x2b8345[_0xba0a('0x2c')];if(_0x120bf9['query'][_0xba0a('0x3e')]){_0x5a41a7[_0xba0a('0x3f')]=[{'all':!![]}];}_0x5a41a7=_['merge']({},_0x5a41a7,_0x120bf9[_0xba0a('0x3d')]);return db[_0xba0a('0x28')][_0xba0a('0x44')](_0x5a41a7)[_0xba0a('0x23')](handleEntityNotFound(_0x234c1d,null))['then'](respondWithResult(_0x234c1d,null))[_0xba0a('0x42')](handleError(_0x234c1d,null));};exports[_0xba0a('0x45')]=function(_0x330ee1,_0x1ab9d9){return db[_0xba0a('0x28')][_0xba0a('0x45')](_0x330ee1['body'],{})[_0xba0a('0x23')](respondWithResult(_0x1ab9d9,0xc9))['catch'](handleError(_0x1ab9d9,null));};exports['update']=function(_0x5797bc,_0x530c6b){if(_0x5797bc[_0xba0a('0x46')]['id']){delete _0x5797bc['body']['id'];}return db[_0xba0a('0x28')][_0xba0a('0x44')]({'where':{'id':_0x5797bc['params']['id']}})[_0xba0a('0x23')](handleEntityNotFound(_0x530c6b,null))[_0xba0a('0x23')](saveUpdates(_0x5797bc[_0xba0a('0x46')],null))['then'](respondWithResult(_0x530c6b,null))[_0xba0a('0x42')](handleError(_0x530c6b,null));};exports[_0xba0a('0x47')]=function(_0x125041,_0x2c283b){return db[_0xba0a('0x28')][_0xba0a('0x44')]({'where':{'id':_0x125041[_0xba0a('0x48')]['id']}})[_0xba0a('0x23')](handleEntityNotFound(_0x2c283b,null))['then'](removeEntity(_0x2c283b,null))['catch'](handleError(_0x2c283b,null));}; \ No newline at end of file +var _0x2124=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','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','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x2124,0xa4));var _0x4212=function(_0x41f27d,_0x3932b5){_0x41f27d=_0x41f27d-0x0;var _0x993fac=_0x2124[_0x41f27d];return _0x993fac;};'use strict';var emlformat=require(_0x4212('0x0'));var rimraf=require(_0x4212('0x1'));var zipdir=require(_0x4212('0x2'));var jsonpatch=require(_0x4212('0x3'));var rp=require(_0x4212('0x4'));var moment=require(_0x4212('0x5'));var BPromise=require(_0x4212('0x6'));var Mustache=require(_0x4212('0x7'));var util=require(_0x4212('0x8'));var path=require(_0x4212('0x9'));var sox=require(_0x4212('0xa'));var csv=require(_0x4212('0xb'));var ejs=require(_0x4212('0xc'));var fs=require('fs');var fs_extra=require(_0x4212('0xd'));var _=require(_0x4212('0xe'));var squel=require('squel');var crypto=require(_0x4212('0xf'));var jsforce=require(_0x4212('0x10'));var deskjs=require(_0x4212('0x11'));var toCsv=require(_0x4212('0xb'));var querystring=require(_0x4212('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4212('0x13'));var as=require(_0x4212('0x14'));var hardwareService=require(_0x4212('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4212('0x16'));var licenseUtil=require(_0x4212('0x17'));var db=require(_0x4212('0x18'))['db'];function respondWithStatusCode(_0x4a250c,_0x3cd59b){_0x3cd59b=_0x3cd59b||0xcc;return function(_0x13b2e8){if(_0x13b2e8){return _0x4a250c[_0x4212('0x19')](_0x3cd59b);}return _0x4a250c[_0x4212('0x1a')](_0x3cd59b)[_0x4212('0x1b')]();};}function respondWithResult(_0x31fabd,_0x22c231){_0x22c231=_0x22c231||0xc8;return function(_0x20695a){if(_0x20695a){return _0x31fabd[_0x4212('0x1a')](_0x22c231)[_0x4212('0x1c')](_0x20695a);}};}function respondWithFilteredResult(_0x4d6cc8,_0x1527d4){return function(_0x39bcdb){if(_0x39bcdb){var _0x6f6e99=typeof _0x1527d4[_0x4212('0x1d')]===_0x4212('0x1e')&&typeof _0x1527d4[_0x4212('0x1f')]===_0x4212('0x1e');var _0x1eb527=_0x39bcdb[_0x4212('0x20')];var _0x9683b5=_0x6f6e99?0x0:_0x1527d4[_0x4212('0x1d')];var _0x2d8080=_0x6f6e99?_0x39bcdb[_0x4212('0x20')]:_0x1527d4[_0x4212('0x1d')]+_0x1527d4[_0x4212('0x1f')];var _0x21ca1a;if(_0x2d8080>=_0x1eb527){_0x2d8080=_0x1eb527;_0x21ca1a=0xc8;}else{_0x21ca1a=0xce;}_0x4d6cc8['status'](_0x21ca1a);return _0x4d6cc8[_0x4212('0x21')]('Content-Range',_0x9683b5+'-'+_0x2d8080+'/'+_0x1eb527)['json'](_0x39bcdb);}return null;};}function patchUpdates(_0x26f14b){return function(_0x4e3140){try{jsonpatch[_0x4212('0x22')](_0x4e3140,_0x26f14b,!![]);}catch(_0x542e5d){return BPromise[_0x4212('0x23')](_0x542e5d);}return _0x4e3140[_0x4212('0x24')]();};}function saveUpdates(_0x5c8b02,_0x144dd8){return function(_0x2d7ca8){if(_0x2d7ca8){return _0x2d7ca8[_0x4212('0x25')](_0x5c8b02)[_0x4212('0x26')](function(_0x33fc52){return _0x33fc52;});}return null;};}function removeEntity(_0x26e106,_0x342d48){return function(_0x23195a){if(_0x23195a){return _0x23195a[_0x4212('0x27')]()[_0x4212('0x26')](function(){_0x26e106[_0x4212('0x1a')](0xcc)[_0x4212('0x1b')]();});}};}function handleEntityNotFound(_0x1ac41a,_0x2c9436){return function(_0x1a9e23){if(!_0x1a9e23){_0x1ac41a[_0x4212('0x19')](0x194);}return _0x1a9e23;};}function handleError(_0xf95fd,_0x11af9a){_0x11af9a=_0x11af9a||0x1f4;return function(_0x2871ac){logger[_0x4212('0x28')](_0x2871ac[_0x4212('0x29')]);if(_0x2871ac[_0x4212('0x2a')]){delete _0x2871ac[_0x4212('0x2a')];}_0xf95fd[_0x4212('0x1a')](_0x11af9a)[_0x4212('0x2b')](_0x2871ac);};}exports[_0x4212('0x2c')]=function(_0x4bb5f8,_0x33b327){var _0x448b56={},_0x40b80c={},_0x493853={'count':0x0,'rows':[]};var _0x1e4989=_['map'](db[_0x4212('0x2d')][_0x4212('0x2e')],function(_0x3ef356){return{'name':_0x3ef356[_0x4212('0x2f')],'type':_0x3ef356[_0x4212('0x30')][_0x4212('0x31')]};});_0x40b80c[_0x4212('0x32')]=_[_0x4212('0x33')](_0x1e4989,'name');_0x40b80c[_0x4212('0x34')]=_[_0x4212('0x35')](_0x4bb5f8[_0x4212('0x34')]);_0x40b80c[_0x4212('0x36')]=_[_0x4212('0x37')](_0x40b80c[_0x4212('0x32')],_0x40b80c[_0x4212('0x34')]);_0x448b56[_0x4212('0x38')]=_[_0x4212('0x37')](_0x40b80c['model'],qs[_0x4212('0x39')](_0x4bb5f8[_0x4212('0x34')]['fields']));_0x448b56[_0x4212('0x38')]=_0x448b56['attributes'][_0x4212('0x3a')]?_0x448b56[_0x4212('0x38')]:_0x40b80c[_0x4212('0x32')];if(!_0x4bb5f8[_0x4212('0x34')][_0x4212('0x3b')]('nolimit')){_0x448b56[_0x4212('0x1f')]=qs[_0x4212('0x1f')](_0x4bb5f8[_0x4212('0x34')][_0x4212('0x1f')]);_0x448b56[_0x4212('0x1d')]=qs[_0x4212('0x1d')](_0x4bb5f8[_0x4212('0x34')][_0x4212('0x1d')]);}_0x448b56[_0x4212('0x3c')]=qs[_0x4212('0x3d')](_0x4bb5f8[_0x4212('0x34')][_0x4212('0x3d')]);_0x448b56[_0x4212('0x3e')]=qs[_0x4212('0x36')](_['pick'](_0x4bb5f8['query'],_0x40b80c[_0x4212('0x36')]),_0x1e4989);if(_0x4bb5f8[_0x4212('0x34')]['filter']){_0x448b56[_0x4212('0x3e')]=_[_0x4212('0x3f')](_0x448b56[_0x4212('0x3e')],{'$or':_[_0x4212('0x33')](_0x1e4989,function(_0x3a1488){if(_0x3a1488[_0x4212('0x30')]!==_0x4212('0x40')){var _0x481994={};_0x481994[_0x3a1488['name']]={'$like':'%'+_0x4bb5f8[_0x4212('0x34')][_0x4212('0x41')]+'%'};return _0x481994;}})});}_0x448b56=_['merge']({},_0x448b56,_0x4bb5f8[_0x4212('0x42')]);var _0x183093={'where':_0x448b56['where']};return db[_0x4212('0x2d')][_0x4212('0x20')](_0x183093)[_0x4212('0x26')](function(_0xfe3c51){_0x493853[_0x4212('0x20')]=_0xfe3c51;if(_0x4bb5f8[_0x4212('0x34')][_0x4212('0x43')]){_0x448b56[_0x4212('0x44')]=[{'all':!![]}];}return db[_0x4212('0x2d')]['findAll'](_0x448b56);})['then'](function(_0x49d7f8){_0x493853['rows']=_0x49d7f8;return _0x493853;})[_0x4212('0x26')](respondWithFilteredResult(_0x33b327,_0x448b56))[_0x4212('0x45')](handleError(_0x33b327,null));};exports[_0x4212('0x46')]=function(_0x392611,_0x3fdb2e){var _0x316ed0={'raw':!![],'where':{'id':_0x392611[_0x4212('0x47')]['id']}},_0x38b19d={};_0x38b19d[_0x4212('0x32')]=_['keys'](db[_0x4212('0x2d')][_0x4212('0x2e')]);_0x38b19d[_0x4212('0x34')]=_[_0x4212('0x35')](_0x392611[_0x4212('0x34')]);_0x38b19d['filters']=_[_0x4212('0x37')](_0x38b19d['model'],_0x38b19d[_0x4212('0x34')]);_0x316ed0[_0x4212('0x38')]=_['intersection'](_0x38b19d[_0x4212('0x32')],qs[_0x4212('0x39')](_0x392611[_0x4212('0x34')]['fields']));_0x316ed0[_0x4212('0x38')]=_0x316ed0[_0x4212('0x38')]['length']?_0x316ed0[_0x4212('0x38')]:_0x38b19d['model'];if(_0x392611[_0x4212('0x34')][_0x4212('0x43')]){_0x316ed0['include']=[{'all':!![]}];}_0x316ed0=_[_0x4212('0x3f')]({},_0x316ed0,_0x392611[_0x4212('0x42')]);return db[_0x4212('0x2d')]['find'](_0x316ed0)[_0x4212('0x26')](handleEntityNotFound(_0x3fdb2e,null))['then'](respondWithResult(_0x3fdb2e,null))['catch'](handleError(_0x3fdb2e,null));};exports[_0x4212('0x48')]=function(_0x138db8,_0x516efc){return db[_0x4212('0x2d')][_0x4212('0x48')](_0x138db8[_0x4212('0x49')],{})[_0x4212('0x26')](respondWithResult(_0x516efc,0xc9))[_0x4212('0x45')](handleError(_0x516efc,null));};exports['update']=function(_0x2b14c8,_0x5c1920){if(_0x2b14c8[_0x4212('0x49')]['id']){delete _0x2b14c8[_0x4212('0x49')]['id'];}return db['OpenchannelApplication'][_0x4212('0x4a')]({'where':{'id':_0x2b14c8[_0x4212('0x47')]['id']}})[_0x4212('0x26')](handleEntityNotFound(_0x5c1920,null))[_0x4212('0x26')](saveUpdates(_0x2b14c8[_0x4212('0x49')],null))[_0x4212('0x26')](respondWithResult(_0x5c1920,null))[_0x4212('0x45')](handleError(_0x5c1920,null));};exports['destroy']=function(_0x3cf689,_0x309797){return db[_0x4212('0x2d')]['find']({'where':{'id':_0x3cf689[_0x4212('0x47')]['id']}})[_0x4212('0x26')](handleEntityNotFound(_0x309797,null))[_0x4212('0x26')](removeEntity(_0x309797,null))[_0x4212('0x45')](handleError(_0x309797,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 22028f7..3e52bbc 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 _0xe300=['utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x155106,_0x531b23){var _0x33490f=function(_0x210b80){while(--_0x210b80){_0x155106['push'](_0x155106['shift']());}};_0x33490f(++_0x531b23);}(_0xe300,0x12a));var _0x0e30=function(_0xeca072,_0x274726){_0xeca072=_0xeca072-0x0;var _0x52d6a3=_0xe300[_0xeca072];return _0x52d6a3;};'use strict';var _=require('lodash');var util=require(_0x0e30('0x0'));var logger=require('../../config/logger')(_0x0e30('0x1'));var moment=require(_0x0e30('0x2'));var BPromise=require(_0x0e30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e30('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x0e30('0x5')]=function(_0x49bd6f,_0x5d1127){return _0x49bd6f[_0x0e30('0x6')](_0x0e30('0x7'),attributes,{'tableName':_0x0e30('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0e30('0x9'),'collate':_0x0e30('0xa')});}; \ No newline at end of file +var _0xfec9=['rimraf','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x348c72,_0x3e32b3){var _0x4fb90d=function(_0x47eeab){while(--_0x47eeab){_0x348c72['push'](_0x348c72['shift']());}};_0x4fb90d(++_0x3e32b3);}(_0xfec9,0x1b3));var _0x9fec=function(_0x4d65c2,_0x2d2156){_0x4d65c2=_0x4d65c2-0x0;var _0x1fbbcd=_0xfec9[_0x4d65c2];return _0x1fbbcd;};'use strict';var _=require(_0x9fec('0x0'));var util=require(_0x9fec('0x1'));var logger=require('../../config/logger')(_0x9fec('0x2'));var moment=require(_0x9fec('0x3'));var BPromise=require(_0x9fec('0x4'));var rp=require(_0x9fec('0x5'));var fs=require('fs');var path=require(_0x9fec('0x6'));var rimraf=require(_0x9fec('0x7'));var config=require('../../config/environment');var attributes=require(_0x9fec('0x8'));module['exports']=function(_0x4a7e36,_0x193526){return _0x4a7e36[_0x9fec('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x9fec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9fec('0xb'),'collate':_0x9fec('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8482842..9d1c6c7 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 _0xaf44=['update','body','options','where','attributes','info','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelApplication'];(function(_0x58dfc7,_0x455e4b){var _0x25fb0b=function(_0x2a3acc){while(--_0x2a3acc){_0x58dfc7['push'](_0x58dfc7['shift']());}};_0x25fb0b(++_0x455e4b);}(_0xaf44,0x83));var _0x4af4=function(_0x11e89b,_0x67d49f){_0x11e89b=_0x11e89b-0x0;var _0x41a5f2=_0xaf44[_0x11e89b];return _0x41a5f2;};'use strict';var _=require(_0x4af4('0x0'));var util=require(_0x4af4('0x1'));var moment=require(_0x4af4('0x2'));var BPromise=require(_0x4af4('0x3'));var rs=require(_0x4af4('0x4'));var fs=require('fs');var Redis=require(_0x4af4('0x5'));var db=require(_0x4af4('0x6'))['db'];var utils=require(_0x4af4('0x7'));var logger=require(_0x4af4('0x8'))('rpc');var config=require(_0x4af4('0x9'));var jayson=require(_0x4af4('0xa'));var client=jayson[_0x4af4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4408dc,_0x3e1693,_0x5375e5){return new BPromise(function(_0x2aa0c3,_0x1de8f4){return client[_0x4af4('0xc')](_0x4408dc,_0x5375e5)[_0x4af4('0xd')](function(_0x155bcb){logger['info'](_0x4af4('0xe'),_0x3e1693,_0x4af4('0xf'));logger[_0x4af4('0x10')](_0x4af4('0x11'),_0x3e1693,_0x4af4('0xf'),JSON[_0x4af4('0x12')](_0x155bcb));if(_0x155bcb[_0x4af4('0x13')]){if(_0x155bcb['error']['code']===0x1f4){logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);return _0x1de8f4(_0x155bcb['error'][_0x4af4('0x14')]);}logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);return _0x2aa0c3(_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3e1693,_0x4af4('0xf'));_0x2aa0c3(_0x155bcb[_0x4af4('0x15')][_0x4af4('0x14')]);}})[_0x4af4('0x16')](function(_0x42d8af){logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x42d8af);_0x1de8f4(_0x42d8af);});});}exports['UpdateOpenchannelApplication']=function(_0x441fe8){var _0x2e73f7=this;return new Promise(function(_0x317b96,_0x2e2005){return db[_0x4af4('0x17')][_0x4af4('0x18')](_0x441fe8[_0x4af4('0x19')],{'raw':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')][_0x4af4('0x1b')]||null:null,'attributes':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')][_0x4af4('0x1c')]||null:null,'limit':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')]['limit']||null:null})[_0x4af4('0xd')](function(_0x84089f){logger[_0x4af4('0x1d')](_0x4af4('0x1e'),_0x441fe8);logger[_0x4af4('0x10')](_0x4af4('0x1e'),_0x441fe8,JSON[_0x4af4('0x12')](_0x84089f));_0x317b96(_0x84089f);})[_0x4af4('0x16')](function(_0x5bc08b){logger[_0x4af4('0x13')](_0x4af4('0x1e'),_0x5bc08b['message'],_0x441fe8);_0x2e2005(_0x2e73f7[_0x4af4('0x13')](0x1f4,_0x5bc08b['message']));});});}; \ No newline at end of file +var _0x659c=['stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x659c,0x15e));var _0xc659=function(_0x65c597,_0x39e7e0){_0x65c597=_0x65c597-0x0;var _0x1ec368=_0x659c[_0x65c597];return _0x1ec368;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var moment=require(_0xc659('0x1'));var BPromise=require('bluebird');var rs=require(_0xc659('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc659('0x3'))['db'];var utils=require(_0xc659('0x4'));var logger=require('../../config/logger')(_0xc659('0x5'));var config=require(_0xc659('0x6'));var jayson=require(_0xc659('0x7'));var client=jayson['client'][_0xc659('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xedb8da,_0x44f592,_0x1ade45){return new BPromise(function(_0x4c5bba,_0x1d8147){return client[_0xc659('0x9')](_0xedb8da,_0x1ade45)['then'](function(_0x2d93ab){logger[_0xc659('0xa')]('OpenchannelApplication,\x20%s,\x20%s',_0x44f592,'request\x20sent');logger[_0xc659('0xb')](_0xc659('0xc'),_0x44f592,_0xc659('0xd'),JSON[_0xc659('0xe')](_0x2d93ab));if(_0x2d93ab[_0xc659('0xf')]){if(_0x2d93ab[_0xc659('0xf')]['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x44f592,_0x2d93ab[_0xc659('0xf')]['message']);return _0x1d8147(_0x2d93ab[_0xc659('0xf')]['message']);}logger['error'](_0xc659('0x10'),_0x44f592,_0x2d93ab[_0xc659('0xf')][_0xc659('0x11')]);return _0x4c5bba(_0x2d93ab[_0xc659('0xf')][_0xc659('0x11')]);}else{logger[_0xc659('0xa')](_0xc659('0x10'),_0x44f592,_0xc659('0xd'));_0x4c5bba(_0x2d93ab[_0xc659('0x12')][_0xc659('0x11')]);}})['catch'](function(_0x30e681){logger[_0xc659('0xf')](_0xc659('0x10'),_0x44f592,_0x30e681);_0x1d8147(_0x30e681);});});}exports[_0xc659('0x13')]=function(_0xa219eb){var _0x9e603d=this;return new Promise(function(_0x3a4147,_0x1cc2e2){return db[_0xc659('0x14')]['update'](_0xa219eb[_0xc659('0x15')],{'raw':_0xa219eb[_0xc659('0x16')]?_0xa219eb[_0xc659('0x16')][_0xc659('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa219eb[_0xc659('0x16')]?_0xa219eb[_0xc659('0x16')][_0xc659('0x18')]||null:null,'attributes':_0xa219eb['options']?_0xa219eb['options']['attributes']||null:null,'limit':_0xa219eb[_0xc659('0x16')]?_0xa219eb[_0xc659('0x16')]['limit']||null:null})['then'](function(_0x22c0d4){logger[_0xc659('0xa')]('UpdateOpenchannelApplication',_0xa219eb);logger[_0xc659('0xb')]('UpdateOpenchannelApplication',_0xa219eb,JSON['stringify'](_0x22c0d4));_0x3a4147(_0x22c0d4);})[_0xc659('0x19')](function(_0x1d46ba){logger['error'](_0xc659('0x13'),_0x1d46ba['message'],_0xa219eb);_0x1cc2e2(_0x9e603d[_0xc659('0xf')](0x1f4,_0x1d46ba[_0xc659('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5b18cc7..034165b 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 _0x0014=['/:id/messages','/:id/download','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannel','delete','openchannelinteraction:destroy','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','show'];(function(_0x1064fb,_0x32b8a1){var _0x54224d=function(_0x3e2af7){while(--_0x3e2af7){_0x1064fb['push'](_0x1064fb['shift']());}};_0x54224d(++_0x32b8a1);}(_0x0014,0x138));var _0x4001=function(_0x38f0de,_0x2c0826){_0x38f0de=_0x38f0de-0x0;var _0x2a1634=_0x0014[_0x38f0de];return _0x2a1634;};'use strict';var multer=require(_0x4001('0x0'));var util=require('util');var path=require(_0x4001('0x1'));var timeout=require(_0x4001('0x2'));var express=require('express');var router=express[_0x4001('0x3')]();var fs_extra=require(_0x4001('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4001('0x5'));var config=require(_0x4001('0x6'));var controller=require(_0x4001('0x7'));router[_0x4001('0x8')]('/',auth[_0x4001('0x9')](),controller['index']);router[_0x4001('0x8')](_0x4001('0xa'),auth[_0x4001('0x9')](),controller['describe']);router[_0x4001('0x8')]('/:id',auth[_0x4001('0x9')](),controller[_0x4001('0xb')]);router[_0x4001('0x8')](_0x4001('0xc'),auth[_0x4001('0x9')](),controller['getMessages']);router[_0x4001('0x8')](_0x4001('0xd'),auth[_0x4001('0x9')](),controller['download']);router[_0x4001('0xe')]('/',auth[_0x4001('0x9')](),controller['create']);router['post'](_0x4001('0xc'),auth[_0x4001('0x9')](),controller[_0x4001('0xf')]);router['post'](_0x4001('0x10'),auth[_0x4001('0x9')](),interaction['tracked']('openchannel',_0x4001('0x11')),controller[_0x4001('0x12')]);router[_0x4001('0x13')](_0x4001('0x14'),auth[_0x4001('0x9')](),interaction[_0x4001('0x15')](_0x4001('0x16'),'openchannelinteraction:update'),controller['update']);router[_0x4001('0x17')]('/:id',auth[_0x4001('0x9')](),interaction['tracked'](_0x4001('0x16'),_0x4001('0x18')),controller[_0x4001('0x19')]);router[_0x4001('0x17')]('/:id/tags',auth[_0x4001('0x9')](),controller['removeTags']);module[_0x4001('0x1a')]=router; \ No newline at end of file +var _0x99ac=['tracked','openchannel','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags'];(function(_0x574b7f,_0x5a758e){var _0x3da1af=function(_0x4b382e){while(--_0x4b382e){_0x574b7f['push'](_0x574b7f['shift']());}};_0x3da1af(++_0x5a758e);}(_0x99ac,0x1c5));var _0xc99a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x99ac[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0xc99a('0x0'));var util=require(_0xc99a('0x1'));var path=require('path');var timeout=require(_0xc99a('0x2'));var express=require(_0xc99a('0x3'));var router=express[_0xc99a('0x4')]();var fs_extra=require(_0xc99a('0x5'));var auth=require(_0xc99a('0x6'));var interaction=require(_0xc99a('0x7'));var config=require(_0xc99a('0x8'));var controller=require(_0xc99a('0x9'));router[_0xc99a('0xa')]('/',auth[_0xc99a('0xb')](),controller[_0xc99a('0xc')]);router['get'](_0xc99a('0xd'),auth['isAuthenticated'](),controller[_0xc99a('0xe')]);router[_0xc99a('0xa')](_0xc99a('0xf'),auth[_0xc99a('0xb')](),controller[_0xc99a('0x10')]);router[_0xc99a('0xa')](_0xc99a('0x11'),auth[_0xc99a('0xb')](),controller[_0xc99a('0x12')]);router['get']('/:id/download',auth[_0xc99a('0xb')](),controller['download']);router[_0xc99a('0x13')]('/',auth['isAuthenticated'](),controller[_0xc99a('0x14')]);router[_0xc99a('0x13')](_0xc99a('0x11'),auth[_0xc99a('0xb')](),controller[_0xc99a('0x15')]);router['post'](_0xc99a('0x16'),auth[_0xc99a('0xb')](),interaction[_0xc99a('0x17')](_0xc99a('0x18'),'openchannelinteraction:addtags'),controller[_0xc99a('0x19')]);router[_0xc99a('0x1a')](_0xc99a('0xf'),auth[_0xc99a('0xb')](),interaction[_0xc99a('0x17')](_0xc99a('0x18'),_0xc99a('0x1b')),controller[_0xc99a('0x1c')]);router['delete'](_0xc99a('0xf'),auth[_0xc99a('0xb')](),interaction['tracked'](_0xc99a('0x18'),_0xc99a('0x1d')),controller[_0xc99a('0x1e')]);router[_0xc99a('0x1f')](_0xc99a('0x16'),auth[_0xc99a('0xb')](),controller[_0xc99a('0x20')]);module[_0xc99a('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 167f50b..92380f0 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 _0x653d=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x653d,0x133));var _0xd653=function(_0x40135f,_0x36ca6f){_0x40135f=_0x40135f-0x0;var _0x3c9f38=_0x653d[_0x40135f];return _0x3c9f38;};'use strict';var Sequelize=require('sequelize');module[_0xd653('0x0')]={'closed':{'type':Sequelize[_0xd653('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd653('0x2')]},'disposition':{'type':Sequelize[_0xd653('0x3')]},'secondDisposition':{'type':Sequelize[_0xd653('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd653('0x3')]},'note':{'type':Sequelize[_0xd653('0x3')]},'read1stAt':{'type':Sequelize[_0xd653('0x2')]},'threadId':{'type':Sequelize[_0xd653('0x3')]},'externalUrl':{'type':Sequelize[_0xd653('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd653('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd653('0x4')]('in',_0xd653('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd653('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x07b9=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x2edb80,_0x5658fb){var _0x11446a=function(_0x4d05c9){while(--_0x4d05c9){_0x2edb80['push'](_0x2edb80['shift']());}};_0x11446a(++_0x5658fb);}(_0x07b9,0x143));var _0x907b=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x07b9[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x907b('0x0'));module[_0x907b('0x1')]={'closed':{'type':Sequelize[_0x907b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x907b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x907b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x907b('0x4')]},'read1stAt':{'type':Sequelize[_0x907b('0x3')]},'threadId':{'type':Sequelize[_0x907b('0x4')]},'externalUrl':{'type':Sequelize[_0x907b('0x4')]},'lastMsgAt':{'type':Sequelize[_0x907b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x907b('0x5')]('in',_0x907b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x907b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ccbbefa..aa33863 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 _0x1f78=['Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','download','unix','tmp','root','server','files','attachments','format','transcript-%d-%s.zip','join','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','closedAt','Public','basename','createReadStream','createWriteStream','System','out','renderFile','transcript-','.pdf','Openchannel','createPdfFromHTML','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','OpenchannelInteraction','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','agent','sequelize','toString','keyBy','merge','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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x54ec06,_0x24e1d4){var _0x18d205=function(_0x2dd940){while(--_0x2dd940){_0x54ec06['push'](_0x54ec06['shift']());}};_0x18d205(++_0x24e1d4);}(_0x1f78,0x134));var _0x81f7=function(_0x564f23,_0x22c50e){_0x564f23=_0x564f23-0x0;var _0x16af30=_0x1f78[_0x564f23];return _0x16af30;};'use strict';var emlformat=require(_0x81f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x81f7('0x1'));var rp=require(_0x81f7('0x2'));var moment=require(_0x81f7('0x3'));var BPromise=require(_0x81f7('0x4'));var Mustache=require(_0x81f7('0x5'));var util=require(_0x81f7('0x6'));var path=require(_0x81f7('0x7'));var sox=require(_0x81f7('0x8'));var csv=require(_0x81f7('0x9'));var ejs=require(_0x81f7('0xa'));var fs=require('fs');var fs_extra=require(_0x81f7('0xb'));var _=require(_0x81f7('0xc'));var squel=require(_0x81f7('0xd'));var crypto=require(_0x81f7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x81f7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81f7('0x10'));var Redis=require(_0x81f7('0x11'));var authService=require(_0x81f7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81f7('0x13'));var pdf=require(_0x81f7('0x14'));var hardwareService=require(_0x81f7('0x15'));var logger=require(_0x81f7('0x16'))(_0x81f7('0x17'));var utils=require(_0x81f7('0x18'));var config=require(_0x81f7('0x19'));var licenseUtil=require(_0x81f7('0x1a'));var db=require(_0x81f7('0x1b'))['db'];config[_0x81f7('0x1c')]=_[_0x81f7('0x1d')](config[_0x81f7('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x81f7('0x1e'))(new Redis(config[_0x81f7('0x1c')]));require('./openchannelInteraction.socket')[_0x81f7('0x1f')](socket);function respondWithStatusCode(_0x2ddf6e,_0x6e146d){_0x6e146d=_0x6e146d||0xcc;return function(_0x313524){if(_0x313524){return _0x2ddf6e[_0x81f7('0x20')](_0x6e146d);}return _0x2ddf6e[_0x81f7('0x21')](_0x6e146d)['end']();};}function respondWithResult(_0x26f68e,_0x14a994){_0x14a994=_0x14a994||0xc8;return function(_0x190d79){if(_0x190d79){return _0x26f68e[_0x81f7('0x21')](_0x14a994)[_0x81f7('0x22')](_0x190d79);}};}function respondWithFilteredResult(_0x61c131,_0x5972d1){return function(_0xc54c9b){if(_0xc54c9b){var _0xeb8374=typeof _0x5972d1[_0x81f7('0x23')]===_0x81f7('0x24')&&typeof _0x5972d1[_0x81f7('0x25')]===_0x81f7('0x24');var _0x308729=_0xc54c9b[_0x81f7('0x26')];var _0x40f33b=_0xeb8374?0x0:_0x5972d1[_0x81f7('0x23')];var _0x2efb38=_0xeb8374?_0xc54c9b[_0x81f7('0x26')]:_0x5972d1[_0x81f7('0x23')]+_0x5972d1['limit'];var _0x1e2307;if(_0x2efb38>=_0x308729){_0x2efb38=_0x308729;_0x1e2307=0xc8;}else{_0x1e2307=0xce;}_0x61c131[_0x81f7('0x21')](_0x1e2307);return _0x61c131[_0x81f7('0x27')](_0x81f7('0x28'),_0x40f33b+'-'+_0x2efb38+'/'+_0x308729)[_0x81f7('0x22')](_0xc54c9b);}return null;};}function patchUpdates(_0xa6d4de){return function(_0x4e5c5c){try{jsonpatch[_0x81f7('0x29')](_0x4e5c5c,_0xa6d4de,!![]);}catch(_0x492328){return BPromise[_0x81f7('0x2a')](_0x492328);}return _0x4e5c5c[_0x81f7('0x2b')]();};}function saveUpdates(_0x42255c,_0x20793c){return function(_0x5d91f2){if(_0x5d91f2){return _0x5d91f2[_0x81f7('0x2c')](_0x42255c)[_0x81f7('0x2d')](function(_0x1ecd80){return _0x1ecd80;});}return null;};}function removeEntity(_0x33d896,_0x3e58b7){return function(_0x42aa10){if(_0x42aa10){return _0x42aa10[_0x81f7('0x2e')]()[_0x81f7('0x2d')](function(){_0x33d896['status'](0xcc)[_0x81f7('0x2f')]();});}};}function handleEntityNotFound(_0xecd94e,_0x5afda7){return function(_0x3075cf){if(!_0x3075cf){_0xecd94e[_0x81f7('0x20')](0x194);}return _0x3075cf;};}function handleError(_0x43a7f1,_0x280f16){_0x280f16=_0x280f16||0x1f4;return function(_0xcd00b6){logger[_0x81f7('0x30')](_0xcd00b6['stack']);if(_0xcd00b6[_0x81f7('0x31')]){delete _0xcd00b6[_0x81f7('0x31')];}_0x43a7f1['status'](_0x280f16)[_0x81f7('0x32')](_0xcd00b6);};}function getInteractionUsers(_0x51ac70,_0x4fa7ed){return new BPromise(function(_0x5acc3b,_0x30d363){try{if(_0x4fa7ed[_0x51ac70['id']]){_0x51ac70[_0x81f7('0x33')]=_[_0x81f7('0x34')](_0x4fa7ed[_0x51ac70['id']],function(_0x2a9333){return{'id':_0x2a9333['id'],'fullname':_0x2a9333[_0x81f7('0x35')]};});}}catch(_0x5ea8d1){_0x30d363(_0x5ea8d1);}_0x5acc3b(_0x51ac70);});}function getInteractionTags(_0x430818,_0x4156b0){return new BPromise(function(_0x1e55a9,_0x1786d0){try{if(_0x430818[_0x81f7('0x36')]){_0x430818[_0x81f7('0x37')]=[];_0x430818['TagIds'][_0x81f7('0x38')](',')[_0x81f7('0x39')](function(_0x1b1fe9){_0x430818[_0x81f7('0x37')][_0x81f7('0x3a')](_0x4156b0[_0x1b1fe9]);});}delete _0x430818['TagIds'];}catch(_0x1c3ea5){_0x1786d0(_0x1c3ea5);}_0x1e55a9(_0x430818);});}function updateOpenchannelInteraction(_0xbec302,_0x1cd51a,_0x511bc3){return new BPromise(function(_0x336b88,_0x3ea814){return getInteractionUsers(_0xbec302,_0x511bc3)[_0x81f7('0x2d')](function(_0x6b23e7){return getInteractionTags(_0x6b23e7,_0x1cd51a);})['then'](function(_0x5c7ed7){return getStateInteraction(_0x5c7ed7);})[_0x81f7('0x2d')](function(_0x5ca763){_0x336b88(_0x5ca763);})[_0x81f7('0x3b')](function(_0x143cdd){_0x3ea814(_0x143cdd);});});}function getStateInteraction(_0x1c9337){return new BPromise(function(_0x73eb67){_0x1c9337[_0x81f7('0x3c')]=0x0;_0x1c9337[_0x81f7('0x3d')]=0x0;_0x1c9337[_0x81f7('0x3e')]=0x0;_0x1c9337[_0x81f7('0x3f')]=0x0;_0x1c9337['total']=0x0;if(!_0x1c9337[_0x81f7('0x40')]&&!_0x1c9337[_0x81f7('0x41')]){_0x1c9337['waiting']+=0x1;}if(!_0x1c9337['closed']&&_0x1c9337['UserId']){_0x1c9337[_0x81f7('0x3d')]+=0x1;if(_0x1c9337['waiting']){_0x1c9337[_0x81f7('0x3c')]-=0x1;}}if(_0x1c9337[_0x81f7('0x40')]&&_0x1c9337['UserId']){_0x1c9337[_0x81f7('0x3e')]+=0x1;if(_0x1c9337[_0x81f7('0x3d')]){_0x1c9337[_0x81f7('0x3d')]-=0x1;}}if(_0x1c9337[_0x81f7('0x40')]&&!_0x1c9337[_0x81f7('0x41')]){_0x1c9337[_0x81f7('0x3f')]+=0x1;if(_0x1c9337[_0x81f7('0x3c')]){_0x1c9337[_0x81f7('0x3c')]-=0x1;}}_0x1c9337[_0x81f7('0x42')]+=0x1;_0x73eb67(_0x1c9337);});}exports[_0x81f7('0x43')]=function(_0x4393e3,_0x4eb919){var _0x55bd35={},_0x85b20c={},_0x188125={'count':0x0,'rows':[]};var _0x307783=_[_0x81f7('0x34')](db[_0x81f7('0x44')][_0x81f7('0x45')],function(_0x152f20){return{'name':_0x152f20['fieldName'],'type':_0x152f20['type']['key']};});_0x85b20c[_0x81f7('0x46')]=_[_0x81f7('0x34')](_0x307783,_0x81f7('0x31'));_0x85b20c[_0x81f7('0x47')]=_[_0x81f7('0x48')](_0x4393e3[_0x81f7('0x47')]);_0x85b20c[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0x85b20c[_0x81f7('0x46')],_0x85b20c[_0x81f7('0x47')]);_0x55bd35[_0x81f7('0x4b')]=_[_0x81f7('0x4a')](_0x85b20c[_0x81f7('0x46')],qs['fields'](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4c')]));_0x55bd35[_0x81f7('0x4b')]=_0x55bd35[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x55bd35[_0x81f7('0x4b')]:_0x85b20c['model'];if(!_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4e')](_0x81f7('0x4f'))){_0x55bd35[_0x81f7('0x25')]=qs[_0x81f7('0x25')](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x25')]);_0x55bd35['offset']=qs[_0x81f7('0x23')](_0x4393e3['query'][_0x81f7('0x23')]);}_0x55bd35['order']=qs[_0x81f7('0x50')](_0x4393e3['query'][_0x81f7('0x50')]);_0x55bd35[_0x81f7('0x51')]=qs[_0x81f7('0x49')](_[_0x81f7('0x52')](_0x4393e3[_0x81f7('0x47')],_0x85b20c[_0x81f7('0x49')]),_0x307783);var _0xe9c08a=[];var _0x4b9cef=squel[_0x81f7('0x53')]()[_0x81f7('0x54')]('id')[_0x81f7('0x54')](_0x81f7('0x31'))[_0x81f7('0x54')]('color')['from'](_0x81f7('0x55'));var _0x298c58=squel[_0x81f7('0x53')]()['field'](_0x81f7('0x56'))[_0x81f7('0x54')](_0x81f7('0x57'))[_0x81f7('0x54')](_0x81f7('0x58'))[_0x81f7('0x59')](_0x81f7('0x5a'),'ui')['left_join'](_0x81f7('0x5b'),'u',_0x81f7('0x5c'));var _0x5ce05b=squel['select']()[_0x81f7('0x59')](_0x81f7('0x5d'),'i')[_0x81f7('0x5e')](_0x81f7('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x81f7('0x5e')](_0x81f7('0x5b'),'o',_0x81f7('0x60'))[_0x81f7('0x5e')]('openchannel_accounts','a',_0x81f7('0x61'))[_0x81f7('0x5e')](_0x81f7('0x62'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x81f7('0x5e')](_0x81f7('0x63'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x81f7('0x5e')](_0x81f7('0x55'),'t',_0x81f7('0x64'));var _0xaa0764=squel[_0x81f7('0x65')]();var _0x275089=[];var _0xafbaab=squel[_0x81f7('0x65')]();var _0x380e24;if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x66')]){_0x380e24=as[_0x81f7('0x67')](_0x4393e3['query'][_0x81f7('0x66')]);var _0x46765b=_0x380e24[_0x81f7('0x68')];for(var _0x286b62=0x0;_0x286b62<_0x380e24['conditions'][_0x81f7('0x4d')];_0x286b62++){var _0x2e1ebd=_0x380e24[_0x81f7('0x69')][_0x286b62];var _0x5deb94='i';var _0xdc81a6=_[_0x81f7('0x6a')](_0x307783,[_0x81f7('0x31'),_0x2e1ebd['field']]);if(!_0xdc81a6){switch(_0x2e1ebd['field']){case _0x81f7('0x6b'):if(_0x2e1ebd[_0x81f7('0x6c')]==0x1){_0x5ce05b['having']('`'+_0x2e1ebd['field']+_0x81f7('0x6d'));}else{_0x5ce05b[_0x81f7('0x6e')]('`'+_0x2e1ebd[_0x81f7('0x54')]+'`\x20>\x200');}break;case _0x81f7('0x6f'):if(_0x2e1ebd[_0x81f7('0x70')]===_0x81f7('0x71')){if(_0x2e1ebd['value'][_0x81f7('0x38')]('\x20')['length']>0x1){_0xaa0764[_0x46765b](_0x81f7('0x72'),qs['getFullTextValue'](_0x2e1ebd['value']),null);}else{var _0x15d3d2='%'+_0x2e1ebd['value']+'%';_0xaa0764[_0x46765b](_0x81f7('0x73'),_0x15d3d2,_0x15d3d2,_0x15d3d2);}}else{_0xdc81a6=_['find'](_0x307783,[_0x81f7('0x31'),_0x81f7('0x74')]);_0x2e1ebd[_0x81f7('0x54')]=_0x81f7('0x74');_0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6[_0x81f7('0x76')],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x78')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x2f')]);}break;case _0x81f7('0x79'):var _0x261d03=_0x2e1ebd[_0x81f7('0x6c')][_0x81f7('0x38')](',')[_0x81f7('0x34')](function(_0x376d0a){return Number(_0x376d0a);});_0x261d03['forEach'](function(_0x1ed0b5){_0xafbaab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ed0b5+',%');});_0x275089=_[_0x81f7('0x7a')](_0x275089,_0x261d03);break;case'User':if(_0x2e1ebd[_0x81f7('0x70')]==='$substring'){_0xaa0764[_0x46765b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2e1ebd[_0x81f7('0x6c')]+'%',null);}else{_0xdc81a6=_[_0x81f7('0x6a')](_0x307783,[_0x81f7('0x31'),_0x81f7('0x41')]);_0x2e1ebd[_0x81f7('0x54')]='UserId';_0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6['type'],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')]['start'],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x2f')]);}break;case'body':_0x4c985e=as[_0x81f7('0x75')]('me',null,_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e['text'],_0x4c985e[_0x81f7('0x6c')]['start'],_0x4c985e['value'][_0x81f7('0x2f')]);break;}}else{var _0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6['type'],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x78')],_0x4c985e['value'][_0x81f7('0x2f')]);}}}else{var _0x4a0fc0=_(_0x4393e3[_0x81f7('0x47')])[_0x81f7('0x48')]()[_0x81f7('0x34')](function(_0x47ea2e){return _[_0x81f7('0x7b')](_0x307783,[_0x81f7('0x31'),_0x47ea2e])?_0x47ea2e:undefined;})[_0x81f7('0x7c')]()[_0x81f7('0x6c')]();if(!_[_0x81f7('0x7d')](_0x4a0fc0)){_0x4a0fc0[_0x81f7('0x39')](function(_0x400a07){if(_0x400a07===_0x81f7('0x7e')){_0x5ce05b['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x81f7('0x7f')](_0x4393e3[_0x81f7('0x47')][_0x400a07]));}else if(_0x400a07===_0x81f7('0x80')){var _0x153d3c=JSON[_0x81f7('0x81')](_0x4393e3[_0x81f7('0x47')][_0x400a07])[_0x81f7('0x82')];var _0x54cbac=JSON[_0x81f7('0x81')](_0x4393e3['query'][_0x400a07])[_0x81f7('0x83')];_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x84'),_0x153d3c,_0x54cbac);}else{if(_0x4393e3['query'][_0x400a07]==='null'){_0x5ce05b['where']('i.'+_0x400a07+'\x20IS\x20NULL');}else{_0x5ce05b[_0x81f7('0x51')]('i.'+_0x400a07+_0x81f7('0x85'),_0x4393e3[_0x81f7('0x47')][_0x400a07]);}}});}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x86')]){if(_0x4393e3['query']['read']==0x1){_0x5ce05b[_0x81f7('0x6e')](_0x81f7('0x87'));}else{_0x5ce05b[_0x81f7('0x6e')](_0x81f7('0x88'));}}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x89')]){_0x275089=_[_0x81f7('0x8a')](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x89')])?_0x4393e3['query'][_0x81f7('0x89')]:new Array(_0x4393e3[_0x81f7('0x47')]['tag']);_0x275089['forEach'](function(_0x4eeed0){_0xafbaab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4eeed0+',%');});}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x8b')]){var _0x457866=_0x4393e3[_0x81f7('0x47')][_0x81f7('0x8b')][_0x81f7('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x457866)){_0xaa0764['or'](_0x81f7('0x8d'),_0x457866+'%');}else{_0xaa0764['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81f7('0x8e')](_0x457866))['or'](_0x81f7('0x8f'),_0x457866+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x457866+'%');}}}_0x5ce05b['where'](_0xaa0764);_0x5ce05b[_0x81f7('0x90')](_0x81f7('0x91'));var _0x229e05={'type':db[_0x81f7('0x92')]['QueryTypes']['SELECT'],'raw':!![]};var _0x518757=_0x5ce05b[_0x81f7('0x93')]();_0x518757['field']('i.id');_0x518757['field'](_0x81f7('0x94'),_0x81f7('0x6b'));if(_0x55bd35[_0x81f7('0x95')]){_0x55bd35[_0x81f7('0x95')][_0x81f7('0x39')](function(_0x196228){var _0xba7489=_0x196228[0x0]===_0x81f7('0x96')?_0x196228[0x0]:'i.'+_0x196228[0x0];_0x5ce05b[_0x81f7('0x95')](_0xba7489,_0x196228[0x1]===_0x81f7('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x275089)){_0x5ce05b['having'](_0xafbaab);_0x518757['where'](_0x81f7('0x98'),_0x275089);}BPromise[_0x81f7('0x99')]()['then'](function(){if(!_0x380e24){if(_0x4393e3['query'][_0x81f7('0x7e')])return;_0x518757['where'](_0x81f7('0x9a'));_0x5ce05b[_0x81f7('0x51')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4393e3[_0x81f7('0x9b')]['role']!=='agent')return;return _0x4393e3['user'][_0x81f7('0x9c')]({'attributes':['id'],'raw':!![]})[_0x81f7('0x2d')](function(_0x5ef2c7){if(_[_0x81f7('0x7d')](_0x5ef2c7)){_0x518757['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x9d'));}else{_0x518757[_0x81f7('0x51')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5ef2c7,'id'));_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x9e'),_['map'](_0x5ef2c7,'id'));}});})[_0x81f7('0x2d')](function(){if(_0x4393e3[_0x81f7('0x9b')][_0x81f7('0x9f')]===_0x81f7('0xa0')&&!_0x380e24&&!_0x4393e3['query']['OpenchannelAccountId'])return[];return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x518757[_0x81f7('0xa2')](),_0x229e05);})[_0x81f7('0x2d')](function(_0x1d4821){_0x188125[_0x81f7('0x26')]=_0x1d4821[_0x81f7('0x4d')];if(_0x188125[_0x81f7('0x26')]===0x0)return[];return db[_0x81f7('0xa1')]['query'](_0x4b9cef[_0x81f7('0xa2')](),_0x229e05)[_0x81f7('0x2d')](function(_0x2dabe2){_0xe9c08a=_[_0x81f7('0xa3')](_0x2dabe2,'id');_0x229e05=_[_0x81f7('0xa4')](_0x229e05,{'model':db[_0x81f7('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4c')]){_0x55bd35[_0x81f7('0x4b')]['forEach'](function(_0x3e911b){_0x5ce05b[_0x81f7('0x54')]('i.'+_0x3e911b);});}else{_0x5ce05b[_0x81f7('0x54')](_0x81f7('0x94'),_0x81f7('0x6b'));_0x5ce05b[_0x81f7('0x54')]('a.key',_0x81f7('0xa5'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xa6'),_0x81f7('0xa7'));_0x5ce05b['field'](_0x81f7('0xa8'),_0x81f7('0x96'));_0x5ce05b[_0x81f7('0x54')]('i.*');_0x5ce05b['field'](_0x81f7('0xa9'),'Contact.firstName');_0x5ce05b['field'](_0x81f7('0xaa'),_0x81f7('0xab'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xac'),_0x81f7('0xad'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xae'),_0x81f7('0xaf'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb0'),_0x81f7('0xb1'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb2'),_0x81f7('0xb3'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb4'),_0x81f7('0xb5'));_0x5ce05b[_0x81f7('0x54')]('o.internal',_0x81f7('0xb6'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb7'),_0x81f7('0x36'));}if(_0x55bd35[_0x81f7('0x25')])_0x5ce05b[_0x81f7('0x25')](_0x55bd35[_0x81f7('0x25')]);if(_0x55bd35[_0x81f7('0x23')])_0x5ce05b['offset'](_0x55bd35['offset']);return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x5ce05b[_0x81f7('0xa2')](),_0x229e05);})[_0x81f7('0x2d')](function(_0x44338e){if(_0x44338e[_0x81f7('0x4d')]>0x0)_0x298c58['where'](_0x81f7('0xb8'),_[_0x81f7('0x34')](_0x44338e,'id'));return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x298c58[_0x81f7('0xa2')](),_0x229e05)['then'](function(_0x160259){var _0x501a6c=_[_0x81f7('0xb9')](_0x160259,_0x81f7('0xba'));var _0x49238c=[];_0x44338e[_0x81f7('0x39')](function(_0x44f8d4){_0x49238c[_0x81f7('0x3a')](updateOpenchannelInteraction(_0x44f8d4,_0xe9c08a,_0x501a6c));});return BPromise[_0x81f7('0xbb')](_0x49238c);});});})['then'](function(_0xa35b90){_0x188125['rows']=_0xa35b90;return _0x188125;})['then'](respondWithFilteredResult(_0x4eb919,_0x55bd35))[_0x81f7('0x3b')](handleError(_0x4eb919,null));};exports['show']=function(_0x4a4649,_0x38ecf7){var _0x24c8bf={};if(_0x4a4649['query'][_0x81f7('0x76')]&&_0x4a4649[_0x81f7('0x47')][_0x81f7('0x76')]===_0x81f7('0x59')){_0x24c8bf[_0x81f7('0x59')]=_0x4a4649[_0x81f7('0xbc')]['id'];}else{_0x24c8bf['id']=_0x4a4649[_0x81f7('0xbc')]['id'];}var _0x43f786={'raw':![],'where':_0x24c8bf},_0xd64420={};_0xd64420['model']=_[_0x81f7('0x48')](db[_0x81f7('0x44')]['rawAttributes']);_0xd64420[_0x81f7('0x47')]=_[_0x81f7('0x48')](_0x4a4649[_0x81f7('0x47')]);_0xd64420[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0xd64420[_0x81f7('0x46')],_0xd64420[_0x81f7('0x47')]);_0x43f786['attributes']=_[_0x81f7('0x4a')](_0xd64420['model'],qs[_0x81f7('0x4c')](_0x4a4649[_0x81f7('0x47')][_0x81f7('0x4c')]));_0x43f786[_0x81f7('0x4b')]=_0x43f786[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x43f786['attributes']:_0xd64420[_0x81f7('0x46')];if(_0x4a4649['query'][_0x81f7('0xbd')]){_0x43f786[_0x81f7('0xbe')]=[{'all':!![]}];}_0x43f786=_['merge']({},_0x43f786,_0x4a4649[_0x81f7('0xbf')]);return db['OpenchannelInteraction']['find'](_0x43f786)[_0x81f7('0x2d')](handleEntityNotFound(_0x38ecf7,null))[_0x81f7('0x2d')](respondWithResult(_0x38ecf7,null))[_0x81f7('0x3b')](handleError(_0x38ecf7,null));};exports[_0x81f7('0xc0')]=function(_0x30345e,_0x37dc9c){return db['OpenchannelInteraction']['create'](_0x30345e[_0x81f7('0xc1')],{})[_0x81f7('0x2d')](respondWithResult(_0x37dc9c,0xc9))[_0x81f7('0x3b')](handleError(_0x37dc9c,null));};exports[_0x81f7('0x2c')]=function(_0x113213,_0x57d9ca){if(_0x113213[_0x81f7('0xc1')]['id']){delete _0x113213['body']['id'];}return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x113213[_0x81f7('0xbc')]['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x57d9ca,null))['then'](saveUpdates(_0x113213[_0x81f7('0xc1')],null))[_0x81f7('0x2d')](respondWithResult(_0x57d9ca,null))[_0x81f7('0x3b')](handleError(_0x57d9ca,null));};exports[_0x81f7('0x2e')]=function(_0x10bf52,_0x2e0238){return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x10bf52['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x2e0238,null))[_0x81f7('0x2d')](removeEntity(_0x2e0238,null))['catch'](handleError(_0x2e0238,null));};exports[_0x81f7('0xc2')]=function(_0x2660e6,_0x966b6b){return db[_0x81f7('0x44')][_0x81f7('0xc2')]()[_0x81f7('0x2d')](respondWithResult(_0x966b6b,null))[_0x81f7('0x3b')](handleError(_0x966b6b,null));};exports[_0x81f7('0xc3')]=function(_0x349394,_0x522534,_0x213f40){return db[_0x81f7('0xc4')][_0x81f7('0x6a')]({'where':{'id':_0x349394['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x522534,null))[_0x81f7('0x2d')](function(_0xbb3ced){if(_0xbb3ced){return _0xbb3ced[_0x81f7('0xc3')](_0x349394['body'][_0x81f7('0xc5')],_['omit'](_0x349394[_0x81f7('0xc1')],['ids','id'])||{});}})[_0x81f7('0x2d')](respondWithResult(_0x522534,null))[_0x81f7('0x3b')](handleError(_0x522534,null));};exports[_0x81f7('0xc6')]=function(_0x554fc3,_0x18795b,_0x1782d9){var _0x24b0d3={'raw':![],'where':{}};var _0x3b8ae2={};var _0x48b39d={'count':0x0,'rows':[]};return db[_0x81f7('0x44')]['findOne']({'where':{'id':_0x554fc3['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x18795b,null))[_0x81f7('0x2d')](function(_0x26c102){if(_0x26c102){_0x3b8ae2[_0x81f7('0x46')]=_[_0x81f7('0x48')](db['OpenchannelMessage']['rawAttributes']);_0x3b8ae2[_0x81f7('0x47')]=_['keys'](_0x554fc3[_0x81f7('0x47')]);_0x3b8ae2[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0x3b8ae2[_0x81f7('0x46')],_0x3b8ae2[_0x81f7('0x47')]);_0x24b0d3[_0x81f7('0x4b')]=_[_0x81f7('0x4a')](_0x3b8ae2[_0x81f7('0x46')],qs[_0x81f7('0x4c')](_0x554fc3[_0x81f7('0x47')]['fields']));_0x24b0d3['attributes']=_0x24b0d3[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x24b0d3[_0x81f7('0x4b')]:_0x3b8ae2[_0x81f7('0x46')];if(!_0x554fc3[_0x81f7('0x47')]['hasOwnProperty']('nolimit')){_0x24b0d3[_0x81f7('0x25')]=qs[_0x81f7('0x25')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x25')]);_0x24b0d3[_0x81f7('0x23')]=qs[_0x81f7('0x23')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x23')]);}_0x24b0d3['order']=qs[_0x81f7('0x50')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x50')]);_0x24b0d3[_0x81f7('0x51')]=qs[_0x81f7('0x49')](_[_0x81f7('0x52')](_0x554fc3[_0x81f7('0x47')],_0x3b8ae2[_0x81f7('0x49')]));_0x24b0d3[_0x81f7('0x51')][_0x81f7('0xba')]=_0x26c102['id'];if(_0x554fc3[_0x81f7('0x47')][_0x81f7('0x8b')]){_0x24b0d3[_0x81f7('0x51')]=_[_0x81f7('0xa4')](_0x24b0d3['where'],{'$or':_['map'](_0x24b0d3[_0x81f7('0x4b')],function(_0x2f032c){var _0x11c606={};_0x11c606[_0x2f032c]={'$like':'%'+_0x554fc3['query']['filter']+'%'};return _0x11c606;})});}if(_0x554fc3[_0x81f7('0x47')]['$gte']){var _0x309db4=_0x554fc3[_0x81f7('0x47')][_0x81f7('0x82')][_0x81f7('0x38')](',');var _0x488959={};_0x488959[_0x309db4[0x0]]={'$gte':moment(_0x309db4[0x1])['format'](_0x81f7('0xc7'))};_0x24b0d3[_0x81f7('0x51')]=_[_0x81f7('0xa4')](_0x24b0d3[_0x81f7('0x51')],_0x488959);}_0x24b0d3=_[_0x81f7('0xa4')]({},_0x24b0d3,_0x554fc3[_0x81f7('0xbf')]);return db[_0x81f7('0xc4')][_0x81f7('0x26')]({'where':_0x24b0d3['where']})[_0x81f7('0x2d')](function(_0x1c2968){_0x48b39d[_0x81f7('0x26')]=_0x1c2968;if(_0x554fc3[_0x81f7('0x47')][_0x81f7('0xbd')]){_0x24b0d3['include']=[{'all':!![]}];}return db[_0x81f7('0xc4')][_0x81f7('0xc8')](_0x24b0d3);})[_0x81f7('0x2d')](function(_0x21df98){_0x48b39d[_0x81f7('0xc9')]=_0x21df98;return _0x48b39d;});}})[_0x81f7('0x2d')](respondWithFilteredResult(_0x18795b,_0x24b0d3))[_0x81f7('0x3b')](handleError(_0x18795b,null));};exports[_0x81f7('0xca')]=function(_0x321cfc,_0x3774f0,_0x184ed1){return db['OpenchannelInteraction'][_0x81f7('0x6a')]({'where':{'id':_0x321cfc[_0x81f7('0xbc')]['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x3774f0,null))['then'](function(_0x20d66f){if(_0x20d66f){return _0x20d66f[_0x81f7('0xcb')](_0x321cfc['body'][_0x81f7('0xc5')],_[_0x81f7('0xcc')](_0x321cfc[_0x81f7('0xc1')],[_0x81f7('0xc5'),'id'])||{})[_0x81f7('0xcd')](function(){return db[_0x81f7('0x79')][_0x81f7('0xc8')]({'attributes':['id',_0x81f7('0x31'),'color'],'where':{'id':_0x321cfc['body']['ids']}});})['then'](function(_0x3d70d6){socket[_0x81f7('0xce')]('openchannelInteractionTags:save',{'id':Number(_0x321cfc[_0x81f7('0xbc')]['id']),'tags':_0x3d70d6||[]});return{'id':Number(_0x321cfc[_0x81f7('0xbc')]['id']),'tags':_0x3d70d6||[]};});}})[_0x81f7('0x2d')](respondWithResult(_0x3774f0,null))['catch'](handleError(_0x3774f0,null));};exports[_0x81f7('0xcf')]=function(_0x3f0da4,_0x1313b8,_0x33d9fe){return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x3f0da4['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x1313b8,null))[_0x81f7('0x2d')](function(_0x2a2670){if(_0x2a2670){return _0x2a2670[_0x81f7('0xcf')](_0x3f0da4[_0x81f7('0x47')][_0x81f7('0xc5')]);}})[_0x81f7('0x2d')](respondWithStatusCode(_0x1313b8,null))['catch'](handleError(_0x1313b8,null));};exports[_0x81f7('0xd0')]=function(_0x2b38b1,_0x16f9cc){var _0x1fbf55=moment()[_0x81f7('0xd1')]()['toString']();var _0x36bfb2=path['join'](config['root'],'server','files',_0x81f7('0xd2'));var _0x2eeb83=path['join'](config[_0x81f7('0xd3')],_0x81f7('0xd4'),_0x81f7('0xd5'),_0x81f7('0xd6'));var _0x1289d4=path['join'](_0x36bfb2,_0x1fbf55);var _0xc5503c=util[_0x81f7('0xd7')](_0x81f7('0xd8'),_0x2b38b1['params']['id'],_0x1fbf55);var _0x203ed1=path[_0x81f7('0xd9')](_0x36bfb2,_0xc5503c);var _0x10a378=[];_0x10a378[_0x81f7('0x3a')]({'model':db[_0x81f7('0xda')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10a378[_0x81f7('0x3a')]({'model':db[_0x81f7('0xdb')],'as':_0x81f7('0x6f'),'attributes':['id',_0x81f7('0xdc'),_0x81f7('0xdd')],'raw':!![]});if(_0x2b38b1[_0x81f7('0x47')][_0x81f7('0xd6')]){_0x10a378['push']({'model':db[_0x81f7('0xde')],'as':_0x81f7('0xde'),'raw':!![]});}var _0x5ebb3c=[{'model':db[_0x81f7('0xc4')],'as':_0x81f7('0xdf'),'attributes':['id',_0x81f7('0xc1'),'createdAt',_0x81f7('0xe0'),_0x81f7('0xe1'),_0x81f7('0x86')],'include':_0x10a378}];_0x5ebb3c[_0x81f7('0x3a')]({'model':db[_0x81f7('0xe2')],'as':_0x81f7('0xe3'),'attributes':['id',_0x81f7('0x31')]});_0x5ebb3c[_0x81f7('0x3a')]({'model':db['User'],'as':_0x81f7('0xe4'),'attributes':['id',_0x81f7('0x35')]});return db[_0x81f7('0x44')]['find']({'where':{'id':_0x2b38b1[_0x81f7('0xbc')]['id']},'include':_0x5ebb3c})[_0x81f7('0x2d')](handleEntityNotFound(_0x16f9cc,null))['then'](function(_0x13599f){if(_0x13599f){var _0xf303fa=_0x13599f['get']({'plain':!![]});fs[_0x81f7('0xe5')](_0x1289d4);var _0x2d2fab={'channel':'Openchannel','account':_0xf303fa[_0x81f7('0xe3')][_0x81f7('0x31')],'agent':_0xf303fa[_0x81f7('0xe4')]?_0xf303fa[_0x81f7('0xe4')][_0x81f7('0x35')]:_0x81f7('0xe6'),'createdAt':moment(_0xf303fa['createdAt'])['format'](_0x81f7('0xc7'))[_0x81f7('0xa2')](),'closedAt':_0xf303fa[_0x81f7('0x40')]?moment(_0xf303fa[_0x81f7('0xe7')])[_0x81f7('0xd7')](_0x81f7('0xc7'))[_0x81f7('0xa2')]():'','disposition':_0xf303fa['disposition'],'visibility':_0xf303fa['threadId']?_0x81f7('0xe8'):'Private','messages':_(_0xf303fa[_0x81f7('0xdf')])['filter']({'secret':![]})['map'](function(_0x1b0ed8){if(_0x1b0ed8['Attachment']){var _0x20df26=path[_0x81f7('0xd9')](_0x2eeb83,_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')]);if(fs['existsSync'](_0x20df26)){fs[_0x81f7('0xea')](_0x20df26)['pipe'](fs[_0x81f7('0xeb')](path[_0x81f7('0xd9')](_0x1289d4,_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')])));}}return{'date':moment(_0x1b0ed8[_0x81f7('0x80')])[_0x81f7('0xd7')](_0x81f7('0xc7'))[_0x81f7('0xa2')](),'sender':_0x1b0ed8['direction']==='out'?_0x1b0ed8[_0x81f7('0xda')]?_0x1b0ed8['User'][_0x81f7('0x35')]:_0x81f7('0xec'):_0x1b0ed8[_0x81f7('0x6f')][_0x81f7('0xdc')]+(_0x1b0ed8[_0x81f7('0x6f')][_0x81f7('0xdd')]?'\x20'+_0x1b0ed8[_0x81f7('0x6f')]['lastName']:''),'body':_0x1b0ed8[_0x81f7('0xde')]?_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')]:_0x1b0ed8[_0x81f7('0xc1')],'direction':_0x1b0ed8[_0x81f7('0xe0')]===_0x81f7('0xed')?'A':'C','secret':_0x1b0ed8[_0x81f7('0xe1')],'read':_0x1b0ed8['read'],'attachment':_0x1b0ed8[_0x81f7('0xde')]};})[_0x81f7('0x6c')]()};return ejs[_0x81f7('0xee')](path['join'](config[_0x81f7('0xd3')],_0x81f7('0xd4'),'views','downloadInteraction.ejs'),{'interaction':_0x2d2fab})[_0x81f7('0x2d')](function(_0x2719f0){var _0x2e03de=path[_0x81f7('0xd9')](_0x1289d4,_0x81f7('0xef')+_0xf303fa['id']+'-'+_0x1fbf55+_0x81f7('0xf0'));var _0x3a770f={'path':_0x2e03de,'channel':_0x81f7('0xf1'),'interactionId':_0xf303fa['id']};return pdf[_0x81f7('0xf2')](_0x2719f0,_0x3a770f);})['then'](function(){return new BPromise(function(_0x4d1e3a,_0x443520){zipdir(_0x1289d4,{'saveTo':_0x203ed1},function(_0x174726,_0x84006a){if(_0x174726)return _0x443520(_0x174726);return _0x4d1e3a(_0x84006a);});})['then'](function(){return new BPromise(function(_0x1fb6c5,_0x5f3759){rimraf(_0x1289d4,function(_0x4c4394){if(_0x4c4394)_0x5f3759(_0x4c4394);return _0x1fb6c5();});});})[_0x81f7('0x2d')](function(){return _0x16f9cc[_0x81f7('0xd0')](_0x203ed1,_0xc5503c,function(_0x1f5752){if(_0x1f5752){console['log'](_0x81f7('0xf3'),_0x1f5752);}else{fs[_0x81f7('0xf4')](_0x203ed1);}});});});}else{return _0x16f9cc['sendStatus'](0xc8);}})[_0x81f7('0x3b')](handleError(_0x16f9cc,null));}; \ No newline at end of file +var _0x94ac=['limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','Users','map','Tags','TagIds','split','push','catch','talking','answered','UserId','waiting','closed','unmanaged','total','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','includeAll','include','options','create','body','params','describe','addMessage','OpenchannelMessage','ids','omit','findOne','nolimit','sort','format','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','fullname','firstName','Attachment','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Private','Messages','basename','pipe','createWriteStream','direction','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','sox','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset'];(function(_0x595485,_0x58ce3b){var _0x594c96=function(_0x44d05a){while(--_0x44d05a){_0x595485['push'](_0x595485['shift']());}};_0x594c96(++_0x58ce3b);}(_0x94ac,0x1d1));var _0xc94a=function(_0x4b7ec6,_0x3180d9){_0x4b7ec6=_0x4b7ec6-0x0;var _0x4f3c3e=_0x94ac[_0x4b7ec6];return _0x4f3c3e;};'use strict';var emlformat=require(_0xc94a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc94a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc94a('0x2'));var BPromise=require(_0xc94a('0x3'));var Mustache=require('mustache');var util=require(_0xc94a('0x4'));var path=require(_0xc94a('0x5'));var sox=require(_0xc94a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc94a('0x7'));var _=require(_0xc94a('0x8'));var squel=require(_0xc94a('0x9'));var crypto=require(_0xc94a('0xa'));var jsforce=require(_0xc94a('0xb'));var deskjs=require(_0xc94a('0xc'));var toCsv=require(_0xc94a('0xd'));var querystring=require(_0xc94a('0xe'));var Papa=require(_0xc94a('0xf'));var Redis=require('ioredis');var authService=require(_0xc94a('0x10'));var qs=require(_0xc94a('0x11'));var as=require(_0xc94a('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xc94a('0x13'));var logger=require(_0xc94a('0x14'))('api');var utils=require(_0xc94a('0x15'));var config=require(_0xc94a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc94a('0x17'))['db'];config[_0xc94a('0x18')]=_[_0xc94a('0x19')](config[_0xc94a('0x18')],{'host':_0xc94a('0x1a'),'port':0x18eb});var socket=require(_0xc94a('0x1b'))(new Redis(config[_0xc94a('0x18')]));require(_0xc94a('0x1c'))[_0xc94a('0x1d')](socket);function respondWithStatusCode(_0x23378b,_0x4b12a6){_0x4b12a6=_0x4b12a6||0xcc;return function(_0xfaa53c){if(_0xfaa53c){return _0x23378b[_0xc94a('0x1e')](_0x4b12a6);}return _0x23378b[_0xc94a('0x1f')](_0x4b12a6)[_0xc94a('0x20')]();};}function respondWithResult(_0x3b617a,_0x37e41e){_0x37e41e=_0x37e41e||0xc8;return function(_0x59ff39){if(_0x59ff39){return _0x3b617a[_0xc94a('0x1f')](_0x37e41e)[_0xc94a('0x21')](_0x59ff39);}};}function respondWithFilteredResult(_0x37ea5e,_0x1619b3){return function(_0x2dd2fe){if(_0x2dd2fe){var _0x18bcf7=typeof _0x1619b3[_0xc94a('0x22')]==='undefined'&&typeof _0x1619b3[_0xc94a('0x23')]===_0xc94a('0x24');var _0xb48e55=_0x2dd2fe[_0xc94a('0x25')];var _0x395258=_0x18bcf7?0x0:_0x1619b3[_0xc94a('0x22')];var _0x472cbf=_0x18bcf7?_0x2dd2fe[_0xc94a('0x25')]:_0x1619b3[_0xc94a('0x22')]+_0x1619b3[_0xc94a('0x23')];var _0x440414;if(_0x472cbf>=_0xb48e55){_0x472cbf=_0xb48e55;_0x440414=0xc8;}else{_0x440414=0xce;}_0x37ea5e[_0xc94a('0x1f')](_0x440414);return _0x37ea5e[_0xc94a('0x26')](_0xc94a('0x27'),_0x395258+'-'+_0x472cbf+'/'+_0xb48e55)[_0xc94a('0x21')](_0x2dd2fe);}return null;};}function patchUpdates(_0x4062bc){return function(_0x2fd5e0){try{jsonpatch[_0xc94a('0x28')](_0x2fd5e0,_0x4062bc,!![]);}catch(_0x489aac){return BPromise[_0xc94a('0x29')](_0x489aac);}return _0x2fd5e0['save']();};}function saveUpdates(_0x567c81,_0x2f88d5){return function(_0x53eae1){if(_0x53eae1){return _0x53eae1[_0xc94a('0x2a')](_0x567c81)[_0xc94a('0x2b')](function(_0x8b0eb5){return _0x8b0eb5;});}return null;};}function removeEntity(_0x3030fa,_0x3ef014){return function(_0xfb0864){if(_0xfb0864){return _0xfb0864['destroy']()['then'](function(){_0x3030fa[_0xc94a('0x1f')](0xcc)[_0xc94a('0x20')]();});}};}function handleEntityNotFound(_0x574296,_0x5c6d0e){return function(_0x3e2ed2){if(!_0x3e2ed2){_0x574296['sendStatus'](0x194);}return _0x3e2ed2;};}function handleError(_0x575009,_0x42c2db){_0x42c2db=_0x42c2db||0x1f4;return function(_0x176ae0){logger[_0xc94a('0x2c')](_0x176ae0[_0xc94a('0x2d')]);if(_0x176ae0[_0xc94a('0x2e')]){delete _0x176ae0['name'];}_0x575009[_0xc94a('0x1f')](_0x42c2db)[_0xc94a('0x2f')](_0x176ae0);};}function getInteractionUsers(_0x4b9fdc,_0x1bf3c1){return new BPromise(function(_0xd671df,_0x28e158){try{if(_0x1bf3c1[_0x4b9fdc['id']]){_0x4b9fdc[_0xc94a('0x30')]=_[_0xc94a('0x31')](_0x1bf3c1[_0x4b9fdc['id']],function(_0xee3c84){return{'id':_0xee3c84['id'],'fullname':_0xee3c84['fullname']};});}}catch(_0xbe718b){_0x28e158(_0xbe718b);}_0xd671df(_0x4b9fdc);});}function getInteractionTags(_0x2b17ff,_0x261569){return new BPromise(function(_0x5df013,_0x309d7b){try{if(_0x2b17ff['TagIds']){_0x2b17ff[_0xc94a('0x32')]=[];_0x2b17ff[_0xc94a('0x33')][_0xc94a('0x34')](',')['forEach'](function(_0x56a1c8){_0x2b17ff[_0xc94a('0x32')][_0xc94a('0x35')](_0x261569[_0x56a1c8]);});}delete _0x2b17ff[_0xc94a('0x33')];}catch(_0x82fe6b){_0x309d7b(_0x82fe6b);}_0x5df013(_0x2b17ff);});}function updateOpenchannelInteraction(_0x371eef,_0x447fcd,_0x2be8c5){return new BPromise(function(_0xf8708e,_0x4af471){return getInteractionUsers(_0x371eef,_0x2be8c5)[_0xc94a('0x2b')](function(_0x522ba4){return getInteractionTags(_0x522ba4,_0x447fcd);})[_0xc94a('0x2b')](function(_0x133be2){return getStateInteraction(_0x133be2);})[_0xc94a('0x2b')](function(_0x483301){_0xf8708e(_0x483301);})[_0xc94a('0x36')](function(_0x38364d){_0x4af471(_0x38364d);});});}function getStateInteraction(_0x475269){return new BPromise(function(_0xd255ad){_0x475269['waiting']=0x0;_0x475269[_0xc94a('0x37')]=0x0;_0x475269[_0xc94a('0x38')]=0x0;_0x475269['unmanaged']=0x0;_0x475269['total']=0x0;if(!_0x475269['closed']&&!_0x475269[_0xc94a('0x39')]){_0x475269[_0xc94a('0x3a')]+=0x1;}if(!_0x475269['closed']&&_0x475269['UserId']){_0x475269[_0xc94a('0x37')]+=0x1;if(_0x475269[_0xc94a('0x3a')]){_0x475269['waiting']-=0x1;}}if(_0x475269[_0xc94a('0x3b')]&&_0x475269[_0xc94a('0x39')]){_0x475269[_0xc94a('0x38')]+=0x1;if(_0x475269[_0xc94a('0x37')]){_0x475269[_0xc94a('0x37')]-=0x1;}}if(_0x475269['closed']&&!_0x475269[_0xc94a('0x39')]){_0x475269[_0xc94a('0x3c')]+=0x1;if(_0x475269[_0xc94a('0x3a')]){_0x475269[_0xc94a('0x3a')]-=0x1;}}_0x475269[_0xc94a('0x3d')]+=0x1;_0xd255ad(_0x475269);});}exports[_0xc94a('0x3e')]=function(_0x4b2900,_0x359d77){var _0x54bfe6={},_0x4352c3={},_0x50dc53={'count':0x0,'rows':[]};var _0x518c99=_[_0xc94a('0x31')](db[_0xc94a('0x3f')][_0xc94a('0x40')],function(_0x249549){return{'name':_0x249549[_0xc94a('0x41')],'type':_0x249549[_0xc94a('0x42')]['key']};});_0x4352c3[_0xc94a('0x43')]=_[_0xc94a('0x31')](_0x518c99,_0xc94a('0x2e'));_0x4352c3['query']=_[_0xc94a('0x44')](_0x4b2900[_0xc94a('0x45')]);_0x4352c3[_0xc94a('0x46')]=_[_0xc94a('0x47')](_0x4352c3[_0xc94a('0x43')],_0x4352c3[_0xc94a('0x45')]);_0x54bfe6[_0xc94a('0x48')]=_[_0xc94a('0x47')](_0x4352c3['model'],qs[_0xc94a('0x49')](_0x4b2900[_0xc94a('0x45')][_0xc94a('0x49')]));_0x54bfe6[_0xc94a('0x48')]=_0x54bfe6[_0xc94a('0x48')]['length']?_0x54bfe6[_0xc94a('0x48')]:_0x4352c3[_0xc94a('0x43')];if(!_0x4b2900['query'][_0xc94a('0x4a')]('nolimit')){_0x54bfe6[_0xc94a('0x23')]=qs[_0xc94a('0x23')](_0x4b2900[_0xc94a('0x45')][_0xc94a('0x23')]);_0x54bfe6[_0xc94a('0x22')]=qs[_0xc94a('0x22')](_0x4b2900[_0xc94a('0x45')][_0xc94a('0x22')]);}_0x54bfe6[_0xc94a('0x4b')]=qs['sort'](_0x4b2900['query']['sort']);_0x54bfe6[_0xc94a('0x4c')]=qs[_0xc94a('0x46')](_['pick'](_0x4b2900[_0xc94a('0x45')],_0x4352c3['filters']),_0x518c99);var _0xcdc55d=[];var _0x530252=squel[_0xc94a('0x4d')]()[_0xc94a('0x4e')]('id')[_0xc94a('0x4e')]('name')[_0xc94a('0x4e')](_0xc94a('0x4f'))['from'](_0xc94a('0x50'));var _0x81f335=squel[_0xc94a('0x4d')]()[_0xc94a('0x4e')](_0xc94a('0x51'))[_0xc94a('0x4e')](_0xc94a('0x52'))[_0xc94a('0x4e')](_0xc94a('0x53'))['from'](_0xc94a('0x54'),'ui')[_0xc94a('0x55')]('users','u',_0xc94a('0x56'));var _0x29db55=squel[_0xc94a('0x4d')]()[_0xc94a('0x57')](_0xc94a('0x58'),'i')[_0xc94a('0x55')](_0xc94a('0x59'),'c',_0xc94a('0x5a'))['left_join'](_0xc94a('0x5b'),'o',_0xc94a('0x5c'))[_0xc94a('0x55')]('openchannel_accounts','a',_0xc94a('0x5d'))[_0xc94a('0x55')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xc94a('0x55')](_0xc94a('0x5e'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xc94a('0x5f'));var _0x457dfc=squel[_0xc94a('0x60')]();var _0x592da0=[];var _0x365abc=squel[_0xc94a('0x60')]();var _0x44ea17;if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x61')]){_0x44ea17=as['parseSearch'](_0x4b2900[_0xc94a('0x45')][_0xc94a('0x61')]);var _0x5e5543=_0x44ea17[_0xc94a('0x62')];for(var _0xb64b28=0x0;_0xb64b28<_0x44ea17[_0xc94a('0x63')][_0xc94a('0x64')];_0xb64b28++){var _0x5cc3c1=_0x44ea17[_0xc94a('0x63')][_0xb64b28];var _0x1cc342='i';var _0x44cb88=_[_0xc94a('0x65')](_0x518c99,[_0xc94a('0x2e'),_0x5cc3c1[_0xc94a('0x4e')]]);if(!_0x44cb88){switch(_0x5cc3c1['field']){case _0xc94a('0x66'):if(_0x5cc3c1[_0xc94a('0x67')]==0x1){_0x29db55[_0xc94a('0x68')]('`'+_0x5cc3c1['field']+_0xc94a('0x69'));}else{_0x29db55[_0xc94a('0x68')]('`'+_0x5cc3c1[_0xc94a('0x4e')]+_0xc94a('0x6a'));}break;case _0xc94a('0x6b'):if(_0x5cc3c1[_0xc94a('0x6c')]==='$substring'){if(_0x5cc3c1[_0xc94a('0x67')]['split']('\x20')[_0xc94a('0x64')]>0x1){_0x457dfc[_0x5e5543](_0xc94a('0x6d'),qs[_0xc94a('0x6e')](_0x5cc3c1[_0xc94a('0x67')]),null);}else{var _0x22c6cd='%'+_0x5cc3c1[_0xc94a('0x67')]+'%';_0x457dfc[_0x5e5543]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x22c6cd,_0x22c6cd,_0x22c6cd);}}else{_0x44cb88=_[_0xc94a('0x65')](_0x518c99,[_0xc94a('0x2e'),_0xc94a('0x6f')]);_0x5cc3c1['field']='ContactId';_0x3d452a=as[_0xc94a('0x70')](_0x1cc342,_0x44cb88['type'],_0x5cc3c1);_0x457dfc[_0x5e5543](_0x3d452a[_0xc94a('0x71')],_0x3d452a[_0xc94a('0x67')][_0xc94a('0x72')],_0x3d452a[_0xc94a('0x67')]['end']);}break;case _0xc94a('0x73'):var _0x21bc78=_0x5cc3c1[_0xc94a('0x67')]['split'](',')['map'](function(_0x34ad3b){return Number(_0x34ad3b);});_0x21bc78[_0xc94a('0x74')](function(_0x58ba1b){_0x365abc['or'](_0xc94a('0x75'),'%,'+_0x58ba1b+',%');});_0x592da0=_[_0xc94a('0x76')](_0x592da0,_0x21bc78);break;case _0xc94a('0x77'):if(_0x5cc3c1[_0xc94a('0x6c')]===_0xc94a('0x78')){_0x457dfc[_0x5e5543](_0xc94a('0x79'),'%'+_0x5cc3c1[_0xc94a('0x67')]+'%',null);}else{_0x44cb88=_[_0xc94a('0x65')](_0x518c99,[_0xc94a('0x2e'),'UserId']);_0x5cc3c1[_0xc94a('0x4e')]='UserId';_0x3d452a=as['buildExpression'](_0x1cc342,_0x44cb88[_0xc94a('0x42')],_0x5cc3c1);_0x457dfc[_0x5e5543](_0x3d452a[_0xc94a('0x71')],_0x3d452a[_0xc94a('0x67')]['start'],_0x3d452a[_0xc94a('0x67')]['end']);}break;case'body':_0x3d452a=as[_0xc94a('0x70')]('me',null,_0x5cc3c1);_0x457dfc[_0x5e5543](_0x3d452a[_0xc94a('0x71')],_0x3d452a[_0xc94a('0x67')][_0xc94a('0x72')],_0x3d452a[_0xc94a('0x67')]['end']);break;}}else{var _0x3d452a=as[_0xc94a('0x70')](_0x1cc342,_0x44cb88[_0xc94a('0x42')],_0x5cc3c1);_0x457dfc[_0x5e5543](_0x3d452a[_0xc94a('0x71')],_0x3d452a[_0xc94a('0x67')]['start'],_0x3d452a[_0xc94a('0x67')]['end']);}}}else{var _0x2ff198=_(_0x4b2900[_0xc94a('0x45')])[_0xc94a('0x44')]()[_0xc94a('0x31')](function(_0x3ad09d){return _[_0xc94a('0x7a')](_0x518c99,[_0xc94a('0x2e'),_0x3ad09d])?_0x3ad09d:undefined;})[_0xc94a('0x7b')]()[_0xc94a('0x67')]();if(!_['isEmpty'](_0x2ff198)){_0x2ff198[_0xc94a('0x74')](function(_0x276029){if(_0x276029===_0xc94a('0x7c')){_0x29db55[_0xc94a('0x4c')](_0xc94a('0x7d'),[][_0xc94a('0x7e')](_0x4b2900[_0xc94a('0x45')][_0x276029]));}else if(_0x276029===_0xc94a('0x7f')){var _0x3d2e25=JSON[_0xc94a('0x80')](_0x4b2900[_0xc94a('0x45')][_0x276029])[_0xc94a('0x81')];var _0x4aa736=JSON[_0xc94a('0x80')](_0x4b2900[_0xc94a('0x45')][_0x276029])[_0xc94a('0x82')];_0x29db55[_0xc94a('0x4c')](_0xc94a('0x83'),_0x3d2e25,_0x4aa736);}else{if(_0x4b2900['query'][_0x276029]===_0xc94a('0x84')){_0x29db55['where']('i.'+_0x276029+_0xc94a('0x85'));}else{_0x29db55[_0xc94a('0x4c')]('i.'+_0x276029+_0xc94a('0x86'),_0x4b2900['query'][_0x276029]);}}});}if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x87')]){if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x87')]==0x1){_0x29db55[_0xc94a('0x68')]('`unreadMessages`\x20=\x200');}else{_0x29db55[_0xc94a('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x88')]){_0x592da0=_[_0xc94a('0x89')](_0x4b2900[_0xc94a('0x45')][_0xc94a('0x88')])?_0x4b2900[_0xc94a('0x45')][_0xc94a('0x88')]:new Array(_0x4b2900[_0xc94a('0x45')]['tag']);_0x592da0['forEach'](function(_0x2f2c08){_0x365abc['or'](_0xc94a('0x75'),'%,'+_0x2f2c08+',%');});}if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x8a')]){var _0x90e1a6=_0x4b2900[_0xc94a('0x45')][_0xc94a('0x8a')][_0xc94a('0x8b')]('\x5c','\x5c\x5c')[_0xc94a('0x8b')](/'/g,'\x27\x27');if(qs[_0xc94a('0x8c')](_0x90e1a6)){_0x457dfc['or'](_0xc94a('0x8d'),_0x90e1a6+'%');}else{_0x457dfc['or'](_0xc94a('0x8e'),qs[_0xc94a('0x6e')](_0x90e1a6))['or']('i.from\x20LIKE\x20?',_0x90e1a6+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x90e1a6+'%');}}}_0x29db55[_0xc94a('0x4c')](_0x457dfc);_0x29db55[_0xc94a('0x8f')]('i.id');var _0x156561={'type':db[_0xc94a('0x90')][_0xc94a('0x91')]['SELECT'],'raw':!![]};var _0x17ed8b=_0x29db55[_0xc94a('0x92')]();_0x17ed8b[_0xc94a('0x4e')]('i.id');_0x17ed8b[_0xc94a('0x4e')](_0xc94a('0x93'),_0xc94a('0x66'));if(_0x54bfe6[_0xc94a('0x4b')]){_0x54bfe6[_0xc94a('0x4b')][_0xc94a('0x74')](function(_0xe774fe){var _0x3d797d=_0xe774fe[0x0]===_0xc94a('0x94')?_0xe774fe[0x0]:'i.'+_0xe774fe[0x0];_0x29db55['order'](_0x3d797d,_0xe774fe[0x1]===_0xc94a('0x95')?![]:!![]);});}if(!_[_0xc94a('0x96')](_0x592da0)){_0x29db55[_0xc94a('0x68')](_0x365abc);_0x17ed8b['where'](_0xc94a('0x97'),_0x592da0);}BPromise[_0xc94a('0x98')]()['then'](function(){if(!_0x44ea17){if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x7c')])return;_0x17ed8b[_0xc94a('0x4c')](_0xc94a('0x99'));_0x29db55[_0xc94a('0x4c')](_0xc94a('0x99'));return;}if(_0x4b2900['user'][_0xc94a('0x9a')]!==_0xc94a('0x9b'))return;return _0x4b2900[_0xc94a('0x9c')][_0xc94a('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4f2d8b){if(_['isEmpty'](_0x4f2d8b)){_0x17ed8b[_0xc94a('0x4c')](_0xc94a('0x9e'));_0x29db55['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x17ed8b[_0xc94a('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x4f2d8b,'id'));_0x29db55[_0xc94a('0x4c')](_0xc94a('0x7d'),_[_0xc94a('0x31')](_0x4f2d8b,'id'));}});})[_0xc94a('0x2b')](function(){if(_0x4b2900['user'][_0xc94a('0x9a')]===_0xc94a('0x9b')&&!_0x44ea17&&!_0x4b2900['query'][_0xc94a('0x7c')])return[];return db['sequelize']['query'](_0x17ed8b[_0xc94a('0x9f')](),_0x156561);})['then'](function(_0x415d55){_0x50dc53[_0xc94a('0x25')]=_0x415d55[_0xc94a('0x64')];if(_0x50dc53[_0xc94a('0x25')]===0x0)return[];return db[_0xc94a('0xa0')][_0xc94a('0x45')](_0x530252[_0xc94a('0x9f')](),_0x156561)['then'](function(_0x108077){_0xcdc55d=_['keyBy'](_0x108077,'id');_0x156561=_[_0xc94a('0xa1')](_0x156561,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b2900[_0xc94a('0x45')][_0xc94a('0x49')]){_0x54bfe6[_0xc94a('0x48')][_0xc94a('0x74')](function(_0x275b6e){_0x29db55[_0xc94a('0x4e')]('i.'+_0x275b6e);});}else{_0x29db55[_0xc94a('0x4e')](_0xc94a('0x93'),'unreadMessages');_0x29db55[_0xc94a('0x4e')](_0xc94a('0xa2'),_0xc94a('0xa3'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xa4'),_0xc94a('0xa5'));_0x29db55[_0xc94a('0x4e')]('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',_0xc94a('0x94'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xa6'));_0x29db55[_0xc94a('0x4e')]('c.firstName',_0xc94a('0xa7'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xa8'),_0xc94a('0xa9'));_0x29db55['field'](_0xc94a('0xaa'),_0xc94a('0xab'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xac'),_0xc94a('0xad'));_0x29db55['field'](_0xc94a('0xae'),_0xc94a('0xaf'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xb0'),_0xc94a('0xb1'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xb2'),_0xc94a('0xb3'));_0x29db55[_0xc94a('0x4e')](_0xc94a('0xb4'),_0xc94a('0xb5'));_0x29db55['field'](_0xc94a('0xb6'),'TagIds');}if(_0x54bfe6[_0xc94a('0x23')])_0x29db55[_0xc94a('0x23')](_0x54bfe6[_0xc94a('0x23')]);if(_0x54bfe6[_0xc94a('0x22')])_0x29db55[_0xc94a('0x22')](_0x54bfe6[_0xc94a('0x22')]);return db[_0xc94a('0xa0')][_0xc94a('0x45')](_0x29db55[_0xc94a('0x9f')](),_0x156561);})['then'](function(_0x5e5fbe){if(_0x5e5fbe[_0xc94a('0x64')]>0x0)_0x81f335['where'](_0xc94a('0xb7'),_[_0xc94a('0x31')](_0x5e5fbe,'id'));return db[_0xc94a('0xa0')][_0xc94a('0x45')](_0x81f335[_0xc94a('0x9f')](),_0x156561)[_0xc94a('0x2b')](function(_0x8b90bd){var _0x4814cd=_[_0xc94a('0xb8')](_0x8b90bd,_0xc94a('0xb9'));var _0x45a2f0=[];_0x5e5fbe[_0xc94a('0x74')](function(_0x5af13){_0x45a2f0[_0xc94a('0x35')](updateOpenchannelInteraction(_0x5af13,_0xcdc55d,_0x4814cd));});return BPromise[_0xc94a('0xba')](_0x45a2f0);});});})[_0xc94a('0x2b')](function(_0x1e82ae){_0x50dc53[_0xc94a('0xbb')]=_0x1e82ae;return _0x50dc53;})[_0xc94a('0x2b')](respondWithFilteredResult(_0x359d77,_0x54bfe6))['catch'](handleError(_0x359d77,null));};exports[_0xc94a('0xbc')]=function(_0x17d1bd,_0x21db00){var _0x3ae7ee={};if(_0x17d1bd[_0xc94a('0x45')][_0xc94a('0x42')]&&_0x17d1bd['query'][_0xc94a('0x42')]===_0xc94a('0x57')){_0x3ae7ee['from']=_0x17d1bd['params']['id'];}else{_0x3ae7ee['id']=_0x17d1bd['params']['id'];}var _0x167851={'raw':![],'where':_0x3ae7ee},_0x582503={};_0x582503[_0xc94a('0x43')]=_[_0xc94a('0x44')](db[_0xc94a('0x3f')][_0xc94a('0x40')]);_0x582503[_0xc94a('0x45')]=_[_0xc94a('0x44')](_0x17d1bd[_0xc94a('0x45')]);_0x582503[_0xc94a('0x46')]=_['intersection'](_0x582503[_0xc94a('0x43')],_0x582503[_0xc94a('0x45')]);_0x167851['attributes']=_[_0xc94a('0x47')](_0x582503[_0xc94a('0x43')],qs[_0xc94a('0x49')](_0x17d1bd['query'][_0xc94a('0x49')]));_0x167851['attributes']=_0x167851[_0xc94a('0x48')][_0xc94a('0x64')]?_0x167851['attributes']:_0x582503[_0xc94a('0x43')];if(_0x17d1bd[_0xc94a('0x45')][_0xc94a('0xbd')]){_0x167851[_0xc94a('0xbe')]=[{'all':!![]}];}_0x167851=_[_0xc94a('0xa1')]({},_0x167851,_0x17d1bd[_0xc94a('0xbf')]);return db['OpenchannelInteraction'][_0xc94a('0x65')](_0x167851)[_0xc94a('0x2b')](handleEntityNotFound(_0x21db00,null))['then'](respondWithResult(_0x21db00,null))['catch'](handleError(_0x21db00,null));};exports[_0xc94a('0xc0')]=function(_0x4a3b0f,_0x16f487){return db[_0xc94a('0x3f')][_0xc94a('0xc0')](_0x4a3b0f[_0xc94a('0xc1')],{})['then'](respondWithResult(_0x16f487,0xc9))[_0xc94a('0x36')](handleError(_0x16f487,null));};exports['update']=function(_0x4729eb,_0x572027){if(_0x4729eb['body']['id']){delete _0x4729eb['body']['id'];}return db['OpenchannelInteraction'][_0xc94a('0x65')]({'where':{'id':_0x4729eb[_0xc94a('0xc2')]['id']}})[_0xc94a('0x2b')](handleEntityNotFound(_0x572027,null))[_0xc94a('0x2b')](saveUpdates(_0x4729eb[_0xc94a('0xc1')],null))[_0xc94a('0x2b')](respondWithResult(_0x572027,null))[_0xc94a('0x36')](handleError(_0x572027,null));};exports['destroy']=function(_0x45ccc4,_0xf36ee0){return db[_0xc94a('0x3f')][_0xc94a('0x65')]({'where':{'id':_0x45ccc4[_0xc94a('0xc2')]['id']}})[_0xc94a('0x2b')](handleEntityNotFound(_0xf36ee0,null))[_0xc94a('0x2b')](removeEntity(_0xf36ee0,null))['catch'](handleError(_0xf36ee0,null));};exports['describe']=function(_0xacd770,_0x4df77d){return db[_0xc94a('0x3f')][_0xc94a('0xc3')]()[_0xc94a('0x2b')](respondWithResult(_0x4df77d,null))[_0xc94a('0x36')](handleError(_0x4df77d,null));};exports[_0xc94a('0xc4')]=function(_0x1d84e1,_0x2d1559,_0x4789dd){return db[_0xc94a('0xc5')]['find']({'where':{'id':_0x1d84e1['params']['id']}})['then'](handleEntityNotFound(_0x2d1559,null))['then'](function(_0xd55cc2){if(_0xd55cc2){return _0xd55cc2[_0xc94a('0xc4')](_0x1d84e1['body'][_0xc94a('0xc6')],_[_0xc94a('0xc7')](_0x1d84e1[_0xc94a('0xc1')],[_0xc94a('0xc6'),'id'])||{});}})[_0xc94a('0x2b')](respondWithResult(_0x2d1559,null))[_0xc94a('0x36')](handleError(_0x2d1559,null));};exports['getMessages']=function(_0x5deb77,_0x120f0f,_0x956abc){var _0x387378={'raw':![],'where':{}};var _0x2a7bd7={};var _0x4911ff={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc94a('0xc8')]({'where':{'id':_0x5deb77[_0xc94a('0xc2')]['id']}})['then'](handleEntityNotFound(_0x120f0f,null))[_0xc94a('0x2b')](function(_0x3684af){if(_0x3684af){_0x2a7bd7['model']=_[_0xc94a('0x44')](db[_0xc94a('0xc5')][_0xc94a('0x40')]);_0x2a7bd7[_0xc94a('0x45')]=_['keys'](_0x5deb77[_0xc94a('0x45')]);_0x2a7bd7['filters']=_[_0xc94a('0x47')](_0x2a7bd7['model'],_0x2a7bd7[_0xc94a('0x45')]);_0x387378['attributes']=_[_0xc94a('0x47')](_0x2a7bd7[_0xc94a('0x43')],qs['fields'](_0x5deb77[_0xc94a('0x45')][_0xc94a('0x49')]));_0x387378[_0xc94a('0x48')]=_0x387378[_0xc94a('0x48')][_0xc94a('0x64')]?_0x387378[_0xc94a('0x48')]:_0x2a7bd7['model'];if(!_0x5deb77[_0xc94a('0x45')][_0xc94a('0x4a')](_0xc94a('0xc9'))){_0x387378['limit']=qs[_0xc94a('0x23')](_0x5deb77[_0xc94a('0x45')][_0xc94a('0x23')]);_0x387378[_0xc94a('0x22')]=qs[_0xc94a('0x22')](_0x5deb77[_0xc94a('0x45')][_0xc94a('0x22')]);}_0x387378['order']=qs[_0xc94a('0xca')](_0x5deb77[_0xc94a('0x45')][_0xc94a('0xca')]);_0x387378[_0xc94a('0x4c')]=qs[_0xc94a('0x46')](_['pick'](_0x5deb77['query'],_0x2a7bd7[_0xc94a('0x46')]));_0x387378[_0xc94a('0x4c')][_0xc94a('0xb9')]=_0x3684af['id'];if(_0x5deb77['query'][_0xc94a('0x8a')]){_0x387378[_0xc94a('0x4c')]=_[_0xc94a('0xa1')](_0x387378[_0xc94a('0x4c')],{'$or':_['map'](_0x387378[_0xc94a('0x48')],function(_0x1bc507){var _0x42f2a6={};_0x42f2a6[_0x1bc507]={'$like':'%'+_0x5deb77[_0xc94a('0x45')][_0xc94a('0x8a')]+'%'};return _0x42f2a6;})});}if(_0x5deb77[_0xc94a('0x45')][_0xc94a('0x81')]){var _0x9c5e20=_0x5deb77[_0xc94a('0x45')][_0xc94a('0x81')][_0xc94a('0x34')](',');var _0x2d6897={};_0x2d6897[_0x9c5e20[0x0]]={'$gte':moment(_0x9c5e20[0x1])[_0xc94a('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x387378[_0xc94a('0x4c')]=_['merge'](_0x387378['where'],_0x2d6897);}_0x387378=_['merge']({},_0x387378,_0x5deb77[_0xc94a('0xbf')]);return db[_0xc94a('0xc5')][_0xc94a('0x25')]({'where':_0x387378[_0xc94a('0x4c')]})[_0xc94a('0x2b')](function(_0x4705b7){_0x4911ff[_0xc94a('0x25')]=_0x4705b7;if(_0x5deb77[_0xc94a('0x45')][_0xc94a('0xbd')]){_0x387378[_0xc94a('0xbe')]=[{'all':!![]}];}return db[_0xc94a('0xc5')][_0xc94a('0xcc')](_0x387378);})[_0xc94a('0x2b')](function(_0x1cf5c4){_0x4911ff['rows']=_0x1cf5c4;return _0x4911ff;});}})[_0xc94a('0x2b')](respondWithFilteredResult(_0x120f0f,_0x387378))[_0xc94a('0x36')](handleError(_0x120f0f,null));};exports[_0xc94a('0xcd')]=function(_0x49e5ad,_0x8e55a,_0x56bf57){return db[_0xc94a('0x3f')][_0xc94a('0x65')]({'where':{'id':_0x49e5ad[_0xc94a('0xc2')]['id']}})[_0xc94a('0x2b')](handleEntityNotFound(_0x8e55a,null))[_0xc94a('0x2b')](function(_0x58c685){if(_0x58c685){return _0x58c685[_0xc94a('0xce')](_0x49e5ad[_0xc94a('0xc1')][_0xc94a('0xc6')],_[_0xc94a('0xc7')](_0x49e5ad['body'],[_0xc94a('0xc6'),'id'])||{})[_0xc94a('0xcf')](function(){return db[_0xc94a('0x73')][_0xc94a('0xcc')]({'attributes':['id',_0xc94a('0x2e'),_0xc94a('0x4f')],'where':{'id':_0x49e5ad[_0xc94a('0xc1')][_0xc94a('0xc6')]}});})[_0xc94a('0x2b')](function(_0x365305){socket[_0xc94a('0xd0')](_0xc94a('0xd1'),{'id':Number(_0x49e5ad['params']['id']),'tags':_0x365305||[]});return{'id':Number(_0x49e5ad['params']['id']),'tags':_0x365305||[]};});}})[_0xc94a('0x2b')](respondWithResult(_0x8e55a,null))[_0xc94a('0x36')](handleError(_0x8e55a,null));};exports['removeTags']=function(_0xb2b455,_0x17e178,_0x23094b){return db[_0xc94a('0x3f')][_0xc94a('0x65')]({'where':{'id':_0xb2b455[_0xc94a('0xc2')]['id']}})[_0xc94a('0x2b')](handleEntityNotFound(_0x17e178,null))[_0xc94a('0x2b')](function(_0x3ae869){if(_0x3ae869){return _0x3ae869[_0xc94a('0xd2')](_0xb2b455[_0xc94a('0x45')][_0xc94a('0xc6')]);}})[_0xc94a('0x2b')](respondWithStatusCode(_0x17e178,null))[_0xc94a('0x36')](handleError(_0x17e178,null));};exports[_0xc94a('0xd3')]=function(_0x3fbf8a,_0x2ef230){var _0x9f618d=moment()[_0xc94a('0xd4')]()[_0xc94a('0x9f')]();var _0x10f58d=path['join'](config[_0xc94a('0xd5')],_0xc94a('0xd6'),'files',_0xc94a('0xd7'));var _0x45c5d9=path[_0xc94a('0xd8')](config[_0xc94a('0xd5')],_0xc94a('0xd6'),_0xc94a('0xd9'),_0xc94a('0xda'));var _0x5ba842=path[_0xc94a('0xd8')](_0x10f58d,_0x9f618d);var _0x21f777=util[_0xc94a('0xcb')]('transcript-%d-%s.zip',_0x3fbf8a[_0xc94a('0xc2')]['id'],_0x9f618d);var _0x4e2338=path[_0xc94a('0xd8')](_0x10f58d,_0x21f777);var _0x4aad32=[];_0x4aad32[_0xc94a('0x35')]({'model':db[_0xc94a('0x77')],'as':'User','attributes':['id',_0xc94a('0xdb')],'raw':!![]});_0x4aad32[_0xc94a('0x35')]({'model':db['CmContact'],'as':_0xc94a('0x6b'),'attributes':['id',_0xc94a('0xdc'),'lastName'],'raw':!![]});if(_0x3fbf8a[_0xc94a('0x45')][_0xc94a('0xda')]){_0x4aad32[_0xc94a('0x35')]({'model':db[_0xc94a('0xdd')],'as':'Attachment','raw':!![]});}var _0x2a0062=[{'model':db[_0xc94a('0xc5')],'as':'Messages','attributes':['id','body',_0xc94a('0x7f'),'direction',_0xc94a('0xde'),_0xc94a('0x87')],'include':_0x4aad32}];_0x2a0062[_0xc94a('0x35')]({'model':db[_0xc94a('0xdf')],'as':_0xc94a('0xe0'),'attributes':['id',_0xc94a('0x2e')]});_0x2a0062[_0xc94a('0x35')]({'model':db[_0xc94a('0x77')],'as':_0xc94a('0xe1'),'attributes':['id',_0xc94a('0xdb')]});return db['OpenchannelInteraction'][_0xc94a('0x65')]({'where':{'id':_0x3fbf8a[_0xc94a('0xc2')]['id']},'include':_0x2a0062})[_0xc94a('0x2b')](handleEntityNotFound(_0x2ef230,null))[_0xc94a('0x2b')](function(_0x1a9f46){if(_0x1a9f46){var _0x56af8f=_0x1a9f46[_0xc94a('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x5ba842);var _0x2d9a25={'channel':_0xc94a('0xe3'),'account':_0x56af8f['Account'][_0xc94a('0x2e')],'agent':_0x56af8f[_0xc94a('0xe1')]?_0x56af8f['Owner'][_0xc94a('0xdb')]:_0xc94a('0xe4'),'createdAt':moment(_0x56af8f[_0xc94a('0x7f')])[_0xc94a('0xcb')](_0xc94a('0xe5'))[_0xc94a('0x9f')](),'closedAt':_0x56af8f[_0xc94a('0x3b')]?moment(_0x56af8f[_0xc94a('0xe6')])[_0xc94a('0xcb')](_0xc94a('0xe5'))[_0xc94a('0x9f')]():'','disposition':_0x56af8f[_0xc94a('0xe7')],'visibility':_0x56af8f[_0xc94a('0xe8')]?'Public':_0xc94a('0xe9'),'messages':_(_0x56af8f[_0xc94a('0xea')])[_0xc94a('0x8a')]({'secret':![]})[_0xc94a('0x31')](function(_0x36caa2){if(_0x36caa2[_0xc94a('0xdd')]){var _0x37a502=path['join'](_0x45c5d9,_0x36caa2['Attachment'][_0xc94a('0xeb')]);if(fs['existsSync'](_0x37a502)){fs['createReadStream'](_0x37a502)[_0xc94a('0xec')](fs[_0xc94a('0xed')](path[_0xc94a('0xd8')](_0x5ba842,_0x36caa2[_0xc94a('0xdd')][_0xc94a('0xeb')])));}}return{'date':moment(_0x36caa2['createdAt'])[_0xc94a('0xcb')](_0xc94a('0xe5'))[_0xc94a('0x9f')](),'sender':_0x36caa2[_0xc94a('0xee')]===_0xc94a('0xef')?_0x36caa2[_0xc94a('0x77')]?_0x36caa2['User'][_0xc94a('0xdb')]:'System':_0x36caa2[_0xc94a('0x6b')][_0xc94a('0xdc')]+(_0x36caa2['Contact'][_0xc94a('0xf0')]?'\x20'+_0x36caa2['Contact'][_0xc94a('0xf0')]:''),'body':_0x36caa2[_0xc94a('0xdd')]?_0x36caa2[_0xc94a('0xdd')][_0xc94a('0xeb')]:_0x36caa2['body'],'direction':_0x36caa2[_0xc94a('0xee')]===_0xc94a('0xef')?'A':'C','secret':_0x36caa2[_0xc94a('0xde')],'read':_0x36caa2['read'],'attachment':_0x36caa2[_0xc94a('0xdd')]};})['value']()};return ejs[_0xc94a('0xf1')](path['join'](config['root'],_0xc94a('0xd6'),_0xc94a('0xf2'),_0xc94a('0xf3')),{'interaction':_0x2d9a25})[_0xc94a('0x2b')](function(_0x2989bb){var _0x48394a=path[_0xc94a('0xd8')](_0x5ba842,_0xc94a('0xf4')+_0x56af8f['id']+'-'+_0x9f618d+_0xc94a('0xf5'));var _0x1bc173={'path':_0x48394a,'channel':_0xc94a('0xe3'),'interactionId':_0x56af8f['id']};return pdf[_0xc94a('0xf6')](_0x2989bb,_0x1bc173);})['then'](function(){return new BPromise(function(_0x5eb858,_0x402e2d){zipdir(_0x5ba842,{'saveTo':_0x4e2338},function(_0x385264,_0x1b094d){if(_0x385264)return _0x402e2d(_0x385264);return _0x5eb858(_0x1b094d);});})['then'](function(){return new BPromise(function(_0x1784a6,_0x30b6a0){rimraf(_0x5ba842,function(_0xf3f26f){if(_0xf3f26f)_0x30b6a0(_0xf3f26f);return _0x1784a6();});});})[_0xc94a('0x2b')](function(){return _0x2ef230[_0xc94a('0xd3')](_0x4e2338,_0x21f777,function(_0x44f2bc){if(_0x44f2bc){console[_0xc94a('0xf7')](_0xc94a('0xf8'),_0x44f2bc);}else{fs[_0xc94a('0xf9')](_0x4e2338);}});});});}else{return _0x2ef230[_0xc94a('0x1e')](0xc8);}})[_0xc94a('0x36')](handleError(_0x2ef230,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 791b1da..caa777b 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 _0x61e9=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','getUsers'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x61e9,0x82));var _0x961e=function(_0x27afe6,_0x48e6e9){_0x27afe6=_0x27afe6-0x0;var _0x30efb1=_0x61e9[_0x27afe6];return _0x30efb1;};'use strict';var EventEmitter=require(_0x961e('0x0'));var OpenchannelInteraction=require(_0x961e('0x1'))['db'][_0x961e('0x2')];var OpenchannelMessage=require(_0x961e('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x961e('0x3')](0x0);var events={'afterCreate':_0x961e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x476973){return function(_0x3aece7,_0x35f12a,_0x5c2ef9){_0x3aece7[_0x961e('0x5')]({'attributes':['id'],'raw':!![]})[_0x961e('0x6')](function(_0x4d0fb7){_0x3aece7[_0x961e('0x7')](_0x961e('0x8'),_0x4d0fb7[_0x961e('0x9')](function(_0x514288){return{'id':_0x514288['id']};}));return OpenchannelMessage[_0x961e('0xa')]({'where':{'OpenchannelInteractionId':_0x3aece7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22628c){_0x3aece7[_0x961e('0x7')](_0x961e('0xb'),_0x22628c[_0x961e('0xc')]);OpenchannelInteractionEvents[_0x961e('0xd')](_0x476973+':'+_0x3aece7['id'],_0x3aece7);OpenchannelInteractionEvents[_0x961e('0xd')](_0x476973,_0x3aece7);_0x5c2ef9(null);})['catch'](_0x5c2ef9(null));};}for(var e in events){if(events[_0x961e('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x961e('0xf')](e,emitEvent(event));}}module[_0x961e('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd532=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save','update','getUsers','then','setDataValue','Users'];(function(_0x295ff0,_0x133c36){var _0x5a219c=function(_0x967a4c){while(--_0x967a4c){_0x295ff0['push'](_0x295ff0['shift']());}};_0x5a219c(++_0x133c36);}(_0xd532,0x15c));var _0x2d53=function(_0xd296b2,_0x27ef8a){_0xd296b2=_0xd296b2-0x0;var _0xf05c77=_0xd532[_0xd296b2];return _0xf05c77;};'use strict';var EventEmitter=require(_0x2d53('0x0'));var OpenchannelInteraction=require(_0x2d53('0x1'))['db'][_0x2d53('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d53('0x3'),'afterUpdate':_0x2d53('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3f1b9a){return function(_0x8d778a,_0x125f1b,_0x3f4a2a){_0x8d778a[_0x2d53('0x5')]({'attributes':['id'],'raw':!![]})[_0x2d53('0x6')](function(_0x60a7ae){_0x8d778a[_0x2d53('0x7')](_0x2d53('0x8'),_0x60a7ae[_0x2d53('0x9')](function(_0x193d3e){return{'id':_0x193d3e['id']};}));return OpenchannelMessage[_0x2d53('0xa')]({'where':{'OpenchannelInteractionId':_0x8d778a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d53('0x6')](function(_0x4c9dd8){_0x8d778a[_0x2d53('0x7')](_0x2d53('0xb'),_0x4c9dd8['length']);OpenchannelInteractionEvents[_0x2d53('0xc')](_0x3f1b9a+':'+_0x8d778a['id'],_0x8d778a);OpenchannelInteractionEvents[_0x2d53('0xc')](_0x3f1b9a,_0x8d778a);_0x3f4a2a(null);})[_0x2d53('0xd')](_0x3f4a2a(null));};}for(var e in events){if(events[_0x2d53('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x2d53('0xf')](e,emitEvent(event));}}module[_0x2d53('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8959b5b..aa16da7 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 _0xca15=['utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions'];(function(_0x5a0620,_0x5ae2ed){var _0xeadd35=function(_0x57c3b2){while(--_0x57c3b2){_0x5a0620['push'](_0x5a0620['shift']());}};_0xeadd35(++_0x5ae2ed);}(_0xca15,0x83));var _0x5ca1=function(_0x25b7ea,_0x2af5c9){_0x25b7ea=_0x25b7ea-0x0;var _0x175ab1=_0xca15[_0x25b7ea];return _0x175ab1;};'use strict';var _=require(_0x5ca1('0x0'));var util=require(_0x5ca1('0x1'));var logger=require('../../config/logger')(_0x5ca1('0x2'));var moment=require(_0x5ca1('0x3'));var BPromise=require(_0x5ca1('0x4'));var rp=require(_0x5ca1('0x5'));var fs=require('fs');var path=require(_0x5ca1('0x6'));var rimraf=require(_0x5ca1('0x7'));var config=require(_0x5ca1('0x8'));var attributes=require(_0x5ca1('0x9'));module[_0x5ca1('0xa')]=function(_0x3a41cb,_0x265bc4){return _0x3a41cb[_0x5ca1('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x5ca1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ca1('0xd'),'collate':_0x5ca1('0xe'),'hooks':{'beforeUpdate':function(_0x55e77f,_0x2d5068,_0x476053){if(_0x55e77f[_0x5ca1('0xf')]('closed')){_0x55e77f[_0x5ca1('0x10')]=moment()['format'](_0x5ca1('0x11'));}_0x476053(null,_0x55e77f);}}});}; \ No newline at end of file +var _0x9ec0=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0x9ec0,0x1b9));var _0x09ec=function(_0x1a5eb0,_0x1f8fbb){_0x1a5eb0=_0x1a5eb0-0x0;var _0x30f9ba=_0x9ec0[_0x1a5eb0];return _0x30f9ba;};'use strict';var _=require(_0x09ec('0x0'));var util=require(_0x09ec('0x1'));var logger=require(_0x09ec('0x2'))(_0x09ec('0x3'));var moment=require(_0x09ec('0x4'));var BPromise=require(_0x09ec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09ec('0x6'));var config=require(_0x09ec('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x09ec('0x8')]=function(_0x427940,_0x1ab080){return _0x427940[_0x09ec('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x09ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x09ec('0xb'),'collate':_0x09ec('0xc'),'hooks':{'beforeUpdate':function(_0x3b689d,_0x12a43d,_0x4c8878){if(_0x3b689d[_0x09ec('0xd')](_0x09ec('0xe'))){_0x3b689d['closedAt']=moment()[_0x09ec('0xf')](_0x09ec('0x10'));}_0x4c8878(null,_0x3b689d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index c409afb..42dbfe1 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 _0x5917=['attributes','limit','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw'];(function(_0x5d495a,_0x59f779){var _0x556eaf=function(_0x19e20e){while(--_0x19e20e){_0x5d495a['push'](_0x5d495a['shift']());}};_0x556eaf(++_0x59f779);}(_0x5917,0x172));var _0x7591=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5917[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7591('0x0'));var util=require(_0x7591('0x1'));var moment=require(_0x7591('0x2'));var BPromise=require(_0x7591('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7591('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7591('0x5'));var logger=require(_0x7591('0x6'))(_0x7591('0x7'));var config=require(_0x7591('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7591('0x9')][_0x7591('0xa')]({'port':0x232a});config[_0x7591('0xb')]=_[_0x7591('0xc')](config['redis'],{'host':_0x7591('0xd'),'port':0x18eb});var socket=require(_0x7591('0xe'))(new Redis(config['redis']));require(_0x7591('0xf'))[_0x7591('0x10')](socket);function respondWithRpcPromise(_0x32bc35,_0x44ac44,_0x13bf00){return new BPromise(function(_0x212a72,_0x466539){return client[_0x7591('0x11')](_0x32bc35,_0x13bf00)[_0x7591('0x12')](function(_0x4824c9){logger[_0x7591('0x13')](_0x7591('0x14'),_0x44ac44,_0x7591('0x15'));logger[_0x7591('0x16')](_0x7591('0x17'),_0x44ac44,'request\x20sent',JSON[_0x7591('0x18')](_0x4824c9));if(_0x4824c9['error']){if(_0x4824c9[_0x7591('0x19')][_0x7591('0x1a')]===0x1f4){logger[_0x7591('0x19')](_0x7591('0x14'),_0x44ac44,_0x4824c9[_0x7591('0x19')][_0x7591('0x1b')]);return _0x466539(_0x4824c9[_0x7591('0x19')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x44ac44,_0x4824c9[_0x7591('0x19')][_0x7591('0x1b')]);return _0x212a72(_0x4824c9['error'][_0x7591('0x1b')]);}else{logger[_0x7591('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x44ac44,_0x7591('0x15'));_0x212a72(_0x4824c9[_0x7591('0x1c')]['message']);}})[_0x7591('0x1d')](function(_0x299ec1){logger[_0x7591('0x19')](_0x7591('0x14'),_0x44ac44,_0x299ec1);_0x466539(_0x299ec1);});});}exports[_0x7591('0x1e')]=function(_0x175bbe){var _0x2c9eca=this;return new Promise(function(_0x2d2080,_0xbaaa1b){return db[_0x7591('0x1f')][_0x7591('0x20')](_0x175bbe['body'],{'raw':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175bbe['options']?_0x175bbe['options']['where']||null:null,'attributes':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x23')]||null:null,'limit':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x24')]||null:null})[_0x7591('0x12')](function(_0x1e29f8){logger[_0x7591('0x13')](_0x7591('0x1e'),_0x175bbe);logger[_0x7591('0x16')]('UpdateOpenchannelInteraction',_0x175bbe,JSON[_0x7591('0x18')](_0x1e29f8));_0x2d2080(_0x1e29f8);})[_0x7591('0x1d')](function(_0x1492cd){logger[_0x7591('0x19')](_0x7591('0x1e'),_0x1492cd[_0x7591('0x1b')],_0x175bbe);_0xbaaa1b(_0x2c9eca[_0x7591('0x19')](0x1f4,_0x1492cd[_0x7591('0x1b')]));});});};exports[_0x7591('0x25')]=function(_0x418da5){return new Promise(function(_0x20608d,_0x25f012){return db[_0x7591('0x1f')][_0x7591('0x26')]({'where':_0x418da5[_0x7591('0x21')]?_0x418da5['options'][_0x7591('0x27')]||null:null})[_0x7591('0x12')](function(_0x2d077e){if(_0x2d077e){return _0x2d077e[_0x7591('0x28')](_0x418da5[_0x7591('0x29')][_0x7591('0x2a')],_['omit'](_0x418da5[_0x7591('0x29')],[_0x7591('0x2a'),'id'])||{});}})[_0x7591('0x2b')](function(_0x323db7){logger[_0x7591('0x13')](_0x7591('0x2c'),_0x418da5);logger['debug'](_0x7591('0x2c'),_0x418da5,JSON[_0x7591('0x18')](_0x323db7));_0x20608d(_0x323db7);})[_0x7591('0x1d')](function(_0x233012){logger['error'](_0x7591('0x2c'),_0x233012[_0x7591('0x1b')],_0x418da5);_0x25f012(_this[_0x7591('0x19')](0x1f4,_0x233012['message']));});});}; \ No newline at end of file +var _0x4966=['addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UpdateOpenchannelInteraction','update','body','options','where','attributes','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction'];(function(_0x4e7962,_0x4269fd){var _0x2a79f0=function(_0x49dcb2){while(--_0x49dcb2){_0x4e7962['push'](_0x4e7962['shift']());}};_0x2a79f0(++_0x4269fd);}(_0x4966,0x146));var _0x6496=function(_0x11314c,_0x2ca8d7){_0x11314c=_0x11314c-0x0;var _0x12cb4a=_0x4966[_0x11314c];return _0x12cb4a;};'use strict';var _=require(_0x6496('0x0'));var util=require(_0x6496('0x1'));var moment=require(_0x6496('0x2'));var BPromise=require(_0x6496('0x3'));var rs=require(_0x6496('0x4'));var fs=require('fs');var Redis=require(_0x6496('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6496('0x6'));var logger=require(_0x6496('0x7'))(_0x6496('0x8'));var config=require(_0x6496('0x9'));var jayson=require(_0x6496('0xa'));var client=jayson[_0x6496('0xb')]['http']({'port':0x232a});config[_0x6496('0xc')]=_['defaults'](config[_0x6496('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6496('0xd'))(new Redis(config['redis']));require(_0x6496('0xe'))[_0x6496('0xf')](socket);function respondWithRpcPromise(_0xac329f,_0x1abf34,_0x516dd1){return new BPromise(function(_0x5bc44a,_0x17c2bb){return client[_0x6496('0x10')](_0xac329f,_0x516dd1)[_0x6496('0x11')](function(_0x5b254d){logger[_0x6496('0x12')](_0x6496('0x13'),_0x1abf34,'request\x20sent');logger['debug'](_0x6496('0x14'),_0x1abf34,_0x6496('0x15'),JSON[_0x6496('0x16')](_0x5b254d));if(_0x5b254d[_0x6496('0x17')]){if(_0x5b254d['error']['code']===0x1f4){logger[_0x6496('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1abf34,_0x5b254d['error'][_0x6496('0x18')]);return _0x17c2bb(_0x5b254d[_0x6496('0x17')][_0x6496('0x18')]);}logger[_0x6496('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1abf34,_0x5b254d[_0x6496('0x17')][_0x6496('0x18')]);return _0x5bc44a(_0x5b254d[_0x6496('0x17')][_0x6496('0x18')]);}else{logger['info'](_0x6496('0x13'),_0x1abf34,_0x6496('0x15'));_0x5bc44a(_0x5b254d['result'][_0x6496('0x18')]);}})['catch'](function(_0x29ba7c){logger[_0x6496('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1abf34,_0x29ba7c);_0x17c2bb(_0x29ba7c);});});}exports[_0x6496('0x19')]=function(_0x460827){var _0x2798c0=this;return new Promise(function(_0x4f740f,_0x5472f2){return db['OpenchannelInteraction'][_0x6496('0x1a')](_0x460827[_0x6496('0x1b')],{'raw':_0x460827[_0x6496('0x1c')]?_0x460827[_0x6496('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x460827[_0x6496('0x1c')]?_0x460827[_0x6496('0x1c')][_0x6496('0x1d')]||null:null,'attributes':_0x460827['options']?_0x460827[_0x6496('0x1c')][_0x6496('0x1e')]||null:null,'limit':_0x460827[_0x6496('0x1c')]?_0x460827[_0x6496('0x1c')]['limit']||null:null})[_0x6496('0x11')](function(_0x3f7fd8){logger[_0x6496('0x12')](_0x6496('0x19'),_0x460827);logger[_0x6496('0x1f')](_0x6496('0x19'),_0x460827,JSON[_0x6496('0x16')](_0x3f7fd8));_0x4f740f(_0x3f7fd8);})['catch'](function(_0x2944fe){logger[_0x6496('0x17')](_0x6496('0x19'),_0x2944fe[_0x6496('0x18')],_0x460827);_0x5472f2(_0x2798c0[_0x6496('0x17')](0x1f4,_0x2944fe['message']));});});};exports[_0x6496('0x20')]=function(_0x1055e1){return new Promise(function(_0xa587cb,_0x540905){return db[_0x6496('0x21')]['find']({'where':_0x1055e1[_0x6496('0x1c')]?_0x1055e1[_0x6496('0x1c')][_0x6496('0x1d')]||null:null})['then'](function(_0x1581ee){if(_0x1581ee){return _0x1581ee[_0x6496('0x22')](_0x1055e1[_0x6496('0x1b')][_0x6496('0x23')],_[_0x6496('0x24')](_0x1055e1[_0x6496('0x1b')],[_0x6496('0x23'),'id'])||{});}})[_0x6496('0x25')](function(_0x591f2b){logger[_0x6496('0x12')](_0x6496('0x26'),_0x1055e1);logger[_0x6496('0x1f')]('AddTags',_0x1055e1,JSON['stringify'](_0x591f2b));_0xa587cb(_0x591f2b);})[_0x6496('0x27')](function(_0x55485e){logger['error'](_0x6496('0x26'),_0x55485e[_0x6496('0x18')],_0x1055e1);_0x540905(_this[_0x6496('0x17')](0x1f4,_0x55485e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 66cf694..4871d76 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 _0x81f1=['update','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x1229c8,_0x1a7f0f){var _0x3ae885=function(_0x27b46d){while(--_0x27b46d){_0x1229c8['push'](_0x1229c8['shift']());}};_0x3ae885(++_0x1a7f0f);}(_0x81f1,0x17e));var _0x181f=function(_0x176c7e,_0x404a2c){_0x176c7e=_0x176c7e-0x0;var _0x8c5dd4=_0x81f1[_0x176c7e];return _0x8c5dd4;};'use strict';var OpenchannelInteractionEvents=require(_0x181f('0x0'));var events=['save',_0x181f('0x1'),_0x181f('0x2')];function createListener(_0x12897a,_0x1c8765){return function(_0x2754e1){_0x1c8765['emit'](_0x12897a,_0x2754e1);};}function removeListener(_0xe7c8f6,_0xe49e28){return function(){OpenchannelInteractionEvents['removeListener'](_0xe7c8f6,_0xe49e28);};}exports[_0x181f('0x3')]=function(_0x2c2975){for(var _0x3f9539=0x0,_0x753371=events[_0x181f('0x4')];_0x3f9539<_0x753371;_0x3f9539++){var _0x37c701=events[_0x3f9539];var _0x3cc709=createListener(_0x181f('0x5')+_0x37c701,_0x2c2975);OpenchannelInteractionEvents['on'](_0x37c701,_0x3cc709);}}; \ No newline at end of file +var _0x94b8=['length','openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener'];(function(_0x38ff2b,_0x3a0316){var _0x341f5e=function(_0x346368){while(--_0x346368){_0x38ff2b['push'](_0x38ff2b['shift']());}};_0x341f5e(++_0x3a0316);}(_0x94b8,0x80));var _0x894b=function(_0x445656,_0x4ba170){_0x445656=_0x445656-0x0;var _0x5a6e5d=_0x94b8[_0x445656];return _0x5a6e5d;};'use strict';var OpenchannelInteractionEvents=require(_0x894b('0x0'));var events=[_0x894b('0x1'),'remove',_0x894b('0x2')];function createListener(_0x41916f,_0x3dd75d){return function(_0x2bdd1b){_0x3dd75d[_0x894b('0x3')](_0x41916f,_0x2bdd1b);};}function removeListener(_0x5d394c,_0x197a42){return function(){OpenchannelInteractionEvents[_0x894b('0x4')](_0x5d394c,_0x197a42);};}exports['register']=function(_0x449940){for(var _0x4eaec0=0x0,_0x285f77=events[_0x894b('0x5')];_0x4eaec0<_0x285f77;_0x4eaec0++){var _0x1316c6=events[_0x4eaec0];var _0x26eb78=createListener(_0x894b('0x6')+_0x1316c6,_0x449940);OpenchannelInteractionEvents['on'](_0x1316c6,_0x26eb78);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8e118f6..234cc0a 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x1cb029,_0xc8baba){var _0x4e1524=function(_0x4eb61b){while(--_0x4eb61b){_0x1cb029['push'](_0x1cb029['shift']());}};_0x4e1524(++_0xc8baba);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xcb91[_0x2a4095];return _0x52eeab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8fc4da7..18ce4e0 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 _0xb2af=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb2af,0xd2));var _0xfb2a=function(_0x63d277,_0x2f59bd){_0x63d277=_0x63d277-0x0;var _0x1435bd=_0xb2af[_0x63d277];return _0x1435bd;};'use strict';var Sequelize=require(_0xfb2a('0x0'));module[_0xfb2a('0x1')]={'body':{'type':Sequelize[_0xfb2a('0x2')](_0xfb2a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfb2a('0x5')]('in',_0xfb2a('0x6')),'defaultValue':_0xfb2a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfb2a('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfb2a('0x2')]}}; \ No newline at end of file +var _0x93e9=['BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x7aff93,_0x548677){var _0x2f27c8=function(_0x2a81b4){while(--_0x2a81b4){_0x7aff93['push'](_0x7aff93['shift']());}};_0x2f27c8(++_0x548677);}(_0x93e9,0xcc));var _0x993e=function(_0x5a4c73,_0x1fb644){_0x5a4c73=_0x5a4c73-0x0;var _0x4f6f42=_0x93e9[_0x5a4c73];return _0x4f6f42;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'body':{'type':Sequelize[_0x993e('0x2')](_0x993e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993e('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x993e('0x6')]},'providerName':{'type':Sequelize[_0x993e('0x7')]},'providerResponse':{'type':Sequelize[_0x993e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8a03c8a..2dbb10b 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 _0x081c=['request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','email','rejectmessage','eml-format','moment','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x081c,0xeb));var _0xc081=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0x081c[_0x17cded];return _0x41b11f;};'use strict';var emlformat=require(_0xc081('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc081('0x1'));var BPromise=require(_0xc081('0x2'));var Mustache=require('mustache');var util=require(_0xc081('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xc081('0x4'));var ejs=require(_0xc081('0x5'));var fs=require('fs');var fs_extra=require(_0xc081('0x6'));var _=require('lodash');var squel=require(_0xc081('0x7'));var crypto=require('crypto');var jsforce=require(_0xc081('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc081('0x4'));var querystring=require(_0xc081('0x9'));var Papa=require(_0xc081('0xa'));var Redis=require('ioredis');var authService=require(_0xc081('0xb'));var qs=require(_0xc081('0xc'));var as=require(_0xc081('0xd'));var hardwareService=require(_0xc081('0xe'));var logger=require('../../config/logger')(_0xc081('0xf'));var utils=require(_0xc081('0x10'));var config=require(_0xc081('0x11'));var licenseUtil=require(_0xc081('0x12'));var db=require(_0xc081('0x13'))['db'];config['redis']=_[_0xc081('0x14')](config[_0xc081('0x15')],{'host':_0xc081('0x16'),'port':0x18eb});var socket=require(_0xc081('0x17'))(new Redis(config[_0xc081('0x15')]));require(_0xc081('0x18'))['register'](socket);var jayson=require(_0xc081('0x19'));var client=jayson[_0xc081('0x1a')][_0xc081('0x1b')]({'port':0x232c});var client9002=jayson[_0xc081('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bd896,_0x43b2ee,_0x3ad86a,_0x32d420){return new BPromise(function(_0x7a7a89,_0xa72ac2){var _0x203ab9=_0x32d420||client;return _0x203ab9['request'](_0x4bd896,_0x3ad86a)[_0xc081('0x1c')](function(_0xfe3ba7){logger[_0xc081('0x1d')](_0xc081('0x1e'),_0x43b2ee,_0xc081('0x1f'));logger['debug'](_0xc081('0x20'),_0x43b2ee,_0xc081('0x1f'),JSON[_0xc081('0x21')](_0xfe3ba7));if(_0xfe3ba7[_0xc081('0x22')]){if(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x23')]===0x1f4){logger[_0xc081('0x22')](_0xc081('0x1e'),_0x43b2ee,_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);return _0xa72ac2(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);}logger[_0xc081('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);return _0x7a7a89(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);}else{logger[_0xc081('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,'request\x20sent');_0x7a7a89(_0xfe3ba7[_0xc081('0x25')]['message']);}})[_0xc081('0x26')](function(_0x15afc7){logger[_0xc081('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,_0x15afc7);_0xa72ac2(_0x15afc7);});});}function respondWithStatusCode(_0x1a549b,_0x5b41b8){_0x5b41b8=_0x5b41b8||0xcc;return function(_0x36db52){if(_0x36db52){return _0x1a549b[_0xc081('0x27')](_0x5b41b8);}return _0x1a549b[_0xc081('0x28')](_0x5b41b8)[_0xc081('0x29')]();};}function respondWithResult(_0x498476,_0x5405bd){_0x5405bd=_0x5405bd||0xc8;return function(_0x27cb28){if(_0x27cb28){return _0x498476['status'](_0x5405bd)[_0xc081('0x2a')](_0x27cb28);}};}function respondWithFilteredResult(_0x464584,_0xb0caf8){return function(_0x3ea230){if(_0x3ea230){var _0x9d5c66=typeof _0xb0caf8['offset']==='undefined'&&typeof _0xb0caf8[_0xc081('0x2b')]===_0xc081('0x2c');var _0x5360b9=_0x3ea230[_0xc081('0x2d')];var _0x6d9371=_0x9d5c66?0x0:_0xb0caf8[_0xc081('0x2e')];var _0x2692ae=_0x9d5c66?_0x3ea230[_0xc081('0x2d')]:_0xb0caf8[_0xc081('0x2e')]+_0xb0caf8[_0xc081('0x2b')];var _0x57f232;if(_0x2692ae>=_0x5360b9){_0x2692ae=_0x5360b9;_0x57f232=0xc8;}else{_0x57f232=0xce;}_0x464584[_0xc081('0x28')](_0x57f232);return _0x464584[_0xc081('0x2f')](_0xc081('0x30'),_0x6d9371+'-'+_0x2692ae+'/'+_0x5360b9)['json'](_0x3ea230);}return null;};}function patchUpdates(_0x4c1bab){return function(_0x4ee550){try{jsonpatch[_0xc081('0x31')](_0x4ee550,_0x4c1bab,!![]);}catch(_0x2ed81c){return BPromise[_0xc081('0x32')](_0x2ed81c);}return _0x4ee550['save']();};}function saveUpdates(_0x1c834c,_0x42d32b){return function(_0x4aff14){if(_0x4aff14){return _0x4aff14[_0xc081('0x33')](_0x1c834c)[_0xc081('0x1c')](function(_0x2541e6){return _0x2541e6;});}return null;};}function removeEntity(_0x7a00aa,_0x1429fb){return function(_0x49b26a){if(_0x49b26a){return _0x49b26a[_0xc081('0x34')]()[_0xc081('0x1c')](function(){_0x7a00aa[_0xc081('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec33b,_0x3dbb0e){return function(_0x2b2183){if(!_0x2b2183){_0x5ec33b[_0xc081('0x27')](0x194);}return _0x2b2183;};}function handleError(_0xb43030,_0x108307){_0x108307=_0x108307||0x1f4;return function(_0x3b0821){logger[_0xc081('0x22')](_0x3b0821[_0xc081('0x35')]);if(_0x3b0821[_0xc081('0x36')]){delete _0x3b0821['name'];}_0xb43030['status'](_0x108307)[_0xc081('0x37')](_0x3b0821);};}exports['index']=function(_0x584d75,_0x324e20){var _0x3c04ea={},_0x394ef6={},_0x403fa5={'count':0x0,'rows':[]};var _0x5222a7=_[_0xc081('0x38')](db[_0xc081('0x39')][_0xc081('0x3a')],function(_0x28a121){return{'name':_0x28a121['fieldName'],'type':_0x28a121[_0xc081('0x3b')][_0xc081('0x3c')]};});_0x394ef6[_0xc081('0x3d')]=_[_0xc081('0x38')](_0x5222a7,'name');_0x394ef6[_0xc081('0x3e')]=_['keys'](_0x584d75[_0xc081('0x3e')]);_0x394ef6[_0xc081('0x3f')]=_[_0xc081('0x40')](_0x394ef6[_0xc081('0x3d')],_0x394ef6[_0xc081('0x3e')]);_0x3c04ea[_0xc081('0x41')]=_[_0xc081('0x40')](_0x394ef6[_0xc081('0x3d')],qs[_0xc081('0x42')](_0x584d75[_0xc081('0x3e')]['fields']));_0x3c04ea['attributes']=_0x3c04ea[_0xc081('0x41')][_0xc081('0x43')]?_0x3c04ea[_0xc081('0x41')]:_0x394ef6[_0xc081('0x3d')];if(!_0x584d75['query'][_0xc081('0x44')](_0xc081('0x45'))){_0x3c04ea[_0xc081('0x2b')]=qs[_0xc081('0x2b')](_0x584d75['query'][_0xc081('0x2b')]);_0x3c04ea[_0xc081('0x2e')]=qs[_0xc081('0x2e')](_0x584d75[_0xc081('0x3e')][_0xc081('0x2e')]);}_0x3c04ea[_0xc081('0x46')]=qs[_0xc081('0x47')](_0x584d75['query']['sort']);_0x3c04ea['where']=qs['filters'](_[_0xc081('0x48')](_0x584d75[_0xc081('0x3e')],_0x394ef6['filters']),_0x5222a7);if(_0x584d75[_0xc081('0x3e')][_0xc081('0x49')]){_0x3c04ea[_0xc081('0x4a')]=_[_0xc081('0x4b')](_0x3c04ea[_0xc081('0x4a')],{'$or':_[_0xc081('0x38')](_0x5222a7,function(_0x1c6aff){if(_0x1c6aff[_0xc081('0x3b')]!==_0xc081('0x4c')){var _0x2f1df0={};_0x2f1df0[_0x1c6aff[_0xc081('0x36')]]={'$like':'%'+_0x584d75['query']['filter']+'%'};return _0x2f1df0;}})});}_0x3c04ea=_[_0xc081('0x4b')]({},_0x3c04ea,_0x584d75[_0xc081('0x4d')]);var _0x4fd879={'where':_0x3c04ea[_0xc081('0x4a')]};return db[_0xc081('0x39')]['count'](_0x4fd879)[_0xc081('0x1c')](function(_0x511508){_0x403fa5['count']=_0x511508;if(_0x584d75['query'][_0xc081('0x4e')]){_0x3c04ea[_0xc081('0x4f')]=[{'all':!![]}];}return db[_0xc081('0x39')][_0xc081('0x50')](_0x3c04ea);})[_0xc081('0x1c')](function(_0x125701){_0x403fa5[_0xc081('0x51')]=_0x125701;return _0x403fa5;})[_0xc081('0x1c')](respondWithFilteredResult(_0x324e20,_0x3c04ea))[_0xc081('0x26')](handleError(_0x324e20,null));};exports[_0xc081('0x52')]=function(_0x30bc26,_0x53f550){var _0x11c400={'raw':!![],'where':{'id':_0x30bc26[_0xc081('0x53')]['id']}},_0x2e90e9={};_0x2e90e9[_0xc081('0x3d')]=_[_0xc081('0x54')](db['OpenchannelMessage'][_0xc081('0x3a')]);_0x2e90e9[_0xc081('0x3e')]=_[_0xc081('0x54')](_0x30bc26[_0xc081('0x3e')]);_0x2e90e9[_0xc081('0x3f')]=_[_0xc081('0x40')](_0x2e90e9[_0xc081('0x3d')],_0x2e90e9[_0xc081('0x3e')]);_0x11c400[_0xc081('0x41')]=_['intersection'](_0x2e90e9['model'],qs[_0xc081('0x42')](_0x30bc26[_0xc081('0x3e')][_0xc081('0x42')]));_0x11c400['attributes']=_0x11c400[_0xc081('0x41')][_0xc081('0x43')]?_0x11c400[_0xc081('0x41')]:_0x2e90e9['model'];if(_0x30bc26[_0xc081('0x3e')]['includeAll']){_0x11c400[_0xc081('0x4f')]=[{'all':!![]}];}_0x11c400=_['merge']({},_0x11c400,_0x30bc26[_0xc081('0x4d')]);return db[_0xc081('0x39')]['find'](_0x11c400)[_0xc081('0x1c')](handleEntityNotFound(_0x53f550,null))[_0xc081('0x1c')](respondWithResult(_0x53f550,null))[_0xc081('0x26')](handleError(_0x53f550,null));};exports[_0xc081('0x55')]=function(_0x34cbee,_0x1668f6){return db[_0xc081('0x39')][_0xc081('0x55')](_0x34cbee['body'],{})[_0xc081('0x1c')](respondWithResult(_0x1668f6,0xc9))['catch'](handleError(_0x1668f6,null));};exports['update']=function(_0x24bbb9,_0x4743ab){if(_0x24bbb9[_0xc081('0x56')]['id']){delete _0x24bbb9[_0xc081('0x56')]['id'];}return db['OpenchannelMessage'][_0xc081('0x57')]({'where':{'id':_0x24bbb9['params']['id']}})[_0xc081('0x1c')](handleEntityNotFound(_0x4743ab,null))[_0xc081('0x1c')](saveUpdates(_0x24bbb9[_0xc081('0x56')],null))['then'](respondWithResult(_0x4743ab,null))[_0xc081('0x26')](handleError(_0x4743ab,null));};exports['destroy']=function(_0x5a52ff,_0x305a0b){return db['OpenchannelMessage'][_0xc081('0x57')]({'where':{'id':_0x5a52ff[_0xc081('0x53')]['id']}})[_0xc081('0x1c')](handleEntityNotFound(_0x305a0b,null))[_0xc081('0x1c')](removeEntity(_0x305a0b,null))[_0xc081('0x26')](handleError(_0x305a0b,null));};exports[_0xc081('0x58')]=function(_0xea4119,_0x154e38){return db[_0xc081('0x39')]['describe']()[_0xc081('0x1c')](respondWithResult(_0x154e38,null))[_0xc081('0x26')](handleError(_0x154e38,null));};var interaction_log=require(_0xc081('0x59'))(_0xc081('0x5a'));exports[_0xc081('0x5b')]=function(_0x5c40c8,_0x3303e5,_0x52fec0){var _0x4d470f={'agent':{},'channel':_0xc081('0x5c')};if(_0x5c40c8[_0xc081('0x56')]['id']){delete _0x5c40c8[_0xc081('0x56')]['id'];}_0x5c40c8[_0xc081('0x56')][_0xc081('0x5d')]=!![];_0x5c40c8[_0xc081('0x56')][_0xc081('0x5e')]=moment()[_0xc081('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')]=_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')]||_0x5c40c8[_0xc081('0x61')]['id'];_0x4d470f[_0xc081('0x62')]['id']=_0x5c40c8[_0xc081('0x56')]['UserId'];return db[_0xc081('0x39')][_0xc081('0x57')]({'where':{'id':_0x5c40c8[_0xc081('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3303e5,null))[_0xc081('0x1c')](saveUpdates(_0x5c40c8['body'],null))['then'](function(_0x43f839){if(_0x43f839){_0x4d470f[_0xc081('0x24')]=_0x43f839[_0xc081('0x63')]({'plain':!![]});return db[_0xc081('0x64')]['find']({'where':{'id':_0x43f839[_0xc081('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x3303e5,null))['then'](function(_0x1470ca){if(_0x1470ca){return _0x1470ca[_0xc081('0x33')]({'UserId':_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')],'read1stAt':_[_0xc081('0x66')](_0x1470ca[_0xc081('0x67')])?moment()['format'](_0xc081('0x68')):undefined});}return null;})[_0xc081('0x1c')](function(_0x3d6f21){if(_0x3d6f21){_0x4d470f['interaction']=_0x3d6f21[_0xc081('0x63')]({'plain':!![]});interaction_log[_0xc081('0x1d')](_0xc081('0x69'),_0x5c40c8[_0xc081('0x61')]['id'],_0x5c40c8['user'][_0xc081('0x36')],_0x5c40c8['user'][_0xc081('0x6a')],_0x4d470f[_0xc081('0x6b')]['id'],_0x5c40c8[_0xc081('0x56')]?JSON['stringify'](_0x5c40c8['body']):_0xc081('0x6c'));return respondWithRpcPromise(_0xc081('0x6d'),_0xc081('0x6e'),_0x4d470f);}return null;})[_0xc081('0x1c')](function(_0x34982b){var _0x1d7e55=_0xc081('0x6f')+_0x34982b[_0xc081('0x24')]['ContactId'];return db[_0xc081('0x70')][_0xc081('0x3e')](_0x1d7e55,{'type':db[_0xc081('0x71')][_0xc081('0x72')]['SELECT'],'raw':!![]})[_0xc081('0x1c')](function(_0x4999af){return _0x4999af;});})['then'](function(_0x4ccda4){if(_0x4ccda4){_0x4d470f[_0xc081('0x24')][_0xc081('0x73')]=_0x4ccda4[0x0];if(!_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')])return;return db[_0xc081('0x74')][_0xc081('0x57')]({'where':{'id':_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')],'role':_0xc081('0x62')},'attributes':['id',_0xc081('0x36'),_0xc081('0x75'),'email','internal'],'raw':!![]});}return null;})[_0xc081('0x1c')](function(_0x43cb26){if(!_0x43cb26)return null;_0x4d470f[_0xc081('0x24')][_0xc081('0x62')]=_0x43cb26;return _0x4d470f;})[_0xc081('0x1c')](function(_0x35c93f){if(_0x35c93f){if(_0x5c40c8[_0xc081('0x56')][_0xc081('0x76')]){_0x4d470f[_0xc081('0x24')][_0xc081('0x77')]=util[_0xc081('0x5f')](_0xc081('0x78'),_0x5c40c8[_0xc081('0x61')][_0xc081('0x36')]);_0x4d470f[_0xc081('0x24')][_0xc081('0x79')]=_0x4d470f[_0xc081('0x79')];_0x4d470f[_0xc081('0x24')][_0xc081('0x7a')]=_0x4d470f[_0xc081('0x79')];_0x4d470f[_0xc081('0x24')][_0xc081('0x7b')]='accept';return respondWithRpcPromise(_0xc081('0x7c'),'EventManager',{'event':_0xc081('0x7d'),'message':_0x4d470f[_0xc081('0x24')]},client9002)[_0xc081('0x1c')](function(){return _0x4d470f;});}return _0x4d470f;}return null;})[_0xc081('0x1c')](respondWithResult(_0x3303e5,null))['catch'](handleError(_0x3303e5,null));};var interaction_log=require('../../config/logger')(_0xc081('0x5a'));exports[_0xc081('0x32')]=function(_0x308026,_0x2364a8,_0x3d7328){var _0x5c6d55={'agent':{},'channel':'openchannel'};if(_0x308026['body']['id']){delete _0x308026[_0xc081('0x56')]['id'];}_0x308026['body'][_0xc081('0x60')]=_0x308026[_0xc081('0x56')][_0xc081('0x60')]||_0x308026[_0xc081('0x61')]['id'];_0x5c6d55[_0xc081('0x62')]['id']=_0x308026['body'][_0xc081('0x60')];return db[_0xc081('0x39')][_0xc081('0x57')]({'where':{'id':_0x308026[_0xc081('0x53')]['id'],'UserId':null}})[_0xc081('0x1c')](handleEntityNotFound(_0x2364a8,null))['then'](function(_0x1258ee){if(_0x1258ee){_0x5c6d55[_0xc081('0x24')]=_0x1258ee[_0xc081('0x63')]({'plain':!![]});return db[_0xc081('0x64')]['find']({'where':{'id':_0x1258ee['OpenchannelInteractionId']}});}return null;})[_0xc081('0x1c')](handleEntityNotFound(_0x2364a8,null))[_0xc081('0x1c')](function(_0x2a7420){if(_0x2a7420){_0x5c6d55['interaction']=_0x2a7420[_0xc081('0x63')]({'plain':!![]});interaction_log[_0xc081('0x1d')](_0xc081('0x7e'),_0x308026[_0xc081('0x61')]['id'],_0x308026[_0xc081('0x61')][_0xc081('0x36')],_0x308026['user'][_0xc081('0x6a')],_0x5c6d55[_0xc081('0x6b')]['id'],_0x308026[_0xc081('0x56')]?JSON[_0xc081('0x21')](_0x308026[_0xc081('0x56')]):_0xc081('0x6c'));return respondWithRpcPromise(_0xc081('0x7f'),_0xc081('0x80'),_0x5c6d55);}return null;})[_0xc081('0x1c')](function(_0x1c913b){var _0x2a3f1e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c913b[_0xc081('0x24')][_0xc081('0x81')];return db['sequelize'][_0xc081('0x3e')](_0x2a3f1e,{'type':db[_0xc081('0x71')][_0xc081('0x72')][_0xc081('0x82')],'raw':!![]})[_0xc081('0x1c')](function(_0x5b3c11){return _0x5b3c11;});})[_0xc081('0x1c')](function(_0x129135){if(_0x129135){_0x5c6d55[_0xc081('0x24')]['contact']=_0x129135[0x0];if(!_0x308026['body'][_0xc081('0x60')])return;return db['User']['find']({'where':{'id':_0x308026['body'][_0xc081('0x60')],'role':_0xc081('0x62')},'attributes':['id',_0xc081('0x36'),_0xc081('0x75'),_0xc081('0x83'),'internal'],'raw':!![]});}return null;})[_0xc081('0x1c')](function(_0x3ace77){if(!_0x3ace77)return null;_0x5c6d55[_0xc081('0x24')][_0xc081('0x62')]=_0x3ace77;return _0x5c6d55;})[_0xc081('0x1c')](function(_0x1dafb0){if(_0x1dafb0){_0x1dafb0[_0xc081('0x24')][_0xc081('0x77')]=util['format'](_0xc081('0x78'),_0x308026['user'][_0xc081('0x36')]);_0x1dafb0[_0xc081('0x24')][_0xc081('0x79')]=_0x5c6d55['channel'];_0x1dafb0[_0xc081('0x24')][_0xc081('0x7a')]=_0x5c6d55['channel'];_0x1dafb0[_0xc081('0x24')]['event']=_0xc081('0x32');respondWithRpcPromise(_0xc081('0x7c'),_0xc081('0x7c'),{'event':_0xc081('0x84'),'message':_0x1dafb0[_0xc081('0x24')]},client9002);return _0x5c6d55;}return null;})[_0xc081('0x1c')](respondWithResult(_0x2364a8,null))['catch'](handleError(_0x2364a8,null));}; \ No newline at end of file +var _0xbb1a=['filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','contact','email','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys'];(function(_0x1b69aa,_0x5aa147){var _0x42647d=function(_0x1743fd){while(--_0x1743fd){_0x1b69aa['push'](_0x1b69aa['shift']());}};_0x42647d(++_0x5aa147);}(_0xbb1a,0x14c));var _0xabb1=function(_0x3da921,_0x23b768){_0x3da921=_0x3da921-0x0;var _0x434990=_0xbb1a[_0x3da921];return _0x434990;};'use strict';var emlformat=require(_0xabb1('0x0'));var rimraf=require(_0xabb1('0x1'));var zipdir=require(_0xabb1('0x2'));var jsonpatch=require(_0xabb1('0x3'));var rp=require('request-promise');var moment=require(_0xabb1('0x4'));var BPromise=require(_0xabb1('0x5'));var Mustache=require('mustache');var util=require(_0xabb1('0x6'));var path=require(_0xabb1('0x7'));var sox=require(_0xabb1('0x8'));var csv=require('to-csv');var ejs=require(_0xabb1('0x9'));var fs=require('fs');var fs_extra=require(_0xabb1('0xa'));var _=require(_0xabb1('0xb'));var squel=require(_0xabb1('0xc'));var crypto=require(_0xabb1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xabb1('0xe'));var toCsv=require(_0xabb1('0xf'));var querystring=require(_0xabb1('0x10'));var Papa=require(_0xabb1('0x11'));var Redis=require('ioredis');var authService=require(_0xabb1('0x12'));var qs=require(_0xabb1('0x13'));var as=require(_0xabb1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabb1('0x15'))(_0xabb1('0x16'));var utils=require(_0xabb1('0x17'));var config=require(_0xabb1('0x18'));var licenseUtil=require(_0xabb1('0x19'));var db=require(_0xabb1('0x1a'))['db'];config['redis']=_[_0xabb1('0x1b')](config[_0xabb1('0x1c')],{'host':_0xabb1('0x1d'),'port':0x18eb});var socket=require(_0xabb1('0x1e'))(new Redis(config[_0xabb1('0x1c')]));require('./openchannelMessage.socket')[_0xabb1('0x1f')](socket);var jayson=require(_0xabb1('0x20'));var client=jayson[_0xabb1('0x21')][_0xabb1('0x22')]({'port':0x232c});var client9002=jayson[_0xabb1('0x21')][_0xabb1('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2a66e3,_0x1f4c25,_0x74ae80,_0x487926){return new BPromise(function(_0x41a207,_0x34e136){var _0x456b62=_0x487926||client;return _0x456b62[_0xabb1('0x23')](_0x2a66e3,_0x74ae80)['then'](function(_0x1b079b){logger[_0xabb1('0x24')](_0xabb1('0x25'),_0x1f4c25,_0xabb1('0x26'));logger['debug'](_0xabb1('0x27'),_0x1f4c25,_0xabb1('0x26'),JSON[_0xabb1('0x28')](_0x1b079b));if(_0x1b079b[_0xabb1('0x29')]){if(_0x1b079b[_0xabb1('0x29')][_0xabb1('0x2a')]===0x1f4){logger[_0xabb1('0x29')](_0xabb1('0x25'),_0x1f4c25,_0x1b079b[_0xabb1('0x29')][_0xabb1('0x2b')]);return _0x34e136(_0x1b079b['error']['message']);}logger[_0xabb1('0x29')](_0xabb1('0x25'),_0x1f4c25,_0x1b079b[_0xabb1('0x29')][_0xabb1('0x2b')]);return _0x41a207(_0x1b079b[_0xabb1('0x29')][_0xabb1('0x2b')]);}else{logger[_0xabb1('0x24')](_0xabb1('0x25'),_0x1f4c25,_0xabb1('0x26'));_0x41a207(_0x1b079b[_0xabb1('0x2c')][_0xabb1('0x2b')]);}})['catch'](function(_0x1730bc){logger[_0xabb1('0x29')](_0xabb1('0x25'),_0x1f4c25,_0x1730bc);_0x34e136(_0x1730bc);});});}function respondWithStatusCode(_0x1b9af2,_0x3302f3){_0x3302f3=_0x3302f3||0xcc;return function(_0x39cf3f){if(_0x39cf3f){return _0x1b9af2[_0xabb1('0x2d')](_0x3302f3);}return _0x1b9af2['status'](_0x3302f3)[_0xabb1('0x2e')]();};}function respondWithResult(_0xfd3e6e,_0x25c086){_0x25c086=_0x25c086||0xc8;return function(_0xdad627){if(_0xdad627){return _0xfd3e6e[_0xabb1('0x2f')](_0x25c086)[_0xabb1('0x30')](_0xdad627);}};}function respondWithFilteredResult(_0x5d2560,_0xaea962){return function(_0x542c9a){if(_0x542c9a){var _0x5e14d2=typeof _0xaea962[_0xabb1('0x31')]===_0xabb1('0x32')&&typeof _0xaea962[_0xabb1('0x33')]===_0xabb1('0x32');var _0x18aba0=_0x542c9a['count'];var _0x1c0aa5=_0x5e14d2?0x0:_0xaea962[_0xabb1('0x31')];var _0x33d8d1=_0x5e14d2?_0x542c9a[_0xabb1('0x34')]:_0xaea962['offset']+_0xaea962[_0xabb1('0x33')];var _0x430855;if(_0x33d8d1>=_0x18aba0){_0x33d8d1=_0x18aba0;_0x430855=0xc8;}else{_0x430855=0xce;}_0x5d2560[_0xabb1('0x2f')](_0x430855);return _0x5d2560[_0xabb1('0x35')](_0xabb1('0x36'),_0x1c0aa5+'-'+_0x33d8d1+'/'+_0x18aba0)[_0xabb1('0x30')](_0x542c9a);}return null;};}function patchUpdates(_0x297e0b){return function(_0x4e27a7){try{jsonpatch[_0xabb1('0x37')](_0x4e27a7,_0x297e0b,!![]);}catch(_0x1391be){return BPromise[_0xabb1('0x38')](_0x1391be);}return _0x4e27a7[_0xabb1('0x39')]();};}function saveUpdates(_0x5b4cd8,_0x387e40){return function(_0x381a54){if(_0x381a54){return _0x381a54[_0xabb1('0x3a')](_0x5b4cd8)['then'](function(_0x56a5cb){return _0x56a5cb;});}return null;};}function removeEntity(_0x27a736,_0x2aebf8){return function(_0x34ac8d){if(_0x34ac8d){return _0x34ac8d[_0xabb1('0x3b')]()[_0xabb1('0x3c')](function(){_0x27a736['status'](0xcc)[_0xabb1('0x2e')]();});}};}function handleEntityNotFound(_0x3552fb,_0x37bcd8){return function(_0x1dc8f3){if(!_0x1dc8f3){_0x3552fb[_0xabb1('0x2d')](0x194);}return _0x1dc8f3;};}function handleError(_0x367094,_0x51f113){_0x51f113=_0x51f113||0x1f4;return function(_0x1395f6){logger['error'](_0x1395f6[_0xabb1('0x3d')]);if(_0x1395f6['name']){delete _0x1395f6[_0xabb1('0x3e')];}_0x367094[_0xabb1('0x2f')](_0x51f113)[_0xabb1('0x3f')](_0x1395f6);};}exports[_0xabb1('0x40')]=function(_0x3e0951,_0x1cace4){var _0x2f405f={},_0x3a2aa3={},_0x24ee43={'count':0x0,'rows':[]};var _0x1b5af1=_[_0xabb1('0x41')](db[_0xabb1('0x42')][_0xabb1('0x43')],function(_0x3b1479){return{'name':_0x3b1479[_0xabb1('0x44')],'type':_0x3b1479[_0xabb1('0x45')]['key']};});_0x3a2aa3[_0xabb1('0x46')]=_[_0xabb1('0x41')](_0x1b5af1,_0xabb1('0x3e'));_0x3a2aa3[_0xabb1('0x47')]=_[_0xabb1('0x48')](_0x3e0951[_0xabb1('0x47')]);_0x3a2aa3[_0xabb1('0x49')]=_[_0xabb1('0x4a')](_0x3a2aa3[_0xabb1('0x46')],_0x3a2aa3[_0xabb1('0x47')]);_0x2f405f[_0xabb1('0x4b')]=_[_0xabb1('0x4a')](_0x3a2aa3[_0xabb1('0x46')],qs[_0xabb1('0x4c')](_0x3e0951[_0xabb1('0x47')]['fields']));_0x2f405f['attributes']=_0x2f405f[_0xabb1('0x4b')][_0xabb1('0x4d')]?_0x2f405f['attributes']:_0x3a2aa3['model'];if(!_0x3e0951['query']['hasOwnProperty']('nolimit')){_0x2f405f['limit']=qs[_0xabb1('0x33')](_0x3e0951[_0xabb1('0x47')][_0xabb1('0x33')]);_0x2f405f['offset']=qs[_0xabb1('0x31')](_0x3e0951[_0xabb1('0x47')][_0xabb1('0x31')]);}_0x2f405f['order']=qs[_0xabb1('0x4e')](_0x3e0951['query'][_0xabb1('0x4e')]);_0x2f405f[_0xabb1('0x4f')]=qs[_0xabb1('0x49')](_[_0xabb1('0x50')](_0x3e0951[_0xabb1('0x47')],_0x3a2aa3[_0xabb1('0x49')]),_0x1b5af1);if(_0x3e0951[_0xabb1('0x47')][_0xabb1('0x51')]){_0x2f405f[_0xabb1('0x4f')]=_[_0xabb1('0x52')](_0x2f405f[_0xabb1('0x4f')],{'$or':_[_0xabb1('0x41')](_0x1b5af1,function(_0x3beb62){if(_0x3beb62[_0xabb1('0x45')]!==_0xabb1('0x53')){var _0x11330f={};_0x11330f[_0x3beb62[_0xabb1('0x3e')]]={'$like':'%'+_0x3e0951[_0xabb1('0x47')][_0xabb1('0x51')]+'%'};return _0x11330f;}})});}_0x2f405f=_[_0xabb1('0x52')]({},_0x2f405f,_0x3e0951['options']);var _0x5c8b1a={'where':_0x2f405f[_0xabb1('0x4f')]};return db[_0xabb1('0x42')][_0xabb1('0x34')](_0x5c8b1a)['then'](function(_0x1045df){_0x24ee43[_0xabb1('0x34')]=_0x1045df;if(_0x3e0951[_0xabb1('0x47')][_0xabb1('0x54')]){_0x2f405f[_0xabb1('0x55')]=[{'all':!![]}];}return db[_0xabb1('0x42')][_0xabb1('0x56')](_0x2f405f);})[_0xabb1('0x3c')](function(_0x29e439){_0x24ee43[_0xabb1('0x57')]=_0x29e439;return _0x24ee43;})[_0xabb1('0x3c')](respondWithFilteredResult(_0x1cace4,_0x2f405f))[_0xabb1('0x58')](handleError(_0x1cace4,null));};exports[_0xabb1('0x59')]=function(_0x4022e3,_0x52eb44){var _0x16d209={'raw':!![],'where':{'id':_0x4022e3[_0xabb1('0x5a')]['id']}},_0x134787={};_0x134787[_0xabb1('0x46')]=_[_0xabb1('0x48')](db[_0xabb1('0x42')]['rawAttributes']);_0x134787[_0xabb1('0x47')]=_[_0xabb1('0x48')](_0x4022e3[_0xabb1('0x47')]);_0x134787[_0xabb1('0x49')]=_[_0xabb1('0x4a')](_0x134787[_0xabb1('0x46')],_0x134787[_0xabb1('0x47')]);_0x16d209[_0xabb1('0x4b')]=_[_0xabb1('0x4a')](_0x134787[_0xabb1('0x46')],qs[_0xabb1('0x4c')](_0x4022e3[_0xabb1('0x47')][_0xabb1('0x4c')]));_0x16d209[_0xabb1('0x4b')]=_0x16d209[_0xabb1('0x4b')][_0xabb1('0x4d')]?_0x16d209[_0xabb1('0x4b')]:_0x134787[_0xabb1('0x46')];if(_0x4022e3[_0xabb1('0x47')]['includeAll']){_0x16d209[_0xabb1('0x55')]=[{'all':!![]}];}_0x16d209=_['merge']({},_0x16d209,_0x4022e3[_0xabb1('0x5b')]);return db[_0xabb1('0x42')][_0xabb1('0x5c')](_0x16d209)[_0xabb1('0x3c')](handleEntityNotFound(_0x52eb44,null))[_0xabb1('0x3c')](respondWithResult(_0x52eb44,null))[_0xabb1('0x58')](handleError(_0x52eb44,null));};exports[_0xabb1('0x5d')]=function(_0x52fab4,_0x32b11a){return db[_0xabb1('0x42')][_0xabb1('0x5d')](_0x52fab4['body'],{})[_0xabb1('0x3c')](respondWithResult(_0x32b11a,0xc9))['catch'](handleError(_0x32b11a,null));};exports[_0xabb1('0x3a')]=function(_0x17d49b,_0x585c89){if(_0x17d49b[_0xabb1('0x5e')]['id']){delete _0x17d49b[_0xabb1('0x5e')]['id'];}return db[_0xabb1('0x42')][_0xabb1('0x5c')]({'where':{'id':_0x17d49b['params']['id']}})[_0xabb1('0x3c')](handleEntityNotFound(_0x585c89,null))['then'](saveUpdates(_0x17d49b[_0xabb1('0x5e')],null))[_0xabb1('0x3c')](respondWithResult(_0x585c89,null))[_0xabb1('0x58')](handleError(_0x585c89,null));};exports[_0xabb1('0x3b')]=function(_0x80788f,_0x1ecbea){return db[_0xabb1('0x42')][_0xabb1('0x5c')]({'where':{'id':_0x80788f[_0xabb1('0x5a')]['id']}})[_0xabb1('0x3c')](handleEntityNotFound(_0x1ecbea,null))[_0xabb1('0x3c')](removeEntity(_0x1ecbea,null))[_0xabb1('0x58')](handleError(_0x1ecbea,null));};exports['describe']=function(_0x3ba1ed,_0x188a8e){return db[_0xabb1('0x42')]['describe']()[_0xabb1('0x3c')](respondWithResult(_0x188a8e,null))['catch'](handleError(_0x188a8e,null));};var interaction_log=require(_0xabb1('0x15'))(_0xabb1('0x5f'));exports[_0xabb1('0x60')]=function(_0xe3f973,_0x124d45,_0x4910fb){var _0x4ba5c2={'agent':{},'channel':_0xabb1('0x61')};if(_0xe3f973[_0xabb1('0x5e')]['id']){delete _0xe3f973['body']['id'];}_0xe3f973[_0xabb1('0x5e')]['read']=!![];_0xe3f973[_0xabb1('0x5e')]['readAt']=moment()[_0xabb1('0x62')](_0xabb1('0x63'));_0xe3f973[_0xabb1('0x5e')]['UserId']=_0xe3f973[_0xabb1('0x5e')][_0xabb1('0x64')]||_0xe3f973[_0xabb1('0x65')]['id'];_0x4ba5c2[_0xabb1('0x66')]['id']=_0xe3f973[_0xabb1('0x5e')][_0xabb1('0x64')];return db[_0xabb1('0x42')][_0xabb1('0x5c')]({'where':{'id':_0xe3f973[_0xabb1('0x5a')]['id'],'UserId':null}})[_0xabb1('0x3c')](handleEntityNotFound(_0x124d45,null))[_0xabb1('0x3c')](saveUpdates(_0xe3f973[_0xabb1('0x5e')],null))[_0xabb1('0x3c')](function(_0x246c8d){if(_0x246c8d){_0x4ba5c2['message']=_0x246c8d[_0xabb1('0x67')]({'plain':!![]});return db[_0xabb1('0x68')][_0xabb1('0x5c')]({'where':{'id':_0x246c8d[_0xabb1('0x69')]}});}return null;})[_0xabb1('0x3c')](handleEntityNotFound(_0x124d45,null))[_0xabb1('0x3c')](function(_0x3386c7){if(_0x3386c7){return _0x3386c7[_0xabb1('0x3a')]({'UserId':_0xe3f973[_0xabb1('0x5e')][_0xabb1('0x64')],'read1stAt':_[_0xabb1('0x6a')](_0x3386c7[_0xabb1('0x6b')])?moment()[_0xabb1('0x62')](_0xabb1('0x63')):undefined});}return null;})['then'](function(_0x47ab70){if(_0x47ab70){_0x4ba5c2[_0xabb1('0x6c')]=_0x47ab70[_0xabb1('0x67')]({'plain':!![]});interaction_log[_0xabb1('0x24')](_0xabb1('0x6d'),_0xe3f973[_0xabb1('0x65')]['id'],_0xe3f973[_0xabb1('0x65')]['name'],_0xe3f973[_0xabb1('0x65')][_0xabb1('0x6e')],_0x4ba5c2[_0xabb1('0x6c')]['id'],_0xe3f973[_0xabb1('0x5e')]?JSON['stringify'](_0xe3f973[_0xabb1('0x5e')]):_0xabb1('0x6f'));return respondWithRpcPromise(_0xabb1('0x70'),_0xabb1('0x71'),_0x4ba5c2);}return null;})[_0xabb1('0x3c')](function(_0x301fcf){var _0x467122=_0xabb1('0x72')+_0x301fcf[_0xabb1('0x2b')]['ContactId'];return db[_0xabb1('0x73')]['query'](_0x467122,{'type':db[_0xabb1('0x74')][_0xabb1('0x75')]['SELECT'],'raw':!![]})[_0xabb1('0x3c')](function(_0x14e92f){return _0x14e92f;});})[_0xabb1('0x3c')](function(_0x4d62cb){if(_0x4d62cb){_0x4ba5c2[_0xabb1('0x2b')]['contact']=_0x4d62cb[0x0];if(!_0xe3f973[_0xabb1('0x5e')][_0xabb1('0x64')])return;return db[_0xabb1('0x76')]['find']({'where':{'id':_0xe3f973[_0xabb1('0x5e')]['UserId'],'role':_0xabb1('0x66')},'attributes':['id',_0xabb1('0x3e'),'fullname','email',_0xabb1('0x77')],'raw':!![]});}return null;})[_0xabb1('0x3c')](function(_0x348270){if(!_0x348270)return null;_0x4ba5c2[_0xabb1('0x2b')][_0xabb1('0x66')]=_0x348270;return _0x4ba5c2;})['then'](function(_0x250e5f){if(_0x250e5f){if(_0xe3f973['body'][_0xabb1('0x78')]){_0x4ba5c2[_0xabb1('0x2b')]['interface']=util[_0xabb1('0x62')](_0xabb1('0x79'),_0xe3f973[_0xabb1('0x65')][_0xabb1('0x3e')]);_0x4ba5c2[_0xabb1('0x2b')][_0xabb1('0x7a')]=_0x4ba5c2[_0xabb1('0x7a')];_0x4ba5c2[_0xabb1('0x2b')][_0xabb1('0x7b')]=_0x4ba5c2[_0xabb1('0x7a')];_0x4ba5c2[_0xabb1('0x2b')]['event']='accept';return respondWithRpcPromise('EventManager',_0xabb1('0x7c'),{'event':_0xabb1('0x7d'),'message':_0x4ba5c2['message']},client9002)[_0xabb1('0x3c')](function(){return _0x4ba5c2;});}return _0x4ba5c2;}return null;})[_0xabb1('0x3c')](respondWithResult(_0x124d45,null))[_0xabb1('0x58')](handleError(_0x124d45,null));};var interaction_log=require('../../config/logger')(_0xabb1('0x5f'));exports[_0xabb1('0x38')]=function(_0x13f792,_0x2c8b20,_0x400a15){var _0x3f06ff={'agent':{},'channel':_0xabb1('0x61')};if(_0x13f792['body']['id']){delete _0x13f792['body']['id'];}_0x13f792[_0xabb1('0x5e')][_0xabb1('0x64')]=_0x13f792['body']['UserId']||_0x13f792[_0xabb1('0x65')]['id'];_0x3f06ff[_0xabb1('0x66')]['id']=_0x13f792[_0xabb1('0x5e')][_0xabb1('0x64')];return db[_0xabb1('0x42')]['find']({'where':{'id':_0x13f792[_0xabb1('0x5a')]['id'],'UserId':null}})[_0xabb1('0x3c')](handleEntityNotFound(_0x2c8b20,null))[_0xabb1('0x3c')](function(_0x59c8fc){if(_0x59c8fc){_0x3f06ff['message']=_0x59c8fc['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x59c8fc[_0xabb1('0x69')]}});}return null;})[_0xabb1('0x3c')](handleEntityNotFound(_0x2c8b20,null))['then'](function(_0x4671b4){if(_0x4671b4){_0x3f06ff[_0xabb1('0x6c')]=_0x4671b4[_0xabb1('0x67')]({'plain':!![]});interaction_log[_0xabb1('0x24')](_0xabb1('0x7e'),_0x13f792[_0xabb1('0x65')]['id'],_0x13f792['user']['name'],_0x13f792['user'][_0xabb1('0x6e')],_0x3f06ff[_0xabb1('0x6c')]['id'],_0x13f792[_0xabb1('0x5e')]?JSON['stringify'](_0x13f792[_0xabb1('0x5e')]):_0xabb1('0x6f'));return respondWithRpcPromise(_0xabb1('0x7f'),_0xabb1('0x80'),_0x3f06ff);}return null;})[_0xabb1('0x3c')](function(_0x355fec){var _0x5c5e76=_0xabb1('0x72')+_0x355fec[_0xabb1('0x2b')][_0xabb1('0x81')];return db['sequelize'][_0xabb1('0x47')](_0x5c5e76,{'type':db[_0xabb1('0x74')][_0xabb1('0x75')][_0xabb1('0x82')],'raw':!![]})[_0xabb1('0x3c')](function(_0x1bfd37){return _0x1bfd37;});})[_0xabb1('0x3c')](function(_0x359446){if(_0x359446){_0x3f06ff['message'][_0xabb1('0x83')]=_0x359446[0x0];if(!_0x13f792[_0xabb1('0x5e')]['UserId'])return;return db[_0xabb1('0x76')][_0xabb1('0x5c')]({'where':{'id':_0x13f792[_0xabb1('0x5e')][_0xabb1('0x64')],'role':_0xabb1('0x66')},'attributes':['id','name','fullname',_0xabb1('0x84'),'internal'],'raw':!![]});}return null;})[_0xabb1('0x3c')](function(_0x44f311){if(!_0x44f311)return null;_0x3f06ff[_0xabb1('0x2b')][_0xabb1('0x66')]=_0x44f311;return _0x3f06ff;})['then'](function(_0x41c417){if(_0x41c417){_0x41c417[_0xabb1('0x2b')]['interface']=util['format'](_0xabb1('0x79'),_0x13f792['user'][_0xabb1('0x3e')]);_0x41c417[_0xabb1('0x2b')]['channel']=_0x3f06ff['channel'];_0x41c417[_0xabb1('0x2b')][_0xabb1('0x7b')]=_0x3f06ff['channel'];_0x41c417[_0xabb1('0x2b')][_0xabb1('0x85')]=_0xabb1('0x38');respondWithRpcPromise(_0xabb1('0x7c'),_0xabb1('0x7c'),{'event':_0xabb1('0x86'),'message':_0x41c417[_0xabb1('0x2b')]},client9002);return _0x3f06ff;}return null;})[_0xabb1('0x3c')](respondWithResult(_0x2c8b20,null))[_0xabb1('0x58')](handleError(_0x2c8b20,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index dca20e5..439a885 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 _0x5cd8=['emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5cd8,0xdc));var _0x85cd=function(_0x37cdab,_0x448b95){_0x37cdab=_0x37cdab-0x0;var _0x270df6=_0x5cd8[_0x37cdab];return _0x270df6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x85cd('0x0'))['db'][_0x85cd('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x85cd('0x2'),'afterUpdate':_0x85cd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f45ba){return function(_0x5e74dc,_0x33b9ae,_0x4ece0a){OpenchannelMessageEvents[_0x85cd('0x4')](_0x3f45ba+':'+_0x5e74dc['id'],_0x5e74dc);OpenchannelMessageEvents[_0x85cd('0x4')](_0x3f45ba,_0x5e74dc);_0x4ece0a(null);};}for(var e in events){if(events[_0x85cd('0x5')](e)){var event=events[e];OpenchannelMessage[_0x85cd('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x5992=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','OpenchannelMessage'];(function(_0x4303d0,_0x1dcda4){var _0x1b7196=function(_0x336abd){while(--_0x336abd){_0x4303d0['push'](_0x4303d0['shift']());}};_0x1b7196(++_0x1dcda4);}(_0x5992,0xaf));var _0x2599=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5992[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x2599('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2599('0x1')](0x0);var events={'afterCreate':_0x2599('0x2'),'afterUpdate':'update','afterDestroy':_0x2599('0x3')};function emitEvent(_0x1f7a2f){return function(_0x215ab0,_0xc95d,_0x503067){OpenchannelMessageEvents[_0x2599('0x4')](_0x1f7a2f+':'+_0x215ab0['id'],_0x215ab0);OpenchannelMessageEvents[_0x2599('0x4')](_0x1f7a2f,_0x215ab0);_0x503067(null);};}for(var e in events){if(events[_0x2599('0x5')](e)){var event=events[e];OpenchannelMessage[_0x2599('0x6')](e,emitEvent(event));}}module[_0x2599('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 48f376c..c1032ef 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 _0x9354=['threadId','inspect','finally','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','Contact','POST','method','GET','body'];(function(_0x59ad2b,_0x3353fe){var _0x46f306=function(_0x5ce5de){while(--_0x5ce5de){_0x59ad2b['push'](_0x59ad2b['shift']());}};_0x46f306(++_0x3353fe);}(_0x9354,0x96));var _0x4935=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9354[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[{'name':_0x4935('0xc'),'fields':['body'],'type':_0x4935('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a44f,_0x2aac9a,_0x38de96){var _0xd5b117=_0x2d518a[_0x4935('0xe')];var _0x261462=_0x47a44f[_0x4935('0xf')]({'plain':!![]});if(_0x261462['direction']['toLowerCase']()==='in'||_0x261462[_0x4935('0x10')]['toLowerCase']()==='out'&&!_0x261462[_0x4935('0x11')]&&!_[_0x4935('0x12')](_0x261462[_0x4935('0x13')])){_0xd5b117[_0x4935('0x14')][_0x4935('0x15')]({'where':{'id':_0x261462[_0x4935('0x16')]}})[_0x4935('0x17')](function(_0x3a7c30){if(_0x3a7c30){_0x3a7c30[_0x4935('0x18')]({'lastMsgAt':_0x261462[_0x4935('0x19')],'lastMsgDirection':_0x261462[_0x4935('0x10')][_0x4935('0x1a')]()});}})[_0x4935('0x1b')](function(_0x3652c4){console[_0x4935('0x1c')](_0x3652c4);});}if(_0x261462[_0x4935('0x10')]==='out'&&!_0x261462[_0x4935('0x11')]){var _0x46526a;_0xd5b117[_0x4935('0x1d')][_0x4935('0x1e')]()[_0x4935('0x17')](function(_0x429ef3){return _0xd5b117['OpenchannelAccount'][_0x4935('0x1f')]({'where':{'id':_0x261462[_0x4935('0x20')]},'include':[{'model':_0xd5b117['OpenchannelInteraction'],'as':_0x4935('0x21'),'where':{'id':_0x261462[_0x4935('0x16')]},'limit':0x1,'include':[{'model':_0xd5b117[_0x4935('0x1d')],'as':'Contact','attributes':_['keys'](_0x429ef3)}]}]});})[_0x4935('0x17')](function(_0x6b849f){_0x46526a=_0x6b849f[_0x4935('0xf')]({'plain':!![]});if(_0x46526a&&_0x46526a[_0x4935('0x22')]){logger[_0x4935('0x23')](_0x4935('0x24'),_0x4935('0x25'),util[_0x4935('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x46526a[_0x4935('0x21')]&&_0x46526a[_0x4935('0x21')][_0x4935('0x27')]){_0x261462[_0x4935('0x28')]=_['omit'](_0x46526a['Interactions'][0x0],_0x4935('0x29'));_0x261462[_0x4935('0x29')]=_0x46526a[_0x4935('0x21')][0x0][_0x4935('0x29')];}var _0x2aac9a={'method':_0x4935('0x2a'),'uri':encodeURI(_0x46526a[_0x4935('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2aac9a[_0x4935('0x2b')]){case _0x4935('0x2c'):_0x2aac9a['qs']=_0x261462;break;case _0x4935('0x2a'):_0x2aac9a[_0x4935('0x2d')]=_0x261462;break;}return rp(_0x2aac9a)[_0x4935('0x17')](function(_0x2c47ab){logger[_0x4935('0x23')](_0x4935('0x24'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x2c47ab[_0x4935('0x2d')]['threadId']&&_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]!=_0x261462[_0x4935('0x28')][_0x4935('0x2e')]){return _0xd5b117[_0x4935('0x14')][_0x4935('0x18')]({'threadId':_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]},{'logging':!![],'where':{'id':_0x261462['Interaction']['id']}});}else{return;}})[_0x4935('0x17')](function(){return _0x47a44f[_0x4935('0x18')]({'read':!![]});})['catch'](function(_0x48a289){logger[_0x4935('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x4935('0x25'),util[_0x4935('0x2f')](_0x48a289,{'showHidden':![],'depth':null}));_0x38de96();});}else{_0x38de96();}})[_0x4935('0x30')](function(){_0x38de96();});}else{_0x38de96();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf4f4=['Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','Interaction','threadId','error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId'];(function(_0x48f07b,_0x173bc6){var _0x6d6e92=function(_0x5b4d87){while(--_0x5b4d87){_0x48f07b['push'](_0x48f07b['shift']());}};_0x6d6e92(++_0x173bc6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5b7528,_0x59847a){_0x5b7528=_0x5b7528-0x0;var _0x404df=_0xf4f4[_0x5b7528];return _0x404df;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[{'name':_0x4f4f('0xc'),'fields':[_0x4f4f('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc066a4,_0x38d110,_0x39e36b){var _0x2d86d1=_0x132d5c[_0x4f4f('0xe')];var _0x11940f=_0xc066a4[_0x4f4f('0xf')]({'plain':!![]});if(_0x11940f[_0x4f4f('0x10')]['toLowerCase']()==='in'||_0x11940f['direction'][_0x4f4f('0x11')]()===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]&&!_[_0x4f4f('0x14')](_0x11940f[_0x4f4f('0x15')])){_0x2d86d1[_0x4f4f('0x16')]['findOne']({'where':{'id':_0x11940f[_0x4f4f('0x17')]}})['then'](function(_0x216ba8){if(_0x216ba8){_0x216ba8[_0x4f4f('0x18')]({'lastMsgAt':_0x11940f[_0x4f4f('0x19')],'lastMsgDirection':_0x11940f[_0x4f4f('0x10')]['toLowerCase']()});}})[_0x4f4f('0x1a')](function(_0x4c68f4){console['error'](_0x4c68f4);});}if(_0x11940f['direction']===_0x4f4f('0x12')&&!_0x11940f[_0x4f4f('0x13')]){var _0x2d21ed;_0x2d86d1[_0x4f4f('0x1b')][_0x4f4f('0x1c')]()[_0x4f4f('0x1d')](function(_0x1245c4){return _0x2d86d1[_0x4f4f('0x1e')][_0x4f4f('0x1f')]({'where':{'id':_0x11940f[_0x4f4f('0x20')]},'include':[{'model':_0x2d86d1[_0x4f4f('0x16')],'as':_0x4f4f('0x21'),'where':{'id':_0x11940f['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2d86d1[_0x4f4f('0x1b')],'as':_0x4f4f('0x22'),'attributes':_[_0x4f4f('0x23')](_0x1245c4)}]}]});})[_0x4f4f('0x1d')](function(_0x302a79){_0x2d21ed=_0x302a79[_0x4f4f('0xf')]({'plain':!![]});if(_0x2d21ed&&_0x2d21ed[_0x4f4f('0x24')]){logger[_0x4f4f('0x25')](_0x4f4f('0x26'),_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x29'),_0x11940f['id'],_0x2d21ed[_0x4f4f('0x24')]));if(_0x2d21ed[_0x4f4f('0x21')]&&_0x2d21ed['Interactions']['length']){_0x11940f['Interaction']=_[_0x4f4f('0x2a')](_0x2d21ed[_0x4f4f('0x21')][0x0],'Contact');_0x11940f[_0x4f4f('0x22')]=_0x2d21ed[_0x4f4f('0x21')][0x0][_0x4f4f('0x22')];}var _0x38d110={'method':_0x4f4f('0x2b'),'uri':encodeURI(_0x2d21ed[_0x4f4f('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38d110[_0x4f4f('0x2c')]){case'GET':_0x38d110['qs']=_0x11940f;break;case _0x4f4f('0x2b'):_0x38d110[_0x4f4f('0xd')]=_0x11940f;break;}return rp(_0x38d110)[_0x4f4f('0x1d')](function(_0x15c79c){logger[_0x4f4f('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x4f4f('0x27'),util[_0x4f4f('0x28')](_0x4f4f('0x2d'),_0x11940f['id'],_0x2d21ed['replyUri']));if(_0x15c79c['body']['threadId']&&_0x15c79c[_0x4f4f('0xd')]['threadId']!=_0x11940f[_0x4f4f('0x2e')][_0x4f4f('0x2f')]){return _0x2d86d1[_0x4f4f('0x16')]['update']({'threadId':_0x15c79c[_0x4f4f('0xd')][_0x4f4f('0x2f')]},{'logging':!![],'where':{'id':_0x11940f['Interaction']['id']}});}else{return;}})[_0x4f4f('0x1d')](function(){return _0xc066a4[_0x4f4f('0x18')]({'read':!![]});})[_0x4f4f('0x1a')](function(_0x5b937e){logger[_0x4f4f('0x30')](_0x4f4f('0x26'),'afterCreate',util['inspect'](_0x5b937e,{'showHidden':![],'depth':null}));_0x39e36b();});}else{_0x39e36b();}})[_0x4f4f('0x31')](function(){_0x39e36b();});}else{_0x39e36b();}}},'charset':_0x4f4f('0x32'),'collate':_0x4f4f('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f21ea4c..183b719 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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x169eb6,_0x18bbad){var _0x238a74=function(_0x55c862){while(--_0x55c862){_0x169eb6['push'](_0x169eb6['shift']());}};_0x238a74(++_0x18bbad);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ca4e3,_0x4af7fd){_0x5ca4e3=_0x5ca4e3-0x0;var _0x472282=_0x2ef3[_0x5ca4e3];return _0x472282;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0xb4470b,_0x1e2ba7){var _0x37ba82=function(_0x203c9e){while(--_0x203c9e){_0xb4470b['push'](_0xb4470b['shift']());}};_0x37ba82(++_0x1e2ba7);}(_0x2ef3,0xba));var _0x32ef=function(_0x574e8d,_0x52f383){_0x574e8d=_0x574e8d-0x0;var _0x300923=_0x2ef3[_0x574e8d];return _0x300923;};'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});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7a10f8b..36933e9 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 _0x5d81=['./openchannelMessage.events','save','remove','removeListener','register','length','openchannelMessage:'];(function(_0x24b1ea,_0x642a66){var _0x1eb3b0=function(_0x57c90b){while(--_0x57c90b){_0x24b1ea['push'](_0x24b1ea['shift']());}};_0x1eb3b0(++_0x642a66);}(_0x5d81,0x1c0));var _0x15d8=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x5d81[_0x37ffea];return _0x2e2615;};'use strict';var OpenchannelMessageEvents=require(_0x15d8('0x0'));var events=[_0x15d8('0x1'),_0x15d8('0x2'),'update'];function createListener(_0x3020fb,_0x1efb69){return function(_0x1bb062){_0x1efb69['emit'](_0x3020fb,_0x1bb062);};}function removeListener(_0x3c1ab0,_0x5ab48b){return function(){OpenchannelMessageEvents[_0x15d8('0x3')](_0x3c1ab0,_0x5ab48b);};}exports[_0x15d8('0x4')]=function(_0x2f492f){for(var _0xb9893=0x0,_0x2df2fe=events[_0x15d8('0x5')];_0xb9893<_0x2df2fe;_0xb9893++){var _0x1d39a9=events[_0xb9893];var _0x4ffe89=createListener(_0x15d8('0x6')+_0x1d39a9,_0x2f492f);OpenchannelMessageEvents['on'](_0x1d39a9,_0x4ffe89);}}; \ No newline at end of file +var _0xe170=['openchannelMessage:','./openchannelMessage.events','save','emit','removeListener','register','length'];(function(_0x538117,_0x4cc778){var _0x54f2a8=function(_0x386a23){while(--_0x386a23){_0x538117['push'](_0x538117['shift']());}};_0x54f2a8(++_0x4cc778);}(_0xe170,0x1b3));var _0x0e17=function(_0x2c0ff7,_0x5dd45e){_0x2c0ff7=_0x2c0ff7-0x0;var _0x57742=_0xe170[_0x2c0ff7];return _0x57742;};'use strict';var OpenchannelMessageEvents=require(_0x0e17('0x0'));var events=[_0x0e17('0x1'),'remove','update'];function createListener(_0x4e5bea,_0x5121cf){return function(_0x38ea49){_0x5121cf[_0x0e17('0x2')](_0x4e5bea,_0x38ea49);};}function removeListener(_0x22e4cc,_0x472070){return function(){OpenchannelMessageEvents[_0x0e17('0x3')](_0x22e4cc,_0x472070);};}exports[_0x0e17('0x4')]=function(_0x3a60af){for(var _0x45b182=0x0,_0x4408a6=events[_0x0e17('0x5')];_0x45b182<_0x4408a6;_0x45b182++){var _0x52e7ec=events[_0x45b182];var _0x393324=createListener(_0x0e17('0x6')+_0x52e7ec,_0x3a60af);OpenchannelMessageEvents['on'](_0x52e7ec,_0x393324);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c5efec0..7a2f919 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 _0x899e=['/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x15793d,_0x589fdf){var _0x29fa3b=function(_0x3e75a1){while(--_0x3e75a1){_0x15793d['push'](_0x15793d['shift']());}};_0x29fa3b(++_0x589fdf);}(_0x899e,0xbc));var _0xe899=function(_0x2a5685,_0x268419){_0x2a5685=_0x2a5685-0x0;var _0x5bf29a=_0x899e[_0x2a5685];return _0x5bf29a;};'use strict';var multer=require(_0xe899('0x0'));var util=require(_0xe899('0x1'));var path=require(_0xe899('0x2'));var timeout=require(_0xe899('0x3'));var express=require(_0xe899('0x4'));var router=express[_0xe899('0x5')]();var fs_extra=require(_0xe899('0x6'));var auth=require(_0xe899('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe899('0x8'));var controller=require(_0xe899('0x9'));router['get']('/',auth[_0xe899('0xa')](),controller[_0xe899('0xb')]);router[_0xe899('0xc')](_0xe899('0xd'),auth['isAuthenticated'](),controller[_0xe899('0xe')]);router[_0xe899('0xc')](_0xe899('0xf'),auth[_0xe899('0xa')](),controller['show']);router[_0xe899('0xc')](_0xe899('0x10'),auth[_0xe899('0xa')](),controller['getMembers']);router[_0xe899('0xc')](_0xe899('0x11'),auth[_0xe899('0xa')](),controller[_0xe899('0x12')]);router[_0xe899('0xc')](_0xe899('0x13'),auth[_0xe899('0xa')](),controller[_0xe899('0x14')]);router[_0xe899('0x15')]('/',auth[_0xe899('0xa')](),controller[_0xe899('0x16')]);router[_0xe899('0x15')]('/:id/teams',auth[_0xe899('0xa')](),controller['addTeams']);router[_0xe899('0x15')](_0xe899('0x13'),auth[_0xe899('0xa')](),controller['addAgents']);router[_0xe899('0x17')](_0xe899('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xe899('0x18')](_0xe899('0xf'),auth[_0xe899('0xa')](),controller[_0xe899('0x19')]);router['delete'](_0xe899('0x11'),auth[_0xe899('0xa')](),controller[_0xe899('0x1a')]);router[_0xe899('0x18')](_0xe899('0x13'),auth['isAuthenticated'](),controller[_0xe899('0x1b')]);module[_0xe899('0x1c')]=router; \ No newline at end of file +var _0x61a9=['removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','index','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','/:id'];(function(_0x438b39,_0x4a16f1){var _0x511bfd=function(_0x37ec6e){while(--_0x37ec6e){_0x438b39['push'](_0x438b39['shift']());}};_0x511bfd(++_0x4a16f1);}(_0x61a9,0x1c2));var _0x961a=function(_0x4baa72,_0x42a8ef){_0x4baa72=_0x4baa72-0x0;var _0x1c7abd=_0x61a9[_0x4baa72];return _0x1c7abd;};'use strict';var multer=require(_0x961a('0x0'));var util=require(_0x961a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x961a('0x2'));var router=express[_0x961a('0x3')]();var fs_extra=require(_0x961a('0x4'));var auth=require(_0x961a('0x5'));var interaction=require(_0x961a('0x6'));var config=require('../../config/environment');var controller=require(_0x961a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x961a('0x8')]);router[_0x961a('0x9')](_0x961a('0xa'),auth[_0x961a('0xb')](),controller[_0x961a('0xc')]);router[_0x961a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x961a('0xd')]);router[_0x961a('0x9')](_0x961a('0xe'),auth['isAuthenticated'](),controller[_0x961a('0xf')]);router[_0x961a('0x9')](_0x961a('0x10'),auth[_0x961a('0xb')](),controller['getTeams']);router[_0x961a('0x9')](_0x961a('0x11'),auth['isAuthenticated'](),controller[_0x961a('0x12')]);router[_0x961a('0x13')]('/',auth[_0x961a('0xb')](),controller[_0x961a('0x14')]);router[_0x961a('0x13')](_0x961a('0x10'),auth['isAuthenticated'](),controller[_0x961a('0x15')]);router['post'](_0x961a('0x11'),auth[_0x961a('0xb')](),controller[_0x961a('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x961a('0x17')]);router[_0x961a('0x18')](_0x961a('0x19'),auth[_0x961a('0xb')](),controller['destroy']);router[_0x961a('0x18')](_0x961a('0x10'),auth[_0x961a('0xb')](),controller[_0x961a('0x1a')]);router[_0x961a('0x18')](_0x961a('0x11'),auth[_0x961a('0xb')](),controller[_0x961a('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index df6917b..36aae80 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 _0x0dac=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x24d727,_0x3d60d3){var _0x83a316=function(_0x47f1a1){while(--_0x47f1a1){_0x24d727['push'](_0x24d727['shift']());}};_0x83a316(++_0x3d60d3);}(_0x0dac,0x78));var _0xc0da=function(_0x5da3af,_0x2c7263){_0x5da3af=_0x5da3af-0x0;var _0x15ea67=_0x0dac[_0x5da3af];return _0x15ea67;};'use strict';var Sequelize=require(_0xc0da('0x0'));module['exports']={'name':{'type':Sequelize[_0xc0da('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc0da('0x1')]},'timeout':{'type':Sequelize[_0xc0da('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0da('0x3')](_0xc0da('0x4'),_0xc0da('0x5'),_0xc0da('0x6'))}}; \ No newline at end of file +var _0xdbf5=['name','rrmemory','sequelize'];(function(_0x567e3f,_0x3df761){var _0x3fc825=function(_0x37006e){while(--_0x37006e){_0x567e3f['push'](_0x567e3f['shift']());}};_0x3fc825(++_0x3df761);}(_0xdbf5,0x10a));var _0x5dbf=function(_0x1776d3,_0x5d088a){_0x1776d3=_0x1776d3-0x0;var _0x16da2b=_0xdbf5[_0x1776d3];return _0x16da2b;};'use strict';var Sequelize=require(_0x5dbf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5dbf('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5dbf('0x2'),'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 dc672d6..af7f178 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 _0x6b19=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','send','index','rawAttributes','type','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','name','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','User','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x6b19,0x86));var _0x96b1=function(_0x1a55a7,_0x2466ac){_0x1a55a7=_0x1a55a7-0x0;var _0x12cb2d=_0x6b19[_0x1a55a7];return _0x12cb2d;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require(_0x96b1('0x1'));var zipdir=require(_0x96b1('0x2'));var jsonpatch=require(_0x96b1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require(_0x96b1('0x7'));var sox=require(_0x96b1('0x8'));var csv=require(_0x96b1('0x9'));var ejs=require(_0x96b1('0xa'));var fs=require('fs');var fs_extra=require(_0x96b1('0xb'));var _=require(_0x96b1('0xc'));var squel=require(_0x96b1('0xd'));var crypto=require(_0x96b1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x96b1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0x10'));var Papa=require('papaparse');var Redis=require(_0x96b1('0x11'));var authService=require(_0x96b1('0x12'));var qs=require(_0x96b1('0x13'));var as=require(_0x96b1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96b1('0x15'))('api');var utils=require(_0x96b1('0x16'));var config=require(_0x96b1('0x17'));var licenseUtil=require(_0x96b1('0x18'));var db=require('../../mysqldb')['db'];config[_0x96b1('0x19')]=_[_0x96b1('0x1a')](config[_0x96b1('0x19')],{'host':_0x96b1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96b1('0x19')]));require(_0x96b1('0x1c'))[_0x96b1('0x1d')](socket);function respondWithStatusCode(_0x4fc901,_0x3e333a){_0x3e333a=_0x3e333a||0xcc;return function(_0x1390d3){if(_0x1390d3){return _0x4fc901[_0x96b1('0x1e')](_0x3e333a);}return _0x4fc901[_0x96b1('0x1f')](_0x3e333a)['end']();};}function respondWithResult(_0x73570d,_0x3e7e58){_0x3e7e58=_0x3e7e58||0xc8;return function(_0xb9e12b){if(_0xb9e12b){return _0x73570d[_0x96b1('0x1f')](_0x3e7e58)[_0x96b1('0x20')](_0xb9e12b);}};}function respondWithFilteredResult(_0x1dd95f,_0x2c0a7d){return function(_0x14de81){if(_0x14de81){var _0x19fd80=typeof _0x2c0a7d[_0x96b1('0x21')]===_0x96b1('0x22')&&typeof _0x2c0a7d[_0x96b1('0x23')]===_0x96b1('0x22');var _0x386be3=_0x14de81['count'];var _0x35e541=_0x19fd80?0x0:_0x2c0a7d[_0x96b1('0x21')];var _0x278f07=_0x19fd80?_0x14de81['count']:_0x2c0a7d[_0x96b1('0x21')]+_0x2c0a7d[_0x96b1('0x23')];var _0x4034ba;if(_0x278f07>=_0x386be3){_0x278f07=_0x386be3;_0x4034ba=0xc8;}else{_0x4034ba=0xce;}_0x1dd95f['status'](_0x4034ba);return _0x1dd95f[_0x96b1('0x24')](_0x96b1('0x25'),_0x35e541+'-'+_0x278f07+'/'+_0x386be3)[_0x96b1('0x20')](_0x14de81);}return null;};}function patchUpdates(_0x11d45b){return function(_0x151880){try{jsonpatch[_0x96b1('0x26')](_0x151880,_0x11d45b,!![]);}catch(_0x5f14b9){return BPromise[_0x96b1('0x27')](_0x5f14b9);}return _0x151880[_0x96b1('0x28')]();};}function saveUpdates(_0x551851,_0x36923d){return function(_0x345a9a){if(_0x345a9a){return _0x345a9a[_0x96b1('0x29')](_0x551851)[_0x96b1('0x2a')](function(_0x3b4b61){return _0x3b4b61;});}return null;};}function removeEntity(_0x5cbf19,_0x55b48b){return function(_0x161f5b){if(_0x161f5b){return _0x161f5b[_0x96b1('0x2b')]()[_0x96b1('0x2a')](function(){var _0x1f35da=_0x161f5b[_0x96b1('0x2c')]({'plain':!![]});var _0x34c34c=_0x96b1('0x2d');return db[_0x96b1('0x2e')][_0x96b1('0x2b')]({'where':{'type':_0x34c34c,'resourceId':_0x1f35da['id']}})[_0x96b1('0x2a')](function(){return _0x161f5b;});})[_0x96b1('0x2a')](function(){_0x5cbf19['status'](0xcc)[_0x96b1('0x2f')]();});}};}function handleEntityNotFound(_0x33bef2,_0x270918){return function(_0x428a27){if(!_0x428a27){_0x33bef2[_0x96b1('0x1e')](0x194);}return _0x428a27;};}function handleError(_0x445f6b,_0xa238b6){_0xa238b6=_0xa238b6||0x1f4;return function(_0x79bad5){logger[_0x96b1('0x30')](_0x79bad5['stack']);if(_0x79bad5['name']){delete _0x79bad5['name'];}_0x445f6b[_0x96b1('0x1f')](_0xa238b6)[_0x96b1('0x31')](_0x79bad5);};}exports[_0x96b1('0x32')]=function(_0x39edac,_0x2bb9fa){var _0x5bebe3={},_0x4083d0={},_0x5b37ef={'count':0x0,'rows':[]};var _0x333f9d=_['map'](db['OpenchannelQueue'][_0x96b1('0x33')],function(_0x334dc3){return{'name':_0x334dc3['fieldName'],'type':_0x334dc3[_0x96b1('0x34')][_0x96b1('0x35')]};});_0x4083d0[_0x96b1('0x36')]=_[_0x96b1('0x37')](_0x333f9d,'name');_0x4083d0[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x39edac[_0x96b1('0x38')]);_0x4083d0[_0x96b1('0x3a')]=_['intersection'](_0x4083d0[_0x96b1('0x36')],_0x4083d0[_0x96b1('0x38')]);_0x5bebe3['attributes']=_['intersection'](_0x4083d0[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x39edac[_0x96b1('0x38')]['fields']));_0x5bebe3[_0x96b1('0x3c')]=_0x5bebe3[_0x96b1('0x3c')]['length']?_0x5bebe3['attributes']:_0x4083d0[_0x96b1('0x36')];if(!_0x39edac[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x5bebe3[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x39edac[_0x96b1('0x38')][_0x96b1('0x23')]);_0x5bebe3[_0x96b1('0x21')]=qs['offset'](_0x39edac[_0x96b1('0x38')][_0x96b1('0x21')]);}_0x5bebe3[_0x96b1('0x3f')]=qs[_0x96b1('0x40')](_0x39edac['query'][_0x96b1('0x40')]);_0x5bebe3[_0x96b1('0x41')]=qs[_0x96b1('0x3a')](_[_0x96b1('0x42')](_0x39edac[_0x96b1('0x38')],_0x4083d0[_0x96b1('0x3a')]),_0x333f9d);if(_0x39edac[_0x96b1('0x38')][_0x96b1('0x43')]){_0x5bebe3['where']=_[_0x96b1('0x44')](_0x5bebe3['where'],{'$or':_[_0x96b1('0x37')](_0x333f9d,function(_0xc117f1){if(_0xc117f1[_0x96b1('0x34')]!==_0x96b1('0x45')){var _0x31bbda={};_0x31bbda[_0xc117f1['name']]={'$like':'%'+_0x39edac['query']['filter']+'%'};return _0x31bbda;}})});}_0x5bebe3=_[_0x96b1('0x44')]({},_0x5bebe3,_0x39edac['options']);var _0x264147={'where':_0x5bebe3[_0x96b1('0x41')]};return db[_0x96b1('0x46')][_0x96b1('0x47')](_0x264147)['then'](function(_0x12dc5f){_0x5b37ef[_0x96b1('0x47')]=_0x12dc5f;if(_0x39edac['query'][_0x96b1('0x48')]){_0x5bebe3[_0x96b1('0x49')]=[{'all':!![]}];}return db[_0x96b1('0x46')][_0x96b1('0x4a')](_0x5bebe3);})[_0x96b1('0x2a')](function(_0x4e0bba){_0x5b37ef[_0x96b1('0x4b')]=_0x4e0bba;return _0x5b37ef;})[_0x96b1('0x2a')](respondWithFilteredResult(_0x2bb9fa,_0x5bebe3))[_0x96b1('0x4c')](handleError(_0x2bb9fa,null));};exports[_0x96b1('0x4d')]=function(_0x582903,_0x949301){var _0x217fd7={'raw':!![],'where':{'id':_0x582903[_0x96b1('0x4e')]['id']}},_0x13e8fb={};_0x13e8fb[_0x96b1('0x36')]=_[_0x96b1('0x39')](db[_0x96b1('0x46')][_0x96b1('0x33')]);_0x13e8fb[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x582903[_0x96b1('0x38')]);_0x13e8fb[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x13e8fb['model'],_0x13e8fb['query']);_0x217fd7[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x13e8fb[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x582903[_0x96b1('0x38')][_0x96b1('0x3b')]));_0x217fd7['attributes']=_0x217fd7['attributes'][_0x96b1('0x50')]?_0x217fd7['attributes']:_0x13e8fb[_0x96b1('0x36')];if(_0x582903[_0x96b1('0x38')][_0x96b1('0x48')]){_0x217fd7[_0x96b1('0x49')]=[{'all':!![]}];}_0x217fd7=_[_0x96b1('0x44')]({},_0x217fd7,_0x582903[_0x96b1('0x51')]);return db[_0x96b1('0x46')][_0x96b1('0x52')](_0x217fd7)[_0x96b1('0x2a')](handleEntityNotFound(_0x949301,null))[_0x96b1('0x2a')](respondWithResult(_0x949301,null))[_0x96b1('0x4c')](handleError(_0x949301,null));};exports['create']=function(_0xc26a1d,_0x27b660){return db[_0x96b1('0x46')]['create'](_0xc26a1d[_0x96b1('0x53')],{})[_0x96b1('0x2a')](function(_0x543045){var _0x16da26=_0xc26a1d[_0x96b1('0x54')][_0x96b1('0x2c')]({'plain':!![]});if(!_0x16da26)throw new Error(_0x96b1('0x55'));if(_0x16da26[_0x96b1('0x56')]===_0x96b1('0x54')){var _0x4c1893=_0x543045['get']({'plain':!![]});var _0x392877=_0x96b1('0x2d');return db[_0x96b1('0x57')][_0x96b1('0x52')]({'where':{'name':_0x392877,'userProfileId':_0x16da26[_0x96b1('0x58')]},'raw':!![]})[_0x96b1('0x2a')](function(_0x2dc13f){if(_0x2dc13f&&_0x2dc13f[_0x96b1('0x59')]===0x0){return db[_0x96b1('0x2e')][_0x96b1('0x5a')]({'name':_0x4c1893[_0x96b1('0x5b')],'resourceId':_0x4c1893['id'],'type':_0x2dc13f[_0x96b1('0x5b')],'sectionId':_0x2dc13f['id']},{})['then'](function(){return _0x543045;});}else{return _0x543045;}})[_0x96b1('0x4c')](function(_0x565b78){logger[_0x96b1('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565b78);throw _0x565b78;});}return _0x543045;})[_0x96b1('0x2a')](respondWithResult(_0x27b660,0xc9))[_0x96b1('0x4c')](handleError(_0x27b660,null));};exports['update']=function(_0x594a10,_0x13f32f){if(_0x594a10[_0x96b1('0x53')]['id']){delete _0x594a10[_0x96b1('0x53')]['id'];}return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x594a10[_0x96b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13f32f,null))[_0x96b1('0x2a')](saveUpdates(_0x594a10[_0x96b1('0x53')],null))[_0x96b1('0x2a')](respondWithResult(_0x13f32f,null))['catch'](handleError(_0x13f32f,null));};exports[_0x96b1('0x2b')]=function(_0x8a25db,_0x1d8980){return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x8a25db[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x1d8980,null))[_0x96b1('0x2a')](removeEntity(_0x1d8980,null))[_0x96b1('0x4c')](handleError(_0x1d8980,null));};exports[_0x96b1('0x5c')]=function(_0xe54cd,_0x17b351){return db[_0x96b1('0x46')][_0x96b1('0x5c')]()[_0x96b1('0x2a')](respondWithResult(_0x17b351,null))[_0x96b1('0x4c')](handleError(_0x17b351,null));};exports[_0x96b1('0x5d')]=function(_0x48c4f6,_0x41c525,_0x4e1803){var _0x12493b={'raw':!![],'where':{}},_0x2fb566={},_0x1151cf;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x48c4f6[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x41c525,null))[_0x96b1('0x2a')](function(_0x1970c7){if(_0x1970c7){_0x1151cf=_0x1970c7[_0x96b1('0x2c')]({'plain':!![]});_0x2fb566[_0x96b1('0x36')]=_['keys'](db[_0x96b1('0x5f')]['rawAttributes']);_0x2fb566['query']=_[_0x96b1('0x39')](_0x48c4f6[_0x96b1('0x38')]);_0x2fb566[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x2fb566[_0x96b1('0x36')],_0x2fb566['query']);_0x12493b[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x2fb566[_0x96b1('0x36')],qs['fields'](_0x48c4f6['query'][_0x96b1('0x3b')]));_0x12493b['attributes']=_0x12493b['attributes'][_0x96b1('0x50')]?_0x12493b[_0x96b1('0x3c')]:_0x2fb566[_0x96b1('0x36')];if(!_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x12493b[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x23')]);_0x12493b[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x48c4f6[_0x96b1('0x38')]['offset']);}_0x12493b[_0x96b1('0x3f')]=qs['sort'](_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x40')]);_0x12493b['where']=qs[_0x96b1('0x3a')](_['pick'](_0x48c4f6[_0x96b1('0x38')],_0x2fb566[_0x96b1('0x3a')]));_0x12493b[_0x96b1('0x41')][_0x96b1('0x60')]=_0x1970c7['id'];if(_0x48c4f6[_0x96b1('0x38')]['filter']){_0x12493b[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x12493b[_0x96b1('0x41')],{'$or':_[_0x96b1('0x37')](_0x12493b['attributes'],function(_0x3ee2a1){var _0x1e9833={};_0x1e9833[_0x3ee2a1]={'$like':'%'+_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x43')]+'%'};return _0x1e9833;})});}_0x12493b=_[_0x96b1('0x44')]({},_0x12493b,_0x48c4f6['options']);return db[_0x96b1('0x5f')]['findAll'](_0x12493b);}})['then'](function(_0x22db86){if(_0x22db86){return db['User'][_0x96b1('0x61')]({'where':{'id':_[_0x96b1('0x37')](_0x22db86,'UserId'),'role':'agent'},'attributes':['id',_0x96b1('0x5b'),_0x96b1('0x62'),_0x96b1('0x63'),_0x96b1('0x64')]});}})['then'](function(_0x57337f){if(_0x57337f){return{'count':_0x57337f[_0x96b1('0x47')],'rows':_[_0x96b1('0x37')](_0x57337f['rows'],function(_0x3857db){return{'membername':_0x3857db[_0x96b1('0x5b')],'UserId':_0x3857db['id'],'queue_name':_0x1151cf['name'],'OpenchannelQueueId':_0x1151cf['id'],'interface':util[_0x96b1('0x65')](_0x96b1('0x66'),'SIP',_0x3857db[_0x96b1('0x5b')]),'penalty':0x0,'paused':_0x3857db[_0x96b1('0x62')],'createdAt':_0x3857db[_0x96b1('0x64')],'updatedAt':_0x3857db[_0x96b1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x96b1('0x2a')](respondWithFilteredResult(_0x41c525,_0x12493b))[_0x96b1('0x4c')](handleError(_0x41c525,null));};exports[_0x96b1('0x67')]=function(_0x16a88b,_0x2025d8,_0x4078f3){var _0x36c569={};var _0x5c280e={};var _0x28aa6e;var _0x21b1f1;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x16a88b[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x2025d8,null))[_0x96b1('0x2a')](function(_0xd303a5){if(_0xd303a5){_0x28aa6e=_0xd303a5;_0x5c280e[_0x96b1('0x36')]=_[_0x96b1('0x39')](db[_0x96b1('0x68')]['rawAttributes']);_0x5c280e[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x16a88b[_0x96b1('0x38')]);_0x5c280e[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x5c280e[_0x96b1('0x36')],_0x5c280e[_0x96b1('0x38')]);_0x36c569[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x5c280e[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x16a88b[_0x96b1('0x38')]['fields']));_0x36c569[_0x96b1('0x3c')]=_0x36c569['attributes'][_0x96b1('0x50')]?_0x36c569['attributes']:_0x5c280e[_0x96b1('0x36')];_0x36c569['order']=qs[_0x96b1('0x40')](_0x16a88b[_0x96b1('0x38')]['sort']);_0x36c569[_0x96b1('0x41')]=qs['filters'](_[_0x96b1('0x42')](_0x16a88b[_0x96b1('0x38')],_0x5c280e['filters']));if(_0x16a88b['query'][_0x96b1('0x43')]){_0x36c569[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x36c569[_0x96b1('0x41')],{'$or':_[_0x96b1('0x37')](_0x36c569[_0x96b1('0x3c')],function(_0x540545){var _0x349ae2={};_0x349ae2[_0x540545]={'$like':'%'+_0x16a88b[_0x96b1('0x38')]['filter']+'%'};return _0x349ae2;})});}_0x36c569=_[_0x96b1('0x44')]({},_0x36c569,_0x16a88b[_0x96b1('0x51')]);return _0x28aa6e[_0x96b1('0x67')](_0x36c569);}})[_0x96b1('0x2a')](function(_0x2ca36b){if(_0x2ca36b){_0x21b1f1=_0x2ca36b[_0x96b1('0x50')];if(!_0x16a88b['query'][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x36c569[_0x96b1('0x23')]=qs['limit'](_0x16a88b[_0x96b1('0x38')][_0x96b1('0x23')]);_0x36c569[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x16a88b[_0x96b1('0x38')][_0x96b1('0x21')]);}return _0x28aa6e[_0x96b1('0x67')](_0x36c569);}})[_0x96b1('0x2a')](function(_0x5d8d88){if(_0x5d8d88){return _0x5d8d88?{'count':_0x21b1f1,'rows':_0x5d8d88}:null;}})['then'](respondWithResult(_0x2025d8,null))[_0x96b1('0x4c')](handleError(_0x2025d8,null));};exports[_0x96b1('0x69')]=function(_0x43d2b1,_0x3604c9,_0x93f510){var _0x27f45a=_0x43d2b1[_0x96b1('0x53')][_0x96b1('0x6a')];return db[_0x96b1('0x68')][_0x96b1('0x4a')]({'where':{'id':_0x27f45a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x96b1('0x5b'),_0x96b1('0x6b'),_0x96b1('0x6c'),_0x96b1('0x6d')],'raw':!![]}]})[_0x96b1('0x2a')](function(_0x249c4a){if(_0x249c4a){var _0x56d86a=_[_0x96b1('0x6e')](_0x249c4a,function(_0x5336f4){var _0x2f419c=_0x5336f4[_0x96b1('0x2c')]({'plain':!![]});return _0x2f419c[_0x96b1('0x6f')];});return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x43d2b1[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](function(_0x3fa275){return db[_0x96b1('0x70')][_0x96b1('0x71')](function(_0x23c797){return _0x3fa275[_0x96b1('0x69')](_0x27f45a,{'transaction':_0x23c797})['then'](function(){return BPromise[_0x96b1('0x72')](_0x56d86a,function(_0x35f01d){return db[_0x96b1('0x5f')][_0x96b1('0x73')]({'where':{'UserId':_0x35f01d['id'],'OpenchannelQueueId':_0x43d2b1[_0x96b1('0x4e')]['id']},'transaction':_0x23c797});});})[_0x96b1('0x2a')](function(){_0x56d86a[_0x96b1('0x74')](function(_0x487d30){socket[_0x96b1('0x75')](_0x96b1('0x76'),{'UserId':_0x487d30['id'],'OpenchannelQueueId':_0x3fa275['id']});});});});});}})[_0x96b1('0x2a')](respondWithStatusCode(_0x3604c9,null))[_0x96b1('0x4c')](handleError(_0x3604c9,null));};exports['removeTeams']=function(_0x29184b,_0x3642ce,_0x42bbfb){return db[_0x96b1('0x68')][_0x96b1('0x4a')]({'where':{'id':_0x29184b[_0x96b1('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x96b1('0x77')],'as':_0x96b1('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x96b1('0x2a')](handleEntityNotFound(_0x3642ce,null))[_0x96b1('0x2a')](function(_0x48f622){var _0x3efe71=_[_0x96b1('0x37')](_0x48f622,'id');var _0x22edc4=[];var _0x4a9f14=[];var _0x1a66e5=squel[_0x96b1('0x78')]();_0x1a66e5[_0x96b1('0x79')](_0x96b1('0x7a'))[_0x96b1('0x7b')]('team_has_openchannel_queues','tq')['join'](_0x96b1('0x7c'),'ut',_0x96b1('0x7d'))['where'](_0x96b1('0x7e'),_0x29184b[_0x96b1('0x4e')]['id']);for(var _0x9f663c=0x0;_0x9f663c<_0x48f622['length'];_0x9f663c+=0x1){let _0x3d5777=_0x48f622[_0x9f663c];for(var _0x58cb9d=0x0;_0x58cb9d<_0x3d5777['Agents'][_0x96b1('0x50')];_0x58cb9d+=0x1){let _0x3d9e33=_0x3d5777[_0x96b1('0x6f')][_0x58cb9d];var _0x1e2058=_0x1a66e5[_0x96b1('0x7f')]();_0x1e2058[_0x96b1('0x41')](_0x96b1('0x80'),_0x3d9e33['id']);_0x4a9f14[_0x96b1('0x81')](db[_0x96b1('0x70')][_0x96b1('0x38')](_0x1e2058[_0x96b1('0x82')](),{'type':db[_0x96b1('0x70')]['QueryTypes'][_0x96b1('0x83')]})[_0x96b1('0x2a')](function(_0x4268b7){if(_0x4268b7[_0x96b1('0x50')]===0x1){return _0x3d9e33['id'];}else{var _0x3b40a1=_['every'](_[_0x96b1('0x37')](_0x4268b7,'TeamId'),function(_0x4714c0){return _['includes'](_0x3efe71,_0x4714c0);});if(_0x3b40a1){return _0x3d9e33['id'];}}}));}}return BPromise[_0x96b1('0x84')](_0x4a9f14)[_0x96b1('0x2a')](function(_0x1087b7){_0x22edc4=_(_0x22edc4)[_0x96b1('0x85')](_0x1087b7)[_0x96b1('0x86')]()['value']();return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x29184b[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](function(_0xf19c45){return db['sequelize'][_0x96b1('0x71')](function(_0x4716a8){return _0xf19c45[_0x96b1('0x87')](_0x29184b['query'][_0x96b1('0x6a')],{'transaction':_0x4716a8})[_0x96b1('0x2a')](function(){if(!_[_0x96b1('0x88')](_0x22edc4)){return _0xf19c45[_0x96b1('0x89')](_0x22edc4,{'transaction':_0x4716a8});}})['then'](function(){_0x22edc4[_0x96b1('0x74')](function(_0x4d69e9){socket[_0x96b1('0x75')](_0x96b1('0x8a'),{'UserId':_0x4d69e9,'OpenchannelQueueId':_0xf19c45['id']});});});});});});})['then'](respondWithStatusCode(_0x3642ce,null))[_0x96b1('0x4c')](handleError(_0x3642ce,null));};exports[_0x96b1('0x8b')]=function(_0x5cc8c4,_0x312934,_0x5033aa){return db['OpenchannelQueue'][_0x96b1('0x52')]({'where':{'id':_0x5cc8c4[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x312934,null))[_0x96b1('0x2a')](function(_0x1c008c){if(_0x1c008c){return _0x1c008c[_0x96b1('0x8b')](_0x5cc8c4['body'][_0x96b1('0x6a')],_[_0x96b1('0x8c')](_0x5cc8c4[_0x96b1('0x53')],[_0x96b1('0x6a'),'id'])||{})[_0x96b1('0x8d')](function(_0x23e449){for(var _0x302aff=0x0;_0x302aff<_0x5cc8c4[_0x96b1('0x53')][_0x96b1('0x6a')]['length'];_0x302aff+=0x1){socket[_0x96b1('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x5cc8c4['body'][_0x96b1('0x6a')][_0x302aff]),'OpenchannelQueueId':Number(_0x5cc8c4[_0x96b1('0x4e')]['id'])});}return _0x23e449;});}})[_0x96b1('0x2a')](respondWithResult(_0x312934,null))[_0x96b1('0x4c')](handleError(_0x312934,null));};exports[_0x96b1('0x89')]=function(_0x3a09f4,_0x453e25,_0x4699b4){return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x3a09f4[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x453e25,null))[_0x96b1('0x2a')](function(_0x4029c9){if(_0x4029c9){return _0x4029c9[_0x96b1('0x89')](_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')])[_0x96b1('0x2a')](function(){if(_['isArray'](_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')])){for(var _0x25b59b=0x0;_0x25b59b<_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')]['length'];_0x25b59b+=0x1){socket['emit'](_0x96b1('0x8a'),{'UserId':Number(_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')][_0x25b59b]),'OpenchannelQueueId':Number(_0x3a09f4['params']['id'])});}}else{socket[_0x96b1('0x75')](_0x96b1('0x8a'),{'UserId':Number(_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')]),'OpenchannelQueueId':Number(_0x3a09f4[_0x96b1('0x4e')]['id'])});}});}})[_0x96b1('0x2a')](respondWithStatusCode(_0x453e25,null))[_0x96b1('0x4c')](handleError(_0x453e25,null));};exports[_0x96b1('0x8e')]=function(_0x4051ba,_0x360353,_0x505084){var _0x5f4cc6={};var _0xa201e2={};var _0x4dec12;var _0x365b15;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x4051ba[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x360353,null))[_0x96b1('0x2a')](function(_0x2a3c1d){if(_0x2a3c1d){_0x4dec12=_0x2a3c1d;_0xa201e2['model']=_[_0x96b1('0x39')](db[_0x96b1('0x77')][_0x96b1('0x33')]);_0xa201e2[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x4051ba[_0x96b1('0x38')]);_0xa201e2[_0x96b1('0x3a')]=_['intersection'](_0xa201e2[_0x96b1('0x36')],_0xa201e2[_0x96b1('0x38')]);_0x5f4cc6[_0x96b1('0x3c')]=_['intersection'](_0xa201e2['model'],qs[_0x96b1('0x3b')](_0x4051ba[_0x96b1('0x38')][_0x96b1('0x3b')]));_0x5f4cc6['attributes']=_0x5f4cc6[_0x96b1('0x3c')][_0x96b1('0x50')]?_0x5f4cc6['attributes']:_0xa201e2['model'];_0x5f4cc6[_0x96b1('0x3f')]=qs[_0x96b1('0x40')](_0x4051ba[_0x96b1('0x38')]['sort']);_0x5f4cc6[_0x96b1('0x41')]=qs['filters'](_[_0x96b1('0x42')](_0x4051ba[_0x96b1('0x38')],_0xa201e2['filters']));if(_0x4051ba[_0x96b1('0x38')][_0x96b1('0x43')]){_0x5f4cc6[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x5f4cc6['where'],{'$or':_[_0x96b1('0x37')](_0x5f4cc6[_0x96b1('0x3c')],function(_0x24ab17){var _0x57c415={};_0x57c415[_0x24ab17]={'$like':'%'+_0x4051ba[_0x96b1('0x38')][_0x96b1('0x43')]+'%'};return _0x57c415;})});}_0x5f4cc6=_[_0x96b1('0x44')]({},_0x5f4cc6,_0x4051ba['options']);return _0x4dec12[_0x96b1('0x8e')](_0x5f4cc6);}})['then'](function(_0x175105){if(_0x175105){_0x365b15=_0x175105[_0x96b1('0x50')];if(!_0x4051ba[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x5f4cc6[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x4051ba['query'][_0x96b1('0x23')]);_0x5f4cc6[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x4051ba[_0x96b1('0x38')][_0x96b1('0x21')]);}return _0x4dec12[_0x96b1('0x8e')](_0x5f4cc6);}})['then'](function(_0x47ea24){if(_0x47ea24){return _0x47ea24?{'count':_0x365b15,'rows':_0x47ea24}:null;}})[_0x96b1('0x2a')](respondWithResult(_0x360353,null))[_0x96b1('0x4c')](handleError(_0x360353,null));}; \ No newline at end of file +var _0xd0f7=['../../config/license/util','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','OpenchannelQueue','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMembers','UserOpenchannelQueue','sort','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','Team','pick','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','select','field','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xd0f7,0x78));var _0x7d0f=function(_0x184d50,_0xd03f9a){_0x184d50=_0x184d50-0x0;var _0x3653fd=_0xd0f7[_0x184d50];return _0x3653fd;};'use strict';var emlformat=require(_0x7d0f('0x0'));var rimraf=require(_0x7d0f('0x1'));var zipdir=require(_0x7d0f('0x2'));var jsonpatch=require(_0x7d0f('0x3'));var rp=require(_0x7d0f('0x4'));var moment=require('moment');var BPromise=require(_0x7d0f('0x5'));var Mustache=require(_0x7d0f('0x6'));var util=require(_0x7d0f('0x7'));var path=require(_0x7d0f('0x8'));var sox=require(_0x7d0f('0x9'));var csv=require(_0x7d0f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d0f('0xb'));var _=require(_0x7d0f('0xc'));var squel=require(_0x7d0f('0xd'));var crypto=require(_0x7d0f('0xe'));var jsforce=require(_0x7d0f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7d0f('0xa'));var querystring=require(_0x7d0f('0x10'));var Papa=require(_0x7d0f('0x11'));var Redis=require(_0x7d0f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7d0f('0x13'));var as=require(_0x7d0f('0x14'));var hardwareService=require(_0x7d0f('0x15'));var logger=require('../../config/logger')(_0x7d0f('0x16'));var utils=require(_0x7d0f('0x17'));var config=require(_0x7d0f('0x18'));var licenseUtil=require(_0x7d0f('0x19'));var db=require(_0x7d0f('0x1a'))['db'];config[_0x7d0f('0x1b')]=_['defaults'](config[_0x7d0f('0x1b')],{'host':_0x7d0f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d0f('0x1b')]));require(_0x7d0f('0x1d'))[_0x7d0f('0x1e')](socket);function respondWithStatusCode(_0x3a9dda,_0x555d69){_0x555d69=_0x555d69||0xcc;return function(_0x3c061f){if(_0x3c061f){return _0x3a9dda[_0x7d0f('0x1f')](_0x555d69);}return _0x3a9dda['status'](_0x555d69)[_0x7d0f('0x20')]();};}function respondWithResult(_0x4cb57b,_0x9c4c9a){_0x9c4c9a=_0x9c4c9a||0xc8;return function(_0x230737){if(_0x230737){return _0x4cb57b['status'](_0x9c4c9a)[_0x7d0f('0x21')](_0x230737);}};}function respondWithFilteredResult(_0x54ae78,_0x13f1a6){return function(_0x14e3a3){if(_0x14e3a3){var _0x2ae823=typeof _0x13f1a6[_0x7d0f('0x22')]===_0x7d0f('0x23')&&typeof _0x13f1a6[_0x7d0f('0x24')]==='undefined';var _0x4b1a62=_0x14e3a3[_0x7d0f('0x25')];var _0x8f1648=_0x2ae823?0x0:_0x13f1a6[_0x7d0f('0x22')];var _0x28787c=_0x2ae823?_0x14e3a3['count']:_0x13f1a6[_0x7d0f('0x22')]+_0x13f1a6['limit'];var _0x1765cc;if(_0x28787c>=_0x4b1a62){_0x28787c=_0x4b1a62;_0x1765cc=0xc8;}else{_0x1765cc=0xce;}_0x54ae78[_0x7d0f('0x26')](_0x1765cc);return _0x54ae78[_0x7d0f('0x27')](_0x7d0f('0x28'),_0x8f1648+'-'+_0x28787c+'/'+_0x4b1a62)['json'](_0x14e3a3);}return null;};}function patchUpdates(_0x18b6b8){return function(_0x106d87){try{jsonpatch['apply'](_0x106d87,_0x18b6b8,!![]);}catch(_0x32a38a){return BPromise[_0x7d0f('0x29')](_0x32a38a);}return _0x106d87[_0x7d0f('0x2a')]();};}function saveUpdates(_0x1f9fa1,_0x446f33){return function(_0xf0507){if(_0xf0507){return _0xf0507[_0x7d0f('0x2b')](_0x1f9fa1)[_0x7d0f('0x2c')](function(_0x375733){return _0x375733;});}return null;};}function removeEntity(_0x924001,_0x1c8d05){return function(_0x59498d){if(_0x59498d){return _0x59498d[_0x7d0f('0x2d')]()[_0x7d0f('0x2c')](function(){var _0xcebc96=_0x59498d[_0x7d0f('0x2e')]({'plain':!![]});var _0x3848a6=_0x7d0f('0x2f');return db[_0x7d0f('0x30')][_0x7d0f('0x2d')]({'where':{'type':_0x3848a6,'resourceId':_0xcebc96['id']}})[_0x7d0f('0x2c')](function(){return _0x59498d;});})[_0x7d0f('0x2c')](function(){_0x924001[_0x7d0f('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x164653,_0x38244d){return function(_0x71e588){if(!_0x71e588){_0x164653[_0x7d0f('0x1f')](0x194);}return _0x71e588;};}function handleError(_0x87d84d,_0x364cd9){_0x364cd9=_0x364cd9||0x1f4;return function(_0x23dbd5){logger['error'](_0x23dbd5[_0x7d0f('0x31')]);if(_0x23dbd5[_0x7d0f('0x32')]){delete _0x23dbd5[_0x7d0f('0x32')];}_0x87d84d[_0x7d0f('0x26')](_0x364cd9)[_0x7d0f('0x33')](_0x23dbd5);};}exports[_0x7d0f('0x34')]=function(_0x9a06a3,_0x36bf68){var _0x37af9a={},_0xdafacb={},_0x10af00={'count':0x0,'rows':[]};var _0x315ddc=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x228a51){return{'name':_0x228a51[_0x7d0f('0x35')],'type':_0x228a51[_0x7d0f('0x36')][_0x7d0f('0x37')]};});_0xdafacb[_0x7d0f('0x38')]=_[_0x7d0f('0x39')](_0x315ddc,_0x7d0f('0x32'));_0xdafacb[_0x7d0f('0x3a')]=_[_0x7d0f('0x3b')](_0x9a06a3[_0x7d0f('0x3a')]);_0xdafacb[_0x7d0f('0x3c')]=_['intersection'](_0xdafacb[_0x7d0f('0x38')],_0xdafacb['query']);_0x37af9a[_0x7d0f('0x3d')]=_[_0x7d0f('0x3e')](_0xdafacb['model'],qs['fields'](_0x9a06a3['query'][_0x7d0f('0x3f')]));_0x37af9a[_0x7d0f('0x3d')]=_0x37af9a[_0x7d0f('0x3d')][_0x7d0f('0x40')]?_0x37af9a['attributes']:_0xdafacb[_0x7d0f('0x38')];if(!_0x9a06a3[_0x7d0f('0x3a')][_0x7d0f('0x41')](_0x7d0f('0x42'))){_0x37af9a[_0x7d0f('0x24')]=qs['limit'](_0x9a06a3[_0x7d0f('0x3a')]['limit']);_0x37af9a['offset']=qs[_0x7d0f('0x22')](_0x9a06a3[_0x7d0f('0x3a')]['offset']);}_0x37af9a[_0x7d0f('0x43')]=qs['sort'](_0x9a06a3[_0x7d0f('0x3a')]['sort']);_0x37af9a[_0x7d0f('0x44')]=qs[_0x7d0f('0x3c')](_['pick'](_0x9a06a3[_0x7d0f('0x3a')],_0xdafacb[_0x7d0f('0x3c')]),_0x315ddc);if(_0x9a06a3[_0x7d0f('0x3a')][_0x7d0f('0x45')]){_0x37af9a[_0x7d0f('0x44')]=_['merge'](_0x37af9a['where'],{'$or':_[_0x7d0f('0x39')](_0x315ddc,function(_0x2e343f){if(_0x2e343f[_0x7d0f('0x36')]!==_0x7d0f('0x46')){var _0x267a89={};_0x267a89[_0x2e343f[_0x7d0f('0x32')]]={'$like':'%'+_0x9a06a3[_0x7d0f('0x3a')]['filter']+'%'};return _0x267a89;}})});}_0x37af9a=_[_0x7d0f('0x47')]({},_0x37af9a,_0x9a06a3['options']);var _0x1afcf2={'where':_0x37af9a[_0x7d0f('0x44')]};return db['OpenchannelQueue'][_0x7d0f('0x25')](_0x1afcf2)[_0x7d0f('0x2c')](function(_0x289a65){_0x10af00[_0x7d0f('0x25')]=_0x289a65;if(_0x9a06a3[_0x7d0f('0x3a')][_0x7d0f('0x48')]){_0x37af9a[_0x7d0f('0x49')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x7d0f('0x4a')](_0x37af9a);})['then'](function(_0xb07061){_0x10af00[_0x7d0f('0x4b')]=_0xb07061;return _0x10af00;})['then'](respondWithFilteredResult(_0x36bf68,_0x37af9a))[_0x7d0f('0x4c')](handleError(_0x36bf68,null));};exports[_0x7d0f('0x4d')]=function(_0x16f472,_0x3a2a87){var _0x495e50={'raw':!![],'where':{'id':_0x16f472[_0x7d0f('0x4e')]['id']}},_0x55f4b8={};_0x55f4b8[_0x7d0f('0x38')]=_['keys'](db[_0x7d0f('0x4f')][_0x7d0f('0x50')]);_0x55f4b8[_0x7d0f('0x3a')]=_[_0x7d0f('0x3b')](_0x16f472['query']);_0x55f4b8[_0x7d0f('0x3c')]=_[_0x7d0f('0x3e')](_0x55f4b8['model'],_0x55f4b8[_0x7d0f('0x3a')]);_0x495e50[_0x7d0f('0x3d')]=_['intersection'](_0x55f4b8['model'],qs['fields'](_0x16f472[_0x7d0f('0x3a')][_0x7d0f('0x3f')]));_0x495e50[_0x7d0f('0x3d')]=_0x495e50['attributes'][_0x7d0f('0x40')]?_0x495e50['attributes']:_0x55f4b8[_0x7d0f('0x38')];if(_0x16f472['query'][_0x7d0f('0x48')]){_0x495e50['include']=[{'all':!![]}];}_0x495e50=_['merge']({},_0x495e50,_0x16f472[_0x7d0f('0x51')]);return db[_0x7d0f('0x4f')][_0x7d0f('0x52')](_0x495e50)['then'](handleEntityNotFound(_0x3a2a87,null))[_0x7d0f('0x2c')](respondWithResult(_0x3a2a87,null))[_0x7d0f('0x4c')](handleError(_0x3a2a87,null));};exports[_0x7d0f('0x53')]=function(_0x113d4b,_0x8dfc82){return db['OpenchannelQueue'][_0x7d0f('0x53')](_0x113d4b[_0x7d0f('0x54')],{})[_0x7d0f('0x2c')](function(_0x33d900){var _0x4f9b34=_0x113d4b[_0x7d0f('0x55')][_0x7d0f('0x2e')]({'plain':!![]});if(!_0x4f9b34)throw new Error(_0x7d0f('0x56'));if(_0x4f9b34[_0x7d0f('0x57')]===_0x7d0f('0x55')){var _0x28e006=_0x33d900[_0x7d0f('0x2e')]({'plain':!![]});var _0x19c937=_0x7d0f('0x2f');return db[_0x7d0f('0x58')][_0x7d0f('0x52')]({'where':{'name':_0x19c937,'userProfileId':_0x4f9b34[_0x7d0f('0x59')]},'raw':!![]})['then'](function(_0x5ced66){if(_0x5ced66&&_0x5ced66[_0x7d0f('0x5a')]===0x0){return db['UserProfileResource'][_0x7d0f('0x53')]({'name':_0x28e006['name'],'resourceId':_0x28e006['id'],'type':_0x5ced66[_0x7d0f('0x32')],'sectionId':_0x5ced66['id']},{})[_0x7d0f('0x2c')](function(){return _0x33d900;});}else{return _0x33d900;}})['catch'](function(_0x4ef08c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ef08c);throw _0x4ef08c;});}return _0x33d900;})[_0x7d0f('0x2c')](respondWithResult(_0x8dfc82,0xc9))[_0x7d0f('0x4c')](handleError(_0x8dfc82,null));};exports[_0x7d0f('0x2b')]=function(_0x58853e,_0x233ac8){if(_0x58853e['body']['id']){delete _0x58853e[_0x7d0f('0x54')]['id'];}return db[_0x7d0f('0x4f')][_0x7d0f('0x52')]({'where':{'id':_0x58853e[_0x7d0f('0x4e')]['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0x233ac8,null))[_0x7d0f('0x2c')](saveUpdates(_0x58853e['body'],null))['then'](respondWithResult(_0x233ac8,null))[_0x7d0f('0x4c')](handleError(_0x233ac8,null));};exports[_0x7d0f('0x2d')]=function(_0x3c5050,_0x567dad){return db[_0x7d0f('0x4f')]['find']({'where':{'id':_0x3c5050['params']['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0x567dad,null))['then'](removeEntity(_0x567dad,null))[_0x7d0f('0x4c')](handleError(_0x567dad,null));};exports['describe']=function(_0x2fe39b,_0x378625){return db[_0x7d0f('0x4f')]['describe']()[_0x7d0f('0x2c')](respondWithResult(_0x378625,null))[_0x7d0f('0x4c')](handleError(_0x378625,null));};exports[_0x7d0f('0x5b')]=function(_0x1d11b,_0x503158,_0x2b4544){var _0xcc72aa={'raw':!![],'where':{}},_0x7f69fa={},_0x30e0c9;return db[_0x7d0f('0x4f')]['findOne']({'where':{'id':_0x1d11b[_0x7d0f('0x4e')]['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0x503158,null))['then'](function(_0x5f2894){if(_0x5f2894){_0x30e0c9=_0x5f2894['get']({'plain':!![]});_0x7f69fa[_0x7d0f('0x38')]=_[_0x7d0f('0x3b')](db[_0x7d0f('0x5c')][_0x7d0f('0x50')]);_0x7f69fa['query']=_['keys'](_0x1d11b[_0x7d0f('0x3a')]);_0x7f69fa[_0x7d0f('0x3c')]=_[_0x7d0f('0x3e')](_0x7f69fa['model'],_0x7f69fa[_0x7d0f('0x3a')]);_0xcc72aa[_0x7d0f('0x3d')]=_['intersection'](_0x7f69fa['model'],qs[_0x7d0f('0x3f')](_0x1d11b[_0x7d0f('0x3a')][_0x7d0f('0x3f')]));_0xcc72aa[_0x7d0f('0x3d')]=_0xcc72aa[_0x7d0f('0x3d')]['length']?_0xcc72aa['attributes']:_0x7f69fa[_0x7d0f('0x38')];if(!_0x1d11b[_0x7d0f('0x3a')]['hasOwnProperty'](_0x7d0f('0x42'))){_0xcc72aa[_0x7d0f('0x24')]=qs[_0x7d0f('0x24')](_0x1d11b[_0x7d0f('0x3a')][_0x7d0f('0x24')]);_0xcc72aa[_0x7d0f('0x22')]=qs['offset'](_0x1d11b[_0x7d0f('0x3a')][_0x7d0f('0x22')]);}_0xcc72aa[_0x7d0f('0x43')]=qs[_0x7d0f('0x5d')](_0x1d11b['query']['sort']);_0xcc72aa[_0x7d0f('0x44')]=qs[_0x7d0f('0x3c')](_['pick'](_0x1d11b[_0x7d0f('0x3a')],_0x7f69fa['filters']));_0xcc72aa[_0x7d0f('0x44')][_0x7d0f('0x5e')]=_0x5f2894['id'];if(_0x1d11b[_0x7d0f('0x3a')][_0x7d0f('0x45')]){_0xcc72aa[_0x7d0f('0x44')]=_[_0x7d0f('0x47')](_0xcc72aa[_0x7d0f('0x44')],{'$or':_[_0x7d0f('0x39')](_0xcc72aa[_0x7d0f('0x3d')],function(_0x5b4ef9){var _0x10c94b={};_0x10c94b[_0x5b4ef9]={'$like':'%'+_0x1d11b[_0x7d0f('0x3a')][_0x7d0f('0x45')]+'%'};return _0x10c94b;})});}_0xcc72aa=_[_0x7d0f('0x47')]({},_0xcc72aa,_0x1d11b[_0x7d0f('0x51')]);return db[_0x7d0f('0x5c')][_0x7d0f('0x4a')](_0xcc72aa);}})[_0x7d0f('0x2c')](function(_0x3e8882){if(_0x3e8882){return db[_0x7d0f('0x5f')][_0x7d0f('0x60')]({'where':{'id':_[_0x7d0f('0x39')](_0x3e8882,_0x7d0f('0x61')),'role':_0x7d0f('0x62')},'attributes':['id',_0x7d0f('0x32'),_0x7d0f('0x63'),'updatedAt',_0x7d0f('0x64')]});}})[_0x7d0f('0x2c')](function(_0xa989b4){if(_0xa989b4){return{'count':_0xa989b4[_0x7d0f('0x25')],'rows':_[_0x7d0f('0x39')](_0xa989b4[_0x7d0f('0x4b')],function(_0xc893b4){return{'membername':_0xc893b4[_0x7d0f('0x32')],'UserId':_0xc893b4['id'],'queue_name':_0x30e0c9[_0x7d0f('0x32')],'OpenchannelQueueId':_0x30e0c9['id'],'interface':util[_0x7d0f('0x65')](_0x7d0f('0x66'),'SIP',_0xc893b4[_0x7d0f('0x32')]),'penalty':0x0,'paused':_0xc893b4['openchannelPause'],'createdAt':_0xc893b4['createdAt'],'updatedAt':_0xc893b4[_0x7d0f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d0f('0x2c')](respondWithFilteredResult(_0x503158,_0xcc72aa))[_0x7d0f('0x4c')](handleError(_0x503158,null));};exports[_0x7d0f('0x68')]=function(_0x3fe24f,_0x4f8f09,_0x3fbb84){var _0xb0665b={};var _0x36dc7f={};var _0x40fd0e;var _0x3a3c8c;return db[_0x7d0f('0x4f')][_0x7d0f('0x69')]({'where':{'id':_0x3fe24f[_0x7d0f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f8f09,null))[_0x7d0f('0x2c')](function(_0x1651c7){if(_0x1651c7){_0x40fd0e=_0x1651c7;_0x36dc7f['model']=_['keys'](db[_0x7d0f('0x6a')][_0x7d0f('0x50')]);_0x36dc7f[_0x7d0f('0x3a')]=_[_0x7d0f('0x3b')](_0x3fe24f[_0x7d0f('0x3a')]);_0x36dc7f[_0x7d0f('0x3c')]=_[_0x7d0f('0x3e')](_0x36dc7f[_0x7d0f('0x38')],_0x36dc7f['query']);_0xb0665b['attributes']=_[_0x7d0f('0x3e')](_0x36dc7f['model'],qs[_0x7d0f('0x3f')](_0x3fe24f[_0x7d0f('0x3a')][_0x7d0f('0x3f')]));_0xb0665b[_0x7d0f('0x3d')]=_0xb0665b[_0x7d0f('0x3d')]['length']?_0xb0665b[_0x7d0f('0x3d')]:_0x36dc7f[_0x7d0f('0x38')];_0xb0665b[_0x7d0f('0x43')]=qs[_0x7d0f('0x5d')](_0x3fe24f[_0x7d0f('0x3a')][_0x7d0f('0x5d')]);_0xb0665b[_0x7d0f('0x44')]=qs['filters'](_[_0x7d0f('0x6b')](_0x3fe24f[_0x7d0f('0x3a')],_0x36dc7f[_0x7d0f('0x3c')]));if(_0x3fe24f[_0x7d0f('0x3a')]['filter']){_0xb0665b['where']=_['merge'](_0xb0665b['where'],{'$or':_[_0x7d0f('0x39')](_0xb0665b['attributes'],function(_0x2b9a82){var _0x3c9def={};_0x3c9def[_0x2b9a82]={'$like':'%'+_0x3fe24f[_0x7d0f('0x3a')]['filter']+'%'};return _0x3c9def;})});}_0xb0665b=_[_0x7d0f('0x47')]({},_0xb0665b,_0x3fe24f[_0x7d0f('0x51')]);return _0x40fd0e[_0x7d0f('0x68')](_0xb0665b);}})['then'](function(_0x16b753){if(_0x16b753){_0x3a3c8c=_0x16b753['length'];if(!_0x3fe24f[_0x7d0f('0x3a')][_0x7d0f('0x41')](_0x7d0f('0x42'))){_0xb0665b[_0x7d0f('0x24')]=qs[_0x7d0f('0x24')](_0x3fe24f[_0x7d0f('0x3a')][_0x7d0f('0x24')]);_0xb0665b['offset']=qs[_0x7d0f('0x22')](_0x3fe24f[_0x7d0f('0x3a')][_0x7d0f('0x22')]);}return _0x40fd0e[_0x7d0f('0x68')](_0xb0665b);}})[_0x7d0f('0x2c')](function(_0x449471){if(_0x449471){return _0x449471?{'count':_0x3a3c8c,'rows':_0x449471}:null;}})[_0x7d0f('0x2c')](respondWithResult(_0x4f8f09,null))[_0x7d0f('0x4c')](handleError(_0x4f8f09,null));};exports['addTeams']=function(_0xf04a60,_0x1bb130,_0x39aaa4){var _0xe9603a=_0xf04a60[_0x7d0f('0x54')][_0x7d0f('0x6c')];return db[_0x7d0f('0x6a')][_0x7d0f('0x4a')]({'where':{'id':_0xe9603a},'attributes':['id'],'include':[{'model':db[_0x7d0f('0x5f')],'as':_0x7d0f('0x6d'),'attributes':['id',_0x7d0f('0x32'),_0x7d0f('0x6e'),_0x7d0f('0x6f'),_0x7d0f('0x70')],'raw':!![]}]})[_0x7d0f('0x2c')](function(_0x1fb698){if(_0x1fb698){var _0x32b51a=_[_0x7d0f('0x71')](_0x1fb698,function(_0x41d29e){var _0x42f9a3=_0x41d29e[_0x7d0f('0x2e')]({'plain':!![]});return _0x42f9a3[_0x7d0f('0x6d')];});return db[_0x7d0f('0x4f')]['find']({'where':{'id':_0xf04a60[_0x7d0f('0x4e')]['id']}})[_0x7d0f('0x2c')](function(_0x145a30){return db['sequelize'][_0x7d0f('0x72')](function(_0x54e214){return _0x145a30['addTeams'](_0xe9603a,{'transaction':_0x54e214})['then'](function(){return BPromise[_0x7d0f('0x73')](_0x32b51a,function(_0x4d9c9c){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x4d9c9c['id'],'OpenchannelQueueId':_0xf04a60['params']['id']},'transaction':_0x54e214});});})[_0x7d0f('0x2c')](function(){_0x32b51a[_0x7d0f('0x74')](function(_0x4eb8e1){socket[_0x7d0f('0x75')]('userOpenchannelQueue:save',{'UserId':_0x4eb8e1['id'],'OpenchannelQueueId':_0x145a30['id']});});});});});}})[_0x7d0f('0x2c')](respondWithStatusCode(_0x1bb130,null))[_0x7d0f('0x4c')](handleError(_0x1bb130,null));};exports[_0x7d0f('0x76')]=function(_0x58d8ec,_0x5cc6a6,_0x18c6e8){return db[_0x7d0f('0x6a')][_0x7d0f('0x4a')]({'where':{'id':_0x58d8ec[_0x7d0f('0x3a')][_0x7d0f('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d0f('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7d0f('0x2c')](handleEntityNotFound(_0x5cc6a6,null))[_0x7d0f('0x2c')](function(_0x123b25){var _0x3755e3=_[_0x7d0f('0x39')](_0x123b25,'id');var _0x33e8ae=[];var _0x1ebf5e=[];var _0x1ca7c8=squel[_0x7d0f('0x77')]();_0x1ca7c8[_0x7d0f('0x78')]('tq.TeamId')[_0x7d0f('0x79')](_0x7d0f('0x7a'),'tq')['join'](_0x7d0f('0x7b'),'ut',_0x7d0f('0x7c'))[_0x7d0f('0x44')](_0x7d0f('0x7d'),_0x58d8ec['params']['id']);for(var _0x2bffc5=0x0;_0x2bffc5<_0x123b25[_0x7d0f('0x40')];_0x2bffc5+=0x1){let _0x4596c7=_0x123b25[_0x2bffc5];for(var _0xf21aed=0x0;_0xf21aed<_0x4596c7[_0x7d0f('0x6d')][_0x7d0f('0x40')];_0xf21aed+=0x1){let _0x2a07a3=_0x4596c7['Agents'][_0xf21aed];var _0x5d05ef=_0x1ca7c8[_0x7d0f('0x7e')]();_0x5d05ef[_0x7d0f('0x44')](_0x7d0f('0x7f'),_0x2a07a3['id']);_0x1ebf5e[_0x7d0f('0x80')](db[_0x7d0f('0x81')][_0x7d0f('0x3a')](_0x5d05ef['toString'](),{'type':db['sequelize'][_0x7d0f('0x82')][_0x7d0f('0x83')]})[_0x7d0f('0x2c')](function(_0x171e27){if(_0x171e27[_0x7d0f('0x40')]===0x1){return _0x2a07a3['id'];}else{var _0x80fd76=_[_0x7d0f('0x84')](_['map'](_0x171e27,_0x7d0f('0x85')),function(_0x1afb4d){return _[_0x7d0f('0x86')](_0x3755e3,_0x1afb4d);});if(_0x80fd76){return _0x2a07a3['id'];}}}));}}return BPromise[_0x7d0f('0x87')](_0x1ebf5e)[_0x7d0f('0x2c')](function(_0x4ea906){_0x33e8ae=_(_0x33e8ae)[_0x7d0f('0x88')](_0x4ea906)[_0x7d0f('0x89')]()[_0x7d0f('0x8a')]();return db[_0x7d0f('0x4f')][_0x7d0f('0x52')]({'where':{'id':_0x58d8ec[_0x7d0f('0x4e')]['id']}})['then'](function(_0x1b7f6d){return db[_0x7d0f('0x81')][_0x7d0f('0x72')](function(_0x47575e){return _0x1b7f6d['removeTeams'](_0x58d8ec[_0x7d0f('0x3a')]['ids'],{'transaction':_0x47575e})['then'](function(){if(!_[_0x7d0f('0x8b')](_0x33e8ae)){return _0x1b7f6d['removeAgents'](_0x33e8ae,{'transaction':_0x47575e});}})['then'](function(){_0x33e8ae[_0x7d0f('0x74')](function(_0x5d0821){socket[_0x7d0f('0x75')](_0x7d0f('0x8c'),{'UserId':_0x5d0821,'OpenchannelQueueId':_0x1b7f6d['id']});});});});});});})['then'](respondWithStatusCode(_0x5cc6a6,null))[_0x7d0f('0x4c')](handleError(_0x5cc6a6,null));};exports[_0x7d0f('0x8d')]=function(_0x2e331f,_0xb11738,_0x4bf1cf){return db[_0x7d0f('0x4f')][_0x7d0f('0x52')]({'where':{'id':_0x2e331f[_0x7d0f('0x4e')]['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0xb11738,null))[_0x7d0f('0x2c')](function(_0x93d10b){if(_0x93d10b){return _0x93d10b[_0x7d0f('0x8d')](_0x2e331f[_0x7d0f('0x54')][_0x7d0f('0x6c')],_['omit'](_0x2e331f['body'],[_0x7d0f('0x6c'),'id'])||{})['spread'](function(_0x19914f){for(var _0x518e6b=0x0;_0x518e6b<_0x2e331f[_0x7d0f('0x54')]['ids'][_0x7d0f('0x40')];_0x518e6b+=0x1){socket[_0x7d0f('0x75')](_0x7d0f('0x8e'),{'UserId':Number(_0x2e331f[_0x7d0f('0x54')]['ids'][_0x518e6b]),'OpenchannelQueueId':Number(_0x2e331f[_0x7d0f('0x4e')]['id'])});}return _0x19914f;});}})[_0x7d0f('0x2c')](respondWithResult(_0xb11738,null))['catch'](handleError(_0xb11738,null));};exports[_0x7d0f('0x8f')]=function(_0x7962c5,_0xcdc78f,_0x118bcc){return db['OpenchannelQueue'][_0x7d0f('0x52')]({'where':{'id':_0x7962c5['params']['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0xcdc78f,null))[_0x7d0f('0x2c')](function(_0x15acb7){if(_0x15acb7){return _0x15acb7[_0x7d0f('0x8f')](_0x7962c5[_0x7d0f('0x3a')][_0x7d0f('0x6c')])[_0x7d0f('0x2c')](function(){if(_['isArray'](_0x7962c5[_0x7d0f('0x3a')]['ids'])){for(var _0x202748=0x0;_0x202748<_0x7962c5[_0x7d0f('0x3a')][_0x7d0f('0x6c')]['length'];_0x202748+=0x1){socket[_0x7d0f('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x7962c5['query'][_0x7d0f('0x6c')][_0x202748]),'OpenchannelQueueId':Number(_0x7962c5[_0x7d0f('0x4e')]['id'])});}}else{socket[_0x7d0f('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x7962c5['query']['ids']),'OpenchannelQueueId':Number(_0x7962c5[_0x7d0f('0x4e')]['id'])});}});}})[_0x7d0f('0x2c')](respondWithStatusCode(_0xcdc78f,null))[_0x7d0f('0x4c')](handleError(_0xcdc78f,null));};exports[_0x7d0f('0x90')]=function(_0x2a30e9,_0xd1e5be,_0x4d7fee){var _0x117299={};var _0x2740f5={};var _0x46e40f;var _0x312b10;return db['OpenchannelQueue'][_0x7d0f('0x69')]({'where':{'id':_0x2a30e9[_0x7d0f('0x4e')]['id']}})[_0x7d0f('0x2c')](handleEntityNotFound(_0xd1e5be,null))[_0x7d0f('0x2c')](function(_0xa6c6d0){if(_0xa6c6d0){_0x46e40f=_0xa6c6d0;_0x2740f5[_0x7d0f('0x38')]=_[_0x7d0f('0x3b')](db[_0x7d0f('0x5f')][_0x7d0f('0x50')]);_0x2740f5[_0x7d0f('0x3a')]=_[_0x7d0f('0x3b')](_0x2a30e9[_0x7d0f('0x3a')]);_0x2740f5['filters']=_[_0x7d0f('0x3e')](_0x2740f5['model'],_0x2740f5[_0x7d0f('0x3a')]);_0x117299[_0x7d0f('0x3d')]=_['intersection'](_0x2740f5[_0x7d0f('0x38')],qs['fields'](_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x3f')]));_0x117299[_0x7d0f('0x3d')]=_0x117299[_0x7d0f('0x3d')][_0x7d0f('0x40')]?_0x117299['attributes']:_0x2740f5['model'];_0x117299[_0x7d0f('0x43')]=qs[_0x7d0f('0x5d')](_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x5d')]);_0x117299[_0x7d0f('0x44')]=qs[_0x7d0f('0x3c')](_[_0x7d0f('0x6b')](_0x2a30e9[_0x7d0f('0x3a')],_0x2740f5[_0x7d0f('0x3c')]));if(_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x45')]){_0x117299[_0x7d0f('0x44')]=_[_0x7d0f('0x47')](_0x117299['where'],{'$or':_[_0x7d0f('0x39')](_0x117299[_0x7d0f('0x3d')],function(_0x586950){var _0x4b078f={};_0x4b078f[_0x586950]={'$like':'%'+_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x45')]+'%'};return _0x4b078f;})});}_0x117299=_[_0x7d0f('0x47')]({},_0x117299,_0x2a30e9[_0x7d0f('0x51')]);return _0x46e40f[_0x7d0f('0x90')](_0x117299);}})[_0x7d0f('0x2c')](function(_0x41ef45){if(_0x41ef45){_0x312b10=_0x41ef45[_0x7d0f('0x40')];if(!_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x41')](_0x7d0f('0x42'))){_0x117299[_0x7d0f('0x24')]=qs['limit'](_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x24')]);_0x117299['offset']=qs[_0x7d0f('0x22')](_0x2a30e9[_0x7d0f('0x3a')][_0x7d0f('0x22')]);}return _0x46e40f[_0x7d0f('0x90')](_0x117299);}})[_0x7d0f('0x2c')](function(_0x159c37){if(_0x159c37){return _0x159c37?{'count':_0x312b10,'rows':_0x159c37}:null;}})[_0x7d0f('0x2c')](respondWithResult(_0xd1e5be,null))[_0x7d0f('0x4c')](handleError(_0xd1e5be,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1403438..b8fcaf1 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 _0x99de=['hasOwnProperty','hook','exports','events','OpenchannelQueue','save','update','remove','emit'];(function(_0x2ded68,_0x2c2681){var _0x30bcf5=function(_0x19d055){while(--_0x19d055){_0x2ded68['push'](_0x2ded68['shift']());}};_0x30bcf5(++_0x2c2681);}(_0x99de,0x8a));var _0xe99d=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x99de[_0x47242d];return _0x30273a;};'use strict';var EventEmitter=require(_0xe99d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe99d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe99d('0x2'),'afterUpdate':_0xe99d('0x3'),'afterDestroy':_0xe99d('0x4')};function emitEvent(_0xdc702b){return function(_0x4b068f,_0x341c36,_0x1a1147){OpenchannelQueueEvents[_0xe99d('0x5')](_0xdc702b+':'+_0x4b068f['id'],_0x4b068f);OpenchannelQueueEvents[_0xe99d('0x5')](_0xdc702b,_0x4b068f);_0x1a1147(null);};}for(var e in events){if(events[_0xe99d('0x6')](e)){var event=events[e];OpenchannelQueue[_0xe99d('0x7')](e,emitEvent(event));}}module[_0xe99d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8c66=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c66,0x78));var _0x68c6=function(_0x119c85,_0x268175){_0x119c85=_0x119c85-0x0;var _0x41d288=_0x8c66[_0x119c85];return _0x41d288;};'use strict';var EventEmitter=require(_0x68c6('0x0'));var OpenchannelQueue=require(_0x68c6('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x68c6('0x2')](0x0);var events={'afterCreate':_0x68c6('0x3'),'afterUpdate':_0x68c6('0x4'),'afterDestroy':_0x68c6('0x5')};function emitEvent(_0x5e8aa4){return function(_0x5a99ae,_0x3e074a,_0x1e27a8){OpenchannelQueueEvents[_0x68c6('0x6')](_0x5e8aa4+':'+_0x5a99ae['id'],_0x5a99ae);OpenchannelQueueEvents[_0x68c6('0x6')](_0x5e8aa4,_0x5a99ae);_0x1e27a8(null);};}for(var e in events){if(events[_0x68c6('0x7')](e)){var event=events[e];OpenchannelQueue[_0x68c6('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 310cfe1..2fa3a32 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 _0x5d5c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0xbadd74,_0x1fc913){var _0x4f0b02=function(_0x282855){while(--_0x282855){_0xbadd74['push'](_0xbadd74['shift']());}};_0x4f0b02(++_0x1fc913);}(_0x5d5c,0xbf));var _0xc5d5=function(_0x3be189,_0x16014f){_0x3be189=_0x3be189-0x0;var _0x3f8895=_0x5d5c[_0x3be189];return _0x3f8895;};'use strict';var _=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var logger=require(_0xc5d5('0x2'))(_0xc5d5('0x3'));var moment=require(_0xc5d5('0x4'));var BPromise=require(_0xc5d5('0x5'));var rp=require(_0xc5d5('0x6'));var fs=require('fs');var path=require(_0xc5d5('0x7'));var rimraf=require(_0xc5d5('0x8'));var config=require(_0xc5d5('0x9'));var attributes=require(_0xc5d5('0xa'));module[_0xc5d5('0xb')]=function(_0x19da75,_0x31ac51){return _0x19da75[_0xc5d5('0xc')](_0xc5d5('0xd'),attributes,{'tableName':_0xc5d5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa014=['moment','path','rimraf','../../config/environment','exports','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x14c695,_0x336d7e){var _0x1a9544=function(_0x5e24b1){while(--_0x5e24b1){_0x14c695['push'](_0x14c695['shift']());}};_0x1a9544(++_0x336d7e);}(_0xa014,0x1b4));var _0x4a01=function(_0x473f1d,_0x3cd9b2){_0x473f1d=_0x473f1d-0x0;var _0x430957=_0xa014[_0x473f1d];return _0x430957;};'use strict';var _=require(_0x4a01('0x0'));var util=require(_0x4a01('0x1'));var logger=require(_0x4a01('0x2'))(_0x4a01('0x3'));var moment=require(_0x4a01('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a01('0x5'));var rimraf=require(_0x4a01('0x6'));var config=require(_0x4a01('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x4a01('0x8')]=function(_0x109b85,_0x33c16a){return _0x109b85[_0x4a01('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x4a01('0xa'),'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 de8f6e7..78942b5 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 _0x107f=['include','map','model','catch','find','ShowOpenchannelQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x107f,0x15c));var _0xf107=function(_0x19463e,_0xa54aca){_0x19463e=_0x19463e-0x0;var _0x436e34=_0x107f[_0x19463e];return _0x436e34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf107('0x0'));var BPromise=require(_0xf107('0x1'));var rs=require(_0xf107('0x2'));var fs=require('fs');var Redis=require(_0xf107('0x3'));var db=require(_0xf107('0x4'))['db'];var utils=require(_0xf107('0x5'));var logger=require('../../config/logger')(_0xf107('0x6'));var config=require('../../config/environment');var jayson=require(_0xf107('0x7'));var client=jayson[_0xf107('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf107('0x9')](config[_0xf107('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf107('0xa')]));require(_0xf107('0xb'))[_0xf107('0xc')](socket);function respondWithRpcPromise(_0x55352a,_0x4f65b5,_0x464209){return new BPromise(function(_0x4b0f7d,_0x29a27e){return client[_0xf107('0xd')](_0x55352a,_0x464209)[_0xf107('0xe')](function(_0x42763a){logger[_0xf107('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f65b5,_0xf107('0x10'));logger[_0xf107('0x11')](_0xf107('0x12'),_0x4f65b5,_0xf107('0x10'),JSON[_0xf107('0x13')](_0x42763a));if(_0x42763a['error']){if(_0x42763a[_0xf107('0x14')]['code']===0x1f4){logger[_0xf107('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f65b5,_0x42763a['error'][_0xf107('0x15')]);return _0x29a27e(_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);}logger['error'](_0xf107('0x16'),_0x4f65b5,_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);return _0x4b0f7d(_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);}else{logger[_0xf107('0xf')](_0xf107('0x16'),_0x4f65b5,_0xf107('0x10'));_0x4b0f7d(_0x42763a[_0xf107('0x17')]['message']);}})['catch'](function(_0xc04a32){logger['error'](_0xf107('0x16'),_0x4f65b5,_0xc04a32);_0x29a27e(_0xc04a32);});});}exports[_0xf107('0x18')]=function(_0x11be01){var _0x46535b=this;return new Promise(function(_0x5cc548,_0x298380){return db[_0xf107('0x19')][_0xf107('0x1a')]({'raw':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1c')]===undefined?!![]:![]:!![],'where':_0x11be01[_0xf107('0x1b')]?_0x11be01[_0xf107('0x1b')][_0xf107('0x1d')]||null:null,'attributes':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1e')]||null:null,'limit':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1f')]||null:null,'include':_0x11be01[_0xf107('0x1b')]?_0x11be01[_0xf107('0x1b')][_0xf107('0x20')]?_[_0xf107('0x21')](_0x11be01[_0xf107('0x1b')][_0xf107('0x20')],function(_0x10f460){return{'model':db[_0x10f460[_0xf107('0x22')]],'as':_0x10f460['as'],'attributes':_0x10f460[_0xf107('0x1e')],'include':_0x10f460[_0xf107('0x20')]?_[_0xf107('0x21')](_0x10f460[_0xf107('0x20')],function(_0x1c0c4a){return{'model':db[_0x1c0c4a[_0xf107('0x22')]],'as':_0x1c0c4a['as'],'attributes':_0x1c0c4a['attributes'],'include':_0x1c0c4a[_0xf107('0x20')]?_[_0xf107('0x21')](_0x1c0c4a[_0xf107('0x20')],function(_0x4841de){return{'model':db[_0x4841de['model']],'as':_0x4841de['as'],'attributes':_0x4841de['attributes']};}):[]};}):[]};}):[]:[]})[_0xf107('0xe')](function(_0x3547d1){logger[_0xf107('0xf')]('GetOpenchannelQueue',_0x11be01);logger[_0xf107('0x11')](_0xf107('0x18'),_0x11be01,JSON[_0xf107('0x13')](_0x3547d1));_0x5cc548(_0x3547d1);})[_0xf107('0x23')](function(_0x5a8716){logger[_0xf107('0x14')](_0xf107('0x18'),_0x5a8716[_0xf107('0x15')],_0x11be01);_0x298380(_0x46535b[_0xf107('0x14')](0x1f4,_0x5a8716['message']));});});};exports['ShowOpenchannelQueue']=function(_0x45737d){var _0x17f24d=this;return new Promise(function(_0x1dd364,_0x2c3c15){return db[_0xf107('0x19')][_0xf107('0x24')]({'raw':_0x45737d[_0xf107('0x1b')]?_0x45737d[_0xf107('0x1b')][_0xf107('0x1c')]===undefined?!![]:![]:!![],'where':_0x45737d[_0xf107('0x1b')]?_0x45737d['options']['where']||null:null,'attributes':_0x45737d['options']?_0x45737d[_0xf107('0x1b')]['attributes']||null:null,'include':_0x45737d[_0xf107('0x1b')]?_0x45737d[_0xf107('0x1b')][_0xf107('0x20')]?_['map'](_0x45737d['options'][_0xf107('0x20')],function(_0x12d9a0){return{'model':db[_0x12d9a0[_0xf107('0x22')]],'as':_0x12d9a0['as'],'attributes':_0x12d9a0[_0xf107('0x1e')],'include':_0x12d9a0['include']?_['map'](_0x12d9a0[_0xf107('0x20')],function(_0x19cc86){return{'model':db[_0x19cc86['model']],'as':_0x19cc86['as'],'attributes':_0x19cc86[_0xf107('0x1e')],'include':_0x19cc86[_0xf107('0x20')]?_[_0xf107('0x21')](_0x19cc86[_0xf107('0x20')],function(_0x56ef3e){return{'model':db[_0x56ef3e['model']],'as':_0x56ef3e['as'],'attributes':_0x56ef3e[_0xf107('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf107('0xe')](function(_0x593551){logger[_0xf107('0xf')](_0xf107('0x25'),_0x45737d);logger['debug'](_0xf107('0x25'),_0x45737d,JSON[_0xf107('0x13')](_0x593551));_0x1dd364(_0x593551);})[_0xf107('0x23')](function(_0x2fdaa9){logger[_0xf107('0x14')](_0xf107('0x25'),_0x2fdaa9[_0xf107('0x15')],_0x45737d);_0x2c3c15(_0x17f24d[_0xf107('0x14')](0x1f4,_0x2fdaa9[_0xf107('0x15')]));});});}; \ No newline at end of file +var _0x4e66=['request\x20sent','stringify','code','error','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4e66,0x149));var _0x64e6=function(_0x4b0d65,_0x5cc99a){_0x4b0d65=_0x4b0d65-0x0;var _0x252ff1=_0x4e66[_0x4b0d65];return _0x252ff1;};'use strict';var _=require(_0x64e6('0x0'));var util=require(_0x64e6('0x1'));var moment=require(_0x64e6('0x2'));var BPromise=require(_0x64e6('0x3'));var rs=require(_0x64e6('0x4'));var fs=require('fs');var Redis=require(_0x64e6('0x5'));var db=require(_0x64e6('0x6'))['db'];var utils=require(_0x64e6('0x7'));var logger=require(_0x64e6('0x8'))(_0x64e6('0x9'));var config=require(_0x64e6('0xa'));var jayson=require(_0x64e6('0xb'));var client=jayson[_0x64e6('0xc')][_0x64e6('0xd')]({'port':0x232a});config[_0x64e6('0xe')]=_['defaults'](config[_0x64e6('0xe')],{'host':_0x64e6('0xf'),'port':0x18eb});var socket=require(_0x64e6('0x10'))(new Redis(config['redis']));require(_0x64e6('0x11'))['register'](socket);function respondWithRpcPromise(_0x574834,_0x6b3413,_0x3598c5){return new BPromise(function(_0x3e68cd,_0x4e4e36){return client[_0x64e6('0x12')](_0x574834,_0x3598c5)[_0x64e6('0x13')](function(_0x4e67fd){logger['info'](_0x64e6('0x14'),_0x6b3413,'request\x20sent');logger[_0x64e6('0x15')](_0x64e6('0x16'),_0x6b3413,_0x64e6('0x17'),JSON[_0x64e6('0x18')](_0x4e67fd));if(_0x4e67fd['error']){if(_0x4e67fd['error'][_0x64e6('0x19')]===0x1f4){logger[_0x64e6('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x6b3413,_0x4e67fd[_0x64e6('0x1a')]['message']);return _0x4e4e36(_0x4e67fd[_0x64e6('0x1a')][_0x64e6('0x1b')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x6b3413,_0x4e67fd[_0x64e6('0x1a')][_0x64e6('0x1b')]);return _0x3e68cd(_0x4e67fd[_0x64e6('0x1a')]['message']);}else{logger[_0x64e6('0x1c')](_0x64e6('0x14'),_0x6b3413,_0x64e6('0x17'));_0x3e68cd(_0x4e67fd[_0x64e6('0x1d')][_0x64e6('0x1b')]);}})[_0x64e6('0x1e')](function(_0x63fb5b){logger['error'](_0x64e6('0x14'),_0x6b3413,_0x63fb5b);_0x4e4e36(_0x63fb5b);});});}exports[_0x64e6('0x1f')]=function(_0x586c26){var _0xc5232=this;return new Promise(function(_0x174c7,_0x3bd639){return db[_0x64e6('0x20')][_0x64e6('0x21')]({'raw':_0x586c26['options']?_0x586c26[_0x64e6('0x22')][_0x64e6('0x23')]===undefined?!![]:![]:!![],'where':_0x586c26[_0x64e6('0x22')]?_0x586c26[_0x64e6('0x22')][_0x64e6('0x24')]||null:null,'attributes':_0x586c26[_0x64e6('0x22')]?_0x586c26[_0x64e6('0x22')]['attributes']||null:null,'limit':_0x586c26[_0x64e6('0x22')]?_0x586c26[_0x64e6('0x22')][_0x64e6('0x25')]||null:null,'include':_0x586c26[_0x64e6('0x22')]?_0x586c26['options'][_0x64e6('0x26')]?_[_0x64e6('0x27')](_0x586c26[_0x64e6('0x22')]['include'],function(_0x3acc6b){return{'model':db[_0x3acc6b[_0x64e6('0x28')]],'as':_0x3acc6b['as'],'attributes':_0x3acc6b[_0x64e6('0x29')],'include':_0x3acc6b[_0x64e6('0x26')]?_[_0x64e6('0x27')](_0x3acc6b['include'],function(_0xd39dcf){return{'model':db[_0xd39dcf['model']],'as':_0xd39dcf['as'],'attributes':_0xd39dcf[_0x64e6('0x29')],'include':_0xd39dcf[_0x64e6('0x26')]?_[_0x64e6('0x27')](_0xd39dcf[_0x64e6('0x26')],function(_0x2cd34d){return{'model':db[_0x2cd34d[_0x64e6('0x28')]],'as':_0x2cd34d['as'],'attributes':_0x2cd34d[_0x64e6('0x29')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x268b5a){logger[_0x64e6('0x1c')](_0x64e6('0x1f'),_0x586c26);logger[_0x64e6('0x15')]('GetOpenchannelQueue',_0x586c26,JSON[_0x64e6('0x18')](_0x268b5a));_0x174c7(_0x268b5a);})[_0x64e6('0x1e')](function(_0xe29d58){logger[_0x64e6('0x1a')]('GetOpenchannelQueue',_0xe29d58['message'],_0x586c26);_0x3bd639(_0xc5232['error'](0x1f4,_0xe29d58[_0x64e6('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0xe25c54){var _0x53b25e=this;return new Promise(function(_0x425822,_0x4998c2){return db[_0x64e6('0x20')][_0x64e6('0x2a')]({'raw':_0xe25c54[_0x64e6('0x22')]?_0xe25c54['options'][_0x64e6('0x23')]===undefined?!![]:![]:!![],'where':_0xe25c54[_0x64e6('0x22')]?_0xe25c54['options']['where']||null:null,'attributes':_0xe25c54[_0x64e6('0x22')]?_0xe25c54[_0x64e6('0x22')][_0x64e6('0x29')]||null:null,'include':_0xe25c54[_0x64e6('0x22')]?_0xe25c54[_0x64e6('0x22')][_0x64e6('0x26')]?_[_0x64e6('0x27')](_0xe25c54['options'][_0x64e6('0x26')],function(_0x47f242){return{'model':db[_0x47f242[_0x64e6('0x28')]],'as':_0x47f242['as'],'attributes':_0x47f242[_0x64e6('0x29')],'include':_0x47f242[_0x64e6('0x26')]?_[_0x64e6('0x27')](_0x47f242['include'],function(_0x4bedab){return{'model':db[_0x4bedab[_0x64e6('0x28')]],'as':_0x4bedab['as'],'attributes':_0x4bedab[_0x64e6('0x29')],'include':_0x4bedab[_0x64e6('0x26')]?_['map'](_0x4bedab[_0x64e6('0x26')],function(_0x1ed56d){return{'model':db[_0x1ed56d[_0x64e6('0x28')]],'as':_0x1ed56d['as'],'attributes':_0x1ed56d[_0x64e6('0x29')]};}):[]};}):[]};}):[]:[]})[_0x64e6('0x13')](function(_0x9c4fe0){logger[_0x64e6('0x1c')](_0x64e6('0x2b'),_0xe25c54);logger[_0x64e6('0x15')](_0x64e6('0x2b'),_0xe25c54,JSON[_0x64e6('0x18')](_0x9c4fe0));_0x425822(_0x9c4fe0);})[_0x64e6('0x1e')](function(_0x2c7746){logger[_0x64e6('0x1a')](_0x64e6('0x2b'),_0x2c7746[_0x64e6('0x1b')],_0xe25c54);_0x4998c2(_0x53b25e[_0x64e6('0x1a')](0x1f4,_0x2c7746[_0x64e6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 07ad167..f9b730f 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 _0x45d6=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x45d6,0x176));var _0x645d=function(_0x1b3cc9,_0x236986){_0x1b3cc9=_0x1b3cc9-0x0;var _0xc96cd1=_0x45d6[_0x1b3cc9];return _0xc96cd1;};'use strict';var OpenchannelQueueEvents=require(_0x645d('0x0'));var events=[_0x645d('0x1'),_0x645d('0x2'),_0x645d('0x3')];function createListener(_0x18ed7d,_0x1af57a){return function(_0x3ed5dc){_0x1af57a[_0x645d('0x4')](_0x18ed7d,_0x3ed5dc);};}function removeListener(_0x56ac81,_0x4fb78e){return function(){OpenchannelQueueEvents[_0x645d('0x5')](_0x56ac81,_0x4fb78e);};}exports[_0x645d('0x6')]=function(_0x19ab10){for(var _0x9c28a0=0x0,_0x23eded=events[_0x645d('0x7')];_0x9c28a0<_0x23eded;_0x9c28a0++){var _0x250f35=events[_0x9c28a0];var _0xdfc96=createListener(_0x645d('0x8')+_0x250f35,_0x19ab10);OpenchannelQueueEvents['on'](_0x250f35,_0xdfc96);}}; \ No newline at end of file +var _0x4b71=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b71,0x1c2));var _0x14b7=function(_0x50e1a7,_0x555868){_0x50e1a7=_0x50e1a7-0x0;var _0x5a3a82=_0x4b71[_0x50e1a7];return _0x5a3a82;};'use strict';var OpenchannelQueueEvents=require(_0x14b7('0x0'));var events=[_0x14b7('0x1'),_0x14b7('0x2'),_0x14b7('0x3')];function createListener(_0x6e5ff8,_0x329d2d){return function(_0x22f9d8){_0x329d2d['emit'](_0x6e5ff8,_0x22f9d8);};}function removeListener(_0x2e9781,_0x4216b1){return function(){OpenchannelQueueEvents[_0x14b7('0x4')](_0x2e9781,_0x4216b1);};}exports[_0x14b7('0x5')]=function(_0x75b2d6){for(var _0x1d9d8d=0x0,_0x27aded=events[_0x14b7('0x6')];_0x1d9d8d<_0x27aded;_0x1d9d8d++){var _0x367b84=events[_0x1d9d8d];var _0x561f22=createListener(_0x14b7('0x7')+_0x367b84,_0x75b2d6);OpenchannelQueueEvents['on'](_0x367b84,_0x561f22);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f1aea5b..08fe849 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 _0xf21f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x412626,_0x1ab9b0){var _0x2e8e57=function(_0xef39da){while(--_0xef39da){_0x412626['push'](_0x412626['shift']());}};_0x2e8e57(++_0x1ab9b0);}(_0xf21f,0x11b));var _0xff21=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xf21f[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require(_0xff21('0x0'));var path=require(_0xff21('0x1'));var timeout=require(_0xff21('0x2'));var express=require(_0xff21('0x3'));var router=express[_0xff21('0x4')]();var fs_extra=require(_0xff21('0x5'));var auth=require(_0xff21('0x6'));var interaction=require(_0xff21('0x7'));var config=require(_0xff21('0x8'));var controller=require(_0xff21('0x9'));router[_0xff21('0xa')]('/',auth['isAuthenticated'](),controller[_0xff21('0xb')]);router[_0xff21('0xa')](_0xff21('0xc'),auth[_0xff21('0xd')](),controller[_0xff21('0xe')]);router[_0xff21('0xa')](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x10')]);router[_0xff21('0x11')]('/',auth[_0xff21('0xd')](),controller['create']);router[_0xff21('0x12')](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x13')]);router['delete'](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x14')]);module[_0xff21('0x15')]=router; \ No newline at end of file +var _0x795b=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe'];(function(_0x403559,_0x1b69c4){var _0x2e7fb9=function(_0x58bd5a){while(--_0x58bd5a){_0x403559['push'](_0x403559['shift']());}};_0x2e7fb9(++_0x1b69c4);}(_0x795b,0x7a));var _0xb795=function(_0x353ce8,_0x29fd68){_0x353ce8=_0x353ce8-0x0;var _0x1d069b=_0x795b[_0x353ce8];return _0x1d069b;};'use strict';var multer=require(_0xb795('0x0'));var util=require(_0xb795('0x1'));var path=require(_0xb795('0x2'));var timeout=require(_0xb795('0x3'));var express=require(_0xb795('0x4'));var router=express[_0xb795('0x5')]();var fs_extra=require(_0xb795('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb795('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0xb795('0x8')]('/',auth[_0xb795('0x9')](),controller['index']);router[_0xb795('0x8')](_0xb795('0xa'),auth[_0xb795('0x9')](),controller['describe']);router[_0xb795('0x8')](_0xb795('0xb'),auth[_0xb795('0x9')](),controller[_0xb795('0xc')]);router[_0xb795('0xd')]('/',auth['isAuthenticated'](),controller[_0xb795('0xe')]);router[_0xb795('0xf')](_0xb795('0xb'),auth[_0xb795('0x9')](),controller['update']);router[_0xb795('0x10')]('/:id',auth[_0xb795('0x9')](),controller[_0xb795('0x11')]);module[_0xb795('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 7f81751..b362d5d 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 _0xc608=['DATE','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc608,0x1c9));var _0x8c60=function(_0x280fea,_0xfd6aad){_0x280fea=_0x280fea-0x0;var _0x2884a3=_0xc608[_0x280fea];return _0x2884a3;};'use strict';var moment=require('moment');var Sequelize=require(_0x8c60('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8c60('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8c60('0x2')]},'leaveAt':{'type':Sequelize[_0x8c60('0x2')]},'acceptAt':{'type':Sequelize[_0x8c60('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c60('0x1')]}}; \ No newline at end of file +var _0xe234=['STRING','DATE','sequelize','exports'];(function(_0x1cdce5,_0x1fb0d4){var _0x3f9d13=function(_0x1125af){while(--_0x1125af){_0x1cdce5['push'](_0x1cdce5['shift']());}};_0x3f9d13(++_0x1fb0d4);}(_0xe234,0xfe));var _0x4e23=function(_0x4ab987,_0x4e95f5){_0x4ab987=_0x4ab987-0x0;var _0x550a31=_0xe234[_0x4ab987];return _0x550a31;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e23('0x0'));module[_0x4e23('0x1')]={'uniqueid':{'type':Sequelize[_0x4e23('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4e23('0x2')]},'joinAt':{'type':Sequelize[_0x4e23('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4e23('0x3')]},'reason':{'type':Sequelize[_0x4e23('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 05ae670..cb49b10 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 _0x4d8d=['hasOwnProperty','sort','filters','pick','filter','merge','options','where','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','error','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x34b471,_0x4a1377){var _0xdd4f7a=function(_0x3b908d){while(--_0x3b908d){_0x34b471['push'](_0x34b471['shift']());}};_0xdd4f7a(++_0x4a1377);}(_0x4d8d,0x9a));var _0xd4d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d8d[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd4d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4d8('0x1'));var jsonpatch=require(_0xd4d8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd4d8('0x3'));var Mustache=require(_0xd4d8('0x4'));var util=require(_0xd4d8('0x5'));var path=require(_0xd4d8('0x6'));var sox=require(_0xd4d8('0x7'));var csv=require(_0xd4d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4d8('0x9'));var _=require(_0xd4d8('0xa'));var squel=require(_0xd4d8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4d8('0x8'));var querystring=require(_0xd4d8('0xc'));var Papa=require(_0xd4d8('0xd'));var Redis=require(_0xd4d8('0xe'));var authService=require(_0xd4d8('0xf'));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(_0xd4d8('0x10'));var licenseUtil=require(_0xd4d8('0x11'));var db=require(_0xd4d8('0x12'))['db'];function respondWithStatusCode(_0x1207d8,_0x261bf5){_0x261bf5=_0x261bf5||0xcc;return function(_0x387807){if(_0x387807){return _0x1207d8[_0xd4d8('0x13')](_0x261bf5);}return _0x1207d8[_0xd4d8('0x14')](_0x261bf5)[_0xd4d8('0x15')]();};}function respondWithResult(_0x371e60,_0x2e1f05){_0x2e1f05=_0x2e1f05||0xc8;return function(_0x1947bf){if(_0x1947bf){return _0x371e60[_0xd4d8('0x14')](_0x2e1f05)[_0xd4d8('0x16')](_0x1947bf);}};}function respondWithFilteredResult(_0x446219,_0x2da5be){return function(_0x395c9b){if(_0x395c9b){var _0x2d3a1f=typeof _0x2da5be[_0xd4d8('0x17')]===_0xd4d8('0x18')&&typeof _0x2da5be['limit']===_0xd4d8('0x18');var _0x1bc205=_0x395c9b['count'];var _0x11395d=_0x2d3a1f?0x0:_0x2da5be['offset'];var _0x537e01=_0x2d3a1f?_0x395c9b['count']:_0x2da5be[_0xd4d8('0x17')]+_0x2da5be[_0xd4d8('0x19')];var _0x15ff5d;if(_0x537e01>=_0x1bc205){_0x537e01=_0x1bc205;_0x15ff5d=0xc8;}else{_0x15ff5d=0xce;}_0x446219[_0xd4d8('0x14')](_0x15ff5d);return _0x446219[_0xd4d8('0x1a')]('Content-Range',_0x11395d+'-'+_0x537e01+'/'+_0x1bc205)[_0xd4d8('0x16')](_0x395c9b);}return null;};}function patchUpdates(_0x3d3596){return function(_0x5a1a41){try{jsonpatch[_0xd4d8('0x1b')](_0x5a1a41,_0x3d3596,!![]);}catch(_0xedd639){return BPromise[_0xd4d8('0x1c')](_0xedd639);}return _0x5a1a41['save']();};}function saveUpdates(_0x5c1f4e,_0x4186a5){return function(_0x94b60b){if(_0x94b60b){return _0x94b60b[_0xd4d8('0x1d')](_0x5c1f4e)[_0xd4d8('0x1e')](function(_0x59ee55){return _0x59ee55;});}return null;};}function removeEntity(_0x5244fe,_0x180ee0){return function(_0x3d3461){if(_0x3d3461){return _0x3d3461[_0xd4d8('0x1f')]()[_0xd4d8('0x1e')](function(){_0x5244fe['status'](0xcc)[_0xd4d8('0x15')]();});}};}function handleEntityNotFound(_0x2cc151,_0x119739){return function(_0x526d11){if(!_0x526d11){_0x2cc151[_0xd4d8('0x13')](0x194);}return _0x526d11;};}function handleError(_0x2d5c53,_0x3881c9){_0x3881c9=_0x3881c9||0x1f4;return function(_0x560f2e){logger[_0xd4d8('0x20')](_0x560f2e['stack']);if(_0x560f2e['name']){delete _0x560f2e[_0xd4d8('0x21')];}_0x2d5c53[_0xd4d8('0x14')](_0x3881c9)[_0xd4d8('0x22')](_0x560f2e);};}exports['index']=function(_0x9dfb59,_0x5608a3){var _0x4c898f={},_0x318dfe={},_0xea1325={'count':0x0,'rows':[]};var _0x2f6a38=_[_0xd4d8('0x23')](db[_0xd4d8('0x24')][_0xd4d8('0x25')],function(_0x281b18){return{'name':_0x281b18[_0xd4d8('0x26')],'type':_0x281b18[_0xd4d8('0x27')]['key']};});_0x318dfe['model']=_['map'](_0x2f6a38,_0xd4d8('0x21'));_0x318dfe[_0xd4d8('0x28')]=_[_0xd4d8('0x29')](_0x9dfb59[_0xd4d8('0x28')]);_0x318dfe['filters']=_[_0xd4d8('0x2a')](_0x318dfe[_0xd4d8('0x2b')],_0x318dfe['query']);_0x4c898f[_0xd4d8('0x2c')]=_[_0xd4d8('0x2a')](_0x318dfe[_0xd4d8('0x2b')],qs[_0xd4d8('0x2d')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x2d')]));_0x4c898f[_0xd4d8('0x2c')]=_0x4c898f['attributes'][_0xd4d8('0x2e')]?_0x4c898f[_0xd4d8('0x2c')]:_0x318dfe[_0xd4d8('0x2b')];if(!_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x2f')]('nolimit')){_0x4c898f[_0xd4d8('0x19')]=qs[_0xd4d8('0x19')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x19')]);_0x4c898f[_0xd4d8('0x17')]=qs[_0xd4d8('0x17')](_0x9dfb59[_0xd4d8('0x28')]['offset']);}_0x4c898f['order']=qs[_0xd4d8('0x30')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x30')]);_0x4c898f['where']=qs[_0xd4d8('0x31')](_[_0xd4d8('0x32')](_0x9dfb59[_0xd4d8('0x28')],_0x318dfe[_0xd4d8('0x31')]),_0x2f6a38);if(_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x33')]){_0x4c898f['where']=_[_0xd4d8('0x34')](_0x4c898f['where'],{'$or':_['map'](_0x2f6a38,function(_0xacd820){if(_0xacd820[_0xd4d8('0x27')]!=='VIRTUAL'){var _0x1f44fe={};_0x1f44fe[_0xacd820[_0xd4d8('0x21')]]={'$like':'%'+_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x33')]+'%'};return _0x1f44fe;}})});}_0x4c898f=_[_0xd4d8('0x34')]({},_0x4c898f,_0x9dfb59[_0xd4d8('0x35')]);var _0x4b48ee={'where':_0x4c898f[_0xd4d8('0x36')]};return db[_0xd4d8('0x24')][_0xd4d8('0x37')](_0x4b48ee)['then'](function(_0x3305e0){_0xea1325[_0xd4d8('0x37')]=_0x3305e0;if(_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x38')]){_0x4c898f['include']=[{'all':!![]}];}return db[_0xd4d8('0x24')][_0xd4d8('0x39')](_0x4c898f);})[_0xd4d8('0x1e')](function(_0x5d3328){_0xea1325[_0xd4d8('0x3a')]=_0x5d3328;return _0xea1325;})['then'](respondWithFilteredResult(_0x5608a3,_0x4c898f))[_0xd4d8('0x3b')](handleError(_0x5608a3,null));};exports[_0xd4d8('0x3c')]=function(_0x1ee81b,_0x20638e){var _0x3fd5ca={'raw':!![],'where':{'id':_0x1ee81b[_0xd4d8('0x3d')]['id']}},_0x511afc={};_0x511afc[_0xd4d8('0x2b')]=_['keys'](db[_0xd4d8('0x24')][_0xd4d8('0x25')]);_0x511afc[_0xd4d8('0x28')]=_[_0xd4d8('0x29')](_0x1ee81b['query']);_0x511afc['filters']=_['intersection'](_0x511afc['model'],_0x511afc[_0xd4d8('0x28')]);_0x3fd5ca['attributes']=_['intersection'](_0x511afc[_0xd4d8('0x2b')],qs[_0xd4d8('0x2d')](_0x1ee81b[_0xd4d8('0x28')][_0xd4d8('0x2d')]));_0x3fd5ca[_0xd4d8('0x2c')]=_0x3fd5ca['attributes']['length']?_0x3fd5ca[_0xd4d8('0x2c')]:_0x511afc['model'];if(_0x1ee81b[_0xd4d8('0x28')][_0xd4d8('0x38')]){_0x3fd5ca[_0xd4d8('0x3e')]=[{'all':!![]}];}_0x3fd5ca=_[_0xd4d8('0x34')]({},_0x3fd5ca,_0x1ee81b['options']);return db[_0xd4d8('0x24')]['find'](_0x3fd5ca)[_0xd4d8('0x1e')](handleEntityNotFound(_0x20638e,null))[_0xd4d8('0x1e')](respondWithResult(_0x20638e,null))[_0xd4d8('0x3b')](handleError(_0x20638e,null));};exports[_0xd4d8('0x3f')]=function(_0x2feb25,_0x411f7f){return db[_0xd4d8('0x24')]['create'](_0x2feb25[_0xd4d8('0x40')],{})[_0xd4d8('0x1e')](respondWithResult(_0x411f7f,0xc9))[_0xd4d8('0x3b')](handleError(_0x411f7f,null));};exports['update']=function(_0x301129,_0x1194fc){if(_0x301129[_0xd4d8('0x40')]['id']){delete _0x301129[_0xd4d8('0x40')]['id'];}return db[_0xd4d8('0x24')][_0xd4d8('0x41')]({'where':{'id':_0x301129[_0xd4d8('0x3d')]['id']}})[_0xd4d8('0x1e')](handleEntityNotFound(_0x1194fc,null))[_0xd4d8('0x1e')](saveUpdates(_0x301129[_0xd4d8('0x40')],null))['then'](respondWithResult(_0x1194fc,null))[_0xd4d8('0x3b')](handleError(_0x1194fc,null));};exports['destroy']=function(_0x4d7ad2,_0x21b86f){return db[_0xd4d8('0x24')]['find']({'where':{'id':_0x4d7ad2[_0xd4d8('0x3d')]['id']}})[_0xd4d8('0x1e')](handleEntityNotFound(_0x21b86f,null))[_0xd4d8('0x1e')](removeEntity(_0x21b86f,null))['catch'](handleError(_0x21b86f,null));};exports[_0xd4d8('0x42')]=function(_0x352a74,_0x39d341){return db[_0xd4d8('0x24')][_0xd4d8('0x42')]()[_0xd4d8('0x1e')](respondWithResult(_0x39d341,null))[_0xd4d8('0x3b')](handleError(_0x39d341,null));}; \ No newline at end of file +var _0x32ab=['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','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','squel','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','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','model','map'];(function(_0x5285a2,_0x1949c0){var _0x4222dc=function(_0x4a166a){while(--_0x4a166a){_0x5285a2['push'](_0x5285a2['shift']());}};_0x4222dc(++_0x1949c0);}(_0x32ab,0xad));var _0xb32a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x32ab[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xb32a('0x0'));var rimraf=require(_0xb32a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb32a('0x2'));var rp=require(_0xb32a('0x3'));var moment=require(_0xb32a('0x4'));var BPromise=require(_0xb32a('0x5'));var Mustache=require(_0xb32a('0x6'));var util=require('util');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('lodash');var squel=require(_0xb32a('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb32a('0x8'));var toCsv=require(_0xb32a('0x9'));var querystring=require(_0xb32a('0xa'));var Papa=require(_0xb32a('0xb'));var Redis=require(_0xb32a('0xc'));var authService=require(_0xb32a('0xd'));var qs=require(_0xb32a('0xe'));var as=require(_0xb32a('0xf'));var hardwareService=require(_0xb32a('0x10'));var logger=require(_0xb32a('0x11'))(_0xb32a('0x12'));var utils=require(_0xb32a('0x13'));var config=require(_0xb32a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb32a('0x15'))['db'];function respondWithStatusCode(_0xe4b422,_0x31c99c){_0x31c99c=_0x31c99c||0xcc;return function(_0x9f5fc0){if(_0x9f5fc0){return _0xe4b422[_0xb32a('0x16')](_0x31c99c);}return _0xe4b422[_0xb32a('0x17')](_0x31c99c)['end']();};}function respondWithResult(_0x286b40,_0x38c7eb){_0x38c7eb=_0x38c7eb||0xc8;return function(_0x5e1ffa){if(_0x5e1ffa){return _0x286b40[_0xb32a('0x17')](_0x38c7eb)[_0xb32a('0x18')](_0x5e1ffa);}};}function respondWithFilteredResult(_0x567a18,_0x38578d){return function(_0x3b78bb){if(_0x3b78bb){var _0x481826=typeof _0x38578d[_0xb32a('0x19')]===_0xb32a('0x1a')&&typeof _0x38578d[_0xb32a('0x1b')]===_0xb32a('0x1a');var _0x355e4e=_0x3b78bb[_0xb32a('0x1c')];var _0xfe2080=_0x481826?0x0:_0x38578d[_0xb32a('0x19')];var _0x4e8d06=_0x481826?_0x3b78bb[_0xb32a('0x1c')]:_0x38578d[_0xb32a('0x19')]+_0x38578d[_0xb32a('0x1b')];var _0x1763b6;if(_0x4e8d06>=_0x355e4e){_0x4e8d06=_0x355e4e;_0x1763b6=0xc8;}else{_0x1763b6=0xce;}_0x567a18['status'](_0x1763b6);return _0x567a18[_0xb32a('0x1d')](_0xb32a('0x1e'),_0xfe2080+'-'+_0x4e8d06+'/'+_0x355e4e)['json'](_0x3b78bb);}return null;};}function patchUpdates(_0x4724e1){return function(_0x4ecc0c){try{jsonpatch['apply'](_0x4ecc0c,_0x4724e1,!![]);}catch(_0x40a7b9){return BPromise[_0xb32a('0x1f')](_0x40a7b9);}return _0x4ecc0c['save']();};}function saveUpdates(_0x53f6a4,_0x226f81){return function(_0x23ed03){if(_0x23ed03){return _0x23ed03[_0xb32a('0x20')](_0x53f6a4)[_0xb32a('0x21')](function(_0x17e61f){return _0x17e61f;});}return null;};}function removeEntity(_0x2f5f50,_0x13ba0d){return function(_0x1e1236){if(_0x1e1236){return _0x1e1236[_0xb32a('0x22')]()['then'](function(){_0x2f5f50['status'](0xcc)[_0xb32a('0x23')]();});}};}function handleEntityNotFound(_0x3f5a34,_0x1b8e8e){return function(_0x4e385c){if(!_0x4e385c){_0x3f5a34[_0xb32a('0x16')](0x194);}return _0x4e385c;};}function handleError(_0x5919c6,_0x411055){_0x411055=_0x411055||0x1f4;return function(_0x455f99){logger[_0xb32a('0x24')](_0x455f99[_0xb32a('0x25')]);if(_0x455f99[_0xb32a('0x26')]){delete _0x455f99[_0xb32a('0x26')];}_0x5919c6[_0xb32a('0x17')](_0x411055)[_0xb32a('0x27')](_0x455f99);};}exports[_0xb32a('0x28')]=function(_0x2c1daa,_0x53e705){var _0x12b721={},_0x7a3a69={},_0x2d99a1={'count':0x0,'rows':[]};var _0x25728e=_['map'](db[_0xb32a('0x29')][_0xb32a('0x2a')],function(_0x143cb9){return{'name':_0x143cb9['fieldName'],'type':_0x143cb9[_0xb32a('0x2b')]['key']};});_0x7a3a69[_0xb32a('0x2c')]=_[_0xb32a('0x2d')](_0x25728e,_0xb32a('0x26'));_0x7a3a69[_0xb32a('0x2e')]=_[_0xb32a('0x2f')](_0x2c1daa[_0xb32a('0x2e')]);_0x7a3a69[_0xb32a('0x30')]=_[_0xb32a('0x31')](_0x7a3a69[_0xb32a('0x2c')],_0x7a3a69[_0xb32a('0x2e')]);_0x12b721[_0xb32a('0x32')]=_[_0xb32a('0x31')](_0x7a3a69['model'],qs[_0xb32a('0x33')](_0x2c1daa['query'][_0xb32a('0x33')]));_0x12b721[_0xb32a('0x32')]=_0x12b721['attributes'][_0xb32a('0x34')]?_0x12b721['attributes']:_0x7a3a69[_0xb32a('0x2c')];if(!_0x2c1daa[_0xb32a('0x2e')][_0xb32a('0x35')](_0xb32a('0x36'))){_0x12b721[_0xb32a('0x1b')]=qs[_0xb32a('0x1b')](_0x2c1daa[_0xb32a('0x2e')]['limit']);_0x12b721[_0xb32a('0x19')]=qs[_0xb32a('0x19')](_0x2c1daa['query'][_0xb32a('0x19')]);}_0x12b721['order']=qs[_0xb32a('0x37')](_0x2c1daa[_0xb32a('0x2e')][_0xb32a('0x37')]);_0x12b721[_0xb32a('0x38')]=qs[_0xb32a('0x30')](_[_0xb32a('0x39')](_0x2c1daa['query'],_0x7a3a69[_0xb32a('0x30')]),_0x25728e);if(_0x2c1daa[_0xb32a('0x2e')][_0xb32a('0x3a')]){_0x12b721[_0xb32a('0x38')]=_[_0xb32a('0x3b')](_0x12b721['where'],{'$or':_[_0xb32a('0x2d')](_0x25728e,function(_0x37daab){if(_0x37daab[_0xb32a('0x2b')]!==_0xb32a('0x3c')){var _0x2b2db5={};_0x2b2db5[_0x37daab[_0xb32a('0x26')]]={'$like':'%'+_0x2c1daa['query'][_0xb32a('0x3a')]+'%'};return _0x2b2db5;}})});}_0x12b721=_[_0xb32a('0x3b')]({},_0x12b721,_0x2c1daa[_0xb32a('0x3d')]);var _0x32fd15={'where':_0x12b721['where']};return db[_0xb32a('0x29')]['count'](_0x32fd15)[_0xb32a('0x21')](function(_0x390ee1){_0x2d99a1['count']=_0x390ee1;if(_0x2c1daa[_0xb32a('0x2e')][_0xb32a('0x3e')]){_0x12b721[_0xb32a('0x3f')]=[{'all':!![]}];}return db[_0xb32a('0x29')][_0xb32a('0x40')](_0x12b721);})[_0xb32a('0x21')](function(_0x91a69f){_0x2d99a1[_0xb32a('0x41')]=_0x91a69f;return _0x2d99a1;})[_0xb32a('0x21')](respondWithFilteredResult(_0x53e705,_0x12b721))[_0xb32a('0x42')](handleError(_0x53e705,null));};exports[_0xb32a('0x43')]=function(_0x1a6c1b,_0x25f6f8){var _0x2d3d92={'raw':!![],'where':{'id':_0x1a6c1b[_0xb32a('0x44')]['id']}},_0xcbe63c={};_0xcbe63c[_0xb32a('0x2c')]=_[_0xb32a('0x2f')](db[_0xb32a('0x29')][_0xb32a('0x2a')]);_0xcbe63c[_0xb32a('0x2e')]=_[_0xb32a('0x2f')](_0x1a6c1b['query']);_0xcbe63c[_0xb32a('0x30')]=_[_0xb32a('0x31')](_0xcbe63c[_0xb32a('0x2c')],_0xcbe63c['query']);_0x2d3d92[_0xb32a('0x32')]=_[_0xb32a('0x31')](_0xcbe63c[_0xb32a('0x2c')],qs[_0xb32a('0x33')](_0x1a6c1b[_0xb32a('0x2e')][_0xb32a('0x33')]));_0x2d3d92[_0xb32a('0x32')]=_0x2d3d92[_0xb32a('0x32')][_0xb32a('0x34')]?_0x2d3d92[_0xb32a('0x32')]:_0xcbe63c[_0xb32a('0x2c')];if(_0x1a6c1b[_0xb32a('0x2e')][_0xb32a('0x3e')]){_0x2d3d92['include']=[{'all':!![]}];}_0x2d3d92=_[_0xb32a('0x3b')]({},_0x2d3d92,_0x1a6c1b[_0xb32a('0x3d')]);return db[_0xb32a('0x29')][_0xb32a('0x45')](_0x2d3d92)[_0xb32a('0x21')](handleEntityNotFound(_0x25f6f8,null))['then'](respondWithResult(_0x25f6f8,null))[_0xb32a('0x42')](handleError(_0x25f6f8,null));};exports['create']=function(_0xa4905a,_0x50a5f5){return db[_0xb32a('0x29')][_0xb32a('0x46')](_0xa4905a[_0xb32a('0x47')],{})[_0xb32a('0x21')](respondWithResult(_0x50a5f5,0xc9))[_0xb32a('0x42')](handleError(_0x50a5f5,null));};exports[_0xb32a('0x20')]=function(_0x348648,_0x57a7aa){if(_0x348648[_0xb32a('0x47')]['id']){delete _0x348648['body']['id'];}return db['OpenchannelQueueReport'][_0xb32a('0x45')]({'where':{'id':_0x348648['params']['id']}})[_0xb32a('0x21')](handleEntityNotFound(_0x57a7aa,null))[_0xb32a('0x21')](saveUpdates(_0x348648[_0xb32a('0x47')],null))['then'](respondWithResult(_0x57a7aa,null))[_0xb32a('0x42')](handleError(_0x57a7aa,null));};exports[_0xb32a('0x22')]=function(_0x5f39d1,_0x23becd){return db[_0xb32a('0x29')][_0xb32a('0x45')]({'where':{'id':_0x5f39d1[_0xb32a('0x44')]['id']}})[_0xb32a('0x21')](handleEntityNotFound(_0x23becd,null))[_0xb32a('0x21')](removeEntity(_0x23becd,null))['catch'](handleError(_0x23becd,null));};exports[_0xb32a('0x48')]=function(_0x378a34,_0x56a77a){return db[_0xb32a('0x29')][_0xb32a('0x48')]()[_0xb32a('0x21')](respondWithResult(_0x56a77a,null))[_0xb32a('0x42')](handleError(_0x56a77a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 911256b..f2ebb0a 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(_0x137a2d,_0x4fc1ba){var _0x100036=function(_0x4e8d9f){while(--_0x4e8d9f){_0x137a2d['push'](_0x137a2d['shift']());}};_0x100036(++_0x4fc1ba);}(_0x5fc3,0xa8));var _0x35fc=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x5fc3[_0x425716];return _0x2d39af;};'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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x41ec33,_0x904b4f){var _0x455763=function(_0x49913c){while(--_0x49913c){_0x41ec33['push'](_0x41ec33['shift']());}};_0x455763(++_0x904b4f);}(_0x7a54,0x106));var _0x47a5=function(_0x324f7e,_0x56c8f6){_0x324f7e=_0x324f7e-0x0;var _0x511884=_0x7a54[_0x324f7e];return _0x511884;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 82bacb8..29c1e13 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 _0x937d=['info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x96ae40,_0x56d13b){var _0xbb36e8=function(_0x3651ff){while(--_0x3651ff){_0x96ae40['push'](_0x96ae40['shift']());}};_0xbb36e8(++_0x56d13b);}(_0x937d,0x1f4));var _0xd937=function(_0x3897e5,_0x56aca9){_0x3897e5=_0x3897e5-0x0;var _0x340a00=_0x937d[_0x3897e5];return _0x340a00;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x1'));var fs=require('fs');var Redis=require(_0xd937('0x2'));var db=require(_0xd937('0x3'))['db'];var utils=require(_0xd937('0x4'));var logger=require(_0xd937('0x5'))(_0xd937('0x6'));var config=require('../../config/environment');var jayson=require(_0xd937('0x7'));var client=jayson[_0xd937('0x8')][_0xd937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cd9,_0x2454f9,_0x4dc790){return new BPromise(function(_0x490b1d,_0x372dff){return client[_0xd937('0xa')](_0x4f6cd9,_0x4dc790)[_0xd937('0xb')](function(_0xa97338){logger[_0xd937('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xd937('0xd'));logger['debug'](_0xd937('0xe'),_0x2454f9,'request\x20sent',JSON[_0xd937('0xf')](_0xa97338));if(_0xa97338[_0xd937('0x10')]){if(_0xa97338[_0xd937('0x10')][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x372dff(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0x13'),_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x490b1d(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x13'),_0x2454f9,_0xd937('0xd'));_0x490b1d(_0xa97338[_0xd937('0x14')]['message']);}})[_0xd937('0x15')](function(_0x16d2ba){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0x16d2ba);_0x372dff(_0x16d2ba);});});}exports[_0xd937('0x16')]=function(_0x3d6b1c){var _0x1d1b8b=this;return new Promise(function(_0x1bd7ee,_0x26d5ca){return db[_0xd937('0x17')][_0xd937('0x18')](_0x3d6b1c[_0xd937('0x19')],{'raw':_0x3d6b1c[_0xd937('0x1a')]?_0x3d6b1c[_0xd937('0x1a')][_0xd937('0x1b')]===undefined?!![]:![]:!![]})[_0xd937('0xb')](function(_0x2c18ea){logger[_0xd937('0xc')](_0xd937('0x16'),_0x3d6b1c);logger[_0xd937('0x1c')](_0xd937('0x16'),_0x3d6b1c,JSON['stringify'](_0x2c18ea));_0x1bd7ee(_0x2c18ea);})[_0xd937('0x15')](function(_0x168f3e){logger[_0xd937('0x10')](_0xd937('0x16'),_0x168f3e[_0xd937('0x12')],_0x3d6b1c);_0x26d5ca(_0x1d1b8b[_0xd937('0x10')](0x1f4,_0x168f3e[_0xd937('0x12')]));});});};exports[_0xd937('0x1d')]=function(_0x194fe5){var _0x14b350=this;return new Promise(function(_0x2bbbd4,_0x5b14d0){return db['OpenchannelQueueReport']['update'](_0x194fe5[_0xd937('0x19')],{'raw':_0x194fe5[_0xd937('0x1a')]?_0x194fe5['options'][_0xd937('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')]['where']||null:null,'attributes':_0x194fe5['options']?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1e')]||null:null,'limit':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1f')]||null:null})[_0xd937('0xb')](function(_0x291fb7){logger[_0xd937('0xc')](_0xd937('0x1d'),_0x194fe5);logger[_0xd937('0x1c')](_0xd937('0x1d'),_0x194fe5,JSON['stringify'](_0x291fb7));_0x2bbbd4(_0x291fb7);})[_0xd937('0x15')](function(_0x23b4ef){logger[_0xd937('0x10')](_0xd937('0x1d'),_0x23b4ef['message'],_0x194fe5);_0x5b14d0(_0x14b350[_0xd937('0x10')](0x1f4,_0x23b4ef[_0xd937('0x12')]));});});}; \ No newline at end of file +var _0xd4f4=['options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body'];(function(_0x49ca00,_0x53fa97){var _0x43bca8=function(_0x256ed8){while(--_0x256ed8){_0x49ca00['push'](_0x49ca00['shift']());}};_0x43bca8(++_0x53fa97);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1ac3ff,_0x4e5685){_0x1ac3ff=_0x1ac3ff-0x0;var _0x284b4a=_0xd4f4[_0x1ac3ff];return _0x284b4a;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['OpenchannelQueueReport'][_0x4d4f('0x18')](_0x51dcf1[_0x4d4f('0x19')],{'raw':_0x51dcf1[_0x4d4f('0x1a')]?_0x51dcf1[_0x4d4f('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e1ae2){logger['info'](_0x4d4f('0x17'),_0x51dcf1);logger[_0x4d4f('0x10')](_0x4d4f('0x17'),_0x51dcf1,JSON[_0x4d4f('0x12')](_0x1e1ae2));_0x519501(_0x1e1ae2);})[_0x4d4f('0x16')](function(_0x5beab4){logger['error'](_0x4d4f('0x17'),_0x5beab4['message'],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x5beab4[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x1b')]=function(_0x3f4a55){var _0xf3f7a4=this;return new Promise(function(_0x497cec,_0x44bd2f){return db[_0x4d4f('0x1c')][_0x4d4f('0x1d')](_0x3f4a55[_0x4d4f('0x19')],{'raw':_0x3f4a55['options']?_0x3f4a55['options'][_0x4d4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x1f')]||null:null,'attributes':_0x3f4a55['options']?_0x3f4a55[_0x4d4f('0x1a')][_0x4d4f('0x20')]||null:null,'limit':_0x3f4a55[_0x4d4f('0x1a')]?_0x3f4a55[_0x4d4f('0x1a')]['limit']||null:null})[_0x4d4f('0xc')](function(_0x51cb3d){logger[_0x4d4f('0xd')](_0x4d4f('0x1b'),_0x3f4a55);logger['debug'](_0x4d4f('0x1b'),_0x3f4a55,JSON[_0x4d4f('0x12')](_0x51cb3d));_0x497cec(_0x51cb3d);})[_0x4d4f('0x16')](function(_0x3d7f14){logger[_0x4d4f('0x13')](_0x4d4f('0x1b'),_0x3d7f14['message'],_0x3f4a55);_0x44bd2f(_0xf3f7a4[_0x4d4f('0x13')](0x1f4,_0x3d7f14[_0x4d4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index d0eb3b5..97ef977 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 _0x6c42=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x6c42,0x124));var _0x26c4=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x6c42[_0x3f8743];return _0x1f844c;};'use strict';var multer=require(_0x26c4('0x0'));var util=require(_0x26c4('0x1'));var path=require('path');var timeout=require(_0x26c4('0x2'));var express=require(_0x26c4('0x3'));var router=express[_0x26c4('0x4')]();var fs_extra=require(_0x26c4('0x5'));var auth=require(_0x26c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26c4('0x7'));var controller=require(_0x26c4('0x8'));router[_0x26c4('0x9')]('/',auth[_0x26c4('0xa')](),controller[_0x26c4('0xb')]);router[_0x26c4('0x9')](_0x26c4('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x26c4('0x9')]('/:id',auth[_0x26c4('0xa')](),controller[_0x26c4('0xd')]);router[_0x26c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x26c4('0xf')]);router[_0x26c4('0x10')](_0x26c4('0x11'),auth[_0x26c4('0xa')](),controller[_0x26c4('0x12')]);router[_0x26c4('0x13')](_0x26c4('0x11'),auth['isAuthenticated'](),controller[_0x26c4('0x14')]);module[_0x26c4('0x15')]=router; \ No newline at end of file +var _0x2731=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','put','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x2731,0xba));var _0x1273=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2731[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1273('0x0'));var util=require(_0x1273('0x1'));var path=require('path');var timeout=require(_0x1273('0x2'));var express=require(_0x1273('0x3'));var router=express[_0x1273('0x4')]();var fs_extra=require(_0x1273('0x5'));var auth=require(_0x1273('0x6'));var interaction=require(_0x1273('0x7'));var config=require(_0x1273('0x8'));var controller=require('./openchannelTransferReport.controller');router[_0x1273('0x9')]('/',auth[_0x1273('0xa')](),controller['index']);router[_0x1273('0x9')](_0x1273('0xb'),auth[_0x1273('0xa')](),controller[_0x1273('0xc')]);router[_0x1273('0x9')](_0x1273('0xd'),auth[_0x1273('0xa')](),controller[_0x1273('0xe')]);router['post']('/',auth[_0x1273('0xa')](),controller['create']);router[_0x1273('0xf')](_0x1273('0xd'),auth[_0x1273('0xa')](),controller['update']);router['delete'](_0x1273('0xd'),auth[_0x1273('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index eefee4d..fed2e80 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xdf34d6,_0x4ecc11){var _0x52e2f0=function(_0x146ad7){while(--_0x146ad7){_0xdf34d6['push'](_0xdf34d6['shift']());}};_0x52e2f0(++_0x4ecc11);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xcb91[_0x2d2c16];return _0x53f2fb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xf8bba,_0x2ca2bc){var _0x414766=function(_0x373ec8){while(--_0x373ec8){_0xf8bba['push'](_0xf8bba['shift']());}};_0x414766(++_0x2ca2bc);}(_0xf4eb,0xec));var _0xbf4e=function(_0xa769c4,_0x2ab319){_0xa769c4=_0xa769c4-0x0;var _0x185412=_0xf4eb[_0xa769c4];return _0x185412;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 47b0eb0..d47819b 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 _0x710d=['OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','end','error','stack','name','send','map'];(function(_0x4d8f12,_0x4bf1e7){var _0x2d8647=function(_0x2506b7){while(--_0x2506b7){_0x4d8f12['push'](_0x4d8f12['shift']());}};_0x2d8647(++_0x4bf1e7);}(_0x710d,0x19d));var _0xd710=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x710d[_0x2e4cbf];return _0x52840f;};'use strict';var emlformat=require(_0xd710('0x0'));var rimraf=require(_0xd710('0x1'));var zipdir=require(_0xd710('0x2'));var jsonpatch=require(_0xd710('0x3'));var rp=require(_0xd710('0x4'));var moment=require(_0xd710('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd710('0x6'));var util=require(_0xd710('0x7'));var path=require('path');var sox=require(_0xd710('0x8'));var csv=require(_0xd710('0x9'));var ejs=require(_0xd710('0xa'));var fs=require('fs');var fs_extra=require(_0xd710('0xb'));var _=require('lodash');var squel=require(_0xd710('0xc'));var crypto=require('crypto');var jsforce=require(_0xd710('0xd'));var deskjs=require(_0xd710('0xe'));var toCsv=require(_0xd710('0x9'));var querystring=require('querystring');var Papa=require(_0xd710('0xf'));var Redis=require(_0xd710('0x10'));var authService=require(_0xd710('0x11'));var qs=require(_0xd710('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd710('0x13'));var logger=require(_0xd710('0x14'))(_0xd710('0x15'));var utils=require(_0xd710('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd710('0x17'));var db=require(_0xd710('0x18'))['db'];function respondWithStatusCode(_0x57725d,_0x509360){_0x509360=_0x509360||0xcc;return function(_0x22d884){if(_0x22d884){return _0x57725d[_0xd710('0x19')](_0x509360);}return _0x57725d[_0xd710('0x1a')](_0x509360)['end']();};}function respondWithResult(_0x37ab3d,_0xbd929a){_0xbd929a=_0xbd929a||0xc8;return function(_0x251fc5){if(_0x251fc5){return _0x37ab3d[_0xd710('0x1a')](_0xbd929a)[_0xd710('0x1b')](_0x251fc5);}};}function respondWithFilteredResult(_0x22c502,_0x189d1a){return function(_0x79e5f6){if(_0x79e5f6){var _0x3956a5=typeof _0x189d1a['offset']===_0xd710('0x1c')&&typeof _0x189d1a[_0xd710('0x1d')]===_0xd710('0x1c');var _0x312233=_0x79e5f6['count'];var _0x177df9=_0x3956a5?0x0:_0x189d1a[_0xd710('0x1e')];var _0x19ed9c=_0x3956a5?_0x79e5f6[_0xd710('0x1f')]:_0x189d1a[_0xd710('0x1e')]+_0x189d1a['limit'];var _0x212f6d;if(_0x19ed9c>=_0x312233){_0x19ed9c=_0x312233;_0x212f6d=0xc8;}else{_0x212f6d=0xce;}_0x22c502[_0xd710('0x1a')](_0x212f6d);return _0x22c502['set'](_0xd710('0x20'),_0x177df9+'-'+_0x19ed9c+'/'+_0x312233)['json'](_0x79e5f6);}return null;};}function patchUpdates(_0x2319bd){return function(_0x333aeb){try{jsonpatch[_0xd710('0x21')](_0x333aeb,_0x2319bd,!![]);}catch(_0x392dbd){return BPromise['reject'](_0x392dbd);}return _0x333aeb[_0xd710('0x22')]();};}function saveUpdates(_0x2d87f0,_0x5cc652){return function(_0x26c2c2){if(_0x26c2c2){return _0x26c2c2[_0xd710('0x23')](_0x2d87f0)[_0xd710('0x24')](function(_0x6d6b51){return _0x6d6b51;});}return null;};}function removeEntity(_0x4b2b78,_0x360bf0){return function(_0x270111){if(_0x270111){return _0x270111['destroy']()[_0xd710('0x24')](function(){_0x4b2b78[_0xd710('0x1a')](0xcc)[_0xd710('0x25')]();});}};}function handleEntityNotFound(_0x3fd611,_0x13ffc0){return function(_0x32bfb2){if(!_0x32bfb2){_0x3fd611['sendStatus'](0x194);}return _0x32bfb2;};}function handleError(_0x54a3d2,_0xd81ef5){_0xd81ef5=_0xd81ef5||0x1f4;return function(_0x1b4a4e){logger[_0xd710('0x26')](_0x1b4a4e[_0xd710('0x27')]);if(_0x1b4a4e['name']){delete _0x1b4a4e[_0xd710('0x28')];}_0x54a3d2[_0xd710('0x1a')](_0xd81ef5)[_0xd710('0x29')](_0x1b4a4e);};}exports['index']=function(_0x5c4b40,_0x22096e){var _0x6ec522={},_0x3bb7f3={},_0x525d19={'count':0x0,'rows':[]};var _0x5230c8=_[_0xd710('0x2a')](db[_0xd710('0x2b')][_0xd710('0x2c')],function(_0x11be0b){return{'name':_0x11be0b[_0xd710('0x2d')],'type':_0x11be0b[_0xd710('0x2e')][_0xd710('0x2f')]};});_0x3bb7f3[_0xd710('0x30')]=_[_0xd710('0x2a')](_0x5230c8,_0xd710('0x28'));_0x3bb7f3['query']=_[_0xd710('0x31')](_0x5c4b40['query']);_0x3bb7f3[_0xd710('0x32')]=_[_0xd710('0x33')](_0x3bb7f3[_0xd710('0x30')],_0x3bb7f3[_0xd710('0x34')]);_0x6ec522['attributes']=_[_0xd710('0x33')](_0x3bb7f3[_0xd710('0x30')],qs[_0xd710('0x35')](_0x5c4b40[_0xd710('0x34')]['fields']));_0x6ec522[_0xd710('0x36')]=_0x6ec522[_0xd710('0x36')][_0xd710('0x37')]?_0x6ec522[_0xd710('0x36')]:_0x3bb7f3[_0xd710('0x30')];if(!_0x5c4b40[_0xd710('0x34')][_0xd710('0x38')](_0xd710('0x39'))){_0x6ec522['limit']=qs[_0xd710('0x1d')](_0x5c4b40[_0xd710('0x34')]['limit']);_0x6ec522[_0xd710('0x1e')]=qs['offset'](_0x5c4b40[_0xd710('0x34')][_0xd710('0x1e')]);}_0x6ec522[_0xd710('0x3a')]=qs[_0xd710('0x3b')](_0x5c4b40[_0xd710('0x34')]['sort']);_0x6ec522[_0xd710('0x3c')]=qs['filters'](_[_0xd710('0x3d')](_0x5c4b40[_0xd710('0x34')],_0x3bb7f3[_0xd710('0x32')]),_0x5230c8);if(_0x5c4b40[_0xd710('0x34')]['filter']){_0x6ec522['where']=_[_0xd710('0x3e')](_0x6ec522[_0xd710('0x3c')],{'$or':_[_0xd710('0x2a')](_0x5230c8,function(_0x38d138){if(_0x38d138[_0xd710('0x2e')]!=='VIRTUAL'){var _0x352a20={};_0x352a20[_0x38d138[_0xd710('0x28')]]={'$like':'%'+_0x5c4b40[_0xd710('0x34')][_0xd710('0x3f')]+'%'};return _0x352a20;}})});}_0x6ec522=_[_0xd710('0x3e')]({},_0x6ec522,_0x5c4b40['options']);var _0x3a4e12={'where':_0x6ec522[_0xd710('0x3c')]};return db[_0xd710('0x2b')][_0xd710('0x1f')](_0x3a4e12)[_0xd710('0x24')](function(_0x319c45){_0x525d19[_0xd710('0x1f')]=_0x319c45;if(_0x5c4b40[_0xd710('0x34')][_0xd710('0x40')]){_0x6ec522[_0xd710('0x41')]=[{'all':!![]}];}return db[_0xd710('0x2b')][_0xd710('0x42')](_0x6ec522);})[_0xd710('0x24')](function(_0x5e5ce1){_0x525d19[_0xd710('0x43')]=_0x5e5ce1;return _0x525d19;})[_0xd710('0x24')](respondWithFilteredResult(_0x22096e,_0x6ec522))[_0xd710('0x44')](handleError(_0x22096e,null));};exports[_0xd710('0x45')]=function(_0x48092e,_0x339db0){var _0x5b1cab={'raw':!![],'where':{'id':_0x48092e[_0xd710('0x46')]['id']}},_0x2d4630={};_0x2d4630[_0xd710('0x30')]=_[_0xd710('0x31')](db['OpenchannelTransferReport'][_0xd710('0x2c')]);_0x2d4630[_0xd710('0x34')]=_[_0xd710('0x31')](_0x48092e[_0xd710('0x34')]);_0x2d4630[_0xd710('0x32')]=_['intersection'](_0x2d4630[_0xd710('0x30')],_0x2d4630[_0xd710('0x34')]);_0x5b1cab['attributes']=_[_0xd710('0x33')](_0x2d4630[_0xd710('0x30')],qs[_0xd710('0x35')](_0x48092e[_0xd710('0x34')][_0xd710('0x35')]));_0x5b1cab[_0xd710('0x36')]=_0x5b1cab['attributes'][_0xd710('0x37')]?_0x5b1cab[_0xd710('0x36')]:_0x2d4630[_0xd710('0x30')];if(_0x48092e[_0xd710('0x34')][_0xd710('0x40')]){_0x5b1cab[_0xd710('0x41')]=[{'all':!![]}];}_0x5b1cab=_[_0xd710('0x3e')]({},_0x5b1cab,_0x48092e['options']);return db['OpenchannelTransferReport']['find'](_0x5b1cab)['then'](handleEntityNotFound(_0x339db0,null))[_0xd710('0x24')](respondWithResult(_0x339db0,null))[_0xd710('0x44')](handleError(_0x339db0,null));};exports[_0xd710('0x47')]=function(_0x5d00bd,_0x52ceaa){return db['OpenchannelTransferReport'][_0xd710('0x47')](_0x5d00bd['body'],{})[_0xd710('0x24')](respondWithResult(_0x52ceaa,0xc9))[_0xd710('0x44')](handleError(_0x52ceaa,null));};exports[_0xd710('0x23')]=function(_0x142d8f,_0x3a1ee5){if(_0x142d8f[_0xd710('0x48')]['id']){delete _0x142d8f['body']['id'];}return db[_0xd710('0x2b')][_0xd710('0x49')]({'where':{'id':_0x142d8f[_0xd710('0x46')]['id']}})[_0xd710('0x24')](handleEntityNotFound(_0x3a1ee5,null))[_0xd710('0x24')](saveUpdates(_0x142d8f[_0xd710('0x48')],null))[_0xd710('0x24')](respondWithResult(_0x3a1ee5,null))[_0xd710('0x44')](handleError(_0x3a1ee5,null));};exports[_0xd710('0x4a')]=function(_0x166ff0,_0x571907){return db[_0xd710('0x2b')][_0xd710('0x49')]({'where':{'id':_0x166ff0['params']['id']}})[_0xd710('0x24')](handleEntityNotFound(_0x571907,null))[_0xd710('0x24')](removeEntity(_0x571907,null))[_0xd710('0x44')](handleError(_0x571907,null));};exports['describe']=function(_0x5f533a,_0x56fb9a){return db[_0xd710('0x2b')][_0xd710('0x4b')]()[_0xd710('0x24')](respondWithResult(_0x56fb9a,null))[_0xd710('0x44')](handleError(_0x56fb9a,null));}; \ No newline at end of file +var _0xdd5c=['create','body','find','params','describe','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','length','catch'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xdd5c,0xda));var _0xcdd5=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0xdd5c[_0x538c70];return _0x42ae01;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdd5('0x0'));var rp=require(_0xcdd5('0x1'));var moment=require(_0xcdd5('0x2'));var BPromise=require(_0xcdd5('0x3'));var Mustache=require('mustache');var util=require(_0xcdd5('0x4'));var path=require(_0xcdd5('0x5'));var sox=require(_0xcdd5('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd5('0x7'));var _=require(_0xcdd5('0x8'));var squel=require(_0xcdd5('0x9'));var crypto=require(_0xcdd5('0xa'));var jsforce=require(_0xcdd5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcdd5('0xc'));var querystring=require('querystring');var Papa=require(_0xcdd5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcdd5('0xe'));var as=require(_0xcdd5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdd5('0x10'))(_0xcdd5('0x11'));var utils=require('../../config/utils');var config=require(_0xcdd5('0x12'));var licenseUtil=require(_0xcdd5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11eb29,_0x523ed9){_0x523ed9=_0x523ed9||0xcc;return function(_0x4a0522){if(_0x4a0522){return _0x11eb29[_0xcdd5('0x14')](_0x523ed9);}return _0x11eb29[_0xcdd5('0x15')](_0x523ed9)[_0xcdd5('0x16')]();};}function respondWithResult(_0x368038,_0x2a2913){_0x2a2913=_0x2a2913||0xc8;return function(_0x8ea961){if(_0x8ea961){return _0x368038[_0xcdd5('0x15')](_0x2a2913)[_0xcdd5('0x17')](_0x8ea961);}};}function respondWithFilteredResult(_0x1102d3,_0x5235a3){return function(_0x22f50d){if(_0x22f50d){var _0x1fb4f9=typeof _0x5235a3[_0xcdd5('0x18')]===_0xcdd5('0x19')&&typeof _0x5235a3[_0xcdd5('0x1a')]==='undefined';var _0x49add4=_0x22f50d[_0xcdd5('0x1b')];var _0x5af3f3=_0x1fb4f9?0x0:_0x5235a3[_0xcdd5('0x18')];var _0x22a77e=_0x1fb4f9?_0x22f50d['count']:_0x5235a3['offset']+_0x5235a3['limit'];var _0x50e2f2;if(_0x22a77e>=_0x49add4){_0x22a77e=_0x49add4;_0x50e2f2=0xc8;}else{_0x50e2f2=0xce;}_0x1102d3['status'](_0x50e2f2);return _0x1102d3[_0xcdd5('0x1c')](_0xcdd5('0x1d'),_0x5af3f3+'-'+_0x22a77e+'/'+_0x49add4)[_0xcdd5('0x17')](_0x22f50d);}return null;};}function patchUpdates(_0x567844){return function(_0x174af0){try{jsonpatch[_0xcdd5('0x1e')](_0x174af0,_0x567844,!![]);}catch(_0x3b92f2){return BPromise[_0xcdd5('0x1f')](_0x3b92f2);}return _0x174af0[_0xcdd5('0x20')]();};}function saveUpdates(_0x57bd74,_0x5f374f){return function(_0x4d9a4d){if(_0x4d9a4d){return _0x4d9a4d[_0xcdd5('0x21')](_0x57bd74)[_0xcdd5('0x22')](function(_0x38eb5e){return _0x38eb5e;});}return null;};}function removeEntity(_0x118d1e,_0xd7315c){return function(_0x3ee6b2){if(_0x3ee6b2){return _0x3ee6b2[_0xcdd5('0x23')]()[_0xcdd5('0x22')](function(){_0x118d1e['status'](0xcc)[_0xcdd5('0x16')]();});}};}function handleEntityNotFound(_0x47c50f,_0x257f2c){return function(_0x44f391){if(!_0x44f391){_0x47c50f[_0xcdd5('0x14')](0x194);}return _0x44f391;};}function handleError(_0x3a7b7b,_0xf4e941){_0xf4e941=_0xf4e941||0x1f4;return function(_0x21c8c5){logger['error'](_0x21c8c5[_0xcdd5('0x24')]);if(_0x21c8c5['name']){delete _0x21c8c5[_0xcdd5('0x25')];}_0x3a7b7b[_0xcdd5('0x15')](_0xf4e941)[_0xcdd5('0x26')](_0x21c8c5);};}exports[_0xcdd5('0x27')]=function(_0x353046,_0x4c9cc0){var _0x3fa64f={},_0x368d23={},_0x52593f={'count':0x0,'rows':[]};var _0x136fd8=_[_0xcdd5('0x28')](db[_0xcdd5('0x29')][_0xcdd5('0x2a')],function(_0x20f8c8){return{'name':_0x20f8c8[_0xcdd5('0x2b')],'type':_0x20f8c8['type']['key']};});_0x368d23[_0xcdd5('0x2c')]=_[_0xcdd5('0x28')](_0x136fd8,'name');_0x368d23['query']=_[_0xcdd5('0x2d')](_0x353046[_0xcdd5('0x2e')]);_0x368d23[_0xcdd5('0x2f')]=_['intersection'](_0x368d23['model'],_0x368d23[_0xcdd5('0x2e')]);_0x3fa64f[_0xcdd5('0x30')]=_[_0xcdd5('0x31')](_0x368d23[_0xcdd5('0x2c')],qs['fields'](_0x353046[_0xcdd5('0x2e')][_0xcdd5('0x32')]));_0x3fa64f[_0xcdd5('0x30')]=_0x3fa64f[_0xcdd5('0x30')]['length']?_0x3fa64f[_0xcdd5('0x30')]:_0x368d23[_0xcdd5('0x2c')];if(!_0x353046['query'][_0xcdd5('0x33')](_0xcdd5('0x34'))){_0x3fa64f[_0xcdd5('0x1a')]=qs[_0xcdd5('0x1a')](_0x353046[_0xcdd5('0x2e')][_0xcdd5('0x1a')]);_0x3fa64f['offset']=qs[_0xcdd5('0x18')](_0x353046[_0xcdd5('0x2e')][_0xcdd5('0x18')]);}_0x3fa64f['order']=qs['sort'](_0x353046['query'][_0xcdd5('0x35')]);_0x3fa64f[_0xcdd5('0x36')]=qs['filters'](_['pick'](_0x353046[_0xcdd5('0x2e')],_0x368d23[_0xcdd5('0x2f')]),_0x136fd8);if(_0x353046['query'][_0xcdd5('0x37')]){_0x3fa64f[_0xcdd5('0x36')]=_['merge'](_0x3fa64f[_0xcdd5('0x36')],{'$or':_[_0xcdd5('0x28')](_0x136fd8,function(_0x533859){if(_0x533859[_0xcdd5('0x38')]!==_0xcdd5('0x39')){var _0x3ed0d9={};_0x3ed0d9[_0x533859[_0xcdd5('0x25')]]={'$like':'%'+_0x353046['query'][_0xcdd5('0x37')]+'%'};return _0x3ed0d9;}})});}_0x3fa64f=_[_0xcdd5('0x3a')]({},_0x3fa64f,_0x353046[_0xcdd5('0x3b')]);var _0x6aed14={'where':_0x3fa64f[_0xcdd5('0x36')]};return db[_0xcdd5('0x29')][_0xcdd5('0x1b')](_0x6aed14)['then'](function(_0x4574ca){_0x52593f['count']=_0x4574ca;if(_0x353046['query'][_0xcdd5('0x3c')]){_0x3fa64f[_0xcdd5('0x3d')]=[{'all':!![]}];}return db[_0xcdd5('0x29')][_0xcdd5('0x3e')](_0x3fa64f);})[_0xcdd5('0x22')](function(_0x2acdc0){_0x52593f['rows']=_0x2acdc0;return _0x52593f;})[_0xcdd5('0x22')](respondWithFilteredResult(_0x4c9cc0,_0x3fa64f))['catch'](handleError(_0x4c9cc0,null));};exports[_0xcdd5('0x3f')]=function(_0x3f8027,_0x5f0ed8){var _0x5982a8={'raw':!![],'where':{'id':_0x3f8027['params']['id']}},_0x16e1a1={};_0x16e1a1[_0xcdd5('0x2c')]=_[_0xcdd5('0x2d')](db[_0xcdd5('0x29')][_0xcdd5('0x2a')]);_0x16e1a1[_0xcdd5('0x2e')]=_['keys'](_0x3f8027[_0xcdd5('0x2e')]);_0x16e1a1['filters']=_[_0xcdd5('0x31')](_0x16e1a1[_0xcdd5('0x2c')],_0x16e1a1['query']);_0x5982a8[_0xcdd5('0x30')]=_['intersection'](_0x16e1a1['model'],qs[_0xcdd5('0x32')](_0x3f8027[_0xcdd5('0x2e')][_0xcdd5('0x32')]));_0x5982a8['attributes']=_0x5982a8[_0xcdd5('0x30')][_0xcdd5('0x40')]?_0x5982a8[_0xcdd5('0x30')]:_0x16e1a1[_0xcdd5('0x2c')];if(_0x3f8027[_0xcdd5('0x2e')][_0xcdd5('0x3c')]){_0x5982a8[_0xcdd5('0x3d')]=[{'all':!![]}];}_0x5982a8=_[_0xcdd5('0x3a')]({},_0x5982a8,_0x3f8027[_0xcdd5('0x3b')]);return db[_0xcdd5('0x29')]['find'](_0x5982a8)[_0xcdd5('0x22')](handleEntityNotFound(_0x5f0ed8,null))['then'](respondWithResult(_0x5f0ed8,null))[_0xcdd5('0x41')](handleError(_0x5f0ed8,null));};exports[_0xcdd5('0x42')]=function(_0x240798,_0x422a39){return db[_0xcdd5('0x29')][_0xcdd5('0x42')](_0x240798[_0xcdd5('0x43')],{})[_0xcdd5('0x22')](respondWithResult(_0x422a39,0xc9))[_0xcdd5('0x41')](handleError(_0x422a39,null));};exports['update']=function(_0x475299,_0x11b26a){if(_0x475299[_0xcdd5('0x43')]['id']){delete _0x475299[_0xcdd5('0x43')]['id'];}return db[_0xcdd5('0x29')][_0xcdd5('0x44')]({'where':{'id':_0x475299['params']['id']}})[_0xcdd5('0x22')](handleEntityNotFound(_0x11b26a,null))[_0xcdd5('0x22')](saveUpdates(_0x475299[_0xcdd5('0x43')],null))[_0xcdd5('0x22')](respondWithResult(_0x11b26a,null))['catch'](handleError(_0x11b26a,null));};exports['destroy']=function(_0x70eac9,_0x250d4b){return db[_0xcdd5('0x29')][_0xcdd5('0x44')]({'where':{'id':_0x70eac9[_0xcdd5('0x45')]['id']}})[_0xcdd5('0x22')](handleEntityNotFound(_0x250d4b,null))['then'](removeEntity(_0x250d4b,null))['catch'](handleError(_0x250d4b,null));};exports[_0xcdd5('0x46')]=function(_0x2a5a44,_0x2ad67f){return db[_0xcdd5('0x29')][_0xcdd5('0x46')]()[_0xcdd5('0x22')](respondWithResult(_0x2ad67f,null))[_0xcdd5('0x41')](handleError(_0x2ad67f,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 8ec797f..37b5212 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 _0xf837=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x2efc80,_0x8d7f41){var _0xfb2076=function(_0x2f0eea){while(--_0x2f0eea){_0x2efc80['push'](_0x2efc80['shift']());}};_0xfb2076(++_0x8d7f41);}(_0xf837,0x166));var _0x7f83=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0xf837[_0x31b57a];return _0x2df3dd;};'use strict';var _=require(_0x7f83('0x0'));var util=require(_0x7f83('0x1'));var logger=require(_0x7f83('0x2'))(_0x7f83('0x3'));var moment=require(_0x7f83('0x4'));var BPromise=require(_0x7f83('0x5'));var rp=require(_0x7f83('0x6'));var fs=require('fs');var path=require(_0x7f83('0x7'));var rimraf=require(_0x7f83('0x8'));var config=require(_0x7f83('0x9'));var attributes=require(_0x7f83('0xa'));module[_0x7f83('0xb')]=function(_0x1fb15f,_0x1e1ea0){return _0x1fb15f['define'](_0x7f83('0xc'),attributes,{'tableName':_0x7f83('0xd'),'paranoid':![],'indexes':[{'name':_0x7f83('0xe'),'fields':[_0x7f83('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3cb1=['util','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash'];(function(_0x2415ad,_0x2fc4bb){var _0x3debf9=function(_0x5f0e05){while(--_0x5f0e05){_0x2415ad['push'](_0x2415ad['shift']());}};_0x3debf9(++_0x2fc4bb);}(_0x3cb1,0xdc));var _0x13cb=function(_0x132a2a,_0x42c807){_0x132a2a=_0x132a2a-0x0;var _0x3b1ade=_0x3cb1[_0x132a2a];return _0x3b1ade;};'use strict';var _=require(_0x13cb('0x0'));var util=require(_0x13cb('0x1'));var logger=require('../../config/logger')(_0x13cb('0x2'));var moment=require(_0x13cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x13cb('0x4'));var fs=require('fs');var path=require(_0x13cb('0x5'));var rimraf=require(_0x13cb('0x6'));var config=require(_0x13cb('0x7'));var attributes=require(_0x13cb('0x8'));module[_0x13cb('0x9')]=function(_0x263dd7,_0x302f42){return _0x263dd7[_0x13cb('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x13cb('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x13cb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3a068b2..4c163a4 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 _0x2e65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x46acfb,_0x3bb7e5){var _0x143806=function(_0x25b17b){while(--_0x25b17b){_0x46acfb['push'](_0x46acfb['shift']());}};_0x143806(++_0x3bb7e5);}(_0x2e65,0x193));var _0x52e6=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x2e65[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});} \ No newline at end of file +var _0xfd6e=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','rpc','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49e68f,_0x21fa6b){var _0x351589=function(_0x88157b){while(--_0x88157b){_0x49e68f['push'](_0x49e68f['shift']());}};_0x351589(++_0x21fa6b);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefd6('0x0'));var util=require('util');var moment=require(_0xefd6('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd6('0x2'));var fs=require('fs');var Redis=require(_0xefd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefd6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xefd6('0x5')][_0xefd6('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x26e108,_0xe477f9,_0x340765){return new BPromise(function(_0x5da399,_0x59c636){return client[_0xefd6('0x7')](_0x26e108,_0x340765)[_0xefd6('0x8')](function(_0x3c941a){logger['info'](_0xefd6('0x9'),_0xe477f9,_0xefd6('0xa'));logger[_0xefd6('0xb')](_0xefd6('0xc'),_0xe477f9,'request\x20sent',JSON[_0xefd6('0xd')](_0x3c941a));if(_0x3c941a[_0xefd6('0xe')]){if(_0x3c941a[_0xefd6('0xe')][_0xefd6('0xf')]===0x1f4){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x59c636(_0x3c941a['error'][_0xefd6('0x10')]);}logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x3c941a[_0xefd6('0xe')][_0xefd6('0x10')]);return _0x5da399(_0x3c941a['error'][_0xefd6('0x10')]);}else{logger['info'](_0xefd6('0x9'),_0xe477f9,'request\x20sent');_0x5da399(_0x3c941a[_0xefd6('0x11')][_0xefd6('0x10')]);}})['catch'](function(_0x17bf20){logger[_0xefd6('0xe')](_0xefd6('0x9'),_0xe477f9,_0x17bf20);_0x59c636(_0x17bf20);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f2ac891..6163486 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 _0x2a4c=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0x58f2d0,_0x12906f){var _0x5b4cdb=function(_0xd9b4da){while(--_0xd9b4da){_0x58f2d0['push'](_0x58f2d0['shift']());}};_0x5b4cdb(++_0x12906f);}(_0x2a4c,0x148));var _0xc2a4=function(_0x20c62a,_0x41a155){_0x20c62a=_0x20c62a-0x0;var _0x3e48c7=_0x2a4c[_0x20c62a];return _0x3e48c7;};'use strict';var multer=require(_0xc2a4('0x0'));var util=require(_0xc2a4('0x1'));var path=require(_0xc2a4('0x2'));var timeout=require(_0xc2a4('0x3'));var express=require(_0xc2a4('0x4'));var router=express[_0xc2a4('0x5')]();var fs_extra=require(_0xc2a4('0x6'));var auth=require(_0xc2a4('0x7'));var interaction=require(_0xc2a4('0x8'));var config=require('../../config/environment');var controller=require(_0xc2a4('0x9'));router[_0xc2a4('0xa')]('/',auth[_0xc2a4('0xb')](),controller['index']);router[_0xc2a4('0xa')]('/:id',auth[_0xc2a4('0xb')](),controller[_0xc2a4('0xc')]);router[_0xc2a4('0xd')]('/',auth['isAuthenticated'](),controller[_0xc2a4('0xe')]);router[_0xc2a4('0xf')]('/:id',auth[_0xc2a4('0xb')](),controller[_0xc2a4('0x10')]);router['delete'](_0xc2a4('0x11'),auth[_0xc2a4('0xb')](),controller[_0xc2a4('0x12')]);module[_0xc2a4('0x13')]=router; \ No newline at end of file +var _0x05f7=['Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x05f7,0xb9));var _0x705f=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0x05f7[_0x3d8ca8];return _0x517e45;};'use strict';var multer=require(_0x705f('0x0'));var util=require(_0x705f('0x1'));var path=require(_0x705f('0x2'));var timeout=require(_0x705f('0x3'));var express=require(_0x705f('0x4'));var router=express[_0x705f('0x5')]();var fs_extra=require(_0x705f('0x6'));var auth=require(_0x705f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x705f('0x8'));var controller=require(_0x705f('0x9'));router[_0x705f('0xa')]('/',auth[_0x705f('0xb')](),controller[_0x705f('0xc')]);router['get'](_0x705f('0xd'),auth[_0x705f('0xb')](),controller[_0x705f('0xe')]);router[_0x705f('0xf')]('/',auth[_0x705f('0xb')](),controller['create']);router[_0x705f('0x10')](_0x705f('0xd'),auth[_0x705f('0xb')](),controller[_0x705f('0x11')]);router['delete']('/:id',auth[_0x705f('0xb')](),controller[_0x705f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f5a097a..868361c 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 _0x0bd6=['name','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0bd6,0x107));var _0x60bd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0bd6[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x60bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x60bd('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf58b=['STRING','name','exports'];(function(_0x1f5236,_0xea7afc){var _0x2efe18=function(_0x1457e4){while(--_0x1457e4){_0x1f5236['push'](_0x1f5236['shift']());}};_0x2efe18(++_0xea7afc);}(_0xf58b,0x1d3));var _0xbf58=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0xf58b[_0x233716];return _0x302298;};'use strict';var Sequelize=require('sequelize');module[_0xbf58('0x0')]={'name':{'type':Sequelize[_0xbf58('0x1')],'unique':_0xbf58('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbf58('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1860974..4d6ba22 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 _0x099d=['filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','error','stack','name','Pause','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1ab499,_0x55db28){var _0x387e12=function(_0x1dec33){while(--_0x1dec33){_0x1ab499['push'](_0x1ab499['shift']());}};_0x387e12(++_0x55db28);}(_0x099d,0x15c));var _0xd099=function(_0x3f678e,_0x22b9b8){_0x3f678e=_0x3f678e-0x0;var _0xf4160e=_0x099d[_0x3f678e];return _0xf4160e;};'use strict';var emlformat=require(_0xd099('0x0'));var rimraf=require(_0xd099('0x1'));var zipdir=require(_0xd099('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd099('0x3'));var moment=require(_0xd099('0x4'));var BPromise=require(_0xd099('0x5'));var Mustache=require(_0xd099('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd099('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd099('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd099('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd099('0xa'));var toCsv=require(_0xd099('0x7'));var querystring=require(_0xd099('0xb'));var Papa=require(_0xd099('0xc'));var Redis=require(_0xd099('0xd'));var authService=require(_0xd099('0xe'));var qs=require(_0xd099('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd099('0x10'));var logger=require(_0xd099('0x11'))('api');var utils=require(_0xd099('0x12'));var config=require(_0xd099('0x13'));var licenseUtil=require(_0xd099('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284cf0,_0x31f2c8){_0x31f2c8=_0x31f2c8||0xcc;return function(_0x5d717e){if(_0x5d717e){return _0x284cf0[_0xd099('0x15')](_0x31f2c8);}return _0x284cf0[_0xd099('0x16')](_0x31f2c8)['end']();};}function respondWithResult(_0x59fb7c,_0x51f984){_0x51f984=_0x51f984||0xc8;return function(_0x4780da){if(_0x4780da){return _0x59fb7c[_0xd099('0x16')](_0x51f984)[_0xd099('0x17')](_0x4780da);}};}function respondWithFilteredResult(_0x51cb5a,_0x2a466b){return function(_0x2942df){if(_0x2942df){var _0x335564=typeof _0x2a466b[_0xd099('0x18')]==='undefined'&&typeof _0x2a466b['limit']==='undefined';var _0xbd8ed1=_0x2942df[_0xd099('0x19')];var _0x1fee48=_0x335564?0x0:_0x2a466b[_0xd099('0x18')];var _0x3464c4=_0x335564?_0x2942df[_0xd099('0x19')]:_0x2a466b[_0xd099('0x18')]+_0x2a466b[_0xd099('0x1a')];var _0x5629a7;if(_0x3464c4>=_0xbd8ed1){_0x3464c4=_0xbd8ed1;_0x5629a7=0xc8;}else{_0x5629a7=0xce;}_0x51cb5a[_0xd099('0x16')](_0x5629a7);return _0x51cb5a[_0xd099('0x1b')](_0xd099('0x1c'),_0x1fee48+'-'+_0x3464c4+'/'+_0xbd8ed1)['json'](_0x2942df);}return null;};}function patchUpdates(_0x271248){return function(_0x46d80d){try{jsonpatch[_0xd099('0x1d')](_0x46d80d,_0x271248,!![]);}catch(_0x2993b9){return BPromise[_0xd099('0x1e')](_0x2993b9);}return _0x46d80d['save']();};}function saveUpdates(_0x7c3c9f,_0x19ad54){return function(_0x26c63d){if(_0x26c63d){return _0x26c63d[_0xd099('0x1f')](_0x7c3c9f)[_0xd099('0x20')](function(_0x539974){return _0x539974;});}return null;};}function removeEntity(_0x404a35,_0x22cd1b){return function(_0x5e740d){if(_0x5e740d){return _0x5e740d[_0xd099('0x21')]()[_0xd099('0x20')](function(){var _0x55a3e8=_0x5e740d['get']({'plain':!![]});var _0x1594bd='Pauses';return db[_0xd099('0x22')][_0xd099('0x21')]({'where':{'type':_0x1594bd,'resourceId':_0x55a3e8['id']}})[_0xd099('0x20')](function(){return _0x5e740d;});})[_0xd099('0x20')](function(){_0x404a35[_0xd099('0x16')](0xcc)[_0xd099('0x23')]();});}};}function handleEntityNotFound(_0x31f6d3,_0xf4b435){return function(_0x2cf4e2){if(!_0x2cf4e2){_0x31f6d3['sendStatus'](0x194);}return _0x2cf4e2;};}function handleError(_0x5550a4,_0x5694c7){_0x5694c7=_0x5694c7||0x1f4;return function(_0x594282){logger[_0xd099('0x24')](_0x594282[_0xd099('0x25')]);if(_0x594282[_0xd099('0x26')]){delete _0x594282[_0xd099('0x26')];}_0x5550a4[_0xd099('0x16')](_0x5694c7)['send'](_0x594282);};}exports['index']=function(_0x254469,_0x2b0453){var _0x31ff8a={},_0x33a36d={},_0x276f3e={'count':0x0,'rows':[]};var _0x802fa7=_['map'](db[_0xd099('0x27')][_0xd099('0x28')],function(_0x4287cd){return{'name':_0x4287cd[_0xd099('0x29')],'type':_0x4287cd[_0xd099('0x2a')][_0xd099('0x2b')]};});_0x33a36d['model']=_['map'](_0x802fa7,_0xd099('0x26'));_0x33a36d[_0xd099('0x2c')]=_[_0xd099('0x2d')](_0x254469[_0xd099('0x2c')]);_0x33a36d['filters']=_[_0xd099('0x2e')](_0x33a36d[_0xd099('0x2f')],_0x33a36d[_0xd099('0x2c')]);_0x31ff8a[_0xd099('0x30')]=_[_0xd099('0x2e')](_0x33a36d['model'],qs['fields'](_0x254469['query'][_0xd099('0x31')]));_0x31ff8a[_0xd099('0x30')]=_0x31ff8a[_0xd099('0x30')][_0xd099('0x32')]?_0x31ff8a[_0xd099('0x30')]:_0x33a36d[_0xd099('0x2f')];if(!_0x254469[_0xd099('0x2c')][_0xd099('0x33')](_0xd099('0x34'))){_0x31ff8a[_0xd099('0x1a')]=qs[_0xd099('0x1a')](_0x254469[_0xd099('0x2c')][_0xd099('0x1a')]);_0x31ff8a[_0xd099('0x18')]=qs['offset'](_0x254469[_0xd099('0x2c')]['offset']);}_0x31ff8a[_0xd099('0x35')]=qs[_0xd099('0x36')](_0x254469['query'][_0xd099('0x36')]);_0x31ff8a[_0xd099('0x37')]=qs[_0xd099('0x38')](_['pick'](_0x254469['query'],_0x33a36d[_0xd099('0x38')]),_0x802fa7);if(_0x254469['query'][_0xd099('0x39')]){_0x31ff8a[_0xd099('0x37')]=_[_0xd099('0x3a')](_0x31ff8a[_0xd099('0x37')],{'$or':_[_0xd099('0x3b')](_0x802fa7,function(_0x408ae9){if(_0x408ae9[_0xd099('0x2a')]!==_0xd099('0x3c')){var _0x1ecf40={};_0x1ecf40[_0x408ae9[_0xd099('0x26')]]={'$like':'%'+_0x254469['query']['filter']+'%'};return _0x1ecf40;}})});}_0x31ff8a=_['merge']({},_0x31ff8a,_0x254469['options']);var _0x289592={'where':_0x31ff8a[_0xd099('0x37')]};return db[_0xd099('0x27')][_0xd099('0x19')](_0x289592)['then'](function(_0x9f0fe4){_0x276f3e[_0xd099('0x19')]=_0x9f0fe4;if(_0x254469[_0xd099('0x2c')]['includeAll']){_0x31ff8a[_0xd099('0x3d')]=[{'all':!![]}];}return db[_0xd099('0x27')][_0xd099('0x3e')](_0x31ff8a);})[_0xd099('0x20')](function(_0x455a7){_0x276f3e[_0xd099('0x3f')]=_0x455a7;return _0x276f3e;})['then'](respondWithFilteredResult(_0x2b0453,_0x31ff8a))[_0xd099('0x40')](handleError(_0x2b0453,null));};exports[_0xd099('0x41')]=function(_0x47f279,_0x220589){var _0x5d2c75={'raw':!![],'where':{'id':_0x47f279[_0xd099('0x42')]['id']}},_0x45e016={};_0x45e016[_0xd099('0x2f')]=_[_0xd099('0x2d')](db[_0xd099('0x27')][_0xd099('0x28')]);_0x45e016[_0xd099('0x2c')]=_['keys'](_0x47f279[_0xd099('0x2c')]);_0x45e016[_0xd099('0x38')]=_['intersection'](_0x45e016['model'],_0x45e016[_0xd099('0x2c')]);_0x5d2c75['attributes']=_[_0xd099('0x2e')](_0x45e016[_0xd099('0x2f')],qs[_0xd099('0x31')](_0x47f279[_0xd099('0x2c')][_0xd099('0x31')]));_0x5d2c75[_0xd099('0x30')]=_0x5d2c75['attributes'][_0xd099('0x32')]?_0x5d2c75[_0xd099('0x30')]:_0x45e016[_0xd099('0x2f')];if(_0x47f279[_0xd099('0x2c')][_0xd099('0x43')]){_0x5d2c75[_0xd099('0x3d')]=[{'all':!![]}];}_0x5d2c75=_['merge']({},_0x5d2c75,_0x47f279[_0xd099('0x44')]);return db[_0xd099('0x27')][_0xd099('0x45')](_0x5d2c75)['then'](handleEntityNotFound(_0x220589,null))[_0xd099('0x20')](respondWithResult(_0x220589,null))['catch'](handleError(_0x220589,null));};exports[_0xd099('0x46')]=function(_0x478a79,_0x38a449){return db[_0xd099('0x27')][_0xd099('0x46')](_0x478a79[_0xd099('0x47')],{})[_0xd099('0x20')](function(_0x54e2ab){var _0xded7ae=_0x478a79[_0xd099('0x48')][_0xd099('0x49')]({'plain':!![]});if(!_0xded7ae)throw new Error(_0xd099('0x4a'));if(_0xded7ae[_0xd099('0x4b')]===_0xd099('0x48')){var _0x21868e=_0x54e2ab[_0xd099('0x49')]({'plain':!![]});var _0x128c82=_0xd099('0x4c');return db[_0xd099('0x4d')][_0xd099('0x45')]({'where':{'name':_0x128c82,'userProfileId':_0xded7ae[_0xd099('0x4e')]},'raw':!![]})[_0xd099('0x20')](function(_0x94f98e){if(_0x94f98e&&_0x94f98e[_0xd099('0x4f')]===0x0){return db[_0xd099('0x22')]['create']({'name':_0x21868e['name'],'resourceId':_0x21868e['id'],'type':_0x94f98e['name'],'sectionId':_0x94f98e['id']},{})[_0xd099('0x20')](function(){return _0x54e2ab;});}else{return _0x54e2ab;}})[_0xd099('0x40')](function(_0x13ff30){logger[_0xd099('0x24')](_0xd099('0x50'),_0x13ff30);throw _0x13ff30;});}return _0x54e2ab;})[_0xd099('0x20')](respondWithResult(_0x38a449,0xc9))['catch'](handleError(_0x38a449,null));};exports[_0xd099('0x1f')]=function(_0x5374b9,_0x14c379){if(_0x5374b9[_0xd099('0x47')]['id']){delete _0x5374b9[_0xd099('0x47')]['id'];}return db['Pause']['find']({'where':{'id':_0x5374b9[_0xd099('0x42')]['id']}})['then'](handleEntityNotFound(_0x14c379,null))[_0xd099('0x20')](saveUpdates(_0x5374b9[_0xd099('0x47')],null))[_0xd099('0x20')](respondWithResult(_0x14c379,null))['catch'](handleError(_0x14c379,null));};exports['destroy']=function(_0x45579d,_0x637cca){return db[_0xd099('0x27')][_0xd099('0x45')]({'where':{'id':_0x45579d[_0xd099('0x42')]['id']}})[_0xd099('0x20')](handleEntityNotFound(_0x637cca,null))[_0xd099('0x20')](removeEntity(_0x637cca,null))['catch'](handleError(_0x637cca,null));}; \ No newline at end of file +var _0x1f4b=['UserProfileResource','sendStatus','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Pauses'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0x1f4b,0x1d1));var _0xb1f4=function(_0x3b1502,_0xa23e9d){_0x3b1502=_0x3b1502-0x0;var _0x1c8537=_0x1f4b[_0x3b1502];return _0x1c8537;};'use strict';var emlformat=require(_0xb1f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1f4('0x1'));var jsonpatch=require(_0xb1f4('0x2'));var rp=require('request-promise');var moment=require(_0xb1f4('0x3'));var BPromise=require(_0xb1f4('0x4'));var Mustache=require(_0xb1f4('0x5'));var util=require(_0xb1f4('0x6'));var path=require(_0xb1f4('0x7'));var sox=require('sox');var csv=require(_0xb1f4('0x8'));var ejs=require(_0xb1f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1f4('0xa'));var squel=require(_0xb1f4('0xb'));var crypto=require(_0xb1f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb1f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb1f4('0xe'));var Papa=require(_0xb1f4('0xf'));var Redis=require(_0xb1f4('0x10'));var authService=require(_0xb1f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb1f4('0x12'));var logger=require(_0xb1f4('0x13'))(_0xb1f4('0x14'));var utils=require(_0xb1f4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb1f4('0x16'));var db=require(_0xb1f4('0x17'))['db'];function respondWithStatusCode(_0x1a9abb,_0x48509e){_0x48509e=_0x48509e||0xcc;return function(_0x1d9c1c){if(_0x1d9c1c){return _0x1a9abb['sendStatus'](_0x48509e);}return _0x1a9abb[_0xb1f4('0x18')](_0x48509e)[_0xb1f4('0x19')]();};}function respondWithResult(_0x120ab0,_0x5445fd){_0x5445fd=_0x5445fd||0xc8;return function(_0x2f2d5f){if(_0x2f2d5f){return _0x120ab0[_0xb1f4('0x18')](_0x5445fd)[_0xb1f4('0x1a')](_0x2f2d5f);}};}function respondWithFilteredResult(_0x1e166b,_0x152e8f){return function(_0x57be2f){if(_0x57be2f){var _0xe7df7c=typeof _0x152e8f[_0xb1f4('0x1b')]===_0xb1f4('0x1c')&&typeof _0x152e8f[_0xb1f4('0x1d')]===_0xb1f4('0x1c');var _0x399925=_0x57be2f[_0xb1f4('0x1e')];var _0x2d69b9=_0xe7df7c?0x0:_0x152e8f['offset'];var _0x53502f=_0xe7df7c?_0x57be2f['count']:_0x152e8f['offset']+_0x152e8f['limit'];var _0x4d9a91;if(_0x53502f>=_0x399925){_0x53502f=_0x399925;_0x4d9a91=0xc8;}else{_0x4d9a91=0xce;}_0x1e166b[_0xb1f4('0x18')](_0x4d9a91);return _0x1e166b['set'](_0xb1f4('0x1f'),_0x2d69b9+'-'+_0x53502f+'/'+_0x399925)[_0xb1f4('0x1a')](_0x57be2f);}return null;};}function patchUpdates(_0x52f86e){return function(_0x3b5d7e){try{jsonpatch[_0xb1f4('0x20')](_0x3b5d7e,_0x52f86e,!![]);}catch(_0x26479e){return BPromise[_0xb1f4('0x21')](_0x26479e);}return _0x3b5d7e[_0xb1f4('0x22')]();};}function saveUpdates(_0x280aa1,_0x208296){return function(_0x278016){if(_0x278016){return _0x278016[_0xb1f4('0x23')](_0x280aa1)[_0xb1f4('0x24')](function(_0x1e811d){return _0x1e811d;});}return null;};}function removeEntity(_0x1c49a5,_0x313933){return function(_0x11b4c5){if(_0x11b4c5){return _0x11b4c5[_0xb1f4('0x25')]()['then'](function(){var _0x12e728=_0x11b4c5['get']({'plain':!![]});var _0x115824=_0xb1f4('0x26');return db[_0xb1f4('0x27')]['destroy']({'where':{'type':_0x115824,'resourceId':_0x12e728['id']}})['then'](function(){return _0x11b4c5;});})[_0xb1f4('0x24')](function(){_0x1c49a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x141810,_0x4d3c53){return function(_0x395133){if(!_0x395133){_0x141810[_0xb1f4('0x28')](0x194);}return _0x395133;};}function handleError(_0x35b0b7,_0x51720d){_0x51720d=_0x51720d||0x1f4;return function(_0x232923){logger[_0xb1f4('0x29')](_0x232923[_0xb1f4('0x2a')]);if(_0x232923[_0xb1f4('0x2b')]){delete _0x232923[_0xb1f4('0x2b')];}_0x35b0b7[_0xb1f4('0x18')](_0x51720d)[_0xb1f4('0x2c')](_0x232923);};}exports['index']=function(_0x3f1710,_0x3383db){var _0x294592={},_0x45662e={},_0x4a8f4b={'count':0x0,'rows':[]};var _0x37c01f=_[_0xb1f4('0x2d')](db[_0xb1f4('0x2e')][_0xb1f4('0x2f')],function(_0x22c07b){return{'name':_0x22c07b[_0xb1f4('0x30')],'type':_0x22c07b[_0xb1f4('0x31')][_0xb1f4('0x32')]};});_0x45662e[_0xb1f4('0x33')]=_[_0xb1f4('0x2d')](_0x37c01f,'name');_0x45662e[_0xb1f4('0x34')]=_['keys'](_0x3f1710[_0xb1f4('0x34')]);_0x45662e[_0xb1f4('0x35')]=_[_0xb1f4('0x36')](_0x45662e[_0xb1f4('0x33')],_0x45662e[_0xb1f4('0x34')]);_0x294592[_0xb1f4('0x37')]=_['intersection'](_0x45662e[_0xb1f4('0x33')],qs['fields'](_0x3f1710[_0xb1f4('0x34')]['fields']));_0x294592[_0xb1f4('0x37')]=_0x294592[_0xb1f4('0x37')]['length']?_0x294592[_0xb1f4('0x37')]:_0x45662e[_0xb1f4('0x33')];if(!_0x3f1710[_0xb1f4('0x34')][_0xb1f4('0x38')](_0xb1f4('0x39'))){_0x294592[_0xb1f4('0x1d')]=qs[_0xb1f4('0x1d')](_0x3f1710[_0xb1f4('0x34')]['limit']);_0x294592['offset']=qs[_0xb1f4('0x1b')](_0x3f1710[_0xb1f4('0x34')][_0xb1f4('0x1b')]);}_0x294592['order']=qs[_0xb1f4('0x3a')](_0x3f1710[_0xb1f4('0x34')][_0xb1f4('0x3a')]);_0x294592[_0xb1f4('0x3b')]=qs[_0xb1f4('0x35')](_[_0xb1f4('0x3c')](_0x3f1710['query'],_0x45662e['filters']),_0x37c01f);if(_0x3f1710['query'][_0xb1f4('0x3d')]){_0x294592[_0xb1f4('0x3b')]=_[_0xb1f4('0x3e')](_0x294592['where'],{'$or':_[_0xb1f4('0x2d')](_0x37c01f,function(_0x410b12){if(_0x410b12[_0xb1f4('0x31')]!==_0xb1f4('0x3f')){var _0x4c1f37={};_0x4c1f37[_0x410b12[_0xb1f4('0x2b')]]={'$like':'%'+_0x3f1710[_0xb1f4('0x34')][_0xb1f4('0x3d')]+'%'};return _0x4c1f37;}})});}_0x294592=_['merge']({},_0x294592,_0x3f1710[_0xb1f4('0x40')]);var _0xb0bb69={'where':_0x294592['where']};return db[_0xb1f4('0x2e')][_0xb1f4('0x1e')](_0xb0bb69)['then'](function(_0x84adc8){_0x4a8f4b[_0xb1f4('0x1e')]=_0x84adc8;if(_0x3f1710['query'][_0xb1f4('0x41')]){_0x294592[_0xb1f4('0x42')]=[{'all':!![]}];}return db[_0xb1f4('0x2e')]['findAll'](_0x294592);})[_0xb1f4('0x24')](function(_0x3f521d){_0x4a8f4b[_0xb1f4('0x43')]=_0x3f521d;return _0x4a8f4b;})[_0xb1f4('0x24')](respondWithFilteredResult(_0x3383db,_0x294592))['catch'](handleError(_0x3383db,null));};exports[_0xb1f4('0x44')]=function(_0x19a991,_0x218c1b){var _0x3420e1={'raw':!![],'where':{'id':_0x19a991[_0xb1f4('0x45')]['id']}},_0x14df15={};_0x14df15[_0xb1f4('0x33')]=_[_0xb1f4('0x46')](db['Pause']['rawAttributes']);_0x14df15['query']=_['keys'](_0x19a991['query']);_0x14df15[_0xb1f4('0x35')]=_['intersection'](_0x14df15['model'],_0x14df15[_0xb1f4('0x34')]);_0x3420e1[_0xb1f4('0x37')]=_['intersection'](_0x14df15[_0xb1f4('0x33')],qs[_0xb1f4('0x47')](_0x19a991[_0xb1f4('0x34')][_0xb1f4('0x47')]));_0x3420e1[_0xb1f4('0x37')]=_0x3420e1[_0xb1f4('0x37')][_0xb1f4('0x48')]?_0x3420e1[_0xb1f4('0x37')]:_0x14df15['model'];if(_0x19a991[_0xb1f4('0x34')]['includeAll']){_0x3420e1[_0xb1f4('0x42')]=[{'all':!![]}];}_0x3420e1=_[_0xb1f4('0x3e')]({},_0x3420e1,_0x19a991[_0xb1f4('0x40')]);return db[_0xb1f4('0x2e')]['find'](_0x3420e1)[_0xb1f4('0x24')](handleEntityNotFound(_0x218c1b,null))['then'](respondWithResult(_0x218c1b,null))[_0xb1f4('0x49')](handleError(_0x218c1b,null));};exports[_0xb1f4('0x4a')]=function(_0x6d8a75,_0x2c1709){return db[_0xb1f4('0x2e')][_0xb1f4('0x4a')](_0x6d8a75[_0xb1f4('0x4b')],{})['then'](function(_0x49c1c5){var _0x297b0c=_0x6d8a75[_0xb1f4('0x4c')][_0xb1f4('0x4d')]({'plain':!![]});if(!_0x297b0c)throw new Error(_0xb1f4('0x4e'));if(_0x297b0c[_0xb1f4('0x4f')]===_0xb1f4('0x4c')){var _0x1be43e=_0x49c1c5['get']({'plain':!![]});var _0x107e1a=_0xb1f4('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x107e1a,'userProfileId':_0x297b0c[_0xb1f4('0x50')]},'raw':!![]})[_0xb1f4('0x24')](function(_0x552ae5){if(_0x552ae5&&_0x552ae5[_0xb1f4('0x51')]===0x0){return db[_0xb1f4('0x27')]['create']({'name':_0x1be43e[_0xb1f4('0x2b')],'resourceId':_0x1be43e['id'],'type':_0x552ae5[_0xb1f4('0x2b')],'sectionId':_0x552ae5['id']},{})['then'](function(){return _0x49c1c5;});}else{return _0x49c1c5;}})['catch'](function(_0x270e16){logger[_0xb1f4('0x29')](_0xb1f4('0x52'),_0x270e16);throw _0x270e16;});}return _0x49c1c5;})[_0xb1f4('0x24')](respondWithResult(_0x2c1709,0xc9))[_0xb1f4('0x49')](handleError(_0x2c1709,null));};exports['update']=function(_0x4df54f,_0x30a0c9){if(_0x4df54f[_0xb1f4('0x4b')]['id']){delete _0x4df54f['body']['id'];}return db[_0xb1f4('0x2e')][_0xb1f4('0x53')]({'where':{'id':_0x4df54f[_0xb1f4('0x45')]['id']}})[_0xb1f4('0x24')](handleEntityNotFound(_0x30a0c9,null))[_0xb1f4('0x24')](saveUpdates(_0x4df54f[_0xb1f4('0x4b')],null))[_0xb1f4('0x24')](respondWithResult(_0x30a0c9,null))[_0xb1f4('0x49')](handleError(_0x30a0c9,null));};exports[_0xb1f4('0x25')]=function(_0x506000,_0x3cb9a3){return db[_0xb1f4('0x2e')]['find']({'where':{'id':_0x506000[_0xb1f4('0x45')]['id']}})[_0xb1f4('0x24')](handleEntityNotFound(_0x3cb9a3,null))['then'](removeEntity(_0x3cb9a3,null))[_0xb1f4('0x49')](handleError(_0x3cb9a3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 67bbc3c..78dc3a6 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59e5cb,_0x2b209a){_0x59e5cb=_0x59e5cb-0x0;var _0x4e69c1=_0x7fbe[_0x59e5cb];return _0x4e69c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x5f24b2,_0x3b3859){var _0x44fb70=function(_0x26525d){while(--_0x26525d){_0x5f24b2['push'](_0x5f24b2['shift']());}};_0x44fb70(++_0x3b3859);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x5fc3[_0x2f71f6];return _0x2b23ea;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index befb52a..ee1ccaa 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(_0x390af3,_0x26eb36){var _0x16d54e=function(_0x19df58){while(--_0x19df58){_0x390af3['push'](_0x390af3['shift']());}};_0x16d54e(++_0x26eb36);}(_0x7a54,0x106));var _0x47a5=function(_0x2faf7d,_0x3c46ba){_0x2faf7d=_0x2faf7d-0x0;var _0x3b4d5c=_0x7a54[_0x2faf7d];return _0x3b4d5c;};'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(_0x32a104,_0x540edc){var _0x2fdb2d=function(_0x591026){while(--_0x591026){_0x32a104['push'](_0x32a104['shift']());}};_0x2fdb2d(++_0x540edc);}(_0x7a54,0x106));var _0x47a5=function(_0x3fcf6b,_0x5de186){_0x3fcf6b=_0x3fcf6b-0x0;var _0x3ebc77=_0x7a54[_0x3fcf6b];return _0x3ebc77;};'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 151e8e9..8ed6888 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 _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x4f1aef,_0xd5aa75){var _0x34e8e7=function(_0x18edf7){while(--_0x18edf7){_0x4f1aef['push'](_0x4f1aef['shift']());}};_0x34e8e7(++_0xd5aa75);}(_0xb458,0x103));var _0x8b45=function(_0x447813,_0x25cabb){_0x447813=_0x447813-0x0;var _0x913e49=_0xb458[_0x447813];return _0x913e49;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file +var _0x68fc=['webhookPost','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','upload','/webhook'];(function(_0x534077,_0x58ed46){var _0x5b007e=function(_0x575224){while(--_0x575224){_0x534077['push'](_0x534077['shift']());}};_0x5b007e(++_0x58ed46);}(_0x68fc,0xa5));var _0xc68f=function(_0xb46b93,_0x1f6a57){_0xb46b93=_0xb46b93-0x0;var _0x312adb=_0x68fc[_0xb46b93];return _0x312adb;};'use strict';var multer=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var path=require(_0xc68f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc68f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc68f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc68f('0x5'));router[_0xc68f('0x6')]('/',auth[_0xc68f('0x7')](),controller[_0xc68f('0x8')]);router['get']('/webhook',controller[_0xc68f('0x9')]);router[_0xc68f('0x6')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xb')]);router[_0xc68f('0x6')](_0xc68f('0xc'),auth[_0xc68f('0x7')](),controller[_0xc68f('0xd')]);var upload=multer({'storage':multer[_0xc68f('0xe')]({'destination':function(_0x5777f9,_0x3b1a43,_0x29f1fe){_0x29f1fe(null,path[_0xc68f('0xf')](config[_0xc68f('0x10')],_0xc68f('0x11')));},'filename':function(_0x2a0a52,_0x3ccebe,_0x41aeb8){_0x3ccebe[_0xc68f('0x12')]=_0x3ccebe[_0xc68f('0x12')][_0xc68f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41aeb8(null,util['format'](_0xc68f('0x14'),path[_0xc68f('0x15')](_0x3ccebe[_0xc68f('0x12')],path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])),Date[_0xc68f('0x17')](),path[_0xc68f('0x16')](_0x3ccebe[_0xc68f('0x12')])));}})});router[_0xc68f('0x18')]('/',upload['single']('file'),controller[_0xc68f('0x19')]);router[_0xc68f('0x18')](_0xc68f('0x1a'),controller[_0xc68f('0x1b')]);router[_0xc68f('0x1c')](_0xc68f('0xa'),auth['isAuthenticated'](),controller[_0xc68f('0x1d')]);router[_0xc68f('0x1e')](_0xc68f('0xa'),auth[_0xc68f('0x7')](),controller[_0xc68f('0x1e')]);module[_0xc68f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5eb7772..1dd5976 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 _0xb23a=['BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xb23a,0x1c0));var _0xab23=function(_0x44c62a,_0x55be84){_0x44c62a=_0x44c62a-0x0;var _0x33ec0d=_0xb23a[_0x44c62a];return _0x33ec0d;};'use strict';var Sequelize=require(_0xab23('0x0'));module[_0xab23('0x1')]={'name':{'type':Sequelize[_0xab23('0x2')]},'type':{'type':Sequelize[_0xab23('0x3')](_0xab23('0x4'),'script')},'description':{'type':Sequelize[_0xab23('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xab23('0x2')],'comment':_0xab23('0x6')},'active':{'type':Sequelize[_0xab23('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xab23('0x8'),_0xab23('0x9'),_0xab23('0xa'),_0xab23('0xb')),'defaultValue':_0xab23('0xa'),'comment':_0xab23('0xc')},'icon':{'type':Sequelize[_0xab23('0x2')]},'adminUrl':{'type':Sequelize[_0xab23('0x2')]},'agentUrl':{'type':Sequelize[_0xab23('0x2')]},'scriptName':{'type':Sequelize[_0xab23('0x2')]},'scriptPath':{'type':Sequelize[_0xab23('0x2')]}}; \ No newline at end of file +var _0xc01b=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','BOOLEAN'];(function(_0x2eeb7d,_0x24e606){var _0x241fc2=function(_0xa600be){while(--_0xa600be){_0x2eeb7d['push'](_0x2eeb7d['shift']());}};_0x241fc2(++_0x24e606);}(_0xc01b,0x65));var _0xbc01=function(_0x5806a1,_0x4b247d){_0x5806a1=_0x5806a1-0x0;var _0x2d271e=_0xc01b[_0x5806a1];return _0x2d271e;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'name':{'type':Sequelize[_0xbc01('0x2')]},'type':{'type':Sequelize[_0xbc01('0x3')]('html',_0xbc01('0x4'))},'description':{'type':Sequelize[_0xbc01('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xbc01('0x6')],'defaultValue':0x0,'comment':_0xbc01('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0xbc01('0x8'),_0xbc01('0x9'),_0xbc01('0xa')),'defaultValue':_0xbc01('0x9'),'comment':_0xbc01('0xb')},'icon':{'type':Sequelize[_0xbc01('0x2')]},'adminUrl':{'type':Sequelize[_0xbc01('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xbc01('0x2')]},'scriptPath':{'type':Sequelize[_0xbc01('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 57a3243..4666e17 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 _0x91fa=['\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','../../mysqldb','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','rows','catch','params','includeAll','find','download','join','server/files/plugins','format','%s.zip','basename','warning','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','agent','create','body','role','userProfileId','user','get','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve'];(function(_0x402cd5,_0x1b8772){var _0x41f888=function(_0x58f111){while(--_0x58f111){_0x402cd5['push'](_0x402cd5['shift']());}};_0x41f888(++_0x1b8772);}(_0x91fa,0xaf));var _0xa91f=function(_0x5c6c2e,_0x86e980){_0x5c6c2e=_0x5c6c2e-0x0;var _0xd262ac=_0x91fa[_0x5c6c2e];return _0xd262ac;};'use strict';var emlformat=require(_0xa91f('0x0'));var rimraf=require(_0xa91f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa91f('0x2'));var rp=require(_0xa91f('0x3'));var moment=require(_0xa91f('0x4'));var BPromise=require(_0xa91f('0x5'));var Mustache=require(_0xa91f('0x6'));var util=require(_0xa91f('0x7'));var path=require(_0xa91f('0x8'));var sox=require(_0xa91f('0x9'));var csv=require('to-csv');var ejs=require(_0xa91f('0xa'));var fs=require('fs');var fs_extra=require(_0xa91f('0xb'));var _=require(_0xa91f('0xc'));var squel=require('squel');var crypto=require(_0xa91f('0xd'));var jsforce=require(_0xa91f('0xe'));var deskjs=require(_0xa91f('0xf'));var toCsv=require(_0xa91f('0x10'));var querystring=require(_0xa91f('0x11'));var Papa=require(_0xa91f('0x12'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xa91f('0x13'));var qs=require(_0xa91f('0x14'));var as=require(_0xa91f('0x15'));var hardwareService=require(_0xa91f('0x16'));var logger=require(_0xa91f('0x17'))(_0xa91f('0x18'));var utils=require(_0xa91f('0x19'));var config=require(_0xa91f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa91f('0x1b'))['db'];config['redis']=_[_0xa91f('0x1c')](config['redis'],{'host':_0xa91f('0x1d'),'port':0x18eb});var socket=require(_0xa91f('0x1e'))(new Redis(config['redis']));require(_0xa91f('0x1f'))['register'](socket);function respondWithStatusCode(_0x35d91c,_0x51e471){_0x51e471=_0x51e471||0xcc;return function(_0x214e75){if(_0x214e75){return _0x35d91c[_0xa91f('0x20')](_0x51e471);}return _0x35d91c[_0xa91f('0x21')](_0x51e471)[_0xa91f('0x22')]();};}function respondWithResult(_0x3fef93,_0x332829){_0x332829=_0x332829||0xc8;return function(_0x2413c0){if(_0x2413c0){return _0x3fef93['status'](_0x332829)[_0xa91f('0x23')](_0x2413c0);}};}function respondWithFilteredResult(_0x373701,_0xed045e){return function(_0x130191){if(_0x130191){var _0x168395=typeof _0xed045e[_0xa91f('0x24')]===_0xa91f('0x25')&&typeof _0xed045e[_0xa91f('0x26')]===_0xa91f('0x25');var _0x2e5f3d=_0x130191[_0xa91f('0x27')];var _0x4a61c5=_0x168395?0x0:_0xed045e[_0xa91f('0x24')];var _0x5bb902=_0x168395?_0x130191[_0xa91f('0x27')]:_0xed045e[_0xa91f('0x24')]+_0xed045e['limit'];var _0x19dfb1;if(_0x5bb902>=_0x2e5f3d){_0x5bb902=_0x2e5f3d;_0x19dfb1=0xc8;}else{_0x19dfb1=0xce;}_0x373701[_0xa91f('0x21')](_0x19dfb1);return _0x373701[_0xa91f('0x28')]('Content-Range',_0x4a61c5+'-'+_0x5bb902+'/'+_0x2e5f3d)[_0xa91f('0x23')](_0x130191);}return null;};}function patchUpdates(_0x392628){return function(_0x14a7b3){try{jsonpatch['apply'](_0x14a7b3,_0x392628,!![]);}catch(_0x2eddb3){return BPromise[_0xa91f('0x29')](_0x2eddb3);}return _0x14a7b3['save']();};}function saveUpdates(_0x33fed1,_0x24bb4c){return function(_0x5ee966){if(_0x5ee966){return _0x5ee966[_0xa91f('0x2a')](_0x33fed1)[_0xa91f('0x2b')](function(_0x3e10a3){return _0x3e10a3;});}return null;};}function removeEntity(_0x4d06c8,_0x315008){return function(_0x562235){if(_0x562235){return _0x562235[_0xa91f('0x2c')]()[_0xa91f('0x2b')](function(){var _0x16b66b=_0x562235['get']({'plain':!![]});var _0x4424f0=_0xa91f('0x2d');return db[_0xa91f('0x2e')][_0xa91f('0x2c')]({'where':{'type':_0x4424f0,'resourceId':_0x16b66b['id']}})['then'](function(){return _0x562235;});})[_0xa91f('0x2b')](function(){_0x4d06c8[_0xa91f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x486651,_0x5c2630){return function(_0x153160){if(!_0x153160){_0x486651[_0xa91f('0x20')](0x194);}return _0x153160;};}function handleError(_0x40d79a,_0x4060f1){_0x4060f1=_0x4060f1||0x1f4;return function(_0x170b11){logger[_0xa91f('0x2f')](_0x170b11[_0xa91f('0x30')]);if(_0x170b11[_0xa91f('0x31')]){delete _0x170b11[_0xa91f('0x31')];}_0x40d79a[_0xa91f('0x21')](_0x4060f1)[_0xa91f('0x32')](_0x170b11);};}exports['index']=function(_0x10c365,_0x40d9d8){var _0x48a5ec={},_0xe07942={},_0x53b14a={'count':0x0,'rows':[]};var _0x583578=_[_0xa91f('0x33')](db['Plugin'][_0xa91f('0x34')],function(_0x4af1ab){return{'name':_0x4af1ab[_0xa91f('0x35')],'type':_0x4af1ab[_0xa91f('0x36')]['key']};});_0xe07942['model']=_[_0xa91f('0x33')](_0x583578,_0xa91f('0x31'));_0xe07942[_0xa91f('0x37')]=_[_0xa91f('0x38')](_0x10c365[_0xa91f('0x37')]);_0xe07942['filters']=_[_0xa91f('0x39')](_0xe07942[_0xa91f('0x3a')],_0xe07942[_0xa91f('0x37')]);_0x48a5ec[_0xa91f('0x3b')]=_[_0xa91f('0x39')](_0xe07942[_0xa91f('0x3a')],qs[_0xa91f('0x3c')](_0x10c365['query']['fields']));_0x48a5ec[_0xa91f('0x3b')]=_0x48a5ec['attributes'][_0xa91f('0x3d')]?_0x48a5ec[_0xa91f('0x3b')]:_0xe07942[_0xa91f('0x3a')];if(!_0x10c365[_0xa91f('0x37')][_0xa91f('0x3e')](_0xa91f('0x3f'))){_0x48a5ec[_0xa91f('0x26')]=qs[_0xa91f('0x26')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x26')]);_0x48a5ec[_0xa91f('0x24')]=qs[_0xa91f('0x24')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x24')]);}_0x48a5ec['order']=qs[_0xa91f('0x40')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x40')]);_0x48a5ec[_0xa91f('0x41')]=qs[_0xa91f('0x42')](_[_0xa91f('0x43')](_0x10c365['query'],_0xe07942['filters']),_0x583578);if(_0x10c365[_0xa91f('0x37')][_0xa91f('0x44')]){_0x48a5ec[_0xa91f('0x41')]=_[_0xa91f('0x45')](_0x48a5ec[_0xa91f('0x41')],{'$or':_[_0xa91f('0x33')](_0x583578,function(_0x3c3424){if(_0x3c3424[_0xa91f('0x36')]!==_0xa91f('0x46')){var _0x2305f9={};_0x2305f9[_0x3c3424[_0xa91f('0x31')]]={'$like':'%'+_0x10c365[_0xa91f('0x37')][_0xa91f('0x44')]+'%'};return _0x2305f9;}})});}_0x48a5ec=_[_0xa91f('0x45')]({},_0x48a5ec,_0x10c365[_0xa91f('0x47')]);var _0x3ad8a2={'where':_0x48a5ec['where']};return db[_0xa91f('0x48')]['count'](_0x3ad8a2)[_0xa91f('0x2b')](function(_0x451132){_0x53b14a[_0xa91f('0x27')]=_0x451132;if(_0x10c365['query']['includeAll']){_0x48a5ec[_0xa91f('0x49')]=[{'all':!![]}];}return db[_0xa91f('0x48')][_0xa91f('0x4a')](_0x48a5ec);})[_0xa91f('0x2b')](function(_0x44b017){_0x53b14a[_0xa91f('0x4b')]=_0x44b017;return _0x53b14a;})[_0xa91f('0x2b')](respondWithFilteredResult(_0x40d9d8,_0x48a5ec))[_0xa91f('0x4c')](handleError(_0x40d9d8,null));};exports['show']=function(_0x5e1c76,_0x33d6ea){var _0x545458={'raw':!![],'where':{'id':_0x5e1c76[_0xa91f('0x4d')]['id']}},_0x343e11={};_0x343e11[_0xa91f('0x3a')]=_[_0xa91f('0x38')](db[_0xa91f('0x48')]['rawAttributes']);_0x343e11[_0xa91f('0x37')]=_[_0xa91f('0x38')](_0x5e1c76[_0xa91f('0x37')]);_0x343e11['filters']=_[_0xa91f('0x39')](_0x343e11[_0xa91f('0x3a')],_0x343e11[_0xa91f('0x37')]);_0x545458[_0xa91f('0x3b')]=_[_0xa91f('0x39')](_0x343e11[_0xa91f('0x3a')],qs[_0xa91f('0x3c')](_0x5e1c76[_0xa91f('0x37')]['fields']));_0x545458[_0xa91f('0x3b')]=_0x545458[_0xa91f('0x3b')][_0xa91f('0x3d')]?_0x545458['attributes']:_0x343e11[_0xa91f('0x3a')];if(_0x5e1c76[_0xa91f('0x37')][_0xa91f('0x4e')]){_0x545458['include']=[{'all':!![]}];}_0x545458=_[_0xa91f('0x45')]({},_0x545458,_0x5e1c76['options']);return db[_0xa91f('0x48')][_0xa91f('0x4f')](_0x545458)[_0xa91f('0x2b')](handleEntityNotFound(_0x33d6ea,null))['then'](respondWithResult(_0x33d6ea,null))['catch'](handleError(_0x33d6ea,null));};exports[_0xa91f('0x50')]=function(_0x4f69ad,_0x22baf3,_0x1b8025){return db['Plugin'][_0xa91f('0x4f')]({'where':{'id':_0x4f69ad[_0xa91f('0x4d')]['id']},'attributes':[_0xa91f('0x31'),_0xa91f('0x8')],'raw':!![]})[_0xa91f('0x2b')](handleEntityNotFound(_0x22baf3,null))[_0xa91f('0x2b')](function(_0x5f24d4){if(_0x5f24d4){var _0x26ee37=path[_0xa91f('0x51')](config['root'],_0xa91f('0x52'),util[_0xa91f('0x53')](_0xa91f('0x54'),path[_0xa91f('0x55')](_0x5f24d4['path'])));var _0x46d79e=fs['createWriteStream'](_0x26ee37);var _0x2dfc06=archiver('zip',{'zlib':{'level':0x9}});_0x2dfc06['on'](_0xa91f('0x56'),function(_0x119a8c){if(_0x119a8c['code']===_0xa91f('0x57')){logger[_0xa91f('0x2f')](_0x119a8c);}else{throw new db['Sequelize']['Error'](_0xa91f('0x58'));}});_0x2dfc06['on'](_0xa91f('0x2f'),function(_0x3d293b){throw new db[(_0xa91f('0x59'))][(_0xa91f('0x5a'))](_0xa91f('0x58'));});_0x2dfc06[_0xa91f('0x5b')](_0x46d79e);_0x2dfc06['glob'](_0xa91f('0x5c'),{'cwd':path[_0xa91f('0x51')](config[_0xa91f('0x5d')],_0xa91f('0x52'),path[_0xa91f('0x5e')](_0x5f24d4[_0xa91f('0x8')])),'ignore':[path[_0xa91f('0x51')](path[_0xa91f('0x55')](_0x5f24d4[_0xa91f('0x8')]),_0xa91f('0x5f')),path[_0xa91f('0x51')](path[_0xa91f('0x55')](_0x5f24d4[_0xa91f('0x8')]),_0xa91f('0x60'))],'nodir':!![]})[_0xa91f('0x61')]();_0x46d79e['on'](_0xa91f('0x62'),function(){if(!fs[_0xa91f('0x63')](_0x26ee37)){throw new db[(_0xa91f('0x59'))][(_0xa91f('0x5a'))](_0xa91f('0x64'));}return _0x22baf3['download'](_0x26ee37,util['format'](_0xa91f('0x54'),path[_0xa91f('0x55')](_0x5f24d4['path'])),function(_0xe1a17b){if(_0xe1a17b){throw new db[(_0xa91f('0x59'))]['Error'](_0xa91f('0x65'));}fs[_0xa91f('0x66')](_0x26ee37);logger['info']('Download\x20completed');logger[_0xa91f('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xa91f('0x4c')](handleError(_0x22baf3,null));};exports[_0xa91f('0x68')]=function(_0x19d753,_0x15afd2,_0x2147e2){var _0x5ebb97=path['basename'](_0x19d753[_0xa91f('0x69')]['filename'],path['extname'](_0x19d753['file'][_0xa91f('0x6a')]));var _0x544b3f=path['join'](config[_0xa91f('0x5d')],_0xa91f('0x52'),_0x19d753[_0xa91f('0x69')]['filename']);var _0x26e18f=path[_0xa91f('0x51')](config[_0xa91f('0x5d')],_0xa91f('0x52'),_0x5ebb97);logger[_0xa91f('0x67')](_0xa91f('0x6b'),_0x544b3f);logger['info'](_0xa91f('0x6c'),_0x26e18f);try{fs[_0xa91f('0x6d')](_0x544b3f,parseInt('0777',0x8));extract(_0x544b3f,{'dir':_0x26e18f},function(_0x518645){if(_0x518645){logger[_0xa91f('0x2f')](_0x518645);handleError(_0x518645,!![]);};var _0x1c2599=fs[_0xa91f('0x6e')](_0x26e18f);if(_0x1c2599['length']>0x1){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error(_0xa91f('0x6f')));}var _0x3ad4f6=fs[_0xa91f('0x70')](path['join'](_0x26e18f,_0x1c2599[0x0]));if(_0x3ad4f6[_0xa91f('0x71')]()){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error(_0xa91f('0x6f')));}if(_0x3ad4f6[_0xa91f('0x72')]()){var _0x1704e8=fs[_0xa91f('0x6e')](path['join'](_0x26e18f,_0x1c2599[0x0]));if(_0x1704e8[_0xa91f('0x3d')]===0x0){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error('Invalid\x20plugin\x20structure'));}var _0x41bca7=_0x1704e8[_0xa91f('0x73')](function(_0x3b7acd){return _0x3b7acd==='manifest.json';});if(!_0x41bca7){return _0x2147e2(new Error('Plugin\x20manifest\x20missing'));}var _0x49844a=fs['readFileSync'](path[_0xa91f('0x51')](_0x26e18f,_0x1c2599[0x0],_0xa91f('0x74')));var _0x177e8c=JSON[_0xa91f('0x75')](_0x49844a);if(_0xa91f('0x25')==typeof _0x177e8c['name']){return _0x2147e2(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x177e8c[_0xa91f('0x36')]){return _0x2147e2(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x76')]){return _0x2147e2(new Error(_0xa91f('0x77')));}if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')]){return _0x2147e2(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x177e8c[_0xa91f('0x36')]===_0xa91f('0x79')){if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')]['views']){return _0x2147e2(new Error(_0xa91f('0x7a')));}if(_0xa91f('0x25')==typeof _0x177e8c['parameters'][_0xa91f('0x7b')]['admin']&&'undefined'==typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent']){return _0x2147e2(new Error(_0xa91f('0x7c')));}}else if(_0x177e8c[_0xa91f('0x36')]===_0xa91f('0x7d')){if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7e')]){return _0x2147e2(new Error(_0xa91f('0x7f')));}if('undefined'==typeof _0x177e8c[_0xa91f('0x78')]['scriptPath']){return _0x2147e2(new Error(_0xa91f('0x80')));}}else{return _0x2147e2(new Error(_0xa91f('0x81')));}var _0x5978a1=_0x177e8c[_0xa91f('0x31')];var _0x578e24=_0x177e8c[_0xa91f('0x82')];var _0x502b11=_0x177e8c[_0xa91f('0x36')];var _0x1b6159=_0x177e8c[_0xa91f('0x83')]?_0x177e8c[_0xa91f('0x83')]:_0xa91f('0x84');var _0x4b0cff=_0x177e8c['icon']?_0x177e8c[_0xa91f('0x85')]:_0xa91f('0x86');var _0x2562c6='';var _0x1c1747='';var _0x449bf0='';var _0x1434a1='';var _0x2d3c2c=_0x177e8c['version'];if(_0x502b11===_0xa91f('0x79')){if('undefined'!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')][_0xa91f('0x87')]){var _0x28447c=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x28447c)){_0x2562c6=path['join'](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x28447c);}else{_0x2562c6=_0x28447c;}}else{logger[_0xa91f('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xa91f('0x25')!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent']){var _0x9b43a2=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x9b43a2)){_0x1c1747=path[_0xa91f('0x51')](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x9b43a2);}else{_0x1c1747=_0x9b43a2;}}else{logger[_0xa91f('0x67')](_0xa91f('0x8a'));}}else if(_0x502b11===_0xa91f('0x7d')){_0x449bf0=_0x177e8c['parameters']['scriptName'];_0x1434a1=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x8b')];if('undefined'!=typeof _0x177e8c[_0xa91f('0x78')]['views']){if(_0xa91f('0x25')!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')][_0xa91f('0x87')]){var _0x28447c=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x28447c)){_0x2562c6=path[_0xa91f('0x51')](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x28447c);}else{_0x2562c6=_0x28447c;}}if(_0xa91f('0x25')!=typeof _0x177e8c['parameters']['views'][_0xa91f('0x8c')]){var _0x9b43a2=_0x177e8c[_0xa91f('0x78')]['views'][_0xa91f('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x9b43a2)){_0x1c1747=path[_0xa91f('0x51')]('plugins',_0x5ebb97,_0x1c2599[0x0],_0x9b43a2);}else{_0x1c1747=_0x9b43a2;}}}}var _0x3ab15a={'name':_0x5978a1,'description':_0x578e24,'path':path[_0xa91f('0x51')](_0x5ebb97,_0x1c2599[0x0]),'type':_0x502b11,'sidebar':_0x1b6159,'icon':_0x4b0cff,'adminUrl':_0x2562c6,'agentUrl':_0x1c1747,'scriptName':_0x449bf0,'scriptPath':_0x1434a1,'version':_0x2d3c2c};removeReferences(_0x544b3f,null);return db[_0xa91f('0x48')][_0xa91f('0x8d')](_0x3ab15a)['then'](function(_0x17c32e){var _0x39fc5b={'role':_0x19d753[_0xa91f('0x8e')][_0xa91f('0x8f')],'userProfileId':_0x19d753['body'][_0xa91f('0x90')]};if(!_0x39fc5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fc5b['role']===_0xa91f('0x91')){var _0x602fcc=_0x17c32e[_0xa91f('0x92')]({'plain':!![]});return db['UserProfileSection'][_0xa91f('0x4f')]({'where':{'name':_0xa91f('0x2d'),'userProfileId':_0x39fc5b['userProfileId']},'raw':!![]})[_0xa91f('0x2b')](function(_0x47ff14){if(_0x47ff14&&_0x47ff14[_0xa91f('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x602fcc['name'],'resourceId':_0x602fcc['id'],'type':_0x47ff14[_0xa91f('0x31')],'sectionId':_0x47ff14['id']},{})[_0xa91f('0x2b')](function(){return _0x17c32e;});}else{return _0x17c32e;}})['catch'](function(_0x5ac1e6){logger[_0xa91f('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ac1e6);throw _0x5ac1e6;});}return _0x17c32e;})[_0xa91f('0x2b')](respondWithResult(_0x15afd2,null))[_0xa91f('0x4c')](handleError(_0x15afd2,null));}});}catch(_0x5bf8a1){_0x15afd2[_0xa91f('0x21')](0x1f4)[_0xa91f('0x32')](_0x5bf8a1);}};function removeReferences(_0x45abaf,_0x2fba9e){try{if(_0x45abaf){fs[_0xa91f('0x66')](_0x45abaf);logger[_0xa91f('0x67')](_0xa91f('0x94'));}if(_0x2fba9e){rimraf(_0x2fba9e,function(){});logger[_0xa91f('0x67')](_0xa91f('0x95'));}}catch(_0x4d950c){logger[_0xa91f('0x2f')](_0x4d950c);}}exports[_0xa91f('0x2a')]=function(_0x5b475,_0x5579ed,_0xf23dc4){return db['Plugin'][_0xa91f('0x4f')]({'where':{'id':_0x5b475[_0xa91f('0x4d')]['id']}})[_0xa91f('0x2b')](handleEntityNotFound(_0x5579ed,null))[_0xa91f('0x2b')](saveUpdates(_0x5b475[_0xa91f('0x8e')],null))[_0xa91f('0x2b')](respondWithResult(_0x5579ed,null))[_0xa91f('0x4c')](handleError(_0x5579ed,null));};exports[_0xa91f('0x96')]=function(_0x19f317,_0x155dd6,_0x29a6dc){return db[_0xa91f('0x48')][_0xa91f('0x4f')]({'where':{'id':_0x19f317['params']['id']}})[_0xa91f('0x2b')](function(_0x449840){if(_0x449840){return _0x449840[_0xa91f('0x2c')]();}})[_0xa91f('0x2b')](function(_0x4b8110){rimraf(path[_0xa91f('0x51')](config[_0xa91f('0x5d')],'server/files/plugins',path[_0xa91f('0x5e')](_0x4b8110[_0xa91f('0x8')])),function(){});return _0x4b8110;})[_0xa91f('0x2b')](handleEntityNotFound(_0x155dd6,null))[_0xa91f('0x2b')](respondWithStatusCode(_0x155dd6,null))[_0xa91f('0x4c')](handleError(_0x155dd6,null));};exports[_0xa91f('0x97')]=function(_0x3df5ff,_0x146981,_0x2e5218){return BPromise[_0xa91f('0x98')]()[_0xa91f('0x2b')](function(){if(!_0x3df5ff[_0xa91f('0x37')]['path']){throw new Error(_0xa91f('0x99'));}if(!_0x3df5ff['query'][_0xa91f('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x12604c=_0x3df5ff['query']['hostname']?_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9b')]+':'+_0x3df5ff[_0xa91f('0x37')]['port']:_0xa91f('0x9c')+_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9a')];var _0x54995d=_0x3df5ff[_0xa91f('0x37')]['json']?_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x23')]:!![];var _0x66ff40=_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9d')]?_0x3df5ff[_0xa91f('0x37')]['encoding']:null;var _0x1eb396={'method':_0x3df5ff[_0xa91f('0x9e')],'uri':util['format'](_0xa91f('0x9f'),_0x12604c,_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x8')]),'json':_0x54995d,'resolveWithFullResponse':!![],'encoding':_0x66ff40,'qs':_0x3df5ff[_0xa91f('0x37')]};if(_0x3df5ff[_0xa91f('0xa0')]){_0x1eb396['headers']=_0x3df5ff[_0xa91f('0xa0')];if(_0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa1')]){delete _0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa1')];}}if(_0x1eb396['headers'][_0xa91f('0xa2')]){delete _0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa2')];}return rp(_0x1eb396);})[_0xa91f('0x2b')](function(_0x1f3245){if(_0x1f3245){_0x146981[_0xa91f('0x28')](_0x1f3245['headers']);logger[_0xa91f('0x67')](_0x1f3245[_0xa91f('0x8e')]);if(_['endsWith'](_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x8')],_0xa91f('0x50'))&&_0x1f3245[_0xa91f('0xa3')]==0x1f4){return _0x146981[_0xa91f('0x20')](_0x1f3245['statusCode']);}else{return _0x146981[_0xa91f('0x21')](_0x1f3245['statusCode'])['send'](_0x1f3245[_0xa91f('0x8e')]);}}else{return _0x146981[_0xa91f('0x20')](0xc8);}})[_0xa91f('0x4c')](handleError(_0x146981,null));};exports['webhookPost']=function(_0x47d48a,_0x320f5f,_0x596e23){return BPromise['resolve']()[_0xa91f('0x2b')](function(){if(!_0x47d48a['query'][_0xa91f('0x8')]){throw new Error(_0xa91f('0x99'));}if(!_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xe3e999=_0x47d48a['query'][_0xa91f('0x9b')]?_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9b')]+':'+_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')]:_0xa91f('0x9c')+_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')];var _0x56b464=_0x47d48a[_0xa91f('0x37')][_0xa91f('0x23')]?_0x47d48a[_0xa91f('0x37')]['json']:!![];var _0x3e2a23=_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9d')]?_0x47d48a['query']['encoding']:null;var _0x262b1f={'method':_0x47d48a[_0xa91f('0x9e')],'uri':util[_0xa91f('0x53')]('%s%s',_0xe3e999,_0x47d48a['query'][_0xa91f('0x8')]),'json':_0x56b464,'resolveWithFullResponse':!![],'encoding':_0x3e2a23,'body':_0x47d48a[_0xa91f('0x8e')]};if(_0x47d48a[_0xa91f('0xa0')]){_0x262b1f['headers']=_0x47d48a[_0xa91f('0xa0')];if(_0x262b1f['headers'][_0xa91f('0xa1')]){delete _0x262b1f[_0xa91f('0xa0')]['content-length'];}}if(_0x262b1f['headers'][_0xa91f('0xa2')]){delete _0x262b1f[_0xa91f('0xa0')][_0xa91f('0xa2')];}return rp(_0x262b1f);})[_0xa91f('0x2b')](function(_0x5c9521){if(_0x5c9521){_0x320f5f[_0xa91f('0x28')](_0x5c9521[_0xa91f('0xa0')]);logger[_0xa91f('0x67')](_0x5c9521['body']);return _0x320f5f[_0xa91f('0x21')](_0x5c9521[_0xa91f('0xa3')])['send'](_0x5c9521['body']);}else{return _0x320f5f[_0xa91f('0x20')](0xc8);}})[_0xa91f('0x4c')](handleError(_0x320f5f,null));}; \ No newline at end of file +var _0xfc0f=['script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','set','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./plugin.socket','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','download','join','root','format','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','attachments/**/*','finalize','existsSync','%s.zip','unlinkSync','info','Temporary\x20file\x20removed','upload','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified'];(function(_0x422d8f,_0xb108b2){var _0xb532ac=function(_0x255b42){while(--_0x255b42){_0x422d8f['push'](_0x422d8f['shift']());}};_0xb532ac(++_0xb108b2);}(_0xfc0f,0x176));var _0xffc0=function(_0x477d3e,_0x25003b){_0x477d3e=_0x477d3e-0x0;var _0x4addc1=_0xfc0f[_0x477d3e];return _0x4addc1;};'use strict';var emlformat=require(_0xffc0('0x0'));var rimraf=require(_0xffc0('0x1'));var zipdir=require(_0xffc0('0x2'));var jsonpatch=require(_0xffc0('0x3'));var rp=require(_0xffc0('0x4'));var moment=require(_0xffc0('0x5'));var BPromise=require(_0xffc0('0x6'));var Mustache=require('mustache');var util=require(_0xffc0('0x7'));var path=require(_0xffc0('0x8'));var sox=require(_0xffc0('0x9'));var csv=require(_0xffc0('0xa'));var ejs=require(_0xffc0('0xb'));var fs=require('fs');var fs_extra=require(_0xffc0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xffc0('0xd'));var jsforce=require(_0xffc0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffc0('0xa'));var querystring=require(_0xffc0('0xf'));var Papa=require(_0xffc0('0x10'));var extract=require(_0xffc0('0x11'));var rimraf=require('rimraf');var archiver=require(_0xffc0('0x12'));var Redis=require(_0xffc0('0x13'));var authService=require(_0xffc0('0x14'));var qs=require(_0xffc0('0x15'));var as=require(_0xffc0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xffc0('0x17'))(_0xffc0('0x18'));var utils=require(_0xffc0('0x19'));var config=require(_0xffc0('0x1a'));var licenseUtil=require(_0xffc0('0x1b'));var db=require('../../mysqldb')['db'];config[_0xffc0('0x1c')]=_[_0xffc0('0x1d')](config[_0xffc0('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xffc0('0x1c')]));require(_0xffc0('0x1e'))['register'](socket);function respondWithStatusCode(_0x112ec5,_0x408c57){_0x408c57=_0x408c57||0xcc;return function(_0x1ee6ca){if(_0x1ee6ca){return _0x112ec5[_0xffc0('0x1f')](_0x408c57);}return _0x112ec5['status'](_0x408c57)[_0xffc0('0x20')]();};}function respondWithResult(_0x2fb0c7,_0x3f22cd){_0x3f22cd=_0x3f22cd||0xc8;return function(_0x4ccd81){if(_0x4ccd81){return _0x2fb0c7[_0xffc0('0x21')](_0x3f22cd)[_0xffc0('0x22')](_0x4ccd81);}};}function respondWithFilteredResult(_0x1a9d5a,_0x188a83){return function(_0x51ac32){if(_0x51ac32){var _0x2d9838=typeof _0x188a83[_0xffc0('0x23')]===_0xffc0('0x24')&&typeof _0x188a83[_0xffc0('0x25')]===_0xffc0('0x24');var _0x1ebe39=_0x51ac32['count'];var _0x33fcbe=_0x2d9838?0x0:_0x188a83[_0xffc0('0x23')];var _0x58fac2=_0x2d9838?_0x51ac32[_0xffc0('0x26')]:_0x188a83['offset']+_0x188a83[_0xffc0('0x25')];var _0x16ea44;if(_0x58fac2>=_0x1ebe39){_0x58fac2=_0x1ebe39;_0x16ea44=0xc8;}else{_0x16ea44=0xce;}_0x1a9d5a[_0xffc0('0x21')](_0x16ea44);return _0x1a9d5a['set']('Content-Range',_0x33fcbe+'-'+_0x58fac2+'/'+_0x1ebe39)[_0xffc0('0x22')](_0x51ac32);}return null;};}function patchUpdates(_0x1085e8){return function(_0x20f3a2){try{jsonpatch[_0xffc0('0x27')](_0x20f3a2,_0x1085e8,!![]);}catch(_0x1bf6c5){return BPromise[_0xffc0('0x28')](_0x1bf6c5);}return _0x20f3a2['save']();};}function saveUpdates(_0x25ac79,_0x446af9){return function(_0x3c3b70){if(_0x3c3b70){return _0x3c3b70[_0xffc0('0x29')](_0x25ac79)[_0xffc0('0x2a')](function(_0x26d9ce){return _0x26d9ce;});}return null;};}function removeEntity(_0x3d052d,_0x5654da){return function(_0x12e425){if(_0x12e425){return _0x12e425['destroy']()[_0xffc0('0x2a')](function(){var _0x5d4feb=_0x12e425[_0xffc0('0x2b')]({'plain':!![]});var _0x3148eb=_0xffc0('0x2c');return db[_0xffc0('0x2d')]['destroy']({'where':{'type':_0x3148eb,'resourceId':_0x5d4feb['id']}})[_0xffc0('0x2a')](function(){return _0x12e425;});})[_0xffc0('0x2a')](function(){_0x3d052d[_0xffc0('0x21')](0xcc)[_0xffc0('0x20')]();});}};}function handleEntityNotFound(_0x42cace,_0x21c37c){return function(_0x3b4172){if(!_0x3b4172){_0x42cace[_0xffc0('0x1f')](0x194);}return _0x3b4172;};}function handleError(_0x14ebd1,_0x595f7c){_0x595f7c=_0x595f7c||0x1f4;return function(_0xb8e8d3){logger[_0xffc0('0x2e')](_0xb8e8d3[_0xffc0('0x2f')]);if(_0xb8e8d3[_0xffc0('0x30')]){delete _0xb8e8d3['name'];}_0x14ebd1['status'](_0x595f7c)[_0xffc0('0x31')](_0xb8e8d3);};}exports[_0xffc0('0x32')]=function(_0xfc7baa,_0x31fb9f){var _0x16a729={},_0x437b00={},_0x400bed={'count':0x0,'rows':[]};var _0x20392b=_[_0xffc0('0x33')](db[_0xffc0('0x34')][_0xffc0('0x35')],function(_0x38bd1b){return{'name':_0x38bd1b[_0xffc0('0x36')],'type':_0x38bd1b[_0xffc0('0x37')][_0xffc0('0x38')]};});_0x437b00[_0xffc0('0x39')]=_[_0xffc0('0x33')](_0x20392b,'name');_0x437b00[_0xffc0('0x3a')]=_[_0xffc0('0x3b')](_0xfc7baa[_0xffc0('0x3a')]);_0x437b00[_0xffc0('0x3c')]=_[_0xffc0('0x3d')](_0x437b00[_0xffc0('0x39')],_0x437b00[_0xffc0('0x3a')]);_0x16a729[_0xffc0('0x3e')]=_[_0xffc0('0x3d')](_0x437b00[_0xffc0('0x39')],qs[_0xffc0('0x3f')](_0xfc7baa['query'][_0xffc0('0x3f')]));_0x16a729['attributes']=_0x16a729[_0xffc0('0x3e')]['length']?_0x16a729[_0xffc0('0x3e')]:_0x437b00[_0xffc0('0x39')];if(!_0xfc7baa['query'][_0xffc0('0x40')](_0xffc0('0x41'))){_0x16a729[_0xffc0('0x25')]=qs[_0xffc0('0x25')](_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x25')]);_0x16a729[_0xffc0('0x23')]=qs[_0xffc0('0x23')](_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x23')]);}_0x16a729[_0xffc0('0x42')]=qs[_0xffc0('0x43')](_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x43')]);_0x16a729[_0xffc0('0x44')]=qs[_0xffc0('0x3c')](_[_0xffc0('0x45')](_0xfc7baa['query'],_0x437b00[_0xffc0('0x3c')]),_0x20392b);if(_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x46')]){_0x16a729['where']=_[_0xffc0('0x47')](_0x16a729[_0xffc0('0x44')],{'$or':_['map'](_0x20392b,function(_0x2a71ed){if(_0x2a71ed['type']!==_0xffc0('0x48')){var _0xfc08a0={};_0xfc08a0[_0x2a71ed[_0xffc0('0x30')]]={'$like':'%'+_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x46')]+'%'};return _0xfc08a0;}})});}_0x16a729=_[_0xffc0('0x47')]({},_0x16a729,_0xfc7baa[_0xffc0('0x49')]);var _0x440013={'where':_0x16a729[_0xffc0('0x44')]};return db[_0xffc0('0x34')]['count'](_0x440013)[_0xffc0('0x2a')](function(_0x5d20f5){_0x400bed[_0xffc0('0x26')]=_0x5d20f5;if(_0xfc7baa[_0xffc0('0x3a')][_0xffc0('0x4a')]){_0x16a729[_0xffc0('0x4b')]=[{'all':!![]}];}return db['Plugin'][_0xffc0('0x4c')](_0x16a729);})['then'](function(_0x227826){_0x400bed[_0xffc0('0x4d')]=_0x227826;return _0x400bed;})[_0xffc0('0x2a')](respondWithFilteredResult(_0x31fb9f,_0x16a729))['catch'](handleError(_0x31fb9f,null));};exports[_0xffc0('0x4e')]=function(_0x11f57f,_0x3c3117){var _0x5d40dc={'raw':!![],'where':{'id':_0x11f57f[_0xffc0('0x4f')]['id']}},_0x2e149f={};_0x2e149f['model']=_[_0xffc0('0x3b')](db[_0xffc0('0x34')][_0xffc0('0x35')]);_0x2e149f[_0xffc0('0x3a')]=_[_0xffc0('0x3b')](_0x11f57f[_0xffc0('0x3a')]);_0x2e149f[_0xffc0('0x3c')]=_[_0xffc0('0x3d')](_0x2e149f['model'],_0x2e149f['query']);_0x5d40dc['attributes']=_[_0xffc0('0x3d')](_0x2e149f['model'],qs[_0xffc0('0x3f')](_0x11f57f[_0xffc0('0x3a')]['fields']));_0x5d40dc[_0xffc0('0x3e')]=_0x5d40dc[_0xffc0('0x3e')]['length']?_0x5d40dc['attributes']:_0x2e149f[_0xffc0('0x39')];if(_0x11f57f[_0xffc0('0x3a')][_0xffc0('0x4a')]){_0x5d40dc[_0xffc0('0x4b')]=[{'all':!![]}];}_0x5d40dc=_['merge']({},_0x5d40dc,_0x11f57f[_0xffc0('0x49')]);return db[_0xffc0('0x34')][_0xffc0('0x50')](_0x5d40dc)[_0xffc0('0x2a')](handleEntityNotFound(_0x3c3117,null))[_0xffc0('0x2a')](respondWithResult(_0x3c3117,null))[_0xffc0('0x51')](handleError(_0x3c3117,null));};exports[_0xffc0('0x52')]=function(_0x4a656e,_0x45d3c5,_0x4153f3){return db[_0xffc0('0x34')]['find']({'where':{'id':_0x4a656e['params']['id']},'attributes':['name',_0xffc0('0x8')],'raw':!![]})[_0xffc0('0x2a')](handleEntityNotFound(_0x45d3c5,null))['then'](function(_0x491903){if(_0x491903){var _0x3ba9b8=path[_0xffc0('0x53')](config[_0xffc0('0x54')],'server/files/plugins',util[_0xffc0('0x55')]('%s.zip',path[_0xffc0('0x56')](_0x491903[_0xffc0('0x8')])));var _0xaae5cd=fs['createWriteStream'](_0x3ba9b8);var _0x1946a3=archiver(_0xffc0('0x57'),{'zlib':{'level':0x9}});_0x1946a3['on'](_0xffc0('0x58'),function(_0x441e23){if(_0x441e23['code']===_0xffc0('0x59')){logger['error'](_0x441e23);}else{throw new db[(_0xffc0('0x5a'))][(_0xffc0('0x5b'))](_0xffc0('0x5c'));}});_0x1946a3['on']('error',function(_0xa64105){throw new db[(_0xffc0('0x5a'))][(_0xffc0('0x5b'))](_0xffc0('0x5c'));});_0x1946a3[_0xffc0('0x5d')](_0xaae5cd);_0x1946a3[_0xffc0('0x5e')]('**/*',{'cwd':path[_0xffc0('0x53')](config[_0xffc0('0x54')],'server/files/plugins',path[_0xffc0('0x5f')](_0x491903[_0xffc0('0x8')])),'ignore':[path[_0xffc0('0x53')](path[_0xffc0('0x56')](_0x491903[_0xffc0('0x8')]),'node_modules/**/*'),path[_0xffc0('0x53')](path[_0xffc0('0x56')](_0x491903[_0xffc0('0x8')]),_0xffc0('0x60'))],'nodir':!![]})[_0xffc0('0x61')]();_0xaae5cd['on']('close',function(){if(!fs[_0xffc0('0x62')](_0x3ba9b8)){throw new db[(_0xffc0('0x5a'))]['Error']('Plugin\x20not\x20found');}return _0x45d3c5['download'](_0x3ba9b8,util[_0xffc0('0x55')](_0xffc0('0x63'),path['basename'](_0x491903[_0xffc0('0x8')])),function(_0x4c2e57){if(_0x4c2e57){throw new db['Sequelize'][(_0xffc0('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xffc0('0x64')](_0x3ba9b8);logger[_0xffc0('0x65')]('Download\x20completed');logger[_0xffc0('0x65')](_0xffc0('0x66'));});});}return null;})[_0xffc0('0x51')](handleError(_0x45d3c5,null));};exports[_0xffc0('0x67')]=function(_0x582466,_0x5bb7cb,_0x5792b6){var _0x22feca=path[_0xffc0('0x56')](_0x582466['file'][_0xffc0('0x68')],path[_0xffc0('0x69')](_0x582466['file'][_0xffc0('0x68')]));var _0x11e002=path['join'](config['root'],_0xffc0('0x6a'),_0x582466['file']['filename']);var _0xae1453=path['join'](config[_0xffc0('0x54')],_0xffc0('0x6a'),_0x22feca);logger['info'](_0xffc0('0x6b'),_0x11e002);logger[_0xffc0('0x65')](_0xffc0('0x6c'),_0xae1453);try{fs[_0xffc0('0x6d')](_0x11e002,parseInt('0777',0x8));extract(_0x11e002,{'dir':_0xae1453},function(_0x308e4d){if(_0x308e4d){logger[_0xffc0('0x2e')](_0x308e4d);handleError(_0x308e4d,!![]);};var _0x15d3e5=fs[_0xffc0('0x6e')](_0xae1453);if(_0x15d3e5[_0xffc0('0x6f')]>0x1){removeReferences(_0x11e002,_0xae1453);logger[_0xffc0('0x2e')]('Invalid\x20plugin\x20structure');return _0x5792b6(new Error(_0xffc0('0x70')));}var _0x3022a3=fs[_0xffc0('0x71')](path[_0xffc0('0x53')](_0xae1453,_0x15d3e5[0x0]));if(_0x3022a3[_0xffc0('0x72')]()){removeReferences(_0x11e002,_0xae1453);logger['error']('Invalid\x20plugin\x20structure');return _0x5792b6(new Error('Invalid\x20plugin\x20structure'));}if(_0x3022a3['isDirectory']()){var _0x1ce577=fs['readdirSync'](path['join'](_0xae1453,_0x15d3e5[0x0]));if(_0x1ce577[_0xffc0('0x6f')]===0x0){removeReferences(_0x11e002,_0xae1453);logger[_0xffc0('0x2e')](_0xffc0('0x70'));return _0x5792b6(new Error('Invalid\x20plugin\x20structure'));}var _0x1c3b77=_0x1ce577['some'](function(_0x4e049d){return _0x4e049d===_0xffc0('0x73');});if(!_0x1c3b77){return _0x5792b6(new Error(_0xffc0('0x74')));}var _0x1d61ac=fs[_0xffc0('0x75')](path[_0xffc0('0x53')](_0xae1453,_0x15d3e5[0x0],_0xffc0('0x73')));var _0x5c39ff=JSON['parse'](_0x1d61ac);if(_0xffc0('0x24')==typeof _0x5c39ff[_0xffc0('0x30')]){return _0x5792b6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xffc0('0x24')==typeof _0x5c39ff[_0xffc0('0x37')]){return _0x5792b6(new Error(_0xffc0('0x76')));}if('undefined'==typeof _0x5c39ff['version']){return _0x5792b6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x5c39ff[_0xffc0('0x77')]){return _0x5792b6(new Error(_0xffc0('0x78')));}if(_0x5c39ff[_0xffc0('0x37')]===_0xffc0('0x79')){if(_0xffc0('0x24')==typeof _0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')]){return _0x5792b6(new Error(_0xffc0('0x7b')));}if(_0xffc0('0x24')==typeof _0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')][_0xffc0('0x7c')]&&_0xffc0('0x24')==typeof _0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')][_0xffc0('0x7d')]){return _0x5792b6(new Error(_0xffc0('0x7e')));}}else if(_0x5c39ff[_0xffc0('0x37')]===_0xffc0('0x7f')){if('undefined'==typeof _0x5c39ff[_0xffc0('0x77')][_0xffc0('0x80')]){return _0x5792b6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xffc0('0x24')==typeof _0x5c39ff['parameters'][_0xffc0('0x81')]){return _0x5792b6(new Error(_0xffc0('0x82')));}}else{return _0x5792b6(new Error(_0xffc0('0x83')));}var _0x3ec19a=_0x5c39ff['name'];var _0x42738d=_0x5c39ff[_0xffc0('0x84')];var _0x952ace=_0x5c39ff[_0xffc0('0x37')];var _0x54bf0e=_0x5c39ff[_0xffc0('0x85')]?_0x5c39ff[_0xffc0('0x85')]:_0xffc0('0x86');var _0x339fcf=_0x5c39ff[_0xffc0('0x87')]?_0x5c39ff[_0xffc0('0x87')]:_0xffc0('0x88');var _0x186f18='';var _0x227e86='';var _0x53bc56='';var _0x571d01='';var _0x511dd1=_0x5c39ff['version'];if(_0x952ace===_0xffc0('0x79')){if(_0xffc0('0x24')!=typeof _0x5c39ff['parameters'][_0xffc0('0x7a')]['admin']){var _0x2524cc=_0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xffc0('0x89')](_0x2524cc)){_0x186f18=path['join'](_0xffc0('0x8a'),_0x22feca,_0x15d3e5[0x0],_0x2524cc);}else{_0x186f18=_0x2524cc;}}else{logger[_0xffc0('0x65')](_0xffc0('0x8b'));}if(_0xffc0('0x24')!=typeof _0x5c39ff[_0xffc0('0x77')]['views']['agent']){var _0x569b75=_0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')][_0xffc0('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x569b75)){_0x227e86=path[_0xffc0('0x53')]('plugins',_0x22feca,_0x15d3e5[0x0],_0x569b75);}else{_0x227e86=_0x569b75;}}else{logger[_0xffc0('0x65')](_0xffc0('0x8c'));}}else if(_0x952ace==='script'){_0x53bc56=_0x5c39ff['parameters'][_0xffc0('0x80')];_0x571d01=_0x5c39ff['parameters'][_0xffc0('0x81')];if('undefined'!=typeof _0x5c39ff['parameters'][_0xffc0('0x7a')]){if('undefined'!=typeof _0x5c39ff['parameters'][_0xffc0('0x7a')][_0xffc0('0x7c')]){var _0x2524cc=_0x5c39ff['parameters'][_0xffc0('0x7a')][_0xffc0('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xffc0('0x89')](_0x2524cc)){_0x186f18=path['join'](_0xffc0('0x8a'),_0x22feca,_0x15d3e5[0x0],_0x2524cc);}else{_0x186f18=_0x2524cc;}}if(_0xffc0('0x24')!=typeof _0x5c39ff[_0xffc0('0x77')][_0xffc0('0x7a')][_0xffc0('0x7d')]){var _0x569b75=_0x5c39ff['parameters'][_0xffc0('0x7a')][_0xffc0('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xffc0('0x89')](_0x569b75)){_0x227e86=path[_0xffc0('0x53')](_0xffc0('0x8a'),_0x22feca,_0x15d3e5[0x0],_0x569b75);}else{_0x227e86=_0x569b75;}}}}var _0x17386e={'name':_0x3ec19a,'description':_0x42738d,'path':path[_0xffc0('0x53')](_0x22feca,_0x15d3e5[0x0]),'type':_0x952ace,'sidebar':_0x54bf0e,'icon':_0x339fcf,'adminUrl':_0x186f18,'agentUrl':_0x227e86,'scriptName':_0x53bc56,'scriptPath':_0x571d01,'version':_0x511dd1};removeReferences(_0x11e002,null);return db[_0xffc0('0x34')][_0xffc0('0x8d')](_0x17386e)['then'](function(_0x5e36b2){var _0x41ef44={'role':_0x582466[_0xffc0('0x8e')][_0xffc0('0x8f')],'userProfileId':_0x582466['body'][_0xffc0('0x90')]};if(!_0x41ef44)throw new Error(_0xffc0('0x91'));if(_0x41ef44[_0xffc0('0x8f')]===_0xffc0('0x92')){var _0x5923cf=_0x5e36b2['get']({'plain':!![]});return db[_0xffc0('0x93')][_0xffc0('0x50')]({'where':{'name':_0xffc0('0x2c'),'userProfileId':_0x41ef44[_0xffc0('0x90')]},'raw':!![]})[_0xffc0('0x2a')](function(_0xb93f85){if(_0xb93f85&&_0xb93f85[_0xffc0('0x94')]===0x0){return db[_0xffc0('0x2d')][_0xffc0('0x8d')]({'name':_0x5923cf[_0xffc0('0x30')],'resourceId':_0x5923cf['id'],'type':_0xb93f85[_0xffc0('0x30')],'sectionId':_0xb93f85['id']},{})[_0xffc0('0x2a')](function(){return _0x5e36b2;});}else{return _0x5e36b2;}})['catch'](function(_0x14c9cd){logger[_0xffc0('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14c9cd);throw _0x14c9cd;});}return _0x5e36b2;})[_0xffc0('0x2a')](respondWithResult(_0x5bb7cb,null))[_0xffc0('0x51')](handleError(_0x5bb7cb,null));}});}catch(_0x539dd6){_0x5bb7cb[_0xffc0('0x21')](0x1f4)[_0xffc0('0x31')](_0x539dd6);}};function removeReferences(_0x418202,_0x2bde9f){try{if(_0x418202){fs[_0xffc0('0x64')](_0x418202);logger[_0xffc0('0x65')](_0xffc0('0x95'));}if(_0x2bde9f){rimraf(_0x2bde9f,function(){});logger[_0xffc0('0x65')](_0xffc0('0x96'));}}catch(_0x46adf9){logger[_0xffc0('0x2e')](_0x46adf9);}}exports[_0xffc0('0x29')]=function(_0x44a0a1,_0x3d05a0,_0x5a41fb){return db[_0xffc0('0x34')][_0xffc0('0x50')]({'where':{'id':_0x44a0a1[_0xffc0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d05a0,null))[_0xffc0('0x2a')](saveUpdates(_0x44a0a1[_0xffc0('0x8e')],null))[_0xffc0('0x2a')](respondWithResult(_0x3d05a0,null))['catch'](handleError(_0x3d05a0,null));};exports[_0xffc0('0x97')]=function(_0x1a3e4e,_0x2d5ef8,_0x3dc529){return db[_0xffc0('0x34')][_0xffc0('0x50')]({'where':{'id':_0x1a3e4e[_0xffc0('0x4f')]['id']}})['then'](function(_0x40d6bb){if(_0x40d6bb){return _0x40d6bb['destroy']();}})[_0xffc0('0x2a')](function(_0xcc5aa2){rimraf(path[_0xffc0('0x53')](config[_0xffc0('0x54')],'server/files/plugins',path[_0xffc0('0x5f')](_0xcc5aa2['path'])),function(){});return _0xcc5aa2;})[_0xffc0('0x2a')](handleEntityNotFound(_0x2d5ef8,null))[_0xffc0('0x2a')](respondWithStatusCode(_0x2d5ef8,null))[_0xffc0('0x51')](handleError(_0x2d5ef8,null));};exports[_0xffc0('0x98')]=function(_0x4ca160,_0x1e97dd,_0x50d3be){return BPromise[_0xffc0('0x99')]()[_0xffc0('0x2a')](function(){if(!_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x8')]){throw new Error(_0xffc0('0x9a'));}if(!_0x4ca160[_0xffc0('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x18653e=_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x9b')]?_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x9b')]+':'+_0x4ca160['query']['port']:'http://localhost:'+_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x9c')];var _0x562a9a=_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x22')]?_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x22')]:!![];var _0x45da9c=_0x4ca160['query'][_0xffc0('0x9d')]?_0x4ca160[_0xffc0('0x3a')][_0xffc0('0x9d')]:null;var _0x5bed3e={'method':_0x4ca160[_0xffc0('0x9e')],'uri':util[_0xffc0('0x55')]('%s%s',_0x18653e,_0x4ca160[_0xffc0('0x3a')]['path']),'json':_0x562a9a,'resolveWithFullResponse':!![],'encoding':_0x45da9c,'qs':_0x4ca160[_0xffc0('0x3a')]};if(_0x4ca160[_0xffc0('0x9f')]){_0x5bed3e['headers']=_0x4ca160[_0xffc0('0x9f')];if(_0x5bed3e[_0xffc0('0x9f')][_0xffc0('0xa0')]){delete _0x5bed3e[_0xffc0('0x9f')]['content-length'];}}if(_0x5bed3e[_0xffc0('0x9f')][_0xffc0('0xa1')]){delete _0x5bed3e[_0xffc0('0x9f')][_0xffc0('0xa1')];}return rp(_0x5bed3e);})[_0xffc0('0x2a')](function(_0x13d9ac){if(_0x13d9ac){_0x1e97dd[_0xffc0('0xa2')](_0x13d9ac['headers']);logger[_0xffc0('0x65')](_0x13d9ac['body']);if(_['endsWith'](_0x4ca160[_0xffc0('0x3a')]['path'],_0xffc0('0x52'))&&_0x13d9ac[_0xffc0('0xa3')]==0x1f4){return _0x1e97dd[_0xffc0('0x1f')](_0x13d9ac[_0xffc0('0xa3')]);}else{return _0x1e97dd[_0xffc0('0x21')](_0x13d9ac[_0xffc0('0xa3')])[_0xffc0('0x31')](_0x13d9ac[_0xffc0('0x8e')]);}}else{return _0x1e97dd[_0xffc0('0x1f')](0xc8);}})[_0xffc0('0x51')](handleError(_0x1e97dd,null));};exports[_0xffc0('0xa4')]=function(_0x5c8aed,_0x4646ff,_0x282eff){return BPromise[_0xffc0('0x99')]()[_0xffc0('0x2a')](function(){if(!_0x5c8aed[_0xffc0('0x3a')][_0xffc0('0x8')]){throw new Error(_0xffc0('0x9a'));}if(!_0x5c8aed[_0xffc0('0x3a')]['port']){throw new Error(_0xffc0('0xa5'));}var _0x1947fd=_0x5c8aed[_0xffc0('0x3a')][_0xffc0('0x9b')]?_0x5c8aed['query']['hostname']+':'+_0x5c8aed['query'][_0xffc0('0x9c')]:'http://localhost:'+_0x5c8aed[_0xffc0('0x3a')][_0xffc0('0x9c')];var _0x56a93f=_0x5c8aed[_0xffc0('0x3a')]['json']?_0x5c8aed[_0xffc0('0x3a')][_0xffc0('0x22')]:!![];var _0x1bd75f=_0x5c8aed[_0xffc0('0x3a')][_0xffc0('0x9d')]?_0x5c8aed[_0xffc0('0x3a')]['encoding']:null;var _0x71ce23={'method':_0x5c8aed[_0xffc0('0x9e')],'uri':util[_0xffc0('0x55')](_0xffc0('0xa6'),_0x1947fd,_0x5c8aed['query'][_0xffc0('0x8')]),'json':_0x56a93f,'resolveWithFullResponse':!![],'encoding':_0x1bd75f,'body':_0x5c8aed[_0xffc0('0x8e')]};if(_0x5c8aed[_0xffc0('0x9f')]){_0x71ce23[_0xffc0('0x9f')]=_0x5c8aed['headers'];if(_0x71ce23['headers'][_0xffc0('0xa0')]){delete _0x71ce23[_0xffc0('0x9f')][_0xffc0('0xa0')];}}if(_0x71ce23[_0xffc0('0x9f')][_0xffc0('0xa1')]){delete _0x71ce23['headers'][_0xffc0('0xa1')];}return rp(_0x71ce23);})[_0xffc0('0x2a')](function(_0x212c33){if(_0x212c33){_0x4646ff[_0xffc0('0xa2')](_0x212c33[_0xffc0('0x9f')]);logger[_0xffc0('0x65')](_0x212c33[_0xffc0('0x8e')]);return _0x4646ff['status'](_0x212c33['statusCode'])[_0xffc0('0x31')](_0x212c33[_0xffc0('0x8e')]);}else{return _0x4646ff[_0xffc0('0x1f')](0xc8);}})[_0xffc0('0x51')](handleError(_0x4646ff,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a7827d4..6052bc9 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 _0x2cd0=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook'];(function(_0x56fb04,_0x523750){var _0x13382c=function(_0x19068d){while(--_0x19068d){_0x56fb04['push'](_0x56fb04['shift']());}};_0x13382c(++_0x523750);}(_0x2cd0,0x10f));var _0x02cd=function(_0x25e9df,_0x17a63a){_0x25e9df=_0x25e9df-0x0;var _0x3dea70=_0x2cd0[_0x25e9df];return _0x3dea70;};'use strict';var EventEmitter=require(_0x02cd('0x0'));var Plugin=require(_0x02cd('0x1'))['db'][_0x02cd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x02cd('0x3')](0x0);var events={'afterCreate':_0x02cd('0x4'),'afterUpdate':_0x02cd('0x5'),'afterDestroy':_0x02cd('0x6')};function emitEvent(_0x215b17){return function(_0x4fecc3,_0x3dfd49,_0x3c4a73){PluginEvents[_0x02cd('0x7')](_0x215b17+':'+_0x4fecc3['id'],_0x4fecc3);PluginEvents[_0x02cd('0x7')](_0x215b17,_0x4fecc3);_0x3c4a73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x02cd('0x8')](e,emitEvent(event));}}module[_0x02cd('0x9')]=PluginEvents; \ No newline at end of file +var _0x1a0b=['Plugin','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x311759,_0x1fa355){_0x311759=_0x311759-0x0;var _0x198b75=_0x1a0b[_0x311759];return _0x198b75;};'use strict';var EventEmitter=require(_0xb1a0('0x0'));var Plugin=require('../../mysqldb')['db'][_0xb1a0('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xb1a0('0x2')](0x0);var events={'afterCreate':_0xb1a0('0x3'),'afterUpdate':_0xb1a0('0x4'),'afterDestroy':_0xb1a0('0x5')};function emitEvent(_0x4522c2){return function(_0x46f819,_0x34c5fb,_0x1126a3){PluginEvents[_0xb1a0('0x6')](_0x4522c2+':'+_0x46f819['id'],_0x46f819);PluginEvents[_0xb1a0('0x6')](_0x4522c2,_0x46f819);_0x1126a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xb1a0('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 425caba..a673054 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 _0x967c=['exports','define','Plugin','lodash','util','../../config/logger','moment','bluebird','path','./plugin.attributes'];(function(_0x1c615b,_0x5003c1){var _0x22c070=function(_0x2d2a7a){while(--_0x2d2a7a){_0x1c615b['push'](_0x1c615b['shift']());}};_0x22c070(++_0x5003c1);}(_0x967c,0xfd));var _0xc967=function(_0x3a9b58,_0x61d8ec){_0x3a9b58=_0x3a9b58-0x0;var _0x205838=_0x967c[_0x3a9b58];return _0x205838;};'use strict';var _=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var logger=require(_0xc967('0x2'))('api');var moment=require(_0xc967('0x3'));var BPromise=require(_0xc967('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc967('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc967('0x6'));module[_0xc967('0x7')]=function(_0x154162,_0x408a54){return _0x154162[_0xc967('0x8')](_0xc967('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e64=['./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x554d24,_0x2a9d57){var _0x1d1396=function(_0x48a811){while(--_0x48a811){_0x554d24['push'](_0x554d24['shift']());}};_0x1d1396(++_0x2a9d57);}(_0x6e64,0x79));var _0x46e6=function(_0x25ee6b,_0x2ff72f){_0x25ee6b=_0x25ee6b-0x0;var _0x169ec8=_0x6e64[_0x25ee6b];return _0x169ec8;};'use strict';var _=require(_0x46e6('0x0'));var util=require(_0x46e6('0x1'));var logger=require(_0x46e6('0x2'))(_0x46e6('0x3'));var moment=require(_0x46e6('0x4'));var BPromise=require(_0x46e6('0x5'));var rp=require(_0x46e6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46e6('0x7'));var config=require(_0x46e6('0x8'));var attributes=require(_0x46e6('0x9'));module[_0x46e6('0xa')]=function(_0x4e11d7,_0x52d20b){return _0x4e11d7[_0x46e6('0xb')](_0x46e6('0xc'),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 ff2c71f..da37475 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 _0x1044=['http','redis','defaults','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','options','raw','CreatePlugin','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2634a7,_0x118508){var _0xa52e2c=function(_0x400f75){while(--_0x400f75){_0x2634a7['push'](_0x2634a7['shift']());}};_0xa52e2c(++_0x118508);}(_0x1044,0x16f));var _0x4104=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1044[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x4104('0x0'));var util=require(_0x4104('0x1'));var moment=require(_0x4104('0x2'));var BPromise=require(_0x4104('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4104('0x4'))['db'];var utils=require(_0x4104('0x5'));var logger=require('../../config/logger')(_0x4104('0x6'));var config=require(_0x4104('0x7'));var jayson=require(_0x4104('0x8'));var client=jayson[_0x4104('0x9')][_0x4104('0xa')]({'port':0x232a});config[_0x4104('0xb')]=_[_0x4104('0xc')](config[_0x4104('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4104('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x254dd9,_0x1794bf,_0x1987d9){return new BPromise(function(_0x2ed1ec,_0x1f5234){return client[_0x4104('0xd')](_0x254dd9,_0x1987d9)[_0x4104('0xe')](function(_0xdaea38){logger[_0x4104('0xf')](_0x4104('0x10'),_0x1794bf,'request\x20sent');logger['debug'](_0x4104('0x11'),_0x1794bf,_0x4104('0x12'),JSON[_0x4104('0x13')](_0xdaea38));if(_0xdaea38[_0x4104('0x14')]){if(_0xdaea38[_0x4104('0x14')][_0x4104('0x15')]===0x1f4){logger['error'](_0x4104('0x10'),_0x1794bf,_0xdaea38[_0x4104('0x14')][_0x4104('0x16')]);return _0x1f5234(_0xdaea38[_0x4104('0x14')]['message']);}logger[_0x4104('0x14')]('Plugin,\x20%s,\x20%s',_0x1794bf,_0xdaea38['error']['message']);return _0x2ed1ec(_0xdaea38['error']['message']);}else{logger[_0x4104('0xf')](_0x4104('0x10'),_0x1794bf,'request\x20sent');_0x2ed1ec(_0xdaea38['result'][_0x4104('0x16')]);}})[_0x4104('0x17')](function(_0x1e2fbc){logger[_0x4104('0x14')](_0x4104('0x10'),_0x1794bf,_0x1e2fbc);_0x1f5234(_0x1e2fbc);});});}exports['CreatePlugin']=function(_0x7e7f44){var _0x470918=this;return new Promise(function(_0x2b32d5,_0x3e6e0b){return db['Plugin'][_0x4104('0x18')](_0x7e7f44['body'],{'raw':_0x7e7f44['options']?_0x7e7f44[_0x4104('0x19')][_0x4104('0x1a')]===undefined?!![]:![]:!![]})[_0x4104('0xe')](function(_0x3040ec){logger[_0x4104('0xf')](_0x4104('0x1b'),_0x7e7f44);logger[_0x4104('0x1c')]('CreatePlugin',_0x7e7f44,JSON['stringify'](_0x3040ec));_0x2b32d5(_0x3040ec);})[_0x4104('0x17')](function(_0x151850){logger['error'](_0x4104('0x1b'),_0x151850[_0x4104('0x16')],_0x7e7f44);_0x3e6e0b(_0x470918[_0x4104('0x14')](0x1f4,_0x151850['message']));});});}; \ No newline at end of file +var _0x6af2=['result','CreatePlugin','create','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x576675,_0x43a637){var _0x20fbd6=function(_0x551a6c){while(--_0x551a6c){_0x576675['push'](_0x576675['shift']());}};_0x20fbd6(++_0x43a637);}(_0x6af2,0x17d));var _0x26af=function(_0x330df2,_0x4e79c3){_0x330df2=_0x330df2-0x0;var _0x110b32=_0x6af2[_0x330df2];return _0x110b32;};'use strict';var _=require(_0x26af('0x0'));var util=require(_0x26af('0x1'));var moment=require(_0x26af('0x2'));var BPromise=require(_0x26af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26af('0x4'))['db'];var utils=require(_0x26af('0x5'));var logger=require(_0x26af('0x6'))(_0x26af('0x7'));var config=require(_0x26af('0x8'));var jayson=require(_0x26af('0x9'));var client=jayson['client'][_0x26af('0xa')]({'port':0x232a});config[_0x26af('0xb')]=_['defaults'](config[_0x26af('0xb')],{'host':_0x26af('0xc'),'port':0x18eb});var socket=require(_0x26af('0xd'))(new Redis(config[_0x26af('0xb')]));require('./plugin.socket')[_0x26af('0xe')](socket);function respondWithRpcPromise(_0x4aba51,_0x415032,_0x3a1fd1){return new BPromise(function(_0x56108a,_0x41c772){return client[_0x26af('0xf')](_0x4aba51,_0x3a1fd1)[_0x26af('0x10')](function(_0x142b40){logger[_0x26af('0x11')](_0x26af('0x12'),_0x415032,_0x26af('0x13'));logger[_0x26af('0x14')](_0x26af('0x15'),_0x415032,'request\x20sent',JSON['stringify'](_0x142b40));if(_0x142b40[_0x26af('0x16')]){if(_0x142b40[_0x26af('0x16')][_0x26af('0x17')]===0x1f4){logger['error'](_0x26af('0x12'),_0x415032,_0x142b40[_0x26af('0x16')][_0x26af('0x18')]);return _0x41c772(_0x142b40[_0x26af('0x16')][_0x26af('0x18')]);}logger[_0x26af('0x16')](_0x26af('0x12'),_0x415032,_0x142b40[_0x26af('0x16')][_0x26af('0x18')]);return _0x56108a(_0x142b40['error'][_0x26af('0x18')]);}else{logger['info'](_0x26af('0x12'),_0x415032,_0x26af('0x13'));_0x56108a(_0x142b40[_0x26af('0x19')][_0x26af('0x18')]);}})['catch'](function(_0x1c1ced){logger[_0x26af('0x16')](_0x26af('0x12'),_0x415032,_0x1c1ced);_0x41c772(_0x1c1ced);});});}exports[_0x26af('0x1a')]=function(_0x548c4a){var _0x1d920e=this;return new Promise(function(_0x5d3125,_0x2372aa){return db['Plugin'][_0x26af('0x1b')](_0x548c4a['body'],{'raw':_0x548c4a['options']?_0x548c4a['options']['raw']===undefined?!![]:![]:!![]})[_0x26af('0x10')](function(_0x14996c){logger[_0x26af('0x11')](_0x26af('0x1a'),_0x548c4a);logger[_0x26af('0x14')]('CreatePlugin',_0x548c4a,JSON['stringify'](_0x14996c));_0x5d3125(_0x14996c);})[_0x26af('0x1c')](function(_0x585bc9){logger[_0x26af('0x16')](_0x26af('0x1a'),_0x585bc9[_0x26af('0x18')],_0x548c4a);_0x2372aa(_0x1d920e['error'](0x1f4,_0x585bc9[_0x26af('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index adc0ebd..1abc048 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 _0x7dc1=['update','emit','removeListener','length','plugin:','save','remove'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x7dc1,0x17f));var _0x17dc=function(_0x1c658d,_0x32a607){_0x1c658d=_0x1c658d-0x0;var _0x147e1c=_0x7dc1[_0x1c658d];return _0x147e1c;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x17dc('0x0'),_0x17dc('0x1'),_0x17dc('0x2')];function createListener(_0x36a6d1,_0x2d8199){return function(_0x3f34fc){_0x2d8199[_0x17dc('0x3')](_0x36a6d1,_0x3f34fc);};}function removeListener(_0x8e3a73,_0x1e17b4){return function(){PluginEvents[_0x17dc('0x4')](_0x8e3a73,_0x1e17b4);};}exports['register']=function(_0x484103){for(var _0x25d453=0x0,_0x4aba9c=events[_0x17dc('0x5')];_0x25d453<_0x4aba9c;_0x25d453++){var _0x59842c=events[_0x25d453];var _0x3ef2cb=createListener(_0x17dc('0x6')+_0x59842c,_0x484103);PluginEvents['on'](_0x59842c,_0x3ef2cb);}}; \ No newline at end of file +var _0x2f47=['remove','update','removeListener','register','length'];(function(_0x27b94b,_0x5a7563){var _0x8d94b2=function(_0x311fea){while(--_0x311fea){_0x27b94b['push'](_0x27b94b['shift']());}};_0x8d94b2(++_0x5a7563);}(_0x2f47,0x159));var _0x72f4=function(_0x33030c,_0x35cce3){_0x33030c=_0x33030c-0x0;var _0x503291=_0x2f47[_0x33030c];return _0x503291;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x72f4('0x0'),_0x72f4('0x1')];function createListener(_0x558713,_0x12dd06){return function(_0x2d4e84){_0x12dd06['emit'](_0x558713,_0x2d4e84);};}function removeListener(_0xd3df6d,_0x533c67){return function(){PluginEvents[_0x72f4('0x2')](_0xd3df6d,_0x533c67);};}exports[_0x72f4('0x3')]=function(_0x104268){for(var _0x174dc2=0x0,_0x37c04a=events[_0x72f4('0x4')];_0x174dc2<_0x37c04a;_0x174dc2++){var _0x44ebfe=events[_0x174dc2];var _0xc2bafc=createListener('plugin:'+_0x44ebfe,_0x104268);PluginEvents['on'](_0x44ebfe,_0xc2bafc);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ac45dee..18cf04c 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(_0x461e0f,_0x372b1a){var _0x290778=function(_0x431bb5){while(--_0x431bb5){_0x461e0f['push'](_0x461e0f['shift']());}};_0x290778(++_0x372b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x50cfa6,_0x369ea6){var _0x5a3715=function(_0x372d16){while(--_0x372d16){_0x50cfa6['push'](_0x50cfa6['shift']());}};_0x5a3715(++_0x369ea6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 92f2dc0..e273d94 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 _0xbee3=['sendStatus','status','json','error','name','send','info','index','then','reject','length','describe','params','catch','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20id','../../config/pm2','path','child_process','bluebird'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xbee3,0xd5));var _0x3bee=function(_0xc3f2ee,_0x24d021){_0xc3f2ee=_0xc3f2ee-0x0;var _0x5600ef=_0xbee3[_0xc3f2ee];return _0x5600ef;};'use strict';var _=require('lodash');var pm2=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x3bee('0x1'));var exec=require(_0x3bee('0x2'))['exec'];var BPromise=require(_0x3bee('0x3'));function handleEntityNotFound(_0x1956c1,_0x1cf379){return function(_0x507c6a){if(!_0x507c6a){_0x1956c1[_0x3bee('0x4')](0x194);;}return _0x507c6a;};}function respondWithResult(_0x3baf77,_0x4c5ef5){_0x4c5ef5=_0x4c5ef5||0xc8;return function(_0x2fdeec){if(_0x2fdeec){return _0x3baf77[_0x3bee('0x5')](_0x4c5ef5)[_0x3bee('0x6')](_0x2fdeec);}return null;};}function handleError(_0x339223,_0xbdd5d5){_0xbdd5d5=_0xbdd5d5||0x1f4;return function(_0x9aab05){logger[_0x3bee('0x7')](_0x9aab05['stack']);if(_0x9aab05[_0x3bee('0x8')]){delete _0x9aab05[_0x3bee('0x8')];}_0x339223[_0x3bee('0x5')](_0xbdd5d5)[_0x3bee('0x9')](_0x9aab05);};}function execChildProcess(){return new BPromise(function(_0x356fef,_0xc53ada){exec('npm\x20install',function(_0x32c0b,_0x5bb283,_0x2da716){logger[_0x3bee('0xa')](_0x5bb283);logger[_0x3bee('0xa')](_0x2da716);if(_0x32c0b){logger[_0x3bee('0x7')](_0x32c0b);return _0xc53ada(_0x32c0b);}return _0x356fef(_0x5bb283);});});}exports[_0x3bee('0xb')]=function(_0x459129,_0xc8c1f0){return pm2['list']()[_0x3bee('0xc')](function(_0x33504d){if(_0x33504d){var _0x31ac52=_[_0x3bee('0xd')](_0x33504d,function(_0x3a0396){return _0x3a0396['name']==='express'||_0x3a0396[_0x3bee('0x8')]==='motion2';});return{'rows':_0x31ac52,'count':_0x31ac52[_0x3bee('0xe')]};}return null;})[_0x3bee('0xc')](respondWithResult(_0xc8c1f0,null))['catch'](handleError(_0xc8c1f0,null));};exports['show']=function(_0x1582a4,_0x36c5aa){return pm2[_0x3bee('0xf')](_0x1582a4[_0x3bee('0x10')]['id'])['then'](respondWithResult(_0x36c5aa,null))[_0x3bee('0xc')](handleEntityNotFound(_0x36c5aa,null))[_0x3bee('0x11')](handleError(_0x36c5aa,null));};exports[_0x3bee('0x12')]=function(_0x49b32d,_0x33d812){if(_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')]&&_0x49b32d['body']['script']){var _0x1afd0f=path[_0x3bee('0x14')](__dirname,'../../files/plugins',_0x49b32d[_0x3bee('0x13')][_0x3bee('0x15')]);var _0x2eea75=process[_0x3bee('0x16')]();process[_0x3bee('0x17')](path[_0x3bee('0x18')](_0x1afd0f));return execChildProcess()[_0x3bee('0xc')](function(_0x582fa9){process[_0x3bee('0x17')](_0x2eea75);return pm2[_0x3bee('0x19')]({'name':_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')],'script':_0x1afd0f});})['then'](function(_0x45249c){pm2[_0x3bee('0x1a')]();return _0x45249c[0x0];})[_0x3bee('0xc')](respondWithResult(_0x33d812,0xc9))['catch'](handleError(_0x33d812,null));}else{return _0x33d812['status'](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1b')});}};exports['update']=function(_0x2c0e50,_0x1b4ce0){if(_0x2c0e50[_0x3bee('0x13')]['id']){delete _0x2c0e50['body']['id'];}var _0x1984c4={'online':_0x3bee('0x1c'),'stopped':_0x3bee('0x1d')};if(_0x1984c4['hasOwnProperty'](_0x2c0e50[_0x3bee('0x13')][_0x3bee('0x5')])){return pm2[_0x1984c4[_0x2c0e50[_0x3bee('0x13')]['status']]](_0x2c0e50[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](respondWithResult(_0x1b4ce0,0xc8))[_0x3bee('0x11')](handleError(_0x1b4ce0,null));}else{return _0x1b4ce0[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x3fbc8c,_0x1e1529){if(_0x3fbc8c[_0x3bee('0x13')]['id']){delete _0x3fbc8c[_0x3bee('0x13')]['id'];}if(_0x3fbc8c['params']['id']){return pm2['delete'](_0x3fbc8c[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](function(_0x4f5b58){pm2['dump']();return _0x4f5b58[0x0];})[_0x3bee('0xc')](respondWithResult(_0x1e1529,null))[_0x3bee('0x11')](handleError(_0x1e1529,null));}else{return _0x1e1529[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1e')});}}; \ No newline at end of file +var _0x2e54=['exec','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','api','path','child_process'];(function(_0x4962d0,_0x4137e9){var _0x42a832=function(_0x502291){while(--_0x502291){_0x4962d0['push'](_0x4962d0['shift']());}};_0x42a832(++_0x4137e9);}(_0x2e54,0x1dd));var _0x42e5=function(_0xbb7979,_0x19c733){_0xbb7979=_0xbb7979-0x0;var _0x2458c4=_0x2e54[_0xbb7979];return _0x2458c4;};'use strict';var _=require(_0x42e5('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x42e5('0x1'));var path=require(_0x42e5('0x2'));var exec=require(_0x42e5('0x3'))[_0x42e5('0x4')];var BPromise=require(_0x42e5('0x5'));function handleEntityNotFound(_0x153440,_0x42736b){return function(_0x528772){if(!_0x528772){_0x153440[_0x42e5('0x6')](0x194);;}return _0x528772;};}function respondWithResult(_0x455f48,_0x38cb1b){_0x38cb1b=_0x38cb1b||0xc8;return function(_0x4bed10){if(_0x4bed10){return _0x455f48[_0x42e5('0x7')](_0x38cb1b)['json'](_0x4bed10);}return null;};}function handleError(_0x335b92,_0x490b99){_0x490b99=_0x490b99||0x1f4;return function(_0x3a8494){logger[_0x42e5('0x8')](_0x3a8494[_0x42e5('0x9')]);if(_0x3a8494[_0x42e5('0xa')]){delete _0x3a8494[_0x42e5('0xa')];}_0x335b92[_0x42e5('0x7')](_0x490b99)[_0x42e5('0xb')](_0x3a8494);};}function execChildProcess(){return new BPromise(function(_0x2fa2f0,_0x197752){exec('npm\x20install',function(_0x456298,_0x28b3b3,_0x5d57f4){logger[_0x42e5('0xc')](_0x28b3b3);logger[_0x42e5('0xc')](_0x5d57f4);if(_0x456298){logger[_0x42e5('0x8')](_0x456298);return _0x197752(_0x456298);}return _0x2fa2f0(_0x28b3b3);});});}exports[_0x42e5('0xd')]=function(_0x144fb4,_0x1faafc){return pm2[_0x42e5('0xe')]()[_0x42e5('0xf')](function(_0x447648){if(_0x447648){var _0x23957f=_['reject'](_0x447648,function(_0x3b3dd9){return _0x3b3dd9[_0x42e5('0xa')]===_0x42e5('0x10')||_0x3b3dd9[_0x42e5('0xa')]===_0x42e5('0x11');});return{'rows':_0x23957f,'count':_0x23957f[_0x42e5('0x12')]};}return null;})[_0x42e5('0xf')](respondWithResult(_0x1faafc,null))[_0x42e5('0x13')](handleError(_0x1faafc,null));};exports[_0x42e5('0x14')]=function(_0x3c7b79,_0x22655f){return pm2[_0x42e5('0x15')](_0x3c7b79[_0x42e5('0x16')]['id'])[_0x42e5('0xf')](respondWithResult(_0x22655f,null))['then'](handleEntityNotFound(_0x22655f,null))[_0x42e5('0x13')](handleError(_0x22655f,null));};exports['create']=function(_0x5f4428,_0x14d16d){if(_0x5f4428[_0x42e5('0x17')]['name']&&_0x5f4428[_0x42e5('0x17')][_0x42e5('0x18')]){var _0x1c2169=path[_0x42e5('0x19')](__dirname,_0x42e5('0x1a'),_0x5f4428[_0x42e5('0x17')][_0x42e5('0x18')]);var _0x58eee5=process['cwd']();process[_0x42e5('0x1b')](path['dirname'](_0x1c2169));return execChildProcess()[_0x42e5('0xf')](function(_0x2e9574){process[_0x42e5('0x1b')](_0x58eee5);return pm2[_0x42e5('0x1c')]({'name':_0x5f4428[_0x42e5('0x17')]['name'],'script':_0x1c2169});})[_0x42e5('0xf')](function(_0xf29221){pm2[_0x42e5('0x1d')]();return _0xf29221[0x0];})[_0x42e5('0xf')](respondWithResult(_0x14d16d,0xc9))[_0x42e5('0x13')](handleError(_0x14d16d,null));}else{return _0x14d16d['status'](0x1f4)['send']({'message':_0x42e5('0x1e')});}};exports['update']=function(_0x56f812,_0x1b60be){if(_0x56f812['body']['id']){delete _0x56f812[_0x42e5('0x17')]['id'];}var _0x2d9e65={'online':_0x42e5('0x1f'),'stopped':_0x42e5('0x20')};if(_0x2d9e65[_0x42e5('0x21')](_0x56f812[_0x42e5('0x17')]['status'])){return pm2[_0x2d9e65[_0x56f812[_0x42e5('0x17')][_0x42e5('0x7')]]](_0x56f812[_0x42e5('0x16')]['id'])[_0x42e5('0xf')](respondWithResult(_0x1b60be,0xc8))[_0x42e5('0x13')](handleError(_0x1b60be,null));}else{return _0x1b60be[_0x42e5('0x7')](0x1f4)[_0x42e5('0xb')]({'message':_0x42e5('0x22')});}};exports[_0x42e5('0x23')]=function(_0x2ba9ef,_0x2c7542){if(_0x2ba9ef[_0x42e5('0x17')]['id']){delete _0x2ba9ef[_0x42e5('0x17')]['id'];}if(_0x2ba9ef['params']['id']){return pm2[_0x42e5('0x24')](_0x2ba9ef[_0x42e5('0x16')]['id'])[_0x42e5('0xf')](function(_0x156e73){pm2['dump']();return _0x156e73[0x0];})['then'](respondWithResult(_0x2c7542,null))[_0x42e5('0x13')](handleError(_0x2c7542,null));}else{return _0x2c7542['status'](0x1f4)[_0x42e5('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 11f8570..40245fe 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 _0x18e4=['exports','express','Router','./realtime.controller','get','isAuthenticated','getQueues'];(function(_0x5a0559,_0x16a2bb){var _0x5b2a4b=function(_0x26977b){while(--_0x26977b){_0x5a0559['push'](_0x5a0559['shift']());}};_0x5b2a4b(++_0x16a2bb);}(_0x18e4,0xe8));var _0x418e=function(_0x1bec0d,_0x338db4){_0x1bec0d=_0x1bec0d-0x0;var _0x49e3e3=_0x18e4[_0x1bec0d];return _0x49e3e3;};'use strict';var express=require(_0x418e('0x0'));var router=express[_0x418e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x418e('0x2'));router[_0x418e('0x3')]('/agents',auth[_0x418e('0x4')](),controller['getAgents']);router['get']('/queues',auth[_0x418e('0x4')](),controller[_0x418e('0x5')]);module[_0x418e('0x6')]=router; \ No newline at end of file +var _0x9b4d=['exports','express','Router','../../components/auth/service','get','isAuthenticated','/queues','getQueues'];(function(_0x1ef607,_0x3cb96e){var _0x1d2230=function(_0x15eeac){while(--_0x15eeac){_0x1ef607['push'](_0x1ef607['shift']());}};_0x1d2230(++_0x3cb96e);}(_0x9b4d,0x1b9));var _0xd9b4=function(_0x4559d6,_0x21ff92){_0x4559d6=_0x4559d6-0x0;var _0x3b77ae=_0x9b4d[_0x4559d6];return _0x3b77ae;};'use strict';var express=require(_0xd9b4('0x0'));var router=express[_0xd9b4('0x1')]();var auth=require(_0xd9b4('0x2'));var controller=require('./realtime.controller');router[_0xd9b4('0x3')]('/agents',auth[_0xd9b4('0x4')](),controller['getAgents']);router[_0xd9b4('0x3')](_0xd9b4('0x5'),auth[_0xd9b4('0x4')](),controller[_0xd9b4('0x6')]);module[_0xd9b4('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 c06e002..a29ca57 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 _0x31f0=['routealias','smsPause','resolve','fieldName','type','key','query','agent','getOptions','role','user','userProfileId','sort','filter','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','includes','channel','toLowerCase','rawAttributes','QueueCampaigns','Queues','all','util','jayson/promise','../../config/logger','api','../../mysqldb','client','http','undefined','limit','offset','count','status','Content-Range','json','error','stack','name','send','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','loggedIn','busy','pick','length','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','push','User','Queue','Pause','findAll','QueueId','loggedInDb','unknown','unavailable','ringing','chatPause','faxPause','mailPause','voicePause','every','idle','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','*pause','userpic','lastLoginAt','pauseType','openchannelPause','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording'];(function(_0x5032a7,_0x59d13b){var _0x116ad1=function(_0x459b4e){while(--_0x459b4e){_0x5032a7['push'](_0x5032a7['shift']());}};_0x116ad1(++_0x59d13b);}(_0x31f0,0xb7));var _0x031f=function(_0x56d6d6,_0x702a1d){_0x56d6d6=_0x56d6d6-0x0;var _0x2975a2=_0x31f0[_0x56d6d6];return _0x2975a2;};'use strict';var util=require(_0x031f('0x0'));var _=require('lodash');var jayson=require(_0x031f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x031f('0x2'))(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var amiClient=jayson[_0x031f('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x031f('0x5')][_0x031f('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x4f6059,_0x4c0f94){return function(_0x56328c){if(_0x56328c){var _0x3dc98e=typeof _0x4c0f94['offset']===_0x031f('0x7')&&typeof _0x4c0f94[_0x031f('0x8')]===_0x031f('0x7');var _0x3e41ed=_0x56328c['count'];var _0x2e5624=_0x3dc98e?0x0:_0x4c0f94[_0x031f('0x9')];var _0x327f11=_0x3dc98e?_0x56328c[_0x031f('0xa')]:_0x4c0f94[_0x031f('0x9')]+_0x4c0f94[_0x031f('0x8')];var _0x2202dc;if(_0x327f11>=_0x3e41ed){_0x327f11=_0x3e41ed;_0x2202dc=0xc8;}else{_0x2202dc=0xce;}_0x4f6059[_0x031f('0xb')](_0x2202dc);return _0x4f6059['set'](_0x031f('0xc'),_0x2e5624+'-'+_0x327f11+'/'+_0x3e41ed)[_0x031f('0xd')](_0x56328c);}return null;};}function handleError(_0x28da6e,_0x351052){_0x351052=_0x351052||0x1f4;return function(_0x3819bb){logger[_0x031f('0xe')](_0x3819bb[_0x031f('0xf')]);if(_0x3819bb['name']){delete _0x3819bb[_0x031f('0x10')];}_0x28da6e[_0x031f('0xb')](_0x351052)[_0x031f('0x11')](_0x3819bb);};}function getRealtimeAgents(){return new Promise(function(_0x2e3dfe,_0x2ea549){return amiClient['request']('Agents',{})[_0x031f('0x12')](function(_0x3a10aa){if(_0x3a10aa[_0x031f('0xe')])throw new Error(_0x031f('0x13'));var _0x5196b1=_0x3a10aa[_0x031f('0x14')];return routingClient[_0x031f('0x15')]('Agents',{})[_0x031f('0x12')](function(_0x535e70){if(_0x535e70[_0x031f('0xe')])throw new Error(_0x031f('0x16'));var _0x563bc8=_0x535e70[_0x031f('0x14')];return _0x2e3dfe(_[_0x031f('0x17')]({},_0x5196b1,_0x563bc8));});})[_0x031f('0x18')](function(_0x1b76d6){_0x2ea549(_0x1b76d6);});});}function getRealtimeQueues(_0x2825ef,_0xf76f1b){return new Promise(function(_0x345bde,_0x29dd6e){var _0x48a76e=_0xf76f1b===_0x031f('0x19')?amiClient:routingClient;return _0x48a76e[_0x031f('0x15')](_[_0x031f('0x1a')](_0xf76f1b)+'Queues',_0x2825ef)['then'](function(_0xa11a2b){if(_0xa11a2b['error'])throw new Error(util[_0x031f('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xf76f1b));return _0x345bde(_0xa11a2b['result']);})['catch'](function(_0x971691){_0x29dd6e(_0x971691);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x12c406,_0x2920cd){return amiClient[_0x031f('0x15')]('VoiceQueuesChannels',{})[_0x031f('0x12')](function(_0x5a64c0){if(_0x5a64c0[_0x031f('0xe')])throw new Error(_0x031f('0x1c'));return _0x12c406(_0x5a64c0[_0x031f('0x14')]);})['catch'](function(_0x35af16){_0x2920cd(_0x35af16);});});}function initializeQueues(_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){var _0x2403e9=['loggedIn',_0x031f('0x1d'),_0x031f('0x1e'),_0x031f('0x1f'),_0x031f('0x20')];if(_0x3847b2===_0x031f('0x19')&&_0x28a617===_0x031f('0x21')){_0x2403e9['push'](_0x031f('0x22'),_0x031f('0x23'),_0x031f('0x24'),_0x031f('0x25'),_0x031f('0x26'),_0x031f('0x27'),_0x031f('0x28'),_0x031f('0x29'),_0x031f('0x2a'),_0x031f('0x2b'),_0x031f('0x2c'),'erlangBusyFactor',_0x031f('0x2d'),_0x031f('0x2e'),_0x031f('0x2f'),_0x031f('0x30'),_0x031f('0x31'),_0x031f('0x32'),_0x031f('0x33'),_0x031f('0x34'),_0x031f('0x35'),_0x031f('0x36'));}return _0x3b2a51[_0x031f('0x37')](function(_0x17217d){var _0x4610fa=_0x17217d['get']({'plain':!![]});_0x4610fa[_0x031f('0x38')]=[];_0x4610fa[_0x031f('0x20')]=0x0;_0x4610fa['loggedInDb']=0x0;_0x4610fa[_0x031f('0x39')]=0x0;_0x4610fa[_0x031f('0x1d')]=0x0;_0x4610fa['waiting']=0x0;if(_0x3847b2===_0x031f('0x19')){_0x4610fa[_0x031f('0x1f')]=0x0;_0x4610fa[_0x031f('0x3a')]=0x0;if(_0x28a617===_0x031f('0x21')){_0x4610fa['pTalking']=0x0;_0x4610fa['originated']=0x0;}}var _0x36ab13=_['find'](_0x54b44e,['id',_0x4610fa['id']]);if(_0x36ab13)_[_0x031f('0x17')](_0x4610fa,_[_0x031f('0x3b')](_0x36ab13,_0x2403e9));return _0x4610fa;});}function updateAgentVoiceStatus(_0x43ef89,_0x56a7f0,_0x5c33c5){var _0x3c1e48=_['filter'](_0x5c33c5,['queue',_0x56a7f0[_0x031f('0x10')]]);if(_0x3c1e48[_0x031f('0x3c')]===0x0)return _0x43ef89[_0x031f('0x3a')]=!![];if(_[_0x031f('0x3d')](_0x3c1e48,[_0x031f('0x3e'),_0x43ef89[_0x031f('0x3f')][_0x031f('0x40')]()]))return _0x43ef89['talking']=!![];if(!_0x43ef89[_0x031f('0x1f')])return _0x43ef89[_0x031f('0x3a')]=!![];}function getVoiceQueueAgents(_0xb3b188,_0x1e9302,_0x58daa2,_0x2be5d1){var _0x10f590=_[_0x031f('0x41')](_0x1e9302,['id',_0xb3b188['id']]);if(!_0x10f590)return _0xb3b188;return _0x10f590['getMembers']({'raw':!![]})[_0x031f('0x12')](function(_0x3b504c){for(var _0x5d6826=0x0;_0x5d6826<_0x3b504c[_0x031f('0x3c')];_0x5d6826++){var _0x268dc7=_['find'](_0x58daa2,['id',_0x3b504c[_0x5d6826]['UserId']]);if(!_0x268dc7){_0x268dc7={'id':_0x3b504c[_0x5d6826][_0x031f('0x42')],'name':_0x3b504c[_0x5d6826][_0x031f('0x42')],'accountcode':'','online':![]};}var _0x9efbc4={'id':_0x268dc7['id'],'name':_0x268dc7[_0x031f('0x10')],'internal':_0x268dc7[_0x031f('0x43')],'online':Boolean(_0x268dc7[_0x031f('0x44')]),'paused':Boolean(_0x3b504c[_0x5d6826][_0x031f('0x20')])};if(_0x268dc7['voiceStatus']===_0x031f('0x1f'))updateAgentVoiceStatus(_0x9efbc4,_0xb3b188,_0x2be5d1);if(_0x9efbc4[_0x031f('0x44')])_0xb3b188['loggedInDb']++;if(_0x9efbc4[_0x031f('0x3a')])_0xb3b188['busy']++;if(_0x9efbc4[_0x031f('0x20')]&&!_0x9efbc4[_0x031f('0x3a')]&&!_0x9efbc4['talking'])_0xb3b188[_0x031f('0x20')]++;_0xb3b188[_0x031f('0x38')][_0x031f('0x45')](_0x9efbc4);}return _0xb3b188;});}function getQueueAgents(_0x50f5d4,_0x98747f,_0x213e1c){var _0x1d3324=_0x031f('0x46')+_[_0x031f('0x1a')](_0x213e1c)+_0x031f('0x47');var _0x236a18=_0x213e1c+_0x031f('0x48');return db[_0x1d3324][_0x031f('0x49')]({'where':{[_['startCase'](_0x213e1c)+_0x031f('0x4a')]:_0x50f5d4['id']},'raw':!![]})[_0x031f('0x12')](function(_0x28f2b3){for(var _0x3205ce=0x0;_0x3205ce<_0x28f2b3[_0x031f('0x3c')];_0x3205ce++){var _0x2c879c=_[_0x031f('0x41')](_0x98747f,['id',_0x28f2b3[_0x3205ce][_0x031f('0x42')]]);if(!_0x2c879c){_0x2c879c={'id':_0x28f2b3[_0x3205ce][_0x031f('0x42')],'name':_0x28f2b3[_0x3205ce]['UserId'],'online':![],['pauseField']:![]};}var _0x38539a={'id':_0x2c879c['id'],'name':_0x2c879c['name'],'online':Boolean(_0x2c879c['online']),'paused':Boolean(_0x2c879c[_0x236a18])};if(_0x38539a[_0x031f('0x44')])_0x50f5d4[_0x031f('0x4b')]++;_0x50f5d4[_0x031f('0x38')][_0x031f('0x45')](_0x38539a);}return _0x50f5d4;});}function isIdle(_0x10d625){return _0x10d625==='idle'||_0x10d625===_0x031f('0x4c')||_0x10d625===_0x031f('0x4d')||_0x10d625===_0x031f('0x4e')||_['isNil'](_0x10d625);}function isAgentPaused(_0x274166,_0x2e7e35){var _0x2dba78=[_0x274166[_0x031f('0x4f')],_0x274166[_0x031f('0x50')],_0x274166[_0x031f('0x51')],_0x274166['openchannelPause'],_0x274166['smsPause'],_0x274166[_0x031f('0x52')],_0x274166['whatsappPause']];if(!_0x2e7e35)return _[_0x031f('0x53')](_0x2dba78);var _0x3bba44=_['filter'](_0x2dba78);return _0x3bba44[_0x031f('0x3c')]>0x0&&_0x3bba44['length']<_0x2dba78['length']?!![]:![];}function isAgentIdle(_0x35a949){if(_0x35a949['voiceStatus']!==_0x031f('0x54')&&_0x35a949['voicePause']){_0x35a949[_0x031f('0x55')]=_0x031f('0x56');return![];}return _['every']([_0x35a949[_0x031f('0x57')],_0x35a949[_0x031f('0x58')],_0x35a949['mailStatus'],_0x35a949[_0x031f('0x59')],_0x35a949['smsStatus'],_0x35a949[_0x031f('0x55')],_0x35a949['whatsappStatus']],isIdle);}function getAgentStatus(_0x1464df){var _0x24848b=_0x031f('0x4c');if(isAgentPaused(_0x1464df))_0x24848b=_0x031f('0x56');else if(isAgentPaused(_0x1464df,!![]))_0x24848b=_0x031f('0x5a');else if(isAgentIdle(_0x1464df))_0x24848b='idle';else _0x24848b=_0x031f('0x3a');return _0x24848b;}exports['getAgents']=function(_0x186957,_0x414350){var _0x4d49f8={'count':0x0,'rows':[]},_0x1f9c55={},_0x7ba7ce,_0x510d17,_0x3b3632=[_0x031f('0x5b'),'online',_0x031f('0x5c'),'lastPauseAt',_0x031f('0x5d'),'lastPauseAt',_0x031f('0x3f'),'address',_0x031f('0x4f'),_0x031f('0x5e'),'mailPause','smsPause',_0x031f('0x5f'),_0x031f('0x50'),'voicePause',_0x031f('0x60'),_0x031f('0x61'),_0x031f('0x62'),_0x031f('0x63'),_0x031f('0x64'),_0x031f('0x65'),_0x031f('0x66'),_0x031f('0x67'),'mailCurrentCapacity',_0x031f('0x68'),_0x031f('0x69'),_0x031f('0x6a'),'chatStatus',_0x031f('0x59'),_0x031f('0x6b'),'smsStatus',_0x031f('0x6c'),_0x031f('0x58'),_0x031f('0x55'),_0x031f('0x6d'),'openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime',_0x031f('0x6e'),_0x031f('0x6f'),'queue',_0x031f('0x70'),_0x031f('0x71'),'phoneBarEnableScreenRecordingByAgent',_0x031f('0x72'),_0x031f('0x73')],_0x154ad2=[_0x031f('0x4f'),_0x031f('0x5e'),_0x031f('0x51'),_0x031f('0x74'),_0x031f('0x5f'),_0x031f('0x50'),_0x031f('0x52'),'online'];Promise[_0x031f('0x75')]()['then'](function(){var _0x13409d=_[_0x031f('0x37')](db[_0x031f('0x46')]['rawAttributes'],function(_0x4c1b74){return{'name':_0x4c1b74[_0x031f('0x76')],'type':_0x4c1b74[_0x031f('0x77')][_0x031f('0x78')]};});_0x186957[_0x031f('0x79')]['role']=_0x031f('0x7a');_0x186957['query']['online']=!![];_0x1f9c55=qs[_0x031f('0x7b')](_0x13409d,_0x186957);_0x1f9c55['raw']=!![];if(_0x186957['user'][_0x031f('0x7c')]===_0x031f('0x7d')){var _0x248f8b={'params':{'id':_0x186957[_0x031f('0x7d')][_0x031f('0x7e')]},'query':{'section':'Agents','role':'agent','online':!![],'nolimit':_0x186957[_0x031f('0x79')]['nolimit'],'sort':_0x186957[_0x031f('0x79')][_0x031f('0x7f')],'filter':_0x186957['query'][_0x031f('0x80')],'raw':!![]}};return db[_0x031f('0x81')][_0x031f('0x82')](_0x248f8b);}return db[_0x031f('0x46')][_0x031f('0x83')](_0x1f9c55);})[_0x031f('0x12')](function(_0x5bea08){_0x4d49f8['count']=_0x5bea08[_0x031f('0xa')];_0x7ba7ce=_0x5bea08[_0x031f('0x84')];return getRealtimeAgents();})[_0x031f('0x12')](function(_0x1d973d){_0x510d17=_0x1d973d[_0x031f('0x84')];return _0x7ba7ce[_0x031f('0x37')](function(_0x3cfb21){var _0x5c99c6=_['find'](_0x510d17,['id',_0x3cfb21['id']]);if(_0x5c99c6)_['merge'](_0x3cfb21,_['pick'](_[_0x031f('0x85')](_0x5c99c6,_0x154ad2),_0x3b3632));_0x3cfb21[_0x031f('0x86')]=getAgentStatus(_0x3cfb21);return _0x3cfb21;});})[_0x031f('0x12')](function(_0x4fb931){if(_0x186957[_0x031f('0x79')][_0x031f('0x87')]){var _0x5133a6=_[_0x031f('0x80')](_0x4fb931,[_0x031f('0x86'),_0x186957[_0x031f('0x79')][_0x031f('0x87')]]);if(_0x186957[_0x031f('0x79')][_0x031f('0x88')]){_0x5133a6=_[_0x031f('0x80')](_0x5133a6,['pauseType',_0x186957['query'][_0x031f('0x88')]]);}}_0x4d49f8['rows']=_0x5133a6||_0x4fb931;return _0x4d49f8;})[_0x031f('0x12')](respondWithFilteredResult(_0x414350,_0x1f9c55))['catch'](handleError(_0x414350,null));};exports[_0x031f('0x89')]=function(_0x1cefb8,_0x3424c9){var _0x556fc6=[_0x031f('0x8a'),'chat',_0x031f('0x8b'),_0x031f('0x8c'),_0x031f('0x8d'),'whatsapp',_0x031f('0x19')];var _0x398e7c={'count':0x0,'rows':[]},_0x3c4b09={},_0x3e3ff5,_0x45330f,_0x5a55e7,_0x55284b,_0x282ab6;Promise[_0x031f('0x75')]()['then'](function(){if(_0x1cefb8[_0x031f('0x79')]['channel']){if(!_[_0x031f('0x8e')](_0x556fc6,_0x1cefb8[_0x031f('0x79')][_0x031f('0x8f')][_0x031f('0x90')]()))throw new Error('Invalid\x20channel');_0x3e3ff5=_0x1cefb8[_0x031f('0x79')][_0x031f('0x8f')][_0x031f('0x90')]();}var _0x5b336f=_[_0x031f('0x1a')](_0x3e3ff5)+_0x031f('0x47');var _0x4deefb=_[_0x031f('0x37')](db[_0x5b336f][_0x031f('0x91')],function(_0x11d498){return{'name':_0x11d498[_0x031f('0x76')],'type':_0x11d498[_0x031f('0x77')][_0x031f('0x78')]};});_0x3c4b09=qs[_0x031f('0x7b')](_0x4deefb,_0x1cefb8);if(_0x1cefb8['user'][_0x031f('0x7c')]===_0x031f('0x7d')){var _0x23cc40={'params':{'id':_0x1cefb8['user']['userProfileId']},'query':{'section':_0x3e3ff5===_0x031f('0x19')&&_0x1cefb8['query']['type']===_0x031f('0x21')?_0x031f('0x92'):_[_0x031f('0x1a')](_0x3e3ff5)+_0x031f('0x93'),'type':_0x1cefb8[_0x031f('0x79')][_0x031f('0x77')],'nolimit':!![],'sort':_0x031f('0x10'),'filter':_0x1cefb8[_0x031f('0x79')][_0x031f('0x80')]}};return db[_0x031f('0x81')][_0x031f('0x82')](_0x23cc40);}return db[_0x5b336f]['findAndCountAll'](_0x3c4b09);})[_0x031f('0x12')](function(_0x2d867f){_0x398e7c[_0x031f('0xa')]=_0x2d867f[_0x031f('0xa')];_0x45330f=_0x2d867f['rows'];return getRealtimeQueues(_0x1cefb8,_0x3e3ff5);})[_0x031f('0x12')](function(_0x5329c2){_0x55284b=_0x5329c2['rows'];return getRealtimeAgents();})[_0x031f('0x12')](function(_0x2f4d09){_0x5a55e7=_0x2f4d09['rows'];if(_0x3e3ff5!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x031f('0x12')](function(_0x62016){_0x282ab6=_0x62016?_0x62016[_0x031f('0x84')]:[];return initializeQueues(_0x45330f,_0x55284b,_0x3e3ff5,_0x1cefb8[_0x031f('0x79')][_0x031f('0x77')]);})[_0x031f('0x12')](function(_0x5e0853){var _0x263658=_0x5e0853[_0x031f('0x37')](function(_0x588f6c){if(_0x3e3ff5===_0x031f('0x19'))return getVoiceQueueAgents(_0x588f6c,_0x45330f,_0x5a55e7,_0x282ab6);else return getQueueAgents(_0x588f6c,_0x5a55e7,_0x3e3ff5);});return Promise[_0x031f('0x94')](_0x263658);})[_0x031f('0x12')](function(_0x14fc7e){_0x398e7c[_0x031f('0x84')]=_0x14fc7e;return _0x398e7c;})[_0x031f('0x12')](respondWithFilteredResult(_0x3424c9,_0x3c4b09))[_0x031f('0x18')](handleError(_0x3424c9,null));}; \ No newline at end of file +var _0x1623=['raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','sms','openchannel','whatsapp','channel','Invalid\x20channel','toLowerCase','type','QueueCampaigns','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','request','then','result','Agents','merge','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','outbound','push','pTalking','originated','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','get','loggedInDb','talking','busy','find','pick','filter','queue','some','connectedlinenum','internal','getMembers','UserId','accountcode','paused','voiceStatus','online','agents','User','startCase','Queue','Pause','QueueId','length','idle','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','voicePause','pause','every','chatStatus','faxStatus','whatsappStatus','*pause','userpic','lastPauseAt','pauseType','address','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','key','query','role','agent','getOptions'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0x1623,0xab));var _0x3162=function(_0x48f6a8,_0x45314d){_0x48f6a8=_0x48f6a8-0x0;var _0x4094b7=_0x1623[_0x48f6a8];return _0x4094b7;};'use strict';var util=require(_0x3162('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0x3162('0x1'));var logger=require(_0x3162('0x2'))(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var amiClient=jayson[_0x3162('0x5')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x3162('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x4b77c4,_0x1b55f2){return function(_0x428de6){if(_0x428de6){var _0x53260d=typeof _0x1b55f2[_0x3162('0x7')]===_0x3162('0x8')&&typeof _0x1b55f2[_0x3162('0x9')]===_0x3162('0x8');var _0x10d684=_0x428de6[_0x3162('0xa')];var _0xe43099=_0x53260d?0x0:_0x1b55f2[_0x3162('0x7')];var _0x4bde10=_0x53260d?_0x428de6['count']:_0x1b55f2[_0x3162('0x7')]+_0x1b55f2[_0x3162('0x9')];var _0x1c3772;if(_0x4bde10>=_0x10d684){_0x4bde10=_0x10d684;_0x1c3772=0xc8;}else{_0x1c3772=0xce;}_0x4b77c4[_0x3162('0xb')](_0x1c3772);return _0x4b77c4[_0x3162('0xc')](_0x3162('0xd'),_0xe43099+'-'+_0x4bde10+'/'+_0x10d684)[_0x3162('0xe')](_0x428de6);}return null;};}function handleError(_0x38da60,_0x157ab8){_0x157ab8=_0x157ab8||0x1f4;return function(_0x4c3625){logger[_0x3162('0xf')](_0x4c3625['stack']);if(_0x4c3625[_0x3162('0x10')]){delete _0x4c3625[_0x3162('0x10')];}_0x38da60['status'](_0x157ab8)['send'](_0x4c3625);};}function getRealtimeAgents(){return new Promise(function(_0x198764,_0x2bb738){return amiClient[_0x3162('0x11')]('Agents',{})[_0x3162('0x12')](function(_0x3d0bea){if(_0x3d0bea[_0x3162('0xf')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x78a56c=_0x3d0bea[_0x3162('0x13')];return routingClient[_0x3162('0x11')](_0x3162('0x14'),{})[_0x3162('0x12')](function(_0x1eed46){if(_0x1eed46[_0x3162('0xf')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x42f283=_0x1eed46[_0x3162('0x13')];return _0x198764(_[_0x3162('0x15')]({},_0x78a56c,_0x42f283));});})[_0x3162('0x16')](function(_0x491144){_0x2bb738(_0x491144);});});}function getRealtimeQueues(_0x1dfd5c,_0x5a5141){return new Promise(function(_0x4ab3e8,_0xa5c62b){var _0x3e4d23=_0x5a5141===_0x3162('0x17')?amiClient:routingClient;return _0x3e4d23['request'](_['startCase'](_0x5a5141)+_0x3162('0x18'),_0x1dfd5c)[_0x3162('0x12')](function(_0x32c051){if(_0x32c051[_0x3162('0xf')])throw new Error(util[_0x3162('0x19')](_0x3162('0x1a'),_0x5a5141));return _0x4ab3e8(_0x32c051[_0x3162('0x13')]);})[_0x3162('0x16')](function(_0x5a4994){_0xa5c62b(_0x5a4994);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0xd283d6,_0x2433f8){return amiClient[_0x3162('0x11')](_0x3162('0x1b'),{})[_0x3162('0x12')](function(_0x3c543e){if(_0x3c543e[_0x3162('0xf')])throw new Error(_0x3162('0x1c'));return _0xd283d6(_0x3c543e[_0x3162('0x13')]);})[_0x3162('0x16')](function(_0x8fa09f){_0x2433f8(_0x8fa09f);});});}function initializeQueues(_0x2f62d7,_0x1c03a4,_0x48de45,_0x4025c3){var _0x552469=[_0x3162('0x1d'),_0x3162('0x1e'),_0x3162('0x1f'),'talking','paused'];if(_0x48de45===_0x3162('0x17')&&_0x4025c3===_0x3162('0x20')){_0x552469[_0x3162('0x21')](_0x3162('0x22'),_0x3162('0x23'),'message',_0x3162('0x24'),'dialMethod',_0x3162('0x25'),_0x3162('0x26'),_0x3162('0x27'),_0x3162('0x28'),_0x3162('0x29'),_0x3162('0x2a'),_0x3162('0x2b'),_0x3162('0x2c'),'dialPredictiveIntervalMaxThreshold',_0x3162('0x2d'),_0x3162('0x2e'),'predictiveIntervalTotalCalls',_0x3162('0x2f'),_0x3162('0x30'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x3162('0x31'));}return _0x2f62d7['map'](function(_0x266aab){var _0x47241c=_0x266aab[_0x3162('0x32')]({'plain':!![]});_0x47241c['agents']=[];_0x47241c['paused']=0x0;_0x47241c[_0x3162('0x33')]=0x0;_0x47241c[_0x3162('0x1d')]=0x0;_0x47241c['available']=0x0;_0x47241c[_0x3162('0x1f')]=0x0;if(_0x48de45==='voice'){_0x47241c[_0x3162('0x34')]=0x0;_0x47241c[_0x3162('0x35')]=0x0;if(_0x4025c3===_0x3162('0x20')){_0x47241c[_0x3162('0x22')]=0x0;_0x47241c[_0x3162('0x23')]=0x0;}}var _0x3b6c91=_[_0x3162('0x36')](_0x1c03a4,['id',_0x47241c['id']]);if(_0x3b6c91)_[_0x3162('0x15')](_0x47241c,_[_0x3162('0x37')](_0x3b6c91,_0x552469));return _0x47241c;});}function updateAgentVoiceStatus(_0x16c5d6,_0x3fc06f,_0x5c39d9){var _0x149571=_[_0x3162('0x38')](_0x5c39d9,[_0x3162('0x39'),_0x3fc06f['name']]);if(_0x149571['length']===0x0)return _0x16c5d6[_0x3162('0x35')]=!![];if(_[_0x3162('0x3a')](_0x149571,[_0x3162('0x3b'),_0x16c5d6[_0x3162('0x3c')]['toString']()]))return _0x16c5d6[_0x3162('0x34')]=!![];if(!_0x16c5d6['talking'])return _0x16c5d6['busy']=!![];}function getVoiceQueueAgents(_0x5dee49,_0x298ed7,_0x3fe4d2,_0x315fdb){var _0x49829f=_[_0x3162('0x36')](_0x298ed7,['id',_0x5dee49['id']]);if(!_0x49829f)return _0x5dee49;return _0x49829f[_0x3162('0x3d')]({'raw':!![]})[_0x3162('0x12')](function(_0x369d33){for(var _0x1e8d5e=0x0;_0x1e8d5e<_0x369d33['length'];_0x1e8d5e++){var _0x5447d6=_[_0x3162('0x36')](_0x3fe4d2,['id',_0x369d33[_0x1e8d5e][_0x3162('0x3e')]]);if(!_0x5447d6){_0x5447d6={'id':_0x369d33[_0x1e8d5e]['UserId'],'name':_0x369d33[_0x1e8d5e]['UserId'],'accountcode':'','online':![]};}var _0x43f780={'id':_0x5447d6['id'],'name':_0x5447d6[_0x3162('0x10')],'internal':_0x5447d6[_0x3162('0x3f')],'online':Boolean(_0x5447d6['online']),'paused':Boolean(_0x369d33[_0x1e8d5e][_0x3162('0x40')])};if(_0x5447d6[_0x3162('0x41')]===_0x3162('0x34'))updateAgentVoiceStatus(_0x43f780,_0x5dee49,_0x315fdb);if(_0x43f780[_0x3162('0x42')])_0x5dee49['loggedInDb']++;if(_0x43f780[_0x3162('0x35')])_0x5dee49[_0x3162('0x35')]++;if(_0x43f780['paused']&&!_0x43f780[_0x3162('0x35')]&&!_0x43f780[_0x3162('0x34')])_0x5dee49['paused']++;_0x5dee49[_0x3162('0x43')][_0x3162('0x21')](_0x43f780);}return _0x5dee49;});}function getQueueAgents(_0x59f75d,_0x117775,_0x555d33){var _0x4146f1=_0x3162('0x44')+_[_0x3162('0x45')](_0x555d33)+_0x3162('0x46');var _0x1bdc10=_0x555d33+_0x3162('0x47');return db[_0x4146f1]['findAll']({'where':{[_[_0x3162('0x45')](_0x555d33)+_0x3162('0x48')]:_0x59f75d['id']},'raw':!![]})[_0x3162('0x12')](function(_0x48832d){for(var _0x3bc8d9=0x0;_0x3bc8d9<_0x48832d[_0x3162('0x49')];_0x3bc8d9++){var _0x4a9cc9=_[_0x3162('0x36')](_0x117775,['id',_0x48832d[_0x3bc8d9]['UserId']]);if(!_0x4a9cc9){_0x4a9cc9={'id':_0x48832d[_0x3bc8d9]['UserId'],'name':_0x48832d[_0x3bc8d9]['UserId'],'online':![],['pauseField']:![]};}var _0x1a4bcf={'id':_0x4a9cc9['id'],'name':_0x4a9cc9[_0x3162('0x10')],'online':Boolean(_0x4a9cc9[_0x3162('0x42')]),'paused':Boolean(_0x4a9cc9[_0x1bdc10])};if(_0x1a4bcf[_0x3162('0x42')])_0x59f75d[_0x3162('0x33')]++;_0x59f75d[_0x3162('0x43')][_0x3162('0x21')](_0x1a4bcf);}return _0x59f75d;});}function isIdle(_0x1b363f){return _0x1b363f===_0x3162('0x4a')||_0x1b363f===_0x3162('0x4b')||_0x1b363f===_0x3162('0x4c')||_0x1b363f===_0x3162('0x4d')||_[_0x3162('0x4e')](_0x1b363f);}function isAgentPaused(_0x56f9bf,_0x3ac940){var _0x48cb8f=[_0x56f9bf['chatPause'],_0x56f9bf[_0x3162('0x4f')],_0x56f9bf[_0x3162('0x50')],_0x56f9bf[_0x3162('0x51')],_0x56f9bf[_0x3162('0x52')],_0x56f9bf['voicePause'],_0x56f9bf[_0x3162('0x53')]];if(!_0x3ac940)return _['every'](_0x48cb8f);var _0xa11c6e=_[_0x3162('0x38')](_0x48cb8f);return _0xa11c6e['length']>0x0&&_0xa11c6e[_0x3162('0x49')]<_0x48cb8f['length']?!![]:![];}function isAgentIdle(_0x516599){if(_0x516599[_0x3162('0x41')]!==_0x3162('0x4a')&&_0x516599[_0x3162('0x54')]){_0x516599[_0x3162('0x41')]=_0x3162('0x55');return![];}return _[_0x3162('0x56')]([_0x516599[_0x3162('0x57')],_0x516599[_0x3162('0x58')],_0x516599['mailStatus'],_0x516599['openchannelStatus'],_0x516599['smsStatus'],_0x516599[_0x3162('0x41')],_0x516599[_0x3162('0x59')]],isIdle);}function getAgentStatus(_0x87de12){var _0x46141d=_0x3162('0x4b');if(isAgentPaused(_0x87de12))_0x46141d=_0x3162('0x55');else if(isAgentPaused(_0x87de12,!![]))_0x46141d=_0x3162('0x5a');else if(isAgentIdle(_0x87de12))_0x46141d='idle';else _0x46141d=_0x3162('0x35');return _0x46141d;}exports['getAgents']=function(_0x3c85e6,_0x4971d1){var _0x283eeb={'count':0x0,'rows':[]},_0x580a75={},_0x1a7165,_0xd6b792,_0x554a8f=[_0x3162('0x5b'),_0x3162('0x42'),'lastLoginAt',_0x3162('0x5c'),_0x3162('0x5d'),_0x3162('0x5c'),_0x3162('0x3c'),_0x3162('0x5e'),'chatPause',_0x3162('0x51'),_0x3162('0x50'),'smsPause','whatsappPause',_0x3162('0x4f'),_0x3162('0x54'),_0x3162('0x5f'),'openchannelCapacity',_0x3162('0x60'),_0x3162('0x61'),_0x3162('0x62'),_0x3162('0x63'),'chatCurrentCapacity',_0x3162('0x64'),_0x3162('0x65'),'smsCurrentCapacity',_0x3162('0x66'),'faxCurrentCapacity',_0x3162('0x57'),_0x3162('0x67'),_0x3162('0x68'),'smsStatus',_0x3162('0x59'),_0x3162('0x58'),_0x3162('0x41'),_0x3162('0x69'),_0x3162('0x6a'),_0x3162('0x6b'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x3162('0x6c'),'queue',_0x3162('0x6d'),_0x3162('0x6e'),_0x3162('0x6f'),_0x3162('0x70'),_0x3162('0x71')],_0x51fab3=['chatPause','openchannelPause',_0x3162('0x50'),_0x3162('0x52'),'whatsappPause',_0x3162('0x4f'),_0x3162('0x54'),_0x3162('0x42')];Promise[_0x3162('0x72')]()[_0x3162('0x12')](function(){var _0x4fdcec=_[_0x3162('0x73')](db[_0x3162('0x44')][_0x3162('0x74')],function(_0x28f891){return{'name':_0x28f891[_0x3162('0x75')],'type':_0x28f891['type'][_0x3162('0x76')]};});_0x3c85e6[_0x3162('0x77')][_0x3162('0x78')]=_0x3162('0x79');_0x3c85e6['query'][_0x3162('0x42')]=!![];_0x580a75=qs[_0x3162('0x7a')](_0x4fdcec,_0x3c85e6);_0x580a75[_0x3162('0x7b')]=!![];if(_0x3c85e6[_0x3162('0x7c')][_0x3162('0x78')]===_0x3162('0x7c')){var _0xbc75f={'params':{'id':_0x3c85e6[_0x3162('0x7c')][_0x3162('0x7d')]},'query':{'section':_0x3162('0x14'),'role':'agent','online':!![],'nolimit':_0x3c85e6[_0x3162('0x77')][_0x3162('0x7e')],'sort':_0x3c85e6['query'][_0x3162('0x7f')],'filter':_0x3c85e6['query'][_0x3162('0x38')],'raw':!![]}};return db[_0x3162('0x80')][_0x3162('0x81')](_0xbc75f);}return db[_0x3162('0x44')][_0x3162('0x82')](_0x580a75);})[_0x3162('0x12')](function(_0x5918f2){_0x283eeb[_0x3162('0xa')]=_0x5918f2[_0x3162('0xa')];_0x1a7165=_0x5918f2[_0x3162('0x83')];return getRealtimeAgents();})[_0x3162('0x12')](function(_0x3147a8){_0xd6b792=_0x3147a8[_0x3162('0x83')];return _0x1a7165['map'](function(_0x2a3e33){var _0x111952=_[_0x3162('0x36')](_0xd6b792,['id',_0x2a3e33['id']]);if(_0x111952)_[_0x3162('0x15')](_0x2a3e33,_[_0x3162('0x37')](_[_0x3162('0x84')](_0x111952,_0x51fab3),_0x554a8f));_0x2a3e33[_0x3162('0x85')]=getAgentStatus(_0x2a3e33);return _0x2a3e33;});})['then'](function(_0x57200f){if(_0x3c85e6['query'][_0x3162('0x86')]){var _0x3b4afd=_['filter'](_0x57200f,[_0x3162('0x85'),_0x3c85e6[_0x3162('0x77')][_0x3162('0x86')]]);if(_0x3c85e6[_0x3162('0x77')]['pauseTypeFilter']){_0x3b4afd=_[_0x3162('0x38')](_0x3b4afd,[_0x3162('0x5d'),_0x3c85e6['query'][_0x3162('0x87')]]);}}_0x283eeb['rows']=_0x3b4afd||_0x57200f;return _0x283eeb;})[_0x3162('0x12')](respondWithFilteredResult(_0x4971d1,_0x580a75))['catch'](handleError(_0x4971d1,null));};exports[_0x3162('0x88')]=function(_0x58e47e,_0x1dc930){var _0x2d62db=[_0x3162('0x89'),_0x3162('0x8a'),_0x3162('0x8b'),_0x3162('0x8c'),'fax',_0x3162('0x8d'),_0x3162('0x17')];var _0x40110d={'count':0x0,'rows':[]},_0x4b3971={},_0x31803e,_0x3685f2,_0x2d2f69,_0x15940e,_0x2e6124;Promise['resolve']()[_0x3162('0x12')](function(){if(_0x58e47e[_0x3162('0x77')]['channel']){if(!_['includes'](_0x2d62db,_0x58e47e[_0x3162('0x77')][_0x3162('0x8e')]['toLowerCase']()))throw new Error(_0x3162('0x8f'));_0x31803e=_0x58e47e[_0x3162('0x77')][_0x3162('0x8e')][_0x3162('0x90')]();}var _0xdc502b=_[_0x3162('0x45')](_0x31803e)+_0x3162('0x46');var _0x3da74a=_[_0x3162('0x73')](db[_0xdc502b]['rawAttributes'],function(_0x48fc50){return{'name':_0x48fc50[_0x3162('0x75')],'type':_0x48fc50[_0x3162('0x91')]['key']};});_0x4b3971=qs[_0x3162('0x7a')](_0x3da74a,_0x58e47e);if(_0x58e47e['user']['role']==='user'){var _0x31981a={'params':{'id':_0x58e47e['user'][_0x3162('0x7d')]},'query':{'section':_0x31803e===_0x3162('0x17')&&_0x58e47e[_0x3162('0x77')][_0x3162('0x91')]===_0x3162('0x20')?_0x3162('0x92'):_[_0x3162('0x45')](_0x31803e)+_0x3162('0x18'),'type':_0x58e47e[_0x3162('0x77')][_0x3162('0x91')],'nolimit':!![],'sort':_0x3162('0x10'),'filter':_0x58e47e['query'][_0x3162('0x38')]}};return db[_0x3162('0x80')][_0x3162('0x81')](_0x31981a);}return db[_0xdc502b][_0x3162('0x82')](_0x4b3971);})[_0x3162('0x12')](function(_0xa463ad){_0x40110d[_0x3162('0xa')]=_0xa463ad[_0x3162('0xa')];_0x3685f2=_0xa463ad[_0x3162('0x83')];return getRealtimeQueues(_0x58e47e,_0x31803e);})[_0x3162('0x12')](function(_0x1d242f){_0x15940e=_0x1d242f[_0x3162('0x83')];return getRealtimeAgents();})['then'](function(_0x22bfb6){_0x2d2f69=_0x22bfb6[_0x3162('0x83')];if(_0x31803e!=_0x3162('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x3d7bd1){_0x2e6124=_0x3d7bd1?_0x3d7bd1['rows']:[];return initializeQueues(_0x3685f2,_0x15940e,_0x31803e,_0x58e47e[_0x3162('0x77')][_0x3162('0x91')]);})['then'](function(_0x5e4321){var _0x246d90=_0x5e4321[_0x3162('0x73')](function(_0x4da601){if(_0x31803e===_0x3162('0x17'))return getVoiceQueueAgents(_0x4da601,_0x3685f2,_0x2d2f69,_0x2e6124);else return getQueueAgents(_0x4da601,_0x2d2f69,_0x31803e);});return Promise['all'](_0x246d90);})[_0x3162('0x12')](function(_0x3421a3){_0x40110d[_0x3162('0x83')]=_0x3421a3;return _0x40110d;})[_0x3162('0x12')](respondWithFilteredResult(_0x1dc930,_0x4b3971))[_0x3162('0x16')](handleError(_0x1dc930,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b77f944..0e9aaf7 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31f308,_0x3db808){var _0x24faed=function(_0x55f55a){while(--_0x55f55a){_0x31f308['push'](_0x31f308['shift']());}};_0x24faed(++_0x3db808);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb0f253,_0x476cc1){var _0x25dbbe=function(_0x52a034){while(--_0x52a034){_0xb0f253['push'](_0xb0f253['shift']());}};_0x25dbbe(++_0x476cc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 658eb0d..8105828 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 _0x038b=['exports','INTEGER','STRING','DATE'];(function(_0x2d1dcd,_0x20ae0f){var _0x2a5a40=function(_0x51bbe7){while(--_0x51bbe7){_0x2d1dcd['push'](_0x2d1dcd['shift']());}};_0x2a5a40(++_0x20ae0f);}(_0x038b,0x114));var _0xb038=function(_0x592c07,_0x2b177a){_0x592c07=_0x592c07-0x0;var _0x80501d=_0x038b[_0x592c07];return _0x80501d;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'state':{'type':Sequelize[_0xb038('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb038('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xb038('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb038('0x3')]},'ringtime':{'type':Sequelize[_0xb038('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb038('0x2')]},'membername':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file +var _0xa2c8=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x4700fd,_0x5ef5c5){var _0x5999b6=function(_0x454367){while(--_0x454367){_0x4700fd['push'](_0x4700fd['shift']());}};_0x5999b6(++_0x5ef5c5);}(_0xa2c8,0x99));var _0x8a2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa2c8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8a2c('0x0'));module[_0x8a2c('0x1')]={'state':{'type':Sequelize[_0x8a2c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8a2c('0x3')]},'scheduledat':{'type':Sequelize[_0x8a2c('0x4')]},'uniqueid':{'type':Sequelize[_0x8a2c('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8a2c('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8a2c('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3c2e605..6c19038 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 _0x0c01=['bluebird','request-promise','path','exports','define','report_agent_preview','util','api','moment'];(function(_0x2a000c,_0x5a5619){var _0x884c78=function(_0x183a9f){while(--_0x183a9f){_0x2a000c['push'](_0x2a000c['shift']());}};_0x884c78(++_0x5a5619);}(_0x0c01,0x1da));var _0x10c0=function(_0x9b7005,_0x31bdd4){_0x9b7005=_0x9b7005-0x0;var _0x1ea41a=_0x0c01[_0x9b7005];return _0x1ea41a;};'use strict';var _=require('lodash');var util=require(_0x10c0('0x0'));var logger=require('../../config/logger')(_0x10c0('0x1'));var moment=require(_0x10c0('0x2'));var BPromise=require(_0x10c0('0x3'));var rp=require(_0x10c0('0x4'));var fs=require('fs');var path=require(_0x10c0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x10c0('0x6')]=function(_0x17ff1f,_0x4e7e6d){return _0x17ff1f[_0x10c0('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x10c0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c8b=['request-promise','path','rimraf','../../config/environment','exports','define','report_agent_preview','lodash','util','../../config/logger','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7c8b,0xb7));var _0xb7c8=function(_0x4d2ae4,_0x51fbd2){_0x4d2ae4=_0x4d2ae4-0x0;var _0x35a7ab=_0x7c8b[_0x4d2ae4];return _0x35a7ab;};'use strict';var _=require(_0xb7c8('0x0'));var util=require(_0xb7c8('0x1'));var logger=require(_0xb7c8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb7c8('0x3'));var rp=require(_0xb7c8('0x4'));var fs=require('fs');var path=require(_0xb7c8('0x5'));var rimraf=require(_0xb7c8('0x6'));var config=require(_0xb7c8('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0xb7c8('0x8')]=function(_0x380219,_0x3d2b00){return _0x380219[_0xb7c8('0x9')]('ReportAgentPreview',attributes,{'tableName':_0xb7c8('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 4c74f0e..7bb8a81 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 _0x355a=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util'];(function(_0x38b85d,_0x10cbaf){var _0x3bbdcf=function(_0x5cf8fe){while(--_0x5cf8fe){_0x38b85d['push'](_0x38b85d['shift']());}};_0x3bbdcf(++_0x10cbaf);}(_0x355a,0x104));var _0xa355=function(_0xaab0ee,_0x3f2d51){_0xaab0ee=_0xaab0ee-0x0;var _0x4d16c4=_0x355a[_0xaab0ee];return _0x4d16c4;};'use strict';var _=require('lodash');var util=require(_0xa355('0x0'));var moment=require(_0xa355('0x1'));var BPromise=require(_0xa355('0x2'));var rs=require(_0xa355('0x3'));var fs=require('fs');var Redis=require(_0xa355('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa355('0x5'));var logger=require('../../config/logger')(_0xa355('0x6'));var config=require(_0xa355('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa355('0x8')][_0xa355('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42ec86,_0x1d6206,_0x1cc7d9){return new BPromise(function(_0x42d7df,_0x28bb04){return client[_0xa355('0xa')](_0x42ec86,_0x1cc7d9)[_0xa355('0xb')](function(_0x161e67){logger[_0xa355('0xc')](_0xa355('0xd'),_0x1d6206,_0xa355('0xe'));logger[_0xa355('0xf')](_0xa355('0x10'),_0x1d6206,_0xa355('0xe'),JSON[_0xa355('0x11')](_0x161e67));if(_0x161e67[_0xa355('0x12')]){if(_0x161e67[_0xa355('0x12')][_0xa355('0x13')]===0x1f4){logger[_0xa355('0x12')](_0xa355('0xd'),_0x1d6206,_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);return _0x28bb04(_0x161e67['error'][_0xa355('0x14')]);}logger[_0xa355('0x12')](_0xa355('0xd'),_0x1d6206,_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);return _0x42d7df(_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);}else{logger['info'](_0xa355('0xd'),_0x1d6206,_0xa355('0xe'));_0x42d7df(_0x161e67[_0xa355('0x15')]['message']);}})[_0xa355('0x16')](function(_0x1df834){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1d6206,_0x1df834);_0x28bb04(_0x1df834);});});}exports[_0xa355('0x17')]=function(_0x3021a4){var _0x42355f=this;return new Promise(function(_0x51ddf2,_0x125384){return db[_0xa355('0x18')][_0xa355('0x19')](_0x3021a4[_0xa355('0x1a')],{'raw':_0x3021a4[_0xa355('0x1b')]?_0x3021a4[_0xa355('0x1b')][_0xa355('0x1c')]===undefined?!![]:![]:!![]})[_0xa355('0xb')](function(_0x1a8062){logger[_0xa355('0xc')](_0xa355('0x17'),_0x3021a4);logger[_0xa355('0xf')]('CreateReportAgentPreview',_0x3021a4,JSON[_0xa355('0x11')](_0x1a8062));_0x51ddf2(_0x1a8062);})[_0xa355('0x16')](function(_0xb030cc){logger[_0xa355('0x12')]('CreateReportAgentPreview',_0xb030cc[_0xa355('0x14')],_0x3021a4);_0x125384(_0x42355f[_0xa355('0x12')](0x1f4,_0xb030cc[_0xa355('0x14')]));});});}; \ No newline at end of file +var _0x2461=['bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','body','options','raw','CreateReportAgentPreview','stringify','lodash','moment'];(function(_0x2be4b2,_0x1a10a5){var _0x412f6c=function(_0x2a506b){while(--_0x2a506b){_0x2be4b2['push'](_0x2be4b2['shift']());}};_0x412f6c(++_0x1a10a5);}(_0x2461,0x157));var _0x1246=function(_0x9b5188,_0x1ee9a9){_0x9b5188=_0x9b5188-0x0;var _0x20f079=_0x2461[_0x9b5188];return _0x20f079;};'use strict';var _=require(_0x1246('0x0'));var util=require('util');var moment=require(_0x1246('0x1'));var BPromise=require(_0x1246('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1246('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1246('0x4'))(_0x1246('0x5'));var config=require(_0x1246('0x6'));var jayson=require(_0x1246('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4fbb,_0x10bc47,_0x173c20){return new BPromise(function(_0x4a3fbc,_0x239df5){return client[_0x1246('0x8')](_0x1c4fbb,_0x173c20)[_0x1246('0x9')](function(_0x34ecee){logger[_0x1246('0xa')](_0x1246('0xb'),_0x10bc47,_0x1246('0xc'));logger[_0x1246('0xd')](_0x1246('0xe'),_0x10bc47,_0x1246('0xc'),JSON['stringify'](_0x34ecee));if(_0x34ecee['error']){if(_0x34ecee[_0x1246('0xf')]['code']===0x1f4){logger[_0x1246('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x10bc47,_0x34ecee[_0x1246('0xf')]['message']);return _0x239df5(_0x34ecee[_0x1246('0xf')]['message']);}logger[_0x1246('0xf')](_0x1246('0xb'),_0x10bc47,_0x34ecee['error'][_0x1246('0x10')]);return _0x4a3fbc(_0x34ecee[_0x1246('0xf')][_0x1246('0x10')]);}else{logger[_0x1246('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x10bc47,_0x1246('0xc'));_0x4a3fbc(_0x34ecee[_0x1246('0x11')][_0x1246('0x10')]);}})['catch'](function(_0x264526){logger[_0x1246('0xf')](_0x1246('0xb'),_0x10bc47,_0x264526);_0x239df5(_0x264526);});});}exports['CreateReportAgentPreview']=function(_0x12fe49){var _0x54ae19=this;return new Promise(function(_0x15e044,_0x5efa1a){return db['ReportAgentPreview']['create'](_0x12fe49[_0x1246('0x12')],{'raw':_0x12fe49['options']?_0x12fe49[_0x1246('0x13')][_0x1246('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x569853){logger[_0x1246('0xa')]('CreateReportAgentPreview',_0x12fe49);logger[_0x1246('0xd')](_0x1246('0x15'),_0x12fe49,JSON[_0x1246('0x16')](_0x569853));_0x15e044(_0x569853);})['catch'](function(_0x5b182a){logger[_0x1246('0xf')](_0x1246('0x15'),_0x5b182a[_0x1246('0x10')],_0x12fe49);_0x5efa1a(_0x54ae19[_0x1246('0xf')](0x1f4,_0x5b182a[_0x1246('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 637b650..00e7ea7 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 _0x4110=['chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues'];(function(_0x3c6ff6,_0x133038){var _0x369479=function(_0x5e0900){while(--_0x5e0900){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x369479(++_0x133038);}(_0x4110,0x89));var _0x0411=function(_0x2c779e,_0x44f372){_0x2c779e=_0x2c779e-0x0;var _0x569b66=_0x4110[_0x2c779e];return _0x569b66;};'use strict';var multer=require(_0x0411('0x0'));var util=require(_0x0411('0x1'));var path=require(_0x0411('0x2'));var express=require(_0x0411('0x3'));var router=express['Router']();var auth=require(_0x0411('0x4'));var controller=require(_0x0411('0x5'));router[_0x0411('0x6')]('/voice/channels',auth[_0x0411('0x7')](),controller[_0x0411('0x8')]);router[_0x0411('0x6')](_0x0411('0x9'),auth[_0x0411('0x7')](),controller[_0x0411('0xa')]);router[_0x0411('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x0411('0x7')](),controller[_0x0411('0xb')]);router['get'](_0x0411('0xc'),auth[_0x0411('0x7')](),controller[_0x0411('0xd')]);router['get'](_0x0411('0xe'),auth[_0x0411('0x7')](),controller[_0x0411('0xf')]);router[_0x0411('0x6')]('/mail/queues',auth[_0x0411('0x7')](),controller[_0x0411('0x10')]);router[_0x0411('0x6')](_0x0411('0x11'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x0411('0x6')](_0x0411('0x12'),auth[_0x0411('0x7')](),controller[_0x0411('0x13')]);router[_0x0411('0x6')](_0x0411('0x14'),auth[_0x0411('0x7')](),controller[_0x0411('0x15')]);router[_0x0411('0x6')]('/whatsapp/queues',auth[_0x0411('0x7')](),controller['whatsappQueues']);router[_0x0411('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x0411('0x16')]);router[_0x0411('0x6')](_0x0411('0x17'),auth[_0x0411('0x7')](),controller['voiceQueuesPreview']);router[_0x0411('0x6')](_0x0411('0x18'),auth[_0x0411('0x7')](),controller[_0x0411('0x19')]);router[_0x0411('0x6')](_0x0411('0x1a'),auth[_0x0411('0x7')](),controller[_0x0411('0x1b')]);router[_0x0411('0x6')](_0x0411('0x1c'),auth['isAuthenticated'](),controller[_0x0411('0x1d')]);router['get'](_0x0411('0x1e'),auth[_0x0411('0x7')](),controller[_0x0411('0x1f')]);router[_0x0411('0x6')]('/voice/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x20')]);router[_0x0411('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get']('/outbound',auth[_0x0411('0x7')](),controller[_0x0411('0x22')]);router[_0x0411('0x6')](_0x0411('0x23'),auth['isAuthenticated'](),controller[_0x0411('0x24')]);router['get'](_0x0411('0x25'),auth[_0x0411('0x7')](),controller[_0x0411('0x26')]);router['put'](_0x0411('0x27'),auth[_0x0411('0x7')](),controller[_0x0411('0x28')]);router[_0x0411('0x6')](_0x0411('0x29'),auth[_0x0411('0x7')](),controller[_0x0411('0x2a')]);router[_0x0411('0x6')]('/trunks',auth[_0x0411('0x7')](),controller[_0x0411('0x2b')]);router['get']('/campaigns',auth[_0x0411('0x7')](),controller[_0x0411('0x2c')]);router[_0x0411('0x6')](_0x0411('0x2d'),auth[_0x0411('0x7')](),controller[_0x0411('0x2e')]);router['get'](_0x0411('0x2f'),auth[_0x0411('0x7')](),controller[_0x0411('0x30')]);router['get'](_0x0411('0x31'),auth[_0x0411('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x0411('0x6')](_0x0411('0x32'),auth[_0x0411('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x0411('0x6')](_0x0411('0x33'),auth[_0x0411('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0411('0x6')]('/sms/queues/waitinginteractions',auth[_0x0411('0x7')](),controller[_0x0411('0x34')]);router[_0x0411('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x0411('0x7')](),controller[_0x0411('0x35')]);router[_0x0411('0x6')](_0x0411('0x36'),auth[_0x0411('0x7')](),controller[_0x0411('0x37')]);router[_0x0411('0x38')](_0x0411('0x39'),auth[_0x0411('0x7')](),controller[_0x0411('0x3a')](_0x0411('0x3b')));router[_0x0411('0x6')](_0x0411('0x3c'),auth[_0x0411('0x7')](),controller[_0x0411('0x3d')]);router['post'](_0x0411('0x3e'),auth[_0x0411('0x7')](),controller['queueNotify']('chat'));router[_0x0411('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x0411('0x3f')]);router[_0x0411('0x38')](_0x0411('0x40'),auth['isAuthenticated'](),controller[_0x0411('0x3a')](_0x0411('0x41')));router[_0x0411('0x6')]('/fax/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x42')]);router[_0x0411('0x38')](_0x0411('0x43'),auth[_0x0411('0x7')](),controller[_0x0411('0x3a')]('openchannel'));router[_0x0411('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x0411('0x44')]);router['post']('/sms/queues/:id/notify',auth[_0x0411('0x7')](),controller[_0x0411('0x3a')](_0x0411('0x45')));router[_0x0411('0x38')](_0x0411('0x46'),auth[_0x0411('0x7')](),controller['queueNotify'](_0x0411('0x47')));router['get']('/sms/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x48')]);router[_0x0411('0x6')]('/whatsapp/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x49')]);router[_0x0411('0x38')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x0411('0x4a')]);module[_0x0411('0x4b')]=router; \ No newline at end of file +var _0x9243=['/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9243,0x89));var _0x3924=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x9243[_0x1d1963];return _0x3f58bb;};'use strict';var multer=require(_0x3924('0x0'));var util=require(_0x3924('0x1'));var path=require(_0x3924('0x2'));var express=require(_0x3924('0x3'));var router=express['Router']();var auth=require(_0x3924('0x4'));var controller=require('./rpc.controller');router[_0x3924('0x5')](_0x3924('0x6'),auth[_0x3924('0x7')](),controller[_0x3924('0x8')]);router[_0x3924('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x3924('0x7')](),controller['voiceChannelMixMonitor']);router[_0x3924('0x5')](_0x3924('0x9'),auth[_0x3924('0x7')](),controller[_0x3924('0xa')]);router['get'](_0x3924('0xb'),auth[_0x3924('0x7')](),controller[_0x3924('0xc')]);router['get']('/chat/queues',auth[_0x3924('0x7')](),controller[_0x3924('0xd')]);router[_0x3924('0x5')](_0x3924('0xe'),auth[_0x3924('0x7')](),controller['mailQueues']);router[_0x3924('0x5')]('/mail/accounts',auth[_0x3924('0x7')](),controller['mailAccounts']);router[_0x3924('0x5')](_0x3924('0xf'),auth[_0x3924('0x7')](),controller['openchannelQueues']);router[_0x3924('0x5')](_0x3924('0x10'),auth[_0x3924('0x7')](),controller[_0x3924('0x11')]);router[_0x3924('0x5')](_0x3924('0x12'),auth[_0x3924('0x7')](),controller[_0x3924('0x13')]);router[_0x3924('0x5')]('/fax/queues',auth[_0x3924('0x7')](),controller[_0x3924('0x14')]);router[_0x3924('0x5')](_0x3924('0x15'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x3924('0x5')](_0x3924('0x16'),auth['isAuthenticated'](),controller[_0x3924('0x17')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x3924('0x7')](),controller[_0x3924('0x18')]);router[_0x3924('0x5')](_0x3924('0x19'),auth[_0x3924('0x7')](),controller[_0x3924('0x1a')]);router[_0x3924('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x3924('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x3924('0x5')](_0x3924('0x1b'),auth[_0x3924('0x7')](),controller[_0x3924('0x1c')]);router[_0x3924('0x1d')](_0x3924('0x1b'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x3924('0x5')](_0x3924('0x1e'),auth[_0x3924('0x7')](),controller[_0x3924('0x1f')]);router[_0x3924('0x5')](_0x3924('0x20'),auth[_0x3924('0x7')](),controller[_0x3924('0x21')]);router[_0x3924('0x5')](_0x3924('0x22'),auth[_0x3924('0x7')](),controller[_0x3924('0x23')]);router[_0x3924('0x1d')](_0x3924('0x24'),auth[_0x3924('0x7')](),controller['agentCapacity']);router[_0x3924('0x5')](_0x3924('0x25'),auth['isAuthenticated'](),controller[_0x3924('0x26')]);router[_0x3924('0x5')](_0x3924('0x27'),auth[_0x3924('0x7')](),controller[_0x3924('0x28')]);router[_0x3924('0x5')](_0x3924('0x29'),auth[_0x3924('0x7')](),controller[_0x3924('0x2a')]);router[_0x3924('0x5')](_0x3924('0x2b'),auth[_0x3924('0x7')](),controller[_0x3924('0x2c')]);router[_0x3924('0x5')](_0x3924('0x2d'),auth[_0x3924('0x7')](),controller[_0x3924('0x2e')]);router[_0x3924('0x5')](_0x3924('0x2f'),auth[_0x3924('0x7')](),controller[_0x3924('0x30')]);router[_0x3924('0x5')](_0x3924('0x31'),auth[_0x3924('0x7')](),controller[_0x3924('0x32')]);router[_0x3924('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x3924('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x3924('0x5')](_0x3924('0x33'),auth[_0x3924('0x7')](),controller['smsQueuesWaitingInteractions']);router[_0x3924('0x5')](_0x3924('0x34'),auth[_0x3924('0x7')](),controller[_0x3924('0x35')]);router[_0x3924('0x5')](_0x3924('0x36'),auth[_0x3924('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x3924('0x37')](_0x3924('0x38'),auth[_0x3924('0x7')](),controller['queueNotify'](_0x3924('0x39')));router[_0x3924('0x5')](_0x3924('0x3a'),auth[_0x3924('0x7')](),controller[_0x3924('0x3b')]);router[_0x3924('0x37')](_0x3924('0x3c'),auth['isAuthenticated'](),controller[_0x3924('0x3d')](_0x3924('0x3e')));router['get'](_0x3924('0x3f'),auth[_0x3924('0x7')](),controller[_0x3924('0x40')]);router[_0x3924('0x37')](_0x3924('0x41'),auth[_0x3924('0x7')](),controller['queueNotify'](_0x3924('0x42')));router['get'](_0x3924('0x43'),auth[_0x3924('0x7')](),controller[_0x3924('0x44')]);router['post'](_0x3924('0x45'),auth[_0x3924('0x7')](),controller[_0x3924('0x3d')](_0x3924('0x46')));router[_0x3924('0x5')]('/openchannel/queues/:id',auth[_0x3924('0x7')](),controller['showOpenchannelQueues']);router[_0x3924('0x37')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x3924('0x37')](_0x3924('0x47'),auth[_0x3924('0x7')](),controller['queueNotify'](_0x3924('0x48')));router[_0x3924('0x5')](_0x3924('0x49'),auth['isAuthenticated'](),controller['showSmsQueues']);router['get'](_0x3924('0x4a'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x3924('0x4b'),auth[_0x3924('0x7')](),controller['agentNotify']);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 f8ba4bf..876504b 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 _0xee14=['telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','INTERACTION','SIP/%s','AgentCapacity'];(function(_0x4f57fd,_0x2241c8){var _0x1bfca7=function(_0x8ca76b){while(--_0x8ca76b){_0x4f57fd['push'](_0x4f57fd['shift']());}};_0x1bfca7(++_0x2241c8);}(_0xee14,0x13a));var _0x4ee1=function(_0x14031c,_0x22c57e){_0x14031c=_0x14031c-0x0;var _0x140fa3=_0xee14[_0x14031c];return _0x140fa3;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var db=require(_0x4ee1('0x2'))['db'];var logger=require(_0x4ee1('0x3'))(_0x4ee1('0x4'));var jayson=require(_0x4ee1('0x5'));var amiClient=jayson[_0x4ee1('0x6')][_0x4ee1('0x7')]({'port':0x232a});var mailClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){var _0x1fd8c8=_0x187656?_0x187656:amiClient;return _0x1fd8c8['request'](_0x327c18,_0x3a45a3)[_0x4ee1('0x8')](function(_0x38be25){if(_0x38be25['error']){if(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xa')]===0x1f4){return _0xdfe9c1(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xb')]);}return _0x293d5f(_0x38be25['error'][_0x4ee1('0xb')]);}else{_0x293d5f(_0x38be25[_0x4ee1('0xc')]);}})[_0x4ee1('0xd')](function(_0x2d5d3c){_0xdfe9c1(_0x2d5d3c);});});}function respondWithResult(_0x2f864e,_0x174427){_0x174427=_0x174427||0xc8;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0xe')](_0x174427)[_0x4ee1('0xf')](_0x5616d6);}return _0x2f864e[_0x4ee1('0x10')](0x194);};}function handleError(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0x1f4;return function(_0x1c342a){logger[_0x4ee1('0x9')](_0x1c342a[_0x4ee1('0x11')]);if(_0x1c342a[_0x4ee1('0x12')]){delete _0x1c342a['name'];}_0x24a915[_0x4ee1('0xe')](_0x46d2c2)[_0x4ee1('0x13')](_0x1c342a);};}function findById(_0x34651b){return function(_0x1b1e0e){if(!_[_0x4ee1('0x14')](_0x34651b)&&!_[_0x4ee1('0x14')](_0x1b1e0e)&&!_[_0x4ee1('0x14')](_0x1b1e0e[_0x4ee1('0x15')])){return _[_0x4ee1('0x16')](_0x1b1e0e[_0x4ee1('0x15')],function(_0x274de5){return _0x274de5['id']==_0x34651b;});}return null;};}exports['voiceChannels']=function(_0x236215,_0x3db827){return respondWithRpcPromise(_0x4ee1('0x17'),_0x236215[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3db827,null))[_0x4ee1('0xd')](handleError(_0x3db827,null));};exports['voiceChannelMixMonitor']=function(_0x8a631f,_0x333e96){return respondWithRpcPromise(_0x4ee1('0x19'),_[_0x4ee1('0x1a')](_0x8a631f[_0x4ee1('0x18')],_0x8a631f[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x333e96,null))[_0x4ee1('0xd')](handleError(_0x333e96,null));};exports[_0x4ee1('0x1c')]=function(_0x3e5038,_0x4faaf6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x4ee1('0x1a')](_0x3e5038[_0x4ee1('0x18')],_0x3e5038[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x4faaf6,null))[_0x4ee1('0xd')](handleError(_0x4faaf6,null));};exports[_0x4ee1('0x1d')]=function(_0x57d45d,_0x5cc0b5){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x57d45d[_0x4ee1('0x18')])['then'](respondWithResult(_0x5cc0b5,null))[_0x4ee1('0xd')](handleError(_0x5cc0b5,null));};exports[_0x4ee1('0x1f')]=function(_0x36654c,_0x215949){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x36654c[_0x4ee1('0x18')])[_0x4ee1('0x8')](findById(_0x36654c['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x215949,null))['catch'](handleError(_0x215949,null));};exports[_0x4ee1('0x20')]=function(_0x4ec408,_0x3dc870){return respondWithRpcPromise(_0x4ee1('0x21'),_[_0x4ee1('0x1a')](_0x4ec408[_0x4ee1('0x22')],_0x4ec408[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x3dc870,null))[_0x4ee1('0xd')](handleError(_0x3dc870,null));};exports['voiceQueuesPreview']=function(_0x121301,_0x3d5e6c){return respondWithRpcPromise(_0x4ee1('0x23'),_[_0x4ee1('0x1a')](_0x121301[_0x4ee1('0x18')],_0x121301['params']))[_0x4ee1('0x8')](respondWithResult(_0x3d5e6c,null))[_0x4ee1('0xd')](handleError(_0x3d5e6c,null));};exports[_0x4ee1('0x24')]=function(_0x2e37a3,_0x79f87c){return respondWithRpcPromise(_0x4ee1('0x25'),_0x2e37a3['query'])['then'](respondWithResult(_0x79f87c,null))[_0x4ee1('0xd')](handleError(_0x79f87c,null));};exports[_0x4ee1('0x26')]=function(_0x41ab60,_0x5a2f6f){return respondWithRpcPromise(_0x4ee1('0x27'),_[_0x4ee1('0x1a')](_0x41ab60[_0x4ee1('0x18')],_0x41ab60[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x5a2f6f,null))[_0x4ee1('0xd')](handleError(_0x5a2f6f,null));};exports[_0x4ee1('0x28')]=function(_0x199e11,_0x36898c){return respondWithRpcPromise(_0x4ee1('0x29'),_[_0x4ee1('0x1a')](_0x199e11[_0x4ee1('0x18')],_0x199e11[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x36898c,null))[_0x4ee1('0xd')](handleError(_0x36898c,null));};exports[_0x4ee1('0x2a')]=function(_0x882468,_0x50539f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ee1('0x1a')](_0x882468[_0x4ee1('0x18')],_0x882468[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x50539f,null))['catch'](handleError(_0x50539f,null));};exports[_0x4ee1('0x2b')]=function(_0x2ed16f,_0x11721a){return respondWithRpcPromise(_0x4ee1('0x2c'),_0x2ed16f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x11721a,null))[_0x4ee1('0xd')](handleError(_0x11721a,null));};exports[_0x4ee1('0x2d')]=function(_0x59b5cc,_0x3b346e){return respondWithRpcPromise(_0x4ee1('0x2e'),_0x59b5cc[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3b346e,null))[_0x4ee1('0xd')](handleError(_0x3b346e,null));};exports[_0x4ee1('0x2f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')])[_0x4ee1('0x8')](function(_0x352dc5){_0x37176a=_0x352dc5;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')],routingClient);})[_0x4ee1('0x8')](function(_0x29493d){return _[_0x4ee1('0x1a')]({},_0x29493d,_0x37176a);})[_0x4ee1('0x8')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0xd')](handleError(_0x3e2ca7,null));};exports['agentCapacity']=function(_0x3b3bed,_0x40a3e3){if(_0x3b3bed['body']&&_0x3b3bed[_0x4ee1('0x22')]['interaction']&&_0x3b3bed[_0x4ee1('0x31')]&&_0x3b3bed['user'][_0x4ee1('0x12')]){for(var _0xc7580c in _0x3b3bed['body'][_0x4ee1('0x32')]){if(_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0x4ee1('0x33')](_0xc7580c)){db['MemberReport'][_0x4ee1('0x34')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3b3bed['body'][_0x4ee1('0x32')][_0xc7580c]&&_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')]?{'$notIn':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c]}:{'$ne':null}}})['then'](function(_0xaa71d5){var _0x266add=moment()[_0x4ee1('0x36')](_0x4ee1('0x37'));for(var _0x5c5862=0x0,_0x3d6bf4=_0xaa71d5[_0x4ee1('0x35')];_0x5c5862<_0x3d6bf4;_0x5c5862+=0x1){_0xaa71d5[_0x5c5862]['updateAttributes']({'exitAt':_0x266add});}});for(var _0x21ebb8=0x0;_0x21ebb8<_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')];_0x21ebb8+=0x1){db[_0x4ee1('0x38')][_0x4ee1('0x39')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':_0x4ee1('0x3a'),'uniqueid':_0x3b3bed['body']['interaction'][_0xc7580c][_0x21ebb8],'exitAt':null},'defaults':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'interface':_[_0x4ee1('0x14')](_0x3b3bed[_0x4ee1('0x31')]['interface'])?util[_0x4ee1('0x36')](_0x4ee1('0x3b'),_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')]):_0x3b3bed[_0x4ee1('0x31')]['interface'],'type':_0x4ee1('0x3a'),'enterAt':moment()[_0x4ee1('0x36')](_0x4ee1('0x37')),'role':'agent','internal':_0x3b3bed[_0x4ee1('0x31')]['internal'],'uniqueid':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c][_0x21ebb8]}});}}}}return respondWithRpcPromise(_0x4ee1('0x3c'),{'id':_0x3b3bed['params']['id'],'capacity':_0x3b3bed[_0x4ee1('0x22')]['capacity']},routingClient)[_0x4ee1('0x8')](respondWithResult(_0x40a3e3,null))[_0x4ee1('0xd')](handleError(_0x40a3e3,null));};exports[_0x4ee1('0x3d')]=function(_0x5f4f78,_0x3368ed){return respondWithRpcPromise(_0x4ee1('0x3e'),_0x5f4f78[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3368ed,null))[_0x4ee1('0xd')](handleError(_0x3368ed,null));};exports[_0x4ee1('0x3f')]=function(_0x3f1c32,_0x517729){return respondWithRpcPromise('Trunks',_0x3f1c32[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x517729,null))[_0x4ee1('0xd')](handleError(_0x517729,null));};exports[_0x4ee1('0x40')]=function(_0x44e65f,_0x31e82d){return respondWithRpcPromise(_0x4ee1('0x41'),_0x44e65f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x31e82d,null))[_0x4ee1('0xd')](handleError(_0x31e82d,null));};exports[_0x4ee1('0x42')]=function(_0x2453ac,_0x3c2e42){return respondWithRpcPromise('ChatQueues',_0x2453ac[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x3c2e42,null))[_0x4ee1('0xd')](handleError(_0x3c2e42,null));};exports[_0x4ee1('0x43')]=function(_0x59bbca,_0x1e0aac){return respondWithRpcPromise(_0x4ee1('0x44'),_0x59bbca['query'],routingClient)['then'](findById(_0x59bbca[_0x4ee1('0x1b')]['id']))['then'](respondWithResult(_0x1e0aac,null))[_0x4ee1('0xd')](handleError(_0x1e0aac,null));};exports[_0x4ee1('0x45')]=function(_0x59ba70,_0x43489c){return respondWithRpcPromise(_0x4ee1('0x46'),_0x59ba70[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x43489c,null))[_0x4ee1('0xd')](handleError(_0x43489c,null));};exports[_0x4ee1('0x47')]=function(_0x11f619,_0x5f5694){return respondWithRpcPromise('MailQueues',_0x11f619[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x11f619['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x5f5694,null))[_0x4ee1('0xd')](handleError(_0x5f5694,null));};exports[_0x4ee1('0x48')]=function(_0x51e341,_0x1ad933){return respondWithRpcPromise('MailAccounts',_0x51e341[_0x4ee1('0x18')],mailClient)['then'](respondWithResult(_0x1ad933,null))['catch'](handleError(_0x1ad933,null));};exports[_0x4ee1('0x49')]=function(_0x16fcd0,_0x290451){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x16fcd0[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x290451,null))[_0x4ee1('0xd')](handleError(_0x290451,null));};exports[_0x4ee1('0x4b')]=function(_0x10f4e,_0x58eb1d){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x10f4e[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x10f4e[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x58eb1d,null))[_0x4ee1('0xd')](handleError(_0x58eb1d,null));};exports[_0x4ee1('0x4c')]=function(_0x20ca0b,_0x19fa31){return respondWithRpcPromise(_0x4ee1('0x4d'),_0x20ca0b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x19fa31,null))['catch'](handleError(_0x19fa31,null));};exports[_0x4ee1('0x4e')]=function(_0x5bf5e9,_0x25cfc3){return respondWithRpcPromise('SmsQueues',_0x5bf5e9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x5bf5e9[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x25cfc3,null))[_0x4ee1('0xd')](handleError(_0x25cfc3,null));};exports[_0x4ee1('0x4f')]=function(_0x342aa1,_0x447060){return respondWithRpcPromise(_0x4ee1('0x50'),_0x342aa1[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x447060,null))[_0x4ee1('0xd')](handleError(_0x447060,null));};exports['showWhatsappQueues']=function(_0x759888,_0x24308c){return respondWithRpcPromise(_0x4ee1('0x50'),_0x759888['query'],routingClient)['then'](findById(_0x759888[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x24308c,null))['catch'](handleError(_0x24308c,null));};exports[_0x4ee1('0x51')]=function(_0x431dfa,_0x3f8f94){return respondWithRpcPromise(_0x4ee1('0x52'),_0x431dfa[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x3f8f94,null))[_0x4ee1('0xd')](handleError(_0x3f8f94,null));};exports[_0x4ee1('0x53')]=function(_0x28e11c,_0x3824bf){return respondWithRpcPromise('FaxQueues',_0x28e11c[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x28e11c['params']['id']))['then'](respondWithResult(_0x3824bf,null))[_0x4ee1('0xd')](handleError(_0x3824bf,null));};exports[_0x4ee1('0x54')]=function(_0x19e095,_0x38e06){return respondWithRpcPromise(_0x4ee1('0x55'),_0x19e095[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x38e06,null))['catch'](handleError(_0x38e06,null));};exports[_0x4ee1('0x56')]=function(_0x39583b,_0x44af66){return respondWithRpcPromise(_0x4ee1('0x57'),_0x39583b[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x44af66,null))[_0x4ee1('0xd')](handleError(_0x44af66,null));};exports['mailQueuesWaitingInteractions']=function(_0x1d360f,_0x29371c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1d360f['query'],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x29371c,null))[_0x4ee1('0xd')](handleError(_0x29371c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2beb82,_0x5aacf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2beb82[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x5aacf1,null))[_0x4ee1('0xd')](handleError(_0x5aacf1,null));};exports[_0x4ee1('0x58')]=function(_0x37fa42,_0x38698a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37fa42[_0x4ee1('0x18')],routingClient)['then'](function(_0x57f66c){if(_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')]!==undefined){var _0x411c99=_(_0x57f66c[_0x4ee1('0x15')])[_0x4ee1('0x5a')]([_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')],_0x37fa42[_0x4ee1('0x1b')]['id']])['map'](_0x4ee1('0x5b'))[_0x4ee1('0x5c')]()['value']();return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0xcd0dd9){return _0x411c99[_0x4ee1('0x5d')](_0xcd0dd9[_0x4ee1('0x5b')])>-0x1;});}else{return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0x4dee3a){return _0x4dee3a[_0x4ee1('0x5b')]===parseInt(_0x37fa42['params']['id']);});}})[_0x4ee1('0x8')](respondWithResult(_0x38698a,null))[_0x4ee1('0xd')](handleError(_0x38698a,null));};exports[_0x4ee1('0x5e')]=function(_0x35a719,_0x48c51c){return respondWithRpcPromise(_0x4ee1('0x5f'),_0x35a719[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x48c51c,null))['catch'](handleError(_0x48c51c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2ef7c9,_0x4b4ad5){return respondWithRpcPromise(_0x4ee1('0x60'),_0x2ef7c9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x4b4ad5,null))['catch'](handleError(_0x4b4ad5,null));};exports['faxQueuesWaitingInteractions']=function(_0x27fd3b,_0x1e2360){return respondWithRpcPromise(_0x4ee1('0x61'),_0x27fd3b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x1e2360,null))[_0x4ee1('0xd')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x62')]=function(_0x5727ef){return function(_0x4a3201,_0x50645b){var _0x3fba19,_0x3a75a7;var _0x33f5af=_[_0x4ee1('0x63')](_0x5727ef);var _0x4db801=_0x5727ef===_0x4ee1('0x64')?'Website':_0x4ee1('0x65');return db[_0x33f5af+_0x4ee1('0x66')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x4a3201[_0x4ee1('0x1b')]['id']}})[_0x4ee1('0x8')](function(_0x190f59){if(_['isNil'](_0x190f59)){throw new Error(_0x33f5af+_0x4ee1('0x68'));}_0x3fba19=_0x190f59;return db[_0x33f5af+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x4a3201[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0x33f5af+_0x4ee1('0x6b')],'as':_0x4ee1('0x6b')},{'model':db[_0x33f5af+_0x4db801],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x207758){if(_[_0x4ee1('0x14')](_0x207758)){throw new Error(_0x33f5af+'\x20Message\x20not\x20found');}_0x3a75a7=_0x207758;return _0x207758[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x646878={'uniqueid':_0x5727ef+'.'+_0x3a75a7['id']+'.'+_0x3a75a7[_0x4ee1('0x6b')]['id'],'FromUserId':_0x4a3201[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d')};_0x646878[_0x33f5af+_0x4ee1('0x6e')]=_0x3a75a7['id'];_0x646878[_0x33f5af+_0x4ee1('0x6f')]=_0x3a75a7[_0x4ee1('0x6b')]['id'];_0x646878[_0x4ee1('0x70')+_0x33f5af+_0x4db801+'Id']=_0x3a75a7[_0x4ee1('0x65')]['id'];_0x646878['To'+_0x33f5af+_0x4ee1('0x71')]=_0x3fba19['id'];return db[_0x33f5af+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x646878);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x5727ef,'interaction':_0x3a75a7['Interaction'],'message':_0x3a75a7,'account':_0x3a75a7[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x6d'),'appdata':_0x3fba19['name']+','+(_0x3a75a7[_0x4ee1('0x65')][_0x4ee1('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x50645b,null))[_0x4ee1('0xd')](handleError(_0x50645b,null));};};exports['agentNotify']=function(_0x13a755,_0x1a00a4){var _0x47b854,_0x1700c6;if(_[_0x4ee1('0x14')](_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2bc05a=_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')];var _0xc07f75=_[_0x4ee1('0x63')](_0x2bc05a);var _0x4315e9=_0x2bc05a===_0x4ee1('0x64')?_0x4ee1('0x77'):'Account';return db[_0x4ee1('0x78')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x13a755['params']['id'],'role':_0x4ee1('0x79')}})['then'](function(_0x5cf7fb){if(_[_0x4ee1('0x14')](_0x5cf7fb)){throw new Error(_0x4ee1('0x7a'));}_0x47b854=_0x5cf7fb;return db[_0xc07f75+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0xc07f75+'Interaction'],'as':_0x4ee1('0x6b')},{'model':db[_0xc07f75+_0x4315e9],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x17ae2d){if(_[_0x4ee1('0x14')](_0x17ae2d)){throw new Error(_0xc07f75+_0x4ee1('0x7b'));}_0x1700c6=_0x17ae2d;return _0x17ae2d[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x5076c6={'uniqueid':_0x2bc05a+'.'+_0x1700c6['id']+'.'+_0x1700c6[_0x4ee1('0x6b')]['id'],'FromUserId':_0x13a755[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d'),'ToUserId':_0x47b854['id']};_0x5076c6[_0xc07f75+_0x4ee1('0x6e')]=_0x1700c6['id'];_0x5076c6[_0xc07f75+_0x4ee1('0x6f')]=_0x1700c6['Interaction']['id'];_0x5076c6[_0x4ee1('0x70')+_0xc07f75+_0x4315e9+'Id']=_0x1700c6['Account']['id'];return db[_0xc07f75+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x5076c6);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x2bc05a,'interaction':_0x1700c6['Interaction'],'message':_0x1700c6,'account':_0x1700c6[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x79'),'appdata':_0x47b854['name']+','+(_0x1700c6[_0x4ee1('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x4ee1('0x7c')}]},routingClient);})[_0x4ee1('0x8')](respondWithResult(_0x1a00a4,null))['catch'](handleError(_0x1a00a4,null));}; \ No newline at end of file +var _0x8d0e=['merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','showChatQueues','ChatQueues','mailQueues','showMailQueues','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','findOne','messageId','Interaction','update','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','agent','\x20Message\x20not\x20found','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch','json','stack','name','send','isNil','rows','voiceChannels','query','then','VoiceChannelMixMonitor'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x315fdc,_0x15282a){_0x315fdc=_0x315fdc-0x0;var _0x5409e2=_0x8d0e[_0x315fdc];return _0x5409e2;};'use strict';var BPromise=require(_0xe8d0('0x0'));var moment=require(_0xe8d0('0x1'));var _=require(_0xe8d0('0x2'));var util=require(_0xe8d0('0x3'));var db=require(_0xe8d0('0x4'))['db'];var logger=require(_0xe8d0('0x5'))(_0xe8d0('0x6'));var jayson=require(_0xe8d0('0x7'));var amiClient=jayson[_0xe8d0('0x8')]['http']({'port':0x232a});var mailClient=jayson[_0xe8d0('0x8')]['http']({'port':0x232b});var routingClient=jayson['client'][_0xe8d0('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){var _0x1b353a=_0xcc03d0?_0xcc03d0:amiClient;return _0x1b353a[_0xe8d0('0xa')](_0x92483d,_0x469d37)['then'](function(_0x10e56c){if(_0x10e56c[_0xe8d0('0xb')]){if(_0x10e56c[_0xe8d0('0xb')]['code']===0x1f4){return _0x13aa63(_0x10e56c['error'][_0xe8d0('0xc')]);}return _0x2b6dce(_0x10e56c[_0xe8d0('0xb')][_0xe8d0('0xc')]);}else{_0x2b6dce(_0x10e56c[_0xe8d0('0xd')]);}})[_0xe8d0('0xe')](function(_0x41de69){_0x13aa63(_0x41de69);});});}function respondWithResult(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xc8;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['status'](_0x38fac0)[_0xe8d0('0xf')](_0x15b9e5);}return _0x5934b2['sendStatus'](0x194);};}function handleError(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0x1f4;return function(_0x2aa906){logger[_0xe8d0('0xb')](_0x2aa906[_0xe8d0('0x10')]);if(_0x2aa906[_0xe8d0('0x11')]){delete _0x2aa906[_0xe8d0('0x11')];}_0x59b4b7['status'](_0x90a1ea)[_0xe8d0('0x12')](_0x2aa906);};}function findById(_0x49554d){return function(_0x6d932b){if(!_[_0xe8d0('0x13')](_0x49554d)&&!_[_0xe8d0('0x13')](_0x6d932b)&&!_['isNil'](_0x6d932b['rows'])){return _['find'](_0x6d932b[_0xe8d0('0x14')],function(_0x384854){return _0x384854['id']==_0x49554d;});}return null;};}exports[_0xe8d0('0x15')]=function(_0x44bbe4,_0x83177b){return respondWithRpcPromise('VoiceChannels',_0x44bbe4[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x83177b,null))['catch'](handleError(_0x83177b,null));};exports['voiceChannelMixMonitor']=function(_0x554402,_0x384a60){return respondWithRpcPromise(_0xe8d0('0x18'),_[_0xe8d0('0x19')](_0x554402[_0xe8d0('0x16')],_0x554402[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x384a60,null))[_0xe8d0('0xe')](handleError(_0x384a60,null));};exports[_0xe8d0('0x1b')]=function(_0x32e39a,_0x5ab4e7){return respondWithRpcPromise(_0xe8d0('0x1c'),_[_0xe8d0('0x19')](_0x32e39a['query'],_0x32e39a[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x5ab4e7,null))[_0xe8d0('0xe')](handleError(_0x5ab4e7,null));};exports[_0xe8d0('0x1d')]=function(_0x146783,_0x149dfd){return respondWithRpcPromise(_0xe8d0('0x1e'),_0x146783[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x149dfd,null))[_0xe8d0('0xe')](handleError(_0x149dfd,null));};exports[_0xe8d0('0x1f')]=function(_0x539548,_0x24982c){return respondWithRpcPromise(_0xe8d0('0x1e'),_0x539548[_0xe8d0('0x16')])['then'](findById(_0x539548[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x24982c,null))['catch'](handleError(_0x24982c,null));};exports[_0xe8d0('0x20')]=function(_0x3ffcb7,_0x11fcf2){return respondWithRpcPromise(_0xe8d0('0x21'),_[_0xe8d0('0x19')](_0x3ffcb7['body'],_0x3ffcb7[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x11fcf2,null))['catch'](handleError(_0x11fcf2,null));};exports['voiceQueuesPreview']=function(_0x547a2b,_0x13cd4c){return respondWithRpcPromise(_0xe8d0('0x22'),_['merge'](_0x547a2b['query'],_0x547a2b[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x13cd4c,null))[_0xe8d0('0xe')](handleError(_0x13cd4c,null));};exports[_0xe8d0('0x23')]=function(_0x327004,_0x1b2b0a){return respondWithRpcPromise(_0xe8d0('0x24'),_0x327004['query'])[_0xe8d0('0x17')](respondWithResult(_0x1b2b0a,null))[_0xe8d0('0xe')](handleError(_0x1b2b0a,null));};exports[_0xe8d0('0x25')]=function(_0x145ddb,_0x587819){return respondWithRpcPromise(_0xe8d0('0x26'),_[_0xe8d0('0x19')](_0x145ddb['query'],_0x145ddb[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x587819,null))[_0xe8d0('0xe')](handleError(_0x587819,null));};exports['voiceQueuesChannelHangup']=function(_0x197e01,_0x531835){return respondWithRpcPromise(_0xe8d0('0x27'),_[_0xe8d0('0x19')](_0x197e01[_0xe8d0('0x16')],_0x197e01[_0xe8d0('0x1a')]))['then'](respondWithResult(_0x531835,null))[_0xe8d0('0xe')](handleError(_0x531835,null));};exports[_0xe8d0('0x28')]=function(_0x20eec5,_0x516243){return respondWithRpcPromise(_0xe8d0('0x29'),_[_0xe8d0('0x19')](_0x20eec5[_0xe8d0('0x16')],_0x20eec5[_0xe8d0('0x1a')]))[_0xe8d0('0x17')](respondWithResult(_0x516243,null))['catch'](handleError(_0x516243,null));};exports[_0xe8d0('0x2a')]=function(_0x1828c5,_0x10970d){return respondWithRpcPromise(_0xe8d0('0x2b'),_0x1828c5[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x10970d,null))[_0xe8d0('0xe')](handleError(_0x10970d,null));};exports[_0xe8d0('0x2c')]=function(_0x4edb3d,_0x5dff14){return respondWithRpcPromise(_0xe8d0('0x2d'),_0x4edb3d[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x5dff14,null))[_0xe8d0('0xe')](handleError(_0x5dff14,null));};exports[_0xe8d0('0x2e')]=function(_0x585d27,_0x2e4362){var _0x4bd7a2;return respondWithRpcPromise(_0xe8d0('0x2f'),_0x585d27[_0xe8d0('0x16')])[_0xe8d0('0x17')](function(_0x48fa07){_0x4bd7a2=_0x48fa07;return respondWithRpcPromise(_0xe8d0('0x2f'),_0x585d27[_0xe8d0('0x16')],routingClient);})[_0xe8d0('0x17')](function(_0x230a90){return _[_0xe8d0('0x19')]({},_0x230a90,_0x4bd7a2);})['then'](respondWithResult(_0x2e4362,null))['catch'](handleError(_0x2e4362,null));};exports['agentCapacity']=function(_0x4cf0da,_0x14ffb6){if(_0x4cf0da['body']&&_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')]&&_0x4cf0da[_0xe8d0('0x32')]&&_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')]){for(var _0x1156da in _0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')]){if(_0x4cf0da['body'][_0xe8d0('0x31')][_0xe8d0('0x33')](_0x1156da)){db['MemberReport']['findAll']({'where':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')],'type':_0xe8d0('0x34'),'exitAt':null,'uniqueid':_0x4cf0da['body'][_0xe8d0('0x31')][_0x1156da]&&_0x4cf0da[_0xe8d0('0x30')]['interaction'][_0x1156da][_0xe8d0('0x35')]?{'$notIn':_0x4cf0da[_0xe8d0('0x30')]['interaction'][_0x1156da]}:{'$ne':null}}})[_0xe8d0('0x17')](function(_0x23e250){var _0x1b7866=moment()[_0xe8d0('0x36')](_0xe8d0('0x37'));for(var _0x2a6760=0x0,_0x11339d=_0x23e250[_0xe8d0('0x35')];_0x2a6760<_0x11339d;_0x2a6760+=0x1){_0x23e250[_0x2a6760]['updateAttributes']({'exitAt':_0x1b7866});}});for(var _0x31a370=0x0;_0x31a370<_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0xe8d0('0x35')];_0x31a370+=0x1){db[_0xe8d0('0x38')][_0xe8d0('0x39')]({'where':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')],'type':_0xe8d0('0x34'),'uniqueid':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0x31a370],'exitAt':null},'defaults':{'channel':_0x1156da,'membername':_0x4cf0da[_0xe8d0('0x32')]['name'],'interface':_[_0xe8d0('0x13')](_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x3a')])?util[_0xe8d0('0x36')](_0xe8d0('0x3b'),_0x4cf0da[_0xe8d0('0x32')][_0xe8d0('0x11')]):_0x4cf0da['user'][_0xe8d0('0x3a')],'type':_0xe8d0('0x34'),'enterAt':moment()[_0xe8d0('0x36')](_0xe8d0('0x37')),'role':'agent','internal':_0x4cf0da[_0xe8d0('0x32')]['internal'],'uniqueid':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x31')][_0x1156da][_0x31a370]}});}}}}return respondWithRpcPromise(_0xe8d0('0x3c'),{'id':_0x4cf0da[_0xe8d0('0x1a')]['id'],'capacity':_0x4cf0da[_0xe8d0('0x30')][_0xe8d0('0x3d')]},routingClient)[_0xe8d0('0x17')](respondWithResult(_0x14ffb6,null))['catch'](handleError(_0x14ffb6,null));};exports[_0xe8d0('0x3e')]=function(_0x55f93d,_0x581a34){return respondWithRpcPromise(_0xe8d0('0x3f'),_0x55f93d['query'])[_0xe8d0('0x17')](respondWithResult(_0x581a34,null))['catch'](handleError(_0x581a34,null));};exports[_0xe8d0('0x40')]=function(_0x28494c,_0x13713c){return respondWithRpcPromise(_0xe8d0('0x41'),_0x28494c['query'])[_0xe8d0('0x17')](respondWithResult(_0x13713c,null))[_0xe8d0('0xe')](handleError(_0x13713c,null));};exports[_0xe8d0('0x42')]=function(_0x2e3f1d,_0x18cc14){return respondWithRpcPromise('Campaigns',_0x2e3f1d[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x18cc14,null))[_0xe8d0('0xe')](handleError(_0x18cc14,null));};exports['chatQueues']=function(_0x2f4d43,_0x571c4e){return respondWithRpcPromise('ChatQueues',_0x2f4d43[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x571c4e,null))['catch'](handleError(_0x571c4e,null));};exports[_0xe8d0('0x43')]=function(_0x3a8074,_0x47893d){return respondWithRpcPromise(_0xe8d0('0x44'),_0x3a8074[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x3a8074[_0xe8d0('0x1a')]['id']))['then'](respondWithResult(_0x47893d,null))[_0xe8d0('0xe')](handleError(_0x47893d,null));};exports[_0xe8d0('0x45')]=function(_0x25e5ab,_0x76316a){return respondWithRpcPromise('MailQueues',_0x25e5ab[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x76316a,null))[_0xe8d0('0xe')](handleError(_0x76316a,null));};exports[_0xe8d0('0x46')]=function(_0x1a74d0,_0x29667c){return respondWithRpcPromise('MailQueues',_0x1a74d0['query'],routingClient)[_0xe8d0('0x17')](findById(_0x1a74d0['params']['id']))[_0xe8d0('0x17')](respondWithResult(_0x29667c,null))[_0xe8d0('0xe')](handleError(_0x29667c,null));};exports['mailAccounts']=function(_0x5ac1ae,_0x995163){return respondWithRpcPromise('MailAccounts',_0x5ac1ae[_0xe8d0('0x16')],mailClient)['then'](respondWithResult(_0x995163,null))[_0xe8d0('0xe')](handleError(_0x995163,null));};exports[_0xe8d0('0x47')]=function(_0x13b9f0,_0x4e2abc){return respondWithRpcPromise(_0xe8d0('0x48'),_0x13b9f0[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x4e2abc,null))[_0xe8d0('0xe')](handleError(_0x4e2abc,null));};exports['showOpenchannelQueues']=function(_0x3d0908,_0x4ff583){return respondWithRpcPromise(_0xe8d0('0x48'),_0x3d0908[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x3d0908[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x4ff583,null))['catch'](handleError(_0x4ff583,null));};exports['smsQueues']=function(_0xd7d433,_0x55a2df){return respondWithRpcPromise(_0xe8d0('0x49'),_0xd7d433[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x55a2df,null))[_0xe8d0('0xe')](handleError(_0x55a2df,null));};exports[_0xe8d0('0x4a')]=function(_0x1e806b,_0x177485){return respondWithRpcPromise(_0xe8d0('0x49'),_0x1e806b[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x1e806b[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x177485,null))[_0xe8d0('0xe')](handleError(_0x177485,null));};exports[_0xe8d0('0x4b')]=function(_0x22992f,_0x4a68d5){return respondWithRpcPromise(_0xe8d0('0x4c'),_0x22992f[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x4a68d5,null))[_0xe8d0('0xe')](handleError(_0x4a68d5,null));};exports[_0xe8d0('0x4d')]=function(_0x4848d4,_0x2eeb92){return respondWithRpcPromise(_0xe8d0('0x4c'),_0x4848d4[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](findById(_0x4848d4[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x2eeb92,null))[_0xe8d0('0xe')](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x4e')]=function(_0x40cb5c,_0x24be86){return respondWithRpcPromise(_0xe8d0('0x4f'),_0x40cb5c[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x24be86,null))['catch'](handleError(_0x24be86,null));};exports[_0xe8d0('0x50')]=function(_0x54c04f,_0x169047){return respondWithRpcPromise(_0xe8d0('0x4f'),_0x54c04f['query'],routingClient)[_0xe8d0('0x17')](findById(_0x54c04f[_0xe8d0('0x1a')]['id']))[_0xe8d0('0x17')](respondWithResult(_0x169047,null))[_0xe8d0('0xe')](handleError(_0x169047,null));};exports[_0xe8d0('0x51')]=function(_0x1b5df8,_0x473e0b){return respondWithRpcPromise(_0xe8d0('0x52'),_0x1b5df8[_0xe8d0('0x16')])[_0xe8d0('0x17')](respondWithResult(_0x473e0b,null))[_0xe8d0('0xe')](handleError(_0x473e0b,null));};exports[_0xe8d0('0x53')]=function(_0xa0c61a,_0x2147d5){return respondWithRpcPromise(_0xe8d0('0x54'),_0xa0c61a[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x2147d5,null))[_0xe8d0('0xe')](handleError(_0x2147d5,null));};exports[_0xe8d0('0x55')]=function(_0x500fb0,_0x30ed66){return respondWithRpcPromise(_0xe8d0('0x56'),_0x500fb0[_0xe8d0('0x16')],routingClient)['then'](respondWithResult(_0x30ed66,null))[_0xe8d0('0xe')](handleError(_0x30ed66,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x31e6df,_0x1c1794){return respondWithRpcPromise(_0xe8d0('0x57'),_0x31e6df['query'],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x1c1794,null))[_0xe8d0('0xe')](handleError(_0x1c1794,null));};exports[_0xe8d0('0x58')]=function(_0x207680,_0x939184){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x207680[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](function(_0x23ba49){if(_0x207680[_0xe8d0('0x16')][_0xe8d0('0x59')]!==undefined){var _0x385a73=_(_0x23ba49[_0xe8d0('0x14')])[_0xe8d0('0x5a')]([_0x207680['query'][_0xe8d0('0x59')],_0x207680[_0xe8d0('0x1a')]['id']])[_0xe8d0('0x5b')](_0xe8d0('0x5c'))['uniq']()[_0xe8d0('0x5d')]();return _0x23ba49[_0xe8d0('0x14')][_0xe8d0('0x5a')](function(_0x575730){return _0x385a73[_0xe8d0('0x5e')](_0x575730['queue_id'])>-0x1;});}else{return _0x23ba49[_0xe8d0('0x14')]['filter'](function(_0x25bc77){return _0x25bc77[_0xe8d0('0x5c')]===parseInt(_0x207680[_0xe8d0('0x1a')]['id']);});}})[_0xe8d0('0x17')](respondWithResult(_0x939184,null))[_0xe8d0('0xe')](handleError(_0x939184,null));};exports[_0xe8d0('0x5f')]=function(_0x17fbdc,_0x3f5c69){return respondWithRpcPromise(_0xe8d0('0x60'),_0x17fbdc[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x3f5c69,null))[_0xe8d0('0xe')](handleError(_0x3f5c69,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x20e4ff,_0x1fa61e){return respondWithRpcPromise(_0xe8d0('0x61'),_0x20e4ff[_0xe8d0('0x16')],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x1fa61e,null))[_0xe8d0('0xe')](handleError(_0x1fa61e,null));};exports[_0xe8d0('0x62')]=function(_0x605b5f,_0x2f9702){return respondWithRpcPromise(_0xe8d0('0x63'),_0x605b5f['query'],routingClient)[_0xe8d0('0x17')](respondWithResult(_0x2f9702,null))[_0xe8d0('0xe')](handleError(_0x2f9702,null));};exports[_0xe8d0('0x64')]=function(_0xebc89e){return function(_0x255e4b,_0x550fe6){var _0x4c4ff0,_0xca752a;var _0x5c8c7d=_[_0xe8d0('0x65')](_0xebc89e);var _0x16098b=_0xebc89e===_0xe8d0('0x66')?'Website':_0xe8d0('0x67');return db[_0x5c8c7d+'Queue'][_0xe8d0('0x68')]({'raw':!![],'where':{'id':_0x255e4b[_0xe8d0('0x1a')]['id']}})[_0xe8d0('0x17')](function(_0x1a04a6){if(_[_0xe8d0('0x13')](_0x1a04a6)){throw new Error(_0x5c8c7d+'\x20Queue\x20not\x20found');}_0x4c4ff0=_0x1a04a6;return db[_0x5c8c7d+'Message'][_0xe8d0('0x68')]({'where':{'id':_0x255e4b[_0xe8d0('0x30')][_0xe8d0('0x69')]},'include':[{'model':db[_0x5c8c7d+_0xe8d0('0x6a')],'as':_0xe8d0('0x6a')},{'model':db[_0x5c8c7d+_0x16098b],'as':_0xe8d0('0x67')}]});})[_0xe8d0('0x17')](function(_0x1ff1cc){if(_[_0xe8d0('0x13')](_0x1ff1cc)){throw new Error(_0x5c8c7d+'\x20Message\x20not\x20found');}_0xca752a=_0x1ff1cc;return _0x1ff1cc[_0xe8d0('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe8d0('0x17')](function(){var _0x142db4={'uniqueid':_0xebc89e+'.'+_0xca752a['id']+'.'+_0xca752a[_0xe8d0('0x6a')]['id'],'FromUserId':_0x255e4b['user']['id'],'type':'queue'};_0x142db4[_0x5c8c7d+_0xe8d0('0x6c')]=_0xca752a['id'];_0x142db4[_0x5c8c7d+_0xe8d0('0x6d')]=_0xca752a[_0xe8d0('0x6a')]['id'];_0x142db4[_0xe8d0('0x6e')+_0x5c8c7d+_0x16098b+'Id']=_0xca752a[_0xe8d0('0x67')]['id'];_0x142db4['To'+_0x5c8c7d+_0xe8d0('0x6f')]=_0x4c4ff0['id'];return db[_0x5c8c7d+_0xe8d0('0x70')][_0xe8d0('0x71')](_0x142db4);})[_0xe8d0('0x17')](function(){return respondWithRpcPromise(_0xe8d0('0x72'),{'channel':_0xebc89e,'interaction':_0xca752a['Interaction'],'message':_0xca752a,'account':_0xca752a[_0xe8d0('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe8d0('0x73'),'appdata':_0x4c4ff0[_0xe8d0('0x11')]+','+(_0xca752a[_0xe8d0('0x67')][_0xe8d0('0x74')]||0x12c),'interval':_0xe8d0('0x75')}]},routingClient);})[_0xe8d0('0x17')](respondWithResult(_0x550fe6,null))[_0xe8d0('0xe')](handleError(_0x550fe6,null));};};exports[_0xe8d0('0x76')]=function(_0x47bdc2,_0x52aece){var _0x2e11fc,_0x38e83f;if(_['isNil'](_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x77')])){throw new Error(_0xe8d0('0x78'));}var _0x499efb=_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x77')];var _0x233a5a=_[_0xe8d0('0x65')](_0x499efb);var _0x55588a=_0x499efb==='chat'?_0xe8d0('0x79'):_0xe8d0('0x67');return db['User']['findOne']({'raw':!![],'where':{'id':_0x47bdc2[_0xe8d0('0x1a')]['id'],'role':_0xe8d0('0x7a')}})[_0xe8d0('0x17')](function(_0x5eaf13){if(_[_0xe8d0('0x13')](_0x5eaf13)){throw new Error('Agent\x20not\x20found');}_0x2e11fc=_0x5eaf13;return db[_0x233a5a+'Message'][_0xe8d0('0x68')]({'where':{'id':_0x47bdc2[_0xe8d0('0x30')][_0xe8d0('0x69')]},'include':[{'model':db[_0x233a5a+_0xe8d0('0x6a')],'as':_0xe8d0('0x6a')},{'model':db[_0x233a5a+_0x55588a],'as':'Account'}]});})[_0xe8d0('0x17')](function(_0x455614){if(_['isNil'](_0x455614)){throw new Error(_0x233a5a+_0xe8d0('0x7b'));}_0x38e83f=_0x455614;return _0x455614[_0xe8d0('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe8d0('0x17')](function(){var _0x3e18af={'uniqueid':_0x499efb+'.'+_0x38e83f['id']+'.'+_0x38e83f['Interaction']['id'],'FromUserId':_0x47bdc2[_0xe8d0('0x32')]['id'],'type':_0xe8d0('0x73'),'ToUserId':_0x2e11fc['id']};_0x3e18af[_0x233a5a+_0xe8d0('0x6c')]=_0x38e83f['id'];_0x3e18af[_0x233a5a+_0xe8d0('0x6d')]=_0x38e83f[_0xe8d0('0x6a')]['id'];_0x3e18af[_0xe8d0('0x6e')+_0x233a5a+_0x55588a+'Id']=_0x38e83f[_0xe8d0('0x67')]['id'];return db[_0x233a5a+_0xe8d0('0x70')]['create'](_0x3e18af);})[_0xe8d0('0x17')](function(){return respondWithRpcPromise(_0xe8d0('0x72'),{'channel':_0x499efb,'interaction':_0x38e83f['Interaction'],'message':_0x38e83f,'account':_0x38e83f['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2e11fc['name']+','+(_0x38e83f[_0xe8d0('0x67')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe8d0('0x17')](respondWithResult(_0x52aece,null))['catch'](handleError(_0x52aece,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 33274e0..ad64464 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 _0xda14=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','create','put','update'];(function(_0x282706,_0x2a09e9){var _0x182e26=function(_0x3ebedf){while(--_0x3ebedf){_0x282706['push'](_0x282706['shift']());}};_0x182e26(++_0x2a09e9);}(_0xda14,0xff));var _0x4da1=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xda14[_0x184759];return _0xf26d5f;};'use strict';var multer=require(_0x4da1('0x0'));var util=require(_0x4da1('0x1'));var path=require(_0x4da1('0x2'));var timeout=require(_0x4da1('0x3'));var express=require(_0x4da1('0x4'));var router=express[_0x4da1('0x5')]();var fs_extra=require(_0x4da1('0x6'));var auth=require(_0x4da1('0x7'));var interaction=require(_0x4da1('0x8'));var config=require(_0x4da1('0x9'));var controller=require(_0x4da1('0xa'));router['get']('/',auth[_0x4da1('0xb')](),controller[_0x4da1('0xc')]);router['get'](_0x4da1('0xd'),auth[_0x4da1('0xb')](),controller[_0x4da1('0xe')]);router[_0x4da1('0xf')](_0x4da1('0x10'),auth['isAuthenticated'](),controller[_0x4da1('0x11')]);router['post']('/',auth[_0x4da1('0xb')](),controller[_0x4da1('0x12')]);router[_0x4da1('0x13')]('/:id',auth[_0x4da1('0xb')](),controller[_0x4da1('0x14')]);router['delete'](_0x4da1('0xd'),auth[_0x4da1('0xb')](),controller[_0x4da1('0x15')]);module[_0x4da1('0x16')]=router; \ No newline at end of file +var _0x7847=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x540f7c,_0x2854cf){var _0x49dc8e=function(_0x308e6f){while(--_0x308e6f){_0x540f7c['push'](_0x540f7c['shift']());}};_0x49dc8e(++_0x2854cf);}(_0x7847,0xf9));var _0x7784=function(_0x21057f,_0x4e3b82){_0x21057f=_0x21057f-0x0;var _0x1e2c77=_0x7847[_0x21057f];return _0x1e2c77;};'use strict';var multer=require(_0x7784('0x0'));var util=require(_0x7784('0x1'));var path=require(_0x7784('0x2'));var timeout=require(_0x7784('0x3'));var express=require('express');var router=express[_0x7784('0x4')]();var fs_extra=require(_0x7784('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7784('0x6'));var config=require(_0x7784('0x7'));var controller=require(_0x7784('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7784('0x9')]('/:id',auth[_0x7784('0xa')](),controller['show']);router[_0x7784('0x9')](_0x7784('0xb'),auth['isAuthenticated'](),controller[_0x7784('0xc')]);router[_0x7784('0xd')]('/',auth[_0x7784('0xa')](),controller[_0x7784('0xe')]);router[_0x7784('0xf')](_0x7784('0x10'),auth[_0x7784('0xa')](),controller[_0x7784('0x11')]);router[_0x7784('0x12')](_0x7784('0x10'),auth[_0x7784('0xa')](),controller[_0x7784('0x13')]);module[_0x7784('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 9a316c4..fccf65b 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 _0xd30f=['default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','days','csv','pdf','xlsx','custom'];(function(_0x3f5330,_0x362afa){var _0x17c626=function(_0x1274a8){while(--_0x1274a8){_0x3f5330['push'](_0x3f5330['shift']());}};_0x17c626(++_0x362afa);}(_0xd30f,0x1dd));var _0xfd30=function(_0x4b5bbc,_0x3c3b52){_0x4b5bbc=_0x4b5bbc-0x0;var _0x4d3691=_0xd30f[_0x4b5bbc];return _0x4d3691;};'use strict';var Sequelize=require('sequelize');module[_0xfd30('0x0')]={'name':{'type':Sequelize[_0xfd30('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfd30('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfd30('0x1')],'allowNull':![],'defaultValue':_0xfd30('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd30('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0x7'),_0xfd30('0x8'),_0xfd30('0x9'),_0xfd30('0xa'),'days',_0xfd30('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xfd30('0xc')},'output':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0xd'),_0xfd30('0xe'),_0xfd30('0xf')),'allowNull':![],'defaultValue':_0xfd30('0xd')},'type':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0x10'),_0xfd30('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xfd30('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd30('0x12')]},'bcc':{'type':Sequelize[_0xfd30('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xfd30('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbd42=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default','custom','TEXT'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0xbd42,0xa8));var _0x2bd4=function(_0x4e53f3,_0x46a9e3){_0x4e53f3=_0x4e53f3-0x0;var _0x4273d4=_0xbd42[_0x4e53f3];return _0x4273d4;};'use strict';var Sequelize=require(_0x2bd4('0x0'));module[_0x2bd4('0x1')]={'name':{'type':Sequelize[_0x2bd4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2bd4('0x2')]},'active':{'type':Sequelize[_0x2bd4('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2bd4('0x2')],'allowNull':![],'defaultValue':_0x2bd4('0x4')},'startAt':{'type':Sequelize[_0x2bd4('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2bd4('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2bd4('0x7')](_0x2bd4('0x8'),_0x2bd4('0x9'),_0x2bd4('0xa'),_0x2bd4('0xb'),_0x2bd4('0xc'),_0x2bd4('0xd'),_0x2bd4('0xe')),'allowNull':![],'defaultValue':_0x2bd4('0xc')},'output':{'type':Sequelize['ENUM'](_0x2bd4('0xf'),_0x2bd4('0x10'),_0x2bd4('0x11')),'allowNull':![],'defaultValue':_0x2bd4('0xf')},'type':{'type':Sequelize[_0x2bd4('0x7')]('custom',_0x2bd4('0x12')),'allowNull':![],'defaultValue':_0x2bd4('0x13')},'sendMail':{'type':Sequelize[_0x2bd4('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2bd4('0x14')]},'bcc':{'type':Sequelize[_0x2bd4('0x14')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index df4d59a..93e93d7 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 _0x74ca=['undefined','count','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x74ca,0x137));var _0xa74c=function(_0x363c19,_0x292992){_0x363c19=_0x363c19-0x0;var _0x1e6de3=_0x74ca[_0x363c19];return _0x1e6de3;};'use strict';var emlformat=require(_0xa74c('0x0'));var rimraf=require(_0xa74c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa74c('0x2'));var rp=require(_0xa74c('0x3'));var moment=require('moment');var BPromise=require(_0xa74c('0x4'));var Mustache=require(_0xa74c('0x5'));var util=require(_0xa74c('0x6'));var path=require(_0xa74c('0x7'));var sox=require(_0xa74c('0x8'));var csv=require(_0xa74c('0x9'));var ejs=require(_0xa74c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa74c('0xb'));var squel=require(_0xa74c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa74c('0xd'));var toCsv=require(_0xa74c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa74c('0xe'));var authService=require(_0xa74c('0xf'));var qs=require(_0xa74c('0x10'));var as=require(_0xa74c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa74c('0x12'))(_0xa74c('0x13'));var utils=require(_0xa74c('0x14'));var config=require(_0xa74c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa74c('0x16'))['db'];function respondWithStatusCode(_0x466481,_0x4f3b9b){_0x4f3b9b=_0x4f3b9b||0xcc;return function(_0xee2ca8){if(_0xee2ca8){return _0x466481[_0xa74c('0x17')](_0x4f3b9b);}return _0x466481[_0xa74c('0x18')](_0x4f3b9b)[_0xa74c('0x19')]();};}function respondWithResult(_0x333c83,_0x27a3a9){_0x27a3a9=_0x27a3a9||0xc8;return function(_0x17c04a){if(_0x17c04a){return _0x333c83[_0xa74c('0x18')](_0x27a3a9)[_0xa74c('0x1a')](_0x17c04a);}};}function respondWithFilteredResult(_0x337174,_0x4ff040){return function(_0x1b591b){if(_0x1b591b){var _0x65dcbe=typeof _0x4ff040[_0xa74c('0x1b')]==='undefined'&&typeof _0x4ff040[_0xa74c('0x1c')]===_0xa74c('0x1d');var _0x347dfd=_0x1b591b['count'];var _0x599d5e=_0x65dcbe?0x0:_0x4ff040[_0xa74c('0x1b')];var _0x286ef8=_0x65dcbe?_0x1b591b[_0xa74c('0x1e')]:_0x4ff040[_0xa74c('0x1b')]+_0x4ff040[_0xa74c('0x1c')];var _0x173375;if(_0x286ef8>=_0x347dfd){_0x286ef8=_0x347dfd;_0x173375=0xc8;}else{_0x173375=0xce;}_0x337174[_0xa74c('0x18')](_0x173375);return _0x337174['set']('Content-Range',_0x599d5e+'-'+_0x286ef8+'/'+_0x347dfd)[_0xa74c('0x1a')](_0x1b591b);}return null;};}function patchUpdates(_0x4ff9fd){return function(_0x47ce93){try{jsonpatch[_0xa74c('0x1f')](_0x47ce93,_0x4ff9fd,!![]);}catch(_0x47d6ea){return BPromise[_0xa74c('0x20')](_0x47d6ea);}return _0x47ce93[_0xa74c('0x21')]();};}function saveUpdates(_0x135a76,_0x24107f){return function(_0x2ebdbb){if(_0x2ebdbb){return _0x2ebdbb[_0xa74c('0x22')](_0x135a76)[_0xa74c('0x23')](function(_0x475c60){return _0x475c60;});}return null;};}function removeEntity(_0x4968e0,_0x1860f6){return function(_0x26c753){if(_0x26c753){return _0x26c753[_0xa74c('0x24')]()[_0xa74c('0x23')](function(){var _0x44e601=_0x26c753['get']({'plain':!![]});var _0x1f6dd0=_0xa74c('0x25');return db[_0xa74c('0x26')][_0xa74c('0x24')]({'where':{'type':_0x1f6dd0,'resourceId':_0x44e601['id']}})[_0xa74c('0x23')](function(){return _0x26c753;});})['then'](function(){_0x4968e0[_0xa74c('0x18')](0xcc)[_0xa74c('0x19')]();});}};}function handleEntityNotFound(_0x422ebb,_0x4cea53){return function(_0x5698e4){if(!_0x5698e4){_0x422ebb['sendStatus'](0x194);}return _0x5698e4;};}function handleError(_0x48ac0f,_0x4ed1a5){_0x4ed1a5=_0x4ed1a5||0x1f4;return function(_0xb4b5a0){logger[_0xa74c('0x27')](_0xb4b5a0[_0xa74c('0x28')]);if(_0xb4b5a0[_0xa74c('0x29')]){delete _0xb4b5a0[_0xa74c('0x29')];}_0x48ac0f[_0xa74c('0x18')](_0x4ed1a5)[_0xa74c('0x2a')](_0xb4b5a0);};}exports[_0xa74c('0x2b')]=function(_0x56bdf3,_0x573ec5){var _0x29d149={},_0x59b5b0={},_0x409bbf={'count':0x0,'rows':[]};var _0x4b1c8b=_['map'](db[_0xa74c('0x2c')]['rawAttributes'],function(_0x18cba6){return{'name':_0x18cba6['fieldName'],'type':_0x18cba6[_0xa74c('0x2d')][_0xa74c('0x2e')]};});_0x59b5b0[_0xa74c('0x2f')]=_[_0xa74c('0x30')](_0x4b1c8b,'name');_0x59b5b0[_0xa74c('0x31')]=_[_0xa74c('0x32')](_0x56bdf3[_0xa74c('0x31')]);_0x59b5b0[_0xa74c('0x33')]=_[_0xa74c('0x34')](_0x59b5b0[_0xa74c('0x2f')],_0x59b5b0['query']);_0x29d149['attributes']=_[_0xa74c('0x34')](_0x59b5b0[_0xa74c('0x2f')],qs[_0xa74c('0x35')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x35')]));_0x29d149['attributes']=_0x29d149[_0xa74c('0x36')]['length']?_0x29d149[_0xa74c('0x36')]:_0x59b5b0[_0xa74c('0x2f')];if(!_0x56bdf3['query'][_0xa74c('0x37')](_0xa74c('0x38'))){_0x29d149[_0xa74c('0x1c')]=qs[_0xa74c('0x1c')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x1c')]);_0x29d149['offset']=qs[_0xa74c('0x1b')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x1b')]);}_0x29d149[_0xa74c('0x39')]=qs[_0xa74c('0x3a')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x3a')]);_0x29d149[_0xa74c('0x3b')]=qs[_0xa74c('0x33')](_[_0xa74c('0x3c')](_0x56bdf3[_0xa74c('0x31')],_0x59b5b0['filters']),_0x4b1c8b);if(_0x56bdf3['query'][_0xa74c('0x3d')]){_0x29d149['where']=_[_0xa74c('0x3e')](_0x29d149['where'],{'$or':_[_0xa74c('0x30')](_0x4b1c8b,function(_0x14b377){if(_0x14b377[_0xa74c('0x2d')]!==_0xa74c('0x3f')){var _0x1221c7={};_0x1221c7[_0x14b377[_0xa74c('0x29')]]={'$like':'%'+_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x3d')]+'%'};return _0x1221c7;}})});}_0x29d149=_[_0xa74c('0x3e')]({},_0x29d149,_0x56bdf3[_0xa74c('0x40')]);var _0x731f36={'where':_0x29d149[_0xa74c('0x3b')]};return db[_0xa74c('0x2c')][_0xa74c('0x1e')](_0x731f36)['then'](function(_0x16cf5d){_0x409bbf[_0xa74c('0x1e')]=_0x16cf5d;if(_0x56bdf3['query']['includeAll']){_0x29d149[_0xa74c('0x41')]=[{'all':!![]}];}return db[_0xa74c('0x2c')]['findAll'](_0x29d149);})[_0xa74c('0x23')](function(_0x436aab){_0x409bbf[_0xa74c('0x42')]=_0x436aab;return _0x409bbf;})[_0xa74c('0x23')](respondWithFilteredResult(_0x573ec5,_0x29d149))['catch'](handleError(_0x573ec5,null));};exports[_0xa74c('0x43')]=function(_0x4ae230,_0x30e5f9){var _0x58fe69={'raw':![],'where':{'id':_0x4ae230['params']['id']}},_0x25febf={};_0x25febf['model']=_[_0xa74c('0x32')](db[_0xa74c('0x2c')][_0xa74c('0x44')]);_0x25febf[_0xa74c('0x31')]=_[_0xa74c('0x32')](_0x4ae230['query']);_0x25febf[_0xa74c('0x33')]=_['intersection'](_0x25febf[_0xa74c('0x2f')],_0x25febf['query']);_0x58fe69[_0xa74c('0x36')]=_[_0xa74c('0x34')](_0x25febf[_0xa74c('0x2f')],qs[_0xa74c('0x35')](_0x4ae230[_0xa74c('0x31')][_0xa74c('0x35')]));_0x58fe69['attributes']=_0x58fe69['attributes'][_0xa74c('0x45')]?_0x58fe69[_0xa74c('0x36')]:_0x25febf[_0xa74c('0x2f')];if(_0x4ae230[_0xa74c('0x31')][_0xa74c('0x46')]){_0x58fe69[_0xa74c('0x41')]=[{'all':!![]}];}_0x58fe69=_[_0xa74c('0x3e')]({},_0x58fe69,_0x4ae230[_0xa74c('0x40')]);return db[_0xa74c('0x2c')][_0xa74c('0x47')](_0x58fe69)[_0xa74c('0x23')](handleEntityNotFound(_0x30e5f9,null))[_0xa74c('0x23')](respondWithResult(_0x30e5f9,null))['catch'](handleError(_0x30e5f9,null));};exports[_0xa74c('0x48')]=function(_0x55cf70,_0x5f48a1){return db[_0xa74c('0x2c')][_0xa74c('0x48')](_0x55cf70[_0xa74c('0x49')],{})[_0xa74c('0x23')](function(_0x38235a){var _0x13d4e6=_0x55cf70[_0xa74c('0x4a')][_0xa74c('0x4b')]({'plain':!![]});if(!_0x13d4e6)throw new Error(_0xa74c('0x4c'));if(_0x13d4e6[_0xa74c('0x4d')]==='user'){var _0x3a86a5=_0x38235a['get']({'plain':!![]});var _0x593579=_0xa74c('0x25');return db[_0xa74c('0x4e')][_0xa74c('0x47')]({'where':{'name':_0x593579,'userProfileId':_0x13d4e6[_0xa74c('0x4f')]},'raw':!![]})[_0xa74c('0x23')](function(_0x1e2690){if(_0x1e2690&&_0x1e2690[_0xa74c('0x50')]===0x0){return db['UserProfileResource'][_0xa74c('0x48')]({'name':_0x3a86a5[_0xa74c('0x29')],'resourceId':_0x3a86a5['id'],'type':_0x1e2690['name'],'sectionId':_0x1e2690['id']},{})['then'](function(){return _0x38235a;});}else{return _0x38235a;}})[_0xa74c('0x51')](function(_0x5882d9){logger[_0xa74c('0x27')](_0xa74c('0x52'),_0x5882d9);throw _0x5882d9;});}return _0x38235a;})[_0xa74c('0x23')](respondWithResult(_0x5f48a1,0xc9))[_0xa74c('0x51')](handleError(_0x5f48a1,null));};exports[_0xa74c('0x22')]=function(_0x475538,_0x44f724){if(_0x475538['body']['id']){delete _0x475538[_0xa74c('0x49')]['id'];}return db['Schedule'][_0xa74c('0x47')]({'where':{'id':_0x475538['params']['id']}})[_0xa74c('0x23')](handleEntityNotFound(_0x44f724,null))[_0xa74c('0x23')](saveUpdates(_0x475538[_0xa74c('0x49')],null))[_0xa74c('0x23')](respondWithResult(_0x44f724,null))[_0xa74c('0x51')](handleError(_0x44f724,null));};exports['destroy']=function(_0x652ed5,_0x5695b1){return db['Schedule']['find']({'where':{'id':_0x652ed5[_0xa74c('0x53')]['id']}})['then'](handleEntityNotFound(_0x5695b1,null))[_0xa74c('0x23')](removeEntity(_0x5695b1,null))[_0xa74c('0x51')](handleError(_0x5695b1,null));};exports['run']=function(_0x1a6e71,_0xc82d8f,_0x22ec12){var _0x3596dd=require('../../config/schedule');return db['Schedule'][_0xa74c('0x47')]({'where':{'id':_0x1a6e71[_0xa74c('0x53')]['id']},'raw':!![]})[_0xa74c('0x23')](handleEntityNotFound(_0xc82d8f,null))['then'](function(){_0x3596dd[_0xa74c('0x54')](_0x1a6e71[_0xa74c('0x53')]['id']);})[_0xa74c('0x23')](respondWithStatusCode(_0xc82d8f,null))[_0xa74c('0x51')](handleError(_0xc82d8f,null));}; \ No newline at end of file +var _0x31da=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','name','send','index','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Schedule','includeAll','include','rows','catch','keys','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','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x414834,_0x346280){var _0x697f02=function(_0x309212){while(--_0x309212){_0x414834['push'](_0x414834['shift']());}};_0x697f02(++_0x346280);}(_0x31da,0x1f4));var _0xa31d=function(_0x95b4a8,_0x3c1c28){_0x95b4a8=_0x95b4a8-0x0;var _0x563671=_0x31da[_0x95b4a8];return _0x563671;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa31d('0x0'));var zipdir=require(_0xa31d('0x1'));var jsonpatch=require(_0xa31d('0x2'));var rp=require(_0xa31d('0x3'));var moment=require(_0xa31d('0x4'));var BPromise=require(_0xa31d('0x5'));var Mustache=require(_0xa31d('0x6'));var util=require(_0xa31d('0x7'));var path=require(_0xa31d('0x8'));var sox=require(_0xa31d('0x9'));var csv=require(_0xa31d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa31d('0xb'));var _=require(_0xa31d('0xc'));var squel=require(_0xa31d('0xd'));var crypto=require(_0xa31d('0xe'));var jsforce=require(_0xa31d('0xf'));var deskjs=require(_0xa31d('0x10'));var toCsv=require(_0xa31d('0xa'));var querystring=require(_0xa31d('0x11'));var Papa=require('papaparse');var Redis=require(_0xa31d('0x12'));var authService=require(_0xa31d('0x13'));var qs=require(_0xa31d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa31d('0x15'))(_0xa31d('0x16'));var utils=require(_0xa31d('0x17'));var config=require(_0xa31d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa31d('0x19'))['db'];function respondWithStatusCode(_0x2598f2,_0x56157d){_0x56157d=_0x56157d||0xcc;return function(_0x174f1f){if(_0x174f1f){return _0x2598f2[_0xa31d('0x1a')](_0x56157d);}return _0x2598f2[_0xa31d('0x1b')](_0x56157d)[_0xa31d('0x1c')]();};}function respondWithResult(_0x2c0887,_0x5c35bb){_0x5c35bb=_0x5c35bb||0xc8;return function(_0x1075fe){if(_0x1075fe){return _0x2c0887['status'](_0x5c35bb)[_0xa31d('0x1d')](_0x1075fe);}};}function respondWithFilteredResult(_0x23eaa1,_0x28760f){return function(_0x4b05b2){if(_0x4b05b2){var _0x593b54=typeof _0x28760f[_0xa31d('0x1e')]===_0xa31d('0x1f')&&typeof _0x28760f['limit']===_0xa31d('0x1f');var _0x5a093e=_0x4b05b2[_0xa31d('0x20')];var _0x31a2ab=_0x593b54?0x0:_0x28760f['offset'];var _0x1bf388=_0x593b54?_0x4b05b2[_0xa31d('0x20')]:_0x28760f[_0xa31d('0x1e')]+_0x28760f[_0xa31d('0x21')];var _0x45cb08;if(_0x1bf388>=_0x5a093e){_0x1bf388=_0x5a093e;_0x45cb08=0xc8;}else{_0x45cb08=0xce;}_0x23eaa1[_0xa31d('0x1b')](_0x45cb08);return _0x23eaa1[_0xa31d('0x22')](_0xa31d('0x23'),_0x31a2ab+'-'+_0x1bf388+'/'+_0x5a093e)[_0xa31d('0x1d')](_0x4b05b2);}return null;};}function patchUpdates(_0x534512){return function(_0x5101da){try{jsonpatch[_0xa31d('0x24')](_0x5101da,_0x534512,!![]);}catch(_0x49cb39){return BPromise[_0xa31d('0x25')](_0x49cb39);}return _0x5101da['save']();};}function saveUpdates(_0x5ec410,_0x596a93){return function(_0x271c23){if(_0x271c23){return _0x271c23[_0xa31d('0x26')](_0x5ec410)[_0xa31d('0x27')](function(_0x535bb6){return _0x535bb6;});}return null;};}function removeEntity(_0x542a18,_0x38673a){return function(_0xcb720d){if(_0xcb720d){return _0xcb720d[_0xa31d('0x28')]()[_0xa31d('0x27')](function(){var _0x547070=_0xcb720d[_0xa31d('0x29')]({'plain':!![]});var _0x173bbd=_0xa31d('0x2a');return db[_0xa31d('0x2b')]['destroy']({'where':{'type':_0x173bbd,'resourceId':_0x547070['id']}})[_0xa31d('0x27')](function(){return _0xcb720d;});})[_0xa31d('0x27')](function(){_0x542a18[_0xa31d('0x1b')](0xcc)[_0xa31d('0x1c')]();});}};}function handleEntityNotFound(_0x355d87,_0x46861e){return function(_0x10df60){if(!_0x10df60){_0x355d87['sendStatus'](0x194);}return _0x10df60;};}function handleError(_0x500327,_0x15f906){_0x15f906=_0x15f906||0x1f4;return function(_0x3a8aaa){logger[_0xa31d('0x2c')](_0x3a8aaa['stack']);if(_0x3a8aaa['name']){delete _0x3a8aaa[_0xa31d('0x2d')];}_0x500327[_0xa31d('0x1b')](_0x15f906)[_0xa31d('0x2e')](_0x3a8aaa);};}exports[_0xa31d('0x2f')]=function(_0x22a245,_0x27a075){var _0x3a373e={},_0x1f6e3f={},_0x40fe70={'count':0x0,'rows':[]};var _0x51aa97=_['map'](db['Schedule']['rawAttributes'],function(_0x42f661){return{'name':_0x42f661['fieldName'],'type':_0x42f661[_0xa31d('0x30')][_0xa31d('0x31')]};});_0x1f6e3f[_0xa31d('0x32')]=_[_0xa31d('0x33')](_0x51aa97,_0xa31d('0x2d'));_0x1f6e3f['query']=_['keys'](_0x22a245[_0xa31d('0x34')]);_0x1f6e3f[_0xa31d('0x35')]=_[_0xa31d('0x36')](_0x1f6e3f[_0xa31d('0x32')],_0x1f6e3f[_0xa31d('0x34')]);_0x3a373e[_0xa31d('0x37')]=_[_0xa31d('0x36')](_0x1f6e3f['model'],qs[_0xa31d('0x38')](_0x22a245[_0xa31d('0x34')]['fields']));_0x3a373e['attributes']=_0x3a373e[_0xa31d('0x37')][_0xa31d('0x39')]?_0x3a373e[_0xa31d('0x37')]:_0x1f6e3f[_0xa31d('0x32')];if(!_0x22a245[_0xa31d('0x34')]['hasOwnProperty'](_0xa31d('0x3a'))){_0x3a373e[_0xa31d('0x21')]=qs[_0xa31d('0x21')](_0x22a245[_0xa31d('0x34')][_0xa31d('0x21')]);_0x3a373e['offset']=qs[_0xa31d('0x1e')](_0x22a245[_0xa31d('0x34')][_0xa31d('0x1e')]);}_0x3a373e[_0xa31d('0x3b')]=qs[_0xa31d('0x3c')](_0x22a245[_0xa31d('0x34')][_0xa31d('0x3c')]);_0x3a373e[_0xa31d('0x3d')]=qs['filters'](_[_0xa31d('0x3e')](_0x22a245[_0xa31d('0x34')],_0x1f6e3f[_0xa31d('0x35')]),_0x51aa97);if(_0x22a245['query']['filter']){_0x3a373e[_0xa31d('0x3d')]=_[_0xa31d('0x3f')](_0x3a373e[_0xa31d('0x3d')],{'$or':_[_0xa31d('0x33')](_0x51aa97,function(_0xd4b65d){if(_0xd4b65d['type']!==_0xa31d('0x40')){var _0x40e96e={};_0x40e96e[_0xd4b65d[_0xa31d('0x2d')]]={'$like':'%'+_0x22a245[_0xa31d('0x34')][_0xa31d('0x41')]+'%'};return _0x40e96e;}})});}_0x3a373e=_[_0xa31d('0x3f')]({},_0x3a373e,_0x22a245[_0xa31d('0x42')]);var _0x233d45={'where':_0x3a373e[_0xa31d('0x3d')]};return db[_0xa31d('0x43')][_0xa31d('0x20')](_0x233d45)[_0xa31d('0x27')](function(_0x3ebc16){_0x40fe70[_0xa31d('0x20')]=_0x3ebc16;if(_0x22a245[_0xa31d('0x34')][_0xa31d('0x44')]){_0x3a373e[_0xa31d('0x45')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x3a373e);})[_0xa31d('0x27')](function(_0x306b57){_0x40fe70[_0xa31d('0x46')]=_0x306b57;return _0x40fe70;})['then'](respondWithFilteredResult(_0x27a075,_0x3a373e))[_0xa31d('0x47')](handleError(_0x27a075,null));};exports['show']=function(_0x19207e,_0x5ae006){var _0x1211ea={'raw':![],'where':{'id':_0x19207e['params']['id']}},_0x491524={};_0x491524[_0xa31d('0x32')]=_['keys'](db[_0xa31d('0x43')]['rawAttributes']);_0x491524[_0xa31d('0x34')]=_[_0xa31d('0x48')](_0x19207e[_0xa31d('0x34')]);_0x491524['filters']=_[_0xa31d('0x36')](_0x491524[_0xa31d('0x32')],_0x491524[_0xa31d('0x34')]);_0x1211ea['attributes']=_['intersection'](_0x491524[_0xa31d('0x32')],qs[_0xa31d('0x38')](_0x19207e[_0xa31d('0x34')][_0xa31d('0x38')]));_0x1211ea[_0xa31d('0x37')]=_0x1211ea[_0xa31d('0x37')]['length']?_0x1211ea[_0xa31d('0x37')]:_0x491524[_0xa31d('0x32')];if(_0x19207e[_0xa31d('0x34')][_0xa31d('0x44')]){_0x1211ea[_0xa31d('0x45')]=[{'all':!![]}];}_0x1211ea=_[_0xa31d('0x3f')]({},_0x1211ea,_0x19207e['options']);return db[_0xa31d('0x43')][_0xa31d('0x49')](_0x1211ea)[_0xa31d('0x27')](handleEntityNotFound(_0x5ae006,null))['then'](respondWithResult(_0x5ae006,null))['catch'](handleError(_0x5ae006,null));};exports[_0xa31d('0x4a')]=function(_0x7ab9b3,_0x14c402){return db['Schedule'][_0xa31d('0x4a')](_0x7ab9b3['body'],{})[_0xa31d('0x27')](function(_0x18e951){var _0x4d1a3b=_0x7ab9b3[_0xa31d('0x4b')][_0xa31d('0x29')]({'plain':!![]});if(!_0x4d1a3b)throw new Error(_0xa31d('0x4c'));if(_0x4d1a3b[_0xa31d('0x4d')]===_0xa31d('0x4b')){var _0x110678=_0x18e951[_0xa31d('0x29')]({'plain':!![]});var _0x756779=_0xa31d('0x2a');return db[_0xa31d('0x4e')][_0xa31d('0x49')]({'where':{'name':_0x756779,'userProfileId':_0x4d1a3b[_0xa31d('0x4f')]},'raw':!![]})['then'](function(_0x32f77f){if(_0x32f77f&&_0x32f77f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x110678[_0xa31d('0x2d')],'resourceId':_0x110678['id'],'type':_0x32f77f[_0xa31d('0x2d')],'sectionId':_0x32f77f['id']},{})[_0xa31d('0x27')](function(){return _0x18e951;});}else{return _0x18e951;}})[_0xa31d('0x47')](function(_0x1160f2){logger[_0xa31d('0x2c')](_0xa31d('0x50'),_0x1160f2);throw _0x1160f2;});}return _0x18e951;})[_0xa31d('0x27')](respondWithResult(_0x14c402,0xc9))[_0xa31d('0x47')](handleError(_0x14c402,null));};exports[_0xa31d('0x26')]=function(_0x4bebe0,_0x3a1367){if(_0x4bebe0['body']['id']){delete _0x4bebe0[_0xa31d('0x51')]['id'];}return db[_0xa31d('0x43')][_0xa31d('0x49')]({'where':{'id':_0x4bebe0['params']['id']}})['then'](handleEntityNotFound(_0x3a1367,null))[_0xa31d('0x27')](saveUpdates(_0x4bebe0[_0xa31d('0x51')],null))[_0xa31d('0x27')](respondWithResult(_0x3a1367,null))[_0xa31d('0x47')](handleError(_0x3a1367,null));};exports[_0xa31d('0x28')]=function(_0x42142d,_0x149760){return db['Schedule'][_0xa31d('0x49')]({'where':{'id':_0x42142d[_0xa31d('0x52')]['id']}})[_0xa31d('0x27')](handleEntityNotFound(_0x149760,null))[_0xa31d('0x27')](removeEntity(_0x149760,null))['catch'](handleError(_0x149760,null));};exports[_0xa31d('0x53')]=function(_0x1e6b87,_0x57ff2f,_0x3874c9){var _0x26b2ea=require(_0xa31d('0x54'));return db[_0xa31d('0x43')][_0xa31d('0x49')]({'where':{'id':_0x1e6b87[_0xa31d('0x52')]['id']},'raw':!![]})[_0xa31d('0x27')](handleEntityNotFound(_0x57ff2f,null))[_0xa31d('0x27')](function(){_0x26b2ea[_0xa31d('0x53')](_0x1e6b87[_0xa31d('0x52')]['id']);})['then'](respondWithStatusCode(_0x57ff2f,null))[_0xa31d('0x47')](handleError(_0x57ff2f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c3ba250..5340d35 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 _0x72f6=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','util'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x72f6,0xf9));var _0x672f=function(_0x490beb,_0x245514){_0x490beb=_0x490beb-0x0;var _0x12e6f4=_0x72f6[_0x490beb];return _0x12e6f4;};'use strict';var _=require('lodash');var util=require(_0x672f('0x0'));var logger=require(_0x672f('0x1'))(_0x672f('0x2'));var moment=require('moment');var BPromise=require(_0x672f('0x3'));var rp=require(_0x672f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x672f('0x5'));var config=require(_0x672f('0x6'));var attributes=require(_0x672f('0x7'));module['exports']=function(_0x306b0c,_0x463bb7){return _0x306b0c[_0x672f('0x8')]('Schedule',attributes,{'tableName':_0x672f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8382=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','util'];(function(_0x493c8f,_0xdfd05){var _0x45722c=function(_0x4dc8f5){while(--_0x4dc8f5){_0x493c8f['push'](_0x493c8f['shift']());}};_0x45722c(++_0xdfd05);}(_0x8382,0x8e));var _0x2838=function(_0x98062e,_0x29e3dc){_0x98062e=_0x98062e-0x0;var _0x45d9c8=_0x8382[_0x98062e];return _0x45d9c8;};'use strict';var _=require('lodash');var util=require(_0x2838('0x0'));var logger=require(_0x2838('0x1'))(_0x2838('0x2'));var moment=require('moment');var BPromise=require(_0x2838('0x3'));var rp=require(_0x2838('0x4'));var fs=require('fs');var path=require(_0x2838('0x5'));var rimraf=require(_0x2838('0x6'));var config=require(_0x2838('0x7'));var attributes=require(_0x2838('0x8'));module['exports']=function(_0x26410b,_0x5f104d){return _0x26410b[_0x2838('0x9')]('Schedule',attributes,{'tableName':_0x2838('0xa'),'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 49eb9c8..e18e390 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 _0xced4=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment'];(function(_0xf38064,_0xcbe11c){var _0x42f37c=function(_0x56b1b7){while(--_0x56b1b7){_0xf38064['push'](_0xf38064['shift']());}};_0x42f37c(++_0xcbe11c);}(_0xced4,0x1a0));var _0x4ced=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xced4[_0x3181cc];return _0x547a4a;};'use strict';var _=require(_0x4ced('0x0'));var util=require('util');var moment=require(_0x4ced('0x1'));var BPromise=require(_0x4ced('0x2'));var rs=require(_0x4ced('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ced('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ced('0x5'))(_0x4ced('0x6'));var config=require(_0x4ced('0x7'));var jayson=require(_0x4ced('0x8'));var client=jayson[_0x4ced('0x9')][_0x4ced('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443907,_0xc8e201,_0x3d5b1d){return new BPromise(function(_0x244375,_0x5eed1d){return client[_0x4ced('0xb')](_0x443907,_0x3d5b1d)[_0x4ced('0xc')](function(_0x1f705c){logger[_0x4ced('0xd')](_0x4ced('0xe'),_0xc8e201,'request\x20sent');logger['debug'](_0x4ced('0xf'),_0xc8e201,_0x4ced('0x10'),JSON[_0x4ced('0x11')](_0x1f705c));if(_0x1f705c[_0x4ced('0x12')]){if(_0x1f705c[_0x4ced('0x12')]['code']===0x1f4){logger[_0x4ced('0x12')](_0x4ced('0xe'),_0xc8e201,_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);return _0x5eed1d(_0x1f705c[_0x4ced('0x12')]['message']);}logger['error'](_0x4ced('0xe'),_0xc8e201,_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);return _0x244375(_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);}else{logger[_0x4ced('0xd')]('Schedule,\x20%s,\x20%s',_0xc8e201,_0x4ced('0x10'));_0x244375(_0x1f705c[_0x4ced('0x14')][_0x4ced('0x13')]);}})[_0x4ced('0x15')](function(_0x3fe628){logger[_0x4ced('0x12')](_0x4ced('0xe'),_0xc8e201,_0x3fe628);_0x5eed1d(_0x3fe628);});});} \ No newline at end of file +var _0x9f9d=['info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5874c2,_0x5b61a4){var _0x4cab66=function(_0x172f24){while(--_0x172f24){_0x5874c2['push'](_0x5874c2['shift']());}};_0x4cab66(++_0x5b61a4);}(_0x9f9d,0xc2));var _0xd9f9=function(_0x5254b1,_0x471ede){_0x5254b1=_0x5254b1-0x0;var _0xfaddd4=_0x9f9d[_0x5254b1];return _0xfaddd4;};'use strict';var _=require(_0xd9f9('0x0'));var util=require(_0xd9f9('0x1'));var moment=require(_0xd9f9('0x2'));var BPromise=require(_0xd9f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9f9('0x4'));var db=require(_0xd9f9('0x5'))['db'];var utils=require(_0xd9f9('0x6'));var logger=require('../../config/logger')(_0xd9f9('0x7'));var config=require(_0xd9f9('0x8'));var jayson=require(_0xd9f9('0x9'));var client=jayson[_0xd9f9('0xa')][_0xd9f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x268a8d,_0x27899a,_0x5c1dd4){return new BPromise(function(_0x69a491,_0x10f7b2){return client['request'](_0x268a8d,_0x5c1dd4)[_0xd9f9('0xc')](function(_0x4e3437){logger[_0xd9f9('0xd')](_0xd9f9('0xe'),_0x27899a,_0xd9f9('0xf'));logger['debug'](_0xd9f9('0x10'),_0x27899a,_0xd9f9('0xf'),JSON[_0xd9f9('0x11')](_0x4e3437));if(_0x4e3437[_0xd9f9('0x12')]){if(_0x4e3437[_0xd9f9('0x12')][_0xd9f9('0x13')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x27899a,_0x4e3437[_0xd9f9('0x12')]['message']);return _0x10f7b2(_0x4e3437[_0xd9f9('0x12')][_0xd9f9('0x14')]);}logger[_0xd9f9('0x12')](_0xd9f9('0xe'),_0x27899a,_0x4e3437[_0xd9f9('0x12')][_0xd9f9('0x14')]);return _0x69a491(_0x4e3437[_0xd9f9('0x12')]['message']);}else{logger[_0xd9f9('0xd')](_0xd9f9('0xe'),_0x27899a,_0xd9f9('0xf'));_0x69a491(_0x4e3437[_0xd9f9('0x15')][_0xd9f9('0x14')]);}})[_0xd9f9('0x16')](function(_0x4a98be){logger[_0xd9f9('0x12')](_0xd9f9('0xe'),_0x27899a,_0x4a98be);_0x10f7b2(_0x4a98be);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e207ef3..e38eef3 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 _0x044d=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','post','update','delete'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x044d,0x1a9));var _0xd044=function(_0x4e115f,_0xbd4672){_0x4e115f=_0x4e115f-0x0;var _0x5c614d=_0x044d[_0x4e115f];return _0x5c614d;};'use strict';var multer=require(_0xd044('0x0'));var util=require('util');var path=require(_0xd044('0x1'));var timeout=require(_0xd044('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd044('0x3'));var auth=require(_0xd044('0x4'));var interaction=require(_0xd044('0x5'));var config=require(_0xd044('0x6'));var controller=require(_0xd044('0x7'));router[_0xd044('0x8')]('/',auth[_0xd044('0x9')](),controller['index']);router[_0xd044('0x8')](_0xd044('0xa'),auth['isAuthenticated'](),controller[_0xd044('0xb')]);router['get'](_0xd044('0xc'),auth[_0xd044('0x9')](),controller['show']);router[_0xd044('0x8')](_0xd044('0xd'),auth[_0xd044('0x9')](),controller['download']);router[_0xd044('0xe')]('/',auth[_0xd044('0x9')](),controller['create']);router['put'](_0xd044('0xc'),auth['isAuthenticated'](),controller[_0xd044('0xf')]);router[_0xd044('0x10')](_0xd044('0xc'),auth[_0xd044('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf815=['download','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download'];(function(_0x4fbace,_0x6012dc){var _0x1afb6f=function(_0x2bd975){while(--_0x2bd975){_0x4fbace['push'](_0x4fbace['shift']());}};_0x1afb6f(++_0x6012dc);}(_0xf815,0x1d4));var _0x5f81=function(_0x3138a4,_0x5235db){_0x3138a4=_0x3138a4-0x0;var _0x54e87f=_0xf815[_0x3138a4];return _0x54e87f;};'use strict';var multer=require(_0x5f81('0x0'));var util=require(_0x5f81('0x1'));var path=require(_0x5f81('0x2'));var timeout=require(_0x5f81('0x3'));var express=require('express');var router=express[_0x5f81('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f81('0x5'));var interaction=require(_0x5f81('0x6'));var config=require(_0x5f81('0x7'));var controller=require(_0x5f81('0x8'));router[_0x5f81('0x9')]('/',auth['isAuthenticated'](),controller[_0x5f81('0xa')]);router['get'](_0x5f81('0xb'),auth[_0x5f81('0xc')](),controller[_0x5f81('0xd')]);router['get'](_0x5f81('0xe'),auth[_0x5f81('0xc')](),controller['show']);router['get'](_0x5f81('0xf'),auth[_0x5f81('0xc')](),controller[_0x5f81('0x10')]);router[_0x5f81('0x11')]('/',auth[_0x5f81('0xc')](),controller['create']);router['put'](_0x5f81('0xe'),auth[_0x5f81('0xc')](),controller[_0x5f81('0x12')]);router[_0x5f81('0x13')](_0x5f81('0xe'),auth[_0x5f81('0xc')](),controller[_0x5f81('0x14')]);module[_0x5f81('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 15ddd8e..44391db 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 _0x3e94=['../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','createdAt','format','updatedAt','sequelize','moment'];(function(_0xffadfc,_0x29ab3a){var _0x2bc15a=function(_0x22fd74){while(--_0x22fd74){_0xffadfc['push'](_0xffadfc['shift']());}};_0x2bc15a(++_0x29ab3a);}(_0x3e94,0x67));var _0x43e9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3e94[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x43e9('0x0'));var moment=require(_0x43e9('0x1'));var path=require('path');var config=require(_0x43e9('0x2'));module[_0x43e9('0x3')]={'format':{'type':Sequelize[_0x43e9('0x4')],'get':function(){return this['getDataValue'](_0x43e9('0x5'))?path[_0x43e9('0x6')](this[_0x43e9('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x43e9('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x43e9('0x8')],'set':function(_0x4b35f1){var _0x1183a0=_0x4b35f1[_0x43e9('0x9')](/\\/g,'/');this[_0x43e9('0xa')]('value',_0x1183a0);}},'rating':{'type':Sequelize[_0x43e9('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x43e9('0xb')],'set':function(_0x43d6e8){this[_0x43e9('0xa')](_0x43e9('0xc'),moment()[_0x43e9('0xd')](_0x43d6e8,'ms'));this[_0x43e9('0xa')](_0x43e9('0xe'),moment());this[_0x43e9('0xa')]('duration',_0x43d6e8);}},'startedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0xc')))['format'](_0x43e9('0x10'))[_0x43e9('0x11')]();}},'closedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0xe')))['format']('MM-DD-YYYY\x20HH:mm')[_0x43e9('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0x12')))[_0x43e9('0x13')](_0x43e9('0x10'))[_0x43e9('0x11')]();}},'updatedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0x14')))[_0x43e9('0x13')](_0x43e9('0x10'))[_0x43e9('0x11')]();}}}; \ No newline at end of file +var _0x0a48=['exports','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','../../config/environment'];(function(_0x2f0d0f,_0x1512bb){var _0x252de9=function(_0x5cd67e){while(--_0x5cd67e){_0x2f0d0f['push'](_0x2f0d0f['shift']());}};_0x252de9(++_0x1512bb);}(_0x0a48,0x95));var _0x80a4=function(_0x51026e,_0x193bf5){_0x51026e=_0x51026e-0x0;var _0x5780d1=_0x0a48[_0x51026e];return _0x5780d1;};'use strict';var Sequelize=require(_0x80a4('0x0'));var moment=require(_0x80a4('0x1'));var path=require('path');var config=require(_0x80a4('0x2'));module[_0x80a4('0x3')]={'format':{'type':Sequelize[_0x80a4('0x4')],'get':function(){return this[_0x80a4('0x5')](_0x80a4('0x6'))?path['extname'](this['getDataValue'](_0x80a4('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x80a4('0x7')]},'channel':{'type':Sequelize[_0x80a4('0x7')]},'value':{'type':Sequelize[_0x80a4('0x7')],'set':function(_0x5f3ac0){var _0x3ccc33=_0x5f3ac0['replace'](/\\/g,'/');this[_0x80a4('0x8')](_0x80a4('0x6'),_0x3ccc33);}},'rating':{'type':Sequelize[_0x80a4('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5dfe4a){this[_0x80a4('0x8')](_0x80a4('0xa'),moment()[_0x80a4('0xb')](_0x5dfe4a,'ms'));this[_0x80a4('0x8')]('closedAt',moment());this[_0x80a4('0x8')]('duration',_0x5dfe4a);}},'startedAt':{'type':Sequelize[_0x80a4('0xc')],'get':function(){return moment(this['getDataValue'](_0x80a4('0xa')))[_0x80a4('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x80a4('0xe')]();}},'closedAt':{'type':Sequelize[_0x80a4('0xc')],'get':function(){return moment(this[_0x80a4('0x5')](_0x80a4('0xf')))[_0x80a4('0xd')](_0x80a4('0x10'))[_0x80a4('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x80a4('0x11')))[_0x80a4('0xd')](_0x80a4('0x10'))[_0x80a4('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x80a4('0x5')](_0x80a4('0x12')))[_0x80a4('0xd')](_0x80a4('0x10'))[_0x80a4('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 68dcbc0..c6adb5f 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 _0x425d=['include','findAll','rows','catch','show','params','length','includeAll','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x425d,0x1e0));var _0xd425=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x425d[_0x16e824];return _0x1745ea;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x36')](_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c')),['format']);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x185d7e[_0xd425('0x37')]);_0x24da23[_0xd425('0x39')]=_[_0xd425('0x3a')](_0x24da23['model'],_0x24da23[_0xd425('0x37')]);_0x37b63c[_0xd425('0x3b')]=_['intersection'](_0x24da23['model'],qs['fields'](_0x185d7e[_0xd425('0x37')][_0xd425('0x3c')]));_0x37b63c[_0xd425('0x3b')]=_0x37b63c[_0xd425('0x3b')]['length']?_0x37b63c[_0xd425('0x3b')]:_0x24da23[_0xd425('0x35')];if(!_0x185d7e[_0xd425('0x37')][_0xd425('0x3d')](_0xd425('0x3e'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e['query'][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e[_0xd425('0x37')][_0xd425('0x21')]);}_0x37b63c['order']=qs[_0xd425('0x3f')](_0x185d7e[_0xd425('0x37')][_0xd425('0x3f')]);_0x37b63c[_0xd425('0x40')]=qs['filters'](_[_0xd425('0x41')](_0x185d7e[_0xd425('0x37')],_0x24da23['filters']),_0x482ba6);if(_0x185d7e['query']['filter']){_0x37b63c[_0xd425('0x40')]=_[_0xd425('0x42')](_0x37b63c[_0xd425('0x40')],{'$or':_['map'](_0x482ba6,function(_0x4f8323){if(_0x4f8323['type']!==_0xd425('0x43')){var _0x3f9090={};_0x3f9090[_0x4f8323[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x37')][_0xd425('0x44')]+'%'};return _0x3f9090;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x45')]);var _0x4b922f={'where':_0x37b63c[_0xd425('0x40')]};return db[_0xd425('0x30')][_0xd425('0x24')](_0x4b922f)['then'](function(_0x3adc67){_0x1cac61[_0xd425('0x24')]=_0x3adc67;if(_0x185d7e[_0xd425('0x37')]['includeAll']){_0x37b63c[_0xd425('0x46')]=[{'all':!![]}];}return db[_0xd425('0x30')][_0xd425('0x47')](_0x37b63c);})[_0xd425('0x2a')](function(_0x5afd62){_0x1cac61[_0xd425('0x48')]=_0x5afd62;return _0x1cac61;})[_0xd425('0x2a')](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x49')](handleError(_0x2fd17a,null));};exports[_0xd425('0x4a')]=function(_0x3f24fb,_0x2f6bf7){var _0x2d799b={'raw':![],'where':{'id':_0x3f24fb[_0xd425('0x4b')]['id']}},_0x524fad={};_0x524fad[_0xd425('0x35')]=_['keys'](db[_0xd425('0x30')]['rawAttributes']);_0x524fad['query']=_[_0xd425('0x38')](_0x3f24fb['query']);_0x524fad[_0xd425('0x39')]=_['intersection'](_0x524fad[_0xd425('0x35')],_0x524fad[_0xd425('0x37')]);_0x2d799b[_0xd425('0x3b')]=_[_0xd425('0x3a')](_0x524fad[_0xd425('0x35')],qs['fields'](_0x3f24fb[_0xd425('0x37')]['fields']));_0x2d799b[_0xd425('0x3b')]=_0x2d799b['attributes'][_0xd425('0x4c')]?_0x2d799b[_0xd425('0x3b')]:_0x524fad[_0xd425('0x35')];if(_0x3f24fb[_0xd425('0x37')][_0xd425('0x4d')]){_0x2d799b['include']=[{'all':!![]}];}_0x2d799b=_[_0xd425('0x42')]({},_0x2d799b,_0x3f24fb[_0xd425('0x45')]);return db[_0xd425('0x30')][_0xd425('0x4e')](_0x2d799b)[_0xd425('0x2a')](handleEntityNotFound(_0x2f6bf7,null))['then'](respondWithResult(_0x2f6bf7,null))[_0xd425('0x49')](handleError(_0x2f6bf7,null));};exports[_0xd425('0x4f')]=function(_0x1450f2,_0x2a2ab4){return db[_0xd425('0x30')][_0xd425('0x4f')](_0x1450f2['body'],{})[_0xd425('0x2a')](respondWithResult(_0x2a2ab4,0xc9))[_0xd425('0x49')](handleError(_0x2a2ab4,null));};exports['update']=function(_0x3f305,_0x42c084){if(_0x3f305[_0xd425('0x50')]['id']){delete _0x3f305[_0xd425('0x50')]['id'];}delete _0x3f305['body'][_0xd425('0x51')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x52')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x53')];delete _0x3f305['body']['value'];return db[_0xd425('0x30')]['find']({'where':{'id':_0x3f305[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x42c084,null))['then'](saveUpdates(_0x3f305[_0xd425('0x50')],null))['then'](respondWithResult(_0x42c084,null))['catch'](handleError(_0x42c084,null));};exports[_0xd425('0x54')]=function(_0x111905,_0xe6451f){return db[_0xd425('0x30')][_0xd425('0x54')]()[_0xd425('0x2a')](respondWithResult(_0xe6451f,null))[_0xd425('0x49')](handleError(_0xe6451f,null));};exports[_0xd425('0x55')]=function(_0x54d437,_0x11ed71,_0x1c6141){var _0x1be9bb=require(_0xd425('0x56'));var _0x7b1080=![];var _0x1c80c2={};if(_0x54d437[_0xd425('0x37')][_0xd425('0x33')]&&_0x54d437['query']['type']==='uniqueid'){_0x1c80c2[_0xd425('0x57')]=_0x54d437[_0xd425('0x4b')]['id'];}else{_0x1c80c2['id']=_0x54d437[_0xd425('0x4b')]['id'];}return db[_0xd425('0x30')]['find']({'where':_0x1c80c2,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x11ed71,null))['then'](function(_0x254b8b){if(_0x254b8b){var _0x44c5e4=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x254b8b[_0xd425('0x5a')]);var _0x57e23e=util['format'](_0xd425('0x5b'),_0x44c5e4);if(fs['existsSync'](_0x57e23e)){_0x7b1080=!![];return _0x1be9bb['decryptFile'](_0x57e23e,_0x44c5e4,config['secrets'][_0xd425('0x5c')])[_0xd425('0x2a')](function(){return _0x254b8b;});}return _0x254b8b;}})[_0xd425('0x2a')](function(_0x5b2323){if(_0x5b2323){var _0x3395d8=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x5b2323[_0xd425('0x5a')]);if(!fs[_0xd425('0x5d')](_0x3395d8)){throw new db[(_0xd425('0x5e'))][(_0xd425('0x5f'))](_0xd425('0x60'));}if(_0x5b2323[_0xd425('0x61')]){return _0x11ed71[_0xd425('0x55')](_0x3395d8,_0x5b2323['filename']+path[_0xd425('0x62')](_0x3395d8),function(){if(_0x7b1080){fs[_0xd425('0x63')](_0x3395d8);}});}else{return _0x11ed71[_0xd425('0x55')](_0x3395d8,function(_0xf22906){if(_0x7b1080){fs['unlink'](_0x3395d8);}});}}})['catch'](function(_0x307e9a){if(_0x307e9a[_0xd425('0x64')]===_0xd425('0x60')){_0x11ed71[_0xd425('0x1f')](0x194)[_0xd425('0x2d')](_0xd425('0x65'));}else{return handleError(_0x11ed71,null);}});};exports[_0xd425('0x66')]=function(_0x44782a,_0x1fcde4){return db[_0xd425('0x30')][_0xd425('0x4e')]({'where':{'id':_0x44782a[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](function(_0x28979e){if(_['isNil'](_0x28979e)){throw new ReferenceError(_0xd425('0x67'));}return _0x28979e;})[_0xd425('0x2a')](function(_0xd2f2e8){var _0x4fd793=path['join'](config['root'],_0xd425('0x59'),_0xd2f2e8[_0xd425('0x5a')]);logger[_0xd425('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x4fd793);if(!_[_0xd425('0x69')](_0xd2f2e8['value'])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd425('0x6b')](_0x4fd793);}_0x4fd793=_0x4fd793+_0xd425('0x6c');if(!_[_0xd425('0x69')](_0xd2f2e8[_0xd425('0x5a')])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+_0xd425('0x6d'));fs[_0xd425('0x6b')](_0x4fd793);}return _0xd2f2e8;})[_0xd425('0x2a')](function(_0x2ba77b){if(!_0x2ba77b)throw new InternalError();return _0x2ba77b[_0xd425('0x66')]();})[_0xd425('0x2a')](function(){_0x1fcde4[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();})[_0xd425('0x49')](handleError(_0x1fcde4,null));}; \ No newline at end of file +var _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1e87b6,_0x3fa9d7){var _0x241d33=function(_0x790bb7){while(--_0x790bb7){_0x1e87b6['push'](_0x1e87b6['shift']());}};_0x241d33(++_0x3fa9d7);}(_0xee14,0x13a));var _0x4ee1=function(_0xedb1ee,_0x3201d5){_0xedb1ee=_0xedb1ee-0x0;var _0x1cb3a5=_0xee14[_0xedb1ee];return _0x1cb3a5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f2517a5..d914e7b 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 _0xa291=['interactionid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x1af305,_0x3a833e){var _0x1270ca=function(_0x2bb5ec){while(--_0x2bb5ec){_0x1af305['push'](_0x1af305['shift']());}};_0x1270ca(++_0x3a833e);}(_0xa291,0xc4));var _0x1a29=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0xa291[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0x1a29('0x0'));var util=require('util');var logger=require(_0x1a29('0x1'))(_0x1a29('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a29('0x3'));var fs=require('fs');var path=require(_0x1a29('0x4'));var rimraf=require(_0x1a29('0x5'));var config=require(_0x1a29('0x6'));var attributes=require(_0x1a29('0x7'));module[_0x1a29('0x8')]=function(_0x44b29e,_0xae723d){return _0x44b29e[_0x1a29('0x9')](_0x1a29('0xa'),attributes,{'tableName':_0x1a29('0xb'),'paranoid':![],'indexes':[{'name':_0x1a29('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1faf=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','path','./screenRecording.attributes'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x1faf,0xcc));var _0xf1fa=function(_0x5b726c,_0x443078){_0x5b726c=_0x5b726c-0x0;var _0x3e778c=_0x1faf[_0x5b726c];return _0x3e778c;};'use strict';var _=require(_0xf1fa('0x0'));var util=require(_0xf1fa('0x1'));var logger=require(_0xf1fa('0x2'))('api');var moment=require(_0xf1fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf1fa('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf1fa('0x5'));module['exports']=function(_0x6ceab6,_0x27b7ec){return _0x6ceab6[_0xf1fa('0x6')](_0xf1fa('0x7'),attributes,{'tableName':_0xf1fa('0x8'),'paranoid':![],'indexes':[{'name':_0xf1fa('0x9'),'fields':[_0xf1fa('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8279b96..87a24c8 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 _0x7a57=['jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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'];(function(_0x23415f,_0x415f79){var _0x1e977f=function(_0x2da5b3){while(--_0x2da5b3){_0x23415f['push'](_0x23415f['shift']());}};_0x1e977f(++_0x415f79);}(_0x7a57,0x153));var _0x77a5=function(_0x55919a,_0x236f23){_0x55919a=_0x55919a-0x0;var _0x782495=_0x7a57[_0x55919a];return _0x782495;};'use strict';var _=require(_0x77a5('0x0'));var util=require(_0x77a5('0x1'));var moment=require(_0x77a5('0x2'));var BPromise=require(_0x77a5('0x3'));var rs=require(_0x77a5('0x4'));var fs=require('fs');var Redis=require(_0x77a5('0x5'));var db=require(_0x77a5('0x6'))['db'];var utils=require(_0x77a5('0x7'));var logger=require(_0x77a5('0x8'))(_0x77a5('0x9'));var config=require(_0x77a5('0xa'));var jayson=require(_0x77a5('0xb'));var client=jayson['client'][_0x77a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b163d,_0x4e466f,_0xfc4fb7){return new BPromise(function(_0xffb2f,_0x7ae1f2){return client[_0x77a5('0xd')](_0x3b163d,_0xfc4fb7)[_0x77a5('0xe')](function(_0x310e19){logger[_0x77a5('0xf')](_0x77a5('0x10'),_0x4e466f,_0x77a5('0x11'));logger[_0x77a5('0x12')](_0x77a5('0x13'),_0x4e466f,_0x77a5('0x11'),JSON[_0x77a5('0x14')](_0x310e19));if(_0x310e19[_0x77a5('0x15')]){if(_0x310e19['error']['code']===0x1f4){logger[_0x77a5('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x4e466f,_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);return _0x7ae1f2(_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);}logger[_0x77a5('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x4e466f,_0x310e19['error'][_0x77a5('0x16')]);return _0xffb2f(_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);}else{logger[_0x77a5('0xf')](_0x77a5('0x10'),_0x4e466f,_0x77a5('0x11'));_0xffb2f(_0x310e19[_0x77a5('0x17')][_0x77a5('0x16')]);}})[_0x77a5('0x18')](function(_0x35bbd3){logger['error'](_0x77a5('0x10'),_0x4e466f,_0x35bbd3);_0x7ae1f2(_0x35bbd3);});});} \ No newline at end of file +var _0x2b32=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6fd95e,_0x5530b1){var _0x5a5f90=function(_0xbc60db){while(--_0xbc60db){_0x6fd95e['push'](_0x6fd95e['shift']());}};_0x5a5f90(++_0x5530b1);}(_0x2b32,0x16c));var _0x22b3=function(_0x32e919,_0x4fd27c){_0x32e919=_0x32e919-0x0;var _0x2fc4cb=_0x2b32[_0x32e919];return _0x2fc4cb;};'use strict';var _=require(_0x22b3('0x0'));var util=require('util');var moment=require(_0x22b3('0x1'));var BPromise=require(_0x22b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22b3('0x3'));var db=require(_0x22b3('0x4'))['db'];var utils=require(_0x22b3('0x5'));var logger=require(_0x22b3('0x6'))(_0x22b3('0x7'));var config=require(_0x22b3('0x8'));var jayson=require(_0x22b3('0x9'));var client=jayson['client'][_0x22b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5220bd,_0xb176e3,_0x4cb6a4){return new BPromise(function(_0x494ab8,_0x378b66){return client[_0x22b3('0xb')](_0x5220bd,_0x4cb6a4)[_0x22b3('0xc')](function(_0x3cc3b4){logger[_0x22b3('0xd')](_0x22b3('0xe'),_0xb176e3,'request\x20sent');logger[_0x22b3('0xf')](_0x22b3('0x10'),_0xb176e3,_0x22b3('0x11'),JSON[_0x22b3('0x12')](_0x3cc3b4));if(_0x3cc3b4[_0x22b3('0x13')]){if(_0x3cc3b4[_0x22b3('0x13')][_0x22b3('0x14')]===0x1f4){logger['error'](_0x22b3('0xe'),_0xb176e3,_0x3cc3b4[_0x22b3('0x13')][_0x22b3('0x15')]);return _0x378b66(_0x3cc3b4[_0x22b3('0x13')][_0x22b3('0x15')]);}logger[_0x22b3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0xb176e3,_0x3cc3b4['error'][_0x22b3('0x15')]);return _0x494ab8(_0x3cc3b4[_0x22b3('0x13')][_0x22b3('0x15')]);}else{logger[_0x22b3('0xd')]('ScreenRecording,\x20%s,\x20%s',_0xb176e3,_0x22b3('0x11'));_0x494ab8(_0x3cc3b4[_0x22b3('0x16')][_0x22b3('0x15')]);}})[_0x22b3('0x17')](function(_0x364bab){logger[_0x22b3('0x13')]('ScreenRecording,\x20%s,\x20%s',_0xb176e3,_0x364bab);_0x378b66(_0x364bab);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8f9d2f2..40aa83e 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 _0xc820=['show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','join','server/files/images/logos/','%s%s','extname','originalname','single','file','addLogo','root','format','logologin','addLogoLogin','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','/now','getDate','/:id'];(function(_0x1e6db4,_0x53a5ff){var _0x28a281=function(_0x266993){while(--_0x266993){_0x1e6db4['push'](_0x1e6db4['shift']());}};_0x28a281(++_0x53a5ff);}(_0xc820,0x1a9));var _0x0c82=function(_0x30e11e,_0x4877bc){_0x30e11e=_0x30e11e-0x0;var _0x3e314e=_0xc820[_0x30e11e];return _0x3e314e;};'use strict';var multer=require(_0x0c82('0x0'));var util=require(_0x0c82('0x1'));var path=require(_0x0c82('0x2'));var timeout=require(_0x0c82('0x3'));var express=require(_0x0c82('0x4'));var router=express[_0x0c82('0x5')]();var fs_extra=require(_0x0c82('0x6'));var auth=require(_0x0c82('0x7'));var interaction=require(_0x0c82('0x8'));var config=require('../../config/environment');var controller=require(_0x0c82('0x9'));router[_0x0c82('0xa')]('/',auth[_0x0c82('0xb')](),controller['index']);router[_0x0c82('0xa')](_0x0c82('0xc'),controller[_0x0c82('0xd')]);router[_0x0c82('0xa')](_0x0c82('0xe'),controller[_0x0c82('0xf')]);router[_0x0c82('0xa')](_0x0c82('0x10'),controller[_0x0c82('0x11')]);router[_0x0c82('0xa')](_0x0c82('0x12'),controller[_0x0c82('0x13')]);router[_0x0c82('0xa')](_0x0c82('0x14'),controller['gdpr']);router[_0x0c82('0xa')](_0x0c82('0x15'),controller['getPreferred']);router[_0x0c82('0xa')](_0x0c82('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x1d5015,_0x44cacf,_0x5d420c){_0x5d420c(null,path[_0x0c82('0x18')](config['root'],_0x0c82('0x19')));},'filename':function(_0x1ae5db,_0x7a61f9,_0x5c64da){_0x5c64da(null,util['format'](_0x0c82('0x1a'),'logo',path[_0x0c82('0x1b')](_0x7a61f9[_0x0c82('0x1c')])));}})});router['post']('/:id/logo',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller[_0x0c82('0x1f')]);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x4d92cb,_0x52922c,_0x4245c4){_0x4245c4(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],'server/files/images/logos/'));},'filename':function(_0xf3973,_0x256eb0,_0x2d2f92){_0x2d2f92(null,util[_0x0c82('0x21')](_0x0c82('0x1a'),_0x0c82('0x22'),path[_0x0c82('0x1b')](_0x256eb0[_0x0c82('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller[_0x0c82('0x23')]);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x53ed9b,_0x1a3663,_0x319338){_0x319338(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],'server/files/images/logos/'));},'filename':function(_0x1276b6,_0x3a5aeb,_0x1a2135){_0x1a2135(null,util[_0x0c82('0x21')]('%s%s','preferred',path[_0x0c82('0x1b')](_0x3a5aeb[_0x0c82('0x1c')])));}})});router['post'](_0x0c82('0x15'),upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x2b4eb9,_0x6b2af7,_0xf911ec){_0xf911ec(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],_0x0c82('0x19')));},'filename':function(_0x1efdb6,_0x7617a2,_0x44e5f8){_0x44e5f8(null,util[_0x0c82('0x21')](_0x0c82('0x1a'),_0x0c82('0x24'),path['extname'](_0x7617a2[_0x0c82('0x1c')])));}})});router['post']('/:id/favicon',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller['addFavicon']);router[_0x0c82('0x25')](_0x0c82('0xe'),auth[_0x0c82('0xb')](),controller[_0x0c82('0x26')]);module[_0x0c82('0x27')]=router; \ No newline at end of file +var _0x0210=['diskStorage','join','server/files/images/logos/','format','%s%s','logo','originalname','post','single','file','extname','/:id/logo_login','addLogoLogin','root','preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon'];(function(_0x40122a,_0x33b20b){var _0x5f1413=function(_0x23c8f2){while(--_0x23c8f2){_0x40122a['push'](_0x40122a['shift']());}};_0x5f1413(++_0x33b20b);}(_0x0210,0xbd));var _0x0021=function(_0x344ec0,_0x13a457){_0x344ec0=_0x344ec0-0x0;var _0x51942e=_0x0210[_0x344ec0];return _0x51942e;};'use strict';var multer=require(_0x0021('0x0'));var util=require(_0x0021('0x1'));var path=require(_0x0021('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0021('0x3')]();var fs_extra=require(_0x0021('0x4'));var auth=require(_0x0021('0x5'));var interaction=require(_0x0021('0x6'));var config=require(_0x0021('0x7'));var controller=require(_0x0021('0x8'));router[_0x0021('0x9')]('/',auth['isAuthenticated'](),controller[_0x0021('0xa')]);router[_0x0021('0x9')]('/now',controller[_0x0021('0xb')]);router[_0x0021('0x9')](_0x0021('0xc'),controller[_0x0021('0xd')]);router['get'](_0x0021('0xe'),controller[_0x0021('0xf')]);router[_0x0021('0x9')]('/:id/logo_login',controller[_0x0021('0x10')]);router[_0x0021('0x9')]('/:id/gdpr',controller[_0x0021('0x11')]);router[_0x0021('0x9')](_0x0021('0x12'),controller[_0x0021('0x13')]);router[_0x0021('0x9')](_0x0021('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0021('0x15')]({'destination':function(_0x324c13,_0x27995e,_0x4045b2){_0x4045b2(null,path[_0x0021('0x16')](config['root'],_0x0021('0x17')));},'filename':function(_0x104231,_0x10b80f,_0x2c1162){_0x2c1162(null,util[_0x0021('0x18')](_0x0021('0x19'),_0x0021('0x1a'),path['extname'](_0x10b80f[_0x0021('0x1b')])));}})});router[_0x0021('0x1c')](_0x0021('0xe'),upload[_0x0021('0x1d')](_0x0021('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x0021('0x15')]({'destination':function(_0x480a4d,_0x248e82,_0x722f2){_0x722f2(null,path[_0x0021('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x44bf4a,_0x25436c,_0x4f6898){_0x4f6898(null,util[_0x0021('0x18')](_0x0021('0x19'),'logologin',path[_0x0021('0x1f')](_0x25436c[_0x0021('0x1b')])));}})});router[_0x0021('0x1c')](_0x0021('0x20'),upload['single'](_0x0021('0x1e')),controller[_0x0021('0x21')]);var upload=multer({'storage':multer[_0x0021('0x15')]({'destination':function(_0x75cc8b,_0x1050ee,_0x556cfe){_0x556cfe(null,path[_0x0021('0x16')](config[_0x0021('0x22')],_0x0021('0x17')));},'filename':function(_0x24801f,_0xbc9006,_0x567071){_0x567071(null,util[_0x0021('0x18')](_0x0021('0x19'),_0x0021('0x23'),path['extname'](_0xbc9006[_0x0021('0x1b')])));}})});router[_0x0021('0x1c')]('/:id/preferred',upload[_0x0021('0x1d')](_0x0021('0x1e')),controller[_0x0021('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x56506c,_0x45368b,_0x40bce6){_0x40bce6(null,path[_0x0021('0x16')](config[_0x0021('0x22')],_0x0021('0x17')));},'filename':function(_0x5b5e64,_0x390ffc,_0x179416){_0x179416(null,util[_0x0021('0x18')](_0x0021('0x19'),_0x0021('0x25'),path[_0x0021('0x1f')](_0x390ffc[_0x0021('0x1b')])));}})});router[_0x0021('0x1c')]('/:id/favicon',upload[_0x0021('0x1d')]('file'),controller[_0x0021('0x26')]);router[_0x0021('0x27')](_0x0021('0xc'),auth[_0x0021('0x28')](),controller['update']);module[_0x0021('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7a410b7..d43e649 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 _0x6fad=['sequelize','exports','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','alternate','UNSIGNED'];(function(_0x4831fa,_0xfd55ab){var _0x318679=function(_0x20dedc){while(--_0x20dedc){_0x4831fa['push'](_0x4831fa['shift']());}};_0x318679(++_0xfd55ab);}(_0x6fad,0x17a));var _0xd6fa=function(_0x1bca89,_0x555310){_0x1bca89=_0x1bca89-0x0;var _0x28f163=_0x6fad[_0x1bca89];return _0x28f163;};'use strict';var Sequelize=require(_0xd6fa('0x0'));module[_0xd6fa('0x1')]={'min_internal':{'type':Sequelize[_0xd6fa('0x2')](0xb),'unique':_0xd6fa('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd6fa('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd6fa('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xd6fa('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd6fa('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd6fa('0x6')]},'turnaddr':{'type':Sequelize[_0xd6fa('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xd6fa('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd6fa('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd6fa('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd6fa('0x6')],'defaultValue':_0xd6fa('0x7')},'chatTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd6fa('0x6')]},'defaultPreferred':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd6fa('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd6fa('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd6fa('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd6fa('0x2')](0x2)[_0xd6fa('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xd6fa('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xd6fa('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd6fa('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0x23bb=['UNSIGNED','sequelize','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x416a91,_0xe61e57){var _0x4fdd84=function(_0x31c36d){while(--_0x31c36d){_0x416a91['push'](_0x416a91['shift']());}};_0x4fdd84(++_0xe61e57);}(_0x23bb,0x79));var _0xb23b=function(_0x3e436c,_0xebf949){_0x3e436c=_0x3e436c-0x0;var _0x3e4924=_0x23bb[_0x3e436c];return _0x3e4924;};'use strict';var Sequelize=require(_0xb23b('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb23b('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb23b('0x2')](0xb),'unique':_0xb23b('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb23b('0x4')],'defaultValue':_0xb23b('0x5')},'logo':{'type':Sequelize[_0xb23b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb23b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb23b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xb23b('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xb23b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb23b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xb23b('0x7')},'enableEmailPreview':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb23b('0x4')],'defaultValue':_0xb23b('0x8')},'chatTimeout':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb23b('0x4')]},'defaultPreferred':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb23b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb23b('0x4')]},'defaultFavicon':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xb23b('0x4')]},'sentiment':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb23b('0x2')]},'sentimentRegion':{'type':Sequelize[_0xb23b('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xb23b('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb23b('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xb23b('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb23b('0x2')](0x2)[_0xb23b('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb23b('0x2')](0x2)[_0xb23b('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb23b('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb23b('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 054af10..447abb6 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 _0xccb9=['update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','download','default_loginLogo.svg','default','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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','jayson/promise','http','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','limit','undefined','offset','set','Content-Range','reject','save','destroy','end','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','length','find'];(function(_0x7e247f,_0x469d63){var _0x344f84=function(_0x42604f){while(--_0x42604f){_0x7e247f['push'](_0x7e247f['shift']());}};_0x344f84(++_0x469d63);}(_0xccb9,0x124));var _0x9ccb=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xccb9[_0x1d558c];return _0x15767d;};'use strict';var emlformat=require(_0x9ccb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ccb('0x1'));var jsonpatch=require(_0x9ccb('0x2'));var rp=require(_0x9ccb('0x3'));var moment=require(_0x9ccb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ccb('0x5'));var util=require(_0x9ccb('0x6'));var path=require(_0x9ccb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ccb('0x8'));var fs=require('fs');var fs_extra=require(_0x9ccb('0x9'));var _=require(_0x9ccb('0xa'));var squel=require(_0x9ccb('0xb'));var crypto=require(_0x9ccb('0xc'));var jsforce=require(_0x9ccb('0xd'));var deskjs=require(_0x9ccb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ccb('0xf'));var Papa=require(_0x9ccb('0x10'));var Redis=require(_0x9ccb('0x11'));var authService=require(_0x9ccb('0x12'));var qs=require(_0x9ccb('0x13'));var as=require(_0x9ccb('0x14'));var hardwareService=require(_0x9ccb('0x15'));var logger=require(_0x9ccb('0x16'))(_0x9ccb('0x17'));var utils=require('../../config/utils');var config=require(_0x9ccb('0x18'));var licenseUtil=require(_0x9ccb('0x19'));var db=require(_0x9ccb('0x1a'))['db'];var jayson=require(_0x9ccb('0x1b'));var client=jayson['client'][_0x9ccb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3e60f9,_0x269d68,_0x53de18,_0x28ed71){return new BPromise(function(_0x2d9e00,_0x5f18b2){var _0x24bb14=_0x28ed71||client;return _0x24bb14['request'](_0x3e60f9,_0x53de18)[_0x9ccb('0x1d')](function(_0x3ac092){logger['info']('Setting,\x20%s,\x20%s',_0x269d68,_0x9ccb('0x1e'));logger[_0x9ccb('0x1f')](_0x9ccb('0x20'),_0x269d68,_0x9ccb('0x1e'),JSON['stringify'](_0x3ac092));if(_0x3ac092[_0x9ccb('0x21')]){if(_0x3ac092[_0x9ccb('0x21')][_0x9ccb('0x22')]===0x1f4){logger[_0x9ccb('0x21')](_0x9ccb('0x23'),_0x269d68,_0x3ac092[_0x9ccb('0x21')][_0x9ccb('0x24')]);return _0x5f18b2(_0x3ac092[_0x9ccb('0x21')]['message']);}logger[_0x9ccb('0x21')](_0x9ccb('0x23'),_0x269d68,_0x3ac092[_0x9ccb('0x21')]['message']);return _0x2d9e00(_0x3ac092['error'][_0x9ccb('0x24')]);}else{logger[_0x9ccb('0x25')](_0x9ccb('0x23'),_0x269d68,_0x9ccb('0x1e'));_0x2d9e00(_0x3ac092[_0x9ccb('0x26')][_0x9ccb('0x24')]);}})[_0x9ccb('0x27')](function(_0x174683){logger[_0x9ccb('0x21')]('Setting,\x20%s,\x20%s',_0x269d68,_0x174683);_0x5f18b2(_0x174683);});});}function respondWithStatusCode(_0x53b8a6,_0xae8e3f){_0xae8e3f=_0xae8e3f||0xcc;return function(_0x4361a3){if(_0x4361a3){return _0x53b8a6[_0x9ccb('0x28')](_0xae8e3f);}return _0x53b8a6[_0x9ccb('0x29')](_0xae8e3f)['end']();};}function respondWithResult(_0x16e174,_0x10130e){_0x10130e=_0x10130e||0xc8;return function(_0x199b54){if(_0x199b54){return _0x16e174[_0x9ccb('0x29')](_0x10130e)[_0x9ccb('0x2a')](_0x199b54);}};}function respondWithFilteredResult(_0x4c1300,_0x21f880){return function(_0x570dc5){if(_0x570dc5){var _0x240669=typeof _0x21f880['offset']==='undefined'&&typeof _0x21f880[_0x9ccb('0x2b')]===_0x9ccb('0x2c');var _0x2c40ed=_0x570dc5['count'];var _0x43a8e8=_0x240669?0x0:_0x21f880[_0x9ccb('0x2d')];var _0x332006=_0x240669?_0x570dc5['count']:_0x21f880['offset']+_0x21f880[_0x9ccb('0x2b')];var _0xebb1fb;if(_0x332006>=_0x2c40ed){_0x332006=_0x2c40ed;_0xebb1fb=0xc8;}else{_0xebb1fb=0xce;}_0x4c1300[_0x9ccb('0x29')](_0xebb1fb);return _0x4c1300[_0x9ccb('0x2e')](_0x9ccb('0x2f'),_0x43a8e8+'-'+_0x332006+'/'+_0x2c40ed)[_0x9ccb('0x2a')](_0x570dc5);}return null;};}function patchUpdates(_0x12dbd8){return function(_0x22d14e){try{jsonpatch['apply'](_0x22d14e,_0x12dbd8,!![]);}catch(_0x3e0c69){return BPromise[_0x9ccb('0x30')](_0x3e0c69);}return _0x22d14e[_0x9ccb('0x31')]();};}function saveUpdates(_0xe3d70b,_0x4efac8){return function(_0x5f0077){if(_0x5f0077){return _0x5f0077['update'](_0xe3d70b)[_0x9ccb('0x1d')](function(_0x26d436){return _0x26d436;});}return null;};}function removeEntity(_0x5ec81e,_0x5374d2){return function(_0x4ec037){if(_0x4ec037){return _0x4ec037[_0x9ccb('0x32')]()['then'](function(){_0x5ec81e['status'](0xcc)[_0x9ccb('0x33')]();});}};}function handleEntityNotFound(_0x25dd66,_0x4bef66){return function(_0x136ac2){if(!_0x136ac2){_0x25dd66[_0x9ccb('0x28')](0x194);}return _0x136ac2;};}function handleError(_0x21927f,_0x414fc8){_0x414fc8=_0x414fc8||0x1f4;return function(_0x5eb09d){logger[_0x9ccb('0x21')](_0x5eb09d[_0x9ccb('0x34')]);if(_0x5eb09d['name']){delete _0x5eb09d[_0x9ccb('0x35')];}_0x21927f[_0x9ccb('0x29')](_0x414fc8)[_0x9ccb('0x36')](_0x5eb09d);};}exports['index']=function(_0x238a6b,_0x19c52f){var _0x1940bc={},_0x4af09f={},_0xfcb758={'count':0x0,'rows':[]};var _0x1547d0=_[_0x9ccb('0x37')](db[_0x9ccb('0x38')][_0x9ccb('0x39')],function(_0x77cd75){return{'name':_0x77cd75[_0x9ccb('0x3a')],'type':_0x77cd75[_0x9ccb('0x3b')][_0x9ccb('0x3c')]};});_0x4af09f[_0x9ccb('0x3d')]=_['map'](_0x1547d0,_0x9ccb('0x35'));_0x4af09f[_0x9ccb('0x3e')]=_['keys'](_0x238a6b[_0x9ccb('0x3e')]);_0x4af09f[_0x9ccb('0x3f')]=_[_0x9ccb('0x40')](_0x4af09f['model'],_0x4af09f[_0x9ccb('0x3e')]);_0x1940bc[_0x9ccb('0x41')]=_[_0x9ccb('0x40')](_0x4af09f[_0x9ccb('0x3d')],qs[_0x9ccb('0x42')](_0x238a6b['query'][_0x9ccb('0x42')]));_0x1940bc['attributes']=_0x1940bc[_0x9ccb('0x41')]['length']?_0x1940bc[_0x9ccb('0x41')]:_0x4af09f[_0x9ccb('0x3d')];if(!_0x238a6b['query'][_0x9ccb('0x43')](_0x9ccb('0x44'))){_0x1940bc['limit']=qs['limit'](_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x2b')]);_0x1940bc['offset']=qs[_0x9ccb('0x2d')](_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x2d')]);}_0x1940bc[_0x9ccb('0x45')]=qs[_0x9ccb('0x46')](_0x238a6b[_0x9ccb('0x3e')]['sort']);_0x1940bc[_0x9ccb('0x47')]=qs[_0x9ccb('0x3f')](_['pick'](_0x238a6b[_0x9ccb('0x3e')],_0x4af09f['filters']),_0x1547d0);if(_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x48')]){_0x1940bc[_0x9ccb('0x47')]=_['merge'](_0x1940bc[_0x9ccb('0x47')],{'$or':_[_0x9ccb('0x37')](_0x1547d0,function(_0x37f53b){if(_0x37f53b[_0x9ccb('0x3b')]!==_0x9ccb('0x49')){var _0x3d0073={};_0x3d0073[_0x37f53b[_0x9ccb('0x35')]]={'$like':'%'+_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x48')]+'%'};return _0x3d0073;}})});}_0x1940bc=_[_0x9ccb('0x4a')]({},_0x1940bc,_0x238a6b[_0x9ccb('0x4b')]);var _0x5dc461={'where':_0x1940bc[_0x9ccb('0x47')]};return db[_0x9ccb('0x38')][_0x9ccb('0x4c')](_0x5dc461)['then'](function(_0x4ed505){_0xfcb758[_0x9ccb('0x4c')]=_0x4ed505;if(_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x4d')]){_0x1940bc[_0x9ccb('0x4e')]=[{'all':!![]}];}return db[_0x9ccb('0x38')][_0x9ccb('0x4f')](_0x1940bc);})[_0x9ccb('0x1d')](function(_0x492836){_0xfcb758[_0x9ccb('0x50')]=_0x492836;return _0xfcb758;})['then'](respondWithFilteredResult(_0x19c52f,_0x1940bc))[_0x9ccb('0x27')](handleError(_0x19c52f,null));};exports[_0x9ccb('0x51')]=function(_0x428f5f,_0x331521){var _0x42521e={'raw':![],'where':{'id':_0x428f5f[_0x9ccb('0x52')]['id']}},_0x5edff0={};_0x5edff0[_0x9ccb('0x3d')]=_[_0x9ccb('0x53')](db[_0x9ccb('0x38')]['rawAttributes']);_0x5edff0[_0x9ccb('0x3e')]=_[_0x9ccb('0x53')](_0x428f5f[_0x9ccb('0x3e')]);_0x5edff0['filters']=_[_0x9ccb('0x40')](_0x5edff0[_0x9ccb('0x3d')],_0x5edff0[_0x9ccb('0x3e')]);_0x42521e[_0x9ccb('0x41')]=_[_0x9ccb('0x40')](_0x5edff0[_0x9ccb('0x3d')],qs['fields'](_0x428f5f[_0x9ccb('0x3e')]['fields']));_0x42521e['attributes']=_0x42521e['attributes'][_0x9ccb('0x54')]?_0x42521e[_0x9ccb('0x41')]:_0x5edff0[_0x9ccb('0x3d')];if(_0x428f5f[_0x9ccb('0x3e')]['includeAll']){_0x42521e[_0x9ccb('0x4e')]=[{'all':!![]}];}_0x42521e=_[_0x9ccb('0x4a')]({},_0x42521e,_0x428f5f[_0x9ccb('0x4b')]);return db['Setting'][_0x9ccb('0x55')](_0x42521e)['then'](handleEntityNotFound(_0x331521,null))[_0x9ccb('0x1d')](respondWithResult(_0x331521,null))[_0x9ccb('0x27')](handleError(_0x331521,null));};exports[_0x9ccb('0x56')]=function(_0x5946b3,_0x416e39){if(_0x5946b3[_0x9ccb('0x57')]['id']){delete _0x5946b3[_0x9ccb('0x57')]['id'];}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x5946b3[_0x9ccb('0x52')]['id']}})['then'](handleEntityNotFound(_0x416e39,null))[_0x9ccb('0x1d')](saveUpdates(_0x5946b3[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x416e39,null))['catch'](handleError(_0x416e39,null));};exports[_0x9ccb('0x58')]=function(_0x6c2543,_0x32ab73,_0xa3dea3){if(_0x6c2543[_0x9ccb('0x59')]&&_0x6c2543[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x6c2543[_0x9ccb('0x57')][_0x9ccb('0x5b')]=_0x6c2543[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x6c2543['params']['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x32ab73,null))[_0x9ccb('0x1d')](saveUpdates(_0x6c2543[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x32ab73,null))[_0x9ccb('0x27')](handleError(_0x32ab73,null));};exports[_0x9ccb('0x5c')]=function(_0x32a1b6,_0x51b65b,_0x19648f){if(_0x32a1b6[_0x9ccb('0x59')]&&_0x32a1b6[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x32a1b6[_0x9ccb('0x57')][_0x9ccb('0x5d')]=_0x32a1b6[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db[_0x9ccb('0x38')]['find']({'where':{'id':_0x32a1b6['params']['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x51b65b,null))[_0x9ccb('0x1d')](saveUpdates(_0x32a1b6[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x51b65b,null))[_0x9ccb('0x27')](handleError(_0x51b65b,null));};var utilLicense=require(_0x9ccb('0x19'));exports[_0x9ccb('0x5e')]=function(_0x2daa03,_0x519f56,_0xf61ab2){var _0xb94bd8=_0x9ccb('0x5f');var _0x31bf22={'custom':![]};return utilLicense[_0x9ccb('0x60')]()[_0x9ccb('0x1d')](function(_0x84f4c3){if(_0x84f4c3){_0x31bf22=_0x84f4c3;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x2daa03[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),'loginLogo',_0x9ccb('0x61'),_0x9ccb('0x62'),_0x9ccb('0x63'),_0x9ccb('0x64'),_0x9ccb('0x65'),_0x9ccb('0x66')],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x519f56,null))[_0x9ccb('0x1d')](function(_0x15e343){if(_0x15e343){var _0x2c4fee=_0x15e343[_0x9ccb('0x5b')]&&fs['existsSync'](path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_['toLower'](_0x15e343['logo'])))?path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_['toLower'](_0x15e343[_0x9ccb('0x5b')])):path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_[_0x9ccb('0x69')](_0x9ccb('0x6a')));var _0x50c835='default'+_[_0x9ccb('0x6b')](_0x9ccb('0x5b'));if(_0x15e343[_0x50c835]||!_0x31bf22[_0x9ccb('0x6c')]){_0x2c4fee=path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_[_0x9ccb('0x69')](_0x9ccb('0x6a')));}if(!fs[_0x9ccb('0x6d')](_0x2c4fee)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_['upperFirst'](_0x9ccb('0x5b'))+_0x9ccb('0x6f'));}return _0x519f56[_0x9ccb('0x70')](_0x2c4fee);}})[_0x9ccb('0x27')](handleError(_0x519f56,null));};var utilLicense=require(_0x9ccb('0x19'));exports['getLogoLogin']=function(_0x4a0f18,_0x31c8f4,_0x1b56df){var _0xcb27b4=_0x9ccb('0x5f');var _0x2c2f7c={'custom':![]};return utilLicense[_0x9ccb('0x60')]()[_0x9ccb('0x1d')](function(_0x2d5197){if(_0x2d5197){_0x2c2f7c=_0x2d5197;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x4a0f18[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),_0x9ccb('0x5d'),'preferred',_0x9ccb('0x62'),'defaultLogo','defaultLoginLogo',_0x9ccb('0x65'),'defaultFavicon'],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x31c8f4,null))[_0x9ccb('0x1d')](function(_0x343aaa){if(_0x343aaa){var _0x1b1096=_0x343aaa[_0x9ccb('0x5d')]&&fs[_0x9ccb('0x6d')](path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_['toLower'](_0x343aaa[_0x9ccb('0x5d')])))?path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_['toLower'](_0x343aaa[_0x9ccb('0x5d')])):path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xcb27b4,_[_0x9ccb('0x69')](_0x9ccb('0x71')));var _0x22342b=_0x9ccb('0x72')+_['upperFirst'](_0x9ccb('0x5d'));if(_0x343aaa[_0x22342b]||!_0x2c2f7c[_0x9ccb('0x6c')]){_0x1b1096=path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_[_0x9ccb('0x69')](_0x9ccb('0x71')));}if(!fs[_0x9ccb('0x6d')](_0x1b1096)){throw new db['Sequelize'][(_0x9ccb('0x73'))](_['upperFirst']('loginLogo')+_0x9ccb('0x6f'));}return _0x31c8f4[_0x9ccb('0x70')](_0x1b1096);}})['catch'](handleError(_0x31c8f4,null));};exports[_0x9ccb('0x74')]=function(_0x3c18e7,_0x3029f5){return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x3c18e7[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x75')]})[_0x9ccb('0x1d')](respondWithResult(_0x3029f5,null))[_0x9ccb('0x27')](handleError(_0x3029f5,null));};exports[_0x9ccb('0x76')]=function(_0x1ec4a5,_0x5db5c4,_0x1338ca){if(_0x1ec4a5[_0x9ccb('0x59')]&&_0x1ec4a5[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x1ec4a5[_0x9ccb('0x57')][_0x9ccb('0x61')]=_0x1ec4a5[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x1ec4a5[_0x9ccb('0x52')]['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x5db5c4,null))[_0x9ccb('0x1d')](saveUpdates(_0x1ec4a5[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x5db5c4,null))[_0x9ccb('0x27')](handleError(_0x5db5c4,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2643c0,_0x7add89,_0x218d9a){var _0x5c1d01='server/files/images/logos';var _0x1eeb7b={'custom':![]};return utilLicense['getLicense']()[_0x9ccb('0x1d')](function(_0x526dad){if(_0x526dad){_0x1eeb7b=_0x526dad;}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x2643c0[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),'loginLogo','preferred',_0x9ccb('0x62'),_0x9ccb('0x63'),'defaultLoginLogo',_0x9ccb('0x65'),_0x9ccb('0x66')],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x7add89,null))[_0x9ccb('0x1d')](function(_0x246110){if(_0x246110){var _0x1c879c=_0x246110[_0x9ccb('0x61')]&&fs[_0x9ccb('0x6d')](path['join'](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x246110['preferred'])))?path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x246110[_0x9ccb('0x61')])):path['join'](config['root'],_0x5c1d01,_[_0x9ccb('0x69')](_0x9ccb('0x77')));var _0x4dfb42=_0x9ccb('0x72')+_['upperFirst'](_0x9ccb('0x61'));if(_0x246110[_0x4dfb42]||!_0x1eeb7b[_0x9ccb('0x6c')]||!_0x1eeb7b[_0x9ccb('0x61')]){_0x1c879c=path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x9ccb('0x77')));}if(!fs['existsSync'](_0x1c879c)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_[_0x9ccb('0x6b')](_0x9ccb('0x61'))+_0x9ccb('0x6f'));}return _0x7add89[_0x9ccb('0x70')](_0x1c879c);}})[_0x9ccb('0x27')](handleError(_0x7add89,null));};exports['addFavicon']=function(_0xd84f8,_0x7023bd,_0x1c323e){if(_0xd84f8[_0x9ccb('0x59')]&&_0xd84f8[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0xd84f8[_0x9ccb('0x57')]['favicon']=_0xd84f8[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0xd84f8[_0x9ccb('0x52')]['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x7023bd,null))[_0x9ccb('0x1d')](saveUpdates(_0xd84f8[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x7023bd,null))['catch'](handleError(_0x7023bd,null));};var utilLicense=require(_0x9ccb('0x19'));exports[_0x9ccb('0x78')]=function(_0x470e03,_0x50d2be,_0x3f62c8){var _0x30dcb7=_0x9ccb('0x5f');var _0x390397={'custom':![]};return utilLicense['getLicense']()[_0x9ccb('0x1d')](function(_0x3ca074){if(_0x3ca074){_0x390397=_0x3ca074;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x470e03[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),_0x9ccb('0x5d'),_0x9ccb('0x61'),_0x9ccb('0x62'),_0x9ccb('0x63'),_0x9ccb('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x50d2be,null))[_0x9ccb('0x1d')](function(_0x41b9be){if(_0x41b9be){var _0x301bc4=_0x41b9be['favicon']&&fs[_0x9ccb('0x6d')](path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x30dcb7,_[_0x9ccb('0x69')](_0x41b9be[_0x9ccb('0x62')])))?path['join'](config[_0x9ccb('0x68')],_0x30dcb7,_['toLower'](_0x41b9be[_0x9ccb('0x62')])):path['join'](config[_0x9ccb('0x68')],_0x30dcb7,_['toLower'](_0x9ccb('0x79')));var _0x2eea65='default'+_[_0x9ccb('0x6b')](_0x9ccb('0x62'));if(_0x41b9be[_0x2eea65]||!_0x390397[_0x9ccb('0x6c')]){_0x301bc4=path[_0x9ccb('0x67')](config['root'],_0x30dcb7,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x301bc4)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_['upperFirst'](_0x9ccb('0x62'))+_0x9ccb('0x6f'));}return _0x50d2be[_0x9ccb('0x70')](_0x301bc4);}})[_0x9ccb('0x27')](handleError(_0x50d2be,null));};exports['getDate']=function(_0x45ec91,_0x4caceb){var _0x50c9ed={'offset':moment()[_0x9ccb('0x7a')]()};_0x50c9ed[_0x9ccb('0x7b')]=moment()[_0x9ccb('0x7a')](_0x50c9ed['offset'])[_0x9ccb('0x7c')](_0x9ccb('0x7d'));return _0x4caceb[_0x9ccb('0x29')](0xc8)['send'](_0x50c9ed);}; \ No newline at end of file +var _0x530e=['existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','ValidationError','gdpr','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','index','map','Setting','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','params','keys','rawAttributes','include','find','body','catch','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x530e,0x10c));var _0xe530=function(_0x253769,_0x3f5753){_0x253769=_0x253769-0x0;var _0x4a589c=_0x530e[_0x253769];return _0x4a589c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe530('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe530('0x1'));var rp=require(_0xe530('0x2'));var moment=require(_0xe530('0x3'));var BPromise=require(_0xe530('0x4'));var Mustache=require('mustache');var util=require(_0xe530('0x5'));var path=require(_0xe530('0x6'));var sox=require(_0xe530('0x7'));var csv=require('to-csv');var ejs=require(_0xe530('0x8'));var fs=require('fs');var fs_extra=require(_0xe530('0x9'));var _=require(_0xe530('0xa'));var squel=require('squel');var crypto=require(_0xe530('0xb'));var jsforce=require(_0xe530('0xc'));var deskjs=require(_0xe530('0xd'));var toCsv=require(_0xe530('0xe'));var querystring=require(_0xe530('0xf'));var Papa=require(_0xe530('0x10'));var Redis=require(_0xe530('0x11'));var authService=require(_0xe530('0x12'));var qs=require(_0xe530('0x13'));var as=require(_0xe530('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe530('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe530('0x16'));var db=require(_0xe530('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xe530('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1d71c9,_0xb8b74,_0x361f89,_0x119a3f){return new BPromise(function(_0x59a494,_0x1f005d){var _0x4b6e7d=_0x119a3f||client;return _0x4b6e7d[_0xe530('0x19')](_0x1d71c9,_0x361f89)[_0xe530('0x1a')](function(_0x363be3){logger['info'](_0xe530('0x1b'),_0xb8b74,_0xe530('0x1c'));logger[_0xe530('0x1d')](_0xe530('0x1e'),_0xb8b74,'request\x20sent',JSON['stringify'](_0x363be3));if(_0x363be3[_0xe530('0x1f')]){if(_0x363be3[_0xe530('0x1f')][_0xe530('0x20')]===0x1f4){logger[_0xe530('0x1f')](_0xe530('0x1b'),_0xb8b74,_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);return _0x1f005d(_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);}logger[_0xe530('0x1f')](_0xe530('0x1b'),_0xb8b74,_0x363be3[_0xe530('0x1f')][_0xe530('0x21')]);return _0x59a494(_0x363be3[_0xe530('0x1f')]['message']);}else{logger[_0xe530('0x22')]('Setting,\x20%s,\x20%s',_0xb8b74,_0xe530('0x1c'));_0x59a494(_0x363be3[_0xe530('0x23')][_0xe530('0x21')]);}})['catch'](function(_0x52cad2){logger[_0xe530('0x1f')]('Setting,\x20%s,\x20%s',_0xb8b74,_0x52cad2);_0x1f005d(_0x52cad2);});});}function respondWithStatusCode(_0x41d6cd,_0x28a7f7){_0x28a7f7=_0x28a7f7||0xcc;return function(_0x334630){if(_0x334630){return _0x41d6cd['sendStatus'](_0x28a7f7);}return _0x41d6cd[_0xe530('0x24')](_0x28a7f7)[_0xe530('0x25')]();};}function respondWithResult(_0x10ff16,_0x42696b){_0x42696b=_0x42696b||0xc8;return function(_0x4bfa22){if(_0x4bfa22){return _0x10ff16['status'](_0x42696b)[_0xe530('0x26')](_0x4bfa22);}};}function respondWithFilteredResult(_0x56e064,_0x4564f5){return function(_0xba4818){if(_0xba4818){var _0x436eaf=typeof _0x4564f5[_0xe530('0x27')]===_0xe530('0x28')&&typeof _0x4564f5[_0xe530('0x29')]===_0xe530('0x28');var _0x2dd206=_0xba4818[_0xe530('0x2a')];var _0x3b4606=_0x436eaf?0x0:_0x4564f5[_0xe530('0x27')];var _0x591265=_0x436eaf?_0xba4818['count']:_0x4564f5[_0xe530('0x27')]+_0x4564f5['limit'];var _0x393f1e;if(_0x591265>=_0x2dd206){_0x591265=_0x2dd206;_0x393f1e=0xc8;}else{_0x393f1e=0xce;}_0x56e064['status'](_0x393f1e);return _0x56e064[_0xe530('0x2b')](_0xe530('0x2c'),_0x3b4606+'-'+_0x591265+'/'+_0x2dd206)[_0xe530('0x26')](_0xba4818);}return null;};}function patchUpdates(_0xaee18d){return function(_0x3de672){try{jsonpatch[_0xe530('0x2d')](_0x3de672,_0xaee18d,!![]);}catch(_0x50fa81){return BPromise[_0xe530('0x2e')](_0x50fa81);}return _0x3de672[_0xe530('0x2f')]();};}function saveUpdates(_0x302bc2,_0x1a644a){return function(_0xfcaa74){if(_0xfcaa74){return _0xfcaa74[_0xe530('0x30')](_0x302bc2)[_0xe530('0x1a')](function(_0x4c715c){return _0x4c715c;});}return null;};}function removeEntity(_0x2b97f0,_0x41d381){return function(_0x3187d8){if(_0x3187d8){return _0x3187d8[_0xe530('0x31')]()[_0xe530('0x1a')](function(){_0x2b97f0[_0xe530('0x24')](0xcc)[_0xe530('0x25')]();});}};}function handleEntityNotFound(_0x4064fc,_0x487dc9){return function(_0x3ae87c){if(!_0x3ae87c){_0x4064fc[_0xe530('0x32')](0x194);}return _0x3ae87c;};}function handleError(_0xaa4f0,_0x4cd411){_0x4cd411=_0x4cd411||0x1f4;return function(_0x3438c6){logger[_0xe530('0x1f')](_0x3438c6[_0xe530('0x33')]);if(_0x3438c6['name']){delete _0x3438c6['name'];}_0xaa4f0[_0xe530('0x24')](_0x4cd411)['send'](_0x3438c6);};}exports[_0xe530('0x34')]=function(_0x403e1f,_0x330c33){var _0x26726e={},_0x2040da={},_0x5a4aec={'count':0x0,'rows':[]};var _0x360ae9=_[_0xe530('0x35')](db[_0xe530('0x36')]['rawAttributes'],function(_0x5f540d){return{'name':_0x5f540d[_0xe530('0x37')],'type':_0x5f540d[_0xe530('0x38')][_0xe530('0x39')]};});_0x2040da[_0xe530('0x3a')]=_[_0xe530('0x35')](_0x360ae9,_0xe530('0x3b'));_0x2040da[_0xe530('0x3c')]=_['keys'](_0x403e1f['query']);_0x2040da[_0xe530('0x3d')]=_[_0xe530('0x3e')](_0x2040da[_0xe530('0x3a')],_0x2040da['query']);_0x26726e[_0xe530('0x3f')]=_[_0xe530('0x3e')](_0x2040da[_0xe530('0x3a')],qs['fields'](_0x403e1f['query'][_0xe530('0x40')]));_0x26726e[_0xe530('0x3f')]=_0x26726e[_0xe530('0x3f')][_0xe530('0x41')]?_0x26726e[_0xe530('0x3f')]:_0x2040da[_0xe530('0x3a')];if(!_0x403e1f[_0xe530('0x3c')][_0xe530('0x42')](_0xe530('0x43'))){_0x26726e[_0xe530('0x29')]=qs[_0xe530('0x29')](_0x403e1f[_0xe530('0x3c')][_0xe530('0x29')]);_0x26726e[_0xe530('0x27')]=qs['offset'](_0x403e1f[_0xe530('0x3c')][_0xe530('0x27')]);}_0x26726e['order']=qs['sort'](_0x403e1f['query'][_0xe530('0x44')]);_0x26726e[_0xe530('0x45')]=qs[_0xe530('0x3d')](_[_0xe530('0x46')](_0x403e1f['query'],_0x2040da['filters']),_0x360ae9);if(_0x403e1f[_0xe530('0x3c')]['filter']){_0x26726e[_0xe530('0x45')]=_[_0xe530('0x47')](_0x26726e[_0xe530('0x45')],{'$or':_[_0xe530('0x35')](_0x360ae9,function(_0x2dc2fc){if(_0x2dc2fc[_0xe530('0x38')]!==_0xe530('0x48')){var _0x95da79={};_0x95da79[_0x2dc2fc[_0xe530('0x3b')]]={'$like':'%'+_0x403e1f['query'][_0xe530('0x49')]+'%'};return _0x95da79;}})});}_0x26726e=_['merge']({},_0x26726e,_0x403e1f[_0xe530('0x4a')]);var _0xb2e1ff={'where':_0x26726e['where']};return db[_0xe530('0x36')][_0xe530('0x2a')](_0xb2e1ff)['then'](function(_0x43e64d){_0x5a4aec[_0xe530('0x2a')]=_0x43e64d;if(_0x403e1f[_0xe530('0x3c')][_0xe530('0x4b')]){_0x26726e['include']=[{'all':!![]}];}return db[_0xe530('0x36')][_0xe530('0x4c')](_0x26726e);})[_0xe530('0x1a')](function(_0x35a330){_0x5a4aec['rows']=_0x35a330;return _0x5a4aec;})[_0xe530('0x1a')](respondWithFilteredResult(_0x330c33,_0x26726e))['catch'](handleError(_0x330c33,null));};exports['show']=function(_0x24af3b,_0x6716c0){var _0xbb7e44={'raw':![],'where':{'id':_0x24af3b[_0xe530('0x4d')]['id']}},_0x2b20c2={};_0x2b20c2[_0xe530('0x3a')]=_[_0xe530('0x4e')](db[_0xe530('0x36')][_0xe530('0x4f')]);_0x2b20c2[_0xe530('0x3c')]=_[_0xe530('0x4e')](_0x24af3b[_0xe530('0x3c')]);_0x2b20c2[_0xe530('0x3d')]=_['intersection'](_0x2b20c2[_0xe530('0x3a')],_0x2b20c2['query']);_0xbb7e44[_0xe530('0x3f')]=_[_0xe530('0x3e')](_0x2b20c2[_0xe530('0x3a')],qs[_0xe530('0x40')](_0x24af3b['query']['fields']));_0xbb7e44[_0xe530('0x3f')]=_0xbb7e44[_0xe530('0x3f')][_0xe530('0x41')]?_0xbb7e44[_0xe530('0x3f')]:_0x2b20c2[_0xe530('0x3a')];if(_0x24af3b[_0xe530('0x3c')][_0xe530('0x4b')]){_0xbb7e44[_0xe530('0x50')]=[{'all':!![]}];}_0xbb7e44=_[_0xe530('0x47')]({},_0xbb7e44,_0x24af3b['options']);return db['Setting'][_0xe530('0x51')](_0xbb7e44)[_0xe530('0x1a')](handleEntityNotFound(_0x6716c0,null))['then'](respondWithResult(_0x6716c0,null))['catch'](handleError(_0x6716c0,null));};exports[_0xe530('0x30')]=function(_0x38e360,_0x39c0d1){if(_0x38e360[_0xe530('0x52')]['id']){delete _0x38e360[_0xe530('0x52')]['id'];}return db['Setting'][_0xe530('0x51')]({'where':{'id':_0x38e360[_0xe530('0x4d')]['id']}})[_0xe530('0x1a')](handleEntityNotFound(_0x39c0d1,null))[_0xe530('0x1a')](saveUpdates(_0x38e360[_0xe530('0x52')],null))[_0xe530('0x1a')](respondWithResult(_0x39c0d1,null))[_0xe530('0x53')](handleError(_0x39c0d1,null));};exports[_0xe530('0x54')]=function(_0x51d2d4,_0x5b881b,_0x429913){if(_0x51d2d4[_0xe530('0x55')]&&_0x51d2d4[_0xe530('0x55')]['filename']){_0x51d2d4[_0xe530('0x52')]['logo']=_0x51d2d4[_0xe530('0x55')][_0xe530('0x56')];}return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x51d2d4[_0xe530('0x4d')]['id']}})[_0xe530('0x1a')](handleEntityNotFound(_0x5b881b,null))[_0xe530('0x1a')](saveUpdates(_0x51d2d4['body'],null))[_0xe530('0x1a')](respondWithResult(_0x5b881b,null))[_0xe530('0x53')](handleError(_0x5b881b,null));};exports[_0xe530('0x57')]=function(_0x4a134d,_0xbc9a66,_0x3ddcc5){if(_0x4a134d[_0xe530('0x55')]&&_0x4a134d['file'][_0xe530('0x56')]){_0x4a134d[_0xe530('0x52')][_0xe530('0x58')]=_0x4a134d[_0xe530('0x55')][_0xe530('0x56')];}return db[_0xe530('0x36')]['find']({'where':{'id':_0x4a134d['params']['id']}})[_0xe530('0x1a')](handleEntityNotFound(_0xbc9a66,null))[_0xe530('0x1a')](saveUpdates(_0x4a134d[_0xe530('0x52')],null))[_0xe530('0x1a')](respondWithResult(_0xbc9a66,null))['catch'](handleError(_0xbc9a66,null));};var utilLicense=require(_0xe530('0x16'));exports[_0xe530('0x59')]=function(_0x802343,_0x2982d9,_0x2d199c){var _0x55228f=_0xe530('0x5a');var _0x795439={'custom':![]};return utilLicense[_0xe530('0x5b')]()[_0xe530('0x1a')](function(_0x3076e7){if(_0x3076e7){_0x795439=_0x3076e7;}return db[_0xe530('0x36')]['find']({'where':{'id':_0x802343[_0xe530('0x4d')]['id']},'attributes':[_0xe530('0x5c'),_0xe530('0x58'),'preferred',_0xe530('0x5d'),_0xe530('0x5e'),_0xe530('0x5f'),_0xe530('0x60'),_0xe530('0x61')],'raw':!![]});})[_0xe530('0x1a')](handleEntityNotFound(_0x2982d9,null))[_0xe530('0x1a')](function(_0x221720){if(_0x221720){var _0x53a3df=_0x221720[_0xe530('0x5c')]&&fs[_0xe530('0x62')](path[_0xe530('0x63')](config[_0xe530('0x64')],_0x55228f,_[_0xe530('0x65')](_0x221720[_0xe530('0x5c')])))?path[_0xe530('0x63')](config[_0xe530('0x64')],_0x55228f,_['toLower'](_0x221720[_0xe530('0x5c')])):path[_0xe530('0x63')](config[_0xe530('0x64')],_0x55228f,_[_0xe530('0x65')](_0xe530('0x66')));var _0x167628=_0xe530('0x67')+_[_0xe530('0x68')]('logo');if(_0x221720[_0x167628]||!_0x795439[_0xe530('0x69')]){_0x53a3df=path['join'](config['root'],_0x55228f,_[_0xe530('0x65')](_0xe530('0x66')));}if(!fs[_0xe530('0x62')](_0x53a3df)){throw new db[(_0xe530('0x6a'))]['ValidationError'](_[_0xe530('0x68')](_0xe530('0x5c'))+_0xe530('0x6b'));}return _0x2982d9[_0xe530('0x6c')](_0x53a3df);}})['catch'](handleError(_0x2982d9,null));};var utilLicense=require(_0xe530('0x16'));exports[_0xe530('0x6d')]=function(_0x5c52bd,_0x291284,_0x256c5c){var _0x4048f5=_0xe530('0x5a');var _0x5cda6c={'custom':![]};return utilLicense[_0xe530('0x5b')]()[_0xe530('0x1a')](function(_0x4626bc){if(_0x4626bc){_0x5cda6c=_0x4626bc;}return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x5c52bd[_0xe530('0x4d')]['id']},'attributes':[_0xe530('0x5c'),_0xe530('0x58'),_0xe530('0x6e'),_0xe530('0x5d'),_0xe530('0x5e'),_0xe530('0x5f'),_0xe530('0x60'),_0xe530('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x291284,null))[_0xe530('0x1a')](function(_0x20a7f6){if(_0x20a7f6){var _0x1ba9b0=_0x20a7f6[_0xe530('0x58')]&&fs[_0xe530('0x62')](path[_0xe530('0x63')](config['root'],_0x4048f5,_[_0xe530('0x65')](_0x20a7f6['loginLogo'])))?path[_0xe530('0x63')](config['root'],_0x4048f5,_[_0xe530('0x65')](_0x20a7f6[_0xe530('0x58')])):path[_0xe530('0x63')](config[_0xe530('0x64')],_0x4048f5,_[_0xe530('0x65')](_0xe530('0x6f')));var _0x167bfd='default'+_[_0xe530('0x68')](_0xe530('0x58'));if(_0x20a7f6[_0x167bfd]||!_0x5cda6c[_0xe530('0x69')]){_0x1ba9b0=path['join'](config[_0xe530('0x64')],_0x4048f5,_['toLower'](_0xe530('0x6f')));}if(!fs[_0xe530('0x62')](_0x1ba9b0)){throw new db['Sequelize'][(_0xe530('0x70'))](_['upperFirst'](_0xe530('0x58'))+_0xe530('0x6b'));}return _0x291284[_0xe530('0x6c')](_0x1ba9b0);}})[_0xe530('0x53')](handleError(_0x291284,null));};exports[_0xe530('0x71')]=function(_0x993cb4,_0x7f2744){return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x993cb4[_0xe530('0x4d')]['id']},'attributes':['securePassword']})[_0xe530('0x1a')](respondWithResult(_0x7f2744,null))[_0xe530('0x53')](handleError(_0x7f2744,null));};exports[_0xe530('0x72')]=function(_0x576244,_0x1f163a,_0x4400c9){if(_0x576244[_0xe530('0x55')]&&_0x576244[_0xe530('0x55')]['filename']){_0x576244['body']['preferred']=_0x576244[_0xe530('0x55')][_0xe530('0x56')];}return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0x576244[_0xe530('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f163a,null))[_0xe530('0x1a')](saveUpdates(_0x576244['body'],null))[_0xe530('0x1a')](respondWithResult(_0x1f163a,null))['catch'](handleError(_0x1f163a,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x50d3bb,_0x40a3c8,_0x226f8c){var _0x21b5f5=_0xe530('0x5a');var _0x15162b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x457e26){if(_0x457e26){_0x15162b=_0x457e26;}return db['Setting']['find']({'where':{'id':_0x50d3bb[_0xe530('0x4d')]['id']},'attributes':[_0xe530('0x5c'),_0xe530('0x58'),'preferred',_0xe530('0x5d'),'defaultLogo',_0xe530('0x5f'),_0xe530('0x60'),_0xe530('0x61')],'raw':!![]});})[_0xe530('0x1a')](handleEntityNotFound(_0x40a3c8,null))['then'](function(_0x23a760){if(_0x23a760){var _0x2e673c=_0x23a760[_0xe530('0x6e')]&&fs[_0xe530('0x62')](path[_0xe530('0x63')](config[_0xe530('0x64')],_0x21b5f5,_[_0xe530('0x65')](_0x23a760[_0xe530('0x6e')])))?path[_0xe530('0x63')](config['root'],_0x21b5f5,_[_0xe530('0x65')](_0x23a760[_0xe530('0x6e')])):path['join'](config[_0xe530('0x64')],_0x21b5f5,_[_0xe530('0x65')]('default_preferred.png'));var _0x383704=_0xe530('0x67')+_[_0xe530('0x68')](_0xe530('0x6e'));if(_0x23a760[_0x383704]||!_0x15162b[_0xe530('0x69')]||!_0x15162b[_0xe530('0x6e')]){_0x2e673c=path[_0xe530('0x63')](config[_0xe530('0x64')],_0x21b5f5,_[_0xe530('0x65')](_0xe530('0x73')));}if(!fs[_0xe530('0x62')](_0x2e673c)){throw new db[(_0xe530('0x6a'))][(_0xe530('0x70'))](_[_0xe530('0x68')](_0xe530('0x6e'))+_0xe530('0x6b'));}return _0x40a3c8['download'](_0x2e673c);}})[_0xe530('0x53')](handleError(_0x40a3c8,null));};exports[_0xe530('0x74')]=function(_0xe63f8d,_0x503d2c,_0x53bc97){if(_0xe63f8d['file']&&_0xe63f8d[_0xe530('0x55')]['filename']){_0xe63f8d['body'][_0xe530('0x5d')]=_0xe63f8d[_0xe530('0x55')][_0xe530('0x56')];}return db[_0xe530('0x36')][_0xe530('0x51')]({'where':{'id':_0xe63f8d['params']['id']}})['then'](handleEntityNotFound(_0x503d2c,null))[_0xe530('0x1a')](saveUpdates(_0xe63f8d[_0xe530('0x52')],null))[_0xe530('0x1a')](respondWithResult(_0x503d2c,null))['catch'](handleError(_0x503d2c,null));};var utilLicense=require(_0xe530('0x16'));exports['getFavicon']=function(_0x36bfbd,_0x50626b,_0x28bc96){var _0xc09ff6=_0xe530('0x5a');var _0x45d8f8={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4fc647){if(_0x4fc647){_0x45d8f8=_0x4fc647;}return db['Setting'][_0xe530('0x51')]({'where':{'id':_0x36bfbd[_0xe530('0x4d')]['id']},'attributes':[_0xe530('0x5c'),_0xe530('0x58'),_0xe530('0x6e'),'favicon',_0xe530('0x5e'),_0xe530('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xe530('0x1a')](handleEntityNotFound(_0x50626b,null))[_0xe530('0x1a')](function(_0x12d70c){if(_0x12d70c){var _0x2c257e=_0x12d70c['favicon']&&fs[_0xe530('0x62')](path[_0xe530('0x63')](config[_0xe530('0x64')],_0xc09ff6,_[_0xe530('0x65')](_0x12d70c['favicon'])))?path[_0xe530('0x63')](config[_0xe530('0x64')],_0xc09ff6,_[_0xe530('0x65')](_0x12d70c[_0xe530('0x5d')])):path[_0xe530('0x63')](config['root'],_0xc09ff6,_[_0xe530('0x65')](_0xe530('0x75')));var _0x5cbfd2=_0xe530('0x67')+_[_0xe530('0x68')](_0xe530('0x5d'));if(_0x12d70c[_0x5cbfd2]||!_0x45d8f8[_0xe530('0x69')]){_0x2c257e=path[_0xe530('0x63')](config[_0xe530('0x64')],_0xc09ff6,_[_0xe530('0x65')](_0xe530('0x75')));}if(!fs[_0xe530('0x62')](_0x2c257e)){throw new db[(_0xe530('0x6a'))][(_0xe530('0x70'))](_[_0xe530('0x68')](_0xe530('0x5d'))+_0xe530('0x6b'));}return _0x50626b['download'](_0x2c257e);}})[_0xe530('0x53')](handleError(_0x50626b,null));};exports[_0xe530('0x76')]=function(_0x5284ae,_0x1469d7){var _0x43b6de={'offset':moment()['utcOffset']()};_0x43b6de[_0xe530('0x77')]=moment()['utcOffset'](_0x43b6de['offset'])[_0xe530('0x78')](_0xe530('0x79'));return _0x1469d7[_0xe530('0x24')](0xc8)['send'](_0x43b6de);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6e9cbc6..34c8161 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x008c,0x188));var _0xc008=function(_0x110479,_0x492d7b){_0x110479=_0x110479-0x0;var _0x55335=_0x008c[_0x110479];return _0x55335;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x2f002a,_0x299399){var _0x346cbf=function(_0x57760e){while(--_0x57760e){_0x2f002a['push'](_0x2f002a['shift']());}};_0x346cbf(++_0x299399);}(_0xedd9,0xfc));var _0x9edd=function(_0x341577,_0x24fcc0){_0x341577=_0x341577-0x0;var _0x558ed4=_0xedd9[_0x341577];return _0x558ed4;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 6c17452..efaf0c4 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 _0x3fb5=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSetting','Setting','options','raw','attributes','include','model','map','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x1e20a1,_0x537772){var _0x29de0a=function(_0x265146){while(--_0x265146){_0x1e20a1['push'](_0x1e20a1['shift']());}};_0x29de0a(++_0x537772);}(_0x3fb5,0x6c));var _0x53fb=function(_0x1138d3,_0x47fea5){_0x1138d3=_0x1138d3-0x0;var _0x9a0af0=_0x3fb5[_0x1138d3];return _0x9a0af0;};'use strict';var _=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var moment=require('moment');var BPromise=require(_0x53fb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53fb('0x3'));var db=require(_0x53fb('0x4'))['db'];var utils=require(_0x53fb('0x5'));var logger=require(_0x53fb('0x6'))('rpc');var config=require(_0x53fb('0x7'));var jayson=require(_0x53fb('0x8'));var client=jayson[_0x53fb('0x9')][_0x53fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8d0b,_0x23bd82,_0x1573f2){return new BPromise(function(_0x619f3f,_0x1a12a6){return client['request'](_0x2b8d0b,_0x1573f2)[_0x53fb('0xb')](function(_0x5988f5){logger[_0x53fb('0xc')](_0x53fb('0xd'),_0x23bd82,_0x53fb('0xe'));logger[_0x53fb('0xf')](_0x53fb('0x10'),_0x23bd82,_0x53fb('0xe'),JSON[_0x53fb('0x11')](_0x5988f5));if(_0x5988f5[_0x53fb('0x12')]){if(_0x5988f5['error']['code']===0x1f4){logger[_0x53fb('0x12')]('Setting,\x20%s,\x20%s',_0x23bd82,_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);return _0x1a12a6(_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);}logger[_0x53fb('0x12')](_0x53fb('0xd'),_0x23bd82,_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);return _0x619f3f(_0x5988f5[_0x53fb('0x12')]['message']);}else{logger[_0x53fb('0xc')]('Setting,\x20%s,\x20%s',_0x23bd82,_0x53fb('0xe'));_0x619f3f(_0x5988f5[_0x53fb('0x14')][_0x53fb('0x13')]);}})['catch'](function(_0x2e25c0){logger['error'](_0x53fb('0xd'),_0x23bd82,_0x2e25c0);_0x1a12a6(_0x2e25c0);});});}exports[_0x53fb('0x15')]=function(_0x13bbe4){var _0x574419=this;return new Promise(function(_0x4d7f5b,_0x273174){return db[_0x53fb('0x16')]['find']({'raw':_0x13bbe4['options']?_0x13bbe4[_0x53fb('0x17')][_0x53fb('0x18')]===undefined?!![]:![]:!![],'where':_0x13bbe4[_0x53fb('0x17')]?_0x13bbe4[_0x53fb('0x17')]['where']||null:null,'attributes':_0x13bbe4['options']?_0x13bbe4['options'][_0x53fb('0x19')]||null:null,'include':_0x13bbe4[_0x53fb('0x17')]?_0x13bbe4['options'][_0x53fb('0x1a')]?_['map'](_0x13bbe4[_0x53fb('0x17')][_0x53fb('0x1a')],function(_0x5d3b65){return{'model':db[_0x5d3b65[_0x53fb('0x1b')]],'as':_0x5d3b65['as'],'attributes':_0x5d3b65[_0x53fb('0x19')],'include':_0x5d3b65['include']?_[_0x53fb('0x1c')](_0x5d3b65[_0x53fb('0x1a')],function(_0x2239cc){return{'model':db[_0x2239cc[_0x53fb('0x1b')]],'as':_0x2239cc['as'],'attributes':_0x2239cc[_0x53fb('0x19')],'include':_0x2239cc[_0x53fb('0x1a')]?_[_0x53fb('0x1c')](_0x2239cc['include'],function(_0x1c6442){return{'model':db[_0x1c6442[_0x53fb('0x1b')]],'as':_0x1c6442['as'],'attributes':_0x1c6442['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32cd9b){logger[_0x53fb('0xc')](_0x53fb('0x15'),_0x13bbe4);logger['debug'](_0x53fb('0x15'),_0x13bbe4,JSON[_0x53fb('0x11')](_0x32cd9b));_0x4d7f5b(_0x32cd9b);})[_0x53fb('0x1d')](function(_0x3c54ee){logger[_0x53fb('0x12')]('ShowSetting',_0x3c54ee[_0x53fb('0x13')],_0x13bbe4);_0x273174(_0x574419[_0x53fb('0x12')](0x1f4,_0x3c54ee[_0x53fb('0x13')]));});});}; \ No newline at end of file +var _0x9a95=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting','find','options','raw','where','attributes','include','map','model','then','ShowSetting','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x5bd436,_0x52a267){var _0x1ee2c2=function(_0x530b14){while(--_0x530b14){_0x5bd436['push'](_0x5bd436['shift']());}};_0x1ee2c2(++_0x52a267);}(_0x9a95,0x15f));var _0x59a9=function(_0x2f08a1,_0x295d31){_0x2f08a1=_0x2f08a1-0x0;var _0x217da7=_0x9a95[_0x2f08a1];return _0x217da7;};'use strict';var _=require(_0x59a9('0x0'));var util=require(_0x59a9('0x1'));var moment=require('moment');var BPromise=require(_0x59a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x59a9('0x4'));var logger=require(_0x59a9('0x5'))(_0x59a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x59a9('0x7'));var client=jayson[_0x59a9('0x8')][_0x59a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x219ab0,_0x3286a4,_0x3f952b){return new BPromise(function(_0x5eee13,_0x4b4ed0){return client[_0x59a9('0xa')](_0x219ab0,_0x3f952b)['then'](function(_0x21a63e){logger[_0x59a9('0xb')](_0x59a9('0xc'),_0x3286a4,_0x59a9('0xd'));logger[_0x59a9('0xe')](_0x59a9('0xf'),_0x3286a4,_0x59a9('0xd'),JSON[_0x59a9('0x10')](_0x21a63e));if(_0x21a63e['error']){if(_0x21a63e[_0x59a9('0x11')][_0x59a9('0x12')]===0x1f4){logger[_0x59a9('0x11')](_0x59a9('0xc'),_0x3286a4,_0x21a63e[_0x59a9('0x11')]['message']);return _0x4b4ed0(_0x21a63e[_0x59a9('0x11')]['message']);}logger['error'](_0x59a9('0xc'),_0x3286a4,_0x21a63e['error'][_0x59a9('0x13')]);return _0x5eee13(_0x21a63e['error'][_0x59a9('0x13')]);}else{logger[_0x59a9('0xb')](_0x59a9('0xc'),_0x3286a4,_0x59a9('0xd'));_0x5eee13(_0x21a63e[_0x59a9('0x14')][_0x59a9('0x13')]);}})[_0x59a9('0x15')](function(_0xbff729){logger[_0x59a9('0x11')]('Setting,\x20%s,\x20%s',_0x3286a4,_0xbff729);_0x4b4ed0(_0xbff729);});});}exports['ShowSetting']=function(_0x420495){var _0x1eec94=this;return new Promise(function(_0x39455c,_0x3ef895){return db[_0x59a9('0x16')][_0x59a9('0x17')]({'raw':_0x420495[_0x59a9('0x18')]?_0x420495[_0x59a9('0x18')][_0x59a9('0x19')]===undefined?!![]:![]:!![],'where':_0x420495['options']?_0x420495[_0x59a9('0x18')][_0x59a9('0x1a')]||null:null,'attributes':_0x420495[_0x59a9('0x18')]?_0x420495[_0x59a9('0x18')][_0x59a9('0x1b')]||null:null,'include':_0x420495[_0x59a9('0x18')]?_0x420495[_0x59a9('0x18')][_0x59a9('0x1c')]?_[_0x59a9('0x1d')](_0x420495[_0x59a9('0x18')][_0x59a9('0x1c')],function(_0x3ff9f9){return{'model':db[_0x3ff9f9[_0x59a9('0x1e')]],'as':_0x3ff9f9['as'],'attributes':_0x3ff9f9['attributes'],'include':_0x3ff9f9[_0x59a9('0x1c')]?_['map'](_0x3ff9f9[_0x59a9('0x1c')],function(_0x4db078){return{'model':db[_0x4db078[_0x59a9('0x1e')]],'as':_0x4db078['as'],'attributes':_0x4db078[_0x59a9('0x1b')],'include':_0x4db078[_0x59a9('0x1c')]?_[_0x59a9('0x1d')](_0x4db078['include'],function(_0x5b9d39){return{'model':db[_0x5b9d39[_0x59a9('0x1e')]],'as':_0x5b9d39['as'],'attributes':_0x5b9d39['attributes']};}):[]};}):[]};}):[]:[]})[_0x59a9('0x1f')](function(_0x1263e5){logger[_0x59a9('0xb')]('ShowSetting',_0x420495);logger[_0x59a9('0xe')](_0x59a9('0x20'),_0x420495,JSON['stringify'](_0x1263e5));_0x39455c(_0x1263e5);})[_0x59a9('0x15')](function(_0x30715a){logger[_0x59a9('0x11')](_0x59a9('0x20'),_0x30715a['message'],_0x420495);_0x3ef895(_0x1eec94[_0x59a9('0x11')](0x1f4,_0x30715a[_0x59a9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2d737d8..620eda7 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x309ad8,_0x3365a0){var _0x3114d4=function(_0x526e93){while(--_0x526e93){_0x309ad8['push'](_0x309ad8['shift']());}};_0x3114d4(++_0x3365a0);}(_0x326f,0xd1));var _0xf326=function(_0x59b98a,_0x353dae){_0x59b98a=_0x59b98a-0x0;var _0x479258=_0x326f[_0x59b98a];return _0x479258;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x206315,_0x54b9ec){var _0x4d8de0=function(_0x1b9ccd){while(--_0x1b9ccd){_0x206315['push'](_0x206315['shift']());}};_0x4d8de0(++_0x54b9ec);}(_0x5fab,0x177));var _0xb5fa=function(_0x50e67a,_0x1784b8){_0x50e67a=_0x50e67a-0x0;var _0x34ff8d=_0x5fab[_0x50e67a];return _0x34ff8d;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index fb2aec0..33312a3 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 _0xc67e=['clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','skebby','connectel','clicksend','plivo'];(function(_0x434b89,_0x17d347){var _0x20171e=function(_0x3e3d80){while(--_0x3e3d80){_0x434b89['push'](_0x434b89['shift']());}};_0x20171e(++_0x17d347);}(_0xc67e,0xc9));var _0xec67=function(_0x38cf85,_0x234c29){_0x38cf85=_0x38cf85-0x0;var _0x5a4c10=_0xc67e[_0x38cf85];return _0x5a4c10;};'use strict';var Sequelize=require(_0xec67('0x0'));var rs=require(_0xec67('0x1'));module['exports']={'name':{'type':Sequelize[_0xec67('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xec67('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xec67('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xec67('0x2')],'defaultValue':function(){return rs[_0xec67('0x3')]();}},'phone':{'type':Sequelize[_0xec67('0x2')]},'type':{'type':Sequelize[_0xec67('0x4')]('twilio',_0xec67('0x5'),_0xec67('0x6'),_0xec67('0x7'),_0xec67('0x8'),_0xec67('0x9'),_0xec67('0xa'),_0xec67('0xb'),_0xec67('0xc'),_0xec67('0xd'))},'accountSid':{'type':Sequelize[_0xec67('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xec67('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xec67('0x2')]},'apiKey':{'type':Sequelize[_0xec67('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xec67('0x2')]},'senderString':{'type':Sequelize[_0xec67('0x2')]},'deliveryReport':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xec67('0x2')]},'notificationTemplate':{'type':Sequelize[_0xec67('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xec67('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec67('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xec67('0x11'),'set':function(_0x2cdfe9){if(!_0x2cdfe9)this[_0xec67('0x12')](_0xec67('0x13'),null);this[_0xec67('0x12')](_0xec67('0x14'),_0x2cdfe9);}}}; \ No newline at end of file +var _0xfe2a=['connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xfe2a,0xe0));var _0xafe2=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xfe2a[_0x4dbaad];return _0x226c72;};'use strict';var Sequelize=require(_0xafe2('0x0'));var rs=require(_0xafe2('0x1'));module['exports']={'name':{'type':Sequelize[_0xafe2('0x2')],'unique':_0xafe2('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xafe2('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xafe2('0x4')]();}},'phone':{'type':Sequelize[_0xafe2('0x2')]},'type':{'type':Sequelize[_0xafe2('0x5')](_0xafe2('0x6'),'skebby',_0xafe2('0x7'),_0xafe2('0x8'),_0xafe2('0x9'),'clickatell',_0xafe2('0xa'),_0xafe2('0xb'),_0xafe2('0xc'),_0xafe2('0xd'))},'accountSid':{'type':Sequelize[_0xafe2('0x2')]},'authId':{'type':Sequelize[_0xafe2('0x2')]},'authToken':{'type':Sequelize[_0xafe2('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xafe2('0x2')]},'password':{'type':Sequelize[_0xafe2('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xafe2('0x2')]},'accountId':{'type':Sequelize[_0xafe2('0x2')]},'senderString':{'type':Sequelize[_0xafe2('0x2')]},'deliveryReport':{'type':Sequelize[_0xafe2('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xafe2('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xafe2('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafe2('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xafe2('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xafe2('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xafe2('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xafe2('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xafe2('0xe')],'defaultValue':![],'comment':_0xafe2('0x11'),'set':function(_0xa3894){if(!_0xa3894)this[_0xafe2('0x12')](_0xafe2('0x13'),null);this[_0xafe2('0x12')](_0xafe2('0x14'),_0xa3894);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 51c2830..a12ff6b 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 _0x325d=['skebby_dispatch_id','requestid','statusInt','status_code','infobip','bandwidth','redif','DELIVERED','error_code','groupName','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','reject','update','destroy','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','includeAll','include','findAll','params','keys','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','notify','sms','SmsApplication','applications','orderBy','priority','asc','account','Applications','CmContact','Sequelize','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','json','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','updatedAt','Messages','dataValues','received\x20delivery\x20report\x20from','inspect'];(function(_0x445495,_0x2e38d8){var _0x32c09f=function(_0x4782ed){while(--_0x4782ed){_0x445495['push'](_0x445495['shift']());}};_0x32c09f(++_0x2e38d8);}(_0x325d,0x103));var _0xd325=function(_0x2b554e,_0x589230){_0x2b554e=_0x2b554e-0x0;var _0xd19aed=_0x325d[_0x2b554e];return _0xd19aed;};'use strict';var emlformat=require(_0xd325('0x0'));var rimraf=require(_0xd325('0x1'));var zipdir=require(_0xd325('0x2'));var jsonpatch=require(_0xd325('0x3'));var rp=require(_0xd325('0x4'));var moment=require(_0xd325('0x5'));var BPromise=require(_0xd325('0x6'));var Mustache=require(_0xd325('0x7'));var util=require('util');var path=require(_0xd325('0x8'));var sox=require(_0xd325('0x9'));var csv=require(_0xd325('0xa'));var ejs=require(_0xd325('0xb'));var fs=require('fs');var fs_extra=require(_0xd325('0xc'));var _=require(_0xd325('0xd'));var squel=require(_0xd325('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd325('0xf'));var toCsv=require(_0xd325('0xa'));var querystring=require(_0xd325('0x10'));var Papa=require('papaparse');var Redis=require(_0xd325('0x11'));var authService=require(_0xd325('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd325('0x13'));var logger=require(_0xd325('0x14'))(_0xd325('0x15'));var utils=require(_0xd325('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd325('0x17'));var db=require(_0xd325('0x18'))['db'];config[_0xd325('0x19')]=_[_0xd325('0x1a')](config[_0xd325('0x19')],{'host':_0xd325('0x1b'),'port':0x18eb});var socket=require(_0xd325('0x1c'))(new Redis(config[_0xd325('0x19')]));require(_0xd325('0x1d'))[_0xd325('0x1e')](socket);var jayson=require(_0xd325('0x1f'));var client=jayson[_0xd325('0x20')][_0xd325('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x527730,_0x3aeb15,_0x1b96ac,_0x30eb41){return new BPromise(function(_0x442e1f,_0x3093ba){var _0x35b913=_0x30eb41||client;return _0x35b913[_0xd325('0x22')](_0x527730,_0x1b96ac)[_0xd325('0x23')](function(_0x4c7839){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3aeb15,_0xd325('0x24'));logger[_0xd325('0x25')](_0xd325('0x26'),_0x3aeb15,_0xd325('0x24'),JSON[_0xd325('0x27')](_0x4c7839));if(_0x4c7839[_0xd325('0x28')]){if(_0x4c7839['error']['code']===0x1f4){logger[_0xd325('0x28')](_0xd325('0x29'),_0x3aeb15,_0x4c7839['error'][_0xd325('0x2a')]);return _0x3093ba(_0x4c7839['error'][_0xd325('0x2a')]);}logger[_0xd325('0x28')](_0xd325('0x29'),_0x3aeb15,_0x4c7839[_0xd325('0x28')][_0xd325('0x2a')]);return _0x442e1f(_0x4c7839[_0xd325('0x28')][_0xd325('0x2a')]);}else{logger['info'](_0xd325('0x29'),_0x3aeb15,_0xd325('0x24'));_0x442e1f(_0x4c7839[_0xd325('0x2b')]['message']);}})[_0xd325('0x2c')](function(_0x2f2a9c){logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3aeb15,_0x2f2a9c);_0x3093ba(_0x2f2a9c);});});}function respondWithStatusCode(_0xf8e83a,_0x41d63a){_0x41d63a=_0x41d63a||0xcc;return function(_0x4c68d5){if(_0x4c68d5){return _0xf8e83a[_0xd325('0x2d')](_0x41d63a);}return _0xf8e83a['status'](_0x41d63a)[_0xd325('0x2e')]();};}function respondWithResult(_0x56e93b,_0x1fd463){_0x1fd463=_0x1fd463||0xc8;return function(_0x45d2f9){if(_0x45d2f9){return _0x56e93b[_0xd325('0x2f')](_0x1fd463)['json'](_0x45d2f9);}};}function respondWithFilteredResult(_0x572659,_0x4b3edb){return function(_0x2dfcbf){if(_0x2dfcbf){var _0x1673d3=typeof _0x4b3edb[_0xd325('0x30')]===_0xd325('0x31')&&typeof _0x4b3edb[_0xd325('0x32')]===_0xd325('0x31');var _0x145780=_0x2dfcbf[_0xd325('0x33')];var _0x293d66=_0x1673d3?0x0:_0x4b3edb[_0xd325('0x30')];var _0x217bfb=_0x1673d3?_0x2dfcbf[_0xd325('0x33')]:_0x4b3edb[_0xd325('0x30')]+_0x4b3edb['limit'];var _0x665f4c;if(_0x217bfb>=_0x145780){_0x217bfb=_0x145780;_0x665f4c=0xc8;}else{_0x665f4c=0xce;}_0x572659[_0xd325('0x2f')](_0x665f4c);return _0x572659[_0xd325('0x34')]('Content-Range',_0x293d66+'-'+_0x217bfb+'/'+_0x145780)['json'](_0x2dfcbf);}return null;};}function patchUpdates(_0x3aaa68){return function(_0x43dca8){try{jsonpatch['apply'](_0x43dca8,_0x3aaa68,!![]);}catch(_0x5635f8){return BPromise[_0xd325('0x35')](_0x5635f8);}return _0x43dca8['save']();};}function saveUpdates(_0x50157f,_0x23c95f){return function(_0x1d8ed1){if(_0x1d8ed1){return _0x1d8ed1[_0xd325('0x36')](_0x50157f)['then'](function(_0x38c6c2){return _0x38c6c2;});}return null;};}function removeEntity(_0x11a30e,_0x511134){return function(_0x5924f9){if(_0x5924f9){return _0x5924f9[_0xd325('0x37')]()['then'](function(){var _0x3b5a2a=_0x5924f9['get']({'plain':!![]});var _0x324c57=_0xd325('0x38');return db[_0xd325('0x39')][_0xd325('0x37')]({'where':{'type':_0x324c57,'resourceId':_0x3b5a2a['id']}})[_0xd325('0x23')](function(){return _0x5924f9;});})[_0xd325('0x23')](function(){_0x11a30e[_0xd325('0x2f')](0xcc)[_0xd325('0x2e')]();});}};}function handleEntityNotFound(_0xa08093,_0x405b5c){return function(_0x135e2b){if(!_0x135e2b){_0xa08093[_0xd325('0x2d')](0x194);}return _0x135e2b;};}function handleError(_0x52bd0b,_0x530ec5){_0x530ec5=_0x530ec5||0x1f4;return function(_0x51f7d9){logger['error'](_0x51f7d9[_0xd325('0x3a')]);if(_0x51f7d9[_0xd325('0x3b')]){delete _0x51f7d9['name'];}_0x52bd0b['status'](_0x530ec5)['send'](_0x51f7d9);};}exports[_0xd325('0x3c')]=function(_0x2bae61,_0x10e002){var _0xcfdc43={'include':[{'model':db[_0xd325('0x3d')],'as':_0xd325('0x3e')}]},_0x30c619={},_0x2b6e9d={'count':0x0,'rows':[]};var _0x4b25cb=_[_0xd325('0x3f')](db[_0xd325('0x40')][_0xd325('0x41')],function(_0x112a1e){return{'name':_0x112a1e[_0xd325('0x42')],'type':_0x112a1e['type']['key']};});_0x30c619[_0xd325('0x43')]=_[_0xd325('0x3f')](_0x4b25cb,_0xd325('0x3b'));_0x30c619[_0xd325('0x44')]=_['keys'](_0x2bae61[_0xd325('0x44')]);_0x30c619['filters']=_['intersection'](_0x30c619[_0xd325('0x43')],_0x30c619['query']);_0xcfdc43['attributes']=_[_0xd325('0x45')](_0x30c619[_0xd325('0x43')],qs[_0xd325('0x46')](_0x2bae61['query'][_0xd325('0x46')]));_0xcfdc43[_0xd325('0x47')]=_0xcfdc43[_0xd325('0x47')][_0xd325('0x48')]?_0xcfdc43[_0xd325('0x47')]:_0x30c619[_0xd325('0x43')];if(!_0x2bae61['query'][_0xd325('0x49')]('nolimit')){_0xcfdc43[_0xd325('0x32')]=qs[_0xd325('0x32')](_0x2bae61[_0xd325('0x44')]['limit']);_0xcfdc43[_0xd325('0x30')]=qs['offset'](_0x2bae61[_0xd325('0x44')]['offset']);}_0xcfdc43['order']=qs[_0xd325('0x4a')](_0x2bae61['query'][_0xd325('0x4a')]);_0xcfdc43[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_['pick'](_0x2bae61['query'],_0x30c619[_0xd325('0x4c')]),_0x4b25cb);if(_0x2bae61[_0xd325('0x44')][_0xd325('0x4d')]){_0xcfdc43[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0xcfdc43[_0xd325('0x4b')],{'$or':_['map'](_0x4b25cb,function(_0x495b2e){if(_0x495b2e[_0xd325('0x4f')]!=='VIRTUAL'){var _0x3c1b2b={};_0x3c1b2b[_0x495b2e['name']]={'$like':'%'+_0x2bae61[_0xd325('0x44')]['filter']+'%'};return _0x3c1b2b;}})});}_0xcfdc43=_[_0xd325('0x4e')]({},_0xcfdc43,_0x2bae61['options']);var _0x4340c6={'where':_0xcfdc43['where']};return db[_0xd325('0x40')][_0xd325('0x33')](_0x4340c6)[_0xd325('0x23')](function(_0x154222){_0x2b6e9d[_0xd325('0x33')]=_0x154222;if(_0x2bae61[_0xd325('0x44')][_0xd325('0x50')]){_0xcfdc43[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x40')][_0xd325('0x52')](_0xcfdc43);})[_0xd325('0x23')](function(_0x44bf0e){_0x2b6e9d['rows']=_0x44bf0e;return _0x2b6e9d;})[_0xd325('0x23')](respondWithFilteredResult(_0x10e002,_0xcfdc43))[_0xd325('0x2c')](handleError(_0x10e002,null));};exports['show']=function(_0x376787,_0x6ede42){var _0x109f3c={'raw':![],'where':{'id':_0x376787[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2be0cc={};_0x2be0cc[_0xd325('0x43')]=_[_0xd325('0x54')](db[_0xd325('0x40')][_0xd325('0x41')]);_0x2be0cc[_0xd325('0x44')]=_[_0xd325('0x54')](_0x376787[_0xd325('0x44')]);_0x2be0cc['filters']=_['intersection'](_0x2be0cc[_0xd325('0x43')],_0x2be0cc[_0xd325('0x44')]);_0x109f3c[_0xd325('0x47')]=_[_0xd325('0x45')](_0x2be0cc[_0xd325('0x43')],qs[_0xd325('0x46')](_0x376787[_0xd325('0x44')]['fields']));_0x109f3c[_0xd325('0x47')]=_0x109f3c['attributes']['length']?_0x109f3c['attributes']:_0x2be0cc[_0xd325('0x43')];if(_0x376787['query'][_0xd325('0x50')]){_0x109f3c[_0xd325('0x51')]=[{'all':!![]}];}_0x109f3c=_['merge']({},_0x109f3c,_0x376787[_0xd325('0x55')]);return db[_0xd325('0x40')][_0xd325('0x56')](_0x109f3c)[_0xd325('0x23')](handleEntityNotFound(_0x6ede42,null))['then'](respondWithResult(_0x6ede42,null))[_0xd325('0x2c')](handleError(_0x6ede42,null));};exports[_0xd325('0x57')]=function(_0xefeb69,_0x5a2a86){return db[_0xd325('0x40')][_0xd325('0x57')](_0xefeb69[_0xd325('0x58')],{})[_0xd325('0x23')](function(_0x560a88){var _0x18f9e8=_0xefeb69['user'][_0xd325('0x59')]({'plain':!![]});if(!_0x18f9e8)throw new Error(_0xd325('0x5a'));if(_0x18f9e8['role']===_0xd325('0x5b')){var _0x570c2b=_0x560a88[_0xd325('0x59')]({'plain':!![]});var _0x3fdaf4='SmsAccounts';return db[_0xd325('0x5c')][_0xd325('0x56')]({'where':{'name':_0x3fdaf4,'userProfileId':_0x18f9e8[_0xd325('0x5d')]},'raw':!![]})[_0xd325('0x23')](function(_0x5694fe){if(_0x5694fe&&_0x5694fe[_0xd325('0x5e')]===0x0){return db[_0xd325('0x39')][_0xd325('0x57')]({'name':_0x570c2b[_0xd325('0x3b')],'resourceId':_0x570c2b['id'],'type':_0x5694fe[_0xd325('0x3b')],'sectionId':_0x5694fe['id']},{})[_0xd325('0x23')](function(){return _0x560a88;});}else{return _0x560a88;}})['catch'](function(_0x1ee97b){logger[_0xd325('0x28')](_0xd325('0x5f'),_0x1ee97b);throw _0x1ee97b;});}return _0x560a88;})[_0xd325('0x23')](respondWithResult(_0x5a2a86,0xc9))[_0xd325('0x2c')](handleError(_0x5a2a86,null));};exports['update']=function(_0x476871,_0x56fdd1){if(_0x476871[_0xd325('0x58')]['id']){delete _0x476871[_0xd325('0x58')]['id'];}return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x476871[_0xd325('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xd325('0x3e')}]})[_0xd325('0x23')](handleEntityNotFound(_0x56fdd1,null))['then'](saveUpdates(_0x476871[_0xd325('0x58')],null))[_0xd325('0x23')](respondWithResult(_0x56fdd1,null))[_0xd325('0x2c')](handleError(_0x56fdd1,null));};exports[_0xd325('0x37')]=function(_0x5f1f0c,_0x310656){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x5f1f0c[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x310656,null))[_0xd325('0x23')](removeEntity(_0x310656,null))['catch'](handleError(_0x310656,null));};exports[_0xd325('0x60')]=function(_0x39a862,_0x27b37e){return db['SmsAccount'][_0xd325('0x60')]()['then'](respondWithResult(_0x27b37e,null))[_0xd325('0x2c')](handleError(_0x27b37e,null));};exports[_0xd325('0x61')]=function(_0x1739ed,_0x5275f0,_0x163034){if(_0x1739ed[_0xd325('0x58')]['id']){delete _0x1739ed[_0xd325('0x58')]['id'];}return db[_0xd325('0x40')]['find']({'where':{'id':_0x1739ed[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x5275f0,null))[_0xd325('0x23')](function(_0x4816cb){if(_0x4816cb){_0x1739ed[_0xd325('0x58')][_0xd325('0x62')]=_0x4816cb['id'];return db['Disposition'][_0xd325('0x57')](_0x1739ed['body']);}})[_0xd325('0x23')](respondWithResult(_0x5275f0,null))['catch'](handleError(_0x5275f0,null));};exports[_0xd325('0x63')]=function(_0x163a36,_0x30aeea,_0x2f0518){var _0x56e281={'raw':![],'where':{}};var _0x5d4e62={};var _0x32cc04={'count':0x0,'rows':[]};return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x163a36[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x30aeea,null))[_0xd325('0x23')](function(_0x1a2894){if(_0x1a2894){_0x5d4e62[_0xd325('0x43')]=_['keys'](db[_0xd325('0x65')][_0xd325('0x41')]);_0x5d4e62[_0xd325('0x44')]=_[_0xd325('0x54')](_0x163a36[_0xd325('0x44')]);_0x5d4e62[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x5d4e62[_0xd325('0x43')],_0x5d4e62['query']);_0x56e281[_0xd325('0x47')]=_[_0xd325('0x45')](_0x5d4e62[_0xd325('0x43')],qs['fields'](_0x163a36[_0xd325('0x44')]['fields']));_0x56e281[_0xd325('0x47')]=_0x56e281[_0xd325('0x47')][_0xd325('0x48')]?_0x56e281[_0xd325('0x47')]:_0x5d4e62['model'];if(!_0x163a36[_0xd325('0x44')]['hasOwnProperty']('nolimit')){_0x56e281['limit']=qs[_0xd325('0x32')](_0x163a36[_0xd325('0x44')][_0xd325('0x32')]);_0x56e281[_0xd325('0x30')]=qs['offset'](_0x163a36['query']['offset']);}_0x56e281['order']=qs[_0xd325('0x4a')](_0x163a36[_0xd325('0x44')][_0xd325('0x4a')]);_0x56e281[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x163a36[_0xd325('0x44')],_0x5d4e62[_0xd325('0x4c')]));_0x56e281[_0xd325('0x4b')][_0xd325('0x62')]=_0x1a2894['id'];if(_0x163a36[_0xd325('0x44')][_0xd325('0x4d')]){_0x56e281[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0x56e281[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x56e281[_0xd325('0x47')],function(_0x51ffb6){var _0x3b598f={};_0x3b598f[_0x51ffb6]={'$like':'%'+_0x163a36[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x3b598f;})});}_0x56e281=_[_0xd325('0x4e')]({},_0x56e281,_0x163a36[_0xd325('0x55')]);return db[_0xd325('0x65')][_0xd325('0x33')]({'where':_0x56e281[_0xd325('0x4b')]})[_0xd325('0x23')](function(_0x2a8e72){_0x32cc04[_0xd325('0x33')]=_0x2a8e72;if(_0x163a36[_0xd325('0x44')][_0xd325('0x50')]){_0x56e281[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x65')][_0xd325('0x52')](_0x56e281);})[_0xd325('0x23')](function(_0x49e217){_0x32cc04[_0xd325('0x67')]=_0x49e217;return _0x32cc04;});}})[_0xd325('0x23')](respondWithFilteredResult(_0x30aeea,_0x56e281))[_0xd325('0x2c')](handleError(_0x30aeea,null));};exports['removeDispositions']=function(_0x1bbea1,_0x2dd7aa,_0x5e65d7){return db['SmsAccount']['find']({'where':{'id':_0x1bbea1[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x2dd7aa,null))['then'](function(_0x2269d4){if(_0x2269d4){return _0x2269d4[_0xd325('0x68')](_0x1bbea1[_0xd325('0x44')][_0xd325('0x69')]);}})[_0xd325('0x23')](respondWithStatusCode(_0x2dd7aa,null))['catch'](handleError(_0x2dd7aa,null));};exports['addAnswer']=function(_0x4e9855,_0xdda957,_0x27f202){if(_0x4e9855[_0xd325('0x58')]['id']){delete _0x4e9855[_0xd325('0x58')]['id'];}return db['SmsAccount'][_0xd325('0x56')]({'where':{'id':_0x4e9855['params']['id']}})['then'](handleEntityNotFound(_0xdda957,null))[_0xd325('0x23')](function(_0x567404){if(_0x567404){_0x4e9855['body'][_0xd325('0x62')]=_0x567404['id'];return db[_0xd325('0x6a')]['create'](_0x4e9855[_0xd325('0x58')]);}})[_0xd325('0x23')](respondWithResult(_0xdda957,null))[_0xd325('0x2c')](handleError(_0xdda957,null));};exports[_0xd325('0x6b')]=function(_0x545d00,_0x3af882,_0x54805d){var _0x5d0f17={'raw':![],'where':{}};var _0x523bbb={};var _0xed9ac8={'count':0x0,'rows':[]};return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x545d00[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3af882,null))[_0xd325('0x23')](function(_0xb66407){if(_0xb66407){_0x523bbb[_0xd325('0x43')]=_['keys'](db[_0xd325('0x6a')][_0xd325('0x41')]);_0x523bbb[_0xd325('0x44')]=_[_0xd325('0x54')](_0x545d00['query']);_0x523bbb[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x523bbb[_0xd325('0x43')],_0x523bbb[_0xd325('0x44')]);_0x5d0f17['attributes']=_[_0xd325('0x45')](_0x523bbb['model'],qs['fields'](_0x545d00[_0xd325('0x44')][_0xd325('0x46')]));_0x5d0f17[_0xd325('0x47')]=_0x5d0f17[_0xd325('0x47')]['length']?_0x5d0f17[_0xd325('0x47')]:_0x523bbb[_0xd325('0x43')];if(!_0x545d00['query'][_0xd325('0x49')]('nolimit')){_0x5d0f17[_0xd325('0x32')]=qs[_0xd325('0x32')](_0x545d00[_0xd325('0x44')][_0xd325('0x32')]);_0x5d0f17['offset']=qs[_0xd325('0x30')](_0x545d00[_0xd325('0x44')][_0xd325('0x30')]);}_0x5d0f17[_0xd325('0x6c')]=qs[_0xd325('0x4a')](_0x545d00['query'][_0xd325('0x4a')]);_0x5d0f17[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x545d00['query'],_0x523bbb['filters']));_0x5d0f17[_0xd325('0x4b')]['SmsAccountId']=_0xb66407['id'];if(_0x545d00[_0xd325('0x44')][_0xd325('0x4d')]){_0x5d0f17[_0xd325('0x4b')]=_['merge'](_0x5d0f17[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x5d0f17[_0xd325('0x47')],function(_0x2c2cc9){var _0x5bcad7={};_0x5bcad7[_0x2c2cc9]={'$like':'%'+_0x545d00['query'][_0xd325('0x4d')]+'%'};return _0x5bcad7;})});}_0x5d0f17=_['merge']({},_0x5d0f17,_0x545d00['options']);return db[_0xd325('0x6a')][_0xd325('0x33')]({'where':_0x5d0f17[_0xd325('0x4b')]})[_0xd325('0x23')](function(_0x4ed8d8){_0xed9ac8[_0xd325('0x33')]=_0x4ed8d8;if(_0x545d00[_0xd325('0x44')][_0xd325('0x50')]){_0x5d0f17[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x6a')][_0xd325('0x52')](_0x5d0f17);})['then'](function(_0x1226cb){_0xed9ac8['rows']=_0x1226cb;return _0xed9ac8;});}})[_0xd325('0x23')](respondWithFilteredResult(_0x3af882,_0x5d0f17))['catch'](handleError(_0x3af882,null));};exports[_0xd325('0x6d')]=function(_0x5eff3f,_0x580861,_0x5837e5){return db['SmsAccount']['find']({'where':{'id':_0x5eff3f[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x580861,null))[_0xd325('0x23')](function(_0x3e2f9){if(_0x3e2f9){return _0x3e2f9[_0xd325('0x6d')](_0x5eff3f[_0xd325('0x44')][_0xd325('0x69')]);}})[_0xd325('0x23')](respondWithStatusCode(_0x580861,null))['catch'](handleError(_0x580861,null));};exports[_0xd325('0x6e')]=function(_0x231408,_0x13c46f,_0x1ce544){var _0x156b09={'channel':_0xd325('0x6f')};var _0x16828e=[];var _0x18cd9c=[];var _0x28aed4={};return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x231408[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x70')],'as':'Applications'}]})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x4c0b7e){_0x156b09['account']=_0x4c0b7e;_0x156b09[_0xd325('0x71')]=_[_0xd325('0x72')](_0x4c0b7e['Applications'],[_0xd325('0x73')],[_0xd325('0x74')]);if(_0x156b09[_0xd325('0x75')][_0xd325('0x76')]){delete _0x156b09[_0xd325('0x75')][_0xd325('0x76')];}return db[_0xd325('0x77')][_0xd325('0x60')]();})[_0xd325('0x23')](function(_0x5b9175){if(!_0x5b9175){throw new db[(_0xd325('0x78'))]['ValidationError']('no\x20available\x20attributes');}_0x16828e=_[_0xd325('0x79')](_['keys'](_0x5b9175),['createdAt','updatedAt']);_0x18cd9c=_['difference'](_[_0xd325('0x54')](_0x5b9175),[_0xd325('0x7a'),'updatedAt',_0xd325('0x7b'),_0xd325('0x7c')]);_0x156b09[_0xd325('0x58')]={'mapKey':_0xd325('0x7d')};if(_0x156b09[_0xd325('0x75')]['type']){switch(_0x156b09[_0xd325('0x75')][_0xd325('0x4f')]){case _0xd325('0x7e'):_0x156b09['body'][_0xd325('0x7f')]=_0x231408['body'][_0xd325('0x80')];_0x156b09[_0xd325('0x58')]['body']=_0x231408[_0xd325('0x58')][_0xd325('0x81')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x83')];break;case _0xd325('0x84'):_0x156b09[_0xd325('0x58')]['from']='+'+_0x231408[_0xd325('0x58')][_0xd325('0x85')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408['body'][_0xd325('0x86')];break;case _0xd325('0x87'):_0x156b09['body']['from']=_0x231408[_0xd325('0x58')][_0xd325('0x7f')];_0x156b09[_0xd325('0x58')]['body']=_0x231408['body'][_0xd325('0x2a')];break;case _0xd325('0x88'):_0x156b09[_0xd325('0x58')][_0xd325('0x7f')]=_0x231408['body'][_0xd325('0x7f')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')][_0xd325('0x58')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x89')];break;case _0xd325('0x8a'):_0x156b09['body']['from']=_0x231408[_0xd325('0x58')][_0xd325('0x80')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['Text'];_0x156b09['body'][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x8b')];break;case'infobip':_0x156b09['body'][_0xd325('0x7f')]='+'+_0x231408[_0xd325('0x58')][_0xd325('0x8c')][0x0][_0xd325('0x7f')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408['body'][_0xd325('0x8c')][0x0][_0xd325('0x86')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x8c')][0x0][_0xd325('0x82')];break;case _0xd325('0x8d'):_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][_0xd325('0x8e')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')][_0xd325('0x8f')][_0xd325('0x2a')];break;case _0xd325('0x90'):_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][_0xd325('0x91')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['text'];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x92')];break;case'bandwidth':_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][0x0]['message']['id'];_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][0x0]['message']['from'];_0x156b09['body'][_0xd325('0x58')]=_0x231408['body'][0x0]['message']['text'];break;case _0xd325('0x93'):_0x156b09['body'][_0xd325('0x7f')]=_0x231408[_0xd325('0x58')][_0xd325('0x7f')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['message'];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x94')];break;}}if(_0x156b09['body']['id']){delete _0x156b09[_0xd325('0x58')]['id'];}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')][_0xd325('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xd325('0x96'));}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')][_0xd325('0x58')])||_0x156b09[_0xd325('0x58')][_0xd325('0x58')]===''){throw new db['Sequelize']['ValidationError'](_0xd325('0x97'));}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')]['mapKey'])){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0x99')+_0x18cd9c);}if(!_[_0xd325('0x9a')](_0x18cd9c,_0x156b09['body']['mapKey'])){throw new db[(_0xd325('0x78'))]['ValidationError'](_0xd325('0x9b')+_0x18cd9c);}_0x28aed4[_0x156b09[_0xd325('0x58')][_0xd325('0x9c')]]=_0x156b09['body'][_0xd325('0x7f')];return db[_0xd325('0x9d')]['find']({'where':{'id':_0x156b09['account']['ListId']},'include':[{'model':db[_0xd325('0x77')],'as':_0xd325('0x9e'),'where':_0x28aed4,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x252ec2){if(_0x252ec2){_0x156b09[_0xd325('0x9f')]=_[_0xd325('0xa0')](_0x252ec2,['Contacts']);if(_0x252ec2[_0xd325('0x9e')][_0xd325('0x48')]){return _0x252ec2[_0xd325('0x9e')][0x0];}var _0x330a82=_[_0xd325('0x1a')](_0x156b09['body'],{'firstName':_0x156b09['body'][_0xd325('0x7f')],'ListId':_0x252ec2['id']});_0x330a82[_0x156b09[_0xd325('0x58')][_0xd325('0x9c')]]=_0x156b09[_0xd325('0x58')][_0xd325('0x7f')];return db[_0xd325('0x77')][_0xd325('0x57')](_0x330a82,{'fields':_0x16828e,'raw':!![]});}})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x375a51){if(_0x375a51){_0x156b09[_0xd325('0xa1')]=_0x375a51;var _0x13e674={'ContactId':_0x375a51['id'],'phone':_0x156b09[_0xd325('0x58')][_0xd325('0x7f')],'SmsAccountId':_0x231408[_0xd325('0x53')]['id']};var _0x2fa149={'ContactId':_0x375a51['id'],'SmsAccountId':_0x231408['params']['id'],'closed':![]};return db['SmsInteraction'][_0xd325('0x56')]({'where':_0x2fa149})[_0xd325('0x23')](function(_0x3be4ec){if(_0x3be4ec){return[_0x3be4ec,![]];}return db[_0xd325('0xa2')][_0xd325('0x57')](_0x13e674)[_0xd325('0x23')](function(_0x403c53){return[_0x403c53,!![]];});});}})[_0xd325('0xa3')](function(_0x2dd335,_0x56b5ee){_0x156b09[_0xd325('0xa4')]=_0x2dd335[_0xd325('0x59')]({'plain':!![]});_0x156b09[_0xd325('0xa4')][_0xd325('0xa5')]=![];if(_0x56b5ee){if(_0x156b09['account'][_0xd325('0xa6')]){_0x156b09[_0xd325('0x71')][_0xd325('0xa7')]({'id':0x0,'priority':_0x156b09[_0xd325('0x71')]['length']+0x1,'app':_0xd325('0xa8'),'appdata':_0xd325('0xa9'),'interval':_0xd325('0xaa')});}_0x156b09[_0xd325('0xa4')][_0xd325('0xa5')]=!![];}return db[_0xd325('0xab')][_0xd325('0x57')]({'phone':_0x156b09['body'][_0xd325('0x7f')],'messageId':_0x156b09[_0xd325('0x58')][_0xd325('0x82')],'body':_0x156b09['body']['body'],'SmsAccountId':_0x231408[_0xd325('0x53')]['id'],'SmsInteractionId':_0x2dd335['id'],'direction':'in','ContactId':_0x2dd335[_0xd325('0xac')],'AttachmentId':_0x156b09[_0xd325('0x58')][_0xd325('0xad')]});})[_0xd325('0x23')](function(_0xe868fc){_0x156b09['message']=_0xe868fc;if(_0x156b09[_0xd325('0xa4')][_0xd325('0xae')]){return db[_0xd325('0xaf')]['find']({'attributes':['id',_0xd325('0x3b')],'where':{'id':_0x156b09[_0xd325('0xa4')][_0xd325('0xae')]}})[_0xd325('0x23')](function(_0x15f6e9){if(_0x15f6e9){_0x156b09[_0xd325('0x71')][_0xd325('0xb0')]({'id':0x0,'priority':0x0,'app':_0xd325('0xb1'),'appdata':_0x15f6e9[_0xd325('0x3b')]+','+(_0x156b09['account'][_0xd325('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd325('0xb3'),_0xd325('0xb4'),_0x156b09);});}return respondWithRpcPromise(_0xd325('0xb3'),_0xd325('0xb4'),_0x156b09);})[_0xd325('0x23')](function(_0x179ab1){if(_0x179ab1){var _0x123ae9=0xc8;var _0xaccf4=_0xd325('0xb5');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaccf4,_0x123ae9,_0xd325('0xb6'));logger[_0xd325('0x25')](_0xd325('0xb7'),_0xaccf4,_0x123ae9,_0xd325('0xb6'),JSON[_0xd325('0x27')](_0x179ab1));if(_0x156b09[_0xd325('0x75')][_0xd325('0x4f')]===_0xd325('0x7e')){return _0x13c46f['status'](_0x123ae9)[_0xd325('0x34')](_0xd325('0xb8'),_0xd325('0xb9'))[_0xd325('0xba')](_0xd325('0xbb'));}else{return _0x13c46f[_0xd325('0x2f')](_0x123ae9)[_0xd325('0xbc')](_0x179ab1);}}})['catch'](handleError(_0x13c46f,null));};exports[_0xd325('0xbd')]=function(_0x52211d,_0x48976f){var _0x59b630=_0x52211d[_0xd325('0x53')]['id'];var _0x1605cd=_0x52211d[_0xd325('0x58')];var _0x40f226=0xc8;var _0x1cd385=null;return db['sequelize'][_0xd325('0xbe')]({'isolationLevel':db[_0xd325('0xbf')]['Transaction'][_0xd325('0xc0')][_0xd325('0xc1')]},function(_0x1469a6){return db['SmsAccount']['findOne']({'where':{'id':_0x59b630},'transaction':_0x1469a6})[_0xd325('0x23')](function(_0x23a054){if(_0x23a054){return db[_0xd325('0x70')][_0xd325('0x37')]({'where':{'SmsAccountId':_0x59b630},'transaction':_0x1469a6})['then'](function(){var _0x35c528=_[_0xd325('0x3f')](_0x1605cd,function(_0x1766dc){_0x1766dc[_0xd325('0x62')]=_0x59b630;return _0x1766dc;});return db[_0xd325('0x70')][_0xd325('0xc2')](_0x35c528,{'transaction':_0x1469a6});});}else{_0x40f226=0x194;_0x1cd385=[];}});})['then'](function(){if(_0x40f226!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x59b630},'order':'priority'})[_0xd325('0x23')](function(_0x1565bf){_0x1cd385=_0x1565bf;});}})[_0xd325('0x2c')](function(_0x4a9271){_0x40f226=0x1f4;logger[_0xd325('0x28')](_0x4a9271[_0xd325('0x3a')]);if(_0x4a9271['name']){delete _0x4a9271[_0xd325('0x3b')];}_0x1cd385=_0x4a9271;})['finally'](function(){if(_0x1cd385===null){_0x48976f[_0xd325('0x2d')](_0x40f226);}else{if(_0x40f226===0x1f4){_0x48976f[_0xd325('0x2f')](_0x40f226)['send'](_0x1cd385);}else{_0x48976f[_0xd325('0x2f')](_0x40f226)[_0xd325('0xbc')](_0x1cd385);}}});};exports['getApplications']=function(_0xcca9a8,_0x45ee87,_0x15306a){var _0xcfbbdd={};var _0x20ad35={};var _0x14c923;var _0x393713;return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0xcca9a8[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x45ee87,null))['then'](function(_0x52a7a9){if(_0x52a7a9){_0x14c923=_0x52a7a9;_0x20ad35[_0xd325('0x43')]=_[_0xd325('0x54')](db[_0xd325('0x70')][_0xd325('0x41')]);_0x20ad35[_0xd325('0x44')]=_[_0xd325('0x54')](_0xcca9a8[_0xd325('0x44')]);_0x20ad35['filters']=_[_0xd325('0x45')](_0x20ad35[_0xd325('0x43')],_0x20ad35[_0xd325('0x44')]);_0xcfbbdd[_0xd325('0x47')]=_[_0xd325('0x45')](_0x20ad35[_0xd325('0x43')],qs['fields'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x46')]));_0xcfbbdd[_0xd325('0x47')]=_0xcfbbdd[_0xd325('0x47')][_0xd325('0x48')]?_0xcfbbdd[_0xd325('0x47')]:_0x20ad35[_0xd325('0x43')];_0xcfbbdd[_0xd325('0x6c')]=qs['sort'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x4a')]);_0xcfbbdd['where']=qs['filters'](_[_0xd325('0x66')](_0xcca9a8['query'],_0x20ad35['filters']));if(_0xcca9a8[_0xd325('0x44')][_0xd325('0x4d')]){_0xcfbbdd['where']=_[_0xd325('0x4e')](_0xcfbbdd['where'],{'$or':_['map'](_0xcfbbdd[_0xd325('0x47')],function(_0x5fc7ba){var _0x2c3977={};_0x2c3977[_0x5fc7ba]={'$like':'%'+_0xcca9a8[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x2c3977;})});}_0xcfbbdd=_['merge']({},_0xcfbbdd,_0xcca9a8[_0xd325('0x55')]);return _0x14c923[_0xd325('0xc3')](_0xcfbbdd);}})['then'](function(_0x4a03a4){if(_0x4a03a4){_0x393713=_0x4a03a4[_0xd325('0x48')];if(!_0xcca9a8[_0xd325('0x44')][_0xd325('0x49')](_0xd325('0xc4'))){_0xcfbbdd[_0xd325('0x32')]=qs['limit'](_0xcca9a8[_0xd325('0x44')]['limit']);_0xcfbbdd['offset']=qs['offset'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x30')]);}return _0x14c923[_0xd325('0xc3')](_0xcfbbdd);}})['then'](function(_0x384921){if(_0x384921){return _0x384921?{'count':_0x393713,'rows':_0x384921}:null;}})[_0xd325('0x23')](respondWithResult(_0x45ee87,null))['catch'](handleError(_0x45ee87,null));};exports[_0xd325('0xc5')]=function(_0x508beb,_0x3d89dc,_0x4f26de){var _0x1fc781={'raw':![],'where':{}};var _0x426853={};var _0x33440a={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x508beb[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3d89dc,null))[_0xd325('0x23')](function(_0x3ce037){if(_0x3ce037){_0x426853[_0xd325('0x43')]=_['keys'](db[_0xd325('0xa2')][_0xd325('0x41')]);_0x426853[_0xd325('0x44')]=_[_0xd325('0x54')](_0x508beb[_0xd325('0x44')]);_0x426853[_0xd325('0x4c')]=_['intersection'](_0x426853['model'],_0x426853['query']);_0x1fc781[_0xd325('0x47')]=_[_0xd325('0x45')](_0x426853[_0xd325('0x43')],qs['fields'](_0x508beb[_0xd325('0x44')][_0xd325('0x46')]));_0x1fc781[_0xd325('0x47')]=_0x1fc781[_0xd325('0x47')][_0xd325('0x48')]?_0x1fc781[_0xd325('0x47')]:_0x426853[_0xd325('0x43')];if(!_0x508beb[_0xd325('0x44')]['hasOwnProperty'](_0xd325('0xc4'))){_0x1fc781[_0xd325('0x32')]=qs['limit'](_0x508beb['query']['limit']);_0x1fc781['offset']=qs[_0xd325('0x30')](_0x508beb['query'][_0xd325('0x30')]);}_0x1fc781[_0xd325('0x6c')]=qs[_0xd325('0x4a')](_0x508beb[_0xd325('0x44')][_0xd325('0x4a')]);_0x1fc781[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x508beb[_0xd325('0x44')],_0x426853[_0xd325('0x4c')]));_0x1fc781[_0xd325('0x4b')][_0xd325('0x62')]=_0x3ce037['id'];if(_0x508beb[_0xd325('0x44')][_0xd325('0x4d')]){_0x1fc781[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0x1fc781[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x1fc781[_0xd325('0x47')],function(_0x59d48c){var _0x5b7913={};_0x5b7913[_0x59d48c]={'$like':'%'+_0x508beb[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x5b7913;})});}_0x1fc781=_[_0xd325('0x4e')]({},_0x1fc781,_0x508beb['options']);return db[_0xd325('0xa2')]['count']({'where':_0x1fc781[_0xd325('0x4b')]})['then'](function(_0x562428){_0x33440a[_0xd325('0x33')]=_0x562428;if(_0x508beb[_0xd325('0x44')]['includeAll']){_0x1fc781[_0xd325('0x51')]=[{'model':db[_0xd325('0x77')],'as':_0xd325('0xc6'),'required':![]},{'model':db['User'],'as':_0xd325('0xc7'),'attributes':['name',_0xd325('0xc8'),_0xd325('0xc9')],'required':![]},{'model':db[_0xd325('0xca')],'as':_0xd325('0xcb'),'attributes':['id',_0xd325('0x3b'),_0xd325('0xcc')],'where':_0x508beb[_0xd325('0x44')][_0xd325('0xcd')]?{'id':_0x508beb[_0xd325('0x44')]['tag']}:undefined,'required':_0x508beb[_0xd325('0x44')][_0xd325('0xcd')]?!![]:![]}];}return db[_0xd325('0xa2')][_0xd325('0x52')](_0x1fc781);})['then'](function(_0x2faf34){_0x33440a[_0xd325('0x67')]=_0x2faf34;return _0x33440a;});}})['then'](respondWithFilteredResult(_0x3d89dc,_0x1fc781))[_0xd325('0x2c')](handleError(_0x3d89dc,null));};exports['send']=function(_0x3e55d4,_0x5e2b7,_0x2d57ab){var _0x312b51,_0x26986a,_0x48f258;if(_[_0xd325('0x95')](_0x3e55d4[_0xd325('0x58')]['body'])||_0x3e55d4[_0xd325('0x58')][_0xd325('0x58')]===''){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0x97'));}if(_[_0xd325('0x95')](_0x3e55d4[_0xd325('0x58')]['to'])){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0xce'));}_0x312b51=_0x3e55d4['body']['to'];return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x3e55d4[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x9d')],'as':_0xd325('0xcf'),'include':[{'model':db['CmContact'],'as':_0xd325('0x9e'),'where':{'mobile':_0x312b51},'limit':0x1,'order':[[_0xd325('0xd0'),'DESC']]}]}]})[_0xd325('0x23')](handleEntityNotFound(_0x5e2b7,null))[_0xd325('0x23')](function(_0x4c15b1){if(_0x4c15b1&&_0x4c15b1[_0xd325('0xcf')]){_0x26986a=_0x4c15b1[_0xd325('0x59')]({'plain':!![]});if(_0x26986a['List']&&_0x26986a[_0xd325('0xcf')][_0xd325('0x9e')][_0xd325('0x48')]){return _0x26986a['List'][_0xd325('0x9e')][0x0];}return db[_0xd325('0x77')][_0xd325('0x57')](_[_0xd325('0x1a')](_0x3e55d4['body'],{'firstName':_0x312b51,'mobile':_0x312b51,'phone':_0x312b51,'ListId':_0x26986a[_0xd325('0x7c')]}));}})['then'](handleEntityNotFound(_0x5e2b7,null))[_0xd325('0x23')](function(_0x5d6b75){if(_0x5d6b75){_0x48f258=_0x5d6b75;return db['SmsInteraction'][_0xd325('0x56')]({'where':{'ContactId':_0x48f258['id'],'closed':![],'SmsAccountId':_0x26986a['id']}})[_0xd325('0x23')](function(_0x2695e3){if(_0x2695e3){return[_0x2695e3,![]];}return db[_0xd325('0xa2')]['create']({'UserId':_0x3e55d4[_0xd325('0x5b')]['id'],'ContactId':_0x48f258['id'],'SmsAccountId':_0x26986a['id'],'phone':_0x312b51,'firstMsgDirection':'out','Messages':[_[_0xd325('0x4e')](_0x3e55d4[_0xd325('0x58')],{'read':![],'body':_0x3e55d4[_0xd325('0x58')]['body'],'phone':_0x312b51,'SmsAccountId':_0x26986a['id'],'UserId':_0x3e55d4['user']['id'],'ContactId':_0x48f258['id']})]},{'include':[{'model':db[_0xd325('0xab')],'as':_0xd325('0xd1')}]})[_0xd325('0x23')](function(_0x5ef5ed){return[_0x5ef5ed,!![]];});});}})[_0xd325('0xa3')](function(_0x223caf,_0x5d2828){if(_0x5d2828){return _0x223caf;}return db[_0xd325('0xab')][_0xd325('0x57')](_[_0xd325('0x4e')](_0x3e55d4[_0xd325('0x58')],{'read':![],'body':_0x3e55d4['body'][_0xd325('0x58')],'phone':_0x312b51,'SmsAccountId':_0x26986a['id'],'SmsInteractionId':_0x223caf['id'],'UserId':_0x3e55d4[_0xd325('0x5b')]['id'],'ContactId':_0x48f258['id']}))['then'](function(_0x9fcd9d){_0x223caf['dataValues'][_0xd325('0xd1')]=[];_0x223caf['dataValues'][_0xd325('0xd1')][_0xd325('0xa7')](_0x9fcd9d[_0xd325('0xd2')]);return _0x223caf;});})[_0xd325('0x23')](respondWithResult(_0x5e2b7,null))[_0xd325('0x2c')](handleError(_0x5e2b7,null));};exports[_0xd325('0x2f')]=function(_0x191532,_0x2c0657,_0x494813){if(_0x191532['body']['id']){delete _0x191532['body']['id'];}var _0x30e810,_0x35fd84,_0x2e0bae;return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x191532[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x2c0657,null))[_0xd325('0x23')](function(_0x1f1aac){if(_0x1f1aac){_0x2e0bae=_0x1f1aac;logger[_0xd325('0x25')](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0xd3'),_0x1f1aac['type'],util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));switch(_0x1f1aac[_0xd325('0x4f')]){case _0xd325('0x84'):if(_0x191532['body'][_0xd325('0xd5')]&&_0x191532[_0xd325('0x58')][_0xd325('0x2f')]){_0x35fd84=_0x191532['body']['status'];return db[_0xd325('0xab')]['find']({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0xd5')]}});}break;case _0xd325('0x87'):if(_0x191532[_0xd325('0x58')][_0xd325('0xd6')]&&_0x191532[_0xd325('0x58')][_0xd325('0xd7')]){_0x35fd84=_0x191532['body'][_0xd325('0xd7')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')]['requestid']}});}break;case _0xd325('0x88'):if(_0x191532[_0xd325('0x58')][_0xd325('0x89')]&&_0x191532[_0xd325('0x58')][_0xd325('0xd8')]){_0x35fd84=_0x191532[_0xd325('0x58')][_0xd325('0xd8')];return db[_0xd325('0xab')]['find']({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0x89')]}});}break;case _0xd325('0xd9'):var _0x3d7542=_0x191532['body'][_0xd325('0x8c')][0x0];if(_0x3d7542['messageId']&&_0x3d7542[_0xd325('0x2f')]['groupName']==='DELIVERED'){_0x35fd84=_0x3d7542['status']['groupName'];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x3d7542[_0xd325('0x82')]}});}break;case _0xd325('0x90'):if(_0x191532[_0xd325('0x58')]['messageId']&&_0x191532[_0xd325('0x58')]['status']){_0x35fd84=_0x191532['body'][_0xd325('0x2f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0x82')]}});}break;case _0xd325('0xda'):if(_0x191532[_0xd325('0x58')][0x0]['message']['id']){_0x35fd84=_0x191532['body'][0x0][_0xd325('0x4f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')][0x0][_0xd325('0x2a')]['id']}});}break;case _0xd325('0x93'):if(_0x191532[_0xd325('0x58')][_0xd325('0xdb')]&&_0x191532['body']['status']){_0x35fd84=_0x191532[_0xd325('0x58')][_0xd325('0x2f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')]['redif']}});}break;}}})[_0xd325('0x23')](handleEntityNotFound(_0x2c0657,null))['then'](function(_0x317d47){if(_0x317d47){_0x30e810=_0x317d47;switch(_0x2e0bae[_0xd325('0x4f')]){case _0xd325('0x84'):if(_0x35fd84===_0xd325('0xdc')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0x84'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd325('0x87'):if(_0x35fd84==='1'){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')](_0xd325('0x26'),'status',_0xd325('0x84'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd325('0x88'):if(!_0x191532[_0xd325('0x58')][_0xd325('0xdd')]&&_0x35fd84>=0xc8&&_0x35fd84<=0xce){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0x88'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x48610a=_0x191532[_0xd325('0x58')]['results'][0x0];if(_0x48610a[_0xd325('0x2f')][_0xd325('0xde')]===_0xd325('0xdc')){return _0x30e810['update']({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0xd9'),util[_0xd325('0xd4')](_0x191532['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x35fd84=='DELIVERED_TO_GATEWAY'||_0x35fd84==_0xd325('0xdf')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error'](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0x90'),util['inspect'](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x35fd84==_0xd325('0xe0')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd325('0x2f'),'bandwidth',util['inspect'](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x35fd84===_0xd325('0xe1')||_0x35fd84===_0xd325('0xe2')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error'](_0xd325('0x26'),_0xd325('0x2f'),'intelepeer',util[_0xd325('0xd4')](_0x191532['body'],{'showHidden':![],'depth':null}));}break;}return _0x30e810;}})[_0xd325('0x23')](respondWithResult(_0x2c0657,null))[_0xd325('0x2c')](handleError(_0x2c0657,null));};exports[_0xd325('0xe3')]=function(_0x1f0802,_0x3c2f41,_0x5cc15b){var _0x14d52e,_0x1f9248,_0x78fbfb;return db[_0xd325('0x40')]['find']({'where':{'id':_0x1f0802['params']['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3c2f41,null))[_0xd325('0x23')](function(_0x4e5bdd){if(_0x4e5bdd){_0x78fbfb=_0x4e5bdd;logger[_0xd325('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd325('0x2f'),_0xd325('0xd3'),_0x4e5bdd[_0xd325('0x4f')],util[_0xd325('0xd4')](_0x1f0802[_0xd325('0x44')],{'showHidden':![],'depth':null}));switch(_0x4e5bdd['type']){case _0xd325('0x8d'):if(_0x1f0802[_0xd325('0x44')][_0xd325('0xe4')]&&_0x1f0802['query'][_0xd325('0xe5')]){_0x1f9248=_0x1f0802[_0xd325('0x44')][_0xd325('0xe5')];return db['SmsMessage'][_0xd325('0x56')]({'where':{'messageId':_0x1f0802['query']['message-id']}});}break;}}})[_0xd325('0x23')](handleEntityNotFound(_0x3c2f41,null))[_0xd325('0x23')](function(_0x9d0280){if(_0x9d0280){_0x14d52e=_0x9d0280;switch(_0x78fbfb[_0xd325('0x4f')]){case _0xd325('0x8d'):if(_0x1f9248==='2'||_0x1f9248==='6'){return _0x14d52e[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0x8d'),util[_0xd325('0xd4')](_0x1f0802[_0xd325('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x14d52e;}})[_0xd325('0x23')](respondWithResult(_0x3c2f41,null))[_0xd325('0x2c')](handleError(_0x3c2f41,null));};exports[_0xd325('0xe6')]=function(_0x1889c2,_0x29ea0e,_0x24558a){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x1889c2[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x29ea0e,null))['then'](function(_0x45d87d){if(_0x45d87d){return _0x45d87d['addAgents'](_0x1889c2['body'][_0xd325('0x69')],_[_0xd325('0xa0')](_0x1889c2['body'],['ids','id'])||{})[_0xd325('0xa3')](function(_0x1c2b59){for(var _0x15e39d=0x0;_0x15e39d<_0x1889c2[_0xd325('0x58')]['ids'][_0xd325('0x48')];_0x15e39d+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x1889c2[_0xd325('0x58')][_0xd325('0x69')][_0x15e39d]),'SmsAccountId':Number(_0x1889c2[_0xd325('0x53')]['id'])});}return _0x1c2b59;});}})['then'](respondWithResult(_0x29ea0e,null))[_0xd325('0x2c')](handleError(_0x29ea0e,null));};exports[_0xd325('0xe7')]=function(_0x1764c7,_0x5c8a7d,_0x1f5a8b){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x1764c7[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x5c8a7d,null))['then'](function(_0x385c24){if(_0x385c24){return _0x385c24[_0xd325('0xe7')](_0x1764c7[_0xd325('0x44')][_0xd325('0x69')])[_0xd325('0x23')](function(){if(_[_0xd325('0xe8')](_0x1764c7[_0xd325('0x44')][_0xd325('0x69')])){for(var _0x314a84=0x0;_0x314a84<_0x1764c7['query'][_0xd325('0x69')][_0xd325('0x48')];_0x314a84+=0x1){socket['emit'](_0xd325('0xe9'),{'UserId':Number(_0x1764c7[_0xd325('0x44')][_0xd325('0x69')][_0x314a84]),'SmsAccountId':Number(_0x1764c7[_0xd325('0x53')]['id'])});}}else{socket[_0xd325('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x1764c7[_0xd325('0x44')][_0xd325('0x69')]),'SmsAccountId':Number(_0x1764c7['params']['id'])});}});}})[_0xd325('0x23')](respondWithStatusCode(_0x5c8a7d,null))[_0xd325('0x2c')](handleError(_0x5c8a7d,null));};exports['getAgents']=function(_0x55c9a0,_0x529f14,_0x5ca1b0){var _0x4c54eb={};var _0x5b6061={};var _0x104b3d;var _0x327ad0;return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x55c9a0[_0xd325('0x53')]['id']}})['then'](handleEntityNotFound(_0x529f14,null))['then'](function(_0x7a6ccb){if(_0x7a6ccb){_0x104b3d=_0x7a6ccb;_0x5b6061['model']=_[_0xd325('0x54')](db[_0xd325('0xaf')][_0xd325('0x41')]);_0x5b6061['query']=_[_0xd325('0x54')](_0x55c9a0[_0xd325('0x44')]);_0x5b6061[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x5b6061[_0xd325('0x43')],_0x5b6061[_0xd325('0x44')]);_0x4c54eb[_0xd325('0x47')]=_[_0xd325('0x45')](_0x5b6061[_0xd325('0x43')],qs[_0xd325('0x46')](_0x55c9a0[_0xd325('0x44')][_0xd325('0x46')]));_0x4c54eb[_0xd325('0x47')]=_0x4c54eb[_0xd325('0x47')][_0xd325('0x48')]?_0x4c54eb[_0xd325('0x47')]:_0x5b6061[_0xd325('0x43')];_0x4c54eb[_0xd325('0x6c')]=qs['sort'](_0x55c9a0[_0xd325('0x44')][_0xd325('0x4a')]);_0x4c54eb[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x55c9a0[_0xd325('0x44')],_0x5b6061[_0xd325('0x4c')]));if(_0x55c9a0[_0xd325('0x44')][_0xd325('0x4d')]){_0x4c54eb[_0xd325('0x4b')]=_['merge'](_0x4c54eb['where'],{'$or':_[_0xd325('0x3f')](_0x4c54eb[_0xd325('0x47')],function(_0xa598e1){var _0x5f4ccd={};_0x5f4ccd[_0xa598e1]={'$like':'%'+_0x55c9a0[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x5f4ccd;})});}_0x4c54eb=_[_0xd325('0x4e')]({},_0x4c54eb,_0x55c9a0[_0xd325('0x55')]);return _0x104b3d[_0xd325('0xeb')](_0x4c54eb);}})['then'](function(_0xb49de1){if(_0xb49de1){_0x327ad0=_0xb49de1[_0xd325('0x48')];if(!_0x55c9a0['query'][_0xd325('0x49')](_0xd325('0xc4'))){_0x4c54eb[_0xd325('0x32')]=qs['limit'](_0x55c9a0[_0xd325('0x44')][_0xd325('0x32')]);_0x4c54eb[_0xd325('0x30')]=qs[_0xd325('0x30')](_0x55c9a0[_0xd325('0x44')][_0xd325('0x30')]);}return _0x104b3d[_0xd325('0xeb')](_0x4c54eb);}})[_0xd325('0x23')](function(_0x572718){if(_0x572718){return _0x572718?{'count':_0x327ad0,'rows':_0x572718}:null;}})[_0xd325('0x23')](respondWithResult(_0x529f14,null))[_0xd325('0x2c')](handleError(_0x529f14,null));}; \ No newline at end of file +var _0x68aa=['text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','emit','userSmsAccount:save','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','SmsAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','nolimit','pick','removeDispositions','addAnswer','SmsAccountId','CannedAnswer','getAnswers','length','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','set','Content-Type'];(function(_0x10efaf,_0xefbbf5){var _0x3b6863=function(_0x136676){while(--_0x136676){_0x10efaf['push'](_0x10efaf['shift']());}};_0x3b6863(++_0xefbbf5);}(_0x68aa,0x110));var _0xa68a=function(_0x1a39a,_0x5134ea){_0x1a39a=_0x1a39a-0x0;var _0x4ce4a8=_0x68aa[_0x1a39a];return _0x4ce4a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa68a('0x0'));var jsonpatch=require(_0xa68a('0x1'));var rp=require('request-promise');var moment=require(_0xa68a('0x2'));var BPromise=require(_0xa68a('0x3'));var Mustache=require(_0xa68a('0x4'));var util=require('util');var path=require(_0xa68a('0x5'));var sox=require(_0xa68a('0x6'));var csv=require(_0xa68a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa68a('0x8'));var _=require(_0xa68a('0x9'));var squel=require('squel');var crypto=require(_0xa68a('0xa'));var jsforce=require(_0xa68a('0xb'));var deskjs=require(_0xa68a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa68a('0xd'));var Papa=require(_0xa68a('0xe'));var Redis=require(_0xa68a('0xf'));var authService=require(_0xa68a('0x10'));var qs=require(_0xa68a('0x11'));var as=require(_0xa68a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa68a('0x13'))(_0xa68a('0x14'));var utils=require(_0xa68a('0x15'));var config=require(_0xa68a('0x16'));var licenseUtil=require(_0xa68a('0x17'));var db=require(_0xa68a('0x18'))['db'];config['redis']=_['defaults'](config[_0xa68a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa68a('0x1a'))(new Redis(config[_0xa68a('0x19')]));require(_0xa68a('0x1b'))[_0xa68a('0x1c')](socket);var jayson=require(_0xa68a('0x1d'));var client=jayson['client'][_0xa68a('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3327c2,_0x3a8534,_0xa81c2f,_0x1240fb){return new BPromise(function(_0x2fee1b,_0x127be2){var _0x2f79e4=_0x1240fb||client;return _0x2f79e4[_0xa68a('0x1f')](_0x3327c2,_0xa81c2f)[_0xa68a('0x20')](function(_0x38f888){logger[_0xa68a('0x21')](_0xa68a('0x22'),_0x3a8534,_0xa68a('0x23'));logger[_0xa68a('0x24')](_0xa68a('0x25'),_0x3a8534,_0xa68a('0x23'),JSON[_0xa68a('0x26')](_0x38f888));if(_0x38f888['error']){if(_0x38f888['error'][_0xa68a('0x27')]===0x1f4){logger[_0xa68a('0x28')](_0xa68a('0x22'),_0x3a8534,_0x38f888[_0xa68a('0x28')][_0xa68a('0x29')]);return _0x127be2(_0x38f888[_0xa68a('0x28')][_0xa68a('0x29')]);}logger[_0xa68a('0x28')](_0xa68a('0x22'),_0x3a8534,_0x38f888['error'][_0xa68a('0x29')]);return _0x2fee1b(_0x38f888[_0xa68a('0x28')][_0xa68a('0x29')]);}else{logger[_0xa68a('0x21')](_0xa68a('0x22'),_0x3a8534,_0xa68a('0x23'));_0x2fee1b(_0x38f888['result']['message']);}})[_0xa68a('0x2a')](function(_0x4cebd2){logger['error'](_0xa68a('0x22'),_0x3a8534,_0x4cebd2);_0x127be2(_0x4cebd2);});});}function respondWithStatusCode(_0x3f903e,_0x5310ac){_0x5310ac=_0x5310ac||0xcc;return function(_0x17804a){if(_0x17804a){return _0x3f903e[_0xa68a('0x2b')](_0x5310ac);}return _0x3f903e[_0xa68a('0x2c')](_0x5310ac)['end']();};}function respondWithResult(_0x2d2cab,_0x12ccaf){_0x12ccaf=_0x12ccaf||0xc8;return function(_0x4f466b){if(_0x4f466b){return _0x2d2cab['status'](_0x12ccaf)[_0xa68a('0x2d')](_0x4f466b);}};}function respondWithFilteredResult(_0x4a0d12,_0x59b7d5){return function(_0x91866c){if(_0x91866c){var _0x1c319f=typeof _0x59b7d5[_0xa68a('0x2e')]===_0xa68a('0x2f')&&typeof _0x59b7d5['limit']===_0xa68a('0x2f');var _0x52df1c=_0x91866c[_0xa68a('0x30')];var _0x3a56d5=_0x1c319f?0x0:_0x59b7d5[_0xa68a('0x2e')];var _0x5effa=_0x1c319f?_0x91866c[_0xa68a('0x30')]:_0x59b7d5['offset']+_0x59b7d5[_0xa68a('0x31')];var _0x5127ce;if(_0x5effa>=_0x52df1c){_0x5effa=_0x52df1c;_0x5127ce=0xc8;}else{_0x5127ce=0xce;}_0x4a0d12[_0xa68a('0x2c')](_0x5127ce);return _0x4a0d12['set'](_0xa68a('0x32'),_0x3a56d5+'-'+_0x5effa+'/'+_0x52df1c)['json'](_0x91866c);}return null;};}function patchUpdates(_0xda8cb5){return function(_0x24e9d7){try{jsonpatch[_0xa68a('0x33')](_0x24e9d7,_0xda8cb5,!![]);}catch(_0xd6ffa2){return BPromise[_0xa68a('0x34')](_0xd6ffa2);}return _0x24e9d7['save']();};}function saveUpdates(_0x5a3658,_0x3eeef1){return function(_0xf17874){if(_0xf17874){return _0xf17874[_0xa68a('0x35')](_0x5a3658)['then'](function(_0x404198){return _0x404198;});}return null;};}function removeEntity(_0x385b34,_0x392ac7){return function(_0x3e220f){if(_0x3e220f){return _0x3e220f[_0xa68a('0x36')]()[_0xa68a('0x20')](function(){var _0x32e56c=_0x3e220f[_0xa68a('0x37')]({'plain':!![]});var _0x10c201=_0xa68a('0x38');return db['UserProfileResource'][_0xa68a('0x36')]({'where':{'type':_0x10c201,'resourceId':_0x32e56c['id']}})[_0xa68a('0x20')](function(){return _0x3e220f;});})[_0xa68a('0x20')](function(){_0x385b34[_0xa68a('0x2c')](0xcc)[_0xa68a('0x39')]();});}};}function handleEntityNotFound(_0x36d67b,_0x21fa01){return function(_0x540752){if(!_0x540752){_0x36d67b['sendStatus'](0x194);}return _0x540752;};}function handleError(_0x246c0f,_0x446580){_0x446580=_0x446580||0x1f4;return function(_0x479a0b){logger[_0xa68a('0x28')](_0x479a0b[_0xa68a('0x3a')]);if(_0x479a0b[_0xa68a('0x3b')]){delete _0x479a0b[_0xa68a('0x3b')];}_0x246c0f[_0xa68a('0x2c')](_0x446580)[_0xa68a('0x3c')](_0x479a0b);};}exports[_0xa68a('0x3d')]=function(_0x18c7d1,_0xa811ea){var _0x3ee605={'include':[{'model':db[_0xa68a('0x3e')],'as':_0xa68a('0x3f')}]},_0x14be85={},_0x2eb3e9={'count':0x0,'rows':[]};var _0x47cd32=_[_0xa68a('0x40')](db[_0xa68a('0x41')][_0xa68a('0x42')],function(_0x3f6fe1){return{'name':_0x3f6fe1[_0xa68a('0x43')],'type':_0x3f6fe1['type'][_0xa68a('0x44')]};});_0x14be85[_0xa68a('0x45')]=_[_0xa68a('0x40')](_0x47cd32,_0xa68a('0x3b'));_0x14be85[_0xa68a('0x46')]=_[_0xa68a('0x47')](_0x18c7d1[_0xa68a('0x46')]);_0x14be85[_0xa68a('0x48')]=_['intersection'](_0x14be85[_0xa68a('0x45')],_0x14be85[_0xa68a('0x46')]);_0x3ee605['attributes']=_[_0xa68a('0x49')](_0x14be85[_0xa68a('0x45')],qs[_0xa68a('0x4a')](_0x18c7d1[_0xa68a('0x46')][_0xa68a('0x4a')]));_0x3ee605['attributes']=_0x3ee605[_0xa68a('0x4b')]['length']?_0x3ee605[_0xa68a('0x4b')]:_0x14be85[_0xa68a('0x45')];if(!_0x18c7d1[_0xa68a('0x46')][_0xa68a('0x4c')]('nolimit')){_0x3ee605[_0xa68a('0x31')]=qs['limit'](_0x18c7d1[_0xa68a('0x46')][_0xa68a('0x31')]);_0x3ee605[_0xa68a('0x2e')]=qs[_0xa68a('0x2e')](_0x18c7d1[_0xa68a('0x46')]['offset']);}_0x3ee605[_0xa68a('0x4d')]=qs[_0xa68a('0x4e')](_0x18c7d1[_0xa68a('0x46')][_0xa68a('0x4e')]);_0x3ee605[_0xa68a('0x4f')]=qs['filters'](_['pick'](_0x18c7d1[_0xa68a('0x46')],_0x14be85[_0xa68a('0x48')]),_0x47cd32);if(_0x18c7d1['query'][_0xa68a('0x50')]){_0x3ee605[_0xa68a('0x4f')]=_[_0xa68a('0x51')](_0x3ee605[_0xa68a('0x4f')],{'$or':_[_0xa68a('0x40')](_0x47cd32,function(_0x1c2d28){if(_0x1c2d28['type']!==_0xa68a('0x52')){var _0x5a6fdc={};_0x5a6fdc[_0x1c2d28['name']]={'$like':'%'+_0x18c7d1['query'][_0xa68a('0x50')]+'%'};return _0x5a6fdc;}})});}_0x3ee605=_[_0xa68a('0x51')]({},_0x3ee605,_0x18c7d1[_0xa68a('0x53')]);var _0x1182fd={'where':_0x3ee605[_0xa68a('0x4f')]};return db[_0xa68a('0x41')][_0xa68a('0x30')](_0x1182fd)[_0xa68a('0x20')](function(_0x4a72c8){_0x2eb3e9[_0xa68a('0x30')]=_0x4a72c8;if(_0x18c7d1[_0xa68a('0x46')][_0xa68a('0x54')]){_0x3ee605['include']=[{'all':!![]}];}return db[_0xa68a('0x41')][_0xa68a('0x55')](_0x3ee605);})[_0xa68a('0x20')](function(_0x522585){_0x2eb3e9[_0xa68a('0x56')]=_0x522585;return _0x2eb3e9;})[_0xa68a('0x20')](respondWithFilteredResult(_0xa811ea,_0x3ee605))['catch'](handleError(_0xa811ea,null));};exports[_0xa68a('0x57')]=function(_0x29a243,_0x5cc847){var _0x52e3a6={'raw':![],'where':{'id':_0x29a243[_0xa68a('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xa68a('0x3f')}]},_0x5b5780={};_0x5b5780[_0xa68a('0x45')]=_['keys'](db[_0xa68a('0x41')][_0xa68a('0x42')]);_0x5b5780[_0xa68a('0x46')]=_[_0xa68a('0x47')](_0x29a243[_0xa68a('0x46')]);_0x5b5780[_0xa68a('0x48')]=_['intersection'](_0x5b5780['model'],_0x5b5780[_0xa68a('0x46')]);_0x52e3a6[_0xa68a('0x4b')]=_[_0xa68a('0x49')](_0x5b5780[_0xa68a('0x45')],qs['fields'](_0x29a243[_0xa68a('0x46')][_0xa68a('0x4a')]));_0x52e3a6[_0xa68a('0x4b')]=_0x52e3a6['attributes']['length']?_0x52e3a6[_0xa68a('0x4b')]:_0x5b5780[_0xa68a('0x45')];if(_0x29a243[_0xa68a('0x46')][_0xa68a('0x54')]){_0x52e3a6[_0xa68a('0x59')]=[{'all':!![]}];}_0x52e3a6=_[_0xa68a('0x51')]({},_0x52e3a6,_0x29a243['options']);return db['SmsAccount'][_0xa68a('0x5a')](_0x52e3a6)[_0xa68a('0x20')](handleEntityNotFound(_0x5cc847,null))['then'](respondWithResult(_0x5cc847,null))[_0xa68a('0x2a')](handleError(_0x5cc847,null));};exports[_0xa68a('0x5b')]=function(_0x35592c,_0x26b056){return db['SmsAccount'][_0xa68a('0x5b')](_0x35592c[_0xa68a('0x5c')],{})[_0xa68a('0x20')](function(_0x4ff71c){var _0x26032e=_0x35592c[_0xa68a('0x5d')][_0xa68a('0x37')]({'plain':!![]});if(!_0x26032e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26032e['role']===_0xa68a('0x5d')){var _0x4fcd23=_0x4ff71c['get']({'plain':!![]});var _0x4b72c8=_0xa68a('0x38');return db[_0xa68a('0x5e')][_0xa68a('0x5a')]({'where':{'name':_0x4b72c8,'userProfileId':_0x26032e[_0xa68a('0x5f')]},'raw':!![]})[_0xa68a('0x20')](function(_0x3541f7){if(_0x3541f7&&_0x3541f7['autoAssociation']===0x0){return db['UserProfileResource'][_0xa68a('0x5b')]({'name':_0x4fcd23['name'],'resourceId':_0x4fcd23['id'],'type':_0x3541f7['name'],'sectionId':_0x3541f7['id']},{})['then'](function(){return _0x4ff71c;});}else{return _0x4ff71c;}})['catch'](function(_0x431187){logger[_0xa68a('0x28')](_0xa68a('0x60'),_0x431187);throw _0x431187;});}return _0x4ff71c;})[_0xa68a('0x20')](respondWithResult(_0x26b056,0xc9))[_0xa68a('0x2a')](handleError(_0x26b056,null));};exports[_0xa68a('0x35')]=function(_0x21688a,_0x1a470b){if(_0x21688a[_0xa68a('0x5c')]['id']){delete _0x21688a[_0xa68a('0x5c')]['id'];}return db[_0xa68a('0x41')]['find']({'where':{'id':_0x21688a['params']['id']},'include':[{'model':db[_0xa68a('0x3e')],'as':_0xa68a('0x3f')}]})[_0xa68a('0x20')](handleEntityNotFound(_0x1a470b,null))[_0xa68a('0x20')](saveUpdates(_0x21688a[_0xa68a('0x5c')],null))['then'](respondWithResult(_0x1a470b,null))[_0xa68a('0x2a')](handleError(_0x1a470b,null));};exports[_0xa68a('0x36')]=function(_0x47f469,_0x5b9c32){return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x47f469[_0xa68a('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b9c32,null))[_0xa68a('0x20')](removeEntity(_0x5b9c32,null))[_0xa68a('0x2a')](handleError(_0x5b9c32,null));};exports['describe']=function(_0x27634b,_0x58ade5){return db[_0xa68a('0x41')][_0xa68a('0x61')]()[_0xa68a('0x20')](respondWithResult(_0x58ade5,null))[_0xa68a('0x2a')](handleError(_0x58ade5,null));};exports[_0xa68a('0x62')]=function(_0x9e403c,_0x5b7e33,_0x4cb9a4){if(_0x9e403c[_0xa68a('0x5c')]['id']){delete _0x9e403c['body']['id'];}return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x9e403c['params']['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x5b7e33,null))[_0xa68a('0x20')](function(_0x2a4adb){if(_0x2a4adb){_0x9e403c['body']['SmsAccountId']=_0x2a4adb['id'];return db[_0xa68a('0x63')]['create'](_0x9e403c[_0xa68a('0x5c')]);}})['then'](respondWithResult(_0x5b7e33,null))[_0xa68a('0x2a')](handleError(_0x5b7e33,null));};exports['getDispositions']=function(_0x59d8ca,_0x5377ab,_0x2d3cc1){var _0xb688a6={'raw':![],'where':{}};var _0x2f09a1={};var _0x279edc={'count':0x0,'rows':[]};return db[_0xa68a('0x41')][_0xa68a('0x64')]({'where':{'id':_0x59d8ca['params']['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x5377ab,null))[_0xa68a('0x20')](function(_0x28272b){if(_0x28272b){_0x2f09a1[_0xa68a('0x45')]=_[_0xa68a('0x47')](db[_0xa68a('0x63')][_0xa68a('0x42')]);_0x2f09a1[_0xa68a('0x46')]=_[_0xa68a('0x47')](_0x59d8ca[_0xa68a('0x46')]);_0x2f09a1[_0xa68a('0x48')]=_[_0xa68a('0x49')](_0x2f09a1['model'],_0x2f09a1[_0xa68a('0x46')]);_0xb688a6[_0xa68a('0x4b')]=_[_0xa68a('0x49')](_0x2f09a1[_0xa68a('0x45')],qs[_0xa68a('0x4a')](_0x59d8ca['query']['fields']));_0xb688a6['attributes']=_0xb688a6[_0xa68a('0x4b')]['length']?_0xb688a6[_0xa68a('0x4b')]:_0x2f09a1['model'];if(!_0x59d8ca['query'][_0xa68a('0x4c')](_0xa68a('0x65'))){_0xb688a6[_0xa68a('0x31')]=qs[_0xa68a('0x31')](_0x59d8ca[_0xa68a('0x46')][_0xa68a('0x31')]);_0xb688a6[_0xa68a('0x2e')]=qs['offset'](_0x59d8ca['query'][_0xa68a('0x2e')]);}_0xb688a6[_0xa68a('0x4d')]=qs[_0xa68a('0x4e')](_0x59d8ca[_0xa68a('0x46')]['sort']);_0xb688a6[_0xa68a('0x4f')]=qs[_0xa68a('0x48')](_[_0xa68a('0x66')](_0x59d8ca[_0xa68a('0x46')],_0x2f09a1['filters']));_0xb688a6[_0xa68a('0x4f')]['SmsAccountId']=_0x28272b['id'];if(_0x59d8ca[_0xa68a('0x46')][_0xa68a('0x50')]){_0xb688a6[_0xa68a('0x4f')]=_['merge'](_0xb688a6[_0xa68a('0x4f')],{'$or':_[_0xa68a('0x40')](_0xb688a6['attributes'],function(_0x367c4c){var _0x4262bf={};_0x4262bf[_0x367c4c]={'$like':'%'+_0x59d8ca[_0xa68a('0x46')]['filter']+'%'};return _0x4262bf;})});}_0xb688a6=_['merge']({},_0xb688a6,_0x59d8ca[_0xa68a('0x53')]);return db[_0xa68a('0x63')][_0xa68a('0x30')]({'where':_0xb688a6[_0xa68a('0x4f')]})['then'](function(_0x1e394d){_0x279edc[_0xa68a('0x30')]=_0x1e394d;if(_0x59d8ca[_0xa68a('0x46')][_0xa68a('0x54')]){_0xb688a6[_0xa68a('0x59')]=[{'all':!![]}];}return db[_0xa68a('0x63')][_0xa68a('0x55')](_0xb688a6);})['then'](function(_0x4a3e75){_0x279edc[_0xa68a('0x56')]=_0x4a3e75;return _0x279edc;});}})[_0xa68a('0x20')](respondWithFilteredResult(_0x5377ab,_0xb688a6))['catch'](handleError(_0x5377ab,null));};exports[_0xa68a('0x67')]=function(_0x3fb19b,_0x2e2ad8,_0x2820ab){return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x3fb19b['params']['id']}})['then'](handleEntityNotFound(_0x2e2ad8,null))[_0xa68a('0x20')](function(_0x5ba633){if(_0x5ba633){return _0x5ba633['removeDispositions'](_0x3fb19b['query']['ids']);}})[_0xa68a('0x20')](respondWithStatusCode(_0x2e2ad8,null))[_0xa68a('0x2a')](handleError(_0x2e2ad8,null));};exports[_0xa68a('0x68')]=function(_0x42addc,_0x14fa6a,_0x388330){if(_0x42addc['body']['id']){delete _0x42addc['body']['id'];}return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x42addc['params']['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x14fa6a,null))[_0xa68a('0x20')](function(_0x2ecea7){if(_0x2ecea7){_0x42addc[_0xa68a('0x5c')][_0xa68a('0x69')]=_0x2ecea7['id'];return db[_0xa68a('0x6a')][_0xa68a('0x5b')](_0x42addc['body']);}})['then'](respondWithResult(_0x14fa6a,null))[_0xa68a('0x2a')](handleError(_0x14fa6a,null));};exports[_0xa68a('0x6b')]=function(_0x25c4a7,_0x4ca835,_0x1f7938){var _0x3c5019={'raw':![],'where':{}};var _0x48f75a={};var _0x52d24e={'count':0x0,'rows':[]};return db[_0xa68a('0x41')][_0xa68a('0x64')]({'where':{'id':_0x25c4a7['params']['id']}})['then'](handleEntityNotFound(_0x4ca835,null))[_0xa68a('0x20')](function(_0x2cf7c3){if(_0x2cf7c3){_0x48f75a[_0xa68a('0x45')]=_['keys'](db[_0xa68a('0x6a')][_0xa68a('0x42')]);_0x48f75a['query']=_[_0xa68a('0x47')](_0x25c4a7['query']);_0x48f75a[_0xa68a('0x48')]=_['intersection'](_0x48f75a[_0xa68a('0x45')],_0x48f75a[_0xa68a('0x46')]);_0x3c5019[_0xa68a('0x4b')]=_['intersection'](_0x48f75a[_0xa68a('0x45')],qs['fields'](_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x4a')]));_0x3c5019[_0xa68a('0x4b')]=_0x3c5019[_0xa68a('0x4b')][_0xa68a('0x6c')]?_0x3c5019[_0xa68a('0x4b')]:_0x48f75a[_0xa68a('0x45')];if(!_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x4c')](_0xa68a('0x65'))){_0x3c5019[_0xa68a('0x31')]=qs[_0xa68a('0x31')](_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x31')]);_0x3c5019['offset']=qs[_0xa68a('0x2e')](_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x2e')]);}_0x3c5019[_0xa68a('0x4d')]=qs['sort'](_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x4e')]);_0x3c5019['where']=qs[_0xa68a('0x48')](_['pick'](_0x25c4a7['query'],_0x48f75a[_0xa68a('0x48')]));_0x3c5019[_0xa68a('0x4f')]['SmsAccountId']=_0x2cf7c3['id'];if(_0x25c4a7['query']['filter']){_0x3c5019['where']=_[_0xa68a('0x51')](_0x3c5019['where'],{'$or':_[_0xa68a('0x40')](_0x3c5019[_0xa68a('0x4b')],function(_0x3e6249){var _0x3ebbe5={};_0x3ebbe5[_0x3e6249]={'$like':'%'+_0x25c4a7['query'][_0xa68a('0x50')]+'%'};return _0x3ebbe5;})});}_0x3c5019=_[_0xa68a('0x51')]({},_0x3c5019,_0x25c4a7['options']);return db[_0xa68a('0x6a')]['count']({'where':_0x3c5019['where']})[_0xa68a('0x20')](function(_0x3f2ff5){_0x52d24e[_0xa68a('0x30')]=_0x3f2ff5;if(_0x25c4a7[_0xa68a('0x46')][_0xa68a('0x54')]){_0x3c5019[_0xa68a('0x59')]=[{'all':!![]}];}return db[_0xa68a('0x6a')]['findAll'](_0x3c5019);})[_0xa68a('0x20')](function(_0x5d0173){_0x52d24e[_0xa68a('0x56')]=_0x5d0173;return _0x52d24e;});}})[_0xa68a('0x20')](respondWithFilteredResult(_0x4ca835,_0x3c5019))['catch'](handleError(_0x4ca835,null));};exports[_0xa68a('0x6d')]=function(_0x5e5169,_0x394fc2,_0xea1d6a){return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x5e5169[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x394fc2,null))[_0xa68a('0x20')](function(_0x33064f){if(_0x33064f){return _0x33064f['removeAnswers'](_0x5e5169[_0xa68a('0x46')][_0xa68a('0x6e')]);}})[_0xa68a('0x20')](respondWithStatusCode(_0x394fc2,null))[_0xa68a('0x2a')](handleError(_0x394fc2,null));};exports[_0xa68a('0x6f')]=function(_0x4323fa,_0x373ee8,_0x59ab7a){var _0x5e44a3={'channel':_0xa68a('0x70')};var _0x1ceff7=[];var _0x4fec4c=[];var _0x3766df={};return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x4323fa[_0xa68a('0x58')]['id']},'include':[{'model':db[_0xa68a('0x71')],'as':_0xa68a('0x72')}]})[_0xa68a('0x20')](handleEntityNotFound(_0x373ee8,null))[_0xa68a('0x20')](function(_0x21ca4c){_0x5e44a3[_0xa68a('0x73')]=_0x21ca4c;_0x5e44a3[_0xa68a('0x74')]=_[_0xa68a('0x75')](_0x21ca4c[_0xa68a('0x72')],[_0xa68a('0x76')],[_0xa68a('0x77')]);if(_0x5e44a3['account'][_0xa68a('0x72')]){delete _0x5e44a3[_0xa68a('0x73')][_0xa68a('0x72')];}return db[_0xa68a('0x78')][_0xa68a('0x61')]();})[_0xa68a('0x20')](function(_0x4ead6a){if(!_0x4ead6a){throw new db[(_0xa68a('0x79'))][(_0xa68a('0x7a'))](_0xa68a('0x7b'));}_0x1ceff7=_[_0xa68a('0x7c')](_[_0xa68a('0x47')](_0x4ead6a),[_0xa68a('0x7d'),_0xa68a('0x7e')]);_0x4fec4c=_[_0xa68a('0x7c')](_[_0xa68a('0x47')](_0x4ead6a),[_0xa68a('0x7d'),_0xa68a('0x7e'),'CompanyId',_0xa68a('0x7f')]);_0x5e44a3[_0xa68a('0x5c')]={'mapKey':_0xa68a('0x80')};if(_0x5e44a3['account'][_0xa68a('0x81')]){switch(_0x5e44a3['account'][_0xa68a('0x81')]){case _0xa68a('0x82'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x84')];_0x5e44a3['body'][_0xa68a('0x5c')]=_0x4323fa['body'][_0xa68a('0x85')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x87')];break;case _0xa68a('0x88'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]='+'+_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x89')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x8a')];break;case _0xa68a('0x8b'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x83')];_0x5e44a3['body'][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x29')];break;case _0xa68a('0x8c'):_0x5e44a3['body'][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x83')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x5c')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x8d')];break;case _0xa68a('0x8e'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x84')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x8f')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x90')];break;case _0xa68a('0x91'):_0x5e44a3['body']['from']='+'+_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x92')][0x0][_0xa68a('0x83')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')]['results'][0x0]['text'];_0x5e44a3['body'][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x92')][0x0][_0xa68a('0x86')];break;case _0xa68a('0x93'):_0x5e44a3['body'][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x94')];_0x5e44a3['body'][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x95')][_0xa68a('0x29')];break;case _0xa68a('0x96'):_0x5e44a3[_0xa68a('0x5c')]['from']=_0x4323fa[_0xa68a('0x5c')]['fromNumber'];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x8a')];_0x5e44a3['body'][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x97')];break;case _0xa68a('0x98'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')][0x0]['message']['id'];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][0x0][_0xa68a('0x29')]['from'];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][0x0][_0xa68a('0x29')][_0xa68a('0x8a')];break;case _0xa68a('0x99'):_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x83')];_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')]=_0x4323fa[_0xa68a('0x5c')][_0xa68a('0x29')];_0x5e44a3['body'][_0xa68a('0x86')]=_0x4323fa[_0xa68a('0x5c')]['refid'];break;}}if(_0x5e44a3[_0xa68a('0x5c')]['id']){delete _0x5e44a3[_0xa68a('0x5c')]['id'];}if(_[_0xa68a('0x9a')](_0x5e44a3['body']['from'])){throw new db[(_0xa68a('0x79'))][(_0xa68a('0x7a'))](_0xa68a('0x9b'));}if(_[_0xa68a('0x9a')](_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x5c')])||_0x5e44a3['body']['body']===''){throw new db[(_0xa68a('0x79'))][(_0xa68a('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa68a('0x9a')](_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x9c')])){throw new db[(_0xa68a('0x79'))]['ValidationError'](_0xa68a('0x9d')+_0x4fec4c);}if(!_['includes'](_0x4fec4c,_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x9c')])){throw new db[(_0xa68a('0x79'))][(_0xa68a('0x7a'))](_0xa68a('0x9e')+_0x4fec4c);}_0x3766df[_0x5e44a3['body']['mapKey']]=_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')];return db[_0xa68a('0x9f')][_0xa68a('0x5a')]({'where':{'id':_0x5e44a3['account']['ListId']},'include':[{'model':db[_0xa68a('0x78')],'as':_0xa68a('0xa0'),'where':_0x3766df,'limit':0x1,'order':[[_0xa68a('0x7e'),'DESC']]}]});})['then'](handleEntityNotFound(_0x373ee8,null))[_0xa68a('0x20')](function(_0x10b454){if(_0x10b454){_0x5e44a3[_0xa68a('0xa1')]=_[_0xa68a('0xa2')](_0x10b454,[_0xa68a('0xa0')]);if(_0x10b454[_0xa68a('0xa0')][_0xa68a('0x6c')]){return _0x10b454[_0xa68a('0xa0')][0x0];}var _0x18bcef=_[_0xa68a('0xa3')](_0x5e44a3[_0xa68a('0x5c')],{'firstName':_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')],'ListId':_0x10b454['id']});_0x18bcef[_0x5e44a3['body'][_0xa68a('0x9c')]]=_0x5e44a3['body'][_0xa68a('0x83')];return db[_0xa68a('0x78')][_0xa68a('0x5b')](_0x18bcef,{'fields':_0x1ceff7,'raw':!![]});}})[_0xa68a('0x20')](handleEntityNotFound(_0x373ee8,null))[_0xa68a('0x20')](function(_0x389e45){if(_0x389e45){_0x5e44a3['contact']=_0x389e45;var _0x1a2e66={'ContactId':_0x389e45['id'],'phone':_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0x83')],'SmsAccountId':_0x4323fa[_0xa68a('0x58')]['id']};var _0x4fbe91={'ContactId':_0x389e45['id'],'SmsAccountId':_0x4323fa['params']['id'],'closed':![]};return db[_0xa68a('0xa4')][_0xa68a('0x5a')]({'where':_0x4fbe91})[_0xa68a('0x20')](function(_0xee3db2){if(_0xee3db2){return[_0xee3db2,![]];}return db[_0xa68a('0xa4')][_0xa68a('0x5b')](_0x1a2e66)[_0xa68a('0x20')](function(_0x10314e){return[_0x10314e,!![]];});});}})[_0xa68a('0xa5')](function(_0x37703c,_0x38edf7){_0x5e44a3[_0xa68a('0xa6')]=_0x37703c[_0xa68a('0x37')]({'plain':!![]});_0x5e44a3[_0xa68a('0xa6')][_0xa68a('0xa7')]=![];if(_0x38edf7){if(_0x5e44a3[_0xa68a('0x73')][_0xa68a('0xa8')]){_0x5e44a3[_0xa68a('0x74')][_0xa68a('0xa9')]({'id':0x0,'priority':_0x5e44a3[_0xa68a('0x74')]['length']+0x1,'app':_0xa68a('0xaa'),'appdata':_0xa68a('0xab'),'interval':_0xa68a('0xac')});}_0x5e44a3[_0xa68a('0xa6')][_0xa68a('0xa7')]=!![];}return db[_0xa68a('0xad')]['create']({'phone':_0x5e44a3[_0xa68a('0x5c')]['from'],'messageId':_0x5e44a3['body'][_0xa68a('0x86')],'body':_0x5e44a3['body']['body'],'SmsAccountId':_0x4323fa[_0xa68a('0x58')]['id'],'SmsInteractionId':_0x37703c['id'],'direction':'in','ContactId':_0x37703c[_0xa68a('0xae')],'AttachmentId':_0x5e44a3[_0xa68a('0x5c')][_0xa68a('0xaf')]});})[_0xa68a('0x20')](function(_0x10f4f2){_0x5e44a3[_0xa68a('0x29')]=_0x10f4f2;if(_0x5e44a3['interaction']['UserId']){return db['User'][_0xa68a('0x5a')]({'attributes':['id','name'],'where':{'id':_0x5e44a3[_0xa68a('0xa6')]['UserId']}})['then'](function(_0x19ca4d){if(_0x19ca4d){_0x5e44a3[_0xa68a('0x74')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x19ca4d[_0xa68a('0x3b')]+','+(_0x5e44a3[_0xa68a('0x73')][_0xa68a('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xa68a('0xb1'),_0x5e44a3);});}return respondWithRpcPromise('Start',_0xa68a('0xb1'),_0x5e44a3);})['then'](function(_0x154618){if(_0x154618){var _0x287e47=0xc8;var _0x5ad601=_0xa68a('0xb2');logger['info'](_0xa68a('0x25'),_0x5ad601,_0x287e47,_0xa68a('0xb3'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5ad601,_0x287e47,_0xa68a('0xb3'),JSON['stringify'](_0x154618));if(_0x5e44a3[_0xa68a('0x73')][_0xa68a('0x81')]===_0xa68a('0x82')){return _0x373ee8[_0xa68a('0x2c')](_0x287e47)[_0xa68a('0xb4')](_0xa68a('0xb5'),_0xa68a('0xb6'))[_0xa68a('0x3c')](_0xa68a('0xb7'));}else{return _0x373ee8[_0xa68a('0x2c')](_0x287e47)[_0xa68a('0x2d')](_0x154618);}}})[_0xa68a('0x2a')](handleError(_0x373ee8,null));};exports[_0xa68a('0xb8')]=function(_0x5fc02c,_0x576bee){var _0x42d509=_0x5fc02c[_0xa68a('0x58')]['id'];var _0x516c9c=_0x5fc02c[_0xa68a('0x5c')];var _0x31711a=0xc8;var _0x50f2b8=null;return db[_0xa68a('0xb9')][_0xa68a('0xba')]({'isolationLevel':db[_0xa68a('0xb9')][_0xa68a('0xbb')][_0xa68a('0xbc')][_0xa68a('0xbd')]},function(_0x92b6bf){return db['SmsAccount'][_0xa68a('0x64')]({'where':{'id':_0x42d509},'transaction':_0x92b6bf})[_0xa68a('0x20')](function(_0x542b27){if(_0x542b27){return db['SmsApplication'][_0xa68a('0x36')]({'where':{'SmsAccountId':_0x42d509},'transaction':_0x92b6bf})[_0xa68a('0x20')](function(){var _0x185d55=_[_0xa68a('0x40')](_0x516c9c,function(_0x948cc){_0x948cc['SmsAccountId']=_0x42d509;return _0x948cc;});return db[_0xa68a('0x71')][_0xa68a('0xbe')](_0x185d55,{'transaction':_0x92b6bf});});}else{_0x31711a=0x194;_0x50f2b8=[];}});})[_0xa68a('0x20')](function(){if(_0x31711a!==0x194){return db['SmsApplication'][_0xa68a('0xbf')]({'where':{'SmsAccountId':_0x42d509},'order':_0xa68a('0x76')})['then'](function(_0x3898fa){_0x50f2b8=_0x3898fa;});}})[_0xa68a('0x2a')](function(_0x1b9df1){_0x31711a=0x1f4;logger[_0xa68a('0x28')](_0x1b9df1['stack']);if(_0x1b9df1[_0xa68a('0x3b')]){delete _0x1b9df1['name'];}_0x50f2b8=_0x1b9df1;})[_0xa68a('0xc0')](function(){if(_0x50f2b8===null){_0x576bee[_0xa68a('0x2b')](_0x31711a);}else{if(_0x31711a===0x1f4){_0x576bee[_0xa68a('0x2c')](_0x31711a)[_0xa68a('0x3c')](_0x50f2b8);}else{_0x576bee[_0xa68a('0x2c')](_0x31711a)[_0xa68a('0x2d')](_0x50f2b8);}}});};exports[_0xa68a('0xc1')]=function(_0x26d339,_0x113f9a,_0x565d80){var _0xc87cbf={};var _0x4a1d4b={};var _0x3762fc;var _0x1fe52a;return db[_0xa68a('0x41')][_0xa68a('0x64')]({'where':{'id':_0x26d339[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x113f9a,null))[_0xa68a('0x20')](function(_0x45721e){if(_0x45721e){_0x3762fc=_0x45721e;_0x4a1d4b[_0xa68a('0x45')]=_[_0xa68a('0x47')](db['SmsApplication'][_0xa68a('0x42')]);_0x4a1d4b[_0xa68a('0x46')]=_[_0xa68a('0x47')](_0x26d339[_0xa68a('0x46')]);_0x4a1d4b[_0xa68a('0x48')]=_[_0xa68a('0x49')](_0x4a1d4b[_0xa68a('0x45')],_0x4a1d4b[_0xa68a('0x46')]);_0xc87cbf[_0xa68a('0x4b')]=_[_0xa68a('0x49')](_0x4a1d4b[_0xa68a('0x45')],qs['fields'](_0x26d339['query']['fields']));_0xc87cbf[_0xa68a('0x4b')]=_0xc87cbf['attributes'][_0xa68a('0x6c')]?_0xc87cbf[_0xa68a('0x4b')]:_0x4a1d4b[_0xa68a('0x45')];_0xc87cbf[_0xa68a('0x4d')]=qs['sort'](_0x26d339[_0xa68a('0x46')][_0xa68a('0x4e')]);_0xc87cbf[_0xa68a('0x4f')]=qs[_0xa68a('0x48')](_[_0xa68a('0x66')](_0x26d339['query'],_0x4a1d4b[_0xa68a('0x48')]));if(_0x26d339['query']['filter']){_0xc87cbf[_0xa68a('0x4f')]=_[_0xa68a('0x51')](_0xc87cbf['where'],{'$or':_[_0xa68a('0x40')](_0xc87cbf[_0xa68a('0x4b')],function(_0x39ffa8){var _0x144a25={};_0x144a25[_0x39ffa8]={'$like':'%'+_0x26d339[_0xa68a('0x46')][_0xa68a('0x50')]+'%'};return _0x144a25;})});}_0xc87cbf=_['merge']({},_0xc87cbf,_0x26d339['options']);return _0x3762fc[_0xa68a('0xc1')](_0xc87cbf);}})[_0xa68a('0x20')](function(_0x2349a6){if(_0x2349a6){_0x1fe52a=_0x2349a6[_0xa68a('0x6c')];if(!_0x26d339[_0xa68a('0x46')]['hasOwnProperty'](_0xa68a('0x65'))){_0xc87cbf[_0xa68a('0x31')]=qs[_0xa68a('0x31')](_0x26d339[_0xa68a('0x46')][_0xa68a('0x31')]);_0xc87cbf['offset']=qs[_0xa68a('0x2e')](_0x26d339[_0xa68a('0x46')][_0xa68a('0x2e')]);}return _0x3762fc[_0xa68a('0xc1')](_0xc87cbf);}})[_0xa68a('0x20')](function(_0x363129){if(_0x363129){return _0x363129?{'count':_0x1fe52a,'rows':_0x363129}:null;}})['then'](respondWithResult(_0x113f9a,null))[_0xa68a('0x2a')](handleError(_0x113f9a,null));};exports[_0xa68a('0xc2')]=function(_0x300a20,_0xdd0dc0,_0x285912){var _0x5c7fab={'raw':![],'where':{}};var _0x50e706={};var _0x1234b9={'count':0x0,'rows':[]};return db[_0xa68a('0x41')][_0xa68a('0x64')]({'where':{'id':_0x300a20[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0xdd0dc0,null))[_0xa68a('0x20')](function(_0x5b3c12){if(_0x5b3c12){_0x50e706[_0xa68a('0x45')]=_[_0xa68a('0x47')](db[_0xa68a('0xa4')][_0xa68a('0x42')]);_0x50e706[_0xa68a('0x46')]=_[_0xa68a('0x47')](_0x300a20[_0xa68a('0x46')]);_0x50e706[_0xa68a('0x48')]=_[_0xa68a('0x49')](_0x50e706[_0xa68a('0x45')],_0x50e706[_0xa68a('0x46')]);_0x5c7fab[_0xa68a('0x4b')]=_['intersection'](_0x50e706[_0xa68a('0x45')],qs['fields'](_0x300a20[_0xa68a('0x46')][_0xa68a('0x4a')]));_0x5c7fab[_0xa68a('0x4b')]=_0x5c7fab[_0xa68a('0x4b')][_0xa68a('0x6c')]?_0x5c7fab[_0xa68a('0x4b')]:_0x50e706[_0xa68a('0x45')];if(!_0x300a20[_0xa68a('0x46')][_0xa68a('0x4c')](_0xa68a('0x65'))){_0x5c7fab['limit']=qs[_0xa68a('0x31')](_0x300a20['query'][_0xa68a('0x31')]);_0x5c7fab[_0xa68a('0x2e')]=qs['offset'](_0x300a20[_0xa68a('0x46')][_0xa68a('0x2e')]);}_0x5c7fab['order']=qs[_0xa68a('0x4e')](_0x300a20[_0xa68a('0x46')]['sort']);_0x5c7fab[_0xa68a('0x4f')]=qs['filters'](_[_0xa68a('0x66')](_0x300a20['query'],_0x50e706[_0xa68a('0x48')]));_0x5c7fab[_0xa68a('0x4f')][_0xa68a('0x69')]=_0x5b3c12['id'];if(_0x300a20[_0xa68a('0x46')]['filter']){_0x5c7fab[_0xa68a('0x4f')]=_['merge'](_0x5c7fab[_0xa68a('0x4f')],{'$or':_[_0xa68a('0x40')](_0x5c7fab[_0xa68a('0x4b')],function(_0x378478){var _0x413b1d={};_0x413b1d[_0x378478]={'$like':'%'+_0x300a20[_0xa68a('0x46')][_0xa68a('0x50')]+'%'};return _0x413b1d;})});}_0x5c7fab=_[_0xa68a('0x51')]({},_0x5c7fab,_0x300a20[_0xa68a('0x53')]);return db[_0xa68a('0xa4')][_0xa68a('0x30')]({'where':_0x5c7fab['where']})[_0xa68a('0x20')](function(_0x2582ba){_0x1234b9[_0xa68a('0x30')]=_0x2582ba;if(_0x300a20[_0xa68a('0x46')][_0xa68a('0x54')]){_0x5c7fab[_0xa68a('0x59')]=[{'model':db['CmContact'],'as':_0xa68a('0xc3'),'required':![]},{'model':db[_0xa68a('0xc4')],'as':_0xa68a('0xc5'),'attributes':[_0xa68a('0x3b'),_0xa68a('0xc6'),_0xa68a('0xc7')],'required':![]},{'model':db['Tag'],'as':_0xa68a('0xc8'),'attributes':['id',_0xa68a('0x3b'),'color'],'where':_0x300a20[_0xa68a('0x46')]['tag']?{'id':_0x300a20[_0xa68a('0x46')][_0xa68a('0xc9')]}:undefined,'required':_0x300a20[_0xa68a('0x46')][_0xa68a('0xc9')]?!![]:![]}];}return db[_0xa68a('0xa4')][_0xa68a('0x55')](_0x5c7fab);})[_0xa68a('0x20')](function(_0x595480){_0x1234b9[_0xa68a('0x56')]=_0x595480;return _0x1234b9;});}})['then'](respondWithFilteredResult(_0xdd0dc0,_0x5c7fab))[_0xa68a('0x2a')](handleError(_0xdd0dc0,null));};exports[_0xa68a('0x3c')]=function(_0x1de83c,_0x9abda1,_0x2be74e){var _0x150e83,_0x593884,_0x152c02;if(_['isNil'](_0x1de83c[_0xa68a('0x5c')][_0xa68a('0x5c')])||_0x1de83c[_0xa68a('0x5c')][_0xa68a('0x5c')]===''){throw new db[(_0xa68a('0x79'))]['ValidationError'](_0xa68a('0xca'));}if(_[_0xa68a('0x9a')](_0x1de83c['body']['to'])){throw new db[(_0xa68a('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x150e83=_0x1de83c[_0xa68a('0x5c')]['to'];return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x1de83c[_0xa68a('0x58')]['id']},'include':[{'model':db[_0xa68a('0x9f')],'as':_0xa68a('0xcb'),'include':[{'model':db[_0xa68a('0x78')],'as':_0xa68a('0xa0'),'where':{'mobile':_0x150e83},'limit':0x1,'order':[[_0xa68a('0x7e'),'DESC']]}]}]})[_0xa68a('0x20')](handleEntityNotFound(_0x9abda1,null))[_0xa68a('0x20')](function(_0x4bbc70){if(_0x4bbc70&&_0x4bbc70[_0xa68a('0xcb')]){_0x593884=_0x4bbc70[_0xa68a('0x37')]({'plain':!![]});if(_0x593884[_0xa68a('0xcb')]&&_0x593884['List'][_0xa68a('0xa0')][_0xa68a('0x6c')]){return _0x593884['List'][_0xa68a('0xa0')][0x0];}return db['CmContact'][_0xa68a('0x5b')](_[_0xa68a('0xa3')](_0x1de83c[_0xa68a('0x5c')],{'firstName':_0x150e83,'mobile':_0x150e83,'phone':_0x150e83,'ListId':_0x593884[_0xa68a('0x7f')]}));}})['then'](handleEntityNotFound(_0x9abda1,null))[_0xa68a('0x20')](function(_0x431b06){if(_0x431b06){_0x152c02=_0x431b06;return db['SmsInteraction'][_0xa68a('0x5a')]({'where':{'ContactId':_0x152c02['id'],'closed':![],'SmsAccountId':_0x593884['id']}})[_0xa68a('0x20')](function(_0x1ea01a){if(_0x1ea01a){return[_0x1ea01a,![]];}return db[_0xa68a('0xa4')][_0xa68a('0x5b')]({'UserId':_0x1de83c['user']['id'],'ContactId':_0x152c02['id'],'SmsAccountId':_0x593884['id'],'phone':_0x150e83,'firstMsgDirection':'out','Messages':[_[_0xa68a('0x51')](_0x1de83c[_0xa68a('0x5c')],{'read':![],'body':_0x1de83c[_0xa68a('0x5c')][_0xa68a('0x5c')],'phone':_0x150e83,'SmsAccountId':_0x593884['id'],'UserId':_0x1de83c[_0xa68a('0x5d')]['id'],'ContactId':_0x152c02['id']})]},{'include':[{'model':db[_0xa68a('0xad')],'as':'Messages'}]})[_0xa68a('0x20')](function(_0x2ca1d8){return[_0x2ca1d8,!![]];});});}})[_0xa68a('0xa5')](function(_0x48daf7,_0x153551){if(_0x153551){return _0x48daf7;}return db[_0xa68a('0xad')][_0xa68a('0x5b')](_['merge'](_0x1de83c[_0xa68a('0x5c')],{'read':![],'body':_0x1de83c[_0xa68a('0x5c')][_0xa68a('0x5c')],'phone':_0x150e83,'SmsAccountId':_0x593884['id'],'SmsInteractionId':_0x48daf7['id'],'UserId':_0x1de83c[_0xa68a('0x5d')]['id'],'ContactId':_0x152c02['id']}))[_0xa68a('0x20')](function(_0x1032a7){_0x48daf7[_0xa68a('0xcc')][_0xa68a('0xcd')]=[];_0x48daf7['dataValues'][_0xa68a('0xcd')][_0xa68a('0xa9')](_0x1032a7[_0xa68a('0xcc')]);return _0x48daf7;});})[_0xa68a('0x20')](respondWithResult(_0x9abda1,null))[_0xa68a('0x2a')](handleError(_0x9abda1,null));};exports[_0xa68a('0x2c')]=function(_0x66cedc,_0x25aa7d,_0x384154){if(_0x66cedc[_0xa68a('0x5c')]['id']){delete _0x66cedc[_0xa68a('0x5c')]['id'];}var _0x500dc5,_0x234eac,_0x467645;return db[_0xa68a('0x41')]['find']({'where':{'id':_0x66cedc[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x25aa7d,null))[_0xa68a('0x20')](function(_0x29127d){if(_0x29127d){_0x467645=_0x29127d;logger[_0xa68a('0x24')](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0xce'),_0x29127d[_0xa68a('0x81')],util['inspect'](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));switch(_0x29127d['type']){case _0xa68a('0x88'):if(_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xcf')]&&_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x2c')]){_0x234eac=_0x66cedc['body'][_0xa68a('0x2c')];return db[_0xa68a('0xad')][_0xa68a('0x5a')]({'where':{'messageId':_0x66cedc['body'][_0xa68a('0xcf')]}});}break;case _0xa68a('0x8b'):if(_0x66cedc['body'][_0xa68a('0xd0')]&&_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xd1')]){_0x234eac=_0x66cedc['body']['statusInt'];return db[_0xa68a('0xad')][_0xa68a('0x5a')]({'where':{'messageId':_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xd0')]}});}break;case _0xa68a('0x8c'):if(_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x8d')]&&_0x66cedc['body'][_0xa68a('0xd2')]){_0x234eac=_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xd2')];return db['SmsMessage'][_0xa68a('0x5a')]({'where':{'messageId':_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x8d')]}});}break;case'infobip':var _0x5a2cc2=_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x92')][0x0];if(_0x5a2cc2[_0xa68a('0x86')]&&_0x5a2cc2[_0xa68a('0x2c')][_0xa68a('0xd3')]===_0xa68a('0xd4')){_0x234eac=_0x5a2cc2[_0xa68a('0x2c')][_0xa68a('0xd3')];return db['SmsMessage'][_0xa68a('0x5a')]({'where':{'messageId':_0x5a2cc2[_0xa68a('0x86')]}});}break;case _0xa68a('0x96'):if(_0x66cedc[_0xa68a('0x5c')]['messageId']&&_0x66cedc['body'][_0xa68a('0x2c')]){_0x234eac=_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x2c')];return db[_0xa68a('0xad')]['find']({'where':{'messageId':_0x66cedc[_0xa68a('0x5c')]['messageId']}});}break;case _0xa68a('0x98'):if(_0x66cedc[_0xa68a('0x5c')][0x0]['message']['id']){_0x234eac=_0x66cedc[_0xa68a('0x5c')][0x0]['type'];return db[_0xa68a('0xad')][_0xa68a('0x5a')]({'where':{'messageId':_0x66cedc[_0xa68a('0x5c')][0x0][_0xa68a('0x29')]['id']}});}break;case'intelepeer':if(_0x66cedc[_0xa68a('0x5c')]['redif']&&_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x2c')]){_0x234eac=_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x2c')];return db['SmsMessage'][_0xa68a('0x5a')]({'where':{'messageId':_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xd5')]}});}break;}}})[_0xa68a('0x20')](handleEntityNotFound(_0x25aa7d,null))['then'](function(_0x449a7b){if(_0x449a7b){_0x500dc5=_0x449a7b;switch(_0x467645['type']){case _0xa68a('0x88'):if(_0x234eac===_0xa68a('0xd4')){return _0x500dc5['update']({'read':!![]});}else{logger[_0xa68a('0x28')](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0x88'),util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa68a('0x8b'):if(_0x234eac==='1'){return _0x500dc5[_0xa68a('0x35')]({'read':!![]});}else{logger['error'](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0x88'),util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa68a('0x8c'):if(!_0x66cedc[_0xa68a('0x5c')][_0xa68a('0xd7')]&&_0x234eac>=0xc8&&_0x234eac<=0xce){return _0x500dc5['update']({'read':!![]});}else{logger[_0xa68a('0x28')](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0x8c'),util['inspect'](_0x66cedc['body'],{'showHidden':![],'depth':null}));}break;case _0xa68a('0x91'):var _0x4bee24=_0x66cedc[_0xa68a('0x5c')][_0xa68a('0x92')][0x0];if(_0x4bee24['status'][_0xa68a('0xd3')]===_0xa68a('0xd4')){return _0x500dc5[_0xa68a('0x35')]({'read':!![]});}else{logger[_0xa68a('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa68a('0x2c'),'infobip',util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa68a('0x96'):if(_0x234eac==_0xa68a('0xd8')||_0x234eac==_0xa68a('0xd9')){return _0x500dc5[_0xa68a('0x35')]({'read':!![]});}else{logger['error'](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0x96'),util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x234eac==_0xa68a('0xda')){return _0x500dc5[_0xa68a('0x35')]({'read':!![]});}else{logger[_0xa68a('0x28')](_0xa68a('0x25'),_0xa68a('0x2c'),'bandwidth',util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xa68a('0x99'):if(_0x234eac===_0xa68a('0xdb')||_0x234eac==='ACCEPTD'){return _0x500dc5['update']({'read':!![]});}else{logger[_0xa68a('0x28')](_0xa68a('0x25'),_0xa68a('0x2c'),'intelepeer',util[_0xa68a('0xd6')](_0x66cedc[_0xa68a('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x500dc5;}})['then'](respondWithResult(_0x25aa7d,null))[_0xa68a('0x2a')](handleError(_0x25aa7d,null));};exports['statusGet']=function(_0x43c3c0,_0x5e3a29,_0x22eb8e){var _0x1d4616,_0x4e090a,_0x4aa140;return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x43c3c0[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x5e3a29,null))[_0xa68a('0x20')](function(_0x1bd4f3){if(_0x1bd4f3){_0x4aa140=_0x1bd4f3;logger['debug'](_0xa68a('0x25'),_0xa68a('0x2c'),'received\x20delivery\x20report\x20from',_0x1bd4f3[_0xa68a('0x81')],util['inspect'](_0x43c3c0[_0xa68a('0x46')],{'showHidden':![],'depth':null}));switch(_0x1bd4f3[_0xa68a('0x81')]){case _0xa68a('0x93'):if(_0x43c3c0[_0xa68a('0x46')][_0xa68a('0xdc')]&&_0x43c3c0[_0xa68a('0x46')][_0xa68a('0xdd')]){_0x4e090a=_0x43c3c0[_0xa68a('0x46')][_0xa68a('0xdd')];return db[_0xa68a('0xad')][_0xa68a('0x5a')]({'where':{'messageId':_0x43c3c0[_0xa68a('0x46')][_0xa68a('0xdc')]}});}break;}}})[_0xa68a('0x20')](handleEntityNotFound(_0x5e3a29,null))[_0xa68a('0x20')](function(_0x3b600e){if(_0x3b600e){_0x1d4616=_0x3b600e;switch(_0x4aa140[_0xa68a('0x81')]){case'csc':if(_0x4e090a==='2'||_0x4e090a==='6'){return _0x1d4616[_0xa68a('0x35')]({'read':!![]});}else{logger[_0xa68a('0x28')](_0xa68a('0x25'),_0xa68a('0x2c'),_0xa68a('0x93'),util['inspect'](_0x43c3c0[_0xa68a('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x1d4616;}})['then'](respondWithResult(_0x5e3a29,null))[_0xa68a('0x2a')](handleError(_0x5e3a29,null));};exports['addAgents']=function(_0x1b0f77,_0x5b2913,_0x5ce138){return db[_0xa68a('0x41')][_0xa68a('0x5a')]({'where':{'id':_0x1b0f77[_0xa68a('0x58')]['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x5b2913,null))[_0xa68a('0x20')](function(_0x2bd324){if(_0x2bd324){return _0x2bd324['addAgents'](_0x1b0f77[_0xa68a('0x5c')][_0xa68a('0x6e')],_[_0xa68a('0xa2')](_0x1b0f77['body'],['ids','id'])||{})[_0xa68a('0xa5')](function(_0x487a98){for(var _0xa254a8=0x0;_0xa254a8<_0x1b0f77[_0xa68a('0x5c')]['ids']['length'];_0xa254a8+=0x1){socket[_0xa68a('0xde')](_0xa68a('0xdf'),{'UserId':Number(_0x1b0f77[_0xa68a('0x5c')][_0xa68a('0x6e')][_0xa254a8]),'SmsAccountId':Number(_0x1b0f77[_0xa68a('0x58')]['id'])});}return _0x487a98;});}})['then'](respondWithResult(_0x5b2913,null))[_0xa68a('0x2a')](handleError(_0x5b2913,null));};exports['removeAgents']=function(_0x27cfea,_0x21002f,_0x28f25b){return db['SmsAccount'][_0xa68a('0x5a')]({'where':{'id':_0x27cfea['params']['id']}})[_0xa68a('0x20')](handleEntityNotFound(_0x21002f,null))['then'](function(_0x39c8f7){if(_0x39c8f7){return _0x39c8f7[_0xa68a('0xe0')](_0x27cfea[_0xa68a('0x46')]['ids'])[_0xa68a('0x20')](function(){if(_[_0xa68a('0xe1')](_0x27cfea[_0xa68a('0x46')][_0xa68a('0x6e')])){for(var _0x155631=0x0;_0x155631<_0x27cfea[_0xa68a('0x46')][_0xa68a('0x6e')][_0xa68a('0x6c')];_0x155631+=0x1){socket[_0xa68a('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x27cfea['query'][_0xa68a('0x6e')][_0x155631]),'SmsAccountId':Number(_0x27cfea[_0xa68a('0x58')]['id'])});}}else{socket[_0xa68a('0xde')]('userSmsAccount:remove',{'UserId':Number(_0x27cfea[_0xa68a('0x46')][_0xa68a('0x6e')]),'SmsAccountId':Number(_0x27cfea[_0xa68a('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x21002f,null))[_0xa68a('0x2a')](handleError(_0x21002f,null));};exports[_0xa68a('0xe2')]=function(_0x59a72c,_0x2e3262,_0x48c03a){var _0x3194e={};var _0x9574a5={};var _0x4efed6;var _0x1fbf25;return db['SmsAccount'][_0xa68a('0x64')]({'where':{'id':_0x59a72c[_0xa68a('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e3262,null))[_0xa68a('0x20')](function(_0xe8a9a9){if(_0xe8a9a9){_0x4efed6=_0xe8a9a9;_0x9574a5[_0xa68a('0x45')]=_[_0xa68a('0x47')](db['User'][_0xa68a('0x42')]);_0x9574a5['query']=_['keys'](_0x59a72c['query']);_0x9574a5['filters']=_[_0xa68a('0x49')](_0x9574a5[_0xa68a('0x45')],_0x9574a5['query']);_0x3194e[_0xa68a('0x4b')]=_[_0xa68a('0x49')](_0x9574a5[_0xa68a('0x45')],qs[_0xa68a('0x4a')](_0x59a72c['query'][_0xa68a('0x4a')]));_0x3194e[_0xa68a('0x4b')]=_0x3194e['attributes'][_0xa68a('0x6c')]?_0x3194e[_0xa68a('0x4b')]:_0x9574a5[_0xa68a('0x45')];_0x3194e['order']=qs[_0xa68a('0x4e')](_0x59a72c[_0xa68a('0x46')][_0xa68a('0x4e')]);_0x3194e[_0xa68a('0x4f')]=qs[_0xa68a('0x48')](_[_0xa68a('0x66')](_0x59a72c[_0xa68a('0x46')],_0x9574a5['filters']));if(_0x59a72c[_0xa68a('0x46')][_0xa68a('0x50')]){_0x3194e[_0xa68a('0x4f')]=_[_0xa68a('0x51')](_0x3194e[_0xa68a('0x4f')],{'$or':_['map'](_0x3194e[_0xa68a('0x4b')],function(_0x45411c){var _0x5f22a5={};_0x5f22a5[_0x45411c]={'$like':'%'+_0x59a72c[_0xa68a('0x46')][_0xa68a('0x50')]+'%'};return _0x5f22a5;})});}_0x3194e=_[_0xa68a('0x51')]({},_0x3194e,_0x59a72c[_0xa68a('0x53')]);return _0x4efed6['getAgents'](_0x3194e);}})[_0xa68a('0x20')](function(_0x269c5d){if(_0x269c5d){_0x1fbf25=_0x269c5d['length'];if(!_0x59a72c[_0xa68a('0x46')][_0xa68a('0x4c')]('nolimit')){_0x3194e[_0xa68a('0x31')]=qs[_0xa68a('0x31')](_0x59a72c[_0xa68a('0x46')]['limit']);_0x3194e[_0xa68a('0x2e')]=qs[_0xa68a('0x2e')](_0x59a72c[_0xa68a('0x46')][_0xa68a('0x2e')]);}return _0x4efed6['getAgents'](_0x3194e);}})['then'](function(_0x4c4c1a){if(_0x4c4c1a){return _0x4c4c1a?{'count':_0x1fbf25,'rows':_0x4c4c1a}:null;}})[_0xa68a('0x20')](respondWithResult(_0x2e3262,null))[_0xa68a('0x2a')](handleError(_0x2e3262,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a48dbdb..78fe3d7 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 _0x3905=['../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x79ca66,_0x41e29f){var _0x31040f=function(_0x335c35){while(--_0x335c35){_0x79ca66['push'](_0x79ca66['shift']());}};_0x31040f(++_0x41e29f);}(_0x3905,0x1cf));var _0x5390=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x3905[_0x3d34da];return _0xcf6af8;};'use strict';var EventEmitter=require(_0x5390('0x0'));var SmsAccount=require(_0x5390('0x1'))['db'][_0x5390('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5390('0x3'),'afterUpdate':'update','afterDestroy':_0x5390('0x4')};function emitEvent(_0x40b39e){return function(_0x3d199a,_0x58d78d,_0x37a7ac){SmsAccountEvents[_0x5390('0x5')](_0x40b39e+':'+_0x3d199a['id'],_0x3d199a);SmsAccountEvents[_0x5390('0x5')](_0x40b39e,_0x3d199a);_0x37a7ac(null);};}for(var e in events){if(events[_0x5390('0x6')](e)){var event=events[e];SmsAccount[_0x5390('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xd762=['exports','events','SmsAccount','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd762,0xb0));var _0x2d76=function(_0x31c798,_0x2f1872){_0x31c798=_0x31c798-0x0;var _0x5e508d=_0xd762[_0x31c798];return _0x5e508d;};'use strict';var EventEmitter=require(_0x2d76('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x2d76('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d76('0x2'),'afterDestroy':_0x2d76('0x3')};function emitEvent(_0x4d06b7){return function(_0x361c2a,_0x169ac1,_0x3c956b){SmsAccountEvents['emit'](_0x4d06b7+':'+_0x361c2a['id'],_0x361c2a);SmsAccountEvents[_0x2d76('0x4')](_0x4d06b7,_0x361c2a);_0x3c956b(null);};}for(var e in events){if(events[_0x2d76('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x2d76('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 30bba37..218d027 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 _0x2f65=['sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x559ff5,_0x389fda){var _0x51483e=function(_0x1ce5f3){while(--_0x1ce5f3){_0x559ff5['push'](_0x559ff5['shift']());}};_0x51483e(++_0x389fda);}(_0x2f65,0xf1));var _0x52f6=function(_0x3fe5de,_0x515efa){_0x3fe5de=_0x3fe5de-0x0;var _0x500a65=_0x2f65[_0x3fe5de];return _0x500a65;};'use strict';var _=require(_0x52f6('0x0'));var util=require(_0x52f6('0x1'));var logger=require(_0x52f6('0x2'))('api');var moment=require(_0x52f6('0x3'));var BPromise=require(_0x52f6('0x4'));var rp=require(_0x52f6('0x5'));var fs=require('fs');var path=require(_0x52f6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x52f6('0x7')]=function(_0x3d1035,_0x1e1692){return _0x3d1035[_0x52f6('0x8')]('SmsAccount',attributes,{'tableName':_0x52f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x810b=['exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x46ede9,_0x18ad7b){var _0x35af8b=function(_0xb13571){while(--_0xb13571){_0x46ede9['push'](_0x46ede9['shift']());}};_0x35af8b(++_0x18ad7b);}(_0x810b,0x66));var _0xb810=function(_0x30a2f2,_0x13bb5f){_0x30a2f2=_0x30a2f2-0x0;var _0x4a7bb9=_0x810b[_0x30a2f2];return _0x4a7bb9;};'use strict';var _=require(_0xb810('0x0'));var util=require(_0xb810('0x1'));var logger=require('../../config/logger')(_0xb810('0x2'));var moment=require(_0xb810('0x3'));var BPromise=require(_0xb810('0x4'));var rp=require(_0xb810('0x5'));var fs=require('fs');var path=require(_0xb810('0x6'));var rimraf=require(_0xb810('0x7'));var config=require(_0xb810('0x8'));var attributes=require(_0xb810('0x9'));module[_0xb810('0xa')]=function(_0x7c8f7b,_0x7e7627){return _0x7c8f7b[_0xb810('0xb')](_0xb810('0xc'),attributes,{'tableName':_0xb810('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index c57343d..e3c53dd 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 _0x07d0=['localhost','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','options','raw','where','attributes','include','map','model','then','debug','ShowSmsAccount','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x1bbaa3,_0x15f691){var _0x5062dd=function(_0x2ef7c0){while(--_0x2ef7c0){_0x1bbaa3['push'](_0x1bbaa3['shift']());}};_0x5062dd(++_0x15f691);}(_0x07d0,0x176));var _0x007d=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x07d0[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x007d('0x0'));var util=require('util');var moment=require(_0x007d('0x1'));var BPromise=require('bluebird');var rs=require(_0x007d('0x2'));var fs=require('fs');var Redis=require(_0x007d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x007d('0x4'));var config=require(_0x007d('0x5'));var jayson=require(_0x007d('0x6'));var client=jayson['client'][_0x007d('0x7')]({'port':0x232a});config[_0x007d('0x8')]=_[_0x007d('0x9')](config['redis'],{'host':_0x007d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x007d('0x8')]));require(_0x007d('0xb'))[_0x007d('0xc')](socket);function respondWithRpcPromise(_0x438ae9,_0x9c4a17,_0x1b8db1){return new BPromise(function(_0x56a6f1,_0x1771a1){return client['request'](_0x438ae9,_0x1b8db1)['then'](function(_0x287530){logger['info'](_0x007d('0xd'),_0x9c4a17,_0x007d('0xe'));logger['debug'](_0x007d('0xf'),_0x9c4a17,_0x007d('0xe'),JSON[_0x007d('0x10')](_0x287530));if(_0x287530[_0x007d('0x11')]){if(_0x287530['error'][_0x007d('0x12')]===0x1f4){logger['error'](_0x007d('0xd'),_0x9c4a17,_0x287530[_0x007d('0x11')][_0x007d('0x13')]);return _0x1771a1(_0x287530[_0x007d('0x11')][_0x007d('0x13')]);}logger[_0x007d('0x11')](_0x007d('0xd'),_0x9c4a17,_0x287530['error'][_0x007d('0x13')]);return _0x56a6f1(_0x287530[_0x007d('0x11')][_0x007d('0x13')]);}else{logger[_0x007d('0x14')](_0x007d('0xd'),_0x9c4a17,_0x007d('0xe'));_0x56a6f1(_0x287530['result']['message']);}})[_0x007d('0x15')](function(_0x13202f){logger['error'](_0x007d('0xd'),_0x9c4a17,_0x13202f);_0x1771a1(_0x13202f);});});}exports['ShowSmsAccount']=function(_0x3b1b92){var _0x270aee=this;return new Promise(function(_0x1a8656,_0x4bd859){return db['SmsAccount']['find']({'raw':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x17')]===undefined?!![]:![]:!![],'where':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x18')]||null:null,'attributes':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x19')]||null:null,'include':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x1a')]?_[_0x007d('0x1b')](_0x3b1b92[_0x007d('0x16')][_0x007d('0x1a')],function(_0x3580e2){return{'model':db[_0x3580e2[_0x007d('0x1c')]],'as':_0x3580e2['as'],'attributes':_0x3580e2[_0x007d('0x19')],'include':_0x3580e2[_0x007d('0x1a')]?_[_0x007d('0x1b')](_0x3580e2[_0x007d('0x1a')],function(_0x326190){return{'model':db[_0x326190[_0x007d('0x1c')]],'as':_0x326190['as'],'attributes':_0x326190[_0x007d('0x19')],'include':_0x326190['include']?_['map'](_0x326190[_0x007d('0x1a')],function(_0x2a1182){return{'model':db[_0x2a1182['model']],'as':_0x2a1182['as'],'attributes':_0x2a1182['attributes']};}):[]};}):[]};}):[]:[]})[_0x007d('0x1d')](function(_0x78bc0c){logger[_0x007d('0x14')]('ShowSmsAccount',_0x3b1b92);logger[_0x007d('0x1e')](_0x007d('0x1f'),_0x3b1b92,JSON[_0x007d('0x10')](_0x78bc0c));_0x1a8656(_0x78bc0c);})[_0x007d('0x15')](function(_0x2940b5){logger['error'](_0x007d('0x1f'),_0x2940b5[_0x007d('0x13')],_0x3b1b92);_0x4bd859(_0x270aee[_0x007d('0x11')](0x1f4,_0x2940b5[_0x007d('0x13')]));});});}; \ No newline at end of file +var _0x2590=['redis','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSmsAccount','options','raw','where','attributes','map','model','include','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x2590,0x1eb));var _0x0259=function(_0x44ba7e,_0x385d05){_0x44ba7e=_0x44ba7e-0x0;var _0x2fb813=_0x2590[_0x44ba7e];return _0x2fb813;};'use strict';var _=require(_0x0259('0x0'));var util=require(_0x0259('0x1'));var moment=require(_0x0259('0x2'));var BPromise=require(_0x0259('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0259('0x4'));var db=require(_0x0259('0x5'))['db'];var utils=require(_0x0259('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0259('0x7'));var jayson=require(_0x0259('0x8'));var client=jayson[_0x0259('0x9')][_0x0259('0xa')]({'port':0x232a});config['redis']=_[_0x0259('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0259('0xc'))(new Redis(config[_0x0259('0xd')]));require(_0x0259('0xe'))[_0x0259('0xf')](socket);function respondWithRpcPromise(_0x44938a,_0x22235e,_0x343924){return new BPromise(function(_0x2ddd54,_0x59882a){return client[_0x0259('0x10')](_0x44938a,_0x343924)['then'](function(_0x4fc5ba){logger[_0x0259('0x11')](_0x0259('0x12'),_0x22235e,'request\x20sent');logger[_0x0259('0x13')](_0x0259('0x14'),_0x22235e,'request\x20sent',JSON[_0x0259('0x15')](_0x4fc5ba));if(_0x4fc5ba[_0x0259('0x16')]){if(_0x4fc5ba[_0x0259('0x16')][_0x0259('0x17')]===0x1f4){logger[_0x0259('0x16')](_0x0259('0x12'),_0x22235e,_0x4fc5ba[_0x0259('0x16')][_0x0259('0x18')]);return _0x59882a(_0x4fc5ba[_0x0259('0x16')][_0x0259('0x18')]);}logger[_0x0259('0x16')](_0x0259('0x12'),_0x22235e,_0x4fc5ba[_0x0259('0x16')]['message']);return _0x2ddd54(_0x4fc5ba[_0x0259('0x16')][_0x0259('0x18')]);}else{logger[_0x0259('0x11')](_0x0259('0x12'),_0x22235e,_0x0259('0x19'));_0x2ddd54(_0x4fc5ba['result'][_0x0259('0x18')]);}})[_0x0259('0x1a')](function(_0x24aa28){logger[_0x0259('0x16')](_0x0259('0x12'),_0x22235e,_0x24aa28);_0x59882a(_0x24aa28);});});}exports[_0x0259('0x1b')]=function(_0x31d819){var _0x5f552b=this;return new Promise(function(_0x3a3e5f,_0x26305b){return db['SmsAccount']['find']({'raw':_0x31d819['options']?_0x31d819[_0x0259('0x1c')][_0x0259('0x1d')]===undefined?!![]:![]:!![],'where':_0x31d819[_0x0259('0x1c')]?_0x31d819[_0x0259('0x1c')][_0x0259('0x1e')]||null:null,'attributes':_0x31d819[_0x0259('0x1c')]?_0x31d819['options'][_0x0259('0x1f')]||null:null,'include':_0x31d819['options']?_0x31d819[_0x0259('0x1c')]['include']?_[_0x0259('0x20')](_0x31d819[_0x0259('0x1c')]['include'],function(_0x17849a){return{'model':db[_0x17849a[_0x0259('0x21')]],'as':_0x17849a['as'],'attributes':_0x17849a[_0x0259('0x1f')],'include':_0x17849a[_0x0259('0x22')]?_['map'](_0x17849a['include'],function(_0x12de23){return{'model':db[_0x12de23['model']],'as':_0x12de23['as'],'attributes':_0x12de23['attributes'],'include':_0x12de23[_0x0259('0x22')]?_[_0x0259('0x20')](_0x12de23[_0x0259('0x22')],function(_0x2ebb8a){return{'model':db[_0x2ebb8a[_0x0259('0x21')]],'as':_0x2ebb8a['as'],'attributes':_0x2ebb8a[_0x0259('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0259('0x23')](function(_0x221b57){logger[_0x0259('0x11')](_0x0259('0x1b'),_0x31d819);logger[_0x0259('0x13')](_0x0259('0x1b'),_0x31d819,JSON['stringify'](_0x221b57));_0x3a3e5f(_0x221b57);})[_0x0259('0x1a')](function(_0x215c40){logger[_0x0259('0x16')](_0x0259('0x1b'),_0x215c40[_0x0259('0x18')],_0x31d819);_0x26305b(_0x5f552b[_0x0259('0x16')](0x1f4,_0x215c40[_0x0259('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 470153a..9f695a9 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 505972c..db89a1c 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1debf5,_0x515f87){var _0x5a67d5=function(_0x34afc2){while(--_0x34afc2){_0x1debf5['push'](_0x1debf5['shift']());}};_0x5a67d5(++_0x515f87);}(_0xedd9,0xfc));var _0x9edd=function(_0x6b23ea,_0x22072f){_0x6b23ea=_0x6b23ea-0x0;var _0x499d84=_0xedd9[_0x6b23ea];return _0x499d84;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 60838b0..d242735 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 _0xf889=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x2601cc,_0x1f9649){var _0x279990=function(_0x218c68){while(--_0x218c68){_0x2601cc['push'](_0x2601cc['shift']());}};_0x279990(++_0x1f9649);}(_0xf889,0x115));var _0x9f88=function(_0x40cc74,_0x4ee029){_0x40cc74=_0x40cc74-0x0;var _0x40dde4=_0xf889[_0x40cc74];return _0x40dde4;};'use strict';var Sequelize=require(_0x9f88('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9f88('0x2')],'allowNull':![],'defaultValue':_0x9f88('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f88('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f88('0x4')}}; \ No newline at end of file +var _0xbed1=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x63d3f,_0x2d07df){var _0x1ebed8=function(_0x5db54a){while(--_0x5db54a){_0x63d3f['push'](_0x63d3f['shift']());}};_0x1ebed8(++_0x2d07df);}(_0xbed1,0x86));var _0x1bed=function(_0x34df4a,_0x209d10){_0x34df4a=_0x34df4a-0x0;var _0x145c69=_0xbed1[_0x34df4a];return _0x145c69;};'use strict';var Sequelize=require(_0x1bed('0x0'));module[_0x1bed('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1bed('0x2')],'allowNull':![],'defaultValue':_0x1bed('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1bed('0x2')]},'interval':{'type':Sequelize[_0x1bed('0x2')],'defaultValue':_0x1bed('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fb6d108..31728be 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 _0x35f6=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','keys','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x236db6,_0x2796fb){var _0x48487a=function(_0xda7ab6){while(--_0xda7ab6){_0x236db6['push'](_0x236db6['shift']());}};_0x48487a(++_0x2796fb);}(_0x35f6,0x1a0));var _0x635f=function(_0x17f704,_0x53d2aa){_0x17f704=_0x17f704-0x0;var _0x1295d1=_0x35f6[_0x17f704];return _0x1295d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x635f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x635f('0x1'));var rp=require(_0x635f('0x2'));var moment=require(_0x635f('0x3'));var BPromise=require(_0x635f('0x4'));var Mustache=require(_0x635f('0x5'));var util=require(_0x635f('0x6'));var path=require('path');var sox=require(_0x635f('0x7'));var csv=require(_0x635f('0x8'));var ejs=require(_0x635f('0x9'));var fs=require('fs');var fs_extra=require(_0x635f('0xa'));var _=require(_0x635f('0xb'));var squel=require(_0x635f('0xc'));var crypto=require('crypto');var jsforce=require(_0x635f('0xd'));var deskjs=require(_0x635f('0xe'));var toCsv=require(_0x635f('0x8'));var querystring=require('querystring');var Papa=require(_0x635f('0xf'));var Redis=require('ioredis');var authService=require(_0x635f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x635f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x635f('0x12'));var config=require(_0x635f('0x13'));var licenseUtil=require(_0x635f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3967f1,_0xffd262){_0xffd262=_0xffd262||0xcc;return function(_0x557129){if(_0x557129){return _0x3967f1[_0x635f('0x15')](_0xffd262);}return _0x3967f1[_0x635f('0x16')](_0xffd262)[_0x635f('0x17')]();};}function respondWithResult(_0x50f164,_0x5c0bd9){_0x5c0bd9=_0x5c0bd9||0xc8;return function(_0xad6a16){if(_0xad6a16){return _0x50f164[_0x635f('0x16')](_0x5c0bd9)[_0x635f('0x18')](_0xad6a16);}};}function respondWithFilteredResult(_0x2be979,_0x5c33c0){return function(_0x3ad05a){if(_0x3ad05a){var _0x10e13b=typeof _0x5c33c0[_0x635f('0x19')]===_0x635f('0x1a')&&typeof _0x5c33c0[_0x635f('0x1b')]==='undefined';var _0x2b2961=_0x3ad05a['count'];var _0x125fa3=_0x10e13b?0x0:_0x5c33c0['offset'];var _0x45389b=_0x10e13b?_0x3ad05a['count']:_0x5c33c0[_0x635f('0x19')]+_0x5c33c0[_0x635f('0x1b')];var _0x375c6a;if(_0x45389b>=_0x2b2961){_0x45389b=_0x2b2961;_0x375c6a=0xc8;}else{_0x375c6a=0xce;}_0x2be979[_0x635f('0x16')](_0x375c6a);return _0x2be979[_0x635f('0x1c')](_0x635f('0x1d'),_0x125fa3+'-'+_0x45389b+'/'+_0x2b2961)[_0x635f('0x18')](_0x3ad05a);}return null;};}function patchUpdates(_0x1c8b32){return function(_0xda809b){try{jsonpatch[_0x635f('0x1e')](_0xda809b,_0x1c8b32,!![]);}catch(_0x1e5418){return BPromise[_0x635f('0x1f')](_0x1e5418);}return _0xda809b[_0x635f('0x20')]();};}function saveUpdates(_0x1b174c,_0x56b81e){return function(_0x5bbe25){if(_0x5bbe25){return _0x5bbe25[_0x635f('0x21')](_0x1b174c)[_0x635f('0x22')](function(_0x9ec31){return _0x9ec31;});}return null;};}function removeEntity(_0x5e4f68,_0x39ab7f){return function(_0x2edd38){if(_0x2edd38){return _0x2edd38['destroy']()[_0x635f('0x22')](function(){_0x5e4f68['status'](0xcc)[_0x635f('0x17')]();});}};}function handleEntityNotFound(_0x2896fe,_0x1b31ac){return function(_0x639ac6){if(!_0x639ac6){_0x2896fe[_0x635f('0x15')](0x194);}return _0x639ac6;};}function handleError(_0x21a61c,_0x526077){_0x526077=_0x526077||0x1f4;return function(_0x1cc21b){logger[_0x635f('0x23')](_0x1cc21b[_0x635f('0x24')]);if(_0x1cc21b['name']){delete _0x1cc21b[_0x635f('0x25')];}_0x21a61c[_0x635f('0x16')](_0x526077)[_0x635f('0x26')](_0x1cc21b);};}exports[_0x635f('0x27')]=function(_0x40fde7,_0xf92676){var _0x2a9bc9={},_0x5df312={},_0x13ffea={'count':0x0,'rows':[]};var _0x409e1c=_[_0x635f('0x28')](db[_0x635f('0x29')][_0x635f('0x2a')],function(_0x632009){return{'name':_0x632009[_0x635f('0x2b')],'type':_0x632009[_0x635f('0x2c')][_0x635f('0x2d')]};});_0x5df312[_0x635f('0x2e')]=_[_0x635f('0x28')](_0x409e1c,_0x635f('0x25'));_0x5df312['query']=_['keys'](_0x40fde7[_0x635f('0x2f')]);_0x5df312['filters']=_[_0x635f('0x30')](_0x5df312[_0x635f('0x2e')],_0x5df312['query']);_0x2a9bc9[_0x635f('0x31')]=_['intersection'](_0x5df312['model'],qs['fields'](_0x40fde7[_0x635f('0x2f')][_0x635f('0x32')]));_0x2a9bc9['attributes']=_0x2a9bc9[_0x635f('0x31')][_0x635f('0x33')]?_0x2a9bc9[_0x635f('0x31')]:_0x5df312['model'];if(!_0x40fde7['query']['hasOwnProperty']('nolimit')){_0x2a9bc9['limit']=qs[_0x635f('0x1b')](_0x40fde7[_0x635f('0x2f')]['limit']);_0x2a9bc9[_0x635f('0x19')]=qs[_0x635f('0x19')](_0x40fde7[_0x635f('0x2f')][_0x635f('0x19')]);}_0x2a9bc9['order']=qs[_0x635f('0x34')](_0x40fde7[_0x635f('0x2f')]['sort']);_0x2a9bc9[_0x635f('0x35')]=qs[_0x635f('0x36')](_[_0x635f('0x37')](_0x40fde7['query'],_0x5df312[_0x635f('0x36')]),_0x409e1c);if(_0x40fde7[_0x635f('0x2f')][_0x635f('0x38')]){_0x2a9bc9[_0x635f('0x35')]=_['merge'](_0x2a9bc9[_0x635f('0x35')],{'$or':_[_0x635f('0x28')](_0x409e1c,function(_0x1c5709){if(_0x1c5709[_0x635f('0x2c')]!==_0x635f('0x39')){var _0x2ea9e5={};_0x2ea9e5[_0x1c5709[_0x635f('0x25')]]={'$like':'%'+_0x40fde7[_0x635f('0x2f')]['filter']+'%'};return _0x2ea9e5;}})});}_0x2a9bc9=_[_0x635f('0x3a')]({},_0x2a9bc9,_0x40fde7[_0x635f('0x3b')]);var _0xcc53d2={'where':_0x2a9bc9[_0x635f('0x35')]};return db[_0x635f('0x29')][_0x635f('0x3c')](_0xcc53d2)[_0x635f('0x22')](function(_0x3b4f13){_0x13ffea[_0x635f('0x3c')]=_0x3b4f13;if(_0x40fde7[_0x635f('0x2f')][_0x635f('0x3d')]){_0x2a9bc9['include']=[{'all':!![]}];}return db[_0x635f('0x29')]['findAll'](_0x2a9bc9);})[_0x635f('0x22')](function(_0x21fd98){_0x13ffea[_0x635f('0x3e')]=_0x21fd98;return _0x13ffea;})['then'](respondWithFilteredResult(_0xf92676,_0x2a9bc9))[_0x635f('0x3f')](handleError(_0xf92676,null));};exports[_0x635f('0x40')]=function(_0x5c6611,_0x37a724){var _0x463ede={'raw':!![],'where':{'id':_0x5c6611[_0x635f('0x41')]['id']}},_0x3d4a6e={};_0x3d4a6e[_0x635f('0x2e')]=_[_0x635f('0x42')](db[_0x635f('0x29')]['rawAttributes']);_0x3d4a6e[_0x635f('0x2f')]=_['keys'](_0x5c6611['query']);_0x3d4a6e[_0x635f('0x36')]=_[_0x635f('0x30')](_0x3d4a6e['model'],_0x3d4a6e[_0x635f('0x2f')]);_0x463ede[_0x635f('0x31')]=_[_0x635f('0x30')](_0x3d4a6e['model'],qs[_0x635f('0x32')](_0x5c6611[_0x635f('0x2f')][_0x635f('0x32')]));_0x463ede[_0x635f('0x31')]=_0x463ede[_0x635f('0x31')]['length']?_0x463ede[_0x635f('0x31')]:_0x3d4a6e['model'];if(_0x5c6611[_0x635f('0x2f')]['includeAll']){_0x463ede[_0x635f('0x43')]=[{'all':!![]}];}_0x463ede=_[_0x635f('0x3a')]({},_0x463ede,_0x5c6611[_0x635f('0x3b')]);return db[_0x635f('0x29')][_0x635f('0x44')](_0x463ede)['then'](handleEntityNotFound(_0x37a724,null))[_0x635f('0x22')](respondWithResult(_0x37a724,null))[_0x635f('0x3f')](handleError(_0x37a724,null));};exports[_0x635f('0x45')]=function(_0x185092,_0x4622e2){return db[_0x635f('0x29')][_0x635f('0x45')](_0x185092[_0x635f('0x46')],{})[_0x635f('0x22')](respondWithResult(_0x4622e2,0xc9))[_0x635f('0x3f')](handleError(_0x4622e2,null));};exports['update']=function(_0x10e423,_0x276c1f){if(_0x10e423['body']['id']){delete _0x10e423['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x10e423[_0x635f('0x41')]['id']}})['then'](handleEntityNotFound(_0x276c1f,null))[_0x635f('0x22')](saveUpdates(_0x10e423[_0x635f('0x46')],null))[_0x635f('0x22')](respondWithResult(_0x276c1f,null))['catch'](handleError(_0x276c1f,null));};exports['destroy']=function(_0x59497f,_0x29507b){return db[_0x635f('0x29')][_0x635f('0x44')]({'where':{'id':_0x59497f[_0x635f('0x41')]['id']}})[_0x635f('0x22')](handleEntityNotFound(_0x29507b,null))['then'](removeEntity(_0x29507b,null))[_0x635f('0x3f')](handleError(_0x29507b,null));}; \ No newline at end of file +var _0xc342=['find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','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/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0xc342,0xf2));var _0x2c34=function(_0x4105a8,_0x198324){_0x4105a8=_0x4105a8-0x0;var _0x553f0c=_0xc342[_0x4105a8];return _0x553f0c;};'use strict';var emlformat=require(_0x2c34('0x0'));var rimraf=require(_0x2c34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c34('0x2'));var rp=require(_0x2c34('0x3'));var moment=require(_0x2c34('0x4'));var BPromise=require(_0x2c34('0x5'));var Mustache=require(_0x2c34('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2c34('0x7'));var csv=require('to-csv');var ejs=require(_0x2c34('0x8'));var fs=require('fs');var fs_extra=require(_0x2c34('0x9'));var _=require('lodash');var squel=require(_0x2c34('0xa'));var crypto=require('crypto');var jsforce=require(_0x2c34('0xb'));var deskjs=require(_0x2c34('0xc'));var toCsv=require(_0x2c34('0xd'));var querystring=require(_0x2c34('0xe'));var Papa=require(_0x2c34('0xf'));var Redis=require(_0x2c34('0x10'));var authService=require(_0x2c34('0x11'));var qs=require(_0x2c34('0x12'));var as=require(_0x2c34('0x13'));var hardwareService=require(_0x2c34('0x14'));var logger=require(_0x2c34('0x15'))(_0x2c34('0x16'));var utils=require(_0x2c34('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2c34('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4401a8,_0x5e963e){_0x5e963e=_0x5e963e||0xcc;return function(_0x1a9460){if(_0x1a9460){return _0x4401a8[_0x2c34('0x19')](_0x5e963e);}return _0x4401a8['status'](_0x5e963e)[_0x2c34('0x1a')]();};}function respondWithResult(_0x765f07,_0x46a796){_0x46a796=_0x46a796||0xc8;return function(_0x563d0b){if(_0x563d0b){return _0x765f07[_0x2c34('0x1b')](_0x46a796)[_0x2c34('0x1c')](_0x563d0b);}};}function respondWithFilteredResult(_0x3e26ba,_0x563785){return function(_0x5e176d){if(_0x5e176d){var _0x2dab62=typeof _0x563785[_0x2c34('0x1d')]===_0x2c34('0x1e')&&typeof _0x563785[_0x2c34('0x1f')]===_0x2c34('0x1e');var _0x4632fb=_0x5e176d['count'];var _0x2220dc=_0x2dab62?0x0:_0x563785[_0x2c34('0x1d')];var _0x188391=_0x2dab62?_0x5e176d[_0x2c34('0x20')]:_0x563785[_0x2c34('0x1d')]+_0x563785[_0x2c34('0x1f')];var _0x59e580;if(_0x188391>=_0x4632fb){_0x188391=_0x4632fb;_0x59e580=0xc8;}else{_0x59e580=0xce;}_0x3e26ba[_0x2c34('0x1b')](_0x59e580);return _0x3e26ba[_0x2c34('0x21')](_0x2c34('0x22'),_0x2220dc+'-'+_0x188391+'/'+_0x4632fb)[_0x2c34('0x1c')](_0x5e176d);}return null;};}function patchUpdates(_0x2fbc08){return function(_0x1ddb62){try{jsonpatch[_0x2c34('0x23')](_0x1ddb62,_0x2fbc08,!![]);}catch(_0x28abf9){return BPromise[_0x2c34('0x24')](_0x28abf9);}return _0x1ddb62[_0x2c34('0x25')]();};}function saveUpdates(_0x2074f8,_0x4705ae){return function(_0x56e33a){if(_0x56e33a){return _0x56e33a[_0x2c34('0x26')](_0x2074f8)[_0x2c34('0x27')](function(_0x185c73){return _0x185c73;});}return null;};}function removeEntity(_0x61aac6,_0x3ba9be){return function(_0x33f879){if(_0x33f879){return _0x33f879['destroy']()[_0x2c34('0x27')](function(){_0x61aac6['status'](0xcc)[_0x2c34('0x1a')]();});}};}function handleEntityNotFound(_0x2378ce,_0x11c0a5){return function(_0x25bc21){if(!_0x25bc21){_0x2378ce[_0x2c34('0x19')](0x194);}return _0x25bc21;};}function handleError(_0x117e94,_0x2af440){_0x2af440=_0x2af440||0x1f4;return function(_0x5320ef){logger[_0x2c34('0x28')](_0x5320ef[_0x2c34('0x29')]);if(_0x5320ef[_0x2c34('0x2a')]){delete _0x5320ef[_0x2c34('0x2a')];}_0x117e94[_0x2c34('0x1b')](_0x2af440)[_0x2c34('0x2b')](_0x5320ef);};}exports[_0x2c34('0x2c')]=function(_0x2b04ed,_0x1cbb1b){var _0x91a27e={},_0x21a2e4={},_0xf05908={'count':0x0,'rows':[]};var _0x4ef377=_[_0x2c34('0x2d')](db['SmsApplication'][_0x2c34('0x2e')],function(_0x40b6a4){return{'name':_0x40b6a4[_0x2c34('0x2f')],'type':_0x40b6a4[_0x2c34('0x30')][_0x2c34('0x31')]};});_0x21a2e4[_0x2c34('0x32')]=_[_0x2c34('0x2d')](_0x4ef377,_0x2c34('0x2a'));_0x21a2e4[_0x2c34('0x33')]=_[_0x2c34('0x34')](_0x2b04ed['query']);_0x21a2e4[_0x2c34('0x35')]=_[_0x2c34('0x36')](_0x21a2e4[_0x2c34('0x32')],_0x21a2e4[_0x2c34('0x33')]);_0x91a27e[_0x2c34('0x37')]=_[_0x2c34('0x36')](_0x21a2e4['model'],qs['fields'](_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x38')]));_0x91a27e[_0x2c34('0x37')]=_0x91a27e[_0x2c34('0x37')][_0x2c34('0x39')]?_0x91a27e[_0x2c34('0x37')]:_0x21a2e4[_0x2c34('0x32')];if(!_0x2b04ed['query'][_0x2c34('0x3a')](_0x2c34('0x3b'))){_0x91a27e[_0x2c34('0x1f')]=qs[_0x2c34('0x1f')](_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x1f')]);_0x91a27e[_0x2c34('0x1d')]=qs[_0x2c34('0x1d')](_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x1d')]);}_0x91a27e[_0x2c34('0x3c')]=qs[_0x2c34('0x3d')](_0x2b04ed['query'][_0x2c34('0x3d')]);_0x91a27e[_0x2c34('0x3e')]=qs['filters'](_[_0x2c34('0x3f')](_0x2b04ed['query'],_0x21a2e4['filters']),_0x4ef377);if(_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x40')]){_0x91a27e['where']=_['merge'](_0x91a27e[_0x2c34('0x3e')],{'$or':_[_0x2c34('0x2d')](_0x4ef377,function(_0x5a10e7){if(_0x5a10e7[_0x2c34('0x30')]!==_0x2c34('0x41')){var _0x2f34b2={};_0x2f34b2[_0x5a10e7['name']]={'$like':'%'+_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x40')]+'%'};return _0x2f34b2;}})});}_0x91a27e=_[_0x2c34('0x42')]({},_0x91a27e,_0x2b04ed[_0x2c34('0x43')]);var _0x592ddd={'where':_0x91a27e[_0x2c34('0x3e')]};return db[_0x2c34('0x44')][_0x2c34('0x20')](_0x592ddd)[_0x2c34('0x27')](function(_0x226edf){_0xf05908[_0x2c34('0x20')]=_0x226edf;if(_0x2b04ed[_0x2c34('0x33')][_0x2c34('0x45')]){_0x91a27e[_0x2c34('0x46')]=[{'all':!![]}];}return db[_0x2c34('0x44')][_0x2c34('0x47')](_0x91a27e);})[_0x2c34('0x27')](function(_0x35bc45){_0xf05908[_0x2c34('0x48')]=_0x35bc45;return _0xf05908;})[_0x2c34('0x27')](respondWithFilteredResult(_0x1cbb1b,_0x91a27e))[_0x2c34('0x49')](handleError(_0x1cbb1b,null));};exports[_0x2c34('0x4a')]=function(_0x2843a8,_0x1a7c13){var _0x4f77cc={'raw':!![],'where':{'id':_0x2843a8[_0x2c34('0x4b')]['id']}},_0x396d14={};_0x396d14[_0x2c34('0x32')]=_[_0x2c34('0x34')](db[_0x2c34('0x44')][_0x2c34('0x2e')]);_0x396d14['query']=_[_0x2c34('0x34')](_0x2843a8[_0x2c34('0x33')]);_0x396d14['filters']=_[_0x2c34('0x36')](_0x396d14[_0x2c34('0x32')],_0x396d14[_0x2c34('0x33')]);_0x4f77cc[_0x2c34('0x37')]=_['intersection'](_0x396d14[_0x2c34('0x32')],qs[_0x2c34('0x38')](_0x2843a8['query'][_0x2c34('0x38')]));_0x4f77cc[_0x2c34('0x37')]=_0x4f77cc['attributes'][_0x2c34('0x39')]?_0x4f77cc[_0x2c34('0x37')]:_0x396d14[_0x2c34('0x32')];if(_0x2843a8[_0x2c34('0x33')][_0x2c34('0x45')]){_0x4f77cc[_0x2c34('0x46')]=[{'all':!![]}];}_0x4f77cc=_[_0x2c34('0x42')]({},_0x4f77cc,_0x2843a8[_0x2c34('0x43')]);return db[_0x2c34('0x44')]['find'](_0x4f77cc)[_0x2c34('0x27')](handleEntityNotFound(_0x1a7c13,null))['then'](respondWithResult(_0x1a7c13,null))[_0x2c34('0x49')](handleError(_0x1a7c13,null));};exports[_0x2c34('0x4c')]=function(_0x2d0d08,_0xd3bf2){return db['SmsApplication']['create'](_0x2d0d08['body'],{})[_0x2c34('0x27')](respondWithResult(_0xd3bf2,0xc9))['catch'](handleError(_0xd3bf2,null));};exports[_0x2c34('0x26')]=function(_0x3896db,_0x38a82b){if(_0x3896db['body']['id']){delete _0x3896db[_0x2c34('0x4d')]['id'];}return db[_0x2c34('0x44')][_0x2c34('0x4e')]({'where':{'id':_0x3896db[_0x2c34('0x4b')]['id']}})[_0x2c34('0x27')](handleEntityNotFound(_0x38a82b,null))[_0x2c34('0x27')](saveUpdates(_0x3896db[_0x2c34('0x4d')],null))['then'](respondWithResult(_0x38a82b,null))[_0x2c34('0x49')](handleError(_0x38a82b,null));};exports[_0x2c34('0x4f')]=function(_0x11a9c2,_0x36ea1f){return db['SmsApplication']['find']({'where':{'id':_0x11a9c2[_0x2c34('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36ea1f,null))[_0x2c34('0x27')](removeEntity(_0x36ea1f,null))[_0x2c34('0x49')](handleError(_0x36ea1f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1027831..afaa7db 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 _0x6a8e=['define','SmsApplication','sms_applications','utf8mb4','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x6a8e[_0x2ed7d1];return _0x38ae3c;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6a8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe3ae=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3ae,0xdc));var _0xee3a=function(_0xb22b4b,_0x564a03){_0xb22b4b=_0xb22b4b-0x0;var _0x145a36=_0xe3ae[_0xb22b4b];return _0x145a36;};'use strict';var _=require(_0xee3a('0x0'));var util=require(_0xee3a('0x1'));var logger=require('../../config/logger')(_0xee3a('0x2'));var moment=require('moment');var BPromise=require(_0xee3a('0x3'));var rp=require(_0xee3a('0x4'));var fs=require('fs');var path=require(_0xee3a('0x5'));var rimraf=require(_0xee3a('0x6'));var config=require(_0xee3a('0x7'));var attributes=require(_0xee3a('0x8'));module[_0xee3a('0x9')]=function(_0x3788f7,_0x19937c){return _0x3788f7['define'](_0xee3a('0xa'),attributes,{'tableName':_0xee3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee3a('0xc'),'collate':_0xee3a('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4b2399d..ab89691 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 _0x8b0e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8b0e,0x166));var _0xe8b0=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0x8b0e[_0x56418e];return _0x5b160c;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});} \ No newline at end of file +var _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info'];(function(_0x550eb7,_0x465856){var _0x33bffe=function(_0x171208){while(--_0x171208){_0x550eb7['push'](_0x550eb7['shift']());}};_0x33bffe(++_0x465856);}(_0xa413,0x1e5));var _0x3a41=function(_0x1b065a,_0x58c71b){_0x1b065a=_0x1b065a-0x0;var _0x156a8a=_0xa413[_0x1b065a];return _0x156a8a;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('SmsApplication,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('SmsApplication,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6eb78ec..2d6ea2b 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 _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file +var _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9e333dd..c9d83e1 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 _0x0c29=['ENUM','out','BOOLEAN','exports','DATE','STRING'];(function(_0x2d2f1a,_0x57b966){var _0x55d9db=function(_0x15771f){while(--_0x15771f){_0x2d2f1a['push'](_0x2d2f1a['shift']());}};_0x55d9db(++_0x57b966);}(_0x0c29,0xb7));var _0x90c2=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x0c29[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x90c2('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x90c2('0x1')]},'disposition':{'type':Sequelize[_0x90c2('0x2')]},'secondDisposition':{'type':Sequelize[_0x90c2('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x90c2('0x2')]},'read1stAt':{'type':Sequelize[_0x90c2('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x90c2('0x3')]('in',_0x90c2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x90c2('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x90c2('0x3')]('in',_0x90c2('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x90c2('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x5031=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x36d031,_0x146ec1){var _0x2f0b3c=function(_0x5a813c){while(--_0x5a813c){_0x36d031['push'](_0x36d031['shift']());}};_0x2f0b3c(++_0x146ec1);}(_0x5031,0x144));var _0x1503=function(_0x3f0aec,_0x4af277){_0x3f0aec=_0x3f0aec-0x0;var _0x4beb61=_0x5031[_0x3f0aec];return _0x4beb61;};'use strict';var Sequelize=require(_0x1503('0x0'));var moment=require(_0x1503('0x1'));module[_0x1503('0x2')]={'closed':{'type':Sequelize[_0x1503('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1503('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1503('0x5')]},'note':{'type':Sequelize[_0x1503('0x5')]},'phone':{'type':Sequelize[_0x1503('0x5')]},'read1stAt':{'type':Sequelize[_0x1503('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1503('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d87063d..41f88a5 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 _0xf4ae=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','rows','params','includeAll','options','create','describe','SmsMessage','addMessage','ids','omit','getMessages','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','createdAt','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','closedAt','disposition','out','firstName','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','forEach','Tags','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte'];(function(_0x120feb,_0x5f1724){var _0x3251ff=function(_0x3eb7a4){while(--_0x3eb7a4){_0x120feb['push'](_0x120feb['shift']());}};_0x3251ff(++_0x5f1724);}(_0xf4ae,0x69));var _0xef4a=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0xf4ae[_0x11ce46];return _0x272001;};'use strict';var emlformat=require(_0xef4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef4a('0x1'));var jsonpatch=require(_0xef4a('0x2'));var rp=require(_0xef4a('0x3'));var moment=require('moment');var BPromise=require(_0xef4a('0x4'));var Mustache=require('mustache');var util=require(_0xef4a('0x5'));var path=require(_0xef4a('0x6'));var sox=require(_0xef4a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef4a('0x8'));var squel=require(_0xef4a('0x9'));var crypto=require(_0xef4a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xef4a('0xb'));var toCsv=require(_0xef4a('0xc'));var querystring=require('querystring');var Papa=require(_0xef4a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef4a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xef4a('0xf'));var logger=require('../../config/logger')(_0xef4a('0x10'));var utils=require(_0xef4a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xef4a('0x12'));var db=require(_0xef4a('0x13'))['db'];config[_0xef4a('0x14')]=_[_0xef4a('0x15')](config['redis'],{'host':_0xef4a('0x16'),'port':0x18eb});var socket=require(_0xef4a('0x17'))(new Redis(config[_0xef4a('0x14')]));require(_0xef4a('0x18'))[_0xef4a('0x19')](socket);function respondWithStatusCode(_0x2cd438,_0x1f053c){_0x1f053c=_0x1f053c||0xcc;return function(_0x15504d){if(_0x15504d){return _0x2cd438[_0xef4a('0x1a')](_0x1f053c);}return _0x2cd438[_0xef4a('0x1b')](_0x1f053c)[_0xef4a('0x1c')]();};}function respondWithResult(_0x59c130,_0x32b559){_0x32b559=_0x32b559||0xc8;return function(_0x5a72a6){if(_0x5a72a6){return _0x59c130[_0xef4a('0x1b')](_0x32b559)[_0xef4a('0x1d')](_0x5a72a6);}};}function respondWithFilteredResult(_0x4e2791,_0x5d83ca){return function(_0x214274){if(_0x214274){var _0x2d4d19=typeof _0x5d83ca[_0xef4a('0x1e')]==='undefined'&&typeof _0x5d83ca[_0xef4a('0x1f')]===_0xef4a('0x20');var _0x5ec069=_0x214274[_0xef4a('0x21')];var _0x2174f1=_0x2d4d19?0x0:_0x5d83ca['offset'];var _0x31e09a=_0x2d4d19?_0x214274[_0xef4a('0x21')]:_0x5d83ca[_0xef4a('0x1e')]+_0x5d83ca[_0xef4a('0x1f')];var _0x25a61b;if(_0x31e09a>=_0x5ec069){_0x31e09a=_0x5ec069;_0x25a61b=0xc8;}else{_0x25a61b=0xce;}_0x4e2791[_0xef4a('0x1b')](_0x25a61b);return _0x4e2791[_0xef4a('0x22')]('Content-Range',_0x2174f1+'-'+_0x31e09a+'/'+_0x5ec069)[_0xef4a('0x1d')](_0x214274);}return null;};}function patchUpdates(_0x1b8849){return function(_0x5f1223){try{jsonpatch[_0xef4a('0x23')](_0x5f1223,_0x1b8849,!![]);}catch(_0x1e4cc4){return BPromise[_0xef4a('0x24')](_0x1e4cc4);}return _0x5f1223[_0xef4a('0x25')]();};}function saveUpdates(_0x591eac,_0x4cd3df){return function(_0x28c819){if(_0x28c819){return _0x28c819[_0xef4a('0x26')](_0x591eac)[_0xef4a('0x27')](function(_0xd02756){return _0xd02756;});}return null;};}function removeEntity(_0x537879,_0x4927bb){return function(_0x4fbafe){if(_0x4fbafe){return _0x4fbafe[_0xef4a('0x28')]()[_0xef4a('0x27')](function(){_0x537879[_0xef4a('0x1b')](0xcc)[_0xef4a('0x1c')]();});}};}function handleEntityNotFound(_0x426402,_0x30d9d3){return function(_0x650f){if(!_0x650f){_0x426402['sendStatus'](0x194);}return _0x650f;};}function handleError(_0x57e2ee,_0x116831){_0x116831=_0x116831||0x1f4;return function(_0xaacf82){logger[_0xef4a('0x29')](_0xaacf82['stack']);if(_0xaacf82[_0xef4a('0x2a')]){delete _0xaacf82['name'];}_0x57e2ee['status'](_0x116831)[_0xef4a('0x2b')](_0xaacf82);};}function getInteractionUsers(_0x20ef33,_0x442676){return new BPromise(function(_0x2d879d,_0x5473bd){try{if(_0x442676[_0x20ef33['id']]){_0x20ef33[_0xef4a('0x2c')]=_[_0xef4a('0x2d')](_0x442676[_0x20ef33['id']],function(_0xba38e5){return{'id':_0xba38e5['id'],'fullname':_0xba38e5[_0xef4a('0x2e')]};});}}catch(_0x3a8a47){_0x5473bd(_0x3a8a47);}_0x2d879d(_0x20ef33);});}function getInteractionTags(_0x3d767b,_0x905b12){return new BPromise(function(_0x33f2d9,_0x5a6178){try{if(_0x3d767b[_0xef4a('0x2f')]){_0x3d767b['Tags']=[];_0x3d767b[_0xef4a('0x2f')]['split'](',')[_0xef4a('0x30')](function(_0xa5b38b){_0x3d767b[_0xef4a('0x31')]['push'](_0x905b12[_0xa5b38b]);});}delete _0x3d767b[_0xef4a('0x2f')];}catch(_0x28b123){_0x5a6178(_0x28b123);}_0x33f2d9(_0x3d767b);});}function updateSmsInteraction(_0x57d7ab,_0x37b51c,_0x22c586){return new BPromise(function(_0x15f648,_0x314dbb){return getInteractionUsers(_0x57d7ab,_0x22c586)[_0xef4a('0x27')](function(_0x1e22de){return getInteractionTags(_0x1e22de,_0x37b51c);})['then'](function(_0x2d7f61){return getStateInteraction(_0x2d7f61);})['then'](function(_0x2d7ea8){_0x15f648(_0x2d7ea8);})[_0xef4a('0x32')](function(_0x7c9b42){_0x314dbb(_0x7c9b42);});});}function getStateInteraction(_0x7de908){return new BPromise(function(_0x5f10f7){_0x7de908[_0xef4a('0x33')]=0x0;_0x7de908[_0xef4a('0x34')]=0x0;_0x7de908[_0xef4a('0x35')]=0x0;_0x7de908[_0xef4a('0x36')]=0x0;_0x7de908[_0xef4a('0x37')]=0x0;if(!_0x7de908[_0xef4a('0x38')]&&!_0x7de908[_0xef4a('0x39')]){_0x7de908['waiting']+=0x1;}if(!_0x7de908['closed']&&_0x7de908[_0xef4a('0x39')]){_0x7de908['talking']+=0x1;if(_0x7de908[_0xef4a('0x33')]){_0x7de908['waiting']-=0x1;}}if(_0x7de908['closed']&&_0x7de908[_0xef4a('0x39')]){_0x7de908[_0xef4a('0x35')]+=0x1;if(_0x7de908['talking']){_0x7de908[_0xef4a('0x34')]-=0x1;}}if(_0x7de908['closed']&&!_0x7de908[_0xef4a('0x39')]){_0x7de908[_0xef4a('0x36')]+=0x1;if(_0x7de908['waiting']){_0x7de908['waiting']-=0x1;}}_0x7de908[_0xef4a('0x37')]+=0x1;_0x5f10f7(_0x7de908);});}exports[_0xef4a('0x3a')]=function(_0x15a8a5,_0x32f431){var _0x2d588d={},_0x4a9c58={},_0x47e7de={'count':0x0,'rows':[]};var _0x585e42=_[_0xef4a('0x2d')](db[_0xef4a('0x3b')][_0xef4a('0x3c')],function(_0x43a70e){return{'name':_0x43a70e[_0xef4a('0x3d')],'type':_0x43a70e[_0xef4a('0x3e')][_0xef4a('0x3f')]};});_0x4a9c58[_0xef4a('0x40')]=_[_0xef4a('0x2d')](_0x585e42,_0xef4a('0x2a'));_0x4a9c58[_0xef4a('0x41')]=_[_0xef4a('0x42')](_0x15a8a5[_0xef4a('0x41')]);_0x4a9c58[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x4a9c58[_0xef4a('0x40')],_0x4a9c58[_0xef4a('0x41')]);_0x2d588d[_0xef4a('0x45')]=_[_0xef4a('0x44')](_0x4a9c58[_0xef4a('0x40')],qs['fields'](_0x15a8a5['query'][_0xef4a('0x46')]));_0x2d588d[_0xef4a('0x45')]=_0x2d588d[_0xef4a('0x45')][_0xef4a('0x47')]?_0x2d588d['attributes']:_0x4a9c58[_0xef4a('0x40')];if(!_0x15a8a5[_0xef4a('0x41')]['hasOwnProperty'](_0xef4a('0x48'))){_0x2d588d[_0xef4a('0x1f')]=qs[_0xef4a('0x1f')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x1f')]);_0x2d588d[_0xef4a('0x1e')]=qs['offset'](_0x15a8a5[_0xef4a('0x41')]['offset']);}_0x2d588d['order']=qs[_0xef4a('0x49')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x49')]);_0x2d588d[_0xef4a('0x4a')]=qs[_0xef4a('0x43')](_['pick'](_0x15a8a5[_0xef4a('0x41')],_0x4a9c58[_0xef4a('0x43')]),_0x585e42);var _0x5b29bb=[];var _0x1a1ca3=squel[_0xef4a('0x4b')]()[_0xef4a('0x4c')]('id')[_0xef4a('0x4c')](_0xef4a('0x2a'))['field'](_0xef4a('0x4d'))[_0xef4a('0x4e')](_0xef4a('0x4f'));var _0xfc4279=squel[_0xef4a('0x4b')]()[_0xef4a('0x4c')](_0xef4a('0x50'))['field']('u.fullname')[_0xef4a('0x4c')](_0xef4a('0x51'))[_0xef4a('0x4e')](_0xef4a('0x52'),'ui')[_0xef4a('0x53')](_0xef4a('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x4ee6e7=squel[_0xef4a('0x4b')]()[_0xef4a('0x4e')](_0xef4a('0x55'),'i')[_0xef4a('0x53')](_0xef4a('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xef4a('0x54'),'o',_0xef4a('0x57'))[_0xef4a('0x53')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xef4a('0x53')](_0xef4a('0x58'),'me',_0xef4a('0x59'))[_0xef4a('0x53')](_0xef4a('0x5a'),'it',_0xef4a('0x5b'))[_0xef4a('0x53')](_0xef4a('0x4f'),'t',_0xef4a('0x5c'));var _0x5282ec=squel[_0xef4a('0x5d')]();var _0x30f946=[];var _0x15a8de=squel[_0xef4a('0x5d')]();var _0x5bf2c9;if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x5e')]){_0x5bf2c9=as[_0xef4a('0x5f')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x5e')]);var _0x14fb75=_0x5bf2c9['sqlOperator'];for(var _0x2b1143=0x0;_0x2b1143<_0x5bf2c9[_0xef4a('0x60')][_0xef4a('0x47')];_0x2b1143++){var _0x5c08c1=_0x5bf2c9[_0xef4a('0x60')][_0x2b1143];var _0xd0b175='i';var _0x5b22fc=_[_0xef4a('0x61')](_0x585e42,[_0xef4a('0x2a'),_0x5c08c1[_0xef4a('0x4c')]]);if(!_0x5b22fc){switch(_0x5c08c1[_0xef4a('0x4c')]){case _0xef4a('0x62'):if(_0x5c08c1[_0xef4a('0x63')]==0x1){_0x4ee6e7['having']('`'+_0x5c08c1[_0xef4a('0x4c')]+_0xef4a('0x64'));}else{_0x4ee6e7[_0xef4a('0x65')]('`'+_0x5c08c1['field']+'`\x20>\x200');}break;case _0xef4a('0x66'):if(_0x5c08c1[_0xef4a('0x67')]===_0xef4a('0x68')){if(_0x5c08c1[_0xef4a('0x63')]['split']('\x20')[_0xef4a('0x47')]>0x1){_0x5282ec[_0x14fb75](_0xef4a('0x69'),qs['getFullTextValue'](_0x5c08c1['value']),null);}else{var _0xacdbea='%'+_0x5c08c1[_0xef4a('0x63')]+'%';_0x5282ec[_0x14fb75](_0xef4a('0x6a'),_0xacdbea,_0xacdbea,_0xacdbea);}}else{_0x5b22fc=_[_0xef4a('0x61')](_0x585e42,['name',_0xef4a('0x6b')]);_0x5c08c1[_0xef4a('0x4c')]=_0xef4a('0x6b');_0xce7589=as[_0xef4a('0x6c')](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589['text'],_0xce7589[_0xef4a('0x63')][_0xef4a('0x6d')],_0xce7589[_0xef4a('0x63')]['end']);}break;case _0xef4a('0x6e'):var _0x24a4bb=_0x5c08c1[_0xef4a('0x63')][_0xef4a('0x6f')](',')[_0xef4a('0x2d')](function(_0x2b8122){return Number(_0x2b8122);});_0x24a4bb[_0xef4a('0x30')](function(_0x391cc4){_0x15a8de['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x391cc4+',%');});_0x30f946=_[_0xef4a('0x70')](_0x30f946,_0x24a4bb);break;case _0xef4a('0x71'):if(_0x5c08c1[_0xef4a('0x67')]===_0xef4a('0x68')){_0x5282ec[_0x14fb75](_0xef4a('0x72'),'%'+_0x5c08c1['value']+'%',null);}else{_0x5b22fc=_[_0xef4a('0x61')](_0x585e42,[_0xef4a('0x2a'),_0xef4a('0x39')]);_0x5c08c1[_0xef4a('0x4c')]=_0xef4a('0x39');_0xce7589=as[_0xef4a('0x6c')](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589['value'][_0xef4a('0x6d')],_0xce7589[_0xef4a('0x63')][_0xef4a('0x1c')]);}break;case _0xef4a('0x74'):_0xce7589=as[_0xef4a('0x6c')]('me',null,_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589[_0xef4a('0x63')]['start'],_0xce7589['value'][_0xef4a('0x1c')]);break;}}else{var _0xce7589=as['buildExpression'](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589['value'][_0xef4a('0x6d')],_0xce7589['value'][_0xef4a('0x1c')]);}}}else{var _0x3f3caf=_(_0x15a8a5['query'])[_0xef4a('0x42')]()['map'](function(_0x2b538f){return _[_0xef4a('0x75')](_0x585e42,[_0xef4a('0x2a'),_0x2b538f])?_0x2b538f:undefined;})['compact']()[_0xef4a('0x63')]();if(!_['isEmpty'](_0x3f3caf)){_0x3f3caf[_0xef4a('0x30')](function(_0x4ee119){if(_0x4ee119===_0xef4a('0x76')){_0x4ee6e7['where'](_0xef4a('0x77'),[][_0xef4a('0x78')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119]));}else if(_0x4ee119==='createdAt'){var _0x5d2ff=JSON[_0xef4a('0x79')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119])[_0xef4a('0x7a')];var _0x4c3439=JSON[_0xef4a('0x79')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119])[_0xef4a('0x7b')];_0x4ee6e7['where'](_0xef4a('0x7c'),_0x5d2ff,_0x4c3439);}else{if(_0x15a8a5[_0xef4a('0x41')][_0x4ee119]==='null'){_0x4ee6e7[_0xef4a('0x4a')]('i.'+_0x4ee119+_0xef4a('0x7d'));}else{_0x4ee6e7['where']('i.'+_0x4ee119+_0xef4a('0x7e'),_0x15a8a5[_0xef4a('0x41')][_0x4ee119]);}}});}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x7f')]){if(_0x15a8a5[_0xef4a('0x41')]['read']==0x1){_0x4ee6e7[_0xef4a('0x65')](_0xef4a('0x80'));}else{_0x4ee6e7[_0xef4a('0x65')](_0xef4a('0x81'));}}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x82')]){_0x30f946=_[_0xef4a('0x83')](_0x15a8a5[_0xef4a('0x41')]['tag'])?_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x82')]:new Array(_0x15a8a5[_0xef4a('0x41')]['tag']);_0x30f946[_0xef4a('0x30')](function(_0x2dc09f){_0x15a8de['or'](_0xef4a('0x84'),'%,'+_0x2dc09f+',%');});}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x85')]){var _0x333a73=_0x15a8a5[_0xef4a('0x41')]['filter'][_0xef4a('0x86')]('\x5c','\x5c\x5c')[_0xef4a('0x86')](/'/g,'\x27\x27');if(qs[_0xef4a('0x87')](_0x333a73)){_0x5282ec['or']('i.id\x20LIKE\x20?',_0x333a73+'%')['or']('i.phone\x20LIKE\x20?',_0x333a73+'%');}else{_0x5282ec['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xef4a('0x88')](_0x333a73))['or'](_0xef4a('0x89'),_0x333a73+'%');}}}_0x4ee6e7['where'](_0x5282ec);_0x4ee6e7['group']('i.id');var _0x3b065c={'type':db[_0xef4a('0x8a')]['QueryTypes'][_0xef4a('0x8b')],'raw':!![]};var _0x4fee07=_0x4ee6e7['clone']();_0x4fee07[_0xef4a('0x4c')]('i.id');_0x4fee07[_0xef4a('0x4c')](_0xef4a('0x8c'),'unreadMessages');if(_0x2d588d[_0xef4a('0x8d')]){_0x2d588d['order'][_0xef4a('0x30')](function(_0x23cf41){var _0x3bf972=_0x23cf41[0x0]==='contactName'?_0x23cf41[0x0]:'i.'+_0x23cf41[0x0];_0x4ee6e7[_0xef4a('0x8d')](_0x3bf972,_0x23cf41[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x30f946)){_0x4ee6e7[_0xef4a('0x65')](_0x15a8de);_0x4fee07['where'](_0xef4a('0x8e'),_0x30f946);}BPromise[_0xef4a('0x8f')]()['then'](function(){if(!_0x5bf2c9){if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x76')])return;_0x4fee07['where'](_0xef4a('0x90'));_0x4ee6e7[_0xef4a('0x4a')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x15a8a5['user'][_0xef4a('0x91')]!=='agent')return;return _0x15a8a5[_0xef4a('0x92')][_0xef4a('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1669fc){if(_[_0xef4a('0x94')](_0x1669fc)){_0x4fee07[_0xef4a('0x4a')]('i.SmsAccountId\x20IS\x20NULL');_0x4ee6e7[_0xef4a('0x4a')](_0xef4a('0x95'));}else{_0x4fee07[_0xef4a('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0xef4a('0x2d')](_0x1669fc,'id'));_0x4ee6e7[_0xef4a('0x4a')](_0xef4a('0x77'),_[_0xef4a('0x2d')](_0x1669fc,'id'));}});})[_0xef4a('0x27')](function(){if(_0x15a8a5[_0xef4a('0x92')][_0xef4a('0x91')]===_0xef4a('0x96')&&!_0x5bf2c9&&!_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x76')])return[];return db['sequelize']['query'](_0x4fee07[_0xef4a('0x97')](),_0x3b065c);})['then'](function(_0xbfd21f){_0x47e7de[_0xef4a('0x21')]=_0xbfd21f[_0xef4a('0x47')];if(_0x47e7de[_0xef4a('0x21')]===0x0)return[];return db[_0xef4a('0x98')][_0xef4a('0x41')](_0x1a1ca3[_0xef4a('0x97')](),_0x3b065c)[_0xef4a('0x27')](function(_0x356115){_0x5b29bb=_[_0xef4a('0x99')](_0x356115,'id');_0x3b065c=_[_0xef4a('0x9a')](_0x3b065c,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x46')]){_0x2d588d[_0xef4a('0x45')][_0xef4a('0x30')](function(_0xfef20c){_0x4ee6e7[_0xef4a('0x4c')]('i.'+_0xfef20c);});}else{_0x4ee6e7['field'](_0xef4a('0x8c'),_0xef4a('0x62'));_0x4ee6e7[_0xef4a('0x4c')]('a.key',_0xef4a('0x9b'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0x9c'),_0xef4a('0x9d'));_0x4ee6e7[_0xef4a('0x4c')]('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',_0xef4a('0x9e'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0x9f'));_0x4ee6e7[_0xef4a('0x4c')]('c.firstName','Contact.firstName');_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa0'),_0xef4a('0xa1'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa2'),_0xef4a('0xa3'));_0x4ee6e7['field'](_0xef4a('0xa4'),_0xef4a('0xa5'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa6'),_0xef4a('0xa7'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa8'),'Contact.fax');_0x4ee6e7[_0xef4a('0x4c')]('o.fullname',_0xef4a('0xa9'));_0x4ee6e7['field'](_0xef4a('0xaa'),_0xef4a('0xab'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xac'),_0xef4a('0x2f'));}if(_0x2d588d['limit'])_0x4ee6e7[_0xef4a('0x1f')](_0x2d588d['limit']);if(_0x2d588d['offset'])_0x4ee6e7['offset'](_0x2d588d[_0xef4a('0x1e')]);return db['sequelize'][_0xef4a('0x41')](_0x4ee6e7[_0xef4a('0x97')](),_0x3b065c);})['then'](function(_0xe677c7){if(_0xe677c7[_0xef4a('0x47')]>0x0)_0xfc4279[_0xef4a('0x4a')]('ui.SmsInteractionId\x20IN\x20?',_[_0xef4a('0x2d')](_0xe677c7,'id'));return db['sequelize']['query'](_0xfc4279[_0xef4a('0x97')](),_0x3b065c)[_0xef4a('0x27')](function(_0x37294a){var _0x31d1d8=_[_0xef4a('0xad')](_0x37294a,_0xef4a('0xae'));var _0xb77615=[];_0xe677c7[_0xef4a('0x30')](function(_0x4b8f84){_0xb77615[_0xef4a('0xaf')](updateSmsInteraction(_0x4b8f84,_0x5b29bb,_0x31d1d8));});return BPromise[_0xef4a('0xb0')](_0xb77615);});});})[_0xef4a('0x27')](function(_0x28d6ed){_0x47e7de[_0xef4a('0xb1')]=_0x28d6ed;return _0x47e7de;})[_0xef4a('0x27')](respondWithFilteredResult(_0x32f431,_0x2d588d))[_0xef4a('0x32')](handleError(_0x32f431,null));};exports['show']=function(_0x265f13,_0x2a1034){var _0x17178c={'raw':![],'where':{'id':_0x265f13[_0xef4a('0xb2')]['id']}},_0x1d450c={};_0x1d450c[_0xef4a('0x40')]=_[_0xef4a('0x42')](db[_0xef4a('0x3b')][_0xef4a('0x3c')]);_0x1d450c['query']=_[_0xef4a('0x42')](_0x265f13[_0xef4a('0x41')]);_0x1d450c[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x1d450c[_0xef4a('0x40')],_0x1d450c[_0xef4a('0x41')]);_0x17178c[_0xef4a('0x45')]=_[_0xef4a('0x44')](_0x1d450c[_0xef4a('0x40')],qs['fields'](_0x265f13[_0xef4a('0x41')]['fields']));_0x17178c[_0xef4a('0x45')]=_0x17178c[_0xef4a('0x45')]['length']?_0x17178c['attributes']:_0x1d450c['model'];if(_0x265f13['query'][_0xef4a('0xb3')]){_0x17178c['include']=[{'all':!![]}];}_0x17178c=_[_0xef4a('0x9a')]({},_0x17178c,_0x265f13[_0xef4a('0xb4')]);return db['SmsInteraction'][_0xef4a('0x61')](_0x17178c)[_0xef4a('0x27')](handleEntityNotFound(_0x2a1034,null))['then'](respondWithResult(_0x2a1034,null))[_0xef4a('0x32')](handleError(_0x2a1034,null));};exports[_0xef4a('0xb5')]=function(_0x2f354c,_0x43e872){return db[_0xef4a('0x3b')]['create'](_0x2f354c[_0xef4a('0x74')],{})[_0xef4a('0x27')](respondWithResult(_0x43e872,0xc9))['catch'](handleError(_0x43e872,null));};exports[_0xef4a('0x26')]=function(_0x51c6ad,_0x5c38d2){if(_0x51c6ad['body']['id']){delete _0x51c6ad[_0xef4a('0x74')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x51c6ad[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x5c38d2,null))[_0xef4a('0x27')](saveUpdates(_0x51c6ad['body'],null))[_0xef4a('0x27')](respondWithResult(_0x5c38d2,null))['catch'](handleError(_0x5c38d2,null));};exports[_0xef4a('0x28')]=function(_0x1b4204,_0x5d4e7d){return db['SmsInteraction'][_0xef4a('0x61')]({'where':{'id':_0x1b4204[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x5d4e7d,null))[_0xef4a('0x27')](removeEntity(_0x5d4e7d,null))[_0xef4a('0x32')](handleError(_0x5d4e7d,null));};exports[_0xef4a('0xb6')]=function(_0x3bbfe7,_0x3cd6bc){return db[_0xef4a('0x3b')][_0xef4a('0xb6')]()[_0xef4a('0x27')](respondWithResult(_0x3cd6bc,null))['catch'](handleError(_0x3cd6bc,null));};exports['addMessage']=function(_0x136858,_0x493c5f,_0x1a95e3){return db[_0xef4a('0xb7')][_0xef4a('0x61')]({'where':{'id':_0x136858[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x493c5f,null))[_0xef4a('0x27')](function(_0x2abde3){if(_0x2abde3){return _0x2abde3[_0xef4a('0xb8')](_0x136858['body'][_0xef4a('0xb9')],_[_0xef4a('0xba')](_0x136858[_0xef4a('0x74')],[_0xef4a('0xb9'),'id'])||{});}})[_0xef4a('0x27')](respondWithResult(_0x493c5f,null))[_0xef4a('0x32')](handleError(_0x493c5f,null));};exports[_0xef4a('0xbb')]=function(_0x2ceda7,_0x344739,_0x1acd1f){var _0x214e81={'raw':![],'where':{}};var _0x556e14={};var _0x3ee928={'count':0x0,'rows':[]};return db[_0xef4a('0x3b')]['findOne']({'where':{'id':_0x2ceda7['params']['id']}})['then'](handleEntityNotFound(_0x344739,null))[_0xef4a('0x27')](function(_0x3d06ba){if(_0x3d06ba){_0x556e14[_0xef4a('0x40')]=_['keys'](db[_0xef4a('0xb7')][_0xef4a('0x3c')]);_0x556e14[_0xef4a('0x41')]=_[_0xef4a('0x42')](_0x2ceda7['query']);_0x556e14[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x556e14[_0xef4a('0x40')],_0x556e14[_0xef4a('0x41')]);_0x214e81['attributes']=_[_0xef4a('0x44')](_0x556e14[_0xef4a('0x40')],qs['fields'](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x46')]));_0x214e81['attributes']=_0x214e81[_0xef4a('0x45')]['length']?_0x214e81['attributes']:_0x556e14[_0xef4a('0x40')];if(!_0x2ceda7[_0xef4a('0x41')][_0xef4a('0xbc')](_0xef4a('0x48'))){_0x214e81['limit']=qs[_0xef4a('0x1f')](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x1f')]);_0x214e81['offset']=qs['offset'](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x1e')]);}_0x214e81[_0xef4a('0x8d')]=qs[_0xef4a('0x49')](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x49')]);_0x214e81[_0xef4a('0x4a')]=qs['filters'](_[_0xef4a('0xbd')](_0x2ceda7[_0xef4a('0x41')],_0x556e14[_0xef4a('0x43')]));_0x214e81[_0xef4a('0x4a')][_0xef4a('0xae')]=_0x3d06ba['id'];if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x85')]){_0x214e81['where']=_[_0xef4a('0x9a')](_0x214e81[_0xef4a('0x4a')],{'$or':_[_0xef4a('0x2d')](_0x214e81[_0xef4a('0x45')],function(_0x1abe70){var _0x48b0e9={};_0x48b0e9[_0x1abe70]={'$like':'%'+_0x2ceda7[_0xef4a('0x41')]['filter']+'%'};return _0x48b0e9;})});}if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x7a')]){var _0x3f1f6a=_0x2ceda7['query']['$gte'][_0xef4a('0x6f')](',');var _0x58e8f1={};_0x58e8f1[_0x3f1f6a[0x0]]={'$gte':moment(_0x3f1f6a[0x1])[_0xef4a('0xbe')](_0xef4a('0xbf'))};_0x214e81[_0xef4a('0x4a')]=_[_0xef4a('0x9a')](_0x214e81[_0xef4a('0x4a')],_0x58e8f1);}_0x214e81=_['merge']({},_0x214e81,_0x2ceda7[_0xef4a('0xb4')]);return db[_0xef4a('0xb7')][_0xef4a('0x21')]({'where':_0x214e81[_0xef4a('0x4a')]})[_0xef4a('0x27')](function(_0x51fdcb){_0x3ee928['count']=_0x51fdcb;if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0xb3')]){_0x214e81[_0xef4a('0xc0')]=[{'all':!![]}];}return db[_0xef4a('0xb7')][_0xef4a('0xc1')](_0x214e81);})[_0xef4a('0x27')](function(_0x3c9263){_0x3ee928[_0xef4a('0xb1')]=_0x3c9263;return _0x3ee928;});}})[_0xef4a('0x27')](respondWithFilteredResult(_0x344739,_0x214e81))[_0xef4a('0x32')](handleError(_0x344739,null));};exports[_0xef4a('0xc2')]=function(_0x1540bd,_0x276260,_0x4d31de){return db['SmsInteraction']['find']({'where':{'id':_0x1540bd[_0xef4a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x276260,null))[_0xef4a('0x27')](function(_0x341cd2){if(_0x341cd2){return _0x341cd2[_0xef4a('0xc3')](_0x1540bd[_0xef4a('0x74')][_0xef4a('0xb9')],_['omit'](_0x1540bd[_0xef4a('0x74')],[_0xef4a('0xb9'),'id'])||{})[_0xef4a('0xc4')](function(){return db['Tag'][_0xef4a('0xc1')]({'attributes':['id','name',_0xef4a('0x4d')],'where':{'id':_0x1540bd[_0xef4a('0x74')][_0xef4a('0xb9')]}});})['then'](function(_0x548c6f){socket['emit'](_0xef4a('0xc5'),{'id':Number(_0x1540bd[_0xef4a('0xb2')]['id']),'tags':_0x548c6f||[]});return{'id':Number(_0x1540bd[_0xef4a('0xb2')]['id']),'tags':_0x548c6f||[]};});}})['then'](respondWithResult(_0x276260,null))[_0xef4a('0x32')](handleError(_0x276260,null));};exports[_0xef4a('0xc6')]=function(_0x218dfe,_0x211154,_0x2df6c9){return db[_0xef4a('0x3b')][_0xef4a('0x61')]({'where':{'id':_0x218dfe[_0xef4a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x211154,null))[_0xef4a('0x27')](function(_0x1c0b11){if(_0x1c0b11){return _0x1c0b11['removeTags'](_0x218dfe['query'][_0xef4a('0xb9')]);}})['then'](respondWithStatusCode(_0x211154,null))[_0xef4a('0x32')](handleError(_0x211154,null));};exports[_0xef4a('0xc7')]=function(_0x360001,_0x17e9d8){var _0x2660f0=moment()[_0xef4a('0xc8')]()[_0xef4a('0x97')]();var _0x565018=path[_0xef4a('0xc9')](config[_0xef4a('0xca')],_0xef4a('0xcb'),_0xef4a('0xcc'),_0xef4a('0xcd'));var _0x16478e=path[_0xef4a('0xc9')](config['root'],'server',_0xef4a('0xcc'),_0xef4a('0xce'));var _0x49bab9=path[_0xef4a('0xc9')](_0x565018,_0x2660f0);var _0x4458b5=util['format'](_0xef4a('0xcf'),_0x360001[_0xef4a('0xb2')]['id'],_0x2660f0);var _0x3369a3=path[_0xef4a('0xc9')](_0x565018,_0x4458b5);var _0x267a11=[];_0x267a11[_0xef4a('0xaf')]({'model':db[_0xef4a('0x71')],'as':_0xef4a('0x71'),'attributes':['id',_0xef4a('0x2e')],'raw':!![]});_0x267a11['push']({'model':db[_0xef4a('0xd0')],'as':_0xef4a('0x66'),'attributes':['id','firstName',_0xef4a('0xd1')],'raw':!![]});var _0x4b69d2=[{'model':db[_0xef4a('0xb7')],'as':'Messages','attributes':['id',_0xef4a('0x74'),_0xef4a('0xd2'),_0xef4a('0xd3'),_0xef4a('0xd4'),'read'],'include':_0x267a11}];_0x4b69d2[_0xef4a('0xaf')]({'model':db[_0xef4a('0xd5')],'as':_0xef4a('0xd6'),'attributes':['id',_0xef4a('0x2a')]});_0x4b69d2[_0xef4a('0xaf')]({'model':db[_0xef4a('0x71')],'as':_0xef4a('0xd7'),'attributes':['id',_0xef4a('0x2e')]});return db[_0xef4a('0x3b')][_0xef4a('0x61')]({'where':{'id':_0x360001[_0xef4a('0xb2')]['id']},'include':_0x4b69d2})[_0xef4a('0x27')](handleEntityNotFound(_0x17e9d8,null))['then'](function(_0x5352d7){if(_0x5352d7){var _0x1799b0=_0x5352d7['get']({'plain':!![]});fs[_0xef4a('0xd8')](_0x49bab9);var _0x140e72={'channel':_0xef4a('0xd9'),'account':_0x1799b0['Account']['name'],'agent':_0x1799b0[_0xef4a('0xd7')]?_0x1799b0[_0xef4a('0xd7')][_0xef4a('0x2e')]:'N.A.','createdAt':moment(_0x1799b0[_0xef4a('0xd2')])['format'](_0xef4a('0xbf'))[_0xef4a('0x97')](),'closedAt':_0x1799b0[_0xef4a('0x38')]?moment(_0x1799b0[_0xef4a('0xda')])[_0xef4a('0xbe')](_0xef4a('0xbf'))[_0xef4a('0x97')]():'','disposition':_0x1799b0[_0xef4a('0xdb')],'messages':_(_0x1799b0['Messages'])[_0xef4a('0x85')]({'secret':![]})[_0xef4a('0x2d')](function(_0x523e0d){return{'date':moment(_0x523e0d[_0xef4a('0xd2')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x523e0d[_0xef4a('0xd3')]===_0xef4a('0xdc')?_0x523e0d['User']?_0x523e0d[_0xef4a('0x71')][_0xef4a('0x2e')]:'System':_0x523e0d[_0xef4a('0x66')][_0xef4a('0xdd')]+(_0x523e0d['Contact'][_0xef4a('0xd1')]?'\x20'+_0x523e0d['Contact'][_0xef4a('0xd1')]:''),'body':_0x523e0d[_0xef4a('0x74')],'direction':_0x523e0d['direction']===_0xef4a('0xdc')?'A':'C','secret':_0x523e0d['secret'],'read':_0x523e0d[_0xef4a('0x7f')]};})[_0xef4a('0x63')]()};return ejs['renderFile'](path[_0xef4a('0xc9')](config[_0xef4a('0xca')],_0xef4a('0xcb'),_0xef4a('0xde'),'downloadInteraction.ejs'),{'interaction':_0x140e72})[_0xef4a('0x27')](function(_0x2bcafb){var _0x41ca08=path[_0xef4a('0xc9')](_0x49bab9,_0xef4a('0xdf')+_0x1799b0['id']+'-'+_0x2660f0+_0xef4a('0xe0'));var _0x1f1ebd={'path':_0x41ca08,'channel':_0xef4a('0xd9'),'interactionId':_0x1799b0['id']};return pdf[_0xef4a('0xe1')](_0x2bcafb,_0x1f1ebd);})['then'](function(){return new BPromise(function(_0xba2fb4,_0x3b5d5d){zipdir(_0x49bab9,{'saveTo':_0x3369a3},function(_0x20f26f,_0x3b7a25){if(_0x20f26f)return _0x3b5d5d(_0x20f26f);return _0xba2fb4(_0x3b7a25);});})[_0xef4a('0x27')](function(){return new BPromise(function(_0x499075,_0x144df8){rimraf(_0x49bab9,function(_0x493b03){if(_0x493b03)_0x144df8(_0x493b03);return _0x499075();});});})['then'](function(){return _0x17e9d8[_0xef4a('0xc7')](_0x3369a3,_0x4458b5,function(_0x506edd){if(_0x506edd){console['log'](_0xef4a('0xe2'),_0x506edd);}else{fs[_0xef4a('0xe3')](_0x3369a3);}});});});}else{return _0x17e9d8[_0xef4a('0x1a')](0xc8);}})[_0xef4a('0x32')](handleError(_0x17e9d8,null));}; \ No newline at end of file +var _0x4fed=['query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','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','isEmpty','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','count','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show','include','merge','options','create','params','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','filter','includeAll','rows','addTags','spread','Tag','findAll','emit','smsInteractionTags:save','removeTags','download','root','server','files','tmp','attachments','join','format','CmContact','firstName','direction','read','SmsAccount','Account','get','Sms','Owner','fullname','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','secret','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','Tags','TagIds','split','forEach','catch','waiting','talking','total','closed','UserId','answered','unmanaged','index','SmsInteraction','rawAttributes','type','key','map'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fed,0xab));var _0xd4fe=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x4fed[_0x334651];return _0x29657c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4fe('0x1'));var moment=require(_0xd4fe('0x2'));var BPromise=require(_0xd4fe('0x3'));var Mustache=require('mustache');var util=require(_0xd4fe('0x4'));var path=require(_0xd4fe('0x5'));var sox=require('sox');var csv=require(_0xd4fe('0x6'));var ejs=require(_0xd4fe('0x7'));var fs=require('fs');var fs_extra=require(_0xd4fe('0x8'));var _=require('lodash');var squel=require(_0xd4fe('0x9'));var crypto=require(_0xd4fe('0xa'));var jsforce=require(_0xd4fe('0xb'));var deskjs=require(_0xd4fe('0xc'));var toCsv=require(_0xd4fe('0x6'));var querystring=require(_0xd4fe('0xd'));var Papa=require(_0xd4fe('0xe'));var Redis=require('ioredis');var authService=require(_0xd4fe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd4fe('0x10'));var pdf=require(_0xd4fe('0x11'));var hardwareService=require(_0xd4fe('0x12'));var logger=require(_0xd4fe('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4fe('0x14'));var db=require(_0xd4fe('0x15'))['db'];config[_0xd4fe('0x16')]=_['defaults'](config[_0xd4fe('0x16')],{'host':_0xd4fe('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4fe('0x16')]));require(_0xd4fe('0x18'))[_0xd4fe('0x19')](socket);function respondWithStatusCode(_0x192d44,_0x268426){_0x268426=_0x268426||0xcc;return function(_0x485709){if(_0x485709){return _0x192d44[_0xd4fe('0x1a')](_0x268426);}return _0x192d44[_0xd4fe('0x1b')](_0x268426)[_0xd4fe('0x1c')]();};}function respondWithResult(_0x96ede2,_0x5e9222){_0x5e9222=_0x5e9222||0xc8;return function(_0xd3584f){if(_0xd3584f){return _0x96ede2[_0xd4fe('0x1b')](_0x5e9222)[_0xd4fe('0x1d')](_0xd3584f);}};}function respondWithFilteredResult(_0x7f0cf6,_0x526e29){return function(_0x20e749){if(_0x20e749){var _0x3c6a9b=typeof _0x526e29[_0xd4fe('0x1e')]==='undefined'&&typeof _0x526e29['limit']===_0xd4fe('0x1f');var _0x2f2625=_0x20e749['count'];var _0x19fbf8=_0x3c6a9b?0x0:_0x526e29[_0xd4fe('0x1e')];var _0x4d1892=_0x3c6a9b?_0x20e749['count']:_0x526e29[_0xd4fe('0x1e')]+_0x526e29[_0xd4fe('0x20')];var _0x88d655;if(_0x4d1892>=_0x2f2625){_0x4d1892=_0x2f2625;_0x88d655=0xc8;}else{_0x88d655=0xce;}_0x7f0cf6['status'](_0x88d655);return _0x7f0cf6[_0xd4fe('0x21')](_0xd4fe('0x22'),_0x19fbf8+'-'+_0x4d1892+'/'+_0x2f2625)[_0xd4fe('0x1d')](_0x20e749);}return null;};}function patchUpdates(_0x46ba47){return function(_0x174732){try{jsonpatch['apply'](_0x174732,_0x46ba47,!![]);}catch(_0x34bda3){return BPromise['reject'](_0x34bda3);}return _0x174732['save']();};}function saveUpdates(_0x10b3a4,_0x3cd5ed){return function(_0xf1cdf0){if(_0xf1cdf0){return _0xf1cdf0[_0xd4fe('0x23')](_0x10b3a4)[_0xd4fe('0x24')](function(_0x21c0d3){return _0x21c0d3;});}return null;};}function removeEntity(_0x3ba0c6,_0xe76854){return function(_0x4840e7){if(_0x4840e7){return _0x4840e7[_0xd4fe('0x25')]()[_0xd4fe('0x24')](function(){_0x3ba0c6[_0xd4fe('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8dab1,_0x964ff0){return function(_0x11b6fb){if(!_0x11b6fb){_0x8dab1[_0xd4fe('0x1a')](0x194);}return _0x11b6fb;};}function handleError(_0x500d17,_0x1a0d0e){_0x1a0d0e=_0x1a0d0e||0x1f4;return function(_0x264329){logger[_0xd4fe('0x26')](_0x264329[_0xd4fe('0x27')]);if(_0x264329[_0xd4fe('0x28')]){delete _0x264329[_0xd4fe('0x28')];}_0x500d17[_0xd4fe('0x1b')](_0x1a0d0e)[_0xd4fe('0x29')](_0x264329);};}function getInteractionUsers(_0x203bc1,_0x578ce0){return new BPromise(function(_0x1751b3,_0x2dafc6){try{if(_0x578ce0[_0x203bc1['id']]){_0x203bc1['Users']=_['map'](_0x578ce0[_0x203bc1['id']],function(_0x5afd3a){return{'id':_0x5afd3a['id'],'fullname':_0x5afd3a['fullname']};});}}catch(_0x3d73d6){_0x2dafc6(_0x3d73d6);}_0x1751b3(_0x203bc1);});}function getInteractionTags(_0x52fa63,_0x1349b7){return new BPromise(function(_0x5e55fb,_0xc77c02){try{if(_0x52fa63['TagIds']){_0x52fa63[_0xd4fe('0x2a')]=[];_0x52fa63[_0xd4fe('0x2b')][_0xd4fe('0x2c')](',')[_0xd4fe('0x2d')](function(_0x5c8d9c){_0x52fa63[_0xd4fe('0x2a')]['push'](_0x1349b7[_0x5c8d9c]);});}delete _0x52fa63['TagIds'];}catch(_0x3204cd){_0xc77c02(_0x3204cd);}_0x5e55fb(_0x52fa63);});}function updateSmsInteraction(_0x22ff12,_0x53df86,_0x1c54f6){return new BPromise(function(_0x42bef6,_0x2ea124){return getInteractionUsers(_0x22ff12,_0x1c54f6)[_0xd4fe('0x24')](function(_0x1a71f0){return getInteractionTags(_0x1a71f0,_0x53df86);})[_0xd4fe('0x24')](function(_0xe9e3c1){return getStateInteraction(_0xe9e3c1);})['then'](function(_0xdf7c7e){_0x42bef6(_0xdf7c7e);})[_0xd4fe('0x2e')](function(_0x33630d){_0x2ea124(_0x33630d);});});}function getStateInteraction(_0x496a41){return new BPromise(function(_0x300125){_0x496a41[_0xd4fe('0x2f')]=0x0;_0x496a41[_0xd4fe('0x30')]=0x0;_0x496a41['answered']=0x0;_0x496a41['unmanaged']=0x0;_0x496a41[_0xd4fe('0x31')]=0x0;if(!_0x496a41[_0xd4fe('0x32')]&&!_0x496a41['UserId']){_0x496a41[_0xd4fe('0x2f')]+=0x1;}if(!_0x496a41[_0xd4fe('0x32')]&&_0x496a41[_0xd4fe('0x33')]){_0x496a41[_0xd4fe('0x30')]+=0x1;if(_0x496a41['waiting']){_0x496a41[_0xd4fe('0x2f')]-=0x1;}}if(_0x496a41['closed']&&_0x496a41[_0xd4fe('0x33')]){_0x496a41[_0xd4fe('0x34')]+=0x1;if(_0x496a41[_0xd4fe('0x30')]){_0x496a41[_0xd4fe('0x30')]-=0x1;}}if(_0x496a41['closed']&&!_0x496a41[_0xd4fe('0x33')]){_0x496a41[_0xd4fe('0x35')]+=0x1;if(_0x496a41['waiting']){_0x496a41[_0xd4fe('0x2f')]-=0x1;}}_0x496a41[_0xd4fe('0x31')]+=0x1;_0x300125(_0x496a41);});}exports[_0xd4fe('0x36')]=function(_0x1940ec,_0x398c70){var _0x2c1888={},_0x5086d0={},_0x27bc6d={'count':0x0,'rows':[]};var _0x462c3f=_['map'](db[_0xd4fe('0x37')][_0xd4fe('0x38')],function(_0x13b887){return{'name':_0x13b887['fieldName'],'type':_0x13b887[_0xd4fe('0x39')][_0xd4fe('0x3a')]};});_0x5086d0['model']=_[_0xd4fe('0x3b')](_0x462c3f,'name');_0x5086d0[_0xd4fe('0x3c')]=_[_0xd4fe('0x3d')](_0x1940ec[_0xd4fe('0x3c')]);_0x5086d0['filters']=_[_0xd4fe('0x3e')](_0x5086d0[_0xd4fe('0x3f')],_0x5086d0['query']);_0x2c1888[_0xd4fe('0x40')]=_[_0xd4fe('0x3e')](_0x5086d0[_0xd4fe('0x3f')],qs[_0xd4fe('0x41')](_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x41')]));_0x2c1888[_0xd4fe('0x40')]=_0x2c1888[_0xd4fe('0x40')][_0xd4fe('0x42')]?_0x2c1888['attributes']:_0x5086d0[_0xd4fe('0x3f')];if(!_0x1940ec[_0xd4fe('0x3c')]['hasOwnProperty'](_0xd4fe('0x43'))){_0x2c1888[_0xd4fe('0x20')]=qs[_0xd4fe('0x20')](_0x1940ec['query'][_0xd4fe('0x20')]);_0x2c1888[_0xd4fe('0x1e')]=qs['offset'](_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x1e')]);}_0x2c1888[_0xd4fe('0x44')]=qs[_0xd4fe('0x45')](_0x1940ec[_0xd4fe('0x3c')]['sort']);_0x2c1888[_0xd4fe('0x46')]=qs[_0xd4fe('0x47')](_[_0xd4fe('0x48')](_0x1940ec['query'],_0x5086d0[_0xd4fe('0x47')]),_0x462c3f);var _0x1a6ef0=[];var _0x969a6=squel[_0xd4fe('0x49')]()[_0xd4fe('0x4a')]('id')[_0xd4fe('0x4a')](_0xd4fe('0x28'))[_0xd4fe('0x4a')](_0xd4fe('0x4b'))[_0xd4fe('0x4c')](_0xd4fe('0x4d'));var _0x2a0007=squel['select']()['field'](_0xd4fe('0x4e'))[_0xd4fe('0x4a')](_0xd4fe('0x4f'))[_0xd4fe('0x4a')](_0xd4fe('0x50'))['from'](_0xd4fe('0x51'),'ui')['left_join'](_0xd4fe('0x52'),'u',_0xd4fe('0x53'));var _0x587d59=squel[_0xd4fe('0x49')]()[_0xd4fe('0x4c')](_0xd4fe('0x54'),'i')['left_join'](_0xd4fe('0x55'),'c',_0xd4fe('0x56'))[_0xd4fe('0x57')](_0xd4fe('0x52'),'o',_0xd4fe('0x58'))[_0xd4fe('0x57')](_0xd4fe('0x59'),'a',_0xd4fe('0x5a'))[_0xd4fe('0x57')](_0xd4fe('0x5b'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xd4fe('0x57')](_0xd4fe('0x5c'),'it',_0xd4fe('0x5d'))[_0xd4fe('0x57')](_0xd4fe('0x4d'),'t','t.id\x20=\x20it.TagId');var _0x593906=squel[_0xd4fe('0x5e')]();var _0x17074e=[];var _0x83f402=squel[_0xd4fe('0x5e')]();var _0xb2a277;if(_0x1940ec['query'][_0xd4fe('0x5f')]){_0xb2a277=as[_0xd4fe('0x60')](_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x5f')]);var _0x176060=_0xb2a277[_0xd4fe('0x61')];for(var _0x3daa80=0x0;_0x3daa80<_0xb2a277['conditions'][_0xd4fe('0x42')];_0x3daa80++){var _0x5439a4=_0xb2a277['conditions'][_0x3daa80];var _0x381119='i';var _0x1b909e=_[_0xd4fe('0x62')](_0x462c3f,[_0xd4fe('0x28'),_0x5439a4[_0xd4fe('0x4a')]]);if(!_0x1b909e){switch(_0x5439a4[_0xd4fe('0x4a')]){case _0xd4fe('0x63'):if(_0x5439a4['value']==0x1){_0x587d59['having']('`'+_0x5439a4[_0xd4fe('0x4a')]+_0xd4fe('0x64'));}else{_0x587d59['having']('`'+_0x5439a4[_0xd4fe('0x4a')]+_0xd4fe('0x65'));}break;case _0xd4fe('0x66'):if(_0x5439a4['operator']===_0xd4fe('0x67')){if(_0x5439a4['value'][_0xd4fe('0x2c')]('\x20')['length']>0x1){_0x593906[_0x176060](_0xd4fe('0x68'),qs[_0xd4fe('0x69')](_0x5439a4[_0xd4fe('0x6a')]),null);}else{var _0x378eef='%'+_0x5439a4[_0xd4fe('0x6a')]+'%';_0x593906[_0x176060](_0xd4fe('0x6b'),_0x378eef,_0x378eef,_0x378eef);}}else{_0x1b909e=_[_0xd4fe('0x62')](_0x462c3f,['name',_0xd4fe('0x6c')]);_0x5439a4[_0xd4fe('0x4a')]='ContactId';_0x444b29=as[_0xd4fe('0x6d')](_0x381119,_0x1b909e['type'],_0x5439a4);_0x593906[_0x176060](_0x444b29[_0xd4fe('0x6e')],_0x444b29[_0xd4fe('0x6a')][_0xd4fe('0x6f')],_0x444b29['value'][_0xd4fe('0x1c')]);}break;case'Tag':var _0x2eaab6=_0x5439a4['value']['split'](',')['map'](function(_0x883c19){return Number(_0x883c19);});_0x2eaab6[_0xd4fe('0x2d')](function(_0x1731a5){_0x83f402['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1731a5+',%');});_0x17074e=_[_0xd4fe('0x70')](_0x17074e,_0x2eaab6);break;case _0xd4fe('0x71'):if(_0x5439a4['operator']===_0xd4fe('0x67')){_0x593906[_0x176060](_0xd4fe('0x72'),'%'+_0x5439a4[_0xd4fe('0x6a')]+'%',null);}else{_0x1b909e=_[_0xd4fe('0x62')](_0x462c3f,[_0xd4fe('0x28'),_0xd4fe('0x33')]);_0x5439a4[_0xd4fe('0x4a')]=_0xd4fe('0x33');_0x444b29=as[_0xd4fe('0x6d')](_0x381119,_0x1b909e['type'],_0x5439a4);_0x593906[_0x176060](_0x444b29[_0xd4fe('0x6e')],_0x444b29[_0xd4fe('0x6a')][_0xd4fe('0x6f')],_0x444b29[_0xd4fe('0x6a')]['end']);}break;case _0xd4fe('0x73'):_0x444b29=as[_0xd4fe('0x6d')]('me',null,_0x5439a4);_0x593906[_0x176060](_0x444b29[_0xd4fe('0x6e')],_0x444b29[_0xd4fe('0x6a')]['start'],_0x444b29[_0xd4fe('0x6a')][_0xd4fe('0x1c')]);break;}}else{var _0x444b29=as[_0xd4fe('0x6d')](_0x381119,_0x1b909e[_0xd4fe('0x39')],_0x5439a4);_0x593906[_0x176060](_0x444b29['text'],_0x444b29[_0xd4fe('0x6a')][_0xd4fe('0x6f')],_0x444b29[_0xd4fe('0x6a')][_0xd4fe('0x1c')]);}}}else{var _0x5e83c5=_(_0x1940ec[_0xd4fe('0x3c')])[_0xd4fe('0x3d')]()[_0xd4fe('0x3b')](function(_0xd5f0c){return _[_0xd4fe('0x74')](_0x462c3f,[_0xd4fe('0x28'),_0xd5f0c])?_0xd5f0c:undefined;})[_0xd4fe('0x75')]()[_0xd4fe('0x6a')]();if(!_['isEmpty'](_0x5e83c5)){_0x5e83c5['forEach'](function(_0x995824){if(_0x995824===_0xd4fe('0x76')){_0x587d59[_0xd4fe('0x46')]('i.SmsAccountId\x20IN\x20?',[][_0xd4fe('0x77')](_0x1940ec[_0xd4fe('0x3c')][_0x995824]));}else if(_0x995824===_0xd4fe('0x78')){var _0x2ebc76=JSON[_0xd4fe('0x79')](_0x1940ec[_0xd4fe('0x3c')][_0x995824])[_0xd4fe('0x7a')];var _0x5f53f1=JSON[_0xd4fe('0x79')](_0x1940ec[_0xd4fe('0x3c')][_0x995824])[_0xd4fe('0x7b')];_0x587d59[_0xd4fe('0x46')](_0xd4fe('0x7c'),_0x2ebc76,_0x5f53f1);}else{if(_0x1940ec[_0xd4fe('0x3c')][_0x995824]==='null'){_0x587d59[_0xd4fe('0x46')]('i.'+_0x995824+'\x20IS\x20NULL');}else{_0x587d59['where']('i.'+_0x995824+'\x20=\x20?',_0x1940ec['query'][_0x995824]);}}});}if(_0x1940ec[_0xd4fe('0x3c')]['read']){if(_0x1940ec['query']['read']==0x1){_0x587d59['having'](_0xd4fe('0x7d'));}else{_0x587d59['having'](_0xd4fe('0x7e'));}}if(_0x1940ec[_0xd4fe('0x3c')]['tag']){_0x17074e=_['isArray'](_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x7f')])?_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x7f')]:new Array(_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x7f')]);_0x17074e[_0xd4fe('0x2d')](function(_0x5bbc04){_0x83f402['or'](_0xd4fe('0x80'),'%,'+_0x5bbc04+',%');});}if(_0x1940ec['query']['filter']){var _0x266923=_0x1940ec[_0xd4fe('0x3c')]['filter']['replace']('\x5c','\x5c\x5c')[_0xd4fe('0x81')](/'/g,'\x27\x27');if(qs[_0xd4fe('0x82')](_0x266923)){_0x593906['or']('i.id\x20LIKE\x20?',_0x266923+'%')['or'](_0xd4fe('0x83'),_0x266923+'%');}else{_0x593906['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd4fe('0x69')](_0x266923))['or'](_0xd4fe('0x84'),_0x266923+'%');}}}_0x587d59['where'](_0x593906);_0x587d59[_0xd4fe('0x85')]('i.id');var _0x296782={'type':db[_0xd4fe('0x86')]['QueryTypes'][_0xd4fe('0x87')],'raw':!![]};var _0x2551c5=_0x587d59[_0xd4fe('0x88')]();_0x2551c5[_0xd4fe('0x4a')](_0xd4fe('0x89'));_0x2551c5['field'](_0xd4fe('0x8a'),'unreadMessages');if(_0x2c1888['order']){_0x2c1888[_0xd4fe('0x44')][_0xd4fe('0x2d')](function(_0x378c6b){var _0x1f89cc=_0x378c6b[0x0]===_0xd4fe('0x8b')?_0x378c6b[0x0]:'i.'+_0x378c6b[0x0];_0x587d59[_0xd4fe('0x44')](_0x1f89cc,_0x378c6b[0x1]===_0xd4fe('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x17074e)){_0x587d59['having'](_0x83f402);_0x2551c5[_0xd4fe('0x46')]('t.id\x20IN\x20?',_0x17074e);}BPromise[_0xd4fe('0x8d')]()['then'](function(){if(!_0xb2a277){if(_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x76')])return;_0x2551c5[_0xd4fe('0x46')](_0xd4fe('0x8e'));_0x587d59[_0xd4fe('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1940ec[_0xd4fe('0x8f')]['role']!==_0xd4fe('0x90'))return;return _0x1940ec[_0xd4fe('0x8f')][_0xd4fe('0x91')]({'attributes':['id'],'raw':!![]})[_0xd4fe('0x24')](function(_0x16364f){if(_[_0xd4fe('0x92')](_0x16364f)){_0x2551c5[_0xd4fe('0x46')](_0xd4fe('0x93'));_0x587d59['where'](_0xd4fe('0x93'));}else{_0x2551c5[_0xd4fe('0x46')](_0xd4fe('0x94'),_[_0xd4fe('0x3b')](_0x16364f,'id'));_0x587d59[_0xd4fe('0x46')](_0xd4fe('0x94'),_[_0xd4fe('0x3b')](_0x16364f,'id'));}});})[_0xd4fe('0x24')](function(){if(_0x1940ec[_0xd4fe('0x8f')]['role']===_0xd4fe('0x90')&&!_0xb2a277&&!_0x1940ec[_0xd4fe('0x3c')]['SmsAccountId'])return[];return db['sequelize'][_0xd4fe('0x3c')](_0x2551c5[_0xd4fe('0x95')](),_0x296782);})[_0xd4fe('0x24')](function(_0x4af652){_0x27bc6d[_0xd4fe('0x96')]=_0x4af652[_0xd4fe('0x42')];if(_0x27bc6d[_0xd4fe('0x96')]===0x0)return[];return db['sequelize'][_0xd4fe('0x3c')](_0x969a6[_0xd4fe('0x95')](),_0x296782)['then'](function(_0x4331cb){_0x1a6ef0=_['keyBy'](_0x4331cb,'id');_0x296782=_['merge'](_0x296782,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1940ec[_0xd4fe('0x3c')][_0xd4fe('0x41')]){_0x2c1888['attributes'][_0xd4fe('0x2d')](function(_0x517d52){_0x587d59['field']('i.'+_0x517d52);});}else{_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0x8a'),_0xd4fe('0x63'));_0x587d59['field']('a.key','Account.key');_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0x97'),_0xd4fe('0x98'));_0x587d59['field'](_0xd4fe('0x99'),_0xd4fe('0x8b'));_0x587d59[_0xd4fe('0x4a')]('i.*');_0x587d59['field']('c.firstName',_0xd4fe('0x9a'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0x9b'),_0xd4fe('0x9c'));_0x587d59['field'](_0xd4fe('0x9d'),_0xd4fe('0x9e'));_0x587d59[_0xd4fe('0x4a')]('c.phone',_0xd4fe('0x9f'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0xa0'),_0xd4fe('0xa1'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0xa2'),_0xd4fe('0xa3'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0xa4'),_0xd4fe('0xa5'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0xa6'),_0xd4fe('0xa7'));_0x587d59[_0xd4fe('0x4a')](_0xd4fe('0xa8'),_0xd4fe('0x2b'));}if(_0x2c1888[_0xd4fe('0x20')])_0x587d59[_0xd4fe('0x20')](_0x2c1888[_0xd4fe('0x20')]);if(_0x2c1888[_0xd4fe('0x1e')])_0x587d59[_0xd4fe('0x1e')](_0x2c1888['offset']);return db[_0xd4fe('0xa9')][_0xd4fe('0x3c')](_0x587d59[_0xd4fe('0x95')](),_0x296782);})[_0xd4fe('0x24')](function(_0x32bda8){if(_0x32bda8[_0xd4fe('0x42')]>0x0)_0x2a0007['where'](_0xd4fe('0xaa'),_[_0xd4fe('0x3b')](_0x32bda8,'id'));return db[_0xd4fe('0xa9')][_0xd4fe('0x3c')](_0x2a0007[_0xd4fe('0x95')](),_0x296782)['then'](function(_0x35fc0c){var _0x1b19a4=_[_0xd4fe('0xab')](_0x35fc0c,_0xd4fe('0xac'));var _0x4e62a6=[];_0x32bda8[_0xd4fe('0x2d')](function(_0x294ff5){_0x4e62a6[_0xd4fe('0xad')](updateSmsInteraction(_0x294ff5,_0x1a6ef0,_0x1b19a4));});return BPromise[_0xd4fe('0xae')](_0x4e62a6);});});})[_0xd4fe('0x24')](function(_0x421cd1){_0x27bc6d['rows']=_0x421cd1;return _0x27bc6d;})['then'](respondWithFilteredResult(_0x398c70,_0x2c1888))[_0xd4fe('0x2e')](handleError(_0x398c70,null));};exports[_0xd4fe('0xaf')]=function(_0x38d553,_0x3a3541){var _0x1908bd={'raw':![],'where':{'id':_0x38d553['params']['id']}},_0x229860={};_0x229860['model']=_['keys'](db[_0xd4fe('0x37')]['rawAttributes']);_0x229860[_0xd4fe('0x3c')]=_[_0xd4fe('0x3d')](_0x38d553[_0xd4fe('0x3c')]);_0x229860[_0xd4fe('0x47')]=_[_0xd4fe('0x3e')](_0x229860[_0xd4fe('0x3f')],_0x229860[_0xd4fe('0x3c')]);_0x1908bd[_0xd4fe('0x40')]=_[_0xd4fe('0x3e')](_0x229860[_0xd4fe('0x3f')],qs['fields'](_0x38d553['query'][_0xd4fe('0x41')]));_0x1908bd['attributes']=_0x1908bd[_0xd4fe('0x40')][_0xd4fe('0x42')]?_0x1908bd['attributes']:_0x229860['model'];if(_0x38d553[_0xd4fe('0x3c')]['includeAll']){_0x1908bd[_0xd4fe('0xb0')]=[{'all':!![]}];}_0x1908bd=_[_0xd4fe('0xb1')]({},_0x1908bd,_0x38d553[_0xd4fe('0xb2')]);return db[_0xd4fe('0x37')][_0xd4fe('0x62')](_0x1908bd)[_0xd4fe('0x24')](handleEntityNotFound(_0x3a3541,null))[_0xd4fe('0x24')](respondWithResult(_0x3a3541,null))[_0xd4fe('0x2e')](handleError(_0x3a3541,null));};exports['create']=function(_0x45cccf,_0x503df9){return db['SmsInteraction'][_0xd4fe('0xb3')](_0x45cccf[_0xd4fe('0x73')],{})['then'](respondWithResult(_0x503df9,0xc9))[_0xd4fe('0x2e')](handleError(_0x503df9,null));};exports[_0xd4fe('0x23')]=function(_0x3509f8,_0x2df7c7){if(_0x3509f8[_0xd4fe('0x73')]['id']){delete _0x3509f8[_0xd4fe('0x73')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x3509f8[_0xd4fe('0xb4')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x2df7c7,null))[_0xd4fe('0x24')](saveUpdates(_0x3509f8[_0xd4fe('0x73')],null))[_0xd4fe('0x24')](respondWithResult(_0x2df7c7,null))[_0xd4fe('0x2e')](handleError(_0x2df7c7,null));};exports[_0xd4fe('0x25')]=function(_0x5b5b61,_0xa99a5d){return db[_0xd4fe('0x37')][_0xd4fe('0x62')]({'where':{'id':_0x5b5b61[_0xd4fe('0xb4')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0xa99a5d,null))[_0xd4fe('0x24')](removeEntity(_0xa99a5d,null))[_0xd4fe('0x2e')](handleError(_0xa99a5d,null));};exports['describe']=function(_0x26e3ce,_0x2897fe){return db[_0xd4fe('0x37')]['describe']()[_0xd4fe('0x24')](respondWithResult(_0x2897fe,null))[_0xd4fe('0x2e')](handleError(_0x2897fe,null));};exports[_0xd4fe('0xb5')]=function(_0x3e5e2f,_0x361eef,_0x49639b){return db[_0xd4fe('0xb6')][_0xd4fe('0x62')]({'where':{'id':_0x3e5e2f['params']['id']}})['then'](handleEntityNotFound(_0x361eef,null))[_0xd4fe('0x24')](function(_0x20bcb1){if(_0x20bcb1){return _0x20bcb1['addMessage'](_0x3e5e2f[_0xd4fe('0x73')][_0xd4fe('0xb7')],_[_0xd4fe('0xb8')](_0x3e5e2f[_0xd4fe('0x73')],['ids','id'])||{});}})[_0xd4fe('0x24')](respondWithResult(_0x361eef,null))[_0xd4fe('0x2e')](handleError(_0x361eef,null));};exports[_0xd4fe('0xb9')]=function(_0x1bb48d,_0x4f1d99,_0x390103){var _0x216ca1={'raw':![],'where':{}};var _0x4bd6aa={};var _0x243037={'count':0x0,'rows':[]};return db[_0xd4fe('0x37')][_0xd4fe('0xba')]({'where':{'id':_0x1bb48d[_0xd4fe('0xb4')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x4f1d99,null))[_0xd4fe('0x24')](function(_0x2dc2e6){if(_0x2dc2e6){_0x4bd6aa[_0xd4fe('0x3f')]=_[_0xd4fe('0x3d')](db[_0xd4fe('0xb6')][_0xd4fe('0x38')]);_0x4bd6aa[_0xd4fe('0x3c')]=_[_0xd4fe('0x3d')](_0x1bb48d[_0xd4fe('0x3c')]);_0x4bd6aa[_0xd4fe('0x47')]=_['intersection'](_0x4bd6aa[_0xd4fe('0x3f')],_0x4bd6aa[_0xd4fe('0x3c')]);_0x216ca1[_0xd4fe('0x40')]=_[_0xd4fe('0x3e')](_0x4bd6aa['model'],qs[_0xd4fe('0x41')](_0x1bb48d['query'][_0xd4fe('0x41')]));_0x216ca1[_0xd4fe('0x40')]=_0x216ca1[_0xd4fe('0x40')][_0xd4fe('0x42')]?_0x216ca1[_0xd4fe('0x40')]:_0x4bd6aa[_0xd4fe('0x3f')];if(!_0x1bb48d['query'][_0xd4fe('0xbb')](_0xd4fe('0x43'))){_0x216ca1[_0xd4fe('0x20')]=qs[_0xd4fe('0x20')](_0x1bb48d['query'][_0xd4fe('0x20')]);_0x216ca1[_0xd4fe('0x1e')]=qs[_0xd4fe('0x1e')](_0x1bb48d['query']['offset']);}_0x216ca1[_0xd4fe('0x44')]=qs[_0xd4fe('0x45')](_0x1bb48d[_0xd4fe('0x3c')][_0xd4fe('0x45')]);_0x216ca1[_0xd4fe('0x46')]=qs[_0xd4fe('0x47')](_[_0xd4fe('0x48')](_0x1bb48d['query'],_0x4bd6aa[_0xd4fe('0x47')]));_0x216ca1['where']['SmsInteractionId']=_0x2dc2e6['id'];if(_0x1bb48d[_0xd4fe('0x3c')][_0xd4fe('0xbc')]){_0x216ca1[_0xd4fe('0x46')]=_[_0xd4fe('0xb1')](_0x216ca1[_0xd4fe('0x46')],{'$or':_[_0xd4fe('0x3b')](_0x216ca1[_0xd4fe('0x40')],function(_0x162c95){var _0x51461c={};_0x51461c[_0x162c95]={'$like':'%'+_0x1bb48d['query']['filter']+'%'};return _0x51461c;})});}if(_0x1bb48d[_0xd4fe('0x3c')]['$gte']){var _0x1c1d7a=_0x1bb48d[_0xd4fe('0x3c')]['$gte'][_0xd4fe('0x2c')](',');var _0x5d608b={};_0x5d608b[_0x1c1d7a[0x0]]={'$gte':moment(_0x1c1d7a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x216ca1[_0xd4fe('0x46')]=_[_0xd4fe('0xb1')](_0x216ca1['where'],_0x5d608b);}_0x216ca1=_[_0xd4fe('0xb1')]({},_0x216ca1,_0x1bb48d[_0xd4fe('0xb2')]);return db['SmsMessage'][_0xd4fe('0x96')]({'where':_0x216ca1[_0xd4fe('0x46')]})[_0xd4fe('0x24')](function(_0x3f07a2){_0x243037[_0xd4fe('0x96')]=_0x3f07a2;if(_0x1bb48d['query'][_0xd4fe('0xbd')]){_0x216ca1[_0xd4fe('0xb0')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x216ca1);})[_0xd4fe('0x24')](function(_0x634ab7){_0x243037[_0xd4fe('0xbe')]=_0x634ab7;return _0x243037;});}})[_0xd4fe('0x24')](respondWithFilteredResult(_0x4f1d99,_0x216ca1))[_0xd4fe('0x2e')](handleError(_0x4f1d99,null));};exports[_0xd4fe('0xbf')]=function(_0x55655c,_0x4a5ebb,_0x3a6f98){return db[_0xd4fe('0x37')]['find']({'where':{'id':_0x55655c['params']['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x4a5ebb,null))['then'](function(_0x2c1eb2){if(_0x2c1eb2){return _0x2c1eb2['setTags'](_0x55655c['body']['ids'],_[_0xd4fe('0xb8')](_0x55655c[_0xd4fe('0x73')],['ids','id'])||{})[_0xd4fe('0xc0')](function(){return db[_0xd4fe('0xc1')][_0xd4fe('0xc2')]({'attributes':['id',_0xd4fe('0x28'),_0xd4fe('0x4b')],'where':{'id':_0x55655c[_0xd4fe('0x73')]['ids']}});})[_0xd4fe('0x24')](function(_0x183dc1){socket[_0xd4fe('0xc3')](_0xd4fe('0xc4'),{'id':Number(_0x55655c[_0xd4fe('0xb4')]['id']),'tags':_0x183dc1||[]});return{'id':Number(_0x55655c[_0xd4fe('0xb4')]['id']),'tags':_0x183dc1||[]};});}})[_0xd4fe('0x24')](respondWithResult(_0x4a5ebb,null))['catch'](handleError(_0x4a5ebb,null));};exports[_0xd4fe('0xc5')]=function(_0x12a251,_0x5b8ee7,_0x1070b1){return db[_0xd4fe('0x37')][_0xd4fe('0x62')]({'where':{'id':_0x12a251[_0xd4fe('0xb4')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x5b8ee7,null))['then'](function(_0x15d292){if(_0x15d292){return _0x15d292[_0xd4fe('0xc5')](_0x12a251[_0xd4fe('0x3c')][_0xd4fe('0xb7')]);}})[_0xd4fe('0x24')](respondWithStatusCode(_0x5b8ee7,null))[_0xd4fe('0x2e')](handleError(_0x5b8ee7,null));};exports[_0xd4fe('0xc6')]=function(_0x120292,_0xce3021){var _0xfd4d67=moment()['unix']()['toString']();var _0x7f4297=path['join'](config[_0xd4fe('0xc7')],_0xd4fe('0xc8'),_0xd4fe('0xc9'),_0xd4fe('0xca'));var _0x160085=path['join'](config[_0xd4fe('0xc7')],'server',_0xd4fe('0xc9'),_0xd4fe('0xcb'));var _0x4e8181=path[_0xd4fe('0xcc')](_0x7f4297,_0xfd4d67);var _0x2d6262=util[_0xd4fe('0xcd')]('transcript-%d-%s.zip',_0x120292['params']['id'],_0xfd4d67);var _0x1794bf=path[_0xd4fe('0xcc')](_0x7f4297,_0x2d6262);var _0x2bbfb0=[];_0x2bbfb0[_0xd4fe('0xad')]({'model':db[_0xd4fe('0x71')],'as':_0xd4fe('0x71'),'attributes':['id','fullname'],'raw':!![]});_0x2bbfb0[_0xd4fe('0xad')]({'model':db[_0xd4fe('0xce')],'as':'Contact','attributes':['id',_0xd4fe('0xcf'),'lastName'],'raw':!![]});var _0x3d9788=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xd4fe('0x73'),'createdAt',_0xd4fe('0xd0'),'secret',_0xd4fe('0xd1')],'include':_0x2bbfb0}];_0x3d9788['push']({'model':db[_0xd4fe('0xd2')],'as':_0xd4fe('0xd3'),'attributes':['id',_0xd4fe('0x28')]});_0x3d9788['push']({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xd4fe('0x62')]({'where':{'id':_0x120292[_0xd4fe('0xb4')]['id']},'include':_0x3d9788})[_0xd4fe('0x24')](handleEntityNotFound(_0xce3021,null))[_0xd4fe('0x24')](function(_0x157e77){if(_0x157e77){var _0x515bf0=_0x157e77[_0xd4fe('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x4e8181);var _0x3d2422={'channel':_0xd4fe('0xd5'),'account':_0x515bf0['Account'][_0xd4fe('0x28')],'agent':_0x515bf0[_0xd4fe('0xd6')]?_0x515bf0[_0xd4fe('0xd6')][_0xd4fe('0xd7')]:'N.A.','createdAt':moment(_0x515bf0[_0xd4fe('0x78')])[_0xd4fe('0xcd')](_0xd4fe('0xd8'))[_0xd4fe('0x95')](),'closedAt':_0x515bf0[_0xd4fe('0x32')]?moment(_0x515bf0[_0xd4fe('0xd9')])['format'](_0xd4fe('0xd8'))[_0xd4fe('0x95')]():'','disposition':_0x515bf0[_0xd4fe('0xda')],'messages':_(_0x515bf0[_0xd4fe('0xdb')])[_0xd4fe('0xbc')]({'secret':![]})[_0xd4fe('0x3b')](function(_0x44f515){return{'date':moment(_0x44f515['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x44f515[_0xd4fe('0xd0')]===_0xd4fe('0xdc')?_0x44f515[_0xd4fe('0x71')]?_0x44f515[_0xd4fe('0x71')][_0xd4fe('0xd7')]:_0xd4fe('0xdd'):_0x44f515[_0xd4fe('0x66')][_0xd4fe('0xcf')]+(_0x44f515[_0xd4fe('0x66')]['lastName']?'\x20'+_0x44f515[_0xd4fe('0x66')]['lastName']:''),'body':_0x44f515['body'],'direction':_0x44f515[_0xd4fe('0xd0')]===_0xd4fe('0xdc')?'A':'C','secret':_0x44f515[_0xd4fe('0xde')],'read':_0x44f515[_0xd4fe('0xd1')]};})['value']()};return ejs[_0xd4fe('0xdf')](path[_0xd4fe('0xcc')](config[_0xd4fe('0xc7')],_0xd4fe('0xc8'),_0xd4fe('0xe0'),'downloadInteraction.ejs'),{'interaction':_0x3d2422})[_0xd4fe('0x24')](function(_0x52f75a){var _0x41e397=path[_0xd4fe('0xcc')](_0x4e8181,_0xd4fe('0xe1')+_0x515bf0['id']+'-'+_0xfd4d67+_0xd4fe('0xe2'));var _0x2b2a9a={'path':_0x41e397,'channel':_0xd4fe('0xd5'),'interactionId':_0x515bf0['id']};return pdf[_0xd4fe('0xe3')](_0x52f75a,_0x2b2a9a);})['then'](function(){return new BPromise(function(_0x176e17,_0x547c7f){zipdir(_0x4e8181,{'saveTo':_0x1794bf},function(_0x16c73d,_0x472492){if(_0x16c73d)return _0x547c7f(_0x16c73d);return _0x176e17(_0x472492);});})[_0xd4fe('0x24')](function(){return new BPromise(function(_0xb6fe7a,_0x54ff2b){rimraf(_0x4e8181,function(_0x228a44){if(_0x228a44)_0x54ff2b(_0x228a44);return _0xb6fe7a();});});})['then'](function(){return _0xce3021[_0xd4fe('0xc6')](_0x1794bf,_0x2d6262,function(_0x16610e){if(_0x16610e){console[_0xd4fe('0xe4')](_0xd4fe('0xe5'),_0x16610e);}else{fs[_0xd4fe('0xe6')](_0x1794bf);}});});});}else{return _0xce3021[_0xd4fe('0x1a')](0xc8);}})['catch'](handleError(_0xce3021,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index bb29122..79d960e 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 _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x39e740,_0x3a3084){var _0x49d5fc=function(_0x344959){while(--_0x344959){_0x39e740['push'](_0x39e740['shift']());}};_0x49d5fc(++_0x3a3084);}(_0xef0f,0x168));var _0xfef0=function(_0x2970c2,_0x59b21e){_0x2970c2=_0x2970c2-0x0;var _0x9e3084=_0xef0f[_0x2970c2];return _0x9e3084;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x93e9=['getUsers','then','setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x5c67ab,_0x14e2d0){var _0x194183=function(_0x2044ae){while(--_0x2044ae){_0x5c67ab['push'](_0x5c67ab['shift']());}};_0x194183(++_0x14e2d0);}(_0x93e9,0xcc));var _0x993e=function(_0x497641,_0x5d4f64){_0x497641=_0x497641-0x0;var _0x3c355e=_0x93e9[_0x497641];return _0x3c355e;};'use strict';var EventEmitter=require(_0x993e('0x0'));var SmsInteraction=require(_0x993e('0x1'))['db'][_0x993e('0x2')];var SmsMessage=require(_0x993e('0x1'))['db'][_0x993e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x993e('0x4')](0x0);var events={'afterCreate':_0x993e('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b762e){return function(_0x255045,_0x15ce9b,_0x45f52e){_0x255045[_0x993e('0x6')]({'attributes':['id'],'raw':!![]})[_0x993e('0x7')](function(_0x12ac94){_0x255045[_0x993e('0x8')]('Users',_0x12ac94[_0x993e('0x9')](function(_0x69ff1){return{'id':_0x69ff1['id']};}));return SmsMessage[_0x993e('0xa')]({'where':{'SmsInteractionId':_0x255045['id'],'direction':'in','read':![]},'raw':!![]});})[_0x993e('0x7')](function(_0x2cd389){_0x255045[_0x993e('0x8')](_0x993e('0xb'),_0x2cd389['length']);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e+':'+_0x255045['id'],_0x255045);SmsInteractionEvents[_0x993e('0xc')](_0x1b762e,_0x255045);_0x45f52e(null);})['catch'](_0x45f52e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x993e('0xd')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6f73fb9..bc0f5e4 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 _0x6c98=['SmsInteraction','sms_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define'];(function(_0x299175,_0x5333a3){var _0x3db1d8=function(_0xc4f39){while(--_0xc4f39){_0x299175['push'](_0x299175['shift']());}};_0x3db1d8(++_0x5333a3);}(_0x6c98,0x90));var _0x86c9=function(_0x3125e5,_0xe55296){_0x3125e5=_0x3125e5-0x0;var _0x5ea5de=_0x6c98[_0x3125e5];return _0x5ea5de;};'use strict';var _=require(_0x86c9('0x0'));var util=require(_0x86c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x86c9('0x2'));var BPromise=require(_0x86c9('0x3'));var rp=require(_0x86c9('0x4'));var fs=require('fs');var path=require(_0x86c9('0x5'));var rimraf=require(_0x86c9('0x6'));var config=require(_0x86c9('0x7'));var attributes=require(_0x86c9('0x8'));module['exports']=function(_0x597c04,_0x991b3e){return _0x597c04[_0x86c9('0x9')](_0x86c9('0xa'),attributes,{'tableName':_0x86c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a208c,_0x210aa8,_0x1ef80b){if(_0x3a208c['changed'](_0x86c9('0xc'))){_0x3a208c['closedAt']=moment()['format'](_0x86c9('0xd'));}_0x1ef80b(null,_0x3a208c);}}});}; \ No newline at end of file +var _0x9b14=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format'];(function(_0x53f586,_0x2c46cb){var _0x2824a4=function(_0x299be2){while(--_0x299be2){_0x53f586['push'](_0x53f586['shift']());}};_0x2824a4(++_0x2c46cb);}(_0x9b14,0x121));var _0x49b1=function(_0x3b2397,_0x4d52e8){_0x3b2397=_0x3b2397-0x0;var _0x4a81ea=_0x9b14[_0x3b2397];return _0x4a81ea;};'use strict';var _=require(_0x49b1('0x0'));var util=require(_0x49b1('0x1'));var logger=require(_0x49b1('0x2'))('api');var moment=require(_0x49b1('0x3'));var BPromise=require(_0x49b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49b1('0x5'));var rimraf=require(_0x49b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x49b1('0x7'));module[_0x49b1('0x8')]=function(_0x5a771c,_0x178561){return _0x5a771c[_0x49b1('0x9')](_0x49b1('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x239f88,_0x335149,_0x50ff1c){if(_0x239f88[_0x49b1('0xb')](_0x49b1('0xc'))){_0x239f88[_0x49b1('0xd')]=moment()[_0x49b1('0xe')](_0x49b1('0xf'));}_0x50ff1c(null,_0x239f88);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 360ec35..a39fcc1 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 _0x0e6a=['AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit'];(function(_0x4a4592,_0x4ce90d){var _0x41185d=function(_0x365d3f){while(--_0x365d3f){_0x4a4592['push'](_0x4a4592['shift']());}};_0x41185d(++_0x4ce90d);}(_0x0e6a,0x197));var _0xa0e6=function(_0x4557d1,_0x1d7c22){_0x4557d1=_0x4557d1-0x0;var _0x5c27bc=_0x0e6a[_0x4557d1];return _0x5c27bc;};'use strict';var _=require(_0xa0e6('0x0'));var util=require('util');var moment=require(_0xa0e6('0x1'));var BPromise=require(_0xa0e6('0x2'));var rs=require(_0xa0e6('0x3'));var fs=require('fs');var Redis=require(_0xa0e6('0x4'));var db=require(_0xa0e6('0x5'))['db'];var utils=require(_0xa0e6('0x6'));var logger=require(_0xa0e6('0x7'))('rpc');var config=require(_0xa0e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0e6('0x9')][_0xa0e6('0xa')]({'port':0x232a});config[_0xa0e6('0xb')]=_[_0xa0e6('0xc')](config[_0xa0e6('0xb')],{'host':_0xa0e6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xfffd35,_0x4c8dec,_0x55b824){return new BPromise(function(_0xaee3cd,_0x1f7186){return client[_0xa0e6('0xe')](_0xfffd35,_0x55b824)[_0xa0e6('0xf')](function(_0x4c21a6){logger[_0xa0e6('0x10')](_0xa0e6('0x11'),_0x4c8dec,_0xa0e6('0x12'));logger[_0xa0e6('0x13')](_0xa0e6('0x14'),_0x4c8dec,'request\x20sent',JSON[_0xa0e6('0x15')](_0x4c21a6));if(_0x4c21a6[_0xa0e6('0x16')]){if(_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x17')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);return _0x1f7186(_0x4c21a6[_0xa0e6('0x16')]['message']);}logger[_0xa0e6('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);return _0xaee3cd(_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);}else{logger[_0xa0e6('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0xa0e6('0x12'));_0xaee3cd(_0x4c21a6['result'][_0xa0e6('0x18')]);}})[_0xa0e6('0x19')](function(_0x2fdd9d){logger[_0xa0e6('0x16')](_0xa0e6('0x11'),_0x4c8dec,_0x2fdd9d);_0x1f7186(_0x2fdd9d);});});}exports[_0xa0e6('0x1a')]=function(_0x50c558){var _0x5a1352=this;return new Promise(function(_0x21e462,_0x4dc54d){return db[_0xa0e6('0x1b')]['update'](_0x50c558[_0xa0e6('0x1c')],{'raw':_0x50c558[_0xa0e6('0x1d')]?_0x50c558['options'][_0xa0e6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c558['options']?_0x50c558[_0xa0e6('0x1d')][_0xa0e6('0x1f')]||null:null,'attributes':_0x50c558[_0xa0e6('0x1d')]?_0x50c558[_0xa0e6('0x1d')]['attributes']||null:null,'limit':_0x50c558['options']?_0x50c558[_0xa0e6('0x1d')][_0xa0e6('0x20')]||null:null})[_0xa0e6('0xf')](function(_0x4b705b){logger[_0xa0e6('0x10')](_0xa0e6('0x1a'),_0x50c558);logger[_0xa0e6('0x13')](_0xa0e6('0x1a'),_0x50c558,JSON[_0xa0e6('0x15')](_0x4b705b));_0x21e462(_0x4b705b);})['catch'](function(_0x5c4407){logger[_0xa0e6('0x16')]('UpdateSmsInteraction',_0x5c4407[_0xa0e6('0x18')],_0x50c558);_0x4dc54d(_0x5a1352[_0xa0e6('0x16')](0x1f4,_0x5c4407['message']));});});};exports[_0xa0e6('0x21')]=function(_0x160566){return new Promise(function(_0x21c28f,_0x3040a8){return db[_0xa0e6('0x1b')][_0xa0e6('0x22')]({'where':_0x160566[_0xa0e6('0x1d')]?_0x160566[_0xa0e6('0x1d')]['where']||null:null})[_0xa0e6('0xf')](function(_0x1dc5a7){if(_0x1dc5a7){return _0x1dc5a7[_0xa0e6('0x23')](_0x160566[_0xa0e6('0x1c')][_0xa0e6('0x24')],_[_0xa0e6('0x25')](_0x160566[_0xa0e6('0x1c')],[_0xa0e6('0x24'),'id'])||{});}})[_0xa0e6('0x26')](function(_0x5cc757){logger[_0xa0e6('0x10')]('AddTags',_0x160566);logger[_0xa0e6('0x13')](_0xa0e6('0x27'),_0x160566,JSON[_0xa0e6('0x15')](_0x5cc757));_0x21c28f(_0x5cc757);})['catch'](function(_0x13941e){logger[_0xa0e6('0x16')]('AddTags',_0x13941e[_0xa0e6('0x18')],_0x160566);_0x3040a8(_this[_0xa0e6('0x16')](0x1f4,_0x13941e['message']));});});}; \ No newline at end of file +var _0x3795=['attributes','limit','UpdateSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3795,0x1ae));var _0x5379=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3795[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5379('0x0'));var util=require('util');var moment=require(_0x5379('0x1'));var BPromise=require(_0x5379('0x2'));var rs=require(_0x5379('0x3'));var fs=require('fs');var Redis=require(_0x5379('0x4'));var db=require(_0x5379('0x5'))['db'];var utils=require(_0x5379('0x6'));var logger=require('../../config/logger')(_0x5379('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5379('0x8')][_0x5379('0x9')]({'port':0x232a});config[_0x5379('0xa')]=_['defaults'](config['redis'],{'host':_0x5379('0xb'),'port':0x18eb});var socket=require(_0x5379('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x5379('0xd')](socket);function respondWithRpcPromise(_0x2a57bf,_0x2e285e,_0x4e6dc6){return new BPromise(function(_0x5ada23,_0x524acb){return client[_0x5379('0xe')](_0x2a57bf,_0x4e6dc6)[_0x5379('0xf')](function(_0x1f36a9){logger[_0x5379('0x10')](_0x5379('0x11'),_0x2e285e,_0x5379('0x12'));logger[_0x5379('0x13')](_0x5379('0x14'),_0x2e285e,_0x5379('0x12'),JSON[_0x5379('0x15')](_0x1f36a9));if(_0x1f36a9[_0x5379('0x16')]){if(_0x1f36a9['error'][_0x5379('0x17')]===0x1f4){logger[_0x5379('0x16')](_0x5379('0x11'),_0x2e285e,_0x1f36a9[_0x5379('0x16')][_0x5379('0x18')]);return _0x524acb(_0x1f36a9['error']['message']);}logger[_0x5379('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x2e285e,_0x1f36a9[_0x5379('0x16')][_0x5379('0x18')]);return _0x5ada23(_0x1f36a9[_0x5379('0x16')][_0x5379('0x18')]);}else{logger[_0x5379('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x2e285e,_0x5379('0x12'));_0x5ada23(_0x1f36a9[_0x5379('0x19')]['message']);}})[_0x5379('0x1a')](function(_0x1aad72){logger[_0x5379('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x2e285e,_0x1aad72);_0x524acb(_0x1aad72);});});}exports['UpdateSmsInteraction']=function(_0x293913){var _0x35900c=this;return new Promise(function(_0x417f78,_0x4c1f18){return db['SmsInteraction'][_0x5379('0x1b')](_0x293913[_0x5379('0x1c')],{'raw':_0x293913[_0x5379('0x1d')]?_0x293913[_0x5379('0x1d')][_0x5379('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x293913[_0x5379('0x1d')]?_0x293913['options'][_0x5379('0x1f')]||null:null,'attributes':_0x293913[_0x5379('0x1d')]?_0x293913[_0x5379('0x1d')][_0x5379('0x20')]||null:null,'limit':_0x293913[_0x5379('0x1d')]?_0x293913[_0x5379('0x1d')][_0x5379('0x21')]||null:null})[_0x5379('0xf')](function(_0x2c3faa){logger['info']('UpdateSmsInteraction',_0x293913);logger[_0x5379('0x13')](_0x5379('0x22'),_0x293913,JSON[_0x5379('0x15')](_0x2c3faa));_0x417f78(_0x2c3faa);})[_0x5379('0x1a')](function(_0x59052f){logger[_0x5379('0x16')]('UpdateSmsInteraction',_0x59052f[_0x5379('0x18')],_0x293913);_0x4c1f18(_0x35900c[_0x5379('0x16')](0x1f4,_0x59052f[_0x5379('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x53102e){return new Promise(function(_0xd7be5e,_0x5148c9){return db[_0x5379('0x23')][_0x5379('0x24')]({'where':_0x53102e[_0x5379('0x1d')]?_0x53102e[_0x5379('0x1d')][_0x5379('0x1f')]||null:null})[_0x5379('0xf')](function(_0x2dbd0a){if(_0x2dbd0a){return _0x2dbd0a[_0x5379('0x25')](_0x53102e[_0x5379('0x1c')][_0x5379('0x26')],_[_0x5379('0x27')](_0x53102e[_0x5379('0x1c')],[_0x5379('0x26'),'id'])||{});}})[_0x5379('0x28')](function(_0x596afc){logger[_0x5379('0x10')](_0x5379('0x29'),_0x53102e);logger[_0x5379('0x13')]('AddTags',_0x53102e,JSON[_0x5379('0x15')](_0x596afc));_0xd7be5e(_0x596afc);})[_0x5379('0x1a')](function(_0x55163b){logger[_0x5379('0x16')]('AddTags',_0x55163b[_0x5379('0x18')],_0x53102e);_0x5148c9(_this[_0x5379('0x16')](0x1f4,_0x55163b[_0x5379('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1055e2e..ee9919e 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 _0x558e=['./smsInteraction.events','save','remove','update','emit','register','smsInteraction:'];(function(_0x3540f7,_0x24916e){var _0x4da083=function(_0xdebb83){while(--_0xdebb83){_0x3540f7['push'](_0x3540f7['shift']());}};_0x4da083(++_0x24916e);}(_0x558e,0x69));var _0xe558=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0x558e[_0x764874];return _0x29f9d5;};'use strict';var SmsInteractionEvents=require(_0xe558('0x0'));var events=[_0xe558('0x1'),_0xe558('0x2'),_0xe558('0x3')];function createListener(_0x350680,_0x1114f9){return function(_0x166232){_0x1114f9[_0xe558('0x4')](_0x350680,_0x166232);};}function removeListener(_0x1a6d99,_0x3fc144){return function(){SmsInteractionEvents['removeListener'](_0x1a6d99,_0x3fc144);};}exports[_0xe558('0x5')]=function(_0x30ea91){for(var _0xa0cd79=0x0,_0x3f444b=events['length'];_0xa0cd79<_0x3f444b;_0xa0cd79++){var _0x42541a=events[_0xa0cd79];var _0x18f7bc=createListener(_0xe558('0x6')+_0x42541a,_0x30ea91);SmsInteractionEvents['on'](_0x42541a,_0x18f7bc);}}; \ No newline at end of file +var _0xcbb8=['./smsInteraction.events','save','remove','emit','removeListener','register','length','smsInteraction:'];(function(_0x43187f,_0x34a056){var _0x59eafe=function(_0x4e825b){while(--_0x4e825b){_0x43187f['push'](_0x43187f['shift']());}};_0x59eafe(++_0x34a056);}(_0xcbb8,0x70));var _0x8cbb=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xcbb8[_0x40ac5e];return _0x2839d6;};'use strict';var SmsInteractionEvents=require(_0x8cbb('0x0'));var events=[_0x8cbb('0x1'),_0x8cbb('0x2'),'update'];function createListener(_0x498b8e,_0x232c1c){return function(_0x6120ef){_0x232c1c[_0x8cbb('0x3')](_0x498b8e,_0x6120ef);};}function removeListener(_0x3d1bde,_0x21acff){return function(){SmsInteractionEvents[_0x8cbb('0x4')](_0x3d1bde,_0x21acff);};}exports[_0x8cbb('0x5')]=function(_0x49c91d){for(var _0x3d996b=0x0,_0x46b811=events[_0x8cbb('0x6')];_0x3d996b<_0x46b811;_0x3d996b++){var _0x26bf6d=events[_0x3d996b];var _0x3d65d5=createListener(_0x8cbb('0x7')+_0x26bf6d,_0x49c91d);SmsInteractionEvents['on'](_0x26bf6d,_0x3d65d5);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 3d76cf4..498ff71 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 _0x4f8f=['isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','./smsMessage.controller'];(function(_0x36615c,_0x126c0b){var _0x5a5bc3=function(_0x471406){while(--_0x471406){_0x36615c['push'](_0x36615c['shift']());}};_0x5a5bc3(++_0x126c0b);}(_0x4f8f,0x175));var _0xf4f8=function(_0x5ebd40,_0x10609d){_0x5ebd40=_0x5ebd40-0x0;var _0x4a4294=_0x4f8f[_0x5ebd40];return _0x4a4294;};'use strict';var multer=require('multer');var util=require(_0xf4f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4f8('0x1'));var router=express['Router']();var fs_extra=require(_0xf4f8('0x2'));var auth=require(_0xf4f8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf4f8('0x4'));router['get']('/',auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x6')]);router[_0xf4f8('0x7')](_0xf4f8('0x8'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x9')]);router['get'](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0xb')]);router[_0xf4f8('0xc')]('/',auth[_0xf4f8('0x5')](),interaction[_0xf4f8('0xd')](_0xf4f8('0xe'),_0xf4f8('0xf')),controller[_0xf4f8('0x10')]);router[_0xf4f8('0xc')]('/:id/status',controller[_0xf4f8('0x11')]);router[_0xf4f8('0x12')](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x13')]);router[_0xf4f8('0x12')](_0xf4f8('0x14'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x15')]);router[_0xf4f8('0x12')](_0xf4f8('0x16'),auth['isAuthenticated'](),controller[_0xf4f8('0x17')]);router[_0xf4f8('0x18')](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x19')]);module[_0xf4f8('0x1a')]=router; \ No newline at end of file +var _0xa7ef=['./smsMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa7ef,0x70));var _0xfa7e=function(_0x1e929f,_0x3773e1){_0x1e929f=_0x1e929f-0x0;var _0x47f131=_0xa7ef[_0x1e929f];return _0x47f131;};'use strict';var multer=require(_0xfa7e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa7e('0x1'));var express=require(_0xfa7e('0x2'));var router=express[_0xfa7e('0x3')]();var fs_extra=require(_0xfa7e('0x4'));var auth=require(_0xfa7e('0x5'));var interaction=require(_0xfa7e('0x6'));var config=require(_0xfa7e('0x7'));var controller=require(_0xfa7e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa7e('0x9')]);router[_0xfa7e('0xa')](_0xfa7e('0xb'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0xd')]);router[_0xfa7e('0xa')](_0xfa7e('0xe'),auth['isAuthenticated'](),controller[_0xfa7e('0xf')]);router[_0xfa7e('0x10')]('/',auth[_0xfa7e('0xc')](),interaction['tracked'](_0xfa7e('0x11'),_0xfa7e('0x12')),controller[_0xfa7e('0x13')]);router[_0xfa7e('0x10')](_0xfa7e('0x14'),controller[_0xfa7e('0x15')]);router['put'](_0xfa7e('0xe'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x16')]);router[_0xfa7e('0x17')](_0xfa7e('0x18'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x19')]);router[_0xfa7e('0x17')](_0xfa7e('0x1a'),auth[_0xfa7e('0xc')](),controller[_0xfa7e('0x1b')]);router[_0xfa7e('0x1c')]('/:id',auth[_0xfa7e('0xc')](),controller['destroy']);module[_0xfa7e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e15cb33..8d9cfdf 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 _0x181d=['DATE','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x23d241,_0x9f5d38){var _0x21a740=function(_0x31c6fe){while(--_0x31c6fe){_0x23d241['push'](_0x23d241['shift']());}};_0x21a740(++_0x9f5d38);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd181('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd181('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd181('0x2')]('in',_0xd181('0x3')),'defaultValue':_0xd181('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd181('0x4')]},'readAt':{'type':Sequelize[_0xd181('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd181('0x0')]}}; \ No newline at end of file +var _0x853c=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x5c2d75,_0x4035fc){var _0x48f399=function(_0x576db0){while(--_0x576db0){_0x5c2d75['push'](_0x5c2d75['shift']());}};_0x48f399(++_0x4035fc);}(_0x853c,0x1a1));var _0xc853=function(_0x5b0369,_0x16e522){_0x5b0369=_0x5b0369-0x0;var _0x4c1547=_0x853c[_0x5b0369];return _0x4c1547;};'use strict';var Sequelize=require(_0xc853('0x0'));module['exports']={'body':{'type':Sequelize[_0xc853('0x1')](_0xc853('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc853('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc853('0x4')]('in',_0xc853('0x5')),'defaultValue':_0xc853('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc853('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc853('0x6')]},'readAt':{'type':Sequelize[_0xc853('0x7')]},'secret':{'type':Sequelize[_0xc853('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc853('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 19a0a4c..89047d3 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 _0xeaab=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','SmsMessage','findAll','rows','catch','show','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','User','internal','interface','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','plivio','infobip','results','groupName','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xeaab,0xd9));var _0xbeaa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeaab[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xbeaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbeaa('0x1'));var jsonpatch=require(_0xbeaa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeaa('0x3'));var Mustache=require(_0xbeaa('0x4'));var util=require(_0xbeaa('0x5'));var path=require(_0xbeaa('0x6'));var sox=require(_0xbeaa('0x7'));var csv=require(_0xbeaa('0x8'));var ejs=require(_0xbeaa('0x9'));var fs=require('fs');var fs_extra=require(_0xbeaa('0xa'));var _=require(_0xbeaa('0xb'));var squel=require(_0xbeaa('0xc'));var crypto=require(_0xbeaa('0xd'));var jsforce=require(_0xbeaa('0xe'));var deskjs=require(_0xbeaa('0xf'));var toCsv=require(_0xbeaa('0x8'));var querystring=require('querystring');var Papa=require(_0xbeaa('0x10'));var Redis=require(_0xbeaa('0x11'));var authService=require(_0xbeaa('0x12'));var qs=require(_0xbeaa('0x13'));var as=require(_0xbeaa('0x14'));var hardwareService=require(_0xbeaa('0x15'));var logger=require(_0xbeaa('0x16'))('api');var utils=require(_0xbeaa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbeaa('0x18'));var db=require(_0xbeaa('0x19'))['db'];config['redis']=_[_0xbeaa('0x1a')](config['redis'],{'host':_0xbeaa('0x1b'),'port':0x18eb});var socket=require(_0xbeaa('0x1c'))(new Redis(config['redis']));require(_0xbeaa('0x1d'))[_0xbeaa('0x1e')](socket);var jayson=require(_0xbeaa('0x1f'));var client=jayson[_0xbeaa('0x20')][_0xbeaa('0x21')]({'port':0x232c});var client9002=jayson[_0xbeaa('0x20')][_0xbeaa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1cebef,_0x2ab806,_0x34271a,_0x1b28a5){return new BPromise(function(_0x1cc387,_0x24c1ce){var _0x2ae656=_0x1b28a5||client;return _0x2ae656[_0xbeaa('0x22')](_0x1cebef,_0x34271a)[_0xbeaa('0x23')](function(_0x2a72ef){logger[_0xbeaa('0x24')](_0xbeaa('0x25'),_0x2ab806,_0xbeaa('0x26'));logger[_0xbeaa('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ab806,_0xbeaa('0x26'),JSON[_0xbeaa('0x28')](_0x2a72ef));if(_0x2a72ef[_0xbeaa('0x29')]){if(_0x2a72ef['error'][_0xbeaa('0x2a')]===0x1f4){logger[_0xbeaa('0x29')](_0xbeaa('0x25'),_0x2ab806,_0x2a72ef[_0xbeaa('0x29')][_0xbeaa('0x2b')]);return _0x24c1ce(_0x2a72ef[_0xbeaa('0x29')][_0xbeaa('0x2b')]);}logger['error'](_0xbeaa('0x25'),_0x2ab806,_0x2a72ef[_0xbeaa('0x29')]['message']);return _0x1cc387(_0x2a72ef['error']['message']);}else{logger[_0xbeaa('0x24')](_0xbeaa('0x25'),_0x2ab806,_0xbeaa('0x26'));_0x1cc387(_0x2a72ef[_0xbeaa('0x2c')]['message']);}})['catch'](function(_0x53b066){logger[_0xbeaa('0x29')](_0xbeaa('0x25'),_0x2ab806,_0x53b066);_0x24c1ce(_0x53b066);});});}function respondWithStatusCode(_0x63d68b,_0xa9a88e){_0xa9a88e=_0xa9a88e||0xcc;return function(_0x41661b){if(_0x41661b){return _0x63d68b['sendStatus'](_0xa9a88e);}return _0x63d68b[_0xbeaa('0x2d')](_0xa9a88e)[_0xbeaa('0x2e')]();};}function respondWithResult(_0x2ee10e,_0x583be5){_0x583be5=_0x583be5||0xc8;return function(_0x2f509e){if(_0x2f509e){return _0x2ee10e[_0xbeaa('0x2d')](_0x583be5)[_0xbeaa('0x2f')](_0x2f509e);}};}function respondWithFilteredResult(_0x52edbc,_0x1d84cd){return function(_0x578e92){if(_0x578e92){var _0x13d8b7=typeof _0x1d84cd[_0xbeaa('0x30')]===_0xbeaa('0x31')&&typeof _0x1d84cd[_0xbeaa('0x32')]===_0xbeaa('0x31');var _0x52e876=_0x578e92[_0xbeaa('0x33')];var _0x1126b3=_0x13d8b7?0x0:_0x1d84cd['offset'];var _0x31afc9=_0x13d8b7?_0x578e92[_0xbeaa('0x33')]:_0x1d84cd['offset']+_0x1d84cd[_0xbeaa('0x32')];var _0x5af042;if(_0x31afc9>=_0x52e876){_0x31afc9=_0x52e876;_0x5af042=0xc8;}else{_0x5af042=0xce;}_0x52edbc['status'](_0x5af042);return _0x52edbc['set'](_0xbeaa('0x34'),_0x1126b3+'-'+_0x31afc9+'/'+_0x52e876)[_0xbeaa('0x2f')](_0x578e92);}return null;};}function patchUpdates(_0x3f5516){return function(_0x4b9c55){try{jsonpatch[_0xbeaa('0x35')](_0x4b9c55,_0x3f5516,!![]);}catch(_0xc76552){return BPromise[_0xbeaa('0x36')](_0xc76552);}return _0x4b9c55[_0xbeaa('0x37')]();};}function saveUpdates(_0x5d064e,_0x208a38){return function(_0x40b2eb){if(_0x40b2eb){return _0x40b2eb[_0xbeaa('0x38')](_0x5d064e)[_0xbeaa('0x23')](function(_0x73d452){return _0x73d452;});}return null;};}function removeEntity(_0x44b2a8,_0x462cb0){return function(_0x363531){if(_0x363531){return _0x363531[_0xbeaa('0x39')]()['then'](function(){_0x44b2a8[_0xbeaa('0x2d')](0xcc)[_0xbeaa('0x2e')]();});}};}function handleEntityNotFound(_0x5c7734,_0x586bf4){return function(_0x460a83){if(!_0x460a83){_0x5c7734[_0xbeaa('0x3a')](0x194);}return _0x460a83;};}function handleError(_0x4f3548,_0x345a48){_0x345a48=_0x345a48||0x1f4;return function(_0x7f4c43){logger[_0xbeaa('0x29')](_0x7f4c43['stack']);if(_0x7f4c43[_0xbeaa('0x3b')]){delete _0x7f4c43[_0xbeaa('0x3b')];}_0x4f3548[_0xbeaa('0x2d')](_0x345a48)[_0xbeaa('0x3c')](_0x7f4c43);};}exports['index']=function(_0x57e667,_0x526420){var _0x52cb5c={},_0x318b54={},_0x4d3b5b={'count':0x0,'rows':[]};var _0xc00b9f=_[_0xbeaa('0x3d')](db['SmsMessage'][_0xbeaa('0x3e')],function(_0x78c4ff){return{'name':_0x78c4ff['fieldName'],'type':_0x78c4ff[_0xbeaa('0x3f')]['key']};});_0x318b54[_0xbeaa('0x40')]=_[_0xbeaa('0x3d')](_0xc00b9f,_0xbeaa('0x3b'));_0x318b54[_0xbeaa('0x41')]=_[_0xbeaa('0x42')](_0x57e667[_0xbeaa('0x41')]);_0x318b54['filters']=_[_0xbeaa('0x43')](_0x318b54[_0xbeaa('0x40')],_0x318b54[_0xbeaa('0x41')]);_0x52cb5c[_0xbeaa('0x44')]=_[_0xbeaa('0x43')](_0x318b54['model'],qs[_0xbeaa('0x45')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x45')]));_0x52cb5c['attributes']=_0x52cb5c['attributes'][_0xbeaa('0x46')]?_0x52cb5c[_0xbeaa('0x44')]:_0x318b54[_0xbeaa('0x40')];if(!_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x47')](_0xbeaa('0x48'))){_0x52cb5c[_0xbeaa('0x32')]=qs[_0xbeaa('0x32')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x32')]);_0x52cb5c['offset']=qs[_0xbeaa('0x30')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x30')]);}_0x52cb5c['order']=qs[_0xbeaa('0x49')](_0x57e667['query'][_0xbeaa('0x49')]);_0x52cb5c[_0xbeaa('0x4a')]=qs[_0xbeaa('0x4b')](_[_0xbeaa('0x4c')](_0x57e667[_0xbeaa('0x41')],_0x318b54[_0xbeaa('0x4b')]),_0xc00b9f);if(_0x57e667['query'][_0xbeaa('0x4d')]){_0x52cb5c['where']=_[_0xbeaa('0x4e')](_0x52cb5c[_0xbeaa('0x4a')],{'$or':_[_0xbeaa('0x3d')](_0xc00b9f,function(_0x5000b1){if(_0x5000b1[_0xbeaa('0x3f')]!==_0xbeaa('0x4f')){var _0x487746={};_0x487746[_0x5000b1[_0xbeaa('0x3b')]]={'$like':'%'+_0x57e667[_0xbeaa('0x41')]['filter']+'%'};return _0x487746;}})});}_0x52cb5c=_[_0xbeaa('0x4e')]({},_0x52cb5c,_0x57e667[_0xbeaa('0x50')]);var _0x5962f9={'where':_0x52cb5c['where']};return db['SmsMessage'][_0xbeaa('0x33')](_0x5962f9)[_0xbeaa('0x23')](function(_0x1e9296){_0x4d3b5b[_0xbeaa('0x33')]=_0x1e9296;if(_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x51')]){_0x52cb5c[_0xbeaa('0x52')]=[{'all':!![]}];}return db[_0xbeaa('0x53')][_0xbeaa('0x54')](_0x52cb5c);})[_0xbeaa('0x23')](function(_0x350400){_0x4d3b5b[_0xbeaa('0x55')]=_0x350400;return _0x4d3b5b;})[_0xbeaa('0x23')](respondWithFilteredResult(_0x526420,_0x52cb5c))[_0xbeaa('0x56')](handleError(_0x526420,null));};exports[_0xbeaa('0x57')]=function(_0x59be64,_0x33fcbb){var _0x5a97de={'raw':!![],'where':{'id':_0x59be64['params']['id']}},_0x42e46b={};_0x42e46b['model']=_[_0xbeaa('0x42')](db[_0xbeaa('0x53')][_0xbeaa('0x3e')]);_0x42e46b[_0xbeaa('0x41')]=_['keys'](_0x59be64[_0xbeaa('0x41')]);_0x42e46b[_0xbeaa('0x4b')]=_[_0xbeaa('0x43')](_0x42e46b[_0xbeaa('0x40')],_0x42e46b['query']);_0x5a97de[_0xbeaa('0x44')]=_['intersection'](_0x42e46b[_0xbeaa('0x40')],qs[_0xbeaa('0x45')](_0x59be64[_0xbeaa('0x41')][_0xbeaa('0x45')]));_0x5a97de['attributes']=_0x5a97de['attributes']['length']?_0x5a97de['attributes']:_0x42e46b[_0xbeaa('0x40')];if(_0x59be64[_0xbeaa('0x41')][_0xbeaa('0x51')]){_0x5a97de[_0xbeaa('0x52')]=[{'all':!![]}];}_0x5a97de=_[_0xbeaa('0x4e')]({},_0x5a97de,_0x59be64[_0xbeaa('0x50')]);return db[_0xbeaa('0x53')][_0xbeaa('0x58')](_0x5a97de)[_0xbeaa('0x23')](handleEntityNotFound(_0x33fcbb,null))[_0xbeaa('0x23')](respondWithResult(_0x33fcbb,null))[_0xbeaa('0x56')](handleError(_0x33fcbb,null));};exports[_0xbeaa('0x59')]=function(_0x4187b5,_0x47579a){return db[_0xbeaa('0x53')]['create'](_0x4187b5['body'],{})['then'](respondWithResult(_0x47579a,0xc9))[_0xbeaa('0x56')](handleError(_0x47579a,null));};exports[_0xbeaa('0x38')]=function(_0x5f0582,_0x96862e){if(_0x5f0582['body']['id']){delete _0x5f0582[_0xbeaa('0x5a')]['id'];}return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x5f0582['params']['id']}})['then'](handleEntityNotFound(_0x96862e,null))[_0xbeaa('0x23')](saveUpdates(_0x5f0582[_0xbeaa('0x5a')],null))[_0xbeaa('0x23')](respondWithResult(_0x96862e,null))[_0xbeaa('0x56')](handleError(_0x96862e,null));};exports['destroy']=function(_0x83011,_0x281ab6){return db['SmsMessage'][_0xbeaa('0x58')]({'where':{'id':_0x83011[_0xbeaa('0x5b')]['id']}})[_0xbeaa('0x23')](handleEntityNotFound(_0x281ab6,null))['then'](removeEntity(_0x281ab6,null))['catch'](handleError(_0x281ab6,null));};exports[_0xbeaa('0x5c')]=function(_0x544ae3,_0x28ad74){return db[_0xbeaa('0x53')]['describe']()[_0xbeaa('0x23')](respondWithResult(_0x28ad74,null))[_0xbeaa('0x56')](handleError(_0x28ad74,null));};var interaction_log=require(_0xbeaa('0x16'))(_0xbeaa('0x5d'));exports[_0xbeaa('0x5e')]=function(_0x18cea0,_0x586f0d,_0x49210d){var _0x1cf119={'agent':{},'channel':_0xbeaa('0x5f')};if(_0x18cea0[_0xbeaa('0x5a')]['id']){delete _0x18cea0[_0xbeaa('0x5a')]['id'];}_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x60')]=!![];_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x61')]=moment()[_0xbeaa('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')]=_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')]||_0x18cea0[_0xbeaa('0x64')]['id'];_0x1cf119[_0xbeaa('0x65')]['id']=_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')];return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x18cea0[_0xbeaa('0x5b')]['id'],'UserId':null}})[_0xbeaa('0x23')](handleEntityNotFound(_0x586f0d,null))[_0xbeaa('0x23')](saveUpdates(_0x18cea0[_0xbeaa('0x5a')],null))[_0xbeaa('0x23')](function(_0x4a92b7){if(_0x4a92b7){_0x1cf119[_0xbeaa('0x2b')]=_0x4a92b7[_0xbeaa('0x66')]({'plain':!![]});return db[_0xbeaa('0x67')][_0xbeaa('0x58')]({'where':{'id':_0x4a92b7['SmsInteractionId']}});}return null;})[_0xbeaa('0x23')](handleEntityNotFound(_0x586f0d,null))[_0xbeaa('0x23')](function(_0xfdb0f){if(_0xfdb0f){return _0xfdb0f['update']({'UserId':_0x18cea0['body'][_0xbeaa('0x63')],'read1stAt':_['isNil'](_0xfdb0f[_0xbeaa('0x68')])?moment()[_0xbeaa('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbeaa('0x23')](function(_0x3e8b2f){if(_0x3e8b2f){_0x1cf119[_0xbeaa('0x69')]=_0x3e8b2f[_0xbeaa('0x66')]({'plain':!![]});interaction_log[_0xbeaa('0x24')](_0xbeaa('0x6a'),_0x18cea0['user']['id'],_0x18cea0[_0xbeaa('0x64')][_0xbeaa('0x3b')],_0x18cea0[_0xbeaa('0x64')]['role'],_0x1cf119[_0xbeaa('0x69')]['id'],_0x18cea0[_0xbeaa('0x5a')]?JSON[_0xbeaa('0x28')](_0x18cea0[_0xbeaa('0x5a')]):_0xbeaa('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xbeaa('0x6c'),_0x1cf119);}return null;})[_0xbeaa('0x23')](function(_0x247196){var _0x268d90=_0xbeaa('0x6d')+_0x247196[_0xbeaa('0x2b')][_0xbeaa('0x6e')];return db[_0xbeaa('0x6f')][_0xbeaa('0x41')](_0x268d90,{'type':db[_0xbeaa('0x70')][_0xbeaa('0x71')][_0xbeaa('0x72')],'raw':!![]})['then'](function(_0x50472b){return _0x50472b;});})[_0xbeaa('0x23')](function(_0x1b5464){if(_0x1b5464){_0x1cf119['message'][_0xbeaa('0x73')]=_0x1b5464[0x0];if(!_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')])return;return db['User'][_0xbeaa('0x58')]({'where':{'id':_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')],'role':_0xbeaa('0x65')},'attributes':['id',_0xbeaa('0x3b'),_0xbeaa('0x74'),_0xbeaa('0x75'),'internal'],'raw':!![]});}return null;})[_0xbeaa('0x23')](function(_0x5be94c){if(!_0x5be94c)return null;_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x65')]=_0x5be94c;return _0x1cf119;})[_0xbeaa('0x23')](function(_0x555a29){if(_0x555a29){if(_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x76')]){_0x1cf119['message']['interface']=util['format'](_0xbeaa('0x77'),_0x18cea0[_0xbeaa('0x64')][_0xbeaa('0x3b')]);_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x78')]=_0x1cf119[_0xbeaa('0x78')];_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x79')]=_0x1cf119['channel'];_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x7a')]=_0xbeaa('0x5e');return respondWithRpcPromise(_0xbeaa('0x7b'),_0xbeaa('0x7b'),{'event':_0xbeaa('0x7c'),'message':_0x1cf119['message']},client9002)[_0xbeaa('0x23')](function(){return _0x1cf119;});}return _0x1cf119;}return null;})['then'](respondWithResult(_0x586f0d,null))['catch'](handleError(_0x586f0d,null));};var interaction_log=require(_0xbeaa('0x16'))(_0xbeaa('0x5d'));exports['reject']=function(_0x57636c,_0x297239,_0x369f92){var _0x351074={'agent':{},'channel':_0xbeaa('0x5f')};if(_0x57636c[_0xbeaa('0x5a')]['id']){delete _0x57636c[_0xbeaa('0x5a')]['id'];}_0x57636c['body']['UserId']=_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')]||_0x57636c[_0xbeaa('0x64')]['id'];_0x351074[_0xbeaa('0x65')]['id']=_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')];return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x57636c[_0xbeaa('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x297239,null))[_0xbeaa('0x23')](function(_0x22e6d4){if(_0x22e6d4){_0x351074[_0xbeaa('0x2b')]=_0x22e6d4[_0xbeaa('0x66')]({'plain':!![]});return db[_0xbeaa('0x67')][_0xbeaa('0x58')]({'where':{'id':_0x22e6d4['SmsInteractionId']}});}return null;})[_0xbeaa('0x23')](handleEntityNotFound(_0x297239,null))['then'](function(_0x362986){if(_0x362986){_0x351074[_0xbeaa('0x69')]=_0x362986[_0xbeaa('0x66')]({'plain':!![]});interaction_log[_0xbeaa('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57636c[_0xbeaa('0x64')]['id'],_0x57636c[_0xbeaa('0x64')][_0xbeaa('0x3b')],_0x57636c[_0xbeaa('0x64')]['role'],_0x351074['interaction']['id'],_0x57636c[_0xbeaa('0x5a')]?JSON[_0xbeaa('0x28')](_0x57636c['body']):_0xbeaa('0x6b'));return respondWithRpcPromise(_0xbeaa('0x7d'),'rejectMessage',_0x351074);}return null;})[_0xbeaa('0x23')](function(_0x5ab02d){var _0x3903e3=_0xbeaa('0x6d')+_0x5ab02d[_0xbeaa('0x2b')][_0xbeaa('0x6e')];return db['sequelize'][_0xbeaa('0x41')](_0x3903e3,{'type':db[_0xbeaa('0x70')][_0xbeaa('0x71')][_0xbeaa('0x72')],'raw':!![]})[_0xbeaa('0x23')](function(_0x35a36b){return _0x35a36b;});})[_0xbeaa('0x23')](function(_0x46da7a){if(_0x46da7a){_0x351074[_0xbeaa('0x2b')]['contact']=_0x46da7a[0x0];if(!_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')])return;return db[_0xbeaa('0x7e')][_0xbeaa('0x58')]({'where':{'id':_0x57636c[_0xbeaa('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xbeaa('0x3b'),_0xbeaa('0x74'),_0xbeaa('0x75'),_0xbeaa('0x7f')],'raw':!![]});}return null;})['then'](function(_0x367859){if(!_0x367859)return null;_0x351074['message'][_0xbeaa('0x65')]=_0x367859;return _0x351074;})[_0xbeaa('0x23')](function(_0xe192f){if(_0xe192f){_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x80')]=util[_0xbeaa('0x62')](_0xbeaa('0x77'),_0x57636c[_0xbeaa('0x64')][_0xbeaa('0x3b')]);_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x78')]=_0x351074[_0xbeaa('0x78')];_0xe192f['message']['motionChannel']=_0x351074[_0xbeaa('0x78')];_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x7a')]='reject';respondWithRpcPromise(_0xbeaa('0x7b'),_0xbeaa('0x7b'),{'event':_0xbeaa('0x81'),'message':_0xe192f[_0xbeaa('0x2b')]},client9002);return _0x351074;}return null;})[_0xbeaa('0x23')](respondWithResult(_0x297239,null))[_0xbeaa('0x56')](handleError(_0x297239,null));};exports[_0xbeaa('0x2d')]=function(_0x41e585,_0x326e54,_0x2ae223){if(_0x41e585[_0xbeaa('0x5a')]['id']){delete _0x41e585[_0xbeaa('0x5a')]['id'];}var _0xe8c7fe;return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x41e585[_0xbeaa('0x5b')]['id']}})[_0xbeaa('0x23')](handleEntityNotFound(_0x326e54,null))[_0xbeaa('0x23')](function(_0x339406){if(_0x339406){_0xe8c7fe=_0x339406;return db['SmsAccount'][_0xbeaa('0x58')]({'where':{'id':_0x339406[_0xbeaa('0x82')]}});}})[_0xbeaa('0x23')](handleEntityNotFound(_0x326e54,null))[_0xbeaa('0x23')](function(_0x36e169){if(_0x36e169){logger[_0xbeaa('0x27')](_0xbeaa('0x83'),_0xbeaa('0x2d'),_0xbeaa('0x84'),_0x36e169[_0xbeaa('0x3f')],util[_0xbeaa('0x85')](_0x41e585['body'],{'showHidden':![],'depth':null}));switch(_0x36e169[_0xbeaa('0x3f')]){case _0xbeaa('0x86'):if(_0x41e585[_0xbeaa('0x5a')]['MessageSid']&&_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x87')]===_0xe8c7fe[_0xbeaa('0x88')]){return _0xe8c7fe[_0xbeaa('0x38')]({'read':!![]});}else{logger[_0xbeaa('0x29')](_0xbeaa('0x89'),_0xbeaa('0x2d'),_0xbeaa('0x86'),util[_0xbeaa('0x85')](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xbeaa('0x8a'):if(_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x8b')]&&_0x41e585[_0xbeaa('0x5a')]['MessageUUID']===_0xe8c7fe['messageId']&&_['indexOf']([_0xbeaa('0x8c'),_0xbeaa('0x8d')],_0x41e585[_0xbeaa('0x5a')]['Status'])>=0x0){return _0xe8c7fe[_0xbeaa('0x38')]({'read':!![]});}else{logger['error'](_0xbeaa('0x89'),_0xbeaa('0x2d'),_0xbeaa('0x8e'),util['inspect'](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xbeaa('0x8f'):var _0xb4badd=_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x90')][0x0];if(_0xb4badd[_0xbeaa('0x2d')][_0xbeaa('0x91')]==='DELIVERED'){return _0xe8c7fe['update']({'read':!![]});}else{logger['error'](_0xbeaa('0x89'),_0xbeaa('0x2d'),'infobip',util[_0xbeaa('0x85')](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xe8c7fe;}})['then'](respondWithResult(_0x326e54,null))[_0xbeaa('0x56')](handleError(_0x326e54,null));}; \ No newline at end of file +var _0xfaf0=['catch','status','json','undefined','limit','count','offset','Content-Range','save','update','end','sendStatus','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','params','destroy','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','sequelize','SELECT','User','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','results','groupName','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x133015,_0x3f4b03){var _0x29aa33=function(_0x7bbb98){while(--_0x7bbb98){_0x133015['push'](_0x133015['shift']());}};_0x29aa33(++_0x3f4b03);}(_0xfaf0,0x6a));var _0x0faf=function(_0x1121c0,_0x565205){_0x1121c0=_0x1121c0-0x0;var _0x10225c=_0xfaf0[_0x1121c0];return _0x10225c;};'use strict';var emlformat=require(_0x0faf('0x0'));var rimraf=require(_0x0faf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0faf('0x2'));var rp=require(_0x0faf('0x3'));var moment=require('moment');var BPromise=require(_0x0faf('0x4'));var Mustache=require(_0x0faf('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0faf('0x6'));var csv=require('to-csv');var ejs=require(_0x0faf('0x7'));var fs=require('fs');var fs_extra=require(_0x0faf('0x8'));var _=require(_0x0faf('0x9'));var squel=require(_0x0faf('0xa'));var crypto=require('crypto');var jsforce=require(_0x0faf('0xb'));var deskjs=require(_0x0faf('0xc'));var toCsv=require(_0x0faf('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0faf('0xe'));var authService=require(_0x0faf('0xf'));var qs=require(_0x0faf('0x10'));var as=require(_0x0faf('0x11'));var hardwareService=require(_0x0faf('0x12'));var logger=require(_0x0faf('0x13'))('api');var utils=require(_0x0faf('0x14'));var config=require(_0x0faf('0x15'));var licenseUtil=require(_0x0faf('0x16'));var db=require('../../mysqldb')['db'];config[_0x0faf('0x17')]=_['defaults'](config[_0x0faf('0x17')],{'host':_0x0faf('0x18'),'port':0x18eb});var socket=require(_0x0faf('0x19'))(new Redis(config[_0x0faf('0x17')]));require(_0x0faf('0x1a'))[_0x0faf('0x1b')](socket);var jayson=require(_0x0faf('0x1c'));var client=jayson[_0x0faf('0x1d')][_0x0faf('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x0faf('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3afd74,_0x2183ad,_0x124966,_0xaf636){return new BPromise(function(_0x44151b,_0x5ea067){var _0x2bd51f=_0xaf636||client;return _0x2bd51f['request'](_0x3afd74,_0x124966)[_0x0faf('0x1f')](function(_0x53c799){logger[_0x0faf('0x20')](_0x0faf('0x21'),_0x2183ad,_0x0faf('0x22'));logger[_0x0faf('0x23')](_0x0faf('0x24'),_0x2183ad,_0x0faf('0x22'),JSON[_0x0faf('0x25')](_0x53c799));if(_0x53c799[_0x0faf('0x26')]){if(_0x53c799[_0x0faf('0x26')][_0x0faf('0x27')]===0x1f4){logger[_0x0faf('0x26')](_0x0faf('0x21'),_0x2183ad,_0x53c799['error']['message']);return _0x5ea067(_0x53c799[_0x0faf('0x26')][_0x0faf('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x2183ad,_0x53c799[_0x0faf('0x26')][_0x0faf('0x28')]);return _0x44151b(_0x53c799['error'][_0x0faf('0x28')]);}else{logger[_0x0faf('0x20')](_0x0faf('0x21'),_0x2183ad,_0x0faf('0x22'));_0x44151b(_0x53c799[_0x0faf('0x29')][_0x0faf('0x28')]);}})[_0x0faf('0x2a')](function(_0x37de2d){logger[_0x0faf('0x26')](_0x0faf('0x21'),_0x2183ad,_0x37de2d);_0x5ea067(_0x37de2d);});});}function respondWithStatusCode(_0xfe5bc2,_0x1d96b2){_0x1d96b2=_0x1d96b2||0xcc;return function(_0x192061){if(_0x192061){return _0xfe5bc2['sendStatus'](_0x1d96b2);}return _0xfe5bc2['status'](_0x1d96b2)['end']();};}function respondWithResult(_0x5333ff,_0x2a4736){_0x2a4736=_0x2a4736||0xc8;return function(_0x28e5c0){if(_0x28e5c0){return _0x5333ff[_0x0faf('0x2b')](_0x2a4736)[_0x0faf('0x2c')](_0x28e5c0);}};}function respondWithFilteredResult(_0x2aa669,_0x580abf){return function(_0x33f2f7){if(_0x33f2f7){var _0x1ecf39=typeof _0x580abf['offset']===_0x0faf('0x2d')&&typeof _0x580abf[_0x0faf('0x2e')]===_0x0faf('0x2d');var _0x1b8687=_0x33f2f7[_0x0faf('0x2f')];var _0x30244c=_0x1ecf39?0x0:_0x580abf[_0x0faf('0x30')];var _0x208d37=_0x1ecf39?_0x33f2f7[_0x0faf('0x2f')]:_0x580abf[_0x0faf('0x30')]+_0x580abf[_0x0faf('0x2e')];var _0x5f2a0b;if(_0x208d37>=_0x1b8687){_0x208d37=_0x1b8687;_0x5f2a0b=0xc8;}else{_0x5f2a0b=0xce;}_0x2aa669[_0x0faf('0x2b')](_0x5f2a0b);return _0x2aa669['set'](_0x0faf('0x31'),_0x30244c+'-'+_0x208d37+'/'+_0x1b8687)['json'](_0x33f2f7);}return null;};}function patchUpdates(_0x1e933f){return function(_0x34ca10){try{jsonpatch['apply'](_0x34ca10,_0x1e933f,!![]);}catch(_0x3bc0dc){return BPromise['reject'](_0x3bc0dc);}return _0x34ca10[_0x0faf('0x32')]();};}function saveUpdates(_0x580503,_0x553e53){return function(_0x46b53d){if(_0x46b53d){return _0x46b53d[_0x0faf('0x33')](_0x580503)[_0x0faf('0x1f')](function(_0x18a75d){return _0x18a75d;});}return null;};}function removeEntity(_0x10bfaf,_0x5ac121){return function(_0x24b40f){if(_0x24b40f){return _0x24b40f['destroy']()[_0x0faf('0x1f')](function(){_0x10bfaf[_0x0faf('0x2b')](0xcc)[_0x0faf('0x34')]();});}};}function handleEntityNotFound(_0x57c868,_0x195692){return function(_0x4149f2){if(!_0x4149f2){_0x57c868[_0x0faf('0x35')](0x194);}return _0x4149f2;};}function handleError(_0xa972de,_0x3a2a1a){_0x3a2a1a=_0x3a2a1a||0x1f4;return function(_0x5501e8){logger[_0x0faf('0x26')](_0x5501e8[_0x0faf('0x36')]);if(_0x5501e8[_0x0faf('0x37')]){delete _0x5501e8['name'];}_0xa972de[_0x0faf('0x2b')](_0x3a2a1a)[_0x0faf('0x38')](_0x5501e8);};}exports[_0x0faf('0x39')]=function(_0x2da5af,_0x396faa){var _0x8004d7={},_0x2f1f38={},_0x3a9679={'count':0x0,'rows':[]};var _0x50d651=_['map'](db[_0x0faf('0x3a')][_0x0faf('0x3b')],function(_0x75a095){return{'name':_0x75a095[_0x0faf('0x3c')],'type':_0x75a095[_0x0faf('0x3d')][_0x0faf('0x3e')]};});_0x2f1f38[_0x0faf('0x3f')]=_[_0x0faf('0x40')](_0x50d651,'name');_0x2f1f38[_0x0faf('0x41')]=_[_0x0faf('0x42')](_0x2da5af[_0x0faf('0x41')]);_0x2f1f38[_0x0faf('0x43')]=_[_0x0faf('0x44')](_0x2f1f38[_0x0faf('0x3f')],_0x2f1f38[_0x0faf('0x41')]);_0x8004d7[_0x0faf('0x45')]=_[_0x0faf('0x44')](_0x2f1f38['model'],qs[_0x0faf('0x46')](_0x2da5af[_0x0faf('0x41')][_0x0faf('0x46')]));_0x8004d7[_0x0faf('0x45')]=_0x8004d7[_0x0faf('0x45')][_0x0faf('0x47')]?_0x8004d7['attributes']:_0x2f1f38[_0x0faf('0x3f')];if(!_0x2da5af[_0x0faf('0x41')][_0x0faf('0x48')](_0x0faf('0x49'))){_0x8004d7[_0x0faf('0x2e')]=qs[_0x0faf('0x2e')](_0x2da5af[_0x0faf('0x41')][_0x0faf('0x2e')]);_0x8004d7[_0x0faf('0x30')]=qs[_0x0faf('0x30')](_0x2da5af['query'][_0x0faf('0x30')]);}_0x8004d7[_0x0faf('0x4a')]=qs['sort'](_0x2da5af[_0x0faf('0x41')][_0x0faf('0x4b')]);_0x8004d7['where']=qs[_0x0faf('0x43')](_[_0x0faf('0x4c')](_0x2da5af[_0x0faf('0x41')],_0x2f1f38[_0x0faf('0x43')]),_0x50d651);if(_0x2da5af[_0x0faf('0x41')][_0x0faf('0x4d')]){_0x8004d7[_0x0faf('0x4e')]=_[_0x0faf('0x4f')](_0x8004d7[_0x0faf('0x4e')],{'$or':_[_0x0faf('0x40')](_0x50d651,function(_0xa6359f){if(_0xa6359f[_0x0faf('0x3d')]!==_0x0faf('0x50')){var _0x25f4e4={};_0x25f4e4[_0xa6359f[_0x0faf('0x37')]]={'$like':'%'+_0x2da5af['query'][_0x0faf('0x4d')]+'%'};return _0x25f4e4;}})});}_0x8004d7=_[_0x0faf('0x4f')]({},_0x8004d7,_0x2da5af[_0x0faf('0x51')]);var _0x1aadb1={'where':_0x8004d7[_0x0faf('0x4e')]};return db['SmsMessage'][_0x0faf('0x2f')](_0x1aadb1)[_0x0faf('0x1f')](function(_0x2ec296){_0x3a9679['count']=_0x2ec296;if(_0x2da5af[_0x0faf('0x41')]['includeAll']){_0x8004d7[_0x0faf('0x52')]=[{'all':!![]}];}return db[_0x0faf('0x3a')]['findAll'](_0x8004d7);})['then'](function(_0x445713){_0x3a9679[_0x0faf('0x53')]=_0x445713;return _0x3a9679;})[_0x0faf('0x1f')](respondWithFilteredResult(_0x396faa,_0x8004d7))[_0x0faf('0x2a')](handleError(_0x396faa,null));};exports[_0x0faf('0x54')]=function(_0x450582,_0x449725){var _0x2b1307={'raw':!![],'where':{'id':_0x450582['params']['id']}},_0x4bdbe7={};_0x4bdbe7['model']=_[_0x0faf('0x42')](db[_0x0faf('0x3a')][_0x0faf('0x3b')]);_0x4bdbe7['query']=_[_0x0faf('0x42')](_0x450582[_0x0faf('0x41')]);_0x4bdbe7[_0x0faf('0x43')]=_['intersection'](_0x4bdbe7['model'],_0x4bdbe7['query']);_0x2b1307[_0x0faf('0x45')]=_[_0x0faf('0x44')](_0x4bdbe7[_0x0faf('0x3f')],qs[_0x0faf('0x46')](_0x450582[_0x0faf('0x41')][_0x0faf('0x46')]));_0x2b1307['attributes']=_0x2b1307['attributes'][_0x0faf('0x47')]?_0x2b1307[_0x0faf('0x45')]:_0x4bdbe7[_0x0faf('0x3f')];if(_0x450582[_0x0faf('0x41')][_0x0faf('0x55')]){_0x2b1307[_0x0faf('0x52')]=[{'all':!![]}];}_0x2b1307=_[_0x0faf('0x4f')]({},_0x2b1307,_0x450582[_0x0faf('0x51')]);return db[_0x0faf('0x3a')][_0x0faf('0x56')](_0x2b1307)['then'](handleEntityNotFound(_0x449725,null))[_0x0faf('0x1f')](respondWithResult(_0x449725,null))[_0x0faf('0x2a')](handleError(_0x449725,null));};exports[_0x0faf('0x57')]=function(_0x252d96,_0x408ffb){return db['SmsMessage']['create'](_0x252d96[_0x0faf('0x58')],{})[_0x0faf('0x1f')](respondWithResult(_0x408ffb,0xc9))['catch'](handleError(_0x408ffb,null));};exports[_0x0faf('0x33')]=function(_0x182a77,_0x5df42a){if(_0x182a77[_0x0faf('0x58')]['id']){delete _0x182a77[_0x0faf('0x58')]['id'];}return db[_0x0faf('0x3a')]['find']({'where':{'id':_0x182a77[_0x0faf('0x59')]['id']}})[_0x0faf('0x1f')](handleEntityNotFound(_0x5df42a,null))['then'](saveUpdates(_0x182a77[_0x0faf('0x58')],null))['then'](respondWithResult(_0x5df42a,null))[_0x0faf('0x2a')](handleError(_0x5df42a,null));};exports[_0x0faf('0x5a')]=function(_0x50e5e9,_0x160481){return db[_0x0faf('0x3a')]['find']({'where':{'id':_0x50e5e9[_0x0faf('0x59')]['id']}})[_0x0faf('0x1f')](handleEntityNotFound(_0x160481,null))[_0x0faf('0x1f')](removeEntity(_0x160481,null))['catch'](handleError(_0x160481,null));};exports[_0x0faf('0x5b')]=function(_0x5c884e,_0x4723a6){return db[_0x0faf('0x3a')][_0x0faf('0x5b')]()[_0x0faf('0x1f')](respondWithResult(_0x4723a6,null))['catch'](handleError(_0x4723a6,null));};var interaction_log=require('../../config/logger')(_0x0faf('0x5c'));exports[_0x0faf('0x5d')]=function(_0x3285c5,_0x19caa2,_0x1567fa){var _0x8587ab={'agent':{},'channel':_0x0faf('0x5e')};if(_0x3285c5['body']['id']){delete _0x3285c5[_0x0faf('0x58')]['id'];}_0x3285c5[_0x0faf('0x58')][_0x0faf('0x5f')]=!![];_0x3285c5[_0x0faf('0x58')]['readAt']=moment()[_0x0faf('0x60')](_0x0faf('0x61'));_0x3285c5[_0x0faf('0x58')][_0x0faf('0x62')]=_0x3285c5['body'][_0x0faf('0x62')]||_0x3285c5[_0x0faf('0x63')]['id'];_0x8587ab[_0x0faf('0x64')]['id']=_0x3285c5[_0x0faf('0x58')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x3285c5[_0x0faf('0x59')]['id'],'UserId':null}})[_0x0faf('0x1f')](handleEntityNotFound(_0x19caa2,null))['then'](saveUpdates(_0x3285c5[_0x0faf('0x58')],null))[_0x0faf('0x1f')](function(_0x127967){if(_0x127967){_0x8587ab[_0x0faf('0x28')]=_0x127967['get']({'plain':!![]});return db[_0x0faf('0x65')][_0x0faf('0x56')]({'where':{'id':_0x127967['SmsInteractionId']}});}return null;})[_0x0faf('0x1f')](handleEntityNotFound(_0x19caa2,null))[_0x0faf('0x1f')](function(_0x220757){if(_0x220757){return _0x220757[_0x0faf('0x33')]({'UserId':_0x3285c5['body']['UserId'],'read1stAt':_['isNil'](_0x220757[_0x0faf('0x66')])?moment()[_0x0faf('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0faf('0x1f')](function(_0x11e743){if(_0x11e743){_0x8587ab[_0x0faf('0x67')]=_0x11e743[_0x0faf('0x68')]({'plain':!![]});interaction_log[_0x0faf('0x20')](_0x0faf('0x69'),_0x3285c5[_0x0faf('0x63')]['id'],_0x3285c5['user'][_0x0faf('0x37')],_0x3285c5[_0x0faf('0x63')][_0x0faf('0x6a')],_0x8587ab[_0x0faf('0x67')]['id'],_0x3285c5['body']?JSON[_0x0faf('0x25')](_0x3285c5[_0x0faf('0x58')]):'null');return respondWithRpcPromise(_0x0faf('0x6b'),_0x0faf('0x6c'),_0x8587ab);}return null;})['then'](function(_0x950315){var _0x78c53b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x950315[_0x0faf('0x28')][_0x0faf('0x6d')];return db['sequelize']['query'](_0x78c53b,{'type':db[_0x0faf('0x6e')][_0x0faf('0x6f')]['SELECT'],'raw':!![]})[_0x0faf('0x1f')](function(_0x596b16){return _0x596b16;});})[_0x0faf('0x1f')](function(_0x5f0d15){if(_0x5f0d15){_0x8587ab['message'][_0x0faf('0x70')]=_0x5f0d15[0x0];if(!_0x3285c5['body'][_0x0faf('0x62')])return;return db['User'][_0x0faf('0x56')]({'where':{'id':_0x3285c5[_0x0faf('0x58')][_0x0faf('0x62')],'role':_0x0faf('0x64')},'attributes':['id',_0x0faf('0x37'),_0x0faf('0x71'),_0x0faf('0x72'),_0x0faf('0x73')],'raw':!![]});}return null;})['then'](function(_0x2a6c18){if(!_0x2a6c18)return null;_0x8587ab[_0x0faf('0x28')][_0x0faf('0x64')]=_0x2a6c18;return _0x8587ab;})[_0x0faf('0x1f')](function(_0x1c6710){if(_0x1c6710){if(_0x3285c5[_0x0faf('0x58')][_0x0faf('0x74')]){_0x8587ab[_0x0faf('0x28')][_0x0faf('0x75')]=util[_0x0faf('0x60')]('SIP/%s',_0x3285c5['user'][_0x0faf('0x37')]);_0x8587ab[_0x0faf('0x28')][_0x0faf('0x76')]=_0x8587ab[_0x0faf('0x76')];_0x8587ab[_0x0faf('0x28')][_0x0faf('0x77')]=_0x8587ab[_0x0faf('0x76')];_0x8587ab[_0x0faf('0x28')][_0x0faf('0x78')]=_0x0faf('0x5d');return respondWithRpcPromise(_0x0faf('0x79'),_0x0faf('0x79'),{'event':_0x0faf('0x7a'),'message':_0x8587ab[_0x0faf('0x28')]},client9002)['then'](function(){return _0x8587ab;});}return _0x8587ab;}return null;})['then'](respondWithResult(_0x19caa2,null))['catch'](handleError(_0x19caa2,null));};var interaction_log=require(_0x0faf('0x13'))(_0x0faf('0x5c'));exports[_0x0faf('0x7b')]=function(_0x10518c,_0x28fd13,_0x4c56b5){var _0x38ac6f={'agent':{},'channel':_0x0faf('0x5e')};if(_0x10518c['body']['id']){delete _0x10518c[_0x0faf('0x58')]['id'];}_0x10518c['body']['UserId']=_0x10518c['body'][_0x0faf('0x62')]||_0x10518c[_0x0faf('0x63')]['id'];_0x38ac6f['agent']['id']=_0x10518c[_0x0faf('0x58')][_0x0faf('0x62')];return db[_0x0faf('0x3a')][_0x0faf('0x56')]({'where':{'id':_0x10518c[_0x0faf('0x59')]['id'],'UserId':null}})[_0x0faf('0x1f')](handleEntityNotFound(_0x28fd13,null))[_0x0faf('0x1f')](function(_0x3d19eb){if(_0x3d19eb){_0x38ac6f[_0x0faf('0x28')]=_0x3d19eb[_0x0faf('0x68')]({'plain':!![]});return db['SmsInteraction'][_0x0faf('0x56')]({'where':{'id':_0x3d19eb[_0x0faf('0x7c')]}});}return null;})[_0x0faf('0x1f')](handleEntityNotFound(_0x28fd13,null))['then'](function(_0x4f9999){if(_0x4f9999){_0x38ac6f[_0x0faf('0x67')]=_0x4f9999[_0x0faf('0x68')]({'plain':!![]});interaction_log[_0x0faf('0x20')](_0x0faf('0x7d'),_0x10518c[_0x0faf('0x63')]['id'],_0x10518c[_0x0faf('0x63')][_0x0faf('0x37')],_0x10518c[_0x0faf('0x63')][_0x0faf('0x6a')],_0x38ac6f[_0x0faf('0x67')]['id'],_0x10518c[_0x0faf('0x58')]?JSON[_0x0faf('0x25')](_0x10518c['body']):_0x0faf('0x7e'));return respondWithRpcPromise('RejectMessage',_0x0faf('0x7f'),_0x38ac6f);}return null;})['then'](function(_0x535bf8){var _0x262cdd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x535bf8[_0x0faf('0x28')][_0x0faf('0x6d')];return db[_0x0faf('0x80')]['query'](_0x262cdd,{'type':db[_0x0faf('0x6e')][_0x0faf('0x6f')][_0x0faf('0x81')],'raw':!![]})['then'](function(_0x15ef78){return _0x15ef78;});})[_0x0faf('0x1f')](function(_0x3f5f93){if(_0x3f5f93){_0x38ac6f[_0x0faf('0x28')]['contact']=_0x3f5f93[0x0];if(!_0x10518c[_0x0faf('0x58')][_0x0faf('0x62')])return;return db[_0x0faf('0x82')]['find']({'where':{'id':_0x10518c[_0x0faf('0x58')][_0x0faf('0x62')],'role':_0x0faf('0x64')},'attributes':['id',_0x0faf('0x37'),_0x0faf('0x71'),_0x0faf('0x72'),_0x0faf('0x73')],'raw':!![]});}return null;})['then'](function(_0x26670e){if(!_0x26670e)return null;_0x38ac6f[_0x0faf('0x28')]['agent']=_0x26670e;return _0x38ac6f;})[_0x0faf('0x1f')](function(_0xf00046){if(_0xf00046){_0xf00046['message'][_0x0faf('0x75')]=util[_0x0faf('0x60')](_0x0faf('0x83'),_0x10518c['user']['name']);_0xf00046[_0x0faf('0x28')][_0x0faf('0x76')]=_0x38ac6f['channel'];_0xf00046[_0x0faf('0x28')]['motionChannel']=_0x38ac6f[_0x0faf('0x76')];_0xf00046[_0x0faf('0x28')][_0x0faf('0x78')]=_0x0faf('0x7b');respondWithRpcPromise(_0x0faf('0x79'),_0x0faf('0x79'),{'event':_0x0faf('0x84'),'message':_0xf00046[_0x0faf('0x28')]},client9002);return _0x38ac6f;}return null;})[_0x0faf('0x1f')](respondWithResult(_0x28fd13,null))['catch'](handleError(_0x28fd13,null));};exports[_0x0faf('0x2b')]=function(_0x2800af,_0x400931,_0x643de8){if(_0x2800af['body']['id']){delete _0x2800af['body']['id'];}var _0x47d69f;return db['SmsMessage'][_0x0faf('0x56')]({'where':{'id':_0x2800af[_0x0faf('0x59')]['id']}})['then'](handleEntityNotFound(_0x400931,null))[_0x0faf('0x1f')](function(_0x19ad46){if(_0x19ad46){_0x47d69f=_0x19ad46;return db[_0x0faf('0x85')]['find']({'where':{'id':_0x19ad46[_0x0faf('0x86')]}});}})['then'](handleEntityNotFound(_0x400931,null))[_0x0faf('0x1f')](function(_0x2f472e){if(_0x2f472e){logger['debug'](_0x0faf('0x24'),_0x0faf('0x2b'),_0x0faf('0x87'),_0x2f472e[_0x0faf('0x3d')],util['inspect'](_0x2800af[_0x0faf('0x58')],{'showHidden':![],'depth':null}));switch(_0x2f472e[_0x0faf('0x3d')]){case _0x0faf('0x88'):if(_0x2800af[_0x0faf('0x58')][_0x0faf('0x89')]&&_0x2800af[_0x0faf('0x58')][_0x0faf('0x89')]===_0x47d69f[_0x0faf('0x8a')]){return _0x47d69f[_0x0faf('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0faf('0x2b'),_0x0faf('0x88'),util[_0x0faf('0x8b')](_0x2800af[_0x0faf('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0faf('0x8c'):if(_0x2800af[_0x0faf('0x58')]['MessageUUID']&&_0x2800af['body'][_0x0faf('0x8d')]===_0x47d69f['messageId']&&_['indexOf']([_0x0faf('0x8e'),_0x0faf('0x8f')],_0x2800af[_0x0faf('0x58')]['Status'])>=0x0){return _0x47d69f[_0x0faf('0x33')]({'read':!![]});}else{logger['error'](_0x0faf('0x90'),_0x0faf('0x2b'),'plivio',util[_0x0faf('0x8b')](_0x2800af[_0x0faf('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0faf('0x91'):var _0xf2738c=_0x2800af['body'][_0x0faf('0x92')][0x0];if(_0xf2738c[_0x0faf('0x2b')][_0x0faf('0x93')]==='DELIVERED'){return _0x47d69f[_0x0faf('0x33')]({'read':!![]});}else{logger['error'](_0x0faf('0x90'),'status',_0x0faf('0x91'),util[_0x0faf('0x8b')](_0x2800af['body'],{'showHidden':![],'depth':null}));}break;}return _0x47d69f;}})[_0x0faf('0x1f')](respondWithResult(_0x400931,null))['catch'](handleError(_0x400931,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 13b0008..1337656 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 _0x9254=['SmsMessage','setMaxListeners','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x384207,_0x2773da){var _0x3f64ee=function(_0x5957e3){while(--_0x5957e3){_0x384207['push'](_0x384207['shift']());}};_0x3f64ee(++_0x2773da);}(_0x9254,0x1bf));var _0x4925=function(_0x4b24d1,_0x3726b6){_0x4b24d1=_0x4b24d1-0x0;var _0x3221d0=_0x9254[_0x4b24d1];return _0x3221d0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4925('0x0'))['db'][_0x4925('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4925('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4925('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d407b){return function(_0x4a629e,_0x5214c3,_0x1abdf4){SmsMessageEvents[_0x4925('0x4')](_0x2d407b+':'+_0x4a629e['id'],_0x4a629e);SmsMessageEvents[_0x4925('0x4')](_0x2d407b,_0x4a629e);_0x1abdf4(null);};}for(var e in events){if(events[_0x4925('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4925('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xc0eb=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x1656cd,_0x26f2f6){var _0x5af6c3=function(_0x283cfa){while(--_0x283cfa){_0x1656cd['push'](_0x1656cd['shift']());}};_0x5af6c3(++_0x26f2f6);}(_0xc0eb,0x1f0));var _0xbc0e=function(_0x3aa032,_0x566691){_0x3aa032=_0x3aa032-0x0;var _0x5120f9=_0xc0eb[_0x3aa032];return _0x5120f9;};'use strict';var EventEmitter=require(_0xbc0e('0x0'));var SmsMessage=require(_0xbc0e('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbc0e('0x2')](0x0);var events={'afterCreate':_0xbc0e('0x3'),'afterUpdate':'update','afterDestroy':_0xbc0e('0x4')};function emitEvent(_0x60dff4){return function(_0xb6fc8b,_0x8f1f97,_0x3ab073){SmsMessageEvents[_0xbc0e('0x5')](_0x60dff4+':'+_0xb6fc8b['id'],_0xb6fc8b);SmsMessageEvents[_0xbc0e('0x5')](_0x60dff4,_0xb6fc8b);_0x3ab073(null);};}for(var e in events){if(events[_0xbc0e('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xbc0e('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 df299c7..d3db76a 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 _0x6c14=['accountId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','catch','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','format','%s:%s','Basic\x20%s','toString','http_code','data','queued_count','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','infobip','csc','crypto','login','text','sort','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','clickatell','https://messaging.bandwidth.com/api/v2/users/'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x6c14,0xee));var _0x46c1=function(_0x29c696,_0x133cef){_0x29c696=_0x29c696-0x0;var _0x238a8d=_0x6c14[_0x29c696];return _0x238a8d;};'use strict';var _=require('lodash');var util=require(_0x46c1('0x0'));var logger=require('../../config/logger')(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46c1('0x4'));var config=require('../../config/environment');var attributes=require(_0x46c1('0x5'));module[_0x46c1('0x6')]=function(_0x1c1de2,_0x3e6a97){return _0x1c1de2[_0x46c1('0x7')]('SmsMessage',attributes,{'tableName':_0x46c1('0x8'),'paranoid':![],'indexes':[{'name':_0x46c1('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x46c1('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41c2da,_0x5a6353,_0x3aeae8){var _0x600e01=_0x1c1de2[_0x46c1('0xb')];var _0x5a2013=_0x41c2da['get']({'plain':!![]});if(_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()==='in'||_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()===_0x46c1('0xe')&&!_0x5a2013[_0x46c1('0xf')]&&!_['isNil'](_0x5a2013[_0x46c1('0x10')])&&!_['isNil'](_0x5a2013[_0x46c1('0x11')])){_0x600e01[_0x46c1('0x12')][_0x46c1('0x13')]({'where':{'id':_0x5a2013[_0x46c1('0x11')]}})[_0x46c1('0x14')](function(_0x4d7281){if(_0x4d7281){_0x4d7281[_0x46c1('0x15')]({'lastMsgAt':_0x5a2013['createdAt'],'lastMsgDirection':_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()});}})['catch'](function(_0x20e61a){console[_0x46c1('0x16')](_0x20e61a);});}if(_0x5a2013[_0x46c1('0xc')]===_0x46c1('0xe')&&!_0x5a2013[_0x46c1('0xf')]){var _0x28cebb;_0x600e01['SmsAccount'][_0x46c1('0x17')]({'where':{'id':_0x5a2013[_0x46c1('0x18')]},'raw':!![]})[_0x46c1('0x14')](function(_0x1c6aab){_0x28cebb=_0x1c6aab;if(_0x28cebb&&_0x28cebb[_0x46c1('0x19')]){switch(_0x28cebb[_0x46c1('0x19')]){case'twilio':var _0x7a5754=require(_0x46c1('0x1a'));if(_0x28cebb[_0x46c1('0x1b')]&&_0x28cebb['authToken']&&_0x28cebb[_0x46c1('0x1c')]){var _0x2dd19d=new _0x7a5754(_0x28cebb['accountSid'],_0x28cebb[_0x46c1('0x1d')]);_0x2dd19d[_0x46c1('0x1e')][_0x46c1('0x1f')]({'body':_0x5a2013[_0x46c1('0x20')],'to':_0x5a2013[_0x46c1('0x1c')],'from':_0x28cebb['phone'],'statusCallback':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+_0x46c1('0x23')+_0x28cebb['token']})[_0x46c1('0x14')](function(_0xb1aca8){if(_0xb1aca8[_0x46c1('0x24')]){return _0x41c2da['update']({'messageId':_0xb1aca8[_0x46c1('0x24')]});}})['catch'](function(_0x5a6c23){logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),'twilio',util['inspect'](_0x5a6c23,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x46c1('0x27'):var _0x5cf999=_0x46c1('0x28');if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb['password']){var _0x54b4da={'recipient':[_0x5a2013[_0x46c1('0x1c')]],'message':_0x5a2013[_0x46c1('0x20')],'message_type':_0x28cebb[_0x46c1('0x2a')]};if(_0x28cebb['smsMethod']&&_0x28cebb[_0x46c1('0x2a')]!=='SI'){_0x54b4da[_0x46c1('0x2b')]=_0x28cebb[_0x46c1('0x1c')];}var _0x1493aa={'url':_0x5cf999+_0x46c1('0x2c')+_0x28cebb[_0x46c1('0x29')]+_0x46c1('0x2d')+_0x28cebb['password'],'method':_0x46c1('0x2e')};rp(_0x1493aa)[_0x46c1('0x14')](function(_0x45228a){var _0x19781d=_0x45228a['split'](';');var _0x293949={'user_key':_0x19781d[0x0],'session_key':_0x19781d[0x1]};_0x1493aa={'url':_0x5cf999+_0x46c1('0x2f'),'method':_0x46c1('0x30'),'headers':{'user_key':_0x293949[_0x46c1('0x31')],'Session_key':_0x293949['session_key']},'json':!![],'body':_0x54b4da};return rp(_0x1493aa);})[_0x46c1('0x14')](function(_0x3aabc1){if(_0x3aabc1[_0x46c1('0x32')]>=0x1){var _0x5a2ca2={'messageId':_0x3aabc1[_0x46c1('0x33')]};if(_0x28cebb[_0x46c1('0x2a')]!=='GP'||!_0x28cebb[_0x46c1('0x34')]){_0x5a2ca2[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x5a2ca2);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x27'),util['inspect'](_0x3aabc1,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x12dda6){return logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x27'),util[_0x46c1('0x37')](_0x12dda6,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'skebby',_0x46c1('0x38'));}break;case _0x46c1('0x39'):if(_0x28cebb['authToken']){var _0x43ca0d={'recipient':_0x5a2013[_0x46c1('0x1c')],'message':_0x5a2013[_0x46c1('0x20')],'sender':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')],'authorization':_0x28cebb['authToken']};var _0x5a6353={'method':_0x46c1('0x30'),'uri':_0x46c1('0x3b'),'body':_0x43ca0d,'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x309362){var _0x3bd00b={'messageId':_0x309362[_0x46c1('0x3c')]};if(!_0x28cebb[_0x46c1('0x34')]){_0x3bd00b[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x3bd00b);})[_0x46c1('0x36')](function(_0x282d32){logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x39'),util[_0x46c1('0x37')](_0x282d32,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x39'),_0x46c1('0x3d'));}break;case'clicksend':if(_0x28cebb['username']&&_0x28cebb[_0x46c1('0x3e')]){var _0x43ca0d={'messages':[{'source':'xCALLY\x20Motion','to':_0x5a2013[_0x46c1('0x1c')],'body':_0x5a2013[_0x46c1('0x20')],'from':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')]}]};var _0x131805=util[_0x46c1('0x3f')](_0x46c1('0x40'),_0x28cebb[_0x46c1('0x29')],_0x28cebb[_0x46c1('0x3e')]);var _0x5a6353={'method':_0x46c1('0x30'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x43ca0d,'headers':{'Authorization':util[_0x46c1('0x3f')](_0x46c1('0x41'),new Buffer(_0x131805)[_0x46c1('0x42')]('base64'))},'json':!![]};rp(_0x5a6353)['then'](function(_0x39dc80){if(_0x39dc80[_0x46c1('0x43')]>=0xc8&&_0x39dc80[_0x46c1('0x43')]<=0xce){if(_0x39dc80['data']&&_0x39dc80[_0x46c1('0x44')][_0x46c1('0x45')]>0x0){var _0x38ebaa=_['head'](_0x39dc80[_0x46c1('0x44')][_0x46c1('0x1e')]);var _0x3bb328={'messageId':_0x38ebaa['message_id']};if(!_0x28cebb[_0x46c1('0x34')]){_0x3bb328[_0x46c1('0x35')]=!![];}return _0x41c2da['update'](_0x3bb328);}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),util['inspect'](_0x39dc80,{'showHidden':![],'depth':null}));}}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),util[_0x46c1('0x37')](_0x39dc80,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x57c49c){logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x46'),util[_0x46c1('0x37')](_0x57c49c,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x46c1('0x47'):if(_0x28cebb[_0x46c1('0x48')]&&_0x28cebb[_0x46c1('0x1d')]){var _0x43ca0d={'dst':_0x5a2013['phone'],'text':_0x5a2013[_0x46c1('0x20')],'src':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')],'url':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+'/status?token='+_0x28cebb['token']};var _0x131805=util[_0x46c1('0x3f')]('%s:%s',_0x28cebb[_0x46c1('0x48')],_0x28cebb['authToken']);var _0x5a6353={'method':_0x46c1('0x30'),'uri':util[_0x46c1('0x3f')](_0x46c1('0x49'),_0x28cebb[_0x46c1('0x48')]),'body':_0x43ca0d,'headers':{'Authorization':util[_0x46c1('0x3f')]('Basic\x20%s',new Buffer(_0x131805)[_0x46c1('0x42')](_0x46c1('0x4a')))},'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x5ed37a){var _0x4f35f0={'messageId':_0x5ed37a['message_uuid'][0x0]};return _0x41c2da['update'](_0x4f35f0);})['catch'](function(_0x577cfc){logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'plivo',util[_0x46c1('0x37')](_0x577cfc,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'plivo',_0x46c1('0x4b'));}break;case'infobip':if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb[_0x46c1('0x3e')]){if(_0x28cebb[_0x46c1('0x4c')]){var _0x5cdd55={'method':_0x46c1('0x30'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x4d'),'body':{'username':_0x28cebb[_0x46c1('0x29')],'password':_0x28cebb[_0x46c1('0x3e')]},'json':!![]};return rp(_0x5cdd55)[_0x46c1('0x14')](function(_0x11c8a5){var _0x2ea4b1={'method':_0x46c1('0x30'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x4e'),'body':{'messages':[{'from':_0x28cebb[_0x46c1('0x1c')],'destinations':[{'to':_0x5a2013[_0x46c1('0x1c')]}],'text':_0x5a2013['body'],'notifyUrl':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+_0x46c1('0x23')+_0x28cebb[_0x46c1('0x4f')],'notifyContentType':_0x46c1('0x50'),'callbackData':_0x28cebb['phone']+';'+_0x5a2013[_0x46c1('0x20')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x11c8a5['token']},'json':!![]};return rp(_0x2ea4b1)[_0x46c1('0x14')](function(_0x15858f){if(_0x15858f[_0x46c1('0x1e')]){var _0x5198a4={'messageId':_0x15858f[_0x46c1('0x1e')][0x0]['messageId']};if(!_0x28cebb[_0x46c1('0x34')]){_0x5198a4[_0x46c1('0x35')]=!![];}return _0x41c2da['update'](_0x5198a4);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'infobip',util[_0x46c1('0x37')](_0x15858f,{'showHidden':![],'depth':null}));}});})[_0x46c1('0x36')](function(_0x30a8f0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46c1('0x26'),_0x46c1('0x51'),util['inspect'](_0x30a8f0,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'infobip',_0x46c1('0x38'));}break;case _0x46c1('0x52'):var _0x415737=require(_0x46c1('0x53'));if(_0x28cebb['apiKey']){var _0x161f3e={};_0x161f3e[_0x46c1('0x54')]=_0x28cebb['username'];_0x161f3e[_0x46c1('0x1c')]=_0x5a2013['phone'];_0x161f3e['sender']=_0x28cebb[_0x46c1('0x1c')];_0x161f3e[_0x46c1('0x55')]=_0x5a2013[_0x46c1('0x20')];_0x161f3e['timestamp']=+new Date();var _0x1ccf63='';var _0x3ef970='';var _0xc6eddc=Object['keys'](_0x161f3e);_0xc6eddc[_0x46c1('0x56')]();for(var _0x84c0f4=0x0;_0x84c0f4<_0xc6eddc[_0x46c1('0x57')];_0x84c0f4++){if(_0x1ccf63!=''){_0x1ccf63+='&';}_0x1ccf63+=_0xc6eddc[_0x84c0f4]+'='+encodeURIComponent(_0x161f3e[_0xc6eddc[_0x84c0f4]]);_0x3ef970+=_0x161f3e[_0xc6eddc[_0x84c0f4]];}_0x3ef970+=_0x28cebb[_0x46c1('0x58')];_0x3ef970=_0x415737[_0x46c1('0x59')](_0x46c1('0x5a'))['update'](_0x3ef970)[_0x46c1('0x5b')](_0x46c1('0x5c'));if(_0x1ccf63!==''){_0x1ccf63+='&';}_0x1ccf63+=_0x46c1('0x5d')+_0x3ef970;var _0x1493aa={'method':_0x46c1('0x2e'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x5e')+_0x1ccf63,'json':!![]};return rp(_0x1493aa)['then'](function(_0x5ee631){var _0x5a46c6=Object[_0x46c1('0x5f')](_0x5ee631);if(_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x16')]&&parseInt(_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x16')])===0x0){var _0x5a33c8={'messageId':_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x60')]};if(!_0x28cebb[_0x46c1('0x34')]){_0x5a33c8[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x5a33c8);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),util[_0x46c1('0x37')](_0x5ee631['error'],{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2919d8){return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),util[_0x46c1('0x37')](_0x2919d8,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),_0x46c1('0x61'));}break;case'clickatell':if(_0x28cebb[_0x46c1('0x58')]){var _0x2d94f5={'method':'POST','uri':_0x46c1('0x62'),'headers':{'Authorization':_0x28cebb[_0x46c1('0x58')]},'body':{'content':_0x5a2013[_0x46c1('0x20')],'to':[_0x5a2013[_0x46c1('0x1c')]],'from':_0x28cebb[_0x46c1('0x1c')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2d94f5)['then'](function(_0x15c63c){if(!_0x15c63c[_0x46c1('0x16')]){var _0x519581={'messageId':_0x15c63c[_0x46c1('0x1e')][0x0]['apiMessageId']};if(!_0x28cebb[_0x46c1('0x34')]){_0x519581['read']=!![];}return _0x41c2da[_0x46c1('0x15')](_0x519581);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),util[_0x46c1('0x37')](_0x15c63c[_0x46c1('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ec264){return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),util['inspect'](_0x3ec264,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb[_0x46c1('0x3e')]){var _0x131805=util[_0x46c1('0x3f')](_0x46c1('0x40'),_0x28cebb[_0x46c1('0x29')],_0x28cebb[_0x46c1('0x3e')]);var _0x5a6353={'method':'POST','uri':_0x46c1('0x64')+_0x28cebb[_0x46c1('0x65')]+'/messages','body':{'to':[_0x5a2013['phone']],'text':_0x5a2013[_0x46c1('0x20')],'from':_0x28cebb[_0x46c1('0x1c')],'applicationId':_0x28cebb['applicationId']},'headers':{'Authorization':util['format'](_0x46c1('0x41'),new Buffer(_0x131805)[_0x46c1('0x42')](_0x46c1('0x4a')))},'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x52395e){if(_0x52395e['id']){var _0x216bb4={'messageId':_0x52395e['id']};return _0x41c2da[_0x46c1('0x15')](_0x216bb4);}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x66'),util['inspect'](_0x52395e,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2023e0){logger[_0x46c1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46c1('0x26'),_0x46c1('0x66'),util[_0x46c1('0x37')](_0x2023e0,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x66'),_0x46c1('0x38'));}break;case _0x46c1('0x67'):if(_0x28cebb[_0x46c1('0x58')]){var _0x1f7c41={};var _0x1493aa={'method':'POST','uri':_0x46c1('0x68'),'headers':{'Authorization':_0x46c1('0x69')+_0x28cebb[_0x46c1('0x58')],'Content-Type':_0x46c1('0x50')},'body':{'from':_0x28cebb[_0x46c1('0x1c')],'to':_0x5a2013[_0x46c1('0x1c')],'text':_0x5a2013[_0x46c1('0x20')]},'json':!![]};return rp(_0x1493aa)[_0x46c1('0x14')](function(_0x9f7677){if(_0x9f7677[_0x46c1('0x6a')]==0xca){_0x1f7c41[_0x46c1('0x6b')]=_0x9f7677;var _0x1a36df={'method':_0x46c1('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x28cebb['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x1f7c41[_0x46c1('0x6b')][_0x46c1('0x6c')]},'json':!![]};return rp(_0x1a36df)[_0x46c1('0x14')](function(_0x3e0760){_0x1f7c41['status']=_0x3e0760;var _0x472da5={'messageId':_0x1f7c41[_0x46c1('0x6b')]['refid'],'read':!![]};return _0x41c2da[_0x46c1('0x15')](_0x472da5);});}else{return logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),'intelepeer',util['inspect'](_0x9f7677,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2ca597){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x46c1('0x37')](_0x2ca597,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x46c1('0x67'),_0x46c1('0x6d'));}break;}}})[_0x46c1('0x6e')](function(){_0x3aeae8();});}else{_0x3aeae8();}}},'charset':_0x46c1('0x6f'),'collate':_0x46c1('0x70')});}; \ No newline at end of file +var _0x28cf=['Missing\x20parameters:\x20apiKey','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','createdAt','error','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','timestamp','keys','sort','apiKey','createHash','digest','hex','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','messages'];(function(_0x387ed9,_0x2abfc6){var _0x3bbbab=function(_0x1cfa29){while(--_0x1cfa29){_0x387ed9['push'](_0x387ed9['shift']());}};_0x3bbbab(++_0x2abfc6);}(_0x28cf,0xfb));var _0xf28c=function(_0x84caf7,_0x14bce4){_0x84caf7=_0x84caf7-0x0;var _0x1a54c1=_0x28cf[_0x84caf7];return _0x1a54c1;};'use strict';var _=require(_0xf28c('0x0'));var util=require(_0xf28c('0x1'));var logger=require(_0xf28c('0x2'))(_0xf28c('0x3'));var moment=require(_0xf28c('0x4'));var BPromise=require('bluebird');var rp=require(_0xf28c('0x5'));var fs=require('fs');var path=require(_0xf28c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf28c('0x7'));module[_0xf28c('0x8')]=function(_0x4e69ae,_0x4a1e5f){return _0x4e69ae[_0xf28c('0x9')]('SmsMessage',attributes,{'tableName':_0xf28c('0xa'),'paranoid':![],'indexes':[{'name':_0xf28c('0xb'),'fields':[_0xf28c('0xb')]},{'name':_0xf28c('0xc'),'fields':[_0xf28c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x483953,_0x5e5cf9,_0x56aa31){var _0x5ee184=_0x4e69ae['models'];var _0x9b99f3=_0x483953['get']({'plain':!![]});if(_0x9b99f3[_0xf28c('0xe')]['toLowerCase']()==='in'||_0x9b99f3['direction'][_0xf28c('0xf')]()===_0xf28c('0x10')&&!_0x9b99f3[_0xf28c('0x11')]&&!_[_0xf28c('0x12')](_0x9b99f3[_0xf28c('0x13')])&&!_['isNil'](_0x9b99f3[_0xf28c('0x14')])){_0x5ee184[_0xf28c('0x15')]['findOne']({'where':{'id':_0x9b99f3['SmsInteractionId']}})[_0xf28c('0x16')](function(_0x276af7){if(_0x276af7){_0x276af7[_0xf28c('0x17')]({'lastMsgAt':_0x9b99f3[_0xf28c('0x18')],'lastMsgDirection':_0x9b99f3[_0xf28c('0xe')][_0xf28c('0xf')]()});}})['catch'](function(_0x47c014){console[_0xf28c('0x19')](_0x47c014);});}if(_0x9b99f3[_0xf28c('0xe')]===_0xf28c('0x10')&&!_0x9b99f3[_0xf28c('0x11')]){var _0x441146;_0x5ee184['SmsAccount'][_0xf28c('0x1a')]({'where':{'id':_0x9b99f3[_0xf28c('0x1b')]},'raw':!![]})[_0xf28c('0x16')](function(_0x57c844){_0x441146=_0x57c844;if(_0x441146&&_0x441146[_0xf28c('0x1c')]){switch(_0x441146[_0xf28c('0x1c')]){case _0xf28c('0x1d'):var _0x3394a9=require(_0xf28c('0x1d'));if(_0x441146[_0xf28c('0x1e')]&&_0x441146[_0xf28c('0x1f')]&&_0x441146[_0xf28c('0x20')]){var _0x5937f6=new _0x3394a9(_0x441146['accountSid'],_0x441146['authToken']);_0x5937f6['messages'][_0xf28c('0x21')]({'body':_0x9b99f3[_0xf28c('0xd')],'to':_0x9b99f3[_0xf28c('0x20')],'from':_0x441146[_0xf28c('0x20')],'statusCallback':_0x441146[_0xf28c('0x22')]+_0xf28c('0x23')+_0x9b99f3['id']+'/status?token='+_0x441146[_0xf28c('0x24')]})[_0xf28c('0x16')](function(_0x9ebd2){if(_0x9ebd2[_0xf28c('0x25')]){return _0x483953[_0xf28c('0x17')]({'messageId':_0x9ebd2['sid']});}})[_0xf28c('0x26')](function(_0x1af2c1){logger[_0xf28c('0x19')](_0xf28c('0x27'),'afterCreate',_0xf28c('0x1d'),util[_0xf28c('0x28')](_0x1af2c1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf28c('0x27'),_0xf28c('0x29'),'twilio',_0xf28c('0x2a'));}break;case _0xf28c('0x2b'):var _0x313270=_0xf28c('0x2c');if(_0x441146[_0xf28c('0x2d')]&&_0x441146[_0xf28c('0x2e')]){var _0x2c31a9={'recipient':[_0x9b99f3[_0xf28c('0x20')]],'message':_0x9b99f3[_0xf28c('0xd')],'message_type':_0x441146['smsMethod']};if(_0x441146[_0xf28c('0x2f')]&&_0x441146[_0xf28c('0x2f')]!=='SI'){_0x2c31a9[_0xf28c('0x30')]=_0x441146[_0xf28c('0x20')];}var _0x5c8d10={'url':_0x313270+'login?username='+_0x441146[_0xf28c('0x2d')]+_0xf28c('0x31')+_0x441146[_0xf28c('0x2e')],'method':'GET'};rp(_0x5c8d10)[_0xf28c('0x16')](function(_0x7b6bb7){var _0x20ce45=_0x7b6bb7[_0xf28c('0x32')](';');var _0x21c8ec={'user_key':_0x20ce45[0x0],'session_key':_0x20ce45[0x1]};_0x5c8d10={'url':_0x313270+_0xf28c('0x33'),'method':_0xf28c('0x34'),'headers':{'user_key':_0x21c8ec[_0xf28c('0x35')],'Session_key':_0x21c8ec[_0xf28c('0x36')]},'json':!![],'body':_0x2c31a9};return rp(_0x5c8d10);})[_0xf28c('0x16')](function(_0x5d691e){if(_0x5d691e[_0xf28c('0x37')]>=0x1){var _0x3c238d={'messageId':_0x5d691e['internal_order_id']};if(_0x441146[_0xf28c('0x2f')]!=='GP'||!_0x441146[_0xf28c('0x38')]){_0x3c238d[_0xf28c('0x39')]=!![];}return _0x483953[_0xf28c('0x17')](_0x3c238d);}else{return logger[_0xf28c('0x19')](_0xf28c('0x27'),'afterCreate',_0xf28c('0x2b'),util['inspect'](_0x5d691e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2e72dc){return logger[_0xf28c('0x19')](_0xf28c('0x27'),'afterCreate',_0xf28c('0x2b'),util[_0xf28c('0x28')](_0x2e72dc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x2b'),_0xf28c('0x3a'));}break;case _0xf28c('0x3b'):if(_0x441146[_0xf28c('0x1f')]){var _0x254d2d={'recipient':_0x9b99f3[_0xf28c('0x20')],'message':_0x9b99f3['body'],'sender':_0x441146[_0xf28c('0x3c')]||_0x441146[_0xf28c('0x20')],'authorization':_0x441146[_0xf28c('0x1f')]};var _0x5e5cf9={'method':_0xf28c('0x34'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x254d2d,'json':!![]};rp(_0x5e5cf9)[_0xf28c('0x16')](function(_0xb655da){var _0x57260b={'messageId':_0xb655da['requestid']};if(!_0x441146['deliveryReport']){_0x57260b['read']=!![];}return _0x483953[_0xf28c('0x17')](_0x57260b);})[_0xf28c('0x26')](function(_0x55aaa3){logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x3b'),util[_0xf28c('0x28')](_0x55aaa3,{'showHidden':![],'depth':null}));});}else{logger[_0xf28c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),'connectel',_0xf28c('0x3d'));}break;case'clicksend':if(_0x441146[_0xf28c('0x2d')]&&_0x441146[_0xf28c('0x2e')]){var _0x254d2d={'messages':[{'source':_0xf28c('0x3e'),'to':_0x9b99f3[_0xf28c('0x20')],'body':_0x9b99f3[_0xf28c('0xd')],'from':_0x441146[_0xf28c('0x3c')]||_0x441146[_0xf28c('0x20')]}]};var _0x125639=util['format'](_0xf28c('0x3f'),_0x441146[_0xf28c('0x2d')],_0x441146[_0xf28c('0x2e')]);var _0x5e5cf9={'method':_0xf28c('0x34'),'uri':_0xf28c('0x40'),'body':_0x254d2d,'headers':{'Authorization':util[_0xf28c('0x41')](_0xf28c('0x42'),new Buffer(_0x125639)[_0xf28c('0x43')]('base64'))},'json':!![]};rp(_0x5e5cf9)[_0xf28c('0x16')](function(_0x43fd9a){if(_0x43fd9a[_0xf28c('0x44')]>=0xc8&&_0x43fd9a[_0xf28c('0x44')]<=0xce){if(_0x43fd9a['data']&&_0x43fd9a[_0xf28c('0x45')][_0xf28c('0x46')]>0x0){var _0x4ec83b=_[_0xf28c('0x47')](_0x43fd9a[_0xf28c('0x45')]['messages']);var _0x50fcf7={'messageId':_0x4ec83b['message_id']};if(!_0x441146['deliveryReport']){_0x50fcf7[_0xf28c('0x39')]=!![];}return _0x483953['update'](_0x50fcf7);}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),'clickSend',util['inspect'](_0x43fd9a,{'showHidden':![],'depth':null}));}}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),'afterCreate',_0xf28c('0x48'),util[_0xf28c('0x28')](_0x43fd9a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x40a2b6){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),_0xf28c('0x48'),util['inspect'](_0x40a2b6,{'showHidden':![],'depth':null}));});}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x48'),_0xf28c('0x3a'));}break;case _0xf28c('0x49'):if(_0x441146[_0xf28c('0x4a')]&&_0x441146[_0xf28c('0x1f')]){var _0x254d2d={'dst':_0x9b99f3['phone'],'text':_0x9b99f3[_0xf28c('0xd')],'src':_0x441146[_0xf28c('0x3c')]||_0x441146[_0xf28c('0x20')],'url':_0x441146['remote']+_0xf28c('0x23')+_0x9b99f3['id']+_0xf28c('0x4b')+_0x441146[_0xf28c('0x24')]};var _0x125639=util[_0xf28c('0x41')]('%s:%s',_0x441146[_0xf28c('0x4a')],_0x441146[_0xf28c('0x1f')]);var _0x5e5cf9={'method':_0xf28c('0x34'),'uri':util[_0xf28c('0x41')](_0xf28c('0x4c'),_0x441146[_0xf28c('0x4a')]),'body':_0x254d2d,'headers':{'Authorization':util[_0xf28c('0x41')]('Basic\x20%s',new Buffer(_0x125639)[_0xf28c('0x43')](_0xf28c('0x4d')))},'json':!![]};rp(_0x5e5cf9)[_0xf28c('0x16')](function(_0x5dfb83){var _0x7befab={'messageId':_0x5dfb83[_0xf28c('0x4e')][0x0]};return _0x483953[_0xf28c('0x17')](_0x7befab);})[_0xf28c('0x26')](function(_0x3dc4c3){logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x49'),util[_0xf28c('0x28')](_0x3dc4c3,{'showHidden':![],'depth':null}));});}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x49'),_0xf28c('0x4f'));}break;case _0xf28c('0x50'):if(_0x441146['username']&&_0x441146[_0xf28c('0x2e')]){if(_0x441146[_0xf28c('0x51')]){var _0x3261e3={'method':_0xf28c('0x34'),'uri':_0x441146[_0xf28c('0x51')]+'/auth/1/session','body':{'username':_0x441146[_0xf28c('0x2d')],'password':_0x441146['password']},'json':!![]};return rp(_0x3261e3)[_0xf28c('0x16')](function(_0x1b1035){var _0xd53099={'method':_0xf28c('0x34'),'uri':_0x441146[_0xf28c('0x51')]+_0xf28c('0x52'),'body':{'messages':[{'from':_0x441146[_0xf28c('0x20')],'destinations':[{'to':_0x9b99f3['phone']}],'text':_0x9b99f3['body'],'notifyUrl':_0x441146[_0xf28c('0x22')]+_0xf28c('0x23')+_0x9b99f3['id']+_0xf28c('0x4b')+_0x441146['token'],'notifyContentType':_0xf28c('0x53'),'callbackData':_0x441146[_0xf28c('0x20')]+';'+_0x9b99f3[_0xf28c('0xd')]}]},'headers':{'Authorization':_0xf28c('0x54')+_0x1b1035['token']},'json':!![]};return rp(_0xd53099)[_0xf28c('0x16')](function(_0xebd373){if(_0xebd373['messages']){var _0x41b238={'messageId':_0xebd373['messages'][0x0]['messageId']};if(!_0x441146[_0xf28c('0x38')]){_0x41b238['read']=!![];}return _0x483953['update'](_0x41b238);}else{return logger[_0xf28c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),_0xf28c('0x50'),util[_0xf28c('0x28')](_0xebd373,{'showHidden':![],'depth':null}));}});})[_0xf28c('0x26')](function(_0x1d5def){return logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x50'),util[_0xf28c('0x28')](_0x1d5def,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),_0xf28c('0x50'),_0xf28c('0x55'));}}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),'afterCreate',_0xf28c('0x50'),_0xf28c('0x3a'));}break;case _0xf28c('0x56'):var _0x5bb2c3=require(_0xf28c('0x57'));if(_0x441146['apiKey']){var _0xc1e4a0={};_0xc1e4a0['login']=_0x441146[_0xf28c('0x2d')];_0xc1e4a0['phone']=_0x9b99f3['phone'];_0xc1e4a0[_0xf28c('0x30')]=_0x441146[_0xf28c('0x20')];_0xc1e4a0[_0xf28c('0x58')]=_0x9b99f3['body'];_0xc1e4a0[_0xf28c('0x59')]=+new Date();var _0x1642cc='';var _0x233413='';var _0x1f19c7=Object[_0xf28c('0x5a')](_0xc1e4a0);_0x1f19c7[_0xf28c('0x5b')]();for(var _0x3aa262=0x0;_0x3aa262<_0x1f19c7['length'];_0x3aa262++){if(_0x1642cc!=''){_0x1642cc+='&';}_0x1642cc+=_0x1f19c7[_0x3aa262]+'='+encodeURIComponent(_0xc1e4a0[_0x1f19c7[_0x3aa262]]);_0x233413+=_0xc1e4a0[_0x1f19c7[_0x3aa262]];}_0x233413+=_0x441146[_0xf28c('0x5c')];_0x233413=_0x5bb2c3[_0xf28c('0x5d')]('md5')[_0xf28c('0x17')](_0x233413)[_0xf28c('0x5e')](_0xf28c('0x5f'));if(_0x1642cc!==''){_0x1642cc+='&';}_0x1642cc+=_0xf28c('0x60')+_0x233413;var _0x5c8d10={'method':'GET','uri':_0x441146[_0xf28c('0x51')]+_0xf28c('0x61')+_0x1642cc,'json':!![]};return rp(_0x5c8d10)['then'](function(_0x13c4a9){var _0x223370=Object[_0xf28c('0x5a')](_0x13c4a9);if(_0x13c4a9[_0x223370[0x0]][_0xf28c('0x19')]&&parseInt(_0x13c4a9[_0x223370[0x0]][_0xf28c('0x19')])===0x0){var _0x4e07d6={'messageId':_0x13c4a9[_0x223370[0x0]]['id_sms']};if(!_0x441146[_0xf28c('0x38')]){_0x4e07d6[_0xf28c('0x39')]=!![];}return _0x483953[_0xf28c('0x17')](_0x4e07d6);}else{return logger['error'](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x56'),util[_0xf28c('0x28')](_0x13c4a9[_0xf28c('0x19')],{'showHidden':![],'depth':null}));}})[_0xf28c('0x26')](function(_0x3ed5bf){return logger['error'](_0xf28c('0x27'),'afterCreate','csc',util['inspect'](_0x3ed5bf,{'showHidden':![],'depth':null}));});}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x56'),'Missing\x20parameters:\x20apiKey');}break;case _0xf28c('0x62'):if(_0x441146[_0xf28c('0x5c')]){var _0xca51fa={'method':_0xf28c('0x34'),'uri':_0xf28c('0x63'),'headers':{'Authorization':_0x441146[_0xf28c('0x5c')]},'body':{'content':_0x9b99f3[_0xf28c('0xd')],'to':[_0x9b99f3[_0xf28c('0x20')]],'from':_0x441146[_0xf28c('0x20')],'binary':![],'clientMessageId':_0xf28c('0x64'),'charset':_0xf28c('0x65')},'json':!![]};rp(_0xca51fa)[_0xf28c('0x16')](function(_0x13e12e){if(!_0x13e12e['error']){var _0x10000b={'messageId':_0x13e12e[_0xf28c('0x66')][0x0]['apiMessageId']};if(!_0x441146[_0xf28c('0x38')]){_0x10000b[_0xf28c('0x39')]=!![];}return _0x483953[_0xf28c('0x17')](_0x10000b);}else{return logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x62'),util['inspect'](_0x13e12e[_0xf28c('0x19')],{'showHidden':![],'depth':null}));}})[_0xf28c('0x26')](function(_0x4fab45){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),_0xf28c('0x62'),util[_0xf28c('0x28')](_0x4fab45,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf28c('0x27'),_0xf28c('0x29'),'clickatell',_0xf28c('0x67'));}break;case'bandwidth':if(_0x441146[_0xf28c('0x2d')]&&_0x441146[_0xf28c('0x2e')]){var _0x125639=util[_0xf28c('0x41')](_0xf28c('0x3f'),_0x441146['username'],_0x441146[_0xf28c('0x2e')]);var _0x5e5cf9={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x441146[_0xf28c('0x68')]+_0xf28c('0x69'),'body':{'to':[_0x9b99f3['phone']],'text':_0x9b99f3[_0xf28c('0xd')],'from':_0x441146['phone'],'applicationId':_0x441146[_0xf28c('0x6a')]},'headers':{'Authorization':util[_0xf28c('0x41')](_0xf28c('0x42'),new Buffer(_0x125639)[_0xf28c('0x43')](_0xf28c('0x4d')))},'json':!![]};rp(_0x5e5cf9)['then'](function(_0x51ab49){if(_0x51ab49['id']){var _0x47aaf6={'messageId':_0x51ab49['id']};return _0x483953[_0xf28c('0x17')](_0x47aaf6);}else{logger['error'](_0xf28c('0x27'),'afterCreate','bandwidth',util[_0xf28c('0x28')](_0x51ab49,{'showHidden':![],'depth':null}));}})['catch'](function(_0xcafe92){logger['error'](_0xf28c('0x27'),'afterCreate',_0xf28c('0x6b'),util[_0xf28c('0x28')](_0xcafe92,{'showHidden':![],'depth':null}));});}else{logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf28c('0x6c'):if(_0x441146['apiKey']){var _0x1b4d8c={};var _0x5c8d10={'method':_0xf28c('0x34'),'uri':_0xf28c('0x6d'),'headers':{'Authorization':_0xf28c('0x6e')+_0x441146['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x441146[_0xf28c('0x20')],'to':_0x9b99f3[_0xf28c('0x20')],'text':_0x9b99f3[_0xf28c('0xd')]},'json':!![]};return rp(_0x5c8d10)['then'](function(_0x3cfb53){if(_0x3cfb53['code']==0xca){_0x1b4d8c[_0xf28c('0x6f')]=_0x3cfb53;var _0x65721f={'method':_0xf28c('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xf28c('0x6e')+_0x441146['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x1b4d8c[_0xf28c('0x6f')][_0xf28c('0x70')]},'json':!![]};return rp(_0x65721f)['then'](function(_0x3931ea){_0x1b4d8c[_0xf28c('0x71')]=_0x3931ea;var _0x4b975b={'messageId':_0x1b4d8c[_0xf28c('0x6f')][_0xf28c('0x70')],'read':!![]};return _0x483953[_0xf28c('0x17')](_0x4b975b);});}else{return logger[_0xf28c('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf28c('0x29'),_0xf28c('0x6c'),util['inspect'](_0x3cfb53,{'showHidden':![],'depth':null}));}})['catch'](function(_0x258b2f){return logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x6c'),util['inspect'](_0x258b2f,{'showHidden':![],'depth':null}));});}else{return logger[_0xf28c('0x19')](_0xf28c('0x27'),_0xf28c('0x29'),_0xf28c('0x6c'),_0xf28c('0x72'));}break;}}})[_0xf28c('0x73')](function(){_0x56aa31();});}else{_0x56aa31();}}},'charset':_0xf28c('0x74'),'collate':_0xf28c('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 437afa8..8aca546 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 _0x0733=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','options','raw','then','util','moment','bluebird','randomstring'];(function(_0x4c40f6,_0x432c5f){var _0x132f49=function(_0x163df1){while(--_0x163df1){_0x4c40f6['push'](_0x4c40f6['shift']());}};_0x132f49(++_0x432c5f);}(_0x0733,0x125));var _0x3073=function(_0x506565,_0x1386aa){_0x506565=_0x506565-0x0;var _0x172aa2=_0x0733[_0x506565];return _0x172aa2;};'use strict';var _=require('lodash');var util=require(_0x3073('0x0'));var moment=require(_0x3073('0x1'));var BPromise=require(_0x3073('0x2'));var rs=require(_0x3073('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3073('0x4'))['db'];var utils=require(_0x3073('0x5'));var logger=require(_0x3073('0x6'))(_0x3073('0x7'));var config=require(_0x3073('0x8'));var jayson=require(_0x3073('0x9'));var client=jayson[_0x3073('0xa')][_0x3073('0xb')]({'port':0x232a});config['redis']=_[_0x3073('0xc')](config[_0x3073('0xd')],{'host':_0x3073('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3073('0xd')]));require(_0x3073('0xf'))[_0x3073('0x10')](socket);function respondWithRpcPromise(_0x5e6b44,_0x105e78,_0x39874f){return new BPromise(function(_0x3e631f,_0x923b40){return client[_0x3073('0x11')](_0x5e6b44,_0x39874f)['then'](function(_0x4243cf){logger[_0x3073('0x12')](_0x3073('0x13'),_0x105e78,_0x3073('0x14'));logger['debug'](_0x3073('0x15'),_0x105e78,'request\x20sent',JSON[_0x3073('0x16')](_0x4243cf));if(_0x4243cf['error']){if(_0x4243cf[_0x3073('0x17')][_0x3073('0x18')]===0x1f4){logger['error'](_0x3073('0x13'),_0x105e78,_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);return _0x923b40(_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);}logger[_0x3073('0x17')]('SmsMessage,\x20%s,\x20%s',_0x105e78,_0x4243cf[_0x3073('0x17')]['message']);return _0x3e631f(_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);}else{logger['info'](_0x3073('0x13'),_0x105e78,_0x3073('0x14'));_0x3e631f(_0x4243cf[_0x3073('0x1a')]['message']);}})[_0x3073('0x1b')](function(_0x17bdab){logger[_0x3073('0x17')](_0x3073('0x13'),_0x105e78,_0x17bdab);_0x923b40(_0x17bdab);});});}exports[_0x3073('0x1c')]=function(_0x1e94cb){var _0x58cdc4=this;return new Promise(function(_0x4479f3,_0x1e3ebc){return db[_0x3073('0x1d')]['create'](_0x1e94cb['body'],{'raw':_0x1e94cb[_0x3073('0x1e')]?_0x1e94cb['options'][_0x3073('0x1f')]===undefined?!![]:![]:!![]})[_0x3073('0x20')](function(_0x3da25c){logger['info'](_0x3073('0x1c'),_0x1e94cb);logger['debug'](_0x3073('0x1c'),_0x1e94cb,JSON[_0x3073('0x16')](_0x3da25c));_0x4479f3(_0x3da25c);})[_0x3073('0x1b')](function(_0x530594){logger[_0x3073('0x17')]('CreateSmsMessage',_0x530594[_0x3073('0x19')],_0x1e94cb);_0x1e3ebc(_0x58cdc4[_0x3073('0x17')](0x1f4,_0x530594[_0x3073('0x19')]));});});}; \ No newline at end of file +var _0x4ef6=['rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsMessage,\x20%s,\x20%s','CreateSmsMessage','create','options','debug','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0x4ef6,0xc6));var _0x64ef=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x4ef6[_0x47e549];return _0x251374;};'use strict';var _=require('lodash');var util=require(_0x64ef('0x0'));var moment=require(_0x64ef('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ef('0x2'))['db'];var utils=require(_0x64ef('0x3'));var logger=require(_0x64ef('0x4'))(_0x64ef('0x5'));var config=require('../../config/environment');var jayson=require(_0x64ef('0x6'));var client=jayson[_0x64ef('0x7')][_0x64ef('0x8')]({'port':0x232a});config[_0x64ef('0x9')]=_[_0x64ef('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x64ef('0xb'))(new Redis(config[_0x64ef('0x9')]));require(_0x64ef('0xc'))[_0x64ef('0xd')](socket);function respondWithRpcPromise(_0x177bc6,_0x425adb,_0x4b9d03){return new BPromise(function(_0x20bd5e,_0x1b7402){return client['request'](_0x177bc6,_0x4b9d03)[_0x64ef('0xe')](function(_0xb5a804){logger[_0x64ef('0xf')]('SmsMessage,\x20%s,\x20%s',_0x425adb,_0x64ef('0x10'));logger['debug'](_0x64ef('0x11'),_0x425adb,'request\x20sent',JSON[_0x64ef('0x12')](_0xb5a804));if(_0xb5a804[_0x64ef('0x13')]){if(_0xb5a804[_0x64ef('0x13')][_0x64ef('0x14')]===0x1f4){logger[_0x64ef('0x13')]('SmsMessage,\x20%s,\x20%s',_0x425adb,_0xb5a804[_0x64ef('0x13')][_0x64ef('0x15')]);return _0x1b7402(_0xb5a804[_0x64ef('0x13')]['message']);}logger[_0x64ef('0x13')]('SmsMessage,\x20%s,\x20%s',_0x425adb,_0xb5a804['error']['message']);return _0x20bd5e(_0xb5a804[_0x64ef('0x13')]['message']);}else{logger[_0x64ef('0xf')]('SmsMessage,\x20%s,\x20%s',_0x425adb,_0x64ef('0x10'));_0x20bd5e(_0xb5a804[_0x64ef('0x16')]['message']);}})[_0x64ef('0x17')](function(_0x4ba6e5){logger['error'](_0x64ef('0x18'),_0x425adb,_0x4ba6e5);_0x1b7402(_0x4ba6e5);});});}exports[_0x64ef('0x19')]=function(_0x2d0cd4){var _0x52971b=this;return new Promise(function(_0x51277d,_0x823572){return db['SmsMessage'][_0x64ef('0x1a')](_0x2d0cd4['body'],{'raw':_0x2d0cd4[_0x64ef('0x1b')]?_0x2d0cd4['options']['raw']===undefined?!![]:![]:!![]})[_0x64ef('0xe')](function(_0x2d0be9){logger[_0x64ef('0xf')](_0x64ef('0x19'),_0x2d0cd4);logger[_0x64ef('0x1c')](_0x64ef('0x19'),_0x2d0cd4,JSON[_0x64ef('0x12')](_0x2d0be9));_0x51277d(_0x2d0be9);})[_0x64ef('0x17')](function(_0x3acec5){logger[_0x64ef('0x13')](_0x64ef('0x19'),_0x3acec5[_0x64ef('0x15')],_0x2d0cd4);_0x823572(_0x52971b[_0x64ef('0x13')](0x1f4,_0x3acec5[_0x64ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 48cd78d..c1227d3 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 _0xe189=['removeListener','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x44e470,_0x13b9e9){var _0x28fd40=function(_0x5b0ab2){while(--_0x5b0ab2){_0x44e470['push'](_0x44e470['shift']());}};_0x28fd40(++_0x13b9e9);}(_0xe189,0x1d8));var _0x9e18=function(_0x5ab48c,_0x45e2d3){_0x5ab48c=_0x5ab48c-0x0;var _0xc25049=_0xe189[_0x5ab48c];return _0xc25049;};'use strict';var SmsMessageEvents=require(_0x9e18('0x0'));var events=[_0x9e18('0x1'),_0x9e18('0x2'),_0x9e18('0x3')];function createListener(_0x21e81d,_0x3f571e){return function(_0x1e46d3){_0x3f571e['emit'](_0x21e81d,_0x1e46d3);};}function removeListener(_0x13c41a,_0x49fd91){return function(){SmsMessageEvents[_0x9e18('0x4')](_0x13c41a,_0x49fd91);};}exports[_0x9e18('0x5')]=function(_0x4ffd49){for(var _0xcecaf4=0x0,_0x3a47d9=events['length'];_0xcecaf4<_0x3a47d9;_0xcecaf4++){var _0x4be306=events[_0xcecaf4];var _0x22b42b=createListener(_0x9e18('0x6')+_0x4be306,_0x4ffd49);SmsMessageEvents['on'](_0x4be306,_0x22b42b);}}; \ No newline at end of file +var _0x96d7=['register','save','update'];(function(_0x1bb939,_0x5905e9){var _0xf8e8a6=function(_0xb86dce){while(--_0xb86dce){_0x1bb939['push'](_0x1bb939['shift']());}};_0xf8e8a6(++_0x5905e9);}(_0x96d7,0x184));var _0x796d=function(_0x558ce2,_0x1adca8){_0x558ce2=_0x558ce2-0x0;var _0x1d0ab7=_0x96d7[_0x558ce2];return _0x1d0ab7;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x796d('0x0'),'remove',_0x796d('0x1')];function createListener(_0x1f4244,_0xde7649){return function(_0xa51582){_0xde7649['emit'](_0x1f4244,_0xa51582);};}function removeListener(_0x170f40,_0x4d4a6f){return function(){SmsMessageEvents['removeListener'](_0x170f40,_0x4d4a6f);};}exports[_0x796d('0x2')]=function(_0x5d55b8){for(var _0x1f302b=0x0,_0x11d2f6=events['length'];_0x1f302b<_0x11d2f6;_0x1f302b++){var _0x309dd2=events[_0x1f302b];var _0x5cb7c5=createListener('smsMessage:'+_0x309dd2,_0x5d55b8);SmsMessageEvents['on'](_0x309dd2,_0x5cb7c5);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8b8b75d..6f91394 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 _0xfe64=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xfe64,0x94));var _0x4fe6=function(_0x388334,_0x436e8a){_0x388334=_0x388334-0x0;var _0x526544=_0xfe64[_0x388334];return _0x526544;};'use strict';var multer=require(_0x4fe6('0x0'));var util=require(_0x4fe6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4fe6('0x2'));var router=express['Router']();var fs_extra=require(_0x4fe6('0x3'));var auth=require(_0x4fe6('0x4'));var interaction=require(_0x4fe6('0x5'));var config=require(_0x4fe6('0x6'));var controller=require(_0x4fe6('0x7'));router[_0x4fe6('0x8')]('/',auth['isAuthenticated'](),controller[_0x4fe6('0x9')]);router[_0x4fe6('0x8')](_0x4fe6('0xa'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0xc')]);router[_0x4fe6('0x8')](_0x4fe6('0xd'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0xe')]);router[_0x4fe6('0x8')](_0x4fe6('0xf'),auth[_0x4fe6('0xb')](),controller['getMembers']);router[_0x4fe6('0x8')](_0x4fe6('0x10'),auth['isAuthenticated'](),controller[_0x4fe6('0x11')]);router[_0x4fe6('0x8')](_0x4fe6('0x12'),auth['isAuthenticated'](),controller[_0x4fe6('0x13')]);router[_0x4fe6('0x14')]('/',auth['isAuthenticated'](),controller[_0x4fe6('0x15')]);router[_0x4fe6('0x14')](_0x4fe6('0x10'),auth['isAuthenticated'](),controller[_0x4fe6('0x16')]);router['post'](_0x4fe6('0x12'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x17')]);router['put']('/:id',auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x18')]);router[_0x4fe6('0x19')](_0x4fe6('0xd'),auth['isAuthenticated'](),controller[_0x4fe6('0x1a')]);router[_0x4fe6('0x19')](_0x4fe6('0x10'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x1b')]);router[_0x4fe6('0x19')]('/:id/users',auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x1c')]);module[_0x4fe6('0x1d')]=router; \ No newline at end of file +var _0xf2cc=['isAuthenticated','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','addTeams','post','put','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xf2cc,0xc8));var _0xcf2c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xf2cc[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0xcf2c('0x0'));var path=require(_0xcf2c('0x1'));var timeout=require(_0xcf2c('0x2'));var express=require('express');var router=express[_0xcf2c('0x3')]();var fs_extra=require(_0xcf2c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf2c('0x5'));var config=require(_0xcf2c('0x6'));var controller=require(_0xcf2c('0x7'));router['get']('/',auth[_0xcf2c('0x8')](),controller['index']);router[_0xcf2c('0x9')](_0xcf2c('0xa'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0xb')]);router[_0xcf2c('0x9')](_0xcf2c('0xc'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0xd')]);router[_0xcf2c('0x9')](_0xcf2c('0xe'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xcf2c('0xf'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0x10')]);router['get'](_0xcf2c('0x11'),auth['isAuthenticated'](),controller[_0xcf2c('0x12')]);router['post']('/',auth[_0xcf2c('0x8')](),controller['create']);router['post'](_0xcf2c('0xf'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0x13')]);router[_0xcf2c('0x14')](_0xcf2c('0x11'),auth[_0xcf2c('0x8')](),controller['addAgents']);router[_0xcf2c('0x15')](_0xcf2c('0xc'),auth[_0xcf2c('0x8')](),controller['update']);router[_0xcf2c('0x16')](_0xcf2c('0xc'),auth['isAuthenticated'](),controller[_0xcf2c('0x17')]);router[_0xcf2c('0x16')](_0xcf2c('0xf'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0x18')]);router[_0xcf2c('0x16')](_0xcf2c('0x11'),auth[_0xcf2c('0x8')](),controller[_0xcf2c('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 18a4127..93233be 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 _0x7a69=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x7a69,0x9e));var _0x97a6=function(_0x20aeb4,_0x27bcce){_0x20aeb4=_0x20aeb4-0x0;var _0x37571b=_0x7a69[_0x20aeb4];return _0x37571b;};'use strict';var Sequelize=require(_0x97a6('0x0'));module[_0x97a6('0x1')]={'name':{'type':Sequelize[_0x97a6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97a6('0x2')]},'timeout':{'type':Sequelize[_0x97a6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97a6('0x4')]('rrmemory','beepall',_0x97a6('0x5'))}}; \ No newline at end of file +var _0xc34a=['sequelize','exports','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x53e720,_0x2c4c99){var _0x4aa714=function(_0x21bc45){while(--_0x21bc45){_0x53e720['push'](_0x53e720['shift']());}};_0x4aa714(++_0x2c4c99);}(_0xc34a,0xbd));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac34('0x0'));module[_0xac34('0x1')]={'name':{'type':Sequelize[_0xac34('0x2')],'unique':_0xac34('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac34('0x2')]},'timeout':{'type':Sequelize[_0xac34('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac34('0x5')]('rrmemory','beepall',_0xac34('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c752aaa..4e624af 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 _0x61f1=['rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','catch','params','describe','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','smsPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','value','ids','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','findOne','rimraf','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','sendStatus','name'];(function(_0x11c9ab,_0x13caac){var _0x16bff0=function(_0x17b881){while(--_0x17b881){_0x11c9ab['push'](_0x11c9ab['shift']());}};_0x16bff0(++_0x13caac);}(_0x61f1,0xde));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x161f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161f('0x1'));var rp=require(_0x161f('0x2'));var moment=require(_0x161f('0x3'));var BPromise=require(_0x161f('0x4'));var Mustache=require(_0x161f('0x5'));var util=require(_0x161f('0x6'));var path=require(_0x161f('0x7'));var sox=require(_0x161f('0x8'));var csv=require(_0x161f('0x9'));var ejs=require(_0x161f('0xa'));var fs=require('fs');var fs_extra=require(_0x161f('0xb'));var _=require('lodash');var squel=require(_0x161f('0xc'));var crypto=require(_0x161f('0xd'));var jsforce=require(_0x161f('0xe'));var deskjs=require(_0x161f('0xf'));var toCsv=require(_0x161f('0x9'));var querystring=require(_0x161f('0x10'));var Papa=require(_0x161f('0x11'));var Redis=require(_0x161f('0x12'));var authService=require(_0x161f('0x13'));var qs=require(_0x161f('0x14'));var as=require(_0x161f('0x15'));var hardwareService=require(_0x161f('0x16'));var logger=require(_0x161f('0x17'))(_0x161f('0x18'));var utils=require(_0x161f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x161f('0x1a'));var db=require(_0x161f('0x1b'))['db'];config[_0x161f('0x1c')]=_[_0x161f('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x161f('0x1e'))(new Redis(config[_0x161f('0x1c')]));require(_0x161f('0x1f'))[_0x161f('0x20')](socket);function respondWithStatusCode(_0x110513,_0x12b78b){_0x12b78b=_0x12b78b||0xcc;return function(_0x5a899d){if(_0x5a899d){return _0x110513['sendStatus'](_0x12b78b);}return _0x110513[_0x161f('0x21')](_0x12b78b)['end']();};}function respondWithResult(_0x39dcf3,_0x115995){_0x115995=_0x115995||0xc8;return function(_0x5b5cae){if(_0x5b5cae){return _0x39dcf3[_0x161f('0x21')](_0x115995)['json'](_0x5b5cae);}};}function respondWithFilteredResult(_0x34fc2a,_0x35ffce){return function(_0x105eb8){if(_0x105eb8){var _0x2161e8=typeof _0x35ffce[_0x161f('0x22')]===_0x161f('0x23')&&typeof _0x35ffce['limit']===_0x161f('0x23');var _0x2f5dd2=_0x105eb8[_0x161f('0x24')];var _0xe48633=_0x2161e8?0x0:_0x35ffce[_0x161f('0x22')];var _0x3ea435=_0x2161e8?_0x105eb8[_0x161f('0x24')]:_0x35ffce['offset']+_0x35ffce[_0x161f('0x25')];var _0x2e3280;if(_0x3ea435>=_0x2f5dd2){_0x3ea435=_0x2f5dd2;_0x2e3280=0xc8;}else{_0x2e3280=0xce;}_0x34fc2a[_0x161f('0x21')](_0x2e3280);return _0x34fc2a[_0x161f('0x26')](_0x161f('0x27'),_0xe48633+'-'+_0x3ea435+'/'+_0x2f5dd2)[_0x161f('0x28')](_0x105eb8);}return null;};}function patchUpdates(_0x314423){return function(_0x4d9e49){try{jsonpatch['apply'](_0x4d9e49,_0x314423,!![]);}catch(_0x306ea4){return BPromise[_0x161f('0x29')](_0x306ea4);}return _0x4d9e49[_0x161f('0x2a')]();};}function saveUpdates(_0x27236a,_0x4ab4f8){return function(_0x93cd8e){if(_0x93cd8e){return _0x93cd8e[_0x161f('0x2b')](_0x27236a)[_0x161f('0x2c')](function(_0xfb2ffb){return _0xfb2ffb;});}return null;};}function removeEntity(_0x40f67,_0x45663a){return function(_0x4672d5){if(_0x4672d5){return _0x4672d5[_0x161f('0x2d')]()[_0x161f('0x2c')](function(){var _0x17f212=_0x4672d5[_0x161f('0x2e')]({'plain':!![]});var _0x11f841=_0x161f('0x2f');return db[_0x161f('0x30')]['destroy']({'where':{'type':_0x11f841,'resourceId':_0x17f212['id']}})[_0x161f('0x2c')](function(){return _0x4672d5;});})[_0x161f('0x2c')](function(){_0x40f67[_0x161f('0x21')](0xcc)[_0x161f('0x31')]();});}};}function handleEntityNotFound(_0x42ef43,_0x5e255b){return function(_0x10f4ff){if(!_0x10f4ff){_0x42ef43[_0x161f('0x32')](0x194);}return _0x10f4ff;};}function handleError(_0x236c32,_0x48ad4c){_0x48ad4c=_0x48ad4c||0x1f4;return function(_0x266882){logger['error'](_0x266882['stack']);if(_0x266882[_0x161f('0x33')]){delete _0x266882[_0x161f('0x33')];}_0x236c32['status'](_0x48ad4c)['send'](_0x266882);};}exports['index']=function(_0x5625f3,_0x53ab2e){var _0xd81b5d={},_0x346e68={},_0x94e146={'count':0x0,'rows':[]};var _0x1c9f78=_['map'](db['SmsQueue'][_0x161f('0x34')],function(_0x47df9c){return{'name':_0x47df9c['fieldName'],'type':_0x47df9c['type'][_0x161f('0x35')]};});_0x346e68[_0x161f('0x36')]=_[_0x161f('0x37')](_0x1c9f78,_0x161f('0x33'));_0x346e68[_0x161f('0x38')]=_[_0x161f('0x39')](_0x5625f3[_0x161f('0x38')]);_0x346e68['filters']=_[_0x161f('0x3a')](_0x346e68['model'],_0x346e68['query']);_0xd81b5d[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x346e68[_0x161f('0x36')],qs[_0x161f('0x3c')](_0x5625f3['query']['fields']));_0xd81b5d[_0x161f('0x3b')]=_0xd81b5d[_0x161f('0x3b')][_0x161f('0x3d')]?_0xd81b5d[_0x161f('0x3b')]:_0x346e68[_0x161f('0x36')];if(!_0x5625f3[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0xd81b5d[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x5625f3[_0x161f('0x38')][_0x161f('0x25')]);_0xd81b5d[_0x161f('0x22')]=qs[_0x161f('0x22')](_0x5625f3[_0x161f('0x38')]['offset']);}_0xd81b5d[_0x161f('0x40')]=qs[_0x161f('0x41')](_0x5625f3[_0x161f('0x38')][_0x161f('0x41')]);_0xd81b5d['where']=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0x5625f3[_0x161f('0x38')],_0x346e68[_0x161f('0x42')]),_0x1c9f78);if(_0x5625f3[_0x161f('0x38')][_0x161f('0x44')]){_0xd81b5d[_0x161f('0x45')]=_[_0x161f('0x46')](_0xd81b5d[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x1c9f78,function(_0x58113f){if(_0x58113f[_0x161f('0x47')]!==_0x161f('0x48')){var _0x2bfa13={};_0x2bfa13[_0x58113f['name']]={'$like':'%'+_0x5625f3[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x2bfa13;}})});}_0xd81b5d=_['merge']({},_0xd81b5d,_0x5625f3[_0x161f('0x49')]);var _0x515153={'where':_0xd81b5d[_0x161f('0x45')]};return db[_0x161f('0x4a')][_0x161f('0x24')](_0x515153)[_0x161f('0x2c')](function(_0x127619){_0x94e146[_0x161f('0x24')]=_0x127619;if(_0x5625f3['query'][_0x161f('0x4b')]){_0xd81b5d[_0x161f('0x4c')]=[{'all':!![]}];}return db[_0x161f('0x4a')][_0x161f('0x4d')](_0xd81b5d);})['then'](function(_0x76880){_0x94e146[_0x161f('0x4e')]=_0x76880;return _0x94e146;})['then'](respondWithFilteredResult(_0x53ab2e,_0xd81b5d))['catch'](handleError(_0x53ab2e,null));};exports[_0x161f('0x4f')]=function(_0x29df5c,_0x3c0bc3){var _0x38c660={'raw':!![],'where':{'id':_0x29df5c['params']['id']}},_0x1f2e20={};_0x1f2e20['model']=_[_0x161f('0x39')](db[_0x161f('0x4a')][_0x161f('0x34')]);_0x1f2e20['query']=_[_0x161f('0x39')](_0x29df5c[_0x161f('0x38')]);_0x1f2e20['filters']=_['intersection'](_0x1f2e20[_0x161f('0x36')],_0x1f2e20[_0x161f('0x38')]);_0x38c660[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x1f2e20['model'],qs['fields'](_0x29df5c[_0x161f('0x38')]['fields']));_0x38c660['attributes']=_0x38c660[_0x161f('0x3b')]['length']?_0x38c660[_0x161f('0x3b')]:_0x1f2e20['model'];if(_0x29df5c[_0x161f('0x38')][_0x161f('0x4b')]){_0x38c660[_0x161f('0x4c')]=[{'all':!![]}];}_0x38c660=_[_0x161f('0x46')]({},_0x38c660,_0x29df5c[_0x161f('0x49')]);return db[_0x161f('0x4a')]['find'](_0x38c660)['then'](handleEntityNotFound(_0x3c0bc3,null))['then'](respondWithResult(_0x3c0bc3,null))['catch'](handleError(_0x3c0bc3,null));};exports[_0x161f('0x50')]=function(_0x36e559,_0x463206){return db['SmsQueue']['create'](_0x36e559[_0x161f('0x51')],{})['then'](function(_0x4a9faf){var _0x148369=_0x36e559[_0x161f('0x52')][_0x161f('0x2e')]({'plain':!![]});if(!_0x148369)throw new Error(_0x161f('0x53'));if(_0x148369[_0x161f('0x54')]===_0x161f('0x52')){var _0x5ecd36=_0x4a9faf[_0x161f('0x2e')]({'plain':!![]});var _0x428415='SmsQueues';return db[_0x161f('0x55')][_0x161f('0x56')]({'where':{'name':_0x428415,'userProfileId':_0x148369[_0x161f('0x57')]},'raw':!![]})[_0x161f('0x2c')](function(_0x398221){if(_0x398221&&_0x398221['autoAssociation']===0x0){return db[_0x161f('0x30')][_0x161f('0x50')]({'name':_0x5ecd36[_0x161f('0x33')],'resourceId':_0x5ecd36['id'],'type':_0x398221[_0x161f('0x33')],'sectionId':_0x398221['id']},{})[_0x161f('0x2c')](function(){return _0x4a9faf;});}else{return _0x4a9faf;}})['catch'](function(_0x5be0c7){logger[_0x161f('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5be0c7);throw _0x5be0c7;});}return _0x4a9faf;})[_0x161f('0x2c')](respondWithResult(_0x463206,0xc9))[_0x161f('0x59')](handleError(_0x463206,null));};exports['update']=function(_0x444c6d,_0x272a5d){if(_0x444c6d[_0x161f('0x51')]['id']){delete _0x444c6d[_0x161f('0x51')]['id'];}return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x444c6d[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x272a5d,null))['then'](saveUpdates(_0x444c6d['body'],null))[_0x161f('0x2c')](respondWithResult(_0x272a5d,null))[_0x161f('0x59')](handleError(_0x272a5d,null));};exports['destroy']=function(_0x4336f5,_0x294596){return db[_0x161f('0x4a')]['find']({'where':{'id':_0x4336f5['params']['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x294596,null))[_0x161f('0x2c')](removeEntity(_0x294596,null))[_0x161f('0x59')](handleError(_0x294596,null));};exports[_0x161f('0x5b')]=function(_0x86513c,_0x138425){return db[_0x161f('0x4a')][_0x161f('0x5b')]()[_0x161f('0x2c')](respondWithResult(_0x138425,null))['catch'](handleError(_0x138425,null));};exports['getMembers']=function(_0x124726,_0x54e011,_0x15f992){var _0x2f5063={'raw':!![],'where':{}},_0x19df49={},_0x3ea9e6;return db[_0x161f('0x4a')]['findOne']({'where':{'id':_0x124726[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54e011,null))['then'](function(_0x447247){if(_0x447247){_0x3ea9e6=_0x447247[_0x161f('0x2e')]({'plain':!![]});_0x19df49['model']=_[_0x161f('0x39')](db[_0x161f('0x5c')][_0x161f('0x34')]);_0x19df49[_0x161f('0x38')]=_['keys'](_0x124726[_0x161f('0x38')]);_0x19df49[_0x161f('0x42')]=_[_0x161f('0x3a')](_0x19df49[_0x161f('0x36')],_0x19df49[_0x161f('0x38')]);_0x2f5063[_0x161f('0x3b')]=_['intersection'](_0x19df49['model'],qs[_0x161f('0x3c')](_0x124726[_0x161f('0x38')]['fields']));_0x2f5063[_0x161f('0x3b')]=_0x2f5063[_0x161f('0x3b')][_0x161f('0x3d')]?_0x2f5063[_0x161f('0x3b')]:_0x19df49[_0x161f('0x36')];if(!_0x124726[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0x2f5063[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x124726[_0x161f('0x38')]['limit']);_0x2f5063[_0x161f('0x22')]=qs['offset'](_0x124726[_0x161f('0x38')][_0x161f('0x22')]);}_0x2f5063[_0x161f('0x40')]=qs['sort'](_0x124726[_0x161f('0x38')]['sort']);_0x2f5063[_0x161f('0x45')]=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0x124726['query'],_0x19df49[_0x161f('0x42')]));_0x2f5063[_0x161f('0x45')][_0x161f('0x5d')]=_0x447247['id'];if(_0x124726[_0x161f('0x38')][_0x161f('0x44')]){_0x2f5063[_0x161f('0x45')]=_[_0x161f('0x46')](_0x2f5063['where'],{'$or':_[_0x161f('0x37')](_0x2f5063[_0x161f('0x3b')],function(_0x36e30d){var _0x19de87={};_0x19de87[_0x36e30d]={'$like':'%'+_0x124726[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x19de87;})});}_0x2f5063=_[_0x161f('0x46')]({},_0x2f5063,_0x124726['options']);return db['UserSmsQueue'][_0x161f('0x4d')](_0x2f5063);}})['then'](function(_0x4ab3d6){if(_0x4ab3d6){return db['User'][_0x161f('0x5e')]({'where':{'id':_['map'](_0x4ab3d6,_0x161f('0x5f')),'role':'agent'},'attributes':['id','name',_0x161f('0x60'),_0x161f('0x61'),_0x161f('0x62')]});}})[_0x161f('0x2c')](function(_0x100c01){if(_0x100c01){return{'count':_0x100c01[_0x161f('0x24')],'rows':_[_0x161f('0x37')](_0x100c01[_0x161f('0x4e')],function(_0x43e5fd){return{'membername':_0x43e5fd[_0x161f('0x33')],'UserId':_0x43e5fd['id'],'queue_name':_0x3ea9e6[_0x161f('0x33')],'SmsQueueId':_0x3ea9e6['id'],'interface':util['format']('%s/%s',_0x161f('0x63'),_0x43e5fd[_0x161f('0x33')]),'penalty':0x0,'paused':_0x43e5fd[_0x161f('0x60')],'createdAt':_0x43e5fd['createdAt'],'updatedAt':_0x43e5fd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x161f('0x2c')](respondWithFilteredResult(_0x54e011,_0x2f5063))[_0x161f('0x59')](handleError(_0x54e011,null));};exports['getTeams']=function(_0x1e76dc,_0x268228,_0x23bde3){var _0x5e7abc={};var _0x116ead={};var _0x45d3fe;var _0x4cad83;return db[_0x161f('0x4a')]['findOne']({'where':{'id':_0x1e76dc[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x268228,null))['then'](function(_0x3fec96){if(_0x3fec96){_0x45d3fe=_0x3fec96;_0x116ead[_0x161f('0x36')]=_[_0x161f('0x39')](db[_0x161f('0x64')]['rawAttributes']);_0x116ead[_0x161f('0x38')]=_['keys'](_0x1e76dc[_0x161f('0x38')]);_0x116ead[_0x161f('0x42')]=_[_0x161f('0x3a')](_0x116ead[_0x161f('0x36')],_0x116ead[_0x161f('0x38')]);_0x5e7abc[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x116ead[_0x161f('0x36')],qs[_0x161f('0x3c')](_0x1e76dc[_0x161f('0x38')][_0x161f('0x3c')]));_0x5e7abc[_0x161f('0x3b')]=_0x5e7abc[_0x161f('0x3b')][_0x161f('0x3d')]?_0x5e7abc[_0x161f('0x3b')]:_0x116ead[_0x161f('0x36')];_0x5e7abc[_0x161f('0x40')]=qs['sort'](_0x1e76dc[_0x161f('0x38')][_0x161f('0x41')]);_0x5e7abc[_0x161f('0x45')]=qs['filters'](_[_0x161f('0x43')](_0x1e76dc['query'],_0x116ead[_0x161f('0x42')]));if(_0x1e76dc[_0x161f('0x38')][_0x161f('0x44')]){_0x5e7abc[_0x161f('0x45')]=_[_0x161f('0x46')](_0x5e7abc[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x5e7abc[_0x161f('0x3b')],function(_0x7908e7){var _0x5d0eff={};_0x5d0eff[_0x7908e7]={'$like':'%'+_0x1e76dc['query']['filter']+'%'};return _0x5d0eff;})});}_0x5e7abc=_[_0x161f('0x46')]({},_0x5e7abc,_0x1e76dc[_0x161f('0x49')]);return _0x45d3fe[_0x161f('0x65')](_0x5e7abc);}})[_0x161f('0x2c')](function(_0xc66979){if(_0xc66979){_0x4cad83=_0xc66979['length'];if(!_0x1e76dc['query'][_0x161f('0x3e')](_0x161f('0x3f'))){_0x5e7abc[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x1e76dc[_0x161f('0x38')]['limit']);_0x5e7abc[_0x161f('0x22')]=qs['offset'](_0x1e76dc[_0x161f('0x38')][_0x161f('0x22')]);}return _0x45d3fe['getTeams'](_0x5e7abc);}})[_0x161f('0x2c')](function(_0x582701){if(_0x582701){return _0x582701?{'count':_0x4cad83,'rows':_0x582701}:null;}})[_0x161f('0x2c')](respondWithResult(_0x268228,null))[_0x161f('0x59')](handleError(_0x268228,null));};exports[_0x161f('0x66')]=function(_0x5d9691,_0x1eb815,_0x524967){var _0x248f6d=_0x5d9691['body']['ids'];return db[_0x161f('0x64')]['findAll']({'where':{'id':_0x248f6d},'attributes':['id'],'include':[{'model':db[_0x161f('0x67')],'as':_0x161f('0x68'),'attributes':['id','name',_0x161f('0x69'),_0x161f('0x6a'),'interface'],'raw':!![]}]})[_0x161f('0x2c')](function(_0xa717be){if(_0xa717be){var _0xeecff4=_[_0x161f('0x6b')](_0xa717be,function(_0x372e77){var _0x29b75f=_0x372e77[_0x161f('0x2e')]({'plain':!![]});return _0x29b75f[_0x161f('0x68')];});return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x5d9691['params']['id']}})[_0x161f('0x2c')](function(_0x1a75e9){return db['sequelize']['transaction'](function(_0x4280fa){return _0x1a75e9[_0x161f('0x66')](_0x248f6d,{'transaction':_0x4280fa})[_0x161f('0x2c')](function(){return BPromise['each'](_0xeecff4,function(_0x271902){return db[_0x161f('0x5c')][_0x161f('0x6c')]({'where':{'UserId':_0x271902['id'],'SmsQueueId':_0x5d9691[_0x161f('0x5a')]['id']},'transaction':_0x4280fa});});})[_0x161f('0x2c')](function(){_0xeecff4[_0x161f('0x6d')](function(_0x384439){socket['emit'](_0x161f('0x6e'),{'UserId':_0x384439['id'],'SmsQueueId':_0x1a75e9['id']});});});});});}})[_0x161f('0x2c')](respondWithStatusCode(_0x1eb815,null))[_0x161f('0x59')](handleError(_0x1eb815,null));};exports[_0x161f('0x6f')]=function(_0x53272f,_0x9d824f,_0x76667e){return db[_0x161f('0x64')][_0x161f('0x4d')]({'where':{'id':_0x53272f[_0x161f('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x161f('0x67')],'as':_0x161f('0x68'),'attributes':['id'],'raw':!![]}]})[_0x161f('0x2c')](handleEntityNotFound(_0x9d824f,null))[_0x161f('0x2c')](function(_0x4c2455){var _0x4a62c1=_[_0x161f('0x37')](_0x4c2455,'id');var _0x26d106=[];var _0xa8e93b=[];var _0x2dc4c9=squel[_0x161f('0x70')]();_0x2dc4c9[_0x161f('0x71')]('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x161f('0x72')](_0x161f('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x161f('0x74'),_0x53272f[_0x161f('0x5a')]['id']);for(var _0x491411=0x0;_0x491411<_0x4c2455[_0x161f('0x3d')];_0x491411+=0x1){let _0x2b47b5=_0x4c2455[_0x491411];for(var _0x2d9f96=0x0;_0x2d9f96<_0x2b47b5['Agents'][_0x161f('0x3d')];_0x2d9f96+=0x1){let _0x69ce17=_0x2b47b5[_0x161f('0x68')][_0x2d9f96];var _0x51124e=_0x2dc4c9['clone']();_0x51124e['where'](_0x161f('0x75'),_0x69ce17['id']);_0xa8e93b[_0x161f('0x76')](db[_0x161f('0x77')][_0x161f('0x38')](_0x51124e[_0x161f('0x78')](),{'type':db['sequelize']['QueryTypes'][_0x161f('0x79')]})[_0x161f('0x2c')](function(_0x3f6312){if(_0x3f6312[_0x161f('0x3d')]===0x1){return _0x69ce17['id'];}else{var _0x2b9e01=_[_0x161f('0x7a')](_['map'](_0x3f6312,_0x161f('0x7b')),function(_0x540b02){return _[_0x161f('0x7c')](_0x4a62c1,_0x540b02);});if(_0x2b9e01){return _0x69ce17['id'];}}}));}}return BPromise['all'](_0xa8e93b)[_0x161f('0x2c')](function(_0x4c7464){_0x26d106=_(_0x26d106)[_0x161f('0x7d')](_0x4c7464)['compact']()[_0x161f('0x7e')]();return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x53272f[_0x161f('0x5a')]['id']}})['then'](function(_0x4a14cf){return db[_0x161f('0x77')]['transaction'](function(_0xd669a9){return _0x4a14cf[_0x161f('0x6f')](_0x53272f[_0x161f('0x38')][_0x161f('0x7f')],{'transaction':_0xd669a9})[_0x161f('0x2c')](function(){if(!_['isEmpty'](_0x26d106)){return _0x4a14cf[_0x161f('0x80')](_0x26d106,{'transaction':_0xd669a9});}})[_0x161f('0x2c')](function(){_0x26d106[_0x161f('0x6d')](function(_0x13f316){socket['emit'](_0x161f('0x81'),{'UserId':_0x13f316,'SmsQueueId':_0x4a14cf['id']});});});});});});})[_0x161f('0x2c')](respondWithStatusCode(_0x9d824f,null))[_0x161f('0x59')](handleError(_0x9d824f,null));};exports['addAgents']=function(_0x1bedea,_0x373423,_0x10d3d6){return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x1bedea[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x373423,null))[_0x161f('0x2c')](function(_0x18cc1b){if(_0x18cc1b){return _0x18cc1b[_0x161f('0x82')](_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')],_[_0x161f('0x83')](_0x1bedea[_0x161f('0x51')],[_0x161f('0x7f'),'id'])||{})[_0x161f('0x84')](function(_0x203835){for(var _0x25bffc=0x0;_0x25bffc<_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')][_0x161f('0x3d')];_0x25bffc+=0x1){socket[_0x161f('0x85')](_0x161f('0x6e'),{'UserId':Number(_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')][_0x25bffc]),'SmsQueueId':Number(_0x1bedea['params']['id'])});}return _0x203835;});}})[_0x161f('0x2c')](respondWithResult(_0x373423,null))[_0x161f('0x59')](handleError(_0x373423,null));};exports[_0x161f('0x80')]=function(_0x8c278e,_0x3f1b67,_0x59a273){return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x8c278e[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x3f1b67,null))[_0x161f('0x2c')](function(_0xa34eee){if(_0xa34eee){return _0xa34eee[_0x161f('0x80')](_0x8c278e[_0x161f('0x38')][_0x161f('0x7f')])['then'](function(){if(_[_0x161f('0x86')](_0x8c278e[_0x161f('0x38')]['ids'])){for(var _0x120ab1=0x0;_0x120ab1<_0x8c278e[_0x161f('0x38')][_0x161f('0x7f')]['length'];_0x120ab1+=0x1){socket[_0x161f('0x85')](_0x161f('0x81'),{'UserId':Number(_0x8c278e['query'][_0x161f('0x7f')][_0x120ab1]),'SmsQueueId':Number(_0x8c278e[_0x161f('0x5a')]['id'])});}}else{socket[_0x161f('0x85')](_0x161f('0x81'),{'UserId':Number(_0x8c278e[_0x161f('0x38')]['ids']),'SmsQueueId':Number(_0x8c278e[_0x161f('0x5a')]['id'])});}});}})[_0x161f('0x2c')](respondWithStatusCode(_0x3f1b67,null))[_0x161f('0x59')](handleError(_0x3f1b67,null));};exports[_0x161f('0x87')]=function(_0xbf9dc1,_0x9162e0,_0xd8782d){var _0x2cf24f={};var _0x2f16b4={};var _0x3ef484;var _0x93ba9e;return db[_0x161f('0x4a')][_0x161f('0x88')]({'where':{'id':_0xbf9dc1[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x9162e0,null))['then'](function(_0x306ed8){if(_0x306ed8){_0x3ef484=_0x306ed8;_0x2f16b4['model']=_[_0x161f('0x39')](db[_0x161f('0x67')][_0x161f('0x34')]);_0x2f16b4[_0x161f('0x38')]=_[_0x161f('0x39')](_0xbf9dc1[_0x161f('0x38')]);_0x2f16b4[_0x161f('0x42')]=_['intersection'](_0x2f16b4[_0x161f('0x36')],_0x2f16b4[_0x161f('0x38')]);_0x2cf24f[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x2f16b4[_0x161f('0x36')],qs[_0x161f('0x3c')](_0xbf9dc1[_0x161f('0x38')]['fields']));_0x2cf24f['attributes']=_0x2cf24f[_0x161f('0x3b')][_0x161f('0x3d')]?_0x2cf24f[_0x161f('0x3b')]:_0x2f16b4[_0x161f('0x36')];_0x2cf24f[_0x161f('0x40')]=qs[_0x161f('0x41')](_0xbf9dc1[_0x161f('0x38')][_0x161f('0x41')]);_0x2cf24f['where']=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0xbf9dc1['query'],_0x2f16b4[_0x161f('0x42')]));if(_0xbf9dc1[_0x161f('0x38')][_0x161f('0x44')]){_0x2cf24f[_0x161f('0x45')]=_['merge'](_0x2cf24f[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x2cf24f['attributes'],function(_0x3841c3){var _0x4ae443={};_0x4ae443[_0x3841c3]={'$like':'%'+_0xbf9dc1[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x4ae443;})});}_0x2cf24f=_[_0x161f('0x46')]({},_0x2cf24f,_0xbf9dc1[_0x161f('0x49')]);return _0x3ef484[_0x161f('0x87')](_0x2cf24f);}})[_0x161f('0x2c')](function(_0x1da6b0){if(_0x1da6b0){_0x93ba9e=_0x1da6b0[_0x161f('0x3d')];if(!_0xbf9dc1[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0x2cf24f['limit']=qs[_0x161f('0x25')](_0xbf9dc1['query'][_0x161f('0x25')]);_0x2cf24f[_0x161f('0x22')]=qs[_0x161f('0x22')](_0xbf9dc1[_0x161f('0x38')][_0x161f('0x22')]);}return _0x3ef484[_0x161f('0x87')](_0x2cf24f);}})[_0x161f('0x2c')](function(_0x8903dd){if(_0x8903dd){return _0x8903dd?{'count':_0x93ba9e,'rows':_0x8903dd}:null;}})[_0x161f('0x2c')](respondWithResult(_0x9162e0,null))[_0x161f('0x59')](handleError(_0x9162e0,null));}; \ No newline at end of file +var _0xeb37=['compact','transaction','removeTeams','removeAgents','forEach','emit','userSmsQueue:remove','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','params','rawAttributes','include','merge','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','findOrCreate','userSmsQueue:save','field','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','union'];(function(_0x22ce68,_0x37ef28){var _0x2a0319=function(_0x4ba5c8){while(--_0x4ba5c8){_0x22ce68['push'](_0x22ce68['shift']());}};_0x2a0319(++_0x37ef28);}(_0xeb37,0x1ad));var _0x7eb3=function(_0x2c4585,_0x2297fc){_0x2c4585=_0x2c4585-0x0;var _0x417bb0=_0xeb37[_0x2c4585];return _0x417bb0;};'use strict';var emlformat=require(_0x7eb3('0x0'));var rimraf=require(_0x7eb3('0x1'));var zipdir=require(_0x7eb3('0x2'));var jsonpatch=require(_0x7eb3('0x3'));var rp=require(_0x7eb3('0x4'));var moment=require(_0x7eb3('0x5'));var BPromise=require(_0x7eb3('0x6'));var Mustache=require(_0x7eb3('0x7'));var util=require(_0x7eb3('0x8'));var path=require(_0x7eb3('0x9'));var sox=require(_0x7eb3('0xa'));var csv=require(_0x7eb3('0xb'));var ejs=require(_0x7eb3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7eb3('0xd'));var crypto=require(_0x7eb3('0xe'));var jsforce=require(_0x7eb3('0xf'));var deskjs=require(_0x7eb3('0x10'));var toCsv=require(_0x7eb3('0xb'));var querystring=require('querystring');var Papa=require(_0x7eb3('0x11'));var Redis=require(_0x7eb3('0x12'));var authService=require(_0x7eb3('0x13'));var qs=require(_0x7eb3('0x14'));var as=require(_0x7eb3('0x15'));var hardwareService=require(_0x7eb3('0x16'));var logger=require(_0x7eb3('0x17'))(_0x7eb3('0x18'));var utils=require(_0x7eb3('0x19'));var config=require(_0x7eb3('0x1a'));var licenseUtil=require(_0x7eb3('0x1b'));var db=require(_0x7eb3('0x1c'))['db'];config[_0x7eb3('0x1d')]=_['defaults'](config[_0x7eb3('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x7eb3('0x1e'))(new Redis(config[_0x7eb3('0x1d')]));require(_0x7eb3('0x1f'))[_0x7eb3('0x20')](socket);function respondWithStatusCode(_0x5e252f,_0x35f3ea){_0x35f3ea=_0x35f3ea||0xcc;return function(_0x3d370e){if(_0x3d370e){return _0x5e252f[_0x7eb3('0x21')](_0x35f3ea);}return _0x5e252f[_0x7eb3('0x22')](_0x35f3ea)[_0x7eb3('0x23')]();};}function respondWithResult(_0x37bbbf,_0x482f29){_0x482f29=_0x482f29||0xc8;return function(_0x57037c){if(_0x57037c){return _0x37bbbf[_0x7eb3('0x22')](_0x482f29)[_0x7eb3('0x24')](_0x57037c);}};}function respondWithFilteredResult(_0x1433fd,_0x548830){return function(_0x262ef9){if(_0x262ef9){var _0x1bd814=typeof _0x548830['offset']==='undefined'&&typeof _0x548830['limit']===_0x7eb3('0x25');var _0x21994b=_0x262ef9[_0x7eb3('0x26')];var _0x4572d5=_0x1bd814?0x0:_0x548830[_0x7eb3('0x27')];var _0x4bb323=_0x1bd814?_0x262ef9[_0x7eb3('0x26')]:_0x548830[_0x7eb3('0x27')]+_0x548830['limit'];var _0x1fbdad;if(_0x4bb323>=_0x21994b){_0x4bb323=_0x21994b;_0x1fbdad=0xc8;}else{_0x1fbdad=0xce;}_0x1433fd[_0x7eb3('0x22')](_0x1fbdad);return _0x1433fd[_0x7eb3('0x28')]('Content-Range',_0x4572d5+'-'+_0x4bb323+'/'+_0x21994b)[_0x7eb3('0x24')](_0x262ef9);}return null;};}function patchUpdates(_0x4f5d19){return function(_0x46a15a){try{jsonpatch[_0x7eb3('0x29')](_0x46a15a,_0x4f5d19,!![]);}catch(_0x16d643){return BPromise[_0x7eb3('0x2a')](_0x16d643);}return _0x46a15a[_0x7eb3('0x2b')]();};}function saveUpdates(_0x445b6a,_0x3063b9){return function(_0xc76a5b){if(_0xc76a5b){return _0xc76a5b[_0x7eb3('0x2c')](_0x445b6a)[_0x7eb3('0x2d')](function(_0x32a4f9){return _0x32a4f9;});}return null;};}function removeEntity(_0x517c88,_0xabd430){return function(_0x35211b){if(_0x35211b){return _0x35211b[_0x7eb3('0x2e')]()[_0x7eb3('0x2d')](function(){var _0x48614d=_0x35211b[_0x7eb3('0x2f')]({'plain':!![]});var _0xa4d1a=_0x7eb3('0x30');return db[_0x7eb3('0x31')][_0x7eb3('0x2e')]({'where':{'type':_0xa4d1a,'resourceId':_0x48614d['id']}})[_0x7eb3('0x2d')](function(){return _0x35211b;});})[_0x7eb3('0x2d')](function(){_0x517c88[_0x7eb3('0x22')](0xcc)[_0x7eb3('0x23')]();});}};}function handleEntityNotFound(_0x2e6964,_0x4723ee){return function(_0x501b78){if(!_0x501b78){_0x2e6964['sendStatus'](0x194);}return _0x501b78;};}function handleError(_0x3130f2,_0x15ed37){_0x15ed37=_0x15ed37||0x1f4;return function(_0x33a643){logger[_0x7eb3('0x32')](_0x33a643[_0x7eb3('0x33')]);if(_0x33a643[_0x7eb3('0x34')]){delete _0x33a643[_0x7eb3('0x34')];}_0x3130f2[_0x7eb3('0x22')](_0x15ed37)[_0x7eb3('0x35')](_0x33a643);};}exports[_0x7eb3('0x36')]=function(_0x586288,_0x3d09b8){var _0xeceba9={},_0x3b2a8b={},_0x3b252d={'count':0x0,'rows':[]};var _0x1f8e03=_[_0x7eb3('0x37')](db[_0x7eb3('0x38')]['rawAttributes'],function(_0x198a54){return{'name':_0x198a54['fieldName'],'type':_0x198a54[_0x7eb3('0x39')]['key']};});_0x3b2a8b[_0x7eb3('0x3a')]=_[_0x7eb3('0x37')](_0x1f8e03,_0x7eb3('0x34'));_0x3b2a8b['query']=_[_0x7eb3('0x3b')](_0x586288['query']);_0x3b2a8b[_0x7eb3('0x3c')]=_[_0x7eb3('0x3d')](_0x3b2a8b[_0x7eb3('0x3a')],_0x3b2a8b[_0x7eb3('0x3e')]);_0xeceba9[_0x7eb3('0x3f')]=_['intersection'](_0x3b2a8b[_0x7eb3('0x3a')],qs['fields'](_0x586288['query'][_0x7eb3('0x40')]));_0xeceba9[_0x7eb3('0x3f')]=_0xeceba9[_0x7eb3('0x3f')][_0x7eb3('0x41')]?_0xeceba9[_0x7eb3('0x3f')]:_0x3b2a8b['model'];if(!_0x586288['query'][_0x7eb3('0x42')](_0x7eb3('0x43'))){_0xeceba9[_0x7eb3('0x44')]=qs[_0x7eb3('0x44')](_0x586288[_0x7eb3('0x3e')][_0x7eb3('0x44')]);_0xeceba9['offset']=qs[_0x7eb3('0x27')](_0x586288[_0x7eb3('0x3e')][_0x7eb3('0x27')]);}_0xeceba9[_0x7eb3('0x45')]=qs[_0x7eb3('0x46')](_0x586288[_0x7eb3('0x3e')]['sort']);_0xeceba9[_0x7eb3('0x47')]=qs[_0x7eb3('0x3c')](_[_0x7eb3('0x48')](_0x586288[_0x7eb3('0x3e')],_0x3b2a8b[_0x7eb3('0x3c')]),_0x1f8e03);if(_0x586288[_0x7eb3('0x3e')][_0x7eb3('0x49')]){_0xeceba9[_0x7eb3('0x47')]=_['merge'](_0xeceba9[_0x7eb3('0x47')],{'$or':_['map'](_0x1f8e03,function(_0xc7846c){if(_0xc7846c['type']!==_0x7eb3('0x4a')){var _0x3a62f8={};_0x3a62f8[_0xc7846c[_0x7eb3('0x34')]]={'$like':'%'+_0x586288[_0x7eb3('0x3e')][_0x7eb3('0x49')]+'%'};return _0x3a62f8;}})});}_0xeceba9=_['merge']({},_0xeceba9,_0x586288[_0x7eb3('0x4b')]);var _0x11f0db={'where':_0xeceba9['where']};return db[_0x7eb3('0x38')][_0x7eb3('0x26')](_0x11f0db)[_0x7eb3('0x2d')](function(_0x581b0b){_0x3b252d[_0x7eb3('0x26')]=_0x581b0b;if(_0x586288['query'][_0x7eb3('0x4c')]){_0xeceba9['include']=[{'all':!![]}];}return db[_0x7eb3('0x38')][_0x7eb3('0x4d')](_0xeceba9);})[_0x7eb3('0x2d')](function(_0x292b84){_0x3b252d['rows']=_0x292b84;return _0x3b252d;})[_0x7eb3('0x2d')](respondWithFilteredResult(_0x3d09b8,_0xeceba9))[_0x7eb3('0x4e')](handleError(_0x3d09b8,null));};exports['show']=function(_0x13d903,_0x384b4d){var _0x19899a={'raw':!![],'where':{'id':_0x13d903[_0x7eb3('0x4f')]['id']}},_0x296c3d={};_0x296c3d[_0x7eb3('0x3a')]=_[_0x7eb3('0x3b')](db[_0x7eb3('0x38')][_0x7eb3('0x50')]);_0x296c3d['query']=_[_0x7eb3('0x3b')](_0x13d903[_0x7eb3('0x3e')]);_0x296c3d['filters']=_[_0x7eb3('0x3d')](_0x296c3d[_0x7eb3('0x3a')],_0x296c3d['query']);_0x19899a[_0x7eb3('0x3f')]=_[_0x7eb3('0x3d')](_0x296c3d[_0x7eb3('0x3a')],qs[_0x7eb3('0x40')](_0x13d903['query'][_0x7eb3('0x40')]));_0x19899a[_0x7eb3('0x3f')]=_0x19899a[_0x7eb3('0x3f')][_0x7eb3('0x41')]?_0x19899a['attributes']:_0x296c3d[_0x7eb3('0x3a')];if(_0x13d903[_0x7eb3('0x3e')][_0x7eb3('0x4c')]){_0x19899a[_0x7eb3('0x51')]=[{'all':!![]}];}_0x19899a=_[_0x7eb3('0x52')]({},_0x19899a,_0x13d903['options']);return db[_0x7eb3('0x38')]['find'](_0x19899a)['then'](handleEntityNotFound(_0x384b4d,null))['then'](respondWithResult(_0x384b4d,null))['catch'](handleError(_0x384b4d,null));};exports[_0x7eb3('0x53')]=function(_0x3cf163,_0x1d4229){return db[_0x7eb3('0x38')][_0x7eb3('0x53')](_0x3cf163['body'],{})['then'](function(_0x2d9764){var _0x4c4a68=_0x3cf163['user'][_0x7eb3('0x2f')]({'plain':!![]});if(!_0x4c4a68)throw new Error(_0x7eb3('0x54'));if(_0x4c4a68[_0x7eb3('0x55')]===_0x7eb3('0x56')){var _0x2d4afc=_0x2d9764[_0x7eb3('0x2f')]({'plain':!![]});var _0x5e8fa0=_0x7eb3('0x30');return db[_0x7eb3('0x57')][_0x7eb3('0x58')]({'where':{'name':_0x5e8fa0,'userProfileId':_0x4c4a68[_0x7eb3('0x59')]},'raw':!![]})[_0x7eb3('0x2d')](function(_0x1bfb44){if(_0x1bfb44&&_0x1bfb44[_0x7eb3('0x5a')]===0x0){return db[_0x7eb3('0x31')][_0x7eb3('0x53')]({'name':_0x2d4afc[_0x7eb3('0x34')],'resourceId':_0x2d4afc['id'],'type':_0x1bfb44[_0x7eb3('0x34')],'sectionId':_0x1bfb44['id']},{})[_0x7eb3('0x2d')](function(){return _0x2d9764;});}else{return _0x2d9764;}})[_0x7eb3('0x4e')](function(_0x6f380d){logger[_0x7eb3('0x32')](_0x7eb3('0x5b'),_0x6f380d);throw _0x6f380d;});}return _0x2d9764;})[_0x7eb3('0x2d')](respondWithResult(_0x1d4229,0xc9))[_0x7eb3('0x4e')](handleError(_0x1d4229,null));};exports[_0x7eb3('0x2c')]=function(_0x2a3ef0,_0x588311){if(_0x2a3ef0[_0x7eb3('0x5c')]['id']){delete _0x2a3ef0[_0x7eb3('0x5c')]['id'];}return db[_0x7eb3('0x38')][_0x7eb3('0x58')]({'where':{'id':_0x2a3ef0['params']['id']}})[_0x7eb3('0x2d')](handleEntityNotFound(_0x588311,null))['then'](saveUpdates(_0x2a3ef0['body'],null))[_0x7eb3('0x2d')](respondWithResult(_0x588311,null))['catch'](handleError(_0x588311,null));};exports[_0x7eb3('0x2e')]=function(_0x46f802,_0x1405b9){return db[_0x7eb3('0x38')][_0x7eb3('0x58')]({'where':{'id':_0x46f802[_0x7eb3('0x4f')]['id']}})[_0x7eb3('0x2d')](handleEntityNotFound(_0x1405b9,null))[_0x7eb3('0x2d')](removeEntity(_0x1405b9,null))[_0x7eb3('0x4e')](handleError(_0x1405b9,null));};exports[_0x7eb3('0x5d')]=function(_0x355de7,_0x109d46){return db[_0x7eb3('0x38')][_0x7eb3('0x5d')]()[_0x7eb3('0x2d')](respondWithResult(_0x109d46,null))['catch'](handleError(_0x109d46,null));};exports[_0x7eb3('0x5e')]=function(_0x2a3ef8,_0x10fcf3,_0x33af7d){var _0x1d614f={'raw':!![],'where':{}},_0x517593={},_0x4dbe4b;return db[_0x7eb3('0x38')]['findOne']({'where':{'id':_0x2a3ef8[_0x7eb3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x10fcf3,null))[_0x7eb3('0x2d')](function(_0x2cb1a4){if(_0x2cb1a4){_0x4dbe4b=_0x2cb1a4[_0x7eb3('0x2f')]({'plain':!![]});_0x517593['model']=_['keys'](db[_0x7eb3('0x5f')]['rawAttributes']);_0x517593['query']=_['keys'](_0x2a3ef8[_0x7eb3('0x3e')]);_0x517593[_0x7eb3('0x3c')]=_['intersection'](_0x517593['model'],_0x517593[_0x7eb3('0x3e')]);_0x1d614f['attributes']=_[_0x7eb3('0x3d')](_0x517593['model'],qs[_0x7eb3('0x40')](_0x2a3ef8[_0x7eb3('0x3e')][_0x7eb3('0x40')]));_0x1d614f[_0x7eb3('0x3f')]=_0x1d614f[_0x7eb3('0x3f')][_0x7eb3('0x41')]?_0x1d614f[_0x7eb3('0x3f')]:_0x517593[_0x7eb3('0x3a')];if(!_0x2a3ef8[_0x7eb3('0x3e')][_0x7eb3('0x42')](_0x7eb3('0x43'))){_0x1d614f[_0x7eb3('0x44')]=qs['limit'](_0x2a3ef8[_0x7eb3('0x3e')]['limit']);_0x1d614f[_0x7eb3('0x27')]=qs[_0x7eb3('0x27')](_0x2a3ef8[_0x7eb3('0x3e')][_0x7eb3('0x27')]);}_0x1d614f[_0x7eb3('0x45')]=qs['sort'](_0x2a3ef8['query'][_0x7eb3('0x46')]);_0x1d614f[_0x7eb3('0x47')]=qs['filters'](_[_0x7eb3('0x48')](_0x2a3ef8[_0x7eb3('0x3e')],_0x517593[_0x7eb3('0x3c')]));_0x1d614f[_0x7eb3('0x47')]['SmsQueueId']=_0x2cb1a4['id'];if(_0x2a3ef8[_0x7eb3('0x3e')]['filter']){_0x1d614f[_0x7eb3('0x47')]=_[_0x7eb3('0x52')](_0x1d614f[_0x7eb3('0x47')],{'$or':_[_0x7eb3('0x37')](_0x1d614f['attributes'],function(_0x5d3a2a){var _0x3a9458={};_0x3a9458[_0x5d3a2a]={'$like':'%'+_0x2a3ef8[_0x7eb3('0x3e')]['filter']+'%'};return _0x3a9458;})});}_0x1d614f=_[_0x7eb3('0x52')]({},_0x1d614f,_0x2a3ef8[_0x7eb3('0x4b')]);return db[_0x7eb3('0x5f')][_0x7eb3('0x4d')](_0x1d614f);}})[_0x7eb3('0x2d')](function(_0x370672){if(_0x370672){return db[_0x7eb3('0x60')][_0x7eb3('0x61')]({'where':{'id':_[_0x7eb3('0x37')](_0x370672,_0x7eb3('0x62')),'role':_0x7eb3('0x63')},'attributes':['id',_0x7eb3('0x34'),_0x7eb3('0x64'),_0x7eb3('0x65'),'createdAt']});}})['then'](function(_0x848567){if(_0x848567){return{'count':_0x848567['count'],'rows':_[_0x7eb3('0x37')](_0x848567[_0x7eb3('0x66')],function(_0x1fac29){return{'membername':_0x1fac29[_0x7eb3('0x34')],'UserId':_0x1fac29['id'],'queue_name':_0x4dbe4b['name'],'SmsQueueId':_0x4dbe4b['id'],'interface':util[_0x7eb3('0x67')](_0x7eb3('0x68'),_0x7eb3('0x69'),_0x1fac29[_0x7eb3('0x34')]),'penalty':0x0,'paused':_0x1fac29[_0x7eb3('0x64')],'createdAt':_0x1fac29[_0x7eb3('0x6a')],'updatedAt':_0x1fac29[_0x7eb3('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7eb3('0x2d')](respondWithFilteredResult(_0x10fcf3,_0x1d614f))['catch'](handleError(_0x10fcf3,null));};exports[_0x7eb3('0x6b')]=function(_0x36b74b,_0x41c365,_0xee31c4){var _0x10d5ec={};var _0x4ba598={};var _0x44abf6;var _0x4a178f;return db[_0x7eb3('0x38')][_0x7eb3('0x6c')]({'where':{'id':_0x36b74b[_0x7eb3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x41c365,null))['then'](function(_0x482d79){if(_0x482d79){_0x44abf6=_0x482d79;_0x4ba598['model']=_['keys'](db[_0x7eb3('0x6d')]['rawAttributes']);_0x4ba598[_0x7eb3('0x3e')]=_[_0x7eb3('0x3b')](_0x36b74b['query']);_0x4ba598['filters']=_[_0x7eb3('0x3d')](_0x4ba598[_0x7eb3('0x3a')],_0x4ba598[_0x7eb3('0x3e')]);_0x10d5ec[_0x7eb3('0x3f')]=_[_0x7eb3('0x3d')](_0x4ba598[_0x7eb3('0x3a')],qs[_0x7eb3('0x40')](_0x36b74b[_0x7eb3('0x3e')]['fields']));_0x10d5ec['attributes']=_0x10d5ec['attributes'][_0x7eb3('0x41')]?_0x10d5ec['attributes']:_0x4ba598[_0x7eb3('0x3a')];_0x10d5ec[_0x7eb3('0x45')]=qs[_0x7eb3('0x46')](_0x36b74b[_0x7eb3('0x3e')][_0x7eb3('0x46')]);_0x10d5ec[_0x7eb3('0x47')]=qs[_0x7eb3('0x3c')](_[_0x7eb3('0x48')](_0x36b74b[_0x7eb3('0x3e')],_0x4ba598['filters']));if(_0x36b74b[_0x7eb3('0x3e')][_0x7eb3('0x49')]){_0x10d5ec[_0x7eb3('0x47')]=_[_0x7eb3('0x52')](_0x10d5ec[_0x7eb3('0x47')],{'$or':_[_0x7eb3('0x37')](_0x10d5ec['attributes'],function(_0x1d2f16){var _0x4bf7b6={};_0x4bf7b6[_0x1d2f16]={'$like':'%'+_0x36b74b[_0x7eb3('0x3e')][_0x7eb3('0x49')]+'%'};return _0x4bf7b6;})});}_0x10d5ec=_['merge']({},_0x10d5ec,_0x36b74b['options']);return _0x44abf6[_0x7eb3('0x6b')](_0x10d5ec);}})[_0x7eb3('0x2d')](function(_0x5685c1){if(_0x5685c1){_0x4a178f=_0x5685c1[_0x7eb3('0x41')];if(!_0x36b74b[_0x7eb3('0x3e')]['hasOwnProperty'](_0x7eb3('0x43'))){_0x10d5ec[_0x7eb3('0x44')]=qs['limit'](_0x36b74b[_0x7eb3('0x3e')]['limit']);_0x10d5ec['offset']=qs[_0x7eb3('0x27')](_0x36b74b['query']['offset']);}return _0x44abf6[_0x7eb3('0x6b')](_0x10d5ec);}})[_0x7eb3('0x2d')](function(_0x44513e){if(_0x44513e){return _0x44513e?{'count':_0x4a178f,'rows':_0x44513e}:null;}})[_0x7eb3('0x2d')](respondWithResult(_0x41c365,null))[_0x7eb3('0x4e')](handleError(_0x41c365,null));};exports[_0x7eb3('0x6e')]=function(_0x24a75d,_0x5910f5,_0x35afc0){var _0x1a6dac=_0x24a75d[_0x7eb3('0x5c')][_0x7eb3('0x6f')];return db[_0x7eb3('0x6d')]['findAll']({'where':{'id':_0x1a6dac},'attributes':['id'],'include':[{'model':db[_0x7eb3('0x60')],'as':_0x7eb3('0x70'),'attributes':['id',_0x7eb3('0x34'),_0x7eb3('0x71'),'voicePause',_0x7eb3('0x72')],'raw':!![]}]})[_0x7eb3('0x2d')](function(_0x412402){if(_0x412402){var _0x1e9ec5=_[_0x7eb3('0x73')](_0x412402,function(_0x297077){var _0x20364f=_0x297077[_0x7eb3('0x2f')]({'plain':!![]});return _0x20364f[_0x7eb3('0x70')];});return db[_0x7eb3('0x38')][_0x7eb3('0x58')]({'where':{'id':_0x24a75d[_0x7eb3('0x4f')]['id']}})[_0x7eb3('0x2d')](function(_0xe14c1e){return db[_0x7eb3('0x74')]['transaction'](function(_0x2b9f36){return _0xe14c1e[_0x7eb3('0x6e')](_0x1a6dac,{'transaction':_0x2b9f36})[_0x7eb3('0x2d')](function(){return BPromise['each'](_0x1e9ec5,function(_0x240c0e){return db[_0x7eb3('0x5f')][_0x7eb3('0x75')]({'where':{'UserId':_0x240c0e['id'],'SmsQueueId':_0x24a75d[_0x7eb3('0x4f')]['id']},'transaction':_0x2b9f36});});})['then'](function(){_0x1e9ec5['forEach'](function(_0x3623ea){socket['emit'](_0x7eb3('0x76'),{'UserId':_0x3623ea['id'],'SmsQueueId':_0xe14c1e['id']});});});});});}})[_0x7eb3('0x2d')](respondWithStatusCode(_0x5910f5,null))[_0x7eb3('0x4e')](handleError(_0x5910f5,null));};exports['removeTeams']=function(_0x1a87fe,_0x1adaa5,_0x55e57c){return db[_0x7eb3('0x6d')][_0x7eb3('0x4d')]({'where':{'id':_0x1a87fe[_0x7eb3('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7eb3('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7eb3('0x2d')](handleEntityNotFound(_0x1adaa5,null))[_0x7eb3('0x2d')](function(_0x4d2bd2){var _0x56bf49=_[_0x7eb3('0x37')](_0x4d2bd2,'id');var _0xee55cd=[];var _0x4af1a3=[];var _0x331f48=squel['select']();_0x331f48[_0x7eb3('0x77')]('tq.TeamId')['from'](_0x7eb3('0x78'),'tq')[_0x7eb3('0x79')](_0x7eb3('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7eb3('0x47')](_0x7eb3('0x7b'),_0x1a87fe[_0x7eb3('0x4f')]['id']);for(var _0x2f38e2=0x0;_0x2f38e2<_0x4d2bd2[_0x7eb3('0x41')];_0x2f38e2+=0x1){let _0x16971c=_0x4d2bd2[_0x2f38e2];for(var _0x1cdd48=0x0;_0x1cdd48<_0x16971c['Agents'][_0x7eb3('0x41')];_0x1cdd48+=0x1){let _0x32a273=_0x16971c[_0x7eb3('0x70')][_0x1cdd48];var _0x4784c7=_0x331f48[_0x7eb3('0x7c')]();_0x4784c7[_0x7eb3('0x47')](_0x7eb3('0x7d'),_0x32a273['id']);_0x4af1a3['push'](db[_0x7eb3('0x74')][_0x7eb3('0x3e')](_0x4784c7[_0x7eb3('0x7e')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x175cdb){if(_0x175cdb['length']===0x1){return _0x32a273['id'];}else{var _0x1cab65=_[_0x7eb3('0x7f')](_[_0x7eb3('0x37')](_0x175cdb,_0x7eb3('0x80')),function(_0x254a33){return _[_0x7eb3('0x81')](_0x56bf49,_0x254a33);});if(_0x1cab65){return _0x32a273['id'];}}}));}}return BPromise['all'](_0x4af1a3)[_0x7eb3('0x2d')](function(_0x647484){_0xee55cd=_(_0xee55cd)[_0x7eb3('0x82')](_0x647484)[_0x7eb3('0x83')]()['value']();return db[_0x7eb3('0x38')][_0x7eb3('0x58')]({'where':{'id':_0x1a87fe['params']['id']}})[_0x7eb3('0x2d')](function(_0xecf19e){return db[_0x7eb3('0x74')][_0x7eb3('0x84')](function(_0x1d9b27){return _0xecf19e[_0x7eb3('0x85')](_0x1a87fe[_0x7eb3('0x3e')][_0x7eb3('0x6f')],{'transaction':_0x1d9b27})[_0x7eb3('0x2d')](function(){if(!_['isEmpty'](_0xee55cd)){return _0xecf19e[_0x7eb3('0x86')](_0xee55cd,{'transaction':_0x1d9b27});}})['then'](function(){_0xee55cd[_0x7eb3('0x87')](function(_0x178020){socket[_0x7eb3('0x88')](_0x7eb3('0x89'),{'UserId':_0x178020,'SmsQueueId':_0xecf19e['id']});});});});});});})['then'](respondWithStatusCode(_0x1adaa5,null))[_0x7eb3('0x4e')](handleError(_0x1adaa5,null));};exports['addAgents']=function(_0x5ae9a3,_0x35c8d9,_0x2c7870){return db['SmsQueue'][_0x7eb3('0x58')]({'where':{'id':_0x5ae9a3[_0x7eb3('0x4f')]['id']}})[_0x7eb3('0x2d')](handleEntityNotFound(_0x35c8d9,null))[_0x7eb3('0x2d')](function(_0x27ece2){if(_0x27ece2){return _0x27ece2['addAgents'](_0x5ae9a3[_0x7eb3('0x5c')]['ids'],_['omit'](_0x5ae9a3[_0x7eb3('0x5c')],['ids','id'])||{})['spread'](function(_0x564190){for(var _0x36ef76=0x0;_0x36ef76<_0x5ae9a3[_0x7eb3('0x5c')]['ids'][_0x7eb3('0x41')];_0x36ef76+=0x1){socket[_0x7eb3('0x88')]('userSmsQueue:save',{'UserId':Number(_0x5ae9a3[_0x7eb3('0x5c')][_0x7eb3('0x6f')][_0x36ef76]),'SmsQueueId':Number(_0x5ae9a3[_0x7eb3('0x4f')]['id'])});}return _0x564190;});}})[_0x7eb3('0x2d')](respondWithResult(_0x35c8d9,null))[_0x7eb3('0x4e')](handleError(_0x35c8d9,null));};exports['removeAgents']=function(_0xd2f3f7,_0x171bfc,_0x511a19){return db[_0x7eb3('0x38')][_0x7eb3('0x58')]({'where':{'id':_0xd2f3f7[_0x7eb3('0x4f')]['id']}})[_0x7eb3('0x2d')](handleEntityNotFound(_0x171bfc,null))[_0x7eb3('0x2d')](function(_0x1e6942){if(_0x1e6942){return _0x1e6942[_0x7eb3('0x86')](_0xd2f3f7[_0x7eb3('0x3e')][_0x7eb3('0x6f')])['then'](function(){if(_[_0x7eb3('0x8a')](_0xd2f3f7[_0x7eb3('0x3e')][_0x7eb3('0x6f')])){for(var _0x5ec279=0x0;_0x5ec279<_0xd2f3f7['query'][_0x7eb3('0x6f')]['length'];_0x5ec279+=0x1){socket[_0x7eb3('0x88')](_0x7eb3('0x89'),{'UserId':Number(_0xd2f3f7[_0x7eb3('0x3e')][_0x7eb3('0x6f')][_0x5ec279]),'SmsQueueId':Number(_0xd2f3f7['params']['id'])});}}else{socket[_0x7eb3('0x88')](_0x7eb3('0x89'),{'UserId':Number(_0xd2f3f7['query'][_0x7eb3('0x6f')]),'SmsQueueId':Number(_0xd2f3f7[_0x7eb3('0x4f')]['id'])});}});}})[_0x7eb3('0x2d')](respondWithStatusCode(_0x171bfc,null))['catch'](handleError(_0x171bfc,null));};exports[_0x7eb3('0x8b')]=function(_0x3d1ca9,_0x56e78b,_0x427f55){var _0x55f730={};var _0x9904e7={};var _0x883561;var _0x3b98aa;return db['SmsQueue'][_0x7eb3('0x6c')]({'where':{'id':_0x3d1ca9[_0x7eb3('0x4f')]['id']}})[_0x7eb3('0x2d')](handleEntityNotFound(_0x56e78b,null))[_0x7eb3('0x2d')](function(_0x61e56c){if(_0x61e56c){_0x883561=_0x61e56c;_0x9904e7[_0x7eb3('0x3a')]=_[_0x7eb3('0x3b')](db['User'][_0x7eb3('0x50')]);_0x9904e7[_0x7eb3('0x3e')]=_[_0x7eb3('0x3b')](_0x3d1ca9[_0x7eb3('0x3e')]);_0x9904e7[_0x7eb3('0x3c')]=_['intersection'](_0x9904e7['model'],_0x9904e7[_0x7eb3('0x3e')]);_0x55f730[_0x7eb3('0x3f')]=_[_0x7eb3('0x3d')](_0x9904e7[_0x7eb3('0x3a')],qs[_0x7eb3('0x40')](_0x3d1ca9[_0x7eb3('0x3e')][_0x7eb3('0x40')]));_0x55f730['attributes']=_0x55f730[_0x7eb3('0x3f')]['length']?_0x55f730[_0x7eb3('0x3f')]:_0x9904e7['model'];_0x55f730[_0x7eb3('0x45')]=qs[_0x7eb3('0x46')](_0x3d1ca9['query'][_0x7eb3('0x46')]);_0x55f730[_0x7eb3('0x47')]=qs[_0x7eb3('0x3c')](_['pick'](_0x3d1ca9['query'],_0x9904e7[_0x7eb3('0x3c')]));if(_0x3d1ca9[_0x7eb3('0x3e')][_0x7eb3('0x49')]){_0x55f730['where']=_[_0x7eb3('0x52')](_0x55f730[_0x7eb3('0x47')],{'$or':_[_0x7eb3('0x37')](_0x55f730['attributes'],function(_0x20d22c){var _0x27654f={};_0x27654f[_0x20d22c]={'$like':'%'+_0x3d1ca9[_0x7eb3('0x3e')][_0x7eb3('0x49')]+'%'};return _0x27654f;})});}_0x55f730=_[_0x7eb3('0x52')]({},_0x55f730,_0x3d1ca9[_0x7eb3('0x4b')]);return _0x883561[_0x7eb3('0x8b')](_0x55f730);}})[_0x7eb3('0x2d')](function(_0x126b5d){if(_0x126b5d){_0x3b98aa=_0x126b5d['length'];if(!_0x3d1ca9[_0x7eb3('0x3e')]['hasOwnProperty'](_0x7eb3('0x43'))){_0x55f730[_0x7eb3('0x44')]=qs[_0x7eb3('0x44')](_0x3d1ca9[_0x7eb3('0x3e')][_0x7eb3('0x44')]);_0x55f730[_0x7eb3('0x27')]=qs['offset'](_0x3d1ca9[_0x7eb3('0x3e')][_0x7eb3('0x27')]);}return _0x883561[_0x7eb3('0x8b')](_0x55f730);}})[_0x7eb3('0x2d')](function(_0x48d642){if(_0x48d642){return _0x48d642?{'count':_0x3b98aa,'rows':_0x48d642}:null;}})[_0x7eb3('0x2d')](respondWithResult(_0x56e78b,null))[_0x7eb3('0x4e')](handleError(_0x56e78b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index fff58e6..75b218c 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 _0x9953=['../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x13d7cc,_0x26ef4b){var _0x486517=function(_0x19e3fc){while(--_0x19e3fc){_0x13d7cc['push'](_0x13d7cc['shift']());}};_0x486517(++_0x26ef4b);}(_0x9953,0x98));var _0x3995=function(_0x48229a,_0x2dac65){_0x48229a=_0x48229a-0x0;var _0x5342e5=_0x9953[_0x48229a];return _0x5342e5;};'use strict';var EventEmitter=require(_0x3995('0x0'));var SmsQueue=require(_0x3995('0x1'))['db'][_0x3995('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3995('0x4'),'afterDestroy':_0x3995('0x5')};function emitEvent(_0x445b58){return function(_0x591420,_0x4f5cbf,_0x437732){SmsQueueEvents[_0x3995('0x6')](_0x445b58+':'+_0x591420['id'],_0x591420);SmsQueueEvents['emit'](_0x445b58,_0x591420);_0x437732(null);};}for(var e in events){if(events[_0x3995('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3995('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x485c=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x485c,0xf3));var _0xc485=function(_0x525c31,_0x281564){_0x525c31=_0x525c31-0x0;var _0x18535b=_0x485c[_0x525c31];return _0x18535b;};'use strict';var EventEmitter=require(_0xc485('0x0'));var SmsQueue=require(_0xc485('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc485('0x2')](0x0);var events={'afterCreate':_0xc485('0x3'),'afterUpdate':_0xc485('0x4'),'afterDestroy':_0xc485('0x5')};function emitEvent(_0x3f9b63){return function(_0x554d72,_0x70977e,_0x40942){SmsQueueEvents['emit'](_0x3f9b63+':'+_0x554d72['id'],_0x554d72);SmsQueueEvents[_0xc485('0x6')](_0x3f9b63,_0x554d72);_0x40942(null);};}for(var e in events){if(events[_0xc485('0x7')](e)){var event=events[e];SmsQueue[_0xc485('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9a5c2ae..983d65f 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 _0x7a9e=['sms_queues','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x1ebd59,_0x259be6){var _0x2a1505=function(_0x33a2f0){while(--_0x33a2f0){_0x1ebd59['push'](_0x1ebd59['shift']());}};_0x2a1505(++_0x259be6);}(_0x7a9e,0x119));var _0xe7a9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7a9e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe7a9('0x0'));var util=require(_0xe7a9('0x1'));var logger=require(_0xe7a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe7a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a9('0x4'));var config=require(_0xe7a9('0x5'));var attributes=require(_0xe7a9('0x6'));module[_0xe7a9('0x7')]=function(_0x59b159,_0x5ad53a){return _0x59b159['define'](_0xe7a9('0x8'),attributes,{'tableName':_0xe7a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a06=['path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird'];(function(_0x2442bd,_0x26ed49){var _0x50fecc=function(_0x293405){while(--_0x293405){_0x2442bd['push'](_0x2442bd['shift']());}};_0x50fecc(++_0x26ed49);}(_0x8a06,0x10f));var _0x68a0=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x8a06[_0x51b661];return _0x5d1971;};'use strict';var _=require('lodash');var util=require(_0x68a0('0x0'));var logger=require(_0x68a0('0x1'))('api');var moment=require(_0x68a0('0x2'));var BPromise=require(_0x68a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x68a0('0x4'));var rimraf=require('rimraf');var config=require(_0x68a0('0x5'));var attributes=require(_0x68a0('0x6'));module[_0x68a0('0x7')]=function(_0x217f38,_0x390d3c){return _0x217f38[_0x68a0('0x8')](_0x68a0('0x9'),attributes,{'tableName':_0x68a0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6067396..284816d 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 _0xdca5=['attributes','map','include','model','GetSmsQueue','debug','ShowSmsQueue','find','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','SmsQueue','options','raw','where'];(function(_0x566320,_0x254877){var _0x777b74=function(_0x3e6ddc){while(--_0x3e6ddc){_0x566320['push'](_0x566320['shift']());}};_0x777b74(++_0x254877);}(_0xdca5,0x1dc));var _0x5dca=function(_0x141f4c,_0x1cd3cb){_0x141f4c=_0x141f4c-0x0;var _0x438b05=_0xdca5[_0x141f4c];return _0x438b05;};'use strict';var _=require('lodash');var util=require(_0x5dca('0x0'));var moment=require('moment');var BPromise=require(_0x5dca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5dca('0x3'));var logger=require(_0x5dca('0x4'))(_0x5dca('0x5'));var config=require(_0x5dca('0x6'));var jayson=require(_0x5dca('0x7'));var client=jayson[_0x5dca('0x8')][_0x5dca('0x9')]({'port':0x232a});config[_0x5dca('0xa')]=_[_0x5dca('0xb')](config['redis'],{'host':_0x5dca('0xc'),'port':0x18eb});var socket=require(_0x5dca('0xd'))(new Redis(config[_0x5dca('0xa')]));require(_0x5dca('0xe'))[_0x5dca('0xf')](socket);function respondWithRpcPromise(_0xb4db14,_0x2e4dde,_0x4f1049){return new BPromise(function(_0x3df202,_0x4458d4){return client[_0x5dca('0x10')](_0xb4db14,_0x4f1049)[_0x5dca('0x11')](function(_0x1b3eac){logger[_0x5dca('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2e4dde,_0x5dca('0x13'));logger['debug'](_0x5dca('0x14'),_0x2e4dde,_0x5dca('0x13'),JSON[_0x5dca('0x15')](_0x1b3eac));if(_0x1b3eac['error']){if(_0x1b3eac[_0x5dca('0x16')][_0x5dca('0x17')]===0x1f4){logger['error'](_0x5dca('0x18'),_0x2e4dde,_0x1b3eac['error'][_0x5dca('0x19')]);return _0x4458d4(_0x1b3eac['error'][_0x5dca('0x19')]);}logger[_0x5dca('0x16')](_0x5dca('0x18'),_0x2e4dde,_0x1b3eac[_0x5dca('0x16')][_0x5dca('0x19')]);return _0x3df202(_0x1b3eac[_0x5dca('0x16')]['message']);}else{logger['info'](_0x5dca('0x18'),_0x2e4dde,_0x5dca('0x13'));_0x3df202(_0x1b3eac['result']['message']);}})[_0x5dca('0x1a')](function(_0x240231){logger[_0x5dca('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2e4dde,_0x240231);_0x4458d4(_0x240231);});});}exports['GetSmsQueue']=function(_0x5e4a90){var _0x31cc84=this;return new Promise(function(_0xf5f09d,_0x42b9f0){return db[_0x5dca('0x1b')]['findAll']({'raw':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90[_0x5dca('0x1c')][_0x5dca('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90['options'][_0x5dca('0x1e')]||null:null,'attributes':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90[_0x5dca('0x1c')][_0x5dca('0x1f')]||null:null,'limit':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90['options']['limit']||null:null,'include':_0x5e4a90['options']?_0x5e4a90[_0x5dca('0x1c')]['include']?_[_0x5dca('0x20')](_0x5e4a90['options'][_0x5dca('0x21')],function(_0x175f1d){return{'model':db[_0x175f1d[_0x5dca('0x22')]],'as':_0x175f1d['as'],'attributes':_0x175f1d['attributes'],'include':_0x175f1d[_0x5dca('0x21')]?_[_0x5dca('0x20')](_0x175f1d[_0x5dca('0x21')],function(_0xec9ac4){return{'model':db[_0xec9ac4['model']],'as':_0xec9ac4['as'],'attributes':_0xec9ac4[_0x5dca('0x1f')],'include':_0xec9ac4[_0x5dca('0x21')]?_[_0x5dca('0x20')](_0xec9ac4['include'],function(_0xa9dc92){return{'model':db[_0xa9dc92[_0x5dca('0x22')]],'as':_0xa9dc92['as'],'attributes':_0xa9dc92[_0x5dca('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x279208){logger[_0x5dca('0x12')](_0x5dca('0x23'),_0x5e4a90);logger[_0x5dca('0x24')](_0x5dca('0x23'),_0x5e4a90,JSON[_0x5dca('0x15')](_0x279208));_0xf5f09d(_0x279208);})[_0x5dca('0x1a')](function(_0x2028fe){logger[_0x5dca('0x16')]('GetSmsQueue',_0x2028fe[_0x5dca('0x19')],_0x5e4a90);_0x42b9f0(_0x31cc84[_0x5dca('0x16')](0x1f4,_0x2028fe[_0x5dca('0x19')]));});});};exports[_0x5dca('0x25')]=function(_0x473b2d){var _0x332fcb=this;return new Promise(function(_0x37a939,_0x290a71){return db[_0x5dca('0x1b')][_0x5dca('0x26')]({'raw':_0x473b2d[_0x5dca('0x1c')]?_0x473b2d[_0x5dca('0x1c')][_0x5dca('0x1d')]===undefined?!![]:![]:!![],'where':_0x473b2d['options']?_0x473b2d[_0x5dca('0x1c')][_0x5dca('0x1e')]||null:null,'attributes':_0x473b2d['options']?_0x473b2d[_0x5dca('0x1c')]['attributes']||null:null,'include':_0x473b2d[_0x5dca('0x1c')]?_0x473b2d[_0x5dca('0x1c')]['include']?_[_0x5dca('0x20')](_0x473b2d[_0x5dca('0x1c')]['include'],function(_0x3dacdb){return{'model':db[_0x3dacdb['model']],'as':_0x3dacdb['as'],'attributes':_0x3dacdb[_0x5dca('0x1f')],'include':_0x3dacdb['include']?_[_0x5dca('0x20')](_0x3dacdb[_0x5dca('0x21')],function(_0x1f480a){return{'model':db[_0x1f480a['model']],'as':_0x1f480a['as'],'attributes':_0x1f480a['attributes'],'include':_0x1f480a[_0x5dca('0x21')]?_['map'](_0x1f480a[_0x5dca('0x21')],function(_0x706c12){return{'model':db[_0x706c12['model']],'as':_0x706c12['as'],'attributes':_0x706c12[_0x5dca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5dca('0x11')](function(_0x36e852){logger[_0x5dca('0x12')](_0x5dca('0x25'),_0x473b2d);logger[_0x5dca('0x24')](_0x5dca('0x25'),_0x473b2d,JSON[_0x5dca('0x15')](_0x36e852));_0x37a939(_0x36e852);})[_0x5dca('0x1a')](function(_0x40a817){logger[_0x5dca('0x16')](_0x5dca('0x25'),_0x40a817[_0x5dca('0x19')],_0x473b2d);_0x290a71(_0x332fcb[_0x5dca('0x16')](0x1f4,_0x40a817[_0x5dca('0x19')]));});});}; \ No newline at end of file +var _0xe827=['localhost','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSmsQueue','ShowSmsQueue','SmsQueue','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x20ec4b,_0x305755){var _0x3e2f92=function(_0x585115){while(--_0x585115){_0x20ec4b['push'](_0x20ec4b['shift']());}};_0x3e2f92(++_0x305755);}(_0xe827,0x1a4));var _0x7e82=function(_0x512d2b,_0x3f1843){_0x512d2b=_0x512d2b-0x0;var _0x432f8e=_0xe827[_0x512d2b];return _0x432f8e;};'use strict';var _=require(_0x7e82('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e82('0x1'));var db=require(_0x7e82('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e82('0x3'))(_0x7e82('0x4'));var config=require(_0x7e82('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7e82('0x6')][_0x7e82('0x7')]({'port':0x232a});config[_0x7e82('0x8')]=_['defaults'](config['redis'],{'host':_0x7e82('0x9'),'port':0x18eb});var socket=require(_0x7e82('0xa'))(new Redis(config[_0x7e82('0x8')]));require(_0x7e82('0xb'))[_0x7e82('0xc')](socket);function respondWithRpcPromise(_0xcebcd4,_0x3e945e,_0x5fbff7){return new BPromise(function(_0xba0fbf,_0x2bdc69){return client[_0x7e82('0xd')](_0xcebcd4,_0x5fbff7)['then'](function(_0x2bdd5e){logger[_0x7e82('0xe')](_0x7e82('0xf'),_0x3e945e,_0x7e82('0x10'));logger[_0x7e82('0x11')](_0x7e82('0x12'),_0x3e945e,'request\x20sent',JSON[_0x7e82('0x13')](_0x2bdd5e));if(_0x2bdd5e[_0x7e82('0x14')]){if(_0x2bdd5e[_0x7e82('0x14')][_0x7e82('0x15')]===0x1f4){logger[_0x7e82('0x14')](_0x7e82('0xf'),_0x3e945e,_0x2bdd5e[_0x7e82('0x14')][_0x7e82('0x16')]);return _0x2bdc69(_0x2bdd5e[_0x7e82('0x14')][_0x7e82('0x16')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x3e945e,_0x2bdd5e['error']['message']);return _0xba0fbf(_0x2bdd5e[_0x7e82('0x14')][_0x7e82('0x16')]);}else{logger[_0x7e82('0xe')](_0x7e82('0xf'),_0x3e945e,_0x7e82('0x10'));_0xba0fbf(_0x2bdd5e[_0x7e82('0x17')][_0x7e82('0x16')]);}})[_0x7e82('0x18')](function(_0x4cbfdf){logger['error']('SmsQueue,\x20%s,\x20%s',_0x3e945e,_0x4cbfdf);_0x2bdc69(_0x4cbfdf);});});}exports['GetSmsQueue']=function(_0x4302fe){var _0x1a1381=this;return new Promise(function(_0x117640,_0x6e76f7){return db['SmsQueue'][_0x7e82('0x19')]({'raw':_0x4302fe[_0x7e82('0x1a')]?_0x4302fe[_0x7e82('0x1a')][_0x7e82('0x1b')]===undefined?!![]:![]:!![],'where':_0x4302fe['options']?_0x4302fe[_0x7e82('0x1a')][_0x7e82('0x1c')]||null:null,'attributes':_0x4302fe[_0x7e82('0x1a')]?_0x4302fe['options'][_0x7e82('0x1d')]||null:null,'limit':_0x4302fe[_0x7e82('0x1a')]?_0x4302fe['options'][_0x7e82('0x1e')]||null:null,'include':_0x4302fe[_0x7e82('0x1a')]?_0x4302fe[_0x7e82('0x1a')][_0x7e82('0x1f')]?_[_0x7e82('0x20')](_0x4302fe['options'][_0x7e82('0x1f')],function(_0x360e14){return{'model':db[_0x360e14[_0x7e82('0x21')]],'as':_0x360e14['as'],'attributes':_0x360e14[_0x7e82('0x1d')],'include':_0x360e14[_0x7e82('0x1f')]?_[_0x7e82('0x20')](_0x360e14[_0x7e82('0x1f')],function(_0x50cae0){return{'model':db[_0x50cae0[_0x7e82('0x21')]],'as':_0x50cae0['as'],'attributes':_0x50cae0[_0x7e82('0x1d')],'include':_0x50cae0[_0x7e82('0x1f')]?_['map'](_0x50cae0[_0x7e82('0x1f')],function(_0x210e97){return{'model':db[_0x210e97[_0x7e82('0x21')]],'as':_0x210e97['as'],'attributes':_0x210e97[_0x7e82('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7e82('0x22')](function(_0x515c3b){logger[_0x7e82('0xe')](_0x7e82('0x23'),_0x4302fe);logger[_0x7e82('0x11')]('GetSmsQueue',_0x4302fe,JSON[_0x7e82('0x13')](_0x515c3b));_0x117640(_0x515c3b);})[_0x7e82('0x18')](function(_0x301b12){logger['error'](_0x7e82('0x23'),_0x301b12[_0x7e82('0x16')],_0x4302fe);_0x6e76f7(_0x1a1381[_0x7e82('0x14')](0x1f4,_0x301b12[_0x7e82('0x16')]));});});};exports[_0x7e82('0x24')]=function(_0x5008d0){var _0x551897=this;return new Promise(function(_0x1bd12a,_0xc6bc65){return db[_0x7e82('0x25')][_0x7e82('0x26')]({'raw':_0x5008d0[_0x7e82('0x1a')]?_0x5008d0[_0x7e82('0x1a')][_0x7e82('0x1b')]===undefined?!![]:![]:!![],'where':_0x5008d0[_0x7e82('0x1a')]?_0x5008d0[_0x7e82('0x1a')]['where']||null:null,'attributes':_0x5008d0['options']?_0x5008d0['options'][_0x7e82('0x1d')]||null:null,'include':_0x5008d0[_0x7e82('0x1a')]?_0x5008d0[_0x7e82('0x1a')][_0x7e82('0x1f')]?_[_0x7e82('0x20')](_0x5008d0[_0x7e82('0x1a')][_0x7e82('0x1f')],function(_0x5247be){return{'model':db[_0x5247be[_0x7e82('0x21')]],'as':_0x5247be['as'],'attributes':_0x5247be[_0x7e82('0x1d')],'include':_0x5247be[_0x7e82('0x1f')]?_['map'](_0x5247be[_0x7e82('0x1f')],function(_0x24e8d1){return{'model':db[_0x24e8d1[_0x7e82('0x21')]],'as':_0x24e8d1['as'],'attributes':_0x24e8d1[_0x7e82('0x1d')],'include':_0x24e8d1[_0x7e82('0x1f')]?_[_0x7e82('0x20')](_0x24e8d1[_0x7e82('0x1f')],function(_0x374d48){return{'model':db[_0x374d48[_0x7e82('0x21')]],'as':_0x374d48['as'],'attributes':_0x374d48[_0x7e82('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7e82('0x22')](function(_0x1d630b){logger[_0x7e82('0xe')](_0x7e82('0x24'),_0x5008d0);logger[_0x7e82('0x11')](_0x7e82('0x24'),_0x5008d0,JSON['stringify'](_0x1d630b));_0x1bd12a(_0x1d630b);})[_0x7e82('0x18')](function(_0x49e926){logger[_0x7e82('0x14')]('ShowSmsQueue',_0x49e926[_0x7e82('0x16')],_0x5008d0);_0xc6bc65(_0x551897[_0x7e82('0x14')](0x1f4,_0x49e926[_0x7e82('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8e8e9a0..01a23d5 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 _0x8c19=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x1862f0,_0x773da7){var _0x447214=function(_0x5b3a9e){while(--_0x5b3a9e){_0x1862f0['push'](_0x1862f0['shift']());}};_0x447214(++_0x773da7);}(_0x8c19,0x1c7));var _0x98c1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8c19[_0x311c35];return _0x5cc50c;};'use strict';var SmsQueueEvents=require(_0x98c1('0x0'));var events=['save',_0x98c1('0x1'),_0x98c1('0x2')];function createListener(_0x27d3dc,_0x378e45){return function(_0x118d57){_0x378e45[_0x98c1('0x3')](_0x27d3dc,_0x118d57);};}function removeListener(_0x5e5b51,_0x39ac59){return function(){SmsQueueEvents[_0x98c1('0x4')](_0x5e5b51,_0x39ac59);};}exports[_0x98c1('0x5')]=function(_0x3dabe5){for(var _0x591519=0x0,_0x501dd7=events[_0x98c1('0x6')];_0x591519<_0x501dd7;_0x591519++){var _0x4d6d58=events[_0x591519];var _0x3e108c=createListener(_0x98c1('0x7')+_0x4d6d58,_0x3dabe5);SmsQueueEvents['on'](_0x4d6d58,_0x3e108c);}}; \ No newline at end of file +var _0xb289=['emit','removeListener','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x1c6d4f,_0x37e880){var _0x2598af=function(_0x4e9104){while(--_0x4e9104){_0x1c6d4f['push'](_0x1c6d4f['shift']());}};_0x2598af(++_0x37e880);}(_0xb289,0x1ee));var _0x9b28=function(_0x34af1f,_0x10457e){_0x34af1f=_0x34af1f-0x0;var _0x3716c8=_0xb289[_0x34af1f];return _0x3716c8;};'use strict';var SmsQueueEvents=require(_0x9b28('0x0'));var events=[_0x9b28('0x1'),_0x9b28('0x2'),'update'];function createListener(_0x2f4227,_0x3ff9d0){return function(_0x56ccb0){_0x3ff9d0[_0x9b28('0x3')](_0x2f4227,_0x56ccb0);};}function removeListener(_0x540958,_0x4b3baa){return function(){SmsQueueEvents[_0x9b28('0x4')](_0x540958,_0x4b3baa);};}exports['register']=function(_0x367494){for(var _0x11b749=0x0,_0x47f003=events[_0x9b28('0x5')];_0x11b749<_0x47f003;_0x11b749++){var _0x4f33fb=events[_0x11b749];var _0xcdba3d=createListener(_0x9b28('0x6')+_0x4f33fb,_0x367494);SmsQueueEvents['on'](_0x4f33fb,_0xcdba3d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b77eaba..8b6b2d0 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 _0x80bf=['connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','delete','destroy','multer','util'];(function(_0x533f24,_0x4e0b2a){var _0x50a185=function(_0x511b2d){while(--_0x511b2d){_0x533f24['push'](_0x533f24['shift']());}};_0x50a185(++_0x4e0b2a);}(_0x80bf,0x148));var _0xf80b=function(_0x157582,_0x3fbd88){_0x157582=_0x157582-0x0;var _0x23c4c8=_0x80bf[_0x157582];return _0x23c4c8;};'use strict';var multer=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var path=require('path');var timeout=require(_0xf80b('0x2'));var express=require(_0xf80b('0x3'));var router=express['Router']();var fs_extra=require(_0xf80b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf80b('0x5'));var config=require('../../config/environment');var controller=require(_0xf80b('0x6'));router[_0xf80b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf80b('0x7')]('/describe',auth[_0xf80b('0x8')](),controller[_0xf80b('0x9')]);router[_0xf80b('0x7')](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller[_0xf80b('0xb')]);router[_0xf80b('0xc')]('/',auth[_0xf80b('0x8')](),controller['create']);router['put'](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller['update']);router[_0xf80b('0xd')](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller[_0xf80b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x7233=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','describe','get','show','post','/:id','update','delete'];(function(_0x2a4467,_0x36d01a){var _0x2df85c=function(_0x1e0fd4){while(--_0x1e0fd4){_0x2a4467['push'](_0x2a4467['shift']());}};_0x2df85c(++_0x36d01a);}(_0x7233,0x8d));var _0x3723=function(_0x3868dc,_0x420398){_0x3868dc=_0x3868dc-0x0;var _0xc466fb=_0x7233[_0x3868dc];return _0xc466fb;};'use strict';var multer=require(_0x3723('0x0'));var util=require(_0x3723('0x1'));var path=require(_0x3723('0x2'));var timeout=require(_0x3723('0x3'));var express=require(_0x3723('0x4'));var router=express[_0x3723('0x5')]();var fs_extra=require(_0x3723('0x6'));var auth=require(_0x3723('0x7'));var interaction=require(_0x3723('0x8'));var config=require(_0x3723('0x9'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3723('0xa'),auth[_0x3723('0xb')](),controller[_0x3723('0xc')]);router[_0x3723('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3723('0xe')]);router[_0x3723('0xf')]('/',auth[_0x3723('0xb')](),controller['create']);router['put'](_0x3723('0x10'),auth[_0x3723('0xb')](),controller[_0x3723('0x11')]);router[_0x3723('0x12')](_0x3723('0x10'),auth['isAuthenticated'](),controller[_0x3723('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b8b7166..e109a16 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 _0x002e=['sequelize','STRING','DATE','moment'];(function(_0x28d9ee,_0x27ecff){var _0x580769=function(_0x16ea7e){while(--_0x16ea7e){_0x28d9ee['push'](_0x28d9ee['shift']());}};_0x580769(++_0x27ecff);}(_0x002e,0x18f));var _0xe002=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x002e[_0x43b06b];return _0x2c555b;};'use strict';var moment=require(_0xe002('0x0'));var Sequelize=require(_0xe002('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe002('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe002('0x2')]},'joinAt':{'type':Sequelize[_0xe002('0x3')]},'leaveAt':{'type':Sequelize[_0xe002('0x3')]},'acceptAt':{'type':Sequelize[_0xe002('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe002('0x2')]}}; \ No newline at end of file +var _0xc999=['STRING','DATE','sequelize','exports'];(function(_0x5b5d01,_0x563f17){var _0x535208=function(_0x412257){while(--_0x412257){_0x5b5d01['push'](_0x5b5d01['shift']());}};_0x535208(++_0x563f17);}(_0xc999,0x176));var _0x9c99=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xc999[_0x1c9c24];return _0x349c69;};'use strict';var moment=require('moment');var Sequelize=require(_0x9c99('0x0'));module[_0x9c99('0x1')]={'uniqueid':{'type':Sequelize[_0x9c99('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9c99('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1bb130b..734c94b 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 _0x77b4=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x77b4,0x11d));var _0x477b=function(_0x278a40,_0x439018){_0x278a40=_0x278a40-0x0;var _0x383227=_0x77b4[_0x278a40];return _0x383227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477b('0x0'));var zipdir=require(_0x477b('0x1'));var jsonpatch=require(_0x477b('0x2'));var rp=require(_0x477b('0x3'));var moment=require(_0x477b('0x4'));var BPromise=require(_0x477b('0x5'));var Mustache=require(_0x477b('0x6'));var util=require('util');var path=require(_0x477b('0x7'));var sox=require(_0x477b('0x8'));var csv=require(_0x477b('0x9'));var ejs=require(_0x477b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x477b('0xb'));var squel=require(_0x477b('0xc'));var crypto=require(_0x477b('0xd'));var jsforce=require(_0x477b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477b('0xf'));var Papa=require('papaparse');var Redis=require(_0x477b('0x10'));var authService=require(_0x477b('0x11'));var qs=require(_0x477b('0x12'));var as=require(_0x477b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x477b('0x14'))(_0x477b('0x15'));var utils=require(_0x477b('0x16'));var config=require(_0x477b('0x17'));var licenseUtil=require(_0x477b('0x18'));var db=require(_0x477b('0x19'))['db'];function respondWithStatusCode(_0x5b85cb,_0x270196){_0x270196=_0x270196||0xcc;return function(_0x4da24f){if(_0x4da24f){return _0x5b85cb[_0x477b('0x1a')](_0x270196);}return _0x5b85cb['status'](_0x270196)[_0x477b('0x1b')]();};}function respondWithResult(_0x174df8,_0xd67e68){_0xd67e68=_0xd67e68||0xc8;return function(_0x2e6085){if(_0x2e6085){return _0x174df8[_0x477b('0x1c')](_0xd67e68)[_0x477b('0x1d')](_0x2e6085);}};}function respondWithFilteredResult(_0x37edfd,_0x5787cd){return function(_0x409b54){if(_0x409b54){var _0xa67638=typeof _0x5787cd[_0x477b('0x1e')]===_0x477b('0x1f')&&typeof _0x5787cd['limit']===_0x477b('0x1f');var _0x5261ba=_0x409b54[_0x477b('0x20')];var _0x223e77=_0xa67638?0x0:_0x5787cd[_0x477b('0x1e')];var _0x5fdc78=_0xa67638?_0x409b54[_0x477b('0x20')]:_0x5787cd['offset']+_0x5787cd[_0x477b('0x21')];var _0x2d4b1f;if(_0x5fdc78>=_0x5261ba){_0x5fdc78=_0x5261ba;_0x2d4b1f=0xc8;}else{_0x2d4b1f=0xce;}_0x37edfd[_0x477b('0x1c')](_0x2d4b1f);return _0x37edfd['set'](_0x477b('0x22'),_0x223e77+'-'+_0x5fdc78+'/'+_0x5261ba)['json'](_0x409b54);}return null;};}function patchUpdates(_0x2ff34f){return function(_0x57be6b){try{jsonpatch[_0x477b('0x23')](_0x57be6b,_0x2ff34f,!![]);}catch(_0x1a3570){return BPromise[_0x477b('0x24')](_0x1a3570);}return _0x57be6b[_0x477b('0x25')]();};}function saveUpdates(_0x133bc7,_0x325063){return function(_0x333d3b){if(_0x333d3b){return _0x333d3b[_0x477b('0x26')](_0x133bc7)[_0x477b('0x27')](function(_0x4d3bf7){return _0x4d3bf7;});}return null;};}function removeEntity(_0xfbde67,_0x4e0a3f){return function(_0x1f3f2d){if(_0x1f3f2d){return _0x1f3f2d[_0x477b('0x28')]()['then'](function(){_0xfbde67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x81c9a,_0x172ff9){return function(_0x36e13a){if(!_0x36e13a){_0x81c9a[_0x477b('0x1a')](0x194);}return _0x36e13a;};}function handleError(_0x4a3142,_0x241cf0){_0x241cf0=_0x241cf0||0x1f4;return function(_0x54c853){logger['error'](_0x54c853[_0x477b('0x29')]);if(_0x54c853['name']){delete _0x54c853[_0x477b('0x2a')];}_0x4a3142['status'](_0x241cf0)['send'](_0x54c853);};}exports[_0x477b('0x2b')]=function(_0x116d84,_0x434673){var _0x1fcf1b={},_0x7b6041={},_0x2ab9ca={'count':0x0,'rows':[]};var _0x2ed924=_[_0x477b('0x2c')](db[_0x477b('0x2d')][_0x477b('0x2e')],function(_0x45520b){return{'name':_0x45520b['fieldName'],'type':_0x45520b['type'][_0x477b('0x2f')]};});_0x7b6041[_0x477b('0x30')]=_[_0x477b('0x2c')](_0x2ed924,_0x477b('0x2a'));_0x7b6041[_0x477b('0x31')]=_[_0x477b('0x32')](_0x116d84[_0x477b('0x31')]);_0x7b6041[_0x477b('0x33')]=_[_0x477b('0x34')](_0x7b6041[_0x477b('0x30')],_0x7b6041[_0x477b('0x31')]);_0x1fcf1b[_0x477b('0x35')]=_[_0x477b('0x34')](_0x7b6041[_0x477b('0x30')],qs[_0x477b('0x36')](_0x116d84[_0x477b('0x31')]['fields']));_0x1fcf1b[_0x477b('0x35')]=_0x1fcf1b['attributes']['length']?_0x1fcf1b[_0x477b('0x35')]:_0x7b6041[_0x477b('0x30')];if(!_0x116d84[_0x477b('0x31')][_0x477b('0x37')](_0x477b('0x38'))){_0x1fcf1b[_0x477b('0x21')]=qs['limit'](_0x116d84[_0x477b('0x31')][_0x477b('0x21')]);_0x1fcf1b[_0x477b('0x1e')]=qs[_0x477b('0x1e')](_0x116d84[_0x477b('0x31')][_0x477b('0x1e')]);}_0x1fcf1b[_0x477b('0x39')]=qs[_0x477b('0x3a')](_0x116d84[_0x477b('0x31')][_0x477b('0x3a')]);_0x1fcf1b['where']=qs['filters'](_[_0x477b('0x3b')](_0x116d84[_0x477b('0x31')],_0x7b6041[_0x477b('0x33')]),_0x2ed924);if(_0x116d84[_0x477b('0x31')][_0x477b('0x3c')]){_0x1fcf1b[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x1fcf1b[_0x477b('0x3d')],{'$or':_[_0x477b('0x2c')](_0x2ed924,function(_0x4a4816){if(_0x4a4816[_0x477b('0x3f')]!==_0x477b('0x40')){var _0x4401d2={};_0x4401d2[_0x4a4816[_0x477b('0x2a')]]={'$like':'%'+_0x116d84[_0x477b('0x31')][_0x477b('0x3c')]+'%'};return _0x4401d2;}})});}_0x1fcf1b=_['merge']({},_0x1fcf1b,_0x116d84['options']);var _0x2a84d8={'where':_0x1fcf1b[_0x477b('0x3d')]};return db[_0x477b('0x2d')][_0x477b('0x20')](_0x2a84d8)['then'](function(_0x1bf228){_0x2ab9ca[_0x477b('0x20')]=_0x1bf228;if(_0x116d84['query'][_0x477b('0x41')]){_0x1fcf1b[_0x477b('0x42')]=[{'all':!![]}];}return db[_0x477b('0x2d')]['findAll'](_0x1fcf1b);})[_0x477b('0x27')](function(_0x16cb14){_0x2ab9ca[_0x477b('0x43')]=_0x16cb14;return _0x2ab9ca;})[_0x477b('0x27')](respondWithFilteredResult(_0x434673,_0x1fcf1b))[_0x477b('0x44')](handleError(_0x434673,null));};exports[_0x477b('0x45')]=function(_0x3821ed,_0x4de977){var _0x4602b2={'raw':!![],'where':{'id':_0x3821ed[_0x477b('0x46')]['id']}},_0x378a74={};_0x378a74[_0x477b('0x30')]=_['keys'](db[_0x477b('0x2d')][_0x477b('0x2e')]);_0x378a74[_0x477b('0x31')]=_[_0x477b('0x32')](_0x3821ed[_0x477b('0x31')]);_0x378a74[_0x477b('0x33')]=_['intersection'](_0x378a74[_0x477b('0x30')],_0x378a74[_0x477b('0x31')]);_0x4602b2[_0x477b('0x35')]=_[_0x477b('0x34')](_0x378a74[_0x477b('0x30')],qs[_0x477b('0x36')](_0x3821ed[_0x477b('0x31')][_0x477b('0x36')]));_0x4602b2[_0x477b('0x35')]=_0x4602b2[_0x477b('0x35')][_0x477b('0x47')]?_0x4602b2[_0x477b('0x35')]:_0x378a74[_0x477b('0x30')];if(_0x3821ed['query'][_0x477b('0x41')]){_0x4602b2[_0x477b('0x42')]=[{'all':!![]}];}_0x4602b2=_[_0x477b('0x3e')]({},_0x4602b2,_0x3821ed[_0x477b('0x48')]);return db[_0x477b('0x2d')][_0x477b('0x49')](_0x4602b2)[_0x477b('0x27')](handleEntityNotFound(_0x4de977,null))[_0x477b('0x27')](respondWithResult(_0x4de977,null))[_0x477b('0x44')](handleError(_0x4de977,null));};exports[_0x477b('0x4a')]=function(_0x40aa74,_0x45ccf4){return db['SmsQueueReport'][_0x477b('0x4a')](_0x40aa74[_0x477b('0x4b')],{})['then'](respondWithResult(_0x45ccf4,0xc9))['catch'](handleError(_0x45ccf4,null));};exports[_0x477b('0x26')]=function(_0x9eb00f,_0x1936cb){if(_0x9eb00f[_0x477b('0x4b')]['id']){delete _0x9eb00f['body']['id'];}return db[_0x477b('0x2d')]['find']({'where':{'id':_0x9eb00f['params']['id']}})[_0x477b('0x27')](handleEntityNotFound(_0x1936cb,null))[_0x477b('0x27')](saveUpdates(_0x9eb00f['body'],null))[_0x477b('0x27')](respondWithResult(_0x1936cb,null))[_0x477b('0x44')](handleError(_0x1936cb,null));};exports[_0x477b('0x28')]=function(_0x4c6e50,_0x46e4e5){return db[_0x477b('0x2d')][_0x477b('0x49')]({'where':{'id':_0x4c6e50[_0x477b('0x46')]['id']}})[_0x477b('0x27')](handleEntityNotFound(_0x46e4e5,null))[_0x477b('0x27')](removeEntity(_0x46e4e5,null))['catch'](handleError(_0x46e4e5,null));};exports['describe']=function(_0x2e72f8,_0x138a73){return db[_0x477b('0x2d')]['describe']()[_0x477b('0x27')](respondWithResult(_0x138a73,null))['catch'](handleError(_0x138a73,null));}; \ No newline at end of file +var _0xd4ff=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0xbc6e17,_0x2b3de5){var _0x29b837=function(_0x13b06d){while(--_0x13b06d){_0xbc6e17['push'](_0xbc6e17['shift']());}};_0x29b837(++_0x2b3de5);}(_0xd4ff,0x70));var _0xfd4f=function(_0x3f9980,_0x340405){_0x3f9980=_0x3f9980-0x0;var _0x6580fb=_0xd4ff[_0x3f9980];return _0x6580fb;};'use strict';var emlformat=require(_0xfd4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd4f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd4f('0x2'));var moment=require(_0xfd4f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfd4f('0x4'));var util=require(_0xfd4f('0x5'));var path=require('path');var sox=require(_0xfd4f('0x6'));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(_0xfd4f('0x7'));var jsforce=require(_0xfd4f('0x8'));var deskjs=require(_0xfd4f('0x9'));var toCsv=require(_0xfd4f('0xa'));var querystring=require(_0xfd4f('0xb'));var Papa=require(_0xfd4f('0xc'));var Redis=require(_0xfd4f('0xd'));var authService=require(_0xfd4f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd4f('0xf'));var logger=require('../../config/logger')(_0xfd4f('0x10'));var utils=require(_0xfd4f('0x11'));var config=require(_0xfd4f('0x12'));var licenseUtil=require(_0xfd4f('0x13'));var db=require(_0xfd4f('0x14'))['db'];function respondWithStatusCode(_0x8d18ae,_0x3d1896){_0x3d1896=_0x3d1896||0xcc;return function(_0x27b869){if(_0x27b869){return _0x8d18ae[_0xfd4f('0x15')](_0x3d1896);}return _0x8d18ae[_0xfd4f('0x16')](_0x3d1896)[_0xfd4f('0x17')]();};}function respondWithResult(_0x5a411b,_0x3c82cf){_0x3c82cf=_0x3c82cf||0xc8;return function(_0x1c2bca){if(_0x1c2bca){return _0x5a411b['status'](_0x3c82cf)[_0xfd4f('0x18')](_0x1c2bca);}};}function respondWithFilteredResult(_0x29df57,_0x5db736){return function(_0x54b927){if(_0x54b927){var _0x233056=typeof _0x5db736[_0xfd4f('0x19')]===_0xfd4f('0x1a')&&typeof _0x5db736[_0xfd4f('0x1b')]===_0xfd4f('0x1a');var _0x2fc164=_0x54b927['count'];var _0x12fbf9=_0x233056?0x0:_0x5db736[_0xfd4f('0x19')];var _0x1d598f=_0x233056?_0x54b927[_0xfd4f('0x1c')]:_0x5db736[_0xfd4f('0x19')]+_0x5db736[_0xfd4f('0x1b')];var _0x56ba60;if(_0x1d598f>=_0x2fc164){_0x1d598f=_0x2fc164;_0x56ba60=0xc8;}else{_0x56ba60=0xce;}_0x29df57[_0xfd4f('0x16')](_0x56ba60);return _0x29df57['set'](_0xfd4f('0x1d'),_0x12fbf9+'-'+_0x1d598f+'/'+_0x2fc164)[_0xfd4f('0x18')](_0x54b927);}return null;};}function patchUpdates(_0x30a3d9){return function(_0x6795fc){try{jsonpatch['apply'](_0x6795fc,_0x30a3d9,!![]);}catch(_0x3cf921){return BPromise[_0xfd4f('0x1e')](_0x3cf921);}return _0x6795fc[_0xfd4f('0x1f')]();};}function saveUpdates(_0x18b3e1,_0x440ca2){return function(_0x51fd0a){if(_0x51fd0a){return _0x51fd0a[_0xfd4f('0x20')](_0x18b3e1)[_0xfd4f('0x21')](function(_0x1b80ec){return _0x1b80ec;});}return null;};}function removeEntity(_0x36ed31,_0x2ee8c2){return function(_0x3285a9){if(_0x3285a9){return _0x3285a9[_0xfd4f('0x22')]()[_0xfd4f('0x21')](function(){_0x36ed31[_0xfd4f('0x16')](0xcc)[_0xfd4f('0x17')]();});}};}function handleEntityNotFound(_0xafb394,_0x3056ed){return function(_0xbf3638){if(!_0xbf3638){_0xafb394[_0xfd4f('0x15')](0x194);}return _0xbf3638;};}function handleError(_0x1c5c84,_0x22e331){_0x22e331=_0x22e331||0x1f4;return function(_0x26c58e){logger[_0xfd4f('0x23')](_0x26c58e[_0xfd4f('0x24')]);if(_0x26c58e[_0xfd4f('0x25')]){delete _0x26c58e['name'];}_0x1c5c84[_0xfd4f('0x16')](_0x22e331)[_0xfd4f('0x26')](_0x26c58e);};}exports[_0xfd4f('0x27')]=function(_0x59bd75,_0x40558d){var _0x426865={},_0x5592c2={},_0x20d56f={'count':0x0,'rows':[]};var _0x5c5461=_[_0xfd4f('0x28')](db['SmsQueueReport'][_0xfd4f('0x29')],function(_0x1d3d4f){return{'name':_0x1d3d4f['fieldName'],'type':_0x1d3d4f[_0xfd4f('0x2a')][_0xfd4f('0x2b')]};});_0x5592c2[_0xfd4f('0x2c')]=_[_0xfd4f('0x28')](_0x5c5461,_0xfd4f('0x25'));_0x5592c2[_0xfd4f('0x2d')]=_[_0xfd4f('0x2e')](_0x59bd75[_0xfd4f('0x2d')]);_0x5592c2[_0xfd4f('0x2f')]=_[_0xfd4f('0x30')](_0x5592c2[_0xfd4f('0x2c')],_0x5592c2['query']);_0x426865[_0xfd4f('0x31')]=_['intersection'](_0x5592c2['model'],qs[_0xfd4f('0x32')](_0x59bd75[_0xfd4f('0x2d')][_0xfd4f('0x32')]));_0x426865[_0xfd4f('0x31')]=_0x426865[_0xfd4f('0x31')]['length']?_0x426865[_0xfd4f('0x31')]:_0x5592c2[_0xfd4f('0x2c')];if(!_0x59bd75[_0xfd4f('0x2d')][_0xfd4f('0x33')]('nolimit')){_0x426865[_0xfd4f('0x1b')]=qs['limit'](_0x59bd75[_0xfd4f('0x2d')]['limit']);_0x426865[_0xfd4f('0x19')]=qs[_0xfd4f('0x19')](_0x59bd75[_0xfd4f('0x2d')][_0xfd4f('0x19')]);}_0x426865['order']=qs[_0xfd4f('0x34')](_0x59bd75[_0xfd4f('0x2d')][_0xfd4f('0x34')]);_0x426865['where']=qs[_0xfd4f('0x2f')](_[_0xfd4f('0x35')](_0x59bd75[_0xfd4f('0x2d')],_0x5592c2[_0xfd4f('0x2f')]),_0x5c5461);if(_0x59bd75['query'][_0xfd4f('0x36')]){_0x426865[_0xfd4f('0x37')]=_[_0xfd4f('0x38')](_0x426865[_0xfd4f('0x37')],{'$or':_[_0xfd4f('0x28')](_0x5c5461,function(_0x288238){if(_0x288238['type']!==_0xfd4f('0x39')){var _0x1e3605={};_0x1e3605[_0x288238[_0xfd4f('0x25')]]={'$like':'%'+_0x59bd75[_0xfd4f('0x2d')][_0xfd4f('0x36')]+'%'};return _0x1e3605;}})});}_0x426865=_[_0xfd4f('0x38')]({},_0x426865,_0x59bd75['options']);var _0xeff07f={'where':_0x426865[_0xfd4f('0x37')]};return db[_0xfd4f('0x3a')][_0xfd4f('0x1c')](_0xeff07f)['then'](function(_0x4fa809){_0x20d56f[_0xfd4f('0x1c')]=_0x4fa809;if(_0x59bd75['query'][_0xfd4f('0x3b')]){_0x426865[_0xfd4f('0x3c')]=[{'all':!![]}];}return db[_0xfd4f('0x3a')][_0xfd4f('0x3d')](_0x426865);})[_0xfd4f('0x21')](function(_0x27282e){_0x20d56f[_0xfd4f('0x3e')]=_0x27282e;return _0x20d56f;})[_0xfd4f('0x21')](respondWithFilteredResult(_0x40558d,_0x426865))[_0xfd4f('0x3f')](handleError(_0x40558d,null));};exports[_0xfd4f('0x40')]=function(_0x4ac29e,_0x280406){var _0x1dc7e6={'raw':!![],'where':{'id':_0x4ac29e[_0xfd4f('0x41')]['id']}},_0x20343c={};_0x20343c[_0xfd4f('0x2c')]=_[_0xfd4f('0x2e')](db[_0xfd4f('0x3a')][_0xfd4f('0x29')]);_0x20343c[_0xfd4f('0x2d')]=_[_0xfd4f('0x2e')](_0x4ac29e[_0xfd4f('0x2d')]);_0x20343c[_0xfd4f('0x2f')]=_[_0xfd4f('0x30')](_0x20343c[_0xfd4f('0x2c')],_0x20343c[_0xfd4f('0x2d')]);_0x1dc7e6[_0xfd4f('0x31')]=_[_0xfd4f('0x30')](_0x20343c[_0xfd4f('0x2c')],qs[_0xfd4f('0x32')](_0x4ac29e['query'][_0xfd4f('0x32')]));_0x1dc7e6[_0xfd4f('0x31')]=_0x1dc7e6[_0xfd4f('0x31')]['length']?_0x1dc7e6['attributes']:_0x20343c['model'];if(_0x4ac29e[_0xfd4f('0x2d')][_0xfd4f('0x3b')]){_0x1dc7e6['include']=[{'all':!![]}];}_0x1dc7e6=_[_0xfd4f('0x38')]({},_0x1dc7e6,_0x4ac29e[_0xfd4f('0x42')]);return db[_0xfd4f('0x3a')]['find'](_0x1dc7e6)[_0xfd4f('0x21')](handleEntityNotFound(_0x280406,null))[_0xfd4f('0x21')](respondWithResult(_0x280406,null))[_0xfd4f('0x3f')](handleError(_0x280406,null));};exports['create']=function(_0xe86ffd,_0x4bc6b6){return db[_0xfd4f('0x3a')][_0xfd4f('0x43')](_0xe86ffd[_0xfd4f('0x44')],{})[_0xfd4f('0x21')](respondWithResult(_0x4bc6b6,0xc9))[_0xfd4f('0x3f')](handleError(_0x4bc6b6,null));};exports[_0xfd4f('0x20')]=function(_0x5d83de,_0x3a0088){if(_0x5d83de['body']['id']){delete _0x5d83de[_0xfd4f('0x44')]['id'];}return db[_0xfd4f('0x3a')][_0xfd4f('0x45')]({'where':{'id':_0x5d83de[_0xfd4f('0x41')]['id']}})[_0xfd4f('0x21')](handleEntityNotFound(_0x3a0088,null))[_0xfd4f('0x21')](saveUpdates(_0x5d83de[_0xfd4f('0x44')],null))[_0xfd4f('0x21')](respondWithResult(_0x3a0088,null))[_0xfd4f('0x3f')](handleError(_0x3a0088,null));};exports[_0xfd4f('0x22')]=function(_0x99d1a6,_0x115b2a){return db[_0xfd4f('0x3a')]['find']({'where':{'id':_0x99d1a6['params']['id']}})[_0xfd4f('0x21')](handleEntityNotFound(_0x115b2a,null))[_0xfd4f('0x21')](removeEntity(_0x115b2a,null))[_0xfd4f('0x3f')](handleError(_0x115b2a,null));};exports['describe']=function(_0x2b511c,_0x277b38){return db[_0xfd4f('0x3a')][_0xfd4f('0x46')]()['then'](respondWithResult(_0x277b38,null))[_0xfd4f('0x3f')](handleError(_0x277b38,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 95daf56..1004de9 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x19056c,_0x1f5dee){var _0x776130=function(_0x38bd15){while(--_0x38bd15){_0x19056c['push'](_0x19056c['shift']());}};_0x776130(++_0x1f5dee);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6a90aa0..80e3819 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 _0x9282=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','where','limit','UpdateSmsQueueReport','lodash','moment'];(function(_0x243893,_0x349e42){var _0xc15cd6=function(_0x2d5c74){while(--_0x2d5c74){_0x243893['push'](_0x243893['shift']());}};_0xc15cd6(++_0x349e42);}(_0x9282,0x106));var _0x2928=function(_0x5980e4,_0x44ec9c){_0x5980e4=_0x5980e4-0x0;var _0x429716=_0x9282[_0x5980e4];return _0x429716;};'use strict';var _=require(_0x2928('0x0'));var util=require('util');var moment=require(_0x2928('0x1'));var BPromise=require(_0x2928('0x2'));var rs=require(_0x2928('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2928('0x4'))['db'];var utils=require(_0x2928('0x5'));var logger=require(_0x2928('0x6'))(_0x2928('0x7'));var config=require(_0x2928('0x8'));var jayson=require(_0x2928('0x9'));var client=jayson[_0x2928('0xa')][_0x2928('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3331ca,_0x514603,_0x31e492){return new BPromise(function(_0x449f5b,_0x243c98){return client[_0x2928('0xc')](_0x3331ca,_0x31e492)['then'](function(_0x29c3e4){logger[_0x2928('0xd')](_0x2928('0xe'),_0x514603,'request\x20sent');logger[_0x2928('0xf')](_0x2928('0x10'),_0x514603,'request\x20sent',JSON[_0x2928('0x11')](_0x29c3e4));if(_0x29c3e4[_0x2928('0x12')]){if(_0x29c3e4[_0x2928('0x12')][_0x2928('0x13')]===0x1f4){logger[_0x2928('0x12')](_0x2928('0xe'),_0x514603,_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);return _0x243c98(_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);}logger[_0x2928('0x12')](_0x2928('0xe'),_0x514603,_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);return _0x449f5b(_0x29c3e4['error'][_0x2928('0x14')]);}else{logger[_0x2928('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x514603,'request\x20sent');_0x449f5b(_0x29c3e4[_0x2928('0x15')][_0x2928('0x14')]);}})[_0x2928('0x16')](function(_0x9da77f){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x514603,_0x9da77f);_0x243c98(_0x9da77f);});});}exports[_0x2928('0x17')]=function(_0x372e61){var _0x33b498=this;return new Promise(function(_0x2a800f,_0x1d4464){return db[_0x2928('0x18')][_0x2928('0x19')](_0x372e61[_0x2928('0x1a')],{'raw':_0x372e61[_0x2928('0x1b')]?_0x372e61[_0x2928('0x1b')][_0x2928('0x1c')]===undefined?!![]:![]:!![]})[_0x2928('0x1d')](function(_0x13d0da){logger[_0x2928('0xd')](_0x2928('0x17'),_0x372e61);logger[_0x2928('0xf')]('CreateSmsQueueReport',_0x372e61,JSON['stringify'](_0x13d0da));_0x2a800f(_0x13d0da);})[_0x2928('0x16')](function(_0x4288f8){logger[_0x2928('0x12')](_0x2928('0x17'),_0x4288f8[_0x2928('0x14')],_0x372e61);_0x1d4464(_0x33b498[_0x2928('0x12')](0x1f4,_0x4288f8[_0x2928('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x1ce1b2){var _0x20eb71=this;return new Promise(function(_0x5b0824,_0x14fb29){return db[_0x2928('0x18')]['update'](_0x1ce1b2[_0x2928('0x1a')],{'raw':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')][_0x2928('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2['options'][_0x2928('0x1e')]||null:null,'attributes':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')]['attributes']||null:null,'limit':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')][_0x2928('0x1f')]||null:null})[_0x2928('0x1d')](function(_0xe7f368){logger[_0x2928('0xd')](_0x2928('0x20'),_0x1ce1b2);logger[_0x2928('0xf')](_0x2928('0x20'),_0x1ce1b2,JSON['stringify'](_0xe7f368));_0x5b0824(_0xe7f368);})[_0x2928('0x16')](function(_0x43eabc){logger[_0x2928('0x12')](_0x2928('0x20'),_0x43eabc['message'],_0x1ce1b2);_0x14fb29(_0x20eb71['error'](0x1f4,_0x43eabc['message']));});});}; \ No newline at end of file +var _0x28b5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsQueueReport','create','body','options','then','CreateSmsQueueReport','debug','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x3d2b5c,_0x41ac4b){var _0x74ad64=function(_0xfa34a3){while(--_0xfa34a3){_0x3d2b5c['push'](_0x3d2b5c['shift']());}};_0x74ad64(++_0x41ac4b);}(_0x28b5,0xdb));var _0x528b=function(_0x4b8259,_0x1fd9a7){_0x4b8259=_0x4b8259-0x0;var _0x3bfa92=_0x28b5[_0x4b8259];return _0x3bfa92;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x528b('0x2'));var fs=require('fs');var Redis=require(_0x528b('0x3'));var db=require(_0x528b('0x4'))['db'];var utils=require(_0x528b('0x5'));var logger=require(_0x528b('0x6'))(_0x528b('0x7'));var config=require(_0x528b('0x8'));var jayson=require(_0x528b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9a97,_0x47c1b6,_0x326b7f){return new BPromise(function(_0x1295a3,_0x1a24be){return client[_0x528b('0xa')](_0x2a9a97,_0x326b7f)['then'](function(_0x1e23cb){logger[_0x528b('0xb')](_0x528b('0xc'),_0x47c1b6,_0x528b('0xd'));logger['debug'](_0x528b('0xe'),_0x47c1b6,_0x528b('0xd'),JSON[_0x528b('0xf')](_0x1e23cb));if(_0x1e23cb[_0x528b('0x10')]){if(_0x1e23cb['error']['code']===0x1f4){logger['error'](_0x528b('0xc'),_0x47c1b6,_0x1e23cb[_0x528b('0x10')][_0x528b('0x11')]);return _0x1a24be(_0x1e23cb[_0x528b('0x10')]['message']);}logger[_0x528b('0x10')](_0x528b('0xc'),_0x47c1b6,_0x1e23cb[_0x528b('0x10')][_0x528b('0x11')]);return _0x1295a3(_0x1e23cb[_0x528b('0x10')][_0x528b('0x11')]);}else{logger[_0x528b('0xb')](_0x528b('0xc'),_0x47c1b6,_0x528b('0xd'));_0x1295a3(_0x1e23cb['result']['message']);}})[_0x528b('0x12')](function(_0x4937ac){logger[_0x528b('0x10')](_0x528b('0xc'),_0x47c1b6,_0x4937ac);_0x1a24be(_0x4937ac);});});}exports['CreateSmsQueueReport']=function(_0x38ad17){var _0x17b1e4=this;return new Promise(function(_0x2c4004,_0x5d3e75){return db[_0x528b('0x13')][_0x528b('0x14')](_0x38ad17[_0x528b('0x15')],{'raw':_0x38ad17[_0x528b('0x16')]?_0x38ad17[_0x528b('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x528b('0x17')](function(_0x14f51f){logger[_0x528b('0xb')](_0x528b('0x18'),_0x38ad17);logger[_0x528b('0x19')](_0x528b('0x18'),_0x38ad17,JSON[_0x528b('0xf')](_0x14f51f));_0x2c4004(_0x14f51f);})[_0x528b('0x12')](function(_0x54c73a){logger[_0x528b('0x10')](_0x528b('0x18'),_0x54c73a[_0x528b('0x11')],_0x38ad17);_0x5d3e75(_0x17b1e4['error'](0x1f4,_0x54c73a[_0x528b('0x11')]));});});};exports[_0x528b('0x1a')]=function(_0x3cc111){var _0x2ba39f=this;return new Promise(function(_0x40cd68,_0x4532d5){return db[_0x528b('0x13')][_0x528b('0x1b')](_0x3cc111[_0x528b('0x15')],{'raw':_0x3cc111[_0x528b('0x16')]?_0x3cc111[_0x528b('0x16')][_0x528b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cc111[_0x528b('0x16')]?_0x3cc111[_0x528b('0x16')][_0x528b('0x1d')]||null:null,'attributes':_0x3cc111['options']?_0x3cc111[_0x528b('0x16')][_0x528b('0x1e')]||null:null,'limit':_0x3cc111['options']?_0x3cc111[_0x528b('0x16')][_0x528b('0x1f')]||null:null})[_0x528b('0x17')](function(_0x37cdf6){logger[_0x528b('0xb')](_0x528b('0x1a'),_0x3cc111);logger[_0x528b('0x19')](_0x528b('0x1a'),_0x3cc111,JSON[_0x528b('0xf')](_0x37cdf6));_0x40cd68(_0x37cdf6);})['catch'](function(_0x1bb01b){logger[_0x528b('0x10')](_0x528b('0x1a'),_0x1bb01b[_0x528b('0x11')],_0x3cc111);_0x4532d5(_0x2ba39f['error'](0x1f4,_0x1bb01b[_0x528b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8658d6c..9c4610b 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(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xb717,0x1b4));var _0x7b71=function(_0x32ffa9,_0x5ed14c){_0x32ffa9=_0x32ffa9-0x0;var _0x12eb2f=_0xb717[_0x32ffa9];return _0x12eb2f;};'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 _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x940fe0,_0x2b2ebe){var _0x48f3de=function(_0x446cc3){while(--_0x446cc3){_0x940fe0['push'](_0x940fe0['shift']());}};_0x48f3de(++_0x2b2ebe);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);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 46f715b..a3f8af2 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x45466b,_0x228624){var _0x436e9d=function(_0x2b2e14){while(--_0x2b2e14){_0x45466b['push'](_0x45466b['shift']());}};_0x436e9d(++_0x228624);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4c8884,_0x248d8f){var _0x326b7d=function(_0x2dae5e){while(--_0x2dae5e){_0x4c8884['push'](_0x4c8884['shift']());}};_0x326b7d(++_0x248d8f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x4b84[_0x338f73];return _0x163fdf;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c2c2ca7..52b4470 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 _0x2cdb=['stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0x3e17a9,_0x39afdc){var _0x402e91=function(_0x1a07b1){while(--_0x1a07b1){_0x3e17a9['push'](_0x3e17a9['shift']());}};_0x402e91(++_0x39afdc);}(_0x2cdb,0x1a0));var _0xb2cd=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2cdb[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2cd('0x0'));var zipdir=require(_0xb2cd('0x1'));var jsonpatch=require(_0xb2cd('0x2'));var rp=require(_0xb2cd('0x3'));var moment=require(_0xb2cd('0x4'));var BPromise=require(_0xb2cd('0x5'));var Mustache=require(_0xb2cd('0x6'));var util=require(_0xb2cd('0x7'));var path=require(_0xb2cd('0x8'));var sox=require('sox');var csv=require(_0xb2cd('0x9'));var ejs=require(_0xb2cd('0xa'));var fs=require('fs');var fs_extra=require(_0xb2cd('0xb'));var _=require(_0xb2cd('0xc'));var squel=require('squel');var crypto=require(_0xb2cd('0xd'));var jsforce=require(_0xb2cd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb2cd('0x9'));var querystring=require(_0xb2cd('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2cd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb2cd('0x11'));var as=require(_0xb2cd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2cd('0x13'))(_0xb2cd('0x14'));var utils=require(_0xb2cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb2cd('0x16'));var db=require(_0xb2cd('0x17'))['db'];function respondWithStatusCode(_0x3fd5ec,_0x52891d){_0x52891d=_0x52891d||0xcc;return function(_0x14d97e){if(_0x14d97e){return _0x3fd5ec[_0xb2cd('0x18')](_0x52891d);}return _0x3fd5ec[_0xb2cd('0x19')](_0x52891d)['end']();};}function respondWithResult(_0x3b871a,_0x2b8874){_0x2b8874=_0x2b8874||0xc8;return function(_0x218417){if(_0x218417){return _0x3b871a['status'](_0x2b8874)[_0xb2cd('0x1a')](_0x218417);}};}function respondWithFilteredResult(_0x3e4928,_0x36f3b8){return function(_0x51c88a){if(_0x51c88a){var _0x45374c=typeof _0x36f3b8['offset']===_0xb2cd('0x1b')&&typeof _0x36f3b8[_0xb2cd('0x1c')]===_0xb2cd('0x1b');var _0x22577f=_0x51c88a[_0xb2cd('0x1d')];var _0x34d5fc=_0x45374c?0x0:_0x36f3b8[_0xb2cd('0x1e')];var _0x31d4f5=_0x45374c?_0x51c88a[_0xb2cd('0x1d')]:_0x36f3b8['offset']+_0x36f3b8[_0xb2cd('0x1c')];var _0x259d2a;if(_0x31d4f5>=_0x22577f){_0x31d4f5=_0x22577f;_0x259d2a=0xc8;}else{_0x259d2a=0xce;}_0x3e4928[_0xb2cd('0x19')](_0x259d2a);return _0x3e4928[_0xb2cd('0x1f')](_0xb2cd('0x20'),_0x34d5fc+'-'+_0x31d4f5+'/'+_0x22577f)['json'](_0x51c88a);}return null;};}function patchUpdates(_0xb0235d){return function(_0x55f4a9){try{jsonpatch['apply'](_0x55f4a9,_0xb0235d,!![]);}catch(_0x5b776e){return BPromise[_0xb2cd('0x21')](_0x5b776e);}return _0x55f4a9[_0xb2cd('0x22')]();};}function saveUpdates(_0x405484,_0x42e720){return function(_0x28aabd){if(_0x28aabd){return _0x28aabd[_0xb2cd('0x23')](_0x405484)[_0xb2cd('0x24')](function(_0x5e3cdb){return _0x5e3cdb;});}return null;};}function removeEntity(_0x3c26f0,_0x12a9fd){return function(_0x3e8744){if(_0x3e8744){return _0x3e8744[_0xb2cd('0x25')]()[_0xb2cd('0x24')](function(){_0x3c26f0[_0xb2cd('0x19')](0xcc)[_0xb2cd('0x26')]();});}};}function handleEntityNotFound(_0x2da08b,_0x293b0e){return function(_0x32e167){if(!_0x32e167){_0x2da08b['sendStatus'](0x194);}return _0x32e167;};}function handleError(_0x363142,_0x4fdb91){_0x4fdb91=_0x4fdb91||0x1f4;return function(_0x9807c4){logger[_0xb2cd('0x27')](_0x9807c4[_0xb2cd('0x28')]);if(_0x9807c4[_0xb2cd('0x29')]){delete _0x9807c4['name'];}_0x363142[_0xb2cd('0x19')](_0x4fdb91)[_0xb2cd('0x2a')](_0x9807c4);};}exports[_0xb2cd('0x2b')]=function(_0x190e4a,_0x5457a0){var _0x39f604={},_0x172db0={},_0x191a0a={'count':0x0,'rows':[]};var _0x2907fb=_['map'](db['SmsTransferReport'][_0xb2cd('0x2c')],function(_0x1201de){return{'name':_0x1201de['fieldName'],'type':_0x1201de[_0xb2cd('0x2d')][_0xb2cd('0x2e')]};});_0x172db0[_0xb2cd('0x2f')]=_[_0xb2cd('0x30')](_0x2907fb,'name');_0x172db0[_0xb2cd('0x31')]=_[_0xb2cd('0x32')](_0x190e4a[_0xb2cd('0x31')]);_0x172db0[_0xb2cd('0x33')]=_[_0xb2cd('0x34')](_0x172db0[_0xb2cd('0x2f')],_0x172db0[_0xb2cd('0x31')]);_0x39f604[_0xb2cd('0x35')]=_['intersection'](_0x172db0['model'],qs[_0xb2cd('0x36')](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x36')]));_0x39f604[_0xb2cd('0x35')]=_0x39f604[_0xb2cd('0x35')][_0xb2cd('0x37')]?_0x39f604[_0xb2cd('0x35')]:_0x172db0[_0xb2cd('0x2f')];if(!_0x190e4a['query']['hasOwnProperty']('nolimit')){_0x39f604[_0xb2cd('0x1c')]=qs['limit'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x1c')]);_0x39f604[_0xb2cd('0x1e')]=qs['offset'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x1e')]);}_0x39f604[_0xb2cd('0x38')]=qs['sort'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x39')]);_0x39f604[_0xb2cd('0x3a')]=qs[_0xb2cd('0x33')](_[_0xb2cd('0x3b')](_0x190e4a[_0xb2cd('0x31')],_0x172db0[_0xb2cd('0x33')]),_0x2907fb);if(_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x3c')]){_0x39f604[_0xb2cd('0x3a')]=_[_0xb2cd('0x3d')](_0x39f604[_0xb2cd('0x3a')],{'$or':_[_0xb2cd('0x30')](_0x2907fb,function(_0x39bf3b){if(_0x39bf3b['type']!==_0xb2cd('0x3e')){var _0x9e31ec={};_0x9e31ec[_0x39bf3b[_0xb2cd('0x29')]]={'$like':'%'+_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x3c')]+'%'};return _0x9e31ec;}})});}_0x39f604=_['merge']({},_0x39f604,_0x190e4a[_0xb2cd('0x3f')]);var _0x3d56bf={'where':_0x39f604[_0xb2cd('0x3a')]};return db[_0xb2cd('0x40')][_0xb2cd('0x1d')](_0x3d56bf)[_0xb2cd('0x24')](function(_0x379b30){_0x191a0a[_0xb2cd('0x1d')]=_0x379b30;if(_0x190e4a[_0xb2cd('0x31')]['includeAll']){_0x39f604[_0xb2cd('0x41')]=[{'all':!![]}];}return db[_0xb2cd('0x40')][_0xb2cd('0x42')](_0x39f604);})[_0xb2cd('0x24')](function(_0x437419){_0x191a0a[_0xb2cd('0x43')]=_0x437419;return _0x191a0a;})[_0xb2cd('0x24')](respondWithFilteredResult(_0x5457a0,_0x39f604))[_0xb2cd('0x44')](handleError(_0x5457a0,null));};exports[_0xb2cd('0x45')]=function(_0xb426f,_0xbc3dd6){var _0x4cb6f8={'raw':!![],'where':{'id':_0xb426f['params']['id']}},_0x259190={};_0x259190['model']=_[_0xb2cd('0x32')](db[_0xb2cd('0x40')][_0xb2cd('0x2c')]);_0x259190[_0xb2cd('0x31')]=_[_0xb2cd('0x32')](_0xb426f[_0xb2cd('0x31')]);_0x259190[_0xb2cd('0x33')]=_['intersection'](_0x259190['model'],_0x259190['query']);_0x4cb6f8[_0xb2cd('0x35')]=_[_0xb2cd('0x34')](_0x259190[_0xb2cd('0x2f')],qs[_0xb2cd('0x36')](_0xb426f[_0xb2cd('0x31')][_0xb2cd('0x36')]));_0x4cb6f8[_0xb2cd('0x35')]=_0x4cb6f8[_0xb2cd('0x35')][_0xb2cd('0x37')]?_0x4cb6f8[_0xb2cd('0x35')]:_0x259190[_0xb2cd('0x2f')];if(_0xb426f[_0xb2cd('0x31')][_0xb2cd('0x46')]){_0x4cb6f8[_0xb2cd('0x41')]=[{'all':!![]}];}_0x4cb6f8=_[_0xb2cd('0x3d')]({},_0x4cb6f8,_0xb426f[_0xb2cd('0x3f')]);return db[_0xb2cd('0x40')][_0xb2cd('0x47')](_0x4cb6f8)[_0xb2cd('0x24')](handleEntityNotFound(_0xbc3dd6,null))[_0xb2cd('0x24')](respondWithResult(_0xbc3dd6,null))['catch'](handleError(_0xbc3dd6,null));};exports[_0xb2cd('0x48')]=function(_0x553dd9,_0x510eec){return db[_0xb2cd('0x40')][_0xb2cd('0x48')](_0x553dd9['body'],{})[_0xb2cd('0x24')](respondWithResult(_0x510eec,0xc9))[_0xb2cd('0x44')](handleError(_0x510eec,null));};exports[_0xb2cd('0x23')]=function(_0x175336,_0x3b67bc){if(_0x175336[_0xb2cd('0x49')]['id']){delete _0x175336[_0xb2cd('0x49')]['id'];}return db[_0xb2cd('0x40')][_0xb2cd('0x47')]({'where':{'id':_0x175336[_0xb2cd('0x4a')]['id']}})[_0xb2cd('0x24')](handleEntityNotFound(_0x3b67bc,null))[_0xb2cd('0x24')](saveUpdates(_0x175336[_0xb2cd('0x49')],null))[_0xb2cd('0x24')](respondWithResult(_0x3b67bc,null))['catch'](handleError(_0x3b67bc,null));};exports['destroy']=function(_0x4175d0,_0x5cd084){return db[_0xb2cd('0x40')][_0xb2cd('0x47')]({'where':{'id':_0x4175d0[_0xb2cd('0x4a')]['id']}})[_0xb2cd('0x24')](handleEntityNotFound(_0x5cd084,null))[_0xb2cd('0x24')](removeEntity(_0x5cd084,null))[_0xb2cd('0x44')](handleError(_0x5cd084,null));};exports[_0xb2cd('0x4b')]=function(_0x3a00fd,_0x3dd8ad){return db['SmsTransferReport'][_0xb2cd('0x4b')]()[_0xb2cd('0x24')](respondWithResult(_0x3dd8ad,null))[_0xb2cd('0x44')](handleError(_0x3dd8ad,null));}; \ No newline at end of file +var _0x9240=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0xc3398e,_0x49cbbc){var _0x2c64e6=function(_0x41e3b1){while(--_0x41e3b1){_0xc3398e['push'](_0xc3398e['shift']());}};_0x2c64e6(++_0x49cbbc);}(_0x9240,0x169));var _0x0924=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9240[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0924('0x0'));var rimraf=require(_0x0924('0x1'));var zipdir=require(_0x0924('0x2'));var jsonpatch=require(_0x0924('0x3'));var rp=require(_0x0924('0x4'));var moment=require(_0x0924('0x5'));var BPromise=require(_0x0924('0x6'));var Mustache=require('mustache');var util=require(_0x0924('0x7'));var path=require(_0x0924('0x8'));var sox=require(_0x0924('0x9'));var csv=require(_0x0924('0xa'));var ejs=require(_0x0924('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0924('0xc'));var squel=require(_0x0924('0xd'));var crypto=require(_0x0924('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0924('0xf'));var toCsv=require(_0x0924('0xa'));var querystring=require(_0x0924('0x10'));var Papa=require(_0x0924('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0924('0x12'));var as=require(_0x0924('0x13'));var hardwareService=require(_0x0924('0x14'));var logger=require(_0x0924('0x15'))(_0x0924('0x16'));var utils=require(_0x0924('0x17'));var config=require(_0x0924('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0924('0x19'))['db'];function respondWithStatusCode(_0x1549d4,_0xa67b95){_0xa67b95=_0xa67b95||0xcc;return function(_0x1d47d0){if(_0x1d47d0){return _0x1549d4['sendStatus'](_0xa67b95);}return _0x1549d4[_0x0924('0x1a')](_0xa67b95)['end']();};}function respondWithResult(_0x49407d,_0x2f0331){_0x2f0331=_0x2f0331||0xc8;return function(_0x1868e3){if(_0x1868e3){return _0x49407d[_0x0924('0x1a')](_0x2f0331)[_0x0924('0x1b')](_0x1868e3);}};}function respondWithFilteredResult(_0x55b16c,_0x18cda0){return function(_0x997e31){if(_0x997e31){var _0x496c06=typeof _0x18cda0['offset']===_0x0924('0x1c')&&typeof _0x18cda0['limit']===_0x0924('0x1c');var _0x8a422f=_0x997e31[_0x0924('0x1d')];var _0x1356ea=_0x496c06?0x0:_0x18cda0['offset'];var _0x49f75e=_0x496c06?_0x997e31['count']:_0x18cda0[_0x0924('0x1e')]+_0x18cda0[_0x0924('0x1f')];var _0x270e77;if(_0x49f75e>=_0x8a422f){_0x49f75e=_0x8a422f;_0x270e77=0xc8;}else{_0x270e77=0xce;}_0x55b16c[_0x0924('0x1a')](_0x270e77);return _0x55b16c[_0x0924('0x20')](_0x0924('0x21'),_0x1356ea+'-'+_0x49f75e+'/'+_0x8a422f)[_0x0924('0x1b')](_0x997e31);}return null;};}function patchUpdates(_0x1111f1){return function(_0x54d7fb){try{jsonpatch['apply'](_0x54d7fb,_0x1111f1,!![]);}catch(_0x3bd4c4){return BPromise[_0x0924('0x22')](_0x3bd4c4);}return _0x54d7fb[_0x0924('0x23')]();};}function saveUpdates(_0x1649ee,_0x218ba7){return function(_0x5a505e){if(_0x5a505e){return _0x5a505e[_0x0924('0x24')](_0x1649ee)[_0x0924('0x25')](function(_0x25df23){return _0x25df23;});}return null;};}function removeEntity(_0x164b09,_0x2e3ba0){return function(_0xd1a2da){if(_0xd1a2da){return _0xd1a2da[_0x0924('0x26')]()[_0x0924('0x25')](function(){_0x164b09[_0x0924('0x1a')](0xcc)[_0x0924('0x27')]();});}};}function handleEntityNotFound(_0x192d8a,_0x395ca2){return function(_0x50f691){if(!_0x50f691){_0x192d8a['sendStatus'](0x194);}return _0x50f691;};}function handleError(_0x5f0efe,_0x2635b0){_0x2635b0=_0x2635b0||0x1f4;return function(_0x3efc39){logger[_0x0924('0x28')](_0x3efc39[_0x0924('0x29')]);if(_0x3efc39[_0x0924('0x2a')]){delete _0x3efc39[_0x0924('0x2a')];}_0x5f0efe['status'](_0x2635b0)[_0x0924('0x2b')](_0x3efc39);};}exports[_0x0924('0x2c')]=function(_0x164c5a,_0x2bd16a){var _0x1f1756={},_0x52672a={},_0x2d2e9a={'count':0x0,'rows':[]};var _0xc16bdf=_[_0x0924('0x2d')](db[_0x0924('0x2e')][_0x0924('0x2f')],function(_0x270613){return{'name':_0x270613['fieldName'],'type':_0x270613[_0x0924('0x30')][_0x0924('0x31')]};});_0x52672a['model']=_[_0x0924('0x2d')](_0xc16bdf,_0x0924('0x2a'));_0x52672a[_0x0924('0x32')]=_[_0x0924('0x33')](_0x164c5a[_0x0924('0x32')]);_0x52672a['filters']=_[_0x0924('0x34')](_0x52672a[_0x0924('0x35')],_0x52672a[_0x0924('0x32')]);_0x1f1756[_0x0924('0x36')]=_[_0x0924('0x34')](_0x52672a['model'],qs['fields'](_0x164c5a[_0x0924('0x32')][_0x0924('0x37')]));_0x1f1756['attributes']=_0x1f1756[_0x0924('0x36')][_0x0924('0x38')]?_0x1f1756[_0x0924('0x36')]:_0x52672a[_0x0924('0x35')];if(!_0x164c5a['query'][_0x0924('0x39')](_0x0924('0x3a'))){_0x1f1756[_0x0924('0x1f')]=qs[_0x0924('0x1f')](_0x164c5a['query']['limit']);_0x1f1756[_0x0924('0x1e')]=qs['offset'](_0x164c5a['query'][_0x0924('0x1e')]);}_0x1f1756[_0x0924('0x3b')]=qs['sort'](_0x164c5a[_0x0924('0x32')]['sort']);_0x1f1756[_0x0924('0x3c')]=qs['filters'](_[_0x0924('0x3d')](_0x164c5a['query'],_0x52672a[_0x0924('0x3e')]),_0xc16bdf);if(_0x164c5a[_0x0924('0x32')][_0x0924('0x3f')]){_0x1f1756[_0x0924('0x3c')]=_[_0x0924('0x40')](_0x1f1756[_0x0924('0x3c')],{'$or':_[_0x0924('0x2d')](_0xc16bdf,function(_0x458f45){if(_0x458f45[_0x0924('0x30')]!==_0x0924('0x41')){var _0x4589c1={};_0x4589c1[_0x458f45['name']]={'$like':'%'+_0x164c5a[_0x0924('0x32')][_0x0924('0x3f')]+'%'};return _0x4589c1;}})});}_0x1f1756=_[_0x0924('0x40')]({},_0x1f1756,_0x164c5a['options']);var _0x4340e9={'where':_0x1f1756[_0x0924('0x3c')]};return db['SmsTransferReport'][_0x0924('0x1d')](_0x4340e9)['then'](function(_0x536a5a){_0x2d2e9a[_0x0924('0x1d')]=_0x536a5a;if(_0x164c5a[_0x0924('0x32')][_0x0924('0x42')]){_0x1f1756[_0x0924('0x43')]=[{'all':!![]}];}return db[_0x0924('0x2e')]['findAll'](_0x1f1756);})[_0x0924('0x25')](function(_0x2d77f0){_0x2d2e9a['rows']=_0x2d77f0;return _0x2d2e9a;})['then'](respondWithFilteredResult(_0x2bd16a,_0x1f1756))['catch'](handleError(_0x2bd16a,null));};exports[_0x0924('0x44')]=function(_0x18b3ce,_0x2f0eb1){var _0x35d11f={'raw':!![],'where':{'id':_0x18b3ce[_0x0924('0x45')]['id']}},_0x1f4634={};_0x1f4634[_0x0924('0x35')]=_[_0x0924('0x33')](db[_0x0924('0x2e')]['rawAttributes']);_0x1f4634[_0x0924('0x32')]=_[_0x0924('0x33')](_0x18b3ce[_0x0924('0x32')]);_0x1f4634['filters']=_[_0x0924('0x34')](_0x1f4634[_0x0924('0x35')],_0x1f4634['query']);_0x35d11f[_0x0924('0x36')]=_[_0x0924('0x34')](_0x1f4634[_0x0924('0x35')],qs[_0x0924('0x37')](_0x18b3ce[_0x0924('0x32')][_0x0924('0x37')]));_0x35d11f[_0x0924('0x36')]=_0x35d11f[_0x0924('0x36')][_0x0924('0x38')]?_0x35d11f[_0x0924('0x36')]:_0x1f4634[_0x0924('0x35')];if(_0x18b3ce[_0x0924('0x32')]['includeAll']){_0x35d11f[_0x0924('0x43')]=[{'all':!![]}];}_0x35d11f=_['merge']({},_0x35d11f,_0x18b3ce[_0x0924('0x46')]);return db['SmsTransferReport'][_0x0924('0x47')](_0x35d11f)[_0x0924('0x25')](handleEntityNotFound(_0x2f0eb1,null))['then'](respondWithResult(_0x2f0eb1,null))[_0x0924('0x48')](handleError(_0x2f0eb1,null));};exports[_0x0924('0x49')]=function(_0x503b24,_0x33abce){return db[_0x0924('0x2e')][_0x0924('0x49')](_0x503b24[_0x0924('0x4a')],{})[_0x0924('0x25')](respondWithResult(_0x33abce,0xc9))['catch'](handleError(_0x33abce,null));};exports['update']=function(_0x39303f,_0x42cfce){if(_0x39303f[_0x0924('0x4a')]['id']){delete _0x39303f[_0x0924('0x4a')]['id'];}return db['SmsTransferReport'][_0x0924('0x47')]({'where':{'id':_0x39303f[_0x0924('0x45')]['id']}})[_0x0924('0x25')](handleEntityNotFound(_0x42cfce,null))[_0x0924('0x25')](saveUpdates(_0x39303f[_0x0924('0x4a')],null))['then'](respondWithResult(_0x42cfce,null))['catch'](handleError(_0x42cfce,null));};exports['destroy']=function(_0x5460c2,_0x4cad2b){return db[_0x0924('0x2e')][_0x0924('0x47')]({'where':{'id':_0x5460c2[_0x0924('0x45')]['id']}})[_0x0924('0x25')](handleEntityNotFound(_0x4cad2b,null))[_0x0924('0x25')](removeEntity(_0x4cad2b,null))[_0x0924('0x48')](handleError(_0x4cad2b,null));};exports[_0x0924('0x4b')]=function(_0x147640,_0xeb0f93){return db[_0x0924('0x2e')][_0x0924('0x4b')]()[_0x0924('0x25')](respondWithResult(_0xeb0f93,null))[_0x0924('0x48')](handleError(_0xeb0f93,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6782571..b3de603 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 _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','util'];(function(_0x4c3427,_0xc1361b){var _0x497ba8=function(_0x350736){while(--_0x350736){_0x4c3427['push'](_0x4c3427['shift']());}};_0x497ba8(++_0xc1361b);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa4ba[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('SmsTransferReport',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5943=['request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x2ed6c5,_0x2312c5){var _0x6a89cc=function(_0xcd3161){while(--_0xcd3161){_0x2ed6c5['push'](_0x2ed6c5['shift']());}};_0x6a89cc(++_0x2312c5);}(_0x5943,0x168));var _0x3594=function(_0x464497,_0x1e7d08){_0x464497=_0x464497-0x0;var _0x25ec55=_0x5943[_0x464497];return _0x25ec55;};'use strict';var _=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var logger=require(_0x3594('0x2'))('api');var moment=require(_0x3594('0x3'));var BPromise=require('bluebird');var rp=require(_0x3594('0x4'));var fs=require('fs');var path=require(_0x3594('0x5'));var rimraf=require(_0x3594('0x6'));var config=require('../../config/environment');var attributes=require(_0x3594('0x7'));module[_0x3594('0x8')]=function(_0x1b099e,_0x114190){return _0x1b099e[_0x3594('0x9')](_0x3594('0xa'),attributes,{'tableName':_0x3594('0xb'),'paranoid':![],'indexes':[{'name':_0x3594('0xc'),'fields':[_0x3594('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 2f965ff..2f5d4fa 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 _0x3351=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2bbf94,_0x4d2f13){var _0x452473=function(_0x485bfc){while(--_0x485bfc){_0x2bbf94['push'](_0x2bbf94['shift']());}};_0x452473(++_0x4d2f13);}(_0x3351,0x1b4));var _0x1335=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x3351[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x1335('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1335('0x1'));var rs=require(_0x1335('0x2'));var fs=require('fs');var Redis=require(_0x1335('0x3'));var db=require(_0x1335('0x4'))['db'];var utils=require(_0x1335('0x5'));var logger=require(_0x1335('0x6'))(_0x1335('0x7'));var config=require('../../config/environment');var jayson=require(_0x1335('0x8'));var client=jayson[_0x1335('0x9')][_0x1335('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cee84,_0x225646,_0x629305){return new BPromise(function(_0x1a1f63,_0x2c934c){return client[_0x1335('0xb')](_0x2cee84,_0x629305)[_0x1335('0xc')](function(_0x248005){logger['info'](_0x1335('0xd'),_0x225646,'request\x20sent');logger[_0x1335('0xe')](_0x1335('0xf'),_0x225646,_0x1335('0x10'),JSON[_0x1335('0x11')](_0x248005));if(_0x248005[_0x1335('0x12')]){if(_0x248005[_0x1335('0x12')]['code']===0x1f4){logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x248005[_0x1335('0x12')]['message']);return _0x2c934c(_0x248005[_0x1335('0x12')]['message']);}logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x248005['error'][_0x1335('0x13')]);return _0x1a1f63(_0x248005[_0x1335('0x12')]['message']);}else{logger['info'](_0x1335('0xd'),_0x225646,'request\x20sent');_0x1a1f63(_0x248005[_0x1335('0x14')][_0x1335('0x13')]);}})[_0x1335('0x15')](function(_0x59134c){logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x59134c);_0x2c934c(_0x59134c);});});} \ No newline at end of file +var _0x046b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x1cd15c,_0x330636){var _0x432cd8=function(_0x327c8b){while(--_0x327c8b){_0x1cd15c['push'](_0x1cd15c['shift']());}};_0x432cd8(++_0x330636);}(_0x046b,0x147));var _0xb046=function(_0x14c00f,_0x11b192){_0x14c00f=_0x14c00f-0x0;var _0x19fbda=_0x046b[_0x14c00f];return _0x19fbda;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb046('0x5'));var logger=require(_0xb046('0x6'))(_0xb046('0x7'));var config=require(_0xb046('0x8'));var jayson=require(_0xb046('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13203d,_0x1f00c8,_0x190c9a){return new BPromise(function(_0x308e79,_0x3c0678){return client[_0xb046('0xa')](_0x13203d,_0x190c9a)[_0xb046('0xb')](function(_0x170b66){logger['info'](_0xb046('0xc'),_0x1f00c8,'request\x20sent');logger[_0xb046('0xd')](_0xb046('0xe'),_0x1f00c8,_0xb046('0xf'),JSON[_0xb046('0x10')](_0x170b66));if(_0x170b66[_0xb046('0x11')]){if(_0x170b66['error']['code']===0x1f4){logger['error'](_0xb046('0xc'),_0x1f00c8,_0x170b66[_0xb046('0x11')]['message']);return _0x3c0678(_0x170b66[_0xb046('0x11')]['message']);}logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0x170b66['error'][_0xb046('0x12')]);return _0x308e79(_0x170b66[_0xb046('0x11')][_0xb046('0x12')]);}else{logger[_0xb046('0x13')](_0xb046('0xc'),_0x1f00c8,'request\x20sent');_0x308e79(_0x170b66[_0xb046('0x14')][_0xb046('0x12')]);}})[_0xb046('0x15')](function(_0xa3b910){logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0xa3b910);_0x3c0678(_0xa3b910);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cf387c4..f5dbe7e 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 _0x627b=['%s-%s%s','basename','extname','post','single','file','create','put','delete','/:id','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','format'];(function(_0xbd9895,_0x1af1a7){var _0x5d7443=function(_0x5c51dd){while(--_0x5c51dd){_0xbd9895['push'](_0xbd9895['shift']());}};_0x5d7443(++_0x1af1a7);}(_0x627b,0xf3));var _0xb627=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x627b[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require(_0xb627('0x0'));var path=require('path');var timeout=require(_0xb627('0x1'));var express=require('express');var router=express[_0xb627('0x2')]();var fs_extra=require(_0xb627('0x3'));var auth=require(_0xb627('0x4'));var interaction=require(_0xb627('0x5'));var config=require(_0xb627('0x6'));var controller=require(_0xb627('0x7'));router[_0xb627('0x8')]('/',auth[_0xb627('0x9')](),controller['index']);router[_0xb627('0x8')]('/:id',auth[_0xb627('0x9')](),controller[_0xb627('0xa')]);router[_0xb627('0x8')](_0xb627('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xb627('0xc')]({'destination':function(_0x199ef0,_0x2bd237,_0x1d4144){_0x1d4144(null,path[_0xb627('0xd')](config['root'],_0xb627('0xe')));},'filename':function(_0x853c23,_0x1e748d,_0x3fc2c5){_0x1e748d[_0xb627('0xf')]=_0x1e748d[_0xb627('0xf')][_0xb627('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3fc2c5(null,util[_0xb627('0x11')](_0xb627('0x12'),path[_0xb627('0x13')](_0x1e748d[_0xb627('0xf')],path['extname'](_0x1e748d[_0xb627('0xf')])),Date['now'](),path[_0xb627('0x14')](_0x1e748d[_0xb627('0xf')])));}})});router[_0xb627('0x15')]('/',upload[_0xb627('0x16')](_0xb627('0x17')),controller[_0xb627('0x18')]);router[_0xb627('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb627('0x1a')](_0xb627('0x1b'),auth[_0xb627('0x9')](),controller[_0xb627('0x1a')]);module[_0xb627('0x1c')]=router; \ No newline at end of file +var _0xb3a7=['replace','format','%s-%s%s','extname','now','single','create','put','update','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','diskStorage','root','originalname'];(function(_0x5a1d42,_0x1580ad){var _0x195c1f=function(_0x3f8b0c){while(--_0x3f8b0c){_0x5a1d42['push'](_0x5a1d42['shift']());}};_0x195c1f(++_0x1580ad);}(_0xb3a7,0x194));var _0x7b3a=function(_0x597d4f,_0xf528e9){_0x597d4f=_0x597d4f-0x0;var _0x1e65c1=_0xb3a7[_0x597d4f];return _0x1e65c1;};'use strict';var multer=require(_0x7b3a('0x0'));var util=require(_0x7b3a('0x1'));var path=require('path');var timeout=require(_0x7b3a('0x2'));var express=require(_0x7b3a('0x3'));var router=express[_0x7b3a('0x4')]();var fs_extra=require(_0x7b3a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7b3a('0x6'));var config=require(_0x7b3a('0x7'));var controller=require(_0x7b3a('0x8'));router[_0x7b3a('0x9')]('/',auth[_0x7b3a('0xa')](),controller[_0x7b3a('0xb')]);router[_0x7b3a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7b3a('0xc')]);router[_0x7b3a('0x9')]('/:id/download',auth[_0x7b3a('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x7b3a('0xd')]({'destination':function(_0x3c607d,_0x42b5e7,_0x4d1cc5){_0x4d1cc5(null,path['join'](config[_0x7b3a('0xe')],'server/files/sounds/original/'));},'filename':function(_0x285ffe,_0x15316b,_0x30b940){_0x15316b[_0x7b3a('0xf')]=_0x15316b[_0x7b3a('0xf')][_0x7b3a('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30b940(null,util[_0x7b3a('0x11')](_0x7b3a('0x12'),path['basename'](_0x15316b[_0x7b3a('0xf')],path[_0x7b3a('0x13')](_0x15316b[_0x7b3a('0xf')])),Date[_0x7b3a('0x14')](),path['extname'](_0x15316b[_0x7b3a('0xf')])));}})});router['post']('/',upload[_0x7b3a('0x15')]('file'),controller[_0x7b3a('0x16')]);router[_0x7b3a('0x17')]('/:id',auth[_0x7b3a('0xa')](),controller[_0x7b3a('0x18')]);router[_0x7b3a('0x19')](_0x7b3a('0x1a'),auth[_0x7b3a('0xa')](),controller[_0x7b3a('0x19')]);module[_0x7b3a('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 68b805e..3a01655 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 _0x203a=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x3940a3,_0x47d762){var _0x58aa44=function(_0x142af9){while(--_0x142af9){_0x3940a3['push'](_0x3940a3['shift']());}};_0x58aa44(++_0x47d762);}(_0x203a,0x136));var _0xa203=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x203a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa203('0x0')]={'name':{'type':Sequelize[_0xa203('0x1')],'unique':_0xa203('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa203('0x1')]},'display_name':{'type':Sequelize[_0xa203('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa203('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa203('0x4')]},'original_channelCount':{'type':Sequelize[_0xa203('0x5')]},'original_bitRate':{'type':Sequelize[_0xa203('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa203('0x5')]},'converted_format':{'type':Sequelize[_0xa203('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa203('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa203('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa203('0x5')]}}; \ No newline at end of file +var _0x6fa6=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x5a2bba,_0x37074d){var _0x2badee=function(_0x3cc97e){while(--_0x3cc97e){_0x5a2bba['push'](_0x5a2bba['shift']());}};_0x2badee(++_0x37074d);}(_0x6fa6,0x191));var _0x66fa=function(_0x7f379b,_0x184b2d){_0x7f379b=_0x7f379b-0x0;var _0x196089=_0x6fa6[_0x7f379b];return _0x196089;};'use strict';var Sequelize=require(_0x66fa('0x0'));module[_0x66fa('0x1')]={'name':{'type':Sequelize[_0x66fa('0x2')],'unique':_0x66fa('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x66fa('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x66fa('0x2')]},'original_format':{'type':Sequelize[_0x66fa('0x2')]},'original_duration':{'type':Sequelize[_0x66fa('0x4')]},'original_sampleCount':{'type':Sequelize[_0x66fa('0x5')]},'original_channelCount':{'type':Sequelize[_0x66fa('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x66fa('0x6')]},'converted_format':{'type':Sequelize[_0x66fa('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x66fa('0x6')]},'converted_bitRate':{'type':Sequelize[_0x66fa('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x66fa('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 361fdf2..c447ae1 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 _0x1476=['body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','Sounds','end','error','stack','send','index','Sound','rawAttributes','fieldName','type','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','root','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','create'];(function(_0x2330cf,_0x5add9f){var _0x5e230f=function(_0x1f44f7){while(--_0x1f44f7){_0x2330cf['push'](_0x2330cf['shift']());}};_0x5e230f(++_0x5add9f);}(_0x1476,0x8a));var _0x6147=function(_0x5a75d3,_0x3f9427){_0x5a75d3=_0x5a75d3-0x0;var _0x1fe768=_0x1476[_0x5a75d3];return _0x1fe768;};'use strict';var emlformat=require(_0x6147('0x0'));var rimraf=require(_0x6147('0x1'));var zipdir=require(_0x6147('0x2'));var jsonpatch=require(_0x6147('0x3'));var rp=require(_0x6147('0x4'));var moment=require(_0x6147('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6147('0x6'));var util=require('util');var path=require(_0x6147('0x7'));var sox=require(_0x6147('0x8'));var csv=require(_0x6147('0x9'));var ejs=require(_0x6147('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6147('0xb'));var crypto=require(_0x6147('0xc'));var jsforce=require(_0x6147('0xd'));var deskjs=require(_0x6147('0xe'));var toCsv=require(_0x6147('0x9'));var querystring=require(_0x6147('0xf'));var Papa=require('papaparse');var Redis=require(_0x6147('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6147('0x11'));var as=require(_0x6147('0x12'));var hardwareService=require(_0x6147('0x13'));var logger=require(_0x6147('0x14'))(_0x6147('0x15'));var utils=require(_0x6147('0x16'));var config=require(_0x6147('0x17'));var licenseUtil=require(_0x6147('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4275,_0x207f19){_0x207f19=_0x207f19||0xcc;return function(_0x2c7bc4){if(_0x2c7bc4){return _0x2f4275[_0x6147('0x19')](_0x207f19);}return _0x2f4275[_0x6147('0x1a')](_0x207f19)['end']();};}function respondWithResult(_0x469fa5,_0x1205b2){_0x1205b2=_0x1205b2||0xc8;return function(_0x4962a7){if(_0x4962a7){return _0x469fa5['status'](_0x1205b2)['json'](_0x4962a7);}};}function respondWithFilteredResult(_0x807475,_0x4ff887){return function(_0x5b0db8){if(_0x5b0db8){var _0x12f00b=typeof _0x4ff887[_0x6147('0x1b')]===_0x6147('0x1c')&&typeof _0x4ff887[_0x6147('0x1d')]===_0x6147('0x1c');var _0xe1cc66=_0x5b0db8[_0x6147('0x1e')];var _0x5ba2a6=_0x12f00b?0x0:_0x4ff887[_0x6147('0x1b')];var _0x450a86=_0x12f00b?_0x5b0db8[_0x6147('0x1e')]:_0x4ff887[_0x6147('0x1b')]+_0x4ff887[_0x6147('0x1d')];var _0x2e0ca1;if(_0x450a86>=_0xe1cc66){_0x450a86=_0xe1cc66;_0x2e0ca1=0xc8;}else{_0x2e0ca1=0xce;}_0x807475[_0x6147('0x1a')](_0x2e0ca1);return _0x807475[_0x6147('0x1f')](_0x6147('0x20'),_0x5ba2a6+'-'+_0x450a86+'/'+_0xe1cc66)[_0x6147('0x21')](_0x5b0db8);}return null;};}function patchUpdates(_0x370863){return function(_0x45ec6f){try{jsonpatch[_0x6147('0x22')](_0x45ec6f,_0x370863,!![]);}catch(_0x409ffe){return BPromise[_0x6147('0x23')](_0x409ffe);}return _0x45ec6f[_0x6147('0x24')]();};}function saveUpdates(_0x2332a4,_0x55a8c4){return function(_0x4a0bec){if(_0x4a0bec){return _0x4a0bec[_0x6147('0x25')](_0x2332a4)['then'](function(_0x16d99e){return _0x16d99e;});}return null;};}function removeEntity(_0x1f2dcb,_0xc069e5){return function(_0xe3799){if(_0xe3799){return _0xe3799[_0x6147('0x26')]()[_0x6147('0x27')](function(){var _0x13455b=_0xe3799['get']({'plain':!![]});var _0x52e437=_0x6147('0x28');return db['UserProfileResource'][_0x6147('0x26')]({'where':{'type':_0x52e437,'resourceId':_0x13455b['id']}})['then'](function(){return _0xe3799;});})[_0x6147('0x27')](function(){_0x1f2dcb[_0x6147('0x1a')](0xcc)[_0x6147('0x29')]();});}};}function handleEntityNotFound(_0x19c6fc,_0x5560e8){return function(_0x53e731){if(!_0x53e731){_0x19c6fc[_0x6147('0x19')](0x194);}return _0x53e731;};}function handleError(_0x37f8ff,_0x3dc185){_0x3dc185=_0x3dc185||0x1f4;return function(_0x1653e4){logger[_0x6147('0x2a')](_0x1653e4[_0x6147('0x2b')]);if(_0x1653e4['name']){delete _0x1653e4['name'];}_0x37f8ff[_0x6147('0x1a')](_0x3dc185)[_0x6147('0x2c')](_0x1653e4);};}exports[_0x6147('0x2d')]=function(_0xddd698,_0x10d2d3){var _0x1a1a58={},_0x2c629a={},_0x529ba9={'count':0x0,'rows':[]};var _0x457ee3=_['map'](db[_0x6147('0x2e')][_0x6147('0x2f')],function(_0x52de41){return{'name':_0x52de41[_0x6147('0x30')],'type':_0x52de41[_0x6147('0x31')]['key']};});_0x2c629a[_0x6147('0x32')]=_[_0x6147('0x33')](_0x457ee3,_0x6147('0x34'));_0x2c629a['query']=_['keys'](_0xddd698[_0x6147('0x35')]);_0x2c629a['filters']=_[_0x6147('0x36')](_0x2c629a[_0x6147('0x32')],_0x2c629a['query']);_0x1a1a58[_0x6147('0x37')]=_[_0x6147('0x36')](_0x2c629a[_0x6147('0x32')],qs[_0x6147('0x38')](_0xddd698['query'][_0x6147('0x38')]));_0x1a1a58[_0x6147('0x37')]=_0x1a1a58[_0x6147('0x37')][_0x6147('0x39')]?_0x1a1a58[_0x6147('0x37')]:_0x2c629a[_0x6147('0x32')];if(!_0xddd698[_0x6147('0x35')][_0x6147('0x3a')](_0x6147('0x3b'))){_0x1a1a58['limit']=qs['limit'](_0xddd698['query']['limit']);_0x1a1a58[_0x6147('0x1b')]=qs['offset'](_0xddd698[_0x6147('0x35')][_0x6147('0x1b')]);}_0x1a1a58[_0x6147('0x3c')]=qs[_0x6147('0x3d')](_0xddd698[_0x6147('0x35')][_0x6147('0x3d')]);_0x1a1a58['where']=qs[_0x6147('0x3e')](_[_0x6147('0x3f')](_0xddd698[_0x6147('0x35')],_0x2c629a[_0x6147('0x3e')]),_0x457ee3);if(_0xddd698['query'][_0x6147('0x40')]){_0x1a1a58[_0x6147('0x41')]=_[_0x6147('0x42')](_0x1a1a58[_0x6147('0x41')],{'$or':_[_0x6147('0x33')](_0x457ee3,function(_0x389994){if(_0x389994[_0x6147('0x31')]!==_0x6147('0x43')){var _0x4b5278={};_0x4b5278[_0x389994[_0x6147('0x34')]]={'$like':'%'+_0xddd698[_0x6147('0x35')][_0x6147('0x40')]+'%'};return _0x4b5278;}})});}_0x1a1a58=_[_0x6147('0x42')]({},_0x1a1a58,_0xddd698[_0x6147('0x44')]);var _0x238344={'where':_0x1a1a58[_0x6147('0x41')]};return db[_0x6147('0x2e')]['count'](_0x238344)[_0x6147('0x27')](function(_0x58e2a4){_0x529ba9['count']=_0x58e2a4;if(_0xddd698['query'][_0x6147('0x45')]){_0x1a1a58[_0x6147('0x46')]=[{'all':!![]}];}return db[_0x6147('0x2e')][_0x6147('0x47')](_0x1a1a58);})[_0x6147('0x27')](function(_0x23efb4){_0x529ba9[_0x6147('0x48')]=_0x23efb4;return _0x529ba9;})[_0x6147('0x27')](respondWithFilteredResult(_0x10d2d3,_0x1a1a58))[_0x6147('0x49')](handleError(_0x10d2d3,null));};exports['show']=function(_0x3af0ca,_0x85f0e8){var _0x1d3d91={'raw':!![],'where':{'id':_0x3af0ca[_0x6147('0x4a')]['id']}},_0x2464f3={};_0x2464f3['model']=_[_0x6147('0x4b')](db[_0x6147('0x2e')]['rawAttributes']);_0x2464f3[_0x6147('0x35')]=_['keys'](_0x3af0ca[_0x6147('0x35')]);_0x2464f3['filters']=_[_0x6147('0x36')](_0x2464f3[_0x6147('0x32')],_0x2464f3['query']);_0x1d3d91['attributes']=_[_0x6147('0x36')](_0x2464f3[_0x6147('0x32')],qs[_0x6147('0x38')](_0x3af0ca[_0x6147('0x35')]['fields']));_0x1d3d91['attributes']=_0x1d3d91[_0x6147('0x37')][_0x6147('0x39')]?_0x1d3d91[_0x6147('0x37')]:_0x2464f3['model'];if(_0x3af0ca['query'][_0x6147('0x45')]){_0x1d3d91[_0x6147('0x46')]=[{'all':!![]}];}_0x1d3d91=_[_0x6147('0x42')]({},_0x1d3d91,_0x3af0ca[_0x6147('0x44')]);return db[_0x6147('0x2e')][_0x6147('0x4c')](_0x1d3d91)[_0x6147('0x27')](handleEntityNotFound(_0x85f0e8,null))['then'](respondWithResult(_0x85f0e8,null))[_0x6147('0x49')](handleError(_0x85f0e8,null));};exports[_0x6147('0x4d')]=function(_0x3e2f46,_0x47e363,_0x2189d1){return db[_0x6147('0x2e')]['find']({'where':{'id':_0x3e2f46[_0x6147('0x4a')]['id']},'attributes':[_0x6147('0x34'),_0x6147('0x4e'),_0x6147('0x4f')],'raw':!![]})[_0x6147('0x27')](handleEntityNotFound(_0x47e363,null))[_0x6147('0x27')](function(_0xd6bb77){if(_0xd6bb77){if(!fs[_0x6147('0x50')](path[_0x6147('0x51')](config['root'],_0x6147('0x52'),_0xd6bb77[_0x6147('0x4e')]+'.'+_0xd6bb77[_0x6147('0x4f')]))){throw new db[(_0x6147('0x53'))][(_0x6147('0x54'))](_0x6147('0x55'));}return _0x47e363[_0x6147('0x4d')](path['join'](config['root'],_0x6147('0x52'),util[_0x6147('0x56')]('%s.%s',_0xd6bb77[_0x6147('0x4e')],_0xd6bb77[_0x6147('0x4f')])),util['format'](_0x6147('0x57'),_0xd6bb77[_0x6147('0x34')],_0xd6bb77[_0x6147('0x4f')]));}return null;})['catch'](handleError(_0x47e363,null));};exports['create']=function(_0x416528,_0x420d5a,_0x1b185f){var _0x16e274={'name':path[_0x6147('0x58')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')],path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')])),'save_name':path[_0x6147('0x58')](_0x416528[_0x6147('0x59')][_0x6147('0x5c')],path[_0x6147('0x5b')](_0x416528['file']['filename'])),'original_format':path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')])[_0x6147('0x5d')](0x1),'converted_format':'wav'};var _0x1854e9=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x5f'),_0x416528['file'][_0x6147('0x5c')]);var _0x264e68=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x52'),util[_0x6147('0x56')](_0x6147('0x57'),path[_0x6147('0x58')](_0x416528[_0x6147('0x59')]['filename'],path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5c')])),_0x16e274[_0x6147('0x4f')]));logger['info'](_0x6147('0x60'),_0x1854e9);logger[_0x6147('0x61')](_0x6147('0x62'),_0x264e68);try{fs[_0x6147('0x63')](_0x1854e9,parseInt(_0x6147('0x64'),0x8));var _0x14afab=sox[_0x6147('0x65')](_0x1854e9,_0x264e68,{'sampleRate':0x1f40,'format':_0x6147('0x66'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14afab['on'](_0x6147('0x2a'),function(_0x2671e9){fs[_0x6147('0x67')](_0x1854e9);_0x420d5a[_0x6147('0x1a')](0x1f4)[_0x6147('0x2c')](_0x2671e9);});_0x14afab['on'](_0x6147('0x68'),function(_0x3772c2){_0x16e274[_0x6147('0x69')]=isNaN(_0x3772c2['duration'])?null:_0x3772c2[_0x6147('0x6a')]*0x3e8;_0x16e274[_0x6147('0x6b')]=isNaN(_0x3772c2[_0x6147('0x6c')])?null:_0x3772c2[_0x6147('0x6c')];_0x16e274[_0x6147('0x6d')]=isNaN(_0x3772c2['channelCount'])?null:_0x3772c2['channelCount'];_0x16e274['original_bitRate']=isNaN(_0x3772c2[_0x6147('0x6e')])?null:_0x3772c2[_0x6147('0x6e')];_0x16e274['original_sampleRate']=isNaN(_0x3772c2[_0x6147('0x6f')])?null:_0x3772c2[_0x6147('0x6f')];});_0x14afab['on'](_0x6147('0x70'),function(_0x572089){_0x16e274[_0x6147('0x71')]=isNaN(_0x572089['duration'])?null:_0x572089[_0x6147('0x6a')]*0x3e8;_0x16e274[_0x6147('0x72')]=isNaN(_0x572089['sampleCount'])?null:_0x572089[_0x6147('0x6c')];_0x16e274[_0x6147('0x73')]=isNaN(_0x572089[_0x6147('0x74')])?null:_0x572089[_0x6147('0x74')];_0x16e274[_0x6147('0x75')]=isNaN(_0x572089['bitRate'])?null:_0x572089[_0x6147('0x6e')];_0x16e274[_0x6147('0x76')]=isNaN(_0x572089[_0x6147('0x6f')])?null:_0x572089[_0x6147('0x6f')];});_0x14afab['on'](_0x6147('0x29'),function(){fs[_0x6147('0x63')](_0x264e68,parseInt(_0x6147('0x64'),0x8));return db[_0x6147('0x2e')][_0x6147('0x77')](_0x16e274)['then'](function(_0x106368){var _0x56077e={'role':_0x416528[_0x6147('0x78')][_0x6147('0x79')],'userProfileId':_0x416528[_0x6147('0x78')][_0x6147('0x7a')]};if(!_0x56077e)throw new Error(_0x6147('0x7b'));if(_0x56077e[_0x6147('0x79')]==='user'){var _0x2fb539=_0x106368['get']({'plain':!![]});return db[_0x6147('0x7c')][_0x6147('0x4c')]({'where':{'name':_0x6147('0x28'),'userProfileId':_0x56077e[_0x6147('0x7a')]},'raw':!![]})['then'](function(_0xc4a684){if(_0xc4a684&&_0xc4a684[_0x6147('0x7d')]===0x0){return db[_0x6147('0x7e')][_0x6147('0x77')]({'name':_0x2fb539[_0x6147('0x34')],'resourceId':_0x2fb539['id'],'type':_0xc4a684[_0x6147('0x34')],'sectionId':_0xc4a684['id']},{})[_0x6147('0x27')](function(){return _0x106368;});}else{return _0x106368;}})[_0x6147('0x49')](function(_0x9939a6){logger[_0x6147('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9939a6);throw _0x9939a6;});}return _0x106368;})['then'](respondWithResult(_0x420d5a,null))['catch'](handleError(_0x420d5a,null));});_0x14afab['start']();}catch(_0x4f7da8){_0x420d5a['status'](0x1f4)[_0x6147('0x2c')](_0x4f7da8);}};exports['update']=function(_0x2a94ff,_0xcfcc6b,_0x212cb4){return db[_0x6147('0x2e')][_0x6147('0x4c')]({'where':{'id':_0x2a94ff[_0x6147('0x4a')]['id']}})['then'](handleEntityNotFound(_0xcfcc6b,null))[_0x6147('0x27')](saveUpdates(_[_0x6147('0x3f')](_0x2a94ff[_0x6147('0x78')],[_0x6147('0x34'),_0x6147('0x7f')]),null))[_0x6147('0x27')](respondWithResult(_0xcfcc6b,null))[_0x6147('0x49')](handleError(_0xcfcc6b,null));};exports[_0x6147('0x80')]=function(_0x32c791,_0x5a5b92,_0x18f50c){return db[_0x6147('0x2e')]['find']({'where':{'id':_0x32c791['params']['id']}})['then'](function(_0x155c44){if(_0x155c44){return _0x155c44[_0x6147('0x26')]();}})[_0x6147('0x27')](function(_0x3bf7d7){var _0x3ca07d=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x5f'),util[_0x6147('0x56')]('%s.%s',_0x3bf7d7[_0x6147('0x4e')],_0x3bf7d7['original_format']));var _0x49efc7=path[_0x6147('0x51')](config[_0x6147('0x5e')],'server/files/sounds/converted',util[_0x6147('0x56')](_0x6147('0x57'),_0x3bf7d7[_0x6147('0x4e')],_0x3bf7d7[_0x6147('0x4f')]));fs[_0x6147('0x67')](_0x3ca07d);fs[_0x6147('0x67')](_0x49efc7);return _0x3bf7d7;})[_0x6147('0x27')](function(_0x23d6df){if(_0x23d6df){return _0x5a5b92[_0x6147('0x1a')](0xcc)[_0x6147('0x29')]();}})[_0x6147('0x27')](handleEntityNotFound(_0x5a5b92,null))[_0x6147('0x49')](handleError(_0x5a5b92,null));}; \ No newline at end of file +var _0x8cb6=['util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','reject','save','update','then','destroy','Sounds','error','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','params','keys','Sound','include','options','find','existsSync','join','root','server/files/sounds/converted','save_name','format','%s.%s','converted_format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','transcode','src','original_duration','original_sampleCount','sampleCount','channelCount','bitRate','sampleRate','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','unlinkSync','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4d367a,_0x1b2740){var _0x159841=function(_0x1e3d7b){while(--_0x1e3d7b){_0x4d367a['push'](_0x4d367a['shift']());}};_0x159841(++_0x1b2740);}(_0x8cb6,0xe6));var _0x68cb=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x8cb6[_0x562ec5];return _0x279c8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68cb('0x0'));var zipdir=require(_0x68cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68cb('0x2'));var moment=require('moment');var BPromise=require(_0x68cb('0x3'));var Mustache=require('mustache');var util=require(_0x68cb('0x4'));var path=require('path');var sox=require(_0x68cb('0x5'));var csv=require(_0x68cb('0x6'));var ejs=require(_0x68cb('0x7'));var fs=require('fs');var fs_extra=require(_0x68cb('0x8'));var _=require('lodash');var squel=require(_0x68cb('0x9'));var crypto=require(_0x68cb('0xa'));var jsforce=require(_0x68cb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x68cb('0x6'));var querystring=require(_0x68cb('0xc'));var Papa=require(_0x68cb('0xd'));var Redis=require(_0x68cb('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x68cb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68cb('0x10'));var logger=require(_0x68cb('0x11'))(_0x68cb('0x12'));var utils=require(_0x68cb('0x13'));var config=require(_0x68cb('0x14'));var licenseUtil=require(_0x68cb('0x15'));var db=require(_0x68cb('0x16'))['db'];function respondWithStatusCode(_0x304de7,_0x397f98){_0x397f98=_0x397f98||0xcc;return function(_0x244762){if(_0x244762){return _0x304de7[_0x68cb('0x17')](_0x397f98);}return _0x304de7[_0x68cb('0x18')](_0x397f98)[_0x68cb('0x19')]();};}function respondWithResult(_0x23f616,_0x499721){_0x499721=_0x499721||0xc8;return function(_0x3e35f0){if(_0x3e35f0){return _0x23f616[_0x68cb('0x18')](_0x499721)[_0x68cb('0x1a')](_0x3e35f0);}};}function respondWithFilteredResult(_0x467857,_0x5d0b92){return function(_0x1dd08f){if(_0x1dd08f){var _0x4f5fed=typeof _0x5d0b92['offset']===_0x68cb('0x1b')&&typeof _0x5d0b92[_0x68cb('0x1c')]==='undefined';var _0x3dac58=_0x1dd08f[_0x68cb('0x1d')];var _0x3b2532=_0x4f5fed?0x0:_0x5d0b92[_0x68cb('0x1e')];var _0x342f0c=_0x4f5fed?_0x1dd08f['count']:_0x5d0b92[_0x68cb('0x1e')]+_0x5d0b92[_0x68cb('0x1c')];var _0x5bcb8c;if(_0x342f0c>=_0x3dac58){_0x342f0c=_0x3dac58;_0x5bcb8c=0xc8;}else{_0x5bcb8c=0xce;}_0x467857[_0x68cb('0x18')](_0x5bcb8c);return _0x467857[_0x68cb('0x1f')]('Content-Range',_0x3b2532+'-'+_0x342f0c+'/'+_0x3dac58)['json'](_0x1dd08f);}return null;};}function patchUpdates(_0xdcf85a){return function(_0x4f77fe){try{jsonpatch['apply'](_0x4f77fe,_0xdcf85a,!![]);}catch(_0x257618){return BPromise[_0x68cb('0x20')](_0x257618);}return _0x4f77fe[_0x68cb('0x21')]();};}function saveUpdates(_0x461314,_0x541b24){return function(_0x36b892){if(_0x36b892){return _0x36b892[_0x68cb('0x22')](_0x461314)[_0x68cb('0x23')](function(_0x51fe18){return _0x51fe18;});}return null;};}function removeEntity(_0x5cee86,_0x38f076){return function(_0x16fad0){if(_0x16fad0){return _0x16fad0[_0x68cb('0x24')]()[_0x68cb('0x23')](function(){var _0x8fdfd3=_0x16fad0['get']({'plain':!![]});var _0x176203=_0x68cb('0x25');return db['UserProfileResource'][_0x68cb('0x24')]({'where':{'type':_0x176203,'resourceId':_0x8fdfd3['id']}})[_0x68cb('0x23')](function(){return _0x16fad0;});})['then'](function(){_0x5cee86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42630d,_0x455330){return function(_0xcc8983){if(!_0xcc8983){_0x42630d[_0x68cb('0x17')](0x194);}return _0xcc8983;};}function handleError(_0x58eb1f,_0x4b18dd){_0x4b18dd=_0x4b18dd||0x1f4;return function(_0x5b4bac){logger[_0x68cb('0x26')](_0x5b4bac['stack']);if(_0x5b4bac[_0x68cb('0x27')]){delete _0x5b4bac[_0x68cb('0x27')];}_0x58eb1f[_0x68cb('0x18')](_0x4b18dd)[_0x68cb('0x28')](_0x5b4bac);};}exports[_0x68cb('0x29')]=function(_0x37eed7,_0x35329c){var _0x2d0b5b={},_0x44481d={},_0x32e216={'count':0x0,'rows':[]};var _0x313dc6=_['map'](db['Sound'][_0x68cb('0x2a')],function(_0x4ae5bb){return{'name':_0x4ae5bb[_0x68cb('0x2b')],'type':_0x4ae5bb[_0x68cb('0x2c')]['key']};});_0x44481d[_0x68cb('0x2d')]=_[_0x68cb('0x2e')](_0x313dc6,'name');_0x44481d[_0x68cb('0x2f')]=_['keys'](_0x37eed7[_0x68cb('0x2f')]);_0x44481d[_0x68cb('0x30')]=_[_0x68cb('0x31')](_0x44481d[_0x68cb('0x2d')],_0x44481d[_0x68cb('0x2f')]);_0x2d0b5b['attributes']=_['intersection'](_0x44481d[_0x68cb('0x2d')],qs['fields'](_0x37eed7[_0x68cb('0x2f')][_0x68cb('0x32')]));_0x2d0b5b[_0x68cb('0x33')]=_0x2d0b5b[_0x68cb('0x33')][_0x68cb('0x34')]?_0x2d0b5b[_0x68cb('0x33')]:_0x44481d[_0x68cb('0x2d')];if(!_0x37eed7['query'][_0x68cb('0x35')](_0x68cb('0x36'))){_0x2d0b5b[_0x68cb('0x1c')]=qs[_0x68cb('0x1c')](_0x37eed7[_0x68cb('0x2f')][_0x68cb('0x1c')]);_0x2d0b5b[_0x68cb('0x1e')]=qs['offset'](_0x37eed7[_0x68cb('0x2f')][_0x68cb('0x1e')]);}_0x2d0b5b[_0x68cb('0x37')]=qs['sort'](_0x37eed7[_0x68cb('0x2f')][_0x68cb('0x38')]);_0x2d0b5b[_0x68cb('0x39')]=qs['filters'](_[_0x68cb('0x3a')](_0x37eed7[_0x68cb('0x2f')],_0x44481d[_0x68cb('0x30')]),_0x313dc6);if(_0x37eed7['query'][_0x68cb('0x3b')]){_0x2d0b5b['where']=_['merge'](_0x2d0b5b[_0x68cb('0x39')],{'$or':_[_0x68cb('0x2e')](_0x313dc6,function(_0x3ca086){if(_0x3ca086[_0x68cb('0x2c')]!==_0x68cb('0x3c')){var _0x2ed8a4={};_0x2ed8a4[_0x3ca086[_0x68cb('0x27')]]={'$like':'%'+_0x37eed7['query'][_0x68cb('0x3b')]+'%'};return _0x2ed8a4;}})});}_0x2d0b5b=_[_0x68cb('0x3d')]({},_0x2d0b5b,_0x37eed7['options']);var _0xb5a29={'where':_0x2d0b5b[_0x68cb('0x39')]};return db['Sound'][_0x68cb('0x1d')](_0xb5a29)[_0x68cb('0x23')](function(_0x26717c){_0x32e216[_0x68cb('0x1d')]=_0x26717c;if(_0x37eed7[_0x68cb('0x2f')][_0x68cb('0x3e')]){_0x2d0b5b['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x2d0b5b);})[_0x68cb('0x23')](function(_0x14f5ec){_0x32e216[_0x68cb('0x3f')]=_0x14f5ec;return _0x32e216;})[_0x68cb('0x23')](respondWithFilteredResult(_0x35329c,_0x2d0b5b))[_0x68cb('0x40')](handleError(_0x35329c,null));};exports['show']=function(_0x2e1049,_0x153ebc){var _0x317067={'raw':!![],'where':{'id':_0x2e1049[_0x68cb('0x41')]['id']}},_0x2b5ac8={};_0x2b5ac8[_0x68cb('0x2d')]=_[_0x68cb('0x42')](db[_0x68cb('0x43')][_0x68cb('0x2a')]);_0x2b5ac8[_0x68cb('0x2f')]=_[_0x68cb('0x42')](_0x2e1049[_0x68cb('0x2f')]);_0x2b5ac8[_0x68cb('0x30')]=_['intersection'](_0x2b5ac8[_0x68cb('0x2d')],_0x2b5ac8[_0x68cb('0x2f')]);_0x317067[_0x68cb('0x33')]=_[_0x68cb('0x31')](_0x2b5ac8[_0x68cb('0x2d')],qs[_0x68cb('0x32')](_0x2e1049[_0x68cb('0x2f')]['fields']));_0x317067[_0x68cb('0x33')]=_0x317067[_0x68cb('0x33')][_0x68cb('0x34')]?_0x317067[_0x68cb('0x33')]:_0x2b5ac8['model'];if(_0x2e1049[_0x68cb('0x2f')][_0x68cb('0x3e')]){_0x317067[_0x68cb('0x44')]=[{'all':!![]}];}_0x317067=_[_0x68cb('0x3d')]({},_0x317067,_0x2e1049[_0x68cb('0x45')]);return db['Sound'][_0x68cb('0x46')](_0x317067)[_0x68cb('0x23')](handleEntityNotFound(_0x153ebc,null))['then'](respondWithResult(_0x153ebc,null))[_0x68cb('0x40')](handleError(_0x153ebc,null));};exports['download']=function(_0xf94a0b,_0x19f5f3,_0x332970){return db[_0x68cb('0x43')][_0x68cb('0x46')]({'where':{'id':_0xf94a0b['params']['id']},'attributes':[_0x68cb('0x27'),'save_name','converted_format'],'raw':!![]})[_0x68cb('0x23')](handleEntityNotFound(_0x19f5f3,null))[_0x68cb('0x23')](function(_0x3d9157){if(_0x3d9157){if(!fs[_0x68cb('0x47')](path[_0x68cb('0x48')](config[_0x68cb('0x49')],_0x68cb('0x4a'),_0x3d9157[_0x68cb('0x4b')]+'.'+_0x3d9157['converted_format']))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x19f5f3['download'](path[_0x68cb('0x48')](config[_0x68cb('0x49')],_0x68cb('0x4a'),util[_0x68cb('0x4c')](_0x68cb('0x4d'),_0x3d9157[_0x68cb('0x4b')],_0x3d9157[_0x68cb('0x4e')])),util['format'](_0x68cb('0x4d'),_0x3d9157['name'],_0x3d9157[_0x68cb('0x4e')]));}return null;})[_0x68cb('0x40')](handleError(_0x19f5f3,null));};exports[_0x68cb('0x4f')]=function(_0x3b665e,_0x3ca1b8,_0x1a4b51){var _0x3f7fbd={'name':path[_0x68cb('0x50')](_0x3b665e[_0x68cb('0x51')][_0x68cb('0x52')],path[_0x68cb('0x53')](_0x3b665e[_0x68cb('0x51')]['originalname'])),'save_name':path[_0x68cb('0x50')](_0x3b665e[_0x68cb('0x51')]['filename'],path[_0x68cb('0x53')](_0x3b665e['file'][_0x68cb('0x54')])),'original_format':path[_0x68cb('0x53')](_0x3b665e[_0x68cb('0x51')]['originalname'])[_0x68cb('0x55')](0x1),'converted_format':_0x68cb('0x56')};var _0x1e71b1=path['join'](config['root'],_0x68cb('0x57'),_0x3b665e[_0x68cb('0x51')][_0x68cb('0x54')]);var _0x423e83=path[_0x68cb('0x48')](config[_0x68cb('0x49')],'server/files/sounds/converted',util[_0x68cb('0x4c')](_0x68cb('0x4d'),path[_0x68cb('0x50')](_0x3b665e[_0x68cb('0x51')][_0x68cb('0x54')],path[_0x68cb('0x53')](_0x3b665e['file'][_0x68cb('0x54')])),_0x3f7fbd[_0x68cb('0x4e')]));logger[_0x68cb('0x58')](_0x68cb('0x59'),_0x1e71b1);logger['info'](_0x68cb('0x5a'),_0x423e83);try{fs['chmodSync'](_0x1e71b1,parseInt('0777',0x8));var _0x1c8dd5=sox[_0x68cb('0x5b')](_0x1e71b1,_0x423e83,{'sampleRate':0x1f40,'format':_0x68cb('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c8dd5['on']('error',function(_0x5633b2){fs['unlinkSync'](_0x1e71b1);_0x3ca1b8[_0x68cb('0x18')](0x1f4)[_0x68cb('0x28')](_0x5633b2);});_0x1c8dd5['on'](_0x68cb('0x5c'),function(_0x15d509){_0x3f7fbd[_0x68cb('0x5d')]=isNaN(_0x15d509['duration'])?null:_0x15d509['duration']*0x3e8;_0x3f7fbd[_0x68cb('0x5e')]=isNaN(_0x15d509[_0x68cb('0x5f')])?null:_0x15d509[_0x68cb('0x5f')];_0x3f7fbd['original_channelCount']=isNaN(_0x15d509[_0x68cb('0x60')])?null:_0x15d509[_0x68cb('0x60')];_0x3f7fbd['original_bitRate']=isNaN(_0x15d509[_0x68cb('0x61')])?null:_0x15d509[_0x68cb('0x61')];_0x3f7fbd['original_sampleRate']=isNaN(_0x15d509[_0x68cb('0x62')])?null:_0x15d509[_0x68cb('0x62')];});_0x1c8dd5['on']('dest',function(_0x69cf9f){_0x3f7fbd[_0x68cb('0x63')]=isNaN(_0x69cf9f[_0x68cb('0x64')])?null:_0x69cf9f['duration']*0x3e8;_0x3f7fbd[_0x68cb('0x65')]=isNaN(_0x69cf9f[_0x68cb('0x5f')])?null:_0x69cf9f[_0x68cb('0x5f')];_0x3f7fbd[_0x68cb('0x66')]=isNaN(_0x69cf9f[_0x68cb('0x60')])?null:_0x69cf9f[_0x68cb('0x60')];_0x3f7fbd['converted_bitRate']=isNaN(_0x69cf9f[_0x68cb('0x61')])?null:_0x69cf9f[_0x68cb('0x61')];_0x3f7fbd[_0x68cb('0x67')]=isNaN(_0x69cf9f['sampleRate'])?null:_0x69cf9f[_0x68cb('0x62')];});_0x1c8dd5['on'](_0x68cb('0x19'),function(){fs['chmodSync'](_0x423e83,parseInt(_0x68cb('0x68'),0x8));return db['Sound'][_0x68cb('0x4f')](_0x3f7fbd)[_0x68cb('0x23')](function(_0x11fbc0){var _0x40ba3e={'role':_0x3b665e[_0x68cb('0x69')][_0x68cb('0x6a')],'userProfileId':_0x3b665e[_0x68cb('0x69')][_0x68cb('0x6b')]};if(!_0x40ba3e)throw new Error(_0x68cb('0x6c'));if(_0x40ba3e[_0x68cb('0x6a')]===_0x68cb('0x6d')){var _0x4e2a67=_0x11fbc0[_0x68cb('0x6e')]({'plain':!![]});return db[_0x68cb('0x6f')]['find']({'where':{'name':'Sounds','userProfileId':_0x40ba3e[_0x68cb('0x6b')]},'raw':!![]})[_0x68cb('0x23')](function(_0x23b170){if(_0x23b170&&_0x23b170[_0x68cb('0x70')]===0x0){return db[_0x68cb('0x71')][_0x68cb('0x4f')]({'name':_0x4e2a67[_0x68cb('0x27')],'resourceId':_0x4e2a67['id'],'type':_0x23b170[_0x68cb('0x27')],'sectionId':_0x23b170['id']},{})[_0x68cb('0x23')](function(){return _0x11fbc0;});}else{return _0x11fbc0;}})['catch'](function(_0x4ed2cb){logger['error'](_0x68cb('0x72'),_0x4ed2cb);throw _0x4ed2cb;});}return _0x11fbc0;})['then'](respondWithResult(_0x3ca1b8,null))[_0x68cb('0x40')](handleError(_0x3ca1b8,null));});_0x1c8dd5['start']();}catch(_0xfe7af5){_0x3ca1b8['status'](0x1f4)[_0x68cb('0x28')](_0xfe7af5);}};exports[_0x68cb('0x22')]=function(_0x3746c8,_0x52de7e,_0x549b8d){return db[_0x68cb('0x43')]['find']({'where':{'id':_0x3746c8[_0x68cb('0x41')]['id']}})[_0x68cb('0x23')](handleEntityNotFound(_0x52de7e,null))[_0x68cb('0x23')](saveUpdates(_[_0x68cb('0x3a')](_0x3746c8['body'],[_0x68cb('0x27'),'description']),null))[_0x68cb('0x23')](respondWithResult(_0x52de7e,null))[_0x68cb('0x40')](handleError(_0x52de7e,null));};exports[_0x68cb('0x73')]=function(_0x211b86,_0x25869a,_0x6a7b2d){return db[_0x68cb('0x43')][_0x68cb('0x46')]({'where':{'id':_0x211b86[_0x68cb('0x41')]['id']}})[_0x68cb('0x23')](function(_0x40e1f8){if(_0x40e1f8){return _0x40e1f8[_0x68cb('0x24')]();}})[_0x68cb('0x23')](function(_0x260a9a){var _0x3617c7=path['join'](config[_0x68cb('0x49')],_0x68cb('0x57'),util[_0x68cb('0x4c')](_0x68cb('0x4d'),_0x260a9a['save_name'],_0x260a9a['original_format']));var _0x45ee7b=path['join'](config[_0x68cb('0x49')],'server/files/sounds/converted',util['format'](_0x68cb('0x4d'),_0x260a9a[_0x68cb('0x4b')],_0x260a9a['converted_format']));fs['unlinkSync'](_0x3617c7);fs[_0x68cb('0x74')](_0x45ee7b);return _0x260a9a;})[_0x68cb('0x23')](function(_0x5e2dac){if(_0x5e2dac){return _0x25869a['status'](0xcc)['end']();}})[_0x68cb('0x23')](handleEntityNotFound(_0x25869a,null))[_0x68cb('0x40')](handleError(_0x25869a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8d30fcc..d720370 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 _0x687f=['Sound','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0x687f,0x194));var _0xf687=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x687f[_0x2797c6];return _0x54809f;};'use strict';var _=require(_0xf687('0x0'));var util=require(_0xf687('0x1'));var logger=require(_0xf687('0x2'))(_0xf687('0x3'));var moment=require('moment');var BPromise=require(_0xf687('0x4'));var rp=require(_0xf687('0x5'));var fs=require('fs');var path=require(_0xf687('0x6'));var rimraf=require(_0xf687('0x7'));var config=require(_0xf687('0x8'));var attributes=require(_0xf687('0x9'));module[_0xf687('0xa')]=function(_0x5490e0,_0x3f9cb8){return _0x5490e0[_0xf687('0xb')](_0xf687('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f7b=['define','Sound','tools_sounds','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x9c3c94,_0x296e5a){var _0x598937=function(_0x2e3c3b){while(--_0x2e3c3b){_0x9c3c94['push'](_0x9c3c94['shift']());}};_0x598937(++_0x296e5a);}(_0x5f7b,0x1ef));var _0xb5f7=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x5f7b[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var logger=require('../../config/logger')(_0xb5f7('0x2'));var moment=require(_0xb5f7('0x3'));var BPromise=require('bluebird');var rp=require(_0xb5f7('0x4'));var fs=require('fs');var path=require(_0xb5f7('0x5'));var rimraf=require(_0xb5f7('0x6'));var config=require(_0xb5f7('0x7'));var attributes=require('./sound.attributes');module[_0xb5f7('0x8')]=function(_0x373673,_0x57127e){return _0x373673[_0xb5f7('0x9')](_0xb5f7('0xa'),attributes,{'tableName':_0xb5f7('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 ae8094b..fc77bad 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 _0x8888=['stringify','code','error','message','result','catch','ShowSound','Sound','find','options','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3b60ef,_0x270e26){var _0x391fc3=function(_0x589fc1){while(--_0x589fc1){_0x3b60ef['push'](_0x3b60ef['shift']());}};_0x391fc3(++_0x270e26);}(_0x8888,0x140));var _0x8888=function(_0x486f0e,_0x3c9877){_0x486f0e=_0x486f0e-0x0;var _0x34f9b3=_0x8888[_0x486f0e];return _0x34f9b3;};'use strict';var _=require(_0x8888('0x0'));var util=require(_0x8888('0x1'));var moment=require(_0x8888('0x2'));var BPromise=require(_0x8888('0x3'));var rs=require(_0x8888('0x4'));var fs=require('fs');var Redis=require(_0x8888('0x5'));var db=require(_0x8888('0x6'))['db'];var utils=require(_0x8888('0x7'));var logger=require('../../config/logger')(_0x8888('0x8'));var config=require(_0x8888('0x9'));var jayson=require(_0x8888('0xa'));var client=jayson[_0x8888('0xb')][_0x8888('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d1e62,_0x140f12,_0x93af04){return new BPromise(function(_0x3383f8,_0x360542){return client[_0x8888('0xd')](_0x3d1e62,_0x93af04)[_0x8888('0xe')](function(_0x54b5a5){logger[_0x8888('0xf')](_0x8888('0x10'),_0x140f12,'request\x20sent');logger[_0x8888('0x11')](_0x8888('0x12'),_0x140f12,_0x8888('0x13'),JSON[_0x8888('0x14')](_0x54b5a5));if(_0x54b5a5['error']){if(_0x54b5a5['error'][_0x8888('0x15')]===0x1f4){logger[_0x8888('0x16')]('Sound,\x20%s,\x20%s',_0x140f12,_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);return _0x360542(_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);}logger[_0x8888('0x16')](_0x8888('0x10'),_0x140f12,_0x54b5a5[_0x8888('0x16')]['message']);return _0x3383f8(_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);}else{logger[_0x8888('0xf')]('Sound,\x20%s,\x20%s',_0x140f12,'request\x20sent');_0x3383f8(_0x54b5a5[_0x8888('0x18')][_0x8888('0x17')]);}})[_0x8888('0x19')](function(_0x32a017){logger[_0x8888('0x16')](_0x8888('0x10'),_0x140f12,_0x32a017);_0x360542(_0x32a017);});});}exports[_0x8888('0x1a')]=function(_0x4fe78f){var _0x130ad5=this;return new Promise(function(_0x301c09,_0x399fde){return db[_0x8888('0x1b')][_0x8888('0x1c')]({'raw':_0x4fe78f['options']?_0x4fe78f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f['options']['where']||null:null,'attributes':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f[_0x8888('0x1d')][_0x8888('0x1e')]||null:null,'include':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f[_0x8888('0x1d')]['include']?_[_0x8888('0x1f')](_0x4fe78f[_0x8888('0x1d')][_0x8888('0x20')],function(_0x21e547){return{'model':db[_0x21e547[_0x8888('0x21')]],'as':_0x21e547['as'],'attributes':_0x21e547[_0x8888('0x1e')],'include':_0x21e547[_0x8888('0x20')]?_[_0x8888('0x1f')](_0x21e547[_0x8888('0x20')],function(_0x3744dc){return{'model':db[_0x3744dc[_0x8888('0x21')]],'as':_0x3744dc['as'],'attributes':_0x3744dc[_0x8888('0x1e')],'include':_0x3744dc[_0x8888('0x20')]?_[_0x8888('0x1f')](_0x3744dc[_0x8888('0x20')],function(_0x333354){return{'model':db[_0x333354[_0x8888('0x21')]],'as':_0x333354['as'],'attributes':_0x333354[_0x8888('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8888('0xe')](function(_0x443c2c){logger[_0x8888('0xf')](_0x8888('0x1a'),_0x4fe78f);logger['debug'](_0x8888('0x1a'),_0x4fe78f,JSON['stringify'](_0x443c2c));_0x301c09(_0x443c2c);})[_0x8888('0x19')](function(_0x20c1e2){logger[_0x8888('0x16')](_0x8888('0x1a'),_0x20c1e2[_0x8888('0x17')],_0x4fe78f);_0x399fde(_0x130ad5['error'](0x1f4,_0x20c1e2[_0x8888('0x17')]));});});}; \ No newline at end of file +var _0xfa73=['error','info','result','ShowSound','Sound','options','raw','where','attributes','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','code','message'];(function(_0x55aac9,_0x307220){var _0x4069fd=function(_0x139aec){while(--_0x139aec){_0x55aac9['push'](_0x55aac9['shift']());}};_0x4069fd(++_0x307220);}(_0xfa73,0x184));var _0x3fa7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa73[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3fa7('0x0'));var util=require(_0x3fa7('0x1'));var moment=require(_0x3fa7('0x2'));var BPromise=require(_0x3fa7('0x3'));var rs=require(_0x3fa7('0x4'));var fs=require('fs');var Redis=require(_0x3fa7('0x5'));var db=require(_0x3fa7('0x6'))['db'];var utils=require(_0x3fa7('0x7'));var logger=require(_0x3fa7('0x8'))(_0x3fa7('0x9'));var config=require(_0x3fa7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3fa7('0xb')][_0x3fa7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3028d6,_0x2bf325,_0x585981){return new BPromise(function(_0x98c36e,_0x319bda){return client['request'](_0x3028d6,_0x585981)[_0x3fa7('0xd')](function(_0x2a256b){logger['info'](_0x3fa7('0xe'),_0x2bf325,_0x3fa7('0xf'));logger['debug'](_0x3fa7('0x10'),_0x2bf325,_0x3fa7('0xf'),JSON[_0x3fa7('0x11')](_0x2a256b));if(_0x2a256b['error']){if(_0x2a256b['error'][_0x3fa7('0x12')]===0x1f4){logger['error'](_0x3fa7('0xe'),_0x2bf325,_0x2a256b['error'][_0x3fa7('0x13')]);return _0x319bda(_0x2a256b[_0x3fa7('0x14')][_0x3fa7('0x13')]);}logger['error'](_0x3fa7('0xe'),_0x2bf325,_0x2a256b[_0x3fa7('0x14')]['message']);return _0x98c36e(_0x2a256b[_0x3fa7('0x14')][_0x3fa7('0x13')]);}else{logger[_0x3fa7('0x15')](_0x3fa7('0xe'),_0x2bf325,_0x3fa7('0xf'));_0x98c36e(_0x2a256b[_0x3fa7('0x16')][_0x3fa7('0x13')]);}})['catch'](function(_0x4abcb5){logger[_0x3fa7('0x14')](_0x3fa7('0xe'),_0x2bf325,_0x4abcb5);_0x319bda(_0x4abcb5);});});}exports[_0x3fa7('0x17')]=function(_0x547bbd){var _0x4786b7=this;return new Promise(function(_0x3f271d,_0x7f6ca7){return db[_0x3fa7('0x18')]['find']({'raw':_0x547bbd[_0x3fa7('0x19')]?_0x547bbd[_0x3fa7('0x19')][_0x3fa7('0x1a')]===undefined?!![]:![]:!![],'where':_0x547bbd[_0x3fa7('0x19')]?_0x547bbd[_0x3fa7('0x19')][_0x3fa7('0x1b')]||null:null,'attributes':_0x547bbd[_0x3fa7('0x19')]?_0x547bbd[_0x3fa7('0x19')][_0x3fa7('0x1c')]||null:null,'include':_0x547bbd[_0x3fa7('0x19')]?_0x547bbd['options'][_0x3fa7('0x1d')]?_[_0x3fa7('0x1e')](_0x547bbd['options'][_0x3fa7('0x1d')],function(_0x1b67f8){return{'model':db[_0x1b67f8[_0x3fa7('0x1f')]],'as':_0x1b67f8['as'],'attributes':_0x1b67f8[_0x3fa7('0x1c')],'include':_0x1b67f8['include']?_[_0x3fa7('0x1e')](_0x1b67f8[_0x3fa7('0x1d')],function(_0x8cd342){return{'model':db[_0x8cd342['model']],'as':_0x8cd342['as'],'attributes':_0x8cd342[_0x3fa7('0x1c')],'include':_0x8cd342[_0x3fa7('0x1d')]?_[_0x3fa7('0x1e')](_0x8cd342[_0x3fa7('0x1d')],function(_0x5f2967){return{'model':db[_0x5f2967['model']],'as':_0x5f2967['as'],'attributes':_0x5f2967[_0x3fa7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4814be){logger[_0x3fa7('0x15')](_0x3fa7('0x17'),_0x547bbd);logger[_0x3fa7('0x20')](_0x3fa7('0x17'),_0x547bbd,JSON[_0x3fa7('0x11')](_0x4814be));_0x3f271d(_0x4814be);})[_0x3fa7('0x21')](function(_0x5abf34){logger[_0x3fa7('0x14')](_0x3fa7('0x17'),_0x5abf34[_0x3fa7('0x13')],_0x547bbd);_0x7f6ca7(_0x4786b7[_0x3fa7('0x14')](0x1f4,_0x5abf34[_0x3fa7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 15b1cb0..78ec6cc 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45b190,_0x6297da){var _0x46234d=function(_0x41f5ad){while(--_0x41f5ad){_0x45b190['push'](_0x45b190['shift']());}};_0x46234d(++_0x6297da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x0b0e[_0x3a3c17];return _0xd07f21;};'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('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7c9ca4,_0x5506c0){var _0x1f33eb=function(_0x128232){while(--_0x128232){_0x7c9ca4['push'](_0x7c9ca4['shift']());}};_0x1f33eb(++_0x5506c0);}(_0xb10b,0x12a));var _0xbb10=function(_0x34f46d,_0x1d6712){_0x34f46d=_0x34f46d-0x0;var _0x3a2d9e=_0xb10b[_0x34f46d];return _0x3a2d9e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ac78083..328c08c 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 _0x4fc9=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x1157c3,_0x18f174){var _0x287d2a=function(_0x4d4da7){while(--_0x4d4da7){_0x1157c3['push'](_0x1157c3['shift']());}};_0x287d2a(++_0x18f174);}(_0x4fc9,0x1a4));var _0x94fc=function(_0x46e319,_0x2afb65){_0x46e319=_0x46e319-0x0;var _0x5b5b7d=_0x4fc9[_0x46e319];return _0x5b5b7d;};'use strict';var Sequelize=require(_0x94fc('0x0'));module[_0x94fc('0x1')]={'uniqueid':{'type':Sequelize[_0x94fc('0x2')]},'body':{'type':Sequelize[_0x94fc('0x3')](_0x94fc('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x94fc('0x5')]('in',_0x94fc('0x6')),'defaultValue':_0x94fc('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x94fc('0x2')]},'providerResponse':{'type':Sequelize[_0x94fc('0x3')]}}; \ No newline at end of file +var _0x56f8=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x56f8,0x1ce));var _0x856f=function(_0x432b74,_0x44721c){_0x432b74=_0x432b74-0x0;var _0x11a547=_0x56f8[_0x432b74];return _0x11a547;};'use strict';var Sequelize=require(_0x856f('0x0'));module[_0x856f('0x1')]={'uniqueid':{'type':Sequelize[_0x856f('0x2')]},'body':{'type':Sequelize[_0x856f('0x3')](_0x856f('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x856f('0x5')]('in','out'),'defaultValue':_0x856f('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x856f('0x2')]},'providerResponse':{'type':Sequelize[_0x856f('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 62f6ba6..4265ce1 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 _0x6dc0=['../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','then','name','send','index','map','SquareMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2e36e0,_0x3c8bbc){var _0x4abb14=function(_0x277fcd){while(--_0x277fcd){_0x2e36e0['push'](_0x2e36e0['shift']());}};_0x4abb14(++_0x3c8bbc);}(_0x6dc0,0xb6));var _0x06dc=function(_0x37086c,_0x4b1fb8){_0x37086c=_0x37086c-0x0;var _0x77f118=_0x6dc0[_0x37086c];return _0x77f118;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527806,_0x534c07){_0x534c07=_0x534c07||0xcc;return function(_0x4f086f){if(_0x4f086f){return _0x527806[_0x06dc('0x17')](_0x534c07);}return _0x527806['status'](_0x534c07)['end']();};}function respondWithResult(_0x4874ce,_0x196cfd){_0x196cfd=_0x196cfd||0xc8;return function(_0x47753d){if(_0x47753d){return _0x4874ce[_0x06dc('0x18')](_0x196cfd)['json'](_0x47753d);}};}function respondWithFilteredResult(_0x183302,_0x1d92c2){return function(_0x145a07){if(_0x145a07){var _0x3da2c5=typeof _0x1d92c2['offset']===_0x06dc('0x19')&&typeof _0x1d92c2[_0x06dc('0x1a')]===_0x06dc('0x19');var _0x2478b9=_0x145a07[_0x06dc('0x1b')];var _0x51df31=_0x3da2c5?0x0:_0x1d92c2[_0x06dc('0x1c')];var _0x1d6ec8=_0x3da2c5?_0x145a07[_0x06dc('0x1b')]:_0x1d92c2[_0x06dc('0x1c')]+_0x1d92c2[_0x06dc('0x1a')];var _0x152ed2;if(_0x1d6ec8>=_0x2478b9){_0x1d6ec8=_0x2478b9;_0x152ed2=0xc8;}else{_0x152ed2=0xce;}_0x183302['status'](_0x152ed2);return _0x183302['set'](_0x06dc('0x1d'),_0x51df31+'-'+_0x1d6ec8+'/'+_0x2478b9)['json'](_0x145a07);}return null;};}function patchUpdates(_0x21c8c3){return function(_0x5088f3){try{jsonpatch[_0x06dc('0x1e')](_0x5088f3,_0x21c8c3,!![]);}catch(_0x369c60){return BPromise[_0x06dc('0x1f')](_0x369c60);}return _0x5088f3[_0x06dc('0x20')]();};}function saveUpdates(_0x8aaf2,_0x427f39){return function(_0x577284){if(_0x577284){return _0x577284['update'](_0x8aaf2)[_0x06dc('0x21')](function(_0x426260){return _0x426260;});}return null;};}function removeEntity(_0x56c345,_0x95dab2){return function(_0x5eab9b){if(_0x5eab9b){return _0x5eab9b['destroy']()['then'](function(){_0x56c345['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3e42b,_0x5edc7b){return function(_0xfa043e){if(!_0xfa043e){_0xd3e42b['sendStatus'](0x194);}return _0xfa043e;};}function handleError(_0x52afcf,_0xa85ffc){_0xa85ffc=_0xa85ffc||0x1f4;return function(_0x26bbfe){logger['error'](_0x26bbfe['stack']);if(_0x26bbfe[_0x06dc('0x22')]){delete _0x26bbfe['name'];}_0x52afcf[_0x06dc('0x18')](_0xa85ffc)[_0x06dc('0x23')](_0x26bbfe);};}exports[_0x06dc('0x24')]=function(_0xfd5611,_0x1d98b8){var _0x31f5cd={},_0x164554={},_0x33ff4c={'count':0x0,'rows':[]};var _0x3f0e2d=_[_0x06dc('0x25')](db[_0x06dc('0x26')][_0x06dc('0x27')],function(_0x43e689){return{'name':_0x43e689['fieldName'],'type':_0x43e689['type'][_0x06dc('0x28')]};});_0x164554[_0x06dc('0x29')]=_[_0x06dc('0x25')](_0x3f0e2d,_0x06dc('0x22'));_0x164554[_0x06dc('0x2a')]=_[_0x06dc('0x2b')](_0xfd5611[_0x06dc('0x2a')]);_0x164554[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],_0x164554['query']);_0x31f5cd[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0xfd5611[_0x06dc('0x2a')]['fields']));_0x31f5cd[_0x06dc('0x2e')]=_0x31f5cd[_0x06dc('0x2e')][_0x06dc('0x30')]?_0x31f5cd['attributes']:_0x164554[_0x06dc('0x29')];if(!_0xfd5611[_0x06dc('0x2a')]['hasOwnProperty'](_0x06dc('0x31'))){_0x31f5cd[_0x06dc('0x1a')]=qs['limit'](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1a')]);_0x31f5cd[_0x06dc('0x1c')]=qs[_0x06dc('0x1c')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1c')]);}_0x31f5cd[_0x06dc('0x32')]=qs[_0x06dc('0x33')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x33')]);_0x31f5cd['where']=qs['filters'](_['pick'](_0xfd5611[_0x06dc('0x2a')],_0x164554[_0x06dc('0x2c')]),_0x3f0e2d);if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]){_0x31f5cd['where']=_['merge'](_0x31f5cd[_0x06dc('0x35')],{'$or':_[_0x06dc('0x25')](_0x3f0e2d,function(_0xdc718a){if(_0xdc718a[_0x06dc('0x36')]!==_0x06dc('0x37')){var _0xe65d69={};_0xe65d69[_0xdc718a[_0x06dc('0x22')]]={'$like':'%'+_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]+'%'};return _0xe65d69;}})});}_0x31f5cd=_[_0x06dc('0x38')]({},_0x31f5cd,_0xfd5611[_0x06dc('0x39')]);var _0x11e2f6={'where':_0x31f5cd[_0x06dc('0x35')]};return db[_0x06dc('0x26')][_0x06dc('0x1b')](_0x11e2f6)[_0x06dc('0x21')](function(_0x3e9434){_0x33ff4c[_0x06dc('0x1b')]=_0x3e9434;if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x31f5cd['include']=[{'all':!![]}];}return db['SquareMessage'][_0x06dc('0x3b')](_0x31f5cd);})[_0x06dc('0x21')](function(_0x4250fd){_0x33ff4c[_0x06dc('0x3c')]=_0x4250fd;return _0x33ff4c;})[_0x06dc('0x21')](respondWithFilteredResult(_0x1d98b8,_0x31f5cd))['catch'](handleError(_0x1d98b8,null));};exports[_0x06dc('0x3d')]=function(_0x37ec58,_0x64f6f3){var _0x59d4a0={'raw':!![],'where':{'id':_0x37ec58[_0x06dc('0x3e')]['id']}},_0x164684={};_0x164684['model']=_[_0x06dc('0x2b')](db[_0x06dc('0x26')][_0x06dc('0x27')]);_0x164684[_0x06dc('0x2a')]=_['keys'](_0x37ec58['query']);_0x164684[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],_0x164684['query']);_0x59d4a0[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0x37ec58[_0x06dc('0x2a')]['fields']));_0x59d4a0[_0x06dc('0x2e')]=_0x59d4a0['attributes']['length']?_0x59d4a0[_0x06dc('0x2e')]:_0x164684[_0x06dc('0x29')];if(_0x37ec58[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x59d4a0[_0x06dc('0x3f')]=[{'all':!![]}];}_0x59d4a0=_['merge']({},_0x59d4a0,_0x37ec58[_0x06dc('0x39')]);return db[_0x06dc('0x26')][_0x06dc('0x40')](_0x59d4a0)[_0x06dc('0x21')](handleEntityNotFound(_0x64f6f3,null))[_0x06dc('0x21')](respondWithResult(_0x64f6f3,null))[_0x06dc('0x41')](handleError(_0x64f6f3,null));};exports[_0x06dc('0x42')]=function(_0x6a5800,_0x1081a9){return db[_0x06dc('0x26')][_0x06dc('0x42')](_0x6a5800['body'],{})[_0x06dc('0x21')](respondWithResult(_0x1081a9,0xc9))[_0x06dc('0x41')](handleError(_0x1081a9,null));};exports['update']=function(_0xb9c6a2,_0x39e42a){if(_0xb9c6a2[_0x06dc('0x43')]['id']){delete _0xb9c6a2['body']['id'];}return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0xb9c6a2['params']['id']}})['then'](handleEntityNotFound(_0x39e42a,null))['then'](saveUpdates(_0xb9c6a2[_0x06dc('0x43')],null))[_0x06dc('0x21')](respondWithResult(_0x39e42a,null))[_0x06dc('0x41')](handleError(_0x39e42a,null));};exports['destroy']=function(_0x5dd2c2,_0x1d759b){return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0x5dd2c2[_0x06dc('0x3e')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x1d759b,null))['then'](removeEntity(_0x1d759b,null))[_0x06dc('0x41')](handleError(_0x1d759b,null));}; \ No newline at end of file +var _0xa908=['show','params','keys','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','SquareMessage','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch'];(function(_0x4ac1ce,_0x10c8c9){var _0x4a00c4=function(_0x709f14){while(--_0x709f14){_0x4ac1ce['push'](_0x4ac1ce['shift']());}};_0x4a00c4(++_0x10c8c9);}(_0xa908,0x1c3));var _0x8a90=function(_0x38c2b5,_0x4de8fa){_0x38c2b5=_0x38c2b5-0x0;var _0x46deb3=_0xa908[_0x38c2b5];return _0x46deb3;};'use strict';var emlformat=require(_0x8a90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a90('0x2'));var moment=require(_0x8a90('0x3'));var BPromise=require(_0x8a90('0x4'));var Mustache=require(_0x8a90('0x5'));var util=require(_0x8a90('0x6'));var path=require('path');var sox=require(_0x8a90('0x7'));var csv=require(_0x8a90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a90('0x9'));var _=require(_0x8a90('0xa'));var squel=require(_0x8a90('0xb'));var crypto=require(_0x8a90('0xc'));var jsforce=require(_0x8a90('0xd'));var deskjs=require(_0x8a90('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8a90('0xf'));var Papa=require('papaparse');var Redis=require(_0x8a90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8a90('0x11'));var as=require(_0x8a90('0x12'));var hardwareService=require(_0x8a90('0x13'));var logger=require(_0x8a90('0x14'))(_0x8a90('0x15'));var utils=require(_0x8a90('0x16'));var config=require(_0x8a90('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb13e2e,_0x423d39){_0x423d39=_0x423d39||0xcc;return function(_0x110f2e){if(_0x110f2e){return _0xb13e2e['sendStatus'](_0x423d39);}return _0xb13e2e[_0x8a90('0x18')](_0x423d39)[_0x8a90('0x19')]();};}function respondWithResult(_0x3b563d,_0x499ca6){_0x499ca6=_0x499ca6||0xc8;return function(_0x38eef3){if(_0x38eef3){return _0x3b563d[_0x8a90('0x18')](_0x499ca6)['json'](_0x38eef3);}};}function respondWithFilteredResult(_0x122356,_0x85392a){return function(_0x1f667a){if(_0x1f667a){var _0x1bfd6c=typeof _0x85392a['offset']==='undefined'&&typeof _0x85392a[_0x8a90('0x1a')]===_0x8a90('0x1b');var _0x40e491=_0x1f667a[_0x8a90('0x1c')];var _0x17ba83=_0x1bfd6c?0x0:_0x85392a[_0x8a90('0x1d')];var _0x2808c2=_0x1bfd6c?_0x1f667a[_0x8a90('0x1c')]:_0x85392a['offset']+_0x85392a[_0x8a90('0x1a')];var _0x4e78c1;if(_0x2808c2>=_0x40e491){_0x2808c2=_0x40e491;_0x4e78c1=0xc8;}else{_0x4e78c1=0xce;}_0x122356[_0x8a90('0x18')](_0x4e78c1);return _0x122356[_0x8a90('0x1e')](_0x8a90('0x1f'),_0x17ba83+'-'+_0x2808c2+'/'+_0x40e491)[_0x8a90('0x20')](_0x1f667a);}return null;};}function patchUpdates(_0xce9cc3){return function(_0x454103){try{jsonpatch['apply'](_0x454103,_0xce9cc3,!![]);}catch(_0x3b7852){return BPromise[_0x8a90('0x21')](_0x3b7852);}return _0x454103[_0x8a90('0x22')]();};}function saveUpdates(_0x4f2bae,_0x28f6a8){return function(_0x43b8f6){if(_0x43b8f6){return _0x43b8f6['update'](_0x4f2bae)[_0x8a90('0x23')](function(_0x15f93f){return _0x15f93f;});}return null;};}function removeEntity(_0x51dd1a,_0x457c46){return function(_0x36a334){if(_0x36a334){return _0x36a334[_0x8a90('0x24')]()[_0x8a90('0x23')](function(){_0x51dd1a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fd3f,_0xf68970){return function(_0x29b50b){if(!_0x29b50b){_0x22fd3f[_0x8a90('0x25')](0x194);}return _0x29b50b;};}function handleError(_0x10bcda,_0x56cba8){_0x56cba8=_0x56cba8||0x1f4;return function(_0x16a228){logger[_0x8a90('0x26')](_0x16a228[_0x8a90('0x27')]);if(_0x16a228[_0x8a90('0x28')]){delete _0x16a228['name'];}_0x10bcda[_0x8a90('0x18')](_0x56cba8)['send'](_0x16a228);};}exports[_0x8a90('0x29')]=function(_0xdefa9a,_0xd67856){var _0x4b641d={},_0x17aafd={},_0x300a0b={'count':0x0,'rows':[]};var _0x16cbbf=_['map'](db[_0x8a90('0x2a')][_0x8a90('0x2b')],function(_0x3443ba){return{'name':_0x3443ba[_0x8a90('0x2c')],'type':_0x3443ba[_0x8a90('0x2d')][_0x8a90('0x2e')]};});_0x17aafd['model']=_[_0x8a90('0x2f')](_0x16cbbf,_0x8a90('0x28'));_0x17aafd['query']=_['keys'](_0xdefa9a['query']);_0x17aafd[_0x8a90('0x30')]=_[_0x8a90('0x31')](_0x17aafd[_0x8a90('0x32')],_0x17aafd[_0x8a90('0x33')]);_0x4b641d[_0x8a90('0x34')]=_['intersection'](_0x17aafd[_0x8a90('0x32')],qs[_0x8a90('0x35')](_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x35')]));_0x4b641d['attributes']=_0x4b641d['attributes'][_0x8a90('0x36')]?_0x4b641d['attributes']:_0x17aafd[_0x8a90('0x32')];if(!_0xdefa9a[_0x8a90('0x33')]['hasOwnProperty'](_0x8a90('0x37'))){_0x4b641d['limit']=qs[_0x8a90('0x1a')](_0xdefa9a['query'][_0x8a90('0x1a')]);_0x4b641d[_0x8a90('0x1d')]=qs[_0x8a90('0x1d')](_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x1d')]);}_0x4b641d[_0x8a90('0x38')]=qs[_0x8a90('0x39')](_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x39')]);_0x4b641d[_0x8a90('0x3a')]=qs[_0x8a90('0x30')](_['pick'](_0xdefa9a[_0x8a90('0x33')],_0x17aafd[_0x8a90('0x30')]),_0x16cbbf);if(_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x3b')]){_0x4b641d[_0x8a90('0x3a')]=_['merge'](_0x4b641d[_0x8a90('0x3a')],{'$or':_[_0x8a90('0x2f')](_0x16cbbf,function(_0xe5e1d4){if(_0xe5e1d4['type']!==_0x8a90('0x3c')){var _0x3b0229={};_0x3b0229[_0xe5e1d4[_0x8a90('0x28')]]={'$like':'%'+_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x3b')]+'%'};return _0x3b0229;}})});}_0x4b641d=_[_0x8a90('0x3d')]({},_0x4b641d,_0xdefa9a[_0x8a90('0x3e')]);var _0x541075={'where':_0x4b641d[_0x8a90('0x3a')]};return db[_0x8a90('0x2a')]['count'](_0x541075)[_0x8a90('0x23')](function(_0x129d80){_0x300a0b['count']=_0x129d80;if(_0xdefa9a[_0x8a90('0x33')][_0x8a90('0x3f')]){_0x4b641d[_0x8a90('0x40')]=[{'all':!![]}];}return db[_0x8a90('0x2a')]['findAll'](_0x4b641d);})[_0x8a90('0x23')](function(_0x141b39){_0x300a0b[_0x8a90('0x41')]=_0x141b39;return _0x300a0b;})[_0x8a90('0x23')](respondWithFilteredResult(_0xd67856,_0x4b641d))[_0x8a90('0x42')](handleError(_0xd67856,null));};exports[_0x8a90('0x43')]=function(_0xa5939c,_0x273ccf){var _0x478644={'raw':!![],'where':{'id':_0xa5939c[_0x8a90('0x44')]['id']}},_0x10208d={};_0x10208d[_0x8a90('0x32')]=_[_0x8a90('0x45')](db[_0x8a90('0x2a')][_0x8a90('0x2b')]);_0x10208d['query']=_[_0x8a90('0x45')](_0xa5939c['query']);_0x10208d[_0x8a90('0x30')]=_[_0x8a90('0x31')](_0x10208d['model'],_0x10208d[_0x8a90('0x33')]);_0x478644[_0x8a90('0x34')]=_[_0x8a90('0x31')](_0x10208d[_0x8a90('0x32')],qs[_0x8a90('0x35')](_0xa5939c['query'][_0x8a90('0x35')]));_0x478644[_0x8a90('0x34')]=_0x478644[_0x8a90('0x34')][_0x8a90('0x36')]?_0x478644[_0x8a90('0x34')]:_0x10208d[_0x8a90('0x32')];if(_0xa5939c[_0x8a90('0x33')][_0x8a90('0x3f')]){_0x478644[_0x8a90('0x40')]=[{'all':!![]}];}_0x478644=_[_0x8a90('0x3d')]({},_0x478644,_0xa5939c[_0x8a90('0x3e')]);return db[_0x8a90('0x2a')][_0x8a90('0x46')](_0x478644)['then'](handleEntityNotFound(_0x273ccf,null))[_0x8a90('0x23')](respondWithResult(_0x273ccf,null))[_0x8a90('0x42')](handleError(_0x273ccf,null));};exports[_0x8a90('0x47')]=function(_0x25b340,_0x5123ab){return db['SquareMessage']['create'](_0x25b340[_0x8a90('0x48')],{})[_0x8a90('0x23')](respondWithResult(_0x5123ab,0xc9))[_0x8a90('0x42')](handleError(_0x5123ab,null));};exports[_0x8a90('0x49')]=function(_0x2dd26d,_0x2a027c){if(_0x2dd26d['body']['id']){delete _0x2dd26d['body']['id'];}return db[_0x8a90('0x2a')][_0x8a90('0x46')]({'where':{'id':_0x2dd26d[_0x8a90('0x44')]['id']}})[_0x8a90('0x23')](handleEntityNotFound(_0x2a027c,null))['then'](saveUpdates(_0x2dd26d[_0x8a90('0x48')],null))[_0x8a90('0x23')](respondWithResult(_0x2a027c,null))[_0x8a90('0x42')](handleError(_0x2a027c,null));};exports[_0x8a90('0x24')]=function(_0x29a430,_0x453e7e){return db[_0x8a90('0x2a')][_0x8a90('0x46')]({'where':{'id':_0x29a430[_0x8a90('0x44')]['id']}})[_0x8a90('0x23')](handleEntityNotFound(_0x453e7e,null))[_0x8a90('0x23')](removeEntity(_0x453e7e,null))[_0x8a90('0x42')](handleError(_0x453e7e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index fda30b9..f2a7f2d 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 _0xc285=['exports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3da885,_0xac5ecf){var _0x222f0d=function(_0x19bf69){while(--_0x19bf69){_0x3da885['push'](_0x3da885['shift']());}};_0x222f0d(++_0xac5ecf);}(_0xc285,0x9a));var _0x5c28=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0xc285[_0x37be36];return _0x47108e;};'use strict';var _=require(_0x5c28('0x0'));var util=require(_0x5c28('0x1'));var logger=require('../../config/logger')(_0x5c28('0x2'));var moment=require(_0x5c28('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c28('0x4'));var fs=require('fs');var path=require(_0x5c28('0x5'));var rimraf=require(_0x5c28('0x6'));var config=require(_0x5c28('0x7'));var attributes=require('./squareMessage.attributes');module[_0x5c28('0x8')]=function(_0x4d2c9f,_0x1f5f7b){return _0x4d2c9f['define']('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23b7=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger'];(function(_0x32def1,_0x34f15e){var _0xfc9777=function(_0x5b219b){while(--_0x5b219b){_0x32def1['push'](_0x32def1['shift']());}};_0xfc9777(++_0x34f15e);}(_0x23b7,0x169));var _0x723b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23b7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x723b('0x0'));var logger=require(_0x723b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x723b('0x2'));var rp=require(_0x723b('0x3'));var fs=require('fs');var path=require(_0x723b('0x4'));var rimraf=require(_0x723b('0x5'));var config=require(_0x723b('0x6'));var attributes=require(_0x723b('0x7'));module[_0x723b('0x8')]=function(_0x3dca0c,_0x17ed02){return _0x3dca0c[_0x723b('0x9')]('SquareMessage',attributes,{'tableName':_0x723b('0xa'),'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 0c0b0b4..4303ed7 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 _0x5f11=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','SquareMessage,\x20%s,\x20%s'];(function(_0x5e781c,_0x2cbae0){var _0x55939f=function(_0x2bd05b){while(--_0x2bd05b){_0x5e781c['push'](_0x5e781c['shift']());}};_0x55939f(++_0x2cbae0);}(_0x5f11,0xee));var _0x15f1=function(_0x8f5e19,_0x568541){_0x8f5e19=_0x8f5e19-0x0;var _0x3ca99b=_0x5f11[_0x8f5e19];return _0x3ca99b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15f1('0x0'));var BPromise=require(_0x15f1('0x1'));var rs=require(_0x15f1('0x2'));var fs=require('fs');var Redis=require(_0x15f1('0x3'));var db=require(_0x15f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x15f1('0x5'))('rpc');var config=require(_0x15f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x15f1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287e5c,_0x5b7a46,_0x4c41a0){return new BPromise(function(_0xb33ed3,_0x37f70c){return client[_0x15f1('0x8')](_0x287e5c,_0x4c41a0)[_0x15f1('0x9')](function(_0xbfdd3f){logger[_0x15f1('0xa')](_0x15f1('0xb'),_0x5b7a46,_0x15f1('0xc'));logger[_0x15f1('0xd')](_0x15f1('0xe'),_0x5b7a46,_0x15f1('0xc'),JSON[_0x15f1('0xf')](_0xbfdd3f));if(_0xbfdd3f[_0x15f1('0x10')]){if(_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x11')]===0x1f4){logger[_0x15f1('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5b7a46,_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);return _0x37f70c(_0xbfdd3f['error'][_0x15f1('0x12')]);}logger[_0x15f1('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5b7a46,_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);return _0xb33ed3(_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);}else{logger['info'](_0x15f1('0xb'),_0x5b7a46,_0x15f1('0xc'));_0xb33ed3(_0xbfdd3f[_0x15f1('0x13')][_0x15f1('0x12')]);}})[_0x15f1('0x14')](function(_0x2fb46d){logger[_0x15f1('0x10')](_0x15f1('0xb'),_0x5b7a46,_0x2fb46d);_0x37f70c(_0x2fb46d);});});}exports[_0x15f1('0x15')]=function(_0x55815c){var _0x26fedb=this;return new Promise(function(_0x5582c0,_0x56c6f5){return db['SquareMessage'][_0x15f1('0x16')](_0x55815c['body'],{'raw':_0x55815c[_0x15f1('0x17')]?_0x55815c[_0x15f1('0x17')][_0x15f1('0x18')]===undefined?!![]:![]:!![]})[_0x15f1('0x9')](function(_0x51ceeb){logger[_0x15f1('0xa')](_0x15f1('0x15'),_0x55815c);logger[_0x15f1('0xd')](_0x15f1('0x15'),_0x55815c,JSON[_0x15f1('0xf')](_0x51ceeb));_0x5582c0(_0x51ceeb);})[_0x15f1('0x14')](function(_0x5bca7b){logger['error'](_0x15f1('0x15'),_0x5bca7b['message'],_0x55815c);_0x56c6f5(_0x26fedb['error'](0x1f4,_0x5bca7b[_0x15f1('0x12')]));});});}; \ No newline at end of file +var _0xa4a8=['rpc','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0xa4a8,0x143));var _0x8a4a=function(_0x5b12e1,_0x50c67c){_0x5b12e1=_0x5b12e1-0x0;var _0x38f78c=_0xa4a8[_0x5b12e1];return _0x38f78c;};'use strict';var _=require(_0x8a4a('0x0'));var util=require(_0x8a4a('0x1'));var moment=require(_0x8a4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a4a('0x3'));var fs=require('fs');var Redis=require(_0x8a4a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a4a('0x5'));var logger=require(_0x8a4a('0x6'))(_0x8a4a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a4a('0x8'));var client=jayson[_0x8a4a('0x9')][_0x8a4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6b88d8,_0xa6f3f9,_0x3af609){return new BPromise(function(_0x2ec7ae,_0xe53e73){return client[_0x8a4a('0xb')](_0x6b88d8,_0x3af609)[_0x8a4a('0xc')](function(_0x1eeeb7){logger['info'](_0x8a4a('0xd'),_0xa6f3f9,_0x8a4a('0xe'));logger['debug'](_0x8a4a('0xf'),_0xa6f3f9,_0x8a4a('0xe'),JSON[_0x8a4a('0x10')](_0x1eeeb7));if(_0x1eeeb7[_0x8a4a('0x11')]){if(_0x1eeeb7[_0x8a4a('0x11')][_0x8a4a('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0xa6f3f9,_0x1eeeb7[_0x8a4a('0x11')][_0x8a4a('0x13')]);return _0xe53e73(_0x1eeeb7[_0x8a4a('0x11')][_0x8a4a('0x13')]);}logger[_0x8a4a('0x11')](_0x8a4a('0xd'),_0xa6f3f9,_0x1eeeb7[_0x8a4a('0x11')][_0x8a4a('0x13')]);return _0x2ec7ae(_0x1eeeb7[_0x8a4a('0x11')]['message']);}else{logger[_0x8a4a('0x14')](_0x8a4a('0xd'),_0xa6f3f9,_0x8a4a('0xe'));_0x2ec7ae(_0x1eeeb7[_0x8a4a('0x15')]['message']);}})[_0x8a4a('0x16')](function(_0x4d7ea0){logger[_0x8a4a('0x11')](_0x8a4a('0xd'),_0xa6f3f9,_0x4d7ea0);_0xe53e73(_0x4d7ea0);});});}exports[_0x8a4a('0x17')]=function(_0x599c8c){var _0x147a52=this;return new Promise(function(_0x5bc1f2,_0x5586d8){return db[_0x8a4a('0x18')][_0x8a4a('0x19')](_0x599c8c[_0x8a4a('0x1a')],{'raw':_0x599c8c[_0x8a4a('0x1b')]?_0x599c8c[_0x8a4a('0x1b')][_0x8a4a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x949d6c){logger[_0x8a4a('0x14')](_0x8a4a('0x17'),_0x599c8c);logger[_0x8a4a('0x1d')](_0x8a4a('0x17'),_0x599c8c,JSON[_0x8a4a('0x10')](_0x949d6c));_0x5bc1f2(_0x949d6c);})['catch'](function(_0x16bf83){logger[_0x8a4a('0x11')](_0x8a4a('0x17'),_0x16bf83[_0x8a4a('0x13')],_0x599c8c);_0x5586d8(_0x147a52[_0x8a4a('0x11')](0x1f4,_0x16bf83['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0845a57..7359f25 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 _0x0aac=['index','/:id','isAuthenticated','show','15s','post','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x1a858a,_0x3b56de){var _0x3acb99=function(_0x35a42e){while(--_0x35a42e){_0x1a858a['push'](_0x1a858a['shift']());}};_0x3acb99(++_0x3b56de);}(_0x0aac,0x1d6));var _0xc0aa=function(_0x239f2e,_0x4c5c60){_0x239f2e=_0x239f2e-0x0;var _0x17dcf6=_0x0aac[_0x239f2e];return _0x17dcf6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0aa('0x0'));var timeout=require(_0xc0aa('0x1'));var express=require(_0xc0aa('0x2'));var router=express[_0xc0aa('0x3')]();var fs_extra=require(_0xc0aa('0x4'));var auth=require(_0xc0aa('0x5'));var interaction=require(_0xc0aa('0x6'));var config=require(_0xc0aa('0x7'));var controller=require(_0xc0aa('0x8'));router[_0xc0aa('0x9')]('/',auth['isAuthenticated'](),controller[_0xc0aa('0xa')]);router[_0xc0aa('0x9')](_0xc0aa('0xb'),auth[_0xc0aa('0xc')](),controller[_0xc0aa('0xd')]);router['get']('/:id/test',auth[_0xc0aa('0xc')](),timeout(_0xc0aa('0xe')),controller['test']);router[_0xc0aa('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc0aa('0x10')](_0xc0aa('0xb'),auth['isAuthenticated'](),controller[_0xc0aa('0x11')]);router['delete'](_0xc0aa('0xb'),auth[_0xc0aa('0xc')](),controller[_0xc0aa('0x12')]);module[_0xc0aa('0x13')]=router; \ No newline at end of file +var _0x3ed9=['15s','test','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x3ed9,0xa7));var _0x93ed=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0x3ed9[_0x2b0f81];return _0x5ce74c;};'use strict';var multer=require(_0x93ed('0x0'));var util=require(_0x93ed('0x1'));var path=require(_0x93ed('0x2'));var timeout=require(_0x93ed('0x3'));var express=require(_0x93ed('0x4'));var router=express[_0x93ed('0x5')]();var fs_extra=require(_0x93ed('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x93ed('0x7'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0x93ed('0x8')]('/',auth['isAuthenticated'](),controller[_0x93ed('0x9')]);router[_0x93ed('0x8')](_0x93ed('0xa'),auth[_0x93ed('0xb')](),controller[_0x93ed('0xc')]);router[_0x93ed('0x8')]('/:id/test',auth['isAuthenticated'](),timeout(_0x93ed('0xd')),controller[_0x93ed('0xe')]);router['post']('/',auth[_0x93ed('0xb')](),controller[_0x93ed('0xf')]);router[_0x93ed('0x10')](_0x93ed('0xa'),auth[_0x93ed('0xb')](),controller[_0x93ed('0x11')]);router[_0x93ed('0x12')](_0x93ed('0xa'),auth[_0x93ed('0xb')](),controller['destroy']);module[_0x93ed('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 60cd328..8af590a 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 _0xd86a=['STRING','name','sequelize','exports'];(function(_0x5741ea,_0x1101fc){var _0x4f6ae6=function(_0x1e16ba){while(--_0x1e16ba){_0x5741ea['push'](_0x5741ea['shift']());}};_0x4f6ae6(++_0x1101fc);}(_0xd86a,0x136));var _0xad86=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xd86a[_0x22eb96];return _0x5e1adf;};'use strict';var Sequelize=require(_0xad86('0x0'));module[_0xad86('0x1')]={'name':{'type':Sequelize[_0xad86('0x2')],'unique':_0xad86('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xad86('0x2')]},'description':{'type':Sequelize[_0xad86('0x2')]}}; \ No newline at end of file +var _0x56a8=['exports','STRING','sequelize'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x56a8,0x80));var _0x856a=function(_0x30b33,_0x5484d1){_0x30b33=_0x30b33-0x0;var _0x32e2e6=_0x56a8[_0x30b33];return _0x32e2e6;};'use strict';var Sequelize=require(_0x856a('0x0'));module[_0x856a('0x1')]={'name':{'type':Sequelize[_0x856a('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x856a('0x2')]},'description':{'type':Sequelize[_0x856a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b635390..999d313 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 _0xb4af=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','end','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','rows','catch','show','params','rawAttributes','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xb4af,0x9f));var _0xfb4a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb4af[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0xfb4a('0x0'));var rimraf=require(_0xfb4a('0x1'));var zipdir=require(_0xfb4a('0x2'));var jsonpatch=require(_0xfb4a('0x3'));var rp=require(_0xfb4a('0x4'));var moment=require(_0xfb4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb4a('0x6'));var util=require(_0xfb4a('0x7'));var path=require(_0xfb4a('0x8'));var sox=require(_0xfb4a('0x9'));var csv=require(_0xfb4a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb4a('0xb'));var _=require(_0xfb4a('0xc'));var squel=require(_0xfb4a('0xd'));var crypto=require('crypto');var jsforce=require(_0xfb4a('0xe'));var deskjs=require(_0xfb4a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfb4a('0x10'));var Papa=require(_0xfb4a('0x11'));var Redis=require(_0xfb4a('0x12'));var authService=require(_0xfb4a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb4a('0x14'));var logger=require(_0xfb4a('0x15'))(_0xfb4a('0x16'));var utils=require('../../config/utils');var config=require(_0xfb4a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb4a('0x18'))['db'];function respondWithStatusCode(_0x2bf7b4,_0x2271c2){_0x2271c2=_0x2271c2||0xcc;return function(_0x150d6e){if(_0x150d6e){return _0x2bf7b4[_0xfb4a('0x19')](_0x2271c2);}return _0x2bf7b4[_0xfb4a('0x1a')](_0x2271c2)['end']();};}function respondWithResult(_0x37cf76,_0x5b348a){_0x5b348a=_0x5b348a||0xc8;return function(_0x19787c){if(_0x19787c){return _0x37cf76[_0xfb4a('0x1a')](_0x5b348a)[_0xfb4a('0x1b')](_0x19787c);}};}function respondWithFilteredResult(_0x2c2e7f,_0x5e0f58){return function(_0x270a98){if(_0x270a98){var _0x5e8f07=typeof _0x5e0f58['offset']===_0xfb4a('0x1c')&&typeof _0x5e0f58['limit']===_0xfb4a('0x1c');var _0x4b3606=_0x270a98[_0xfb4a('0x1d')];var _0x4f7f2b=_0x5e8f07?0x0:_0x5e0f58[_0xfb4a('0x1e')];var _0x49b4d3=_0x5e8f07?_0x270a98[_0xfb4a('0x1d')]:_0x5e0f58['offset']+_0x5e0f58[_0xfb4a('0x1f')];var _0x2d5902;if(_0x49b4d3>=_0x4b3606){_0x49b4d3=_0x4b3606;_0x2d5902=0xc8;}else{_0x2d5902=0xce;}_0x2c2e7f[_0xfb4a('0x1a')](_0x2d5902);return _0x2c2e7f[_0xfb4a('0x20')](_0xfb4a('0x21'),_0x4f7f2b+'-'+_0x49b4d3+'/'+_0x4b3606)['json'](_0x270a98);}return null;};}function patchUpdates(_0x292e5b){return function(_0x15ae96){try{jsonpatch[_0xfb4a('0x22')](_0x15ae96,_0x292e5b,!![]);}catch(_0x36e795){return BPromise[_0xfb4a('0x23')](_0x36e795);}return _0x15ae96[_0xfb4a('0x24')]();};}function saveUpdates(_0x2fef01,_0x2d8a1f){return function(_0x21f55c){if(_0x21f55c){return _0x21f55c[_0xfb4a('0x25')](_0x2fef01)[_0xfb4a('0x26')](function(_0x304133){return _0x304133;});}return null;};}function removeEntity(_0x38cfa3,_0x94f4be){return function(_0x32dce0){if(_0x32dce0){return _0x32dce0[_0xfb4a('0x27')]()[_0xfb4a('0x26')](function(){var _0xf1c70a=_0x32dce0[_0xfb4a('0x28')]({'plain':!![]});var _0x3d51a3=_0xfb4a('0x29');return db['UserProfileResource'][_0xfb4a('0x27')]({'where':{'type':_0x3d51a3,'resourceId':_0xf1c70a['id']}})['then'](function(){return _0x32dce0;});})[_0xfb4a('0x26')](function(){_0x38cfa3[_0xfb4a('0x1a')](0xcc)[_0xfb4a('0x2a')]();});}};}function handleEntityNotFound(_0x34ab8b,_0xcf1fff){return function(_0x1c6a42){if(!_0x1c6a42){_0x34ab8b[_0xfb4a('0x19')](0x194);}return _0x1c6a42;};}function handleError(_0x188426,_0x267002){_0x267002=_0x267002||0x1f4;return function(_0xc72e4d){logger[_0xfb4a('0x2b')](_0xc72e4d['stack']);if(_0xc72e4d[_0xfb4a('0x2c')]){delete _0xc72e4d[_0xfb4a('0x2c')];}_0x188426['status'](_0x267002)['send'](_0xc72e4d);};}exports[_0xfb4a('0x2d')]=function(_0x44c71e,_0x1be57a){var _0x39d4fa={},_0x53be78={},_0x956581={'count':0x0,'rows':[]};var _0x24be02=_[_0xfb4a('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x5050d1){return{'name':_0x5050d1[_0xfb4a('0x2f')],'type':_0x5050d1[_0xfb4a('0x30')][_0xfb4a('0x31')]};});_0x53be78[_0xfb4a('0x32')]=_['map'](_0x24be02,'name');_0x53be78[_0xfb4a('0x33')]=_[_0xfb4a('0x34')](_0x44c71e[_0xfb4a('0x33')]);_0x53be78[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x53be78['model'],_0x53be78[_0xfb4a('0x33')]);_0x39d4fa[_0xfb4a('0x37')]=_[_0xfb4a('0x36')](_0x53be78['model'],qs[_0xfb4a('0x38')](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x38')]));_0x39d4fa[_0xfb4a('0x37')]=_0x39d4fa[_0xfb4a('0x37')][_0xfb4a('0x39')]?_0x39d4fa[_0xfb4a('0x37')]:_0x53be78[_0xfb4a('0x32')];if(!_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x3a')](_0xfb4a('0x3b'))){_0x39d4fa[_0xfb4a('0x1f')]=qs['limit'](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x1f')]);_0x39d4fa[_0xfb4a('0x1e')]=qs[_0xfb4a('0x1e')](_0x44c71e['query'][_0xfb4a('0x1e')]);}_0x39d4fa[_0xfb4a('0x3c')]=qs['sort'](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x3d')]);_0x39d4fa[_0xfb4a('0x3e')]=qs['filters'](_[_0xfb4a('0x3f')](_0x44c71e[_0xfb4a('0x33')],_0x53be78[_0xfb4a('0x35')]),_0x24be02);if(_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x40')]){_0x39d4fa[_0xfb4a('0x3e')]=_[_0xfb4a('0x41')](_0x39d4fa[_0xfb4a('0x3e')],{'$or':_['map'](_0x24be02,function(_0x478de9){if(_0x478de9['type']!==_0xfb4a('0x42')){var _0x1d0f5d={};_0x1d0f5d[_0x478de9['name']]={'$like':'%'+_0x44c71e['query'][_0xfb4a('0x40')]+'%'};return _0x1d0f5d;}})});}_0x39d4fa=_[_0xfb4a('0x41')]({},_0x39d4fa,_0x44c71e['options']);var _0x37269c={'where':_0x39d4fa[_0xfb4a('0x3e')]};return db[_0xfb4a('0x43')][_0xfb4a('0x1d')](_0x37269c)[_0xfb4a('0x26')](function(_0x5117e2){_0x956581[_0xfb4a('0x1d')]=_0x5117e2;if(_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x44')]){_0x39d4fa[_0xfb4a('0x45')]=[{'all':!![]}];}return db[_0xfb4a('0x43')]['findAll'](_0x39d4fa);})[_0xfb4a('0x26')](function(_0x19de90){_0x956581[_0xfb4a('0x46')]=_0x19de90;return _0x956581;})[_0xfb4a('0x26')](respondWithFilteredResult(_0x1be57a,_0x39d4fa))[_0xfb4a('0x47')](handleError(_0x1be57a,null));};exports[_0xfb4a('0x48')]=function(_0x4e9995,_0x471f88){var _0x314f44={'raw':!![],'where':{'id':_0x4e9995[_0xfb4a('0x49')]['id']}},_0x22ead4={};_0x22ead4[_0xfb4a('0x32')]=_[_0xfb4a('0x34')](db[_0xfb4a('0x43')][_0xfb4a('0x4a')]);_0x22ead4[_0xfb4a('0x33')]=_['keys'](_0x4e9995[_0xfb4a('0x33')]);_0x22ead4[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x22ead4[_0xfb4a('0x32')],_0x22ead4[_0xfb4a('0x33')]);_0x314f44[_0xfb4a('0x37')]=_[_0xfb4a('0x36')](_0x22ead4[_0xfb4a('0x32')],qs['fields'](_0x4e9995['query'][_0xfb4a('0x38')]));_0x314f44[_0xfb4a('0x37')]=_0x314f44[_0xfb4a('0x37')][_0xfb4a('0x39')]?_0x314f44[_0xfb4a('0x37')]:_0x22ead4[_0xfb4a('0x32')];if(_0x4e9995[_0xfb4a('0x33')][_0xfb4a('0x44')]){_0x314f44[_0xfb4a('0x45')]=[{'all':!![]}];}_0x314f44=_['merge']({},_0x314f44,_0x4e9995[_0xfb4a('0x4b')]);return db[_0xfb4a('0x43')]['find'](_0x314f44)[_0xfb4a('0x26')](handleEntityNotFound(_0x471f88,null))[_0xfb4a('0x26')](respondWithResult(_0x471f88,null))[_0xfb4a('0x47')](handleError(_0x471f88,null));};exports[_0xfb4a('0x4c')]=function(_0xa0625d,_0x520e0d){return db[_0xfb4a('0x43')]['create'](_0xa0625d['body'],{})[_0xfb4a('0x26')](function(_0x33b333){var _0x2190ed=_0xa0625d['user']['get']({'plain':!![]});if(!_0x2190ed)throw new Error(_0xfb4a('0x4d'));if(_0x2190ed['role']===_0xfb4a('0x4e')){var _0x582ee4=_0x33b333['get']({'plain':!![]});var _0x4f1e69=_0xfb4a('0x29');return db[_0xfb4a('0x4f')][_0xfb4a('0x50')]({'where':{'name':_0x4f1e69,'userProfileId':_0x2190ed[_0xfb4a('0x51')]},'raw':!![]})['then'](function(_0x171bcb){if(_0x171bcb&&_0x171bcb[_0xfb4a('0x52')]===0x0){return db[_0xfb4a('0x53')]['create']({'name':_0x582ee4['name'],'resourceId':_0x582ee4['id'],'type':_0x171bcb[_0xfb4a('0x2c')],'sectionId':_0x171bcb['id']},{})[_0xfb4a('0x26')](function(){return _0x33b333;});}else{return _0x33b333;}})[_0xfb4a('0x47')](function(_0xc1c690){logger[_0xfb4a('0x2b')](_0xfb4a('0x54'),_0xc1c690);throw _0xc1c690;});}return _0x33b333;})[_0xfb4a('0x26')](respondWithResult(_0x520e0d,0xc9))[_0xfb4a('0x47')](handleError(_0x520e0d,null));};exports[_0xfb4a('0x25')]=function(_0x16eb32,_0x2c53d8){if(_0x16eb32[_0xfb4a('0x55')]['id']){delete _0x16eb32['body']['id'];}return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x16eb32['params']['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x2c53d8,null))['then'](saveUpdates(_0x16eb32[_0xfb4a('0x55')],null))['then'](respondWithResult(_0x2c53d8,null))[_0xfb4a('0x47')](handleError(_0x2c53d8,null));};exports[_0xfb4a('0x27')]=function(_0x397490,_0x562234){return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x397490[_0xfb4a('0x49')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x562234,null))[_0xfb4a('0x26')](removeEntity(_0x562234,null))[_0xfb4a('0x47')](handleError(_0x562234,null));};exports[_0xfb4a('0x56')]=function(_0x2469df,_0x93f1b3,_0x325cfb){var _0x42e8cc;return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x2469df[_0xfb4a('0x49')]['id']},'attributes':['id',_0xfb4a('0x57')]})['then'](handleEntityNotFound(_0x93f1b3,null))[_0xfb4a('0x26')](function(_0x3d152b){if(_0x3d152b){var _0x518f44=require(_0xfb4a('0x58'))();_0x518f44['openSync'](_0x3d152b[_0xfb4a('0x57')]);_0x518f44[_0xfb4a('0x59')]();return _0x3d152b;}})[_0xfb4a('0x26')](respondWithResult(_0x93f1b3,null))[_0xfb4a('0x47')](handleError(_0x93f1b3,null));}; \ No newline at end of file +var _0xff96=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find'];(function(_0x1da80a,_0x4a69bf){var _0x2f2818=function(_0x5ccc95){while(--_0x5ccc95){_0x1da80a['push'](_0x1da80a['shift']());}};_0x2f2818(++_0x4a69bf);}(_0xff96,0x10a));var _0x6ff9=function(_0x2806f6,_0x294105){_0x2806f6=_0x2806f6-0x0;var _0x32ebb1=_0xff96[_0x2806f6];return _0x32ebb1;};'use strict';var emlformat=require(_0x6ff9('0x0'));var rimraf=require(_0x6ff9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ff9('0x2'));var rp=require(_0x6ff9('0x3'));var moment=require(_0x6ff9('0x4'));var BPromise=require(_0x6ff9('0x5'));var Mustache=require(_0x6ff9('0x6'));var util=require(_0x6ff9('0x7'));var path=require(_0x6ff9('0x8'));var sox=require('sox');var csv=require(_0x6ff9('0x9'));var ejs=require(_0x6ff9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6ff9('0xb'));var jsforce=require(_0x6ff9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ff9('0x9'));var querystring=require(_0x6ff9('0xd'));var Papa=require('papaparse');var Redis=require(_0x6ff9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6ff9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ff9('0x10'))('api');var utils=require(_0x6ff9('0x11'));var config=require(_0x6ff9('0x12'));var licenseUtil=require(_0x6ff9('0x13'));var db=require(_0x6ff9('0x14'))['db'];function respondWithStatusCode(_0x50ea48,_0x2a3db0){_0x2a3db0=_0x2a3db0||0xcc;return function(_0x28b347){if(_0x28b347){return _0x50ea48[_0x6ff9('0x15')](_0x2a3db0);}return _0x50ea48[_0x6ff9('0x16')](_0x2a3db0)[_0x6ff9('0x17')]();};}function respondWithResult(_0x55a86e,_0x5b9863){_0x5b9863=_0x5b9863||0xc8;return function(_0x3131f6){if(_0x3131f6){return _0x55a86e[_0x6ff9('0x16')](_0x5b9863)[_0x6ff9('0x18')](_0x3131f6);}};}function respondWithFilteredResult(_0x31ebef,_0x15a23b){return function(_0x3a92f8){if(_0x3a92f8){var _0x5a6411=typeof _0x15a23b[_0x6ff9('0x19')]===_0x6ff9('0x1a')&&typeof _0x15a23b['limit']===_0x6ff9('0x1a');var _0x423a46=_0x3a92f8[_0x6ff9('0x1b')];var _0x23c2c8=_0x5a6411?0x0:_0x15a23b[_0x6ff9('0x19')];var _0x5adaea=_0x5a6411?_0x3a92f8[_0x6ff9('0x1b')]:_0x15a23b['offset']+_0x15a23b[_0x6ff9('0x1c')];var _0x354d60;if(_0x5adaea>=_0x423a46){_0x5adaea=_0x423a46;_0x354d60=0xc8;}else{_0x354d60=0xce;}_0x31ebef['status'](_0x354d60);return _0x31ebef[_0x6ff9('0x1d')](_0x6ff9('0x1e'),_0x23c2c8+'-'+_0x5adaea+'/'+_0x423a46)[_0x6ff9('0x18')](_0x3a92f8);}return null;};}function patchUpdates(_0x27a1d0){return function(_0x2d623e){try{jsonpatch['apply'](_0x2d623e,_0x27a1d0,!![]);}catch(_0x55c558){return BPromise['reject'](_0x55c558);}return _0x2d623e[_0x6ff9('0x1f')]();};}function saveUpdates(_0x6e20e7,_0x24dcce){return function(_0x357dac){if(_0x357dac){return _0x357dac[_0x6ff9('0x20')](_0x6e20e7)[_0x6ff9('0x21')](function(_0x341c71){return _0x341c71;});}return null;};}function removeEntity(_0x46f835,_0x195aeb){return function(_0x299938){if(_0x299938){return _0x299938['destroy']()['then'](function(){var _0xfcf95f=_0x299938[_0x6ff9('0x22')]({'plain':!![]});var _0x2af3d4=_0x6ff9('0x23');return db[_0x6ff9('0x24')][_0x6ff9('0x25')]({'where':{'type':_0x2af3d4,'resourceId':_0xfcf95f['id']}})['then'](function(){return _0x299938;});})[_0x6ff9('0x21')](function(){_0x46f835['status'](0xcc)[_0x6ff9('0x17')]();});}};}function handleEntityNotFound(_0x2b69ca,_0x356743){return function(_0x4c239e){if(!_0x4c239e){_0x2b69ca[_0x6ff9('0x15')](0x194);}return _0x4c239e;};}function handleError(_0x389e8d,_0x3d8e6f){_0x3d8e6f=_0x3d8e6f||0x1f4;return function(_0x3af309){logger[_0x6ff9('0x26')](_0x3af309[_0x6ff9('0x27')]);if(_0x3af309['name']){delete _0x3af309[_0x6ff9('0x28')];}_0x389e8d[_0x6ff9('0x16')](_0x3d8e6f)[_0x6ff9('0x29')](_0x3af309);};}exports[_0x6ff9('0x2a')]=function(_0x543592,_0x2acfcb){var _0x58f790={},_0x488032={},_0x460fa6={'count':0x0,'rows':[]};var _0x92fded=_[_0x6ff9('0x2b')](db[_0x6ff9('0x2c')][_0x6ff9('0x2d')],function(_0x4c3d3f){return{'name':_0x4c3d3f[_0x6ff9('0x2e')],'type':_0x4c3d3f[_0x6ff9('0x2f')][_0x6ff9('0x30')]};});_0x488032[_0x6ff9('0x31')]=_[_0x6ff9('0x2b')](_0x92fded,_0x6ff9('0x28'));_0x488032[_0x6ff9('0x32')]=_[_0x6ff9('0x33')](_0x543592[_0x6ff9('0x32')]);_0x488032[_0x6ff9('0x34')]=_[_0x6ff9('0x35')](_0x488032[_0x6ff9('0x31')],_0x488032[_0x6ff9('0x32')]);_0x58f790[_0x6ff9('0x36')]=_[_0x6ff9('0x35')](_0x488032['model'],qs[_0x6ff9('0x37')](_0x543592['query'][_0x6ff9('0x37')]));_0x58f790[_0x6ff9('0x36')]=_0x58f790['attributes']['length']?_0x58f790['attributes']:_0x488032['model'];if(!_0x543592['query']['hasOwnProperty'](_0x6ff9('0x38'))){_0x58f790[_0x6ff9('0x1c')]=qs[_0x6ff9('0x1c')](_0x543592['query'][_0x6ff9('0x1c')]);_0x58f790[_0x6ff9('0x19')]=qs[_0x6ff9('0x19')](_0x543592[_0x6ff9('0x32')][_0x6ff9('0x19')]);}_0x58f790[_0x6ff9('0x39')]=qs[_0x6ff9('0x3a')](_0x543592['query'][_0x6ff9('0x3a')]);_0x58f790['where']=qs[_0x6ff9('0x34')](_[_0x6ff9('0x3b')](_0x543592[_0x6ff9('0x32')],_0x488032[_0x6ff9('0x34')]),_0x92fded);if(_0x543592[_0x6ff9('0x32')][_0x6ff9('0x3c')]){_0x58f790[_0x6ff9('0x3d')]=_[_0x6ff9('0x3e')](_0x58f790['where'],{'$or':_[_0x6ff9('0x2b')](_0x92fded,function(_0xff70ec){if(_0xff70ec[_0x6ff9('0x2f')]!==_0x6ff9('0x3f')){var _0x28f5ea={};_0x28f5ea[_0xff70ec[_0x6ff9('0x28')]]={'$like':'%'+_0x543592[_0x6ff9('0x32')]['filter']+'%'};return _0x28f5ea;}})});}_0x58f790=_[_0x6ff9('0x3e')]({},_0x58f790,_0x543592[_0x6ff9('0x40')]);var _0x433790={'where':_0x58f790[_0x6ff9('0x3d')]};return db[_0x6ff9('0x2c')][_0x6ff9('0x1b')](_0x433790)[_0x6ff9('0x21')](function(_0xf9ba5){_0x460fa6[_0x6ff9('0x1b')]=_0xf9ba5;if(_0x543592[_0x6ff9('0x32')][_0x6ff9('0x41')]){_0x58f790['include']=[{'all':!![]}];}return db[_0x6ff9('0x2c')][_0x6ff9('0x42')](_0x58f790);})['then'](function(_0x5b1f7e){_0x460fa6[_0x6ff9('0x43')]=_0x5b1f7e;return _0x460fa6;})['then'](respondWithFilteredResult(_0x2acfcb,_0x58f790))[_0x6ff9('0x44')](handleError(_0x2acfcb,null));};exports[_0x6ff9('0x45')]=function(_0x59d15d,_0x403153){var _0x477b20={'raw':!![],'where':{'id':_0x59d15d[_0x6ff9('0x46')]['id']}},_0x35c7ff={};_0x35c7ff['model']=_[_0x6ff9('0x33')](db[_0x6ff9('0x2c')][_0x6ff9('0x2d')]);_0x35c7ff[_0x6ff9('0x32')]=_[_0x6ff9('0x33')](_0x59d15d['query']);_0x35c7ff[_0x6ff9('0x34')]=_[_0x6ff9('0x35')](_0x35c7ff['model'],_0x35c7ff[_0x6ff9('0x32')]);_0x477b20[_0x6ff9('0x36')]=_[_0x6ff9('0x35')](_0x35c7ff[_0x6ff9('0x31')],qs[_0x6ff9('0x37')](_0x59d15d[_0x6ff9('0x32')]['fields']));_0x477b20[_0x6ff9('0x36')]=_0x477b20[_0x6ff9('0x36')][_0x6ff9('0x47')]?_0x477b20[_0x6ff9('0x36')]:_0x35c7ff['model'];if(_0x59d15d[_0x6ff9('0x32')]['includeAll']){_0x477b20[_0x6ff9('0x48')]=[{'all':!![]}];}_0x477b20=_[_0x6ff9('0x3e')]({},_0x477b20,_0x59d15d[_0x6ff9('0x40')]);return db[_0x6ff9('0x2c')][_0x6ff9('0x49')](_0x477b20)[_0x6ff9('0x21')](handleEntityNotFound(_0x403153,null))[_0x6ff9('0x21')](respondWithResult(_0x403153,null))[_0x6ff9('0x44')](handleError(_0x403153,null));};exports[_0x6ff9('0x4a')]=function(_0x422b1b,_0x16545a){return db[_0x6ff9('0x2c')][_0x6ff9('0x4a')](_0x422b1b['body'],{})[_0x6ff9('0x21')](function(_0xfe59ec){var _0x3b22fb=_0x422b1b[_0x6ff9('0x4b')][_0x6ff9('0x22')]({'plain':!![]});if(!_0x3b22fb)throw new Error(_0x6ff9('0x4c'));if(_0x3b22fb[_0x6ff9('0x4d')]===_0x6ff9('0x4b')){var _0x20b9b9=_0xfe59ec[_0x6ff9('0x22')]({'plain':!![]});var _0x1616a5=_0x6ff9('0x23');return db[_0x6ff9('0x4e')][_0x6ff9('0x49')]({'where':{'name':_0x1616a5,'userProfileId':_0x3b22fb[_0x6ff9('0x4f')]},'raw':!![]})[_0x6ff9('0x21')](function(_0x347b1e){if(_0x347b1e&&_0x347b1e['autoAssociation']===0x0){return db[_0x6ff9('0x24')][_0x6ff9('0x4a')]({'name':_0x20b9b9[_0x6ff9('0x28')],'resourceId':_0x20b9b9['id'],'type':_0x347b1e[_0x6ff9('0x28')],'sectionId':_0x347b1e['id']},{})[_0x6ff9('0x21')](function(){return _0xfe59ec;});}else{return _0xfe59ec;}})[_0x6ff9('0x44')](function(_0x4ad747){logger[_0x6ff9('0x26')](_0x6ff9('0x50'),_0x4ad747);throw _0x4ad747;});}return _0xfe59ec;})[_0x6ff9('0x21')](respondWithResult(_0x16545a,0xc9))[_0x6ff9('0x44')](handleError(_0x16545a,null));};exports['update']=function(_0xc89058,_0x1a3854){if(_0xc89058[_0x6ff9('0x51')]['id']){delete _0xc89058[_0x6ff9('0x51')]['id'];}return db[_0x6ff9('0x2c')][_0x6ff9('0x49')]({'where':{'id':_0xc89058[_0x6ff9('0x46')]['id']}})[_0x6ff9('0x21')](handleEntityNotFound(_0x1a3854,null))[_0x6ff9('0x21')](saveUpdates(_0xc89058[_0x6ff9('0x51')],null))[_0x6ff9('0x21')](respondWithResult(_0x1a3854,null))['catch'](handleError(_0x1a3854,null));};exports[_0x6ff9('0x25')]=function(_0x519480,_0x36b4f7){return db[_0x6ff9('0x2c')][_0x6ff9('0x49')]({'where':{'id':_0x519480['params']['id']}})[_0x6ff9('0x21')](handleEntityNotFound(_0x36b4f7,null))[_0x6ff9('0x21')](removeEntity(_0x36b4f7,null))[_0x6ff9('0x44')](handleError(_0x36b4f7,null));};exports[_0x6ff9('0x52')]=function(_0xcf7f7a,_0x528d89,_0x59543d){var _0x3bded5;return db[_0x6ff9('0x2c')][_0x6ff9('0x49')]({'where':{'id':_0xcf7f7a[_0x6ff9('0x46')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x528d89,null))[_0x6ff9('0x21')](function(_0x2e8a00){if(_0x2e8a00){var _0x338f34=require(_0x6ff9('0x53'))();_0x338f34['openSync'](_0x2e8a00['dsn']);_0x338f34[_0x6ff9('0x54')]();return _0x2e8a00;}})[_0x6ff9('0x21')](respondWithResult(_0x528d89,null))[_0x6ff9('0x44')](handleError(_0x528d89,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4d3f1a1..b36d772 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 _0x24ee=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d733c,_0x1c2ed9){var _0xbe16b2=function(_0x82eb1b){while(--_0x82eb1b){_0x4d733c['push'](_0x4d733c['shift']());}};_0xbe16b2(++_0x1c2ed9);}(_0x24ee,0x1b2));var _0xe24e=function(_0x3e1054,_0x345ece){_0x3e1054=_0x3e1054-0x0;var _0xa74ef6=_0x24ee[_0x3e1054];return _0xa74ef6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe24e('0x0'));var BPromise=require(_0xe24e('0x1'));var rp=require(_0xe24e('0x2'));var fs=require('fs');var path=require(_0xe24e('0x3'));var rimraf=require(_0xe24e('0x4'));var config=require(_0xe24e('0x5'));var attributes=require(_0xe24e('0x6'));module[_0xe24e('0x7')]=function(_0x4d7d92,_0x196805){return _0x4d7d92[_0xe24e('0x8')](_0xe24e('0x9'),attributes,{'tableName':_0xe24e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9c5=['../../config/environment','./squareOdbc.attributes','define','SquareOdbc','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x188e3b,_0x4b8e01){var _0x5137c9=function(_0x167a06){while(--_0x167a06){_0x188e3b['push'](_0x188e3b['shift']());}};_0x5137c9(++_0x4b8e01);}(_0xe9c5,0x130));var _0x5e9c=function(_0x209fb4,_0x5241b2){_0x209fb4=_0x209fb4-0x0;var _0x572bbb=_0xe9c5[_0x209fb4];return _0x572bbb;};'use strict';var _=require(_0x5e9c('0x0'));var util=require('util');var logger=require(_0x5e9c('0x1'))(_0x5e9c('0x2'));var moment=require(_0x5e9c('0x3'));var BPromise=require(_0x5e9c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5e9c('0x5'));var config=require(_0x5e9c('0x6'));var attributes=require(_0x5e9c('0x7'));module['exports']=function(_0x396d04,_0x4ca6cb){return _0x396d04[_0x5e9c('0x8')](_0x5e9c('0x9'),attributes,{'tableName':'square_odbc','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 3d9ddb2..5891333 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 _0x2bb1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x2bb1,0x1ce));var _0x12bb=function(_0x1b141d,_0x39de80){_0x1b141d=_0x1b141d-0x0;var _0xd5d5f3=_0x2bb1[_0x1b141d];return _0xd5d5f3;};'use strict';var _=require(_0x12bb('0x0'));var util=require(_0x12bb('0x1'));var moment=require('moment');var BPromise=require(_0x12bb('0x2'));var rs=require(_0x12bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12bb('0x5'))(_0x12bb('0x6'));var config=require(_0x12bb('0x7'));var jayson=require(_0x12bb('0x8'));var client=jayson[_0x12bb('0x9')][_0x12bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56ebe7,_0x5f3e25,_0x39f503){return new BPromise(function(_0x42cfbf,_0x5cd0c1){return client['request'](_0x56ebe7,_0x39f503)[_0x12bb('0xb')](function(_0x260424){logger[_0x12bb('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5f3e25,_0x12bb('0xd'));logger['debug'](_0x12bb('0xe'),_0x5f3e25,_0x12bb('0xd'),JSON[_0x12bb('0xf')](_0x260424));if(_0x260424[_0x12bb('0x10')]){if(_0x260424['error'][_0x12bb('0x11')]===0x1f4){logger[_0x12bb('0x10')](_0x12bb('0x12'),_0x5f3e25,_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);return _0x5cd0c1(_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);}logger[_0x12bb('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x5f3e25,_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);return _0x42cfbf(_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);}else{logger[_0x12bb('0xc')](_0x12bb('0x12'),_0x5f3e25,_0x12bb('0xd'));_0x42cfbf(_0x260424[_0x12bb('0x14')][_0x12bb('0x13')]);}})['catch'](function(_0x380193){logger[_0x12bb('0x10')](_0x12bb('0x12'),_0x5f3e25,_0x380193);_0x5cd0c1(_0x380193);});});}exports[_0x12bb('0x15')]=function(_0x2c278f){var _0x16ff56=this;return new Promise(function(_0x5be41a,_0x50825a){return db[_0x12bb('0x16')][_0x12bb('0x17')]({'raw':_0x2c278f[_0x12bb('0x18')]?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x19')]===undefined?!![]:![]:!![],'where':_0x2c278f[_0x12bb('0x18')]?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1a')]||null:null,'attributes':_0x2c278f['options']?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1b')]||null:null,'include':_0x2c278f['options']?_0x2c278f['options'][_0x12bb('0x1c')]?_[_0x12bb('0x1d')](_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1c')],function(_0x3fdea5){return{'model':db[_0x3fdea5[_0x12bb('0x1e')]],'as':_0x3fdea5['as'],'attributes':_0x3fdea5[_0x12bb('0x1b')],'include':_0x3fdea5['include']?_[_0x12bb('0x1d')](_0x3fdea5[_0x12bb('0x1c')],function(_0x524e94){return{'model':db[_0x524e94[_0x12bb('0x1e')]],'as':_0x524e94['as'],'attributes':_0x524e94[_0x12bb('0x1b')],'include':_0x524e94['include']?_[_0x12bb('0x1d')](_0x524e94['include'],function(_0x265a20){return{'model':db[_0x265a20[_0x12bb('0x1e')]],'as':_0x265a20['as'],'attributes':_0x265a20[_0x12bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x12bb('0xb')](function(_0x3c0bc2){logger[_0x12bb('0xc')](_0x12bb('0x15'),_0x2c278f);logger['debug'](_0x12bb('0x15'),_0x2c278f,JSON['stringify'](_0x3c0bc2));_0x5be41a(_0x3c0bc2);})['catch'](function(_0x34ca6c){logger[_0x12bb('0x10')](_0x12bb('0x15'),_0x34ca6c[_0x12bb('0x13')],_0x2c278f);_0x50825a(_0x16ff56[_0x12bb('0x10')](0x1f4,_0x34ca6c['message']));});});}; \ No newline at end of file +var _0xf4d6=['debug','request\x20sent','stringify','error','code','message','result','catch','find','raw','options','where','map','model','include','attributes','then','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xf4d6,0x166));var _0x6f4d=function(_0x1c194f,_0x3eaef6){_0x1c194f=_0x1c194f-0x0;var _0x4e99b2=_0xf4d6[_0x1c194f];return _0x4e99b2;};'use strict';var _=require(_0x6f4d('0x0'));var util=require(_0x6f4d('0x1'));var moment=require(_0x6f4d('0x2'));var BPromise=require(_0x6f4d('0x3'));var rs=require(_0x6f4d('0x4'));var fs=require('fs');var Redis=require(_0x6f4d('0x5'));var db=require(_0x6f4d('0x6'))['db'];var utils=require(_0x6f4d('0x7'));var logger=require(_0x6f4d('0x8'))(_0x6f4d('0x9'));var config=require('../../config/environment');var jayson=require(_0x6f4d('0xa'));var client=jayson[_0x6f4d('0xb')][_0x6f4d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45762e,_0x456458,_0x5d72f1){return new BPromise(function(_0x98fcdb,_0x38e57d){return client[_0x6f4d('0xd')](_0x45762e,_0x5d72f1)['then'](function(_0x210a75){logger[_0x6f4d('0xe')](_0x6f4d('0xf'),_0x456458,'request\x20sent');logger[_0x6f4d('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x456458,_0x6f4d('0x11'),JSON[_0x6f4d('0x12')](_0x210a75));if(_0x210a75['error']){if(_0x210a75[_0x6f4d('0x13')][_0x6f4d('0x14')]===0x1f4){logger[_0x6f4d('0x13')](_0x6f4d('0xf'),_0x456458,_0x210a75[_0x6f4d('0x13')]['message']);return _0x38e57d(_0x210a75[_0x6f4d('0x13')][_0x6f4d('0x15')]);}logger[_0x6f4d('0x13')](_0x6f4d('0xf'),_0x456458,_0x210a75[_0x6f4d('0x13')][_0x6f4d('0x15')]);return _0x98fcdb(_0x210a75[_0x6f4d('0x13')][_0x6f4d('0x15')]);}else{logger['info'](_0x6f4d('0xf'),_0x456458,_0x6f4d('0x11'));_0x98fcdb(_0x210a75[_0x6f4d('0x16')][_0x6f4d('0x15')]);}})[_0x6f4d('0x17')](function(_0x159b7e){logger['error'](_0x6f4d('0xf'),_0x456458,_0x159b7e);_0x38e57d(_0x159b7e);});});}exports['ShowSquareOdbc']=function(_0x31ad50){var _0x766b0a=this;return new Promise(function(_0x2f1498,_0xbbc521){return db['SquareOdbc'][_0x6f4d('0x18')]({'raw':_0x31ad50['options']?_0x31ad50['options'][_0x6f4d('0x19')]===undefined?!![]:![]:!![],'where':_0x31ad50[_0x6f4d('0x1a')]?_0x31ad50[_0x6f4d('0x1a')][_0x6f4d('0x1b')]||null:null,'attributes':_0x31ad50['options']?_0x31ad50[_0x6f4d('0x1a')]['attributes']||null:null,'include':_0x31ad50[_0x6f4d('0x1a')]?_0x31ad50[_0x6f4d('0x1a')]['include']?_[_0x6f4d('0x1c')](_0x31ad50[_0x6f4d('0x1a')]['include'],function(_0x52e13d){return{'model':db[_0x52e13d[_0x6f4d('0x1d')]],'as':_0x52e13d['as'],'attributes':_0x52e13d['attributes'],'include':_0x52e13d['include']?_[_0x6f4d('0x1c')](_0x52e13d['include'],function(_0x1c861b){return{'model':db[_0x1c861b[_0x6f4d('0x1d')]],'as':_0x1c861b['as'],'attributes':_0x1c861b['attributes'],'include':_0x1c861b[_0x6f4d('0x1e')]?_['map'](_0x1c861b[_0x6f4d('0x1e')],function(_0x1973fd){return{'model':db[_0x1973fd[_0x6f4d('0x1d')]],'as':_0x1973fd['as'],'attributes':_0x1973fd[_0x6f4d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6f4d('0x20')](function(_0x476af3){logger['info']('ShowSquareOdbc',_0x31ad50);logger[_0x6f4d('0x10')]('ShowSquareOdbc',_0x31ad50,JSON[_0x6f4d('0x12')](_0x476af3));_0x2f1498(_0x476af3);})[_0x6f4d('0x17')](function(_0x710ab9){logger[_0x6f4d('0x13')](_0x6f4d('0x21'),_0x710ab9[_0x6f4d('0x15')],_0x31ad50);_0xbbc521(_0x766b0a[_0x6f4d('0x13')](0x1f4,_0x710ab9[_0x6f4d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index b0c5d3d..69acef8 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 _0x9153=['create','post','/:id/users','addUsers','put','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','/:id','show','get'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x9153,0xd8));var _0x3915=function(_0x1f1c4b,_0xabd842){_0x1f1c4b=_0x1f1c4b-0x0;var _0x4d5d61=_0x9153[_0x1f1c4b];return _0x4d5d61;};'use strict';var multer=require(_0x3915('0x0'));var util=require(_0x3915('0x1'));var path=require(_0x3915('0x2'));var timeout=require(_0x3915('0x3'));var express=require(_0x3915('0x4'));var router=express[_0x3915('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3915('0x6'));var interaction=require(_0x3915('0x7'));var config=require(_0x3915('0x8'));var controller=require(_0x3915('0x9'));router['get']('/',auth[_0x3915('0xa')](),controller['index']);router['get'](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0xc')]);router[_0x3915('0xd')]('/:id/users',auth[_0x3915('0xa')](),controller['getUsers']);router['post']('/',auth[_0x3915('0xa')](),controller[_0x3915('0xe')]);router[_0x3915('0xf')](_0x3915('0x10'),auth[_0x3915('0xa')](),controller[_0x3915('0x11')]);router[_0x3915('0x12')](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0x13')]);router['delete'](_0x3915('0xb'),auth[_0x3915('0xa')](),controller['destroy']);router[_0x3915('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x3915('0x15')]);module[_0x3915('0x16')]=router; \ No newline at end of file +var _0x288a=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id','show','/:id/users','isAuthenticated','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers'];(function(_0x56bfb7,_0x3e4072){var _0x858e7e=function(_0x5cd0d8){while(--_0x5cd0d8){_0x56bfb7['push'](_0x56bfb7['shift']());}};_0x858e7e(++_0x3e4072);}(_0x288a,0x188));var _0xa288=function(_0x4f257b,_0xfff5c5){_0x4f257b=_0x4f257b-0x0;var _0x4b2909=_0x288a[_0x4f257b];return _0x4b2909;};'use strict';var multer=require('multer');var util=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var timeout=require(_0xa288('0x2'));var express=require(_0xa288('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa288('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa288('0x5'));var controller=require(_0xa288('0x6'));router[_0xa288('0x7')]('/',auth['isAuthenticated'](),controller[_0xa288('0x8')]);router[_0xa288('0x7')](_0xa288('0x9'),auth['isAuthenticated'](),controller[_0xa288('0xa')]);router[_0xa288('0x7')](_0xa288('0xb'),auth[_0xa288('0xc')](),controller[_0xa288('0xd')]);router[_0xa288('0xe')]('/',auth[_0xa288('0xc')](),controller[_0xa288('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xa288('0x10')]);router[_0xa288('0x11')]('/:id',auth[_0xa288('0xc')](),controller[_0xa288('0x12')]);router[_0xa288('0x13')](_0xa288('0x9'),auth[_0xa288('0xc')](),controller[_0xa288('0x14')]);router[_0xa288('0x13')](_0xa288('0xb'),auth[_0xa288('0xc')](),controller[_0xa288('0x15')]);module[_0xa288('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 743dd7f..88ee4b9 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 _0xf1bd=['toString','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production'];(function(_0x2309ef,_0x26c3d8){var _0x53b7c9=function(_0x46c3e0){while(--_0x46c3e0){_0x2309ef['push'](_0x2309ef['shift']());}};_0x53b7c9(++_0x26c3d8);}(_0xf1bd,0x19a));var _0xdf1b=function(_0x18bb38,_0x17af25){_0x18bb38=_0x18bb38-0x0;var _0x1a8416=_0xf1bd[_0x18bb38];return _0x1a8416;};'use strict';var Sequelize=require(_0xdf1b('0x0'));module[_0xdf1b('0x1')]={'name':{'type':Sequelize[_0xdf1b('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdf1b('0x2')]},'notes':{'type':Sequelize[_0xdf1b('0x3')]},'preproduction':{'type':Sequelize[_0xdf1b('0x4')](_0xdf1b('0x5')),'get':function(){if(this[_0xdf1b('0x6')](_0xdf1b('0x7'))){return this[_0xdf1b('0x6')]('preproduction')['toString'](_0xdf1b('0x8'));}}},'production':{'type':Sequelize[_0xdf1b('0x4')](_0xdf1b('0x5')),'get':function(){if(this[_0xdf1b('0x6')](_0xdf1b('0x9'))){return this['getDataValue'](_0xdf1b('0x9'))[_0xdf1b('0xa')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xdf1b('0xb')]}}; \ No newline at end of file +var _0xf319=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','production'];(function(_0x1373a1,_0x44738a){var _0xc4cce3=function(_0x439f2a){while(--_0x439f2a){_0x1373a1['push'](_0x1373a1['shift']());}};_0xc4cce3(++_0x44738a);}(_0xf319,0xe8));var _0x9f31=function(_0x153bf3,_0x5b60c0){_0x153bf3=_0x153bf3-0x0;var _0x571b27=_0xf319[_0x153bf3];return _0x571b27;};'use strict';var Sequelize=require(_0x9f31('0x0'));module[_0x9f31('0x1')]={'name':{'type':Sequelize[_0x9f31('0x2')],'unique':_0x9f31('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9f31('0x2')]},'notes':{'type':Sequelize[_0x9f31('0x4')]},'preproduction':{'type':Sequelize[_0x9f31('0x5')]('long'),'get':function(){if(this[_0x9f31('0x6')](_0x9f31('0x7'))){return this[_0x9f31('0x6')]('preproduction')[_0x9f31('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x9f31('0x5')]('long'),'get':function(){if(this[_0x9f31('0x6')](_0x9f31('0x9'))){return this[_0x9f31('0x6')](_0x9f31('0x9'))[_0x9f31('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x9f31('0xa')]},'publishedAt':{'type':Sequelize[_0x9f31('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index bc082af..99faa4e 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 _0x42eb=['util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./squareProject.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','get','SquareProjects','UserProfileResource','destroy','then','name','index','map','SquareProject','rawAttributes','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','eml-format','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x59d482,_0x43e5e9){var _0x4b6c63=function(_0x314527){while(--_0x314527){_0x59d482['push'](_0x59d482['shift']());}};_0x4b6c63(++_0x43e5e9);}(_0x42eb,0x11b));var _0xb42e=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x42eb[_0x33dcf7];return _0x542d4e;};'use strict';var emlformat=require(_0xb42e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb42e('0x1'));var jsonpatch=require(_0xb42e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb42e('0x3'));var Mustache=require(_0xb42e('0x4'));var util=require(_0xb42e('0x5'));var path=require('path');var sox=require(_0xb42e('0x6'));var csv=require(_0xb42e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb42e('0x8'));var _=require(_0xb42e('0x9'));var squel=require(_0xb42e('0xa'));var crypto=require('crypto');var jsforce=require(_0xb42e('0xb'));var deskjs=require(_0xb42e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb42e('0xd'));var Papa=require(_0xb42e('0xe'));var Redis=require(_0xb42e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb42e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb42e('0x11'));var logger=require(_0xb42e('0x12'))('api');var utils=require(_0xb42e('0x13'));var config=require(_0xb42e('0x14'));var licenseUtil=require(_0xb42e('0x15'));var db=require(_0xb42e('0x16'))['db'];config['redis']=_[_0xb42e('0x17')](config['redis'],{'host':_0xb42e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb42e('0x19')]));require(_0xb42e('0x1a'))[_0xb42e('0x1b')](socket);function respondWithStatusCode(_0x3f27f5,_0x19dcbc){_0x19dcbc=_0x19dcbc||0xcc;return function(_0x23e328){if(_0x23e328){return _0x3f27f5[_0xb42e('0x1c')](_0x19dcbc);}return _0x3f27f5[_0xb42e('0x1d')](_0x19dcbc)[_0xb42e('0x1e')]();};}function respondWithResult(_0x27a8d9,_0x43f2a6){_0x43f2a6=_0x43f2a6||0xc8;return function(_0x24b6d2){if(_0x24b6d2){return _0x27a8d9[_0xb42e('0x1d')](_0x43f2a6)['json'](_0x24b6d2);}};}function respondWithFilteredResult(_0x2eea8c,_0x433a20){return function(_0x549cf5){if(_0x549cf5){var _0x4531b=typeof _0x433a20['offset']===_0xb42e('0x1f')&&typeof _0x433a20[_0xb42e('0x20')]===_0xb42e('0x1f');var _0x39a46c=_0x549cf5[_0xb42e('0x21')];var _0x12cc30=_0x4531b?0x0:_0x433a20['offset'];var _0x55cd1c=_0x4531b?_0x549cf5[_0xb42e('0x21')]:_0x433a20[_0xb42e('0x22')]+_0x433a20[_0xb42e('0x20')];var _0x1e2d40;if(_0x55cd1c>=_0x39a46c){_0x55cd1c=_0x39a46c;_0x1e2d40=0xc8;}else{_0x1e2d40=0xce;}_0x2eea8c[_0xb42e('0x1d')](_0x1e2d40);return _0x2eea8c['set'](_0xb42e('0x23'),_0x12cc30+'-'+_0x55cd1c+'/'+_0x39a46c)[_0xb42e('0x24')](_0x549cf5);}return null;};}function patchUpdates(_0x388a55){return function(_0x2cd678){try{jsonpatch['apply'](_0x2cd678,_0x388a55,!![]);}catch(_0x2b10d9){return BPromise[_0xb42e('0x25')](_0x2b10d9);}return _0x2cd678[_0xb42e('0x26')]();};}function saveUpdates(_0x3c96c9,_0x5df929){return function(_0x5a1d82){if(_0x5a1d82){return _0x5a1d82[_0xb42e('0x27')](_0x3c96c9)['then'](function(_0x567e82){return _0x567e82;});}return null;};}function removeEntity(_0x3014d5,_0x14e724){return function(_0x1c4581){if(_0x1c4581){return _0x1c4581['destroy']()['then'](function(){var _0x11675b=_0x1c4581[_0xb42e('0x28')]({'plain':!![]});var _0x2f894a=_0xb42e('0x29');return db[_0xb42e('0x2a')][_0xb42e('0x2b')]({'where':{'type':_0x2f894a,'resourceId':_0x11675b['id']}})[_0xb42e('0x2c')](function(){return _0x1c4581;});})[_0xb42e('0x2c')](function(){_0x3014d5[_0xb42e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9490,_0x151270){return function(_0x5ed22c){if(!_0x5ed22c){_0x1a9490['sendStatus'](0x194);}return _0x5ed22c;};}function handleError(_0x545dc9,_0x44621d){_0x44621d=_0x44621d||0x1f4;return function(_0x2380bc){logger['error'](_0x2380bc['stack']);if(_0x2380bc['name']){delete _0x2380bc[_0xb42e('0x2d')];}_0x545dc9[_0xb42e('0x1d')](_0x44621d)['send'](_0x2380bc);};}exports[_0xb42e('0x2e')]=function(_0x170748,_0x3f22aa){var _0x209407={},_0x465a33={},_0x57aa05={'count':0x0,'rows':[]};var _0x21090e=_[_0xb42e('0x2f')](db[_0xb42e('0x30')][_0xb42e('0x31')],function(_0x50fe96){return{'name':_0x50fe96['fieldName'],'type':_0x50fe96[_0xb42e('0x32')][_0xb42e('0x33')]};});_0x465a33['model']=_[_0xb42e('0x2f')](_0x21090e,_0xb42e('0x2d'));_0x465a33['query']=_['keys'](_0x170748[_0xb42e('0x34')]);_0x465a33['filters']=_['intersection'](_0x465a33[_0xb42e('0x35')],_0x465a33[_0xb42e('0x34')]);_0x209407['attributes']=_[_0xb42e('0x36')](_0x465a33[_0xb42e('0x35')],qs[_0xb42e('0x37')](_0x170748['query'][_0xb42e('0x37')]));_0x209407[_0xb42e('0x38')]=_0x209407[_0xb42e('0x38')][_0xb42e('0x39')]?_0x209407[_0xb42e('0x38')]:_0x465a33[_0xb42e('0x35')];if(!_0x170748[_0xb42e('0x34')][_0xb42e('0x3a')](_0xb42e('0x3b'))){_0x209407[_0xb42e('0x20')]=qs[_0xb42e('0x20')](_0x170748[_0xb42e('0x34')][_0xb42e('0x20')]);_0x209407[_0xb42e('0x22')]=qs[_0xb42e('0x22')](_0x170748[_0xb42e('0x34')][_0xb42e('0x22')]);}_0x209407[_0xb42e('0x3c')]=qs['sort'](_0x170748[_0xb42e('0x34')][_0xb42e('0x3d')]);_0x209407[_0xb42e('0x3e')]=qs[_0xb42e('0x3f')](_[_0xb42e('0x40')](_0x170748['query'],_0x465a33[_0xb42e('0x3f')]),_0x21090e);if(_0x170748['query'][_0xb42e('0x41')]){_0x209407[_0xb42e('0x3e')]=_[_0xb42e('0x42')](_0x209407['where'],{'$or':_['map'](_0x21090e,function(_0x181feb){if(_0x181feb['type']!==_0xb42e('0x43')){var _0x221593={};_0x221593[_0x181feb[_0xb42e('0x2d')]]={'$like':'%'+_0x170748[_0xb42e('0x34')][_0xb42e('0x41')]+'%'};return _0x221593;}})});}_0x209407=_[_0xb42e('0x42')]({},_0x209407,_0x170748[_0xb42e('0x44')]);var _0x444a63={'where':_0x209407[_0xb42e('0x3e')]};return db[_0xb42e('0x30')][_0xb42e('0x21')](_0x444a63)['then'](function(_0x1f4a38){_0x57aa05[_0xb42e('0x21')]=_0x1f4a38;if(_0x170748[_0xb42e('0x34')][_0xb42e('0x45')]){_0x209407[_0xb42e('0x46')]=[{'all':!![]}];}return db[_0xb42e('0x30')][_0xb42e('0x47')](_0x209407);})[_0xb42e('0x2c')](function(_0x585b3a){_0x57aa05[_0xb42e('0x48')]=_0x585b3a;return _0x57aa05;})['then'](respondWithFilteredResult(_0x3f22aa,_0x209407))[_0xb42e('0x49')](handleError(_0x3f22aa,null));};exports[_0xb42e('0x4a')]=function(_0x4f69f1,_0x2a5713){var _0x1956f8={'raw':![],'where':{'id':_0x4f69f1['params']['id']}},_0x4bec01={};_0x4bec01['model']=_[_0xb42e('0x4b')](db[_0xb42e('0x30')][_0xb42e('0x31')]);_0x4bec01[_0xb42e('0x34')]=_[_0xb42e('0x4b')](_0x4f69f1[_0xb42e('0x34')]);_0x4bec01[_0xb42e('0x3f')]=_['intersection'](_0x4bec01[_0xb42e('0x35')],_0x4bec01['query']);_0x1956f8[_0xb42e('0x38')]=_[_0xb42e('0x36')](_0x4bec01['model'],qs['fields'](_0x4f69f1[_0xb42e('0x34')][_0xb42e('0x37')]));_0x1956f8[_0xb42e('0x38')]=_0x1956f8[_0xb42e('0x38')][_0xb42e('0x39')]?_0x1956f8[_0xb42e('0x38')]:_0x4bec01[_0xb42e('0x35')];if(_0x4f69f1[_0xb42e('0x34')][_0xb42e('0x45')]){_0x1956f8[_0xb42e('0x46')]=[{'all':!![]}];}_0x1956f8=_['merge']({},_0x1956f8,_0x4f69f1[_0xb42e('0x44')]);return db[_0xb42e('0x30')][_0xb42e('0x4c')](_0x1956f8)[_0xb42e('0x2c')](handleEntityNotFound(_0x2a5713,null))['then'](respondWithResult(_0x2a5713,null))[_0xb42e('0x49')](handleError(_0x2a5713,null));};exports[_0xb42e('0x4d')]=function(_0x4759e3,_0x2a5ed3){return db[_0xb42e('0x30')][_0xb42e('0x4d')](_0x4759e3[_0xb42e('0x4e')],{})['then'](function(_0x11fe64){var _0x29499d=_0x4759e3[_0xb42e('0x4f')][_0xb42e('0x28')]({'plain':!![]});if(!_0x29499d)throw new Error(_0xb42e('0x50'));if(_0x29499d[_0xb42e('0x51')]===_0xb42e('0x4f')){var _0x2bcd62=_0x11fe64[_0xb42e('0x28')]({'plain':!![]});var _0x10f7c9='SquareProjects';return db[_0xb42e('0x52')][_0xb42e('0x4c')]({'where':{'name':_0x10f7c9,'userProfileId':_0x29499d[_0xb42e('0x53')]},'raw':!![]})['then'](function(_0x253976){if(_0x253976&&_0x253976[_0xb42e('0x54')]===0x0){return db[_0xb42e('0x2a')]['create']({'name':_0x2bcd62[_0xb42e('0x2d')],'resourceId':_0x2bcd62['id'],'type':_0x253976[_0xb42e('0x2d')],'sectionId':_0x253976['id']},{})[_0xb42e('0x2c')](function(){return _0x11fe64;});}else{return _0x11fe64;}})['catch'](function(_0x4e6b6d){logger[_0xb42e('0x55')](_0xb42e('0x56'),_0x4e6b6d);throw _0x4e6b6d;});}return _0x11fe64;})[_0xb42e('0x2c')](respondWithResult(_0x2a5ed3,0xc9))[_0xb42e('0x49')](handleError(_0x2a5ed3,null));};exports[_0xb42e('0x27')]=function(_0x270777,_0x239a1c){if(_0x270777[_0xb42e('0x4e')]['id']){delete _0x270777[_0xb42e('0x4e')]['id'];}return db[_0xb42e('0x30')][_0xb42e('0x4c')]({'where':{'id':_0x270777[_0xb42e('0x57')]['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x239a1c,null))[_0xb42e('0x2c')](saveUpdates(_0x270777[_0xb42e('0x4e')],null))[_0xb42e('0x2c')](respondWithResult(_0x239a1c,null))[_0xb42e('0x49')](handleError(_0x239a1c,null));};exports[_0xb42e('0x2b')]=function(_0x3bbe7f,_0x388e7a){return db['SquareProject'][_0xb42e('0x4c')]({'where':{'id':_0x3bbe7f[_0xb42e('0x57')]['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x388e7a,null))[_0xb42e('0x2c')](removeEntity(_0x388e7a,null))[_0xb42e('0x49')](handleError(_0x388e7a,null));};exports[_0xb42e('0x58')]=function(_0x155301,_0x16f38b,_0x1d0a38){return db['SquareProject']['find']({'where':{'id':_0x155301[_0xb42e('0x57')]['id']}})['then'](handleEntityNotFound(_0x16f38b,null))[_0xb42e('0x2c')](function(_0x9ac241){if(_0x9ac241){return _0x9ac241['addUsers'](_0x155301['body']['ids'],_[_0xb42e('0x59')](_0x155301['body'],[_0xb42e('0x5a'),'id'])||{});}})[_0xb42e('0x2c')](respondWithResult(_0x16f38b,null))[_0xb42e('0x49')](handleError(_0x16f38b,null));};exports[_0xb42e('0x5b')]=function(_0xd04b04,_0xf77ae6,_0x61f2a){return db[_0xb42e('0x30')][_0xb42e('0x4c')]({'where':{'id':_0xd04b04['params']['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0xf77ae6,null))[_0xb42e('0x2c')](function(_0xf5734){if(_0xf5734){return _0xf5734[_0xb42e('0x5b')](_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')])[_0xb42e('0x2c')](function(){if(_[_0xb42e('0x5c')](_0xd04b04['query'][_0xb42e('0x5a')])){for(var _0x468e49=0x0;_0x468e49<_0xd04b04['query'][_0xb42e('0x5a')]['length'];_0x468e49+=0x1){socket['emit'](_0xb42e('0x5d'),{'UserId':Number(_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')][_0x468e49]),'SquareProjectId':Number(_0xd04b04['params']['id'])});}}else{socket['emit'](_0xb42e('0x5d'),{'UserId':Number(_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')]),'SquareProjectId':Number(_0xd04b04[_0xb42e('0x57')]['id'])});}});}})[_0xb42e('0x2c')](respondWithStatusCode(_0xf77ae6,null))['catch'](handleError(_0xf77ae6,null));};exports[_0xb42e('0x5e')]=function(_0xaeee65,_0x5d176b,_0x6191f5){var _0x200528={};var _0x184cb8={};var _0x4eb084;var _0x162a62;return db['SquareProject'][_0xb42e('0x5f')]({'where':{'id':_0xaeee65['params']['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x5d176b,null))['then'](function(_0x41cb7b){if(_0x41cb7b){_0x4eb084=_0x41cb7b;_0x184cb8['model']=_['keys'](db['User']['rawAttributes']);_0x184cb8['query']=_['keys'](_0xaeee65[_0xb42e('0x34')]);_0x184cb8[_0xb42e('0x3f')]=_[_0xb42e('0x36')](_0x184cb8[_0xb42e('0x35')],_0x184cb8[_0xb42e('0x34')]);_0x200528[_0xb42e('0x38')]=_[_0xb42e('0x36')](_0x184cb8[_0xb42e('0x35')],qs[_0xb42e('0x37')](_0xaeee65[_0xb42e('0x34')][_0xb42e('0x37')]));_0x200528[_0xb42e('0x38')]=_0x200528[_0xb42e('0x38')][_0xb42e('0x39')]?_0x200528[_0xb42e('0x38')]:_0x184cb8['model'];_0x200528['order']=qs[_0xb42e('0x3d')](_0xaeee65[_0xb42e('0x34')][_0xb42e('0x3d')]);_0x200528[_0xb42e('0x3e')]=qs['filters'](_[_0xb42e('0x40')](_0xaeee65[_0xb42e('0x34')],_0x184cb8['filters']));if(_0xaeee65[_0xb42e('0x34')][_0xb42e('0x41')]){_0x200528[_0xb42e('0x3e')]=_['merge'](_0x200528[_0xb42e('0x3e')],{'$or':_[_0xb42e('0x2f')](_0x200528[_0xb42e('0x38')],function(_0x4caf8a){var _0x201e8f={};_0x201e8f[_0x4caf8a]={'$like':'%'+_0xaeee65['query'][_0xb42e('0x41')]+'%'};return _0x201e8f;})});}_0x200528=_[_0xb42e('0x42')]({},_0x200528,_0xaeee65['options']);return _0x4eb084[_0xb42e('0x5e')](_0x200528);}})['then'](function(_0x3c78d6){if(_0x3c78d6){_0x162a62=_0x3c78d6[_0xb42e('0x39')];if(!_0xaeee65['query']['hasOwnProperty'](_0xb42e('0x3b'))){_0x200528[_0xb42e('0x20')]=qs[_0xb42e('0x20')](_0xaeee65['query'][_0xb42e('0x20')]);_0x200528[_0xb42e('0x22')]=qs[_0xb42e('0x22')](_0xaeee65['query'][_0xb42e('0x22')]);}return _0x4eb084[_0xb42e('0x5e')](_0x200528);}})[_0xb42e('0x2c')](function(_0x2c7989){if(_0x2c7989){return _0x2c7989?{'count':_0x162a62,'rows':_0x2c7989}:null;}})[_0xb42e('0x2c')](respondWithResult(_0x5d176b,null))[_0xb42e('0x49')](handleError(_0x5d176b,null));}; \ No newline at end of file +var _0xdeae=['filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','name','query','keys'];(function(_0x41d350,_0x6062e){var _0x19899a=function(_0x4e4b86){while(--_0x4e4b86){_0x41d350['push'](_0x41d350['shift']());}};_0x19899a(++_0x6062e);}(_0xdeae,0x8f));var _0xedea=function(_0x72e04a,_0x398f0b){_0x72e04a=_0x72e04a-0x0;var _0x4e8acf=_0xdeae[_0x72e04a];return _0x4e8acf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xedea('0x0'));var zipdir=require(_0xedea('0x1'));var jsonpatch=require(_0xedea('0x2'));var rp=require(_0xedea('0x3'));var moment=require('moment');var BPromise=require(_0xedea('0x4'));var Mustache=require(_0xedea('0x5'));var util=require(_0xedea('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xedea('0x7'));var ejs=require(_0xedea('0x8'));var fs=require('fs');var fs_extra=require(_0xedea('0x9'));var _=require('lodash');var squel=require(_0xedea('0xa'));var crypto=require('crypto');var jsforce=require(_0xedea('0xb'));var deskjs=require(_0xedea('0xc'));var toCsv=require(_0xedea('0x7'));var querystring=require(_0xedea('0xd'));var Papa=require(_0xedea('0xe'));var Redis=require(_0xedea('0xf'));var authService=require(_0xedea('0x10'));var qs=require(_0xedea('0x11'));var as=require(_0xedea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedea('0x13'))(_0xedea('0x14'));var utils=require(_0xedea('0x15'));var config=require(_0xedea('0x16'));var licenseUtil=require(_0xedea('0x17'));var db=require(_0xedea('0x18'))['db'];config[_0xedea('0x19')]=_['defaults'](config[_0xedea('0x19')],{'host':_0xedea('0x1a'),'port':0x18eb});var socket=require(_0xedea('0x1b'))(new Redis(config[_0xedea('0x19')]));require(_0xedea('0x1c'))['register'](socket);function respondWithStatusCode(_0x4e1f9c,_0x207dae){_0x207dae=_0x207dae||0xcc;return function(_0x5475d0){if(_0x5475d0){return _0x4e1f9c[_0xedea('0x1d')](_0x207dae);}return _0x4e1f9c[_0xedea('0x1e')](_0x207dae)[_0xedea('0x1f')]();};}function respondWithResult(_0x59be48,_0x5cf848){_0x5cf848=_0x5cf848||0xc8;return function(_0x24a5af){if(_0x24a5af){return _0x59be48[_0xedea('0x1e')](_0x5cf848)['json'](_0x24a5af);}};}function respondWithFilteredResult(_0x38c502,_0x78c937){return function(_0x107fae){if(_0x107fae){var _0x770eed=typeof _0x78c937[_0xedea('0x20')]===_0xedea('0x21')&&typeof _0x78c937[_0xedea('0x22')]===_0xedea('0x21');var _0x5e26c3=_0x107fae[_0xedea('0x23')];var _0x5fe765=_0x770eed?0x0:_0x78c937[_0xedea('0x20')];var _0x46bd4f=_0x770eed?_0x107fae[_0xedea('0x23')]:_0x78c937[_0xedea('0x20')]+_0x78c937[_0xedea('0x22')];var _0x5357fb;if(_0x46bd4f>=_0x5e26c3){_0x46bd4f=_0x5e26c3;_0x5357fb=0xc8;}else{_0x5357fb=0xce;}_0x38c502[_0xedea('0x1e')](_0x5357fb);return _0x38c502[_0xedea('0x24')](_0xedea('0x25'),_0x5fe765+'-'+_0x46bd4f+'/'+_0x5e26c3)[_0xedea('0x26')](_0x107fae);}return null;};}function patchUpdates(_0x34f938){return function(_0x59a07a){try{jsonpatch[_0xedea('0x27')](_0x59a07a,_0x34f938,!![]);}catch(_0x3a3685){return BPromise[_0xedea('0x28')](_0x3a3685);}return _0x59a07a[_0xedea('0x29')]();};}function saveUpdates(_0x4e8aa4,_0x3a9bf0){return function(_0x3de3a1){if(_0x3de3a1){return _0x3de3a1[_0xedea('0x2a')](_0x4e8aa4)[_0xedea('0x2b')](function(_0x7a2138){return _0x7a2138;});}return null;};}function removeEntity(_0x285f5e,_0x58ae19){return function(_0x52cc90){if(_0x52cc90){return _0x52cc90[_0xedea('0x2c')]()[_0xedea('0x2b')](function(){var _0x2a967d=_0x52cc90[_0xedea('0x2d')]({'plain':!![]});var _0x2cdffc=_0xedea('0x2e');return db[_0xedea('0x2f')][_0xedea('0x2c')]({'where':{'type':_0x2cdffc,'resourceId':_0x2a967d['id']}})[_0xedea('0x2b')](function(){return _0x52cc90;});})['then'](function(){_0x285f5e[_0xedea('0x1e')](0xcc)[_0xedea('0x1f')]();});}};}function handleEntityNotFound(_0x3f6a93,_0x379d82){return function(_0x2c073c){if(!_0x2c073c){_0x3f6a93[_0xedea('0x1d')](0x194);}return _0x2c073c;};}function handleError(_0x504421,_0x5443eb){_0x5443eb=_0x5443eb||0x1f4;return function(_0x36b41f){logger['error'](_0x36b41f[_0xedea('0x30')]);if(_0x36b41f['name']){delete _0x36b41f['name'];}_0x504421[_0xedea('0x1e')](_0x5443eb)[_0xedea('0x31')](_0x36b41f);};}exports[_0xedea('0x32')]=function(_0x21f23c,_0x1ef38f){var _0x5980ca={},_0x1a7d35={},_0x50cd75={'count':0x0,'rows':[]};var _0x539f89=_[_0xedea('0x33')](db[_0xedea('0x34')][_0xedea('0x35')],function(_0x17aae3){return{'name':_0x17aae3[_0xedea('0x36')],'type':_0x17aae3[_0xedea('0x37')][_0xedea('0x38')]};});_0x1a7d35[_0xedea('0x39')]=_[_0xedea('0x33')](_0x539f89,_0xedea('0x3a'));_0x1a7d35[_0xedea('0x3b')]=_[_0xedea('0x3c')](_0x21f23c['query']);_0x1a7d35[_0xedea('0x3d')]=_[_0xedea('0x3e')](_0x1a7d35[_0xedea('0x39')],_0x1a7d35['query']);_0x5980ca[_0xedea('0x3f')]=_[_0xedea('0x3e')](_0x1a7d35[_0xedea('0x39')],qs[_0xedea('0x40')](_0x21f23c[_0xedea('0x3b')][_0xedea('0x40')]));_0x5980ca[_0xedea('0x3f')]=_0x5980ca['attributes'][_0xedea('0x41')]?_0x5980ca['attributes']:_0x1a7d35[_0xedea('0x39')];if(!_0x21f23c['query']['hasOwnProperty'](_0xedea('0x42'))){_0x5980ca[_0xedea('0x22')]=qs[_0xedea('0x22')](_0x21f23c[_0xedea('0x3b')][_0xedea('0x22')]);_0x5980ca['offset']=qs[_0xedea('0x20')](_0x21f23c[_0xedea('0x3b')]['offset']);}_0x5980ca[_0xedea('0x43')]=qs[_0xedea('0x44')](_0x21f23c[_0xedea('0x3b')][_0xedea('0x44')]);_0x5980ca['where']=qs['filters'](_[_0xedea('0x45')](_0x21f23c[_0xedea('0x3b')],_0x1a7d35['filters']),_0x539f89);if(_0x21f23c['query'][_0xedea('0x46')]){_0x5980ca['where']=_['merge'](_0x5980ca[_0xedea('0x47')],{'$or':_[_0xedea('0x33')](_0x539f89,function(_0x44a9fd){if(_0x44a9fd[_0xedea('0x37')]!==_0xedea('0x48')){var _0x3dcb9e={};_0x3dcb9e[_0x44a9fd[_0xedea('0x3a')]]={'$like':'%'+_0x21f23c[_0xedea('0x3b')][_0xedea('0x46')]+'%'};return _0x3dcb9e;}})});}_0x5980ca=_[_0xedea('0x49')]({},_0x5980ca,_0x21f23c[_0xedea('0x4a')]);var _0x30c7e2={'where':_0x5980ca[_0xedea('0x47')]};return db[_0xedea('0x34')][_0xedea('0x23')](_0x30c7e2)[_0xedea('0x2b')](function(_0x4adc08){_0x50cd75[_0xedea('0x23')]=_0x4adc08;if(_0x21f23c[_0xedea('0x3b')]['includeAll']){_0x5980ca[_0xedea('0x4b')]=[{'all':!![]}];}return db[_0xedea('0x34')][_0xedea('0x4c')](_0x5980ca);})[_0xedea('0x2b')](function(_0x5ad5ed){_0x50cd75[_0xedea('0x4d')]=_0x5ad5ed;return _0x50cd75;})[_0xedea('0x2b')](respondWithFilteredResult(_0x1ef38f,_0x5980ca))[_0xedea('0x4e')](handleError(_0x1ef38f,null));};exports[_0xedea('0x4f')]=function(_0x2a8fad,_0x1f2fa5){var _0x5b5e75={'raw':![],'where':{'id':_0x2a8fad['params']['id']}},_0x85c5f1={};_0x85c5f1[_0xedea('0x39')]=_[_0xedea('0x3c')](db['SquareProject'][_0xedea('0x35')]);_0x85c5f1['query']=_[_0xedea('0x3c')](_0x2a8fad[_0xedea('0x3b')]);_0x85c5f1[_0xedea('0x3d')]=_[_0xedea('0x3e')](_0x85c5f1[_0xedea('0x39')],_0x85c5f1[_0xedea('0x3b')]);_0x5b5e75[_0xedea('0x3f')]=_[_0xedea('0x3e')](_0x85c5f1[_0xedea('0x39')],qs[_0xedea('0x40')](_0x2a8fad[_0xedea('0x3b')][_0xedea('0x40')]));_0x5b5e75['attributes']=_0x5b5e75[_0xedea('0x3f')]['length']?_0x5b5e75[_0xedea('0x3f')]:_0x85c5f1['model'];if(_0x2a8fad['query']['includeAll']){_0x5b5e75[_0xedea('0x4b')]=[{'all':!![]}];}_0x5b5e75=_[_0xedea('0x49')]({},_0x5b5e75,_0x2a8fad[_0xedea('0x4a')]);return db[_0xedea('0x34')][_0xedea('0x50')](_0x5b5e75)[_0xedea('0x2b')](handleEntityNotFound(_0x1f2fa5,null))['then'](respondWithResult(_0x1f2fa5,null))[_0xedea('0x4e')](handleError(_0x1f2fa5,null));};exports[_0xedea('0x51')]=function(_0x3eec08,_0x4451d3){return db[_0xedea('0x34')][_0xedea('0x51')](_0x3eec08[_0xedea('0x52')],{})[_0xedea('0x2b')](function(_0x3f31dc){var _0x5ba762=_0x3eec08[_0xedea('0x53')]['get']({'plain':!![]});if(!_0x5ba762)throw new Error(_0xedea('0x54'));if(_0x5ba762[_0xedea('0x55')]===_0xedea('0x53')){var _0x449c9b=_0x3f31dc[_0xedea('0x2d')]({'plain':!![]});var _0x211320=_0xedea('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x211320,'userProfileId':_0x5ba762[_0xedea('0x56')]},'raw':!![]})[_0xedea('0x2b')](function(_0x468868){if(_0x468868&&_0x468868[_0xedea('0x57')]===0x0){return db[_0xedea('0x2f')]['create']({'name':_0x449c9b[_0xedea('0x3a')],'resourceId':_0x449c9b['id'],'type':_0x468868['name'],'sectionId':_0x468868['id']},{})[_0xedea('0x2b')](function(){return _0x3f31dc;});}else{return _0x3f31dc;}})[_0xedea('0x4e')](function(_0x25f673){logger[_0xedea('0x58')](_0xedea('0x59'),_0x25f673);throw _0x25f673;});}return _0x3f31dc;})[_0xedea('0x2b')](respondWithResult(_0x4451d3,0xc9))[_0xedea('0x4e')](handleError(_0x4451d3,null));};exports[_0xedea('0x2a')]=function(_0x36bea3,_0x3ad05d){if(_0x36bea3[_0xedea('0x52')]['id']){delete _0x36bea3[_0xedea('0x52')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x36bea3[_0xedea('0x5a')]['id']}})[_0xedea('0x2b')](handleEntityNotFound(_0x3ad05d,null))[_0xedea('0x2b')](saveUpdates(_0x36bea3['body'],null))[_0xedea('0x2b')](respondWithResult(_0x3ad05d,null))[_0xedea('0x4e')](handleError(_0x3ad05d,null));};exports[_0xedea('0x2c')]=function(_0x409890,_0x25df70){return db[_0xedea('0x34')][_0xedea('0x50')]({'where':{'id':_0x409890['params']['id']}})['then'](handleEntityNotFound(_0x25df70,null))[_0xedea('0x2b')](removeEntity(_0x25df70,null))[_0xedea('0x4e')](handleError(_0x25df70,null));};exports[_0xedea('0x5b')]=function(_0x10fa89,_0x111ec1,_0x362d1b){return db[_0xedea('0x34')][_0xedea('0x50')]({'where':{'id':_0x10fa89[_0xedea('0x5a')]['id']}})[_0xedea('0x2b')](handleEntityNotFound(_0x111ec1,null))[_0xedea('0x2b')](function(_0x19b813){if(_0x19b813){return _0x19b813[_0xedea('0x5b')](_0x10fa89[_0xedea('0x52')][_0xedea('0x5c')],_[_0xedea('0x5d')](_0x10fa89[_0xedea('0x52')],[_0xedea('0x5c'),'id'])||{});}})[_0xedea('0x2b')](respondWithResult(_0x111ec1,null))['catch'](handleError(_0x111ec1,null));};exports['removeUsers']=function(_0x118166,_0x2cfd45,_0x327dc1){return db[_0xedea('0x34')][_0xedea('0x50')]({'where':{'id':_0x118166[_0xedea('0x5a')]['id']}})[_0xedea('0x2b')](handleEntityNotFound(_0x2cfd45,null))[_0xedea('0x2b')](function(_0x2d67fd){if(_0x2d67fd){return _0x2d67fd[_0xedea('0x5e')](_0x118166['query'][_0xedea('0x5c')])['then'](function(){if(_[_0xedea('0x5f')](_0x118166['query'][_0xedea('0x5c')])){for(var _0x459886=0x0;_0x459886<_0x118166[_0xedea('0x3b')][_0xedea('0x5c')][_0xedea('0x41')];_0x459886+=0x1){socket[_0xedea('0x60')](_0xedea('0x61'),{'UserId':Number(_0x118166['query'][_0xedea('0x5c')][_0x459886]),'SquareProjectId':Number(_0x118166[_0xedea('0x5a')]['id'])});}}else{socket[_0xedea('0x60')](_0xedea('0x61'),{'UserId':Number(_0x118166[_0xedea('0x3b')][_0xedea('0x5c')]),'SquareProjectId':Number(_0x118166[_0xedea('0x5a')]['id'])});}});}})[_0xedea('0x2b')](respondWithStatusCode(_0x2cfd45,null))[_0xedea('0x4e')](handleError(_0x2cfd45,null));};exports[_0xedea('0x62')]=function(_0x34ecb6,_0x52f427,_0x47ee6b){var _0x4120e0={};var _0x25c088={};var _0xe1a02c;var _0x4a5931;return db[_0xedea('0x34')][_0xedea('0x63')]({'where':{'id':_0x34ecb6[_0xedea('0x5a')]['id']}})[_0xedea('0x2b')](handleEntityNotFound(_0x52f427,null))['then'](function(_0x3df9de){if(_0x3df9de){_0xe1a02c=_0x3df9de;_0x25c088[_0xedea('0x39')]=_['keys'](db[_0xedea('0x64')]['rawAttributes']);_0x25c088[_0xedea('0x3b')]=_[_0xedea('0x3c')](_0x34ecb6[_0xedea('0x3b')]);_0x25c088[_0xedea('0x3d')]=_[_0xedea('0x3e')](_0x25c088[_0xedea('0x39')],_0x25c088[_0xedea('0x3b')]);_0x4120e0[_0xedea('0x3f')]=_[_0xedea('0x3e')](_0x25c088[_0xedea('0x39')],qs['fields'](_0x34ecb6[_0xedea('0x3b')][_0xedea('0x40')]));_0x4120e0[_0xedea('0x3f')]=_0x4120e0[_0xedea('0x3f')][_0xedea('0x41')]?_0x4120e0['attributes']:_0x25c088[_0xedea('0x39')];_0x4120e0['order']=qs[_0xedea('0x44')](_0x34ecb6[_0xedea('0x3b')][_0xedea('0x44')]);_0x4120e0[_0xedea('0x47')]=qs['filters'](_['pick'](_0x34ecb6[_0xedea('0x3b')],_0x25c088[_0xedea('0x3d')]));if(_0x34ecb6['query'][_0xedea('0x46')]){_0x4120e0[_0xedea('0x47')]=_[_0xedea('0x49')](_0x4120e0[_0xedea('0x47')],{'$or':_[_0xedea('0x33')](_0x4120e0[_0xedea('0x3f')],function(_0x492106){var _0x4f3fc0={};_0x4f3fc0[_0x492106]={'$like':'%'+_0x34ecb6[_0xedea('0x3b')][_0xedea('0x46')]+'%'};return _0x4f3fc0;})});}_0x4120e0=_[_0xedea('0x49')]({},_0x4120e0,_0x34ecb6[_0xedea('0x4a')]);return _0xe1a02c[_0xedea('0x62')](_0x4120e0);}})['then'](function(_0x45064b){if(_0x45064b){_0x4a5931=_0x45064b[_0xedea('0x41')];if(!_0x34ecb6[_0xedea('0x3b')][_0xedea('0x65')](_0xedea('0x42'))){_0x4120e0[_0xedea('0x22')]=qs['limit'](_0x34ecb6['query'][_0xedea('0x22')]);_0x4120e0[_0xedea('0x20')]=qs[_0xedea('0x20')](_0x34ecb6[_0xedea('0x3b')][_0xedea('0x20')]);}return _0xe1a02c[_0xedea('0x62')](_0x4120e0);}})[_0xedea('0x2b')](function(_0x201506){if(_0x201506){return _0x201506?{'count':_0x4a5931,'rows':_0x201506}:null;}})[_0xedea('0x2b')](respondWithResult(_0x52f427,null))[_0xedea('0x4e')](handleError(_0x52f427,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index caf1896..dd2626b 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 _0x3c4b=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x28603c,_0x4a63f4){var _0x21ae3f=function(_0x2180e2){while(--_0x2180e2){_0x28603c['push'](_0x28603c['shift']());}};_0x21ae3f(++_0x4a63f4);}(_0x3c4b,0x129));var _0xb3c4=function(_0x583e18,_0x18c831){_0x583e18=_0x583e18-0x0;var _0x55a6f4=_0x3c4b[_0x583e18];return _0x55a6f4;};'use strict';var EventEmitter=require(_0xb3c4('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xb3c4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb3c4('0x2')](0x0);var events={'afterCreate':_0xb3c4('0x3'),'afterUpdate':_0xb3c4('0x4'),'afterDestroy':_0xb3c4('0x5')};function emitEvent(_0x2a3f5d){return function(_0x74d4d9,_0xd39d9d,_0x50257b){SquareProjectEvents[_0xb3c4('0x6')](_0x2a3f5d+':'+_0x74d4d9['id'],_0x74d4d9);SquareProjectEvents[_0xb3c4('0x6')](_0x2a3f5d,_0x74d4d9);_0x50257b(null);};}for(var e in events){if(events[_0xb3c4('0x7')](e)){var event=events[e];SquareProject[_0xb3c4('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x23b3=['remove','emit','hook','exports','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x2a18ab,_0xae4224){var _0x5d7db8=function(_0x21ccb2){while(--_0x21ccb2){_0x2a18ab['push'](_0x2a18ab['shift']());}};_0x5d7db8(++_0xae4224);}(_0x23b3,0x1cf));var _0x323b=function(_0x2100d6,_0x55362c){_0x2100d6=_0x2100d6-0x0;var _0x298ddd=_0x23b3[_0x2100d6];return _0x298ddd;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x323b('0x0'))['db'][_0x323b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x323b('0x2')](0x0);var events={'afterCreate':_0x323b('0x3'),'afterUpdate':_0x323b('0x4'),'afterDestroy':_0x323b('0x5')};function emitEvent(_0x254211){return function(_0x28f1b3,_0x43d98d,_0x1ab644){SquareProjectEvents[_0x323b('0x6')](_0x254211+':'+_0x28f1b3['id'],_0x28f1b3);SquareProjectEvents[_0x323b('0x6')](_0x254211,_0x28f1b3);_0x1ab644(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x323b('0x7')](e,emitEvent(event));}}module[_0x323b('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0fc542f..da04d01 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 _0x81ec=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','SquareProject','changed','preproduction'];(function(_0x540df4,_0x264a86){var _0x23dc36=function(_0x3661ba){while(--_0x3661ba){_0x540df4['push'](_0x540df4['shift']());}};_0x23dc36(++_0x264a86);}(_0x81ec,0x140));var _0xc81e=function(_0x1a42bc,_0x34a88c){_0x1a42bc=_0x1a42bc-0x0;var _0x33fd2b=_0x81ec[_0x1a42bc];return _0x33fd2b;};'use strict';var _=require('lodash');var util=require(_0xc81e('0x0'));var logger=require(_0xc81e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc81e('0x2'));var rp=require(_0xc81e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc81e('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc81e('0x5')]=function(_0x1b0674,_0x4389fe){return _0x1b0674[_0xc81e('0x6')](_0xc81e('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59f1f3,_0x213973,_0x59ff60){if(_0x59f1f3[_0xc81e('0x8')](_0xc81e('0x9'))){_0x59f1f3[_0xc81e('0xa')]=moment()[_0xc81e('0xb')](_0xc81e('0xc'));}if(_0x59f1f3['changed'](_0xc81e('0xd'))){_0x59f1f3[_0xc81e('0xe')]=moment()[_0xc81e('0xb')](_0xc81e('0xc'));}_0x59ff60(null,_0x59f1f3);}}});}; \ No newline at end of file +var _0xd703=['exports','define','SquareProject','changed','preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xd703,0x113));var _0x3d70=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xd703[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x3d70('0x0'));var util=require(_0x3d70('0x1'));var logger=require(_0x3d70('0x2'))('api');var moment=require(_0x3d70('0x3'));var BPromise=require(_0x3d70('0x4'));var rp=require(_0x3d70('0x5'));var fs=require('fs');var path=require(_0x3d70('0x6'));var rimraf=require(_0x3d70('0x7'));var config=require(_0x3d70('0x8'));var attributes=require(_0x3d70('0x9'));module[_0x3d70('0xa')]=function(_0x1e093b,_0x3b487d){return _0x1e093b[_0x3d70('0xb')](_0x3d70('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59a655,_0x59cce0,_0xf22964){if(_0x59a655[_0x3d70('0xd')](_0x3d70('0xe'))){_0x59a655[_0x3d70('0xf')]=moment()[_0x3d70('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x59a655['changed'](_0x3d70('0x11'))){_0x59a655['publishedAt']=moment()[_0x3d70('0x10')](_0x3d70('0x12'));}_0xf22964(null,_0x59a655);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c7fc145..0bdd3f2 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 _0xc08f=['defaults','localhost','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareProject','SquareProject','raw','where','options','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x502f60,_0x345e6d){var _0x2fe26f=function(_0x41fb8f){while(--_0x41fb8f){_0x502f60['push'](_0x502f60['shift']());}};_0x2fe26f(++_0x345e6d);}(_0xc08f,0x12a));var _0xfc08=function(_0x520d9b,_0x217fc0){_0x520d9b=_0x520d9b-0x0;var _0x34f3f9=_0xc08f[_0x520d9b];return _0x34f3f9;};'use strict';var _=require(_0xfc08('0x0'));var util=require(_0xfc08('0x1'));var moment=require(_0xfc08('0x2'));var BPromise=require(_0xfc08('0x3'));var rs=require(_0xfc08('0x4'));var fs=require('fs');var Redis=require(_0xfc08('0x5'));var db=require(_0xfc08('0x6'))['db'];var utils=require(_0xfc08('0x7'));var logger=require(_0xfc08('0x8'))(_0xfc08('0x9'));var config=require(_0xfc08('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfc08('0xb')][_0xfc08('0xc')]({'port':0x232a});config[_0xfc08('0xd')]=_[_0xfc08('0xe')](config[_0xfc08('0xd')],{'host':_0xfc08('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc08('0xd')]));require(_0xfc08('0x10'))[_0xfc08('0x11')](socket);function respondWithRpcPromise(_0x2b3c01,_0x135b35,_0x563397){return new BPromise(function(_0xd9f98c,_0x39feb4){return client[_0xfc08('0x12')](_0x2b3c01,_0x563397)['then'](function(_0x4717e3){logger[_0xfc08('0x13')](_0xfc08('0x14'),_0x135b35,_0xfc08('0x15'));logger[_0xfc08('0x16')](_0xfc08('0x17'),_0x135b35,_0xfc08('0x15'),JSON['stringify'](_0x4717e3));if(_0x4717e3[_0xfc08('0x18')]){if(_0x4717e3[_0xfc08('0x18')][_0xfc08('0x19')]===0x1f4){logger[_0xfc08('0x18')](_0xfc08('0x14'),_0x135b35,_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);return _0x39feb4(_0x4717e3[_0xfc08('0x18')]['message']);}logger[_0xfc08('0x18')]('SquareProject,\x20%s,\x20%s',_0x135b35,_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);return _0xd9f98c(_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);}else{logger['info'](_0xfc08('0x14'),_0x135b35,'request\x20sent');_0xd9f98c(_0x4717e3[_0xfc08('0x1b')]['message']);}})[_0xfc08('0x1c')](function(_0x5b72b3){logger['error']('SquareProject,\x20%s,\x20%s',_0x135b35,_0x5b72b3);_0x39feb4(_0x5b72b3);});});}exports[_0xfc08('0x1d')]=function(_0x32e582){var _0x121c36=this;return new Promise(function(_0x4e2a97,_0x176125){return db[_0xfc08('0x1e')]['find']({'raw':_0x32e582['options']?_0x32e582['options'][_0xfc08('0x1f')]===undefined?!![]:![]:!![],'where':_0x32e582['options']?_0x32e582['options'][_0xfc08('0x20')]||null:null,'attributes':_0x32e582[_0xfc08('0x21')]?_0x32e582[_0xfc08('0x21')][_0xfc08('0x22')]||null:null,'include':_0x32e582[_0xfc08('0x21')]?_0x32e582['options'][_0xfc08('0x23')]?_['map'](_0x32e582['options']['include'],function(_0x19d647){return{'model':db[_0x19d647[_0xfc08('0x24')]],'as':_0x19d647['as'],'attributes':_0x19d647[_0xfc08('0x22')],'include':_0x19d647['include']?_['map'](_0x19d647[_0xfc08('0x23')],function(_0x505805){return{'model':db[_0x505805[_0xfc08('0x24')]],'as':_0x505805['as'],'attributes':_0x505805['attributes'],'include':_0x505805['include']?_[_0xfc08('0x25')](_0x505805[_0xfc08('0x23')],function(_0x5180aa){return{'model':db[_0x5180aa[_0xfc08('0x24')]],'as':_0x5180aa['as'],'attributes':_0x5180aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc08('0x26')](function(_0x5dc796){logger[_0xfc08('0x13')](_0xfc08('0x1d'),_0x32e582);logger['debug']('ShowSquareProject',_0x32e582,JSON['stringify'](_0x5dc796));_0x4e2a97(_0x5dc796);})[_0xfc08('0x1c')](function(_0x3c76cc){logger[_0xfc08('0x18')](_0xfc08('0x1d'),_0x3c76cc[_0xfc08('0x1a')],_0x32e582);_0x176125(_0x121c36[_0xfc08('0x18')](0x1f4,_0x3c76cc['message']));});});}; \ No newline at end of file +var _0xd68c=['error','code','message','catch','ShowSquareProject','SquareProject','options','raw','attributes','map','include','model','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x83bf26,_0x1fc049){var _0xaf25f8=function(_0x5dd993){while(--_0x5dd993){_0x83bf26['push'](_0x83bf26['shift']());}};_0xaf25f8(++_0x1fc049);}(_0xd68c,0x9c));var _0xcd68=function(_0x293440,_0x357eff){_0x293440=_0x293440-0x0;var _0x596af9=_0xd68c[_0x293440];return _0x596af9;};'use strict';var _=require(_0xcd68('0x0'));var util=require(_0xcd68('0x1'));var moment=require(_0xcd68('0x2'));var BPromise=require(_0xcd68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd68('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd68('0x5'))('rpc');var config=require(_0xcd68('0x6'));var jayson=require(_0xcd68('0x7'));var client=jayson[_0xcd68('0x8')][_0xcd68('0x9')]({'port':0x232a});config[_0xcd68('0xa')]=_[_0xcd68('0xb')](config[_0xcd68('0xa')],{'host':_0xcd68('0xc'),'port':0x18eb});var socket=require(_0xcd68('0xd'))(new Redis(config[_0xcd68('0xa')]));require(_0xcd68('0xe'))[_0xcd68('0xf')](socket);function respondWithRpcPromise(_0x4e5518,_0x5df442,_0x1c8ab7){return new BPromise(function(_0x1b8c40,_0x1f8c4a){return client[_0xcd68('0x10')](_0x4e5518,_0x1c8ab7)[_0xcd68('0x11')](function(_0x2f35ba){logger[_0xcd68('0x12')](_0xcd68('0x13'),_0x5df442,_0xcd68('0x14'));logger[_0xcd68('0x15')](_0xcd68('0x16'),_0x5df442,'request\x20sent',JSON[_0xcd68('0x17')](_0x2f35ba));if(_0x2f35ba[_0xcd68('0x18')]){if(_0x2f35ba[_0xcd68('0x18')][_0xcd68('0x19')]===0x1f4){logger[_0xcd68('0x18')](_0xcd68('0x13'),_0x5df442,_0x2f35ba[_0xcd68('0x18')][_0xcd68('0x1a')]);return _0x1f8c4a(_0x2f35ba[_0xcd68('0x18')][_0xcd68('0x1a')]);}logger[_0xcd68('0x18')](_0xcd68('0x13'),_0x5df442,_0x2f35ba[_0xcd68('0x18')]['message']);return _0x1b8c40(_0x2f35ba[_0xcd68('0x18')][_0xcd68('0x1a')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x5df442,'request\x20sent');_0x1b8c40(_0x2f35ba['result'][_0xcd68('0x1a')]);}})[_0xcd68('0x1b')](function(_0x3b5b1d){logger[_0xcd68('0x18')](_0xcd68('0x13'),_0x5df442,_0x3b5b1d);_0x1f8c4a(_0x3b5b1d);});});}exports[_0xcd68('0x1c')]=function(_0x57488b){var _0xd5f687=this;return new Promise(function(_0x4c7d45,_0x11857b){return db[_0xcd68('0x1d')]['find']({'raw':_0x57488b[_0xcd68('0x1e')]?_0x57488b[_0xcd68('0x1e')][_0xcd68('0x1f')]===undefined?!![]:![]:!![],'where':_0x57488b['options']?_0x57488b[_0xcd68('0x1e')]['where']||null:null,'attributes':_0x57488b['options']?_0x57488b[_0xcd68('0x1e')][_0xcd68('0x20')]||null:null,'include':_0x57488b[_0xcd68('0x1e')]?_0x57488b[_0xcd68('0x1e')]['include']?_[_0xcd68('0x21')](_0x57488b[_0xcd68('0x1e')][_0xcd68('0x22')],function(_0x5ea918){return{'model':db[_0x5ea918['model']],'as':_0x5ea918['as'],'attributes':_0x5ea918[_0xcd68('0x20')],'include':_0x5ea918[_0xcd68('0x22')]?_[_0xcd68('0x21')](_0x5ea918[_0xcd68('0x22')],function(_0x35fc65){return{'model':db[_0x35fc65[_0xcd68('0x23')]],'as':_0x35fc65['as'],'attributes':_0x35fc65[_0xcd68('0x20')],'include':_0x35fc65[_0xcd68('0x22')]?_[_0xcd68('0x21')](_0x35fc65[_0xcd68('0x22')],function(_0x250dc0){return{'model':db[_0x250dc0['model']],'as':_0x250dc0['as'],'attributes':_0x250dc0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55facb){logger[_0xcd68('0x12')](_0xcd68('0x1c'),_0x57488b);logger[_0xcd68('0x15')]('ShowSquareProject',_0x57488b,JSON['stringify'](_0x55facb));_0x4c7d45(_0x55facb);})['catch'](function(_0x16fb24){logger['error'](_0xcd68('0x1c'),_0x16fb24[_0xcd68('0x1a')],_0x57488b);_0x11857b(_0xd5f687[_0xcd68('0x18')](0x1f4,_0x16fb24[_0xcd68('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b158893..e8c195f 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 _0xddb6=['save','update','emit','removeListener','register','./squareProject.events'];(function(_0x3187b0,_0x4cee2a){var _0x12c691=function(_0x25f27c){while(--_0x25f27c){_0x3187b0['push'](_0x3187b0['shift']());}};_0x12c691(++_0x4cee2a);}(_0xddb6,0x89));var _0x6ddb=function(_0xebfde5,_0x3e8236){_0xebfde5=_0xebfde5-0x0;var _0x2a3d41=_0xddb6[_0xebfde5];return _0x2a3d41;};'use strict';var SquareProjectEvents=require(_0x6ddb('0x0'));var events=[_0x6ddb('0x1'),'remove',_0x6ddb('0x2')];function createListener(_0x373110,_0x1a23d6){return function(_0x2c85ef){_0x1a23d6[_0x6ddb('0x3')](_0x373110,_0x2c85ef);};}function removeListener(_0x3f0180,_0x1e1cd1){return function(){SquareProjectEvents[_0x6ddb('0x4')](_0x3f0180,_0x1e1cd1);};}exports[_0x6ddb('0x5')]=function(_0xa911c){for(var _0x476c0f=0x0,_0x1af8ff=events['length'];_0x476c0f<_0x1af8ff;_0x476c0f++){var _0x3bc42c=events[_0x476c0f];var _0x314a91=createListener('squareProject:'+_0x3bc42c,_0xa911c);SquareProjectEvents['on'](_0x3bc42c,_0x314a91);}}; \ No newline at end of file +var _0x933e=['emit','removeListener','squareProject:','./squareProject.events','remove','update'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x933e,0x1d7));var _0xe933=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x933e[_0x4a9fb1];return _0x348672;};'use strict';var SquareProjectEvents=require(_0xe933('0x0'));var events=['save',_0xe933('0x1'),_0xe933('0x2')];function createListener(_0x3d8571,_0x112c9c){return function(_0x1f94e8){_0x112c9c[_0xe933('0x3')](_0x3d8571,_0x1f94e8);};}function removeListener(_0x2be9b7,_0x28bad7){return function(){SquareProjectEvents[_0xe933('0x4')](_0x2be9b7,_0x28bad7);};}exports['register']=function(_0x2f516e){for(var _0x2b5192=0x0,_0x5f4646=events['length'];_0x2b5192<_0x5f4646;_0x2b5192++){var _0x549f0b=events[_0x2b5192];var _0x2bf39a=createListener(_0xe933('0x5')+_0x549f0b,_0x2f516e);SquareProjectEvents['on'](_0x549f0b,_0x2bf39a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d8c5ef2..e09401c 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x85de56,_0x1d9596){var _0x115f55=function(_0x3e3012){while(--_0x3e3012){_0x85de56['push'](_0x85de56['shift']());}};_0x115f55(++_0x1d9596);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x39470f,_0x17b0ea){var _0x4ce974=function(_0x7c52ac){while(--_0x7c52ac){_0x39470f['push'](_0x39470f['shift']());}};_0x4ce974(++_0x17b0ea);}(_0x5fc3,0xa8));var _0x35fc=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0x5fc3[_0xf2f332];return _0x56cce3;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ab8dfb1..ac2d06e 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 _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0xf02b98,_0xb0ee62){var _0x1b9a63=function(_0x261cdd){while(--_0x261cdd){_0xf02b98['push'](_0xf02b98['shift']());}};_0x1b9a63(++_0xb0ee62);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x41b20f,_0x3e1d12){_0x41b20f=_0x41b20f-0x0;var _0x369cb2=_0xd6d6[_0x41b20f];return _0x369cb2;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'callerid':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d6d('0x2')]},'extension':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'dnid':{'type':Sequelize[_0x6d6d('0x2')]},'projectName':{'type':Sequelize[_0x6d6d('0x2')]},'saveName':{'type':Sequelize[_0x6d6d('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x6d6d('0x2')]},'format':{'type':Sequelize[_0x6d6d('0x3')],'get':function(){var _0x44f83d='';var _0x18f824=this[_0x6d6d('0x4')](_0x6d6d('0x5'));if(_0x18f824){_0x44f83d=_0x18f824[_0x6d6d('0x6')](_0x18f824['lastIndexOf']('.'));}return _0x44f83d;}}}; \ No newline at end of file +var _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x49fc24,_0x577335){var _0x1ff47c=function(_0x4b777c){while(--_0x4b777c){_0x49fc24['push'](_0x49fc24['shift']());}};_0x1ff47c(++_0x577335);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 330f452..abd541d 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 _0x7293=['isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message'];(function(_0x52260f,_0x455667){var _0x27ac6b=function(_0x57995a){while(--_0x57995a){_0x52260f['push'](_0x52260f['shift']());}};_0x27ac6b(++_0x455667);}(_0x7293,0x1c9));var _0x3729=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7293[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x3729('0x0'));var rimraf=require(_0x3729('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3729('0x2'));var rp=require(_0x3729('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3729('0x4'));var util=require(_0x3729('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3729('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3729('0x7'));var _=require(_0x3729('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3729('0x9'));var deskjs=require(_0x3729('0xa'));var toCsv=require(_0x3729('0x6'));var querystring=require(_0x3729('0xb'));var Papa=require('papaparse');var Redis=require(_0x3729('0xc'));var authService=require(_0x3729('0xd'));var qs=require(_0x3729('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3729('0xf'));var logger=require(_0x3729('0x10'))(_0x3729('0x11'));var utils=require(_0x3729('0x12'));var config=require(_0x3729('0x13'));var licenseUtil=require(_0x3729('0x14'));var db=require(_0x3729('0x15'))['db'];function respondWithStatusCode(_0x4231ba,_0x4d0781){_0x4d0781=_0x4d0781||0xcc;return function(_0x1738cf){if(_0x1738cf){return _0x4231ba[_0x3729('0x16')](_0x4d0781);}return _0x4231ba[_0x3729('0x17')](_0x4d0781)[_0x3729('0x18')]();};}function respondWithResult(_0x19c461,_0x45daed){_0x45daed=_0x45daed||0xc8;return function(_0x14eebd){if(_0x14eebd){return _0x19c461[_0x3729('0x17')](_0x45daed)[_0x3729('0x19')](_0x14eebd);}};}function respondWithFilteredResult(_0x97e622,_0x3ce2f5){return function(_0x3f30dd){if(_0x3f30dd){var _0x4fef3b=typeof _0x3ce2f5[_0x3729('0x1a')]===_0x3729('0x1b')&&typeof _0x3ce2f5[_0x3729('0x1c')]===_0x3729('0x1b');var _0x31ac92=_0x3f30dd[_0x3729('0x1d')];var _0x588e63=_0x4fef3b?0x0:_0x3ce2f5[_0x3729('0x1a')];var _0x8aa64d=_0x4fef3b?_0x3f30dd[_0x3729('0x1d')]:_0x3ce2f5[_0x3729('0x1a')]+_0x3ce2f5[_0x3729('0x1c')];var _0x3718fb;if(_0x8aa64d>=_0x31ac92){_0x8aa64d=_0x31ac92;_0x3718fb=0xc8;}else{_0x3718fb=0xce;}_0x97e622[_0x3729('0x17')](_0x3718fb);return _0x97e622['set'](_0x3729('0x1e'),_0x588e63+'-'+_0x8aa64d+'/'+_0x31ac92)['json'](_0x3f30dd);}return null;};}function patchUpdates(_0x3fa8e7){return function(_0x49b1a8){try{jsonpatch[_0x3729('0x1f')](_0x49b1a8,_0x3fa8e7,!![]);}catch(_0x4332b1){return BPromise[_0x3729('0x20')](_0x4332b1);}return _0x49b1a8['save']();};}function saveUpdates(_0x36af64,_0x54821c){return function(_0x2585dc){if(_0x2585dc){return _0x2585dc[_0x3729('0x21')](_0x36af64)['then'](function(_0x5e3072){return _0x5e3072;});}return null;};}function removeEntity(_0xcb8eb8,_0x485bb3){return function(_0x26054c){if(_0x26054c){return _0x26054c[_0x3729('0x22')]()[_0x3729('0x23')](function(){_0xcb8eb8[_0x3729('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8c6c,_0x571d6f){return function(_0xee6b69){if(!_0xee6b69){_0x3c8c6c[_0x3729('0x16')](0x194);}return _0xee6b69;};}function handleError(_0xb2b757,_0x4c2167){_0x4c2167=_0x4c2167||0x1f4;return function(_0x2e2593){logger[_0x3729('0x24')](_0x2e2593['stack']);if(_0x2e2593[_0x3729('0x25')]){delete _0x2e2593[_0x3729('0x25')];}_0xb2b757['status'](_0x4c2167)[_0x3729('0x26')](_0x2e2593);};}exports[_0x3729('0x27')]=function(_0x403c93,_0x5a2548){var _0x543b4f={},_0x29f1dc={},_0x29e87d={'count':0x0,'rows':[]};var _0x2a54c5=_[_0x3729('0x28')](db[_0x3729('0x29')][_0x3729('0x2a')],function(_0x587cc7){return{'name':_0x587cc7[_0x3729('0x2b')],'type':_0x587cc7[_0x3729('0x2c')]['key']};});_0x29f1dc[_0x3729('0x2d')]=_[_0x3729('0x28')](_0x2a54c5,_0x3729('0x25'));_0x29f1dc['query']=_['keys'](_0x403c93[_0x3729('0x2e')]);_0x29f1dc[_0x3729('0x2f')]=_[_0x3729('0x30')](_0x29f1dc[_0x3729('0x2d')],_0x29f1dc[_0x3729('0x2e')]);_0x543b4f[_0x3729('0x31')]=_[_0x3729('0x30')](_0x29f1dc['model'],qs['fields'](_0x403c93[_0x3729('0x2e')][_0x3729('0x32')]));_0x543b4f[_0x3729('0x31')]=_0x543b4f[_0x3729('0x31')][_0x3729('0x33')]?_0x543b4f[_0x3729('0x31')]:_0x29f1dc[_0x3729('0x2d')];if(!_0x403c93[_0x3729('0x2e')][_0x3729('0x34')](_0x3729('0x35'))){_0x543b4f[_0x3729('0x1c')]=qs[_0x3729('0x1c')](_0x403c93[_0x3729('0x2e')]['limit']);_0x543b4f['offset']=qs['offset'](_0x403c93['query']['offset']);}_0x543b4f[_0x3729('0x36')]=qs[_0x3729('0x37')](_0x403c93[_0x3729('0x2e')]['sort']);_0x543b4f[_0x3729('0x38')]=qs['filters'](_['pick'](_0x403c93[_0x3729('0x2e')],_0x29f1dc[_0x3729('0x2f')]),_0x2a54c5);if(_0x403c93[_0x3729('0x2e')]['filter']){_0x543b4f[_0x3729('0x38')]=_[_0x3729('0x39')](_0x543b4f[_0x3729('0x38')],{'$or':_['map'](_0x2a54c5,function(_0x3aa86c){if(_0x3aa86c['type']!==_0x3729('0x3a')){var _0x58e4c1={};_0x58e4c1[_0x3aa86c[_0x3729('0x25')]]={'$like':'%'+_0x403c93[_0x3729('0x2e')][_0x3729('0x3b')]+'%'};return _0x58e4c1;}})});}_0x543b4f=_[_0x3729('0x39')]({},_0x543b4f,_0x403c93[_0x3729('0x3c')]);var _0x3d2b20={'where':_0x543b4f[_0x3729('0x38')]};return db[_0x3729('0x29')]['count'](_0x3d2b20)['then'](function(_0x3efc7d){_0x29e87d[_0x3729('0x1d')]=_0x3efc7d;if(_0x403c93[_0x3729('0x2e')][_0x3729('0x3d')]){_0x543b4f['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x543b4f);})[_0x3729('0x23')](function(_0x2d2d27){_0x29e87d[_0x3729('0x3e')]=_0x2d2d27;return _0x29e87d;})[_0x3729('0x23')](respondWithFilteredResult(_0x5a2548,_0x543b4f))['catch'](handleError(_0x5a2548,null));};exports[_0x3729('0x3f')]=function(_0x317394,_0x31f11d){var _0x26dbee={'raw':!![],'where':{'id':_0x317394[_0x3729('0x40')]['id']}},_0x466ec1={};_0x466ec1[_0x3729('0x2d')]=_['keys'](db[_0x3729('0x29')][_0x3729('0x2a')]);_0x466ec1[_0x3729('0x2e')]=_['keys'](_0x317394[_0x3729('0x2e')]);_0x466ec1[_0x3729('0x2f')]=_[_0x3729('0x30')](_0x466ec1[_0x3729('0x2d')],_0x466ec1[_0x3729('0x2e')]);_0x26dbee['attributes']=_['intersection'](_0x466ec1['model'],qs[_0x3729('0x32')](_0x317394[_0x3729('0x2e')][_0x3729('0x32')]));_0x26dbee['attributes']=_0x26dbee[_0x3729('0x31')][_0x3729('0x33')]?_0x26dbee[_0x3729('0x31')]:_0x466ec1['model'];if(_0x317394['query']['includeAll']){_0x26dbee[_0x3729('0x41')]=[{'all':!![]}];}_0x26dbee=_[_0x3729('0x39')]({},_0x26dbee,_0x317394[_0x3729('0x3c')]);return db['SquareRecording'][_0x3729('0x42')](_0x26dbee)['then'](handleEntityNotFound(_0x31f11d,null))[_0x3729('0x23')](respondWithResult(_0x31f11d,null))[_0x3729('0x43')](handleError(_0x31f11d,null));};exports[_0x3729('0x44')]=function(_0xa60d3d,_0x2b2b98){return db[_0x3729('0x29')][_0x3729('0x44')](_0xa60d3d[_0x3729('0x45')],{})[_0x3729('0x23')](respondWithResult(_0x2b2b98,0xc9))[_0x3729('0x43')](handleError(_0x2b2b98,null));};exports[_0x3729('0x21')]=function(_0x43621e,_0x57bd93){if(_0x43621e[_0x3729('0x45')]['id']){delete _0x43621e[_0x3729('0x45')]['id'];}return db[_0x3729('0x29')][_0x3729('0x42')]({'where':{'id':_0x43621e['params']['id']}})[_0x3729('0x23')](handleEntityNotFound(_0x57bd93,null))['then'](saveUpdates(_0x43621e[_0x3729('0x45')],null))[_0x3729('0x23')](respondWithResult(_0x57bd93,null))[_0x3729('0x43')](handleError(_0x57bd93,null));};exports[_0x3729('0x46')]=function(_0x31574e,_0x54ff93,_0x350fde){var _0x3c35e6=require(_0x3729('0x47'));var _0x4329d1=![];var _0x5ab113={};if(_0x31574e[_0x3729('0x2e')]['type']&&_0x31574e[_0x3729('0x2e')]['type']===_0x3729('0x48')){_0x5ab113[_0x3729('0x48')]=_0x31574e['params']['id'];}else{_0x5ab113['id']=_0x31574e['params']['id'];}return db[_0x3729('0x29')][_0x3729('0x42')]({'where':_0x5ab113,'attributes':['id','savePath',_0x3729('0x49')],'raw':!![]})[_0x3729('0x23')](handleEntityNotFound(_0x54ff93,null))['then'](function(_0x3d99a8){if(_0x3d99a8){var _0x4dc435=_0x3d99a8[_0x3729('0x4a')];var _0x43ed5f=util[_0x3729('0x4b')]('%s.cypher',_0x4dc435);if(fs[_0x3729('0x4c')](_0x43ed5f)){_0x4329d1=!![];return _0x3c35e6['decryptFile'](_0x43ed5f,_0x4dc435,config[_0x3729('0x4d')][_0x3729('0x4e')])[_0x3729('0x23')](function(){return _0x3d99a8;});}return _0x3d99a8;}})[_0x3729('0x23')](function(_0x24cc57){if(_0x24cc57){var _0x12a4e0=_0x24cc57[_0x3729('0x4a')];if(!fs['existsSync'](_0x12a4e0)){throw new db['Sequelize'][(_0x3729('0x4f'))](_0x3729('0x50'));}if(_0x24cc57[_0x3729('0x49')]){return _0x54ff93[_0x3729('0x46')](_0x12a4e0,_0x24cc57[_0x3729('0x49')]+path['extname'](_0x12a4e0),function(){if(_0x4329d1){fs[_0x3729('0x51')](_0x12a4e0);}});}else{return _0x54ff93[_0x3729('0x46')](_0x12a4e0,function(_0x3b0b6c){if(_0x4329d1){fs[_0x3729('0x51')](_0x12a4e0);}});}}})['catch'](function(_0x2be4c2){if(_0x2be4c2[_0x3729('0x52')]==='SquareRecording\x20not\x20found'){_0x54ff93['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x54ff93,null);}});};exports[_0x3729('0x22')]=function(_0x4c5798,_0xc588d1){return db['SquareRecording'][_0x3729('0x42')]({'where':{'id':_0x4c5798[_0x3729('0x40')]['id']}})[_0x3729('0x23')](function(_0x1510ae){if(_[_0x3729('0x53')](_0x1510ae)){throw new ReferenceError(_0x3729('0x54'));}return _0x1510ae;})[_0x3729('0x23')](function(_0x429ac4){var _0x1490b9=_0x429ac4[_0x3729('0x4a')];logger[_0x3729('0x55')](_0x3729('0x56'),_0x1490b9);if(!_['isNil'](_0x429ac4[_0x3729('0x4a')])&&fs['existsSync'](_0x1490b9)){logger[_0x3729('0x55')]('File:\x20\x22'+_0x1490b9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3729('0x57')](_0x1490b9);}_0x1490b9=_0x1490b9+_0x3729('0x58');if(!_['isNil'](_0x429ac4['savePath'])&&fs[_0x3729('0x4c')](_0x1490b9)){logger[_0x3729('0x55')]('File:\x20\x22'+_0x1490b9+_0x3729('0x59'));fs[_0x3729('0x57')](_0x1490b9);}return _0x429ac4;})[_0x3729('0x23')](function(_0x342431){if(!_0x342431)throw new InternalError();return _0x342431['destroy']();})['then'](function(){_0xc588d1[_0x3729('0x17')](0xcc)[_0x3729('0x18')]();})[_0x3729('0x43')](handleError(_0xc588d1,null));}; \ No newline at end of file +var _0x2564=['mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','then','params','keys','intersection','length','include','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','request-promise','moment'];(function(_0x22e9fb,_0x3919c1){var _0x4bc6b8=function(_0x52f457){while(--_0x52f457){_0x22e9fb['push'](_0x22e9fb['shift']());}};_0x4bc6b8(++_0x3919c1);}(_0x2564,0x189));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4256('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4256('0x1'));var moment=require(_0x4256('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4256('0x3'));var util=require(_0x4256('0x4'));var path=require(_0x4256('0x5'));var sox=require(_0x4256('0x6'));var csv=require('to-csv');var ejs=require(_0x4256('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4256('0x8'));var squel=require(_0x4256('0x9'));var crypto=require(_0x4256('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4256('0xb'));var toCsv=require(_0x4256('0xc'));var querystring=require(_0x4256('0xd'));var Papa=require(_0x4256('0xe'));var Redis=require(_0x4256('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4256('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4256('0x11'));var logger=require(_0x4256('0x12'))(_0x4256('0x13'));var utils=require(_0x4256('0x14'));var config=require(_0x4256('0x15'));var licenseUtil=require(_0x4256('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba64d,_0x3aa894){_0x3aa894=_0x3aa894||0xcc;return function(_0x5ef32e){if(_0x5ef32e){return _0x5ba64d[_0x4256('0x17')](_0x3aa894);}return _0x5ba64d['status'](_0x3aa894)[_0x4256('0x18')]();};}function respondWithResult(_0x420350,_0x114f18){_0x114f18=_0x114f18||0xc8;return function(_0x18bee8){if(_0x18bee8){return _0x420350[_0x4256('0x19')](_0x114f18)[_0x4256('0x1a')](_0x18bee8);}};}function respondWithFilteredResult(_0x585bc6,_0x242b5e){return function(_0x24553b){if(_0x24553b){var _0x589144=typeof _0x242b5e[_0x4256('0x1b')]===_0x4256('0x1c')&&typeof _0x242b5e['limit']==='undefined';var _0x2dcb45=_0x24553b[_0x4256('0x1d')];var _0x1f4b07=_0x589144?0x0:_0x242b5e['offset'];var _0x210ba9=_0x589144?_0x24553b[_0x4256('0x1d')]:_0x242b5e[_0x4256('0x1b')]+_0x242b5e['limit'];var _0x3abd7d;if(_0x210ba9>=_0x2dcb45){_0x210ba9=_0x2dcb45;_0x3abd7d=0xc8;}else{_0x3abd7d=0xce;}_0x585bc6[_0x4256('0x19')](_0x3abd7d);return _0x585bc6[_0x4256('0x1e')](_0x4256('0x1f'),_0x1f4b07+'-'+_0x210ba9+'/'+_0x2dcb45)['json'](_0x24553b);}return null;};}function patchUpdates(_0x4b63ba){return function(_0x246b6a){try{jsonpatch[_0x4256('0x20')](_0x246b6a,_0x4b63ba,!![]);}catch(_0x1c1ddc){return BPromise[_0x4256('0x21')](_0x1c1ddc);}return _0x246b6a[_0x4256('0x22')]();};}function saveUpdates(_0x4f171b,_0x201a3b){return function(_0x46c5e5){if(_0x46c5e5){return _0x46c5e5[_0x4256('0x23')](_0x4f171b)['then'](function(_0x26a231){return _0x26a231;});}return null;};}function removeEntity(_0x1a9b15,_0x34b04d){return function(_0xe897d){if(_0xe897d){return _0xe897d['destroy']()['then'](function(){_0x1a9b15[_0x4256('0x19')](0xcc)[_0x4256('0x18')]();});}};}function handleEntityNotFound(_0x313421,_0x3b9f27){return function(_0x22bad9){if(!_0x22bad9){_0x313421[_0x4256('0x17')](0x194);}return _0x22bad9;};}function handleError(_0x2a6ac9,_0x26a2f1){_0x26a2f1=_0x26a2f1||0x1f4;return function(_0x283a16){logger[_0x4256('0x24')](_0x283a16[_0x4256('0x25')]);if(_0x283a16[_0x4256('0x26')]){delete _0x283a16[_0x4256('0x26')];}_0x2a6ac9[_0x4256('0x19')](_0x26a2f1)[_0x4256('0x27')](_0x283a16);};}exports[_0x4256('0x28')]=function(_0xd5dc70,_0x122103){var _0x23c30b={},_0x263975={},_0x4e8a4e={'count':0x0,'rows':[]};var _0x45716f=_[_0x4256('0x29')](db[_0x4256('0x2a')][_0x4256('0x2b')],function(_0x41791d){return{'name':_0x41791d[_0x4256('0x2c')],'type':_0x41791d[_0x4256('0x2d')][_0x4256('0x2e')]};});_0x263975[_0x4256('0x2f')]=_[_0x4256('0x29')](_0x45716f,_0x4256('0x26'));_0x263975['query']=_['keys'](_0xd5dc70[_0x4256('0x30')]);_0x263975[_0x4256('0x31')]=_['intersection'](_0x263975[_0x4256('0x2f')],_0x263975[_0x4256('0x30')]);_0x23c30b[_0x4256('0x32')]=_['intersection'](_0x263975[_0x4256('0x2f')],qs[_0x4256('0x33')](_0xd5dc70[_0x4256('0x30')][_0x4256('0x33')]));_0x23c30b[_0x4256('0x32')]=_0x23c30b[_0x4256('0x32')]['length']?_0x23c30b['attributes']:_0x263975['model'];if(!_0xd5dc70[_0x4256('0x30')][_0x4256('0x34')]('nolimit')){_0x23c30b[_0x4256('0x35')]=qs[_0x4256('0x35')](_0xd5dc70[_0x4256('0x30')][_0x4256('0x35')]);_0x23c30b[_0x4256('0x1b')]=qs[_0x4256('0x1b')](_0xd5dc70[_0x4256('0x30')][_0x4256('0x1b')]);}_0x23c30b['order']=qs[_0x4256('0x36')](_0xd5dc70[_0x4256('0x30')][_0x4256('0x36')]);_0x23c30b[_0x4256('0x37')]=qs[_0x4256('0x31')](_[_0x4256('0x38')](_0xd5dc70['query'],_0x263975['filters']),_0x45716f);if(_0xd5dc70[_0x4256('0x30')]['filter']){_0x23c30b['where']=_[_0x4256('0x39')](_0x23c30b[_0x4256('0x37')],{'$or':_[_0x4256('0x29')](_0x45716f,function(_0x11d961){if(_0x11d961[_0x4256('0x2d')]!==_0x4256('0x3a')){var _0x5a7ca5={};_0x5a7ca5[_0x11d961[_0x4256('0x26')]]={'$like':'%'+_0xd5dc70[_0x4256('0x30')][_0x4256('0x3b')]+'%'};return _0x5a7ca5;}})});}_0x23c30b=_['merge']({},_0x23c30b,_0xd5dc70[_0x4256('0x3c')]);var _0x52aadb={'where':_0x23c30b[_0x4256('0x37')]};return db[_0x4256('0x2a')][_0x4256('0x1d')](_0x52aadb)['then'](function(_0x2c23e7){_0x4e8a4e[_0x4256('0x1d')]=_0x2c23e7;if(_0xd5dc70[_0x4256('0x30')][_0x4256('0x3d')]){_0x23c30b['include']=[{'all':!![]}];}return db['SquareRecording'][_0x4256('0x3e')](_0x23c30b);})['then'](function(_0x3da460){_0x4e8a4e[_0x4256('0x3f')]=_0x3da460;return _0x4e8a4e;})[_0x4256('0x40')](respondWithFilteredResult(_0x122103,_0x23c30b))['catch'](handleError(_0x122103,null));};exports['show']=function(_0x3a2c9c,_0x49e328){var _0xd36d0={'raw':!![],'where':{'id':_0x3a2c9c[_0x4256('0x41')]['id']}},_0x290125={};_0x290125['model']=_[_0x4256('0x42')](db['SquareRecording'][_0x4256('0x2b')]);_0x290125[_0x4256('0x30')]=_[_0x4256('0x42')](_0x3a2c9c['query']);_0x290125['filters']=_[_0x4256('0x43')](_0x290125[_0x4256('0x2f')],_0x290125[_0x4256('0x30')]);_0xd36d0[_0x4256('0x32')]=_[_0x4256('0x43')](_0x290125[_0x4256('0x2f')],qs[_0x4256('0x33')](_0x3a2c9c[_0x4256('0x30')]['fields']));_0xd36d0[_0x4256('0x32')]=_0xd36d0[_0x4256('0x32')][_0x4256('0x44')]?_0xd36d0[_0x4256('0x32')]:_0x290125[_0x4256('0x2f')];if(_0x3a2c9c[_0x4256('0x30')]['includeAll']){_0xd36d0[_0x4256('0x45')]=[{'all':!![]}];}_0xd36d0=_[_0x4256('0x39')]({},_0xd36d0,_0x3a2c9c[_0x4256('0x3c')]);return db[_0x4256('0x2a')][_0x4256('0x46')](_0xd36d0)[_0x4256('0x40')](handleEntityNotFound(_0x49e328,null))[_0x4256('0x40')](respondWithResult(_0x49e328,null))[_0x4256('0x47')](handleError(_0x49e328,null));};exports[_0x4256('0x48')]=function(_0x24a3f0,_0x27ff56){return db[_0x4256('0x2a')][_0x4256('0x48')](_0x24a3f0[_0x4256('0x49')],{})[_0x4256('0x40')](respondWithResult(_0x27ff56,0xc9))[_0x4256('0x47')](handleError(_0x27ff56,null));};exports['update']=function(_0x1fb9ad,_0x436b11){if(_0x1fb9ad['body']['id']){delete _0x1fb9ad[_0x4256('0x49')]['id'];}return db[_0x4256('0x2a')][_0x4256('0x46')]({'where':{'id':_0x1fb9ad[_0x4256('0x41')]['id']}})[_0x4256('0x40')](handleEntityNotFound(_0x436b11,null))['then'](saveUpdates(_0x1fb9ad[_0x4256('0x49')],null))[_0x4256('0x40')](respondWithResult(_0x436b11,null))[_0x4256('0x47')](handleError(_0x436b11,null));};exports['download']=function(_0x432a76,_0x26f683,_0x59f2d3){var _0x3efb4b=require(_0x4256('0x4a'));var _0x477719=![];var _0x3677a3={};if(_0x432a76[_0x4256('0x30')][_0x4256('0x2d')]&&_0x432a76[_0x4256('0x30')][_0x4256('0x2d')]==='uniqueid'){_0x3677a3[_0x4256('0x4b')]=_0x432a76[_0x4256('0x41')]['id'];}else{_0x3677a3['id']=_0x432a76[_0x4256('0x41')]['id'];}return db[_0x4256('0x2a')][_0x4256('0x46')]({'where':_0x3677a3,'attributes':['id',_0x4256('0x4c'),_0x4256('0x4d')],'raw':!![]})[_0x4256('0x40')](handleEntityNotFound(_0x26f683,null))[_0x4256('0x40')](function(_0x5ac936){if(_0x5ac936){var _0x15c72e=_0x5ac936[_0x4256('0x4c')];var _0x51d7c7=util[_0x4256('0x4e')](_0x4256('0x4f'),_0x15c72e);if(fs[_0x4256('0x50')](_0x51d7c7)){_0x477719=!![];return _0x3efb4b[_0x4256('0x51')](_0x51d7c7,_0x15c72e,config[_0x4256('0x52')][_0x4256('0x53')])[_0x4256('0x40')](function(){return _0x5ac936;});}return _0x5ac936;}})['then'](function(_0x1f1550){if(_0x1f1550){var _0x2ee5eb=_0x1f1550['savePath'];if(!fs[_0x4256('0x50')](_0x2ee5eb)){throw new db[(_0x4256('0x54'))][(_0x4256('0x55'))](_0x4256('0x56'));}if(_0x1f1550['filename']){return _0x26f683[_0x4256('0x57')](_0x2ee5eb,_0x1f1550['filename']+path[_0x4256('0x58')](_0x2ee5eb),function(){if(_0x477719){fs[_0x4256('0x59')](_0x2ee5eb);}});}else{return _0x26f683['download'](_0x2ee5eb,function(_0x2a9158){if(_0x477719){fs[_0x4256('0x59')](_0x2ee5eb);}});}}})[_0x4256('0x47')](function(_0x3a10f5){if(_0x3a10f5[_0x4256('0x5a')]===_0x4256('0x56')){_0x26f683[_0x4256('0x19')](0x194)[_0x4256('0x27')]('Not\x20found');}else{return handleError(_0x26f683,null);}});};exports[_0x4256('0x5b')]=function(_0x37518a,_0x475232){return db[_0x4256('0x2a')][_0x4256('0x46')]({'where':{'id':_0x37518a['params']['id']}})[_0x4256('0x40')](function(_0x39b495){if(_[_0x4256('0x5c')](_0x39b495)){throw new ReferenceError('Entity\x20not\x20found');}return _0x39b495;})[_0x4256('0x40')](function(_0x176b91){var _0x46b7ac=_0x176b91[_0x4256('0x4c')];logger[_0x4256('0x5d')](_0x4256('0x5e'),_0x46b7ac);if(!_[_0x4256('0x5c')](_0x176b91[_0x4256('0x4c')])&&fs[_0x4256('0x50')](_0x46b7ac)){logger[_0x4256('0x5d')]('File:\x20\x22'+_0x46b7ac+_0x4256('0x5f'));fs[_0x4256('0x60')](_0x46b7ac);}_0x46b7ac=_0x46b7ac+_0x4256('0x61');if(!_['isNil'](_0x176b91[_0x4256('0x4c')])&&fs[_0x4256('0x50')](_0x46b7ac)){logger['info'](_0x4256('0x62')+_0x46b7ac+_0x4256('0x5f'));fs[_0x4256('0x60')](_0x46b7ac);}return _0x176b91;})['then'](function(_0x5d5064){if(!_0x5d5064)throw new InternalError();return _0x5d5064[_0x4256('0x5b')]();})['then'](function(){_0x475232[_0x4256('0x19')](0xcc)[_0x4256('0x18')]();})[_0x4256('0x47')](handleError(_0x475232,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d3394bd..3c582be 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 _0x55c1=['rimraf','../../config/environment','exports','SquareRecording','square_recordings','lodash','util','bluebird','request-promise','path'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0x55c1,0x1e5));var _0x155c=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x55c1[_0x4a73f2];return _0x4190ee;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x155c('0x2'));var rp=require(_0x155c('0x3'));var fs=require('fs');var path=require(_0x155c('0x4'));var rimraf=require(_0x155c('0x5'));var config=require(_0x155c('0x6'));var attributes=require('./squareRecording.attributes');module[_0x155c('0x7')]=function(_0x55a3ae,_0x1b30c6){return _0x55a3ae['define'](_0x155c('0x8'),attributes,{'tableName':_0x155c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc359=['square_recordings','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0xe5b3e1,_0x57a645){var _0x121dad=function(_0x3aa300){while(--_0x3aa300){_0xe5b3e1['push'](_0xe5b3e1['shift']());}};_0x121dad(++_0x57a645);}(_0xc359,0x1d9));var _0x9c35=function(_0x358fb5,_0x4407b8){_0x358fb5=_0x358fb5-0x0;var _0x4abfeb=_0xc359[_0x358fb5];return _0x4abfeb;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./squareRecording.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('SquareRecording',attributes,{'tableName':_0x9c35('0x7'),'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 bc0c335..361ea06 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 _0xf33c=['SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','options','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x53788f,_0x225e11){var _0x35d60d=function(_0x594f92){while(--_0x594f92){_0x53788f['push'](_0x53788f['shift']());}};_0x35d60d(++_0x225e11);}(_0xf33c,0x193));var _0xcf33=function(_0x31e753,_0x18503f){_0x31e753=_0x31e753-0x0;var _0x40feaa=_0xf33c[_0x31e753];return _0x40feaa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcf33('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf33('0x1'));var db=require(_0xcf33('0x2'))['db'];var utils=require(_0xcf33('0x3'));var logger=require(_0xcf33('0x4'))(_0xcf33('0x5'));var config=require(_0xcf33('0x6'));var jayson=require(_0xcf33('0x7'));var client=jayson[_0xcf33('0x8')][_0xcf33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0df4,_0x167d54,_0x2920e2){return new BPromise(function(_0x293f63,_0x3784d1){return client[_0xcf33('0xa')](_0x5c0df4,_0x2920e2)[_0xcf33('0xb')](function(_0x1429c4){logger['info']('SquareRecording,\x20%s,\x20%s',_0x167d54,'request\x20sent');logger[_0xcf33('0xc')](_0xcf33('0xd'),_0x167d54,'request\x20sent',JSON['stringify'](_0x1429c4));if(_0x1429c4[_0xcf33('0xe')]){if(_0x1429c4[_0xcf33('0xe')][_0xcf33('0xf')]===0x1f4){logger['error'](_0xcf33('0x10'),_0x167d54,_0x1429c4['error'][_0xcf33('0x11')]);return _0x3784d1(_0x1429c4[_0xcf33('0xe')][_0xcf33('0x11')]);}logger[_0xcf33('0xe')](_0xcf33('0x10'),_0x167d54,_0x1429c4[_0xcf33('0xe')][_0xcf33('0x11')]);return _0x293f63(_0x1429c4['error']['message']);}else{logger[_0xcf33('0x12')](_0xcf33('0x10'),_0x167d54,_0xcf33('0x13'));_0x293f63(_0x1429c4[_0xcf33('0x14')][_0xcf33('0x11')]);}})[_0xcf33('0x15')](function(_0x493bcc){logger[_0xcf33('0xe')](_0xcf33('0x10'),_0x167d54,_0x493bcc);_0x3784d1(_0x493bcc);});});}exports[_0xcf33('0x16')]=function(_0x2dc858){var _0x3fa6c9=this;return new Promise(function(_0x50ca18,_0xa7de7e){return db[_0xcf33('0x17')][_0xcf33('0x18')](_0x2dc858['body'],{'raw':_0x2dc858['options']?_0x2dc858[_0xcf33('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xcf33('0xb')](function(_0x2e1f83){logger['info'](_0xcf33('0x16'),_0x2dc858);logger['debug'](_0xcf33('0x16'),_0x2dc858,JSON['stringify'](_0x2e1f83));_0x50ca18(_0x2e1f83);})['catch'](function(_0x495ce9){logger[_0xcf33('0xe')](_0xcf33('0x16'),_0x495ce9[_0xcf33('0x11')],_0x2dc858);_0xa7de7e(_0x3fa6c9[_0xcf33('0xe')](0x1f4,_0x495ce9[_0xcf33('0x11')]));});});}; \ No newline at end of file +var _0xfd33=['ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SquareRecording','body','CreateSquareRecording','lodash','util','moment','bluebird','randomstring'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0xfd33,0x154));var _0x3fd3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xfd33[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x3fd3('0x0'));var util=require(_0x3fd3('0x1'));var moment=require(_0x3fd3('0x2'));var BPromise=require(_0x3fd3('0x3'));var rs=require(_0x3fd3('0x4'));var fs=require('fs');var Redis=require(_0x3fd3('0x5'));var db=require(_0x3fd3('0x6'))['db'];var utils=require(_0x3fd3('0x7'));var logger=require('../../config/logger')(_0x3fd3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3fd3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad1fa,_0x5d1e01,_0x5709e6){return new BPromise(function(_0x4580c6,_0x9c5e43){return client['request'](_0x3ad1fa,_0x5709e6)[_0x3fd3('0xa')](function(_0x17f5bb){logger[_0x3fd3('0xb')](_0x3fd3('0xc'),_0x5d1e01,_0x3fd3('0xd'));logger[_0x3fd3('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5d1e01,_0x3fd3('0xd'),JSON[_0x3fd3('0xf')](_0x17f5bb));if(_0x17f5bb[_0x3fd3('0x10')]){if(_0x17f5bb[_0x3fd3('0x10')][_0x3fd3('0x11')]===0x1f4){logger['error'](_0x3fd3('0xc'),_0x5d1e01,_0x17f5bb[_0x3fd3('0x10')][_0x3fd3('0x12')]);return _0x9c5e43(_0x17f5bb[_0x3fd3('0x10')][_0x3fd3('0x12')]);}logger[_0x3fd3('0x10')]('SquareRecording,\x20%s,\x20%s',_0x5d1e01,_0x17f5bb[_0x3fd3('0x10')][_0x3fd3('0x12')]);return _0x4580c6(_0x17f5bb[_0x3fd3('0x10')][_0x3fd3('0x12')]);}else{logger[_0x3fd3('0xb')](_0x3fd3('0xc'),_0x5d1e01,_0x3fd3('0xd'));_0x4580c6(_0x17f5bb['result'][_0x3fd3('0x12')]);}})[_0x3fd3('0x13')](function(_0x5333e4){logger['error'](_0x3fd3('0xc'),_0x5d1e01,_0x5333e4);_0x9c5e43(_0x5333e4);});});}exports['CreateSquareRecording']=function(_0x44c080){var _0xb20751=this;return new Promise(function(_0x25fa2f,_0x4413c8){return db[_0x3fd3('0x14')]['create'](_0x44c080[_0x3fd3('0x15')],{'raw':_0x44c080['options']?_0x44c080['options']['raw']===undefined?!![]:![]:!![]})[_0x3fd3('0xa')](function(_0x5ade16){logger['info']('CreateSquareRecording',_0x44c080);logger[_0x3fd3('0xe')]('CreateSquareRecording',_0x44c080,JSON[_0x3fd3('0xf')](_0x5ade16));_0x25fa2f(_0x5ade16);})[_0x3fd3('0x13')](function(_0x186416){logger[_0x3fd3('0x10')](_0x3fd3('0x16'),_0x186416[_0x3fd3('0x12')],_0x44c080);_0x4413c8(_0xb20751['error'](0x1f4,_0x186416[_0x3fd3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index dded9da..f60201b 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1dfcf9,_0x2a88f8){var _0x39676a=function(_0x245463){while(--_0x245463){_0x1dfcf9['push'](_0x1dfcf9['shift']());}};_0x39676a(++_0x2a88f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x5379f9,_0x561c18){var _0x6d70d5=function(_0x3ceb71){while(--_0x3ceb71){_0x5379f9['push'](_0x5379f9['shift']());}};_0x6d70d5(++_0x561c18);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['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 6a6307c..959051c 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 _0x6876=['DATE','sequelize','exports','STRING'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x6876,0x10d));var _0x6687=function(_0x295b61,_0x20b436){_0x295b61=_0x295b61-0x0;var _0x2d9519=_0x6876[_0x295b61];return _0x2d9519;};'use strict';var Sequelize=require(_0x6687('0x0'));module[_0x6687('0x1')]={'network':{'type':Sequelize[_0x6687('0x2')]},'network_script':{'type':Sequelize[_0x6687('0x2')]},'request':{'type':Sequelize[_0x6687('0x2')]},'channel':{'type':Sequelize[_0x6687('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6687('0x2')]},'uniqueid':{'type':Sequelize[_0x6687('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6687('0x2')]},'calleridname':{'type':Sequelize[_0x6687('0x2')]},'callingpres':{'type':Sequelize[_0x6687('0x2')]},'callingani2':{'type':Sequelize[_0x6687('0x2')]},'callington':{'type':Sequelize[_0x6687('0x2')]},'callingtns':{'type':Sequelize[_0x6687('0x2')]},'dnid':{'type':Sequelize[_0x6687('0x2')]},'rdnis':{'type':Sequelize[_0x6687('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6687('0x2')]},'priority':{'type':Sequelize[_0x6687('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x6687('0x2')]},'project_name':{'type':Sequelize[_0x6687('0x2')]},'joinAt':{'type':Sequelize[_0x6687('0x3')]},'leaveAt':{'type':Sequelize[_0x6687('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8262=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8262,0x9d));var _0x2826=function(_0x1c7fcd,_0x22f5ab){_0x1c7fcd=_0x1c7fcd-0x0;var _0x19a01b=_0x8262[_0x1c7fcd];return _0x19a01b;};'use strict';var Sequelize=require(_0x2826('0x0'));module[_0x2826('0x1')]={'network':{'type':Sequelize[_0x2826('0x2')]},'network_script':{'type':Sequelize[_0x2826('0x2')]},'request':{'type':Sequelize[_0x2826('0x2')]},'channel':{'type':Sequelize[_0x2826('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2826('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2826('0x2')]},'callingpres':{'type':Sequelize[_0x2826('0x2')]},'callingani2':{'type':Sequelize[_0x2826('0x2')]},'callington':{'type':Sequelize[_0x2826('0x2')]},'callingtns':{'type':Sequelize[_0x2826('0x2')]},'dnid':{'type':Sequelize[_0x2826('0x2')]},'rdnis':{'type':Sequelize[_0x2826('0x2')]},'context':{'type':Sequelize[_0x2826('0x2')]},'extension':{'type':Sequelize[_0x2826('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x2826('0x2')]},'accountcode':{'type':Sequelize[_0x2826('0x2')]},'threadid':{'type':Sequelize[_0x2826('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2826('0x3')]},'leaveAt':{'type':Sequelize[_0x2826('0x3')]},'bot':{'type':Sequelize[_0x2826('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b8f0aad..0177483 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 _0x1af3=['where','merge','type','VIRTUAL','name','options','includeAll','include','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','send','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter'];(function(_0x25937c,_0xc2db6f){var _0x52640b=function(_0x298387){while(--_0x298387){_0x25937c['push'](_0x25937c['shift']());}};_0x52640b(++_0xc2db6f);}(_0x1af3,0x178));var _0x31af=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x1af3[_0x3227c1];return _0x31fd48;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31af('0x2'));var rp=require('request-promise');var moment=require(_0x31af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x31af('0x4'));var util=require(_0x31af('0x5'));var path=require(_0x31af('0x6'));var sox=require('sox');var csv=require(_0x31af('0x7'));var ejs=require(_0x31af('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31af('0x9'));var squel=require('squel');var crypto=require(_0x31af('0xa'));var jsforce=require(_0x31af('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x31af('0x7'));var querystring=require('querystring');var Papa=require(_0x31af('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x31af('0xd'));var as=require(_0x31af('0xe'));var hardwareService=require(_0x31af('0xf'));var logger=require(_0x31af('0x10'))(_0x31af('0x11'));var utils=require('../../config/utils');var config=require(_0x31af('0x12'));var licenseUtil=require(_0x31af('0x13'));var db=require(_0x31af('0x14'))['db'];function respondWithStatusCode(_0x28a3b3,_0x313db9){_0x313db9=_0x313db9||0xcc;return function(_0x2683f){if(_0x2683f){return _0x28a3b3[_0x31af('0x15')](_0x313db9);}return _0x28a3b3[_0x31af('0x16')](_0x313db9)['end']();};}function respondWithResult(_0x42d3e6,_0x528828){_0x528828=_0x528828||0xc8;return function(_0x145283){if(_0x145283){return _0x42d3e6[_0x31af('0x16')](_0x528828)[_0x31af('0x17')](_0x145283);}};}function respondWithFilteredResult(_0x2fff26,_0x5c8342){return function(_0x1dade5){if(_0x1dade5){var _0xd79ba8=typeof _0x5c8342[_0x31af('0x18')]===_0x31af('0x19')&&typeof _0x5c8342[_0x31af('0x1a')]===_0x31af('0x19');var _0x308071=_0x1dade5[_0x31af('0x1b')];var _0x19287d=_0xd79ba8?0x0:_0x5c8342[_0x31af('0x18')];var _0x3c1cf1=_0xd79ba8?_0x1dade5[_0x31af('0x1b')]:_0x5c8342[_0x31af('0x18')]+_0x5c8342[_0x31af('0x1a')];var _0x4d33ce;if(_0x3c1cf1>=_0x308071){_0x3c1cf1=_0x308071;_0x4d33ce=0xc8;}else{_0x4d33ce=0xce;}_0x2fff26[_0x31af('0x16')](_0x4d33ce);return _0x2fff26[_0x31af('0x1c')](_0x31af('0x1d'),_0x19287d+'-'+_0x3c1cf1+'/'+_0x308071)[_0x31af('0x17')](_0x1dade5);}return null;};}function patchUpdates(_0x358539){return function(_0x16a7b5){try{jsonpatch[_0x31af('0x1e')](_0x16a7b5,_0x358539,!![]);}catch(_0x462f46){return BPromise[_0x31af('0x1f')](_0x462f46);}return _0x16a7b5[_0x31af('0x20')]();};}function saveUpdates(_0x116a26,_0x13a835){return function(_0x100394){if(_0x100394){return _0x100394[_0x31af('0x21')](_0x116a26)[_0x31af('0x22')](function(_0xe18642){return _0xe18642;});}return null;};}function removeEntity(_0x25e08c,_0x50d0b2){return function(_0x15d56c){if(_0x15d56c){return _0x15d56c['destroy']()[_0x31af('0x22')](function(){_0x25e08c[_0x31af('0x16')](0xcc)[_0x31af('0x23')]();});}};}function handleEntityNotFound(_0x4ce9d2,_0x23e721){return function(_0x4552e4){if(!_0x4552e4){_0x4ce9d2[_0x31af('0x15')](0x194);}return _0x4552e4;};}function handleError(_0x566245,_0x189403){_0x189403=_0x189403||0x1f4;return function(_0x4534fa){logger['error'](_0x4534fa[_0x31af('0x24')]);if(_0x4534fa['name']){delete _0x4534fa['name'];}_0x566245[_0x31af('0x16')](_0x189403)[_0x31af('0x25')](_0x4534fa);};}exports['index']=function(_0x16a452,_0xf32087){var _0x27f295={},_0x42c6cd={},_0x105961={'count':0x0,'rows':[]};var _0x59af7a=_[_0x31af('0x26')](db[_0x31af('0x27')][_0x31af('0x28')],function(_0x58842f){return{'name':_0x58842f[_0x31af('0x29')],'type':_0x58842f['type'][_0x31af('0x2a')]};});_0x42c6cd[_0x31af('0x2b')]=_[_0x31af('0x26')](_0x59af7a,'name');_0x42c6cd['query']=_[_0x31af('0x2c')](_0x16a452[_0x31af('0x2d')]);_0x42c6cd[_0x31af('0x2e')]=_[_0x31af('0x2f')](_0x42c6cd[_0x31af('0x2b')],_0x42c6cd['query']);_0x27f295[_0x31af('0x30')]=_[_0x31af('0x2f')](_0x42c6cd['model'],qs['fields'](_0x16a452[_0x31af('0x2d')][_0x31af('0x31')]));_0x27f295[_0x31af('0x30')]=_0x27f295[_0x31af('0x30')][_0x31af('0x32')]?_0x27f295[_0x31af('0x30')]:_0x42c6cd[_0x31af('0x2b')];if(!_0x16a452[_0x31af('0x2d')]['hasOwnProperty'](_0x31af('0x33'))){_0x27f295['limit']=qs[_0x31af('0x1a')](_0x16a452[_0x31af('0x2d')][_0x31af('0x1a')]);_0x27f295[_0x31af('0x18')]=qs[_0x31af('0x18')](_0x16a452['query'][_0x31af('0x18')]);}_0x27f295[_0x31af('0x34')]=qs[_0x31af('0x35')](_0x16a452[_0x31af('0x2d')][_0x31af('0x35')]);_0x27f295['where']=qs[_0x31af('0x2e')](_[_0x31af('0x36')](_0x16a452[_0x31af('0x2d')],_0x42c6cd['filters']),_0x59af7a);if(_0x16a452[_0x31af('0x2d')][_0x31af('0x37')]){_0x27f295[_0x31af('0x38')]=_[_0x31af('0x39')](_0x27f295['where'],{'$or':_[_0x31af('0x26')](_0x59af7a,function(_0x519bb4){if(_0x519bb4[_0x31af('0x3a')]!==_0x31af('0x3b')){var _0x36fd13={};_0x36fd13[_0x519bb4[_0x31af('0x3c')]]={'$like':'%'+_0x16a452[_0x31af('0x2d')]['filter']+'%'};return _0x36fd13;}})});}_0x27f295=_[_0x31af('0x39')]({},_0x27f295,_0x16a452[_0x31af('0x3d')]);var _0x920143={'where':_0x27f295[_0x31af('0x38')]};return db['SquareReport'][_0x31af('0x1b')](_0x920143)[_0x31af('0x22')](function(_0x53fd8e){_0x105961[_0x31af('0x1b')]=_0x53fd8e;if(_0x16a452[_0x31af('0x2d')][_0x31af('0x3e')]){_0x27f295[_0x31af('0x3f')]=[{'all':!![]}];}return db[_0x31af('0x27')]['findAll'](_0x27f295);})[_0x31af('0x22')](function(_0x35d9af){_0x105961['rows']=_0x35d9af;return _0x105961;})[_0x31af('0x22')](respondWithFilteredResult(_0xf32087,_0x27f295))[_0x31af('0x40')](handleError(_0xf32087,null));};exports[_0x31af('0x41')]=function(_0x25bcbe,_0x3fccb6){var _0x35bb1c={'raw':!![],'where':{'id':_0x25bcbe[_0x31af('0x42')]['id']}},_0x1ad785={};_0x1ad785[_0x31af('0x2b')]=_[_0x31af('0x2c')](db[_0x31af('0x27')]['rawAttributes']);_0x1ad785[_0x31af('0x2d')]=_[_0x31af('0x2c')](_0x25bcbe[_0x31af('0x2d')]);_0x1ad785[_0x31af('0x2e')]=_['intersection'](_0x1ad785[_0x31af('0x2b')],_0x1ad785[_0x31af('0x2d')]);_0x35bb1c[_0x31af('0x30')]=_[_0x31af('0x2f')](_0x1ad785[_0x31af('0x2b')],qs[_0x31af('0x31')](_0x25bcbe[_0x31af('0x2d')][_0x31af('0x31')]));_0x35bb1c[_0x31af('0x30')]=_0x35bb1c['attributes']['length']?_0x35bb1c['attributes']:_0x1ad785[_0x31af('0x2b')];if(_0x25bcbe[_0x31af('0x2d')][_0x31af('0x3e')]){_0x35bb1c[_0x31af('0x3f')]=[{'all':!![]}];}_0x35bb1c=_[_0x31af('0x39')]({},_0x35bb1c,_0x25bcbe[_0x31af('0x3d')]);return db[_0x31af('0x27')]['find'](_0x35bb1c)[_0x31af('0x22')](handleEntityNotFound(_0x3fccb6,null))['then'](respondWithResult(_0x3fccb6,null))[_0x31af('0x40')](handleError(_0x3fccb6,null));};exports['create']=function(_0x1c432f,_0x510a51){return db['SquareReport'][_0x31af('0x43')](_0x1c432f['body'],{})[_0x31af('0x22')](respondWithResult(_0x510a51,0xc9))['catch'](handleError(_0x510a51,null));};exports[_0x31af('0x21')]=function(_0x854415,_0x532264){if(_0x854415[_0x31af('0x44')]['id']){delete _0x854415[_0x31af('0x44')]['id'];}return db[_0x31af('0x27')][_0x31af('0x45')]({'where':{'id':_0x854415['params']['id']}})[_0x31af('0x22')](handleEntityNotFound(_0x532264,null))[_0x31af('0x22')](saveUpdates(_0x854415[_0x31af('0x44')],null))[_0x31af('0x22')](respondWithResult(_0x532264,null))[_0x31af('0x40')](handleError(_0x532264,null));};exports[_0x31af('0x46')]=function(_0x210f96,_0x29ddef){return db[_0x31af('0x27')][_0x31af('0x45')]({'where':{'id':_0x210f96[_0x31af('0x42')]['id']}})['then'](handleEntityNotFound(_0x29ddef,null))['then'](removeEntity(_0x29ddef,null))['catch'](handleError(_0x29ddef,null));};exports[_0x31af('0x47')]=function(_0x206cb1,_0x1de9a0){return db[_0x31af('0x27')][_0x31af('0x47')]()['then'](respondWithResult(_0x1de9a0,null))['catch'](handleError(_0x1de9a0,null));}; \ No newline at end of file +var _0xf53f=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','name','send','map','SquareReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset'];(function(_0x1fdcff,_0x54b1ca){var _0x36dcb8=function(_0x25f44d){while(--_0x25f44d){_0x1fdcff['push'](_0x1fdcff['shift']());}};_0x36dcb8(++_0x54b1ca);}(_0xf53f,0x1e9));var _0xff53=function(_0x353a55,_0x4899fc){_0x353a55=_0x353a55-0x0;var _0x5055b1=_0xf53f[_0x353a55];return _0x5055b1;};'use strict';var emlformat=require(_0xff53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff53('0x2'));var moment=require(_0xff53('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xff53('0x4'));var util=require(_0xff53('0x5'));var path=require(_0xff53('0x6'));var sox=require(_0xff53('0x7'));var csv=require('to-csv');var ejs=require(_0xff53('0x8'));var fs=require('fs');var fs_extra=require(_0xff53('0x9'));var _=require(_0xff53('0xa'));var squel=require(_0xff53('0xb'));var crypto=require(_0xff53('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xff53('0xd'));var toCsv=require(_0xff53('0xe'));var querystring=require(_0xff53('0xf'));var Papa=require(_0xff53('0x10'));var Redis=require('ioredis');var authService=require(_0xff53('0x11'));var qs=require(_0xff53('0x12'));var as=require(_0xff53('0x13'));var hardwareService=require(_0xff53('0x14'));var logger=require(_0xff53('0x15'))(_0xff53('0x16'));var utils=require(_0xff53('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff53('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4333c6,_0x4007c2){_0x4007c2=_0x4007c2||0xcc;return function(_0x46b1c9){if(_0x46b1c9){return _0x4333c6[_0xff53('0x19')](_0x4007c2);}return _0x4333c6[_0xff53('0x1a')](_0x4007c2)['end']();};}function respondWithResult(_0x26720b,_0x34d670){_0x34d670=_0x34d670||0xc8;return function(_0x14a20e){if(_0x14a20e){return _0x26720b[_0xff53('0x1a')](_0x34d670)[_0xff53('0x1b')](_0x14a20e);}};}function respondWithFilteredResult(_0x4fb23f,_0x3eae49){return function(_0x10eb35){if(_0x10eb35){var _0x399801=typeof _0x3eae49[_0xff53('0x1c')]===_0xff53('0x1d')&&typeof _0x3eae49[_0xff53('0x1e')]===_0xff53('0x1d');var _0x5d9679=_0x10eb35[_0xff53('0x1f')];var _0x4add53=_0x399801?0x0:_0x3eae49[_0xff53('0x1c')];var _0x50f442=_0x399801?_0x10eb35[_0xff53('0x1f')]:_0x3eae49[_0xff53('0x1c')]+_0x3eae49[_0xff53('0x1e')];var _0x445903;if(_0x50f442>=_0x5d9679){_0x50f442=_0x5d9679;_0x445903=0xc8;}else{_0x445903=0xce;}_0x4fb23f[_0xff53('0x1a')](_0x445903);return _0x4fb23f[_0xff53('0x20')](_0xff53('0x21'),_0x4add53+'-'+_0x50f442+'/'+_0x5d9679)[_0xff53('0x1b')](_0x10eb35);}return null;};}function patchUpdates(_0x4a21b8){return function(_0x5b3f91){try{jsonpatch[_0xff53('0x22')](_0x5b3f91,_0x4a21b8,!![]);}catch(_0x161f77){return BPromise[_0xff53('0x23')](_0x161f77);}return _0x5b3f91[_0xff53('0x24')]();};}function saveUpdates(_0x2d48db,_0x1270d1){return function(_0x5dc075){if(_0x5dc075){return _0x5dc075[_0xff53('0x25')](_0x2d48db)[_0xff53('0x26')](function(_0x24312c){return _0x24312c;});}return null;};}function removeEntity(_0x301afd,_0xf92b67){return function(_0x3ac85b){if(_0x3ac85b){return _0x3ac85b['destroy']()[_0xff53('0x26')](function(){_0x301afd[_0xff53('0x1a')](0xcc)[_0xff53('0x27')]();});}};}function handleEntityNotFound(_0x352ab0,_0x4abed5){return function(_0x547125){if(!_0x547125){_0x352ab0['sendStatus'](0x194);}return _0x547125;};}function handleError(_0x33484f,_0x18fd9c){_0x18fd9c=_0x18fd9c||0x1f4;return function(_0x475f20){logger['error'](_0x475f20['stack']);if(_0x475f20[_0xff53('0x28')]){delete _0x475f20['name'];}_0x33484f[_0xff53('0x1a')](_0x18fd9c)[_0xff53('0x29')](_0x475f20);};}exports['index']=function(_0x55881e,_0x1736ed){var _0x3912a8={},_0x1e8907={},_0x10e582={'count':0x0,'rows':[]};var _0x3e1333=_[_0xff53('0x2a')](db[_0xff53('0x2b')][_0xff53('0x2c')],function(_0x391a86){return{'name':_0x391a86[_0xff53('0x2d')],'type':_0x391a86['type'][_0xff53('0x2e')]};});_0x1e8907['model']=_[_0xff53('0x2a')](_0x3e1333,_0xff53('0x28'));_0x1e8907[_0xff53('0x2f')]=_[_0xff53('0x30')](_0x55881e['query']);_0x1e8907[_0xff53('0x31')]=_[_0xff53('0x32')](_0x1e8907['model'],_0x1e8907[_0xff53('0x2f')]);_0x3912a8[_0xff53('0x33')]=_[_0xff53('0x32')](_0x1e8907['model'],qs[_0xff53('0x34')](_0x55881e['query'][_0xff53('0x34')]));_0x3912a8[_0xff53('0x33')]=_0x3912a8[_0xff53('0x33')][_0xff53('0x35')]?_0x3912a8['attributes']:_0x1e8907[_0xff53('0x36')];if(!_0x55881e['query'][_0xff53('0x37')](_0xff53('0x38'))){_0x3912a8[_0xff53('0x1e')]=qs[_0xff53('0x1e')](_0x55881e[_0xff53('0x2f')][_0xff53('0x1e')]);_0x3912a8[_0xff53('0x1c')]=qs[_0xff53('0x1c')](_0x55881e['query']['offset']);}_0x3912a8['order']=qs['sort'](_0x55881e[_0xff53('0x2f')]['sort']);_0x3912a8['where']=qs[_0xff53('0x31')](_[_0xff53('0x39')](_0x55881e[_0xff53('0x2f')],_0x1e8907[_0xff53('0x31')]),_0x3e1333);if(_0x55881e['query'][_0xff53('0x3a')]){_0x3912a8[_0xff53('0x3b')]=_[_0xff53('0x3c')](_0x3912a8[_0xff53('0x3b')],{'$or':_[_0xff53('0x2a')](_0x3e1333,function(_0x4b5328){if(_0x4b5328['type']!==_0xff53('0x3d')){var _0x155949={};_0x155949[_0x4b5328['name']]={'$like':'%'+_0x55881e['query']['filter']+'%'};return _0x155949;}})});}_0x3912a8=_[_0xff53('0x3c')]({},_0x3912a8,_0x55881e[_0xff53('0x3e')]);var _0xb19f56={'where':_0x3912a8[_0xff53('0x3b')]};return db[_0xff53('0x2b')][_0xff53('0x1f')](_0xb19f56)[_0xff53('0x26')](function(_0x2072ab){_0x10e582[_0xff53('0x1f')]=_0x2072ab;if(_0x55881e[_0xff53('0x2f')][_0xff53('0x3f')]){_0x3912a8[_0xff53('0x40')]=[{'all':!![]}];}return db[_0xff53('0x2b')][_0xff53('0x41')](_0x3912a8);})[_0xff53('0x26')](function(_0x1c3373){_0x10e582[_0xff53('0x42')]=_0x1c3373;return _0x10e582;})[_0xff53('0x26')](respondWithFilteredResult(_0x1736ed,_0x3912a8))[_0xff53('0x43')](handleError(_0x1736ed,null));};exports[_0xff53('0x44')]=function(_0x49449a,_0x17114e){var _0x3cb239={'raw':!![],'where':{'id':_0x49449a[_0xff53('0x45')]['id']}},_0x5b8f52={};_0x5b8f52[_0xff53('0x36')]=_['keys'](db[_0xff53('0x2b')][_0xff53('0x2c')]);_0x5b8f52[_0xff53('0x2f')]=_['keys'](_0x49449a[_0xff53('0x2f')]);_0x5b8f52['filters']=_[_0xff53('0x32')](_0x5b8f52[_0xff53('0x36')],_0x5b8f52[_0xff53('0x2f')]);_0x3cb239[_0xff53('0x33')]=_[_0xff53('0x32')](_0x5b8f52[_0xff53('0x36')],qs['fields'](_0x49449a[_0xff53('0x2f')]['fields']));_0x3cb239[_0xff53('0x33')]=_0x3cb239['attributes'][_0xff53('0x35')]?_0x3cb239[_0xff53('0x33')]:_0x5b8f52[_0xff53('0x36')];if(_0x49449a[_0xff53('0x2f')]['includeAll']){_0x3cb239['include']=[{'all':!![]}];}_0x3cb239=_['merge']({},_0x3cb239,_0x49449a['options']);return db['SquareReport'][_0xff53('0x46')](_0x3cb239)[_0xff53('0x26')](handleEntityNotFound(_0x17114e,null))[_0xff53('0x26')](respondWithResult(_0x17114e,null))['catch'](handleError(_0x17114e,null));};exports['create']=function(_0x274ac8,_0x5c19e0){return db[_0xff53('0x2b')]['create'](_0x274ac8[_0xff53('0x47')],{})['then'](respondWithResult(_0x5c19e0,0xc9))[_0xff53('0x43')](handleError(_0x5c19e0,null));};exports[_0xff53('0x25')]=function(_0x390b5e,_0x1950d8){if(_0x390b5e['body']['id']){delete _0x390b5e[_0xff53('0x47')]['id'];}return db[_0xff53('0x2b')][_0xff53('0x46')]({'where':{'id':_0x390b5e[_0xff53('0x45')]['id']}})[_0xff53('0x26')](handleEntityNotFound(_0x1950d8,null))[_0xff53('0x26')](saveUpdates(_0x390b5e[_0xff53('0x47')],null))[_0xff53('0x26')](respondWithResult(_0x1950d8,null))[_0xff53('0x43')](handleError(_0x1950d8,null));};exports[_0xff53('0x48')]=function(_0x50d233,_0x8ac45e){return db['SquareReport'][_0xff53('0x46')]({'where':{'id':_0x50d233[_0xff53('0x45')]['id']}})[_0xff53('0x26')](handleEntityNotFound(_0x8ac45e,null))[_0xff53('0x26')](removeEntity(_0x8ac45e,null))[_0xff53('0x43')](handleError(_0x8ac45e,null));};exports[_0xff53('0x49')]=function(_0x16dad4,_0x424221){return db[_0xff53('0x2b')][_0xff53('0x49')]()[_0xff53('0x26')](respondWithResult(_0x424221,null))[_0xff53('0x43')](handleError(_0x424221,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2df7d36..b6dec7a 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 _0x9c81=['report_square','uid_pname','project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c81,0x8b));var _0x19c8=function(_0x4a308b,_0x37276a){_0x4a308b=_0x4a308b-0x0;var _0x2f80c7=_0x9c81[_0x4a308b];return _0x2f80c7;};'use strict';var _=require(_0x19c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19c8('0x1'));var moment=require(_0x19c8('0x2'));var BPromise=require(_0x19c8('0x3'));var rp=require(_0x19c8('0x4'));var fs=require('fs');var path=require(_0x19c8('0x5'));var rimraf=require(_0x19c8('0x6'));var config=require(_0x19c8('0x7'));var attributes=require('./squareReport.attributes');module[_0x19c8('0x8')]=function(_0x373fbe,_0x1e5042){return _0x373fbe[_0x19c8('0x9')](_0x19c8('0xa'),attributes,{'tableName':_0x19c8('0xb'),'paranoid':![],'indexes':[{'name':_0x19c8('0xc'),'fields':['uniqueid',_0x19c8('0xd')]},{'name':_0x19c8('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name'];(function(_0xc6879,_0x84a966){var _0x54f7a4=function(_0x4e63eb){while(--_0x4e63eb){_0xc6879['push'](_0xc6879['shift']());}};_0x54f7a4(++_0x84a966);}(_0x187d,0x101));var _0xd187=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x187d[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xd187('0x0'));var util=require(_0xd187('0x1'));var logger=require(_0xd187('0x2'))(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var rp=require(_0xd187('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd187('0x7'));var config=require(_0xd187('0x8'));var attributes=require(_0xd187('0x9'));module[_0xd187('0xa')]=function(_0x219c20,_0x285b7a){return _0x219c20['define'](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xd187('0xd'),_0xd187('0xe')]},{'name':_0xd187('0xf'),'fields':[_0xd187('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 08a9f05..642291b 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 _0x8afb=['raw','stringify','catch','UpdateSquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateSquareReport','SquareReport','create','body','options'];(function(_0x5444a7,_0x42be78){var _0x4e8dfe=function(_0x4b4462){while(--_0x4b4462){_0x5444a7['push'](_0x5444a7['shift']());}};_0x4e8dfe(++_0x42be78);}(_0x8afb,0x17d));var _0xb8af=function(_0x2455d4,_0x3c14db){_0x2455d4=_0x2455d4-0x0;var _0xe7f3ed=_0x8afb[_0x2455d4];return _0xe7f3ed;};'use strict';var _=require(_0xb8af('0x0'));var util=require(_0xb8af('0x1'));var moment=require(_0xb8af('0x2'));var BPromise=require(_0xb8af('0x3'));var rs=require(_0xb8af('0x4'));var fs=require('fs');var Redis=require(_0xb8af('0x5'));var db=require(_0xb8af('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8af('0x7'))(_0xb8af('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8af('0x9'));var client=jayson['client'][_0xb8af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x299f34,_0x2eb1ea,_0x1dfe97){return new BPromise(function(_0xf5eb4d,_0x9207bd){return client[_0xb8af('0xb')](_0x299f34,_0x1dfe97)[_0xb8af('0xc')](function(_0x2d6038){logger['info'](_0xb8af('0xd'),_0x2eb1ea,'request\x20sent');logger[_0xb8af('0xe')](_0xb8af('0xf'),_0x2eb1ea,_0xb8af('0x10'),JSON['stringify'](_0x2d6038));if(_0x2d6038['error']){if(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x2eb1ea,_0x2d6038['error'][_0xb8af('0x13')]);return _0x9207bd(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);}logger[_0xb8af('0x11')]('SquareReport,\x20%s,\x20%s',_0x2eb1ea,_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);return _0xf5eb4d(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);}else{logger[_0xb8af('0x14')](_0xb8af('0xd'),_0x2eb1ea,_0xb8af('0x10'));_0xf5eb4d(_0x2d6038[_0xb8af('0x15')]['message']);}})['catch'](function(_0x1e2af4){logger[_0xb8af('0x11')](_0xb8af('0xd'),_0x2eb1ea,_0x1e2af4);_0x9207bd(_0x1e2af4);});});}exports[_0xb8af('0x16')]=function(_0x13c442){var _0x441d5f=this;return new Promise(function(_0x10284d,_0x5ae2c7){return db[_0xb8af('0x17')][_0xb8af('0x18')](_0x13c442[_0xb8af('0x19')],{'raw':_0x13c442[_0xb8af('0x1a')]?_0x13c442[_0xb8af('0x1a')][_0xb8af('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5661a9){logger[_0xb8af('0x14')](_0xb8af('0x16'),_0x13c442);logger[_0xb8af('0xe')]('CreateSquareReport',_0x13c442,JSON[_0xb8af('0x1c')](_0x5661a9));_0x10284d(_0x5661a9);})[_0xb8af('0x1d')](function(_0xea3326){logger[_0xb8af('0x11')]('CreateSquareReport',_0xea3326[_0xb8af('0x13')],_0x13c442);_0x5ae2c7(_0x441d5f[_0xb8af('0x11')](0x1f4,_0xea3326[_0xb8af('0x13')]));});});};exports[_0xb8af('0x1e')]=function(_0x597be9){var _0x56df73=this;return new Promise(function(_0x5cb069,_0x150efe){return db['SquareReport']['update'](_0x597be9['body'],{'raw':_0x597be9['options']?_0x597be9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597be9[_0xb8af('0x1a')]?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x1f')]||null:null,'attributes':_0x597be9['options']?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x20')]||null:null,'limit':_0x597be9[_0xb8af('0x1a')]?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x21')]||null:null})[_0xb8af('0xc')](function(_0x596edf){logger[_0xb8af('0x14')](_0xb8af('0x1e'),_0x597be9);logger['debug'](_0xb8af('0x1e'),_0x597be9,JSON['stringify'](_0x596edf));_0x5cb069(_0x596edf);})['catch'](function(_0x6d0c3){logger['error']('UpdateSquareReport',_0x6d0c3[_0xb8af('0x13')],_0x597be9);_0x150efe(_0x56df73[_0xb8af('0x11')](0x1f4,_0x6d0c3[_0xb8af('0x13')]));});});}; \ No newline at end of file +var _0xe82b=['code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','stringify','UpdateSquareReport','update','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xe82b,0xfc));var _0xbe82=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe82b[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xbe82('0x0'));var util=require(_0xbe82('0x1'));var moment=require(_0xbe82('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe82('0x4'))['db'];var utils=require(_0xbe82('0x5'));var logger=require(_0xbe82('0x6'))(_0xbe82('0x7'));var config=require(_0xbe82('0x8'));var jayson=require(_0xbe82('0x9'));var client=jayson[_0xbe82('0xa')][_0xbe82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39cbd7,_0x540364,_0x37d4a0){return new BPromise(function(_0x139da8,_0x41f23a){return client[_0xbe82('0xc')](_0x39cbd7,_0x37d4a0)[_0xbe82('0xd')](function(_0x57a209){logger[_0xbe82('0xe')](_0xbe82('0xf'),_0x540364,_0xbe82('0x10'));logger[_0xbe82('0x11')](_0xbe82('0x12'),_0x540364,'request\x20sent',JSON['stringify'](_0x57a209));if(_0x57a209[_0xbe82('0x13')]){if(_0x57a209['error'][_0xbe82('0x14')]===0x1f4){logger['error'](_0xbe82('0xf'),_0x540364,_0x57a209[_0xbe82('0x13')]['message']);return _0x41f23a(_0x57a209[_0xbe82('0x13')][_0xbe82('0x15')]);}logger[_0xbe82('0x13')]('SquareReport,\x20%s,\x20%s',_0x540364,_0x57a209[_0xbe82('0x13')][_0xbe82('0x15')]);return _0x139da8(_0x57a209[_0xbe82('0x13')][_0xbe82('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x540364,_0xbe82('0x10'));_0x139da8(_0x57a209[_0xbe82('0x16')][_0xbe82('0x15')]);}})[_0xbe82('0x17')](function(_0x5621ec){logger[_0xbe82('0x13')](_0xbe82('0xf'),_0x540364,_0x5621ec);_0x41f23a(_0x5621ec);});});}exports[_0xbe82('0x18')]=function(_0x496cc6){var _0x583385=this;return new Promise(function(_0x2996c6,_0x32b034){return db[_0xbe82('0x19')][_0xbe82('0x1a')](_0x496cc6[_0xbe82('0x1b')],{'raw':_0x496cc6[_0xbe82('0x1c')]?_0x496cc6['options'][_0xbe82('0x1d')]===undefined?!![]:![]:!![]})[_0xbe82('0xd')](function(_0x51dde6){logger[_0xbe82('0xe')](_0xbe82('0x18'),_0x496cc6);logger['debug'](_0xbe82('0x18'),_0x496cc6,JSON[_0xbe82('0x1e')](_0x51dde6));_0x2996c6(_0x51dde6);})[_0xbe82('0x17')](function(_0x54ef80){logger[_0xbe82('0x13')](_0xbe82('0x18'),_0x54ef80['message'],_0x496cc6);_0x32b034(_0x583385[_0xbe82('0x13')](0x1f4,_0x54ef80[_0xbe82('0x15')]));});});};exports[_0xbe82('0x1f')]=function(_0x2a2b76){var _0x2d94f0=this;return new Promise(function(_0x59c217,_0x55bcee){return db[_0xbe82('0x19')][_0xbe82('0x20')](_0x2a2b76['body'],{'raw':_0x2a2b76['options']?_0x2a2b76[_0xbe82('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2b76[_0xbe82('0x1c')]?_0x2a2b76[_0xbe82('0x1c')]['where']||null:null,'attributes':_0x2a2b76[_0xbe82('0x1c')]?_0x2a2b76[_0xbe82('0x1c')][_0xbe82('0x21')]||null:null,'limit':_0x2a2b76[_0xbe82('0x1c')]?_0x2a2b76['options']['limit']||null:null})[_0xbe82('0xd')](function(_0x1d0b77){logger[_0xbe82('0xe')]('UpdateSquareReport',_0x2a2b76);logger['debug']('UpdateSquareReport',_0x2a2b76,JSON[_0xbe82('0x1e')](_0x1d0b77));_0x59c217(_0x1d0b77);})['catch'](function(_0x37f2b9){logger[_0xbe82('0x13')](_0xbe82('0x1f'),_0x37f2b9[_0xbe82('0x15')],_0x2a2b76);_0x55bcee(_0x2d94f0[_0xbe82('0x13')](0x1f4,_0x37f2b9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b755a0b..a689fdd 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 _0xf3e1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','show','post','create','/:id','update','delete','exports','path','connect-timeout','express'];(function(_0x48562d,_0x3ca202){var _0x658f0a=function(_0x52b83f){while(--_0x52b83f){_0x48562d['push'](_0x48562d['shift']());}};_0x658f0a(++_0x3ca202);}(_0xf3e1,0x107));var _0x1f3e=function(_0x327f66,_0x188d77){_0x327f66=_0x327f66-0x0;var _0x31f70a=_0xf3e1[_0x327f66];return _0x31f70a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f3e('0x0'));var timeout=require(_0x1f3e('0x1'));var express=require(_0x1f3e('0x2'));var router=express[_0x1f3e('0x3')]();var fs_extra=require(_0x1f3e('0x4'));var auth=require(_0x1f3e('0x5'));var interaction=require(_0x1f3e('0x6'));var config=require(_0x1f3e('0x7'));var controller=require(_0x1f3e('0x8'));router[_0x1f3e('0x9')]('/',auth[_0x1f3e('0xa')](),controller['index']);router[_0x1f3e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1f3e('0xb')]);router[_0x1f3e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1f3e('0xc')]);router[_0x1f3e('0xd')]('/',auth[_0x1f3e('0xa')](),controller[_0x1f3e('0xe')]);router['put'](_0x1f3e('0xf'),auth[_0x1f3e('0xa')](),controller[_0x1f3e('0x10')]);router[_0x1f3e('0x11')]('/:id',auth[_0x1f3e('0xa')](),controller['destroy']);module[_0x1f3e('0x12')]=router; \ No newline at end of file +var _0x726c=['fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','create','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x49a024,_0x583071){var _0x53d7e0=function(_0x3b3232){while(--_0x3b3232){_0x49a024['push'](_0x49a024['shift']());}};_0x53d7e0(++_0x583071);}(_0x726c,0x95));var _0xc726=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x726c[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0xc726('0x0'));var util=require(_0xc726('0x1'));var path=require('path');var timeout=require(_0xc726('0x2'));var express=require(_0xc726('0x3'));var router=express['Router']();var fs_extra=require(_0xc726('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc726('0x5'));var config=require(_0xc726('0x6'));var controller=require(_0xc726('0x7'));router[_0xc726('0x8')]('/',auth[_0xc726('0x9')](),controller['index']);router[_0xc726('0x8')](_0xc726('0xa'),auth['isAuthenticated'](),controller[_0xc726('0xb')]);router[_0xc726('0x8')](_0xc726('0xc'),auth[_0xc726('0x9')](),controller['show']);router['post']('/',auth[_0xc726('0x9')](),controller[_0xc726('0xd')]);router['put'](_0xc726('0xc'),auth[_0xc726('0x9')](),controller[_0xc726('0xe')]);router['delete'](_0xc726('0xc'),auth[_0xc726('0x9')](),controller[_0xc726('0xf')]);module[_0xc726('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b595485..45b1248 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 _0x4ccb=['TEXT','exports','STRING'];(function(_0x2bd20a,_0x1db27a){var _0x59e9e1=function(_0x46be96){while(--_0x46be96){_0x2bd20a['push'](_0x2bd20a['shift']());}};_0x59e9e1(++_0x1db27a);}(_0x4ccb,0x8b));var _0xb4cc=function(_0xefda,_0x20c209){_0xefda=_0xefda-0x0;var _0x5790d4=_0x4ccb[_0xefda];return _0x5790d4;};'use strict';var Sequelize=require('sequelize');module[_0xb4cc('0x0')]={'uniqueid':{'type':Sequelize[_0xb4cc('0x1')]},'node':{'type':Sequelize[_0xb4cc('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xb4cc('0x2')]},'project_name':{'type':Sequelize[_0xb4cc('0x1')]},'callerid':{'type':Sequelize[_0xb4cc('0x1')]}}; \ No newline at end of file +var _0x0724=['TEXT','sequelize','exports','STRING'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x0724,0xa5));var _0x4072=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0724[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x4072('0x0'));module[_0x4072('0x1')]={'uniqueid':{'type':Sequelize[_0x4072('0x2')]},'node':{'type':Sequelize[_0x4072('0x2')]},'application':{'type':Sequelize[_0x4072('0x2')]},'data':{'type':Sequelize[_0x4072('0x3')]},'project_name':{'type':Sequelize[_0x4072('0x2')]},'callerid':{'type':Sequelize[_0x4072('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f1aa4bd..b7bbbf0 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 _0x7e9b=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','fieldName','key'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7e9b,0x18e));var _0xb7e9=function(_0x26912f,_0x59fab1){_0x26912f=_0x26912f-0x0;var _0x254200=_0x7e9b[_0x26912f];return _0x254200;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7e9('0x0'));var zipdir=require(_0xb7e9('0x1'));var jsonpatch=require(_0xb7e9('0x2'));var rp=require(_0xb7e9('0x3'));var moment=require('moment');var BPromise=require(_0xb7e9('0x4'));var Mustache=require(_0xb7e9('0x5'));var util=require(_0xb7e9('0x6'));var path=require(_0xb7e9('0x7'));var sox=require(_0xb7e9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7e9('0x9'));var squel=require('squel');var crypto=require(_0xb7e9('0xa'));var jsforce=require(_0xb7e9('0xb'));var deskjs=require(_0xb7e9('0xc'));var toCsv=require(_0xb7e9('0xd'));var querystring=require(_0xb7e9('0xe'));var Papa=require(_0xb7e9('0xf'));var Redis=require(_0xb7e9('0x10'));var authService=require(_0xb7e9('0x11'));var qs=require(_0xb7e9('0x12'));var as=require(_0xb7e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7e9('0x14'))(_0xb7e9('0x15'));var utils=require(_0xb7e9('0x16'));var config=require(_0xb7e9('0x17'));var licenseUtil=require(_0xb7e9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1cb1,_0xebd333){_0xebd333=_0xebd333||0xcc;return function(_0x29b26f){if(_0x29b26f){return _0x2f1cb1[_0xb7e9('0x19')](_0xebd333);}return _0x2f1cb1['status'](_0xebd333)[_0xb7e9('0x1a')]();};}function respondWithResult(_0x530836,_0x31d944){_0x31d944=_0x31d944||0xc8;return function(_0x670058){if(_0x670058){return _0x530836[_0xb7e9('0x1b')](_0x31d944)['json'](_0x670058);}};}function respondWithFilteredResult(_0x3b523e,_0x23caa8){return function(_0x32fa98){if(_0x32fa98){var _0x980153=typeof _0x23caa8[_0xb7e9('0x1c')]===_0xb7e9('0x1d')&&typeof _0x23caa8['limit']==='undefined';var _0x671b01=_0x32fa98[_0xb7e9('0x1e')];var _0x629ab1=_0x980153?0x0:_0x23caa8[_0xb7e9('0x1c')];var _0x3324f1=_0x980153?_0x32fa98['count']:_0x23caa8[_0xb7e9('0x1c')]+_0x23caa8[_0xb7e9('0x1f')];var _0x424a91;if(_0x3324f1>=_0x671b01){_0x3324f1=_0x671b01;_0x424a91=0xc8;}else{_0x424a91=0xce;}_0x3b523e['status'](_0x424a91);return _0x3b523e[_0xb7e9('0x20')](_0xb7e9('0x21'),_0x629ab1+'-'+_0x3324f1+'/'+_0x671b01)[_0xb7e9('0x22')](_0x32fa98);}return null;};}function patchUpdates(_0x41caf9){return function(_0x40f3a1){try{jsonpatch['apply'](_0x40f3a1,_0x41caf9,!![]);}catch(_0x516021){return BPromise['reject'](_0x516021);}return _0x40f3a1[_0xb7e9('0x23')]();};}function saveUpdates(_0x283344,_0x31a329){return function(_0x117c26){if(_0x117c26){return _0x117c26[_0xb7e9('0x24')](_0x283344)[_0xb7e9('0x25')](function(_0x2fc1ee){return _0x2fc1ee;});}return null;};}function removeEntity(_0x4910d5,_0x58736c){return function(_0x511d7d){if(_0x511d7d){return _0x511d7d[_0xb7e9('0x26')]()['then'](function(){_0x4910d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ffb6,_0x3a0b13){return function(_0x42857b){if(!_0x42857b){_0x44ffb6[_0xb7e9('0x19')](0x194);}return _0x42857b;};}function handleError(_0x394d4f,_0x3ec815){_0x3ec815=_0x3ec815||0x1f4;return function(_0x2f8e43){logger[_0xb7e9('0x27')](_0x2f8e43[_0xb7e9('0x28')]);if(_0x2f8e43[_0xb7e9('0x29')]){delete _0x2f8e43['name'];}_0x394d4f[_0xb7e9('0x1b')](_0x3ec815)[_0xb7e9('0x2a')](_0x2f8e43);};}exports['index']=function(_0x33d050,_0x57e82e){var _0x3fbd0e={},_0x2c0e29={},_0x4720f5={'count':0x0,'rows':[]};var _0x111e8d=_['map'](db[_0xb7e9('0x2b')]['rawAttributes'],function(_0x14fd14){return{'name':_0x14fd14[_0xb7e9('0x2c')],'type':_0x14fd14['type'][_0xb7e9('0x2d')]};});_0x2c0e29[_0xb7e9('0x2e')]=_[_0xb7e9('0x2f')](_0x111e8d,_0xb7e9('0x29'));_0x2c0e29[_0xb7e9('0x30')]=_[_0xb7e9('0x31')](_0x33d050[_0xb7e9('0x30')]);_0x2c0e29[_0xb7e9('0x32')]=_[_0xb7e9('0x33')](_0x2c0e29[_0xb7e9('0x2e')],_0x2c0e29['query']);_0x3fbd0e[_0xb7e9('0x34')]=_[_0xb7e9('0x33')](_0x2c0e29['model'],qs[_0xb7e9('0x35')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x35')]));_0x3fbd0e[_0xb7e9('0x34')]=_0x3fbd0e[_0xb7e9('0x34')][_0xb7e9('0x36')]?_0x3fbd0e[_0xb7e9('0x34')]:_0x2c0e29['model'];if(!_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x37')]('nolimit')){_0x3fbd0e['limit']=qs[_0xb7e9('0x1f')](_0x33d050['query'][_0xb7e9('0x1f')]);_0x3fbd0e[_0xb7e9('0x1c')]=qs[_0xb7e9('0x1c')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x1c')]);}_0x3fbd0e[_0xb7e9('0x38')]=qs[_0xb7e9('0x39')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x39')]);_0x3fbd0e['where']=qs[_0xb7e9('0x32')](_[_0xb7e9('0x3a')](_0x33d050[_0xb7e9('0x30')],_0x2c0e29['filters']),_0x111e8d);if(_0x33d050['query']['filter']){_0x3fbd0e[_0xb7e9('0x3b')]=_[_0xb7e9('0x3c')](_0x3fbd0e[_0xb7e9('0x3b')],{'$or':_['map'](_0x111e8d,function(_0x118536){if(_0x118536['type']!=='VIRTUAL'){var _0x50b46b={};_0x50b46b[_0x118536[_0xb7e9('0x29')]]={'$like':'%'+_0x33d050['query'][_0xb7e9('0x3d')]+'%'};return _0x50b46b;}})});}_0x3fbd0e=_[_0xb7e9('0x3c')]({},_0x3fbd0e,_0x33d050['options']);var _0x25f4df={'where':_0x3fbd0e[_0xb7e9('0x3b')]};return db[_0xb7e9('0x2b')][_0xb7e9('0x1e')](_0x25f4df)[_0xb7e9('0x25')](function(_0x539650){_0x4720f5[_0xb7e9('0x1e')]=_0x539650;if(_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x3e')]){_0x3fbd0e[_0xb7e9('0x3f')]=[{'all':!![]}];}return db[_0xb7e9('0x2b')][_0xb7e9('0x40')](_0x3fbd0e);})[_0xb7e9('0x25')](function(_0x4f0a53){_0x4720f5['rows']=_0x4f0a53;return _0x4720f5;})[_0xb7e9('0x25')](respondWithFilteredResult(_0x57e82e,_0x3fbd0e))[_0xb7e9('0x41')](handleError(_0x57e82e,null));};exports[_0xb7e9('0x42')]=function(_0xa0d268,_0x228e52){var _0x25a932={'raw':!![],'where':{'id':_0xa0d268[_0xb7e9('0x43')]['id']}},_0x4a8412={};_0x4a8412['model']=_['keys'](db['SquareDetailsReport'][_0xb7e9('0x44')]);_0x4a8412[_0xb7e9('0x30')]=_['keys'](_0xa0d268['query']);_0x4a8412['filters']=_['intersection'](_0x4a8412[_0xb7e9('0x2e')],_0x4a8412['query']);_0x25a932[_0xb7e9('0x34')]=_[_0xb7e9('0x33')](_0x4a8412[_0xb7e9('0x2e')],qs['fields'](_0xa0d268[_0xb7e9('0x30')][_0xb7e9('0x35')]));_0x25a932[_0xb7e9('0x34')]=_0x25a932[_0xb7e9('0x34')][_0xb7e9('0x36')]?_0x25a932[_0xb7e9('0x34')]:_0x4a8412[_0xb7e9('0x2e')];if(_0xa0d268[_0xb7e9('0x30')][_0xb7e9('0x3e')]){_0x25a932[_0xb7e9('0x3f')]=[{'all':!![]}];}_0x25a932=_[_0xb7e9('0x3c')]({},_0x25a932,_0xa0d268[_0xb7e9('0x45')]);return db[_0xb7e9('0x2b')][_0xb7e9('0x46')](_0x25a932)['then'](handleEntityNotFound(_0x228e52,null))[_0xb7e9('0x25')](respondWithResult(_0x228e52,null))[_0xb7e9('0x41')](handleError(_0x228e52,null));};exports[_0xb7e9('0x47')]=function(_0x3df48c,_0x3a590e){return db[_0xb7e9('0x2b')][_0xb7e9('0x47')](_0x3df48c[_0xb7e9('0x48')],{})['then'](respondWithResult(_0x3a590e,0xc9))[_0xb7e9('0x41')](handleError(_0x3a590e,null));};exports[_0xb7e9('0x24')]=function(_0x3e15fb,_0x4096cc){if(_0x3e15fb[_0xb7e9('0x48')]['id']){delete _0x3e15fb[_0xb7e9('0x48')]['id'];}return db[_0xb7e9('0x2b')]['find']({'where':{'id':_0x3e15fb[_0xb7e9('0x43')]['id']}})[_0xb7e9('0x25')](handleEntityNotFound(_0x4096cc,null))[_0xb7e9('0x25')](saveUpdates(_0x3e15fb['body'],null))['then'](respondWithResult(_0x4096cc,null))[_0xb7e9('0x41')](handleError(_0x4096cc,null));};exports[_0xb7e9('0x26')]=function(_0x5a53b8,_0x1b01e3){return db[_0xb7e9('0x2b')][_0xb7e9('0x46')]({'where':{'id':_0x5a53b8[_0xb7e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b01e3,null))[_0xb7e9('0x25')](removeEntity(_0x1b01e3,null))[_0xb7e9('0x41')](handleError(_0x1b01e3,null));};exports[_0xb7e9('0x49')]=function(_0x3d19e5,_0x24b74b){return db[_0xb7e9('0x2b')][_0xb7e9('0x49')]()['then'](respondWithResult(_0x24b74b,null))['catch'](handleError(_0x24b74b,null));}; \ No newline at end of file +var _0xdc3a=['VIRTUAL','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','include','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xdc3a,0x1e8));var _0xadc3=function(_0xe81a84,_0x1fafd4){_0xe81a84=_0xe81a84-0x0;var _0x314117=_0xdc3a[_0xe81a84];return _0x314117;};'use strict';var emlformat=require(_0xadc3('0x0'));var rimraf=require(_0xadc3('0x1'));var zipdir=require(_0xadc3('0x2'));var jsonpatch=require(_0xadc3('0x3'));var rp=require(_0xadc3('0x4'));var moment=require(_0xadc3('0x5'));var BPromise=require(_0xadc3('0x6'));var Mustache=require(_0xadc3('0x7'));var util=require(_0xadc3('0x8'));var path=require(_0xadc3('0x9'));var sox=require('sox');var csv=require(_0xadc3('0xa'));var ejs=require(_0xadc3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadc3('0xc'));var squel=require(_0xadc3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xadc3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xadc3('0xf'));var Papa=require(_0xadc3('0x10'));var Redis=require(_0xadc3('0x11'));var authService=require(_0xadc3('0x12'));var qs=require(_0xadc3('0x13'));var as=require(_0xadc3('0x14'));var hardwareService=require(_0xadc3('0x15'));var logger=require(_0xadc3('0x16'))('api');var utils=require(_0xadc3('0x17'));var config=require(_0xadc3('0x18'));var licenseUtil=require(_0xadc3('0x19'));var db=require(_0xadc3('0x1a'))['db'];function respondWithStatusCode(_0x956312,_0x412934){_0x412934=_0x412934||0xcc;return function(_0x59ef21){if(_0x59ef21){return _0x956312['sendStatus'](_0x412934);}return _0x956312[_0xadc3('0x1b')](_0x412934)['end']();};}function respondWithResult(_0x390349,_0x4319f4){_0x4319f4=_0x4319f4||0xc8;return function(_0x3ebcb8){if(_0x3ebcb8){return _0x390349[_0xadc3('0x1b')](_0x4319f4)['json'](_0x3ebcb8);}};}function respondWithFilteredResult(_0x54af2a,_0x2e798f){return function(_0x26943c){if(_0x26943c){var _0x2c6b09=typeof _0x2e798f[_0xadc3('0x1c')]===_0xadc3('0x1d')&&typeof _0x2e798f[_0xadc3('0x1e')]===_0xadc3('0x1d');var _0x299415=_0x26943c[_0xadc3('0x1f')];var _0x22cb73=_0x2c6b09?0x0:_0x2e798f[_0xadc3('0x1c')];var _0x29565f=_0x2c6b09?_0x26943c['count']:_0x2e798f['offset']+_0x2e798f['limit'];var _0x42bbf1;if(_0x29565f>=_0x299415){_0x29565f=_0x299415;_0x42bbf1=0xc8;}else{_0x42bbf1=0xce;}_0x54af2a[_0xadc3('0x1b')](_0x42bbf1);return _0x54af2a[_0xadc3('0x20')](_0xadc3('0x21'),_0x22cb73+'-'+_0x29565f+'/'+_0x299415)['json'](_0x26943c);}return null;};}function patchUpdates(_0x15db07){return function(_0xbb7d4c){try{jsonpatch[_0xadc3('0x22')](_0xbb7d4c,_0x15db07,!![]);}catch(_0x16cb89){return BPromise[_0xadc3('0x23')](_0x16cb89);}return _0xbb7d4c[_0xadc3('0x24')]();};}function saveUpdates(_0x5c9155,_0x25776f){return function(_0x11e6fb){if(_0x11e6fb){return _0x11e6fb[_0xadc3('0x25')](_0x5c9155)[_0xadc3('0x26')](function(_0x5c595c){return _0x5c595c;});}return null;};}function removeEntity(_0x154538,_0x5f496f){return function(_0x15e651){if(_0x15e651){return _0x15e651['destroy']()[_0xadc3('0x26')](function(){_0x154538['status'](0xcc)[_0xadc3('0x27')]();});}};}function handleEntityNotFound(_0x49668b,_0x2aada0){return function(_0x408244){if(!_0x408244){_0x49668b[_0xadc3('0x28')](0x194);}return _0x408244;};}function handleError(_0x492b0a,_0x5b92e1){_0x5b92e1=_0x5b92e1||0x1f4;return function(_0x1258d4){logger[_0xadc3('0x29')](_0x1258d4['stack']);if(_0x1258d4[_0xadc3('0x2a')]){delete _0x1258d4['name'];}_0x492b0a[_0xadc3('0x1b')](_0x5b92e1)[_0xadc3('0x2b')](_0x1258d4);};}exports[_0xadc3('0x2c')]=function(_0x3cbeed,_0x594f11){var _0x1c9b02={},_0x23c4bd={},_0x5f2851={'count':0x0,'rows':[]};var _0x13afbf=_[_0xadc3('0x2d')](db['SquareDetailsReport'][_0xadc3('0x2e')],function(_0x2689d3){return{'name':_0x2689d3[_0xadc3('0x2f')],'type':_0x2689d3[_0xadc3('0x30')]['key']};});_0x23c4bd[_0xadc3('0x31')]=_['map'](_0x13afbf,'name');_0x23c4bd['query']=_[_0xadc3('0x32')](_0x3cbeed[_0xadc3('0x33')]);_0x23c4bd[_0xadc3('0x34')]=_[_0xadc3('0x35')](_0x23c4bd[_0xadc3('0x31')],_0x23c4bd[_0xadc3('0x33')]);_0x1c9b02[_0xadc3('0x36')]=_[_0xadc3('0x35')](_0x23c4bd[_0xadc3('0x31')],qs['fields'](_0x3cbeed[_0xadc3('0x33')][_0xadc3('0x37')]));_0x1c9b02['attributes']=_0x1c9b02[_0xadc3('0x36')][_0xadc3('0x38')]?_0x1c9b02[_0xadc3('0x36')]:_0x23c4bd[_0xadc3('0x31')];if(!_0x3cbeed['query'][_0xadc3('0x39')](_0xadc3('0x3a'))){_0x1c9b02[_0xadc3('0x1e')]=qs[_0xadc3('0x1e')](_0x3cbeed[_0xadc3('0x33')][_0xadc3('0x1e')]);_0x1c9b02[_0xadc3('0x1c')]=qs[_0xadc3('0x1c')](_0x3cbeed[_0xadc3('0x33')][_0xadc3('0x1c')]);}_0x1c9b02[_0xadc3('0x3b')]=qs[_0xadc3('0x3c')](_0x3cbeed[_0xadc3('0x33')][_0xadc3('0x3c')]);_0x1c9b02[_0xadc3('0x3d')]=qs[_0xadc3('0x34')](_[_0xadc3('0x3e')](_0x3cbeed[_0xadc3('0x33')],_0x23c4bd[_0xadc3('0x34')]),_0x13afbf);if(_0x3cbeed['query'][_0xadc3('0x3f')]){_0x1c9b02[_0xadc3('0x3d')]=_[_0xadc3('0x40')](_0x1c9b02[_0xadc3('0x3d')],{'$or':_['map'](_0x13afbf,function(_0x151ccf){if(_0x151ccf[_0xadc3('0x30')]!==_0xadc3('0x41')){var _0x586172={};_0x586172[_0x151ccf['name']]={'$like':'%'+_0x3cbeed['query'][_0xadc3('0x3f')]+'%'};return _0x586172;}})});}_0x1c9b02=_[_0xadc3('0x40')]({},_0x1c9b02,_0x3cbeed[_0xadc3('0x42')]);var _0x3adc9f={'where':_0x1c9b02['where']};return db[_0xadc3('0x43')][_0xadc3('0x1f')](_0x3adc9f)['then'](function(_0x24642c){_0x5f2851[_0xadc3('0x1f')]=_0x24642c;if(_0x3cbeed[_0xadc3('0x33')][_0xadc3('0x44')]){_0x1c9b02['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xadc3('0x45')](_0x1c9b02);})[_0xadc3('0x26')](function(_0x5058de){_0x5f2851[_0xadc3('0x46')]=_0x5058de;return _0x5f2851;})[_0xadc3('0x26')](respondWithFilteredResult(_0x594f11,_0x1c9b02))[_0xadc3('0x47')](handleError(_0x594f11,null));};exports[_0xadc3('0x48')]=function(_0x54b39b,_0x4ca848){var _0x49ff75={'raw':!![],'where':{'id':_0x54b39b[_0xadc3('0x49')]['id']}},_0x3ac36f={};_0x3ac36f[_0xadc3('0x31')]=_[_0xadc3('0x32')](db['SquareDetailsReport'][_0xadc3('0x2e')]);_0x3ac36f[_0xadc3('0x33')]=_[_0xadc3('0x32')](_0x54b39b['query']);_0x3ac36f['filters']=_[_0xadc3('0x35')](_0x3ac36f[_0xadc3('0x31')],_0x3ac36f[_0xadc3('0x33')]);_0x49ff75[_0xadc3('0x36')]=_['intersection'](_0x3ac36f[_0xadc3('0x31')],qs[_0xadc3('0x37')](_0x54b39b[_0xadc3('0x33')][_0xadc3('0x37')]));_0x49ff75[_0xadc3('0x36')]=_0x49ff75[_0xadc3('0x36')][_0xadc3('0x38')]?_0x49ff75[_0xadc3('0x36')]:_0x3ac36f['model'];if(_0x54b39b[_0xadc3('0x33')][_0xadc3('0x44')]){_0x49ff75[_0xadc3('0x4a')]=[{'all':!![]}];}_0x49ff75=_['merge']({},_0x49ff75,_0x54b39b[_0xadc3('0x42')]);return db[_0xadc3('0x43')][_0xadc3('0x4b')](_0x49ff75)['then'](handleEntityNotFound(_0x4ca848,null))[_0xadc3('0x26')](respondWithResult(_0x4ca848,null))[_0xadc3('0x47')](handleError(_0x4ca848,null));};exports['create']=function(_0x446b60,_0x17d2f8){return db[_0xadc3('0x43')]['create'](_0x446b60[_0xadc3('0x4c')],{})[_0xadc3('0x26')](respondWithResult(_0x17d2f8,0xc9))[_0xadc3('0x47')](handleError(_0x17d2f8,null));};exports[_0xadc3('0x25')]=function(_0x595814,_0x510a6d){if(_0x595814[_0xadc3('0x4c')]['id']){delete _0x595814[_0xadc3('0x4c')]['id'];}return db[_0xadc3('0x43')][_0xadc3('0x4b')]({'where':{'id':_0x595814[_0xadc3('0x49')]['id']}})[_0xadc3('0x26')](handleEntityNotFound(_0x510a6d,null))['then'](saveUpdates(_0x595814[_0xadc3('0x4c')],null))[_0xadc3('0x26')](respondWithResult(_0x510a6d,null))[_0xadc3('0x47')](handleError(_0x510a6d,null));};exports[_0xadc3('0x4d')]=function(_0x1e27aa,_0x4d42e2){return db[_0xadc3('0x43')][_0xadc3('0x4b')]({'where':{'id':_0x1e27aa[_0xadc3('0x49')]['id']}})[_0xadc3('0x26')](handleEntityNotFound(_0x4d42e2,null))[_0xadc3('0x26')](removeEntity(_0x4d42e2,null))[_0xadc3('0x47')](handleError(_0x4d42e2,null));};exports['describe']=function(_0x44b2ec,_0x3d295c){return db[_0xadc3('0x43')][_0xadc3('0x4e')]()[_0xadc3('0x26')](respondWithResult(_0x3d295c,null))['catch'](handleError(_0x3d295c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7b226ec..24c4da3 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 _0xd51c=['request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x575020,_0x35bec1){var _0x297ee9=function(_0x4e09f1){while(--_0x4e09f1){_0x575020['push'](_0x575020['shift']());}};_0x297ee9(++_0x35bec1);}(_0xd51c,0x14a));var _0xcd51=function(_0x28ac6e,_0x3705eb){_0x28ac6e=_0x28ac6e-0x0;var _0x372a24=_0xd51c[_0x28ac6e];return _0x372a24;};'use strict';var _=require(_0xcd51('0x0'));var util=require(_0xcd51('0x1'));var logger=require(_0xcd51('0x2'))(_0xcd51('0x3'));var moment=require(_0xcd51('0x4'));var BPromise=require(_0xcd51('0x5'));var rp=require(_0xcd51('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd51('0x7'));var attributes=require(_0xcd51('0x8'));module[_0xcd51('0x9')]=function(_0x18fe27,_0x4404c6){return _0x18fe27[_0xcd51('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xcd51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0457=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','api'];(function(_0x1c4cb2,_0x370de9){var _0xe28537=function(_0x184b4d){while(--_0x184b4d){_0x1c4cb2['push'](_0x1c4cb2['shift']());}};_0xe28537(++_0x370de9);}(_0x0457,0xbe));var _0x7045=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x0457[_0x164e8f];return _0x2b2840;};'use strict';var _=require(_0x7045('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7045('0x1'));var moment=require(_0x7045('0x2'));var BPromise=require(_0x7045('0x3'));var rp=require(_0x7045('0x4'));var fs=require('fs');var path=require(_0x7045('0x5'));var rimraf=require(_0x7045('0x6'));var config=require(_0x7045('0x7'));var attributes=require(_0x7045('0x8'));module[_0x7045('0x9')]=function(_0x5d28dd,_0x5a9fb8){return _0x5d28dd['define'](_0x7045('0xa'),attributes,{'tableName':_0x7045('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index e129895..6c3b168 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 _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x542984,_0x1f33c0){var _0x5e8ac2=function(_0x48fcdc){while(--_0x48fcdc){_0x542984['push'](_0x542984['shift']());}};_0x5e8ac2(++_0x1f33c0);}(_0x4fc2,0x111));var _0x24fc=function(_0x59e225,_0x190985){_0x59e225=_0x59e225-0x0;var _0x5dc34b=_0x4fc2[_0x59e225];return _0x5dc34b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateSquareDetailsReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['SquareDetailsReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateSquareDetailsReport',_0x23873c);logger[_0x24fc('0x10')]('CreateSquareDetailsReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});}; \ No newline at end of file +var _0x5ec6=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment'];(function(_0x398705,_0x3cc941){var _0x1dd32e=function(_0x13e405){while(--_0x13e405){_0x398705['push'](_0x398705['shift']());}};_0x1dd32e(++_0x3cc941);}(_0x5ec6,0x7f));var _0x65ec=function(_0x12af2d,_0x3c99fb){_0x12af2d=_0x12af2d-0x0;var _0x42e3e3=_0x5ec6[_0x12af2d];return _0x42e3e3;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')](_0x1254f8[_0x65ec('0x17')],{'raw':_0x1254f8[_0x65ec('0x18')]?_0x1254f8[_0x65ec('0x18')][_0x65ec('0x19')]===undefined?!![]:![]:!![]})[_0x65ec('0xa')](function(_0x1467ac){logger[_0x65ec('0x12')](_0x65ec('0x14'),_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x1467ac));_0x29ebc4(_0x1467ac);})['catch'](function(_0x170703){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x170703[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x170703[_0x65ec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index fdc8546..2b35021 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 _0x50a3=['express','../../components/auth/service','index','get','/process/:pid/kill','isAuthenticated','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x50a3,0xee));var _0x350a=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x50a3[_0x2e913b];return _0x173899;};'use strict';var express=require(_0x350a('0x0'));var router=express['Router']();var auth=require(_0x350a('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x350a('0x2')]);router[_0x350a('0x3')](_0x350a('0x4'),auth[_0x350a('0x5')](),controller['killProcess']);module[_0x350a('0x6')]=router; \ No newline at end of file +var _0x94a4=['exports','express','../../components/auth/service','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x150667,_0x4c0be9){var _0x35b307=function(_0x15244b){while(--_0x15244b){_0x150667['push'](_0x150667['shift']());}};_0x35b307(++_0x4c0be9);}(_0x94a4,0x9b));var _0x494a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x94a4[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x494a('0x0'));var router=express['Router']();var auth=require(_0x494a('0x1'));var controller=require('./system.controller');router[_0x494a('0x2')]('/',auth[_0x494a('0x3')](),controller['index']);router['get'](_0x494a('0x4'),auth[_0x494a('0x3')](),controller[_0x494a('0x5')]);module[_0x494a('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index dfb2317..a1cc061 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 _0x5eb2=['indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','lodash','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x5eb2,0x149));var _0x25eb=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0x5eb2[_0x3d0678];return _0x7f9a43;};'use strict';var info=require('systeminformation');var exec=require(_0x25eb('0x0'))[_0x25eb('0x1')];var logger=require(_0x25eb('0x2'))(_0x25eb('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x25eb('0x4'));function handleError(_0x444a74,_0xb2c5ea,_0x1a6d29){_0xb2c5ea=_0xb2c5ea||0x1f4;return function(_0x466fcf){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1a6d29,_0xb2c5ea,util[_0x25eb('0x5')](_0x466fcf,{'showHidden':![],'depth':null}));delete _0x466fcf[_0x25eb('0x6')];_0x444a74[_0x25eb('0x7')](_0xb2c5ea)['send'](_0x466fcf);};}exports[_0x25eb('0x8')]=function(_0x4b3a2b,_0x1bcb81){return info[_0x25eb('0x9')]()[_0x25eb('0xa')](function(_0x55f909){return _0x1bcb81[_0x25eb('0x7')](0xc8)[_0x25eb('0xb')](_0x55f909);})[_0x25eb('0xc')](function(_0x4ee00b){return _0x1bcb81[_0x25eb('0x7')](0x1f4)[_0x25eb('0xb')](_0x4ee00b);});};exports[_0x25eb('0xd')]=function(_0x55c648,_0x29722d){var _0x40cb24=[_0x25eb('0xe')];return new BPromise(function(_0x1e6a04,_0x3ff0fe){return exec(util[_0x25eb('0xf')](_0x25eb('0x10'),_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')]),function(_0x22d75b,_0x51df11,_0x2d7c2d){if(_0x22d75b){return _0x3ff0fe(_0x22d75b);}return _0x1e6a04(_0x51df11);});})[_0x25eb('0xa')](function(_0x56886d){var _0x1e3665=![];var _0x2fecda=_0x56886d[_0x25eb('0x13')](/\n/);for(var _0x5b11b2=0x0,_0x2f7c5e=_0x40cb24[_0x25eb('0x14')];_0x5b11b2<_0x2f7c5e,_0x1e3665===![];_0x5b11b2+=0x1){if(_0x56886d[_0x25eb('0x15')](_0x40cb24[_0x5b11b2])>=0x0){_0x1e3665=!![];}}if(!_0x1e3665){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')]));}process[_0x25eb('0x16')](_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')],_0x25eb('0x17'));return _0x29722d[_0x25eb('0x7')](0xc8)[_0x25eb('0xb')]({'message':util[_0x25eb('0xf')](_0x25eb('0x18'),_0x55c648['params'][_0x25eb('0x12')])});})[_0x25eb('0xc')](handleError(_0x29722d,null,'killProcess'));}; \ No newline at end of file +var _0x9675=['inspect','status','send','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','killProcess','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9675,0x99));var _0x5967=function(_0x23c8ce,_0x39a64a){_0x23c8ce=_0x23c8ce-0x0;var _0x15a245=_0x9675[_0x23c8ce];return _0x15a245;};'use strict';var info=require(_0x5967('0x0'));var exec=require(_0x5967('0x1'))[_0x5967('0x2')];var logger=require(_0x5967('0x3'))('api');var util=require(_0x5967('0x4'));var BPromise=require(_0x5967('0x5'));var _=require(_0x5967('0x6'));function handleError(_0x23781a,_0x5030eb,_0x276dd5){_0x5030eb=_0x5030eb||0x1f4;return function(_0x58e44a){logger[_0x5967('0x7')](_0x5967('0x8'),_0x276dd5,_0x5030eb,util[_0x5967('0x9')](_0x58e44a,{'showHidden':![],'depth':null}));delete _0x58e44a['name'];_0x23781a[_0x5967('0xa')](_0x5030eb)[_0x5967('0xb')](_0x58e44a);};}exports['index']=function(_0x64665,_0x1d0b95){return info[_0x5967('0xc')]()['then'](function(_0x358a10){return _0x1d0b95[_0x5967('0xa')](0xc8)[_0x5967('0xd')](_0x358a10);})[_0x5967('0xe')](function(_0x543c33){return _0x1d0b95[_0x5967('0xa')](0x1f4)[_0x5967('0xd')](_0x543c33);});};exports['killProcess']=function(_0x405c3e,_0x2ba2a8){var _0x439d19=[_0x5967('0xf')];return new BPromise(function(_0x3e465c,_0x54b79a){return exec(util[_0x5967('0x10')](_0x5967('0x11'),_0x405c3e[_0x5967('0x12')][_0x5967('0x13')]),function(_0x2032de,_0x3e2d89,_0x58c442){if(_0x2032de){return _0x54b79a(_0x2032de);}return _0x3e465c(_0x3e2d89);});})[_0x5967('0x14')](function(_0x4f2b01){var _0x2247a3=![];var _0x5265c4=_0x4f2b01[_0x5967('0x15')](/\n/);for(var _0x16a532=0x0,_0x2035c0=_0x439d19[_0x5967('0x16')];_0x16a532<_0x2035c0,_0x2247a3===![];_0x16a532+=0x1){if(_0x4f2b01[_0x5967('0x17')](_0x439d19[_0x16a532])>=0x0){_0x2247a3=!![];}}if(!_0x2247a3){throw new Error(util[_0x5967('0x10')](_0x5967('0x18'),_0x405c3e[_0x5967('0x12')][_0x5967('0x13')]));}process[_0x5967('0x19')](_0x405c3e['params'][_0x5967('0x13')],'SIGINT');return _0x2ba2a8[_0x5967('0xa')](0xc8)[_0x5967('0xd')]({'message':util[_0x5967('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x405c3e[_0x5967('0x12')]['pid'])});})['catch'](handleError(_0x2ba2a8,null,_0x5967('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f4525e4..068c7e2 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 _0x648e=['./tag.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2bd565,_0x38ff91){var _0x11e9c4=function(_0x25da2f){while(--_0x25da2f){_0x2bd565['push'](_0x2bd565['shift']());}};_0x11e9c4(++_0x38ff91);}(_0x648e,0xa3));var _0xe648=function(_0x5b5a0d,_0x5a8e75){_0x5b5a0d=_0x5b5a0d-0x0;var _0x167e1e=_0x648e[_0x5b5a0d];return _0x167e1e;};'use strict';var multer=require(_0xe648('0x0'));var util=require(_0xe648('0x1'));var path=require('path');var timeout=require(_0xe648('0x2'));var express=require('express');var router=express[_0xe648('0x3')]();var fs_extra=require(_0xe648('0x4'));var auth=require(_0xe648('0x5'));var interaction=require(_0xe648('0x6'));var config=require(_0xe648('0x7'));var controller=require(_0xe648('0x8'));router[_0xe648('0x9')]('/',auth[_0xe648('0xa')](),controller[_0xe648('0xb')]);router[_0xe648('0x9')](_0xe648('0xc'),auth[_0xe648('0xa')](),controller[_0xe648('0xd')]);router[_0xe648('0xe')]('/',auth[_0xe648('0xa')](),controller['create']);router[_0xe648('0xf')](_0xe648('0xc'),auth['isAuthenticated'](),controller[_0xe648('0x10')]);router['delete'](_0xe648('0xc'),auth[_0xe648('0xa')](),controller[_0xe648('0x11')]);module[_0xe648('0x12')]=router; \ No newline at end of file +var _0x0120=['../../config/environment','./tag.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc6dbb4,_0x3fd27e){var _0xd5e8a9=function(_0x5adc40){while(--_0x5adc40){_0xc6dbb4['push'](_0xc6dbb4['shift']());}};_0xd5e8a9(++_0x3fd27e);}(_0x0120,0x6f));var _0x0012=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x0120[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var path=require(_0x0012('0x2'));var timeout=require(_0x0012('0x3'));var express=require(_0x0012('0x4'));var router=express[_0x0012('0x5')]();var fs_extra=require(_0x0012('0x6'));var auth=require(_0x0012('0x7'));var interaction=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var controller=require(_0x0012('0xa'));router[_0x0012('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0xe')]);router[_0x0012('0xf')]('/',auth[_0x0012('0xd')](),controller['create']);router[_0x0012('0x10')](_0x0012('0xc'),auth[_0x0012('0xd')](),controller[_0x0012('0x11')]);router['delete'](_0x0012('0xc'),auth['isAuthenticated'](),controller[_0x0012('0x12')]);module[_0x0012('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d724662..bed085b 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 _0xadcc=['name','#0091EA','sequelize','STRING'];(function(_0x2e1389,_0x1f4433){var _0x53acb3=function(_0x339807){while(--_0x339807){_0x2e1389['push'](_0x2e1389['shift']());}};_0x53acb3(++_0x1f4433);}(_0xadcc,0x76));var _0xcadc=function(_0x39c723,_0x5ab9e0){_0x39c723=_0x39c723-0x0;var _0x2eb15b=_0xadcc[_0x39c723];return _0x2eb15b;};'use strict';var Sequelize=require(_0xcadc('0x0'));module['exports']={'name':{'type':Sequelize[_0xcadc('0x1')],'unique':_0xcadc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcadc('0x1')],'defaultValue':_0xcadc('0x3')},'description':{'type':Sequelize[_0xcadc('0x1')]}}; \ No newline at end of file +var _0x152f=['sequelize','exports','STRING','name'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x152f,0x144));var _0xf152=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x152f[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'name':{'type':Sequelize[_0xf152('0x2')],'unique':_0xf152('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf152('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xf152('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5b90b37..dbe5ac4 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 _0xb717=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Tags','end','sendStatus','stack','name','send','map','Tag','rawAttributes','fieldName','type','model'];(function(_0x52d63e,_0x4add57){var _0x19032f=function(_0x2f7358){while(--_0x2f7358){_0x52d63e['push'](_0x52d63e['shift']());}};_0x19032f(++_0x4add57);}(_0xb717,0x1b4));var _0x7b71=function(_0x3600c8,_0x5832eb){_0x3600c8=_0x3600c8-0x0;var _0x2e68df=_0xb717[_0x3600c8];return _0x2e68df;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){var _0x16c1f3=_0x478dd8[_0x7b71('0x25')]({'plain':!![]});var _0x19a6f5=_0x7b71('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x19a6f5,'resourceId':_0x16c1f3['id']}})[_0x7b71('0x23')](function(){return _0x478dd8;});})[_0x7b71('0x23')](function(){_0x33ad80['status'](0xcc)[_0x7b71('0x27')]();});}};}function handleEntityNotFound(_0x214555,_0x7c978b){return function(_0x2f9ca9){if(!_0x2f9ca9){_0x214555[_0x7b71('0x28')](0x194);}return _0x2f9ca9;};}function handleError(_0x5209b6,_0x55ae81){_0x55ae81=_0x55ae81||0x1f4;return function(_0x2b323b){logger['error'](_0x2b323b[_0x7b71('0x29')]);if(_0x2b323b['name']){delete _0x2b323b[_0x7b71('0x2a')];}_0x5209b6[_0x7b71('0x18')](_0x55ae81)[_0x7b71('0x2b')](_0x2b323b);};}exports['index']=function(_0x1e4e89,_0xc29e2b){var _0x21ef65={},_0x5b5a4b={},_0x5e11e1={'count':0x0,'rows':[]};var _0xd100d4=_[_0x7b71('0x2c')](db[_0x7b71('0x2d')][_0x7b71('0x2e')],function(_0x43925c){return{'name':_0x43925c[_0x7b71('0x2f')],'type':_0x43925c[_0x7b71('0x30')]['key']};});_0x5b5a4b[_0x7b71('0x31')]=_[_0x7b71('0x2c')](_0xd100d4,_0x7b71('0x2a'));_0x5b5a4b['query']=_[_0x7b71('0x32')](_0x1e4e89[_0x7b71('0x33')]);_0x5b5a4b[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],_0x5b5a4b[_0x7b71('0x33')]);_0x21ef65['attributes']=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x36')]));_0x21ef65['attributes']=_0x21ef65[_0x7b71('0x37')][_0x7b71('0x38')]?_0x21ef65[_0x7b71('0x37')]:_0x5b5a4b[_0x7b71('0x31')];if(!_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x39')](_0x7b71('0x3a'))){_0x21ef65[_0x7b71('0x1c')]=qs['limit'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1c')]);_0x21ef65[_0x7b71('0x1a')]=qs[_0x7b71('0x1a')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1a')]);}_0x21ef65[_0x7b71('0x3b')]=qs['sort'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3c')]);_0x21ef65[_0x7b71('0x3d')]=qs[_0x7b71('0x34')](_['pick'](_0x1e4e89[_0x7b71('0x33')],_0x5b5a4b[_0x7b71('0x34')]),_0xd100d4);if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]){_0x21ef65[_0x7b71('0x3d')]=_[_0x7b71('0x3f')](_0x21ef65[_0x7b71('0x3d')],{'$or':_[_0x7b71('0x2c')](_0xd100d4,function(_0x30e9d1){if(_0x30e9d1[_0x7b71('0x30')]!==_0x7b71('0x40')){var _0x154dd5={};_0x154dd5[_0x30e9d1['name']]={'$like':'%'+_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]+'%'};return _0x154dd5;}})});}_0x21ef65=_['merge']({},_0x21ef65,_0x1e4e89[_0x7b71('0x41')]);var _0x411c57={'where':_0x21ef65[_0x7b71('0x3d')]};return db[_0x7b71('0x2d')][_0x7b71('0x1d')](_0x411c57)['then'](function(_0x37cf27){_0x5e11e1[_0x7b71('0x1d')]=_0x37cf27;if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x42')]){_0x21ef65[_0x7b71('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x21ef65);})[_0x7b71('0x23')](function(_0x541730){_0x5e11e1[_0x7b71('0x44')]=_0x541730;return _0x5e11e1;})[_0x7b71('0x23')](respondWithFilteredResult(_0xc29e2b,_0x21ef65))[_0x7b71('0x45')](handleError(_0xc29e2b,null));};exports[_0x7b71('0x46')]=function(_0x3c3ffb,_0x324b28){var _0x23a762={'raw':!![],'where':{'id':_0x3c3ffb[_0x7b71('0x47')]['id']}},_0x5b73a6={};_0x5b73a6[_0x7b71('0x31')]=_['keys'](db[_0x7b71('0x2d')][_0x7b71('0x2e')]);_0x5b73a6[_0x7b71('0x33')]=_[_0x7b71('0x32')](_0x3c3ffb[_0x7b71('0x33')]);_0x5b73a6[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],_0x5b73a6[_0x7b71('0x33')]);_0x23a762[_0x7b71('0x37')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x3c3ffb['query'][_0x7b71('0x36')]));_0x23a762[_0x7b71('0x37')]=_0x23a762['attributes']['length']?_0x23a762['attributes']:_0x5b73a6[_0x7b71('0x31')];if(_0x3c3ffb[_0x7b71('0x33')][_0x7b71('0x42')]){_0x23a762['include']=[{'all':!![]}];}_0x23a762=_[_0x7b71('0x3f')]({},_0x23a762,_0x3c3ffb[_0x7b71('0x41')]);return db['Tag'][_0x7b71('0x48')](_0x23a762)[_0x7b71('0x23')](handleEntityNotFound(_0x324b28,null))[_0x7b71('0x23')](respondWithResult(_0x324b28,null))['catch'](handleError(_0x324b28,null));};exports[_0x7b71('0x49')]=function(_0x18cb19,_0x945c68){return db[_0x7b71('0x2d')][_0x7b71('0x49')](_0x18cb19[_0x7b71('0x4a')],{})[_0x7b71('0x23')](function(_0x30e8d8){var _0xdb438=_0x18cb19[_0x7b71('0x4b')][_0x7b71('0x25')]({'plain':!![]});if(!_0xdb438)throw new Error(_0x7b71('0x4c'));if(_0xdb438['role']===_0x7b71('0x4b')){var _0x504cdf=_0x30e8d8[_0x7b71('0x25')]({'plain':!![]});var _0x154f72=_0x7b71('0x26');return db[_0x7b71('0x4d')][_0x7b71('0x48')]({'where':{'name':_0x154f72,'userProfileId':_0xdb438[_0x7b71('0x4e')]},'raw':!![]})['then'](function(_0x318605){if(_0x318605&&_0x318605['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b71('0x49')]({'name':_0x504cdf['name'],'resourceId':_0x504cdf['id'],'type':_0x318605[_0x7b71('0x2a')],'sectionId':_0x318605['id']},{})[_0x7b71('0x23')](function(){return _0x30e8d8;});}else{return _0x30e8d8;}})[_0x7b71('0x45')](function(_0x38cf0e){logger[_0x7b71('0x4f')](_0x7b71('0x50'),_0x38cf0e);throw _0x38cf0e;});}return _0x30e8d8;})[_0x7b71('0x23')](respondWithResult(_0x945c68,0xc9))[_0x7b71('0x45')](handleError(_0x945c68,null));};exports[_0x7b71('0x22')]=function(_0x38395a,_0xbb46b3){if(_0x38395a['body']['id']){delete _0x38395a['body']['id'];}return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x38395a[_0x7b71('0x47')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0xbb46b3,null))[_0x7b71('0x23')](saveUpdates(_0x38395a['body'],null))['then'](respondWithResult(_0xbb46b3,null))['catch'](handleError(_0xbb46b3,null));};exports[_0x7b71('0x24')]=function(_0x48b486,_0x1d3acf){return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x48b486[_0x7b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3acf,null))[_0x7b71('0x23')](removeEntity(_0x1d3acf,null))['catch'](handleError(_0x1d3acf,null));}; \ No newline at end of file +var _0x5712=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','user','get','role','userProfileId','autoAssociation','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x5b984b,_0x355e68){var _0x52e07d=function(_0x5b5064){while(--_0x5b5064){_0x5b984b['push'](_0x5b984b['shift']());}};_0x52e07d(++_0x355e68);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){var _0x22cdb8=_0x5d6778['get']({'plain':!![]});var _0x5d455d=_0x2571('0x27');return db[_0x2571('0x28')][_0x2571('0x26')]({'where':{'type':_0x5d455d,'resourceId':_0x22cdb8['id']}})[_0x2571('0x25')](function(){return _0x5d6778;});})[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6ccc,_0x1ceb21){return function(_0x426615){if(!_0x426615){_0x4f6ccc[_0x2571('0x1a')](0x194);}return _0x426615;};}function handleError(_0x2ce206,_0x26757a){_0x26757a=_0x26757a||0x1f4;return function(_0x165aa8){logger[_0x2571('0x29')](_0x165aa8[_0x2571('0x2a')]);if(_0x165aa8[_0x2571('0x2b')]){delete _0x165aa8[_0x2571('0x2b')];}_0x2ce206['status'](_0x26757a)[_0x2571('0x2c')](_0x165aa8);};}exports[_0x2571('0x2d')]=function(_0x26af3c,_0x441e7d){var _0x1bf5d1={},_0x2902cb={},_0x5bc2e7={'count':0x0,'rows':[]};var _0x4c4911=_[_0x2571('0x2e')](db[_0x2571('0x2f')][_0x2571('0x30')],function(_0x2b6416){return{'name':_0x2b6416['fieldName'],'type':_0x2b6416[_0x2571('0x31')][_0x2571('0x32')]};});_0x2902cb['model']=_['map'](_0x4c4911,_0x2571('0x2b'));_0x2902cb[_0x2571('0x33')]=_[_0x2571('0x34')](_0x26af3c['query']);_0x2902cb[_0x2571('0x35')]=_[_0x2571('0x36')](_0x2902cb['model'],_0x2902cb[_0x2571('0x33')]);_0x1bf5d1['attributes']=_[_0x2571('0x36')](_0x2902cb[_0x2571('0x37')],qs[_0x2571('0x38')](_0x26af3c['query']['fields']));_0x1bf5d1[_0x2571('0x39')]=_0x1bf5d1['attributes'][_0x2571('0x3a')]?_0x1bf5d1[_0x2571('0x39')]:_0x2902cb[_0x2571('0x37')];if(!_0x26af3c[_0x2571('0x33')]['hasOwnProperty'](_0x2571('0x3b'))){_0x1bf5d1[_0x2571('0x20')]=qs['limit'](_0x26af3c[_0x2571('0x33')][_0x2571('0x20')]);_0x1bf5d1['offset']=qs[_0x2571('0x3c')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3c')]);}_0x1bf5d1[_0x2571('0x3d')]=qs[_0x2571('0x3e')](_0x26af3c[_0x2571('0x33')][_0x2571('0x3e')]);_0x1bf5d1[_0x2571('0x3f')]=qs[_0x2571('0x35')](_[_0x2571('0x40')](_0x26af3c[_0x2571('0x33')],_0x2902cb[_0x2571('0x35')]),_0x4c4911);if(_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]){_0x1bf5d1['where']=_[_0x2571('0x42')](_0x1bf5d1[_0x2571('0x3f')],{'$or':_[_0x2571('0x2e')](_0x4c4911,function(_0x440752){if(_0x440752[_0x2571('0x31')]!==_0x2571('0x43')){var _0x35deff={};_0x35deff[_0x440752['name']]={'$like':'%'+_0x26af3c[_0x2571('0x33')][_0x2571('0x41')]+'%'};return _0x35deff;}})});}_0x1bf5d1=_[_0x2571('0x42')]({},_0x1bf5d1,_0x26af3c['options']);var _0x5fe079={'where':_0x1bf5d1[_0x2571('0x3f')]};return db[_0x2571('0x2f')]['count'](_0x5fe079)[_0x2571('0x25')](function(_0x1c6ccd){_0x5bc2e7[_0x2571('0x1f')]=_0x1c6ccd;if(_0x26af3c[_0x2571('0x33')][_0x2571('0x44')]){_0x1bf5d1[_0x2571('0x45')]=[{'all':!![]}];}return db[_0x2571('0x2f')][_0x2571('0x46')](_0x1bf5d1);})[_0x2571('0x25')](function(_0x5d2734){_0x5bc2e7[_0x2571('0x47')]=_0x5d2734;return _0x5bc2e7;})[_0x2571('0x25')](respondWithFilteredResult(_0x441e7d,_0x1bf5d1))[_0x2571('0x48')](handleError(_0x441e7d,null));};exports[_0x2571('0x49')]=function(_0x2411d9,_0x1e6f2c){var _0x391c01={'raw':!![],'where':{'id':_0x2411d9['params']['id']}},_0x2d024c={};_0x2d024c['model']=_['keys'](db['Tag']['rawAttributes']);_0x2d024c['query']=_[_0x2571('0x34')](_0x2411d9[_0x2571('0x33')]);_0x2d024c['filters']=_[_0x2571('0x36')](_0x2d024c[_0x2571('0x37')],_0x2d024c[_0x2571('0x33')]);_0x391c01[_0x2571('0x39')]=_[_0x2571('0x36')](_0x2d024c['model'],qs['fields'](_0x2411d9['query'][_0x2571('0x38')]));_0x391c01[_0x2571('0x39')]=_0x391c01[_0x2571('0x39')][_0x2571('0x3a')]?_0x391c01[_0x2571('0x39')]:_0x2d024c[_0x2571('0x37')];if(_0x2411d9[_0x2571('0x33')]['includeAll']){_0x391c01[_0x2571('0x45')]=[{'all':!![]}];}_0x391c01=_[_0x2571('0x42')]({},_0x391c01,_0x2411d9[_0x2571('0x4a')]);return db['Tag'][_0x2571('0x4b')](_0x391c01)[_0x2571('0x25')](handleEntityNotFound(_0x1e6f2c,null))[_0x2571('0x25')](respondWithResult(_0x1e6f2c,null))[_0x2571('0x48')](handleError(_0x1e6f2c,null));};exports['create']=function(_0x18291c,_0x245edb){return db[_0x2571('0x2f')][_0x2571('0x4c')](_0x18291c['body'],{})[_0x2571('0x25')](function(_0xef8f21){var _0x10d956=_0x18291c[_0x2571('0x4d')][_0x2571('0x4e')]({'plain':!![]});if(!_0x10d956)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10d956[_0x2571('0x4f')]===_0x2571('0x4d')){var _0x20302b=_0xef8f21[_0x2571('0x4e')]({'plain':!![]});var _0x6a55ff=_0x2571('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x6a55ff,'userProfileId':_0x10d956[_0x2571('0x50')]},'raw':!![]})['then'](function(_0x47ff18){if(_0x47ff18&&_0x47ff18[_0x2571('0x51')]===0x0){return db[_0x2571('0x28')][_0x2571('0x4c')]({'name':_0x20302b[_0x2571('0x2b')],'resourceId':_0x20302b['id'],'type':_0x47ff18[_0x2571('0x2b')],'sectionId':_0x47ff18['id']},{})[_0x2571('0x25')](function(){return _0xef8f21;});}else{return _0xef8f21;}})[_0x2571('0x48')](function(_0x3c890a){logger[_0x2571('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c890a);throw _0x3c890a;});}return _0xef8f21;})[_0x2571('0x25')](respondWithResult(_0x245edb,0xc9))[_0x2571('0x48')](handleError(_0x245edb,null));};exports[_0x2571('0x52')]=function(_0x495c45,_0x3823c9){if(_0x495c45['body']['id']){delete _0x495c45[_0x2571('0x53')]['id'];}return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x495c45['params']['id']}})['then'](handleEntityNotFound(_0x3823c9,null))['then'](saveUpdates(_0x495c45['body'],null))[_0x2571('0x25')](respondWithResult(_0x3823c9,null))[_0x2571('0x48')](handleError(_0x3823c9,null));};exports[_0x2571('0x26')]=function(_0x3ce2b9,_0x333b91){return db[_0x2571('0x2f')][_0x2571('0x4b')]({'where':{'id':_0x3ce2b9[_0x2571('0x54')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x333b91,null))[_0x2571('0x25')](removeEntity(_0x333b91,null))[_0x2571('0x48')](handleError(_0x333b91,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 317d7b9..31c27ca 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 _0x8ac7=['bluebird','request-promise','path','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x4c7fa5,_0x63c9be){var _0x5ec1d5=function(_0x43e5a8){while(--_0x43e5a8){_0x4c7fa5['push'](_0x4c7fa5['shift']());}};_0x5ec1d5(++_0x63c9be);}(_0x8ac7,0xeb));var _0x78ac=function(_0x718377,_0x46cf96){_0x718377=_0x718377-0x0;var _0xc1f190=_0x8ac7[_0x718377];return _0xc1f190;};'use strict';var _=require(_0x78ac('0x0'));var util=require(_0x78ac('0x1'));var logger=require(_0x78ac('0x2'))(_0x78ac('0x3'));var moment=require(_0x78ac('0x4'));var BPromise=require(_0x78ac('0x5'));var rp=require(_0x78ac('0x6'));var fs=require('fs');var path=require(_0x78ac('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78ac('0x8'));module[_0x78ac('0x9')]=function(_0x144ceb,_0xb83d69){return _0x144ceb['define'](_0x78ac('0xa'),attributes,{'tableName':_0x78ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a1=['exports','define','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes'];(function(_0x3ea609,_0x4dd140){var _0x2ca054=function(_0x89f00c){while(--_0x89f00c){_0x3ea609['push'](_0x3ea609['shift']());}};_0x2ca054(++_0x4dd140);}(_0x43a1,0x138));var _0x143a=function(_0xb509c2,_0xc778dd){_0xb509c2=_0xb509c2-0x0;var _0x1a63e1=_0x43a1[_0xb509c2];return _0x1a63e1;};'use strict';var _=require(_0x143a('0x0'));var util=require('util');var logger=require(_0x143a('0x1'))(_0x143a('0x2'));var moment=require(_0x143a('0x3'));var BPromise=require(_0x143a('0x4'));var rp=require(_0x143a('0x5'));var fs=require('fs');var path=require(_0x143a('0x6'));var rimraf=require(_0x143a('0x7'));var config=require(_0x143a('0x8'));var attributes=require(_0x143a('0x9'));module[_0x143a('0xa')]=function(_0x1cefa5,_0x6cbfe0){return _0x1cefa5[_0x143a('0xb')](_0x143a('0xc'),attributes,{'tableName':_0x143a('0xd'),'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 16d462b..0a28e7c 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x27eda4,_0x5e7af2){var _0x1c6255=function(_0x3b7506){while(--_0x3b7506){_0x27eda4['push'](_0x27eda4['shift']());}};_0x1c6255(++_0x5e7af2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x4b84[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Tag,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Tag,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0xcb81=['lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x49a798,_0x38dbfa){var _0x215214=function(_0x8fd8b5){while(--_0x8fd8b5){_0x49a798['push'](_0x49a798['shift']());}};_0x215214(++_0x38dbfa);}(_0xcb81,0x154));var _0x1cb8=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0xcb81[_0x3132e8];return _0x43eb8c;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var moment=require('moment');var BPromise=require(_0x1cb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb8('0x3'));var logger=require(_0x1cb8('0x4'))(_0x1cb8('0x5'));var config=require(_0x1cb8('0x6'));var jayson=require(_0x1cb8('0x7'));var client=jayson['client'][_0x1cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac2d6,_0x584b16,_0x2408c2){return new BPromise(function(_0x39b4ad,_0x282fd8){return client['request'](_0x2ac2d6,_0x2408c2)[_0x1cb8('0x9')](function(_0x51dc9e){logger['info'](_0x1cb8('0xa'),_0x584b16,_0x1cb8('0xb'));logger[_0x1cb8('0xc')](_0x1cb8('0xd'),_0x584b16,_0x1cb8('0xb'),JSON[_0x1cb8('0xe')](_0x51dc9e));if(_0x51dc9e[_0x1cb8('0xf')]){if(_0x51dc9e[_0x1cb8('0xf')]['code']===0x1f4){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x282fd8(_0x51dc9e[_0x1cb8('0xf')]['message']);}logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x39b4ad(_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);}else{logger[_0x1cb8('0x11')](_0x1cb8('0xa'),_0x584b16,'request\x20sent');_0x39b4ad(_0x51dc9e[_0x1cb8('0x12')]['message']);}})[_0x1cb8('0x13')](function(_0x28b8ff){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x28b8ff);_0x282fd8(_0x28b8ff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index dad0590..bd6ba8f 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 e1f3c38..ed8d7e7 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 _0x757a=['exports','STRING'];(function(_0x4ef58a,_0x122e9d){var _0x4e5968=function(_0x3a3573){while(--_0x3a3573){_0x4ef58a['push'](_0x4ef58a['shift']());}};_0x4e5968(++_0x122e9d);}(_0x757a,0xde));var _0xa757=function(_0x407687,_0x2e75c8){_0x407687=_0x407687-0x0;var _0xc7a6df=_0x757a[_0x407687];return _0xc7a6df;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x122336,_0x4828b4){var _0x23462d=function(_0x5341eb){while(--_0x5341eb){_0x122336['push'](_0x122336['shift']());}};_0x23462d(++_0x4828b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x425ea3,_0x26b830){_0x425ea3=_0x425ea3-0x0;var _0x54f159=_0xb10b[_0x425ea3];return _0x54f159;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ec2cf02..dc255aa 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 _0x2678=['voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','VoicePrefixId','spread','isArray','Chat','Sms','removeAgents','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','destroy','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','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','send','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','addAgents','Voice','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue:save'];(function(_0x3215bb,_0x1c42da){var _0x274014=function(_0x3df30c){while(--_0x3df30c){_0x3215bb['push'](_0x3215bb['shift']());}};_0x274014(++_0x1c42da);}(_0x2678,0xac));var _0x8267=function(_0xb8242,_0x253564){_0xb8242=_0xb8242-0x0;var _0x5e2c40=_0x2678[_0xb8242];return _0x5e2c40;};'use strict';var emlformat=require(_0x8267('0x0'));var rimraf=require(_0x8267('0x1'));var zipdir=require(_0x8267('0x2'));var jsonpatch=require(_0x8267('0x3'));var rp=require('request-promise');var moment=require(_0x8267('0x4'));var BPromise=require(_0x8267('0x5'));var Mustache=require(_0x8267('0x6'));var util=require(_0x8267('0x7'));var path=require(_0x8267('0x8'));var sox=require(_0x8267('0x9'));var csv=require('to-csv');var ejs=require(_0x8267('0xa'));var fs=require('fs');var fs_extra=require(_0x8267('0xb'));var _=require(_0x8267('0xc'));var squel=require(_0x8267('0xd'));var crypto=require('crypto');var jsforce=require(_0x8267('0xe'));var deskjs=require(_0x8267('0xf'));var toCsv=require(_0x8267('0x10'));var querystring=require(_0x8267('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8267('0x12'));var qs=require(_0x8267('0x13'));var as=require(_0x8267('0x14'));var hardwareService=require(_0x8267('0x15'));var logger=require(_0x8267('0x16'))(_0x8267('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8267('0x18'));var db=require(_0x8267('0x19'))['db'];config[_0x8267('0x1a')]=_[_0x8267('0x1b')](config[_0x8267('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8267('0x1c'))(new Redis(config['redis']));require('./team.socket')[_0x8267('0x1d')](socket);function respondWithStatusCode(_0x1e7297,_0x273ec1){_0x273ec1=_0x273ec1||0xcc;return function(_0x3a6e02){if(_0x3a6e02){return _0x1e7297[_0x8267('0x1e')](_0x273ec1);}return _0x1e7297['status'](_0x273ec1)[_0x8267('0x1f')]();};}function respondWithResult(_0x1d2b4b,_0x30261f){_0x30261f=_0x30261f||0xc8;return function(_0x4d9113){if(_0x4d9113){return _0x1d2b4b[_0x8267('0x20')](_0x30261f)['json'](_0x4d9113);}};}function respondWithFilteredResult(_0xf2830f,_0x3e0f53){return function(_0x542ceb){if(_0x542ceb){var _0x67dc01=typeof _0x3e0f53[_0x8267('0x21')]===_0x8267('0x22')&&typeof _0x3e0f53[_0x8267('0x23')]==='undefined';var _0x194b90=_0x542ceb[_0x8267('0x24')];var _0x5da96d=_0x67dc01?0x0:_0x3e0f53[_0x8267('0x21')];var _0x3be9a9=_0x67dc01?_0x542ceb['count']:_0x3e0f53[_0x8267('0x21')]+_0x3e0f53[_0x8267('0x23')];var _0x191da3;if(_0x3be9a9>=_0x194b90){_0x3be9a9=_0x194b90;_0x191da3=0xc8;}else{_0x191da3=0xce;}_0xf2830f[_0x8267('0x20')](_0x191da3);return _0xf2830f[_0x8267('0x25')](_0x8267('0x26'),_0x5da96d+'-'+_0x3be9a9+'/'+_0x194b90)[_0x8267('0x27')](_0x542ceb);}return null;};}function patchUpdates(_0x24ddd3){return function(_0x3ea83b){try{jsonpatch[_0x8267('0x28')](_0x3ea83b,_0x24ddd3,!![]);}catch(_0x255150){return BPromise['reject'](_0x255150);}return _0x3ea83b[_0x8267('0x29')]();};}function saveUpdates(_0x4b5240,_0x507ab6){return function(_0x41db7a){if(_0x41db7a){return _0x41db7a[_0x8267('0x2a')](_0x4b5240)[_0x8267('0x2b')](function(_0x1e67bc){return _0x1e67bc;});}return null;};}function handleEntityNotFound(_0x5adbf4,_0x690c0e){return function(_0x23e6c6){if(!_0x23e6c6){_0x5adbf4['sendStatus'](0x194);}return _0x23e6c6;};}function handleError(_0x38dde7,_0x523845){_0x523845=_0x523845||0x1f4;return function(_0x2bd20b){logger[_0x8267('0x2c')](_0x2bd20b['stack']);if(_0x2bd20b[_0x8267('0x2d')]){delete _0x2bd20b[_0x8267('0x2d')];}_0x38dde7[_0x8267('0x20')](_0x523845)['send'](_0x2bd20b);};}exports[_0x8267('0x2e')]=function(_0x5b3e41,_0x938b67){var _0x51529f={},_0x5665fe={},_0x254356={'count':0x0,'rows':[]};var _0x53929e=_[_0x8267('0x2f')](db['Team'][_0x8267('0x30')],function(_0x261165){return{'name':_0x261165[_0x8267('0x31')],'type':_0x261165[_0x8267('0x32')]['key']};});_0x5665fe[_0x8267('0x33')]=_[_0x8267('0x2f')](_0x53929e,'name');_0x5665fe[_0x8267('0x34')]=_['keys'](_0x5b3e41['query']);_0x5665fe[_0x8267('0x35')]=_[_0x8267('0x36')](_0x5665fe[_0x8267('0x33')],_0x5665fe[_0x8267('0x34')]);_0x51529f[_0x8267('0x37')]=_[_0x8267('0x36')](_0x5665fe[_0x8267('0x33')],qs[_0x8267('0x38')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x38')]));_0x51529f[_0x8267('0x37')]=_0x51529f[_0x8267('0x37')][_0x8267('0x39')]?_0x51529f[_0x8267('0x37')]:_0x5665fe[_0x8267('0x33')];if(!_0x5b3e41[_0x8267('0x34')][_0x8267('0x3a')](_0x8267('0x3b'))){_0x51529f['limit']=qs[_0x8267('0x23')](_0x5b3e41['query'][_0x8267('0x23')]);_0x51529f[_0x8267('0x21')]=qs[_0x8267('0x21')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x21')]);}_0x51529f[_0x8267('0x3c')]=qs[_0x8267('0x3d')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x3d')]);_0x51529f[_0x8267('0x3e')]=qs[_0x8267('0x35')](_[_0x8267('0x3f')](_0x5b3e41[_0x8267('0x34')],_0x5665fe['filters']),_0x53929e);if(_0x5b3e41[_0x8267('0x34')][_0x8267('0x40')]){_0x51529f['where']=_[_0x8267('0x41')](_0x51529f[_0x8267('0x3e')],{'$or':_[_0x8267('0x2f')](_0x53929e,function(_0x533274){if(_0x533274['type']!==_0x8267('0x42')){var _0x48dcf0={};_0x48dcf0[_0x533274[_0x8267('0x2d')]]={'$like':'%'+_0x5b3e41[_0x8267('0x34')][_0x8267('0x40')]+'%'};return _0x48dcf0;}})});}_0x51529f=_[_0x8267('0x41')]({},_0x51529f,_0x5b3e41[_0x8267('0x43')]);var _0x259021={'where':_0x51529f[_0x8267('0x3e')]};return db[_0x8267('0x44')][_0x8267('0x24')](_0x259021)['then'](function(_0x2a1866){_0x254356[_0x8267('0x24')]=_0x2a1866;if(_0x5b3e41[_0x8267('0x34')][_0x8267('0x45')]){_0x51529f[_0x8267('0x46')]=[{'all':!![]}];}return db[_0x8267('0x44')][_0x8267('0x47')](_0x51529f);})[_0x8267('0x2b')](function(_0x3138ca){_0x254356[_0x8267('0x48')]=_0x3138ca;return _0x254356;})[_0x8267('0x2b')](respondWithFilteredResult(_0x938b67,_0x51529f))['catch'](handleError(_0x938b67,null));};exports[_0x8267('0x49')]=function(_0x17a19a,_0x482dba){var _0x2a6905={'raw':![],'where':{'id':_0x17a19a[_0x8267('0x4a')]['id']}},_0xcb863a={};_0xcb863a['model']=_[_0x8267('0x4b')](db['Team'][_0x8267('0x30')]);_0xcb863a[_0x8267('0x34')]=_[_0x8267('0x4b')](_0x17a19a['query']);_0xcb863a[_0x8267('0x35')]=_[_0x8267('0x36')](_0xcb863a[_0x8267('0x33')],_0xcb863a[_0x8267('0x34')]);_0x2a6905[_0x8267('0x37')]=_[_0x8267('0x36')](_0xcb863a[_0x8267('0x33')],qs[_0x8267('0x38')](_0x17a19a[_0x8267('0x34')][_0x8267('0x38')]));_0x2a6905[_0x8267('0x37')]=_0x2a6905['attributes'][_0x8267('0x39')]?_0x2a6905[_0x8267('0x37')]:_0xcb863a[_0x8267('0x33')];if(_0x17a19a[_0x8267('0x34')][_0x8267('0x45')]){_0x2a6905[_0x8267('0x46')]=[{'all':!![]}];}_0x2a6905=_[_0x8267('0x41')]({},_0x2a6905,_0x17a19a[_0x8267('0x43')]);return db[_0x8267('0x44')][_0x8267('0x4c')](_0x2a6905)[_0x8267('0x2b')](handleEntityNotFound(_0x482dba,null))[_0x8267('0x2b')](respondWithResult(_0x482dba,null))['catch'](handleError(_0x482dba,null));};exports[_0x8267('0x4d')]=function(_0x426a55,_0x22c815){return db[_0x8267('0x44')][_0x8267('0x4d')](_0x426a55[_0x8267('0x4e')],{})[_0x8267('0x2b')](function(_0x46d48f){var _0x4c12d5=_0x426a55[_0x8267('0x4f')][_0x8267('0x50')]({'plain':!![]});if(!_0x4c12d5)throw new Error(_0x8267('0x51'));if(_0x4c12d5[_0x8267('0x52')]===_0x8267('0x4f')){var _0xe060d3=_0x46d48f[_0x8267('0x50')]({'plain':!![]});var _0x17d8c5=_0x8267('0x53');return db[_0x8267('0x54')][_0x8267('0x4c')]({'where':{'name':_0x17d8c5,'userProfileId':_0x4c12d5[_0x8267('0x55')]},'raw':!![]})[_0x8267('0x2b')](function(_0x2e6619){if(_0x2e6619&&_0x2e6619[_0x8267('0x56')]===0x0){return db[_0x8267('0x57')]['create']({'name':_0xe060d3[_0x8267('0x2d')],'resourceId':_0xe060d3['id'],'type':_0x2e6619[_0x8267('0x2d')],'sectionId':_0x2e6619['id']},{})[_0x8267('0x2b')](function(){return _0x46d48f;});}else{return _0x46d48f;}})[_0x8267('0x58')](function(_0x549d67){logger[_0x8267('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x549d67);throw _0x549d67;});}return _0x46d48f;})[_0x8267('0x2b')](respondWithResult(_0x22c815,0xc9))[_0x8267('0x58')](handleError(_0x22c815,null));};exports[_0x8267('0x2a')]=function(_0x450552,_0x4bce3c){if(_0x450552['body']['id']){delete _0x450552['body']['id'];}return db['Team']['find']({'where':{'id':_0x450552['params']['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x4bce3c,null))[_0x8267('0x2b')](saveUpdates(_0x450552['body'],null))[_0x8267('0x2b')](respondWithResult(_0x4bce3c,null))[_0x8267('0x58')](handleError(_0x4bce3c,null));};exports['destroy']=function(_0x1fc3d6,_0x5afbe5){var _0x19319e=_0x1fc3d6['params']['id'];var _0x12d133=[];return db[_0x8267('0x59')][_0x8267('0x5a')](function(_0x29e4f0){var _0x34f020=_0x8267('0x5b')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x34f020,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0})[_0x8267('0x2b')](function(_0x4d18ff){_0x12d133=_['map'](_0x4d18ff,function(_0x32e84e){return Number(_0x32e84e[_0x8267('0x5e')]);});})[_0x8267('0x2b')](function(){var _0x5f393f=_0x8267('0x5f')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x5f393f,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x22e003){var _0x573759=_[_0x8267('0x2f')](_0x22e003,function(_0x5583df){return Number(_0x5583df[_0x8267('0x61')]);});return db[_0x8267('0x62')]['destroy']({'where':{'UserId':{'$in':_0x12d133},'VoiceQueueId':{'$in':_0x573759}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x2a75c4=_0x8267('0x63')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x2a75c4,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})['then'](function(_0x4db277){var _0x8ea3cf=_[_0x8267('0x2f')](_0x4db277,function(_0x58d512){return Number(_0x58d512[_0x8267('0x64')]);});return db['UserMailQueue'][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'MailQueueId':{'$in':_0x8ea3cf}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x234c8d=_0x8267('0x66')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x234c8d,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x828571){var _0x84c334=_[_0x8267('0x2f')](_0x828571,function(_0x537695){return Number(_0x537695[_0x8267('0x67')]);});return db[_0x8267('0x68')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'SmsQueueId':{'$in':_0x84c334}},'transaction':_0x29e4f0});})['then'](function(){var _0x3a4b70=_0x8267('0x69')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x3a4b70,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x334ecd){var _0x5292ac=_[_0x8267('0x2f')](_0x334ecd,function(_0x2466d2){return Number(_0x2466d2[_0x8267('0x6a')]);});return db[_0x8267('0x6b')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'ChatQueueId':{'$in':_0x5292ac}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x5f5140=_0x8267('0x6c')+_0x19319e;return db['sequelize'][_0x8267('0x34')](_0x5f5140,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x1d3767){var _0x2b06dd=_[_0x8267('0x2f')](_0x1d3767,function(_0x2f8455){return Number(_0x2f8455['FaxQueueId']);});return db['UserFaxQueue'][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'FaxQueueId':{'$in':_0x2b06dd}},'transaction':_0x29e4f0});})['then'](function(){var _0x21fb7d=_0x8267('0x6d')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x21fb7d,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x9f41bf){var _0x44aeee=_[_0x8267('0x2f')](_0x9f41bf,function(_0x54490b){return Number(_0x54490b[_0x8267('0x6e')]);});return db[_0x8267('0x6f')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'OpenchannelQueueId':{'$in':_0x44aeee}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x2a76eb=_0x8267('0x70')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x2a76eb,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x3be28f){var _0x31c7ef=_[_0x8267('0x2f')](_0x3be28f,function(_0x247dfd){return Number(_0x247dfd[_0x8267('0x71')]);});return db[_0x8267('0x72')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'WhatsappQueueId':{'$in':_0x31c7ef}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){return db[_0x8267('0x73')]['find']({'where':{'TeamId':_0x19319e}});})['then'](function(_0x36a09e){if(_0x36a09e===null){return;}return db[_0x8267('0x74')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'VoicePrefixId':_0x36a09e['VoicePrefixId']},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){return db[_0x8267('0x44')][_0x8267('0x65')]({'where':{'id':_0x19319e},'cascade':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x33ebc7){if(_0x33ebc7===0x0){_0x5afbe5[_0x8267('0x1e')](0x194);}else{return db[_0x8267('0x57')][_0x8267('0x65')]({'where':{'type':'Teams','resourceId':_0x19319e},'cascade':!![],'transaction':_0x29e4f0})[_0x8267('0x2b')](function(){_0x5afbe5['status'](0xcc)[_0x8267('0x1f')]();});}})[_0x8267('0x58')](function(_0x56149b){_0x5afbe5['status'](0x1f4)[_0x8267('0x75')](_0x56149b);});});};exports['getQueues']=function(_0x400c12,_0x41afc8,_0x4147d8){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x400c12['params']['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x41afc8,null))[_0x8267('0x2b')](function(_0x1a7673){if(!_0x400c12[_0x8267('0x34')]['channel']||!utils['isValidChannel'](_0x400c12['query'][_0x8267('0x77')])){throw new db[(_0x8267('0x5c'))]['ValidationError'](_0x8267('0x78'));}var _0x588dea={};var _0x5726f4={};_0x5726f4[_0x8267('0x33')]=_['keys'](db[_[_0x8267('0x79')](_0x400c12[_0x8267('0x34')][_0x8267('0x77')][_0x8267('0x7a')]())+_0x8267('0x7b')][_0x8267('0x30')]);_0x5726f4[_0x8267('0x34')]=_['keys'](_0x400c12[_0x8267('0x34')]);_0x5726f4[_0x8267('0x35')]=_['intersection'](_0x5726f4[_0x8267('0x33')],_0x5726f4[_0x8267('0x34')]);_0x588dea['attributes']=_[_0x8267('0x36')](_0x5726f4[_0x8267('0x33')],qs['fields'](_0x400c12['query'][_0x8267('0x38')]));_0x588dea['attributes']=_0x588dea['attributes'][_0x8267('0x39')]?_0x588dea[_0x8267('0x37')]:_0x5726f4[_0x8267('0x33')];_0x588dea[_0x8267('0x23')]=qs[_0x8267('0x23')](_0x400c12[_0x8267('0x34')]['limit']);_0x588dea[_0x8267('0x21')]=qs[_0x8267('0x21')](_0x400c12[_0x8267('0x34')][_0x8267('0x21')]);_0x588dea[_0x8267('0x3c')]=qs['sort'](_0x400c12['query'][_0x8267('0x3d')]);_0x588dea[_0x8267('0x3e')]=qs[_0x8267('0x35')](_['pick'](_0x400c12['query'],_0x5726f4[_0x8267('0x35')]));_0x588dea=_['merge']({},_0x588dea,_0x400c12[_0x8267('0x43')]);return _0x1a7673[_0x8267('0x50')+_[_0x8267('0x79')](_0x400c12[_0x8267('0x34')][_0x8267('0x77')]['toLowerCase']())+_0x8267('0x7c')](_0x588dea);})['then'](respondWithResult(_0x41afc8,null))[_0x8267('0x58')](handleError(_0x41afc8,null));};exports[_0x8267('0x7d')]=function(_0x2867fd,_0x3f54b1,_0xd61433){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x2867fd[_0x8267('0x4a')]['id']}})[_0x8267('0x2b')](function(_0x1cd1cb){if(_0x1cd1cb){if(!_0x2867fd[_0x8267('0x4e')][_0x8267('0x77')]||!utils[_0x8267('0x7e')](_0x2867fd[_0x8267('0x4e')]['channel'])){throw new db[(_0x8267('0x5c'))][(_0x8267('0x7f'))](_0x8267('0x78'));}return _0x1cd1cb[_0x8267('0x80')+_[_0x8267('0x79')](_0x2867fd[_0x8267('0x4e')]['channel'][_0x8267('0x7a')]())+'Queues'](_0x2867fd[_0x8267('0x4e')][_0x8267('0x81')]);}return null;})[_0x8267('0x2b')](handleEntityNotFound(_0x3f54b1,null))[_0x8267('0x2b')](respondWithStatusCode(_0x3f54b1,null))[_0x8267('0x58')](handleError(_0x3f54b1,null));};exports[_0x8267('0x82')]=function(_0x1648d2,_0x268714,_0x3b42f4){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x1648d2[_0x8267('0x4a')]['id']}})['then'](function(_0x5b3ffd){if(_0x5b3ffd){if(!_0x1648d2[_0x8267('0x34')][_0x8267('0x77')]||!utils['isValidChannel'](_0x1648d2[_0x8267('0x34')][_0x8267('0x77')])){throw new db['Sequelize']['ValidationError'](_0x8267('0x78'));}return _0x5b3ffd['remove'+_['capitalize'](_0x1648d2[_0x8267('0x34')][_0x8267('0x77')]['toLowerCase']())+_0x8267('0x7c')](_0x1648d2['query']['ids']);}return null;})[_0x8267('0x2b')](handleEntityNotFound(_0x268714,null))[_0x8267('0x2b')](respondWithStatusCode(_0x268714,null))[_0x8267('0x58')](handleError(_0x268714,null));};exports[_0x8267('0x83')]=function(_0x1307b1,_0x3011b5){var _0x1f5ce0=_['isArray'](_0x1307b1[_0x8267('0x4e')][_0x8267('0x81')])?_0x1307b1[_0x8267('0x4e')][_0x8267('0x81')]:[_0x1307b1['body'][_0x8267('0x81')]];var _0x16fce9=_0x1307b1[_0x8267('0x4a')]['id'];return db[_0x8267('0x44')][_0x8267('0x4c')]({'where':{'id':_0x16fce9}})[_0x8267('0x2b')](handleEntityNotFound(_0x3011b5,null))['then'](function(_0x2f9232){if(_0x2f9232){var _0x375af9=[_0x8267('0x84'),'Chat','Mail','Sms',_0x8267('0x85'),_0x8267('0x86'),_0x8267('0x87')];return db[_0x8267('0x59')][_0x8267('0x5a')](function(_0x4c81a1){var _0x1e0a96=_[_0x8267('0x2f')](_0x375af9,function(_0x4893e4){var _0x2cf973={'attributes':['id',_0x8267('0x2d')]};if(_0x4893e4==='Voice'){_0x2cf973[_0x8267('0x88')]={'attributes':[_0x8267('0x89')]};}return _0x2f9232[_0x8267('0x50')+_0x4893e4+_0x8267('0x7c')](_0x2cf973)[_0x8267('0x2b')](function(_0x5f2842){var _0x554293=_[_0x8267('0x2f')](_0x5f2842,function(_0x4db2fb){var _0x1e2ba1=_[_0x8267('0x2f')](_0x1f5ce0,function(_0x1f20e6){var _0x5e7b28={'where':{'UserId':_0x1f20e6,[_0x4893e4+_0x8267('0x8a')]:_0x4db2fb['id']},'transaction':_0x4c81a1};if(_0x4893e4==='Voice'){_0x5e7b28[_0x8267('0x1b')]={'penalty':_0x4db2fb[_0x8267('0x8b')][_0x8267('0x89')]};}return db[_0x8267('0x8c')+_0x4893e4+_0x8267('0x7b')]['findOrCreate'](_0x5e7b28)[_0x8267('0x2b')](function(){socket['emit'](_0x8267('0x4f')+_0x4893e4+_0x8267('0x8d'),{'UserId':_0x1f20e6,[_0x4893e4+_0x8267('0x8a')]:_0x4db2fb['id']});if(_0x4893e4!=='Voice'){return;}return db['User'][_0x8267('0x47')]({'where':{'id':_0x1f5ce0,'online':0x1},'attributes':['id',_0x8267('0x2d'),'online',_0x8267('0x8e'),_0x8267('0x8f')],'raw':!![]})[_0x8267('0x2b')](function(_0x37afc3){var _0x5bc2d8=_[_0x8267('0x2f')](_0x37afc3,function(_0x10d9b5){return db[_0x8267('0x90')][_0x8267('0x91')]({'membername':_0x10d9b5[_0x8267('0x2d')],'UserId':_0x10d9b5['id'],'queue_name':_0x4db2fb[_0x8267('0x2d')],'VoiceQueueId':_0x4db2fb['id'],'interface':_[_0x8267('0x92')](_0x10d9b5[_0x8267('0x8f')])?util['format'](_0x8267('0x93'),_0x10d9b5[_0x8267('0x2d')]):_0x10d9b5[_0x8267('0x8f')],'paused':_0x10d9b5[_0x8267('0x8e')]||![],'penalty':_0x4db2fb['TeamVoiceQueue'][_0x8267('0x89')]},{'transaction':_0x4c81a1});});return Promise[_0x8267('0x94')](_0x5bc2d8);});});});return Promise['all'](_0x1e2ba1);});return Promise[_0x8267('0x94')](_0x554293);})[_0x8267('0x2b')](function(){return db[_0x8267('0x73')][_0x8267('0x76')]({'where':{'teamId':_0x16fce9}})[_0x8267('0x2b')](function(_0x53ea04){if(_0x53ea04){var _0x4e23a3=_[_0x8267('0x2f')](_0x1f5ce0,function(_0x396536){db[_0x8267('0x74')][_0x8267('0x91')]({'UserId':_0x396536,'VoicePrefixId':_0x53ea04[_0x8267('0x95')]});});return Promise[_0x8267('0x94')](_0x4e23a3);}});});});return Promise[_0x8267('0x94')](_0x1e0a96)[_0x8267('0x2b')](function(){return _0x2f9232[_0x8267('0x83')](_0x1f5ce0,{'transaction':_0x4c81a1})[_0x8267('0x96')](function(_0x455c95){return _0x455c95;});});});}})[_0x8267('0x2b')](respondWithResult(_0x3011b5,null))[_0x8267('0x58')](handleError(_0x3011b5,null));};exports['removeAgents']=function(_0xd926ba,_0x1e189b){var _0x30cb7e=_[_0x8267('0x97')](_0xd926ba[_0x8267('0x34')][_0x8267('0x81')])?_0xd926ba[_0x8267('0x34')][_0x8267('0x81')]:[_0xd926ba[_0x8267('0x34')][_0x8267('0x81')]];var _0x174e95=_0xd926ba[_0x8267('0x4a')]['id'];return db[_0x8267('0x44')][_0x8267('0x4c')]({'where':{'id':_0x174e95}})[_0x8267('0x2b')](handleEntityNotFound(_0x1e189b,null))[_0x8267('0x2b')](function(_0x11f45f){if(_0x11f45f){var _0x4d506c=[_0x8267('0x84'),_0x8267('0x98'),'Mail',_0x8267('0x99'),_0x8267('0x85'),_0x8267('0x86'),_0x8267('0x87')];return db[_0x8267('0x59')]['transaction'](function(_0x41f9f7){var _0x519adc=_[_0x8267('0x2f')](_0x4d506c,function(_0x5a5e5a){var _0x2da4aa={'attributes':['id','name']};return _0x11f45f[_0x8267('0x50')+_0x5a5e5a+_0x8267('0x7c')](_0x2da4aa)['then'](function(_0x7041c9){var _0x4e796e=_[_0x8267('0x2f')](_0x7041c9,function(_0x1c580e){return _0x1c580e[_0x8267('0x9a')](_0x30cb7e,{'transaction':_0x41f9f7})[_0x8267('0x2b')](function(){var _0x24d7b1=_[_0x8267('0x2f')](_0x30cb7e,function(_0x1a3374){socket['emit'](_0x8267('0x4f')+_0x5a5e5a+_0x8267('0x9b'),{'UserId':Number(_0x1a3374),[_0x5a5e5a+_0x8267('0x8a')]:_0x1c580e['id']});if(_0x5a5e5a!==_0x8267('0x84')){return;}return db[_0x8267('0x90')][_0x8267('0x65')]({'where':{'VoiceQueueId':_0x1c580e['id'],'UserId':_0x1a3374},'transaction':_0x41f9f7});});return Promise[_0x8267('0x94')](_0x24d7b1);});});return Promise['all'](_0x4e796e);});});return Promise[_0x8267('0x94')](_0x519adc)[_0x8267('0x2b')](function(){return _0x11f45f['removeAgents'](_0x30cb7e,{'transaction':_0x41f9f7});})[_0x8267('0x2b')](function(){return db['TeamVoicePrefix'][_0x8267('0x76')]({'where':{'teamId':_0x174e95}})['then'](function(_0x55934f){if(_0x55934f){var _0x15c32b=_[_0x8267('0x2f')](_0x30cb7e,function(_0x1bdbe8){db[_0x8267('0x74')]['destroy']({'where':{'UserId':_0x1bdbe8,'VoicePrefixId':_0x55934f[_0x8267('0x95')]}});});return Promise[_0x8267('0x94')](_0x15c32b);}});});});}})['then'](respondWithStatusCode(_0x1e189b,null))[_0x8267('0x58')](handleError(_0x1e189b,null));};exports[_0x8267('0x9c')]=function(_0x8b07ab,_0x26b1d3,_0x1bf3ee){var _0x92ff85={};var _0x31aa96={};var _0x1a15a3;var _0xd671fc;return db[_0x8267('0x44')]['findOne']({'where':{'id':_0x8b07ab[_0x8267('0x4a')]['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x26b1d3,null))['then'](function(_0x28cdd0){if(_0x28cdd0){_0x1a15a3=_0x28cdd0;_0x31aa96[_0x8267('0x33')]=_[_0x8267('0x4b')](db[_0x8267('0x8c')][_0x8267('0x30')]);_0x31aa96['query']=_[_0x8267('0x4b')](_0x8b07ab[_0x8267('0x34')]);_0x31aa96['filters']=_[_0x8267('0x36')](_0x31aa96['model'],_0x31aa96[_0x8267('0x34')]);_0x92ff85['attributes']=_['intersection'](_0x31aa96['model'],qs['fields'](_0x8b07ab[_0x8267('0x34')][_0x8267('0x38')]));_0x92ff85[_0x8267('0x37')]=_0x92ff85[_0x8267('0x37')]['length']?_0x92ff85['attributes']:_0x31aa96['model'];_0x92ff85[_0x8267('0x3c')]=qs[_0x8267('0x3d')](_0x8b07ab[_0x8267('0x34')][_0x8267('0x3d')]);_0x92ff85[_0x8267('0x3e')]=qs[_0x8267('0x35')](_[_0x8267('0x3f')](_0x8b07ab['query'],_0x31aa96[_0x8267('0x35')]));if(_0x8b07ab[_0x8267('0x34')][_0x8267('0x40')]){_0x92ff85[_0x8267('0x3e')]=_[_0x8267('0x41')](_0x92ff85['where'],{'$or':_[_0x8267('0x2f')](_0x92ff85[_0x8267('0x37')],function(_0xc53d0d){var _0x5694fb={};_0x5694fb[_0xc53d0d]={'$like':'%'+_0x8b07ab[_0x8267('0x34')][_0x8267('0x40')]+'%'};return _0x5694fb;})});}_0x92ff85=_[_0x8267('0x41')]({},_0x92ff85,_0x8b07ab['options']);return _0x1a15a3[_0x8267('0x9c')](_0x92ff85);}})[_0x8267('0x2b')](function(_0x4f759d){if(_0x4f759d){_0xd671fc=_0x4f759d[_0x8267('0x39')];if(!_0x8b07ab['query']['hasOwnProperty'](_0x8267('0x3b'))){_0x92ff85[_0x8267('0x23')]=qs[_0x8267('0x23')](_0x8b07ab['query'][_0x8267('0x23')]);_0x92ff85[_0x8267('0x21')]=qs['offset'](_0x8b07ab['query']['offset']);}return _0x1a15a3[_0x8267('0x9c')](_0x92ff85);}})[_0x8267('0x2b')](function(_0x165b76){if(_0x165b76){return _0x165b76?{'count':_0xd671fc,'rows':_0x165b76}:null;}})[_0x8267('0x2b')](respondWithResult(_0x26b1d3,null))['catch'](handleError(_0x26b1d3,null));}; \ No newline at end of file +var _0xd18d=['Queues','add','ids','ValidationError','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','all','UserVoicePrefix','spread','removeAgents','Queue:remove','getAgents','User','hasOwnProperty','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','type','filter','options','includeAll','include','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','UserMailQueue','Sequelize','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue'];(function(_0x53844f,_0x398371){var _0x3aed67=function(_0x1f24a3){while(--_0x1f24a3){_0x53844f['push'](_0x53844f['shift']());}};_0x3aed67(++_0x398371);}(_0xd18d,0x14c));var _0xdd18=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0xd18d[_0x22e9fe];return _0x47cd19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd18('0x0'));var moment=require('moment');var BPromise=require(_0xdd18('0x1'));var Mustache=require(_0xdd18('0x2'));var util=require(_0xdd18('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xdd18('0x4'));var ejs=require(_0xdd18('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd18('0x6'));var squel=require(_0xdd18('0x7'));var crypto=require(_0xdd18('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdd18('0x9'));var toCsv=require(_0xdd18('0x4'));var querystring=require(_0xdd18('0xa'));var Papa=require(_0xdd18('0xb'));var Redis=require(_0xdd18('0xc'));var authService=require(_0xdd18('0xd'));var qs=require(_0xdd18('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdd18('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd18('0x10'));var db=require(_0xdd18('0x11'))['db'];config['redis']=_[_0xdd18('0x12')](config['redis'],{'host':_0xdd18('0x13'),'port':0x18eb});var socket=require(_0xdd18('0x14'))(new Redis(config['redis']));require(_0xdd18('0x15'))[_0xdd18('0x16')](socket);function respondWithStatusCode(_0x5e72e7,_0x23a643){_0x23a643=_0x23a643||0xcc;return function(_0x298c9b){if(_0x298c9b){return _0x5e72e7[_0xdd18('0x17')](_0x23a643);}return _0x5e72e7[_0xdd18('0x18')](_0x23a643)['end']();};}function respondWithResult(_0x55fddf,_0x5c9695){_0x5c9695=_0x5c9695||0xc8;return function(_0x2517e1){if(_0x2517e1){return _0x55fddf[_0xdd18('0x18')](_0x5c9695)['json'](_0x2517e1);}};}function respondWithFilteredResult(_0x3dc790,_0x3e1deb){return function(_0x56131b){if(_0x56131b){var _0x191eb1=typeof _0x3e1deb[_0xdd18('0x19')]===_0xdd18('0x1a')&&typeof _0x3e1deb[_0xdd18('0x1b')]==='undefined';var _0x5ea204=_0x56131b[_0xdd18('0x1c')];var _0x1edc27=_0x191eb1?0x0:_0x3e1deb['offset'];var _0x30334b=_0x191eb1?_0x56131b[_0xdd18('0x1c')]:_0x3e1deb[_0xdd18('0x19')]+_0x3e1deb['limit'];var _0x27c4a1;if(_0x30334b>=_0x5ea204){_0x30334b=_0x5ea204;_0x27c4a1=0xc8;}else{_0x27c4a1=0xce;}_0x3dc790[_0xdd18('0x18')](_0x27c4a1);return _0x3dc790[_0xdd18('0x1d')](_0xdd18('0x1e'),_0x1edc27+'-'+_0x30334b+'/'+_0x5ea204)['json'](_0x56131b);}return null;};}function patchUpdates(_0x21964b){return function(_0x1de93f){try{jsonpatch[_0xdd18('0x1f')](_0x1de93f,_0x21964b,!![]);}catch(_0x5e51f6){return BPromise[_0xdd18('0x20')](_0x5e51f6);}return _0x1de93f[_0xdd18('0x21')]();};}function saveUpdates(_0x32df93,_0x19c932){return function(_0x45c6bd){if(_0x45c6bd){return _0x45c6bd['update'](_0x32df93)[_0xdd18('0x22')](function(_0x49903f){return _0x49903f;});}return null;};}function handleEntityNotFound(_0x9a55ba,_0x273616){return function(_0xf33827){if(!_0xf33827){_0x9a55ba[_0xdd18('0x17')](0x194);}return _0xf33827;};}function handleError(_0x3bf1d7,_0x16c313){_0x16c313=_0x16c313||0x1f4;return function(_0xf34a9e){logger[_0xdd18('0x23')](_0xf34a9e[_0xdd18('0x24')]);if(_0xf34a9e['name']){delete _0xf34a9e[_0xdd18('0x25')];}_0x3bf1d7[_0xdd18('0x18')](_0x16c313)[_0xdd18('0x26')](_0xf34a9e);};}exports[_0xdd18('0x27')]=function(_0x2b6238,_0x48cf78){var _0x5f401d={},_0x2fb1a2={},_0x495bbf={'count':0x0,'rows':[]};var _0x366013=_[_0xdd18('0x28')](db[_0xdd18('0x29')][_0xdd18('0x2a')],function(_0x3f6ed1){return{'name':_0x3f6ed1[_0xdd18('0x2b')],'type':_0x3f6ed1['type'][_0xdd18('0x2c')]};});_0x2fb1a2[_0xdd18('0x2d')]=_['map'](_0x366013,'name');_0x2fb1a2[_0xdd18('0x2e')]=_[_0xdd18('0x2f')](_0x2b6238[_0xdd18('0x2e')]);_0x2fb1a2[_0xdd18('0x30')]=_[_0xdd18('0x31')](_0x2fb1a2[_0xdd18('0x2d')],_0x2fb1a2[_0xdd18('0x2e')]);_0x5f401d[_0xdd18('0x32')]=_[_0xdd18('0x31')](_0x2fb1a2[_0xdd18('0x2d')],qs[_0xdd18('0x33')](_0x2b6238[_0xdd18('0x2e')][_0xdd18('0x33')]));_0x5f401d[_0xdd18('0x32')]=_0x5f401d[_0xdd18('0x32')][_0xdd18('0x34')]?_0x5f401d[_0xdd18('0x32')]:_0x2fb1a2[_0xdd18('0x2d')];if(!_0x2b6238[_0xdd18('0x2e')]['hasOwnProperty'](_0xdd18('0x35'))){_0x5f401d[_0xdd18('0x1b')]=qs[_0xdd18('0x1b')](_0x2b6238['query'][_0xdd18('0x1b')]);_0x5f401d[_0xdd18('0x19')]=qs[_0xdd18('0x19')](_0x2b6238[_0xdd18('0x2e')][_0xdd18('0x19')]);}_0x5f401d[_0xdd18('0x36')]=qs['sort'](_0x2b6238[_0xdd18('0x2e')][_0xdd18('0x37')]);_0x5f401d['where']=qs[_0xdd18('0x30')](_[_0xdd18('0x38')](_0x2b6238[_0xdd18('0x2e')],_0x2fb1a2[_0xdd18('0x30')]),_0x366013);if(_0x2b6238[_0xdd18('0x2e')]['filter']){_0x5f401d['where']=_[_0xdd18('0x39')](_0x5f401d[_0xdd18('0x3a')],{'$or':_[_0xdd18('0x28')](_0x366013,function(_0x5ba7fa){if(_0x5ba7fa[_0xdd18('0x3b')]!=='VIRTUAL'){var _0x1dd6c3={};_0x1dd6c3[_0x5ba7fa[_0xdd18('0x25')]]={'$like':'%'+_0x2b6238[_0xdd18('0x2e')][_0xdd18('0x3c')]+'%'};return _0x1dd6c3;}})});}_0x5f401d=_[_0xdd18('0x39')]({},_0x5f401d,_0x2b6238[_0xdd18('0x3d')]);var _0x5aaf84={'where':_0x5f401d[_0xdd18('0x3a')]};return db[_0xdd18('0x29')][_0xdd18('0x1c')](_0x5aaf84)[_0xdd18('0x22')](function(_0x214d32){_0x495bbf[_0xdd18('0x1c')]=_0x214d32;if(_0x2b6238['query'][_0xdd18('0x3e')]){_0x5f401d[_0xdd18('0x3f')]=[{'all':!![]}];}return db['Team'][_0xdd18('0x40')](_0x5f401d);})[_0xdd18('0x22')](function(_0x1ac43b){_0x495bbf[_0xdd18('0x41')]=_0x1ac43b;return _0x495bbf;})['then'](respondWithFilteredResult(_0x48cf78,_0x5f401d))[_0xdd18('0x42')](handleError(_0x48cf78,null));};exports[_0xdd18('0x43')]=function(_0x47a0ca,_0x325b24){var _0x2acaca={'raw':![],'where':{'id':_0x47a0ca['params']['id']}},_0xae94da={};_0xae94da[_0xdd18('0x2d')]=_['keys'](db[_0xdd18('0x29')]['rawAttributes']);_0xae94da['query']=_[_0xdd18('0x2f')](_0x47a0ca[_0xdd18('0x2e')]);_0xae94da['filters']=_[_0xdd18('0x31')](_0xae94da[_0xdd18('0x2d')],_0xae94da[_0xdd18('0x2e')]);_0x2acaca[_0xdd18('0x32')]=_['intersection'](_0xae94da[_0xdd18('0x2d')],qs[_0xdd18('0x33')](_0x47a0ca[_0xdd18('0x2e')]['fields']));_0x2acaca[_0xdd18('0x32')]=_0x2acaca[_0xdd18('0x32')][_0xdd18('0x34')]?_0x2acaca['attributes']:_0xae94da[_0xdd18('0x2d')];if(_0x47a0ca[_0xdd18('0x2e')]['includeAll']){_0x2acaca[_0xdd18('0x3f')]=[{'all':!![]}];}_0x2acaca=_[_0xdd18('0x39')]({},_0x2acaca,_0x47a0ca['options']);return db[_0xdd18('0x29')][_0xdd18('0x44')](_0x2acaca)[_0xdd18('0x22')](handleEntityNotFound(_0x325b24,null))[_0xdd18('0x22')](respondWithResult(_0x325b24,null))['catch'](handleError(_0x325b24,null));};exports[_0xdd18('0x45')]=function(_0x405d78,_0x4b214e){return db[_0xdd18('0x29')][_0xdd18('0x45')](_0x405d78['body'],{})[_0xdd18('0x22')](function(_0x501835){var _0x473929=_0x405d78[_0xdd18('0x46')][_0xdd18('0x47')]({'plain':!![]});if(!_0x473929)throw new Error(_0xdd18('0x48'));if(_0x473929[_0xdd18('0x49')]===_0xdd18('0x46')){var _0x50011f=_0x501835[_0xdd18('0x47')]({'plain':!![]});var _0x5eb0a3=_0xdd18('0x4a');return db[_0xdd18('0x4b')][_0xdd18('0x44')]({'where':{'name':_0x5eb0a3,'userProfileId':_0x473929['userProfileId']},'raw':!![]})[_0xdd18('0x22')](function(_0x2a42f0){if(_0x2a42f0&&_0x2a42f0[_0xdd18('0x4c')]===0x0){return db[_0xdd18('0x4d')]['create']({'name':_0x50011f['name'],'resourceId':_0x50011f['id'],'type':_0x2a42f0[_0xdd18('0x25')],'sectionId':_0x2a42f0['id']},{})[_0xdd18('0x22')](function(){return _0x501835;});}else{return _0x501835;}})[_0xdd18('0x42')](function(_0x9725e7){logger['error'](_0xdd18('0x4e'),_0x9725e7);throw _0x9725e7;});}return _0x501835;})[_0xdd18('0x22')](respondWithResult(_0x4b214e,0xc9))['catch'](handleError(_0x4b214e,null));};exports[_0xdd18('0x4f')]=function(_0x272fb9,_0x7e7be){if(_0x272fb9[_0xdd18('0x50')]['id']){delete _0x272fb9[_0xdd18('0x50')]['id'];}return db[_0xdd18('0x29')][_0xdd18('0x44')]({'where':{'id':_0x272fb9['params']['id']}})[_0xdd18('0x22')](handleEntityNotFound(_0x7e7be,null))['then'](saveUpdates(_0x272fb9[_0xdd18('0x50')],null))[_0xdd18('0x22')](respondWithResult(_0x7e7be,null))[_0xdd18('0x42')](handleError(_0x7e7be,null));};exports[_0xdd18('0x51')]=function(_0x5b9df4,_0x15687e){var _0x3c4658=_0x5b9df4[_0xdd18('0x52')]['id'];var _0x20dfe7=[];return db[_0xdd18('0x53')][_0xdd18('0x54')](function(_0x11bd0b){var _0xc0fb79=_0xdd18('0x55')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0xc0fb79,{'type':db['Sequelize'][_0xdd18('0x56')]['SELECT'],'raw':!![],'transaction':_0x11bd0b})[_0xdd18('0x22')](function(_0x337c6e){_0x20dfe7=_[_0xdd18('0x28')](_0x337c6e,function(_0x1e3369){return Number(_0x1e3369[_0xdd18('0x57')]);});})[_0xdd18('0x22')](function(){var _0x1c7aa7=_0xdd18('0x58')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x1c7aa7,{'type':db['Sequelize'][_0xdd18('0x56')]['SELECT'],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0x515bfa){var _0x438009=_[_0xdd18('0x28')](_0x515bfa,function(_0x460130){return Number(_0x460130['VoiceQueueId']);});return db[_0xdd18('0x59')]['destroy']({'where':{'UserId':{'$in':_0x20dfe7},'VoiceQueueId':{'$in':_0x438009}},'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(){var _0x559344=_0xdd18('0x5a')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x559344,{'type':db['Sequelize'][_0xdd18('0x56')][_0xdd18('0x5b')],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0xab2df5){var _0x1bc8b4=_[_0xdd18('0x28')](_0xab2df5,function(_0x1a7d96){return Number(_0x1a7d96[_0xdd18('0x5c')]);});return db[_0xdd18('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x20dfe7},'MailQueueId':{'$in':_0x1bc8b4}},'transaction':_0x11bd0b});})['then'](function(){var _0x11c416='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x11c416,{'type':db[_0xdd18('0x5e')][_0xdd18('0x56')][_0xdd18('0x5b')],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0xb15649){var _0x40d5b4=_['map'](_0xb15649,function(_0x4284d4){return Number(_0x4284d4['SmsQueueId']);});return db[_0xdd18('0x5f')][_0xdd18('0x51')]({'where':{'UserId':{'$in':_0x20dfe7},'SmsQueueId':{'$in':_0x40d5b4}},'transaction':_0x11bd0b});})['then'](function(){var _0x191284=_0xdd18('0x60')+_0x3c4658;return db[_0xdd18('0x53')]['query'](_0x191284,{'type':db[_0xdd18('0x5e')][_0xdd18('0x56')][_0xdd18('0x5b')],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0x1d067d){var _0x329fcc=_[_0xdd18('0x28')](_0x1d067d,function(_0x46b684){return Number(_0x46b684[_0xdd18('0x61')]);});return db[_0xdd18('0x62')][_0xdd18('0x51')]({'where':{'UserId':{'$in':_0x20dfe7},'ChatQueueId':{'$in':_0x329fcc}},'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(){var _0x3739bf=_0xdd18('0x63')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x3739bf,{'type':db[_0xdd18('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x11bd0b});})['then'](function(_0x441da5){var _0x598060=_['map'](_0x441da5,function(_0x57aeec){return Number(_0x57aeec['FaxQueueId']);});return db[_0xdd18('0x64')]['destroy']({'where':{'UserId':{'$in':_0x20dfe7},'FaxQueueId':{'$in':_0x598060}},'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(){var _0x10f00f=_0xdd18('0x65')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x10f00f,{'type':db[_0xdd18('0x5e')]['QueryTypes'][_0xdd18('0x5b')],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0x32423c){var _0x40339c=_[_0xdd18('0x28')](_0x32423c,function(_0x3e238f){return Number(_0x3e238f[_0xdd18('0x66')]);});return db[_0xdd18('0x67')][_0xdd18('0x51')]({'where':{'UserId':{'$in':_0x20dfe7},'OpenchannelQueueId':{'$in':_0x40339c}},'transaction':_0x11bd0b});})['then'](function(){var _0x46ca7c=_0xdd18('0x68')+_0x3c4658;return db[_0xdd18('0x53')][_0xdd18('0x2e')](_0x46ca7c,{'type':db[_0xdd18('0x5e')][_0xdd18('0x56')][_0xdd18('0x5b')],'raw':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0x32af66){var _0x4a376e=_[_0xdd18('0x28')](_0x32af66,function(_0x35ff67){return Number(_0x35ff67[_0xdd18('0x69')]);});return db['UserWhatsappQueue'][_0xdd18('0x51')]({'where':{'UserId':{'$in':_0x20dfe7},'WhatsappQueueId':{'$in':_0x4a376e}},'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(){return db[_0xdd18('0x6a')]['find']({'where':{'TeamId':_0x3c4658}});})['then'](function(_0x107a2b){if(_0x107a2b===null){return;}return db['UserVoicePrefix'][_0xdd18('0x51')]({'where':{'UserId':{'$in':_0x20dfe7},'VoicePrefixId':_0x107a2b['VoicePrefixId']},'transaction':_0x11bd0b});})['then'](function(){return db['Team'][_0xdd18('0x51')]({'where':{'id':_0x3c4658},'cascade':!![],'transaction':_0x11bd0b});})[_0xdd18('0x22')](function(_0x35575d){if(_0x35575d===0x0){_0x15687e[_0xdd18('0x17')](0x194);}else{return db[_0xdd18('0x4d')][_0xdd18('0x51')]({'where':{'type':'Teams','resourceId':_0x3c4658},'cascade':!![],'transaction':_0x11bd0b})['then'](function(){_0x15687e[_0xdd18('0x18')](0xcc)['end']();});}})[_0xdd18('0x42')](function(_0x492285){_0x15687e[_0xdd18('0x18')](0x1f4)[_0xdd18('0x26')](_0x492285);});});};exports[_0xdd18('0x6b')]=function(_0x1c4a59,_0x4a6ef1,_0x27111f){return db[_0xdd18('0x29')][_0xdd18('0x6c')]({'where':{'id':_0x1c4a59['params']['id']}})[_0xdd18('0x22')](handleEntityNotFound(_0x4a6ef1,null))['then'](function(_0x55d76f){if(!_0x1c4a59[_0xdd18('0x2e')][_0xdd18('0x6d')]||!utils[_0xdd18('0x6e')](_0x1c4a59[_0xdd18('0x2e')]['channel'])){throw new db[(_0xdd18('0x5e'))]['ValidationError'](_0xdd18('0x6f'));}var _0x3399a0={};var _0x39f0c1={};_0x39f0c1['model']=_[_0xdd18('0x2f')](db[_[_0xdd18('0x70')](_0x1c4a59['query'][_0xdd18('0x6d')][_0xdd18('0x71')]())+_0xdd18('0x72')][_0xdd18('0x2a')]);_0x39f0c1['query']=_[_0xdd18('0x2f')](_0x1c4a59[_0xdd18('0x2e')]);_0x39f0c1[_0xdd18('0x30')]=_['intersection'](_0x39f0c1['model'],_0x39f0c1[_0xdd18('0x2e')]);_0x3399a0[_0xdd18('0x32')]=_[_0xdd18('0x31')](_0x39f0c1[_0xdd18('0x2d')],qs['fields'](_0x1c4a59[_0xdd18('0x2e')][_0xdd18('0x33')]));_0x3399a0[_0xdd18('0x32')]=_0x3399a0['attributes'][_0xdd18('0x34')]?_0x3399a0['attributes']:_0x39f0c1[_0xdd18('0x2d')];_0x3399a0[_0xdd18('0x1b')]=qs[_0xdd18('0x1b')](_0x1c4a59[_0xdd18('0x2e')][_0xdd18('0x1b')]);_0x3399a0['offset']=qs[_0xdd18('0x19')](_0x1c4a59['query'][_0xdd18('0x19')]);_0x3399a0[_0xdd18('0x36')]=qs[_0xdd18('0x37')](_0x1c4a59[_0xdd18('0x2e')]['sort']);_0x3399a0[_0xdd18('0x3a')]=qs['filters'](_[_0xdd18('0x38')](_0x1c4a59[_0xdd18('0x2e')],_0x39f0c1[_0xdd18('0x30')]));_0x3399a0=_['merge']({},_0x3399a0,_0x1c4a59['options']);return _0x55d76f[_0xdd18('0x47')+_[_0xdd18('0x70')](_0x1c4a59[_0xdd18('0x2e')][_0xdd18('0x6d')][_0xdd18('0x71')]())+_0xdd18('0x73')](_0x3399a0);})[_0xdd18('0x22')](respondWithResult(_0x4a6ef1,null))['catch'](handleError(_0x4a6ef1,null));};exports['addQueues']=function(_0x5b8f47,_0x78a1a2,_0x52bca1){return db['Team'][_0xdd18('0x6c')]({'where':{'id':_0x5b8f47[_0xdd18('0x52')]['id']}})[_0xdd18('0x22')](function(_0x1ec81d){if(_0x1ec81d){if(!_0x5b8f47[_0xdd18('0x50')]['channel']||!utils[_0xdd18('0x6e')](_0x5b8f47[_0xdd18('0x50')][_0xdd18('0x6d')])){throw new db['Sequelize']['ValidationError'](_0xdd18('0x6f'));}return _0x1ec81d[_0xdd18('0x74')+_[_0xdd18('0x70')](_0x5b8f47[_0xdd18('0x50')][_0xdd18('0x6d')][_0xdd18('0x71')]())+_0xdd18('0x73')](_0x5b8f47[_0xdd18('0x50')][_0xdd18('0x75')]);}return null;})[_0xdd18('0x22')](handleEntityNotFound(_0x78a1a2,null))['then'](respondWithStatusCode(_0x78a1a2,null))[_0xdd18('0x42')](handleError(_0x78a1a2,null));};exports['removeQueues']=function(_0x9d1cb6,_0x1e560c,_0x38f68c){return db[_0xdd18('0x29')][_0xdd18('0x6c')]({'where':{'id':_0x9d1cb6[_0xdd18('0x52')]['id']}})[_0xdd18('0x22')](function(_0x1c02c6){if(_0x1c02c6){if(!_0x9d1cb6[_0xdd18('0x2e')][_0xdd18('0x6d')]||!utils['isValidChannel'](_0x9d1cb6[_0xdd18('0x2e')]['channel'])){throw new db[(_0xdd18('0x5e'))][(_0xdd18('0x76'))](_0xdd18('0x6f'));}return _0x1c02c6[_0xdd18('0x77')+_[_0xdd18('0x70')](_0x9d1cb6['query'][_0xdd18('0x6d')]['toLowerCase']())+_0xdd18('0x73')](_0x9d1cb6[_0xdd18('0x2e')][_0xdd18('0x75')]);}return null;})[_0xdd18('0x22')](handleEntityNotFound(_0x1e560c,null))['then'](respondWithStatusCode(_0x1e560c,null))[_0xdd18('0x42')](handleError(_0x1e560c,null));};exports[_0xdd18('0x78')]=function(_0x2fddc9,_0x496e60){var _0x30bb88=_[_0xdd18('0x79')](_0x2fddc9[_0xdd18('0x50')][_0xdd18('0x75')])?_0x2fddc9[_0xdd18('0x50')][_0xdd18('0x75')]:[_0x2fddc9[_0xdd18('0x50')][_0xdd18('0x75')]];var _0x2a5179=_0x2fddc9[_0xdd18('0x52')]['id'];return db[_0xdd18('0x29')][_0xdd18('0x44')]({'where':{'id':_0x2a5179}})[_0xdd18('0x22')](handleEntityNotFound(_0x496e60,null))['then'](function(_0x45ad21){if(_0x45ad21){var _0x3577b6=[_0xdd18('0x7a'),_0xdd18('0x7b'),_0xdd18('0x7c'),_0xdd18('0x7d'),_0xdd18('0x7e'),_0xdd18('0x7f'),_0xdd18('0x80')];return db[_0xdd18('0x53')][_0xdd18('0x54')](function(_0x7f4622){var _0x6ffb84=_[_0xdd18('0x28')](_0x3577b6,function(_0x3eb16c){var _0x38ae33={'attributes':['id',_0xdd18('0x25')]};if(_0x3eb16c===_0xdd18('0x7a')){_0x38ae33['through']={'attributes':[_0xdd18('0x81')]};}return _0x45ad21[_0xdd18('0x47')+_0x3eb16c+_0xdd18('0x73')](_0x38ae33)[_0xdd18('0x22')](function(_0x5007b4){var _0x516951=_['map'](_0x5007b4,function(_0x18ac30){var _0x1c4ba4=_['map'](_0x30bb88,function(_0x39eacc){var _0x2a70b2={'where':{'UserId':_0x39eacc,[_0x3eb16c+_0xdd18('0x82')]:_0x18ac30['id']},'transaction':_0x7f4622};if(_0x3eb16c==='Voice'){_0x2a70b2['defaults']={'penalty':_0x18ac30[_0xdd18('0x83')][_0xdd18('0x81')]};}return db['User'+_0x3eb16c+'Queue'][_0xdd18('0x84')](_0x2a70b2)['then'](function(){socket[_0xdd18('0x85')]('user'+_0x3eb16c+'Queue:save',{'UserId':_0x39eacc,[_0x3eb16c+_0xdd18('0x82')]:_0x18ac30['id']});if(_0x3eb16c!==_0xdd18('0x7a')){return;}return db['User'][_0xdd18('0x40')]({'where':{'id':_0x30bb88,'online':0x1},'attributes':['id','name',_0xdd18('0x86'),_0xdd18('0x87'),_0xdd18('0x88')],'raw':!![]})[_0xdd18('0x22')](function(_0x20c2e8){var _0x39a9f4=_[_0xdd18('0x28')](_0x20c2e8,function(_0x293574){return db[_0xdd18('0x89')][_0xdd18('0x8a')]({'membername':_0x293574[_0xdd18('0x25')],'UserId':_0x293574['id'],'queue_name':_0x18ac30[_0xdd18('0x25')],'VoiceQueueId':_0x18ac30['id'],'interface':_[_0xdd18('0x8b')](_0x293574[_0xdd18('0x88')])?util[_0xdd18('0x8c')]('SIP/%s',_0x293574[_0xdd18('0x25')]):_0x293574[_0xdd18('0x88')],'paused':_0x293574[_0xdd18('0x87')]||![],'penalty':_0x18ac30[_0xdd18('0x83')][_0xdd18('0x81')]},{'transaction':_0x7f4622});});return Promise[_0xdd18('0x8d')](_0x39a9f4);});});});return Promise[_0xdd18('0x8d')](_0x1c4ba4);});return Promise[_0xdd18('0x8d')](_0x516951);})[_0xdd18('0x22')](function(){return db[_0xdd18('0x6a')]['findOne']({'where':{'teamId':_0x2a5179}})['then'](function(_0x44c0bb){if(_0x44c0bb){var _0x5f33e9=_['map'](_0x30bb88,function(_0x4cde90){db[_0xdd18('0x8e')][_0xdd18('0x8a')]({'UserId':_0x4cde90,'VoicePrefixId':_0x44c0bb['VoicePrefixId']});});return Promise[_0xdd18('0x8d')](_0x5f33e9);}});});});return Promise[_0xdd18('0x8d')](_0x6ffb84)[_0xdd18('0x22')](function(){return _0x45ad21[_0xdd18('0x78')](_0x30bb88,{'transaction':_0x7f4622})[_0xdd18('0x8f')](function(_0x59e895){return _0x59e895;});});});}})[_0xdd18('0x22')](respondWithResult(_0x496e60,null))[_0xdd18('0x42')](handleError(_0x496e60,null));};exports[_0xdd18('0x90')]=function(_0x738c18,_0x36c384){var _0x184260=_[_0xdd18('0x79')](_0x738c18[_0xdd18('0x2e')][_0xdd18('0x75')])?_0x738c18[_0xdd18('0x2e')][_0xdd18('0x75')]:[_0x738c18['query'][_0xdd18('0x75')]];var _0x53a780=_0x738c18['params']['id'];return db[_0xdd18('0x29')]['find']({'where':{'id':_0x53a780}})[_0xdd18('0x22')](handleEntityNotFound(_0x36c384,null))['then'](function(_0x4fd1b1){if(_0x4fd1b1){var _0x382db4=[_0xdd18('0x7a'),'Chat',_0xdd18('0x7c'),_0xdd18('0x7d'),_0xdd18('0x7e'),_0xdd18('0x7f'),_0xdd18('0x80')];return db[_0xdd18('0x53')][_0xdd18('0x54')](function(_0x432b02){var _0x29130e=_[_0xdd18('0x28')](_0x382db4,function(_0x4bfb55){var _0x55ffb3={'attributes':['id',_0xdd18('0x25')]};return _0x4fd1b1[_0xdd18('0x47')+_0x4bfb55+_0xdd18('0x73')](_0x55ffb3)['then'](function(_0x12ccbc){var _0xe4797a=_[_0xdd18('0x28')](_0x12ccbc,function(_0x148a69){return _0x148a69[_0xdd18('0x90')](_0x184260,{'transaction':_0x432b02})[_0xdd18('0x22')](function(){var _0x168da6=_[_0xdd18('0x28')](_0x184260,function(_0x4397dc){socket['emit']('user'+_0x4bfb55+_0xdd18('0x91'),{'UserId':Number(_0x4397dc),[_0x4bfb55+_0xdd18('0x82')]:_0x148a69['id']});if(_0x4bfb55!==_0xdd18('0x7a')){return;}return db[_0xdd18('0x89')][_0xdd18('0x51')]({'where':{'VoiceQueueId':_0x148a69['id'],'UserId':_0x4397dc},'transaction':_0x432b02});});return Promise[_0xdd18('0x8d')](_0x168da6);});});return Promise[_0xdd18('0x8d')](_0xe4797a);});});return Promise[_0xdd18('0x8d')](_0x29130e)[_0xdd18('0x22')](function(){return _0x4fd1b1['removeAgents'](_0x184260,{'transaction':_0x432b02});})[_0xdd18('0x22')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x53a780}})[_0xdd18('0x22')](function(_0x1b8b5a){if(_0x1b8b5a){var _0xd3aa10=_['map'](_0x184260,function(_0x3a6775){db[_0xdd18('0x8e')][_0xdd18('0x51')]({'where':{'UserId':_0x3a6775,'VoicePrefixId':_0x1b8b5a['VoicePrefixId']}});});return Promise[_0xdd18('0x8d')](_0xd3aa10);}});});});}})['then'](respondWithStatusCode(_0x36c384,null))[_0xdd18('0x42')](handleError(_0x36c384,null));};exports[_0xdd18('0x92')]=function(_0xdabf5a,_0x3eef5d,_0x29d14e){var _0x46bbf0={};var _0x22b09e={};var _0x19fed4;var _0x1f63b7;return db['Team']['findOne']({'where':{'id':_0xdabf5a['params']['id']}})[_0xdd18('0x22')](handleEntityNotFound(_0x3eef5d,null))[_0xdd18('0x22')](function(_0x115bf6){if(_0x115bf6){_0x19fed4=_0x115bf6;_0x22b09e[_0xdd18('0x2d')]=_[_0xdd18('0x2f')](db[_0xdd18('0x93')][_0xdd18('0x2a')]);_0x22b09e[_0xdd18('0x2e')]=_[_0xdd18('0x2f')](_0xdabf5a[_0xdd18('0x2e')]);_0x22b09e[_0xdd18('0x30')]=_[_0xdd18('0x31')](_0x22b09e['model'],_0x22b09e[_0xdd18('0x2e')]);_0x46bbf0[_0xdd18('0x32')]=_[_0xdd18('0x31')](_0x22b09e[_0xdd18('0x2d')],qs[_0xdd18('0x33')](_0xdabf5a[_0xdd18('0x2e')]['fields']));_0x46bbf0[_0xdd18('0x32')]=_0x46bbf0[_0xdd18('0x32')][_0xdd18('0x34')]?_0x46bbf0[_0xdd18('0x32')]:_0x22b09e[_0xdd18('0x2d')];_0x46bbf0['order']=qs[_0xdd18('0x37')](_0xdabf5a[_0xdd18('0x2e')][_0xdd18('0x37')]);_0x46bbf0[_0xdd18('0x3a')]=qs[_0xdd18('0x30')](_['pick'](_0xdabf5a['query'],_0x22b09e[_0xdd18('0x30')]));if(_0xdabf5a['query'][_0xdd18('0x3c')]){_0x46bbf0[_0xdd18('0x3a')]=_[_0xdd18('0x39')](_0x46bbf0[_0xdd18('0x3a')],{'$or':_[_0xdd18('0x28')](_0x46bbf0[_0xdd18('0x32')],function(_0x3d9fb6){var _0x1fcf1b={};_0x1fcf1b[_0x3d9fb6]={'$like':'%'+_0xdabf5a[_0xdd18('0x2e')][_0xdd18('0x3c')]+'%'};return _0x1fcf1b;})});}_0x46bbf0=_[_0xdd18('0x39')]({},_0x46bbf0,_0xdabf5a[_0xdd18('0x3d')]);return _0x19fed4[_0xdd18('0x92')](_0x46bbf0);}})[_0xdd18('0x22')](function(_0x38a063){if(_0x38a063){_0x1f63b7=_0x38a063[_0xdd18('0x34')];if(!_0xdabf5a['query'][_0xdd18('0x94')](_0xdd18('0x35'))){_0x46bbf0[_0xdd18('0x1b')]=qs[_0xdd18('0x1b')](_0xdabf5a[_0xdd18('0x2e')][_0xdd18('0x1b')]);_0x46bbf0['offset']=qs[_0xdd18('0x19')](_0xdabf5a[_0xdd18('0x2e')][_0xdd18('0x19')]);}return _0x19fed4[_0xdd18('0x92')](_0x46bbf0);}})['then'](function(_0x4ca66f){if(_0x4ca66f){return _0x4ca66f?{'count':_0x1f63b7,'rows':_0x4ca66f}:null;}})[_0xdd18('0x22')](respondWithResult(_0x3eef5d,null))[_0xdd18('0x42')](handleError(_0x3eef5d,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 03882ef..3315f92 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 _0x0e63=['update','remove','emit','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x4f37e2,_0x1f5ddf){var _0x177e10=function(_0x1d7493){while(--_0x1d7493){_0x4f37e2['push'](_0x4f37e2['shift']());}};_0x177e10(++_0x1f5ddf);}(_0x0e63,0x190));var _0x30e6=function(_0x5ac2e3,_0x31cc81){_0x5ac2e3=_0x5ac2e3-0x0;var _0x1cf218=_0x0e63[_0x5ac2e3];return _0x1cf218;};'use strict';var EventEmitter=require(_0x30e6('0x0'));var Team=require(_0x30e6('0x1'))['db'][_0x30e6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x30e6('0x3')](0x0);var events={'afterCreate':_0x30e6('0x4'),'afterUpdate':_0x30e6('0x5'),'afterDestroy':_0x30e6('0x6')};function emitEvent(_0x98fa7){return function(_0xaa710d,_0x289b79,_0x44ebe9){TeamEvents[_0x30e6('0x7')](_0x98fa7+':'+_0xaa710d['id'],_0xaa710d);TeamEvents[_0x30e6('0x7')](_0x98fa7,_0xaa710d);_0x44ebe9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x30e6('0x8')]=TeamEvents; \ No newline at end of file +var _0x6759=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x2f7176,_0x2c6471){var _0x45a260=function(_0x11af07){while(--_0x11af07){_0x2f7176['push'](_0x2f7176['shift']());}};_0x45a260(++_0x2c6471);}(_0x6759,0x10d));var _0x9675=function(_0x4df671,_0x12b67f){_0x4df671=_0x4df671-0x0;var _0x3f9658=_0x6759[_0x4df671];return _0x3f9658;};'use strict';var EventEmitter=require('events');var Team=require(_0x9675('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9675('0x1')](0x0);var events={'afterCreate':_0x9675('0x2'),'afterUpdate':_0x9675('0x3'),'afterDestroy':_0x9675('0x4')};function emitEvent(_0x56f0c0){return function(_0x2398ff,_0xb6dc99,_0xc856e5){TeamEvents[_0x9675('0x5')](_0x56f0c0+':'+_0x2398ff['id'],_0x2398ff);TeamEvents[_0x9675('0x5')](_0x56f0c0,_0x2398ff);_0xc856e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9675('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 406b12a..27d6504 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 _0xf635=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams','lodash'];(function(_0x1def93,_0x1adede){var _0x35199a=function(_0x44051a){while(--_0x44051a){_0x1def93['push'](_0x1def93['shift']());}};_0x35199a(++_0x1adede);}(_0xf635,0xc2));var _0x5f63=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0xf635[_0x1e0c0e];return _0x53fecc;};'use strict';var _=require(_0x5f63('0x0'));var util=require(_0x5f63('0x1'));var logger=require(_0x5f63('0x2'))(_0x5f63('0x3'));var moment=require('moment');var BPromise=require(_0x5f63('0x4'));var rp=require(_0x5f63('0x5'));var fs=require('fs');var path=require(_0x5f63('0x6'));var rimraf=require(_0x5f63('0x7'));var config=require(_0x5f63('0x8'));var attributes=require('./team.attributes');module[_0x5f63('0x9')]=function(_0xfb97fa,_0x29fae5){return _0xfb97fa[_0x5f63('0xa')](_0x5f63('0xb'),attributes,{'tableName':_0x5f63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3fe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x5df25b,_0x1bc928){var _0x19f252=function(_0x41de28){while(--_0x41de28){_0x5df25b['push'](_0x5df25b['shift']());}};_0x19f252(++_0x1bc928);}(_0xa3fe,0xf4));var _0xea3f=function(_0x1c67ba,_0x3a95cf){_0x1c67ba=_0x1c67ba-0x0;var _0x3b139a=_0xa3fe[_0x1c67ba];return _0x3b139a;};'use strict';var _=require(_0xea3f('0x0'));var util=require(_0xea3f('0x1'));var logger=require(_0xea3f('0x2'))(_0xea3f('0x3'));var moment=require(_0xea3f('0x4'));var BPromise=require(_0xea3f('0x5'));var rp=require(_0xea3f('0x6'));var fs=require('fs');var path=require(_0xea3f('0x7'));var rimraf=require(_0xea3f('0x8'));var config=require(_0xea3f('0x9'));var attributes=require(_0xea3f('0xa'));module[_0xea3f('0xb')]=function(_0x4da87a,_0x1cc38b){return _0x4da87a[_0xea3f('0xc')]('Team',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 08525ca..c901c66 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 _0x473a=['../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x473a,0x1a4));var _0xa473=function(_0x227b3c,_0x122a91){_0x227b3c=_0x227b3c-0x0;var _0x39ada5=_0x473a[_0x227b3c];return _0x39ada5;};'use strict';var _=require(_0xa473('0x0'));var util=require(_0xa473('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa473('0x2'));var fs=require('fs');var Redis=require(_0xa473('0x3'));var db=require(_0xa473('0x4'))['db'];var utils=require(_0xa473('0x5'));var logger=require(_0xa473('0x6'))(_0xa473('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa473('0x8')]({'port':0x232a});config[_0xa473('0x9')]=_[_0xa473('0xa')](config[_0xa473('0x9')],{'host':_0xa473('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa473('0xc'))['register'](socket);function respondWithRpcPromise(_0x2f8d1b,_0x3f748e,_0x40e48c){return new BPromise(function(_0x547d74,_0x54b494){return client[_0xa473('0xd')](_0x2f8d1b,_0x40e48c)[_0xa473('0xe')](function(_0x162780){logger['info'](_0xa473('0xf'),_0x3f748e,_0xa473('0x10'));logger[_0xa473('0x11')](_0xa473('0x12'),_0x3f748e,_0xa473('0x10'),JSON['stringify'](_0x162780));if(_0x162780[_0xa473('0x13')]){if(_0x162780[_0xa473('0x13')][_0xa473('0x14')]===0x1f4){logger[_0xa473('0x13')](_0xa473('0xf'),_0x3f748e,_0x162780[_0xa473('0x13')][_0xa473('0x15')]);return _0x54b494(_0x162780[_0xa473('0x13')][_0xa473('0x15')]);}logger['error'](_0xa473('0xf'),_0x3f748e,_0x162780[_0xa473('0x13')][_0xa473('0x15')]);return _0x547d74(_0x162780['error'][_0xa473('0x15')]);}else{logger[_0xa473('0x16')]('Team,\x20%s,\x20%s',_0x3f748e,'request\x20sent');_0x547d74(_0x162780[_0xa473('0x17')]['message']);}})[_0xa473('0x18')](function(_0x35463a){logger['error'](_0xa473('0xf'),_0x3f748e,_0x35463a);_0x54b494(_0x35463a);});});} \ No newline at end of file +var _0xca1f=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0xca1f,0xef));var _0xfca1=function(_0x2f122c,_0x8a9b50){_0x2f122c=_0x2f122c-0x0;var _0x2ca7f1=_0xca1f[_0x2f122c];return _0x2ca7f1;};'use strict';var _=require(_0xfca1('0x0'));var util=require(_0xfca1('0x1'));var moment=require('moment');var BPromise=require(_0xfca1('0x2'));var rs=require(_0xfca1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfca1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfca1('0x5'))(_0xfca1('0x6'));var config=require(_0xfca1('0x7'));var jayson=require(_0xfca1('0x8'));var client=jayson[_0xfca1('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfca1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xfca1('0xb'))(new Redis(config[_0xfca1('0xa')]));require(_0xfca1('0xc'))[_0xfca1('0xd')](socket);function respondWithRpcPromise(_0xa9b63e,_0x17039e,_0x4a0b91){return new BPromise(function(_0x3b8f94,_0x515905){return client[_0xfca1('0xe')](_0xa9b63e,_0x4a0b91)[_0xfca1('0xf')](function(_0x498ab4){logger[_0xfca1('0x10')](_0xfca1('0x11'),_0x17039e,'request\x20sent');logger[_0xfca1('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x17039e,_0xfca1('0x13'),JSON[_0xfca1('0x14')](_0x498ab4));if(_0x498ab4['error']){if(_0x498ab4[_0xfca1('0x15')][_0xfca1('0x16')]===0x1f4){logger[_0xfca1('0x15')](_0xfca1('0x11'),_0x17039e,_0x498ab4[_0xfca1('0x15')]['message']);return _0x515905(_0x498ab4[_0xfca1('0x15')][_0xfca1('0x17')]);}logger[_0xfca1('0x15')](_0xfca1('0x11'),_0x17039e,_0x498ab4[_0xfca1('0x15')][_0xfca1('0x17')]);return _0x3b8f94(_0x498ab4[_0xfca1('0x15')]['message']);}else{logger[_0xfca1('0x10')]('Team,\x20%s,\x20%s',_0x17039e,_0xfca1('0x13'));_0x3b8f94(_0x498ab4[_0xfca1('0x18')][_0xfca1('0x17')]);}})[_0xfca1('0x19')](function(_0xa7f7c){logger['error'](_0xfca1('0x11'),_0x17039e,_0xa7f7c);_0x515905(_0xa7f7c);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 2f55fac..e62fbc7 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 _0x7543=['remove','update','emit','removeListener','register','length','save'];(function(_0x2ecc2d,_0x2cef69){var _0x50766b=function(_0x1313ec){while(--_0x1313ec){_0x2ecc2d['push'](_0x2ecc2d['shift']());}};_0x50766b(++_0x2cef69);}(_0x7543,0xca));var _0x3754=function(_0x92bc95,_0x2dbcc0){_0x92bc95=_0x92bc95-0x0;var _0x1d671e=_0x7543[_0x92bc95];return _0x1d671e;};'use strict';var TeamEvents=require('./team.events');var events=[_0x3754('0x0'),_0x3754('0x1'),_0x3754('0x2')];function createListener(_0x41c08e,_0x34cba1){return function(_0x3af056){_0x34cba1[_0x3754('0x3')](_0x41c08e,_0x3af056);};}function removeListener(_0x276109,_0x3e5e4e){return function(){TeamEvents[_0x3754('0x4')](_0x276109,_0x3e5e4e);};}exports[_0x3754('0x5')]=function(_0x1e49a2){for(var _0x48c22f=0x0,_0x2304fb=events[_0x3754('0x6')];_0x48c22f<_0x2304fb;_0x48c22f++){var _0x11ef76=events[_0x48c22f];var _0x6852d5=createListener('team:'+_0x11ef76,_0x1e49a2);TeamEvents['on'](_0x11ef76,_0x6852d5);}}; \ No newline at end of file +var _0xb7aa=['./team.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7aa,0x11a));var _0xab7a=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xb7aa[_0x41d02a];return _0x4c3983;};'use strict';var TeamEvents=require(_0xab7a('0x0'));var events=[_0xab7a('0x1'),_0xab7a('0x2'),_0xab7a('0x3')];function createListener(_0x1d2507,_0x3eab6c){return function(_0x20b86d){_0x3eab6c[_0xab7a('0x4')](_0x1d2507,_0x20b86d);};}function removeListener(_0x34adc3,_0x3b0621){return function(){TeamEvents['removeListener'](_0x34adc3,_0x3b0621);};}exports[_0xab7a('0x5')]=function(_0x1c761b){for(var _0x2ee412=0x0,_0x29ef15=events['length'];_0x2ee412<_0x29ef15;_0x2ee412++){var _0x99ac82=events[_0x2ee412];var _0x1e3b23=createListener('team:'+_0x99ac82,_0x1c761b);TeamEvents['on'](_0x99ac82,_0x1e3b23);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0fcb055..72155c1 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 _0x1b32=['INTEGER','exports'];(function(_0x4e731a,_0x268b0a){var _0xac9961=function(_0x1f82ab){while(--_0x1f82ab){_0x4e731a['push'](_0x4e731a['shift']());}};_0xac9961(++_0x268b0a);}(_0x1b32,0x85));var _0x21b3=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x1b32[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');module[_0x21b3('0x0')]={'TeamId':{'type':Sequelize[_0x21b3('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x21b3('0x1')]}}; \ No newline at end of file +var _0x4787=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4787,0x148));var _0x7478=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x4787[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');module[_0x7478('0x0')]={'TeamId':{'type':Sequelize[_0x7478('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7478('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 20e7c3d..03d08ec 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 _0x9af1=['../../config/environment','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d885b,_0x37010c){var _0x255e9b=function(_0x50c565){while(--_0x50c565){_0x2d885b['push'](_0x2d885b['shift']());}};_0x255e9b(++_0x37010c);}(_0x9af1,0x68));var _0x19af=function(_0x5aedb2,_0x41d9d5){_0x5aedb2=_0x5aedb2-0x0;var _0x4010a1=_0x9af1[_0x5aedb2];return _0x4010a1;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var logger=require(_0x19af('0x2'))('api');var moment=require(_0x19af('0x3'));var BPromise=require(_0x19af('0x4'));var rp=require(_0x19af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19af('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x19af('0x7')]=function(_0x157fc9,_0x41a50f){return _0x157fc9[_0x19af('0x8')](_0x19af('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb688=['exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x6990bc,_0x16f292){var _0x5ca9ab=function(_0x7e3f32){while(--_0x7e3f32){_0x6990bc['push'](_0x6990bc['shift']());}};_0x5ca9ab(++_0x16f292);}(_0xb688,0xcf));var _0x8b68=function(_0x1c1fa1,_0x31a871){_0x1c1fa1=_0x1c1fa1-0x0;var _0x2496fa=_0xb688[_0x1c1fa1];return _0x2496fa;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 231926d..88e719a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x583800,_0xef7e91){var _0x5720fb=function(_0x261e70){while(--_0x261e70){_0x583800['push'](_0x583800['shift']());}};_0x5720fb(++_0xef7e91);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3fe73d,_0x5edc28){var _0x2646a9=function(_0x59c671){while(--_0x59c671){_0x3fe73d['push'](_0x3fe73d['shift']());}};_0x2646a9(++_0x5edc28);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f58ce68..dc37a88 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 _0x5533=['sequelize','exports','INTEGER'];(function(_0x10ec84,_0x2f71a4){var _0x3d4db0=function(_0x4da4b4){while(--_0x4da4b4){_0x10ec84['push'](_0x10ec84['shift']());}};_0x3d4db0(++_0x2f71a4);}(_0x5533,0xf9));var _0x3553=function(_0x384782,_0x2ebb8d){_0x384782=_0x384782-0x0;var _0x2d5489=_0x5533[_0x384782];return _0x2d5489;};'use strict';var Sequelize=require(_0x3553('0x0'));module[_0x3553('0x1')]={'penalty':{'type':Sequelize[_0x3553('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2691=['sequelize','exports','INTEGER'];(function(_0x1be50b,_0x190884){var _0x112155=function(_0x386804){while(--_0x386804){_0x1be50b['push'](_0x1be50b['shift']());}};_0x112155(++_0x190884);}(_0x2691,0x132));var _0x1269=function(_0x38b58,_0x255a6f){_0x38b58=_0x38b58-0x0;var _0x338fd5=_0x2691[_0x38b58];return _0x338fd5;};'use strict';var Sequelize=require(_0x1269('0x0'));module[_0x1269('0x1')]={'penalty':{'type':Sequelize[_0x1269('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 8c14242..83e184b 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 _0x6597=['../../config/logger','moment','request-promise','./teamVoiceQueue.attributes','exports','define','lodash','util'];(function(_0x11df10,_0x132def){var _0x1b08df=function(_0x336048){while(--_0x336048){_0x11df10['push'](_0x11df10['shift']());}};_0x1b08df(++_0x132def);}(_0x6597,0x16e));var _0x7659=function(_0x1f4c48,_0x1ea65c){_0x1f4c48=_0x1f4c48-0x0;var _0xf40f40=_0x6597[_0x1f4c48];return _0xf40f40;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1159=['define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x2e8d52,_0x93b4e1){var _0x4b0865=function(_0x1dac72){while(--_0x1dac72){_0x2e8d52['push'](_0x2e8d52['shift']());}};_0x4b0865(++_0x93b4e1);}(_0x1159,0xf3));var _0x9115=function(_0x26d481,_0x369892){_0x26d481=_0x26d481-0x0;var _0x3da09e=_0x1159[_0x26d481];return _0x3da09e;};'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/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 5bd9885..3a4ae78 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 _0x208d=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x208d,0xa4));var _0xd208=function(_0x4a4c78,_0x13d5b7){_0x4a4c78=_0x4a4c78-0x0;var _0xd58f32=_0x208d[_0x4a4c78];return _0xd58f32;};'use strict';var _=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var moment=require(_0xd208('0x2'));var BPromise=require(_0xd208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd208('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd208('0x5'));var logger=require(_0xd208('0x6'))(_0xd208('0x7'));var config=require(_0xd208('0x8'));var jayson=require(_0xd208('0x9'));var client=jayson['client'][_0xd208('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6aabd,_0x25008a,_0x521d9c){return new BPromise(function(_0xc03f32,_0x4477a6){return client['request'](_0x6aabd,_0x521d9c)[_0xd208('0xb')](function(_0x406cbb){logger['info'](_0xd208('0xc'),_0x25008a,_0xd208('0xd'));logger[_0xd208('0xe')](_0xd208('0xf'),_0x25008a,'request\x20sent',JSON[_0xd208('0x10')](_0x406cbb));if(_0x406cbb[_0xd208('0x11')]){if(_0x406cbb['error'][_0xd208('0x12')]===0x1f4){logger[_0xd208('0x11')](_0xd208('0xc'),_0x25008a,_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);return _0x4477a6(_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x25008a,_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);return _0xc03f32(_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);}else{logger[_0xd208('0x14')](_0xd208('0xc'),_0x25008a,'request\x20sent');_0xc03f32(_0x406cbb[_0xd208('0x15')][_0xd208('0x13')]);}})['catch'](function(_0x6ac23e){logger['error'](_0xd208('0xc'),_0x25008a,_0x6ac23e);_0x4477a6(_0x6ac23e);});});} \ No newline at end of file +var _0x7d43=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d43,0x12c));var _0x37d4=function(_0x5c5b4a,_0x557f92){_0x5c5b4a=_0x5c5b4a-0x0;var _0x9de325=_0x7d43[_0x5c5b4a];return _0x9de325;};'use strict';var _=require(_0x37d4('0x0'));var util=require('util');var moment=require(_0x37d4('0x1'));var BPromise=require(_0x37d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d4('0x3'));var db=require(_0x37d4('0x4'))['db'];var utils=require(_0x37d4('0x5'));var logger=require(_0x37d4('0x6'))('rpc');var config=require(_0x37d4('0x7'));var jayson=require(_0x37d4('0x8'));var client=jayson[_0x37d4('0x9')][_0x37d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c17c3,_0x43a627,_0x1eaa2f){return new BPromise(function(_0x2625c1,_0x225da3){return client[_0x37d4('0xb')](_0x2c17c3,_0x1eaa2f)[_0x37d4('0xc')](function(_0x32e909){logger[_0x37d4('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x43a627,'request\x20sent');logger[_0x37d4('0xe')](_0x37d4('0xf'),_0x43a627,_0x37d4('0x10'),JSON['stringify'](_0x32e909));if(_0x32e909['error']){if(_0x32e909[_0x37d4('0x11')][_0x37d4('0x12')]===0x1f4){logger[_0x37d4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x43a627,_0x32e909[_0x37d4('0x11')]['message']);return _0x225da3(_0x32e909['error'][_0x37d4('0x13')]);}logger[_0x37d4('0x11')](_0x37d4('0x14'),_0x43a627,_0x32e909['error'][_0x37d4('0x13')]);return _0x2625c1(_0x32e909[_0x37d4('0x11')][_0x37d4('0x13')]);}else{logger['info'](_0x37d4('0x14'),_0x43a627,_0x37d4('0x10'));_0x2625c1(_0x32e909[_0x37d4('0x15')][_0x37d4('0x13')]);}})[_0x37d4('0x16')](function(_0x1da5ef){logger[_0x37d4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x43a627,_0x1da5ef);_0x225da3(_0x1da5ef);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index cadec81..b10594c 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 _0x2cc4=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./template.controller','get'];(function(_0x11c50f,_0x361ddb){var _0x39c015=function(_0x546611){while(--_0x546611){_0x11c50f['push'](_0x11c50f['shift']());}};_0x39c015(++_0x361ddb);}(_0x2cc4,0x1f0));var _0x42cc=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x2cc4[_0xc69f39];return _0x93be41;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require('express');var router=express[_0x42cc('0x4')]();var fs_extra=require(_0x42cc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42cc('0x6'));router[_0x42cc('0x7')]('/',auth[_0x42cc('0x8')](),controller[_0x42cc('0x9')]);router[_0x42cc('0x7')]('/:id',auth[_0x42cc('0x8')](),controller[_0x42cc('0xa')]);router[_0x42cc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42cc('0xc')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0xe')]);router[_0x42cc('0xf')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0x10')]);module[_0x42cc('0x11')]=router; \ No newline at end of file +var _0x078f=['create','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x078f,0x1b4));var _0xf078=function(_0x37377f,_0x3b08e3){_0x37377f=_0x37377f-0x0;var _0x3ffd62=_0x078f[_0x37377f];return _0x3ffd62;};'use strict';var multer=require('multer');var util=require(_0xf078('0x0'));var path=require(_0xf078('0x1'));var timeout=require('connect-timeout');var express=require(_0xf078('0x2'));var router=express[_0xf078('0x3')]();var fs_extra=require(_0xf078('0x4'));var auth=require(_0xf078('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf078('0x6'));var controller=require(_0xf078('0x7'));router[_0xf078('0x8')]('/',auth[_0xf078('0x9')](),controller[_0xf078('0xa')]);router[_0xf078('0x8')](_0xf078('0xb'),auth[_0xf078('0x9')](),controller[_0xf078('0xc')]);router[_0xf078('0xd')]('/',auth['isAuthenticated'](),controller[_0xf078('0xe')]);router['put'](_0xf078('0xb'),auth[_0xf078('0x9')](),controller[_0xf078('0xf')]);router[_0xf078('0x10')]('/:id',auth[_0xf078('0x9')](),controller['destroy']);module[_0xf078('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index fa3dde6..33f60b2 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 _0x1344=['TEXT','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1344,0x1eb));var _0x4134=function(_0x2657c1,_0x50043d){_0x2657c1=_0x2657c1-0x0;var _0x2a94c3=_0x1344[_0x2657c1];return _0x2a94c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4134('0x0')]},'html':{'type':Sequelize[_0x4134('0x1')]}}; \ No newline at end of file +var _0x6c01=['STRING','TEXT','exports'];(function(_0x4bedc7,_0x1416dd){var _0x56a1f3=function(_0x462034){while(--_0x462034){_0x4bedc7['push'](_0x4bedc7['shift']());}};_0x56a1f3(++_0x1416dd);}(_0x6c01,0x1c7));var _0x16c0=function(_0x4de2ee,_0x343134){_0x4de2ee=_0x4de2ee-0x0;var _0x1faaac=_0x6c01[_0x4de2ee];return _0x1faaac;};'use strict';var Sequelize=require('sequelize');module[_0x16c0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x16c0('0x1')]},'html':{'type':Sequelize[_0x16c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c89ed54..7b5df08 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 _0xf426=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','Template','rawAttributes','fieldName','type','key'];(function(_0x41ddb5,_0x5015a5){var _0x213548=function(_0x436654){while(--_0x436654){_0x41ddb5['push'](_0x41ddb5['shift']());}};_0x213548(++_0x5015a5);}(_0xf426,0xb0));var _0x6f42=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0xf426[_0x4498a2];return _0x411aa8;};'use strict';var emlformat=require(_0x6f42('0x0'));var rimraf=require(_0x6f42('0x1'));var zipdir=require(_0x6f42('0x2'));var jsonpatch=require(_0x6f42('0x3'));var rp=require(_0x6f42('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6f42('0x5'));var csv=require(_0x6f42('0x6'));var ejs=require(_0x6f42('0x7'));var fs=require('fs');var fs_extra=require(_0x6f42('0x8'));var _=require(_0x6f42('0x9'));var squel=require('squel');var crypto=require(_0x6f42('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f42('0x6'));var querystring=require(_0x6f42('0xb'));var Papa=require(_0x6f42('0xc'));var Redis=require(_0x6f42('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f42('0xe'));var hardwareService=require(_0x6f42('0xf'));var logger=require(_0x6f42('0x10'))('api');var utils=require(_0x6f42('0x11'));var config=require(_0x6f42('0x12'));var licenseUtil=require(_0x6f42('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52611e,_0x567bbd){_0x567bbd=_0x567bbd||0xcc;return function(_0x5e6035){if(_0x5e6035){return _0x52611e[_0x6f42('0x14')](_0x567bbd);}return _0x52611e['status'](_0x567bbd)[_0x6f42('0x15')]();};}function respondWithResult(_0xdf88ed,_0x2b271c){_0x2b271c=_0x2b271c||0xc8;return function(_0x5df819){if(_0x5df819){return _0xdf88ed[_0x6f42('0x16')](_0x2b271c)[_0x6f42('0x17')](_0x5df819);}};}function respondWithFilteredResult(_0x793104,_0x37ca61){return function(_0x3f63dd){if(_0x3f63dd){var _0x859730=typeof _0x37ca61['offset']==='undefined'&&typeof _0x37ca61[_0x6f42('0x18')]===_0x6f42('0x19');var _0x21fe9a=_0x3f63dd[_0x6f42('0x1a')];var _0x1f5560=_0x859730?0x0:_0x37ca61[_0x6f42('0x1b')];var _0x2d0248=_0x859730?_0x3f63dd[_0x6f42('0x1a')]:_0x37ca61[_0x6f42('0x1b')]+_0x37ca61['limit'];var _0x310c30;if(_0x2d0248>=_0x21fe9a){_0x2d0248=_0x21fe9a;_0x310c30=0xc8;}else{_0x310c30=0xce;}_0x793104[_0x6f42('0x16')](_0x310c30);return _0x793104['set'](_0x6f42('0x1c'),_0x1f5560+'-'+_0x2d0248+'/'+_0x21fe9a)[_0x6f42('0x17')](_0x3f63dd);}return null;};}function patchUpdates(_0x23757b){return function(_0x5c352c){try{jsonpatch[_0x6f42('0x1d')](_0x5c352c,_0x23757b,!![]);}catch(_0x4dbc90){return BPromise['reject'](_0x4dbc90);}return _0x5c352c[_0x6f42('0x1e')]();};}function saveUpdates(_0x19c496,_0x28cd97){return function(_0x38d95d){if(_0x38d95d){return _0x38d95d[_0x6f42('0x1f')](_0x19c496)[_0x6f42('0x20')](function(_0x502f68){return _0x502f68;});}return null;};}function removeEntity(_0x45a977,_0x22de1b){return function(_0x488bb9){if(_0x488bb9){return _0x488bb9['destroy']()[_0x6f42('0x20')](function(){var _0x88de99=_0x488bb9[_0x6f42('0x21')]({'plain':!![]});var _0x368ef9=_0x6f42('0x22');return db[_0x6f42('0x23')][_0x6f42('0x24')]({'where':{'type':_0x368ef9,'resourceId':_0x88de99['id']}})[_0x6f42('0x20')](function(){return _0x488bb9;});})[_0x6f42('0x20')](function(){_0x45a977[_0x6f42('0x16')](0xcc)[_0x6f42('0x15')]();});}};}function handleEntityNotFound(_0x5172b9,_0x563874){return function(_0x5920b2){if(!_0x5920b2){_0x5172b9['sendStatus'](0x194);}return _0x5920b2;};}function handleError(_0x1ea1ca,_0x2607ae){_0x2607ae=_0x2607ae||0x1f4;return function(_0x34b9ef){logger[_0x6f42('0x25')](_0x34b9ef[_0x6f42('0x26')]);if(_0x34b9ef[_0x6f42('0x27')]){delete _0x34b9ef['name'];}_0x1ea1ca['status'](_0x2607ae)[_0x6f42('0x28')](_0x34b9ef);};}exports['index']=function(_0x1106d4,_0x2d5e24){var _0x216daa={},_0x23bec4={},_0x63ddcf={'count':0x0,'rows':[]};var _0x37ee98=_['map'](db[_0x6f42('0x29')][_0x6f42('0x2a')],function(_0x4944cb){return{'name':_0x4944cb[_0x6f42('0x2b')],'type':_0x4944cb[_0x6f42('0x2c')][_0x6f42('0x2d')]};});_0x23bec4[_0x6f42('0x2e')]=_['map'](_0x37ee98,_0x6f42('0x27'));_0x23bec4[_0x6f42('0x2f')]=_[_0x6f42('0x30')](_0x1106d4['query']);_0x23bec4['filters']=_[_0x6f42('0x31')](_0x23bec4[_0x6f42('0x2e')],_0x23bec4['query']);_0x216daa['attributes']=_[_0x6f42('0x31')](_0x23bec4[_0x6f42('0x2e')],qs[_0x6f42('0x32')](_0x1106d4['query'][_0x6f42('0x32')]));_0x216daa[_0x6f42('0x33')]=_0x216daa[_0x6f42('0x33')]['length']?_0x216daa['attributes']:_0x23bec4[_0x6f42('0x2e')];if(!_0x1106d4['query'][_0x6f42('0x34')](_0x6f42('0x35'))){_0x216daa[_0x6f42('0x18')]=qs[_0x6f42('0x18')](_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x18')]);_0x216daa['offset']=qs[_0x6f42('0x1b')](_0x1106d4['query'][_0x6f42('0x1b')]);}_0x216daa['order']=qs[_0x6f42('0x36')](_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x36')]);_0x216daa[_0x6f42('0x37')]=qs[_0x6f42('0x38')](_['pick'](_0x1106d4[_0x6f42('0x2f')],_0x23bec4[_0x6f42('0x38')]),_0x37ee98);if(_0x1106d4[_0x6f42('0x2f')]['filter']){_0x216daa[_0x6f42('0x37')]=_[_0x6f42('0x39')](_0x216daa[_0x6f42('0x37')],{'$or':_[_0x6f42('0x3a')](_0x37ee98,function(_0x9ef9e0){if(_0x9ef9e0[_0x6f42('0x2c')]!==_0x6f42('0x3b')){var _0x64ecd3={};_0x64ecd3[_0x9ef9e0[_0x6f42('0x27')]]={'$like':'%'+_0x1106d4['query']['filter']+'%'};return _0x64ecd3;}})});}_0x216daa=_['merge']({},_0x216daa,_0x1106d4[_0x6f42('0x3c')]);var _0x187a19={'where':_0x216daa[_0x6f42('0x37')]};return db[_0x6f42('0x29')][_0x6f42('0x1a')](_0x187a19)['then'](function(_0x4fcd53){_0x63ddcf[_0x6f42('0x1a')]=_0x4fcd53;if(_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x3d')]){_0x216daa['include']=[{'all':!![]}];}return db[_0x6f42('0x29')][_0x6f42('0x3e')](_0x216daa);})[_0x6f42('0x20')](function(_0x292a3f){_0x63ddcf[_0x6f42('0x3f')]=_0x292a3f;return _0x63ddcf;})[_0x6f42('0x20')](respondWithFilteredResult(_0x2d5e24,_0x216daa))[_0x6f42('0x40')](handleError(_0x2d5e24,null));};exports['show']=function(_0x57093f,_0x49b087){var _0x2a4d7a={'raw':!![],'where':{'id':_0x57093f['params']['id']}},_0x2d2316={};_0x2d2316[_0x6f42('0x2e')]=_[_0x6f42('0x30')](db[_0x6f42('0x29')][_0x6f42('0x2a')]);_0x2d2316[_0x6f42('0x2f')]=_[_0x6f42('0x30')](_0x57093f[_0x6f42('0x2f')]);_0x2d2316['filters']=_['intersection'](_0x2d2316['model'],_0x2d2316[_0x6f42('0x2f')]);_0x2a4d7a[_0x6f42('0x33')]=_[_0x6f42('0x31')](_0x2d2316[_0x6f42('0x2e')],qs['fields'](_0x57093f[_0x6f42('0x2f')]['fields']));_0x2a4d7a[_0x6f42('0x33')]=_0x2a4d7a[_0x6f42('0x33')][_0x6f42('0x41')]?_0x2a4d7a[_0x6f42('0x33')]:_0x2d2316['model'];if(_0x57093f[_0x6f42('0x2f')][_0x6f42('0x3d')]){_0x2a4d7a[_0x6f42('0x42')]=[{'all':!![]}];}_0x2a4d7a=_['merge']({},_0x2a4d7a,_0x57093f[_0x6f42('0x3c')]);return db[_0x6f42('0x29')][_0x6f42('0x43')](_0x2a4d7a)['then'](handleEntityNotFound(_0x49b087,null))['then'](respondWithResult(_0x49b087,null))['catch'](handleError(_0x49b087,null));};exports['create']=function(_0x5008ae,_0x21f286){return db[_0x6f42('0x29')][_0x6f42('0x44')](_0x5008ae['body'],{})[_0x6f42('0x20')](function(_0x4bfd03){var _0x2414bf=_0x5008ae[_0x6f42('0x45')][_0x6f42('0x21')]({'plain':!![]});if(!_0x2414bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2414bf[_0x6f42('0x46')]==='user'){var _0x2439ca=_0x4bfd03[_0x6f42('0x21')]({'plain':!![]});var _0x317496=_0x6f42('0x22');return db['UserProfileSection'][_0x6f42('0x43')]({'where':{'name':_0x317496,'userProfileId':_0x2414bf['userProfileId']},'raw':!![]})[_0x6f42('0x20')](function(_0x1a44fd){if(_0x1a44fd&&_0x1a44fd[_0x6f42('0x47')]===0x0){return db[_0x6f42('0x23')]['create']({'name':_0x2439ca['name'],'resourceId':_0x2439ca['id'],'type':_0x1a44fd[_0x6f42('0x27')],'sectionId':_0x1a44fd['id']},{})[_0x6f42('0x20')](function(){return _0x4bfd03;});}else{return _0x4bfd03;}})[_0x6f42('0x40')](function(_0x1cbb73){logger[_0x6f42('0x25')](_0x6f42('0x48'),_0x1cbb73);throw _0x1cbb73;});}return _0x4bfd03;})['then'](respondWithResult(_0x21f286,0xc9))['catch'](handleError(_0x21f286,null));};exports[_0x6f42('0x1f')]=function(_0x6d831f,_0x55868e){if(_0x6d831f[_0x6f42('0x49')]['id']){delete _0x6d831f[_0x6f42('0x49')]['id'];}return db[_0x6f42('0x29')][_0x6f42('0x43')]({'where':{'id':_0x6d831f['params']['id']}})[_0x6f42('0x20')](handleEntityNotFound(_0x55868e,null))[_0x6f42('0x20')](saveUpdates(_0x6d831f[_0x6f42('0x49')],null))[_0x6f42('0x20')](respondWithResult(_0x55868e,null))[_0x6f42('0x40')](handleError(_0x55868e,null));};exports[_0x6f42('0x24')]=function(_0x31b9ba,_0xbfc53){return db[_0x6f42('0x29')][_0x6f42('0x43')]({'where':{'id':_0x31b9ba['params']['id']}})[_0x6f42('0x20')](handleEntityNotFound(_0xbfc53,null))['then'](removeEntity(_0xbfc53,null))['catch'](handleError(_0xbfc53,null));}; \ No newline at end of file +var _0xec7e=['sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','fields','find','create','body','user','role','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit'];(function(_0x582fd0,_0x411f85){var _0x3ced46=function(_0x1c7cb9){while(--_0x1c7cb9){_0x582fd0['push'](_0x582fd0['shift']());}};_0x3ced46(++_0x411f85);}(_0xec7e,0x69));var _0xeec7=function(_0x702a2,_0x6c81ea){_0x702a2=_0x702a2-0x0;var _0x4741af=_0xec7e[_0x702a2];return _0x4741af;};'use strict';var emlformat=require(_0xeec7('0x0'));var rimraf=require(_0xeec7('0x1'));var zipdir=require(_0xeec7('0x2'));var jsonpatch=require(_0xeec7('0x3'));var rp=require('request-promise');var moment=require(_0xeec7('0x4'));var BPromise=require(_0xeec7('0x5'));var Mustache=require(_0xeec7('0x6'));var util=require(_0xeec7('0x7'));var path=require('path');var sox=require(_0xeec7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeec7('0x9'));var squel=require('squel');var crypto=require(_0xeec7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xeec7('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeec7('0xc'));var Papa=require(_0xeec7('0xd'));var Redis=require(_0xeec7('0xe'));var authService=require(_0xeec7('0xf'));var qs=require(_0xeec7('0x10'));var as=require(_0xeec7('0x11'));var hardwareService=require(_0xeec7('0x12'));var logger=require(_0xeec7('0x13'))(_0xeec7('0x14'));var utils=require(_0xeec7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeec7('0x16'));var db=require(_0xeec7('0x17'))['db'];function respondWithStatusCode(_0x4728b8,_0x1d3d35){_0x1d3d35=_0x1d3d35||0xcc;return function(_0xfa9aab){if(_0xfa9aab){return _0x4728b8['sendStatus'](_0x1d3d35);}return _0x4728b8[_0xeec7('0x18')](_0x1d3d35)['end']();};}function respondWithResult(_0x4bd04d,_0x113216){_0x113216=_0x113216||0xc8;return function(_0x44c924){if(_0x44c924){return _0x4bd04d[_0xeec7('0x18')](_0x113216)[_0xeec7('0x19')](_0x44c924);}};}function respondWithFilteredResult(_0x36b4,_0x29c53b){return function(_0x25653c){if(_0x25653c){var _0xbba6ef=typeof _0x29c53b[_0xeec7('0x1a')]===_0xeec7('0x1b')&&typeof _0x29c53b[_0xeec7('0x1c')]===_0xeec7('0x1b');var _0x31a913=_0x25653c['count'];var _0x5da91c=_0xbba6ef?0x0:_0x29c53b[_0xeec7('0x1a')];var _0xdc1d67=_0xbba6ef?_0x25653c[_0xeec7('0x1d')]:_0x29c53b[_0xeec7('0x1a')]+_0x29c53b[_0xeec7('0x1c')];var _0x1acaa7;if(_0xdc1d67>=_0x31a913){_0xdc1d67=_0x31a913;_0x1acaa7=0xc8;}else{_0x1acaa7=0xce;}_0x36b4[_0xeec7('0x18')](_0x1acaa7);return _0x36b4['set'](_0xeec7('0x1e'),_0x5da91c+'-'+_0xdc1d67+'/'+_0x31a913)['json'](_0x25653c);}return null;};}function patchUpdates(_0x423c8e){return function(_0x4a35a8){try{jsonpatch['apply'](_0x4a35a8,_0x423c8e,!![]);}catch(_0x90e74b){return BPromise[_0xeec7('0x1f')](_0x90e74b);}return _0x4a35a8[_0xeec7('0x20')]();};}function saveUpdates(_0x2edcb9,_0x4ae77f){return function(_0x3ba019){if(_0x3ba019){return _0x3ba019['update'](_0x2edcb9)['then'](function(_0x514b77){return _0x514b77;});}return null;};}function removeEntity(_0x33d15c,_0x56b805){return function(_0x216608){if(_0x216608){return _0x216608[_0xeec7('0x21')]()[_0xeec7('0x22')](function(){var _0x4ea338=_0x216608[_0xeec7('0x23')]({'plain':!![]});var _0x40836f='Templates';return db[_0xeec7('0x24')][_0xeec7('0x21')]({'where':{'type':_0x40836f,'resourceId':_0x4ea338['id']}})[_0xeec7('0x22')](function(){return _0x216608;});})[_0xeec7('0x22')](function(){_0x33d15c[_0xeec7('0x18')](0xcc)[_0xeec7('0x25')]();});}};}function handleEntityNotFound(_0x2996aa,_0x251f2d){return function(_0x4e945f){if(!_0x4e945f){_0x2996aa[_0xeec7('0x26')](0x194);}return _0x4e945f;};}function handleError(_0x1bb588,_0xe7e61f){_0xe7e61f=_0xe7e61f||0x1f4;return function(_0x3d39ca){logger[_0xeec7('0x27')](_0x3d39ca[_0xeec7('0x28')]);if(_0x3d39ca['name']){delete _0x3d39ca[_0xeec7('0x29')];}_0x1bb588['status'](_0xe7e61f)[_0xeec7('0x2a')](_0x3d39ca);};}exports[_0xeec7('0x2b')]=function(_0x1a83f6,_0x351e39){var _0x35ef37={},_0x409684={},_0xb2b901={'count':0x0,'rows':[]};var _0x585c00=_[_0xeec7('0x2c')](db[_0xeec7('0x2d')][_0xeec7('0x2e')],function(_0x474fd4){return{'name':_0x474fd4[_0xeec7('0x2f')],'type':_0x474fd4[_0xeec7('0x30')][_0xeec7('0x31')]};});_0x409684[_0xeec7('0x32')]=_['map'](_0x585c00,_0xeec7('0x29'));_0x409684[_0xeec7('0x33')]=_[_0xeec7('0x34')](_0x1a83f6[_0xeec7('0x33')]);_0x409684['filters']=_[_0xeec7('0x35')](_0x409684[_0xeec7('0x32')],_0x409684['query']);_0x35ef37[_0xeec7('0x36')]=_[_0xeec7('0x35')](_0x409684[_0xeec7('0x32')],qs['fields'](_0x1a83f6[_0xeec7('0x33')]['fields']));_0x35ef37[_0xeec7('0x36')]=_0x35ef37['attributes'][_0xeec7('0x37')]?_0x35ef37[_0xeec7('0x36')]:_0x409684['model'];if(!_0x1a83f6['query']['hasOwnProperty'](_0xeec7('0x38'))){_0x35ef37[_0xeec7('0x1c')]=qs[_0xeec7('0x1c')](_0x1a83f6[_0xeec7('0x33')]['limit']);_0x35ef37[_0xeec7('0x1a')]=qs[_0xeec7('0x1a')](_0x1a83f6[_0xeec7('0x33')][_0xeec7('0x1a')]);}_0x35ef37['order']=qs[_0xeec7('0x39')](_0x1a83f6[_0xeec7('0x33')][_0xeec7('0x39')]);_0x35ef37[_0xeec7('0x3a')]=qs[_0xeec7('0x3b')](_['pick'](_0x1a83f6[_0xeec7('0x33')],_0x409684[_0xeec7('0x3b')]),_0x585c00);if(_0x1a83f6[_0xeec7('0x33')][_0xeec7('0x3c')]){_0x35ef37['where']=_[_0xeec7('0x3d')](_0x35ef37[_0xeec7('0x3a')],{'$or':_['map'](_0x585c00,function(_0x228e18){if(_0x228e18[_0xeec7('0x30')]!==_0xeec7('0x3e')){var _0x267c99={};_0x267c99[_0x228e18[_0xeec7('0x29')]]={'$like':'%'+_0x1a83f6[_0xeec7('0x33')][_0xeec7('0x3c')]+'%'};return _0x267c99;}})});}_0x35ef37=_[_0xeec7('0x3d')]({},_0x35ef37,_0x1a83f6[_0xeec7('0x3f')]);var _0x44c31c={'where':_0x35ef37[_0xeec7('0x3a')]};return db[_0xeec7('0x2d')][_0xeec7('0x1d')](_0x44c31c)[_0xeec7('0x22')](function(_0x197e81){_0xb2b901['count']=_0x197e81;if(_0x1a83f6[_0xeec7('0x33')][_0xeec7('0x40')]){_0x35ef37[_0xeec7('0x41')]=[{'all':!![]}];}return db[_0xeec7('0x2d')]['findAll'](_0x35ef37);})[_0xeec7('0x22')](function(_0x3ee78a){_0xb2b901[_0xeec7('0x42')]=_0x3ee78a;return _0xb2b901;})['then'](respondWithFilteredResult(_0x351e39,_0x35ef37))['catch'](handleError(_0x351e39,null));};exports[_0xeec7('0x43')]=function(_0x524951,_0x2d33e1){var _0x65d12b={'raw':!![],'where':{'id':_0x524951['params']['id']}},_0xf9b72c={};_0xf9b72c['model']=_[_0xeec7('0x34')](db[_0xeec7('0x2d')][_0xeec7('0x2e')]);_0xf9b72c['query']=_[_0xeec7('0x34')](_0x524951[_0xeec7('0x33')]);_0xf9b72c[_0xeec7('0x3b')]=_[_0xeec7('0x35')](_0xf9b72c[_0xeec7('0x32')],_0xf9b72c[_0xeec7('0x33')]);_0x65d12b[_0xeec7('0x36')]=_[_0xeec7('0x35')](_0xf9b72c[_0xeec7('0x32')],qs[_0xeec7('0x44')](_0x524951[_0xeec7('0x33')]['fields']));_0x65d12b[_0xeec7('0x36')]=_0x65d12b[_0xeec7('0x36')][_0xeec7('0x37')]?_0x65d12b['attributes']:_0xf9b72c['model'];if(_0x524951[_0xeec7('0x33')][_0xeec7('0x40')]){_0x65d12b[_0xeec7('0x41')]=[{'all':!![]}];}_0x65d12b=_[_0xeec7('0x3d')]({},_0x65d12b,_0x524951[_0xeec7('0x3f')]);return db['Template'][_0xeec7('0x45')](_0x65d12b)[_0xeec7('0x22')](handleEntityNotFound(_0x2d33e1,null))[_0xeec7('0x22')](respondWithResult(_0x2d33e1,null))['catch'](handleError(_0x2d33e1,null));};exports[_0xeec7('0x46')]=function(_0x14606b,_0x5c441d){return db['Template'][_0xeec7('0x46')](_0x14606b[_0xeec7('0x47')],{})['then'](function(_0x43a0d6){var _0x5eaadf=_0x14606b[_0xeec7('0x48')]['get']({'plain':!![]});if(!_0x5eaadf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eaadf[_0xeec7('0x49')]===_0xeec7('0x48')){var _0x45fb80=_0x43a0d6[_0xeec7('0x23')]({'plain':!![]});var _0x2c39d8=_0xeec7('0x4a');return db[_0xeec7('0x4b')][_0xeec7('0x45')]({'where':{'name':_0x2c39d8,'userProfileId':_0x5eaadf['userProfileId']},'raw':!![]})[_0xeec7('0x22')](function(_0x54c2bc){if(_0x54c2bc&&_0x54c2bc[_0xeec7('0x4c')]===0x0){return db['UserProfileResource'][_0xeec7('0x46')]({'name':_0x45fb80['name'],'resourceId':_0x45fb80['id'],'type':_0x54c2bc[_0xeec7('0x29')],'sectionId':_0x54c2bc['id']},{})[_0xeec7('0x22')](function(){return _0x43a0d6;});}else{return _0x43a0d6;}})['catch'](function(_0x271553){logger['error'](_0xeec7('0x4d'),_0x271553);throw _0x271553;});}return _0x43a0d6;})[_0xeec7('0x22')](respondWithResult(_0x5c441d,0xc9))[_0xeec7('0x4e')](handleError(_0x5c441d,null));};exports[_0xeec7('0x4f')]=function(_0x3f10b3,_0x19de3c){if(_0x3f10b3[_0xeec7('0x47')]['id']){delete _0x3f10b3[_0xeec7('0x47')]['id'];}return db['Template'][_0xeec7('0x45')]({'where':{'id':_0x3f10b3[_0xeec7('0x50')]['id']}})['then'](handleEntityNotFound(_0x19de3c,null))[_0xeec7('0x22')](saveUpdates(_0x3f10b3[_0xeec7('0x47')],null))[_0xeec7('0x22')](respondWithResult(_0x19de3c,null))[_0xeec7('0x4e')](handleError(_0x19de3c,null));};exports['destroy']=function(_0x34d7ab,_0x34d91b){return db[_0xeec7('0x2d')][_0xeec7('0x45')]({'where':{'id':_0x34d7ab[_0xeec7('0x50')]['id']}})[_0xeec7('0x22')](handleEntityNotFound(_0x34d91b,null))[_0xeec7('0x22')](removeEntity(_0x34d91b,null))['catch'](handleError(_0x34d91b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a472a28..2e90b2e 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 _0x7baa=['tools_templates','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x7baa,0x145));var _0xa7ba=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x7baa[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0xa7ba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7ba('0x1'));var moment=require(_0xa7ba('0x2'));var BPromise=require(_0xa7ba('0x3'));var rp=require(_0xa7ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7ba('0x5'));var config=require(_0xa7ba('0x6'));var attributes=require(_0xa7ba('0x7'));module[_0xa7ba('0x8')]=function(_0x30df69,_0x37d113){return _0x30df69[_0xa7ba('0x9')](_0xa7ba('0xa'),attributes,{'tableName':_0xa7ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7356=['../../config/logger','api','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x7356,0x1de));var _0x6735=function(_0x5ddbe9,_0xa1ef5){_0x5ddbe9=_0x5ddbe9-0x0;var _0x5cd717=_0x7356[_0x5ddbe9];return _0x5cd717;};'use strict';var _=require(_0x6735('0x0'));var util=require(_0x6735('0x1'));var logger=require(_0x6735('0x2'))(_0x6735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6735('0x4'));var fs=require('fs');var path=require(_0x6735('0x5'));var rimraf=require('rimraf');var config=require(_0x6735('0x6'));var attributes=require(_0x6735('0x7'));module[_0x6735('0x8')]=function(_0x43087e,_0x33613c){return _0x43087e[_0x6735('0x9')](_0x6735('0xa'),attributes,{'tableName':_0x6735('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 3546e20..003dfbd 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 _0x3563=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','model','include','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Template,\x20%s,\x20%s'];(function(_0x28f358,_0x2ab025){var _0x2e58d2=function(_0x1c3b01){while(--_0x1c3b01){_0x28f358['push'](_0x28f358['shift']());}};_0x2e58d2(++_0x2ab025);}(_0x3563,0x159));var _0x3356=function(_0x33ec76,_0x10f648){_0x33ec76=_0x33ec76-0x0;var _0x5c8ab2=_0x3563[_0x33ec76];return _0x5c8ab2;};'use strict';var _=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var moment=require(_0x3356('0x2'));var BPromise=require(_0x3356('0x3'));var rs=require(_0x3356('0x4'));var fs=require('fs');var Redis=require(_0x3356('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3356('0x6'));var logger=require(_0x3356('0x7'))(_0x3356('0x8'));var config=require(_0x3356('0x9'));var jayson=require(_0x3356('0xa'));var client=jayson[_0x3356('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587083,_0x14048a,_0x5c7883){return new BPromise(function(_0x415bd4,_0x44a6c6){return client[_0x3356('0xc')](_0x587083,_0x5c7883)[_0x3356('0xd')](function(_0x5a0b27){logger['info'](_0x3356('0xe'),_0x14048a,_0x3356('0xf'));logger[_0x3356('0x10')](_0x3356('0x11'),_0x14048a,'request\x20sent',JSON[_0x3356('0x12')](_0x5a0b27));if(_0x5a0b27['error']){if(_0x5a0b27['error'][_0x3356('0x13')]===0x1f4){logger[_0x3356('0x14')](_0x3356('0xe'),_0x14048a,_0x5a0b27['error']['message']);return _0x44a6c6(_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);}logger[_0x3356('0x14')](_0x3356('0xe'),_0x14048a,_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);return _0x415bd4(_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);}else{logger[_0x3356('0x16')](_0x3356('0xe'),_0x14048a,_0x3356('0xf'));_0x415bd4(_0x5a0b27[_0x3356('0x17')][_0x3356('0x15')]);}})[_0x3356('0x18')](function(_0x18eaf3){logger['error'](_0x3356('0xe'),_0x14048a,_0x18eaf3);_0x44a6c6(_0x18eaf3);});});}exports[_0x3356('0x19')]=function(_0x44c30b){var _0x1428e9=this;return new Promise(function(_0x346f7c,_0x22fd4e){return db[_0x3356('0x1a')][_0x3356('0x1b')]({'raw':_0x44c30b['options']?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1d')]===undefined?!![]:![]:!![],'where':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1e')]||null:null,'attributes':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1f')]||null:null,'limit':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x20')]||null:null,'include':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')]['include']?_[_0x3356('0x21')](_0x44c30b[_0x3356('0x1c')]['include'],function(_0x207ada){return{'model':db[_0x207ada[_0x3356('0x22')]],'as':_0x207ada['as'],'attributes':_0x207ada[_0x3356('0x1f')],'include':_0x207ada[_0x3356('0x23')]?_[_0x3356('0x21')](_0x207ada[_0x3356('0x23')],function(_0xb512a0){return{'model':db[_0xb512a0[_0x3356('0x22')]],'as':_0xb512a0['as'],'attributes':_0xb512a0['attributes'],'include':_0xb512a0[_0x3356('0x23')]?_['map'](_0xb512a0[_0x3356('0x23')],function(_0x933ece){return{'model':db[_0x933ece[_0x3356('0x22')]],'as':_0x933ece['as'],'attributes':_0x933ece[_0x3356('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3356('0xd')](function(_0x14f5bd){logger['info']('GetTemplate',_0x44c30b);logger[_0x3356('0x10')](_0x3356('0x19'),_0x44c30b,JSON[_0x3356('0x12')](_0x14f5bd));_0x346f7c(_0x14f5bd);})['catch'](function(_0x409237){logger[_0x3356('0x14')](_0x3356('0x19'),_0x409237[_0x3356('0x15')],_0x44c30b);_0x22fd4e(_0x1428e9[_0x3356('0x14')](0x1f4,_0x409237[_0x3356('0x15')]));});});}; \ No newline at end of file +var _0x0e5c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','Template','findAll','options','raw','where','include','map','model','attributes','catch','lodash'];(function(_0x90c4ad,_0x2986d8){var _0x1224a3=function(_0x306323){while(--_0x306323){_0x90c4ad['push'](_0x90c4ad['shift']());}};_0x1224a3(++_0x2986d8);}(_0x0e5c,0x1cd));var _0xc0e5=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x0e5c[_0x120bc2];return _0x454a41;};'use strict';var _=require(_0xc0e5('0x0'));var util=require(_0xc0e5('0x1'));var moment=require(_0xc0e5('0x2'));var BPromise=require(_0xc0e5('0x3'));var rs=require(_0xc0e5('0x4'));var fs=require('fs');var Redis=require(_0xc0e5('0x5'));var db=require(_0xc0e5('0x6'))['db'];var utils=require(_0xc0e5('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc0e5('0x8')][_0xc0e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1600f4,_0x3bc3d6,_0x166607){return new BPromise(function(_0x582218,_0x2081a2){return client[_0xc0e5('0xa')](_0x1600f4,_0x166607)[_0xc0e5('0xb')](function(_0x2284df){logger['info'](_0xc0e5('0xc'),_0x3bc3d6,_0xc0e5('0xd'));logger[_0xc0e5('0xe')](_0xc0e5('0xf'),_0x3bc3d6,'request\x20sent',JSON[_0xc0e5('0x10')](_0x2284df));if(_0x2284df[_0xc0e5('0x11')]){if(_0x2284df[_0xc0e5('0x11')][_0xc0e5('0x12')]===0x1f4){logger[_0xc0e5('0x11')]('Template,\x20%s,\x20%s',_0x3bc3d6,_0x2284df['error'][_0xc0e5('0x13')]);return _0x2081a2(_0x2284df['error'][_0xc0e5('0x13')]);}logger[_0xc0e5('0x11')](_0xc0e5('0xc'),_0x3bc3d6,_0x2284df[_0xc0e5('0x11')][_0xc0e5('0x13')]);return _0x582218(_0x2284df[_0xc0e5('0x11')][_0xc0e5('0x13')]);}else{logger[_0xc0e5('0x14')](_0xc0e5('0xc'),_0x3bc3d6,_0xc0e5('0xd'));_0x582218(_0x2284df[_0xc0e5('0x15')][_0xc0e5('0x13')]);}})['catch'](function(_0x24ca9c){logger[_0xc0e5('0x11')](_0xc0e5('0xc'),_0x3bc3d6,_0x24ca9c);_0x2081a2(_0x24ca9c);});});}exports[_0xc0e5('0x16')]=function(_0x4e7a05){var _0x3a8645=this;return new Promise(function(_0x7aef39,_0xc4221c){return db[_0xc0e5('0x17')][_0xc0e5('0x18')]({'raw':_0x4e7a05[_0xc0e5('0x19')]?_0x4e7a05[_0xc0e5('0x19')][_0xc0e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e7a05[_0xc0e5('0x19')]?_0x4e7a05[_0xc0e5('0x19')][_0xc0e5('0x1b')]||null:null,'attributes':_0x4e7a05[_0xc0e5('0x19')]?_0x4e7a05[_0xc0e5('0x19')]['attributes']||null:null,'limit':_0x4e7a05[_0xc0e5('0x19')]?_0x4e7a05[_0xc0e5('0x19')]['limit']||null:null,'include':_0x4e7a05[_0xc0e5('0x19')]?_0x4e7a05[_0xc0e5('0x19')][_0xc0e5('0x1c')]?_[_0xc0e5('0x1d')](_0x4e7a05[_0xc0e5('0x19')][_0xc0e5('0x1c')],function(_0x5556ff){return{'model':db[_0x5556ff[_0xc0e5('0x1e')]],'as':_0x5556ff['as'],'attributes':_0x5556ff['attributes'],'include':_0x5556ff[_0xc0e5('0x1c')]?_[_0xc0e5('0x1d')](_0x5556ff[_0xc0e5('0x1c')],function(_0x19748b){return{'model':db[_0x19748b[_0xc0e5('0x1e')]],'as':_0x19748b['as'],'attributes':_0x19748b['attributes'],'include':_0x19748b[_0xc0e5('0x1c')]?_[_0xc0e5('0x1d')](_0x19748b['include'],function(_0x5a4e20){return{'model':db[_0x5a4e20['model']],'as':_0x5a4e20['as'],'attributes':_0x5a4e20[_0xc0e5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc0e5('0xb')](function(_0x543101){logger['info']('GetTemplate',_0x4e7a05);logger[_0xc0e5('0xe')](_0xc0e5('0x16'),_0x4e7a05,JSON[_0xc0e5('0x10')](_0x543101));_0x7aef39(_0x543101);})[_0xc0e5('0x20')](function(_0x139889){logger[_0xc0e5('0x11')](_0xc0e5('0x16'),_0x139889[_0xc0e5('0x13')],_0x4e7a05);_0xc4221c(_0x3a8645['error'](0x1f4,_0x139889[_0xc0e5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3d19ce8..7db9e72 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 _0x1baf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','put','update','destroy','multer','util','path','express'];(function(_0x562cd0,_0x30659f){var _0x18a4d7=function(_0x2d762e){while(--_0x2d762e){_0x562cd0['push'](_0x562cd0['shift']());}};_0x18a4d7(++_0x30659f);}(_0x1baf,0x14e));var _0xf1ba=function(_0x52aba9,_0x17f9ba){_0x52aba9=_0x52aba9-0x0;var _0x1805d2=_0x1baf[_0x52aba9];return _0x1805d2;};'use strict';var multer=require(_0xf1ba('0x0'));var util=require(_0xf1ba('0x1'));var path=require(_0xf1ba('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1ba('0x3'));var router=express[_0xf1ba('0x4')]();var fs_extra=require(_0xf1ba('0x5'));var auth=require(_0xf1ba('0x6'));var interaction=require(_0xf1ba('0x7'));var config=require(_0xf1ba('0x8'));var controller=require('./trigger.controller');router[_0xf1ba('0x9')]('/',auth[_0xf1ba('0xa')](),controller['index']);router['get'](_0xf1ba('0xb'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0xc')]);router[_0xf1ba('0x9')](_0xf1ba('0xd'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0xe')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xf1ba('0xf')]);router[_0xf1ba('0x9')]('/:id/actions',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x10')]);router[_0xf1ba('0x11')]('/',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x12')]);router[_0xf1ba('0x11')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xf1ba('0x13')]);router[_0xf1ba('0x11')](_0xf1ba('0x14'),auth['isAuthenticated'](),controller[_0xf1ba('0x15')]);router[_0xf1ba('0x11')](_0xf1ba('0x16'),auth[_0xf1ba('0xa')](),controller['addAction']);router[_0xf1ba('0x17')]('/:id',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x18')]);router['delete'](_0xf1ba('0xb'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x19')]);module['exports']=router; \ No newline at end of file +var _0x00d1=['util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','put','update','delete','destroy','exports','multer'];(function(_0x1fe828,_0x4d0dc2){var _0x5e5ec4=function(_0x189424){while(--_0x189424){_0x1fe828['push'](_0x1fe828['shift']());}};_0x5e5ec4(++_0x4d0dc2);}(_0x00d1,0x16f));var _0x100d=function(_0xcc6ce4,_0x2979cf){_0xcc6ce4=_0xcc6ce4-0x0;var _0x29566e=_0x00d1[_0xcc6ce4];return _0x29566e;};'use strict';var multer=require(_0x100d('0x0'));var util=require(_0x100d('0x1'));var path=require('path');var timeout=require(_0x100d('0x2'));var express=require(_0x100d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x100d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x100d('0x5'));var controller=require('./trigger.controller');router[_0x100d('0x6')]('/',auth[_0x100d('0x7')](),controller['index']);router[_0x100d('0x6')](_0x100d('0x8'),auth[_0x100d('0x7')](),controller['show']);router[_0x100d('0x6')](_0x100d('0x9'),auth['isAuthenticated'](),controller[_0x100d('0xa')]);router[_0x100d('0x6')](_0x100d('0xb'),auth['isAuthenticated'](),controller[_0x100d('0xc')]);router[_0x100d('0x6')](_0x100d('0xd'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x100d('0xe')]);router[_0x100d('0xf')](_0x100d('0x9'),auth[_0x100d('0x7')](),controller[_0x100d('0x10')]);router[_0x100d('0xf')]('/:id/any_conditions',auth[_0x100d('0x7')](),controller[_0x100d('0x11')]);router[_0x100d('0xf')](_0x100d('0xd'),auth[_0x100d('0x7')](),controller['addAction']);router[_0x100d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x100d('0x13')]);router[_0x100d('0x14')](_0x100d('0x8'),auth[_0x100d('0x7')](),controller[_0x100d('0x15')]);module[_0x100d('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 67afcff..d041c62 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 _0xdcd5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3d3275,_0x18b2f0){var _0x379f31=function(_0x5c7911){while(--_0x5c7911){_0x3d3275['push'](_0x3d3275['shift']());}};_0x379f31(++_0x18b2f0);}(_0xdcd5,0x174));var _0x5dcd=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xdcd5[_0x1d94d1];return _0x23c397;};'use strict';var Sequelize=require(_0x5dcd('0x0'));module[_0x5dcd('0x1')]={'name':{'type':Sequelize[_0x5dcd('0x2')]},'channel':{'type':Sequelize[_0x5dcd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5dcd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6120=['exports','STRING','BOOLEAN'];(function(_0x1f1305,_0x2435f5){var _0x571a9d=function(_0x411dfc){while(--_0x411dfc){_0x1f1305['push'](_0x1f1305['shift']());}};_0x571a9d(++_0x2435f5);}(_0x6120,0x16b));var _0x0612=function(_0x44b0b0,_0x409c75){_0x44b0b0=_0x44b0b0-0x0;var _0x4adfd=_0x6120[_0x44b0b0];return _0x4adfd;};'use strict';var Sequelize=require('sequelize');module[_0x0612('0x0')]={'name':{'type':Sequelize[_0x0612('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0612('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index c0eb223..a721cd7 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 _0x113b=['status','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','Trigger','includeAll','include','rows','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','order','pick','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','count','limit'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x113b,0x167));var _0xb113=function(_0x355235,_0x5517f9){_0x355235=_0x355235-0x0;var _0x104ea0=_0x113b[_0x355235];return _0x104ea0;};'use strict';var emlformat=require(_0xb113('0x0'));var rimraf=require(_0xb113('0x1'));var zipdir=require(_0xb113('0x2'));var jsonpatch=require(_0xb113('0x3'));var rp=require(_0xb113('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb113('0x5'));var util=require('util');var path=require(_0xb113('0x6'));var sox=require(_0xb113('0x7'));var csv=require(_0xb113('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb113('0x9'));var _=require(_0xb113('0xa'));var squel=require(_0xb113('0xb'));var crypto=require(_0xb113('0xc'));var jsforce=require(_0xb113('0xd'));var deskjs=require(_0xb113('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb113('0xf'));var authService=require(_0xb113('0x10'));var qs=require(_0xb113('0x11'));var as=require(_0xb113('0x12'));var hardwareService=require(_0xb113('0x13'));var logger=require('../../config/logger')(_0xb113('0x14'));var utils=require(_0xb113('0x15'));var config=require(_0xb113('0x16'));var licenseUtil=require(_0xb113('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6a55b6,_0x2e128a){_0x2e128a=_0x2e128a||0xcc;return function(_0x2bf932){if(_0x2bf932){return _0x6a55b6['sendStatus'](_0x2e128a);}return _0x6a55b6['status'](_0x2e128a)['end']();};}function respondWithResult(_0x38cac1,_0x2dfa2b){_0x2dfa2b=_0x2dfa2b||0xc8;return function(_0x4ca74d){if(_0x4ca74d){return _0x38cac1['status'](_0x2dfa2b)[_0xb113('0x18')](_0x4ca74d);}};}function respondWithFilteredResult(_0x4d6a57,_0x396266){return function(_0x12c248){if(_0x12c248){var _0x1df18a=typeof _0x396266[_0xb113('0x19')]===_0xb113('0x1a')&&typeof _0x396266['limit']===_0xb113('0x1a');var _0x2aede8=_0x12c248[_0xb113('0x1b')];var _0x4041da=_0x1df18a?0x0:_0x396266[_0xb113('0x19')];var _0xc25049=_0x1df18a?_0x12c248[_0xb113('0x1b')]:_0x396266['offset']+_0x396266[_0xb113('0x1c')];var _0x2565f9;if(_0xc25049>=_0x2aede8){_0xc25049=_0x2aede8;_0x2565f9=0xc8;}else{_0x2565f9=0xce;}_0x4d6a57[_0xb113('0x1d')](_0x2565f9);return _0x4d6a57[_0xb113('0x1e')](_0xb113('0x1f'),_0x4041da+'-'+_0xc25049+'/'+_0x2aede8)['json'](_0x12c248);}return null;};}function patchUpdates(_0x5ec400){return function(_0x105cc9){try{jsonpatch[_0xb113('0x20')](_0x105cc9,_0x5ec400,!![]);}catch(_0xca1ee1){return BPromise[_0xb113('0x21')](_0xca1ee1);}return _0x105cc9[_0xb113('0x22')]();};}function saveUpdates(_0x2e579d,_0x5341d8){return function(_0x2bf519){if(_0x2bf519){return _0x2bf519[_0xb113('0x23')](_0x2e579d)[_0xb113('0x24')](function(_0x187656){return _0x187656;});}return null;};}function removeEntity(_0x3ed51b,_0x1aec59){return function(_0xd5e810){if(_0xd5e810){return _0xd5e810[_0xb113('0x25')]()['then'](function(){var _0x288007=_0xd5e810[_0xb113('0x26')]({'plain':!![]});var _0x3c805b='Triggers';return db['UserProfileResource'][_0xb113('0x25')]({'where':{'type':_0x3c805b,'resourceId':_0x288007['id']}})[_0xb113('0x24')](function(){return _0xd5e810;});})[_0xb113('0x24')](function(){_0x3ed51b[_0xb113('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c07e4,_0x37d588){return function(_0x376655){if(!_0x376655){_0x2c07e4[_0xb113('0x27')](0x194);}return _0x376655;};}function handleError(_0x43fab8,_0x41a9f1){_0x41a9f1=_0x41a9f1||0x1f4;return function(_0x439821){logger[_0xb113('0x28')](_0x439821[_0xb113('0x29')]);if(_0x439821[_0xb113('0x2a')]){delete _0x439821['name'];}_0x43fab8[_0xb113('0x1d')](_0x41a9f1)['send'](_0x439821);};}exports[_0xb113('0x2b')]=function(_0x3999c9,_0x2efb56){var _0x15e107={},_0x24fff4={},_0x1dc3d7={'count':0x0,'rows':[]};var _0x414bc6=_['map'](db['Trigger'][_0xb113('0x2c')],function(_0x475087){return{'name':_0x475087[_0xb113('0x2d')],'type':_0x475087[_0xb113('0x2e')][_0xb113('0x2f')]};});_0x24fff4[_0xb113('0x30')]=_[_0xb113('0x31')](_0x414bc6,_0xb113('0x2a'));_0x24fff4[_0xb113('0x32')]=_[_0xb113('0x33')](_0x3999c9[_0xb113('0x32')]);_0x24fff4[_0xb113('0x34')]=_[_0xb113('0x35')](_0x24fff4[_0xb113('0x30')],_0x24fff4['query']);_0x15e107['attributes']=_[_0xb113('0x35')](_0x24fff4[_0xb113('0x30')],qs[_0xb113('0x36')](_0x3999c9[_0xb113('0x32')]['fields']));_0x15e107[_0xb113('0x37')]=_0x15e107['attributes']['length']?_0x15e107[_0xb113('0x37')]:_0x24fff4[_0xb113('0x30')];if(!_0x3999c9[_0xb113('0x32')][_0xb113('0x38')]('nolimit')){_0x15e107[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x3999c9[_0xb113('0x32')][_0xb113('0x1c')]);_0x15e107[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x3999c9[_0xb113('0x32')][_0xb113('0x19')]);}_0x15e107['order']=qs[_0xb113('0x39')](_0x3999c9[_0xb113('0x32')][_0xb113('0x39')]);_0x15e107[_0xb113('0x3a')]=qs['filters'](_['pick'](_0x3999c9[_0xb113('0x32')],_0x24fff4[_0xb113('0x34')]),_0x414bc6);if(_0x3999c9[_0xb113('0x32')][_0xb113('0x3b')]){_0x15e107[_0xb113('0x3a')]=_[_0xb113('0x3c')](_0x15e107[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x414bc6,function(_0x1ed37c){if(_0x1ed37c[_0xb113('0x2e')]!==_0xb113('0x3d')){var _0x13bcef={};_0x13bcef[_0x1ed37c[_0xb113('0x2a')]]={'$like':'%'+_0x3999c9[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x13bcef;}})});}_0x15e107=_[_0xb113('0x3c')]({},_0x15e107,_0x3999c9['options']);var _0x3a1594={'where':_0x15e107[_0xb113('0x3a')]};return db[_0xb113('0x3e')][_0xb113('0x1b')](_0x3a1594)['then'](function(_0x472b09){_0x1dc3d7[_0xb113('0x1b')]=_0x472b09;if(_0x3999c9[_0xb113('0x32')][_0xb113('0x3f')]){_0x15e107[_0xb113('0x40')]=[{'all':!![]}];}return db[_0xb113('0x3e')]['findAll'](_0x15e107);})['then'](function(_0x43d82d){_0x1dc3d7[_0xb113('0x41')]=_0x43d82d;return _0x1dc3d7;})['then'](respondWithFilteredResult(_0x2efb56,_0x15e107))[_0xb113('0x42')](handleError(_0x2efb56,null));};exports[_0xb113('0x43')]=function(_0x402f4b,_0x101465){var _0x56a159={'raw':![],'where':{'id':_0x402f4b['params']['id']}},_0x4d0c13={};_0x4d0c13[_0xb113('0x30')]=_['keys'](db[_0xb113('0x3e')]['rawAttributes']);_0x4d0c13[_0xb113('0x32')]=_[_0xb113('0x33')](_0x402f4b[_0xb113('0x32')]);_0x4d0c13['filters']=_[_0xb113('0x35')](_0x4d0c13[_0xb113('0x30')],_0x4d0c13['query']);_0x56a159[_0xb113('0x37')]=_['intersection'](_0x4d0c13['model'],qs[_0xb113('0x36')](_0x402f4b[_0xb113('0x32')]['fields']));_0x56a159[_0xb113('0x37')]=_0x56a159[_0xb113('0x37')]['length']?_0x56a159[_0xb113('0x37')]:_0x4d0c13[_0xb113('0x30')];if(_0x402f4b[_0xb113('0x32')]['includeAll']){_0x56a159[_0xb113('0x40')]=[{'all':!![]}];}_0x56a159=_['merge']({},_0x56a159,_0x402f4b[_0xb113('0x44')]);return db['Trigger']['find'](_0x56a159)[_0xb113('0x24')](handleEntityNotFound(_0x101465,null))[_0xb113('0x24')](respondWithResult(_0x101465,null))['catch'](handleError(_0x101465,null));};exports['create']=function(_0x41ae0a,_0x2febe5){return db[_0xb113('0x3e')][_0xb113('0x45')](_0x41ae0a['body'],{})[_0xb113('0x24')](function(_0x3b65fa){var _0x20f723=_0x41ae0a[_0xb113('0x46')][_0xb113('0x26')]({'plain':!![]});if(!_0x20f723)throw new Error(_0xb113('0x47'));if(_0x20f723[_0xb113('0x48')]===_0xb113('0x46')){var _0x46699b=_0x3b65fa[_0xb113('0x26')]({'plain':!![]});var _0x56fcc9=_0xb113('0x49');return db[_0xb113('0x4a')][_0xb113('0x4b')]({'where':{'name':_0x56fcc9,'userProfileId':_0x20f723[_0xb113('0x4c')]},'raw':!![]})[_0xb113('0x24')](function(_0x48ae84){if(_0x48ae84&&_0x48ae84[_0xb113('0x4d')]===0x0){return db['UserProfileResource'][_0xb113('0x45')]({'name':_0x46699b['name'],'resourceId':_0x46699b['id'],'type':_0x48ae84[_0xb113('0x2a')],'sectionId':_0x48ae84['id']},{})['then'](function(){return _0x3b65fa;});}else{return _0x3b65fa;}})[_0xb113('0x42')](function(_0x42cb4a){logger[_0xb113('0x28')](_0xb113('0x4e'),_0x42cb4a);throw _0x42cb4a;});}return _0x3b65fa;})[_0xb113('0x24')](respondWithResult(_0x2febe5,0xc9))[_0xb113('0x42')](handleError(_0x2febe5,null));};exports[_0xb113('0x23')]=function(_0x2c08f0,_0x1562be){if(_0x2c08f0[_0xb113('0x4f')]['id']){delete _0x2c08f0[_0xb113('0x4f')]['id'];}return db['Trigger'][_0xb113('0x4b')]({'where':{'id':_0x2c08f0[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1562be,null))['then'](saveUpdates(_0x2c08f0[_0xb113('0x4f')],null))[_0xb113('0x24')](respondWithResult(_0x1562be,null))[_0xb113('0x42')](handleError(_0x1562be,null));};exports[_0xb113('0x25')]=function(_0x55d9e4,_0x5b9ccf){return db[_0xb113('0x3e')][_0xb113('0x4b')]({'where':{'id':_0x55d9e4[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x5b9ccf,null))['then'](removeEntity(_0x5b9ccf,null))[_0xb113('0x42')](handleError(_0x5b9ccf,null));};exports[_0xb113('0x51')]=function(_0x26b840,_0x4e7c61,_0x43ff8a){if(_0x26b840['body']['id']){delete _0x26b840[_0xb113('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x26b840['params']['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x4e7c61,null))[_0xb113('0x24')](function(_0x33b841){if(_0x33b841){_0x26b840[_0xb113('0x4f')][_0xb113('0x52')]=_0x33b841['id'];return db[_0xb113('0x53')]['create'](_0x26b840['body']);}})[_0xb113('0x24')](respondWithResult(_0x4e7c61,null))['catch'](handleError(_0x4e7c61,null));};exports[_0xb113('0x54')]=function(_0x3aa9e5,_0x1374a5,_0x171165){if(_0x3aa9e5['body']['id']){delete _0x3aa9e5[_0xb113('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3aa9e5[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1374a5,null))[_0xb113('0x24')](function(_0x31a4df){if(_0x31a4df){_0x3aa9e5[_0xb113('0x4f')][_0xb113('0x55')]=_0x31a4df['id'];return db[_0xb113('0x53')]['create'](_0x3aa9e5[_0xb113('0x4f')]);}})[_0xb113('0x24')](respondWithResult(_0x1374a5,null))[_0xb113('0x42')](handleError(_0x1374a5,null));};exports[_0xb113('0x56')]=function(_0x4246f1,_0xc9ead8,_0x4b9004){var _0x5c650a={};var _0x54e6ba={};var _0x4c5e86;var _0x103257;return db[_0xb113('0x3e')][_0xb113('0x57')]({'where':{'id':_0x4246f1['params']['id']}})[_0xb113('0x24')](handleEntityNotFound(_0xc9ead8,null))['then'](function(_0x34deab){if(_0x34deab){_0x4c5e86=_0x34deab;_0x54e6ba[_0xb113('0x30')]=_[_0xb113('0x33')](db[_0xb113('0x53')]['rawAttributes']);_0x54e6ba[_0xb113('0x32')]=_[_0xb113('0x33')](_0x4246f1[_0xb113('0x32')]);_0x54e6ba['filters']=_['intersection'](_0x54e6ba[_0xb113('0x30')],_0x54e6ba['query']);_0x5c650a[_0xb113('0x37')]=_[_0xb113('0x35')](_0x54e6ba[_0xb113('0x30')],qs[_0xb113('0x36')](_0x4246f1[_0xb113('0x32')][_0xb113('0x36')]));_0x5c650a['attributes']=_0x5c650a[_0xb113('0x37')][_0xb113('0x58')]?_0x5c650a[_0xb113('0x37')]:_0x54e6ba[_0xb113('0x30')];_0x5c650a[_0xb113('0x59')]=qs[_0xb113('0x39')](_0x4246f1[_0xb113('0x32')]['sort']);_0x5c650a[_0xb113('0x3a')]=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x4246f1[_0xb113('0x32')],_0x54e6ba[_0xb113('0x34')]));if(_0x4246f1[_0xb113('0x32')][_0xb113('0x3b')]){_0x5c650a[_0xb113('0x3a')]=_[_0xb113('0x3c')](_0x5c650a[_0xb113('0x3a')],{'$or':_['map'](_0x5c650a[_0xb113('0x37')],function(_0x44c9ab){var _0x2fc12e={};_0x2fc12e[_0x44c9ab]={'$like':'%'+_0x4246f1['query'][_0xb113('0x3b')]+'%'};return _0x2fc12e;})});}_0x5c650a=_[_0xb113('0x3c')]({},_0x5c650a,_0x4246f1[_0xb113('0x44')]);return _0x4c5e86[_0xb113('0x56')](_0x5c650a);}})[_0xb113('0x24')](function(_0x1afeb8){if(_0x1afeb8){_0x103257=_0x1afeb8[_0xb113('0x58')];if(!_0x4246f1[_0xb113('0x32')]['hasOwnProperty'](_0xb113('0x5b'))){_0x5c650a[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x4246f1['query'][_0xb113('0x1c')]);_0x5c650a[_0xb113('0x19')]=qs['offset'](_0x4246f1[_0xb113('0x32')]['offset']);}return _0x4c5e86['getAllConditions'](_0x5c650a);}})[_0xb113('0x24')](function(_0x29f315){if(_0x29f315){return _0x29f315?{'count':_0x103257,'rows':_0x29f315}:null;}})[_0xb113('0x24')](respondWithResult(_0xc9ead8,null))[_0xb113('0x42')](handleError(_0xc9ead8,null));};exports[_0xb113('0x5c')]=function(_0x5b572d,_0x1f8efa,_0x3ddce3){var _0x4976ee={};var _0x113fd5={};var _0x134b42;var _0x50b40e;return db['Trigger'][_0xb113('0x57')]({'where':{'id':_0x5b572d[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1f8efa,null))[_0xb113('0x24')](function(_0x4e6139){if(_0x4e6139){_0x134b42=_0x4e6139;_0x113fd5[_0xb113('0x30')]=_[_0xb113('0x33')](db['Condition']['rawAttributes']);_0x113fd5[_0xb113('0x32')]=_[_0xb113('0x33')](_0x5b572d[_0xb113('0x32')]);_0x113fd5['filters']=_[_0xb113('0x35')](_0x113fd5[_0xb113('0x30')],_0x113fd5['query']);_0x4976ee[_0xb113('0x37')]=_[_0xb113('0x35')](_0x113fd5[_0xb113('0x30')],qs[_0xb113('0x36')](_0x5b572d[_0xb113('0x32')][_0xb113('0x36')]));_0x4976ee[_0xb113('0x37')]=_0x4976ee[_0xb113('0x37')][_0xb113('0x58')]?_0x4976ee[_0xb113('0x37')]:_0x113fd5[_0xb113('0x30')];_0x4976ee['order']=qs['sort'](_0x5b572d[_0xb113('0x32')][_0xb113('0x39')]);_0x4976ee['where']=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x5b572d[_0xb113('0x32')],_0x113fd5[_0xb113('0x34')]));if(_0x5b572d[_0xb113('0x32')][_0xb113('0x3b')]){_0x4976ee[_0xb113('0x3a')]=_['merge'](_0x4976ee[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x4976ee[_0xb113('0x37')],function(_0x34e381){var _0x53cff3={};_0x53cff3[_0x34e381]={'$like':'%'+_0x5b572d[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x53cff3;})});}_0x4976ee=_[_0xb113('0x3c')]({},_0x4976ee,_0x5b572d[_0xb113('0x44')]);return _0x134b42[_0xb113('0x5c')](_0x4976ee);}})[_0xb113('0x24')](function(_0x459cde){if(_0x459cde){_0x50b40e=_0x459cde[_0xb113('0x58')];if(!_0x5b572d[_0xb113('0x32')][_0xb113('0x38')](_0xb113('0x5b'))){_0x4976ee[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x5b572d['query']['limit']);_0x4976ee[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x5b572d[_0xb113('0x32')]['offset']);}return _0x134b42[_0xb113('0x5c')](_0x4976ee);}})['then'](function(_0x4a921c){if(_0x4a921c){return _0x4a921c?{'count':_0x50b40e,'rows':_0x4a921c}:null;}})[_0xb113('0x24')](respondWithResult(_0x1f8efa,null))['catch'](handleError(_0x1f8efa,null));};exports[_0xb113('0x5d')]=function(_0x586421,_0xf27809,_0x25cf54){if(_0x586421[_0xb113('0x4f')]['id']){delete _0x586421[_0xb113('0x4f')]['id'];}return db[_0xb113('0x3e')][_0xb113('0x4b')]({'where':{'id':_0x586421[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0xf27809,null))['then'](function(_0x400798){if(_0x400798){_0x586421['body'][_0xb113('0x5e')]=_0x400798['id'];return db[_0xb113('0x5f')][_0xb113('0x45')](_0x586421[_0xb113('0x4f')]);}})[_0xb113('0x24')](respondWithResult(_0xf27809,null))[_0xb113('0x42')](handleError(_0xf27809,null));};exports[_0xb113('0x60')]=function(_0x315c5e,_0x1673b6,_0x5715dc){var _0x357f36={};var _0x441cc9={};var _0x1f6a18;var _0x5eee84;return db[_0xb113('0x3e')][_0xb113('0x57')]({'where':{'id':_0x315c5e[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1673b6,null))[_0xb113('0x24')](function(_0x263e77){if(_0x263e77){_0x1f6a18=_0x263e77;_0x441cc9[_0xb113('0x30')]=_[_0xb113('0x33')](db['Action'][_0xb113('0x2c')]);_0x441cc9[_0xb113('0x32')]=_[_0xb113('0x33')](_0x315c5e[_0xb113('0x32')]);_0x441cc9[_0xb113('0x34')]=_['intersection'](_0x441cc9[_0xb113('0x30')],_0x441cc9[_0xb113('0x32')]);_0x357f36[_0xb113('0x37')]=_['intersection'](_0x441cc9[_0xb113('0x30')],qs[_0xb113('0x36')](_0x315c5e[_0xb113('0x32')]['fields']));_0x357f36[_0xb113('0x37')]=_0x357f36[_0xb113('0x37')]['length']?_0x357f36[_0xb113('0x37')]:_0x441cc9[_0xb113('0x30')];_0x357f36[_0xb113('0x59')]=qs[_0xb113('0x39')](_0x315c5e[_0xb113('0x32')]['sort']);_0x357f36[_0xb113('0x3a')]=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x315c5e[_0xb113('0x32')],_0x441cc9[_0xb113('0x34')]));if(_0x315c5e[_0xb113('0x32')][_0xb113('0x3b')]){_0x357f36['where']=_[_0xb113('0x3c')](_0x357f36[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x357f36['attributes'],function(_0x27133e){var _0x4fe143={};_0x4fe143[_0x27133e]={'$like':'%'+_0x315c5e[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x4fe143;})});}_0x357f36=_[_0xb113('0x3c')]({},_0x357f36,_0x315c5e['options']);return _0x1f6a18[_0xb113('0x60')](_0x357f36);}})[_0xb113('0x24')](function(_0x5b4812){if(_0x5b4812){_0x5eee84=_0x5b4812[_0xb113('0x58')];if(!_0x315c5e[_0xb113('0x32')][_0xb113('0x38')](_0xb113('0x5b'))){_0x357f36[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x315c5e['query'][_0xb113('0x1c')]);_0x357f36[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x315c5e['query']['offset']);}return _0x1f6a18[_0xb113('0x60')](_0x357f36);}})['then'](function(_0x652eca){if(_0x652eca){return _0x652eca?{'count':_0x5eee84,'rows':_0x652eca}:null;}})['then'](respondWithResult(_0x1673b6,null))[_0xb113('0x42')](handleError(_0x1673b6,null));}; \ No newline at end of file +var _0xbca4=['json','then','destroy','get','Triggers','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','Trigger','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','addAllCondition','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count'];(function(_0x99be21,_0x37b7c2){var _0x2a7652=function(_0x530660){while(--_0x530660){_0x99be21['push'](_0x99be21['shift']());}};_0x2a7652(++_0x37b7c2);}(_0xbca4,0x149));var _0x4bca=function(_0x86b3ed,_0x5d831b){_0x86b3ed=_0x86b3ed-0x0;var _0x50d6a3=_0xbca4[_0x86b3ed];return _0x50d6a3;};'use strict';var emlformat=require(_0x4bca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bca('0x1'));var jsonpatch=require(_0x4bca('0x2'));var rp=require(_0x4bca('0x3'));var moment=require(_0x4bca('0x4'));var BPromise=require(_0x4bca('0x5'));var Mustache=require(_0x4bca('0x6'));var util=require('util');var path=require(_0x4bca('0x7'));var sox=require('sox');var csv=require(_0x4bca('0x8'));var ejs=require(_0x4bca('0x9'));var fs=require('fs');var fs_extra=require(_0x4bca('0xa'));var _=require(_0x4bca('0xb'));var squel=require(_0x4bca('0xc'));var crypto=require(_0x4bca('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bca('0x8'));var querystring=require(_0x4bca('0xe'));var Papa=require(_0x4bca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4bca('0x10'));var as=require(_0x4bca('0x11'));var hardwareService=require(_0x4bca('0x12'));var logger=require(_0x4bca('0x13'))(_0x4bca('0x14'));var utils=require(_0x4bca('0x15'));var config=require(_0x4bca('0x16'));var licenseUtil=require(_0x4bca('0x17'));var db=require(_0x4bca('0x18'))['db'];function respondWithStatusCode(_0x44b2a4,_0x1a1a68){_0x1a1a68=_0x1a1a68||0xcc;return function(_0x234191){if(_0x234191){return _0x44b2a4['sendStatus'](_0x1a1a68);}return _0x44b2a4['status'](_0x1a1a68)[_0x4bca('0x19')]();};}function respondWithResult(_0x35ac76,_0x2f738a){_0x2f738a=_0x2f738a||0xc8;return function(_0x2471bc){if(_0x2471bc){return _0x35ac76[_0x4bca('0x1a')](_0x2f738a)['json'](_0x2471bc);}};}function respondWithFilteredResult(_0x432812,_0x3aa248){return function(_0x472d38){if(_0x472d38){var _0x56d2ab=typeof _0x3aa248[_0x4bca('0x1b')]===_0x4bca('0x1c')&&typeof _0x3aa248[_0x4bca('0x1d')]===_0x4bca('0x1c');var _0x1a5672=_0x472d38[_0x4bca('0x1e')];var _0x38ee89=_0x56d2ab?0x0:_0x3aa248[_0x4bca('0x1b')];var _0x1f6d43=_0x56d2ab?_0x472d38[_0x4bca('0x1e')]:_0x3aa248[_0x4bca('0x1b')]+_0x3aa248[_0x4bca('0x1d')];var _0x1b4a79;if(_0x1f6d43>=_0x1a5672){_0x1f6d43=_0x1a5672;_0x1b4a79=0xc8;}else{_0x1b4a79=0xce;}_0x432812[_0x4bca('0x1a')](_0x1b4a79);return _0x432812['set']('Content-Range',_0x38ee89+'-'+_0x1f6d43+'/'+_0x1a5672)[_0x4bca('0x1f')](_0x472d38);}return null;};}function patchUpdates(_0x41c8bc){return function(_0x30d183){try{jsonpatch['apply'](_0x30d183,_0x41c8bc,!![]);}catch(_0x327ef8){return BPromise['reject'](_0x327ef8);}return _0x30d183['save']();};}function saveUpdates(_0x3dce42,_0x123097){return function(_0x44744d){if(_0x44744d){return _0x44744d['update'](_0x3dce42)[_0x4bca('0x20')](function(_0x26d7e5){return _0x26d7e5;});}return null;};}function removeEntity(_0x6a040b,_0x9705f5){return function(_0x1e99dd){if(_0x1e99dd){return _0x1e99dd[_0x4bca('0x21')]()[_0x4bca('0x20')](function(){var _0x53cf68=_0x1e99dd[_0x4bca('0x22')]({'plain':!![]});var _0x434a75=_0x4bca('0x23');return db['UserProfileResource'][_0x4bca('0x21')]({'where':{'type':_0x434a75,'resourceId':_0x53cf68['id']}})[_0x4bca('0x20')](function(){return _0x1e99dd;});})[_0x4bca('0x20')](function(){_0x6a040b[_0x4bca('0x1a')](0xcc)[_0x4bca('0x19')]();});}};}function handleEntityNotFound(_0x38f9e7,_0x3ac43d){return function(_0x51ba52){if(!_0x51ba52){_0x38f9e7[_0x4bca('0x24')](0x194);}return _0x51ba52;};}function handleError(_0x39d072,_0x3507b6){_0x3507b6=_0x3507b6||0x1f4;return function(_0x2b7789){logger[_0x4bca('0x25')](_0x2b7789[_0x4bca('0x26')]);if(_0x2b7789[_0x4bca('0x27')]){delete _0x2b7789[_0x4bca('0x27')];}_0x39d072[_0x4bca('0x1a')](_0x3507b6)['send'](_0x2b7789);};}exports[_0x4bca('0x28')]=function(_0x2c2f9c,_0x13bc60){var _0x34bdac={},_0x14f085={},_0x313695={'count':0x0,'rows':[]};var _0x3b9426=_[_0x4bca('0x29')](db['Trigger'][_0x4bca('0x2a')],function(_0x59a458){return{'name':_0x59a458[_0x4bca('0x2b')],'type':_0x59a458[_0x4bca('0x2c')][_0x4bca('0x2d')]};});_0x14f085[_0x4bca('0x2e')]=_['map'](_0x3b9426,_0x4bca('0x27'));_0x14f085[_0x4bca('0x2f')]=_[_0x4bca('0x30')](_0x2c2f9c['query']);_0x14f085['filters']=_[_0x4bca('0x31')](_0x14f085[_0x4bca('0x2e')],_0x14f085['query']);_0x34bdac['attributes']=_[_0x4bca('0x31')](_0x14f085[_0x4bca('0x2e')],qs[_0x4bca('0x32')](_0x2c2f9c['query'][_0x4bca('0x32')]));_0x34bdac[_0x4bca('0x33')]=_0x34bdac['attributes']['length']?_0x34bdac['attributes']:_0x14f085[_0x4bca('0x2e')];if(!_0x2c2f9c[_0x4bca('0x2f')][_0x4bca('0x34')](_0x4bca('0x35'))){_0x34bdac['limit']=qs[_0x4bca('0x1d')](_0x2c2f9c[_0x4bca('0x2f')][_0x4bca('0x1d')]);_0x34bdac[_0x4bca('0x1b')]=qs['offset'](_0x2c2f9c[_0x4bca('0x2f')][_0x4bca('0x1b')]);}_0x34bdac[_0x4bca('0x36')]=qs[_0x4bca('0x37')](_0x2c2f9c['query']['sort']);_0x34bdac[_0x4bca('0x38')]=qs['filters'](_['pick'](_0x2c2f9c[_0x4bca('0x2f')],_0x14f085[_0x4bca('0x39')]),_0x3b9426);if(_0x2c2f9c['query'][_0x4bca('0x3a')]){_0x34bdac[_0x4bca('0x38')]=_['merge'](_0x34bdac[_0x4bca('0x38')],{'$or':_['map'](_0x3b9426,function(_0x2e1564){if(_0x2e1564[_0x4bca('0x2c')]!=='VIRTUAL'){var _0x1bb343={};_0x1bb343[_0x2e1564['name']]={'$like':'%'+_0x2c2f9c['query'][_0x4bca('0x3a')]+'%'};return _0x1bb343;}})});}_0x34bdac=_[_0x4bca('0x3b')]({},_0x34bdac,_0x2c2f9c[_0x4bca('0x3c')]);var _0x20c2f8={'where':_0x34bdac[_0x4bca('0x38')]};return db[_0x4bca('0x3d')][_0x4bca('0x1e')](_0x20c2f8)['then'](function(_0x2899e5){_0x313695[_0x4bca('0x1e')]=_0x2899e5;if(_0x2c2f9c[_0x4bca('0x2f')][_0x4bca('0x3e')]){_0x34bdac[_0x4bca('0x3f')]=[{'all':!![]}];}return db[_0x4bca('0x3d')][_0x4bca('0x40')](_0x34bdac);})[_0x4bca('0x20')](function(_0x1455b9){_0x313695['rows']=_0x1455b9;return _0x313695;})[_0x4bca('0x20')](respondWithFilteredResult(_0x13bc60,_0x34bdac))['catch'](handleError(_0x13bc60,null));};exports[_0x4bca('0x41')]=function(_0x27f427,_0x3a8dc1){var _0x51a5bf={'raw':![],'where':{'id':_0x27f427[_0x4bca('0x42')]['id']}},_0x14afd2={};_0x14afd2[_0x4bca('0x2e')]=_[_0x4bca('0x30')](db[_0x4bca('0x3d')][_0x4bca('0x2a')]);_0x14afd2['query']=_['keys'](_0x27f427['query']);_0x14afd2[_0x4bca('0x39')]=_[_0x4bca('0x31')](_0x14afd2[_0x4bca('0x2e')],_0x14afd2[_0x4bca('0x2f')]);_0x51a5bf['attributes']=_[_0x4bca('0x31')](_0x14afd2[_0x4bca('0x2e')],qs['fields'](_0x27f427[_0x4bca('0x2f')][_0x4bca('0x32')]));_0x51a5bf[_0x4bca('0x33')]=_0x51a5bf[_0x4bca('0x33')][_0x4bca('0x43')]?_0x51a5bf['attributes']:_0x14afd2[_0x4bca('0x2e')];if(_0x27f427[_0x4bca('0x2f')][_0x4bca('0x3e')]){_0x51a5bf[_0x4bca('0x3f')]=[{'all':!![]}];}_0x51a5bf=_[_0x4bca('0x3b')]({},_0x51a5bf,_0x27f427[_0x4bca('0x3c')]);return db[_0x4bca('0x3d')][_0x4bca('0x44')](_0x51a5bf)[_0x4bca('0x20')](handleEntityNotFound(_0x3a8dc1,null))[_0x4bca('0x20')](respondWithResult(_0x3a8dc1,null))[_0x4bca('0x45')](handleError(_0x3a8dc1,null));};exports[_0x4bca('0x46')]=function(_0x2d5dbf,_0x12da06){return db[_0x4bca('0x3d')][_0x4bca('0x46')](_0x2d5dbf[_0x4bca('0x47')],{})[_0x4bca('0x20')](function(_0x534f78){var _0xe44bc=_0x2d5dbf[_0x4bca('0x48')]['get']({'plain':!![]});if(!_0xe44bc)throw new Error(_0x4bca('0x49'));if(_0xe44bc[_0x4bca('0x4a')]==='user'){var _0x26c4be=_0x534f78[_0x4bca('0x22')]({'plain':!![]});var _0x1fa8b2=_0x4bca('0x23');return db[_0x4bca('0x4b')][_0x4bca('0x44')]({'where':{'name':_0x1fa8b2,'userProfileId':_0xe44bc[_0x4bca('0x4c')]},'raw':!![]})[_0x4bca('0x20')](function(_0x32333a){if(_0x32333a&&_0x32333a[_0x4bca('0x4d')]===0x0){return db[_0x4bca('0x4e')][_0x4bca('0x46')]({'name':_0x26c4be[_0x4bca('0x27')],'resourceId':_0x26c4be['id'],'type':_0x32333a[_0x4bca('0x27')],'sectionId':_0x32333a['id']},{})['then'](function(){return _0x534f78;});}else{return _0x534f78;}})[_0x4bca('0x45')](function(_0x3da9f0){logger[_0x4bca('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3da9f0);throw _0x3da9f0;});}return _0x534f78;})[_0x4bca('0x20')](respondWithResult(_0x12da06,0xc9))['catch'](handleError(_0x12da06,null));};exports[_0x4bca('0x4f')]=function(_0x5dae2a,_0x120009){if(_0x5dae2a[_0x4bca('0x47')]['id']){delete _0x5dae2a[_0x4bca('0x47')]['id'];}return db[_0x4bca('0x3d')][_0x4bca('0x44')]({'where':{'id':_0x5dae2a[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0x120009,null))[_0x4bca('0x20')](saveUpdates(_0x5dae2a[_0x4bca('0x47')],null))[_0x4bca('0x20')](respondWithResult(_0x120009,null))[_0x4bca('0x45')](handleError(_0x120009,null));};exports[_0x4bca('0x21')]=function(_0x42bd64,_0x2838db){return db[_0x4bca('0x3d')][_0x4bca('0x44')]({'where':{'id':_0x42bd64[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0x2838db,null))['then'](removeEntity(_0x2838db,null))[_0x4bca('0x45')](handleError(_0x2838db,null));};exports[_0x4bca('0x50')]=function(_0x5e7613,_0x156046,_0x483b6c){if(_0x5e7613[_0x4bca('0x47')]['id']){delete _0x5e7613[_0x4bca('0x47')]['id'];}return db[_0x4bca('0x3d')][_0x4bca('0x44')]({'where':{'id':_0x5e7613[_0x4bca('0x42')]['id']}})['then'](handleEntityNotFound(_0x156046,null))[_0x4bca('0x20')](function(_0x5dfd72){if(_0x5dfd72){_0x5e7613['body']['TriggerAllId']=_0x5dfd72['id'];return db[_0x4bca('0x51')][_0x4bca('0x46')](_0x5e7613['body']);}})[_0x4bca('0x20')](respondWithResult(_0x156046,null))[_0x4bca('0x45')](handleError(_0x156046,null));};exports['addAnyCondition']=function(_0x13cea7,_0xf98b30,_0x5aec93){if(_0x13cea7[_0x4bca('0x47')]['id']){delete _0x13cea7['body']['id'];}return db[_0x4bca('0x3d')][_0x4bca('0x44')]({'where':{'id':_0x13cea7[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0xf98b30,null))[_0x4bca('0x20')](function(_0x1fb6e4){if(_0x1fb6e4){_0x13cea7[_0x4bca('0x47')]['TriggerAnyId']=_0x1fb6e4['id'];return db[_0x4bca('0x51')][_0x4bca('0x46')](_0x13cea7[_0x4bca('0x47')]);}})[_0x4bca('0x20')](respondWithResult(_0xf98b30,null))[_0x4bca('0x45')](handleError(_0xf98b30,null));};exports[_0x4bca('0x52')]=function(_0x47a04b,_0x409c76,_0x51edd6){var _0x2bb839={};var _0x19ea81={};var _0x226c09;var _0x3ca1ba;return db[_0x4bca('0x3d')][_0x4bca('0x53')]({'where':{'id':_0x47a04b[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0x409c76,null))['then'](function(_0x202200){if(_0x202200){_0x226c09=_0x202200;_0x19ea81[_0x4bca('0x2e')]=_[_0x4bca('0x30')](db['Condition']['rawAttributes']);_0x19ea81['query']=_[_0x4bca('0x30')](_0x47a04b[_0x4bca('0x2f')]);_0x19ea81[_0x4bca('0x39')]=_['intersection'](_0x19ea81[_0x4bca('0x2e')],_0x19ea81[_0x4bca('0x2f')]);_0x2bb839[_0x4bca('0x33')]=_[_0x4bca('0x31')](_0x19ea81[_0x4bca('0x2e')],qs['fields'](_0x47a04b[_0x4bca('0x2f')][_0x4bca('0x32')]));_0x2bb839['attributes']=_0x2bb839['attributes'][_0x4bca('0x43')]?_0x2bb839[_0x4bca('0x33')]:_0x19ea81[_0x4bca('0x2e')];_0x2bb839[_0x4bca('0x36')]=qs[_0x4bca('0x37')](_0x47a04b['query'][_0x4bca('0x37')]);_0x2bb839[_0x4bca('0x38')]=qs['filters'](_[_0x4bca('0x54')](_0x47a04b[_0x4bca('0x2f')],_0x19ea81[_0x4bca('0x39')]));if(_0x47a04b['query']['filter']){_0x2bb839[_0x4bca('0x38')]=_[_0x4bca('0x3b')](_0x2bb839[_0x4bca('0x38')],{'$or':_[_0x4bca('0x29')](_0x2bb839[_0x4bca('0x33')],function(_0x232067){var _0x22a6f2={};_0x22a6f2[_0x232067]={'$like':'%'+_0x47a04b[_0x4bca('0x2f')][_0x4bca('0x3a')]+'%'};return _0x22a6f2;})});}_0x2bb839=_[_0x4bca('0x3b')]({},_0x2bb839,_0x47a04b[_0x4bca('0x3c')]);return _0x226c09['getAllConditions'](_0x2bb839);}})[_0x4bca('0x20')](function(_0x38605b){if(_0x38605b){_0x3ca1ba=_0x38605b[_0x4bca('0x43')];if(!_0x47a04b['query'][_0x4bca('0x34')](_0x4bca('0x35'))){_0x2bb839['limit']=qs[_0x4bca('0x1d')](_0x47a04b[_0x4bca('0x2f')]['limit']);_0x2bb839[_0x4bca('0x1b')]=qs[_0x4bca('0x1b')](_0x47a04b['query']['offset']);}return _0x226c09['getAllConditions'](_0x2bb839);}})[_0x4bca('0x20')](function(_0x5568c5){if(_0x5568c5){return _0x5568c5?{'count':_0x3ca1ba,'rows':_0x5568c5}:null;}})['then'](respondWithResult(_0x409c76,null))[_0x4bca('0x45')](handleError(_0x409c76,null));};exports[_0x4bca('0x55')]=function(_0x27d996,_0x583d24,_0xad2e14){var _0x123267={};var _0x3d59a8={};var _0x4be3db;var _0x382618;return db[_0x4bca('0x3d')][_0x4bca('0x53')]({'where':{'id':_0x27d996[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0x583d24,null))['then'](function(_0x1d6e42){if(_0x1d6e42){_0x4be3db=_0x1d6e42;_0x3d59a8[_0x4bca('0x2e')]=_[_0x4bca('0x30')](db[_0x4bca('0x51')][_0x4bca('0x2a')]);_0x3d59a8[_0x4bca('0x2f')]=_['keys'](_0x27d996[_0x4bca('0x2f')]);_0x3d59a8[_0x4bca('0x39')]=_[_0x4bca('0x31')](_0x3d59a8[_0x4bca('0x2e')],_0x3d59a8['query']);_0x123267[_0x4bca('0x33')]=_[_0x4bca('0x31')](_0x3d59a8[_0x4bca('0x2e')],qs[_0x4bca('0x32')](_0x27d996[_0x4bca('0x2f')][_0x4bca('0x32')]));_0x123267[_0x4bca('0x33')]=_0x123267[_0x4bca('0x33')]['length']?_0x123267[_0x4bca('0x33')]:_0x3d59a8['model'];_0x123267[_0x4bca('0x36')]=qs[_0x4bca('0x37')](_0x27d996[_0x4bca('0x2f')][_0x4bca('0x37')]);_0x123267[_0x4bca('0x38')]=qs['filters'](_[_0x4bca('0x54')](_0x27d996['query'],_0x3d59a8[_0x4bca('0x39')]));if(_0x27d996['query'][_0x4bca('0x3a')]){_0x123267[_0x4bca('0x38')]=_[_0x4bca('0x3b')](_0x123267[_0x4bca('0x38')],{'$or':_[_0x4bca('0x29')](_0x123267[_0x4bca('0x33')],function(_0x445fc5){var _0x1dd145={};_0x1dd145[_0x445fc5]={'$like':'%'+_0x27d996[_0x4bca('0x2f')][_0x4bca('0x3a')]+'%'};return _0x1dd145;})});}_0x123267=_[_0x4bca('0x3b')]({},_0x123267,_0x27d996[_0x4bca('0x3c')]);return _0x4be3db[_0x4bca('0x55')](_0x123267);}})[_0x4bca('0x20')](function(_0x76bbb0){if(_0x76bbb0){_0x382618=_0x76bbb0[_0x4bca('0x43')];if(!_0x27d996[_0x4bca('0x2f')][_0x4bca('0x34')](_0x4bca('0x35'))){_0x123267['limit']=qs[_0x4bca('0x1d')](_0x27d996[_0x4bca('0x2f')][_0x4bca('0x1d')]);_0x123267[_0x4bca('0x1b')]=qs[_0x4bca('0x1b')](_0x27d996[_0x4bca('0x2f')][_0x4bca('0x1b')]);}return _0x4be3db[_0x4bca('0x55')](_0x123267);}})[_0x4bca('0x20')](function(_0x285c1c){if(_0x285c1c){return _0x285c1c?{'count':_0x382618,'rows':_0x285c1c}:null;}})[_0x4bca('0x20')](respondWithResult(_0x583d24,null))['catch'](handleError(_0x583d24,null));};exports[_0x4bca('0x56')]=function(_0x2e556b,_0x20b277,_0x4ee428){if(_0x2e556b[_0x4bca('0x47')]['id']){delete _0x2e556b['body']['id'];}return db['Trigger'][_0x4bca('0x44')]({'where':{'id':_0x2e556b[_0x4bca('0x42')]['id']}})[_0x4bca('0x20')](handleEntityNotFound(_0x20b277,null))[_0x4bca('0x20')](function(_0x52d5b9){if(_0x52d5b9){_0x2e556b[_0x4bca('0x47')][_0x4bca('0x57')]=_0x52d5b9['id'];return db[_0x4bca('0x58')][_0x4bca('0x46')](_0x2e556b['body']);}})[_0x4bca('0x20')](respondWithResult(_0x20b277,null))[_0x4bca('0x45')](handleError(_0x20b277,null));};exports[_0x4bca('0x59')]=function(_0x7a4107,_0x3e52a6,_0x272891){var _0x1d6d52={};var _0x4c28c5={};var _0x5d8f6c;var _0x20cabe;return db[_0x4bca('0x3d')][_0x4bca('0x53')]({'where':{'id':_0x7a4107['params']['id']}})['then'](handleEntityNotFound(_0x3e52a6,null))[_0x4bca('0x20')](function(_0x55bdb9){if(_0x55bdb9){_0x5d8f6c=_0x55bdb9;_0x4c28c5[_0x4bca('0x2e')]=_[_0x4bca('0x30')](db[_0x4bca('0x58')][_0x4bca('0x2a')]);_0x4c28c5[_0x4bca('0x2f')]=_['keys'](_0x7a4107[_0x4bca('0x2f')]);_0x4c28c5[_0x4bca('0x39')]=_[_0x4bca('0x31')](_0x4c28c5[_0x4bca('0x2e')],_0x4c28c5[_0x4bca('0x2f')]);_0x1d6d52[_0x4bca('0x33')]=_['intersection'](_0x4c28c5[_0x4bca('0x2e')],qs[_0x4bca('0x32')](_0x7a4107[_0x4bca('0x2f')][_0x4bca('0x32')]));_0x1d6d52['attributes']=_0x1d6d52[_0x4bca('0x33')]['length']?_0x1d6d52[_0x4bca('0x33')]:_0x4c28c5[_0x4bca('0x2e')];_0x1d6d52[_0x4bca('0x36')]=qs[_0x4bca('0x37')](_0x7a4107['query'][_0x4bca('0x37')]);_0x1d6d52['where']=qs[_0x4bca('0x39')](_[_0x4bca('0x54')](_0x7a4107[_0x4bca('0x2f')],_0x4c28c5[_0x4bca('0x39')]));if(_0x7a4107[_0x4bca('0x2f')][_0x4bca('0x3a')]){_0x1d6d52['where']=_['merge'](_0x1d6d52[_0x4bca('0x38')],{'$or':_[_0x4bca('0x29')](_0x1d6d52['attributes'],function(_0x4f1840){var _0x4209d8={};_0x4209d8[_0x4f1840]={'$like':'%'+_0x7a4107[_0x4bca('0x2f')]['filter']+'%'};return _0x4209d8;})});}_0x1d6d52=_['merge']({},_0x1d6d52,_0x7a4107['options']);return _0x5d8f6c[_0x4bca('0x59')](_0x1d6d52);}})['then'](function(_0x1c30ff){if(_0x1c30ff){_0x20cabe=_0x1c30ff[_0x4bca('0x43')];if(!_0x7a4107[_0x4bca('0x2f')][_0x4bca('0x34')](_0x4bca('0x35'))){_0x1d6d52[_0x4bca('0x1d')]=qs[_0x4bca('0x1d')](_0x7a4107[_0x4bca('0x2f')]['limit']);_0x1d6d52[_0x4bca('0x1b')]=qs[_0x4bca('0x1b')](_0x7a4107[_0x4bca('0x2f')][_0x4bca('0x1b')]);}return _0x5d8f6c['getActions'](_0x1d6d52);}})[_0x4bca('0x20')](function(_0x1ffee5){if(_0x1ffee5){return _0x1ffee5?{'count':_0x20cabe,'rows':_0x1ffee5}:null;}})[_0x4bca('0x20')](respondWithResult(_0x3e52a6,null))[_0x4bca('0x45')](handleError(_0x3e52a6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f9c700c..604a0fe 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 _0xde50=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','Trigger'];(function(_0x130263,_0x56682e){var _0x2c9e6d=function(_0x27efe5){while(--_0x27efe5){_0x130263['push'](_0x130263['shift']());}};_0x2c9e6d(++_0x56682e);}(_0xde50,0x140));var _0x0de5=function(_0x531cc1,_0x2a048c){_0x531cc1=_0x531cc1-0x0;var _0x33a99b=_0xde50[_0x531cc1];return _0x33a99b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0de5('0x0'))(_0x0de5('0x1'));var moment=require(_0x0de5('0x2'));var BPromise=require(_0x0de5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de5('0x4'));var rimraf=require('rimraf');var config=require(_0x0de5('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x5f05a1,_0x444955){return _0x5f05a1[_0x0de5('0x6')](_0x0de5('0x7'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91a=['./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20c7cd,_0x401cb6){var _0x159723=function(_0x586e01){while(--_0x586e01){_0x20c7cd['push'](_0x20c7cd['shift']());}};_0x159723(++_0x401cb6);}(_0xb91a,0xf4));var _0xab91=function(_0x356fb0,_0x36bbc1){_0x356fb0=_0x356fb0-0x0;var _0x115f7a=_0xb91a[_0x356fb0];return _0x115f7a;};'use strict';var _=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var logger=require(_0xab91('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var attributes=require(_0xab91('0x8'));module[_0xab91('0x9')]=function(_0x429933,_0x290af9){return _0x429933[_0xab91('0xa')]('Trigger',attributes,{'tableName':_0xab91('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 c831671..5469612 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 _0xd777=['GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','stringify','catch','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1bccda,_0x1009e2){var _0x486285=function(_0x3a9e43){while(--_0x3a9e43){_0x1bccda['push'](_0x1bccda['shift']());}};_0x486285(++_0x1009e2);}(_0xd777,0x9a));var _0x7d77=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xd777[_0x1119c8];return _0x3f3071;};'use strict';var _=require(_0x7d77('0x0'));var util=require(_0x7d77('0x1'));var moment=require(_0x7d77('0x2'));var BPromise=require(_0x7d77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d77('0x4'));var db=require(_0x7d77('0x5'))['db'];var utils=require(_0x7d77('0x6'));var logger=require('../../config/logger')(_0x7d77('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d77('0x8')][_0x7d77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb166d1,_0xed3d03,_0x3054ec){return new BPromise(function(_0x6cdfc1,_0x589186){return client[_0x7d77('0xa')](_0xb166d1,_0x3054ec)[_0x7d77('0xb')](function(_0x32ad30){logger[_0x7d77('0xc')](_0x7d77('0xd'),_0xed3d03,_0x7d77('0xe'));logger[_0x7d77('0xf')](_0x7d77('0x10'),_0xed3d03,_0x7d77('0xe'),JSON['stringify'](_0x32ad30));if(_0x32ad30['error']){if(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x12')]===0x1f4){logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);return _0x589186(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);}logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);return _0x6cdfc1(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);}else{logger[_0x7d77('0xc')]('Trigger,\x20%s,\x20%s',_0xed3d03,_0x7d77('0xe'));_0x6cdfc1(_0x32ad30[_0x7d77('0x14')][_0x7d77('0x13')]);}})['catch'](function(_0x15c3c0){logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x15c3c0);_0x589186(_0x15c3c0);});});}exports[_0x7d77('0x15')]=function(_0x2db17f){var _0x106efd=this;return new Promise(function(_0xc4ba43,_0x4192a4){return db[_0x7d77('0x16')][_0x7d77('0x17')]({'raw':_0x2db17f['options']?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x19')]===undefined?!![]:![]:!![],'where':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x1a')]||null:null,'attributes':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x1b')]||null:null,'limit':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')]['limit']||null:null,'include':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')]['include']?_['map'](_0x2db17f['options']['include'],function(_0x4138cd){return{'model':db[_0x4138cd['model']],'as':_0x4138cd['as'],'attributes':_0x4138cd[_0x7d77('0x1b')],'include':_0x4138cd[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0x4138cd['include'],function(_0x46fe72){return{'model':db[_0x46fe72[_0x7d77('0x1e')]],'as':_0x46fe72['as'],'attributes':_0x46fe72['attributes'],'include':_0x46fe72[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0x46fe72['include'],function(_0x1ad1b5){return{'model':db[_0x1ad1b5[_0x7d77('0x1e')]],'as':_0x1ad1b5['as'],'attributes':_0x1ad1b5[_0x7d77('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7d77('0xb')](function(_0x35ac2c){logger['info'](_0x7d77('0x15'),_0x2db17f);logger['debug']('GetTrigger',_0x2db17f,JSON[_0x7d77('0x1f')](_0x35ac2c));_0xc4ba43(_0x35ac2c);})[_0x7d77('0x20')](function(_0x5379b7){logger[_0x7d77('0x11')](_0x7d77('0x15'),_0x5379b7['message'],_0x2db17f);_0x4192a4(_0x106efd[_0x7d77('0x11')](0x1f4,_0x5379b7[_0x7d77('0x13')]));});});};exports[_0x7d77('0x21')]=function(_0x609bd4){var _0x5283fc=this;return new Promise(function(_0x198836,_0x5139ac){return db[_0x7d77('0x16')][_0x7d77('0x22')]({'raw':_0x609bd4[_0x7d77('0x18')]?_0x609bd4[_0x7d77('0x18')][_0x7d77('0x19')]===undefined?!![]:![]:!![],'where':_0x609bd4[_0x7d77('0x18')]?_0x609bd4[_0x7d77('0x18')][_0x7d77('0x1a')]||null:null,'attributes':_0x609bd4[_0x7d77('0x18')]?_0x609bd4['options'][_0x7d77('0x1b')]||null:null,'include':_0x609bd4[_0x7d77('0x18')]?_0x609bd4['options'][_0x7d77('0x1c')]?_['map'](_0x609bd4[_0x7d77('0x18')][_0x7d77('0x1c')],function(_0xf35cf){return{'model':db[_0xf35cf[_0x7d77('0x1e')]],'as':_0xf35cf['as'],'attributes':_0xf35cf[_0x7d77('0x1b')],'include':_0xf35cf['include']?_[_0x7d77('0x1d')](_0xf35cf['include'],function(_0xde8072){return{'model':db[_0xde8072[_0x7d77('0x1e')]],'as':_0xde8072['as'],'attributes':_0xde8072[_0x7d77('0x1b')],'include':_0xde8072[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0xde8072[_0x7d77('0x1c')],function(_0x104758){return{'model':db[_0x104758['model']],'as':_0x104758['as'],'attributes':_0x104758[_0x7d77('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ef7f){logger['info']('ShowTrigger',_0x609bd4);logger[_0x7d77('0xf')](_0x7d77('0x21'),_0x609bd4,JSON[_0x7d77('0x1f')](_0x44ef7f));_0x198836(_0x44ef7f);})[_0x7d77('0x20')](function(_0x32d01b){logger['error'](_0x7d77('0x21'),_0x32d01b[_0x7d77('0x13')],_0x609bd4);_0x5139ac(_0x5283fc['error'](0x1f4,_0x32d01b['message']));});});}; \ No newline at end of file +var _0x6096=['result','catch','GetTrigger','Trigger','options','where','attributes','limit','include','model','map','debug','ShowTrigger','find','raw','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info'];(function(_0x2a3153,_0x4c56b5){var _0x22930e=function(_0x329911){while(--_0x329911){_0x2a3153['push'](_0x2a3153['shift']());}};_0x22930e(++_0x4c56b5);}(_0x6096,0x159));var _0x6609=function(_0x17fc20,_0x7d3f2f){_0x17fc20=_0x17fc20-0x0;var _0x29d108=_0x6096[_0x17fc20];return _0x29d108;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6609('0x0'));var rs=require(_0x6609('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6609('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6609('0x3'))('rpc');var config=require(_0x6609('0x4'));var jayson=require(_0x6609('0x5'));var client=jayson[_0x6609('0x6')][_0x6609('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38a11b,_0x5a696e,_0xfcf978){return new BPromise(function(_0x899abe,_0x1fcf95){return client[_0x6609('0x8')](_0x38a11b,_0xfcf978)[_0x6609('0x9')](function(_0x18003c){logger['info'](_0x6609('0xa'),_0x5a696e,_0x6609('0xb'));logger['debug'](_0x6609('0xc'),_0x5a696e,_0x6609('0xb'),JSON[_0x6609('0xd')](_0x18003c));if(_0x18003c['error']){if(_0x18003c['error'][_0x6609('0xe')]===0x1f4){logger[_0x6609('0xf')](_0x6609('0xa'),_0x5a696e,_0x18003c[_0x6609('0xf')]['message']);return _0x1fcf95(_0x18003c['error'][_0x6609('0x10')]);}logger[_0x6609('0xf')](_0x6609('0xa'),_0x5a696e,_0x18003c[_0x6609('0xf')][_0x6609('0x10')]);return _0x899abe(_0x18003c[_0x6609('0xf')]['message']);}else{logger[_0x6609('0x11')](_0x6609('0xa'),_0x5a696e,_0x6609('0xb'));_0x899abe(_0x18003c[_0x6609('0x12')][_0x6609('0x10')]);}})[_0x6609('0x13')](function(_0x206f81){logger[_0x6609('0xf')](_0x6609('0xa'),_0x5a696e,_0x206f81);_0x1fcf95(_0x206f81);});});}exports[_0x6609('0x14')]=function(_0x4da68b){var _0x353e7c=this;return new Promise(function(_0x2c3700,_0x4f37fd){return db[_0x6609('0x15')]['findAll']({'raw':_0x4da68b[_0x6609('0x16')]?_0x4da68b[_0x6609('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4da68b[_0x6609('0x16')]?_0x4da68b[_0x6609('0x16')][_0x6609('0x17')]||null:null,'attributes':_0x4da68b['options']?_0x4da68b[_0x6609('0x16')][_0x6609('0x18')]||null:null,'limit':_0x4da68b[_0x6609('0x16')]?_0x4da68b[_0x6609('0x16')][_0x6609('0x19')]||null:null,'include':_0x4da68b[_0x6609('0x16')]?_0x4da68b[_0x6609('0x16')]['include']?_['map'](_0x4da68b[_0x6609('0x16')][_0x6609('0x1a')],function(_0x21cb27){return{'model':db[_0x21cb27[_0x6609('0x1b')]],'as':_0x21cb27['as'],'attributes':_0x21cb27['attributes'],'include':_0x21cb27[_0x6609('0x1a')]?_[_0x6609('0x1c')](_0x21cb27[_0x6609('0x1a')],function(_0x322b9c){return{'model':db[_0x322b9c[_0x6609('0x1b')]],'as':_0x322b9c['as'],'attributes':_0x322b9c['attributes'],'include':_0x322b9c[_0x6609('0x1a')]?_['map'](_0x322b9c['include'],function(_0x4bcdde){return{'model':db[_0x4bcdde[_0x6609('0x1b')]],'as':_0x4bcdde['as'],'attributes':_0x4bcdde[_0x6609('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6609('0x9')](function(_0x4ccb08){logger['info'](_0x6609('0x14'),_0x4da68b);logger[_0x6609('0x1d')]('GetTrigger',_0x4da68b,JSON['stringify'](_0x4ccb08));_0x2c3700(_0x4ccb08);})[_0x6609('0x13')](function(_0x240118){logger[_0x6609('0xf')](_0x6609('0x14'),_0x240118[_0x6609('0x10')],_0x4da68b);_0x4f37fd(_0x353e7c['error'](0x1f4,_0x240118['message']));});});};exports[_0x6609('0x1e')]=function(_0x106367){var _0x1e3b5c=this;return new Promise(function(_0x4b6c6a,_0x49e95c){return db[_0x6609('0x15')][_0x6609('0x1f')]({'raw':_0x106367['options']?_0x106367['options'][_0x6609('0x20')]===undefined?!![]:![]:!![],'where':_0x106367[_0x6609('0x16')]?_0x106367[_0x6609('0x16')]['where']||null:null,'attributes':_0x106367['options']?_0x106367[_0x6609('0x16')][_0x6609('0x18')]||null:null,'include':_0x106367[_0x6609('0x16')]?_0x106367[_0x6609('0x16')][_0x6609('0x1a')]?_[_0x6609('0x1c')](_0x106367[_0x6609('0x16')]['include'],function(_0x55cce1){return{'model':db[_0x55cce1[_0x6609('0x1b')]],'as':_0x55cce1['as'],'attributes':_0x55cce1['attributes'],'include':_0x55cce1[_0x6609('0x1a')]?_['map'](_0x55cce1[_0x6609('0x1a')],function(_0x43f229){return{'model':db[_0x43f229[_0x6609('0x1b')]],'as':_0x43f229['as'],'attributes':_0x43f229[_0x6609('0x18')],'include':_0x43f229[_0x6609('0x1a')]?_[_0x6609('0x1c')](_0x43f229[_0x6609('0x1a')],function(_0x5dc95a){return{'model':db[_0x5dc95a[_0x6609('0x1b')]],'as':_0x5dc95a['as'],'attributes':_0x5dc95a[_0x6609('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6609('0x9')](function(_0x255e91){logger[_0x6609('0x11')](_0x6609('0x1e'),_0x106367);logger[_0x6609('0x1d')](_0x6609('0x1e'),_0x106367,JSON[_0x6609('0xd')](_0x255e91));_0x4b6c6a(_0x255e91);})[_0x6609('0x13')](function(_0x13a44a){logger['error'](_0x6609('0x1e'),_0x13a44a['message'],_0x106367);_0x49e95c(_0x1e3b5c[_0x6609('0xf')](0x1f4,_0x13a44a['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e4f7b6f..dfbce44 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 _0xc3ef=['isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get'];(function(_0x3eee4e,_0x417ac8){var _0x42a56b=function(_0xfe7a3a){while(--_0xfe7a3a){_0x3eee4e['push'](_0x3eee4e['shift']());}};_0x42a56b(++_0x417ac8);}(_0xc3ef,0x89));var _0xfc3e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc3ef[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xfc3e('0x0'));var util=require(_0xfc3e('0x1'));var path=require('path');var timeout=require(_0xfc3e('0x2'));var express=require(_0xfc3e('0x3'));var router=express[_0xfc3e('0x4')]();var fs_extra=require(_0xfc3e('0x5'));var auth=require(_0xfc3e('0x6'));var interaction=require(_0xfc3e('0x7'));var config=require('../../config/environment');var controller=require(_0xfc3e('0x8'));router[_0xfc3e('0x9')]('/',auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xb')]);router['get']('/:id',auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xc')]);router[_0xfc3e('0xd')](_0xfc3e('0xe'),auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xf')]);router[_0xfc3e('0xd')]('/',auth['isAuthenticated'](),controller[_0xfc3e('0x10')]);router[_0xfc3e('0x11')](_0xfc3e('0x12'),auth[_0xfc3e('0xa')](),controller['update']);router[_0xfc3e('0x13')](_0xfc3e('0x12'),auth[_0xfc3e('0xa')](),controller[_0xfc3e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe59b=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','/:id','show','post','/:id/clone','clone','isAuthenticated','create','update'];(function(_0x2f7763,_0xce17d9){var _0x47b0cd=function(_0xa9720a){while(--_0xa9720a){_0x2f7763['push'](_0x2f7763['shift']());}};_0x47b0cd(++_0xce17d9);}(_0xe59b,0x119));var _0xbe59=function(_0x29a580,_0xc0cfbb){_0x29a580=_0x29a580-0x0;var _0x196b8c=_0xe59b[_0x29a580];return _0x196b8c;};'use strict';var multer=require(_0xbe59('0x0'));var util=require(_0xbe59('0x1'));var path=require(_0xbe59('0x2'));var timeout=require(_0xbe59('0x3'));var express=require(_0xbe59('0x4'));var router=express['Router']();var fs_extra=require(_0xbe59('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe59('0x6'));var config=require(_0xbe59('0x7'));var controller=require(_0xbe59('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbe59('0x9')]);router[_0xbe59('0xa')](_0xbe59('0xb'),auth['isAuthenticated'](),controller[_0xbe59('0xc')]);router[_0xbe59('0xd')](_0xbe59('0xe'),auth['isAuthenticated'](),controller[_0xbe59('0xf')]);router[_0xbe59('0xd')]('/',auth[_0xbe59('0x10')](),controller[_0xbe59('0x11')]);router['put']('/:id',auth[_0xbe59('0x10')](),controller[_0xbe59('0x12')]);router['delete'](_0xbe59('0xb'),auth[_0xbe59('0x10')](),controller['destroy']);module[_0xbe59('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 8d48c0f..8b32374 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 _0x7e03=['force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','STRING','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0x7e03,0x113));var _0x37e0=function(_0x469e3d,_0x4b8a1b){_0x469e3d=_0x469e3d-0x0;var _0x31144f=_0x7e03[_0x469e3d];return _0x31144f;};'use strict';var Sequelize=require(_0x37e0('0x0'));module[_0x37e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x37e0('0x2'),_0x37e0('0x3'),_0x37e0('0x4')),'allowNull':![],'defaultValue':_0x37e0('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x37e0('0x5')},'callingpres':{'type':Sequelize[_0x37e0('0x6')]('ALLOWED_NOT_SCREENED',_0x37e0('0x7'),_0x37e0('0x8'),_0x37e0('0x9'),'PROHIB_NOT_SCREENED',_0x37e0('0xa'),_0x37e0('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x37e0('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x37e0('0xc')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x37e0('0xc')]},'transport':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'udp','set':function(_0x468785){this['setDataValue'](_0x37e0('0xd'),_0x468785?_0x468785[_0x37e0('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x37e0('0xd'))?this[_0x37e0('0xf')]('transport')[_0x37e0('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x11'),_0x37e0('0x12'),_0x37e0('0x13'),_0x37e0('0x14'),_0x37e0('0x15')),'defaultValue':_0x37e0('0x11')},'directmedia':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no',_0x37e0('0x17'),'update',_0x37e0('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x37e0('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x37e0('0xc')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x37e0('0x19'),'set':function(_0x55544c){this[_0x37e0('0x1a')](_0x37e0('0x1b'),_0x55544c?_0x55544c[_0x37e0('0xe')](','):null);},'get':function(){return this[_0x37e0('0xf')]('nat')?this['getDataValue']('nat')[_0x37e0('0x10')](','):null;},'comment':_0x37e0('0x1c')},'callgroup':{'type':Sequelize[_0x37e0('0xc')]},'namedcallgroup':{'type':Sequelize[_0x37e0('0xc')]},'pickupgroup':{'type':Sequelize[_0x37e0('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x37e0('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25e37c){this[_0x37e0('0x1a')](_0x37e0('0x1d'),_0x25e37c?_0x25e37c['join'](';'):_0x37e0('0x1e'));},'get':function(){return this[_0x37e0('0xf')]('allow')?this[_0x37e0('0xf')](_0x37e0('0x1d'))[_0x37e0('0x10')](';'):null;},'comment':_0x37e0('0x1f')},'autoframing':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'insecure':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':_0x37e0('0x20'),'set':function(_0xd35ad8){this[_0x37e0('0x1a')](_0x37e0('0x21'),_0xd35ad8?_0xd35ad8[_0x37e0('0xe')](','):null);},'get':function(){return this[_0x37e0('0xf')](_0x37e0('0x21'))?this['getDataValue'](_0x37e0('0x21'))[_0x37e0('0x10')](','):null;},'comment':_0x37e0('0x22')},'trustrpid':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x37e0('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'accountcode':{'type':Sequelize[_0x37e0('0x23')](0xb)},'setvar':{'type':Sequelize[_0x37e0('0xc')]},'callerid':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':_0x37e0('0x24')},'amaflags':{'type':Sequelize[_0x37e0('0xc')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x37e0('0x16')},'busylevel':{'type':Sequelize[_0x37e0('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x37e0('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x37e0('0xc')]},'template':{'type':Sequelize[_0x37e0('0xc')]},'videosupport':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no',_0x37e0('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x37e0('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'mailbox':{'type':Sequelize[_0x37e0('0xc')]},'session_timers':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x26'),_0x37e0('0x27'),'originate')},'session_expires':{'type':Sequelize[_0x37e0('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x37e0('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x28'),'uas'),'defaultValue':_0x37e0('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x37e0('0xc')]},'fromdomain':{'type':Sequelize[_0x37e0('0xc')]},'fromuser':{'type':Sequelize[_0x37e0('0xc')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':_0x37e0('0x16')},'keepalive':{'type':Sequelize[_0x37e0('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x37e0('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no',_0x37e0('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x37e0('0xc')]},'callbackextension':{'type':Sequelize[_0x37e0('0xc')]},'timert1':{'type':Sequelize[_0x37e0('0x23')](0xb)},'timerb':{'type':Sequelize[_0x37e0('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x37e0('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x37e0('0xc')]},'contactdeny':{'type':Sequelize[_0x37e0('0xc')]},'contactacl':{'type':Sequelize[_0x37e0('0xc')]},'unsolicited_mailbox':{'type':Sequelize[_0x37e0('0xc')]},'use_q850_reason':{'type':Sequelize[_0x37e0('0xc')]},'maxforwards':{'type':Sequelize[_0x37e0('0x23')](0xb)},'encryption':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'force_avp':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'icesupport':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x37e0('0x6')]('yes','no',_0x37e0('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x37e0('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x37e0('0xc')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x37e0('0xc')]},'dtlscafile':{'type':Sequelize[_0x37e0('0xc')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x37e0('0x2c'),_0x37e0('0x2d'),_0x37e0('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x37e0('0xc')]},'recordofffeature':{'type':Sequelize[_0x37e0('0xc')]},'call_limit':{'type':Sequelize[_0x37e0('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'vmexten':{'type':Sequelize[_0x37e0('0xc')]},'mohinterpret':{'type':Sequelize[_0x37e0('0xc')]},'mohsuggest':{'type':Sequelize[_0x37e0('0xc')]},'parkinglot':{'type':Sequelize[_0x37e0('0xc')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x37e0('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no',_0x37e0('0x17'),_0x37e0('0x30'),_0x37e0('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x37e0('0xc')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'no'}}; \ No newline at end of file +var _0x371c=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','fingerprint','certificate','passive','dynamic','nonat','update,nonat','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','rfc2833','auto','yes','update','force_rport,comedia','nat','join','all','ulaw;alaw;gsm'];(function(_0x168966,_0x2a307f){var _0x9089b4=function(_0x5656ab){while(--_0x5656ab){_0x168966['push'](_0x168966['shift']());}};_0x9089b4(++_0x2a307f);}(_0x371c,0x69));var _0xc371=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x371c[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc371('0x0')],'allowNull':![],'unique':_0xc371('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc371('0x2'),_0xc371('0x3'),_0xc371('0x4')),'allowNull':![],'defaultValue':_0xc371('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc371('0x5')},'callingpres':{'type':Sequelize[_0xc371('0x6')]('ALLOWED_NOT_SCREENED',_0xc371('0x7'),'ALLOWED_FAILED_SCREEN',_0xc371('0x8'),_0xc371('0x9'),_0xc371('0xa'),_0xc371('0xb'),_0xc371('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xc371('0x0')]},'secret':{'type':Sequelize[_0xc371('0x0')]},'md5secret':{'type':Sequelize[_0xc371('0x0')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc371('0x0')],'defaultValue':_0xc371('0xd'),'set':function(_0x5166a9){this[_0xc371('0xe')](_0xc371('0xf'),_0x5166a9?_0x5166a9['join'](','):null);},'get':function(){return this[_0xc371('0x10')](_0xc371('0xf'))?this[_0xc371('0x10')]('transport')[_0xc371('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xc371('0x12'),'info','shortinfo','inband',_0xc371('0x13')),'defaultValue':_0xc371('0x12')},'directmedia':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no','nonat',_0xc371('0x15'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc371('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc371('0x0')]},'directmediadeny':{'type':Sequelize[_0xc371('0x0')]},'nat':{'type':Sequelize[_0xc371('0x0')],'defaultValue':_0xc371('0x16'),'set':function(_0x27e309){this['setDataValue'](_0xc371('0x17'),_0x27e309?_0x27e309[_0xc371('0x18')](','):null);},'get':function(){return this[_0xc371('0x10')]('nat')?this[_0xc371('0x10')](_0xc371('0x17'))[_0xc371('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc371('0x0')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xc371('0x0')]},'namedpickupgroup':{'type':Sequelize[_0xc371('0x0')]},'language':{'type':Sequelize[_0xc371('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc371('0x0')],'defaultValue':_0xc371('0x19')},'allow':{'type':Sequelize[_0xc371('0x0')],'allowNull':![],'defaultValue':_0xc371('0x1a'),'set':function(_0x29e13c){this[_0xc371('0xe')](_0xc371('0x1b'),_0x29e13c?_0x29e13c[_0xc371('0x18')](';'):_0xc371('0x1a'));},'get':function(){return this[_0xc371('0x10')]('allow')?this[_0xc371('0x10')](_0xc371('0x1b'))['split'](';'):null;},'comment':_0xc371('0x1c')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x485124){this[_0xc371('0xe')]('insecure',_0x485124?_0x485124[_0xc371('0x18')](','):null);},'get':function(){return this[_0xc371('0x10')](_0xc371('0x1d'))?this[_0xc371('0x10')](_0xc371('0x1d'))[_0xc371('0x11')](','):null;},'comment':_0xc371('0x1e')},'trustrpid':{'type':Sequelize['ENUM'](_0xc371('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc371('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no',_0xc371('0x1f'))},'promiscredir':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xc371('0x6')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc371('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc371('0x0')]},'callcounter':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc371('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc371('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0xc371('0x0')]},'template':{'type':Sequelize[_0xc371('0x0')]},'videosupport':{'type':Sequelize['ENUM'](_0xc371('0x14'),'no',_0xc371('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'mailbox':{'type':Sequelize[_0xc371('0x0')]},'session_timers':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x22'),_0xc371('0x23'),'originate')},'session_expires':{'type':Sequelize[_0xc371('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x24'),_0xc371('0x25')),'defaultValue':_0xc371('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0xc371('0x0')]},'regexten':{'type':Sequelize[_0xc371('0x0')]},'fromdomain':{'type':Sequelize[_0xc371('0x0')]},'fromuser':{'type':Sequelize[_0xc371('0x0')]},'port':{'type':Sequelize[_0xc371('0x20')](0x5)},'qualify':{'type':Sequelize[_0xc371('0x6')]('yes','no'),'defaultValue':_0xc371('0x14')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xc371('0x0')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc371('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc371('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc371('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc371('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xc371('0x0')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xc371('0x0')]},'use_q850_reason':{'type':Sequelize[_0xc371('0x0')]},'maxforwards':{'type':Sequelize[_0xc371('0x20')](0xb)},'encryption':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'force_avp':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'icesupport':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no',_0xc371('0x26'),_0xc371('0x27'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xc371('0x0')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xc371('0x28'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc371('0x0')]},'recordofffeature':{'type':Sequelize[_0xc371('0x0')]},'call_limit':{'type':Sequelize[_0xc371('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no')},'vmexten':{'type':Sequelize[_0xc371('0x0')]},'mohinterpret':{'type':Sequelize[_0xc371('0x0')]},'mohsuggest':{'type':Sequelize[_0xc371('0x0')]},'parkinglot':{'type':Sequelize[_0xc371('0x0')]},'description':{'type':Sequelize[_0xc371('0x0')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xc371('0x29')},'canreinvite':{'type':Sequelize[_0xc371('0x6')](_0xc371('0x14'),'no',_0xc371('0x2a'),_0xc371('0x15'),_0xc371('0x2b')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc371('0x0')]},'otherFields':{'type':Sequelize[_0xc371('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc371('0x0')],'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 65f967b..0b1c67b 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 _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0xfc5a84,_0x552e63){var _0x15cacb=function(_0x4f135b){while(--_0x4f135b){_0xfc5a84['push'](_0xfc5a84['shift']());}};_0x15cacb(++_0x552e63);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x113d6a,_0x212abd){_0x113d6a=_0x113d6a-0x0;var _0x38448d=_0xd6d6[_0x113d6a];return _0x38448d;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x2dd7fc,_0x42c03c){var _0x1eac5d=function(_0x48fe12){while(--_0x48fe12){_0x2dd7fc['push'](_0x2dd7fc['shift']());}};_0x1eac5d(++_0x42c03c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0xa08ad0,_0x34b452){_0xa08ad0=_0xa08ad0-0x0;var _0x5c037f=_0x8d0e[_0xa08ad0];return _0x5c037f;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index da79c78..01aec6b 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 _0xd1fb=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x2874c2,_0x1de2df){var _0x1624d2=function(_0x2857a2){while(--_0x2857a2){_0x2874c2['push'](_0x2874c2['shift']());}};_0x1624d2(++_0x1de2df);}(_0xd1fb,0xe5));var _0xbd1f=function(_0x4950a6,_0xb4845f){_0x4950a6=_0x4950a6-0x0;var _0x10f9a2=_0xd1fb[_0x4950a6];return _0x10f9a2;};'use strict';var _=require(_0xbd1f('0x0'));var util=require(_0xbd1f('0x1'));var logger=require(_0xbd1f('0x2'))(_0xbd1f('0x3'));var moment=require(_0xbd1f('0x4'));var BPromise=require(_0xbd1f('0x5'));var rp=require(_0xbd1f('0x6'));var fs=require('fs');var path=require(_0xbd1f('0x7'));var rimraf=require(_0xbd1f('0x8'));var config=require(_0xbd1f('0x9'));var attributes=require(_0xbd1f('0xa'));module[_0xbd1f('0xb')]=function(_0xd71db5,_0x5c0334){return _0xd71db5[_0xbd1f('0xc')](_0xbd1f('0xd'),attributes,{'tableName':_0xbd1f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa569=['define','tools_trunks','lodash','util','api','bluebird','path','../../config/environment','./trunk.attributes','exports'];(function(_0x66b9b4,_0x8780d7){var _0x3016f0=function(_0x5f449e){while(--_0x5f449e){_0x66b9b4['push'](_0x66b9b4['shift']());}};_0x3016f0(++_0x8780d7);}(_0xa569,0x19c));var _0x9a56=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0xa569[_0x5d9ceb];return _0x33ce82;};'use strict';var _=require(_0x9a56('0x0'));var util=require(_0x9a56('0x1'));var logger=require('../../config/logger')(_0x9a56('0x2'));var moment=require('moment');var BPromise=require(_0x9a56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a56('0x4'));var rimraf=require('rimraf');var config=require(_0x9a56('0x5'));var attributes=require(_0x9a56('0x6'));module[_0x9a56('0x7')]=function(_0x3ed8c7,_0x2a5b10){return _0x3ed8c7[_0x9a56('0x8')]('Trunk',attributes,{'tableName':_0x9a56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index c05a71e..daef9d0 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 _0xa543=['limit','include','map','model','debug','catch','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrunk','findAll','options','where','attributes'];(function(_0x2e1c99,_0x2b667a){var _0x3d5e7e=function(_0x142f29){while(--_0x142f29){_0x2e1c99['push'](_0x2e1c99['shift']());}};_0x3d5e7e(++_0x2b667a);}(_0xa543,0x167));var _0x3a54=function(_0x5c02f5,_0x545d10){_0x5c02f5=_0x5c02f5-0x0;var _0xe997ea=_0xa543[_0x5c02f5];return _0xe997ea;};'use strict';var _=require(_0x3a54('0x0'));var util=require(_0x3a54('0x1'));var moment=require(_0x3a54('0x2'));var BPromise=require(_0x3a54('0x3'));var rs=require(_0x3a54('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a54('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a54('0x7'));var client=jayson[_0x3a54('0x8')][_0x3a54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d4ca8,_0x2a8eda,_0x383451){return new BPromise(function(_0x3a3eb7,_0x5b7d02){return client[_0x3a54('0xa')](_0x2d4ca8,_0x383451)[_0x3a54('0xb')](function(_0x123b6d){logger[_0x3a54('0xc')](_0x3a54('0xd'),_0x2a8eda,'request\x20sent');logger['debug'](_0x3a54('0xe'),_0x2a8eda,_0x3a54('0xf'),JSON[_0x3a54('0x10')](_0x123b6d));if(_0x123b6d['error']){if(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x12')]===0x1f4){logger[_0x3a54('0x11')](_0x3a54('0xd'),_0x2a8eda,_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);return _0x5b7d02(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);}logger[_0x3a54('0x11')](_0x3a54('0xd'),_0x2a8eda,_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);return _0x3a3eb7(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);}else{logger[_0x3a54('0xc')](_0x3a54('0xd'),_0x2a8eda,_0x3a54('0xf'));_0x3a3eb7(_0x123b6d[_0x3a54('0x14')][_0x3a54('0x13')]);}})['catch'](function(_0x63807){logger[_0x3a54('0x11')]('Trunk,\x20%s,\x20%s',_0x2a8eda,_0x63807);_0x5b7d02(_0x63807);});});}exports[_0x3a54('0x15')]=function(_0x53a464){var _0x3832e1=this;return new Promise(function(_0x1767fe,_0x1e4205){return db['Trunk'][_0x3a54('0x16')]({'raw':_0x53a464['options']?_0x53a464[_0x3a54('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x18')]||null:null,'attributes':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x19')]||null:null,'limit':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x1a')]||null:null,'include':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x53a464[_0x3a54('0x17')][_0x3a54('0x1b')],function(_0x438fe2){return{'model':db[_0x438fe2['model']],'as':_0x438fe2['as'],'attributes':_0x438fe2[_0x3a54('0x19')],'include':_0x438fe2[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x438fe2[_0x3a54('0x1b')],function(_0x227961){return{'model':db[_0x227961[_0x3a54('0x1d')]],'as':_0x227961['as'],'attributes':_0x227961[_0x3a54('0x19')],'include':_0x227961[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x227961[_0x3a54('0x1b')],function(_0x52580c){return{'model':db[_0x52580c['model']],'as':_0x52580c['as'],'attributes':_0x52580c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b46be){logger[_0x3a54('0xc')](_0x3a54('0x15'),_0x53a464);logger[_0x3a54('0x1e')](_0x3a54('0x15'),_0x53a464,JSON[_0x3a54('0x10')](_0x5b46be));_0x1767fe(_0x5b46be);})[_0x3a54('0x1f')](function(_0x71f013){logger[_0x3a54('0x11')](_0x3a54('0x15'),_0x71f013[_0x3a54('0x13')],_0x53a464);_0x1e4205(_0x3832e1[_0x3a54('0x11')](0x1f4,_0x71f013['message']));});});};exports[_0x3a54('0x20')]=function(_0x2b011a){var _0x30c689=this;return new Promise(function(_0x428d0e,_0x48cd4d){return db['Trunk'][_0x3a54('0x21')]({'raw':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')][_0x3a54('0x22')]===undefined?!![]:![]:!![],'where':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')][_0x3a54('0x18')]||null:null,'attributes':_0x2b011a['options']?_0x2b011a[_0x3a54('0x17')]['attributes']||null:null,'include':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')]['include']?_['map'](_0x2b011a[_0x3a54('0x17')][_0x3a54('0x1b')],function(_0x24ee39){return{'model':db[_0x24ee39[_0x3a54('0x1d')]],'as':_0x24ee39['as'],'attributes':_0x24ee39[_0x3a54('0x19')],'include':_0x24ee39[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x24ee39['include'],function(_0x5a3b00){return{'model':db[_0x5a3b00[_0x3a54('0x1d')]],'as':_0x5a3b00['as'],'attributes':_0x5a3b00[_0x3a54('0x19')],'include':_0x5a3b00[_0x3a54('0x1b')]?_['map'](_0x5a3b00[_0x3a54('0x1b')],function(_0x44a7f6){return{'model':db[_0x44a7f6['model']],'as':_0x44a7f6['as'],'attributes':_0x44a7f6[_0x3a54('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3a54('0xb')](function(_0x2df99a){logger[_0x3a54('0xc')]('ShowTrunk',_0x2b011a);logger[_0x3a54('0x1e')]('ShowTrunk',_0x2b011a,JSON[_0x3a54('0x10')](_0x2df99a));_0x428d0e(_0x2df99a);})['catch'](function(_0x417280){logger[_0x3a54('0x11')](_0x3a54('0x20'),_0x417280[_0x3a54('0x13')],_0x2b011a);_0x48cd4d(_0x30c689[_0x3a54('0x11')](0x1f4,_0x417280[_0x3a54('0x13')]));});});}; \ No newline at end of file +var _0x008d=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrunk','util','bluebird','randomstring','../../mysqldb'];(function(_0x3ceac8,_0x15070c){var _0x161b4b=function(_0x588398){while(--_0x588398){_0x3ceac8['push'](_0x3ceac8['shift']());}};_0x161b4b(++_0x15070c);}(_0x008d,0x88));var _0xd008=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x008d[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xd008('0x0'));var moment=require('moment');var BPromise=require(_0xd008('0x1'));var rs=require(_0xd008('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd008('0x3'))['db'];var utils=require(_0xd008('0x4'));var logger=require('../../config/logger')(_0xd008('0x5'));var config=require(_0xd008('0x6'));var jayson=require(_0xd008('0x7'));var client=jayson[_0xd008('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cfd98,_0x32df66,_0x2462df){return new BPromise(function(_0xcf07f7,_0x1d11df){return client[_0xd008('0x9')](_0x5cfd98,_0x2462df)[_0xd008('0xa')](function(_0x46d961){logger[_0xd008('0xb')](_0xd008('0xc'),_0x32df66,'request\x20sent');logger[_0xd008('0xd')](_0xd008('0xe'),_0x32df66,_0xd008('0xf'),JSON[_0xd008('0x10')](_0x46d961));if(_0x46d961[_0xd008('0x11')]){if(_0x46d961['error'][_0xd008('0x12')]===0x1f4){logger[_0xd008('0x11')](_0xd008('0xc'),_0x32df66,_0x46d961[_0xd008('0x11')][_0xd008('0x13')]);return _0x1d11df(_0x46d961[_0xd008('0x11')][_0xd008('0x13')]);}logger[_0xd008('0x11')]('Trunk,\x20%s,\x20%s',_0x32df66,_0x46d961['error'][_0xd008('0x13')]);return _0xcf07f7(_0x46d961[_0xd008('0x11')]['message']);}else{logger[_0xd008('0xb')](_0xd008('0xc'),_0x32df66,_0xd008('0xf'));_0xcf07f7(_0x46d961[_0xd008('0x14')]['message']);}})[_0xd008('0x15')](function(_0xef2169){logger['error'](_0xd008('0xc'),_0x32df66,_0xef2169);_0x1d11df(_0xef2169);});});}exports[_0xd008('0x16')]=function(_0x1a37c1){var _0x33276f=this;return new Promise(function(_0x38512a,_0x490bac){return db[_0xd008('0x17')][_0xd008('0x18')]({'raw':_0x1a37c1[_0xd008('0x19')]?_0x1a37c1[_0xd008('0x19')][_0xd008('0x1a')]===undefined?!![]:![]:!![],'where':_0x1a37c1['options']?_0x1a37c1[_0xd008('0x19')][_0xd008('0x1b')]||null:null,'attributes':_0x1a37c1['options']?_0x1a37c1[_0xd008('0x19')][_0xd008('0x1c')]||null:null,'limit':_0x1a37c1['options']?_0x1a37c1[_0xd008('0x19')][_0xd008('0x1d')]||null:null,'include':_0x1a37c1[_0xd008('0x19')]?_0x1a37c1[_0xd008('0x19')][_0xd008('0x1e')]?_[_0xd008('0x1f')](_0x1a37c1['options'][_0xd008('0x1e')],function(_0x3ef4e2){return{'model':db[_0x3ef4e2[_0xd008('0x20')]],'as':_0x3ef4e2['as'],'attributes':_0x3ef4e2[_0xd008('0x1c')],'include':_0x3ef4e2['include']?_['map'](_0x3ef4e2[_0xd008('0x1e')],function(_0x5c53f4){return{'model':db[_0x5c53f4['model']],'as':_0x5c53f4['as'],'attributes':_0x5c53f4[_0xd008('0x1c')],'include':_0x5c53f4[_0xd008('0x1e')]?_[_0xd008('0x1f')](_0x5c53f4['include'],function(_0x3ba100){return{'model':db[_0x3ba100[_0xd008('0x20')]],'as':_0x3ba100['as'],'attributes':_0x3ba100[_0xd008('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd008('0xa')](function(_0x374dd1){logger[_0xd008('0xb')](_0xd008('0x16'),_0x1a37c1);logger[_0xd008('0xd')]('GetTrunk',_0x1a37c1,JSON[_0xd008('0x10')](_0x374dd1));_0x38512a(_0x374dd1);})[_0xd008('0x15')](function(_0x2d1e1a){logger[_0xd008('0x11')](_0xd008('0x16'),_0x2d1e1a['message'],_0x1a37c1);_0x490bac(_0x33276f[_0xd008('0x11')](0x1f4,_0x2d1e1a[_0xd008('0x13')]));});});};exports['ShowTrunk']=function(_0x39bfd2){var _0x25b138=this;return new Promise(function(_0xa159,_0x1cee03){return db[_0xd008('0x17')][_0xd008('0x21')]({'raw':_0x39bfd2[_0xd008('0x19')]?_0x39bfd2[_0xd008('0x19')][_0xd008('0x1a')]===undefined?!![]:![]:!![],'where':_0x39bfd2[_0xd008('0x19')]?_0x39bfd2['options'][_0xd008('0x1b')]||null:null,'attributes':_0x39bfd2[_0xd008('0x19')]?_0x39bfd2[_0xd008('0x19')]['attributes']||null:null,'include':_0x39bfd2[_0xd008('0x19')]?_0x39bfd2[_0xd008('0x19')]['include']?_['map'](_0x39bfd2[_0xd008('0x19')][_0xd008('0x1e')],function(_0x2a5938){return{'model':db[_0x2a5938[_0xd008('0x20')]],'as':_0x2a5938['as'],'attributes':_0x2a5938[_0xd008('0x1c')],'include':_0x2a5938[_0xd008('0x1e')]?_[_0xd008('0x1f')](_0x2a5938[_0xd008('0x1e')],function(_0x7aba00){return{'model':db[_0x7aba00[_0xd008('0x20')]],'as':_0x7aba00['as'],'attributes':_0x7aba00['attributes'],'include':_0x7aba00[_0xd008('0x1e')]?_[_0xd008('0x1f')](_0x7aba00[_0xd008('0x1e')],function(_0x68f929){return{'model':db[_0x68f929[_0xd008('0x20')]],'as':_0x68f929['as'],'attributes':_0x68f929[_0xd008('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd008('0xa')](function(_0x2b7dfb){logger[_0xd008('0xb')](_0xd008('0x22'),_0x39bfd2);logger['debug'](_0xd008('0x22'),_0x39bfd2,JSON[_0xd008('0x10')](_0x2b7dfb));_0xa159(_0x2b7dfb);})[_0xd008('0x15')](function(_0x1373ea){logger[_0xd008('0x11')](_0xd008('0x22'),_0x1373ea[_0xd008('0x13')],_0x39bfd2);_0x1cee03(_0x25b138[_0xd008('0x11')](0x1f4,_0x1373ea[_0xd008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2738df3..05e853e 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed05=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x20f200,_0x146614){var _0x5b7169=function(_0x1a01da){while(--_0x1a01da){_0x20f200['push'](_0x20f200['shift']());}};_0x5b7169(++_0x146614);}(_0xed05,0xcd));var _0x5ed0=function(_0x2bb47a,_0xd334f7){_0x2bb47a=_0x2bb47a-0x0;var _0x510f5d=_0xed05[_0x2bb47a];return _0x510f5d;};'use strict';var express=require(_0x5ed0('0x0'));var router=express[_0x5ed0('0x1')]();var auth=require(_0x5ed0('0x2'));var controller=require(_0x5ed0('0x3'));router[_0x5ed0('0x4')](_0x5ed0('0x5'),auth[_0x5ed0('0x6')](),controller[_0x5ed0('0x7')]);module[_0x5ed0('0x8')]=router; \ No newline at end of file +var _0xb05b=['Router','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x455198,_0x4b6927){var _0x479a26=function(_0x3d03c0){while(--_0x3d03c0){_0x455198['push'](_0x455198['shift']());}};_0x479a26(++_0x4b6927);}(_0xb05b,0x177));var _0xbb05=function(_0x332bb4,_0x24246d){_0x332bb4=_0x332bb4-0x0;var _0x136f0b=_0xb05b[_0x332bb4];return _0x136f0b;};'use strict';var express=require('express');var router=express[_0xbb05('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xbb05('0x1'));router[_0xbb05('0x2')](_0xbb05('0x3'),auth[_0xbb05('0x4')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 495b992..6a9eafd 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0xa4db92,_0x1a07e3){var _0x403706=function(_0x30e61d){while(--_0x30e61d){_0xa4db92['push'](_0xa4db92['shift']());}};_0x403706(++_0x1a07e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0xcafaae,_0x1236ed){var _0x95133e=function(_0x269e16){while(--_0x269e16){_0xcafaae['push'](_0xcafaae['shift']());}};_0x95133e(++_0x1236ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 277298e..9e5299c 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb32d=['admin','Unauthorized','params','UserSetting','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x429e40,_0x16e27e){var _0xfda349=function(_0x4e0a5e){while(--_0x4e0a5e){_0x429e40['push'](_0x429e40['shift']());}};_0xfda349(++_0x16e27e);}(_0xb32d,0x1da));var _0xdb32=function(_0x55d0fd,_0x1b1bdd){_0x55d0fd=_0x55d0fd-0x0;var _0x40ce6f=_0xb32d[_0x55d0fd];return _0x40ce6f;};'use strict';var _=require(_0xdb32('0x0'));var Redis=require(_0xdb32('0x1'));var logger=require(_0xdb32('0x2'))(_0xdb32('0x3'));var config=require(_0xdb32('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xdb32('0x5')]));require(_0xdb32('0x6'))['register'](socket);config[_0xdb32('0x5')]=_[_0xdb32('0x7')](config[_0xdb32('0x5')],{'host':_0xdb32('0x8'),'port':0x18eb});function respondWithResult(_0x6f4af0,_0x386309){_0x386309=_0x386309||0xc8;return function(_0x5bb076){if(_0x5bb076){return _0x6f4af0[_0xdb32('0x9')](_0x386309)[_0xdb32('0xa')](_0x5bb076);}};}function saveUpdates(_0xbe779d){return function(_0x1deacb){if(_0x1deacb){return _0x1deacb[_0xdb32('0xb')](_0xbe779d)[_0xdb32('0xc')](function(_0x112db6){return _0x112db6;});}return null;};}function handleEntityNotFound(_0x3ddfc6){return function(_0x251443){if(!_0x251443){_0x3ddfc6[_0xdb32('0xd')](0x194);}return _0x251443;};}function handleError(_0x296482,_0x2c3355){_0x2c3355=_0x2c3355||0x1f4;return function(_0x91be02){logger[_0xdb32('0xe')](_0x91be02[_0xdb32('0xf')]);if(_0x91be02[_0xdb32('0x10')]){delete _0x91be02[_0xdb32('0x10')];}_0x296482[_0xdb32('0x9')](_0x2c3355)[_0xdb32('0x11')](_0x91be02);};}exports[_0xdb32('0xb')]=function(_0x410b23,_0x5e4377){if(_0x410b23[_0xdb32('0x12')][_0xdb32('0x13')]!==_0xdb32('0x14'))throw new Error(_0xdb32('0x15'));if(isNaN(Number(_0x410b23[_0xdb32('0x16')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xdb32('0x17')][_0xdb32('0x18')]({'where':{'id':_0x410b23[_0xdb32('0x16')]['id']}})['then'](handleEntityNotFound(_0x5e4377,null))['then'](saveUpdates(_0x410b23['body'],null))['then'](respondWithResult(_0x5e4377,null))[_0xdb32('0x19')](handleError(_0x5e4377,null));}; \ No newline at end of file +var _0x44ae=['update','then','sendStatus','error','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','register','defaults','status'];(function(_0xa8ecef,_0x5821e6){var _0x39823c=function(_0x350011){while(--_0x350011){_0xa8ecef['push'](_0xa8ecef['shift']());}};_0x39823c(++_0x5821e6);}(_0x44ae,0x17d));var _0xe44a=function(_0x3ba3c0,_0x129464){_0x3ba3c0=_0x3ba3c0-0x0;var _0x574ae9=_0x44ae[_0x3ba3c0];return _0x574ae9;};'use strict';var _=require(_0xe44a('0x0'));var Redis=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var config=require('../../config/environment');var db=require(_0xe44a('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xe44a('0x5')]));require(_0xe44a('0x6'))[_0xe44a('0x7')](socket);config[_0xe44a('0x5')]=_[_0xe44a('0x8')](config[_0xe44a('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x41a06b,_0x37bbef){_0x37bbef=_0x37bbef||0xc8;return function(_0x21f98c){if(_0x21f98c){return _0x41a06b[_0xe44a('0x9')](_0x37bbef)['json'](_0x21f98c);}};}function saveUpdates(_0x221125){return function(_0xde6308){if(_0xde6308){return _0xde6308[_0xe44a('0xa')](_0x221125)[_0xe44a('0xb')](function(_0x4c52ee){return _0x4c52ee;});}return null;};}function handleEntityNotFound(_0x231326){return function(_0x3493e7){if(!_0x3493e7){_0x231326[_0xe44a('0xc')](0x194);}return _0x3493e7;};}function handleError(_0x1d7db0,_0xe19628){_0xe19628=_0xe19628||0x1f4;return function(_0x30fd36){logger[_0xe44a('0xd')](_0x30fd36['stack']);if(_0x30fd36['name']){delete _0x30fd36['name'];}_0x1d7db0[_0xe44a('0x9')](_0xe19628)[_0xe44a('0xe')](_0x30fd36);};}exports[_0xe44a('0xa')]=function(_0x56cee6,_0x2263ba){if(_0x56cee6[_0xe44a('0xf')][_0xe44a('0x10')]!==_0xe44a('0x11'))throw new Error(_0xe44a('0x12'));if(isNaN(Number(_0x56cee6[_0xe44a('0x13')]['id'])))throw new Error(_0xe44a('0x14'));return db['UserSetting'][_0xe44a('0x15')]({'where':{'id':_0x56cee6[_0xe44a('0x13')]['id']}})['then'](handleEntityNotFound(_0x2263ba,null))['then'](saveUpdates(_0x56cee6['body'],null))['then'](respondWithResult(_0x2263ba,null))[_0xe44a('0x16')](handleError(_0x2263ba,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 0e85e3d..675ca60 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b3e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x270930,_0x5169ca){var _0x2220ca=function(_0xe36c18){while(--_0xe36c18){_0x270930['push'](_0x270930['shift']());}};_0x2220ca(++_0x5169ca);}(_0x0b3e,0x114));var _0xe0b3=function(_0x4501a5,_0xaa8ce7){_0x4501a5=_0x4501a5-0x0;var _0x1ae352=_0x0b3e[_0x4501a5];return _0x1ae352;};'use strict';var EventEmitter=require(_0xe0b3('0x0'));var UserSetting=require(_0xe0b3('0x1'))['db'][_0xe0b3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe0b3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0b3('0x4'),'afterDestroy':_0xe0b3('0x5')};function emitEvent(_0x3529a9){return function(_0xe43f61,_0x3989b1,_0x204600){UserSettingEvents[_0xe0b3('0x6')](_0x3529a9+':'+_0xe43f61['id'],_0xe43f61);UserSettingEvents[_0xe0b3('0x6')](_0x3529a9,_0xe43f61);_0x204600(null);};}for(var e in events){if(events[_0xe0b3('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x3086=['../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x2da1a2,_0xa09d17){var _0x84cce9=function(_0x5778d6){while(--_0x5778d6){_0x2da1a2['push'](_0x2da1a2['shift']());}};_0x84cce9(++_0xa09d17);}(_0x3086,0xbd));var _0x6308=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x3086[_0x1beef3];return _0x5af964;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x6308('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6308('0x1'),'afterUpdate':_0x6308('0x2'),'afterDestroy':_0x6308('0x3')};function emitEvent(_0x4c192a){return function(_0x485e32,_0x240ddd,_0x17dbb3){UserSettingEvents[_0x6308('0x4')](_0x4c192a+':'+_0x485e32['id'],_0x485e32);UserSettingEvents[_0x6308('0x4')](_0x4c192a,_0x485e32);_0x17dbb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x6308('0x5')](e,emitEvent(event));}}module[_0x6308('0x6')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 2dc22ad..b618162 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f3c=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x4f3c[_0x20e7e3];return _0x14b9de;};'use strict';var attributes=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]=function(_0x362124){return _0x362124[_0xc4f3('0x2')](_0xc4f3('0x3'),attributes,{'tableName':_0xc4f3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8261e6){if(!_0x8261e6[_0xc4f3('0x5')])_0x8261e6[_0xc4f3('0x6')]=null;else if(_0x8261e6[_0xc4f3('0x6')]===null)_0x8261e6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x7497=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x7749('0x0'));module[_0x7749('0x1')]=function(_0x24fbc9){return _0x24fbc9['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4000cf){if(!_0x4000cf[_0x7749('0x2')])_0x4000cf['clientSideLoggingEnabledSince']=null;else if(_0x4000cf[_0x7749('0x3')]===null)_0x4000cf[_0x7749('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index a6a5478..e42d082 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f7a=['length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update:user-','UserId','register'];(function(_0x56ff5e,_0x257c79){var _0x26d7c6=function(_0x3cd248){while(--_0x3cd248){_0x56ff5e['push'](_0x56ff5e['shift']());}};_0x26d7c6(++_0x257c79);}(_0x0f7a,0x1bb));var _0xa0f7=function(_0x5b7030,_0x387b0b){_0x5b7030=_0x5b7030-0x0;var _0x198515=_0x0f7a[_0x5b7030];return _0x198515;};'use strict';var UserSettingEvents=require(_0xa0f7('0x0'));var events=[_0xa0f7('0x1'),_0xa0f7('0x2'),'update'];function createListener(_0x36b22b,_0xb28ee2){return function(_0xe8ecb5){_0xb28ee2[_0xa0f7('0x3')](_0x36b22b,_0xe8ecb5);if(_0x36b22b==='user-setting:update'){_0xb28ee2[_0xa0f7('0x3')](_0xa0f7('0x4')+_0xe8ecb5[_0xa0f7('0x5')],_0xe8ecb5);}};}exports[_0xa0f7('0x6')]=function(_0x508ed3){for(var _0x331fd2=0x0,_0x3f57e9=events[_0xa0f7('0x7')];_0x331fd2<_0x3f57e9;_0x331fd2++){var _0x5451e7=events[_0x331fd2];var _0x4b876d=createListener(_0xa0f7('0x8')+_0x5451e7,_0x508ed3);UserSettingEvents['on'](_0x5451e7,_0x4b876d);}}; \ No newline at end of file +var _0x0a6d=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0a6d,0x13e));var _0xd0a6=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x0a6d[_0x2dea24];return _0x309d58;};'use strict';var UserSettingEvents=require(_0xd0a6('0x0'));var events=[_0xd0a6('0x1'),'remove',_0xd0a6('0x2')];function createListener(_0x46330a,_0x3936bd){return function(_0x3431d6){_0x3936bd[_0xd0a6('0x3')](_0x46330a,_0x3431d6);if(_0x46330a===_0xd0a6('0x4')){_0x3936bd[_0xd0a6('0x3')](_0xd0a6('0x5')+_0x3431d6[_0xd0a6('0x6')],_0x3431d6);}};}exports[_0xd0a6('0x7')]=function(_0x501696){for(var _0x31395c=0x0,_0x2678d3=events[_0xd0a6('0x8')];_0x31395c<_0x2678d3;_0x31395c++){var _0x2d06e2=events[_0x31395c];var _0x5149aa=createListener(_0xd0a6('0x9')+_0x2d06e2,_0x501696);UserSettingEvents['on'](_0x2d06e2,_0x5149aa);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ee03a98..88c3b22 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 _0xa23a=['/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa23a,0x1b4));var _0xaa23=function(_0x1b9a9f,_0x482c35){_0x1b9a9f=_0x1b9a9f-0x0;var _0x2552fd=_0xa23a[_0x1b9a9f];return _0x2552fd;};'use strict';var multer=require(_0xaa23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa23('0x1'));var express=require(_0xaa23('0x2'));var router=express[_0xaa23('0x3')]();var fs_extra=require(_0xaa23('0x4'));var auth=require(_0xaa23('0x5'));var interaction=require(_0xaa23('0x6'));var config=require(_0xaa23('0x7'));var controller=require(_0xaa23('0x8'));router[_0xaa23('0x9')]('/',auth[_0xaa23('0xa')](),controller[_0xaa23('0xb')]);router[_0xaa23('0x9')](_0xaa23('0xc'),auth[_0xaa23('0xa')](),controller['describe']);router['get'](_0xaa23('0xd'),auth[_0xaa23('0xa')](),controller[_0xaa23('0xe')]);router['get']('/presence',auth['isAuthenticated'](),controller[_0xaa23('0xf')]);router[_0xaa23('0x9')](_0xaa23('0x10'),auth[_0xaa23('0xa')](),controller['show']);router[_0xaa23('0x9')](_0xaa23('0x11'),controller[_0xaa23('0x12')]);router['get']('/:id/open_tabs',auth[_0xaa23('0xa')](),controller[_0xaa23('0x13')]);router['get'](_0xaa23('0x14'),auth[_0xaa23('0xa')](),controller['getContacts']);router[_0xaa23('0x9')](_0xaa23('0x15'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x16')]);router[_0xaa23('0x9')](_0xaa23('0x17'),auth['isAuthenticated'](),controller[_0xaa23('0x18')]);router[_0xaa23('0x9')]('/:id/groups',auth[_0xaa23('0xa')](),controller[_0xaa23('0x19')]);router[_0xaa23('0x9')](_0xaa23('0x1a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x1b')]);router[_0xaa23('0x9')](_0xaa23('0x1c'),auth['isAuthenticated'](),controller[_0xaa23('0x1d')]);router[_0xaa23('0x9')](_0xaa23('0x1e'),auth['isAuthenticated'](),controller[_0xaa23('0x1f')]);router[_0xaa23('0x9')]('/:id/openchannel/interactions',auth[_0xaa23('0xa')](),controller['getOpenchannelInteractions']);router['get'](_0xaa23('0x20'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x21')]);router[_0xaa23('0x9')](_0xaa23('0x22'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x23')]);router[_0xaa23('0x9')](_0xaa23('0x24'),auth[_0xaa23('0xa')](),controller['getFaxInteractions']);router['get'](_0xaa23('0x25'),auth[_0xaa23('0xa')](),controller['getWhatsappInteractions']);router[_0xaa23('0x9')](_0xaa23('0x26'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x27')]);router[_0xaa23('0x9')](_0xaa23('0x28'),auth[_0xaa23('0xa')](),controller['getLists']);router[_0xaa23('0x9')](_0xaa23('0x29'),auth[_0xaa23('0xa')](),controller['getAgents']);router[_0xaa23('0x9')](_0xaa23('0x2a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2b')]);router['get']('/:id/fax_accounts',auth[_0xaa23('0xa')](),controller['getFaxAccounts']);router['get'](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2d')]);router[_0xaa23('0x9')](_0xaa23('0x2e'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2f')]);router[_0xaa23('0x9')](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x31')]);router[_0xaa23('0x9')]('/:id/chat_websites',auth[_0xaa23('0xa')](),controller[_0xaa23('0x32')]);router[_0xaa23('0x9')](_0xaa23('0x33'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x34')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router['get'](_0xaa23('0x35'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x36')]);router['get']('/:id/api_key',auth[_0xaa23('0xa')](),controller[_0xaa23('0x37')]);router[_0xaa23('0x38')]('/:id/contacts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x39')]);router[_0xaa23('0x38')]('/',auth[_0xaa23('0xa')](),controller[_0xaa23('0x3a')]);router['post'](_0xaa23('0x3b'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x3c')]);router[_0xaa23('0x38')](_0xaa23('0x15'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x3d')]);var upload=multer({'storage':multer[_0xaa23('0x3e')]({'destination':function(_0x48cbae,_0x2519d1,_0xc2355){_0xc2355(null,path[_0xaa23('0x3f')](config[_0xaa23('0x40')],_0xaa23('0x41')));},'filename':function(_0x178127,_0x486753,_0x16bb22){_0x16bb22(null,util[_0xaa23('0x42')](_0xaa23('0x43'),Date['now'](),_0x486753[_0xaa23('0x44')]));}})});router[_0xaa23('0x38')]('/:id/avatar',upload[_0xaa23('0x45')]('file'),controller[_0xaa23('0x46')]);router[_0xaa23('0x38')](_0xaa23('0x47'),auth['isAuthenticated'](),controller[_0xaa23('0x48')]);router[_0xaa23('0x38')](_0xaa23('0x49'),auth['isAuthenticated'](),controller[_0xaa23('0x4a')]);router[_0xaa23('0x38')](_0xaa23('0x4b'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x4c')]);router['post'](_0xaa23('0x4d'),auth['isAuthenticated'](),controller[_0xaa23('0x4e')]);router[_0xaa23('0x38')](_0xaa23('0x26'),auth['isAuthenticated'](),controller[_0xaa23('0x4f')]);router['post'](_0xaa23('0x50'),auth['isAuthenticated'](),controller[_0xaa23('0x51')]);router['post'](_0xaa23('0x52'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x53')]);router[_0xaa23('0x38')](_0xaa23('0x54'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x55')]);router[_0xaa23('0x38')](_0xaa23('0x56'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x57')]);router[_0xaa23('0x38')](_0xaa23('0x58'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x59')]);router['post'](_0xaa23('0x5a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5b')]);router[_0xaa23('0x38')](_0xaa23('0x5c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5d')]);router[_0xaa23('0x38')](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5e')]);router[_0xaa23('0x38')](_0xaa23('0x2e'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5f')]);router[_0xaa23('0x38')](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x60')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xaa23('0x61')]);router[_0xaa23('0x38')](_0xaa23('0x33'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x62')]);router[_0xaa23('0x38')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xaa23('0x63')]);router['post'](_0xaa23('0x64'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x65')]);router[_0xaa23('0x66')](_0xaa23('0x10'),auth[_0xaa23('0xa')](),controller['update']);router[_0xaa23('0x66')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0xaa23('0x15'),auth['isAuthenticated'](),controller[_0xaa23('0x67')]);router[_0xaa23('0x68')](_0xaa23('0x26'),auth['isAuthenticated'](),controller[_0xaa23('0x69')]);router[_0xaa23('0x68')]('/:id',auth[_0xaa23('0xa')](),controller[_0xaa23('0x6a')]);router[_0xaa23('0x68')](_0xaa23('0x50'),auth[_0xaa23('0xa')](),controller['removeChatInteractions']);router['delete'](_0xaa23('0x52'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6b')]);router[_0xaa23('0x68')](_0xaa23('0x54'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6c')]);router[_0xaa23('0x68')]('/:id/sms_interactions',auth[_0xaa23('0xa')](),controller[_0xaa23('0x6d')]);router[_0xaa23('0x68')](_0xaa23('0x58'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6e')]);router[_0xaa23('0x68')](_0xaa23('0x5a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6f')]);router[_0xaa23('0x68')](_0xaa23('0x5c'),auth['isAuthenticated'](),controller[_0xaa23('0x70')]);router[_0xaa23('0x68')](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x71')]);router['delete']('/:id/openchannel_accounts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x72')]);router['delete'](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x73')]);router[_0xaa23('0x68')](_0xaa23('0x74'),auth['isAuthenticated'](),controller[_0xaa23('0x75')]);router[_0xaa23('0x68')]('/:id/whatsapp_accounts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x76')]);router[_0xaa23('0x68')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xaa23('0x77')]);router['delete'](_0xaa23('0x64'),auth[_0xaa23('0xa')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x6d36=['post','addContacts','create','/create_many','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','originalname','single','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','changePassword','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','getApiKey'];(function(_0x2216f9,_0xce5b40){var _0x39eab6=function(_0x5eb8f5){while(--_0x5eb8f5){_0x2216f9['push'](_0x2216f9['shift']());}};_0x39eab6(++_0xce5b40);}(_0x6d36,0xb0));var _0x66d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6d36[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x66d3('0x0'));var util=require(_0x66d3('0x1'));var path=require(_0x66d3('0x2'));var timeout=require(_0x66d3('0x3'));var express=require(_0x66d3('0x4'));var router=express[_0x66d3('0x5')]();var fs_extra=require(_0x66d3('0x6'));var auth=require(_0x66d3('0x7'));var interaction=require(_0x66d3('0x8'));var config=require(_0x66d3('0x9'));var controller=require(_0x66d3('0xa'));router[_0x66d3('0xb')]('/',auth[_0x66d3('0xc')](),controller[_0x66d3('0xd')]);router[_0x66d3('0xb')](_0x66d3('0xe'),auth[_0x66d3('0xc')](),controller[_0x66d3('0xf')]);router[_0x66d3('0xb')]('/whoami',auth['isAuthenticated'](),controller['whoami']);router[_0x66d3('0xb')](_0x66d3('0x10'),auth['isAuthenticated'](),controller[_0x66d3('0x11')]);router[_0x66d3('0xb')](_0x66d3('0x12'),auth['isAuthenticated'](),controller[_0x66d3('0x13')]);router['get'](_0x66d3('0x14'),controller[_0x66d3('0x15')]);router[_0x66d3('0xb')](_0x66d3('0x16'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x66d3('0xb')](_0x66d3('0x17'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x18')]);router[_0x66d3('0xb')]('/:id/queues',auth[_0x66d3('0xc')](),controller['getQueues']);router[_0x66d3('0xb')](_0x66d3('0x19'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x1a')]);router['get'](_0x66d3('0x1b'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x1c')]);router[_0x66d3('0xb')](_0x66d3('0x1d'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x1e')]);router['get'](_0x66d3('0x1f'),auth['isAuthenticated'](),controller[_0x66d3('0x20')]);router[_0x66d3('0xb')](_0x66d3('0x21'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x22')]);router[_0x66d3('0xb')]('/:id/openchannel/interactions',auth[_0x66d3('0xc')](),controller['getOpenchannelInteractions']);router['get'](_0x66d3('0x23'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x24')]);router[_0x66d3('0xb')](_0x66d3('0x25'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x66d3('0xb')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x66d3('0x26')]);router[_0x66d3('0xb')](_0x66d3('0x27'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x28')]);router[_0x66d3('0xb')](_0x66d3('0x29'),auth[_0x66d3('0xc')](),controller['getTeams']);router[_0x66d3('0xb')](_0x66d3('0x2a'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x2b')]);router[_0x66d3('0xb')](_0x66d3('0x2c'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x2d')]);router[_0x66d3('0xb')](_0x66d3('0x2e'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x2f')]);router[_0x66d3('0xb')](_0x66d3('0x30'),auth['isAuthenticated'](),controller[_0x66d3('0x31')]);router[_0x66d3('0xb')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x66d3('0x32')]);router['get'](_0x66d3('0x33'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x34')]);router['get'](_0x66d3('0x35'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x36')]);router[_0x66d3('0xb')](_0x66d3('0x37'),auth[_0x66d3('0xc')](),controller['getChatWebsites']);router[_0x66d3('0xb')](_0x66d3('0x38'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x39')]);router[_0x66d3('0xb')](_0x66d3('0x3a'),auth['isAuthenticated'](),controller[_0x66d3('0x3b')]);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x66d3('0x3c')]);router[_0x66d3('0xb')]('/:id/api_key',auth[_0x66d3('0xc')](),controller[_0x66d3('0x3d')]);router[_0x66d3('0x3e')]('/:id/contacts',auth[_0x66d3('0xc')](),controller[_0x66d3('0x3f')]);router['post']('/',auth['isAuthenticated'](),controller[_0x66d3('0x40')]);router[_0x66d3('0x3e')](_0x66d3('0x41'),auth[_0x66d3('0xc')](),controller['bulkCreate']);router['post'](_0x66d3('0x42'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x43')]);var upload=multer({'storage':multer[_0x66d3('0x44')]({'destination':function(_0x3b30d5,_0x37d347,_0x30e01a){_0x30e01a(null,path[_0x66d3('0x45')](config[_0x66d3('0x46')],_0x66d3('0x47')));},'filename':function(_0x22c80d,_0x36907f,_0x5d4c2a){_0x5d4c2a(null,util[_0x66d3('0x48')]('%s-%s',Date['now'](),_0x36907f[_0x66d3('0x49')]));}})});router[_0x66d3('0x3e')]('/:id/avatar',upload[_0x66d3('0x4a')]('file'),controller['addAvatar']);router[_0x66d3('0x3e')](_0x66d3('0x4b'),auth['isAuthenticated'](),controller[_0x66d3('0x4c')]);router[_0x66d3('0x3e')]('/:id/logout',auth[_0x66d3('0xc')](),controller[_0x66d3('0x4d')]);router[_0x66d3('0x3e')](_0x66d3('0x4e'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x4f')]);router[_0x66d3('0x3e')](_0x66d3('0x50'),auth[_0x66d3('0xc')](),controller['unpause']);router['post'](_0x66d3('0x29'),auth['isAuthenticated'](),controller[_0x66d3('0x51')]);router['post'](_0x66d3('0x52'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x53')]);router[_0x66d3('0x3e')](_0x66d3('0x54'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x55')]);router[_0x66d3('0x3e')](_0x66d3('0x56'),auth['isAuthenticated'](),controller[_0x66d3('0x57')]);router[_0x66d3('0x3e')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x66d3('0x58')]);router['post'](_0x66d3('0x59'),auth['isAuthenticated'](),controller[_0x66d3('0x5a')]);router[_0x66d3('0x3e')](_0x66d3('0x5b'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x5c')]);router['post'](_0x66d3('0x30'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x5d')]);router[_0x66d3('0x3e')](_0x66d3('0x5e'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x5f')]);router[_0x66d3('0x3e')](_0x66d3('0x33'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x60')]);router[_0x66d3('0x3e')]('/:id/sms_accounts',auth[_0x66d3('0xc')](),controller['addSmsAccounts']);router[_0x66d3('0x3e')](_0x66d3('0x37'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x61')]);router[_0x66d3('0x3e')](_0x66d3('0x38'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x62')]);router[_0x66d3('0x3e')]('/:id/square_projects',auth[_0x66d3('0xc')](),controller[_0x66d3('0x63')]);router['post'](_0x66d3('0x64'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x65')]);router[_0x66d3('0x66')]('/:id',auth['isAuthenticated'](),controller[_0x66d3('0x67')]);router[_0x66d3('0x66')]('/:id/password',auth[_0x66d3('0xc')](),controller[_0x66d3('0x68')]);router['delete']('/:id/queues',auth[_0x66d3('0xc')](),controller[_0x66d3('0x69')]);router[_0x66d3('0x6a')](_0x66d3('0x29'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x6b')]);router[_0x66d3('0x6a')](_0x66d3('0x12'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x6c')]);router[_0x66d3('0x6a')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['removeChatInteractions']);router['delete'](_0x66d3('0x54'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x6d')]);router[_0x66d3('0x6a')](_0x66d3('0x56'),auth[_0x66d3('0xc')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x66d3('0xc')](),controller[_0x66d3('0x6e')]);router[_0x66d3('0x6a')](_0x66d3('0x59'),auth['isAuthenticated'](),controller[_0x66d3('0x6f')]);router['delete'](_0x66d3('0x5b'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x70')]);router[_0x66d3('0x6a')](_0x66d3('0x30'),auth['isAuthenticated'](),controller[_0x66d3('0x71')]);router['delete'](_0x66d3('0x5e'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x72')]);router[_0x66d3('0x6a')](_0x66d3('0x33'),auth[_0x66d3('0xc')](),controller['removeOpenchannelAccounts']);router[_0x66d3('0x6a')](_0x66d3('0x35'),auth[_0x66d3('0xc')](),controller['removeSmsAccounts']);router[_0x66d3('0x6a')](_0x66d3('0x37'),auth['isAuthenticated'](),controller[_0x66d3('0x73')]);router[_0x66d3('0x6a')](_0x66d3('0x38'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x74')]);router[_0x66d3('0x6a')](_0x66d3('0x3a'),auth[_0x66d3('0xc')](),controller['removeSquareProjects']);router[_0x66d3('0x6a')](_0x66d3('0x64'),auth[_0x66d3('0xc')](),controller[_0x66d3('0x75')]);module[_0x66d3('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 0e13d24..4c39aa9 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x236f79,_0x4e04ff){var _0x49d6c7=function(_0x3add88){while(--_0x3add88){_0x236f79['push'](_0x236f79['shift']());}};_0x49d6c7(++_0x4e04ff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xcb91[_0x34c553];return _0x1357d2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x36fe15,_0x31c21e){var _0xbb9d82=function(_0x711861){while(--_0x711861){_0x36fe15['push'](_0x36fe15['shift']());}};_0xbb9d82(++_0x31c21e);}(_0xedd9,0xfc));var _0x9edd=function(_0x493c63,_0x2c7f1f){_0x493c63=_0x493c63-0x0;var _0x2d5330=_0xedd9[_0x493c63];return _0x2d5330;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 615031f..b22e9af 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 _0xf292=['getAvatar','root','download','existsSync','join','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','pick','hasOwnProperty','CmList','List','Tags','color','tag','nolimit','getQueues','findOne','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','PAUSE','type','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','getMailQueues','getSmsQueues','Sms','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','Queue:save','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Mail','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$in','$notIn','$like','$notLike','$overlap','$contained','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','queues','teams','inbound','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','select','field','ui.','InteractionId','ui.createdAt','user_has_','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','update','then','destroy','get','admin','Agents','agent','Telephones','filter','map','value','includes','role','find','name','UserProfileResource','stack','send','index','User','fieldName','key','password','where','count','query','userSetting','true','include','UserSetting','push','findAll','rows','length','dataValues','fax','openchannel','whatsapp','all','show','model','keys','rawAttributes','filters','intersection','attributes','fields','includeAll','merge','options','openTabs','chat','sms','mail','body','params','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','internal','min_internal','isNil','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','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','104','105','107','108','100','115','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','some','telephone','isEmpty','compact','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','online','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','Queues','spread','toLowerCase','emit','voice','interface','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','remove','channel','isArray','QueueId','Queue:remove','userpic','file','filename'];(function(_0x47d839,_0x18928e){var _0x259d7a=function(_0x1d31e3){while(--_0x1d31e3){_0x47d839['push'](_0x47d839['shift']());}};_0x259d7a(++_0x18928e);}(_0xf292,0xe4));var _0x2f29=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xf292[_0x5a9c0c];return _0x53c77d;};'use strict';var moment=require(_0x2f29('0x0'));var BPromise=require(_0x2f29('0x1'));var util=require(_0x2f29('0x2'));var path=require(_0x2f29('0x3'));var fs=require('fs');var _=require(_0x2f29('0x4'));var squel=require(_0x2f29('0x5'));var jayson=require(_0x2f29('0x6'));var Redis=require(_0x2f29('0x7'));var authService=require(_0x2f29('0x8'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2f29('0x9'));var utils=require(_0x2f29('0xa'));var config=require(_0x2f29('0xb'));var licenseUtil=require(_0x2f29('0xc'));var db=require(_0x2f29('0xd'))['db'];var socket=require(_0x2f29('0xe'))(new Redis(config[_0x2f29('0xf')]));require(_0x2f29('0x10'))[_0x2f29('0x11')](socket);config[_0x2f29('0xf')]=_[_0x2f29('0x12')](config[_0x2f29('0xf')],{'host':_0x2f29('0x13'),'port':0x18eb});var client=jayson[_0x2f29('0x14')][_0x2f29('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0xadb192,_0x20af54,_0x25af0a,_0x34445a){return new BPromise(function(_0x193bad,_0x114c33){var _0x43afac=_0x34445a||client;return _0x43afac[_0x2f29('0x16')](_0xadb192,_0x25af0a)['then'](function(_0x176228){logger['info'](_0x2f29('0x17'),_0x20af54,_0x2f29('0x18'));logger['debug'](_0x2f29('0x19'),_0x20af54,_0x2f29('0x18'),JSON['stringify'](_0x176228));if(_0x176228['error']){if(_0x176228[_0x2f29('0x1a')][_0x2f29('0x1b')]===0x1f4){logger[_0x2f29('0x1a')](_0x2f29('0x17'),_0x20af54,_0x176228[_0x2f29('0x1a')]['message']);return _0x114c33(_0x176228[_0x2f29('0x1a')]['message']);}logger[_0x2f29('0x1a')](_0x2f29('0x17'),_0x20af54,_0x176228[_0x2f29('0x1a')][_0x2f29('0x1c')]);return _0x193bad(_0x176228['error']['message']);}else{logger['info'](_0x2f29('0x17'),_0x20af54,'request\x20sent');_0x193bad(_0x176228['result'][_0x2f29('0x1c')]);}})[_0x2f29('0x1d')](function(_0x21dd76){logger[_0x2f29('0x1a')](_0x2f29('0x17'),_0x20af54,_0x21dd76);_0x114c33(_0x21dd76);});});}function respondWithStatusCode(_0x289f7f,_0xa82762){_0xa82762=_0xa82762||0xcc;return function(_0xa619bf){if(_0xa619bf){return _0x289f7f[_0x2f29('0x1e')](_0xa82762);}return _0x289f7f[_0x2f29('0x1f')](_0xa82762)[_0x2f29('0x20')]();};}function respondWithResult(_0x7c608b,_0x584ee4){_0x584ee4=_0x584ee4||0xc8;return function(_0x1eeaf4){if(_0x1eeaf4){return _0x7c608b[_0x2f29('0x1f')](_0x584ee4)[_0x2f29('0x21')](_0x1eeaf4);}};}function respondWithFilteredResult(_0x83eb26,_0x1e4dc2){return function(_0x2b668e){if(_0x2b668e){var _0x4ba682=typeof _0x1e4dc2['offset']===_0x2f29('0x22')&&typeof _0x1e4dc2[_0x2f29('0x23')]===_0x2f29('0x22');var _0x46e719=_0x2b668e['count'];var _0xea7a13=_0x4ba682?0x0:_0x1e4dc2['offset'];var _0x43a92c=_0x4ba682?_0x2b668e['count']:_0x1e4dc2[_0x2f29('0x24')]+_0x1e4dc2[_0x2f29('0x23')];var _0x12f688;if(_0x43a92c>=_0x46e719){_0x43a92c=_0x46e719;_0x12f688=0xc8;}else{_0x12f688=0xce;}_0x83eb26[_0x2f29('0x1f')](_0x12f688);return _0x83eb26[_0x2f29('0x25')](_0x2f29('0x26'),_0xea7a13+'-'+_0x43a92c+'/'+_0x46e719)[_0x2f29('0x21')](_0x2b668e);}return null;};}function saveUpdates(_0x510d3b){return function(_0x2693c4){if(_0x2693c4){return _0x2693c4[_0x2f29('0x27')](_0x510d3b)[_0x2f29('0x28')](function(_0xa7016e){return _0xa7016e;});}return null;};}function removeEntity(_0x33e64d){return function(_0x2501af){if(_0x2501af){return _0x2501af[_0x2f29('0x29')]()[_0x2f29('0x28')](function(){var _0x417046=_0x2501af[_0x2f29('0x2a')]({'plain':!![]});if(_0x417046['role']===_0x2f29('0x2b'))return;var _0x52cde9=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x2f29('0x2c'),'value':_0x2f29('0x2d'),'ignore':![]},{'name':_0x2f29('0x2e'),'value':'telephone','ignore':![]}];var _0x391c45=_(_0x52cde9)[_0x2f29('0x2f')]('ignore')[_0x2f29('0x30')](_0x2f29('0x31'))['value']();if(_[_0x2f29('0x32')](_0x391c45,_0x417046[_0x2f29('0x33')])){return;}var _0x444e8c=_[_0x2f29('0x34')](_0x52cde9,[_0x2f29('0x31'),_0x417046[_0x2f29('0x33')]])[_0x2f29('0x35')];return db[_0x2f29('0x36')][_0x2f29('0x29')]({'where':{'type':_0x444e8c,'resourceId':_0x417046['id']}})[_0x2f29('0x28')](function(){return _0x2501af;});})[_0x2f29('0x28')](function(){_0x33e64d[_0x2f29('0x1f')](0xcc)[_0x2f29('0x20')]();});}};}function handleEntityNotFound(_0x5bcabb){return function(_0x35e187){if(!_0x35e187){_0x5bcabb[_0x2f29('0x1e')](0x194);}return _0x35e187;};}function handleError(_0x1d4e5c,_0x4d4c6d){_0x4d4c6d=_0x4d4c6d||0x1f4;return function(_0x17ffdd){logger['error'](_0x17ffdd[_0x2f29('0x37')]);if(_0x17ffdd[_0x2f29('0x35')]){delete _0x17ffdd[_0x2f29('0x35')];}_0x1d4e5c['status'](_0x4d4c6d)[_0x2f29('0x38')](_0x17ffdd);};}exports[_0x2f29('0x39')]=function(_0x30e161,_0x1728a0){var _0x14c3e9={},_0xc91009={'count':0x0,'rows':[]};var _0x47e1ba=_(db[_0x2f29('0x3a')]['rawAttributes'])[_0x2f29('0x30')](function(_0x4012b9){return{'name':_0x4012b9[_0x2f29('0x3b')],'type':_0x4012b9['type'][_0x2f29('0x3c')]};})[_0x2f29('0x2f')](function(_0x5ae519){return!_[_0x2f29('0x32')]([_0x2f29('0x3d'),'salt'],_0x5ae519[_0x2f29('0x35')]);})['value']();_0x14c3e9=qs['getOptions'](_0x47e1ba,_0x30e161);var _0x2717dc={'where':_0x14c3e9[_0x2f29('0x3e')]};return db[_0x2f29('0x3a')][_0x2f29('0x3f')](_0x2717dc)[_0x2f29('0x28')](function(_0x4943d1){_0xc91009['count']=_0x4943d1;if(_0x30e161[_0x2f29('0x40')]['includeAll']){_0x14c3e9['include']=[{'all':!![]}];}if(_0x30e161[_0x2f29('0x40')][_0x2f29('0x41')]===_0x2f29('0x42')){_0x14c3e9[_0x2f29('0x43')]=[{'model':db[_0x2f29('0x44')],'as':_0x2f29('0x41')}];}if(!_[_0x2f29('0x32')](_0x14c3e9['attributes'],'id')){_0x14c3e9['attributes'][_0x2f29('0x45')]('id');}return db['User'][_0x2f29('0x46')](_0x14c3e9);})[_0x2f29('0x28')](function(_0x42c693){_0xc91009[_0x2f29('0x47')]=_0x42c693;if(_0x30e161[_0x2f29('0x40')]['openTabs']===_0x2f29('0x42')){var _0x3781fa=[];for(var _0x2a18bb=0x0;_0x2a18bb<_0xc91009[_0x2f29('0x47')][_0x2f29('0x48')];_0x2a18bb++){_0x3781fa['push'](get_open_tabs('chat',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs('sms',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa['push'](get_open_tabs(_0x2f29('0x4a'),_0xc91009['rows'][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs('mail',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa['push'](get_open_tabs(_0x2f29('0x4b'),_0xc91009['rows'][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));}return BPromise[_0x2f29('0x4d')](_0x3781fa)[_0x2f29('0x28')](function(){return _0xc91009;});}else{return _0xc91009;}})[_0x2f29('0x28')](respondWithFilteredResult(_0x1728a0,_0x14c3e9))[_0x2f29('0x1d')](handleError(_0x1728a0,null));};exports[_0x2f29('0x4e')]=function(_0x493321,_0x2fb7b3){var _0x4a2958={'raw':![],'where':{'id':_0x493321['params']['id']}},_0x4a86a5={};_0x4a86a5[_0x2f29('0x4f')]=_['differenceBy'](_[_0x2f29('0x50')](db['User'][_0x2f29('0x51')]),['password','salt']);_0x4a86a5[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x493321[_0x2f29('0x40')]);_0x4a86a5[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x4a86a5['model'],_0x4a86a5[_0x2f29('0x40')]);_0x4a2958[_0x2f29('0x54')]=_['intersection'](_0x4a86a5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x493321[_0x2f29('0x40')][_0x2f29('0x55')]));_0x4a2958[_0x2f29('0x54')]=_0x4a2958[_0x2f29('0x54')]['length']?_0x4a2958['attributes']:_0x4a86a5[_0x2f29('0x4f')];if(_0x493321[_0x2f29('0x40')][_0x2f29('0x56')]){_0x4a2958['include']=[{'all':!![]}];}if(_0x493321['query']['userSetting']===_0x2f29('0x42')){_0x4a2958[_0x2f29('0x43')]=[{'model':db[_0x2f29('0x44')],'as':_0x2f29('0x41')}];}_0x4a2958=_[_0x2f29('0x57')]({},_0x4a2958,_0x493321[_0x2f29('0x58')]);if(!_[_0x2f29('0x32')](_0x4a2958[_0x2f29('0x54')],'id')){_0x4a2958[_0x2f29('0x54')][_0x2f29('0x45')]('id');}return db[_0x2f29('0x3a')][_0x2f29('0x34')](_0x4a2958)[_0x2f29('0x28')](handleEntityNotFound(_0x2fb7b3,null))[_0x2f29('0x28')](function(_0x5ba266){var _0x8d5595=[];values=_0x5ba266;if(_0x493321[_0x2f29('0x40')][_0x2f29('0x59')]==='true'){_0x8d5595['push'](get_open_tabs(_0x2f29('0x5a'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595['push'](get_open_tabs(_0x2f29('0x5b'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4b'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595['push'](get_open_tabs(_0x2f29('0x4a'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x5c'),_0x5ba266['dataValues']));return BPromise['all'](_0x8d5595);}else{return values;}})[_0x2f29('0x28')](function(){return values;})['then'](respondWithResult(_0x2fb7b3,null))[_0x2f29('0x1d')](handleError(_0x2fb7b3,null));};exports['update']=function(_0x12e5f6,_0x57fd77){if(_0x12e5f6[_0x2f29('0x5d')]['id']){delete _0x12e5f6['body']['id'];}delete _0x12e5f6['body'][_0x2f29('0x33')];return db['User'][_0x2f29('0x34')]({'where':{'id':_0x12e5f6[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x57fd77,null))[_0x2f29('0x28')](saveUpdates(_0x12e5f6[_0x2f29('0x5d')],null))['then'](respondWithResult(_0x57fd77,null))['catch'](handleError(_0x57fd77,null));};exports['describe']=function(_0x3e19c2,_0x555748){return db[_0x2f29('0x3a')][_0x2f29('0x5f')]()[_0x2f29('0x28')](respondWithResult(_0x555748,null))[_0x2f29('0x1d')](handleError(_0x555748,null));};exports[_0x2f29('0x60')]=function(_0x22b271,_0x52b9d8){return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x22b271['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x52b9d8,null))['then'](function(_0x2837f1){if(_0x2837f1){return _0x2837f1[_0x2f29('0x60')](_0x22b271[_0x2f29('0x5d')][_0x2f29('0x61')],_[_0x2f29('0x62')](_0x22b271[_0x2f29('0x5d')],[_0x2f29('0x61'),'id'])||{});}})[_0x2f29('0x28')](respondWithResult(_0x52b9d8,null))[_0x2f29('0x1d')](handleError(_0x52b9d8,null));};function validateUser(_0x4b5981){return new BPromise(function(_0x39b9e6,_0x191a23){if(_0x4b5981['internal'])return _0x39b9e6(_0x4b5981);return db[_0x2f29('0x63')][_0x2f29('0x64')](0x1)['then'](function(_0x5221b7){if(_0x5221b7[_0x2f29('0x65')])authService[_0x2f29('0x66')](_0x4b5981[_0x2f29('0x3d')]);db['User'][_0x2f29('0x67')]('internal')[_0x2f29('0x28')](function(_0x1a43cc){if(_['isNil'](_0x1a43cc)){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')]||0x1;return;}if(_[_0x2f29('0x6a')](_0x5221b7[_0x2f29('0x69')])||_0x5221b7['min_internal']===_0x1a43cc){_0x4b5981[_0x2f29('0x68')]=_0x1a43cc+0x1;return;}if(_0x5221b7[_0x2f29('0x69')]>_0x1a43cc){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')];return;}return db[_0x2f29('0x6b')][_0x2f29('0x40')](_0x2f29('0x6c'),{'type':db[_0x2f29('0x6b')][_0x2f29('0x6d')][_0x2f29('0x6e')]})[_0x2f29('0x28')](function(_0x3367a8){if(_0x3367a8&&_0x3367a8[_0x2f29('0x48')]){for(var _0x4eaedd=0x0,_0x4f48b1=_0x3367a8[_0x2f29('0x48')];_0x4eaedd<_0x4f48b1&&_[_0x2f29('0x6a')](_0x4b5981[_0x2f29('0x68')]);_0x4eaedd++){if(_0x5221b7[_0x2f29('0x69')]<=_0x3367a8[_0x4eaedd][_0x2f29('0x6f')]){_0x4b5981[_0x2f29('0x68')]=_0x3367a8[_0x4eaedd][_0x2f29('0x6f')];}else if(_0x5221b7[_0x2f29('0x69')]>_0x3367a8[_0x4eaedd][_0x2f29('0x6f')]&&_0x5221b7[_0x2f29('0x69')]<=_0x3367a8[_0x4eaedd]['to']){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')];}}}if(_[_0x2f29('0x6a')](_0x4b5981[_0x2f29('0x68')])){_0x4b5981[_0x2f29('0x68')]=_0x1a43cc+0x1;}return _0x39b9e6(_0x4b5981);});});})[_0x2f29('0x1d')](function(_0x49a54){_0x191a23(_0x49a54);});});}function updateUser(_0x143b67){return new BPromise(function(_0xe5e25f,_0x17dac8){try{if(_0x143b67[_0x2f29('0x70')]){_0x143b67[_0x2f29('0x71')]=_0x143b67[_0x2f29('0x68')];_0x143b67[_0x2f29('0x72')]={'mailbox':_0x143b67[_0x2f29('0x68')],'password':_0x143b67[_0x2f29('0x3d')],'fullname':_0x143b67[_0x2f29('0x73')],'email':_0x143b67['email']};}if(_0x143b67[_0x2f29('0x33')]==='agent'){if(!_0x143b67[_0x2f29('0x74')])_0x143b67[_0x2f29('0x74')]=[_0x2f29('0x75'),_0x2f29('0x76'),_0x2f29('0x77'),_0x2f29('0x78'),_0x2f29('0x79'),_0x2f29('0x7a'),_0x2f29('0x7b'),'106',_0x2f29('0x7c'),_0x2f29('0x7d'),'109',_0x2f29('0x7e'),'111','114',_0x2f29('0x7f')];}_0xe5e25f(_0x143b67);}catch(_0xb1d41a){_0x17dac8(_0xb1d41a);}});}exports[_0x2f29('0x80')]=function(_0x402281,_0x3905a7){if(_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2d'))throw new Error(_0x2f29('0x82'));if(_0x402281[_0x2f29('0x5d')]['role']===_0x2f29('0x81')&&_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]!=='admin'){throw new Error(_0x2f29('0x83'));}if(_0x402281[_0x2f29('0x5d')][_0x2f29('0x33')]==='admin'&&_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]!==_0x2f29('0x2b')){throw new Error(_0x2f29('0x84'));}return licenseUtil[_0x2f29('0x85')]([_0x402281[_0x2f29('0x5d')]])[_0x2f29('0x28')](function(){return validateUser(_0x402281[_0x2f29('0x5d')]);})['then'](function(_0x45f0fa){return updateUser(_0x45f0fa)['then'](function(_0x220eb2){if(_0x220eb2[_0x2f29('0x33')]===_0x2f29('0x2b')){_0x220eb2[_0x2f29('0x86')]=_0x402281['user']['settingsEnabled'];delete _0x220eb2[_0x2f29('0x87')];}return _0x220eb2;});})[_0x2f29('0x28')](function(_0x5d9430){return db['User'][_0x2f29('0x80')](_0x5d9430,{'include':[{'model':db['VoiceMail'],'as':_0x2f29('0x72')}]});})['then'](function(_0x5736a3){if(_0x402281[_0x2f29('0x5d')][_0x2f29('0x33')]==='user')return _0x5736a3;if(_0x402281['user'][_0x2f29('0x33')]!==_0x2f29('0x81'))return _0x5736a3;return db[_0x2f29('0x88')]['find']({'where':{'name':_0x5736a3[_0x2f29('0x33')]===_0x2f29('0x2d')?_0x2f29('0x2c'):'Telephones','userProfileId':_0x402281[_0x2f29('0x81')]['userProfileId']},'raw':!![]})['then'](function(_0x2562d1){if(!_0x2562d1||_0x2562d1[_0x2f29('0x89')]!=0x0)return _0x5736a3;return db[_0x2f29('0x36')][_0x2f29('0x80')]({'name':_0x5736a3[_0x2f29('0x35')],'resourceId':_0x5736a3['id'],'type':_0x2562d1[_0x2f29('0x35')],'sectionId':_0x2562d1['id']},{})['then'](function(){return _0x5736a3;});})[_0x2f29('0x1d')](function(_0x5a711f){logger[_0x2f29('0x1a')](_0x2f29('0x8a'),_0x5a711f);throw _0x5a711f;});})[_0x2f29('0x28')](respondWithResult(_0x3905a7,0xc9))[_0x2f29('0x1d')](handleError(_0x3905a7,null));};exports[_0x2f29('0x8b')]=function(_0x8cbc20,_0x48ae6a){var _0x1d114d=_0x8cbc20[_0x2f29('0x5d')];var _0x58cbdf=[];if(_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2d'))throw new Error('Unauthorized');if(_['some'](_0x1d114d,['role',_0x2f29('0x81')])&&_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]!=='admin'){throw new Error(_0x2f29('0x83'));}if(_['some'](_0x1d114d,[_0x2f29('0x33'),'admin'])&&_0x8cbc20[_0x2f29('0x81')]['role']!==_0x2f29('0x2b')){throw new Error(_0x2f29('0x8c'));}return licenseUtil['checkUserLimits'](_0x1d114d)[_0x2f29('0x28')](function(){return validateUser(_0x1d114d[0x0]);})[_0x2f29('0x28')](function(){for(var _0x2faad1=0x1;_0x2faad1<_0x1d114d[_0x2f29('0x48')];_0x2faad1++){var _0x242ccf=_0x1d114d[_0x2faad1-0x1][_0x2f29('0x68')];if(!_0x1d114d[_0x2faad1][_0x2f29('0x68')])_0x1d114d[_0x2faad1][_0x2f29('0x68')]=_0x242ccf+0x1;_0x58cbdf[_0x2f29('0x45')](validateUser(_0x1d114d[_0x2faad1]));}return BPromise[_0x2f29('0x4d')](_0x58cbdf);})[_0x2f29('0x28')](function(){_0x58cbdf=[];for(var _0x17123f=0x0;_0x17123f<_0x1d114d['length'];_0x17123f++){_0x58cbdf[_0x2f29('0x45')](updateUser(_0x1d114d[_0x17123f]));}return BPromise[_0x2f29('0x4d')](_0x58cbdf);})[_0x2f29('0x28')](function(){return BPromise[_0x2f29('0x8d')](_0x1d114d,function(_0x59f490){return db[_0x2f29('0x3a')][_0x2f29('0x80')](_0x59f490,{'include':[{'model':db['VoiceMail'],'as':_0x2f29('0x72')}]})[_0x2f29('0x28')](function(_0x14c07f){_0x59f490['id']=_0x14c07f['id'];return _0x59f490;});});})[_0x2f29('0x28')](function(_0x3b6ec5){if(_0x8cbc20[_0x2f29('0x5d')][_0x2f29('0x33')]===_0x2f29('0x81'))return _0x3b6ec5;if(_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]!==_0x2f29('0x81'))return _0x3b6ec5;var _0x794ab1=_[_0x2f29('0x8e')](_0x3b6ec5,function(_0x2b785b){return _0x2b785b['role']===_0x2f29('0x2d')||_0x2b785b[_0x2f29('0x33')]===_0x2f29('0x8f');});if(!_0x794ab1)return _0x3b6ec5;return db[_0x2f29('0x88')][_0x2f29('0x46')]({'where':{'name':{'$or':[_0x2f29('0x2c'),_0x2f29('0x2e')]},'userProfileId':_0x8cbc20[_0x2f29('0x81')]['userProfileId']},'raw':!![]})[_0x2f29('0x28')](function(_0x4d2995){if(_[_0x2f29('0x90')](_0x4d2995)||!_[_0x2f29('0x8e')](_0x4d2995,['autoAssociation',0x0]))return _0x3b6ec5;_0x58cbdf=[];var _0x129330=_(_0x4d2995)[_0x2f29('0x30')](function(_0x4d88a1){if(_0x4d88a1[_0x2f29('0x89')]===0x1)return;return _0x4d88a1['name']==='Agents'?_0x2f29('0x2d'):_0x2f29('0x8f');})[_0x2f29('0x91')]()[_0x2f29('0x31')]();for(var _0x4de55e=0x0;_0x4de55e<_0x3b6ec5[_0x2f29('0x48')];_0x4de55e++){if(!_[_0x2f29('0x32')](_0x129330,_0x3b6ec5[_0x4de55e][_0x2f29('0x33')]))return;var _0x4129ea=_0x3b6ec5[_0x4de55e]['role']===_0x2f29('0x2d')?'Agents':_0x2f29('0x2e');_0x58cbdf[_0x2f29('0x45')](db[_0x2f29('0x36')][_0x2f29('0x80')]({'name':_0x3b6ec5[_0x4de55e][_0x2f29('0x35')],'resourceId':_0x3b6ec5[_0x4de55e]['id'],'type':_0x4129ea,'sectionId':_[_0x2f29('0x34')](_0x4d2995,[_0x2f29('0x35'),_0x4129ea])['id']},{}));}return BPromise['all'](_0x58cbdf);});})[_0x2f29('0x28')](respondWithResult(_0x48ae6a,0xc9))[_0x2f29('0x1d')](handleError(_0x48ae6a,null));};exports['changePassword']=function(_0x15ab1b,_0x1ca460){if(_0x15ab1b['body']['id']){delete _0x15ab1b[_0x2f29('0x5d')]['id'];}return db[_0x2f29('0x3a')]['find']({'where':{'id':_0x15ab1b[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](function(_0x3a7a0b){if(!_0x3a7a0b)return null;if(_0x3a7a0b['id']===_0x15ab1b[_0x2f29('0x81')]['id']){if(!_0x15ab1b[_0x2f29('0x5d')]['oldPassword']||!_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x95'));}if(!_0x3a7a0b['authenticate'](_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x96')])){throw new db[(_0x2f29('0x93'))]['ValidationError'](_0x2f29('0x97'));}if(_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x96')]===_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db['Sequelize'][(_0x2f29('0x94'))](_0x2f29('0x98'));}}else if(_0x15ab1b[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2b')){if(!_0x15ab1b['body'][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x15ab1b[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x81')){if(!_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x99'));}if(_0x3a7a0b['role']!==_0x2f29('0x2d')){throw new db['Sequelize']['ValidationError'](_0x2f29('0x82'));}}else{throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x82'));}return _0x3a7a0b;})['then'](handleEntityNotFound(_0x1ca460,null))[_0x2f29('0x28')](function(_0x2a1340){return db[_0x2f29('0x63')]['findOne']({'attributes':['id',_0x2f29('0x65'),_0x2f29('0x9a'),_0x2f29('0x9b')]})[_0x2f29('0x28')](function(_0x22efc5){if(_0x22efc5[_0x2f29('0x65')])authService[_0x2f29('0x66')](_0x15ab1b[_0x2f29('0x5d')]['newPassword']);if(!_0x22efc5[_0x2f29('0x9a')]||!_0x2a1340[_0x2f29('0x9c')])return _0x2a1340;authService[_0x2f29('0x9d')](_0x15ab1b[_0x2f29('0x5d')]['newPassword'],_0x2a1340[_0x2f29('0x9c')],_0x22efc5['passwordHistoryLimit']);return _0x2a1340;})[_0x2f29('0x28')](saveUpdates({'password':_0x15ab1b['body']['newPassword'],'passwordResetAt':_0x15ab1b[_0x2f29('0x81')]['id']==_0x15ab1b[_0x2f29('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x2f29('0x9e')](_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')],_0x2a1340[_0x2f29('0x9c')])},null));})['then'](respondWithResult(_0x1ca460,null))[_0x2f29('0x1d')](handleError(_0x1ca460,null));};exports['addQueues']=function(_0x32ac4c,_0x32d58a){var _0x3f3b59=_0x32ac4c['body']['channel'];return db['User'][_0x2f29('0x34')]({'where':{'id':_0x32ac4c[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),_0x2f29('0x9f'),'loginInPause',_0x2f29('0xa0'),'interface']})[_0x2f29('0x28')](handleEntityNotFound(_0x32d58a,null))[_0x2f29('0x28')](function(_0x5a7aea){if(_0x5a7aea){if(!utils[_0x2f29('0xa1')](_0x3f3b59)){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}return _0x5a7aea[_0x2f29('0xa3')+_[_0x2f29('0xa4')](_0x3f3b59['toLowerCase']())+_0x2f29('0xa5')](_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')],{'penalty':_0x32ac4c[_0x2f29('0x5d')]['penalty']||0x0})[_0x2f29('0xa6')](function(_0x36d7df){for(var _0x1aff09=0x0;_0x1aff09<_0x32ac4c['body'][_0x2f29('0x61')][_0x2f29('0x48')];_0x1aff09+=0x1){var _0x415d97={'UserId':Number(_0x32ac4c['params']['id'])};_0x415d97[_[_0x2f29('0xa4')](_0x3f3b59[_0x2f29('0xa7')]())+'QueueId']=Number(_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')][_0x1aff09]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x3f3b59[_0x2f29('0xa7')]())+'Queue:save',_0x415d97);}return _0x36d7df;})[_0x2f29('0x28')](function(){if(_0x3f3b59==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2f29('0x28')](function(_0x76220b){var _0x318514=_0x5a7aea[_0x2f29('0x2a')]({'plain':!![]});var _0x559b8e=[];if(_0x3f3b59===_0x2f29('0xa9')&&_0x318514[_0x2f29('0x33')]===_0x2f29('0x2d')&&_0x318514[_0x2f29('0x9f')]){for(var _0x340696=0x0;_0x340696<_0x76220b[_0x2f29('0x48')];_0x340696+=0x1){_0x559b8e[_0x2f29('0x45')]({'membername':_0x318514['name'],'UserId':_0x318514['id'],'queue_name':_0x76220b[_0x340696][_0x2f29('0x35')],'VoiceQueueId':_0x76220b[_0x340696]['id'],'interface':_[_0x2f29('0x6a')](_0x318514[_0x2f29('0xaa')])?util[_0x2f29('0xab')](_0x2f29('0xac'),_0x318514[_0x2f29('0x35')]):_0x318514[_0x2f29('0xaa')],'paused':_0x318514[_0x2f29('0xa0')]||![],'penalty':_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0xad')]||0x0});}return BPromise[_0x2f29('0x8d')](_0x559b8e,function(_0x450072){return db[_0x2f29('0xae')]['upsert'](_0x450072);});}return _0x5a7aea;});}})['then'](respondWithStatusCode(_0x32d58a,null))[_0x2f29('0x1d')](handleError(_0x32d58a,null));};exports[_0x2f29('0xaf')]=function(_0x52ff01,_0x1458ce){var _0xb8076d,_0xdfee7e;return db['User'][_0x2f29('0x34')]({'where':{'id':_0x52ff01['params']['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x1458ce,null))[_0x2f29('0x28')](function(_0x4f10e7){if(_0x4f10e7){_0xb8076d=_0x4f10e7;if(!_0x52ff01[_0x2f29('0x40')]['channel']||!utils[_0x2f29('0xa1')](_0x52ff01['query']['channel'])){throw new db[(_0x2f29('0x93'))]['ValidationError']('Unknown\x20channel');}return _0x4f10e7[_0x2f29('0xb0')+_['capitalize'](_0x52ff01[_0x2f29('0x40')][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xa5')](_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')]);}})[_0x2f29('0x28')](function(_0x3ffd45){if(_[_0x2f29('0xb2')](_0x52ff01['query'][_0x2f29('0x61')])){for(var _0x3f125d=0x0;_0x3f125d<_0x52ff01['query'][_0x2f29('0x61')][_0x2f29('0x48')];_0x3f125d+=0x1){_0xdfee7e={'UserId':Number(_0x52ff01[_0x2f29('0x5e')]['id'])};_0xdfee7e[_[_0x2f29('0xa4')](_0x52ff01[_0x2f29('0x40')][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xb3')]=Number(_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')][_0x3f125d]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xb4'),_0xdfee7e);}}else{_0xdfee7e={'UserId':Number(_0x52ff01[_0x2f29('0x5e')]['id'])};_0xdfee7e[_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')]['toLowerCase']())+_0x2f29('0xb3')]=Number(_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')]['toLowerCase']())+_0x2f29('0xb4'),_0xdfee7e);}return _0x3ffd45;})[_0x2f29('0x28')](function(){if(_0x52ff01[_0x2f29('0x40')]['channel']==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x52ff01['params']['id'],'VoiceQueueId':_0x52ff01[_0x2f29('0x40')]['ids']},'individualHooks':!![]})[_0x2f29('0x28')](function(){return _0xb8076d;});}return _0xb8076d;})[_0x2f29('0x28')](respondWithStatusCode(_0x1458ce,null))['catch'](handleError(_0x1458ce,null));};exports['addAvatar']=function(_0x3018cb,_0x5aa8be){_0x3018cb[_0x2f29('0x5d')][_0x2f29('0xb5')]=_0x3018cb[_0x2f29('0xb6')][_0x2f29('0xb7')];return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x3018cb[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x5aa8be,null))['then'](saveUpdates(_0x3018cb[_0x2f29('0x5d')],null))[_0x2f29('0x28')](respondWithResult(_0x5aa8be,null))[_0x2f29('0x1d')](handleError(_0x5aa8be,null));};exports[_0x2f29('0xb8')]=function(_0x116fe5,_0x27df75){var _0xc9b3fb=path['join'](config[_0x2f29('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x2f29('0x3a')]['find']({'where':{'id':_0x116fe5[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0xb5')],'raw':!![]})[_0x2f29('0x28')](handleEntityNotFound(_0x27df75,null))[_0x2f29('0x28')](function(_0x4872d4){if(_0x4872d4){if(_[_0x2f29('0x6a')](_0x4872d4[_0x2f29('0xb5')])){return _0x27df75[_0x2f29('0xba')](_0xc9b3fb);}else{if(!fs[_0x2f29('0xbb')](path[_0x2f29('0xbc')](config[_0x2f29('0xb9')],_0x2f29('0xbd'),_0x4872d4[_0x2f29('0xb5')]))){return _0x27df75[_0x2f29('0xba')](_0xc9b3fb);}return _0x27df75['download'](path['join'](config[_0x2f29('0xb9')],'server/files/images/',_0x4872d4[_0x2f29('0xb5')]));}}})[_0x2f29('0x1d')](handleError(_0x27df75,null));};exports[_0x2f29('0xbe')]=function(_0x4f7238,_0x2b33cb){return db['User'][_0x2f29('0x34')]({'where':{'id':_0x4f7238['params']['id']},'attributes':['id']})[_0x2f29('0x28')](handleEntityNotFound(_0x2b33cb,null))[_0x2f29('0x28')](function(_0x42e715){var _0x219440=[];values=_0x42e715[_0x2f29('0x49')];_0x219440[_0x2f29('0x45')](get_open_tabs('chat',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs('sms',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs('openchannel',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0x42e715['dataValues']));_0x219440[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4a'),_0x42e715['dataValues']));_0x219440[_0x2f29('0x45')](get_open_tabs('mail',_0x42e715[_0x2f29('0x49')]));return BPromise[_0x2f29('0x4d')](_0x219440);})[_0x2f29('0x28')](function(_0x5a917b){if(_0x5a917b){var _0x33a9d8=_[_0x2f29('0x30')](values['ChatOpenTabs'],function(_0x4eef75){return{'channel':_0x2f29('0xbf'),'id':_0x4eef75['id'],'createdAt':_0x4eef75[_0x2f29('0xc0')]};});var _0x34dae3=_[_0x2f29('0x30')](values[_0x2f29('0xc1')],function(_0x4f4477){return{'channel':_0x2f29('0xc2'),'id':_0x4f4477['id'],'createdAt':_0x4f4477[_0x2f29('0xc0')]};});var _0x289073=_[_0x2f29('0x30')](values[_0x2f29('0xc3')],function(_0x4e569e){return{'channel':_0x2f29('0xc4'),'id':_0x4e569e['id'],'createdAt':_0x4e569e['createdAt']};});var _0xf24a4d=_[_0x2f29('0x30')](values[_0x2f29('0xc5')],function(_0x1277ad){return{'channel':_0x2f29('0xc6'),'id':_0x1277ad['id'],'createdAt':_0x1277ad[_0x2f29('0xc0')]};});var _0x10ca14=_[_0x2f29('0x30')](values[_0x2f29('0xc7')],function(_0xc0b846){return{'channel':_0x2f29('0xc8'),'id':_0xc0b846['id'],'createdAt':_0xc0b846['createdAt']};});var _0x56976e=_[_0x2f29('0x30')](values[_0x2f29('0xc9')],function(_0x23753b){return{'channel':_0x2f29('0xca'),'id':_0x23753b['id'],'createdAt':_0x23753b['createdAt']};});var _0x4f3b7b=_[_0x2f29('0xcb')](_0x33a9d8,_0x34dae3,_0x289073,_0xf24a4d,_0x10ca14,_0x56976e);var _0x30350d={'count':_0x4f3b7b[_0x2f29('0x48')],'rows':_0x4f3b7b};return _0x30350d;}else return null;})['then'](respondWithResult(_0x2b33cb,null))[_0x2f29('0x1d')](handleError(_0x2b33cb,null));};exports[_0x2f29('0xcc')]=function(_0x32318b,_0x8df29d){var _0x117b18={};var _0xfd919a={};var _0x33c55a;var _0x547b75;return db['User']['findOne']({'where':{'id':_0x32318b['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x8df29d,null))[_0x2f29('0x28')](function(_0x5b6fb8){if(_0x5b6fb8){_0x33c55a=_0x5b6fb8;_0xfd919a[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xcd')]['rawAttributes']);_0xfd919a[_0x2f29('0x40')]=_['keys'](_0x32318b[_0x2f29('0x40')]);_0xfd919a[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0xfd919a[_0x2f29('0x4f')],_0xfd919a['query']);_0x117b18[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0xfd919a['model'],qs[_0x2f29('0x55')](_0x32318b[_0x2f29('0x40')][_0x2f29('0x55')]));_0x117b18[_0x2f29('0x54')]=_0x117b18[_0x2f29('0x54')]['length']?_0x117b18[_0x2f29('0x54')]:_0xfd919a[_0x2f29('0x4f')];_0x117b18[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x32318b[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x117b18[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x32318b[_0x2f29('0x40')],_0xfd919a[_0x2f29('0x52')]));if(_0x32318b['query'][_0x2f29('0x2f')]){_0x117b18[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x117b18['where'],{'$or':_[_0x2f29('0x30')](_0x117b18['attributes'],function(_0x21081b){var _0x67f4b8={};_0x67f4b8[_0x21081b]={'$like':'%'+_0x32318b[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x67f4b8;})});}_0x117b18=_[_0x2f29('0x57')]({},_0x117b18,_0x32318b['options']);return _0x33c55a[_0x2f29('0xcc')](_0x117b18);}})[_0x2f29('0x28')](function(_0x4267d0){if(_0x4267d0){_0x547b75=_0x4267d0[_0x2f29('0x48')];if(_0x32318b['query'][_0x2f29('0xd1')]('includeAll')){_0x117b18[_0x2f29('0x43')]=[{'model':db[_0x2f29('0xd2')],'as':_0x2f29('0xd3'),'required':![]},{'model':db['Tag'],'as':_0x2f29('0xd4'),'attributes':['id','name',_0x2f29('0xd5')],'where':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]?{'id':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]}:undefined,'required':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]?!![]:![]}];}if(!_0x32318b[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x117b18[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x32318b[_0x2f29('0x40')][_0x2f29('0x23')]);_0x117b18[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x32318b[_0x2f29('0x40')]['offset']);}return _0x33c55a[_0x2f29('0xcc')](_0x117b18);}})['then'](function(_0x59a7fd){if(_0x59a7fd){return _0x59a7fd?{'count':_0x547b75,'rows':_0x59a7fd}:null;}})[_0x2f29('0x28')](respondWithResult(_0x8df29d,null))['catch'](handleError(_0x8df29d,null));};exports[_0x2f29('0xd8')]=function(_0x3a34d5,_0x2c7606){var _0x3c2174;var _0x18c231={};var _0x2a411e;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x3a34d5[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x2c7606,null))[_0x2f29('0x28')](function(_0x483524){if(!utils['isValidChannel'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}_0x3c2174=_0x483524;var _0x53b75d={};_0x53b75d[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_[_0x2f29('0xa4')](_0x3a34d5['query'][_0x2f29('0xb1')])+_0x2f29('0xda')][_0x2f29('0x51')]);_0x53b75d[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x3a34d5[_0x2f29('0x40')]);_0x53b75d[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x53b75d[_0x2f29('0x4f')],_0x53b75d['query']);_0x18c231['attributes']=_['intersection'](_0x53b75d[_0x2f29('0x4f')],qs['fields'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x55')]));_0x18c231[_0x2f29('0x54')]=_0x18c231['attributes'][_0x2f29('0x48')]?_0x18c231[_0x2f29('0x54')]:_0x53b75d[_0x2f29('0x4f')];_0x18c231['order']=qs[_0x2f29('0xcf')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x18c231[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x3a34d5[_0x2f29('0x40')],_0x53b75d[_0x2f29('0x52')]));if(_0x3a34d5['query']['filter']){_0x18c231[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x18c231[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x18c231['attributes'],function(_0x44de54){var _0x578542={};_0x578542[_0x44de54]={'$like':'%'+_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x578542;})});}_0x18c231=_[_0x2f29('0x57')]({},_0x18c231,_0x3a34d5[_0x2f29('0x58')]);switch(_0x3c2174['role']){case _0x2f29('0x2b'):return db[_[_0x2f29('0xa4')](_0x3a34d5['query']['channel'])+'Queue'][_0x2f29('0x46')](_0x18c231);case _0x2f29('0x81'):case _0x2f29('0x2d'):return _0x3c2174[_0x2f29('0x2a')+_[_0x2f29('0xa4')](_0x3a34d5['query'][_0x2f29('0xb1')])+_0x2f29('0xa5')](_0x18c231);default:throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xdb'));}})['then'](function(_0x373a25){_0x2a411e=_0x373a25[_0x2f29('0x48')];if(!_0x3a34d5['query'][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x18c231[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x23')]);_0x18c231[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x24')]);}switch(_0x3c2174[_0x2f29('0x33')]){case _0x2f29('0x2b'):return db[_['capitalize'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])+_0x2f29('0xda')][_0x2f29('0x46')](_0x18c231);case _0x2f29('0x81'):case _0x2f29('0x2d'):return _0x3c2174[_0x2f29('0x2a')+_[_0x2f29('0xa4')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])+_0x2f29('0xa5')](_0x18c231);}})[_0x2f29('0x28')](function(_0x56cbae){return{'count':_0x2a411e,'rows':_0x56cbae};})[_0x2f29('0x28')](respondWithResult(_0x2c7606,null))['catch'](handleError(_0x2c7606,null));};exports[_0x2f29('0xdc')]=function(_0x414fe2,_0x4351de){var _0x223500={};var _0x2a711f={};var _0x2f1d35;var _0x2b9323;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x414fe2[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x4351de,null))[_0x2f29('0x28')](function(_0x2aa8e0){if(_0x2aa8e0){_0x2f1d35=_0x2aa8e0;_0x2a711f[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xae')][_0x2f29('0x51')]);_0x2a711f[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x414fe2[_0x2f29('0x40')]);_0x2a711f['filters']=_[_0x2f29('0x53')](_0x2a711f[_0x2f29('0x4f')],_0x2a711f[_0x2f29('0x40')]);_0x223500[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x2a711f[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x414fe2['query'][_0x2f29('0x55')]));_0x223500[_0x2f29('0x54')]=_0x223500[_0x2f29('0x54')][_0x2f29('0x48')]?_0x223500['attributes']:_0x2a711f[_0x2f29('0x4f')];_0x223500['order']=qs[_0x2f29('0xcf')](_0x414fe2['query'][_0x2f29('0xcf')]);_0x223500[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x414fe2[_0x2f29('0x40')],_0x2a711f['filters']));if(_0x414fe2[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x223500[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x223500[_0x2f29('0x3e')],{'$or':_['map'](_0x223500[_0x2f29('0x54')],function(_0x28862d){var _0x32c556={};_0x32c556[_0x28862d]={'$like':'%'+_0x414fe2[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x32c556;})});}_0x223500=_[_0x2f29('0x57')]({},_0x223500,_0x414fe2[_0x2f29('0x58')]);return _0x2f1d35[_0x2f29('0xdc')](_0x223500);}})['then'](function(_0xab392c){if(_0xab392c){_0x2b9323=_0xab392c[_0x2f29('0x48')];if(!_0x414fe2[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x223500['limit']=qs[_0x2f29('0x23')](_0x414fe2[_0x2f29('0x40')][_0x2f29('0x23')]);_0x223500[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x414fe2[_0x2f29('0x40')]['offset']);}return _0x2f1d35[_0x2f29('0xdc')](_0x223500);}})['then'](function(_0x1dad5b){if(_0x1dad5b){return _0x1dad5b?{'count':_0x2b9323,'rows':_0x1dad5b}:null;}})['then'](respondWithResult(_0x4351de,null))[_0x2f29('0x1d')](handleError(_0x4351de,null));};exports['getGroups']=function(_0x2a0047,_0x35ae36){var _0x3a0e37={};var _0x83de1b={};var _0x5123a1;var _0x5e4a09;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x2a0047['params']['id']}})['then'](handleEntityNotFound(_0x35ae36,null))[_0x2f29('0x28')](function(_0x2dc08c){if(_0x2dc08c){_0x5123a1=_0x2dc08c;_0x83de1b[_0x2f29('0x4f')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x83de1b[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x2a0047[_0x2f29('0x40')]);_0x83de1b[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x83de1b['model'],_0x83de1b[_0x2f29('0x40')]);_0x3a0e37[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x83de1b[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x2a0047[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3a0e37[_0x2f29('0x54')]=_0x3a0e37[_0x2f29('0x54')]['length']?_0x3a0e37[_0x2f29('0x54')]:_0x83de1b['model'];_0x3a0e37[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x2a0047[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3a0e37[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x2a0047['query'],_0x83de1b['filters']));if(_0x2a0047['query'][_0x2f29('0x2f')]){_0x3a0e37[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3a0e37[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3a0e37[_0x2f29('0x54')],function(_0x4bf0f9){var _0x67df19={};_0x67df19[_0x4bf0f9]={'$like':'%'+_0x2a0047[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x67df19;})});}_0x3a0e37=_[_0x2f29('0x57')]({},_0x3a0e37,_0x2a0047[_0x2f29('0x58')]);return _0x5123a1[_0x2f29('0xdd')](_0x3a0e37);}})[_0x2f29('0x28')](function(_0xfd0c77){if(_0xfd0c77){_0x5e4a09=_0xfd0c77[_0x2f29('0x48')];if(!_0x2a0047['query']['hasOwnProperty'](_0x2f29('0xd7'))){_0x3a0e37[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x2a0047[_0x2f29('0x40')]['limit']);_0x3a0e37[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x2a0047[_0x2f29('0x40')]['offset']);}return _0x5123a1[_0x2f29('0xdd')](_0x3a0e37);}})[_0x2f29('0x28')](function(_0xe2ae3a){if(_0xe2ae3a){return _0xe2ae3a?{'count':_0x5e4a09,'rows':_0xe2ae3a}:null;}})[_0x2f29('0x28')](respondWithResult(_0x35ae36,null))[_0x2f29('0x1d')](handleError(_0x35ae36,null));};exports['getRecordings']=function(_0x318477,_0x5d27b8){var _0x5d353b={'raw':!![],'where':{}};var _0x39f969={};var _0x24e9af={'count':0x0,'rows':[]};return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x318477[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x5d27b8,null))[_0x2f29('0x28')](function(_0xf64199){if(_0xf64199){_0x39f969[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xde')][_0x2f29('0x51')]);_0x39f969[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x318477[_0x2f29('0x40')]);_0x39f969['filters']=_[_0x2f29('0x53')](_0x39f969[_0x2f29('0x4f')],_0x39f969['query']);_0x5d353b[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x39f969[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x318477[_0x2f29('0x40')][_0x2f29('0x55')]));_0x5d353b[_0x2f29('0x54')]=_0x5d353b['attributes'][_0x2f29('0x48')]?_0x5d353b[_0x2f29('0x54')]:_0x39f969[_0x2f29('0x4f')];if(!_0x318477[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x5d353b['limit']=qs[_0x2f29('0x23')](_0x318477['query'][_0x2f29('0x23')]);_0x5d353b[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x318477[_0x2f29('0x40')]['offset']);}_0x5d353b[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x318477[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x5d353b['where']=qs[_0x2f29('0x52')](_['pick'](_0x318477[_0x2f29('0x40')],_0x39f969[_0x2f29('0x52')]));_0x5d353b[_0x2f29('0x3e')]['UserId']=_0xf64199['id'];if(_0x318477['query']['filter']){_0x5d353b[_0x2f29('0x3e')]=_['merge'](_0x5d353b[_0x2f29('0x3e')],{'$or':_['map'](_0x5d353b['attributes'],function(_0x91becb){var _0x1d27db={};_0x1d27db[_0x91becb]={'$like':'%'+_0x318477[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x1d27db;})});}_0x5d353b=_[_0x2f29('0x57')]({},_0x5d353b,_0x318477['options']);return db[_0x2f29('0xde')][_0x2f29('0x3f')]({'where':_0x5d353b['where']})[_0x2f29('0x28')](function(_0x52d414){_0x24e9af[_0x2f29('0x3f')]=_0x52d414;if(_0x318477[_0x2f29('0x40')]['includeAll']){_0x5d353b[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xde')]['findAll'](_0x5d353b);})['then'](function(_0x288c1f){_0x24e9af[_0x2f29('0x47')]=_0x288c1f;return _0x24e9af;});}})[_0x2f29('0x28')](respondWithFilteredResult(_0x5d27b8,_0x5d353b))[_0x2f29('0x1d')](handleError(_0x5d27b8,null));};exports[_0x2f29('0xdf')]=function(_0x20bc0c,_0x6f186){var _0x4b67a3={'raw':!![],'where':{}};var _0x4705a5={};var _0x4b663a={'count':0x0,'rows':[]};return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x20bc0c[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x6f186,null))['then'](function(_0x5a62a2){if(_0x5a62a2){_0x4705a5[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db['ScreenRecording'][_0x2f29('0x51')]);_0x4705a5[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x20bc0c[_0x2f29('0x40')]);_0x4705a5[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x4705a5[_0x2f29('0x4f')],_0x4705a5['query']);_0x4b67a3[_0x2f29('0x54')]=_['intersection'](_0x4705a5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x55')]));_0x4b67a3[_0x2f29('0x54')]=_0x4b67a3[_0x2f29('0x54')][_0x2f29('0x48')]?_0x4b67a3[_0x2f29('0x54')]:_0x4705a5[_0x2f29('0x4f')];if(!_0x20bc0c[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x4b67a3[_0x2f29('0x23')]=qs['limit'](_0x20bc0c[_0x2f29('0x40')]['limit']);_0x4b67a3[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x20bc0c[_0x2f29('0x40')]['offset']);}_0x4b67a3[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x20bc0c[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x4b67a3[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x20bc0c[_0x2f29('0x40')],_0x4705a5[_0x2f29('0x52')]));_0x4b67a3[_0x2f29('0x3e')][_0x2f29('0xe0')]=_0x5a62a2['id'];if(_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x4b67a3['where']=_[_0x2f29('0x57')](_0x4b67a3[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x4b67a3['attributes'],function(_0xf011b5){var _0x29f5c2={};_0x29f5c2[_0xf011b5]={'$like':'%'+_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x29f5c2;})});}_0x4b67a3=_[_0x2f29('0x57')]({},_0x4b67a3,_0x20bc0c['options']);return db[_0x2f29('0xe1')][_0x2f29('0x3f')]({'where':_0x4b67a3['where']})['then'](function(_0xdb99ef){_0x4b663a[_0x2f29('0x3f')]=_0xdb99ef;if(_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x56')]){_0x4b67a3[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xe1')]['findAll'](_0x4b67a3);})[_0x2f29('0x28')](function(_0xa99993){_0x4b663a[_0x2f29('0x47')]=_0xa99993;return _0x4b663a;});}})['then'](respondWithFilteredResult(_0x6f186,_0x4b67a3))[_0x2f29('0x1d')](handleError(_0x6f186,null));};exports[_0x2f29('0xe2')]=function(_0x3fdcc0,_0x50cacd){var _0x1ca350={};var _0x449e96={};var _0x2b3fb9;var _0x23d81e;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x3fdcc0[_0x2f29('0x5e')]['id']}})['then'](handleEntityNotFound(_0x50cacd,null))[_0x2f29('0x28')](function(_0x5b2713){if(_0x5b2713){_0x2b3fb9=_0x5b2713;_0x449e96[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db['ChatInteraction'][_0x2f29('0x51')]);_0x449e96[_0x2f29('0x40')]=_['keys'](_0x3fdcc0['query']);_0x449e96[_0x2f29('0x52')]=_['intersection'](_0x449e96[_0x2f29('0x4f')],_0x449e96[_0x2f29('0x40')]);_0x1ca350[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x449e96[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0x55')]));_0x1ca350[_0x2f29('0x54')]=_0x1ca350['attributes'][_0x2f29('0x48')]?_0x1ca350[_0x2f29('0x54')]:_0x449e96[_0x2f29('0x4f')];_0x1ca350[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x1ca350[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x3fdcc0[_0x2f29('0x40')],_0x449e96[_0x2f29('0x52')]));if(_0x3fdcc0['query'][_0x2f29('0x2f')]){_0x1ca350[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x1ca350['where'],{'$or':_[_0x2f29('0x30')](_0x1ca350[_0x2f29('0x54')],function(_0x286626){var _0x4dda9e={};_0x4dda9e[_0x286626]={'$like':'%'+_0x3fdcc0[_0x2f29('0x40')]['filter']+'%'};return _0x4dda9e;})});}_0x1ca350=_['merge']({},_0x1ca350,_0x3fdcc0['options']);return _0x2b3fb9['getChatInteractions'](_0x1ca350);}})[_0x2f29('0x28')](function(_0x1e1b04){if(_0x1e1b04){_0x23d81e=_0x1e1b04[_0x2f29('0x48')];if(!_0x3fdcc0[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x1ca350[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x3fdcc0['query']['limit']);_0x1ca350[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x2b3fb9[_0x2f29('0xe2')](_0x1ca350);}})[_0x2f29('0x28')](function(_0x49de25){if(_0x49de25){return _0x49de25?{'count':_0x23d81e,'rows':_0x49de25}:null;}})[_0x2f29('0x28')](respondWithResult(_0x50cacd,null))[_0x2f29('0x1d')](handleError(_0x50cacd,null));};exports[_0x2f29('0xe3')]=function(_0x4ef371,_0x561ae4){var _0x43d36f={};var _0x5ed49f={};var _0x5118ca;var _0x2c1649;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x4ef371['params']['id']}})['then'](handleEntityNotFound(_0x561ae4,null))[_0x2f29('0x28')](function(_0x34a5fb){if(_0x34a5fb){_0x5118ca=_0x34a5fb;_0x5ed49f[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xe4')][_0x2f29('0x51')]);_0x5ed49f[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x4ef371[_0x2f29('0x40')]);_0x5ed49f[_0x2f29('0x52')]=_['intersection'](_0x5ed49f[_0x2f29('0x4f')],_0x5ed49f[_0x2f29('0x40')]);_0x43d36f[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x5ed49f[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x4ef371[_0x2f29('0x40')]['fields']));_0x43d36f[_0x2f29('0x54')]=_0x43d36f['attributes']['length']?_0x43d36f[_0x2f29('0x54')]:_0x5ed49f['model'];_0x43d36f['order']=qs[_0x2f29('0xcf')](_0x4ef371[_0x2f29('0x40')]['sort']);_0x43d36f['where']=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x4ef371[_0x2f29('0x40')],_0x5ed49f[_0x2f29('0x52')]));if(_0x4ef371[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x43d36f['where']=_[_0x2f29('0x57')](_0x43d36f[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x43d36f[_0x2f29('0x54')],function(_0x2c8657){var _0x29569d={};_0x29569d[_0x2c8657]={'$like':'%'+_0x4ef371[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x29569d;})});}_0x43d36f=_[_0x2f29('0x57')]({},_0x43d36f,_0x4ef371[_0x2f29('0x58')]);return _0x5118ca['getOpenchannelInteractions'](_0x43d36f);}})[_0x2f29('0x28')](function(_0x48e070){if(_0x48e070){_0x2c1649=_0x48e070[_0x2f29('0x48')];if(!_0x4ef371[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x43d36f[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x4ef371['query'][_0x2f29('0x23')]);_0x43d36f['offset']=qs['offset'](_0x4ef371[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x5118ca[_0x2f29('0xe3')](_0x43d36f);}})[_0x2f29('0x28')](function(_0x40647d){if(_0x40647d){return _0x40647d?{'count':_0x2c1649,'rows':_0x40647d}:null;}})['then'](respondWithResult(_0x561ae4,null))[_0x2f29('0x1d')](handleError(_0x561ae4,null));};exports['getMailInteractions']=function(_0x318d56,_0x2be77d){var _0x16289e={'raw':!![],'where':{}};var _0x42bbcd={};var _0x79596={'count':0x0,'rows':[]};return db[_0x2f29('0x3a')]['findOne']({'where':{'id':_0x318d56[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x2be77d,null))[_0x2f29('0x28')](function(_0x4eccba){if(_0x4eccba){_0x42bbcd[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xe5')][_0x2f29('0x51')]);_0x42bbcd[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x318d56[_0x2f29('0x40')]);_0x42bbcd[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x42bbcd[_0x2f29('0x4f')],_0x42bbcd['query']);_0x16289e[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x42bbcd[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x318d56[_0x2f29('0x40')]['fields']));_0x16289e['attributes']=_0x16289e[_0x2f29('0x54')][_0x2f29('0x48')]?_0x16289e[_0x2f29('0x54')]:_0x42bbcd[_0x2f29('0x4f')];if(!_0x318d56[_0x2f29('0x40')][_0x2f29('0xd1')]('nolimit')){_0x16289e[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x318d56[_0x2f29('0x40')]['limit']);_0x16289e[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x318d56[_0x2f29('0x40')][_0x2f29('0x24')]);}_0x16289e[_0x2f29('0xce')]=qs['sort'](_0x318d56['query'][_0x2f29('0xcf')]);_0x16289e[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x318d56[_0x2f29('0x40')],_0x42bbcd[_0x2f29('0x52')]));_0x16289e[_0x2f29('0x3e')]['UserId']=_0x4eccba['id'];if(_0x318d56[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x16289e[_0x2f29('0x3e')]=_['merge'](_0x16289e['where'],{'$or':_[_0x2f29('0x30')](_0x16289e[_0x2f29('0x54')],function(_0x111ae0){var _0x19c740={};_0x19c740[_0x111ae0]={'$like':'%'+_0x318d56[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x19c740;})});}_0x16289e=_['merge']({},_0x16289e,_0x318d56[_0x2f29('0x58')]);return db['MailInteraction']['count']({'where':_0x16289e['where']})[_0x2f29('0x28')](function(_0x423948){_0x79596[_0x2f29('0x3f')]=_0x423948;if(_0x318d56[_0x2f29('0x40')]['includeAll']){_0x16289e[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xe5')]['findAll'](_0x16289e);})['then'](function(_0x5f4f34){_0x79596[_0x2f29('0x47')]=_0x5f4f34;return _0x79596;});}})['then'](respondWithFilteredResult(_0x2be77d,_0x16289e))[_0x2f29('0x1d')](handleError(_0x2be77d,null));};exports[_0x2f29('0xe6')]=function(_0x240f3f,_0x43f9e4){var _0x3c7bec={};var _0x34d67b={};var _0xcfa793;var _0x2df2e5;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x240f3f[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x43f9e4,null))[_0x2f29('0x28')](function(_0x9e7faf){if(_0x9e7faf){_0xcfa793=_0x9e7faf;_0x34d67b[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xe7')][_0x2f29('0x51')]);_0x34d67b['query']=_[_0x2f29('0x50')](_0x240f3f['query']);_0x34d67b['filters']=_['intersection'](_0x34d67b[_0x2f29('0x4f')],_0x34d67b[_0x2f29('0x40')]);_0x3c7bec[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x34d67b[_0x2f29('0x4f')],qs['fields'](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3c7bec[_0x2f29('0x54')]=_0x3c7bec[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3c7bec['attributes']:_0x34d67b[_0x2f29('0x4f')];_0x3c7bec[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3c7bec[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x240f3f[_0x2f29('0x40')],_0x34d67b[_0x2f29('0x52')]));if(_0x240f3f[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3c7bec['where']=_[_0x2f29('0x57')](_0x3c7bec[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3c7bec[_0x2f29('0x54')],function(_0x3882b){var _0x30b017={};_0x30b017[_0x3882b]={'$like':'%'+_0x240f3f[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x30b017;})});}_0x3c7bec=_[_0x2f29('0x57')]({},_0x3c7bec,_0x240f3f[_0x2f29('0x58')]);return _0xcfa793['getSmsInteractions'](_0x3c7bec);}})[_0x2f29('0x28')](function(_0xa5fe65){if(_0xa5fe65){_0x2df2e5=_0xa5fe65['length'];if(!_0x240f3f[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x3c7bec[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3c7bec[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0xcfa793[_0x2f29('0xe6')](_0x3c7bec);}})[_0x2f29('0x28')](function(_0x10879c){if(_0x10879c){return _0x10879c?{'count':_0x2df2e5,'rows':_0x10879c}:null;}})['then'](respondWithResult(_0x43f9e4,null))[_0x2f29('0x1d')](handleError(_0x43f9e4,null));};exports[_0x2f29('0xe8')]=function(_0x1cfb76,_0xf8a253){var _0x3de280={};var _0x2618d7={};var _0x3ad84f;var _0x40e68d;return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x1cfb76['params']['id']}})['then'](handleEntityNotFound(_0xf8a253,null))['then'](function(_0x5d59c2){if(_0x5d59c2){_0x3ad84f=_0x5d59c2;_0x2618d7[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xe9')][_0x2f29('0x51')]);_0x2618d7['query']=_[_0x2f29('0x50')](_0x1cfb76[_0x2f29('0x40')]);_0x2618d7[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x2618d7['model'],_0x2618d7[_0x2f29('0x40')]);_0x3de280[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x2618d7[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3de280['attributes']=_0x3de280[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3de280[_0x2f29('0x54')]:_0x2618d7[_0x2f29('0x4f')];_0x3de280[_0x2f29('0xce')]=qs['sort'](_0x1cfb76['query']['sort']);_0x3de280[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x1cfb76[_0x2f29('0x40')],_0x2618d7[_0x2f29('0x52')]));if(_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3de280[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3de280[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3de280['attributes'],function(_0x48b6f1){var _0x33d43e={};_0x33d43e[_0x48b6f1]={'$like':'%'+_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x33d43e;})});}_0x3de280=_[_0x2f29('0x57')]({},_0x3de280,_0x1cfb76[_0x2f29('0x58')]);return _0x3ad84f[_0x2f29('0xe8')](_0x3de280);}})['then'](function(_0x11e549){if(_0x11e549){_0x40e68d=_0x11e549[_0x2f29('0x48')];if(!_0x1cfb76[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x3de280[_0x2f29('0x23')]=qs['limit'](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3de280[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x3ad84f[_0x2f29('0xe8')](_0x3de280);}})['then'](function(_0x83aa20){if(_0x83aa20){return _0x83aa20?{'count':_0x40e68d,'rows':_0x83aa20}:null;}})[_0x2f29('0x28')](respondWithResult(_0xf8a253,null))[_0x2f29('0x1d')](handleError(_0xf8a253,null));};exports[_0x2f29('0xea')]=function(_0x44caf4,_0x22ae67){var _0x5cc2e5={};var _0x45a1a0={};var _0x4ad6a0;var _0x3bc124;return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x44caf4[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x22ae67,null))['then'](function(_0xe7af9d){if(_0xe7af9d){_0x4ad6a0=_0xe7af9d;_0x45a1a0[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xeb')][_0x2f29('0x51')]);_0x45a1a0['query']=_[_0x2f29('0x50')](_0x44caf4[_0x2f29('0x40')]);_0x45a1a0[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x45a1a0['model'],_0x45a1a0[_0x2f29('0x40')]);_0x5cc2e5['attributes']=_['intersection'](_0x45a1a0['model'],qs[_0x2f29('0x55')](_0x44caf4[_0x2f29('0x40')][_0x2f29('0x55')]));_0x5cc2e5[_0x2f29('0x54')]=_0x5cc2e5[_0x2f29('0x54')]['length']?_0x5cc2e5[_0x2f29('0x54')]:_0x45a1a0['model'];_0x5cc2e5[_0x2f29('0xce')]=qs['sort'](_0x44caf4[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x5cc2e5[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x44caf4[_0x2f29('0x40')],_0x45a1a0[_0x2f29('0x52')]));if(_0x44caf4[_0x2f29('0x40')]['filter']){_0x5cc2e5['where']=_[_0x2f29('0x57')](_0x5cc2e5['where'],{'$or':_[_0x2f29('0x30')](_0x5cc2e5[_0x2f29('0x54')],function(_0x458c78){var _0x1af8a2={};_0x1af8a2[_0x458c78]={'$like':'%'+_0x44caf4[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x1af8a2;})});}_0x5cc2e5=_[_0x2f29('0x57')]({},_0x5cc2e5,_0x44caf4[_0x2f29('0x58')]);return _0x4ad6a0[_0x2f29('0xea')](_0x5cc2e5);}})[_0x2f29('0x28')](function(_0x4fe270){if(_0x4fe270){_0x3bc124=_0x4fe270[_0x2f29('0x48')];if(!_0x44caf4['query'][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x5cc2e5[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x44caf4[_0x2f29('0x40')][_0x2f29('0x23')]);_0x5cc2e5[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x44caf4['query'][_0x2f29('0x24')]);}return _0x4ad6a0[_0x2f29('0xea')](_0x5cc2e5);}})['then'](function(_0x329ee4){if(_0x329ee4){return _0x329ee4?{'count':_0x3bc124,'rows':_0x329ee4}:null;}})[_0x2f29('0x28')](respondWithResult(_0x22ae67,null))[_0x2f29('0x1d')](handleError(_0x22ae67,null));};exports[_0x2f29('0xec')]=function(_0x46ae0f,_0xb80827,_0x34e2be){var _0x8f34bb;var _0x4fb7a0;var _0x408202;var _0x53e5c6=!_[_0x2f29('0x6a')](_0x46ae0f[_0x2f29('0x5e')]['id'])?_0x46ae0f[_0x2f29('0x5e')]['id']:!_[_0x2f29('0x6a')](_0x46ae0f[_0x2f29('0x81')]['id'])?_0x46ae0f['user']['id']:null;return db['User'][_0x2f29('0x34')]({'where':{'id':_0x53e5c6,'role':{'$or':[_0x2f29('0x2b'),_0x2f29('0x81'),_0x2f29('0x2d')]}},'attributes':['id','name',_0x2f29('0xed'),'mobile',_0x2f29('0x33'),'internal',_0x2f29('0xee')]})[_0x2f29('0x28')](function(_0x113975){if(_0x113975){if(_0x113975['role']==='agent'){_0x8f34bb=_0x113975;if(_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xaa')]){_0x408202=util[_0x2f29('0xab')](_0x2f29('0xef'),_0x8f34bb[_0x46ae0f['body'][_0x2f29('0xaa')]]);}else if(_0x46ae0f['body'][_0x2f29('0xf0')]){_0x408202=util[_0x2f29('0xab')](_0x2f29('0xac'),_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xf0')]);}else{_0x408202=util[_0x2f29('0xab')]('SIP/%s',_0x8f34bb[_0x2f29('0x35')]);}socket['to'](util[_0x2f29('0xab')](_0x2f29('0xf1'),_0x8f34bb[_0x2f29('0x35')]))[_0x2f29('0xa8')](_0x2f29('0xf2'),{'user':{'id':_0x8f34bb['id'],'name':_0x8f34bb[_0x2f29('0x35')]},'ip':_0x46ae0f['headers'][_0x2f29('0xf3')]||_0x46ae0f[_0x2f29('0xf4')][_0x2f29('0xf5')]||_0x46ae0f['socket'][_0x2f29('0xf5')]||_0x46ae0f[_0x2f29('0xf4')]['socket'][_0x2f29('0xf5')]});return db[_0x2f29('0xae')]['destroy']({'where':{'membername':_0x8f34bb[_0x2f29('0x35')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x2f29('0x94'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x8f34bb){return _0x8f34bb[_0x2f29('0xf6')]({'raw':!![]});}})['then'](function(_0x43730d){if(_0x8f34bb){var _0x325c51=[];if(_0x43730d){_0x4fb7a0=_0x43730d;if(_0x4fb7a0[_0x2f29('0x48')]){for(var _0x5587=0x0;_0x5587<_0x4fb7a0[_0x2f29('0x48')];_0x5587++){_0x325c51['push']({'membername':_0x8f34bb[_0x2f29('0x35')],'UserId':_0x8f34bb['id'],'queue_name':_0x4fb7a0[_0x5587]['name'],'VoiceQueueId':_0x4fb7a0[_0x5587]['id'],'interface':_0x408202,'paused':_0x8f34bb[_0x2f29('0xee')]||![],'penalty':_0x4fb7a0[_0x5587][_0x2f29('0xf7')]||0x0});}return BPromise[_0x2f29('0x8d')](_0x325c51,function(_0x854be8){return db[_0x2f29('0xae')][_0x2f29('0xf8')](_0x854be8);});}}}})[_0x2f29('0x28')](function(){if(_0x8f34bb){return db[_0x2f29('0xf9')][_0x2f29('0x46')]({'where':{'membername':_0x8f34bb[_0x2f29('0x35')],'exitAt':null}});}})[_0x2f29('0x28')](function(_0x4941cb){if(_0x8f34bb){var _0x138990=[];_0x4941cb[_0x2f29('0xfa')](function(_0x5a17d9){_0x138990[_0x2f29('0x45')](_0x5a17d9['update']({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb'))}));});return BPromise[_0x2f29('0x4d')](_0x138990);}})[_0x2f29('0x28')](function(){if(_0x8f34bb){var _0x4c2eec=[];var _0x48bc16=[];var _0x32524b=utils[_0x2f29('0xfc')]();var _0x40b23d={'membername':_0x8f34bb[_0x2f29('0x35')],'interface':_0x408202,'enterAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'role':_0x8f34bb[_0x2f29('0x33')],'internal':_0x8f34bb['internal']};_0x32524b[_0x2f29('0xfa')](function(_0x4c8e57){_0x4c2eec[_0x2f29('0x45')](_[_0x2f29('0x57')]({'channel':_0x4c8e57,'type':_0x2f29('0xfd'),'data1':_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xfe')],'data2':_0x408202},_0x40b23d));if(_0x8f34bb[_0x2f29('0xee')]){_0x48bc16[_0x2f29('0x45')](_['merge']({'channel':_0x4c8e57,'type':'PAUSE','data1':_0x2f29('0xff')},_0x40b23d));}});return db[_0x2f29('0xf9')]['bulkCreate'](_0x4c2eec['concat'](_0x48bc16),{'individualHooks':!![]});}})[_0x2f29('0x28')](function(){if(_0x8f34bb){return _0x8f34bb[_0x2f29('0x27')]({'online':!![],'lastLoginAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'voicePause':_0x8f34bb[_0x2f29('0xee')]||![],'mailPause':_0x8f34bb['loginInPause']||![],'chatPause':_0x8f34bb[_0x2f29('0xee')]||![],'faxPause':_0x8f34bb['loginInPause']||![],'smsPause':_0x8f34bb[_0x2f29('0xee')]||![],'openchannelPause':_0x8f34bb[_0x2f29('0xee')]||![],'whatsappPause':_0x8f34bb[_0x2f29('0xee')]||![],'pauseType':_0x8f34bb[_0x2f29('0xee')]?_0x2f29('0xff'):null,'interface':_0x408202,'lastPauseAt':moment()[_0x2f29('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x2f29('0x28')](function(_0x474249){if(_0x46ae0f[_0x2f29('0x100')]){return _0x34e2be();}else{return BPromise[_0x2f29('0x101')](_0x474249)[_0x2f29('0x28')](respondWithResult(_0xb80827,null));}})[_0x2f29('0x1d')](handleError(_0xb80827,null));};exports[_0x2f29('0x102')]=function(_0xc97cbd,_0x1540c3){var _0x4c2721;return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0xc97cbd[_0x2f29('0x5e')]['id'],'role':_0x2f29('0x2d')},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x1540c3,null))[_0x2f29('0x28')](function(_0xa19b87){if(_0xa19b87){_0x4c2721=_0xa19b87;return db['UserVoiceQueueRt'][_0x2f29('0x29')]({'where':{'membername':_0x4c2721[_0x2f29('0x35')]},'individualHooks':!![]});}})[_0x2f29('0x28')](function(){return db[_0x2f29('0xf9')][_0x2f29('0x46')]({'where':{'membername':_0x4c2721[_0x2f29('0x35')],'exitAt':null}});})[_0x2f29('0x28')](function(_0x334abc){var _0x1f5710=[];_0x334abc['forEach'](function(_0x29e552){_0x1f5710[_0x2f29('0x45')](_0x29e552[_0x2f29('0x27')]({'exitAt':moment()['format'](_0x2f29('0xfb'))}));});return BPromise[_0x2f29('0x4d')](_0x1f5710);})[_0x2f29('0x28')](function(){return _0x4c2721[_0x2f29('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2f29('0x28')](respondWithResult(_0x1540c3,null))[_0x2f29('0x1d')](handleError(_0x1540c3,null));};exports['pause']=function(_0x49de18,_0x33e2fa){var _0x29be18;return db['UserVoiceQueueRt'][_0x2f29('0x27')]({'paused':0x1},{'where':{'UserId':_0x49de18['params']['id']},'individualHooks':!![]})[_0x2f29('0x28')](function(){return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x49de18[_0x2f29('0x5e')]['id'],'role':_0x2f29('0x2d')},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),_0x2f29('0x68'),_0x2f29('0xaa')]});})[_0x2f29('0x28')](handleEntityNotFound(_0x33e2fa,null))[_0x2f29('0x28')](function(_0x35d176){if(_0x35d176){_0x29be18=_0x35d176;return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x104'),{'id':_0x29be18['id'],'name':_0x29be18[_0x2f29('0x35')],'pause':!![]});}})[_0x2f29('0x28')](function(){if(_0x29be18){return db[_0x2f29('0xf9')]['findAll']({'where':{'membername':_0x29be18[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}});}})[_0x2f29('0x28')](function(_0x7cb1a1){if(_0x7cb1a1[_0x2f29('0x48')]){var _0x2a594c=moment()[_0x2f29('0xab')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x415dfa=0x0,_0x436ada=_0x7cb1a1[_0x2f29('0x48')];_0x415dfa<_0x436ada;_0x415dfa++){_0x7cb1a1[_0x415dfa][_0x2f29('0x105')]({'exitAt':_0x2a594c});}}})[_0x2f29('0x28')](function(){var _0x46fa12=[];var _0x2f8fb4=utils[_0x2f29('0xfc')]();_0x2f8fb4[_0x2f29('0xfa')](function(_0x1ae721){_0x46fa12[_0x2f29('0x45')]({'channel':_0x1ae721,'membername':_0x29be18[_0x2f29('0x35')],'interface':_[_0x2f29('0x6a')](_0x29be18['interface'])?util['format'](_0x2f29('0xac'),_0x29be18[_0x2f29('0x35')]):_0x29be18[_0x2f29('0xaa')],'type':_0x2f29('0x106'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x49de18[_0x2f29('0x5d')][_0x2f29('0x107')]||_0x2f29('0x108'),'role':_0x29be18[_0x2f29('0x33')],'internal':_0x29be18['internal']});});return db[_0x2f29('0xf9')][_0x2f29('0x8b')](_0x46fa12,{'individualHooks':!![]});})[_0x2f29('0x28')](function(){return _0x29be18['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x49de18['body']['type']||_0x2f29('0x108'),'lastPauseAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb'))});})['then'](respondWithResult(_0x33e2fa,null))[_0x2f29('0x1d')](handleError(_0x33e2fa,null));};exports[_0x2f29('0x109')]=function(_0x4e7d15,_0x20dcf0){var _0xcb62f9;return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x4e7d15['params']['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),'voicePause',_0x2f29('0x10a'),'chatPause',_0x2f29('0x10b'),'openchannelPause',_0x2f29('0x10c'),_0x2f29('0x10d'),_0x2f29('0x10e'),_0x2f29('0x10f')]})['then'](handleEntityNotFound(_0x20dcf0,null))[_0x2f29('0x28')](function(_0x2d480b){if(_0x2d480b){_0xcb62f9=_0x2d480b;if(_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')]&&!utils[_0x2f29('0xa1')](_0x4e7d15['body'][_0x2f29('0xb1')])){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}switch(_0x4e7d15[_0x2f29('0x5d')]['channel']){case _0x2f29('0xa9'):return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x109'),{'id':_0xcb62f9['id'],'name':_0xcb62f9['name'],'pause':![]})[_0x2f29('0x28')](function(){return db[_0x2f29('0xae')][_0x2f29('0x27')]({'paused':0x0},{'where':{'UserId':_0xcb62f9['id']},'individualHooks':!![]});})[_0x2f29('0x28')](function(){return db[_0x2f29('0xf9')]['find']({'where':{'channel':_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')],'membername':_0xcb62f9[_0x2f29('0x35')],'type':_0x2f29('0x106'),'exitAt':null}});})['then'](function(_0x316773){if(_0x316773){return _0x316773[_0x2f29('0x27')]({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0xcb62f9[_0x2f29('0x27')]({'voicePause':![]});});case'mail':case'chat':case _0x2f29('0x4a'):case _0x2f29('0x5b'):case _0x2f29('0x4c'):case'openchannel':return db[_0x2f29('0xf9')]['find']({'where':{'channel':_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')],'membername':_0xcb62f9[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}})['then'](function(_0x137dee){if(_0x137dee){return _0x137dee[_0x2f29('0x27')]({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x2f29('0x28')](function(){var _0x5d006e={};_['set'](_0x5d006e,util[_0x2f29('0xab')](_0x2f29('0x110'),_0x4e7d15[_0x2f29('0x5d')]['channel'],_0x2f29('0x111')),![]);return _0xcb62f9['update'](_0x5d006e);});default:return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x109'),{'id':_0xcb62f9['id'],'name':_0xcb62f9[_0x2f29('0x35')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x2f29('0x27')]({'paused':0x0},{'where':{'UserId':_0xcb62f9['id']}});})[_0x2f29('0x28')](function(){return db['MemberReport'][_0x2f29('0x46')]({'where':{'membername':_0xcb62f9[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}});})[_0x2f29('0x28')](function(_0x437113){var _0x21e275=[];_0x437113['forEach'](function(_0x4d5dd4){_0x21e275[_0x2f29('0x45')](_0x4d5dd4[_0x2f29('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise['all'](_0x21e275);})[_0x2f29('0x28')](function(){return _0xcb62f9[_0x2f29('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x20dcf0,null))['catch'](handleError(_0x20dcf0,null));};exports[_0x2f29('0x112')]=function(_0x3dfb02,_0x360ad1){var _0x3b7588={};var _0xc32be5={};var _0xe8b81a;var _0x1c88e5;return db[_0x2f29('0x3a')]['findOne']({'where':{'id':_0x3dfb02['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x360ad1,null))[_0x2f29('0x28')](function(_0x405c6d){if(_0x405c6d){_0xe8b81a=_0x405c6d;_0xc32be5[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0x113')][_0x2f29('0x51')]);_0xc32be5[_0x2f29('0x40')]=_['keys'](_0x3dfb02[_0x2f29('0x40')]);_0xc32be5['filters']=_[_0x2f29('0x53')](_0xc32be5[_0x2f29('0x4f')],_0xc32be5[_0x2f29('0x40')]);_0x3b7588['attributes']=_[_0x2f29('0x53')](_0xc32be5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x3dfb02['query'][_0x2f29('0x55')]));_0x3b7588[_0x2f29('0x54')]=_0x3b7588['attributes'][_0x2f29('0x48')]?_0x3b7588['attributes']:_0xc32be5[_0x2f29('0x4f')];_0x3b7588[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x3dfb02[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3b7588[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x3dfb02[_0x2f29('0x40')],_0xc32be5[_0x2f29('0x52')]));if(_0x3dfb02[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3b7588[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3b7588[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3b7588[_0x2f29('0x54')],function(_0x466433){var _0x4e2e8b={};_0x4e2e8b[_0x466433]={'$like':'%'+_0x3dfb02[_0x2f29('0x40')]['filter']+'%'};return _0x4e2e8b;})});}_0x3b7588=_[_0x2f29('0x57')]({},_0x3b7588,_0x3dfb02[_0x2f29('0x58')]);return _0xe8b81a[_0x2f29('0x112')](_0x3b7588);}})['then'](function(_0x1b1d30){if(_0x1b1d30){_0x1c88e5=_0x1b1d30[_0x2f29('0x48')];if(!_0x3dfb02[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x3b7588[_0x2f29('0x23')]=qs['limit'](_0x3dfb02[_0x2f29('0x40')]['limit']);_0x3b7588[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3dfb02[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0xe8b81a['getTeams'](_0x3b7588);}})[_0x2f29('0x28')](function(_0x363def){if(_0x363def){return _0x363def?{'count':_0x1c88e5,'rows':_0x363def}:null;}})[_0x2f29('0x28')](respondWithResult(_0x360ad1,null))['catch'](handleError(_0x360ad1,null));};exports[_0x2f29('0x114')]=function(_0x11571b,_0x53c4dc){return db['User']['find']({'where':{'id':_0x11571b['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x53c4dc,null))[_0x2f29('0x28')](function(_0x304743){if(_0x304743){var _0x4b479a=_0x304743[_0x2f29('0x2a')]({'plain':!![]});return _0x304743[_0x2f29('0x114')](_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')],_['omit'](_0x11571b[_0x2f29('0x5d')],[_0x2f29('0x61'),'id'])||{})[_0x2f29('0x28')](function(){for(var _0x4bac9c=0x0;_0x4bac9c<_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')][_0x2f29('0x48')];_0x4bac9c++){var _0x59f842=[];var _0x4b055b={};db['Team'][_0x2f29('0xd9')]({'where':{'id':_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')][_0x4bac9c]}})[_0x2f29('0x28')](function(_0x2f067e){_0x4b055b=_0x2f067e['dataValues'];_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0xf6')]()['then'](function(_0x3dbdc5){for(var _0x514f6c=0x0;_0x514f6c<_0x3dbdc5['length'];_0x514f6c++){_0x3dbdc5[_0x514f6c][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x116'));}return _0x3dbdc5;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x117')]()[_0x2f29('0x28')](function(_0x835f53){for(var _0x7eccd8=0x0;_0x7eccd8<_0x835f53[_0x2f29('0x48')];_0x7eccd8++){_0x835f53[_0x7eccd8][_0x2f29('0x115')]('channel','Chat');}return _0x835f53;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x118')]()[_0x2f29('0x28')](function(_0x1b768e){for(var _0x791c31=0x0;_0x791c31<_0x1b768e[_0x2f29('0x48')];_0x791c31++){_0x1b768e[_0x791c31][_0x2f29('0x115')](_0x2f29('0xb1'),'Mail');}return _0x1b768e;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x119')]()['then'](function(_0x468606){for(var _0x1ec6ad=0x0;_0x1ec6ad<_0x468606[_0x2f29('0x48')];_0x1ec6ad++){_0x468606[_0x1ec6ad]['setDataValue'](_0x2f29('0xb1'),_0x2f29('0x11a'));}return _0x468606;}));_0x59f842[_0x2f29('0x45')](_0x2f067e['getWhatsappQueues']()['then'](function(_0x4e38c4){for(var _0x5c59e3=0x0;_0x5c59e3<_0x4e38c4[_0x2f29('0x48')];_0x5c59e3++){_0x4e38c4[_0x5c59e3][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11b'));}return _0x4e38c4;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x11c')]()['then'](function(_0x18a036){for(var _0x57e448=0x0;_0x57e448<_0x18a036['length'];_0x57e448++){_0x18a036[_0x57e448]['setDataValue'](_0x2f29('0xb1'),_0x2f29('0x11d'));}return _0x18a036;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x11e')]()['then'](function(_0x3b1281){for(var _0x3d0863=0x0;_0x3d0863<_0x3b1281[_0x2f29('0x48')];_0x3d0863++){_0x3b1281[_0x3d0863]['setDataValue']('channel',_0x2f29('0x11f'));}return _0x3b1281;}));return BPromise[_0x2f29('0x4d')](_0x59f842);})[_0x2f29('0x28')](function(_0x510b78){var _0x2e7ce9=_[_0x2f29('0x120')](_0x510b78);_0x59f842=[];return db[_0x2f29('0x6b')][_0x2f29('0x121')](function(_0x3ba804){for(var _0x4e15af=0x0;_0x4e15af<_0x2e7ce9[_0x2f29('0x48')];_0x4e15af++){_0x59f842[_0x2f29('0x45')](_0x2e7ce9[_0x4e15af][_0x2f29('0x122')](_0x4b479a['id']),{'transaction':_0x3ba804});}return BPromise[_0x2f29('0x4d')](_0x59f842)[_0x2f29('0x28')](function(){if(_0x4b479a[_0x2f29('0x9f')]){return BPromise[_0x2f29('0x8d')](_['filter'](_0x2e7ce9,function(_0x41a562){return _0x41a562[_0x2f29('0x123')](_0x2f29('0xb1'))===_0x2f29('0x116');}),function(_0x3243e2){return db['UserVoiceQueueRt'][_0x2f29('0xf8')]({'membername':_0x4b479a[_0x2f29('0x35')],'UserId':_0x4b479a['id'],'queue_name':_0x3243e2[_0x2f29('0x35')],'VoiceQueueId':_0x3243e2['id'],'interface':_[_0x2f29('0x6a')](_0x4b479a[_0x2f29('0xaa')])?util[_0x2f29('0xab')]('SIP/%s',_0x4b479a['name']):_0x4b479a[_0x2f29('0xaa')],'paused':_0x4b479a['voicePause']||![],'penalty':_0x4b479a[_0x2f29('0xad')]},{'transaction':_0x3ba804});});}else{return;}})[_0x2f29('0x28')](function(){for(var _0x4a508e=0x0;_0x4a508e<_0x2e7ce9[_0x2f29('0x48')];_0x4a508e++){var _0x3552f2=_0x2e7ce9[_0x4a508e][_0x2f29('0x123')](_0x2f29('0xb1'));var _0x1046df=_0x3552f2+'QueueId';socket['emit']('user'+_0x3552f2+_0x2f29('0x124'),{'UserId':_0x4b479a['id'],['queueField']:_0x2e7ce9[_0x4a508e]['id']});}});});})[_0x2f29('0x28')](function(){db[_0x2f29('0x125')][_0x2f29('0xd9')]({'where':{'teamId':_0x4b055b['id']}})[_0x2f29('0x28')](function(_0x2d5ce6){if(_0x2d5ce6){db[_0x2f29('0x126')][_0x2f29('0x80')]({'UserId':_0x11571b[_0x2f29('0x5e')]['id'],'VoicePrefixId':_0x2d5ce6[_0x2f29('0x127')]});}});});}});}})[_0x2f29('0x28')](respondWithStatusCode(_0x53c4dc,null))[_0x2f29('0x1d')](handleError(_0x53c4dc,null));};exports[_0x2f29('0x128')]=function(_0x29a8dd,_0x16a986){return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x29a8dd[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x16a986,null))[_0x2f29('0x28')](function(_0x82ffa0){if(_0x82ffa0){var _0x1d4998=_0x82ffa0[_0x2f29('0x2a')]({'plain':!![]});var _0x3b3da6=_0x29a8dd[_0x2f29('0x40')][_0x2f29('0x61')];return _0x82ffa0[_0x2f29('0x128')](_0x3b3da6)[_0x2f29('0x28')](function(){for(var _0x21bce9=0x0;_0x21bce9<_0x3b3da6[_0x2f29('0x48')];_0x21bce9++){var _0x34886f=[];var _0x48ce47={};db['Team']['findOne']({'where':{'id':_0x3b3da6[_0x21bce9]}})['then'](function(_0x5c81c7){_0x48ce47=_0x5c81c7['dataValues'];_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0xf6')]()[_0x2f29('0x28')](function(_0x232782){for(var _0x1f93d7=0x0;_0x1f93d7<_0x232782[_0x2f29('0x48')];_0x1f93d7++){_0x232782[_0x1f93d7][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x116'));}return _0x232782;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x117')]()['then'](function(_0x2ffd77){for(var _0x194ed0=0x0;_0x194ed0<_0x2ffd77['length'];_0x194ed0++){_0x2ffd77[_0x194ed0][_0x2f29('0x115')](_0x2f29('0xb1'),'Chat');}return _0x2ffd77;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x118')]()['then'](function(_0x5b456b){for(var _0x4d8d68=0x0;_0x4d8d68<_0x5b456b[_0x2f29('0x48')];_0x4d8d68++){_0x5b456b[_0x4d8d68][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x129'));}return _0x5b456b;}));_0x34886f['push'](_0x5c81c7[_0x2f29('0x119')]()['then'](function(_0x263e70){for(var _0x5c8532=0x0;_0x5c8532<_0x263e70['length'];_0x5c8532++){_0x263e70[_0x5c8532][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11a'));}return _0x263e70;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7['getWhatsappQueues']()['then'](function(_0x3fe722){for(var _0xe677dd=0x0;_0xe677dd<_0x3fe722['length'];_0xe677dd++){_0x3fe722[_0xe677dd][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11b'));}return _0x3fe722;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x11c')]()['then'](function(_0x270026){for(var _0x5ea86c=0x0;_0x5ea86c<_0x270026['length'];_0x5ea86c++){_0x270026[_0x5ea86c][_0x2f29('0x115')](_0x2f29('0xb1'),'Fax');}return _0x270026;}));_0x34886f['push'](_0x5c81c7[_0x2f29('0x11e')]()[_0x2f29('0x28')](function(_0x5382b8){for(var _0x5d416a=0x0;_0x5d416a<_0x5382b8[_0x2f29('0x48')];_0x5d416a++){_0x5382b8[_0x5d416a][_0x2f29('0x115')]('channel',_0x2f29('0x11f'));}return _0x5382b8;}));return BPromise['all'](_0x34886f);})['then'](function(_0x4f9e63){var _0x4e4899=_['flatten'](_0x4f9e63);_0x34886f=[];return db['sequelize'][_0x2f29('0x121')](function(_0x3562a5){for(var _0x7b29cd=0x0;_0x7b29cd<_0x4e4899[_0x2f29('0x48')];_0x7b29cd++){_0x34886f[_0x2f29('0x45')](_0x4e4899[_0x7b29cd][_0x2f29('0x12a')](_0x1d4998['id']),{'transaction':_0x3562a5});}return BPromise[_0x2f29('0x4d')](_0x34886f)[_0x2f29('0x28')](function(){if(_0x1d4998['online']){return BPromise[_0x2f29('0x8d')](_[_0x2f29('0x2f')](_0x4e4899,function(_0x43c461){return _0x43c461['getDataValue'](_0x2f29('0xb1'))===_0x2f29('0x116');}),function(_0x281622){return db[_0x2f29('0xae')][_0x2f29('0x29')]({'where':{'VoiceQueueId':_0x281622['id'],'UserId':_0x1d4998['id']},'transaction':_0x3562a5});});}else{return;}})['then'](function(){db[_0x2f29('0x125')][_0x2f29('0xd9')]({'where':{'teamId':_0x48ce47['id']}})[_0x2f29('0x28')](function(_0xdb60f6){if(_0xdb60f6){return db[_0x2f29('0x126')]['destroy']({'where':{'UserId':_0x1d4998['id'],'VoicePrefixId':_0xdb60f6[_0x2f29('0x49')][_0x2f29('0x127')]}});}});})['then'](function(){for(var _0x1ab689=0x0;_0x1ab689<_0x4e4899['length'];_0x1ab689++){var _0x1eba5f=_0x4e4899[_0x1ab689]['getDataValue']('channel');var _0x2777a6=_0x1eba5f+_0x2f29('0xb3');socket[_0x2f29('0xa8')](_0x2f29('0x81')+_0x1eba5f+_0x2f29('0xb4'),{'UserId':_0x1d4998['id'],['queueField']:_0x4e4899[_0x1ab689]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x16a986,null))['catch'](handleError(_0x16a986,null));};exports[_0x2f29('0x12b')]=function(_0x5957fe,_0x2bd535){var _0x3853c5={};var _0x21f6a8={};var _0x40964c;var _0x4a4bab;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x5957fe[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x2bd535,null))['then'](function(_0x2dc344){if(_0x2dc344){_0x40964c=_0x2dc344;_0x21f6a8[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xd2')][_0x2f29('0x51')]);_0x21f6a8['query']=_['keys'](_0x5957fe['query']);_0x21f6a8[_0x2f29('0x52')]=_['intersection'](_0x21f6a8[_0x2f29('0x4f')],_0x21f6a8[_0x2f29('0x40')]);_0x3853c5[_0x2f29('0x54')]=_['intersection'](_0x21f6a8['model'],qs[_0x2f29('0x55')](_0x5957fe['query'][_0x2f29('0x55')]));_0x3853c5[_0x2f29('0x54')]=_0x3853c5[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3853c5[_0x2f29('0x54')]:_0x21f6a8['model'];_0x3853c5[_0x2f29('0xce')]=qs['sort'](_0x5957fe[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3853c5[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x5957fe[_0x2f29('0x40')],_0x21f6a8[_0x2f29('0x52')]));if(_0x5957fe[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3853c5['where']=_[_0x2f29('0x57')](_0x3853c5[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3853c5[_0x2f29('0x54')],function(_0x5bbaa1){var _0x31bbac={};_0x31bbac[_0x5bbaa1]={'$like':'%'+_0x5957fe[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x31bbac;})});}_0x3853c5=_[_0x2f29('0x57')]({},_0x3853c5,_0x5957fe[_0x2f29('0x58')]);return _0x40964c[_0x2f29('0x12b')](_0x3853c5);}})['then'](function(_0x46326e){if(_0x46326e){_0x4a4bab=_0x46326e['length'];if(!_0x5957fe[_0x2f29('0x40')][_0x2f29('0xd1')]('nolimit')){_0x3853c5[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x5957fe[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3853c5['offset']=qs[_0x2f29('0x24')](_0x5957fe[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x40964c['getLists'](_0x3853c5);}})['then'](function(_0x336b6a){if(_0x336b6a){return _0x336b6a?{'count':_0x4a4bab,'rows':_0x336b6a}:null;}})[_0x2f29('0x28')](respondWithResult(_0x2bd535,null))[_0x2f29('0x1d')](handleError(_0x2bd535,null));};exports[_0x2f29('0x12c')]=function(_0x513522,_0xbaa40e){var _0x142277={};var _0x1476ee={};var _0x58c416;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x513522[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0xbaa40e,null))[_0x2f29('0x28')](function(_0x485ff0){if(_0x485ff0){_0x58c416=_0x485ff0;_0x1476ee[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0x3a')][_0x2f29('0x51')]);_0x1476ee['query']=_[_0x2f29('0x50')](_0x513522[_0x2f29('0x40')]);_0x1476ee[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x1476ee['model'],_0x1476ee[_0x2f29('0x40')]);_0x142277[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x1476ee['model'],qs[_0x2f29('0x55')](_0x513522[_0x2f29('0x40')][_0x2f29('0x55')]));_0x142277[_0x2f29('0x54')]=_0x142277['attributes'][_0x2f29('0x48')]?_0x142277['attributes']:_0x1476ee[_0x2f29('0x4f')];_0x142277[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x513522[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x142277[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x513522[_0x2f29('0x40')],_0x1476ee[_0x2f29('0x52')]));if(_0x513522[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x142277[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x142277[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x142277['attributes'],function(_0x17d586){var _0x30f14c={};_0x30f14c[_0x17d586]={'$like':'%'+_0x513522[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x30f14c;})});}_0x142277[_0x2f29('0x4f')]=db['User'];_0x142277['as']='Agents';_0x142277=_[_0x2f29('0x57')]({},_0x142277,_0x513522[_0x2f29('0x58')]);return _0x58c416[_0x2f29('0xf6')]({'include':[_0x142277]});}})['then'](function(_0x32bcae){if(_0x32bcae){var _0x2cc6e9={},_0x1c0b07=[];for(var _0x439362=0x0;_0x439362<_0x32bcae['length'];_0x439362+=0x1){for(var _0x4a950c=0x0,_0x10948e;_0x4a950c<_0x32bcae[_0x439362][_0x2f29('0x2c')][_0x2f29('0x48')];_0x4a950c+=0x1){_0x10948e=_0x32bcae[_0x439362][_0x2f29('0x2c')][_0x4a950c]['get']({'plain':!![]});_0x2cc6e9[_0x10948e['id']]=_0x10948e;}}_0x2cc6e9=_['values'](_0x2cc6e9);for(var _0x28c23b=qs[_0x2f29('0x24')](_0x513522[_0x2f29('0x40')]['offset']);_0x28c23b<_0x2cc6e9[_0x2f29('0x48')]&&_0x1c0b07['length']=_0x100c90){_0x54062d=_0x100c90;_0x128b34=0xc8;}else{_0x128b34=0xce;}_0x5e6386[_0x4e28('0x21')](_0x128b34);return _0x5e6386[_0x4e28('0x27')](_0x4e28('0x28'),_0x482e5a+'-'+_0x54062d+'/'+_0x100c90)['json'](_0x163990);}return null;};}function saveUpdates(_0xb7c01e){return function(_0x320dab){if(_0x320dab){return _0x320dab[_0x4e28('0x29')](_0xb7c01e)[_0x4e28('0x14')](function(_0x29d1ab){return _0x29d1ab;});}return null;};}function removeEntity(_0x109a55){return function(_0x18ad99){if(_0x18ad99){return _0x18ad99[_0x4e28('0x2a')]()[_0x4e28('0x14')](function(){var _0x39f7df=_0x18ad99[_0x4e28('0x2b')]({'plain':!![]});if(_0x39f7df['role']===_0x4e28('0x2c'))return;var _0x1a3c6d=[{'name':_0x4e28('0x2d'),'value':'user','ignore':!![]},{'name':_0x4e28('0x2e'),'value':_0x4e28('0x2f'),'ignore':![]},{'name':'Telephones','value':_0x4e28('0x30'),'ignore':![]}];var _0x4b343b=_(_0x1a3c6d)['filter']('ignore')[_0x4e28('0x31')](_0x4e28('0x32'))['value']();if(_[_0x4e28('0x33')](_0x4b343b,_0x39f7df[_0x4e28('0x34')])){return;}var _0x2ad774=_[_0x4e28('0x35')](_0x1a3c6d,[_0x4e28('0x32'),_0x39f7df[_0x4e28('0x34')]])['name'];return db[_0x4e28('0x36')][_0x4e28('0x2a')]({'where':{'type':_0x2ad774,'resourceId':_0x39f7df['id']}})[_0x4e28('0x14')](function(){return _0x18ad99;});})[_0x4e28('0x14')](function(){_0x109a55['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x120edb){return function(_0x3f2dfa){if(!_0x3f2dfa){_0x120edb[_0x4e28('0x20')](0x194);}return _0x3f2dfa;};}function handleError(_0x580840,_0x43c1aa){_0x43c1aa=_0x43c1aa||0x1f4;return function(_0xeb50e2){logger[_0x4e28('0x1b')](_0xeb50e2[_0x4e28('0x37')]);if(_0xeb50e2[_0x4e28('0x38')]){delete _0xeb50e2[_0x4e28('0x38')];}_0x580840[_0x4e28('0x21')](_0x43c1aa)[_0x4e28('0x39')](_0xeb50e2);};}exports[_0x4e28('0x3a')]=function(_0x571132,_0x500c49){var _0x21fc6f={},_0x2db8cb={'count':0x0,'rows':[]};var _0x1f2aba=_(db['User'][_0x4e28('0x3b')])[_0x4e28('0x31')](function(_0x51f4c3){return{'name':_0x51f4c3[_0x4e28('0x3c')],'type':_0x51f4c3[_0x4e28('0x3d')][_0x4e28('0x3e')]};})[_0x4e28('0x3f')](function(_0x3f9462){return!_['includes'](['password',_0x4e28('0x40')],_0x3f9462[_0x4e28('0x38')]);})[_0x4e28('0x32')]();_0x21fc6f=qs[_0x4e28('0x41')](_0x1f2aba,_0x571132);var _0x528d88={'where':_0x21fc6f['where']};return db[_0x4e28('0x42')][_0x4e28('0x26')](_0x528d88)[_0x4e28('0x14')](function(_0x1c0989){_0x2db8cb['count']=_0x1c0989;if(_0x571132[_0x4e28('0x43')][_0x4e28('0x44')]){_0x21fc6f[_0x4e28('0x45')]=[{'all':!![]}];}if(_0x571132[_0x4e28('0x43')][_0x4e28('0x46')]===_0x4e28('0x47')){_0x21fc6f[_0x4e28('0x45')]=[{'model':db[_0x4e28('0x48')],'as':_0x4e28('0x46')}];}if(!_[_0x4e28('0x33')](_0x21fc6f[_0x4e28('0x49')],'id')){_0x21fc6f[_0x4e28('0x49')][_0x4e28('0x4a')]('id');}return db[_0x4e28('0x42')][_0x4e28('0x4b')](_0x21fc6f);})[_0x4e28('0x14')](function(_0xcc9a1c){_0x2db8cb[_0x4e28('0x4c')]=_0xcc9a1c;if(_0x571132[_0x4e28('0x43')]['openTabs']===_0x4e28('0x47')){var _0x26c466=[];for(var _0x3b695d=0x0;_0x3b695d<_0x2db8cb['rows'][_0x4e28('0x4d')];_0x3b695d++){_0x26c466['push'](get_open_tabs('chat',_0x2db8cb[_0x4e28('0x4c')][_0x3b695d][_0x4e28('0x4e')]));_0x26c466[_0x4e28('0x4a')](get_open_tabs('sms',_0x2db8cb[_0x4e28('0x4c')][_0x3b695d][_0x4e28('0x4e')]));_0x26c466[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x4f'),_0x2db8cb['rows'][_0x3b695d]['dataValues']));_0x26c466['push'](get_open_tabs(_0x4e28('0x50'),_0x2db8cb['rows'][_0x3b695d][_0x4e28('0x4e')]));_0x26c466['push'](get_open_tabs(_0x4e28('0x51'),_0x2db8cb['rows'][_0x3b695d]['dataValues']));_0x26c466[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x52'),_0x2db8cb[_0x4e28('0x4c')][_0x3b695d]['dataValues']));}return BPromise[_0x4e28('0x53')](_0x26c466)[_0x4e28('0x14')](function(){return _0x2db8cb;});}else{return _0x2db8cb;}})[_0x4e28('0x14')](respondWithFilteredResult(_0x500c49,_0x21fc6f))[_0x4e28('0x1f')](handleError(_0x500c49,null));};exports[_0x4e28('0x54')]=function(_0x181fca,_0x15c6ab){var _0x313073={'raw':![],'where':{'id':_0x181fca[_0x4e28('0x55')]['id']}},_0x5c29c5={};_0x5c29c5[_0x4e28('0x56')]=_[_0x4e28('0x57')](_[_0x4e28('0x58')](db['User'][_0x4e28('0x3b')]),['password',_0x4e28('0x40')]);_0x5c29c5['query']=_[_0x4e28('0x58')](_0x181fca['query']);_0x5c29c5[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x5c29c5[_0x4e28('0x56')],_0x5c29c5[_0x4e28('0x43')]);_0x313073[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x5c29c5['model'],qs[_0x4e28('0x5b')](_0x181fca[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x313073[_0x4e28('0x49')]=_0x313073[_0x4e28('0x49')]['length']?_0x313073[_0x4e28('0x49')]:_0x5c29c5[_0x4e28('0x56')];if(_0x181fca[_0x4e28('0x43')][_0x4e28('0x44')]){_0x313073['include']=[{'all':!![]}];}if(_0x181fca[_0x4e28('0x43')]['userSetting']===_0x4e28('0x47')){_0x313073[_0x4e28('0x45')]=[{'model':db[_0x4e28('0x48')],'as':_0x4e28('0x46')}];}_0x313073=_['merge']({},_0x313073,_0x181fca[_0x4e28('0x5c')]);if(!_[_0x4e28('0x33')](_0x313073[_0x4e28('0x49')],'id')){_0x313073[_0x4e28('0x49')][_0x4e28('0x4a')]('id');}return db[_0x4e28('0x42')][_0x4e28('0x35')](_0x313073)[_0x4e28('0x14')](handleEntityNotFound(_0x15c6ab,null))['then'](function(_0x317561){var _0x263f45=[];values=_0x317561;if(_0x181fca[_0x4e28('0x43')][_0x4e28('0x5d')]===_0x4e28('0x47')){_0x263f45[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x5e'),_0x317561[_0x4e28('0x4e')]));_0x263f45['push'](get_open_tabs(_0x4e28('0x5f'),_0x317561[_0x4e28('0x4e')]));_0x263f45[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x51'),_0x317561[_0x4e28('0x4e')]));_0x263f45[_0x4e28('0x4a')](get_open_tabs('whatsapp',_0x317561[_0x4e28('0x4e')]));_0x263f45[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x4f'),_0x317561[_0x4e28('0x4e')]));_0x263f45[_0x4e28('0x4a')](get_open_tabs('mail',_0x317561[_0x4e28('0x4e')]));return BPromise[_0x4e28('0x53')](_0x263f45);}else{return values;}})[_0x4e28('0x14')](function(){return values;})[_0x4e28('0x14')](respondWithResult(_0x15c6ab,null))[_0x4e28('0x1f')](handleError(_0x15c6ab,null));};exports[_0x4e28('0x29')]=function(_0x251458,_0x206ff1){if(_0x251458[_0x4e28('0x60')]['id']){delete _0x251458[_0x4e28('0x60')]['id'];}delete _0x251458[_0x4e28('0x60')][_0x4e28('0x34')];return db['User'][_0x4e28('0x35')]({'where':{'id':_0x251458[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x206ff1,null))['then'](saveUpdates(_0x251458[_0x4e28('0x60')],null))[_0x4e28('0x14')](respondWithResult(_0x206ff1,null))[_0x4e28('0x1f')](handleError(_0x206ff1,null));};exports['describe']=function(_0xac8815,_0x172e12){return db[_0x4e28('0x42')]['describe']()['then'](respondWithResult(_0x172e12,null))[_0x4e28('0x1f')](handleError(_0x172e12,null));};exports[_0x4e28('0x61')]=function(_0x48b14a,_0x4982eb){return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0x48b14a[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x4982eb,null))['then'](function(_0x1501b0){if(_0x1501b0){return _0x1501b0[_0x4e28('0x61')](_0x48b14a[_0x4e28('0x60')][_0x4e28('0x62')],_[_0x4e28('0x63')](_0x48b14a[_0x4e28('0x60')],[_0x4e28('0x62'),'id'])||{});}})[_0x4e28('0x14')](respondWithResult(_0x4982eb,null))[_0x4e28('0x1f')](handleError(_0x4982eb,null));};function validateUser(_0x20c2bb){return new BPromise(function(_0x187999,_0x2eef25){if(_0x20c2bb[_0x4e28('0x64')])return _0x187999(_0x20c2bb);return db[_0x4e28('0x65')][_0x4e28('0x66')](0x1)[_0x4e28('0x14')](function(_0xbf0df9){if(_0xbf0df9[_0x4e28('0x67')])authService[_0x4e28('0x68')](_0x20c2bb[_0x4e28('0x69')]);db[_0x4e28('0x42')][_0x4e28('0x6a')](_0x4e28('0x64'))[_0x4e28('0x14')](function(_0x5e58a4){if(_[_0x4e28('0x6b')](_0x5e58a4)){_0x20c2bb['internal']=_0xbf0df9[_0x4e28('0x6c')]||0x1;return;}if(_[_0x4e28('0x6b')](_0xbf0df9[_0x4e28('0x6c')])||_0xbf0df9[_0x4e28('0x6c')]===_0x5e58a4){_0x20c2bb[_0x4e28('0x64')]=_0x5e58a4+0x1;return;}if(_0xbf0df9['min_internal']>_0x5e58a4){_0x20c2bb['internal']=_0xbf0df9[_0x4e28('0x6c')];return;}return db[_0x4e28('0x6d')][_0x4e28('0x43')](_0x4e28('0x6e'),{'type':db[_0x4e28('0x6d')][_0x4e28('0x6f')]['SELECT']})[_0x4e28('0x14')](function(_0x18964d){if(_0x18964d&&_0x18964d[_0x4e28('0x4d')]){for(var _0x216968=0x0,_0x47d83e=_0x18964d[_0x4e28('0x4d')];_0x216968<_0x47d83e&&_['isNil'](_0x20c2bb[_0x4e28('0x64')]);_0x216968++){if(_0xbf0df9[_0x4e28('0x6c')]<=_0x18964d[_0x216968]['from']){_0x20c2bb['internal']=_0x18964d[_0x216968][_0x4e28('0x70')];}else if(_0xbf0df9['min_internal']>_0x18964d[_0x216968][_0x4e28('0x70')]&&_0xbf0df9[_0x4e28('0x6c')]<=_0x18964d[_0x216968]['to']){_0x20c2bb[_0x4e28('0x64')]=_0xbf0df9[_0x4e28('0x6c')];}}}if(_[_0x4e28('0x6b')](_0x20c2bb[_0x4e28('0x64')])){_0x20c2bb[_0x4e28('0x64')]=_0x5e58a4+0x1;}return _0x187999(_0x20c2bb);});});})[_0x4e28('0x1f')](function(_0x4435d7){_0x2eef25(_0x4435d7);});});}function updateUser(_0x2c013a){return new BPromise(function(_0x15ad1a,_0x2033f7){try{if(_0x2c013a[_0x4e28('0x71')]){_0x2c013a[_0x4e28('0x72')]=_0x2c013a['internal'];_0x2c013a[_0x4e28('0x73')]={'mailbox':_0x2c013a[_0x4e28('0x64')],'password':_0x2c013a[_0x4e28('0x69')],'fullname':_0x2c013a[_0x4e28('0x74')],'email':_0x2c013a['email']};}if(_0x2c013a[_0x4e28('0x34')]==='agent'){if(!_0x2c013a[_0x4e28('0x75')])_0x2c013a[_0x4e28('0x75')]=[_0x4e28('0x76'),_0x4e28('0x77'),'103',_0x4e28('0x78'),_0x4e28('0x79'),_0x4e28('0x7a'),_0x4e28('0x7b'),_0x4e28('0x7c'),_0x4e28('0x7d'),_0x4e28('0x7e'),_0x4e28('0x7f'),_0x4e28('0x80'),_0x4e28('0x81'),_0x4e28('0x82'),'115'];}_0x15ad1a(_0x2c013a);}catch(_0x1bbc53){_0x2033f7(_0x1bbc53);}});}exports[_0x4e28('0x83')]=function(_0x5c9d2e,_0x2e4856){if(_0x5c9d2e['user']['role']===_0x4e28('0x2f'))throw new Error('Unauthorized');if(_0x5c9d2e[_0x4e28('0x60')][_0x4e28('0x34')]===_0x4e28('0x84')&&_0x5c9d2e['user']['role']!=='admin'){throw new Error(_0x4e28('0x85'));}if(_0x5c9d2e[_0x4e28('0x60')][_0x4e28('0x34')]===_0x4e28('0x2c')&&_0x5c9d2e[_0x4e28('0x84')][_0x4e28('0x34')]!==_0x4e28('0x2c')){throw new Error(_0x4e28('0x86'));}return licenseUtil[_0x4e28('0x87')]([_0x5c9d2e[_0x4e28('0x60')]])[_0x4e28('0x14')](function(){return validateUser(_0x5c9d2e['body']);})['then'](function(_0x504b09){return updateUser(_0x504b09)['then'](function(_0x3ff91b){if(_0x3ff91b[_0x4e28('0x34')]===_0x4e28('0x2c')){_0x3ff91b[_0x4e28('0x88')]=_0x5c9d2e['user']['settingsEnabled'];delete _0x3ff91b[_0x4e28('0x89')];}return _0x3ff91b;});})[_0x4e28('0x14')](function(_0x445b32){return db[_0x4e28('0x42')][_0x4e28('0x83')](_0x445b32,{'include':[{'model':db[_0x4e28('0x73')],'as':_0x4e28('0x73')}]});})['then'](function(_0x4762e2){if(_0x5c9d2e[_0x4e28('0x60')]['role']===_0x4e28('0x84'))return _0x4762e2;if(_0x5c9d2e[_0x4e28('0x84')][_0x4e28('0x34')]!=='user')return _0x4762e2;return db[_0x4e28('0x8a')][_0x4e28('0x35')]({'where':{'name':_0x4762e2['role']===_0x4e28('0x2f')?_0x4e28('0x2e'):_0x4e28('0x8b'),'userProfileId':_0x5c9d2e[_0x4e28('0x84')][_0x4e28('0x89')]},'raw':!![]})[_0x4e28('0x14')](function(_0x4191a2){if(!_0x4191a2||_0x4191a2['autoAssociation']!=0x0)return _0x4762e2;return db[_0x4e28('0x36')]['create']({'name':_0x4762e2['name'],'resourceId':_0x4762e2['id'],'type':_0x4191a2[_0x4e28('0x38')],'sectionId':_0x4191a2['id']},{})[_0x4e28('0x14')](function(){return _0x4762e2;});})[_0x4e28('0x1f')](function(_0x39b57c){logger[_0x4e28('0x1b')](_0x4e28('0x8c'),_0x39b57c);throw _0x39b57c;});})[_0x4e28('0x14')](respondWithResult(_0x2e4856,0xc9))[_0x4e28('0x1f')](handleError(_0x2e4856,null));};exports[_0x4e28('0x8d')]=function(_0x345001,_0x5817c1){var _0x134512=_0x345001[_0x4e28('0x60')];var _0x35ff3c=[];if(_0x345001[_0x4e28('0x84')][_0x4e28('0x34')]===_0x4e28('0x2f'))throw new Error(_0x4e28('0x8e'));if(_[_0x4e28('0x8f')](_0x134512,[_0x4e28('0x34'),_0x4e28('0x84')])&&_0x345001[_0x4e28('0x84')][_0x4e28('0x34')]!==_0x4e28('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x4e28('0x8f')](_0x134512,['role','admin'])&&_0x345001[_0x4e28('0x84')][_0x4e28('0x34')]!=='admin'){throw new Error(_0x4e28('0x90'));}return licenseUtil[_0x4e28('0x87')](_0x134512)['then'](function(){return validateUser(_0x134512[0x0]);})[_0x4e28('0x14')](function(){for(var _0xd35e1=0x1;_0xd35e1<_0x134512['length'];_0xd35e1++){var _0x332366=_0x134512[_0xd35e1-0x1][_0x4e28('0x64')];if(!_0x134512[_0xd35e1]['internal'])_0x134512[_0xd35e1][_0x4e28('0x64')]=_0x332366+0x1;_0x35ff3c[_0x4e28('0x4a')](validateUser(_0x134512[_0xd35e1]));}return BPromise[_0x4e28('0x53')](_0x35ff3c);})[_0x4e28('0x14')](function(){_0x35ff3c=[];for(var _0x2953e9=0x0;_0x2953e9<_0x134512[_0x4e28('0x4d')];_0x2953e9++){_0x35ff3c[_0x4e28('0x4a')](updateUser(_0x134512[_0x2953e9]));}return BPromise[_0x4e28('0x53')](_0x35ff3c);})[_0x4e28('0x14')](function(){return BPromise[_0x4e28('0x91')](_0x134512,function(_0x46799e){return db[_0x4e28('0x42')]['create'](_0x46799e,{'include':[{'model':db[_0x4e28('0x73')],'as':_0x4e28('0x73')}]})['then'](function(_0x434b19){_0x46799e['id']=_0x434b19['id'];return _0x46799e;});});})[_0x4e28('0x14')](function(_0x31a0c2){if(_0x345001[_0x4e28('0x60')][_0x4e28('0x34')]===_0x4e28('0x84'))return _0x31a0c2;if(_0x345001[_0x4e28('0x84')]['role']!==_0x4e28('0x84'))return _0x31a0c2;var _0x1d4407=_[_0x4e28('0x8f')](_0x31a0c2,function(_0x202284){return _0x202284[_0x4e28('0x34')]===_0x4e28('0x2f')||_0x202284[_0x4e28('0x34')]===_0x4e28('0x30');});if(!_0x1d4407)return _0x31a0c2;return db[_0x4e28('0x8a')][_0x4e28('0x4b')]({'where':{'name':{'$or':[_0x4e28('0x2e'),_0x4e28('0x8b')]},'userProfileId':_0x345001[_0x4e28('0x84')][_0x4e28('0x89')]},'raw':!![]})[_0x4e28('0x14')](function(_0x8eecfa){if(_[_0x4e28('0x92')](_0x8eecfa)||!_[_0x4e28('0x8f')](_0x8eecfa,[_0x4e28('0x93'),0x0]))return _0x31a0c2;_0x35ff3c=[];var _0x1a3924=_(_0x8eecfa)[_0x4e28('0x31')](function(_0x53e547){if(_0x53e547[_0x4e28('0x93')]===0x1)return;return _0x53e547[_0x4e28('0x38')]===_0x4e28('0x2e')?_0x4e28('0x2f'):'telephone';})[_0x4e28('0x94')]()['value']();for(var _0xc16710=0x0;_0xc16710<_0x31a0c2['length'];_0xc16710++){if(!_['includes'](_0x1a3924,_0x31a0c2[_0xc16710][_0x4e28('0x34')]))return;var _0x198d35=_0x31a0c2[_0xc16710]['role']===_0x4e28('0x2f')?_0x4e28('0x2e'):_0x4e28('0x8b');_0x35ff3c[_0x4e28('0x4a')](db[_0x4e28('0x36')][_0x4e28('0x83')]({'name':_0x31a0c2[_0xc16710][_0x4e28('0x38')],'resourceId':_0x31a0c2[_0xc16710]['id'],'type':_0x198d35,'sectionId':_['find'](_0x8eecfa,[_0x4e28('0x38'),_0x198d35])['id']},{}));}return BPromise['all'](_0x35ff3c);});})[_0x4e28('0x14')](respondWithResult(_0x5817c1,0xc9))[_0x4e28('0x1f')](handleError(_0x5817c1,null));};exports[_0x4e28('0x95')]=function(_0xe38f26,_0x28d5d4){if(_0xe38f26[_0x4e28('0x60')]['id']){delete _0xe38f26[_0x4e28('0x60')]['id'];}return db[_0x4e28('0x42')]['find']({'where':{'id':_0xe38f26[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](function(_0x2bc4aa){if(!_0x2bc4aa)return null;if(_0x2bc4aa['id']===_0xe38f26[_0x4e28('0x84')]['id']){if(!_0xe38f26[_0x4e28('0x60')][_0x4e28('0x96')]||!_0xe38f26['body']['newPassword']){throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0x99'));}if(!_0x2bc4aa[_0x4e28('0x9a')](_0xe38f26[_0x4e28('0x60')][_0x4e28('0x96')])){throw new db['Sequelize'][(_0x4e28('0x98'))]('Wrong\x20credentials');}if(_0xe38f26[_0x4e28('0x60')][_0x4e28('0x96')]===_0xe38f26['body'][_0x4e28('0x9b')]){throw new db['Sequelize'][(_0x4e28('0x98'))](_0x4e28('0x9c'));}}else if(_0xe38f26[_0x4e28('0x84')][_0x4e28('0x34')]===_0x4e28('0x2c')){if(!_0xe38f26[_0x4e28('0x60')]['newPassword']){throw new db[(_0x4e28('0x97'))]['ValidationError'](_0x4e28('0x9d'));}}else if(_0xe38f26[_0x4e28('0x84')][_0x4e28('0x34')]==='user'){if(!_0xe38f26['body'][_0x4e28('0x9b')]){throw new db[(_0x4e28('0x97'))]['ValidationError'](_0x4e28('0x9d'));}if(_0x2bc4aa[_0x4e28('0x34')]!==_0x4e28('0x2f')){throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0x8e'));}}else{throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0x8e'));}return _0x2bc4aa;})[_0x4e28('0x14')](handleEntityNotFound(_0x28d5d4,null))['then'](function(_0x15521e){return db['Setting']['findOne']({'attributes':['id',_0x4e28('0x67'),_0x4e28('0x9e'),'passwordHistoryLimit']})[_0x4e28('0x14')](function(_0x545101){if(_0x545101[_0x4e28('0x67')])authService[_0x4e28('0x68')](_0xe38f26[_0x4e28('0x60')][_0x4e28('0x9b')]);if(!_0x545101[_0x4e28('0x9e')]||!_0x15521e['previousPasswords'])return _0x15521e;authService[_0x4e28('0x9f')](_0xe38f26[_0x4e28('0x60')][_0x4e28('0x9b')],_0x15521e[_0x4e28('0xa0')],_0x545101[_0x4e28('0xa1')]);return _0x15521e;})[_0x4e28('0x14')](saveUpdates({'password':_0xe38f26[_0x4e28('0x60')][_0x4e28('0x9b')],'passwordResetAt':_0xe38f26[_0x4e28('0x84')]['id']==_0xe38f26['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xe38f26[_0x4e28('0x60')][_0x4e28('0x9b')],_0x15521e[_0x4e28('0xa0')])},null));})[_0x4e28('0x14')](respondWithResult(_0x28d5d4,null))[_0x4e28('0x1f')](handleError(_0x28d5d4,null));};exports['addQueues']=function(_0xa21e79,_0x3b2a75){var _0x39b4e8=_0xa21e79[_0x4e28('0x60')][_0x4e28('0xa2')];return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0xa21e79[_0x4e28('0x55')]['id']},'attributes':['id',_0x4e28('0x38'),'role',_0x4e28('0xa3'),_0x4e28('0xa4'),_0x4e28('0xa5'),_0x4e28('0xa6')]})['then'](handleEntityNotFound(_0x3b2a75,null))['then'](function(_0x44c103){if(_0x44c103){if(!utils[_0x4e28('0xa7')](_0x39b4e8)){throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0xa8'));}return _0x44c103[_0x4e28('0xa9')+_[_0x4e28('0xaa')](_0x39b4e8['toLowerCase']())+_0x4e28('0xab')](_0xa21e79[_0x4e28('0x60')]['ids'],{'penalty':_0xa21e79[_0x4e28('0x60')]['penalty']||0x0})[_0x4e28('0xac')](function(_0x7843b7){for(var _0x4121df=0x0;_0x4121df<_0xa21e79[_0x4e28('0x60')]['ids'][_0x4e28('0x4d')];_0x4121df+=0x1){var _0x60838f={'UserId':Number(_0xa21e79[_0x4e28('0x55')]['id'])};_0x60838f[_[_0x4e28('0xaa')](_0x39b4e8[_0x4e28('0xad')]())+_0x4e28('0xae')]=Number(_0xa21e79['body'][_0x4e28('0x62')][_0x4121df]);socket[_0x4e28('0xaf')](_0x4e28('0x84')+_['capitalize'](_0x39b4e8[_0x4e28('0xad')]())+_0x4e28('0xb0'),_0x60838f);}return _0x7843b7;})[_0x4e28('0x14')](function(){if(_0x39b4e8==='voice'){return db[_0x4e28('0xb1')][_0x4e28('0x4b')]({'where':{'id':_0xa21e79[_0x4e28('0x60')][_0x4e28('0x62')]||[]},'raw':!![],'attributes':['id',_0x4e28('0x38')]});}})[_0x4e28('0x14')](function(_0x237550){var _0x177412=_0x44c103['get']({'plain':!![]});var _0x39a847=[];if(_0x39b4e8===_0x4e28('0xb2')&&_0x177412[_0x4e28('0x34')]===_0x4e28('0x2f')&&_0x177412[_0x4e28('0xa3')]){for(var _0x43acdd=0x0;_0x43acdd<_0x237550['length'];_0x43acdd+=0x1){_0x39a847[_0x4e28('0x4a')]({'membername':_0x177412['name'],'UserId':_0x177412['id'],'queue_name':_0x237550[_0x43acdd][_0x4e28('0x38')],'VoiceQueueId':_0x237550[_0x43acdd]['id'],'interface':_[_0x4e28('0x6b')](_0x177412[_0x4e28('0xa6')])?util[_0x4e28('0xb3')](_0x4e28('0xb4'),_0x177412['name']):_0x177412[_0x4e28('0xa6')],'paused':_0x177412[_0x4e28('0xa5')]||![],'penalty':_0xa21e79[_0x4e28('0x60')][_0x4e28('0xb5')]||0x0});}return BPromise[_0x4e28('0x91')](_0x39a847,function(_0x309917){return db[_0x4e28('0xb6')][_0x4e28('0xb7')](_0x309917);});}return _0x44c103;});}})['then'](respondWithStatusCode(_0x3b2a75,null))['catch'](handleError(_0x3b2a75,null));};exports['removeQueues']=function(_0x683cbb,_0x29e6f0){var _0x1685a1,_0x59350f;return db[_0x4e28('0x42')]['find']({'where':{'id':_0x683cbb['params']['id']},'attributes':['id',_0x4e28('0x38'),_0x4e28('0x34')]})[_0x4e28('0x14')](handleEntityNotFound(_0x29e6f0,null))['then'](function(_0x480fe1){if(_0x480fe1){_0x1685a1=_0x480fe1;if(!_0x683cbb[_0x4e28('0x43')]['channel']||!utils[_0x4e28('0xa7')](_0x683cbb[_0x4e28('0x43')][_0x4e28('0xa2')])){throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))]('Unknown\x20channel');}return _0x480fe1[_0x4e28('0xb8')+_[_0x4e28('0xaa')](_0x683cbb[_0x4e28('0x43')][_0x4e28('0xa2')][_0x4e28('0xad')]())+_0x4e28('0xab')](_0x683cbb[_0x4e28('0x43')]['ids']);}})[_0x4e28('0x14')](function(_0x7ebb9b){if(_[_0x4e28('0xb9')](_0x683cbb[_0x4e28('0x43')][_0x4e28('0x62')])){for(var _0x41a913=0x0;_0x41a913<_0x683cbb[_0x4e28('0x43')][_0x4e28('0x62')][_0x4e28('0x4d')];_0x41a913+=0x1){_0x59350f={'UserId':Number(_0x683cbb[_0x4e28('0x55')]['id'])};_0x59350f[_[_0x4e28('0xaa')](_0x683cbb[_0x4e28('0x43')]['channel'][_0x4e28('0xad')]())+_0x4e28('0xae')]=Number(_0x683cbb[_0x4e28('0x43')]['ids'][_0x41a913]);socket[_0x4e28('0xaf')](_0x4e28('0x84')+_[_0x4e28('0xaa')](_0x683cbb[_0x4e28('0x43')][_0x4e28('0xa2')][_0x4e28('0xad')]())+_0x4e28('0xba'),_0x59350f);}}else{_0x59350f={'UserId':Number(_0x683cbb[_0x4e28('0x55')]['id'])};_0x59350f[_[_0x4e28('0xaa')](_0x683cbb['query']['channel']['toLowerCase']())+_0x4e28('0xae')]=Number(_0x683cbb[_0x4e28('0x43')][_0x4e28('0x62')]);socket[_0x4e28('0xaf')](_0x4e28('0x84')+_[_0x4e28('0xaa')](_0x683cbb['query'][_0x4e28('0xa2')][_0x4e28('0xad')]())+_0x4e28('0xba'),_0x59350f);}return _0x7ebb9b;})[_0x4e28('0x14')](function(){if(_0x683cbb[_0x4e28('0x43')][_0x4e28('0xa2')]===_0x4e28('0xb2')){return db[_0x4e28('0xb6')]['destroy']({'where':{'UserId':_0x683cbb[_0x4e28('0x55')]['id'],'VoiceQueueId':_0x683cbb[_0x4e28('0x43')]['ids']},'individualHooks':!![]})['then'](function(){return _0x1685a1;});}return _0x1685a1;})['then'](respondWithStatusCode(_0x29e6f0,null))[_0x4e28('0x1f')](handleError(_0x29e6f0,null));};exports[_0x4e28('0xbb')]=function(_0x4aac06,_0x5304f3){_0x4aac06[_0x4e28('0x60')][_0x4e28('0xbc')]=_0x4aac06[_0x4e28('0xbd')][_0x4e28('0xbe')];return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0x4aac06[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x5304f3,null))[_0x4e28('0x14')](saveUpdates(_0x4aac06[_0x4e28('0x60')],null))['then'](respondWithResult(_0x5304f3,null))[_0x4e28('0x1f')](handleError(_0x5304f3,null));};exports[_0x4e28('0xbf')]=function(_0x315241,_0x3ad729){var _0x2648f1=path[_0x4e28('0xc0')](config[_0x4e28('0xc1')],'server/files/images/logos/default_profile.png');return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0x315241['params']['id']},'attributes':['id',_0x4e28('0xbc')],'raw':!![]})[_0x4e28('0x14')](handleEntityNotFound(_0x3ad729,null))[_0x4e28('0x14')](function(_0x1847ed){if(_0x1847ed){if(_[_0x4e28('0x6b')](_0x1847ed[_0x4e28('0xbc')])){return _0x3ad729['download'](_0x2648f1);}else{if(!fs[_0x4e28('0xc2')](path['join'](config[_0x4e28('0xc1')],'server/files/images/',_0x1847ed[_0x4e28('0xbc')]))){return _0x3ad729[_0x4e28('0xc3')](_0x2648f1);}return _0x3ad729[_0x4e28('0xc3')](path[_0x4e28('0xc0')](config[_0x4e28('0xc1')],_0x4e28('0xc4'),_0x1847ed['userpic']));}}})[_0x4e28('0x1f')](handleError(_0x3ad729,null));};exports[_0x4e28('0xc5')]=function(_0x415f45,_0x536185){return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0x415f45[_0x4e28('0x55')]['id']},'attributes':['id']})[_0x4e28('0x14')](handleEntityNotFound(_0x536185,null))['then'](function(_0x5a32a8){var _0x527d9b=[];values=_0x5a32a8[_0x4e28('0x4e')];_0x527d9b[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x5e'),_0x5a32a8['dataValues']));_0x527d9b[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x5f'),_0x5a32a8['dataValues']));_0x527d9b[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x51'),_0x5a32a8[_0x4e28('0x4e')]));_0x527d9b[_0x4e28('0x4a')](get_open_tabs('whatsapp',_0x5a32a8[_0x4e28('0x4e')]));_0x527d9b[_0x4e28('0x4a')](get_open_tabs(_0x4e28('0x4f'),_0x5a32a8[_0x4e28('0x4e')]));_0x527d9b['push'](get_open_tabs('mail',_0x5a32a8['dataValues']));return BPromise['all'](_0x527d9b);})['then'](function(_0x45c7e4){if(_0x45c7e4){var _0x243ee2=_[_0x4e28('0x31')](values[_0x4e28('0xc6')],function(_0x416905){return{'channel':_0x4e28('0xc7'),'id':_0x416905['id'],'createdAt':_0x416905[_0x4e28('0xc8')]};});var _0x36c8ea=_['map'](values[_0x4e28('0xc9')],function(_0x5bdd96){return{'channel':'FAX','id':_0x5bdd96['id'],'createdAt':_0x5bdd96[_0x4e28('0xc8')]};});var _0x4ad764=_[_0x4e28('0x31')](values['OpenchannelOpenTabs'],function(_0xb1967){return{'channel':_0x4e28('0xca'),'id':_0xb1967['id'],'createdAt':_0xb1967[_0x4e28('0xc8')]};});var _0xecb0d5=_['map'](values['MailOpenTabs'],function(_0x4a0e91){return{'channel':_0x4e28('0xcb'),'id':_0x4a0e91['id'],'createdAt':_0x4a0e91[_0x4e28('0xc8')]};});var _0x5a69e4=_[_0x4e28('0x31')](values[_0x4e28('0xcc')],function(_0x512799){return{'channel':_0x4e28('0xcd'),'id':_0x512799['id'],'createdAt':_0x512799[_0x4e28('0xc8')]};});var _0x29d221=_['map'](values[_0x4e28('0xce')],function(_0x429f59){return{'channel':'WHATSAPP','id':_0x429f59['id'],'createdAt':_0x429f59[_0x4e28('0xc8')]};});var _0x1387e7=_[_0x4e28('0xcf')](_0x243ee2,_0x36c8ea,_0x4ad764,_0xecb0d5,_0x5a69e4,_0x29d221);var _0x1f6fa8={'count':_0x1387e7[_0x4e28('0x4d')],'rows':_0x1387e7};return _0x1f6fa8;}else return null;})['then'](respondWithResult(_0x536185,null))[_0x4e28('0x1f')](handleError(_0x536185,null));};exports[_0x4e28('0xd0')]=function(_0x5339a7,_0x2e6ee4){var _0xae36e7={};var _0x49de53={};var _0xd438b4;var _0x3dfe1;return db['User'][_0x4e28('0xd1')]({'where':{'id':_0x5339a7[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x2e6ee4,null))[_0x4e28('0x14')](function(_0x5e9315){if(_0x5e9315){_0xd438b4=_0x5e9315;_0x49de53[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_0x4e28('0xd2')][_0x4e28('0x3b')]);_0x49de53[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x5339a7['query']);_0x49de53[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x49de53[_0x4e28('0x56')],_0x49de53[_0x4e28('0x43')]);_0xae36e7[_0x4e28('0x49')]=_['intersection'](_0x49de53[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x5339a7[_0x4e28('0x43')]['fields']));_0xae36e7[_0x4e28('0x49')]=_0xae36e7[_0x4e28('0x49')][_0x4e28('0x4d')]?_0xae36e7[_0x4e28('0x49')]:_0x49de53[_0x4e28('0x56')];_0xae36e7[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x5339a7['query']['sort']);_0xae36e7[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_['pick'](_0x5339a7[_0x4e28('0x43')],_0x49de53[_0x4e28('0x59')]));if(_0x5339a7['query']['filter']){_0xae36e7['where']=_[_0x4e28('0xd6')](_0xae36e7['where'],{'$or':_[_0x4e28('0x31')](_0xae36e7['attributes'],function(_0x2c99b6){var _0x2d5bac={};_0x2d5bac[_0x2c99b6]={'$like':'%'+_0x5339a7[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x2d5bac;})});}_0xae36e7=_[_0x4e28('0xd6')]({},_0xae36e7,_0x5339a7[_0x4e28('0x5c')]);return _0xd438b4['getContacts'](_0xae36e7);}})['then'](function(_0x58478a){if(_0x58478a){_0x3dfe1=_0x58478a[_0x4e28('0x4d')];if(_0x5339a7[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0x44'))){_0xae36e7[_0x4e28('0x45')]=[{'model':db[_0x4e28('0xd8')],'as':_0x4e28('0xd9'),'required':![]},{'model':db[_0x4e28('0xda')],'as':_0x4e28('0xdb'),'attributes':['id','name',_0x4e28('0xdc')],'where':_0x5339a7[_0x4e28('0x43')]['tag']?{'id':_0x5339a7[_0x4e28('0x43')][_0x4e28('0xdd')]}:undefined,'required':_0x5339a7[_0x4e28('0x43')][_0x4e28('0xdd')]?!![]:![]}];}if(!_0x5339a7[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0xae36e7[_0x4e28('0xdf')]=qs['limit'](_0x5339a7['query'][_0x4e28('0xdf')]);_0xae36e7[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x5339a7['query']['offset']);}return _0xd438b4[_0x4e28('0xd0')](_0xae36e7);}})[_0x4e28('0x14')](function(_0x4e6cc1){if(_0x4e6cc1){return _0x4e6cc1?{'count':_0x3dfe1,'rows':_0x4e6cc1}:null;}})[_0x4e28('0x14')](respondWithResult(_0x2e6ee4,null))[_0x4e28('0x1f')](handleError(_0x2e6ee4,null));};exports[_0x4e28('0xe0')]=function(_0x3938b1,_0x5a498c){var _0x3769fd;var _0x596f73={};var _0x36e04a;return db['User'][_0x4e28('0xd1')]({'where':{'id':_0x3938b1[_0x4e28('0x55')]['id']},'attributes':['id',_0x4e28('0x38'),_0x4e28('0x34')]})[_0x4e28('0x14')](handleEntityNotFound(_0x5a498c,null))['then'](function(_0x927eb8){if(!utils[_0x4e28('0xa7')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xa2')])){throw new db['Sequelize'][(_0x4e28('0x98'))]('Unknown\x20channel');}_0x3769fd=_0x927eb8;var _0x258326={};_0x258326[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_['capitalize'](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xa2')])+_0x4e28('0xe1')][_0x4e28('0x3b')]);_0x258326[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x3938b1['query']);_0x258326[_0x4e28('0x59')]=_['intersection'](_0x258326[_0x4e28('0x56')],_0x258326[_0x4e28('0x43')]);_0x596f73[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x258326[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x3938b1['query'][_0x4e28('0x5b')]));_0x596f73[_0x4e28('0x49')]=_0x596f73[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x596f73[_0x4e28('0x49')]:_0x258326[_0x4e28('0x56')];_0x596f73[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x3938b1[_0x4e28('0x43')]['sort']);_0x596f73[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_['pick'](_0x3938b1['query'],_0x258326[_0x4e28('0x59')]));if(_0x3938b1[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x596f73[_0x4e28('0xd5')]=_[_0x4e28('0xd6')](_0x596f73[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x596f73[_0x4e28('0x49')],function(_0x6ef1bf){var _0x1cd94b={};_0x1cd94b[_0x6ef1bf]={'$like':'%'+_0x3938b1[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x1cd94b;})});}_0x596f73=_['merge']({},_0x596f73,_0x3938b1[_0x4e28('0x5c')]);switch(_0x3769fd[_0x4e28('0x34')]){case'admin':return db[_[_0x4e28('0xaa')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xa2')])+'Queue'][_0x4e28('0x4b')](_0x596f73);case _0x4e28('0x84'):case'agent':return _0x3769fd[_0x4e28('0x2b')+_[_0x4e28('0xaa')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xa2')])+_0x4e28('0xab')](_0x596f73);default:throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0xe2'));}})['then'](function(_0x219803){_0x36e04a=_0x219803['length'];if(!_0x3938b1[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x596f73[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x596f73['offset']=qs[_0x4e28('0x24')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0x24')]);}switch(_0x3769fd[_0x4e28('0x34')]){case _0x4e28('0x2c'):return db[_[_0x4e28('0xaa')](_0x3938b1['query'][_0x4e28('0xa2')])+_0x4e28('0xe1')][_0x4e28('0x4b')](_0x596f73);case'user':case'agent':return _0x3769fd[_0x4e28('0x2b')+_[_0x4e28('0xaa')](_0x3938b1[_0x4e28('0x43')][_0x4e28('0xa2')])+_0x4e28('0xab')](_0x596f73);}})['then'](function(_0x44ce31){return{'count':_0x36e04a,'rows':_0x44ce31};})[_0x4e28('0x14')](respondWithResult(_0x5a498c,null))[_0x4e28('0x1f')](handleError(_0x5a498c,null));};exports[_0x4e28('0xe3')]=function(_0x5e5317,_0x340f22){var _0x8c47ab={};var _0x5413e5={};var _0x598762;var _0x37c6b1;return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x5e5317[_0x4e28('0x55')]['id']}})['then'](handleEntityNotFound(_0x340f22,null))[_0x4e28('0x14')](function(_0x2d7421){if(_0x2d7421){_0x598762=_0x2d7421;_0x5413e5['model']=_[_0x4e28('0x58')](db[_0x4e28('0xb6')][_0x4e28('0x3b')]);_0x5413e5['query']=_[_0x4e28('0x58')](_0x5e5317[_0x4e28('0x43')]);_0x5413e5[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x5413e5['model'],_0x5413e5[_0x4e28('0x43')]);_0x8c47ab[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x5413e5[_0x4e28('0x56')],qs['fields'](_0x5e5317[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x8c47ab[_0x4e28('0x49')]=_0x8c47ab[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x8c47ab[_0x4e28('0x49')]:_0x5413e5[_0x4e28('0x56')];_0x8c47ab[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x5e5317[_0x4e28('0x43')]['sort']);_0x8c47ab['where']=qs[_0x4e28('0x59')](_['pick'](_0x5e5317[_0x4e28('0x43')],_0x5413e5[_0x4e28('0x59')]));if(_0x5e5317[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x8c47ab[_0x4e28('0xd5')]=_[_0x4e28('0xd6')](_0x8c47ab[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x8c47ab[_0x4e28('0x49')],function(_0x48e5e0){var _0x17d296={};_0x17d296[_0x48e5e0]={'$like':'%'+_0x5e5317[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x17d296;})});}_0x8c47ab=_[_0x4e28('0xd6')]({},_0x8c47ab,_0x5e5317[_0x4e28('0x5c')]);return _0x598762[_0x4e28('0xe3')](_0x8c47ab);}})[_0x4e28('0x14')](function(_0xc6cb4b){if(_0xc6cb4b){_0x37c6b1=_0xc6cb4b[_0x4e28('0x4d')];if(!_0x5e5317[_0x4e28('0x43')][_0x4e28('0xd7')]('nolimit')){_0x8c47ab[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x5e5317[_0x4e28('0x43')]['limit']);_0x8c47ab[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x5e5317[_0x4e28('0x43')]['offset']);}return _0x598762[_0x4e28('0xe3')](_0x8c47ab);}})[_0x4e28('0x14')](function(_0x3004d3){if(_0x3004d3){return _0x3004d3?{'count':_0x37c6b1,'rows':_0x3004d3}:null;}})[_0x4e28('0x14')](respondWithResult(_0x340f22,null))[_0x4e28('0x1f')](handleError(_0x340f22,null));};exports['getGroups']=function(_0x3e112b,_0x21645d){var _0x394f04={};var _0xdd951d={};var _0x58342e;var _0x2b6018;return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x3e112b[_0x4e28('0x55')]['id']}})['then'](handleEntityNotFound(_0x21645d,null))[_0x4e28('0x14')](function(_0x127b30){if(_0x127b30){_0x58342e=_0x127b30;_0xdd951d[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_0x4e28('0xe4')][_0x4e28('0x3b')]);_0xdd951d['query']=_['keys'](_0x3e112b[_0x4e28('0x43')]);_0xdd951d[_0x4e28('0x59')]=_['intersection'](_0xdd951d['model'],_0xdd951d[_0x4e28('0x43')]);_0x394f04[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0xdd951d[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x3e112b[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x394f04[_0x4e28('0x49')]=_0x394f04[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x394f04[_0x4e28('0x49')]:_0xdd951d[_0x4e28('0x56')];_0x394f04['order']=qs[_0x4e28('0xd4')](_0x3e112b[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x394f04['where']=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0x3e112b[_0x4e28('0x43')],_0xdd951d[_0x4e28('0x59')]));if(_0x3e112b[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x394f04[_0x4e28('0xd5')]=_['merge'](_0x394f04['where'],{'$or':_[_0x4e28('0x31')](_0x394f04[_0x4e28('0x49')],function(_0x5044d7){var _0x271363={};_0x271363[_0x5044d7]={'$like':'%'+_0x3e112b[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x271363;})});}_0x394f04=_['merge']({},_0x394f04,_0x3e112b[_0x4e28('0x5c')]);return _0x58342e[_0x4e28('0xe6')](_0x394f04);}})[_0x4e28('0x14')](function(_0x4005e8){if(_0x4005e8){_0x2b6018=_0x4005e8[_0x4e28('0x4d')];if(!_0x3e112b[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x394f04[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x3e112b[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x394f04['offset']=qs[_0x4e28('0x24')](_0x3e112b['query'][_0x4e28('0x24')]);}return _0x58342e[_0x4e28('0xe6')](_0x394f04);}})[_0x4e28('0x14')](function(_0x3d08b5){if(_0x3d08b5){return _0x3d08b5?{'count':_0x2b6018,'rows':_0x3d08b5}:null;}})['then'](respondWithResult(_0x21645d,null))[_0x4e28('0x1f')](handleError(_0x21645d,null));};exports[_0x4e28('0xe7')]=function(_0x4011e6,_0x1cef5c){var _0xfcee42={'raw':!![],'where':{}};var _0x107df9={};var _0x5af540={'count':0x0,'rows':[]};return db['User'][_0x4e28('0xd1')]({'where':{'id':_0x4011e6[_0x4e28('0x55')]['id']}})['then'](handleEntityNotFound(_0x1cef5c,null))['then'](function(_0x59b48e){if(_0x59b48e){_0x107df9[_0x4e28('0x56')]=_['keys'](db[_0x4e28('0xe8')][_0x4e28('0x3b')]);_0x107df9[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x4011e6[_0x4e28('0x43')]);_0x107df9[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x107df9[_0x4e28('0x56')],_0x107df9['query']);_0xfcee42[_0x4e28('0x49')]=_['intersection'](_0x107df9[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x4011e6[_0x4e28('0x43')][_0x4e28('0x5b')]));_0xfcee42[_0x4e28('0x49')]=_0xfcee42[_0x4e28('0x49')]['length']?_0xfcee42[_0x4e28('0x49')]:_0x107df9[_0x4e28('0x56')];if(!_0x4011e6[_0x4e28('0x43')][_0x4e28('0xd7')]('nolimit')){_0xfcee42[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x4011e6[_0x4e28('0x43')]['limit']);_0xfcee42[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x4011e6[_0x4e28('0x43')]['offset']);}_0xfcee42[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x4011e6['query'][_0x4e28('0xd4')]);_0xfcee42[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0x4011e6['query'],_0x107df9[_0x4e28('0x59')]));_0xfcee42[_0x4e28('0xd5')][_0x4e28('0xe9')]=_0x59b48e['id'];if(_0x4011e6[_0x4e28('0x43')][_0x4e28('0x3f')]){_0xfcee42['where']=_['merge'](_0xfcee42[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0xfcee42['attributes'],function(_0x1b6266){var _0x299057={};_0x299057[_0x1b6266]={'$like':'%'+_0x4011e6[_0x4e28('0x43')]['filter']+'%'};return _0x299057;})});}_0xfcee42=_['merge']({},_0xfcee42,_0x4011e6[_0x4e28('0x5c')]);return db[_0x4e28('0xe8')][_0x4e28('0x26')]({'where':_0xfcee42[_0x4e28('0xd5')]})[_0x4e28('0x14')](function(_0x147067){_0x5af540[_0x4e28('0x26')]=_0x147067;if(_0x4011e6[_0x4e28('0x43')][_0x4e28('0x44')]){_0xfcee42['include']=[{'all':!![]}];}return db[_0x4e28('0xe8')][_0x4e28('0x4b')](_0xfcee42);})[_0x4e28('0x14')](function(_0x1295e2){_0x5af540['rows']=_0x1295e2;return _0x5af540;});}})[_0x4e28('0x14')](respondWithFilteredResult(_0x1cef5c,_0xfcee42))[_0x4e28('0x1f')](handleError(_0x1cef5c,null));};exports[_0x4e28('0xea')]=function(_0x23a70b,_0x5b4fe8){var _0x4bc2ce={'raw':!![],'where':{}};var _0x4842ac={};var _0x43e48a={'count':0x0,'rows':[]};return db[_0x4e28('0x42')]['findOne']({'where':{'id':_0x23a70b[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x5b4fe8,null))[_0x4e28('0x14')](function(_0x386190){if(_0x386190){_0x4842ac[_0x4e28('0x56')]=_[_0x4e28('0x58')](db['ScreenRecording']['rawAttributes']);_0x4842ac[_0x4e28('0x43')]=_['keys'](_0x23a70b[_0x4e28('0x43')]);_0x4842ac[_0x4e28('0x59')]=_['intersection'](_0x4842ac[_0x4e28('0x56')],_0x4842ac['query']);_0x4bc2ce[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x4842ac[_0x4e28('0x56')],qs['fields'](_0x23a70b[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x4bc2ce[_0x4e28('0x49')]=_0x4bc2ce[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x4bc2ce['attributes']:_0x4842ac[_0x4e28('0x56')];if(!_0x23a70b['query'][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x4bc2ce['limit']=qs[_0x4e28('0xdf')](_0x23a70b[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x4bc2ce['offset']=qs[_0x4e28('0x24')](_0x23a70b[_0x4e28('0x43')][_0x4e28('0x24')]);}_0x4bc2ce[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x23a70b[_0x4e28('0x43')]['sort']);_0x4bc2ce[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0x23a70b[_0x4e28('0x43')],_0x4842ac[_0x4e28('0x59')]));_0x4bc2ce['where']['UserId']=_0x386190['id'];if(_0x23a70b['query'][_0x4e28('0x3f')]){_0x4bc2ce['where']=_[_0x4e28('0xd6')](_0x4bc2ce[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x4bc2ce[_0x4e28('0x49')],function(_0x5987ed){var _0xd95a1a={};_0xd95a1a[_0x5987ed]={'$like':'%'+_0x23a70b['query'][_0x4e28('0x3f')]+'%'};return _0xd95a1a;})});}_0x4bc2ce=_[_0x4e28('0xd6')]({},_0x4bc2ce,_0x23a70b[_0x4e28('0x5c')]);return db[_0x4e28('0xeb')]['count']({'where':_0x4bc2ce[_0x4e28('0xd5')]})['then'](function(_0x15165b){_0x43e48a['count']=_0x15165b;if(_0x23a70b[_0x4e28('0x43')]['includeAll']){_0x4bc2ce['include']=[{'all':!![]}];}return db[_0x4e28('0xeb')][_0x4e28('0x4b')](_0x4bc2ce);})[_0x4e28('0x14')](function(_0x51f7fc){_0x43e48a[_0x4e28('0x4c')]=_0x51f7fc;return _0x43e48a;});}})[_0x4e28('0x14')](respondWithFilteredResult(_0x5b4fe8,_0x4bc2ce))[_0x4e28('0x1f')](handleError(_0x5b4fe8,null));};exports[_0x4e28('0xec')]=function(_0x7d3c4a,_0x3f11a5){var _0x3c2f5e={};var _0x2964f7={};var _0x558dcf;var _0xe2d1c7;return db['User']['findOne']({'where':{'id':_0x7d3c4a[_0x4e28('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f11a5,null))['then'](function(_0x3e3bff){if(_0x3e3bff){_0x558dcf=_0x3e3bff;_0x2964f7[_0x4e28('0x56')]=_[_0x4e28('0x58')](db['ChatInteraction'][_0x4e28('0x3b')]);_0x2964f7[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x7d3c4a[_0x4e28('0x43')]);_0x2964f7[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x2964f7[_0x4e28('0x56')],_0x2964f7[_0x4e28('0x43')]);_0x3c2f5e['attributes']=_[_0x4e28('0x5a')](_0x2964f7[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x7d3c4a[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x3c2f5e[_0x4e28('0x49')]=_0x3c2f5e[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x3c2f5e[_0x4e28('0x49')]:_0x2964f7[_0x4e28('0x56')];_0x3c2f5e[_0x4e28('0xd3')]=qs['sort'](_0x7d3c4a[_0x4e28('0x43')]['sort']);_0x3c2f5e[_0x4e28('0xd5')]=qs['filters'](_[_0x4e28('0xe5')](_0x7d3c4a['query'],_0x2964f7[_0x4e28('0x59')]));if(_0x7d3c4a[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x3c2f5e[_0x4e28('0xd5')]=_['merge'](_0x3c2f5e['where'],{'$or':_['map'](_0x3c2f5e['attributes'],function(_0x1f5500){var _0x321cc0={};_0x321cc0[_0x1f5500]={'$like':'%'+_0x7d3c4a[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x321cc0;})});}_0x3c2f5e=_['merge']({},_0x3c2f5e,_0x7d3c4a[_0x4e28('0x5c')]);return _0x558dcf['getChatInteractions'](_0x3c2f5e);}})[_0x4e28('0x14')](function(_0x146aeb){if(_0x146aeb){_0xe2d1c7=_0x146aeb[_0x4e28('0x4d')];if(!_0x7d3c4a['query'][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x3c2f5e[_0x4e28('0xdf')]=qs['limit'](_0x7d3c4a[_0x4e28('0x43')]['limit']);_0x3c2f5e[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x7d3c4a[_0x4e28('0x43')][_0x4e28('0x24')]);}return _0x558dcf[_0x4e28('0xec')](_0x3c2f5e);}})['then'](function(_0x58440c){if(_0x58440c){return _0x58440c?{'count':_0xe2d1c7,'rows':_0x58440c}:null;}})[_0x4e28('0x14')](respondWithResult(_0x3f11a5,null))[_0x4e28('0x1f')](handleError(_0x3f11a5,null));};exports[_0x4e28('0xed')]=function(_0x3e8eba,_0x50988f){var _0x24bf03={};var _0x3b4804={};var _0x1e322b;var _0x291747;return db['User'][_0x4e28('0xd1')]({'where':{'id':_0x3e8eba[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x50988f,null))[_0x4e28('0x14')](function(_0x236764){if(_0x236764){_0x1e322b=_0x236764;_0x3b4804['model']=_[_0x4e28('0x58')](db[_0x4e28('0xee')][_0x4e28('0x3b')]);_0x3b4804[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x3e8eba['query']);_0x3b4804[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x3b4804[_0x4e28('0x56')],_0x3b4804[_0x4e28('0x43')]);_0x24bf03['attributes']=_[_0x4e28('0x5a')](_0x3b4804[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x3e8eba['query'][_0x4e28('0x5b')]));_0x24bf03['attributes']=_0x24bf03[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x24bf03['attributes']:_0x3b4804[_0x4e28('0x56')];_0x24bf03[_0x4e28('0xd3')]=qs['sort'](_0x3e8eba[_0x4e28('0x43')]['sort']);_0x24bf03[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_['pick'](_0x3e8eba['query'],_0x3b4804['filters']));if(_0x3e8eba[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x24bf03[_0x4e28('0xd5')]=_[_0x4e28('0xd6')](_0x24bf03['where'],{'$or':_['map'](_0x24bf03[_0x4e28('0x49')],function(_0x2c980c){var _0x414cf6={};_0x414cf6[_0x2c980c]={'$like':'%'+_0x3e8eba['query'][_0x4e28('0x3f')]+'%'};return _0x414cf6;})});}_0x24bf03=_[_0x4e28('0xd6')]({},_0x24bf03,_0x3e8eba[_0x4e28('0x5c')]);return _0x1e322b[_0x4e28('0xed')](_0x24bf03);}})[_0x4e28('0x14')](function(_0x4aed65){if(_0x4aed65){_0x291747=_0x4aed65[_0x4e28('0x4d')];if(!_0x3e8eba[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x24bf03['limit']=qs['limit'](_0x3e8eba[_0x4e28('0x43')]['limit']);_0x24bf03[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x3e8eba[_0x4e28('0x43')][_0x4e28('0x24')]);}return _0x1e322b[_0x4e28('0xed')](_0x24bf03);}})[_0x4e28('0x14')](function(_0x5d7406){if(_0x5d7406){return _0x5d7406?{'count':_0x291747,'rows':_0x5d7406}:null;}})[_0x4e28('0x14')](respondWithResult(_0x50988f,null))['catch'](handleError(_0x50988f,null));};exports[_0x4e28('0xef')]=function(_0x4e9382,_0x549506){var _0x1ab635={'raw':!![],'where':{}};var _0x43b835={};var _0x4ea1cf={'count':0x0,'rows':[]};return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x4e9382[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x549506,null))['then'](function(_0x4ae661){if(_0x4ae661){_0x43b835[_0x4e28('0x56')]=_[_0x4e28('0x58')](db['MailInteraction']['rawAttributes']);_0x43b835[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x4e9382[_0x4e28('0x43')]);_0x43b835['filters']=_[_0x4e28('0x5a')](_0x43b835[_0x4e28('0x56')],_0x43b835[_0x4e28('0x43')]);_0x1ab635[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x43b835[_0x4e28('0x56')],qs['fields'](_0x4e9382[_0x4e28('0x43')][_0x4e28('0x5b')]));_0x1ab635['attributes']=_0x1ab635[_0x4e28('0x49')]['length']?_0x1ab635[_0x4e28('0x49')]:_0x43b835['model'];if(!_0x4e9382[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x1ab635[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x4e9382[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x1ab635[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x4e9382[_0x4e28('0x43')]['offset']);}_0x1ab635['order']=qs['sort'](_0x4e9382[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x1ab635[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_['pick'](_0x4e9382[_0x4e28('0x43')],_0x43b835[_0x4e28('0x59')]));_0x1ab635[_0x4e28('0xd5')][_0x4e28('0xe9')]=_0x4ae661['id'];if(_0x4e9382['query'][_0x4e28('0x3f')]){_0x1ab635['where']=_[_0x4e28('0xd6')](_0x1ab635[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x1ab635['attributes'],function(_0x3855ce){var _0x1848f0={};_0x1848f0[_0x3855ce]={'$like':'%'+_0x4e9382[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x1848f0;})});}_0x1ab635=_[_0x4e28('0xd6')]({},_0x1ab635,_0x4e9382[_0x4e28('0x5c')]);return db[_0x4e28('0xf0')][_0x4e28('0x26')]({'where':_0x1ab635[_0x4e28('0xd5')]})['then'](function(_0x52d041){_0x4ea1cf[_0x4e28('0x26')]=_0x52d041;if(_0x4e9382[_0x4e28('0x43')]['includeAll']){_0x1ab635[_0x4e28('0x45')]=[{'all':!![]}];}return db['MailInteraction'][_0x4e28('0x4b')](_0x1ab635);})[_0x4e28('0x14')](function(_0x12f112){_0x4ea1cf['rows']=_0x12f112;return _0x4ea1cf;});}})['then'](respondWithFilteredResult(_0x549506,_0x1ab635))[_0x4e28('0x1f')](handleError(_0x549506,null));};exports[_0x4e28('0xf1')]=function(_0xafcf37,_0x3bbad0){var _0x1d2672={};var _0x72fde0={};var _0x4c1a18;var _0x156317;return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0xafcf37['params']['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x3bbad0,null))[_0x4e28('0x14')](function(_0x3f7161){if(_0x3f7161){_0x4c1a18=_0x3f7161;_0x72fde0['model']=_['keys'](db[_0x4e28('0xf2')][_0x4e28('0x3b')]);_0x72fde0['query']=_[_0x4e28('0x58')](_0xafcf37[_0x4e28('0x43')]);_0x72fde0[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x72fde0[_0x4e28('0x56')],_0x72fde0[_0x4e28('0x43')]);_0x1d2672[_0x4e28('0x49')]=_['intersection'](_0x72fde0[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0xafcf37['query'][_0x4e28('0x5b')]));_0x1d2672[_0x4e28('0x49')]=_0x1d2672['attributes'][_0x4e28('0x4d')]?_0x1d2672[_0x4e28('0x49')]:_0x72fde0['model'];_0x1d2672[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0xafcf37[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x1d2672[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0xafcf37[_0x4e28('0x43')],_0x72fde0['filters']));if(_0xafcf37[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x1d2672[_0x4e28('0xd5')]=_['merge'](_0x1d2672[_0x4e28('0xd5')],{'$or':_['map'](_0x1d2672['attributes'],function(_0x4caef2){var _0x30c1bb={};_0x30c1bb[_0x4caef2]={'$like':'%'+_0xafcf37[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x30c1bb;})});}_0x1d2672=_[_0x4e28('0xd6')]({},_0x1d2672,_0xafcf37['options']);return _0x4c1a18['getSmsInteractions'](_0x1d2672);}})[_0x4e28('0x14')](function(_0x5e2fb4){if(_0x5e2fb4){_0x156317=_0x5e2fb4[_0x4e28('0x4d')];if(!_0xafcf37[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x1d2672['limit']=qs[_0x4e28('0xdf')](_0xafcf37[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x1d2672['offset']=qs[_0x4e28('0x24')](_0xafcf37['query']['offset']);}return _0x4c1a18[_0x4e28('0xf1')](_0x1d2672);}})[_0x4e28('0x14')](function(_0x2a5c64){if(_0x2a5c64){return _0x2a5c64?{'count':_0x156317,'rows':_0x2a5c64}:null;}})[_0x4e28('0x14')](respondWithResult(_0x3bbad0,null))[_0x4e28('0x1f')](handleError(_0x3bbad0,null));};exports[_0x4e28('0xf3')]=function(_0x59566e,_0x42816e){var _0x16fcfa={};var _0x55d5a2={};var _0x48bc55;var _0x1d0ee6;return db['User']['findOne']({'where':{'id':_0x59566e[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x42816e,null))[_0x4e28('0x14')](function(_0x22a105){if(_0x22a105){_0x48bc55=_0x22a105;_0x55d5a2[_0x4e28('0x56')]=_['keys'](db[_0x4e28('0xf4')][_0x4e28('0x3b')]);_0x55d5a2[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x59566e[_0x4e28('0x43')]);_0x55d5a2[_0x4e28('0x59')]=_['intersection'](_0x55d5a2[_0x4e28('0x56')],_0x55d5a2['query']);_0x16fcfa[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x55d5a2[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x59566e[_0x4e28('0x43')]['fields']));_0x16fcfa[_0x4e28('0x49')]=_0x16fcfa['attributes'][_0x4e28('0x4d')]?_0x16fcfa[_0x4e28('0x49')]:_0x55d5a2[_0x4e28('0x56')];_0x16fcfa[_0x4e28('0xd3')]=qs[_0x4e28('0xd4')](_0x59566e[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x16fcfa[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0x59566e[_0x4e28('0x43')],_0x55d5a2[_0x4e28('0x59')]));if(_0x59566e[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x16fcfa[_0x4e28('0xd5')]=_['merge'](_0x16fcfa['where'],{'$or':_['map'](_0x16fcfa[_0x4e28('0x49')],function(_0x40e97f){var _0x454d36={};_0x454d36[_0x40e97f]={'$like':'%'+_0x59566e['query'][_0x4e28('0x3f')]+'%'};return _0x454d36;})});}_0x16fcfa=_['merge']({},_0x16fcfa,_0x59566e['options']);return _0x48bc55[_0x4e28('0xf3')](_0x16fcfa);}})[_0x4e28('0x14')](function(_0x3609fd){if(_0x3609fd){_0x1d0ee6=_0x3609fd[_0x4e28('0x4d')];if(!_0x59566e[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x16fcfa['limit']=qs[_0x4e28('0xdf')](_0x59566e[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x16fcfa[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x59566e[_0x4e28('0x43')][_0x4e28('0x24')]);}return _0x48bc55[_0x4e28('0xf3')](_0x16fcfa);}})['then'](function(_0x28b4e9){if(_0x28b4e9){return _0x28b4e9?{'count':_0x1d0ee6,'rows':_0x28b4e9}:null;}})['then'](respondWithResult(_0x42816e,null))[_0x4e28('0x1f')](handleError(_0x42816e,null));};exports['getWhatsappInteractions']=function(_0x321ba8,_0x241def){var _0x2e6bcd={};var _0x190b12={};var _0x26c8fb;var _0xf97c45;return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x321ba8[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x241def,null))[_0x4e28('0x14')](function(_0x200d10){if(_0x200d10){_0x26c8fb=_0x200d10;_0x190b12[_0x4e28('0x56')]=_['keys'](db[_0x4e28('0xf5')][_0x4e28('0x3b')]);_0x190b12['query']=_[_0x4e28('0x58')](_0x321ba8['query']);_0x190b12[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x190b12['model'],_0x190b12[_0x4e28('0x43')]);_0x2e6bcd[_0x4e28('0x49')]=_['intersection'](_0x190b12[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x321ba8[_0x4e28('0x43')]['fields']));_0x2e6bcd[_0x4e28('0x49')]=_0x2e6bcd['attributes']['length']?_0x2e6bcd[_0x4e28('0x49')]:_0x190b12[_0x4e28('0x56')];_0x2e6bcd['order']=qs['sort'](_0x321ba8['query']['sort']);_0x2e6bcd[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0x321ba8[_0x4e28('0x43')],_0x190b12[_0x4e28('0x59')]));if(_0x321ba8[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x2e6bcd[_0x4e28('0xd5')]=_[_0x4e28('0xd6')](_0x2e6bcd[_0x4e28('0xd5')],{'$or':_['map'](_0x2e6bcd[_0x4e28('0x49')],function(_0xbda66){var _0x593bc8={};_0x593bc8[_0xbda66]={'$like':'%'+_0x321ba8[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x593bc8;})});}_0x2e6bcd=_[_0x4e28('0xd6')]({},_0x2e6bcd,_0x321ba8[_0x4e28('0x5c')]);return _0x26c8fb[_0x4e28('0xf6')](_0x2e6bcd);}})[_0x4e28('0x14')](function(_0x37cfa7){if(_0x37cfa7){_0xf97c45=_0x37cfa7[_0x4e28('0x4d')];if(!_0x321ba8['query'][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x2e6bcd[_0x4e28('0xdf')]=qs[_0x4e28('0xdf')](_0x321ba8[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x2e6bcd[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0x321ba8['query']['offset']);}return _0x26c8fb[_0x4e28('0xf6')](_0x2e6bcd);}})[_0x4e28('0x14')](function(_0x17c923){if(_0x17c923){return _0x17c923?{'count':_0xf97c45,'rows':_0x17c923}:null;}})['then'](respondWithResult(_0x241def,null))['catch'](handleError(_0x241def,null));};exports[_0x4e28('0xf7')]=function(_0x52252d,_0x17697d,_0x38cf91){var _0x1245b4;var _0x17c4e4;var _0x4dd06b;var _0x446623=!_[_0x4e28('0x6b')](_0x52252d[_0x4e28('0x55')]['id'])?_0x52252d[_0x4e28('0x55')]['id']:!_[_0x4e28('0x6b')](_0x52252d[_0x4e28('0x84')]['id'])?_0x52252d[_0x4e28('0x84')]['id']:null;return db['User'][_0x4e28('0x35')]({'where':{'id':_0x446623,'role':{'$or':[_0x4e28('0x2c'),_0x4e28('0x84'),_0x4e28('0x2f')]}},'attributes':['id',_0x4e28('0x38'),_0x4e28('0xf8'),_0x4e28('0xf9'),_0x4e28('0x34'),_0x4e28('0x64'),_0x4e28('0xa4')]})[_0x4e28('0x14')](function(_0x4ec5c1){if(_0x4ec5c1){if(_0x4ec5c1[_0x4e28('0x34')]===_0x4e28('0x2f')){_0x1245b4=_0x4ec5c1;if(_0x52252d[_0x4e28('0x60')][_0x4e28('0xa6')]){_0x4dd06b=util['format']('LOCAL/%s@from-sip/n',_0x1245b4[_0x52252d[_0x4e28('0x60')]['interface']]);}else if(_0x52252d[_0x4e28('0x60')][_0x4e28('0xfa')]){_0x4dd06b=util['format'](_0x4e28('0xb4'),_0x52252d[_0x4e28('0x60')]['intrf']);}else{_0x4dd06b=util[_0x4e28('0xb3')](_0x4e28('0xb4'),_0x1245b4[_0x4e28('0x38')]);}socket['to'](util[_0x4e28('0xb3')](_0x4e28('0xfb'),_0x1245b4[_0x4e28('0x38')]))[_0x4e28('0xaf')]('user:forcelogout',{'user':{'id':_0x1245b4['id'],'name':_0x1245b4[_0x4e28('0x38')]},'ip':_0x52252d['headers'][_0x4e28('0xfc')]||_0x52252d[_0x4e28('0xfd')][_0x4e28('0xfe')]||_0x52252d['socket'][_0x4e28('0xfe')]||_0x52252d['connection'][_0x4e28('0xff')][_0x4e28('0xfe')]});return db['UserVoiceQueueRt'][_0x4e28('0x2a')]({'where':{'membername':_0x1245b4['name']},'individualHooks':!![]});}}else{throw new db[(_0x4e28('0x97'))][(_0x4e28('0x98'))](_0x4e28('0x100'));}})['then'](function(){if(_0x1245b4){return _0x1245b4[_0x4e28('0x101')]({'raw':!![]});}})[_0x4e28('0x14')](function(_0x30a84a){if(_0x1245b4){var _0x318502=[];if(_0x30a84a){_0x17c4e4=_0x30a84a;if(_0x17c4e4[_0x4e28('0x4d')]){for(var _0x58451d=0x0;_0x58451d<_0x17c4e4[_0x4e28('0x4d')];_0x58451d++){_0x318502[_0x4e28('0x4a')]({'membername':_0x1245b4[_0x4e28('0x38')],'UserId':_0x1245b4['id'],'queue_name':_0x17c4e4[_0x58451d][_0x4e28('0x38')],'VoiceQueueId':_0x17c4e4[_0x58451d]['id'],'interface':_0x4dd06b,'paused':_0x1245b4[_0x4e28('0xa4')]||![],'penalty':_0x17c4e4[_0x58451d]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x318502,function(_0x3938e4){return db[_0x4e28('0xb6')][_0x4e28('0xb7')](_0x3938e4);});}}}})[_0x4e28('0x14')](function(){if(_0x1245b4){return db['MemberReport']['findAll']({'where':{'membername':_0x1245b4[_0x4e28('0x38')],'exitAt':null}});}})['then'](function(_0x49f53c){if(_0x1245b4){var _0x4739b3=[];_0x49f53c[_0x4e28('0x102')](function(_0x5b5973){_0x4739b3[_0x4e28('0x4a')](_0x5b5973[_0x4e28('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4e28('0x53')](_0x4739b3);}})[_0x4e28('0x14')](function(){if(_0x1245b4){var _0x3939c9=[];var _0x1a1675=[];var _0x585da7=utils[_0x4e28('0x103')]();var _0x4ef871={'membername':_0x1245b4['name'],'interface':_0x4dd06b,'enterAt':moment()[_0x4e28('0xb3')](_0x4e28('0x104')),'role':_0x1245b4['role'],'internal':_0x1245b4[_0x4e28('0x64')]};_0x585da7[_0x4e28('0x102')](function(_0x117d30){_0x3939c9[_0x4e28('0x4a')](_[_0x4e28('0xd6')]({'channel':_0x117d30,'type':_0x4e28('0x105'),'data1':_0x52252d['body'][_0x4e28('0x106')],'data2':_0x4dd06b},_0x4ef871));if(_0x1245b4['loginInPause']){_0x1a1675[_0x4e28('0x4a')](_[_0x4e28('0xd6')]({'channel':_0x117d30,'type':'PAUSE','data1':_0x4e28('0x107')},_0x4ef871));}});return db[_0x4e28('0x108')][_0x4e28('0x8d')](_0x3939c9[_0x4e28('0xcf')](_0x1a1675),{'individualHooks':!![]});}})[_0x4e28('0x14')](function(){if(_0x1245b4){return _0x1245b4['update']({'online':!![],'lastLoginAt':moment()[_0x4e28('0xb3')](_0x4e28('0x104')),'voicePause':_0x1245b4[_0x4e28('0xa4')]||![],'mailPause':_0x1245b4['loginInPause']||![],'chatPause':_0x1245b4['loginInPause']||![],'faxPause':_0x1245b4[_0x4e28('0xa4')]||![],'smsPause':_0x1245b4[_0x4e28('0xa4')]||![],'openchannelPause':_0x1245b4[_0x4e28('0xa4')]||![],'whatsappPause':_0x1245b4[_0x4e28('0xa4')]||![],'pauseType':_0x1245b4[_0x4e28('0xa4')]?_0x4e28('0x107'):null,'interface':_0x4dd06b,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4e28('0x14')](function(_0x269b0a){if(_0x52252d[_0x4e28('0x109')]){return _0x38cf91();}else{return BPromise[_0x4e28('0x10a')](_0x269b0a)[_0x4e28('0x14')](respondWithResult(_0x17697d,null));}})['catch'](handleError(_0x17697d,null));};exports[_0x4e28('0x10b')]=function(_0x11182c,_0x3594eb){var _0x21b8c7;return db['User']['find']({'where':{'id':_0x11182c['params']['id'],'role':_0x4e28('0x2f')},'attributes':['id',_0x4e28('0x38'),'role']})['then'](handleEntityNotFound(_0x3594eb,null))['then'](function(_0x24e2c4){if(_0x24e2c4){_0x21b8c7=_0x24e2c4;return db[_0x4e28('0xb6')]['destroy']({'where':{'membername':_0x21b8c7[_0x4e28('0x38')]},'individualHooks':!![]});}})[_0x4e28('0x14')](function(){return db[_0x4e28('0x108')][_0x4e28('0x4b')]({'where':{'membername':_0x21b8c7[_0x4e28('0x38')],'exitAt':null}});})[_0x4e28('0x14')](function(_0x297555){var _0x29c383=[];_0x297555[_0x4e28('0x102')](function(_0x579009){_0x29c383[_0x4e28('0x4a')](_0x579009[_0x4e28('0x29')]({'exitAt':moment()[_0x4e28('0xb3')](_0x4e28('0x104'))}));});return BPromise[_0x4e28('0x53')](_0x29c383);})[_0x4e28('0x14')](function(){return _0x21b8c7[_0x4e28('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4e28('0x14')](respondWithResult(_0x3594eb,null))['catch'](handleError(_0x3594eb,null));};exports[_0x4e28('0x10c')]=function(_0x1a2816,_0x107999){var _0x1dad5e;return db[_0x4e28('0xb6')][_0x4e28('0x29')]({'paused':0x1},{'where':{'UserId':_0x1a2816[_0x4e28('0x55')]['id']},'individualHooks':!![]})[_0x4e28('0x14')](function(){return db[_0x4e28('0x42')][_0x4e28('0x35')]({'where':{'id':_0x1a2816[_0x4e28('0x55')]['id'],'role':'agent'},'attributes':['id','name','role',_0x4e28('0x64'),_0x4e28('0xa6')]});})[_0x4e28('0x14')](handleEntityNotFound(_0x107999,null))[_0x4e28('0x14')](function(_0x57cbcb){if(_0x57cbcb){_0x1dad5e=_0x57cbcb;return respondWithRpcPromise('QueuePause','pause',{'id':_0x1dad5e['id'],'name':_0x1dad5e[_0x4e28('0x38')],'pause':!![]});}})[_0x4e28('0x14')](function(){if(_0x1dad5e){return db[_0x4e28('0x108')][_0x4e28('0x4b')]({'where':{'membername':_0x1dad5e[_0x4e28('0x38')],'type':_0x4e28('0x10d'),'exitAt':null}});}})[_0x4e28('0x14')](function(_0x4b0619){if(_0x4b0619[_0x4e28('0x4d')]){var _0x5dd7fb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x21eddb=0x0,_0x1b8964=_0x4b0619[_0x4e28('0x4d')];_0x21eddb<_0x1b8964;_0x21eddb++){_0x4b0619[_0x21eddb][_0x4e28('0x10e')]({'exitAt':_0x5dd7fb});}}})[_0x4e28('0x14')](function(){var _0x3d5cad=[];var _0x28bb70=utils[_0x4e28('0x103')]();_0x28bb70[_0x4e28('0x102')](function(_0x2455b2){_0x3d5cad[_0x4e28('0x4a')]({'channel':_0x2455b2,'membername':_0x1dad5e['name'],'interface':_['isNil'](_0x1dad5e['interface'])?util[_0x4e28('0xb3')](_0x4e28('0xb4'),_0x1dad5e[_0x4e28('0x38')]):_0x1dad5e[_0x4e28('0xa6')],'type':_0x4e28('0x10d'),'enterAt':moment()[_0x4e28('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1a2816['body'][_0x4e28('0x3d')]||_0x4e28('0x10f'),'role':_0x1dad5e[_0x4e28('0x34')],'internal':_0x1dad5e[_0x4e28('0x64')]});});return db['MemberReport']['bulkCreate'](_0x3d5cad,{'individualHooks':!![]});})['then'](function(){return _0x1dad5e[_0x4e28('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a2816[_0x4e28('0x60')][_0x4e28('0x3d')]||_0x4e28('0x10f'),'lastPauseAt':moment()[_0x4e28('0xb3')](_0x4e28('0x104'))});})[_0x4e28('0x14')](respondWithResult(_0x107999,null))[_0x4e28('0x1f')](handleError(_0x107999,null));};exports[_0x4e28('0x110')]=function(_0x256c8b,_0x20487d){var _0x441be7;return db[_0x4e28('0x42')]['find']({'where':{'id':_0x256c8b[_0x4e28('0x55')]['id']},'attributes':['id',_0x4e28('0x38'),_0x4e28('0x34'),'voicePause','mailPause',_0x4e28('0x111'),_0x4e28('0x112'),_0x4e28('0x113'),_0x4e28('0x114'),_0x4e28('0x115'),_0x4e28('0x116'),_0x4e28('0x117')]})[_0x4e28('0x14')](handleEntityNotFound(_0x20487d,null))[_0x4e28('0x14')](function(_0x4682e2){if(_0x4682e2){_0x441be7=_0x4682e2;if(_0x256c8b[_0x4e28('0x60')]['channel']&&!utils[_0x4e28('0xa7')](_0x256c8b[_0x4e28('0x60')][_0x4e28('0xa2')])){throw new db['Sequelize'][(_0x4e28('0x98'))]('Unknown\x20channel');}switch(_0x256c8b[_0x4e28('0x60')]['channel']){case _0x4e28('0xb2'):return respondWithRpcPromise(_0x4e28('0x118'),_0x4e28('0x110'),{'id':_0x441be7['id'],'name':_0x441be7[_0x4e28('0x38')],'pause':![]})[_0x4e28('0x14')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x441be7['id']},'individualHooks':!![]});})[_0x4e28('0x14')](function(){return db['MemberReport']['find']({'where':{'channel':_0x256c8b[_0x4e28('0x60')][_0x4e28('0xa2')],'membername':_0x441be7['name'],'type':_0x4e28('0x10d'),'exitAt':null}});})['then'](function(_0x5c15a7){if(_0x5c15a7){return _0x5c15a7[_0x4e28('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x4e28('0x119')},{'individualHooks':!![]});}return null;})[_0x4e28('0x14')](function(){return _0x441be7[_0x4e28('0x29')]({'voicePause':![]});});case _0x4e28('0x50'):case _0x4e28('0x5e'):case'fax':case _0x4e28('0x5f'):case _0x4e28('0x52'):case _0x4e28('0x51'):return db[_0x4e28('0x108')]['find']({'where':{'channel':_0x256c8b['body']['channel'],'membername':_0x441be7[_0x4e28('0x38')],'type':_0x4e28('0x10d'),'exitAt':null}})[_0x4e28('0x14')](function(_0x1f6041){if(_0x1f6041){return _0x1f6041['update']({'exitAt':moment()['format'](_0x4e28('0x104')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4e28('0x14')](function(){var _0x549df8={};_[_0x4e28('0x27')](_0x549df8,util['format'](_0x4e28('0x11a'),_0x256c8b[_0x4e28('0x60')][_0x4e28('0xa2')],_0x4e28('0x11b')),![]);return _0x441be7[_0x4e28('0x29')](_0x549df8);});default:return respondWithRpcPromise(_0x4e28('0x118'),_0x4e28('0x110'),{'id':_0x441be7['id'],'name':_0x441be7['name'],'pause':![]})[_0x4e28('0x14')](function(){return db[_0x4e28('0xb6')][_0x4e28('0x29')]({'paused':0x0},{'where':{'UserId':_0x441be7['id']}});})[_0x4e28('0x14')](function(){return db[_0x4e28('0x108')]['findAll']({'where':{'membername':_0x441be7[_0x4e28('0x38')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x51d958){var _0x200bde=[];_0x51d958['forEach'](function(_0x1e1dd0){_0x200bde['push'](_0x1e1dd0[_0x4e28('0x29')]({'exitAt':moment()[_0x4e28('0xb3')](_0x4e28('0x104')),'data2':_0x4e28('0x119')}));});return BPromise[_0x4e28('0x53')](_0x200bde);})['then'](function(){return _0x441be7[_0x4e28('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4e28('0x14')](respondWithResult(_0x20487d,null))['catch'](handleError(_0x20487d,null));};exports['getTeams']=function(_0xd1131e,_0x4bdd1b){var _0x37f5b={};var _0x3eab13={};var _0xa2027c;var _0x422410;return db['User']['findOne']({'where':{'id':_0xd1131e['params']['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x4bdd1b,null))[_0x4e28('0x14')](function(_0x4a03f9){if(_0x4a03f9){_0xa2027c=_0x4a03f9;_0x3eab13[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_0x4e28('0x11c')]['rawAttributes']);_0x3eab13[_0x4e28('0x43')]=_['keys'](_0xd1131e[_0x4e28('0x43')]);_0x3eab13[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x3eab13[_0x4e28('0x56')],_0x3eab13[_0x4e28('0x43')]);_0x37f5b[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x3eab13[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0xd1131e['query'][_0x4e28('0x5b')]));_0x37f5b['attributes']=_0x37f5b[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x37f5b[_0x4e28('0x49')]:_0x3eab13[_0x4e28('0x56')];_0x37f5b['order']=qs[_0x4e28('0xd4')](_0xd1131e[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x37f5b[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0xd1131e[_0x4e28('0x43')],_0x3eab13['filters']));if(_0xd1131e[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x37f5b[_0x4e28('0xd5')]=_[_0x4e28('0xd6')](_0x37f5b[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x37f5b['attributes'],function(_0x23fcea){var _0xc320ad={};_0xc320ad[_0x23fcea]={'$like':'%'+_0xd1131e[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0xc320ad;})});}_0x37f5b=_[_0x4e28('0xd6')]({},_0x37f5b,_0xd1131e['options']);return _0xa2027c[_0x4e28('0x11d')](_0x37f5b);}})[_0x4e28('0x14')](function(_0x4a518e){if(_0x4a518e){_0x422410=_0x4a518e[_0x4e28('0x4d')];if(!_0xd1131e[_0x4e28('0x43')]['hasOwnProperty'](_0x4e28('0xde'))){_0x37f5b[_0x4e28('0xdf')]=qs['limit'](_0xd1131e[_0x4e28('0x43')][_0x4e28('0xdf')]);_0x37f5b[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0xd1131e[_0x4e28('0x43')][_0x4e28('0x24')]);}return _0xa2027c[_0x4e28('0x11d')](_0x37f5b);}})[_0x4e28('0x14')](function(_0x212fce){if(_0x212fce){return _0x212fce?{'count':_0x422410,'rows':_0x212fce}:null;}})[_0x4e28('0x14')](respondWithResult(_0x4bdd1b,null))['catch'](handleError(_0x4bdd1b,null));};exports[_0x4e28('0x11e')]=function(_0x43748c,_0x284b78){return db['User']['find']({'where':{'id':_0x43748c[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x284b78,null))[_0x4e28('0x14')](function(_0xf04d92){if(_0xf04d92){var _0x38b281=_0xf04d92[_0x4e28('0x2b')]({'plain':!![]});return _0xf04d92[_0x4e28('0x11e')](_0x43748c[_0x4e28('0x60')][_0x4e28('0x62')],_[_0x4e28('0x63')](_0x43748c['body'],[_0x4e28('0x62'),'id'])||{})['then'](function(){for(var _0x1edec9=0x0;_0x1edec9<_0x43748c[_0x4e28('0x60')][_0x4e28('0x62')][_0x4e28('0x4d')];_0x1edec9++){var _0x4c55bb=[];var _0x5a2dee={};db[_0x4e28('0x11c')][_0x4e28('0xd1')]({'where':{'id':_0x43748c[_0x4e28('0x60')]['ids'][_0x1edec9]}})['then'](function(_0xd3acbc){_0x5a2dee=_0xd3acbc[_0x4e28('0x4e')];_0x4c55bb[_0x4e28('0x4a')](_0xd3acbc[_0x4e28('0x101')]()[_0x4e28('0x14')](function(_0x52fbd5){for(var _0x321274=0x0;_0x321274<_0x52fbd5['length'];_0x321274++){_0x52fbd5[_0x321274][_0x4e28('0x11f')](_0x4e28('0xa2'),'Voice');}return _0x52fbd5;}));_0x4c55bb[_0x4e28('0x4a')](_0xd3acbc[_0x4e28('0x120')]()['then'](function(_0x4df2f0){for(var _0x41a3be=0x0;_0x41a3be<_0x4df2f0[_0x4e28('0x4d')];_0x41a3be++){_0x4df2f0[_0x41a3be]['setDataValue'](_0x4e28('0xa2'),_0x4e28('0x121'));}return _0x4df2f0;}));_0x4c55bb['push'](_0xd3acbc[_0x4e28('0x122')]()['then'](function(_0x4a6996){for(var _0x3387a2=0x0;_0x3387a2<_0x4a6996[_0x4e28('0x4d')];_0x3387a2++){_0x4a6996[_0x3387a2][_0x4e28('0x11f')]('channel','Mail');}return _0x4a6996;}));_0x4c55bb['push'](_0xd3acbc[_0x4e28('0x123')]()[_0x4e28('0x14')](function(_0x5e90db){for(var _0x65676e=0x0;_0x65676e<_0x5e90db[_0x4e28('0x4d')];_0x65676e++){_0x5e90db[_0x65676e]['setDataValue'](_0x4e28('0xa2'),_0x4e28('0x124'));}return _0x5e90db;}));_0x4c55bb[_0x4e28('0x4a')](_0xd3acbc[_0x4e28('0x125')]()['then'](function(_0x3faa0f){for(var _0x4ce2fe=0x0;_0x4ce2fe<_0x3faa0f[_0x4e28('0x4d')];_0x4ce2fe++){_0x3faa0f[_0x4ce2fe][_0x4e28('0x11f')](_0x4e28('0xa2'),_0x4e28('0x126'));}return _0x3faa0f;}));_0x4c55bb[_0x4e28('0x4a')](_0xd3acbc[_0x4e28('0x127')]()['then'](function(_0x58104b){for(var _0x5c06f1=0x0;_0x5c06f1<_0x58104b['length'];_0x5c06f1++){_0x58104b[_0x5c06f1][_0x4e28('0x11f')](_0x4e28('0xa2'),'Fax');}return _0x58104b;}));_0x4c55bb[_0x4e28('0x4a')](_0xd3acbc[_0x4e28('0x128')]()[_0x4e28('0x14')](function(_0x5a3e23){for(var _0x5d12f1=0x0;_0x5d12f1<_0x5a3e23[_0x4e28('0x4d')];_0x5d12f1++){_0x5a3e23[_0x5d12f1]['setDataValue'](_0x4e28('0xa2'),'Openchannel');}return _0x5a3e23;}));return BPromise['all'](_0x4c55bb);})[_0x4e28('0x14')](function(_0x583b73){var _0x3a77ea=_['flatten'](_0x583b73);_0x4c55bb=[];return db[_0x4e28('0x6d')][_0x4e28('0x129')](function(_0x48ab8c){for(var _0x2e4319=0x0;_0x2e4319<_0x3a77ea[_0x4e28('0x4d')];_0x2e4319++){_0x4c55bb[_0x4e28('0x4a')](_0x3a77ea[_0x2e4319]['addAgent'](_0x38b281['id']),{'transaction':_0x48ab8c});}return BPromise[_0x4e28('0x53')](_0x4c55bb)[_0x4e28('0x14')](function(){if(_0x38b281['online']){return BPromise[_0x4e28('0x91')](_[_0x4e28('0x3f')](_0x3a77ea,function(_0x4af207){return _0x4af207['getDataValue'](_0x4e28('0xa2'))===_0x4e28('0x12a');}),function(_0x30a959){return db['UserVoiceQueueRt'][_0x4e28('0xb7')]({'membername':_0x38b281[_0x4e28('0x38')],'UserId':_0x38b281['id'],'queue_name':_0x30a959[_0x4e28('0x38')],'VoiceQueueId':_0x30a959['id'],'interface':_[_0x4e28('0x6b')](_0x38b281['interface'])?util['format'](_0x4e28('0xb4'),_0x38b281[_0x4e28('0x38')]):_0x38b281[_0x4e28('0xa6')],'paused':_0x38b281[_0x4e28('0xa5')]||![],'penalty':_0x38b281[_0x4e28('0xb5')]},{'transaction':_0x48ab8c});});}else{return;}})['then'](function(){for(var _0x4b1976=0x0;_0x4b1976<_0x3a77ea[_0x4e28('0x4d')];_0x4b1976++){var _0x2fd978=_0x3a77ea[_0x4b1976][_0x4e28('0x12b')](_0x4e28('0xa2'));var _0x55ac66=_0x2fd978+_0x4e28('0xae');socket['emit']('user'+_0x2fd978+_0x4e28('0xb0'),{'UserId':_0x38b281['id'],['queueField']:_0x3a77ea[_0x4b1976]['id']});}});});})[_0x4e28('0x14')](function(){db[_0x4e28('0x12c')][_0x4e28('0xd1')]({'where':{'teamId':_0x5a2dee['id']}})[_0x4e28('0x14')](function(_0x5e150d){if(_0x5e150d){db['UserVoicePrefix'][_0x4e28('0x83')]({'UserId':_0x43748c['params']['id'],'VoicePrefixId':_0x5e150d[_0x4e28('0x12d')]});}});});}});}})[_0x4e28('0x14')](respondWithStatusCode(_0x284b78,null))[_0x4e28('0x1f')](handleError(_0x284b78,null));};exports[_0x4e28('0x12e')]=function(_0x591b58,_0x15be0c){return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x591b58[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x15be0c,null))[_0x4e28('0x14')](function(_0x503803){if(_0x503803){var _0x323294=_0x503803[_0x4e28('0x2b')]({'plain':!![]});var _0x328e0a=_0x591b58[_0x4e28('0x43')][_0x4e28('0x62')];return _0x503803[_0x4e28('0x12e')](_0x328e0a)['then'](function(){for(var _0x22d758=0x0;_0x22d758<_0x328e0a[_0x4e28('0x4d')];_0x22d758++){var _0xe8bc6=[];var _0x3cf309={};db['Team'][_0x4e28('0xd1')]({'where':{'id':_0x328e0a[_0x22d758]}})[_0x4e28('0x14')](function(_0x31359a){_0x3cf309=_0x31359a[_0x4e28('0x4e')];_0xe8bc6[_0x4e28('0x4a')](_0x31359a[_0x4e28('0x101')]()[_0x4e28('0x14')](function(_0x24603c){for(var _0x1faedd=0x0;_0x1faedd<_0x24603c[_0x4e28('0x4d')];_0x1faedd++){_0x24603c[_0x1faedd][_0x4e28('0x11f')](_0x4e28('0xa2'),_0x4e28('0x12a'));}return _0x24603c;}));_0xe8bc6['push'](_0x31359a[_0x4e28('0x120')]()[_0x4e28('0x14')](function(_0xa7537c){for(var _0x1d5541=0x0;_0x1d5541<_0xa7537c['length'];_0x1d5541++){_0xa7537c[_0x1d5541]['setDataValue'](_0x4e28('0xa2'),_0x4e28('0x121'));}return _0xa7537c;}));_0xe8bc6[_0x4e28('0x4a')](_0x31359a[_0x4e28('0x122')]()[_0x4e28('0x14')](function(_0x496734){for(var _0x1108df=0x0;_0x1108df<_0x496734[_0x4e28('0x4d')];_0x1108df++){_0x496734[_0x1108df][_0x4e28('0x11f')](_0x4e28('0xa2'),'Mail');}return _0x496734;}));_0xe8bc6[_0x4e28('0x4a')](_0x31359a[_0x4e28('0x123')]()[_0x4e28('0x14')](function(_0xa9f4c4){for(var _0x51932a=0x0;_0x51932a<_0xa9f4c4['length'];_0x51932a++){_0xa9f4c4[_0x51932a]['setDataValue'](_0x4e28('0xa2'),'Sms');}return _0xa9f4c4;}));_0xe8bc6['push'](_0x31359a[_0x4e28('0x125')]()[_0x4e28('0x14')](function(_0x5679c9){for(var _0x4bd3e7=0x0;_0x4bd3e7<_0x5679c9[_0x4e28('0x4d')];_0x4bd3e7++){_0x5679c9[_0x4bd3e7][_0x4e28('0x11f')](_0x4e28('0xa2'),'Whatsapp');}return _0x5679c9;}));_0xe8bc6[_0x4e28('0x4a')](_0x31359a[_0x4e28('0x127')]()[_0x4e28('0x14')](function(_0x542571){for(var _0x1b06a4=0x0;_0x1b06a4<_0x542571['length'];_0x1b06a4++){_0x542571[_0x1b06a4]['setDataValue'](_0x4e28('0xa2'),_0x4e28('0x12f'));}return _0x542571;}));_0xe8bc6['push'](_0x31359a[_0x4e28('0x128')]()[_0x4e28('0x14')](function(_0x145111){for(var _0x445ef8=0x0;_0x445ef8<_0x145111[_0x4e28('0x4d')];_0x445ef8++){_0x145111[_0x445ef8][_0x4e28('0x11f')](_0x4e28('0xa2'),'Openchannel');}return _0x145111;}));return BPromise['all'](_0xe8bc6);})[_0x4e28('0x14')](function(_0x18569a){var _0x2c3a45=_[_0x4e28('0x130')](_0x18569a);_0xe8bc6=[];return db[_0x4e28('0x6d')]['transaction'](function(_0x23b242){for(var _0x1e2ad5=0x0;_0x1e2ad5<_0x2c3a45[_0x4e28('0x4d')];_0x1e2ad5++){_0xe8bc6['push'](_0x2c3a45[_0x1e2ad5][_0x4e28('0x131')](_0x323294['id']),{'transaction':_0x23b242});}return BPromise['all'](_0xe8bc6)['then'](function(){if(_0x323294[_0x4e28('0xa3')]){return BPromise[_0x4e28('0x91')](_[_0x4e28('0x3f')](_0x2c3a45,function(_0x4e3136){return _0x4e3136[_0x4e28('0x12b')](_0x4e28('0xa2'))===_0x4e28('0x12a');}),function(_0x43c457){return db[_0x4e28('0xb6')][_0x4e28('0x2a')]({'where':{'VoiceQueueId':_0x43c457['id'],'UserId':_0x323294['id']},'transaction':_0x23b242});});}else{return;}})['then'](function(){db[_0x4e28('0x12c')][_0x4e28('0xd1')]({'where':{'teamId':_0x3cf309['id']}})[_0x4e28('0x14')](function(_0x6e2f3b){if(_0x6e2f3b){return db[_0x4e28('0x132')]['destroy']({'where':{'UserId':_0x323294['id'],'VoicePrefixId':_0x6e2f3b[_0x4e28('0x4e')][_0x4e28('0x12d')]}});}});})['then'](function(){for(var _0x2b7cf8=0x0;_0x2b7cf8<_0x2c3a45[_0x4e28('0x4d')];_0x2b7cf8++){var _0x27241b=_0x2c3a45[_0x2b7cf8]['getDataValue'](_0x4e28('0xa2'));var _0x246f20=_0x27241b+_0x4e28('0xae');socket[_0x4e28('0xaf')]('user'+_0x27241b+_0x4e28('0xba'),{'UserId':_0x323294['id'],['queueField']:_0x2c3a45[_0x2b7cf8]['id']});}});});});}});}})[_0x4e28('0x14')](respondWithStatusCode(_0x15be0c,null))[_0x4e28('0x1f')](handleError(_0x15be0c,null));};exports['getLists']=function(_0xb71d20,_0x1acf83){var _0x362144={};var _0x5052f4={};var _0xef30b0;var _0x2bb019;return db['User'][_0x4e28('0xd1')]({'where':{'id':_0xb71d20[_0x4e28('0x55')]['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x1acf83,null))[_0x4e28('0x14')](function(_0x2e84b5){if(_0x2e84b5){_0xef30b0=_0x2e84b5;_0x5052f4[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_0x4e28('0xd8')][_0x4e28('0x3b')]);_0x5052f4[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0xb71d20[_0x4e28('0x43')]);_0x5052f4[_0x4e28('0x59')]=_[_0x4e28('0x5a')](_0x5052f4[_0x4e28('0x56')],_0x5052f4[_0x4e28('0x43')]);_0x362144[_0x4e28('0x49')]=_[_0x4e28('0x5a')](_0x5052f4[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0xb71d20[_0x4e28('0x43')]['fields']));_0x362144[_0x4e28('0x49')]=_0x362144[_0x4e28('0x49')][_0x4e28('0x4d')]?_0x362144['attributes']:_0x5052f4[_0x4e28('0x56')];_0x362144['order']=qs[_0x4e28('0xd4')](_0xb71d20[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x362144[_0x4e28('0xd5')]=qs[_0x4e28('0x59')](_[_0x4e28('0xe5')](_0xb71d20['query'],_0x5052f4[_0x4e28('0x59')]));if(_0xb71d20[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x362144[_0x4e28('0xd5')]=_['merge'](_0x362144[_0x4e28('0xd5')],{'$or':_[_0x4e28('0x31')](_0x362144[_0x4e28('0x49')],function(_0x468c0a){var _0x13d65c={};_0x13d65c[_0x468c0a]={'$like':'%'+_0xb71d20[_0x4e28('0x43')][_0x4e28('0x3f')]+'%'};return _0x13d65c;})});}_0x362144=_[_0x4e28('0xd6')]({},_0x362144,_0xb71d20[_0x4e28('0x5c')]);return _0xef30b0[_0x4e28('0x133')](_0x362144);}})[_0x4e28('0x14')](function(_0x5369c1){if(_0x5369c1){_0x2bb019=_0x5369c1[_0x4e28('0x4d')];if(!_0xb71d20[_0x4e28('0x43')][_0x4e28('0xd7')](_0x4e28('0xde'))){_0x362144['limit']=qs[_0x4e28('0xdf')](_0xb71d20['query']['limit']);_0x362144[_0x4e28('0x24')]=qs[_0x4e28('0x24')](_0xb71d20[_0x4e28('0x43')]['offset']);}return _0xef30b0[_0x4e28('0x133')](_0x362144);}})['then'](function(_0x69df1e){if(_0x69df1e){return _0x69df1e?{'count':_0x2bb019,'rows':_0x69df1e}:null;}})[_0x4e28('0x14')](respondWithResult(_0x1acf83,null))[_0x4e28('0x1f')](handleError(_0x1acf83,null));};exports[_0x4e28('0x134')]=function(_0x391066,_0x209dc6){var _0x4ab3d1={};var _0x7e330a={};var _0x187645;return db[_0x4e28('0x42')][_0x4e28('0xd1')]({'where':{'id':_0x391066['params']['id']}})[_0x4e28('0x14')](handleEntityNotFound(_0x209dc6,null))[_0x4e28('0x14')](function(_0x151df2){if(_0x151df2){_0x187645=_0x151df2;_0x7e330a[_0x4e28('0x56')]=_[_0x4e28('0x58')](db[_0x4e28('0x42')]['rawAttributes']);_0x7e330a[_0x4e28('0x43')]=_[_0x4e28('0x58')](_0x391066[_0x4e28('0x43')]);_0x7e330a[_0x4e28('0x59')]=_['intersection'](_0x7e330a[_0x4e28('0x56')],_0x7e330a['query']);_0x4ab3d1[_0x4e28('0x49')]=_['intersection'](_0x7e330a[_0x4e28('0x56')],qs[_0x4e28('0x5b')](_0x391066[_0x4e28('0x43')]['fields']));_0x4ab3d1[_0x4e28('0x49')]=_0x4ab3d1[_0x4e28('0x49')]['length']?_0x4ab3d1['attributes']:_0x7e330a[_0x4e28('0x56')];_0x4ab3d1['order']=qs[_0x4e28('0xd4')](_0x391066[_0x4e28('0x43')][_0x4e28('0xd4')]);_0x4ab3d1[_0x4e28('0xd5')]=qs['filters'](_[_0x4e28('0xe5')](_0x391066[_0x4e28('0x43')],_0x7e330a[_0x4e28('0x59')]));if(_0x391066[_0x4e28('0x43')][_0x4e28('0x3f')]){_0x4ab3d1['where']=_[_0x4e28('0xd6')](_0x4ab3d1[_0x4e28('0xd5')],{'$or':_['map'](_0x4ab3d1['attributes'],function(_0x15b24a){var _0xfcc2f2={};_0xfcc2f2[_0x15b24a]={'$like':'%'+_0x391066['query'][_0x4e28('0x3f')]+'%'};return _0xfcc2f2;})});}_0x4ab3d1['model']=db[_0x4e28('0x42')];_0x4ab3d1['as']=_0x4e28('0x2e');_0x4ab3d1=_['merge']({},_0x4ab3d1,_0x391066['options']);return _0x187645[_0x4e28('0x101')]({'include':[_0x4ab3d1]});}})[_0x4e28('0x14')](function(_0x2ed890){if(_0x2ed890){var _0xfb8d01={},_0x508960=[];for(var _0x46009e=0x0;_0x46009e<_0x2ed890['length'];_0x46009e+=0x1){for(var _0x204c70=0x0,_0x2260f3;_0x204c70<_0x2ed890[_0x46009e]['Agents'][_0x4e28('0x4d')];_0x204c70+=0x1){_0x2260f3=_0x2ed890[_0x46009e][_0x4e28('0x2e')][_0x204c70]['get']({'plain':!![]});_0xfb8d01[_0x2260f3['id']]=_0x2260f3;}}_0xfb8d01=_[_0x4e28('0x135')](_0xfb8d01);for(var _0x2822e6=qs['offset'](_0x391066[_0x4e28('0x43')]['offset']);_0x2822e6<_0xfb8d01[_0x4e28('0x4d')]&&_0x508960[_0x4e28('0x4d')]=_0x456208[_0x5f3d('0x53')]){throw new Error(_0x5f3d('0x54'));}})['then'](function(){if(_0x33ce77){return db[_0x5f3d('0x2b')][_0x5f3d('0x48')]({'where':{'membername':_0x33ce77[_0x5f3d('0x27')]},'individualHooks':!![]});}})[_0x5f3d('0x20')](function(){if(_0x33ce77){return _0x33ce77[_0x5f3d('0x55')]({'raw':!![]});}})[_0x5f3d('0x20')](function(_0x5bd674){if(_0x33ce77){if(_0x5bd674){var _0x5e135a=[];_0x2a30f1=_0x5bd674;if(_0x2a30f1[_0x5f3d('0x2f')]){for(var _0x4039ae=0x0;_0x4039ae<_0x2a30f1[_0x5f3d('0x2f')];_0x4039ae++){_0x5e135a[_0x5f3d('0x49')](db['UserVoiceQueueRt'][_0x5f3d('0x56')]({'membername':_0x33ce77[_0x5f3d('0x27')],'UserId':_0x33ce77['id'],'queue_name':_0x2a30f1[_0x4039ae][_0x5f3d('0x27')],'VoiceQueueId':_0x2a30f1[_0x4039ae]['id'],'interface':_0x57a592,'paused':_0x33ce77[_0x5f3d('0x4e')]||![],'penalty':_0x2a30f1[_0x4039ae][_0x5f3d('0x57')]||0x0}));}return BPromise[_0x5f3d('0x46')](_0x5e135a);}}}})[_0x5f3d('0x20')](function(){if(_0x33ce77){return db[_0x5f3d('0x2c')]['findAll']({'where':{'membername':_0x33ce77[_0x5f3d('0x27')],'exitAt':null}});}})[_0x5f3d('0x20')](function(_0x27ca04){if(_0x33ce77){if(_0x27ca04&&_0x27ca04[_0x5f3d('0x2f')]){var _0x131563=[];_0x27ca04[_0x5f3d('0x32')](function(_0xdf506){_0x131563['push'](_0xdf506[_0x5f3d('0x39')]({'exitAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e'))}));});return BPromise[_0x5f3d('0x46')](_0x131563);}}})[_0x5f3d('0x20')](function(_0x3be4cd){if(_0x33ce77){var _0xe563ea=[];var _0x44d079=[];var _0x440afe=utils[_0x5f3d('0x31')]();var _0x11d10e={'membername':_0x33ce77[_0x5f3d('0x27')],'interface':_0x57a592,'enterAt':moment()['format'](_0x5f3d('0x2e')),'role':_0x33ce77[_0x5f3d('0x28')],'internal':_0x33ce77['internal']};_0x440afe[_0x5f3d('0x32')](function(_0x4f23c4){_0xe563ea[_0x5f3d('0x49')](_[_0x5f3d('0x58')]({'channel':_0x4f23c4,'type':_0x5f3d('0x59'),'data1':_0x5f3d('0x5a'),'data2':_0x57a592},_0x11d10e));if(_0x33ce77[_0x5f3d('0x4e')]){_0x44d079[_0x5f3d('0x49')](_[_0x5f3d('0x58')]({'channel':_0x4f23c4,'type':'PAUSE','data1':'LOGININPAUSE'},_0x11d10e));}});return db[_0x5f3d('0x2c')]['bulkCreate'](_0xe563ea[_0x5f3d('0x5b')](_0x44d079),{'individualHooks':!![]});}})['then'](function(){if(_0x33ce77){return _0x33ce77['update']({'online':!![],'lastLoginAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e')),'voicePause':_0x33ce77[_0x5f3d('0x4e')]||![],'mailPause':_0x33ce77[_0x5f3d('0x4e')]||![],'chatPause':_0x33ce77[_0x5f3d('0x4e')]||![],'faxPause':_0x33ce77[_0x5f3d('0x4e')]||![],'smsPause':_0x33ce77[_0x5f3d('0x4e')]||![],'openchannelPause':_0x33ce77[_0x5f3d('0x4e')]||![],'pauseType':_0x33ce77[_0x5f3d('0x4e')]?_0x5f3d('0x5c'):null,'lastPauseAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e')),'interface':_0x57a592});}})[_0x5f3d('0x20')](function(_0x2a4525){_0x257594(_0x2a4525);})[_0x5f3d('0x22')](function(_0x5e9502){_0xf99e00(_0x2e6b72[_0x5f3d('0x14')](0x1f4,_0x5e9502[_0x5f3d('0x16')]));});});}; \ No newline at end of file +var _0x5cee=['UserVoiceQueueRt','update','findAll','name','PAUSE','length','format','updateAttributes','forEach','push','SIP/%s','type','internal','body','uniqueid','MemberReport','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','voice','YYYY-MM-DD\x20HH:mm:ss','system','mail','chat','fax','sms','openchannel','whatsapp','set','all','LogoutUser','LoginUser','phone','loginInPause','count','../../config/license/util','getLicense','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','bulkCreate','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetUser','User','options','raw','where','attributes','limit','include','model','map','find','then','ShowUser','PauseUser','role','interface'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5cee,0x1ae));var _0xe5ce=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x5cee[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0xe5ce('0x0'));var util=require(_0xe5ce('0x1'));var moment=require(_0xe5ce('0x2'));var BPromise=require(_0xe5ce('0x3'));var rs=require(_0xe5ce('0x4'));var fs=require('fs');var Redis=require(_0xe5ce('0x5'));var db=require(_0xe5ce('0x6'))['db'];var utils=require(_0xe5ce('0x7'));var logger=require(_0xe5ce('0x8'))(_0xe5ce('0x9'));var config=require(_0xe5ce('0xa'));var jayson=require(_0xe5ce('0xb'));var client=jayson[_0xe5ce('0xc')][_0xe5ce('0xd')]({'port':0x232a});config[_0xe5ce('0xe')]=_['defaults'](config[_0xe5ce('0xe')],{'host':_0xe5ce('0xf'),'port':0x18eb});var socket=require(_0xe5ce('0x10'))(new Redis(config[_0xe5ce('0xe')]));require('./user.socket')[_0xe5ce('0x11')](socket);function respondWithRpcPromise(_0x5ee37a,_0x4538bd,_0x504d93){return new BPromise(function(_0x185ef2,_0x1bfb02){return client[_0xe5ce('0x12')](_0x5ee37a,_0x504d93)['then'](function(_0x267d9e){logger['info'](_0xe5ce('0x13'),_0x4538bd,_0xe5ce('0x14'));logger[_0xe5ce('0x15')]('User,\x20%s,\x20%s,\x20%s',_0x4538bd,_0xe5ce('0x14'),JSON[_0xe5ce('0x16')](_0x267d9e));if(_0x267d9e[_0xe5ce('0x17')]){if(_0x267d9e['error'][_0xe5ce('0x18')]===0x1f4){logger[_0xe5ce('0x17')](_0xe5ce('0x13'),_0x4538bd,_0x267d9e[_0xe5ce('0x17')][_0xe5ce('0x19')]);return _0x1bfb02(_0x267d9e[_0xe5ce('0x17')][_0xe5ce('0x19')]);}logger['error'](_0xe5ce('0x13'),_0x4538bd,_0x267d9e[_0xe5ce('0x17')][_0xe5ce('0x19')]);return _0x185ef2(_0x267d9e[_0xe5ce('0x17')][_0xe5ce('0x19')]);}else{logger[_0xe5ce('0x1a')](_0xe5ce('0x13'),_0x4538bd,_0xe5ce('0x14'));_0x185ef2(_0x267d9e[_0xe5ce('0x1b')][_0xe5ce('0x19')]);}})[_0xe5ce('0x1c')](function(_0x10961f){logger[_0xe5ce('0x17')](_0xe5ce('0x13'),_0x4538bd,_0x10961f);_0x1bfb02(_0x10961f);});});}exports[_0xe5ce('0x1d')]=function(_0x297202){var _0x2df293=this;return new Promise(function(_0x5ba38f,_0x1c4706){return db[_0xe5ce('0x1e')]['findAll']({'raw':_0x297202[_0xe5ce('0x1f')]?_0x297202[_0xe5ce('0x1f')][_0xe5ce('0x20')]===undefined?!![]:![]:!![],'where':_0x297202['options']?_0x297202['options'][_0xe5ce('0x21')]||null:null,'attributes':_0x297202['options']?_0x297202['options'][_0xe5ce('0x22')]||null:null,'limit':_0x297202[_0xe5ce('0x1f')]?_0x297202[_0xe5ce('0x1f')][_0xe5ce('0x23')]||null:null,'include':_0x297202['options']?_0x297202['options'][_0xe5ce('0x24')]?_['map'](_0x297202['options'][_0xe5ce('0x24')],function(_0x533672){return{'model':db[_0x533672[_0xe5ce('0x25')]],'as':_0x533672['as'],'attributes':_0x533672['attributes'],'include':_0x533672['include']?_[_0xe5ce('0x26')](_0x533672[_0xe5ce('0x24')],function(_0x2a1e32){return{'model':db[_0x2a1e32['model']],'as':_0x2a1e32['as'],'attributes':_0x2a1e32[_0xe5ce('0x22')],'include':_0x2a1e32['include']?_[_0xe5ce('0x26')](_0x2a1e32[_0xe5ce('0x24')],function(_0x5d3a99){return{'model':db[_0x5d3a99[_0xe5ce('0x25')]],'as':_0x5d3a99['as'],'attributes':_0x5d3a99[_0xe5ce('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a80d0){logger['info'](_0xe5ce('0x1d'),_0x297202);logger[_0xe5ce('0x15')]('GetUser',_0x297202,JSON[_0xe5ce('0x16')](_0x1a80d0));_0x5ba38f(_0x1a80d0);})[_0xe5ce('0x1c')](function(_0x28eb23){logger[_0xe5ce('0x17')](_0xe5ce('0x1d'),_0x28eb23['message'],_0x297202);_0x1c4706(_0x2df293['error'](0x1f4,_0x28eb23['message']));});});};exports['ShowUser']=function(_0x3c2c21){var _0x27fd7f=this;return new Promise(function(_0x496f65,_0xa85f5f){return db[_0xe5ce('0x1e')][_0xe5ce('0x27')]({'raw':_0x3c2c21[_0xe5ce('0x1f')]?_0x3c2c21[_0xe5ce('0x1f')][_0xe5ce('0x20')]===undefined?!![]:![]:!![],'where':_0x3c2c21[_0xe5ce('0x1f')]?_0x3c2c21[_0xe5ce('0x1f')][_0xe5ce('0x21')]||null:null,'attributes':_0x3c2c21[_0xe5ce('0x1f')]?_0x3c2c21[_0xe5ce('0x1f')][_0xe5ce('0x22')]||null:null,'include':_0x3c2c21[_0xe5ce('0x1f')]?_0x3c2c21[_0xe5ce('0x1f')][_0xe5ce('0x24')]?_[_0xe5ce('0x26')](_0x3c2c21['options']['include'],function(_0x2bd232){return{'model':db[_0x2bd232[_0xe5ce('0x25')]],'as':_0x2bd232['as'],'attributes':_0x2bd232['attributes'],'include':_0x2bd232[_0xe5ce('0x24')]?_['map'](_0x2bd232[_0xe5ce('0x24')],function(_0x3c55aa){return{'model':db[_0x3c55aa[_0xe5ce('0x25')]],'as':_0x3c55aa['as'],'attributes':_0x3c55aa[_0xe5ce('0x22')],'include':_0x3c55aa[_0xe5ce('0x24')]?_['map'](_0x3c55aa['include'],function(_0x1c59eb){return{'model':db[_0x1c59eb[_0xe5ce('0x25')]],'as':_0x1c59eb['as'],'attributes':_0x1c59eb['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5ce('0x28')](function(_0x49f7c3){logger[_0xe5ce('0x1a')](_0xe5ce('0x29'),_0x3c2c21);logger[_0xe5ce('0x15')](_0xe5ce('0x29'),_0x3c2c21,JSON['stringify'](_0x49f7c3));_0x496f65(_0x49f7c3);})[_0xe5ce('0x1c')](function(_0x4d7bbe){logger[_0xe5ce('0x17')](_0xe5ce('0x29'),_0x4d7bbe[_0xe5ce('0x19')],_0x3c2c21);_0xa85f5f(_0x27fd7f[_0xe5ce('0x17')](0x1f4,_0x4d7bbe['message']));});});};exports[_0xe5ce('0x2a')]=function(_0x40bc52){var _0x592152=this;return new Promise(function(_0x44bfb0,_0x58ee2c){var _0x45b260;return db['User'][_0xe5ce('0x27')]({'where':_0x40bc52[_0xe5ce('0x1f')]['where']||{},'attributes':['id','name',_0xe5ce('0x2b'),'internal',_0xe5ce('0x2c')]})['then'](function(_0x271a5f){if(_0x271a5f){_0x45b260=_0x271a5f;return db[_0xe5ce('0x2d')][_0xe5ce('0x2e')]({'paused':0x1},{'where':{'UserId':_0x45b260['id']},'individualHooks':!![]});}})[_0xe5ce('0x28')](function(){if(_0x45b260){return db['MemberReport'][_0xe5ce('0x2f')]({'where':{'membername':_0x45b260[_0xe5ce('0x30')],'type':_0xe5ce('0x31'),'exitAt':null}});}})[_0xe5ce('0x28')](function(_0x38c867){if(_0x45b260){if(_0x38c867&&_0x38c867[_0xe5ce('0x32')]){var _0x160cb0=moment()[_0xe5ce('0x33')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x362466=0x0,_0x2403a7=_0x38c867['length'];_0x362466<_0x2403a7;_0x362466++){_0x38c867[_0x362466][_0xe5ce('0x34')]({'exitAt':_0x160cb0});}}}})['then'](function(){if(_0x45b260){var _0x5af443=[];var _0x468819=utils['getChannels']();_0x468819[_0xe5ce('0x35')](function(_0x5b66c7){_0x5af443[_0xe5ce('0x36')]({'channel':_0x5b66c7,'membername':_0x45b260[_0xe5ce('0x30')],'interface':_['isNil'](_0x45b260['interface'])?util[_0xe5ce('0x33')](_0xe5ce('0x37'),_0x45b260[_0xe5ce('0x30')]):_0x45b260['interface'],'type':_0xe5ce('0x31'),'enterAt':moment()[_0xe5ce('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x40bc52['body'][_0xe5ce('0x38')]||'DEFAULT\x20PAUSE','role':_0x45b260['role'],'internal':_0x45b260[_0xe5ce('0x39')],'uniqueid':_0x40bc52[_0xe5ce('0x3a')][_0xe5ce('0x3b')]||null});});return db[_0xe5ce('0x3c')]['bulkCreate'](_0x5af443,{'individualHooks':!![]});}})[_0xe5ce('0x28')](function(){if(_0x45b260){return _0x45b260[_0xe5ce('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x40bc52[_0xe5ce('0x3a')]['type']||_0xe5ce('0x3d'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xe5ce('0x28')](function(_0x23981d){_0x44bfb0(_0x23981d);})[_0xe5ce('0x1c')](function(_0x2fb4d3){_0x58ee2c(_0x592152[_0xe5ce('0x17')](0x1f4,_0x2fb4d3['message']));});});};exports[_0xe5ce('0x3e')]=function(_0x49ea09){var _0x3cdf47=this;return new Promise(function(_0x1a92bf,_0x2fca06){var _0x44b89a;return db['User'][_0xe5ce('0x3f')]({'where':_0x49ea09[_0xe5ce('0x1f')][_0xe5ce('0x21')]||{},'attributes':['id','name']})['then'](function(_0x4846a9){if(_0x4846a9){_0x44b89a=_0x4846a9;if(_0x49ea09['body'][_0xe5ce('0x40')]&&!utils[_0xe5ce('0x41')](_0x49ea09['body']['channel'])){throw new Error('Unknown\x20channel');}switch(_0x49ea09[_0xe5ce('0x3a')]['channel']){case _0xe5ce('0x42'):return db['UserVoiceQueueRt'][_0xe5ce('0x2e')]({'paused':0x0},{'where':{'UserId':_0x44b89a['id']}})[_0xe5ce('0x28')](function(){return db['MemberReport']['find']({'where':{'channel':_0x49ea09[_0xe5ce('0x3a')][_0xe5ce('0x40')],'membername':_0x44b89a[_0xe5ce('0x30')],'type':_0xe5ce('0x31'),'exitAt':null}});})[_0xe5ce('0x28')](function(_0x3bb673){if(_0x3bb673){return _0x3bb673[_0xe5ce('0x2e')]({'exitAt':moment()[_0xe5ce('0x33')](_0xe5ce('0x43')),'data2':_0xe5ce('0x44')},{'individualHooks':!![]});}return null;})[_0xe5ce('0x28')](function(){return _0x44b89a[_0xe5ce('0x2e')]({'voicePause':![]});});case _0xe5ce('0x45'):case _0xe5ce('0x46'):case _0xe5ce('0x47'):case _0xe5ce('0x48'):case _0xe5ce('0x49'):case _0xe5ce('0x4a'):return db[_0xe5ce('0x3c')][_0xe5ce('0x27')]({'where':{'channel':_0x49ea09[_0xe5ce('0x3a')]['channel'],'membername':_0x44b89a['name'],'type':_0xe5ce('0x31'),'exitAt':null}})[_0xe5ce('0x28')](function(_0x27185c){return _0x27185c[_0xe5ce('0x2e')]({'exitAt':moment()[_0xe5ce('0x33')](_0xe5ce('0x43')),'data2':'system'},{'individualHooks':!![]});})[_0xe5ce('0x28')](function(){var _0x1f4a31={};_[_0xe5ce('0x4b')](_0x1f4a31,util[_0xe5ce('0x33')]('%s%s',_0x49ea09[_0xe5ce('0x3a')][_0xe5ce('0x40')],'Pause'),![]);return _0x44b89a[_0xe5ce('0x2e')](_0x1f4a31);});default:return db[_0xe5ce('0x2d')][_0xe5ce('0x2e')]({'paused':0x0},{'where':{'UserId':_0x44b89a['id']}})[_0xe5ce('0x28')](function(){return db['MemberReport'][_0xe5ce('0x2f')]({'where':{'membername':_0x44b89a[_0xe5ce('0x30')],'type':'PAUSE','exitAt':null}});})[_0xe5ce('0x28')](function(_0x43909c){var _0x2230e3=[];_0x43909c[_0xe5ce('0x35')](function(_0x2d9560){_0x2230e3[_0xe5ce('0x36')](_0x2d9560['update']({'exitAt':moment()[_0xe5ce('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xe5ce('0x44')}));});return BPromise[_0xe5ce('0x4c')](_0x2230e3);})['then'](function(){return _0x44b89a[_0xe5ce('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xe5ce('0x28')](function(_0x5addfc){_0x1a92bf(_0x5addfc);})[_0xe5ce('0x1c')](function(_0x14e207){_0x2fca06(_0x3cdf47[_0xe5ce('0x17')](0x1f4,_0x14e207[_0xe5ce('0x19')]));});});};exports[_0xe5ce('0x4d')]=function(_0x1dc7d7){var _0x4718ff=this;return new Promise(function(_0x408f49,_0x35e5fe){var _0x100c57;return db[_0xe5ce('0x1e')][_0xe5ce('0x3f')]({'where':_0x1dc7d7[_0xe5ce('0x1f')]['where']||{},'attributes':['id',_0xe5ce('0x30')]})[_0xe5ce('0x28')](function(_0x2ed32c){if(_0x2ed32c){_0x100c57=_0x2ed32c;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x100c57[_0xe5ce('0x30')]},'individualHooks':!![]});}})[_0xe5ce('0x28')](function(){if(_0x100c57){return db['MemberReport'][_0xe5ce('0x2f')]({'where':{'membername':_0x100c57[_0xe5ce('0x30')],'exitAt':null}});}})['then'](function(_0x29542b){if(_0x100c57){if(_0x29542b&&_0x29542b['length']){var _0x1fd039=[];_0x29542b[_0xe5ce('0x35')](function(_0x495ed8){_0x1fd039[_0xe5ce('0x36')](_0x495ed8['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1fd039);}}})['then'](function(){if(_0x100c57){return _0x100c57['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe5ce('0x28')](function(_0x2e5f53){_0x408f49(_0x2e5f53);})['catch'](function(_0x55f3bf){_0x35e5fe(_0x4718ff['error'](0x1f4,_0x55f3bf['message']));});});};exports[_0xe5ce('0x4e')]=function(_0x4874f1){var _0x516290=this;return new Promise(function(_0x1aa099,_0x192150){var _0x2a58e8;var _0x13cdca;var _0x2df3a8;var _0x1b825e;return db[_0xe5ce('0x1e')]['findOne']({'where':_0x4874f1[_0xe5ce('0x1f')][_0xe5ce('0x21')]||{},'attributes':['id',_0xe5ce('0x30'),_0xe5ce('0x2b'),'mobile',_0xe5ce('0x4f'),_0xe5ce('0x39'),_0xe5ce('0x50'),_0xe5ce('0x2c')]})[_0xe5ce('0x28')](function(_0x2ba2e3){if(_0x2ba2e3){_0x2a58e8=_0x2ba2e3;_0x1b825e=_0x4874f1[_0xe5ce('0x3a')][_0xe5ce('0x2c')]?_0x4874f1[_0xe5ce('0x3a')][_0xe5ce('0x2c')]:util[_0xe5ce('0x33')](_0xe5ce('0x37'),_0x2a58e8[_0xe5ce('0x30')]);return db[_0xe5ce('0x1e')][_0xe5ce('0x51')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2a58e8['id']}}});}})[_0xe5ce('0x28')](function(_0x313ab1){if(_0x313ab1){_0x2df3a8=_0x313ab1;return require(_0xe5ce('0x52'))[_0xe5ce('0x53')]();}})[_0xe5ce('0x28')](function(_0x268449){if(_0x268449&&_0x268449[_0xe5ce('0x54')]&&_0x2df3a8>=_0x268449[_0xe5ce('0x54')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xe5ce('0x28')](function(){if(_0x2a58e8){return db[_0xe5ce('0x2d')][_0xe5ce('0x55')]({'where':{'membername':_0x2a58e8[_0xe5ce('0x30')]},'individualHooks':!![]});}})['then'](function(){if(_0x2a58e8){return _0x2a58e8[_0xe5ce('0x56')]({'raw':!![]});}})[_0xe5ce('0x28')](function(_0x48ce0d){if(_0x2a58e8){if(_0x48ce0d){var _0x5af7ea=[];_0x13cdca=_0x48ce0d;if(_0x13cdca[_0xe5ce('0x32')]){for(var _0x3e727e=0x0;_0x3e727e<_0x13cdca[_0xe5ce('0x32')];_0x3e727e++){_0x5af7ea[_0xe5ce('0x36')](db[_0xe5ce('0x2d')][_0xe5ce('0x57')]({'membername':_0x2a58e8[_0xe5ce('0x30')],'UserId':_0x2a58e8['id'],'queue_name':_0x13cdca[_0x3e727e][_0xe5ce('0x30')],'VoiceQueueId':_0x13cdca[_0x3e727e]['id'],'interface':_0x1b825e,'paused':_0x2a58e8['loginInPause']||![],'penalty':_0x13cdca[_0x3e727e][_0xe5ce('0x58')]||0x0}));}return BPromise[_0xe5ce('0x4c')](_0x5af7ea);}}}})[_0xe5ce('0x28')](function(){if(_0x2a58e8){return db[_0xe5ce('0x3c')]['findAll']({'where':{'membername':_0x2a58e8[_0xe5ce('0x30')],'exitAt':null}});}})['then'](function(_0x3cdf30){if(_0x2a58e8){if(_0x3cdf30&&_0x3cdf30[_0xe5ce('0x32')]){var _0x5a261c=[];_0x3cdf30[_0xe5ce('0x35')](function(_0x44bd76){_0x5a261c[_0xe5ce('0x36')](_0x44bd76[_0xe5ce('0x2e')]({'exitAt':moment()[_0xe5ce('0x33')](_0xe5ce('0x43'))}));});return BPromise[_0xe5ce('0x4c')](_0x5a261c);}}})[_0xe5ce('0x28')](function(_0x4ac0d9){if(_0x2a58e8){var _0x1e82ba=[];var _0x5e982a=[];var _0x3fb72f=utils[_0xe5ce('0x59')]();var _0x5590c6={'membername':_0x2a58e8['name'],'interface':_0x1b825e,'enterAt':moment()[_0xe5ce('0x33')](_0xe5ce('0x43')),'role':_0x2a58e8[_0xe5ce('0x2b')],'internal':_0x2a58e8[_0xe5ce('0x39')]};_0x3fb72f[_0xe5ce('0x35')](function(_0xc832e1){_0x1e82ba['push'](_[_0xe5ce('0x5a')]({'channel':_0xc832e1,'type':_0xe5ce('0x5b'),'data1':_0xe5ce('0x5c'),'data2':_0x1b825e},_0x5590c6));if(_0x2a58e8['loginInPause']){_0x5e982a[_0xe5ce('0x36')](_[_0xe5ce('0x5a')]({'channel':_0xc832e1,'type':_0xe5ce('0x31'),'data1':'LOGININPAUSE'},_0x5590c6));}});return db['MemberReport'][_0xe5ce('0x5d')](_0x1e82ba['concat'](_0x5e982a),{'individualHooks':!![]});}})[_0xe5ce('0x28')](function(){if(_0x2a58e8){return _0x2a58e8[_0xe5ce('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xe5ce('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2a58e8[_0xe5ce('0x50')]||![],'mailPause':_0x2a58e8['loginInPause']||![],'chatPause':_0x2a58e8[_0xe5ce('0x50')]||![],'faxPause':_0x2a58e8[_0xe5ce('0x50')]||![],'smsPause':_0x2a58e8[_0xe5ce('0x50')]||![],'openchannelPause':_0x2a58e8[_0xe5ce('0x50')]||![],'pauseType':_0x2a58e8[_0xe5ce('0x50')]?_0xe5ce('0x5e'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x1b825e});}})[_0xe5ce('0x28')](function(_0x401322){_0x1aa099(_0x401322);})[_0xe5ce('0x1c')](function(_0x5e557e){_0x192150(_0x516290[_0xe5ce('0x17')](0x1f4,_0x5e557e[_0xe5ce('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index eb69231..b1e5231 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 _0x4cb5=['update','register','length','user:','./user.events','save','remove'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x4cb5,0x11c));var _0x54cb=function(_0x5a65da,_0x5e8d5d){_0x5a65da=_0x5a65da-0x0;var _0x3d01e3=_0x4cb5[_0x5a65da];return _0x3d01e3;};'use strict';var UserEvents=require(_0x54cb('0x0'));var events=[_0x54cb('0x1'),_0x54cb('0x2'),_0x54cb('0x3')];function createListener(_0x3325ff,_0x2537c3){return function(_0x56e058){_0x2537c3['emit'](_0x3325ff,_0x56e058);};}function removeListener(_0x5c8c4d,_0x11a9d5){return function(){UserEvents['removeListener'](_0x5c8c4d,_0x11a9d5);};}exports[_0x54cb('0x4')]=function(_0xcedf5){for(var _0x4c4360=0x0,_0x1b3171=events[_0x54cb('0x5')];_0x4c4360<_0x1b3171;_0x4c4360++){var _0x4ed3c6=events[_0x4c4360];var _0x5edcb2=createListener(_0x54cb('0x6')+_0x4ed3c6,_0xcedf5);UserEvents['on'](_0x4ed3c6,_0x5edcb2);}}; \ No newline at end of file +var _0x1293=['user:','./user.events','save','update','emit','removeListener','register','length'];(function(_0x45301a,_0x7f8d6f){var _0x434ab8=function(_0x268997){while(--_0x268997){_0x45301a['push'](_0x45301a['shift']());}};_0x434ab8(++_0x7f8d6f);}(_0x1293,0x199));var _0x3129=function(_0x101241,_0x261d72){_0x101241=_0x101241-0x0;var _0x157874=_0x1293[_0x101241];return _0x157874;};'use strict';var UserEvents=require(_0x3129('0x0'));var events=[_0x3129('0x1'),'remove',_0x3129('0x2')];function createListener(_0x5c5bd2,_0x3368d7){return function(_0x48f875){_0x3368d7[_0x3129('0x3')](_0x5c5bd2,_0x48f875);};}function removeListener(_0x2435ca,_0x52d674){return function(){UserEvents[_0x3129('0x4')](_0x2435ca,_0x52d674);};}exports[_0x3129('0x5')]=function(_0x208d7a){for(var _0xc4b211=0x0,_0x420e54=events[_0x3129('0x6')];_0xc4b211<_0x420e54;_0xc4b211++){var _0x39d5f2=events[_0xc4b211];var _0x54b017=createListener(_0x3129('0x7')+_0x39d5f2,_0x208d7a);UserEvents['on'](_0x39d5f2,_0x54b017);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e137ec0..574f88b 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(_0x40fcfb,_0xfd7c59){var _0x4095cf=function(_0x5037cb){while(--_0x5037cb){_0x40fcfb['push'](_0x40fcfb['shift']());}};_0x4095cf(++_0xfd7c59);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x52cb4a,_0x217996){var _0x2d84e7=function(_0x1ecdb2){while(--_0x1ecdb2){_0x52cb4a['push'](_0x52cb4a['shift']());}};_0x2d84e7(++_0x217996);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 82516c1..5e4dbbf 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0404=['INTEGER','exports'];(function(_0x2d340d,_0x35a2f6){var _0x38932a=function(_0x425276){while(--_0x425276){_0x2d340d['push'](_0x2d340d['shift']());}};_0x38932a(++_0x35a2f6);}(_0x0404,0x123));var _0x4040=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x0404[_0xbe40ad];return _0x50fac9;};'use strict';var Sequelize=require('sequelize');module[_0x4040('0x0')]={'penalty':{'type':Sequelize[_0x4040('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x530a=['INTEGER','exports'];(function(_0x1240af,_0x2d909a){var _0x5a88bf=function(_0x3ceda2){while(--_0x3ceda2){_0x1240af['push'](_0x1240af['shift']());}};_0x5a88bf(++_0x2d909a);}(_0x530a,0x81));var _0xa530=function(_0x544087,_0x16bd93){_0x544087=_0x544087-0x0;var _0x4a3ee3=_0x530a[_0x544087];return _0x4a3ee3;};'use strict';var Sequelize=require('sequelize');module[_0xa530('0x0')]={'penalty':{'type':Sequelize[_0xa530('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 192ee1d..eca7639 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 _0x8016=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','api'];(function(_0x28d936,_0x5d98a6){var _0x569200=function(_0x569e00){while(--_0x569e00){_0x28d936['push'](_0x28d936['shift']());}};_0x569200(++_0x5d98a6);}(_0x8016,0x19f));var _0x6801=function(_0x3c3ec7,_0x309339){_0x3c3ec7=_0x3c3ec7-0x0;var _0x23e52c=_0x8016[_0x3c3ec7];return _0x23e52c;};'use strict';var _=require(_0x6801('0x0'));var util=require(_0x6801('0x1'));var logger=require('../../config/logger')(_0x6801('0x2'));var moment=require('moment');var BPromise=require(_0x6801('0x3'));var rp=require(_0x6801('0x4'));var fs=require('fs');var path=require(_0x6801('0x5'));var rimraf=require(_0x6801('0x6'));var config=require(_0x6801('0x7'));var attributes=require(_0x6801('0x8'));module['exports']=function(_0x3533ab,_0x49cfd0){return _0x3533ab[_0x6801('0x9')]('UserChatQueue',attributes,{'tableName':_0x6801('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8586=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x404767,_0x318248){var _0x14ad1b=function(_0x641ec3){while(--_0x641ec3){_0x404767['push'](_0x404767['shift']());}};_0x14ad1b(++_0x318248);}(_0x8586,0x12b));var _0x6858=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8586[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x6858('0x0'));var util=require(_0x6858('0x1'));var logger=require(_0x6858('0x2'))(_0x6858('0x3'));var moment=require('moment');var BPromise=require(_0x6858('0x4'));var rp=require(_0x6858('0x5'));var fs=require('fs');var path=require(_0x6858('0x6'));var rimraf=require(_0x6858('0x7'));var config=require('../../config/environment');var attributes=require(_0x6858('0x8'));module[_0x6858('0x9')]=function(_0x4cb65f,_0x335840){return _0x4cb65f[_0x6858('0xa')](_0x6858('0xb'),attributes,{'tableName':_0x6858('0xc'),'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 438d1e4..8a8b2ab 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 _0xbef7=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x4dde94,_0x52b903){var _0x30acf7=function(_0x2d0ead){while(--_0x2d0ead){_0x4dde94['push'](_0x4dde94['shift']());}};_0x30acf7(++_0x52b903);}(_0xbef7,0xd8));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7bef('0x0'));var util=require('util');var moment=require(_0x7bef('0x1'));var BPromise=require(_0x7bef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bef('0x3'));var db=require(_0x7bef('0x4'))['db'];var utils=require(_0x7bef('0x5'));var logger=require(_0x7bef('0x6'))(_0x7bef('0x7'));var config=require(_0x7bef('0x8'));var jayson=require(_0x7bef('0x9'));var client=jayson['client'][_0x7bef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380a09,_0x143058,_0x201fb4){return new BPromise(function(_0xe24da3,_0x5c0cd4){return client['request'](_0x380a09,_0x201fb4)[_0x7bef('0xb')](function(_0x289737){logger[_0x7bef('0xc')](_0x7bef('0xd'),_0x143058,_0x7bef('0xe'));logger['debug'](_0x7bef('0xf'),_0x143058,_0x7bef('0xe'),JSON['stringify'](_0x289737));if(_0x289737['error']){if(_0x289737[_0x7bef('0x10')]['code']===0x1f4){logger[_0x7bef('0x10')](_0x7bef('0xd'),_0x143058,_0x289737[_0x7bef('0x10')]['message']);return _0x5c0cd4(_0x289737['error'][_0x7bef('0x11')]);}logger[_0x7bef('0x10')](_0x7bef('0xd'),_0x143058,_0x289737['error'][_0x7bef('0x11')]);return _0xe24da3(_0x289737['error'][_0x7bef('0x11')]);}else{logger[_0x7bef('0xc')](_0x7bef('0xd'),_0x143058,_0x7bef('0xe'));_0xe24da3(_0x289737['result'][_0x7bef('0x11')]);}})[_0x7bef('0x12')](function(_0x328289){logger['error'](_0x7bef('0xd'),_0x143058,_0x328289);_0x5c0cd4(_0x328289);});});} \ No newline at end of file +var _0x2629=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util'];(function(_0x1dee11,_0x191420){var _0x3485dd=function(_0x17df52){while(--_0x17df52){_0x1dee11['push'](_0x1dee11['shift']());}};_0x3485dd(++_0x191420);}(_0x2629,0x124));var _0x9262=function(_0x496c0c,_0x1497aa){_0x496c0c=_0x496c0c-0x0;var _0x2f673b=_0x2629[_0x496c0c];return _0x2f673b;};'use strict';var _=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9262('0x2'));var fs=require('fs');var Redis=require(_0x9262('0x3'));var db=require(_0x9262('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9262('0x5'));var config=require(_0x9262('0x6'));var jayson=require(_0x9262('0x7'));var client=jayson[_0x9262('0x8')][_0x9262('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3954d6,_0x56b226,_0x10808f){return new BPromise(function(_0x4b9339,_0x479e2b){return client[_0x9262('0xa')](_0x3954d6,_0x10808f)[_0x9262('0xb')](function(_0x5b846f){logger[_0x9262('0xc')](_0x9262('0xd'),_0x56b226,'request\x20sent');logger[_0x9262('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x56b226,'request\x20sent',JSON[_0x9262('0xf')](_0x5b846f));if(_0x5b846f['error']){if(_0x5b846f['error']['code']===0x1f4){logger[_0x9262('0x10')](_0x9262('0xd'),_0x56b226,_0x5b846f['error'][_0x9262('0x11')]);return _0x479e2b(_0x5b846f['error'][_0x9262('0x11')]);}logger[_0x9262('0x10')](_0x9262('0xd'),_0x56b226,_0x5b846f[_0x9262('0x10')][_0x9262('0x11')]);return _0x4b9339(_0x5b846f[_0x9262('0x10')][_0x9262('0x11')]);}else{logger[_0x9262('0xc')](_0x9262('0xd'),_0x56b226,_0x9262('0x12'));_0x4b9339(_0x5b846f[_0x9262('0x13')]['message']);}})[_0x9262('0x14')](function(_0x4c31ba){logger['error'](_0x9262('0xd'),_0x56b226,_0x4c31ba);_0x479e2b(_0x4c31ba);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 518796a..897b69d 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x411f5c,_0xc2ecc9){var _0x5ef722=function(_0x35b0fb){while(--_0x35b0fb){_0x411f5c['push'](_0x411f5c['shift']());}};_0x5ef722(++_0xc2ecc9);}(_0x70e0,0x17b));var _0x070e=function(_0x109d39,_0x54bf3c){_0x109d39=_0x109d39-0x0;var _0x2b17b9=_0x70e0[_0x109d39];return _0x2b17b9;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x38e177,_0x59ec9f){var _0x1faf15=function(_0x4cf149){while(--_0x4cf149){_0x38e177['push'](_0x38e177['shift']());}};_0x1faf15(++_0x59ec9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 b0b775a..d608ae6 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 _0x5d81=['exports','INTEGER','STRING','sequelize'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0x5d81,0x97));var _0x15d8=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x5d81[_0x631a3c];return _0x2bdfa3;};'use strict';var Sequelize=require(_0x15d8('0x0'));module[_0x15d8('0x1')]={'penalty':{'type':Sequelize[_0x15d8('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x15d8('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x15d8('0x3')]}}; \ No newline at end of file +var _0xdb36=['INTEGER','STRING','sequelize','exports'];(function(_0x1d2244,_0x500e1a){var _0x5d89c2=function(_0x3ded41){while(--_0x3ded41){_0x1d2244['push'](_0x1d2244['shift']());}};_0x5d89c2(++_0x500e1a);}(_0xdb36,0xf6));var _0x6db3=function(_0x586ca3,_0x31140e){_0x586ca3=_0x586ca3-0x0;var _0x5577d0=_0xdb36[_0x586ca3];return _0x5577d0;};'use strict';var Sequelize=require(_0x6db3('0x0'));module[_0x6db3('0x1')]={'penalty':{'type':Sequelize[_0x6db3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6db3('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 9f3ffe1..b768453 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 _0xc3f3=['UserFaxQueue','user_has_fax_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xc3f3,0x152));var _0x3c3f=function(_0x38c980,_0x2912a6){_0x38c980=_0x38c980-0x0;var _0x4ccf3c=_0xc3f3[_0x38c980];return _0x4ccf3c;};'use strict';var _=require(_0x3c3f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c3f('0x1'));var moment=require(_0x3c3f('0x2'));var BPromise=require(_0x3c3f('0x3'));var rp=require(_0x3c3f('0x4'));var fs=require('fs');var path=require(_0x3c3f('0x5'));var rimraf=require(_0x3c3f('0x6'));var config=require(_0x3c3f('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x3c3f('0x8')]=function(_0x44c05c,_0x505bc7){return _0x44c05c[_0x3c3f('0x9')](_0x3c3f('0xa'),attributes,{'tableName':_0x3c3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a6=['path','rimraf','../../config/environment','./userFaxQueue.attributes','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f8dca,_0x50001e){var _0x1b19f7=function(_0xe387ca){while(--_0xe387ca){_0x1f8dca['push'](_0x1f8dca['shift']());}};_0x1b19f7(++_0x50001e);}(_0xf0a6,0x6e));var _0x6f0a=function(_0x2838ee,_0x2c618d){_0x2838ee=_0x2838ee-0x0;var _0x1c1090=_0xf0a6[_0x2838ee];return _0x1c1090;};'use strict';var _=require(_0x6f0a('0x0'));var util=require(_0x6f0a('0x1'));var logger=require(_0x6f0a('0x2'))(_0x6f0a('0x3'));var moment=require(_0x6f0a('0x4'));var BPromise=require(_0x6f0a('0x5'));var rp=require(_0x6f0a('0x6'));var fs=require('fs');var path=require(_0x6f0a('0x7'));var rimraf=require(_0x6f0a('0x8'));var config=require(_0x6f0a('0x9'));var attributes=require(_0x6f0a('0xa'));module['exports']=function(_0x2e4882,_0x334e9b){return _0x2e4882['define'](_0x6f0a('0xb'),attributes,{'tableName':_0x6f0a('0xc'),'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 3d54bc2..837cda6 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 _0x1f93=['http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x591b15,_0x29ab95){var _0x11c6b7=function(_0x2acf6d){while(--_0x2acf6d){_0x591b15['push'](_0x591b15['shift']());}};_0x11c6b7(++_0x29ab95);}(_0x1f93,0x137));var _0x31f9=function(_0xddcdd7,_0x2c3459){_0xddcdd7=_0xddcdd7-0x0;var _0xe6047b=_0x1f93[_0xddcdd7];return _0xe6047b;};'use strict';var _=require(_0x31f9('0x0'));var util=require('util');var moment=require(_0x31f9('0x1'));var BPromise=require(_0x31f9('0x2'));var rs=require(_0x31f9('0x3'));var fs=require('fs');var Redis=require(_0x31f9('0x4'));var db=require(_0x31f9('0x5'))['db'];var utils=require(_0x31f9('0x6'));var logger=require(_0x31f9('0x7'))(_0x31f9('0x8'));var config=require(_0x31f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x31f9('0xa')][_0x31f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e59d5,_0x1c272a,_0x2d5998){return new BPromise(function(_0x2dd4c2,_0x3be2b3){return client[_0x31f9('0xc')](_0x2e59d5,_0x2d5998)['then'](function(_0x3086df){logger[_0x31f9('0xd')](_0x31f9('0xe'),_0x1c272a,_0x31f9('0xf'));logger[_0x31f9('0x10')](_0x31f9('0x11'),_0x1c272a,_0x31f9('0xf'),JSON[_0x31f9('0x12')](_0x3086df));if(_0x3086df[_0x31f9('0x13')]){if(_0x3086df[_0x31f9('0x13')][_0x31f9('0x14')]===0x1f4){logger['error'](_0x31f9('0xe'),_0x1c272a,_0x3086df['error'][_0x31f9('0x15')]);return _0x3be2b3(_0x3086df['error'][_0x31f9('0x15')]);}logger['error'](_0x31f9('0xe'),_0x1c272a,_0x3086df['error']['message']);return _0x2dd4c2(_0x3086df[_0x31f9('0x13')][_0x31f9('0x15')]);}else{logger[_0x31f9('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1c272a,_0x31f9('0xf'));_0x2dd4c2(_0x3086df[_0x31f9('0x16')]['message']);}})['catch'](function(_0x1baeb9){logger['error'](_0x31f9('0xe'),_0x1c272a,_0x1baeb9);_0x3be2b3(_0x1baeb9);});});} \ No newline at end of file +var _0x3e5e=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','randomstring','ioredis','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e5e,0x140));var _0xe3e5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3e5e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3e5('0x0'));var fs=require('fs');var Redis=require(_0xe3e5('0x1'));var db=require(_0xe3e5('0x2'))['db'];var utils=require(_0xe3e5('0x3'));var logger=require('../../config/logger')(_0xe3e5('0x4'));var config=require(_0xe3e5('0x5'));var jayson=require(_0xe3e5('0x6'));var client=jayson['client'][_0xe3e5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3abcf8,_0x19b57f,_0x342051){return new BPromise(function(_0x322844,_0x42c60f){return client[_0xe3e5('0x8')](_0x3abcf8,_0x342051)['then'](function(_0x5e783a){logger[_0xe3e5('0x9')](_0xe3e5('0xa'),_0x19b57f,'request\x20sent');logger[_0xe3e5('0xb')](_0xe3e5('0xc'),_0x19b57f,_0xe3e5('0xd'),JSON[_0xe3e5('0xe')](_0x5e783a));if(_0x5e783a[_0xe3e5('0xf')]){if(_0x5e783a[_0xe3e5('0xf')]['code']===0x1f4){logger[_0xe3e5('0xf')](_0xe3e5('0xa'),_0x19b57f,_0x5e783a['error'][_0xe3e5('0x10')]);return _0x42c60f(_0x5e783a['error'][_0xe3e5('0x10')]);}logger[_0xe3e5('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x19b57f,_0x5e783a[_0xe3e5('0xf')][_0xe3e5('0x10')]);return _0x322844(_0x5e783a['error'][_0xe3e5('0x10')]);}else{logger['info'](_0xe3e5('0xa'),_0x19b57f,_0xe3e5('0xd'));_0x322844(_0x5e783a[_0xe3e5('0x11')][_0xe3e5('0x10')]);}})[_0xe3e5('0x12')](function(_0x5346fe){logger[_0xe3e5('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x19b57f,_0x5346fe);_0x42c60f(_0x5346fe);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 01bc492..6767896 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x60581d,_0xa3e313){var _0x43dd38=function(_0x38c017){while(--_0x38c017){_0x60581d['push'](_0x60581d['shift']());}};_0x43dd38(++_0xa3e313);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x77ad04,_0x50b6d8){var _0xfbf0f=function(_0x259c61){while(--_0x259c61){_0x77ad04['push'](_0x77ad04['shift']());}};_0xfbf0f(++_0x50b6d8);}(_0x70e0,0x17b));var _0x070e=function(_0x326f33,_0x9c8d9f){_0x326f33=_0x326f33-0x0;var _0x2d5b4f=_0x70e0[_0x326f33];return _0x2d5b4f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 03806e8..313e133 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 _0xfb06=['exports'];(function(_0xba9fee,_0x4447c0){var _0x305416=function(_0x3d0d7f){while(--_0x3d0d7f){_0xba9fee['push'](_0xba9fee['shift']());}};_0x305416(++_0x4447c0);}(_0xfb06,0x118));var _0x6fb0=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xfb06[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require('sequelize');module[_0x6fb0('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x093c=['sequelize','exports','INTEGER'];(function(_0x4c8af4,_0x556041){var _0x32fb71=function(_0x182ddb){while(--_0x182ddb){_0x4c8af4['push'](_0x4c8af4['shift']());}};_0x32fb71(++_0x556041);}(_0x093c,0x7e));var _0xc093=function(_0x131d81,_0x420cd7){_0x131d81=_0x131d81-0x0;var _0x50e259=_0x093c[_0x131d81];return _0x50e259;};'use strict';var Sequelize=require(_0xc093('0x0'));module[_0xc093('0x1')]={'penalty':{'type':Sequelize[_0xc093('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 23ef600..2f6c0c3 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 _0x2e43=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2e43,0x187));var _0x32e4=function(_0x3300d0,_0x45afb1){_0x3300d0=_0x3300d0-0x0;var _0x2762dd=_0x2e43[_0x3300d0];return _0x2762dd;};'use strict';var _=require(_0x32e4('0x0'));var util=require(_0x32e4('0x1'));var logger=require('../../config/logger')(_0x32e4('0x2'));var moment=require(_0x32e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32e4('0x4'));var rimraf=require(_0x32e4('0x5'));var config=require(_0x32e4('0x6'));var attributes=require(_0x32e4('0x7'));module[_0x32e4('0x8')]=function(_0x3dcd83,_0x4bffcf){return _0x3dcd83[_0x32e4('0x9')](_0x32e4('0xa'),attributes,{'tableName':_0x32e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf2=['user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','UserMailQueue'];(function(_0x3c188e,_0x5e771a){var _0x5b054b=function(_0x4643d1){while(--_0x4643d1){_0x3c188e['push'](_0x3c188e['shift']());}};_0x5b054b(++_0x5e771a);}(_0x9cf2,0xb1));var _0x29cf=function(_0x3544f9,_0x5ee41d){_0x3544f9=_0x3544f9-0x0;var _0x1f3599=_0x9cf2[_0x3544f9];return _0x1f3599;};'use strict';var _=require(_0x29cf('0x0'));var util=require(_0x29cf('0x1'));var logger=require(_0x29cf('0x2'))(_0x29cf('0x3'));var moment=require(_0x29cf('0x4'));var BPromise=require(_0x29cf('0x5'));var rp=require(_0x29cf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x29cf('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x29cf('0x8')]=function(_0x4086ef,_0x368b95){return _0x4086ef['define'](_0x29cf('0x9'),attributes,{'tableName':_0x29cf('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 62bfe2b..c40e620 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a0f27,_0x1ff8e3){var _0x2c504c=function(_0x49af99){while(--_0x49af99){_0x5a0f27['push'](_0x5a0f27['shift']());}};_0x2c504c(++_0x1ff8e3);}(_0xa41a,0x6b));var _0xaa41=function(_0x2ed7d6,_0x3592ff){_0x2ed7d6=_0x2ed7d6-0x0;var _0x3767bd=_0xa41a[_0x2ed7d6];return _0x3767bd;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x562bde,_0x55240b){var _0x3b5707=function(_0x59d111){while(--_0x59d111){_0x562bde['push'](_0x562bde['shift']());}};_0x3b5707(++_0x55240b);}(_0xa41a,0x6b));var _0xaa41=function(_0x39f2ac,_0x2ef69e){_0x39f2ac=_0x39f2ac-0x0;var _0x23adca=_0xa41a[_0x39f2ac];return _0x23adca;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f38c0b8..2318d9e 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 _0x2c4c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x4a208f,_0x45325b){var _0xd20ec2=function(_0x3fbf2f){while(--_0x3fbf2f){_0x4a208f['push'](_0x4a208f['shift']());}};_0xd20ec2(++_0x45325b);}(_0x2c4c,0x1ad));var _0xc2c4=function(_0xb51463,_0x1c7959){_0xb51463=_0xb51463-0x0;var _0x15f379=_0x2c4c[_0xb51463];return _0x15f379;};'use strict';var multer=require(_0xc2c4('0x0'));var util=require(_0xc2c4('0x1'));var path=require(_0xc2c4('0x2'));var timeout=require(_0xc2c4('0x3'));var express=require(_0xc2c4('0x4'));var router=express[_0xc2c4('0x5')]();var fs_extra=require(_0xc2c4('0x6'));var auth=require(_0xc2c4('0x7'));var interaction=require(_0xc2c4('0x8'));var config=require(_0xc2c4('0x9'));var controller=require('./userNotification.controller');router[_0xc2c4('0xa')]('/',auth[_0xc2c4('0xb')](),controller[_0xc2c4('0xc')]);module[_0xc2c4('0xd')]=router; \ No newline at end of file +var _0x9397=['./userNotification.controller','sendUserNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x50ab90,_0x4f1f45){var _0x455338=function(_0x380a3a){while(--_0x380a3a){_0x50ab90['push'](_0x50ab90['shift']());}};_0x455338(++_0x4f1f45);}(_0x9397,0x1aa));var _0x7939=function(_0x1a58ac,_0x2a3cc2){_0x1a58ac=_0x1a58ac-0x0;var _0xeac505=_0x9397[_0x1a58ac];return _0xeac505;};'use strict';var multer=require(_0x7939('0x0'));var util=require(_0x7939('0x1'));var path=require(_0x7939('0x2'));var timeout=require(_0x7939('0x3'));var express=require('express');var router=express[_0x7939('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7939('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7939('0x6'));router['post']('/',auth['isAuthenticated'](),controller[_0x7939('0x7')]);module[_0x7939('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 27949f7..e944377 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 _0xfa42=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2dffac,_0x2d38e7){var _0x535c18=function(_0x1f3df0){while(--_0x1f3df0){_0x2dffac['push'](_0x2dffac['shift']());}};_0x535c18(++_0x2d38e7);}(_0xfa42,0xd7));var _0x2fa4=function(_0x26bf5a,_0x1d5c98){_0x26bf5a=_0x26bf5a-0x0;var _0x409a3a=_0xfa42[_0x26bf5a];return _0x409a3a;};'use strict';var Sequelize=require(_0x2fa4('0x0'));module[_0x2fa4('0x1')]={'body':{'type':Sequelize[_0x2fa4('0x2')]},'senderName':{'type':Sequelize[_0x2fa4('0x3')]},'recipientsId':{'type':Sequelize[_0x2fa4('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2fa4('0x4')]}}; \ No newline at end of file +var _0x232b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x37fd0b,_0x136247){var _0x1cc1ae=function(_0x22a9b4){while(--_0x22a9b4){_0x37fd0b['push'](_0x37fd0b['shift']());}};_0x1cc1ae(++_0x136247);}(_0x232b,0x1d9));var _0xb232=function(_0x158965,_0x117f97){_0x158965=_0x158965-0x0;var _0x3a3e9d=_0x232b[_0x158965];return _0x3a3e9d;};'use strict';var Sequelize=require(_0xb232('0x0'));module[_0xb232('0x1')]={'body':{'type':Sequelize[_0xb232('0x2')]},'senderName':{'type':Sequelize[_0xb232('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xb232('0x3')]},'beep':{'type':Sequelize[_0xb232('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 6b88f95..e6d2230 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 _0x94c6=['error','stack','name','send','body','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','Queue','push','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x89fc66,_0x45bd91){var _0x417acb=function(_0x29323a){while(--_0x29323a){_0x89fc66['push'](_0x89fc66['shift']());}};_0x417acb(++_0x45bd91);}(_0x94c6,0x96));var _0x694c=function(_0x3cdaf1,_0x5e9c5f){_0x3cdaf1=_0x3cdaf1-0x0;var _0xdbcc68=_0x94c6[_0x3cdaf1];return _0xdbcc68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x694c('0x0'));var zipdir=require(_0x694c('0x1'));var jsonpatch=require(_0x694c('0x2'));var rp=require('request-promise');var moment=require(_0x694c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x694c('0x4'));var util=require(_0x694c('0x5'));var path=require(_0x694c('0x6'));var sox=require('sox');var csv=require(_0x694c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x694c('0x8'));var _=require(_0x694c('0x9'));var squel=require(_0x694c('0xa'));var crypto=require('crypto');var jsforce=require(_0x694c('0xb'));var deskjs=require(_0x694c('0xc'));var toCsv=require(_0x694c('0x7'));var querystring=require(_0x694c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x694c('0xe'));var qs=require(_0x694c('0xf'));var as=require(_0x694c('0x10'));var hardwareService=require(_0x694c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x694c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x694c('0x13'))['db'];config[_0x694c('0x14')]=_['defaults'](config[_0x694c('0x14')],{'host':_0x694c('0x15'),'port':0x18eb});var socket=require(_0x694c('0x16'))(new Redis(config['redis']));require('./userNotification.socket')[_0x694c('0x17')](socket);function respondWithStatusCode(_0x4c6432,_0x2f2ecd){_0x2f2ecd=_0x2f2ecd||0xcc;return function(_0x425e5c){if(_0x425e5c){return _0x4c6432[_0x694c('0x18')](_0x2f2ecd);}return _0x4c6432['status'](_0x2f2ecd)[_0x694c('0x19')]();};}function respondWithResult(_0x554ddb,_0x3330e8){_0x3330e8=_0x3330e8||0xc8;return function(_0xe6a8e4){if(_0xe6a8e4){return _0x554ddb[_0x694c('0x1a')](_0x3330e8)[_0x694c('0x1b')](_0xe6a8e4);}};}function respondWithFilteredResult(_0x549ac8,_0x433daf){return function(_0x12569b){if(_0x12569b){var _0x5381d0=typeof _0x433daf['offset']===_0x694c('0x1c')&&typeof _0x433daf['limit']==='undefined';var _0x3fb5f5=_0x12569b[_0x694c('0x1d')];var _0xba8593=_0x5381d0?0x0:_0x433daf[_0x694c('0x1e')];var _0x1451b7=_0x5381d0?_0x12569b[_0x694c('0x1d')]:_0x433daf[_0x694c('0x1e')]+_0x433daf[_0x694c('0x1f')];var _0x2bad7d;if(_0x1451b7>=_0x3fb5f5){_0x1451b7=_0x3fb5f5;_0x2bad7d=0xc8;}else{_0x2bad7d=0xce;}_0x549ac8[_0x694c('0x1a')](_0x2bad7d);return _0x549ac8[_0x694c('0x20')](_0x694c('0x21'),_0xba8593+'-'+_0x1451b7+'/'+_0x3fb5f5)[_0x694c('0x1b')](_0x12569b);}return null;};}function patchUpdates(_0x5e25ce){return function(_0x2e5030){try{jsonpatch[_0x694c('0x22')](_0x2e5030,_0x5e25ce,!![]);}catch(_0x3268a7){return BPromise[_0x694c('0x23')](_0x3268a7);}return _0x2e5030['save']();};}function saveUpdates(_0x914607,_0x2471eb){return function(_0x1f86a4){if(_0x1f86a4){return _0x1f86a4[_0x694c('0x24')](_0x914607)[_0x694c('0x25')](function(_0x562dfd){return _0x562dfd;});}return null;};}function removeEntity(_0x444f78,_0x807a01){return function(_0x58044e){if(_0x58044e){return _0x58044e['destroy']()[_0x694c('0x25')](function(){_0x444f78['status'](0xcc)[_0x694c('0x19')]();});}};}function handleEntityNotFound(_0x228e36,_0x5d3d58){return function(_0x240a4e){if(!_0x240a4e){_0x228e36[_0x694c('0x18')](0x194);}return _0x240a4e;};}function handleError(_0x54d55d,_0x381c60){_0x381c60=_0x381c60||0x1f4;return function(_0x116730){logger[_0x694c('0x26')](_0x116730[_0x694c('0x27')]);if(_0x116730['name']){delete _0x116730[_0x694c('0x28')];}_0x54d55d[_0x694c('0x1a')](_0x381c60)[_0x694c('0x29')](_0x116730);};}exports['sendUserNotification']=function(_0x4121fe,_0xaea59a,_0xae5121){if(!_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x2b'))&&!_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x2c'))){throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x2f'));}else{if(_0x4121fe['body']['hasOwnProperty'](_0x694c('0x2c'))&&!_0x4121fe['body'][_0x694c('0x30')]('view')){throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x31'));}if(!_0x4121fe[_0x694c('0x2a')][_0x694c('0x30')](_0x694c('0x32'))){throw new db[(_0x694c('0x2d'))]['ValidationError'](_0x694c('0x33'));}else{try{var _0x2c9da7=JSON[_0x694c('0x34')](_0x4121fe['body'][_0x694c('0x32')]);}catch(_0x4eae54){logger[_0x694c('0x26')](_0x4eae54);throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x447a36=[_0x694c('0x35'),'faxqueue',_0x694c('0x36'),_0x694c('0x37'),'smsqueue',_0x694c('0x38'),'whatsappqueue',_0x694c('0x39'),_0x694c('0x3a')];if(_[_0x694c('0x3b')](_0x2c9da7,function(_0x118802){return!_[_0x694c('0x3c')](_0x447a36,_0x118802[_0x694c('0x3d')][_0x694c('0x3e')]());})){throw new db['Sequelize'][(_0x694c('0x2e'))](_0x694c('0x3f'));}}}var _0x53cebf={};_0x53cebf[_0x694c('0x40')]=_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x40'))?_0x4121fe[_0x694c('0x2a')]['senderName']:_0x4121fe[_0x694c('0x3a')][_0x694c('0x41')];_0x53cebf[_0x694c('0x42')]=_[_0x694c('0x43')](_0x4121fe['body'][_0x694c('0x42')])?null:_0x4121fe[_0x694c('0x2a')][_0x694c('0x42')];_0x53cebf[_0x694c('0x44')]=_0x4121fe[_0x694c('0x2a')][_0x694c('0x44')]||![];_0x53cebf[_0x694c('0x45')]=_0x4121fe[_0x694c('0x3a')]['id'];return getContent(_0x4121fe[_0x694c('0x2a')])['then'](function(_0x436bda){_0x53cebf['body']=_0x436bda;return getRecipients(_0x2c9da7);})[_0x694c('0x25')](function(_0xee0df8){_0x53cebf[_0x694c('0x46')]=_[_0x694c('0x47')](_0xee0df8)['join'](',');return db[_0x694c('0x48')][_0x694c('0x49')](function(_0x2e1275){return db['UserNotification']['create'](_0x53cebf,{'raw':!![],'transaction':_0x2e1275})[_0x694c('0x25')](function(_0x2d0d98){var _0x403c86={'sender':_0x53cebf[_0x694c('0x40')],'description':_0x53cebf[_0x694c('0x42')],'content':_0x53cebf[_0x694c('0x2a')],'beep':_0x53cebf[_0x694c('0x44')]};_0xee0df8[_0x694c('0x4a')](function(_0x1dc712){_0x403c86[_0x694c('0x4b')]=_0x1dc712;socket[_0x694c('0x4c')]('userNotification:send',_0x403c86);});return _0x2d0d98;});});})['then'](respondWithResult(_0xaea59a,0xc9))[_0x694c('0x4d')](handleError(_0xaea59a,null));};function getContent(_0x2df255){return new BPromise(function(_0xac297a,_0x31e6b7){if(_0x2df255[_0x694c('0x2b')]){_0xac297a(_0x2df255[_0x694c('0x2b')]);return;}return db[_0x694c('0x4e')][_0x694c('0x4f')]({'attributes':[_0x694c('0x50')],'where':{'id':_0x2df255['TemplateId']},'raw':!![]})[_0x694c('0x25')](function(_0x43d364){if(!_0x43d364)throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x51'));var _0x2ddf43=Mustache[_0x694c('0x52')](_0x43d364['html'],_0x2df255[_0x694c('0x53')]);_0xac297a(_0x2ddf43);})['catch'](function(_0x4dbf71){_0x31e6b7(_0x4dbf71);});});}function getRecipients(_0x48e18a){return new BPromise(function(_0x37c95d,_0x30b28e){var _0x231e2d=[];var _0x4c4e02=[];_0x48e18a[_0x694c('0x4a')](function(_0x20b395){var _0x3320e8=_[_0x694c('0x54')](_0x20b395[_0x694c('0x3d')]['toLowerCase']());if(_0x3320e8===_0x694c('0x55')){_0x231e2d=_[_0x694c('0x56')](_0x231e2d,_0x20b395[_0x694c('0x57')]);}else{if(_[_0x694c('0x3c')](_0x3320e8,_0x694c('0x58')))_0x3320e8=_0x3320e8['replace']('queue',_0x694c('0x59'));_0x20b395['ids']['forEach'](function(_0x5b93b3){_0x4c4e02[_0x694c('0x5a')](getAgents(_0x3320e8,_0x5b93b3));});}});return BPromise['all'](_0x4c4e02)['then'](function(_0x3e6594){_0x231e2d=_[_0x694c('0x56')](_0x231e2d,_[_0x694c('0x5b')](_0x3e6594));_0x37c95d(_0x231e2d);})[_0x694c('0x4d')](function(_0x547073){_0x30b28e(_0x547073);});});}function getAgents(_0xa19234,_0x2c2bf4){return new BPromise(function(_0xbb032b,_0x2cd4da){return db[_0xa19234][_0x694c('0x4f')]({'where':{'id':_0x2c2bf4}})[_0x694c('0x25')](function(_0x1cd44d){return _0x1cd44d[_0x694c('0x5c')]({'attributes':['id'],'raw':!![]})[_0x694c('0x25')](function(_0x1a0d51){var _0x5619e8=_[_0x694c('0x5d')](_0x1a0d51,'id');_0xbb032b(_0x5619e8);});})[_0x694c('0x4d')](function(_0x271a10){_0x2cd4da(_0x271a10);});});} \ No newline at end of file +var _0x7e6b=['model','senderName','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','sequelize','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','toLowerCase','User','union','ids','includes','queue','Queue','push','all','flatten','getAgents','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','user','some'];(function(_0x4c9d00,_0x5092d5){var _0x4a73f5=function(_0xc0bfc7){while(--_0xc0bfc7){_0x4c9d00['push'](_0x4c9d00['shift']());}};_0x4a73f5(++_0x5092d5);}(_0x7e6b,0x144));var _0xb7e6=function(_0x18eb26,_0x2cd839){_0x18eb26=_0x18eb26-0x0;var _0x225268=_0x7e6b[_0x18eb26];return _0x225268;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7e6('0x0'));var zipdir=require(_0xb7e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb7e6('0x2'));var BPromise=require(_0xb7e6('0x3'));var Mustache=require(_0xb7e6('0x4'));var util=require('util');var path=require(_0xb7e6('0x5'));var sox=require('sox');var csv=require(_0xb7e6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7e6('0x7'));var squel=require(_0xb7e6('0x8'));var crypto=require(_0xb7e6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb7e6('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7e6('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb7e6('0xb'));var hardwareService=require(_0xb7e6('0xc'));var logger=require(_0xb7e6('0xd'))(_0xb7e6('0xe'));var utils=require(_0xb7e6('0xf'));var config=require(_0xb7e6('0x10'));var licenseUtil=require(_0xb7e6('0x11'));var db=require(_0xb7e6('0x12'))['db'];config['redis']=_[_0xb7e6('0x13')](config[_0xb7e6('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7e6('0x15'))(new Redis(config['redis']));require(_0xb7e6('0x16'))['register'](socket);function respondWithStatusCode(_0x1db8c0,_0x11b3ac){_0x11b3ac=_0x11b3ac||0xcc;return function(_0x27ba72){if(_0x27ba72){return _0x1db8c0['sendStatus'](_0x11b3ac);}return _0x1db8c0['status'](_0x11b3ac)[_0xb7e6('0x17')]();};}function respondWithResult(_0x5eee24,_0x102be5){_0x102be5=_0x102be5||0xc8;return function(_0x283f25){if(_0x283f25){return _0x5eee24[_0xb7e6('0x18')](_0x102be5)['json'](_0x283f25);}};}function respondWithFilteredResult(_0x22608f,_0x31b2be){return function(_0x5ab4e3){if(_0x5ab4e3){var _0x5df6c8=typeof _0x31b2be[_0xb7e6('0x19')]===_0xb7e6('0x1a')&&typeof _0x31b2be[_0xb7e6('0x1b')]===_0xb7e6('0x1a');var _0x165f06=_0x5ab4e3['count'];var _0x567251=_0x5df6c8?0x0:_0x31b2be['offset'];var _0x38fbfc=_0x5df6c8?_0x5ab4e3[_0xb7e6('0x1c')]:_0x31b2be[_0xb7e6('0x19')]+_0x31b2be['limit'];var _0x59e0bb;if(_0x38fbfc>=_0x165f06){_0x38fbfc=_0x165f06;_0x59e0bb=0xc8;}else{_0x59e0bb=0xce;}_0x22608f[_0xb7e6('0x18')](_0x59e0bb);return _0x22608f[_0xb7e6('0x1d')](_0xb7e6('0x1e'),_0x567251+'-'+_0x38fbfc+'/'+_0x165f06)[_0xb7e6('0x1f')](_0x5ab4e3);}return null;};}function patchUpdates(_0x4452b8){return function(_0xbb0157){try{jsonpatch[_0xb7e6('0x20')](_0xbb0157,_0x4452b8,!![]);}catch(_0x31385c){return BPromise[_0xb7e6('0x21')](_0x31385c);}return _0xbb0157[_0xb7e6('0x22')]();};}function saveUpdates(_0x78ad7e,_0x54cc1f){return function(_0x4e9beb){if(_0x4e9beb){return _0x4e9beb[_0xb7e6('0x23')](_0x78ad7e)[_0xb7e6('0x24')](function(_0x3b619c){return _0x3b619c;});}return null;};}function removeEntity(_0x5d12de,_0x2f2ae2){return function(_0x230531){if(_0x230531){return _0x230531[_0xb7e6('0x25')]()[_0xb7e6('0x24')](function(){_0x5d12de['status'](0xcc)[_0xb7e6('0x17')]();});}};}function handleEntityNotFound(_0x671dd,_0x2462a4){return function(_0xff1f8f){if(!_0xff1f8f){_0x671dd[_0xb7e6('0x26')](0x194);}return _0xff1f8f;};}function handleError(_0x3229fa,_0x16b10a){_0x16b10a=_0x16b10a||0x1f4;return function(_0x23000b){logger['error'](_0x23000b[_0xb7e6('0x27')]);if(_0x23000b[_0xb7e6('0x28')]){delete _0x23000b[_0xb7e6('0x28')];}_0x3229fa[_0xb7e6('0x18')](_0x16b10a)[_0xb7e6('0x29')](_0x23000b);};}exports[_0xb7e6('0x2a')]=function(_0x5f22ac,_0x10bd16,_0x164ff7){if(!_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x2c')]('text')&&!_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x2c')](_0xb7e6('0x2d'))){throw new db['Sequelize']['ValidationError'](_0xb7e6('0x2e'));}else{if(_0x5f22ac['body'][_0xb7e6('0x2c')](_0xb7e6('0x2d'))&&!_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x2c')](_0xb7e6('0x2f'))){throw new db[(_0xb7e6('0x30'))][(_0xb7e6('0x31'))](_0xb7e6('0x32'));}if(!_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x2c')](_0xb7e6('0x33'))){throw new db[(_0xb7e6('0x30'))][(_0xb7e6('0x31'))](_0xb7e6('0x34'));}else{try{var _0x431754=JSON[_0xb7e6('0x35')](_0x5f22ac[_0xb7e6('0x2b')]['recipients']);}catch(_0x4eaf56){logger[_0xb7e6('0x36')](_0x4eaf56);throw new db[(_0xb7e6('0x30'))][(_0xb7e6('0x31'))](_0xb7e6('0x37'));}var _0x353b36=[_0xb7e6('0x38'),_0xb7e6('0x39'),_0xb7e6('0x3a'),'openchannelqueue',_0xb7e6('0x3b'),_0xb7e6('0x3c'),_0xb7e6('0x3d'),'team',_0xb7e6('0x3e')];if(_[_0xb7e6('0x3f')](_0x431754,function(_0x42d2d7){return!_['includes'](_0x353b36,_0x42d2d7[_0xb7e6('0x40')]['toLowerCase']());})){throw new db['Sequelize'][(_0xb7e6('0x31'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4e5b26={};_0x4e5b26['senderName']=_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x2c')]('senderName')?_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x41')]:_0x5f22ac[_0xb7e6('0x3e')][_0xb7e6('0x42')];_0x4e5b26[_0xb7e6('0x43')]=_[_0xb7e6('0x44')](_0x5f22ac['body'][_0xb7e6('0x43')])?null:_0x5f22ac[_0xb7e6('0x2b')][_0xb7e6('0x43')];_0x4e5b26['beep']=_0x5f22ac[_0xb7e6('0x2b')]['beep']||![];_0x4e5b26[_0xb7e6('0x45')]=_0x5f22ac[_0xb7e6('0x3e')]['id'];return getContent(_0x5f22ac[_0xb7e6('0x2b')])[_0xb7e6('0x24')](function(_0x5adbd5){_0x4e5b26[_0xb7e6('0x2b')]=_0x5adbd5;return getRecipients(_0x431754);})['then'](function(_0xf27d49){_0x4e5b26[_0xb7e6('0x46')]=_[_0xb7e6('0x47')](_0xf27d49)['join'](',');return db[_0xb7e6('0x48')]['transaction'](function(_0x49ce6d){return db[_0xb7e6('0x49')][_0xb7e6('0x4a')](_0x4e5b26,{'raw':!![],'transaction':_0x49ce6d})[_0xb7e6('0x24')](function(_0x41c3c0){var _0x46d70d={'sender':_0x4e5b26['senderName'],'description':_0x4e5b26['recipientsDescription'],'content':_0x4e5b26[_0xb7e6('0x2b')],'beep':_0x4e5b26[_0xb7e6('0x4b')]};_0xf27d49[_0xb7e6('0x4c')](function(_0x254545){_0x46d70d[_0xb7e6('0x4d')]=_0x254545;socket[_0xb7e6('0x4e')](_0xb7e6('0x4f'),_0x46d70d);});return _0x41c3c0;});});})[_0xb7e6('0x24')](respondWithResult(_0x10bd16,0xc9))[_0xb7e6('0x50')](handleError(_0x10bd16,null));};function getContent(_0x182d93){return new BPromise(function(_0x1106a0,_0x57ffcc){if(_0x182d93[_0xb7e6('0x51')]){_0x1106a0(_0x182d93[_0xb7e6('0x51')]);return;}return db[_0xb7e6('0x52')][_0xb7e6('0x53')]({'attributes':[_0xb7e6('0x54')],'where':{'id':_0x182d93[_0xb7e6('0x2d')]},'raw':!![]})[_0xb7e6('0x24')](function(_0x32ce7b){if(!_0x32ce7b)throw new db[(_0xb7e6('0x30'))][(_0xb7e6('0x31'))](_0xb7e6('0x55'));var _0x3ada37=Mustache['render'](_0x32ce7b[_0xb7e6('0x54')],_0x182d93[_0xb7e6('0x2f')]);_0x1106a0(_0x3ada37);})[_0xb7e6('0x50')](function(_0x4fc75b){_0x57ffcc(_0x4fc75b);});});}function getRecipients(_0x10579c){return new BPromise(function(_0x113bb7,_0x2b10ee){var _0x38d71f=[];var _0x9fa53d=[];_0x10579c[_0xb7e6('0x4c')](function(_0x725ba2){var _0x5a348a=_['startCase'](_0x725ba2[_0xb7e6('0x40')][_0xb7e6('0x56')]());if(_0x5a348a===_0xb7e6('0x57')){_0x38d71f=_[_0xb7e6('0x58')](_0x38d71f,_0x725ba2[_0xb7e6('0x59')]);}else{if(_[_0xb7e6('0x5a')](_0x5a348a,_0xb7e6('0x5b')))_0x5a348a=_0x5a348a['replace'](_0xb7e6('0x5b'),_0xb7e6('0x5c'));_0x725ba2[_0xb7e6('0x59')][_0xb7e6('0x4c')](function(_0x336bc1){_0x9fa53d[_0xb7e6('0x5d')](getAgents(_0x5a348a,_0x336bc1));});}});return BPromise[_0xb7e6('0x5e')](_0x9fa53d)[_0xb7e6('0x24')](function(_0x505d4e){_0x38d71f=_[_0xb7e6('0x58')](_0x38d71f,_[_0xb7e6('0x5f')](_0x505d4e));_0x113bb7(_0x38d71f);})[_0xb7e6('0x50')](function(_0x1b6940){_0x2b10ee(_0x1b6940);});});}function getAgents(_0x555556,_0x4e50ec){return new BPromise(function(_0x465a8d,_0x56ebbf){return db[_0x555556][_0xb7e6('0x53')]({'where':{'id':_0x4e50ec}})[_0xb7e6('0x24')](function(_0x361540){return _0x361540[_0xb7e6('0x60')]({'attributes':['id'],'raw':!![]})[_0xb7e6('0x24')](function(_0x498fe1){var _0xeab76=_['map'](_0x498fe1,'id');_0x465a8d(_0xeab76);});})[_0xb7e6('0x50')](function(_0x894283){_0x56ebbf(_0x894283);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 1d3d42c..285cb2b 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 _0x3ef7=['events','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ef7,0x1f4));var _0x73ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ef7[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x73ef('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x73ef('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x73ef('0x2')](0x0);var events={'afterCreate':_0x73ef('0x3'),'afterUpdate':_0x73ef('0x4'),'afterDestroy':_0x73ef('0x5')};function emitEvent(_0x163da1){return function(_0x499776,_0x4f041b,_0x2a0369){UserNotificationEvents[_0x73ef('0x6')](_0x163da1+':'+_0x499776['id'],_0x499776);UserNotificationEvents[_0x73ef('0x6')](_0x163da1,_0x499776);_0x2a0369(null);};}for(var e in events){if(events[_0x73ef('0x7')](e)){var event=events[e];UserNotification[_0x73ef('0x8')](e,emitEvent(event));}}module[_0x73ef('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xc6b0=['setMaxListeners','save','remove','emit','exports','UserNotification'];(function(_0x371c6f,_0x65302a){var _0x37ea38=function(_0x334287){while(--_0x334287){_0x371c6f['push'](_0x371c6f['shift']());}};_0x37ea38(++_0x65302a);}(_0xc6b0,0xdd));var _0x0c6b=function(_0x5555f8,_0x2bd7ec){_0x5555f8=_0x5555f8-0x0;var _0x39a854=_0xc6b0[_0x5555f8];return _0x39a854;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x0c6b('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0c6b('0x1')](0x0);var events={'afterCreate':_0x0c6b('0x2'),'afterUpdate':'update','afterDestroy':_0x0c6b('0x3')};function emitEvent(_0x5c7df2){return function(_0x2c34d4,_0x5af55b,_0x2011d6){UserNotificationEvents['emit'](_0x5c7df2+':'+_0x2c34d4['id'],_0x2c34d4);UserNotificationEvents[_0x0c6b('0x4')](_0x5c7df2,_0x2c34d4);_0x2011d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x0c6b('0x5')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d35af5a..32ddca6 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 _0xe00f=['rimraf','../../config/environment','exports','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x53d5d6,_0x168987){var _0x401965=function(_0x177a8e){while(--_0x177a8e){_0x53d5d6['push'](_0x53d5d6['shift']());}};_0x401965(++_0x168987);}(_0xe00f,0x14b));var _0xfe00=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xe00f[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var logger=require('../../config/logger')(_0xfe00('0x2'));var moment=require(_0xfe00('0x3'));var BPromise=require(_0xfe00('0x4'));var rp=require(_0xfe00('0x5'));var fs=require('fs');var path=require(_0xfe00('0x6'));var rimraf=require(_0xfe00('0x7'));var config=require(_0xfe00('0x8'));var attributes=require('./userNotification.attributes');module[_0xfe00('0x9')]=function(_0x4eac9d,_0x4c4705){return _0x4eac9d['define']('UserNotification',attributes,{'tableName':_0xfe00('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe00('0xb'),'collate':_0xfe00('0xc')});}; \ No newline at end of file +var _0xb630=['bluebird','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x12a987,_0x41df8d){var _0x4ab418=function(_0x373566){while(--_0x373566){_0x12a987['push'](_0x12a987['shift']());}};_0x4ab418(++_0x41df8d);}(_0xb630,0xb1));var _0x0b63=function(_0x4a352c,_0x1844ac){_0x4a352c=_0x4a352c-0x0;var _0x488000=_0xb630[_0x4a352c];return _0x488000;};'use strict';var _=require(_0x0b63('0x0'));var util=require(_0x0b63('0x1'));var logger=require(_0x0b63('0x2'))(_0x0b63('0x3'));var moment=require(_0x0b63('0x4'));var BPromise=require(_0x0b63('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b63('0x6'));var rimraf=require(_0x0b63('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x0b63('0x8')]=function(_0x2d167f,_0x254674){return _0x2d167f[_0x0b63('0x9')](_0x0b63('0xa'),attributes,{'tableName':_0x0b63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0b63('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index fa88a21..6ec1c96 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 _0x1706=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3fd750,_0x120661){var _0x4f15d9=function(_0x3181b8){while(--_0x3181b8){_0x3fd750['push'](_0x3fd750['shift']());}};_0x4f15d9(++_0x120661);}(_0x1706,0x1d8));var _0x6170=function(_0x27fc64,_0x3cf15b){_0x27fc64=_0x27fc64-0x0;var _0x51a9fb=_0x1706[_0x27fc64];return _0x51a9fb;};'use strict';var _=require(_0x6170('0x0'));var util=require(_0x6170('0x1'));var moment=require(_0x6170('0x2'));var BPromise=require('bluebird');var rs=require(_0x6170('0x3'));var fs=require('fs');var Redis=require(_0x6170('0x4'));var db=require(_0x6170('0x5'))['db'];var utils=require(_0x6170('0x6'));var logger=require('../../config/logger')(_0x6170('0x7'));var config=require(_0x6170('0x8'));var jayson=require(_0x6170('0x9'));var client=jayson[_0x6170('0xa')][_0x6170('0xb')]({'port':0x232a});config[_0x6170('0xc')]=_['defaults'](config['redis'],{'host':_0x6170('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6170('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x243d73,_0x29aa1e,_0x293c8d){return new BPromise(function(_0x225adc,_0xbd3a2f){return client['request'](_0x243d73,_0x293c8d)[_0x6170('0xe')](function(_0x55b9ef){logger[_0x6170('0xf')](_0x6170('0x10'),_0x29aa1e,'request\x20sent');logger[_0x6170('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x29aa1e,_0x6170('0x12'),JSON[_0x6170('0x13')](_0x55b9ef));if(_0x55b9ef[_0x6170('0x14')]){if(_0x55b9ef[_0x6170('0x14')][_0x6170('0x15')]===0x1f4){logger['error'](_0x6170('0x10'),_0x29aa1e,_0x55b9ef[_0x6170('0x14')][_0x6170('0x16')]);return _0xbd3a2f(_0x55b9ef[_0x6170('0x14')][_0x6170('0x16')]);}logger[_0x6170('0x14')]('UserNotification,\x20%s,\x20%s',_0x29aa1e,_0x55b9ef['error'][_0x6170('0x16')]);return _0x225adc(_0x55b9ef[_0x6170('0x14')]['message']);}else{logger['info'](_0x6170('0x10'),_0x29aa1e,_0x6170('0x12'));_0x225adc(_0x55b9ef[_0x6170('0x17')]['message']);}})[_0x6170('0x18')](function(_0x2881c3){logger[_0x6170('0x14')](_0x6170('0x10'),_0x29aa1e,_0x2881c3);_0xbd3a2f(_0x2881c3);});});} \ No newline at end of file +var _0xa3e4=['catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3700fd,_0x5bd346){var _0x4ffb6c=function(_0x42a3de){while(--_0x42a3de){_0x3700fd['push'](_0x3700fd['shift']());}};_0x4ffb6c(++_0x5bd346);}(_0xa3e4,0x121));var _0x4a3e=function(_0x3ba3c0,_0x129464){_0x3ba3c0=_0x3ba3c0-0x0;var _0x574ae9=_0xa3e4[_0x3ba3c0];return _0x574ae9;};'use strict';var _=require(_0x4a3e('0x0'));var util=require('util');var moment=require(_0x4a3e('0x1'));var BPromise=require(_0x4a3e('0x2'));var rs=require(_0x4a3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4a3e('0x4'));var logger=require(_0x4a3e('0x5'))(_0x4a3e('0x6'));var config=require('../../config/environment');var jayson=require(_0x4a3e('0x7'));var client=jayson[_0x4a3e('0x8')][_0x4a3e('0x9')]({'port':0x232a});config[_0x4a3e('0xa')]=_[_0x4a3e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4a3e('0xc'))(new Redis(config[_0x4a3e('0xa')]));require(_0x4a3e('0xd'))[_0x4a3e('0xe')](socket);function respondWithRpcPromise(_0x242007,_0xefba76,_0x45b4ff){return new BPromise(function(_0x37037b,_0x2861d0){return client['request'](_0x242007,_0x45b4ff)[_0x4a3e('0xf')](function(_0x2af040){logger[_0x4a3e('0x10')](_0x4a3e('0x11'),_0xefba76,'request\x20sent');logger[_0x4a3e('0x12')](_0x4a3e('0x13'),_0xefba76,_0x4a3e('0x14'),JSON['stringify'](_0x2af040));if(_0x2af040[_0x4a3e('0x15')]){if(_0x2af040[_0x4a3e('0x15')]['code']===0x1f4){logger[_0x4a3e('0x15')](_0x4a3e('0x11'),_0xefba76,_0x2af040[_0x4a3e('0x15')]['message']);return _0x2861d0(_0x2af040['error'][_0x4a3e('0x16')]);}logger[_0x4a3e('0x15')]('UserNotification,\x20%s,\x20%s',_0xefba76,_0x2af040[_0x4a3e('0x15')]['message']);return _0x37037b(_0x2af040['error']['message']);}else{logger[_0x4a3e('0x10')](_0x4a3e('0x11'),_0xefba76,'request\x20sent');_0x37037b(_0x2af040['result'][_0x4a3e('0x16')]);}})[_0x4a3e('0x17')](function(_0x27a8bd){logger[_0x4a3e('0x15')](_0x4a3e('0x11'),_0xefba76,_0x27a8bd);_0x2861d0(_0x27a8bd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 590cc42..4e2eb5b 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 _0x735f=['length','./userNotification.events','remove','update','emit','removeListener','register'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x735f,0x112));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xf735('0x0'));var events=['save',_0xf735('0x1'),_0xf735('0x2')];function createListener(_0x7e0b0e,_0x558409){return function(_0x37d3f8){_0x558409[_0xf735('0x3')](_0x7e0b0e,_0x37d3f8);};}function removeListener(_0x4de7e6,_0x3f0643){return function(){UserNotificationEvents[_0xf735('0x4')](_0x4de7e6,_0x3f0643);};}exports[_0xf735('0x5')]=function(_0x4cabaf){for(var _0x566ff0=0x0,_0x410df3=events[_0xf735('0x6')];_0x566ff0<_0x410df3;_0x566ff0++){var _0x30ad1b=events[_0x566ff0];var _0x3709ed=createListener('userNotification:'+_0x30ad1b,_0x4cabaf);UserNotificationEvents['on'](_0x30ad1b,_0x3709ed);}}; \ No newline at end of file +var _0x57f0=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x3218f7,_0x8af5e2){var _0x3fdf19=function(_0x18a522){while(--_0x18a522){_0x3218f7['push'](_0x3218f7['shift']());}};_0x3fdf19(++_0x8af5e2);}(_0x57f0,0x77));var _0x057f=function(_0x2cdc34,_0x15e0c1){_0x2cdc34=_0x2cdc34-0x0;var _0x2be714=_0x57f0[_0x2cdc34];return _0x2be714;};'use strict';var UserNotificationEvents=require(_0x057f('0x0'));var events=[_0x057f('0x1'),_0x057f('0x2'),_0x057f('0x3')];function createListener(_0x442b42,_0x4b541c){return function(_0x17dd5b){_0x4b541c[_0x057f('0x4')](_0x442b42,_0x17dd5b);};}function removeListener(_0x5285ee,_0x1f8db2){return function(){UserNotificationEvents[_0x057f('0x5')](_0x5285ee,_0x1f8db2);};}exports[_0x057f('0x6')]=function(_0x1c2cac){for(var _0x39baac=0x0,_0x2b2f7e=events[_0x057f('0x7')];_0x39baac<_0x2b2f7e;_0x39baac++){var _0x26bea5=events[_0x39baac];var _0x383563=createListener(_0x057f('0x8')+_0x26bea5,_0x1c2cac);UserNotificationEvents['on'](_0x26bea5,_0x383563);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ef3a048..0487e17 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(_0x114135,_0x1636a0){var _0x7c7e22=function(_0x43cbf3){while(--_0x43cbf3){_0x114135['push'](_0x114135['shift']());}};_0x7c7e22(++_0x1636a0);}(_0x70e0,0x17b));var _0x070e=function(_0x4f9223,_0x330bf1){_0x4f9223=_0x4f9223-0x0;var _0x4165c5=_0x70e0[_0x4f9223];return _0x4165c5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 2f80bca..8f3ee40 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 _0xb905=['INTEGER','sequelize'];(function(_0x36c7f0,_0x294d21){var _0x23fd16=function(_0x2442ef){while(--_0x2442ef){_0x36c7f0['push'](_0x36c7f0['shift']());}};_0x23fd16(++_0x294d21);}(_0xb905,0xa7));var _0x5b90=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb905[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x5b90('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5b90('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b20=['exports','INTEGER','sequelize'];(function(_0x2203d0,_0x50c5a3){var _0x42244d=function(_0x29c079){while(--_0x29c079){_0x2203d0['push'](_0x2203d0['shift']());}};_0x42244d(++_0x50c5a3);}(_0x5b20,0x86));var _0x05b2=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5b20[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x05b2('0x0'));module[_0x05b2('0x1')]={'penalty':{'type':Sequelize[_0x05b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index ed28a50..5238d60 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 _0xc4f2=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment'];(function(_0xfa48f3,_0x3bce6c){var _0x47694f=function(_0x2431e8){while(--_0x2431e8){_0xfa48f3['push'](_0xfa48f3['shift']());}};_0x47694f(++_0x3bce6c);}(_0xc4f2,0xbc));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c4f('0x0'));var logger=require(_0x2c4f('0x1'))(_0x2c4f('0x2'));var moment=require(_0x2c4f('0x3'));var BPromise=require(_0x2c4f('0x4'));var rp=require(_0x2c4f('0x5'));var fs=require('fs');var path=require(_0x2c4f('0x6'));var rimraf=require(_0x2c4f('0x7'));var config=require(_0x2c4f('0x8'));var attributes=require(_0x2c4f('0x9'));module['exports']=function(_0x414065,_0x229bb5){return _0x414065['define'](_0x2c4f('0xa'),attributes,{'tableName':_0x2c4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46dd=['user_has_openchannel_queues','../../config/logger','moment','path','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue'];(function(_0x4d7de9,_0x51aaed){var _0x420d49=function(_0x3168de){while(--_0x3168de){_0x4d7de9['push'](_0x4d7de9['shift']());}};_0x420d49(++_0x51aaed);}(_0x46dd,0x91));var _0xd46d=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x46dd[_0x13ff53];return _0x290228;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd46d('0x0'))('api');var moment=require(_0xd46d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46d('0x2'));var rimraf=require('rimraf');var config=require(_0xd46d('0x3'));var attributes=require(_0xd46d('0x4'));module[_0xd46d('0x5')]=function(_0x271526,_0x140638){return _0x271526['define'](_0xd46d('0x6'),attributes,{'tableName':_0xd46d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0409668..bf5f29c 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 _0xf3a1=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3e5bf0,_0x2e9af1){var _0x4b5b79=function(_0x56bb6e){while(--_0x56bb6e){_0x3e5bf0['push'](_0x3e5bf0['shift']());}};_0x4b5b79(++_0x2e9af1);}(_0xf3a1,0x6e));var _0x1f3a=function(_0xdf34cc,_0x223241){_0xdf34cc=_0xdf34cc-0x0;var _0x510795=_0xf3a1[_0xdf34cc];return _0x510795;};'use strict';var _=require(_0x1f3a('0x0'));var util=require(_0x1f3a('0x1'));var moment=require(_0x1f3a('0x2'));var BPromise=require(_0x1f3a('0x3'));var rs=require(_0x1f3a('0x4'));var fs=require('fs');var Redis=require(_0x1f3a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1f3a('0x6'));var config=require(_0x1f3a('0x7'));var jayson=require(_0x1f3a('0x8'));var client=jayson[_0x1f3a('0x9')][_0x1f3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe7f116,_0x142bcc,_0x300bee){return new BPromise(function(_0x492ac3,_0x573c84){return client['request'](_0xe7f116,_0x300bee)[_0x1f3a('0xb')](function(_0x27c081){logger[_0x1f3a('0xc')](_0x1f3a('0xd'),_0x142bcc,_0x1f3a('0xe'));logger[_0x1f3a('0xf')](_0x1f3a('0x10'),_0x142bcc,_0x1f3a('0xe'),JSON[_0x1f3a('0x11')](_0x27c081));if(_0x27c081[_0x1f3a('0x12')]){if(_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x13')]===0x1f4){logger[_0x1f3a('0x12')](_0x1f3a('0xd'),_0x142bcc,_0x27c081['error']['message']);return _0x573c84(_0x27c081[_0x1f3a('0x12')]['message']);}logger[_0x1f3a('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x142bcc,_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x14')]);return _0x492ac3(_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x14')]);}else{logger[_0x1f3a('0xc')](_0x1f3a('0xd'),_0x142bcc,_0x1f3a('0xe'));_0x492ac3(_0x27c081[_0x1f3a('0x15')][_0x1f3a('0x14')]);}})['catch'](function(_0x25ada4){logger[_0x1f3a('0x12')](_0x1f3a('0xd'),_0x142bcc,_0x25ada4);_0x573c84(_0x25ada4);});});} \ No newline at end of file +var _0x413a=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x48de25,_0x488051){var _0xdaeb9d=function(_0x44a364){while(--_0x44a364){_0x48de25['push'](_0x48de25['shift']());}};_0xdaeb9d(++_0x488051);}(_0x413a,0x11a));var _0xa413=function(_0x288ec7,_0x5511b2){_0x288ec7=_0x288ec7-0x0;var _0x39d0db=_0x413a[_0x288ec7];return _0x39d0db;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa413('0x0'));var BPromise=require(_0xa413('0x1'));var rs=require(_0xa413('0x2'));var fs=require('fs');var Redis=require(_0xa413('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa413('0x4'));var logger=require(_0xa413('0x5'))(_0xa413('0x6'));var config=require('../../config/environment');var jayson=require(_0xa413('0x7'));var client=jayson[_0xa413('0x8')][_0xa413('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d0464,_0x1c7f0d,_0x53657c){return new BPromise(function(_0x25f8c6,_0x52b8c4){return client['request'](_0x8d0464,_0x53657c)[_0xa413('0xa')](function(_0x10ac0f){logger[_0xa413('0xb')](_0xa413('0xc'),_0x1c7f0d,_0xa413('0xd'));logger['debug'](_0xa413('0xe'),_0x1c7f0d,_0xa413('0xd'),JSON[_0xa413('0xf')](_0x10ac0f));if(_0x10ac0f[_0xa413('0x10')]){if(_0x10ac0f[_0xa413('0x10')][_0xa413('0x11')]===0x1f4){logger[_0xa413('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1c7f0d,_0x10ac0f[_0xa413('0x10')]['message']);return _0x52b8c4(_0x10ac0f[_0xa413('0x10')][_0xa413('0x12')]);}logger[_0xa413('0x10')](_0xa413('0xc'),_0x1c7f0d,_0x10ac0f['error']['message']);return _0x25f8c6(_0x10ac0f[_0xa413('0x10')]['message']);}else{logger[_0xa413('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1c7f0d,'request\x20sent');_0x25f8c6(_0x10ac0f[_0xa413('0x13')][_0xa413('0x12')]);}})[_0xa413('0x14')](function(_0x2b3888){logger[_0xa413('0x10')](_0xa413('0xc'),_0x1c7f0d,_0x2b3888);_0x52b8c4(_0x2b3888);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9703339..074ac39 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 _0x7794=['removeSections','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/sections','/:id/resources','getResources','post','create','clone','addSections','put','update','delete','destroy'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x7794,0x16a));var _0x4779=function(_0x455453,_0x3ed4b3){_0x455453=_0x455453-0x0;var _0x5174b4=_0x7794[_0x455453];return _0x5174b4;};'use strict';var multer=require('multer');var util=require(_0x4779('0x0'));var path=require(_0x4779('0x1'));var timeout=require('connect-timeout');var express=require(_0x4779('0x2'));var router=express['Router']();var fs_extra=require(_0x4779('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4779('0x4'));var config=require(_0x4779('0x5'));var controller=require('./userProfile.controller');router[_0x4779('0x6')]('/',auth[_0x4779('0x7')](),controller[_0x4779('0x8')]);router['get']('/describe',auth[_0x4779('0x7')](),controller[_0x4779('0x9')]);router[_0x4779('0x6')](_0x4779('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4779('0xb'),auth['isAuthenticated'](),controller['getSections']);router[_0x4779('0x6')](_0x4779('0xc'),auth[_0x4779('0x7')](),controller[_0x4779('0xd')]);router[_0x4779('0xe')]('/',auth['isAuthenticated'](),controller[_0x4779('0xf')]);router['post']('/:id/clone',auth[_0x4779('0x7')](),controller[_0x4779('0x10')]);router['post'](_0x4779('0xb'),auth[_0x4779('0x7')](),controller[_0x4779('0x11')]);router['post']('/:id/resources',auth[_0x4779('0x7')](),controller['addResources']);router[_0x4779('0x12')](_0x4779('0xa'),auth[_0x4779('0x7')](),controller[_0x4779('0x13')]);router[_0x4779('0x14')]('/:id',auth[_0x4779('0x7')](),controller[_0x4779('0x15')]);router[_0x4779('0x14')](_0x4779('0xb'),auth[_0x4779('0x7')](),controller[_0x4779('0x16')]);router[_0x4779('0x14')](_0x4779('0xc'),auth[_0x4779('0x7')](),controller['removeResources']);module[_0x4779('0x17')]=router; \ No newline at end of file +var _0x3fb5=['/:id/clone','addSections','addResources','put','update','delete','destroy','/:id/sections','removeSections','/:id/resources','removeResources','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','getSections','getResources','post'];(function(_0x479eba,_0x528986){var _0x34487b=function(_0xae9198){while(--_0xae9198){_0x479eba['push'](_0x479eba['shift']());}};_0x34487b(++_0x528986);}(_0x3fb5,0x73));var _0x53fb=function(_0x5bea0d,_0x21f680){_0x5bea0d=_0x5bea0d-0x0;var _0xa7734c=_0x3fb5[_0x5bea0d];return _0xa7734c;};'use strict';var multer=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var path=require(_0x53fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x53fb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x53fb('0x4'));var interaction=require(_0x53fb('0x5'));var config=require(_0x53fb('0x6'));var controller=require('./userProfile.controller');router[_0x53fb('0x7')]('/',auth['isAuthenticated'](),controller[_0x53fb('0x8')]);router[_0x53fb('0x7')]('/describe',auth[_0x53fb('0x9')](),controller[_0x53fb('0xa')]);router[_0x53fb('0x7')](_0x53fb('0xb'),auth[_0x53fb('0x9')](),controller['show']);router[_0x53fb('0x7')]('/:id/sections',auth['isAuthenticated'](),controller[_0x53fb('0xc')]);router[_0x53fb('0x7')]('/:id/resources',auth['isAuthenticated'](),controller[_0x53fb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x53fb('0xe')](_0x53fb('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x53fb('0xe')]('/:id/sections',auth['isAuthenticated'](),controller[_0x53fb('0x10')]);router['post']('/:id/resources',auth[_0x53fb('0x9')](),controller[_0x53fb('0x11')]);router[_0x53fb('0x12')]('/:id',auth[_0x53fb('0x9')](),controller[_0x53fb('0x13')]);router[_0x53fb('0x14')]('/:id',auth[_0x53fb('0x9')](),controller[_0x53fb('0x15')]);router[_0x53fb('0x14')](_0x53fb('0x16'),auth[_0x53fb('0x9')](),controller[_0x53fb('0x17')]);router[_0x53fb('0x14')](_0x53fb('0x18'),auth[_0x53fb('0x9')](),controller[_0x53fb('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 66bc8b6..85fccc9 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 _0xb934=['setDataValue','crudPermissions','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb934,0x164));var _0x4b93=function(_0x3fe2b1,_0x967d3b){_0x3fe2b1=_0x3fe2b1-0x0;var _0xeff4db=_0xb934[_0x3fe2b1];return _0xeff4db;};'use strict';var Sequelize=require(_0x4b93('0x0'));module[_0x4b93('0x1')]={'name':{'type':Sequelize[_0x4b93('0x2')],'allowNull':![],'unique':_0x4b93('0x3')},'crudPermissions':{'type':Sequelize[_0x4b93('0x2')],'set':function(_0x56b232){this[_0x4b93('0x4')](_0x4b93('0x5'),_0x56b232?_0x56b232['join'](''):[]);},'get':function(){return this[_0x4b93('0x6')]('crudPermissions')?this[_0x4b93('0x6')](_0x4b93('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4b93('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9872=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x9872,0xb7));var _0x2987=function(_0x4d31a5,_0x3592c0){_0x4d31a5=_0x4d31a5-0x0;var _0x2d2011=_0x9872[_0x4d31a5];return _0x2d2011;};'use strict';var Sequelize=require('sequelize');module[_0x2987('0x0')]={'name':{'type':Sequelize[_0x2987('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2987('0x1')],'set':function(_0x5d9599){this[_0x2987('0x2')](_0x2987('0x3'),_0x5d9599?_0x5d9599[_0x2987('0x4')](''):[]);},'get':function(){return this[_0x2987('0x5')]('crudPermissions')?this[_0x2987('0x5')](_0x2987('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2987('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2987('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2987('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c6478c2..f11fc70 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 _0x4910=['enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','error','send','map','rawAttributes','fieldName','type','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','UserProfile','includeAll','include','findAll','then','rows','catch','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','params','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','UserProfileSection','push','removeSections','ids','getSections','includes','isEmpty','subsections'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4910,0x1d9));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x0491('0x0'));var rimraf=require(_0x0491('0x1'));var zipdir=require(_0x0491('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0491('0x3'));var moment=require(_0x0491('0x4'));var BPromise=require(_0x0491('0x5'));var Mustache=require(_0x0491('0x6'));var util=require(_0x0491('0x7'));var path=require('path');var sox=require(_0x0491('0x8'));var csv=require(_0x0491('0x9'));var ejs=require(_0x0491('0xa'));var fs=require('fs');var fs_extra=require(_0x0491('0xb'));var _=require(_0x0491('0xc'));var squel=require('squel');var crypto=require(_0x0491('0xd'));var jsforce=require(_0x0491('0xe'));var deskjs=require(_0x0491('0xf'));var toCsv=require(_0x0491('0x9'));var querystring=require(_0x0491('0x10'));var Papa=require('papaparse');var Redis=require(_0x0491('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0491('0x12'));var as=require(_0x0491('0x13'));var hardwareService=require(_0x0491('0x14'));var logger=require(_0x0491('0x15'))(_0x0491('0x16'));var utils=require(_0x0491('0x17'));var config=require(_0x0491('0x18'));var licenseUtil=require(_0x0491('0x19'));var db=require(_0x0491('0x1a'))['db'];config[_0x0491('0x1b')]=_['defaults'](config[_0x0491('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0491('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x0491('0x1d')](socket);function respondWithStatusCode(_0x7ba36,_0x439f5c){_0x439f5c=_0x439f5c||0xcc;return function(_0x2f1a37){if(_0x2f1a37){return _0x7ba36[_0x0491('0x1e')](_0x439f5c);}return _0x7ba36[_0x0491('0x1f')](_0x439f5c)[_0x0491('0x20')]();};}function respondWithResult(_0xbd94bd,_0xf12423){_0xf12423=_0xf12423||0xc8;return function(_0x1411a6){if(_0x1411a6){return _0xbd94bd['status'](_0xf12423)[_0x0491('0x21')](_0x1411a6);}};}function respondWithFilteredResult(_0x1cf288,_0x12990a){return function(_0x31bc2c){if(_0x31bc2c){var _0x3b536e=typeof _0x12990a[_0x0491('0x22')]==='undefined'&&typeof _0x12990a[_0x0491('0x23')]===_0x0491('0x24');var _0x4e94f8=_0x31bc2c['count'];var _0x1ba594=_0x3b536e?0x0:_0x12990a['offset'];var _0x6f8139=_0x3b536e?_0x31bc2c[_0x0491('0x25')]:_0x12990a['offset']+_0x12990a[_0x0491('0x23')];var _0x22776d;if(_0x6f8139>=_0x4e94f8){_0x6f8139=_0x4e94f8;_0x22776d=0xc8;}else{_0x22776d=0xce;}_0x1cf288[_0x0491('0x1f')](_0x22776d);return _0x1cf288[_0x0491('0x26')]('Content-Range',_0x1ba594+'-'+_0x6f8139+'/'+_0x4e94f8)[_0x0491('0x21')](_0x31bc2c);}return null;};}function patchUpdates(_0x358117){return function(_0x1fb8a5){try{jsonpatch['apply'](_0x1fb8a5,_0x358117,!![]);}catch(_0x1498c2){return BPromise[_0x0491('0x27')](_0x1498c2);}return _0x1fb8a5[_0x0491('0x28')]();};}function saveUpdates(_0x1934a0,_0x30ad41){return function(_0xdda718){if(_0xdda718){return _0xdda718[_0x0491('0x29')](_0x1934a0)['then'](function(_0x7c03ef){return _0x7c03ef;});}return null;};}function removeEntity(_0x4a39f0,_0xc0c021){return function(_0x93bc14){if(_0x93bc14){return _0x93bc14[_0x0491('0x2a')]()['then'](function(){_0x4a39f0[_0x0491('0x1f')](0xcc)[_0x0491('0x20')]();});}};}function handleEntityNotFound(_0x59beec,_0x2d13c4){return function(_0xe0e31e){if(!_0xe0e31e){_0x59beec[_0x0491('0x1e')](0x194);}return _0xe0e31e;};}function handleError(_0x2c3f39,_0x3ec059){_0x3ec059=_0x3ec059||0x1f4;return function(_0x38b4b8){logger[_0x0491('0x2b')](_0x38b4b8['stack']);if(_0x38b4b8['name']){delete _0x38b4b8['name'];}_0x2c3f39['status'](_0x3ec059)[_0x0491('0x2c')](_0x38b4b8);};}exports['index']=function(_0x46d432,_0xb82361){var _0x3b66d0={},_0x7d4feb={},_0x2e3223={'count':0x0,'rows':[]};var _0x18278b=_[_0x0491('0x2d')](db['UserProfile'][_0x0491('0x2e')],function(_0x133d37){return{'name':_0x133d37[_0x0491('0x2f')],'type':_0x133d37[_0x0491('0x30')]['key']};});_0x7d4feb['model']=_['map'](_0x18278b,_0x0491('0x31'));_0x7d4feb['query']=_[_0x0491('0x32')](_0x46d432[_0x0491('0x33')]);_0x7d4feb[_0x0491('0x34')]=_[_0x0491('0x35')](_0x7d4feb[_0x0491('0x36')],_0x7d4feb[_0x0491('0x33')]);_0x3b66d0[_0x0491('0x37')]=_[_0x0491('0x35')](_0x7d4feb['model'],qs[_0x0491('0x38')](_0x46d432['query'][_0x0491('0x38')]));_0x3b66d0[_0x0491('0x37')]=_0x3b66d0['attributes'][_0x0491('0x39')]?_0x3b66d0['attributes']:_0x7d4feb[_0x0491('0x36')];if(!_0x46d432[_0x0491('0x33')][_0x0491('0x3a')](_0x0491('0x3b'))){_0x3b66d0['limit']=qs['limit'](_0x46d432[_0x0491('0x33')][_0x0491('0x23')]);_0x3b66d0[_0x0491('0x22')]=qs['offset'](_0x46d432[_0x0491('0x33')]['offset']);}_0x3b66d0[_0x0491('0x3c')]=qs['sort'](_0x46d432[_0x0491('0x33')][_0x0491('0x3d')]);_0x3b66d0[_0x0491('0x3e')]=qs['filters'](_['pick'](_0x46d432[_0x0491('0x33')],_0x7d4feb[_0x0491('0x34')]),_0x18278b);if(_0x46d432[_0x0491('0x33')]['filter']){_0x3b66d0['where']=_[_0x0491('0x3f')](_0x3b66d0[_0x0491('0x3e')],{'$or':_[_0x0491('0x2d')](_0x18278b,function(_0xd58fa7){if(_0xd58fa7[_0x0491('0x30')]!==_0x0491('0x40')){var _0x36c305={};_0x36c305[_0xd58fa7['name']]={'$like':'%'+_0x46d432[_0x0491('0x33')][_0x0491('0x41')]+'%'};return _0x36c305;}})});}_0x3b66d0=_['merge']({},_0x3b66d0,_0x46d432[_0x0491('0x42')]);var _0x2e7566={'where':_0x3b66d0[_0x0491('0x3e')]};return db[_0x0491('0x43')][_0x0491('0x25')](_0x2e7566)['then'](function(_0xfdb977){_0x2e3223[_0x0491('0x25')]=_0xfdb977;if(_0x46d432[_0x0491('0x33')][_0x0491('0x44')]){_0x3b66d0[_0x0491('0x45')]=[{'all':!![]}];}return db[_0x0491('0x43')][_0x0491('0x46')](_0x3b66d0);})[_0x0491('0x47')](function(_0x20ead0){_0x2e3223[_0x0491('0x48')]=_0x20ead0;return _0x2e3223;})[_0x0491('0x47')](respondWithFilteredResult(_0xb82361,_0x3b66d0))[_0x0491('0x49')](handleError(_0xb82361,null));};exports['show']=function(_0x51c997,_0x25439c){var _0x4af10d={'raw':![],'where':{'id':_0x51c997['params']['id']}},_0x5dc807={};_0x5dc807['model']=_[_0x0491('0x32')](db['UserProfile'][_0x0491('0x2e')]);_0x5dc807[_0x0491('0x33')]=_[_0x0491('0x32')](_0x51c997['query']);_0x5dc807[_0x0491('0x34')]=_['intersection'](_0x5dc807[_0x0491('0x36')],_0x5dc807['query']);_0x4af10d[_0x0491('0x37')]=_[_0x0491('0x35')](_0x5dc807[_0x0491('0x36')],qs[_0x0491('0x38')](_0x51c997[_0x0491('0x33')][_0x0491('0x38')]));_0x4af10d[_0x0491('0x37')]=_0x4af10d[_0x0491('0x37')][_0x0491('0x39')]?_0x4af10d[_0x0491('0x37')]:_0x5dc807[_0x0491('0x36')];if(_0x51c997[_0x0491('0x33')][_0x0491('0x44')]){_0x4af10d['include']=[{'all':!![]}];}_0x4af10d=_[_0x0491('0x3f')]({},_0x4af10d,_0x51c997[_0x0491('0x42')]);return db[_0x0491('0x43')][_0x0491('0x4a')](_0x4af10d)[_0x0491('0x47')](handleEntityNotFound(_0x25439c,null))[_0x0491('0x47')](respondWithResult(_0x25439c,null))['catch'](handleError(_0x25439c,null));};exports[_0x0491('0x4b')]=function(_0x27fc82,_0x198312){return db[_0x0491('0x43')]['create'](_0x27fc82['body'],{})[_0x0491('0x47')](respondWithResult(_0x198312,0xc9))[_0x0491('0x49')](handleError(_0x198312,null));};exports[_0x0491('0x4c')]=function(_0x563c4f,_0x6dd643){var _0x584f74={'where':{'id':_0x563c4f['params']['id']}},_0x129f9c={};_0x129f9c[_0x0491('0x36')]=_[_0x0491('0x32')](db[_0x0491('0x43')][_0x0491('0x2e')]);_0x584f74[_0x0491('0x37')]=_['intersection'](_0x129f9c[_0x0491('0x36')],qs['fields'](_0x563c4f['query'][_0x0491('0x38')]));_0x584f74[_0x0491('0x37')]=_0x584f74[_0x0491('0x37')][_0x0491('0x39')]?_0x584f74[_0x0491('0x37')]:_0x129f9c[_0x0491('0x36')];if(_0x563c4f[_0x0491('0x33')][_0x0491('0x44')]){_0x584f74['include']=[{'all':!![]}];}_0x584f74=_[_0x0491('0x3f')]({},_0x584f74,_0x563c4f[_0x0491('0x42')]);return db[_0x0491('0x43')][_0x0491('0x4a')](_0x584f74)[_0x0491('0x47')](handleEntityNotFound(_0x6dd643,null))['then'](function(_0x9a980e){if(_0x9a980e){var _0x225a34=_0x9a980e[_0x0491('0x4d')]({'plain':!![]});_0x225a34=qs[_0x0491('0x4e')](_0x225a34,['id',_0x0491('0x4f'),_0x0491('0x50'),_0x0491('0x51')]);_0x563c4f[_0x0491('0x52')]=_['omit'](_0x563c4f[_0x0491('0x52')],['id',_0x0491('0x4f'),_0x0491('0x50')]);return db[_0x0491('0x53')][_0x0491('0x54')](function(_0x112f8b){return db[_0x0491('0x43')][_0x0491('0x4b')](_[_0x0491('0x3f')](_0x225a34,_0x563c4f['body']),{'include':_0x563c4f[_0x0491('0x33')][_0x0491('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x112f8b})[_0x0491('0x47')](function(_0x260d06){var _0x5a97ae=_0x260d06['get']({'plain':!![]});return db['UserProfileSection'][_0x0491('0x46')]({'where':{'userProfileId':_0x563c4f[_0x0491('0x55')]['id']},'raw':!![]})['then'](function(_0x472b68){if(_0x472b68){return BPromise[_0x0491('0x56')](_0x472b68,function(_0x4bb695){return new BPromise(function(_0x9802a9,_0x28b3ce){if(_0x4bb695[_0x0491('0x57')]===null||_0x4bb695[_0x0491('0x57')]===0x1)_0x9802a9(null);return db[_0x0491('0x58')]['findAll']({'where':{'sectionId':_0x4bb695['id']},'raw':!![]})[_0x0491('0x47')](function(_0x4b3df8){var _0x4ea662=_[_0x0491('0x2d')](_0x4b3df8,function(_0x3527f4){return qs[_0x0491('0x4e')](_0x3527f4,['id','createdAt',_0x0491('0x50'),_0x0491('0x59')]);});_0x9802a9(_0x4ea662);})['catch'](function(_0x1b439e){_0x28b3ce(_0x1b439e);});})[_0x0491('0x47')](function(_0x2f840d){var _0x3427ef=qs[_0x0491('0x4e')](_0x4bb695,['id',_0x0491('0x4f'),_0x0491('0x50')]);_0x3427ef['userProfileId']=_0x5a97ae['id'];if(_0x2f840d)_0x3427ef['Resources']=_0x2f840d;return _0x3427ef;})[_0x0491('0x47')](function(_0x11de4c){return db['UserProfileSection'][_0x0491('0x4b')](_0x11de4c,{'include':[{'model':db[_0x0491('0x58')],'as':_0x0491('0x5a')}],'raw':!![],'transaction':_0x112f8b});});})[_0x0491('0x47')](function(){return _0x5a97ae;});}});});});}})[_0x0491('0x47')](respondWithResult(_0x6dd643,0xc9))[_0x0491('0x49')](handleError(_0x6dd643,null));};exports['update']=function(_0x2c41ec,_0x3c4a45){if(_0x2c41ec[_0x0491('0x52')]['id']){delete _0x2c41ec[_0x0491('0x52')]['id'];}return db['UserProfile'][_0x0491('0x4a')]({'where':{'id':_0x2c41ec[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x3c4a45,null))[_0x0491('0x47')](saveUpdates(_0x2c41ec['body'],null))[_0x0491('0x47')](respondWithResult(_0x3c4a45,null))[_0x0491('0x49')](handleError(_0x3c4a45,null));};exports[_0x0491('0x2a')]=function(_0x2b3cf9,_0x1fe684){return db['UserProfile']['find']({'where':{'id':_0x2b3cf9['params']['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x1fe684,null))[_0x0491('0x47')](removeEntity(_0x1fe684,null))[_0x0491('0x49')](handleError(_0x1fe684,null));};exports[_0x0491('0x5b')]=function(_0x4236e5,_0x4344dd){return db[_0x0491('0x43')]['describe']()[_0x0491('0x47')](respondWithResult(_0x4344dd,null))['catch'](handleError(_0x4344dd,null));};exports[_0x0491('0x5c')]=function(_0x2e9cc3,_0x6f2731){var _0xe4af61=_0x2e9cc3[_0x0491('0x52')];return db['UserProfile'][_0x0491('0x4a')]({'where':{'id':_0x2e9cc3[_0x0491('0x55')]['id']}})['then'](handleEntityNotFound(_0x6f2731,null))['then'](function(_0x143104){if(_0x143104){return db[_0x0491('0x53')]['transaction'](function(_0x1cf948){return db['UserProfileSection'][_0x0491('0x2a')]({'where':{'userProfileId':_0x2e9cc3[_0x0491('0x55')]['id'],'sectionId':_[_0x0491('0x2d')](_0xe4af61,function(_0xd5aed4){return _0xd5aed4[_0x0491('0x59')];})},'transaction':_0x1cf948})['then'](function(){var _0x1ee5af=_[_0x0491('0x2d')](_0xe4af61,function(_0x22bb76){_0x22bb76[_0x0491('0x5d')]=_0x2e9cc3[_0x0491('0x55')]['id'];return _0x22bb76;});var _0x1d2772=[];return BPromise[_0x0491('0x56')](_0x1ee5af,function(_0x477ef4){return db[_0x0491('0x5e')][_0x0491('0x4b')](_0x477ef4,{'include':[{'model':db[_0x0491('0x58')],'as':_0x0491('0x5a')}],'raw':!![],'transaction':_0x1cf948})['then'](function(_0x3e0903){_0x1d2772[_0x0491('0x5f')](_0x3e0903[_0x0491('0x4d')]({'plain':!![]}));});})[_0x0491('0x47')](function(){return _0x1d2772;});});});}})[_0x0491('0x47')](function(_0x13e7e1){return _0x13e7e1;})[_0x0491('0x47')](respondWithResult(_0x6f2731,null))[_0x0491('0x49')](handleError(_0x6f2731,null));};exports[_0x0491('0x60')]=function(_0x56f608,_0x361252){var _0x24899e;return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x56f608[_0x0491('0x55')]['id']},'attributes':['id',_0x0491('0x31')]})[_0x0491('0x47')](handleEntityNotFound(_0x361252,null))['then'](function(_0x1b651d){if(_0x1b651d){_0x24899e=_0x1b651d;return db[_0x0491('0x5e')][_0x0491('0x2a')]({'where':{'userProfileId':_0x56f608[_0x0491('0x55')]['id'],'sectionId':_0x56f608['query'][_0x0491('0x61')]}});}})[_0x0491('0x47')](function(){return _0x24899e;})[_0x0491('0x47')](respondWithStatusCode(_0x361252,null))['catch'](handleError(_0x361252,null));};exports[_0x0491('0x62')]=function(_0x502d27,_0x30008b){var _0x1b2115=[];var _0x393aa5=[];return db[_0x0491('0x5e')][_0x0491('0x46')]({'where':{'userProfileId':_0x502d27['params']['id']},'raw':!![]})['then'](function(_0x4daffd){_0x1b2115=_['filter'](_0x4daffd,function(_0x2ff034){return _0x2ff034['enabled']===0x1||_[_0x0491('0x63')]([0x3eb,0x709],_0x2ff034['sectionId']);});if(!_[_0x0491('0x64')](_0x1b2115)){return _['map'](_0x1b2115,function(_0x3170f4){return _0x3170f4['sectionId'];});}else{return;}})[_0x0491('0x47')](function(_0x1a455e){if(_0x1a455e)_0x393aa5=_0x1a455e;if(_[_0x0491('0x63')](_0x393aa5,0x64)){var _0xae356c=_['find'](_0x1b2115,{'sectionId':0x64});return hasDefaultDashboard(_0xae356c)[_0x0491('0x47')](function(_0x1e4487){return _[_0x0491('0x2d')](_0x1b2115,function(_0x58e77b){if(_0x58e77b[_0x0491('0x59')]===0x64){_0x58e77b[_0x0491('0x65')]=_0x1e4487;}return _0x58e77b;});});}else{return;}})[_0x0491('0x47')](function(_0x18bd6a){if(_0x18bd6a)_0x1b2115=_0x18bd6a;if(_[_0x0491('0x63')](_0x393aa5,0x3eb)){var _0x4dac50=_[_0x0491('0x4a')](_0x1b2115,{'sectionId':0x3eb});return getCustomDashboards(_0x4dac50)['then'](function(_0x29e671){return _[_0x0491('0x2d')](_0x1b2115,function(_0x2eeb61){if(_0x4dac50['enabled']){if(_0x2eeb61[_0x0491('0x59')]===0x3eb){_0x2eeb61[_0x0491('0x65')]=_0x29e671;}}else{if(_0x2eeb61[_0x0491('0x59')]===0x64){_0x2eeb61[_0x0491('0x65')]=_0x29e671;}}return _0x2eeb61;});});}else{return;}})[_0x0491('0x47')](function(_0x14ded9){if(_0x14ded9)_0x1b2115=_0x14ded9;if(_[_0x0491('0x63')](_0x393aa5,0x709)){var _0x36e0a0=_['find'](_0x1b2115,{'sectionId':0x709});return getPlugins(_0x36e0a0)[_0x0491('0x47')](function(_0x393832){if(_0x36e0a0['enabled']){return _[_0x0491('0x2d')](_0x1b2115,function(_0x4eb0d9){if(_0x4eb0d9['sectionId']===0x709){_0x4eb0d9['subsections']=_0x393832;}return _0x4eb0d9;});}else{var _0x469733={'sectionId':0x76c,'enabled':0x1,'subsections':_0x393832};var _0x3f2d2a=_[_0x0491('0x2d')](_0x1b2115);_0x3f2d2a[_0x0491('0x5f')](_0x469733);return _0x3f2d2a;}});}else{return;}})['then'](function(_0x50e2de){if(_0x50e2de)_0x1b2115=_0x50e2de;return _[_0x0491('0x41')](_0x1b2115,[_0x0491('0x66'),0x1]);})[_0x0491('0x47')](respondWithResult(_0x30008b,null))[_0x0491('0x49')](handleError(_0x30008b,null));};function hasDefaultDashboard(_0x148359){var _0x52ac40=[0x65];return new BPromise(function(_0x42d8ad,_0xf52e3b){try{if(_0x148359[_0x0491('0x57')]){_0x42d8ad(_0x52ac40);}else{return db[_0x0491('0x58')][_0x0491('0x67')]({'where':{'sectionId':_0x148359['id']},'raw':!![]})[_0x0491('0x47')](function(_0x54d46a){_0x54d46a?_0x42d8ad(_0x52ac40):_0x42d8ad();});}}catch(_0x50c727){_0xf52e3b(_0x50c727);}});}function getCustomDashboards(_0x543699){var _0x52772b=[];return new BPromise(function(_0x5b91f5,_0x26ff9a){try{if(_0x543699[_0x0491('0x57')]){return db[_0x0491('0x68')]['findAll']({'raw':!![]})[_0x0491('0x47')](function(_0xfc37e0){_0xfc37e0[_0x0491('0x69')](function(_0x2540bd){_0x52772b[_0x0491('0x5f')](_0x2540bd['id']+0x1869f);});_0x5b91f5(_0x52772b);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x543699['id']},'raw':!![]})['then'](function(_0x458796){_0x458796['forEach'](function(_0x22309b){_0x52772b['push'](_0x22309b['resourceId']+0x1869f);});_0x5b91f5(_0x52772b);});}}catch(_0x1b7241){_0x26ff9a(_0x1b7241);}});}function getPlugins(_0x534752){var _0x270766=[];return new BPromise(function(_0x1e92f7,_0x5229d3){try{if(_0x534752['autoAssociation']){return db[_0x0491('0x6a')][_0x0491('0x46')]({'raw':!![]})['then'](function(_0x874976){_0x874976['forEach'](function(_0x4cd686){_0x270766[_0x0491('0x5f')](_0x4cd686['id']+0x15b38);});_0x1e92f7(_0x270766);});}else{return db[_0x0491('0x58')]['findAll']({'where':{'sectionId':_0x534752['id']},'raw':!![]})[_0x0491('0x47')](function(_0x4cbf5c){_0x4cbf5c[_0x0491('0x69')](function(_0x5a3682){_0x270766[_0x0491('0x5f')](_0x5a3682[_0x0491('0x6b')]+0x15b38);});_0x1e92f7(_0x270766);});}}catch(_0x35fd25){_0x5229d3(_0x35fd25);}});}exports[_0x0491('0x6c')]=function(_0x46320a,_0x2f9755){return db[_0x0491('0x43')]['find']({'where':{'id':_0x46320a[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x2f9755,null))[_0x0491('0x47')](function(_0x5a1deb){if(_0x5a1deb){return db['sequelize'][_0x0491('0x54')](function(_0x2eb1a3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x57795b){if(_0x57795b){return db[_0x0491('0x5e')]['destroy']({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id'],'id':_[_0x0491('0x2d')](_0x57795b,function(_0x3ae15f){return _0x3ae15f['id'];})},'transaction':_0x2eb1a3});}})[_0x0491('0x47')](function(_0x3a3cea){var _0x1648ab=_['map'](_0x46320a[_0x0491('0x52')],function(_0x42eaf8){_0x42eaf8[_0x0491('0x5d')]=_0x46320a[_0x0491('0x55')]['id'];return _0x42eaf8;});return db[_0x0491('0x5e')]['bulkCreate'](_0x1648ab,{'raw':!![],'transaction':_0x2eb1a3});})[_0x0491('0x47')](function(_0x4bbed5){var _0x8bd3a6=_[_0x0491('0x41')](_[_0x0491('0x2d')](_0x4bbed5,function(_0x2a7d5f){return _0x2a7d5f[_0x0491('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x8bd3a6){return db[_0x0491('0x5e')][_0x0491('0x46')]({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id'],'sectionId':_[_0x0491('0x2d')](_0x8bd3a6,function(_0x41761c){return _0x41761c[_0x0491('0x59')];})},'attributes':['id',_0x0491('0x59')],'raw':!![]})[_0x0491('0x47')](function(_0x4ed236){var _0x274a33=_['map'](_0x46320a[_0x0491('0x52')],function(_0x4d3265){_0x4d3265['userProfileId']=_0x46320a[_0x0491('0x55')]['id'];return _0x4d3265;});return db[_0x0491('0x58')][_0x0491('0x6d')](_0x274a33,{'raw':!![],'transaction':_0x2eb1a3});});}})[_0x0491('0x49')](handleError(_0x2f9755,null));});}})['then'](function(_0x5905e6){var _0x3d1d5e=_[_0x0491('0x2d')](_0x5905e6,function(_0x32cc17){return _0x32cc17[_0x0491('0x4d')]({'plain':!![]});});})[_0x0491('0x47')](respondWithResult(_0x2f9755,null))[_0x0491('0x49')](handleError(_0x2f9755,null));};exports[_0x0491('0x6e')]=function(_0x30ab30,_0x50638a,_0x2d3f32){return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x30ab30[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x50638a,null))[_0x0491('0x47')](function(_0x38b20b){if(_0x38b20b){return _0x38b20b['removeResources'](_0x30ab30[_0x0491('0x33')]['ids']);}})[_0x0491('0x47')](respondWithStatusCode(_0x50638a,null))['catch'](handleError(_0x50638a,null));};exports[_0x0491('0x6f')]=function(_0x360943,_0x3bc361){var _0x149cbe={};if(!_0x360943[_0x0491('0x33')][_0x0491('0x70')])throw new Error(_0x0491('0x71'));if(!_0x360943[_0x0491('0x33')][_0x0491('0x3a')](_0x0491('0x3b'))){_0x149cbe['limit']=qs[_0x0491('0x23')](_0x360943[_0x0491('0x33')][_0x0491('0x23')]);_0x149cbe[_0x0491('0x22')]=qs[_0x0491('0x22')](_0x360943[_0x0491('0x33')][_0x0491('0x22')]);}return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x360943[_0x0491('0x55')]['id']}})['then'](function(_0x4a9c5e){if(!_0x4a9c5e)throw new Error(_0x0491('0x72')+_0x360943['params']['id']);return db[_0x0491('0x43')][_0x0491('0x6f')](_0x360943);})['then'](respondWithFilteredResult(_0x3bc361,_0x149cbe))[_0x0491('0x49')](handleError(_0x3bc361,null));}; \ No newline at end of file +var _0x9264=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','then','include','findAll','rows','catch','show','includeAll','find','create','clone','params','options','get','omit','createdAt','body','updatedAt','sequelize','each','autoAssociation','sectionId','Resources','UserProfileSection','UserProfileResource','destroy','describe','addSections','transaction','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','error','name','send','index','map','UserProfile'];(function(_0x2822b3,_0x49842b){var _0x4b9178=function(_0x265ccd){while(--_0x265ccd){_0x2822b3['push'](_0x2822b3['shift']());}};_0x4b9178(++_0x49842b);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4926('0x0'));var rimraf=require(_0x4926('0x1'));var zipdir=require(_0x4926('0x2'));var jsonpatch=require(_0x4926('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4926('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4926('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4926('0x6'));var _=require(_0x4926('0x7'));var squel=require('squel');var crypto=require(_0x4926('0x8'));var jsforce=require(_0x4926('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4926('0xa'));var querystring=require(_0x4926('0xb'));var Papa=require(_0x4926('0xc'));var Redis=require('ioredis');var authService=require(_0x4926('0xd'));var qs=require(_0x4926('0xe'));var as=require(_0x4926('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4926('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4926('0x11'));var licenseUtil=require(_0x4926('0x12'));var db=require(_0x4926('0x13'))['db'];config['redis']=_[_0x4926('0x14')](config[_0x4926('0x15')],{'host':_0x4926('0x16'),'port':0x18eb});var socket=require(_0x4926('0x17'))(new Redis(config[_0x4926('0x15')]));require(_0x4926('0x18'))[_0x4926('0x19')](socket);function respondWithStatusCode(_0x1a280b,_0x21503d){_0x21503d=_0x21503d||0xcc;return function(_0x7782aa){if(_0x7782aa){return _0x1a280b[_0x4926('0x1a')](_0x21503d);}return _0x1a280b[_0x4926('0x1b')](_0x21503d)[_0x4926('0x1c')]();};}function respondWithResult(_0x1ac74f,_0x55b957){_0x55b957=_0x55b957||0xc8;return function(_0x1703ed){if(_0x1703ed){return _0x1ac74f[_0x4926('0x1b')](_0x55b957)[_0x4926('0x1d')](_0x1703ed);}};}function respondWithFilteredResult(_0x5736dd,_0x4d2cd3){return function(_0x1dd78e){if(_0x1dd78e){var _0x5630a8=typeof _0x4d2cd3[_0x4926('0x1e')]===_0x4926('0x1f')&&typeof _0x4d2cd3['limit']===_0x4926('0x1f');var _0x49461e=_0x1dd78e[_0x4926('0x20')];var _0x3d3fbc=_0x5630a8?0x0:_0x4d2cd3[_0x4926('0x1e')];var _0x2d6239=_0x5630a8?_0x1dd78e['count']:_0x4d2cd3['offset']+_0x4d2cd3[_0x4926('0x21')];var _0x588c7a;if(_0x2d6239>=_0x49461e){_0x2d6239=_0x49461e;_0x588c7a=0xc8;}else{_0x588c7a=0xce;}_0x5736dd['status'](_0x588c7a);return _0x5736dd[_0x4926('0x22')](_0x4926('0x23'),_0x3d3fbc+'-'+_0x2d6239+'/'+_0x49461e)['json'](_0x1dd78e);}return null;};}function patchUpdates(_0xfd1095){return function(_0x4792ac){try{jsonpatch[_0x4926('0x24')](_0x4792ac,_0xfd1095,!![]);}catch(_0x55e459){return BPromise[_0x4926('0x25')](_0x55e459);}return _0x4792ac[_0x4926('0x26')]();};}function saveUpdates(_0x2df18c,_0x44eb88){return function(_0x585b91){if(_0x585b91){return _0x585b91['update'](_0x2df18c)['then'](function(_0x1c02e7){return _0x1c02e7;});}return null;};}function removeEntity(_0xbfbe1b,_0x43c077){return function(_0x2519a2){if(_0x2519a2){return _0x2519a2['destroy']()['then'](function(){_0xbfbe1b['status'](0xcc)[_0x4926('0x1c')]();});}};}function handleEntityNotFound(_0x273f4b,_0x18f56d){return function(_0x4adb87){if(!_0x4adb87){_0x273f4b['sendStatus'](0x194);}return _0x4adb87;};}function handleError(_0x50004f,_0x37701c){_0x37701c=_0x37701c||0x1f4;return function(_0x3f06a3){logger[_0x4926('0x27')](_0x3f06a3['stack']);if(_0x3f06a3[_0x4926('0x28')]){delete _0x3f06a3[_0x4926('0x28')];}_0x50004f[_0x4926('0x1b')](_0x37701c)[_0x4926('0x29')](_0x3f06a3);};}exports[_0x4926('0x2a')]=function(_0x14cc3a,_0x5a44a9){var _0x39ad37={},_0x717a1a={},_0x32a6c2={'count':0x0,'rows':[]};var _0x14d8b8=_[_0x4926('0x2b')](db[_0x4926('0x2c')][_0x4926('0x2d')],function(_0x50ea49){return{'name':_0x50ea49[_0x4926('0x2e')],'type':_0x50ea49[_0x4926('0x2f')]['key']};});_0x717a1a[_0x4926('0x30')]=_[_0x4926('0x2b')](_0x14d8b8,_0x4926('0x28'));_0x717a1a[_0x4926('0x31')]=_[_0x4926('0x32')](_0x14cc3a[_0x4926('0x31')]);_0x717a1a[_0x4926('0x33')]=_[_0x4926('0x34')](_0x717a1a[_0x4926('0x30')],_0x717a1a[_0x4926('0x31')]);_0x39ad37[_0x4926('0x35')]=_[_0x4926('0x34')](_0x717a1a[_0x4926('0x30')],qs[_0x4926('0x36')](_0x14cc3a['query'][_0x4926('0x36')]));_0x39ad37[_0x4926('0x35')]=_0x39ad37[_0x4926('0x35')][_0x4926('0x37')]?_0x39ad37['attributes']:_0x717a1a[_0x4926('0x30')];if(!_0x14cc3a[_0x4926('0x31')][_0x4926('0x38')](_0x4926('0x39'))){_0x39ad37[_0x4926('0x21')]=qs['limit'](_0x14cc3a[_0x4926('0x31')][_0x4926('0x21')]);_0x39ad37[_0x4926('0x1e')]=qs['offset'](_0x14cc3a[_0x4926('0x31')][_0x4926('0x1e')]);}_0x39ad37[_0x4926('0x3a')]=qs[_0x4926('0x3b')](_0x14cc3a[_0x4926('0x31')][_0x4926('0x3b')]);_0x39ad37['where']=qs[_0x4926('0x33')](_[_0x4926('0x3c')](_0x14cc3a[_0x4926('0x31')],_0x717a1a[_0x4926('0x33')]),_0x14d8b8);if(_0x14cc3a[_0x4926('0x31')]['filter']){_0x39ad37[_0x4926('0x3d')]=_[_0x4926('0x3e')](_0x39ad37[_0x4926('0x3d')],{'$or':_[_0x4926('0x2b')](_0x14d8b8,function(_0x4ea503){if(_0x4ea503['type']!=='VIRTUAL'){var _0x2e74d9={};_0x2e74d9[_0x4ea503[_0x4926('0x28')]]={'$like':'%'+_0x14cc3a[_0x4926('0x31')][_0x4926('0x3f')]+'%'};return _0x2e74d9;}})});}_0x39ad37=_[_0x4926('0x3e')]({},_0x39ad37,_0x14cc3a['options']);var _0x5a8f61={'where':_0x39ad37['where']};return db['UserProfile'][_0x4926('0x20')](_0x5a8f61)[_0x4926('0x40')](function(_0x4380da){_0x32a6c2[_0x4926('0x20')]=_0x4380da;if(_0x14cc3a[_0x4926('0x31')]['includeAll']){_0x39ad37[_0x4926('0x41')]=[{'all':!![]}];}return db[_0x4926('0x2c')][_0x4926('0x42')](_0x39ad37);})[_0x4926('0x40')](function(_0x437800){_0x32a6c2[_0x4926('0x43')]=_0x437800;return _0x32a6c2;})[_0x4926('0x40')](respondWithFilteredResult(_0x5a44a9,_0x39ad37))[_0x4926('0x44')](handleError(_0x5a44a9,null));};exports[_0x4926('0x45')]=function(_0x39329b,_0x51427e){var _0x571efa={'raw':![],'where':{'id':_0x39329b['params']['id']}},_0x3428be={};_0x3428be[_0x4926('0x30')]=_[_0x4926('0x32')](db[_0x4926('0x2c')]['rawAttributes']);_0x3428be[_0x4926('0x31')]=_[_0x4926('0x32')](_0x39329b[_0x4926('0x31')]);_0x3428be[_0x4926('0x33')]=_[_0x4926('0x34')](_0x3428be[_0x4926('0x30')],_0x3428be[_0x4926('0x31')]);_0x571efa[_0x4926('0x35')]=_[_0x4926('0x34')](_0x3428be[_0x4926('0x30')],qs[_0x4926('0x36')](_0x39329b[_0x4926('0x31')][_0x4926('0x36')]));_0x571efa[_0x4926('0x35')]=_0x571efa[_0x4926('0x35')]['length']?_0x571efa[_0x4926('0x35')]:_0x3428be[_0x4926('0x30')];if(_0x39329b['query'][_0x4926('0x46')]){_0x571efa[_0x4926('0x41')]=[{'all':!![]}];}_0x571efa=_[_0x4926('0x3e')]({},_0x571efa,_0x39329b['options']);return db[_0x4926('0x2c')][_0x4926('0x47')](_0x571efa)[_0x4926('0x40')](handleEntityNotFound(_0x51427e,null))[_0x4926('0x40')](respondWithResult(_0x51427e,null))[_0x4926('0x44')](handleError(_0x51427e,null));};exports[_0x4926('0x48')]=function(_0x43764f,_0x12a89b){return db['UserProfile'][_0x4926('0x48')](_0x43764f['body'],{})['then'](respondWithResult(_0x12a89b,0xc9))[_0x4926('0x44')](handleError(_0x12a89b,null));};exports[_0x4926('0x49')]=function(_0x50d4b4,_0x3afe71){var _0x3ef8ec={'where':{'id':_0x50d4b4[_0x4926('0x4a')]['id']}},_0x37877f={};_0x37877f[_0x4926('0x30')]=_[_0x4926('0x32')](db['UserProfile']['rawAttributes']);_0x3ef8ec['attributes']=_['intersection'](_0x37877f[_0x4926('0x30')],qs[_0x4926('0x36')](_0x50d4b4[_0x4926('0x31')][_0x4926('0x36')]));_0x3ef8ec[_0x4926('0x35')]=_0x3ef8ec[_0x4926('0x35')]['length']?_0x3ef8ec[_0x4926('0x35')]:_0x37877f[_0x4926('0x30')];if(_0x50d4b4['query'][_0x4926('0x46')]){_0x3ef8ec[_0x4926('0x41')]=[{'all':!![]}];}_0x3ef8ec=_['merge']({},_0x3ef8ec,_0x50d4b4[_0x4926('0x4b')]);return db[_0x4926('0x2c')]['find'](_0x3ef8ec)[_0x4926('0x40')](handleEntityNotFound(_0x3afe71,null))['then'](function(_0x1b0b43){if(_0x1b0b43){var _0x691972=_0x1b0b43[_0x4926('0x4c')]({'plain':!![]});_0x691972=qs[_0x4926('0x4d')](_0x691972,['id',_0x4926('0x4e'),'updatedAt','crudPermissions']);_0x50d4b4[_0x4926('0x4f')]=_[_0x4926('0x4d')](_0x50d4b4['body'],['id',_0x4926('0x4e'),_0x4926('0x50')]);return db[_0x4926('0x51')]['transaction'](function(_0x22e537){return db[_0x4926('0x2c')][_0x4926('0x48')](_[_0x4926('0x3e')](_0x691972,_0x50d4b4['body']),{'include':_0x50d4b4['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x22e537})[_0x4926('0x40')](function(_0x391087){var _0x2efca4=_0x391087[_0x4926('0x4c')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x50d4b4['params']['id']},'raw':!![]})[_0x4926('0x40')](function(_0x113907){if(_0x113907){return BPromise[_0x4926('0x52')](_0x113907,function(_0x41e090){return new BPromise(function(_0x39c072,_0x5ad039){if(_0x41e090[_0x4926('0x53')]===null||_0x41e090[_0x4926('0x53')]===0x1)_0x39c072(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x41e090['id']},'raw':!![]})[_0x4926('0x40')](function(_0x27ef63){var _0x165d08=_[_0x4926('0x2b')](_0x27ef63,function(_0x48a4ec){return qs['omit'](_0x48a4ec,['id','createdAt',_0x4926('0x50'),_0x4926('0x54')]);});_0x39c072(_0x165d08);})[_0x4926('0x44')](function(_0x55b39b){_0x5ad039(_0x55b39b);});})[_0x4926('0x40')](function(_0x538665){var _0x1696c9=qs[_0x4926('0x4d')](_0x41e090,['id','createdAt',_0x4926('0x50')]);_0x1696c9['userProfileId']=_0x2efca4['id'];if(_0x538665)_0x1696c9[_0x4926('0x55')]=_0x538665;return _0x1696c9;})[_0x4926('0x40')](function(_0x4ebdb8){return db[_0x4926('0x56')][_0x4926('0x48')](_0x4ebdb8,{'include':[{'model':db[_0x4926('0x57')],'as':_0x4926('0x55')}],'raw':!![],'transaction':_0x22e537});});})['then'](function(){return _0x2efca4;});}});});});}})[_0x4926('0x40')](respondWithResult(_0x3afe71,0xc9))[_0x4926('0x44')](handleError(_0x3afe71,null));};exports['update']=function(_0x7ed5fc,_0x155726){if(_0x7ed5fc[_0x4926('0x4f')]['id']){delete _0x7ed5fc[_0x4926('0x4f')]['id'];}return db['UserProfile'][_0x4926('0x47')]({'where':{'id':_0x7ed5fc[_0x4926('0x4a')]['id']}})[_0x4926('0x40')](handleEntityNotFound(_0x155726,null))[_0x4926('0x40')](saveUpdates(_0x7ed5fc['body'],null))[_0x4926('0x40')](respondWithResult(_0x155726,null))[_0x4926('0x44')](handleError(_0x155726,null));};exports[_0x4926('0x58')]=function(_0x4b8873,_0x59df25){return db[_0x4926('0x2c')][_0x4926('0x47')]({'where':{'id':_0x4b8873[_0x4926('0x4a')]['id']}})['then'](handleEntityNotFound(_0x59df25,null))[_0x4926('0x40')](removeEntity(_0x59df25,null))[_0x4926('0x44')](handleError(_0x59df25,null));};exports[_0x4926('0x59')]=function(_0x3180ae,_0x328380){return db[_0x4926('0x2c')][_0x4926('0x59')]()['then'](respondWithResult(_0x328380,null))[_0x4926('0x44')](handleError(_0x328380,null));};exports[_0x4926('0x5a')]=function(_0x17a414,_0x21207f){var _0x5321cc=_0x17a414[_0x4926('0x4f')];return db[_0x4926('0x2c')][_0x4926('0x47')]({'where':{'id':_0x17a414[_0x4926('0x4a')]['id']}})[_0x4926('0x40')](handleEntityNotFound(_0x21207f,null))['then'](function(_0x8f68cf){if(_0x8f68cf){return db['sequelize'][_0x4926('0x5b')](function(_0x129405){return db[_0x4926('0x56')][_0x4926('0x58')]({'where':{'userProfileId':_0x17a414['params']['id'],'sectionId':_[_0x4926('0x2b')](_0x5321cc,function(_0x5854ae){return _0x5854ae['sectionId'];})},'transaction':_0x129405})[_0x4926('0x40')](function(){var _0x2f60f0=_[_0x4926('0x2b')](_0x5321cc,function(_0x28b118){_0x28b118[_0x4926('0x5c')]=_0x17a414[_0x4926('0x4a')]['id'];return _0x28b118;});var _0x564e51=[];return BPromise[_0x4926('0x52')](_0x2f60f0,function(_0x25a345){return db[_0x4926('0x56')][_0x4926('0x48')](_0x25a345,{'include':[{'model':db['UserProfileResource'],'as':_0x4926('0x55')}],'raw':!![],'transaction':_0x129405})[_0x4926('0x40')](function(_0x1de139){_0x564e51[_0x4926('0x5d')](_0x1de139[_0x4926('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x564e51;});});});}})['then'](function(_0x388370){return _0x388370;})[_0x4926('0x40')](respondWithResult(_0x21207f,null))[_0x4926('0x44')](handleError(_0x21207f,null));};exports[_0x4926('0x5e')]=function(_0x522b61,_0x1fad14){var _0x3d788b;return db[_0x4926('0x2c')][_0x4926('0x47')]({'where':{'id':_0x522b61[_0x4926('0x4a')]['id']},'attributes':['id',_0x4926('0x28')]})[_0x4926('0x40')](handleEntityNotFound(_0x1fad14,null))[_0x4926('0x40')](function(_0x36a782){if(_0x36a782){_0x3d788b=_0x36a782;return db[_0x4926('0x56')][_0x4926('0x58')]({'where':{'userProfileId':_0x522b61[_0x4926('0x4a')]['id'],'sectionId':_0x522b61[_0x4926('0x31')][_0x4926('0x5f')]}});}})[_0x4926('0x40')](function(){return _0x3d788b;})[_0x4926('0x40')](respondWithStatusCode(_0x1fad14,null))[_0x4926('0x44')](handleError(_0x1fad14,null));};exports[_0x4926('0x60')]=function(_0x4ae357,_0x2889c1){var _0x30bb83=[];var _0x3f9198=[];return db['UserProfileSection'][_0x4926('0x42')]({'where':{'userProfileId':_0x4ae357[_0x4926('0x4a')]['id']},'raw':!![]})[_0x4926('0x40')](function(_0x152dbf){_0x30bb83=_[_0x4926('0x3f')](_0x152dbf,function(_0x18aa37){return _0x18aa37[_0x4926('0x61')]===0x1||_[_0x4926('0x62')]([0x3eb,0x709],_0x18aa37[_0x4926('0x54')]);});if(!_[_0x4926('0x63')](_0x30bb83)){return _[_0x4926('0x2b')](_0x30bb83,function(_0x45d7c3){return _0x45d7c3['sectionId'];});}else{return;}})['then'](function(_0x162d9c){if(_0x162d9c)_0x3f9198=_0x162d9c;if(_['includes'](_0x3f9198,0x64)){var _0x140eba=_[_0x4926('0x47')](_0x30bb83,{'sectionId':0x64});return hasDefaultDashboard(_0x140eba)['then'](function(_0x3818e4){return _[_0x4926('0x2b')](_0x30bb83,function(_0x246db8){if(_0x246db8[_0x4926('0x54')]===0x64){_0x246db8[_0x4926('0x64')]=_0x3818e4;}return _0x246db8;});});}else{return;}})['then'](function(_0x50141a){if(_0x50141a)_0x30bb83=_0x50141a;if(_[_0x4926('0x62')](_0x3f9198,0x3eb)){var _0x1314b7=_[_0x4926('0x47')](_0x30bb83,{'sectionId':0x3eb});return getCustomDashboards(_0x1314b7)['then'](function(_0x16fe37){return _['map'](_0x30bb83,function(_0x28385a){if(_0x1314b7[_0x4926('0x61')]){if(_0x28385a[_0x4926('0x54')]===0x3eb){_0x28385a[_0x4926('0x64')]=_0x16fe37;}}else{if(_0x28385a[_0x4926('0x54')]===0x64){_0x28385a[_0x4926('0x64')]=_0x16fe37;}}return _0x28385a;});});}else{return;}})[_0x4926('0x40')](function(_0x4d6b56){if(_0x4d6b56)_0x30bb83=_0x4d6b56;if(_[_0x4926('0x62')](_0x3f9198,0x709)){var _0x3ae52e=_[_0x4926('0x47')](_0x30bb83,{'sectionId':0x709});return getPlugins(_0x3ae52e)['then'](function(_0x8d3b96){if(_0x3ae52e[_0x4926('0x61')]){return _[_0x4926('0x2b')](_0x30bb83,function(_0x49fb63){if(_0x49fb63[_0x4926('0x54')]===0x709){_0x49fb63[_0x4926('0x64')]=_0x8d3b96;}return _0x49fb63;});}else{var _0x35690d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x8d3b96};var _0xecac48=_[_0x4926('0x2b')](_0x30bb83);_0xecac48[_0x4926('0x5d')](_0x35690d);return _0xecac48;}});}else{return;}})['then'](function(_0x345922){if(_0x345922)_0x30bb83=_0x345922;return _[_0x4926('0x3f')](_0x30bb83,[_0x4926('0x61'),0x1]);})[_0x4926('0x40')](respondWithResult(_0x2889c1,null))[_0x4926('0x44')](handleError(_0x2889c1,null));};function hasDefaultDashboard(_0x20a068){var _0x3e4da9=[0x65];return new BPromise(function(_0x3ba12b,_0x5bae2b){try{if(_0x20a068[_0x4926('0x53')]){_0x3ba12b(_0x3e4da9);}else{return db['UserProfileResource'][_0x4926('0x65')]({'where':{'sectionId':_0x20a068['id']},'raw':!![]})['then'](function(_0x2c9f29){_0x2c9f29?_0x3ba12b(_0x3e4da9):_0x3ba12b();});}}catch(_0x2d5590){_0x5bae2b(_0x2d5590);}});}function getCustomDashboards(_0x1b01d3){var _0x1d8424=[];return new BPromise(function(_0x2458a5,_0x2aedb7){try{if(_0x1b01d3[_0x4926('0x53')]){return db[_0x4926('0x66')]['findAll']({'raw':!![]})[_0x4926('0x40')](function(_0x48230a){_0x48230a['forEach'](function(_0x2f524c){_0x1d8424[_0x4926('0x5d')](_0x2f524c['id']+0x1869f);});_0x2458a5(_0x1d8424);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1b01d3['id']},'raw':!![]})['then'](function(_0x5d7c70){_0x5d7c70[_0x4926('0x67')](function(_0x1edfe3){_0x1d8424[_0x4926('0x5d')](_0x1edfe3['resourceId']+0x1869f);});_0x2458a5(_0x1d8424);});}}catch(_0x4011d7){_0x2aedb7(_0x4011d7);}});}function getPlugins(_0x5d6aa0){var _0x2290db=[];return new BPromise(function(_0x4dd23b,_0x2c62e7){try{if(_0x5d6aa0[_0x4926('0x53')]){return db[_0x4926('0x68')][_0x4926('0x42')]({'raw':!![]})[_0x4926('0x40')](function(_0x5a3bcf){_0x5a3bcf[_0x4926('0x67')](function(_0x1ecf6e){_0x2290db[_0x4926('0x5d')](_0x1ecf6e['id']+0x15b38);});_0x4dd23b(_0x2290db);});}else{return db[_0x4926('0x57')][_0x4926('0x42')]({'where':{'sectionId':_0x5d6aa0['id']},'raw':!![]})['then'](function(_0x5bf140){_0x5bf140[_0x4926('0x67')](function(_0x26c5d3){_0x2290db['push'](_0x26c5d3['resourceId']+0x15b38);});_0x4dd23b(_0x2290db);});}}catch(_0x2d4d46){_0x2c62e7(_0x2d4d46);}});}exports[_0x4926('0x69')]=function(_0x3f2f37,_0x5d1adb){return db['UserProfile'][_0x4926('0x47')]({'where':{'id':_0x3f2f37['params']['id']}})[_0x4926('0x40')](handleEntityNotFound(_0x5d1adb,null))[_0x4926('0x40')](function(_0x182039){if(_0x182039){return db[_0x4926('0x51')]['transaction'](function(_0x12d9a3){return db[_0x4926('0x56')][_0x4926('0x42')]({'where':{'userProfileId':_0x3f2f37[_0x4926('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x4926('0x40')](function(_0xa4950e){if(_0xa4950e){return db[_0x4926('0x56')][_0x4926('0x58')]({'where':{'userProfileId':_0x3f2f37['params']['id'],'id':_[_0x4926('0x2b')](_0xa4950e,function(_0x1b78b7){return _0x1b78b7['id'];})},'transaction':_0x12d9a3});}})[_0x4926('0x40')](function(_0x1e7ce2){var _0x5a3146=_[_0x4926('0x2b')](_0x3f2f37[_0x4926('0x4f')],function(_0x3068cb){_0x3068cb['userProfileId']=_0x3f2f37['params']['id'];return _0x3068cb;});return db[_0x4926('0x56')]['bulkCreate'](_0x5a3146,{'raw':!![],'transaction':_0x12d9a3});})[_0x4926('0x40')](function(_0x5d8516){var _0x3a0a1a=_[_0x4926('0x3f')](_[_0x4926('0x2b')](_0x5d8516,function(_0x10072b){return _0x10072b[_0x4926('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a0a1a){return db[_0x4926('0x56')][_0x4926('0x42')]({'where':{'userProfileId':_0x3f2f37['params']['id'],'sectionId':_[_0x4926('0x2b')](_0x3a0a1a,function(_0xde230e){return _0xde230e['sectionId'];})},'attributes':['id',_0x4926('0x54')],'raw':!![]})['then'](function(_0x108f2c){var _0x296a0c=_[_0x4926('0x2b')](_0x3f2f37[_0x4926('0x4f')],function(_0x4bfc3a){_0x4bfc3a[_0x4926('0x5c')]=_0x3f2f37[_0x4926('0x4a')]['id'];return _0x4bfc3a;});return db[_0x4926('0x57')][_0x4926('0x6a')](_0x296a0c,{'raw':!![],'transaction':_0x12d9a3});});}})[_0x4926('0x44')](handleError(_0x5d1adb,null));});}})[_0x4926('0x40')](function(_0x574517){var _0x23e99c=_[_0x4926('0x2b')](_0x574517,function(_0x556a78){return _0x556a78['get']({'plain':!![]});});})[_0x4926('0x40')](respondWithResult(_0x5d1adb,null))['catch'](handleError(_0x5d1adb,null));};exports['removeResources']=function(_0xaa7b6d,_0x28309e,_0x23c770){return db[_0x4926('0x2c')]['find']({'where':{'id':_0xaa7b6d[_0x4926('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28309e,null))['then'](function(_0x96341a){if(_0x96341a){return _0x96341a['removeResources'](_0xaa7b6d[_0x4926('0x31')][_0x4926('0x5f')]);}})[_0x4926('0x40')](respondWithStatusCode(_0x28309e,null))[_0x4926('0x44')](handleError(_0x28309e,null));};exports[_0x4926('0x6b')]=function(_0x452fe9,_0x5426b8){var _0x41085d={};if(!_0x452fe9[_0x4926('0x31')][_0x4926('0x6c')])throw new Error(_0x4926('0x6d'));if(!_0x452fe9[_0x4926('0x31')][_0x4926('0x38')](_0x4926('0x39'))){_0x41085d['limit']=qs['limit'](_0x452fe9['query'][_0x4926('0x21')]);_0x41085d[_0x4926('0x1e')]=qs[_0x4926('0x1e')](_0x452fe9[_0x4926('0x31')][_0x4926('0x1e')]);}return db[_0x4926('0x2c')][_0x4926('0x47')]({'where':{'id':_0x452fe9[_0x4926('0x4a')]['id']}})[_0x4926('0x40')](function(_0x2d0387){if(!_0x2d0387)throw new Error(_0x4926('0x6e')+_0x452fe9[_0x4926('0x4a')]['id']);return db['UserProfile']['getResources'](_0x452fe9);})[_0x4926('0x40')](respondWithFilteredResult(_0x5426b8,_0x41085d))[_0x4926('0x44')](handleError(_0x5426b8,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7088f0e..214e82a 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 _0x5ff9=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff9,0xa0));var _0x95ff=function(_0x1df0a7,_0x3b31bd){_0x1df0a7=_0x1df0a7-0x0;var _0xf612a2=_0x5ff9[_0x1df0a7];return _0xf612a2;};'use strict';var EventEmitter=require(_0x95ff('0x0'));var UserProfile=require(_0x95ff('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x95ff('0x2')](0x0);var events={'afterCreate':_0x95ff('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d1ce4){return function(_0x58eb5d,_0x5b1bee,_0x174f9d){UserProfileEvents[_0x95ff('0x4')](_0x3d1ce4+':'+_0x58eb5d['id'],_0x58eb5d);UserProfileEvents['emit'](_0x3d1ce4,_0x58eb5d);_0x174f9d(null);};}for(var e in events){if(events[_0x95ff('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x95ff('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x6d11=['hook','exports','events','../../mysqldb','UserProfile','save','remove','emit','hasOwnProperty'];(function(_0x1e869f,_0x44c25b){var _0x179a44=function(_0x137b65){while(--_0x137b65){_0x1e869f['push'](_0x1e869f['shift']());}};_0x179a44(++_0x44c25b);}(_0x6d11,0xbf));var _0x16d1=function(_0x5bc369,_0x59fa6d){_0x5bc369=_0x5bc369-0x0;var _0x58dbb0=_0x6d11[_0x5bc369];return _0x58dbb0;};'use strict';var EventEmitter=require(_0x16d1('0x0'));var UserProfile=require(_0x16d1('0x1'))['db'][_0x16d1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x16d1('0x3'),'afterUpdate':'update','afterDestroy':_0x16d1('0x4')};function emitEvent(_0x2e1a35){return function(_0x4bce83,_0x48754e,_0x3e0e86){UserProfileEvents[_0x16d1('0x5')](_0x2e1a35+':'+_0x4bce83['id'],_0x4bce83);UserProfileEvents[_0x16d1('0x5')](_0x2e1a35,_0x4bce83);_0x3e0e86(null);};}for(var e in events){if(events[_0x16d1('0x6')](e)){var event=events[e];UserProfile[_0x16d1('0x7')](e,emitEvent(event));}}module[_0x16d1('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 2568ae9..6f97216 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 _0x22d4=['params','union','ignore','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','merge','key','foreignKey','options','includeAll','forEach','default','reportId','DefaultReports','custom','CustomReports','count','rows','color','tag','openTabs','true','chat','sms','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','type','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','agent','membername','telephone','VoiceQueues','VoiceQueue','inbound','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','QueueCampaigns','users','agents','Users','role','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','variables','Variable','metrics','charAt','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find'];(function(_0x4fa939,_0x222e50){var _0x40d21a=function(_0x12b4f1){while(--_0x12b4f1){_0x4fa939['push'](_0x4fa939['shift']());}};_0x40d21a(++_0x222e50);}(_0x22d4,0xe2));var _0x422d=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x22d4[_0x164e8f];return _0x2b2840;};'use strict';var _=require('lodash');var attributes=require(_0x422d('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x422d('0x1'));module[_0x422d('0x2')]=function(_0x44be05){var _0x2ad11d=_0x44be05['models'];function _0x317478(_0x1795a9,_0x20255a){return new Promise(function(_0x2d440b,_0x4fde01){if(!_0x20255a)return _0x2d440b(null);var _0x2b590b=_0x20255a[_0x422d('0x3')]?{[_0x20255a[_0x422d('0x3')][_0x422d('0x4')]]:_0x20255a['filter'][_0x422d('0x5')]}:undefined;return _0x2ad11d[_0x1795a9][_0x422d('0x6')]({'where':_0x2b590b,'raw':!![]})[_0x422d('0x7')](function(_0x1766cb){_0x20255a[_0x422d('0x8')]=_[_0x422d('0x9')](_0x1766cb,'id');_0x2d440b(_0x20255a);})[_0x422d('0xa')](function(_0x4d5dc8){_0x4fde01(_0x4d5dc8);});});}function _0x29777d(_0x38f506,_0x1a94aa){return new Promise(function(_0x1a968f,_0x43f34c){var _0x5419c5=_0x38f506[_0x422d('0x3')]?{[_0x38f506['filter'][_0x422d('0x4')]]:_0x38f506[_0x422d('0x3')][_0x422d('0x5')]}:undefined;return _0x2ad11d[_0x38f506[_0x422d('0xb')]][_0x422d('0x6')]({'where':_0x5419c5,'raw':!![]})[_0x422d('0x7')](function(_0x18e3dd){_0x1a94aa[_0x422d('0x8')]=_[_0x422d('0x9')](_0x18e3dd,function(_0xd8a51f){return _0xd8a51f[_0x422d('0xc')];});_0x1a968f(_0x1a94aa);})[_0x422d('0xa')](function(_0x519c5c){_0x43f34c(_0x519c5c);});});}function _0x417a27(_0x2e4242,_0x5be7d7,_0x20e948){if(!_0x5be7d7)return Promise[_0x422d('0xd')](null);return new Promise(function(_0x43693d,_0x301228){return _0x2ad11d[_0x422d('0xe')][_0x422d('0x6')]({'where':{'sectionId':_0x5be7d7['id']},'raw':!![]})[_0x422d('0x7')](function(_0x8636af){if(_0x2e4242[_0x422d('0x4')]&&_0x2e4242[_0x422d('0x4')]!=='id'){_0x5be7d7[_0x422d('0x8')]=_['map'](_0x8636af,function(_0x4b59c6){return _0x4b59c6[_0x2e4242[_0x422d('0x4')]];});}else{if(_0x20e948===_0x422d('0xf')){_0x5be7d7[_0x422d('0x8')]=_[_0x422d('0x9')](_0x8636af,function(_0x16cf48){return{'id':_0x16cf48['resourceId'],'type':_0x16cf48[_0x422d('0x10')]};});}else{_0x5be7d7[_0x422d('0x8')]=_[_0x422d('0x9')](_0x8636af,function(_0x949a0a){return _0x949a0a['resourceId'];});}}_0x43693d(_0x5be7d7);})[_0x422d('0xa')](function(_0x4c16e8){_0x301228(_0x4c16e8);});});}function _0x2d15ee(_0x317162,_0x514b37){var _0x45e003={'parentSections':[]};switch(_0x317162[_0x422d('0x11')]()){case'squareprojects':_0x45e003['childModel']=_0x422d('0x12');break;case _0x422d('0x13'):_0x45e003['childModel']=_0x422d('0x14');break;case _0x422d('0x15'):_0x45e003[_0x422d('0x16')]='SquareRecording';_0x45e003['parentSections']=[{'name':_0x422d('0x17'),'field':_0x422d('0xc'),'foreignKey':_0x422d('0x18')}];break;case _0x422d('0x19'):_0x45e003[_0x422d('0x16')]=_0x422d('0x1a');break;case _0x422d('0x1b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x1c');_0x45e003[_0x422d('0x1d')]=[{'name':'Lists','field':'id','foreignKey':_0x422d('0x1e')}];break;case _0x422d('0x1f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x20');break;case'companies':_0x45e003[_0x422d('0x16')]=_0x422d('0x21');break;case _0x422d('0x22'):_0x45e003[_0x422d('0x16')]=_0x422d('0x23');break;case _0x422d('0x24'):_0x45e003[_0x422d('0x16')]=_0x422d('0x25');break;case _0x422d('0x26'):_0x45e003[_0x422d('0x16')]=_0x422d('0x27');break;case'faxqueues':_0x45e003[_0x422d('0x16')]=_0x422d('0x28');break;case _0x422d('0x29'):_0x45e003['childModel']='FaxAccount';break;case _0x422d('0x2a'):case _0x422d('0x2b'):case'outboundroutes':_0x45e003[_0x422d('0x16')]=_0x422d('0x2c');break;case _0x422d('0x2d'):_0x45e003[_0x422d('0x16')]=_0x422d('0x2e');break;case _0x422d('0x2f'):_0x45e003[_0x422d('0x16')]='VoiceMail';break;case _0x422d('0x30'):_0x45e003['childModel']='VoiceRecording';_0x45e003['parentSections']=[{'name':_0x422d('0x31'),'field':_0x422d('0xc'),'foreignKey':'membername','model':_0x422d('0x32'),'filter':{'field':'role','value':[_0x422d('0x33')]}},{'name':'Telephones','field':_0x422d('0xc'),'foreignKey':_0x422d('0x34'),'model':_0x422d('0x32'),'filter':{'field':'role','value':[_0x422d('0x35')]}},{'name':_0x422d('0x36'),'field':_0x422d('0xc'),'foreignKey':'queue','model':_0x422d('0x37'),'filter':{'field':_0x422d('0x10'),'value':[_0x422d('0x38')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x422d('0x39'),'model':_0x422d('0x37'),'filter':{'field':_0x422d('0x10'),'value':['outbound']}}];break;case _0x422d('0x3a'):_0x45e003[_0x422d('0x16')]=_0x422d('0x3b');break;case _0x422d('0x3c'):_0x45e003[_0x422d('0x16')]=_0x422d('0x3d');break;case _0x422d('0x3e'):_0x45e003['childModel']=_0x422d('0x3f');break;case _0x422d('0x40'):_0x45e003['childModel']=_0x422d('0x41');break;case _0x422d('0x42'):_0x45e003['childModel']=_0x422d('0x43');break;case _0x422d('0x44'):_0x45e003[_0x422d('0x16')]='MailAccount';break;case _0x422d('0x45'):_0x45e003['childModel']=_0x422d('0x46');break;case'openchannelqueues':_0x45e003[_0x422d('0x16')]=_0x422d('0x47');break;case _0x422d('0x48'):_0x45e003[_0x422d('0x16')]='OpenchannelAccount';break;case _0x422d('0x49'):_0x45e003['childModel']='SmsQueue';break;case _0x422d('0x4a'):_0x45e003['childModel']='SmsAccount';break;case _0x422d('0x4b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x4c');break;case _0x422d('0x4d'):_0x45e003[_0x422d('0x16')]=_0x422d('0x4e');break;case _0x422d('0x4f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x50');break;case'voicequeues':case'queuecampaigns':_0x45e003['childModel']=_0x422d('0x37');if(_0x514b37){_0x45e003[_0x422d('0x1d')]=[{'name':_0x422d('0x36')},{'name':_0x422d('0x51')}];}break;case _0x422d('0x52'):case _0x422d('0x53'):case'telephones':_0x45e003[_0x422d('0x16')]=_0x422d('0x32');if(_0x514b37){_0x45e003[_0x422d('0x1d')]=[{'name':_0x422d('0x54'),'filter':{'field':_0x422d('0x55'),'value':[_0x422d('0x56'),_0x422d('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0x422d('0x58')}];}break;case _0x422d('0x59'):_0x45e003['childModel']=_0x422d('0x5a');break;case _0x422d('0x5b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x5c');break;case'freshdeskaccounts':_0x45e003[_0x422d('0x16')]=_0x422d('0x5d');break;case'sugarcrmaccounts':_0x45e003[_0x422d('0x16')]=_0x422d('0x5e');break;case _0x422d('0x5f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x60');break;case _0x422d('0x61'):_0x45e003[_0x422d('0x16')]=_0x422d('0x62');break;case _0x422d('0x63'):_0x45e003['childModel']='User';break;case _0x422d('0x64'):_0x45e003[_0x422d('0x16')]=_0x422d('0x65');break;case _0x422d('0x66'):_0x45e003[_0x422d('0x16')]='Disposition';break;case _0x422d('0x67'):_0x45e003[_0x422d('0x16')]=_0x422d('0x68');break;case _0x422d('0x69'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6a');break;case _0x422d('0x6b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6c');break;case _0x422d('0x6d'):_0x45e003[_0x422d('0x16')]='Schedule';break;case _0x422d('0x6e'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6f');break;case _0x422d('0x70'):_0x45e003['childModel']=_0x422d('0x71');break;case'templates':_0x45e003[_0x422d('0x16')]=_0x422d('0x72');break;case'triggers':_0x45e003[_0x422d('0x16')]=_0x422d('0x73');break;case _0x422d('0x74'):_0x45e003['childModel']=_0x422d('0x75');break;case _0x422d('0x76'):_0x45e003[_0x422d('0x16')]=_0x422d('0x77');break;case'plugins':_0x45e003[_0x422d('0x16')]='Plugin';break;case'extractedreports':_0x45e003['childModel']=_0x422d('0xf');_0x45e003['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x422d('0x78'):_0x45e003['childModel']='AnalyticMetric';break;}return _0x45e003;}function _0x19d7d1(_0x567a43,_0x3db6ba){var _0x1c94e2=_0x567a43[_0x422d('0x79')](0x0)['toUpperCase']()+_0x567a43['slice'](0x1);var _0x271803={'type':_0x2ad11d[_0x422d('0x7a')][_0x422d('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x1e794d,_0x35f7b2){var _0x218faf=squel['select']()['field'](_0x422d('0x7c')+_0x1c94e2+_0x422d('0x7d'),'id')[_0x422d('0x4')](_0x422d('0x7e'))['from']('user_has_'+_0x567a43+_0x422d('0x7f'),'ui')['where'](_0x422d('0x80'),_0x3db6ba['id']);return _0x2ad11d[_0x422d('0x81')][_0x422d('0x82')](_0x218faf[_0x422d('0x83')](),_0x271803)[_0x422d('0x7')](function(_0x5d9cab){_0x3db6ba[_0x1c94e2+_0x422d('0x84')]=_0x5d9cab;_0x1e794d(_0x5d9cab);})['catch'](function(_0x315129){_0x35f7b2(_0x315129);});});}return _0x44be05[_0x422d('0x85')](_0x422d('0x86'),attributes,{'tableName':_0x422d('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x31d57e){var _0x398926={'raw':_0x31d57e['query'][_0x422d('0x88')],'where':{}};var _0x3c61b3={};var _0x28ae4b={'count':0x0,'rows':[]};var _0x3801a5=_0x31d57e[_0x422d('0x82')][_0x422d('0x89')];var _0x680134=_0x31d57e['query'][_0x422d('0x8a')]||![];var _0x4c8aed=_0x2d15ee(_0x3801a5,_0x680134);if(!_0x4c8aed[_0x422d('0x16')])throw new Error(_0x422d('0x8b')+_0x3801a5+'\x27');var _0x47ff8b=[{'name':_0x3801a5}];if(!_[_0x422d('0x8c')](_0x4c8aed[_0x422d('0x1d')]))_0x47ff8b=_0x4c8aed[_0x422d('0x1d')];var _0x2f5ca5=[];for(var _0x22bc13=0x0;_0x22bc13<_0x47ff8b[_0x422d('0x8d')];_0x22bc13++){_0x2f5ca5[_0x422d('0x8e')](_0x2ad11d['UserProfileSection'][_0x422d('0x8f')]({'where':{'userProfileId':_0x31d57e[_0x422d('0x90')]['id'],'name':_0x47ff8b[_0x22bc13][_0x422d('0xc')]},'raw':!![]}));}return Promise['all'](_0x2f5ca5)[_0x422d('0x7')](function(_0x3b8e23){var _0x506483=_[_0x422d('0x3')](_0x3b8e23,function(_0x26880c){return _0x26880c?_0x26880c:undefined;});var _0x344883=_[_0x422d('0x3')](_0x47ff8b,['ignore',!![]]);var _0x505daa=_[_0x422d('0x8c')](_0x506483)&&_[_0x422d('0x8c')](_0x344883)?null:_[_0x422d('0x91')](_0x344883,_0x506483);if(!_0x505daa)return null;var _0x17bd48=[];for(var _0x5bb3b2=0x0;_0x5bb3b2<_0x505daa['length'];_0x5bb3b2++){var _0x43021b=_[_0x422d('0x8f')](_0x47ff8b,function(_0x364443){return _0x505daa[_0x5bb3b2]?_0x364443[_0x422d('0xc')]===_0x505daa[_0x5bb3b2][_0x422d('0xc')]:null;});if(_0x43021b){if(_0x505daa[_0x5bb3b2][_0x422d('0x92')]){_0x17bd48['push'](_0x317478(_0x4c8aed[_0x422d('0x16')],_0x505daa[_0x5bb3b2]));}else{if(!_0x505daa[_0x5bb3b2][_0x422d('0x93')]){_0x17bd48[_0x422d('0x8e')](_0x417a27(_0x43021b,_0x505daa[_0x5bb3b2],_0x4c8aed[_0x422d('0x16')]));}else{if(_0x43021b[_0x422d('0xb')]){_0x17bd48[_0x422d('0x8e')](_0x29777d(_0x43021b,_0x505daa[_0x5bb3b2]));}}}}}return Promise[_0x422d('0x94')](_0x17bd48);})[_0x422d('0x7')](function(_0x2535d2){var _0x229784=_0x2535d2;var _0x247ea2=null;if(_0x229784){_0x247ea2=_0x229784['length']===0x1?_0x229784[0x0]:null;}if(!_0x247ea2&&!_0x229784)return _0x28ae4b;var _0x5f136f=_0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x95')];_0x3c61b3[_0x422d('0xb')]=_[_0x422d('0x96')](_0x5f136f);_0x3c61b3['query']=_[_0x422d('0x96')](_0x31d57e[_0x422d('0x82')]);_0x3c61b3[_0x422d('0x97')]=_[_0x422d('0x98')](_0x3c61b3[_0x422d('0xb')],_0x3c61b3[_0x422d('0x82')]);_0x398926[_0x422d('0x99')]=_[_0x422d('0x98')](_0x3c61b3[_0x422d('0xb')],qs[_0x422d('0x9a')](_0x31d57e['query'][_0x422d('0x9a')]));_0x398926[_0x422d('0x99')]=_0x398926['attributes'][_0x422d('0x8d')]?_0x398926['attributes']:_0x3c61b3[_0x422d('0xb')];if(!_0x31d57e[_0x422d('0x82')]['hasOwnProperty'](_0x422d('0x9b'))){_0x398926[_0x422d('0x9c')]=qs['limit'](_0x31d57e[_0x422d('0x82')]['limit']);_0x398926[_0x422d('0x9d')]=qs['offset'](_0x31d57e[_0x422d('0x82')][_0x422d('0x9d')]);}_0x398926[_0x422d('0x9e')]=qs[_0x422d('0x9f')](_0x31d57e['query']['sort']);_0x398926[_0x422d('0xa0')]=qs[_0x422d('0x97')](_[_0x422d('0xa1')](_0x31d57e[_0x422d('0x82')],_0x3c61b3[_0x422d('0x97')]));if(_0x31d57e[_0x422d('0x82')][_0x422d('0x3')]){_0x398926['where']=_[_0x422d('0xa2')](_0x398926[_0x422d('0xa0')],{'$or':_[_0x422d('0x9')](_0x5f136f,function(_0x5e177b){if(_0x5e177b[_0x422d('0x10')][_0x422d('0xa3')]!=='VIRTUAL'){var _0x35aacb={};_0x35aacb[_0x5e177b[_0x422d('0x4')]]={'$like':'%'+_0x31d57e['query'][_0x422d('0x3')]+'%'};return _0x35aacb;}})});}var _0x23b0f8=[];var _0x4997c0=null;var _0x41fe47={};if(_0x247ea2){_0x4997c0=_[_0x422d('0x8f')](_0x47ff8b,['name',_0x247ea2[_0x422d('0xc')]]);if(_0x4997c0[_0x422d('0x4')]){_0x41fe47={};if(_0x4c8aed[_0x422d('0x16')]===_0x422d('0xf')){_0x41fe47[_0x4997c0['foreignKey']]=_[_0x422d('0x9')](_0x247ea2[_0x422d('0x8')],'id');}else{_0x41fe47[_0x4997c0[_0x422d('0xa4')]]=_0x247ea2[_0x422d('0x8')];}_0x23b0f8['push'](_0x41fe47);}else{_0x398926['where']['id']=_0x247ea2['associatedResources'];}}else{for(var _0x17aa04=0x0;_0x17aa04<_0x229784['length'];_0x17aa04++){_0x4997c0=_[_0x422d('0x8f')](_0x47ff8b,[_0x422d('0xc'),_0x229784[_0x17aa04][_0x422d('0xc')]]);if(_0x4997c0['field']){_0x41fe47={};_0x41fe47[_0x4997c0[_0x422d('0xa4')]]=_0x229784[_0x17aa04][_0x422d('0x8')];_0x23b0f8['push'](_0x41fe47);}else{if(!_0x398926[_0x422d('0xa0')]['id'])_0x398926[_0x422d('0xa0')]['id']=[];_0x229784[_0x17aa04][_0x422d('0x8')]['forEach'](function(_0x55df9f){_0x398926[_0x422d('0xa0')]['id'][_0x422d('0x8e')](_0x55df9f);});}}}if(!_[_0x422d('0x8c')](_0x23b0f8)){_0x398926[_0x422d('0xa0')]=_[_0x422d('0xa2')](_0x398926[_0x422d('0xa0')],{'$and':{'$or':_0x23b0f8}});}_0x398926=_[_0x422d('0xa2')]({},_0x398926,_0x31d57e[_0x422d('0xa5')]);if(_0x247ea2&&!_0x247ea2['autoAssociation']&&_0x4c8aed[_0x422d('0x16')]===_0x422d('0xf')){if(_0x31d57e[_0x422d('0x82')][_0x422d('0xa6')]){_0x398926['include']=[{'all':!![]}];}return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x6')](_0x398926)[_0x422d('0x7')](function(_0x469312){var _0x214390=[];_0x469312[_0x422d('0xa7')](function(_0x2bb2b5){var _0x300dc2;switch(_0x2bb2b5['reportType']){case _0x422d('0xa8'):_0x300dc2=_[_0x422d('0x8f')](_0x247ea2[_0x422d('0x8')],function(_0x1ba96a){return _0x1ba96a['id']===_0x2bb2b5[_0x422d('0xa9')]&&_0x1ba96a['type']===_0x422d('0xaa');});break;case _0x422d('0xab'):_0x300dc2=_['find'](_0x247ea2[_0x422d('0x8')],function(_0x29830b){return _0x29830b['id']===_0x2bb2b5['reportId']&&_0x29830b[_0x422d('0x10')]===_0x422d('0xac');});break;}if(_0x300dc2)_0x214390['push'](_0x2bb2b5);});_0x28ae4b[_0x422d('0xad')]=_0x214390[_0x422d('0x8d')];_0x28ae4b[_0x422d('0xae')]=_0x214390;return _0x28ae4b;});}else{return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]]['count']({'where':_0x398926['where']})[_0x422d('0x7')](function(_0x166696){_0x28ae4b[_0x422d('0xad')]=_0x166696;if(_0x31d57e['query'][_0x422d('0xa6')]){if(_0x4c8aed[_0x422d('0x16')]==='CmContact'){_0x398926['include']=[{'model':_0x2ad11d['Tag'],'as':'Tags','attributes':['id',_0x422d('0xc'),'color'],'required':_0x31d57e[_0x422d('0x82')]['tag']?!![]:![]},{'model':_0x2ad11d[_0x422d('0x71')],'as':'ThroughTags','attributes':['id',_0x422d('0xc'),_0x422d('0xaf')],'through':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]?{'attributes':[],'where':{'TagId':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]||undefined}}:{},'required':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]?!![]:![]}];}else{_0x398926['include']=[{'all':!![]}];}}return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x6')](_0x398926);})[_0x422d('0x7')](function(_0x259067){_0x28ae4b[_0x422d('0xae')]=_0x259067;if(_0x3801a5===_0x422d('0x31')&&_0x31d57e[_0x422d('0x82')][_0x422d('0xb1')]===_0x422d('0xb2')){var _0x3e6b00=[];for(var _0x4d1806=0x0;_0x4d1806<_0x28ae4b[_0x422d('0xae')][_0x422d('0x8d')];_0x4d1806++){_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb3'),_0x28ae4b[_0x422d('0xae')][_0x4d1806]['dataValues']));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb4'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1('fax',_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb6'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb7'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb8'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));}return Promise[_0x422d('0x94')](_0x3e6b00)['then'](function(){return _0x28ae4b;});}return _0x28ae4b;});}});}}});}; \ No newline at end of file +var _0xd1e4=['name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','Users','user','Agents','ZendeskAccount','salesforceaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','Dashboard','Interval','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','UserProfile','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','ignore','union','push','all','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','key','VIRTUAL','find','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','CustomReports','count','Tags','color','tag','rows','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','catch','model','associatedResources'];(function(_0x33a92d,_0x4de136){var _0x4df857=function(_0x31fadf){while(--_0x31fadf){_0x33a92d['push'](_0x33a92d['shift']());}};_0x4df857(++_0x4de136);}(_0xd1e4,0x172));var _0x4d1e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd1e4[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x4d1e('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x4d1e('0x1'));var squel=require(_0x4d1e('0x2'));module[_0x4d1e('0x3')]=function(_0x4942a4){var _0x556353=_0x4942a4[_0x4d1e('0x4')];function _0x43a035(_0x448aae,_0x138233){return new Promise(function(_0x41b1f2,_0x1f366f){if(!_0x138233)return _0x41b1f2(null);var _0x29ec1=_0x138233['filter']?{[_0x138233[_0x4d1e('0x5')][_0x4d1e('0x6')]]:_0x138233[_0x4d1e('0x5')][_0x4d1e('0x7')]}:undefined;return _0x556353[_0x448aae][_0x4d1e('0x8')]({'where':_0x29ec1,'raw':!![]})[_0x4d1e('0x9')](function(_0xb47474){_0x138233['associatedResources']=_[_0x4d1e('0xa')](_0xb47474,'id');_0x41b1f2(_0x138233);})[_0x4d1e('0xb')](function(_0xe7eba1){_0x1f366f(_0xe7eba1);});});}function _0x207bca(_0x315d4e,_0x470b64){return new Promise(function(_0x25cdc4,_0x189cf8){var _0x29d104=_0x315d4e[_0x4d1e('0x5')]?{[_0x315d4e['filter'][_0x4d1e('0x6')]]:_0x315d4e[_0x4d1e('0x5')][_0x4d1e('0x7')]}:undefined;return _0x556353[_0x315d4e[_0x4d1e('0xc')]][_0x4d1e('0x8')]({'where':_0x29d104,'raw':!![]})[_0x4d1e('0x9')](function(_0x40c6cd){_0x470b64[_0x4d1e('0xd')]=_[_0x4d1e('0xa')](_0x40c6cd,function(_0x1fbaf6){return _0x1fbaf6[_0x4d1e('0xe')];});_0x25cdc4(_0x470b64);})[_0x4d1e('0xb')](function(_0x4b9eef){_0x189cf8(_0x4b9eef);});});}function _0x59a91e(_0x5036ba,_0xc3bbb1,_0x550f55){if(!_0xc3bbb1)return Promise[_0x4d1e('0xf')](null);return new Promise(function(_0x34c29e,_0x3e2a8b){return _0x556353[_0x4d1e('0x10')]['findAll']({'where':{'sectionId':_0xc3bbb1['id']},'raw':!![]})[_0x4d1e('0x9')](function(_0x4ce9b7){if(_0x5036ba[_0x4d1e('0x6')]&&_0x5036ba[_0x4d1e('0x6')]!=='id'){_0xc3bbb1[_0x4d1e('0xd')]=_['map'](_0x4ce9b7,function(_0x382423){return _0x382423[_0x5036ba[_0x4d1e('0x6')]];});}else{if(_0x550f55===_0x4d1e('0x11')){_0xc3bbb1[_0x4d1e('0xd')]=_[_0x4d1e('0xa')](_0x4ce9b7,function(_0x591fa6){return{'id':_0x591fa6[_0x4d1e('0x12')],'type':_0x591fa6[_0x4d1e('0x13')]};});}else{_0xc3bbb1[_0x4d1e('0xd')]=_[_0x4d1e('0xa')](_0x4ce9b7,function(_0x84b161){return _0x84b161[_0x4d1e('0x12')];});}}_0x34c29e(_0xc3bbb1);})['catch'](function(_0x5eaff6){_0x3e2a8b(_0x5eaff6);});});}function _0x5030ee(_0x16c603,_0x5bc670){var _0x4d0564={'parentSections':[]};switch(_0x16c603[_0x4d1e('0x14')]()){case'squareprojects':_0x4d0564['childModel']=_0x4d1e('0x15');break;case _0x4d1e('0x16'):_0x4d0564['childModel']='SquareOdbc';break;case'squarerecordings':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x18');_0x4d0564[_0x4d1e('0x19')]=[{'name':_0x4d1e('0x1a'),'field':_0x4d1e('0xe'),'foreignKey':_0x4d1e('0x1b')}];break;case _0x4d1e('0x1c'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x1d');break;case _0x4d1e('0x1e'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x1f');_0x4d0564[_0x4d1e('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x4d1e('0x20')}];break;case _0x4d1e('0x21'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x22');break;case _0x4d1e('0x23'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x24');break;case _0x4d1e('0x25'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x26');break;case _0x4d1e('0x27'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x28');break;case _0x4d1e('0x29'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x2a');break;case _0x4d1e('0x2b'):_0x4d0564['childModel']='FaxQueue';break;case'faxaccounts':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x2c');break;case'inboundroutes':case _0x4d1e('0x2d'):case'outboundroutes':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x2e');break;case _0x4d1e('0x2f'):_0x4d0564[_0x4d1e('0x17')]='VoiceContext';break;case _0x4d1e('0x30'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x31');break;case _0x4d1e('0x32'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x33');_0x4d0564[_0x4d1e('0x19')]=[{'name':'Agents','field':_0x4d1e('0xe'),'foreignKey':_0x4d1e('0x34'),'model':_0x4d1e('0x35'),'filter':{'field':_0x4d1e('0x36'),'value':[_0x4d1e('0x37')]}},{'name':_0x4d1e('0x38'),'field':_0x4d1e('0xe'),'foreignKey':_0x4d1e('0x34'),'model':_0x4d1e('0x35'),'filter':{'field':_0x4d1e('0x36'),'value':[_0x4d1e('0x39')]}},{'name':_0x4d1e('0x3a'),'field':'name','foreignKey':_0x4d1e('0x3b'),'model':_0x4d1e('0x3c'),'filter':{'field':'type','value':[_0x4d1e('0x3d')]}},{'name':'QueueCampaigns','field':_0x4d1e('0xe'),'foreignKey':_0x4d1e('0x3b'),'model':'VoiceQueue','filter':{'field':_0x4d1e('0x13'),'value':[_0x4d1e('0x3e')]}}];break;case _0x4d1e('0x3f'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x40');break;case _0x4d1e('0x41'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x42');break;case _0x4d1e('0x43'):_0x4d0564['childModel']=_0x4d1e('0x44');break;case _0x4d1e('0x45'):_0x4d0564['childModel']='Campaign';break;case'mailqueues':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x46');break;case _0x4d1e('0x47'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x48');break;case _0x4d1e('0x49'):_0x4d0564['childModel']='MailSubstatus';break;case _0x4d1e('0x4a'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x4b');break;case _0x4d1e('0x4c'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x4d');break;case _0x4d1e('0x4e'):_0x4d0564['childModel']=_0x4d1e('0x4f');break;case _0x4d1e('0x50'):_0x4d0564[_0x4d1e('0x17')]='SmsAccount';break;case _0x4d1e('0x51'):_0x4d0564['childModel']=_0x4d1e('0x52');break;case _0x4d1e('0x53'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x54');break;case _0x4d1e('0x55'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x56');break;case _0x4d1e('0x57'):case _0x4d1e('0x58'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x3c');if(_0x5bc670){_0x4d0564[_0x4d1e('0x19')]=[{'name':_0x4d1e('0x3a')},{'name':_0x4d1e('0x59')}];}break;case'users':case _0x4d1e('0x5a'):case'telephones':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x35');if(_0x5bc670){_0x4d0564[_0x4d1e('0x19')]=[{'name':_0x4d1e('0x5b'),'filter':{'field':'role','value':['admin',_0x4d1e('0x5c')]},'ignore':!![]},{'name':_0x4d1e('0x5d')},{'name':_0x4d1e('0x38')}];}break;case'zendeskaccounts':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x5e');break;case _0x4d1e('0x5f'):_0x4d0564['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x4d0564['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x60');break;case _0x4d1e('0x61'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x62');break;case'zohoaccounts':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x63');break;case _0x4d1e('0x64'):_0x4d0564[_0x4d1e('0x17')]='User';break;case'cannedanswers':_0x4d0564['childModel']=_0x4d1e('0x65');break;case _0x4d1e('0x66'):_0x4d0564[_0x4d1e('0x17')]='Disposition';break;case _0x4d1e('0x67'):_0x4d0564['childModel']=_0x4d1e('0x68');break;case'intervals':_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x69');break;case'pauses':_0x4d0564['childModel']=_0x4d1e('0x6a');break;case'scheduler':_0x4d0564['childModel']=_0x4d1e('0x6b');break;case _0x4d1e('0x6c'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x6d');break;case _0x4d1e('0x6e'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x6f');break;case _0x4d1e('0x70'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x71');break;case _0x4d1e('0x72'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x73');break;case _0x4d1e('0x74'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x75');break;case _0x4d1e('0x76'):_0x4d0564[_0x4d1e('0x17')]='Variable';break;case _0x4d1e('0x77'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x78');break;case'extractedreports':_0x4d0564[_0x4d1e('0x17')]='AnalyticExtractedReport';_0x4d0564[_0x4d1e('0x19')]=[{'name':_0x4d1e('0x79'),'field':'id','foreignKey':_0x4d1e('0x7a')}];break;case _0x4d1e('0x7b'):_0x4d0564[_0x4d1e('0x17')]=_0x4d1e('0x7c');break;}return _0x4d0564;}function _0x48ab2f(_0x2c26ac,_0xe93489){var _0x3fafb4=_0x2c26ac[_0x4d1e('0x7d')](0x0)[_0x4d1e('0x7e')]()+_0x2c26ac[_0x4d1e('0x7f')](0x1);var _0x16a15e={'type':_0x556353[_0x4d1e('0x80')][_0x4d1e('0x81')][_0x4d1e('0x82')],'raw':!![]};return new Promise(function(_0x56ade6,_0xa9a0bf){var _0xdd11cb=squel['select']()[_0x4d1e('0x6')](_0x4d1e('0x83')+_0x3fafb4+_0x4d1e('0x84'),'id')[_0x4d1e('0x6')]('ui.createdAt')[_0x4d1e('0x85')](_0x4d1e('0x86')+_0x2c26ac+_0x4d1e('0x87'),'ui')['where'](_0x4d1e('0x88'),_0xe93489['id']);return _0x556353[_0x4d1e('0x89')]['query'](_0xdd11cb['toString'](),_0x16a15e)[_0x4d1e('0x9')](function(_0x154fd8){_0xe93489[_0x3fafb4+_0x4d1e('0x8a')]=_0x154fd8;_0x56ade6(_0x154fd8);})[_0x4d1e('0xb')](function(_0x24ef4a){_0xa9a0bf(_0x24ef4a);});});}return _0x4942a4[_0x4d1e('0x8b')](_0x4d1e('0x8c'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x7c8542){var _0x21cf84={'raw':_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0x8e')],'where':{}};var _0x4d1f9e={};var _0x2782a9={'count':0x0,'rows':[]};var _0x2e87c6=_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0x8f')];var _0x5bb49c=_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0x90')]||![];var _0x4e751f=_0x5030ee(_0x2e87c6,_0x5bb49c);if(!_0x4e751f['childModel'])throw new Error(_0x4d1e('0x91')+_0x2e87c6+'\x27');var _0x2aec3=[{'name':_0x2e87c6}];if(!_[_0x4d1e('0x92')](_0x4e751f[_0x4d1e('0x19')]))_0x2aec3=_0x4e751f['parentSections'];var _0x221b73=[];for(var _0x49ab39=0x0;_0x49ab39<_0x2aec3[_0x4d1e('0x93')];_0x49ab39++){_0x221b73['push'](_0x556353[_0x4d1e('0x94')]['find']({'where':{'userProfileId':_0x7c8542[_0x4d1e('0x95')]['id'],'name':_0x2aec3[_0x49ab39][_0x4d1e('0xe')]},'raw':!![]}));}return Promise['all'](_0x221b73)[_0x4d1e('0x9')](function(_0x3484c0){var _0x9a18f2=_['filter'](_0x3484c0,function(_0x5f4b37){return _0x5f4b37?_0x5f4b37:undefined;});var _0x1e21fe=_['filter'](_0x2aec3,[_0x4d1e('0x96'),!![]]);var _0x5d66c8=_[_0x4d1e('0x92')](_0x9a18f2)&&_[_0x4d1e('0x92')](_0x1e21fe)?null:_[_0x4d1e('0x97')](_0x1e21fe,_0x9a18f2);if(!_0x5d66c8)return null;var _0xe826b9=[];for(var _0x28da35=0x0;_0x28da35<_0x5d66c8['length'];_0x28da35++){var _0x4ff276=_['find'](_0x2aec3,function(_0x28bc31){return _0x5d66c8[_0x28da35]?_0x28bc31[_0x4d1e('0xe')]===_0x5d66c8[_0x28da35]['name']:null;});if(_0x4ff276){if(_0x5d66c8[_0x28da35][_0x4d1e('0x96')]){_0xe826b9[_0x4d1e('0x98')](_0x43a035(_0x4e751f[_0x4d1e('0x17')],_0x5d66c8[_0x28da35]));}else{if(!_0x5d66c8[_0x28da35]['autoAssociation']){_0xe826b9[_0x4d1e('0x98')](_0x59a91e(_0x4ff276,_0x5d66c8[_0x28da35],_0x4e751f[_0x4d1e('0x17')]));}else{if(_0x4ff276[_0x4d1e('0xc')]){_0xe826b9[_0x4d1e('0x98')](_0x207bca(_0x4ff276,_0x5d66c8[_0x28da35]));}}}}}return Promise[_0x4d1e('0x99')](_0xe826b9);})['then'](function(_0xdd40bd){var _0x302f66=_0xdd40bd;var _0x480af8=null;if(_0x302f66){_0x480af8=_0x302f66['length']===0x1?_0x302f66[0x0]:null;}if(!_0x480af8&&!_0x302f66)return _0x2782a9;var _0x525a6a=_0x556353[_0x4e751f[_0x4d1e('0x17')]]['rawAttributes'];_0x4d1f9e[_0x4d1e('0xc')]=_['keys'](_0x525a6a);_0x4d1f9e['query']=_[_0x4d1e('0x9a')](_0x7c8542[_0x4d1e('0x8d')]);_0x4d1f9e[_0x4d1e('0x9b')]=_['intersection'](_0x4d1f9e[_0x4d1e('0xc')],_0x4d1f9e[_0x4d1e('0x8d')]);_0x21cf84['attributes']=_[_0x4d1e('0x9c')](_0x4d1f9e[_0x4d1e('0xc')],qs[_0x4d1e('0x9d')](_0x7c8542['query'][_0x4d1e('0x9d')]));_0x21cf84['attributes']=_0x21cf84[_0x4d1e('0x9e')]['length']?_0x21cf84['attributes']:_0x4d1f9e[_0x4d1e('0xc')];if(!_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0x9f')](_0x4d1e('0xa0'))){_0x21cf84[_0x4d1e('0xa1')]=qs[_0x4d1e('0xa1')](_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xa1')]);_0x21cf84['offset']=qs[_0x4d1e('0xa2')](_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xa2')]);}_0x21cf84['order']=qs[_0x4d1e('0xa3')](_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xa3')]);_0x21cf84[_0x4d1e('0xa4')]=qs[_0x4d1e('0x9b')](_['pick'](_0x7c8542[_0x4d1e('0x8d')],_0x4d1f9e[_0x4d1e('0x9b')]));if(_0x7c8542['query'][_0x4d1e('0x5')]){_0x21cf84['where']=_['merge'](_0x21cf84[_0x4d1e('0xa4')],{'$or':_[_0x4d1e('0xa')](_0x525a6a,function(_0x4498b4){if(_0x4498b4[_0x4d1e('0x13')][_0x4d1e('0xa5')]!==_0x4d1e('0xa6')){var _0xaac9c={};_0xaac9c[_0x4498b4['field']]={'$like':'%'+_0x7c8542['query']['filter']+'%'};return _0xaac9c;}})});}var _0x1ecb54=[];var _0x2ed31c=null;var _0xc62a85={};if(_0x480af8){_0x2ed31c=_[_0x4d1e('0xa7')](_0x2aec3,[_0x4d1e('0xe'),_0x480af8[_0x4d1e('0xe')]]);if(_0x2ed31c[_0x4d1e('0x6')]){_0xc62a85={};if(_0x4e751f[_0x4d1e('0x17')]===_0x4d1e('0x11')){_0xc62a85[_0x2ed31c[_0x4d1e('0xa8')]]=_[_0x4d1e('0xa')](_0x480af8[_0x4d1e('0xd')],'id');}else{_0xc62a85[_0x2ed31c[_0x4d1e('0xa8')]]=_0x480af8[_0x4d1e('0xd')];}_0x1ecb54[_0x4d1e('0x98')](_0xc62a85);}else{_0x21cf84[_0x4d1e('0xa4')]['id']=_0x480af8['associatedResources'];}}else{for(var _0x386539=0x0;_0x386539<_0x302f66[_0x4d1e('0x93')];_0x386539++){_0x2ed31c=_['find'](_0x2aec3,[_0x4d1e('0xe'),_0x302f66[_0x386539][_0x4d1e('0xe')]]);if(_0x2ed31c[_0x4d1e('0x6')]){_0xc62a85={};_0xc62a85[_0x2ed31c['foreignKey']]=_0x302f66[_0x386539]['associatedResources'];_0x1ecb54[_0x4d1e('0x98')](_0xc62a85);}else{if(!_0x21cf84['where']['id'])_0x21cf84['where']['id']=[];_0x302f66[_0x386539][_0x4d1e('0xd')][_0x4d1e('0xa9')](function(_0x4e3945){_0x21cf84[_0x4d1e('0xa4')]['id'][_0x4d1e('0x98')](_0x4e3945);});}}}if(!_[_0x4d1e('0x92')](_0x1ecb54)){_0x21cf84['where']=_[_0x4d1e('0xaa')](_0x21cf84[_0x4d1e('0xa4')],{'$and':{'$or':_0x1ecb54}});}_0x21cf84=_[_0x4d1e('0xaa')]({},_0x21cf84,_0x7c8542[_0x4d1e('0xab')]);if(_0x480af8&&!_0x480af8['autoAssociation']&&_0x4e751f[_0x4d1e('0x17')]==='AnalyticExtractedReport'){if(_0x7c8542['query'][_0x4d1e('0xac')]){_0x21cf84[_0x4d1e('0xad')]=[{'all':!![]}];}return _0x556353[_0x4e751f['childModel']][_0x4d1e('0x8')](_0x21cf84)[_0x4d1e('0x9')](function(_0xcf51de){var _0x22ed3e=[];_0xcf51de[_0x4d1e('0xa9')](function(_0x13528a){var _0x38b77a;switch(_0x13528a[_0x4d1e('0xae')]){case _0x4d1e('0xaf'):_0x38b77a=_['find'](_0x480af8['associatedResources'],function(_0x54f82b){return _0x54f82b['id']===_0x13528a[_0x4d1e('0x7a')]&&_0x54f82b[_0x4d1e('0x13')]===_0x4d1e('0xb0');});break;case'custom':_0x38b77a=_[_0x4d1e('0xa7')](_0x480af8['associatedResources'],function(_0xff2587){return _0xff2587['id']===_0x13528a[_0x4d1e('0x7a')]&&_0xff2587[_0x4d1e('0x13')]===_0x4d1e('0xb1');});break;}if(_0x38b77a)_0x22ed3e['push'](_0x13528a);});_0x2782a9[_0x4d1e('0xb2')]=_0x22ed3e[_0x4d1e('0x93')];_0x2782a9['rows']=_0x22ed3e;return _0x2782a9;});}else{return _0x556353[_0x4e751f[_0x4d1e('0x17')]]['count']({'where':_0x21cf84[_0x4d1e('0xa4')]})['then'](function(_0x16b2de){_0x2782a9[_0x4d1e('0xb2')]=_0x16b2de;if(_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xac')]){if(_0x4e751f[_0x4d1e('0x17')]===_0x4d1e('0x1f')){_0x21cf84[_0x4d1e('0xad')]=[{'model':_0x556353[_0x4d1e('0x6f')],'as':_0x4d1e('0xb3'),'attributes':['id','name',_0x4d1e('0xb4')],'required':_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xb5')]?!![]:![]},{'model':_0x556353[_0x4d1e('0x6f')],'as':'ThroughTags','attributes':['id',_0x4d1e('0xe'),_0x4d1e('0xb4')],'through':_0x7c8542[_0x4d1e('0x8d')][_0x4d1e('0xb5')]?{'attributes':[],'where':{'TagId':_0x7c8542[_0x4d1e('0x8d')]['tag']||undefined}}:{},'required':_0x7c8542['query'][_0x4d1e('0xb5')]?!![]:![]}];}else{_0x21cf84['include']=[{'all':!![]}];}}return _0x556353[_0x4e751f['childModel']][_0x4d1e('0x8')](_0x21cf84);})['then'](function(_0x3a6174){_0x2782a9[_0x4d1e('0xb6')]=_0x3a6174;if(_0x2e87c6==='Agents'&&_0x7c8542['query'][_0x4d1e('0xb7')]===_0x4d1e('0xb8')){var _0x43adcb=[];for(var _0x43636c=0x0;_0x43636c<_0x2782a9[_0x4d1e('0xb6')][_0x4d1e('0x93')];_0x43636c++){_0x43adcb[_0x4d1e('0x98')](_0x48ab2f(_0x4d1e('0xb9'),_0x2782a9[_0x4d1e('0xb6')][_0x43636c][_0x4d1e('0xba')]));_0x43adcb[_0x4d1e('0x98')](_0x48ab2f(_0x4d1e('0xbb'),_0x2782a9[_0x4d1e('0xb6')][_0x43636c][_0x4d1e('0xba')]));_0x43adcb[_0x4d1e('0x98')](_0x48ab2f(_0x4d1e('0xbc'),_0x2782a9[_0x4d1e('0xb6')][_0x43636c][_0x4d1e('0xba')]));_0x43adcb['push'](_0x48ab2f(_0x4d1e('0xbd'),_0x2782a9[_0x4d1e('0xb6')][_0x43636c][_0x4d1e('0xba')]));_0x43adcb['push'](_0x48ab2f(_0x4d1e('0xbe'),_0x2782a9['rows'][_0x43636c][_0x4d1e('0xba')]));_0x43adcb[_0x4d1e('0x98')](_0x48ab2f(_0x4d1e('0xbf'),_0x2782a9[_0x4d1e('0xb6')][_0x43636c]['dataValues']));}return Promise[_0x4d1e('0x99')](_0x43adcb)['then'](function(){return _0x2782a9;});}return _0x2782a9;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 71a59af..5d22feb 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 _0x11f3=['redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x3a18e8,_0x5a4ae7){var _0x48cbf3=function(_0x460d58){while(--_0x460d58){_0x3a18e8['push'](_0x3a18e8['shift']());}};_0x48cbf3(++_0x5a4ae7);}(_0x11f3,0x149));var _0x311f=function(_0x3dc16f,_0x5e7b05){_0x3dc16f=_0x3dc16f-0x0;var _0x2bfa63=_0x11f3[_0x3dc16f];return _0x2bfa63;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var moment=require(_0x311f('0x2'));var BPromise=require('bluebird');var rs=require(_0x311f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x311f('0x4'))['db'];var utils=require(_0x311f('0x5'));var logger=require(_0x311f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x311f('0x7'));var client=jayson['client'][_0x311f('0x8')]({'port':0x232a});config[_0x311f('0x9')]=_[_0x311f('0xa')](config[_0x311f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x311f('0xb'))(new Redis(config[_0x311f('0x9')]));require(_0x311f('0xc'))[_0x311f('0xd')](socket);function respondWithRpcPromise(_0x7cd779,_0x495f48,_0x20de65){return new BPromise(function(_0x292325,_0x2e45d1){return client[_0x311f('0xe')](_0x7cd779,_0x20de65)[_0x311f('0xf')](function(_0x1d70ea){logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));logger[_0x311f('0x13')](_0x311f('0x14'),_0x495f48,_0x311f('0x12'),JSON[_0x311f('0x15')](_0x1d70ea));if(_0x1d70ea[_0x311f('0x16')]){if(_0x1d70ea[_0x311f('0x16')][_0x311f('0x17')]===0x1f4){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')]['message']);return _0x2e45d1(_0x1d70ea['error']['message']);}logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);return _0x292325(_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);}else{logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));_0x292325(_0x1d70ea['result'][_0x311f('0x18')]);}})[_0x311f('0x19')](function(_0x3b9ca8){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x3b9ca8);_0x2e45d1(_0x3b9ca8);});});} \ No newline at end of file +var _0x4279=['redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x2c32ad,_0x1a12d4){var _0x1d474f=function(_0xa83df7){while(--_0xa83df7){_0x2c32ad['push'](_0x2c32ad['shift']());}};_0x1d474f(++_0x1a12d4);}(_0x4279,0x8d));var _0x9427=function(_0x78cbc7,_0x37cf46){_0x78cbc7=_0x78cbc7-0x0;var _0x4058e4=_0x4279[_0x78cbc7];return _0x4058e4;};'use strict';var _=require('lodash');var util=require(_0x9427('0x0'));var moment=require(_0x9427('0x1'));var BPromise=require('bluebird');var rs=require(_0x9427('0x2'));var fs=require('fs');var Redis=require(_0x9427('0x3'));var db=require(_0x9427('0x4'))['db'];var utils=require(_0x9427('0x5'));var logger=require('../../config/logger')(_0x9427('0x6'));var config=require('../../config/environment');var jayson=require(_0x9427('0x7'));var client=jayson[_0x9427('0x8')]['http']({'port':0x232a});config[_0x9427('0x9')]=_[_0x9427('0xa')](config[_0x9427('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9427('0xb'))(new Redis(config['redis']));require(_0x9427('0xc'))['register'](socket);function respondWithRpcPromise(_0x559a48,_0xc62445,_0x12b94e){return new BPromise(function(_0xfe89e1,_0x2aff5b){return client[_0x9427('0xd')](_0x559a48,_0x12b94e)[_0x9427('0xe')](function(_0x4f1a57){logger[_0x9427('0xf')]('UserProfile,\x20%s,\x20%s',_0xc62445,_0x9427('0x10'));logger[_0x9427('0x11')](_0x9427('0x12'),_0xc62445,_0x9427('0x10'),JSON[_0x9427('0x13')](_0x4f1a57));if(_0x4f1a57[_0x9427('0x14')]){if(_0x4f1a57[_0x9427('0x14')][_0x9427('0x15')]===0x1f4){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')][_0x9427('0x17')]);return _0x2aff5b(_0x4f1a57[_0x9427('0x14')]['message']);}logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0x4f1a57[_0x9427('0x14')]['message']);return _0xfe89e1(_0x4f1a57['error'][_0x9427('0x17')]);}else{logger['info'](_0x9427('0x16'),_0xc62445,_0x9427('0x10'));_0xfe89e1(_0x4f1a57['result']['message']);}})[_0x9427('0x18')](function(_0xd64381){logger[_0x9427('0x14')](_0x9427('0x16'),_0xc62445,_0xd64381);_0x2aff5b(_0xd64381);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 39da722..d7943b5 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 _0xa04d=['save','remove','emit','removeListener','length','./userProfile.events'];(function(_0x11ca9b,_0x21cf96){var _0x22bc61=function(_0x1a9ec6){while(--_0x1a9ec6){_0x11ca9b['push'](_0x11ca9b['shift']());}};_0x22bc61(++_0x21cf96);}(_0xa04d,0xe3));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0xda04('0x0'));var events=[_0xda04('0x1'),_0xda04('0x2'),'update'];function createListener(_0x30eaec,_0x465bf7){return function(_0x3f90c6){_0x465bf7[_0xda04('0x3')](_0x30eaec,_0x3f90c6);};}function removeListener(_0x507e84,_0xf40acf){return function(){UserProfileEvents[_0xda04('0x4')](_0x507e84,_0xf40acf);};}exports['register']=function(_0x5762cf){for(var _0x8a62c2=0x0,_0x21a9c0=events[_0xda04('0x5')];_0x8a62c2<_0x21a9c0;_0x8a62c2++){var _0x448066=events[_0x8a62c2];var _0x428712=createListener('userProfile:'+_0x448066,_0x5762cf);UserProfileEvents['on'](_0x448066,_0x428712);}}; \ No newline at end of file +var _0x69d8=['register','userProfile:','save','remove','update','emit','removeListener'];(function(_0x584131,_0x7378a7){var _0x522ded=function(_0x355f01){while(--_0x355f01){_0x584131['push'](_0x584131['shift']());}};_0x522ded(++_0x7378a7);}(_0x69d8,0x8e));var _0x869d=function(_0x2f7d18,_0x44bea6){_0x2f7d18=_0x2f7d18-0x0;var _0x425175=_0x69d8[_0x2f7d18];return _0x425175;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x869d('0x0'),_0x869d('0x1'),_0x869d('0x2')];function createListener(_0x2b8ad2,_0x572114){return function(_0x396448){_0x572114[_0x869d('0x3')](_0x2b8ad2,_0x396448);};}function removeListener(_0x2ab698,_0x225078){return function(){UserProfileEvents[_0x869d('0x4')](_0x2ab698,_0x225078);};}exports[_0x869d('0x5')]=function(_0x3fef6e){for(var _0x58ee2a=0x0,_0x421cf3=events['length'];_0x58ee2a<_0x421cf3;_0x58ee2a++){var _0x279588=events[_0x58ee2a];var _0x48053c=createListener(_0x869d('0x6')+_0x279588,_0x3fef6e);UserProfileEvents['on'](_0x279588,_0x48053c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 5aaf761..42505a2 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 _0xa805=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','post','destroy','multer','util','path','connect-timeout'];(function(_0x5f3eca,_0xf5e61e){var _0x18fc28=function(_0x49d26e){while(--_0x49d26e){_0x5f3eca['push'](_0x5f3eca['shift']());}};_0x18fc28(++_0xf5e61e);}(_0xa805,0x161));var _0x5a80=function(_0x847af,_0x38f42f){_0x847af=_0x847af-0x0;var _0x111667=_0xa805[_0x847af];return _0x111667;};'use strict';var multer=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var path=require(_0x5a80('0x2'));var timeout=require(_0x5a80('0x3'));var express=require(_0x5a80('0x4'));var router=express[_0x5a80('0x5')]();var fs_extra=require(_0x5a80('0x6'));var auth=require(_0x5a80('0x7'));var interaction=require(_0x5a80('0x8'));var config=require(_0x5a80('0x9'));var controller=require(_0x5a80('0xa'));router[_0x5a80('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a80('0xb')]('/describe',auth[_0x5a80('0xc')](),controller[_0x5a80('0xd')]);router[_0x5a80('0xb')](_0x5a80('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5a80('0xf')]('/',auth[_0x5a80('0xc')](),controller['create']);router['put'](_0x5a80('0xe'),auth[_0x5a80('0xc')](),controller['update']);router['delete'](_0x5a80('0xe'),auth[_0x5a80('0xc')](),controller[_0x5a80('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb17d=['delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x5c6cf5,_0x782e49){var _0x17913a=function(_0x59b199){while(--_0x59b199){_0x5c6cf5['push'](_0x5c6cf5['shift']());}};_0x17913a(++_0x782e49);}(_0xb17d,0xab));var _0xdb17=function(_0x6beac1,_0x3a261b){_0x6beac1=_0x6beac1-0x0;var _0x220136=_0xb17d[_0x6beac1];return _0x220136;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb17('0x0'));var timeout=require(_0xdb17('0x1'));var express=require(_0xdb17('0x2'));var router=express['Router']();var fs_extra=require(_0xdb17('0x3'));var auth=require(_0xdb17('0x4'));var interaction=require(_0xdb17('0x5'));var config=require(_0xdb17('0x6'));var controller=require('./userProfileResource.controller');router[_0xdb17('0x7')]('/',auth[_0xdb17('0x8')](),controller[_0xdb17('0x9')]);router[_0xdb17('0x7')](_0xdb17('0xa'),auth[_0xdb17('0x8')](),controller[_0xdb17('0xb')]);router[_0xdb17('0x7')](_0xdb17('0xc'),auth[_0xdb17('0x8')](),controller[_0xdb17('0xd')]);router[_0xdb17('0xe')]('/',auth['isAuthenticated'](),controller[_0xdb17('0xf')]);router[_0xdb17('0x10')](_0xdb17('0xc'),auth['isAuthenticated'](),controller[_0xdb17('0x11')]);router[_0xdb17('0x12')]('/:id',auth[_0xdb17('0x8')](),controller[_0xdb17('0x13')]);module[_0xdb17('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f7651ec..cda4c68 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 _0x62ab=['exports','INTEGER','STRING'];(function(_0x2f2781,_0x579a21){var _0x5d14e4=function(_0x5f2f71){while(--_0x5f2f71){_0x2f2781['push'](_0x2f2781['shift']());}};_0x5d14e4(++_0x579a21);}(_0x62ab,0xd2));var _0xb62a=function(_0x3a228f,_0x434931){_0x3a228f=_0x3a228f-0x0;var _0x52001e=_0x62ab[_0x3a228f];return _0x52001e;};'use strict';var Sequelize=require('sequelize');module[_0xb62a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb62a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb62a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4276=['STRING','INTEGER','sequelize','exports'];(function(_0x4cdd5a,_0x57e480){var _0x4133d9=function(_0x3c3f4b){while(--_0x3c3f4b){_0x4cdd5a['push'](_0x4cdd5a['shift']());}};_0x4133d9(++_0x57e480);}(_0x4276,0xca));var _0x6427=function(_0x3a613e,_0x23eea5){_0x3a613e=_0x3a613e-0x0;var _0x5cf308=_0x4276[_0x3a613e];return _0x5cf308;};'use strict';var Sequelize=require(_0x6427('0x0'));module[_0x6427('0x1')]={'name':{'type':Sequelize[_0x6427('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6427('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6427('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3010c2c..7e329d4 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 _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x20cea6,_0x3a0611){var _0x29f2ae=function(_0x204b68){while(--_0x204b68){_0x20cea6['push'](_0x20cea6['shift']());}};_0x29f2ae(++_0x3a0611);}(_0x7a54,0x106));var _0x47a5=function(_0x53d69b,_0x150f7e){_0x53d69b=_0x53d69b-0x0;var _0x4dbef3=_0x7a54[_0x53d69b];return _0x4dbef3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['UserProfileResource'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['UserProfileResource']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x348e74,_0x1ff546){var _0x45b264=function(_0x323a22){while(--_0x323a22){_0x348e74['push'](_0x348e74['shift']());}};_0x45b264(++_0x1ff546);}(_0xd117,0x182));var _0x7d11=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xd117[_0x56825b];return _0x69ce77;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d5884b2..07d69ff 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 _0x477e=['resourceId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x3d2be9,_0xa46038){var _0x4184ea=function(_0x5d9770){while(--_0x5d9770){_0x3d2be9['push'](_0x3d2be9['shift']());}};_0x4184ea(++_0xa46038);}(_0x477e,0x146));var _0xe477=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x477e[_0x2b8077];return _0x308091;};'use strict';var _=require(_0xe477('0x0'));var util=require('util');var logger=require(_0xe477('0x1'))(_0xe477('0x2'));var moment=require(_0xe477('0x3'));var BPromise=require(_0xe477('0x4'));var rp=require(_0xe477('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe477('0x6'));var config=require(_0xe477('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xe477('0x8')]=function(_0x5b7e3a,_0x26c115){return _0x5b7e3a[_0xe477('0x9')](_0xe477('0xa'),attributes,{'tableName':_0xe477('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe477('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a8b=['compositeIndex','resourceId','sectionId','../../config/logger','api','moment','path','rimraf','../../config/environment','UserProfileResource','user_profile_has_resources'];(function(_0x414371,_0x50aff4){var _0x216784=function(_0x20d00e){while(--_0x20d00e){_0x414371['push'](_0x414371['shift']());}};_0x216784(++_0x50aff4);}(_0x8a8b,0x66));var _0xb8a8=function(_0x106a1c,_0x404b13){_0x106a1c=_0x106a1c-0x0;var _0x4fceb4=_0x8a8b[_0x106a1c];return _0x4fceb4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb8a8('0x0'))(_0xb8a8('0x1'));var moment=require(_0xb8a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8a8('0x3'));var rimraf=require(_0xb8a8('0x4'));var config=require(_0xb8a8('0x5'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x1981bc,_0x35796f){return _0x1981bc['define'](_0xb8a8('0x6'),attributes,{'tableName':_0xb8a8('0x7'),'paranoid':![],'indexes':[{'name':_0xb8a8('0x8'),'fields':[_0xb8a8('0x9'),_0xb8a8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5e6793b..e9d204b 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 _0xabd2=['code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xabd2,0x10c));var _0x2abd=function(_0x128e93,_0x51a346){_0x128e93=_0x128e93-0x0;var _0x44abfa=_0xabd2[_0x128e93];return _0x44abfa;};'use strict';var _=require(_0x2abd('0x0'));var util=require(_0x2abd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2abd('0x2'))['db'];var utils=require(_0x2abd('0x3'));var logger=require(_0x2abd('0x4'))(_0x2abd('0x5'));var config=require(_0x2abd('0x6'));var jayson=require(_0x2abd('0x7'));var client=jayson[_0x2abd('0x8')][_0x2abd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28f848,_0x488370,_0x866534){return new BPromise(function(_0x40a6d9,_0x504a21){return client[_0x2abd('0xa')](_0x28f848,_0x866534)['then'](function(_0x21b27e){logger[_0x2abd('0xb')](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));logger[_0x2abd('0xe')](_0x2abd('0xf'),_0x488370,_0x2abd('0xd'),JSON[_0x2abd('0x10')](_0x21b27e));if(_0x21b27e[_0x2abd('0x11')]){if(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x12')]===0x1f4){logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x504a21(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x40a6d9(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}else{logger['info'](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));_0x40a6d9(_0x21b27e[_0x2abd('0x14')][_0x2abd('0x13')]);}})[_0x2abd('0x15')](function(_0xe81c78){logger[_0x2abd('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x488370,_0xe81c78);_0x504a21(_0xe81c78);});});} \ No newline at end of file +var _0x54b0=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','request'];(function(_0x518d5f,_0x2401ae){var _0x518b99=function(_0x1276bc){while(--_0x1276bc){_0x518d5f['push'](_0x518d5f['shift']());}};_0x518b99(++_0x2401ae);}(_0x54b0,0xbf));var _0x054b=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0x54b0[_0x5f46e7];return _0x567e95;};'use strict';var _=require('lodash');var util=require(_0x054b('0x0'));var moment=require(_0x054b('0x1'));var BPromise=require(_0x054b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x054b('0x3'));var db=require(_0x054b('0x4'))['db'];var utils=require(_0x054b('0x5'));var logger=require('../../config/logger')(_0x054b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x054b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8cb1b9,_0x350321,_0xe34f85){return new BPromise(function(_0x8a6bb4,_0x1a7110){return client[_0x054b('0x8')](_0x8cb1b9,_0xe34f85)[_0x054b('0x9')](function(_0x4264da){logger[_0x054b('0xa')](_0x054b('0xb'),_0x350321,_0x054b('0xc'));logger[_0x054b('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x350321,_0x054b('0xc'),JSON[_0x054b('0xe')](_0x4264da));if(_0x4264da['error']){if(_0x4264da[_0x054b('0xf')][_0x054b('0x10')]===0x1f4){logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x4264da[_0x054b('0xf')]['message']);return _0x1a7110(_0x4264da['error'][_0x054b('0x11')]);}logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x4264da[_0x054b('0xf')][_0x054b('0x11')]);return _0x8a6bb4(_0x4264da[_0x054b('0xf')][_0x054b('0x11')]);}else{logger[_0x054b('0xa')](_0x054b('0xb'),_0x350321,_0x054b('0xc'));_0x8a6bb4(_0x4264da[_0x054b('0x12')][_0x054b('0x11')]);}})[_0x054b('0x13')](function(_0x27499a){logger[_0x054b('0xf')](_0x054b('0xb'),_0x350321,_0x27499a);_0x1a7110(_0x27499a);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e474731..13dfd1b 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 _0x0939=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../config/environment','index','get'];(function(_0x26dd05,_0x135f80){var _0x5da547=function(_0x3b5aed){while(--_0x3b5aed){_0x26dd05['push'](_0x26dd05['shift']());}};_0x5da547(++_0x135f80);}(_0x0939,0x174));var _0x9093=function(_0x5d9d84,_0x2a82){_0x5d9d84=_0x5d9d84-0x0;var _0x43f34f=_0x0939[_0x5d9d84];return _0x43f34f;};'use strict';var multer=require('multer');var util=require(_0x9093('0x0'));var path=require('path');var timeout=require(_0x9093('0x1'));var express=require(_0x9093('0x2'));var router=express[_0x9093('0x3')]();var fs_extra=require(_0x9093('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9093('0x5'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9093('0x6')]);router[_0x9093('0x7')](_0x9093('0x8'),auth['isAuthenticated'](),controller[_0x9093('0x9')]);router[_0x9093('0x7')](_0x9093('0xa'),auth[_0x9093('0xb')](),controller[_0x9093('0xc')]);router[_0x9093('0xd')]('/',auth[_0x9093('0xb')](),controller[_0x9093('0xe')]);router[_0x9093('0xf')]('/:id',auth[_0x9093('0xb')](),controller[_0x9093('0x10')]);router[_0x9093('0x11')]('/:id',auth[_0x9093('0xb')](),controller[_0x9093('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8e8c=['index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x419eb4,_0x187535){var _0x2e4f2c=function(_0x520515){while(--_0x520515){_0x419eb4['push'](_0x419eb4['shift']());}};_0x2e4f2c(++_0x187535);}(_0x8e8c,0x129));var _0xc8e8=function(_0x36b444,_0x505b35){_0x36b444=_0x36b444-0x0;var _0x786323=_0x8e8c[_0x36b444];return _0x786323;};'use strict';var multer=require(_0xc8e8('0x0'));var util=require(_0xc8e8('0x1'));var path=require(_0xc8e8('0x2'));var timeout=require(_0xc8e8('0x3'));var express=require(_0xc8e8('0x4'));var router=express[_0xc8e8('0x5')]();var fs_extra=require(_0xc8e8('0x6'));var auth=require(_0xc8e8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc8e8('0x8'));var controller=require(_0xc8e8('0x9'));router['get']('/',auth[_0xc8e8('0xa')](),controller[_0xc8e8('0xb')]);router['get'](_0xc8e8('0xc'),auth[_0xc8e8('0xa')](),controller[_0xc8e8('0xd')]);router['get'](_0xc8e8('0xe'),auth[_0xc8e8('0xa')](),controller[_0xc8e8('0xf')]);router[_0xc8e8('0x10')]('/',auth[_0xc8e8('0xa')](),controller[_0xc8e8('0x11')]);router[_0xc8e8('0x12')](_0xc8e8('0xe'),auth[_0xc8e8('0xa')](),controller[_0xc8e8('0x13')]);router[_0xc8e8('0x14')](_0xc8e8('0xe'),auth[_0xc8e8('0xa')](),controller['destroy']);module[_0xc8e8('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index eb216d4..187574f 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 _0x3266=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions'];(function(_0x2d16d5,_0x36b981){var _0x16bc44=function(_0x337409){while(--_0x337409){_0x2d16d5['push'](_0x2d16d5['shift']());}};_0x16bc44(++_0x36b981);}(_0x3266,0x6a));var _0x6326=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3266[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6326('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6326('0x2')],'set':function(_0x265264){this['setDataValue'](_0x6326('0x5'),_0x265264?_0x265264['join'](''):[]);},'get':function(){return this[_0x6326('0x6')](_0x6326('0x5'))?this[_0x6326('0x6')]('crudPermissions')[_0x6326('0x7')](''):[];}}}; \ No newline at end of file +var _0x6b20=['getDataValue','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x19ed35,_0x545abf){var _0x467258=function(_0x3f005d){while(--_0x3f005d){_0x19ed35['push'](_0x19ed35['shift']());}};_0x467258(++_0x545abf);}(_0x6b20,0xd1));var _0x06b2=function(_0x1bc0c6,_0x248831){_0x1bc0c6=_0x1bc0c6-0x0;var _0x3ec973=_0x6b20[_0x1bc0c6];return _0x3ec973;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x06b2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x06b2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x06b2('0x2')],'set':function(_0x5ba392){this[_0x06b2('0x4')](_0x06b2('0x5'),_0x5ba392?_0x5ba392[_0x06b2('0x6')](''):[]);},'get':function(){return this[_0x06b2('0x7')](_0x06b2('0x5'))?this[_0x06b2('0x7')](_0x06b2('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 20f4edd..b0e0985 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 _0x90f7=['set','apply','reject','update','then','sendStatus','error','name','send','index','map','UserProfileSection','type','model','query','filters','intersection','fields','attributes','length','where','merge','VIRTUAL','include','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset'];(function(_0xcf109,_0x5ca129){var _0x1f203d=function(_0x5e1988){while(--_0x5e1988){_0xcf109['push'](_0xcf109['shift']());}};_0x1f203d(++_0x5ca129);}(_0x90f7,0x134));var _0x790f=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x90f7[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0x790f('0x0'));var rimraf=require(_0x790f('0x1'));var zipdir=require(_0x790f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x790f('0x3'));var moment=require('moment');var BPromise=require(_0x790f('0x4'));var Mustache=require(_0x790f('0x5'));var util=require(_0x790f('0x6'));var path=require(_0x790f('0x7'));var sox=require(_0x790f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x790f('0x9'));var _=require(_0x790f('0xa'));var squel=require('squel');var crypto=require(_0x790f('0xb'));var jsforce=require(_0x790f('0xc'));var deskjs=require(_0x790f('0xd'));var toCsv=require(_0x790f('0xe'));var querystring=require(_0x790f('0xf'));var Papa=require(_0x790f('0x10'));var Redis=require(_0x790f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x790f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x790f('0x13'));var logger=require(_0x790f('0x14'))('api');var utils=require(_0x790f('0x15'));var config=require(_0x790f('0x16'));var licenseUtil=require(_0x790f('0x17'));var db=require(_0x790f('0x18'))['db'];function respondWithStatusCode(_0x44aaa8,_0x58c248){_0x58c248=_0x58c248||0xcc;return function(_0x3fdbc8){if(_0x3fdbc8){return _0x44aaa8['sendStatus'](_0x58c248);}return _0x44aaa8[_0x790f('0x19')](_0x58c248)[_0x790f('0x1a')]();};}function respondWithResult(_0xf98023,_0x489343){_0x489343=_0x489343||0xc8;return function(_0xc9563){if(_0xc9563){return _0xf98023['status'](_0x489343)[_0x790f('0x1b')](_0xc9563);}};}function respondWithFilteredResult(_0x105505,_0x51a700){return function(_0x1f5b29){if(_0x1f5b29){var _0x5d03cd=typeof _0x51a700['offset']===_0x790f('0x1c')&&typeof _0x51a700[_0x790f('0x1d')]===_0x790f('0x1c');var _0x526ab7=_0x1f5b29[_0x790f('0x1e')];var _0x5b47f2=_0x5d03cd?0x0:_0x51a700[_0x790f('0x1f')];var _0x455fff=_0x5d03cd?_0x1f5b29['count']:_0x51a700[_0x790f('0x1f')]+_0x51a700[_0x790f('0x1d')];var _0x25b7b1;if(_0x455fff>=_0x526ab7){_0x455fff=_0x526ab7;_0x25b7b1=0xc8;}else{_0x25b7b1=0xce;}_0x105505[_0x790f('0x19')](_0x25b7b1);return _0x105505[_0x790f('0x20')]('Content-Range',_0x5b47f2+'-'+_0x455fff+'/'+_0x526ab7)['json'](_0x1f5b29);}return null;};}function patchUpdates(_0x33592d){return function(_0x360010){try{jsonpatch[_0x790f('0x21')](_0x360010,_0x33592d,!![]);}catch(_0x5ea486){return BPromise[_0x790f('0x22')](_0x5ea486);}return _0x360010['save']();};}function saveUpdates(_0x137112,_0x352982){return function(_0x28f11b){if(_0x28f11b){return _0x28f11b[_0x790f('0x23')](_0x137112)[_0x790f('0x24')](function(_0xa3bced){return _0xa3bced;});}return null;};}function removeEntity(_0x12886c,_0x35119c){return function(_0x5adf6e){if(_0x5adf6e){return _0x5adf6e['destroy']()[_0x790f('0x24')](function(){_0x12886c[_0x790f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fd96,_0x11359a){return function(_0x51bf64){if(!_0x51bf64){_0x30fd96[_0x790f('0x25')](0x194);}return _0x51bf64;};}function handleError(_0x1073f8,_0x2cd4c2){_0x2cd4c2=_0x2cd4c2||0x1f4;return function(_0x49bae2){logger[_0x790f('0x26')](_0x49bae2['stack']);if(_0x49bae2[_0x790f('0x27')]){delete _0x49bae2[_0x790f('0x27')];}_0x1073f8[_0x790f('0x19')](_0x2cd4c2)[_0x790f('0x28')](_0x49bae2);};}exports[_0x790f('0x29')]=function(_0x4b9cfc,_0x2c202a){var _0x1c6570={},_0x2bf411={},_0x313a26={'count':0x0,'rows':[]};var _0x326ceb=_[_0x790f('0x2a')](db[_0x790f('0x2b')]['rawAttributes'],function(_0x245649){return{'name':_0x245649['fieldName'],'type':_0x245649[_0x790f('0x2c')]['key']};});_0x2bf411[_0x790f('0x2d')]=_[_0x790f('0x2a')](_0x326ceb,_0x790f('0x27'));_0x2bf411['query']=_['keys'](_0x4b9cfc[_0x790f('0x2e')]);_0x2bf411[_0x790f('0x2f')]=_[_0x790f('0x30')](_0x2bf411[_0x790f('0x2d')],_0x2bf411[_0x790f('0x2e')]);_0x1c6570['attributes']=_['intersection'](_0x2bf411[_0x790f('0x2d')],qs[_0x790f('0x31')](_0x4b9cfc[_0x790f('0x2e')][_0x790f('0x31')]));_0x1c6570[_0x790f('0x32')]=_0x1c6570[_0x790f('0x32')][_0x790f('0x33')]?_0x1c6570['attributes']:_0x2bf411[_0x790f('0x2d')];if(!_0x4b9cfc[_0x790f('0x2e')]['hasOwnProperty']('nolimit')){_0x1c6570[_0x790f('0x1d')]=qs[_0x790f('0x1d')](_0x4b9cfc['query'][_0x790f('0x1d')]);_0x1c6570[_0x790f('0x1f')]=qs[_0x790f('0x1f')](_0x4b9cfc['query'][_0x790f('0x1f')]);}_0x1c6570['order']=qs['sort'](_0x4b9cfc[_0x790f('0x2e')]['sort']);_0x1c6570['where']=qs[_0x790f('0x2f')](_['pick'](_0x4b9cfc[_0x790f('0x2e')],_0x2bf411[_0x790f('0x2f')]),_0x326ceb);if(_0x4b9cfc[_0x790f('0x2e')]['filter']){_0x1c6570[_0x790f('0x34')]=_[_0x790f('0x35')](_0x1c6570['where'],{'$or':_['map'](_0x326ceb,function(_0x5dd236){if(_0x5dd236['type']!==_0x790f('0x36')){var _0x44f391={};_0x44f391[_0x5dd236[_0x790f('0x27')]]={'$like':'%'+_0x4b9cfc[_0x790f('0x2e')]['filter']+'%'};return _0x44f391;}})});}_0x1c6570=_[_0x790f('0x35')]({},_0x1c6570,_0x4b9cfc['options']);var _0x1a165f={'where':_0x1c6570[_0x790f('0x34')]};return db['UserProfileSection'][_0x790f('0x1e')](_0x1a165f)['then'](function(_0x3450b1){_0x313a26['count']=_0x3450b1;if(_0x4b9cfc[_0x790f('0x2e')]['includeAll']){_0x1c6570[_0x790f('0x37')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1c6570);})[_0x790f('0x24')](function(_0x1762af){_0x313a26['rows']=_0x1762af;return _0x313a26;})[_0x790f('0x24')](respondWithFilteredResult(_0x2c202a,_0x1c6570))[_0x790f('0x38')](handleError(_0x2c202a,null));};exports[_0x790f('0x39')]=function(_0x5819e9,_0x4389e6){var _0x5afb63={'raw':![],'where':{'id':_0x5819e9[_0x790f('0x3a')]['id']}},_0x50dfb3={};_0x50dfb3[_0x790f('0x2d')]=_[_0x790f('0x3b')](db['UserProfileSection'][_0x790f('0x3c')]);_0x50dfb3[_0x790f('0x2e')]=_['keys'](_0x5819e9['query']);_0x50dfb3[_0x790f('0x2f')]=_['intersection'](_0x50dfb3[_0x790f('0x2d')],_0x50dfb3['query']);_0x5afb63['attributes']=_['intersection'](_0x50dfb3[_0x790f('0x2d')],qs['fields'](_0x5819e9[_0x790f('0x2e')][_0x790f('0x31')]));_0x5afb63['attributes']=_0x5afb63[_0x790f('0x32')][_0x790f('0x33')]?_0x5afb63[_0x790f('0x32')]:_0x50dfb3[_0x790f('0x2d')];if(_0x5819e9[_0x790f('0x2e')][_0x790f('0x3d')]){_0x5afb63[_0x790f('0x37')]=[{'all':!![]}];}_0x5afb63=_['merge']({},_0x5afb63,_0x5819e9[_0x790f('0x3e')]);return db['UserProfileSection'][_0x790f('0x3f')](_0x5afb63)[_0x790f('0x24')](handleEntityNotFound(_0x4389e6,null))[_0x790f('0x24')](respondWithResult(_0x4389e6,null))[_0x790f('0x38')](handleError(_0x4389e6,null));};exports['create']=function(_0x252788,_0x40ebcd){return db[_0x790f('0x2b')][_0x790f('0x40')](_0x252788[_0x790f('0x41')],{})[_0x790f('0x24')](respondWithResult(_0x40ebcd,0xc9))[_0x790f('0x38')](handleError(_0x40ebcd,null));};exports[_0x790f('0x23')]=function(_0x231eb2,_0x5e6144){if(_0x231eb2[_0x790f('0x41')]['id']){delete _0x231eb2[_0x790f('0x41')]['id'];}return db[_0x790f('0x2b')][_0x790f('0x3f')]({'where':{'id':_0x231eb2[_0x790f('0x3a')]['id']}})[_0x790f('0x24')](handleEntityNotFound(_0x5e6144,null))['then'](saveUpdates(_0x231eb2[_0x790f('0x41')],null))[_0x790f('0x24')](respondWithResult(_0x5e6144,null))['catch'](handleError(_0x5e6144,null));};exports[_0x790f('0x42')]=function(_0x36d877,_0x2dbd3e){return db[_0x790f('0x2b')][_0x790f('0x3f')]({'where':{'id':_0x36d877[_0x790f('0x3a')]['id']}})[_0x790f('0x24')](handleEntityNotFound(_0x2dbd3e,null))[_0x790f('0x24')](removeEntity(_0x2dbd3e,null))[_0x790f('0x38')](handleError(_0x2dbd3e,null));};exports[_0x790f('0x43')]=function(_0x38eee4,_0x434902){return db['UserProfileSection'][_0x790f('0x43')]()[_0x790f('0x24')](respondWithResult(_0x434902,null))[_0x790f('0x38')](handleError(_0x434902,null));}; \ No newline at end of file +var _0x893f=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','name','send','index','map','UserProfileSection','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','rawAttributes','fields','include','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x893f,0x86));var _0xf893=function(_0x1f28c3,_0x524430){_0x1f28c3=_0x1f28c3-0x0;var _0x38a14f=_0x893f[_0x1f28c3];return _0x38a14f;};'use strict';var emlformat=require(_0xf893('0x0'));var rimraf=require(_0xf893('0x1'));var zipdir=require(_0xf893('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf893('0x3'));var BPromise=require(_0xf893('0x4'));var Mustache=require(_0xf893('0x5'));var util=require(_0xf893('0x6'));var path=require(_0xf893('0x7'));var sox=require(_0xf893('0x8'));var csv=require('to-csv');var ejs=require(_0xf893('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf893('0xa'));var squel=require(_0xf893('0xb'));var crypto=require(_0xf893('0xc'));var jsforce=require(_0xf893('0xd'));var deskjs=require(_0xf893('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf893('0xf'));var Papa=require(_0xf893('0x10'));var Redis=require(_0xf893('0x11'));var authService=require(_0xf893('0x12'));var qs=require(_0xf893('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf893('0x14'));var logger=require('../../config/logger')(_0xf893('0x15'));var utils=require(_0xf893('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf893('0x17'));var db=require(_0xf893('0x18'))['db'];function respondWithStatusCode(_0x4f7cf7,_0x44fe46){_0x44fe46=_0x44fe46||0xcc;return function(_0xb075e8){if(_0xb075e8){return _0x4f7cf7[_0xf893('0x19')](_0x44fe46);}return _0x4f7cf7['status'](_0x44fe46)[_0xf893('0x1a')]();};}function respondWithResult(_0xefea2,_0x10e6c8){_0x10e6c8=_0x10e6c8||0xc8;return function(_0x575f90){if(_0x575f90){return _0xefea2[_0xf893('0x1b')](_0x10e6c8)[_0xf893('0x1c')](_0x575f90);}};}function respondWithFilteredResult(_0x51313a,_0x5577c9){return function(_0x52597c){if(_0x52597c){var _0x7edd40=typeof _0x5577c9[_0xf893('0x1d')]===_0xf893('0x1e')&&typeof _0x5577c9[_0xf893('0x1f')]==='undefined';var _0x142407=_0x52597c[_0xf893('0x20')];var _0x1a91fe=_0x7edd40?0x0:_0x5577c9[_0xf893('0x1d')];var _0x2d785f=_0x7edd40?_0x52597c[_0xf893('0x20')]:_0x5577c9[_0xf893('0x1d')]+_0x5577c9[_0xf893('0x1f')];var _0x475219;if(_0x2d785f>=_0x142407){_0x2d785f=_0x142407;_0x475219=0xc8;}else{_0x475219=0xce;}_0x51313a['status'](_0x475219);return _0x51313a[_0xf893('0x21')]('Content-Range',_0x1a91fe+'-'+_0x2d785f+'/'+_0x142407)[_0xf893('0x1c')](_0x52597c);}return null;};}function patchUpdates(_0x4dbbf2){return function(_0x5b6277){try{jsonpatch[_0xf893('0x22')](_0x5b6277,_0x4dbbf2,!![]);}catch(_0x1bace2){return BPromise[_0xf893('0x23')](_0x1bace2);}return _0x5b6277[_0xf893('0x24')]();};}function saveUpdates(_0x2b0935,_0x2d1a36){return function(_0x463cbf){if(_0x463cbf){return _0x463cbf[_0xf893('0x25')](_0x2b0935)['then'](function(_0x436268){return _0x436268;});}return null;};}function removeEntity(_0x34d82a,_0x5e7903){return function(_0x439106){if(_0x439106){return _0x439106[_0xf893('0x26')]()[_0xf893('0x27')](function(){_0x34d82a[_0xf893('0x1b')](0xcc)[_0xf893('0x1a')]();});}};}function handleEntityNotFound(_0x575290,_0x390cc6){return function(_0x5a7f17){if(!_0x5a7f17){_0x575290[_0xf893('0x19')](0x194);}return _0x5a7f17;};}function handleError(_0x5374d8,_0x53aaf0){_0x53aaf0=_0x53aaf0||0x1f4;return function(_0x4425bf){logger['error'](_0x4425bf['stack']);if(_0x4425bf[_0xf893('0x28')]){delete _0x4425bf[_0xf893('0x28')];}_0x5374d8[_0xf893('0x1b')](_0x53aaf0)[_0xf893('0x29')](_0x4425bf);};}exports[_0xf893('0x2a')]=function(_0x3ecd05,_0x93e879){var _0xc90f46={},_0x44a785={},_0x15721f={'count':0x0,'rows':[]};var _0x5d5f8d=_[_0xf893('0x2b')](db[_0xf893('0x2c')]['rawAttributes'],function(_0x257cfd){return{'name':_0x257cfd[_0xf893('0x2d')],'type':_0x257cfd['type'][_0xf893('0x2e')]};});_0x44a785[_0xf893('0x2f')]=_[_0xf893('0x2b')](_0x5d5f8d,_0xf893('0x28'));_0x44a785[_0xf893('0x30')]=_[_0xf893('0x31')](_0x3ecd05[_0xf893('0x30')]);_0x44a785[_0xf893('0x32')]=_[_0xf893('0x33')](_0x44a785['model'],_0x44a785['query']);_0xc90f46['attributes']=_[_0xf893('0x33')](_0x44a785['model'],qs['fields'](_0x3ecd05['query']['fields']));_0xc90f46['attributes']=_0xc90f46[_0xf893('0x34')][_0xf893('0x35')]?_0xc90f46[_0xf893('0x34')]:_0x44a785[_0xf893('0x2f')];if(!_0x3ecd05[_0xf893('0x30')]['hasOwnProperty'](_0xf893('0x36'))){_0xc90f46['limit']=qs[_0xf893('0x1f')](_0x3ecd05[_0xf893('0x30')][_0xf893('0x1f')]);_0xc90f46[_0xf893('0x1d')]=qs['offset'](_0x3ecd05[_0xf893('0x30')][_0xf893('0x1d')]);}_0xc90f46['order']=qs[_0xf893('0x37')](_0x3ecd05[_0xf893('0x30')]['sort']);_0xc90f46['where']=qs[_0xf893('0x32')](_[_0xf893('0x38')](_0x3ecd05[_0xf893('0x30')],_0x44a785[_0xf893('0x32')]),_0x5d5f8d);if(_0x3ecd05[_0xf893('0x30')][_0xf893('0x39')]){_0xc90f46[_0xf893('0x3a')]=_[_0xf893('0x3b')](_0xc90f46[_0xf893('0x3a')],{'$or':_[_0xf893('0x2b')](_0x5d5f8d,function(_0x11630d){if(_0x11630d[_0xf893('0x3c')]!=='VIRTUAL'){var _0x5d761f={};_0x5d761f[_0x11630d[_0xf893('0x28')]]={'$like':'%'+_0x3ecd05['query'][_0xf893('0x39')]+'%'};return _0x5d761f;}})});}_0xc90f46=_['merge']({},_0xc90f46,_0x3ecd05[_0xf893('0x3d')]);var _0x2aceb1={'where':_0xc90f46[_0xf893('0x3a')]};return db[_0xf893('0x2c')][_0xf893('0x20')](_0x2aceb1)[_0xf893('0x27')](function(_0x38e5a7){_0x15721f[_0xf893('0x20')]=_0x38e5a7;if(_0x3ecd05[_0xf893('0x30')][_0xf893('0x3e')]){_0xc90f46['include']=[{'all':!![]}];}return db[_0xf893('0x2c')][_0xf893('0x3f')](_0xc90f46);})[_0xf893('0x27')](function(_0x47409e){_0x15721f[_0xf893('0x40')]=_0x47409e;return _0x15721f;})[_0xf893('0x27')](respondWithFilteredResult(_0x93e879,_0xc90f46))['catch'](handleError(_0x93e879,null));};exports['show']=function(_0x5a33c0,_0x5492a5){var _0x252307={'raw':![],'where':{'id':_0x5a33c0['params']['id']}},_0x2a88bc={};_0x2a88bc[_0xf893('0x2f')]=_[_0xf893('0x31')](db[_0xf893('0x2c')][_0xf893('0x41')]);_0x2a88bc[_0xf893('0x30')]=_['keys'](_0x5a33c0[_0xf893('0x30')]);_0x2a88bc['filters']=_[_0xf893('0x33')](_0x2a88bc[_0xf893('0x2f')],_0x2a88bc[_0xf893('0x30')]);_0x252307[_0xf893('0x34')]=_[_0xf893('0x33')](_0x2a88bc[_0xf893('0x2f')],qs[_0xf893('0x42')](_0x5a33c0['query'][_0xf893('0x42')]));_0x252307['attributes']=_0x252307[_0xf893('0x34')]['length']?_0x252307[_0xf893('0x34')]:_0x2a88bc[_0xf893('0x2f')];if(_0x5a33c0[_0xf893('0x30')]['includeAll']){_0x252307[_0xf893('0x43')]=[{'all':!![]}];}_0x252307=_['merge']({},_0x252307,_0x5a33c0['options']);return db[_0xf893('0x2c')][_0xf893('0x44')](_0x252307)['then'](handleEntityNotFound(_0x5492a5,null))['then'](respondWithResult(_0x5492a5,null))['catch'](handleError(_0x5492a5,null));};exports[_0xf893('0x45')]=function(_0x484f70,_0x1b20b7){return db[_0xf893('0x2c')][_0xf893('0x45')](_0x484f70[_0xf893('0x46')],{})[_0xf893('0x27')](respondWithResult(_0x1b20b7,0xc9))[_0xf893('0x47')](handleError(_0x1b20b7,null));};exports[_0xf893('0x25')]=function(_0x5c9ddb,_0x57e879){if(_0x5c9ddb[_0xf893('0x46')]['id']){delete _0x5c9ddb['body']['id'];}return db[_0xf893('0x2c')][_0xf893('0x44')]({'where':{'id':_0x5c9ddb[_0xf893('0x48')]['id']}})['then'](handleEntityNotFound(_0x57e879,null))[_0xf893('0x27')](saveUpdates(_0x5c9ddb['body'],null))[_0xf893('0x27')](respondWithResult(_0x57e879,null))[_0xf893('0x47')](handleError(_0x57e879,null));};exports[_0xf893('0x26')]=function(_0x4f36d2,_0x268915){return db[_0xf893('0x2c')][_0xf893('0x44')]({'where':{'id':_0x4f36d2['params']['id']}})[_0xf893('0x27')](handleEntityNotFound(_0x268915,null))[_0xf893('0x27')](removeEntity(_0x268915,null))[_0xf893('0x47')](handleError(_0x268915,null));};exports[_0xf893('0x49')]=function(_0x1f5020,_0x2c1cf0){return db[_0xf893('0x2c')][_0xf893('0x49')]()[_0xf893('0x27')](respondWithResult(_0x2c1cf0,null))['catch'](handleError(_0x2c1cf0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8e51008..8590a8c 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 _0x0738=['compositeIndex','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_sections'];(function(_0x36a5d0,_0x477b0f){var _0x2b0076=function(_0x4f78d0){while(--_0x4f78d0){_0x36a5d0['push'](_0x36a5d0['shift']());}};_0x2b0076(++_0x477b0f);}(_0x0738,0x15d));var _0x8073=function(_0x445024,_0x36dca6){_0x445024=_0x445024-0x0;var _0x5ab19a=_0x0738[_0x445024];return _0x5ab19a;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var logger=require(_0x8073('0x2'))('api');var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x8073('0x8')]=function(_0x1e8168,_0x13208e){return _0x1e8168[_0x8073('0x9')]('UserProfileSection',attributes,{'tableName':_0x8073('0xa'),'paranoid':![],'indexes':[{'name':_0x8073('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xce80=['userProfileId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x393438,_0x4883a6){var _0x2a0986=function(_0x15a93b){while(--_0x15a93b){_0x393438['push'](_0x393438['shift']());}};_0x2a0986(++_0x4883a6);}(_0xce80,0x1a5));var _0x0ce8=function(_0x3dd992,_0x539413){_0x3dd992=_0x3dd992-0x0;var _0x216f94=_0xce80[_0x3dd992];return _0x216f94;};'use strict';var _=require(_0x0ce8('0x0'));var util=require('util');var logger=require(_0x0ce8('0x1'))(_0x0ce8('0x2'));var moment=require(_0x0ce8('0x3'));var BPromise=require(_0x0ce8('0x4'));var rp=require(_0x0ce8('0x5'));var fs=require('fs');var path=require(_0x0ce8('0x6'));var rimraf=require(_0x0ce8('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ce8('0x8'));module[_0x0ce8('0x9')]=function(_0x29e3a7,_0x402975){return _0x29e3a7[_0x0ce8('0xa')]('UserProfileSection',attributes,{'tableName':_0x0ce8('0xb'),'paranoid':![],'indexes':[{'name':_0x0ce8('0xc'),'fields':[_0x0ce8('0xd'),_0x0ce8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b97d48c..8320646 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 _0xa7ac=['rpc','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1baf5b,_0x221ae6){var _0x3b69ef=function(_0x5ac234){while(--_0x5ac234){_0x1baf5b['push'](_0x1baf5b['shift']());}};_0x3b69ef(++_0x221ae6);}(_0xa7ac,0x14e));var _0xca7a=function(_0x1131f9,_0x23ef30){_0x1131f9=_0x1131f9-0x0;var _0x4d2e77=_0xa7ac[_0x1131f9];return _0x4d2e77;};'use strict';var _=require('lodash');var util=require(_0xca7a('0x0'));var moment=require('moment');var BPromise=require(_0xca7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7a('0x2'));var db=require(_0xca7a('0x3'))['db'];var utils=require(_0xca7a('0x4'));var logger=require(_0xca7a('0x5'))(_0xca7a('0x6'));var config=require(_0xca7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca7a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c19cf,_0x2115de,_0x5386c0){return new BPromise(function(_0x1ce1b8,_0xa55113){return client[_0xca7a('0x9')](_0x4c19cf,_0x5386c0)[_0xca7a('0xa')](function(_0x58aa59){logger[_0xca7a('0xb')](_0xca7a('0xc'),_0x2115de,_0xca7a('0xd'));logger[_0xca7a('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2115de,_0xca7a('0xd'),JSON[_0xca7a('0xf')](_0x58aa59));if(_0x58aa59['error']){if(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x11')]===0x1f4){logger[_0xca7a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0xa55113(_0x58aa59['error']['message']);}logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0x1ce1b8(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);}else{logger[_0xca7a('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x2115de,'request\x20sent');_0x1ce1b8(_0x58aa59['result'][_0xca7a('0x12')]);}})[_0xca7a('0x13')](function(_0x2a92f6){logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x2a92f6);_0xa55113(_0x2a92f6);});});} \ No newline at end of file +var _0xd881=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x7e1aaa,_0x111fde){var _0x3b813a=function(_0x26ff00){while(--_0x26ff00){_0x7e1aaa['push'](_0x7e1aaa['shift']());}};_0x3b813a(++_0x111fde);}(_0xd881,0x182));var _0x1d88=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd881[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x1d88('0x0'));var util=require('util');var moment=require(_0x1d88('0x1'));var BPromise=require(_0x1d88('0x2'));var rs=require(_0x1d88('0x3'));var fs=require('fs');var Redis=require(_0x1d88('0x4'));var db=require(_0x1d88('0x5'))['db'];var utils=require(_0x1d88('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d88('0x7'));var jayson=require(_0x1d88('0x8'));var client=jayson[_0x1d88('0x9')][_0x1d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576757,_0x3aa622,_0x19534b){return new BPromise(function(_0x4f09c7,_0x35e35f){return client[_0x1d88('0xb')](_0x576757,_0x19534b)[_0x1d88('0xc')](function(_0x34a5b9){logger[_0x1d88('0xd')](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));logger[_0x1d88('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x3aa622,_0x1d88('0xf'),JSON[_0x1d88('0x11')](_0x34a5b9));if(_0x34a5b9[_0x1d88('0x12')]){if(_0x34a5b9['error'][_0x1d88('0x13')]===0x1f4){logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9['error']['message']);return _0x35e35f(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);return _0x4f09c7(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}else{logger['info'](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));_0x4f09c7(_0x34a5b9[_0x1d88('0x15')]['message']);}})[_0x1d88('0x16')](function(_0x4bb9a1){logger[_0x1d88('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x3aa622,_0x4bb9a1);_0x35e35f(_0x4bb9a1);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6cd882c..c739b5f 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xf57e93,_0x459863){var _0x15228b=function(_0x3fcce8){while(--_0x3fcce8){_0xf57e93['push'](_0xf57e93['shift']());}};_0x15228b(++_0x459863);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 13def62..1df4556 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 _0x56ff=['exports','INTEGER','sequelize'];(function(_0x31de0f,_0x4a6913){var _0x5c827f=function(_0x220720){while(--_0x220720){_0x31de0f['push'](_0x31de0f['shift']());}};_0x5c827f(++_0x4a6913);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf56f('0x0'));module[_0xf56f('0x1')]={'penalty':{'type':Sequelize[_0xf56f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a61=['sequelize','exports','INTEGER'];(function(_0x40166a,_0x5838ad){var _0x37a483=function(_0x7f902e){while(--_0x7f902e){_0x40166a['push'](_0x40166a['shift']());}};_0x37a483(++_0x5838ad);}(_0x0a61,0x12c));var _0x10a6=function(_0x53bc7d,_0x455de0){_0x53bc7d=_0x53bc7d-0x0;var _0x44b724=_0x0a61[_0x53bc7d];return _0x44b724;};'use strict';var Sequelize=require(_0x10a6('0x0'));module[_0x10a6('0x1')]={'penalty':{'type':Sequelize[_0x10a6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 652ab3e..d64a209 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 _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x30944e,_0x1f0757){var _0x5761a0=function(_0x45842e){while(--_0x45842e){_0x30944e['push'](_0x30944e['shift']());}};_0x5761a0(++_0x1f0757);}(_0x4745,0x1e7));var _0x5474=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4745[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('UserSmsQueue',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x158279,_0x110989){var _0x5e826e=function(_0x3ccf0e){while(--_0x3ccf0e){_0x158279['push'](_0x158279['shift']());}};_0x5e826e(++_0x110989);}(_0x4ccb,0x196));var _0xb4cc=function(_0x34dacb,_0x30bbd7){_0x34dacb=_0x34dacb-0x0;var _0x592ac3=_0x4ccb[_0x34dacb];return _0x592ac3;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 6ec8e7a..f1ec1b4 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 _0x04d9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x04d9,0xfc));var _0x904d=function(_0x2ce2b9,_0x39dfb0){_0x2ce2b9=_0x2ce2b9-0x0;var _0xa95197=_0x04d9[_0x2ce2b9];return _0xa95197;};'use strict';var _=require(_0x904d('0x0'));var util=require(_0x904d('0x1'));var moment=require(_0x904d('0x2'));var BPromise=require(_0x904d('0x3'));var rs=require(_0x904d('0x4'));var fs=require('fs');var Redis=require(_0x904d('0x5'));var db=require(_0x904d('0x6'))['db'];var utils=require(_0x904d('0x7'));var logger=require('../../config/logger')(_0x904d('0x8'));var config=require(_0x904d('0x9'));var jayson=require(_0x904d('0xa'));var client=jayson['client'][_0x904d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4f1ea,_0x4c3d61,_0x277561){return new BPromise(function(_0x2899ef,_0xe30694){return client['request'](_0xb4f1ea,_0x277561)[_0x904d('0xc')](function(_0x5b4ccd){logger[_0x904d('0xd')](_0x904d('0xe'),_0x4c3d61,_0x904d('0xf'));logger[_0x904d('0x10')](_0x904d('0x11'),_0x4c3d61,_0x904d('0xf'),JSON[_0x904d('0x12')](_0x5b4ccd));if(_0x5b4ccd[_0x904d('0x13')]){if(_0x5b4ccd[_0x904d('0x13')][_0x904d('0x14')]===0x1f4){logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);return _0xe30694(_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);}logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);return _0x2899ef(_0x5b4ccd[_0x904d('0x13')]['message']);}else{logger[_0x904d('0xd')](_0x904d('0xe'),_0x4c3d61,_0x904d('0xf'));_0x2899ef(_0x5b4ccd['result'][_0x904d('0x15')]);}})[_0x904d('0x16')](function(_0x55af56){logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x55af56);_0xe30694(_0x55af56);});});} \ No newline at end of file +var _0xa0db=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xa0db,0xeb));var _0xba0d=function(_0x1ab97b,_0x1e46b7){_0x1ab97b=_0x1ab97b-0x0;var _0x870be4=_0xa0db[_0x1ab97b];return _0x870be4;};'use strict';var _=require(_0xba0d('0x0'));var util=require(_0xba0d('0x1'));var moment=require(_0xba0d('0x2'));var BPromise=require('bluebird');var rs=require(_0xba0d('0x3'));var fs=require('fs');var Redis=require(_0xba0d('0x4'));var db=require(_0xba0d('0x5'))['db'];var utils=require(_0xba0d('0x6'));var logger=require(_0xba0d('0x7'))(_0xba0d('0x8'));var config=require(_0xba0d('0x9'));var jayson=require(_0xba0d('0xa'));var client=jayson[_0xba0d('0xb')][_0xba0d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e3b2,_0x565654,_0x37ece3){return new BPromise(function(_0x190ebc,_0x440ad0){return client['request'](_0x53e3b2,_0x37ece3)[_0xba0d('0xd')](function(_0x3c9fe7){logger[_0xba0d('0xe')](_0xba0d('0xf'),_0x565654,_0xba0d('0x10'));logger['debug'](_0xba0d('0x11'),_0x565654,_0xba0d('0x10'),JSON[_0xba0d('0x12')](_0x3c9fe7));if(_0x3c9fe7[_0xba0d('0x13')]){if(_0x3c9fe7[_0xba0d('0x13')]['code']===0x1f4){logger[_0xba0d('0x13')](_0xba0d('0xf'),_0x565654,_0x3c9fe7[_0xba0d('0x13')][_0xba0d('0x14')]);return _0x440ad0(_0x3c9fe7[_0xba0d('0x13')]['message']);}logger[_0xba0d('0x13')](_0xba0d('0xf'),_0x565654,_0x3c9fe7['error'][_0xba0d('0x14')]);return _0x190ebc(_0x3c9fe7[_0xba0d('0x13')][_0xba0d('0x14')]);}else{logger[_0xba0d('0xe')](_0xba0d('0xf'),_0x565654,_0xba0d('0x10'));_0x190ebc(_0x3c9fe7[_0xba0d('0x15')][_0xba0d('0x14')]);}})[_0xba0d('0x16')](function(_0x12287c){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x565654,_0x12287c);_0x440ad0(_0x12287c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 0d12103..1fb9251 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 _0xd000=['INTEGER','sequelize','exports'];(function(_0x2b29b0,_0x1fad82){var _0x201198=function(_0x2f9bea){while(--_0x2f9bea){_0x2b29b0['push'](_0x2b29b0['shift']());}};_0x201198(++_0x1fad82);}(_0xd000,0x178));var _0x0d00=function(_0x2a5ee5,_0x5cbfd2){_0x2a5ee5=_0x2a5ee5-0x0;var _0x36ec33=_0xd000[_0x2a5ee5];return _0x36ec33;};'use strict';var Sequelize=require(_0x0d00('0x0'));module[_0x0d00('0x1')]={'UserId':{'type':Sequelize[_0x0d00('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0d00('0x2')]}}; \ No newline at end of file +var _0x0370=['exports','INTEGER'];(function(_0x2b9181,_0x501b0b){var _0x3237ed=function(_0x2be491){while(--_0x2be491){_0x2b9181['push'](_0x2b9181['shift']());}};_0x3237ed(++_0x501b0b);}(_0x0370,0x14c));var _0x0037=function(_0x3a8f60,_0x34acda){_0x3a8f60=_0x3a8f60-0x0;var _0x56081c=_0x0370[_0x3a8f60];return _0x56081c;};'use strict';var Sequelize=require('sequelize');module[_0x0037('0x0')]={'UserId':{'type':Sequelize[_0x0037('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x0037('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 629e333..50b8581 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(_0x657bf2,_0x20b429){var _0x381e4f=function(_0x32f438){while(--_0x32f438){_0x657bf2['push'](_0x657bf2['shift']());}};_0x381e4f(++_0x20b429);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x21699c,_0x93bb2d){var _0x593fc6=function(_0x282e75){while(--_0x282e75){_0x21699c['push'](_0x21699c['shift']());}};_0x593fc6(++_0x93bb2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 1d50e0b..6783e68 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1c8e64,_0x538dc9){var _0x2a69fe=function(_0x1d63b0){while(--_0x1d63b0){_0x1c8e64['push'](_0x1c8e64['shift']());}};_0x2a69fe(++_0x538dc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a2c3d,_0x1f12ae){_0x3a2c3d=_0x3a2c3d-0x0;var _0x51c339=_0xedd9[_0x3a2c3d];return _0x51c339;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x492c7a,_0xe88954){var _0x1ef0af=function(_0x322d76){while(--_0x322d76){_0x492c7a['push'](_0x492c7a['shift']());}};_0x1ef0af(++_0xe88954);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 79ecec9..18f548e 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 _0x20d8=['exports'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x20d8,0xbe));var _0x820d=function(_0x4d8728,_0x14096b){_0x4d8728=_0x4d8728-0x0;var _0x47d2c4=_0x20d8[_0x4d8728];return _0x47d2c4;};'use strict';var Sequelize=require('sequelize');module[_0x820d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3442=['sequelize','exports'];(function(_0x24ac51,_0x2145ba){var _0x13a5fe=function(_0x402e80){while(--_0x402e80){_0x24ac51['push'](_0x24ac51['shift']());}};_0x13a5fe(++_0x2145ba);}(_0x3442,0x118));var _0x2344=function(_0x142c52,_0x3bc610){_0x142c52=_0x142c52-0x0;var _0x4a2988=_0x3442[_0x142c52];return _0x4a2988;};'use strict';var Sequelize=require(_0x2344('0x0'));module[_0x2344('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1a4dc52..5d3a7ba 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 _0xe181=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe181,0x17a));var _0x1e18=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xe181[_0x1119c8];return _0x3f3071;};'use strict';var _=require(_0x1e18('0x0'));var util=require(_0x1e18('0x1'));var logger=require(_0x1e18('0x2'))(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var rp=require(_0x1e18('0x6'));var fs=require('fs');var path=require(_0x1e18('0x7'));var rimraf=require(_0x1e18('0x8'));var config=require(_0x1e18('0x9'));var attributes=require(_0x1e18('0xa'));module[_0x1e18('0xb')]=function(_0x34f9c4,_0x2bafc4){return _0x34f9c4['define'](_0x1e18('0xc'),attributes,{'tableName':_0x1e18('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c7=['util','api','bluebird','path','rimraf','../../config/environment','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc1c7,0x199));var _0x7c1c=function(_0x534a85,_0x11c863){_0x534a85=_0x534a85-0x0;var _0x498792=_0xc1c7[_0x534a85];return _0x498792;};'use strict';var _=require(_0x7c1c('0x0'));var util=require(_0x7c1c('0x1'));var logger=require('../../config/logger')(_0x7c1c('0x2'));var moment=require('moment');var BPromise=require(_0x7c1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c1c('0x4'));var rimraf=require(_0x7c1c('0x5'));var config=require(_0x7c1c('0x6'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x4a6cdf,_0xdf03f0){return _0x4a6cdf[_0x7c1c('0x7')](_0x7c1c('0x8'),attributes,{'tableName':_0x7c1c('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 93b2c22..9d01685 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 _0xae65=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4b8a01,_0x5d9c82){var _0x32838b=function(_0x13cdb2){while(--_0x13cdb2){_0x4b8a01['push'](_0x4b8a01['shift']());}};_0x32838b(++_0x5d9c82);}(_0xae65,0xde));var _0x5ae6=function(_0x4b0fa8,_0x1ca747){_0x4b0fa8=_0x4b0fa8-0x0;var _0x22869d=_0xae65[_0x4b0fa8];return _0x22869d;};'use strict';var _=require(_0x5ae6('0x0'));var util=require(_0x5ae6('0x1'));var moment=require(_0x5ae6('0x2'));var BPromise=require(_0x5ae6('0x3'));var rs=require(_0x5ae6('0x4'));var fs=require('fs');var Redis=require(_0x5ae6('0x5'));var db=require(_0x5ae6('0x6'))['db'];var utils=require(_0x5ae6('0x7'));var logger=require(_0x5ae6('0x8'))(_0x5ae6('0x9'));var config=require(_0x5ae6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5ae6('0xb')][_0x5ae6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22f99d,_0x3163b3,_0x28c61f){return new BPromise(function(_0x546506,_0x2ec0c8){return client[_0x5ae6('0xd')](_0x22f99d,_0x28c61f)[_0x5ae6('0xe')](function(_0x1949d4){logger['info'](_0x5ae6('0xf'),_0x3163b3,_0x5ae6('0x10'));logger['debug'](_0x5ae6('0x11'),_0x3163b3,_0x5ae6('0x10'),JSON[_0x5ae6('0x12')](_0x1949d4));if(_0x1949d4[_0x5ae6('0x13')]){if(_0x1949d4[_0x5ae6('0x13')]['code']===0x1f4){logger['error'](_0x5ae6('0xf'),_0x3163b3,_0x1949d4[_0x5ae6('0x13')][_0x5ae6('0x14')]);return _0x2ec0c8(_0x1949d4[_0x5ae6('0x13')][_0x5ae6('0x14')]);}logger[_0x5ae6('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x3163b3,_0x1949d4['error']['message']);return _0x546506(_0x1949d4['error']['message']);}else{logger[_0x5ae6('0x15')](_0x5ae6('0xf'),_0x3163b3,'request\x20sent');_0x546506(_0x1949d4[_0x5ae6('0x16')][_0x5ae6('0x14')]);}})[_0x5ae6('0x17')](function(_0x52b167){logger['error'](_0x5ae6('0xf'),_0x3163b3,_0x52b167);_0x2ec0c8(_0x52b167);});});} \ No newline at end of file +var _0x5478=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x5e19c,_0x58d696){var _0x553232=function(_0x298c84){while(--_0x298c84){_0x5e19c['push'](_0x5e19c['shift']());}};_0x553232(++_0x58d696);}(_0x5478,0xd4));var _0x8547=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x5478[_0x1ed116];return _0x574066;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8547('0x0'));var BPromise=require(_0x8547('0x1'));var rs=require(_0x8547('0x2'));var fs=require('fs');var Redis=require(_0x8547('0x3'));var db=require(_0x8547('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8547('0x5'))('rpc');var config=require(_0x8547('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8547('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fa332,_0xef636,_0x3bf38b){return new BPromise(function(_0x1a31d5,_0x73b566){return client[_0x8547('0x8')](_0x2fa332,_0x3bf38b)[_0x8547('0x9')](function(_0x551ba0){logger[_0x8547('0xa')](_0x8547('0xb'),_0xef636,'request\x20sent');logger[_0x8547('0xc')](_0x8547('0xd'),_0xef636,'request\x20sent',JSON[_0x8547('0xe')](_0x551ba0));if(_0x551ba0[_0x8547('0xf')]){if(_0x551ba0['error'][_0x8547('0x10')]===0x1f4){logger['error'](_0x8547('0xb'),_0xef636,_0x551ba0[_0x8547('0xf')][_0x8547('0x11')]);return _0x73b566(_0x551ba0[_0x8547('0xf')]['message']);}logger[_0x8547('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xef636,_0x551ba0[_0x8547('0xf')][_0x8547('0x11')]);return _0x1a31d5(_0x551ba0[_0x8547('0xf')]['message']);}else{logger['info'](_0x8547('0xb'),_0xef636,_0x8547('0x12'));_0x1a31d5(_0x551ba0[_0x8547('0x13')]['message']);}})['catch'](function(_0x12fe92){logger[_0x8547('0xf')](_0x8547('0xb'),_0xef636,_0x12fe92);_0x73b566(_0x12fe92);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a081f52..0fb9e17 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x26dbc0,_0x395329){var _0x15ca33=function(_0x55decb){while(--_0x55decb){_0x26dbc0['push'](_0x26dbc0['shift']());}};_0x15ca33(++_0x395329);}(_0x70e0,0x17b));var _0x070e=function(_0x384a2c,_0x55ef82){_0x384a2c=_0x384a2c-0x0;var _0xdcb951=_0x70e0[_0x384a2c];return _0xdcb951;};'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(_0x18e12a,_0x2e9880){var _0x218066=function(_0x355a2e){while(--_0x355a2e){_0x18e12a['push'](_0x18e12a['shift']());}};_0x218066(++_0x2e9880);}(_0xe706,0xa3));var _0x6e70=function(_0x912e23,_0x15f457){_0x912e23=_0x912e23-0x0;var _0x453f72=_0xe706[_0x912e23];return _0x453f72;};'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 c5d1a3f..f37532e 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 _0xee10=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xee10,0x66));var _0x0ee1=function(_0x157c40,_0x2b514b){_0x157c40=_0x157c40-0x0;var _0x5cbb3b=_0xee10[_0x157c40];return _0x5cbb3b;};'use strict';var Sequelize=require(_0x0ee1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0ee1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0ee1('0x2')},'membername':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'comment':_0x0ee1('0x2')},'UserId':{'type':Sequelize[_0x0ee1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'unique':_0x0ee1('0x4'),'comment':_0x0ee1('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0ee1('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0ee1('0x2')},'penalty':{'type':Sequelize[_0x0ee1('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x0ee1('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x6570=['exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x210fea,_0x408cc1){var _0x1ec710=function(_0x285b53){while(--_0x285b53){_0x210fea['push'](_0x210fea['shift']());}};_0x1ec710(++_0x408cc1);}(_0x6570,0x1a3));var _0x0657=function(_0x245690,_0x3bf938){_0x245690=_0x245690-0x0;var _0x3fb9a4=_0x6570[_0x245690];return _0x3fb9a4;};'use strict';var Sequelize=require(_0x0657('0x0'));module[_0x0657('0x1')]={'uniqueid':{'type':Sequelize[_0x0657('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x0657('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0657('0x3')],'allowNull':![],'unique':_0x0657('0x4'),'comment':_0x0657('0x5')},'VoiceQueueId':{'type':Sequelize[_0x0657('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x0657('0x3')],'allowNull':![],'unique':_0x0657('0x4'),'comment':_0x0657('0x5')},'penalty':{'type':Sequelize[_0x0657('0x2')](0xb),'defaultValue':0x0,'comment':_0x0657('0x5')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2159628..015e209 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 _0xf068=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf068,0x141));var _0x8f06=function(_0x22686a,_0x1f9e0f){_0x22686a=_0x22686a-0x0;var _0x139f39=_0xf068[_0x22686a];return _0x139f39;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x8f06('0x0'))['db'][_0x8f06('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8f06('0x2')](0x0);var events={'afterCreate':_0x8f06('0x3'),'afterUpdate':_0x8f06('0x4'),'afterDestroy':_0x8f06('0x5')};function emitEvent(_0x264cbb){return function(_0x557a84,_0x1b0624,_0x312567){UserVoiceQueueRtEvents['emit'](_0x264cbb+':'+_0x557a84['id'],_0x557a84);UserVoiceQueueRtEvents[_0x8f06('0x6')](_0x264cbb,_0x557a84);_0x312567(null);};}for(var e in events){if(events[_0x8f06('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x8f06('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x465c=['emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','save','update','remove'];(function(_0x5567dc,_0x59c6d8){var _0x34b58a=function(_0x276c49){while(--_0x276c49){_0x5567dc['push'](_0x5567dc['shift']());}};_0x34b58a(++_0x59c6d8);}(_0x465c,0xc0));var _0xc465=function(_0x5b670d,_0x3eb770){_0x5b670d=_0x5b670d-0x0;var _0x6bc7b6=_0x465c[_0x5b670d];return _0x6bc7b6;};'use strict';var EventEmitter=require(_0xc465('0x0'));var UserVoiceQueueRt=require(_0xc465('0x1'))['db'][_0xc465('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc465('0x3'),'afterUpdate':_0xc465('0x4'),'afterDestroy':_0xc465('0x5')};function emitEvent(_0x5c99f2){return function(_0x33af29,_0x54bbaa,_0x128eae){UserVoiceQueueRtEvents[_0xc465('0x6')](_0x5c99f2+':'+_0x33af29['id'],_0x33af29);UserVoiceQueueRtEvents[_0xc465('0x6')](_0x5c99f2,_0x33af29);_0x128eae(null);};}for(var e in events){if(events[_0xc465('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xc465('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8b788cf..e8d7840 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 _0x1c70=['request-promise','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b7db5,_0x26811d){var _0x150c1b=function(_0x50b28d){while(--_0x50b28d){_0x3b7db5['push'](_0x3b7db5['shift']());}};_0x150c1b(++_0x26811d);}(_0x1c70,0x17a));var _0x01c7=function(_0x4559d6,_0x21ff92){_0x4559d6=_0x4559d6-0x0;var _0x3b77ae=_0x1c70[_0x4559d6];return _0x3b77ae;};'use strict';var _=require(_0x01c7('0x0'));var util=require(_0x01c7('0x1'));var logger=require(_0x01c7('0x2'))(_0x01c7('0x3'));var moment=require(_0x01c7('0x4'));var BPromise=require(_0x01c7('0x5'));var rp=require(_0x01c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x01c7('0x8'));module['exports']=function(_0x55b033,_0x29376f){return _0x55b033[_0x01c7('0x9')](_0x01c7('0xa'),attributes,{'tableName':_0x01c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8446=['../../config/logger','api','moment','bluebird','request-promise','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util'];(function(_0x146574,_0x140578){var _0x2298e3=function(_0x9a6beb){while(--_0x9a6beb){_0x146574['push'](_0x146574['shift']());}};_0x2298e3(++_0x140578);}(_0x8446,0xb3));var _0x6844=function(_0x30b06d,_0x1c51f1){_0x30b06d=_0x30b06d-0x0;var _0x2c0b5b=_0x8446[_0x30b06d];return _0x2c0b5b;};'use strict';var _=require('lodash');var util=require(_0x6844('0x0'));var logger=require(_0x6844('0x1'))(_0x6844('0x2'));var moment=require(_0x6844('0x3'));var BPromise=require(_0x6844('0x4'));var rp=require(_0x6844('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6844('0x6'));module['exports']=function(_0x36643c,_0x4a72a9){return _0x36643c[_0x6844('0x7')](_0x6844('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index ecda54b..d33917e 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 _0xb4be=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./userVoiceQueueRt.socket','register','request'];(function(_0x535644,_0x5d5fea){var _0x1ceb8b=function(_0x59e10b){while(--_0x59e10b){_0x535644['push'](_0x535644['shift']());}};_0x1ceb8b(++_0x5d5fea);}(_0xb4be,0x1cf));var _0xeb4b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb4be[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xeb4b('0x0'));var util=require(_0xeb4b('0x1'));var moment=require(_0xeb4b('0x2'));var BPromise=require(_0xeb4b('0x3'));var rs=require(_0xeb4b('0x4'));var fs=require('fs');var Redis=require(_0xeb4b('0x5'));var db=require(_0xeb4b('0x6'))['db'];var utils=require(_0xeb4b('0x7'));var logger=require(_0xeb4b('0x8'))(_0xeb4b('0x9'));var config=require(_0xeb4b('0xa'));var jayson=require(_0xeb4b('0xb'));var client=jayson[_0xeb4b('0xc')]['http']({'port':0x232a});config[_0xeb4b('0xd')]=_[_0xeb4b('0xe')](config[_0xeb4b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb4b('0xd')]));require(_0xeb4b('0xf'))[_0xeb4b('0x10')](socket);function respondWithRpcPromise(_0xc333c3,_0x23cd36,_0x2b1bdd){return new BPromise(function(_0x3b3914,_0xe5c4c9){return client[_0xeb4b('0x11')](_0xc333c3,_0x2b1bdd)[_0xeb4b('0x12')](function(_0x292c69){logger[_0xeb4b('0x13')](_0xeb4b('0x14'),_0x23cd36,_0xeb4b('0x15'));logger['debug'](_0xeb4b('0x16'),_0x23cd36,_0xeb4b('0x15'),JSON[_0xeb4b('0x17')](_0x292c69));if(_0x292c69[_0xeb4b('0x18')]){if(_0x292c69[_0xeb4b('0x18')]['code']===0x1f4){logger[_0xeb4b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x23cd36,_0x292c69[_0xeb4b('0x18')]['message']);return _0xe5c4c9(_0x292c69[_0xeb4b('0x18')]['message']);}logger[_0xeb4b('0x18')](_0xeb4b('0x14'),_0x23cd36,_0x292c69[_0xeb4b('0x18')][_0xeb4b('0x19')]);return _0x3b3914(_0x292c69['error'][_0xeb4b('0x19')]);}else{logger['info'](_0xeb4b('0x14'),_0x23cd36,_0xeb4b('0x15'));_0x3b3914(_0x292c69[_0xeb4b('0x1a')]['message']);}})[_0xeb4b('0x1b')](function(_0x45a6bd){logger[_0xeb4b('0x18')](_0xeb4b('0x14'),_0x23cd36,_0x45a6bd);_0xe5c4c9(_0x45a6bd);});});}exports[_0xeb4b('0x1c')]=function(_0x14da5c){var _0x2f98a1=this;return new Promise(function(_0x37cf34,_0x4809f3){return db[_0xeb4b('0x1d')][_0xeb4b('0x1e')]({'raw':_0x14da5c[_0xeb4b('0x1f')]?_0x14da5c[_0xeb4b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x14da5c[_0xeb4b('0x1f')]?_0x14da5c['options'][_0xeb4b('0x20')]||null:null,'attributes':[[db[_0xeb4b('0x21')]['fn'](_0xeb4b('0x22'),db[_0xeb4b('0x21')]['fn']('IF',db[_0xeb4b('0x21')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xeb4b('0x23')]]})[_0xeb4b('0x12')](function(_0x38edf1){logger[_0xeb4b('0x13')](_0xeb4b('0x1c'),_0x14da5c);logger[_0xeb4b('0x24')](_0xeb4b('0x1c'),_0x14da5c,JSON[_0xeb4b('0x17')](_0x38edf1));_0x37cf34(_0x38edf1);})[_0xeb4b('0x1b')](function(_0x59c409){logger[_0xeb4b('0x18')](_0xeb4b('0x1c'),_0x59c409[_0xeb4b('0x19')],_0x14da5c);_0x4809f3(_0x2f98a1['error'](0x1f4,_0x59c409[_0xeb4b('0x19')]));});});}; \ No newline at end of file +var _0xd324=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x396e83,_0x19a7b8){var _0x520bdb=function(_0xe42cfb){while(--_0xe42cfb){_0x396e83['push'](_0x396e83['shift']());}};_0x520bdb(++_0x19a7b8);}(_0xd324,0xea));var _0x4d32=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0xd324[_0x9148ba];return _0x355e3b;};'use strict';var _=require('lodash');var util=require(_0x4d32('0x0'));var moment=require(_0x4d32('0x1'));var BPromise=require(_0x4d32('0x2'));var rs=require(_0x4d32('0x3'));var fs=require('fs');var Redis=require(_0x4d32('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d32('0x5'));var logger=require(_0x4d32('0x6'))('rpc');var config=require(_0x4d32('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d32('0x8')][_0x4d32('0x9')]({'port':0x232a});config['redis']=_[_0x4d32('0xa')](config[_0x4d32('0xb')],{'host':_0x4d32('0xc'),'port':0x18eb});var socket=require(_0x4d32('0xd'))(new Redis(config[_0x4d32('0xb')]));require(_0x4d32('0xe'))[_0x4d32('0xf')](socket);function respondWithRpcPromise(_0x20a9e1,_0x80592c,_0x361b9d){return new BPromise(function(_0x664cde,_0x3baf16){return client[_0x4d32('0x10')](_0x20a9e1,_0x361b9d)[_0x4d32('0x11')](function(_0x434220){logger[_0x4d32('0x12')](_0x4d32('0x13'),_0x80592c,_0x4d32('0x14'));logger[_0x4d32('0x15')](_0x4d32('0x16'),_0x80592c,_0x4d32('0x14'),JSON[_0x4d32('0x17')](_0x434220));if(_0x434220[_0x4d32('0x18')]){if(_0x434220[_0x4d32('0x18')]['code']===0x1f4){logger['error'](_0x4d32('0x13'),_0x80592c,_0x434220[_0x4d32('0x18')][_0x4d32('0x19')]);return _0x3baf16(_0x434220[_0x4d32('0x18')]['message']);}logger[_0x4d32('0x18')](_0x4d32('0x13'),_0x80592c,_0x434220[_0x4d32('0x18')][_0x4d32('0x19')]);return _0x664cde(_0x434220[_0x4d32('0x18')][_0x4d32('0x19')]);}else{logger[_0x4d32('0x12')](_0x4d32('0x13'),_0x80592c,_0x4d32('0x14'));_0x664cde(_0x434220[_0x4d32('0x1a')]['message']);}})[_0x4d32('0x1b')](function(_0x29fc85){logger['error'](_0x4d32('0x13'),_0x80592c,_0x29fc85);_0x3baf16(_0x29fc85);});});}exports[_0x4d32('0x1c')]=function(_0x25df72){var _0x1be926=this;return new Promise(function(_0x151ea1,_0x3dd146){return db[_0x4d32('0x1d')][_0x4d32('0x1e')]({'raw':_0x25df72[_0x4d32('0x1f')]?_0x25df72[_0x4d32('0x1f')][_0x4d32('0x20')]===undefined?!![]:![]:!![],'where':_0x25df72[_0x4d32('0x1f')]?_0x25df72[_0x4d32('0x1f')][_0x4d32('0x21')]||null:null,'attributes':[[db[_0x4d32('0x22')]['fn'](_0x4d32('0x23'),db[_0x4d32('0x22')]['fn']('IF',db[_0x4d32('0x22')][_0x4d32('0x24')](_0x4d32('0x25')))),_0x4d32('0x26')]]})[_0x4d32('0x11')](function(_0x246a77){logger[_0x4d32('0x12')](_0x4d32('0x1c'),_0x25df72);logger[_0x4d32('0x15')]('GetVoiceQueueRtPauses',_0x25df72,JSON[_0x4d32('0x17')](_0x246a77));_0x151ea1(_0x246a77);})[_0x4d32('0x1b')](function(_0x3a1019){logger['error'](_0x4d32('0x1c'),_0x3a1019[_0x4d32('0x19')],_0x25df72);_0x3dd146(_0x1be926[_0x4d32('0x18')](0x1f4,_0x3a1019[_0x4d32('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 20c10f3..5b6ac1a 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 _0xaa3f=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x41d578,_0x2dbaf4){var _0x57e9fc=function(_0x210249){while(--_0x210249){_0x41d578['push'](_0x41d578['shift']());}};_0x57e9fc(++_0x2dbaf4);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5b0aec,_0x410ecc){_0x5b0aec=_0x5b0aec-0x0;var _0x23c946=_0xaa3f[_0x5b0aec];return _0x23c946;};'use strict';var UserVoiceQueueRtEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),_0xfaa3('0x2'),_0xfaa3('0x3')];function createListener(_0x1ebbfb,_0x1da39b){return function(_0x408343){_0x1da39b[_0xfaa3('0x4')](_0x1ebbfb,_0x408343);};}function removeListener(_0x32f4e1,_0x5123a3){return function(){UserVoiceQueueRtEvents['removeListener'](_0x32f4e1,_0x5123a3);};}exports[_0xfaa3('0x5')]=function(_0x4bac92){for(var _0x3d09aa=0x0,_0xeecce5=events[_0xfaa3('0x6')];_0x3d09aa<_0xeecce5;_0x3d09aa++){var _0xbf270c=events[_0x3d09aa];var _0x328d5f=createListener(_0xfaa3('0x7')+_0xbf270c,_0x4bac92);UserVoiceQueueRtEvents['on'](_0xbf270c,_0x328d5f);}}; \ No newline at end of file +var _0x7dfd=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x53bbbc,_0x2a1ed9){var _0x43239b=function(_0x33af74){while(--_0x33af74){_0x53bbbc['push'](_0x53bbbc['shift']());}};_0x43239b(++_0x2a1ed9);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0xd7df('0x0'));var events=[_0xd7df('0x1'),_0xd7df('0x2'),_0xd7df('0x3')];function createListener(_0x346f5f,_0x28c3c9){return function(_0x176418){_0x28c3c9[_0xd7df('0x4')](_0x346f5f,_0x176418);};}function removeListener(_0x3ef231,_0x3d8c5a){return function(){UserVoiceQueueRtEvents[_0xd7df('0x5')](_0x3ef231,_0x3d8c5a);};}exports[_0xd7df('0x6')]=function(_0x36cf0f){for(var _0x39ce98=0x0,_0x354ea7=events[_0xd7df('0x7')];_0x39ce98<_0x354ea7;_0x39ce98++){var _0x2c48a4=events[_0x39ce98];var _0x5c220a=createListener(_0xd7df('0x8')+_0x2c48a4,_0x36cf0f);UserVoiceQueueRtEvents['on'](_0x2c48a4,_0x5c220a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e90f311..51f811d 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x322252,_0x12d2c5){var _0x3f6c4e=function(_0x2e03ca){while(--_0x2e03ca){_0x322252['push'](_0x322252['shift']());}};_0x3f6c4e(++_0x12d2c5);}(_0x70e0,0x17b));var _0x070e=function(_0x36c30c,_0x5966bb){_0x36c30c=_0x36c30c-0x0;var _0x5cd602=_0x70e0[_0x36c30c];return _0x5cd602;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2e8131,_0x57709d){var _0x5c95e9=function(_0x1795c9){while(--_0x1795c9){_0x2e8131['push'](_0x2e8131['shift']());}};_0x5c95e9(++_0x57709d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 f00afdd..cec2c4e 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 _0x5ec3=['exports','sequelize'];(function(_0x1fd412,_0x335420){var _0x416a4c=function(_0x19f1f0){while(--_0x19f1f0){_0x1fd412['push'](_0x1fd412['shift']());}};_0x416a4c(++_0x335420);}(_0x5ec3,0xa1));var _0x35ec=function(_0x4e0ab3,_0x524063){_0x4e0ab3=_0x4e0ab3-0x0;var _0x46ff71=_0x5ec3[_0x4e0ab3];return _0x46ff71;};'use strict';var Sequelize=require(_0x35ec('0x0'));module[_0x35ec('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x655d=['sequelize','INTEGER'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x655d,0x172));var _0xd655=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x655d[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xd655('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd655('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 228281e..723880d 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 _0x83b0=['util','../../config/logger','request-promise','path','../../config/environment','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x114749,_0x3b09f3){var _0x14b8ce=function(_0xcd1b6e){while(--_0xcd1b6e){_0x114749['push'](_0x114749['shift']());}};_0x14b8ce(++_0x3b09f3);}(_0x83b0,0x170));var _0x083b=function(_0x382b1b,_0x2553aa){_0x382b1b=_0x382b1b-0x0;var _0x4abaa5=_0x83b0[_0x382b1b];return _0x4abaa5;};'use strict';var _=require(_0x083b('0x0'));var util=require(_0x083b('0x1'));var logger=require(_0x083b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x083b('0x3'));var fs=require('fs');var path=require(_0x083b('0x4'));var rimraf=require('rimraf');var config=require(_0x083b('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x083b('0x6')]=function(_0x18c98e,_0x116286){return _0x18c98e[_0x083b('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x083b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40e3=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise','path'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x40e3,0x1da));var _0x340e=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x40e3[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x340e('0x0'));var util=require(_0x340e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x340e('0x2'));var BPromise=require(_0x340e('0x3'));var rp=require(_0x340e('0x4'));var fs=require('fs');var path=require(_0x340e('0x5'));var rimraf=require('rimraf');var config=require(_0x340e('0x6'));var attributes=require(_0x340e('0x7'));module[_0x340e('0x8')]=function(_0x4c1a64,_0x46dbe1){return _0x4c1a64[_0x340e('0x9')](_0x340e('0xa'),attributes,{'tableName':_0x340e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 95ed3ff..c8f65de 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 _0x2f02=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x363554,_0x7abbb0){var _0x1faff7=function(_0x4761dd){while(--_0x4761dd){_0x363554['push'](_0x363554['shift']());}};_0x1faff7(++_0x7abbb0);}(_0x2f02,0xa3));var _0x22f0=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2f02[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x22f0('0x0'));var util=require(_0x22f0('0x1'));var moment=require(_0x22f0('0x2'));var BPromise=require(_0x22f0('0x3'));var rs=require(_0x22f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f0('0x5'))['db'];var utils=require(_0x22f0('0x6'));var logger=require('../../config/logger')(_0x22f0('0x7'));var config=require(_0x22f0('0x8'));var jayson=require(_0x22f0('0x9'));var client=jayson['client'][_0x22f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x83a6e1,_0x4b437f,_0x440213){return new BPromise(function(_0x1b1ffd,_0x44973c){return client['request'](_0x83a6e1,_0x440213)[_0x22f0('0xb')](function(_0x3d15b6){logger[_0x22f0('0xc')](_0x22f0('0xd'),_0x4b437f,_0x22f0('0xe'));logger['debug'](_0x22f0('0xf'),_0x4b437f,_0x22f0('0xe'),JSON[_0x22f0('0x10')](_0x3d15b6));if(_0x3d15b6[_0x22f0('0x11')]){if(_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x12')]===0x1f4){logger[_0x22f0('0x11')](_0x22f0('0xd'),_0x4b437f,_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x13')]);return _0x44973c(_0x3d15b6['error'][_0x22f0('0x13')]);}logger[_0x22f0('0x11')](_0x22f0('0xd'),_0x4b437f,_0x3d15b6['error']['message']);return _0x1b1ffd(_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x13')]);}else{logger[_0x22f0('0xc')](_0x22f0('0xd'),_0x4b437f,_0x22f0('0xe'));_0x1b1ffd(_0x3d15b6[_0x22f0('0x14')][_0x22f0('0x13')]);}})[_0x22f0('0x15')](function(_0x4e7438){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4b437f,_0x4e7438);_0x44973c(_0x4e7438);});});} \ No newline at end of file +var _0x589f=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x587bbe,_0x1bb503){var _0x2cd8ae=function(_0x4b7ced){while(--_0x4b7ced){_0x587bbe['push'](_0x587bbe['shift']());}};_0x2cd8ae(++_0x1bb503);}(_0x589f,0x64));var _0xf589=function(_0x409ad2,_0x5129c1){_0x409ad2=_0x409ad2-0x0;var _0x595b5f=_0x589f[_0x409ad2];return _0x595b5f;};'use strict';var _=require(_0xf589('0x0'));var util=require(_0xf589('0x1'));var moment=require(_0xf589('0x2'));var BPromise=require('bluebird');var rs=require(_0xf589('0x3'));var fs=require('fs');var Redis=require(_0xf589('0x4'));var db=require(_0xf589('0x5'))['db'];var utils=require(_0xf589('0x6'));var logger=require('../../config/logger')(_0xf589('0x7'));var config=require(_0xf589('0x8'));var jayson=require(_0xf589('0x9'));var client=jayson[_0xf589('0xa')][_0xf589('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fce7c,_0x586a5a,_0x1dfe64){return new BPromise(function(_0x377eed,_0x173aa9){return client[_0xf589('0xc')](_0x4fce7c,_0x1dfe64)[_0xf589('0xd')](function(_0x544af6){logger['info'](_0xf589('0xe'),_0x586a5a,_0xf589('0xf'));logger[_0xf589('0x10')](_0xf589('0x11'),_0x586a5a,_0xf589('0xf'),JSON[_0xf589('0x12')](_0x544af6));if(_0x544af6[_0xf589('0x13')]){if(_0x544af6[_0xf589('0x13')][_0xf589('0x14')]===0x1f4){logger[_0xf589('0x13')](_0xf589('0xe'),_0x586a5a,_0x544af6[_0xf589('0x13')][_0xf589('0x15')]);return _0x173aa9(_0x544af6[_0xf589('0x13')][_0xf589('0x15')]);}logger[_0xf589('0x13')](_0xf589('0xe'),_0x586a5a,_0x544af6[_0xf589('0x13')]['message']);return _0x377eed(_0x544af6['error'][_0xf589('0x15')]);}else{logger[_0xf589('0x16')](_0xf589('0xe'),_0x586a5a,_0xf589('0xf'));_0x377eed(_0x544af6[_0xf589('0x17')]['message']);}})[_0xf589('0x18')](function(_0x41faf5){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x586a5a,_0x41faf5);_0x173aa9(_0x41faf5);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9adf19d..57fd048 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 _0xf842=['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','get'];(function(_0x555337,_0x1559d1){var _0x49b217=function(_0x3cb634){while(--_0x3cb634){_0x555337['push'](_0x555337['shift']());}};_0x49b217(++_0x1559d1);}(_0xf842,0x172));var _0x2f84=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xf842[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var path=require(_0x2f84('0x2'));var timeout=require(_0x2f84('0x3'));var express=require('express');var router=express[_0x2f84('0x4')]();var fs_extra=require(_0x2f84('0x5'));var auth=require(_0x2f84('0x6'));var interaction=require(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var controller=require('./variable.controller');router[_0x2f84('0x9')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0xb')]);router['get'](_0x2f84('0xc'),auth[_0x2f84('0xa')](),controller[_0x2f84('0xd')]);router[_0x2f84('0xe')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0xf')]);router[_0x2f84('0x10')](_0x2f84('0xc'),auth[_0x2f84('0xa')](),controller[_0x2f84('0x11')]);router['delete'](_0x2f84('0xc'),auth['isAuthenticated'](),controller[_0x2f84('0x12')]);module[_0x2f84('0x13')]=router; \ No newline at end of file +var _0x8e63=['get','index','/:id','isAuthenticated','create','put','destroy','util','express','Router','fs-extra','../../config/environment','./variable.controller'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0x8e63,0x7c));var _0x38e6=function(_0x26b246,_0x2551f4){_0x26b246=_0x26b246-0x0;var _0x8f5c7e=_0x8e63[_0x26b246];return _0x8f5c7e;};'use strict';var multer=require('multer');var util=require(_0x38e6('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38e6('0x1'));var router=express[_0x38e6('0x2')]();var fs_extra=require(_0x38e6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x38e6('0x4'));var controller=require(_0x38e6('0x5'));router[_0x38e6('0x6')]('/',auth['isAuthenticated'](),controller[_0x38e6('0x7')]);router[_0x38e6('0x6')](_0x38e6('0x8'),auth[_0x38e6('0x9')](),controller['show']);router['post']('/',auth[_0x38e6('0x9')](),controller[_0x38e6('0xa')]);router[_0x38e6('0xb')](_0x38e6('0x8'),auth[_0x38e6('0x9')](),controller['update']);router['delete'](_0x38e6('0x8'),auth['isAuthenticated'](),controller[_0x38e6('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 567c569..39022ac 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 _0xeaa7=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeaa7,0x113));var _0x7eaa=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xeaa7[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x7eaa('0x0'));module[_0x7eaa('0x1')]={'name':{'type':Sequelize[_0x7eaa('0x2')],'unique':_0x7eaa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7eaa('0x2')]}}; \ No newline at end of file +var _0xe88a=['name','sequelize','exports','STRING'];(function(_0x321421,_0x555332){var _0x5374a4=function(_0x31158f){while(--_0x31158f){_0x321421['push'](_0x321421['shift']());}};_0x5374a4(++_0x555332);}(_0xe88a,0xb1));var _0xae88=function(_0x3a608c,_0x4b7d2d){_0x3a608c=_0x3a608c-0x0;var _0x11b84f=_0xe88a[_0x3a608c];return _0x11b84f;};'use strict';var Sequelize=require(_0xae88('0x0'));module[_0xae88('0x1')]={'name':{'type':Sequelize[_0xae88('0x2')],'unique':_0xae88('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xae88('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 53d572e..a82ba52 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 _0xc372=['fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','fields','include','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','reject','save','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes'];(function(_0x2992ef,_0x2d8d01){var _0x440f83=function(_0x1f63a7){while(--_0x1f63a7){_0x2992ef['push'](_0x2992ef['shift']());}};_0x440f83(++_0x2d8d01);}(_0xc372,0x114));var _0x2c37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc372[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2c37('0x0'));var rimraf=require(_0x2c37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c37('0x2'));var rp=require(_0x2c37('0x3'));var moment=require(_0x2c37('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c37('0x5'));var util=require(_0x2c37('0x6'));var path=require(_0x2c37('0x7'));var sox=require(_0x2c37('0x8'));var csv=require(_0x2c37('0x9'));var ejs=require(_0x2c37('0xa'));var fs=require('fs');var fs_extra=require(_0x2c37('0xb'));var _=require(_0x2c37('0xc'));var squel=require(_0x2c37('0xd'));var crypto=require(_0x2c37('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2c37('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c37('0x10'));var Papa=require(_0x2c37('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c37('0x12'));var as=require(_0x2c37('0x13'));var hardwareService=require(_0x2c37('0x14'));var logger=require(_0x2c37('0x15'))('api');var utils=require(_0x2c37('0x16'));var config=require(_0x2c37('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c37('0x18'))['db'];function respondWithStatusCode(_0x2b2c0e,_0x30f7b0){_0x30f7b0=_0x30f7b0||0xcc;return function(_0x446651){if(_0x446651){return _0x2b2c0e['sendStatus'](_0x30f7b0);}return _0x2b2c0e[_0x2c37('0x19')](_0x30f7b0)[_0x2c37('0x1a')]();};}function respondWithResult(_0x1d0a6a,_0x21006a){_0x21006a=_0x21006a||0xc8;return function(_0xfa502b){if(_0xfa502b){return _0x1d0a6a[_0x2c37('0x19')](_0x21006a)[_0x2c37('0x1b')](_0xfa502b);}};}function respondWithFilteredResult(_0x5929ad,_0x13c333){return function(_0x3210f3){if(_0x3210f3){var _0x1fe151=typeof _0x13c333['offset']===_0x2c37('0x1c')&&typeof _0x13c333[_0x2c37('0x1d')]===_0x2c37('0x1c');var _0x162ceb=_0x3210f3['count'];var _0xcc8806=_0x1fe151?0x0:_0x13c333['offset'];var _0x4ca5d8=_0x1fe151?_0x3210f3[_0x2c37('0x1e')]:_0x13c333[_0x2c37('0x1f')]+_0x13c333[_0x2c37('0x1d')];var _0x47308f;if(_0x4ca5d8>=_0x162ceb){_0x4ca5d8=_0x162ceb;_0x47308f=0xc8;}else{_0x47308f=0xce;}_0x5929ad[_0x2c37('0x19')](_0x47308f);return _0x5929ad['set']('Content-Range',_0xcc8806+'-'+_0x4ca5d8+'/'+_0x162ceb)['json'](_0x3210f3);}return null;};}function patchUpdates(_0x3d4d6b){return function(_0xa889b9){try{jsonpatch['apply'](_0xa889b9,_0x3d4d6b,!![]);}catch(_0x535a72){return BPromise[_0x2c37('0x20')](_0x535a72);}return _0xa889b9[_0x2c37('0x21')]();};}function saveUpdates(_0xb9ba2e,_0x1dc279){return function(_0x32c616){if(_0x32c616){return _0x32c616['update'](_0xb9ba2e)[_0x2c37('0x22')](function(_0x17e596){return _0x17e596;});}return null;};}function removeEntity(_0x5b1211,_0x22de68){return function(_0x59d4d5){if(_0x59d4d5){return _0x59d4d5[_0x2c37('0x23')]()[_0x2c37('0x22')](function(){var _0x3f032f=_0x59d4d5[_0x2c37('0x24')]({'plain':!![]});var _0x28d639=_0x2c37('0x25');return db[_0x2c37('0x26')]['destroy']({'where':{'type':_0x28d639,'resourceId':_0x3f032f['id']}})[_0x2c37('0x22')](function(){return _0x59d4d5;});})['then'](function(){_0x5b1211['status'](0xcc)[_0x2c37('0x1a')]();});}};}function handleEntityNotFound(_0x58208c,_0x1c0012){return function(_0x3602a4){if(!_0x3602a4){_0x58208c[_0x2c37('0x27')](0x194);}return _0x3602a4;};}function handleError(_0x472d6a,_0x46bda7){_0x46bda7=_0x46bda7||0x1f4;return function(_0x2d0ce0){logger[_0x2c37('0x28')](_0x2d0ce0[_0x2c37('0x29')]);if(_0x2d0ce0[_0x2c37('0x2a')]){delete _0x2d0ce0[_0x2c37('0x2a')];}_0x472d6a[_0x2c37('0x19')](_0x46bda7)[_0x2c37('0x2b')](_0x2d0ce0);};}exports[_0x2c37('0x2c')]=function(_0x38d258,_0x16da64){var _0x31d56c={},_0x13d9f4={},_0x4e8f85={'count':0x0,'rows':[]};var _0x42a0d3=_[_0x2c37('0x2d')](db[_0x2c37('0x2e')][_0x2c37('0x2f')],function(_0x132254){return{'name':_0x132254[_0x2c37('0x30')],'type':_0x132254['type']['key']};});_0x13d9f4[_0x2c37('0x31')]=_['map'](_0x42a0d3,_0x2c37('0x2a'));_0x13d9f4[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x38d258['query']);_0x13d9f4[_0x2c37('0x34')]=_[_0x2c37('0x35')](_0x13d9f4['model'],_0x13d9f4['query']);_0x31d56c['attributes']=_[_0x2c37('0x35')](_0x13d9f4[_0x2c37('0x31')],qs['fields'](_0x38d258['query']['fields']));_0x31d56c[_0x2c37('0x36')]=_0x31d56c[_0x2c37('0x36')][_0x2c37('0x37')]?_0x31d56c['attributes']:_0x13d9f4[_0x2c37('0x31')];if(!_0x38d258['query'][_0x2c37('0x38')](_0x2c37('0x39'))){_0x31d56c[_0x2c37('0x1d')]=qs[_0x2c37('0x1d')](_0x38d258[_0x2c37('0x32')][_0x2c37('0x1d')]);_0x31d56c['offset']=qs[_0x2c37('0x1f')](_0x38d258['query'][_0x2c37('0x1f')]);}_0x31d56c[_0x2c37('0x3a')]=qs['sort'](_0x38d258[_0x2c37('0x32')]['sort']);_0x31d56c[_0x2c37('0x3b')]=qs['filters'](_[_0x2c37('0x3c')](_0x38d258['query'],_0x13d9f4[_0x2c37('0x34')]),_0x42a0d3);if(_0x38d258[_0x2c37('0x32')][_0x2c37('0x3d')]){_0x31d56c[_0x2c37('0x3b')]=_[_0x2c37('0x3e')](_0x31d56c[_0x2c37('0x3b')],{'$or':_['map'](_0x42a0d3,function(_0x55af4d){if(_0x55af4d[_0x2c37('0x3f')]!=='VIRTUAL'){var _0x3a1571={};_0x3a1571[_0x55af4d[_0x2c37('0x2a')]]={'$like':'%'+_0x38d258[_0x2c37('0x32')][_0x2c37('0x3d')]+'%'};return _0x3a1571;}})});}_0x31d56c=_[_0x2c37('0x3e')]({},_0x31d56c,_0x38d258[_0x2c37('0x40')]);var _0xe42102={'where':_0x31d56c[_0x2c37('0x3b')]};return db[_0x2c37('0x2e')][_0x2c37('0x1e')](_0xe42102)[_0x2c37('0x22')](function(_0x712f03){_0x4e8f85[_0x2c37('0x1e')]=_0x712f03;if(_0x38d258['query'][_0x2c37('0x41')]){_0x31d56c['include']=[{'all':!![]}];}return db[_0x2c37('0x2e')][_0x2c37('0x42')](_0x31d56c);})[_0x2c37('0x22')](function(_0x4b8f8c){_0x4e8f85[_0x2c37('0x43')]=_0x4b8f8c;return _0x4e8f85;})[_0x2c37('0x22')](respondWithFilteredResult(_0x16da64,_0x31d56c))[_0x2c37('0x44')](handleError(_0x16da64,null));};exports[_0x2c37('0x45')]=function(_0x400410,_0x5c604d){var _0x217314={'raw':!![],'where':{'id':_0x400410['params']['id']}},_0xcf9a53={};_0xcf9a53['model']=_[_0x2c37('0x33')](db[_0x2c37('0x2e')][_0x2c37('0x2f')]);_0xcf9a53[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x400410[_0x2c37('0x32')]);_0xcf9a53['filters']=_[_0x2c37('0x35')](_0xcf9a53[_0x2c37('0x31')],_0xcf9a53['query']);_0x217314['attributes']=_['intersection'](_0xcf9a53[_0x2c37('0x31')],qs[_0x2c37('0x46')](_0x400410[_0x2c37('0x32')][_0x2c37('0x46')]));_0x217314[_0x2c37('0x36')]=_0x217314[_0x2c37('0x36')][_0x2c37('0x37')]?_0x217314[_0x2c37('0x36')]:_0xcf9a53[_0x2c37('0x31')];if(_0x400410[_0x2c37('0x32')]['includeAll']){_0x217314[_0x2c37('0x47')]=[{'all':!![]}];}_0x217314=_[_0x2c37('0x3e')]({},_0x217314,_0x400410[_0x2c37('0x40')]);return db['Variable']['find'](_0x217314)[_0x2c37('0x22')](handleEntityNotFound(_0x5c604d,null))['then'](respondWithResult(_0x5c604d,null))[_0x2c37('0x44')](handleError(_0x5c604d,null));};exports['create']=function(_0x3be672,_0x1eba5b){return db[_0x2c37('0x2e')][_0x2c37('0x48')](_0x3be672[_0x2c37('0x49')],{})['then'](function(_0x2f1d63){var _0x13fd4e=_0x3be672[_0x2c37('0x4a')][_0x2c37('0x24')]({'plain':!![]});if(!_0x13fd4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13fd4e[_0x2c37('0x4b')]===_0x2c37('0x4a')){var _0x53868b=_0x2f1d63[_0x2c37('0x24')]({'plain':!![]});var _0x2361d9=_0x2c37('0x25');return db['UserProfileSection'][_0x2c37('0x4c')]({'where':{'name':_0x2361d9,'userProfileId':_0x13fd4e['userProfileId']},'raw':!![]})[_0x2c37('0x22')](function(_0x5d456b){if(_0x5d456b&&_0x5d456b[_0x2c37('0x4d')]===0x0){return db['UserProfileResource'][_0x2c37('0x48')]({'name':_0x53868b[_0x2c37('0x2a')],'resourceId':_0x53868b['id'],'type':_0x5d456b[_0x2c37('0x2a')],'sectionId':_0x5d456b['id']},{})[_0x2c37('0x22')](function(){return _0x2f1d63;});}else{return _0x2f1d63;}})[_0x2c37('0x44')](function(_0x55f7f1){logger[_0x2c37('0x28')](_0x2c37('0x4e'),_0x55f7f1);throw _0x55f7f1;});}return _0x2f1d63;})[_0x2c37('0x22')](respondWithResult(_0x1eba5b,0xc9))['catch'](handleError(_0x1eba5b,null));};exports[_0x2c37('0x4f')]=function(_0xe870c,_0x195f32){if(_0xe870c[_0x2c37('0x49')]['id']){delete _0xe870c[_0x2c37('0x49')]['id'];}return db['Variable'][_0x2c37('0x4c')]({'where':{'id':_0xe870c[_0x2c37('0x50')]['id']}})['then'](handleEntityNotFound(_0x195f32,null))[_0x2c37('0x22')](saveUpdates(_0xe870c[_0x2c37('0x49')],null))[_0x2c37('0x22')](respondWithResult(_0x195f32,null))['catch'](handleError(_0x195f32,null));};exports[_0x2c37('0x23')]=function(_0x25e63f,_0x4ff90f){return db['Variable'][_0x2c37('0x4c')]({'where':{'id':_0x25e63f[_0x2c37('0x50')]['id']}})[_0x2c37('0x22')](handleEntityNotFound(_0x4ff90f,null))['then'](removeEntity(_0x4ff90f,null))[_0x2c37('0x44')](handleError(_0x4ff90f,null));}; \ No newline at end of file +var _0x834c=['error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','Variable','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x834c,0x170));var _0xc834=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x834c[_0x35ef6b];return _0x3ad145;};'use strict';var emlformat=require(_0xc834('0x0'));var rimraf=require(_0xc834('0x1'));var zipdir=require(_0xc834('0x2'));var jsonpatch=require(_0xc834('0x3'));var rp=require(_0xc834('0x4'));var moment=require('moment');var BPromise=require(_0xc834('0x5'));var Mustache=require(_0xc834('0x6'));var util=require(_0xc834('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc834('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc834('0x9'));var _=require(_0xc834('0xa'));var squel=require(_0xc834('0xb'));var crypto=require(_0xc834('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc834('0xd'));var toCsv=require(_0xc834('0x8'));var querystring=require(_0xc834('0xe'));var Papa=require(_0xc834('0xf'));var Redis=require(_0xc834('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc834('0x11'));var as=require(_0xc834('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc834('0x13'))(_0xc834('0x14'));var utils=require(_0xc834('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc834('0x16'));var db=require(_0xc834('0x17'))['db'];function respondWithStatusCode(_0x35bb85,_0x256e65){_0x256e65=_0x256e65||0xcc;return function(_0x3bf735){if(_0x3bf735){return _0x35bb85[_0xc834('0x18')](_0x256e65);}return _0x35bb85[_0xc834('0x19')](_0x256e65)[_0xc834('0x1a')]();};}function respondWithResult(_0x2190f5,_0x11f171){_0x11f171=_0x11f171||0xc8;return function(_0x45e825){if(_0x45e825){return _0x2190f5['status'](_0x11f171)[_0xc834('0x1b')](_0x45e825);}};}function respondWithFilteredResult(_0x5062d3,_0x30e76d){return function(_0x444770){if(_0x444770){var _0x3619ac=typeof _0x30e76d['offset']===_0xc834('0x1c')&&typeof _0x30e76d[_0xc834('0x1d')]==='undefined';var _0x1ed16d=_0x444770[_0xc834('0x1e')];var _0x3706e0=_0x3619ac?0x0:_0x30e76d[_0xc834('0x1f')];var _0x359216=_0x3619ac?_0x444770['count']:_0x30e76d['offset']+_0x30e76d[_0xc834('0x1d')];var _0x3ae005;if(_0x359216>=_0x1ed16d){_0x359216=_0x1ed16d;_0x3ae005=0xc8;}else{_0x3ae005=0xce;}_0x5062d3['status'](_0x3ae005);return _0x5062d3[_0xc834('0x20')]('Content-Range',_0x3706e0+'-'+_0x359216+'/'+_0x1ed16d)[_0xc834('0x1b')](_0x444770);}return null;};}function patchUpdates(_0x214f8a){return function(_0x39aabe){try{jsonpatch[_0xc834('0x21')](_0x39aabe,_0x214f8a,!![]);}catch(_0x3233e5){return BPromise[_0xc834('0x22')](_0x3233e5);}return _0x39aabe[_0xc834('0x23')]();};}function saveUpdates(_0x47eee0,_0x1ad744){return function(_0x20b23a){if(_0x20b23a){return _0x20b23a[_0xc834('0x24')](_0x47eee0)[_0xc834('0x25')](function(_0x57039b){return _0x57039b;});}return null;};}function removeEntity(_0x209999,_0x1f54fb){return function(_0x5d4fef){if(_0x5d4fef){return _0x5d4fef[_0xc834('0x26')]()['then'](function(){var _0xe57cdc=_0x5d4fef[_0xc834('0x27')]({'plain':!![]});var _0x2e5967=_0xc834('0x28');return db[_0xc834('0x29')][_0xc834('0x26')]({'where':{'type':_0x2e5967,'resourceId':_0xe57cdc['id']}})[_0xc834('0x25')](function(){return _0x5d4fef;});})[_0xc834('0x25')](function(){_0x209999['status'](0xcc)[_0xc834('0x1a')]();});}};}function handleEntityNotFound(_0x465359,_0x12dff3){return function(_0x5e1bc2){if(!_0x5e1bc2){_0x465359[_0xc834('0x18')](0x194);}return _0x5e1bc2;};}function handleError(_0x3e6b46,_0x43ee0a){_0x43ee0a=_0x43ee0a||0x1f4;return function(_0x3ba422){logger[_0xc834('0x2a')](_0x3ba422[_0xc834('0x2b')]);if(_0x3ba422['name']){delete _0x3ba422[_0xc834('0x2c')];}_0x3e6b46[_0xc834('0x19')](_0x43ee0a)[_0xc834('0x2d')](_0x3ba422);};}exports[_0xc834('0x2e')]=function(_0x993f57,_0x2539fd){var _0x202fa2={},_0xd6e7d1={},_0xbf3f52={'count':0x0,'rows':[]};var _0x3c0fab=_[_0xc834('0x2f')](db['Variable'][_0xc834('0x30')],function(_0x54dc25){return{'name':_0x54dc25[_0xc834('0x31')],'type':_0x54dc25['type'][_0xc834('0x32')]};});_0xd6e7d1[_0xc834('0x33')]=_[_0xc834('0x2f')](_0x3c0fab,_0xc834('0x2c'));_0xd6e7d1[_0xc834('0x34')]=_[_0xc834('0x35')](_0x993f57[_0xc834('0x34')]);_0xd6e7d1[_0xc834('0x36')]=_[_0xc834('0x37')](_0xd6e7d1[_0xc834('0x33')],_0xd6e7d1[_0xc834('0x34')]);_0x202fa2[_0xc834('0x38')]=_[_0xc834('0x37')](_0xd6e7d1[_0xc834('0x33')],qs['fields'](_0x993f57[_0xc834('0x34')][_0xc834('0x39')]));_0x202fa2[_0xc834('0x38')]=_0x202fa2[_0xc834('0x38')]['length']?_0x202fa2[_0xc834('0x38')]:_0xd6e7d1['model'];if(!_0x993f57['query'][_0xc834('0x3a')](_0xc834('0x3b'))){_0x202fa2[_0xc834('0x1d')]=qs[_0xc834('0x1d')](_0x993f57[_0xc834('0x34')][_0xc834('0x1d')]);_0x202fa2[_0xc834('0x1f')]=qs[_0xc834('0x1f')](_0x993f57[_0xc834('0x34')][_0xc834('0x1f')]);}_0x202fa2['order']=qs['sort'](_0x993f57['query']['sort']);_0x202fa2[_0xc834('0x3c')]=qs[_0xc834('0x36')](_[_0xc834('0x3d')](_0x993f57[_0xc834('0x34')],_0xd6e7d1[_0xc834('0x36')]),_0x3c0fab);if(_0x993f57[_0xc834('0x34')][_0xc834('0x3e')]){_0x202fa2[_0xc834('0x3c')]=_[_0xc834('0x3f')](_0x202fa2[_0xc834('0x3c')],{'$or':_[_0xc834('0x2f')](_0x3c0fab,function(_0x51c9d1){if(_0x51c9d1[_0xc834('0x40')]!==_0xc834('0x41')){var _0x4231ce={};_0x4231ce[_0x51c9d1[_0xc834('0x2c')]]={'$like':'%'+_0x993f57[_0xc834('0x34')][_0xc834('0x3e')]+'%'};return _0x4231ce;}})});}_0x202fa2=_[_0xc834('0x3f')]({},_0x202fa2,_0x993f57[_0xc834('0x42')]);var _0x2ad040={'where':_0x202fa2[_0xc834('0x3c')]};return db[_0xc834('0x43')][_0xc834('0x1e')](_0x2ad040)[_0xc834('0x25')](function(_0xfca29e){_0xbf3f52[_0xc834('0x1e')]=_0xfca29e;if(_0x993f57[_0xc834('0x34')]['includeAll']){_0x202fa2['include']=[{'all':!![]}];}return db['Variable'][_0xc834('0x44')](_0x202fa2);})['then'](function(_0x57c984){_0xbf3f52[_0xc834('0x45')]=_0x57c984;return _0xbf3f52;})[_0xc834('0x25')](respondWithFilteredResult(_0x2539fd,_0x202fa2))[_0xc834('0x46')](handleError(_0x2539fd,null));};exports[_0xc834('0x47')]=function(_0x321022,_0x2bf898){var _0x48b9c2={'raw':!![],'where':{'id':_0x321022[_0xc834('0x48')]['id']}},_0x278212={};_0x278212[_0xc834('0x33')]=_[_0xc834('0x35')](db[_0xc834('0x43')][_0xc834('0x30')]);_0x278212[_0xc834('0x34')]=_['keys'](_0x321022[_0xc834('0x34')]);_0x278212[_0xc834('0x36')]=_[_0xc834('0x37')](_0x278212[_0xc834('0x33')],_0x278212['query']);_0x48b9c2[_0xc834('0x38')]=_['intersection'](_0x278212[_0xc834('0x33')],qs['fields'](_0x321022[_0xc834('0x34')][_0xc834('0x39')]));_0x48b9c2['attributes']=_0x48b9c2['attributes'][_0xc834('0x49')]?_0x48b9c2[_0xc834('0x38')]:_0x278212[_0xc834('0x33')];if(_0x321022[_0xc834('0x34')]['includeAll']){_0x48b9c2[_0xc834('0x4a')]=[{'all':!![]}];}_0x48b9c2=_['merge']({},_0x48b9c2,_0x321022['options']);return db['Variable'][_0xc834('0x4b')](_0x48b9c2)['then'](handleEntityNotFound(_0x2bf898,null))['then'](respondWithResult(_0x2bf898,null))[_0xc834('0x46')](handleError(_0x2bf898,null));};exports[_0xc834('0x4c')]=function(_0x4f3e48,_0x46a3be){return db[_0xc834('0x43')]['create'](_0x4f3e48[_0xc834('0x4d')],{})[_0xc834('0x25')](function(_0x328737){var _0x91aab=_0x4f3e48[_0xc834('0x4e')]['get']({'plain':!![]});if(!_0x91aab)throw new Error(_0xc834('0x4f'));if(_0x91aab['role']===_0xc834('0x4e')){var _0x4279b6=_0x328737[_0xc834('0x27')]({'plain':!![]});var _0x303ff3=_0xc834('0x28');return db['UserProfileSection'][_0xc834('0x4b')]({'where':{'name':_0x303ff3,'userProfileId':_0x91aab[_0xc834('0x50')]},'raw':!![]})[_0xc834('0x25')](function(_0x2ce0f4){if(_0x2ce0f4&&_0x2ce0f4['autoAssociation']===0x0){return db[_0xc834('0x29')]['create']({'name':_0x4279b6['name'],'resourceId':_0x4279b6['id'],'type':_0x2ce0f4['name'],'sectionId':_0x2ce0f4['id']},{})['then'](function(){return _0x328737;});}else{return _0x328737;}})[_0xc834('0x46')](function(_0x4a536d){logger[_0xc834('0x2a')](_0xc834('0x51'),_0x4a536d);throw _0x4a536d;});}return _0x328737;})[_0xc834('0x25')](respondWithResult(_0x46a3be,0xc9))[_0xc834('0x46')](handleError(_0x46a3be,null));};exports[_0xc834('0x24')]=function(_0x5a4822,_0x1502f5){if(_0x5a4822[_0xc834('0x4d')]['id']){delete _0x5a4822[_0xc834('0x4d')]['id'];}return db['Variable']['find']({'where':{'id':_0x5a4822['params']['id']}})['then'](handleEntityNotFound(_0x1502f5,null))['then'](saveUpdates(_0x5a4822[_0xc834('0x4d')],null))[_0xc834('0x25')](respondWithResult(_0x1502f5,null))[_0xc834('0x46')](handleError(_0x1502f5,null));};exports['destroy']=function(_0xea30c0,_0x1f9623){return db[_0xc834('0x43')][_0xc834('0x4b')]({'where':{'id':_0xea30c0['params']['id']}})[_0xc834('0x25')](handleEntityNotFound(_0x1f9623,null))[_0xc834('0x25')](removeEntity(_0x1f9623,null))['catch'](handleError(_0x1f9623,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 6f70962..4361b46 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 _0xfa9e=['request-promise','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','moment'];(function(_0x35c921,_0x4b18d7){var _0x160814=function(_0x32fbd9){while(--_0x32fbd9){_0x35c921['push'](_0x35c921['shift']());}};_0x160814(++_0x4b18d7);}(_0xfa9e,0x180));var _0xefa9=function(_0x211f44,_0x5b0f30){_0x211f44=_0x211f44-0x0;var _0x2dfb6d=_0xfa9e[_0x211f44];return _0x2dfb6d;};'use strict';var _=require(_0xefa9('0x0'));var util=require(_0xefa9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xefa9('0x2'));var BPromise=require('bluebird');var rp=require(_0xefa9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xefa9('0x4'));var attributes=require(_0xefa9('0x5'));module['exports']=function(_0x178f49,_0x23e727){return _0x178f49[_0xefa9('0x6')](_0xefa9('0x7'),attributes,{'tableName':_0xefa9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4257=['./variable.attributes','exports','Variable','tools_variables','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x5178b5,_0x59d85c){var _0x41a902=function(_0x1f9177){while(--_0x1f9177){_0x5178b5['push'](_0x5178b5['shift']());}};_0x41a902(++_0x59d85c);}(_0x4257,0xdc));var _0x7425=function(_0xb2b990,_0x13a655){_0xb2b990=_0xb2b990-0x0;var _0x2e1f05=_0x4257[_0xb2b990];return _0x2e1f05;};'use strict';var _=require(_0x7425('0x0'));var util=require('util');var logger=require(_0x7425('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7425('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7425('0x3'));var rimraf=require(_0x7425('0x4'));var config=require('../../config/environment');var attributes=require(_0x7425('0x5'));module[_0x7425('0x6')]=function(_0x5b87ec,_0x23ac61){return _0x5b87ec['define'](_0x7425('0x7'),attributes,{'tableName':_0x7425('0x8'),'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 f358e85..64fe1fc 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 _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x4b84[_0x39ea42];return _0x33f5b7;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x1cb9,0x14e));var _0x91cb=function(_0x262c77,_0xcab200){_0x262c77=_0x262c77-0x0;var _0x3c35e4=_0x1cb9[_0x262c77];return _0x3c35e4;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6823cc8..6666ede 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 _0x1d20=['express','Router','../../components/auth/service','./version.controller','get','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1d20,0x1e6));var _0x01d2=function(_0x524b3f,_0x6ecfd2){_0x524b3f=_0x524b3f-0x0;var _0x40184a=_0x1d20[_0x524b3f];return _0x40184a;};'use strict';var express=require(_0x01d2('0x0'));var router=express[_0x01d2('0x1')]();var auth=require(_0x01d2('0x2'));var controller=require(_0x01d2('0x3'));router[_0x01d2('0x4')]('/',controller['index']);router[_0x01d2('0x4')](_0x01d2('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x01d2('0x6')]);router[_0x01d2('0x4')](_0x01d2('0x7'),auth[_0x01d2('0x8')](),auth[_0x01d2('0x9')](),controller[_0x01d2('0xa')]);router[_0x01d2('0x4')](_0x01d2('0xb'),auth[_0x01d2('0x8')](),auth['canUpdate'](),controller[_0x01d2('0xc')]);router['get'](_0x01d2('0xd'),auth[_0x01d2('0x8')](),controller[_0x01d2('0xe')]);router[_0x01d2('0x4')](_0x01d2('0xf'),controller[_0x01d2('0x10')]);module[_0x01d2('0x11')]=router; \ No newline at end of file +var _0xae45=['./version.controller','get','isAuthenticated','canUpdate','fetch','/pull','pull','restart','/migrations','express','Router','../../components/auth/service'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xae45,0xed));var _0x5ae4=function(_0x633f85,_0x46e2db){_0x633f85=_0x633f85-0x0;var _0x59b77e=_0xae45[_0x633f85];return _0x59b77e;};'use strict';var express=require(_0x5ae4('0x0'));var router=express[_0x5ae4('0x1')]();var auth=require(_0x5ae4('0x2'));var controller=require(_0x5ae4('0x3'));router[_0x5ae4('0x4')]('/',controller['index']);router['get']('/fetch',auth[_0x5ae4('0x5')](),auth[_0x5ae4('0x6')](),controller[_0x5ae4('0x7')]);router[_0x5ae4('0x4')]('/reset',auth['isAuthenticated'](),auth[_0x5ae4('0x6')](),controller['reset']);router['get'](_0x5ae4('0x8'),auth[_0x5ae4('0x5')](),auth[_0x5ae4('0x6')](),controller[_0x5ae4('0x9')]);router[_0x5ae4('0x4')]('/restart',auth[_0x5ae4('0x5')](),controller[_0x5ae4('0xa')]);router[_0x5ae4('0x4')](_0x5ae4('0xb'),controller['migrations']);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index bda07b2..b341a3b 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 _0xdf40=['compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','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.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version'];(function(_0x2e2e13,_0x36b176){var _0x5480d3=function(_0x57c0c4){while(--_0x57c0c4){_0x2e2e13['push'](_0x2e2e13['shift']());}};_0x5480d3(++_0x36b176);}(_0xdf40,0xc5));var _0x0df4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdf40[_0x46e363];return _0x3fb059;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x0df4('0x0'));var pkginfo=require(_0x0df4('0x1'))(module,_0x0df4('0x2'));var compareVersions=require(_0x0df4('0x3'));var exec=require(_0x0df4('0x4'))[_0x0df4('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x0df4('0x6'));var pm2=require(_0x0df4('0x7'));var logger=require(_0x0df4('0x8'))('update');var git=require('simple-git')(config[_0x0df4('0x9')]);exports[_0x0df4('0xa')]=function(_0x173a46,_0x209064){var _0x285e95={'current':module[_0x0df4('0xb')][_0x0df4('0x2')],'phonebar':0x2};if(_0x173a46['query']&&_0x173a46[_0x0df4('0xc')][_0x0df4('0xd')]){return git[_0x0df4('0xe')]()['tags'](function(_0x223158,_0x3c247b){_0x285e95[_0x0df4('0xd')]=(_0x223158?module[_0x0df4('0xb')][_0x0df4('0x2')]:_0x3c247b[_0x0df4('0xd')])||_0x0df4('0xf');return _0x209064[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')](_0x285e95);});}else{return _0x209064['status'](0xc8)[_0x0df4('0x11')](_0x285e95);}};exports[_0x0df4('0xe')]=function(_0x19c0af,_0x3be8e0){return git[_0x0df4('0xe')]([_0x0df4('0x12'),_0x0df4('0x13')],function(_0x49c7a3){if(_0x49c7a3){logger['error'](_0x49c7a3);return _0x3be8e0[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x49c7a3);}logger[_0x0df4('0x14')](_0x0df4('0x15'));return _0x3be8e0[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x0df4('0x16')]=function(_0x1b8d48,_0x37ab26){return git['reset']([_0x0df4('0x17'),'FETCH_HEAD'],function(_0x480fc4){if(_0x480fc4){logger[_0x0df4('0x18')](_0x480fc4);return _0x37ab26[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x480fc4);}logger[_0x0df4('0x14')](_0x0df4('0x19'));return _0x37ab26[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x0df4('0x1a')});});};exports[_0x0df4('0x1b')]=function(_0x185527,_0x50240f){exec('npm\x20install\x20--production',function(_0x53350b,_0x144de0,_0x3d862b){logger[_0x0df4('0x14')](_0x144de0);logger[_0x0df4('0x14')](_0x3d862b);if(_0x53350b){logger['error'](_0x53350b);return _0x50240f[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x53350b);}return _0x50240f[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x144de0});});};exports[_0x0df4('0x1c')]=function(_0x44719d,_0x3b27a2){return pm2[_0x0df4('0x1c')](_0x0df4('0x1d'))[_0x0df4('0x1e')](function(_0x317de1){logger[_0x0df4('0x14')](_0x0df4('0x1f'),_0x317de1);return _0x3b27a2[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x0df4('0x20')});})[_0x0df4('0x21')](function(_0x18e06c){logger[_0x0df4('0x18')](_0x18e06c);return _0x3b27a2['status'](0x1f4)['json'](_0x18e06c);});};exports[_0x0df4('0x22')]=function(_0x4a0fba,_0x560187){var _0x5920b0=fs[_0x0df4('0x23')](path[_0x0df4('0x24')](config['root'],_0x0df4('0x25'),_0x0df4('0x22')));var _0x56d148=[];for(var _0x4c7e3e=0x0;_0x4c7e3e<_0x5920b0[_0x0df4('0x26')];_0x4c7e3e++){var _0x43e7b1=_0x5920b0[_0x4c7e3e][_0x0df4('0x27')](_0x0df4('0x28'),'');if(compareVersions(module[_0x0df4('0xb')][_0x0df4('0x2')],_0x43e7b1)===-0x1){_0x56d148['push'](_0x43e7b1);}}if(_0x56d148[_0x0df4('0x26')]){var _0x39a008=_0x56d148['sort'](compareVersions);var _0x288afe=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x0df4('0x29')],'modelName':_0x0df4('0x29'),'columnName':_0x0df4('0x2')},'migrations':{'params':[db[_0x0df4('0x2a')][_0x0df4('0x2b')](),db[_0x0df4('0x2a')][_0x0df4('0x2c')],function(){throw new Error(_0x0df4('0x2d'));}],'path':path['join'](config[_0x0df4('0x9')],_0x0df4('0x25'),'migrations'),'pattern':/\.js$/}});_0x288afe['up']({'migrations':_['map'](_0x39a008,function(_0x99462){return _0x99462+_0x0df4('0x28');})})[_0x0df4('0x1e')](function(){return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x2e')+module[_0x0df4('0xb')][_0x0df4('0x2')]+_0x0df4('0x2f')+_['last'](_0x39a008),'migrations':_[_0x0df4('0x24')](_0x39a008)});})[_0x0df4('0x21')](function(_0x19140e){if(_0x19140e instanceof db['sequelize'][_0x0df4('0x30')]){return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x31')});}else{return _0x560187[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x19140e);}});}else{return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x31')});}}; \ No newline at end of file +var _0x704a=['exports','version','query','latest','fetch','tags','2.0.0','status','json','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','\x20to\x20','catch','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0x704a,0x193));var _0xa704=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x704a[_0x21549c];return _0x426cbd;};'use strict';var Umzug=require(_0xa704('0x0'));var path=require(_0xa704('0x1'));var fs=require('fs');var _=require(_0xa704('0x2'));var pkginfo=require(_0xa704('0x3'))(module,'version');var compareVersions=require(_0xa704('0x4'));var exec=require(_0xa704('0x5'))['exec'];var db=require(_0xa704('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xa704('0x7'));var logger=require(_0xa704('0x8'))(_0xa704('0x9'));var git=require(_0xa704('0xa'))(config[_0xa704('0xb')]);exports[_0xa704('0xc')]=function(_0x84cc04,_0x77260){var _0x462894={'current':module[_0xa704('0xd')][_0xa704('0xe')],'phonebar':0x2};if(_0x84cc04[_0xa704('0xf')]&&_0x84cc04['query'][_0xa704('0x10')]){return git[_0xa704('0x11')]()[_0xa704('0x12')](function(_0x53072f,_0x8360ce){_0x462894[_0xa704('0x10')]=(_0x53072f?module[_0xa704('0xd')]['version']:_0x8360ce[_0xa704('0x10')])||_0xa704('0x13');return _0x77260[_0xa704('0x14')](0xc8)[_0xa704('0x15')](_0x462894);});}else{return _0x77260[_0xa704('0x14')](0xc8)[_0xa704('0x15')](_0x462894);}};exports['fetch']=function(_0x31edaa,_0x1b8cf9){return git[_0xa704('0x11')](['origin',_0xa704('0x16')],function(_0x2d53f8){if(_0x2d53f8){logger['error'](_0x2d53f8);return _0x1b8cf9[_0xa704('0x14')](0x1f4)['json'](_0x2d53f8);}logger['info'](_0xa704('0x17'));return _0x1b8cf9[_0xa704('0x14')](0xc8)['json']({'output':_0xa704('0x18')});});};exports['reset']=function(_0x7b06cf,_0x3c5a13){return git[_0xa704('0x19')](['--hard',_0xa704('0x1a')],function(_0x4558e6){if(_0x4558e6){logger['error'](_0x4558e6);return _0x3c5a13[_0xa704('0x14')](0x1f4)[_0xa704('0x15')](_0x4558e6);}logger[_0xa704('0x1b')](_0xa704('0x1c'));return _0x3c5a13[_0xa704('0x14')](0xc8)[_0xa704('0x15')]({'output':_0xa704('0x1d')});});};exports[_0xa704('0x1e')]=function(_0x1a4529,_0x5adbb4){exec(_0xa704('0x1f'),function(_0x45425c,_0x2a1015,_0x4dab23){logger[_0xa704('0x1b')](_0x2a1015);logger[_0xa704('0x1b')](_0x4dab23);if(_0x45425c){logger[_0xa704('0x20')](_0x45425c);return _0x5adbb4[_0xa704('0x14')](0x1f4)['json'](_0x45425c);}return _0x5adbb4[_0xa704('0x14')](0xc8)[_0xa704('0x15')]({'output':_0x2a1015});});};exports[_0xa704('0x21')]=function(_0x3c9ec9,_0x78f3a7){return pm2[_0xa704('0x21')](_0xa704('0x22'))[_0xa704('0x23')](function(_0x111987){logger[_0xa704('0x1b')](_0xa704('0x24'),_0x111987);return _0x78f3a7['status'](0xc8)['json']({'output':_0xa704('0x25')});})['catch'](function(_0x5e8bbf){logger[_0xa704('0x20')](_0x5e8bbf);return _0x78f3a7[_0xa704('0x14')](0x1f4)[_0xa704('0x15')](_0x5e8bbf);});};exports[_0xa704('0x26')]=function(_0xb9bd31,_0x5051eb){var _0x3a38d3=fs['readdirSync'](path[_0xa704('0x27')](config[_0xa704('0xb')],_0xa704('0x28'),_0xa704('0x26')));var _0x478080=[];for(var _0x5ea5d8=0x0;_0x5ea5d8<_0x3a38d3[_0xa704('0x29')];_0x5ea5d8++){var _0x3e7cf1=_0x3a38d3[_0x5ea5d8][_0xa704('0x2a')](_0xa704('0x2b'),'');if(compareVersions(module[_0xa704('0xd')][_0xa704('0xe')],_0x3e7cf1)===-0x1){_0x478080[_0xa704('0x2c')](_0x3e7cf1);}}if(_0x478080[_0xa704('0x29')]){var _0x1e91c8=_0x478080['sort'](compareVersions);var _0x4a6e04=new Umzug({'storage':_0xa704('0x2d'),'storageOptions':{'model':db[_0xa704('0x2e')],'modelName':_0xa704('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0xa704('0x2d')]['getQueryInterface'](),db[_0xa704('0x2d')][_0xa704('0x2f')],function(){throw new Error(_0xa704('0x30'));}],'path':path[_0xa704('0x27')](config['root'],_0xa704('0x28'),_0xa704('0x26')),'pattern':/\.js$/}});_0x4a6e04['up']({'migrations':_['map'](_0x1e91c8,function(_0x558f7d){return _0x558f7d+_0xa704('0x2b');})})[_0xa704('0x23')](function(){return _0x5051eb[_0xa704('0x14')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xa704('0xd')][_0xa704('0xe')]+_0xa704('0x31')+_['last'](_0x1e91c8),'migrations':_[_0xa704('0x27')](_0x1e91c8)});})[_0xa704('0x32')](function(_0x161c03){if(_0x161c03 instanceof db[_0xa704('0x2d')]['UniqueConstraintError']){return _0x5051eb[_0xa704('0x14')](0xc8)[_0xa704('0x15')]({'output':_0xa704('0x33')});}else{return _0x5051eb[_0xa704('0x14')](0x1f4)[_0xa704('0x15')](_0x161c03);}});}else{return _0x5051eb['status'](0xc8)[_0xa704('0x15')]({'output':_0xa704('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2562ffb..bcc9284 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 _0xc1aa=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xc1aa,0xe9));var _0xac1a=function(_0x503563,_0x4b1c57){_0x503563=_0x503563-0x0;var _0x4fffac=_0xc1aa[_0x503563];return _0x4fffac;};'use strict';var multer=require(_0xac1a('0x0'));var util=require(_0xac1a('0x1'));var path=require(_0xac1a('0x2'));var timeout=require(_0xac1a('0x3'));var express=require(_0xac1a('0x4'));var router=express['Router']();var fs_extra=require(_0xac1a('0x5'));var auth=require(_0xac1a('0x6'));var interaction=require(_0xac1a('0x7'));var config=require(_0xac1a('0x8'));var controller=require(_0xac1a('0x9'));router[_0xac1a('0xa')]('/',auth[_0xac1a('0xb')](),controller[_0xac1a('0xc')]);router[_0xac1a('0xa')](_0xac1a('0xd'),auth['isAuthenticated'](),controller[_0xac1a('0xe')]);router[_0xac1a('0xa')]('/:id',auth[_0xac1a('0xb')](),controller[_0xac1a('0xf')]);router['post']('/',auth[_0xac1a('0xb')](),controller['create']);router[_0xac1a('0x10')](_0xac1a('0x11'),auth[_0xac1a('0xb')](),controller[_0xac1a('0x12')]);router[_0xac1a('0x13')]('/:id',auth[_0xac1a('0xb')](),controller[_0xac1a('0x14')]);module[_0xac1a('0x15')]=router; \ No newline at end of file +var _0x65a7=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','destroy'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x65a7,0x1b9));var _0x765a=function(_0x3433d7,_0x6ecebb){_0x3433d7=_0x3433d7-0x0;var _0x918f57=_0x65a7[_0x3433d7];return _0x918f57;};'use strict';var multer=require(_0x765a('0x0'));var util=require(_0x765a('0x1'));var path=require(_0x765a('0x2'));var timeout=require(_0x765a('0x3'));var express=require(_0x765a('0x4'));var router=express[_0x765a('0x5')]();var fs_extra=require(_0x765a('0x6'));var auth=require(_0x765a('0x7'));var interaction=require(_0x765a('0x8'));var config=require(_0x765a('0x9'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x765a('0xa')](),controller[_0x765a('0xb')]);router[_0x765a('0xc')](_0x765a('0xd'),auth[_0x765a('0xa')](),controller[_0x765a('0xe')]);router['get'](_0x765a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x765a('0x10')]('/',auth[_0x765a('0xa')](),controller['create']);router[_0x765a('0x11')](_0x765a('0xf'),auth[_0x765a('0xa')](),controller[_0x765a('0x12')]);router[_0x765a('0x13')](_0x765a('0xf'),auth['isAuthenticated'](),controller[_0x765a('0x14')]);module[_0x765a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9672186..454bbcf 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 _0xf7d9=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x2789ea,_0xa34d25){var _0x3a88ce=function(_0x399e85){while(--_0x399e85){_0x2789ea['push'](_0x2789ea['shift']());}};_0x3a88ce(++_0xa34d25);}(_0xf7d9,0x122));var _0x9f7d=function(_0x31210e,_0x5ae645){_0x31210e=_0x31210e-0x0;var _0x365e5b=_0xf7d9[_0x31210e];return _0x365e5b;};'use strict';var Sequelize=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'type':{'type':Sequelize[_0x9f7d('0x2')]},'uniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9f7d('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9f7d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9f7d('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9f7d('0x5')]},'agentacw':{'type':Sequelize[_0x9f7d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9f7d('0x5')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x9f7d('0x2')]},'channel':{'type':Sequelize[_0x9f7d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9f7d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9f7d('0x2')]},'connectedlinename':{'type':Sequelize[_0x9f7d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9f7d('0x2')]},'context':{'type':Sequelize[_0x9f7d('0x2')]},'exten':{'type':Sequelize[_0x9f7d('0x2')]},'priority':{'type':Sequelize[_0x9f7d('0x2')]},'destchannel':{'type':Sequelize[_0x9f7d('0x2')]},'destchannelstate':{'type':Sequelize[_0x9f7d('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9f7d('0x2')]},'destcalleridname':{'type':Sequelize[_0x9f7d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9f7d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9f7d('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x9f7d('0x2')]},'destcontext':{'type':Sequelize[_0x9f7d('0x2')]},'destexten':{'type':Sequelize[_0x9f7d('0x2')]},'destpriority':{'type':Sequelize[_0x9f7d('0x2')]},'destuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9f7d('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9f7d('0x6')},'transferexten':{'type':Sequelize[_0x9f7d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9f7d('0x2')]},'agententerreason':{'type':Sequelize[_0x9f7d('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4f4=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x4fe77d,_0xaad1f1){var _0x296a48=function(_0x444659){while(--_0x444659){_0x4fe77d['push'](_0x4fe77d['shift']());}};_0x296a48(++_0xaad1f1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3c1928,_0x35b748){_0x3c1928=_0x3c1928-0x0;var _0x465e03=_0xf4f4[_0x3c1928];return _0x465e03;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4f4f('0x2')]},'calleridnum':{'type':Sequelize[_0x4f4f('0x2')]},'calleridname':{'type':Sequelize[_0x4f4f('0x2')]},'queue':{'type':Sequelize[_0x4f4f('0x2')]},'interface':{'type':Sequelize[_0x4f4f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4f4f('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x4f4f('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4f4f('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4f4f('0x3')]},'holdtime':{'type':Sequelize[_0x4f4f('0x4')]},'agentcomplete':{'type':Sequelize[_0x4f4f('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4f4f('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4f4f('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4f4f('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f4f('0x4')]},'reason':{'type':Sequelize[_0x4f4f('0x2')]},'lastevent':{'type':Sequelize[_0x4f4f('0x2')]},'channel':{'type':Sequelize[_0x4f4f('0x2')]},'channelstate':{'type':Sequelize[_0x4f4f('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4f4f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4f4f('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f4f('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4f4f('0x2')]},'exten':{'type':Sequelize[_0x4f4f('0x2')]},'priority':{'type':Sequelize[_0x4f4f('0x2')]},'destchannel':{'type':Sequelize[_0x4f4f('0x2')]},'destchannelstate':{'type':Sequelize[_0x4f4f('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4f4f('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4f4f('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4f4f('0x2')]},'destlanguage':{'type':Sequelize[_0x4f4f('0x2')]},'destaccountcode':{'type':Sequelize[_0x4f4f('0x2')]},'destcontext':{'type':Sequelize[_0x4f4f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4f4f('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4f4f('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f4f('0x2')],'comment':_0x4f4f('0x6')},'transferexten':{'type':Sequelize[_0x4f4f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4f4f('0x2')]},'agententerreason':{'type':Sequelize[_0x4f4f('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 41e1070..ec9c3f7 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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 71a7aa9..45ce551 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 _0x6dac=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x121e52,_0x48e0d2){var _0x5b6f18=function(_0xd97ba0){while(--_0xd97ba0){_0x121e52['push'](_0x121e52['shift']());}};_0x5b6f18(++_0x48e0d2);}(_0x6dac,0x16e));var _0xc6da=function(_0x5a5e7c,_0x218a51){_0x5a5e7c=_0x5a5e7c-0x0;var _0x3a9b12=_0x6dac[_0x5a5e7c];return _0x3a9b12;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var rp=require(_0xc6da('0x6'));var fs=require('fs');var path=require(_0xc6da('0x7'));var rimraf=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var attributes=require(_0xc6da('0xa'));module[_0xc6da('0xb')]=function(_0x325f49,_0x5caf49){return _0x325f49[_0xc6da('0xc')](_0xc6da('0xd'),attributes,{'tableName':_0xc6da('0xe'),'paranoid':![],'indexes':[{'fields':[_0xc6da('0xf'),_0xc6da('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6011=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6011,0x196));var _0x1601=function(_0x239ab9,_0x4dab7a){_0x239ab9=_0x239ab9-0x0;var _0x4304f0=_0x6011[_0x239ab9];return _0x4304f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1601('0x0'));var rp=require(_0x1601('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1601('0x2'));var config=require(_0x1601('0x3'));var attributes=require(_0x1601('0x4'));module[_0x1601('0x5')]=function(_0x3c9c29,_0x38cc43){return _0x3c9c29[_0x1601('0x6')](_0x1601('0x7'),attributes,{'tableName':_0x1601('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1601('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0c7acb4..0ea33f5 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 _0xc63e=['create','body','options','CreateVoiceAgentReport','debug','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','info','result','catch','VoiceAgentReport'];(function(_0x2c288f,_0x4359d7){var _0x56bc18=function(_0x4b27a3){while(--_0x4b27a3){_0x2c288f['push'](_0x2c288f['shift']());}};_0x56bc18(++_0x4359d7);}(_0xc63e,0xab));var _0xec63=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xc63e[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0xec63('0x0'));var util=require('util');var moment=require(_0xec63('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec63('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec63('0x3'));var logger=require(_0xec63('0x4'))(_0xec63('0x5'));var config=require(_0xec63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec63('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cc3ae,_0x18c125,_0x44615a){return new BPromise(function(_0x30d059,_0x893b26){return client[_0xec63('0x8')](_0x4cc3ae,_0x44615a)[_0xec63('0x9')](function(_0x1c2bed){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x18c125,_0xec63('0xa'));logger['debug'](_0xec63('0xb'),_0x18c125,_0xec63('0xa'),JSON[_0xec63('0xc')](_0x1c2bed));if(_0x1c2bed[_0xec63('0xd')]){if(_0x1c2bed[_0xec63('0xd')][_0xec63('0xe')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x18c125,_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);return _0x893b26(_0x1c2bed['error']['message']);}logger['error'](_0xec63('0x10'),_0x18c125,_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);return _0x30d059(_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);}else{logger[_0xec63('0x11')](_0xec63('0x10'),_0x18c125,_0xec63('0xa'));_0x30d059(_0x1c2bed[_0xec63('0x12')][_0xec63('0xf')]);}})[_0xec63('0x13')](function(_0x56e6f6){logger['error'](_0xec63('0x10'),_0x18c125,_0x56e6f6);_0x893b26(_0x56e6f6);});});}exports['CreateVoiceAgentReport']=function(_0x19a41b){var _0x49ff9d=this;return new Promise(function(_0x2958b0,_0x38d48f){return db[_0xec63('0x14')][_0xec63('0x15')](_0x19a41b[_0xec63('0x16')],{'raw':_0x19a41b['options']?_0x19a41b[_0xec63('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xec63('0x9')](function(_0x25dba8){logger[_0xec63('0x11')](_0xec63('0x18'),_0x19a41b);logger[_0xec63('0x19')](_0xec63('0x18'),_0x19a41b,JSON['stringify'](_0x25dba8));_0x2958b0(_0x25dba8);})[_0xec63('0x13')](function(_0xf6cda1){logger[_0xec63('0xd')](_0xec63('0x18'),_0xf6cda1[_0xec63('0xf')],_0x19a41b);_0x38d48f(_0x49ff9d[_0xec63('0xd')](0x1f4,_0xf6cda1[_0xec63('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0x227122){var _0x1bd810=this;return new Promise(function(_0x53b96f,_0x3ba79d){return db[_0xec63('0x14')][_0xec63('0x1a')](_0x227122[_0xec63('0x16')],{'raw':_0x227122['options']?_0x227122['options'][_0xec63('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227122['options']?_0x227122[_0xec63('0x17')][_0xec63('0x1c')]||null:null,'attributes':_0x227122[_0xec63('0x17')]?_0x227122['options'][_0xec63('0x1d')]||null:null,'limit':_0x227122[_0xec63('0x17')]?_0x227122[_0xec63('0x17')][_0xec63('0x1e')]||null:null})['then'](function(_0x16810a){logger['info'](_0xec63('0x1f'),_0x227122);logger['debug'](_0xec63('0x1f'),_0x227122,JSON[_0xec63('0xc')](_0x16810a));_0x53b96f(_0x16810a);})[_0xec63('0x13')](function(_0x1e0bf2){logger['error'](_0xec63('0x1f'),_0x1e0bf2[_0xec63('0xf')],_0x227122);_0x3ba79d(_0x1bd810['error'](0x1f4,_0x1e0bf2[_0xec63('0xf')]));});});}; \ No newline at end of file +var _0x1e2b=['../../mysqldb','rpc','jayson/promise','http','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceAgentReport','options','raw','then','UpdateVoiceAgentReport','update','body','where','limit','util','randomstring','ioredis'];(function(_0x61f2fa,_0x482d91){var _0x4c5518=function(_0x47ddc9){while(--_0x47ddc9){_0x61f2fa['push'](_0x61f2fa['shift']());}};_0x4c5518(++_0x482d91);}(_0x1e2b,0x185));var _0xb1e2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1e2b[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xb1e2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1e2('0x1'));var fs=require('fs');var Redis=require(_0xb1e2('0x2'));var db=require(_0xb1e2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1e2('0x4'));var config=require('../../config/environment');var jayson=require(_0xb1e2('0x5'));var client=jayson['client'][_0xb1e2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1e442c,_0x5f5662,_0x45621f){return new BPromise(function(_0x56d56a,_0x3d92a3){return client[_0xb1e2('0x7')](_0x1e442c,_0x45621f)['then'](function(_0x2535c8){logger['info'](_0xb1e2('0x8'),_0x5f5662,_0xb1e2('0x9'));logger[_0xb1e2('0xa')](_0xb1e2('0xb'),_0x5f5662,_0xb1e2('0x9'),JSON[_0xb1e2('0xc')](_0x2535c8));if(_0x2535c8['error']){if(_0x2535c8[_0xb1e2('0xd')][_0xb1e2('0xe')]===0x1f4){logger[_0xb1e2('0xd')](_0xb1e2('0x8'),_0x5f5662,_0x2535c8['error'][_0xb1e2('0xf')]);return _0x3d92a3(_0x2535c8['error'][_0xb1e2('0xf')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5f5662,_0x2535c8[_0xb1e2('0xd')][_0xb1e2('0xf')]);return _0x56d56a(_0x2535c8['error'][_0xb1e2('0xf')]);}else{logger[_0xb1e2('0x10')](_0xb1e2('0x8'),_0x5f5662,'request\x20sent');_0x56d56a(_0x2535c8[_0xb1e2('0x11')][_0xb1e2('0xf')]);}})[_0xb1e2('0x12')](function(_0x4754ab){logger[_0xb1e2('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x5f5662,_0x4754ab);_0x3d92a3(_0x4754ab);});});}exports['CreateVoiceAgentReport']=function(_0x5b961b){var _0x187c02=this;return new Promise(function(_0x2375a4,_0x388d46){return db[_0xb1e2('0x13')]['create'](_0x5b961b['body'],{'raw':_0x5b961b[_0xb1e2('0x14')]?_0x5b961b[_0xb1e2('0x14')][_0xb1e2('0x15')]===undefined?!![]:![]:!![]})[_0xb1e2('0x16')](function(_0x1d4f6e){logger['info']('CreateVoiceAgentReport',_0x5b961b);logger['debug']('CreateVoiceAgentReport',_0x5b961b,JSON[_0xb1e2('0xc')](_0x1d4f6e));_0x2375a4(_0x1d4f6e);})[_0xb1e2('0x12')](function(_0x28618b){logger[_0xb1e2('0xd')]('CreateVoiceAgentReport',_0x28618b[_0xb1e2('0xf')],_0x5b961b);_0x388d46(_0x187c02[_0xb1e2('0xd')](0x1f4,_0x28618b[_0xb1e2('0xf')]));});});};exports[_0xb1e2('0x17')]=function(_0x3f9bf3){var _0x28e883=this;return new Promise(function(_0x3c183e,_0x3df055){return db[_0xb1e2('0x13')][_0xb1e2('0x18')](_0x3f9bf3[_0xb1e2('0x19')],{'raw':_0x3f9bf3[_0xb1e2('0x14')]?_0x3f9bf3[_0xb1e2('0x14')][_0xb1e2('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f9bf3[_0xb1e2('0x14')]?_0x3f9bf3[_0xb1e2('0x14')][_0xb1e2('0x1a')]||null:null,'attributes':_0x3f9bf3[_0xb1e2('0x14')]?_0x3f9bf3[_0xb1e2('0x14')]['attributes']||null:null,'limit':_0x3f9bf3['options']?_0x3f9bf3[_0xb1e2('0x14')][_0xb1e2('0x1b')]||null:null})[_0xb1e2('0x16')](function(_0x2e045d){logger['info'](_0xb1e2('0x17'),_0x3f9bf3);logger[_0xb1e2('0xa')]('UpdateVoiceAgentReport',_0x3f9bf3,JSON[_0xb1e2('0xc')](_0x2e045d));_0x3c183e(_0x2e045d);})[_0xb1e2('0x12')](function(_0x4ad559){logger[_0xb1e2('0xd')](_0xb1e2('0x17'),_0x4ad559[_0xb1e2('0xf')],_0x3f9bf3);_0x3df055(_0x28e883[_0xb1e2('0xd')](0x1f4,_0x4ad559[_0xb1e2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d78b0a8..9c055a6 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 _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x9bc1b5,_0x2a0313){var _0x35e68e=function(_0x58dbc6){while(--_0x58dbc6){_0x9bc1b5['push'](_0x9bc1b5['shift']());}};_0x35e68e(++_0x2a0313);}(_0x7bae,0x13b));var _0xe7ba=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7bae[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x35644c,_0x3c80a0){var _0xc2e514=function(_0x588b4c){while(--_0x588b4c){_0x35644c['push'](_0x35644c['shift']());}};_0xc2e514(++_0x3c80a0);}(_0x0e85,0x7c));var _0x50e8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x0e85[_0x369151];return _0x4292d5;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('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 3b275c7..aa5878a 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 _0x8c6c=['internal','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x13b471,_0x42efbf){var _0xc79516=function(_0x287f5b){while(--_0x287f5b){_0x13b471['push'](_0x13b471['shift']());}};_0xc79516(++_0x42efbf);}(_0x8c6c,0x133));var _0xc8c6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8c6c[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xc8c6('0x0'));module[_0xc8c6('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc8c6('0x2')]('inbound',_0xc8c6('0x3'),'outbound','inbound-fax',_0xc8c6('0x4'),_0xc8c6('0x5'))},'tag':{'type':Sequelize[_0xc8c6('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc8c6('0x6')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc8c6('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc8c6('0x6')]},'lastapplication':{'type':Sequelize[_0xc8c6('0x6')]},'lastdata':{'type':Sequelize[_0xc8c6('0x7')]},'starttime':{'type':Sequelize[_0xc8c6('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc8c6('0x8')]},'endtime':{'type':Sequelize[_0xc8c6('0x8')]},'duration':{'type':Sequelize[_0xc8c6('0x9')]},'billableseconds':{'type':Sequelize[_0xc8c6('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc8c6('0x6')]},'amaflags':{'type':Sequelize[_0xc8c6('0x6')]},'userfield':{'type':Sequelize[_0xc8c6('0x6')]},'userDisposition':{'type':Sequelize[_0xc8c6('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc8c6('0x6')]},'note':{'type':Sequelize[_0xc8c6('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc8c6('0x9')]},'sipcallid':{'type':Sequelize[_0xc8c6('0x6')]}}; \ No newline at end of file +var _0xd1eb=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','inbound-fax'];(function(_0xdc86e3,_0x44dd42){var _0x2533db=function(_0x156619){while(--_0x156619){_0xdc86e3['push'](_0xdc86e3['shift']());}};_0x2533db(++_0x44dd42);}(_0xd1eb,0xc3));var _0xbd1e=function(_0xcd6df,_0x4dfe4a){_0xcd6df=_0xcd6df-0x0;var _0x25369b=_0xd1eb[_0xcd6df];return _0x25369b;};'use strict';var Sequelize=require(_0xbd1e('0x0'));module[_0xbd1e('0x1')]={'uniqueid':{'type':Sequelize[_0xbd1e('0x2')]},'type':{'type':Sequelize['ENUM'](_0xbd1e('0x3'),'internal','outbound',_0xbd1e('0x4'),_0xbd1e('0x5'),_0xbd1e('0x6'))},'tag':{'type':Sequelize[_0xbd1e('0x2')]},'accountcode':{'type':Sequelize[_0xbd1e('0x2')]},'source':{'type':Sequelize[_0xbd1e('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbd1e('0x2')]},'channel':{'type':Sequelize[_0xbd1e('0x2')]},'destinationchannel':{'type':Sequelize[_0xbd1e('0x2')]},'lastapplication':{'type':Sequelize[_0xbd1e('0x2')]},'lastdata':{'type':Sequelize[_0xbd1e('0x7')]},'starttime':{'type':Sequelize[_0xbd1e('0x8')]},'systemanswertime':{'type':Sequelize[_0xbd1e('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xbd1e('0x9')]},'billableseconds':{'type':Sequelize[_0xbd1e('0x9')]},'mohtime':{'type':Sequelize[_0xbd1e('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbd1e('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbd1e('0x2')]},'userDisposition':{'type':Sequelize[_0xbd1e('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xbd1e('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xbd1e('0x2')]},'note':{'type':Sequelize[_0xbd1e('0x2')]},'prefix':{'type':Sequelize[_0xbd1e('0x2')]},'routeid':{'type':Sequelize[_0xbd1e('0x9')]},'sipcallid':{'type':Sequelize[_0xbd1e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index dd060ee..4c5705e 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xadb5,0xad));var _0x5adb=function(_0x20fec4,_0x59e85c){_0x20fec4=_0x20fec4-0x0;var _0x432758=_0xadb5[_0x20fec4];return _0x432758;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3ef45e,_0xe84f33){var _0x69e7c=function(_0x43ba11){while(--_0x43ba11){_0x3ef45e['push'](_0x3ef45e['shift']());}};_0x69e7c(++_0xe84f33);}(_0xadb5,0xad));var _0x5adb=function(_0x58a6cf,_0x3acf79){_0x58a6cf=_0x58a6cf-0x0;var _0xd71932=_0xadb5[_0x58a6cf];return _0xd71932;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 219753e..3b07f4c 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 _0xd04b=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x2d323f,_0x231fe6){var _0x11e018=function(_0x4f326b){while(--_0x4f326b){_0x2d323f['push'](_0x2d323f['shift']());}};_0x11e018(++_0x231fe6);}(_0xd04b,0x145));var _0xbd04=function(_0x462d15,_0x53293c){_0x462d15=_0x462d15-0x0;var _0x985573=_0xd04b[_0x462d15];return _0x985573;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd04('0x4'));var fs=require('fs');var path=require(_0xbd04('0x5'));var rimraf=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var attributes=require(_0xbd04('0x8'));module[_0xbd04('0x9')]=function(_0x11d6ce,_0x2d8811){return _0x11d6ce[_0xbd04('0xa')](_0xbd04('0xb'),attributes,{'tableName':_0xbd04('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bc8=['../../config/environment','./voiceCallReport.attributes','VoiceCallReport','uniqueid','util','../../config/logger','api','bluebird','rimraf'];(function(_0x1fcc94,_0x3e038c){var _0x26f26f=function(_0x51519f){while(--_0x51519f){_0x1fcc94['push'](_0x1fcc94['shift']());}};_0x26f26f(++_0x3e038c);}(_0x3bc8,0x1f3));var _0x83bc=function(_0x15718e,_0x2f5096){_0x15718e=_0x15718e-0x0;var _0xf3b1d2=_0x3bc8[_0x15718e];return _0xf3b1d2;};'use strict';var _=require('lodash');var util=require(_0x83bc('0x0'));var logger=require(_0x83bc('0x1'))(_0x83bc('0x2'));var moment=require('moment');var BPromise=require(_0x83bc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x83bc('0x4'));var config=require(_0x83bc('0x5'));var attributes=require(_0x83bc('0x6'));module['exports']=function(_0x4f5953,_0x434f01){return _0x4f5953['define'](_0x83bc('0x7'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x83bc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c99823d..71d1af0 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 _0xb83c=['raw','where','include','map','model','attributes','info','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','debug','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','findAll','options'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0xb83c,0x180));var _0xcb83=function(_0x391244,_0x13c2a5){_0x391244=_0x391244-0x0;var _0x1e86c5=_0xb83c[_0x391244];return _0x1e86c5;};'use strict';var _=require(_0xcb83('0x0'));var util=require(_0xcb83('0x1'));var moment=require(_0xcb83('0x2'));var BPromise=require(_0xcb83('0x3'));var rs=require(_0xcb83('0x4'));var fs=require('fs');var Redis=require(_0xcb83('0x5'));var db=require(_0xcb83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb83('0x7'))(_0xcb83('0x8'));var config=require('../../config/environment');var jayson=require(_0xcb83('0x9'));var client=jayson[_0xcb83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b417,_0x24cc4a,_0x2bf7d3){return new BPromise(function(_0x4d9577,_0x59b4a6){return client[_0xcb83('0xb')](_0x33b417,_0x2bf7d3)[_0xcb83('0xc')](function(_0x724fca){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x24cc4a,_0xcb83('0xd'));logger['debug'](_0xcb83('0xe'),_0x24cc4a,_0xcb83('0xd'),JSON[_0xcb83('0xf')](_0x724fca));if(_0x724fca[_0xcb83('0x10')]){if(_0x724fca[_0xcb83('0x10')][_0xcb83('0x11')]===0x1f4){logger['error'](_0xcb83('0x12'),_0x24cc4a,_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);return _0x59b4a6(_0x724fca[_0xcb83('0x10')]['message']);}logger[_0xcb83('0x10')](_0xcb83('0x12'),_0x24cc4a,_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);return _0x4d9577(_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);}else{logger['info'](_0xcb83('0x12'),_0x24cc4a,'request\x20sent');_0x4d9577(_0x724fca['result'][_0xcb83('0x13')]);}})[_0xcb83('0x14')](function(_0x3f1cbb){logger[_0xcb83('0x10')](_0xcb83('0x12'),_0x24cc4a,_0x3f1cbb);_0x59b4a6(_0x3f1cbb);});});}exports['GetVoiceCallReport']=function(_0x39e5de){var _0x2106ef=this;return new Promise(function(_0x3620cc,_0x2b0ec9){return db['VoiceCallReport'][_0xcb83('0x15')]({'raw':_0x39e5de['options']?_0x39e5de[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![],'where':_0x39e5de[_0xcb83('0x16')]?_0x39e5de['options'][_0xcb83('0x18')]||null:null,'attributes':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')]['attributes']||null:null,'limit':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')]['limit']||null:null,'include':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')][_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x39e5de[_0xcb83('0x16')]['include'],function(_0x41f39d){return{'model':db[_0x41f39d[_0xcb83('0x1b')]],'as':_0x41f39d['as'],'attributes':_0x41f39d[_0xcb83('0x1c')],'include':_0x41f39d[_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x41f39d[_0xcb83('0x19')],function(_0x51977e){return{'model':db[_0x51977e['model']],'as':_0x51977e['as'],'attributes':_0x51977e[_0xcb83('0x1c')],'include':_0x51977e[_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x51977e[_0xcb83('0x19')],function(_0x352c52){return{'model':db[_0x352c52[_0xcb83('0x1b')]],'as':_0x352c52['as'],'attributes':_0x352c52[_0xcb83('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcb83('0xc')](function(_0x4edc63){logger[_0xcb83('0x1d')](_0xcb83('0x1e'),_0x39e5de);logger['debug'](_0xcb83('0x1e'),_0x39e5de,JSON[_0xcb83('0xf')](_0x4edc63));_0x3620cc(_0x4edc63);})[_0xcb83('0x14')](function(_0x3d41a4){logger[_0xcb83('0x10')](_0xcb83('0x1e'),_0x3d41a4[_0xcb83('0x13')],_0x39e5de);_0x2b0ec9(_0x2106ef[_0xcb83('0x10')](0x1f4,_0x3d41a4[_0xcb83('0x13')]));});});};exports[_0xcb83('0x1f')]=function(_0x58afc9){var _0x409817=this;return new Promise(function(_0x1d2631,_0x22aa60){return db[_0xcb83('0x20')]['create'](_0x58afc9['body'],{'raw':_0x58afc9['options']?_0x58afc9[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![]})[_0xcb83('0xc')](function(_0x46df78){logger[_0xcb83('0x1d')](_0xcb83('0x1f'),_0x58afc9);logger[_0xcb83('0x21')](_0xcb83('0x1f'),_0x58afc9,JSON[_0xcb83('0xf')](_0x46df78));_0x1d2631(_0x46df78);})[_0xcb83('0x14')](function(_0x45490a){logger[_0xcb83('0x10')](_0xcb83('0x1f'),_0x45490a[_0xcb83('0x13')],_0x58afc9);_0x22aa60(_0x409817['error'](0x1f4,_0x45490a[_0xcb83('0x13')]));});});};exports[_0xcb83('0x22')]=function(_0x48a476){var _0x382c7d=this;return new Promise(function(_0xd70440,_0x1eef94){return db[_0xcb83('0x20')][_0xcb83('0x23')](_0x48a476[_0xcb83('0x24')],{'raw':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x18')]||null:null,'attributes':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x1c')]||null:null,'limit':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')]['limit']||null:null})[_0xcb83('0xc')](function(_0xa1a277){logger[_0xcb83('0x1d')]('UpdateVoiceCallReport',_0x48a476);logger[_0xcb83('0x21')](_0xcb83('0x22'),_0x48a476,JSON[_0xcb83('0xf')](_0xa1a277));_0xd70440(_0xa1a277);})[_0xcb83('0x14')](function(_0x21acc2){logger[_0xcb83('0x10')]('UpdateVoiceCallReport',_0x21acc2[_0xcb83('0x13')],_0x48a476);_0x1eef94(_0x382c7d['error'](0x1f4,_0x21acc2['message']));});});}; \ No newline at end of file +var _0x5876=['findAll','options','raw','where','include','map','model','attributes','then','stringify','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceCallReport','VoiceCallReport'];(function(_0x2970e0,_0x3c6e49){var _0x44d8e8=function(_0x2dc6b4){while(--_0x2dc6b4){_0x2970e0['push'](_0x2970e0['shift']());}};_0x44d8e8(++_0x3c6e49);}(_0x5876,0x1cc));var _0x6587=function(_0x2b8347,_0x14e3f2){_0x2b8347=_0x2b8347-0x0;var _0x15e93e=_0x5876[_0x2b8347];return _0x15e93e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6587('0x0'));var BPromise=require(_0x6587('0x1'));var rs=require(_0x6587('0x2'));var fs=require('fs');var Redis=require(_0x6587('0x3'));var db=require(_0x6587('0x4'))['db'];var utils=require(_0x6587('0x5'));var logger=require('../../config/logger')(_0x6587('0x6'));var config=require('../../config/environment');var jayson=require(_0x6587('0x7'));var client=jayson[_0x6587('0x8')][_0x6587('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2846ac,_0x3a55a9,_0xd1334e){return new BPromise(function(_0x57d3c9,_0x1dd460){return client[_0x6587('0xa')](_0x2846ac,_0xd1334e)['then'](function(_0x2f6c2a){logger[_0x6587('0xb')](_0x6587('0xc'),_0x3a55a9,_0x6587('0xd'));logger[_0x6587('0xe')](_0x6587('0xf'),_0x3a55a9,'request\x20sent',JSON['stringify'](_0x2f6c2a));if(_0x2f6c2a[_0x6587('0x10')]){if(_0x2f6c2a['error'][_0x6587('0x11')]===0x1f4){logger[_0x6587('0x10')](_0x6587('0xc'),_0x3a55a9,_0x2f6c2a[_0x6587('0x10')][_0x6587('0x12')]);return _0x1dd460(_0x2f6c2a[_0x6587('0x10')][_0x6587('0x12')]);}logger[_0x6587('0x10')](_0x6587('0xc'),_0x3a55a9,_0x2f6c2a['error']['message']);return _0x57d3c9(_0x2f6c2a[_0x6587('0x10')][_0x6587('0x12')]);}else{logger[_0x6587('0xb')](_0x6587('0xc'),_0x3a55a9,_0x6587('0xd'));_0x57d3c9(_0x2f6c2a['result'][_0x6587('0x12')]);}})['catch'](function(_0x5c321f){logger[_0x6587('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x3a55a9,_0x5c321f);_0x1dd460(_0x5c321f);});});}exports[_0x6587('0x13')]=function(_0xf2b048){var _0x591178=this;return new Promise(function(_0x32680f,_0x3d3448){return db[_0x6587('0x14')][_0x6587('0x15')]({'raw':_0xf2b048[_0x6587('0x16')]?_0xf2b048[_0x6587('0x16')][_0x6587('0x17')]===undefined?!![]:![]:!![],'where':_0xf2b048[_0x6587('0x16')]?_0xf2b048[_0x6587('0x16')][_0x6587('0x18')]||null:null,'attributes':_0xf2b048[_0x6587('0x16')]?_0xf2b048[_0x6587('0x16')]['attributes']||null:null,'limit':_0xf2b048['options']?_0xf2b048[_0x6587('0x16')]['limit']||null:null,'include':_0xf2b048[_0x6587('0x16')]?_0xf2b048[_0x6587('0x16')][_0x6587('0x19')]?_[_0x6587('0x1a')](_0xf2b048[_0x6587('0x16')][_0x6587('0x19')],function(_0x5f24fd){return{'model':db[_0x5f24fd['model']],'as':_0x5f24fd['as'],'attributes':_0x5f24fd['attributes'],'include':_0x5f24fd[_0x6587('0x19')]?_[_0x6587('0x1a')](_0x5f24fd[_0x6587('0x19')],function(_0x12e308){return{'model':db[_0x12e308[_0x6587('0x1b')]],'as':_0x12e308['as'],'attributes':_0x12e308[_0x6587('0x1c')],'include':_0x12e308['include']?_[_0x6587('0x1a')](_0x12e308[_0x6587('0x19')],function(_0x4c747d){return{'model':db[_0x4c747d[_0x6587('0x1b')]],'as':_0x4c747d['as'],'attributes':_0x4c747d[_0x6587('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6587('0x1d')](function(_0x386862){logger[_0x6587('0xb')](_0x6587('0x13'),_0xf2b048);logger[_0x6587('0xe')](_0x6587('0x13'),_0xf2b048,JSON[_0x6587('0x1e')](_0x386862));_0x32680f(_0x386862);})[_0x6587('0x1f')](function(_0x7d0844){logger[_0x6587('0x10')](_0x6587('0x13'),_0x7d0844[_0x6587('0x12')],_0xf2b048);_0x3d3448(_0x591178[_0x6587('0x10')](0x1f4,_0x7d0844[_0x6587('0x12')]));});});};exports[_0x6587('0x20')]=function(_0x3c8db7){var _0x1bf47c=this;return new Promise(function(_0x22ffcb,_0xf1e326){return db[_0x6587('0x14')][_0x6587('0x21')](_0x3c8db7[_0x6587('0x22')],{'raw':_0x3c8db7[_0x6587('0x16')]?_0x3c8db7[_0x6587('0x16')][_0x6587('0x17')]===undefined?!![]:![]:!![]})[_0x6587('0x1d')](function(_0x452f33){logger[_0x6587('0xb')]('CreateVoiceCallReport',_0x3c8db7);logger[_0x6587('0xe')](_0x6587('0x20'),_0x3c8db7,JSON[_0x6587('0x1e')](_0x452f33));_0x22ffcb(_0x452f33);})[_0x6587('0x1f')](function(_0x51bd07){logger[_0x6587('0x10')](_0x6587('0x20'),_0x51bd07['message'],_0x3c8db7);_0xf1e326(_0x1bf47c['error'](0x1f4,_0x51bd07[_0x6587('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x5576db){var _0x2e7f01=this;return new Promise(function(_0x4ff57a,_0x20fe13){return db[_0x6587('0x14')][_0x6587('0x23')](_0x5576db[_0x6587('0x22')],{'raw':_0x5576db[_0x6587('0x16')]?_0x5576db[_0x6587('0x16')][_0x6587('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5576db[_0x6587('0x16')]?_0x5576db[_0x6587('0x16')][_0x6587('0x18')]||null:null,'attributes':_0x5576db[_0x6587('0x16')]?_0x5576db['options'][_0x6587('0x1c')]||null:null,'limit':_0x5576db[_0x6587('0x16')]?_0x5576db[_0x6587('0x16')]['limit']||null:null})[_0x6587('0x1d')](function(_0x156bfb){logger[_0x6587('0xb')]('UpdateVoiceCallReport',_0x5576db);logger[_0x6587('0xe')](_0x6587('0x24'),_0x5576db,JSON[_0x6587('0x1e')](_0x156bfb));_0x4ff57a(_0x156bfb);})['catch'](function(_0x395c7e){logger[_0x6587('0x10')](_0x6587('0x24'),_0x395c7e[_0x6587('0x12')],_0x5576db);_0x20fe13(_0x2e7f01[_0x6587('0x10')](0x1f4,_0x395c7e[_0x6587('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 0cd7e4d..146228b 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 _0x83a5=['../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','create','put','delete','multer','util','path','Router','fs-extra'];(function(_0x1b0af8,_0x47def0){var _0x392d26=function(_0x1e7168){while(--_0x1e7168){_0x1b0af8['push'](_0x1b0af8['shift']());}};_0x392d26(++_0x47def0);}(_0x83a5,0xcb));var _0x583a=function(_0x51f4a6,_0x23fa32){_0x51f4a6=_0x51f4a6-0x0;var _0x150756=_0x83a5[_0x51f4a6];return _0x150756;};'use strict';var multer=require(_0x583a('0x0'));var util=require(_0x583a('0x1'));var path=require(_0x583a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x583a('0x3')]();var fs_extra=require(_0x583a('0x4'));var auth=require(_0x583a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x583a('0x6'));var controller=require(_0x583a('0x7'));router[_0x583a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x583a('0x9'),auth[_0x583a('0xa')](),controller[_0x583a('0xb')]);router[_0x583a('0xc')]('/',auth[_0x583a('0xa')](),controller[_0x583a('0xd')]);router[_0x583a('0xe')](_0x583a('0x9'),auth[_0x583a('0xa')](),controller['update']);router[_0x583a('0xf')](_0x583a('0x9'),auth[_0x583a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x63b5=['get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index'];(function(_0x4a758e,_0x23d77d){var _0x4626f4=function(_0x5b4dcf){while(--_0x5b4dcf){_0x4a758e['push'](_0x4a758e['shift']());}};_0x4626f4(++_0x23d77d);}(_0x63b5,0x125));var _0x563b=function(_0x4ebd1e,_0xb8cecd){_0x4ebd1e=_0x4ebd1e-0x0;var _0x1eb74b=_0x63b5[_0x4ebd1e];return _0x1eb74b;};'use strict';var multer=require(_0x563b('0x0'));var util=require('util');var path=require(_0x563b('0x1'));var timeout=require(_0x563b('0x2'));var express=require(_0x563b('0x3'));var router=express[_0x563b('0x4')]();var fs_extra=require(_0x563b('0x5'));var auth=require(_0x563b('0x6'));var interaction=require(_0x563b('0x7'));var config=require(_0x563b('0x8'));var controller=require(_0x563b('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x563b('0xa')]);router[_0x563b('0xb')](_0x563b('0xc'),auth[_0x563b('0xd')](),controller[_0x563b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x563b('0xf')]('/:id',auth[_0x563b('0xd')](),controller['update']);router[_0x563b('0x10')](_0x563b('0xc'),auth[_0x563b('0xd')](),controller[_0x563b('0x11')]);module[_0x563b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 97dd13c..7ea72e7 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 _0x1edc=['exports','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1edc,0x16c));var _0xc1ed=function(_0x42f091,_0x22cac5){_0x42f091=_0x42f091-0x0;var _0x495be1=_0x1edc[_0x42f091];return _0x495be1;};'use strict';var Sequelize=require('sequelize');module[_0xc1ed('0x0')]={'name':{'type':Sequelize[_0xc1ed('0x1')]},'prefix':{'type':Sequelize[_0xc1ed('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xc1ed('0x1')],'set':function(_0x42ec39){this['setDataValue'](_0xc1ed('0x2'),_0x42ec39?_0x42ec39[_0xc1ed('0x3')](''):[]);},'get':function(){return this[_0xc1ed('0x4')](_0xc1ed('0x2'))?this['getDataValue'](_0xc1ed('0x2'))[_0xc1ed('0x5')](''):[];}},'auth':{'type':Sequelize[_0xc1ed('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xc1ed('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc1ed('0x1')]},'description':{'type':Sequelize[_0xc1ed('0x1')]}}; \ No newline at end of file +var _0xf6ea=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','split'];(function(_0x37eb8a,_0x53ec7d){var _0x287b3c=function(_0x150628){while(--_0x150628){_0x37eb8a['push'](_0x37eb8a['shift']());}};_0x287b3c(++_0x53ec7d);}(_0xf6ea,0x151));var _0xaf6e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf6ea[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xaf6e('0x0'));module[_0xaf6e('0x1')]={'name':{'type':Sequelize[_0xaf6e('0x2')]},'prefix':{'type':Sequelize[_0xaf6e('0x2')],'unique':_0xaf6e('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xaf6e('0x2')],'set':function(_0x3ccbe9){this[_0xaf6e('0x4')](_0xaf6e('0x5'),_0x3ccbe9?_0x3ccbe9['join'](''):[]);},'get':function(){return this['getDataValue'](_0xaf6e('0x5'))?this['getDataValue'](_0xaf6e('0x5'))[_0xaf6e('0x6')](''):[];}},'auth':{'type':Sequelize[_0xaf6e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xaf6e('0x2')]},'record':{'type':Sequelize[_0xaf6e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xaf6e('0x2')]},'description':{'type':Sequelize[_0xaf6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e8d96ae..c41ee4e 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 _0x7341=['status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x563634,_0x5da4cf){var _0xe1b86=function(_0x33e2a5){while(--_0x33e2a5){_0x563634['push'](_0x563634['shift']());}};_0xe1b86(++_0x5da4cf);}(_0x7341,0xe4));var _0x1734=function(_0x122ac2,_0x48d2e1){_0x122ac2=_0x122ac2-0x0;var _0x2600e0=_0x7341[_0x122ac2];return _0x2600e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){var _0x34ac29=_0x44e420['get']({'plain':!![]});var _0x5e0023=_0x1734('0x24');return db[_0x1734('0x25')][_0x1734('0x23')]({'where':{'type':_0x5e0023,'resourceId':_0x34ac29['id']}})[_0x1734('0x22')](function(){return _0x44e420;});})[_0x1734('0x22')](function(){_0x45593e[_0x1734('0x18')](0xcc)[_0x1734('0x19')]();});}};}function handleEntityNotFound(_0x27d6e5,_0x4a670a){return function(_0x381960){if(!_0x381960){_0x27d6e5['sendStatus'](0x194);}return _0x381960;};}function handleError(_0x17e068,_0x16a35f){_0x16a35f=_0x16a35f||0x1f4;return function(_0xfca2ad){logger['error'](_0xfca2ad[_0x1734('0x26')]);if(_0xfca2ad[_0x1734('0x27')]){delete _0xfca2ad[_0x1734('0x27')];}_0x17e068['status'](_0x16a35f)[_0x1734('0x28')](_0xfca2ad);};}exports[_0x1734('0x29')]=function(_0x5594c0,_0x1bd659){var _0x419e75={},_0x1b2d85={},_0xf3d22e={'count':0x0,'rows':[]};var _0x4f4d92=_[_0x1734('0x2a')](db[_0x1734('0x2b')]['rawAttributes'],function(_0x4dd04a){return{'name':_0x4dd04a[_0x1734('0x2c')],'type':_0x4dd04a[_0x1734('0x2d')][_0x1734('0x2e')]};});_0x1b2d85[_0x1734('0x2f')]=_[_0x1734('0x2a')](_0x4f4d92,_0x1734('0x27'));_0x1b2d85[_0x1734('0x30')]=_[_0x1734('0x31')](_0x5594c0[_0x1734('0x30')]);_0x1b2d85[_0x1734('0x32')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],_0x1b2d85[_0x1734('0x30')]);_0x419e75[_0x1734('0x34')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],qs[_0x1734('0x35')](_0x5594c0['query'][_0x1734('0x35')]));_0x419e75['attributes']=_0x419e75[_0x1734('0x34')][_0x1734('0x36')]?_0x419e75[_0x1734('0x34')]:_0x1b2d85[_0x1734('0x2f')];if(!_0x5594c0[_0x1734('0x30')][_0x1734('0x37')](_0x1734('0x38'))){_0x419e75[_0x1734('0x1d')]=qs['limit'](_0x5594c0[_0x1734('0x30')][_0x1734('0x1d')]);_0x419e75[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0x5594c0[_0x1734('0x30')][_0x1734('0x1b')]);}_0x419e75[_0x1734('0x39')]=qs['sort'](_0x5594c0[_0x1734('0x30')][_0x1734('0x3a')]);_0x419e75[_0x1734('0x3b')]=qs[_0x1734('0x32')](_[_0x1734('0x3c')](_0x5594c0[_0x1734('0x30')],_0x1b2d85[_0x1734('0x32')]),_0x4f4d92);if(_0x5594c0[_0x1734('0x30')]['filter']){_0x419e75[_0x1734('0x3b')]=_['merge'](_0x419e75[_0x1734('0x3b')],{'$or':_[_0x1734('0x2a')](_0x4f4d92,function(_0x4ee569){if(_0x4ee569[_0x1734('0x2d')]!==_0x1734('0x3d')){var _0x169db8={};_0x169db8[_0x4ee569[_0x1734('0x27')]]={'$like':'%'+_0x5594c0[_0x1734('0x30')][_0x1734('0x3e')]+'%'};return _0x169db8;}})});}_0x419e75=_[_0x1734('0x3f')]({},_0x419e75,_0x5594c0[_0x1734('0x40')]);var _0x55d67c={'where':_0x419e75[_0x1734('0x3b')]};return db[_0x1734('0x2b')][_0x1734('0x1e')](_0x55d67c)[_0x1734('0x22')](function(_0x5f34e1){_0xf3d22e[_0x1734('0x1e')]=_0x5f34e1;if(_0x5594c0['query']['includeAll']){_0x419e75[_0x1734('0x41')]=[{'all':!![]}];}return db[_0x1734('0x2b')][_0x1734('0x42')](_0x419e75);})[_0x1734('0x22')](function(_0x4fc418){_0xf3d22e[_0x1734('0x43')]=_0x4fc418;return _0xf3d22e;})[_0x1734('0x22')](respondWithFilteredResult(_0x1bd659,_0x419e75))['catch'](handleError(_0x1bd659,null));};exports[_0x1734('0x44')]=function(_0x1b104a,_0x55954e){var _0x17f282={'raw':![],'where':{'id':_0x1b104a[_0x1734('0x45')]['id']}},_0x4bfc67={};_0x4bfc67[_0x1734('0x2f')]=_[_0x1734('0x31')](db[_0x1734('0x2b')][_0x1734('0x46')]);_0x4bfc67[_0x1734('0x30')]=_[_0x1734('0x31')](_0x1b104a['query']);_0x4bfc67[_0x1734('0x32')]=_[_0x1734('0x33')](_0x4bfc67['model'],_0x4bfc67[_0x1734('0x30')]);_0x17f282[_0x1734('0x34')]=_[_0x1734('0x33')](_0x4bfc67[_0x1734('0x2f')],qs['fields'](_0x1b104a[_0x1734('0x30')][_0x1734('0x35')]));_0x17f282[_0x1734('0x34')]=_0x17f282['attributes'][_0x1734('0x36')]?_0x17f282[_0x1734('0x34')]:_0x4bfc67[_0x1734('0x2f')];if(_0x1b104a[_0x1734('0x30')][_0x1734('0x47')]){_0x17f282[_0x1734('0x41')]=[{'all':!![]}];}_0x17f282=_[_0x1734('0x3f')]({},_0x17f282,_0x1b104a[_0x1734('0x40')]);return db[_0x1734('0x2b')][_0x1734('0x48')](_0x17f282)[_0x1734('0x22')](handleEntityNotFound(_0x55954e,null))[_0x1734('0x22')](respondWithResult(_0x55954e,null))[_0x1734('0x49')](handleError(_0x55954e,null));};exports[_0x1734('0x4a')]=function(_0x470110,_0x121c8c){return db[_0x1734('0x2b')][_0x1734('0x4a')](_0x470110['body'],{})[_0x1734('0x22')](function(_0x50e12d){var _0xfc42f3=_0x470110[_0x1734('0x4b')][_0x1734('0x4c')]({'plain':!![]});if(!_0xfc42f3)throw new Error(_0x1734('0x4d'));if(_0xfc42f3['role']==='user'){var _0x294097=_0x50e12d[_0x1734('0x4c')]({'plain':!![]});var _0x518ef4=_0x1734('0x24');return db[_0x1734('0x4e')][_0x1734('0x48')]({'where':{'name':_0x518ef4,'userProfileId':_0xfc42f3[_0x1734('0x4f')]},'raw':!![]})[_0x1734('0x22')](function(_0x1394bd){if(_0x1394bd&&_0x1394bd[_0x1734('0x50')]===0x0){return db['UserProfileResource'][_0x1734('0x4a')]({'name':_0x294097[_0x1734('0x27')],'resourceId':_0x294097['id'],'type':_0x1394bd[_0x1734('0x27')],'sectionId':_0x1394bd['id']},{})['then'](function(){return _0x50e12d;});}else{return _0x50e12d;}})[_0x1734('0x49')](function(_0x6b6fef){logger[_0x1734('0x51')](_0x1734('0x52'),_0x6b6fef);throw _0x6b6fef;});}return _0x50e12d;})['then'](respondWithResult(_0x121c8c,0xc9))[_0x1734('0x49')](handleError(_0x121c8c,null));};exports[_0x1734('0x21')]=function(_0x19ceed,_0xac0441){if(_0x19ceed[_0x1734('0x53')]['id']){delete _0x19ceed['body']['id'];}return db[_0x1734('0x2b')]['find']({'where':{'id':_0x19ceed['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xac0441,null))[_0x1734('0x22')](saveUpdates(_0x19ceed['body'],null))['then'](respondWithResult(_0xac0441,null))[_0x1734('0x49')](handleError(_0xac0441,null));};exports[_0x1734('0x23')]=function(_0x553fc0,_0x515e39){return db['VoiceChanSpy'][_0x1734('0x48')]({'where':{'id':_0x553fc0[_0x1734('0x45')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x515e39,null))[_0x1734('0x22')](removeEntity(_0x515e39,null))['catch'](handleError(_0x515e39,null));}; \ No newline at end of file +var _0xc79f=['stack','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','role','ChanSpies','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error'];(function(_0x2cc78b,_0x1c9f1c){var _0x37466f=function(_0xfe0a30){while(--_0xfe0a30){_0x2cc78b['push'](_0x2cc78b['shift']());}};_0x37466f(++_0x1c9f1c);}(_0xc79f,0x82));var _0xfc79=function(_0x4d9a4b,_0x430486){_0x4d9a4b=_0x4d9a4b-0x0;var _0x5326cc=_0xc79f[_0x4d9a4b];return _0x5326cc;};'use strict';var emlformat=require(_0xfc79('0x0'));var rimraf=require(_0xfc79('0x1'));var zipdir=require(_0xfc79('0x2'));var jsonpatch=require(_0xfc79('0x3'));var rp=require(_0xfc79('0x4'));var moment=require('moment');var BPromise=require(_0xfc79('0x5'));var Mustache=require(_0xfc79('0x6'));var util=require(_0xfc79('0x7'));var path=require(_0xfc79('0x8'));var sox=require(_0xfc79('0x9'));var csv=require(_0xfc79('0xa'));var ejs=require(_0xfc79('0xb'));var fs=require('fs');var fs_extra=require(_0xfc79('0xc'));var _=require(_0xfc79('0xd'));var squel=require('squel');var crypto=require(_0xfc79('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc79('0xf'));var toCsv=require(_0xfc79('0xa'));var querystring=require(_0xfc79('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc79('0x11'));var authService=require(_0xfc79('0x12'));var qs=require(_0xfc79('0x13'));var as=require(_0xfc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc79('0x15'))(_0xfc79('0x16'));var utils=require(_0xfc79('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc79('0x18'));var db=require(_0xfc79('0x19'))['db'];function respondWithStatusCode(_0x4b7f0e,_0xc2f79){_0xc2f79=_0xc2f79||0xcc;return function(_0x493a04){if(_0x493a04){return _0x4b7f0e[_0xfc79('0x1a')](_0xc2f79);}return _0x4b7f0e[_0xfc79('0x1b')](_0xc2f79)[_0xfc79('0x1c')]();};}function respondWithResult(_0x4996b6,_0x33bf71){_0x33bf71=_0x33bf71||0xc8;return function(_0x29c937){if(_0x29c937){return _0x4996b6[_0xfc79('0x1b')](_0x33bf71)[_0xfc79('0x1d')](_0x29c937);}};}function respondWithFilteredResult(_0x895b17,_0x7ef734){return function(_0x4cb052){if(_0x4cb052){var _0x228dab=typeof _0x7ef734[_0xfc79('0x1e')]===_0xfc79('0x1f')&&typeof _0x7ef734[_0xfc79('0x20')]==='undefined';var _0x39983a=_0x4cb052[_0xfc79('0x21')];var _0x216501=_0x228dab?0x0:_0x7ef734[_0xfc79('0x1e')];var _0x489e9a=_0x228dab?_0x4cb052['count']:_0x7ef734[_0xfc79('0x1e')]+_0x7ef734['limit'];var _0x816333;if(_0x489e9a>=_0x39983a){_0x489e9a=_0x39983a;_0x816333=0xc8;}else{_0x816333=0xce;}_0x895b17[_0xfc79('0x1b')](_0x816333);return _0x895b17[_0xfc79('0x22')](_0xfc79('0x23'),_0x216501+'-'+_0x489e9a+'/'+_0x39983a)['json'](_0x4cb052);}return null;};}function patchUpdates(_0x8187e2){return function(_0x418f64){try{jsonpatch[_0xfc79('0x24')](_0x418f64,_0x8187e2,!![]);}catch(_0x3c3c54){return BPromise[_0xfc79('0x25')](_0x3c3c54);}return _0x418f64[_0xfc79('0x26')]();};}function saveUpdates(_0x287549,_0x5009d5){return function(_0x1d6551){if(_0x1d6551){return _0x1d6551[_0xfc79('0x27')](_0x287549)[_0xfc79('0x28')](function(_0x2042ee){return _0x2042ee;});}return null;};}function removeEntity(_0x44ab6b,_0x5a1c6e){return function(_0x4d8636){if(_0x4d8636){return _0x4d8636['destroy']()[_0xfc79('0x28')](function(){var _0x3dc4e4=_0x4d8636[_0xfc79('0x29')]({'plain':!![]});var _0x324191='ChanSpies';return db[_0xfc79('0x2a')]['destroy']({'where':{'type':_0x324191,'resourceId':_0x3dc4e4['id']}})[_0xfc79('0x28')](function(){return _0x4d8636;});})['then'](function(){_0x44ab6b[_0xfc79('0x1b')](0xcc)[_0xfc79('0x1c')]();});}};}function handleEntityNotFound(_0x96ceeb,_0x523270){return function(_0x14fd6c){if(!_0x14fd6c){_0x96ceeb[_0xfc79('0x1a')](0x194);}return _0x14fd6c;};}function handleError(_0x168ec2,_0x3a8ca3){_0x3a8ca3=_0x3a8ca3||0x1f4;return function(_0x2ae979){logger[_0xfc79('0x2b')](_0x2ae979[_0xfc79('0x2c')]);if(_0x2ae979['name']){delete _0x2ae979[_0xfc79('0x2d')];}_0x168ec2[_0xfc79('0x1b')](_0x3a8ca3)[_0xfc79('0x2e')](_0x2ae979);};}exports[_0xfc79('0x2f')]=function(_0x52212b,_0x386b1b){var _0x106f1a={},_0x184921={},_0x25c703={'count':0x0,'rows':[]};var _0x43c181=_[_0xfc79('0x30')](db['VoiceChanSpy']['rawAttributes'],function(_0x3a57c3){return{'name':_0x3a57c3['fieldName'],'type':_0x3a57c3[_0xfc79('0x31')][_0xfc79('0x32')]};});_0x184921[_0xfc79('0x33')]=_[_0xfc79('0x30')](_0x43c181,_0xfc79('0x2d'));_0x184921[_0xfc79('0x34')]=_[_0xfc79('0x35')](_0x52212b[_0xfc79('0x34')]);_0x184921[_0xfc79('0x36')]=_['intersection'](_0x184921[_0xfc79('0x33')],_0x184921[_0xfc79('0x34')]);_0x106f1a[_0xfc79('0x37')]=_[_0xfc79('0x38')](_0x184921[_0xfc79('0x33')],qs['fields'](_0x52212b[_0xfc79('0x34')][_0xfc79('0x39')]));_0x106f1a['attributes']=_0x106f1a['attributes']['length']?_0x106f1a[_0xfc79('0x37')]:_0x184921[_0xfc79('0x33')];if(!_0x52212b[_0xfc79('0x34')][_0xfc79('0x3a')](_0xfc79('0x3b'))){_0x106f1a['limit']=qs[_0xfc79('0x20')](_0x52212b[_0xfc79('0x34')][_0xfc79('0x20')]);_0x106f1a['offset']=qs[_0xfc79('0x1e')](_0x52212b[_0xfc79('0x34')]['offset']);}_0x106f1a['order']=qs[_0xfc79('0x3c')](_0x52212b[_0xfc79('0x34')][_0xfc79('0x3c')]);_0x106f1a[_0xfc79('0x3d')]=qs[_0xfc79('0x36')](_[_0xfc79('0x3e')](_0x52212b[_0xfc79('0x34')],_0x184921[_0xfc79('0x36')]),_0x43c181);if(_0x52212b[_0xfc79('0x34')]['filter']){_0x106f1a[_0xfc79('0x3d')]=_[_0xfc79('0x3f')](_0x106f1a[_0xfc79('0x3d')],{'$or':_['map'](_0x43c181,function(_0xa409ff){if(_0xa409ff['type']!==_0xfc79('0x40')){var _0x36cb81={};_0x36cb81[_0xa409ff[_0xfc79('0x2d')]]={'$like':'%'+_0x52212b[_0xfc79('0x34')][_0xfc79('0x41')]+'%'};return _0x36cb81;}})});}_0x106f1a=_[_0xfc79('0x3f')]({},_0x106f1a,_0x52212b[_0xfc79('0x42')]);var _0x3022a7={'where':_0x106f1a[_0xfc79('0x3d')]};return db[_0xfc79('0x43')][_0xfc79('0x21')](_0x3022a7)[_0xfc79('0x28')](function(_0x305cec){_0x25c703[_0xfc79('0x21')]=_0x305cec;if(_0x52212b[_0xfc79('0x34')][_0xfc79('0x44')]){_0x106f1a[_0xfc79('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xfc79('0x46')](_0x106f1a);})['then'](function(_0xdfcefb){_0x25c703[_0xfc79('0x47')]=_0xdfcefb;return _0x25c703;})[_0xfc79('0x28')](respondWithFilteredResult(_0x386b1b,_0x106f1a))[_0xfc79('0x48')](handleError(_0x386b1b,null));};exports[_0xfc79('0x49')]=function(_0x98f935,_0x39bd13){var _0x3f6840={'raw':![],'where':{'id':_0x98f935[_0xfc79('0x4a')]['id']}},_0x17028c={};_0x17028c[_0xfc79('0x33')]=_['keys'](db['VoiceChanSpy'][_0xfc79('0x4b')]);_0x17028c['query']=_[_0xfc79('0x35')](_0x98f935['query']);_0x17028c['filters']=_[_0xfc79('0x38')](_0x17028c['model'],_0x17028c[_0xfc79('0x34')]);_0x3f6840[_0xfc79('0x37')]=_[_0xfc79('0x38')](_0x17028c[_0xfc79('0x33')],qs['fields'](_0x98f935[_0xfc79('0x34')][_0xfc79('0x39')]));_0x3f6840['attributes']=_0x3f6840[_0xfc79('0x37')][_0xfc79('0x4c')]?_0x3f6840[_0xfc79('0x37')]:_0x17028c[_0xfc79('0x33')];if(_0x98f935[_0xfc79('0x34')][_0xfc79('0x44')]){_0x3f6840[_0xfc79('0x45')]=[{'all':!![]}];}_0x3f6840=_[_0xfc79('0x3f')]({},_0x3f6840,_0x98f935[_0xfc79('0x42')]);return db[_0xfc79('0x43')]['find'](_0x3f6840)['then'](handleEntityNotFound(_0x39bd13,null))['then'](respondWithResult(_0x39bd13,null))[_0xfc79('0x48')](handleError(_0x39bd13,null));};exports[_0xfc79('0x4d')]=function(_0x4ce140,_0x549407){return db[_0xfc79('0x43')][_0xfc79('0x4d')](_0x4ce140[_0xfc79('0x4e')],{})[_0xfc79('0x28')](function(_0x12f970){var _0x47f525=_0x4ce140[_0xfc79('0x4f')][_0xfc79('0x29')]({'plain':!![]});if(!_0x47f525)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47f525[_0xfc79('0x50')]==='user'){var _0x2cada8=_0x12f970[_0xfc79('0x29')]({'plain':!![]});var _0x45893b=_0xfc79('0x51');return db['UserProfileSection'][_0xfc79('0x52')]({'where':{'name':_0x45893b,'userProfileId':_0x47f525[_0xfc79('0x53')]},'raw':!![]})[_0xfc79('0x28')](function(_0x44804b){if(_0x44804b&&_0x44804b[_0xfc79('0x54')]===0x0){return db['UserProfileResource'][_0xfc79('0x4d')]({'name':_0x2cada8[_0xfc79('0x2d')],'resourceId':_0x2cada8['id'],'type':_0x44804b['name'],'sectionId':_0x44804b['id']},{})[_0xfc79('0x28')](function(){return _0x12f970;});}else{return _0x12f970;}})[_0xfc79('0x48')](function(_0x4363ec){logger[_0xfc79('0x2b')](_0xfc79('0x55'),_0x4363ec);throw _0x4363ec;});}return _0x12f970;})[_0xfc79('0x28')](respondWithResult(_0x549407,0xc9))[_0xfc79('0x48')](handleError(_0x549407,null));};exports['update']=function(_0x55cc38,_0x2017d0){if(_0x55cc38[_0xfc79('0x4e')]['id']){delete _0x55cc38[_0xfc79('0x4e')]['id'];}return db[_0xfc79('0x43')]['find']({'where':{'id':_0x55cc38[_0xfc79('0x4a')]['id']}})[_0xfc79('0x28')](handleEntityNotFound(_0x2017d0,null))[_0xfc79('0x28')](saveUpdates(_0x55cc38[_0xfc79('0x4e')],null))['then'](respondWithResult(_0x2017d0,null))[_0xfc79('0x48')](handleError(_0x2017d0,null));};exports[_0xfc79('0x56')]=function(_0x272761,_0x1dac37){return db[_0xfc79('0x43')][_0xfc79('0x52')]({'where':{'id':_0x272761[_0xfc79('0x4a')]['id']}})[_0xfc79('0x28')](handleEntityNotFound(_0x1dac37,null))['then'](removeEntity(_0x1dac37,null))[_0xfc79('0x48')](handleError(_0x1dac37,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e7bbbc1..037ff54 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 _0xb994=['internal','name','concat','User','findAll','agent','models','define','VoiceChanSpy','voice_chanspy','then','length','bulkCreate','VoiceExtension','destroy','catch','bluebird','context','from-sip','%s%s','system','push','merge','Set','format','CDR(type)=%s','record','MixMonitor','auth','Authenticate','ChanSpy','SIP/%s,%s','options'];(function(_0x268868,_0x1979ae){var _0x3a4fcd=function(_0x58d70b){while(--_0x58d70b){_0x268868['push'](_0x268868['shift']());}};_0x3a4fcd(++_0x1979ae);}(_0xb994,0x19c));var _0x4b99=function(_0x132339,_0x330970){_0x132339=_0x132339-0x0;var _0x2fbe07=_0xb994[_0x132339];return _0x2fbe07;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x4b99('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5cdfbb,_0x718538,_0x2361dc){var _0x3c99f9=0x1;var _0x100724=[];var _0x4ef31a={'context':_0x718538[_0x4b99('0x1')]||_0x4b99('0x2'),'exten':util['format'](_0x4b99('0x3'),_0x5cdfbb['prefix'],_0x2361dc),'type':_0x4b99('0x4'),'isApp':![],'ChanSpyId':_0x5cdfbb['id'],'UserId':_0x718538['id']};_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':_0x4b99('0x7'),'appdata':util[_0x4b99('0x8')](_0x4b99('0x9'),'chanspy'),'priority':_0x3c99f9++},_0x4ef31a));if(_0x5cdfbb[_0x4b99('0xa')]){_0x100724['push'](_[_0x4b99('0x6')]({'app':_0x4b99('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x5cdfbb['recordingFormat']),'priority':_0x3c99f9++},_0x4ef31a));}if(_0x5cdfbb[_0x4b99('0xc')]){_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':_0x4b99('0xd'),'appdata':_0x5cdfbb['password'],'priority':_0x3c99f9++},_0x4ef31a));}_0x100724['push'](_[_0x4b99('0x6')]({'app':_0x4b99('0xe'),'appdata':util[_0x4b99('0x8')](_0x4b99('0xf'),_0x718538['name'],_0x5cdfbb[_0x4b99('0x10')]?_0x5cdfbb[_0x4b99('0x10')]['join'](''):''),'priority':_0x3c99f9++},_0x4ef31a));if(_0x5cdfbb['record']){_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':'StopMixMonitor','priority':_0x3c99f9++},_0x4ef31a));}return _0x100724;};var getChanSpyApplications=function(_0x52b66d,_0x59840f){var _0x269acc=[];for(var _0x980b61=0x0,_0x159606=0x1;_0x980b61<_0x59840f['length'];_0x980b61++,_0x159606=0x1){_0x269acc=_0x269acc['concat'](getUserApplications(_0x52b66d,_0x59840f[_0x980b61],_0x59840f[_0x980b61]['internal']));if(_0x59840f[_0x980b61][_0x4b99('0x11')]!=_0x59840f[_0x980b61][_0x4b99('0x12')]){_0x269acc=_0x269acc[_0x4b99('0x13')](getUserApplications(_0x52b66d,_0x59840f[_0x980b61],_0x59840f[_0x980b61][_0x4b99('0x12')]));}}return _0x269acc;};var getChanSpyPromise=function(_0x38555c,_0x3777ef){return new BPromise(function(_0x1461db,_0x3ee869){return _0x38555c[_0x4b99('0x14')][_0x4b99('0x15')]({'attributes':['id','name',_0x4b99('0x11')],'where':{'role':_0x4b99('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x20e818){if(_0x20e818){return _0x1461db(getChanSpyApplications(_0x3777ef,_0x20e818));}return _0x1461db([]);})['catch'](function(_0x23acd7){_0x3ee869(_0x23acd7);});});};module['exports']=function(_0x95fca1,_0x542c15){var _0x28b3d6=_0x95fca1[_0x4b99('0x17')];return _0x95fca1[_0x4b99('0x18')](_0x4b99('0x19'),attributes,{'tableName':_0x4b99('0x1a'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e1cb4,_0x146db1,_0x514bb5){return getChanSpyPromise(_0x28b3d6,_0x1e1cb4)[_0x4b99('0x1b')](function(_0xc772a4){if(_0xc772a4&&_0xc772a4[_0x4b99('0x1c')]){return _0x28b3d6['VoiceExtension'][_0x4b99('0x1d')](_0xc772a4);}})[_0x4b99('0x1b')](function(){_0x514bb5();})['catch'](function(_0x1f7644){_0x514bb5(_0x1f7644);});},'afterUpdate':function(_0x889364,_0x223d85,_0x5c6151){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1f')]({'where':{'ChanSpyId':_0x889364['id']}})['then'](function(){return getChanSpyPromise(_0x28b3d6,_0x889364);})[_0x4b99('0x1b')](function(_0x4aeb0a){if(_0x4aeb0a&&_0x4aeb0a[_0x4b99('0x1c')]){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1d')](_0x4aeb0a);}})['then'](function(){_0x5c6151();})[_0x4b99('0x20')](function(_0x1b0685){_0x5c6151(_0x1b0685);});},'afterDestroy':function(_0x153a8b,_0x32918f,_0x5f4a7e){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1f')]({'where':{'ChanSpyId':_0x153a8b['id']}})[_0x4b99('0x1b')](function(){_0x5f4a7e();})[_0x4b99('0x20')](function(_0x13bfcd){_0x5f4a7e(_0x13bfcd);});}}});}; \ No newline at end of file +var _0x06f4=['Authenticate','ChanSpy','options','join','length','concat','internal','name','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','from-sip','format','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x06f4,0x15e));var _0x406f=function(_0x30e378,_0x31dd4b){_0x30e378=_0x30e378-0x0;var _0x3ac5dd=_0x06f4[_0x30e378];return _0x3ac5dd;};'use strict';var _=require(_0x406f('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x34e259,_0x58cf02,_0x2ecd63){var _0x4afdb4=0x1;var _0x12cc17=[];var _0x34c4dc={'context':_0x58cf02['context']||_0x406f('0x1'),'exten':util[_0x406f('0x2')]('%s%s',_0x34e259['prefix'],_0x2ecd63),'type':_0x406f('0x3'),'isApp':![],'ChanSpyId':_0x34e259['id'],'UserId':_0x58cf02['id']};_0x12cc17[_0x406f('0x4')](_[_0x406f('0x5')]({'app':_0x406f('0x6'),'appdata':util[_0x406f('0x2')](_0x406f('0x7'),_0x406f('0x8')),'priority':_0x4afdb4++},_0x34c4dc));if(_0x34e259[_0x406f('0x9')]){_0x12cc17[_0x406f('0x4')](_['merge']({'app':_0x406f('0xa'),'appdata':util[_0x406f('0x2')]('${UNIQUEID}.%s,a',_0x34e259[_0x406f('0xb')]),'priority':_0x4afdb4++},_0x34c4dc));}if(_0x34e259[_0x406f('0xc')]){_0x12cc17[_0x406f('0x4')](_[_0x406f('0x5')]({'app':_0x406f('0xd'),'appdata':_0x34e259['password'],'priority':_0x4afdb4++},_0x34c4dc));}_0x12cc17['push'](_[_0x406f('0x5')]({'app':_0x406f('0xe'),'appdata':util[_0x406f('0x2')]('SIP/%s,%s',_0x58cf02['name'],_0x34e259[_0x406f('0xf')]?_0x34e259['options'][_0x406f('0x10')](''):''),'priority':_0x4afdb4++},_0x34c4dc));if(_0x34e259[_0x406f('0x9')]){_0x12cc17[_0x406f('0x4')](_['merge']({'app':'StopMixMonitor','priority':_0x4afdb4++},_0x34c4dc));}return _0x12cc17;};var getChanSpyApplications=function(_0xb8fe1d,_0xdab878){var _0x55cd73=[];for(var _0x58d7dc=0x0,_0x6e02b1=0x1;_0x58d7dc<_0xdab878[_0x406f('0x11')];_0x58d7dc++,_0x6e02b1=0x1){_0x55cd73=_0x55cd73[_0x406f('0x12')](getUserApplications(_0xb8fe1d,_0xdab878[_0x58d7dc],_0xdab878[_0x58d7dc][_0x406f('0x13')]));if(_0xdab878[_0x58d7dc][_0x406f('0x13')]!=_0xdab878[_0x58d7dc][_0x406f('0x14')]){_0x55cd73=_0x55cd73[_0x406f('0x12')](getUserApplications(_0xb8fe1d,_0xdab878[_0x58d7dc],_0xdab878[_0x58d7dc][_0x406f('0x14')]));}}return _0x55cd73;};var getChanSpyPromise=function(_0x2d326d,_0x1cd945){return new BPromise(function(_0x1e4445,_0x59ada2){return _0x2d326d[_0x406f('0x15')]['findAll']({'attributes':['id','name',_0x406f('0x13')],'where':{'role':_0x406f('0x16'),'chanspy':!![]},'raw':!![]})[_0x406f('0x17')](function(_0x1ec53b){if(_0x1ec53b){return _0x1e4445(getChanSpyApplications(_0x1cd945,_0x1ec53b));}return _0x1e4445([]);})[_0x406f('0x18')](function(_0x1f5197){_0x59ada2(_0x1f5197);});});};module[_0x406f('0x19')]=function(_0x1819c2,_0x37534e){var _0x5e9edc=_0x1819c2[_0x406f('0x1a')];return _0x1819c2[_0x406f('0x1b')](_0x406f('0x1c'),attributes,{'tableName':_0x406f('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e2f96,_0xbfd4cf,_0x5ea1f6){return getChanSpyPromise(_0x5e9edc,_0x3e2f96)[_0x406f('0x17')](function(_0x85fc7d){if(_0x85fc7d&&_0x85fc7d[_0x406f('0x11')]){return _0x5e9edc[_0x406f('0x1e')][_0x406f('0x1f')](_0x85fc7d);}})[_0x406f('0x17')](function(){_0x5ea1f6();})[_0x406f('0x18')](function(_0x41aa11){_0x5ea1f6(_0x41aa11);});},'afterUpdate':function(_0x5e1e35,_0x2cbe31,_0x95c9f8){return _0x5e9edc[_0x406f('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5e1e35['id']}})[_0x406f('0x17')](function(){return getChanSpyPromise(_0x5e9edc,_0x5e1e35);})[_0x406f('0x17')](function(_0x513f37){if(_0x513f37&&_0x513f37[_0x406f('0x11')]){return _0x5e9edc[_0x406f('0x1e')][_0x406f('0x1f')](_0x513f37);}})[_0x406f('0x17')](function(){_0x95c9f8();})[_0x406f('0x18')](function(_0x4d73fd){_0x95c9f8(_0x4d73fd);});},'afterDestroy':function(_0x2a49bb,_0x2b6d96,_0x3b12b5){return _0x5e9edc[_0x406f('0x1e')][_0x406f('0x20')]({'where':{'ChanSpyId':_0x2a49bb['id']}})[_0x406f('0x17')](function(){_0x3b12b5();})[_0x406f('0x18')](function(_0x164302){_0x3b12b5(_0x164302);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e2248a3..96757fd 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 _0xdace=['request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xdace,0xc5));var _0xedac=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0xdace[_0x320b8e];return _0x55a10a;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x6953=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6953,0x91));var _0x3695=function(_0x334c14,_0x1df988){_0x334c14=_0x334c14-0x0;var _0x1e7875=_0x6953[_0x334c14];return _0x1e7875;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d640a2e..338afa4 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 _0x303d=['/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x303d,0xe3));var _0xd303=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x303d[_0x5a7e78];return _0xa8d4a1;};'use strict';var multer=require(_0xd303('0x0'));var util=require(_0xd303('0x1'));var path=require(_0xd303('0x2'));var timeout=require(_0xd303('0x3'));var express=require(_0xd303('0x4'));var router=express[_0xd303('0x5')]();var fs_extra=require(_0xd303('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd303('0x7'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xd303('0x8')]('/',auth[_0xd303('0x9')](),controller[_0xd303('0xa')]);router[_0xd303('0x8')](_0xd303('0xb'),auth['isAuthenticated'](),controller[_0xd303('0xc')]);router[_0xd303('0xd')]('/',auth[_0xd303('0x9')](),controller['create']);router[_0xd303('0xe')](_0xd303('0xb'),auth[_0xd303('0x9')](),controller[_0xd303('0xf')]);router['delete'](_0xd303('0xb'),auth[_0xd303('0x9')](),controller['destroy']);module[_0xd303('0x10')]=router; \ No newline at end of file +var _0xdae5=['put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdae5,0x1a1));var _0x5dae=function(_0x542a7b,_0x563884){_0x542a7b=_0x542a7b-0x0;var _0x26f109=_0xdae5[_0x542a7b];return _0x26f109;};'use strict';var multer=require(_0x5dae('0x0'));var util=require('util');var path=require(_0x5dae('0x1'));var timeout=require(_0x5dae('0x2'));var express=require(_0x5dae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5dae('0x4'));var interaction=require(_0x5dae('0x5'));var config=require(_0x5dae('0x6'));var controller=require(_0x5dae('0x7'));router[_0x5dae('0x8')]('/',auth[_0x5dae('0x9')](),controller[_0x5dae('0xa')]);router[_0x5dae('0x8')](_0x5dae('0xb'),auth[_0x5dae('0x9')](),controller[_0x5dae('0xc')]);router[_0x5dae('0xd')]('/',auth['isAuthenticated'](),controller[_0x5dae('0xe')]);router[_0x5dae('0xf')](_0x5dae('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5dae('0x10')]('/:id',auth[_0x5dae('0x9')](),controller['destroy']);module[_0x5dae('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 5f9311e..19b56b8 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 _0xf705=['sequelize','STRING','BOOLEAN'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0xf705,0x168));var _0x5f70=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf705[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5f70('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f70('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5f70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9489=['exports','name','STRING','sequelize'];(function(_0x5374eb,_0x4e5e18){var _0x406a25=function(_0x3dfa42){while(--_0x3dfa42){_0x5374eb['push'](_0x5374eb['shift']());}};_0x406a25(++_0x4e5e18);}(_0x9489,0xd3));var _0x9948=function(_0x5d1fe6,_0x37ed86){_0x5d1fe6=_0x5d1fe6-0x0;var _0x1c9ebf=_0x9489[_0x5d1fe6];return _0x1c9ebf;};'use strict';var Sequelize=require(_0x9948('0x0'));module[_0x9948('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9948('0x2')},'description':{'type':Sequelize[_0x9948('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 00a927a..06231ba 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 _0x4f74=['jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','readFileSync','join','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/context.ejs','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x698173,_0x32fca1){var _0x18898e=function(_0x2f9e4b){while(--_0x2f9e4b){_0x698173['push'](_0x698173['shift']());}};_0x18898e(++_0x32fca1);}(_0x4f74,0x17f));var _0x44f7=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x4f74[_0x4851ff];return _0x26773b;};'use strict';var emlformat=require(_0x44f7('0x0'));var rimraf=require(_0x44f7('0x1'));var zipdir=require(_0x44f7('0x2'));var jsonpatch=require(_0x44f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44f7('0x4'));var Mustache=require(_0x44f7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x44f7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44f7('0x7'));var _=require(_0x44f7('0x8'));var squel=require(_0x44f7('0x9'));var crypto=require(_0x44f7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x44f7('0xb'));var toCsv=require(_0x44f7('0x6'));var querystring=require('querystring');var Papa=require(_0x44f7('0xc'));var Redis=require(_0x44f7('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44f7('0xe'));var logger=require(_0x44f7('0xf'))(_0x44f7('0x10'));var utils=require(_0x44f7('0x11'));var config=require(_0x44f7('0x12'));var licenseUtil=require(_0x44f7('0x13'));var db=require(_0x44f7('0x14'))['db'];var jayson=require(_0x44f7('0x15'));var client=jayson[_0x44f7('0x16')][_0x44f7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xddbed7,_0x5049a0,_0x210344,_0x5b6bc0){return new BPromise(function(_0x15e0b5,_0xf581a4){var _0x57e982=_0x5b6bc0||client;return _0x57e982['request'](_0xddbed7,_0x210344)[_0x44f7('0x18')](function(_0x10640c){logger[_0x44f7('0x19')](_0x44f7('0x1a'),_0x5049a0,_0x44f7('0x1b'));logger['debug'](_0x44f7('0x1c'),_0x5049a0,_0x44f7('0x1b'),JSON[_0x44f7('0x1d')](_0x10640c));if(_0x10640c[_0x44f7('0x1e')]){if(_0x10640c[_0x44f7('0x1e')][_0x44f7('0x1f')]===0x1f4){logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x10640c[_0x44f7('0x1e')][_0x44f7('0x20')]);return _0xf581a4(_0x10640c['error']['message']);}logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x10640c[_0x44f7('0x1e')]['message']);return _0x15e0b5(_0x10640c[_0x44f7('0x1e')]['message']);}else{logger[_0x44f7('0x19')]('VoiceContext,\x20%s,\x20%s',_0x5049a0,_0x44f7('0x1b'));_0x15e0b5(_0x10640c[_0x44f7('0x21')][_0x44f7('0x20')]);}})['catch'](function(_0x1f6082){logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x1f6082);_0xf581a4(_0x1f6082);});});}function respondWithStatusCode(_0x494489,_0xe8f022){_0xe8f022=_0xe8f022||0xcc;return function(_0x3f7793){if(_0x3f7793){return _0x494489['sendStatus'](_0xe8f022);}return _0x494489['status'](_0xe8f022)[_0x44f7('0x22')]();};}function respondWithResult(_0x45d53e,_0x32e7bc){_0x32e7bc=_0x32e7bc||0xc8;return function(_0x1125de){if(_0x1125de){return _0x45d53e[_0x44f7('0x23')](_0x32e7bc)[_0x44f7('0x24')](_0x1125de);}};}function respondWithFilteredResult(_0x54328c,_0x1d9804){return function(_0x4cbf2f){if(_0x4cbf2f){var _0x1a90ca=typeof _0x1d9804[_0x44f7('0x25')]===_0x44f7('0x26')&&typeof _0x1d9804['limit']===_0x44f7('0x26');var _0x407e4f=_0x4cbf2f['count'];var _0x1221e8=_0x1a90ca?0x0:_0x1d9804[_0x44f7('0x25')];var _0x3ec1a4=_0x1a90ca?_0x4cbf2f[_0x44f7('0x27')]:_0x1d9804[_0x44f7('0x25')]+_0x1d9804[_0x44f7('0x28')];var _0x560efb;if(_0x3ec1a4>=_0x407e4f){_0x3ec1a4=_0x407e4f;_0x560efb=0xc8;}else{_0x560efb=0xce;}_0x54328c[_0x44f7('0x23')](_0x560efb);return _0x54328c[_0x44f7('0x29')](_0x44f7('0x2a'),_0x1221e8+'-'+_0x3ec1a4+'/'+_0x407e4f)[_0x44f7('0x24')](_0x4cbf2f);}return null;};}function patchUpdates(_0x51b1d9){return function(_0x3b1865){try{jsonpatch[_0x44f7('0x2b')](_0x3b1865,_0x51b1d9,!![]);}catch(_0x4c226e){return BPromise[_0x44f7('0x2c')](_0x4c226e);}return _0x3b1865[_0x44f7('0x2d')]();};}function saveUpdates(_0x6099b2,_0x1c9c93){return function(_0x31708d){if(_0x31708d){return _0x31708d[_0x44f7('0x2e')](_0x6099b2)['then'](function(_0x8213b0){return _0x8213b0;});}return null;};}function removeEntity(_0x236b0d,_0x246fcd){return function(_0x4b08eb){if(_0x4b08eb){return _0x4b08eb[_0x44f7('0x2f')]()['then'](function(){var _0x25dd82=_0x4b08eb[_0x44f7('0x30')]({'plain':!![]});var _0x35c701=_0x44f7('0x31');return db[_0x44f7('0x32')][_0x44f7('0x2f')]({'where':{'type':_0x35c701,'resourceId':_0x25dd82['id']}})[_0x44f7('0x18')](function(){return _0x4b08eb;});})[_0x44f7('0x18')](function(){_0x236b0d[_0x44f7('0x23')](0xcc)[_0x44f7('0x22')]();});}};}function handleEntityNotFound(_0xefb5ec,_0x5aff46){return function(_0x163130){if(!_0x163130){_0xefb5ec['sendStatus'](0x194);}return _0x163130;};}function handleError(_0x4ed47b,_0x27f13e){_0x27f13e=_0x27f13e||0x1f4;return function(_0x48aff6){logger['error'](_0x48aff6[_0x44f7('0x33')]);if(_0x48aff6['name']){delete _0x48aff6[_0x44f7('0x34')];}_0x4ed47b[_0x44f7('0x23')](_0x27f13e)[_0x44f7('0x35')](_0x48aff6);};}exports['index']=function(_0x3d1ea6,_0x5bf1d9){var _0x330ca1={},_0x36db0d={},_0x1f4a47={'count':0x0,'rows':[]};var _0x50cd4a=_[_0x44f7('0x36')](db[_0x44f7('0x37')]['rawAttributes'],function(_0x2b8b42){return{'name':_0x2b8b42[_0x44f7('0x38')],'type':_0x2b8b42[_0x44f7('0x39')][_0x44f7('0x3a')]};});_0x36db0d[_0x44f7('0x3b')]=_[_0x44f7('0x36')](_0x50cd4a,'name');_0x36db0d[_0x44f7('0x3c')]=_[_0x44f7('0x3d')](_0x3d1ea6[_0x44f7('0x3c')]);_0x36db0d[_0x44f7('0x3e')]=_[_0x44f7('0x3f')](_0x36db0d['model'],_0x36db0d[_0x44f7('0x3c')]);_0x330ca1['attributes']=_['intersection'](_0x36db0d['model'],qs[_0x44f7('0x40')](_0x3d1ea6['query'][_0x44f7('0x40')]));_0x330ca1[_0x44f7('0x41')]=_0x330ca1[_0x44f7('0x41')]['length']?_0x330ca1[_0x44f7('0x41')]:_0x36db0d[_0x44f7('0x3b')];if(!_0x3d1ea6[_0x44f7('0x3c')]['hasOwnProperty'](_0x44f7('0x42'))){_0x330ca1[_0x44f7('0x28')]=qs[_0x44f7('0x28')](_0x3d1ea6[_0x44f7('0x3c')][_0x44f7('0x28')]);_0x330ca1[_0x44f7('0x25')]=qs[_0x44f7('0x25')](_0x3d1ea6[_0x44f7('0x3c')][_0x44f7('0x25')]);}_0x330ca1['order']=qs[_0x44f7('0x43')](_0x3d1ea6[_0x44f7('0x3c')]['sort']);_0x330ca1[_0x44f7('0x44')]=qs[_0x44f7('0x3e')](_[_0x44f7('0x45')](_0x3d1ea6[_0x44f7('0x3c')],_0x36db0d[_0x44f7('0x3e')]),_0x50cd4a);if(_0x3d1ea6[_0x44f7('0x3c')]['filter']){_0x330ca1[_0x44f7('0x44')]=_['merge'](_0x330ca1['where'],{'$or':_[_0x44f7('0x36')](_0x50cd4a,function(_0x49a263){if(_0x49a263[_0x44f7('0x39')]!==_0x44f7('0x46')){var _0x1e85e7={};_0x1e85e7[_0x49a263[_0x44f7('0x34')]]={'$like':'%'+_0x3d1ea6['query']['filter']+'%'};return _0x1e85e7;}})});}_0x330ca1=_[_0x44f7('0x47')]({},_0x330ca1,_0x3d1ea6[_0x44f7('0x48')]);var _0x2489e2={'where':_0x330ca1[_0x44f7('0x44')]};return db['VoiceContext'][_0x44f7('0x27')](_0x2489e2)[_0x44f7('0x18')](function(_0x38da04){_0x1f4a47['count']=_0x38da04;if(_0x3d1ea6[_0x44f7('0x3c')]['includeAll']){_0x330ca1[_0x44f7('0x49')]=[{'all':!![]}];}return db[_0x44f7('0x37')][_0x44f7('0x4a')](_0x330ca1);})[_0x44f7('0x18')](function(_0x1de113){_0x1f4a47[_0x44f7('0x4b')]=_0x1de113;return _0x1f4a47;})['then'](respondWithFilteredResult(_0x5bf1d9,_0x330ca1))[_0x44f7('0x4c')](handleError(_0x5bf1d9,null));};exports[_0x44f7('0x4d')]=function(_0x2d7892,_0x289813){var _0x451feb={'raw':![],'where':{'id':_0x2d7892[_0x44f7('0x4e')]['id']}},_0x46a20f={};_0x46a20f['model']=_['keys'](db[_0x44f7('0x37')][_0x44f7('0x4f')]);_0x46a20f['query']=_[_0x44f7('0x3d')](_0x2d7892[_0x44f7('0x3c')]);_0x46a20f[_0x44f7('0x3e')]=_[_0x44f7('0x3f')](_0x46a20f[_0x44f7('0x3b')],_0x46a20f['query']);_0x451feb[_0x44f7('0x41')]=_[_0x44f7('0x3f')](_0x46a20f[_0x44f7('0x3b')],qs['fields'](_0x2d7892[_0x44f7('0x3c')][_0x44f7('0x40')]));_0x451feb[_0x44f7('0x41')]=_0x451feb['attributes'][_0x44f7('0x50')]?_0x451feb['attributes']:_0x46a20f[_0x44f7('0x3b')];if(_0x2d7892[_0x44f7('0x3c')][_0x44f7('0x51')]){_0x451feb[_0x44f7('0x49')]=[{'all':!![]}];}_0x451feb=_['merge']({},_0x451feb,_0x2d7892['options']);return db[_0x44f7('0x37')][_0x44f7('0x52')](_0x451feb)[_0x44f7('0x18')](handleEntityNotFound(_0x289813,null))['then'](respondWithResult(_0x289813,null))[_0x44f7('0x4c')](handleError(_0x289813,null));};exports[_0x44f7('0x53')]=function(_0x1074a1,_0x24a5ed,_0x134756){var _0x56c85a;return db[_0x44f7('0x37')][_0x44f7('0x53')](_0x1074a1[_0x44f7('0x54')],{'raw':!![]})[_0x44f7('0x18')](function(_0x4d6a41){_0x56c85a=_0x4d6a41;return db[_0x44f7('0x37')][_0x44f7('0x4a')]({'raw':!![]});})[_0x44f7('0x18')](function(_0x31a852){var _0x411cdb=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x398848=ejs[_0x44f7('0x57')](_0x411cdb,{'contexts':_0x31a852||[]});fs['writeFileSync'](_0x44f7('0x58'),_0x398848);})['then'](function(){return respondWithRpcPromise(_0x44f7('0x59'),_0x44f7('0x53'),{'module':_0x44f7('0x5a')});})[_0x44f7('0x18')](function(){var _0xec03e4=_0x1074a1[_0x44f7('0x5b')][_0x44f7('0x30')]({'plain':!![]});if(!_0xec03e4)throw new Error(_0x44f7('0x5c'));if(_0xec03e4['role']==='user'){var _0x161c61=_0x56c85a['get']({'plain':!![]});return db[_0x44f7('0x5d')][_0x44f7('0x52')]({'where':{'name':_0x44f7('0x31'),'userProfileId':_0xec03e4[_0x44f7('0x5e')]},'raw':!![]})[_0x44f7('0x18')](function(_0x25122a){if(_0x25122a&&_0x25122a[_0x44f7('0x5f')]===0x0){return db['UserProfileResource'][_0x44f7('0x53')]({'name':_0x161c61['name'],'resourceId':_0x161c61['id'],'type':_0x25122a[_0x44f7('0x34')],'sectionId':_0x25122a['id']},{})[_0x44f7('0x18')](function(){return _0x56c85a;});}else{return _0x56c85a;}})[_0x44f7('0x4c')](function(_0xf12f6f){logger[_0x44f7('0x1e')](_0x44f7('0x60'),_0xf12f6f);throw _0xf12f6f;});}return _0x56c85a;})['then'](respondWithResult(_0x24a5ed,0xc9))[_0x44f7('0x4c')](handleError(_0x24a5ed,null));};exports[_0x44f7('0x2e')]=function(_0x445bf1,_0x279653,_0x231383){var _0x11da66;return db[_0x44f7('0x37')][_0x44f7('0x52')]({'where':{'id':_0x445bf1['params']['id']}})[_0x44f7('0x18')](handleEntityNotFound(_0x279653,null))[_0x44f7('0x18')](saveUpdates(_0x445bf1[_0x44f7('0x54')],null))['then'](function(_0x140211){if(_0x140211){_0x11da66=_0x140211;return db[_0x44f7('0x37')][_0x44f7('0x4a')]({'raw':!![]});}})['then'](function(_0x8356a3){var _0x372891=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config[_0x44f7('0x61')],_0x44f7('0x62')),_0x44f7('0x63'));var _0x17f887=ejs[_0x44f7('0x57')](_0x372891,{'contexts':_0x8356a3||[]});fs[_0x44f7('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x17f887);})[_0x44f7('0x18')](function(){return respondWithRpcPromise(_0x44f7('0x59'),_0x44f7('0x2e'),{'module':_0x44f7('0x5a')});})[_0x44f7('0x18')](function(){return _0x11da66;})['then'](respondWithResult(_0x279653,null))[_0x44f7('0x4c')](handleError(_0x279653,null));};exports[_0x44f7('0x2f')]=function(_0x2a9ca4,_0x1b155a,_0xec9ac6){var _0x66111c;return db['VoiceContext'][_0x44f7('0x52')]({'where':{'id':_0x2a9ca4[_0x44f7('0x4e')]['id']}})[_0x44f7('0x18')](handleEntityNotFound(_0x1b155a,null))[_0x44f7('0x18')](removeEntity(_0x1b155a,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x44f7('0x18')](function(_0xa848a1){var _0x36159a=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config['root'],_0x44f7('0x62')),_0x44f7('0x63'));var _0x5eb88f=ejs[_0x44f7('0x57')](_0x36159a,{'contexts':_0xa848a1});fs['writeFileSync'](_0x44f7('0x58'),_0x5eb88f);return respondWithRpcPromise(_0x44f7('0x59'),'destroy',{'module':_0x44f7('0x5a')});})[_0x44f7('0x4c')](handleError(_0x1b155a,null));}; \ No newline at end of file +var _0x0a03=['render','/etc/asterisk/extensions_xcally_contexts.conf','findAll','Reload','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','find','create','body','readFileSync','join','root','utf8','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params'];(function(_0x508329,_0x434519){var _0x142d22=function(_0x44d2d3){while(--_0x44d2d3){_0x508329['push'](_0x508329['shift']());}};_0x142d22(++_0x434519);}(_0x0a03,0xd4));var _0x30a0=function(_0x3264ca,_0x4b7745){_0x3264ca=_0x3264ca-0x0;var _0x5197f2=_0x0a03[_0x3264ca];return _0x5197f2;};'use strict';var emlformat=require(_0x30a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30a0('0x1'));var jsonpatch=require(_0x30a0('0x2'));var rp=require(_0x30a0('0x3'));var moment=require(_0x30a0('0x4'));var BPromise=require(_0x30a0('0x5'));var Mustache=require(_0x30a0('0x6'));var util=require(_0x30a0('0x7'));var path=require(_0x30a0('0x8'));var sox=require(_0x30a0('0x9'));var csv=require('to-csv');var ejs=require(_0x30a0('0xa'));var fs=require('fs');var fs_extra=require(_0x30a0('0xb'));var _=require(_0x30a0('0xc'));var squel=require(_0x30a0('0xd'));var crypto=require('crypto');var jsforce=require(_0x30a0('0xe'));var deskjs=require(_0x30a0('0xf'));var toCsv=require(_0x30a0('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x30a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30a0('0x12'));var as=require(_0x30a0('0x13'));var hardwareService=require(_0x30a0('0x14'));var logger=require(_0x30a0('0x15'))(_0x30a0('0x16'));var utils=require('../../config/utils');var config=require(_0x30a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x30a0('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x30a0('0x19')][_0x30a0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1a9cb3,_0x34c967,_0x52ac64,_0x2b3836){return new BPromise(function(_0xee5913,_0x1c12b3){var _0x5de090=_0x2b3836||client;return _0x5de090[_0x30a0('0x1b')](_0x1a9cb3,_0x52ac64)[_0x30a0('0x1c')](function(_0x86dbf6){logger['info'](_0x30a0('0x1d'),_0x34c967,'request\x20sent');logger[_0x30a0('0x1e')](_0x30a0('0x1f'),_0x34c967,_0x30a0('0x20'),JSON[_0x30a0('0x21')](_0x86dbf6));if(_0x86dbf6[_0x30a0('0x22')]){if(_0x86dbf6[_0x30a0('0x22')]['code']===0x1f4){logger[_0x30a0('0x22')](_0x30a0('0x1d'),_0x34c967,_0x86dbf6[_0x30a0('0x22')][_0x30a0('0x23')]);return _0x1c12b3(_0x86dbf6[_0x30a0('0x22')]['message']);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x34c967,_0x86dbf6[_0x30a0('0x22')][_0x30a0('0x23')]);return _0xee5913(_0x86dbf6[_0x30a0('0x22')]['message']);}else{logger[_0x30a0('0x24')](_0x30a0('0x1d'),_0x34c967,_0x30a0('0x20'));_0xee5913(_0x86dbf6[_0x30a0('0x25')][_0x30a0('0x23')]);}})[_0x30a0('0x26')](function(_0x4b4c8c){logger[_0x30a0('0x22')](_0x30a0('0x1d'),_0x34c967,_0x4b4c8c);_0x1c12b3(_0x4b4c8c);});});}function respondWithStatusCode(_0x422801,_0x4e8530){_0x4e8530=_0x4e8530||0xcc;return function(_0x26584b){if(_0x26584b){return _0x422801['sendStatus'](_0x4e8530);}return _0x422801[_0x30a0('0x27')](_0x4e8530)[_0x30a0('0x28')]();};}function respondWithResult(_0x18045b,_0x537026){_0x537026=_0x537026||0xc8;return function(_0x1ce112){if(_0x1ce112){return _0x18045b[_0x30a0('0x27')](_0x537026)[_0x30a0('0x29')](_0x1ce112);}};}function respondWithFilteredResult(_0x3fc380,_0x59c9ac){return function(_0x53fc54){if(_0x53fc54){var _0x4f4cde=typeof _0x59c9ac[_0x30a0('0x2a')]===_0x30a0('0x2b')&&typeof _0x59c9ac['limit']==='undefined';var _0x190040=_0x53fc54['count'];var _0x2234c5=_0x4f4cde?0x0:_0x59c9ac[_0x30a0('0x2a')];var _0x1e3bad=_0x4f4cde?_0x53fc54[_0x30a0('0x2c')]:_0x59c9ac[_0x30a0('0x2a')]+_0x59c9ac[_0x30a0('0x2d')];var _0x4fcee8;if(_0x1e3bad>=_0x190040){_0x1e3bad=_0x190040;_0x4fcee8=0xc8;}else{_0x4fcee8=0xce;}_0x3fc380['status'](_0x4fcee8);return _0x3fc380[_0x30a0('0x2e')]('Content-Range',_0x2234c5+'-'+_0x1e3bad+'/'+_0x190040)[_0x30a0('0x29')](_0x53fc54);}return null;};}function patchUpdates(_0x127f9c){return function(_0x548b15){try{jsonpatch[_0x30a0('0x2f')](_0x548b15,_0x127f9c,!![]);}catch(_0x4e000b){return BPromise[_0x30a0('0x30')](_0x4e000b);}return _0x548b15[_0x30a0('0x31')]();};}function saveUpdates(_0x1c7b82,_0x24206b){return function(_0x3b8476){if(_0x3b8476){return _0x3b8476[_0x30a0('0x32')](_0x1c7b82)[_0x30a0('0x1c')](function(_0x3e9852){return _0x3e9852;});}return null;};}function removeEntity(_0x41ce2d,_0x1ffb6a){return function(_0x311d67){if(_0x311d67){return _0x311d67[_0x30a0('0x33')]()[_0x30a0('0x1c')](function(){var _0x122528=_0x311d67[_0x30a0('0x34')]({'plain':!![]});var _0x50f282=_0x30a0('0x35');return db[_0x30a0('0x36')][_0x30a0('0x33')]({'where':{'type':_0x50f282,'resourceId':_0x122528['id']}})[_0x30a0('0x1c')](function(){return _0x311d67;});})[_0x30a0('0x1c')](function(){_0x41ce2d[_0x30a0('0x27')](0xcc)[_0x30a0('0x28')]();});}};}function handleEntityNotFound(_0x49eefc,_0x3bdc0a){return function(_0x140b69){if(!_0x140b69){_0x49eefc[_0x30a0('0x37')](0x194);}return _0x140b69;};}function handleError(_0xdccef3,_0x23784f){_0x23784f=_0x23784f||0x1f4;return function(_0x304366){logger[_0x30a0('0x22')](_0x304366[_0x30a0('0x38')]);if(_0x304366['name']){delete _0x304366[_0x30a0('0x39')];}_0xdccef3['status'](_0x23784f)[_0x30a0('0x3a')](_0x304366);};}exports[_0x30a0('0x3b')]=function(_0x3c66b,_0x2e5a8e){var _0x25e473={},_0x57667c={},_0x5c1135={'count':0x0,'rows':[]};var _0x3b8bb2=_[_0x30a0('0x3c')](db[_0x30a0('0x3d')][_0x30a0('0x3e')],function(_0x4ec0ab){return{'name':_0x4ec0ab['fieldName'],'type':_0x4ec0ab['type'][_0x30a0('0x3f')]};});_0x57667c[_0x30a0('0x40')]=_[_0x30a0('0x3c')](_0x3b8bb2,'name');_0x57667c['query']=_[_0x30a0('0x41')](_0x3c66b[_0x30a0('0x42')]);_0x57667c[_0x30a0('0x43')]=_[_0x30a0('0x44')](_0x57667c[_0x30a0('0x40')],_0x57667c[_0x30a0('0x42')]);_0x25e473['attributes']=_['intersection'](_0x57667c[_0x30a0('0x40')],qs['fields'](_0x3c66b['query'][_0x30a0('0x45')]));_0x25e473['attributes']=_0x25e473[_0x30a0('0x46')][_0x30a0('0x47')]?_0x25e473[_0x30a0('0x46')]:_0x57667c[_0x30a0('0x40')];if(!_0x3c66b['query']['hasOwnProperty'](_0x30a0('0x48'))){_0x25e473[_0x30a0('0x2d')]=qs['limit'](_0x3c66b[_0x30a0('0x42')][_0x30a0('0x2d')]);_0x25e473[_0x30a0('0x2a')]=qs['offset'](_0x3c66b[_0x30a0('0x42')]['offset']);}_0x25e473[_0x30a0('0x49')]=qs['sort'](_0x3c66b[_0x30a0('0x42')][_0x30a0('0x4a')]);_0x25e473[_0x30a0('0x4b')]=qs[_0x30a0('0x43')](_['pick'](_0x3c66b[_0x30a0('0x42')],_0x57667c[_0x30a0('0x43')]),_0x3b8bb2);if(_0x3c66b[_0x30a0('0x42')][_0x30a0('0x4c')]){_0x25e473[_0x30a0('0x4b')]=_[_0x30a0('0x4d')](_0x25e473[_0x30a0('0x4b')],{'$or':_[_0x30a0('0x3c')](_0x3b8bb2,function(_0x2f8d91){if(_0x2f8d91[_0x30a0('0x4e')]!==_0x30a0('0x4f')){var _0x5116c8={};_0x5116c8[_0x2f8d91[_0x30a0('0x39')]]={'$like':'%'+_0x3c66b[_0x30a0('0x42')]['filter']+'%'};return _0x5116c8;}})});}_0x25e473=_[_0x30a0('0x4d')]({},_0x25e473,_0x3c66b[_0x30a0('0x50')]);var _0x41ade5={'where':_0x25e473[_0x30a0('0x4b')]};return db[_0x30a0('0x3d')]['count'](_0x41ade5)[_0x30a0('0x1c')](function(_0x5aaf35){_0x5c1135[_0x30a0('0x2c')]=_0x5aaf35;if(_0x3c66b[_0x30a0('0x42')][_0x30a0('0x51')]){_0x25e473[_0x30a0('0x52')]=[{'all':!![]}];}return db[_0x30a0('0x3d')]['findAll'](_0x25e473);})['then'](function(_0x3dd4e7){_0x5c1135[_0x30a0('0x53')]=_0x3dd4e7;return _0x5c1135;})[_0x30a0('0x1c')](respondWithFilteredResult(_0x2e5a8e,_0x25e473))[_0x30a0('0x26')](handleError(_0x2e5a8e,null));};exports[_0x30a0('0x54')]=function(_0x2c6fd2,_0x34c1aa){var _0x38776b={'raw':![],'where':{'id':_0x2c6fd2['params']['id']}},_0x4dbbf8={};_0x4dbbf8['model']=_[_0x30a0('0x41')](db[_0x30a0('0x3d')][_0x30a0('0x3e')]);_0x4dbbf8[_0x30a0('0x42')]=_[_0x30a0('0x41')](_0x2c6fd2['query']);_0x4dbbf8['filters']=_[_0x30a0('0x44')](_0x4dbbf8[_0x30a0('0x40')],_0x4dbbf8['query']);_0x38776b['attributes']=_['intersection'](_0x4dbbf8[_0x30a0('0x40')],qs['fields'](_0x2c6fd2[_0x30a0('0x42')][_0x30a0('0x45')]));_0x38776b[_0x30a0('0x46')]=_0x38776b[_0x30a0('0x46')]['length']?_0x38776b[_0x30a0('0x46')]:_0x4dbbf8[_0x30a0('0x40')];if(_0x2c6fd2[_0x30a0('0x42')][_0x30a0('0x51')]){_0x38776b[_0x30a0('0x52')]=[{'all':!![]}];}_0x38776b=_['merge']({},_0x38776b,_0x2c6fd2[_0x30a0('0x50')]);return db[_0x30a0('0x3d')][_0x30a0('0x55')](_0x38776b)[_0x30a0('0x1c')](handleEntityNotFound(_0x34c1aa,null))[_0x30a0('0x1c')](respondWithResult(_0x34c1aa,null))['catch'](handleError(_0x34c1aa,null));};exports[_0x30a0('0x56')]=function(_0x1226a2,_0x11f4bd,_0x196925){var _0x2d9331;return db['VoiceContext'][_0x30a0('0x56')](_0x1226a2[_0x30a0('0x57')],{'raw':!![]})[_0x30a0('0x1c')](function(_0x2e7640){_0x2d9331=_0x2e7640;return db[_0x30a0('0x3d')]['findAll']({'raw':!![]});})[_0x30a0('0x1c')](function(_0x4482d8){var _0x4983e0=fs[_0x30a0('0x58')](path[_0x30a0('0x59')](config[_0x30a0('0x5a')],'server/files/templates/context.ejs'),_0x30a0('0x5b'));var _0x4b33bd=ejs['render'](_0x4983e0,{'contexts':_0x4482d8||[]});fs[_0x30a0('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4b33bd);})[_0x30a0('0x1c')](function(){return respondWithRpcPromise('Reload',_0x30a0('0x56'),{'module':_0x30a0('0x5d')});})[_0x30a0('0x1c')](function(){var _0x4b6102=_0x1226a2[_0x30a0('0x5e')][_0x30a0('0x34')]({'plain':!![]});if(!_0x4b6102)throw new Error(_0x30a0('0x5f'));if(_0x4b6102[_0x30a0('0x60')]==='user'){var _0x374f6d=_0x2d9331[_0x30a0('0x34')]({'plain':!![]});return db[_0x30a0('0x61')][_0x30a0('0x55')]({'where':{'name':_0x30a0('0x35'),'userProfileId':_0x4b6102[_0x30a0('0x62')]},'raw':!![]})[_0x30a0('0x1c')](function(_0x231581){if(_0x231581&&_0x231581['autoAssociation']===0x0){return db[_0x30a0('0x36')][_0x30a0('0x56')]({'name':_0x374f6d[_0x30a0('0x39')],'resourceId':_0x374f6d['id'],'type':_0x231581[_0x30a0('0x39')],'sectionId':_0x231581['id']},{})[_0x30a0('0x1c')](function(){return _0x2d9331;});}else{return _0x2d9331;}})[_0x30a0('0x26')](function(_0x32e0f7){logger[_0x30a0('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32e0f7);throw _0x32e0f7;});}return _0x2d9331;})['then'](respondWithResult(_0x11f4bd,0xc9))[_0x30a0('0x26')](handleError(_0x11f4bd,null));};exports['update']=function(_0x2a6447,_0x2b415c,_0x2e88e0){var _0x5e6895;return db[_0x30a0('0x3d')][_0x30a0('0x55')]({'where':{'id':_0x2a6447[_0x30a0('0x63')]['id']}})['then'](handleEntityNotFound(_0x2b415c,null))[_0x30a0('0x1c')](saveUpdates(_0x2a6447[_0x30a0('0x57')],null))[_0x30a0('0x1c')](function(_0x2247ec){if(_0x2247ec){_0x5e6895=_0x2247ec;return db[_0x30a0('0x3d')]['findAll']({'raw':!![]});}})[_0x30a0('0x1c')](function(_0x44fb86){var _0x1d1c21=fs['readFileSync'](path[_0x30a0('0x59')](config[_0x30a0('0x5a')],'server/files/templates/context.ejs'),'utf8');var _0x5eff03=ejs[_0x30a0('0x64')](_0x1d1c21,{'contexts':_0x44fb86||[]});fs['writeFileSync'](_0x30a0('0x65'),_0x5eff03);})[_0x30a0('0x1c')](function(){return respondWithRpcPromise('Reload',_0x30a0('0x32'),{'module':'chan_sip.so'});})[_0x30a0('0x1c')](function(){return _0x5e6895;})[_0x30a0('0x1c')](respondWithResult(_0x2b415c,null))[_0x30a0('0x26')](handleError(_0x2b415c,null));};exports[_0x30a0('0x33')]=function(_0x12f6c8,_0x45866f,_0x219671){var _0x5bb562;return db['VoiceContext']['find']({'where':{'id':_0x12f6c8['params']['id']}})[_0x30a0('0x1c')](handleEntityNotFound(_0x45866f,null))[_0x30a0('0x1c')](removeEntity(_0x45866f,null))[_0x30a0('0x1c')](function(){return db['VoiceContext'][_0x30a0('0x66')]({'raw':!![]});})[_0x30a0('0x1c')](function(_0x111364){var _0x847c66=fs[_0x30a0('0x58')](path[_0x30a0('0x59')](config['root'],'server/files/templates/context.ejs'),_0x30a0('0x5b'));var _0x116b67=ejs['render'](_0x847c66,{'contexts':_0x111364});fs[_0x30a0('0x5c')](_0x30a0('0x65'),_0x116b67);return respondWithRpcPromise(_0x30a0('0x67'),_0x30a0('0x33'),{'module':'chan_sip.so'});})[_0x30a0('0x26')](handleError(_0x45866f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 600fc9c..e2a0e62 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 _0xd5b0=['path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4ee799,_0x22e2c2){var _0x26fe5b=function(_0x52b3e9){while(--_0x52b3e9){_0x4ee799['push'](_0x4ee799['shift']());}};_0x26fe5b(++_0x22e2c2);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x5a1804,_0x5f12a5){_0x5a1804=_0x5a1804-0x0;var _0x4087d2=_0xd5b0[_0x5a1804];return _0x4087d2;};'use strict';var _=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var logger=require(_0x0d5b('0x2'))(_0x0d5b('0x3'));var moment=require('moment');var BPromise=require(_0x0d5b('0x4'));var rp=require(_0x0d5b('0x5'));var fs=require('fs');var path=require(_0x0d5b('0x6'));var rimraf=require(_0x0d5b('0x7'));var config=require(_0x0d5b('0x8'));var attributes=require(_0x0d5b('0x9'));module[_0x0d5b('0xa')]=function(_0x52b1f6,_0x4036b4){return _0x52b1f6[_0x0d5b('0xb')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['../../config/logger','api','request-promise','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6324,0x17b));var _0x4632=function(_0x5d1dad,_0x2cbdd4){_0x5d1dad=_0x5d1dad-0x0;var _0x334f8d=_0x6324[_0x5d1dad];return _0x334f8d;};'use strict';var _=require('lodash');var util=require(_0x4632('0x0'));var logger=require(_0x4632('0x1'))(_0x4632('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4632('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4632('0x4'));var config=require('../../config/environment');var attributes=require(_0x4632('0x5'));module[_0x4632('0x6')]=function(_0x130b5e,_0x5aade7){return _0x130b5e[_0x4632('0x7')](_0x4632('0x8'),attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3c95c06..3ad7b92 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 _0x51c5=['code','message','VoiceContext,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error'];(function(_0x26d252,_0x3d7e71){var _0x5cd2be=function(_0xd7c16){while(--_0xd7c16){_0x26d252['push'](_0x26d252['shift']());}};_0x5cd2be(++_0x3d7e71);}(_0x51c5,0x8f));var _0x551c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x51c5[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x551c('0x0'));var util=require(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rs=require(_0x551c('0x4'));var fs=require('fs');var Redis=require(_0x551c('0x5'));var db=require(_0x551c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x551c('0x7'))(_0x551c('0x8'));var config=require(_0x551c('0x9'));var jayson=require(_0x551c('0xa'));var client=jayson[_0x551c('0xb')][_0x551c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21dfa1,_0x196955,_0x4f3a0a){return new BPromise(function(_0x414edb,_0x15f4f8){return client[_0x551c('0xd')](_0x21dfa1,_0x4f3a0a)['then'](function(_0x17683c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x196955,'request\x20sent');logger[_0x551c('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x196955,_0x551c('0xf'),JSON[_0x551c('0x10')](_0x17683c));if(_0x17683c[_0x551c('0x11')]){if(_0x17683c[_0x551c('0x11')][_0x551c('0x12')]===0x1f4){logger[_0x551c('0x11')]('VoiceContext,\x20%s,\x20%s',_0x196955,_0x17683c[_0x551c('0x11')][_0x551c('0x13')]);return _0x15f4f8(_0x17683c[_0x551c('0x11')]['message']);}logger[_0x551c('0x11')](_0x551c('0x14'),_0x196955,_0x17683c['error'][_0x551c('0x13')]);return _0x414edb(_0x17683c['error'][_0x551c('0x13')]);}else{logger[_0x551c('0x15')](_0x551c('0x14'),_0x196955,_0x551c('0xf'));_0x414edb(_0x17683c['result']['message']);}})[_0x551c('0x16')](function(_0xcdf011){logger['error'](_0x551c('0x14'),_0x196955,_0xcdf011);_0x15f4f8(_0xcdf011);});});} \ No newline at end of file +var _0xf81a=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x37b533,_0x49bb2f){var _0x4e0588=function(_0x3a0c93){while(--_0x3a0c93){_0x37b533['push'](_0x37b533['shift']());}};_0x4e0588(++_0x49bb2f);}(_0xf81a,0x16b));var _0xaf81=function(_0x31af76,_0x396c12){_0x31af76=_0x31af76-0x0;var _0x5757e9=_0xf81a[_0x31af76];return _0x5757e9;};'use strict';var _=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf81('0x3'));var fs=require('fs');var Redis=require(_0xaf81('0x4'));var db=require(_0xaf81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf81('0x8'));var client=jayson[_0xaf81('0x9')][_0xaf81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd36,_0x268973,_0x365b31){return new BPromise(function(_0x4c3052,_0x3f0ac8){return client[_0xaf81('0xb')](_0x5cfd36,_0x365b31)[_0xaf81('0xc')](function(_0x3efaaf){logger['info'](_0xaf81('0xd'),_0x268973,_0xaf81('0xe'));logger[_0xaf81('0xf')](_0xaf81('0x10'),_0x268973,_0xaf81('0xe'),JSON[_0xaf81('0x11')](_0x3efaaf));if(_0x3efaaf['error']){if(_0x3efaaf['error'][_0xaf81('0x12')]===0x1f4){logger['error'](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x3f0ac8(_0x3efaaf[_0xaf81('0x13')]['message']);}logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x4c3052(_0x3efaaf[_0xaf81('0x13')]['message']);}else{logger[_0xaf81('0x15')](_0xaf81('0xd'),_0x268973,'request\x20sent');_0x4c3052(_0x3efaaf[_0xaf81('0x16')][_0xaf81('0x14')]);}})[_0xaf81('0x17')](function(_0x508df4){logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x508df4);_0x3f0ac8(_0x508df4);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9e5d2ba..568909d 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 _0x6ce9=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x55da99,_0x4a6b0c){var _0x575612=function(_0x9ebd8){while(--_0x9ebd8){_0x55da99['push'](_0x55da99['shift']());}};_0x575612(++_0x4a6b0c);}(_0x6ce9,0xe1));var _0x96ce=function(_0x4c44fe,_0x2a45b2){_0x4c44fe=_0x4c44fe-0x0;var _0x36b26e=_0x6ce9[_0x4c44fe];return _0x36b26e;};'use strict';var multer=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var path=require(_0x96ce('0x2'));var timeout=require(_0x96ce('0x3'));var express=require(_0x96ce('0x4'));var router=express[_0x96ce('0x5')]();var fs_extra=require(_0x96ce('0x6'));var auth=require(_0x96ce('0x7'));var interaction=require(_0x96ce('0x8'));var config=require('../../config/environment');var controller=require(_0x96ce('0x9'));router[_0x96ce('0xa')]('/',auth[_0x96ce('0xb')](),controller[_0x96ce('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x96ce('0xd')]);router[_0x96ce('0xa')](_0x96ce('0xe'),auth[_0x96ce('0xb')](),controller[_0x96ce('0xf')]);router[_0x96ce('0x10')]('/',auth['isAuthenticated'](),controller[_0x96ce('0x11')]);router[_0x96ce('0x12')](_0x96ce('0xe'),auth[_0x96ce('0xb')](),controller[_0x96ce('0x13')]);router['delete'](_0x96ce('0xe'),auth['isAuthenticated'](),controller[_0x96ce('0x14')]);module[_0x96ce('0x15')]=router; \ No newline at end of file +var _0x5b96=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x37a0e2,_0x5248ac){var _0x2b9fb1=function(_0x5d2034){while(--_0x5d2034){_0x37a0e2['push'](_0x37a0e2['shift']());}};_0x2b9fb1(++_0x5248ac);}(_0x5b96,0xbc));var _0x65b9=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x5b96[_0x5c768b];return _0x335af8;};'use strict';var multer=require(_0x65b9('0x0'));var util=require('util');var path=require(_0x65b9('0x1'));var timeout=require(_0x65b9('0x2'));var express=require('express');var router=express[_0x65b9('0x3')]();var fs_extra=require(_0x65b9('0x4'));var auth=require(_0x65b9('0x5'));var interaction=require(_0x65b9('0x6'));var config=require(_0x65b9('0x7'));var controller=require(_0x65b9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x65b9('0x9')]);router[_0x65b9('0xa')](_0x65b9('0xb'),auth[_0x65b9('0xc')](),controller['describe']);router[_0x65b9('0xa')](_0x65b9('0xd'),auth[_0x65b9('0xc')](),controller[_0x65b9('0xe')]);router[_0x65b9('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65b9('0x10')](_0x65b9('0xd'),auth[_0x65b9('0xc')](),controller[_0x65b9('0x11')]);router[_0x65b9('0x12')]('/:id',auth[_0x65b9('0xc')](),controller[_0x65b9('0x13')]);module[_0x65b9('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 281dd47..5700567 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 _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x1b4af6,_0xd59625){var _0x105d96=function(_0x31995e){while(--_0x31995e){_0x1b4af6['push'](_0x1b4af6['shift']());}};_0x105d96(++_0xd59625);}(_0xb821,0xa7));var _0x1b82=function(_0x4f62af,_0x231ea8){_0x4f62af=_0x4f62af-0x0;var _0x16aa1b=_0xb821[_0x4f62af];return _0x16aa1b;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5c25ac2..e13ed04 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 _0x3d4b=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x3d4b,0x15e));var _0xb3d4=function(_0x2f1c02,_0x3f24bf){_0x2f1c02=_0x2f1c02-0x0;var _0x5bb7de=_0x3d4b[_0x2f1c02];return _0x5bb7de;};'use strict';var emlformat=require(_0xb3d4('0x0'));var rimraf=require(_0xb3d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3d4('0x2'));var BPromise=require(_0xb3d4('0x3'));var Mustache=require(_0xb3d4('0x4'));var util=require(_0xb3d4('0x5'));var path=require(_0xb3d4('0x6'));var sox=require(_0xb3d4('0x7'));var csv=require(_0xb3d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3d4('0x9'));var squel=require(_0xb3d4('0xa'));var crypto=require(_0xb3d4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb3d4('0x8'));var querystring=require(_0xb3d4('0xc'));var Papa=require(_0xb3d4('0xd'));var Redis=require(_0xb3d4('0xe'));var authService=require(_0xb3d4('0xf'));var qs=require(_0xb3d4('0x10'));var as=require(_0xb3d4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3d4('0x12'))(_0xb3d4('0x13'));var utils=require('../../config/utils');var config=require(_0xb3d4('0x14'));var licenseUtil=require(_0xb3d4('0x15'));var db=require(_0xb3d4('0x16'))['db'];function respondWithStatusCode(_0x3d67d0,_0x9ff88d){_0x9ff88d=_0x9ff88d||0xcc;return function(_0x1b3774){if(_0x1b3774){return _0x3d67d0[_0xb3d4('0x17')](_0x9ff88d);}return _0x3d67d0[_0xb3d4('0x18')](_0x9ff88d)['end']();};}function respondWithResult(_0x9d7bc4,_0x6ac81a){_0x6ac81a=_0x6ac81a||0xc8;return function(_0x1efa53){if(_0x1efa53){return _0x9d7bc4[_0xb3d4('0x18')](_0x6ac81a)[_0xb3d4('0x19')](_0x1efa53);}};}function respondWithFilteredResult(_0x871a05,_0x591657){return function(_0x5267f1){if(_0x5267f1){var _0x5c3790=typeof _0x591657['offset']==='undefined'&&typeof _0x591657[_0xb3d4('0x1a')]===_0xb3d4('0x1b');var _0x41ce82=_0x5267f1[_0xb3d4('0x1c')];var _0xa42a94=_0x5c3790?0x0:_0x591657[_0xb3d4('0x1d')];var _0x523ccc=_0x5c3790?_0x5267f1[_0xb3d4('0x1c')]:_0x591657[_0xb3d4('0x1d')]+_0x591657[_0xb3d4('0x1a')];var _0x5cda46;if(_0x523ccc>=_0x41ce82){_0x523ccc=_0x41ce82;_0x5cda46=0xc8;}else{_0x5cda46=0xce;}_0x871a05[_0xb3d4('0x18')](_0x5cda46);return _0x871a05[_0xb3d4('0x1e')](_0xb3d4('0x1f'),_0xa42a94+'-'+_0x523ccc+'/'+_0x41ce82)[_0xb3d4('0x19')](_0x5267f1);}return null;};}function patchUpdates(_0x2ddc42){return function(_0x4eafa2){try{jsonpatch[_0xb3d4('0x20')](_0x4eafa2,_0x2ddc42,!![]);}catch(_0x36a356){return BPromise[_0xb3d4('0x21')](_0x36a356);}return _0x4eafa2[_0xb3d4('0x22')]();};}function saveUpdates(_0x58894d,_0x20e22b){return function(_0xb8f36e){if(_0xb8f36e){return _0xb8f36e[_0xb3d4('0x23')](_0x58894d)['then'](function(_0x3ab6b0){return _0x3ab6b0;});}return null;};}function removeEntity(_0x510e2,_0x1bac9b){return function(_0x5da9ed){if(_0x5da9ed){return _0x5da9ed[_0xb3d4('0x24')]()['then'](function(){_0x510e2[_0xb3d4('0x18')](0xcc)[_0xb3d4('0x25')]();});}};}function handleEntityNotFound(_0x393dfe,_0x23489c){return function(_0x5c3e2b){if(!_0x5c3e2b){_0x393dfe['sendStatus'](0x194);}return _0x5c3e2b;};}function handleError(_0x44f9bd,_0x6c4cd3){_0x6c4cd3=_0x6c4cd3||0x1f4;return function(_0x592ae4){logger[_0xb3d4('0x26')](_0x592ae4[_0xb3d4('0x27')]);if(_0x592ae4[_0xb3d4('0x28')]){delete _0x592ae4[_0xb3d4('0x28')];}_0x44f9bd[_0xb3d4('0x18')](_0x6c4cd3)[_0xb3d4('0x29')](_0x592ae4);};}exports[_0xb3d4('0x2a')]=function(_0x584116,_0x5bb174){var _0x27ae0c={},_0x254a9c={},_0x4dfe10={'count':0x0,'rows':[]};var _0x4b00a9=_[_0xb3d4('0x2b')](db[_0xb3d4('0x2c')][_0xb3d4('0x2d')],function(_0xf29265){return{'name':_0xf29265[_0xb3d4('0x2e')],'type':_0xf29265[_0xb3d4('0x2f')]['key']};});_0x254a9c[_0xb3d4('0x30')]=_[_0xb3d4('0x2b')](_0x4b00a9,_0xb3d4('0x28'));_0x254a9c[_0xb3d4('0x31')]=_['keys'](_0x584116[_0xb3d4('0x31')]);_0x254a9c[_0xb3d4('0x32')]=_['intersection'](_0x254a9c[_0xb3d4('0x30')],_0x254a9c[_0xb3d4('0x31')]);_0x27ae0c[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0x254a9c[_0xb3d4('0x30')],qs[_0xb3d4('0x35')](_0x584116[_0xb3d4('0x31')]['fields']));_0x27ae0c['attributes']=_0x27ae0c['attributes']['length']?_0x27ae0c[_0xb3d4('0x33')]:_0x254a9c['model'];if(!_0x584116['query'][_0xb3d4('0x36')](_0xb3d4('0x37'))){_0x27ae0c[_0xb3d4('0x1a')]=qs[_0xb3d4('0x1a')](_0x584116[_0xb3d4('0x31')]['limit']);_0x27ae0c['offset']=qs['offset'](_0x584116[_0xb3d4('0x31')][_0xb3d4('0x1d')]);}_0x27ae0c[_0xb3d4('0x38')]=qs[_0xb3d4('0x39')](_0x584116[_0xb3d4('0x31')][_0xb3d4('0x39')]);_0x27ae0c[_0xb3d4('0x3a')]=qs['filters'](_['pick'](_0x584116[_0xb3d4('0x31')],_0x254a9c['filters']),_0x4b00a9);if(_0x584116['query']['filter']){_0x27ae0c[_0xb3d4('0x3a')]=_[_0xb3d4('0x3b')](_0x27ae0c[_0xb3d4('0x3a')],{'$or':_['map'](_0x4b00a9,function(_0x3d2181){if(_0x3d2181[_0xb3d4('0x2f')]!==_0xb3d4('0x3c')){var _0x5292ec={};_0x5292ec[_0x3d2181[_0xb3d4('0x28')]]={'$like':'%'+_0x584116['query'][_0xb3d4('0x3d')]+'%'};return _0x5292ec;}})});}_0x27ae0c=_[_0xb3d4('0x3b')]({},_0x27ae0c,_0x584116[_0xb3d4('0x3e')]);var _0x457135={'where':_0x27ae0c[_0xb3d4('0x3a')]};return db['VoiceDialReport']['count'](_0x457135)[_0xb3d4('0x3f')](function(_0x41287b){_0x4dfe10[_0xb3d4('0x1c')]=_0x41287b;if(_0x584116[_0xb3d4('0x31')][_0xb3d4('0x40')]){_0x27ae0c[_0xb3d4('0x41')]=[{'all':!![]}];}return db[_0xb3d4('0x2c')][_0xb3d4('0x42')](_0x27ae0c);})['then'](function(_0xb0356d){_0x4dfe10[_0xb3d4('0x43')]=_0xb0356d;return _0x4dfe10;})['then'](respondWithFilteredResult(_0x5bb174,_0x27ae0c))[_0xb3d4('0x44')](handleError(_0x5bb174,null));};exports['show']=function(_0x50d83d,_0x10f632){var _0x9bf9a0={'raw':!![],'where':{'id':_0x50d83d[_0xb3d4('0x45')]['id']}},_0x4274a4={};_0x4274a4['model']=_[_0xb3d4('0x46')](db[_0xb3d4('0x2c')][_0xb3d4('0x2d')]);_0x4274a4[_0xb3d4('0x31')]=_[_0xb3d4('0x46')](_0x50d83d['query']);_0x4274a4[_0xb3d4('0x32')]=_[_0xb3d4('0x34')](_0x4274a4[_0xb3d4('0x30')],_0x4274a4[_0xb3d4('0x31')]);_0x9bf9a0[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0x4274a4['model'],qs[_0xb3d4('0x35')](_0x50d83d[_0xb3d4('0x31')][_0xb3d4('0x35')]));_0x9bf9a0[_0xb3d4('0x33')]=_0x9bf9a0['attributes'][_0xb3d4('0x47')]?_0x9bf9a0[_0xb3d4('0x33')]:_0x4274a4[_0xb3d4('0x30')];if(_0x50d83d[_0xb3d4('0x31')][_0xb3d4('0x40')]){_0x9bf9a0[_0xb3d4('0x41')]=[{'all':!![]}];}_0x9bf9a0=_[_0xb3d4('0x3b')]({},_0x9bf9a0,_0x50d83d[_0xb3d4('0x3e')]);return db[_0xb3d4('0x2c')]['find'](_0x9bf9a0)[_0xb3d4('0x3f')](handleEntityNotFound(_0x10f632,null))[_0xb3d4('0x3f')](respondWithResult(_0x10f632,null))[_0xb3d4('0x44')](handleError(_0x10f632,null));};exports['create']=function(_0x1a644c,_0x1f69e9){return db[_0xb3d4('0x2c')][_0xb3d4('0x48')](_0x1a644c['body'],{})[_0xb3d4('0x3f')](respondWithResult(_0x1f69e9,0xc9))[_0xb3d4('0x44')](handleError(_0x1f69e9,null));};exports[_0xb3d4('0x23')]=function(_0xa95383,_0x3db461){if(_0xa95383[_0xb3d4('0x49')]['id']){delete _0xa95383[_0xb3d4('0x49')]['id'];}return db[_0xb3d4('0x2c')][_0xb3d4('0x4a')]({'where':{'id':_0xa95383[_0xb3d4('0x45')]['id']}})[_0xb3d4('0x3f')](handleEntityNotFound(_0x3db461,null))[_0xb3d4('0x3f')](saveUpdates(_0xa95383[_0xb3d4('0x49')],null))[_0xb3d4('0x3f')](respondWithResult(_0x3db461,null))[_0xb3d4('0x44')](handleError(_0x3db461,null));};exports[_0xb3d4('0x24')]=function(_0x3cafdf,_0x500856){return db[_0xb3d4('0x2c')][_0xb3d4('0x4a')]({'where':{'id':_0x3cafdf['params']['id']}})['then'](handleEntityNotFound(_0x500856,null))['then'](removeEntity(_0x500856,null))[_0xb3d4('0x44')](handleError(_0x500856,null));};exports[_0xb3d4('0x4b')]=function(_0x544540,_0x479b39){return db[_0xb3d4('0x2c')]['describe']()[_0xb3d4('0x3f')](respondWithResult(_0x479b39,null))[_0xb3d4('0x44')](handleError(_0x479b39,null));}; \ No newline at end of file +var _0x972e=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status'];(function(_0x401a4d,_0x4bb835){var _0x1faaff=function(_0x57539e){while(--_0x57539e){_0x401a4d['push'](_0x401a4d['shift']());}};_0x1faaff(++_0x4bb835);}(_0x972e,0x14e));var _0xe972=function(_0x3066c5,_0x4d4edf){_0x3066c5=_0x3066c5-0x0;var _0x2dcd8e=_0x972e[_0x3066c5];return _0x2dcd8e;};'use strict';var emlformat=require(_0xe972('0x0'));var rimraf=require(_0xe972('0x1'));var zipdir=require(_0xe972('0x2'));var jsonpatch=require(_0xe972('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe972('0x4'));var Mustache=require('mustache');var util=require(_0xe972('0x5'));var path=require(_0xe972('0x6'));var sox=require(_0xe972('0x7'));var csv=require(_0xe972('0x8'));var ejs=require(_0xe972('0x9'));var fs=require('fs');var fs_extra=require(_0xe972('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe972('0xb'));var deskjs=require(_0xe972('0xc'));var toCsv=require(_0xe972('0x8'));var querystring=require('querystring');var Papa=require(_0xe972('0xd'));var Redis=require('ioredis');var authService=require(_0xe972('0xe'));var qs=require(_0xe972('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe972('0x10'))(_0xe972('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe972('0x12'));var db=require(_0xe972('0x13'))['db'];function respondWithStatusCode(_0x5a19ed,_0xb35d3){_0xb35d3=_0xb35d3||0xcc;return function(_0x34aac5){if(_0x34aac5){return _0x5a19ed['sendStatus'](_0xb35d3);}return _0x5a19ed[_0xe972('0x14')](_0xb35d3)[_0xe972('0x15')]();};}function respondWithResult(_0x3323d9,_0x3192c6){_0x3192c6=_0x3192c6||0xc8;return function(_0x2b7f44){if(_0x2b7f44){return _0x3323d9[_0xe972('0x14')](_0x3192c6)[_0xe972('0x16')](_0x2b7f44);}};}function respondWithFilteredResult(_0x4196d7,_0xa66212){return function(_0x1b7b8c){if(_0x1b7b8c){var _0x4c2d5b=typeof _0xa66212[_0xe972('0x17')]===_0xe972('0x18')&&typeof _0xa66212[_0xe972('0x19')]===_0xe972('0x18');var _0x587f10=_0x1b7b8c[_0xe972('0x1a')];var _0x2504eb=_0x4c2d5b?0x0:_0xa66212[_0xe972('0x17')];var _0x5a9206=_0x4c2d5b?_0x1b7b8c[_0xe972('0x1a')]:_0xa66212[_0xe972('0x17')]+_0xa66212[_0xe972('0x19')];var _0x3d2a8c;if(_0x5a9206>=_0x587f10){_0x5a9206=_0x587f10;_0x3d2a8c=0xc8;}else{_0x3d2a8c=0xce;}_0x4196d7['status'](_0x3d2a8c);return _0x4196d7['set'](_0xe972('0x1b'),_0x2504eb+'-'+_0x5a9206+'/'+_0x587f10)[_0xe972('0x16')](_0x1b7b8c);}return null;};}function patchUpdates(_0x47098c){return function(_0x34f4bc){try{jsonpatch[_0xe972('0x1c')](_0x34f4bc,_0x47098c,!![]);}catch(_0x124b3b){return BPromise[_0xe972('0x1d')](_0x124b3b);}return _0x34f4bc[_0xe972('0x1e')]();};}function saveUpdates(_0x53c4c2,_0x40ba16){return function(_0x5c7221){if(_0x5c7221){return _0x5c7221[_0xe972('0x1f')](_0x53c4c2)[_0xe972('0x20')](function(_0x5a574e){return _0x5a574e;});}return null;};}function removeEntity(_0x416873,_0x1a02be){return function(_0x1a1043){if(_0x1a1043){return _0x1a1043[_0xe972('0x21')]()['then'](function(){_0x416873[_0xe972('0x14')](0xcc)[_0xe972('0x15')]();});}};}function handleEntityNotFound(_0x1c4987,_0xfc28f1){return function(_0x2bffae){if(!_0x2bffae){_0x1c4987['sendStatus'](0x194);}return _0x2bffae;};}function handleError(_0x249b57,_0x5b8c62){_0x5b8c62=_0x5b8c62||0x1f4;return function(_0x539759){logger[_0xe972('0x22')](_0x539759[_0xe972('0x23')]);if(_0x539759[_0xe972('0x24')]){delete _0x539759['name'];}_0x249b57[_0xe972('0x14')](_0x5b8c62)[_0xe972('0x25')](_0x539759);};}exports[_0xe972('0x26')]=function(_0x5b5f31,_0x362ab1){var _0x1cf823={},_0x53c61f={},_0x46c030={'count':0x0,'rows':[]};var _0x1a7c90=_[_0xe972('0x27')](db[_0xe972('0x28')][_0xe972('0x29')],function(_0x16dbb5){return{'name':_0x16dbb5['fieldName'],'type':_0x16dbb5[_0xe972('0x2a')][_0xe972('0x2b')]};});_0x53c61f[_0xe972('0x2c')]=_[_0xe972('0x27')](_0x1a7c90,_0xe972('0x24'));_0x53c61f[_0xe972('0x2d')]=_[_0xe972('0x2e')](_0x5b5f31[_0xe972('0x2d')]);_0x53c61f[_0xe972('0x2f')]=_[_0xe972('0x30')](_0x53c61f[_0xe972('0x2c')],_0x53c61f[_0xe972('0x2d')]);_0x1cf823[_0xe972('0x31')]=_[_0xe972('0x30')](_0x53c61f[_0xe972('0x2c')],qs[_0xe972('0x32')](_0x5b5f31[_0xe972('0x2d')][_0xe972('0x32')]));_0x1cf823[_0xe972('0x31')]=_0x1cf823[_0xe972('0x31')][_0xe972('0x33')]?_0x1cf823[_0xe972('0x31')]:_0x53c61f[_0xe972('0x2c')];if(!_0x5b5f31['query'][_0xe972('0x34')]('nolimit')){_0x1cf823['limit']=qs[_0xe972('0x19')](_0x5b5f31[_0xe972('0x2d')][_0xe972('0x19')]);_0x1cf823[_0xe972('0x17')]=qs['offset'](_0x5b5f31[_0xe972('0x2d')][_0xe972('0x17')]);}_0x1cf823[_0xe972('0x35')]=qs[_0xe972('0x36')](_0x5b5f31[_0xe972('0x2d')][_0xe972('0x36')]);_0x1cf823['where']=qs['filters'](_[_0xe972('0x37')](_0x5b5f31[_0xe972('0x2d')],_0x53c61f[_0xe972('0x2f')]),_0x1a7c90);if(_0x5b5f31[_0xe972('0x2d')]['filter']){_0x1cf823['where']=_[_0xe972('0x38')](_0x1cf823[_0xe972('0x39')],{'$or':_['map'](_0x1a7c90,function(_0x570fbd){if(_0x570fbd[_0xe972('0x2a')]!==_0xe972('0x3a')){var _0x2bfc2b={};_0x2bfc2b[_0x570fbd[_0xe972('0x24')]]={'$like':'%'+_0x5b5f31[_0xe972('0x2d')][_0xe972('0x3b')]+'%'};return _0x2bfc2b;}})});}_0x1cf823=_[_0xe972('0x38')]({},_0x1cf823,_0x5b5f31[_0xe972('0x3c')]);var _0x13581a={'where':_0x1cf823[_0xe972('0x39')]};return db['VoiceDialReport'][_0xe972('0x1a')](_0x13581a)['then'](function(_0x36bcd0){_0x46c030['count']=_0x36bcd0;if(_0x5b5f31['query']['includeAll']){_0x1cf823['include']=[{'all':!![]}];}return db[_0xe972('0x28')][_0xe972('0x3d')](_0x1cf823);})['then'](function(_0x1b739c){_0x46c030[_0xe972('0x3e')]=_0x1b739c;return _0x46c030;})[_0xe972('0x20')](respondWithFilteredResult(_0x362ab1,_0x1cf823))[_0xe972('0x3f')](handleError(_0x362ab1,null));};exports[_0xe972('0x40')]=function(_0x28109,_0x18dda1){var _0x5d666b={'raw':!![],'where':{'id':_0x28109['params']['id']}},_0x3bb521={};_0x3bb521['model']=_['keys'](db[_0xe972('0x28')][_0xe972('0x29')]);_0x3bb521[_0xe972('0x2d')]=_[_0xe972('0x2e')](_0x28109['query']);_0x3bb521[_0xe972('0x2f')]=_[_0xe972('0x30')](_0x3bb521['model'],_0x3bb521['query']);_0x5d666b[_0xe972('0x31')]=_['intersection'](_0x3bb521[_0xe972('0x2c')],qs['fields'](_0x28109['query'][_0xe972('0x32')]));_0x5d666b['attributes']=_0x5d666b[_0xe972('0x31')][_0xe972('0x33')]?_0x5d666b[_0xe972('0x31')]:_0x3bb521[_0xe972('0x2c')];if(_0x28109[_0xe972('0x2d')][_0xe972('0x41')]){_0x5d666b['include']=[{'all':!![]}];}_0x5d666b=_[_0xe972('0x38')]({},_0x5d666b,_0x28109[_0xe972('0x3c')]);return db[_0xe972('0x28')][_0xe972('0x42')](_0x5d666b)[_0xe972('0x20')](handleEntityNotFound(_0x18dda1,null))[_0xe972('0x20')](respondWithResult(_0x18dda1,null))[_0xe972('0x3f')](handleError(_0x18dda1,null));};exports[_0xe972('0x43')]=function(_0x1e1c64,_0x8197df){return db['VoiceDialReport'][_0xe972('0x43')](_0x1e1c64[_0xe972('0x44')],{})[_0xe972('0x20')](respondWithResult(_0x8197df,0xc9))[_0xe972('0x3f')](handleError(_0x8197df,null));};exports[_0xe972('0x1f')]=function(_0x4221b3,_0xc56d0f){if(_0x4221b3[_0xe972('0x44')]['id']){delete _0x4221b3[_0xe972('0x44')]['id'];}return db[_0xe972('0x28')][_0xe972('0x42')]({'where':{'id':_0x4221b3[_0xe972('0x45')]['id']}})[_0xe972('0x20')](handleEntityNotFound(_0xc56d0f,null))[_0xe972('0x20')](saveUpdates(_0x4221b3[_0xe972('0x44')],null))[_0xe972('0x20')](respondWithResult(_0xc56d0f,null))['catch'](handleError(_0xc56d0f,null));};exports[_0xe972('0x21')]=function(_0x24d180,_0x524a34){return db['VoiceDialReport'][_0xe972('0x42')]({'where':{'id':_0x24d180['params']['id']}})[_0xe972('0x20')](handleEntityNotFound(_0x524a34,null))[_0xe972('0x20')](removeEntity(_0x524a34,null))['catch'](handleError(_0x524a34,null));};exports[_0xe972('0x46')]=function(_0x2067d7,_0x9385bd){return db[_0xe972('0x28')][_0xe972('0x46')]()[_0xe972('0x20')](respondWithResult(_0x9385bd,null))['catch'](handleError(_0x9385bd,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3bb92b6..8f06771 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 _0x4202=['request-promise','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','bluebird'];(function(_0x284d70,_0x4e5330){var _0x5a40f8=function(_0x5507e7){while(--_0x5507e7){_0x284d70['push'](_0x284d70['shift']());}};_0x5a40f8(++_0x4e5330);}(_0x4202,0x8c));var _0x2420=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x4202[_0x835cb7];return _0x3ef599;};'use strict';var _=require(_0x2420('0x0'));var util=require(_0x2420('0x1'));var logger=require('../../config/logger')(_0x2420('0x2'));var moment=require('moment');var BPromise=require(_0x2420('0x3'));var rp=require(_0x2420('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2420('0x5'));var config=require(_0x2420('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x2420('0x7')]=function(_0x322420,_0x582361){return _0x322420[_0x2420('0x8')](_0x2420('0x9'),attributes,{'tableName':_0x2420('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2420('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d55=['./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x5434b2,_0x1165e4){var _0x529056=function(_0x3a8c9b){while(--_0x3a8c9b){_0x5434b2['push'](_0x5434b2['shift']());}};_0x529056(++_0x1165e4);}(_0x7d55,0x1bc));var _0x57d5=function(_0x2ac4dc,_0x24eb29){_0x2ac4dc=_0x2ac4dc-0x0;var _0x157506=_0x7d55[_0x2ac4dc];return _0x157506;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var logger=require(_0x57d5('0x2'))(_0x57d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57d5('0x4'));var fs=require('fs');var path=require(_0x57d5('0x5'));var rimraf=require(_0x57d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d5('0x7'));module[_0x57d5('0x8')]=function(_0x15c349,_0x30fcfe){return _0x15c349[_0x57d5('0x9')](_0x57d5('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 e0f34b5..d0ca751 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 _0x24ec=['VoiceDialReport','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x32c98a,_0x5e6eb0){var _0x1796d3=function(_0x560640){while(--_0x560640){_0x32c98a['push'](_0x32c98a['shift']());}};_0x1796d3(++_0x5e6eb0);}(_0x24ec,0x64));var _0xc24e=function(_0x2febc2,_0x2245ea){_0x2febc2=_0x2febc2-0x0;var _0x41c10f=_0x24ec[_0x2febc2];return _0x41c10f;};'use strict';var _=require(_0xc24e('0x0'));var util=require(_0xc24e('0x1'));var moment=require('moment');var BPromise=require(_0xc24e('0x2'));var rs=require(_0xc24e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc24e('0x4'))['db'];var utils=require(_0xc24e('0x5'));var logger=require(_0xc24e('0x6'))(_0xc24e('0x7'));var config=require(_0xc24e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc24e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x529610,_0x3e8ab8,_0x7f741e){return new BPromise(function(_0x3b069e,_0x4978ad){return client[_0xc24e('0xa')](_0x529610,_0x7f741e)[_0xc24e('0xb')](function(_0x5bc83b){logger[_0xc24e('0xc')](_0xc24e('0xd'),_0x3e8ab8,'request\x20sent');logger[_0xc24e('0xe')](_0xc24e('0xf'),_0x3e8ab8,'request\x20sent',JSON[_0xc24e('0x10')](_0x5bc83b));if(_0x5bc83b[_0xc24e('0x11')]){if(_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x12')]===0x1f4){logger[_0xc24e('0x11')](_0xc24e('0xd'),_0x3e8ab8,_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x13')]);return _0x4978ad(_0x5bc83b['error'][_0xc24e('0x13')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3e8ab8,_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x13')]);return _0x3b069e(_0x5bc83b['error'][_0xc24e('0x13')]);}else{logger[_0xc24e('0xc')](_0xc24e('0xd'),_0x3e8ab8,'request\x20sent');_0x3b069e(_0x5bc83b['result'][_0xc24e('0x13')]);}})['catch'](function(_0x17de30){logger[_0xc24e('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3e8ab8,_0x17de30);_0x4978ad(_0x17de30);});});}exports['CreateVoiceDialReport']=function(_0x5ee1c6){var _0x56d045=this;return new Promise(function(_0x2bd5d6,_0x598a15){return db[_0xc24e('0x14')]['create'](_0x5ee1c6[_0xc24e('0x15')],{'raw':_0x5ee1c6[_0xc24e('0x16')]?_0x5ee1c6[_0xc24e('0x16')][_0xc24e('0x17')]===undefined?!![]:![]:!![]})[_0xc24e('0xb')](function(_0x3b9885){logger[_0xc24e('0xc')]('CreateVoiceDialReport',_0x5ee1c6);logger[_0xc24e('0xe')](_0xc24e('0x18'),_0x5ee1c6,JSON['stringify'](_0x3b9885));_0x2bd5d6(_0x3b9885);})[_0xc24e('0x19')](function(_0x265f96){logger[_0xc24e('0x11')](_0xc24e('0x18'),_0x265f96[_0xc24e('0x13')],_0x5ee1c6);_0x598a15(_0x56d045[_0xc24e('0x11')](0x1f4,_0x265f96['message']));});});};exports[_0xc24e('0x1a')]=function(_0x15e1f2){var _0x47e03e=this;return new Promise(function(_0x1f8fe3,_0x2637c3){return db[_0xc24e('0x14')][_0xc24e('0x1b')](_0x15e1f2[_0xc24e('0x15')],{'raw':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')]['where']||null:null,'attributes':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x1c')]||null:null,'limit':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x1d')]||null:null})[_0xc24e('0xb')](function(_0x1e83f3){logger[_0xc24e('0xc')](_0xc24e('0x1a'),_0x15e1f2);logger[_0xc24e('0xe')](_0xc24e('0x1a'),_0x15e1f2,JSON[_0xc24e('0x10')](_0x1e83f3));_0x1f8fe3(_0x1e83f3);})[_0xc24e('0x19')](function(_0x24f5c3){logger[_0xc24e('0x11')](_0xc24e('0x1a'),_0x24f5c3[_0xc24e('0x13')],_0x15e1f2);_0x2637c3(_0x47e03e[_0xc24e('0x11')](0x1f4,_0x24f5c3[_0xc24e('0x13')]));});});}; \ No newline at end of file +var _0x5a9c=['attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where'];(function(_0x4ea3db,_0x511e7c){var _0x5328ac=function(_0x20ac2e){while(--_0x20ac2e){_0x4ea3db['push'](_0x4ea3db['shift']());}};_0x5328ac(++_0x511e7c);}(_0x5a9c,0x176));var _0xc5a9=function(_0x5793c2,_0x27f5d9){_0x5793c2=_0x5793c2-0x0;var _0xf89c7=_0x5a9c[_0x5793c2];return _0xf89c7;};'use strict';var _=require(_0xc5a9('0x0'));var util=require(_0xc5a9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc5a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5a9('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc5a9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xc5a9('0x5')][_0xc5a9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19c401,_0x137fb6,_0x574642){return new BPromise(function(_0x551c36,_0x453dec){return client[_0xc5a9('0x7')](_0x19c401,_0x574642)[_0xc5a9('0x8')](function(_0xd2cac){logger[_0xc5a9('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x137fb6,_0xc5a9('0xa'));logger[_0xc5a9('0xb')](_0xc5a9('0xc'),_0x137fb6,_0xc5a9('0xa'),JSON[_0xc5a9('0xd')](_0xd2cac));if(_0xd2cac[_0xc5a9('0xe')]){if(_0xd2cac[_0xc5a9('0xe')][_0xc5a9('0xf')]===0x1f4){logger[_0xc5a9('0xe')](_0xc5a9('0x10'),_0x137fb6,_0xd2cac[_0xc5a9('0xe')][_0xc5a9('0x11')]);return _0x453dec(_0xd2cac[_0xc5a9('0xe')][_0xc5a9('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x137fb6,_0xd2cac[_0xc5a9('0xe')][_0xc5a9('0x11')]);return _0x551c36(_0xd2cac['error']['message']);}else{logger[_0xc5a9('0x9')](_0xc5a9('0x10'),_0x137fb6,_0xc5a9('0xa'));_0x551c36(_0xd2cac[_0xc5a9('0x12')][_0xc5a9('0x11')]);}})[_0xc5a9('0x13')](function(_0x4d4561){logger['error'](_0xc5a9('0x10'),_0x137fb6,_0x4d4561);_0x453dec(_0x4d4561);});});}exports[_0xc5a9('0x14')]=function(_0x41b111){var _0x498add=this;return new Promise(function(_0x194247,_0xc89ef2){return db['VoiceDialReport'][_0xc5a9('0x15')](_0x41b111[_0xc5a9('0x16')],{'raw':_0x41b111[_0xc5a9('0x17')]?_0x41b111[_0xc5a9('0x17')][_0xc5a9('0x18')]===undefined?!![]:![]:!![]})[_0xc5a9('0x8')](function(_0x432838){logger['info']('CreateVoiceDialReport',_0x41b111);logger['debug'](_0xc5a9('0x14'),_0x41b111,JSON[_0xc5a9('0xd')](_0x432838));_0x194247(_0x432838);})[_0xc5a9('0x13')](function(_0x5996c4){logger[_0xc5a9('0xe')](_0xc5a9('0x14'),_0x5996c4[_0xc5a9('0x11')],_0x41b111);_0xc89ef2(_0x498add[_0xc5a9('0xe')](0x1f4,_0x5996c4[_0xc5a9('0x11')]));});});};exports[_0xc5a9('0x19')]=function(_0x4b9b8c){var _0x1f8f7b=this;return new Promise(function(_0x28ca13,_0x1ead4a){return db[_0xc5a9('0x1a')][_0xc5a9('0x1b')](_0x4b9b8c[_0xc5a9('0x16')],{'raw':_0x4b9b8c['options']?_0x4b9b8c[_0xc5a9('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b9b8c[_0xc5a9('0x17')]?_0x4b9b8c[_0xc5a9('0x17')][_0xc5a9('0x1c')]||null:null,'attributes':_0x4b9b8c[_0xc5a9('0x17')]?_0x4b9b8c[_0xc5a9('0x17')][_0xc5a9('0x1d')]||null:null,'limit':_0x4b9b8c[_0xc5a9('0x17')]?_0x4b9b8c[_0xc5a9('0x17')][_0xc5a9('0x1e')]||null:null})[_0xc5a9('0x8')](function(_0x304156){logger['info'](_0xc5a9('0x19'),_0x4b9b8c);logger[_0xc5a9('0xb')](_0xc5a9('0x19'),_0x4b9b8c,JSON['stringify'](_0x304156));_0x28ca13(_0x304156);})[_0xc5a9('0x13')](function(_0x418df7){logger['error'](_0xc5a9('0x19'),_0x418df7[_0xc5a9('0x11')],_0x4b9b8c);_0x1ead4a(_0x1f8f7b[_0xc5a9('0xe')](0x1f4,_0x418df7[_0xc5a9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9ee8911..12164a5 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 _0x5ee6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','multer'];(function(_0x4bcbe1,_0x4575fc){var _0x4d9bb3=function(_0x5a1593){while(--_0x5a1593){_0x4bcbe1['push'](_0x4bcbe1['shift']());}};_0x4d9bb3(++_0x4575fc);}(_0x5ee6,0x1f3));var _0x65ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ee6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x65ee('0x0'));var util=require(_0x65ee('0x1'));var path=require(_0x65ee('0x2'));var timeout=require(_0x65ee('0x3'));var express=require('express');var router=express[_0x65ee('0x4')]();var fs_extra=require(_0x65ee('0x5'));var auth=require(_0x65ee('0x6'));var interaction=require(_0x65ee('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x65ee('0x8')]('/',auth[_0x65ee('0x9')](),controller[_0x65ee('0xa')]);router[_0x65ee('0x8')](_0x65ee('0xb'),auth[_0x65ee('0x9')](),controller[_0x65ee('0xc')]);router[_0x65ee('0xd')]('/',auth[_0x65ee('0x9')](),controller[_0x65ee('0xe')]);router[_0x65ee('0xd')](_0x65ee('0xf'),auth[_0x65ee('0x9')](),controller[_0x65ee('0x10')]);router[_0x65ee('0x11')](_0x65ee('0xb'),auth[_0x65ee('0x9')](),controller['update']);router[_0x65ee('0x12')](_0x65ee('0xb'),auth['isAuthenticated'](),controller[_0x65ee('0x13')]);module['exports']=router; \ No newline at end of file +var _0x291d=['get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','put','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0x5a5c7a,_0x15a886){var _0x51d347=function(_0x21b4d7){while(--_0x21b4d7){_0x5a5c7a['push'](_0x5a5c7a['shift']());}};_0x51d347(++_0x15a886);}(_0x291d,0xb5));var _0xd291=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x291d[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xd291('0x0'));var util=require(_0xd291('0x1'));var path=require(_0xd291('0x2'));var timeout=require(_0xd291('0x3'));var express=require('express');var router=express[_0xd291('0x4')]();var fs_extra=require(_0xd291('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd291('0x6'));var config=require(_0xd291('0x7'));var controller=require(_0xd291('0x8'));router[_0xd291('0x9')]('/',auth[_0xd291('0xa')](),controller[_0xd291('0xb')]);router[_0xd291('0x9')](_0xd291('0xc'),auth[_0xd291('0xa')](),controller['show']);router[_0xd291('0xd')]('/',auth[_0xd291('0xa')](),controller[_0xd291('0xe')]);router[_0xd291('0xd')](_0xd291('0xf'),auth[_0xd291('0xa')](),controller[_0xd291('0x10')]);router[_0xd291('0x11')]('/:id',auth[_0xd291('0xa')](),controller['update']);router['delete'](_0xd291('0xc'),auth['isAuthenticated'](),controller[_0xd291('0x12')]);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 0365f66..70d2de1 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 _0x34cf=['wav','VIRTUAL','exten','exports','STRING','compositeIndex','ENUM','inbound','outbound','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x3328ac,_0x28f068){var _0x5c729e=function(_0x1866e7){while(--_0x1866e7){_0x3328ac['push'](_0x3328ac['shift']());}};_0x5c729e(++_0x28f068);}(_0x34cf,0xc6));var _0xf34c=function(_0x4a11e0,_0x5d9cad){_0x4a11e0=_0x4a11e0-0x0;var _0x2db0ee=_0x34cf[_0x4a11e0];return _0x2db0ee;};'use strict';var Sequelize=require('sequelize');module[_0xf34c('0x0')]={'context':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'unique':_0xf34c('0x2')},'priority':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xf34c('0x2')},'tag':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf34c('0x3')](_0xf34c('0x4'),_0xf34c('0x5'),'internal',_0xf34c('0x6'),'outbound-fax',_0xf34c('0x7'),_0xf34c('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xf34c('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf34c('0x9')},'IntervalId':{'type':Sequelize[_0xf34c('0xa')]},'isApp':{'type':Sequelize[_0xf34c('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf34c('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xf34c('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf34c('0xa')]},'recordingFormat':{'type':Sequelize[_0xf34c('0x1')],'defaultValue':_0xf34c('0xc')},'answer':{'type':Sequelize[_0xf34c('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf34c('0xd')],'get':function(_0x226bd5){return this['getDataValue'](_0xf34c('0xe'));}},'alias':{'type':Sequelize[_0xf34c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8b3e=['exten','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav'];(function(_0x4d602e,_0x4b2d5b){var _0x140b40=function(_0x2100b4){while(--_0x2100b4){_0x4d602e['push'](_0x4d602e['shift']());}};_0x140b40(++_0x4b2d5b);}(_0x8b3e,0x10b));var _0xe8b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b3e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':![],'unique':_0xe8b3('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe8b3('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe8b3('0x3')](_0xe8b3('0x4'),_0xe8b3('0x5'),'internal',_0xe8b3('0x6'),_0xe8b3('0x7'),'system',_0xe8b3('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xe8b3('0x0')]},'interval':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':![],'defaultValue':_0xe8b3('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xe8b3('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe8b3('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe8b3('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe8b3('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xe8b3('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4f963e){return this['getDataValue'](_0xe8b3('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 259260c..2714e93 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 _0xc820=['ignore','map','includes','find','value','type','name','UserProfileResource','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','alias','sequelize','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','destroy','then','OutboundRoutes','outbound','InternalRoutes','internal'];(function(_0x707c3,_0x3c7ca1){var _0x35a6cb=function(_0xa26127){while(--_0xa26127){_0x707c3['push'](_0x707c3['shift']());}};_0x35a6cb(++_0x3c7ca1);}(_0xc820,0x97));var _0x0c82=function(_0x79d61b,_0x6a19fc){_0x79d61b=_0x79d61b-0x0;var _0x47cdf7=_0xc820[_0x79d61b];return _0x47cdf7;};'use strict';var _=require(_0x0c82('0x0'));var Redis=require(_0x0c82('0x1'));var qs=require(_0x0c82('0x2'));var logger=require('../../config/logger')(_0x0c82('0x3'));var config=require(_0x0c82('0x4'));var db=require(_0x0c82('0x5'))['db'];config[_0x0c82('0x6')]=_['defaults'](config[_0x0c82('0x6')],{'host':_0x0c82('0x7'),'port':0x18eb});var socket=require(_0x0c82('0x8'))(new Redis(config[_0x0c82('0x6')]));require('./voiceExtension.socket')[_0x0c82('0x9')](socket);function respondWithStatusCode(_0x14eadf,_0x201e91){_0x201e91=_0x201e91||0xcc;return function(_0x3de4ab){if(_0x3de4ab){return _0x14eadf[_0x0c82('0xa')](_0x201e91);}return _0x14eadf[_0x0c82('0xb')](_0x201e91)[_0x0c82('0xc')]();};}function respondWithResult(_0x37d62e,_0x35a4d6){_0x35a4d6=_0x35a4d6||0xc8;return function(_0x37add6){if(_0x37add6){return _0x37d62e[_0x0c82('0xb')](_0x35a4d6)['json'](_0x37add6);}};}function respondWithFilteredResult(_0xdc85fa,_0x46121c){return function(_0x46c307){if(_0x46c307){var _0x254350=typeof _0x46121c[_0x0c82('0xd')]===_0x0c82('0xe')&&typeof _0x46121c['limit']===_0x0c82('0xe');var _0x276d8f=_0x46c307[_0x0c82('0xf')];var _0x41d8af=_0x254350?0x0:_0x46121c[_0x0c82('0xd')];var _0x3a4c44=_0x254350?_0x46c307[_0x0c82('0xf')]:_0x46121c[_0x0c82('0xd')]+_0x46121c[_0x0c82('0x10')];var _0x29ec96;if(_0x3a4c44>=_0x276d8f){_0x3a4c44=_0x276d8f;_0x29ec96=0xc8;}else{_0x29ec96=0xce;}_0xdc85fa[_0x0c82('0xb')](_0x29ec96);return _0xdc85fa['set'](_0x0c82('0x11'),_0x41d8af+'-'+_0x3a4c44+'/'+_0x276d8f)[_0x0c82('0x12')](_0x46c307);}return null;};}function removeEntity(_0xe3bb61){return function(_0x564482){if(_0x564482){return _0x564482[_0x0c82('0x13')]()[_0x0c82('0x14')](function(){var _0x42c558=_0x564482['get']({'plain':!![]});var _0xb7ac3f=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x0c82('0x15'),'value':_0x0c82('0x16'),'ignore':![]},{'name':_0x0c82('0x17'),'value':_0x0c82('0x18'),'ignore':![]}];var _0x506d6d=_(_0xb7ac3f)['filter'](_0x0c82('0x19'))[_0x0c82('0x1a')]('value')['value']();if(_[_0x0c82('0x1b')](_0x506d6d,_0x42c558['type'])){return;}var _0x4e7e97=_[_0x0c82('0x1c')](_0xb7ac3f,[_0x0c82('0x1d'),_0x42c558[_0x0c82('0x1e')]])[_0x0c82('0x1f')];return db[_0x0c82('0x20')][_0x0c82('0x13')]({'where':{'type':_0x4e7e97,'resourceId':_0x42c558['id']}})['then'](function(){return _0x564482;});})[_0x0c82('0x14')](function(){_0xe3bb61[_0x0c82('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58643e){return function(_0x1721a9){if(!_0x1721a9){_0x58643e[_0x0c82('0xa')](0x194);}return _0x1721a9;};}function handleError(_0x373001,_0x475b20){_0x475b20=_0x475b20||0x1f4;return function(_0x26da58){logger['error'](_0x26da58['stack']);if(_0x26da58[_0x0c82('0x1f')]){delete _0x26da58[_0x0c82('0x1f')];}_0x373001['status'](_0x475b20)[_0x0c82('0x21')](_0x26da58);};}exports[_0x0c82('0x22')]=function(_0x479323,_0xcaa8c8){var _0x342164={},_0x2fa8c4={},_0x451024={'count':0x0,'rows':[]};var _0x4b6ed3=_[_0x0c82('0x1a')](db[_0x0c82('0x23')][_0x0c82('0x24')],function(_0x5ee6d0){return{'name':_0x5ee6d0[_0x0c82('0x25')],'type':_0x5ee6d0[_0x0c82('0x1e')][_0x0c82('0x26')]};});_0x2fa8c4[_0x0c82('0x27')]=_[_0x0c82('0x1a')](_0x4b6ed3,_0x0c82('0x1f'));_0x2fa8c4[_0x0c82('0x28')]=_[_0x0c82('0x29')](_0x479323['query']);_0x2fa8c4['filters']=_[_0x0c82('0x2a')](_0x2fa8c4[_0x0c82('0x27')],_0x2fa8c4[_0x0c82('0x28')]);_0x342164['attributes']=_[_0x0c82('0x2a')](_0x2fa8c4[_0x0c82('0x27')],qs[_0x0c82('0x2b')](_0x479323[_0x0c82('0x28')][_0x0c82('0x2b')]));_0x342164['attributes']=_0x342164[_0x0c82('0x2c')][_0x0c82('0x2d')]?_0x342164['attributes']:_0x2fa8c4[_0x0c82('0x27')];if(!_0x479323['query'][_0x0c82('0x2e')](_0x0c82('0x2f'))){_0x342164[_0x0c82('0x10')]=qs[_0x0c82('0x10')](_0x479323[_0x0c82('0x28')][_0x0c82('0x10')]);_0x342164[_0x0c82('0xd')]=qs['offset'](_0x479323[_0x0c82('0x28')][_0x0c82('0xd')]);}_0x342164['order']=qs[_0x0c82('0x30')](_0x479323[_0x0c82('0x28')][_0x0c82('0x30')]);_0x342164[_0x0c82('0x31')]=qs[_0x0c82('0x32')](_['pick'](_0x479323['query'],_0x2fa8c4['filters']),_0x4b6ed3);if(_0x479323['query'][_0x0c82('0x33')]){_0x342164[_0x0c82('0x31')]=_[_0x0c82('0x34')](_0x342164[_0x0c82('0x31')],{'$or':_[_0x0c82('0x1a')](_0x4b6ed3,function(_0x15e135){if(_0x15e135[_0x0c82('0x1e')]!==_0x0c82('0x35')){var _0xd501d7={};_0xd501d7[_0x15e135[_0x0c82('0x1f')]]={'$like':'%'+_0x479323[_0x0c82('0x28')][_0x0c82('0x33')]+'%'};return _0xd501d7;}})});}_0x342164=_[_0x0c82('0x34')]({},_0x342164,_0x479323[_0x0c82('0x36')]);var _0x46cac6={'where':_0x342164[_0x0c82('0x31')]};return db[_0x0c82('0x23')][_0x0c82('0xf')](_0x46cac6)['then'](function(_0x2737b7){_0x451024[_0x0c82('0xf')]=_0x2737b7;if(_0x479323[_0x0c82('0x28')][_0x0c82('0x37')]){_0x342164[_0x0c82('0x38')]=[{'all':!![]}];}return db[_0x0c82('0x23')][_0x0c82('0x39')](_0x342164);})[_0x0c82('0x14')](function(_0x3db4d1){_0x451024[_0x0c82('0x3a')]=_0x3db4d1;return _0x451024;})[_0x0c82('0x14')](respondWithFilteredResult(_0xcaa8c8,_0x342164))[_0x0c82('0x3b')](handleError(_0xcaa8c8,null));};exports[_0x0c82('0x3c')]=function(_0x2f91c5,_0x2604da){var _0x5d7213={'raw':![],'where':{'id':_0x2f91c5[_0x0c82('0x3d')]['id']}},_0x349e5b={};_0x349e5b[_0x0c82('0x27')]=_[_0x0c82('0x29')](db[_0x0c82('0x23')]['rawAttributes']);_0x349e5b['query']=_[_0x0c82('0x29')](_0x2f91c5[_0x0c82('0x28')]);_0x349e5b[_0x0c82('0x32')]=_[_0x0c82('0x2a')](_0x349e5b[_0x0c82('0x27')],_0x349e5b[_0x0c82('0x28')]);_0x5d7213[_0x0c82('0x2c')]=_[_0x0c82('0x2a')](_0x349e5b[_0x0c82('0x27')],qs[_0x0c82('0x2b')](_0x2f91c5[_0x0c82('0x28')][_0x0c82('0x2b')]));_0x5d7213['attributes']=_0x5d7213[_0x0c82('0x2c')][_0x0c82('0x2d')]?_0x5d7213[_0x0c82('0x2c')]:_0x349e5b[_0x0c82('0x27')];if(_0x2f91c5[_0x0c82('0x28')][_0x0c82('0x37')]){_0x5d7213[_0x0c82('0x38')]=[{'all':!![]}];}_0x5d7213=_[_0x0c82('0x34')]({},_0x5d7213,_0x2f91c5[_0x0c82('0x36')]);return db[_0x0c82('0x23')][_0x0c82('0x1c')](_0x5d7213)['then'](handleEntityNotFound(_0x2604da,null))['then'](respondWithResult(_0x2604da,null))[_0x0c82('0x3b')](handleError(_0x2604da,null));};exports[_0x0c82('0x13')]=function(_0x1428bd,_0x28ec4b){return db[_0x0c82('0x23')]['find']({'where':{'id':_0x1428bd[_0x0c82('0x3d')]['id']}})[_0x0c82('0x14')](handleEntityNotFound(_0x28ec4b,null))['then'](removeEntity(_0x28ec4b,null))[_0x0c82('0x3b')](handleError(_0x28ec4b,null));};exports[_0x0c82('0x3e')]=function(_0x40d785,_0x30acda){if(_0x40d785[_0x0c82('0x3f')][_0x0c82('0x1e')]===_0x0c82('0x16')&&!_[_0x0c82('0x40')](_0x40d785['body'][_0x0c82('0x41')],'_')){_0x40d785[_0x0c82('0x3f')][_0x0c82('0x41')]='_'[_0x0c82('0x42')](_0x40d785['body'][_0x0c82('0x41')]);}return db['VoiceExtension'][_0x0c82('0x3e')](_0x40d785[_0x0c82('0x3f')],{'raw':![]})[_0x0c82('0x14')](function(_0x5105f8){var _0x14d3f1=_0x40d785[_0x0c82('0x43')]['get']({'plain':!![]});if(!_0x14d3f1)throw new Error(_0x0c82('0x44'));if(_0x14d3f1[_0x0c82('0x45')]==='user'){var _0x46f09a=_0x5105f8[_0x0c82('0x46')]({'plain':!![]});var _0xf79f56=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x0c82('0x17'),'value':_0x0c82('0x18')}];var _0x33a2bc=_[_0x0c82('0x1c')](_0xf79f56,['value',_0x46f09a[_0x0c82('0x1e')]])['name'];return db[_0x0c82('0x47')]['find']({'where':{'name':_0x33a2bc,'userProfileId':_0x14d3f1[_0x0c82('0x48')]},'raw':!![]})[_0x0c82('0x14')](function(_0x5454e2){if(_0x5454e2&&_0x5454e2[_0x0c82('0x49')]===0x0){return db[_0x0c82('0x20')][_0x0c82('0x3e')]({'name':_0x46f09a[_0x0c82('0x1f')],'resourceId':_0x46f09a['id'],'type':_0x5454e2['name'],'sectionId':_0x5454e2['id']},{})['then'](function(){return _0x5105f8;});}else{return _0x5105f8;}})[_0x0c82('0x3b')](function(_0x455e4e){logger[_0x0c82('0x4a')](_0x0c82('0x4b'),_0x455e4e);throw _0x455e4e;});}return _0x5105f8;})[_0x0c82('0x14')](respondWithResult(_0x30acda,0xc9))['catch'](handleError(_0x30acda,null));};exports[_0x0c82('0x4c')]=function(_0x2ea98e,_0x2658e9){if(_0x2ea98e[_0x0c82('0x3f')]['id']){delete _0x2ea98e['body']['id'];}return db[_0x0c82('0x23')][_0x0c82('0x1c')]({'where':{'id':_0x2ea98e['params']['id']}})[_0x0c82('0x14')](handleEntityNotFound(_0x2658e9,null))[_0x0c82('0x14')](function(_0x101ca2){if(_0x101ca2){return db[_0x0c82('0x23')][_0x0c82('0x4c')](_[_0x0c82('0x4d')](_0x2ea98e['body'],[_0x0c82('0x41'),_0x0c82('0x4e'),'description',_0x0c82('0x4f'),_0x0c82('0x50'),'mandatoryDisposition',_0x0c82('0x51')]),{'where':{'context':_0x101ca2[_0x0c82('0x4e')],'exten':_0x101ca2['exten']},'individualHooks':!![]})[_0x0c82('0x14')](function(_0x26e42f){return _0x26e42f;});}return null;})['then'](respondWithStatusCode(_0x2658e9,null))[_0x0c82('0x3b')](handleError(_0x2658e9,null));};exports['addApplications']=function(_0x1c34ec,_0x630dfc){var _0x2a5649=_0x1c34ec['params']['id'];var _0x1515f6=_0x1c34ec[_0x0c82('0x3f')];var _0x4a8fd2=0xc8;var _0x1ef786=null;return db[_0x0c82('0x52')]['transaction']({'isolationLevel':db[_0x0c82('0x52')]['Transaction']['ISOLATION_LEVELS'][_0x0c82('0x53')]},function(_0x17db8a){return db[_0x0c82('0x23')]['findOne']({'where':{'id':_0x2a5649},'transaction':_0x17db8a})[_0x0c82('0x14')](function(_0x22bd45){if(_0x22bd45){return db[_0x0c82('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x2a5649},'transaction':_0x17db8a})[_0x0c82('0x14')](function(){var _0x3c05e8=_[_0x0c82('0x1a')](_0x1515f6,function(_0x583b2f){_0x583b2f[_0x0c82('0x54')]=_0x2a5649;_0x583b2f[_0x0c82('0x55')]=!![];return _0x583b2f;});return _0x22bd45[_0x0c82('0x56')](_0x3c05e8);})[_0x0c82('0x14')](function(_0x2b3d32){return db[_0x0c82('0x23')]['bulkCreate'](_0x2b3d32,{'transaction':_0x17db8a});});}else{_0x4a8fd2=0x194;_0x1ef786=[];}});})['then'](function(){if(_0x4a8fd2!==0x194){return db[_0x0c82('0x23')][_0x0c82('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2a5649},'order':'cast(priority\x20as\x20unsigned)'})[_0x0c82('0x14')](function(_0x534894){_0x1ef786=_0x534894;});}})['catch'](function(_0x4b0e69){_0x4a8fd2=0x1f4;logger[_0x0c82('0x4a')](_0x4b0e69['stack']);if(_0x4b0e69['name']){delete _0x4b0e69[_0x0c82('0x1f')];}_0x1ef786=_0x4b0e69;})['finally'](function(){if(_0x1ef786===null){_0x630dfc[_0x0c82('0xa')](_0x4a8fd2);}else{if(_0x4a8fd2===0x1f4){_0x630dfc[_0x0c82('0xb')](_0x4a8fd2)[_0x0c82('0x21')](_0x1ef786);}else{_0x630dfc[_0x0c82('0xb')](_0x4a8fd2)[_0x0c82('0x12')](_0x1ef786);}}});}; \ No newline at end of file +var _0xf9c7=['internal','ignore','map','value','includes','find','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','catch','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','localhost','redis','register','sendStatus','status','end','json','offset','undefined','count','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x34348b,_0x36571e){var _0xa7c5dd=function(_0x29ba7a){while(--_0x29ba7a){_0x34348b['push'](_0x34348b['shift']());}};_0xa7c5dd(++_0x36571e);}(_0xf9c7,0x1aa));var _0x7f9c=function(_0x21a3e5,_0xe6c66b){_0x21a3e5=_0x21a3e5-0x0;var _0x21d28d=_0xf9c7[_0x21a3e5];return _0x21d28d;};'use strict';var _=require(_0x7f9c('0x0'));var Redis=require('ioredis');var qs=require(_0x7f9c('0x1'));var logger=require(_0x7f9c('0x2'))(_0x7f9c('0x3'));var config=require(_0x7f9c('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7f9c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f9c('0x6')]));require('./voiceExtension.socket')[_0x7f9c('0x7')](socket);function respondWithStatusCode(_0x58c738,_0x15b24c){_0x15b24c=_0x15b24c||0xcc;return function(_0x50b75d){if(_0x50b75d){return _0x58c738[_0x7f9c('0x8')](_0x15b24c);}return _0x58c738[_0x7f9c('0x9')](_0x15b24c)[_0x7f9c('0xa')]();};}function respondWithResult(_0x184790,_0x43bb38){_0x43bb38=_0x43bb38||0xc8;return function(_0xbceb01){if(_0xbceb01){return _0x184790[_0x7f9c('0x9')](_0x43bb38)[_0x7f9c('0xb')](_0xbceb01);}};}function respondWithFilteredResult(_0x1d5dd6,_0x3d100f){return function(_0x4ffb93){if(_0x4ffb93){var _0x20aef5=typeof _0x3d100f[_0x7f9c('0xc')]===_0x7f9c('0xd')&&typeof _0x3d100f['limit']===_0x7f9c('0xd');var _0x5841d8=_0x4ffb93[_0x7f9c('0xe')];var _0x42fcca=_0x20aef5?0x0:_0x3d100f[_0x7f9c('0xc')];var _0x2c2c90=_0x20aef5?_0x4ffb93[_0x7f9c('0xe')]:_0x3d100f['offset']+_0x3d100f['limit'];var _0x116c46;if(_0x2c2c90>=_0x5841d8){_0x2c2c90=_0x5841d8;_0x116c46=0xc8;}else{_0x116c46=0xce;}_0x1d5dd6['status'](_0x116c46);return _0x1d5dd6[_0x7f9c('0xf')]('Content-Range',_0x42fcca+'-'+_0x2c2c90+'/'+_0x5841d8)[_0x7f9c('0xb')](_0x4ffb93);}return null;};}function removeEntity(_0x2ba309){return function(_0x258106){if(_0x258106){return _0x258106[_0x7f9c('0x10')]()[_0x7f9c('0x11')](function(){var _0x2af4f2=_0x258106[_0x7f9c('0x12')]({'plain':!![]});var _0x405347=[{'name':_0x7f9c('0x13'),'value':_0x7f9c('0x14'),'ignore':![]},{'name':_0x7f9c('0x15'),'value':_0x7f9c('0x16'),'ignore':![]},{'name':_0x7f9c('0x17'),'value':_0x7f9c('0x18'),'ignore':![]}];var _0x176f3f=_(_0x405347)['filter'](_0x7f9c('0x19'))[_0x7f9c('0x1a')](_0x7f9c('0x1b'))[_0x7f9c('0x1b')]();if(_[_0x7f9c('0x1c')](_0x176f3f,_0x2af4f2['type'])){return;}var _0x509a6d=_[_0x7f9c('0x1d')](_0x405347,[_0x7f9c('0x1b'),_0x2af4f2['type']])['name'];return db[_0x7f9c('0x1e')][_0x7f9c('0x10')]({'where':{'type':_0x509a6d,'resourceId':_0x2af4f2['id']}})[_0x7f9c('0x11')](function(){return _0x258106;});})[_0x7f9c('0x11')](function(){_0x2ba309[_0x7f9c('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x112693){return function(_0x4c2efe){if(!_0x4c2efe){_0x112693[_0x7f9c('0x8')](0x194);}return _0x4c2efe;};}function handleError(_0x321a7c,_0x19b7eb){_0x19b7eb=_0x19b7eb||0x1f4;return function(_0x28ee70){logger[_0x7f9c('0x1f')](_0x28ee70[_0x7f9c('0x20')]);if(_0x28ee70[_0x7f9c('0x21')]){delete _0x28ee70[_0x7f9c('0x21')];}_0x321a7c['status'](_0x19b7eb)[_0x7f9c('0x22')](_0x28ee70);};}exports[_0x7f9c('0x23')]=function(_0x1a63a3,_0x6a315d){var _0x50616c={},_0x2e74bb={},_0x547b26={'count':0x0,'rows':[]};var _0x5b5a4b=_[_0x7f9c('0x1a')](db[_0x7f9c('0x24')][_0x7f9c('0x25')],function(_0x4a2778){return{'name':_0x4a2778[_0x7f9c('0x26')],'type':_0x4a2778[_0x7f9c('0x27')][_0x7f9c('0x28')]};});_0x2e74bb[_0x7f9c('0x29')]=_['map'](_0x5b5a4b,_0x7f9c('0x21'));_0x2e74bb[_0x7f9c('0x2a')]=_[_0x7f9c('0x2b')](_0x1a63a3[_0x7f9c('0x2a')]);_0x2e74bb[_0x7f9c('0x2c')]=_[_0x7f9c('0x2d')](_0x2e74bb[_0x7f9c('0x29')],_0x2e74bb['query']);_0x50616c[_0x7f9c('0x2e')]=_[_0x7f9c('0x2d')](_0x2e74bb[_0x7f9c('0x29')],qs[_0x7f9c('0x2f')](_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0x2f')]));_0x50616c['attributes']=_0x50616c[_0x7f9c('0x2e')][_0x7f9c('0x30')]?_0x50616c['attributes']:_0x2e74bb[_0x7f9c('0x29')];if(!_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0x31')]('nolimit')){_0x50616c[_0x7f9c('0x32')]=qs[_0x7f9c('0x32')](_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0x32')]);_0x50616c[_0x7f9c('0xc')]=qs[_0x7f9c('0xc')](_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0xc')]);}_0x50616c['order']=qs['sort'](_0x1a63a3[_0x7f9c('0x2a')]['sort']);_0x50616c[_0x7f9c('0x33')]=qs['filters'](_[_0x7f9c('0x34')](_0x1a63a3[_0x7f9c('0x2a')],_0x2e74bb[_0x7f9c('0x2c')]),_0x5b5a4b);if(_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0x35')]){_0x50616c[_0x7f9c('0x33')]=_[_0x7f9c('0x36')](_0x50616c[_0x7f9c('0x33')],{'$or':_[_0x7f9c('0x1a')](_0x5b5a4b,function(_0x3ebc2d){if(_0x3ebc2d[_0x7f9c('0x27')]!==_0x7f9c('0x37')){var _0x1a6d66={};_0x1a6d66[_0x3ebc2d['name']]={'$like':'%'+_0x1a63a3[_0x7f9c('0x2a')]['filter']+'%'};return _0x1a6d66;}})});}_0x50616c=_[_0x7f9c('0x36')]({},_0x50616c,_0x1a63a3[_0x7f9c('0x38')]);var _0x35b2cf={'where':_0x50616c[_0x7f9c('0x33')]};return db[_0x7f9c('0x24')][_0x7f9c('0xe')](_0x35b2cf)['then'](function(_0x4b4424){_0x547b26['count']=_0x4b4424;if(_0x1a63a3[_0x7f9c('0x2a')][_0x7f9c('0x39')]){_0x50616c['include']=[{'all':!![]}];}return db[_0x7f9c('0x24')]['findAll'](_0x50616c);})[_0x7f9c('0x11')](function(_0x21e0cc){_0x547b26[_0x7f9c('0x3a')]=_0x21e0cc;return _0x547b26;})[_0x7f9c('0x11')](respondWithFilteredResult(_0x6a315d,_0x50616c))['catch'](handleError(_0x6a315d,null));};exports['show']=function(_0x4fd2f7,_0x4ae0a2){var _0x4cfca3={'raw':![],'where':{'id':_0x4fd2f7[_0x7f9c('0x3b')]['id']}},_0x57147c={};_0x57147c[_0x7f9c('0x29')]=_['keys'](db[_0x7f9c('0x24')][_0x7f9c('0x25')]);_0x57147c[_0x7f9c('0x2a')]=_[_0x7f9c('0x2b')](_0x4fd2f7[_0x7f9c('0x2a')]);_0x57147c[_0x7f9c('0x2c')]=_[_0x7f9c('0x2d')](_0x57147c[_0x7f9c('0x29')],_0x57147c[_0x7f9c('0x2a')]);_0x4cfca3['attributes']=_['intersection'](_0x57147c[_0x7f9c('0x29')],qs['fields'](_0x4fd2f7[_0x7f9c('0x2a')][_0x7f9c('0x2f')]));_0x4cfca3[_0x7f9c('0x2e')]=_0x4cfca3[_0x7f9c('0x2e')][_0x7f9c('0x30')]?_0x4cfca3['attributes']:_0x57147c[_0x7f9c('0x29')];if(_0x4fd2f7[_0x7f9c('0x2a')][_0x7f9c('0x39')]){_0x4cfca3[_0x7f9c('0x3c')]=[{'all':!![]}];}_0x4cfca3=_[_0x7f9c('0x36')]({},_0x4cfca3,_0x4fd2f7[_0x7f9c('0x38')]);return db[_0x7f9c('0x24')][_0x7f9c('0x1d')](_0x4cfca3)[_0x7f9c('0x11')](handleEntityNotFound(_0x4ae0a2,null))[_0x7f9c('0x11')](respondWithResult(_0x4ae0a2,null))[_0x7f9c('0x3d')](handleError(_0x4ae0a2,null));};exports[_0x7f9c('0x10')]=function(_0x117711,_0x53e221){return db['VoiceExtension'][_0x7f9c('0x1d')]({'where':{'id':_0x117711[_0x7f9c('0x3b')]['id']}})[_0x7f9c('0x11')](handleEntityNotFound(_0x53e221,null))[_0x7f9c('0x11')](removeEntity(_0x53e221,null))['catch'](handleError(_0x53e221,null));};exports['create']=function(_0x4ce4f2,_0x7a2a1d){if(_0x4ce4f2[_0x7f9c('0x3e')][_0x7f9c('0x27')]===_0x7f9c('0x16')&&!_[_0x7f9c('0x3f')](_0x4ce4f2['body'][_0x7f9c('0x40')],'_')){_0x4ce4f2[_0x7f9c('0x3e')][_0x7f9c('0x40')]='_'['concat'](_0x4ce4f2[_0x7f9c('0x3e')][_0x7f9c('0x40')]);}return db['VoiceExtension']['create'](_0x4ce4f2['body'],{'raw':![]})[_0x7f9c('0x11')](function(_0x3298dc){var _0x10eede=_0x4ce4f2['user']['get']({'plain':!![]});if(!_0x10eede)throw new Error(_0x7f9c('0x41'));if(_0x10eede[_0x7f9c('0x42')]==='user'){var _0x119e0e=_0x3298dc[_0x7f9c('0x12')]({'plain':!![]});var _0x4fccfb=[{'name':_0x7f9c('0x13'),'value':_0x7f9c('0x14')},{'name':'OutboundRoutes','value':'outbound'},{'name':'InternalRoutes','value':_0x7f9c('0x18')}];var _0x3bad3e=_[_0x7f9c('0x1d')](_0x4fccfb,[_0x7f9c('0x1b'),_0x119e0e[_0x7f9c('0x27')]])[_0x7f9c('0x21')];return db[_0x7f9c('0x43')]['find']({'where':{'name':_0x3bad3e,'userProfileId':_0x10eede[_0x7f9c('0x44')]},'raw':!![]})[_0x7f9c('0x11')](function(_0x532d96){if(_0x532d96&&_0x532d96[_0x7f9c('0x45')]===0x0){return db[_0x7f9c('0x1e')][_0x7f9c('0x46')]({'name':_0x119e0e[_0x7f9c('0x21')],'resourceId':_0x119e0e['id'],'type':_0x532d96[_0x7f9c('0x21')],'sectionId':_0x532d96['id']},{})[_0x7f9c('0x11')](function(){return _0x3298dc;});}else{return _0x3298dc;}})['catch'](function(_0x2bd62b){logger[_0x7f9c('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bd62b);throw _0x2bd62b;});}return _0x3298dc;})['then'](respondWithResult(_0x7a2a1d,0xc9))[_0x7f9c('0x3d')](handleError(_0x7a2a1d,null));};exports[_0x7f9c('0x47')]=function(_0x20d468,_0x392922){if(_0x20d468['body']['id']){delete _0x20d468[_0x7f9c('0x3e')]['id'];}return db['VoiceExtension'][_0x7f9c('0x1d')]({'where':{'id':_0x20d468['params']['id']}})[_0x7f9c('0x11')](handleEntityNotFound(_0x392922,null))[_0x7f9c('0x11')](function(_0x1a741d){if(_0x1a741d){return db[_0x7f9c('0x24')][_0x7f9c('0x47')](_[_0x7f9c('0x34')](_0x20d468['body'],['exten',_0x7f9c('0x48'),_0x7f9c('0x49'),_0x7f9c('0x4a'),_0x7f9c('0x4b'),'mandatoryDisposition',_0x7f9c('0x4c')]),{'where':{'context':_0x1a741d['context'],'exten':_0x1a741d[_0x7f9c('0x40')]},'individualHooks':!![]})[_0x7f9c('0x11')](function(_0x5e89f8){return _0x5e89f8;});}return null;})[_0x7f9c('0x11')](respondWithStatusCode(_0x392922,null))[_0x7f9c('0x3d')](handleError(_0x392922,null));};exports[_0x7f9c('0x4d')]=function(_0x33af7e,_0xe74932){var _0x10579d=_0x33af7e[_0x7f9c('0x3b')]['id'];var _0x167338=_0x33af7e[_0x7f9c('0x3e')];var _0x41c076=0xc8;var _0x2f93b0=null;return db[_0x7f9c('0x4e')][_0x7f9c('0x4f')]({'isolationLevel':db[_0x7f9c('0x4e')][_0x7f9c('0x50')][_0x7f9c('0x51')][_0x7f9c('0x52')]},function(_0x20817b){return db[_0x7f9c('0x24')][_0x7f9c('0x53')]({'where':{'id':_0x10579d},'transaction':_0x20817b})[_0x7f9c('0x11')](function(_0x4142af){if(_0x4142af){return db[_0x7f9c('0x24')][_0x7f9c('0x10')]({'where':{'VoiceExtensionId':_0x10579d},'transaction':_0x20817b})[_0x7f9c('0x11')](function(){var _0x37e5e5=_[_0x7f9c('0x1a')](_0x167338,function(_0x352e68){_0x352e68[_0x7f9c('0x54')]=_0x10579d;_0x352e68[_0x7f9c('0x55')]=!![];return _0x352e68;});return _0x4142af[_0x7f9c('0x56')](_0x37e5e5);})[_0x7f9c('0x11')](function(_0x4aea5e){return db[_0x7f9c('0x24')][_0x7f9c('0x57')](_0x4aea5e,{'transaction':_0x20817b});});}else{_0x41c076=0x194;_0x2f93b0=[];}});})[_0x7f9c('0x11')](function(){if(_0x41c076!==0x194){return db[_0x7f9c('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x10579d},'order':_0x7f9c('0x58')})[_0x7f9c('0x11')](function(_0x32ffd7){_0x2f93b0=_0x32ffd7;});}})[_0x7f9c('0x3d')](function(_0x52d3f9){_0x41c076=0x1f4;logger[_0x7f9c('0x1f')](_0x52d3f9[_0x7f9c('0x20')]);if(_0x52d3f9[_0x7f9c('0x21')]){delete _0x52d3f9[_0x7f9c('0x21')];}_0x2f93b0=_0x52d3f9;})[_0x7f9c('0x59')](function(){if(_0x2f93b0===null){_0xe74932[_0x7f9c('0x8')](_0x41c076);}else{if(_0x41c076===0x1f4){_0xe74932['status'](_0x41c076)['send'](_0x2f93b0);}else{_0xe74932[_0x7f9c('0x9')](_0x41c076)[_0x7f9c('0xb')](_0x2f93b0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cd26277..b77c685 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 _0x79e0=['VoiceExtension','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x79e0,0xd7));var _0x079e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x79e0[_0x5c9307];return _0x373e29;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x079e('0x0'))['db'][_0x079e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x079e('0x2')](0x0);var events={'afterCreate':_0x079e('0x3'),'afterUpdate':_0x079e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ec80d){return function(_0x58cda8,_0x23d7a7,_0x38244f){VoiceExtensionEvents[_0x079e('0x5')](_0x1ec80d+':'+_0x58cda8['id'],_0x58cda8);VoiceExtensionEvents[_0x079e('0x5')](_0x1ec80d,_0x58cda8);_0x38244f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x079e('0x6')](e,emitEvent(event));}}module[_0x079e('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x1e87=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5c62a3,_0x1b4f8d){var _0x1723cf=function(_0x4d110f){while(--_0x4d110f){_0x5c62a3['push'](_0x5c62a3['shift']());}};_0x1723cf(++_0x1b4f8d);}(_0x1e87,0x1b6));var _0x71e8=function(_0x327b49,_0xc232b8){_0x327b49=_0x327b49-0x0;var _0x4e7265=_0x1e87[_0x327b49];return _0x4e7265;};'use strict';var EventEmitter=require(_0x71e8('0x0'));var VoiceExtension=require(_0x71e8('0x1'))['db'][_0x71e8('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x71e8('0x3')](0x0);var events={'afterCreate':_0x71e8('0x4'),'afterUpdate':_0x71e8('0x5'),'afterDestroy':_0x71e8('0x6')};function emitEvent(_0x30eb30){return function(_0xbec88,_0x4d0c4d,_0x5776f6){VoiceExtensionEvents[_0x71e8('0x7')](_0x30eb30+':'+_0xbec88['id'],_0xbec88);VoiceExtensionEvents[_0x71e8('0x7')](_0x30eb30,_0xbec88);_0x5776f6(null);};}for(var e in events){if(events[_0x71e8('0x8')](e)){var event=events[e];VoiceExtension[_0x71e8('0x9')](e,emitEvent(event));}}module[_0x71e8('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 4ad0a80..33756dc 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 _0x0d64=['SIP','join','none','U(xcally-mixmonitor-context)','replace','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','length','name','trunk','param','phone','prefix','${EXTEN}'];(function(_0x490bd1,_0x1de391){var _0x2f38e3=function(_0x2e036e){while(--_0x2e036e){_0x490bd1['push'](_0x490bd1['shift']());}};_0x2f38e3(++_0x1de391);}(_0x0d64,0x77));var _0x40d6=function(_0x396583,_0x1049e3){_0x396583=_0x396583-0x0;var _0x3af08e=_0x0d64[_0x396583];return _0x3af08e;};'use strict';var _=require(_0x40d6('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x40d6('0x1')]=function(_0x24aa2e){var _0x48b4d9=_0x24aa2e[_0x40d6('0x2')];function _0x3f6845(_0x59340b){var _0x1c9abe=0x2;var _0xa5722b=[{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':_0x40d6('0x5')+_0x59340b[_0x40d6('0x3')],'context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x59340b[_0x40d6('0x8')]?_0x40d6('0x4'):_0x40d6('0x9'),'appdata':_0x59340b['alias']?'CDR(routeAlias)='+_0x59340b[_0x40d6('0x8')]:'No\x20alias\x20set','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']}];if(_0x59340b['type']===_0x40d6('0xa')){_0xa5722b['push']({'type':_0x40d6('0xa'),'app':'Set','appdata':'CDR(routeid)='+_0x59340b['id'],'context':_0x59340b['context'],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']});}_0xa5722b[_0x40d6('0xb')]({'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':_0x40d6('0xc'),'context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']});return _0xa5722b;}function _0x249e0c(_0x1d9be4){var _0x5866e9=0x2;var _0x4290d0=[{'type':_0x40d6('0xd'),'app':'Set','appdata':_0x40d6('0xe'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x1d9be4[_0x40d6('0x8')]?_0x40d6('0x4'):'NoOp','appdata':_0x1d9be4[_0x40d6('0x8')]?'CDR(routeAlias)='+_0x1d9be4[_0x40d6('0x8')]:_0x40d6('0xf'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'CDR(destination)='+(_0x1d9be4[_0x40d6('0x10')]?_0x40d6('0x11')+_0x1d9be4['cutdigits']+'}':'${EXTEN}'),'context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'CDR(routeid)='+_0x1d9be4['id'],'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x13')+(_0x5866e9+0x2)+'):Goto('+(_0x5866e9+0x1)+')','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x1d9be4[_0x40d6('0x10')]?_0x40d6('0x14')+_0x1d9be4['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x15'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':'outbound','app':'Set','appdata':_0x40d6('0x16'),'context':_0x1d9be4['context'],'exten':_0x1d9be4['exten'],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x17')+_0x1d9be4['id'],'context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']}];if(_0x1d9be4[_0x40d6('0x18')](_0x40d6('0x19'))&&_0x1d9be4[_0x40d6('0x19')]!=='none'){_0x4290d0[_0x40d6('0xb')]({'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x1a'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4['exten'],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':'outbound','app':_0x40d6('0x4'),'appdata':_0x40d6('0x1b')+_0x1d9be4[_0x40d6('0x19')]||'wav','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']});}return _0x4290d0;}function _0x15be32(_0x243822,_0x433e70){var _0x3966de=[{'name':'trunk','param':0x0},{'name':_0x40d6('0x1c'),'param':0x1},{'name':_0x40d6('0x1d'),'param':0x2},{'name':_0x40d6('0x1e'),'param':0x3}];var _0xa505b2={};var _0x161d3a=_0x433e70[_0x40d6('0x1f')](',');var _0x534494=[];for(var _0x1d366c=0x0;_0x1d366c<_0x3966de[_0x40d6('0x20')];_0x1d366c++){switch(_0x3966de[_0x1d366c][_0x40d6('0x21')]){case _0x40d6('0x22'):_0xa505b2[_0x40d6('0x22')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]][_0x40d6('0x1f')]('/')[0x1];_0xa505b2[_0x40d6('0x24')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]][_0x40d6('0x1f')]('/')[0x2];_0xa505b2[_0x40d6('0x25')]=_0xa505b2[_0x40d6('0x24')]?_0xa505b2[_0x40d6('0x24')][_0x40d6('0x1f')]('$')[0x0]:undefined;_0xa505b2['phone']=_0x243822['cutdigits']?(_0xa505b2[_0x40d6('0x25')]||'')+_0x40d6('0x11')+_0x243822['cutdigits']+'}':(_0xa505b2[_0x40d6('0x25')]||'')+_0x40d6('0x26');_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=[_0x40d6('0x27'),_0xa505b2['trunk'],_0xa505b2[_0x40d6('0x24')]][_0x40d6('0x28')]('/');break;case _0x40d6('0x1d'):_0xa505b2[_0x40d6('0x1d')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]];if(_0x243822[_0x40d6('0x19')]!==_0x40d6('0x29')){if(_0xa505b2['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0xa505b2['options']+=_0x40d6('0x2a');}}else{_0xa505b2['options']=_0xa505b2[_0x40d6('0x1d')][_0x40d6('0x2b')](_0x40d6('0x2a'),'');}_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=_0xa505b2['options'];break;default:_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=_0x161d3a[_0x3966de[_0x1d366c]['param']];}}return _0x534494[_0x40d6('0x28')](',');}function _0x34d467(_0x13c5e8,_0x4f1f75,_0x1d0648){return new Promise(function(_0x383507,_0x1cf0c6){var _0x2ab202=[];if(_['isEmpty'](_0x4f1f75))return _0x383507(_0x2ab202);_0x48b4d9['Interval']['findAll']({'attributes':['id',_0x40d6('0x2c'),_0x40d6('0x2d')],'raw':!![]})[_0x40d6('0x2e')](function(_0x4bd7c6){for(var _0x70d05c=0x0,_0x25f65a=0x0;_0x70d05c<_0x4f1f75[_0x40d6('0x20')];_0x70d05c++,_0x25f65a=0x0){var _0x1ea783=_0x4f1f75[_0x70d05c];var _0x1b210e=[];var _0x15b778=[];delete _0x1ea783['id'];if(_0x1ea783[_0x40d6('0x2c')]!=='*,*,*,*'){_0x1ea783['intervals']=[_0x1ea783[_0x40d6('0x2c')]];}else{_0x1ea783[_0x40d6('0x2f')]=_0x1ea783[_0x40d6('0x2d')]?_[_0x40d6('0x30')](_[_0x40d6('0x31')](_0x4bd7c6,{'IntervalId':_0x1ea783[_0x40d6('0x2d')]}),_0x40d6('0x2c')):[];}_0x1ea783[_0x40d6('0x6')]=_0x13c5e8['context'];_0x1ea783[_0x40d6('0x7')]=_0x13c5e8[_0x40d6('0x7')];if(_0x1ea783[_0x40d6('0x3')])_0x1ea783[_0x40d6('0x3')]=_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')]();if(_0x13c5e8['type']===_0x40d6('0xd')){if(_0x1ea783[_0x40d6('0x18')](_0x40d6('0x33'))&&_0x1ea783['tag']&&_0x1ea783['tag']!=='--'){_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')](),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x34')+_0x1ea783['tag'],'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')]['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783['type'][_0x40d6('0x32')](),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x35')+(_0x1ea783[_0x40d6('0x36')]?_0x40d6('0x37')+_0x1ea783[_0x40d6('0x36')]+')':_0x40d6('0x38')),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8['exten'],'priority':_0x1ea783['intervals']['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}else{if(_0x1ea783[_0x40d6('0x18')](_0x40d6('0x39'))){if(['queue','playback'][_0x40d6('0x3a')](_0x1ea783[_0x40d6('0x3b')][_0x40d6('0x32')]())&&_0x1ea783[_0x40d6('0x3c')]!==_0x40d6('0x3d')){if(_0x1ea783[_0x40d6('0x39')]){_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783['type']['toLowerCase'](),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x3e'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783[_0x40d6('0x3')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x13c5e8['context'],'exten':_0x13c5e8['exten'],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}else{_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')](),'app':'ExecIf','appdata':_0x40d6('0x3f'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')]['toLowerCase'](),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x40'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8['exten'],'priority':_0x1ea783[_0x40d6('0x2f')]['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}}}}for(var _0x24d90f=0x0;_0x24d90f<_0x1ea783[_0x40d6('0x2f')]['length'];_0x24d90f++){var _0xe1ba99=_0x1d0648+_0x1ea783[_0x40d6('0x2f')]['length'];var _0x4e60b6=_0x24d90f===_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]-0x1?_0x1d0648+_0x1b210e['length']+_0x15b778['length']+0x2:_0x1d0648+_0x24d90f+0x1;_0x1b210e[_0x40d6('0x41')](_0x24d90f,0x0,{'type':_0x13c5e8['type'],'app':_0x40d6('0x42'),'appdata':_0x1ea783[_0x40d6('0x2f')][_0x24d90f]+'?'+_0x13c5e8[_0x40d6('0x6')]+_0x40d6('0x43')+_0xe1ba99+':'+_0x13c5e8[_0x40d6('0x6')]+_0x40d6('0x43')+_0x4e60b6,'exten':_0x13c5e8[_0x40d6('0x7')],'context':_0x13c5e8[_0x40d6('0x6')],'priority':_0x1d0648+_0x24d90f,'VoiceExtensionId':_0x13c5e8['id']});}if(_0x1ea783[_0x40d6('0x3c')]===_0x40d6('0x44'))_0x1ea783['appdata']=_0x15be32(_0x13c5e8,_0x1ea783[_0x40d6('0x45')]);_0x1ea783[_0x40d6('0x46')]=_0x1b210e[_0x40d6('0x20')]?_[_0x40d6('0x47')](_0x1b210e)[_0x40d6('0x46')]+0x1:_0x1d0648;_0x2ab202=_['concat'](_0x2ab202,_0x1b210e,[_0x1ea783],_0x15b778);_0x1d0648=_[_0x40d6('0x47')](_0x2ab202)[_0x40d6('0x46')]+0x1;}return _0x383507(_0x2ab202);})[_0x40d6('0x48')](function(_0x1bd6ac){_0x1cf0c6(_0x1bd6ac);});});}return _0x24aa2e[_0x40d6('0x49')](_0x40d6('0x4a'),attributes,{'tableName':_0x40d6('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x217aa5){var _0x3d7b5a=this[_0x40d6('0x4c')]({'plain':!![]});var _0x32c14f=_0x3d7b5a[_0x40d6('0x3')]===_0x40d6('0xd')?_0x249e0c(_0x3d7b5a):_0x3f6845(_0x3d7b5a);return _0x34d467(_0x3d7b5a,_0x217aa5,_[_0x40d6('0x47')](_0x32c14f)[_0x40d6('0x46')]+0x1)[_0x40d6('0x2e')](function(_0x364a00){var _0x566588=_[_0x40d6('0x4d')](_0x32c14f,_0x364a00);_0x566588[_0x40d6('0xb')]({'type':_0x3d7b5a[_0x40d6('0x3')],'app':_0x40d6('0x4e'),'exten':_0x3d7b5a['exten'],'context':_0x3d7b5a[_0x40d6('0x6')],'priority':_[_0x40d6('0x47')](_0x566588)[_0x40d6('0x46')]+0x1,'VoiceExtensionId':_0x3d7b5a['id']});return _0x566588;});}}});}; \ No newline at end of file +var _0xcc0b=['interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','outboundDial','appdata','priority','concat','catch','VoiceExtension','voice_extensions','get','last','Hangup','lodash','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcc0b,0xc0));var _0xbcc0=function(_0x1ca59f,_0x1a5cd7){_0x1ca59f=_0x1ca59f-0x0;var _0x2f3153=_0xcc0b[_0x1ca59f];return _0x2f3153;};'use strict';var _=require(_0xbcc0('0x0'));var attributes=require(_0xbcc0('0x1'));module['exports']=function(_0x411ebf){var _0x349222=_0x411ebf[_0xbcc0('0x2')];function _0x1d8c5c(_0x3287dc){var _0x5259e3=0x2;var _0x30bf9d=[{'type':_0x3287dc[_0xbcc0('0x3')],'app':'Set','appdata':_0xbcc0('0x4')+_0x3287dc[_0xbcc0('0x3')],'context':_0x3287dc[_0xbcc0('0x5')],'exten':_0x3287dc[_0xbcc0('0x6')],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']},{'type':_0x3287dc[_0xbcc0('0x3')],'app':_0x3287dc[_0xbcc0('0x7')]?'Set':_0xbcc0('0x8'),'appdata':_0x3287dc[_0xbcc0('0x7')]?_0xbcc0('0x9')+_0x3287dc[_0xbcc0('0x7')]:_0xbcc0('0xa'),'context':_0x3287dc[_0xbcc0('0x5')],'exten':_0x3287dc[_0xbcc0('0x6')],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']}];if(_0x3287dc[_0xbcc0('0x3')]===_0xbcc0('0xb')){_0x30bf9d[_0xbcc0('0xc')]({'type':_0xbcc0('0xb'),'app':_0xbcc0('0xd'),'appdata':'CDR(routeid)='+_0x3287dc['id'],'context':_0x3287dc[_0xbcc0('0x5')],'exten':_0x3287dc['exten'],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']});}_0x30bf9d['push']({'type':_0x3287dc[_0xbcc0('0x3')],'app':_0xbcc0('0xd'),'appdata':_0xbcc0('0xe'),'context':_0x3287dc[_0xbcc0('0x5')],'exten':_0x3287dc[_0xbcc0('0x6')],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']},{'type':_0x3287dc[_0xbcc0('0x3')],'app':'Set','appdata':_0xbcc0('0xf'),'context':_0x3287dc['context'],'exten':_0x3287dc[_0xbcc0('0x6')],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']},{'type':_0x3287dc['type'],'app':'Set','appdata':_0xbcc0('0x10'),'context':_0x3287dc[_0xbcc0('0x5')],'exten':_0x3287dc[_0xbcc0('0x6')],'priority':_0x5259e3++,'VoiceExtensionId':_0x3287dc['id']});return _0x30bf9d;}function _0x4c2401(_0x428975){var _0x4ee2ca=0x2;var _0xaaff5d=[{'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':_0xbcc0('0x12'),'context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':_0x428975[_0xbcc0('0x7')]?_0xbcc0('0xd'):_0xbcc0('0x8'),'appdata':_0x428975[_0xbcc0('0x7')]?_0xbcc0('0x9')+_0x428975[_0xbcc0('0x7')]:_0xbcc0('0xa'),'context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':'CDR(destination)='+(_0x428975[_0xbcc0('0x13')]?_0xbcc0('0x14')+_0x428975[_0xbcc0('0x13')]+'}':'${EXTEN}'),'context':_0x428975['context'],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':'Set','appdata':_0xbcc0('0x15')+_0x428975['id'],'context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':'outbound','app':_0xbcc0('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4ee2ca+0x2)+_0xbcc0('0x17')+(_0x4ee2ca+0x1)+')','context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':_0x428975[_0xbcc0('0x13')]?_0xbcc0('0x18')+_0x428975[_0xbcc0('0x13')]+'}':_0xbcc0('0x19'),'context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975['exten'],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':_0xbcc0('0xf'),'context':_0x428975['context'],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':'Set','appdata':_0xbcc0('0x10'),'context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':'outbound','app':_0xbcc0('0xd'),'appdata':'outboundrouteid='+_0x428975['id'],'context':_0x428975['context'],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']}];if(_0x428975[_0xbcc0('0x1a')](_0xbcc0('0x1b'))&&_0x428975[_0xbcc0('0x1b')]!==_0xbcc0('0x1c')){_0xaaff5d[_0xbcc0('0xc')]({'type':_0xbcc0('0x11'),'app':_0xbcc0('0xd'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x428975['context'],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']},{'type':_0xbcc0('0x11'),'app':'Set','appdata':_0xbcc0('0x1d')+_0x428975[_0xbcc0('0x1b')]||'wav','context':_0x428975[_0xbcc0('0x5')],'exten':_0x428975[_0xbcc0('0x6')],'priority':_0x4ee2ca++,'VoiceExtensionId':_0x428975['id']});}return _0xaaff5d;}function _0x7b4e9d(_0x3b74a3,_0x7f7bbb){var _0x3bf05a=[{'name':_0xbcc0('0x1e'),'param':0x0},{'name':_0xbcc0('0x1f'),'param':0x1},{'name':_0xbcc0('0x20'),'param':0x2},{'name':_0xbcc0('0x21'),'param':0x3}];var _0x143079={};var _0x5bb3fd=_0x7f7bbb[_0xbcc0('0x22')](',');var _0x14a206=[];for(var _0x5f255b=0x0;_0x5f255b<_0x3bf05a[_0xbcc0('0x23')];_0x5f255b++){switch(_0x3bf05a[_0x5f255b][_0xbcc0('0x24')]){case _0xbcc0('0x1e'):_0x143079[_0xbcc0('0x1e')]=_0x5bb3fd[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]][_0xbcc0('0x22')]('/')[0x1];_0x143079[_0xbcc0('0x26')]=_0x5bb3fd[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]][_0xbcc0('0x22')]('/')[0x2];_0x143079[_0xbcc0('0x27')]=_0x143079[_0xbcc0('0x26')]?_0x143079[_0xbcc0('0x26')][_0xbcc0('0x22')]('$')[0x0]:undefined;_0x143079[_0xbcc0('0x26')]=_0x3b74a3[_0xbcc0('0x13')]?(_0x143079['prefix']||'')+'${EXTEN:'+_0x3b74a3['cutdigits']+'}':(_0x143079['prefix']||'')+_0xbcc0('0x28');_0x14a206[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]]=[_0xbcc0('0x29'),_0x143079['trunk'],_0x143079[_0xbcc0('0x26')]]['join']('/');break;case _0xbcc0('0x20'):_0x143079[_0xbcc0('0x20')]=_0x5bb3fd[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]];if(_0x3b74a3[_0xbcc0('0x1b')]!=='none'){if(_0x143079[_0xbcc0('0x20')][_0xbcc0('0x2a')](_0xbcc0('0x2b'))<0x0){_0x143079['options']+=_0xbcc0('0x2b');}}else{_0x143079['options']=_0x143079['options'][_0xbcc0('0x2c')]('U(xcally-mixmonitor-context)','');}_0x14a206[_0x3bf05a[_0x5f255b]['param']]=_0x143079[_0xbcc0('0x20')];break;default:_0x14a206[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]]=_0x5bb3fd[_0x3bf05a[_0x5f255b][_0xbcc0('0x25')]];}}return _0x14a206['join'](',');}function _0xb5a718(_0x11ab3c,_0x2cb705,_0x1d4923){return new Promise(function(_0x1bd3ff,_0x137947){var _0x1ad122=[];if(_[_0xbcc0('0x2d')](_0x2cb705))return _0x1bd3ff(_0x1ad122);_0x349222[_0xbcc0('0x2e')][_0xbcc0('0x2f')]({'attributes':['id',_0xbcc0('0x30'),_0xbcc0('0x31')],'raw':!![]})[_0xbcc0('0x32')](function(_0x252381){for(var _0x52974f=0x0,_0x2fd925=0x0;_0x52974f<_0x2cb705[_0xbcc0('0x23')];_0x52974f++,_0x2fd925=0x0){var _0x4d7b8d=_0x2cb705[_0x52974f];var _0x461386=[];var _0x15cd16=[];delete _0x4d7b8d['id'];if(_0x4d7b8d['interval']!==_0xbcc0('0x33')){_0x4d7b8d[_0xbcc0('0x34')]=[_0x4d7b8d['interval']];}else{_0x4d7b8d[_0xbcc0('0x34')]=_0x4d7b8d[_0xbcc0('0x31')]?_[_0xbcc0('0x35')](_[_0xbcc0('0x36')](_0x252381,{'IntervalId':_0x4d7b8d[_0xbcc0('0x31')]}),_0xbcc0('0x30')):[];}_0x4d7b8d[_0xbcc0('0x5')]=_0x11ab3c[_0xbcc0('0x5')];_0x4d7b8d['exten']=_0x11ab3c[_0xbcc0('0x6')];if(_0x4d7b8d[_0xbcc0('0x3')])_0x4d7b8d[_0xbcc0('0x3')]=_0x4d7b8d[_0xbcc0('0x3')]['toLowerCase']();if(_0x11ab3c['type']===_0xbcc0('0x11')){if(_0x4d7b8d[_0xbcc0('0x1a')](_0xbcc0('0x37'))&&_0x4d7b8d['tag']&&_0x4d7b8d['tag']!=='--'){_0x461386['push']({'type':_0x4d7b8d['type']['toLowerCase'](),'app':_0xbcc0('0xd'),'appdata':_0xbcc0('0x38')+_0x4d7b8d['tag'],'context':_0x11ab3c[_0xbcc0('0x5')],'exten':_0x11ab3c['exten'],'priority':_0x4d7b8d['intervals']['length']+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});}_0x461386['push']({'type':_0x4d7b8d['type'][_0xbcc0('0x39')](),'app':_0xbcc0('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4d7b8d[_0xbcc0('0x3a')]?_0xbcc0('0x3b')+_0x4d7b8d[_0xbcc0('0x3a')]+')':_0xbcc0('0x3c')),'context':_0x11ab3c[_0xbcc0('0x5')],'exten':_0x11ab3c[_0xbcc0('0x6')],'priority':_0x4d7b8d[_0xbcc0('0x34')][_0xbcc0('0x23')]+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});}else{if(_0x4d7b8d[_0xbcc0('0x1a')](_0xbcc0('0x3d'))){if(['queue',_0xbcc0('0x3e')][_0xbcc0('0x3f')](_0x4d7b8d[_0xbcc0('0x40')]['toLowerCase']())&&_0x4d7b8d[_0xbcc0('0x41')]!=='custom'){if(_0x4d7b8d[_0xbcc0('0x3d')]){_0x461386['push']({'type':_0x4d7b8d[_0xbcc0('0x3')][_0xbcc0('0x39')](),'app':_0xbcc0('0x16'),'appdata':_0xbcc0('0x42'),'context':_0x11ab3c[_0xbcc0('0x5')],'exten':_0x11ab3c['exten'],'priority':_0x4d7b8d[_0xbcc0('0x34')][_0xbcc0('0x23')]+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});_0x461386[_0xbcc0('0xc')]({'type':_0x4d7b8d[_0xbcc0('0x3')][_0xbcc0('0x39')](),'app':'Set','appdata':_0xbcc0('0x43'),'context':_0x11ab3c[_0xbcc0('0x5')],'exten':_0x11ab3c[_0xbcc0('0x6')],'priority':_0x4d7b8d[_0xbcc0('0x34')][_0xbcc0('0x23')]+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});}else{_0x461386['push']({'type':_0x4d7b8d[_0xbcc0('0x3')][_0xbcc0('0x39')](),'app':'ExecIf','appdata':_0xbcc0('0x44'),'context':_0x11ab3c[_0xbcc0('0x5')],'exten':_0x11ab3c[_0xbcc0('0x6')],'priority':_0x4d7b8d['intervals']['length']+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});_0x461386['push']({'type':_0x4d7b8d[_0xbcc0('0x3')][_0xbcc0('0x39')](),'app':'Set','appdata':_0xbcc0('0x45'),'context':_0x11ab3c['context'],'exten':_0x11ab3c[_0xbcc0('0x6')],'priority':_0x4d7b8d[_0xbcc0('0x34')][_0xbcc0('0x23')]+_0x1d4923+_0x2fd925++,'VoiceExtensionId':_0x11ab3c['id']});}}}}for(var _0x12386e=0x0;_0x12386e<_0x4d7b8d[_0xbcc0('0x34')][_0xbcc0('0x23')];_0x12386e++){var _0x62f534=_0x1d4923+_0x4d7b8d[_0xbcc0('0x34')]['length'];var _0x114e09=_0x12386e===_0x4d7b8d[_0xbcc0('0x34')]['length']-0x1?_0x1d4923+_0x461386[_0xbcc0('0x23')]+_0x15cd16['length']+0x2:_0x1d4923+_0x12386e+0x1;_0x461386['splice'](_0x12386e,0x0,{'type':_0x11ab3c[_0xbcc0('0x3')],'app':'GotoIfTime','appdata':_0x4d7b8d[_0xbcc0('0x34')][_0x12386e]+'?'+_0x11ab3c[_0xbcc0('0x5')]+',${EXTEN},'+_0x62f534+':'+_0x11ab3c[_0xbcc0('0x5')]+',${EXTEN},'+_0x114e09,'exten':_0x11ab3c['exten'],'context':_0x11ab3c['context'],'priority':_0x1d4923+_0x12386e,'VoiceExtensionId':_0x11ab3c['id']});}if(_0x4d7b8d[_0xbcc0('0x41')]===_0xbcc0('0x46'))_0x4d7b8d['appdata']=_0x7b4e9d(_0x11ab3c,_0x4d7b8d[_0xbcc0('0x47')]);_0x4d7b8d['priority']=_0x461386[_0xbcc0('0x23')]?_['last'](_0x461386)[_0xbcc0('0x48')]+0x1:_0x1d4923;_0x1ad122=_[_0xbcc0('0x49')](_0x1ad122,_0x461386,[_0x4d7b8d],_0x15cd16);_0x1d4923=_['last'](_0x1ad122)[_0xbcc0('0x48')]+0x1;}return _0x1bd3ff(_0x1ad122);})[_0xbcc0('0x4a')](function(_0x4d579d){_0x137947(_0x4d579d);});});}return _0x411ebf['define'](_0xbcc0('0x4b'),attributes,{'tableName':_0xbcc0('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x365b05){var _0x2f586a=this[_0xbcc0('0x4d')]({'plain':!![]});var _0x47db63=_0x2f586a['type']==='outbound'?_0x4c2401(_0x2f586a):_0x1d8c5c(_0x2f586a);return _0xb5a718(_0x2f586a,_0x365b05,_[_0xbcc0('0x4e')](_0x47db63)[_0xbcc0('0x48')]+0x1)['then'](function(_0x5f27ec){var _0xc817a1=_[_0xbcc0('0x49')](_0x47db63,_0x5f27ec);_0xc817a1[_0xbcc0('0xc')]({'type':_0x2f586a[_0xbcc0('0x3')],'app':_0xbcc0('0x4f'),'exten':_0x2f586a[_0xbcc0('0x6')],'context':_0x2f586a['context'],'priority':_[_0xbcc0('0x4e')](_0xc817a1)[_0xbcc0('0x48')]+0x1,'VoiceExtensionId':_0x2f586a['id']});return _0xc817a1;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e43f946..341d3b1 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 _0x979e=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','where','map','include','model','attributes','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x979e,0x195));var _0xe979=function(_0x25cf01,_0x49b221){_0x25cf01=_0x25cf01-0x0;var _0x3a31c3=_0x979e[_0x25cf01];return _0x3a31c3;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require(_0xe979('0x2'));var BPromise=require(_0xe979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe979('0x4'));var db=require(_0xe979('0x5'))['db'];var utils=require(_0xe979('0x6'));var logger=require(_0xe979('0x7'))(_0xe979('0x8'));var config=require('../../config/environment');var jayson=require(_0xe979('0x9'));var client=jayson['client'][_0xe979('0xa')]({'port':0x232a});config[_0xe979('0xb')]=_[_0xe979('0xc')](config[_0xe979('0xb')],{'host':_0xe979('0xd'),'port':0x18eb});var socket=require(_0xe979('0xe'))(new Redis(config[_0xe979('0xb')]));require(_0xe979('0xf'))[_0xe979('0x10')](socket);function respondWithRpcPromise(_0x22cb19,_0x3aeb90,_0x4eddb9){return new BPromise(function(_0x19fcc8,_0x1647d2){return client[_0xe979('0x11')](_0x22cb19,_0x4eddb9)['then'](function(_0x18fe2b){logger[_0xe979('0x12')](_0xe979('0x13'),_0x3aeb90,_0xe979('0x14'));logger[_0xe979('0x15')](_0xe979('0x16'),_0x3aeb90,_0xe979('0x14'),JSON[_0xe979('0x17')](_0x18fe2b));if(_0x18fe2b['error']){if(_0x18fe2b[_0xe979('0x18')][_0xe979('0x19')]===0x1f4){logger[_0xe979('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3aeb90,_0x18fe2b['error'][_0xe979('0x1a')]);return _0x1647d2(_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);}logger[_0xe979('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3aeb90,_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);return _0x19fcc8(_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);}else{logger[_0xe979('0x12')](_0xe979('0x13'),_0x3aeb90,_0xe979('0x14'));_0x19fcc8(_0x18fe2b['result'][_0xe979('0x1a')]);}})['catch'](function(_0x58f4a9){logger[_0xe979('0x18')](_0xe979('0x13'),_0x3aeb90,_0x58f4a9);_0x1647d2(_0x58f4a9);});});}exports[_0xe979('0x1b')]=function(_0x184373){var _0x5d3cbe=this;return new Promise(function(_0x466879,_0x480fbd){return db[_0xe979('0x1c')][_0xe979('0x1d')]({'raw':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x184373[_0xe979('0x1e')]?_0x184373['options'][_0xe979('0x1f')]||null:null,'attributes':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['attributes']||null:null,'limit':_0x184373[_0xe979('0x1e')]?_0x184373['options']['limit']||null:null,'include':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['include']?_[_0xe979('0x20')](_0x184373['options'][_0xe979('0x21')],function(_0x4bfb4b){return{'model':db[_0x4bfb4b[_0xe979('0x22')]],'as':_0x4bfb4b['as'],'attributes':_0x4bfb4b[_0xe979('0x23')],'include':_0x4bfb4b[_0xe979('0x21')]?_[_0xe979('0x20')](_0x4bfb4b[_0xe979('0x21')],function(_0x4aa174){return{'model':db[_0x4aa174[_0xe979('0x22')]],'as':_0x4aa174['as'],'attributes':_0x4aa174[_0xe979('0x23')],'include':_0x4aa174[_0xe979('0x21')]?_[_0xe979('0x20')](_0x4aa174[_0xe979('0x21')],function(_0x53ada7){return{'model':db[_0x53ada7[_0xe979('0x22')]],'as':_0x53ada7['as'],'attributes':_0x53ada7[_0xe979('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe979('0x24')](function(_0x2d7302){logger[_0xe979('0x12')]('GetVoiceExtension',_0x184373);logger[_0xe979('0x15')](_0xe979('0x1b'),_0x184373,JSON[_0xe979('0x17')](_0x2d7302));_0x466879(_0x2d7302);})[_0xe979('0x25')](function(_0xe6e59e){logger['error'](_0xe979('0x1b'),_0xe6e59e[_0xe979('0x1a')],_0x184373);_0x480fbd(_0x5d3cbe['error'](0x1f4,_0xe6e59e[_0xe979('0x1a')]));});});}; \ No newline at end of file +var _0x7b84=['client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','limit','map','include','model','attributes','info','GetVoiceExtension','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x7b84,0x167));var _0x47b8=function(_0x1d128f,_0x534ce1){_0x1d128f=_0x1d128f-0x0;var _0x1a5790=_0x7b84[_0x1d128f];return _0x1a5790;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});config[_0x47b8('0xc')]=_[_0x47b8('0xd')](config[_0x47b8('0xc')],{'host':_0x47b8('0xe'),'port':0x18eb});var socket=require(_0x47b8('0xf'))(new Redis(config[_0x47b8('0xc')]));require(_0x47b8('0x10'))[_0x47b8('0x11')](socket);function respondWithRpcPromise(_0x3ddbfd,_0xb3f2b8,_0x520569){return new BPromise(function(_0x5450f6,_0x245bf5){return client[_0x47b8('0x12')](_0x3ddbfd,_0x520569)[_0x47b8('0x13')](function(_0x320fdf){logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));logger['debug'](_0x47b8('0x16'),_0xb3f2b8,_0x47b8('0x15'),JSON[_0x47b8('0x17')](_0x320fdf));if(_0x320fdf[_0x47b8('0x18')]){if(_0x320fdf[_0x47b8('0x18')]['code']===0x1f4){logger['error'](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf['error'][_0x47b8('0x19')]);return _0x245bf5(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}logger[_0x47b8('0x18')](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);return _0x5450f6(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}else{logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));_0x5450f6(_0x320fdf[_0x47b8('0x1a')][_0x47b8('0x19')]);}})[_0x47b8('0x1b')](function(_0x593f36){logger[_0x47b8('0x18')]('VoiceExtension,\x20%s,\x20%s',_0xb3f2b8,_0x593f36);_0x245bf5(_0x593f36);});});}exports['GetVoiceExtension']=function(_0x20731c){var _0x5e15d5=this;return new Promise(function(_0x1d44a9,_0x227cd7){return db[_0x47b8('0x1c')][_0x47b8('0x1d')]({'raw':_0x20731c[_0x47b8('0x1e')]?_0x20731c[_0x47b8('0x1e')][_0x47b8('0x1f')]===undefined?!![]:![]:!![],'where':_0x20731c[_0x47b8('0x1e')]?_0x20731c['options'][_0x47b8('0x20')]||null:null,'attributes':_0x20731c[_0x47b8('0x1e')]?_0x20731c[_0x47b8('0x1e')]['attributes']||null:null,'limit':_0x20731c[_0x47b8('0x1e')]?_0x20731c[_0x47b8('0x1e')][_0x47b8('0x21')]||null:null,'include':_0x20731c['options']?_0x20731c[_0x47b8('0x1e')]['include']?_[_0x47b8('0x22')](_0x20731c['options'][_0x47b8('0x23')],function(_0x3e40a1){return{'model':db[_0x3e40a1[_0x47b8('0x24')]],'as':_0x3e40a1['as'],'attributes':_0x3e40a1[_0x47b8('0x25')],'include':_0x3e40a1[_0x47b8('0x23')]?_[_0x47b8('0x22')](_0x3e40a1[_0x47b8('0x23')],function(_0x315fd7){return{'model':db[_0x315fd7[_0x47b8('0x24')]],'as':_0x315fd7['as'],'attributes':_0x315fd7[_0x47b8('0x25')],'include':_0x315fd7[_0x47b8('0x23')]?_[_0x47b8('0x22')](_0x315fd7[_0x47b8('0x23')],function(_0x19a605){return{'model':db[_0x19a605['model']],'as':_0x19a605['as'],'attributes':_0x19a605['attributes']};}):[]};}):[]};}):[]:[]})[_0x47b8('0x13')](function(_0x9edecd){logger[_0x47b8('0x26')](_0x47b8('0x27'),_0x20731c);logger[_0x47b8('0x28')]('GetVoiceExtension',_0x20731c,JSON[_0x47b8('0x17')](_0x9edecd));_0x1d44a9(_0x9edecd);})[_0x47b8('0x1b')](function(_0x4edc09){logger[_0x47b8('0x18')](_0x47b8('0x27'),_0x4edc09[_0x47b8('0x19')],_0x20731c);_0x227cd7(_0x5e15d5['error'](0x1f4,_0x4edc09[_0x47b8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4f893a5..86b58ed 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(_0x3de9ad,_0x2a0d99){var _0x3b7676=function(_0x541c88){while(--_0x541c88){_0x3de9ad['push'](_0x3de9ad['shift']());}};_0x3b7676(++_0x2a0d99);}(_0xe14b,0x93));var _0xbe14=function(_0x4ebcee,_0x22671d){_0x4ebcee=_0x4ebcee-0x0;var _0x26e5bf=_0xe14b[_0x4ebcee];return _0x26e5bf;};'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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x4c2745,_0x43790d){var _0x39beb2=function(_0x3cd5c3){while(--_0x3cd5c3){_0x4c2745['push'](_0x4c2745['shift']());}};_0x39beb2(++_0x43790d);}(_0x1261,0x144));var _0x1126=function(_0x1b4bef,_0x5bb6be){_0x1b4bef=_0x1b4bef-0x0;var _0xf377eb=_0x1261[_0x1b4bef];return _0xf377eb;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4cc2b74..183fce9 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 _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x20bf79,_0xbecfa4){var _0x1f9012=function(_0x18a569){while(--_0x18a569){_0x20bf79['push'](_0x20bf79['shift']());}};_0x1f9012(++_0xbecfa4);}(_0x687b,0x14a));var _0xb687=function(_0x35e0d4,_0x4cc3b2){_0x35e0d4=_0x35e0d4-0x0;var _0x481513=_0x687b[_0x35e0d4];return _0x481513;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file +var _0x4991=['show','/:id/messages','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated'];(function(_0x29b90d,_0x2ffba9){var _0x5c1ebf=function(_0x250c29){while(--_0x250c29){_0x29b90d['push'](_0x29b90d['shift']());}};_0x5c1ebf(++_0x2ffba9);}(_0x4991,0xf7));var _0x1499=function(_0x320dbf,_0x1b2893){_0x320dbf=_0x320dbf-0x0;var _0x3502f8=_0x4991[_0x320dbf];return _0x3502f8;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['getMessages']);router[_0x1499('0xf')]('/',auth[_0x1499('0xc')](),controller['create']);router[_0x1499('0x10')](_0x1499('0xb'),auth['isAuthenticated'](),controller[_0x1499('0x11')]);router[_0x1499('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1499('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 336fffb..8163f3f 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 _0x9040=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x14fd3e,_0x1949ae){var _0x3958d5=function(_0x280aaf){while(--_0x280aaf){_0x14fd3e['push'](_0x14fd3e['shift']());}};_0x3958d5(++_0x1949ae);}(_0x9040,0x1a4));var _0x0904=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x9040[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0904('0x0'));module[_0x0904('0x1')]={'customer_id':{'type':Sequelize[_0x0904('0x2')]},'context':{'type':Sequelize[_0x0904('0x2')],'defaultValue':_0x0904('0x3'),'unique':_0x0904('0x4')},'mailbox':{'type':Sequelize[_0x0904('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0904('0x4')},'password':{'type':Sequelize[_0x0904('0x2')]},'fullname':{'type':Sequelize[_0x0904('0x2')]},'email':{'type':Sequelize[_0x0904('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1d5edf){this[_0x0904('0x5')](_0x0904('0x6'),typeof _0x1d5edf===_0x0904('0x7')&&_0x1d5edf[_0x0904('0x8')]()?_0x1d5edf[_0x0904('0x8')]():null);}},'pager':{'type':Sequelize[_0x0904('0x2')]},'tz':{'type':Sequelize[_0x0904('0x2')],'defaultValue':_0x0904('0x9')},'attach':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':_0x0904('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0904('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':_0x0904('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x0904('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0904('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0904('0xd')],'get':function(){return this[_0x0904('0xe')](_0x0904('0xf'))+_0x0904('0x10')+this[_0x0904('0xe')](_0x0904('0x11'));}}}; \ No newline at end of file +var _0xab5f=['email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','getDataValue','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x4adc50,_0x149b13){var _0x55cb86=function(_0x2027bc){while(--_0x2027bc){_0x4adc50['push'](_0x4adc50['shift']());}};_0x55cb86(++_0x149b13);}(_0xab5f,0xb0));var _0xfab5=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xab5f[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xfab5('0x0')]},'context':{'type':Sequelize[_0xfab5('0x0')],'defaultValue':_0xfab5('0x1'),'unique':_0xfab5('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xfab5('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xfab5('0x0')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x185235){this[_0xfab5('0x3')](_0xfab5('0x4'),typeof _0x185235==='string'&&_0x185235['trim']()?_0x185235[_0xfab5('0x5')]():null);}},'pager':{'type':Sequelize[_0xfab5('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfab5('0x6')},'attach':{'type':Sequelize[_0xfab5('0x7')]('yes','no'),'defaultValue':_0xfab5('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xfab5('0x8'),'no'),'defaultValue':_0xfab5('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfab5('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfab5('0x7')](_0xfab5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xfab5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfab5('0x7')](_0xfab5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xfab5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfab5('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfab5('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xfab5('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xfab5('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfab5('0x7')](_0xfab5('0x8'),'no'),'defaultValue':_0xfab5('0x8'),'allowNull':![]},'stamp':{'type':_0xfab5('0xa')},'emailsubject':{'type':Sequelize[_0xfab5('0x0')]},'emailbody':{'type':Sequelize[_0xfab5('0x0')]},'maxsecs':{'type':Sequelize[_0xfab5('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfab5('0xc')],'get':function(){return this['getDataValue'](_0xfab5('0xd'))+'\x20-\x20'+this[_0xfab5('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 95d6b0b..d048104 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 _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x55c876,_0x3184b2){var _0x50c931=function(_0x1b62a5){while(--_0x1b62a5){_0x55c876['push'](_0x55c876['shift']());}};_0x50c931(++_0x3184b2);}(_0x3f8c,0x104));var _0xc3f8=function(_0x322391,_0x4143d9){_0x322391=_0x322391-0x0;var _0x19cb8b=_0x3f8c[_0x322391];return _0x19cb8b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file +var _0x36ee=['set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','stack','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x89a1e7,_0x242359){var _0x16c5e3=function(_0x3fe007){while(--_0x3fe007){_0x89a1e7['push'](_0x89a1e7['shift']());}};_0x16c5e3(++_0x242359);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['VoiceMail'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='Voicemails';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));};exports[_0xe36e('0x54')]=function(_0x169369,_0x443154,_0x700b63){return db[_0xe36e('0x2d')][_0xe36e('0x55')]({'where':{'id':_0x169369[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x26')](function(_0x56718a){var _0x2cf7fc;var _0x389e91={},_0x6f979f={};_0x6f979f[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x56')][_0xe36e('0x2e')]);_0x6f979f[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x169369[_0xe36e('0x33')]);_0x6f979f[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],_0x6f979f[_0xe36e('0x33')]);_0x389e91['attributes']=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],qs['fields'](_0x169369[_0xe36e('0x33')][_0xe36e('0x38')]));_0x389e91[_0xe36e('0x37')]=_0x389e91[_0xe36e('0x37')][_0xe36e('0x39')]?_0x389e91[_0xe36e('0x37')]:_0x6f979f['model'];if(!_0x169369[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x389e91[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x169369[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x389e91[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x169369[_0xe36e('0x33')]['offset']);}_0x389e91[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x169369['query'][_0xe36e('0x3c')]);_0x389e91[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x169369[_0xe36e('0x33')],_0x6f979f[_0xe36e('0x35')]));if(_0x169369[_0xe36e('0x33')]['filter']){_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x389e91[_0xe36e('0x37')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x169369[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xc1daf8;})});}_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91['where'],{'mailboxuser':_0x56718a[_0xe36e('0x57')]});_0x389e91=_[_0xe36e('0x40')]({},_0x389e91,_0x169369[_0xe36e('0x48')]);return db[_0xe36e('0x56')]['findAndCountAll'](_0x389e91)['then'](respondWithFilteredResult(_0x443154,_0x389e91));})[_0xe36e('0x44')](handleError(_0x443154,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b25b3d8..9a2f9b1 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 _0x13cc=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context'];(function(_0xeb2609,_0x3dd738){var _0x49b540=function(_0x454a3e){while(--_0x454a3e){_0xeb2609['push'](_0xeb2609['shift']());}};_0x49b540(++_0x3dd738);}(_0x13cc,0x177));var _0xc13c=function(_0x321d43,_0x2a116a){_0x321d43=_0x321d43-0x0;var _0x2640e1=_0x13cc[_0x321d43];return _0x2640e1;};'use strict';var _=require(_0xc13c('0x0'));var util=require('util');var logger=require(_0xc13c('0x1'))(_0xc13c('0x2'));var moment=require(_0xc13c('0x3'));var BPromise=require(_0xc13c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc13c('0x5'));var rimraf=require(_0xc13c('0x6'));var config=require(_0xc13c('0x7'));var attributes=require(_0xc13c('0x8'));module[_0xc13c('0x9')]=function(_0x2fd8bc,_0x5abc54){return _0x2fd8bc[_0xc13c('0xa')](_0xc13c('0xb'),attributes,{'tableName':_0xc13c('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc13c('0xd'),_0xc13c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x816d=['context','lodash','util','../../config/logger','api','moment','bluebird','path','./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x816d,0x1d5));var _0xd816=function(_0x3817a8,_0x40766c){_0x3817a8=_0x3817a8-0x0;var _0x550bd6=_0x816d[_0x3817a8];return _0x550bd6;};'use strict';var _=require(_0xd816('0x0'));var util=require(_0xd816('0x1'));var logger=require(_0xd816('0x2'))(_0xd816('0x3'));var moment=require(_0xd816('0x4'));var BPromise=require(_0xd816('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd816('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd816('0x7'));module[_0xd816('0x8')]=function(_0x56cd0d,_0x5e6d0c){return _0x56cd0d['define'](_0xd816('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xd816('0xa'),'fields':[_0xd816('0xb'),_0xd816('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9391dc5..cee7631 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 _0xb81f=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xb81f,0x13a));var _0xfb81=function(_0x535d45,_0x3a1ba2){_0x535d45=_0x535d45-0x0;var _0x79dcf6=_0xb81f[_0x535d45];return _0x79dcf6;};'use strict';var _=require('lodash');var util=require(_0xfb81('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb81('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb81('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb81('0x3'))(_0xfb81('0x4'));var config=require(_0xfb81('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfb81('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5c7c4,_0x53a8bf,_0x406e1e){return new BPromise(function(_0x30961e,_0xf4e954){return client[_0xfb81('0x7')](_0xc5c7c4,_0x406e1e)[_0xfb81('0x8')](function(_0x17ee45){logger[_0xfb81('0x9')](_0xfb81('0xa'),_0x53a8bf,_0xfb81('0xb'));logger[_0xfb81('0xc')](_0xfb81('0xd'),_0x53a8bf,'request\x20sent',JSON[_0xfb81('0xe')](_0x17ee45));if(_0x17ee45[_0xfb81('0xf')]){if(_0x17ee45['error'][_0xfb81('0x10')]===0x1f4){logger[_0xfb81('0xf')](_0xfb81('0xa'),_0x53a8bf,_0x17ee45['error'][_0xfb81('0x11')]);return _0xf4e954(_0x17ee45['error'][_0xfb81('0x11')]);}logger[_0xfb81('0xf')](_0xfb81('0xa'),_0x53a8bf,_0x17ee45['error'][_0xfb81('0x11')]);return _0x30961e(_0x17ee45['error'][_0xfb81('0x11')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x53a8bf,_0xfb81('0xb'));_0x30961e(_0x17ee45['result']['message']);}})[_0xfb81('0x12')](function(_0x134a7e){logger[_0xfb81('0xf')]('VoiceMail,\x20%s,\x20%s',_0x53a8bf,_0x134a7e);_0xf4e954(_0x134a7e);});});} \ No newline at end of file +var _0x381d=['client','http','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x381d,0x166));var _0xd381=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x381d[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0xd381('0x0'));var util=require(_0xd381('0x1'));var moment=require(_0xd381('0x2'));var BPromise=require(_0xd381('0x3'));var rs=require(_0xd381('0x4'));var fs=require('fs');var Redis=require(_0xd381('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd381('0x6'))(_0xd381('0x7'));var config=require(_0xd381('0x8'));var jayson=require(_0xd381('0x9'));var client=jayson[_0xd381('0xa')][_0xd381('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17cd02,_0x4f5787,_0x2795d0){return new BPromise(function(_0x5b7358,_0x348396){return client['request'](_0x17cd02,_0x2795d0)[_0xd381('0xc')](function(_0xa38db8){logger['info']('VoiceMail,\x20%s,\x20%s',_0x4f5787,_0xd381('0xd'));logger[_0xd381('0xe')](_0xd381('0xf'),_0x4f5787,_0xd381('0xd'),JSON['stringify'](_0xa38db8));if(_0xa38db8[_0xd381('0x10')]){if(_0xa38db8[_0xd381('0x10')][_0xd381('0x11')]===0x1f4){logger['error'](_0xd381('0x12'),_0x4f5787,_0xa38db8[_0xd381('0x10')]['message']);return _0x348396(_0xa38db8[_0xd381('0x10')][_0xd381('0x13')]);}logger[_0xd381('0x10')](_0xd381('0x12'),_0x4f5787,_0xa38db8[_0xd381('0x10')]['message']);return _0x5b7358(_0xa38db8[_0xd381('0x10')][_0xd381('0x13')]);}else{logger[_0xd381('0x14')]('VoiceMail,\x20%s,\x20%s',_0x4f5787,_0xd381('0xd'));_0x5b7358(_0xa38db8[_0xd381('0x15')]['message']);}})[_0xd381('0x16')](function(_0x2d18e9){logger[_0xd381('0x10')](_0xd381('0x12'),_0x4f5787,_0x2d18e9);_0x348396(_0x2d18e9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 27974d9..8907319 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 _0xb8bf=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','update','delete','exports','path','connect-timeout','express','fs-extra'];(function(_0x5b78d5,_0x39764c){var _0x48f8ca=function(_0x3acee0){while(--_0x3acee0){_0x5b78d5['push'](_0x5b78d5['shift']());}};_0x48f8ca(++_0x39764c);}(_0xb8bf,0x16c));var _0xfb8b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb8bf[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb8b('0x0'));var timeout=require(_0xfb8b('0x1'));var express=require(_0xfb8b('0x2'));var router=express['Router']();var fs_extra=require(_0xfb8b('0x3'));var auth=require(_0xfb8b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb8b('0x5'));var controller=require('./voiceMailMessage.controller');router[_0xfb8b('0x6')]('/',auth[_0xfb8b('0x7')](),controller[_0xfb8b('0x8')]);router['get'](_0xfb8b('0x9'),auth['isAuthenticated'](),controller[_0xfb8b('0xa')]);router['get']('/:id/download',auth[_0xfb8b('0x7')](),controller[_0xfb8b('0xb')]);router[_0xfb8b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfb8b('0x9'),auth['isAuthenticated'](),controller[_0xfb8b('0xd')]);router[_0xfb8b('0xe')](_0xfb8b('0x9'),auth[_0xfb8b('0x7')](),controller['destroy']);module[_0xfb8b('0xf')]=router; \ No newline at end of file +var _0x330f=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put','update','delete'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x330f,0x192));var _0xf330=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0x330f[_0x57a670];return _0x41ce21;};'use strict';var multer=require(_0xf330('0x0'));var util=require(_0xf330('0x1'));var path=require(_0xf330('0x2'));var timeout=require('connect-timeout');var express=require(_0xf330('0x3'));var router=express['Router']();var fs_extra=require(_0xf330('0x4'));var auth=require(_0xf330('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf330('0x6'));router['get']('/',auth[_0xf330('0x7')](),controller['index']);router[_0xf330('0x8')](_0xf330('0x9'),auth['isAuthenticated'](),controller[_0xf330('0xa')]);router[_0xf330('0x8')](_0xf330('0xb'),auth[_0xf330('0x7')](),controller[_0xf330('0xc')]);router[_0xf330('0xd')]('/',auth[_0xf330('0x7')](),controller[_0xf330('0xe')]);router[_0xf330('0xf')](_0xf330('0x9'),auth['isAuthenticated'](),controller[_0xf330('0x10')]);router[_0xf330('0x11')](_0xf330('0x9'),auth[_0xf330('0x7')](),controller[_0xf330('0x12')]);module[_0xf330('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a8f7baa..7681860 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 _0xff6d=['STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xff6d,0x9e));var _0xdff6=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0xff6d[_0x2af276];return _0x4c586e;};'use strict';var Sequelize=require(_0xdff6('0x0'));module[_0xdff6('0x1')]={'name':{'type':Sequelize[_0xdff6('0x2')],'get':function(_0x5c944d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xdff6('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xdff6('0x5')](_0xdff6('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'stamp':{'type':_0xdff6('0x7'),'defaultValue':Sequelize[_0xdff6('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x6dea=['INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3ea5e1,_0x17c486){var _0x1b81d7=function(_0x5af999){while(--_0x5af999){_0x3ea5e1['push'](_0x3ea5e1['shift']());}};_0x1b81d7(++_0x17c486);}(_0x6dea,0x1d6));var _0xa6de=function(_0x2ef4ff,_0x3e2335){_0x2ef4ff=_0x2ef4ff-0x0;var _0x57a6f2=_0x6dea[_0x2ef4ff];return _0x57a6f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5272f6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa6de('0x0')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'context':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'recording':{'type':Sequelize[_0xa6de('0x2')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa6de('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa6de('0x3')](_0xa6de('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 091464c..e7da3b5 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 _0x5cca=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','sendStatus','name','map','VoiceMailMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','.wav\x22','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cca,0x116));var _0xa5cc=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0x5cca[_0x77e7e8];return _0x205a3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5cc('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa5cc('0x2'));var util=require(_0xa5cc('0x3'));var path=require(_0xa5cc('0x4'));var sox=require(_0xa5cc('0x5'));var csv=require(_0xa5cc('0x6'));var ejs=require(_0xa5cc('0x7'));var fs=require('fs');var fs_extra=require(_0xa5cc('0x8'));var _=require('lodash');var squel=require(_0xa5cc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5cc('0xa'));var toCsv=require(_0xa5cc('0x6'));var querystring=require(_0xa5cc('0xb'));var Papa=require(_0xa5cc('0xc'));var Redis=require(_0xa5cc('0xd'));var authService=require(_0xa5cc('0xe'));var qs=require(_0xa5cc('0xf'));var as=require(_0xa5cc('0x10'));var hardwareService=require(_0xa5cc('0x11'));var logger=require(_0xa5cc('0x12'))(_0xa5cc('0x13'));var utils=require(_0xa5cc('0x14'));var config=require(_0xa5cc('0x15'));var licenseUtil=require(_0xa5cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x205df7,_0x545790){_0x545790=_0x545790||0xcc;return function(_0x3e9d95){if(_0x3e9d95){return _0x205df7['sendStatus'](_0x545790);}return _0x205df7['status'](_0x545790)[_0xa5cc('0x17')]();};}function respondWithResult(_0x399ca3,_0x1cc9be){_0x1cc9be=_0x1cc9be||0xc8;return function(_0x12fb45){if(_0x12fb45){return _0x399ca3['status'](_0x1cc9be)['json'](_0x12fb45);}};}function respondWithFilteredResult(_0x1c5602,_0x3a6c8a){return function(_0x3f3967){if(_0x3f3967){var _0x123ff7=typeof _0x3a6c8a['offset']===_0xa5cc('0x18')&&typeof _0x3a6c8a[_0xa5cc('0x19')]==='undefined';var _0x8ad55d=_0x3f3967[_0xa5cc('0x1a')];var _0x53ab49=_0x123ff7?0x0:_0x3a6c8a[_0xa5cc('0x1b')];var _0x48aeba=_0x123ff7?_0x3f3967['count']:_0x3a6c8a[_0xa5cc('0x1b')]+_0x3a6c8a[_0xa5cc('0x19')];var _0xf4bff;if(_0x48aeba>=_0x8ad55d){_0x48aeba=_0x8ad55d;_0xf4bff=0xc8;}else{_0xf4bff=0xce;}_0x1c5602[_0xa5cc('0x1c')](_0xf4bff);return _0x1c5602[_0xa5cc('0x1d')](_0xa5cc('0x1e'),_0x53ab49+'-'+_0x48aeba+'/'+_0x8ad55d)['json'](_0x3f3967);}return null;};}function patchUpdates(_0x2dd3a0){return function(_0x796ac2){try{jsonpatch['apply'](_0x796ac2,_0x2dd3a0,!![]);}catch(_0x3d0ac6){return BPromise['reject'](_0x3d0ac6);}return _0x796ac2['save']();};}function saveUpdates(_0x47a213,_0x32ca8f){return function(_0x348ce4){if(_0x348ce4){return _0x348ce4[_0xa5cc('0x1f')](_0x47a213)[_0xa5cc('0x20')](function(_0x107c61){return _0x107c61;});}return null;};}function removeEntity(_0x2a2c33,_0x2761ed){return function(_0x44eed8){if(_0x44eed8){return _0x44eed8[_0xa5cc('0x21')]()[_0xa5cc('0x20')](function(){_0x2a2c33[_0xa5cc('0x1c')](0xcc)[_0xa5cc('0x17')]();});}};}function handleEntityNotFound(_0x2a2e37,_0x57fe7d){return function(_0x3877dc){if(!_0x3877dc){_0x2a2e37[_0xa5cc('0x22')](0x194);}return _0x3877dc;};}function handleError(_0x289dbd,_0x40118b){_0x40118b=_0x40118b||0x1f4;return function(_0x2802ca){logger['error'](_0x2802ca['stack']);if(_0x2802ca[_0xa5cc('0x23')]){delete _0x2802ca['name'];}_0x289dbd[_0xa5cc('0x1c')](_0x40118b)['send'](_0x2802ca);};}exports['index']=function(_0x46ca99,_0x4102ca){var _0xf72ff7={},_0x3d1a4f={},_0x412bb4={'count':0x0,'rows':[]};var _0x5b4031=_[_0xa5cc('0x24')](db[_0xa5cc('0x25')][_0xa5cc('0x26')],function(_0xbc3b1f){return{'name':_0xbc3b1f[_0xa5cc('0x27')],'type':_0xbc3b1f[_0xa5cc('0x28')]['key']};});_0x3d1a4f[_0xa5cc('0x29')]=_['differenceBy'](_[_0xa5cc('0x24')](_0x5b4031,_0xa5cc('0x23')),[_0xa5cc('0x23')]);_0x3d1a4f[_0xa5cc('0x2a')]=_['keys'](_0x46ca99[_0xa5cc('0x2a')]);_0x3d1a4f[_0xa5cc('0x2b')]=_[_0xa5cc('0x2c')](_0x3d1a4f[_0xa5cc('0x29')],_0x3d1a4f['query']);_0xf72ff7['attributes']=_['intersection'](_0x3d1a4f['model'],qs[_0xa5cc('0x2d')](_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x2d')]));_0xf72ff7[_0xa5cc('0x2e')]=_0xf72ff7[_0xa5cc('0x2e')][_0xa5cc('0x2f')]?_0xf72ff7[_0xa5cc('0x2e')]:_0x3d1a4f[_0xa5cc('0x29')];if(!_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x30')](_0xa5cc('0x31'))){_0xf72ff7[_0xa5cc('0x19')]=qs['limit'](_0x46ca99['query'][_0xa5cc('0x19')]);_0xf72ff7['offset']=qs['offset'](_0x46ca99['query']['offset']);}_0xf72ff7['order']=qs[_0xa5cc('0x32')](_0x46ca99['query'][_0xa5cc('0x32')]);_0xf72ff7[_0xa5cc('0x33')]=qs['filters'](_[_0xa5cc('0x34')](_0x46ca99[_0xa5cc('0x2a')],_0x3d1a4f[_0xa5cc('0x2b')]),_0x5b4031);if(_0x46ca99['query'][_0xa5cc('0x35')]){_0xf72ff7[_0xa5cc('0x33')]=_[_0xa5cc('0x36')](_0xf72ff7[_0xa5cc('0x33')],{'$or':_[_0xa5cc('0x24')](_0x5b4031,function(_0x4d8d04){if(_0x4d8d04[_0xa5cc('0x28')]!=='VIRTUAL'){var _0x3dbc0f={};_0x3dbc0f[_0x4d8d04[_0xa5cc('0x23')]]={'$like':'%'+_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x35')]+'%'};return _0x3dbc0f;}})});}_0xf72ff7=_[_0xa5cc('0x36')]({},_0xf72ff7,_0x46ca99[_0xa5cc('0x37')]);var _0x3c2507={'where':_0xf72ff7['where']};return db['VoiceMailMessage'][_0xa5cc('0x1a')](_0x3c2507)[_0xa5cc('0x20')](function(_0x21c16c){_0x412bb4[_0xa5cc('0x1a')]=_0x21c16c;if(_0x46ca99['query']['includeAll']){_0xf72ff7[_0xa5cc('0x38')]=[{'all':!![]}];}return db[_0xa5cc('0x25')][_0xa5cc('0x39')](_0xf72ff7);})['then'](function(_0x23a75b){_0x412bb4[_0xa5cc('0x3a')]=_0x23a75b;return _0x412bb4;})[_0xa5cc('0x20')](respondWithFilteredResult(_0x4102ca,_0xf72ff7))[_0xa5cc('0x3b')](handleError(_0x4102ca,null));};exports['show']=function(_0x49443b,_0x486168){var _0x39e0c8={'raw':!![],'where':{'id':_0x49443b[_0xa5cc('0x3c')]['id']}},_0x28efe5={};_0x28efe5['model']=_[_0xa5cc('0x3d')](db['VoiceMailMessage']['rawAttributes']);_0x28efe5[_0xa5cc('0x2a')]=_[_0xa5cc('0x3d')](_0x49443b['query']);_0x28efe5['filters']=_[_0xa5cc('0x2c')](_0x28efe5['model'],_0x28efe5[_0xa5cc('0x2a')]);_0x39e0c8[_0xa5cc('0x2e')]=_[_0xa5cc('0x2c')](_0x28efe5[_0xa5cc('0x29')],qs['fields'](_0x49443b[_0xa5cc('0x2a')]['fields']));_0x39e0c8['attributes']=_0x39e0c8[_0xa5cc('0x2e')]['length']?_0x39e0c8[_0xa5cc('0x2e')]:_0x28efe5['model'];if(_0x49443b[_0xa5cc('0x2a')][_0xa5cc('0x3e')]){_0x39e0c8[_0xa5cc('0x38')]=[{'all':!![]}];}_0x39e0c8=_['merge']({},_0x39e0c8,_0x49443b['options']);return db['VoiceMailMessage'][_0xa5cc('0x3f')](_0x39e0c8)[_0xa5cc('0x20')](handleEntityNotFound(_0x486168,null))['then'](respondWithResult(_0x486168,null))[_0xa5cc('0x3b')](handleError(_0x486168,null));};exports[_0xa5cc('0x40')]=function(_0x4ad317,_0x305844){return db['VoiceMailMessage']['create'](_0x4ad317[_0xa5cc('0x41')],{})['then'](respondWithResult(_0x305844,0xc9))['catch'](handleError(_0x305844,null));};exports[_0xa5cc('0x1f')]=function(_0x3a02d5,_0x3b4772){if(_0x3a02d5['body']['id']){delete _0x3a02d5[_0xa5cc('0x41')]['id'];}return db['VoiceMailMessage'][_0xa5cc('0x3f')]({'where':{'id':_0x3a02d5[_0xa5cc('0x3c')]['id']}})[_0xa5cc('0x20')](handleEntityNotFound(_0x3b4772,null))[_0xa5cc('0x20')](saveUpdates(_0x3a02d5['body'],null))[_0xa5cc('0x20')](respondWithResult(_0x3b4772,null))[_0xa5cc('0x3b')](handleError(_0x3b4772,null));};exports['destroy']=function(_0x24b449,_0x1e563e){return db[_0xa5cc('0x25')][_0xa5cc('0x3f')]({'where':{'id':_0x24b449[_0xa5cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1e563e,null))['then'](removeEntity(_0x1e563e,null))[_0xa5cc('0x3b')](handleError(_0x1e563e,null));};exports[_0xa5cc('0x42')]=function(_0x3e2577,_0xf3f189,_0x5b27e2){return db[_0xa5cc('0x25')][_0xa5cc('0x3f')]({'where':{'id':_0x3e2577['params']['id']},'attributes':['id',_0xa5cc('0x43'),_0xa5cc('0x44')]})['then'](handleEntityNotFound(_0xf3f189,null))[_0xa5cc('0x20')](function(_0x45c395){if(_0x45c395){if(!_0x45c395['recording']){throw new db[(_0xa5cc('0x45'))]['ValidationError'](_0xa5cc('0x46'));}var _0x5f7061={'Content-Type':'audio/wav','Content-Disposition':_0xa5cc('0x47')};if(_0x45c395[_0xa5cc('0x44')]){_0x5f7061['Content-Disposition']='attachment;\x20filename=\x22'+_0x45c395[_0xa5cc('0x44')]+_0xa5cc('0x48');}_0xf3f189[_0xa5cc('0x1d')](_0x5f7061);return _0xf3f189['send'](new Buffer(_0x45c395[_0xa5cc('0x43')]));}})[_0xa5cc('0x3b')](handleError(_0xf3f189,null));}; \ No newline at end of file +var _0x823d=['query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','rows','catch','show','params','rawAttributes','include','find','create','update','body','destroy','download','recording','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','set','json','apply','reject','then','error','stack','name','index','map','VoiceMailMessage','fieldName','type','key','differenceBy'];(function(_0xdfbefd,_0x5916b2){var _0x2b7fb2=function(_0xb06b7f){while(--_0xb06b7f){_0xdfbefd['push'](_0xdfbefd['shift']());}};_0x2b7fb2(++_0x5916b2);}(_0x823d,0xce));var _0xd823=function(_0x208cf0,_0x486665){_0x208cf0=_0x208cf0-0x0;var _0x372d0d=_0x823d[_0x208cf0];return _0x372d0d;};'use strict';var emlformat=require(_0xd823('0x0'));var rimraf=require(_0xd823('0x1'));var zipdir=require(_0xd823('0x2'));var jsonpatch=require(_0xd823('0x3'));var rp=require('request-promise');var moment=require(_0xd823('0x4'));var BPromise=require(_0xd823('0x5'));var Mustache=require(_0xd823('0x6'));var util=require(_0xd823('0x7'));var path=require(_0xd823('0x8'));var sox=require(_0xd823('0x9'));var csv=require(_0xd823('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd823('0xb'));var squel=require(_0xd823('0xc'));var crypto=require(_0xd823('0xd'));var jsforce=require(_0xd823('0xe'));var deskjs=require(_0xd823('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd823('0x10'));var Papa=require('papaparse');var Redis=require(_0xd823('0x11'));var authService=require(_0xd823('0x12'));var qs=require(_0xd823('0x13'));var as=require(_0xd823('0x14'));var hardwareService=require(_0xd823('0x15'));var logger=require(_0xd823('0x16'))(_0xd823('0x17'));var utils=require('../../config/utils');var config=require(_0xd823('0x18'));var licenseUtil=require(_0xd823('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15b19f,_0x465be5){_0x465be5=_0x465be5||0xcc;return function(_0x28051b){if(_0x28051b){return _0x15b19f[_0xd823('0x1a')](_0x465be5);}return _0x15b19f['status'](_0x465be5)[_0xd823('0x1b')]();};}function respondWithResult(_0x5b0a1e,_0x5a1151){_0x5a1151=_0x5a1151||0xc8;return function(_0x4e2ee7){if(_0x4e2ee7){return _0x5b0a1e[_0xd823('0x1c')](_0x5a1151)['json'](_0x4e2ee7);}};}function respondWithFilteredResult(_0x1cc1d8,_0x1984ca){return function(_0x128174){if(_0x128174){var _0x2d3efd=typeof _0x1984ca[_0xd823('0x1d')]===_0xd823('0x1e')&&typeof _0x1984ca['limit']===_0xd823('0x1e');var _0x292bd1=_0x128174['count'];var _0x58ce14=_0x2d3efd?0x0:_0x1984ca['offset'];var _0x30d64d=_0x2d3efd?_0x128174['count']:_0x1984ca[_0xd823('0x1d')]+_0x1984ca['limit'];var _0x2fe7ed;if(_0x30d64d>=_0x292bd1){_0x30d64d=_0x292bd1;_0x2fe7ed=0xc8;}else{_0x2fe7ed=0xce;}_0x1cc1d8[_0xd823('0x1c')](_0x2fe7ed);return _0x1cc1d8[_0xd823('0x1f')]('Content-Range',_0x58ce14+'-'+_0x30d64d+'/'+_0x292bd1)[_0xd823('0x20')](_0x128174);}return null;};}function patchUpdates(_0x3ca126){return function(_0x6617b4){try{jsonpatch[_0xd823('0x21')](_0x6617b4,_0x3ca126,!![]);}catch(_0x598dae){return BPromise[_0xd823('0x22')](_0x598dae);}return _0x6617b4['save']();};}function saveUpdates(_0x50c8ad,_0x5a943f){return function(_0x3f3878){if(_0x3f3878){return _0x3f3878['update'](_0x50c8ad)[_0xd823('0x23')](function(_0x44cf93){return _0x44cf93;});}return null;};}function removeEntity(_0x3f9ce,_0x23f1ec){return function(_0xf98f94){if(_0xf98f94){return _0xf98f94['destroy']()['then'](function(){_0x3f9ce[_0xd823('0x1c')](0xcc)[_0xd823('0x1b')]();});}};}function handleEntityNotFound(_0xed5f42,_0x197a9b){return function(_0x3bf295){if(!_0x3bf295){_0xed5f42[_0xd823('0x1a')](0x194);}return _0x3bf295;};}function handleError(_0x283b18,_0xb74ca6){_0xb74ca6=_0xb74ca6||0x1f4;return function(_0x1cd31b){logger[_0xd823('0x24')](_0x1cd31b[_0xd823('0x25')]);if(_0x1cd31b[_0xd823('0x26')]){delete _0x1cd31b[_0xd823('0x26')];}_0x283b18[_0xd823('0x1c')](_0xb74ca6)['send'](_0x1cd31b);};}exports[_0xd823('0x27')]=function(_0x17d2b4,_0x19a2ce){var _0x331983={},_0x14c0a9={},_0x344c53={'count':0x0,'rows':[]};var _0x505b3f=_[_0xd823('0x28')](db[_0xd823('0x29')]['rawAttributes'],function(_0x42f76c){return{'name':_0x42f76c[_0xd823('0x2a')],'type':_0x42f76c[_0xd823('0x2b')][_0xd823('0x2c')]};});_0x14c0a9['model']=_[_0xd823('0x2d')](_[_0xd823('0x28')](_0x505b3f,_0xd823('0x26')),[_0xd823('0x26')]);_0x14c0a9[_0xd823('0x2e')]=_[_0xd823('0x2f')](_0x17d2b4[_0xd823('0x2e')]);_0x14c0a9[_0xd823('0x30')]=_[_0xd823('0x31')](_0x14c0a9['model'],_0x14c0a9['query']);_0x331983[_0xd823('0x32')]=_[_0xd823('0x31')](_0x14c0a9[_0xd823('0x33')],qs[_0xd823('0x34')](_0x17d2b4[_0xd823('0x2e')][_0xd823('0x34')]));_0x331983[_0xd823('0x32')]=_0x331983[_0xd823('0x32')][_0xd823('0x35')]?_0x331983[_0xd823('0x32')]:_0x14c0a9[_0xd823('0x33')];if(!_0x17d2b4['query'][_0xd823('0x36')](_0xd823('0x37'))){_0x331983[_0xd823('0x38')]=qs[_0xd823('0x38')](_0x17d2b4[_0xd823('0x2e')][_0xd823('0x38')]);_0x331983[_0xd823('0x1d')]=qs[_0xd823('0x1d')](_0x17d2b4[_0xd823('0x2e')]['offset']);}_0x331983['order']=qs[_0xd823('0x39')](_0x17d2b4[_0xd823('0x2e')][_0xd823('0x39')]);_0x331983[_0xd823('0x3a')]=qs[_0xd823('0x30')](_[_0xd823('0x3b')](_0x17d2b4[_0xd823('0x2e')],_0x14c0a9[_0xd823('0x30')]),_0x505b3f);if(_0x17d2b4[_0xd823('0x2e')][_0xd823('0x3c')]){_0x331983[_0xd823('0x3a')]=_['merge'](_0x331983[_0xd823('0x3a')],{'$or':_[_0xd823('0x28')](_0x505b3f,function(_0x44706b){if(_0x44706b[_0xd823('0x2b')]!==_0xd823('0x3d')){var _0x4b9423={};_0x4b9423[_0x44706b[_0xd823('0x26')]]={'$like':'%'+_0x17d2b4[_0xd823('0x2e')][_0xd823('0x3c')]+'%'};return _0x4b9423;}})});}_0x331983=_[_0xd823('0x3e')]({},_0x331983,_0x17d2b4[_0xd823('0x3f')]);var _0x16baad={'where':_0x331983['where']};return db[_0xd823('0x29')][_0xd823('0x40')](_0x16baad)[_0xd823('0x23')](function(_0x166e21){_0x344c53['count']=_0x166e21;if(_0x17d2b4[_0xd823('0x2e')]['includeAll']){_0x331983['include']=[{'all':!![]}];}return db[_0xd823('0x29')]['findAll'](_0x331983);})[_0xd823('0x23')](function(_0x7c00a){_0x344c53[_0xd823('0x41')]=_0x7c00a;return _0x344c53;})[_0xd823('0x23')](respondWithFilteredResult(_0x19a2ce,_0x331983))[_0xd823('0x42')](handleError(_0x19a2ce,null));};exports[_0xd823('0x43')]=function(_0x3767f4,_0x50e3ed){var _0x5e05e1={'raw':!![],'where':{'id':_0x3767f4[_0xd823('0x44')]['id']}},_0x53c54e={};_0x53c54e[_0xd823('0x33')]=_[_0xd823('0x2f')](db[_0xd823('0x29')][_0xd823('0x45')]);_0x53c54e[_0xd823('0x2e')]=_['keys'](_0x3767f4['query']);_0x53c54e[_0xd823('0x30')]=_['intersection'](_0x53c54e[_0xd823('0x33')],_0x53c54e[_0xd823('0x2e')]);_0x5e05e1[_0xd823('0x32')]=_[_0xd823('0x31')](_0x53c54e[_0xd823('0x33')],qs[_0xd823('0x34')](_0x3767f4[_0xd823('0x2e')][_0xd823('0x34')]));_0x5e05e1['attributes']=_0x5e05e1[_0xd823('0x32')][_0xd823('0x35')]?_0x5e05e1[_0xd823('0x32')]:_0x53c54e[_0xd823('0x33')];if(_0x3767f4[_0xd823('0x2e')]['includeAll']){_0x5e05e1[_0xd823('0x46')]=[{'all':!![]}];}_0x5e05e1=_[_0xd823('0x3e')]({},_0x5e05e1,_0x3767f4[_0xd823('0x3f')]);return db['VoiceMailMessage'][_0xd823('0x47')](_0x5e05e1)[_0xd823('0x23')](handleEntityNotFound(_0x50e3ed,null))['then'](respondWithResult(_0x50e3ed,null))['catch'](handleError(_0x50e3ed,null));};exports[_0xd823('0x48')]=function(_0x15c2b5,_0x223f89){return db[_0xd823('0x29')]['create'](_0x15c2b5['body'],{})['then'](respondWithResult(_0x223f89,0xc9))['catch'](handleError(_0x223f89,null));};exports[_0xd823('0x49')]=function(_0x28ddf3,_0x2bd12f){if(_0x28ddf3[_0xd823('0x4a')]['id']){delete _0x28ddf3[_0xd823('0x4a')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x28ddf3['params']['id']}})[_0xd823('0x23')](handleEntityNotFound(_0x2bd12f,null))[_0xd823('0x23')](saveUpdates(_0x28ddf3[_0xd823('0x4a')],null))[_0xd823('0x23')](respondWithResult(_0x2bd12f,null))[_0xd823('0x42')](handleError(_0x2bd12f,null));};exports[_0xd823('0x4b')]=function(_0x1ba9c1,_0x6ce950){return db[_0xd823('0x29')][_0xd823('0x47')]({'where':{'id':_0x1ba9c1[_0xd823('0x44')]['id']}})[_0xd823('0x23')](handleEntityNotFound(_0x6ce950,null))[_0xd823('0x23')](removeEntity(_0x6ce950,null))['catch'](handleError(_0x6ce950,null));};exports[_0xd823('0x4c')]=function(_0x42b06c,_0x367953,_0x98d8c){return db[_0xd823('0x29')][_0xd823('0x47')]({'where':{'id':_0x42b06c['params']['id']},'attributes':['id',_0xd823('0x4d'),'msg_id']})['then'](handleEntityNotFound(_0x367953,null))[_0xd823('0x23')](function(_0xdde30c){if(_0xdde30c){if(!_0xdde30c[_0xd823('0x4d')]){throw new db['Sequelize']['ValidationError'](_0xd823('0x4e'));}var _0x41a1a0={'Content-Type':_0xd823('0x4f'),'Content-Disposition':'attachment'};if(_0xdde30c[_0xd823('0x50')]){_0x41a1a0[_0xd823('0x51')]=_0xd823('0x52')+_0xdde30c[_0xd823('0x50')]+_0xd823('0x53');}_0x367953[_0xd823('0x1f')](_0x41a1a0);return _0x367953['send'](new Buffer(_0xdde30c[_0xd823('0x4d')]));}})[_0xd823('0x42')](handleError(_0x367953,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 14057e4..5bb3c47 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 _0x6f15=['rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x12f5f7,_0xa58b52){var _0x345c1b=function(_0x306035){while(--_0x306035){_0x12f5f7['push'](_0x12f5f7['shift']());}};_0x345c1b(++_0xa58b52);}(_0x6f15,0xd2));var _0x56f1=function(_0x351246,_0x5a7b4e){_0x351246=_0x351246-0x0;var _0x2ec4ab=_0x6f15[_0x351246];return _0x2ec4ab;};'use strict';var _=require(_0x56f1('0x0'));var util=require(_0x56f1('0x1'));var logger=require(_0x56f1('0x2'))('api');var moment=require(_0x56f1('0x3'));var BPromise=require('bluebird');var rp=require(_0x56f1('0x4'));var fs=require('fs');var path=require(_0x56f1('0x5'));var rimraf=require(_0x56f1('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x56f1('0x7')]=function(_0x95d367,_0x5284cb){return _0x95d367[_0x56f1('0x8')](_0x56f1('0x9'),attributes,{'tableName':_0x56f1('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x56f1('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0663=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0663,0x16a));var _0x3066=function(_0x2ca1ff,_0x5ac0b0){_0x2ca1ff=_0x2ca1ff-0x0;var _0x4504fa=_0x0663[_0x2ca1ff];return _0x4504fa;};'use strict';var _=require('lodash');var util=require(_0x3066('0x0'));var logger=require(_0x3066('0x1'))(_0x3066('0x2'));var moment=require(_0x3066('0x3'));var BPromise=require(_0x3066('0x4'));var rp=require(_0x3066('0x5'));var fs=require('fs');var path=require(_0x3066('0x6'));var rimraf=require(_0x3066('0x7'));var config=require(_0x3066('0x8'));var attributes=require(_0x3066('0x9'));module[_0x3066('0xa')]=function(_0xefcda4,_0x29928c){return _0xefcda4[_0x3066('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x3066('0xc'),'paranoid':![],'indexes':[{'name':_0x3066('0xd'),'fields':[_0x3066('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 230599d..654b185 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 _0x25fa=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x384438,_0x228524){var _0xe475e9=function(_0xa107df){while(--_0xa107df){_0x384438['push'](_0x384438['shift']());}};_0xe475e9(++_0x228524);}(_0x25fa,0xc4));var _0xa25f=function(_0x609688,_0x44059d){_0x609688=_0x609688-0x0;var _0x46396d=_0x25fa[_0x609688];return _0x46396d;};'use strict';var _=require(_0xa25f('0x0'));var util=require(_0xa25f('0x1'));var moment=require(_0xa25f('0x2'));var BPromise=require(_0xa25f('0x3'));var rs=require(_0xa25f('0x4'));var fs=require('fs');var Redis=require(_0xa25f('0x5'));var db=require(_0xa25f('0x6'))['db'];var utils=require(_0xa25f('0x7'));var logger=require('../../config/logger')(_0xa25f('0x8'));var config=require(_0xa25f('0x9'));var jayson=require(_0xa25f('0xa'));var client=jayson[_0xa25f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a16e8,_0x590804,_0x15502c){return new BPromise(function(_0x7092d2,_0x5c9383){return client[_0xa25f('0xc')](_0x3a16e8,_0x15502c)['then'](function(_0x130c9b){logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x590804,'request\x20sent');logger['debug'](_0xa25f('0xf'),_0x590804,_0xa25f('0x10'),JSON[_0xa25f('0x11')](_0x130c9b));if(_0x130c9b[_0xa25f('0x12')]){if(_0x130c9b['error'][_0xa25f('0x13')]===0x1f4){logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);return _0x5c9383(_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);}logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);return _0x7092d2(_0x130c9b[_0xa25f('0x12')]['message']);}else{logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x590804,_0xa25f('0x10'));_0x7092d2(_0x130c9b[_0xa25f('0x15')][_0xa25f('0x14')]);}})['catch'](function(_0x2197dc){logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x2197dc);_0x5c9383(_0x2197dc);});});} \ No newline at end of file +var _0x8ee9=['moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x49b59f,_0x1f3a28){var _0x46f0de=function(_0x3841f1){while(--_0x3841f1){_0x49b59f['push'](_0x49b59f['shift']());}};_0x46f0de(++_0x1f3a28);}(_0x8ee9,0x129));var _0x98ee=function(_0x196db5,_0xc0dd0e){_0x196db5=_0x196db5-0x0;var _0xc196ed=_0x8ee9[_0x196db5];return _0xc196ed;};'use strict';var _=require(_0x98ee('0x0'));var util=require(_0x98ee('0x1'));var moment=require(_0x98ee('0x2'));var BPromise=require(_0x98ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ee('0x5'));var config=require(_0x98ee('0x6'));var jayson=require(_0x98ee('0x7'));var client=jayson[_0x98ee('0x8')][_0x98ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a976a,_0x4201da,_0x13a7c6){return new BPromise(function(_0x4b65e8,_0x406a40){return client[_0x98ee('0xa')](_0x2a976a,_0x13a7c6)[_0x98ee('0xb')](function(_0x5a007f){logger['info'](_0x98ee('0xc'),_0x4201da,'request\x20sent');logger[_0x98ee('0xd')](_0x98ee('0xe'),_0x4201da,_0x98ee('0xf'),JSON[_0x98ee('0x10')](_0x5a007f));if(_0x5a007f[_0x98ee('0x11')]){if(_0x5a007f[_0x98ee('0x11')][_0x98ee('0x12')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4201da,_0x5a007f[_0x98ee('0x11')]['message']);return _0x406a40(_0x5a007f[_0x98ee('0x11')][_0x98ee('0x13')]);}logger[_0x98ee('0x11')](_0x98ee('0xc'),_0x4201da,_0x5a007f[_0x98ee('0x11')][_0x98ee('0x13')]);return _0x4b65e8(_0x5a007f['error'][_0x98ee('0x13')]);}else{logger[_0x98ee('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x4201da,_0x98ee('0xf'));_0x4b65e8(_0x5a007f[_0x98ee('0x15')][_0x98ee('0x13')]);}})[_0x98ee('0x16')](function(_0x25a4f6){logger[_0x98ee('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x4201da,_0x25a4f6);_0x406a40(_0x25a4f6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index acb71ef..eea8d3a 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 _0x519a=['removeSound','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x519a,0x65));var _0xa519=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0x519a[_0xaf025d];return _0x1c77cb;};'use strict';var multer=require(_0xa519('0x0'));var util=require(_0xa519('0x1'));var path=require(_0xa519('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa519('0x3'));var auth=require(_0xa519('0x4'));var interaction=require(_0xa519('0x5'));var config=require('../../config/environment');var controller=require(_0xa519('0x6'));router[_0xa519('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa519('0x7')](_0xa519('0x8'),auth[_0xa519('0x9')](),controller[_0xa519('0xa')]);router[_0xa519('0x7')](_0xa519('0xb'),auth[_0xa519('0x9')](),controller[_0xa519('0xc')]);router[_0xa519('0xd')]('/',auth[_0xa519('0x9')](),controller[_0xa519('0xe')]);router[_0xa519('0xd')](_0xa519('0xb'),auth[_0xa519('0x9')](),controller['addSound']);router[_0xa519('0xf')](_0xa519('0x8'),auth[_0xa519('0x9')](),controller[_0xa519('0x10')]);router[_0xa519('0x11')]('/:id',auth[_0xa519('0x9')](),controller[_0xa519('0x12')]);router['delete']('/:id/sounds/:id2',auth[_0xa519('0x9')](),controller[_0xa519('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb6b6=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x1d0b74,_0x2b9295){var _0x1c18e7=function(_0x2c06e0){while(--_0x2c06e0){_0x1d0b74['push'](_0x1d0b74['shift']());}};_0x1c18e7(++_0x2b9295);}(_0xb6b6,0x19d));var _0x6b6b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb6b6[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x6b6b('0x0'));var util=require(_0x6b6b('0x1'));var path=require(_0x6b6b('0x2'));var timeout=require(_0x6b6b('0x3'));var express=require(_0x6b6b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b6b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6b6b('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x6b6b('0x7')]('/',auth[_0x6b6b('0x8')](),controller[_0x6b6b('0x9')]);router['get'](_0x6b6b('0xa'),auth[_0x6b6b('0x8')](),controller[_0x6b6b('0xb')]);router[_0x6b6b('0x7')](_0x6b6b('0xc'),auth['isAuthenticated'](),controller[_0x6b6b('0xd')]);router['post']('/',auth[_0x6b6b('0x8')](),controller[_0x6b6b('0xe')]);router['post'](_0x6b6b('0xc'),auth[_0x6b6b('0x8')](),controller[_0x6b6b('0xf')]);router[_0x6b6b('0x10')](_0x6b6b('0xa'),auth[_0x6b6b('0x8')](),controller[_0x6b6b('0x11')]);router[_0x6b6b('0x12')](_0x6b6b('0xa'),auth[_0x6b6b('0x8')](),controller[_0x6b6b('0x13')]);router[_0x6b6b('0x12')](_0x6b6b('0x14'),auth[_0x6b6b('0x8')](),controller[_0x6b6b('0x15')]);module[_0x6b6b('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8abf3fe..f89b5fc 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 _0x0ab1=['ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name'];(function(_0x33006f,_0x152441){var _0x215222=function(_0x1e1d78){while(--_0x1e1d78){_0x33006f['push'](_0x33006f['shift']());}};_0x215222(++_0x152441);}(_0x0ab1,0xcd));var _0x10ab=function(_0x57ae69,_0x2c5bf8){_0x57ae69=_0x57ae69-0x0;var _0x51b15a=_0x0ab1[_0x57ae69];return _0x51b15a;};'use strict';var Sequelize=require('sequelize');module[_0x10ab('0x0')]={'name':{'type':Sequelize[_0x10ab('0x1')],'allowNull':![],'unique':_0x10ab('0x2')},'mode':{'type':Sequelize[_0x10ab('0x3')](_0x10ab('0x4'),_0x10ab('0x5'),_0x10ab('0x6'),_0x10ab('0x7'),_0x10ab('0x8'),_0x10ab('0x9')),'allowNull':!![],'defaultValue':_0x10ab('0x5')},'directory':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![],'defaultValue':_0x10ab('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x10ab('0xb')},'defaultEntry':{'type':Sequelize[_0x10ab('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9301=['name','files','quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING'];(function(_0x2398f7,_0x999073){var _0x2c5cc4=function(_0x340fb0){while(--_0x340fb0){_0x2398f7['push'](_0x2398f7['shift']());}};_0x2c5cc4(++_0x999073);}(_0x9301,0x1bf));var _0x1930=function(_0x291461,_0x47f5c4){_0x291461=_0x291461-0x0;var _0x42370a=_0x9301[_0x291461];return _0x42370a;};'use strict';var Sequelize=require(_0x1930('0x0'));module[_0x1930('0x1')]={'name':{'type':Sequelize[_0x1930('0x2')],'allowNull':![],'unique':_0x1930('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x1930('0x4'),'mp3nb',_0x1930('0x5'),_0x1930('0x6'),_0x1930('0x7')),'allowNull':!![],'defaultValue':_0x1930('0x4')},'directory':{'type':Sequelize[_0x1930('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x1930('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1930('0x8')},'format':{'type':Sequelize[_0x1930('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x1930('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a332459..d900a14 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 _0xa85b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','symlinkSync','Sequelize','removeSound','id2','unlinkSync','order','hasOwnProperty','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','length','find','update','body','params','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','autoAssociation'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa85b,0x103));var _0xba85=function(_0x552a60,_0x42d26d){_0x552a60=_0x552a60-0x0;var _0x3730d1=_0xa85b[_0x552a60];return _0x3730d1;};'use strict';var emlformat=require(_0xba85('0x0'));var rimraf=require(_0xba85('0x1'));var zipdir=require(_0xba85('0x2'));var jsonpatch=require(_0xba85('0x3'));var rp=require('request-promise');var moment=require(_0xba85('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba85('0x5'));var util=require(_0xba85('0x6'));var path=require(_0xba85('0x7'));var sox=require(_0xba85('0x8'));var csv=require('to-csv');var ejs=require(_0xba85('0x9'));var fs=require('fs');var fs_extra=require(_0xba85('0xa'));var _=require(_0xba85('0xb'));var squel=require(_0xba85('0xc'));var crypto=require('crypto');var jsforce=require(_0xba85('0xd'));var deskjs=require(_0xba85('0xe'));var toCsv=require(_0xba85('0xf'));var querystring=require(_0xba85('0x10'));var Papa=require(_0xba85('0x11'));var Redis=require(_0xba85('0x12'));var authService=require(_0xba85('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba85('0x14'));var logger=require(_0xba85('0x15'))('api');var utils=require(_0xba85('0x16'));var config=require(_0xba85('0x17'));var licenseUtil=require(_0xba85('0x18'));var db=require(_0xba85('0x19'))['db'];function respondWithStatusCode(_0xf8cf0,_0x4349ee){_0x4349ee=_0x4349ee||0xcc;return function(_0x4e0dcb){if(_0x4e0dcb){return _0xf8cf0[_0xba85('0x1a')](_0x4349ee);}return _0xf8cf0['status'](_0x4349ee)[_0xba85('0x1b')]();};}function respondWithResult(_0x5c3672,_0x3dee15){_0x3dee15=_0x3dee15||0xc8;return function(_0x118384){if(_0x118384){return _0x5c3672[_0xba85('0x1c')](_0x3dee15)[_0xba85('0x1d')](_0x118384);}};}function respondWithFilteredResult(_0x3957a1,_0x1b31a8){return function(_0x524864){if(_0x524864){var _0x32a2d8=typeof _0x1b31a8[_0xba85('0x1e')]===_0xba85('0x1f')&&typeof _0x1b31a8[_0xba85('0x20')]===_0xba85('0x1f');var _0x3f84ff=_0x524864['count'];var _0x5f42fb=_0x32a2d8?0x0:_0x1b31a8[_0xba85('0x1e')];var _0x2f02ef=_0x32a2d8?_0x524864['count']:_0x1b31a8[_0xba85('0x1e')]+_0x1b31a8['limit'];var _0x2895a7;if(_0x2f02ef>=_0x3f84ff){_0x2f02ef=_0x3f84ff;_0x2895a7=0xc8;}else{_0x2895a7=0xce;}_0x3957a1[_0xba85('0x1c')](_0x2895a7);return _0x3957a1[_0xba85('0x21')](_0xba85('0x22'),_0x5f42fb+'-'+_0x2f02ef+'/'+_0x3f84ff)[_0xba85('0x1d')](_0x524864);}return null;};}function patchUpdates(_0x5e42c4){return function(_0x472e3d){try{jsonpatch[_0xba85('0x23')](_0x472e3d,_0x5e42c4,!![]);}catch(_0x376a03){return BPromise[_0xba85('0x24')](_0x376a03);}return _0x472e3d[_0xba85('0x25')]();};}function saveUpdates(_0x37c8a3,_0x355e9c){return function(_0x3b5866){if(_0x3b5866){return _0x3b5866['update'](_0x37c8a3)[_0xba85('0x26')](function(_0x1d1280){return _0x1d1280;});}return null;};}function removeEntity(_0x27d656,_0xd7ab24){return function(_0xcf454f){if(_0xcf454f){return _0xcf454f[_0xba85('0x27')]()[_0xba85('0x26')](function(){var _0x1382fe=_0xcf454f['get']({'plain':!![]});var _0x4a1572='MusicOnHolds';return db[_0xba85('0x28')][_0xba85('0x27')]({'where':{'type':_0x4a1572,'resourceId':_0x1382fe['id']}})[_0xba85('0x26')](function(){return _0xcf454f;});})[_0xba85('0x26')](function(){_0x27d656[_0xba85('0x1c')](0xcc)[_0xba85('0x1b')]();});}};}function handleEntityNotFound(_0xf962d,_0xef506c){return function(_0x44b3be){if(!_0x44b3be){_0xf962d[_0xba85('0x1a')](0x194);}return _0x44b3be;};}function handleError(_0x1d59a5,_0x252332){_0x252332=_0x252332||0x1f4;return function(_0x41c97e){logger[_0xba85('0x29')](_0x41c97e[_0xba85('0x2a')]);if(_0x41c97e[_0xba85('0x2b')]){delete _0x41c97e[_0xba85('0x2b')];}_0x1d59a5[_0xba85('0x1c')](_0x252332)[_0xba85('0x2c')](_0x41c97e);};}exports[_0xba85('0x2d')]=function(_0x2b1b18,_0x1df8ac){var _0x23bc42={},_0x12a63e={},_0x589a97={'count':0x0,'rows':[]};var _0x2a1ddd=_[_0xba85('0x2e')](db[_0xba85('0x2f')][_0xba85('0x30')],function(_0x176db1){return{'name':_0x176db1[_0xba85('0x31')],'type':_0x176db1[_0xba85('0x32')]['key']};});_0x12a63e[_0xba85('0x33')]=_[_0xba85('0x2e')](_0x2a1ddd,'name');_0x12a63e[_0xba85('0x34')]=_[_0xba85('0x35')](_0x2b1b18[_0xba85('0x34')]);_0x12a63e['filters']=_[_0xba85('0x36')](_0x12a63e[_0xba85('0x33')],_0x12a63e[_0xba85('0x34')]);_0x23bc42[_0xba85('0x37')]=_[_0xba85('0x36')](_0x12a63e['model'],qs[_0xba85('0x38')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x38')]));_0x23bc42[_0xba85('0x37')]=_0x23bc42[_0xba85('0x37')]['length']?_0x23bc42[_0xba85('0x37')]:_0x12a63e[_0xba85('0x33')];if(!_0x2b1b18[_0xba85('0x34')]['hasOwnProperty'](_0xba85('0x39'))){_0x23bc42[_0xba85('0x20')]=qs[_0xba85('0x20')](_0x2b1b18[_0xba85('0x34')]['limit']);_0x23bc42[_0xba85('0x1e')]=qs[_0xba85('0x1e')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x1e')]);}_0x23bc42['order']=qs[_0xba85('0x3a')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x3a')]);delete _0x2b1b18[_0xba85('0x34')][_0xba85('0x3a')];_0x23bc42[_0xba85('0x3b')]=qs[_0xba85('0x3c')](_[_0xba85('0x3d')](_0x2b1b18['query'],_0x12a63e['filters']),_0x2a1ddd);if(_0x2b1b18['query'][_0xba85('0x3e')]){_0x23bc42['where']=_['merge'](_0x23bc42[_0xba85('0x3b')],{'$or':_[_0xba85('0x2e')](_0x2a1ddd,function(_0x40d6fe){if(_0x40d6fe[_0xba85('0x32')]!==_0xba85('0x3f')){var _0x57f435={};_0x57f435[_0x40d6fe['name']]={'$like':'%'+_0x2b1b18[_0xba85('0x34')][_0xba85('0x3e')]+'%'};return _0x57f435;}})});}_0x23bc42=_[_0xba85('0x40')]({},_0x23bc42,_0x2b1b18[_0xba85('0x41')]);var _0x16e418={'where':_0x23bc42[_0xba85('0x3b')]};return db[_0xba85('0x2f')][_0xba85('0x42')](_0x16e418)[_0xba85('0x26')](function(_0x35aadf){_0x589a97[_0xba85('0x42')]=_0x35aadf;if(_0x2b1b18[_0xba85('0x34')][_0xba85('0x43')]){_0x23bc42[_0xba85('0x44')]=[{'all':!![]}];}return db[_0xba85('0x2f')][_0xba85('0x45')](_0x23bc42);})[_0xba85('0x26')](function(_0x25d267){_0x589a97['rows']=_0x25d267;return _0x589a97;})[_0xba85('0x26')](respondWithFilteredResult(_0x1df8ac,_0x23bc42))[_0xba85('0x46')](handleError(_0x1df8ac,null));};exports[_0xba85('0x47')]=function(_0x53ee59,_0x47f568){var _0x4ad17b={'raw':![],'where':{'id':_0x53ee59['params']['id']}},_0x24b797={};_0x24b797[_0xba85('0x33')]=_[_0xba85('0x35')](db[_0xba85('0x2f')]['rawAttributes']);_0x24b797[_0xba85('0x34')]=_[_0xba85('0x35')](_0x53ee59[_0xba85('0x34')]);_0x24b797['filters']=_[_0xba85('0x36')](_0x24b797['model'],_0x24b797[_0xba85('0x34')]);_0x4ad17b['attributes']=_[_0xba85('0x36')](_0x24b797[_0xba85('0x33')],qs[_0xba85('0x38')](_0x53ee59[_0xba85('0x34')][_0xba85('0x38')]));_0x4ad17b[_0xba85('0x37')]=_0x4ad17b[_0xba85('0x37')][_0xba85('0x48')]?_0x4ad17b[_0xba85('0x37')]:_0x24b797[_0xba85('0x33')];if(_0x53ee59['query'][_0xba85('0x43')]){_0x4ad17b[_0xba85('0x44')]=[{'all':!![]}];}_0x4ad17b=_['merge']({},_0x4ad17b,_0x53ee59[_0xba85('0x41')]);return db[_0xba85('0x2f')][_0xba85('0x49')](_0x4ad17b)[_0xba85('0x26')](handleEntityNotFound(_0x47f568,null))[_0xba85('0x26')](respondWithResult(_0x47f568,null))[_0xba85('0x46')](handleError(_0x47f568,null));};exports[_0xba85('0x4a')]=function(_0x4abee4,_0x169a54){if(_0x4abee4[_0xba85('0x4b')]['id']){delete _0x4abee4[_0xba85('0x4b')]['id'];}return db[_0xba85('0x2f')][_0xba85('0x49')]({'where':{'id':_0x4abee4[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x169a54,null))[_0xba85('0x26')](saveUpdates(_0x4abee4[_0xba85('0x4b')],null))[_0xba85('0x26')](respondWithResult(_0x169a54,null))[_0xba85('0x46')](handleError(_0x169a54,null));};exports[_0xba85('0x4d')]=function(_0x447113,_0x4a3407,_0x54dee3){return db[_0xba85('0x4e')][_0xba85('0x4f')](function(_0x204791){if(_0x447113[_0xba85('0x4b')]['mode']===_0xba85('0x50')){_0x447113[_0xba85('0x4b')]['directory']=path[_0xba85('0x51')](config[_0xba85('0x52')],_0xba85('0x53'),_0x447113[_0xba85('0x4b')][_0xba85('0x2b')]);}return db[_0xba85('0x2f')][_0xba85('0x4d')](_0x447113[_0xba85('0x4b')],{'transaction':_0x204791})[_0xba85('0x26')](function(_0x4d9c09){if(_0x447113[_0xba85('0x4b')][_0xba85('0x54')]===_0xba85('0x50')){fs[_0xba85('0x55')](_0x4d9c09[_0xba85('0x56')],parseInt(_0xba85('0x57'),0x8));}var _0x1571c2=_0x447113['user'][_0xba85('0x58')]({'plain':!![]});if(!_0x1571c2)throw new Error(_0xba85('0x59'));if(_0x1571c2[_0xba85('0x5a')]===_0xba85('0x5b')){var _0x33fe23=_0x4d9c09[_0xba85('0x58')]({'plain':!![]});return db[_0xba85('0x5c')]['find']({'where':{'name':_0xba85('0x5d'),'userProfileId':_0x1571c2['userProfileId']},'raw':!![]})[_0xba85('0x26')](function(_0xc028d){if(_0xc028d&&_0xc028d[_0xba85('0x5e')]===0x0){return db[_0xba85('0x28')][_0xba85('0x4d')]({'name':_0x33fe23[_0xba85('0x2b')],'resourceId':_0x33fe23['id'],'type':_0xc028d[_0xba85('0x2b')],'sectionId':_0xc028d['id']},{})[_0xba85('0x26')](function(){return _0x4d9c09;});}else{return _0x4d9c09;}})[_0xba85('0x46')](function(_0x240b4e){logger[_0xba85('0x29')](_0xba85('0x5f'),_0x240b4e);});}return _0x4d9c09;});})[_0xba85('0x26')](respondWithResult(_0x4a3407,0xc9))['catch'](handleError(_0x4a3407,null));};exports['destroy']=function(_0x4db135,_0x55ed05,_0x54c98e){var _0x35de64;return db[_0xba85('0x2f')]['find']({'where':{'id':_0x4db135['params']['id']}})[_0xba85('0x26')](function(_0x167ee6){if(_0x167ee6){return db[_0xba85('0x4e')]['transaction'](function(_0x178b6e){return _0x167ee6[_0xba85('0x27')]({'transaction':_0x178b6e,'raw':!![]})['then'](function(_0x189b9b){if(_0x189b9b[_0xba85('0x56')]){fs[_0xba85('0x60')](_0x189b9b[_0xba85('0x56')])[_0xba85('0x61')](function(_0x5d89c3){fs['unlinkSync'](path[_0xba85('0x51')](_0x189b9b[_0xba85('0x56')],_0x5d89c3));});fs['rmdirSync'](_0x189b9b[_0xba85('0x56')]);}return _0x189b9b;});})[_0xba85('0x46')](function(_0x24cdcd){throw new db['Sequelize'][(_0xba85('0x62'))](_0x24cdcd[_0xba85('0x63')]);});}})[_0xba85('0x26')](handleEntityNotFound(_0x55ed05,null))[_0xba85('0x26')](removeEntity(_0x55ed05,null))[_0xba85('0x46')](handleError(_0x55ed05,null));};exports['addSound']=function(_0xb64829,_0x50ade3,_0x23e348){return db[_0xba85('0x4e')][_0xba85('0x4f')](function(_0x156b7f){var _0x46922b;return db['VoiceMusicOnHold'][_0xba85('0x49')]({'where':{'id':_0xb64829[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](function(_0x40e838){if(_0x40e838){_0x46922b=_0x40e838;return _0x40e838[_0xba85('0x64')](_0xb64829['body']['id'],{'transaction':_0x156b7f});}})['then'](function(_0x38bf76){if(_0x38bf76){return db[_0xba85('0x65')][_0xba85('0x66')]({'where':{'id':_0xb64829[_0xba85('0x4b')]['id']},'attributes':['id',_0xba85('0x2b'),'save_name',_0xba85('0x67'),_0xba85('0x68')],'raw':!![]});}})[_0xba85('0x26')](function(_0x88af6a){if(_0x88af6a){var _0x1e2cfc=path[_0xba85('0x51')](config['root'],_0xba85('0x69'),util[_0xba85('0x6a')](_0xba85('0x6b'),path[_0xba85('0x6c')](_0x88af6a[_0xba85('0x6d')],path['extname'](_0x88af6a[_0xba85('0x6d')])),_0x88af6a[_0xba85('0x67')]));var _0x46dcc7=path['join'](config[_0xba85('0x52')],_0xba85('0x53'),_0x46922b['name'],util[_0xba85('0x6a')](_0xba85('0x6b'),_0x88af6a['name'],_0x88af6a['converted_format']));fs[_0xba85('0x6e')](_0x1e2cfc,_0x46dcc7);return _0x88af6a;}})['catch'](function(_0x57d585){throw new db[(_0xba85('0x6f'))][(_0xba85('0x62'))](_0x57d585[_0xba85('0x63')]);});})[_0xba85('0x26')](handleEntityNotFound(_0x50ade3,null))[_0xba85('0x26')](respondWithResult(_0x50ade3,0xc9))[_0xba85('0x46')](handleError(_0x50ade3,null));};exports[_0xba85('0x70')]=function(_0x1c5729,_0x48bd91,_0x3bf0b8){return db['sequelize'][_0xba85('0x4f')](function(_0x2e7636){var _0x5c6333;return db['VoiceMusicOnHold'][_0xba85('0x66')]({'where':{'id':_0x1c5729[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x48bd91,null))[_0xba85('0x26')](function(_0x1a889e){if(_0x1a889e){_0x5c6333=_0x1a889e;return _0x1a889e[_0xba85('0x70')](_0x1c5729[_0xba85('0x4c')]['id2']);}})[_0xba85('0x26')](function(_0x48d864){if(_0x48d864){return db['Sound']['findOne']({'where':{'id':_0x1c5729[_0xba85('0x4c')][_0xba85('0x71')]},'attributes':['id','name',_0xba85('0x6d'),_0xba85('0x67'),_0xba85('0x68')],'raw':!![]});}})[_0xba85('0x26')](function(_0x32166a){if(_0x32166a){fs[_0xba85('0x72')](path['join'](_0x5c6333[_0xba85('0x56')],util['format'](_0xba85('0x6b'),_0x32166a[_0xba85('0x2b')],_0x32166a[_0xba85('0x67')])));return _0x32166a;}})['catch'](function(_0x2ec01c){throw new db['Sequelize'][(_0xba85('0x62'))](_0x2ec01c['message']);});})[_0xba85('0x26')](handleEntityNotFound(_0x48bd91,null))[_0xba85('0x26')](respondWithStatusCode(_0x48bd91,0xcc))[_0xba85('0x46')](handleError(_0x48bd91,null));};exports['getSounds']=function(_0x2012f7,_0x5d7f2a,_0x3e6fd6){var _0x415a79={};var _0x183f20={};var _0x41cba2;var _0x350d28;return db[_0xba85('0x2f')]['findOne']({'where':{'id':_0x2012f7[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x5d7f2a,null))[_0xba85('0x26')](function(_0x29fbf4){if(_0x29fbf4){_0x41cba2=_0x29fbf4;_0x183f20['model']=_[_0xba85('0x35')](db[_0xba85('0x65')][_0xba85('0x30')]);_0x183f20['query']=_[_0xba85('0x35')](_0x2012f7['query']);_0x183f20['filters']=_[_0xba85('0x36')](_0x183f20['model'],_0x183f20['query']);_0x415a79[_0xba85('0x37')]=_[_0xba85('0x36')](_0x183f20[_0xba85('0x33')],qs[_0xba85('0x38')](_0x2012f7[_0xba85('0x34')][_0xba85('0x38')]));_0x415a79['attributes']=_0x415a79[_0xba85('0x37')][_0xba85('0x48')]?_0x415a79[_0xba85('0x37')]:_0x183f20['model'];_0x415a79[_0xba85('0x73')]=qs[_0xba85('0x3a')](_0x2012f7['query'][_0xba85('0x3a')]);_0x415a79[_0xba85('0x3b')]=qs[_0xba85('0x3c')](_[_0xba85('0x3d')](_0x2012f7[_0xba85('0x34')],_0x183f20[_0xba85('0x3c')]));if(_0x2012f7[_0xba85('0x34')][_0xba85('0x3e')]){_0x415a79[_0xba85('0x3b')]=_[_0xba85('0x40')](_0x415a79[_0xba85('0x3b')],{'$or':_[_0xba85('0x2e')](_0x415a79[_0xba85('0x37')],function(_0x21250b){var _0x4115dd={};_0x4115dd[_0x21250b]={'$like':'%'+_0x2012f7[_0xba85('0x34')][_0xba85('0x3e')]+'%'};return _0x4115dd;})});}_0x415a79=_['merge']({},_0x415a79,_0x2012f7[_0xba85('0x41')]);return _0x41cba2['getSounds'](_0x415a79);}})[_0xba85('0x26')](function(_0x3d13e8){if(_0x3d13e8){_0x350d28=_0x3d13e8[_0xba85('0x48')];if(!_0x2012f7[_0xba85('0x34')][_0xba85('0x74')](_0xba85('0x39'))){_0x415a79[_0xba85('0x20')]=qs[_0xba85('0x20')](_0x2012f7[_0xba85('0x34')]['limit']);_0x415a79[_0xba85('0x1e')]=qs[_0xba85('0x1e')](_0x2012f7[_0xba85('0x34')][_0xba85('0x1e')]);}return _0x41cba2[_0xba85('0x75')](_0x415a79);}})[_0xba85('0x26')](function(_0x572c0b){if(_0x572c0b){return _0x572c0b?{'count':_0x350d28,'rows':_0x572c0b}:null;}})['then'](respondWithResult(_0x5d7f2a,null))['catch'](handleError(_0x5d7f2a,null));}; \ No newline at end of file +var _0x756d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','params','body','create','sequelize','directory','root','server/files/moh','mode','files','mkdirSync','0777','user','userProfileId','transaction','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','extname','%s.%s','symlinkSync','message','removeSound','id2','getSounds','order','pick','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','fs-extra','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0x756d,0x12e));var _0xd756=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x756d[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xd756('0x0'));var rimraf=require(_0xd756('0x1'));var zipdir=require(_0xd756('0x2'));var jsonpatch=require(_0xd756('0x3'));var rp=require(_0xd756('0x4'));var moment=require(_0xd756('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd756('0x6'));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(_0xd756('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd756('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd756('0x9'));var toCsv=require(_0xd756('0xa'));var querystring=require(_0xd756('0xb'));var Papa=require(_0xd756('0xc'));var Redis=require(_0xd756('0xd'));var authService=require(_0xd756('0xe'));var qs=require(_0xd756('0xf'));var as=require(_0xd756('0x10'));var hardwareService=require(_0xd756('0x11'));var logger=require(_0xd756('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd756('0x13'));var licenseUtil=require(_0xd756('0x14'));var db=require(_0xd756('0x15'))['db'];function respondWithStatusCode(_0x518479,_0x49d002){_0x49d002=_0x49d002||0xcc;return function(_0x15ab6f){if(_0x15ab6f){return _0x518479['sendStatus'](_0x49d002);}return _0x518479[_0xd756('0x16')](_0x49d002)[_0xd756('0x17')]();};}function respondWithResult(_0x4fd64e,_0x5f1cbb){_0x5f1cbb=_0x5f1cbb||0xc8;return function(_0x428831){if(_0x428831){return _0x4fd64e[_0xd756('0x16')](_0x5f1cbb)[_0xd756('0x18')](_0x428831);}};}function respondWithFilteredResult(_0x50efaa,_0x8dc42b){return function(_0x3bf848){if(_0x3bf848){var _0x2bb3c1=typeof _0x8dc42b[_0xd756('0x19')]==='undefined'&&typeof _0x8dc42b[_0xd756('0x1a')]===_0xd756('0x1b');var _0x2b512b=_0x3bf848[_0xd756('0x1c')];var _0x204bbc=_0x2bb3c1?0x0:_0x8dc42b[_0xd756('0x19')];var _0x220214=_0x2bb3c1?_0x3bf848[_0xd756('0x1c')]:_0x8dc42b[_0xd756('0x19')]+_0x8dc42b['limit'];var _0x2945f8;if(_0x220214>=_0x2b512b){_0x220214=_0x2b512b;_0x2945f8=0xc8;}else{_0x2945f8=0xce;}_0x50efaa[_0xd756('0x16')](_0x2945f8);return _0x50efaa[_0xd756('0x1d')](_0xd756('0x1e'),_0x204bbc+'-'+_0x220214+'/'+_0x2b512b)[_0xd756('0x18')](_0x3bf848);}return null;};}function patchUpdates(_0x2d3e71){return function(_0x4e1036){try{jsonpatch[_0xd756('0x1f')](_0x4e1036,_0x2d3e71,!![]);}catch(_0x40f638){return BPromise[_0xd756('0x20')](_0x40f638);}return _0x4e1036[_0xd756('0x21')]();};}function saveUpdates(_0x32a3a2,_0x24cc72){return function(_0x3568f5){if(_0x3568f5){return _0x3568f5['update'](_0x32a3a2)[_0xd756('0x22')](function(_0x3e9be5){return _0x3e9be5;});}return null;};}function removeEntity(_0x8a5b5d,_0x3653ce){return function(_0x433c4d){if(_0x433c4d){return _0x433c4d[_0xd756('0x23')]()[_0xd756('0x22')](function(){var _0x12e989=_0x433c4d['get']({'plain':!![]});var _0x3ac95a=_0xd756('0x24');return db[_0xd756('0x25')]['destroy']({'where':{'type':_0x3ac95a,'resourceId':_0x12e989['id']}})[_0xd756('0x22')](function(){return _0x433c4d;});})[_0xd756('0x22')](function(){_0x8a5b5d[_0xd756('0x16')](0xcc)[_0xd756('0x17')]();});}};}function handleEntityNotFound(_0x4045eb,_0x2db318){return function(_0x1a8afc){if(!_0x1a8afc){_0x4045eb[_0xd756('0x26')](0x194);}return _0x1a8afc;};}function handleError(_0x33e18f,_0xcf7b87){_0xcf7b87=_0xcf7b87||0x1f4;return function(_0x27d3e0){logger[_0xd756('0x27')](_0x27d3e0[_0xd756('0x28')]);if(_0x27d3e0[_0xd756('0x29')]){delete _0x27d3e0[_0xd756('0x29')];}_0x33e18f[_0xd756('0x16')](_0xcf7b87)['send'](_0x27d3e0);};}exports[_0xd756('0x2a')]=function(_0x507ee7,_0x45dd1c){var _0xfa32b0={},_0x43e25a={},_0x44f5e9={'count':0x0,'rows':[]};var _0x4d9e77=_['map'](db[_0xd756('0x2b')][_0xd756('0x2c')],function(_0x134f88){return{'name':_0x134f88[_0xd756('0x2d')],'type':_0x134f88['type']['key']};});_0x43e25a[_0xd756('0x2e')]=_[_0xd756('0x2f')](_0x4d9e77,_0xd756('0x29'));_0x43e25a[_0xd756('0x30')]=_[_0xd756('0x31')](_0x507ee7[_0xd756('0x30')]);_0x43e25a[_0xd756('0x32')]=_['intersection'](_0x43e25a[_0xd756('0x2e')],_0x43e25a[_0xd756('0x30')]);_0xfa32b0[_0xd756('0x33')]=_[_0xd756('0x34')](_0x43e25a[_0xd756('0x2e')],qs[_0xd756('0x35')](_0x507ee7[_0xd756('0x30')][_0xd756('0x35')]));_0xfa32b0[_0xd756('0x33')]=_0xfa32b0[_0xd756('0x33')][_0xd756('0x36')]?_0xfa32b0['attributes']:_0x43e25a[_0xd756('0x2e')];if(!_0x507ee7[_0xd756('0x30')]['hasOwnProperty']('nolimit')){_0xfa32b0['limit']=qs['limit'](_0x507ee7[_0xd756('0x30')][_0xd756('0x1a')]);_0xfa32b0[_0xd756('0x19')]=qs[_0xd756('0x19')](_0x507ee7[_0xd756('0x30')][_0xd756('0x19')]);}_0xfa32b0['order']=qs['sort'](_0x507ee7[_0xd756('0x30')][_0xd756('0x37')]);delete _0x507ee7[_0xd756('0x30')][_0xd756('0x37')];_0xfa32b0[_0xd756('0x38')]=qs[_0xd756('0x32')](_['pick'](_0x507ee7['query'],_0x43e25a[_0xd756('0x32')]),_0x4d9e77);if(_0x507ee7[_0xd756('0x30')][_0xd756('0x39')]){_0xfa32b0[_0xd756('0x38')]=_['merge'](_0xfa32b0['where'],{'$or':_['map'](_0x4d9e77,function(_0x5511f9){if(_0x5511f9['type']!=='VIRTUAL'){var _0x524367={};_0x524367[_0x5511f9['name']]={'$like':'%'+_0x507ee7[_0xd756('0x30')][_0xd756('0x39')]+'%'};return _0x524367;}})});}_0xfa32b0=_[_0xd756('0x3a')]({},_0xfa32b0,_0x507ee7[_0xd756('0x3b')]);var _0x174577={'where':_0xfa32b0[_0xd756('0x38')]};return db[_0xd756('0x2b')][_0xd756('0x1c')](_0x174577)['then'](function(_0x32afaa){_0x44f5e9[_0xd756('0x1c')]=_0x32afaa;if(_0x507ee7[_0xd756('0x30')][_0xd756('0x3c')]){_0xfa32b0['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xd756('0x3d')](_0xfa32b0);})[_0xd756('0x22')](function(_0x4227fe){_0x44f5e9[_0xd756('0x3e')]=_0x4227fe;return _0x44f5e9;})['then'](respondWithFilteredResult(_0x45dd1c,_0xfa32b0))[_0xd756('0x3f')](handleError(_0x45dd1c,null));};exports[_0xd756('0x40')]=function(_0x1aa03d,_0x4f59e2){var _0x92787={'raw':![],'where':{'id':_0x1aa03d['params']['id']}},_0x48eaa5={};_0x48eaa5[_0xd756('0x2e')]=_[_0xd756('0x31')](db[_0xd756('0x2b')]['rawAttributes']);_0x48eaa5[_0xd756('0x30')]=_['keys'](_0x1aa03d[_0xd756('0x30')]);_0x48eaa5[_0xd756('0x32')]=_[_0xd756('0x34')](_0x48eaa5[_0xd756('0x2e')],_0x48eaa5['query']);_0x92787[_0xd756('0x33')]=_['intersection'](_0x48eaa5[_0xd756('0x2e')],qs[_0xd756('0x35')](_0x1aa03d['query']['fields']));_0x92787[_0xd756('0x33')]=_0x92787[_0xd756('0x33')][_0xd756('0x36')]?_0x92787[_0xd756('0x33')]:_0x48eaa5[_0xd756('0x2e')];if(_0x1aa03d['query'][_0xd756('0x3c')]){_0x92787[_0xd756('0x41')]=[{'all':!![]}];}_0x92787=_['merge']({},_0x92787,_0x1aa03d[_0xd756('0x3b')]);return db[_0xd756('0x2b')][_0xd756('0x42')](_0x92787)['then'](handleEntityNotFound(_0x4f59e2,null))[_0xd756('0x22')](respondWithResult(_0x4f59e2,null))[_0xd756('0x3f')](handleError(_0x4f59e2,null));};exports['update']=function(_0x22ca6b,_0x9642af){if(_0x22ca6b['body']['id']){delete _0x22ca6b['body']['id'];}return db[_0xd756('0x2b')][_0xd756('0x42')]({'where':{'id':_0x22ca6b[_0xd756('0x43')]['id']}})[_0xd756('0x22')](handleEntityNotFound(_0x9642af,null))[_0xd756('0x22')](saveUpdates(_0x22ca6b[_0xd756('0x44')],null))[_0xd756('0x22')](respondWithResult(_0x9642af,null))['catch'](handleError(_0x9642af,null));};exports[_0xd756('0x45')]=function(_0x3277bc,_0x45c09d,_0xf733c3){return db[_0xd756('0x46')]['transaction'](function(_0x148d8e){if(_0x3277bc['body']['mode']==='files'){_0x3277bc[_0xd756('0x44')][_0xd756('0x47')]=path['join'](config[_0xd756('0x48')],_0xd756('0x49'),_0x3277bc[_0xd756('0x44')][_0xd756('0x29')]);}return db['VoiceMusicOnHold'][_0xd756('0x45')](_0x3277bc[_0xd756('0x44')],{'transaction':_0x148d8e})['then'](function(_0x10fc65){if(_0x3277bc['body'][_0xd756('0x4a')]===_0xd756('0x4b')){fs[_0xd756('0x4c')](_0x10fc65[_0xd756('0x47')],parseInt(_0xd756('0x4d'),0x8));}var _0x30210b=_0x3277bc[_0xd756('0x4e')]['get']({'plain':!![]});if(!_0x30210b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30210b['role']==='user'){var _0x5ca2e0=_0x10fc65['get']({'plain':!![]});return db['UserProfileSection'][_0xd756('0x42')]({'where':{'name':_0xd756('0x24'),'userProfileId':_0x30210b[_0xd756('0x4f')]},'raw':!![]})['then'](function(_0x342e7c){if(_0x342e7c&&_0x342e7c['autoAssociation']===0x0){return db['UserProfileResource'][_0xd756('0x45')]({'name':_0x5ca2e0[_0xd756('0x29')],'resourceId':_0x5ca2e0['id'],'type':_0x342e7c[_0xd756('0x29')],'sectionId':_0x342e7c['id']},{})[_0xd756('0x22')](function(){return _0x10fc65;});}else{return _0x10fc65;}})['catch'](function(_0x39727c){logger[_0xd756('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39727c);});}return _0x10fc65;});})['then'](respondWithResult(_0x45c09d,0xc9))['catch'](handleError(_0x45c09d,null));};exports['destroy']=function(_0x384890,_0x42558a,_0x9970a7){var _0x18464e;return db['VoiceMusicOnHold'][_0xd756('0x42')]({'where':{'id':_0x384890[_0xd756('0x43')]['id']}})['then'](function(_0x5e0fde){if(_0x5e0fde){return db[_0xd756('0x46')][_0xd756('0x50')](function(_0x1defa1){return _0x5e0fde[_0xd756('0x23')]({'transaction':_0x1defa1,'raw':!![]})[_0xd756('0x22')](function(_0x1e106e){if(_0x1e106e['directory']){fs[_0xd756('0x51')](_0x1e106e[_0xd756('0x47')])['forEach'](function(_0x4e0a01){fs[_0xd756('0x52')](path[_0xd756('0x53')](_0x1e106e['directory'],_0x4e0a01));});fs[_0xd756('0x54')](_0x1e106e[_0xd756('0x47')]);}return _0x1e106e;});})[_0xd756('0x3f')](function(_0x5c178a){throw new db[(_0xd756('0x55'))][(_0xd756('0x56'))](_0x5c178a['message']);});}})[_0xd756('0x22')](handleEntityNotFound(_0x42558a,null))[_0xd756('0x22')](removeEntity(_0x42558a,null))[_0xd756('0x3f')](handleError(_0x42558a,null));};exports[_0xd756('0x57')]=function(_0x35257e,_0x29e633,_0x284a6f){return db[_0xd756('0x46')][_0xd756('0x50')](function(_0x15636f){var _0x31898c;return db[_0xd756('0x2b')][_0xd756('0x42')]({'where':{'id':_0x35257e[_0xd756('0x43')]['id']}})[_0xd756('0x22')](function(_0x14a5a6){if(_0x14a5a6){_0x31898c=_0x14a5a6;return _0x14a5a6[_0xd756('0x57')](_0x35257e[_0xd756('0x44')]['id'],{'transaction':_0x15636f});}})[_0xd756('0x22')](function(_0x5e73c5){if(_0x5e73c5){return db[_0xd756('0x58')][_0xd756('0x59')]({'where':{'id':_0x35257e[_0xd756('0x44')]['id']},'attributes':['id',_0xd756('0x29'),_0xd756('0x5a'),_0xd756('0x5b'),_0xd756('0x5c')],'raw':!![]});}})['then'](function(_0x1ef4d6){if(_0x1ef4d6){var _0x3b0343=path[_0xd756('0x53')](config['root'],_0xd756('0x5d'),util[_0xd756('0x5e')]('%s.%s',path['basename'](_0x1ef4d6[_0xd756('0x5a')],path[_0xd756('0x5f')](_0x1ef4d6[_0xd756('0x5a')])),_0x1ef4d6[_0xd756('0x5b')]));var _0x29c893=path[_0xd756('0x53')](config[_0xd756('0x48')],_0xd756('0x49'),_0x31898c[_0xd756('0x29')],util[_0xd756('0x5e')](_0xd756('0x60'),_0x1ef4d6[_0xd756('0x29')],_0x1ef4d6['converted_format']));fs[_0xd756('0x61')](_0x3b0343,_0x29c893);return _0x1ef4d6;}})[_0xd756('0x3f')](function(_0x4244b9){throw new db['Sequelize']['ValidationError'](_0x4244b9[_0xd756('0x62')]);});})[_0xd756('0x22')](handleEntityNotFound(_0x29e633,null))[_0xd756('0x22')](respondWithResult(_0x29e633,0xc9))[_0xd756('0x3f')](handleError(_0x29e633,null));};exports[_0xd756('0x63')]=function(_0x15653c,_0x2fba7f,_0x458018){return db[_0xd756('0x46')]['transaction'](function(_0x168b0d){var _0x27b621;return db[_0xd756('0x2b')][_0xd756('0x59')]({'where':{'id':_0x15653c[_0xd756('0x43')]['id']}})[_0xd756('0x22')](handleEntityNotFound(_0x2fba7f,null))[_0xd756('0x22')](function(_0x26460d){if(_0x26460d){_0x27b621=_0x26460d;return _0x26460d[_0xd756('0x63')](_0x15653c[_0xd756('0x43')][_0xd756('0x64')]);}})[_0xd756('0x22')](function(_0x6eb485){if(_0x6eb485){return db['Sound'][_0xd756('0x59')]({'where':{'id':_0x15653c[_0xd756('0x43')][_0xd756('0x64')]},'attributes':['id',_0xd756('0x29'),_0xd756('0x5a'),_0xd756('0x5b'),_0xd756('0x5c')],'raw':!![]});}})[_0xd756('0x22')](function(_0x43b90f){if(_0x43b90f){fs[_0xd756('0x52')](path[_0xd756('0x53')](_0x27b621[_0xd756('0x47')],util[_0xd756('0x5e')](_0xd756('0x60'),_0x43b90f[_0xd756('0x29')],_0x43b90f[_0xd756('0x5b')])));return _0x43b90f;}})[_0xd756('0x3f')](function(_0xf51774){throw new db[(_0xd756('0x55'))][(_0xd756('0x56'))](_0xf51774[_0xd756('0x62')]);});})[_0xd756('0x22')](handleEntityNotFound(_0x2fba7f,null))[_0xd756('0x22')](respondWithStatusCode(_0x2fba7f,0xcc))[_0xd756('0x3f')](handleError(_0x2fba7f,null));};exports[_0xd756('0x65')]=function(_0x12a8ee,_0x7ad286,_0x2c2123){var _0x5da78a={};var _0x40b997={};var _0x5d07f3;var _0x46dc02;return db[_0xd756('0x2b')][_0xd756('0x59')]({'where':{'id':_0x12a8ee['params']['id']}})[_0xd756('0x22')](handleEntityNotFound(_0x7ad286,null))[_0xd756('0x22')](function(_0x18f070){if(_0x18f070){_0x5d07f3=_0x18f070;_0x40b997[_0xd756('0x2e')]=_['keys'](db['Sound'][_0xd756('0x2c')]);_0x40b997[_0xd756('0x30')]=_[_0xd756('0x31')](_0x12a8ee[_0xd756('0x30')]);_0x40b997[_0xd756('0x32')]=_[_0xd756('0x34')](_0x40b997['model'],_0x40b997[_0xd756('0x30')]);_0x5da78a[_0xd756('0x33')]=_['intersection'](_0x40b997['model'],qs[_0xd756('0x35')](_0x12a8ee[_0xd756('0x30')][_0xd756('0x35')]));_0x5da78a['attributes']=_0x5da78a[_0xd756('0x33')]['length']?_0x5da78a[_0xd756('0x33')]:_0x40b997[_0xd756('0x2e')];_0x5da78a[_0xd756('0x66')]=qs[_0xd756('0x37')](_0x12a8ee[_0xd756('0x30')][_0xd756('0x37')]);_0x5da78a[_0xd756('0x38')]=qs[_0xd756('0x32')](_[_0xd756('0x67')](_0x12a8ee['query'],_0x40b997[_0xd756('0x32')]));if(_0x12a8ee['query']['filter']){_0x5da78a[_0xd756('0x38')]=_[_0xd756('0x3a')](_0x5da78a[_0xd756('0x38')],{'$or':_[_0xd756('0x2f')](_0x5da78a[_0xd756('0x33')],function(_0x229fde){var _0x2cd691={};_0x2cd691[_0x229fde]={'$like':'%'+_0x12a8ee['query'][_0xd756('0x39')]+'%'};return _0x2cd691;})});}_0x5da78a=_[_0xd756('0x3a')]({},_0x5da78a,_0x12a8ee[_0xd756('0x3b')]);return _0x5d07f3[_0xd756('0x65')](_0x5da78a);}})['then'](function(_0x524e17){if(_0x524e17){_0x46dc02=_0x524e17[_0xd756('0x36')];if(!_0x12a8ee[_0xd756('0x30')]['hasOwnProperty'](_0xd756('0x68'))){_0x5da78a[_0xd756('0x1a')]=qs[_0xd756('0x1a')](_0x12a8ee['query']['limit']);_0x5da78a[_0xd756('0x19')]=qs[_0xd756('0x19')](_0x12a8ee['query'][_0xd756('0x19')]);}return _0x5d07f3[_0xd756('0x65')](_0x5da78a);}})[_0xd756('0x22')](function(_0x4a672d){if(_0x4a672d){return _0x4a672d?{'count':_0x46dc02,'rows':_0x4a672d}:null;}})[_0xd756('0x22')](respondWithResult(_0x7ad286,null))[_0xd756('0x3f')](handleError(_0x7ad286,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5953c4a..2cfdb1b 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 _0x0418=['path','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0418,0xb9));var _0x8041=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0418[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8041('0x0'))(_0x8041('0x1'));var moment=require(_0x8041('0x2'));var BPromise=require(_0x8041('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8041('0x4'));var rimraf=require('rimraf');var config=require(_0x8041('0x5'));var attributes=require(_0x8041('0x6'));module['exports']=function(_0x4bebbe,_0x265b32){return _0x4bebbe[_0x8041('0x7')](_0x8041('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf0e=['api','bluebird','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcf0e,0x1ad));var _0xecf0=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xcf0e[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xecf0('0x0'));var util=require(_0xecf0('0x1'));var logger=require(_0xecf0('0x2'))(_0xecf0('0x3'));var moment=require('moment');var BPromise=require(_0xecf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecf0('0x5'));var rimraf=require(_0xecf0('0x6'));var config=require(_0xecf0('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xecf0('0x8')]=function(_0x32a9a0,_0x337be2){return _0x32a9a0[_0xecf0('0x9')](_0xecf0('0xa'),attributes,{'tableName':_0xecf0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 08a0cab..9bd8b3a 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(_0x2c1f47,_0x3cbcdf){var _0x24cdab=function(_0x1a154d){while(--_0x1a154d){_0x2c1f47['push'](_0x2c1f47['shift']());}};_0x24cdab(++_0x3cbcdf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xcb91[_0x498334];return _0x13bb70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5a6235,_0x24852a){var _0x24d0a9=function(_0x5eabae){while(--_0x5eabae){_0x5a6235['push'](_0x5a6235['shift']());}};_0x24d0a9(++_0x24852a);}(_0xe706,0xa3));var _0x6e70=function(_0x5d0725,_0x1ae8ad){_0x5d0725=_0x5d0725-0x0;var _0x157c30=_0xe706[_0x5d0725];return _0x157c30;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index cd7f99b..7d8c681 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 _0xebec=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','removeAgents','removeTeams'];(function(_0x4f75ca,_0x2f2e8f){var _0x54bb5f=function(_0x48ddbf){while(--_0x48ddbf){_0x4f75ca['push'](_0x4f75ca['shift']());}};_0x54bb5f(++_0x2f2e8f);}(_0xebec,0x135));var _0xcebe=function(_0x1a4ad1,_0x4df6a5){_0x1a4ad1=_0x1a4ad1-0x0;var _0x32b225=_0xebec[_0x1a4ad1];return _0x32b225;};'use strict';var multer=require(_0xcebe('0x0'));var util=require(_0xcebe('0x1'));var path=require(_0xcebe('0x2'));var timeout=require('connect-timeout');var express=require(_0xcebe('0x3'));var router=express[_0xcebe('0x4')]();var fs_extra=require(_0xcebe('0x5'));var auth=require(_0xcebe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcebe('0x7'));var controller=require(_0xcebe('0x8'));router[_0xcebe('0x9')]('/',auth[_0xcebe('0xa')](),controller[_0xcebe('0xb')]);router[_0xcebe('0x9')](_0xcebe('0xc'),auth[_0xcebe('0xa')](),controller[_0xcebe('0xd')]);router['get'](_0xcebe('0xe'),auth[_0xcebe('0xa')](),controller[_0xcebe('0xf')]);router[_0xcebe('0x9')](_0xcebe('0x10'),auth[_0xcebe('0xa')](),controller['getAgents']);router[_0xcebe('0x9')](_0xcebe('0x11'),auth[_0xcebe('0xa')](),controller[_0xcebe('0x12')]);router[_0xcebe('0x13')]('/',auth[_0xcebe('0xa')](),controller[_0xcebe('0x14')]);router[_0xcebe('0x13')](_0xcebe('0x10'),auth['isAuthenticated'](),controller[_0xcebe('0x15')]);router[_0xcebe('0x13')](_0xcebe('0x11'),auth[_0xcebe('0xa')](),controller[_0xcebe('0x16')]);router[_0xcebe('0x17')](_0xcebe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xcebe('0x18')](_0xcebe('0xe'),auth[_0xcebe('0xa')](),controller['destroy']);router['delete']('/:id/users',auth[_0xcebe('0xa')](),controller[_0xcebe('0x19')]);router['delete']('/:id/teams',auth[_0xcebe('0xa')](),controller[_0xcebe('0x1a')]);module[_0xcebe('0x1b')]=router; \ No newline at end of file +var _0x9335=['post','create','addAgents','addTeams','update','destroy','removeAgents','delete','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','/:id/teams','getTeams'];(function(_0x6a8cb3,_0xcc695f){var _0x14e37c=function(_0x395342){while(--_0x395342){_0x6a8cb3['push'](_0x6a8cb3['shift']());}};_0x14e37c(++_0xcc695f);}(_0x9335,0xab));var _0x5933=function(_0x7c6641,_0x380ba0){_0x7c6641=_0x7c6641-0x0;var _0x5ebe76=_0x9335[_0x7c6641];return _0x5ebe76;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./voicePrefix.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['describe']);router[_0x5933('0x9')](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0x9')](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x9')](_0x5933('0x10'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);router[_0x5933('0x12')]('/',auth['isAuthenticated'](),controller[_0x5933('0x13')]);router['post'](_0x5933('0xe'),auth[_0x5933('0xb')](),controller[_0x5933('0x14')]);router['post'](_0x5933('0x10'),auth['isAuthenticated'](),controller[_0x5933('0x15')]);router['put'](_0x5933('0xc'),auth['isAuthenticated'](),controller[_0x5933('0x16')]);router['delete'](_0x5933('0xc'),auth[_0x5933('0xb')](),controller[_0x5933('0x17')]);router['delete']('/:id/users',auth[_0x5933('0xb')](),controller[_0x5933('0x18')]);router[_0x5933('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5933('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1ea9509..09ec5ed 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 _0x9b6e=['name','system-','getDataValue','STRING','exports'];(function(_0x173a20,_0x57570f){var _0x1177f2=function(_0x305dbf){while(--_0x305dbf){_0x173a20['push'](_0x173a20['shift']());}};_0x1177f2(++_0x57570f);}(_0x9b6e,0x144));var _0xe9b6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9b6e[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0xe9b6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9b6('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4dd42d){return _0xe9b6('0x2')+this[_0xe9b6('0x3')](_0xe9b6('0x1'))+'-';}},'description':{'type':Sequelize[_0xe9b6('0x4')]},'callerIdAll':{'type':Sequelize[_0xe9b6('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd428=['name','INTEGER','sequelize','STRING','VIRTUAL','system-','getDataValue'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xd428,0x8e));var _0x8d42=function(_0x5656d8,_0x36b1f5){_0x5656d8=_0x5656d8-0x0;var _0xaf934f=_0xd428[_0x5656d8];return _0xaf934f;};'use strict';var Sequelize=require(_0x8d42('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d42('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x8d42('0x2')],'get':function(_0xbafeaa){return _0x8d42('0x3')+this[_0x8d42('0x4')](_0x8d42('0x5'))+'-';}},'description':{'type':Sequelize[_0x8d42('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x8d42('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 619208f..c25b287 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 _0xd914=['Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','type','system','description'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd914,0x17f));var _0x4d91=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xd914[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];config[_0x4d91('0x1b')]=_[_0x4d91('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d91('0x1d'))(new Redis(config[_0x4d91('0x1b')]));require(_0x4d91('0x1e'))[_0x4d91('0x1f')](socket);function respondWithStatusCode(_0x33fbd4,_0x25bafc){_0x25bafc=_0x25bafc||0xcc;return function(_0x36f606){if(_0x36f606){return _0x33fbd4['sendStatus'](_0x25bafc);}return _0x33fbd4[_0x4d91('0x20')](_0x25bafc)[_0x4d91('0x21')]();};}function respondWithResult(_0x1e2ef7,_0xb92681){_0xb92681=_0xb92681||0xc8;return function(_0x280e80){if(_0x280e80){return _0x1e2ef7['status'](_0xb92681)[_0x4d91('0x22')](_0x280e80);}};}function respondWithFilteredResult(_0xb75abf,_0x241564){return function(_0x44b9a7){if(_0x44b9a7){var _0x4cfa40=typeof _0x241564[_0x4d91('0x23')]===_0x4d91('0x24')&&typeof _0x241564[_0x4d91('0x25')]==='undefined';var _0x13ef2c=_0x44b9a7[_0x4d91('0x26')];var _0x351388=_0x4cfa40?0x0:_0x241564[_0x4d91('0x23')];var _0x10b767=_0x4cfa40?_0x44b9a7[_0x4d91('0x26')]:_0x241564[_0x4d91('0x23')]+_0x241564[_0x4d91('0x25')];var _0x30d911;if(_0x10b767>=_0x13ef2c){_0x10b767=_0x13ef2c;_0x30d911=0xc8;}else{_0x30d911=0xce;}_0xb75abf[_0x4d91('0x20')](_0x30d911);return _0xb75abf['set'](_0x4d91('0x27'),_0x351388+'-'+_0x10b767+'/'+_0x13ef2c)['json'](_0x44b9a7);}return null;};}function patchUpdates(_0x57913e){return function(_0x74a697){try{jsonpatch[_0x4d91('0x28')](_0x74a697,_0x57913e,!![]);}catch(_0x341d18){return BPromise[_0x4d91('0x29')](_0x341d18);}return _0x74a697[_0x4d91('0x2a')]();};}function saveUpdates(_0x12b722,_0x100cd4){return function(_0x123606){if(_0x123606){return _0x123606['update'](_0x12b722)['then'](function(_0x1ee6b3){return _0x1ee6b3;});}return null;};}function removeEntity(_0x112923,_0x3bed98){return function(_0x45fc91){if(_0x45fc91){return _0x45fc91[_0x4d91('0x2b')]()[_0x4d91('0x2c')](function(){var _0x14bdb4=_0x45fc91['get']({'plain':!![]});var _0x3dc353=_0x4d91('0x2d');return db[_0x4d91('0x2e')]['destroy']({'where':{'type':_0x3dc353,'resourceId':_0x14bdb4['id']}})['then'](function(){return _0x45fc91;});})[_0x4d91('0x2c')](function(){_0x112923[_0x4d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fe76,_0x42d5a0){return function(_0x2d6981){if(!_0x2d6981){_0x50fe76[_0x4d91('0x2f')](0x194);}return _0x2d6981;};}function handleError(_0x17c7bc,_0x4f23dd){_0x4f23dd=_0x4f23dd||0x1f4;return function(_0x2587a1){logger[_0x4d91('0x30')](_0x2587a1[_0x4d91('0x31')]);if(_0x2587a1[_0x4d91('0x32')]){delete _0x2587a1[_0x4d91('0x32')];}_0x17c7bc[_0x4d91('0x20')](_0x4f23dd)[_0x4d91('0x33')](_0x2587a1);};}exports['index']=function(_0x82f585,_0x4f44ff){var _0x4ad7bf={},_0x292808={},_0x3a2780={'count':0x0,'rows':[]};var _0x4f95f0=_[_0x4d91('0x34')](db[_0x4d91('0x35')][_0x4d91('0x36')],function(_0x2be3f5){return{'name':_0x2be3f5[_0x4d91('0x37')],'type':_0x2be3f5['type'][_0x4d91('0x38')]};});_0x292808[_0x4d91('0x39')]=_[_0x4d91('0x34')](_0x4f95f0,_0x4d91('0x32'));_0x292808[_0x4d91('0x3a')]=_[_0x4d91('0x3b')](_0x82f585['query']);_0x292808[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x292808['model'],_0x292808[_0x4d91('0x3a')]);_0x4ad7bf[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x292808['model'],qs[_0x4d91('0x3f')](_0x82f585[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x4ad7bf[_0x4d91('0x3e')]=_0x4ad7bf['attributes'][_0x4d91('0x40')]?_0x4ad7bf[_0x4d91('0x3e')]:_0x292808[_0x4d91('0x39')];if(!_0x82f585[_0x4d91('0x3a')]['hasOwnProperty']('nolimit')){_0x4ad7bf[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x82f585['query'][_0x4d91('0x25')]);_0x4ad7bf[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x82f585[_0x4d91('0x3a')]['offset']);}_0x4ad7bf[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x82f585['query'][_0x4d91('0x42')]);_0x4ad7bf['where']=qs[_0x4d91('0x3c')](_['pick'](_0x82f585[_0x4d91('0x3a')],_0x292808['filters']),_0x4f95f0);if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x4ad7bf[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x4ad7bf['where'],{'$or':_['map'](_0x4f95f0,function(_0x25e0f5){if(_0x25e0f5['type']!==_0x4d91('0x46')){var _0x282d64={};_0x282d64[_0x25e0f5['name']]={'$like':'%'+_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x282d64;}})});}_0x4ad7bf=_[_0x4d91('0x45')]({},_0x4ad7bf,_0x82f585[_0x4d91('0x47')]);var _0x1c6d0b={'where':_0x4ad7bf[_0x4d91('0x44')]};return db[_0x4d91('0x35')]['count'](_0x1c6d0b)[_0x4d91('0x2c')](function(_0x4c70af){_0x3a2780[_0x4d91('0x26')]=_0x4c70af;if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x4ad7bf[_0x4d91('0x49')]=[{'all':!![]}];}return db[_0x4d91('0x35')][_0x4d91('0x4a')](_0x4ad7bf);})['then'](function(_0x4ffc08){_0x3a2780[_0x4d91('0x4b')]=_0x4ffc08;return _0x3a2780;})[_0x4d91('0x2c')](respondWithFilteredResult(_0x4f44ff,_0x4ad7bf))['catch'](handleError(_0x4f44ff,null));};exports[_0x4d91('0x4c')]=function(_0x164658,_0x342de1){var _0x3f8659={'raw':![],'where':{'id':_0x164658[_0x4d91('0x4d')]['id']}},_0x31f21a={};_0x31f21a[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x35')]['rawAttributes']);_0x31f21a['query']=_[_0x4d91('0x3b')](_0x164658['query']);_0x31f21a[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x31f21a[_0x4d91('0x39')],_0x31f21a[_0x4d91('0x3a')]);_0x3f8659['attributes']=_[_0x4d91('0x3d')](_0x31f21a['model'],qs['fields'](_0x164658[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x3f8659[_0x4d91('0x3e')]=_0x3f8659[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x3f8659[_0x4d91('0x3e')]:_0x31f21a['model'];if(_0x164658[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x3f8659[_0x4d91('0x49')]=[{'all':!![]}];}_0x3f8659=_[_0x4d91('0x45')]({},_0x3f8659,_0x164658[_0x4d91('0x47')]);return db[_0x4d91('0x35')][_0x4d91('0x4e')](_0x3f8659)[_0x4d91('0x2c')](handleEntityNotFound(_0x342de1,null))[_0x4d91('0x2c')](respondWithResult(_0x342de1,null))[_0x4d91('0x4f')](handleError(_0x342de1,null));};exports[_0x4d91('0x2b')]=function(_0x5a67fa,_0xa5c630){return db['VoicePrefix'][_0x4d91('0x4e')]({'where':{'id':_0x5a67fa[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0xa5c630,null))[_0x4d91('0x2c')](removeEntity(_0xa5c630,null))[_0x4d91('0x4f')](handleError(_0xa5c630,null));};exports[_0x4d91('0x50')]=function(_0x3028b1,_0x22b341){return db['VoicePrefix'][_0x4d91('0x50')]()[_0x4d91('0x2c')](respondWithResult(_0x22b341,null))[_0x4d91('0x4f')](handleError(_0x22b341,null));};exports[_0x4d91('0x51')]=function(_0x26ecd7,_0x19e57e){var _0x5765ce;return db['sequelize'][_0x4d91('0x52')](function(_0x2159e4){return db[_0x4d91('0x35')][_0x4d91('0x51')](_0x26ecd7[_0x4d91('0x53')],{'transaction':_0x2159e4})[_0x4d91('0x2c')](function(_0x2875f4){_0x5765ce=_0x2875f4[_0x4d91('0x54')]({'plain':!![]});return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5765ce[_0x4d91('0x56')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x280c41){return createVoicePrefixExtensions(_0x5765ce,_0x280c41,_0x2159e4);});});})[_0x4d91('0x2c')](function(){var _0x3e9154=_0x26ecd7[_0x4d91('0x57')][_0x4d91('0x54')]({'plain':!![]});if(!_0x3e9154)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9154['role']==='user'){var _0x45cf4e=_0x5765ce;return db[_0x4d91('0x58')][_0x4d91('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9154[_0x4d91('0x59')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x3985f3){if(_0x3985f3&&_0x3985f3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45cf4e[_0x4d91('0x32')],'resourceId':_0x45cf4e['id'],'type':_0x3985f3[_0x4d91('0x32')],'sectionId':_0x3985f3['id']},{})[_0x4d91('0x2c')](function(){return _0x5765ce;});}else{return _0x5765ce;}})[_0x4d91('0x4f')](function(_0x31d6e5){logger['error'](_0x4d91('0x5a'),_0x31d6e5);throw _0x31d6e5;});}return _0x5765ce;})[_0x4d91('0x2c')](respondWithResult(_0x19e57e,null))['catch'](handleError(_0x19e57e,null));};function Extension(_0x563558,_0x3f4f24,_0x544711,_0x3fda50){this[_0x4d91('0x5b')]=_0x4d91('0x5c');this['exten']=_0x563558;this[_0x4d91('0x5d')]=_0x544711;this[_0x4d91('0x5e')]=_0x4d91('0x5f');this[_0x4d91('0x60')]=_0x4d91('0x61');this[_0x4d91('0x62')]=_0x3f4f24;this[_0x4d91('0x63')]=_0x3fda50;}function createVoicePrefixExtensions(_0x524b4f,_0x533572,_0x5eeba8){return new BPromise(function(_0x4bd66d,_0x83395){var _0x8d6db2=new Extension(formatPrefixName(_0x524b4f[_0x4d91('0x64')]),0x1,'NoOp',_0x4d91('0x65'));_0x8d6db2['VoicePrefixId']=_0x524b4f['id'];return db[_0x4d91('0x55')][_0x4d91('0x51')](_0x8d6db2,{'transaction':_0x5eeba8})['then'](function(_0x51a594){var _0x1a707f=_0x51a594[_0x4d91('0x54')]({'plain':!![]});var _0x31150f=_[_0x4d91('0x34')](addVoicePrefixExtensions(_0x524b4f,_0x533572),function(_0x24661a){_0x24661a[_0x4d91('0x56')]=_0x1a707f['id'];_0x24661a[_0x4d91('0x66')]=_0x524b4f['id'];return _0x24661a;});return db[_0x4d91('0x55')][_0x4d91('0x67')](_0x31150f,{'transaction':_0x5eeba8})[_0x4d91('0x2c')](function(_0x5bfb08){if(!_0x5bfb08){return _0x83395('Extensions\x20creation\x20failed');}else{return _0x4bd66d(_0x5bfb08);}})[_0x4d91('0x4f')](function(_0x7e26c2){return _0x83395(_0x7e26c2);});});;});};function addVoicePrefixExtensions(_0x2049ca,_0x13281d){var _0x16ba26=[];var _0x16d384=formatPrefixName(_0x2049ca[_0x4d91('0x64')]);_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x2,_0x4d91('0x69'),'CDR(prefix)='+_0x2049ca['name']));if(_0x2049ca['callerIdAll']){_0x16ba26['push'](new Extension(_0x16d384,0x3,_0x4d91('0x69'),_0x4d91('0x6a')+_0x2049ca[_0x4d91('0x6b')]));}else{_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x3,_0x4d91('0x6c'),_0x4d91('0x6d')));}_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x4,_0x4d91('0x6e'),_0x13281d[_0x4d91('0x5b')]+','+_0x4d91('0x6f')+(0x8+_0x2049ca[_0x4d91('0x32')][_0x4d91('0x40')])+'}'+','+0x1));return _0x16ba26;}function formatPrefixName(_0x4444a2){var _0xef787='_';for(var _0x3bc828=0x0;_0x3bc828<_0x4444a2[_0x4d91('0x40')];_0x3bc828++){if(_0x4444a2[_0x4d91('0x70')](_0x3bc828)=='-'){_0xef787+=_0x4444a2['charAt'](_0x3bc828);}else{_0xef787+='['+_0x4444a2[_0x4d91('0x70')](_0x3bc828)+']';}}_0xef787+='.';return _0xef787;}exports[_0x4d91('0x71')]=function(_0xc4ef10,_0x2e2105,_0x1cad5b){var _0x5ab447=_0xc4ef10[_0x4d91('0x53')];_0x5ab447[_0x4d91('0x64')]='system-'+_0x5ab447[_0x4d91('0x32')]+'-';return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0xa469a4){return db[_0x4d91('0x35')]['update'](_0x5ab447,{'where':{'id':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')]['destroy']({'where':{'VoicePrefixId':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5ab447['VoiceExtensionId']},'raw':!![]})[_0x4d91('0x2c')](function(_0x403e0c){return createVoicePrefixExtensions(_0x5ab447,_0x403e0c,_0xa469a4);});});});})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x35')][_0x4d91('0x73')](_0x5ab447['id']);})[_0x4d91('0x2c')](respondWithResult(_0x2e2105,null))[_0x4d91('0x4f')](handleError(_0x2e2105,null));};exports['addAgents']=function(_0xdbb484,_0x2e014b,_0x4e7994){return db[_0x4d91('0x35')]['find']({'where':{'id':_0xdbb484['params']['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x2e014b,null))['then'](function(_0x1a5376){if(_0x1a5376){return _0x1a5376[_0x4d91('0x74')](_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')],_[_0x4d91('0x76')](_0xdbb484[_0x4d91('0x53')],[_0x4d91('0x75'),'id'])||{})['spread'](function(_0x485da1){for(var _0x1c27e7=0x0;_0x1c27e7<_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')][_0x4d91('0x40')];_0x1c27e7+=0x1){socket[_0x4d91('0x77')]('userVoicePrefix:save',{'UserId':Number(_0xdbb484['body'][_0x4d91('0x75')][_0x1c27e7]),'VoicePrefixId':Number(_0xdbb484['params']['id'])});}return _0x485da1;});}})['then'](respondWithResult(_0x2e014b,null))[_0x4d91('0x4f')](handleError(_0x2e014b,null));};exports['removeAgents']=function(_0x585a8d,_0x216c33,_0x1b813c){return db[_0x4d91('0x35')]['find']({'where':{'id':_0x585a8d['params']['id']}})['then'](handleEntityNotFound(_0x216c33,null))[_0x4d91('0x2c')](function(_0x8d84f3){if(_0x8d84f3){return _0x8d84f3[_0x4d91('0x78')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])[_0x4d91('0x2c')](function(){if(_[_0x4d91('0x79')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])){for(var _0x542f58=0x0;_0x542f58<_0x585a8d[_0x4d91('0x3a')]['ids']['length'];_0x542f58+=0x1){socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')][_0x542f58]),'VoicePrefixId':Number(_0x585a8d['params']['id'])});}}else{socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')]),'VoicePrefixId':Number(_0x585a8d[_0x4d91('0x4d')]['id'])});}});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x216c33,null))[_0x4d91('0x4f')](handleError(_0x216c33,null));};exports['getAgents']=function(_0x28322e,_0x24376e,_0x7bc606){var _0x49d81c={};var _0xc37e2e={};var _0x45a628;var _0x2cf518;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x28322e[_0x4d91('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24376e,null))[_0x4d91('0x2c')](function(_0x582bee){if(_0x582bee){_0x45a628=_0x582bee;_0xc37e2e[_0x4d91('0x39')]=_['keys'](db[_0x4d91('0x7c')][_0x4d91('0x36')]);_0xc37e2e['query']=_['keys'](_0x28322e['query']);_0xc37e2e[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0xc37e2e[_0x4d91('0x39')],_0xc37e2e[_0x4d91('0x3a')]);_0x49d81c[_0x4d91('0x3e')]=_['intersection'](_0xc37e2e['model'],qs[_0x4d91('0x3f')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x49d81c[_0x4d91('0x3e')]=_0x49d81c[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x49d81c[_0x4d91('0x3e')]:_0xc37e2e['model'];_0x49d81c[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x49d81c[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x28322e[_0x4d91('0x3a')],_0xc37e2e[_0x4d91('0x3c')]));if(_0x28322e['query'][_0x4d91('0x43')]){_0x49d81c[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x49d81c[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x49d81c[_0x4d91('0x3e')],function(_0x4682a8){var _0x51a30d={};_0x51a30d[_0x4682a8]={'$like':'%'+_0x28322e[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x51a30d;})});}_0x49d81c=_['merge']({},_0x49d81c,_0x28322e[_0x4d91('0x47')]);return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})['then'](function(_0x22cd5a){if(_0x22cd5a){_0x2cf518=_0x22cd5a[_0x4d91('0x40')];if(!_0x28322e[_0x4d91('0x3a')][_0x4d91('0x7f')](_0x4d91('0x80'))){_0x49d81c[_0x4d91('0x25')]=qs['limit'](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x49d81c[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x28322e[_0x4d91('0x3a')]['offset']);}return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})[_0x4d91('0x2c')](function(_0x3b0ab3){if(_0x3b0ab3){return _0x3b0ab3?{'count':_0x2cf518,'rows':_0x3b0ab3}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x24376e,null))[_0x4d91('0x4f')](handleError(_0x24376e,null));};exports[_0x4d91('0x81')]=function(_0x18f844,_0x3e93d0,_0x53d973){var _0x367c30={};var _0x28b505={};var _0x451e14;var _0x37fe62;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x18f844[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x3e93d0,null))[_0x4d91('0x2c')](function(_0x5abc1d){if(_0x5abc1d){_0x451e14=_0x5abc1d;_0x28b505[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x82')][_0x4d91('0x36')]);_0x28b505['query']=_['keys'](_0x18f844[_0x4d91('0x3a')]);_0x28b505[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],_0x28b505['query']);_0x367c30[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],qs[_0x4d91('0x3f')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x367c30[_0x4d91('0x3e')]=_0x367c30[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x367c30['attributes']:_0x28b505[_0x4d91('0x39')];_0x367c30[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x367c30[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x18f844[_0x4d91('0x3a')],_0x28b505[_0x4d91('0x3c')]));if(_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x367c30['where']=_[_0x4d91('0x45')](_0x367c30[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x367c30[_0x4d91('0x3e')],function(_0x3e57a1){var _0x41fbc7={};_0x41fbc7[_0x3e57a1]={'$like':'%'+_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x41fbc7;})});}_0x367c30=_[_0x4d91('0x45')]({},_0x367c30,_0x18f844[_0x4d91('0x47')]);return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x5a241a){if(_0x5a241a){_0x37fe62=_0x5a241a['length'];if(!_0x18f844[_0x4d91('0x3a')]['hasOwnProperty'](_0x4d91('0x80'))){_0x367c30[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x367c30[_0x4d91('0x23')]=qs['offset'](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x23')]);}return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x1419c5){if(_0x1419c5){return _0x1419c5?{'count':_0x37fe62,'rows':_0x1419c5}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x3e93d0,null))[_0x4d91('0x4f')](handleError(_0x3e93d0,null));};exports[_0x4d91('0x83')]=function(_0x47cbca,_0x1df276,_0x3e2771){var _0x15d270=_0x47cbca[_0x4d91('0x53')][_0x4d91('0x75')];var _0x17e3bc;return db[_0x4d91('0x82')][_0x4d91('0x4a')]({'where':{'id':_0x15d270},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id','name',_0x4d91('0x85'),_0x4d91('0x86'),'interface'],'raw':!![]}]})[_0x4d91('0x2c')](function(_0x1f836b){if(_0x1f836b){_0x17e3bc=_0x1f836b;var _0x455dd6=_['flatMap'](_0x1f836b,function(_0x46ccf4){var _0xcc22a2=_0x46ccf4['get']({'plain':!![]});return _0xcc22a2['Agents'];});return db[_0x4d91('0x35')][_0x4d91('0x4e')]({'where':{'id':_0x47cbca[_0x4d91('0x4d')]['id']}})['then'](function(_0x352e84){return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0x3b2e36){return _0x352e84[_0x4d91('0x83')](_0x15d270,{'transaction':_0x3b2e36})[_0x4d91('0x2c')](function(){return BPromise[_0x4d91('0x87')](_0x17e3bc,function(_0x185ded){return db[_0x4d91('0x88')][_0x4d91('0x89')]({'TeamId':_0x185ded['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},{'transaction':_0x3b2e36});});})['then'](function(){return BPromise[_0x4d91('0x87')](_0x455dd6,function(_0x2a9069){return db[_0x4d91('0x8a')][_0x4d91('0x8b')]({'where':{'UserId':_0x2a9069['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},'transaction':_0x3b2e36});});})[_0x4d91('0x2c')](function(){_0x455dd6[_0x4d91('0x8c')](function(_0xb67bd3){socket[_0x4d91('0x77')](_0x4d91('0x8d'),{'UserId':_0xb67bd3['id'],'VoicePrefixId':_0x352e84['id']});});});});});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x1df276,null))[_0x4d91('0x4f')](handleError(_0x1df276,null));};exports[_0x4d91('0x8e')]=function(_0xbadba4,_0xe88619,_0x44f21b){return db[_0x4d91('0x82')]['findAll']({'where':{'id':_0xbadba4['query'][_0x4d91('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe88619,null))[_0x4d91('0x2c')](function(_0x2882d5){var _0x2678e7=_[_0x4d91('0x34')](_0x2882d5,'id');var _0x236a61=[];var _0x54f720=[];var _0x5f2ce4=squel['select']();_0x5f2ce4['field'](_0x4d91('0x8f'))[_0x4d91('0x90')]('team_has_voice_prefixes','tq')[_0x4d91('0x91')](_0x4d91('0x92'),'ut',_0x4d91('0x93'))['where'](_0x4d91('0x94'),_0xbadba4[_0x4d91('0x4d')]['id']);for(var _0x237074=0x0;_0x237074<_0x2882d5['length'];_0x237074+=0x1){let _0x3b4804=_0x2882d5[_0x237074];for(var _0x20212f=0x0;_0x20212f<_0x3b4804[_0x4d91('0x84')][_0x4d91('0x40')];_0x20212f+=0x1){let _0x39de93=_0x3b4804['Agents'][_0x20212f];var _0xe60b6=_0x5f2ce4[_0x4d91('0x95')]();_0xe60b6[_0x4d91('0x44')](_0x4d91('0x96'),_0x39de93['id']);_0x54f720['push'](db[_0x4d91('0x72')][_0x4d91('0x3a')](_0xe60b6[_0x4d91('0x97')](),{'type':db[_0x4d91('0x72')][_0x4d91('0x98')][_0x4d91('0x99')]})['then'](function(_0x12e226){if(_0x12e226[_0x4d91('0x40')]===0x1){return _0x39de93['id'];}else{var _0x448a12=_[_0x4d91('0x9a')](_[_0x4d91('0x34')](_0x12e226,_0x4d91('0x9b')),function(_0x2c5ccc){return _['includes'](_0x2678e7,_0x2c5ccc);});if(_0x448a12){return _0x39de93['id'];}}}));}}return BPromise['all'](_0x54f720)[_0x4d91('0x2c')](function(_0x4026b3){_0x236a61=_(_0x236a61)[_0x4d91('0x9c')](_0x4026b3)[_0x4d91('0x9d')]()[_0x4d91('0x9e')]();return db[_0x4d91('0x35')]['find']({'where':{'id':_0xbadba4[_0x4d91('0x4d')]['id']}})['then'](function(_0x3e23df){return db[_0x4d91('0x72')]['transaction'](function(_0x9d7ff1){return _0x3e23df[_0x4d91('0x8e')](_0xbadba4['query']['ids'],{'transaction':_0x9d7ff1})['then'](function(){if(!_[_0x4d91('0x9f')](_0x236a61)){return _0x3e23df['removeAgents'](_0x236a61,{'transaction':_0x9d7ff1});}})[_0x4d91('0x2c')](function(){_0x236a61[_0x4d91('0x8c')](function(_0x4da3b1){socket['emit'](_0x4d91('0x7a'),{'UserId':_0x4da3b1,'VoicePrefixId':_0x3e23df['id']});});});});});});})[_0x4d91('0x2c')](respondWithStatusCode(_0xe88619,null))[_0x4d91('0x4f')](handleError(_0xe88619,null));}; \ No newline at end of file +var _0x3266=['index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','findById','addAgents','emit','userVoicePrefix:save','ids','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','getTeams','Team','interface','Agents','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','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','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','VoicePrefixes','UserProfileResource','destroy','error','name'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x3266,0x6a));var _0x6326=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x3266[_0xf73c09];return _0xa8923c;};'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'];config[_0x6326('0x1c')]=_['defaults'](config['redis'],{'host':_0x6326('0x1d'),'port':0x18eb});var socket=require(_0x6326('0x1e'))(new Redis(config['redis']));require(_0x6326('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d2d9b,_0x20dcc6){_0x20dcc6=_0x20dcc6||0xcc;return function(_0x3d6ac0){if(_0x3d6ac0){return _0x2d2d9b[_0x6326('0x20')](_0x20dcc6);}return _0x2d2d9b[_0x6326('0x21')](_0x20dcc6)[_0x6326('0x22')]();};}function respondWithResult(_0x55923a,_0x1104c5){_0x1104c5=_0x1104c5||0xc8;return function(_0x518e6f){if(_0x518e6f){return _0x55923a['status'](_0x1104c5)['json'](_0x518e6f);}};}function respondWithFilteredResult(_0x51e7b9,_0x5d402d){return function(_0x58e960){if(_0x58e960){var _0xdf5ced=typeof _0x5d402d[_0x6326('0x23')]===_0x6326('0x24')&&typeof _0x5d402d['limit']==='undefined';var _0x954ed5=_0x58e960[_0x6326('0x25')];var _0x272b5c=_0xdf5ced?0x0:_0x5d402d[_0x6326('0x23')];var _0x3c08db=_0xdf5ced?_0x58e960[_0x6326('0x25')]:_0x5d402d[_0x6326('0x23')]+_0x5d402d['limit'];var _0x22307f;if(_0x3c08db>=_0x954ed5){_0x3c08db=_0x954ed5;_0x22307f=0xc8;}else{_0x22307f=0xce;}_0x51e7b9['status'](_0x22307f);return _0x51e7b9[_0x6326('0x26')](_0x6326('0x27'),_0x272b5c+'-'+_0x3c08db+'/'+_0x954ed5)[_0x6326('0x28')](_0x58e960);}return null;};}function patchUpdates(_0x24fb78){return function(_0x43cdfc){try{jsonpatch[_0x6326('0x29')](_0x43cdfc,_0x24fb78,!![]);}catch(_0x225555){return BPromise[_0x6326('0x2a')](_0x225555);}return _0x43cdfc[_0x6326('0x2b')]();};}function saveUpdates(_0x2d0d00,_0x34954b){return function(_0x4933e1){if(_0x4933e1){return _0x4933e1[_0x6326('0x2c')](_0x2d0d00)[_0x6326('0x2d')](function(_0x575701){return _0x575701;});}return null;};}function removeEntity(_0x4e272b,_0x4d28fd){return function(_0x405474){if(_0x405474){return _0x405474['destroy']()[_0x6326('0x2d')](function(){var _0x1a48da=_0x405474['get']({'plain':!![]});var _0x15e33d=_0x6326('0x2e');return db[_0x6326('0x2f')][_0x6326('0x30')]({'where':{'type':_0x15e33d,'resourceId':_0x1a48da['id']}})[_0x6326('0x2d')](function(){return _0x405474;});})[_0x6326('0x2d')](function(){_0x4e272b[_0x6326('0x21')](0xcc)[_0x6326('0x22')]();});}};}function handleEntityNotFound(_0x461e0f,_0x127744){return function(_0x4980f6){if(!_0x4980f6){_0x461e0f[_0x6326('0x20')](0x194);}return _0x4980f6;};}function handleError(_0x331772,_0x134524){_0x134524=_0x134524||0x1f4;return function(_0x2e0445){logger[_0x6326('0x31')](_0x2e0445['stack']);if(_0x2e0445[_0x6326('0x32')]){delete _0x2e0445[_0x6326('0x32')];}_0x331772[_0x6326('0x21')](_0x134524)['send'](_0x2e0445);};}exports[_0x6326('0x33')]=function(_0x4d7807,_0x4e703a){var _0xfb6b62={},_0x7ac8d9={},_0x160a12={'count':0x0,'rows':[]};var _0x103b1c=_[_0x6326('0x34')](db[_0x6326('0x35')][_0x6326('0x36')],function(_0x46c803){return{'name':_0x46c803[_0x6326('0x37')],'type':_0x46c803[_0x6326('0x38')][_0x6326('0x39')]};});_0x7ac8d9[_0x6326('0x3a')]=_['map'](_0x103b1c,_0x6326('0x32'));_0x7ac8d9[_0x6326('0x3b')]=_['keys'](_0x4d7807[_0x6326('0x3b')]);_0x7ac8d9[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x7ac8d9['model'],_0x7ac8d9[_0x6326('0x3b')]);_0xfb6b62['attributes']=_['intersection'](_0x7ac8d9[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x4d7807[_0x6326('0x3b')]['fields']));_0xfb6b62[_0x6326('0x3f')]=_0xfb6b62['attributes'][_0x6326('0x40')]?_0xfb6b62['attributes']:_0x7ac8d9[_0x6326('0x3a')];if(!_0x4d7807[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0xfb6b62[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x4d7807['query'][_0x6326('0x43')]);_0xfb6b62[_0x6326('0x23')]=qs['offset'](_0x4d7807[_0x6326('0x3b')]['offset']);}_0xfb6b62['order']=qs[_0x6326('0x44')](_0x4d7807[_0x6326('0x3b')][_0x6326('0x44')]);_0xfb6b62[_0x6326('0x45')]=qs[_0x6326('0x3c')](_[_0x6326('0x46')](_0x4d7807['query'],_0x7ac8d9['filters']),_0x103b1c);if(_0x4d7807[_0x6326('0x3b')]['filter']){_0xfb6b62[_0x6326('0x45')]=_['merge'](_0xfb6b62[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x103b1c,function(_0x335feb){if(_0x335feb[_0x6326('0x38')]!==_0x6326('0x47')){var _0x1b754d={};_0x1b754d[_0x335feb[_0x6326('0x32')]]={'$like':'%'+_0x4d7807[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x1b754d;}})});}_0xfb6b62=_[_0x6326('0x49')]({},_0xfb6b62,_0x4d7807[_0x6326('0x4a')]);var _0x5d36b1={'where':_0xfb6b62[_0x6326('0x45')]};return db['VoicePrefix'][_0x6326('0x25')](_0x5d36b1)[_0x6326('0x2d')](function(_0x16fc33){_0x160a12[_0x6326('0x25')]=_0x16fc33;if(_0x4d7807['query'][_0x6326('0x4b')]){_0xfb6b62[_0x6326('0x4c')]=[{'all':!![]}];}return db['VoicePrefix'][_0x6326('0x4d')](_0xfb6b62);})[_0x6326('0x2d')](function(_0x7a5057){_0x160a12[_0x6326('0x4e')]=_0x7a5057;return _0x160a12;})['then'](respondWithFilteredResult(_0x4e703a,_0xfb6b62))[_0x6326('0x4f')](handleError(_0x4e703a,null));};exports[_0x6326('0x50')]=function(_0x231e15,_0x28504f){var _0x44d852={'raw':![],'where':{'id':_0x231e15[_0x6326('0x51')]['id']}},_0x165953={};_0x165953['model']=_[_0x6326('0x52')](db[_0x6326('0x35')][_0x6326('0x36')]);_0x165953[_0x6326('0x3b')]=_['keys'](_0x231e15[_0x6326('0x3b')]);_0x165953['filters']=_[_0x6326('0x3d')](_0x165953[_0x6326('0x3a')],_0x165953[_0x6326('0x3b')]);_0x44d852[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x165953['model'],qs[_0x6326('0x3e')](_0x231e15['query']['fields']));_0x44d852[_0x6326('0x3f')]=_0x44d852[_0x6326('0x3f')]['length']?_0x44d852[_0x6326('0x3f')]:_0x165953[_0x6326('0x3a')];if(_0x231e15[_0x6326('0x3b')][_0x6326('0x4b')]){_0x44d852[_0x6326('0x4c')]=[{'all':!![]}];}_0x44d852=_['merge']({},_0x44d852,_0x231e15['options']);return db[_0x6326('0x35')][_0x6326('0x53')](_0x44d852)[_0x6326('0x2d')](handleEntityNotFound(_0x28504f,null))[_0x6326('0x2d')](respondWithResult(_0x28504f,null))[_0x6326('0x4f')](handleError(_0x28504f,null));};exports[_0x6326('0x30')]=function(_0xdc4522,_0x55bcd6){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0xdc4522[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x55bcd6,null))[_0x6326('0x2d')](removeEntity(_0x55bcd6,null))['catch'](handleError(_0x55bcd6,null));};exports[_0x6326('0x54')]=function(_0x55537a,_0x216972){return db[_0x6326('0x35')]['describe']()[_0x6326('0x2d')](respondWithResult(_0x216972,null))['catch'](handleError(_0x216972,null));};exports[_0x6326('0x55')]=function(_0x202fd3,_0x2ee8df){var _0x35400e;return db['sequelize'][_0x6326('0x56')](function(_0xbe6b3e){return db['VoicePrefix'][_0x6326('0x55')](_0x202fd3[_0x6326('0x57')],{'transaction':_0xbe6b3e})[_0x6326('0x2d')](function(_0x4a42ae){_0x35400e=_0x4a42ae[_0x6326('0x58')]({'plain':!![]});return db[_0x6326('0x59')]['find']({'where':{'id':_0x35400e[_0x6326('0x5a')]},'raw':!![]})['then'](function(_0x1f1463){return createVoicePrefixExtensions(_0x35400e,_0x1f1463,_0xbe6b3e);});});})[_0x6326('0x2d')](function(){var _0x3e9825=_0x202fd3[_0x6326('0x5b')][_0x6326('0x58')]({'plain':!![]});if(!_0x3e9825)throw new Error(_0x6326('0x5c'));if(_0x3e9825[_0x6326('0x5d')]==='user'){var _0x51adce=_0x35400e;return db['UserProfileSection'][_0x6326('0x53')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9825[_0x6326('0x5e')]},'raw':!![]})[_0x6326('0x2d')](function(_0xcae454){if(_0xcae454&&_0xcae454[_0x6326('0x5f')]===0x0){return db[_0x6326('0x2f')]['create']({'name':_0x51adce[_0x6326('0x32')],'resourceId':_0x51adce['id'],'type':_0xcae454[_0x6326('0x32')],'sectionId':_0xcae454['id']},{})['then'](function(){return _0x35400e;});}else{return _0x35400e;}})[_0x6326('0x4f')](function(_0xdeba28){logger[_0x6326('0x31')](_0x6326('0x60'),_0xdeba28);throw _0xdeba28;});}return _0x35400e;})[_0x6326('0x2d')](respondWithResult(_0x2ee8df,null))[_0x6326('0x4f')](handleError(_0x2ee8df,null));};function Extension(_0x320d43,_0x2f624f,_0x2c7a8d,_0x37506f){this['context']=_0x6326('0x61');this[_0x6326('0x62')]=_0x320d43;this[_0x6326('0x63')]=_0x2c7a8d;this[_0x6326('0x38')]='system';this['description']=_0x6326('0x64');this[_0x6326('0x65')]=_0x2f624f;this[_0x6326('0x66')]=_0x37506f;}function createVoicePrefixExtensions(_0x10f54b,_0x3ac39d,_0x54a9eb){return new BPromise(function(_0x4cec50,_0x13fc10){var _0x447b34=new Extension(formatPrefixName(_0x10f54b[_0x6326('0x67')]),0x1,_0x6326('0x68'),'Voice\x20Prefix');_0x447b34[_0x6326('0x69')]=_0x10f54b['id'];return db[_0x6326('0x59')][_0x6326('0x55')](_0x447b34,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x4197d6){var _0xc8f404=_0x4197d6['get']({'plain':!![]});var _0x2bc08a=_['map'](addVoicePrefixExtensions(_0x10f54b,_0x3ac39d),function(_0x4877c8){_0x4877c8[_0x6326('0x5a')]=_0xc8f404['id'];_0x4877c8['VoicePrefixId']=_0x10f54b['id'];return _0x4877c8;});return db[_0x6326('0x59')][_0x6326('0x6a')](_0x2bc08a,{'transaction':_0x54a9eb})[_0x6326('0x2d')](function(_0x3b6de7){if(!_0x3b6de7){return _0x13fc10(_0x6326('0x6b'));}else{return _0x4cec50(_0x3b6de7);}})[_0x6326('0x4f')](function(_0x1e8d86){return _0x13fc10(_0x1e8d86);});});;});};function addVoicePrefixExtensions(_0x75e3a7,_0xa2928e){var _0x3f5e2e=[];var _0x53ff60=formatPrefixName(_0x75e3a7[_0x6326('0x67')]);_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x2,_0x6326('0x6d'),_0x6326('0x6e')+_0x75e3a7[_0x6326('0x32')]));if(_0x75e3a7['callerIdAll']){_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,_0x6326('0x6d'),_0x6326('0x6f')+_0x75e3a7[_0x6326('0x70')]));}else{_0x3f5e2e[_0x6326('0x6c')](new Extension(_0x53ff60,0x3,'NoOp',_0x6326('0x71')));}_0x3f5e2e['push'](new Extension(_0x53ff60,0x4,'goto',_0xa2928e[_0x6326('0x72')]+','+_0x6326('0x73')+(0x8+_0x75e3a7[_0x6326('0x32')][_0x6326('0x40')])+'}'+','+0x1));return _0x3f5e2e;}function formatPrefixName(_0x4fd921){var _0x4fbede='_';for(var _0x5cadb2=0x0;_0x5cadb2<_0x4fd921['length'];_0x5cadb2++){if(_0x4fd921[_0x6326('0x74')](_0x5cadb2)=='-'){_0x4fbede+=_0x4fd921['charAt'](_0x5cadb2);}else{_0x4fbede+='['+_0x4fd921[_0x6326('0x74')](_0x5cadb2)+']';}}_0x4fbede+='.';return _0x4fbede;}exports[_0x6326('0x2c')]=function(_0x54730e,_0x4c1d7e,_0x5401cf){var _0x5e86bc=_0x54730e['body'];_0x5e86bc[_0x6326('0x67')]='system-'+_0x5e86bc['name']+'-';return db['sequelize']['transaction'](function(_0x19916e){return db['VoicePrefix'][_0x6326('0x2c')](_0x5e86bc,{'where':{'id':_0x5e86bc['id']},'transaction':_0x19916e})[_0x6326('0x2d')](function(){return db['VoiceExtension'][_0x6326('0x30')]({'where':{'VoicePrefixId':_0x5e86bc['id']},'transaction':_0x19916e})['then'](function(){return db[_0x6326('0x59')][_0x6326('0x53')]({'where':{'id':_0x5e86bc[_0x6326('0x5a')]},'raw':!![]})[_0x6326('0x2d')](function(_0x339838){return createVoicePrefixExtensions(_0x5e86bc,_0x339838,_0x19916e);});});});})[_0x6326('0x2d')](function(){return db[_0x6326('0x35')][_0x6326('0x75')](_0x5e86bc['id']);})[_0x6326('0x2d')](respondWithResult(_0x4c1d7e,null))[_0x6326('0x4f')](handleError(_0x4c1d7e,null));};exports[_0x6326('0x76')]=function(_0x19cc2b,_0x3bc5f3,_0x27a505){return db[_0x6326('0x35')][_0x6326('0x53')]({'where':{'id':_0x19cc2b[_0x6326('0x51')]['id']}})['then'](handleEntityNotFound(_0x3bc5f3,null))['then'](function(_0x543792){if(_0x543792){return _0x543792['addAgents'](_0x19cc2b[_0x6326('0x57')]['ids'],_['omit'](_0x19cc2b['body'],['ids','id'])||{})['spread'](function(_0x5a1a9f){for(var _0xe845d6=0x0;_0xe845d6<_0x19cc2b[_0x6326('0x57')]['ids'][_0x6326('0x40')];_0xe845d6+=0x1){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':Number(_0x19cc2b['body'][_0x6326('0x79')][_0xe845d6]),'VoicePrefixId':Number(_0x19cc2b[_0x6326('0x51')]['id'])});}return _0x5a1a9f;});}})[_0x6326('0x2d')](respondWithResult(_0x3bc5f3,null))[_0x6326('0x4f')](handleError(_0x3bc5f3,null));};exports[_0x6326('0x7a')]=function(_0x483813,_0x3bff09,_0x4aec22){return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x483813['params']['id']}})['then'](handleEntityNotFound(_0x3bff09,null))['then'](function(_0x491f2e){if(_0x491f2e){return _0x491f2e['removeAgents'](_0x483813['query']['ids'])[_0x6326('0x2d')](function(){if(_[_0x6326('0x7b')](_0x483813[_0x6326('0x3b')][_0x6326('0x79')])){for(var _0x590e06=0x0;_0x590e06<_0x483813['query']['ids'][_0x6326('0x40')];_0x590e06+=0x1){socket[_0x6326('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x483813[_0x6326('0x3b')]['ids'][_0x590e06]),'VoicePrefixId':Number(_0x483813['params']['id'])});}}else{socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':Number(_0x483813[_0x6326('0x3b')][_0x6326('0x79')]),'VoicePrefixId':Number(_0x483813[_0x6326('0x51')]['id'])});}});}})[_0x6326('0x2d')](respondWithStatusCode(_0x3bff09,null))[_0x6326('0x4f')](handleError(_0x3bff09,null));};exports['getAgents']=function(_0x5afd24,_0x4c8bde,_0x1ec0ef){var _0x5223f4={};var _0x48631a={};var _0xaea64f;var _0x429c41;return db['VoicePrefix'][_0x6326('0x7d')]({'where':{'id':_0x5afd24['params']['id']}})['then'](handleEntityNotFound(_0x4c8bde,null))[_0x6326('0x2d')](function(_0xbca686){if(_0xbca686){_0xaea64f=_0xbca686;_0x48631a['model']=_['keys'](db[_0x6326('0x7e')][_0x6326('0x36')]);_0x48631a[_0x6326('0x3b')]=_[_0x6326('0x52')](_0x5afd24['query']);_0x48631a['filters']=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],_0x48631a[_0x6326('0x3b')]);_0x5223f4[_0x6326('0x3f')]=_[_0x6326('0x3d')](_0x48631a[_0x6326('0x3a')],qs[_0x6326('0x3e')](_0x5afd24[_0x6326('0x3b')]['fields']));_0x5223f4[_0x6326('0x3f')]=_0x5223f4['attributes'][_0x6326('0x40')]?_0x5223f4[_0x6326('0x3f')]:_0x48631a[_0x6326('0x3a')];_0x5223f4[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x5afd24[_0x6326('0x3b')]['sort']);_0x5223f4[_0x6326('0x45')]=qs[_0x6326('0x3c')](_['pick'](_0x5afd24[_0x6326('0x3b')],_0x48631a[_0x6326('0x3c')]));if(_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]){_0x5223f4[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5223f4[_0x6326('0x45')],{'$or':_['map'](_0x5223f4[_0x6326('0x3f')],function(_0x21ccbf){var _0x458a7e={};_0x458a7e[_0x21ccbf]={'$like':'%'+_0x5afd24[_0x6326('0x3b')][_0x6326('0x48')]+'%'};return _0x458a7e;})});}_0x5223f4=_['merge']({},_0x5223f4,_0x5afd24[_0x6326('0x4a')]);return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})['then'](function(_0x411fe5){if(_0x411fe5){_0x429c41=_0x411fe5[_0x6326('0x40')];if(!_0x5afd24[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5223f4[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x5afd24[_0x6326('0x3b')]['limit']);_0x5223f4[_0x6326('0x23')]=qs[_0x6326('0x23')](_0x5afd24[_0x6326('0x3b')][_0x6326('0x23')]);}return _0xaea64f[_0x6326('0x80')](_0x5223f4);}})[_0x6326('0x2d')](function(_0xcb5683){if(_0xcb5683){return _0xcb5683?{'count':_0x429c41,'rows':_0xcb5683}:null;}})['then'](respondWithResult(_0x4c8bde,null))[_0x6326('0x4f')](handleError(_0x4c8bde,null));};exports['getTeams']=function(_0x44cea5,_0x57e6ad,_0x3a9312){var _0x5b251f={};var _0x2b885b={};var _0xda3005;var _0x29682b;return db[_0x6326('0x35')][_0x6326('0x7d')]({'where':{'id':_0x44cea5[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](handleEntityNotFound(_0x57e6ad,null))['then'](function(_0x1da431){if(_0x1da431){_0xda3005=_0x1da431;_0x2b885b[_0x6326('0x3a')]=_[_0x6326('0x52')](db['Team'][_0x6326('0x36')]);_0x2b885b['query']=_[_0x6326('0x52')](_0x44cea5[_0x6326('0x3b')]);_0x2b885b[_0x6326('0x3c')]=_[_0x6326('0x3d')](_0x2b885b[_0x6326('0x3a')],_0x2b885b[_0x6326('0x3b')]);_0x5b251f[_0x6326('0x3f')]=_['intersection'](_0x2b885b[_0x6326('0x3a')],qs['fields'](_0x44cea5[_0x6326('0x3b')][_0x6326('0x3e')]));_0x5b251f[_0x6326('0x3f')]=_0x5b251f[_0x6326('0x3f')]['length']?_0x5b251f['attributes']:_0x2b885b[_0x6326('0x3a')];_0x5b251f[_0x6326('0x7f')]=qs[_0x6326('0x44')](_0x44cea5[_0x6326('0x3b')]['sort']);_0x5b251f[_0x6326('0x45')]=qs['filters'](_['pick'](_0x44cea5[_0x6326('0x3b')],_0x2b885b[_0x6326('0x3c')]));if(_0x44cea5[_0x6326('0x3b')][_0x6326('0x48')]){_0x5b251f[_0x6326('0x45')]=_[_0x6326('0x49')](_0x5b251f[_0x6326('0x45')],{'$or':_[_0x6326('0x34')](_0x5b251f[_0x6326('0x3f')],function(_0x3884db){var _0x5ccb35={};_0x5ccb35[_0x3884db]={'$like':'%'+_0x44cea5['query'][_0x6326('0x48')]+'%'};return _0x5ccb35;})});}_0x5b251f=_['merge']({},_0x5b251f,_0x44cea5[_0x6326('0x4a')]);return _0xda3005['getTeams'](_0x5b251f);}})['then'](function(_0x10d3c6){if(_0x10d3c6){_0x29682b=_0x10d3c6[_0x6326('0x40')];if(!_0x44cea5[_0x6326('0x3b')][_0x6326('0x41')](_0x6326('0x42'))){_0x5b251f[_0x6326('0x43')]=qs[_0x6326('0x43')](_0x44cea5[_0x6326('0x3b')]['limit']);_0x5b251f['offset']=qs[_0x6326('0x23')](_0x44cea5['query'][_0x6326('0x23')]);}return _0xda3005[_0x6326('0x81')](_0x5b251f);}})['then'](function(_0x5c57e5){if(_0x5c57e5){return _0x5c57e5?{'count':_0x29682b,'rows':_0x5c57e5}:null;}})[_0x6326('0x2d')](respondWithResult(_0x57e6ad,null))['catch'](handleError(_0x57e6ad,null));};exports['addTeams']=function(_0x50d766,_0x4f45a6,_0x3a9a9e){var _0x22c60d=_0x50d766[_0x6326('0x57')][_0x6326('0x79')];var _0x26f784;return db[_0x6326('0x82')]['findAll']({'where':{'id':_0x22c60d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online','voicePause',_0x6326('0x83')],'raw':!![]}]})[_0x6326('0x2d')](function(_0x215db1){if(_0x215db1){_0x26f784=_0x215db1;var _0x2a9f5c=_['flatMap'](_0x215db1,function(_0x20f5ea){var _0x293f72=_0x20f5ea['get']({'plain':!![]});return _0x293f72[_0x6326('0x84')];});return db['VoicePrefix'][_0x6326('0x53')]({'where':{'id':_0x50d766[_0x6326('0x51')]['id']}})[_0x6326('0x2d')](function(_0x5d4b0a){return db['sequelize'][_0x6326('0x56')](function(_0xf912fe){return _0x5d4b0a[_0x6326('0x85')](_0x22c60d,{'transaction':_0xf912fe})['then'](function(){return BPromise[_0x6326('0x86')](_0x26f784,function(_0x464914){return db[_0x6326('0x87')]['upsert']({'TeamId':_0x464914['id'],'VoicePrefixId':_0x50d766[_0x6326('0x51')]['id']},{'transaction':_0xf912fe});});})['then'](function(){return BPromise[_0x6326('0x86')](_0x2a9f5c,function(_0x5a7b49){return db[_0x6326('0x88')][_0x6326('0x89')]({'where':{'UserId':_0x5a7b49['id'],'VoicePrefixId':_0x50d766['params']['id']},'transaction':_0xf912fe});});})[_0x6326('0x2d')](function(){_0x2a9f5c[_0x6326('0x8a')](function(_0x38d8c8){socket[_0x6326('0x77')](_0x6326('0x78'),{'UserId':_0x38d8c8['id'],'VoicePrefixId':_0x5d4b0a['id']});});});});});}})[_0x6326('0x2d')](respondWithStatusCode(_0x4f45a6,null))[_0x6326('0x4f')](handleError(_0x4f45a6,null));};exports[_0x6326('0x8b')]=function(_0x43dc1e,_0x26ea69,_0x1a4b94){return db[_0x6326('0x82')][_0x6326('0x4d')]({'where':{'id':_0x43dc1e['query'][_0x6326('0x79')]},'attributes':['id'],'include':[{'model':db[_0x6326('0x7e')],'as':_0x6326('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x26ea69,null))['then'](function(_0x489226){var _0x5db6b3=_[_0x6326('0x34')](_0x489226,'id');var _0x5135df=[];var _0x4c15d2=[];var _0xd9c385=squel['select']();_0xd9c385['field'](_0x6326('0x8c'))['from'](_0x6326('0x8d'),'tq')[_0x6326('0x8e')](_0x6326('0x8f'),'ut',_0x6326('0x90'))[_0x6326('0x45')](_0x6326('0x91'),_0x43dc1e[_0x6326('0x51')]['id']);for(var _0x26391c=0x0;_0x26391c<_0x489226[_0x6326('0x40')];_0x26391c+=0x1){let _0x1adcbc=_0x489226[_0x26391c];for(var _0x46bece=0x0;_0x46bece<_0x1adcbc[_0x6326('0x84')][_0x6326('0x40')];_0x46bece+=0x1){let _0x30d31a=_0x1adcbc[_0x6326('0x84')][_0x46bece];var _0x3ec241=_0xd9c385[_0x6326('0x92')]();_0x3ec241[_0x6326('0x45')](_0x6326('0x93'),_0x30d31a['id']);_0x4c15d2[_0x6326('0x6c')](db['sequelize'][_0x6326('0x3b')](_0x3ec241[_0x6326('0x94')](),{'type':db[_0x6326('0x95')][_0x6326('0x96')][_0x6326('0x97')]})[_0x6326('0x2d')](function(_0x292657){if(_0x292657[_0x6326('0x40')]===0x1){return _0x30d31a['id'];}else{var _0x909cce=_[_0x6326('0x98')](_['map'](_0x292657,_0x6326('0x99')),function(_0x4b493a){return _[_0x6326('0x9a')](_0x5db6b3,_0x4b493a);});if(_0x909cce){return _0x30d31a['id'];}}}));}}return BPromise[_0x6326('0x9b')](_0x4c15d2)['then'](function(_0x2b98a4){_0x5135df=_(_0x5135df)[_0x6326('0x9c')](_0x2b98a4)['compact']()['value']();return db[_0x6326('0x35')]['find']({'where':{'id':_0x43dc1e[_0x6326('0x51')]['id']}})['then'](function(_0x4a470e){return db[_0x6326('0x95')][_0x6326('0x56')](function(_0x298a11){return _0x4a470e[_0x6326('0x8b')](_0x43dc1e[_0x6326('0x3b')][_0x6326('0x79')],{'transaction':_0x298a11})[_0x6326('0x2d')](function(){if(!_['isEmpty'](_0x5135df)){return _0x4a470e['removeAgents'](_0x5135df,{'transaction':_0x298a11});}})[_0x6326('0x2d')](function(){_0x5135df[_0x6326('0x8a')](function(_0x42d1db){socket[_0x6326('0x77')](_0x6326('0x7c'),{'UserId':_0x42d1db,'VoicePrefixId':_0x4a470e['id']});});});});});});})['then'](respondWithStatusCode(_0x26ea69,null))[_0x6326('0x4f')](handleError(_0x26ea69,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index bef1106..91cb048 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 _0x5a59=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5a59,0x19f));var _0x95a5=function(_0x8c8b76,_0x500c08){_0x8c8b76=_0x8c8b76-0x0;var _0x5377f8=_0x5a59[_0x8c8b76];return _0x5377f8;};'use strict';var EventEmitter=require(_0x95a5('0x0'));var VoicePrefix=require(_0x95a5('0x1'))['db'][_0x95a5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x95a5('0x3')](0x0);var events={'afterCreate':_0x95a5('0x4'),'afterUpdate':_0x95a5('0x5'),'afterDestroy':_0x95a5('0x6')};function emitEvent(_0x168430){return function(_0x4aa2da,_0x4f40ed,_0x538150){VoicePrefixEvents[_0x95a5('0x7')](_0x168430+':'+_0x4aa2da['id'],_0x4aa2da);VoicePrefixEvents[_0x95a5('0x7')](_0x168430,_0x4aa2da);_0x538150(null);};}for(var e in events){if(events[_0x95a5('0x8')](e)){var event=events[e];VoicePrefix[_0x95a5('0x9')](e,emitEvent(event));}}module[_0x95a5('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x95f6=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x4ea5fb,_0x1bcc80){var _0x39c9c8=function(_0x4b087e){while(--_0x4b087e){_0x4ea5fb['push'](_0x4ea5fb['shift']());}};_0x39c9c8(++_0x1bcc80);}(_0x95f6,0x66));var _0x695f=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0x95f6[_0x511a19];return _0x499aa6;};'use strict';var EventEmitter=require(_0x695f('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x695f('0x1')](0x0);var events={'afterCreate':_0x695f('0x2'),'afterUpdate':_0x695f('0x3'),'afterDestroy':_0x695f('0x4')};function emitEvent(_0x4a068e){return function(_0xbd71bd,_0x33f34d,_0x4ac2ad){VoicePrefixEvents[_0x695f('0x5')](_0x4a068e+':'+_0xbd71bd['id'],_0xbd71bd);VoicePrefixEvents[_0x695f('0x5')](_0x4a068e,_0xbd71bd);_0x4ac2ad(null);};}for(var e in events){if(events[_0x695f('0x6')](e)){var event=events[e];VoicePrefix[_0x695f('0x7')](e,emitEvent(event));}}module[_0x695f('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2a58d4b..7503478 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 _0x41ab=['rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x41ab,0xef));var _0xb41a=function(_0x56b9ee,_0x25a747){_0x56b9ee=_0x56b9ee-0x0;var _0x371286=_0x41ab[_0x56b9ee];return _0x371286;};'use strict';var _=require(_0xb41a('0x0'));var util=require(_0xb41a('0x1'));var logger=require(_0xb41a('0x2'))(_0xb41a('0x3'));var moment=require(_0xb41a('0x4'));var BPromise=require(_0xb41a('0x5'));var rp=require(_0xb41a('0x6'));var fs=require('fs');var path=require(_0xb41a('0x7'));var rimraf=require(_0xb41a('0x8'));var config=require(_0xb41a('0x9'));var attributes=require(_0xb41a('0xa'));module['exports']=function(_0xc6ae3f,_0x77882f){return _0xc6ae3f[_0xb41a('0xb')]('VoicePrefix',attributes,{'tableName':_0xb41a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dc0=['define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x5cd635,_0x28e48f){var _0x191bc0=function(_0x24daba){while(--_0x24daba){_0x5cd635['push'](_0x5cd635['shift']());}};_0x191bc0(++_0x28e48f);}(_0x5dc0,0x1e1));var _0x05dc=function(_0x511b77,_0xe65b0d){_0x511b77=_0x511b77-0x0;var _0x14ed29=_0x5dc0[_0x511b77];return _0x14ed29;};'use strict';var _=require('lodash');var util=require(_0x05dc('0x0'));var logger=require(_0x05dc('0x1'))(_0x05dc('0x2'));var moment=require(_0x05dc('0x3'));var BPromise=require(_0x05dc('0x4'));var rp=require(_0x05dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05dc('0x6'));var config=require(_0x05dc('0x7'));var attributes=require(_0x05dc('0x8'));module['exports']=function(_0x3e47f3,_0x5cee10){return _0x3e47f3[_0x05dc('0x9')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2d0a749..39a70e1 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 _0x50a5=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x50a5,0xd1));var _0x550a=function(_0x5d85b2,_0x5f3494){_0x5d85b2=_0x5d85b2-0x0;var _0x58675c=_0x50a5[_0x5d85b2];return _0x58675c;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x550a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x550a('0x3'))(_0x550a('0x4'));var config=require(_0x550a('0x5'));var jayson=require(_0x550a('0x6'));var client=jayson[_0x550a('0x7')][_0x550a('0x8')]({'port':0x232a});config[_0x550a('0x9')]=_[_0x550a('0xa')](config[_0x550a('0x9')],{'host':_0x550a('0xb'),'port':0x18eb});var socket=require(_0x550a('0xc'))(new Redis(config[_0x550a('0x9')]));require(_0x550a('0xd'))['register'](socket);function respondWithRpcPromise(_0x1f584d,_0x13e4f3,_0x2f7cc5){return new BPromise(function(_0x1249d5,_0x3f13f5){return client[_0x550a('0xe')](_0x1f584d,_0x2f7cc5)['then'](function(_0xa6bce5){logger[_0x550a('0xf')](_0x550a('0x10'),_0x13e4f3,_0x550a('0x11'));logger[_0x550a('0x12')](_0x550a('0x13'),_0x13e4f3,_0x550a('0x11'),JSON[_0x550a('0x14')](_0xa6bce5));if(_0xa6bce5['error']){if(_0xa6bce5[_0x550a('0x15')]['code']===0x1f4){logger['error'](_0x550a('0x10'),_0x13e4f3,_0xa6bce5[_0x550a('0x15')]['message']);return _0x3f13f5(_0xa6bce5[_0x550a('0x15')]['message']);}logger[_0x550a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x13e4f3,_0xa6bce5[_0x550a('0x15')][_0x550a('0x16')]);return _0x1249d5(_0xa6bce5[_0x550a('0x15')][_0x550a('0x16')]);}else{logger[_0x550a('0xf')](_0x550a('0x10'),_0x13e4f3,'request\x20sent');_0x1249d5(_0xa6bce5[_0x550a('0x17')]['message']);}})[_0x550a('0x18')](function(_0x142a9f){logger[_0x550a('0x15')](_0x550a('0x10'),_0x13e4f3,_0x142a9f);_0x3f13f5(_0x142a9f);});});} \ No newline at end of file +var _0x68b3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x68b3,0x1d8));var _0x368b=function(_0x461937,_0x140111){_0x461937=_0x461937-0x0;var _0x3b64a8=_0x68b3[_0x461937];return _0x3b64a8;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});config[_0x368b('0xc')]=_[_0x368b('0xd')](config[_0x368b('0xc')],{'host':_0x368b('0xe'),'port':0x18eb});var socket=require(_0x368b('0xf'))(new Redis(config[_0x368b('0xc')]));require(_0x368b('0x10'))[_0x368b('0x11')](socket);function respondWithRpcPromise(_0x5a46f9,_0x160e12,_0xdbd344){return new BPromise(function(_0x34a110,_0x51d513){return client[_0x368b('0x12')](_0x5a46f9,_0xdbd344)[_0x368b('0x13')](function(_0x253e4b){logger['info'](_0x368b('0x14'),_0x160e12,_0x368b('0x15'));logger['debug'](_0x368b('0x16'),_0x160e12,_0x368b('0x15'),JSON[_0x368b('0x17')](_0x253e4b));if(_0x253e4b[_0x368b('0x18')]){if(_0x253e4b[_0x368b('0x18')]['code']===0x1f4){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x253e4b['error'][_0x368b('0x19')]);return _0x51d513(_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);}logger['error'](_0x368b('0x14'),_0x160e12,_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);return _0x34a110(_0x253e4b['error'][_0x368b('0x19')]);}else{logger[_0x368b('0x1a')](_0x368b('0x14'),_0x160e12,'request\x20sent');_0x34a110(_0x253e4b['result'][_0x368b('0x19')]);}})[_0x368b('0x1b')](function(_0x2c3cec){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x2c3cec);_0x51d513(_0x2c3cec);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b13f67c..d6dce98 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 _0xad13=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad13,0x79));var _0x3ad1=function(_0x47854e,_0x2a8c38){_0x47854e=_0x47854e-0x0;var _0x27e266=_0xad13[_0x47854e];return _0x27e266;};'use strict';var VoicePrefixEvents=require(_0x3ad1('0x0'));var events=['save',_0x3ad1('0x1'),_0x3ad1('0x2')];function createListener(_0x17f6ee,_0x38bf8c){return function(_0x501af9){_0x38bf8c[_0x3ad1('0x3')](_0x17f6ee,_0x501af9);};}function removeListener(_0x8fd72a,_0x2d59bf){return function(){VoicePrefixEvents[_0x3ad1('0x4')](_0x8fd72a,_0x2d59bf);};}exports[_0x3ad1('0x5')]=function(_0x416e30){for(var _0x42ab5c=0x0,_0x23ed63=events[_0x3ad1('0x6')];_0x42ab5c<_0x23ed63;_0x42ab5c++){var _0x313ad9=events[_0x42ab5c];var _0x4d27b0=createListener(_0x3ad1('0x7')+_0x313ad9,_0x416e30);VoicePrefixEvents['on'](_0x313ad9,_0x4d27b0);}}; \ No newline at end of file +var _0xc99a=['remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0xf10bd7,_0x16b720){var _0x12b5c9=function(_0x498d98){while(--_0x498d98){_0xf10bd7['push'](_0xf10bd7['shift']());}};_0x12b5c9(++_0x16b720);}(_0xc99a,0x7c));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var VoicePrefixEvents=require(_0xac99('0x0'));var events=[_0xac99('0x1'),_0xac99('0x2'),_0xac99('0x3')];function createListener(_0x3de0c0,_0xb984d0){return function(_0x4ef612){_0xb984d0[_0xac99('0x4')](_0x3de0c0,_0x4ef612);};}function removeListener(_0x98e7e4,_0x3054b0){return function(){VoicePrefixEvents[_0xac99('0x5')](_0x98e7e4,_0x3054b0);};}exports[_0xac99('0x6')]=function(_0x44294b){for(var _0x1a9116=0x0,_0x4594ec=events[_0xac99('0x7')];_0x1a9116<_0x4594ec;_0x1a9116++){var _0x1ae607=events[_0x1a9116];var _0x458f0b=createListener(_0xac99('0x8')+_0x1ae607,_0x44294b);VoicePrefixEvents['on'](_0x1ae607,_0x458f0b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 65a5616..366f2a7 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x47f4c2,_0x134e7b){var _0x22c63e=function(_0x5b8572){while(--_0x5b8572){_0x47f4c2['push'](_0x47f4c2['shift']());}};_0x22c63e(++_0x134e7b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2cad1d,_0x95a8c7){_0x2cad1d=_0x2cad1d-0x0;var _0x4a900c=_0xb10b[_0x2cad1d];return _0x4a900c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x338b26,_0x45d064){var _0x21d9da=function(_0x10c8bb){while(--_0x10c8bb){_0x338b26['push'](_0x338b26['shift']());}};_0x21d9da(++_0x45d064);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 6ef7b49..a0ae0e9 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 _0xf97b=['type','dialMethod','booked','predictive','power','INTEGER','yes','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue'];(function(_0x54d0a3,_0x5d25b2){var _0x2d79c9=function(_0x11a14e){while(--_0x11a14e){_0x54d0a3['push'](_0x54d0a3['shift']());}};_0x2d79c9(++_0x5d25b2);}(_0xf97b,0x97));var _0xbf97=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf97b[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xbf97('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf97('0x1')],'allowNull':![],'unique':_0xbf97('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xbf97('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xbf97('0x5')},'announce':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbf97('0x3')]('rr','ringall',_0xbf97('0x6'),_0xbf97('0x7'),_0xbf97('0x8'),'rrmemory',_0xbf97('0x9'),_0xbf97('0xa'),_0xbf97('0xb')),'allowNull':![],'defaultValue':_0xbf97('0xc'),'set':function(_0x23d78b){this[_0xbf97('0xd')](_0xbf97('0xe'),_0x23d78b?_0x23d78b:_0xbf97('0xf'));},'get':function(){var _0x4d6377=this[_0xbf97('0x10')](_0xbf97('0x11'));var _0x11872e=this['getDataValue'](_0xbf97('0x12'));var _0x128c48=this['getDataValue'](_0xbf97('0xe'));if(_0x4d6377==='inbound'){return _0x128c48;}if(_0x11872e==='booked'&&_0x128c48==='rrmemory'||_0x11872e===_0xbf97('0x13')&&_0x128c48==='roundrobin'){return _0x128c48;}if(_0x11872e==='progressive'||_0x11872e===_0xbf97('0x14')||_0x11872e===_0xbf97('0x15')){return _0x128c48;}return null;}},'servicelevel':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbf97('0x16')](0xb)},'timeout':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbf97('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xbf97('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbf97('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbf97('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xbf97('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbf97('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':_0xbf97('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xbf97('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xbf97('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbf97('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbf97('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xbf97('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbf97('0x1')]},'queue_less_than':{'type':Sequelize[_0xbf97('0x1')]},'periodic_announce':{'type':Sequelize[_0xbf97('0x18')],'set':function(_0x2931cf){this['setDataValue']('periodic_announce',_0x2931cf?_0x2931cf[_0xbf97('0x19')](','):[]);},'get':function(){return this[_0xbf97('0x10')]('periodic_announce')?this[_0xbf97('0x10')](_0xbf97('0x1a'))[_0xbf97('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xbf97('0x17'),'set':function(_0xa6d53d){this[_0xbf97('0xd')]('joinempty',_0xa6d53d?_0xa6d53d[_0xbf97('0x19')](','):undefined);},'get':function(){return this[_0xbf97('0x10')]('joinempty')?this[_0xbf97('0x10')](_0xbf97('0x1c'))[_0xbf97('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':'no','set':function(_0x57ed47){this['setDataValue'](_0xbf97('0x1d'),_0x57ed47?_0x57ed47[_0xbf97('0x19')](','):undefined);},'get':function(){return this[_0xbf97('0x10')](_0xbf97('0x1d'))?this[_0xbf97('0x10')](_0xbf97('0x1d'))[_0xbf97('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf97('0x1')]},'acw':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'set':function(_0x1595cb){this[_0xbf97('0xd')](_0xbf97('0x1f'),_0x1595cb);if(_0x1595cb){if(this[_0xbf97('0x10')]('wrapuptime')<0x2){this[_0xbf97('0xd')](_0xbf97('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbf97('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbf97('0x22'),_0xbf97('0x15'),_0xbf97('0x14'),_0xbf97('0x13')),'defaultValue':_0xbf97('0x22'),'comment':_0xbf97('0x23')},'dialLimitChannel':{'type':Sequelize[_0xbf97('0x16')](0x4)[_0xbf97('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xbf97('0x16')](0x4)[_0xbf97('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbf97('0x25')},'dialPowerLevel':{'type':Sequelize[_0xbf97('0x26')](0x2)[_0xbf97('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbf97('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbf97('0x28'),_0xbf97('0x29')),'defaultValue':_0xbf97('0x29'),'comment':_0xbf97('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbf97('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbf97('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbf97('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbf97('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':_0xbf97('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x2f')},'dialQueueProject':{'type':Sequelize[_0xbf97('0x1')],'comment':_0xbf97('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbf97('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbf97('0x35')},'dialTimezone':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':_0xbf97('0x36')},'dialPrefix':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbf97('0x3')]('always',_0xbf97('0x37'),_0xbf97('0x38')),'defaultValue':_0xbf97('0x39')},'dialAMDActive':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'comment':_0xbf97('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbf97('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbf97('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xbf97('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbf97('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf97('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbf97('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbf97('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbf97('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbf97('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf97('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbf97('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'comment':_0xbf97('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x44'),_0xbf97('0x45')),'defaultValue':_0xbf97('0x44')},'dialQueueProject2':{'type':Sequelize[_0xbf97('0x1')],'comment':_0xbf97('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf97('0x46')},'dialCutDigit':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf97('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf97('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':![],'comment':_0xbf97('0x51'),'set':function(_0xd5cc7){if(!_0xd5cc7)this[_0xbf97('0xd')](_0xbf97('0x52'),null);this[_0xbf97('0xd')](_0xbf97('0x53'),_0xd5cc7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xbf97('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbf97('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf145=['power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','outbound','inbound','default','STRING','ringall','leastrecent','fewestcalls','rrmemory','linear','rrordered','setDataValue','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview'];(function(_0x533489,_0xd4da83){var _0xc874fb=function(_0x38cafb){while(--_0x38cafb){_0x533489['push'](_0x533489['shift']());}};_0xc874fb(++_0xd4da83);}(_0xf145,0x17e));var _0x5f14=function(_0xb7bd46,_0x941298){_0xb7bd46=_0xb7bd46-0x0;var _0x2abe45=_0xf145[_0xb7bd46];return _0x2abe45;};'use strict';var Sequelize=require(_0x5f14('0x0'));module[_0x5f14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f14('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5f14('0x3')]('inbound',_0x5f14('0x4')),'allowNull':![],'defaultValue':_0x5f14('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x5f14('0x6')},'announce':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5f14('0x3')]('rr',_0x5f14('0x8'),_0x5f14('0x9'),_0x5f14('0xa'),'random',_0x5f14('0xb'),_0x5f14('0xc'),'wrandom',_0x5f14('0xd')),'allowNull':![],'defaultValue':_0x5f14('0x8'),'set':function(_0x5a05a7){this[_0x5f14('0xe')]('strategy',_0x5a05a7?_0x5a05a7:_0x5f14('0xb'));},'get':function(){var _0x39f77c=this[_0x5f14('0xf')]('type');var _0x495d4d=this[_0x5f14('0xf')]('dialMethod');var _0x327356=this[_0x5f14('0xf')]('strategy');if(_0x39f77c==='inbound'){return _0x327356;}if(_0x495d4d===_0x5f14('0x10')&&_0x327356===_0x5f14('0xb')||_0x495d4d===_0x5f14('0x10')&&_0x327356===_0x5f14('0x11')){return _0x327356;}if(_0x495d4d===_0x5f14('0x12')||_0x495d4d===_0x5f14('0x13')||_0x495d4d==='power'){return _0x327356;}return null;}},'servicelevel':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x5f14('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':_0x5f14('0x15')},'autopause':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5f14('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5f14('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5f14('0x7')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x5f14('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x5f14('0x15'),'no'),'defaultValue':_0x5f14('0x15')},'announce_holdtime':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x5f14('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x5f14('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5f14('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5f14('0x7')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5f14('0x7')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x5f14('0x7')]},'periodic_announce':{'type':Sequelize[_0x5f14('0x16')],'set':function(_0x2671df){this['setDataValue']('periodic_announce',_0x2671df?_0x2671df[_0x5f14('0x17')](','):[]);},'get':function(){return this[_0x5f14('0xf')]('periodic_announce')?this[_0x5f14('0xf')](_0x5f14('0x18'))[_0x5f14('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':_0x5f14('0x15'),'set':function(_0x4bb6f4){this[_0x5f14('0xe')](_0x5f14('0x1a'),_0x4bb6f4?_0x4bb6f4[_0x5f14('0x17')](','):undefined);},'get':function(){return this[_0x5f14('0xf')](_0x5f14('0x1a'))?this[_0x5f14('0xf')]('joinempty')['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':'no','set':function(_0x325c64){this[_0x5f14('0xe')](_0x5f14('0x1b'),_0x325c64?_0x325c64[_0x5f14('0x17')](','):undefined);},'get':function(){return this[_0x5f14('0xf')](_0x5f14('0x1b'))?this['getDataValue'](_0x5f14('0x1b'))[_0x5f14('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5f14('0x7')]},'description':{'type':Sequelize[_0x5f14('0x7')]},'acw':{'type':Sequelize[_0x5f14('0x1c')],'defaultValue':0x0,'set':function(_0x113f04){this[_0x5f14('0xe')](_0x5f14('0x1d'),_0x113f04);if(_0x113f04){if(this[_0x5f14('0xf')](_0x5f14('0x1e'))<0x2){this['setDataValue'](_0x5f14('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5f14('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5f14('0x1f')},'dialMethod':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x20'),_0x5f14('0x12'),_0x5f14('0x21'),'predictive','booked'),'defaultValue':_0x5f14('0x12'),'comment':_0x5f14('0x22')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x5f14('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5f14('0x24')},'dialLimitQueue':{'type':Sequelize[_0x5f14('0x14')](0x4)[_0x5f14('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5f14('0x25')},'dialPowerLevel':{'type':Sequelize[_0x5f14('0x26')](0x2)[_0x5f14('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5f14('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x28'),_0x5f14('0x29')),'defaultValue':_0x5f14('0x29'),'comment':_0x5f14('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5f14('0x26')](0x2)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5f14('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5f14('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5f14('0x7')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x5f14('0x2e'),'comment':_0x5f14('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x30')},'dialQueueProject':{'type':Sequelize[_0x5f14('0x7')],'comment':_0x5f14('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5f14('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'comment':_0x5f14('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5f14('0x36')},'dialTimezone':{'type':Sequelize[_0x5f14('0x7')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5f14('0x3')](_0x5f14('0x37'),_0x5f14('0x38'),'onlyIfOpen'),'defaultValue':_0x5f14('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5f14('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5f14('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5f14('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5f14('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5f14('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x5f14('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5f14('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5f14('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5f14('0x14')](0x9)[_0x5f14('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5f14('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5f14('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5f14('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x5f14('0x42')),'defaultValue':_0x5f14('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x5f14('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5f14('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5f14('0x44')},'dialCutDigit':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5f14('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5f14('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5f14('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5f14('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5f14('0x14')](0x3)[_0x5f14('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5f14('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5f14('0x14')](0x5)[_0x5f14('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5f14('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5f14('0x14')],'allowNull':!![],'comment':_0x5f14('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0x5f14('0x1c')],'defaultValue':![],'comment':_0x5f14('0x50'),'set':function(_0x3d40fc){if(!_0x3d40fc)this[_0x5f14('0xe')](_0x5f14('0x51'),null);this['setDataValue'](_0x5f14('0x52'),_0x3d40fc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5f14('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5f14('0x1c')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5f14('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5904775..42920c5 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 _0xa8e1=['create','body','user','role','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','QueueCampaigns','UserProfileSection','destroy','getHoppers','findOne','CmHopper','sort','include','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','removeTeams','isEmpty','emit','addAgents','spread','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ListId','scheduledAt','ContactId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','then','stack','name','send','index','VoiceQueue','fieldName','key','model','query','intersection','length','attributes','hasOwnProperty','nolimit','order','where','filters','pick','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','fields'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa8e1,0x11a));var _0x1a8e=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xa8e1[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a8e('0x0'));var zipdir=require(_0x1a8e('0x1'));var jsonpatch=require(_0x1a8e('0x2'));var rp=require('request-promise');var moment=require(_0x1a8e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a8e('0x4'));var path=require('path');var sox=require(_0x1a8e('0x5'));var csv=require(_0x1a8e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a8e('0x7'));var squel=require(_0x1a8e('0x8'));var crypto=require(_0x1a8e('0x9'));var jsforce=require(_0x1a8e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1a8e('0x6'));var querystring=require('querystring');var Papa=require(_0x1a8e('0xb'));var Redis=require(_0x1a8e('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1a8e('0xd'));var as=require(_0x1a8e('0xe'));var hardwareService=require(_0x1a8e('0xf'));var logger=require(_0x1a8e('0x10'))(_0x1a8e('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a8e('0x12'));var db=require(_0x1a8e('0x13'))['db'];config['redis']=_[_0x1a8e('0x14')](config['redis'],{'host':_0x1a8e('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a8e('0x16')]));require('./voiceQueue.socket')[_0x1a8e('0x17')](socket);function respondWithStatusCode(_0x34c93b,_0x17ad11){_0x17ad11=_0x17ad11||0xcc;return function(_0x321bfb){if(_0x321bfb){return _0x34c93b[_0x1a8e('0x18')](_0x17ad11);}return _0x34c93b[_0x1a8e('0x19')](_0x17ad11)[_0x1a8e('0x1a')]();};}function respondWithResult(_0x471c41,_0x41560f){_0x41560f=_0x41560f||0xc8;return function(_0x2761e5){if(_0x2761e5){return _0x471c41[_0x1a8e('0x19')](_0x41560f)[_0x1a8e('0x1b')](_0x2761e5);}};}function respondWithFilteredResult(_0x3895a5,_0x5da411){return function(_0x2bc004){if(_0x2bc004){var _0x23dcc8=typeof _0x5da411[_0x1a8e('0x1c')]==='undefined'&&typeof _0x5da411[_0x1a8e('0x1d')]==='undefined';var _0x399f82=_0x2bc004[_0x1a8e('0x1e')];var _0x596b30=_0x23dcc8?0x0:_0x5da411[_0x1a8e('0x1c')];var _0x3187db=_0x23dcc8?_0x2bc004[_0x1a8e('0x1e')]:_0x5da411['offset']+_0x5da411[_0x1a8e('0x1d')];var _0x2f05b4;if(_0x3187db>=_0x399f82){_0x3187db=_0x399f82;_0x2f05b4=0xc8;}else{_0x2f05b4=0xce;}_0x3895a5[_0x1a8e('0x19')](_0x2f05b4);return _0x3895a5['set'](_0x1a8e('0x1f'),_0x596b30+'-'+_0x3187db+'/'+_0x399f82)['json'](_0x2bc004);}return null;};}function patchUpdates(_0x1ed34f){return function(_0x265bdf){try{jsonpatch[_0x1a8e('0x20')](_0x265bdf,_0x1ed34f,!![]);}catch(_0x1f2441){return BPromise[_0x1a8e('0x21')](_0x1f2441);}return _0x265bdf[_0x1a8e('0x22')]();};}function saveUpdates(_0x45cf04,_0xa8f1f5){return function(_0x5e7752){if(_0x5e7752){return _0x5e7752[_0x1a8e('0x23')](_0x45cf04)['then'](function(_0x33b39a){return _0x33b39a;});}return null;};}function removeEntity(_0x19c03c,_0x37b8b4){return function(_0x5e0e83){if(_0x5e0e83){return _0x5e0e83['destroy']()['then'](function(){var _0x42868e=_0x5e0e83['get']({'plain':!![]});var _0x3c39de=[{'name':_0x1a8e('0x24'),'value':_0x1a8e('0x25'),'ignore':![]},{'name':'QueueCampaigns','value':_0x1a8e('0x26'),'ignore':![]}];var _0x544220=_(_0x3c39de)[_0x1a8e('0x27')](_0x1a8e('0x28'))[_0x1a8e('0x29')]('value')[_0x1a8e('0x2a')]();if(_[_0x1a8e('0x2b')](_0x544220,_0x42868e['type'])){return;}var _0x5da3e7=_[_0x1a8e('0x2c')](_0x3c39de,[_0x1a8e('0x2a'),_0x42868e[_0x1a8e('0x2d')]])['name'];return db[_0x1a8e('0x2e')]['destroy']({'where':{'type':_0x5da3e7,'resourceId':_0x42868e['id']}})[_0x1a8e('0x2f')](function(){return _0x5e0e83;});})[_0x1a8e('0x2f')](function(){_0x19c03c[_0x1a8e('0x19')](0xcc)[_0x1a8e('0x1a')]();});}};}function handleEntityNotFound(_0x5bad9b,_0x359378){return function(_0x5d84bc){if(!_0x5d84bc){_0x5bad9b[_0x1a8e('0x18')](0x194);}return _0x5d84bc;};}function handleError(_0x1969f1,_0x5bce61){_0x5bce61=_0x5bce61||0x1f4;return function(_0x2c7a99){logger['error'](_0x2c7a99[_0x1a8e('0x30')]);if(_0x2c7a99['name']){delete _0x2c7a99[_0x1a8e('0x31')];}_0x1969f1[_0x1a8e('0x19')](_0x5bce61)[_0x1a8e('0x32')](_0x2c7a99);};}exports[_0x1a8e('0x33')]=function(_0x46dfd4,_0x39702e){var _0x478e8f={},_0x478ed0={},_0x50c548={'count':0x0,'rows':[]};var _0x33276a=_[_0x1a8e('0x29')](db[_0x1a8e('0x34')]['rawAttributes'],function(_0x5a4802){return{'name':_0x5a4802[_0x1a8e('0x35')],'type':_0x5a4802[_0x1a8e('0x2d')][_0x1a8e('0x36')]};});_0x478ed0[_0x1a8e('0x37')]=_['map'](_0x33276a,_0x1a8e('0x31'));_0x478ed0['query']=_['keys'](_0x46dfd4[_0x1a8e('0x38')]);_0x478ed0['filters']=_[_0x1a8e('0x39')](_0x478ed0['model'],_0x478ed0['query']);_0x478e8f['attributes']=_['intersection'](_0x478ed0['model'],qs['fields'](_0x46dfd4[_0x1a8e('0x38')]['fields']));_0x478e8f['attributes']=_0x478e8f['attributes'][_0x1a8e('0x3a')]?_0x478e8f[_0x1a8e('0x3b')]:_0x478ed0[_0x1a8e('0x37')];if(!_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x478e8f[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x46dfd4['query'][_0x1a8e('0x1d')]);_0x478e8f['offset']=qs['offset'](_0x46dfd4[_0x1a8e('0x38')]['offset']);}_0x478e8f[_0x1a8e('0x3e')]=qs['sort'](_0x46dfd4['query']['sort']);_0x478e8f[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x46dfd4[_0x1a8e('0x38')],_0x478ed0['filters']),_0x33276a);if(_0x46dfd4['query'][_0x1a8e('0x27')]){_0x478e8f[_0x1a8e('0x3f')]=_['merge'](_0x478e8f[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x33276a,function(_0x5696fb){if(_0x5696fb[_0x1a8e('0x2d')]!=='VIRTUAL'){var _0x471fee={};_0x471fee[_0x5696fb[_0x1a8e('0x31')]]={'$like':'%'+_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x471fee;}})});}_0x478e8f=_[_0x1a8e('0x42')]({},_0x478e8f,_0x46dfd4[_0x1a8e('0x43')]);var _0x23fa03={'where':_0x478e8f[_0x1a8e('0x3f')]};return db['VoiceQueue']['count'](_0x23fa03)['then'](function(_0x25abfb){_0x50c548['count']=_0x25abfb;if(_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x478e8f['include']=[{'all':!![]}];}return db[_0x1a8e('0x34')]['findAll'](_0x478e8f);})['then'](function(_0x566571){_0x50c548[_0x1a8e('0x45')]=_0x566571;return _0x50c548;})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x39702e,_0x478e8f))[_0x1a8e('0x46')](handleError(_0x39702e,null));};exports[_0x1a8e('0x47')]=function(_0x4bbfd6,_0x5c110a){var _0x3bf0f3={'raw':![],'where':{'id':_0x4bbfd6[_0x1a8e('0x48')]['id']}},_0x3327f4={};_0x3327f4[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x34')][_0x1a8e('0x4a')]);_0x3327f4[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x4bbfd6[_0x1a8e('0x38')]);_0x3327f4[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x3327f4[_0x1a8e('0x37')],_0x3327f4['query']);_0x3bf0f3[_0x1a8e('0x3b')]=_['intersection'](_0x3327f4[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x4bbfd6[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x3bf0f3['attributes']=_0x3bf0f3[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x3bf0f3[_0x1a8e('0x3b')]:_0x3327f4[_0x1a8e('0x37')];if(_0x4bbfd6[_0x1a8e('0x38')]['includeAll']){_0x3bf0f3['include']=[{'all':!![]}];}_0x3bf0f3=_[_0x1a8e('0x42')]({},_0x3bf0f3,_0x4bbfd6[_0x1a8e('0x43')]);return db['VoiceQueue'][_0x1a8e('0x2c')](_0x3bf0f3)['then'](handleEntityNotFound(_0x5c110a,null))['then'](respondWithResult(_0x5c110a,null))[_0x1a8e('0x46')](handleError(_0x5c110a,null));};exports['create']=function(_0x4ec62e,_0x32f2ed){return db[_0x1a8e('0x34')][_0x1a8e('0x4c')](_0x4ec62e[_0x1a8e('0x4d')],{})['then'](function(_0x4e8da8){var _0x121bae=_0x4ec62e[_0x1a8e('0x4e')]['get']({'plain':!![]});if(!_0x121bae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x121bae[_0x1a8e('0x4f')]===_0x1a8e('0x4e')){var _0x20f1ce=_0x4e8da8[_0x1a8e('0x50')]({'plain':!![]});var _0x5326fa=[{'name':'VoiceQueues','value':_0x1a8e('0x25')},{'name':'QueueCampaigns','value':'outbound'}];var _0x3422e8=_[_0x1a8e('0x2c')](_0x5326fa,['value',_0x20f1ce[_0x1a8e('0x2d')]])[_0x1a8e('0x31')];return db['UserProfileSection'][_0x1a8e('0x2c')]({'where':{'name':_0x3422e8,'userProfileId':_0x121bae[_0x1a8e('0x51')]},'raw':!![]})['then'](function(_0x547b45){if(_0x547b45&&_0x547b45['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a8e('0x4c')]({'name':_0x20f1ce[_0x1a8e('0x31')],'resourceId':_0x20f1ce['id'],'type':_0x547b45[_0x1a8e('0x31')],'sectionId':_0x547b45['id']},{})[_0x1a8e('0x2f')](function(){return _0x4e8da8;});}else{return _0x4e8da8;}})['catch'](function(_0x5e0e4f){logger[_0x1a8e('0x52')](_0x1a8e('0x53'),_0x5e0e4f);throw _0x5e0e4f;});}return _0x4e8da8;})['then'](respondWithResult(_0x32f2ed,0xc9))[_0x1a8e('0x46')](handleError(_0x32f2ed,null));};exports['clone']=function(_0x3d3531,_0xbda64e){var _0x2076c3={'where':{'id':_0x3d3531[_0x1a8e('0x48')]['id']}},_0x37673c={};_0x37673c['model']=_[_0x1a8e('0x49')](db[_0x1a8e('0x34')][_0x1a8e('0x4a')]);_0x2076c3['attributes']=_['intersection'](_0x37673c[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x3d3531[_0x1a8e('0x38')]['fields']));_0x2076c3[_0x1a8e('0x3b')]=_0x2076c3[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x2076c3[_0x1a8e('0x3b')]:_0x37673c[_0x1a8e('0x37')];if(_0x3d3531[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x2076c3['include']=[{'all':!![]}];}_0x2076c3=_[_0x1a8e('0x42')]({},_0x2076c3,_0x3d3531['options']);return db[_0x1a8e('0x34')][_0x1a8e('0x2c')](_0x2076c3)['then'](handleEntityNotFound(_0xbda64e,null))[_0x1a8e('0x2f')](function(_0x16049e){if(_0x16049e){var _0x78aac5=_0x16049e[_0x1a8e('0x50')]({'plain':!![]});_0x78aac5=qs[_0x1a8e('0x54')](_0x78aac5,['id',_0x1a8e('0x55'),_0x1a8e('0x56')]);_0x3d3531[_0x1a8e('0x4d')]=_[_0x1a8e('0x54')](_0x3d3531['body'],['id',_0x1a8e('0x55'),_0x1a8e('0x56')]);return db[_0x1a8e('0x34')][_0x1a8e('0x4c')](_[_0x1a8e('0x42')](_0x78aac5,_0x3d3531['body']),{'include':_0x3d3531['query'][_0x1a8e('0x44')]?[{'all':!![]}]:undefined})[_0x1a8e('0x2f')](function(_0x1c1e5e){var _0x155ddd=_0x3d3531[_0x1a8e('0x4e')][_0x1a8e('0x50')]({'plain':!![]});if(!_0x155ddd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155ddd['role']===_0x1a8e('0x4e')){var _0x480337=_0x1c1e5e[_0x1a8e('0x50')]({'plain':!![]});var _0x4c1eec=[{'name':_0x1a8e('0x24'),'value':_0x1a8e('0x25')},{'name':_0x1a8e('0x57'),'value':'outbound'}];var _0x560c39=_[_0x1a8e('0x2c')](_0x4c1eec,[_0x1a8e('0x2a'),_0x480337[_0x1a8e('0x2d')]])['name'];return db[_0x1a8e('0x58')][_0x1a8e('0x2c')]({'where':{'name':_0x560c39,'userProfileId':_0x155ddd[_0x1a8e('0x51')]},'raw':!![]})[_0x1a8e('0x2f')](function(_0x4869e3){if(_0x4869e3&&_0x4869e3['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a8e('0x4c')]({'name':_0x480337['name'],'resourceId':_0x480337['id'],'type':_0x4869e3['name'],'sectionId':_0x4869e3['id']},{})[_0x1a8e('0x2f')](function(){return _0x1c1e5e;});}else{return _0x1c1e5e;}})[_0x1a8e('0x46')](function(_0x3208f3){logger[_0x1a8e('0x52')](_0x1a8e('0x53'),_0x3208f3);throw _0x3208f3;});}return _0x1c1e5e;});}})[_0x1a8e('0x2f')](respondWithResult(_0xbda64e,0xc9))[_0x1a8e('0x46')](handleError(_0xbda64e,null));};exports['update']=function(_0x2e5902,_0xf16c8e){if(_0x2e5902[_0x1a8e('0x4d')]['id']){delete _0x2e5902[_0x1a8e('0x4d')]['id'];}return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2e5902[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0xf16c8e,null))['then'](saveUpdates(_0x2e5902[_0x1a8e('0x4d')],null))[_0x1a8e('0x2f')](respondWithResult(_0xf16c8e,null))[_0x1a8e('0x46')](handleError(_0xf16c8e,null));};exports[_0x1a8e('0x59')]=function(_0x2baf2b,_0xe1c561){return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x2baf2b['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0xe1c561,null))[_0x1a8e('0x2f')](removeEntity(_0xe1c561,null))[_0x1a8e('0x46')](handleError(_0xe1c561,null));};exports[_0x1a8e('0x5a')]=function(_0x2612ab,_0x3226a5,_0x55fa31){var _0x375231={'raw':![],'where':{}};var _0x18370f={};var _0x5edb3b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1a8e('0x5b')]({'where':{'id':_0x2612ab[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x3226a5,null))[_0x1a8e('0x2f')](function(_0x8941df){if(_0x8941df){_0x18370f[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x5c')]['rawAttributes']);_0x18370f[_0x1a8e('0x38')]=_['keys'](_0x2612ab[_0x1a8e('0x38')]);_0x18370f[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x18370f[_0x1a8e('0x37')],_0x18370f[_0x1a8e('0x38')]);_0x375231[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x18370f[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x2612ab['query']['fields']));_0x375231[_0x1a8e('0x3b')]=_0x375231[_0x1a8e('0x3b')]['length']?_0x375231['attributes']:_0x18370f[_0x1a8e('0x37')];if(!_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x3c')]('nolimit')){_0x375231[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x375231[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x375231[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x375231[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x2612ab[_0x1a8e('0x38')],_0x18370f[_0x1a8e('0x40')]));_0x375231[_0x1a8e('0x3f')]['VoiceQueueId']=_0x8941df['id'];if(_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x375231[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x375231[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x375231['attributes'],function(_0x56f4a5){var _0x19fe82={};_0x19fe82[_0x56f4a5]={'$like':'%'+_0x2612ab['query'][_0x1a8e('0x27')]+'%'};return _0x19fe82;})});}_0x375231=_[_0x1a8e('0x42')]({},_0x375231,_0x2612ab[_0x1a8e('0x43')]);return db['CmHopper'][_0x1a8e('0x1e')]({'where':_0x375231['where']})['then'](function(_0x5b9414){_0x5edb3b[_0x1a8e('0x1e')]=_0x5b9414;if(_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x375231[_0x1a8e('0x5e')]=[{'all':!![]}];}return db['CmHopper'][_0x1a8e('0x5f')](_0x375231);})[_0x1a8e('0x2f')](function(_0x106890){_0x5edb3b['rows']=_0x106890;return _0x5edb3b;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x3226a5,_0x375231))[_0x1a8e('0x46')](handleError(_0x3226a5,null));};exports['getHopperHistories']=function(_0x10eeea,_0x2cf8a6,_0x27c415){var _0x5ab975={'raw':!![],'where':{}};var _0x468633={};var _0x57ed73={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x10eeea['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2cf8a6,null))['then'](function(_0x5f3005){if(_0x5f3005){_0x468633[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x60')][_0x1a8e('0x4a')]);_0x468633['query']=_[_0x1a8e('0x49')](_0x10eeea['query']);_0x468633[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x468633[_0x1a8e('0x37')],_0x468633[_0x1a8e('0x38')]);_0x5ab975[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x468633[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x5ab975[_0x1a8e('0x3b')]=_0x5ab975[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x5ab975[_0x1a8e('0x3b')]:_0x468633[_0x1a8e('0x37')];if(!_0x10eeea[_0x1a8e('0x38')]['hasOwnProperty'](_0x1a8e('0x3d'))){_0x5ab975[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x5ab975['offset']=qs[_0x1a8e('0x1c')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x5ab975[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x5ab975[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x10eeea[_0x1a8e('0x38')],_0x468633[_0x1a8e('0x40')]));_0x5ab975[_0x1a8e('0x3f')]['VoiceQueueId']=_0x5f3005['id'];if(_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x5ab975[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x5ab975['where'],{'$or':_[_0x1a8e('0x29')](_0x5ab975[_0x1a8e('0x3b')],function(_0x28363c){var _0x33bc32={};_0x33bc32[_0x28363c]={'$like':'%'+_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x33bc32;})});}_0x5ab975=_[_0x1a8e('0x42')]({},_0x5ab975,_0x10eeea['options']);return db[_0x1a8e('0x60')][_0x1a8e('0x1e')]({'where':_0x5ab975[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x7a8c2f){_0x57ed73[_0x1a8e('0x1e')]=_0x7a8c2f;if(_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x5ab975['include']=[{'all':!![]}];}return db[_0x1a8e('0x60')][_0x1a8e('0x5f')](_0x5ab975);})[_0x1a8e('0x2f')](function(_0x58315e){_0x57ed73[_0x1a8e('0x45')]=_0x58315e;return _0x57ed73;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x2cf8a6,_0x5ab975))[_0x1a8e('0x46')](handleError(_0x2cf8a6,null));};exports[_0x1a8e('0x61')]=function(_0x1d38d1,_0x2c8941,_0x4df0cc){var _0x26eda5={'raw':!![],'where':{}};var _0x3e3ebd={};var _0x28dd1c={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x1d38d1[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2c8941,null))['then'](function(_0x52f65b){if(_0x52f65b){_0x3e3ebd['model']=_[_0x1a8e('0x49')](db[_0x1a8e('0x62')][_0x1a8e('0x4a')]);_0x3e3ebd['query']=_[_0x1a8e('0x49')](_0x1d38d1[_0x1a8e('0x38')]);_0x3e3ebd[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x3e3ebd[_0x1a8e('0x37')],_0x3e3ebd['query']);_0x26eda5[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x3e3ebd[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x1d38d1['query'][_0x1a8e('0x4b')]));_0x26eda5[_0x1a8e('0x3b')]=_0x26eda5[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x26eda5[_0x1a8e('0x3b')]:_0x3e3ebd[_0x1a8e('0x37')];if(!_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x26eda5[_0x1a8e('0x1d')]=qs['limit'](_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x26eda5[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x1d38d1[_0x1a8e('0x38')]['offset']);}_0x26eda5['order']=qs['sort'](_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x26eda5['where']=qs['filters'](_[_0x1a8e('0x41')](_0x1d38d1['query'],_0x3e3ebd[_0x1a8e('0x40')]));_0x26eda5['where'][_0x1a8e('0x63')]=_0x52f65b['id'];if(_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x26eda5[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x26eda5['where'],{'$or':_[_0x1a8e('0x29')](_0x26eda5[_0x1a8e('0x3b')],function(_0x4a6e73){var _0x4adf48={};_0x4adf48[_0x4a6e73]={'$like':'%'+_0x1d38d1['query']['filter']+'%'};return _0x4adf48;})});}_0x26eda5=_['merge']({},_0x26eda5,_0x1d38d1['options']);return db[_0x1a8e('0x62')][_0x1a8e('0x1e')]({'where':_0x26eda5[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x249c37){_0x28dd1c[_0x1a8e('0x1e')]=_0x249c37;if(_0x1d38d1[_0x1a8e('0x38')]['includeAll']){_0x26eda5['include']=[{'all':!![]}];}return db[_0x1a8e('0x62')][_0x1a8e('0x5f')](_0x26eda5);})[_0x1a8e('0x2f')](function(_0x10cedc){_0x28dd1c['rows']=_0x10cedc;return _0x28dd1c;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x2c8941,_0x26eda5))['catch'](handleError(_0x2c8941,null));};exports[_0x1a8e('0x64')]=function(_0x191d0d,_0x37fba2,_0x22d268){var _0x1b5e74={'raw':!![],'where':{}};var _0x42dc6c={};var _0x45d176={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x191d0d[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x37fba2,null))[_0x1a8e('0x2f')](function(_0x42eb9){if(_0x42eb9){_0x42dc6c[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x65')][_0x1a8e('0x4a')]);_0x42dc6c[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x191d0d[_0x1a8e('0x38')]);_0x42dc6c[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x42dc6c[_0x1a8e('0x37')],_0x42dc6c[_0x1a8e('0x38')]);_0x1b5e74[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x42dc6c[_0x1a8e('0x37')],qs['fields'](_0x191d0d[_0x1a8e('0x38')]['fields']));_0x1b5e74['attributes']=_0x1b5e74[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x1b5e74[_0x1a8e('0x3b')]:_0x42dc6c[_0x1a8e('0x37')];if(!_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x1b5e74[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x191d0d['query'][_0x1a8e('0x1d')]);_0x1b5e74[_0x1a8e('0x1c')]=qs['offset'](_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x1b5e74['order']=qs['sort'](_0x191d0d['query'][_0x1a8e('0x5d')]);_0x1b5e74[_0x1a8e('0x3f')]=qs['filters'](_['pick'](_0x191d0d[_0x1a8e('0x38')],_0x42dc6c[_0x1a8e('0x40')]));_0x1b5e74[_0x1a8e('0x3f')][_0x1a8e('0x63')]=_0x42eb9['id'];if(_0x191d0d[_0x1a8e('0x38')]['filter']){_0x1b5e74[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x1b5e74[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x1b5e74[_0x1a8e('0x3b')],function(_0x5b0b56){var _0x4009cc={};_0x4009cc[_0x5b0b56]={'$like':'%'+_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x4009cc;})});}_0x1b5e74=_[_0x1a8e('0x42')]({},_0x1b5e74,_0x191d0d['options']);return db[_0x1a8e('0x65')]['count']({'where':_0x1b5e74[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x56ac3c){_0x45d176[_0x1a8e('0x1e')]=_0x56ac3c;if(_0x191d0d['query'][_0x1a8e('0x44')]){_0x1b5e74[_0x1a8e('0x5e')]=[{'all':!![]}];}return db[_0x1a8e('0x65')][_0x1a8e('0x5f')](_0x1b5e74);})[_0x1a8e('0x2f')](function(_0xfb9abd){_0x45d176[_0x1a8e('0x45')]=_0xfb9abd;return _0x45d176;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x37fba2,_0x1b5e74))[_0x1a8e('0x46')](handleError(_0x37fba2,null));};exports['getTeams']=function(_0x127b95,_0x236260,_0xd6e161){var _0x231c7c={};var _0x46f64c={};var _0x5da7b0;var _0x1639a1;return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x127b95[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x236260,null))[_0x1a8e('0x2f')](function(_0x3d6bae){if(_0x3d6bae){_0x5da7b0=_0x3d6bae;_0x46f64c[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x66')][_0x1a8e('0x4a')]);_0x46f64c[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x127b95['query']);_0x46f64c[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x46f64c[_0x1a8e('0x37')],_0x46f64c[_0x1a8e('0x38')]);_0x231c7c['attributes']=_[_0x1a8e('0x39')](_0x46f64c[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x231c7c[_0x1a8e('0x3b')]=_0x231c7c[_0x1a8e('0x3b')]['length']?_0x231c7c[_0x1a8e('0x3b')]:_0x46f64c[_0x1a8e('0x37')];_0x231c7c[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x127b95[_0x1a8e('0x38')]['sort']);_0x231c7c[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x127b95['query'],_0x46f64c[_0x1a8e('0x40')]));if(_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x231c7c[_0x1a8e('0x3f')]=_['merge'](_0x231c7c[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x231c7c[_0x1a8e('0x3b')],function(_0x3b4025){var _0x57b23f={};_0x57b23f[_0x3b4025]={'$like':'%'+_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x57b23f;})});}_0x231c7c=_[_0x1a8e('0x42')]({},_0x231c7c,_0x127b95[_0x1a8e('0x43')]);return _0x5da7b0[_0x1a8e('0x67')](_0x231c7c);}})[_0x1a8e('0x2f')](function(_0x246b7c){if(_0x246b7c){_0x1639a1=_0x246b7c['length'];if(!_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x231c7c['limit']=qs[_0x1a8e('0x1d')](_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x231c7c[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x127b95[_0x1a8e('0x38')]['offset']);}return _0x5da7b0[_0x1a8e('0x67')](_0x231c7c);}})[_0x1a8e('0x2f')](function(_0x5d0604){if(_0x5d0604){return _0x5d0604?{'count':_0x1639a1,'rows':_0x5d0604}:null;}})['then'](respondWithResult(_0x236260,null))[_0x1a8e('0x46')](handleError(_0x236260,null));};exports[_0x1a8e('0x68')]=function(_0x1116a0,_0x4d799d,_0x3910c3){var _0x3a699c=_0x1116a0[_0x1a8e('0x4d')]['teams'];var _0x464a6d=_[_0x1a8e('0x29')](_0x3a699c,'id');return db[_0x1a8e('0x66')][_0x1a8e('0x5f')]({'where':{'id':_0x464a6d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1a8e('0x69'),'attributes':['id',_0x1a8e('0x31'),_0x1a8e('0x6a'),_0x1a8e('0x6b'),_0x1a8e('0x6c')],'raw':!![]}]})[_0x1a8e('0x2f')](function(_0x2a1a96){if(_0x2a1a96){var _0x28defb=_[_0x1a8e('0x6d')](_0x2a1a96,function(_0xc01fa4){var _0x22202d=_0xc01fa4[_0x1a8e('0x50')]({'plain':!![]});_0x22202d[_0x1a8e('0x69')][_0x1a8e('0x6e')](function(_0x3b5365){_0x3b5365[_0x1a8e('0x6f')]=_[_0x1a8e('0x2c')](_0x3a699c,{'id':_0x22202d['id']})['penalty'];});return _0x22202d[_0x1a8e('0x69')];});return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x1116a0['params']['id']}})['then'](function(_0x3b5161){return db[_0x1a8e('0x70')][_0x1a8e('0x71')](function(_0x17b036){return _0x3b5161['addTeams'](_0x464a6d,{'transaction':_0x17b036})[_0x1a8e('0x2f')](function(){return BPromise[_0x1a8e('0x72')](_0x3a699c,function(_0x3d8150){return db[_0x1a8e('0x73')][_0x1a8e('0x74')]({'TeamId':_0x3d8150['id'],'VoiceQueueId':_0x1116a0[_0x1a8e('0x48')]['id'],'penalty':_0x3d8150[_0x1a8e('0x6f')]},{'transaction':_0x17b036});});})[_0x1a8e('0x2f')](function(){return BPromise[_0x1a8e('0x72')](_0x28defb,function(_0x16d5c0){return db[_0x1a8e('0x75')][_0x1a8e('0x76')]({'where':{'UserId':_0x16d5c0['id'],'VoiceQueueId':_0x1116a0[_0x1a8e('0x48')]['id']},'defaults':{'penalty':_0x16d5c0[_0x1a8e('0x6f')]},'transaction':_0x17b036});});})['then'](function(){return BPromise[_0x1a8e('0x72')](_[_0x1a8e('0x27')](_0x28defb,{'online':!![]}),function(_0x308b22){return db[_0x1a8e('0x77')][_0x1a8e('0x74')]({'membername':_0x308b22['name'],'UserId':_0x308b22['id'],'queue_name':_0x3b5161[_0x1a8e('0x31')],'VoiceQueueId':_0x3b5161['id'],'interface':_[_0x1a8e('0x78')](_0x308b22[_0x1a8e('0x6c')])?util[_0x1a8e('0x79')]('SIP/%s',_0x308b22[_0x1a8e('0x31')]):_0x308b22[_0x1a8e('0x6c')],'paused':_0x308b22[_0x1a8e('0x6b')]||![],'penalty':_0x308b22[_0x1a8e('0x6f')]},{'transaction':_0x17b036});});})[_0x1a8e('0x2f')](function(){_0x28defb[_0x1a8e('0x6e')](function(_0x12b8f1){socket['emit'](_0x1a8e('0x7a'),{'UserId':_0x12b8f1['id'],'VoiceQueueId':_0x3b5161['id']});});});});});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x4d799d,null))[_0x1a8e('0x46')](handleError(_0x4d799d,null));};exports['removeTeams']=function(_0x20330b,_0x1bd972,_0x4257c0){return db[_0x1a8e('0x66')][_0x1a8e('0x5f')]({'where':{'id':_0x20330b['query'][_0x1a8e('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x1a8e('0x7c')],'as':_0x1a8e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x1a8e('0x2f')](handleEntityNotFound(_0x1bd972,null))[_0x1a8e('0x2f')](function(_0x3c939e){var _0x9e023e=_['map'](_0x3c939e,'id');var _0x357f39=[];var _0x998dd=[];var _0x1e30c6=squel['select']();_0x1e30c6[_0x1a8e('0x7d')](_0x1a8e('0x7e'))[_0x1a8e('0x7f')](_0x1a8e('0x80'),'tq')[_0x1a8e('0x81')](_0x1a8e('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1a8e('0x3f')](_0x1a8e('0x83'),_0x20330b[_0x1a8e('0x48')]['id']);for(var _0x39e605=0x0;_0x39e605<_0x3c939e[_0x1a8e('0x3a')];_0x39e605+=0x1){let _0x283a9d=_0x3c939e[_0x39e605];for(var _0x97034e=0x0;_0x97034e<_0x283a9d[_0x1a8e('0x69')][_0x1a8e('0x3a')];_0x97034e+=0x1){let _0xb7cbc6=_0x283a9d['Agents'][_0x97034e];var _0x4f0aad=_0x1e30c6['clone']();_0x4f0aad[_0x1a8e('0x3f')](_0x1a8e('0x84'),_0xb7cbc6['id']);_0x998dd[_0x1a8e('0x85')](db['sequelize'][_0x1a8e('0x38')](_0x4f0aad[_0x1a8e('0x86')](),{'type':db[_0x1a8e('0x70')]['QueryTypes'][_0x1a8e('0x87')]})[_0x1a8e('0x2f')](function(_0x446ee0){if(_0x446ee0[_0x1a8e('0x3a')]===0x1){return _0xb7cbc6['id'];}else{var _0x3be6dc=_[_0x1a8e('0x88')](_[_0x1a8e('0x29')](_0x446ee0,_0x1a8e('0x89')),function(_0x42db5a){return _[_0x1a8e('0x2b')](_0x9e023e,_0x42db5a);});if(_0x3be6dc){return _0xb7cbc6['id'];}}}));}}return BPromise[_0x1a8e('0x8a')](_0x998dd)[_0x1a8e('0x2f')](function(_0x583f07){_0x357f39=_(_0x357f39)['union'](_0x583f07)[_0x1a8e('0x8b')]()[_0x1a8e('0x2a')]();return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x20330b['params']['id']}})[_0x1a8e('0x2f')](function(_0x170457){return db[_0x1a8e('0x70')][_0x1a8e('0x71')](function(_0x4dafbf){return _0x170457[_0x1a8e('0x8c')](_0x20330b[_0x1a8e('0x38')][_0x1a8e('0x7b')],{'transaction':_0x4dafbf})[_0x1a8e('0x2f')](function(){if(!_[_0x1a8e('0x8d')](_0x357f39)){return _0x170457['removeAgents'](_0x357f39,{'transaction':_0x4dafbf})[_0x1a8e('0x2f')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x20330b[_0x1a8e('0x48')]['id'],'UserId':_0x357f39},'transaction':_0x4dafbf});});}})[_0x1a8e('0x2f')](function(){_0x357f39[_0x1a8e('0x6e')](function(_0x28df57){socket[_0x1a8e('0x8e')]('userVoiceQueue:remove',{'UserId':_0x28df57,'VoiceQueueId':_0x170457['id']});});});});});});})['then'](respondWithStatusCode(_0x1bd972,null))[_0x1a8e('0x46')](handleError(_0x1bd972,null));};exports[_0x1a8e('0x8f')]=function(_0x284af4,_0x491a96,_0xd17dab){var _0x5ae9bc,_0x5ebb78;return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x284af4['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x491a96,null))[_0x1a8e('0x2f')](function(_0x27145c){if(_0x27145c){_0x5ebb78=_0x27145c;return _0x27145c['addAgents'](_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x284af4[_0x1a8e('0x4d')],['ids','id'])||{})[_0x1a8e('0x90')](function(_0x2ca61b){for(var _0x11f010=0x0;_0x11f010<_0x284af4[_0x1a8e('0x4d')]['ids']['length'];_0x11f010+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')][_0x11f010]),'VoiceQueueId':Number(_0x284af4[_0x1a8e('0x48')]['id'])});}return _0x2ca61b;});}})[_0x1a8e('0x2f')](function(_0x232e4d){_0x5ae9bc=_0x232e4d||[];if(_0x5ebb78){return db[_0x1a8e('0x7c')][_0x1a8e('0x5f')]({'where':{'id':_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')]},'attributes':['id',_0x1a8e('0x31'),_0x1a8e('0x6a'),_0x1a8e('0x6b'),_0x1a8e('0x6c')],'raw':!![]});}})[_0x1a8e('0x2f')](function(_0x885f93){if(!_['isEmpty'](_0x885f93)){var _0x55adb8=[];for(var _0x272cf7=0x0;_0x272cf7<_0x885f93[_0x1a8e('0x3a')];_0x272cf7++){if(_0x885f93[_0x272cf7]['online']){_0x55adb8[_0x1a8e('0x85')](db[_0x1a8e('0x77')][_0x1a8e('0x74')]({'membername':_0x885f93[_0x272cf7][_0x1a8e('0x31')],'UserId':_0x885f93[_0x272cf7]['id'],'queue_name':_0x5ebb78[_0x1a8e('0x31')],'VoiceQueueId':_0x5ebb78['id'],'interface':_[_0x1a8e('0x78')](_0x885f93[_0x272cf7][_0x1a8e('0x6c')])?util[_0x1a8e('0x79')](_0x1a8e('0x91'),_0x885f93[_0x272cf7]['name']):_0x885f93[_0x272cf7][_0x1a8e('0x6c')],'paused':_0x885f93[_0x272cf7]['voicePause']||![],'penalty':_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x6f')]||0x0}));}}return BPromise['all'](_0x55adb8);}})['then'](function(){return _0x5ae9bc;})[_0x1a8e('0x2f')](respondWithResult(_0x491a96,null))[_0x1a8e('0x46')](handleError(_0x491a96,null));};exports[_0x1a8e('0x92')]=function(_0x2e6a77,_0x4b14dd,_0x5cbc75){return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2e6a77[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b14dd,null))['then'](function(_0x1d4e98){if(_0x1d4e98){return _0x1d4e98['removeAgents'](_0x2e6a77[_0x1a8e('0x38')][_0x1a8e('0x7b')])[_0x1a8e('0x2f')](function(){if(_[_0x1a8e('0x93')](_0x2e6a77['query'][_0x1a8e('0x7b')])){for(var _0x16de5f=0x0;_0x16de5f<_0x2e6a77['query'][_0x1a8e('0x7b')]['length'];_0x16de5f+=0x1){socket[_0x1a8e('0x8e')](_0x1a8e('0x94'),{'UserId':Number(_0x2e6a77[_0x1a8e('0x38')]['ids'][_0x16de5f]),'VoiceQueueId':Number(_0x2e6a77[_0x1a8e('0x48')]['id'])});}}else{socket[_0x1a8e('0x8e')](_0x1a8e('0x94'),{'UserId':Number(_0x2e6a77[_0x1a8e('0x38')]['ids']),'VoiceQueueId':Number(_0x2e6a77[_0x1a8e('0x48')]['id'])});}});}})[_0x1a8e('0x2f')](function(_0x1ac4ca){return db[_0x1a8e('0x77')]['destroy']({'where':{'VoiceQueueId':_0x2e6a77[_0x1a8e('0x48')]['id'],'UserId':_0x2e6a77[_0x1a8e('0x38')][_0x1a8e('0x7b')]}})['then'](function(){return _0x1ac4ca;});})[_0x1a8e('0x2f')](respondWithStatusCode(_0x4b14dd,null))[_0x1a8e('0x46')](handleError(_0x4b14dd,null));};exports[_0x1a8e('0x95')]=function(_0x294a5c,_0x77d7b,_0x3820ad){var _0x434e97={};var _0x171fed={};var _0x145176;var _0x25a898;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x294a5c[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x77d7b,null))[_0x1a8e('0x2f')](function(_0x30382d){if(_0x30382d){_0x145176=_0x30382d;_0x171fed[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x7c')][_0x1a8e('0x4a')]);_0x171fed['query']=_[_0x1a8e('0x49')](_0x294a5c[_0x1a8e('0x38')]);_0x171fed[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x171fed[_0x1a8e('0x37')],_0x171fed[_0x1a8e('0x38')]);_0x434e97['attributes']=_['intersection'](_0x171fed[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x434e97[_0x1a8e('0x3b')]=_0x434e97[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x434e97[_0x1a8e('0x3b')]:_0x171fed[_0x1a8e('0x37')];_0x434e97[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x434e97[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_['pick'](_0x294a5c[_0x1a8e('0x38')],_0x171fed['filters']));if(_0x294a5c['query'][_0x1a8e('0x27')]){_0x434e97[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x434e97[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x434e97[_0x1a8e('0x3b')],function(_0xd85948){var _0x2719ad={};_0x2719ad[_0xd85948]={'$like':'%'+_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x2719ad;})});}_0x434e97=_[_0x1a8e('0x42')]({},_0x434e97,_0x294a5c[_0x1a8e('0x43')]);return _0x145176[_0x1a8e('0x95')](_0x434e97);}})[_0x1a8e('0x2f')](function(_0x488f37){if(_0x488f37){_0x25a898=_0x488f37[_0x1a8e('0x3a')];if(!_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x434e97[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x294a5c[_0x1a8e('0x38')]['limit']);_0x434e97['offset']=qs['offset'](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x145176[_0x1a8e('0x95')](_0x434e97);}})[_0x1a8e('0x2f')](function(_0x4efb64){if(_0x4efb64){return _0x4efb64?{'count':_0x25a898,'rows':_0x4efb64}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0x77d7b,null))[_0x1a8e('0x46')](handleError(_0x77d7b,null));};exports[_0x1a8e('0x96')]=function(_0x2dab67,_0x227818,_0x4c4d6e){var _0x3bf7f4={};var _0x51ad4b={};var _0x25c613;var _0x400800;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x2dab67[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x227818,null))[_0x1a8e('0x2f')](function(_0x5dda0d){if(_0x5dda0d){_0x25c613=_0x5dda0d;_0x51ad4b[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db['UserVoiceQueueRt']['rawAttributes']);_0x51ad4b[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x2dab67[_0x1a8e('0x38')]);_0x51ad4b[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x51ad4b[_0x1a8e('0x37')],_0x51ad4b[_0x1a8e('0x38')]);_0x3bf7f4[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x51ad4b[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x3bf7f4[_0x1a8e('0x3b')]=_0x3bf7f4[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x3bf7f4['attributes']:_0x51ad4b['model'];_0x3bf7f4[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x3bf7f4['where']=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x2dab67[_0x1a8e('0x38')],_0x51ad4b[_0x1a8e('0x40')]));if(_0x2dab67['query'][_0x1a8e('0x27')]){_0x3bf7f4[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x3bf7f4[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x3bf7f4['attributes'],function(_0x5d5337){var _0xc31874={};_0xc31874[_0x5d5337]={'$like':'%'+_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0xc31874;})});}_0x3bf7f4=_[_0x1a8e('0x42')]({},_0x3bf7f4,_0x2dab67['options']);return _0x25c613[_0x1a8e('0x96')](_0x3bf7f4);}})[_0x1a8e('0x2f')](function(_0x58d9d8){if(_0x58d9d8){_0x400800=_0x58d9d8['length'];if(!_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x3bf7f4[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x2dab67[_0x1a8e('0x38')]['limit']);_0x3bf7f4['offset']=qs['offset'](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x25c613[_0x1a8e('0x96')](_0x3bf7f4);}})['then'](function(_0x24e5a7){return _0x24e5a7?{'count':_0x400800,'rows':_0x24e5a7}:null;})[_0x1a8e('0x2f')](respondWithResult(_0x227818,null))[_0x1a8e('0x46')](handleError(_0x227818,null));};exports['getLists']=function(_0x54eda1,_0x5eb853,_0x36afae){var _0x4c3bdc={};var _0x1fe141={};var _0x213383;var _0x4fdc84;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x54eda1[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x5eb853,null))['then'](function(_0x25ec54){if(_0x25ec54){_0x213383=_0x25ec54;_0x1fe141['model']=_[_0x1a8e('0x49')](db['CmList']['rawAttributes']);_0x1fe141[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x54eda1['query']);_0x1fe141[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x1fe141['model'],_0x1fe141[_0x1a8e('0x38')]);_0x4c3bdc[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x1fe141[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x4c3bdc[_0x1a8e('0x3b')]=_0x4c3bdc['attributes'][_0x1a8e('0x3a')]?_0x4c3bdc[_0x1a8e('0x3b')]:_0x1fe141[_0x1a8e('0x37')];_0x4c3bdc[_0x1a8e('0x3e')]=qs['sort'](_0x54eda1[_0x1a8e('0x38')]['sort']);_0x4c3bdc[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x54eda1[_0x1a8e('0x38')],_0x1fe141['filters']));if(_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x4c3bdc[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x4c3bdc[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x4c3bdc[_0x1a8e('0x3b')],function(_0x2699ec){var _0x5c3159={};_0x5c3159[_0x2699ec]={'$like':'%'+_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x5c3159;})});}_0x4c3bdc=_['merge']({},_0x4c3bdc,_0x54eda1[_0x1a8e('0x43')]);return _0x213383[_0x1a8e('0x97')](_0x4c3bdc);}})[_0x1a8e('0x2f')](function(_0x407d1e){if(_0x407d1e){_0x4fdc84=_0x407d1e[_0x1a8e('0x3a')];if(!_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x3c')]('nolimit')){_0x4c3bdc['limit']=qs[_0x1a8e('0x1d')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x4c3bdc[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x213383[_0x1a8e('0x97')](_0x4c3bdc);}})['then'](function(_0x812f71){if(_0x812f71){return _0x812f71?{'count':_0x4fdc84,'rows':_0x812f71}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0x5eb853,null))['catch'](handleError(_0x5eb853,null));};exports['addLists']=function(_0x2fd45a,_0x5bf72c,_0x24b274){var _0x2f1e49,_0x44b060;return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2fd45a[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bf72c,null))[_0x1a8e('0x2f')](function(_0x47bd86){if(_0x47bd86){_0x44b060=_0x47bd86;return _0x47bd86['addLists'](_0x2fd45a[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x2fd45a['body'],[_0x1a8e('0x7b'),'id'])||{});}return null;})[_0x1a8e('0x90')](function(_0x3ec739){var _0x44ebb7;_0x2f1e49=_0x3ec739||[];var _0x27d9e0=[];if(_0x3ec739){for(var _0xe46a30=0x0;_0xe46a30<_0x3ec739[_0x1a8e('0x3a')];_0xe46a30+=0x1){var _0x4b2a7b=_0x3ec739[_0xe46a30]['get']({'plain':!![]});_0x44b060[_0x1a8e('0x98')]=_0x2fd45a['body'][_0x1a8e('0x98')]?_0x2fd45a[_0x1a8e('0x4d')][_0x1a8e('0x98')]:_0x44b060['dialCheckDuplicateType'];switch(_0x44b060[_0x1a8e('0x98')]){case _0x1a8e('0x99'):_0x44ebb7=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')]('cm_hopper')[_0x1a8e('0x9c')]([_0x1a8e('0x9d'),'scheduledAt','ContactId',_0x1a8e('0x9e'),'VoiceQueueId',_0x1a8e('0x55'),_0x1a8e('0x56')],squel['select']()[_0x1a8e('0x7d')]('phone','phone')[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x9f'))[_0x1a8e('0x7d')]('id',_0x1a8e('0xa0'))['field'](_0x4b2a7b[_0x1a8e('0xa1')][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),_0x1a8e('0x63'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),'createdAt')['field'](_0x1a8e('0xa2'),_0x1a8e('0x56'))[_0x1a8e('0x7f')](_0x1a8e('0xa3'))[_0x1a8e('0x3f')](_0x1a8e('0xa4'))[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b[_0x1a8e('0xa1')][_0x1a8e('0x86')]())[_0x1a8e('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0xa7'))[_0x1a8e('0x7f')]('cm_hopper_final')[_0x1a8e('0x3f')]('VoiceQueueId\x20=\x20?',_0x2fd45a[_0x1a8e('0x48')]['id']['toString']()))[_0x1a8e('0x3f')](_0x1a8e('0xa8'),squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0xa9'))[_0x1a8e('0x7f')](_0x1a8e('0xaa'))[_0x1a8e('0x3f')](_0x1a8e('0x83'),_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')]())))[_0x1a8e('0x86')]();break;case _0x1a8e('0xab'):_0x44ebb7=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')]('cm_hopper')[_0x1a8e('0x9c')]([_0x1a8e('0x9d'),_0x1a8e('0x9f'),'ContactId',_0x1a8e('0x9e'),_0x1a8e('0x63'),_0x1a8e('0x55'),'updatedAt'],squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0x9d'),_0x1a8e('0x9d'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),'scheduledAt')[_0x1a8e('0x7d')]('id','ContactId')['field'](_0x4b2a7b['CmListId'][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id']['toString'](),_0x1a8e('0x63'))[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x55'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x56'))['from'](_0x1a8e('0xa3'))['where'](_0x1a8e('0xa4'))[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b['CmListId'][_0x1a8e('0x86')]())[_0x1a8e('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa8'),squel['select']()[_0x1a8e('0x7d')](_0x1a8e('0xa9'))['from'](_0x1a8e('0xaa'))[_0x1a8e('0x3f')]('VoiceQueueId\x20=\x20?',_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')]())))[_0x1a8e('0x86')]();break;default:_0x44ebb7=squel['insert']()[_0x1a8e('0x9b')](_0x1a8e('0xaa'))['fromQuery']([_0x1a8e('0x9d'),'scheduledAt',_0x1a8e('0xa0'),'ListId',_0x1a8e('0x63'),_0x1a8e('0x55'),_0x1a8e('0x56')],squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0x9d'),_0x1a8e('0x9d'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x9f'))[_0x1a8e('0x7d')]('id',_0x1a8e('0xa0'))[_0x1a8e('0x7d')](_0x4b2a7b[_0x1a8e('0xa1')]['toString'](),'ListId')[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),'VoiceQueueId')[_0x1a8e('0x7d')]('NOW()','createdAt')['field'](_0x1a8e('0xa2'),'updatedAt')[_0x1a8e('0x7f')](_0x1a8e('0xa3'))[_0x1a8e('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b[_0x1a8e('0xa1')]['toString']())['where'](_0x1a8e('0xac')))['toString']();}_0x27d9e0[_0x1a8e('0x85')](db[_0x1a8e('0x70')]['query'](_0x44ebb7));}return BPromise['all'](_0x27d9e0);}})[_0x1a8e('0x2f')](function(){return _0x2f1e49;})[_0x1a8e('0x2f')](respondWithResult(_0x5bf72c,null))[_0x1a8e('0x46')](handleError(_0x5bf72c,null));};exports[_0x1a8e('0xad')]=function(_0xdce3d2,_0x5747c3,_0x2ad4e8){return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0xdce3d2[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x5747c3,null))['then'](function(_0x2f7f23){if(_0x2f7f23){return _0x2f7f23[_0x1a8e('0xad')](_0xdce3d2[_0x1a8e('0x38')][_0x1a8e('0x7b')]);}})[_0x1a8e('0x2f')](function(_0x44c293){if(_0x44c293){return db[_0x1a8e('0x5c')][_0x1a8e('0x59')]({'where':{'ListId':_0xdce3d2['query'][_0x1a8e('0x7b')],'VoiceQueueId':_0xdce3d2[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](function(){return _0x44c293;});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x5747c3,null))[_0x1a8e('0x46')](handleError(_0x5747c3,null));};exports[_0x1a8e('0xae')]=function(_0x4342e9,_0xd988d4,_0x45dea8){var _0x20881b={};var _0x5b5639={};var _0x3464cb;var _0x1ff6a1;return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x4342e9[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0xd988d4,null))[_0x1a8e('0x2f')](function(_0x7d350c){if(_0x7d350c){_0x3464cb=_0x7d350c;_0x5b5639[_0x1a8e('0x37')]=_['keys'](db[_0x1a8e('0xaf')][_0x1a8e('0x4a')]);_0x5b5639[_0x1a8e('0x38')]=_['keys'](_0x4342e9['query']);_0x5b5639[_0x1a8e('0x40')]=_['intersection'](_0x5b5639[_0x1a8e('0x37')],_0x5b5639['query']);_0x20881b[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x5b5639['model'],qs[_0x1a8e('0x4b')](_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x20881b['attributes']=_0x20881b[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x20881b[_0x1a8e('0x3b')]:_0x5b5639['model'];_0x20881b[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x4342e9[_0x1a8e('0x38')]['sort']);_0x20881b[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x4342e9['query'],_0x5b5639[_0x1a8e('0x40')]));if(_0x4342e9['query'][_0x1a8e('0x27')]){_0x20881b[_0x1a8e('0x3f')]=_['merge'](_0x20881b[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x20881b[_0x1a8e('0x3b')],function(_0x13dd90){var _0x4c938d={};_0x4c938d[_0x13dd90]={'$like':'%'+_0x4342e9['query'][_0x1a8e('0x27')]+'%'};return _0x4c938d;})});}_0x20881b=_['merge']({},_0x20881b,_0x4342e9[_0x1a8e('0x43')]);return _0x3464cb['getBlackLists'](_0x20881b);}})[_0x1a8e('0x2f')](function(_0x513364){if(_0x513364){_0x1ff6a1=_0x513364[_0x1a8e('0x3a')];if(!_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x20881b[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x4342e9['query'][_0x1a8e('0x1d')]);_0x20881b[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x3464cb['getBlackLists'](_0x20881b);}})[_0x1a8e('0x2f')](function(_0x3ce731){if(_0x3ce731){return _0x3ce731?{'count':_0x1ff6a1,'rows':_0x3ce731}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0xd988d4,null))['catch'](handleError(_0xd988d4,null));};exports['addBlackLists']=function(_0x49c748,_0x2ad4b5,_0xb23e9a){var _0x3f4489,_0x4d14f3;return db[_0x1a8e('0x34')]['find']({'where':{'id':_0x49c748[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2ad4b5,null))['then'](function(_0x35816d){if(_0x35816d){_0x4d14f3=_0x35816d;return _0x35816d[_0x1a8e('0xb0')](_0x49c748[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x49c748[_0x1a8e('0x4d')],[_0x1a8e('0x7b'),'id'])||{});}return null;})[_0x1a8e('0x90')](function(_0x31a6a1){var _0x222d5b;_0x3f4489=_0x31a6a1||[];var _0x143915=[];if(_0x31a6a1){for(var _0x3545d5=0x0;_0x3545d5<_0x31a6a1[_0x1a8e('0x3a')];_0x3545d5+=0x1){var _0x2eedd8=_0x31a6a1[_0x3545d5]['get']({'plain':!![]});_0x222d5b=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')](_0x1a8e('0xb1'))['fromQuery']([_0x1a8e('0x9d'),_0x1a8e('0xa0'),'ListId',_0x1a8e('0x63'),_0x1a8e('0x55'),_0x1a8e('0x56')],squel[_0x1a8e('0xa6')]()['field'](_0x1a8e('0x9d'),'phone')[_0x1a8e('0x7d')]('id','ContactId')[_0x1a8e('0x7d')](_0x2eedd8[_0x1a8e('0xa1')][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x49c748[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),_0x1a8e('0x63'))[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x55'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x56'))['from']('cm_contacts')[_0x1a8e('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x2eedd8[_0x1a8e('0xa1')][_0x1a8e('0x86')]())[_0x1a8e('0x3f')](_0x1a8e('0xac')))['toString']();_0x143915[_0x1a8e('0x85')](db[_0x1a8e('0x70')][_0x1a8e('0x38')](_0x222d5b));}return BPromise[_0x1a8e('0x8a')](_0x143915);}})[_0x1a8e('0x2f')](function(){return _0x3f4489;})[_0x1a8e('0x2f')](respondWithResult(_0x2ad4b5,null))[_0x1a8e('0x46')](handleError(_0x2ad4b5,null));};exports[_0x1a8e('0xb2')]=function(_0x238623,_0x48f57e,_0x338545){return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x238623['params']['id']}})['then'](handleEntityNotFound(_0x48f57e,null))[_0x1a8e('0x2f')](function(_0x582023){if(_0x582023){return _0x582023[_0x1a8e('0xb2')](_0x238623['query'][_0x1a8e('0x7b')]);}})[_0x1a8e('0x2f')](function(_0x38593f){if(_0x38593f){return db['CmHopperBlack'][_0x1a8e('0x59')]({'where':{'ListId':_0x238623[_0x1a8e('0x38')][_0x1a8e('0x7b')],'VoiceQueueId':_0x238623[_0x1a8e('0x48')]['id']}})['then'](function(){return _0x38593f;});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x48f57e,null))['catch'](handleError(_0x48f57e,null));}; \ No newline at end of file +var _0x4f79=['UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','emit','userVoiceQueue:save','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','TeamId','all','union','ids','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','SIP/%s','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','fromQuery','phone','ContactId','ListId','field','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','cm_hopper','COALESCE(phone,\x27\x27)','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','count','limit','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','type','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','params','getHoppers','findOne','CmHopper','pick','getHopperHistories','CmHopperHistory','getHopperFinals','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','TeamVoiceQueue','upsert','each'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4f79,0xf0));var _0x94f7=function(_0x2db143,_0x1c7fa2){_0x2db143=_0x2db143-0x0;var _0x3fdb56=_0x4f79[_0x2db143];return _0x3fdb56;};'use strict';var emlformat=require(_0x94f7('0x0'));var rimraf=require(_0x94f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94f7('0x2'));var rp=require(_0x94f7('0x3'));var moment=require(_0x94f7('0x4'));var BPromise=require(_0x94f7('0x5'));var Mustache=require(_0x94f7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x94f7('0x7'));var csv=require(_0x94f7('0x8'));var ejs=require(_0x94f7('0x9'));var fs=require('fs');var fs_extra=require(_0x94f7('0xa'));var _=require('lodash');var squel=require(_0x94f7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x94f7('0xc'));var toCsv=require(_0x94f7('0x8'));var querystring=require(_0x94f7('0xd'));var Papa=require(_0x94f7('0xe'));var Redis=require(_0x94f7('0xf'));var authService=require(_0x94f7('0x10'));var qs=require(_0x94f7('0x11'));var as=require(_0x94f7('0x12'));var hardwareService=require(_0x94f7('0x13'));var logger=require(_0x94f7('0x14'))(_0x94f7('0x15'));var utils=require('../../config/utils');var config=require(_0x94f7('0x16'));var licenseUtil=require(_0x94f7('0x17'));var db=require(_0x94f7('0x18'))['db'];config[_0x94f7('0x19')]=_['defaults'](config[_0x94f7('0x19')],{'host':_0x94f7('0x1a'),'port':0x18eb});var socket=require(_0x94f7('0x1b'))(new Redis(config[_0x94f7('0x19')]));require(_0x94f7('0x1c'))[_0x94f7('0x1d')](socket);function respondWithStatusCode(_0x3ba549,_0x46afc7){_0x46afc7=_0x46afc7||0xcc;return function(_0x9efc28){if(_0x9efc28){return _0x3ba549[_0x94f7('0x1e')](_0x46afc7);}return _0x3ba549[_0x94f7('0x1f')](_0x46afc7)[_0x94f7('0x20')]();};}function respondWithResult(_0x52904e,_0x283368){_0x283368=_0x283368||0xc8;return function(_0x5ae328){if(_0x5ae328){return _0x52904e['status'](_0x283368)[_0x94f7('0x21')](_0x5ae328);}};}function respondWithFilteredResult(_0x22bfb0,_0x54e592){return function(_0x1a7bf5){if(_0x1a7bf5){var _0x16e44b=typeof _0x54e592[_0x94f7('0x22')]==='undefined'&&typeof _0x54e592['limit']==='undefined';var _0x37d02b=_0x1a7bf5['count'];var _0x39dfb8=_0x16e44b?0x0:_0x54e592[_0x94f7('0x22')];var _0x53d063=_0x16e44b?_0x1a7bf5[_0x94f7('0x23')]:_0x54e592[_0x94f7('0x22')]+_0x54e592[_0x94f7('0x24')];var _0x5468ae;if(_0x53d063>=_0x37d02b){_0x53d063=_0x37d02b;_0x5468ae=0xc8;}else{_0x5468ae=0xce;}_0x22bfb0[_0x94f7('0x1f')](_0x5468ae);return _0x22bfb0['set'](_0x94f7('0x25'),_0x39dfb8+'-'+_0x53d063+'/'+_0x37d02b)['json'](_0x1a7bf5);}return null;};}function patchUpdates(_0x31099f){return function(_0x5e12eb){try{jsonpatch['apply'](_0x5e12eb,_0x31099f,!![]);}catch(_0x4b125a){return BPromise[_0x94f7('0x26')](_0x4b125a);}return _0x5e12eb[_0x94f7('0x27')]();};}function saveUpdates(_0x215a05,_0x13552e){return function(_0x529e00){if(_0x529e00){return _0x529e00[_0x94f7('0x28')](_0x215a05)[_0x94f7('0x29')](function(_0x5dad13){return _0x5dad13;});}return null;};}function removeEntity(_0x2bb37a,_0x5be43a){return function(_0x50999e){if(_0x50999e){return _0x50999e[_0x94f7('0x2a')]()[_0x94f7('0x29')](function(){var _0xa98f3d=_0x50999e[_0x94f7('0x2b')]({'plain':!![]});var _0x54539b=[{'name':_0x94f7('0x2c'),'value':_0x94f7('0x2d'),'ignore':![]},{'name':_0x94f7('0x2e'),'value':_0x94f7('0x2f'),'ignore':![]}];var _0x7558fc=_(_0x54539b)['filter'](_0x94f7('0x30'))[_0x94f7('0x31')](_0x94f7('0x32'))[_0x94f7('0x32')]();if(_['includes'](_0x7558fc,_0xa98f3d[_0x94f7('0x33')])){return;}var _0x215ede=_['find'](_0x54539b,[_0x94f7('0x32'),_0xa98f3d[_0x94f7('0x33')]])[_0x94f7('0x34')];return db[_0x94f7('0x35')][_0x94f7('0x2a')]({'where':{'type':_0x215ede,'resourceId':_0xa98f3d['id']}})['then'](function(){return _0x50999e;});})[_0x94f7('0x29')](function(){_0x2bb37a['status'](0xcc)[_0x94f7('0x20')]();});}};}function handleEntityNotFound(_0x1d5c54,_0x29b280){return function(_0xe6048d){if(!_0xe6048d){_0x1d5c54['sendStatus'](0x194);}return _0xe6048d;};}function handleError(_0x5576da,_0x31479f){_0x31479f=_0x31479f||0x1f4;return function(_0x157ea0){logger[_0x94f7('0x36')](_0x157ea0[_0x94f7('0x37')]);if(_0x157ea0[_0x94f7('0x34')]){delete _0x157ea0[_0x94f7('0x34')];}_0x5576da[_0x94f7('0x1f')](_0x31479f)['send'](_0x157ea0);};}exports[_0x94f7('0x38')]=function(_0x2d7279,_0x458b19){var _0x1ab53e={},_0x28e78a={},_0x14acc6={'count':0x0,'rows':[]};var _0xdad6c1=_[_0x94f7('0x31')](db[_0x94f7('0x39')][_0x94f7('0x3a')],function(_0x4837b8){return{'name':_0x4837b8[_0x94f7('0x3b')],'type':_0x4837b8[_0x94f7('0x33')]['key']};});_0x28e78a[_0x94f7('0x3c')]=_[_0x94f7('0x31')](_0xdad6c1,'name');_0x28e78a[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x2d7279[_0x94f7('0x3d')]);_0x28e78a[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x28e78a[_0x94f7('0x3c')],_0x28e78a[_0x94f7('0x3d')]);_0x1ab53e[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x28e78a[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0x2d7279[_0x94f7('0x3d')]['fields']));_0x1ab53e[_0x94f7('0x41')]=_0x1ab53e['attributes']['length']?_0x1ab53e[_0x94f7('0x41')]:_0x28e78a[_0x94f7('0x3c')];if(!_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x43')](_0x94f7('0x44'))){_0x1ab53e[_0x94f7('0x24')]=qs[_0x94f7('0x24')](_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x1ab53e['offset']=qs['offset'](_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x22')]);}_0x1ab53e[_0x94f7('0x45')]=qs[_0x94f7('0x46')](_0x2d7279['query'][_0x94f7('0x46')]);_0x1ab53e[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_['pick'](_0x2d7279[_0x94f7('0x3d')],_0x28e78a[_0x94f7('0x3f')]),_0xdad6c1);if(_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x1ab53e[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x1ab53e['where'],{'$or':_['map'](_0xdad6c1,function(_0x2a2453){if(_0x2a2453[_0x94f7('0x33')]!=='VIRTUAL'){var _0x22c45c={};_0x22c45c[_0x2a2453['name']]={'$like':'%'+_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x22c45c;}})});}_0x1ab53e=_[_0x94f7('0x49')]({},_0x1ab53e,_0x2d7279[_0x94f7('0x4a')]);var _0xbeb943={'where':_0x1ab53e[_0x94f7('0x47')]};return db['VoiceQueue'][_0x94f7('0x23')](_0xbeb943)[_0x94f7('0x29')](function(_0x34c935){_0x14acc6['count']=_0x34c935;if(_0x2d7279[_0x94f7('0x3d')][_0x94f7('0x4b')]){_0x1ab53e[_0x94f7('0x4c')]=[{'all':!![]}];}return db['VoiceQueue'][_0x94f7('0x4d')](_0x1ab53e);})['then'](function(_0x17fe54){_0x14acc6[_0x94f7('0x4e')]=_0x17fe54;return _0x14acc6;})[_0x94f7('0x29')](respondWithFilteredResult(_0x458b19,_0x1ab53e))[_0x94f7('0x4f')](handleError(_0x458b19,null));};exports[_0x94f7('0x50')]=function(_0x205d3c,_0x32076b){var _0x412a1e={'raw':![],'where':{'id':_0x205d3c['params']['id']}},_0x1536fe={};_0x1536fe[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db[_0x94f7('0x39')][_0x94f7('0x3a')]);_0x1536fe[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x205d3c[_0x94f7('0x3d')]);_0x1536fe['filters']=_[_0x94f7('0x40')](_0x1536fe[_0x94f7('0x3c')],_0x1536fe['query']);_0x412a1e[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x1536fe['model'],qs['fields'](_0x205d3c[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x412a1e[_0x94f7('0x41')]=_0x412a1e[_0x94f7('0x41')][_0x94f7('0x51')]?_0x412a1e[_0x94f7('0x41')]:_0x1536fe[_0x94f7('0x3c')];if(_0x205d3c['query'][_0x94f7('0x4b')]){_0x412a1e['include']=[{'all':!![]}];}_0x412a1e=_[_0x94f7('0x49')]({},_0x412a1e,_0x205d3c[_0x94f7('0x4a')]);return db[_0x94f7('0x39')][_0x94f7('0x52')](_0x412a1e)['then'](handleEntityNotFound(_0x32076b,null))[_0x94f7('0x29')](respondWithResult(_0x32076b,null))['catch'](handleError(_0x32076b,null));};exports[_0x94f7('0x53')]=function(_0x1c4c5f,_0x1518f5){return db[_0x94f7('0x39')][_0x94f7('0x53')](_0x1c4c5f[_0x94f7('0x54')],{})['then'](function(_0x2808c9){var _0x2e052c=_0x1c4c5f['user']['get']({'plain':!![]});if(!_0x2e052c)throw new Error(_0x94f7('0x55'));if(_0x2e052c['role']===_0x94f7('0x56')){var _0x5a33e7=_0x2808c9['get']({'plain':!![]});var _0x305899=[{'name':_0x94f7('0x2c'),'value':_0x94f7('0x2d')},{'name':_0x94f7('0x2e'),'value':_0x94f7('0x2f')}];var _0x4149b7=_['find'](_0x305899,[_0x94f7('0x32'),_0x5a33e7['type']])[_0x94f7('0x34')];return db[_0x94f7('0x57')][_0x94f7('0x52')]({'where':{'name':_0x4149b7,'userProfileId':_0x2e052c[_0x94f7('0x58')]},'raw':!![]})[_0x94f7('0x29')](function(_0x730a49){if(_0x730a49&&_0x730a49[_0x94f7('0x59')]===0x0){return db[_0x94f7('0x35')][_0x94f7('0x53')]({'name':_0x5a33e7[_0x94f7('0x34')],'resourceId':_0x5a33e7['id'],'type':_0x730a49[_0x94f7('0x34')],'sectionId':_0x730a49['id']},{})[_0x94f7('0x29')](function(){return _0x2808c9;});}else{return _0x2808c9;}})['catch'](function(_0x3a324f){logger[_0x94f7('0x36')](_0x94f7('0x5a'),_0x3a324f);throw _0x3a324f;});}return _0x2808c9;})[_0x94f7('0x29')](respondWithResult(_0x1518f5,0xc9))[_0x94f7('0x4f')](handleError(_0x1518f5,null));};exports['clone']=function(_0x4ce44e,_0x2b1ccf){var _0x27fecf={'where':{'id':_0x4ce44e['params']['id']}},_0x11cbfa={};_0x11cbfa['model']=_[_0x94f7('0x3e')](db[_0x94f7('0x39')][_0x94f7('0x3a')]);_0x27fecf[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x11cbfa[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0x4ce44e[_0x94f7('0x3d')]['fields']));_0x27fecf[_0x94f7('0x41')]=_0x27fecf[_0x94f7('0x41')][_0x94f7('0x51')]?_0x27fecf[_0x94f7('0x41')]:_0x11cbfa[_0x94f7('0x3c')];if(_0x4ce44e['query']['includeAll']){_0x27fecf[_0x94f7('0x4c')]=[{'all':!![]}];}_0x27fecf=_['merge']({},_0x27fecf,_0x4ce44e[_0x94f7('0x4a')]);return db['VoiceQueue']['find'](_0x27fecf)['then'](handleEntityNotFound(_0x2b1ccf,null))['then'](function(_0x48f7c3){if(_0x48f7c3){var _0x1d56df=_0x48f7c3[_0x94f7('0x2b')]({'plain':!![]});_0x1d56df=qs[_0x94f7('0x5b')](_0x1d56df,['id',_0x94f7('0x5c'),_0x94f7('0x5d')]);_0x4ce44e[_0x94f7('0x54')]=_[_0x94f7('0x5b')](_0x4ce44e[_0x94f7('0x54')],['id',_0x94f7('0x5c'),_0x94f7('0x5d')]);return db[_0x94f7('0x39')][_0x94f7('0x53')](_[_0x94f7('0x49')](_0x1d56df,_0x4ce44e['body']),{'include':_0x4ce44e[_0x94f7('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x94f7('0x29')](function(_0x189e0a){var _0x3b77c8=_0x4ce44e[_0x94f7('0x56')][_0x94f7('0x2b')]({'plain':!![]});if(!_0x3b77c8)throw new Error(_0x94f7('0x55'));if(_0x3b77c8[_0x94f7('0x5e')]===_0x94f7('0x56')){var _0x1130fb=_0x189e0a[_0x94f7('0x2b')]({'plain':!![]});var _0x14c107=[{'name':_0x94f7('0x2c'),'value':_0x94f7('0x2d')},{'name':'QueueCampaigns','value':'outbound'}];var _0x1fcb3f=_['find'](_0x14c107,['value',_0x1130fb['type']])[_0x94f7('0x34')];return db[_0x94f7('0x57')][_0x94f7('0x52')]({'where':{'name':_0x1fcb3f,'userProfileId':_0x3b77c8[_0x94f7('0x58')]},'raw':!![]})[_0x94f7('0x29')](function(_0x56fc21){if(_0x56fc21&&_0x56fc21['autoAssociation']===0x0){return db['UserProfileResource'][_0x94f7('0x53')]({'name':_0x1130fb[_0x94f7('0x34')],'resourceId':_0x1130fb['id'],'type':_0x56fc21['name'],'sectionId':_0x56fc21['id']},{})[_0x94f7('0x29')](function(){return _0x189e0a;});}else{return _0x189e0a;}})[_0x94f7('0x4f')](function(_0x9056c7){logger[_0x94f7('0x36')](_0x94f7('0x5a'),_0x9056c7);throw _0x9056c7;});}return _0x189e0a;});}})[_0x94f7('0x29')](respondWithResult(_0x2b1ccf,0xc9))[_0x94f7('0x4f')](handleError(_0x2b1ccf,null));};exports[_0x94f7('0x28')]=function(_0x1e87d7,_0x46339e){if(_0x1e87d7[_0x94f7('0x54')]['id']){delete _0x1e87d7['body']['id'];}return db[_0x94f7('0x39')][_0x94f7('0x52')]({'where':{'id':_0x1e87d7['params']['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x46339e,null))[_0x94f7('0x29')](saveUpdates(_0x1e87d7[_0x94f7('0x54')],null))['then'](respondWithResult(_0x46339e,null))[_0x94f7('0x4f')](handleError(_0x46339e,null));};exports[_0x94f7('0x2a')]=function(_0x2c4e92,_0x398436){return db[_0x94f7('0x39')]['find']({'where':{'id':_0x2c4e92[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x398436,null))['then'](removeEntity(_0x398436,null))[_0x94f7('0x4f')](handleError(_0x398436,null));};exports[_0x94f7('0x60')]=function(_0xe3a392,_0x3a3ee9,_0x1721a6){var _0x351ede={'raw':![],'where':{}};var _0x14fb6f={};var _0x308b90={'count':0x0,'rows':[]};return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0xe3a392['params']['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x3a3ee9,null))[_0x94f7('0x29')](function(_0x531a28){if(_0x531a28){_0x14fb6f['model']=_[_0x94f7('0x3e')](db[_0x94f7('0x62')]['rawAttributes']);_0x14fb6f[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0xe3a392[_0x94f7('0x3d')]);_0x14fb6f[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x14fb6f[_0x94f7('0x3c')],_0x14fb6f['query']);_0x351ede[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x14fb6f[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0xe3a392[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x351ede['attributes']=_0x351ede[_0x94f7('0x41')]['length']?_0x351ede['attributes']:_0x14fb6f[_0x94f7('0x3c')];if(!_0xe3a392['query'][_0x94f7('0x43')](_0x94f7('0x44'))){_0x351ede[_0x94f7('0x24')]=qs[_0x94f7('0x24')](_0xe3a392[_0x94f7('0x3d')]['limit']);_0x351ede[_0x94f7('0x22')]=qs[_0x94f7('0x22')](_0xe3a392['query'][_0x94f7('0x22')]);}_0x351ede['order']=qs[_0x94f7('0x46')](_0xe3a392['query'][_0x94f7('0x46')]);_0x351ede[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0xe3a392[_0x94f7('0x3d')],_0x14fb6f[_0x94f7('0x3f')]));_0x351ede[_0x94f7('0x47')]['VoiceQueueId']=_0x531a28['id'];if(_0xe3a392[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x351ede[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x351ede[_0x94f7('0x47')],{'$or':_['map'](_0x351ede['attributes'],function(_0x184597){var _0x3faf1d={};_0x3faf1d[_0x184597]={'$like':'%'+_0xe3a392[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x3faf1d;})});}_0x351ede=_[_0x94f7('0x49')]({},_0x351ede,_0xe3a392[_0x94f7('0x4a')]);return db[_0x94f7('0x62')]['count']({'where':_0x351ede[_0x94f7('0x47')]})['then'](function(_0x4f7b6f){_0x308b90[_0x94f7('0x23')]=_0x4f7b6f;if(_0xe3a392[_0x94f7('0x3d')][_0x94f7('0x4b')]){_0x351ede[_0x94f7('0x4c')]=[{'all':!![]}];}return db[_0x94f7('0x62')][_0x94f7('0x4d')](_0x351ede);})[_0x94f7('0x29')](function(_0x334f63){_0x308b90[_0x94f7('0x4e')]=_0x334f63;return _0x308b90;});}})['then'](respondWithFilteredResult(_0x3a3ee9,_0x351ede))[_0x94f7('0x4f')](handleError(_0x3a3ee9,null));};exports[_0x94f7('0x64')]=function(_0x5624cf,_0x228a95,_0x2cdc6c){var _0x563e68={'raw':!![],'where':{}};var _0x358470={};var _0x19eb94={'count':0x0,'rows':[]};return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x5624cf[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x228a95,null))[_0x94f7('0x29')](function(_0x107ab1){if(_0x107ab1){_0x358470[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db['CmHopperHistory']['rawAttributes']);_0x358470[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x5624cf[_0x94f7('0x3d')]);_0x358470['filters']=_[_0x94f7('0x40')](_0x358470['model'],_0x358470[_0x94f7('0x3d')]);_0x563e68[_0x94f7('0x41')]=_['intersection'](_0x358470[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0x5624cf[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x563e68[_0x94f7('0x41')]=_0x563e68[_0x94f7('0x41')][_0x94f7('0x51')]?_0x563e68['attributes']:_0x358470[_0x94f7('0x3c')];if(!_0x5624cf[_0x94f7('0x3d')]['hasOwnProperty'](_0x94f7('0x44'))){_0x563e68['limit']=qs[_0x94f7('0x24')](_0x5624cf[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x563e68[_0x94f7('0x22')]=qs['offset'](_0x5624cf[_0x94f7('0x3d')][_0x94f7('0x22')]);}_0x563e68[_0x94f7('0x45')]=qs[_0x94f7('0x46')](_0x5624cf[_0x94f7('0x3d')]['sort']);_0x563e68['where']=qs[_0x94f7('0x3f')](_['pick'](_0x5624cf['query'],_0x358470[_0x94f7('0x3f')]));_0x563e68['where']['VoiceQueueId']=_0x107ab1['id'];if(_0x5624cf[_0x94f7('0x3d')]['filter']){_0x563e68[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x563e68['where'],{'$or':_[_0x94f7('0x31')](_0x563e68['attributes'],function(_0x21ee14){var _0x477b3c={};_0x477b3c[_0x21ee14]={'$like':'%'+_0x5624cf['query']['filter']+'%'};return _0x477b3c;})});}_0x563e68=_[_0x94f7('0x49')]({},_0x563e68,_0x5624cf[_0x94f7('0x4a')]);return db[_0x94f7('0x65')]['count']({'where':_0x563e68[_0x94f7('0x47')]})[_0x94f7('0x29')](function(_0x53e1a1){_0x19eb94['count']=_0x53e1a1;if(_0x5624cf[_0x94f7('0x3d')][_0x94f7('0x4b')]){_0x563e68['include']=[{'all':!![]}];}return db[_0x94f7('0x65')][_0x94f7('0x4d')](_0x563e68);})[_0x94f7('0x29')](function(_0x513dbe){_0x19eb94[_0x94f7('0x4e')]=_0x513dbe;return _0x19eb94;});}})[_0x94f7('0x29')](respondWithFilteredResult(_0x228a95,_0x563e68))[_0x94f7('0x4f')](handleError(_0x228a95,null));};exports[_0x94f7('0x66')]=function(_0x3d494e,_0x1dc77e,_0x1661ca){var _0x478105={'raw':!![],'where':{}};var _0x1b9b9a={};var _0x4ee863={'count':0x0,'rows':[]};return db[_0x94f7('0x39')]['findOne']({'where':{'id':_0x3d494e['params']['id']}})['then'](handleEntityNotFound(_0x1dc77e,null))[_0x94f7('0x29')](function(_0x8e6561){if(_0x8e6561){_0x1b9b9a[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db['CmHopperFinal'][_0x94f7('0x3a')]);_0x1b9b9a[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x3d494e[_0x94f7('0x3d')]);_0x1b9b9a[_0x94f7('0x3f')]=_['intersection'](_0x1b9b9a[_0x94f7('0x3c')],_0x1b9b9a[_0x94f7('0x3d')]);_0x478105[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x1b9b9a[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0x3d494e[_0x94f7('0x3d')]['fields']));_0x478105['attributes']=_0x478105[_0x94f7('0x41')][_0x94f7('0x51')]?_0x478105[_0x94f7('0x41')]:_0x1b9b9a[_0x94f7('0x3c')];if(!_0x3d494e[_0x94f7('0x3d')][_0x94f7('0x43')](_0x94f7('0x44'))){_0x478105[_0x94f7('0x24')]=qs[_0x94f7('0x24')](_0x3d494e[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x478105['offset']=qs[_0x94f7('0x22')](_0x3d494e[_0x94f7('0x3d')][_0x94f7('0x22')]);}_0x478105[_0x94f7('0x45')]=qs['sort'](_0x3d494e[_0x94f7('0x3d')][_0x94f7('0x46')]);_0x478105[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0x3d494e[_0x94f7('0x3d')],_0x1b9b9a[_0x94f7('0x3f')]));_0x478105[_0x94f7('0x47')][_0x94f7('0x67')]=_0x8e6561['id'];if(_0x3d494e['query'][_0x94f7('0x48')]){_0x478105[_0x94f7('0x47')]=_['merge'](_0x478105[_0x94f7('0x47')],{'$or':_['map'](_0x478105[_0x94f7('0x41')],function(_0x502a01){var _0x1898b3={};_0x1898b3[_0x502a01]={'$like':'%'+_0x3d494e['query']['filter']+'%'};return _0x1898b3;})});}_0x478105=_[_0x94f7('0x49')]({},_0x478105,_0x3d494e['options']);return db[_0x94f7('0x68')][_0x94f7('0x23')]({'where':_0x478105['where']})[_0x94f7('0x29')](function(_0x1f4b71){_0x4ee863[_0x94f7('0x23')]=_0x1f4b71;if(_0x3d494e[_0x94f7('0x3d')][_0x94f7('0x4b')]){_0x478105[_0x94f7('0x4c')]=[{'all':!![]}];}return db[_0x94f7('0x68')]['findAll'](_0x478105);})[_0x94f7('0x29')](function(_0x26ee0d){_0x4ee863[_0x94f7('0x4e')]=_0x26ee0d;return _0x4ee863;});}})[_0x94f7('0x29')](respondWithFilteredResult(_0x1dc77e,_0x478105))['catch'](handleError(_0x1dc77e,null));};exports[_0x94f7('0x69')]=function(_0x2302ab,_0x320a45,_0x1921a7){var _0x22a7e7={'raw':!![],'where':{}};var _0x16f112={};var _0x34f2af={'count':0x0,'rows':[]};return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x2302ab['params']['id']}})['then'](handleEntityNotFound(_0x320a45,null))[_0x94f7('0x29')](function(_0x3bfb25){if(_0x3bfb25){_0x16f112[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db['CmHopperBlack'][_0x94f7('0x3a')]);_0x16f112[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x2302ab[_0x94f7('0x3d')]);_0x16f112[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x16f112[_0x94f7('0x3c')],_0x16f112['query']);_0x22a7e7[_0x94f7('0x41')]=_['intersection'](_0x16f112['model'],qs[_0x94f7('0x42')](_0x2302ab[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x22a7e7[_0x94f7('0x41')]=_0x22a7e7[_0x94f7('0x41')][_0x94f7('0x51')]?_0x22a7e7[_0x94f7('0x41')]:_0x16f112['model'];if(!_0x2302ab[_0x94f7('0x3d')][_0x94f7('0x43')](_0x94f7('0x44'))){_0x22a7e7['limit']=qs[_0x94f7('0x24')](_0x2302ab['query'][_0x94f7('0x24')]);_0x22a7e7[_0x94f7('0x22')]=qs[_0x94f7('0x22')](_0x2302ab['query'][_0x94f7('0x22')]);}_0x22a7e7['order']=qs['sort'](_0x2302ab[_0x94f7('0x3d')][_0x94f7('0x46')]);_0x22a7e7[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0x2302ab[_0x94f7('0x3d')],_0x16f112[_0x94f7('0x3f')]));_0x22a7e7[_0x94f7('0x47')][_0x94f7('0x67')]=_0x3bfb25['id'];if(_0x2302ab[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x22a7e7[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x22a7e7[_0x94f7('0x47')],{'$or':_['map'](_0x22a7e7['attributes'],function(_0x1a2843){var _0x4fcd0a={};_0x4fcd0a[_0x1a2843]={'$like':'%'+_0x2302ab[_0x94f7('0x3d')]['filter']+'%'};return _0x4fcd0a;})});}_0x22a7e7=_['merge']({},_0x22a7e7,_0x2302ab['options']);return db['CmHopperBlack'][_0x94f7('0x23')]({'where':_0x22a7e7[_0x94f7('0x47')]})[_0x94f7('0x29')](function(_0x311745){_0x34f2af[_0x94f7('0x23')]=_0x311745;if(_0x2302ab[_0x94f7('0x3d')][_0x94f7('0x4b')]){_0x22a7e7[_0x94f7('0x4c')]=[{'all':!![]}];}return db[_0x94f7('0x6a')][_0x94f7('0x4d')](_0x22a7e7);})[_0x94f7('0x29')](function(_0x115cee){_0x34f2af['rows']=_0x115cee;return _0x34f2af;});}})[_0x94f7('0x29')](respondWithFilteredResult(_0x320a45,_0x22a7e7))[_0x94f7('0x4f')](handleError(_0x320a45,null));};exports[_0x94f7('0x6b')]=function(_0x475ad4,_0x4c1204,_0x43778d){var _0x1afadd={};var _0x278cad={};var _0xa769dd;var _0x362bec;return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x475ad4[_0x94f7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4c1204,null))[_0x94f7('0x29')](function(_0x48a4bc){if(_0x48a4bc){_0xa769dd=_0x48a4bc;_0x278cad[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db[_0x94f7('0x6c')]['rawAttributes']);_0x278cad[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0x475ad4[_0x94f7('0x3d')]);_0x278cad[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x278cad[_0x94f7('0x3c')],_0x278cad[_0x94f7('0x3d')]);_0x1afadd[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x278cad['model'],qs['fields'](_0x475ad4['query']['fields']));_0x1afadd[_0x94f7('0x41')]=_0x1afadd[_0x94f7('0x41')]['length']?_0x1afadd[_0x94f7('0x41')]:_0x278cad[_0x94f7('0x3c')];_0x1afadd[_0x94f7('0x45')]=qs['sort'](_0x475ad4[_0x94f7('0x3d')][_0x94f7('0x46')]);_0x1afadd[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0x475ad4[_0x94f7('0x3d')],_0x278cad[_0x94f7('0x3f')]));if(_0x475ad4['query'][_0x94f7('0x48')]){_0x1afadd[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x1afadd[_0x94f7('0x47')],{'$or':_[_0x94f7('0x31')](_0x1afadd['attributes'],function(_0x43e04f){var _0x2b5fa9={};_0x2b5fa9[_0x43e04f]={'$like':'%'+_0x475ad4[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x2b5fa9;})});}_0x1afadd=_[_0x94f7('0x49')]({},_0x1afadd,_0x475ad4[_0x94f7('0x4a')]);return _0xa769dd[_0x94f7('0x6b')](_0x1afadd);}})[_0x94f7('0x29')](function(_0x1669da){if(_0x1669da){_0x362bec=_0x1669da[_0x94f7('0x51')];if(!_0x475ad4[_0x94f7('0x3d')][_0x94f7('0x43')]('nolimit')){_0x1afadd[_0x94f7('0x24')]=qs[_0x94f7('0x24')](_0x475ad4['query'][_0x94f7('0x24')]);_0x1afadd['offset']=qs[_0x94f7('0x22')](_0x475ad4[_0x94f7('0x3d')][_0x94f7('0x22')]);}return _0xa769dd[_0x94f7('0x6b')](_0x1afadd);}})[_0x94f7('0x29')](function(_0x1c75f7){if(_0x1c75f7){return _0x1c75f7?{'count':_0x362bec,'rows':_0x1c75f7}:null;}})['then'](respondWithResult(_0x4c1204,null))[_0x94f7('0x4f')](handleError(_0x4c1204,null));};exports[_0x94f7('0x6d')]=function(_0x139cf1,_0x2ee1b8,_0x3051c9){var _0x4e8278=_0x139cf1[_0x94f7('0x54')]['teams'];var _0x2bd39e=_[_0x94f7('0x31')](_0x4e8278,'id');return db[_0x94f7('0x6c')]['findAll']({'where':{'id':_0x2bd39e},'attributes':['id'],'include':[{'model':db[_0x94f7('0x6e')],'as':'Agents','attributes':['id','name',_0x94f7('0x6f'),_0x94f7('0x70'),_0x94f7('0x71')],'raw':!![]}]})[_0x94f7('0x29')](function(_0x573c42){if(_0x573c42){var _0x2d602b=_[_0x94f7('0x72')](_0x573c42,function(_0x466b71){var _0x38ac30=_0x466b71[_0x94f7('0x2b')]({'plain':!![]});_0x38ac30[_0x94f7('0x73')][_0x94f7('0x74')](function(_0x342825){_0x342825[_0x94f7('0x75')]=_['find'](_0x4e8278,{'id':_0x38ac30['id']})[_0x94f7('0x75')];});return _0x38ac30[_0x94f7('0x73')];});return db[_0x94f7('0x39')]['find']({'where':{'id':_0x139cf1['params']['id']}})[_0x94f7('0x29')](function(_0x4ffd51){return db['sequelize'][_0x94f7('0x76')](function(_0x6f44bf){return _0x4ffd51['addTeams'](_0x2bd39e,{'transaction':_0x6f44bf})[_0x94f7('0x29')](function(){return BPromise['each'](_0x4e8278,function(_0x530c19){return db[_0x94f7('0x77')][_0x94f7('0x78')]({'TeamId':_0x530c19['id'],'VoiceQueueId':_0x139cf1[_0x94f7('0x5f')]['id'],'penalty':_0x530c19['penalty']},{'transaction':_0x6f44bf});});})[_0x94f7('0x29')](function(){return BPromise[_0x94f7('0x79')](_0x2d602b,function(_0x2df6cb){return db[_0x94f7('0x7a')][_0x94f7('0x7b')]({'where':{'UserId':_0x2df6cb['id'],'VoiceQueueId':_0x139cf1[_0x94f7('0x5f')]['id']},'defaults':{'penalty':_0x2df6cb[_0x94f7('0x75')]},'transaction':_0x6f44bf});});})[_0x94f7('0x29')](function(){return BPromise[_0x94f7('0x79')](_['filter'](_0x2d602b,{'online':!![]}),function(_0x2216a9){return db[_0x94f7('0x7c')][_0x94f7('0x78')]({'membername':_0x2216a9[_0x94f7('0x34')],'UserId':_0x2216a9['id'],'queue_name':_0x4ffd51[_0x94f7('0x34')],'VoiceQueueId':_0x4ffd51['id'],'interface':_[_0x94f7('0x7d')](_0x2216a9[_0x94f7('0x71')])?util[_0x94f7('0x7e')]('SIP/%s',_0x2216a9[_0x94f7('0x34')]):_0x2216a9[_0x94f7('0x71')],'paused':_0x2216a9[_0x94f7('0x70')]||![],'penalty':_0x2216a9[_0x94f7('0x75')]},{'transaction':_0x6f44bf});});})['then'](function(){_0x2d602b[_0x94f7('0x74')](function(_0x413533){socket[_0x94f7('0x7f')](_0x94f7('0x80'),{'UserId':_0x413533['id'],'VoiceQueueId':_0x4ffd51['id']});});});});});}})['then'](respondWithStatusCode(_0x2ee1b8,null))['catch'](handleError(_0x2ee1b8,null));};exports['removeTeams']=function(_0x1dad19,_0x477712,_0x2c3483){return db[_0x94f7('0x6c')][_0x94f7('0x4d')]({'where':{'id':_0x1dad19[_0x94f7('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x94f7('0x73'),'attributes':['id'],'raw':!![]}]})[_0x94f7('0x29')](handleEntityNotFound(_0x477712,null))[_0x94f7('0x29')](function(_0x2e56fa){var _0x1c4053=_[_0x94f7('0x31')](_0x2e56fa,'id');var _0x588644=[];var _0x5b4ec1=[];var _0x237f60=squel['select']();_0x237f60['field'](_0x94f7('0x81'))[_0x94f7('0x82')]('team_has_voice_queues','tq')[_0x94f7('0x83')](_0x94f7('0x84'),'ut',_0x94f7('0x85'))['where'](_0x94f7('0x86'),_0x1dad19[_0x94f7('0x5f')]['id']);for(var _0x2dab7d=0x0;_0x2dab7d<_0x2e56fa[_0x94f7('0x51')];_0x2dab7d+=0x1){let _0x304349=_0x2e56fa[_0x2dab7d];for(var _0x4dd880=0x0;_0x4dd880<_0x304349[_0x94f7('0x73')][_0x94f7('0x51')];_0x4dd880+=0x1){let _0x31163d=_0x304349[_0x94f7('0x73')][_0x4dd880];var _0x5db9a4=_0x237f60['clone']();_0x5db9a4[_0x94f7('0x47')](_0x94f7('0x87'),_0x31163d['id']);_0x5b4ec1[_0x94f7('0x88')](db[_0x94f7('0x89')]['query'](_0x5db9a4[_0x94f7('0x8a')](),{'type':db[_0x94f7('0x89')][_0x94f7('0x8b')]['SELECT']})[_0x94f7('0x29')](function(_0x26d057){if(_0x26d057[_0x94f7('0x51')]===0x1){return _0x31163d['id'];}else{var _0x17149c=_['every'](_['map'](_0x26d057,_0x94f7('0x8c')),function(_0x33d83a){return _['includes'](_0x1c4053,_0x33d83a);});if(_0x17149c){return _0x31163d['id'];}}}));}}return BPromise[_0x94f7('0x8d')](_0x5b4ec1)['then'](function(_0xaa9e53){_0x588644=_(_0x588644)[_0x94f7('0x8e')](_0xaa9e53)['compact']()['value']();return db[_0x94f7('0x39')]['find']({'where':{'id':_0x1dad19[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](function(_0x4c2051){return db[_0x94f7('0x89')][_0x94f7('0x76')](function(_0x1bef11){return _0x4c2051['removeTeams'](_0x1dad19[_0x94f7('0x3d')][_0x94f7('0x8f')],{'transaction':_0x1bef11})[_0x94f7('0x29')](function(){if(!_['isEmpty'](_0x588644)){return _0x4c2051[_0x94f7('0x90')](_0x588644,{'transaction':_0x1bef11})[_0x94f7('0x29')](function(){return db[_0x94f7('0x7c')][_0x94f7('0x2a')]({'where':{'VoiceQueueId':_0x1dad19[_0x94f7('0x5f')]['id'],'UserId':_0x588644},'transaction':_0x1bef11});});}})['then'](function(){_0x588644['forEach'](function(_0x8073a2){socket[_0x94f7('0x7f')](_0x94f7('0x91'),{'UserId':_0x8073a2,'VoiceQueueId':_0x4c2051['id']});});});});});});})['then'](respondWithStatusCode(_0x477712,null))['catch'](handleError(_0x477712,null));};exports['addAgents']=function(_0x1b58e3,_0xc2582f,_0xc74c1a){var _0x530544,_0xd2ac0d;return db[_0x94f7('0x39')][_0x94f7('0x52')]({'where':{'id':_0x1b58e3['params']['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0xc2582f,null))[_0x94f7('0x29')](function(_0x505f9e){if(_0x505f9e){_0xd2ac0d=_0x505f9e;return _0x505f9e[_0x94f7('0x92')](_0x1b58e3[_0x94f7('0x54')]['ids'],_[_0x94f7('0x5b')](_0x1b58e3[_0x94f7('0x54')],[_0x94f7('0x8f'),'id'])||{})[_0x94f7('0x93')](function(_0x37ca1b){for(var _0x18ce9b=0x0;_0x18ce9b<_0x1b58e3[_0x94f7('0x54')]['ids'][_0x94f7('0x51')];_0x18ce9b+=0x1){socket[_0x94f7('0x7f')](_0x94f7('0x80'),{'UserId':Number(_0x1b58e3[_0x94f7('0x54')][_0x94f7('0x8f')][_0x18ce9b]),'VoiceQueueId':Number(_0x1b58e3[_0x94f7('0x5f')]['id'])});}return _0x37ca1b;});}})['then'](function(_0x24fbd3){_0x530544=_0x24fbd3||[];if(_0xd2ac0d){return db['User'][_0x94f7('0x4d')]({'where':{'id':_0x1b58e3['body']['ids']},'attributes':['id','name',_0x94f7('0x6f'),_0x94f7('0x70'),'interface'],'raw':!![]});}})[_0x94f7('0x29')](function(_0x25f522){if(!_[_0x94f7('0x94')](_0x25f522)){var _0x16a283=[];for(var _0x2acac3=0x0;_0x2acac3<_0x25f522[_0x94f7('0x51')];_0x2acac3++){if(_0x25f522[_0x2acac3][_0x94f7('0x6f')]){_0x16a283[_0x94f7('0x88')](db[_0x94f7('0x7c')]['upsert']({'membername':_0x25f522[_0x2acac3][_0x94f7('0x34')],'UserId':_0x25f522[_0x2acac3]['id'],'queue_name':_0xd2ac0d[_0x94f7('0x34')],'VoiceQueueId':_0xd2ac0d['id'],'interface':_[_0x94f7('0x7d')](_0x25f522[_0x2acac3][_0x94f7('0x71')])?util[_0x94f7('0x7e')](_0x94f7('0x95'),_0x25f522[_0x2acac3][_0x94f7('0x34')]):_0x25f522[_0x2acac3][_0x94f7('0x71')],'paused':_0x25f522[_0x2acac3][_0x94f7('0x70')]||![],'penalty':_0x1b58e3['body'][_0x94f7('0x75')]||0x0}));}}return BPromise[_0x94f7('0x8d')](_0x16a283);}})['then'](function(){return _0x530544;})[_0x94f7('0x29')](respondWithResult(_0xc2582f,null))['catch'](handleError(_0xc2582f,null));};exports[_0x94f7('0x90')]=function(_0x23c656,_0x59e2b4,_0x34b81e){return db[_0x94f7('0x39')][_0x94f7('0x52')]({'where':{'id':_0x23c656[_0x94f7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x59e2b4,null))['then'](function(_0x317c9b){if(_0x317c9b){return _0x317c9b[_0x94f7('0x90')](_0x23c656['query'][_0x94f7('0x8f')])['then'](function(){if(_['isArray'](_0x23c656[_0x94f7('0x3d')]['ids'])){for(var _0x5ecd5a=0x0;_0x5ecd5a<_0x23c656[_0x94f7('0x3d')]['ids']['length'];_0x5ecd5a+=0x1){socket[_0x94f7('0x7f')](_0x94f7('0x91'),{'UserId':Number(_0x23c656[_0x94f7('0x3d')]['ids'][_0x5ecd5a]),'VoiceQueueId':Number(_0x23c656[_0x94f7('0x5f')]['id'])});}}else{socket[_0x94f7('0x7f')](_0x94f7('0x91'),{'UserId':Number(_0x23c656[_0x94f7('0x3d')]['ids']),'VoiceQueueId':Number(_0x23c656[_0x94f7('0x5f')]['id'])});}});}})[_0x94f7('0x29')](function(_0xceeaa6){return db[_0x94f7('0x7c')][_0x94f7('0x2a')]({'where':{'VoiceQueueId':_0x23c656['params']['id'],'UserId':_0x23c656[_0x94f7('0x3d')]['ids']}})['then'](function(){return _0xceeaa6;});})[_0x94f7('0x29')](respondWithStatusCode(_0x59e2b4,null))[_0x94f7('0x4f')](handleError(_0x59e2b4,null));};exports[_0x94f7('0x96')]=function(_0x2c8c12,_0x4c75bb,_0xedf3d3){var _0x3fba49={};var _0x43ef11={};var _0xfc098f;var _0x3df48c;return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x2c8c12[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x4c75bb,null))[_0x94f7('0x29')](function(_0xd1bac1){if(_0xd1bac1){_0xfc098f=_0xd1bac1;_0x43ef11[_0x94f7('0x3c')]=_['keys'](db['User'][_0x94f7('0x3a')]);_0x43ef11[_0x94f7('0x3d')]=_['keys'](_0x2c8c12[_0x94f7('0x3d')]);_0x43ef11[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x43ef11[_0x94f7('0x3c')],_0x43ef11['query']);_0x3fba49[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x43ef11[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0x2c8c12[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x3fba49[_0x94f7('0x41')]=_0x3fba49[_0x94f7('0x41')][_0x94f7('0x51')]?_0x3fba49[_0x94f7('0x41')]:_0x43ef11[_0x94f7('0x3c')];_0x3fba49[_0x94f7('0x45')]=qs[_0x94f7('0x46')](_0x2c8c12['query'][_0x94f7('0x46')]);_0x3fba49[_0x94f7('0x47')]=qs['filters'](_[_0x94f7('0x63')](_0x2c8c12[_0x94f7('0x3d')],_0x43ef11[_0x94f7('0x3f')]));if(_0x2c8c12[_0x94f7('0x3d')]['filter']){_0x3fba49[_0x94f7('0x47')]=_['merge'](_0x3fba49[_0x94f7('0x47')],{'$or':_['map'](_0x3fba49[_0x94f7('0x41')],function(_0x59ae56){var _0x373bbb={};_0x373bbb[_0x59ae56]={'$like':'%'+_0x2c8c12[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x373bbb;})});}_0x3fba49=_['merge']({},_0x3fba49,_0x2c8c12[_0x94f7('0x4a')]);return _0xfc098f[_0x94f7('0x96')](_0x3fba49);}})[_0x94f7('0x29')](function(_0xbf55db){if(_0xbf55db){_0x3df48c=_0xbf55db[_0x94f7('0x51')];if(!_0x2c8c12[_0x94f7('0x3d')]['hasOwnProperty'](_0x94f7('0x44'))){_0x3fba49['limit']=qs[_0x94f7('0x24')](_0x2c8c12[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x3fba49[_0x94f7('0x22')]=qs[_0x94f7('0x22')](_0x2c8c12[_0x94f7('0x3d')][_0x94f7('0x22')]);}return _0xfc098f[_0x94f7('0x96')](_0x3fba49);}})[_0x94f7('0x29')](function(_0x272e79){if(_0x272e79){return _0x272e79?{'count':_0x3df48c,'rows':_0x272e79}:null;}})[_0x94f7('0x29')](respondWithResult(_0x4c75bb,null))[_0x94f7('0x4f')](handleError(_0x4c75bb,null));};exports['getMembers']=function(_0x5e1513,_0x45f71d,_0x2aab5b){var _0x14631d={};var _0x31b312={};var _0x3692eb;var _0x3595a9;return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x5e1513['params']['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x45f71d,null))[_0x94f7('0x29')](function(_0x1ccd73){if(_0x1ccd73){_0x3692eb=_0x1ccd73;_0x31b312[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db[_0x94f7('0x7c')]['rawAttributes']);_0x31b312['query']=_[_0x94f7('0x3e')](_0x5e1513[_0x94f7('0x3d')]);_0x31b312['filters']=_[_0x94f7('0x40')](_0x31b312[_0x94f7('0x3c')],_0x31b312[_0x94f7('0x3d')]);_0x14631d[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x31b312['model'],qs[_0x94f7('0x42')](_0x5e1513[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x14631d[_0x94f7('0x41')]=_0x14631d['attributes'][_0x94f7('0x51')]?_0x14631d[_0x94f7('0x41')]:_0x31b312[_0x94f7('0x3c')];_0x14631d[_0x94f7('0x45')]=qs['sort'](_0x5e1513[_0x94f7('0x3d')][_0x94f7('0x46')]);_0x14631d[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0x5e1513[_0x94f7('0x3d')],_0x31b312[_0x94f7('0x3f')]));if(_0x5e1513[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x14631d[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x14631d[_0x94f7('0x47')],{'$or':_[_0x94f7('0x31')](_0x14631d[_0x94f7('0x41')],function(_0x228c3d){var _0x2b441e={};_0x2b441e[_0x228c3d]={'$like':'%'+_0x5e1513[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x2b441e;})});}_0x14631d=_[_0x94f7('0x49')]({},_0x14631d,_0x5e1513['options']);return _0x3692eb[_0x94f7('0x97')](_0x14631d);}})['then'](function(_0x27e625){if(_0x27e625){_0x3595a9=_0x27e625[_0x94f7('0x51')];if(!_0x5e1513['query'][_0x94f7('0x43')](_0x94f7('0x44'))){_0x14631d[_0x94f7('0x24')]=qs['limit'](_0x5e1513['query'][_0x94f7('0x24')]);_0x14631d['offset']=qs['offset'](_0x5e1513['query'][_0x94f7('0x22')]);}return _0x3692eb['getMembers'](_0x14631d);}})[_0x94f7('0x29')](function(_0x162da2){return _0x162da2?{'count':_0x3595a9,'rows':_0x162da2}:null;})[_0x94f7('0x29')](respondWithResult(_0x45f71d,null))['catch'](handleError(_0x45f71d,null));};exports[_0x94f7('0x98')]=function(_0xfb0125,_0x4d1cb8,_0x5c6f89){var _0x2a915f={};var _0x38975e={};var _0x1d685d;var _0x8307ed;return db['VoiceQueue'][_0x94f7('0x61')]({'where':{'id':_0xfb0125[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x4d1cb8,null))['then'](function(_0x1b1ef8){if(_0x1b1ef8){_0x1d685d=_0x1b1ef8;_0x38975e[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db['CmList'][_0x94f7('0x3a')]);_0x38975e[_0x94f7('0x3d')]=_[_0x94f7('0x3e')](_0xfb0125[_0x94f7('0x3d')]);_0x38975e['filters']=_[_0x94f7('0x40')](_0x38975e[_0x94f7('0x3c')],_0x38975e[_0x94f7('0x3d')]);_0x2a915f[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x38975e[_0x94f7('0x3c')],qs[_0x94f7('0x42')](_0xfb0125[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x2a915f['attributes']=_0x2a915f[_0x94f7('0x41')][_0x94f7('0x51')]?_0x2a915f[_0x94f7('0x41')]:_0x38975e[_0x94f7('0x3c')];_0x2a915f[_0x94f7('0x45')]=qs[_0x94f7('0x46')](_0xfb0125[_0x94f7('0x3d')][_0x94f7('0x46')]);_0x2a915f[_0x94f7('0x47')]=qs[_0x94f7('0x3f')](_[_0x94f7('0x63')](_0xfb0125[_0x94f7('0x3d')],_0x38975e[_0x94f7('0x3f')]));if(_0xfb0125[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x2a915f[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x2a915f['where'],{'$or':_['map'](_0x2a915f[_0x94f7('0x41')],function(_0x53b214){var _0x2b7c3c={};_0x2b7c3c[_0x53b214]={'$like':'%'+_0xfb0125['query']['filter']+'%'};return _0x2b7c3c;})});}_0x2a915f=_[_0x94f7('0x49')]({},_0x2a915f,_0xfb0125['options']);return _0x1d685d[_0x94f7('0x98')](_0x2a915f);}})[_0x94f7('0x29')](function(_0x4ef681){if(_0x4ef681){_0x8307ed=_0x4ef681[_0x94f7('0x51')];if(!_0xfb0125[_0x94f7('0x3d')]['hasOwnProperty']('nolimit')){_0x2a915f['limit']=qs['limit'](_0xfb0125[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x2a915f[_0x94f7('0x22')]=qs[_0x94f7('0x22')](_0xfb0125[_0x94f7('0x3d')][_0x94f7('0x22')]);}return _0x1d685d[_0x94f7('0x98')](_0x2a915f);}})[_0x94f7('0x29')](function(_0x512fcb){if(_0x512fcb){return _0x512fcb?{'count':_0x8307ed,'rows':_0x512fcb}:null;}})['then'](respondWithResult(_0x4d1cb8,null))[_0x94f7('0x4f')](handleError(_0x4d1cb8,null));};exports['addLists']=function(_0x5a6612,_0xfd969b,_0xd2af34){var _0x3355bf,_0x12dfb8;return db[_0x94f7('0x39')][_0x94f7('0x52')]({'where':{'id':_0x5a6612[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0xfd969b,null))[_0x94f7('0x29')](function(_0x5bb50d){if(_0x5bb50d){_0x12dfb8=_0x5bb50d;return _0x5bb50d[_0x94f7('0x99')](_0x5a6612['body'][_0x94f7('0x8f')],_[_0x94f7('0x5b')](_0x5a6612[_0x94f7('0x54')],[_0x94f7('0x8f'),'id'])||{});}return null;})[_0x94f7('0x93')](function(_0x5e68dc){var _0x3a3f29;_0x3355bf=_0x5e68dc||[];var _0x3ea901=[];if(_0x5e68dc){for(var _0x3c590d=0x0;_0x3c590d<_0x5e68dc['length'];_0x3c590d+=0x1){var _0x493122=_0x5e68dc[_0x3c590d][_0x94f7('0x2b')]({'plain':!![]});_0x12dfb8['dialCheckDuplicateType']=_0x5a6612[_0x94f7('0x54')]['dialCheckDuplicateType']?_0x5a6612['body'][_0x94f7('0x9a')]:_0x12dfb8[_0x94f7('0x9a')];switch(_0x12dfb8[_0x94f7('0x9a')]){case'always':_0x3a3f29=squel[_0x94f7('0x9b')]()[_0x94f7('0x9c')]('cm_hopper')[_0x94f7('0x9d')]([_0x94f7('0x9e'),'scheduledAt',_0x94f7('0x9f'),_0x94f7('0xa0'),_0x94f7('0x67'),_0x94f7('0x5c'),_0x94f7('0x5d')],squel['select']()[_0x94f7('0xa1')](_0x94f7('0x9e'),'phone')['field']('NOW()',_0x94f7('0xa2'))['field']('id',_0x94f7('0x9f'))[_0x94f7('0xa1')](_0x493122[_0x94f7('0xa3')][_0x94f7('0x8a')](),'ListId')[_0x94f7('0xa1')](_0x5a6612[_0x94f7('0x5f')]['id']['toString'](),_0x94f7('0x67'))[_0x94f7('0xa1')](_0x94f7('0xa4'),_0x94f7('0x5c'))[_0x94f7('0xa1')](_0x94f7('0xa4'),_0x94f7('0x5d'))[_0x94f7('0x82')](_0x94f7('0xa5'))[_0x94f7('0x47')](_0x94f7('0xa6'))[_0x94f7('0x47')](_0x94f7('0xa7'),_0x493122[_0x94f7('0xa3')][_0x94f7('0x8a')]())[_0x94f7('0x47')](_0x94f7('0xa8'))[_0x94f7('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x94f7('0xa9')]()[_0x94f7('0xa1')](_0x94f7('0xaa'))[_0x94f7('0x82')](_0x94f7('0xab'))['where'](_0x94f7('0x86'),_0x5a6612[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')]()))[_0x94f7('0x47')](_0x94f7('0xac'),squel['select']()[_0x94f7('0xa1')]('COALESCE(phone,\x27\x27)')[_0x94f7('0x82')]('cm_hopper')['where'](_0x94f7('0x86'),_0x5a6612[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')]())))[_0x94f7('0x8a')]();break;case'onlyIfOpen':_0x3a3f29=squel[_0x94f7('0x9b')]()[_0x94f7('0x9c')](_0x94f7('0xad'))[_0x94f7('0x9d')](['phone',_0x94f7('0xa2'),_0x94f7('0x9f'),'ListId',_0x94f7('0x67'),_0x94f7('0x5c'),'updatedAt'],squel[_0x94f7('0xa9')]()[_0x94f7('0xa1')](_0x94f7('0x9e'),_0x94f7('0x9e'))[_0x94f7('0xa1')](_0x94f7('0xa4'),_0x94f7('0xa2'))['field']('id',_0x94f7('0x9f'))['field'](_0x493122[_0x94f7('0xa3')]['toString'](),'ListId')[_0x94f7('0xa1')](_0x5a6612[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')](),_0x94f7('0x67'))[_0x94f7('0xa1')](_0x94f7('0xa4'),'createdAt')[_0x94f7('0xa1')]('NOW()',_0x94f7('0x5d'))['from'](_0x94f7('0xa5'))[_0x94f7('0x47')]('deletedAt\x20IS\x20NULL')[_0x94f7('0x47')](_0x94f7('0xa7'),_0x493122[_0x94f7('0xa3')][_0x94f7('0x8a')]())[_0x94f7('0x47')](_0x94f7('0xa8'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x94f7('0xa9')]()['field'](_0x94f7('0xae'))['from'](_0x94f7('0xad'))['where'](_0x94f7('0x86'),_0x5a6612[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')]())))[_0x94f7('0x8a')]();break;default:_0x3a3f29=squel[_0x94f7('0x9b')]()[_0x94f7('0x9c')](_0x94f7('0xad'))['fromQuery']([_0x94f7('0x9e'),_0x94f7('0xa2'),_0x94f7('0x9f'),'ListId',_0x94f7('0x67'),_0x94f7('0x5c'),_0x94f7('0x5d')],squel[_0x94f7('0xa9')]()['field'](_0x94f7('0x9e'),_0x94f7('0x9e'))['field'](_0x94f7('0xa4'),_0x94f7('0xa2'))['field']('id',_0x94f7('0x9f'))[_0x94f7('0xa1')](_0x493122[_0x94f7('0xa3')][_0x94f7('0x8a')](),'ListId')[_0x94f7('0xa1')](_0x5a6612[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')](),_0x94f7('0x67'))[_0x94f7('0xa1')](_0x94f7('0xa4'),_0x94f7('0x5c'))['field']('NOW()',_0x94f7('0x5d'))[_0x94f7('0x82')](_0x94f7('0xa5'))[_0x94f7('0x47')](_0x94f7('0xa6'))[_0x94f7('0x47')](_0x94f7('0xa7'),_0x493122[_0x94f7('0xa3')][_0x94f7('0x8a')]())[_0x94f7('0x47')](_0x94f7('0xa8')))[_0x94f7('0x8a')]();}_0x3ea901['push'](db[_0x94f7('0x89')][_0x94f7('0x3d')](_0x3a3f29));}return BPromise[_0x94f7('0x8d')](_0x3ea901);}})[_0x94f7('0x29')](function(){return _0x3355bf;})['then'](respondWithResult(_0xfd969b,null))[_0x94f7('0x4f')](handleError(_0xfd969b,null));};exports[_0x94f7('0xaf')]=function(_0xf1fbd7,_0xcda5ab,_0x3333e5){return db['VoiceQueue'][_0x94f7('0x52')]({'where':{'id':_0xf1fbd7[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0xcda5ab,null))[_0x94f7('0x29')](function(_0x410726){if(_0x410726){return _0x410726[_0x94f7('0xaf')](_0xf1fbd7[_0x94f7('0x3d')][_0x94f7('0x8f')]);}})[_0x94f7('0x29')](function(_0x20bc70){if(_0x20bc70){return db['CmHopper'][_0x94f7('0x2a')]({'where':{'ListId':_0xf1fbd7[_0x94f7('0x3d')][_0x94f7('0x8f')],'VoiceQueueId':_0xf1fbd7[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](function(){return _0x20bc70;});}})[_0x94f7('0x29')](respondWithStatusCode(_0xcda5ab,null))[_0x94f7('0x4f')](handleError(_0xcda5ab,null));};exports['getBlackLists']=function(_0x4b5660,_0x26b6b4,_0x1d53ab){var _0x1ec723={};var _0x4cb035={};var _0x9f0214;var _0x4606b8;return db[_0x94f7('0x39')][_0x94f7('0x61')]({'where':{'id':_0x4b5660[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x26b6b4,null))[_0x94f7('0x29')](function(_0x107abf){if(_0x107abf){_0x9f0214=_0x107abf;_0x4cb035[_0x94f7('0x3c')]=_[_0x94f7('0x3e')](db[_0x94f7('0xb0')][_0x94f7('0x3a')]);_0x4cb035[_0x94f7('0x3d')]=_['keys'](_0x4b5660[_0x94f7('0x3d')]);_0x4cb035[_0x94f7('0x3f')]=_[_0x94f7('0x40')](_0x4cb035[_0x94f7('0x3c')],_0x4cb035[_0x94f7('0x3d')]);_0x1ec723[_0x94f7('0x41')]=_[_0x94f7('0x40')](_0x4cb035['model'],qs[_0x94f7('0x42')](_0x4b5660[_0x94f7('0x3d')][_0x94f7('0x42')]));_0x1ec723['attributes']=_0x1ec723[_0x94f7('0x41')][_0x94f7('0x51')]?_0x1ec723[_0x94f7('0x41')]:_0x4cb035[_0x94f7('0x3c')];_0x1ec723[_0x94f7('0x45')]=qs[_0x94f7('0x46')](_0x4b5660[_0x94f7('0x3d')]['sort']);_0x1ec723[_0x94f7('0x47')]=qs['filters'](_['pick'](_0x4b5660['query'],_0x4cb035[_0x94f7('0x3f')]));if(_0x4b5660[_0x94f7('0x3d')][_0x94f7('0x48')]){_0x1ec723[_0x94f7('0x47')]=_[_0x94f7('0x49')](_0x1ec723[_0x94f7('0x47')],{'$or':_[_0x94f7('0x31')](_0x1ec723[_0x94f7('0x41')],function(_0x5c7891){var _0x3f7052={};_0x3f7052[_0x5c7891]={'$like':'%'+_0x4b5660[_0x94f7('0x3d')][_0x94f7('0x48')]+'%'};return _0x3f7052;})});}_0x1ec723=_[_0x94f7('0x49')]({},_0x1ec723,_0x4b5660[_0x94f7('0x4a')]);return _0x9f0214[_0x94f7('0xb1')](_0x1ec723);}})[_0x94f7('0x29')](function(_0x3fd645){if(_0x3fd645){_0x4606b8=_0x3fd645[_0x94f7('0x51')];if(!_0x4b5660['query']['hasOwnProperty'](_0x94f7('0x44'))){_0x1ec723[_0x94f7('0x24')]=qs[_0x94f7('0x24')](_0x4b5660[_0x94f7('0x3d')][_0x94f7('0x24')]);_0x1ec723['offset']=qs[_0x94f7('0x22')](_0x4b5660[_0x94f7('0x3d')]['offset']);}return _0x9f0214[_0x94f7('0xb1')](_0x1ec723);}})[_0x94f7('0x29')](function(_0x242936){if(_0x242936){return _0x242936?{'count':_0x4606b8,'rows':_0x242936}:null;}})[_0x94f7('0x29')](respondWithResult(_0x26b6b4,null))[_0x94f7('0x4f')](handleError(_0x26b6b4,null));};exports[_0x94f7('0xb2')]=function(_0x105248,_0x324583,_0x3969ac){var _0xa6877d,_0x419ceb;return db[_0x94f7('0x39')]['find']({'where':{'id':_0x105248[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](handleEntityNotFound(_0x324583,null))[_0x94f7('0x29')](function(_0x1d1c97){if(_0x1d1c97){_0x419ceb=_0x1d1c97;return _0x1d1c97[_0x94f7('0xb2')](_0x105248[_0x94f7('0x54')][_0x94f7('0x8f')],_[_0x94f7('0x5b')](_0x105248['body'],[_0x94f7('0x8f'),'id'])||{});}return null;})[_0x94f7('0x93')](function(_0x5d97bf){var _0x2ec343;_0xa6877d=_0x5d97bf||[];var _0x2a4228=[];if(_0x5d97bf){for(var _0x3d19a5=0x0;_0x3d19a5<_0x5d97bf[_0x94f7('0x51')];_0x3d19a5+=0x1){var _0xdd6021=_0x5d97bf[_0x3d19a5][_0x94f7('0x2b')]({'plain':!![]});_0x2ec343=squel[_0x94f7('0x9b')]()[_0x94f7('0x9c')](_0x94f7('0xb3'))[_0x94f7('0x9d')]([_0x94f7('0x9e'),_0x94f7('0x9f'),_0x94f7('0xa0'),_0x94f7('0x67'),_0x94f7('0x5c'),_0x94f7('0x5d')],squel[_0x94f7('0xa9')]()[_0x94f7('0xa1')](_0x94f7('0x9e'),_0x94f7('0x9e'))[_0x94f7('0xa1')]('id',_0x94f7('0x9f'))[_0x94f7('0xa1')](_0xdd6021[_0x94f7('0xa3')][_0x94f7('0x8a')](),_0x94f7('0xa0'))[_0x94f7('0xa1')](_0x105248[_0x94f7('0x5f')]['id'][_0x94f7('0x8a')](),_0x94f7('0x67'))['field'](_0x94f7('0xa4'),_0x94f7('0x5c'))[_0x94f7('0xa1')](_0x94f7('0xa4'),_0x94f7('0x5d'))[_0x94f7('0x82')](_0x94f7('0xa5'))[_0x94f7('0x47')]('deletedAt\x20IS\x20NULL')[_0x94f7('0x47')](_0x94f7('0xa7'),_0xdd6021[_0x94f7('0xa3')][_0x94f7('0x8a')]())[_0x94f7('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x94f7('0x8a')]();_0x2a4228['push'](db['sequelize']['query'](_0x2ec343));}return BPromise['all'](_0x2a4228);}})[_0x94f7('0x29')](function(){return _0xa6877d;})[_0x94f7('0x29')](respondWithResult(_0x324583,null))['catch'](handleError(_0x324583,null));};exports['removeBlackLists']=function(_0x52c363,_0xab1332,_0x3765d7){return db[_0x94f7('0x39')][_0x94f7('0x52')]({'where':{'id':_0x52c363[_0x94f7('0x5f')]['id']}})['then'](handleEntityNotFound(_0xab1332,null))['then'](function(_0x10f4a5){if(_0x10f4a5){return _0x10f4a5[_0x94f7('0xb4')](_0x52c363[_0x94f7('0x3d')][_0x94f7('0x8f')]);}})['then'](function(_0xc5af50){if(_0xc5af50){return db['CmHopperBlack'][_0x94f7('0x2a')]({'where':{'ListId':_0x52c363[_0x94f7('0x3d')][_0x94f7('0x8f')],'VoiceQueueId':_0x52c363[_0x94f7('0x5f')]['id']}})[_0x94f7('0x29')](function(){return _0xc5af50;});}})[_0x94f7('0x29')](respondWithStatusCode(_0xab1332,null))[_0x94f7('0x4f')](handleError(_0xab1332,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 52ec95f..e992c15 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 _0x7189=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7189,0x18a));var _0x9718=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x7189[_0x21b36c];return _0x236627;};'use strict';var EventEmitter=require(_0x9718('0x0'));var VoiceQueue=require(_0x9718('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9718('0x2'),'afterUpdate':_0x9718('0x3'),'afterDestroy':_0x9718('0x4')};function emitEvent(_0x22eda9){return function(_0x3d84b9,_0x202f0c,_0x118aaa){VoiceQueueEvents[_0x9718('0x5')](_0x22eda9+':'+_0x3d84b9['id'],_0x3d84b9);VoiceQueueEvents[_0x9718('0x5')](_0x22eda9,_0x3d84b9);_0x118aaa(null);};}for(var e in events){if(events[_0x9718('0x6')](e)){var event=events[e];VoiceQueue[_0x9718('0x7')](e,emitEvent(event));}}module[_0x9718('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x24c4=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x45322a,_0x138b74){var _0x3a4358=function(_0x3b4fc2){while(--_0x3b4fc2){_0x45322a['push'](_0x45322a['shift']());}};_0x3a4358(++_0x138b74);}(_0x24c4,0xbe));var _0x424c=function(_0x2a346c,_0x205808){_0x2a346c=_0x2a346c-0x0;var _0x1945e0=_0x24c4[_0x2a346c];return _0x1945e0;};'use strict';var EventEmitter=require(_0x424c('0x0'));var VoiceQueue=require(_0x424c('0x1'))['db'][_0x424c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x424c('0x3')](0x0);var events={'afterCreate':_0x424c('0x4'),'afterUpdate':_0x424c('0x5'),'afterDestroy':_0x424c('0x6')};function emitEvent(_0x1544e5){return function(_0xb64756,_0x53b370,_0x9d7c85){VoiceQueueEvents[_0x424c('0x7')](_0x1544e5+':'+_0xb64756['id'],_0xb64756);VoiceQueueEvents['emit'](_0x1544e5,_0xb64756);_0x9d7c85(null);};}for(var e in events){if(events[_0x424c('0x8')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x424c('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 53c42c0..4e6bd4d 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0xa81808,_0x5c00e0){var _0x35ad5c=function(_0x2ffba2){while(--_0x2ffba2){_0xa81808['push'](_0xa81808['shift']());}};_0x35ad5c(++_0x5c00e0);}(_0xedd9,0xfc));var _0x9edd=function(_0x56058e,_0x2b8057){_0x56058e=_0x56058e-0x0;var _0x316ec3=_0xedd9[_0x56058e];return _0x316ec3;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x72e9a9,_0x50c5c1){var _0x40f7fe=function(_0x580304){while(--_0x580304){_0x72e9a9['push'](_0x72e9a9['shift']());}};_0x40f7fe(++_0x50c5c1);}(_0xedd9,0xfc));var _0x9edd=function(_0x34a752,_0x152aa1){_0x34a752=_0x34a752-0x0;var _0x121f4e=_0xedd9[_0x34a752];return _0x121f4e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index c98b0ed..8262d63 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 _0xbe95=['request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','model','map','include','GetVoiceQueue','debug','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register'];(function(_0x2750a9,_0x2e8e75){var _0x5c437e=function(_0x6ca359){while(--_0x6ca359){_0x2750a9['push'](_0x2750a9['shift']());}};_0x5c437e(++_0x2e8e75);}(_0xbe95,0x103));var _0x5be9=function(_0x1f53fa,_0x538864){_0x1f53fa=_0x1f53fa-0x0;var _0x55e254=_0xbe95[_0x1f53fa];return _0x55e254;};'use strict';var _=require(_0x5be9('0x0'));var util=require(_0x5be9('0x1'));var moment=require('moment');var BPromise=require(_0x5be9('0x2'));var rs=require(_0x5be9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5be9('0x4'))['db'];var utils=require(_0x5be9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5be9('0x6'));var jayson=require(_0x5be9('0x7'));var client=jayson[_0x5be9('0x8')]['http']({'port':0x232a});config[_0x5be9('0x9')]=_[_0x5be9('0xa')](config['redis'],{'host':_0x5be9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5be9('0x9')]));require(_0x5be9('0xc'))[_0x5be9('0xd')](socket);function respondWithRpcPromise(_0x4e6af7,_0xa3ef06,_0x25ca07){return new BPromise(function(_0x5779d0,_0x431e85){return client[_0x5be9('0xe')](_0x4e6af7,_0x25ca07)[_0x5be9('0xf')](function(_0x4ef52f){logger[_0x5be9('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xa3ef06,_0x5be9('0x11'));logger['debug'](_0x5be9('0x12'),_0xa3ef06,_0x5be9('0x11'),JSON['stringify'](_0x4ef52f));if(_0x4ef52f[_0x5be9('0x13')]){if(_0x4ef52f['error'][_0x5be9('0x14')]===0x1f4){logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);return _0x431e85(_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);}logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);return _0x5779d0(_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);}else{logger[_0x5be9('0x10')](_0x5be9('0x15'),_0xa3ef06,_0x5be9('0x11'));_0x5779d0(_0x4ef52f[_0x5be9('0x17')]['message']);}})[_0x5be9('0x18')](function(_0x4d7128){logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4d7128);_0x431e85(_0x4d7128);});});}exports['GetVoiceQueue']=function(_0x1526fd){var _0x1641dc=this;return new Promise(function(_0x2443bf,_0xf1b876){return db['VoiceQueue'][_0x5be9('0x19')]({'raw':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1c')]||null:null,'attributes':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1d')]||null:null,'limit':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1e')]||null:null,'include':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')]['include']?_['map'](_0x1526fd[_0x5be9('0x1a')]['include'],function(_0x3c21d3){return{'model':db[_0x3c21d3[_0x5be9('0x1f')]],'as':_0x3c21d3['as'],'attributes':_0x3c21d3['attributes'],'include':_0x3c21d3['include']?_[_0x5be9('0x20')](_0x3c21d3[_0x5be9('0x21')],function(_0x5999ba){return{'model':db[_0x5999ba[_0x5be9('0x1f')]],'as':_0x5999ba['as'],'attributes':_0x5999ba[_0x5be9('0x1d')],'include':_0x5999ba[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x5999ba[_0x5be9('0x21')],function(_0x4b3cb7){return{'model':db[_0x4b3cb7[_0x5be9('0x1f')]],'as':_0x4b3cb7['as'],'attributes':_0x4b3cb7[_0x5be9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2148a6){logger[_0x5be9('0x10')](_0x5be9('0x22'),_0x1526fd);logger[_0x5be9('0x23')](_0x5be9('0x22'),_0x1526fd,JSON['stringify'](_0x2148a6));_0x2443bf(_0x2148a6);})[_0x5be9('0x18')](function(_0x535550){logger[_0x5be9('0x13')](_0x5be9('0x22'),_0x535550[_0x5be9('0x16')],_0x1526fd);_0xf1b876(_0x1641dc[_0x5be9('0x13')](0x1f4,_0x535550[_0x5be9('0x16')]));});});};exports[_0x5be9('0x24')]=function(_0xad5712){var _0x212aec=this;return new Promise(function(_0x1c4a8a,_0x50d381){return db[_0x5be9('0x25')][_0x5be9('0x26')]({'raw':_0xad5712[_0x5be9('0x1a')]?_0xad5712['options'][_0x5be9('0x1b')]===undefined?!![]:![]:!![],'where':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x1c')]||null:null,'attributes':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x1d')]||null:null,'include':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x21')]?_[_0x5be9('0x20')](_0xad5712['options'][_0x5be9('0x21')],function(_0x14c8be){return{'model':db[_0x14c8be[_0x5be9('0x1f')]],'as':_0x14c8be['as'],'attributes':_0x14c8be[_0x5be9('0x1d')],'include':_0x14c8be[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x14c8be['include'],function(_0x4553ac){return{'model':db[_0x4553ac[_0x5be9('0x1f')]],'as':_0x4553ac['as'],'attributes':_0x4553ac[_0x5be9('0x1d')],'include':_0x4553ac[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x4553ac[_0x5be9('0x21')],function(_0x27cc53){return{'model':db[_0x27cc53[_0x5be9('0x1f')]],'as':_0x27cc53['as'],'attributes':_0x27cc53['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be9('0xf')](function(_0x49421d){logger[_0x5be9('0x10')]('ShowVoiceQueue',_0xad5712);logger[_0x5be9('0x23')]('ShowVoiceQueue',_0xad5712,JSON['stringify'](_0x49421d));_0x1c4a8a(_0x49421d);})[_0x5be9('0x18')](function(_0x196c88){logger[_0x5be9('0x13')]('ShowVoiceQueue',_0x196c88[_0x5be9('0x16')],_0xad5712);_0x50d381(_0x212aec['error'](0x1f4,_0x196c88['message']));});});}; \ No newline at end of file +var _0xf752=['VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf752,0x1b1));var _0x2f75=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf752[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x2f75('0x0'));var util=require(_0x2f75('0x1'));var moment=require(_0x2f75('0x2'));var BPromise=require(_0x2f75('0x3'));var rs=require(_0x2f75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f75('0x5'))['db'];var utils=require(_0x2f75('0x6'));var logger=require(_0x2f75('0x7'))('rpc');var config=require(_0x2f75('0x8'));var jayson=require(_0x2f75('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2f75('0xa')]=_[_0x2f75('0xb')](config['redis'],{'host':_0x2f75('0xc'),'port':0x18eb});var socket=require(_0x2f75('0xd'))(new Redis(config[_0x2f75('0xa')]));require(_0x2f75('0xe'))[_0x2f75('0xf')](socket);function respondWithRpcPromise(_0x22fa4b,_0x322dff,_0x452578){return new BPromise(function(_0xe107e1,_0x30102b){return client[_0x2f75('0x10')](_0x22fa4b,_0x452578)[_0x2f75('0x11')](function(_0x394b7e){logger['info'](_0x2f75('0x12'),_0x322dff,'request\x20sent');logger['debug'](_0x2f75('0x13'),_0x322dff,_0x2f75('0x14'),JSON[_0x2f75('0x15')](_0x394b7e));if(_0x394b7e['error']){if(_0x394b7e[_0x2f75('0x16')][_0x2f75('0x17')]===0x1f4){logger[_0x2f75('0x16')](_0x2f75('0x12'),_0x322dff,_0x394b7e[_0x2f75('0x16')]['message']);return _0x30102b(_0x394b7e['error'][_0x2f75('0x18')]);}logger[_0x2f75('0x16')](_0x2f75('0x12'),_0x322dff,_0x394b7e[_0x2f75('0x16')][_0x2f75('0x18')]);return _0xe107e1(_0x394b7e[_0x2f75('0x16')][_0x2f75('0x18')]);}else{logger[_0x2f75('0x19')](_0x2f75('0x12'),_0x322dff,'request\x20sent');_0xe107e1(_0x394b7e[_0x2f75('0x1a')][_0x2f75('0x18')]);}})[_0x2f75('0x1b')](function(_0xfcebb2){logger[_0x2f75('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x322dff,_0xfcebb2);_0x30102b(_0xfcebb2);});});}exports[_0x2f75('0x1c')]=function(_0x364755){var _0xe92d71=this;return new Promise(function(_0x2ac4a0,_0x452af6){return db[_0x2f75('0x1d')][_0x2f75('0x1e')]({'raw':_0x364755[_0x2f75('0x1f')]?_0x364755['options'][_0x2f75('0x20')]===undefined?!![]:![]:!![],'where':_0x364755[_0x2f75('0x1f')]?_0x364755['options'][_0x2f75('0x21')]||null:null,'attributes':_0x364755[_0x2f75('0x1f')]?_0x364755[_0x2f75('0x1f')][_0x2f75('0x22')]||null:null,'limit':_0x364755[_0x2f75('0x1f')]?_0x364755[_0x2f75('0x1f')][_0x2f75('0x23')]||null:null,'include':_0x364755[_0x2f75('0x1f')]?_0x364755['options'][_0x2f75('0x24')]?_[_0x2f75('0x25')](_0x364755['options'][_0x2f75('0x24')],function(_0x393ec7){return{'model':db[_0x393ec7[_0x2f75('0x26')]],'as':_0x393ec7['as'],'attributes':_0x393ec7[_0x2f75('0x22')],'include':_0x393ec7['include']?_[_0x2f75('0x25')](_0x393ec7[_0x2f75('0x24')],function(_0x17e701){return{'model':db[_0x17e701['model']],'as':_0x17e701['as'],'attributes':_0x17e701[_0x2f75('0x22')],'include':_0x17e701['include']?_[_0x2f75('0x25')](_0x17e701[_0x2f75('0x24')],function(_0x5d0f41){return{'model':db[_0x5d0f41[_0x2f75('0x26')]],'as':_0x5d0f41['as'],'attributes':_0x5d0f41[_0x2f75('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16945e){logger[_0x2f75('0x19')](_0x2f75('0x1c'),_0x364755);logger[_0x2f75('0x27')](_0x2f75('0x1c'),_0x364755,JSON[_0x2f75('0x15')](_0x16945e));_0x2ac4a0(_0x16945e);})[_0x2f75('0x1b')](function(_0xdfabda){logger[_0x2f75('0x16')]('GetVoiceQueue',_0xdfabda[_0x2f75('0x18')],_0x364755);_0x452af6(_0xe92d71[_0x2f75('0x16')](0x1f4,_0xdfabda[_0x2f75('0x18')]));});});};exports[_0x2f75('0x28')]=function(_0x33fc6a){var _0x287b60=this;return new Promise(function(_0x51ea76,_0x5b1f80){return db['VoiceQueue'][_0x2f75('0x29')]({'raw':_0x33fc6a[_0x2f75('0x1f')]?_0x33fc6a[_0x2f75('0x1f')][_0x2f75('0x20')]===undefined?!![]:![]:!![],'where':_0x33fc6a['options']?_0x33fc6a['options'][_0x2f75('0x21')]||null:null,'attributes':_0x33fc6a[_0x2f75('0x1f')]?_0x33fc6a['options']['attributes']||null:null,'include':_0x33fc6a['options']?_0x33fc6a[_0x2f75('0x1f')][_0x2f75('0x24')]?_[_0x2f75('0x25')](_0x33fc6a[_0x2f75('0x1f')]['include'],function(_0x2904ba){return{'model':db[_0x2904ba[_0x2f75('0x26')]],'as':_0x2904ba['as'],'attributes':_0x2904ba['attributes'],'include':_0x2904ba[_0x2f75('0x24')]?_[_0x2f75('0x25')](_0x2904ba[_0x2f75('0x24')],function(_0x443b5e){return{'model':db[_0x443b5e['model']],'as':_0x443b5e['as'],'attributes':_0x443b5e[_0x2f75('0x22')],'include':_0x443b5e[_0x2f75('0x24')]?_[_0x2f75('0x25')](_0x443b5e[_0x2f75('0x24')],function(_0x333c77){return{'model':db[_0x333c77['model']],'as':_0x333c77['as'],'attributes':_0x333c77[_0x2f75('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1893df){logger[_0x2f75('0x19')](_0x2f75('0x28'),_0x33fc6a);logger[_0x2f75('0x27')](_0x2f75('0x28'),_0x33fc6a,JSON[_0x2f75('0x15')](_0x1893df));_0x51ea76(_0x1893df);})[_0x2f75('0x1b')](function(_0xd013f5){logger['error'](_0x2f75('0x28'),_0xd013f5['message'],_0x33fc6a);_0x5b1f80(_0x287b60[_0x2f75('0x16')](0x1f4,_0xd013f5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 01bd295..72d5917 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 _0xcedf=['update','emit','register','length','voiceQueue:','save','remove'];(function(_0x3cc2d3,_0x52ea15){var _0x4f3a36=function(_0x4f6003){while(--_0x4f6003){_0x3cc2d3['push'](_0x3cc2d3['shift']());}};_0x4f3a36(++_0x52ea15);}(_0xcedf,0x12b));var _0xfced=function(_0x5440d0,_0x2627df){_0x5440d0=_0x5440d0-0x0;var _0x3364e4=_0xcedf[_0x5440d0];return _0x3364e4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xfced('0x0'),_0xfced('0x1'),_0xfced('0x2')];function createListener(_0x3aa598,_0x3bf66b){return function(_0x3f39c3){_0x3bf66b[_0xfced('0x3')](_0x3aa598,_0x3f39c3);};}function removeListener(_0x242f79,_0x3996c0){return function(){VoiceQueueEvents['removeListener'](_0x242f79,_0x3996c0);};}exports[_0xfced('0x4')]=function(_0x44c39d){for(var _0x914e15=0x0,_0x75f33d=events[_0xfced('0x5')];_0x914e15<_0x75f33d;_0x914e15++){var _0x57506c=events[_0x914e15];var _0x32755d=createListener(_0xfced('0x6')+_0x57506c,_0x44c39d);VoiceQueueEvents['on'](_0x57506c,_0x32755d);}}; \ No newline at end of file +var _0xa84e=['./voiceQueue.events','remove','emit','removeListener','register','length','voiceQueue:'];(function(_0x487eb0,_0x4ca69c){var _0x360818=function(_0xd6ca1){while(--_0xd6ca1){_0x487eb0['push'](_0x487eb0['shift']());}};_0x360818(++_0x4ca69c);}(_0xa84e,0x16c));var _0xea84=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0xa84e[_0x51bb38];return _0x51c09b;};'use strict';var VoiceQueueEvents=require(_0xea84('0x0'));var events=['save',_0xea84('0x1'),'update'];function createListener(_0x5c07a4,_0x3d205c){return function(_0x2a3415){_0x3d205c[_0xea84('0x2')](_0x5c07a4,_0x2a3415);};}function removeListener(_0x5b0c13,_0x4c35ec){return function(){VoiceQueueEvents[_0xea84('0x3')](_0x5b0c13,_0x4c35ec);};}exports[_0xea84('0x4')]=function(_0x4db101){for(var _0x1604dc=0x0,_0x44f937=events[_0xea84('0x5')];_0x1604dc<_0x44f937;_0x1604dc++){var _0x40885e=events[_0x1604dc];var _0x3731b3=createListener(_0xea84('0x6')+_0x40885e,_0x4db101);VoiceQueueEvents['on'](_0x40885e,_0x3731b3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 85a2946..fec766d 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 _0xf0ef=['isAuthenticated','/index','getVoiceQueuesReport','/:id','show','create','put','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xf0ef,0x1a9));var _0xff0e=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0xf0ef[_0x18b191];return _0x43e146;};'use strict';var multer=require('multer');var util=require(_0xff0e('0x0'));var path=require('path');var timeout=require(_0xff0e('0x1'));var express=require('express');var router=express[_0xff0e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xff0e('0x3'));var interaction=require(_0xff0e('0x4'));var config=require('../../config/environment');var controller=require(_0xff0e('0x5'));router[_0xff0e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff0e('0x6')]('/describe',auth[_0xff0e('0x7')](),controller['describe']);router[_0xff0e('0x6')](_0xff0e('0x8'),auth[_0xff0e('0x7')](),controller[_0xff0e('0x9')]);router['get'](_0xff0e('0xa'),auth['isAuthenticated'](),controller[_0xff0e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff0e('0xc')]);router[_0xff0e('0xd')](_0xff0e('0xa'),auth[_0xff0e('0x7')](),controller['update']);router['delete']('/:id',auth[_0xff0e('0x7')](),controller[_0xff0e('0xe')]);module[_0xff0e('0xf')]=router; \ No newline at end of file +var _0x5367=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x247dc6,_0x2356a7){var _0x3b0b80=function(_0x1bfaa1){while(--_0x1bfaa1){_0x247dc6['push'](_0x247dc6['shift']());}};_0x3b0b80(++_0x2356a7);}(_0x5367,0x6e));var _0x7536=function(_0x574d7d,_0x3ec17b){_0x574d7d=_0x574d7d-0x0;var _0x2aa234=_0x5367[_0x574d7d];return _0x2aa234;};'use strict';var multer=require(_0x7536('0x0'));var util=require(_0x7536('0x1'));var path=require(_0x7536('0x2'));var timeout=require('connect-timeout');var express=require(_0x7536('0x3'));var router=express[_0x7536('0x4')]();var fs_extra=require(_0x7536('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7536('0x6'));var config=require('../../config/environment');var controller=require(_0x7536('0x7'));router[_0x7536('0x8')]('/',auth[_0x7536('0x9')](),controller[_0x7536('0xa')]);router[_0x7536('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7536('0xb')]);router[_0x7536('0x8')]('/index',auth[_0x7536('0x9')](),controller[_0x7536('0xc')]);router[_0x7536('0x8')](_0x7536('0xd'),auth['isAuthenticated'](),controller[_0x7536('0xe')]);router[_0x7536('0xf')]('/',auth['isAuthenticated'](),controller[_0x7536('0x10')]);router[_0x7536('0x11')](_0x7536('0xd'),auth['isAuthenticated'](),controller[_0x7536('0x12')]);router[_0x7536('0x13')]('/:id',auth[_0x7536('0x9')](),controller[_0x7536('0x14')]);module[_0x7536('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index efb53fa..edd0274 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 _0xa282=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x2363b1,_0x442198){var _0x1dc992=function(_0x387e87){while(--_0x387e87){_0x2363b1['push'](_0x2363b1['shift']());}};_0x1dc992(++_0x442198);}(_0xa282,0x8f));var _0x2a28=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa282[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a28('0x0'));module[_0x2a28('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2a28('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a28('0x2')]},'queue':{'type':Sequelize[_0x2a28('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x2a28('0x3')],'set':function(_0x4abf39){var _0x44bc0d=moment(_0x4abf39);var _0x4ee0aa=moment(this[_0x2a28('0x4')](_0x2a28('0x5')))[_0x2a28('0x6')](_0x2a28('0x7'));var _0x5ed41f=_0x44bc0d[_0x2a28('0x8')](_0x4ee0aa,_0x2a28('0x9'));this[_0x2a28('0xa')](_0x2a28('0xb'),_0x4abf39);this['setDataValue'](_0x2a28('0xc'),_0x5ed41f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2a28('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2a28('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2a28('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2a28('0x2')]},'context':{'type':Sequelize[_0x2a28('0x2')]},'exten':{'type':Sequelize[_0x2a28('0x2')]},'priority':{'type':Sequelize[_0x2a28('0x2')]},'holdtime':{'type':Sequelize[_0x2a28('0xd')]},'mohtime':{'type':Sequelize[_0x2a28('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2a28('0x2')],'comment':_0x2a28('0xf')},'transferexten':{'type':Sequelize[_0x2a28('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2a28('0x2')]},'secondDisposition':{'type':Sequelize[_0x2a28('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2a28('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2a28('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4932=['setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x376511,_0x4d57f0){var _0x167310=function(_0x31114f){while(--_0x31114f){_0x376511['push'](_0x376511['shift']());}};_0x167310(++_0x4d57f0);}(_0x4932,0x1aa));var _0x2493=function(_0x5e48b4,_0x2e63f5){_0x5e48b4=_0x5e48b4-0x0;var _0x1c2cec=_0x4932[_0x5e48b4];return _0x1c2cec;};'use strict';var Sequelize=require(_0x2493('0x0'));var moment=require(_0x2493('0x1'));module['exports']={'type':{'type':Sequelize[_0x2493('0x2')]},'uniqueid':{'type':Sequelize[_0x2493('0x2')]},'calleridnum':{'type':Sequelize[_0x2493('0x2')]},'calleridname':{'type':Sequelize[_0x2493('0x2')]},'queue':{'type':Sequelize[_0x2493('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2493('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x340a78){var _0x3b3a60=moment(_0x340a78);var _0xd0a5a2=moment(this[_0x2493('0x4')](_0x2493('0x5')))['format'](_0x2493('0x6'));var _0x4c7974=_0x3b3a60[_0x2493('0x7')](_0xd0a5a2,_0x2493('0x8'));this[_0x2493('0x9')]('queuecallerleaveAt',_0x340a78);this['setDataValue'](_0x2493('0xa'),_0x4c7974||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2493('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x2493('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2493('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2493('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2493('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2493('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x2493('0xd')},'originalposition':{'type':Sequelize[_0x2493('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2493('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2493('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x2493('0xb')]},'mohtime':{'type':Sequelize[_0x2493('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2493('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2493('0x2')]},'transfer':{'type':Sequelize[_0x2493('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2493('0x2')],'comment':_0x2493('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2493('0x2')]},'disposition':{'type':Sequelize[_0x2493('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2493('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 1dcb90d..a99e736 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 _0xdfdc=['VoiceQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','findAll','catch','show','params','length','include','find','create','body','describe','filter','includeAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','stack','name','send'];(function(_0x2ec658,_0x2967ae){var _0x1e0e2f=function(_0x4ebf4e){while(--_0x4ebf4e){_0x2ec658['push'](_0x2ec658['shift']());}};_0x1e0e2f(++_0x2967ae);}(_0xdfdc,0xc7));var _0xcdfd=function(_0x3e0228,_0x4afdad){_0x3e0228=_0x3e0228-0x0;var _0x548109=_0xdfdc[_0x3e0228];return _0x548109;};'use strict';var emlformat=require(_0xcdfd('0x0'));var rimraf=require(_0xcdfd('0x1'));var zipdir=require(_0xcdfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x4'));var util=require(_0xcdfd('0x5'));var path=require(_0xcdfd('0x6'));var sox=require(_0xcdfd('0x7'));var csv=require('to-csv');var ejs=require(_0xcdfd('0x8'));var fs=require('fs');var fs_extra=require(_0xcdfd('0x9'));var _=require(_0xcdfd('0xa'));var squel=require(_0xcdfd('0xb'));var crypto=require('crypto');var jsforce=require(_0xcdfd('0xc'));var deskjs=require(_0xcdfd('0xd'));var toCsv=require(_0xcdfd('0xe'));var querystring=require('querystring');var Papa=require(_0xcdfd('0xf'));var Redis=require(_0xcdfd('0x10'));var authService=require(_0xcdfd('0x11'));var qs=require(_0xcdfd('0x12'));var as=require(_0xcdfd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdfd('0x14'))(_0xcdfd('0x15'));var utils=require(_0xcdfd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcdfd('0x17'));var db=require('../../mysqldb')['db'];config[_0xcdfd('0x18')]=_[_0xcdfd('0x19')](config[_0xcdfd('0x18')],{'host':_0xcdfd('0x1a'),'port':0x18eb});var socket=require(_0xcdfd('0x1b'))(new Redis(config[_0xcdfd('0x18')]));require(_0xcdfd('0x1c'))[_0xcdfd('0x1d')](socket);function respondWithStatusCode(_0x142f77,_0x8e0a60){_0x8e0a60=_0x8e0a60||0xcc;return function(_0xd44cd2){if(_0xd44cd2){return _0x142f77[_0xcdfd('0x1e')](_0x8e0a60);}return _0x142f77['status'](_0x8e0a60)['end']();};}function respondWithResult(_0x4a67e7,_0x5a9f7e){_0x5a9f7e=_0x5a9f7e||0xc8;return function(_0x48d2cc){if(_0x48d2cc){return _0x4a67e7[_0xcdfd('0x1f')](_0x5a9f7e)[_0xcdfd('0x20')](_0x48d2cc);}};}function respondWithFilteredResult(_0x4b6b59,_0x5dad58){return function(_0x494e10){if(_0x494e10){var _0x5b7f4f=typeof _0x5dad58[_0xcdfd('0x21')]===_0xcdfd('0x22')&&typeof _0x5dad58[_0xcdfd('0x23')]===_0xcdfd('0x22');var _0x409d58=_0x494e10[_0xcdfd('0x24')];var _0x4bdb86=_0x5b7f4f?0x0:_0x5dad58[_0xcdfd('0x21')];var _0xf42b4f=_0x5b7f4f?_0x494e10[_0xcdfd('0x24')]:_0x5dad58['offset']+_0x5dad58['limit'];var _0x2dd1d5;if(_0xf42b4f>=_0x409d58){_0xf42b4f=_0x409d58;_0x2dd1d5=0xc8;}else{_0x2dd1d5=0xce;}_0x4b6b59[_0xcdfd('0x1f')](_0x2dd1d5);return _0x4b6b59[_0xcdfd('0x25')](_0xcdfd('0x26'),_0x4bdb86+'-'+_0xf42b4f+'/'+_0x409d58)['json'](_0x494e10);}return null;};}function patchUpdates(_0x1782ba){return function(_0x5808fe){try{jsonpatch['apply'](_0x5808fe,_0x1782ba,!![]);}catch(_0xacfae8){return BPromise[_0xcdfd('0x27')](_0xacfae8);}return _0x5808fe['save']();};}function saveUpdates(_0x2468ce,_0x5d012e){return function(_0x58935b){if(_0x58935b){return _0x58935b[_0xcdfd('0x28')](_0x2468ce)[_0xcdfd('0x29')](function(_0x558942){return _0x558942;});}return null;};}function removeEntity(_0x22b4b9,_0x365a91){return function(_0x332675){if(_0x332675){return _0x332675[_0xcdfd('0x2a')]()[_0xcdfd('0x29')](function(){_0x22b4b9[_0xcdfd('0x1f')](0xcc)[_0xcdfd('0x2b')]();});}};}function handleEntityNotFound(_0x39b8be,_0xa1a816){return function(_0x5bae89){if(!_0x5bae89){_0x39b8be[_0xcdfd('0x1e')](0x194);}return _0x5bae89;};}function handleError(_0x3eac6f,_0x286fbc){_0x286fbc=_0x286fbc||0x1f4;return function(_0x5a3fd7){logger['error'](_0x5a3fd7[_0xcdfd('0x2c')]);if(_0x5a3fd7[_0xcdfd('0x2d')]){delete _0x5a3fd7[_0xcdfd('0x2d')];}_0x3eac6f[_0xcdfd('0x1f')](_0x286fbc)[_0xcdfd('0x2e')](_0x5a3fd7);};}exports['index']=function(_0x88ebe0,_0x3391b8){var _0x1a0914={},_0x1f594a={},_0x555990={'count':0x0,'rows':[]};var _0x3214a9=_['map'](db[_0xcdfd('0x2f')][_0xcdfd('0x30')],function(_0x352791){return{'name':_0x352791[_0xcdfd('0x31')],'type':_0x352791[_0xcdfd('0x32')][_0xcdfd('0x33')]};});_0x1f594a['model']=_[_0xcdfd('0x34')](_0x3214a9,_0xcdfd('0x2d'));_0x1f594a[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x88ebe0[_0xcdfd('0x35')]);_0x1f594a['filters']=_[_0xcdfd('0x37')](_0x1f594a[_0xcdfd('0x38')],_0x1f594a[_0xcdfd('0x35')]);_0x1a0914[_0xcdfd('0x39')]=_[_0xcdfd('0x37')](_0x1f594a[_0xcdfd('0x38')],qs[_0xcdfd('0x3a')](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x1a0914[_0xcdfd('0x39')]=_0x1a0914[_0xcdfd('0x39')]['length']?_0x1a0914[_0xcdfd('0x39')]:_0x1f594a['model'];if(!_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x3b')](_0xcdfd('0x3c'))){_0x1a0914[_0xcdfd('0x23')]=qs['limit'](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x1a0914[_0xcdfd('0x21')]=qs[_0xcdfd('0x21')](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x21')]);}_0x1a0914[_0xcdfd('0x3d')]=qs[_0xcdfd('0x3e')](_0x88ebe0[_0xcdfd('0x35')]['sort']);_0x1a0914[_0xcdfd('0x3f')]=qs[_0xcdfd('0x40')](_[_0xcdfd('0x41')](_0x88ebe0[_0xcdfd('0x35')],_0x1f594a[_0xcdfd('0x40')]),_0x3214a9);if(_0x88ebe0[_0xcdfd('0x35')]['filter']){_0x1a0914[_0xcdfd('0x3f')]=_[_0xcdfd('0x42')](_0x1a0914[_0xcdfd('0x3f')],{'$or':_['map'](_0x3214a9,function(_0x296e1f){if(_0x296e1f[_0xcdfd('0x32')]!==_0xcdfd('0x43')){var _0x2f8242={};_0x2f8242[_0x296e1f[_0xcdfd('0x2d')]]={'$like':'%'+_0x88ebe0[_0xcdfd('0x35')]['filter']+'%'};return _0x2f8242;}})});}_0x1a0914=_[_0xcdfd('0x42')]({},_0x1a0914,_0x88ebe0[_0xcdfd('0x44')]);var _0x254a97={'where':_0x1a0914[_0xcdfd('0x3f')]};return db[_0xcdfd('0x2f')]['count'](_0x254a97)['then'](function(_0x4f34e0){_0x555990[_0xcdfd('0x24')]=_0x4f34e0;if(_0x88ebe0[_0xcdfd('0x35')]['includeAll']){_0x1a0914['include']=[{'all':!![]}];}return db[_0xcdfd('0x2f')][_0xcdfd('0x45')](_0x1a0914);})[_0xcdfd('0x29')](function(_0x25239d){_0x555990['rows']=_0x25239d;return _0x555990;})[_0xcdfd('0x29')](respondWithFilteredResult(_0x3391b8,_0x1a0914))[_0xcdfd('0x46')](handleError(_0x3391b8,null));};exports[_0xcdfd('0x47')]=function(_0x42eb1d,_0x64645a){var _0x568e00={'raw':![],'where':{'id':_0x42eb1d[_0xcdfd('0x48')]['id']}},_0x57de79={};_0x57de79[_0xcdfd('0x38')]=_[_0xcdfd('0x36')](db[_0xcdfd('0x2f')][_0xcdfd('0x30')]);_0x57de79[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x42eb1d[_0xcdfd('0x35')]);_0x57de79[_0xcdfd('0x40')]=_[_0xcdfd('0x37')](_0x57de79['model'],_0x57de79['query']);_0x568e00[_0xcdfd('0x39')]=_['intersection'](_0x57de79[_0xcdfd('0x38')],qs[_0xcdfd('0x3a')](_0x42eb1d[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x568e00[_0xcdfd('0x39')]=_0x568e00[_0xcdfd('0x39')][_0xcdfd('0x49')]?_0x568e00['attributes']:_0x57de79[_0xcdfd('0x38')];if(_0x42eb1d['query']['includeAll']){_0x568e00[_0xcdfd('0x4a')]=[{'all':!![]}];}_0x568e00=_[_0xcdfd('0x42')]({},_0x568e00,_0x42eb1d['options']);return db['VoiceQueueReport'][_0xcdfd('0x4b')](_0x568e00)['then'](handleEntityNotFound(_0x64645a,null))[_0xcdfd('0x29')](respondWithResult(_0x64645a,null))['catch'](handleError(_0x64645a,null));};exports[_0xcdfd('0x4c')]=function(_0x27c28b,_0x4cf18d){return db['VoiceQueueReport'][_0xcdfd('0x4c')](_0x27c28b[_0xcdfd('0x4d')],{})[_0xcdfd('0x29')](respondWithResult(_0x4cf18d,0xc9))[_0xcdfd('0x46')](handleError(_0x4cf18d,null));};exports[_0xcdfd('0x28')]=function(_0x4cd8c3,_0x229fa4){if(_0x4cd8c3['body']['id']){delete _0x4cd8c3[_0xcdfd('0x4d')]['id'];}return db[_0xcdfd('0x2f')]['find']({'where':{'id':_0x4cd8c3[_0xcdfd('0x48')]['id']}})['then'](handleEntityNotFound(_0x229fa4,null))[_0xcdfd('0x29')](saveUpdates(_0x4cd8c3[_0xcdfd('0x4d')],null))['then'](respondWithResult(_0x229fa4,null))[_0xcdfd('0x46')](handleError(_0x229fa4,null));};exports[_0xcdfd('0x2a')]=function(_0x4efe8e,_0x3d69a8){return db['VoiceQueueReport'][_0xcdfd('0x4b')]({'where':{'id':_0x4efe8e[_0xcdfd('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d69a8,null))[_0xcdfd('0x29')](removeEntity(_0x3d69a8,null))['catch'](handleError(_0x3d69a8,null));};exports[_0xcdfd('0x4e')]=function(_0x221134,_0x56323f){return db[_0xcdfd('0x2f')]['describe']()[_0xcdfd('0x29')](respondWithResult(_0x56323f,null))[_0xcdfd('0x46')](handleError(_0x56323f,null));};exports['getVoiceQueuesReport']=function(_0x367eee,_0x3425c3){var _0x105054={},_0x47f223={},_0x770ea8={'count':0x0,'rows':[]};_0x47f223['model']=_[_0xcdfd('0x36')](db[_0xcdfd('0x2f')][_0xcdfd('0x30')]);_0x47f223[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x367eee['query']);_0x47f223[_0xcdfd('0x40')]=_[_0xcdfd('0x37')](_0x47f223[_0xcdfd('0x38')],_0x47f223['query']);_0x105054[_0xcdfd('0x39')]=_[_0xcdfd('0x37')](_0x47f223['model'],qs[_0xcdfd('0x3a')](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x105054['attributes']=_0x105054[_0xcdfd('0x39')][_0xcdfd('0x49')]?_0x105054['attributes']:_0x47f223['model'];if(!_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x3b')](_0xcdfd('0x3c'))){_0x105054[_0xcdfd('0x23')]=qs['limit'](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x105054[_0xcdfd('0x21')]=qs[_0xcdfd('0x21')](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x21')]);}_0x105054[_0xcdfd('0x3d')]=qs['sort'](_0x367eee['query'][_0xcdfd('0x3e')]);_0x105054[_0xcdfd('0x3f')]=qs['filters'](_[_0xcdfd('0x41')](_0x367eee[_0xcdfd('0x35')],_0x47f223[_0xcdfd('0x40')]));if(_0x367eee['query'][_0xcdfd('0x4f')]){_0x105054[_0xcdfd('0x3f')]=_[_0xcdfd('0x42')](_0x105054[_0xcdfd('0x3f')],{'$or':_[_0xcdfd('0x34')](_0x105054[_0xcdfd('0x39')],function(_0xb6bdab){var _0x2761c4={};_0x2761c4[_0xb6bdab]={'$like':'%'+_0x367eee[_0xcdfd('0x35')]['filter']+'%'};return _0x2761c4;})});}_0x105054=_[_0xcdfd('0x42')]({},_0x105054,_0x367eee[_0xcdfd('0x44')]);var _0x38c24a={'where':_0x105054[_0xcdfd('0x3f')]};return db[_0xcdfd('0x2f')]['count'](_0x38c24a)[_0xcdfd('0x29')](function(_0x1447bc){_0x770ea8['count']=_0x1447bc;if(_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x50')]){_0x105054['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xcdfd('0x45')](_0x105054);})[_0xcdfd('0x29')](function(_0x50ffd6){_0x770ea8['rows']=_0x50ffd6;return _0x770ea8;})[_0xcdfd('0x29')](respondWithFilteredResult(_0x3425c3,_0x105054,_0xcdfd('0x51')))[_0xcdfd('0x46')](handleError(_0x3425c3,null,_0xcdfd('0x51')));}; \ No newline at end of file +var _0x936a=['defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','describe','sort','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x42cffa,_0x1e360a){var _0xe98dfd=function(_0xf0caf1){while(--_0xf0caf1){_0x42cffa['push'](_0x42cffa['shift']());}};_0xe98dfd(++_0x1e360a);}(_0x936a,0x1e6));var _0xa936=function(_0x2428da,_0x34fbf2){_0x2428da=_0x2428da-0x0;var _0x3b4d80=_0x936a[_0x2428da];return _0x3b4d80;};'use strict';var emlformat=require(_0xa936('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa936('0x1'));var jsonpatch=require(_0xa936('0x2'));var rp=require(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa936('0x5'));var util=require(_0xa936('0x6'));var path=require(_0xa936('0x7'));var sox=require(_0xa936('0x8'));var csv=require(_0xa936('0x9'));var ejs=require(_0xa936('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa936('0xb'));var squel=require(_0xa936('0xc'));var crypto=require(_0xa936('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa936('0x9'));var querystring=require(_0xa936('0xe'));var Papa=require(_0xa936('0xf'));var Redis=require(_0xa936('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa936('0x11'));var as=require(_0xa936('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa936('0x13'))(_0xa936('0x14'));var utils=require('../../config/utils');var config=require(_0xa936('0x15'));var licenseUtil=require(_0xa936('0x16'));var db=require(_0xa936('0x17'))['db'];config['redis']=_[_0xa936('0x18')](config[_0xa936('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa936('0x1a'))(new Redis(config[_0xa936('0x19')]));require(_0xa936('0x1b'))[_0xa936('0x1c')](socket);function respondWithStatusCode(_0x2fcd30,_0x23d864){_0x23d864=_0x23d864||0xcc;return function(_0x3c98e7){if(_0x3c98e7){return _0x2fcd30['sendStatus'](_0x23d864);}return _0x2fcd30[_0xa936('0x1d')](_0x23d864)[_0xa936('0x1e')]();};}function respondWithResult(_0xc719a6,_0x2ad974){_0x2ad974=_0x2ad974||0xc8;return function(_0x4da637){if(_0x4da637){return _0xc719a6[_0xa936('0x1d')](_0x2ad974)[_0xa936('0x1f')](_0x4da637);}};}function respondWithFilteredResult(_0x10f2a1,_0x31c26f){return function(_0x28c1f2){if(_0x28c1f2){var _0x32b19b=typeof _0x31c26f[_0xa936('0x20')]===_0xa936('0x21')&&typeof _0x31c26f[_0xa936('0x22')]===_0xa936('0x21');var _0x28f615=_0x28c1f2[_0xa936('0x23')];var _0xfac4b4=_0x32b19b?0x0:_0x31c26f[_0xa936('0x20')];var _0x24bfb6=_0x32b19b?_0x28c1f2[_0xa936('0x23')]:_0x31c26f[_0xa936('0x20')]+_0x31c26f[_0xa936('0x22')];var _0x4fc6b0;if(_0x24bfb6>=_0x28f615){_0x24bfb6=_0x28f615;_0x4fc6b0=0xc8;}else{_0x4fc6b0=0xce;}_0x10f2a1['status'](_0x4fc6b0);return _0x10f2a1['set'](_0xa936('0x24'),_0xfac4b4+'-'+_0x24bfb6+'/'+_0x28f615)[_0xa936('0x1f')](_0x28c1f2);}return null;};}function patchUpdates(_0x39f686){return function(_0x14b2f9){try{jsonpatch[_0xa936('0x25')](_0x14b2f9,_0x39f686,!![]);}catch(_0x1432de){return BPromise[_0xa936('0x26')](_0x1432de);}return _0x14b2f9[_0xa936('0x27')]();};}function saveUpdates(_0x4a8d84,_0x1d39e3){return function(_0x50937f){if(_0x50937f){return _0x50937f[_0xa936('0x28')](_0x4a8d84)[_0xa936('0x29')](function(_0x153176){return _0x153176;});}return null;};}function removeEntity(_0x1ec5e9,_0x1a2c34){return function(_0x32a050){if(_0x32a050){return _0x32a050['destroy']()[_0xa936('0x29')](function(){_0x1ec5e9['status'](0xcc)[_0xa936('0x1e')]();});}};}function handleEntityNotFound(_0x59a4d0,_0x387d78){return function(_0x44f60d){if(!_0x44f60d){_0x59a4d0[_0xa936('0x2a')](0x194);}return _0x44f60d;};}function handleError(_0x142bd0,_0x3af956){_0x3af956=_0x3af956||0x1f4;return function(_0x466beb){logger[_0xa936('0x2b')](_0x466beb[_0xa936('0x2c')]);if(_0x466beb['name']){delete _0x466beb[_0xa936('0x2d')];}_0x142bd0[_0xa936('0x1d')](_0x3af956)[_0xa936('0x2e')](_0x466beb);};}exports[_0xa936('0x2f')]=function(_0x5df991,_0x4da53d){var _0x3a4e60={},_0x4ad0d1={},_0xe85756={'count':0x0,'rows':[]};var _0x75e8d=_[_0xa936('0x30')](db[_0xa936('0x31')][_0xa936('0x32')],function(_0x58aa3c){return{'name':_0x58aa3c[_0xa936('0x33')],'type':_0x58aa3c[_0xa936('0x34')][_0xa936('0x35')]};});_0x4ad0d1['model']=_[_0xa936('0x30')](_0x75e8d,'name');_0x4ad0d1['query']=_[_0xa936('0x36')](_0x5df991[_0xa936('0x37')]);_0x4ad0d1[_0xa936('0x38')]=_['intersection'](_0x4ad0d1[_0xa936('0x39')],_0x4ad0d1[_0xa936('0x37')]);_0x3a4e60[_0xa936('0x3a')]=_[_0xa936('0x3b')](_0x4ad0d1[_0xa936('0x39')],qs['fields'](_0x5df991[_0xa936('0x37')][_0xa936('0x3c')]));_0x3a4e60[_0xa936('0x3a')]=_0x3a4e60[_0xa936('0x3a')][_0xa936('0x3d')]?_0x3a4e60[_0xa936('0x3a')]:_0x4ad0d1[_0xa936('0x39')];if(!_0x5df991['query'][_0xa936('0x3e')](_0xa936('0x3f'))){_0x3a4e60['limit']=qs['limit'](_0x5df991['query']['limit']);_0x3a4e60[_0xa936('0x20')]=qs[_0xa936('0x20')](_0x5df991['query'][_0xa936('0x20')]);}_0x3a4e60[_0xa936('0x40')]=qs['sort'](_0x5df991[_0xa936('0x37')]['sort']);_0x3a4e60[_0xa936('0x41')]=qs[_0xa936('0x38')](_[_0xa936('0x42')](_0x5df991['query'],_0x4ad0d1[_0xa936('0x38')]),_0x75e8d);if(_0x5df991[_0xa936('0x37')]['filter']){_0x3a4e60['where']=_['merge'](_0x3a4e60[_0xa936('0x41')],{'$or':_[_0xa936('0x30')](_0x75e8d,function(_0x269fe9){if(_0x269fe9[_0xa936('0x34')]!==_0xa936('0x43')){var _0x1f1d99={};_0x1f1d99[_0x269fe9[_0xa936('0x2d')]]={'$like':'%'+_0x5df991[_0xa936('0x37')][_0xa936('0x44')]+'%'};return _0x1f1d99;}})});}_0x3a4e60=_[_0xa936('0x45')]({},_0x3a4e60,_0x5df991[_0xa936('0x46')]);var _0xd4bb33={'where':_0x3a4e60[_0xa936('0x41')]};return db['VoiceQueueReport']['count'](_0xd4bb33)[_0xa936('0x29')](function(_0x4d2e28){_0xe85756[_0xa936('0x23')]=_0x4d2e28;if(_0x5df991[_0xa936('0x37')][_0xa936('0x47')]){_0x3a4e60['include']=[{'all':!![]}];}return db[_0xa936('0x31')][_0xa936('0x48')](_0x3a4e60);})[_0xa936('0x29')](function(_0x40110c){_0xe85756[_0xa936('0x49')]=_0x40110c;return _0xe85756;})[_0xa936('0x29')](respondWithFilteredResult(_0x4da53d,_0x3a4e60))['catch'](handleError(_0x4da53d,null));};exports[_0xa936('0x4a')]=function(_0x4af2a7,_0x298f20){var _0x1b8e74={'raw':![],'where':{'id':_0x4af2a7[_0xa936('0x4b')]['id']}},_0x48e9ef={};_0x48e9ef[_0xa936('0x39')]=_['keys'](db['VoiceQueueReport'][_0xa936('0x32')]);_0x48e9ef[_0xa936('0x37')]=_['keys'](_0x4af2a7[_0xa936('0x37')]);_0x48e9ef[_0xa936('0x38')]=_[_0xa936('0x3b')](_0x48e9ef[_0xa936('0x39')],_0x48e9ef[_0xa936('0x37')]);_0x1b8e74[_0xa936('0x3a')]=_[_0xa936('0x3b')](_0x48e9ef[_0xa936('0x39')],qs[_0xa936('0x3c')](_0x4af2a7[_0xa936('0x37')][_0xa936('0x3c')]));_0x1b8e74[_0xa936('0x3a')]=_0x1b8e74[_0xa936('0x3a')][_0xa936('0x3d')]?_0x1b8e74['attributes']:_0x48e9ef['model'];if(_0x4af2a7[_0xa936('0x37')][_0xa936('0x47')]){_0x1b8e74[_0xa936('0x4c')]=[{'all':!![]}];}_0x1b8e74=_[_0xa936('0x45')]({},_0x1b8e74,_0x4af2a7[_0xa936('0x46')]);return db[_0xa936('0x31')][_0xa936('0x4d')](_0x1b8e74)[_0xa936('0x29')](handleEntityNotFound(_0x298f20,null))[_0xa936('0x29')](respondWithResult(_0x298f20,null))[_0xa936('0x4e')](handleError(_0x298f20,null));};exports[_0xa936('0x4f')]=function(_0x37234b,_0x2402dc){return db[_0xa936('0x31')]['create'](_0x37234b[_0xa936('0x50')],{})[_0xa936('0x29')](respondWithResult(_0x2402dc,0xc9))['catch'](handleError(_0x2402dc,null));};exports[_0xa936('0x28')]=function(_0x169fd2,_0x421d7d){if(_0x169fd2[_0xa936('0x50')]['id']){delete _0x169fd2['body']['id'];}return db[_0xa936('0x31')][_0xa936('0x4d')]({'where':{'id':_0x169fd2['params']['id']}})[_0xa936('0x29')](handleEntityNotFound(_0x421d7d,null))[_0xa936('0x29')](saveUpdates(_0x169fd2[_0xa936('0x50')],null))[_0xa936('0x29')](respondWithResult(_0x421d7d,null))['catch'](handleError(_0x421d7d,null));};exports[_0xa936('0x51')]=function(_0x562545,_0x40f408){return db[_0xa936('0x31')][_0xa936('0x4d')]({'where':{'id':_0x562545['params']['id']}})[_0xa936('0x29')](handleEntityNotFound(_0x40f408,null))[_0xa936('0x29')](removeEntity(_0x40f408,null))[_0xa936('0x4e')](handleError(_0x40f408,null));};exports[_0xa936('0x52')]=function(_0x3496b7,_0x51eb51){return db['VoiceQueueReport'][_0xa936('0x52')]()[_0xa936('0x29')](respondWithResult(_0x51eb51,null))['catch'](handleError(_0x51eb51,null));};exports['getVoiceQueuesReport']=function(_0x1dff37,_0x1bc0bf){var _0xaaad9f={},_0x48b6c3={},_0x15db92={'count':0x0,'rows':[]};_0x48b6c3[_0xa936('0x39')]=_[_0xa936('0x36')](db[_0xa936('0x31')][_0xa936('0x32')]);_0x48b6c3[_0xa936('0x37')]=_[_0xa936('0x36')](_0x1dff37[_0xa936('0x37')]);_0x48b6c3['filters']=_[_0xa936('0x3b')](_0x48b6c3[_0xa936('0x39')],_0x48b6c3[_0xa936('0x37')]);_0xaaad9f['attributes']=_[_0xa936('0x3b')](_0x48b6c3[_0xa936('0x39')],qs[_0xa936('0x3c')](_0x1dff37[_0xa936('0x37')][_0xa936('0x3c')]));_0xaaad9f[_0xa936('0x3a')]=_0xaaad9f[_0xa936('0x3a')]['length']?_0xaaad9f['attributes']:_0x48b6c3[_0xa936('0x39')];if(!_0x1dff37[_0xa936('0x37')][_0xa936('0x3e')](_0xa936('0x3f'))){_0xaaad9f['limit']=qs[_0xa936('0x22')](_0x1dff37[_0xa936('0x37')][_0xa936('0x22')]);_0xaaad9f[_0xa936('0x20')]=qs[_0xa936('0x20')](_0x1dff37[_0xa936('0x37')]['offset']);}_0xaaad9f['order']=qs['sort'](_0x1dff37['query'][_0xa936('0x53')]);_0xaaad9f[_0xa936('0x41')]=qs[_0xa936('0x38')](_[_0xa936('0x42')](_0x1dff37[_0xa936('0x37')],_0x48b6c3[_0xa936('0x38')]));if(_0x1dff37[_0xa936('0x37')]['filter']){_0xaaad9f[_0xa936('0x41')]=_[_0xa936('0x45')](_0xaaad9f[_0xa936('0x41')],{'$or':_[_0xa936('0x30')](_0xaaad9f[_0xa936('0x3a')],function(_0x2b9de0){var _0x29cd60={};_0x29cd60[_0x2b9de0]={'$like':'%'+_0x1dff37[_0xa936('0x37')][_0xa936('0x44')]+'%'};return _0x29cd60;})});}_0xaaad9f=_[_0xa936('0x45')]({},_0xaaad9f,_0x1dff37[_0xa936('0x46')]);var _0x16f2f3={'where':_0xaaad9f[_0xa936('0x41')]};return db[_0xa936('0x31')][_0xa936('0x23')](_0x16f2f3)[_0xa936('0x29')](function(_0x375084){_0x15db92[_0xa936('0x23')]=_0x375084;if(_0x1dff37['query'][_0xa936('0x47')]){_0xaaad9f[_0xa936('0x4c')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xa936('0x48')](_0xaaad9f);})[_0xa936('0x29')](function(_0x3ef7bf){_0x15db92[_0xa936('0x49')]=_0x3ef7bf;return _0x15db92;})[_0xa936('0x29')](respondWithFilteredResult(_0x1bc0bf,_0xaaad9f,_0xa936('0x54')))[_0xa936('0x4e')](handleError(_0x1bc0bf,null,_0xa936('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index afb393a..0c26d5f 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 _0x6403=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','update','remove','emit'];(function(_0x126b37,_0x5089fa){var _0x40c7b8=function(_0x26ced5){while(--_0x26ced5){_0x126b37['push'](_0x126b37['shift']());}};_0x40c7b8(++_0x5089fa);}(_0x6403,0x1a1));var _0x3640=function(_0xfd5517,_0x468d64){_0xfd5517=_0xfd5517-0x0;var _0x3468c4=_0x6403[_0xfd5517];return _0x3468c4;};'use strict';var EventEmitter=require(_0x3640('0x0'));var VoiceQueueReport=require(_0x3640('0x1'))['db'][_0x3640('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3640('0x3'),'afterDestroy':_0x3640('0x4')};function emitEvent(_0xe9860a){return function(_0x3016a1,_0x18a19b,_0x2a4567){VoiceQueueReportEvents['emit'](_0xe9860a+':'+_0x3016a1['id'],_0x3016a1);VoiceQueueReportEvents[_0x3640('0x5')](_0xe9860a,_0x3016a1);_0x2a4567(null);};}for(var e in events){if(events[_0x3640('0x6')](e)){var event=events[e];VoiceQueueReport[_0x3640('0x7')](e,emitEvent(event));}}module[_0x3640('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9ccd=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hook'];(function(_0x26c358,_0x265af8){var _0x57b00c=function(_0xb5133c){while(--_0xb5133c){_0x26c358['push'](_0x26c358['shift']());}};_0x57b00c(++_0x265af8);}(_0x9ccd,0x1d5));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xd9cc('0x0'));var VoiceQueueReport=require(_0xd9cc('0x1'))['db'][_0xd9cc('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9cc('0x3'),'afterUpdate':_0xd9cc('0x4'),'afterDestroy':_0xd9cc('0x5')};function emitEvent(_0x51089b){return function(_0x1e1d1c,_0x2c3e4c,_0x5d1cd3){VoiceQueueReportEvents[_0xd9cc('0x6')](_0x51089b+':'+_0x1e1d1c['id'],_0x1e1d1c);VoiceQueueReportEvents[_0xd9cc('0x6')](_0x51089b,_0x1e1d1c);_0x5d1cd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xd9cc('0x7')](e,emitEvent(event));}}module[_0xd9cc('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ab3a075..19c28ce 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 _0x864e=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x864e,0x166));var _0xe864=function(_0xbea836,_0x100985){_0xbea836=_0xbea836-0x0;var _0x221a4e=_0x864e[_0xbea836];return _0x221a4e;};'use strict';var _=require(_0xe864('0x0'));var util=require('util');var logger=require(_0xe864('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe864('0x2'));var attributes=require(_0xe864('0x3'));module[_0xe864('0x4')]=function(_0xa9583b,_0x42f9b8){return _0xa9583b[_0xe864('0x5')](_0xe864('0x6'),attributes,{'tableName':_0xe864('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xe864('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb768=['request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2ec316,_0x19f5a3){var _0x27378b=function(_0x29e310){while(--_0x29e310){_0x2ec316['push'](_0x2ec316['shift']());}};_0x27378b(++_0x19f5a3);}(_0xb768,0xaf));var _0x8b76=function(_0x5a2d39,_0x218bbc){_0x5a2d39=_0x5a2d39-0x0;var _0x9c44fa=_0xb768[_0x5a2d39];return _0x9c44fa;};'use strict';var _=require(_0x8b76('0x0'));var util=require(_0x8b76('0x1'));var logger=require(_0x8b76('0x2'))(_0x8b76('0x3'));var moment=require(_0x8b76('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b76('0x5'));var fs=require('fs');var path=require(_0x8b76('0x6'));var rimraf=require(_0x8b76('0x7'));var config=require(_0x8b76('0x8'));var attributes=require(_0x8b76('0x9'));module[_0x8b76('0xa')]=function(_0x351176,_0x31a0f8){return _0x351176[_0x8b76('0xb')](_0x8b76('0xc'),attributes,{'tableName':_0x8b76('0xd'),'paranoid':![],'indexes':[{'fields':[_0x8b76('0xe')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 08fd99c..c00e380 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 _0x4f83=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','raw','options','where','include','model','attributes','map','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e082d,_0x26ce91){var _0x2c4df6=function(_0x241712){while(--_0x241712){_0x4e082d['push'](_0x4e082d['shift']());}};_0x2c4df6(++_0x26ce91);}(_0x4f83,0x78));var _0x34f8=function(_0x594293,_0x77712f){_0x594293=_0x594293-0x0;var _0x20f156=_0x4f83[_0x594293];return _0x20f156;};'use strict';var _=require('lodash');var util=require(_0x34f8('0x0'));var moment=require(_0x34f8('0x1'));var BPromise=require(_0x34f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34f8('0x3'));var db=require(_0x34f8('0x4'))['db'];var utils=require(_0x34f8('0x5'));var logger=require(_0x34f8('0x6'))(_0x34f8('0x7'));var config=require(_0x34f8('0x8'));var jayson=require(_0x34f8('0x9'));var client=jayson[_0x34f8('0xa')]['http']({'port':0x232a});config[_0x34f8('0xb')]=_[_0x34f8('0xc')](config[_0x34f8('0xb')],{'host':_0x34f8('0xd'),'port':0x18eb});var socket=require(_0x34f8('0xe'))(new Redis(config['redis']));require(_0x34f8('0xf'))[_0x34f8('0x10')](socket);function respondWithRpcPromise(_0x5d7f4e,_0x5b91c7,_0x3ce875){return new BPromise(function(_0x25c6e3,_0x3f655c){return client['request'](_0x5d7f4e,_0x3ce875)['then'](function(_0x301573){logger[_0x34f8('0x11')](_0x34f8('0x12'),_0x5b91c7,_0x34f8('0x13'));logger[_0x34f8('0x14')](_0x34f8('0x15'),_0x5b91c7,_0x34f8('0x13'),JSON[_0x34f8('0x16')](_0x301573));if(_0x301573[_0x34f8('0x17')]){if(_0x301573[_0x34f8('0x17')][_0x34f8('0x18')]===0x1f4){logger['error'](_0x34f8('0x12'),_0x5b91c7,_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);return _0x3f655c(_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);}logger[_0x34f8('0x17')](_0x34f8('0x12'),_0x5b91c7,_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);return _0x25c6e3(_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);}else{logger[_0x34f8('0x11')](_0x34f8('0x12'),_0x5b91c7,_0x34f8('0x13'));_0x25c6e3(_0x301573[_0x34f8('0x1a')][_0x34f8('0x19')]);}})[_0x34f8('0x1b')](function(_0x2507a4){logger[_0x34f8('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b91c7,_0x2507a4);_0x3f655c(_0x2507a4);});});}exports[_0x34f8('0x1c')]=function(_0x3559bc){var _0x4d9a36=this;return new Promise(function(_0x1a0f60,_0x4b2625){return db[_0x34f8('0x1d')]['findAll']({'raw':_0x3559bc['options']?_0x3559bc['options'][_0x34f8('0x1e')]===undefined?!![]:![]:!![],'where':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')][_0x34f8('0x20')]||null:null,'attributes':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['attributes']||null:null,'limit':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['limit']||null:null,'include':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['include']?_['map'](_0x3559bc[_0x34f8('0x1f')][_0x34f8('0x21')],function(_0x493619){return{'model':db[_0x493619[_0x34f8('0x22')]],'as':_0x493619['as'],'attributes':_0x493619[_0x34f8('0x23')],'include':_0x493619[_0x34f8('0x21')]?_[_0x34f8('0x24')](_0x493619['include'],function(_0x19ba28){return{'model':db[_0x19ba28['model']],'as':_0x19ba28['as'],'attributes':_0x19ba28[_0x34f8('0x23')],'include':_0x19ba28['include']?_[_0x34f8('0x24')](_0x19ba28[_0x34f8('0x21')],function(_0x4eb3ef){return{'model':db[_0x4eb3ef[_0x34f8('0x22')]],'as':_0x4eb3ef['as'],'attributes':_0x4eb3ef[_0x34f8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x34f8('0x25')](function(_0x4baedd){logger[_0x34f8('0x11')]('GetVoiceQueueReport',_0x3559bc);logger[_0x34f8('0x14')]('GetVoiceQueueReport',_0x3559bc,JSON[_0x34f8('0x16')](_0x4baedd));_0x1a0f60(_0x4baedd);})[_0x34f8('0x1b')](function(_0x4413e4){logger[_0x34f8('0x17')]('GetVoiceQueueReport',_0x4413e4['message'],_0x3559bc);_0x4b2625(_0x4d9a36[_0x34f8('0x17')](0x1f4,_0x4413e4['message']));});});};exports[_0x34f8('0x26')]=function(_0x1dce7){var _0x501467=this;return new Promise(function(_0x1d1a16,_0x2510fb){return db['VoiceQueueReport'][_0x34f8('0x27')](_0x1dce7[_0x34f8('0x28')],{'raw':_0x1dce7[_0x34f8('0x1f')]?_0x1dce7[_0x34f8('0x1f')][_0x34f8('0x1e')]===undefined?!![]:![]:!![]})[_0x34f8('0x25')](function(_0x4a3b06){logger[_0x34f8('0x11')](_0x34f8('0x26'),_0x1dce7);logger[_0x34f8('0x14')]('CreateVoiceQueueReport',_0x1dce7,JSON[_0x34f8('0x16')](_0x4a3b06));_0x1d1a16(_0x4a3b06);})[_0x34f8('0x1b')](function(_0x4bf7f1){logger[_0x34f8('0x17')](_0x34f8('0x26'),_0x4bf7f1[_0x34f8('0x19')],_0x1dce7);_0x2510fb(_0x501467[_0x34f8('0x17')](0x1f4,_0x4bf7f1['message']));});});};exports[_0x34f8('0x29')]=function(_0x59f231){var _0xf3e998=this;return new Promise(function(_0x8dbec6,_0x27376d){return db[_0x34f8('0x1d')]['update'](_0x59f231[_0x34f8('0x28')],{'raw':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x20')]||null:null,'attributes':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x23')]||null:null,'limit':_0x59f231[_0x34f8('0x1f')]?_0x59f231[_0x34f8('0x1f')][_0x34f8('0x2a')]||null:null})[_0x34f8('0x25')](function(_0x211857){logger[_0x34f8('0x11')]('UpdateVoiceQueueReport',_0x59f231);logger[_0x34f8('0x14')]('UpdateVoiceQueueReport',_0x59f231,JSON[_0x34f8('0x16')](_0x211857));_0x8dbec6(_0x211857);})[_0x34f8('0x1b')](function(_0x15bdc1){logger[_0x34f8('0x17')](_0x34f8('0x29'),_0x15bdc1['message'],_0x59f231);_0x27376d(_0xf3e998[_0x34f8('0x17')](0x1f4,_0x15bdc1[_0x34f8('0x19')]));});});}; \ No newline at end of file +var _0x4612=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','limit','map','include','model','CreateVoiceQueueReport','raw','update','body','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x4612,0x1a9));var _0x2461=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4612[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x2461('0x0'));var util=require(_0x2461('0x1'));var moment=require(_0x2461('0x2'));var BPromise=require('bluebird');var rs=require(_0x2461('0x3'));var fs=require('fs');var Redis=require(_0x2461('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2461('0x5'));var logger=require(_0x2461('0x6'))(_0x2461('0x7'));var config=require(_0x2461('0x8'));var jayson=require(_0x2461('0x9'));var client=jayson[_0x2461('0xa')][_0x2461('0xb')]({'port':0x232a});config[_0x2461('0xc')]=_[_0x2461('0xd')](config[_0x2461('0xc')],{'host':_0x2461('0xe'),'port':0x18eb});var socket=require(_0x2461('0xf'))(new Redis(config['redis']));require(_0x2461('0x10'))[_0x2461('0x11')](socket);function respondWithRpcPromise(_0x4aa206,_0xcfc548,_0x57f791){return new BPromise(function(_0x8626f,_0x324f7f){return client[_0x2461('0x12')](_0x4aa206,_0x57f791)[_0x2461('0x13')](function(_0x538aa1){logger[_0x2461('0x14')](_0x2461('0x15'),_0xcfc548,'request\x20sent');logger[_0x2461('0x16')](_0x2461('0x17'),_0xcfc548,'request\x20sent',JSON[_0x2461('0x18')](_0x538aa1));if(_0x538aa1['error']){if(_0x538aa1['error'][_0x2461('0x19')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0xcfc548,_0x538aa1[_0x2461('0x1a')][_0x2461('0x1b')]);return _0x324f7f(_0x538aa1['error'][_0x2461('0x1b')]);}logger['error'](_0x2461('0x15'),_0xcfc548,_0x538aa1[_0x2461('0x1a')][_0x2461('0x1b')]);return _0x8626f(_0x538aa1[_0x2461('0x1a')]['message']);}else{logger['info'](_0x2461('0x15'),_0xcfc548,'request\x20sent');_0x8626f(_0x538aa1['result'][_0x2461('0x1b')]);}})[_0x2461('0x1c')](function(_0x20f09f){logger[_0x2461('0x1a')](_0x2461('0x15'),_0xcfc548,_0x20f09f);_0x324f7f(_0x20f09f);});});}exports[_0x2461('0x1d')]=function(_0x506fbb){var _0x25b288=this;return new Promise(function(_0x3571c5,_0x101332){return db[_0x2461('0x1e')][_0x2461('0x1f')]({'raw':_0x506fbb['options']?_0x506fbb[_0x2461('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x506fbb[_0x2461('0x20')]?_0x506fbb[_0x2461('0x20')]['where']||null:null,'attributes':_0x506fbb[_0x2461('0x20')]?_0x506fbb[_0x2461('0x20')][_0x2461('0x21')]||null:null,'limit':_0x506fbb[_0x2461('0x20')]?_0x506fbb[_0x2461('0x20')][_0x2461('0x22')]||null:null,'include':_0x506fbb[_0x2461('0x20')]?_0x506fbb[_0x2461('0x20')]['include']?_[_0x2461('0x23')](_0x506fbb['options'][_0x2461('0x24')],function(_0x39ef2f){return{'model':db[_0x39ef2f[_0x2461('0x25')]],'as':_0x39ef2f['as'],'attributes':_0x39ef2f[_0x2461('0x21')],'include':_0x39ef2f[_0x2461('0x24')]?_[_0x2461('0x23')](_0x39ef2f['include'],function(_0x49242a){return{'model':db[_0x49242a[_0x2461('0x25')]],'as':_0x49242a['as'],'attributes':_0x49242a[_0x2461('0x21')],'include':_0x49242a[_0x2461('0x24')]?_[_0x2461('0x23')](_0x49242a['include'],function(_0x3571e5){return{'model':db[_0x3571e5[_0x2461('0x25')]],'as':_0x3571e5['as'],'attributes':_0x3571e5[_0x2461('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb3bcbc){logger[_0x2461('0x14')]('GetVoiceQueueReport',_0x506fbb);logger[_0x2461('0x16')](_0x2461('0x1d'),_0x506fbb,JSON['stringify'](_0xb3bcbc));_0x3571c5(_0xb3bcbc);})[_0x2461('0x1c')](function(_0x531138){logger[_0x2461('0x1a')](_0x2461('0x1d'),_0x531138[_0x2461('0x1b')],_0x506fbb);_0x101332(_0x25b288[_0x2461('0x1a')](0x1f4,_0x531138[_0x2461('0x1b')]));});});};exports[_0x2461('0x26')]=function(_0x16e4e1){var _0x27fcd0=this;return new Promise(function(_0x15b306,_0x2d1d19){return db[_0x2461('0x1e')]['create'](_0x16e4e1['body'],{'raw':_0x16e4e1['options']?_0x16e4e1[_0x2461('0x20')][_0x2461('0x27')]===undefined?!![]:![]:!![]})[_0x2461('0x13')](function(_0x202f9a){logger['info']('CreateVoiceQueueReport',_0x16e4e1);logger[_0x2461('0x16')]('CreateVoiceQueueReport',_0x16e4e1,JSON[_0x2461('0x18')](_0x202f9a));_0x15b306(_0x202f9a);})[_0x2461('0x1c')](function(_0x134fbf){logger[_0x2461('0x1a')](_0x2461('0x26'),_0x134fbf[_0x2461('0x1b')],_0x16e4e1);_0x2d1d19(_0x27fcd0['error'](0x1f4,_0x134fbf[_0x2461('0x1b')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1d254c){var _0x2e966c=this;return new Promise(function(_0x4b35b1,_0x3b46c6){return db[_0x2461('0x1e')][_0x2461('0x28')](_0x1d254c[_0x2461('0x29')],{'raw':_0x1d254c['options']?_0x1d254c[_0x2461('0x20')][_0x2461('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d254c[_0x2461('0x20')]?_0x1d254c['options']['where']||null:null,'attributes':_0x1d254c[_0x2461('0x20')]?_0x1d254c[_0x2461('0x20')][_0x2461('0x21')]||null:null,'limit':_0x1d254c[_0x2461('0x20')]?_0x1d254c[_0x2461('0x20')][_0x2461('0x22')]||null:null})['then'](function(_0xb7a046){logger[_0x2461('0x14')](_0x2461('0x2a'),_0x1d254c);logger['debug'](_0x2461('0x2a'),_0x1d254c,JSON[_0x2461('0x18')](_0xb7a046));_0x4b35b1(_0xb7a046);})[_0x2461('0x1c')](function(_0x188768){logger[_0x2461('0x1a')](_0x2461('0x2a'),_0x188768['message'],_0x1d254c);_0x3b46c6(_0x2e966c['error'](0x1f4,_0x188768[_0x2461('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index af99abd..b3bbad5 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 _0xdb94=['voiceQueueReport:','save','remove','emit','removeListener','length'];(function(_0x578201,_0xe5c92d){var _0x4c74f4=function(_0x2336e1){while(--_0x2336e1){_0x578201['push'](_0x578201['shift']());}};_0x4c74f4(++_0xe5c92d);}(_0xdb94,0xe5));var _0x4db9=function(_0x5e0af7,_0x1600eb){_0x5e0af7=_0x5e0af7-0x0;var _0x163ffa=_0xdb94[_0x5e0af7];return _0x163ffa;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4db9('0x0'),_0x4db9('0x1'),'update'];function createListener(_0x26e16b,_0x3b24a6){return function(_0x25b510){_0x3b24a6[_0x4db9('0x2')](_0x26e16b,_0x25b510);};}function removeListener(_0x1f05d4,_0x592097){return function(){VoiceQueueReportEvents[_0x4db9('0x3')](_0x1f05d4,_0x592097);};}exports['register']=function(_0x1d21a8){for(var _0xc76bc1=0x0,_0x1dddb9=events[_0x4db9('0x4')];_0xc76bc1<_0x1dddb9;_0xc76bc1++){var _0x42a857=events[_0xc76bc1];var _0x57c701=createListener(_0x4db9('0x5')+_0x42a857,_0x1d21a8);VoiceQueueReportEvents['on'](_0x42a857,_0x57c701);}}; \ No newline at end of file +var _0xd493=['./voiceQueueReport.events','remove','update','length','voiceQueueReport:'];(function(_0x1ad901,_0x852d9e){var _0x3c0249=function(_0x319eda){while(--_0x319eda){_0x1ad901['push'](_0x1ad901['shift']());}};_0x3c0249(++_0x852d9e);}(_0xd493,0x1bd));var _0x3d49=function(_0x416320,_0x36fb4f){_0x416320=_0x416320-0x0;var _0xfd38ca=_0xd493[_0x416320];return _0xfd38ca;};'use strict';var VoiceQueueReportEvents=require(_0x3d49('0x0'));var events=['save',_0x3d49('0x1'),_0x3d49('0x2')];function createListener(_0x55cb43,_0x4c751d){return function(_0x4a877d){_0x4c751d['emit'](_0x55cb43,_0x4a877d);};}function removeListener(_0x439989,_0xab52eb){return function(){VoiceQueueReportEvents['removeListener'](_0x439989,_0xab52eb);};}exports['register']=function(_0x1550e0){for(var _0x1316f4=0x0,_0x1ef537=events[_0x3d49('0x3')];_0x1316f4<_0x1ef537;_0x1316f4++){var _0x5d3a0a=events[_0x1316f4];var _0x3d2d14=createListener(_0x3d49('0x4')+_0x5d3a0a,_0x1550e0);VoiceQueueReportEvents['on'](_0x5d3a0a,_0x3d2d14);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8c0fd56..e57b612 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 _0xd190=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id'];(function(_0x2e2ba2,_0x1662ed){var _0x16a312=function(_0x500504){while(--_0x500504){_0x2e2ba2['push'](_0x2e2ba2['shift']());}};_0x16a312(++_0x1662ed);}(_0xd190,0xde));var _0x0d19=function(_0x4900e7,_0x3b3f2a){_0x4900e7=_0x4900e7-0x0;var _0x35803d=_0xd190[_0x4900e7];return _0x35803d;};'use strict';var multer=require('multer');var util=require(_0x0d19('0x0'));var path=require('path');var timeout=require(_0x0d19('0x1'));var express=require(_0x0d19('0x2'));var router=express[_0x0d19('0x3')]();var fs_extra=require(_0x0d19('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0d19('0x5'));var config=require(_0x0d19('0x6'));var controller=require(_0x0d19('0x7'));router[_0x0d19('0x8')]('/',auth[_0x0d19('0x9')](),controller[_0x0d19('0xa')]);router[_0x0d19('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0d19('0xb')]);router[_0x0d19('0xc')]('/',auth[_0x0d19('0x9')](),controller[_0x0d19('0xd')]);router[_0x0d19('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0d19('0xf')]);router[_0x0d19('0x10')](_0x0d19('0x11'),auth[_0x0d19('0x9')](),controller[_0x0d19('0x12')]);module[_0x0d19('0x13')]=router; \ No newline at end of file +var _0x616c=['/:id','post','put','destroy','util','path','express','Router','fs-extra','../../components/auth/service','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x58bdca,_0x1204cf){var _0x476770=function(_0x3b18e5){while(--_0x3b18e5){_0x58bdca['push'](_0x58bdca['shift']());}};_0x476770(++_0x1204cf);}(_0x616c,0x1b6));var _0xc616=function(_0x1ebecf,_0x384739){_0x1ebecf=_0x1ebecf-0x0;var _0x522a28=_0x616c[_0x1ebecf];return _0x522a28;};'use strict';var multer=require('multer');var util=require(_0xc616('0x0'));var path=require(_0xc616('0x1'));var timeout=require('connect-timeout');var express=require(_0xc616('0x2'));var router=express[_0xc616('0x3')]();var fs_extra=require(_0xc616('0x4'));var auth=require(_0xc616('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc616('0x6'));router[_0xc616('0x7')]('/',auth[_0xc616('0x8')](),controller[_0xc616('0x9')]);router[_0xc616('0x7')](_0xc616('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc616('0xb')]('/',auth[_0xc616('0x8')](),controller['create']);router[_0xc616('0xc')]('/:id',auth[_0xc616('0x8')](),controller['update']);router['delete'](_0xc616('0xa'),auth[_0xc616('0x8')](),controller[_0xc616('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index da0eefd..98e7c44 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 _0xa1a9=['STRING','format','sequelize'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x265364,_0x3c3b3f){_0x265364=_0x265364-0x0;var _0x3f3e65=_0xa1a9[_0x265364];return _0x3f3e65;};'use strict';var Sequelize=require(_0x9a1a('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x9a1a('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x9a1a('0x2')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x995e=['DATE','format','sequelize','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x995e,0x1b5));var _0xe995=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x995e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe995('0x0'));var moment=require('moment');module[_0xe995('0x1')]={'time':{'type':Sequelize[_0xe995('0x2')]},'callid':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe995('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe995('0x3')],'allowNull':![],'defaultValue':moment()[_0xe995('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 51bfce1..1049557 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 _0x1b84=['then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','includeAll','options','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy'];(function(_0x3a04f9,_0x131c24){var _0x58d308=function(_0x5b42cf){while(--_0x5b42cf){_0x3a04f9['push'](_0x3a04f9['shift']());}};_0x58d308(++_0x131c24);}(_0x1b84,0x151));var _0x41b8=function(_0x4c057b,_0xc46f08){_0x4c057b=_0x4c057b-0x0;var _0x5497b0=_0x1b84[_0x4c057b];return _0x5497b0;};'use strict';var emlformat=require(_0x41b8('0x0'));var rimraf=require(_0x41b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b8('0x2'));var rp=require(_0x41b8('0x3'));var moment=require(_0x41b8('0x4'));var BPromise=require(_0x41b8('0x5'));var Mustache=require(_0x41b8('0x6'));var util=require(_0x41b8('0x7'));var path=require(_0x41b8('0x8'));var sox=require(_0x41b8('0x9'));var csv=require(_0x41b8('0xa'));var ejs=require(_0x41b8('0xb'));var fs=require('fs');var fs_extra=require(_0x41b8('0xc'));var _=require(_0x41b8('0xd'));var squel=require('squel');var crypto=require(_0x41b8('0xe'));var jsforce=require(_0x41b8('0xf'));var deskjs=require(_0x41b8('0x10'));var toCsv=require(_0x41b8('0xa'));var querystring=require('querystring');var Papa=require(_0x41b8('0x11'));var Redis=require(_0x41b8('0x12'));var authService=require(_0x41b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x41b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41b8('0x15'))(_0x41b8('0x16'));var utils=require('../../config/utils');var config=require(_0x41b8('0x17'));var licenseUtil=require(_0x41b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ced65,_0x4e247e){_0x4e247e=_0x4e247e||0xcc;return function(_0x3c123b){if(_0x3c123b){return _0x1ced65[_0x41b8('0x19')](_0x4e247e);}return _0x1ced65[_0x41b8('0x1a')](_0x4e247e)[_0x41b8('0x1b')]();};}function respondWithResult(_0x6c47e,_0x1eaa13){_0x1eaa13=_0x1eaa13||0xc8;return function(_0x417b7d){if(_0x417b7d){return _0x6c47e['status'](_0x1eaa13)[_0x41b8('0x1c')](_0x417b7d);}};}function respondWithFilteredResult(_0x10c005,_0x4a5454){return function(_0xeb061d){if(_0xeb061d){var _0x2b7f49=typeof _0x4a5454[_0x41b8('0x1d')]===_0x41b8('0x1e')&&typeof _0x4a5454[_0x41b8('0x1f')]===_0x41b8('0x1e');var _0x121370=_0xeb061d[_0x41b8('0x20')];var _0x5abc23=_0x2b7f49?0x0:_0x4a5454[_0x41b8('0x1d')];var _0x57f173=_0x2b7f49?_0xeb061d[_0x41b8('0x20')]:_0x4a5454[_0x41b8('0x1d')]+_0x4a5454[_0x41b8('0x1f')];var _0x211adf;if(_0x57f173>=_0x121370){_0x57f173=_0x121370;_0x211adf=0xc8;}else{_0x211adf=0xce;}_0x10c005['status'](_0x211adf);return _0x10c005[_0x41b8('0x21')](_0x41b8('0x22'),_0x5abc23+'-'+_0x57f173+'/'+_0x121370)['json'](_0xeb061d);}return null;};}function patchUpdates(_0x25ec32){return function(_0x5048c5){try{jsonpatch['apply'](_0x5048c5,_0x25ec32,!![]);}catch(_0x5664fa){return BPromise[_0x41b8('0x23')](_0x5664fa);}return _0x5048c5['save']();};}function saveUpdates(_0x470e96,_0x3b773c){return function(_0x8dc0eb){if(_0x8dc0eb){return _0x8dc0eb[_0x41b8('0x24')](_0x470e96)['then'](function(_0x2b0f79){return _0x2b0f79;});}return null;};}function removeEntity(_0x586ffa,_0x39d3d0){return function(_0x24609d){if(_0x24609d){return _0x24609d[_0x41b8('0x25')]()[_0x41b8('0x26')](function(){_0x586ffa[_0x41b8('0x1a')](0xcc)[_0x41b8('0x1b')]();});}};}function handleEntityNotFound(_0x43299b,_0x41865d){return function(_0x1855db){if(!_0x1855db){_0x43299b[_0x41b8('0x19')](0x194);}return _0x1855db;};}function handleError(_0x1cc1ae,_0x566b61){_0x566b61=_0x566b61||0x1f4;return function(_0x28b004){logger[_0x41b8('0x27')](_0x28b004['stack']);if(_0x28b004[_0x41b8('0x28')]){delete _0x28b004[_0x41b8('0x28')];}_0x1cc1ae[_0x41b8('0x1a')](_0x566b61)[_0x41b8('0x29')](_0x28b004);};}exports[_0x41b8('0x2a')]=function(_0x3b879d,_0x46f06){var _0x4a6677={},_0x3fc9dd={},_0x5df248={'count':0x0,'rows':[]};var _0x188c6f=_[_0x41b8('0x2b')](db[_0x41b8('0x2c')][_0x41b8('0x2d')],function(_0x3a546c){return{'name':_0x3a546c[_0x41b8('0x2e')],'type':_0x3a546c[_0x41b8('0x2f')][_0x41b8('0x30')]};});_0x3fc9dd[_0x41b8('0x31')]=_[_0x41b8('0x2b')](_0x188c6f,_0x41b8('0x28'));_0x3fc9dd[_0x41b8('0x32')]=_[_0x41b8('0x33')](_0x3b879d[_0x41b8('0x32')]);_0x3fc9dd[_0x41b8('0x34')]=_[_0x41b8('0x35')](_0x3fc9dd[_0x41b8('0x31')],_0x3fc9dd[_0x41b8('0x32')]);_0x4a6677[_0x41b8('0x36')]=_['intersection'](_0x3fc9dd[_0x41b8('0x31')],qs['fields'](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x37')]));_0x4a6677[_0x41b8('0x36')]=_0x4a6677[_0x41b8('0x36')][_0x41b8('0x38')]?_0x4a6677[_0x41b8('0x36')]:_0x3fc9dd[_0x41b8('0x31')];if(!_0x3b879d[_0x41b8('0x32')]['hasOwnProperty'](_0x41b8('0x39'))){_0x4a6677[_0x41b8('0x1f')]=qs[_0x41b8('0x1f')](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x1f')]);_0x4a6677[_0x41b8('0x1d')]=qs['offset'](_0x3b879d[_0x41b8('0x32')]['offset']);}_0x4a6677[_0x41b8('0x3a')]=qs[_0x41b8('0x3b')](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x3b')]);_0x4a6677[_0x41b8('0x3c')]=qs[_0x41b8('0x34')](_[_0x41b8('0x3d')](_0x3b879d[_0x41b8('0x32')],_0x3fc9dd[_0x41b8('0x34')]),_0x188c6f);if(_0x3b879d['query'][_0x41b8('0x3e')]){_0x4a6677[_0x41b8('0x3c')]=_[_0x41b8('0x3f')](_0x4a6677[_0x41b8('0x3c')],{'$or':_['map'](_0x188c6f,function(_0x15fbdc){if(_0x15fbdc[_0x41b8('0x2f')]!==_0x41b8('0x40')){var _0x43fb89={};_0x43fb89[_0x15fbdc['name']]={'$like':'%'+_0x3b879d['query'][_0x41b8('0x3e')]+'%'};return _0x43fb89;}})});}_0x4a6677=_[_0x41b8('0x3f')]({},_0x4a6677,_0x3b879d['options']);var _0x2ac25c={'where':_0x4a6677['where']};return db['VoiceQueuesLog'][_0x41b8('0x20')](_0x2ac25c)['then'](function(_0x54843c){_0x5df248[_0x41b8('0x20')]=_0x54843c;if(_0x3b879d[_0x41b8('0x32')]['includeAll']){_0x4a6677[_0x41b8('0x41')]=[{'all':!![]}];}return db[_0x41b8('0x2c')][_0x41b8('0x42')](_0x4a6677);})[_0x41b8('0x26')](function(_0xbd687d){_0x5df248[_0x41b8('0x43')]=_0xbd687d;return _0x5df248;})[_0x41b8('0x26')](respondWithFilteredResult(_0x46f06,_0x4a6677))['catch'](handleError(_0x46f06,null));};exports[_0x41b8('0x44')]=function(_0x59e17c,_0x3ae7b8){var _0x44c7e4={'raw':!![],'where':{'id':_0x59e17c['params']['id']}},_0x491fff={};_0x491fff[_0x41b8('0x31')]=_[_0x41b8('0x33')](db['VoiceQueuesLog'][_0x41b8('0x2d')]);_0x491fff['query']=_[_0x41b8('0x33')](_0x59e17c['query']);_0x491fff['filters']=_[_0x41b8('0x35')](_0x491fff[_0x41b8('0x31')],_0x491fff[_0x41b8('0x32')]);_0x44c7e4[_0x41b8('0x36')]=_['intersection'](_0x491fff[_0x41b8('0x31')],qs['fields'](_0x59e17c[_0x41b8('0x32')][_0x41b8('0x37')]));_0x44c7e4[_0x41b8('0x36')]=_0x44c7e4[_0x41b8('0x36')][_0x41b8('0x38')]?_0x44c7e4[_0x41b8('0x36')]:_0x491fff[_0x41b8('0x31')];if(_0x59e17c[_0x41b8('0x32')][_0x41b8('0x45')]){_0x44c7e4[_0x41b8('0x41')]=[{'all':!![]}];}_0x44c7e4=_[_0x41b8('0x3f')]({},_0x44c7e4,_0x59e17c[_0x41b8('0x46')]);return db[_0x41b8('0x2c')][_0x41b8('0x47')](_0x44c7e4)[_0x41b8('0x26')](handleEntityNotFound(_0x3ae7b8,null))['then'](respondWithResult(_0x3ae7b8,null))['catch'](handleError(_0x3ae7b8,null));};exports['create']=function(_0x502a71,_0x433f8a){return db[_0x41b8('0x2c')][_0x41b8('0x48')](_0x502a71[_0x41b8('0x49')],{})[_0x41b8('0x26')](respondWithResult(_0x433f8a,0xc9))[_0x41b8('0x4a')](handleError(_0x433f8a,null));};exports[_0x41b8('0x24')]=function(_0x17b0c2,_0x2247ce){if(_0x17b0c2['body']['id']){delete _0x17b0c2[_0x41b8('0x49')]['id'];}return db[_0x41b8('0x2c')]['find']({'where':{'id':_0x17b0c2['params']['id']}})[_0x41b8('0x26')](handleEntityNotFound(_0x2247ce,null))[_0x41b8('0x26')](saveUpdates(_0x17b0c2[_0x41b8('0x49')],null))['then'](respondWithResult(_0x2247ce,null))[_0x41b8('0x4a')](handleError(_0x2247ce,null));};exports['destroy']=function(_0x545949,_0x3304d0){return db[_0x41b8('0x2c')][_0x41b8('0x47')]({'where':{'id':_0x545949['params']['id']}})[_0x41b8('0x26')](handleEntityNotFound(_0x3304d0,null))[_0x41b8('0x26')](removeEntity(_0x3304d0,null))[_0x41b8('0x4a')](handleError(_0x3304d0,null));}; \ No newline at end of file +var _0x1e8d=['fields','length','attributes','order','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','end','sendStatus','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','type','key','map','query','filters','intersection','model'];(function(_0xc70602,_0x531f15){var _0x338b62=function(_0x47bec1){while(--_0x47bec1){_0xc70602['push'](_0xc70602['shift']());}};_0x338b62(++_0x531f15);}(_0x1e8d,0xf2));var _0xd1e8=function(_0x4b2231,_0x379f87){_0x4b2231=_0x4b2231-0x0;var _0xb11ccc=_0x1e8d[_0x4b2231];return _0xb11ccc;};'use strict';var emlformat=require(_0xd1e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1e8('0x1'));var jsonpatch=require(_0xd1e8('0x2'));var rp=require(_0xd1e8('0x3'));var moment=require(_0xd1e8('0x4'));var BPromise=require(_0xd1e8('0x5'));var Mustache=require(_0xd1e8('0x6'));var util=require(_0xd1e8('0x7'));var path=require(_0xd1e8('0x8'));var sox=require(_0xd1e8('0x9'));var csv=require('to-csv');var ejs=require(_0xd1e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd1e8('0xb'));var _=require('lodash');var squel=require(_0xd1e8('0xc'));var crypto=require('crypto');var jsforce=require(_0xd1e8('0xd'));var deskjs=require(_0xd1e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd1e8('0xf'));var Papa=require(_0xd1e8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd1e8('0x11'));var hardwareService=require(_0xd1e8('0x12'));var logger=require(_0xd1e8('0x13'))(_0xd1e8('0x14'));var utils=require('../../config/utils');var config=require(_0xd1e8('0x15'));var licenseUtil=require(_0xd1e8('0x16'));var db=require(_0xd1e8('0x17'))['db'];function respondWithStatusCode(_0x39003d,_0x539453){_0x539453=_0x539453||0xcc;return function(_0x3382fd){if(_0x3382fd){return _0x39003d['sendStatus'](_0x539453);}return _0x39003d[_0xd1e8('0x18')](_0x539453)['end']();};}function respondWithResult(_0x3d4c03,_0x160d59){_0x160d59=_0x160d59||0xc8;return function(_0x4c8a34){if(_0x4c8a34){return _0x3d4c03[_0xd1e8('0x18')](_0x160d59)['json'](_0x4c8a34);}};}function respondWithFilteredResult(_0x299255,_0xad12cc){return function(_0x9f467e){if(_0x9f467e){var _0x5c809e=typeof _0xad12cc[_0xd1e8('0x19')]==='undefined'&&typeof _0xad12cc[_0xd1e8('0x1a')]===_0xd1e8('0x1b');var _0x4209a0=_0x9f467e[_0xd1e8('0x1c')];var _0x386eec=_0x5c809e?0x0:_0xad12cc[_0xd1e8('0x19')];var _0x4e21f6=_0x5c809e?_0x9f467e[_0xd1e8('0x1c')]:_0xad12cc['offset']+_0xad12cc[_0xd1e8('0x1a')];var _0x48fbe5;if(_0x4e21f6>=_0x4209a0){_0x4e21f6=_0x4209a0;_0x48fbe5=0xc8;}else{_0x48fbe5=0xce;}_0x299255[_0xd1e8('0x18')](_0x48fbe5);return _0x299255[_0xd1e8('0x1d')](_0xd1e8('0x1e'),_0x386eec+'-'+_0x4e21f6+'/'+_0x4209a0)[_0xd1e8('0x1f')](_0x9f467e);}return null;};}function patchUpdates(_0x2033d3){return function(_0x6ba6be){try{jsonpatch[_0xd1e8('0x20')](_0x6ba6be,_0x2033d3,!![]);}catch(_0x4abe60){return BPromise[_0xd1e8('0x21')](_0x4abe60);}return _0x6ba6be['save']();};}function saveUpdates(_0x303717,_0x154006){return function(_0x453751){if(_0x453751){return _0x453751['update'](_0x303717)['then'](function(_0x39ebac){return _0x39ebac;});}return null;};}function removeEntity(_0x11b917,_0x2b3a2c){return function(_0x218f3b){if(_0x218f3b){return _0x218f3b['destroy']()['then'](function(){_0x11b917[_0xd1e8('0x18')](0xcc)[_0xd1e8('0x22')]();});}};}function handleEntityNotFound(_0x5b22b6,_0x4d56ba){return function(_0x33deac){if(!_0x33deac){_0x5b22b6[_0xd1e8('0x23')](0x194);}return _0x33deac;};}function handleError(_0x5dd69a,_0x4b8020){_0x4b8020=_0x4b8020||0x1f4;return function(_0x288e41){logger[_0xd1e8('0x24')](_0x288e41[_0xd1e8('0x25')]);if(_0x288e41[_0xd1e8('0x26')]){delete _0x288e41[_0xd1e8('0x26')];}_0x5dd69a[_0xd1e8('0x18')](_0x4b8020)[_0xd1e8('0x27')](_0x288e41);};}exports[_0xd1e8('0x28')]=function(_0x5dd80a,_0xfb8d05){var _0x5a68f1={},_0x4271c1={},_0x5dd468={'count':0x0,'rows':[]};var _0xca23a9=_['map'](db[_0xd1e8('0x29')][_0xd1e8('0x2a')],function(_0x453bca){return{'name':_0x453bca['fieldName'],'type':_0x453bca[_0xd1e8('0x2b')][_0xd1e8('0x2c')]};});_0x4271c1['model']=_[_0xd1e8('0x2d')](_0xca23a9,'name');_0x4271c1[_0xd1e8('0x2e')]=_['keys'](_0x5dd80a[_0xd1e8('0x2e')]);_0x4271c1[_0xd1e8('0x2f')]=_[_0xd1e8('0x30')](_0x4271c1[_0xd1e8('0x31')],_0x4271c1['query']);_0x5a68f1['attributes']=_[_0xd1e8('0x30')](_0x4271c1['model'],qs[_0xd1e8('0x32')](_0x5dd80a[_0xd1e8('0x2e')][_0xd1e8('0x32')]));_0x5a68f1['attributes']=_0x5a68f1['attributes'][_0xd1e8('0x33')]?_0x5a68f1[_0xd1e8('0x34')]:_0x4271c1['model'];if(!_0x5dd80a[_0xd1e8('0x2e')]['hasOwnProperty']('nolimit')){_0x5a68f1[_0xd1e8('0x1a')]=qs[_0xd1e8('0x1a')](_0x5dd80a[_0xd1e8('0x2e')][_0xd1e8('0x1a')]);_0x5a68f1[_0xd1e8('0x19')]=qs[_0xd1e8('0x19')](_0x5dd80a[_0xd1e8('0x2e')][_0xd1e8('0x19')]);}_0x5a68f1[_0xd1e8('0x35')]=qs['sort'](_0x5dd80a['query'][_0xd1e8('0x36')]);_0x5a68f1[_0xd1e8('0x37')]=qs[_0xd1e8('0x2f')](_[_0xd1e8('0x38')](_0x5dd80a[_0xd1e8('0x2e')],_0x4271c1[_0xd1e8('0x2f')]),_0xca23a9);if(_0x5dd80a[_0xd1e8('0x2e')][_0xd1e8('0x39')]){_0x5a68f1[_0xd1e8('0x37')]=_['merge'](_0x5a68f1[_0xd1e8('0x37')],{'$or':_[_0xd1e8('0x2d')](_0xca23a9,function(_0x97e39d){if(_0x97e39d[_0xd1e8('0x2b')]!==_0xd1e8('0x3a')){var _0x16bb51={};_0x16bb51[_0x97e39d[_0xd1e8('0x26')]]={'$like':'%'+_0x5dd80a[_0xd1e8('0x2e')][_0xd1e8('0x39')]+'%'};return _0x16bb51;}})});}_0x5a68f1=_[_0xd1e8('0x3b')]({},_0x5a68f1,_0x5dd80a[_0xd1e8('0x3c')]);var _0x3edaba={'where':_0x5a68f1[_0xd1e8('0x37')]};return db[_0xd1e8('0x29')][_0xd1e8('0x1c')](_0x3edaba)[_0xd1e8('0x3d')](function(_0x24122f){_0x5dd468[_0xd1e8('0x1c')]=_0x24122f;if(_0x5dd80a[_0xd1e8('0x2e')]['includeAll']){_0x5a68f1[_0xd1e8('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xd1e8('0x3f')](_0x5a68f1);})['then'](function(_0xb5ff8c){_0x5dd468[_0xd1e8('0x40')]=_0xb5ff8c;return _0x5dd468;})['then'](respondWithFilteredResult(_0xfb8d05,_0x5a68f1))[_0xd1e8('0x41')](handleError(_0xfb8d05,null));};exports[_0xd1e8('0x42')]=function(_0x40b901,_0x341e26){var _0x483aba={'raw':!![],'where':{'id':_0x40b901[_0xd1e8('0x43')]['id']}},_0x3d2190={};_0x3d2190[_0xd1e8('0x31')]=_[_0xd1e8('0x44')](db[_0xd1e8('0x29')]['rawAttributes']);_0x3d2190[_0xd1e8('0x2e')]=_['keys'](_0x40b901[_0xd1e8('0x2e')]);_0x3d2190[_0xd1e8('0x2f')]=_['intersection'](_0x3d2190[_0xd1e8('0x31')],_0x3d2190[_0xd1e8('0x2e')]);_0x483aba[_0xd1e8('0x34')]=_['intersection'](_0x3d2190['model'],qs[_0xd1e8('0x32')](_0x40b901[_0xd1e8('0x2e')][_0xd1e8('0x32')]));_0x483aba[_0xd1e8('0x34')]=_0x483aba['attributes'][_0xd1e8('0x33')]?_0x483aba[_0xd1e8('0x34')]:_0x3d2190[_0xd1e8('0x31')];if(_0x40b901['query']['includeAll']){_0x483aba[_0xd1e8('0x3e')]=[{'all':!![]}];}_0x483aba=_[_0xd1e8('0x3b')]({},_0x483aba,_0x40b901['options']);return db[_0xd1e8('0x29')][_0xd1e8('0x45')](_0x483aba)[_0xd1e8('0x3d')](handleEntityNotFound(_0x341e26,null))[_0xd1e8('0x3d')](respondWithResult(_0x341e26,null))['catch'](handleError(_0x341e26,null));};exports[_0xd1e8('0x46')]=function(_0x33db9e,_0x4ac51f){return db['VoiceQueuesLog'][_0xd1e8('0x46')](_0x33db9e[_0xd1e8('0x47')],{})[_0xd1e8('0x3d')](respondWithResult(_0x4ac51f,0xc9))[_0xd1e8('0x41')](handleError(_0x4ac51f,null));};exports[_0xd1e8('0x48')]=function(_0x4820b0,_0x4196cc){if(_0x4820b0[_0xd1e8('0x47')]['id']){delete _0x4820b0['body']['id'];}return db[_0xd1e8('0x29')][_0xd1e8('0x45')]({'where':{'id':_0x4820b0[_0xd1e8('0x43')]['id']}})[_0xd1e8('0x3d')](handleEntityNotFound(_0x4196cc,null))[_0xd1e8('0x3d')](saveUpdates(_0x4820b0[_0xd1e8('0x47')],null))[_0xd1e8('0x3d')](respondWithResult(_0x4196cc,null))['catch'](handleError(_0x4196cc,null));};exports['destroy']=function(_0x541d96,_0x27fa65){return db[_0xd1e8('0x29')]['find']({'where':{'id':_0x541d96['params']['id']}})[_0xd1e8('0x3d')](handleEntityNotFound(_0x27fa65,null))[_0xd1e8('0x3d')](removeEntity(_0x27fa65,null))[_0xd1e8('0x41')](handleError(_0x27fa65,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 39133ba..5fa8ced 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 _0x01e7=['request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','lodash','api'];(function(_0x21cf8f,_0x3996c8){var _0x2700bf=function(_0x19a492){while(--_0x19a492){_0x21cf8f['push'](_0x21cf8f['shift']());}};_0x2700bf(++_0x3996c8);}(_0x01e7,0x134));var _0x701e=function(_0x5f4153,_0x20a5be){_0x5f4153=_0x5f4153-0x0;var _0x44236e=_0x01e7[_0x5f4153];return _0x44236e;};'use strict';var _=require(_0x701e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x701e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x701e('0x2'));var fs=require('fs');var path=require(_0x701e('0x3'));var rimraf=require(_0x701e('0x4'));var config=require('../../config/environment');var attributes=require(_0x701e('0x5'));module[_0x701e('0x6')]=function(_0x415875,_0x16235b){return _0x415875['define'](_0x701e('0x7'),attributes,{'tableName':_0x701e('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x701e('0x9'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x827d=['VoiceQueuesLog','event_dtm','dtm','lodash','util','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x827d,0xdf));var _0xd827=function(_0x510b12,_0xa08206){_0x510b12=_0x510b12-0x0;var _0x2673e2=_0x827d[_0x510b12];return _0x2673e2;};'use strict';var _=require(_0xd827('0x0'));var util=require(_0xd827('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd827('0x2'));var rp=require(_0xd827('0x3'));var fs=require('fs');var path=require(_0xd827('0x4'));var rimraf=require('rimraf');var config=require(_0xd827('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0xd827('0x6')]=function(_0x357c0b,_0x105998){return _0x357c0b[_0xd827('0x7')](_0xd827('0x8'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd827('0x9'),'fields':['event',_0xd827('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e352ffc..2563c91 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 _0xd9cc=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1e061d,_0x28c134){var _0x472f97=function(_0x27a0a9){while(--_0x27a0a9){_0x1e061d['push'](_0x1e061d['shift']());}};_0x472f97(++_0x28c134);}(_0xd9cc,0x1e1));var _0xcd9c=function(_0x39f591,_0x264187){_0x39f591=_0x39f591-0x0;var _0x551627=_0xd9cc[_0x39f591];return _0x551627;};'use strict';var _=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var moment=require(_0xcd9c('0x2'));var BPromise=require(_0xcd9c('0x3'));var rs=require(_0xcd9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9c('0x5'))['db'];var utils=require(_0xcd9c('0x6'));var logger=require(_0xcd9c('0x7'))('rpc');var config=require(_0xcd9c('0x8'));var jayson=require(_0xcd9c('0x9'));var client=jayson['client'][_0xcd9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c7a,_0x15c37c,_0x245c95){return new BPromise(function(_0x598a78,_0x2e62c5){return client['request'](_0x2a9c7a,_0x245c95)[_0xcd9c('0xb')](function(_0x21ecd4){logger[_0xcd9c('0xc')](_0xcd9c('0xd'),_0x15c37c,_0xcd9c('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x15c37c,_0xcd9c('0xe'),JSON[_0xcd9c('0xf')](_0x21ecd4));if(_0x21ecd4[_0xcd9c('0x10')]){if(_0x21ecd4['error'][_0xcd9c('0x11')]===0x1f4){logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x21ecd4['error'][_0xcd9c('0x12')]);return _0x2e62c5(_0x21ecd4[_0xcd9c('0x10')][_0xcd9c('0x12')]);}logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x21ecd4['error']['message']);return _0x598a78(_0x21ecd4[_0xcd9c('0x10')][_0xcd9c('0x12')]);}else{logger[_0xcd9c('0xc')](_0xcd9c('0xd'),_0x15c37c,_0xcd9c('0xe'));_0x598a78(_0x21ecd4[_0xcd9c('0x13')][_0xcd9c('0x12')]);}})[_0xcd9c('0x14')](function(_0x793f5f){logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x793f5f);_0x2e62c5(_0x793f5f);});});} \ No newline at end of file +var _0x1020=['http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x1020,0x1a4));var _0x0102=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x1020[_0xca1f0e];return _0x35e4ef;};'use strict';var _=require(_0x0102('0x0'));var util=require('util');var moment=require(_0x0102('0x1'));var BPromise=require(_0x0102('0x2'));var rs=require(_0x0102('0x3'));var fs=require('fs');var Redis=require(_0x0102('0x4'));var db=require(_0x0102('0x5'))['db'];var utils=require(_0x0102('0x6'));var logger=require(_0x0102('0x7'))(_0x0102('0x8'));var config=require(_0x0102('0x9'));var jayson=require(_0x0102('0xa'));var client=jayson[_0x0102('0xb')][_0x0102('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55229f,_0x26804d,_0x1aa60e){return new BPromise(function(_0x43df9f,_0x5ea57e){return client['request'](_0x55229f,_0x1aa60e)[_0x0102('0xd')](function(_0x566659){logger['info'](_0x0102('0xe'),_0x26804d,_0x0102('0xf'));logger[_0x0102('0x10')](_0x0102('0x11'),_0x26804d,_0x0102('0xf'),JSON['stringify'](_0x566659));if(_0x566659[_0x0102('0x12')]){if(_0x566659[_0x0102('0x12')][_0x0102('0x13')]===0x1f4){logger[_0x0102('0x12')](_0x0102('0xe'),_0x26804d,_0x566659[_0x0102('0x12')][_0x0102('0x14')]);return _0x5ea57e(_0x566659[_0x0102('0x12')][_0x0102('0x14')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x26804d,_0x566659[_0x0102('0x12')][_0x0102('0x14')]);return _0x43df9f(_0x566659[_0x0102('0x12')][_0x0102('0x14')]);}else{logger[_0x0102('0x15')](_0x0102('0xe'),_0x26804d,_0x0102('0xf'));_0x43df9f(_0x566659[_0x0102('0x16')][_0x0102('0x14')]);}})[_0x0102('0x17')](function(_0x38fab3){logger['error'](_0x0102('0xe'),_0x26804d,_0x38fab3);_0x5ea57e(_0x38fab3);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0ea99ce..983254b 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 _0x4e40=['/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','exports','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','download'];(function(_0x330ae0,_0x33a050){var _0x165047=function(_0x4bdcff){while(--_0x4bdcff){_0x330ae0['push'](_0x330ae0['shift']());}};_0x165047(++_0x33a050);}(_0x4e40,0x148));var _0x04e4=function(_0x4cf874,_0x1a04a5){_0x4cf874=_0x4cf874-0x0;var _0x34c2b2=_0x4e40[_0x4cf874];return _0x34c2b2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04e4('0x0'));var router=express[_0x04e4('0x1')]();var fs_extra=require(_0x04e4('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x04e4('0x3'));var controller=require(_0x04e4('0x4'));router[_0x04e4('0x5')]('/',auth['isAuthenticated'](),controller[_0x04e4('0x6')]);router['get'](_0x04e4('0x7'),auth[_0x04e4('0x8')](),controller['describe']);router['get']('/:id',auth[_0x04e4('0x8')](),controller[_0x04e4('0x9')]);router[_0x04e4('0x5')](_0x04e4('0xa'),auth['isAuthenticated'](),controller[_0x04e4('0xb')]);router[_0x04e4('0x5')](_0x04e4('0xc'),controller['downloads']);router[_0x04e4('0x5')](_0x04e4('0xd'),auth['isAuthenticated'](),controller[_0x04e4('0xe')]);router[_0x04e4('0xf')]('/',auth[_0x04e4('0x8')](),controller['create']);router[_0x04e4('0xf')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x04e4('0x10')]);router[_0x04e4('0x11')]('/:id',auth[_0x04e4('0x8')](),controller['update']);router['delete'](_0x04e4('0x12'),auth[_0x04e4('0x8')](),controller['destroy']);module[_0x04e4('0x13')]=router; \ No newline at end of file +var _0x1d64=['/:id','isAuthenticated','show','download','/:id/downloads','downloads','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','describe'];(function(_0x3477d0,_0x35a21e){var _0x10e8bd=function(_0x55e669){while(--_0x55e669){_0x3477d0['push'](_0x3477d0['shift']());}};_0x10e8bd(++_0x35a21e);}(_0x1d64,0x14f));var _0x41d6=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x1d64[_0x547add];return _0x2ed1f3;};'use strict';var multer=require(_0x41d6('0x0'));var util=require('util');var path=require(_0x41d6('0x1'));var timeout=require(_0x41d6('0x2'));var express=require('express');var router=express[_0x41d6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x41d6('0x4'));var config=require(_0x41d6('0x5'));var controller=require(_0x41d6('0x6'));router[_0x41d6('0x7')]('/',auth['isAuthenticated'](),controller[_0x41d6('0x8')]);router[_0x41d6('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x41d6('0x9')]);router[_0x41d6('0x7')](_0x41d6('0xa'),auth[_0x41d6('0xb')](),controller[_0x41d6('0xc')]);router['get']('/:id/download',auth[_0x41d6('0xb')](),controller[_0x41d6('0xd')]);router[_0x41d6('0x7')](_0x41d6('0xe'),controller[_0x41d6('0xf')]);router[_0x41d6('0x7')]('/:id/transcribe',auth[_0x41d6('0xb')](),controller[_0x41d6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x41d6('0x11')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x41d6('0x12')]);router[_0x41d6('0x13')]('/:id',auth[_0x41d6('0xb')](),controller[_0x41d6('0x14')]);router[_0x41d6('0x15')]('/:id',auth[_0x41d6('0xb')](),controller['destroy']);module[_0x41d6('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b177c8a..1064eba 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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 c737fcc..892fa42 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 _0x86d4=['../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x86d4,0x82));var _0x486d=function(_0x5c2ac7,_0x4e7fea){_0x5c2ac7=_0x5c2ac7-0x0;var _0x1efc9a=_0x86d4[_0x5c2ac7];return _0x1efc9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x486d('0x0'));var zipdir=require(_0x486d('0x1'));var jsonpatch=require(_0x486d('0x2'));var rp=require(_0x486d('0x3'));var moment=require(_0x486d('0x4'));var BPromise=require(_0x486d('0x5'));var Mustache=require(_0x486d('0x6'));var util=require(_0x486d('0x7'));var path=require('path');var sox=require(_0x486d('0x8'));var csv=require('to-csv');var ejs=require(_0x486d('0x9'));var fs=require('fs');var fs_extra=require(_0x486d('0xa'));var _=require(_0x486d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x486d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x486d('0xd'));var Papa=require(_0x486d('0xe'));var AWS=require(_0x486d('0xf'));var uuidv4=require(_0x486d('0x10'));var Redis=require(_0x486d('0x11'));var authService=require(_0x486d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x486d('0x13'));var hardwareService=require(_0x486d('0x14'));var logger=require('../../config/logger')(_0x486d('0x15'));var utils=require(_0x486d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x486d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50010e,_0x432876){_0x432876=_0x432876||0xcc;return function(_0xbe0098){if(_0xbe0098){return _0x50010e[_0x486d('0x18')](_0x432876);}return _0x50010e[_0x486d('0x19')](_0x432876)[_0x486d('0x1a')]();};}function respondWithResult(_0x1a24cc,_0x5c879){_0x5c879=_0x5c879||0xc8;return function(_0x29d348){if(_0x29d348){return _0x1a24cc[_0x486d('0x19')](_0x5c879)['json'](_0x29d348);}};}function respondWithFilteredResult(_0x2b26d5,_0x4a68c8){return function(_0x35a0cb){if(_0x35a0cb){var _0x5d8555=typeof _0x4a68c8[_0x486d('0x1b')]===_0x486d('0x1c')&&typeof _0x4a68c8['limit']===_0x486d('0x1c');var _0x6f57ad=_0x35a0cb[_0x486d('0x1d')];var _0x592259=_0x5d8555?0x0:_0x4a68c8['offset'];var _0x262fce=_0x5d8555?_0x35a0cb[_0x486d('0x1d')]:_0x4a68c8[_0x486d('0x1b')]+_0x4a68c8[_0x486d('0x1e')];var _0x461009;if(_0x262fce>=_0x6f57ad){_0x262fce=_0x6f57ad;_0x461009=0xc8;}else{_0x461009=0xce;}_0x2b26d5[_0x486d('0x19')](_0x461009);return _0x2b26d5[_0x486d('0x1f')](_0x486d('0x20'),_0x592259+'-'+_0x262fce+'/'+_0x6f57ad)[_0x486d('0x21')](_0x35a0cb);}return null;};}function patchUpdates(_0x513700){return function(_0x4fb5f5){try{jsonpatch[_0x486d('0x22')](_0x4fb5f5,_0x513700,!![]);}catch(_0xfc7689){return BPromise[_0x486d('0x23')](_0xfc7689);}return _0x4fb5f5[_0x486d('0x24')]();};}function saveUpdates(_0x266f94,_0x109714){return function(_0x557280){if(_0x557280){return _0x557280[_0x486d('0x25')](_0x266f94)[_0x486d('0x26')](function(_0x48b5fe){return _0x48b5fe;});}return null;};}function removeEntity(_0x5c0e67,_0xa4da68){return function(_0x4c9cee){if(_0x4c9cee){return _0x4c9cee[_0x486d('0x27')]()[_0x486d('0x26')](function(){_0x5c0e67[_0x486d('0x19')](0xcc)[_0x486d('0x1a')]();});}};}function handleEntityNotFound(_0x2acc85,_0x2f9fbd){return function(_0x1771e8){if(!_0x1771e8){_0x2acc85[_0x486d('0x18')](0x194);}return _0x1771e8;};}function handleError(_0x51e223,_0x944726){_0x944726=_0x944726||0x1f4;return function(_0x182c98){logger['error'](_0x182c98['stack']);if(_0x182c98['name']){delete _0x182c98[_0x486d('0x28')];}_0x51e223[_0x486d('0x19')](_0x944726)[_0x486d('0x29')](_0x182c98);};}exports['index']=function(_0x4f86ae,_0x4b5053){var _0x4ed736={},_0x1dbaf5={},_0x587a36={'count':0x0,'rows':[]};var _0x1e130f=_[_0x486d('0x2a')](db['VoiceRecording'][_0x486d('0x2b')],function(_0x15b2d2){return{'name':_0x15b2d2[_0x486d('0x2c')],'type':_0x15b2d2[_0x486d('0x2d')][_0x486d('0x2e')]};});_0x1dbaf5[_0x486d('0x2f')]=_[_0x486d('0x30')](_['map'](_0x1e130f,_0x486d('0x28')),[_0x486d('0x31')]);_0x1dbaf5[_0x486d('0x32')]=_[_0x486d('0x33')](_0x4f86ae[_0x486d('0x32')]);_0x1dbaf5[_0x486d('0x34')]=_['intersection'](_0x1dbaf5[_0x486d('0x2f')],_0x1dbaf5[_0x486d('0x32')]);_0x4ed736[_0x486d('0x35')]=_[_0x486d('0x36')](_0x1dbaf5['model'],qs[_0x486d('0x37')](_0x4f86ae['query'][_0x486d('0x37')]));_0x4ed736[_0x486d('0x35')]=_0x4ed736['attributes'][_0x486d('0x38')]?_0x4ed736[_0x486d('0x35')]:_0x1dbaf5[_0x486d('0x2f')];if(!_0x4f86ae[_0x486d('0x32')][_0x486d('0x39')](_0x486d('0x3a'))){_0x4ed736['limit']=qs[_0x486d('0x1e')](_0x4f86ae[_0x486d('0x32')][_0x486d('0x1e')]);_0x4ed736['offset']=qs[_0x486d('0x1b')](_0x4f86ae[_0x486d('0x32')][_0x486d('0x1b')]);}_0x4ed736[_0x486d('0x3b')]=qs[_0x486d('0x3c')](_0x4f86ae[_0x486d('0x32')]['sort']);_0x4ed736[_0x486d('0x3d')]=qs[_0x486d('0x34')](_['pick'](_0x4f86ae[_0x486d('0x32')],_0x1dbaf5['filters']),_0x1e130f);if(_0x4f86ae[_0x486d('0x32')][_0x486d('0x3e')]){_0x4ed736['where']=_[_0x486d('0x3f')](_0x4ed736['where'],{'$or':_[_0x486d('0x2a')](_0x1e130f,function(_0x9accb9){if(_0x9accb9['type']!==_0x486d('0x40')){var _0xbfc7f8={};_0xbfc7f8[_0x9accb9['name']]={'$like':'%'+_0x4f86ae[_0x486d('0x32')][_0x486d('0x3e')]+'%'};return _0xbfc7f8;}})});}_0x4ed736=_[_0x486d('0x3f')]({},_0x4ed736,_0x4f86ae[_0x486d('0x41')]);var _0xd239dc={'where':_0x4ed736[_0x486d('0x3d')]};return db[_0x486d('0x42')][_0x486d('0x1d')](_0xd239dc)[_0x486d('0x26')](function(_0x3c734a){_0x587a36[_0x486d('0x1d')]=_0x3c734a;if(_0x4f86ae['query']['includeAll']){_0x4ed736[_0x486d('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x486d('0x44')](_0x4ed736);})[_0x486d('0x26')](function(_0xd4bbac){_0x587a36[_0x486d('0x45')]=_0xd4bbac;return _0x587a36;})[_0x486d('0x26')](respondWithFilteredResult(_0x4b5053,_0x4ed736))[_0x486d('0x46')](handleError(_0x4b5053,null));};exports[_0x486d('0x47')]=function(_0x44836f,_0x4afdb0){var _0x4ed11d={'raw':![],'where':{'id':_0x44836f[_0x486d('0x48')]['id']}},_0xecf5ed={};_0xecf5ed[_0x486d('0x2f')]=_['keys'](db[_0x486d('0x42')][_0x486d('0x2b')]);_0xecf5ed[_0x486d('0x32')]=_[_0x486d('0x33')](_0x44836f[_0x486d('0x32')]);_0xecf5ed[_0x486d('0x34')]=_[_0x486d('0x36')](_0xecf5ed['model'],_0xecf5ed[_0x486d('0x32')]);_0x4ed11d[_0x486d('0x35')]=_[_0x486d('0x36')](_0xecf5ed[_0x486d('0x2f')],qs[_0x486d('0x37')](_0x44836f['query'][_0x486d('0x37')]));_0x4ed11d[_0x486d('0x35')]=_0x4ed11d[_0x486d('0x35')]['length']?_0x4ed11d[_0x486d('0x35')]:_0xecf5ed[_0x486d('0x2f')];if(_0x44836f[_0x486d('0x32')][_0x486d('0x49')]){_0x4ed11d[_0x486d('0x43')]=[{'all':!![]}];}_0x4ed11d=_['merge']({},_0x4ed11d,_0x44836f[_0x486d('0x41')]);return db[_0x486d('0x42')]['find'](_0x4ed11d)[_0x486d('0x26')](handleEntityNotFound(_0x4afdb0,null))[_0x486d('0x26')](respondWithResult(_0x4afdb0,null))[_0x486d('0x46')](handleError(_0x4afdb0,null));};exports[_0x486d('0x4a')]=function(_0xd8438,_0x2ad0d4){return db['VoiceRecording']['create'](_0xd8438[_0x486d('0x4b')],{})[_0x486d('0x26')](respondWithResult(_0x2ad0d4,0xc9))[_0x486d('0x46')](handleError(_0x2ad0d4,null));};exports[_0x486d('0x25')]=function(_0x39554c,_0x566aaa){if(_0x39554c[_0x486d('0x4b')]['id']){delete _0x39554c[_0x486d('0x4b')]['id'];}return db[_0x486d('0x42')][_0x486d('0x4c')]({'where':{'id':_0x39554c['params']['id']}})[_0x486d('0x26')](handleEntityNotFound(_0x566aaa,null))[_0x486d('0x26')](saveUpdates(_0x39554c[_0x486d('0x4b')],null))[_0x486d('0x26')](respondWithResult(_0x566aaa,null))[_0x486d('0x46')](handleError(_0x566aaa,null));};exports[_0x486d('0x4d')]=function(_0x2c9c9d,_0xc67109){return db[_0x486d('0x42')][_0x486d('0x4d')]()[_0x486d('0x26')](respondWithResult(_0xc67109,null))[_0x486d('0x46')](handleError(_0xc67109,null));};exports[_0x486d('0x4e')]=function(_0x4841a8,_0x2df435,_0x5ea620){var _0x595199=require('../../components/encryptor');var _0x4b1bcf=![];var _0x18b2d5={};if(_0x4841a8[_0x486d('0x32')][_0x486d('0x2d')]&&_0x4841a8[_0x486d('0x32')]['type']==='uniqueid'){_0x18b2d5[_0x486d('0x4f')]=_0x4841a8[_0x486d('0x48')]['id'];}else{_0x18b2d5['id']=_0x4841a8['params']['id'];}return db[_0x486d('0x42')]['find']({'where':_0x18b2d5,'attributes':['id',_0x486d('0x50')],'raw':!![]})[_0x486d('0x26')](handleEntityNotFound(_0x2df435,null))[_0x486d('0x26')](function(_0x3658f2){if(_0x3658f2){var _0x429ea6=_0x3658f2['value'];var _0x7a35c5=util[_0x486d('0x31')]('%s.cypher',_0x429ea6);if(fs[_0x486d('0x51')](_0x7a35c5)){_0x4b1bcf=!![];return _0x595199[_0x486d('0x52')](_0x7a35c5,_0x429ea6,config[_0x486d('0x53')][_0x486d('0x54')])[_0x486d('0x26')](function(){return _0x3658f2;});}return _0x3658f2;}})['then'](function(_0x47838b){if(_0x47838b){var _0x4e3396=_0x47838b[_0x486d('0x50')];if(!fs['existsSync'](_0x4e3396)){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x57'));}if(_0x47838b[_0x486d('0x58')]){return _0x2df435[_0x486d('0x4e')](_0x4e3396,_0x47838b[_0x486d('0x58')]+path[_0x486d('0x59')](_0x4e3396),function(){if(_0x4b1bcf){fs['unlink'](_0x4e3396);}});}else{return _0x2df435[_0x486d('0x4e')](_0x4e3396,function(_0x2b9bcc){if(_0x4b1bcf){fs[_0x486d('0x5a')](_0x4e3396);}});}}})[_0x486d('0x46')](function(_0x5ec7d2){if(_0x5ec7d2[_0x486d('0x5b')]===_0x486d('0x57')){_0x2df435[_0x486d('0x19')](0x194)['send'](_0x486d('0x5c'));}else{return handleError(_0x2df435,null);}});};exports['downloads']=function(_0x3b5594,_0x242771,_0x2e7df7){var _0x35f3e8=require(_0x486d('0x5d'));var _0x3105b1=![];var _0x43a8b5={'$and':[db[_0x486d('0x5e')][_0x486d('0x3d')](db[_0x486d('0x5e')]['fn'](_0x486d('0x5f'),db[_0x486d('0x5e')][_0x486d('0x60')](_0x486d('0x4f'))),_0x3b5594['query'][_0x486d('0x61')])]};if(_0x3b5594['query'][_0x486d('0x2d')]&&_0x3b5594['query']['type']===_0x486d('0x4f')){_0x43a8b5[_0x486d('0x62')][_0x486d('0x63')]({'uniqueid':_0x3b5594[_0x486d('0x48')]['id']});}else{_0x43a8b5['$and'][_0x486d('0x63')]({'id':_0x3b5594[_0x486d('0x48')]['id']});}return db['VoiceRecording'][_0x486d('0x4c')]({'where':_0x43a8b5,'attributes':['id',_0x486d('0x50')],'raw':!![]})[_0x486d('0x26')](handleEntityNotFound(_0x242771,null))['then'](function(_0x14a887){if(_0x14a887){var _0x44e5c5=util[_0x486d('0x31')](_0x486d('0x64'),_0x14a887[_0x486d('0x50')]);if(fs[_0x486d('0x51')](_0x44e5c5)){_0x3105b1=!![];return _0x35f3e8[_0x486d('0x52')](_0x44e5c5,_0x14a887[_0x486d('0x50')],config[_0x486d('0x53')][_0x486d('0x54')])[_0x486d('0x26')](function(){return _0x14a887;});}return _0x14a887;}})[_0x486d('0x26')](function(_0x892a1b){if(_0x892a1b){if(!fs[_0x486d('0x51')](_0x892a1b['value'])){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x892a1b['filename']){return _0x242771['download'](_0x892a1b[_0x486d('0x50')],_0x892a1b[_0x486d('0x58')]+path[_0x486d('0x59')](_0x892a1b[_0x486d('0x50')]),function(){if(_0x3105b1){fs[_0x486d('0x5a')](_0x892a1b[_0x486d('0x50')]);}});}else{return _0x242771[_0x486d('0x4e')](_0x892a1b[_0x486d('0x50')],function(_0x47db9f){if(_0x3105b1){fs[_0x486d('0x5a')](_0x892a1b[_0x486d('0x50')]);}});}}})[_0x486d('0x46')](handleError(_0x242771,null));};exports[_0x486d('0x27')]=function(_0x14abbf,_0x4ba767){return db[_0x486d('0x42')][_0x486d('0x4c')]({'where':{'id':_0x14abbf[_0x486d('0x48')]['id']}})[_0x486d('0x26')](function(_0x4c1873){if(_[_0x486d('0x65')](_0x4c1873)){throw new ReferenceError(_0x486d('0x66'));}return _0x4c1873;})['then'](function(_0x5d909e){var _0x3fdfe4=_0x5d909e[_0x486d('0x50')];logger[_0x486d('0x67')](_0x486d('0x68'),_0x3fdfe4);if(!_[_0x486d('0x65')](_0x5d909e[_0x486d('0x50')])&&fs['existsSync'](_0x3fdfe4)){logger[_0x486d('0x67')]('File:\x20\x22'+_0x3fdfe4+_0x486d('0x69'));fs[_0x486d('0x6a')](_0x3fdfe4);}_0x3fdfe4=_0x3fdfe4+'.cypher';if(!_['isNil'](_0x5d909e[_0x486d('0x50')])&&fs[_0x486d('0x51')](_0x3fdfe4)){logger['info']('File:\x20\x22'+_0x3fdfe4+_0x486d('0x69'));fs[_0x486d('0x6a')](_0x3fdfe4);}return _0x5d909e;})[_0x486d('0x26')](function(_0x5bce07){if(!_0x5bce07)throw new InternalError();return _0x5bce07[_0x486d('0x27')]();})[_0x486d('0x26')](function(){_0x4ba767[_0x486d('0x19')](0xcc)['end']();})[_0x486d('0x46')](handleError(_0x4ba767,null));};function getBucketslist(_0x2b0362,_0x5df083,_0x3ac96a){return new Promise(function(_0x336191,_0x22b4b5){var _0x3e8515=new AWS['S3']({'accessKeyId':_0x5df083,'secretAccessKey':_0x2b0362,'region':_0x3ac96a});_0x3e8515[_0x486d('0x6b')]({},function(_0x191ed3,_0x4d5e25){if(_0x191ed3){return _0x22b4b5(_0x191ed3);}else{return _0x336191(_0x4d5e25);}});});}function createBucket(_0x2bfa6f,_0x35e36c,_0x1237e2,_0x412309){return new Promise(function(_0x12ce3b,_0x2982e7){var _0x184fba=new AWS['S3']({'accessKeyId':_0x35e36c,'secretAccessKey':_0x2bfa6f,'region':_0x1237e2});_0x184fba[_0x486d('0x6c')]({'Bucket':_0x412309},function(_0x3d390c,_0x360cb1){if(_0x3d390c){return _0x2982e7(_0x3d390c);}else{return _0x12ce3b(_0x360cb1);}});});}function uploadFile(_0x7278c8,_0x37f397,_0x5ef075,_0x48de02,_0x539930,_0x39961b){return new Promise(function(_0x4ba146,_0x48538e){var _0x22f08e=new AWS['S3']({'accessKeyId':_0x37f397,'secretAccessKey':_0x7278c8,'region':_0x5ef075});_0x22f08e['upload']({'Bucket':_0x48de02,'Key':_0x539930,'Body':_0x39961b},function(_0x160a69,_0xc5ceba){if(_0x160a69){return _0x48538e(_0x160a69);}else{return _0x4ba146(_0xc5ceba);}});});}function startTranscribe(_0x48ac32,_0x16cef7,_0xcbc2e0,_0x202d0c,_0x375c6d,_0xe90493){return new Promise(function(_0x58a07c,_0x5d57f9){var _0x402d9a=new AWS['TranscribeService']({'accessKeyId':_0x16cef7,'secretAccessKey':_0x48ac32,'region':_0xcbc2e0});_0x402d9a[_0x486d('0x6d')]({'TranscriptionJobName':_0x202d0c,'LanguageCode':_0x375c6d,'Media':{'MediaFileUri':_0xe90493}},function(_0x4aa373,_0x5ead92){if(_0x4aa373){return _0x5d57f9(_0x4aa373);}else{return _0x58a07c(_0x5ead92);}});});}function transcribe(_0x265848,_0x3d0feb,_0x3f3147,_0x5222a0,_0x24fa17,_0x8a66b1,_0x57a5f6){return new Promise(function(_0x3e0195,_0x179354){var _0x82209c={};logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x6e'),_0x265848,_0x24fa17));return uploadFile(_0x3d0feb,_0x3f3147,_0x5222a0,_0x24fa17,path['basename'](_0x8a66b1),fs[_0x486d('0x6f')](_0x8a66b1))[_0x486d('0x26')](function(_0x125bee){logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x265848,_0x24fa17,_0x125bee['Location']));_0x82209c[_0x486d('0x70')]=_0x125bee[_0x486d('0x71')];_0x82209c['location']=_0x125bee[_0x486d('0x72')];logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x73'),_0x265848));return startTranscribe(_0x3d0feb,_0x3f3147,_0x5222a0,uuidv4(),_0x57a5f6,_0x125bee[_0x486d('0x72')]);})[_0x486d('0x26')](function(_0x41da2b){logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x74'),_0x265848,_0x41da2b[_0x486d('0x75')][_0x486d('0x76')]));_0x82209c[_0x486d('0x77')]=_0x41da2b[_0x486d('0x75')]['TranscriptionJobName'];_0x82209c['transcribeStatus']=_0x41da2b[_0x486d('0x75')][_0x486d('0x78')];return _0x3e0195(_0x82209c);})[_0x486d('0x46')](function(_0x104c9f){return _0x179354(_0x104c9f);});});}exports[_0x486d('0x79')]=function(_0x1e1690,_0xe59372,_0x169973){var _0x473443;var _0x272b26;var _0x2a06b2;var _0x4aab9e=require(_0x486d('0x5d'));return db[_0x486d('0x42')]['findOne']({'where':{'id':_0x1e1690[_0x486d('0x48')]['id']}})[_0x486d('0x26')](function(_0x629db1){if(_0x629db1){var _0x40067c=util[_0x486d('0x31')](_0x486d('0x64'),_0x629db1['value']);if(fs[_0x486d('0x51')](_0x40067c)){cypher=!![];return _0x4aab9e[_0x486d('0x52')](_0x40067c,_0x629db1[_0x486d('0x50')],config[_0x486d('0x53')][_0x486d('0x54')])['then'](function(){return _0x629db1;});}return _0x629db1;}})[_0x486d('0x26')](function(_0x2e1878){if(!_0x2e1878){throw new db['Sequelize'][(_0x486d('0x56'))](_0x486d('0x7a'));}_0x272b26=_0x2e1878;return db[_0x486d('0x7b')][_0x486d('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xe59372,null))[_0x486d('0x26')](function(_0x37bede){if(_0x37bede){_0x473443=_0x37bede;if(!_0x473443[_0x486d('0x7d')]||!_0x473443[_0x486d('0x7e')]||!_0x473443[_0x486d('0x7f')]||!_0x473443[_0x486d('0x80')]||!_0x473443[_0x486d('0x70')]){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x81'));}if(_0x1e1690[_0x486d('0x4b')]['runSentiment']&&(!_0x473443[_0x486d('0x82')]||!_0x473443[_0x486d('0x83')]||!_0x473443[_0x486d('0x84')]||!_0x473443[_0x486d('0x80')]||!_0x473443[_0x486d('0x70')])){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x85'));}return db[_0x486d('0x86')][_0x486d('0x7c')]({'where':{'id':_0x473443['transcribeAccountId']}});}})[_0x486d('0x26')](function(_0x44da27){if(!_0x44da27){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x87'));}if(!_0x44da27[_0x486d('0x88')]||!_0x44da27[_0x486d('0x89')]){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x8a'));}_0x2a06b2=_0x44da27;return getBucketslist(_0x2a06b2['data1'],_0x2a06b2[_0x486d('0x89')],_0x473443[_0x486d('0x7f')]);})['then'](function(_0x233f63){if(_0x233f63&&_0x233f63[_0x486d('0x8b')]){var _0x57a5c4=_[_0x486d('0x4c')](_0x233f63[_0x486d('0x8b')],function(_0x4c54b4){return _0x4c54b4[_0x486d('0x8c')]===_0x473443[_0x486d('0x70')];});if(!_0x57a5c4){logger['info'](util[_0x486d('0x31')](_0x486d('0x8d'),_0x1e1690[_0x486d('0x48')]['id'],_0x473443['bucket']));return createBucket(_0x2a06b2[_0x486d('0x88')],_0x2a06b2[_0x486d('0x89')],_0x473443[_0x486d('0x7f')],_0x473443[_0x486d('0x70')]);}logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1e1690[_0x486d('0x48')]['id'],_0x473443['bucket']));return;}})[_0x486d('0x26')](function(_0x65abc9){if(_0x272b26[_0x486d('0x8e')]===_0x486d('0x8f')){return transcribe(_0x1e1690['params']['id'],_0x2a06b2[_0x486d('0x88')],_0x2a06b2['data2'],_0x473443[_0x486d('0x7f')],_0x473443[_0x486d('0x70')],_0x272b26[_0x486d('0x50')],_0x473443[_0x486d('0x80')]);}else{logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1e1690[_0x486d('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x486d('0x26')](function(_0x5f57b7){if(_0x5f57b7){_0x5f57b7[_0x486d('0x90')]=_0x1e1690[_0x486d('0x4b')][_0x486d('0x91')];return _0x272b26[_0x486d('0x92')](_0x5f57b7);}})[_0x486d('0x26')](respondWithResult(_0xe59372,null))[_0x486d('0x46')](handleError(_0xe59372,null));};function writeFile(_0x227bc5,_0xd99f29){return new Promise(function(_0x134c7d,_0x1bd598){fs[_0x486d('0x93')](_0xd99f29,_0x227bc5,function(_0x12c327,_0x66f60f){if(_0x12c327){return _0x1bd598(_0x12c327);}else{return _0x134c7d(_0x66f60f);}});});}exports[_0x486d('0x94')]=function(_0x2b5eb1,_0x342d15,_0xd41107){return db['VoiceRecording'][_0x486d('0x7c')]({'where':{'id':_0x2b5eb1[_0x486d('0x48')]['id']}})[_0x486d('0x26')](handleEntityNotFound(_0x342d15))['then'](function(_0x58d71c){if(_0x58d71c&&_0x58d71c['fileText']){var _0x2c5e11=_0x58d71c[_0x486d('0x95')];var _0x180130=config[_0x486d('0x96')]+_0x486d('0x97')+_0x58d71c['id']+'.txt';if(fs[_0x486d('0x51')](_0x180130)){return _0x180130;}return writeFile(_0x2c5e11,_0x180130)[_0x486d('0x26')](function(){return _0x180130;});}else{throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x98'));}})['then'](function(_0xea9cbd){return _0x342d15[_0x486d('0x4e')](_0xea9cbd);})[_0x486d('0x46')](handleError(_0x342d15));}; \ No newline at end of file +var _0x686f=['keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','find','create','update','body','describe','download','../../components/encryptor','params','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','MD5','col','uniqueid','token','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','listBuckets','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','runSentiment','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','then','end','error','stack','name','map','VoiceRecording','type','key','model','differenceBy'];(function(_0x1e252f,_0x2e8785){var _0x469682=function(_0x3f0e30){while(--_0x3f0e30){_0x1e252f['push'](_0x1e252f['shift']());}};_0x469682(++_0x2e8785);}(_0x686f,0x19c));var _0xf686=function(_0xe9f055,_0x258b96){_0xe9f055=_0xe9f055-0x0;var _0xea96bf=_0x686f[_0xe9f055];return _0xea96bf;};'use strict';var emlformat=require(_0xf686('0x0'));var rimraf=require(_0xf686('0x1'));var zipdir=require(_0xf686('0x2'));var jsonpatch=require(_0xf686('0x3'));var rp=require(_0xf686('0x4'));var moment=require(_0xf686('0x5'));var BPromise=require(_0xf686('0x6'));var Mustache=require(_0xf686('0x7'));var util=require(_0xf686('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf686('0x9'));var ejs=require(_0xf686('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf686('0xb'));var squel=require(_0xf686('0xc'));var crypto=require(_0xf686('0xd'));var jsforce=require(_0xf686('0xe'));var deskjs=require(_0xf686('0xf'));var toCsv=require(_0xf686('0x9'));var querystring=require(_0xf686('0x10'));var Papa=require(_0xf686('0x11'));var AWS=require(_0xf686('0x12'));var uuidv4=require(_0xf686('0x13'));var Redis=require(_0xf686('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xf686('0x15'));var as=require(_0xf686('0x16'));var hardwareService=require(_0xf686('0x17'));var logger=require(_0xf686('0x18'))(_0xf686('0x19'));var utils=require(_0xf686('0x1a'));var config=require(_0xf686('0x1b'));var licenseUtil=require(_0xf686('0x1c'));var db=require(_0xf686('0x1d'))['db'];function respondWithStatusCode(_0xce5d51,_0x2992cc){_0x2992cc=_0x2992cc||0xcc;return function(_0x1f08d9){if(_0x1f08d9){return _0xce5d51[_0xf686('0x1e')](_0x2992cc);}return _0xce5d51['status'](_0x2992cc)['end']();};}function respondWithResult(_0x2d6cf6,_0xd034b7){_0xd034b7=_0xd034b7||0xc8;return function(_0x450fb0){if(_0x450fb0){return _0x2d6cf6[_0xf686('0x1f')](_0xd034b7)['json'](_0x450fb0);}};}function respondWithFilteredResult(_0x52f050,_0x3c2d8c){return function(_0x16d0d1){if(_0x16d0d1){var _0x328c86=typeof _0x3c2d8c[_0xf686('0x20')]===_0xf686('0x21')&&typeof _0x3c2d8c[_0xf686('0x22')]===_0xf686('0x21');var _0x11525c=_0x16d0d1[_0xf686('0x23')];var _0x29e701=_0x328c86?0x0:_0x3c2d8c['offset'];var _0x4a141b=_0x328c86?_0x16d0d1[_0xf686('0x23')]:_0x3c2d8c['offset']+_0x3c2d8c['limit'];var _0x3d05e3;if(_0x4a141b>=_0x11525c){_0x4a141b=_0x11525c;_0x3d05e3=0xc8;}else{_0x3d05e3=0xce;}_0x52f050[_0xf686('0x1f')](_0x3d05e3);return _0x52f050[_0xf686('0x24')](_0xf686('0x25'),_0x29e701+'-'+_0x4a141b+'/'+_0x11525c)[_0xf686('0x26')](_0x16d0d1);}return null;};}function patchUpdates(_0xd0c8f5){return function(_0x52ab4d){try{jsonpatch[_0xf686('0x27')](_0x52ab4d,_0xd0c8f5,!![]);}catch(_0x24f6cf){return BPromise[_0xf686('0x28')](_0x24f6cf);}return _0x52ab4d['save']();};}function saveUpdates(_0x563973,_0x40e7a9){return function(_0x499836){if(_0x499836){return _0x499836['update'](_0x563973)['then'](function(_0x3f35bc){return _0x3f35bc;});}return null;};}function removeEntity(_0x1888e5,_0x2fa82f){return function(_0x458506){if(_0x458506){return _0x458506[_0xf686('0x29')]()[_0xf686('0x2a')](function(){_0x1888e5[_0xf686('0x1f')](0xcc)[_0xf686('0x2b')]();});}};}function handleEntityNotFound(_0x173ac8,_0x421f35){return function(_0x1ec87f){if(!_0x1ec87f){_0x173ac8[_0xf686('0x1e')](0x194);}return _0x1ec87f;};}function handleError(_0x311fb8,_0x32d8e5){_0x32d8e5=_0x32d8e5||0x1f4;return function(_0x93a6fa){logger[_0xf686('0x2c')](_0x93a6fa[_0xf686('0x2d')]);if(_0x93a6fa[_0xf686('0x2e')]){delete _0x93a6fa['name'];}_0x311fb8[_0xf686('0x1f')](_0x32d8e5)['send'](_0x93a6fa);};}exports['index']=function(_0x2abf86,_0x2bf0c4){var _0xccf3e0={},_0x58e1c8={},_0x42389c={'count':0x0,'rows':[]};var _0x2ce16d=_[_0xf686('0x2f')](db[_0xf686('0x30')]['rawAttributes'],function(_0xf1b7c){return{'name':_0xf1b7c['fieldName'],'type':_0xf1b7c[_0xf686('0x31')][_0xf686('0x32')]};});_0x58e1c8[_0xf686('0x33')]=_[_0xf686('0x34')](_['map'](_0x2ce16d,_0xf686('0x2e')),['format']);_0x58e1c8['query']=_[_0xf686('0x35')](_0x2abf86[_0xf686('0x36')]);_0x58e1c8[_0xf686('0x37')]=_['intersection'](_0x58e1c8[_0xf686('0x33')],_0x58e1c8['query']);_0xccf3e0[_0xf686('0x38')]=_['intersection'](_0x58e1c8[_0xf686('0x33')],qs[_0xf686('0x39')](_0x2abf86[_0xf686('0x36')][_0xf686('0x39')]));_0xccf3e0[_0xf686('0x38')]=_0xccf3e0[_0xf686('0x38')][_0xf686('0x3a')]?_0xccf3e0[_0xf686('0x38')]:_0x58e1c8[_0xf686('0x33')];if(!_0x2abf86[_0xf686('0x36')][_0xf686('0x3b')](_0xf686('0x3c'))){_0xccf3e0[_0xf686('0x22')]=qs[_0xf686('0x22')](_0x2abf86[_0xf686('0x36')][_0xf686('0x22')]);_0xccf3e0[_0xf686('0x20')]=qs[_0xf686('0x20')](_0x2abf86[_0xf686('0x36')]['offset']);}_0xccf3e0[_0xf686('0x3d')]=qs[_0xf686('0x3e')](_0x2abf86[_0xf686('0x36')][_0xf686('0x3e')]);_0xccf3e0[_0xf686('0x3f')]=qs[_0xf686('0x37')](_[_0xf686('0x40')](_0x2abf86['query'],_0x58e1c8[_0xf686('0x37')]),_0x2ce16d);if(_0x2abf86[_0xf686('0x36')][_0xf686('0x41')]){_0xccf3e0[_0xf686('0x3f')]=_['merge'](_0xccf3e0['where'],{'$or':_['map'](_0x2ce16d,function(_0x5e40b9){if(_0x5e40b9['type']!==_0xf686('0x42')){var _0x91e44a={};_0x91e44a[_0x5e40b9[_0xf686('0x2e')]]={'$like':'%'+_0x2abf86[_0xf686('0x36')][_0xf686('0x41')]+'%'};return _0x91e44a;}})});}_0xccf3e0=_[_0xf686('0x43')]({},_0xccf3e0,_0x2abf86[_0xf686('0x44')]);var _0x236cbb={'where':_0xccf3e0[_0xf686('0x3f')]};return db['VoiceRecording'][_0xf686('0x23')](_0x236cbb)[_0xf686('0x2a')](function(_0x39e2f9){_0x42389c['count']=_0x39e2f9;if(_0x2abf86[_0xf686('0x36')]['includeAll']){_0xccf3e0[_0xf686('0x45')]=[{'all':!![]}];}return db[_0xf686('0x30')][_0xf686('0x46')](_0xccf3e0);})['then'](function(_0x3c9efc){_0x42389c[_0xf686('0x47')]=_0x3c9efc;return _0x42389c;})[_0xf686('0x2a')](respondWithFilteredResult(_0x2bf0c4,_0xccf3e0))[_0xf686('0x48')](handleError(_0x2bf0c4,null));};exports[_0xf686('0x49')]=function(_0x31c783,_0x34e97a){var _0x45b3f1={'raw':![],'where':{'id':_0x31c783['params']['id']}},_0x4b5a54={};_0x4b5a54['model']=_[_0xf686('0x35')](db[_0xf686('0x30')][_0xf686('0x4a')]);_0x4b5a54['query']=_[_0xf686('0x35')](_0x31c783[_0xf686('0x36')]);_0x4b5a54[_0xf686('0x37')]=_[_0xf686('0x4b')](_0x4b5a54['model'],_0x4b5a54['query']);_0x45b3f1[_0xf686('0x38')]=_[_0xf686('0x4b')](_0x4b5a54[_0xf686('0x33')],qs['fields'](_0x31c783[_0xf686('0x36')]['fields']));_0x45b3f1[_0xf686('0x38')]=_0x45b3f1[_0xf686('0x38')][_0xf686('0x3a')]?_0x45b3f1[_0xf686('0x38')]:_0x4b5a54[_0xf686('0x33')];if(_0x31c783[_0xf686('0x36')][_0xf686('0x4c')]){_0x45b3f1[_0xf686('0x45')]=[{'all':!![]}];}_0x45b3f1=_[_0xf686('0x43')]({},_0x45b3f1,_0x31c783[_0xf686('0x44')]);return db[_0xf686('0x30')][_0xf686('0x4d')](_0x45b3f1)[_0xf686('0x2a')](handleEntityNotFound(_0x34e97a,null))[_0xf686('0x2a')](respondWithResult(_0x34e97a,null))[_0xf686('0x48')](handleError(_0x34e97a,null));};exports[_0xf686('0x4e')]=function(_0x218693,_0x24563f){return db[_0xf686('0x30')][_0xf686('0x4e')](_0x218693['body'],{})[_0xf686('0x2a')](respondWithResult(_0x24563f,0xc9))[_0xf686('0x48')](handleError(_0x24563f,null));};exports[_0xf686('0x4f')]=function(_0x4cb03c,_0x497420){if(_0x4cb03c['body']['id']){delete _0x4cb03c[_0xf686('0x50')]['id'];}return db['VoiceRecording'][_0xf686('0x4d')]({'where':{'id':_0x4cb03c['params']['id']}})[_0xf686('0x2a')](handleEntityNotFound(_0x497420,null))[_0xf686('0x2a')](saveUpdates(_0x4cb03c['body'],null))['then'](respondWithResult(_0x497420,null))['catch'](handleError(_0x497420,null));};exports['describe']=function(_0x1dcf4f,_0x1b87d5){return db[_0xf686('0x30')][_0xf686('0x51')]()[_0xf686('0x2a')](respondWithResult(_0x1b87d5,null))[_0xf686('0x48')](handleError(_0x1b87d5,null));};exports[_0xf686('0x52')]=function(_0x49ae46,_0x3b08be,_0x2215a8){var _0x3ae6f5=require(_0xf686('0x53'));var _0x274d54=![];var _0x36b352={};if(_0x49ae46['query'][_0xf686('0x31')]&&_0x49ae46[_0xf686('0x36')]['type']==='uniqueid'){_0x36b352['uniqueid']=_0x49ae46[_0xf686('0x54')]['id'];}else{_0x36b352['id']=_0x49ae46['params']['id'];}return db['VoiceRecording']['find']({'where':_0x36b352,'attributes':['id',_0xf686('0x55')],'raw':!![]})[_0xf686('0x2a')](handleEntityNotFound(_0x3b08be,null))[_0xf686('0x2a')](function(_0x49a550){if(_0x49a550){var _0x461c33=_0x49a550[_0xf686('0x55')];var _0x1b54a5=util[_0xf686('0x56')](_0xf686('0x57'),_0x461c33);if(fs[_0xf686('0x58')](_0x1b54a5)){_0x274d54=!![];return _0x3ae6f5[_0xf686('0x59')](_0x1b54a5,_0x461c33,config[_0xf686('0x5a')][_0xf686('0x5b')])[_0xf686('0x2a')](function(){return _0x49a550;});}return _0x49a550;}})[_0xf686('0x2a')](function(_0x5c4aec){if(_0x5c4aec){var _0x3bbeeb=_0x5c4aec[_0xf686('0x55')];if(!fs[_0xf686('0x58')](_0x3bbeeb)){throw new db[(_0xf686('0x5c'))][(_0xf686('0x5d'))](_0xf686('0x5e'));}if(_0x5c4aec['filename']){return _0x3b08be[_0xf686('0x52')](_0x3bbeeb,_0x5c4aec[_0xf686('0x5f')]+path[_0xf686('0x60')](_0x3bbeeb),function(){if(_0x274d54){fs[_0xf686('0x61')](_0x3bbeeb);}});}else{return _0x3b08be['download'](_0x3bbeeb,function(_0x3a0c31){if(_0x274d54){fs[_0xf686('0x61')](_0x3bbeeb);}});}}})['catch'](function(_0x19a627){if(_0x19a627[_0xf686('0x62')]===_0xf686('0x5e')){_0x3b08be[_0xf686('0x1f')](0x194)[_0xf686('0x63')]('Not\x20found');}else{return handleError(_0x3b08be,null);}});};exports[_0xf686('0x64')]=function(_0x38f510,_0x1931a2,_0x577602){var _0x126eb8=require(_0xf686('0x53'));var _0x3209b3=![];var _0x240870={'$and':[db[_0xf686('0x65')][_0xf686('0x3f')](db[_0xf686('0x65')]['fn'](_0xf686('0x66'),db[_0xf686('0x65')][_0xf686('0x67')](_0xf686('0x68'))),_0x38f510['query'][_0xf686('0x69')])]};if(_0x38f510[_0xf686('0x36')][_0xf686('0x31')]&&_0x38f510[_0xf686('0x36')][_0xf686('0x31')]===_0xf686('0x68')){_0x240870['$and']['push']({'uniqueid':_0x38f510[_0xf686('0x54')]['id']});}else{_0x240870[_0xf686('0x6a')][_0xf686('0x6b')]({'id':_0x38f510[_0xf686('0x54')]['id']});}return db[_0xf686('0x30')][_0xf686('0x4d')]({'where':_0x240870,'attributes':['id','value'],'raw':!![]})[_0xf686('0x2a')](handleEntityNotFound(_0x1931a2,null))['then'](function(_0x25a7f7){if(_0x25a7f7){var _0x141342=util[_0xf686('0x56')]('%s.cypher',_0x25a7f7['value']);if(fs[_0xf686('0x58')](_0x141342)){_0x3209b3=!![];return _0x126eb8[_0xf686('0x59')](_0x141342,_0x25a7f7[_0xf686('0x55')],config[_0xf686('0x5a')][_0xf686('0x5b')])[_0xf686('0x2a')](function(){return _0x25a7f7;});}return _0x25a7f7;}})[_0xf686('0x2a')](function(_0xa4dc74){if(_0xa4dc74){if(!fs['existsSync'](_0xa4dc74[_0xf686('0x55')])){throw new db['Sequelize'][(_0xf686('0x5d'))](_0xf686('0x5e'));}if(_0xa4dc74[_0xf686('0x5f')]){return _0x1931a2['download'](_0xa4dc74[_0xf686('0x55')],_0xa4dc74[_0xf686('0x5f')]+path['extname'](_0xa4dc74['value']),function(){if(_0x3209b3){fs[_0xf686('0x61')](_0xa4dc74[_0xf686('0x55')]);}});}else{return _0x1931a2[_0xf686('0x52')](_0xa4dc74[_0xf686('0x55')],function(_0x5005c8){if(_0x3209b3){fs[_0xf686('0x61')](_0xa4dc74[_0xf686('0x55')]);}});}}})['catch'](handleError(_0x1931a2,null));};exports[_0xf686('0x29')]=function(_0x5b4f46,_0x5a01e7){return db['VoiceRecording']['find']({'where':{'id':_0x5b4f46[_0xf686('0x54')]['id']}})[_0xf686('0x2a')](function(_0x4b3b88){if(_['isNil'](_0x4b3b88)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4b3b88;})['then'](function(_0x59a2f5){var _0x11f091=_0x59a2f5[_0xf686('0x55')];logger[_0xf686('0x6c')](_0xf686('0x6d'),_0x11f091);if(!_['isNil'](_0x59a2f5[_0xf686('0x55')])&&fs[_0xf686('0x58')](_0x11f091)){logger['info']('File:\x20\x22'+_0x11f091+_0xf686('0x6e'));fs[_0xf686('0x6f')](_0x11f091);}_0x11f091=_0x11f091+'.cypher';if(!_['isNil'](_0x59a2f5['value'])&&fs[_0xf686('0x58')](_0x11f091)){logger[_0xf686('0x6c')](_0xf686('0x70')+_0x11f091+_0xf686('0x6e'));fs[_0xf686('0x6f')](_0x11f091);}return _0x59a2f5;})['then'](function(_0x58c199){if(!_0x58c199)throw new InternalError();return _0x58c199[_0xf686('0x29')]();})[_0xf686('0x2a')](function(){_0x5a01e7[_0xf686('0x1f')](0xcc)['end']();})[_0xf686('0x48')](handleError(_0x5a01e7,null));};function getBucketslist(_0x5d0365,_0x46cac8,_0x17618c){return new Promise(function(_0x2f59e2,_0x518437){var _0x329f2c=new AWS['S3']({'accessKeyId':_0x46cac8,'secretAccessKey':_0x5d0365,'region':_0x17618c});_0x329f2c[_0xf686('0x71')]({},function(_0xfe3edc,_0x4b6a38){if(_0xfe3edc){return _0x518437(_0xfe3edc);}else{return _0x2f59e2(_0x4b6a38);}});});}function createBucket(_0x40ea58,_0x9bcccf,_0x24bbde,_0x3855cf){return new Promise(function(_0x4e555a,_0x26e3ab){var _0x171c8e=new AWS['S3']({'accessKeyId':_0x9bcccf,'secretAccessKey':_0x40ea58,'region':_0x24bbde});_0x171c8e['createBucket']({'Bucket':_0x3855cf},function(_0x1fdd5a,_0x1c1069){if(_0x1fdd5a){return _0x26e3ab(_0x1fdd5a);}else{return _0x4e555a(_0x1c1069);}});});}function uploadFile(_0xb753ae,_0x1d24ac,_0x2bfd03,_0x48bad9,_0x2f13bb,_0x140030){return new Promise(function(_0x2fa0b3,_0x509575){var _0x33193a=new AWS['S3']({'accessKeyId':_0x1d24ac,'secretAccessKey':_0xb753ae,'region':_0x2bfd03});_0x33193a['upload']({'Bucket':_0x48bad9,'Key':_0x2f13bb,'Body':_0x140030},function(_0x133530,_0x154865){if(_0x133530){return _0x509575(_0x133530);}else{return _0x2fa0b3(_0x154865);}});});}function startTranscribe(_0x419e37,_0x1033b3,_0x680de5,_0x8902ac,_0x27cd69,_0x43d628){return new Promise(function(_0x2c62bd,_0x5ef7e4){var _0x2973ac=new AWS['TranscribeService']({'accessKeyId':_0x1033b3,'secretAccessKey':_0x419e37,'region':_0x680de5});_0x2973ac[_0xf686('0x72')]({'TranscriptionJobName':_0x8902ac,'LanguageCode':_0x27cd69,'Media':{'MediaFileUri':_0x43d628}},function(_0x22e4c5,_0x169f7c){if(_0x22e4c5){return _0x5ef7e4(_0x22e4c5);}else{return _0x2c62bd(_0x169f7c);}});});}function transcribe(_0x588e50,_0x5902cc,_0x5ce4f9,_0x4188b3,_0x24f106,_0x482e7b,_0x2d6cb5){return new Promise(function(_0xfdffa7,_0x2e6e34){var _0x890e08={};logger[_0xf686('0x6c')](util['format'](_0xf686('0x73'),_0x588e50,_0x24f106));return uploadFile(_0x5902cc,_0x5ce4f9,_0x4188b3,_0x24f106,path[_0xf686('0x74')](_0x482e7b),fs['readFileSync'](_0x482e7b))[_0xf686('0x2a')](function(_0x264193){logger[_0xf686('0x6c')](util['format'](_0xf686('0x75'),_0x588e50,_0x24f106,_0x264193[_0xf686('0x76')]));_0x890e08[_0xf686('0x77')]=_0x264193[_0xf686('0x78')];_0x890e08[_0xf686('0x79')]=_0x264193['Location'];logger[_0xf686('0x6c')](util[_0xf686('0x56')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x588e50));return startTranscribe(_0x5902cc,_0x5ce4f9,_0x4188b3,uuidv4(),_0x2d6cb5,_0x264193[_0xf686('0x76')]);})[_0xf686('0x2a')](function(_0x4430a4){logger[_0xf686('0x6c')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x588e50,_0x4430a4[_0xf686('0x7a')][_0xf686('0x7b')]));_0x890e08['transcribeName']=_0x4430a4[_0xf686('0x7a')][_0xf686('0x7b')];_0x890e08[_0xf686('0x7c')]=_0x4430a4['TranscriptionJob']['TranscriptionJobStatus'];return _0xfdffa7(_0x890e08);})[_0xf686('0x48')](function(_0x242873){return _0x2e6e34(_0x242873);});});}exports[_0xf686('0x7d')]=function(_0x29bac6,_0x1d54b2,_0x4238f3){var _0x4addf0;var _0x4b9520;var _0x5b93e7;var _0xef5cfe=require(_0xf686('0x53'));return db[_0xf686('0x30')][_0xf686('0x7e')]({'where':{'id':_0x29bac6['params']['id']}})['then'](function(_0x1b4802){if(_0x1b4802){var _0x4bdb38=util[_0xf686('0x56')](_0xf686('0x57'),_0x1b4802['value']);if(fs[_0xf686('0x58')](_0x4bdb38)){cypher=!![];return _0xef5cfe[_0xf686('0x59')](_0x4bdb38,_0x1b4802[_0xf686('0x55')],config[_0xf686('0x5a')]['recording'])[_0xf686('0x2a')](function(){return _0x1b4802;});}return _0x1b4802;}})[_0xf686('0x2a')](function(_0x4cc44f){if(!_0x4cc44f){throw new db['Sequelize'][(_0xf686('0x5d'))](_0xf686('0x7f'));}_0x4b9520=_0x4cc44f;return db[_0xf686('0x80')]['findOne']({'where':{'id':0x1}});})[_0xf686('0x2a')](handleEntityNotFound(_0x1d54b2,null))[_0xf686('0x2a')](function(_0x5d95d8){if(_0x5d95d8){_0x4addf0=_0x5d95d8;if(!_0x4addf0[_0xf686('0x81')]||!_0x4addf0[_0xf686('0x82')]||!_0x4addf0[_0xf686('0x83')]||!_0x4addf0['language']||!_0x4addf0['bucket']){throw new db[(_0xf686('0x5c'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x29bac6[_0xf686('0x50')][_0xf686('0x84')]&&(!_0x4addf0[_0xf686('0x85')]||!_0x4addf0['sentimentAccountId']||!_0x4addf0[_0xf686('0x86')]||!_0x4addf0[_0xf686('0x87')]||!_0x4addf0[_0xf686('0x77')])){throw new db[(_0xf686('0x5c'))]['ValidationError'](_0xf686('0x88'));}return db[_0xf686('0x89')][_0xf686('0x7e')]({'where':{'id':_0x4addf0[_0xf686('0x82')]}});}})[_0xf686('0x2a')](function(_0x5c5a9a){if(!_0x5c5a9a){throw new db[(_0xf686('0x5c'))][(_0xf686('0x5d'))](_0xf686('0x8a'));}if(!_0x5c5a9a[_0xf686('0x8b')]||!_0x5c5a9a['data2']){throw new db[(_0xf686('0x5c'))][(_0xf686('0x5d'))](_0xf686('0x8c'));}_0x5b93e7=_0x5c5a9a;return getBucketslist(_0x5b93e7[_0xf686('0x8b')],_0x5b93e7['data2'],_0x4addf0[_0xf686('0x83')]);})['then'](function(_0xb30ad1){if(_0xb30ad1&&_0xb30ad1[_0xf686('0x8d')]){var _0xbd135d=_[_0xf686('0x4d')](_0xb30ad1[_0xf686('0x8d')],function(_0x19b694){return _0x19b694[_0xf686('0x8e')]===_0x4addf0[_0xf686('0x77')];});if(!_0xbd135d){logger[_0xf686('0x6c')](util[_0xf686('0x56')](_0xf686('0x8f'),_0x29bac6['params']['id'],_0x4addf0[_0xf686('0x77')]));return createBucket(_0x5b93e7['data1'],_0x5b93e7[_0xf686('0x90')],_0x4addf0['transcribeRegion'],_0x4addf0[_0xf686('0x77')]);}logger[_0xf686('0x6c')](util[_0xf686('0x56')](_0xf686('0x91'),_0x29bac6[_0xf686('0x54')]['id'],_0x4addf0['bucket']));return;}})[_0xf686('0x2a')](function(_0x2a89f5){if(_0x4b9520[_0xf686('0x7c')]===_0xf686('0x92')){return transcribe(_0x29bac6[_0xf686('0x54')]['id'],_0x5b93e7['data1'],_0x5b93e7[_0xf686('0x90')],_0x4addf0[_0xf686('0x83')],_0x4addf0[_0xf686('0x77')],_0x4b9520[_0xf686('0x55')],_0x4addf0[_0xf686('0x87')]);}else{logger[_0xf686('0x6c')](util[_0xf686('0x56')](_0xf686('0x93'),_0x29bac6[_0xf686('0x54')]['id']));return{'transcribeStatus':_0xf686('0x94')};}})[_0xf686('0x2a')](function(_0x36ab70){if(_0x36ab70){_0x36ab70[_0xf686('0x95')]=_0x29bac6[_0xf686('0x50')][_0xf686('0x84')];return _0x4b9520['updateAttributes'](_0x36ab70);}})['then'](respondWithResult(_0x1d54b2,null))['catch'](handleError(_0x1d54b2,null));};function writeFile(_0x9977b1,_0x19fc03){return new Promise(function(_0x36de0d,_0x7f0a49){fs['writeFile'](_0x19fc03,_0x9977b1,function(_0x1b62c8,_0x567109){if(_0x1b62c8){return _0x7f0a49(_0x1b62c8);}else{return _0x36de0d(_0x567109);}});});}exports[_0xf686('0x96')]=function(_0x425e94,_0x4a9ae4,_0x25ff28){return db[_0xf686('0x30')][_0xf686('0x7e')]({'where':{'id':_0x425e94['params']['id']}})[_0xf686('0x2a')](handleEntityNotFound(_0x4a9ae4))[_0xf686('0x2a')](function(_0x547b71){if(_0x547b71&&_0x547b71[_0xf686('0x97')]){var _0x22bd4e=_0x547b71[_0xf686('0x97')];var _0x57e916=config[_0xf686('0x98')]+'/server/files/transcribes/transcribe_'+_0x547b71['id']+_0xf686('0x99');if(fs[_0xf686('0x58')](_0x57e916)){return _0x57e916;}return writeFile(_0x22bd4e,_0x57e916)['then'](function(){return _0x57e916;});}else{throw new db['Sequelize'][(_0xf686('0x5d'))](_0xf686('0x9a'));}})['then'](function(_0x43ead4){return _0x4a9ae4[_0xf686('0x52')](_0x43ead4);})[_0xf686('0x48')](handleError(_0x4a9ae4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b08d2a0..100d4b5 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 _0x1c63=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x1c63,0xdc));var _0x31c6=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0x1c63[_0xe33b12];return _0x30699d;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var logger=require(_0x31c6('0x2'))(_0x31c6('0x3'));var moment=require('moment');var BPromise=require(_0x31c6('0x4'));var rp=require(_0x31c6('0x5'));var fs=require('fs');var path=require(_0x31c6('0x6'));var rimraf=require('rimraf');var config=require(_0x31c6('0x7'));var attributes=require(_0x31c6('0x8'));module[_0x31c6('0x9')]=function(_0x1f4994,_0xfd3cf3){return _0x1f4994['define']('VoiceRecording',attributes,{'tableName':_0x31c6('0xa'),'paranoid':![],'indexes':[{'name':_0x31c6('0xb'),'fields':[_0x31c6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7da6=['rimraf','../../config/environment','./voiceRecording.attributes','exports','define','uniqueid','../../config/logger','api','moment','bluebird','path'];(function(_0x1b2566,_0x4b3059){var _0x4eb987=function(_0x20fef6){while(--_0x20fef6){_0x1b2566['push'](_0x1b2566['shift']());}};_0x4eb987(++_0x4b3059);}(_0x7da6,0x124));var _0x67da=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x7da6[_0x16ea87];return _0x6e7b1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x67da('0x0'))(_0x67da('0x1'));var moment=require(_0x67da('0x2'));var BPromise=require(_0x67da('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67da('0x4'));var rimraf=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var attributes=require(_0x67da('0x7'));module[_0x67da('0x8')]=function(_0x40d5f8,_0x59af9a){return _0x40d5f8[_0x67da('0x9')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x67da('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index dcc7ced..1af4db1 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 _0xb145=['info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','create','existsSync','format','value','encryptFile','recording','unlink','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb145,0xa3));var _0x5b14=function(_0x190b8d,_0x325a21){_0x190b8d=_0x190b8d-0x0;var _0x35671c=_0xb145[_0x190b8d];return _0x35671c;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['UpdateVoiceRecording']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')](_0x48d395[_0x5b14('0x19')],{'raw':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d395['options']?_0x48d395['options'][_0x5b14('0x1b')]||null:null,'attributes':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1c')]||null:null,'limit':_0x48d395['options']?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1d')]||null:null})['then'](function(_0x2d7b38){logger[_0x5b14('0xd')]('UpdateVoiceRecording',_0x48d395);logger[_0x5b14('0xf')]('UpdateVoiceRecording',_0x48d395,JSON['stringify'](_0x2d7b38));_0x3f397d(_0x2d7b38);})['catch'](function(_0x4def4b){logger[_0x5b14('0x12')](_0x5b14('0x1e'),_0x4def4b[_0x5b14('0x14')],_0x48d395);_0x3035b5(_0x58bf3c['error'](0x1f4,_0x4def4b[_0x5b14('0x14')]));});});};exports[_0x5b14('0x1f')]=function(_0x2ac7b0){var _0x143648=this;return new Promise(function(_0xe6851b,_0x1bbbd7){var _0x422d22=require(_0x5b14('0x20'));var _0x296d65;return db[_0x5b14('0x21')][_0x5b14('0x22')]({'attributes':['id',_0x5b14('0x23')],'where':{'id':0x1},'raw':!![]})[_0x5b14('0x24')](function(_0x266bbe){_0x296d65=_0x266bbe;return db['VoiceRecording'][_0x5b14('0x25')](_0x2ac7b0[_0x5b14('0x19')]);})['then'](function(_0x4ecf7c){if(_0x296d65[_0x5b14('0x23')]&&fs[_0x5b14('0x26')](_0x4ecf7c['value'])){var _0x4c1f0e=util[_0x5b14('0x27')]('%s.cypher',_0x4ecf7c[_0x5b14('0x28')]);return _0x422d22[_0x5b14('0x29')](_0x4ecf7c['value'],_0x4c1f0e,config['secrets'][_0x5b14('0x2a')])[_0x5b14('0x24')](function(){fs[_0x5b14('0x2b')](_0x4ecf7c['value']);logger[_0x5b14('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4ecf7c;});}return _0x4ecf7c;})[_0x5b14('0x24')](function(_0x291c92){logger[_0x5b14('0xd')](_0x5b14('0x1f'),_0x2ac7b0);logger['debug'](_0x5b14('0x1f'),_0x2ac7b0,JSON[_0x5b14('0x11')](_0x291c92));_0xe6851b(_0x291c92);})[_0x5b14('0x16')](function(_0x37f62c){logger['error'](_0x5b14('0x1f'),_0x37f62c[_0x5b14('0x14')],_0x2ac7b0);_0x1bbbd7(_0x143648[_0x5b14('0x12')](0x1f4,_0x37f62c['message']));});});}; \ No newline at end of file +var _0x2272=['client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','encryptFile','secrets','recording','unlink','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x4a7529,_0xba0830){var _0x254252=function(_0x53cbea){while(--_0x53cbea){_0x4a7529['push'](_0x4a7529['shift']());}};_0x254252(++_0xba0830);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'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')]('VoiceRecording,\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')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f75['options']?_0x531f75[_0x2227('0x1c')][_0x2227('0x1e')]||null:null,'attributes':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x1f')]||null:null,'limit':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x20')]||null:null})[_0x2227('0xc')](function(_0x34c090){logger[_0x2227('0xd')]('UpdateVoiceRecording',_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x34c090));_0x620012(_0x34c090);})[_0x2227('0x17')](function(_0xbfdce1){logger['error']('UpdateVoiceRecording',_0xbfdce1[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0xbfdce1[_0x2227('0x15')]));});});};exports[_0x2227('0x21')]=function(_0x5be889){var _0x191a3e=this;return new Promise(function(_0x301304,_0x2d8ea0){var _0x1957ee=require('../../components/encryptor');var _0x204def;return db[_0x2227('0x22')][_0x2227('0x23')]({'attributes':['id',_0x2227('0x24')],'where':{'id':0x1},'raw':!![]})[_0x2227('0xc')](function(_0x4789eb){_0x204def=_0x4789eb;return db['VoiceRecording']['create'](_0x5be889[_0x2227('0x1b')]);})['then'](function(_0x2ba581){if(_0x204def[_0x2227('0x24')]&&fs['existsSync'](_0x2ba581['value'])){var _0x1f1ba7=util[_0x2227('0x25')](_0x2227('0x26'),_0x2ba581['value']);return _0x1957ee[_0x2227('0x27')](_0x2ba581['value'],_0x1f1ba7,config[_0x2227('0x28')][_0x2227('0x29')])[_0x2227('0xc')](function(){fs[_0x2227('0x2a')](_0x2ba581[_0x2227('0x2b')]);logger[_0x2227('0xd')](_0x2227('0x2c'));return _0x2ba581;});}return _0x2ba581;})[_0x2227('0xc')](function(_0xd38f59){logger[_0x2227('0xd')](_0x2227('0x21'),_0x5be889);logger['debug'](_0x2227('0x21'),_0x5be889,JSON[_0x2227('0x11')](_0xd38f59));_0x301304(_0xd38f59);})[_0x2227('0x17')](function(_0x6cd5d7){logger['error'](_0x2227('0x21'),_0x6cd5d7[_0x2227('0x15')],_0x5be889);_0x2d8ea0(_0x191a3e[_0x2227('0x12')](0x1f4,_0x6cd5d7[_0x2227('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 172eac0..9cec95b 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 _0x2315=['show','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x504a25,_0x191ad4){var _0x3a8efe=function(_0x38b4a9){while(--_0x38b4a9){_0x504a25['push'](_0x504a25['shift']());}};_0x3a8efe(++_0x191ad4);}(_0x2315,0xfc));var _0x5231=function(_0x8004b5,_0x4932b2){_0x8004b5=_0x8004b5-0x0;var _0x1a5e1f=_0x2315[_0x8004b5];return _0x1a5e1f;};'use strict';var multer=require(_0x5231('0x0'));var util=require('util');var path=require(_0x5231('0x1'));var timeout=require('connect-timeout');var express=require(_0x5231('0x2'));var router=express[_0x5231('0x3')]();var fs_extra=require(_0x5231('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5231('0x5'));var config=require(_0x5231('0x6'));var controller=require(_0x5231('0x7'));router['get']('/',auth[_0x5231('0x8')](),controller[_0x5231('0x9')]);router[_0x5231('0xa')](_0x5231('0xb'),auth[_0x5231('0x8')](),controller[_0x5231('0xc')]);router['get'](_0x5231('0xd'),auth[_0x5231('0x8')](),controller[_0x5231('0xe')]);router['post']('/',auth[_0x5231('0x8')](),controller[_0x5231('0xf')]);router[_0x5231('0x10')]('/:id',auth[_0x5231('0x8')](),controller[_0x5231('0x11')]);router['delete']('/:id',auth[_0x5231('0x8')](),controller['destroy']);module[_0x5231('0x12')]=router; \ No newline at end of file +var _0x0760=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4c7201,_0x45388f){var _0x4bddca=function(_0x1312f1){while(--_0x1312f1){_0x4c7201['push'](_0x4c7201['shift']());}};_0x4bddca(++_0x45388f);}(_0x0760,0xf6));var _0x0076=function(_0x58c10d,_0x1d5885){_0x58c10d=_0x58c10d-0x0;var _0x6b0ecd=_0x0760[_0x58c10d];return _0x6b0ecd;};'use strict';var multer=require('multer');var util=require(_0x0076('0x0'));var path=require(_0x0076('0x1'));var timeout=require(_0x0076('0x2'));var express=require(_0x0076('0x3'));var router=express[_0x0076('0x4')]();var fs_extra=require(_0x0076('0x5'));var auth=require(_0x0076('0x6'));var interaction=require(_0x0076('0x7'));var config=require(_0x0076('0x8'));var controller=require(_0x0076('0x9'));router[_0x0076('0xa')]('/',auth[_0x0076('0xb')](),controller[_0x0076('0xc')]);router[_0x0076('0xa')]('/describe',auth[_0x0076('0xb')](),controller[_0x0076('0xd')]);router[_0x0076('0xa')](_0x0076('0xe'),auth[_0x0076('0xb')](),controller['show']);router[_0x0076('0xf')]('/',auth['isAuthenticated'](),controller[_0x0076('0x10')]);router[_0x0076('0x11')]('/:id',auth[_0x0076('0xb')](),controller['update']);router[_0x0076('0x12')](_0x0076('0xe'),auth[_0x0076('0xb')](),controller[_0x0076('0x13')]);module[_0x0076('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 45469df..2ed55c4 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 _0x20f3=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x4683b5,_0x51a68c){var _0x1f23aa=function(_0x2d8316){while(--_0x2d8316){_0x4683b5['push'](_0x4683b5['shift']());}};_0x1f23aa(++_0x51a68c);}(_0x20f3,0x149));var _0x320f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x20f3[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x320f('0x0'));var moment=require(_0x320f('0x1'));module[_0x320f('0x2')]={'type':{'type':Sequelize[_0x320f('0x3')](_0x320f('0x4'),_0x320f('0x5'))},'result':{'type':Sequelize[_0x320f('0x6')]},'transfererchannel':{'type':Sequelize[_0x320f('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x320f('0x6')]},'transferercalleridname':{'type':Sequelize[_0x320f('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x320f('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x320f('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x320f('0x6')]},'transferercontext':{'type':Sequelize[_0x320f('0x6')]},'transfererexten':{'type':Sequelize[_0x320f('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x320f('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x320f('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x320f('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x320f('0x6')]},'isexternal':{'type':Sequelize[_0x320f('0x3')](_0x320f('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x70f3=['Yes','moment','ENUM','blind','attended','STRING'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x70f3,0x79));var _0x370f=function(_0x159e29,_0x53d9ca){_0x159e29=_0x159e29-0x0;var _0x429903=_0x70f3[_0x159e29];return _0x429903;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x370f('0x0'));module['exports']={'type':{'type':Sequelize[_0x370f('0x1')](_0x370f('0x2'),_0x370f('0x3'))},'result':{'type':Sequelize[_0x370f('0x4')]},'transfererchannel':{'type':Sequelize[_0x370f('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x370f('0x4')]},'transferercalleridname':{'type':Sequelize[_0x370f('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x370f('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x370f('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x370f('0x4')]},'transferercontext':{'type':Sequelize[_0x370f('0x4')]},'transfererexten':{'type':Sequelize[_0x370f('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x370f('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x370f('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x370f('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x370f('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x370f('0x4')]},'isexternal':{'type':Sequelize[_0x370f('0x1')](_0x370f('0x5'),'No')},'context':{'type':Sequelize[_0x370f('0x4')]},'extension':{'type':Sequelize[_0x370f('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 00a0570..3d528bd 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 _0x976b=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','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/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','key','model','query'];(function(_0x979bfa,_0x3dc593){var _0x288866=function(_0x134d5c){while(--_0x134d5c){_0x979bfa['push'](_0x979bfa['shift']());}};_0x288866(++_0x3dc593);}(_0x976b,0xfd));var _0xb976=function(_0x6620ce,_0xbf690){_0x6620ce=_0x6620ce-0x0;var _0x31c9c7=_0x976b[_0x6620ce];return _0x31c9c7;};'use strict';var emlformat=require(_0xb976('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb976('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb976('0x2'));var moment=require(_0xb976('0x3'));var BPromise=require(_0xb976('0x4'));var Mustache=require(_0xb976('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb976('0x6'));var csv=require('to-csv');var ejs=require(_0xb976('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb976('0x8'));var crypto=require('crypto');var jsforce=require(_0xb976('0x9'));var deskjs=require(_0xb976('0xa'));var toCsv=require(_0xb976('0xb'));var querystring=require(_0xb976('0xc'));var Papa=require(_0xb976('0xd'));var Redis=require(_0xb976('0xe'));var authService=require(_0xb976('0xf'));var qs=require(_0xb976('0x10'));var as=require(_0xb976('0x11'));var hardwareService=require(_0xb976('0x12'));var logger=require(_0xb976('0x13'))('api');var utils=require(_0xb976('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb976('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41184f,_0x41d2f2){_0x41d2f2=_0x41d2f2||0xcc;return function(_0x2f18df){if(_0x2f18df){return _0x41184f[_0xb976('0x16')](_0x41d2f2);}return _0x41184f['status'](_0x41d2f2)[_0xb976('0x17')]();};}function respondWithResult(_0x72f6a5,_0x2ccd0f){_0x2ccd0f=_0x2ccd0f||0xc8;return function(_0x4d8aa1){if(_0x4d8aa1){return _0x72f6a5[_0xb976('0x18')](_0x2ccd0f)[_0xb976('0x19')](_0x4d8aa1);}};}function respondWithFilteredResult(_0x536e35,_0x26b76d){return function(_0x3003eb){if(_0x3003eb){var _0x141b4e=typeof _0x26b76d[_0xb976('0x1a')]===_0xb976('0x1b')&&typeof _0x26b76d[_0xb976('0x1c')]===_0xb976('0x1b');var _0x1f138c=_0x3003eb['count'];var _0x1520d9=_0x141b4e?0x0:_0x26b76d[_0xb976('0x1a')];var _0x27aaee=_0x141b4e?_0x3003eb['count']:_0x26b76d['offset']+_0x26b76d[_0xb976('0x1c')];var _0x3dfc2d;if(_0x27aaee>=_0x1f138c){_0x27aaee=_0x1f138c;_0x3dfc2d=0xc8;}else{_0x3dfc2d=0xce;}_0x536e35[_0xb976('0x18')](_0x3dfc2d);return _0x536e35[_0xb976('0x1d')](_0xb976('0x1e'),_0x1520d9+'-'+_0x27aaee+'/'+_0x1f138c)[_0xb976('0x19')](_0x3003eb);}return null;};}function patchUpdates(_0x27ec26){return function(_0x427b0b){try{jsonpatch[_0xb976('0x1f')](_0x427b0b,_0x27ec26,!![]);}catch(_0x51c634){return BPromise[_0xb976('0x20')](_0x51c634);}return _0x427b0b[_0xb976('0x21')]();};}function saveUpdates(_0x149c3b,_0x1e4147){return function(_0x13adbe){if(_0x13adbe){return _0x13adbe[_0xb976('0x22')](_0x149c3b)[_0xb976('0x23')](function(_0x334ef7){return _0x334ef7;});}return null;};}function removeEntity(_0x44b004,_0x557119){return function(_0x7116f){if(_0x7116f){return _0x7116f[_0xb976('0x24')]()['then'](function(){_0x44b004[_0xb976('0x18')](0xcc)[_0xb976('0x17')]();});}};}function handleEntityNotFound(_0x363fb8,_0xab2e3c){return function(_0x893e35){if(!_0x893e35){_0x363fb8[_0xb976('0x16')](0x194);}return _0x893e35;};}function handleError(_0x507974,_0x5861a0){_0x5861a0=_0x5861a0||0x1f4;return function(_0x47a8fc){logger['error'](_0x47a8fc[_0xb976('0x25')]);if(_0x47a8fc[_0xb976('0x26')]){delete _0x47a8fc[_0xb976('0x26')];}_0x507974[_0xb976('0x18')](_0x5861a0)[_0xb976('0x27')](_0x47a8fc);};}exports[_0xb976('0x28')]=function(_0x2c9fb9,_0x157c94){var _0x236ee2={},_0x290704={},_0x1de002={'count':0x0,'rows':[]};var _0x53b286=_[_0xb976('0x29')](db[_0xb976('0x2a')]['rawAttributes'],function(_0x5921a9){return{'name':_0x5921a9[_0xb976('0x2b')],'type':_0x5921a9['type'][_0xb976('0x2c')]};});_0x290704[_0xb976('0x2d')]=_[_0xb976('0x29')](_0x53b286,_0xb976('0x26'));_0x290704[_0xb976('0x2e')]=_[_0xb976('0x2f')](_0x2c9fb9[_0xb976('0x2e')]);_0x290704[_0xb976('0x30')]=_['intersection'](_0x290704['model'],_0x290704[_0xb976('0x2e')]);_0x236ee2[_0xb976('0x31')]=_[_0xb976('0x32')](_0x290704[_0xb976('0x2d')],qs[_0xb976('0x33')](_0x2c9fb9[_0xb976('0x2e')]['fields']));_0x236ee2[_0xb976('0x31')]=_0x236ee2[_0xb976('0x31')][_0xb976('0x34')]?_0x236ee2[_0xb976('0x31')]:_0x290704['model'];if(!_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x35')](_0xb976('0x36'))){_0x236ee2[_0xb976('0x1c')]=qs['limit'](_0x2c9fb9[_0xb976('0x2e')]['limit']);_0x236ee2[_0xb976('0x1a')]=qs[_0xb976('0x1a')](_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x1a')]);}_0x236ee2[_0xb976('0x37')]=qs[_0xb976('0x38')](_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x38')]);_0x236ee2['where']=qs['filters'](_[_0xb976('0x39')](_0x2c9fb9[_0xb976('0x2e')],_0x290704[_0xb976('0x30')]),_0x53b286);if(_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x3a')]){_0x236ee2[_0xb976('0x3b')]=_[_0xb976('0x3c')](_0x236ee2[_0xb976('0x3b')],{'$or':_[_0xb976('0x29')](_0x53b286,function(_0x7c613d){if(_0x7c613d[_0xb976('0x3d')]!=='VIRTUAL'){var _0x11b132={};_0x11b132[_0x7c613d['name']]={'$like':'%'+_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x3a')]+'%'};return _0x11b132;}})});}_0x236ee2=_[_0xb976('0x3c')]({},_0x236ee2,_0x2c9fb9[_0xb976('0x3e')]);var _0x499b6f={'where':_0x236ee2[_0xb976('0x3b')]};return db[_0xb976('0x2a')][_0xb976('0x3f')](_0x499b6f)[_0xb976('0x23')](function(_0x29deaf){_0x1de002[_0xb976('0x3f')]=_0x29deaf;if(_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x40')]){_0x236ee2[_0xb976('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x236ee2);})[_0xb976('0x23')](function(_0x41873c){_0x1de002[_0xb976('0x42')]=_0x41873c;return _0x1de002;})['then'](respondWithFilteredResult(_0x157c94,_0x236ee2))[_0xb976('0x43')](handleError(_0x157c94,null));};exports[_0xb976('0x44')]=function(_0x2c6f24,_0x56118c){var _0x23ed2e={'raw':!![],'where':{'id':_0x2c6f24[_0xb976('0x45')]['id']}},_0x26af8b={};_0x26af8b[_0xb976('0x2d')]=_[_0xb976('0x2f')](db[_0xb976('0x2a')][_0xb976('0x46')]);_0x26af8b['query']=_[_0xb976('0x2f')](_0x2c6f24['query']);_0x26af8b[_0xb976('0x30')]=_[_0xb976('0x32')](_0x26af8b[_0xb976('0x2d')],_0x26af8b[_0xb976('0x2e')]);_0x23ed2e[_0xb976('0x31')]=_[_0xb976('0x32')](_0x26af8b[_0xb976('0x2d')],qs[_0xb976('0x33')](_0x2c6f24[_0xb976('0x2e')][_0xb976('0x33')]));_0x23ed2e[_0xb976('0x31')]=_0x23ed2e['attributes'][_0xb976('0x34')]?_0x23ed2e[_0xb976('0x31')]:_0x26af8b[_0xb976('0x2d')];if(_0x2c6f24[_0xb976('0x2e')][_0xb976('0x40')]){_0x23ed2e[_0xb976('0x41')]=[{'all':!![]}];}_0x23ed2e=_[_0xb976('0x3c')]({},_0x23ed2e,_0x2c6f24[_0xb976('0x3e')]);return db[_0xb976('0x2a')][_0xb976('0x47')](_0x23ed2e)[_0xb976('0x23')](handleEntityNotFound(_0x56118c,null))[_0xb976('0x23')](respondWithResult(_0x56118c,null))[_0xb976('0x43')](handleError(_0x56118c,null));};exports[_0xb976('0x48')]=function(_0x5795f4,_0x5eba30){return db[_0xb976('0x2a')][_0xb976('0x48')](_0x5795f4[_0xb976('0x49')],{})['then'](respondWithResult(_0x5eba30,0xc9))[_0xb976('0x43')](handleError(_0x5eba30,null));};exports[_0xb976('0x22')]=function(_0x33a99d,_0x8b10fa){if(_0x33a99d[_0xb976('0x49')]['id']){delete _0x33a99d[_0xb976('0x49')]['id'];}return db[_0xb976('0x2a')][_0xb976('0x47')]({'where':{'id':_0x33a99d[_0xb976('0x45')]['id']}})['then'](handleEntityNotFound(_0x8b10fa,null))['then'](saveUpdates(_0x33a99d[_0xb976('0x49')],null))[_0xb976('0x23')](respondWithResult(_0x8b10fa,null))[_0xb976('0x43')](handleError(_0x8b10fa,null));};exports[_0xb976('0x24')]=function(_0x120567,_0x1fdcfc){return db[_0xb976('0x2a')][_0xb976('0x47')]({'where':{'id':_0x120567[_0xb976('0x45')]['id']}})[_0xb976('0x23')](handleEntityNotFound(_0x1fdcfc,null))[_0xb976('0x23')](removeEntity(_0x1fdcfc,null))[_0xb976('0x43')](handleError(_0x1fdcfc,null));};exports[_0xb976('0x4a')]=function(_0x2e051b,_0x52eb18){return db[_0xb976('0x2a')]['describe']()[_0xb976('0x23')](respondWithResult(_0x52eb18,null))['catch'](handleError(_0x52eb18,null));}; \ No newline at end of file +var _0xcad0=['api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','fields','length','includeAll','find','create','update','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x50b139,_0x15ded7){var _0x3ccbb5=function(_0x4df0a3){while(--_0x4df0a3){_0x50b139['push'](_0x50b139['shift']());}};_0x3ccbb5(++_0x15ded7);}(_0xcad0,0x195));var _0x0cad=function(_0x3bd208,_0x3a59c2){_0x3bd208=_0x3bd208-0x0;var _0x97a34f=_0xcad0[_0x3bd208];return _0x97a34f;};'use strict';var emlformat=require(_0x0cad('0x0'));var rimraf=require(_0x0cad('0x1'));var zipdir=require(_0x0cad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0cad('0x3'));var moment=require('moment');var BPromise=require(_0x0cad('0x4'));var Mustache=require(_0x0cad('0x5'));var util=require('util');var path=require(_0x0cad('0x6'));var sox=require(_0x0cad('0x7'));var csv=require(_0x0cad('0x8'));var ejs=require(_0x0cad('0x9'));var fs=require('fs');var fs_extra=require(_0x0cad('0xa'));var _=require(_0x0cad('0xb'));var squel=require('squel');var crypto=require(_0x0cad('0xc'));var jsforce=require(_0x0cad('0xd'));var deskjs=require(_0x0cad('0xe'));var toCsv=require(_0x0cad('0x8'));var querystring=require(_0x0cad('0xf'));var Papa=require(_0x0cad('0x10'));var Redis=require('ioredis');var authService=require(_0x0cad('0x11'));var qs=require(_0x0cad('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cad('0x13'));var logger=require(_0x0cad('0x14'))(_0x0cad('0x15'));var utils=require('../../config/utils');var config=require(_0x0cad('0x16'));var licenseUtil=require(_0x0cad('0x17'));var db=require(_0x0cad('0x18'))['db'];function respondWithStatusCode(_0x912308,_0x43a889){_0x43a889=_0x43a889||0xcc;return function(_0x52324c){if(_0x52324c){return _0x912308['sendStatus'](_0x43a889);}return _0x912308[_0x0cad('0x19')](_0x43a889)['end']();};}function respondWithResult(_0x2e35fb,_0x640f4){_0x640f4=_0x640f4||0xc8;return function(_0x19444e){if(_0x19444e){return _0x2e35fb['status'](_0x640f4)[_0x0cad('0x1a')](_0x19444e);}};}function respondWithFilteredResult(_0x2da7fd,_0x126879){return function(_0x207651){if(_0x207651){var _0x31f775=typeof _0x126879[_0x0cad('0x1b')]===_0x0cad('0x1c')&&typeof _0x126879[_0x0cad('0x1d')]===_0x0cad('0x1c');var _0x15ea42=_0x207651[_0x0cad('0x1e')];var _0x3cce2c=_0x31f775?0x0:_0x126879[_0x0cad('0x1b')];var _0x4042b6=_0x31f775?_0x207651[_0x0cad('0x1e')]:_0x126879[_0x0cad('0x1b')]+_0x126879[_0x0cad('0x1d')];var _0x2adfc2;if(_0x4042b6>=_0x15ea42){_0x4042b6=_0x15ea42;_0x2adfc2=0xc8;}else{_0x2adfc2=0xce;}_0x2da7fd[_0x0cad('0x19')](_0x2adfc2);return _0x2da7fd['set'](_0x0cad('0x1f'),_0x3cce2c+'-'+_0x4042b6+'/'+_0x15ea42)[_0x0cad('0x1a')](_0x207651);}return null;};}function patchUpdates(_0xca6358){return function(_0xdd8a33){try{jsonpatch[_0x0cad('0x20')](_0xdd8a33,_0xca6358,!![]);}catch(_0x5c6f22){return BPromise[_0x0cad('0x21')](_0x5c6f22);}return _0xdd8a33['save']();};}function saveUpdates(_0x37ae50,_0x1e69ca){return function(_0x33b020){if(_0x33b020){return _0x33b020['update'](_0x37ae50)[_0x0cad('0x22')](function(_0x4c19de){return _0x4c19de;});}return null;};}function removeEntity(_0x318cae,_0x576f46){return function(_0x308137){if(_0x308137){return _0x308137[_0x0cad('0x23')]()['then'](function(){_0x318cae[_0x0cad('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cb58,_0x49f6be){return function(_0x2b8196){if(!_0x2b8196){_0x18cb58[_0x0cad('0x24')](0x194);}return _0x2b8196;};}function handleError(_0x148f71,_0x352f95){_0x352f95=_0x352f95||0x1f4;return function(_0x3a4da0){logger['error'](_0x3a4da0[_0x0cad('0x25')]);if(_0x3a4da0[_0x0cad('0x26')]){delete _0x3a4da0[_0x0cad('0x26')];}_0x148f71[_0x0cad('0x19')](_0x352f95)[_0x0cad('0x27')](_0x3a4da0);};}exports['index']=function(_0x30f0f6,_0x185726){var _0xb6ad57={},_0x49bcd4={},_0x41fee8={'count':0x0,'rows':[]};var _0x59a3f0=_[_0x0cad('0x28')](db[_0x0cad('0x29')][_0x0cad('0x2a')],function(_0x11a325){return{'name':_0x11a325[_0x0cad('0x2b')],'type':_0x11a325['type']['key']};});_0x49bcd4['model']=_['map'](_0x59a3f0,_0x0cad('0x26'));_0x49bcd4[_0x0cad('0x2c')]=_['keys'](_0x30f0f6[_0x0cad('0x2c')]);_0x49bcd4[_0x0cad('0x2d')]=_[_0x0cad('0x2e')](_0x49bcd4[_0x0cad('0x2f')],_0x49bcd4[_0x0cad('0x2c')]);_0xb6ad57['attributes']=_[_0x0cad('0x2e')](_0x49bcd4['model'],qs['fields'](_0x30f0f6[_0x0cad('0x2c')]['fields']));_0xb6ad57['attributes']=_0xb6ad57[_0x0cad('0x30')]['length']?_0xb6ad57[_0x0cad('0x30')]:_0x49bcd4['model'];if(!_0x30f0f6[_0x0cad('0x2c')]['hasOwnProperty'](_0x0cad('0x31'))){_0xb6ad57[_0x0cad('0x1d')]=qs[_0x0cad('0x1d')](_0x30f0f6[_0x0cad('0x2c')][_0x0cad('0x1d')]);_0xb6ad57[_0x0cad('0x1b')]=qs[_0x0cad('0x1b')](_0x30f0f6[_0x0cad('0x2c')]['offset']);}_0xb6ad57[_0x0cad('0x32')]=qs[_0x0cad('0x33')](_0x30f0f6[_0x0cad('0x2c')][_0x0cad('0x33')]);_0xb6ad57[_0x0cad('0x34')]=qs[_0x0cad('0x2d')](_[_0x0cad('0x35')](_0x30f0f6[_0x0cad('0x2c')],_0x49bcd4['filters']),_0x59a3f0);if(_0x30f0f6[_0x0cad('0x2c')][_0x0cad('0x36')]){_0xb6ad57[_0x0cad('0x34')]=_[_0x0cad('0x37')](_0xb6ad57[_0x0cad('0x34')],{'$or':_['map'](_0x59a3f0,function(_0x1e0c9d){if(_0x1e0c9d['type']!==_0x0cad('0x38')){var _0x4e9d8c={};_0x4e9d8c[_0x1e0c9d[_0x0cad('0x26')]]={'$like':'%'+_0x30f0f6['query'][_0x0cad('0x36')]+'%'};return _0x4e9d8c;}})});}_0xb6ad57=_[_0x0cad('0x37')]({},_0xb6ad57,_0x30f0f6[_0x0cad('0x39')]);var _0x1ed6e5={'where':_0xb6ad57[_0x0cad('0x34')]};return db[_0x0cad('0x29')]['count'](_0x1ed6e5)[_0x0cad('0x22')](function(_0x246641){_0x41fee8[_0x0cad('0x1e')]=_0x246641;if(_0x30f0f6[_0x0cad('0x2c')]['includeAll']){_0xb6ad57[_0x0cad('0x3a')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x0cad('0x3b')](_0xb6ad57);})[_0x0cad('0x22')](function(_0x1101a6){_0x41fee8['rows']=_0x1101a6;return _0x41fee8;})[_0x0cad('0x22')](respondWithFilteredResult(_0x185726,_0xb6ad57))[_0x0cad('0x3c')](handleError(_0x185726,null));};exports[_0x0cad('0x3d')]=function(_0x4ba1c0,_0x508bef){var _0x5d47e8={'raw':!![],'where':{'id':_0x4ba1c0[_0x0cad('0x3e')]['id']}},_0x2528a9={};_0x2528a9['model']=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x2528a9[_0x0cad('0x2c')]=_[_0x0cad('0x3f')](_0x4ba1c0[_0x0cad('0x2c')]);_0x2528a9['filters']=_['intersection'](_0x2528a9[_0x0cad('0x2f')],_0x2528a9['query']);_0x5d47e8[_0x0cad('0x30')]=_[_0x0cad('0x2e')](_0x2528a9['model'],qs[_0x0cad('0x40')](_0x4ba1c0[_0x0cad('0x2c')][_0x0cad('0x40')]));_0x5d47e8['attributes']=_0x5d47e8[_0x0cad('0x30')][_0x0cad('0x41')]?_0x5d47e8['attributes']:_0x2528a9['model'];if(_0x4ba1c0[_0x0cad('0x2c')][_0x0cad('0x42')]){_0x5d47e8[_0x0cad('0x3a')]=[{'all':!![]}];}_0x5d47e8=_[_0x0cad('0x37')]({},_0x5d47e8,_0x4ba1c0['options']);return db[_0x0cad('0x29')][_0x0cad('0x43')](_0x5d47e8)[_0x0cad('0x22')](handleEntityNotFound(_0x508bef,null))[_0x0cad('0x22')](respondWithResult(_0x508bef,null))[_0x0cad('0x3c')](handleError(_0x508bef,null));};exports[_0x0cad('0x44')]=function(_0x174a3a,_0x470baa){return db['VoiceTransferReport']['create'](_0x174a3a['body'],{})[_0x0cad('0x22')](respondWithResult(_0x470baa,0xc9))[_0x0cad('0x3c')](handleError(_0x470baa,null));};exports[_0x0cad('0x45')]=function(_0x530cc9,_0x31d1c8){if(_0x530cc9['body']['id']){delete _0x530cc9['body']['id'];}return db[_0x0cad('0x29')][_0x0cad('0x43')]({'where':{'id':_0x530cc9['params']['id']}})[_0x0cad('0x22')](handleEntityNotFound(_0x31d1c8,null))[_0x0cad('0x22')](saveUpdates(_0x530cc9['body'],null))[_0x0cad('0x22')](respondWithResult(_0x31d1c8,null))[_0x0cad('0x3c')](handleError(_0x31d1c8,null));};exports[_0x0cad('0x23')]=function(_0x3bd494,_0xc192b6){return db['VoiceTransferReport'][_0x0cad('0x43')]({'where':{'id':_0x3bd494[_0x0cad('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc192b6,null))[_0x0cad('0x22')](removeEntity(_0xc192b6,null))['catch'](handleError(_0xc192b6,null));};exports[_0x0cad('0x46')]=function(_0x286f55,_0x405fe9){return db[_0x0cad('0x29')][_0x0cad('0x46')]()[_0x0cad('0x22')](respondWithResult(_0x405fe9,null))[_0x0cad('0x3c')](handleError(_0x405fe9,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c2ab99d..9451dbd 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 _0x91be=['api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x2bcf5e,_0x5d9059){var _0x94e486=function(_0x24344f){while(--_0x24344f){_0x2bcf5e['push'](_0x2bcf5e['shift']());}};_0x94e486(++_0x5d9059);}(_0x91be,0x9a));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe91b('0x0'));var util=require(_0xe91b('0x1'));var logger=require('../../config/logger')(_0xe91b('0x2'));var moment=require('moment');var BPromise=require(_0xe91b('0x3'));var rp=require(_0xe91b('0x4'));var fs=require('fs');var path=require(_0xe91b('0x5'));var rimraf=require('rimraf');var config=require(_0xe91b('0x6'));var attributes=require(_0xe91b('0x7'));module[_0xe91b('0x8')]=function(_0x4b5e3d,_0x1f6cd5){return _0x4b5e3d[_0xe91b('0x9')](_0xe91b('0xa'),attributes,{'tableName':_0xe91b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9505=['rimraf','../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4a47dc,_0xc5f364){var _0xb2a931=function(_0x3cd598){while(--_0x3cd598){_0x4a47dc['push'](_0x4a47dc['shift']());}};_0xb2a931(++_0xc5f364);}(_0x9505,0xe0));var _0x5950=function(_0x3ffd3a,_0x3cd68a){_0x3ffd3a=_0x3ffd3a-0x0;var _0x5278db=_0x9505[_0x3ffd3a];return _0x5278db;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require(_0x5950('0x2'))(_0x5950('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5950('0x4'));var fs=require('fs');var path=require(_0x5950('0x5'));var rimraf=require(_0x5950('0x6'));var config=require(_0x5950('0x7'));var attributes=require(_0x5950('0x8'));module['exports']=function(_0x283241,_0x13f2fa){return _0x283241['define'](_0x5950('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 1399909..5ba3388 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 _0xc7bf=['stringify','code','error','message','request\x20sent','result','catch','body','options','raw','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xc7bf,0xff));var _0xfc7b=function(_0x3459d4,_0x51c957){_0x3459d4=_0x3459d4-0x0;var _0x47aed1=_0xc7bf[_0x3459d4];return _0x47aed1;};'use strict';var _=require(_0xfc7b('0x0'));var util=require(_0xfc7b('0x1'));var moment=require(_0xfc7b('0x2'));var BPromise=require(_0xfc7b('0x3'));var rs=require(_0xfc7b('0x4'));var fs=require('fs');var Redis=require(_0xfc7b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc7b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc7b('0x7'));var jayson=require(_0xfc7b('0x8'));var client=jayson[_0xfc7b('0x9')][_0xfc7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111a65,_0x2c53e2,_0x48e33b){return new BPromise(function(_0x394596,_0x4165f3){return client[_0xfc7b('0xb')](_0x111a65,_0x48e33b)[_0xfc7b('0xc')](function(_0x5af32b){logger[_0xfc7b('0xd')](_0xfc7b('0xe'),_0x2c53e2,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2c53e2,'request\x20sent',JSON[_0xfc7b('0xf')](_0x5af32b));if(_0x5af32b['error']){if(_0x5af32b['error'][_0xfc7b('0x10')]===0x1f4){logger['error'](_0xfc7b('0xe'),_0x2c53e2,_0x5af32b[_0xfc7b('0x11')][_0xfc7b('0x12')]);return _0x4165f3(_0x5af32b['error'][_0xfc7b('0x12')]);}logger[_0xfc7b('0x11')](_0xfc7b('0xe'),_0x2c53e2,_0x5af32b[_0xfc7b('0x11')][_0xfc7b('0x12')]);return _0x394596(_0x5af32b['error'][_0xfc7b('0x12')]);}else{logger[_0xfc7b('0xd')](_0xfc7b('0xe'),_0x2c53e2,_0xfc7b('0x13'));_0x394596(_0x5af32b[_0xfc7b('0x14')]['message']);}})[_0xfc7b('0x15')](function(_0x5210ee){logger[_0xfc7b('0x11')](_0xfc7b('0xe'),_0x2c53e2,_0x5210ee);_0x4165f3(_0x5210ee);});});}exports['CreateVoiceTransferReport']=function(_0x3d8525){var _0x2da99f=this;return new Promise(function(_0xabcdc,_0x12a2e1){return db['VoiceTransferReport']['create'](_0x3d8525[_0xfc7b('0x16')],{'raw':_0x3d8525[_0xfc7b('0x17')]?_0x3d8525['options'][_0xfc7b('0x18')]===undefined?!![]:![]:!![]})[_0xfc7b('0xc')](function(_0xc3cab1){logger['info'](_0xfc7b('0x19'),_0x3d8525);logger[_0xfc7b('0x1a')](_0xfc7b('0x19'),_0x3d8525,JSON[_0xfc7b('0xf')](_0xc3cab1));_0xabcdc(_0xc3cab1);})[_0xfc7b('0x15')](function(_0x30737d){logger[_0xfc7b('0x11')](_0xfc7b('0x19'),_0x30737d['message'],_0x3d8525);_0x12a2e1(_0x2da99f[_0xfc7b('0x11')](0x1f4,_0x30737d[_0xfc7b('0x12')]));});});}; \ No newline at end of file +var _0xc7d8=['client','http','request','then','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4709df,_0x2e6d05){var _0x45d096=function(_0x165216){while(--_0x165216){_0x4709df['push'](_0x4709df['shift']());}};_0x45d096(++_0x2e6d05);}(_0xc7d8,0x1d5));var _0x8c7d=function(_0x4f50ae,_0x1ba3f3){_0x4f50ae=_0x4f50ae-0x0;var _0x67ebc1=_0xc7d8[_0x4f50ae];return _0x67ebc1;};'use strict';var _=require(_0x8c7d('0x0'));var util=require(_0x8c7d('0x1'));var moment=require(_0x8c7d('0x2'));var BPromise=require(_0x8c7d('0x3'));var rs=require(_0x8c7d('0x4'));var fs=require('fs');var Redis=require(_0x8c7d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c7d('0x6'));var logger=require(_0x8c7d('0x7'))(_0x8c7d('0x8'));var config=require(_0x8c7d('0x9'));var jayson=require(_0x8c7d('0xa'));var client=jayson[_0x8c7d('0xb')][_0x8c7d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf70d2f,_0x400a94,_0x419660){return new BPromise(function(_0x4a79ea,_0x18412e){return client[_0x8c7d('0xd')](_0xf70d2f,_0x419660)[_0x8c7d('0xe')](function(_0x1b41e6){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x400a94,_0x8c7d('0xf'));logger['debug'](_0x8c7d('0x10'),_0x400a94,_0x8c7d('0xf'),JSON[_0x8c7d('0x11')](_0x1b41e6));if(_0x1b41e6[_0x8c7d('0x12')]){if(_0x1b41e6['error'][_0x8c7d('0x13')]===0x1f4){logger['error'](_0x8c7d('0x14'),_0x400a94,_0x1b41e6[_0x8c7d('0x12')][_0x8c7d('0x15')]);return _0x18412e(_0x1b41e6[_0x8c7d('0x12')][_0x8c7d('0x15')]);}logger[_0x8c7d('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x400a94,_0x1b41e6['error']['message']);return _0x4a79ea(_0x1b41e6[_0x8c7d('0x12')]['message']);}else{logger[_0x8c7d('0x16')](_0x8c7d('0x14'),_0x400a94,_0x8c7d('0xf'));_0x4a79ea(_0x1b41e6[_0x8c7d('0x17')][_0x8c7d('0x15')]);}})['catch'](function(_0xbb9c2c){logger[_0x8c7d('0x12')](_0x8c7d('0x14'),_0x400a94,_0xbb9c2c);_0x18412e(_0xbb9c2c);});});}exports[_0x8c7d('0x18')]=function(_0x23f112){var _0x3dcac4=this;return new Promise(function(_0x18aa0c,_0x2c9658){return db[_0x8c7d('0x19')][_0x8c7d('0x1a')](_0x23f112[_0x8c7d('0x1b')],{'raw':_0x23f112['options']?_0x23f112[_0x8c7d('0x1c')][_0x8c7d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xc17f8c){logger['info'](_0x8c7d('0x18'),_0x23f112);logger['debug']('CreateVoiceTransferReport',_0x23f112,JSON[_0x8c7d('0x11')](_0xc17f8c));_0x18aa0c(_0xc17f8c);})['catch'](function(_0xd1d91c){logger[_0x8c7d('0x12')]('CreateVoiceTransferReport',_0xd1d91c[_0x8c7d('0x15')],_0x23f112);_0x2c9658(_0x3dcac4[_0x8c7d('0x12')](0x1f4,_0xd1d91c[_0x8c7d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 2ef2d76..b336c73 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 _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x179d7e,_0x2a078b){var _0x197c9a=function(_0x4f7151){while(--_0x4f7151){_0x179d7e['push'](_0x179d7e['shift']());}};_0x197c9a(++_0x2a078b);}(_0x5b02,0xe9));var _0x25b0=function(_0xc8a62b,_0x92ac22){_0xc8a62b=_0xc8a62b-0x0;var _0x7a38a6=_0x5b02[_0xc8a62b];return _0x7a38a6;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file +var _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0xf3cd[_0x3fcfb6];return _0x3b99a7;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c5430b8..e9d9754 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 _0x5636=['then','error','message','result','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','json','originate\x20executed!','catch','hangup','info','format','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20executed!','calls','calls\x20fired:','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','stack','name','status','send','NotFound','request'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x5636,0x102));var _0x6563=function(_0x5a473b,_0x1a7d54){_0x5a473b=_0x5a473b-0x0;var _0x4271db=_0x5636[_0x5a473b];return _0x4271db;};'use strict';var path=require(_0x6563('0x0'));var fs=require('fs');var _=require(_0x6563('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x6563('0x2'));var jayson=require(_0x6563('0x3'));var amiClient=jayson[_0x6563('0x4')]['http']({'port':0x232a});var logger=require(_0x6563('0x5'))(_0x6563('0x6'));var Redis=require(_0x6563('0x7'));config[_0x6563('0x8')]=_[_0x6563('0x9')](config[_0x6563('0x8')],{'host':_0x6563('0xa'),'port':0x18eb});var io=require(_0x6563('0xb'))(new Redis(config[_0x6563('0x8')]));var Schema=require(_0x6563('0xc'));var originateValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'callNumber':{'type':_0x6563('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6563('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x10')]},'transferNumber':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]}});function emit(_0x11baa2,_0x477d9b,_0xd398ce){logger['info'](_0x11baa2,_0x477d9b,JSON[_0x6563('0x12')](_0xd398ce));io['to'](_0x11baa2)['emit'](_0x477d9b,_0xd398ce);}function handleError(_0x502694){return function(_0x47972a){console[_0x6563('0x13')]('handleError:',_0x47972a,_0x47972a instanceof RangeError);logger['error'](_0x47972a[_0x6563('0x14')]);if(_0x47972a instanceof RangeError){if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x194)[_0x6563('0x17')](_0x47972a);}else{if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x1f4)[_0x6563('0x17')](_0x47972a);}};}function checkError(){return function(_0x5bf608){if(!_0x5bf608){throw new RangeError(_0x6563('0x18'));}return _0x5bf608;};}function respondWithRpcPromise(_0x9c3da7,_0x20b478){return new BPromise(function(_0x5a335c,_0x293db2){var _0x5c37bb=amiClient;return _0x5c37bb[_0x6563('0x19')](_0x9c3da7,_0x20b478)[_0x6563('0x1a')](function(_0x5610b0){if(_0x5610b0['error']){if(_0x5610b0[_0x6563('0x1b')]['code']===0x1f4){return _0x293db2(_0x5610b0[_0x6563('0x1b')][_0x6563('0x1c')]);}return _0x5a335c(_0x5610b0[_0x6563('0x1b')]['message']);}else{_0x5a335c(_0x5610b0[_0x6563('0x1d')]);}})['catch'](function(_0x7ea857){_0x293db2(_0x7ea857);});});}function getAgent(_0x1590e6){return db['User'][_0x6563('0x1e')]({'where':{'id':_0x1590e6,'role':_0x6563('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x2ddb2b,_0x5b03a7){return new BPromise(function(_0x1fe1cb,_0x4fbb20){var _0x480408=respondWithRpcPromise(_0x6563('0x20'));var _0x118d31=getAgent(_0x2ddb2b);Promise[_0x6563('0x21')]([_0x480408,_0x118d31])[_0x6563('0x1a')](function(_0x3eb23b){var _0x4b4d3b=_0x3eb23b[0x0];var _0x3c8bd1=_0x3eb23b[0x1];var _0x4f275c=_['filter'](_0x4b4d3b[_0x6563('0x22')],function(_0x35af37){return _0x35af37[_0x6563('0x23')]==_0x3c8bd1['id']&&_0x35af37[_0x6563('0x24')]==_0x5b03a7;});if(_0x4f275c[_0x6563('0x25')]==0x1){_0x1fe1cb(_0x3c8bd1);}else{_0x4fbb20(new RangeError(_0x6563('0x26')+_0x5b03a7+_0x6563('0x27')));}});});}exports[_0x6563('0x28')]=function(_0x101b24,_0x246d53){logger['info'](_0x6563('0x29'),_0x101b24[_0x6563('0x2a')]);var _0x29fb9d=originateValidation[_0x6563('0xc')](_0x101b24[_0x6563('0x2a')]);if(_0x29fb9d[_0x6563('0x25')]>0x0){return _0x246d53[_0x6563('0x16')](0x190)['json'](_0x29fb9d);}var _0x8cf1=_0x101b24[_0x6563('0x2a')][_0x6563('0x2b')];var _0x46fb1b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2c')];var _0x574a35=_0x101b24[_0x6563('0x2a')][_0x6563('0x2d')];var _0x26c24b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2e')];return getAgent(_0x8cf1)[_0x6563('0x1a')](function(_0x3f578a){logger['info'](_0x6563('0x2f'),_0x3f578a[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x3f578a[_0x6563('0x15')]),'webbar:originate',{'callNumber':_0x46fb1b,'callerId':_0x574a35,'callbackUrl':_0x26c24b});return _0x246d53['status'](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x32')});})[_0x6563('0x33')](handleError(_0x246d53));};exports[_0x6563('0x34')]=function(_0x4962c2,_0x2d36d4){logger[_0x6563('0x35')]('hangup\x20fired:',_0x4962c2[_0x6563('0x2a')]);var _0xe5e80f=hangupValidation[_0x6563('0xc')](_0x4962c2[_0x6563('0x2a')]);if(_0xe5e80f[_0x6563('0x25')]>0x0){return _0x2d36d4[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0xe5e80f);}var _0x15c23e=_0x4962c2[_0x6563('0x2a')]['userId'];var _0x130a88=_0x4962c2[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x15c23e)[_0x6563('0x1a')](function(_0x5ebe88){logger['info'](_0x6563('0x2f'),_0x5ebe88[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x5ebe88[_0x6563('0x15')]),'webbar:hangup',{'sessionId':_0x130a88});return _0x2d36d4[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x6563('0x33')](handleError(_0x2d36d4));};exports[_0x6563('0x37')]=function(_0xea186,_0xcf92cd){logger[_0x6563('0x35')](_0x6563('0x38'),_0xea186[_0x6563('0x2a')]);var _0x32932f=answerValidation[_0x6563('0xc')](_0xea186[_0x6563('0x2a')]);if(_0x32932f[_0x6563('0x25')]>0x0){return _0xcf92cd['status'](0x190)['json'](_0x32932f);}var _0x38eab4=_0xea186[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2f2aa6=_0xea186[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x38eab4)[_0x6563('0x1a')](function(_0x4b7838){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x4b7838[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x4b7838[_0x6563('0x15')]),_0x6563('0x39'),{'sessionId':_0x2f2aa6});return _0xcf92cd[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3a')});})['catch'](handleError(_0xcf92cd));};exports['hold']=function(_0x1504ca,_0x42d54c){logger[_0x6563('0x35')]('hold\x20fired:',_0x1504ca[_0x6563('0x2a')]);var _0x120723=holdValidation[_0x6563('0xc')](_0x1504ca[_0x6563('0x2a')]);if(_0x120723['length']>0x0){return _0x42d54c[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x120723);}var _0xd54477=_0x1504ca['body'][_0x6563('0x2b')];var _0x4bcfff=_0x1504ca[_0x6563('0x2a')]['sessionId'];return getAgent(_0xd54477)['then'](function(_0x1ef2da){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x1ef2da[_0x6563('0x15')]);emit(util[_0x6563('0x36')](_0x6563('0x30'),_0x1ef2da[_0x6563('0x15')]),_0x6563('0x3b'),{'sessionId':_0x4bcfff});return _0x42d54c[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x6563('0x33')](handleError(_0x42d54c));};exports['unhold']=function(_0x22306a,_0xb339e9){logger[_0x6563('0x35')]('unhold\x20fired:',_0x22306a[_0x6563('0x2a')]);var _0x141f0c=unholdValidation['validate'](_0x22306a[_0x6563('0x2a')]);if(_0x141f0c[_0x6563('0x25')]>0x0){return _0xb339e9[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x141f0c);}var _0xbd920a=_0x22306a['body'][_0x6563('0x2b')];var _0x5c4cfa=_0x22306a[_0x6563('0x2a')]['sessionId'];return getAgent(_0xbd920a)[_0x6563('0x1a')](function(_0x5992c8){logger['info']('entityFound:',_0x5992c8['name']);emit(util[_0x6563('0x36')]('user:%s',_0x5992c8[_0x6563('0x15')]),'webbar:unhold',{'sessionId':_0x5c4cfa});return _0xb339e9[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3c')});})[_0x6563('0x33')](handleError(_0xb339e9));};exports[_0x6563('0x3d')]=function(_0x199a0e,_0x23c94a){logger[_0x6563('0x35')](_0x6563('0x3e'),_0x23c94a['body']);var _0x386ae9=callsValidation[_0x6563('0xc')](_0x199a0e[_0x6563('0x2a')]);if(_0x386ae9[_0x6563('0x25')]>0x0){return _0x23c94a[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x386ae9);}var _0x40c99b=_0x199a0e[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2c7e9d=respondWithRpcPromise(_0x6563('0x20'));var _0x5c456b=getAgent(_0x40c99b);return Promise[_0x6563('0x21')]([_0x2c7e9d,_0x5c456b])[_0x6563('0x1a')](function(_0x23f38d){var _0x2e9c69=_0x23f38d[0x0];var _0x46c26c=_0x23f38d[0x1];var _0x3c06ac=_[_0x6563('0x3f')](_0x2e9c69[_0x6563('0x22')],function(_0x53292e){return _0x53292e[_0x6563('0x23')]==_0x46c26c['id'];});return _0x23c94a['status'](0xc8)[_0x6563('0x31')]({'count':_0x3c06ac[_0x6563('0x25')],'rows':_0x3c06ac});})['catch'](handleError(_0x23c94a));};exports['conference']=function(_0x3374b0,_0x8f5e46){logger[_0x6563('0x35')](_0x6563('0x40'),_0x3374b0['body']);var _0x2a3df0=conferenceValidation['validate'](_0x3374b0[_0x6563('0x2a')]);if(_0x2a3df0[_0x6563('0x25')]>0x0){return _0x8f5e46['status'](0x190)['json'](_0x2a3df0);}var _0x3a3a35=_0x3374b0['body']['userId'];return getAgent(_0x3a3a35)[_0x6563('0x1a')](function(_0x49d6a5){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x49d6a5[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x49d6a5[_0x6563('0x15')]),_0x6563('0x41'));return _0x8f5e46[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x42')});})[_0x6563('0x33')](handleError(_0x8f5e46));};exports[_0x6563('0x43')]=function(_0x7d8546,_0x58728d){logger['info'](_0x6563('0x44'),_0x7d8546[_0x6563('0x2a')]);var _0x5b5783=transferValidation['validate'](_0x7d8546['body']);if(_0x5b5783[_0x6563('0x25')]>0x0){return _0x58728d[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x5b5783);}var _0x149b74=_0x7d8546['body'][_0x6563('0x2b')];var _0x1a5c54=_0x7d8546[_0x6563('0x2a')][_0x6563('0x24')];var _0xb55389=_0x7d8546['body']['transferNumber'];return getAgent(_0x149b74)[_0x6563('0x1a')](function(_0x1d7b5d){logger[_0x6563('0x35')]('entityFound:',_0x1d7b5d[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x1d7b5d[_0x6563('0x15')]),_0x6563('0x45'),{'sessionId':_0x1a5c54,'transferNumber':_0xb55389});return _0x58728d[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x46')});})[_0x6563('0x33')](handleError(_0x58728d));}; \ No newline at end of file +var _0xa588=['client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0xa588,0xe1));var _0x8a58=function(_0x38dcff,_0x5f249d){_0x38dcff=_0x38dcff-0x0;var _0x6cb881=_0xa588[_0x38dcff];return _0x6cb881;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8a58('0x0'));var db=require(_0x8a58('0x1'))['db'];var config=require(_0x8a58('0x2'));var util=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var jayson=require(_0x8a58('0x5'));var amiClient=jayson[_0x8a58('0x6')][_0x8a58('0x7')]({'port':0x232a});var logger=require(_0x8a58('0x8'))('webbarapi');var Redis=require(_0x8a58('0x9'));config[_0x8a58('0xa')]=_[_0x8a58('0xb')](config[_0x8a58('0xa')],{'host':_0x8a58('0xc'),'port':0x18eb});var io=require(_0x8a58('0xd'))(new Redis(config[_0x8a58('0xa')]));var Schema=require(_0x8a58('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'callNumber':{'type':_0x8a58('0x10'),'required':[!![],_0x8a58('0x11')]},'callerId':{'type':_0x8a58('0x10')},'callbackUrl':{'type':_0x8a58('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':_0x8a58('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8a58('0x13')]},'transferNumber':{'type':_0x8a58('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a58('0x12'),'required':[!![],_0x8a58('0xf')]}});function emit(_0x26e3a8,_0xd967db,_0xddfaae){logger['info'](_0x26e3a8,_0xd967db,JSON['stringify'](_0xddfaae));io['to'](_0x26e3a8)[_0x8a58('0x14')](_0xd967db,_0xddfaae);}function handleError(_0x107e0a){return function(_0x18a14d){console['log'](_0x8a58('0x15'),_0x18a14d,_0x18a14d instanceof RangeError);logger[_0x8a58('0x16')](_0x18a14d['stack']);if(_0x18a14d instanceof RangeError){if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x194)[_0x8a58('0x19')](_0x18a14d);}else{if(_0x18a14d[_0x8a58('0x17')]){delete _0x18a14d[_0x8a58('0x17')];}_0x107e0a[_0x8a58('0x18')](0x1f4)[_0x8a58('0x19')](_0x18a14d);}};}function checkError(){return function(_0x92951){if(!_0x92951){throw new RangeError(_0x8a58('0x1a'));}return _0x92951;};}function respondWithRpcPromise(_0xb20cfe,_0x844b58){return new BPromise(function(_0x3758fa,_0x34adb8){var _0x561a9a=amiClient;return _0x561a9a[_0x8a58('0x1b')](_0xb20cfe,_0x844b58)[_0x8a58('0x1c')](function(_0x20a6c5){if(_0x20a6c5[_0x8a58('0x16')]){if(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1d')]===0x1f4){return _0x34adb8(_0x20a6c5[_0x8a58('0x16')]['message']);}return _0x3758fa(_0x20a6c5[_0x8a58('0x16')][_0x8a58('0x1e')]);}else{_0x3758fa(_0x20a6c5[_0x8a58('0x1f')]);}})[_0x8a58('0x20')](function(_0x4fb0fb){_0x34adb8(_0x4fb0fb);});});}function getAgent(_0x1e9c3b){return db[_0x8a58('0x21')][_0x8a58('0x22')]({'where':{'id':_0x1e9c3b,'role':'agent'}})[_0x8a58('0x1c')](checkError());}function getAgentCheckSession(_0x31abcc,_0x4426ff){return new BPromise(function(_0x27d7c8,_0x367aec){var _0x3e317f=respondWithRpcPromise(_0x8a58('0x23'));var _0x4d5041=getAgent(_0x31abcc);Promise[_0x8a58('0x24')]([_0x3e317f,_0x4d5041])['then'](function(_0x501aa1){var _0x5e7265=_0x501aa1[0x0];var _0x4cfc96=_0x501aa1[0x1];var _0x5a9c53=_[_0x8a58('0x25')](_0x5e7265[_0x8a58('0x26')],function(_0x1b2d9e){return _0x1b2d9e[_0x8a58('0x27')]==_0x4cfc96['id']&&_0x1b2d9e[_0x8a58('0x28')]==_0x4426ff;});if(_0x5a9c53[_0x8a58('0x29')]==0x1){_0x27d7c8(_0x4cfc96);}else{_0x367aec(new RangeError(_0x8a58('0x2a')+_0x4426ff+_0x8a58('0x2b')));}});});}exports[_0x8a58('0x2c')]=function(_0x3d9e3a,_0x8ab99c){logger[_0x8a58('0x2d')](_0x8a58('0x2e'),_0x3d9e3a['body']);var _0x330e8a=originateValidation[_0x8a58('0xe')](_0x3d9e3a[_0x8a58('0x2f')]);if(_0x330e8a[_0x8a58('0x29')]>0x0){return _0x8ab99c[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x330e8a);}var _0x50c73d=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x25ecd6=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x32')];var _0x264cc7=_0x3d9e3a[_0x8a58('0x2f')]['callerId'];var _0x3d1fb0=_0x3d9e3a[_0x8a58('0x2f')][_0x8a58('0x33')];return getAgent(_0x50c73d)['then'](function(_0x5ecfea){logger['info'](_0x8a58('0x34'),_0x5ecfea[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x5ecfea['name']),_0x8a58('0x37'),{'callNumber':_0x25ecd6,'callerId':_0x264cc7,'callbackUrl':_0x3d1fb0});return _0x8ab99c[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x38')});})['catch'](handleError(_0x8ab99c));};exports[_0x8a58('0x39')]=function(_0x2a7c70,_0x5aad83){logger[_0x8a58('0x2d')](_0x8a58('0x3a'),_0x2a7c70[_0x8a58('0x2f')]);var _0x35d930=hangupValidation[_0x8a58('0xe')](_0x2a7c70[_0x8a58('0x2f')]);if(_0x35d930['length']>0x0){return _0x5aad83['status'](0x190)[_0x8a58('0x30')](_0x35d930);}var _0x31b8fe=_0x2a7c70['body'][_0x8a58('0x31')];var _0x2e1d71=_0x2a7c70[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x31b8fe)[_0x8a58('0x1c')](function(_0x4e9e04){logger[_0x8a58('0x2d')]('entityFound:',_0x4e9e04[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x4e9e04[_0x8a58('0x17')]),_0x8a58('0x3b'),{'sessionId':_0x2e1d71});return _0x5aad83[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x5aad83));};exports[_0x8a58('0x3c')]=function(_0x54e454,_0x53fd19){logger[_0x8a58('0x2d')](_0x8a58('0x3d'),_0x54e454[_0x8a58('0x2f')]);var _0x573cd3=answerValidation['validate'](_0x54e454[_0x8a58('0x2f')]);if(_0x573cd3['length']>0x0){return _0x53fd19[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x573cd3);}var _0x3feec0=_0x54e454[_0x8a58('0x2f')]['userId'];var _0x417951=_0x54e454[_0x8a58('0x2f')]['sessionId'];return getAgent(_0x3feec0)[_0x8a58('0x1c')](function(_0xba52de){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0xba52de['name']);emit(util[_0x8a58('0x35')]('user:%s',_0xba52de[_0x8a58('0x17')]),_0x8a58('0x3e'),{'sessionId':_0x417951});return _0x53fd19['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0x53fd19));};exports[_0x8a58('0x3f')]=function(_0x417b08,_0x177ba9){logger[_0x8a58('0x2d')](_0x8a58('0x40'),_0x417b08[_0x8a58('0x2f')]);var _0x507423=holdValidation['validate'](_0x417b08[_0x8a58('0x2f')]);if(_0x507423[_0x8a58('0x29')]>0x0){return _0x177ba9[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x507423);}var _0x1ec51b=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x903c85=_0x417b08[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x1ec51b)[_0x8a58('0x1c')](function(_0x392c32){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x392c32['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x392c32[_0x8a58('0x17')]),_0x8a58('0x41'),{'sessionId':_0x903c85});return _0x177ba9[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x42')});})['catch'](handleError(_0x177ba9));};exports['unhold']=function(_0x5ab682,_0x31e12a){logger[_0x8a58('0x2d')](_0x8a58('0x43'),_0x5ab682['body']);var _0x3883ee=unholdValidation[_0x8a58('0xe')](_0x5ab682[_0x8a58('0x2f')]);if(_0x3883ee[_0x8a58('0x29')]>0x0){return _0x31e12a[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x3883ee);}var _0x22f5aa=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x2f48ef=_0x5ab682[_0x8a58('0x2f')][_0x8a58('0x28')];return getAgent(_0x22f5aa)['then'](function(_0xf44eaa){logger[_0x8a58('0x2d')]('entityFound:',_0xf44eaa[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0xf44eaa['name']),_0x8a58('0x44'),{'sessionId':_0x2f48ef});return _0x31e12a['status'](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x45')});})[_0x8a58('0x20')](handleError(_0x31e12a));};exports[_0x8a58('0x46')]=function(_0x3c7225,_0xfd0229){logger[_0x8a58('0x2d')](_0x8a58('0x47'),_0xfd0229[_0x8a58('0x2f')]);var _0x53fbde=callsValidation[_0x8a58('0xe')](_0x3c7225[_0x8a58('0x2f')]);if(_0x53fbde[_0x8a58('0x29')]>0x0){return _0xfd0229[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x53fbde);}var _0x57adf4=_0x3c7225[_0x8a58('0x2f')][_0x8a58('0x31')];var _0xa01a37=respondWithRpcPromise(_0x8a58('0x23'));var _0x1022d5=getAgent(_0x57adf4);return Promise[_0x8a58('0x24')]([_0xa01a37,_0x1022d5])[_0x8a58('0x1c')](function(_0x38e435){var _0x515f26=_0x38e435[0x0];var _0x415dea=_0x38e435[0x1];var _0xbf6332=_[_0x8a58('0x25')](_0x515f26['rows'],function(_0x229e68){return _0x229e68['UserId']==_0x415dea['id'];});return _0xfd0229[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'count':_0xbf6332[_0x8a58('0x29')],'rows':_0xbf6332});})[_0x8a58('0x20')](handleError(_0xfd0229));};exports[_0x8a58('0x48')]=function(_0x2f653d,_0x1b8292){logger[_0x8a58('0x2d')]('conference\x20fired:',_0x2f653d['body']);var _0x455aeb=conferenceValidation[_0x8a58('0xe')](_0x2f653d[_0x8a58('0x2f')]);if(_0x455aeb[_0x8a58('0x29')]>0x0){return _0x1b8292[_0x8a58('0x18')](0x190)[_0x8a58('0x30')](_0x455aeb);}var _0x1b4f68=_0x2f653d['body'][_0x8a58('0x31')];return getAgent(_0x1b4f68)[_0x8a58('0x1c')](function(_0x493ccd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x493ccd[_0x8a58('0x17')]);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x493ccd[_0x8a58('0x17')]),'webbar:conference');return _0x1b8292[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':'conference\x20executed!'});})[_0x8a58('0x20')](handleError(_0x1b8292));};exports[_0x8a58('0x49')]=function(_0x19e256,_0x26b333){logger['info']('transfer\x20fired:',_0x19e256[_0x8a58('0x2f')]);var _0x5ce699=transferValidation[_0x8a58('0xe')](_0x19e256[_0x8a58('0x2f')]);if(_0x5ce699[_0x8a58('0x29')]>0x0){return _0x26b333[_0x8a58('0x18')](0x190)['json'](_0x5ce699);}var _0xb0b5da=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x31')];var _0x371930=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x28')];var _0x9046f1=_0x19e256[_0x8a58('0x2f')][_0x8a58('0x4a')];return getAgent(_0xb0b5da)[_0x8a58('0x1c')](function(_0x318acd){logger[_0x8a58('0x2d')](_0x8a58('0x34'),_0x318acd['name']);emit(util[_0x8a58('0x35')](_0x8a58('0x36'),_0x318acd[_0x8a58('0x17')]),_0x8a58('0x4b'),{'sessionId':_0x371930,'transferNumber':_0x9046f1});return _0x26b333[_0x8a58('0x18')](0xc8)[_0x8a58('0x30')]({'error':![],'message':_0x8a58('0x4c')});})[_0x8a58('0x20')](handleError(_0x26b333));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 9255dcb..0c9aa33 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 _0x6d38=['get','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','update','delete','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getDispositions']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getAnswers']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0x9')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0x11')]('/',auth[_0x86d3('0x7')](),controller['create']);router[_0x86d3('0x11')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x11')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x13')]);router['post'](_0x86d3('0x14'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x11')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x16')]);router[_0x86d3('0x11')](_0x86d3('0x17'),controller['notify']);router[_0x86d3('0x11')]('/:id/send',auth[_0x86d3('0x7')](),controller['send']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x18')]);router[_0x86d3('0x19')]('/:id',auth[_0x86d3('0x7')](),controller['destroy']);router[_0x86d3('0x19')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['removeDispositions']);router[_0x86d3('0x19')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['removeAnswers']);router['delete'](_0x86d3('0x14'),auth['isAuthenticated'](),controller[_0x86d3('0x1a')]);module[_0x86d3('0x1b')]=router; \ No newline at end of file +var _0x93e9=['/describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x93e9,0xcc));var _0x993e=function(_0x3255a7,_0x50267c){_0x3255a7=_0x3255a7-0x0;var _0x25ba82=_0x93e9[_0x3255a7];return _0x25ba82;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['describe']);router[_0x993e('0x9')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0x9')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller['getDispositions']);router[_0x993e('0x9')](_0x993e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x993e('0x9')]('/:id/users',auth[_0x993e('0xa')](),controller['getAgents']);router['get'](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x12')]);router[_0x993e('0x13')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0x14')]);router[_0x993e('0x13')](_0x993e('0xf'),auth[_0x993e('0xa')](),controller[_0x993e('0x15')]);router[_0x993e('0x13')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x16')]);router[_0x993e('0x13')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller['addAgents']);router[_0x993e('0x13')](_0x993e('0x11'),auth[_0x993e('0xa')](),controller[_0x993e('0x18')]);router[_0x993e('0x13')](_0x993e('0x19'),controller['notify']);router[_0x993e('0x13')](_0x993e('0x1a'),auth[_0x993e('0xa')](),controller[_0x993e('0x1b')]);router[_0x993e('0x1c')](_0x993e('0xd'),auth[_0x993e('0xa')](),controller[_0x993e('0x1d')]);router['delete'](_0x993e('0xd'),auth['isAuthenticated'](),controller[_0x993e('0x1e')]);router[_0x993e('0x1f')](_0x993e('0xf'),auth['isAuthenticated'](),controller[_0x993e('0x20')]);router[_0x993e('0x1f')](_0x993e('0x10'),auth[_0x993e('0xa')](),controller[_0x993e('0x21')]);router[_0x993e('0x1f')](_0x993e('0x17'),auth[_0x993e('0xa')](),controller[_0x993e('0x22')]);module[_0x993e('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a16e493..3567359 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 _0x6f42=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','generate','ENUM'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x6f42,0x1ea));var _0x26f4=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x6f42[_0x351b46];return _0x1515df;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x26f4('0x0')]={'name':{'type':Sequelize[_0x26f4('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x26f4('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x26f4('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x26f4('0x2')]();}},'phone':{'type':Sequelize[_0x26f4('0x1')]},'type':{'type':Sequelize[_0x26f4('0x3')](_0x26f4('0x4'),_0x26f4('0x5'))},'accountSid':{'type':Sequelize[_0x26f4('0x1')]},'baseUrl':{'type':Sequelize[_0x26f4('0x1')]},'authToken':{'type':Sequelize[_0x26f4('0x1')]},'notificationTemplate':{'type':Sequelize[_0x26f4('0x6')],'defaultValue':function(){return _0x26f4('0x7');}},'notificationSound':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26f4('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![],'comment':_0x26f4('0xa'),'set':function(_0x249df1){if(!_0x249df1){this[_0x26f4('0xb')](_0x26f4('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x249df1);}},'description':{'type':Sequelize[_0x26f4('0x1')]}}; \ No newline at end of file +var _0x7a1a=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x34b48c,_0xe97afa){var _0x3b9957=function(_0x33095d){while(--_0x33095d){_0x34b48c['push'](_0x34b48c['shift']());}};_0x3b9957(++_0xe97afa);}(_0x7a1a,0xd5));var _0xa7a1=function(_0x204cd8,_0x26ef48){_0x204cd8=_0x204cd8-0x0;var _0x1ac385=_0x7a1a[_0x204cd8];return _0x1ac385;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa7a1('0x0'));module[_0xa7a1('0x1')]={'name':{'type':Sequelize[_0xa7a1('0x2')],'unique':_0xa7a1('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa7a1('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa7a1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa7a1('0x2')],'defaultValue':function(){return rs[_0xa7a1('0x4')]();}},'phone':{'type':Sequelize[_0xa7a1('0x2')]},'type':{'type':Sequelize['ENUM'](_0xa7a1('0x5'),_0xa7a1('0x6'))},'accountSid':{'type':Sequelize[_0xa7a1('0x2')]},'baseUrl':{'type':Sequelize[_0xa7a1('0x2')]},'authToken':{'type':Sequelize[_0xa7a1('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa7a1('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa7a1('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa7a1('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa7a1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa7a1('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa7a1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa7a1('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7a1('0x9')],'comment':_0xa7a1('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa7a1('0xb'),'set':function(_0x5cc5c7){if(!_0x5cc5c7){this[_0xa7a1('0xc')](_0xa7a1('0xd'),null);}this[_0xa7a1('0xc')](_0xa7a1('0xe'),_0x5cc5c7);}},'description':{'type':Sequelize[_0xa7a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 94acf84..0f79f84 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 _0xedec=['message_id','Sequelize','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','stringify','Content-Type','text/xml','send','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','spread','dataValues','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','messageId','notifications'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xedec,0x1a4));var _0xcede=function(_0x4c9730,_0x412b10){_0x4c9730=_0x4c9730-0x0;var _0x16a1ef=_0xedec[_0x4c9730];return _0x16a1ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcede('0x0'));var rp=require('request-promise');var moment=require(_0xcede('0x1'));var BPromise=require(_0xcede('0x2'));var Mustache=require(_0xcede('0x3'));var util=require('util');var path=require(_0xcede('0x4'));var sox=require(_0xcede('0x5'));var csv=require(_0xcede('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcede('0x7'));var _=require(_0xcede('0x8'));var squel=require(_0xcede('0x9'));var crypto=require('crypto');var jsforce=require(_0xcede('0xa'));var deskjs=require(_0xcede('0xb'));var toCsv=require(_0xcede('0x6'));var querystring=require(_0xcede('0xc'));var Papa=require('papaparse');var Redis=require(_0xcede('0xd'));var authService=require(_0xcede('0xe'));var qs=require(_0xcede('0xf'));var as=require(_0xcede('0x10'));var hardwareService=require(_0xcede('0x11'));var logger=require(_0xcede('0x12'))(_0xcede('0x13'));var utils=require(_0xcede('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xcede('0x15')](config[_0xcede('0x16')],{'host':_0xcede('0x17'),'port':0x18eb});var socket=require(_0xcede('0x18'))(new Redis(config[_0xcede('0x16')]));require(_0xcede('0x19'))[_0xcede('0x1a')](socket);var jayson=require(_0xcede('0x1b'));var client=jayson[_0xcede('0x1c')][_0xcede('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3768b9,_0x1eebaa,_0x4d6f84,_0x4811b6){return new BPromise(function(_0x1c0552,_0x59d945){var _0x51b5d2=_0x4811b6||client;return _0x51b5d2[_0xcede('0x1e')](_0x3768b9,_0x4d6f84)['then'](function(_0xf2983e){logger[_0xcede('0x1f')](_0xcede('0x20'),_0x1eebaa,_0xcede('0x21'));logger[_0xcede('0x22')](_0xcede('0x23'),_0x1eebaa,_0xcede('0x21'),JSON['stringify'](_0xf2983e));if(_0xf2983e[_0xcede('0x24')]){if(_0xf2983e['error'][_0xcede('0x25')]===0x1f4){logger[_0xcede('0x24')](_0xcede('0x20'),_0x1eebaa,_0xf2983e['error'][_0xcede('0x26')]);return _0x59d945(_0xf2983e[_0xcede('0x24')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1eebaa,_0xf2983e['error']['message']);return _0x1c0552(_0xf2983e[_0xcede('0x24')][_0xcede('0x26')]);}else{logger[_0xcede('0x1f')](_0xcede('0x20'),_0x1eebaa,'request\x20sent');_0x1c0552(_0xf2983e['result'][_0xcede('0x26')]);}})[_0xcede('0x27')](function(_0x22a838){logger[_0xcede('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x1eebaa,_0x22a838);_0x59d945(_0x22a838);});});}function respondWithStatusCode(_0x92ce19,_0x1a3533){_0x1a3533=_0x1a3533||0xcc;return function(_0x2e45c2){if(_0x2e45c2){return _0x92ce19[_0xcede('0x28')](_0x1a3533);}return _0x92ce19[_0xcede('0x29')](_0x1a3533)[_0xcede('0x2a')]();};}function respondWithResult(_0x96aa4c,_0xd3d133){_0xd3d133=_0xd3d133||0xc8;return function(_0x1f7d99){if(_0x1f7d99){return _0x96aa4c[_0xcede('0x29')](_0xd3d133)[_0xcede('0x2b')](_0x1f7d99);}};}function respondWithFilteredResult(_0x3e1ae9,_0xb44588){return function(_0x38652a){if(_0x38652a){var _0x5a7626=typeof _0xb44588['offset']===_0xcede('0x2c')&&typeof _0xb44588[_0xcede('0x2d')]===_0xcede('0x2c');var _0x18b54f=_0x38652a[_0xcede('0x2e')];var _0x355f8=_0x5a7626?0x0:_0xb44588['offset'];var _0xd85bba=_0x5a7626?_0x38652a['count']:_0xb44588[_0xcede('0x2f')]+_0xb44588['limit'];var _0x385e57;if(_0xd85bba>=_0x18b54f){_0xd85bba=_0x18b54f;_0x385e57=0xc8;}else{_0x385e57=0xce;}_0x3e1ae9[_0xcede('0x29')](_0x385e57);return _0x3e1ae9[_0xcede('0x30')](_0xcede('0x31'),_0x355f8+'-'+_0xd85bba+'/'+_0x18b54f)[_0xcede('0x2b')](_0x38652a);}return null;};}function patchUpdates(_0x2bc549){return function(_0x3fb701){try{jsonpatch[_0xcede('0x32')](_0x3fb701,_0x2bc549,!![]);}catch(_0x1a12f7){return BPromise[_0xcede('0x33')](_0x1a12f7);}return _0x3fb701[_0xcede('0x34')]();};}function saveUpdates(_0x4feafb,_0x1f3816){return function(_0x4a36b7){if(_0x4a36b7){return _0x4a36b7[_0xcede('0x35')](_0x4feafb)[_0xcede('0x36')](function(_0x3818b4){return _0x3818b4;});}return null;};}function removeEntity(_0xd65946,_0x1dd46e){return function(_0x3a7bbf){if(_0x3a7bbf){return _0x3a7bbf[_0xcede('0x37')]()['then'](function(){var _0x2e4b10=_0x3a7bbf[_0xcede('0x38')]({'plain':!![]});var _0x41e726=_0xcede('0x39');return db[_0xcede('0x3a')][_0xcede('0x37')]({'where':{'type':_0x41e726,'resourceId':_0x2e4b10['id']}})['then'](function(){return _0x3a7bbf;});})['then'](function(){_0xd65946[_0xcede('0x29')](0xcc)[_0xcede('0x2a')]();});}};}function handleEntityNotFound(_0x59dec2,_0x183e62){return function(_0x2c62e8){if(!_0x2c62e8){_0x59dec2['sendStatus'](0x194);}return _0x2c62e8;};}function handleError(_0x46a487,_0x283629){_0x283629=_0x283629||0x1f4;return function(_0x2aca76){logger[_0xcede('0x24')](_0x2aca76[_0xcede('0x3b')]);if(_0x2aca76[_0xcede('0x3c')]){delete _0x2aca76[_0xcede('0x3c')];}_0x46a487[_0xcede('0x29')](_0x283629)['send'](_0x2aca76);};}exports[_0xcede('0x3d')]=function(_0x5363d2,_0x5a7e0c){var _0x5e6d7b={'include':[{'model':db['Pause'],'as':_0xcede('0x3e')}]},_0x1367a3={},_0x46ba28={'count':0x0,'rows':[]};var _0x52d32d=_[_0xcede('0x3f')](db[_0xcede('0x40')][_0xcede('0x41')],function(_0x58615e){return{'name':_0x58615e[_0xcede('0x42')],'type':_0x58615e[_0xcede('0x43')]['key']};});_0x1367a3['model']=_[_0xcede('0x3f')](_0x52d32d,_0xcede('0x3c'));_0x1367a3['query']=_['keys'](_0x5363d2[_0xcede('0x44')]);_0x1367a3['filters']=_['intersection'](_0x1367a3[_0xcede('0x45')],_0x1367a3[_0xcede('0x44')]);_0x5e6d7b['attributes']=_[_0xcede('0x46')](_0x1367a3['model'],qs[_0xcede('0x47')](_0x5363d2[_0xcede('0x44')][_0xcede('0x47')]));_0x5e6d7b['attributes']=_0x5e6d7b[_0xcede('0x48')][_0xcede('0x49')]?_0x5e6d7b[_0xcede('0x48')]:_0x1367a3['model'];if(!_0x5363d2[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x5e6d7b[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x5363d2['query'][_0xcede('0x2d')]);_0x5e6d7b[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x5363d2['query'][_0xcede('0x2f')]);}_0x5e6d7b[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x5363d2[_0xcede('0x44')][_0xcede('0x4d')]);_0x5e6d7b[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x5363d2['query'],_0x1367a3[_0xcede('0x4f')]),_0x52d32d);if(_0x5363d2[_0xcede('0x44')][_0xcede('0x51')]){_0x5e6d7b['where']=_[_0xcede('0x52')](_0x5e6d7b[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x52d32d,function(_0x54047b){if(_0x54047b['type']!=='VIRTUAL'){var _0x594b2d={};_0x594b2d[_0x54047b['name']]={'$like':'%'+_0x5363d2[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x594b2d;}})});}_0x5e6d7b=_[_0xcede('0x52')]({},_0x5e6d7b,_0x5363d2[_0xcede('0x53')]);var _0x29fb63={'where':_0x5e6d7b[_0xcede('0x4e')]};return db[_0xcede('0x40')][_0xcede('0x2e')](_0x29fb63)[_0xcede('0x36')](function(_0x439714){_0x46ba28[_0xcede('0x2e')]=_0x439714;if(_0x5363d2[_0xcede('0x44')]['includeAll']){_0x5e6d7b[_0xcede('0x54')]=[{'all':!![]}];}return db[_0xcede('0x40')][_0xcede('0x55')](_0x5e6d7b);})[_0xcede('0x36')](function(_0xf3ae12){_0x46ba28[_0xcede('0x56')]=_0xf3ae12;return _0x46ba28;})[_0xcede('0x36')](respondWithFilteredResult(_0x5a7e0c,_0x5e6d7b))[_0xcede('0x27')](handleError(_0x5a7e0c,null));};exports[_0xcede('0x57')]=function(_0x536776,_0x2fe7d1){var _0x2eccea={'raw':![],'where':{'id':_0x536776[_0xcede('0x58')]['id']},'include':[{'model':db[_0xcede('0x59')],'as':_0xcede('0x3e')}]},_0x428483={};_0x428483[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x40')][_0xcede('0x41')]);_0x428483[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x536776[_0xcede('0x44')]);_0x428483['filters']=_[_0xcede('0x46')](_0x428483[_0xcede('0x45')],_0x428483[_0xcede('0x44')]);_0x2eccea[_0xcede('0x48')]=_[_0xcede('0x46')](_0x428483[_0xcede('0x45')],qs[_0xcede('0x47')](_0x536776[_0xcede('0x44')][_0xcede('0x47')]));_0x2eccea[_0xcede('0x48')]=_0x2eccea[_0xcede('0x48')][_0xcede('0x49')]?_0x2eccea[_0xcede('0x48')]:_0x428483[_0xcede('0x45')];if(_0x536776[_0xcede('0x44')]['includeAll']){_0x2eccea[_0xcede('0x54')]=[{'all':!![]}];}_0x2eccea=_[_0xcede('0x52')]({},_0x2eccea,_0x536776[_0xcede('0x53')]);return db[_0xcede('0x40')][_0xcede('0x5b')](_0x2eccea)[_0xcede('0x36')](handleEntityNotFound(_0x2fe7d1,null))['then'](respondWithResult(_0x2fe7d1,null))[_0xcede('0x27')](handleError(_0x2fe7d1,null));};exports[_0xcede('0x5c')]=function(_0x4cb548,_0x31057c){return db[_0xcede('0x40')]['create'](_0x4cb548['body'],{})[_0xcede('0x36')](function(_0x590e57){var _0x4f1e6e=_0x4cb548[_0xcede('0x5d')][_0xcede('0x38')]({'plain':!![]});if(!_0x4f1e6e)throw new Error(_0xcede('0x5e'));if(_0x4f1e6e[_0xcede('0x5f')]==='user'){var _0x4b9b98=_0x590e57[_0xcede('0x38')]({'plain':!![]});var _0x4c2704='WhatsappAccounts';return db[_0xcede('0x60')]['find']({'where':{'name':_0x4c2704,'userProfileId':_0x4f1e6e[_0xcede('0x61')]},'raw':!![]})[_0xcede('0x36')](function(_0x4410c5){if(_0x4410c5&&_0x4410c5[_0xcede('0x62')]===0x0){return db[_0xcede('0x3a')][_0xcede('0x5c')]({'name':_0x4b9b98[_0xcede('0x3c')],'resourceId':_0x4b9b98['id'],'type':_0x4410c5[_0xcede('0x3c')],'sectionId':_0x4410c5['id']},{})[_0xcede('0x36')](function(){return _0x590e57;});}else{return _0x590e57;}})[_0xcede('0x27')](function(_0x5a545c){logger['error'](_0xcede('0x63'),_0x5a545c);throw _0x5a545c;});}return _0x590e57;})['then'](respondWithResult(_0x31057c,0xc9))['catch'](handleError(_0x31057c,null));};exports[_0xcede('0x35')]=function(_0x4473e7,_0x370875){if(_0x4473e7[_0xcede('0x64')]['id']){delete _0x4473e7['body']['id'];}return db[_0xcede('0x40')]['find']({'where':{'id':_0x4473e7[_0xcede('0x58')]['id']},'include':[{'model':db[_0xcede('0x59')],'as':_0xcede('0x3e')}]})['then'](handleEntityNotFound(_0x370875,null))[_0xcede('0x36')](saveUpdates(_0x4473e7[_0xcede('0x64')],null))[_0xcede('0x36')](respondWithResult(_0x370875,null))[_0xcede('0x27')](handleError(_0x370875,null));};exports['destroy']=function(_0x4e0177,_0x4ce61c){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x4e0177[_0xcede('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ce61c,null))['then'](removeEntity(_0x4ce61c,null))[_0xcede('0x27')](handleError(_0x4ce61c,null));};exports[_0xcede('0x65')]=function(_0x7faecf,_0x1ed5ea){return db[_0xcede('0x40')][_0xcede('0x65')]()['then'](respondWithResult(_0x1ed5ea,null))[_0xcede('0x27')](handleError(_0x1ed5ea,null));};exports[_0xcede('0x66')]=function(_0x2e3233,_0x366012,_0x3852fa){if(_0x2e3233[_0xcede('0x64')]['id']){delete _0x2e3233[_0xcede('0x64')]['id'];}return db['WhatsappAccount'][_0xcede('0x5b')]({'where':{'id':_0x2e3233['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x366012,null))[_0xcede('0x36')](function(_0x2642bf){if(_0x2642bf){_0x2e3233['body'][_0xcede('0x67')]=_0x2642bf['id'];return db['Disposition'][_0xcede('0x5c')](_0x2e3233[_0xcede('0x64')]);}})['then'](respondWithResult(_0x366012,null))[_0xcede('0x27')](handleError(_0x366012,null));};exports[_0xcede('0x68')]=function(_0x1eec32,_0x55f829,_0x2ae5e8){var _0x474d7c={'raw':![],'where':{}};var _0x5f2200={};var _0xfd08a2={'count':0x0,'rows':[]};return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x1eec32['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x55f829,null))[_0xcede('0x36')](function(_0x281fd6){if(_0x281fd6){_0x5f2200[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x6a')]['rawAttributes']);_0x5f2200[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x1eec32[_0xcede('0x44')]);_0x5f2200[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x5f2200[_0xcede('0x45')],_0x5f2200['query']);_0x474d7c['attributes']=_['intersection'](_0x5f2200[_0xcede('0x45')],qs['fields'](_0x1eec32['query'][_0xcede('0x47')]));_0x474d7c['attributes']=_0x474d7c[_0xcede('0x48')][_0xcede('0x49')]?_0x474d7c[_0xcede('0x48')]:_0x5f2200[_0xcede('0x45')];if(!_0x1eec32[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x474d7c[_0xcede('0x2d')]=qs['limit'](_0x1eec32['query'][_0xcede('0x2d')]);_0x474d7c[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x1eec32[_0xcede('0x44')][_0xcede('0x2f')]);}_0x474d7c['order']=qs[_0xcede('0x4d')](_0x1eec32['query']['sort']);_0x474d7c[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_['pick'](_0x1eec32[_0xcede('0x44')],_0x5f2200[_0xcede('0x4f')]));_0x474d7c['where'][_0xcede('0x67')]=_0x281fd6['id'];if(_0x1eec32[_0xcede('0x44')]['filter']){_0x474d7c['where']=_[_0xcede('0x52')](_0x474d7c[_0xcede('0x4e')],{'$or':_['map'](_0x474d7c['attributes'],function(_0x2c1b9c){var _0x16d348={};_0x16d348[_0x2c1b9c]={'$like':'%'+_0x1eec32[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x16d348;})});}_0x474d7c=_[_0xcede('0x52')]({},_0x474d7c,_0x1eec32[_0xcede('0x53')]);return db[_0xcede('0x6a')][_0xcede('0x2e')]({'where':_0x474d7c[_0xcede('0x4e')]})['then'](function(_0x22834a){_0xfd08a2[_0xcede('0x2e')]=_0x22834a;if(_0x1eec32['query'][_0xcede('0x6b')]){_0x474d7c[_0xcede('0x54')]=[{'all':!![]}];}return db[_0xcede('0x6a')][_0xcede('0x55')](_0x474d7c);})[_0xcede('0x36')](function(_0x30c5df){_0xfd08a2[_0xcede('0x56')]=_0x30c5df;return _0xfd08a2;});}})[_0xcede('0x36')](respondWithFilteredResult(_0x55f829,_0x474d7c))[_0xcede('0x27')](handleError(_0x55f829,null));};exports[_0xcede('0x6c')]=function(_0x3b95b3,_0x2b7e88,_0x330dd1){return db[_0xcede('0x40')]['find']({'where':{'id':_0x3b95b3[_0xcede('0x58')]['id']}})['then'](handleEntityNotFound(_0x2b7e88,null))[_0xcede('0x36')](function(_0x5b0a40){if(_0x5b0a40){return _0x5b0a40[_0xcede('0x6c')](_0x3b95b3['query'][_0xcede('0x6d')]);}})[_0xcede('0x36')](respondWithStatusCode(_0x2b7e88,null))[_0xcede('0x27')](handleError(_0x2b7e88,null));};exports[_0xcede('0x6e')]=function(_0x325763,_0x4d1b81,_0xf6d294){if(_0x325763[_0xcede('0x64')]['id']){delete _0x325763[_0xcede('0x64')]['id'];}return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x325763[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x4d1b81,null))[_0xcede('0x36')](function(_0x3816ca){if(_0x3816ca){_0x325763[_0xcede('0x64')]['WhatsappAccountId']=_0x3816ca['id'];return db[_0xcede('0x6f')][_0xcede('0x5c')](_0x325763[_0xcede('0x64')]);}})[_0xcede('0x36')](respondWithResult(_0x4d1b81,null))[_0xcede('0x27')](handleError(_0x4d1b81,null));};exports[_0xcede('0x70')]=function(_0x4c6b05,_0x2114a3,_0x5ddff8){var _0x5713f8={'raw':![],'where':{}};var _0x13fd8c={};var _0x525e4f={'count':0x0,'rows':[]};return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x4c6b05[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x2114a3,null))[_0xcede('0x36')](function(_0x50b3ce){if(_0x50b3ce){_0x13fd8c[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x6f')]['rawAttributes']);_0x13fd8c[_0xcede('0x44')]=_['keys'](_0x4c6b05[_0xcede('0x44')]);_0x13fd8c[_0xcede('0x4f')]=_['intersection'](_0x13fd8c[_0xcede('0x45')],_0x13fd8c[_0xcede('0x44')]);_0x5713f8['attributes']=_[_0xcede('0x46')](_0x13fd8c[_0xcede('0x45')],qs['fields'](_0x4c6b05['query'][_0xcede('0x47')]));_0x5713f8[_0xcede('0x48')]=_0x5713f8[_0xcede('0x48')][_0xcede('0x49')]?_0x5713f8[_0xcede('0x48')]:_0x13fd8c[_0xcede('0x45')];if(!_0x4c6b05[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x5713f8['limit']=qs['limit'](_0x4c6b05['query']['limit']);_0x5713f8[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x4c6b05[_0xcede('0x44')]['offset']);}_0x5713f8[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x4c6b05[_0xcede('0x44')][_0xcede('0x4d')]);_0x5713f8[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x4c6b05[_0xcede('0x44')],_0x13fd8c[_0xcede('0x4f')]));_0x5713f8['where'][_0xcede('0x67')]=_0x50b3ce['id'];if(_0x4c6b05[_0xcede('0x44')][_0xcede('0x51')]){_0x5713f8[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x5713f8['where'],{'$or':_[_0xcede('0x3f')](_0x5713f8['attributes'],function(_0x435c93){var _0x2ca845={};_0x2ca845[_0x435c93]={'$like':'%'+_0x4c6b05[_0xcede('0x44')]['filter']+'%'};return _0x2ca845;})});}_0x5713f8=_[_0xcede('0x52')]({},_0x5713f8,_0x4c6b05[_0xcede('0x53')]);return db[_0xcede('0x6f')][_0xcede('0x2e')]({'where':_0x5713f8[_0xcede('0x4e')]})[_0xcede('0x36')](function(_0x6b5f30){_0x525e4f[_0xcede('0x2e')]=_0x6b5f30;if(_0x4c6b05[_0xcede('0x44')]['includeAll']){_0x5713f8[_0xcede('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5713f8);})[_0xcede('0x36')](function(_0x21f6ab){_0x525e4f[_0xcede('0x56')]=_0x21f6ab;return _0x525e4f;});}})[_0xcede('0x36')](respondWithFilteredResult(_0x2114a3,_0x5713f8))['catch'](handleError(_0x2114a3,null));};exports[_0xcede('0x71')]=function(_0x43cfda,_0x49005e,_0x5702a5){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x43cfda[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x49005e,null))[_0xcede('0x36')](function(_0x5cf48b){if(_0x5cf48b){return _0x5cf48b['removeAnswers'](_0x43cfda[_0xcede('0x44')]['ids']);}})[_0xcede('0x36')](respondWithStatusCode(_0x49005e,null))[_0xcede('0x27')](handleError(_0x49005e,null));};exports[_0xcede('0x72')]=function(_0x160a3a,_0x98293c,_0x43a070){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x160a3a['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x98293c,null))[_0xcede('0x36')](function(_0x4b3c4b){if(_0x4b3c4b){return _0x4b3c4b[_0xcede('0x72')](_0x160a3a['body'][_0xcede('0x6d')],_[_0xcede('0x73')](_0x160a3a[_0xcede('0x64')],[_0xcede('0x6d'),'id'])||{})['spread'](function(_0x5c9e73){for(var _0x48f693=0x0;_0x48f693<_0x160a3a[_0xcede('0x64')][_0xcede('0x6d')][_0xcede('0x49')];_0x48f693+=0x1){socket[_0xcede('0x74')](_0xcede('0x75'),{'UserId':Number(_0x160a3a[_0xcede('0x64')][_0xcede('0x6d')][_0x48f693]),'WhatsappAccountId':Number(_0x160a3a[_0xcede('0x58')]['id'])});}return _0x5c9e73;});}})[_0xcede('0x36')](respondWithResult(_0x98293c,null))[_0xcede('0x27')](handleError(_0x98293c,null));};exports[_0xcede('0x76')]=function(_0x499c97,_0x4722ac,_0x5db81e){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x499c97['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x4722ac,null))['then'](function(_0x3d253d){if(_0x3d253d){return _0x3d253d[_0xcede('0x76')](_0x499c97['query'][_0xcede('0x6d')])['then'](function(){if(_[_0xcede('0x77')](_0x499c97['query'][_0xcede('0x6d')])){for(var _0x963aed=0x0;_0x963aed<_0x499c97['query'][_0xcede('0x6d')]['length'];_0x963aed+=0x1){socket[_0xcede('0x74')](_0xcede('0x78'),{'UserId':Number(_0x499c97[_0xcede('0x44')][_0xcede('0x6d')][_0x963aed]),'WhatsappAccountId':Number(_0x499c97[_0xcede('0x58')]['id'])});}}else{socket['emit'](_0xcede('0x78'),{'UserId':Number(_0x499c97[_0xcede('0x44')]['ids']),'WhatsappAccountId':Number(_0x499c97[_0xcede('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x4722ac,null))[_0xcede('0x27')](handleError(_0x4722ac,null));};exports[_0xcede('0x79')]=function(_0x4adb92,_0x4c2d30,_0x186c19){var _0x21bfbe={};var _0x2d676f={};var _0x4d5047;var _0x4e46e8;return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x4adb92['params']['id']}})['then'](handleEntityNotFound(_0x4c2d30,null))[_0xcede('0x36')](function(_0x2aaca6){if(_0x2aaca6){_0x4d5047=_0x2aaca6;_0x2d676f[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x7a')][_0xcede('0x41')]);_0x2d676f['query']=_[_0xcede('0x5a')](_0x4adb92[_0xcede('0x44')]);_0x2d676f[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x2d676f[_0xcede('0x45')],_0x2d676f['query']);_0x21bfbe[_0xcede('0x48')]=_[_0xcede('0x46')](_0x2d676f['model'],qs[_0xcede('0x47')](_0x4adb92[_0xcede('0x44')][_0xcede('0x47')]));_0x21bfbe['attributes']=_0x21bfbe[_0xcede('0x48')][_0xcede('0x49')]?_0x21bfbe['attributes']:_0x2d676f[_0xcede('0x45')];_0x21bfbe[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x4adb92[_0xcede('0x44')]['sort']);_0x21bfbe['where']=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x4adb92[_0xcede('0x44')],_0x2d676f[_0xcede('0x4f')]));if(_0x4adb92['query'][_0xcede('0x51')]){_0x21bfbe[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x21bfbe[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x21bfbe[_0xcede('0x48')],function(_0x1b372c){var _0x5735c9={};_0x5735c9[_0x1b372c]={'$like':'%'+_0x4adb92[_0xcede('0x44')]['filter']+'%'};return _0x5735c9;})});}_0x21bfbe=_['merge']({},_0x21bfbe,_0x4adb92[_0xcede('0x53')]);return _0x4d5047[_0xcede('0x79')](_0x21bfbe);}})[_0xcede('0x36')](function(_0x46d9d3){if(_0x46d9d3){_0x4e46e8=_0x46d9d3[_0xcede('0x49')];if(!_0x4adb92[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x21bfbe[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x4adb92['query'][_0xcede('0x2d')]);_0x21bfbe[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x4adb92[_0xcede('0x44')]['offset']);}return _0x4d5047[_0xcede('0x79')](_0x21bfbe);}})[_0xcede('0x36')](function(_0x323a06){if(_0x323a06){return _0x323a06?{'count':_0x4e46e8,'rows':_0x323a06}:null;}})[_0xcede('0x36')](respondWithResult(_0x4c2d30,null))[_0xcede('0x27')](handleError(_0x4c2d30,null));};exports['addApplications']=function(_0x18ddc3,_0x39fd4d){var _0x4324aa=_0x18ddc3[_0xcede('0x58')]['id'];var _0x52c01f=_0x18ddc3[_0xcede('0x64')];var _0xe2225b=0xc8;var _0x1947d3=null;return db['sequelize'][_0xcede('0x7b')]({'isolationLevel':db['sequelize']['Transaction'][_0xcede('0x7c')][_0xcede('0x7d')]},function(_0x1935bc){return db[_0xcede('0x40')]['findOne']({'where':{'id':_0x4324aa},'transaction':_0x1935bc})['then'](function(_0x466d64){if(_0x466d64){return db[_0xcede('0x7e')][_0xcede('0x37')]({'where':{'WhatsappAccountId':_0x4324aa},'transaction':_0x1935bc})[_0xcede('0x36')](function(){var _0x3ba09d=_[_0xcede('0x3f')](_0x52c01f,function(_0x45070e){_0x45070e[_0xcede('0x67')]=_0x4324aa;return _0x45070e;});return db[_0xcede('0x7e')][_0xcede('0x7f')](_0x3ba09d,{'transaction':_0x1935bc});});}else{_0xe2225b=0x194;_0x1947d3=[];}});})['then'](function(){if(_0xe2225b!==0x194){return db[_0xcede('0x7e')][_0xcede('0x80')]({'where':{'WhatsappAccountId':_0x4324aa},'order':_0xcede('0x81')})['then'](function(_0x20513f){_0x1947d3=_0x20513f;});}})[_0xcede('0x27')](function(_0x427a96){_0xe2225b=0x1f4;logger[_0xcede('0x24')](_0x427a96[_0xcede('0x3b')]);if(_0x427a96[_0xcede('0x3c')]){delete _0x427a96[_0xcede('0x3c')];}_0x1947d3=_0x427a96;})['finally'](function(){if(_0x1947d3===null){_0x39fd4d['sendStatus'](_0xe2225b);}else{if(_0xe2225b===0x1f4){_0x39fd4d[_0xcede('0x29')](_0xe2225b)['send'](_0x1947d3);}else{_0x39fd4d[_0xcede('0x29')](_0xe2225b)[_0xcede('0x2b')](_0x1947d3);}}});};exports[_0xcede('0x82')]=function(_0x3f7795,_0x5da8ff,_0x81d2d6){var _0x17118a={};var _0x18a3b0={};var _0x2ef7c2;var _0x2b9e88;return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x3f7795[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x5da8ff,null))[_0xcede('0x36')](function(_0x5221b9){if(_0x5221b9){_0x2ef7c2=_0x5221b9;_0x18a3b0[_0xcede('0x45')]=_['keys'](db['WhatsappApplication'][_0xcede('0x41')]);_0x18a3b0[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x3f7795['query']);_0x18a3b0[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x18a3b0['model'],_0x18a3b0['query']);_0x17118a['attributes']=_[_0xcede('0x46')](_0x18a3b0[_0xcede('0x45')],qs['fields'](_0x3f7795[_0xcede('0x44')]['fields']));_0x17118a[_0xcede('0x48')]=_0x17118a['attributes'][_0xcede('0x49')]?_0x17118a[_0xcede('0x48')]:_0x18a3b0[_0xcede('0x45')];_0x17118a[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x3f7795[_0xcede('0x44')]['sort']);_0x17118a[_0xcede('0x4e')]=qs['filters'](_[_0xcede('0x50')](_0x3f7795['query'],_0x18a3b0[_0xcede('0x4f')]));if(_0x3f7795[_0xcede('0x44')][_0xcede('0x51')]){_0x17118a[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x17118a[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x17118a[_0xcede('0x48')],function(_0x472148){var _0x40f6bb={};_0x40f6bb[_0x472148]={'$like':'%'+_0x3f7795[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x40f6bb;})});}_0x17118a=_['merge']({},_0x17118a,_0x3f7795[_0xcede('0x53')]);return _0x2ef7c2['getApplications'](_0x17118a);}})[_0xcede('0x36')](function(_0x19e8a7){if(_0x19e8a7){_0x2b9e88=_0x19e8a7[_0xcede('0x49')];if(!_0x3f7795['query'][_0xcede('0x4a')]('nolimit')){_0x17118a[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x3f7795['query']['limit']);_0x17118a[_0xcede('0x2f')]=qs['offset'](_0x3f7795[_0xcede('0x44')][_0xcede('0x2f')]);}return _0x2ef7c2[_0xcede('0x82')](_0x17118a);}})[_0xcede('0x36')](function(_0x5f3ad5){if(_0x5f3ad5){return _0x5f3ad5?{'count':_0x2b9e88,'rows':_0x5f3ad5}:null;}})[_0xcede('0x36')](respondWithResult(_0x5da8ff,null))['catch'](handleError(_0x5da8ff,null));};exports[_0xcede('0x83')]=function(_0x52b160,_0x3c936f,_0xd540ba){var _0x26cfa2={'channel':_0xcede('0x84')};var _0x57cdcb=[];var _0xbcce27=[];var _0x5bb727={};return db['WhatsappAccount'][_0xcede('0x5b')]({'where':{'id':_0x52b160['params']['id']},'include':[{'model':db[_0xcede('0x7e')],'as':_0xcede('0x85')}]})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))[_0xcede('0x36')](function(_0x8e8b09){_0x26cfa2['account']=_0x8e8b09;if(_0x26cfa2[_0xcede('0x86')]&&_0x26cfa2['account'][_0xcede('0x43')]===_0xcede('0x87')&&_0x52b160[_0xcede('0x64')]['statuses']){if(_0x52b160['body']['statuses'][_0xcede('0x49')]===0x0)return;if(_0x52b160['body'][_0xcede('0x88')][0x0][_0xcede('0x89')]!==_0xcede('0x8a'))return;return db[_0xcede('0x8b')][_0xcede('0x35')]({'read':!![],'readAt':_0x52b160[_0xcede('0x64')][_0xcede('0x88')][0x0][_0xcede('0x8c')]},{'where':{'messageId':_0x52b160[_0xcede('0x64')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xcede('0x36')](function(_0x21985b){return _0x3c936f['status'](0xc8)['json'](_0x21985b);});}_0x26cfa2[_0xcede('0x8d')]=_[_0xcede('0x8e')](_0x8e8b09[_0xcede('0x85')],[_0xcede('0x81')],['asc']);if(_0x26cfa2['account'][_0xcede('0x85')]){delete _0x26cfa2[_0xcede('0x86')][_0xcede('0x85')];}return db[_0xcede('0x8f')][_0xcede('0x65')]()[_0xcede('0x36')](function(_0x46e0b6){if(!_0x46e0b6){throw new db['Sequelize'][(_0xcede('0x90'))]('no\x20available\x20attributes');}_0x57cdcb=_[_0xcede('0x91')](_[_0xcede('0x5a')](_0x46e0b6),[_0xcede('0x92'),'updatedAt']);_0xbcce27=_['difference'](_[_0xcede('0x5a')](_0x46e0b6),['createdAt',_0xcede('0x93'),'CompanyId',_0xcede('0x94')]);_0x26cfa2[_0xcede('0x64')]={'mapKey':_0xcede('0x95')};if(_0x26cfa2[_0xcede('0x86')]&&_0x26cfa2['account'][_0xcede('0x43')]===_0xcede('0x96')){_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')]=_0x52b160['body'][_0xcede('0x98')][_0xcede('0x99')]('whatsapp:','');_0x26cfa2['body']['body']=_0x52b160[_0xcede('0x64')]['Body'];_0x26cfa2[_0xcede('0x64')][_0xcede('0x9a')]=_0x52b160[_0xcede('0x64')]['MessageSid'];}if(_0x26cfa2['account']&&_0x26cfa2[_0xcede('0x86')][_0xcede('0x43')]===_0xcede('0x87')){_0x26cfa2[_0xcede('0x64')]['from']=_0x52b160['body'][_0xcede('0x9b')][0x0][_0xcede('0x97')];_0x26cfa2['body'][_0xcede('0x64')]=_0x52b160[_0xcede('0x64')][_0xcede('0x9b')][0x0][_0xcede('0x26')][_0xcede('0x64')];_0x26cfa2[_0xcede('0x64')][_0xcede('0x9a')]=_0x52b160['body']['notifications'][0x0][_0xcede('0x9c')];}if(_0x26cfa2[_0xcede('0x64')]['id']){delete _0x26cfa2[_0xcede('0x64')]['id'];}if(_['isNil'](_0x26cfa2[_0xcede('0x64')]['from'])){throw new db[(_0xcede('0x9d'))][(_0xcede('0x90'))]('from\x20is\x20mandatory');}if(_[_0xcede('0x9e')](_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')])||_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')]===''){throw new db[(_0xcede('0x9d'))][(_0xcede('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcede('0x9e')](_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')])){throw new db[(_0xcede('0x9d'))]['ValidationError'](_0xcede('0xa0')+_0xbcce27);}if(!_[_0xcede('0xa1')](_0xbcce27,_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')])){throw new db[(_0xcede('0x9d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbcce27);}_0x5bb727[_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')]]=_0x26cfa2[_0xcede('0x64')]['from'];return db[_0xcede('0xa2')][_0xcede('0x5b')]({'where':{'id':_0x26cfa2['account'][_0xcede('0x94')]},'include':[{'model':db[_0xcede('0x8f')],'as':_0xcede('0xa3'),'where':_0x5bb727,'limit':0x1,'order':[[_0xcede('0x93'),_0xcede('0xa4')]]}]});})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))['then'](function(_0x4324dc){if(_0x4324dc){_0x26cfa2[_0xcede('0xa5')]=_['omit'](_0x4324dc,[_0xcede('0xa3')]);if(_0x4324dc['Contacts'][_0xcede('0x49')]){return _0x4324dc[_0xcede('0xa3')][0x0];}var _0x243723=_[_0xcede('0x15')](_0x26cfa2[_0xcede('0x64')],{'firstName':_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')],'ListId':_0x4324dc['id']});_0x243723[_0x26cfa2['body']['mapKey']]=_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')];return db[_0xcede('0x8f')][_0xcede('0x5c')](_0x243723,{'fields':_0x57cdcb,'raw':!![]});}})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))[_0xcede('0x36')](function(_0x58b7cd){if(_0x58b7cd){_0x26cfa2[_0xcede('0xa6')]=_0x58b7cd;var _0x13ba3a={'ContactId':_0x58b7cd['id'],'phone':_0x26cfa2['body'][_0xcede('0x97')],'WhatsappAccountId':_0x52b160[_0xcede('0x58')]['id']};var _0x2024c4={'ContactId':_0x58b7cd['id'],'WhatsappAccountId':_0x52b160['params']['id'],'closed':![]};return db[_0xcede('0xa7')][_0xcede('0x5b')]({'where':_0x2024c4})['then'](function(_0x26b1c5){if(_0x26b1c5){return[_0x26b1c5,![]];}return db[_0xcede('0xa7')]['create'](_0x13ba3a)[_0xcede('0x36')](function(_0x2970b6){return[_0x2970b6,!![]];});});}})['spread'](function(_0x39895c,_0x51fad7){_0x26cfa2[_0xcede('0xa8')]=_0x39895c[_0xcede('0x38')]({'plain':!![]});_0x26cfa2['interaction']['created']=![];if(_0x51fad7){if(_0x26cfa2['account'][_0xcede('0xa9')]){_0x26cfa2[_0xcede('0x8d')][_0xcede('0xaa')]({'id':0x0,'priority':_0x26cfa2[_0xcede('0x8d')]['length']+0x1,'app':_0xcede('0xab'),'appdata':_0xcede('0xac'),'interval':'*,*,*,*'});}_0x26cfa2['interaction'][_0xcede('0xad')]=!![];}return db[_0xcede('0x8b')]['create']({'phone':_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')],'messageId':_0x26cfa2['body'][_0xcede('0x9a')],'body':_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')],'WhatsappAccountId':_0x52b160[_0xcede('0x58')]['id'],'WhatsappInteractionId':_0x39895c['id'],'direction':'in','ContactId':_0x39895c[_0xcede('0xae')],'AttachmentId':_0x26cfa2[_0xcede('0x64')][_0xcede('0xaf')]});})[_0xcede('0x36')](function(_0x31b461){_0x26cfa2[_0xcede('0x26')]=_0x31b461;if(_0x26cfa2[_0xcede('0xa8')]['UserId']){return db[_0xcede('0x7a')]['find']({'attributes':['id',_0xcede('0x3c')],'where':{'id':_0x26cfa2[_0xcede('0xa8')]['UserId']}})[_0xcede('0x36')](function(_0x527bac){if(_0x527bac){_0x26cfa2['applications'][_0xcede('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x527bac[_0xcede('0x3c')]+','+(_0x26cfa2[_0xcede('0x86')][_0xcede('0xb1')]||0xa),'interval':_0xcede('0xb2')});}return respondWithRpcPromise(_0xcede('0xb3'),_0xcede('0xb4'),_0x26cfa2);});}return respondWithRpcPromise(_0xcede('0xb3'),_0xcede('0xb4'),_0x26cfa2);})['then'](function(_0x200334){if(_0x200334){var _0x2ed856=0xc8;var _0x1352ce=_0xcede('0xb5');logger[_0xcede('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1352ce,_0x2ed856,'entity\x20found');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1352ce,_0x2ed856,'entity\x20found',JSON[_0xcede('0xb6')](_0x200334));if(_0x26cfa2[_0xcede('0x86')]['type']===_0xcede('0x96')){return _0x3c936f[_0xcede('0x29')](_0x2ed856)['set'](_0xcede('0xb7'),_0xcede('0xb8'))['send']('\x0a');}else{return _0x3c936f[_0xcede('0x29')](_0x2ed856)['json'](_0x200334);}}});})[_0xcede('0x27')](handleError(_0x3c936f,null));};exports[_0xcede('0xb9')]=function(_0x3137c0,_0x16d1e2,_0x35abf8){var _0x1bd75f,_0x306dc4,_0x454389;if(_[_0xcede('0x9e')](_0x3137c0[_0xcede('0x64')]['body'])||_0x3137c0[_0xcede('0x64')][_0xcede('0x64')]===''){throw new db[(_0xcede('0x9d'))]['ValidationError'](_0xcede('0xba'));}if(_[_0xcede('0x9e')](_0x3137c0['body']['to'])){throw new db['Sequelize'][(_0xcede('0x90'))]('to\x20is\x20mandatory');}_0x1bd75f=_0x3137c0[_0xcede('0x64')]['to'];return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x3137c0[_0xcede('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xcede('0xbb'),'include':[{'model':db['CmContact'],'as':_0xcede('0xa3'),'where':{'mobile':_0x1bd75f},'limit':0x1,'order':[[_0xcede('0x93'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x16d1e2,null))[_0xcede('0x36')](function(_0x27a3c1){if(_0x27a3c1&&_0x27a3c1[_0xcede('0xbb')]){_0x306dc4=_0x27a3c1['get']({'plain':!![]});if(_0x306dc4[_0xcede('0xbb')]&&_0x306dc4['List'][_0xcede('0xa3')]['length']){return _0x306dc4[_0xcede('0xbb')]['Contacts'][0x0];}return db[_0xcede('0x8f')][_0xcede('0x5c')](_[_0xcede('0x15')](_0x3137c0[_0xcede('0x64')],{'firstName':_0x1bd75f,'mobile':_0x1bd75f,'phone':_0x1bd75f,'ListId':_0x306dc4['ListId']}));}})[_0xcede('0x36')](handleEntityNotFound(_0x16d1e2,null))['then'](function(_0x10b4ad){if(_0x10b4ad){_0x454389=_0x10b4ad;return db[_0xcede('0xa7')]['find']({'where':{'ContactId':_0x454389['id'],'closed':![],'WhatsappAccountId':_0x306dc4['id']}})[_0xcede('0x36')](function(_0x554542){if(_0x554542){return[_0x554542,![]];}return db[_0xcede('0xa7')][_0xcede('0x5c')]({'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id'],'WhatsappAccountId':_0x306dc4['id'],'phone':_0x1bd75f,'firstMsgDirection':_0xcede('0xbc'),'Messages':[_['merge'](_0x3137c0['body'],{'read':![],'body':_0x3137c0[_0xcede('0x64')]['body'],'phone':_0x1bd75f,'WhatsappAccountId':_0x306dc4['id'],'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xcede('0xbd')}]})[_0xcede('0x36')](function(_0x34f991){return[_0x34f991,!![]];});});}})[_0xcede('0xbe')](function(_0x2a6a7e,_0x9aeaa1){if(_0x9aeaa1){return _0x2a6a7e;}return db[_0xcede('0x8b')]['create'](_[_0xcede('0x52')](_0x3137c0[_0xcede('0x64')],{'read':![],'body':_0x3137c0[_0xcede('0x64')][_0xcede('0x64')],'phone':_0x1bd75f,'WhatsappAccountId':_0x306dc4['id'],'WhatsappInteractionId':_0x2a6a7e['id'],'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id']}))[_0xcede('0x36')](function(_0x3adb19){_0x2a6a7e[_0xcede('0xbf')][_0xcede('0xbd')]=[];_0x2a6a7e[_0xcede('0xbf')]['Messages']['push'](_0x3adb19['dataValues']);return _0x2a6a7e;});})[_0xcede('0x36')](respondWithResult(_0x16d1e2,null))[_0xcede('0x27')](handleError(_0x16d1e2,null));}; \ No newline at end of file +var _0xec3b=['map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','WhatsappAccount','includeAll','findAll','catch','show','params','rawAttributes','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','body','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','include','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','send','getApplications','notify','whatsapp','account','sinch','statuses','state','timestamp','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','twilio','From','replace','Body','messageId','MessageSid','notifications','from','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','index','Pause','mandatoryDispositionPause'];(function(_0x1f3b1d,_0x52e366){var _0x7ff69d=function(_0x1f2ecc){while(--_0x1f2ecc){_0x1f3b1d['push'](_0x1f3b1d['shift']());}};_0x7ff69d(++_0x52e366);}(_0xec3b,0x134));var _0xbec3=function(_0x52094b,_0x426ca3){_0x52094b=_0x52094b-0x0;var _0x1e7ffe=_0xec3b[_0x52094b];return _0x1e7ffe;};'use strict';var emlformat=require(_0xbec3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbec3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec3('0x2'));var moment=require(_0xbec3('0x3'));var BPromise=require(_0xbec3('0x4'));var Mustache=require(_0xbec3('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbec3('0x6'));var csv=require(_0xbec3('0x7'));var ejs=require(_0xbec3('0x8'));var fs=require('fs');var fs_extra=require(_0xbec3('0x9'));var _=require('lodash');var squel=require(_0xbec3('0xa'));var crypto=require('crypto');var jsforce=require(_0xbec3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbec3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbec3('0xd'));var qs=require(_0xbec3('0xe'));var as=require(_0xbec3('0xf'));var hardwareService=require(_0xbec3('0x10'));var logger=require(_0xbec3('0x11'))(_0xbec3('0x12'));var utils=require('../../config/utils');var config=require(_0xbec3('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbec3('0x14')]=_[_0xbec3('0x15')](config[_0xbec3('0x14')],{'host':_0xbec3('0x16'),'port':0x18eb});var socket=require(_0xbec3('0x17'))(new Redis(config[_0xbec3('0x14')]));require(_0xbec3('0x18'))[_0xbec3('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbec3('0x1a')][_0xbec3('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x11871a,_0x5b8bf7,_0x3672f5,_0x3109d5){return new BPromise(function(_0x3b4e4b,_0x1205ef){var _0xea6deb=_0x3109d5||client;return _0xea6deb[_0xbec3('0x1c')](_0x11871a,_0x3672f5)[_0xbec3('0x1d')](function(_0x16ee98){logger[_0xbec3('0x1e')](_0xbec3('0x1f'),_0x5b8bf7,_0xbec3('0x20'));logger[_0xbec3('0x21')](_0xbec3('0x22'),_0x5b8bf7,_0xbec3('0x20'),JSON[_0xbec3('0x23')](_0x16ee98));if(_0x16ee98['error']){if(_0x16ee98[_0xbec3('0x24')][_0xbec3('0x25')]===0x1f4){logger[_0xbec3('0x24')](_0xbec3('0x1f'),_0x5b8bf7,_0x16ee98[_0xbec3('0x24')][_0xbec3('0x26')]);return _0x1205ef(_0x16ee98[_0xbec3('0x24')]['message']);}logger[_0xbec3('0x24')](_0xbec3('0x1f'),_0x5b8bf7,_0x16ee98[_0xbec3('0x24')]['message']);return _0x3b4e4b(_0x16ee98[_0xbec3('0x24')][_0xbec3('0x26')]);}else{logger[_0xbec3('0x1e')](_0xbec3('0x1f'),_0x5b8bf7,_0xbec3('0x20'));_0x3b4e4b(_0x16ee98[_0xbec3('0x27')][_0xbec3('0x26')]);}})['catch'](function(_0x10c703){logger[_0xbec3('0x24')](_0xbec3('0x1f'),_0x5b8bf7,_0x10c703);_0x1205ef(_0x10c703);});});}function respondWithStatusCode(_0x26c24a,_0x4d3810){_0x4d3810=_0x4d3810||0xcc;return function(_0x2c5ad8){if(_0x2c5ad8){return _0x26c24a['sendStatus'](_0x4d3810);}return _0x26c24a[_0xbec3('0x28')](_0x4d3810)[_0xbec3('0x29')]();};}function respondWithResult(_0x4a664a,_0x1a6a50){_0x1a6a50=_0x1a6a50||0xc8;return function(_0x422c26){if(_0x422c26){return _0x4a664a['status'](_0x1a6a50)[_0xbec3('0x2a')](_0x422c26);}};}function respondWithFilteredResult(_0x4474af,_0x2a3835){return function(_0x11482f){if(_0x11482f){var _0x5dc596=typeof _0x2a3835[_0xbec3('0x2b')]==='undefined'&&typeof _0x2a3835['limit']===_0xbec3('0x2c');var _0x271489=_0x11482f[_0xbec3('0x2d')];var _0x2882f1=_0x5dc596?0x0:_0x2a3835[_0xbec3('0x2b')];var _0x4e260b=_0x5dc596?_0x11482f[_0xbec3('0x2d')]:_0x2a3835['offset']+_0x2a3835[_0xbec3('0x2e')];var _0x521f49;if(_0x4e260b>=_0x271489){_0x4e260b=_0x271489;_0x521f49=0xc8;}else{_0x521f49=0xce;}_0x4474af[_0xbec3('0x28')](_0x521f49);return _0x4474af[_0xbec3('0x2f')](_0xbec3('0x30'),_0x2882f1+'-'+_0x4e260b+'/'+_0x271489)[_0xbec3('0x2a')](_0x11482f);}return null;};}function patchUpdates(_0x5134c4){return function(_0x51d3fc){try{jsonpatch['apply'](_0x51d3fc,_0x5134c4,!![]);}catch(_0xddc93a){return BPromise[_0xbec3('0x31')](_0xddc93a);}return _0x51d3fc['save']();};}function saveUpdates(_0x1eeab5,_0x512eae){return function(_0x10fd85){if(_0x10fd85){return _0x10fd85[_0xbec3('0x32')](_0x1eeab5)['then'](function(_0x21ab9d){return _0x21ab9d;});}return null;};}function removeEntity(_0x287d62,_0x41939c){return function(_0x4720e5){if(_0x4720e5){return _0x4720e5[_0xbec3('0x33')]()[_0xbec3('0x1d')](function(){var _0x3e0333=_0x4720e5[_0xbec3('0x34')]({'plain':!![]});var _0x556fc4=_0xbec3('0x35');return db[_0xbec3('0x36')]['destroy']({'where':{'type':_0x556fc4,'resourceId':_0x3e0333['id']}})[_0xbec3('0x1d')](function(){return _0x4720e5;});})[_0xbec3('0x1d')](function(){_0x287d62['status'](0xcc)[_0xbec3('0x29')]();});}};}function handleEntityNotFound(_0x4322ed,_0xcdc3cf){return function(_0x37567b){if(!_0x37567b){_0x4322ed[_0xbec3('0x37')](0x194);}return _0x37567b;};}function handleError(_0x5c0639,_0xaf6bca){_0xaf6bca=_0xaf6bca||0x1f4;return function(_0x250cf8){logger[_0xbec3('0x24')](_0x250cf8['stack']);if(_0x250cf8[_0xbec3('0x38')]){delete _0x250cf8[_0xbec3('0x38')];}_0x5c0639[_0xbec3('0x28')](_0xaf6bca)['send'](_0x250cf8);};}exports[_0xbec3('0x39')]=function(_0x245974,_0x16bd7f){var _0x12a5c5={'include':[{'model':db[_0xbec3('0x3a')],'as':_0xbec3('0x3b')}]},_0x1983ad={},_0x50f70c={'count':0x0,'rows':[]};var _0x41845e=_[_0xbec3('0x3c')](db['WhatsappAccount']['rawAttributes'],function(_0x8316c3){return{'name':_0x8316c3[_0xbec3('0x3d')],'type':_0x8316c3[_0xbec3('0x3e')][_0xbec3('0x3f')]};});_0x1983ad[_0xbec3('0x40')]=_[_0xbec3('0x3c')](_0x41845e,'name');_0x1983ad[_0xbec3('0x41')]=_['keys'](_0x245974[_0xbec3('0x41')]);_0x1983ad[_0xbec3('0x42')]=_[_0xbec3('0x43')](_0x1983ad[_0xbec3('0x40')],_0x1983ad['query']);_0x12a5c5[_0xbec3('0x44')]=_[_0xbec3('0x43')](_0x1983ad[_0xbec3('0x40')],qs[_0xbec3('0x45')](_0x245974[_0xbec3('0x41')]['fields']));_0x12a5c5[_0xbec3('0x44')]=_0x12a5c5['attributes'][_0xbec3('0x46')]?_0x12a5c5[_0xbec3('0x44')]:_0x1983ad[_0xbec3('0x40')];if(!_0x245974[_0xbec3('0x41')][_0xbec3('0x47')]('nolimit')){_0x12a5c5[_0xbec3('0x2e')]=qs[_0xbec3('0x2e')](_0x245974[_0xbec3('0x41')][_0xbec3('0x2e')]);_0x12a5c5['offset']=qs[_0xbec3('0x2b')](_0x245974[_0xbec3('0x41')][_0xbec3('0x2b')]);}_0x12a5c5[_0xbec3('0x48')]=qs[_0xbec3('0x49')](_0x245974[_0xbec3('0x41')]['sort']);_0x12a5c5['where']=qs[_0xbec3('0x42')](_['pick'](_0x245974[_0xbec3('0x41')],_0x1983ad[_0xbec3('0x42')]),_0x41845e);if(_0x245974[_0xbec3('0x41')][_0xbec3('0x4a')]){_0x12a5c5[_0xbec3('0x4b')]=_[_0xbec3('0x4c')](_0x12a5c5['where'],{'$or':_['map'](_0x41845e,function(_0x31ab5a){if(_0x31ab5a[_0xbec3('0x3e')]!=='VIRTUAL'){var _0x35018c={};_0x35018c[_0x31ab5a[_0xbec3('0x38')]]={'$like':'%'+_0x245974['query']['filter']+'%'};return _0x35018c;}})});}_0x12a5c5=_['merge']({},_0x12a5c5,_0x245974[_0xbec3('0x4d')]);var _0x33eccf={'where':_0x12a5c5[_0xbec3('0x4b')]};return db[_0xbec3('0x4e')][_0xbec3('0x2d')](_0x33eccf)[_0xbec3('0x1d')](function(_0x51637d){_0x50f70c[_0xbec3('0x2d')]=_0x51637d;if(_0x245974[_0xbec3('0x41')][_0xbec3('0x4f')]){_0x12a5c5['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xbec3('0x50')](_0x12a5c5);})[_0xbec3('0x1d')](function(_0x14615e){_0x50f70c['rows']=_0x14615e;return _0x50f70c;})[_0xbec3('0x1d')](respondWithFilteredResult(_0x16bd7f,_0x12a5c5))[_0xbec3('0x51')](handleError(_0x16bd7f,null));};exports[_0xbec3('0x52')]=function(_0x15cf95,_0x14f1c2){var _0x5e1cc6={'raw':![],'where':{'id':_0x15cf95[_0xbec3('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xbec3('0x3b')}]},_0x205656={};_0x205656[_0xbec3('0x40')]=_['keys'](db[_0xbec3('0x4e')][_0xbec3('0x54')]);_0x205656[_0xbec3('0x41')]=_[_0xbec3('0x55')](_0x15cf95[_0xbec3('0x41')]);_0x205656[_0xbec3('0x42')]=_[_0xbec3('0x43')](_0x205656[_0xbec3('0x40')],_0x205656['query']);_0x5e1cc6[_0xbec3('0x44')]=_[_0xbec3('0x43')](_0x205656[_0xbec3('0x40')],qs['fields'](_0x15cf95[_0xbec3('0x41')][_0xbec3('0x45')]));_0x5e1cc6[_0xbec3('0x44')]=_0x5e1cc6[_0xbec3('0x44')][_0xbec3('0x46')]?_0x5e1cc6[_0xbec3('0x44')]:_0x205656[_0xbec3('0x40')];if(_0x15cf95[_0xbec3('0x41')]['includeAll']){_0x5e1cc6['include']=[{'all':!![]}];}_0x5e1cc6=_[_0xbec3('0x4c')]({},_0x5e1cc6,_0x15cf95[_0xbec3('0x4d')]);return db['WhatsappAccount']['find'](_0x5e1cc6)[_0xbec3('0x1d')](handleEntityNotFound(_0x14f1c2,null))[_0xbec3('0x1d')](respondWithResult(_0x14f1c2,null))[_0xbec3('0x51')](handleError(_0x14f1c2,null));};exports[_0xbec3('0x56')]=function(_0xd297b1,_0x219821){return db[_0xbec3('0x4e')]['create'](_0xd297b1['body'],{})['then'](function(_0x33aade){var _0x50ee0b=_0xd297b1[_0xbec3('0x57')][_0xbec3('0x34')]({'plain':!![]});if(!_0x50ee0b)throw new Error(_0xbec3('0x58'));if(_0x50ee0b['role']===_0xbec3('0x57')){var _0x404d32=_0x33aade[_0xbec3('0x34')]({'plain':!![]});var _0x5690c3=_0xbec3('0x35');return db['UserProfileSection'][_0xbec3('0x59')]({'where':{'name':_0x5690c3,'userProfileId':_0x50ee0b['userProfileId']},'raw':!![]})[_0xbec3('0x1d')](function(_0x1d82e0){if(_0x1d82e0&&_0x1d82e0[_0xbec3('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x404d32[_0xbec3('0x38')],'resourceId':_0x404d32['id'],'type':_0x1d82e0['name'],'sectionId':_0x1d82e0['id']},{})[_0xbec3('0x1d')](function(){return _0x33aade;});}else{return _0x33aade;}})['catch'](function(_0x5c217a){logger[_0xbec3('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c217a);throw _0x5c217a;});}return _0x33aade;})[_0xbec3('0x1d')](respondWithResult(_0x219821,0xc9))[_0xbec3('0x51')](handleError(_0x219821,null));};exports[_0xbec3('0x32')]=function(_0x4fe9d7,_0xd5590d){if(_0x4fe9d7[_0xbec3('0x5b')]['id']){delete _0x4fe9d7['body']['id'];}return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x4fe9d7[_0xbec3('0x53')]['id']},'include':[{'model':db[_0xbec3('0x3a')],'as':_0xbec3('0x3b')}]})[_0xbec3('0x1d')](handleEntityNotFound(_0xd5590d,null))[_0xbec3('0x1d')](saveUpdates(_0x4fe9d7[_0xbec3('0x5b')],null))[_0xbec3('0x1d')](respondWithResult(_0xd5590d,null))[_0xbec3('0x51')](handleError(_0xd5590d,null));};exports[_0xbec3('0x33')]=function(_0x5bea88,_0x430936){return db['WhatsappAccount']['find']({'where':{'id':_0x5bea88[_0xbec3('0x53')]['id']}})['then'](handleEntityNotFound(_0x430936,null))[_0xbec3('0x1d')](removeEntity(_0x430936,null))[_0xbec3('0x51')](handleError(_0x430936,null));};exports['describe']=function(_0x43ff0c,_0x230c7a){return db[_0xbec3('0x4e')]['describe']()[_0xbec3('0x1d')](respondWithResult(_0x230c7a,null))[_0xbec3('0x51')](handleError(_0x230c7a,null));};exports['addDisposition']=function(_0xb27827,_0x66324d,_0x1e3133){if(_0xb27827[_0xbec3('0x5b')]['id']){delete _0xb27827['body']['id'];}return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0xb27827[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x66324d,null))[_0xbec3('0x1d')](function(_0x4d2117){if(_0x4d2117){_0xb27827[_0xbec3('0x5b')][_0xbec3('0x5c')]=_0x4d2117['id'];return db[_0xbec3('0x5d')]['create'](_0xb27827[_0xbec3('0x5b')]);}})[_0xbec3('0x1d')](respondWithResult(_0x66324d,null))[_0xbec3('0x51')](handleError(_0x66324d,null));};exports[_0xbec3('0x5e')]=function(_0x3608ba,_0x1232c6,_0x21e2a7){var _0x3870d7={'raw':![],'where':{}};var _0x144525={};var _0x3401b6={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xbec3('0x5f')]({'where':{'id':_0x3608ba[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x1232c6,null))[_0xbec3('0x1d')](function(_0x444fa3){if(_0x444fa3){_0x144525['model']=_[_0xbec3('0x55')](db[_0xbec3('0x5d')]['rawAttributes']);_0x144525[_0xbec3('0x41')]=_[_0xbec3('0x55')](_0x3608ba[_0xbec3('0x41')]);_0x144525[_0xbec3('0x42')]=_[_0xbec3('0x43')](_0x144525[_0xbec3('0x40')],_0x144525['query']);_0x3870d7[_0xbec3('0x44')]=_[_0xbec3('0x43')](_0x144525['model'],qs[_0xbec3('0x45')](_0x3608ba[_0xbec3('0x41')]['fields']));_0x3870d7['attributes']=_0x3870d7['attributes'][_0xbec3('0x46')]?_0x3870d7[_0xbec3('0x44')]:_0x144525[_0xbec3('0x40')];if(!_0x3608ba[_0xbec3('0x41')][_0xbec3('0x47')](_0xbec3('0x60'))){_0x3870d7[_0xbec3('0x2e')]=qs[_0xbec3('0x2e')](_0x3608ba[_0xbec3('0x41')][_0xbec3('0x2e')]);_0x3870d7['offset']=qs['offset'](_0x3608ba[_0xbec3('0x41')][_0xbec3('0x2b')]);}_0x3870d7[_0xbec3('0x48')]=qs[_0xbec3('0x49')](_0x3608ba[_0xbec3('0x41')][_0xbec3('0x49')]);_0x3870d7[_0xbec3('0x4b')]=qs[_0xbec3('0x42')](_[_0xbec3('0x61')](_0x3608ba['query'],_0x144525[_0xbec3('0x42')]));_0x3870d7[_0xbec3('0x4b')][_0xbec3('0x5c')]=_0x444fa3['id'];if(_0x3608ba[_0xbec3('0x41')][_0xbec3('0x4a')]){_0x3870d7['where']=_[_0xbec3('0x4c')](_0x3870d7[_0xbec3('0x4b')],{'$or':_[_0xbec3('0x3c')](_0x3870d7['attributes'],function(_0x5194ef){var _0x5d7ea0={};_0x5d7ea0[_0x5194ef]={'$like':'%'+_0x3608ba[_0xbec3('0x41')][_0xbec3('0x4a')]+'%'};return _0x5d7ea0;})});}_0x3870d7=_[_0xbec3('0x4c')]({},_0x3870d7,_0x3608ba[_0xbec3('0x4d')]);return db['Disposition'][_0xbec3('0x2d')]({'where':_0x3870d7[_0xbec3('0x4b')]})[_0xbec3('0x1d')](function(_0x9ab870){_0x3401b6[_0xbec3('0x2d')]=_0x9ab870;if(_0x3608ba[_0xbec3('0x41')][_0xbec3('0x4f')]){_0x3870d7['include']=[{'all':!![]}];}return db['Disposition'][_0xbec3('0x50')](_0x3870d7);})[_0xbec3('0x1d')](function(_0x498a4d){_0x3401b6[_0xbec3('0x62')]=_0x498a4d;return _0x3401b6;});}})[_0xbec3('0x1d')](respondWithFilteredResult(_0x1232c6,_0x3870d7))['catch'](handleError(_0x1232c6,null));};exports[_0xbec3('0x63')]=function(_0x301408,_0x538dd7,_0x1fd40f){return db['WhatsappAccount']['find']({'where':{'id':_0x301408['params']['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x538dd7,null))['then'](function(_0x57fc7a){if(_0x57fc7a){return _0x57fc7a[_0xbec3('0x63')](_0x301408[_0xbec3('0x41')][_0xbec3('0x64')]);}})[_0xbec3('0x1d')](respondWithStatusCode(_0x538dd7,null))[_0xbec3('0x51')](handleError(_0x538dd7,null));};exports['addAnswer']=function(_0x20c14d,_0x1f4248,_0x2fed0b){if(_0x20c14d[_0xbec3('0x5b')]['id']){delete _0x20c14d[_0xbec3('0x5b')]['id'];}return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x20c14d[_0xbec3('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f4248,null))[_0xbec3('0x1d')](function(_0x1ab955){if(_0x1ab955){_0x20c14d[_0xbec3('0x5b')][_0xbec3('0x5c')]=_0x1ab955['id'];return db[_0xbec3('0x65')]['create'](_0x20c14d['body']);}})[_0xbec3('0x1d')](respondWithResult(_0x1f4248,null))[_0xbec3('0x51')](handleError(_0x1f4248,null));};exports[_0xbec3('0x66')]=function(_0x12f13b,_0x507519,_0x31d146){var _0x4932b8={'raw':![],'where':{}};var _0x5b9816={};var _0x2cc715={'count':0x0,'rows':[]};return db[_0xbec3('0x4e')]['findOne']({'where':{'id':_0x12f13b[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x507519,null))[_0xbec3('0x1d')](function(_0x43cf2f){if(_0x43cf2f){_0x5b9816[_0xbec3('0x40')]=_[_0xbec3('0x55')](db['CannedAnswer'][_0xbec3('0x54')]);_0x5b9816[_0xbec3('0x41')]=_[_0xbec3('0x55')](_0x12f13b[_0xbec3('0x41')]);_0x5b9816['filters']=_[_0xbec3('0x43')](_0x5b9816[_0xbec3('0x40')],_0x5b9816[_0xbec3('0x41')]);_0x4932b8[_0xbec3('0x44')]=_['intersection'](_0x5b9816[_0xbec3('0x40')],qs['fields'](_0x12f13b[_0xbec3('0x41')]['fields']));_0x4932b8[_0xbec3('0x44')]=_0x4932b8[_0xbec3('0x44')][_0xbec3('0x46')]?_0x4932b8[_0xbec3('0x44')]:_0x5b9816[_0xbec3('0x40')];if(!_0x12f13b[_0xbec3('0x41')]['hasOwnProperty']('nolimit')){_0x4932b8[_0xbec3('0x2e')]=qs['limit'](_0x12f13b[_0xbec3('0x41')][_0xbec3('0x2e')]);_0x4932b8[_0xbec3('0x2b')]=qs[_0xbec3('0x2b')](_0x12f13b[_0xbec3('0x41')][_0xbec3('0x2b')]);}_0x4932b8[_0xbec3('0x48')]=qs[_0xbec3('0x49')](_0x12f13b['query'][_0xbec3('0x49')]);_0x4932b8[_0xbec3('0x4b')]=qs['filters'](_['pick'](_0x12f13b[_0xbec3('0x41')],_0x5b9816['filters']));_0x4932b8[_0xbec3('0x4b')][_0xbec3('0x5c')]=_0x43cf2f['id'];if(_0x12f13b[_0xbec3('0x41')]['filter']){_0x4932b8[_0xbec3('0x4b')]=_[_0xbec3('0x4c')](_0x4932b8[_0xbec3('0x4b')],{'$or':_[_0xbec3('0x3c')](_0x4932b8[_0xbec3('0x44')],function(_0x4238f7){var _0x3b8d9a={};_0x3b8d9a[_0x4238f7]={'$like':'%'+_0x12f13b[_0xbec3('0x41')][_0xbec3('0x4a')]+'%'};return _0x3b8d9a;})});}_0x4932b8=_['merge']({},_0x4932b8,_0x12f13b[_0xbec3('0x4d')]);return db[_0xbec3('0x65')][_0xbec3('0x2d')]({'where':_0x4932b8['where']})[_0xbec3('0x1d')](function(_0x43d621){_0x2cc715[_0xbec3('0x2d')]=_0x43d621;if(_0x12f13b[_0xbec3('0x41')][_0xbec3('0x4f')]){_0x4932b8[_0xbec3('0x67')]=[{'all':!![]}];}return db[_0xbec3('0x65')]['findAll'](_0x4932b8);})['then'](function(_0x227fb2){_0x2cc715[_0xbec3('0x62')]=_0x227fb2;return _0x2cc715;});}})['then'](respondWithFilteredResult(_0x507519,_0x4932b8))[_0xbec3('0x51')](handleError(_0x507519,null));};exports[_0xbec3('0x68')]=function(_0x189955,_0x1766ed,_0x65b1b1){return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x189955[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x1766ed,null))[_0xbec3('0x1d')](function(_0x3111af){if(_0x3111af){return _0x3111af[_0xbec3('0x68')](_0x189955['query']['ids']);}})[_0xbec3('0x1d')](respondWithStatusCode(_0x1766ed,null))[_0xbec3('0x51')](handleError(_0x1766ed,null));};exports[_0xbec3('0x69')]=function(_0x4aafdc,_0x524471,_0x3f3003){return db['WhatsappAccount']['find']({'where':{'id':_0x4aafdc[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x524471,null))[_0xbec3('0x1d')](function(_0x54553b){if(_0x54553b){return _0x54553b[_0xbec3('0x69')](_0x4aafdc[_0xbec3('0x5b')][_0xbec3('0x64')],_[_0xbec3('0x6a')](_0x4aafdc[_0xbec3('0x5b')],[_0xbec3('0x64'),'id'])||{})['spread'](function(_0x41b399){for(var _0x585138=0x0;_0x585138<_0x4aafdc[_0xbec3('0x5b')][_0xbec3('0x64')][_0xbec3('0x46')];_0x585138+=0x1){socket[_0xbec3('0x6b')]('userWhatsappAccount:save',{'UserId':Number(_0x4aafdc['body'][_0xbec3('0x64')][_0x585138]),'WhatsappAccountId':Number(_0x4aafdc[_0xbec3('0x53')]['id'])});}return _0x41b399;});}})[_0xbec3('0x1d')](respondWithResult(_0x524471,null))[_0xbec3('0x51')](handleError(_0x524471,null));};exports['removeAgents']=function(_0x416bcb,_0x4a0b88,_0xc96962){return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x416bcb['params']['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x4a0b88,null))[_0xbec3('0x1d')](function(_0x52a305){if(_0x52a305){return _0x52a305[_0xbec3('0x6c')](_0x416bcb[_0xbec3('0x41')]['ids'])[_0xbec3('0x1d')](function(){if(_[_0xbec3('0x6d')](_0x416bcb['query'][_0xbec3('0x64')])){for(var _0x19e058=0x0;_0x19e058<_0x416bcb[_0xbec3('0x41')]['ids']['length'];_0x19e058+=0x1){socket[_0xbec3('0x6b')]('userWhatsappAccount:remove',{'UserId':Number(_0x416bcb[_0xbec3('0x41')]['ids'][_0x19e058]),'WhatsappAccountId':Number(_0x416bcb[_0xbec3('0x53')]['id'])});}}else{socket['emit'](_0xbec3('0x6e'),{'UserId':Number(_0x416bcb[_0xbec3('0x41')]['ids']),'WhatsappAccountId':Number(_0x416bcb[_0xbec3('0x53')]['id'])});}});}})[_0xbec3('0x1d')](respondWithStatusCode(_0x4a0b88,null))['catch'](handleError(_0x4a0b88,null));};exports[_0xbec3('0x6f')]=function(_0x3faf21,_0x4023c3,_0x460eb7){var _0x37ccb8={};var _0xe31674={};var _0x593d69;var _0x86dc82;return db[_0xbec3('0x4e')][_0xbec3('0x5f')]({'where':{'id':_0x3faf21[_0xbec3('0x53')]['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x4023c3,null))[_0xbec3('0x1d')](function(_0x535b3b){if(_0x535b3b){_0x593d69=_0x535b3b;_0xe31674[_0xbec3('0x40')]=_[_0xbec3('0x55')](db[_0xbec3('0x70')][_0xbec3('0x54')]);_0xe31674[_0xbec3('0x41')]=_['keys'](_0x3faf21['query']);_0xe31674[_0xbec3('0x42')]=_[_0xbec3('0x43')](_0xe31674[_0xbec3('0x40')],_0xe31674[_0xbec3('0x41')]);_0x37ccb8[_0xbec3('0x44')]=_['intersection'](_0xe31674[_0xbec3('0x40')],qs[_0xbec3('0x45')](_0x3faf21[_0xbec3('0x41')][_0xbec3('0x45')]));_0x37ccb8[_0xbec3('0x44')]=_0x37ccb8['attributes'][_0xbec3('0x46')]?_0x37ccb8['attributes']:_0xe31674['model'];_0x37ccb8[_0xbec3('0x48')]=qs[_0xbec3('0x49')](_0x3faf21[_0xbec3('0x41')][_0xbec3('0x49')]);_0x37ccb8[_0xbec3('0x4b')]=qs[_0xbec3('0x42')](_[_0xbec3('0x61')](_0x3faf21[_0xbec3('0x41')],_0xe31674[_0xbec3('0x42')]));if(_0x3faf21['query'][_0xbec3('0x4a')]){_0x37ccb8[_0xbec3('0x4b')]=_[_0xbec3('0x4c')](_0x37ccb8[_0xbec3('0x4b')],{'$or':_[_0xbec3('0x3c')](_0x37ccb8['attributes'],function(_0x5b8ca9){var _0x438fc0={};_0x438fc0[_0x5b8ca9]={'$like':'%'+_0x3faf21[_0xbec3('0x41')][_0xbec3('0x4a')]+'%'};return _0x438fc0;})});}_0x37ccb8=_[_0xbec3('0x4c')]({},_0x37ccb8,_0x3faf21[_0xbec3('0x4d')]);return _0x593d69['getAgents'](_0x37ccb8);}})[_0xbec3('0x1d')](function(_0x366b28){if(_0x366b28){_0x86dc82=_0x366b28[_0xbec3('0x46')];if(!_0x3faf21[_0xbec3('0x41')][_0xbec3('0x47')](_0xbec3('0x60'))){_0x37ccb8[_0xbec3('0x2e')]=qs['limit'](_0x3faf21[_0xbec3('0x41')][_0xbec3('0x2e')]);_0x37ccb8[_0xbec3('0x2b')]=qs[_0xbec3('0x2b')](_0x3faf21['query'][_0xbec3('0x2b')]);}return _0x593d69[_0xbec3('0x6f')](_0x37ccb8);}})[_0xbec3('0x1d')](function(_0xe9941e){if(_0xe9941e){return _0xe9941e?{'count':_0x86dc82,'rows':_0xe9941e}:null;}})[_0xbec3('0x1d')](respondWithResult(_0x4023c3,null))[_0xbec3('0x51')](handleError(_0x4023c3,null));};exports[_0xbec3('0x71')]=function(_0xddeb6c,_0x3df02c){var _0x26e1db=_0xddeb6c[_0xbec3('0x53')]['id'];var _0x2f4cae=_0xddeb6c[_0xbec3('0x5b')];var _0x49511b=0xc8;var _0x1c174a=null;return db['sequelize'][_0xbec3('0x72')]({'isolationLevel':db[_0xbec3('0x73')][_0xbec3('0x74')][_0xbec3('0x75')][_0xbec3('0x76')]},function(_0x448728){return db[_0xbec3('0x4e')]['findOne']({'where':{'id':_0x26e1db},'transaction':_0x448728})[_0xbec3('0x1d')](function(_0x22c725){if(_0x22c725){return db['WhatsappApplication'][_0xbec3('0x33')]({'where':{'WhatsappAccountId':_0x26e1db},'transaction':_0x448728})[_0xbec3('0x1d')](function(){var _0x211eec=_['map'](_0x2f4cae,function(_0xe2c11b){_0xe2c11b[_0xbec3('0x5c')]=_0x26e1db;return _0xe2c11b;});return db[_0xbec3('0x77')][_0xbec3('0x78')](_0x211eec,{'transaction':_0x448728});});}else{_0x49511b=0x194;_0x1c174a=[];}});})['then'](function(){if(_0x49511b!==0x194){return db[_0xbec3('0x77')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x26e1db},'order':_0xbec3('0x79')})[_0xbec3('0x1d')](function(_0x24c6a1){_0x1c174a=_0x24c6a1;});}})[_0xbec3('0x51')](function(_0x27abe2){_0x49511b=0x1f4;logger[_0xbec3('0x24')](_0x27abe2[_0xbec3('0x7a')]);if(_0x27abe2[_0xbec3('0x38')]){delete _0x27abe2[_0xbec3('0x38')];}_0x1c174a=_0x27abe2;})[_0xbec3('0x7b')](function(){if(_0x1c174a===null){_0x3df02c[_0xbec3('0x37')](_0x49511b);}else{if(_0x49511b===0x1f4){_0x3df02c[_0xbec3('0x28')](_0x49511b)[_0xbec3('0x7c')](_0x1c174a);}else{_0x3df02c[_0xbec3('0x28')](_0x49511b)[_0xbec3('0x2a')](_0x1c174a);}}});};exports[_0xbec3('0x7d')]=function(_0x304bd2,_0x55622e,_0x17e085){var _0x452fd0={};var _0x421876={};var _0x1ae929;var _0x2123e1;return db['WhatsappAccount'][_0xbec3('0x5f')]({'where':{'id':_0x304bd2['params']['id']}})[_0xbec3('0x1d')](handleEntityNotFound(_0x55622e,null))['then'](function(_0x431e9d){if(_0x431e9d){_0x1ae929=_0x431e9d;_0x421876[_0xbec3('0x40')]=_['keys'](db[_0xbec3('0x77')][_0xbec3('0x54')]);_0x421876['query']=_[_0xbec3('0x55')](_0x304bd2[_0xbec3('0x41')]);_0x421876[_0xbec3('0x42')]=_[_0xbec3('0x43')](_0x421876[_0xbec3('0x40')],_0x421876['query']);_0x452fd0[_0xbec3('0x44')]=_[_0xbec3('0x43')](_0x421876[_0xbec3('0x40')],qs['fields'](_0x304bd2[_0xbec3('0x41')][_0xbec3('0x45')]));_0x452fd0[_0xbec3('0x44')]=_0x452fd0[_0xbec3('0x44')][_0xbec3('0x46')]?_0x452fd0[_0xbec3('0x44')]:_0x421876[_0xbec3('0x40')];_0x452fd0[_0xbec3('0x48')]=qs[_0xbec3('0x49')](_0x304bd2[_0xbec3('0x41')][_0xbec3('0x49')]);_0x452fd0['where']=qs['filters'](_[_0xbec3('0x61')](_0x304bd2[_0xbec3('0x41')],_0x421876[_0xbec3('0x42')]));if(_0x304bd2[_0xbec3('0x41')][_0xbec3('0x4a')]){_0x452fd0[_0xbec3('0x4b')]=_[_0xbec3('0x4c')](_0x452fd0[_0xbec3('0x4b')],{'$or':_['map'](_0x452fd0['attributes'],function(_0x2d65d5){var _0x1bdf38={};_0x1bdf38[_0x2d65d5]={'$like':'%'+_0x304bd2[_0xbec3('0x41')][_0xbec3('0x4a')]+'%'};return _0x1bdf38;})});}_0x452fd0=_[_0xbec3('0x4c')]({},_0x452fd0,_0x304bd2[_0xbec3('0x4d')]);return _0x1ae929[_0xbec3('0x7d')](_0x452fd0);}})['then'](function(_0x3c8dcc){if(_0x3c8dcc){_0x2123e1=_0x3c8dcc[_0xbec3('0x46')];if(!_0x304bd2[_0xbec3('0x41')]['hasOwnProperty'](_0xbec3('0x60'))){_0x452fd0[_0xbec3('0x2e')]=qs[_0xbec3('0x2e')](_0x304bd2[_0xbec3('0x41')][_0xbec3('0x2e')]);_0x452fd0['offset']=qs[_0xbec3('0x2b')](_0x304bd2['query'][_0xbec3('0x2b')]);}return _0x1ae929[_0xbec3('0x7d')](_0x452fd0);}})[_0xbec3('0x1d')](function(_0x366e77){if(_0x366e77){return _0x366e77?{'count':_0x2123e1,'rows':_0x366e77}:null;}})[_0xbec3('0x1d')](respondWithResult(_0x55622e,null))['catch'](handleError(_0x55622e,null));};exports[_0xbec3('0x7e')]=function(_0x9377ae,_0x3d348d,_0x404ba7){var _0x5d1769={'channel':_0xbec3('0x7f')};var _0x9d11c8=[];var _0x5a35eb=[];var _0x1acade={};return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x9377ae[_0xbec3('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3d348d,null))['then'](function(_0x3bb7fd){_0x5d1769['account']=_0x3bb7fd;if(_0x5d1769[_0xbec3('0x80')]&&_0x5d1769[_0xbec3('0x80')]['type']===_0xbec3('0x81')&&_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x82')]){if(_0x9377ae['body']['statuses'][_0xbec3('0x46')]===0x0)return;if(_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x82')][0x0][_0xbec3('0x83')]!=='read')return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x82')][0x0][_0xbec3('0x84')]},{'where':{'messageId':_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x82')][0x0][_0xbec3('0x85')]},'individualHooks':!![]})['then'](function(_0x133033){return _0x3d348d['status'](0xc8)[_0xbec3('0x2a')](_0x133033);});}_0x5d1769[_0xbec3('0x86')]=_[_0xbec3('0x87')](_0x3bb7fd[_0xbec3('0x88')],['priority'],[_0xbec3('0x89')]);if(_0x5d1769[_0xbec3('0x80')]['Applications']){delete _0x5d1769[_0xbec3('0x80')][_0xbec3('0x88')];}return db[_0xbec3('0x8a')]['describe']()['then'](function(_0x235916){if(!_0x235916){throw new db[(_0xbec3('0x8b'))][(_0xbec3('0x8c'))](_0xbec3('0x8d'));}_0x9d11c8=_[_0xbec3('0x8e')](_[_0xbec3('0x55')](_0x235916),['createdAt',_0xbec3('0x8f')]);_0x5a35eb=_[_0xbec3('0x8e')](_['keys'](_0x235916),['createdAt','updatedAt',_0xbec3('0x90'),'ListId']);_0x5d1769[_0xbec3('0x5b')]={'mapKey':'mobile'};if(_0x5d1769[_0xbec3('0x80')]&&_0x5d1769[_0xbec3('0x80')][_0xbec3('0x3e')]===_0xbec3('0x91')){_0x5d1769[_0xbec3('0x5b')]['from']=_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x92')][_0xbec3('0x93')]('whatsapp:','');_0x5d1769[_0xbec3('0x5b')]['body']=_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x94')];_0x5d1769['body'][_0xbec3('0x95')]=_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x96')];}if(_0x5d1769[_0xbec3('0x80')]&&_0x5d1769[_0xbec3('0x80')][_0xbec3('0x3e')]==='sinch'){_0x5d1769[_0xbec3('0x5b')]['from']=_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x97')][0x0][_0xbec3('0x98')];_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x5b')]=_0x9377ae[_0xbec3('0x5b')][_0xbec3('0x97')][0x0]['message']['body'];_0x5d1769['body'][_0xbec3('0x95')]=_0x9377ae['body'][_0xbec3('0x97')][0x0][_0xbec3('0x85')];}if(_0x5d1769[_0xbec3('0x5b')]['id']){delete _0x5d1769[_0xbec3('0x5b')]['id'];}if(_['isNil'](_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x98')])){throw new db[(_0xbec3('0x8b'))][(_0xbec3('0x8c'))]('from\x20is\x20mandatory');}if(_[_0xbec3('0x99')](_0x5d1769['body'][_0xbec3('0x5b')])||_0x5d1769['body'][_0xbec3('0x5b')]===''){throw new db[(_0xbec3('0x8b'))][(_0xbec3('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x9a')])){throw new db[(_0xbec3('0x8b'))][(_0xbec3('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5a35eb);}if(!_['includes'](_0x5a35eb,_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x9a')])){throw new db[(_0xbec3('0x8b'))]['ValidationError'](_0xbec3('0x9b')+_0x5a35eb);}_0x1acade[_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x9a')]]=_0x5d1769['body'][_0xbec3('0x98')];return db['CmList'][_0xbec3('0x59')]({'where':{'id':_0x5d1769[_0xbec3('0x80')][_0xbec3('0x9c')]},'include':[{'model':db[_0xbec3('0x8a')],'as':_0xbec3('0x9d'),'where':_0x1acade,'limit':0x1,'order':[[_0xbec3('0x8f'),_0xbec3('0x9e')]]}]});})['then'](handleEntityNotFound(_0x3d348d,null))['then'](function(_0x52606e){if(_0x52606e){_0x5d1769['list']=_[_0xbec3('0x6a')](_0x52606e,[_0xbec3('0x9d')]);if(_0x52606e[_0xbec3('0x9d')]['length']){return _0x52606e[_0xbec3('0x9d')][0x0];}var _0x3ca6db=_['defaults'](_0x5d1769[_0xbec3('0x5b')],{'firstName':_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x98')],'ListId':_0x52606e['id']});_0x3ca6db[_0x5d1769['body'][_0xbec3('0x9a')]]=_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x98')];return db['CmContact']['create'](_0x3ca6db,{'fields':_0x9d11c8,'raw':!![]});}})[_0xbec3('0x1d')](handleEntityNotFound(_0x3d348d,null))['then'](function(_0x43474e){if(_0x43474e){_0x5d1769[_0xbec3('0x9f')]=_0x43474e;var _0x37aa36={'ContactId':_0x43474e['id'],'phone':_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x98')],'WhatsappAccountId':_0x9377ae['params']['id']};var _0x32c6be={'ContactId':_0x43474e['id'],'WhatsappAccountId':_0x9377ae[_0xbec3('0x53')]['id'],'closed':![]};return db[_0xbec3('0xa0')]['find']({'where':_0x32c6be})[_0xbec3('0x1d')](function(_0x300e21){if(_0x300e21){return[_0x300e21,![]];}return db[_0xbec3('0xa0')][_0xbec3('0x56')](_0x37aa36)[_0xbec3('0x1d')](function(_0x5495e1){return[_0x5495e1,!![]];});});}})[_0xbec3('0xa1')](function(_0x4e7b5b,_0x5a28db){_0x5d1769[_0xbec3('0xa2')]=_0x4e7b5b['get']({'plain':!![]});_0x5d1769[_0xbec3('0xa2')][_0xbec3('0xa3')]=![];if(_0x5a28db){if(_0x5d1769[_0xbec3('0x80')][_0xbec3('0xa4')]){_0x5d1769[_0xbec3('0x86')][_0xbec3('0xa5')]({'id':0x0,'priority':_0x5d1769[_0xbec3('0x86')][_0xbec3('0x46')]+0x1,'app':_0xbec3('0xa6'),'appdata':_0xbec3('0xa7'),'interval':_0xbec3('0xa8')});}_0x5d1769[_0xbec3('0xa2')][_0xbec3('0xa3')]=!![];}return db[_0xbec3('0xa9')][_0xbec3('0x56')]({'phone':_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x98')],'messageId':_0x5d1769[_0xbec3('0x5b')][_0xbec3('0x95')],'body':_0x5d1769['body'][_0xbec3('0x5b')],'WhatsappAccountId':_0x9377ae[_0xbec3('0x53')]['id'],'WhatsappInteractionId':_0x4e7b5b['id'],'direction':'in','ContactId':_0x4e7b5b[_0xbec3('0xaa')],'AttachmentId':_0x5d1769[_0xbec3('0x5b')][_0xbec3('0xab')]});})[_0xbec3('0x1d')](function(_0x501efb){_0x5d1769[_0xbec3('0x26')]=_0x501efb;if(_0x5d1769[_0xbec3('0xa2')][_0xbec3('0xac')]){return db[_0xbec3('0x70')][_0xbec3('0x59')]({'attributes':['id',_0xbec3('0x38')],'where':{'id':_0x5d1769['interaction'][_0xbec3('0xac')]}})[_0xbec3('0x1d')](function(_0x5f3f0e){if(_0x5f3f0e){_0x5d1769[_0xbec3('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f3f0e[_0xbec3('0x38')]+','+(_0x5d1769[_0xbec3('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0xbec3('0xa8')});}return respondWithRpcPromise(_0xbec3('0xad'),'startRouting',_0x5d1769);});}return respondWithRpcPromise(_0xbec3('0xad'),'startRouting',_0x5d1769);})['then'](function(_0xcd632e){if(_0xcd632e){var _0x3673f4=0xc8;var _0x20c369='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x20c369,_0x3673f4,_0xbec3('0xae'));logger['debug'](_0xbec3('0xaf'),_0x20c369,_0x3673f4,_0xbec3('0xae'),JSON[_0xbec3('0x23')](_0xcd632e));if(_0x5d1769[_0xbec3('0x80')][_0xbec3('0x3e')]==='twilio'){return _0x3d348d[_0xbec3('0x28')](_0x3673f4)[_0xbec3('0x2f')](_0xbec3('0xb0'),_0xbec3('0xb1'))[_0xbec3('0x7c')]('\x0a');}else{return _0x3d348d[_0xbec3('0x28')](_0x3673f4)['json'](_0xcd632e);}}});})['catch'](handleError(_0x3d348d,null));};exports[_0xbec3('0x7c')]=function(_0x2d9787,_0x230590,_0x59a95b){var _0x63f5eb,_0x2d34d5,_0x223be7;if(_[_0xbec3('0x99')](_0x2d9787[_0xbec3('0x5b')]['body'])||_0x2d9787[_0xbec3('0x5b')][_0xbec3('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0xbec3('0xb2'));}if(_['isNil'](_0x2d9787['body']['to'])){throw new db['Sequelize'][(_0xbec3('0x8c'))](_0xbec3('0xb3'));}_0x63f5eb=_0x2d9787[_0xbec3('0x5b')]['to'];return db[_0xbec3('0x4e')][_0xbec3('0x59')]({'where':{'id':_0x2d9787[_0xbec3('0x53')]['id']},'include':[{'model':db[_0xbec3('0xb4')],'as':_0xbec3('0xb5'),'include':[{'model':db[_0xbec3('0x8a')],'as':_0xbec3('0x9d'),'where':{'mobile':_0x63f5eb},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xbec3('0x1d')](handleEntityNotFound(_0x230590,null))['then'](function(_0x4d1594){if(_0x4d1594&&_0x4d1594[_0xbec3('0xb5')]){_0x2d34d5=_0x4d1594[_0xbec3('0x34')]({'plain':!![]});if(_0x2d34d5[_0xbec3('0xb5')]&&_0x2d34d5['List'][_0xbec3('0x9d')][_0xbec3('0x46')]){return _0x2d34d5[_0xbec3('0xb5')][_0xbec3('0x9d')][0x0];}return db[_0xbec3('0x8a')][_0xbec3('0x56')](_[_0xbec3('0x15')](_0x2d9787[_0xbec3('0x5b')],{'firstName':_0x63f5eb,'mobile':_0x63f5eb,'phone':_0x63f5eb,'ListId':_0x2d34d5['ListId']}));}})[_0xbec3('0x1d')](handleEntityNotFound(_0x230590,null))[_0xbec3('0x1d')](function(_0x44911c){if(_0x44911c){_0x223be7=_0x44911c;return db[_0xbec3('0xa0')][_0xbec3('0x59')]({'where':{'ContactId':_0x223be7['id'],'closed':![],'WhatsappAccountId':_0x2d34d5['id']}})[_0xbec3('0x1d')](function(_0x2ef432){if(_0x2ef432){return[_0x2ef432,![]];}return db[_0xbec3('0xa0')]['create']({'UserId':_0x2d9787[_0xbec3('0x57')]['id'],'ContactId':_0x223be7['id'],'WhatsappAccountId':_0x2d34d5['id'],'phone':_0x63f5eb,'firstMsgDirection':'out','Messages':[_['merge'](_0x2d9787[_0xbec3('0x5b')],{'read':![],'body':_0x2d9787[_0xbec3('0x5b')][_0xbec3('0x5b')],'phone':_0x63f5eb,'WhatsappAccountId':_0x2d34d5['id'],'UserId':_0x2d9787[_0xbec3('0x57')]['id'],'ContactId':_0x223be7['id']})]},{'include':[{'model':db[_0xbec3('0xa9')],'as':_0xbec3('0xb6')}]})[_0xbec3('0x1d')](function(_0x7e8c8a){return[_0x7e8c8a,!![]];});});}})[_0xbec3('0xa1')](function(_0x4a18d0,_0x41c4ca){if(_0x41c4ca){return _0x4a18d0;}return db['WhatsappMessage'][_0xbec3('0x56')](_['merge'](_0x2d9787[_0xbec3('0x5b')],{'read':![],'body':_0x2d9787[_0xbec3('0x5b')][_0xbec3('0x5b')],'phone':_0x63f5eb,'WhatsappAccountId':_0x2d34d5['id'],'WhatsappInteractionId':_0x4a18d0['id'],'UserId':_0x2d9787['user']['id'],'ContactId':_0x223be7['id']}))[_0xbec3('0x1d')](function(_0x15dfd0){_0x4a18d0['dataValues'][_0xbec3('0xb6')]=[];_0x4a18d0[_0xbec3('0xb7')][_0xbec3('0xb6')][_0xbec3('0xa5')](_0x15dfd0[_0xbec3('0xb7')]);return _0x4a18d0;});})[_0xbec3('0x1d')](respondWithResult(_0x230590,null))[_0xbec3('0x51')](handleError(_0x230590,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 525b258..a59ae52 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 _0x8c04=['WhatsappAccount','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8c04,0x1cc));var _0x48c0=function(_0x13b5a1,_0x5e4687){_0x13b5a1=_0x13b5a1-0x0;var _0x3eedd9=_0x8c04[_0x13b5a1];return _0x3eedd9;};'use strict';var EventEmitter=require(_0x48c0('0x0'));var WhatsappAccount=require(_0x48c0('0x1'))['db'][_0x48c0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x48c0('0x3'),'afterDestroy':_0x48c0('0x4')};function emitEvent(_0x1f0c30){return function(_0x3dee43,_0x36d6c3,_0x20659f){WhatsappAccountEvents['emit'](_0x1f0c30+':'+_0x3dee43['id'],_0x3dee43);WhatsappAccountEvents[_0x48c0('0x5')](_0x1f0c30,_0x3dee43);_0x20659f(null);};}for(var e in events){if(events[_0x48c0('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd897=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x5da2b0,_0x573f18){var _0x3b967f=function(_0x3704ed){while(--_0x3704ed){_0x5da2b0['push'](_0x5da2b0['shift']());}};_0x3b967f(++_0x573f18);}(_0xd897,0xb7));var _0x7d89=function(_0x2c4424,_0x5cc73e){_0x2c4424=_0x2c4424-0x0;var _0x1e217b=_0xd897[_0x2c4424];return _0x1e217b;};'use strict';var EventEmitter=require(_0x7d89('0x0'));var WhatsappAccount=require(_0x7d89('0x1'))['db'][_0x7d89('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7d89('0x3')](0x0);var events={'afterCreate':_0x7d89('0x4'),'afterUpdate':_0x7d89('0x5'),'afterDestroy':_0x7d89('0x6')};function emitEvent(_0x1de311){return function(_0x195f53,_0x248730,_0x52268e){WhatsappAccountEvents['emit'](_0x1de311+':'+_0x195f53['id'],_0x195f53);WhatsappAccountEvents[_0x7d89('0x7')](_0x1de311,_0x195f53);_0x52268e(null);};}for(var e in events){if(events[_0x7d89('0x8')](e)){var event=events[e];WhatsappAccount[_0x7d89('0x9')](e,emitEvent(event));}}module[_0x7d89('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 24d5d34..f33217d 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 _0x1378=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x1378,0x162));var _0x8137=function(_0x27ac4e,_0x5dcaac){_0x27ac4e=_0x27ac4e-0x0;var _0x215a5d=_0x1378[_0x27ac4e];return _0x215a5d;};'use strict';var _=require(_0x8137('0x0'));var util=require(_0x8137('0x1'));var logger=require(_0x8137('0x2'))(_0x8137('0x3'));var moment=require(_0x8137('0x4'));var BPromise=require(_0x8137('0x5'));var rp=require(_0x8137('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8137('0x7'));var config=require(_0x8137('0x8'));var attributes=require(_0x8137('0x9'));module[_0x8137('0xa')]=function(_0x168608,_0x6c7270){return _0x168608[_0x8137('0xb')](_0x8137('0xc'),attributes,{'tableName':_0x8137('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd210=['whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','path','./whatsappAccount.attributes','exports','WhatsappAccount'];(function(_0x601222,_0x2c4cb0){var _0x3f07c6=function(_0x93c1e5){while(--_0x93c1e5){_0x601222['push'](_0x601222['shift']());}};_0x3f07c6(++_0x2c4cb0);}(_0xd210,0x137));var _0x0d21=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0xd210[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0x0d21('0x0'));var util=require(_0x0d21('0x1'));var logger=require(_0x0d21('0x2'))(_0x0d21('0x3'));var moment=require('moment');var BPromise=require(_0x0d21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d21('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0d21('0x6'));module[_0x0d21('0x7')]=function(_0x2e2b66,_0x505364){return _0x2e2b66['define'](_0x0d21('0x8'),attributes,{'tableName':_0x0d21('0x9'),'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 1f57762..889d0da 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 _0x5eda=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','moment'];(function(_0x68741a,_0x2908f1){var _0x2b7a05=function(_0x2a3ae9){while(--_0x2a3ae9){_0x68741a['push'](_0x68741a['shift']());}};_0x2b7a05(++_0x2908f1);}(_0x5eda,0x1af));var _0xa5ed=function(_0x39567e,_0x5686b1){_0x39567e=_0x39567e-0x0;var _0xfe26f9=_0x5eda[_0x39567e];return _0xfe26f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5ed('0x0'));var BPromise=require(_0xa5ed('0x1'));var rs=require(_0xa5ed('0x2'));var fs=require('fs');var Redis=require(_0xa5ed('0x3'));var db=require(_0xa5ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5ed('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5ed('0x6'));var client=jayson[_0xa5ed('0x7')][_0xa5ed('0x8')]({'port':0x232a});config['redis']=_[_0xa5ed('0x9')](config[_0xa5ed('0xa')],{'host':_0xa5ed('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5ed('0xa')]));require('./whatsappAccount.socket')[_0xa5ed('0xc')](socket);function respondWithRpcPromise(_0x45aae0,_0x3d8179,_0x2014ae){return new BPromise(function(_0x5dc35c,_0x18f444){return client[_0xa5ed('0xd')](_0x45aae0,_0x2014ae)['then'](function(_0xe17e31){logger[_0xa5ed('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x3d8179,_0xa5ed('0xf'));logger[_0xa5ed('0x10')](_0xa5ed('0x11'),_0x3d8179,_0xa5ed('0xf'),JSON[_0xa5ed('0x12')](_0xe17e31));if(_0xe17e31[_0xa5ed('0x13')]){if(_0xe17e31['error'][_0xa5ed('0x14')]===0x1f4){logger['error'](_0xa5ed('0x15'),_0x3d8179,_0xe17e31[_0xa5ed('0x13')]['message']);return _0x18f444(_0xe17e31[_0xa5ed('0x13')][_0xa5ed('0x16')]);}logger[_0xa5ed('0x13')](_0xa5ed('0x15'),_0x3d8179,_0xe17e31[_0xa5ed('0x13')]['message']);return _0x5dc35c(_0xe17e31['error'][_0xa5ed('0x16')]);}else{logger[_0xa5ed('0xe')](_0xa5ed('0x15'),_0x3d8179,_0xa5ed('0xf'));_0x5dc35c(_0xe17e31[_0xa5ed('0x17')][_0xa5ed('0x16')]);}})[_0xa5ed('0x18')](function(_0x233e15){logger[_0xa5ed('0x13')](_0xa5ed('0x15'),_0x3d8179,_0x233e15);_0x18f444(_0x233e15);});});}exports[_0xa5ed('0x19')]=function(_0xaeb373){var _0x1ea203=this;return new Promise(function(_0xabd3cf,_0x713b89){return db[_0xa5ed('0x1a')][_0xa5ed('0x1b')]({'raw':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x1d')]===undefined?!![]:![]:!![],'where':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373[_0xa5ed('0x1c')][_0xa5ed('0x1e')]||null:null,'attributes':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x1f')]||null:null,'include':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x20')]?_[_0xa5ed('0x21')](_0xaeb373[_0xa5ed('0x1c')][_0xa5ed('0x20')],function(_0x17c967){return{'model':db[_0x17c967['model']],'as':_0x17c967['as'],'attributes':_0x17c967[_0xa5ed('0x1f')],'include':_0x17c967[_0xa5ed('0x20')]?_['map'](_0x17c967[_0xa5ed('0x20')],function(_0x2d3692){return{'model':db[_0x2d3692[_0xa5ed('0x22')]],'as':_0x2d3692['as'],'attributes':_0x2d3692[_0xa5ed('0x1f')],'include':_0x2d3692[_0xa5ed('0x20')]?_['map'](_0x2d3692['include'],function(_0x545f69){return{'model':db[_0x545f69[_0xa5ed('0x22')]],'as':_0x545f69['as'],'attributes':_0x545f69[_0xa5ed('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa5ed('0x23')](function(_0x9c50dd){logger[_0xa5ed('0xe')]('ShowWhatsappAccount',_0xaeb373);logger['debug']('ShowWhatsappAccount',_0xaeb373,JSON['stringify'](_0x9c50dd));_0xabd3cf(_0x9c50dd);})[_0xa5ed('0x18')](function(_0x21488c){logger[_0xa5ed('0x13')](_0xa5ed('0x19'),_0x21488c[_0xa5ed('0x16')],_0xaeb373);_0x713b89(_0x1ea203[_0xa5ed('0x13')](0x1f4,_0x21488c[_0xa5ed('0x16')]));});});}; \ No newline at end of file +var _0x6bc9=['redis','defaults','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','map','include','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x6bc9,0x1bc));var _0x96bc=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x6bc9[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var moment=require(_0x96bc('0x2'));var BPromise=require(_0x96bc('0x3'));var rs=require(_0x96bc('0x4'));var fs=require('fs');var Redis=require(_0x96bc('0x5'));var db=require(_0x96bc('0x6'))['db'];var utils=require(_0x96bc('0x7'));var logger=require(_0x96bc('0x8'))(_0x96bc('0x9'));var config=require('../../config/environment');var jayson=require(_0x96bc('0xa'));var client=jayson[_0x96bc('0xb')]['http']({'port':0x232a});config[_0x96bc('0xc')]=_[_0x96bc('0xd')](config[_0x96bc('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x96bc('0xe'))[_0x96bc('0xf')](socket);function respondWithRpcPromise(_0x111504,_0x58e751,_0x32c875){return new BPromise(function(_0x30a6dd,_0x5346f7){return client['request'](_0x111504,_0x32c875)[_0x96bc('0x10')](function(_0x573227){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x58e751,'request\x20sent');logger['debug'](_0x96bc('0x11'),_0x58e751,'request\x20sent',JSON[_0x96bc('0x12')](_0x573227));if(_0x573227[_0x96bc('0x13')]){if(_0x573227['error'][_0x96bc('0x14')]===0x1f4){logger[_0x96bc('0x13')](_0x96bc('0x15'),_0x58e751,_0x573227[_0x96bc('0x13')]['message']);return _0x5346f7(_0x573227[_0x96bc('0x13')][_0x96bc('0x16')]);}logger[_0x96bc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x58e751,_0x573227[_0x96bc('0x13')]['message']);return _0x30a6dd(_0x573227[_0x96bc('0x13')][_0x96bc('0x16')]);}else{logger[_0x96bc('0x17')](_0x96bc('0x15'),_0x58e751,_0x96bc('0x18'));_0x30a6dd(_0x573227[_0x96bc('0x19')][_0x96bc('0x16')]);}})[_0x96bc('0x1a')](function(_0x117a6a){logger[_0x96bc('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x58e751,_0x117a6a);_0x5346f7(_0x117a6a);});});}exports[_0x96bc('0x1b')]=function(_0x5f46f6){var _0x5788a1=this;return new Promise(function(_0x526940,_0x152d8a){return db[_0x96bc('0x1c')][_0x96bc('0x1d')]({'raw':_0x5f46f6[_0x96bc('0x1e')]?_0x5f46f6[_0x96bc('0x1e')][_0x96bc('0x1f')]===undefined?!![]:![]:!![],'where':_0x5f46f6['options']?_0x5f46f6[_0x96bc('0x1e')][_0x96bc('0x20')]||null:null,'attributes':_0x5f46f6[_0x96bc('0x1e')]?_0x5f46f6['options']['attributes']||null:null,'include':_0x5f46f6[_0x96bc('0x1e')]?_0x5f46f6[_0x96bc('0x1e')]['include']?_[_0x96bc('0x21')](_0x5f46f6[_0x96bc('0x1e')][_0x96bc('0x22')],function(_0x52c046){return{'model':db[_0x52c046[_0x96bc('0x23')]],'as':_0x52c046['as'],'attributes':_0x52c046[_0x96bc('0x24')],'include':_0x52c046['include']?_[_0x96bc('0x21')](_0x52c046['include'],function(_0x56757a){return{'model':db[_0x56757a[_0x96bc('0x23')]],'as':_0x56757a['as'],'attributes':_0x56757a[_0x96bc('0x24')],'include':_0x56757a[_0x96bc('0x22')]?_['map'](_0x56757a['include'],function(_0x39bf05){return{'model':db[_0x39bf05['model']],'as':_0x39bf05['as'],'attributes':_0x39bf05[_0x96bc('0x24')]};}):[]};}):[]};}):[]:[]})[_0x96bc('0x10')](function(_0x8a8a88){logger[_0x96bc('0x17')](_0x96bc('0x1b'),_0x5f46f6);logger[_0x96bc('0x25')](_0x96bc('0x1b'),_0x5f46f6,JSON[_0x96bc('0x12')](_0x8a8a88));_0x526940(_0x8a8a88);})['catch'](function(_0x4f62ee){logger[_0x96bc('0x13')](_0x96bc('0x1b'),_0x4f62ee[_0x96bc('0x16')],_0x5f46f6);_0x152d8a(_0x5788a1['error'](0x1f4,_0x4f62ee['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b1dea55..7eda509 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 _0xa9d5=['./whatsappAccount.events','save','remove','removeListener','length','whatsappAccount:'];(function(_0x494b44,_0x43583c){var _0x8ba974=function(_0x3b073b){while(--_0x3b073b){_0x494b44['push'](_0x494b44['shift']());}};_0x8ba974(++_0x43583c);}(_0xa9d5,0x1ec));var _0x5a9d=function(_0x546eb8,_0xb8e40f){_0x546eb8=_0x546eb8-0x0;var _0x4dca8a=_0xa9d5[_0x546eb8];return _0x4dca8a;};'use strict';var WhatsappAccountEvents=require(_0x5a9d('0x0'));var events=[_0x5a9d('0x1'),_0x5a9d('0x2'),'update'];function createListener(_0x21c8a4,_0x251330){return function(_0x554ba3){_0x251330['emit'](_0x21c8a4,_0x554ba3);};}function removeListener(_0x539eba,_0x2d5c7d){return function(){WhatsappAccountEvents[_0x5a9d('0x3')](_0x539eba,_0x2d5c7d);};}exports['register']=function(_0x56489d){for(var _0x579a8d=0x0,_0x334a24=events[_0x5a9d('0x4')];_0x579a8d<_0x334a24;_0x579a8d++){var _0x4789ce=events[_0x579a8d];var _0x10c1aa=createListener(_0x5a9d('0x5')+_0x4789ce,_0x56489d);WhatsappAccountEvents['on'](_0x4789ce,_0x10c1aa);}}; \ No newline at end of file +var _0x9280=['length','whatsappAccount:','save','remove','update','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9280,0x92));var _0x0928=function(_0x5102fa,_0x7ffdb0){_0x5102fa=_0x5102fa-0x0;var _0x53c822=_0x9280[_0x5102fa];return _0x53c822;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x0928('0x0'),_0x0928('0x1'),_0x0928('0x2')];function createListener(_0x403c30,_0x4df119){return function(_0x45ba0a){_0x4df119['emit'](_0x403c30,_0x45ba0a);};}function removeListener(_0x48897b,_0x264464){return function(){WhatsappAccountEvents['removeListener'](_0x48897b,_0x264464);};}exports[_0x0928('0x3')]=function(_0x2ec533){for(var _0x165579=0x0,_0x29d46c=events[_0x0928('0x4')];_0x165579<_0x29d46c;_0x165579++){var _0x40c364=events[_0x165579];var _0xa3777a=createListener(_0x0928('0x5')+_0x40c364,_0x2ec533);WhatsappAccountEvents['on'](_0x40c364,_0xa3777a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ecb1bcd..3034daf 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 _0xed06=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','show','post','create','/:id','update','delete','destroy'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xed06,0x131));var _0x6ed0=function(_0x56bf30,_0x284c8b){_0x56bf30=_0x56bf30-0x0;var _0xaea08b=_0xed06[_0x56bf30];return _0xaea08b;};'use strict';var multer=require('multer');var util=require(_0x6ed0('0x0'));var path=require(_0x6ed0('0x1'));var timeout=require(_0x6ed0('0x2'));var express=require(_0x6ed0('0x3'));var router=express[_0x6ed0('0x4')]();var fs_extra=require(_0x6ed0('0x5'));var auth=require(_0x6ed0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ed0('0x7'));var controller=require(_0x6ed0('0x8'));router['get']('/',auth[_0x6ed0('0x9')](),controller[_0x6ed0('0xa')]);router['get']('/:id',auth[_0x6ed0('0x9')](),controller[_0x6ed0('0xb')]);router[_0x6ed0('0xc')]('/',auth['isAuthenticated'](),controller[_0x6ed0('0xd')]);router['put'](_0x6ed0('0xe'),auth['isAuthenticated'](),controller[_0x6ed0('0xf')]);router[_0x6ed0('0x10')](_0x6ed0('0xe'),auth[_0x6ed0('0x9')](),controller[_0x6ed0('0x11')]);module[_0x6ed0('0x12')]=router; \ No newline at end of file +var _0x5668=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4dc763,_0x22bff4){var _0x292fe1=function(_0x409c8a){while(--_0x409c8a){_0x4dc763['push'](_0x4dc763['shift']());}};_0x292fe1(++_0x22bff4);}(_0x5668,0x13d));var _0x8566=function(_0x3e801d,_0x568036){_0x3e801d=_0x3e801d-0x0;var _0x5a9008=_0x5668[_0x3e801d];return _0x5a9008;};'use strict';var multer=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var path=require(_0x8566('0x2'));var timeout=require(_0x8566('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8566('0x4'));var auth=require(_0x8566('0x5'));var interaction=require(_0x8566('0x6'));var config=require(_0x8566('0x7'));var controller=require(_0x8566('0x8'));router[_0x8566('0x9')]('/',auth['isAuthenticated'](),controller[_0x8566('0xa')]);router[_0x8566('0x9')]('/:id',auth[_0x8566('0xb')](),controller[_0x8566('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8566('0xd')]);router[_0x8566('0xe')](_0x8566('0xf'),auth[_0x8566('0xb')](),controller['update']);router[_0x8566('0x10')](_0x8566('0xf'),auth[_0x8566('0xb')](),controller[_0x8566('0x11')]);module[_0x8566('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 d9bb598..664b0c4 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 _0xfe56=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x41576e,_0x2f8699){var _0x2b2715=function(_0x1e854a){while(--_0x1e854a){_0x41576e['push'](_0x41576e['shift']());}};_0x2b2715(++_0x2f8699);}(_0xfe56,0x9a));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x6fe5('0x0'));module[_0x6fe5('0x1')]={'priority':{'type':Sequelize[_0x6fe5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6fe5('0x3')],'allowNull':![],'defaultValue':_0x6fe5('0x4')},'appdata':{'type':Sequelize[_0x6fe5('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6fe5('0x3')],'defaultValue':_0x6fe5('0x6')}}; \ No newline at end of file +var _0xf990=['noop','sequelize','exports','INTEGER','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf990,0x146));var _0x0f99=function(_0x50b033,_0x126481){_0x50b033=_0x50b033-0x0;var _0x5ae38f=_0xf990[_0x50b033];return _0x5ae38f;};'use strict';var Sequelize=require(_0x0f99('0x0'));module[_0x0f99('0x1')]={'priority':{'type':Sequelize[_0x0f99('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f99('0x3')],'allowNull':![],'defaultValue':_0x0f99('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0f99('0x3')]},'interval':{'type':Sequelize[_0x0f99('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a750250..eb26080 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 _0x6d4b=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','status','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','WhatsappApplication','include','findAll','show','params','length','includeAll','find','create','body','catch','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','end'];(function(_0xba07a4,_0x29a01e){var _0x81cf82=function(_0x3b8fb0){while(--_0x3b8fb0){_0xba07a4['push'](_0xba07a4['shift']());}};_0x81cf82(++_0x29a01e);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x5936ec,_0x50e4c3){_0x5936ec=_0x5936ec-0x0;var _0x496c3c=_0x6d4b[_0x5936ec];return _0x496c3c;};'use strict';var emlformat=require(_0xb6d4('0x0'));var rimraf=require(_0xb6d4('0x1'));var zipdir=require(_0xb6d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d4('0x3'));var moment=require(_0xb6d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6d4('0x5'));var path=require(_0xb6d4('0x6'));var sox=require(_0xb6d4('0x7'));var csv=require(_0xb6d4('0x8'));var ejs=require(_0xb6d4('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d4('0xa'));var _=require(_0xb6d4('0xb'));var squel=require(_0xb6d4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6d4('0xd'));var deskjs=require(_0xb6d4('0xe'));var toCsv=require(_0xb6d4('0x8'));var querystring=require(_0xb6d4('0xf'));var Papa=require(_0xb6d4('0x10'));var Redis=require(_0xb6d4('0x11'));var authService=require(_0xb6d4('0x12'));var qs=require(_0xb6d4('0x13'));var as=require(_0xb6d4('0x14'));var hardwareService=require(_0xb6d4('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6d4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x900d20,_0x23ca6e){_0x23ca6e=_0x23ca6e||0xcc;return function(_0x13cbfc){if(_0x13cbfc){return _0x900d20[_0xb6d4('0x17')](_0x23ca6e);}return _0x900d20['status'](_0x23ca6e)[_0xb6d4('0x18')]();};}function respondWithResult(_0x2c3af8,_0x4bb27b){_0x4bb27b=_0x4bb27b||0xc8;return function(_0xbad248){if(_0xbad248){return _0x2c3af8['status'](_0x4bb27b)[_0xb6d4('0x19')](_0xbad248);}};}function respondWithFilteredResult(_0x2b7c50,_0x300443){return function(_0x1b0dab){if(_0x1b0dab){var _0x9813c8=typeof _0x300443[_0xb6d4('0x1a')]===_0xb6d4('0x1b')&&typeof _0x300443['limit']===_0xb6d4('0x1b');var _0x14f314=_0x1b0dab[_0xb6d4('0x1c')];var _0x431af2=_0x9813c8?0x0:_0x300443[_0xb6d4('0x1a')];var _0x438053=_0x9813c8?_0x1b0dab[_0xb6d4('0x1c')]:_0x300443[_0xb6d4('0x1a')]+_0x300443[_0xb6d4('0x1d')];var _0x5221e7;if(_0x438053>=_0x14f314){_0x438053=_0x14f314;_0x5221e7=0xc8;}else{_0x5221e7=0xce;}_0x2b7c50['status'](_0x5221e7);return _0x2b7c50[_0xb6d4('0x1e')](_0xb6d4('0x1f'),_0x431af2+'-'+_0x438053+'/'+_0x14f314)[_0xb6d4('0x19')](_0x1b0dab);}return null;};}function patchUpdates(_0x3d3cd6){return function(_0x4e034e){try{jsonpatch['apply'](_0x4e034e,_0x3d3cd6,!![]);}catch(_0x145157){return BPromise[_0xb6d4('0x20')](_0x145157);}return _0x4e034e[_0xb6d4('0x21')]();};}function saveUpdates(_0x5b9fb1,_0x3ee5c4){return function(_0x532cbc){if(_0x532cbc){return _0x532cbc['update'](_0x5b9fb1)[_0xb6d4('0x22')](function(_0x9e402a){return _0x9e402a;});}return null;};}function removeEntity(_0x54ef55,_0x56baa4){return function(_0x3a86ac){if(_0x3a86ac){return _0x3a86ac[_0xb6d4('0x23')]()[_0xb6d4('0x22')](function(){_0x54ef55[_0xb6d4('0x24')](0xcc)[_0xb6d4('0x18')]();});}};}function handleEntityNotFound(_0x223ca0,_0x1d1ac6){return function(_0x474cfc){if(!_0x474cfc){_0x223ca0[_0xb6d4('0x17')](0x194);}return _0x474cfc;};}function handleError(_0x3aedc7,_0xe67526){_0xe67526=_0xe67526||0x1f4;return function(_0x18db34){logger['error'](_0x18db34[_0xb6d4('0x25')]);if(_0x18db34[_0xb6d4('0x26')]){delete _0x18db34['name'];}_0x3aedc7[_0xb6d4('0x24')](_0xe67526)['send'](_0x18db34);};}exports[_0xb6d4('0x27')]=function(_0x3f2e8b,_0x346d4d){var _0x3191d2={},_0x1a311d={},_0x1b7ace={'count':0x0,'rows':[]};var _0x41847c=_[_0xb6d4('0x28')](db['WhatsappApplication'][_0xb6d4('0x29')],function(_0x1fea09){return{'name':_0x1fea09[_0xb6d4('0x2a')],'type':_0x1fea09['type'][_0xb6d4('0x2b')]};});_0x1a311d[_0xb6d4('0x2c')]=_['map'](_0x41847c,_0xb6d4('0x26'));_0x1a311d[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x3f2e8b['query']);_0x1a311d['filters']=_['intersection'](_0x1a311d[_0xb6d4('0x2c')],_0x1a311d[_0xb6d4('0x2d')]);_0x3191d2[_0xb6d4('0x2f')]=_[_0xb6d4('0x30')](_0x1a311d[_0xb6d4('0x2c')],qs[_0xb6d4('0x31')](_0x3f2e8b['query']['fields']));_0x3191d2[_0xb6d4('0x2f')]=_0x3191d2['attributes']['length']?_0x3191d2['attributes']:_0x1a311d['model'];if(!_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x32')]('nolimit')){_0x3191d2[_0xb6d4('0x1d')]=qs['limit'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1d')]);_0x3191d2[_0xb6d4('0x1a')]=qs[_0xb6d4('0x1a')](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1a')]);}_0x3191d2[_0xb6d4('0x33')]=qs['sort'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x34')]);_0x3191d2[_0xb6d4('0x35')]=qs['filters'](_['pick'](_0x3f2e8b[_0xb6d4('0x2d')],_0x1a311d[_0xb6d4('0x36')]),_0x41847c);if(_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x37')]){_0x3191d2[_0xb6d4('0x35')]=_['merge'](_0x3191d2[_0xb6d4('0x35')],{'$or':_['map'](_0x41847c,function(_0x188a38){if(_0x188a38[_0xb6d4('0x38')]!==_0xb6d4('0x39')){var _0x4e0ac2={};_0x4e0ac2[_0x188a38[_0xb6d4('0x26')]]={'$like':'%'+_0x3f2e8b['query']['filter']+'%'};return _0x4e0ac2;}})});}_0x3191d2=_[_0xb6d4('0x3a')]({},_0x3191d2,_0x3f2e8b[_0xb6d4('0x3b')]);var _0xa71efc={'where':_0x3191d2[_0xb6d4('0x35')]};return db[_0xb6d4('0x3c')][_0xb6d4('0x1c')](_0xa71efc)['then'](function(_0x9c3a24){_0x1b7ace['count']=_0x9c3a24;if(_0x3f2e8b[_0xb6d4('0x2d')]['includeAll']){_0x3191d2[_0xb6d4('0x3d')]=[{'all':!![]}];}return db[_0xb6d4('0x3c')][_0xb6d4('0x3e')](_0x3191d2);})[_0xb6d4('0x22')](function(_0x23aefc){_0x1b7ace['rows']=_0x23aefc;return _0x1b7ace;})[_0xb6d4('0x22')](respondWithFilteredResult(_0x346d4d,_0x3191d2))['catch'](handleError(_0x346d4d,null));};exports[_0xb6d4('0x3f')]=function(_0x2c92c9,_0x12c55e){var _0x1d7960={'raw':!![],'where':{'id':_0x2c92c9[_0xb6d4('0x40')]['id']}},_0x314bfb={};_0x314bfb['model']=_[_0xb6d4('0x2e')](db['WhatsappApplication'][_0xb6d4('0x29')]);_0x314bfb[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x2c92c9[_0xb6d4('0x2d')]);_0x314bfb[_0xb6d4('0x36')]=_[_0xb6d4('0x30')](_0x314bfb['model'],_0x314bfb['query']);_0x1d7960[_0xb6d4('0x2f')]=_['intersection'](_0x314bfb['model'],qs[_0xb6d4('0x31')](_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x31')]));_0x1d7960['attributes']=_0x1d7960['attributes'][_0xb6d4('0x41')]?_0x1d7960[_0xb6d4('0x2f')]:_0x314bfb[_0xb6d4('0x2c')];if(_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x42')]){_0x1d7960['include']=[{'all':!![]}];}_0x1d7960=_[_0xb6d4('0x3a')]({},_0x1d7960,_0x2c92c9[_0xb6d4('0x3b')]);return db[_0xb6d4('0x3c')][_0xb6d4('0x43')](_0x1d7960)[_0xb6d4('0x22')](handleEntityNotFound(_0x12c55e,null))[_0xb6d4('0x22')](respondWithResult(_0x12c55e,null))['catch'](handleError(_0x12c55e,null));};exports['create']=function(_0x15eb4d,_0x47efcf){return db['WhatsappApplication'][_0xb6d4('0x44')](_0x15eb4d[_0xb6d4('0x45')],{})[_0xb6d4('0x22')](respondWithResult(_0x47efcf,0xc9))[_0xb6d4('0x46')](handleError(_0x47efcf,null));};exports[_0xb6d4('0x47')]=function(_0x3544ed,_0x28a5d5){if(_0x3544ed['body']['id']){delete _0x3544ed[_0xb6d4('0x45')]['id'];}return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x3544ed[_0xb6d4('0x40')]['id']}})['then'](handleEntityNotFound(_0x28a5d5,null))['then'](saveUpdates(_0x3544ed['body'],null))['then'](respondWithResult(_0x28a5d5,null))[_0xb6d4('0x46')](handleError(_0x28a5d5,null));};exports['destroy']=function(_0x2d2891,_0x19c8fd){return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x2d2891[_0xb6d4('0x40')]['id']}})[_0xb6d4('0x22')](handleEntityNotFound(_0x19c8fd,null))['then'](removeEntity(_0x19c8fd,null))['catch'](handleError(_0x19c8fd,null));}; \ No newline at end of file +var _0x9512=['update','then','destroy','error','stack','name','send','WhatsappApplication','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../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','save'];(function(_0x7cec73,_0x473323){var _0x42ef34=function(_0x13384b){while(--_0x13384b){_0x7cec73['push'](_0x7cec73['shift']());}};_0x42ef34(++_0x473323);}(_0x9512,0x75));var _0x2951=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0x9512[_0x3815c2];return _0x271f88;};'use strict';var emlformat=require(_0x2951('0x0'));var rimraf=require(_0x2951('0x1'));var zipdir=require(_0x2951('0x2'));var jsonpatch=require(_0x2951('0x3'));var rp=require(_0x2951('0x4'));var moment=require(_0x2951('0x5'));var BPromise=require(_0x2951('0x6'));var Mustache=require('mustache');var util=require(_0x2951('0x7'));var path=require(_0x2951('0x8'));var sox=require(_0x2951('0x9'));var csv=require(_0x2951('0xa'));var ejs=require(_0x2951('0xb'));var fs=require('fs');var fs_extra=require(_0x2951('0xc'));var _=require(_0x2951('0xd'));var squel=require('squel');var crypto=require(_0x2951('0xe'));var jsforce=require(_0x2951('0xf'));var deskjs=require(_0x2951('0x10'));var toCsv=require(_0x2951('0xa'));var querystring=require(_0x2951('0x11'));var Papa=require(_0x2951('0x12'));var Redis=require('ioredis');var authService=require(_0x2951('0x13'));var qs=require(_0x2951('0x14'));var as=require(_0x2951('0x15'));var hardwareService=require(_0x2951('0x16'));var logger=require('../../config/logger')(_0x2951('0x17'));var utils=require(_0x2951('0x18'));var config=require(_0x2951('0x19'));var licenseUtil=require(_0x2951('0x1a'));var db=require(_0x2951('0x1b'))['db'];function respondWithStatusCode(_0x48a757,_0x3ca182){_0x3ca182=_0x3ca182||0xcc;return function(_0x2dc786){if(_0x2dc786){return _0x48a757[_0x2951('0x1c')](_0x3ca182);}return _0x48a757[_0x2951('0x1d')](_0x3ca182)[_0x2951('0x1e')]();};}function respondWithResult(_0x13a494,_0x240479){_0x240479=_0x240479||0xc8;return function(_0x25d7fc){if(_0x25d7fc){return _0x13a494[_0x2951('0x1d')](_0x240479)[_0x2951('0x1f')](_0x25d7fc);}};}function respondWithFilteredResult(_0x40de23,_0x402072){return function(_0x3ea695){if(_0x3ea695){var _0x5750e9=typeof _0x402072[_0x2951('0x20')]===_0x2951('0x21')&&typeof _0x402072[_0x2951('0x22')]===_0x2951('0x21');var _0x3d0a9c=_0x3ea695[_0x2951('0x23')];var _0x4a9cb2=_0x5750e9?0x0:_0x402072[_0x2951('0x20')];var _0xdbc682=_0x5750e9?_0x3ea695[_0x2951('0x23')]:_0x402072[_0x2951('0x20')]+_0x402072[_0x2951('0x22')];var _0x54e060;if(_0xdbc682>=_0x3d0a9c){_0xdbc682=_0x3d0a9c;_0x54e060=0xc8;}else{_0x54e060=0xce;}_0x40de23['status'](_0x54e060);return _0x40de23[_0x2951('0x24')](_0x2951('0x25'),_0x4a9cb2+'-'+_0xdbc682+'/'+_0x3d0a9c)[_0x2951('0x1f')](_0x3ea695);}return null;};}function patchUpdates(_0x367343){return function(_0x55e473){try{jsonpatch['apply'](_0x55e473,_0x367343,!![]);}catch(_0x2b8938){return BPromise['reject'](_0x2b8938);}return _0x55e473[_0x2951('0x26')]();};}function saveUpdates(_0x17f5d0,_0x24a027){return function(_0x579f2b){if(_0x579f2b){return _0x579f2b[_0x2951('0x27')](_0x17f5d0)[_0x2951('0x28')](function(_0x567fcd){return _0x567fcd;});}return null;};}function removeEntity(_0x22c841,_0x3e86b0){return function(_0x4afea7){if(_0x4afea7){return _0x4afea7[_0x2951('0x29')]()[_0x2951('0x28')](function(){_0x22c841[_0x2951('0x1d')](0xcc)[_0x2951('0x1e')]();});}};}function handleEntityNotFound(_0x5ee6e2,_0x1269d5){return function(_0x7082b){if(!_0x7082b){_0x5ee6e2[_0x2951('0x1c')](0x194);}return _0x7082b;};}function handleError(_0x1acb0a,_0xaa447c){_0xaa447c=_0xaa447c||0x1f4;return function(_0x263380){logger[_0x2951('0x2a')](_0x263380[_0x2951('0x2b')]);if(_0x263380[_0x2951('0x2c')]){delete _0x263380['name'];}_0x1acb0a[_0x2951('0x1d')](_0xaa447c)[_0x2951('0x2d')](_0x263380);};}exports['index']=function(_0x1bfca1,_0x287628){var _0x233c14={},_0xd55127={},_0x275824={'count':0x0,'rows':[]};var _0x2dc926=_['map'](db[_0x2951('0x2e')][_0x2951('0x2f')],function(_0x53b493){return{'name':_0x53b493[_0x2951('0x30')],'type':_0x53b493[_0x2951('0x31')]['key']};});_0xd55127[_0x2951('0x32')]=_[_0x2951('0x33')](_0x2dc926,_0x2951('0x2c'));_0xd55127['query']=_[_0x2951('0x34')](_0x1bfca1[_0x2951('0x35')]);_0xd55127[_0x2951('0x36')]=_[_0x2951('0x37')](_0xd55127[_0x2951('0x32')],_0xd55127['query']);_0x233c14['attributes']=_[_0x2951('0x37')](_0xd55127[_0x2951('0x32')],qs['fields'](_0x1bfca1[_0x2951('0x35')][_0x2951('0x38')]));_0x233c14[_0x2951('0x39')]=_0x233c14['attributes'][_0x2951('0x3a')]?_0x233c14[_0x2951('0x39')]:_0xd55127['model'];if(!_0x1bfca1[_0x2951('0x35')][_0x2951('0x3b')](_0x2951('0x3c'))){_0x233c14['limit']=qs[_0x2951('0x22')](_0x1bfca1[_0x2951('0x35')]['limit']);_0x233c14['offset']=qs[_0x2951('0x20')](_0x1bfca1[_0x2951('0x35')][_0x2951('0x20')]);}_0x233c14[_0x2951('0x3d')]=qs[_0x2951('0x3e')](_0x1bfca1['query']['sort']);_0x233c14[_0x2951('0x3f')]=qs[_0x2951('0x36')](_['pick'](_0x1bfca1['query'],_0xd55127[_0x2951('0x36')]),_0x2dc926);if(_0x1bfca1[_0x2951('0x35')][_0x2951('0x40')]){_0x233c14[_0x2951('0x3f')]=_['merge'](_0x233c14[_0x2951('0x3f')],{'$or':_[_0x2951('0x33')](_0x2dc926,function(_0x39d292){if(_0x39d292[_0x2951('0x31')]!==_0x2951('0x41')){var _0x3eabe9={};_0x3eabe9[_0x39d292[_0x2951('0x2c')]]={'$like':'%'+_0x1bfca1[_0x2951('0x35')][_0x2951('0x40')]+'%'};return _0x3eabe9;}})});}_0x233c14=_[_0x2951('0x42')]({},_0x233c14,_0x1bfca1[_0x2951('0x43')]);var _0x4aefb9={'where':_0x233c14[_0x2951('0x3f')]};return db['WhatsappApplication'][_0x2951('0x23')](_0x4aefb9)[_0x2951('0x28')](function(_0x23fc09){_0x275824['count']=_0x23fc09;if(_0x1bfca1[_0x2951('0x35')][_0x2951('0x44')]){_0x233c14[_0x2951('0x45')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2951('0x46')](_0x233c14);})[_0x2951('0x28')](function(_0x37fb45){_0x275824[_0x2951('0x47')]=_0x37fb45;return _0x275824;})[_0x2951('0x28')](respondWithFilteredResult(_0x287628,_0x233c14))[_0x2951('0x48')](handleError(_0x287628,null));};exports[_0x2951('0x49')]=function(_0x259dfa,_0x180a04){var _0x1091f9={'raw':!![],'where':{'id':_0x259dfa[_0x2951('0x4a')]['id']}},_0x97f532={};_0x97f532[_0x2951('0x32')]=_[_0x2951('0x34')](db[_0x2951('0x2e')][_0x2951('0x2f')]);_0x97f532[_0x2951('0x35')]=_['keys'](_0x259dfa[_0x2951('0x35')]);_0x97f532[_0x2951('0x36')]=_[_0x2951('0x37')](_0x97f532['model'],_0x97f532[_0x2951('0x35')]);_0x1091f9[_0x2951('0x39')]=_['intersection'](_0x97f532[_0x2951('0x32')],qs[_0x2951('0x38')](_0x259dfa[_0x2951('0x35')][_0x2951('0x38')]));_0x1091f9['attributes']=_0x1091f9['attributes'][_0x2951('0x3a')]?_0x1091f9[_0x2951('0x39')]:_0x97f532[_0x2951('0x32')];if(_0x259dfa[_0x2951('0x35')][_0x2951('0x44')]){_0x1091f9[_0x2951('0x45')]=[{'all':!![]}];}_0x1091f9=_[_0x2951('0x42')]({},_0x1091f9,_0x259dfa[_0x2951('0x43')]);return db[_0x2951('0x2e')][_0x2951('0x4b')](_0x1091f9)[_0x2951('0x28')](handleEntityNotFound(_0x180a04,null))[_0x2951('0x28')](respondWithResult(_0x180a04,null))['catch'](handleError(_0x180a04,null));};exports[_0x2951('0x4c')]=function(_0x1e68bc,_0x4b3382){return db[_0x2951('0x2e')][_0x2951('0x4c')](_0x1e68bc['body'],{})[_0x2951('0x28')](respondWithResult(_0x4b3382,0xc9))[_0x2951('0x48')](handleError(_0x4b3382,null));};exports['update']=function(_0x44cfa1,_0x5c11ef){if(_0x44cfa1['body']['id']){delete _0x44cfa1[_0x2951('0x4d')]['id'];}return db[_0x2951('0x2e')][_0x2951('0x4b')]({'where':{'id':_0x44cfa1[_0x2951('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c11ef,null))['then'](saveUpdates(_0x44cfa1[_0x2951('0x4d')],null))[_0x2951('0x28')](respondWithResult(_0x5c11ef,null))['catch'](handleError(_0x5c11ef,null));};exports['destroy']=function(_0x4bbcfd,_0xf1adc8){return db[_0x2951('0x2e')][_0x2951('0x4b')]({'where':{'id':_0x4bbcfd[_0x2951('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf1adc8,null))['then'](removeEntity(_0xf1adc8,null))[_0x2951('0x48')](handleError(_0xf1adc8,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index bf8ea27..d349f6d 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 _0xf041=['bluebird','path','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x490014,_0x519ad6){var _0x289bee=function(_0x44fcc8){while(--_0x44fcc8){_0x490014['push'](_0x490014['shift']());}};_0x289bee(++_0x519ad6);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f04('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2a3a=['./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x1042fa,_0x433b12){var _0x250863=function(_0x8122e4){while(--_0x8122e4){_0x1042fa['push'](_0x1042fa['shift']());}};_0x250863(++_0x433b12);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x3650ac,_0x2e2859){_0x3650ac=_0x3650ac-0x0;var _0x381453=_0x2a3a[_0x3650ac];return _0x381453;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2a3('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f9bdd9e..5537af9 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f7a29,_0x55de79){var _0x47b74b=function(_0x53d890){while(--_0x53d890){_0x2f7a29['push'](_0x2f7a29['shift']());}};_0x47b74b(++_0x55de79);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c71c1,_0x7b1da6){_0x1c71c1=_0x1c71c1-0x0;var _0x564f95=_0x6aa7[_0x1c71c1];return _0x564f95;};'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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x271b53,_0x53c008){var _0x157909=function(_0x4c921c){while(--_0x4c921c){_0x271b53['push'](_0x271b53['shift']());}};_0x157909(++_0x53c008);}(_0x425d,0x1e0));var _0xd425=function(_0xa21fee,_0x11d555){_0xa21fee=_0xa21fee-0x0;var _0x467965=_0x425d[_0xa21fee];return _0x467965;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6daabb2..80722e7 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 _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get'];(function(_0x37ddb7,_0x32d333){var _0x36c284=function(_0x54ca86){while(--_0x54ca86){_0x37ddb7['push'](_0x37ddb7['shift']());}};_0x36c284(++_0x32d333);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0x7d9f[_0x337dd9];return _0x20f4fc;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'whatsappinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('0x1d')]=router; \ No newline at end of file +var _0x6b8f=['/:id/messages','getMessages','post','create','addMessage','tracked','whatsapp','addTags','whatsappinteraction:update','delete','/:id/tags','removeTags','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x140f08,_0x4b90db){var _0x1d79cd=function(_0x1489ac){while(--_0x1489ac){_0x140f08['push'](_0x140f08['shift']());}};_0x1d79cd(++_0x4b90db);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x563ffe,_0x1170f8){_0x563ffe=_0x563ffe-0x0;var _0xdb507f=_0x6b8f[_0x563ffe];return _0xdb507f;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0x6')](_0xf6b8('0xc'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf6b8('0xe')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);router[_0xf6b8('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf6b8('0x10')]);router[_0xf6b8('0xe')]('/:id/tags',auth[_0xf6b8('0x9')](),interaction[_0xf6b8('0x11')](_0xf6b8('0x12'),'whatsappinteraction:addtags'),controller[_0xf6b8('0x13')]);router['put'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),interaction[_0xf6b8('0x11')](_0xf6b8('0x12'),_0xf6b8('0x14')),controller['update']);router['delete'](_0xf6b8('0xa'),auth['isAuthenticated'](),interaction[_0xf6b8('0x11')](_0xf6b8('0x12'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xf6b8('0x15')](_0xf6b8('0x16'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0x17')]);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 5813a46..cefb128 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 _0xd206=['moment','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x4c5a90,_0x39edaf){var _0x8e83e8=function(_0xce4f7e){while(--_0xce4f7e){_0x4c5a90['push'](_0x4c5a90['shift']());}};_0x8e83e8(++_0x39edaf);}(_0xd206,0x107));var _0x6d20=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xd206[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0x6d20('0x0'));var moment=require(_0x6d20('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d20('0x3')]},'disposition':{'type':Sequelize[_0x6d20('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d20('0x4')]},'note':{'type':Sequelize[_0x6d20('0x4')]},'phone':{'type':Sequelize[_0x6d20('0x4')]},'read1stAt':{'type':Sequelize[_0x6d20('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x41fe=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0xd7f258,_0x4d054f){var _0x255d4c=function(_0x3e8f74){while(--_0x3e8f74){_0xd7f258['push'](_0xd7f258['shift']());}};_0x255d4c(++_0x4d054f);}(_0x41fe,0xd1));var _0xe41f=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x41fe[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require(_0xe41f('0x0'));var moment=require(_0xe41f('0x1'));module[_0xe41f('0x2')]={'closed':{'type':Sequelize[_0xe41f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe41f('0x4')]},'disposition':{'type':Sequelize[_0xe41f('0x5')]},'secondDisposition':{'type':Sequelize[_0xe41f('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe41f('0x5')]},'note':{'type':Sequelize[_0xe41f('0x5')]},'phone':{'type':Sequelize[_0xe41f('0x5')]},'read1stAt':{'type':Sequelize[_0xe41f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe41f('0x6')]('in',_0xe41f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe41f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe41f('0x6')]('in',_0xe41f('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe41f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 7e6350d..c5763a0 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 _0x988c=['tools_tags','select','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','union','start','body','keys','some','compact','WhatsappAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','unreadMessages','order','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','includeAll','options','create','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','spread','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','Contact','firstName','Attachment','Messages','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','lastName','direction','secret','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','sort','where','field','color','from'];(function(_0x2a894c,_0x418da3){var _0x159fe8=function(_0x408c0c){while(--_0x408c0c){_0x2a894c['push'](_0x2a894c['shift']());}};_0x159fe8(++_0x418da3);}(_0x988c,0x19e));var _0xc988=function(_0x2469eb,_0x5024fa){_0x2469eb=_0x2469eb-0x0;var _0x5dc202=_0x988c[_0x2469eb];return _0x5dc202;};'use strict';var emlformat=require(_0xc988('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc988('0x1'));var moment=require(_0xc988('0x2'));var BPromise=require(_0xc988('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc988('0x4'));var csv=require(_0xc988('0x5'));var ejs=require(_0xc988('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc988('0x7'));var squel=require(_0xc988('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc988('0x9'));var toCsv=require(_0xc988('0x5'));var querystring=require(_0xc988('0xa'));var Papa=require(_0xc988('0xb'));var Redis=require(_0xc988('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc988('0xd'));var as=require(_0xc988('0xe'));var pdf=require(_0xc988('0xf'));var hardwareService=require(_0xc988('0x10'));var logger=require(_0xc988('0x11'))('api');var utils=require(_0xc988('0x12'));var config=require(_0xc988('0x13'));var licenseUtil=require(_0xc988('0x14'));var db=require('../../mysqldb')['db'];config[_0xc988('0x15')]=_['defaults'](config[_0xc988('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc988('0x16'))(new Redis(config[_0xc988('0x15')]));require(_0xc988('0x17'))[_0xc988('0x18')](socket);function respondWithStatusCode(_0x5dbfbf,_0x25c583){_0x25c583=_0x25c583||0xcc;return function(_0x35c0b4){if(_0x35c0b4){return _0x5dbfbf[_0xc988('0x19')](_0x25c583);}return _0x5dbfbf[_0xc988('0x1a')](_0x25c583)[_0xc988('0x1b')]();};}function respondWithResult(_0x24a096,_0xcb99f9){_0xcb99f9=_0xcb99f9||0xc8;return function(_0x35aebb){if(_0x35aebb){return _0x24a096[_0xc988('0x1a')](_0xcb99f9)[_0xc988('0x1c')](_0x35aebb);}};}function respondWithFilteredResult(_0xd27863,_0x49738a){return function(_0x314a24){if(_0x314a24){var _0x23677f=typeof _0x49738a[_0xc988('0x1d')]===_0xc988('0x1e')&&typeof _0x49738a[_0xc988('0x1f')]==='undefined';var _0x5d1c5f=_0x314a24[_0xc988('0x20')];var _0x47f438=_0x23677f?0x0:_0x49738a[_0xc988('0x1d')];var _0x3cad71=_0x23677f?_0x314a24['count']:_0x49738a['offset']+_0x49738a[_0xc988('0x1f')];var _0x304a30;if(_0x3cad71>=_0x5d1c5f){_0x3cad71=_0x5d1c5f;_0x304a30=0xc8;}else{_0x304a30=0xce;}_0xd27863[_0xc988('0x1a')](_0x304a30);return _0xd27863['set'](_0xc988('0x21'),_0x47f438+'-'+_0x3cad71+'/'+_0x5d1c5f)[_0xc988('0x1c')](_0x314a24);}return null;};}function patchUpdates(_0x32ea75){return function(_0x49fe1c){try{jsonpatch[_0xc988('0x22')](_0x49fe1c,_0x32ea75,!![]);}catch(_0xc57267){return BPromise[_0xc988('0x23')](_0xc57267);}return _0x49fe1c['save']();};}function saveUpdates(_0x5444a5,_0x343ac3){return function(_0x3ca571){if(_0x3ca571){return _0x3ca571[_0xc988('0x24')](_0x5444a5)[_0xc988('0x25')](function(_0x155c8e){return _0x155c8e;});}return null;};}function removeEntity(_0x3adb60,_0x176741){return function(_0xfb2eb4){if(_0xfb2eb4){return _0xfb2eb4['destroy']()[_0xc988('0x25')](function(){_0x3adb60[_0xc988('0x1a')](0xcc)[_0xc988('0x1b')]();});}};}function handleEntityNotFound(_0x3f8b9a,_0x38bcee){return function(_0x1c9d07){if(!_0x1c9d07){_0x3f8b9a[_0xc988('0x19')](0x194);}return _0x1c9d07;};}function handleError(_0xd97eff,_0x495b1a){_0x495b1a=_0x495b1a||0x1f4;return function(_0x2a0d6f){logger[_0xc988('0x26')](_0x2a0d6f[_0xc988('0x27')]);if(_0x2a0d6f[_0xc988('0x28')]){delete _0x2a0d6f['name'];}_0xd97eff['status'](_0x495b1a)[_0xc988('0x29')](_0x2a0d6f);};}function getInteractionUsers(_0x11d51f,_0x20aaab){return new BPromise(function(_0x4b954a,_0x117ec8){try{if(_0x20aaab[_0x11d51f['id']]){_0x11d51f[_0xc988('0x2a')]=_[_0xc988('0x2b')](_0x20aaab[_0x11d51f['id']],function(_0x467bd4){return{'id':_0x467bd4['id'],'fullname':_0x467bd4[_0xc988('0x2c')]};});}}catch(_0x34da97){_0x117ec8(_0x34da97);}_0x4b954a(_0x11d51f);});}function getInteractionTags(_0x3a798f,_0x1344db){return new BPromise(function(_0x3a5fe7,_0x2d1cfc){try{if(_0x3a798f[_0xc988('0x2d')]){_0x3a798f[_0xc988('0x2e')]=[];_0x3a798f[_0xc988('0x2d')][_0xc988('0x2f')](',')['forEach'](function(_0x5aa8fe){_0x3a798f[_0xc988('0x2e')][_0xc988('0x30')](_0x1344db[_0x5aa8fe]);});}delete _0x3a798f['TagIds'];}catch(_0x10e73e){_0x2d1cfc(_0x10e73e);}_0x3a5fe7(_0x3a798f);});}function updateWhatsappInteraction(_0x10b0f9,_0x5b003f,_0x1d26ea){return new BPromise(function(_0x284ce5,_0x1f7bf9){return getInteractionUsers(_0x10b0f9,_0x1d26ea)['then'](function(_0x5d11fc){return getInteractionTags(_0x5d11fc,_0x5b003f);})[_0xc988('0x25')](function(_0x34fbe6){return getStateInteraction(_0x34fbe6);})[_0xc988('0x25')](function(_0x2c105c){_0x284ce5(_0x2c105c);})[_0xc988('0x31')](function(_0x627095){_0x1f7bf9(_0x627095);});});}function getStateInteraction(_0x1bdeb5){return new BPromise(function(_0x17ff79){_0x1bdeb5[_0xc988('0x32')]=0x0;_0x1bdeb5[_0xc988('0x33')]=0x0;_0x1bdeb5['answered']=0x0;_0x1bdeb5[_0xc988('0x34')]=0x0;_0x1bdeb5[_0xc988('0x35')]=0x0;if(!_0x1bdeb5[_0xc988('0x36')]&&!_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x32')]+=0x1;}if(!_0x1bdeb5[_0xc988('0x36')]&&_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x33')]+=0x1;if(_0x1bdeb5[_0xc988('0x32')]){_0x1bdeb5['waiting']-=0x1;}}if(_0x1bdeb5[_0xc988('0x36')]&&_0x1bdeb5[_0xc988('0x37')]){_0x1bdeb5['answered']+=0x1;if(_0x1bdeb5[_0xc988('0x33')]){_0x1bdeb5[_0xc988('0x33')]-=0x1;}}if(_0x1bdeb5[_0xc988('0x36')]&&!_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x34')]+=0x1;if(_0x1bdeb5[_0xc988('0x32')]){_0x1bdeb5['waiting']-=0x1;}}_0x1bdeb5[_0xc988('0x35')]+=0x1;_0x17ff79(_0x1bdeb5);});}exports[_0xc988('0x38')]=function(_0x4cefe6,_0x20cadd){var _0x3a1617={},_0x2ec03d={},_0xa996f7={'count':0x0,'rows':[]};var _0x43c71e=_[_0xc988('0x2b')](db['WhatsappInteraction'][_0xc988('0x39')],function(_0x4a67bd){return{'name':_0x4a67bd[_0xc988('0x3a')],'type':_0x4a67bd[_0xc988('0x3b')]['key']};});_0x2ec03d[_0xc988('0x3c')]=_[_0xc988('0x2b')](_0x43c71e,_0xc988('0x28'));_0x2ec03d['query']=_['keys'](_0x4cefe6[_0xc988('0x3d')]);_0x2ec03d[_0xc988('0x3e')]=_[_0xc988('0x3f')](_0x2ec03d[_0xc988('0x3c')],_0x2ec03d[_0xc988('0x3d')]);_0x3a1617[_0xc988('0x40')]=_[_0xc988('0x3f')](_0x2ec03d[_0xc988('0x3c')],qs['fields'](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x41')]));_0x3a1617[_0xc988('0x40')]=_0x3a1617[_0xc988('0x40')][_0xc988('0x42')]?_0x3a1617[_0xc988('0x40')]:_0x2ec03d[_0xc988('0x3c')];if(!_0x4cefe6['query']['hasOwnProperty']('nolimit')){_0x3a1617[_0xc988('0x1f')]=qs['limit'](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x1f')]);_0x3a1617[_0xc988('0x1d')]=qs[_0xc988('0x1d')](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x1d')]);}_0x3a1617['order']=qs[_0xc988('0x43')](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x43')]);_0x3a1617[_0xc988('0x44')]=qs[_0xc988('0x3e')](_['pick'](_0x4cefe6[_0xc988('0x3d')],_0x2ec03d['filters']),_0x43c71e);var _0x24674a=[];var _0x15c0a9=squel['select']()['field']('id')[_0xc988('0x45')](_0xc988('0x28'))[_0xc988('0x45')](_0xc988('0x46'))[_0xc988('0x47')](_0xc988('0x48'));var _0x4e3f00=squel[_0xc988('0x49')]()[_0xc988('0x45')]('u.id')[_0xc988('0x45')](_0xc988('0x4a'))[_0xc988('0x45')](_0xc988('0x4b'))[_0xc988('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xc988('0x4c'),'u',_0xc988('0x4d'));var _0x2dfb6d=squel['select']()[_0xc988('0x47')](_0xc988('0x4e'),'i')[_0xc988('0x4f')](_0xc988('0x50'),'c',_0xc988('0x51'))[_0xc988('0x4f')](_0xc988('0x4c'),'o',_0xc988('0x52'))['left_join'](_0xc988('0x53'),'a',_0xc988('0x54'))[_0xc988('0x4f')](_0xc988('0x55'),'me',_0xc988('0x56'))['left_join'](_0xc988('0x57'),'it',_0xc988('0x58'))[_0xc988('0x4f')](_0xc988('0x48'),'t',_0xc988('0x59'));var _0x264dbf=squel[_0xc988('0x5a')]();var _0x513f59=[];var _0x40e033=squel[_0xc988('0x5a')]();var _0x509c93;if(_0x4cefe6['query']['search']){_0x509c93=as[_0xc988('0x5b')](_0x4cefe6['query'][_0xc988('0x5c')]);var _0x9f2344=_0x509c93[_0xc988('0x5d')];for(var _0x2ea91f=0x0;_0x2ea91f<_0x509c93[_0xc988('0x5e')][_0xc988('0x42')];_0x2ea91f++){var _0x31016e=_0x509c93[_0xc988('0x5e')][_0x2ea91f];var _0x536b72='i';var _0x452c75=_['find'](_0x43c71e,['name',_0x31016e[_0xc988('0x45')]]);if(!_0x452c75){switch(_0x31016e[_0xc988('0x45')]){case'unreadMessages':if(_0x31016e[_0xc988('0x5f')]==0x1){_0x2dfb6d[_0xc988('0x60')]('`'+_0x31016e[_0xc988('0x45')]+'`\x20=\x200');}else{_0x2dfb6d['having']('`'+_0x31016e[_0xc988('0x45')]+_0xc988('0x61'));}break;case'Contact':if(_0x31016e[_0xc988('0x62')]===_0xc988('0x63')){if(_0x31016e[_0xc988('0x5f')][_0xc988('0x2f')]('\x20')[_0xc988('0x42')]>0x1){_0x264dbf[_0x9f2344](_0xc988('0x64'),qs[_0xc988('0x65')](_0x31016e[_0xc988('0x5f')]),null);}else{var _0x3eeff5='%'+_0x31016e[_0xc988('0x5f')]+'%';_0x264dbf[_0x9f2344](_0xc988('0x66'),_0x3eeff5,_0x3eeff5,_0x3eeff5);}}else{_0x452c75=_[_0xc988('0x67')](_0x43c71e,[_0xc988('0x28'),_0xc988('0x68')]);_0x31016e['field']='ContactId';_0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')]['start'],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}break;case _0xc988('0x6b'):var _0xcbb427=_0x31016e[_0xc988('0x5f')][_0xc988('0x2f')](',')[_0xc988('0x2b')](function(_0x5d0704){return Number(_0x5d0704);});_0xcbb427[_0xc988('0x6c')](function(_0x329741){_0x40e033['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x329741+',%');});_0x513f59=_[_0xc988('0x6d')](_0x513f59,_0xcbb427);break;case'User':if(_0x31016e[_0xc988('0x62')]===_0xc988('0x63')){_0x264dbf[_0x9f2344]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31016e[_0xc988('0x5f')]+'%',null);}else{_0x452c75=_[_0xc988('0x67')](_0x43c71e,[_0xc988('0x28'),_0xc988('0x37')]);_0x31016e[_0xc988('0x45')]=_0xc988('0x37');_0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}break;case _0xc988('0x6f'):_0x12c40c=as[_0xc988('0x69')]('me',null,_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c['value'][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);break;}}else{var _0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}}}else{var _0x102524=_(_0x4cefe6[_0xc988('0x3d')])[_0xc988('0x70')]()['map'](function(_0x480d68){return _[_0xc988('0x71')](_0x43c71e,['name',_0x480d68])?_0x480d68:undefined;})[_0xc988('0x72')]()[_0xc988('0x5f')]();if(!_['isEmpty'](_0x102524)){_0x102524[_0xc988('0x6c')](function(_0x58b27b){if(_0x58b27b===_0xc988('0x73')){_0x2dfb6d[_0xc988('0x44')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x4cefe6[_0xc988('0x3d')][_0x58b27b]));}else if(_0x58b27b===_0xc988('0x74')){var _0x3fb173=JSON[_0xc988('0x75')](_0x4cefe6[_0xc988('0x3d')][_0x58b27b])[_0xc988('0x76')];var _0x121eba=JSON[_0xc988('0x75')](_0x4cefe6['query'][_0x58b27b])[_0xc988('0x77')];_0x2dfb6d[_0xc988('0x44')](_0xc988('0x78'),_0x3fb173,_0x121eba);}else{if(_0x4cefe6[_0xc988('0x3d')][_0x58b27b]===_0xc988('0x79')){_0x2dfb6d[_0xc988('0x44')]('i.'+_0x58b27b+'\x20IS\x20NULL');}else{_0x2dfb6d['where']('i.'+_0x58b27b+_0xc988('0x7a'),_0x4cefe6['query'][_0x58b27b]);}}});}if(_0x4cefe6[_0xc988('0x3d')]['read']){if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7b')]==0x1){_0x2dfb6d[_0xc988('0x60')]('`unreadMessages`\x20=\x200');}else{_0x2dfb6d[_0xc988('0x60')](_0xc988('0x7c'));}}if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7d')]){_0x513f59=_[_0xc988('0x7e')](_0x4cefe6['query'][_0xc988('0x7d')])?_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7d')]:new Array(_0x4cefe6['query'][_0xc988('0x7d')]);_0x513f59['forEach'](function(_0xd013c0){_0x40e033['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd013c0+',%');});}if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7f')]){var _0x5df930=_0x4cefe6['query'][_0xc988('0x7f')][_0xc988('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc988('0x81')](_0x5df930)){_0x264dbf['or']('i.id\x20LIKE\x20?',_0x5df930+'%')['or'](_0xc988('0x82'),_0x5df930+'%');}else{_0x264dbf['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc988('0x65')](_0x5df930))['or'](_0xc988('0x83'),_0x5df930+'%');}}}_0x2dfb6d[_0xc988('0x44')](_0x264dbf);_0x2dfb6d[_0xc988('0x84')](_0xc988('0x85'));var _0x3f379e={'type':db['Sequelize'][_0xc988('0x86')]['SELECT'],'raw':!![]};var _0x29bbf0=_0x2dfb6d[_0xc988('0x87')]();_0x29bbf0[_0xc988('0x45')](_0xc988('0x85'));_0x29bbf0[_0xc988('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc988('0x88'));if(_0x3a1617[_0xc988('0x89')]){_0x3a1617[_0xc988('0x89')]['forEach'](function(_0x5b1da8){var _0x4b09b7=_0x5b1da8[0x0]===_0xc988('0x8a')?_0x5b1da8[0x0]:'i.'+_0x5b1da8[0x0];_0x2dfb6d[_0xc988('0x89')](_0x4b09b7,_0x5b1da8[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc988('0x8b')](_0x513f59)){_0x2dfb6d[_0xc988('0x60')](_0x40e033);_0x29bbf0['where'](_0xc988('0x8c'),_0x513f59);}BPromise[_0xc988('0x8d')]()[_0xc988('0x25')](function(){if(!_0x509c93){if(_0x4cefe6['query']['WhatsappAccountId'])return;_0x29bbf0[_0xc988('0x44')](_0xc988('0x8e'));_0x2dfb6d[_0xc988('0x44')](_0xc988('0x8e'));return;}if(_0x4cefe6[_0xc988('0x8f')][_0xc988('0x90')]!=='agent')return;return _0x4cefe6[_0xc988('0x8f')][_0xc988('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x176905){if(_[_0xc988('0x8b')](_0x176905)){_0x29bbf0['where'](_0xc988('0x92'));_0x2dfb6d['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x29bbf0['where'](_0xc988('0x93'),_['map'](_0x176905,'id'));_0x2dfb6d[_0xc988('0x44')](_0xc988('0x93'),_['map'](_0x176905,'id'));}});})['then'](function(){if(_0x4cefe6[_0xc988('0x8f')][_0xc988('0x90')]===_0xc988('0x94')&&!_0x509c93&&!_0x4cefe6['query'][_0xc988('0x73')])return[];return db[_0xc988('0x95')][_0xc988('0x3d')](_0x29bbf0[_0xc988('0x96')](),_0x3f379e);})[_0xc988('0x25')](function(_0x120343){_0xa996f7[_0xc988('0x20')]=_0x120343[_0xc988('0x42')];if(_0xa996f7['count']===0x0)return[];return db[_0xc988('0x95')][_0xc988('0x3d')](_0x15c0a9[_0xc988('0x96')](),_0x3f379e)[_0xc988('0x25')](function(_0x54ff0d){_0x24674a=_[_0xc988('0x97')](_0x54ff0d,'id');_0x3f379e=_[_0xc988('0x98')](_0x3f379e,{'model':db[_0xc988('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cefe6['query']['fields']){_0x3a1617[_0xc988('0x40')][_0xc988('0x6c')](function(_0x3bede2){_0x2dfb6d[_0xc988('0x45')]('i.'+_0x3bede2);});}else{_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9a'),_0xc988('0x88'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9b'),_0xc988('0x9c'));_0x2dfb6d['field'](_0xc988('0x9d'),_0xc988('0x9e'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9f'),'contactName');_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa0'));_0x2dfb6d['field'](_0xc988('0xa1'),_0xc988('0xa2'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa3'),_0xc988('0xa4'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa5'),_0xc988('0xa6'));_0x2dfb6d['field'](_0xc988('0xa7'),_0xc988('0xa8'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa9'),_0xc988('0xaa'));_0x2dfb6d['field'](_0xc988('0xab'),_0xc988('0xac'));_0x2dfb6d[_0xc988('0x45')]('o.fullname',_0xc988('0xad'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xae'),_0xc988('0xaf'));_0x2dfb6d['field'](_0xc988('0xb0'),_0xc988('0x2d'));}if(_0x3a1617['limit'])_0x2dfb6d[_0xc988('0x1f')](_0x3a1617[_0xc988('0x1f')]);if(_0x3a1617[_0xc988('0x1d')])_0x2dfb6d[_0xc988('0x1d')](_0x3a1617['offset']);return db[_0xc988('0x95')][_0xc988('0x3d')](_0x2dfb6d[_0xc988('0x96')](),_0x3f379e);})[_0xc988('0x25')](function(_0x5e6f15){if(_0x5e6f15[_0xc988('0x42')]>0x0)_0x4e3f00[_0xc988('0x44')](_0xc988('0xb1'),_[_0xc988('0x2b')](_0x5e6f15,'id'));return db[_0xc988('0x95')][_0xc988('0x3d')](_0x4e3f00[_0xc988('0x96')](),_0x3f379e)[_0xc988('0x25')](function(_0x592f73){var _0x2d7c96=_[_0xc988('0xb2')](_0x592f73,_0xc988('0xb3'));var _0xb32d5c=[];_0x5e6f15['forEach'](function(_0x2b4e43){_0xb32d5c[_0xc988('0x30')](updateWhatsappInteraction(_0x2b4e43,_0x24674a,_0x2d7c96));});return BPromise['all'](_0xb32d5c);});});})[_0xc988('0x25')](function(_0x165553){_0xa996f7[_0xc988('0xb4')]=_0x165553;return _0xa996f7;})[_0xc988('0x25')](respondWithFilteredResult(_0x20cadd,_0x3a1617))[_0xc988('0x31')](handleError(_0x20cadd,null));};exports['show']=function(_0x3e21e2,_0x15ed88){var _0x2a2ed2={'raw':![],'where':{'id':_0x3e21e2['params']['id']}},_0x322e86={};_0x322e86[_0xc988('0x3c')]=_[_0xc988('0x70')](db['WhatsappInteraction']['rawAttributes']);_0x322e86[_0xc988('0x3d')]=_['keys'](_0x3e21e2['query']);_0x322e86[_0xc988('0x3e')]=_[_0xc988('0x3f')](_0x322e86['model'],_0x322e86[_0xc988('0x3d')]);_0x2a2ed2[_0xc988('0x40')]=_[_0xc988('0x3f')](_0x322e86[_0xc988('0x3c')],qs['fields'](_0x3e21e2[_0xc988('0x3d')][_0xc988('0x41')]));_0x2a2ed2['attributes']=_0x2a2ed2[_0xc988('0x40')][_0xc988('0x42')]?_0x2a2ed2[_0xc988('0x40')]:_0x322e86['model'];if(_0x3e21e2['query'][_0xc988('0xb5')]){_0x2a2ed2['include']=[{'all':!![]}];}_0x2a2ed2=_[_0xc988('0x98')]({},_0x2a2ed2,_0x3e21e2[_0xc988('0xb6')]);return db['WhatsappInteraction'][_0xc988('0x67')](_0x2a2ed2)[_0xc988('0x25')](handleEntityNotFound(_0x15ed88,null))[_0xc988('0x25')](respondWithResult(_0x15ed88,null))[_0xc988('0x31')](handleError(_0x15ed88,null));};exports[_0xc988('0xb7')]=function(_0x25492c,_0x12070e){return db['WhatsappInteraction'][_0xc988('0xb7')](_0x25492c[_0xc988('0x6f')],{})[_0xc988('0x25')](respondWithResult(_0x12070e,0xc9))[_0xc988('0x31')](handleError(_0x12070e,null));};exports[_0xc988('0x24')]=function(_0x2befd8,_0x68235){if(_0x2befd8[_0xc988('0x6f')]['id']){delete _0x2befd8['body']['id'];}return db['WhatsappInteraction'][_0xc988('0x67')]({'where':{'id':_0x2befd8[_0xc988('0xb8')]['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x68235,null))[_0xc988('0x25')](saveUpdates(_0x2befd8['body'],null))[_0xc988('0x25')](respondWithResult(_0x68235,null))[_0xc988('0x31')](handleError(_0x68235,null));};exports['destroy']=function(_0xf652f4,_0x255c0d){return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0xf652f4[_0xc988('0xb8')]['id']}})['then'](handleEntityNotFound(_0x255c0d,null))['then'](removeEntity(_0x255c0d,null))[_0xc988('0x31')](handleError(_0x255c0d,null));};exports[_0xc988('0xb9')]=function(_0x5dba4b,_0x3f6441){return db[_0xc988('0x99')][_0xc988('0xb9')]()[_0xc988('0x25')](respondWithResult(_0x3f6441,null))['catch'](handleError(_0x3f6441,null));};exports[_0xc988('0xba')]=function(_0x39474f,_0x1fd584,_0x154b6b){return db[_0xc988('0xbb')]['find']({'where':{'id':_0x39474f['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x1fd584,null))[_0xc988('0x25')](function(_0x1a93e2){if(_0x1a93e2){return _0x1a93e2[_0xc988('0xba')](_0x39474f[_0xc988('0x6f')]['ids'],_['omit'](_0x39474f[_0xc988('0x6f')],[_0xc988('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x1fd584,null))[_0xc988('0x31')](handleError(_0x1fd584,null));};exports[_0xc988('0xbd')]=function(_0x351992,_0x50422c,_0x3fd433){var _0x2736d2={'raw':![],'where':{}};var _0x3623f7={};var _0x46ae94={'count':0x0,'rows':[]};return db[_0xc988('0x99')][_0xc988('0xbe')]({'where':{'id':_0x351992['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x50422c,null))['then'](function(_0x38cad3){if(_0x38cad3){_0x3623f7[_0xc988('0x3c')]=_[_0xc988('0x70')](db[_0xc988('0xbb')][_0xc988('0x39')]);_0x3623f7[_0xc988('0x3d')]=_[_0xc988('0x70')](_0x351992[_0xc988('0x3d')]);_0x3623f7['filters']=_[_0xc988('0x3f')](_0x3623f7[_0xc988('0x3c')],_0x3623f7[_0xc988('0x3d')]);_0x2736d2['attributes']=_['intersection'](_0x3623f7[_0xc988('0x3c')],qs[_0xc988('0x41')](_0x351992['query'][_0xc988('0x41')]));_0x2736d2[_0xc988('0x40')]=_0x2736d2['attributes'][_0xc988('0x42')]?_0x2736d2[_0xc988('0x40')]:_0x3623f7['model'];if(!_0x351992[_0xc988('0x3d')][_0xc988('0xbf')](_0xc988('0xc0'))){_0x2736d2[_0xc988('0x1f')]=qs[_0xc988('0x1f')](_0x351992[_0xc988('0x3d')][_0xc988('0x1f')]);_0x2736d2[_0xc988('0x1d')]=qs[_0xc988('0x1d')](_0x351992[_0xc988('0x3d')][_0xc988('0x1d')]);}_0x2736d2[_0xc988('0x89')]=qs[_0xc988('0x43')](_0x351992[_0xc988('0x3d')][_0xc988('0x43')]);_0x2736d2['where']=qs[_0xc988('0x3e')](_[_0xc988('0xc1')](_0x351992[_0xc988('0x3d')],_0x3623f7[_0xc988('0x3e')]));_0x2736d2[_0xc988('0x44')][_0xc988('0xb3')]=_0x38cad3['id'];if(_0x351992[_0xc988('0x3d')][_0xc988('0x7f')]){_0x2736d2[_0xc988('0x44')]=_[_0xc988('0x98')](_0x2736d2[_0xc988('0x44')],{'$or':_[_0xc988('0x2b')](_0x2736d2[_0xc988('0x40')],function(_0xfe6fdb){var _0xfb36d5={};_0xfb36d5[_0xfe6fdb]={'$like':'%'+_0x351992[_0xc988('0x3d')][_0xc988('0x7f')]+'%'};return _0xfb36d5;})});}if(_0x351992['query'][_0xc988('0x76')]){var _0x1dd28=_0x351992[_0xc988('0x3d')][_0xc988('0x76')][_0xc988('0x2f')](',');var _0x2fdb56={};_0x2fdb56[_0x1dd28[0x0]]={'$gte':moment(_0x1dd28[0x1])[_0xc988('0xc2')](_0xc988('0xc3'))};_0x2736d2[_0xc988('0x44')]=_['merge'](_0x2736d2[_0xc988('0x44')],_0x2fdb56);}_0x2736d2=_[_0xc988('0x98')]({},_0x2736d2,_0x351992['options']);return db[_0xc988('0xbb')][_0xc988('0x20')]({'where':_0x2736d2['where']})['then'](function(_0x135f58){_0x46ae94[_0xc988('0x20')]=_0x135f58;if(_0x351992[_0xc988('0x3d')][_0xc988('0xb5')]){_0x2736d2[_0xc988('0xc4')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xc988('0xc5')](_0x2736d2);})['then'](function(_0x2c299c){_0x46ae94[_0xc988('0xb4')]=_0x2c299c;return _0x46ae94;});}})[_0xc988('0x25')](respondWithFilteredResult(_0x50422c,_0x2736d2))[_0xc988('0x31')](handleError(_0x50422c,null));};exports[_0xc988('0xc6')]=function(_0x8579a9,_0x50ddfa,_0x57484f){return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0x8579a9['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x50ddfa,null))['then'](function(_0x20286c){if(_0x20286c){return _0x20286c[_0xc988('0xc7')](_0x8579a9[_0xc988('0x6f')][_0xc988('0xbc')],_[_0xc988('0xc8')](_0x8579a9[_0xc988('0x6f')],[_0xc988('0xbc'),'id'])||{})[_0xc988('0xc9')](function(){return db[_0xc988('0x6b')]['findAll']({'attributes':['id',_0xc988('0x28'),_0xc988('0x46')],'where':{'id':_0x8579a9[_0xc988('0x6f')][_0xc988('0xbc')]}});})[_0xc988('0x25')](function(_0x503dc0){socket['emit'](_0xc988('0xca'),{'id':Number(_0x8579a9[_0xc988('0xb8')]['id']),'tags':_0x503dc0||[]});return{'id':Number(_0x8579a9[_0xc988('0xb8')]['id']),'tags':_0x503dc0||[]};});}})[_0xc988('0x25')](respondWithResult(_0x50ddfa,null))[_0xc988('0x31')](handleError(_0x50ddfa,null));};exports[_0xc988('0xcb')]=function(_0x3d2d79,_0x543536,_0x3b66e2){return db['WhatsappInteraction'][_0xc988('0x67')]({'where':{'id':_0x3d2d79[_0xc988('0xb8')]['id']}})['then'](handleEntityNotFound(_0x543536,null))[_0xc988('0x25')](function(_0x30f1c7){if(_0x30f1c7){return _0x30f1c7[_0xc988('0xcb')](_0x3d2d79[_0xc988('0x3d')][_0xc988('0xbc')]);}})[_0xc988('0x25')](respondWithStatusCode(_0x543536,null))[_0xc988('0x31')](handleError(_0x543536,null));};exports[_0xc988('0xcc')]=function(_0x5efafd,_0xa617e){var _0x5e451c=moment()[_0xc988('0xcd')]()[_0xc988('0x96')]();var _0x3cd208=path[_0xc988('0xce')](config[_0xc988('0xcf')],_0xc988('0xd0'),_0xc988('0xd1'),_0xc988('0xd2'));var _0x92c32c=path[_0xc988('0xce')](config[_0xc988('0xcf')],_0xc988('0xd0'),'files',_0xc988('0xd3'));var _0x379afe=path[_0xc988('0xce')](_0x3cd208,_0x5e451c);var _0x1aae72=util['format'](_0xc988('0xd4'),_0x5efafd[_0xc988('0xb8')]['id'],_0x5e451c);var _0xc58fb6=path['join'](_0x3cd208,_0x1aae72);var _0x1d867e=[];_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd5')],'as':_0xc988('0xd5'),'attributes':['id',_0xc988('0x2c')],'raw':!![]});_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd6')],'as':_0xc988('0xd7'),'attributes':['id',_0xc988('0xd8'),'lastName'],'raw':!![]});if(_0x5efafd[_0xc988('0x3d')][_0xc988('0xd3')]){_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd9')],'as':_0xc988('0xd9'),'raw':!![]});}var _0x32986e=[{'model':db[_0xc988('0xbb')],'as':_0xc988('0xda'),'attributes':['id',_0xc988('0x6f'),_0xc988('0x74'),'direction','secret',_0xc988('0x7b')],'include':_0x1d867e}];_0x32986e['push']({'model':db[_0xc988('0xdb')],'as':_0xc988('0xdc'),'attributes':['id','name']});_0x32986e[_0xc988('0x30')]({'model':db[_0xc988('0xd5')],'as':_0xc988('0xdd'),'attributes':['id',_0xc988('0x2c')]});return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0x5efafd[_0xc988('0xb8')]['id']},'include':_0x32986e})[_0xc988('0x25')](handleEntityNotFound(_0xa617e,null))[_0xc988('0x25')](function(_0xbaf650){if(_0xbaf650){var _0xfa52dd=_0xbaf650[_0xc988('0xde')]({'plain':!![]});fs[_0xc988('0xdf')](_0x379afe);var _0x4910b6={'channel':_0xc988('0xe0'),'account':_0xfa52dd['Account'][_0xc988('0x28')],'agent':_0xfa52dd[_0xc988('0xdd')]?_0xfa52dd[_0xc988('0xdd')][_0xc988('0x2c')]:_0xc988('0xe1'),'createdAt':moment(_0xfa52dd[_0xc988('0x74')])[_0xc988('0xc2')](_0xc988('0xc3'))['toString'](),'closedAt':_0xfa52dd[_0xc988('0x36')]?moment(_0xfa52dd[_0xc988('0xe2')])[_0xc988('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc988('0x96')]():'','disposition':_0xfa52dd[_0xc988('0xe3')],'messages':_(_0xfa52dd[_0xc988('0xda')])[_0xc988('0x7f')]({'secret':![]})['map'](function(_0x48de71){if(_0x48de71[_0xc988('0xd9')]){var _0x47c1b3=path['join'](_0x92c32c,_0x48de71[_0xc988('0xd9')][_0xc988('0xe4')]);if(fs[_0xc988('0xe5')](_0x47c1b3)){fs[_0xc988('0xe6')](_0x47c1b3)[_0xc988('0xe7')](fs['createWriteStream'](path[_0xc988('0xce')](_0x379afe,_0x48de71['Attachment'][_0xc988('0xe4')])));}}return{'date':moment(_0x48de71[_0xc988('0x74')])[_0xc988('0xc2')](_0xc988('0xc3'))[_0xc988('0x96')](),'sender':_0x48de71['direction']===_0xc988('0xe8')?_0x48de71[_0xc988('0xd5')]?_0x48de71[_0xc988('0xd5')]['fullname']:_0xc988('0xe9'):_0x48de71[_0xc988('0xd7')][_0xc988('0xd8')]+(_0x48de71[_0xc988('0xd7')]['lastName']?'\x20'+_0x48de71['Contact'][_0xc988('0xea')]:''),'body':_0x48de71[_0xc988('0xd9')]?_0x48de71[_0xc988('0xd9')][_0xc988('0xe4')]:_0x48de71[_0xc988('0x6f')],'direction':_0x48de71[_0xc988('0xeb')]===_0xc988('0xe8')?'A':'C','secret':_0x48de71[_0xc988('0xec')],'read':_0x48de71[_0xc988('0x7b')],'attachment':_0x48de71[_0xc988('0xd9')]};})[_0xc988('0x5f')]()};return ejs['renderFile'](path['join'](config[_0xc988('0xcf')],_0xc988('0xd0'),'views',_0xc988('0xed')),{'interaction':_0x4910b6})[_0xc988('0x25')](function(_0x2a8192){var _0x11b9e9=path[_0xc988('0xce')](_0x379afe,_0xc988('0xee')+_0xfa52dd['id']+'-'+_0x5e451c+_0xc988('0xef'));var _0x3b018e={'path':_0x11b9e9,'channel':'Whatsapp','interactionId':_0xfa52dd['id']};return pdf[_0xc988('0xf0')](_0x2a8192,_0x3b018e);})['then'](function(){return new BPromise(function(_0x506479,_0x44cd25){zipdir(_0x379afe,{'saveTo':_0xc58fb6},function(_0x35d8af,_0x2ed15a){if(_0x35d8af)return _0x44cd25(_0x35d8af);return _0x506479(_0x2ed15a);});})['then'](function(){return new BPromise(function(_0x5bc52a,_0x42951c){rimraf(_0x379afe,function(_0x4cd1ca){if(_0x4cd1ca)_0x42951c(_0x4cd1ca);return _0x5bc52a();});});})[_0xc988('0x25')](function(){return _0xa617e['download'](_0xc58fb6,_0x1aae72,function(_0x12e46a){if(_0x12e46a){console[_0xc988('0xf1')](_0xc988('0xf2'),_0x12e46a);}else{fs['unlinkSync'](_0xc58fb6);}});});});}else{return _0xa617e[_0xc988('0x19')](0xc8);}})[_0xc988('0x31')](handleError(_0xa617e,null));}; \ No newline at end of file +var _0x0c6b=['end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','WhatsappInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','select','field','color','from','tools_tags','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','push','all','rows','show','params','include','merge','options','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','createdAt','WhatsappAccount','Owner','get','mkdirSync','Account','N.A.','closedAt','disposition','basename','existsSync','pipe','direction','out','System','Contact','firstName','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status'];(function(_0x50c944,_0x33e196){var _0x29eefa=function(_0x116939){while(--_0x116939){_0x50c944['push'](_0x50c944['shift']());}};_0x29eefa(++_0x33e196);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x32bc88,_0x40909b){_0x32bc88=_0x32bc88-0x0;var _0x106dc3=_0x0c6b[_0x32bc88];return _0x106dc3;};'use strict';var emlformat=require(_0xb0c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0c6('0x1'));var jsonpatch=require(_0xb0c6('0x2'));var rp=require(_0xb0c6('0x3'));var moment=require(_0xb0c6('0x4'));var BPromise=require(_0xb0c6('0x5'));var Mustache=require(_0xb0c6('0x6'));var util=require(_0xb0c6('0x7'));var path=require(_0xb0c6('0x8'));var sox=require(_0xb0c6('0x9'));var csv=require(_0xb0c6('0xa'));var ejs=require(_0xb0c6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb0c6('0xc'));var deskjs=require(_0xb0c6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb0c6('0xe'));var Redis=require(_0xb0c6('0xf'));var authService=require(_0xb0c6('0x10'));var qs=require(_0xb0c6('0x11'));var as=require(_0xb0c6('0x12'));var pdf=require(_0xb0c6('0x13'));var hardwareService=require(_0xb0c6('0x14'));var logger=require(_0xb0c6('0x15'))('api');var utils=require(_0xb0c6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb0c6('0x17'));var db=require(_0xb0c6('0x18'))['db'];config[_0xb0c6('0x19')]=_['defaults'](config[_0xb0c6('0x19')],{'host':_0xb0c6('0x1a'),'port':0x18eb});var socket=require(_0xb0c6('0x1b'))(new Redis(config[_0xb0c6('0x19')]));require(_0xb0c6('0x1c'))[_0xb0c6('0x1d')](socket);function respondWithStatusCode(_0xb021af,_0xf94004){_0xf94004=_0xf94004||0xcc;return function(_0x527b2c){if(_0x527b2c){return _0xb021af[_0xb0c6('0x1e')](_0xf94004);}return _0xb021af[_0xb0c6('0x1f')](_0xf94004)[_0xb0c6('0x20')]();};}function respondWithResult(_0xb6e21b,_0x4e4642){_0x4e4642=_0x4e4642||0xc8;return function(_0x19a09e){if(_0x19a09e){return _0xb6e21b[_0xb0c6('0x1f')](_0x4e4642)[_0xb0c6('0x21')](_0x19a09e);}};}function respondWithFilteredResult(_0x49a3a7,_0x188fc4){return function(_0xbbc184){if(_0xbbc184){var _0x210c54=typeof _0x188fc4[_0xb0c6('0x22')]===_0xb0c6('0x23')&&typeof _0x188fc4[_0xb0c6('0x24')]===_0xb0c6('0x23');var _0x5f49b8=_0xbbc184[_0xb0c6('0x25')];var _0xffd7fa=_0x210c54?0x0:_0x188fc4['offset'];var _0x50091c=_0x210c54?_0xbbc184[_0xb0c6('0x25')]:_0x188fc4[_0xb0c6('0x22')]+_0x188fc4[_0xb0c6('0x24')];var _0x52d002;if(_0x50091c>=_0x5f49b8){_0x50091c=_0x5f49b8;_0x52d002=0xc8;}else{_0x52d002=0xce;}_0x49a3a7['status'](_0x52d002);return _0x49a3a7[_0xb0c6('0x26')]('Content-Range',_0xffd7fa+'-'+_0x50091c+'/'+_0x5f49b8)[_0xb0c6('0x21')](_0xbbc184);}return null;};}function patchUpdates(_0x6508c1){return function(_0x110290){try{jsonpatch['apply'](_0x110290,_0x6508c1,!![]);}catch(_0x2b4d60){return BPromise[_0xb0c6('0x27')](_0x2b4d60);}return _0x110290[_0xb0c6('0x28')]();};}function saveUpdates(_0x340150,_0x1a3c46){return function(_0x38b714){if(_0x38b714){return _0x38b714[_0xb0c6('0x29')](_0x340150)[_0xb0c6('0x2a')](function(_0x3c43c3){return _0x3c43c3;});}return null;};}function removeEntity(_0x2a748c,_0x555470){return function(_0x19b471){if(_0x19b471){return _0x19b471[_0xb0c6('0x2b')]()[_0xb0c6('0x2a')](function(){_0x2a748c[_0xb0c6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e922e,_0x14f3d0){return function(_0x4ed574){if(!_0x4ed574){_0x5e922e['sendStatus'](0x194);}return _0x4ed574;};}function handleError(_0xe49839,_0x1d48f3){_0x1d48f3=_0x1d48f3||0x1f4;return function(_0x10c9a3){logger[_0xb0c6('0x2c')](_0x10c9a3[_0xb0c6('0x2d')]);if(_0x10c9a3[_0xb0c6('0x2e')]){delete _0x10c9a3[_0xb0c6('0x2e')];}_0xe49839[_0xb0c6('0x1f')](_0x1d48f3)[_0xb0c6('0x2f')](_0x10c9a3);};}function getInteractionUsers(_0x408a7b,_0x50cec8){return new BPromise(function(_0x9b9482,_0xe482db){try{if(_0x50cec8[_0x408a7b['id']]){_0x408a7b[_0xb0c6('0x30')]=_[_0xb0c6('0x31')](_0x50cec8[_0x408a7b['id']],function(_0x3613de){return{'id':_0x3613de['id'],'fullname':_0x3613de[_0xb0c6('0x32')]};});}}catch(_0x2282c2){_0xe482db(_0x2282c2);}_0x9b9482(_0x408a7b);});}function getInteractionTags(_0x29232c,_0x33ec86){return new BPromise(function(_0x1f3191,_0x18c7c5){try{if(_0x29232c['TagIds']){_0x29232c[_0xb0c6('0x33')]=[];_0x29232c[_0xb0c6('0x34')][_0xb0c6('0x35')](',')[_0xb0c6('0x36')](function(_0x264fe0){_0x29232c[_0xb0c6('0x33')]['push'](_0x33ec86[_0x264fe0]);});}delete _0x29232c[_0xb0c6('0x34')];}catch(_0xf0cf61){_0x18c7c5(_0xf0cf61);}_0x1f3191(_0x29232c);});}function updateWhatsappInteraction(_0x2f8321,_0x3c7f31,_0x42262f){return new BPromise(function(_0x2c50b0,_0x30e586){return getInteractionUsers(_0x2f8321,_0x42262f)[_0xb0c6('0x2a')](function(_0x2acff1){return getInteractionTags(_0x2acff1,_0x3c7f31);})[_0xb0c6('0x2a')](function(_0x45417e){return getStateInteraction(_0x45417e);})['then'](function(_0x3bf60c){_0x2c50b0(_0x3bf60c);})[_0xb0c6('0x37')](function(_0x4cfca2){_0x30e586(_0x4cfca2);});});}function getStateInteraction(_0x5ae6c7){return new BPromise(function(_0x3cd144){_0x5ae6c7[_0xb0c6('0x38')]=0x0;_0x5ae6c7[_0xb0c6('0x39')]=0x0;_0x5ae6c7[_0xb0c6('0x3a')]=0x0;_0x5ae6c7['unmanaged']=0x0;_0x5ae6c7[_0xb0c6('0x3b')]=0x0;if(!_0x5ae6c7[_0xb0c6('0x3c')]&&!_0x5ae6c7[_0xb0c6('0x3d')]){_0x5ae6c7[_0xb0c6('0x38')]+=0x1;}if(!_0x5ae6c7['closed']&&_0x5ae6c7[_0xb0c6('0x3d')]){_0x5ae6c7['talking']+=0x1;if(_0x5ae6c7[_0xb0c6('0x38')]){_0x5ae6c7[_0xb0c6('0x38')]-=0x1;}}if(_0x5ae6c7[_0xb0c6('0x3c')]&&_0x5ae6c7['UserId']){_0x5ae6c7[_0xb0c6('0x3a')]+=0x1;if(_0x5ae6c7[_0xb0c6('0x39')]){_0x5ae6c7['talking']-=0x1;}}if(_0x5ae6c7['closed']&&!_0x5ae6c7[_0xb0c6('0x3d')]){_0x5ae6c7[_0xb0c6('0x3e')]+=0x1;if(_0x5ae6c7[_0xb0c6('0x38')]){_0x5ae6c7[_0xb0c6('0x38')]-=0x1;}}_0x5ae6c7[_0xb0c6('0x3b')]+=0x1;_0x3cd144(_0x5ae6c7);});}exports[_0xb0c6('0x3f')]=function(_0x1dbf1b,_0x4bb5e8){var _0x2c4d7b={},_0x224ec1={},_0x113040={'count':0x0,'rows':[]};var _0x19d593=_['map'](db[_0xb0c6('0x40')][_0xb0c6('0x41')],function(_0x47e522){return{'name':_0x47e522['fieldName'],'type':_0x47e522[_0xb0c6('0x42')][_0xb0c6('0x43')]};});_0x224ec1[_0xb0c6('0x44')]=_[_0xb0c6('0x31')](_0x19d593,'name');_0x224ec1[_0xb0c6('0x45')]=_[_0xb0c6('0x46')](_0x1dbf1b[_0xb0c6('0x45')]);_0x224ec1[_0xb0c6('0x47')]=_[_0xb0c6('0x48')](_0x224ec1[_0xb0c6('0x44')],_0x224ec1['query']);_0x2c4d7b['attributes']=_[_0xb0c6('0x48')](_0x224ec1[_0xb0c6('0x44')],qs[_0xb0c6('0x49')](_0x1dbf1b['query'][_0xb0c6('0x49')]));_0x2c4d7b[_0xb0c6('0x4a')]=_0x2c4d7b['attributes'][_0xb0c6('0x4b')]?_0x2c4d7b[_0xb0c6('0x4a')]:_0x224ec1[_0xb0c6('0x44')];if(!_0x1dbf1b[_0xb0c6('0x45')]['hasOwnProperty']('nolimit')){_0x2c4d7b['limit']=qs['limit'](_0x1dbf1b[_0xb0c6('0x45')]['limit']);_0x2c4d7b[_0xb0c6('0x22')]=qs[_0xb0c6('0x22')](_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x22')]);}_0x2c4d7b[_0xb0c6('0x4c')]=qs[_0xb0c6('0x4d')](_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x4d')]);_0x2c4d7b['where']=qs['filters'](_[_0xb0c6('0x4e')](_0x1dbf1b[_0xb0c6('0x45')],_0x224ec1['filters']),_0x19d593);var _0xb86f84=[];var _0x548865=squel[_0xb0c6('0x4f')]()['field']('id')[_0xb0c6('0x50')](_0xb0c6('0x2e'))['field'](_0xb0c6('0x51'))[_0xb0c6('0x52')](_0xb0c6('0x53'));var _0x455fba=squel[_0xb0c6('0x4f')]()[_0xb0c6('0x50')]('u.id')[_0xb0c6('0x50')](_0xb0c6('0x54'))[_0xb0c6('0x50')]('ui.WhatsappInteractionId')[_0xb0c6('0x52')]('user_has_whatsapp_interactions','ui')[_0xb0c6('0x55')](_0xb0c6('0x56'),'u',_0xb0c6('0x57'));var _0x222e96=squel['select']()[_0xb0c6('0x52')](_0xb0c6('0x58'),'i')['left_join'](_0xb0c6('0x59'),'c',_0xb0c6('0x5a'))[_0xb0c6('0x55')](_0xb0c6('0x56'),'o',_0xb0c6('0x5b'))[_0xb0c6('0x55')]('whatsapp_accounts','a',_0xb0c6('0x5c'))['left_join'](_0xb0c6('0x5d'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join']('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xb0c6('0x53'),'t',_0xb0c6('0x5e'));var _0x4fe0b4=squel[_0xb0c6('0x5f')]();var _0x158d5a=[];var _0x1c0115=squel[_0xb0c6('0x5f')]();var _0x416844;if(_0x1dbf1b['query'][_0xb0c6('0x60')]){_0x416844=as['parseSearch'](_0x1dbf1b[_0xb0c6('0x45')]['search']);var _0x27e0b1=_0x416844[_0xb0c6('0x61')];for(var _0x3fa007=0x0;_0x3fa007<_0x416844[_0xb0c6('0x62')][_0xb0c6('0x4b')];_0x3fa007++){var _0x67fc8d=_0x416844['conditions'][_0x3fa007];var _0x1e9fce='i';var _0x3626a1=_['find'](_0x19d593,[_0xb0c6('0x2e'),_0x67fc8d[_0xb0c6('0x50')]]);if(!_0x3626a1){switch(_0x67fc8d[_0xb0c6('0x50')]){case _0xb0c6('0x63'):if(_0x67fc8d[_0xb0c6('0x64')]==0x1){_0x222e96[_0xb0c6('0x65')]('`'+_0x67fc8d['field']+_0xb0c6('0x66'));}else{_0x222e96[_0xb0c6('0x65')]('`'+_0x67fc8d[_0xb0c6('0x50')]+_0xb0c6('0x67'));}break;case'Contact':if(_0x67fc8d['operator']==='$substring'){if(_0x67fc8d['value'][_0xb0c6('0x35')]('\x20')[_0xb0c6('0x4b')]>0x1){_0x4fe0b4[_0x27e0b1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb0c6('0x68')](_0x67fc8d[_0xb0c6('0x64')]),null);}else{var _0x12be33='%'+_0x67fc8d[_0xb0c6('0x64')]+'%';_0x4fe0b4[_0x27e0b1](_0xb0c6('0x69'),_0x12be33,_0x12be33,_0x12be33);}}else{_0x3626a1=_[_0xb0c6('0x6a')](_0x19d593,['name',_0xb0c6('0x6b')]);_0x67fc8d[_0xb0c6('0x50')]=_0xb0c6('0x6b');_0x266217=as[_0xb0c6('0x6c')](_0x1e9fce,_0x3626a1[_0xb0c6('0x42')],_0x67fc8d);_0x4fe0b4[_0x27e0b1](_0x266217['text'],_0x266217[_0xb0c6('0x64')][_0xb0c6('0x6d')],_0x266217[_0xb0c6('0x64')][_0xb0c6('0x20')]);}break;case _0xb0c6('0x6e'):var _0x417668=_0x67fc8d[_0xb0c6('0x64')][_0xb0c6('0x35')](',')[_0xb0c6('0x31')](function(_0x5b26a5){return Number(_0x5b26a5);});_0x417668['forEach'](function(_0x4dc505){_0x1c0115['or'](_0xb0c6('0x6f'),'%,'+_0x4dc505+',%');});_0x158d5a=_['union'](_0x158d5a,_0x417668);break;case _0xb0c6('0x70'):if(_0x67fc8d['operator']===_0xb0c6('0x71')){_0x4fe0b4[_0x27e0b1](_0xb0c6('0x72'),'%'+_0x67fc8d[_0xb0c6('0x64')]+'%',null);}else{_0x3626a1=_['find'](_0x19d593,['name',_0xb0c6('0x3d')]);_0x67fc8d[_0xb0c6('0x50')]=_0xb0c6('0x3d');_0x266217=as[_0xb0c6('0x6c')](_0x1e9fce,_0x3626a1[_0xb0c6('0x42')],_0x67fc8d);_0x4fe0b4[_0x27e0b1](_0x266217[_0xb0c6('0x73')],_0x266217[_0xb0c6('0x64')]['start'],_0x266217[_0xb0c6('0x64')][_0xb0c6('0x20')]);}break;case _0xb0c6('0x74'):_0x266217=as[_0xb0c6('0x6c')]('me',null,_0x67fc8d);_0x4fe0b4[_0x27e0b1](_0x266217[_0xb0c6('0x73')],_0x266217[_0xb0c6('0x64')][_0xb0c6('0x6d')],_0x266217[_0xb0c6('0x64')]['end']);break;}}else{var _0x266217=as[_0xb0c6('0x6c')](_0x1e9fce,_0x3626a1[_0xb0c6('0x42')],_0x67fc8d);_0x4fe0b4[_0x27e0b1](_0x266217[_0xb0c6('0x73')],_0x266217[_0xb0c6('0x64')]['start'],_0x266217[_0xb0c6('0x64')][_0xb0c6('0x20')]);}}}else{var _0x55dcd4=_(_0x1dbf1b['query'])[_0xb0c6('0x46')]()[_0xb0c6('0x31')](function(_0x2e554c){return _[_0xb0c6('0x75')](_0x19d593,[_0xb0c6('0x2e'),_0x2e554c])?_0x2e554c:undefined;})[_0xb0c6('0x76')]()[_0xb0c6('0x64')]();if(!_['isEmpty'](_0x55dcd4)){_0x55dcd4[_0xb0c6('0x36')](function(_0x35db48){if(_0x35db48===_0xb0c6('0x77')){_0x222e96[_0xb0c6('0x78')](_0xb0c6('0x79'),[][_0xb0c6('0x7a')](_0x1dbf1b['query'][_0x35db48]));}else if(_0x35db48==='createdAt'){var _0x2b3641=JSON[_0xb0c6('0x7b')](_0x1dbf1b[_0xb0c6('0x45')][_0x35db48])[_0xb0c6('0x7c')];var _0x1a638c=JSON['parse'](_0x1dbf1b[_0xb0c6('0x45')][_0x35db48])['$lte'];_0x222e96[_0xb0c6('0x78')](_0xb0c6('0x7d'),_0x2b3641,_0x1a638c);}else{if(_0x1dbf1b[_0xb0c6('0x45')][_0x35db48]===_0xb0c6('0x7e')){_0x222e96['where']('i.'+_0x35db48+_0xb0c6('0x7f'));}else{_0x222e96['where']('i.'+_0x35db48+_0xb0c6('0x80'),_0x1dbf1b['query'][_0x35db48]);}}});}if(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x81')]){if(_0x1dbf1b['query'][_0xb0c6('0x81')]==0x1){_0x222e96['having'](_0xb0c6('0x82'));}else{_0x222e96[_0xb0c6('0x65')](_0xb0c6('0x83'));}}if(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x84')]){_0x158d5a=_['isArray'](_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x84')])?_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x84')]:new Array(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x84')]);_0x158d5a[_0xb0c6('0x36')](function(_0x562d6e){_0x1c0115['or'](_0xb0c6('0x6f'),'%,'+_0x562d6e+',%');});}if(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x85')]){var _0x371560=_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x85')][_0xb0c6('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb0c6('0x87')](_0x371560)){_0x4fe0b4['or']('i.id\x20LIKE\x20?',_0x371560+'%')['or']('i.phone\x20LIKE\x20?',_0x371560+'%');}else{_0x4fe0b4['or'](_0xb0c6('0x88'),qs['getFullTextValue'](_0x371560))['or'](_0xb0c6('0x89'),_0x371560+'%');}}}_0x222e96['where'](_0x4fe0b4);_0x222e96[_0xb0c6('0x8a')]('i.id');var _0x181153={'type':db[_0xb0c6('0x8b')][_0xb0c6('0x8c')]['SELECT'],'raw':!![]};var _0x43bfa4=_0x222e96[_0xb0c6('0x8d')]();_0x43bfa4['field'](_0xb0c6('0x8e'));_0x43bfa4['field'](_0xb0c6('0x8f'),_0xb0c6('0x63'));if(_0x2c4d7b['order']){_0x2c4d7b[_0xb0c6('0x4c')][_0xb0c6('0x36')](function(_0x5112cb){var _0xd88183=_0x5112cb[0x0]===_0xb0c6('0x90')?_0x5112cb[0x0]:'i.'+_0x5112cb[0x0];_0x222e96[_0xb0c6('0x4c')](_0xd88183,_0x5112cb[0x1]===_0xb0c6('0x91')?![]:!![]);});}if(!_[_0xb0c6('0x92')](_0x158d5a)){_0x222e96[_0xb0c6('0x65')](_0x1c0115);_0x43bfa4[_0xb0c6('0x78')](_0xb0c6('0x93'),_0x158d5a);}BPromise[_0xb0c6('0x94')]()['then'](function(){if(!_0x416844){if(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x77')])return;_0x43bfa4[_0xb0c6('0x78')](_0xb0c6('0x95'));_0x222e96[_0xb0c6('0x78')](_0xb0c6('0x95'));return;}if(_0x1dbf1b[_0xb0c6('0x96')]['role']!=='agent')return;return _0x1dbf1b[_0xb0c6('0x96')][_0xb0c6('0x97')]({'attributes':['id'],'raw':!![]})[_0xb0c6('0x2a')](function(_0x275a8c){if(_[_0xb0c6('0x92')](_0x275a8c)){_0x43bfa4[_0xb0c6('0x78')](_0xb0c6('0x98'));_0x222e96[_0xb0c6('0x78')](_0xb0c6('0x98'));}else{_0x43bfa4['where']('i.WhatsappAccountId\x20IN\x20?',_[_0xb0c6('0x31')](_0x275a8c,'id'));_0x222e96[_0xb0c6('0x78')](_0xb0c6('0x79'),_['map'](_0x275a8c,'id'));}});})[_0xb0c6('0x2a')](function(){if(_0x1dbf1b[_0xb0c6('0x96')][_0xb0c6('0x99')]===_0xb0c6('0x9a')&&!_0x416844&&!_0x1dbf1b['query']['WhatsappAccountId'])return[];return db[_0xb0c6('0x9b')][_0xb0c6('0x45')](_0x43bfa4['toString'](),_0x181153);})[_0xb0c6('0x2a')](function(_0x13c0f9){_0x113040[_0xb0c6('0x25')]=_0x13c0f9[_0xb0c6('0x4b')];if(_0x113040[_0xb0c6('0x25')]===0x0)return[];return db['sequelize']['query'](_0x548865[_0xb0c6('0x9c')](),_0x181153)['then'](function(_0x3d5c0f){_0xb86f84=_[_0xb0c6('0x9d')](_0x3d5c0f,'id');_0x181153=_['merge'](_0x181153,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1dbf1b[_0xb0c6('0x45')][_0xb0c6('0x49')]){_0x2c4d7b[_0xb0c6('0x4a')][_0xb0c6('0x36')](function(_0x2a38cc){_0x222e96[_0xb0c6('0x50')]('i.'+_0x2a38cc);});}else{_0x222e96[_0xb0c6('0x50')](_0xb0c6('0x8f'),_0xb0c6('0x63'));_0x222e96[_0xb0c6('0x50')](_0xb0c6('0x9e'),_0xb0c6('0x9f'));_0x222e96[_0xb0c6('0x50')]('a.mandatoryDisposition',_0xb0c6('0xa0'));_0x222e96[_0xb0c6('0x50')]('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',_0xb0c6('0x90'));_0x222e96[_0xb0c6('0x50')]('i.*');_0x222e96[_0xb0c6('0x50')]('c.firstName',_0xb0c6('0xa1'));_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xa2'),'Contact.lastName');_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xa3'),_0xb0c6('0xa4'));_0x222e96['field'](_0xb0c6('0xa5'),_0xb0c6('0xa6'));_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xa7'),_0xb0c6('0xa8'));_0x222e96['field']('c.fax',_0xb0c6('0xa9'));_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xaa'),_0xb0c6('0xab'));_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xac'),'Owner.internal');_0x222e96[_0xb0c6('0x50')](_0xb0c6('0xad'),_0xb0c6('0x34'));}if(_0x2c4d7b[_0xb0c6('0x24')])_0x222e96[_0xb0c6('0x24')](_0x2c4d7b[_0xb0c6('0x24')]);if(_0x2c4d7b['offset'])_0x222e96[_0xb0c6('0x22')](_0x2c4d7b[_0xb0c6('0x22')]);return db[_0xb0c6('0x9b')][_0xb0c6('0x45')](_0x222e96['toString'](),_0x181153);})[_0xb0c6('0x2a')](function(_0x34cd64){if(_0x34cd64['length']>0x0)_0x455fba['where']('ui.WhatsappInteractionId\x20IN\x20?',_[_0xb0c6('0x31')](_0x34cd64,'id'));return db[_0xb0c6('0x9b')]['query'](_0x455fba[_0xb0c6('0x9c')](),_0x181153)[_0xb0c6('0x2a')](function(_0x2f34ba){var _0x2988e=_[_0xb0c6('0xae')](_0x2f34ba,_0xb0c6('0xaf'));var _0x3520ee=[];_0x34cd64[_0xb0c6('0x36')](function(_0x27c67f){_0x3520ee[_0xb0c6('0xb0')](updateWhatsappInteraction(_0x27c67f,_0xb86f84,_0x2988e));});return BPromise[_0xb0c6('0xb1')](_0x3520ee);});});})[_0xb0c6('0x2a')](function(_0x707d0e){_0x113040[_0xb0c6('0xb2')]=_0x707d0e;return _0x113040;})['then'](respondWithFilteredResult(_0x4bb5e8,_0x2c4d7b))[_0xb0c6('0x37')](handleError(_0x4bb5e8,null));};exports[_0xb0c6('0xb3')]=function(_0x45be8b,_0x21b548){var _0x3317f3={'raw':![],'where':{'id':_0x45be8b[_0xb0c6('0xb4')]['id']}},_0x5bfd3f={};_0x5bfd3f[_0xb0c6('0x44')]=_[_0xb0c6('0x46')](db[_0xb0c6('0x40')][_0xb0c6('0x41')]);_0x5bfd3f['query']=_['keys'](_0x45be8b[_0xb0c6('0x45')]);_0x5bfd3f[_0xb0c6('0x47')]=_['intersection'](_0x5bfd3f['model'],_0x5bfd3f[_0xb0c6('0x45')]);_0x3317f3[_0xb0c6('0x4a')]=_[_0xb0c6('0x48')](_0x5bfd3f[_0xb0c6('0x44')],qs[_0xb0c6('0x49')](_0x45be8b[_0xb0c6('0x45')]['fields']));_0x3317f3[_0xb0c6('0x4a')]=_0x3317f3[_0xb0c6('0x4a')][_0xb0c6('0x4b')]?_0x3317f3[_0xb0c6('0x4a')]:_0x5bfd3f[_0xb0c6('0x44')];if(_0x45be8b[_0xb0c6('0x45')]['includeAll']){_0x3317f3[_0xb0c6('0xb5')]=[{'all':!![]}];}_0x3317f3=_[_0xb0c6('0xb6')]({},_0x3317f3,_0x45be8b[_0xb0c6('0xb7')]);return db[_0xb0c6('0x40')][_0xb0c6('0x6a')](_0x3317f3)['then'](handleEntityNotFound(_0x21b548,null))[_0xb0c6('0x2a')](respondWithResult(_0x21b548,null))[_0xb0c6('0x37')](handleError(_0x21b548,null));};exports[_0xb0c6('0xb8')]=function(_0x2a0d61,_0x4fb199){return db[_0xb0c6('0x40')]['create'](_0x2a0d61[_0xb0c6('0x74')],{})['then'](respondWithResult(_0x4fb199,0xc9))['catch'](handleError(_0x4fb199,null));};exports[_0xb0c6('0x29')]=function(_0x2e5d42,_0x3fa88b){if(_0x2e5d42[_0xb0c6('0x74')]['id']){delete _0x2e5d42['body']['id'];}return db[_0xb0c6('0x40')]['find']({'where':{'id':_0x2e5d42[_0xb0c6('0xb4')]['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x3fa88b,null))[_0xb0c6('0x2a')](saveUpdates(_0x2e5d42['body'],null))['then'](respondWithResult(_0x3fa88b,null))[_0xb0c6('0x37')](handleError(_0x3fa88b,null));};exports[_0xb0c6('0x2b')]=function(_0x2737b4,_0x538ece){return db[_0xb0c6('0x40')][_0xb0c6('0x6a')]({'where':{'id':_0x2737b4[_0xb0c6('0xb4')]['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x538ece,null))[_0xb0c6('0x2a')](removeEntity(_0x538ece,null))['catch'](handleError(_0x538ece,null));};exports[_0xb0c6('0xb9')]=function(_0x31c5a7,_0xc08ea3){return db[_0xb0c6('0x40')]['describe']()['then'](respondWithResult(_0xc08ea3,null))[_0xb0c6('0x37')](handleError(_0xc08ea3,null));};exports[_0xb0c6('0xba')]=function(_0x1a7e88,_0x4119df,_0x29f1e7){return db[_0xb0c6('0xbb')]['find']({'where':{'id':_0x1a7e88['params']['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x4119df,null))[_0xb0c6('0x2a')](function(_0x181fc7){if(_0x181fc7){return _0x181fc7[_0xb0c6('0xba')](_0x1a7e88[_0xb0c6('0x74')][_0xb0c6('0xbc')],_[_0xb0c6('0xbd')](_0x1a7e88['body'],[_0xb0c6('0xbc'),'id'])||{});}})[_0xb0c6('0x2a')](respondWithResult(_0x4119df,null))[_0xb0c6('0x37')](handleError(_0x4119df,null));};exports['getMessages']=function(_0x5272e1,_0x1bb211,_0x3ebffb){var _0x48a770={'raw':![],'where':{}};var _0x3757f8={};var _0x50d187={'count':0x0,'rows':[]};return db[_0xb0c6('0x40')][_0xb0c6('0xbe')]({'where':{'id':_0x5272e1[_0xb0c6('0xb4')]['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x1bb211,null))[_0xb0c6('0x2a')](function(_0x4c68fe){if(_0x4c68fe){_0x3757f8['model']=_[_0xb0c6('0x46')](db['WhatsappMessage'][_0xb0c6('0x41')]);_0x3757f8[_0xb0c6('0x45')]=_['keys'](_0x5272e1[_0xb0c6('0x45')]);_0x3757f8[_0xb0c6('0x47')]=_[_0xb0c6('0x48')](_0x3757f8['model'],_0x3757f8[_0xb0c6('0x45')]);_0x48a770[_0xb0c6('0x4a')]=_[_0xb0c6('0x48')](_0x3757f8[_0xb0c6('0x44')],qs[_0xb0c6('0x49')](_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0x49')]));_0x48a770[_0xb0c6('0x4a')]=_0x48a770[_0xb0c6('0x4a')][_0xb0c6('0x4b')]?_0x48a770['attributes']:_0x3757f8[_0xb0c6('0x44')];if(!_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0xbf')]('nolimit')){_0x48a770[_0xb0c6('0x24')]=qs[_0xb0c6('0x24')](_0x5272e1['query'][_0xb0c6('0x24')]);_0x48a770[_0xb0c6('0x22')]=qs['offset'](_0x5272e1[_0xb0c6('0x45')]['offset']);}_0x48a770[_0xb0c6('0x4c')]=qs[_0xb0c6('0x4d')](_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0x4d')]);_0x48a770['where']=qs[_0xb0c6('0x47')](_[_0xb0c6('0x4e')](_0x5272e1['query'],_0x3757f8['filters']));_0x48a770['where'][_0xb0c6('0xaf')]=_0x4c68fe['id'];if(_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0x85')]){_0x48a770[_0xb0c6('0x78')]=_[_0xb0c6('0xb6')](_0x48a770['where'],{'$or':_[_0xb0c6('0x31')](_0x48a770[_0xb0c6('0x4a')],function(_0x49af16){var _0x21aacf={};_0x21aacf[_0x49af16]={'$like':'%'+_0x5272e1['query'][_0xb0c6('0x85')]+'%'};return _0x21aacf;})});}if(_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0x7c')]){var _0x59b66b=_0x5272e1['query'][_0xb0c6('0x7c')][_0xb0c6('0x35')](',');var _0x1dccf5={};_0x1dccf5[_0x59b66b[0x0]]={'$gte':moment(_0x59b66b[0x1])[_0xb0c6('0xc0')](_0xb0c6('0xc1'))};_0x48a770[_0xb0c6('0x78')]=_[_0xb0c6('0xb6')](_0x48a770[_0xb0c6('0x78')],_0x1dccf5);}_0x48a770=_[_0xb0c6('0xb6')]({},_0x48a770,_0x5272e1[_0xb0c6('0xb7')]);return db[_0xb0c6('0xbb')][_0xb0c6('0x25')]({'where':_0x48a770[_0xb0c6('0x78')]})['then'](function(_0x1dbb6c){_0x50d187[_0xb0c6('0x25')]=_0x1dbb6c;if(_0x5272e1[_0xb0c6('0x45')][_0xb0c6('0xc2')]){_0x48a770['include']=[{'all':!![]}];}return db[_0xb0c6('0xbb')][_0xb0c6('0xc3')](_0x48a770);})['then'](function(_0x10495b){_0x50d187[_0xb0c6('0xb2')]=_0x10495b;return _0x50d187;});}})[_0xb0c6('0x2a')](respondWithFilteredResult(_0x1bb211,_0x48a770))[_0xb0c6('0x37')](handleError(_0x1bb211,null));};exports[_0xb0c6('0xc4')]=function(_0xf131d6,_0x4437cb,_0x43cc07){return db[_0xb0c6('0x40')]['find']({'where':{'id':_0xf131d6['params']['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x4437cb,null))[_0xb0c6('0x2a')](function(_0x17e7c4){if(_0x17e7c4){return _0x17e7c4[_0xb0c6('0xc5')](_0xf131d6['body'][_0xb0c6('0xbc')],_[_0xb0c6('0xbd')](_0xf131d6[_0xb0c6('0x74')],[_0xb0c6('0xbc'),'id'])||{})['spread'](function(){return db[_0xb0c6('0x6e')]['findAll']({'attributes':['id','name',_0xb0c6('0x51')],'where':{'id':_0xf131d6['body'][_0xb0c6('0xbc')]}});})[_0xb0c6('0x2a')](function(_0x12fd2e){socket[_0xb0c6('0xc6')](_0xb0c6('0xc7'),{'id':Number(_0xf131d6[_0xb0c6('0xb4')]['id']),'tags':_0x12fd2e||[]});return{'id':Number(_0xf131d6[_0xb0c6('0xb4')]['id']),'tags':_0x12fd2e||[]};});}})[_0xb0c6('0x2a')](respondWithResult(_0x4437cb,null))[_0xb0c6('0x37')](handleError(_0x4437cb,null));};exports[_0xb0c6('0xc8')]=function(_0x4eaa97,_0x1028e8,_0x555a3c){return db['WhatsappInteraction']['find']({'where':{'id':_0x4eaa97['params']['id']}})[_0xb0c6('0x2a')](handleEntityNotFound(_0x1028e8,null))[_0xb0c6('0x2a')](function(_0x514cf4){if(_0x514cf4){return _0x514cf4[_0xb0c6('0xc8')](_0x4eaa97[_0xb0c6('0x45')][_0xb0c6('0xbc')]);}})[_0xb0c6('0x2a')](respondWithStatusCode(_0x1028e8,null))['catch'](handleError(_0x1028e8,null));};exports[_0xb0c6('0xc9')]=function(_0x54d2b4,_0x333939){var _0x50ffc8=moment()[_0xb0c6('0xca')]()['toString']();var _0x1fb003=path[_0xb0c6('0xcb')](config[_0xb0c6('0xcc')],_0xb0c6('0xcd'),_0xb0c6('0xce'),_0xb0c6('0xcf'));var _0x23a247=path[_0xb0c6('0xcb')](config[_0xb0c6('0xcc')],_0xb0c6('0xcd'),'files',_0xb0c6('0xd0'));var _0x188284=path[_0xb0c6('0xcb')](_0x1fb003,_0x50ffc8);var _0x234c18=util[_0xb0c6('0xc0')](_0xb0c6('0xd1'),_0x54d2b4[_0xb0c6('0xb4')]['id'],_0x50ffc8);var _0x5e1bcd=path[_0xb0c6('0xcb')](_0x1fb003,_0x234c18);var _0x16b3a2=[];_0x16b3a2[_0xb0c6('0xb0')]({'model':db[_0xb0c6('0x70')],'as':_0xb0c6('0x70'),'attributes':['id',_0xb0c6('0x32')],'raw':!![]});_0x16b3a2[_0xb0c6('0xb0')]({'model':db[_0xb0c6('0xd2')],'as':'Contact','attributes':['id','firstName',_0xb0c6('0xd3')],'raw':!![]});if(_0x54d2b4[_0xb0c6('0x45')]['attachments']){_0x16b3a2[_0xb0c6('0xb0')]({'model':db[_0xb0c6('0xd4')],'as':_0xb0c6('0xd4'),'raw':!![]});}var _0x282c9c=[{'model':db[_0xb0c6('0xbb')],'as':_0xb0c6('0xd5'),'attributes':['id',_0xb0c6('0x74'),_0xb0c6('0xd6'),'direction','secret',_0xb0c6('0x81')],'include':_0x16b3a2}];_0x282c9c[_0xb0c6('0xb0')]({'model':db[_0xb0c6('0xd7')],'as':'Account','attributes':['id','name']});_0x282c9c[_0xb0c6('0xb0')]({'model':db[_0xb0c6('0x70')],'as':_0xb0c6('0xd8'),'attributes':['id',_0xb0c6('0x32')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x54d2b4[_0xb0c6('0xb4')]['id']},'include':_0x282c9c})[_0xb0c6('0x2a')](handleEntityNotFound(_0x333939,null))[_0xb0c6('0x2a')](function(_0x1d3a92){if(_0x1d3a92){var _0x29e40c=_0x1d3a92[_0xb0c6('0xd9')]({'plain':!![]});fs[_0xb0c6('0xda')](_0x188284);var _0x4462d9={'channel':'Whatsapp','account':_0x29e40c[_0xb0c6('0xdb')][_0xb0c6('0x2e')],'agent':_0x29e40c[_0xb0c6('0xd8')]?_0x29e40c[_0xb0c6('0xd8')][_0xb0c6('0x32')]:_0xb0c6('0xdc'),'createdAt':moment(_0x29e40c['createdAt'])['format'](_0xb0c6('0xc1'))['toString'](),'closedAt':_0x29e40c[_0xb0c6('0x3c')]?moment(_0x29e40c[_0xb0c6('0xdd')])[_0xb0c6('0xc0')](_0xb0c6('0xc1'))['toString']():'','disposition':_0x29e40c[_0xb0c6('0xde')],'messages':_(_0x29e40c[_0xb0c6('0xd5')])[_0xb0c6('0x85')]({'secret':![]})[_0xb0c6('0x31')](function(_0x2a3815){if(_0x2a3815[_0xb0c6('0xd4')]){var _0x40cedc=path['join'](_0x23a247,_0x2a3815['Attachment'][_0xb0c6('0xdf')]);if(fs[_0xb0c6('0xe0')](_0x40cedc)){fs['createReadStream'](_0x40cedc)[_0xb0c6('0xe1')](fs['createWriteStream'](path[_0xb0c6('0xcb')](_0x188284,_0x2a3815[_0xb0c6('0xd4')][_0xb0c6('0xdf')])));}}return{'date':moment(_0x2a3815[_0xb0c6('0xd6')])[_0xb0c6('0xc0')](_0xb0c6('0xc1'))[_0xb0c6('0x9c')](),'sender':_0x2a3815[_0xb0c6('0xe2')]===_0xb0c6('0xe3')?_0x2a3815[_0xb0c6('0x70')]?_0x2a3815['User'][_0xb0c6('0x32')]:_0xb0c6('0xe4'):_0x2a3815[_0xb0c6('0xe5')][_0xb0c6('0xe6')]+(_0x2a3815[_0xb0c6('0xe5')][_0xb0c6('0xd3')]?'\x20'+_0x2a3815[_0xb0c6('0xe5')][_0xb0c6('0xd3')]:''),'body':_0x2a3815[_0xb0c6('0xd4')]?_0x2a3815[_0xb0c6('0xd4')][_0xb0c6('0xdf')]:_0x2a3815[_0xb0c6('0x74')],'direction':_0x2a3815[_0xb0c6('0xe2')]===_0xb0c6('0xe3')?'A':'C','secret':_0x2a3815['secret'],'read':_0x2a3815['read'],'attachment':_0x2a3815['Attachment']};})[_0xb0c6('0x64')]()};return ejs['renderFile'](path[_0xb0c6('0xcb')](config[_0xb0c6('0xcc')],_0xb0c6('0xcd'),_0xb0c6('0xe7'),_0xb0c6('0xe8')),{'interaction':_0x4462d9})[_0xb0c6('0x2a')](function(_0x22e00a){var _0x50e5a6=path['join'](_0x188284,_0xb0c6('0xe9')+_0x29e40c['id']+'-'+_0x50ffc8+'.pdf');var _0x2f5d6e={'path':_0x50e5a6,'channel':_0xb0c6('0xea'),'interactionId':_0x29e40c['id']};return pdf[_0xb0c6('0xeb')](_0x22e00a,_0x2f5d6e);})[_0xb0c6('0x2a')](function(){return new BPromise(function(_0x5cb4f4,_0x5deded){zipdir(_0x188284,{'saveTo':_0x5e1bcd},function(_0xab7b73,_0x392c58){if(_0xab7b73)return _0x5deded(_0xab7b73);return _0x5cb4f4(_0x392c58);});})[_0xb0c6('0x2a')](function(){return new BPromise(function(_0x7834dc,_0x4f90e5){rimraf(_0x188284,function(_0x1d8197){if(_0x1d8197)_0x4f90e5(_0x1d8197);return _0x7834dc();});});})[_0xb0c6('0x2a')](function(){return _0x333939[_0xb0c6('0xc9')](_0x5e1bcd,_0x234c18,function(_0x1935c7){if(_0x1935c7){console[_0xb0c6('0xec')]('err',_0x1935c7);}else{fs[_0xb0c6('0xed')](_0x5e1bcd);}});});});}else{return _0x333939[_0xb0c6('0x1e')](0xc8);}})[_0xb0c6('0x37')](handleError(_0x333939,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 19e108a..0f15fc8 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 _0xc7ea=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ea,0x171));var _0xac7e=function(_0xbca14e,_0x2b6d64){_0xbca14e=_0xbca14e-0x0;var _0x5cd841=_0xc7ea[_0xbca14e];return _0x5cd841;};'use strict';var EventEmitter=require(_0xac7e('0x0'));var WhatsappInteraction=require(_0xac7e('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xac7e('0x1'))['db'][_0xac7e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xac7e('0x3')](0x0);var events={'afterCreate':_0xac7e('0x4'),'afterUpdate':'update','afterDestroy':_0xac7e('0x5')};function emitEvent(_0x39bf60){return function(_0x1c15cf,_0x3ca05f,_0x26b1c5){_0x1c15cf[_0xac7e('0x6')]({'attributes':['id'],'raw':!![]})[_0xac7e('0x7')](function(_0x1aca29){_0x1c15cf[_0xac7e('0x8')](_0xac7e('0x9'),_0x1aca29['map'](function(_0x114e82){return{'id':_0x114e82['id']};}));return WhatsappMessage[_0xac7e('0xa')]({'where':{'WhatsappInteractionId':_0x1c15cf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac7e('0x7')](function(_0x173b59){_0x1c15cf[_0xac7e('0x8')](_0xac7e('0xb'),_0x173b59[_0xac7e('0xc')]);WhatsappInteractionEvents[_0xac7e('0xd')](_0x39bf60+':'+_0x1c15cf['id'],_0x1c15cf);WhatsappInteractionEvents[_0xac7e('0xd')](_0x39bf60,_0x1c15cf);_0x26b1c5(null);})[_0xac7e('0xe')](_0x26b1c5(null));};}for(var e in events){if(events[_0xac7e('0xf')](e)){var event=events[e];WhatsappInteraction[_0xac7e('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xfb30=['setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xfb30,0x88));var _0x0fb3=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfb30[_0x3947c9];return _0x2e7871;};'use strict';var EventEmitter=require(_0x0fb3('0x0'));var WhatsappInteraction=require(_0x0fb3('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x0fb3('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0fb3('0x3'),'afterUpdate':_0x0fb3('0x4'),'afterDestroy':_0x0fb3('0x5')};function emitEvent(_0x309947){return function(_0xeae902,_0x26a227,_0x2f2a96){_0xeae902[_0x0fb3('0x6')]({'attributes':['id'],'raw':!![]})[_0x0fb3('0x7')](function(_0x1042d9){_0xeae902[_0x0fb3('0x8')]('Users',_0x1042d9[_0x0fb3('0x9')](function(_0x51a30b){return{'id':_0x51a30b['id']};}));return WhatsappMessage[_0x0fb3('0xa')]({'where':{'WhatsappInteractionId':_0xeae902['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0fb3('0x7')](function(_0x3b5f43){_0xeae902[_0x0fb3('0x8')](_0x0fb3('0xb'),_0x3b5f43['length']);WhatsappInteractionEvents['emit'](_0x309947+':'+_0xeae902['id'],_0xeae902);WhatsappInteractionEvents[_0x0fb3('0xc')](_0x309947,_0xeae902);_0x2f2a96(null);})[_0x0fb3('0xd')](_0x2f2a96(null));};}for(var e in events){if(events[_0x0fb3('0xe')](e)){var event=events[e];WhatsappInteraction[_0x0fb3('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ef7f957..f6c479a 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 _0x106a=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x106a,0xb2));var _0xa106=function(_0x4d4282,_0x47388c){_0x4d4282=_0x4d4282-0x0;var _0x540385=_0x106a[_0x4d4282];return _0x540385;};'use strict';var _=require(_0xa106('0x0'));var util=require(_0xa106('0x1'));var logger=require(_0xa106('0x2'))(_0xa106('0x3'));var moment=require('moment');var BPromise=require(_0xa106('0x4'));var rp=require(_0xa106('0x5'));var fs=require('fs');var path=require(_0xa106('0x6'));var rimraf=require(_0xa106('0x7'));var config=require(_0xa106('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x593689,_0x558be7){return _0x593689['define'](_0xa106('0x9'),attributes,{'tableName':_0xa106('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59a09e,_0x3fc912,_0x32d5dc){if(_0x59a09e[_0xa106('0xb')](_0xa106('0xc'))){_0x59a09e[_0xa106('0xd')]=moment()[_0xa106('0xe')](_0xa106('0xf'));}_0x32d5dc(null,_0x59a09e);}}});}; \ No newline at end of file +var _0x5464=['changed','closed','closedAt','format','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions'];(function(_0x2d1d1d,_0x32d7ac){var _0x1a6c24=function(_0x1dab92){while(--_0x1dab92){_0x2d1d1d['push'](_0x2d1d1d['shift']());}};_0x1a6c24(++_0x32d7ac);}(_0x5464,0x15d));var _0x4546=function(_0x4dca9d,_0xb9472d){_0x4dca9d=_0x4dca9d-0x0;var _0x4e5301=_0x5464[_0x4dca9d];return _0x4e5301;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a76c1,_0x2e860a,_0x2f0376){if(_0x1a76c1[_0x4546('0xb')](_0x4546('0xc'))){_0x1a76c1[_0x4546('0xd')]=moment()[_0x4546('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2f0376(null,_0x1a76c1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a6b6099..30926dc 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 _0x9f9a=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','body','options','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','omit','spread','AddTags'];(function(_0x5cda7a,_0x51a7a0){var _0x18e18a=function(_0x1e8348){while(--_0x1e8348){_0x5cda7a['push'](_0x5cda7a['shift']());}};_0x18e18a(++_0x51a7a0);}(_0x9f9a,0x1e1));var _0xa9f9=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x9f9a[_0x3e7804];return _0x56efda;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f9('0x0'));var db=require(_0xa9f9('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9f9('0x2'))(_0xa9f9('0x3'));var config=require('../../config/environment');var jayson=require(_0xa9f9('0x4'));var client=jayson[_0xa9f9('0x5')][_0xa9f9('0x6')]({'port':0x232a});config[_0xa9f9('0x7')]=_[_0xa9f9('0x8')](config[_0xa9f9('0x7')],{'host':_0xa9f9('0x9'),'port':0x18eb});var socket=require(_0xa9f9('0xa'))(new Redis(config['redis']));require(_0xa9f9('0xb'))['register'](socket);function respondWithRpcPromise(_0x1cb976,_0x3b4881,_0x39a906){return new BPromise(function(_0x1768c2,_0x28a4bb){return client[_0xa9f9('0xc')](_0x1cb976,_0x39a906)[_0xa9f9('0xd')](function(_0x5d0074){logger[_0xa9f9('0xe')](_0xa9f9('0xf'),_0x3b4881,_0xa9f9('0x10'));logger[_0xa9f9('0x11')](_0xa9f9('0x12'),_0x3b4881,_0xa9f9('0x10'),JSON[_0xa9f9('0x13')](_0x5d0074));if(_0x5d0074['error']){if(_0x5d0074[_0xa9f9('0x14')][_0xa9f9('0x15')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3b4881,_0x5d0074['error'][_0xa9f9('0x16')]);return _0x28a4bb(_0x5d0074['error'][_0xa9f9('0x16')]);}logger['error'](_0xa9f9('0xf'),_0x3b4881,_0x5d0074[_0xa9f9('0x14')]['message']);return _0x1768c2(_0x5d0074[_0xa9f9('0x14')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3b4881,_0xa9f9('0x10'));_0x1768c2(_0x5d0074[_0xa9f9('0x17')][_0xa9f9('0x16')]);}})[_0xa9f9('0x18')](function(_0x171da9){logger[_0xa9f9('0x14')](_0xa9f9('0xf'),_0x3b4881,_0x171da9);_0x28a4bb(_0x171da9);});});}exports['UpdateWhatsappInteraction']=function(_0x100e3b){var _0xf3022f=this;return new Promise(function(_0x35e572,_0x14bee5){return db[_0xa9f9('0x19')]['update'](_0x100e3b[_0xa9f9('0x1a')],{'raw':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1c')]||null:null,'attributes':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1d')]||null:null,'limit':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1e')]||null:null})[_0xa9f9('0xd')](function(_0x3033ba){logger[_0xa9f9('0xe')](_0xa9f9('0x1f'),_0x100e3b);logger[_0xa9f9('0x11')](_0xa9f9('0x1f'),_0x100e3b,JSON[_0xa9f9('0x13')](_0x3033ba));_0x35e572(_0x3033ba);})['catch'](function(_0x3781c3){logger[_0xa9f9('0x14')](_0xa9f9('0x1f'),_0x3781c3[_0xa9f9('0x16')],_0x100e3b);_0x14bee5(_0xf3022f['error'](0x1f4,_0x3781c3[_0xa9f9('0x16')]));});});};exports[_0xa9f9('0x20')]=function(_0x3971a3){return new Promise(function(_0x108cc2,_0x58596e){return db[_0xa9f9('0x19')][_0xa9f9('0x21')]({'where':_0x3971a3['options']?_0x3971a3['options'][_0xa9f9('0x1c')]||null:null})[_0xa9f9('0xd')](function(_0x36f700){if(_0x36f700){return _0x36f700['addTags'](_0x3971a3['body']['ids'],_[_0xa9f9('0x22')](_0x3971a3['body'],['ids','id'])||{});}})[_0xa9f9('0x23')](function(_0x39987d){logger[_0xa9f9('0xe')]('AddTags',_0x3971a3);logger[_0xa9f9('0x11')]('AddTags',_0x3971a3,JSON[_0xa9f9('0x13')](_0x39987d));_0x108cc2(_0x39987d);})['catch'](function(_0x54e378){logger['error'](_0xa9f9('0x24'),_0x54e378[_0xa9f9('0x16')],_0x3971a3);_0x58596e(_this['error'](0x1f4,_0x54e378[_0xa9f9('0x16')]));});});}; \ No newline at end of file +var _0x42f0=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2b59b1,_0x46c17c){var _0x4a44bb=function(_0x47c007){while(--_0x47c007){_0x2b59b1['push'](_0x2b59b1['shift']());}};_0x4a44bb(++_0x46c17c);}(_0x42f0,0x1c1));var _0x042f=function(_0x4dec07,_0x5d12c8){_0x4dec07=_0x4dec07-0x0;var _0x17c8d4=_0x42f0[_0x4dec07];return _0x17c8d4;};'use strict';var _=require(_0x042f('0x0'));var util=require(_0x042f('0x1'));var moment=require(_0x042f('0x2'));var BPromise=require(_0x042f('0x3'));var rs=require(_0x042f('0x4'));var fs=require('fs');var Redis=require(_0x042f('0x5'));var db=require(_0x042f('0x6'))['db'];var utils=require(_0x042f('0x7'));var logger=require(_0x042f('0x8'))(_0x042f('0x9'));var config=require(_0x042f('0xa'));var jayson=require(_0x042f('0xb'));var client=jayson[_0x042f('0xc')][_0x042f('0xd')]({'port':0x232a});config[_0x042f('0xe')]=_[_0x042f('0xf')](config[_0x042f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x042f('0x10'))(new Redis(config[_0x042f('0xe')]));require(_0x042f('0x11'))[_0x042f('0x12')](socket);function respondWithRpcPromise(_0x2d5d6d,_0x576158,_0x56904e){return new BPromise(function(_0x15367d,_0x19d322){return client[_0x042f('0x13')](_0x2d5d6d,_0x56904e)[_0x042f('0x14')](function(_0x1b7cf0){logger[_0x042f('0x15')](_0x042f('0x16'),_0x576158,_0x042f('0x17'));logger[_0x042f('0x18')](_0x042f('0x19'),_0x576158,'request\x20sent',JSON['stringify'](_0x1b7cf0));if(_0x1b7cf0[_0x042f('0x1a')]){if(_0x1b7cf0['error'][_0x042f('0x1b')]===0x1f4){logger[_0x042f('0x1a')](_0x042f('0x16'),_0x576158,_0x1b7cf0['error'][_0x042f('0x1c')]);return _0x19d322(_0x1b7cf0[_0x042f('0x1a')]['message']);}logger['error'](_0x042f('0x16'),_0x576158,_0x1b7cf0['error'][_0x042f('0x1c')]);return _0x15367d(_0x1b7cf0['error'][_0x042f('0x1c')]);}else{logger[_0x042f('0x15')](_0x042f('0x16'),_0x576158,'request\x20sent');_0x15367d(_0x1b7cf0[_0x042f('0x1d')][_0x042f('0x1c')]);}})[_0x042f('0x1e')](function(_0x35e2cc){logger['error'](_0x042f('0x16'),_0x576158,_0x35e2cc);_0x19d322(_0x35e2cc);});});}exports[_0x042f('0x1f')]=function(_0x578e67){var _0x11f8ea=this;return new Promise(function(_0x33e471,_0x59ded8){return db['WhatsappInteraction'][_0x042f('0x20')](_0x578e67[_0x042f('0x21')],{'raw':_0x578e67[_0x042f('0x22')]?_0x578e67['options'][_0x042f('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x578e67['options']?_0x578e67[_0x042f('0x22')][_0x042f('0x24')]||null:null,'attributes':_0x578e67[_0x042f('0x22')]?_0x578e67[_0x042f('0x22')]['attributes']||null:null,'limit':_0x578e67[_0x042f('0x22')]?_0x578e67[_0x042f('0x22')][_0x042f('0x25')]||null:null})[_0x042f('0x14')](function(_0x424bd6){logger[_0x042f('0x15')](_0x042f('0x1f'),_0x578e67);logger[_0x042f('0x18')](_0x042f('0x1f'),_0x578e67,JSON[_0x042f('0x26')](_0x424bd6));_0x33e471(_0x424bd6);})['catch'](function(_0x4c72ee){logger[_0x042f('0x1a')](_0x042f('0x1f'),_0x4c72ee[_0x042f('0x1c')],_0x578e67);_0x59ded8(_0x11f8ea[_0x042f('0x1a')](0x1f4,_0x4c72ee['message']));});});};exports[_0x042f('0x27')]=function(_0x2bab36){return new Promise(function(_0x354251,_0x566b95){return db['WhatsappInteraction'][_0x042f('0x28')]({'where':_0x2bab36[_0x042f('0x22')]?_0x2bab36['options']['where']||null:null})['then'](function(_0x2b6b8b){if(_0x2b6b8b){return _0x2b6b8b[_0x042f('0x29')](_0x2bab36[_0x042f('0x21')][_0x042f('0x2a')],_[_0x042f('0x2b')](_0x2bab36['body'],[_0x042f('0x2a'),'id'])||{});}})[_0x042f('0x2c')](function(_0x1fdf3e){logger['info'](_0x042f('0x2d'),_0x2bab36);logger[_0x042f('0x18')](_0x042f('0x2d'),_0x2bab36,JSON[_0x042f('0x26')](_0x1fdf3e));_0x354251(_0x1fdf3e);})['catch'](function(_0x5c808e){logger[_0x042f('0x1a')](_0x042f('0x2d'),_0x5c808e[_0x042f('0x1c')],_0x2bab36);_0x566b95(_this[_0x042f('0x1a')](0x1f4,_0x5c808e[_0x042f('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 710ee98..9446a69 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 _0xe1b3=['register','whatsappInteraction:','./whatsappInteraction.events','save','removeListener'];(function(_0x5f1431,_0x49bea0){var _0x165500=function(_0xdb081a){while(--_0xdb081a){_0x5f1431['push'](_0x5f1431['shift']());}};_0x165500(++_0x49bea0);}(_0xe1b3,0x165));var _0x3e1b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe1b3[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappInteractionEvents=require(_0x3e1b('0x0'));var events=[_0x3e1b('0x1'),'remove','update'];function createListener(_0x5d246b,_0x54d1bb){return function(_0x571c03){_0x54d1bb['emit'](_0x5d246b,_0x571c03);};}function removeListener(_0x74ce5b,_0x3a4b10){return function(){WhatsappInteractionEvents[_0x3e1b('0x2')](_0x74ce5b,_0x3a4b10);};}exports[_0x3e1b('0x3')]=function(_0x18d45f){for(var _0xbd2e2d=0x0,_0x1fca7d=events['length'];_0xbd2e2d<_0x1fca7d;_0xbd2e2d++){var _0x41fff1=events[_0xbd2e2d];var _0x54335c=createListener(_0x3e1b('0x4')+_0x41fff1,_0x18d45f);WhatsappInteractionEvents['on'](_0x41fff1,_0x54335c);}}; \ No newline at end of file +var _0x113f=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','removeListener'];(function(_0xc2e05e,_0xc18cfe){var _0x2e4174=function(_0x250bf0){while(--_0x250bf0){_0xc2e05e['push'](_0xc2e05e['shift']());}};_0x2e4174(++_0xc18cfe);}(_0x113f,0xb2));var _0xf113=function(_0x167fb4,_0x4955de){_0x167fb4=_0x167fb4-0x0;var _0x51a385=_0x113f[_0x167fb4];return _0x51a385;};'use strict';var WhatsappInteractionEvents=require(_0xf113('0x0'));var events=[_0xf113('0x1'),_0xf113('0x2'),'update'];function createListener(_0x2f19a8,_0x50d80c){return function(_0x2dc28e){_0x50d80c['emit'](_0x2f19a8,_0x2dc28e);};}function removeListener(_0x2ca988,_0x1a3b4a){return function(){WhatsappInteractionEvents[_0xf113('0x3')](_0x2ca988,_0x1a3b4a);};}exports[_0xf113('0x4')]=function(_0xad9998){for(var _0x2c5d00=0x0,_0xc0aa33=events[_0xf113('0x5')];_0x2c5d00<_0xc0aa33;_0x2c5d00++){var _0x3297d9=events[_0x2c5d00];var _0x2532d2=createListener(_0xf113('0x6')+_0x3297d9,_0xad9998);WhatsappInteractionEvents['on'](_0x3297d9,_0x2532d2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 65faed8..9965db9 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 _0xbafc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbafc,0xed));var _0xcbaf=function(_0x5013bd,_0x4d4b8d){_0x5013bd=_0x5013bd-0x0;var _0x5d3e13=_0xbafc[_0x5013bd];return _0x5d3e13;};'use strict';var multer=require(_0xcbaf('0x0'));var util=require(_0xcbaf('0x1'));var path=require('path');var timeout=require(_0xcbaf('0x2'));var express=require(_0xcbaf('0x3'));var router=express[_0xcbaf('0x4')]();var fs_extra=require(_0xcbaf('0x5'));var auth=require(_0xcbaf('0x6'));var interaction=require(_0xcbaf('0x7'));var config=require(_0xcbaf('0x8'));var controller=require(_0xcbaf('0x9'));router[_0xcbaf('0xa')]('/',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0xc')]);router[_0xcbaf('0xa')](_0xcbaf('0xd'),auth[_0xcbaf('0xb')](),controller['describe']);router['get'](_0xcbaf('0xe'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0xf')]);router[_0xcbaf('0x10')]('/',auth[_0xcbaf('0xb')](),interaction[_0xcbaf('0x11')](_0xcbaf('0x12'),_0xcbaf('0x13')),controller[_0xcbaf('0x14')]);router[_0xcbaf('0x10')](_0xcbaf('0x15'),controller[_0xcbaf('0x16')]);router[_0xcbaf('0x17')](_0xcbaf('0xe'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x18')]);router[_0xcbaf('0x17')](_0xcbaf('0x19'),auth['isAuthenticated'](),controller[_0xcbaf('0x1a')]);router[_0xcbaf('0x1b')](_0xcbaf('0xe'),auth['isAuthenticated'](),controller[_0xcbaf('0x1c')]);module[_0xcbaf('0x1d')]=router; \ No newline at end of file +var _0x3ade=['put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create'];(function(_0x53fda3,_0x5cc847){var _0x3c0742=function(_0x1c8f43){while(--_0x1c8f43){_0x53fda3['push'](_0x53fda3['shift']());}};_0x3c0742(++_0x5cc847);}(_0x3ade,0x6a));var _0xe3ad=function(_0x5a24de,_0x542232){_0x5a24de=_0x5a24de-0x0;var _0x388e2e=_0x3ade[_0x5a24de];return _0x388e2e;};'use strict';var multer=require(_0xe3ad('0x0'));var util=require(_0xe3ad('0x1'));var path=require(_0xe3ad('0x2'));var timeout=require(_0xe3ad('0x3'));var express=require('express');var router=express[_0xe3ad('0x4')]();var fs_extra=require(_0xe3ad('0x5'));var auth=require(_0xe3ad('0x6'));var interaction=require(_0xe3ad('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xe3ad('0x8')]('/',auth[_0xe3ad('0x9')](),controller[_0xe3ad('0xa')]);router[_0xe3ad('0x8')](_0xe3ad('0xb'),auth[_0xe3ad('0x9')](),controller['describe']);router['get'](_0xe3ad('0xc'),auth['isAuthenticated'](),controller[_0xe3ad('0xd')]);router[_0xe3ad('0xe')]('/',auth[_0xe3ad('0x9')](),interaction[_0xe3ad('0xf')](_0xe3ad('0x10'),_0xe3ad('0x11')),controller[_0xe3ad('0x12')]);router[_0xe3ad('0xe')]('/:id/status',controller['status']);router[_0xe3ad('0x13')](_0xe3ad('0xc'),auth[_0xe3ad('0x9')](),controller['update']);router['put'](_0xe3ad('0x14'),auth[_0xe3ad('0x9')](),controller[_0xe3ad('0x15')]);router[_0xe3ad('0x13')](_0xe3ad('0x16'),auth[_0xe3ad('0x9')](),controller['reject']);router[_0xe3ad('0x17')](_0xe3ad('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe3ad('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 58791e7..c4b603c 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 _0x683f=['TEXT','medium','ENUM','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0x683f,0x18e));var _0xf683=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x683f[_0x16051a];return _0x35d20d;};'use strict';var Sequelize=require(_0xf683('0x0'));module[_0xf683('0x1')]={'body':{'type':Sequelize[_0xf683('0x2')](_0xf683('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf683('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf683('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf683('0x5')]},'readAt':{'type':Sequelize[_0xf683('0x6')]},'secret':{'type':Sequelize[_0xf683('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf683('0x2')]}}; \ No newline at end of file +var _0xa1b8=['TEXT','medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x4da6ba,_0x554ea7){var _0x4b8317=function(_0x573de2){while(--_0x573de2){_0x4da6ba['push'](_0x4da6ba['shift']());}};_0x4b8317(++_0x554ea7);}(_0xa1b8,0x1b7));var _0x8a1b=function(_0x10dbdd,_0x91235){_0x10dbdd=_0x10dbdd-0x0;var _0x3d3ef8=_0xa1b8[_0x10dbdd];return _0x3d3ef8;};'use strict';var Sequelize=require(_0x8a1b('0x0'));module[_0x8a1b('0x1')]={'body':{'type':Sequelize[_0x8a1b('0x2')](_0x8a1b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8a1b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8a1b('0x5')),'defaultValue':_0x8a1b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8a1b('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x8a1b('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8a1b('0x6')]},'providerResponse':{'type':Sequelize[_0x8a1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6807c52..6c92bb5 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 _0x7c52=['options','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','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','acceptmessage','WhatsappInteraction','null','RejectMessage','rejectMessage','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7c52,0x14c));var _0x27c5=function(_0x1ba238,_0x240f26){_0x1ba238=_0x1ba238-0x0;var _0x4e020f=_0x7c52[_0x1ba238];return _0x4e020f;};'use strict';var emlformat=require(_0x27c5('0x0'));var rimraf=require(_0x27c5('0x1'));var zipdir=require(_0x27c5('0x2'));var jsonpatch=require(_0x27c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x27c5('0x4'));var util=require('util');var path=require('path');var sox=require(_0x27c5('0x5'));var csv=require(_0x27c5('0x6'));var ejs=require(_0x27c5('0x7'));var fs=require('fs');var fs_extra=require(_0x27c5('0x8'));var _=require(_0x27c5('0x9'));var squel=require('squel');var crypto=require(_0x27c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27c5('0xb'));var toCsv=require(_0x27c5('0x6'));var querystring=require(_0x27c5('0xc'));var Papa=require(_0x27c5('0xd'));var Redis=require(_0x27c5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x27c5('0xf'));var as=require(_0x27c5('0x10'));var hardwareService=require(_0x27c5('0x11'));var logger=require(_0x27c5('0x12'))(_0x27c5('0x13'));var utils=require('../../config/utils');var config=require(_0x27c5('0x14'));var licenseUtil=require(_0x27c5('0x15'));var db=require(_0x27c5('0x16'))['db'];config['redis']=_['defaults'](config[_0x27c5('0x17')],{'host':_0x27c5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27c5('0x17')]));require(_0x27c5('0x19'))[_0x27c5('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x27c5('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x27c5('0x1b')][_0x27c5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2edba2,_0x171ab2,_0x43f7d4,_0x1aab57){return new BPromise(function(_0x442608,_0x3c1a94){var _0x11a0ed=_0x1aab57||client;return _0x11a0ed[_0x27c5('0x1d')](_0x2edba2,_0x43f7d4)[_0x27c5('0x1e')](function(_0x56b096){logger[_0x27c5('0x1f')](_0x27c5('0x20'),_0x171ab2,_0x27c5('0x21'));logger[_0x27c5('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x171ab2,'request\x20sent',JSON[_0x27c5('0x23')](_0x56b096));if(_0x56b096[_0x27c5('0x24')]){if(_0x56b096[_0x27c5('0x24')][_0x27c5('0x25')]===0x1f4){logger[_0x27c5('0x24')](_0x27c5('0x20'),_0x171ab2,_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);return _0x3c1a94(_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);}logger[_0x27c5('0x24')](_0x27c5('0x20'),_0x171ab2,_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);return _0x442608(_0x56b096['error'][_0x27c5('0x26')]);}else{logger[_0x27c5('0x1f')](_0x27c5('0x20'),_0x171ab2,_0x27c5('0x21'));_0x442608(_0x56b096[_0x27c5('0x27')][_0x27c5('0x26')]);}})[_0x27c5('0x28')](function(_0x56986f){logger[_0x27c5('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x171ab2,_0x56986f);_0x3c1a94(_0x56986f);});});}function respondWithStatusCode(_0x5005a5,_0x3885b6){_0x3885b6=_0x3885b6||0xcc;return function(_0xc1a761){if(_0xc1a761){return _0x5005a5[_0x27c5('0x29')](_0x3885b6);}return _0x5005a5[_0x27c5('0x2a')](_0x3885b6)['end']();};}function respondWithResult(_0x12a324,_0x2f406c){_0x2f406c=_0x2f406c||0xc8;return function(_0x3841c7){if(_0x3841c7){return _0x12a324[_0x27c5('0x2a')](_0x2f406c)[_0x27c5('0x2b')](_0x3841c7);}};}function respondWithFilteredResult(_0x25f321,_0x5b1fed){return function(_0x279381){if(_0x279381){var _0x50a4b8=typeof _0x5b1fed['offset']==='undefined'&&typeof _0x5b1fed['limit']==='undefined';var _0x385908=_0x279381['count'];var _0x5dd61b=_0x50a4b8?0x0:_0x5b1fed['offset'];var _0x180579=_0x50a4b8?_0x279381[_0x27c5('0x2c')]:_0x5b1fed[_0x27c5('0x2d')]+_0x5b1fed['limit'];var _0x5dc24a;if(_0x180579>=_0x385908){_0x180579=_0x385908;_0x5dc24a=0xc8;}else{_0x5dc24a=0xce;}_0x25f321['status'](_0x5dc24a);return _0x25f321[_0x27c5('0x2e')](_0x27c5('0x2f'),_0x5dd61b+'-'+_0x180579+'/'+_0x385908)[_0x27c5('0x2b')](_0x279381);}return null;};}function patchUpdates(_0xa58590){return function(_0x216f17){try{jsonpatch[_0x27c5('0x30')](_0x216f17,_0xa58590,!![]);}catch(_0x43e681){return BPromise[_0x27c5('0x31')](_0x43e681);}return _0x216f17[_0x27c5('0x32')]();};}function saveUpdates(_0x397eed,_0x356d2a){return function(_0x1d49c1){if(_0x1d49c1){return _0x1d49c1[_0x27c5('0x33')](_0x397eed)[_0x27c5('0x1e')](function(_0x4f76b0){return _0x4f76b0;});}return null;};}function removeEntity(_0x2b65e1,_0x262874){return function(_0x20bf0d){if(_0x20bf0d){return _0x20bf0d[_0x27c5('0x34')]()[_0x27c5('0x1e')](function(){_0x2b65e1[_0x27c5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4988,_0x5b0b53){return function(_0x2dd640){if(!_0x2dd640){_0x5a4988[_0x27c5('0x29')](0x194);}return _0x2dd640;};}function handleError(_0x49b82b,_0x44a2e8){_0x44a2e8=_0x44a2e8||0x1f4;return function(_0x4d35a6){logger[_0x27c5('0x24')](_0x4d35a6['stack']);if(_0x4d35a6[_0x27c5('0x35')]){delete _0x4d35a6[_0x27c5('0x35')];}_0x49b82b[_0x27c5('0x2a')](_0x44a2e8)[_0x27c5('0x36')](_0x4d35a6);};}exports[_0x27c5('0x37')]=function(_0xb27f1,_0x5d5654){var _0x5ed6a5={},_0x17a9fb={},_0x473c66={'count':0x0,'rows':[]};var _0x1a6a13=_[_0x27c5('0x38')](db[_0x27c5('0x39')][_0x27c5('0x3a')],function(_0x2bdabd){return{'name':_0x2bdabd[_0x27c5('0x3b')],'type':_0x2bdabd[_0x27c5('0x3c')]['key']};});_0x17a9fb[_0x27c5('0x3d')]=_[_0x27c5('0x38')](_0x1a6a13,_0x27c5('0x35'));_0x17a9fb[_0x27c5('0x3e')]=_['keys'](_0xb27f1[_0x27c5('0x3e')]);_0x17a9fb[_0x27c5('0x3f')]=_[_0x27c5('0x40')](_0x17a9fb[_0x27c5('0x3d')],_0x17a9fb[_0x27c5('0x3e')]);_0x5ed6a5[_0x27c5('0x41')]=_['intersection'](_0x17a9fb['model'],qs['fields'](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x42')]));_0x5ed6a5[_0x27c5('0x41')]=_0x5ed6a5[_0x27c5('0x41')][_0x27c5('0x43')]?_0x5ed6a5[_0x27c5('0x41')]:_0x17a9fb[_0x27c5('0x3d')];if(!_0xb27f1['query'][_0x27c5('0x44')]('nolimit')){_0x5ed6a5['limit']=qs[_0x27c5('0x45')](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x45')]);_0x5ed6a5[_0x27c5('0x2d')]=qs['offset'](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x2d')]);}_0x5ed6a5[_0x27c5('0x46')]=qs[_0x27c5('0x47')](_0xb27f1['query'][_0x27c5('0x47')]);_0x5ed6a5[_0x27c5('0x48')]=qs['filters'](_[_0x27c5('0x49')](_0xb27f1[_0x27c5('0x3e')],_0x17a9fb[_0x27c5('0x3f')]),_0x1a6a13);if(_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x4a')]){_0x5ed6a5[_0x27c5('0x48')]=_[_0x27c5('0x4b')](_0x5ed6a5[_0x27c5('0x48')],{'$or':_[_0x27c5('0x38')](_0x1a6a13,function(_0x17b876){if(_0x17b876['type']!=='VIRTUAL'){var _0x1f8139={};_0x1f8139[_0x17b876[_0x27c5('0x35')]]={'$like':'%'+_0xb27f1[_0x27c5('0x3e')]['filter']+'%'};return _0x1f8139;}})});}_0x5ed6a5=_['merge']({},_0x5ed6a5,_0xb27f1[_0x27c5('0x4c')]);var _0x26fcfb={'where':_0x5ed6a5['where']};return db[_0x27c5('0x39')][_0x27c5('0x2c')](_0x26fcfb)[_0x27c5('0x1e')](function(_0x57ea9b){_0x473c66[_0x27c5('0x2c')]=_0x57ea9b;if(_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x4d')]){_0x5ed6a5[_0x27c5('0x4e')]=[{'all':!![]}];}return db[_0x27c5('0x39')][_0x27c5('0x4f')](_0x5ed6a5);})[_0x27c5('0x1e')](function(_0x4ec524){_0x473c66[_0x27c5('0x50')]=_0x4ec524;return _0x473c66;})['then'](respondWithFilteredResult(_0x5d5654,_0x5ed6a5))[_0x27c5('0x28')](handleError(_0x5d5654,null));};exports[_0x27c5('0x51')]=function(_0x544d85,_0x4b82e2){var _0x28af76={'raw':!![],'where':{'id':_0x544d85[_0x27c5('0x52')]['id']}},_0x575086={};_0x575086[_0x27c5('0x3d')]=_['keys'](db[_0x27c5('0x39')][_0x27c5('0x3a')]);_0x575086[_0x27c5('0x3e')]=_['keys'](_0x544d85['query']);_0x575086[_0x27c5('0x3f')]=_[_0x27c5('0x40')](_0x575086[_0x27c5('0x3d')],_0x575086[_0x27c5('0x3e')]);_0x28af76[_0x27c5('0x41')]=_[_0x27c5('0x40')](_0x575086[_0x27c5('0x3d')],qs[_0x27c5('0x42')](_0x544d85[_0x27c5('0x3e')][_0x27c5('0x42')]));_0x28af76[_0x27c5('0x41')]=_0x28af76[_0x27c5('0x41')][_0x27c5('0x43')]?_0x28af76['attributes']:_0x575086[_0x27c5('0x3d')];if(_0x544d85[_0x27c5('0x3e')][_0x27c5('0x4d')]){_0x28af76[_0x27c5('0x4e')]=[{'all':!![]}];}_0x28af76=_[_0x27c5('0x4b')]({},_0x28af76,_0x544d85[_0x27c5('0x4c')]);return db['WhatsappMessage'][_0x27c5('0x53')](_0x28af76)[_0x27c5('0x1e')](handleEntityNotFound(_0x4b82e2,null))['then'](respondWithResult(_0x4b82e2,null))[_0x27c5('0x28')](handleError(_0x4b82e2,null));};exports[_0x27c5('0x54')]=function(_0x1f535d,_0x96363){return db[_0x27c5('0x39')][_0x27c5('0x54')](_0x1f535d[_0x27c5('0x55')],{})[_0x27c5('0x1e')](respondWithResult(_0x96363,0xc9))[_0x27c5('0x28')](handleError(_0x96363,null));};exports[_0x27c5('0x33')]=function(_0x2a46b2,_0x520ba7){if(_0x2a46b2[_0x27c5('0x55')]['id']){delete _0x2a46b2['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x2a46b2[_0x27c5('0x52')]['id']}})[_0x27c5('0x1e')](handleEntityNotFound(_0x520ba7,null))[_0x27c5('0x1e')](saveUpdates(_0x2a46b2['body'],null))[_0x27c5('0x1e')](respondWithResult(_0x520ba7,null))[_0x27c5('0x28')](handleError(_0x520ba7,null));};exports['destroy']=function(_0x3dfd85,_0x530cbc){return db[_0x27c5('0x39')][_0x27c5('0x53')]({'where':{'id':_0x3dfd85[_0x27c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x530cbc,null))[_0x27c5('0x1e')](removeEntity(_0x530cbc,null))['catch'](handleError(_0x530cbc,null));};exports[_0x27c5('0x56')]=function(_0x47f657,_0x3c2223){return db['WhatsappMessage']['describe']()[_0x27c5('0x1e')](respondWithResult(_0x3c2223,null))[_0x27c5('0x28')](handleError(_0x3c2223,null));};var interaction_log=require(_0x27c5('0x12'))('whatsapp-interactions');exports[_0x27c5('0x57')]=function(_0x31b87a,_0x34b04d,_0x349377){var _0x6908e2={'agent':{},'channel':_0x27c5('0x58')};if(_0x31b87a[_0x27c5('0x55')]['id']){delete _0x31b87a[_0x27c5('0x55')]['id'];}_0x31b87a[_0x27c5('0x55')][_0x27c5('0x59')]=!![];_0x31b87a['body'][_0x27c5('0x5a')]=moment()['format'](_0x27c5('0x5b'));_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')]=_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')]||_0x31b87a['user']['id'];_0x6908e2[_0x27c5('0x5d')]['id']=_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')];return db[_0x27c5('0x39')]['find']({'where':{'id':_0x31b87a[_0x27c5('0x52')]['id'],'UserId':null}})[_0x27c5('0x1e')](handleEntityNotFound(_0x34b04d,null))[_0x27c5('0x1e')](saveUpdates(_0x31b87a[_0x27c5('0x55')],null))[_0x27c5('0x1e')](function(_0x1a639d){if(_0x1a639d){_0x6908e2[_0x27c5('0x26')]=_0x1a639d[_0x27c5('0x5e')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1a639d[_0x27c5('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x34b04d,null))[_0x27c5('0x1e')](function(_0x459546){if(_0x459546){return _0x459546['update']({'UserId':_0x31b87a['body'][_0x27c5('0x5c')],'read1stAt':_['isNil'](_0x459546[_0x27c5('0x60')])?moment()[_0x27c5('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x27c5('0x1e')](function(_0x547605){if(_0x547605){_0x6908e2[_0x27c5('0x62')]=_0x547605[_0x27c5('0x5e')]({'plain':!![]});interaction_log[_0x27c5('0x1f')](_0x27c5('0x63'),_0x31b87a[_0x27c5('0x64')]['id'],_0x31b87a[_0x27c5('0x64')][_0x27c5('0x35')],_0x31b87a[_0x27c5('0x64')][_0x27c5('0x65')],_0x6908e2[_0x27c5('0x62')]['id'],_0x31b87a['body']?JSON[_0x27c5('0x23')](_0x31b87a['body']):'null');return respondWithRpcPromise(_0x27c5('0x66'),_0x27c5('0x67'),_0x6908e2);}return null;})[_0x27c5('0x1e')](function(_0x411e6e){var _0x292c71=_0x27c5('0x68')+_0x411e6e[_0x27c5('0x26')][_0x27c5('0x69')];return db[_0x27c5('0x6a')]['query'](_0x292c71,{'type':db[_0x27c5('0x6b')][_0x27c5('0x6c')][_0x27c5('0x6d')],'raw':!![]})[_0x27c5('0x1e')](function(_0x5a5598){return _0x5a5598;});})[_0x27c5('0x1e')](function(_0xd7edf7){if(_0xd7edf7){_0x6908e2[_0x27c5('0x26')][_0x27c5('0x6e')]=_0xd7edf7[0x0];if(!_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')])return;return db[_0x27c5('0x6f')][_0x27c5('0x53')]({'where':{'id':_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')],'role':_0x27c5('0x5d')},'attributes':['id',_0x27c5('0x35'),_0x27c5('0x70'),_0x27c5('0x71'),_0x27c5('0x72')],'raw':!![]});}return null;})[_0x27c5('0x1e')](function(_0x4355cf){if(!_0x4355cf)return null;_0x6908e2['message']['agent']=_0x4355cf;return _0x6908e2;})[_0x27c5('0x1e')](function(_0x4f2992){if(_0x4f2992){if(_0x31b87a[_0x27c5('0x55')][_0x27c5('0x73')]){_0x6908e2[_0x27c5('0x26')][_0x27c5('0x74')]=util[_0x27c5('0x61')](_0x27c5('0x75'),_0x31b87a[_0x27c5('0x64')][_0x27c5('0x35')]);_0x6908e2[_0x27c5('0x26')][_0x27c5('0x76')]=_0x6908e2['channel'];_0x6908e2['message'][_0x27c5('0x77')]=_0x6908e2['channel'];_0x6908e2[_0x27c5('0x26')][_0x27c5('0x78')]=_0x27c5('0x57');return respondWithRpcPromise('EventManager',_0x27c5('0x79'),{'event':_0x27c5('0x7a'),'message':_0x6908e2[_0x27c5('0x26')]},client9002)['then'](function(){return _0x6908e2;});}return _0x6908e2;}return null;})[_0x27c5('0x1e')](respondWithResult(_0x34b04d,null))[_0x27c5('0x28')](handleError(_0x34b04d,null));};var interaction_log=require(_0x27c5('0x12'))('whatsapp-interactions');exports['reject']=function(_0xc96fe4,_0x2d99d0,_0x40a4de){var _0x4c353c={'agent':{},'channel':'whatsapp'};if(_0xc96fe4[_0x27c5('0x55')]['id']){delete _0xc96fe4[_0x27c5('0x55')]['id'];}_0xc96fe4[_0x27c5('0x55')]['UserId']=_0xc96fe4[_0x27c5('0x55')][_0x27c5('0x5c')]||_0xc96fe4[_0x27c5('0x64')]['id'];_0x4c353c['agent']['id']=_0xc96fe4[_0x27c5('0x55')]['UserId'];return db['WhatsappMessage'][_0x27c5('0x53')]({'where':{'id':_0xc96fe4[_0x27c5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d99d0,null))['then'](function(_0x57a8d7){if(_0x57a8d7){_0x4c353c[_0x27c5('0x26')]=_0x57a8d7[_0x27c5('0x5e')]({'plain':!![]});return db[_0x27c5('0x7b')][_0x27c5('0x53')]({'where':{'id':_0x57a8d7[_0x27c5('0x5f')]}});}return null;})[_0x27c5('0x1e')](handleEntityNotFound(_0x2d99d0,null))[_0x27c5('0x1e')](function(_0x45096c){if(_0x45096c){_0x4c353c[_0x27c5('0x62')]=_0x45096c[_0x27c5('0x5e')]({'plain':!![]});interaction_log[_0x27c5('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc96fe4[_0x27c5('0x64')]['id'],_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x35')],_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x65')],_0x4c353c[_0x27c5('0x62')]['id'],_0xc96fe4[_0x27c5('0x55')]?JSON['stringify'](_0xc96fe4['body']):_0x27c5('0x7c'));return respondWithRpcPromise(_0x27c5('0x7d'),_0x27c5('0x7e'),_0x4c353c);}return null;})['then'](function(_0x187b60){var _0x15a6aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x187b60['message']['ContactId'];return db[_0x27c5('0x6a')]['query'](_0x15a6aa,{'type':db[_0x27c5('0x6b')][_0x27c5('0x6c')][_0x27c5('0x6d')],'raw':!![]})[_0x27c5('0x1e')](function(_0x67c49f){return _0x67c49f;});})['then'](function(_0x453d98){if(_0x453d98){_0x4c353c[_0x27c5('0x26')][_0x27c5('0x6e')]=_0x453d98[0x0];if(!_0xc96fe4['body'][_0x27c5('0x5c')])return;return db['User'][_0x27c5('0x53')]({'where':{'id':_0xc96fe4['body']['UserId'],'role':_0x27c5('0x5d')},'attributes':['id',_0x27c5('0x35'),_0x27c5('0x70'),'email','internal'],'raw':!![]});}return null;})[_0x27c5('0x1e')](function(_0x258eaf){if(!_0x258eaf)return null;_0x4c353c[_0x27c5('0x26')][_0x27c5('0x5d')]=_0x258eaf;return _0x4c353c;})['then'](function(_0x354822){if(_0x354822){_0x354822['message'][_0x27c5('0x74')]=util[_0x27c5('0x61')]('SIP/%s',_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x35')]);_0x354822[_0x27c5('0x26')]['channel']=_0x4c353c[_0x27c5('0x76')];_0x354822[_0x27c5('0x26')][_0x27c5('0x77')]=_0x4c353c['channel'];_0x354822['message']['event']=_0x27c5('0x31');respondWithRpcPromise(_0x27c5('0x79'),'EventManager',{'event':_0x27c5('0x7f'),'message':_0x354822[_0x27c5('0x26')]},client9002);return _0x4c353c;}return null;})[_0x27c5('0x1e')](respondWithResult(_0x2d99d0,null))[_0x27c5('0x28')](handleError(_0x2d99d0,null));};exports[_0x27c5('0x2a')]=function(_0x55447f,_0x31f2e6,_0x33cdc0){if(_0x55447f[_0x27c5('0x55')]['id']){delete _0x55447f['body']['id'];}var _0x358d1c;return db[_0x27c5('0x39')][_0x27c5('0x53')]({'where':{'id':_0x55447f[_0x27c5('0x52')]['id']}})[_0x27c5('0x1e')](handleEntityNotFound(_0x31f2e6,null))[_0x27c5('0x1e')](function(_0x5779c5){if(_0x5779c5){_0x358d1c=_0x5779c5;return db['WhatsappAccount'][_0x27c5('0x53')]({'where':{'id':_0x5779c5['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x31f2e6,null))[_0x27c5('0x1e')](function(_0x5b97a9){if(_0x5b97a9){logger['debug'](_0x27c5('0x80'),_0x27c5('0x2a'),_0x27c5('0x81'),_0x5b97a9[_0x27c5('0x3c')],util['inspect'](_0x55447f[_0x27c5('0x55')],{'showHidden':![],'depth':null}));switch(_0x5b97a9['type']){case _0x27c5('0x82'):if(_0x55447f[_0x27c5('0x55')][_0x27c5('0x83')]&&_0x55447f['body'][_0x27c5('0x83')]===_0x358d1c[_0x27c5('0x84')]&&_0x55447f[_0x27c5('0x55')]['MessageStatus']&&_0x55447f['body'][_0x27c5('0x85')]==='read'){return _0x358d1c[_0x27c5('0x33')]({'read':!![]});}else{logger[_0x27c5('0x24')](_0x27c5('0x86'),'status','twilio',util[_0x27c5('0x87')](_0x55447f['body'],{'showHidden':![],'depth':null}));}break;}return _0x358d1c;}})['then'](respondWithResult(_0x31f2e6,null))['catch'](handleError(_0x31f2e6,null));}; \ No newline at end of file +var _0xef22=['options','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','EventManager','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','sendStatus','stack','map','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','WhatsappMessage','includeAll','include','findAll','rows','show','rawAttributes','length'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xef22,0x158));var _0x2ef2=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xef22[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ef2('0x0'));var zipdir=require(_0x2ef2('0x1'));var jsonpatch=require(_0x2ef2('0x2'));var rp=require(_0x2ef2('0x3'));var moment=require(_0x2ef2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2ef2('0x5'));var util=require(_0x2ef2('0x6'));var path=require(_0x2ef2('0x7'));var sox=require(_0x2ef2('0x8'));var csv=require(_0x2ef2('0x9'));var ejs=require(_0x2ef2('0xa'));var fs=require('fs');var fs_extra=require(_0x2ef2('0xb'));var _=require(_0x2ef2('0xc'));var squel=require('squel');var crypto=require(_0x2ef2('0xd'));var jsforce=require(_0x2ef2('0xe'));var deskjs=require(_0x2ef2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ef2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2ef2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef2('0x12'));var hardwareService=require(_0x2ef2('0x13'));var logger=require(_0x2ef2('0x14'))(_0x2ef2('0x15'));var utils=require('../../config/utils');var config=require(_0x2ef2('0x16'));var licenseUtil=require(_0x2ef2('0x17'));var db=require(_0x2ef2('0x18'))['db'];config['redis']=_[_0x2ef2('0x19')](config[_0x2ef2('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ef2('0x1b'))(new Redis(config[_0x2ef2('0x1a')]));require(_0x2ef2('0x1c'))[_0x2ef2('0x1d')](socket);var jayson=require(_0x2ef2('0x1e'));var client=jayson['client'][_0x2ef2('0x1f')]({'port':0x232c});var client9002=jayson[_0x2ef2('0x20')][_0x2ef2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x444a26,_0x67f69f,_0xfc2cf7,_0x592440){return new BPromise(function(_0x455f5d,_0x53b52d){var _0x3b6064=_0x592440||client;return _0x3b6064[_0x2ef2('0x21')](_0x444a26,_0xfc2cf7)[_0x2ef2('0x22')](function(_0x182e60){logger[_0x2ef2('0x23')](_0x2ef2('0x24'),_0x67f69f,_0x2ef2('0x25'));logger[_0x2ef2('0x26')](_0x2ef2('0x27'),_0x67f69f,_0x2ef2('0x25'),JSON[_0x2ef2('0x28')](_0x182e60));if(_0x182e60['error']){if(_0x182e60[_0x2ef2('0x29')]['code']===0x1f4){logger['error'](_0x2ef2('0x24'),_0x67f69f,_0x182e60[_0x2ef2('0x29')][_0x2ef2('0x2a')]);return _0x53b52d(_0x182e60[_0x2ef2('0x29')]['message']);}logger[_0x2ef2('0x29')](_0x2ef2('0x24'),_0x67f69f,_0x182e60[_0x2ef2('0x29')]['message']);return _0x455f5d(_0x182e60[_0x2ef2('0x29')][_0x2ef2('0x2a')]);}else{logger[_0x2ef2('0x23')](_0x2ef2('0x24'),_0x67f69f,_0x2ef2('0x25'));_0x455f5d(_0x182e60[_0x2ef2('0x2b')][_0x2ef2('0x2a')]);}})[_0x2ef2('0x2c')](function(_0x569da5){logger[_0x2ef2('0x29')](_0x2ef2('0x24'),_0x67f69f,_0x569da5);_0x53b52d(_0x569da5);});});}function respondWithStatusCode(_0x54ee07,_0x2fbb03){_0x2fbb03=_0x2fbb03||0xcc;return function(_0x3ab078){if(_0x3ab078){return _0x54ee07['sendStatus'](_0x2fbb03);}return _0x54ee07[_0x2ef2('0x2d')](_0x2fbb03)[_0x2ef2('0x2e')]();};}function respondWithResult(_0x50c465,_0x54fb79){_0x54fb79=_0x54fb79||0xc8;return function(_0x3041ad){if(_0x3041ad){return _0x50c465[_0x2ef2('0x2d')](_0x54fb79)[_0x2ef2('0x2f')](_0x3041ad);}};}function respondWithFilteredResult(_0x2bee29,_0x4b3a11){return function(_0x394368){if(_0x394368){var _0x47ccdc=typeof _0x4b3a11[_0x2ef2('0x30')]===_0x2ef2('0x31')&&typeof _0x4b3a11[_0x2ef2('0x32')]==='undefined';var _0x2cca7d=_0x394368[_0x2ef2('0x33')];var _0x5f31a3=_0x47ccdc?0x0:_0x4b3a11[_0x2ef2('0x30')];var _0x242c6f=_0x47ccdc?_0x394368[_0x2ef2('0x33')]:_0x4b3a11['offset']+_0x4b3a11[_0x2ef2('0x32')];var _0x5c4898;if(_0x242c6f>=_0x2cca7d){_0x242c6f=_0x2cca7d;_0x5c4898=0xc8;}else{_0x5c4898=0xce;}_0x2bee29[_0x2ef2('0x2d')](_0x5c4898);return _0x2bee29[_0x2ef2('0x34')](_0x2ef2('0x35'),_0x5f31a3+'-'+_0x242c6f+'/'+_0x2cca7d)[_0x2ef2('0x2f')](_0x394368);}return null;};}function patchUpdates(_0x2ff7e0){return function(_0x5903af){try{jsonpatch[_0x2ef2('0x36')](_0x5903af,_0x2ff7e0,!![]);}catch(_0x1e46cf){return BPromise['reject'](_0x1e46cf);}return _0x5903af[_0x2ef2('0x37')]();};}function saveUpdates(_0xf4ba14,_0x57117c){return function(_0x4dad29){if(_0x4dad29){return _0x4dad29[_0x2ef2('0x38')](_0xf4ba14)[_0x2ef2('0x22')](function(_0x3da1e9){return _0x3da1e9;});}return null;};}function removeEntity(_0x4ece92,_0x548467){return function(_0x257858){if(_0x257858){return _0x257858[_0x2ef2('0x39')]()['then'](function(){_0x4ece92[_0x2ef2('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42475a,_0x41122a){return function(_0x24235d){if(!_0x24235d){_0x42475a[_0x2ef2('0x3a')](0x194);}return _0x24235d;};}function handleError(_0x206f53,_0x7c09d4){_0x7c09d4=_0x7c09d4||0x1f4;return function(_0x3af115){logger['error'](_0x3af115[_0x2ef2('0x3b')]);if(_0x3af115['name']){delete _0x3af115['name'];}_0x206f53[_0x2ef2('0x2d')](_0x7c09d4)['send'](_0x3af115);};}exports['index']=function(_0x329792,_0x10c302){var _0x4ebcc3={},_0x1934eb={},_0x26ba17={'count':0x0,'rows':[]};var _0x435b44=_[_0x2ef2('0x3c')](db['WhatsappMessage']['rawAttributes'],function(_0x28ea5a){return{'name':_0x28ea5a[_0x2ef2('0x3d')],'type':_0x28ea5a[_0x2ef2('0x3e')]['key']};});_0x1934eb[_0x2ef2('0x3f')]=_['map'](_0x435b44,_0x2ef2('0x40'));_0x1934eb[_0x2ef2('0x41')]=_[_0x2ef2('0x42')](_0x329792[_0x2ef2('0x41')]);_0x1934eb[_0x2ef2('0x43')]=_['intersection'](_0x1934eb[_0x2ef2('0x3f')],_0x1934eb[_0x2ef2('0x41')]);_0x4ebcc3['attributes']=_[_0x2ef2('0x44')](_0x1934eb[_0x2ef2('0x3f')],qs[_0x2ef2('0x45')](_0x329792[_0x2ef2('0x41')]['fields']));_0x4ebcc3['attributes']=_0x4ebcc3[_0x2ef2('0x46')]['length']?_0x4ebcc3[_0x2ef2('0x46')]:_0x1934eb[_0x2ef2('0x3f')];if(!_0x329792[_0x2ef2('0x41')][_0x2ef2('0x47')](_0x2ef2('0x48'))){_0x4ebcc3[_0x2ef2('0x32')]=qs['limit'](_0x329792[_0x2ef2('0x41')]['limit']);_0x4ebcc3[_0x2ef2('0x30')]=qs[_0x2ef2('0x30')](_0x329792['query'][_0x2ef2('0x30')]);}_0x4ebcc3[_0x2ef2('0x49')]=qs[_0x2ef2('0x4a')](_0x329792[_0x2ef2('0x41')][_0x2ef2('0x4a')]);_0x4ebcc3[_0x2ef2('0x4b')]=qs[_0x2ef2('0x43')](_[_0x2ef2('0x4c')](_0x329792[_0x2ef2('0x41')],_0x1934eb[_0x2ef2('0x43')]),_0x435b44);if(_0x329792[_0x2ef2('0x41')]['filter']){_0x4ebcc3['where']=_[_0x2ef2('0x4d')](_0x4ebcc3[_0x2ef2('0x4b')],{'$or':_['map'](_0x435b44,function(_0x5324c5){if(_0x5324c5[_0x2ef2('0x3e')]!==_0x2ef2('0x4e')){var _0x36a171={};_0x36a171[_0x5324c5[_0x2ef2('0x40')]]={'$like':'%'+_0x329792[_0x2ef2('0x41')][_0x2ef2('0x4f')]+'%'};return _0x36a171;}})});}_0x4ebcc3=_[_0x2ef2('0x4d')]({},_0x4ebcc3,_0x329792['options']);var _0x45ff0d={'where':_0x4ebcc3[_0x2ef2('0x4b')]};return db[_0x2ef2('0x50')]['count'](_0x45ff0d)[_0x2ef2('0x22')](function(_0x2eec08){_0x26ba17[_0x2ef2('0x33')]=_0x2eec08;if(_0x329792[_0x2ef2('0x41')][_0x2ef2('0x51')]){_0x4ebcc3[_0x2ef2('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x2ef2('0x53')](_0x4ebcc3);})[_0x2ef2('0x22')](function(_0x1d61f8){_0x26ba17[_0x2ef2('0x54')]=_0x1d61f8;return _0x26ba17;})[_0x2ef2('0x22')](respondWithFilteredResult(_0x10c302,_0x4ebcc3))[_0x2ef2('0x2c')](handleError(_0x10c302,null));};exports[_0x2ef2('0x55')]=function(_0x346a51,_0x1fd6fd){var _0x479448={'raw':!![],'where':{'id':_0x346a51['params']['id']}},_0x45b3af={};_0x45b3af[_0x2ef2('0x3f')]=_['keys'](db[_0x2ef2('0x50')][_0x2ef2('0x56')]);_0x45b3af[_0x2ef2('0x41')]=_[_0x2ef2('0x42')](_0x346a51['query']);_0x45b3af[_0x2ef2('0x43')]=_[_0x2ef2('0x44')](_0x45b3af[_0x2ef2('0x3f')],_0x45b3af[_0x2ef2('0x41')]);_0x479448[_0x2ef2('0x46')]=_[_0x2ef2('0x44')](_0x45b3af['model'],qs[_0x2ef2('0x45')](_0x346a51[_0x2ef2('0x41')][_0x2ef2('0x45')]));_0x479448[_0x2ef2('0x46')]=_0x479448[_0x2ef2('0x46')][_0x2ef2('0x57')]?_0x479448[_0x2ef2('0x46')]:_0x45b3af[_0x2ef2('0x3f')];if(_0x346a51['query'][_0x2ef2('0x51')]){_0x479448['include']=[{'all':!![]}];}_0x479448=_[_0x2ef2('0x4d')]({},_0x479448,_0x346a51[_0x2ef2('0x58')]);return db[_0x2ef2('0x50')][_0x2ef2('0x59')](_0x479448)[_0x2ef2('0x22')](handleEntityNotFound(_0x1fd6fd,null))[_0x2ef2('0x22')](respondWithResult(_0x1fd6fd,null))[_0x2ef2('0x2c')](handleError(_0x1fd6fd,null));};exports[_0x2ef2('0x5a')]=function(_0x46d6d7,_0x143c7d){return db['WhatsappMessage'][_0x2ef2('0x5a')](_0x46d6d7[_0x2ef2('0x5b')],{})[_0x2ef2('0x22')](respondWithResult(_0x143c7d,0xc9))[_0x2ef2('0x2c')](handleError(_0x143c7d,null));};exports['update']=function(_0x9c7d37,_0x787145){if(_0x9c7d37[_0x2ef2('0x5b')]['id']){delete _0x9c7d37['body']['id'];}return db[_0x2ef2('0x50')][_0x2ef2('0x59')]({'where':{'id':_0x9c7d37[_0x2ef2('0x5c')]['id']}})[_0x2ef2('0x22')](handleEntityNotFound(_0x787145,null))[_0x2ef2('0x22')](saveUpdates(_0x9c7d37[_0x2ef2('0x5b')],null))[_0x2ef2('0x22')](respondWithResult(_0x787145,null))[_0x2ef2('0x2c')](handleError(_0x787145,null));};exports[_0x2ef2('0x39')]=function(_0x293f7e,_0x737b8d){return db['WhatsappMessage'][_0x2ef2('0x59')]({'where':{'id':_0x293f7e[_0x2ef2('0x5c')]['id']}})[_0x2ef2('0x22')](handleEntityNotFound(_0x737b8d,null))[_0x2ef2('0x22')](removeEntity(_0x737b8d,null))[_0x2ef2('0x2c')](handleError(_0x737b8d,null));};exports[_0x2ef2('0x5d')]=function(_0x514b0f,_0x3d757f){return db['WhatsappMessage'][_0x2ef2('0x5d')]()['then'](respondWithResult(_0x3d757f,null))[_0x2ef2('0x2c')](handleError(_0x3d757f,null));};var interaction_log=require(_0x2ef2('0x14'))(_0x2ef2('0x5e'));exports[_0x2ef2('0x5f')]=function(_0x513948,_0x2f5084,_0x48fc23){var _0x216457={'agent':{},'channel':_0x2ef2('0x60')};if(_0x513948[_0x2ef2('0x5b')]['id']){delete _0x513948[_0x2ef2('0x5b')]['id'];}_0x513948['body'][_0x2ef2('0x61')]=!![];_0x513948[_0x2ef2('0x5b')][_0x2ef2('0x62')]=moment()[_0x2ef2('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x513948['body'][_0x2ef2('0x64')]=_0x513948[_0x2ef2('0x5b')]['UserId']||_0x513948['user']['id'];_0x216457[_0x2ef2('0x65')]['id']=_0x513948[_0x2ef2('0x5b')][_0x2ef2('0x64')];return db[_0x2ef2('0x50')][_0x2ef2('0x59')]({'where':{'id':_0x513948[_0x2ef2('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f5084,null))['then'](saveUpdates(_0x513948['body'],null))[_0x2ef2('0x22')](function(_0x3bd587){if(_0x3bd587){_0x216457[_0x2ef2('0x2a')]=_0x3bd587[_0x2ef2('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x2ef2('0x59')]({'where':{'id':_0x3bd587[_0x2ef2('0x67')]}});}return null;})[_0x2ef2('0x22')](handleEntityNotFound(_0x2f5084,null))[_0x2ef2('0x22')](function(_0x24373e){if(_0x24373e){return _0x24373e['update']({'UserId':_0x513948['body']['UserId'],'read1stAt':_[_0x2ef2('0x68')](_0x24373e['read1stAt'])?moment()[_0x2ef2('0x63')](_0x2ef2('0x69')):undefined});}return null;})[_0x2ef2('0x22')](function(_0x27e243){if(_0x27e243){_0x216457['interaction']=_0x27e243[_0x2ef2('0x66')]({'plain':!![]});interaction_log[_0x2ef2('0x23')](_0x2ef2('0x6a'),_0x513948[_0x2ef2('0x6b')]['id'],_0x513948[_0x2ef2('0x6b')][_0x2ef2('0x40')],_0x513948[_0x2ef2('0x6b')][_0x2ef2('0x6c')],_0x216457[_0x2ef2('0x6d')]['id'],_0x513948['body']?JSON[_0x2ef2('0x28')](_0x513948[_0x2ef2('0x5b')]):_0x2ef2('0x6e'));return respondWithRpcPromise(_0x2ef2('0x6f'),_0x2ef2('0x70'),_0x216457);}return null;})[_0x2ef2('0x22')](function(_0x3f779f){var _0xeeb109=_0x2ef2('0x71')+_0x3f779f['message'][_0x2ef2('0x72')];return db[_0x2ef2('0x73')][_0x2ef2('0x41')](_0xeeb109,{'type':db[_0x2ef2('0x74')][_0x2ef2('0x75')][_0x2ef2('0x76')],'raw':!![]})[_0x2ef2('0x22')](function(_0x46ecdc){return _0x46ecdc;});})[_0x2ef2('0x22')](function(_0x31a090){if(_0x31a090){_0x216457[_0x2ef2('0x2a')][_0x2ef2('0x77')]=_0x31a090[0x0];if(!_0x513948[_0x2ef2('0x5b')]['UserId'])return;return db[_0x2ef2('0x78')]['find']({'where':{'id':_0x513948[_0x2ef2('0x5b')][_0x2ef2('0x64')],'role':_0x2ef2('0x65')},'attributes':['id',_0x2ef2('0x40'),'fullname',_0x2ef2('0x79'),_0x2ef2('0x7a')],'raw':!![]});}return null;})[_0x2ef2('0x22')](function(_0x1fb36b){if(!_0x1fb36b)return null;_0x216457[_0x2ef2('0x2a')][_0x2ef2('0x65')]=_0x1fb36b;return _0x216457;})['then'](function(_0x411652){if(_0x411652){if(_0x513948[_0x2ef2('0x5b')][_0x2ef2('0x7b')]){_0x216457[_0x2ef2('0x2a')][_0x2ef2('0x7c')]=util['format'](_0x2ef2('0x7d'),_0x513948['user']['name']);_0x216457[_0x2ef2('0x2a')]['channel']=_0x216457[_0x2ef2('0x7e')];_0x216457[_0x2ef2('0x2a')]['motionChannel']=_0x216457['channel'];_0x216457[_0x2ef2('0x2a')]['event']=_0x2ef2('0x5f');return respondWithRpcPromise(_0x2ef2('0x7f'),_0x2ef2('0x7f'),{'event':'acceptmessage','message':_0x216457['message']},client9002)[_0x2ef2('0x22')](function(){return _0x216457;});}return _0x216457;}return null;})[_0x2ef2('0x22')](respondWithResult(_0x2f5084,null))[_0x2ef2('0x2c')](handleError(_0x2f5084,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x2ef2('0x80')]=function(_0x43d119,_0x2c3a2b,_0x725ae7){var _0x25be89={'agent':{},'channel':_0x2ef2('0x60')};if(_0x43d119['body']['id']){delete _0x43d119[_0x2ef2('0x5b')]['id'];}_0x43d119[_0x2ef2('0x5b')]['UserId']=_0x43d119[_0x2ef2('0x5b')][_0x2ef2('0x64')]||_0x43d119['user']['id'];_0x25be89[_0x2ef2('0x65')]['id']=_0x43d119[_0x2ef2('0x5b')][_0x2ef2('0x64')];return db[_0x2ef2('0x50')][_0x2ef2('0x59')]({'where':{'id':_0x43d119[_0x2ef2('0x5c')]['id'],'UserId':null}})[_0x2ef2('0x22')](handleEntityNotFound(_0x2c3a2b,null))[_0x2ef2('0x22')](function(_0x49708e){if(_0x49708e){_0x25be89['message']=_0x49708e[_0x2ef2('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x49708e['WhatsappInteractionId']}});}return null;})[_0x2ef2('0x22')](handleEntityNotFound(_0x2c3a2b,null))['then'](function(_0x11ceef){if(_0x11ceef){_0x25be89[_0x2ef2('0x6d')]=_0x11ceef[_0x2ef2('0x66')]({'plain':!![]});interaction_log[_0x2ef2('0x23')](_0x2ef2('0x81'),_0x43d119[_0x2ef2('0x6b')]['id'],_0x43d119[_0x2ef2('0x6b')][_0x2ef2('0x40')],_0x43d119[_0x2ef2('0x6b')][_0x2ef2('0x6c')],_0x25be89[_0x2ef2('0x6d')]['id'],_0x43d119[_0x2ef2('0x5b')]?JSON[_0x2ef2('0x28')](_0x43d119[_0x2ef2('0x5b')]):_0x2ef2('0x6e'));return respondWithRpcPromise(_0x2ef2('0x82'),_0x2ef2('0x83'),_0x25be89);}return null;})[_0x2ef2('0x22')](function(_0x380927){var _0x5d0a84=_0x2ef2('0x71')+_0x380927['message'][_0x2ef2('0x72')];return db[_0x2ef2('0x73')][_0x2ef2('0x41')](_0x5d0a84,{'type':db['Sequelize'][_0x2ef2('0x75')][_0x2ef2('0x76')],'raw':!![]})[_0x2ef2('0x22')](function(_0x108454){return _0x108454;});})['then'](function(_0x231699){if(_0x231699){_0x25be89['message']['contact']=_0x231699[0x0];if(!_0x43d119['body'][_0x2ef2('0x64')])return;return db[_0x2ef2('0x78')][_0x2ef2('0x59')]({'where':{'id':_0x43d119[_0x2ef2('0x5b')][_0x2ef2('0x64')],'role':'agent'},'attributes':['id',_0x2ef2('0x40'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x2ef2('0x22')](function(_0x33fde2){if(!_0x33fde2)return null;_0x25be89[_0x2ef2('0x2a')][_0x2ef2('0x65')]=_0x33fde2;return _0x25be89;})[_0x2ef2('0x22')](function(_0x24605e){if(_0x24605e){_0x24605e[_0x2ef2('0x2a')]['interface']=util[_0x2ef2('0x63')](_0x2ef2('0x7d'),_0x43d119['user']['name']);_0x24605e[_0x2ef2('0x2a')][_0x2ef2('0x7e')]=_0x25be89[_0x2ef2('0x7e')];_0x24605e[_0x2ef2('0x2a')][_0x2ef2('0x84')]=_0x25be89[_0x2ef2('0x7e')];_0x24605e[_0x2ef2('0x2a')][_0x2ef2('0x85')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x2ef2('0x86'),'message':_0x24605e['message']},client9002);return _0x25be89;}return null;})[_0x2ef2('0x22')](respondWithResult(_0x2c3a2b,null))['catch'](handleError(_0x2c3a2b,null));};exports[_0x2ef2('0x2d')]=function(_0x49160e,_0x195538,_0xb23205){if(_0x49160e['body']['id']){delete _0x49160e[_0x2ef2('0x5b')]['id'];}var _0x3913a8;return db[_0x2ef2('0x50')]['find']({'where':{'id':_0x49160e[_0x2ef2('0x5c')]['id']}})[_0x2ef2('0x22')](handleEntityNotFound(_0x195538,null))[_0x2ef2('0x22')](function(_0x4e1eca){if(_0x4e1eca){_0x3913a8=_0x4e1eca;return db[_0x2ef2('0x87')]['find']({'where':{'id':_0x4e1eca[_0x2ef2('0x88')]}});}})[_0x2ef2('0x22')](handleEntityNotFound(_0x195538,null))[_0x2ef2('0x22')](function(_0x197212){if(_0x197212){logger[_0x2ef2('0x26')](_0x2ef2('0x89'),_0x2ef2('0x2d'),'received\x20delivery\x20report\x20from',_0x197212[_0x2ef2('0x3e')],util[_0x2ef2('0x8a')](_0x49160e['body'],{'showHidden':![],'depth':null}));switch(_0x197212['type']){case _0x2ef2('0x8b'):if(_0x49160e[_0x2ef2('0x5b')][_0x2ef2('0x8c')]&&_0x49160e[_0x2ef2('0x5b')][_0x2ef2('0x8c')]===_0x3913a8[_0x2ef2('0x8d')]&&_0x49160e[_0x2ef2('0x5b')][_0x2ef2('0x8e')]&&_0x49160e[_0x2ef2('0x5b')][_0x2ef2('0x8e')]===_0x2ef2('0x61')){return _0x3913a8['update']({'read':!![]});}else{logger[_0x2ef2('0x29')](_0x2ef2('0x8f'),_0x2ef2('0x2d'),_0x2ef2('0x8b'),util[_0x2ef2('0x8a')](_0x49160e[_0x2ef2('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x3913a8;}})[_0x2ef2('0x22')](respondWithResult(_0x195538,null))['catch'](handleError(_0x195538,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a7e42cb..5d47fd3 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 _0xde2c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xde2c,0x7f));var _0xcde2=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xde2c[_0x4232d8];return _0x324de2;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var WhatsappMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':_0xcde2('0x5'),'afterDestroy':_0xcde2('0x6')};function emitEvent(_0x3a309f){return function(_0x55c175,_0x4353c8,_0x196898){WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f+':'+_0x55c175['id'],_0x55c175);WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f,_0x55c175);_0x196898(null);};}for(var e in events){if(events[_0xcde2('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xcde2('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4fc2=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x4fc2,0x111));var _0x24fc=function(_0x2eb4c0,_0x5806ec){_0x2eb4c0=_0x2eb4c0-0x0;var _0x272172=_0x4fc2[_0x2eb4c0];return _0x272172;};'use strict';var EventEmitter=require(_0x24fc('0x0'));var WhatsappMessage=require(_0x24fc('0x1'))['db'][_0x24fc('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x24fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x24fc('0x4'),'afterDestroy':_0x24fc('0x5')};function emitEvent(_0x1e7fdf){return function(_0x541ad2,_0x126d90,_0x3772eb){WhatsappMessageEvents['emit'](_0x1e7fdf+':'+_0x541ad2['id'],_0x541ad2);WhatsappMessageEvents[_0x24fc('0x6')](_0x1e7fdf,_0x541ad2);_0x3772eb(null);};}for(var e in events){if(events[_0x24fc('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x24fc('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 36c71d0..5b23057 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 _0xcc4c=['baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','lodash','util','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0xcc4c,0x1e4));var _0xccc4=function(_0x26e6e5,_0x2c16ae){_0x26e6e5=_0x26e6e5-0x0;var _0x5ea5b8=_0xcc4c[_0x26e6e5];return _0x5ea5b8;};'use strict';var _=require(_0xccc4('0x0'));var util=require(_0xccc4('0x1'));var logger=require(_0xccc4('0x2'))('api');var moment=require(_0xccc4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xccc4('0x4'));var fs=require('fs');var path=require(_0xccc4('0x5'));var rimraf=require(_0xccc4('0x6'));var config=require(_0xccc4('0x7'));var attributes=require(_0xccc4('0x8'));module['exports']=function(_0x4478b0,_0x57ad42){return _0x4478b0[_0xccc4('0x9')](_0xccc4('0xa'),attributes,{'tableName':_0xccc4('0xb'),'paranoid':![],'indexes':[{'name':_0xccc4('0xc'),'fields':['messageId']},{'name':_0xccc4('0xd'),'fields':[_0xccc4('0xe')],'type':_0xccc4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31d19f,_0x5726ec,_0x5697b9){var _0x205112=_0x4478b0[_0xccc4('0x10')];var _0x2febce=_0x31d19f[_0xccc4('0x11')]({'plain':!![]});if(_0x2febce[_0xccc4('0x12')][_0xccc4('0x13')]()==='in'||_0x2febce[_0xccc4('0x12')]['toLowerCase']()==='out'&&!_0x2febce[_0xccc4('0x14')]&&!_[_0xccc4('0x15')](_0x2febce['UserId'])){_0x205112[_0xccc4('0x16')][_0xccc4('0x17')]({'where':{'id':_0x2febce['WhatsappInteractionId']}})[_0xccc4('0x18')](function(_0x44a0d3){if(_0x44a0d3){_0x44a0d3[_0xccc4('0x19')]({'lastMsgAt':_0x2febce[_0xccc4('0x1a')],'lastMsgDirection':_0x2febce[_0xccc4('0x12')]['toLowerCase']()});}})['catch'](function(_0x254982){console[_0xccc4('0x1b')](_0x254982);});}if(_0x2febce[_0xccc4('0x12')]==='out'&&!_0x2febce[_0xccc4('0x14')]){var _0x5cf51f;_0x205112[_0xccc4('0x1c')][_0xccc4('0x1d')]({'where':{'id':_0x2febce[_0xccc4('0x1e')]},'raw':!![]})['then'](function(_0x1cfd80){_0x5cf51f=_0x1cfd80;if(_0x5cf51f&&_0x5cf51f[_0xccc4('0x1f')]){switch(_0x5cf51f[_0xccc4('0x1f')]){case'twilio':var _0x26a735=require(_0xccc4('0x20'));if(_0x5cf51f[_0xccc4('0x21')]&&_0x5cf51f['authToken']&&_0x5cf51f[_0xccc4('0x22')]){var _0x562fd5=new _0x26a735(_0x5cf51f[_0xccc4('0x21')],_0x5cf51f[_0xccc4('0x23')]);_0x562fd5[_0xccc4('0x24')][_0xccc4('0x25')]({'body':_0x2febce['body'],'to':'whatsapp:'+_0x2febce[_0xccc4('0x22')],'from':_0xccc4('0x26')+_0x5cf51f['phone'],'statusCallback':_0x5cf51f['remote']+'/api/whatsapp/messages/'+_0x2febce['id']+_0xccc4('0x27')+_0x5cf51f[_0xccc4('0x28')]})[_0xccc4('0x18')](function(_0x397166){if(_0x397166['sid']){return _0x31d19f[_0xccc4('0x19')]({'messageId':_0x397166[_0xccc4('0x29')]});}})['catch'](function(_0x875be0){logger[_0xccc4('0x1b')](_0xccc4('0x2a'),_0xccc4('0x2b'),_0xccc4('0x20'),util[_0xccc4('0x2c')](_0x875be0,{'showHidden':![],'depth':null}));});}else{logger[_0xccc4('0x1b')](_0xccc4('0x2a'),_0xccc4('0x2b'),_0xccc4('0x20'),_0xccc4('0x2d'));}break;case _0xccc4('0x2e'):var _0x11c7ba=_0x5cf51f[_0xccc4('0x21')];var _0x2ea8dd=_0x5cf51f[_0xccc4('0x23')];var _0x4e53f4=_0x5cf51f[_0xccc4('0x2f')]+_0xccc4('0x30')+_0x11c7ba+_0xccc4('0x31');var _0x4c044a={'to':[_0x2febce['phone']],'message':{'type':_0xccc4('0x32'),'text':_0x2febce[_0xccc4('0xe')]}};var _0x4c7dda={'method':_0xccc4('0x33'),'uri':_0x4e53f4,'headers':{'Authorization':'Bearer\x20'+_0x2ea8dd,'Content-Type':_0xccc4('0x34')},'body':_0x4c044a,'json':!![]};rp(_0x4c7dda)[_0xccc4('0x18')](function(_0xff11c9){if(_0xff11c9[_0xccc4('0x35')][0x0]['message_id']){return _0x31d19f[_0xccc4('0x19')]({'messageId':_0xff11c9[_0xccc4('0x35')][0x0][_0xccc4('0x36')]});}})[_0xccc4('0x37')](function(_0x691803){logger[_0xccc4('0x38')](_0xccc4('0x39'),_0x691803);});break;}}})['finally'](function(){_0x5697b9();});}else{_0x5697b9();}}},'charset':_0xccc4('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ba3=['moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x1576ce,_0x56ad54){var _0x494c06=function(_0x33e771){while(--_0x33e771){_0x1576ce['push'](_0x1576ce['shift']());}};_0x494c06(++_0x56ad54);}(_0x8ba3,0x1b0));var _0x38ba=function(_0x1697f9,_0x931814){_0x1697f9=_0x1697f9-0x0;var _0x1e2264=_0x8ba3[_0x1697f9];return _0x1e2264;};'use strict';var _=require('lodash');var util=require(_0x38ba('0x0'));var logger=require(_0x38ba('0x1'))('api');var moment=require(_0x38ba('0x2'));var BPromise=require(_0x38ba('0x3'));var rp=require(_0x38ba('0x4'));var fetch=require(_0x38ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38ba('0x6'));var config=require(_0x38ba('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x38ba('0x8')]=function(_0x5004a1,_0x40e313){return _0x5004a1[_0x38ba('0x9')](_0x38ba('0xa'),attributes,{'tableName':_0x38ba('0xb'),'paranoid':![],'indexes':[{'name':_0x38ba('0xc'),'fields':['messageId']},{'name':_0x38ba('0xd'),'fields':[_0x38ba('0xe')],'type':_0x38ba('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31b521,_0x4ea42b,_0x2a2587){var _0x211723=_0x5004a1[_0x38ba('0x10')];var _0x89e873=_0x31b521[_0x38ba('0x11')]({'plain':!![]});if(_0x89e873[_0x38ba('0x12')][_0x38ba('0x13')]()==='in'||_0x89e873[_0x38ba('0x12')]['toLowerCase']()===_0x38ba('0x14')&&!_0x89e873[_0x38ba('0x15')]&&!_[_0x38ba('0x16')](_0x89e873['UserId'])){_0x211723[_0x38ba('0x17')][_0x38ba('0x18')]({'where':{'id':_0x89e873['WhatsappInteractionId']}})[_0x38ba('0x19')](function(_0x3c7ae7){if(_0x3c7ae7){_0x3c7ae7['update']({'lastMsgAt':_0x89e873[_0x38ba('0x1a')],'lastMsgDirection':_0x89e873[_0x38ba('0x12')]['toLowerCase']()});}})[_0x38ba('0x1b')](function(_0x30c2f2){console[_0x38ba('0x1c')](_0x30c2f2);});}if(_0x89e873['direction']==='out'&&!_0x89e873[_0x38ba('0x15')]){var _0x246c3e;_0x211723[_0x38ba('0x1d')][_0x38ba('0x1e')]({'where':{'id':_0x89e873[_0x38ba('0x1f')]},'raw':!![]})[_0x38ba('0x19')](function(_0x624b7f){_0x246c3e=_0x624b7f;if(_0x246c3e&&_0x246c3e[_0x38ba('0x20')]){switch(_0x246c3e[_0x38ba('0x20')]){case _0x38ba('0x21'):var _0x32ee38=require(_0x38ba('0x21'));if(_0x246c3e[_0x38ba('0x22')]&&_0x246c3e['authToken']&&_0x246c3e[_0x38ba('0x23')]){var _0xa6121=new _0x32ee38(_0x246c3e[_0x38ba('0x22')],_0x246c3e[_0x38ba('0x24')]);_0xa6121[_0x38ba('0x25')][_0x38ba('0x26')]({'body':_0x89e873['body'],'to':'whatsapp:'+_0x89e873[_0x38ba('0x23')],'from':_0x38ba('0x27')+_0x246c3e['phone'],'statusCallback':_0x246c3e[_0x38ba('0x28')]+_0x38ba('0x29')+_0x89e873['id']+_0x38ba('0x2a')+_0x246c3e['token']})[_0x38ba('0x19')](function(_0x5708f2){if(_0x5708f2[_0x38ba('0x2b')]){return _0x31b521['update']({'messageId':_0x5708f2[_0x38ba('0x2b')]});}})['catch'](function(_0xb2c050){logger[_0x38ba('0x1c')](_0x38ba('0x2c'),_0x38ba('0x2d'),'twilio',util['inspect'](_0xb2c050,{'showHidden':![],'depth':null}));});}else{logger[_0x38ba('0x1c')](_0x38ba('0x2c'),_0x38ba('0x2d'),_0x38ba('0x21'),_0x38ba('0x2e'));}break;case _0x38ba('0x2f'):var _0x1c20bd=_0x246c3e[_0x38ba('0x22')];var _0x496b91=_0x246c3e[_0x38ba('0x24')];var _0x1f445f=_0x246c3e[_0x38ba('0x30')]+_0x38ba('0x31')+_0x1c20bd+_0x38ba('0x32');var _0x3fa93d={'to':[_0x89e873[_0x38ba('0x23')]],'message':{'type':_0x38ba('0x33'),'text':_0x89e873['body']}};var _0x716071={'method':_0x38ba('0x34'),'uri':_0x1f445f,'headers':{'Authorization':_0x38ba('0x35')+_0x496b91,'Content-Type':_0x38ba('0x36')},'body':_0x3fa93d,'json':!![]};rp(_0x716071)[_0x38ba('0x19')](function(_0x855a24){if(_0x855a24[_0x38ba('0x37')][0x0][_0x38ba('0x38')]){return _0x31b521['update']({'messageId':_0x855a24[_0x38ba('0x37')][0x0]['message_id']});}})[_0x38ba('0x1b')](function(_0x55fea3){logger[_0x38ba('0x39')](_0x38ba('0x3a'),_0x55fea3);});break;}}})[_0x38ba('0x3b')](function(){_0x2a2587();});}else{_0x2a2587();}}},'charset':_0x38ba('0x3c'),'collate':_0x38ba('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0c4842f..e6da80d 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 _0x384e=['CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x384e,0x89));var _0xe384=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x384e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe384('0x0'));var util=require(_0xe384('0x1'));var moment=require(_0xe384('0x2'));var BPromise=require(_0xe384('0x3'));var rs=require(_0xe384('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe384('0x5'))['db'];var utils=require(_0xe384('0x6'));var logger=require(_0xe384('0x7'))('rpc');var config=require(_0xe384('0x8'));var jayson=require(_0xe384('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe384('0xa')]=_['defaults'](config['redis'],{'host':_0xe384('0xb'),'port':0x18eb});var socket=require(_0xe384('0xc'))(new Redis(config[_0xe384('0xa')]));require(_0xe384('0xd'))[_0xe384('0xe')](socket);function respondWithRpcPromise(_0x4d0fe3,_0x5d9ea1,_0x3fa4c8){return new BPromise(function(_0x297b90,_0x4cac59){return client[_0xe384('0xf')](_0x4d0fe3,_0x3fa4c8)[_0xe384('0x10')](function(_0x3ed091){logger[_0xe384('0x11')](_0xe384('0x12'),_0x5d9ea1,'request\x20sent');logger[_0xe384('0x13')](_0xe384('0x14'),_0x5d9ea1,'request\x20sent',JSON[_0xe384('0x15')](_0x3ed091));if(_0x3ed091['error']){if(_0x3ed091[_0xe384('0x16')][_0xe384('0x17')]===0x1f4){logger['error'](_0xe384('0x12'),_0x5d9ea1,_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);return _0x4cac59(_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);}logger['error'](_0xe384('0x12'),_0x5d9ea1,_0x3ed091['error'][_0xe384('0x18')]);return _0x297b90(_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);}else{logger[_0xe384('0x11')](_0xe384('0x12'),_0x5d9ea1,_0xe384('0x19'));_0x297b90(_0x3ed091[_0xe384('0x1a')][_0xe384('0x18')]);}})[_0xe384('0x1b')](function(_0x3b4f67){logger[_0xe384('0x16')](_0xe384('0x12'),_0x5d9ea1,_0x3b4f67);_0x4cac59(_0x3b4f67);});});}exports[_0xe384('0x1c')]=function(_0x4a864f){var _0x3e168b=this;return new Promise(function(_0x4f4103,_0x2d7a7e){return db[_0xe384('0x1d')][_0xe384('0x1e')](_0x4a864f[_0xe384('0x1f')],{'raw':_0x4a864f['options']?_0x4a864f[_0xe384('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xe384('0x10')](function(_0x2dc6fa){logger[_0xe384('0x11')]('CreateWhatsappMessage',_0x4a864f);logger['debug'](_0xe384('0x1c'),_0x4a864f,JSON[_0xe384('0x15')](_0x2dc6fa));_0x4f4103(_0x2dc6fa);})[_0xe384('0x1b')](function(_0x36fcd8){logger[_0xe384('0x16')](_0xe384('0x1c'),_0x36fcd8[_0xe384('0x18')],_0x4a864f);_0x2d7a7e(_0x3e168b[_0xe384('0x16')](0x1f4,_0x36fcd8[_0xe384('0x18')]));});});}; \ No newline at end of file +var _0x6d6b=['localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','catch','CreateWhatsappMessage','WhatsappMessage','create','body','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x2f5fa7,_0x299f74){var _0x459db6=function(_0x9acc6d){while(--_0x9acc6d){_0x2f5fa7['push'](_0x2f5fa7['shift']());}};_0x459db6(++_0x299f74);}(_0x6d6b,0x134));var _0xb6d6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d6b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb6d6('0x0'));var util=require('util');var moment=require(_0xb6d6('0x1'));var BPromise=require(_0xb6d6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6d6('0x3'));var db=require(_0xb6d6('0x4'))['db'];var utils=require(_0xb6d6('0x5'));var logger=require(_0xb6d6('0x6'))(_0xb6d6('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6d6('0x8'));var client=jayson[_0xb6d6('0x9')][_0xb6d6('0xa')]({'port':0x232a});config[_0xb6d6('0xb')]=_['defaults'](config[_0xb6d6('0xb')],{'host':_0xb6d6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6d6('0xb')]));require(_0xb6d6('0xd'))[_0xb6d6('0xe')](socket);function respondWithRpcPromise(_0x256abb,_0x5bda51,_0xf131d3){return new BPromise(function(_0x3af24a,_0x4e91b8){return client[_0xb6d6('0xf')](_0x256abb,_0xf131d3)[_0xb6d6('0x10')](function(_0x4060d4){logger[_0xb6d6('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x5bda51,'request\x20sent');logger['debug'](_0xb6d6('0x12'),_0x5bda51,_0xb6d6('0x13'),JSON[_0xb6d6('0x14')](_0x4060d4));if(_0x4060d4[_0xb6d6('0x15')]){if(_0x4060d4['error'][_0xb6d6('0x16')]===0x1f4){logger[_0xb6d6('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5bda51,_0x4060d4['error'][_0xb6d6('0x17')]);return _0x4e91b8(_0x4060d4[_0xb6d6('0x15')][_0xb6d6('0x17')]);}logger[_0xb6d6('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5bda51,_0x4060d4[_0xb6d6('0x15')]['message']);return _0x3af24a(_0x4060d4[_0xb6d6('0x15')][_0xb6d6('0x17')]);}else{logger['info'](_0xb6d6('0x18'),_0x5bda51,_0xb6d6('0x13'));_0x3af24a(_0x4060d4['result'][_0xb6d6('0x17')]);}})[_0xb6d6('0x19')](function(_0x4e0969){logger[_0xb6d6('0x15')](_0xb6d6('0x18'),_0x5bda51,_0x4e0969);_0x4e91b8(_0x4e0969);});});}exports[_0xb6d6('0x1a')]=function(_0x440572){var _0x225e4b=this;return new Promise(function(_0x1ca486,_0x4243ad){return db[_0xb6d6('0x1b')][_0xb6d6('0x1c')](_0x440572[_0xb6d6('0x1d')],{'raw':_0x440572['options']?_0x440572['options'][_0xb6d6('0x1e')]===undefined?!![]:![]:!![]})[_0xb6d6('0x10')](function(_0x562ec1){logger[_0xb6d6('0x11')](_0xb6d6('0x1a'),_0x440572);logger[_0xb6d6('0x1f')](_0xb6d6('0x1a'),_0x440572,JSON['stringify'](_0x562ec1));_0x1ca486(_0x562ec1);})[_0xb6d6('0x19')](function(_0xed5e3e){logger[_0xb6d6('0x15')](_0xb6d6('0x1a'),_0xed5e3e[_0xb6d6('0x17')],_0x440572);_0x4243ad(_0x225e4b[_0xb6d6('0x15')](0x1f4,_0xed5e3e[_0xb6d6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 127a6f7..377728a 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 _0x9e6a=['./whatsappMessage.events','remove','update','emit','removeListener','length','whatsappMessage:'];(function(_0x107f6c,_0x4ed971){var _0x43e026=function(_0x407fc5){while(--_0x407fc5){_0x107f6c['push'](_0x107f6c['shift']());}};_0x43e026(++_0x4ed971);}(_0x9e6a,0x1d5));var _0xa9e6=function(_0x4a5eee,_0x3dbb21){_0x4a5eee=_0x4a5eee-0x0;var _0x2da7d4=_0x9e6a[_0x4a5eee];return _0x2da7d4;};'use strict';var WhatsappMessageEvents=require(_0xa9e6('0x0'));var events=['save',_0xa9e6('0x1'),_0xa9e6('0x2')];function createListener(_0x4ccc3d,_0x2d6853){return function(_0x547d3f){_0x2d6853[_0xa9e6('0x3')](_0x4ccc3d,_0x547d3f);};}function removeListener(_0x2f53e2,_0x490981){return function(){WhatsappMessageEvents[_0xa9e6('0x4')](_0x2f53e2,_0x490981);};}exports['register']=function(_0x96008f){for(var _0xcacc99=0x0,_0x179e1f=events[_0xa9e6('0x5')];_0xcacc99<_0x179e1f;_0xcacc99++){var _0x45198d=events[_0xcacc99];var _0x46ddef=createListener(_0xa9e6('0x6')+_0x45198d,_0x96008f);WhatsappMessageEvents['on'](_0x45198d,_0x46ddef);}}; \ No newline at end of file +var _0x4db1=['remove','removeListener','register','./whatsappMessage.events','save'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0x4db1,0x116));var _0x14db=function(_0x30f030,_0xd03b7a){_0x30f030=_0x30f030-0x0;var _0xf7614f=_0x4db1[_0x30f030];return _0xf7614f;};'use strict';var WhatsappMessageEvents=require(_0x14db('0x0'));var events=[_0x14db('0x1'),_0x14db('0x2'),'update'];function createListener(_0x12efab,_0x5cc8d4){return function(_0x31e843){_0x5cc8d4['emit'](_0x12efab,_0x31e843);};}function removeListener(_0x3fbd86,_0x1385d0){return function(){WhatsappMessageEvents[_0x14db('0x3')](_0x3fbd86,_0x1385d0);};}exports[_0x14db('0x4')]=function(_0x371b83){for(var _0x4541de=0x0,_0x37a7b9=events['length'];_0x4541de<_0x37a7b9;_0x4541de++){var _0x33ae76=events[_0x4541de];var _0x6a2ef=createListener('whatsappMessage:'+_0x33ae76,_0x371b83);WhatsappMessageEvents['on'](_0x33ae76,_0x6a2ef);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 385af01..f47efb3 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 _0xc9b8=['update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xc9b8,0x1aa));var _0x8c9b=function(_0x23785c,_0x1c6e72){_0x23785c=_0x23785c-0x0;var _0x2dc080=_0xc9b8[_0x23785c];return _0x2dc080;};'use strict';var multer=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var path=require('path');var timeout=require(_0x8c9b('0x2'));var express=require(_0x8c9b('0x3'));var router=express[_0x8c9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c9b('0x6'));var controller=require(_0x8c9b('0x7'));router[_0x8c9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c9b('0x9')]);router[_0x8c9b('0x8')](_0x8c9b('0xa'),auth[_0x8c9b('0xb')](),controller['describe']);router[_0x8c9b('0x8')](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xd')]);router[_0x8c9b('0x8')]('/:id/members',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xe')]);router[_0x8c9b('0x8')](_0x8c9b('0xf'),auth['isAuthenticated'](),controller[_0x8c9b('0x10')]);router[_0x8c9b('0x8')](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller['getAgents']);router[_0x8c9b('0x12')]('/',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x13')]);router['post']('/:id/teams',auth[_0x8c9b('0xb')](),controller['addTeams']);router[_0x8c9b('0x12')](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x14')]);router[_0x8c9b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8c9b('0x16')]);router['delete'](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x17')]);router[_0x8c9b('0x18')](_0x8c9b('0xf'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x19')]);router['delete'](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x1a')]);module[_0x8c9b('0x1b')]=router; \ No newline at end of file +var _0xb1bc=['removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams'];(function(_0x254ee7,_0x9bba53){var _0x19486c=function(_0x4e9276){while(--_0x4e9276){_0x254ee7['push'](_0x254ee7['shift']());}};_0x19486c(++_0x9bba53);}(_0xb1bc,0x119));var _0xcb1b=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xb1bc[_0x51b0dc];return _0x13fa89;};'use strict';var multer=require(_0xcb1b('0x0'));var util=require(_0xcb1b('0x1'));var path=require(_0xcb1b('0x2'));var timeout=require(_0xcb1b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcb1b('0x4'));var auth=require(_0xcb1b('0x5'));var interaction=require(_0xcb1b('0x6'));var config=require(_0xcb1b('0x7'));var controller=require(_0xcb1b('0x8'));router[_0xcb1b('0x9')]('/',auth[_0xcb1b('0xa')](),controller[_0xcb1b('0xb')]);router['get'](_0xcb1b('0xc'),auth['isAuthenticated'](),controller[_0xcb1b('0xd')]);router[_0xcb1b('0x9')](_0xcb1b('0xe'),auth['isAuthenticated'](),controller[_0xcb1b('0xf')]);router[_0xcb1b('0x9')](_0xcb1b('0x10'),auth['isAuthenticated'](),controller[_0xcb1b('0x11')]);router['get'](_0xcb1b('0x12'),auth['isAuthenticated'](),controller[_0xcb1b('0x13')]);router[_0xcb1b('0x9')](_0xcb1b('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcb1b('0x15')]('/',auth[_0xcb1b('0xa')](),controller[_0xcb1b('0x16')]);router[_0xcb1b('0x15')](_0xcb1b('0x12'),auth[_0xcb1b('0xa')](),controller[_0xcb1b('0x17')]);router[_0xcb1b('0x15')](_0xcb1b('0x14'),auth[_0xcb1b('0xa')](),controller[_0xcb1b('0x18')]);router[_0xcb1b('0x19')](_0xcb1b('0xe'),auth['isAuthenticated'](),controller[_0xcb1b('0x1a')]);router['delete'](_0xcb1b('0xe'),auth[_0xcb1b('0xa')](),controller['destroy']);router[_0xcb1b('0x1b')](_0xcb1b('0x12'),auth[_0xcb1b('0xa')](),controller[_0xcb1b('0x1c')]);router[_0xcb1b('0x1b')](_0xcb1b('0x14'),auth['isAuthenticated'](),controller[_0xcb1b('0x1d')]);module[_0xcb1b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ac48bc8..52e5f60 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 _0x6b19=['STRING','sequelize','exports','name','rrmemory','beepall','roundrobin'];(function(_0x36f074,_0x3357f2){var _0x286747=function(_0x4f29bc){while(--_0x4f29bc){_0x36f074['push'](_0x36f074['shift']());}};_0x286747(++_0x3357f2);}(_0x6b19,0xe8));var _0x96b1=function(_0x50b42a,_0x29ec69){_0x50b42a=_0x50b42a-0x0;var _0x111607=_0x6b19[_0x50b42a];return _0x111607;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96b1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x96b1('0x3'),_0x96b1('0x4'),_0x96b1('0x5'))},'description':{'type':Sequelize[_0x96b1('0x6')]}}; \ No newline at end of file +var _0xc125=['exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x50c109,_0x1b8d3e){var _0x355214=function(_0xb6c17c){while(--_0xb6c17c){_0x50c109['push'](_0x50c109['shift']());}};_0x355214(++_0x1b8d3e);}(_0xc125,0x150));var _0x5c12=function(_0x18f76f,_0xcba2f4){_0x18f76f=_0x18f76f-0x0;var _0x4aa730=_0xc125[_0x18f76f];return _0x4aa730;};'use strict';var Sequelize=require('sequelize');module[_0x5c12('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5c12('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5c12('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c12('0x3')](_0x5c12('0x4'),_0x5c12('0x5'),_0x5c12('0x6'))},'description':{'type':Sequelize[_0x5c12('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index bf89e21..516c775 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 _0x4234=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserWhatsappQueue','order','pick','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','removeTeams','Team','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','isEmpty','removeAgents','forEach','omit','spread','isArray','userWhatsappQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x184aa6,_0x5b00ca){var _0x1214a5=function(_0x11c5cd){while(--_0x11c5cd){_0x184aa6['push'](_0x184aa6['shift']());}};_0x1214a5(++_0x5b00ca);}(_0x4234,0xfd));var _0x4423=function(_0x168f13,_0x16ff0a){_0x168f13=_0x168f13-0x0;var _0x5213a6=_0x4234[_0x168f13];return _0x5213a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4423('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4423('0x1'));var rp=require(_0x4423('0x2'));var moment=require(_0x4423('0x3'));var BPromise=require(_0x4423('0x4'));var Mustache=require('mustache');var util=require(_0x4423('0x5'));var path=require(_0x4423('0x6'));var sox=require('sox');var csv=require(_0x4423('0x7'));var ejs=require(_0x4423('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4423('0x9'));var squel=require(_0x4423('0xa'));var crypto=require(_0x4423('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4423('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4423('0xd'));var Redis=require(_0x4423('0xe'));var authService=require(_0x4423('0xf'));var qs=require(_0x4423('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4423('0x11'));var logger=require(_0x4423('0x12'))(_0x4423('0x13'));var utils=require(_0x4423('0x14'));var config=require(_0x4423('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4423('0x16')]=_['defaults'](config['redis'],{'host':_0x4423('0x17'),'port':0x18eb});var socket=require(_0x4423('0x18'))(new Redis(config[_0x4423('0x16')]));require(_0x4423('0x19'))[_0x4423('0x1a')](socket);function respondWithStatusCode(_0x100b1b,_0x5ef40d){_0x5ef40d=_0x5ef40d||0xcc;return function(_0x517467){if(_0x517467){return _0x100b1b[_0x4423('0x1b')](_0x5ef40d);}return _0x100b1b['status'](_0x5ef40d)['end']();};}function respondWithResult(_0x34ceea,_0x5bb647){_0x5bb647=_0x5bb647||0xc8;return function(_0x1d39fd){if(_0x1d39fd){return _0x34ceea[_0x4423('0x1c')](_0x5bb647)[_0x4423('0x1d')](_0x1d39fd);}};}function respondWithFilteredResult(_0x54309b,_0xbd6b67){return function(_0x1f3845){if(_0x1f3845){var _0x38e565=typeof _0xbd6b67[_0x4423('0x1e')]===_0x4423('0x1f')&&typeof _0xbd6b67['limit']===_0x4423('0x1f');var _0x5400ef=_0x1f3845[_0x4423('0x20')];var _0x1079c0=_0x38e565?0x0:_0xbd6b67[_0x4423('0x1e')];var _0x1e1935=_0x38e565?_0x1f3845['count']:_0xbd6b67[_0x4423('0x1e')]+_0xbd6b67[_0x4423('0x21')];var _0x1de9b7;if(_0x1e1935>=_0x5400ef){_0x1e1935=_0x5400ef;_0x1de9b7=0xc8;}else{_0x1de9b7=0xce;}_0x54309b[_0x4423('0x1c')](_0x1de9b7);return _0x54309b['set'](_0x4423('0x22'),_0x1079c0+'-'+_0x1e1935+'/'+_0x5400ef)[_0x4423('0x1d')](_0x1f3845);}return null;};}function patchUpdates(_0x3170c1){return function(_0x5aabf2){try{jsonpatch[_0x4423('0x23')](_0x5aabf2,_0x3170c1,!![]);}catch(_0x3f85c4){return BPromise[_0x4423('0x24')](_0x3f85c4);}return _0x5aabf2['save']();};}function saveUpdates(_0x4fac7b,_0x45dafa){return function(_0x470a9b){if(_0x470a9b){return _0x470a9b[_0x4423('0x25')](_0x4fac7b)[_0x4423('0x26')](function(_0x410962){return _0x410962;});}return null;};}function removeEntity(_0x31becd,_0x355d22){return function(_0x9929f7){if(_0x9929f7){return _0x9929f7[_0x4423('0x27')]()['then'](function(){var _0x299039=_0x9929f7[_0x4423('0x28')]({'plain':!![]});var _0x590851=_0x4423('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x590851,'resourceId':_0x299039['id']}})['then'](function(){return _0x9929f7;});})[_0x4423('0x26')](function(){_0x31becd[_0x4423('0x1c')](0xcc)[_0x4423('0x2a')]();});}};}function handleEntityNotFound(_0x10def3,_0x53fd0c){return function(_0x3fbb0d){if(!_0x3fbb0d){_0x10def3['sendStatus'](0x194);}return _0x3fbb0d;};}function handleError(_0x73cece,_0x27be4f){_0x27be4f=_0x27be4f||0x1f4;return function(_0x4ebca1){logger[_0x4423('0x2b')](_0x4ebca1['stack']);if(_0x4ebca1[_0x4423('0x2c')]){delete _0x4ebca1[_0x4423('0x2c')];}_0x73cece['status'](_0x27be4f)[_0x4423('0x2d')](_0x4ebca1);};}exports[_0x4423('0x2e')]=function(_0x5e8789,_0x159e5b){var _0x1d1b2d={},_0x3330a6={},_0xd69848={'count':0x0,'rows':[]};var _0x25a943=_[_0x4423('0x2f')](db[_0x4423('0x30')][_0x4423('0x31')],function(_0xd33533){return{'name':_0xd33533[_0x4423('0x32')],'type':_0xd33533[_0x4423('0x33')][_0x4423('0x34')]};});_0x3330a6[_0x4423('0x35')]=_[_0x4423('0x2f')](_0x25a943,_0x4423('0x2c'));_0x3330a6['query']=_[_0x4423('0x36')](_0x5e8789[_0x4423('0x37')]);_0x3330a6['filters']=_[_0x4423('0x38')](_0x3330a6[_0x4423('0x35')],_0x3330a6[_0x4423('0x37')]);_0x1d1b2d[_0x4423('0x39')]=_[_0x4423('0x38')](_0x3330a6['model'],qs[_0x4423('0x3a')](_0x5e8789[_0x4423('0x37')][_0x4423('0x3a')]));_0x1d1b2d[_0x4423('0x39')]=_0x1d1b2d[_0x4423('0x39')][_0x4423('0x3b')]?_0x1d1b2d[_0x4423('0x39')]:_0x3330a6['model'];if(!_0x5e8789[_0x4423('0x37')][_0x4423('0x3c')](_0x4423('0x3d'))){_0x1d1b2d[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x5e8789[_0x4423('0x37')]['limit']);_0x1d1b2d[_0x4423('0x1e')]=qs[_0x4423('0x1e')](_0x5e8789[_0x4423('0x37')]['offset']);}_0x1d1b2d['order']=qs[_0x4423('0x3e')](_0x5e8789['query'][_0x4423('0x3e')]);_0x1d1b2d[_0x4423('0x3f')]=qs['filters'](_['pick'](_0x5e8789[_0x4423('0x37')],_0x3330a6[_0x4423('0x40')]),_0x25a943);if(_0x5e8789[_0x4423('0x37')][_0x4423('0x41')]){_0x1d1b2d['where']=_['merge'](_0x1d1b2d['where'],{'$or':_[_0x4423('0x2f')](_0x25a943,function(_0x26b674){if(_0x26b674[_0x4423('0x33')]!==_0x4423('0x42')){var _0x5b6314={};_0x5b6314[_0x26b674['name']]={'$like':'%'+_0x5e8789[_0x4423('0x37')]['filter']+'%'};return _0x5b6314;}})});}_0x1d1b2d=_[_0x4423('0x43')]({},_0x1d1b2d,_0x5e8789[_0x4423('0x44')]);var _0x4be39c={'where':_0x1d1b2d['where']};return db[_0x4423('0x30')]['count'](_0x4be39c)[_0x4423('0x26')](function(_0x2507c7){_0xd69848[_0x4423('0x20')]=_0x2507c7;if(_0x5e8789[_0x4423('0x37')]['includeAll']){_0x1d1b2d[_0x4423('0x45')]=[{'all':!![]}];}return db[_0x4423('0x30')][_0x4423('0x46')](_0x1d1b2d);})[_0x4423('0x26')](function(_0x2d68ab){_0xd69848[_0x4423('0x47')]=_0x2d68ab;return _0xd69848;})['then'](respondWithFilteredResult(_0x159e5b,_0x1d1b2d))[_0x4423('0x48')](handleError(_0x159e5b,null));};exports[_0x4423('0x49')]=function(_0x28496d,_0x316d2d){var _0x29f2d3={'raw':!![],'where':{'id':_0x28496d[_0x4423('0x4a')]['id']}},_0x2d0a95={};_0x2d0a95[_0x4423('0x35')]=_[_0x4423('0x36')](db[_0x4423('0x30')]['rawAttributes']);_0x2d0a95[_0x4423('0x37')]=_[_0x4423('0x36')](_0x28496d[_0x4423('0x37')]);_0x2d0a95[_0x4423('0x40')]=_[_0x4423('0x38')](_0x2d0a95[_0x4423('0x35')],_0x2d0a95['query']);_0x29f2d3[_0x4423('0x39')]=_[_0x4423('0x38')](_0x2d0a95['model'],qs[_0x4423('0x3a')](_0x28496d['query'][_0x4423('0x3a')]));_0x29f2d3[_0x4423('0x39')]=_0x29f2d3[_0x4423('0x39')]['length']?_0x29f2d3[_0x4423('0x39')]:_0x2d0a95[_0x4423('0x35')];if(_0x28496d['query']['includeAll']){_0x29f2d3['include']=[{'all':!![]}];}_0x29f2d3=_[_0x4423('0x43')]({},_0x29f2d3,_0x28496d['options']);return db['WhatsappQueue']['find'](_0x29f2d3)[_0x4423('0x26')](handleEntityNotFound(_0x316d2d,null))[_0x4423('0x26')](respondWithResult(_0x316d2d,null))['catch'](handleError(_0x316d2d,null));};exports[_0x4423('0x4b')]=function(_0x630e85,_0x131f53){return db[_0x4423('0x30')][_0x4423('0x4b')](_0x630e85['body'],{})[_0x4423('0x26')](function(_0x1831a1){var _0x48116c=_0x630e85[_0x4423('0x4c')][_0x4423('0x28')]({'plain':!![]});if(!_0x48116c)throw new Error(_0x4423('0x4d'));if(_0x48116c['role']===_0x4423('0x4c')){var _0x33c43b=_0x1831a1['get']({'plain':!![]});var _0x5b6df4=_0x4423('0x29');return db[_0x4423('0x4e')][_0x4423('0x4f')]({'where':{'name':_0x5b6df4,'userProfileId':_0x48116c[_0x4423('0x50')]},'raw':!![]})[_0x4423('0x26')](function(_0x1e3526){if(_0x1e3526&&_0x1e3526[_0x4423('0x51')]===0x0){return db[_0x4423('0x52')][_0x4423('0x4b')]({'name':_0x33c43b['name'],'resourceId':_0x33c43b['id'],'type':_0x1e3526['name'],'sectionId':_0x1e3526['id']},{})['then'](function(){return _0x1831a1;});}else{return _0x1831a1;}})['catch'](function(_0x51989d){logger['error'](_0x4423('0x53'),_0x51989d);throw _0x51989d;});}return _0x1831a1;})[_0x4423('0x26')](respondWithResult(_0x131f53,0xc9))[_0x4423('0x48')](handleError(_0x131f53,null));};exports[_0x4423('0x25')]=function(_0x6ecdd4,_0x3c87bf){if(_0x6ecdd4[_0x4423('0x54')]['id']){delete _0x6ecdd4[_0x4423('0x54')]['id'];}return db[_0x4423('0x30')][_0x4423('0x4f')]({'where':{'id':_0x6ecdd4[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x3c87bf,null))[_0x4423('0x26')](saveUpdates(_0x6ecdd4[_0x4423('0x54')],null))[_0x4423('0x26')](respondWithResult(_0x3c87bf,null))[_0x4423('0x48')](handleError(_0x3c87bf,null));};exports['destroy']=function(_0x51d925,_0x3f2ad1){return db[_0x4423('0x30')]['find']({'where':{'id':_0x51d925[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x3f2ad1,null))[_0x4423('0x26')](removeEntity(_0x3f2ad1,null))['catch'](handleError(_0x3f2ad1,null));};exports['describe']=function(_0xe18534,_0x35b3eb){return db[_0x4423('0x30')]['describe']()[_0x4423('0x26')](respondWithResult(_0x35b3eb,null))[_0x4423('0x48')](handleError(_0x35b3eb,null));};exports[_0x4423('0x55')]=function(_0x2da884,_0xe75e53,_0x5d5761){var _0x3d9cd6={'raw':!![],'where':{}},_0x3536a4={},_0x4bf248;return db[_0x4423('0x30')][_0x4423('0x56')]({'where':{'id':_0x2da884[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0xe75e53,null))['then'](function(_0x1cdc97){if(_0x1cdc97){_0x4bf248=_0x1cdc97[_0x4423('0x28')]({'plain':!![]});_0x3536a4['model']=_[_0x4423('0x36')](db[_0x4423('0x57')][_0x4423('0x31')]);_0x3536a4[_0x4423('0x37')]=_['keys'](_0x2da884[_0x4423('0x37')]);_0x3536a4[_0x4423('0x40')]=_[_0x4423('0x38')](_0x3536a4[_0x4423('0x35')],_0x3536a4[_0x4423('0x37')]);_0x3d9cd6[_0x4423('0x39')]=_[_0x4423('0x38')](_0x3536a4['model'],qs[_0x4423('0x3a')](_0x2da884['query'][_0x4423('0x3a')]));_0x3d9cd6[_0x4423('0x39')]=_0x3d9cd6[_0x4423('0x39')]['length']?_0x3d9cd6[_0x4423('0x39')]:_0x3536a4[_0x4423('0x35')];if(!_0x2da884[_0x4423('0x37')][_0x4423('0x3c')](_0x4423('0x3d'))){_0x3d9cd6[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x2da884[_0x4423('0x37')][_0x4423('0x21')]);_0x3d9cd6['offset']=qs[_0x4423('0x1e')](_0x2da884[_0x4423('0x37')][_0x4423('0x1e')]);}_0x3d9cd6[_0x4423('0x58')]=qs[_0x4423('0x3e')](_0x2da884[_0x4423('0x37')][_0x4423('0x3e')]);_0x3d9cd6[_0x4423('0x3f')]=qs['filters'](_[_0x4423('0x59')](_0x2da884[_0x4423('0x37')],_0x3536a4[_0x4423('0x40')]));_0x3d9cd6['where']['WhatsappQueueId']=_0x1cdc97['id'];if(_0x2da884[_0x4423('0x37')]['filter']){_0x3d9cd6[_0x4423('0x3f')]=_['merge'](_0x3d9cd6[_0x4423('0x3f')],{'$or':_['map'](_0x3d9cd6[_0x4423('0x39')],function(_0x482210){var _0x271403={};_0x271403[_0x482210]={'$like':'%'+_0x2da884[_0x4423('0x37')][_0x4423('0x41')]+'%'};return _0x271403;})});}_0x3d9cd6=_[_0x4423('0x43')]({},_0x3d9cd6,_0x2da884['options']);return db[_0x4423('0x57')][_0x4423('0x46')](_0x3d9cd6);}})[_0x4423('0x26')](function(_0x1777cc){if(_0x1777cc){return db[_0x4423('0x5a')][_0x4423('0x5b')]({'where':{'id':_['map'](_0x1777cc,_0x4423('0x5c')),'role':_0x4423('0x5d')},'attributes':['id',_0x4423('0x2c'),_0x4423('0x5e'),_0x4423('0x5f'),_0x4423('0x60')]});}})[_0x4423('0x26')](function(_0x236af3){if(_0x236af3){return{'count':_0x236af3[_0x4423('0x20')],'rows':_[_0x4423('0x2f')](_0x236af3[_0x4423('0x47')],function(_0x299aeb){return{'membername':_0x299aeb[_0x4423('0x2c')],'UserId':_0x299aeb['id'],'queue_name':_0x4bf248[_0x4423('0x2c')],'WhatsappQueueId':_0x4bf248['id'],'interface':util[_0x4423('0x61')](_0x4423('0x62'),_0x4423('0x63'),_0x299aeb[_0x4423('0x2c')]),'penalty':0x0,'paused':_0x299aeb[_0x4423('0x5e')],'createdAt':_0x299aeb[_0x4423('0x60')],'updatedAt':_0x299aeb[_0x4423('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4423('0x26')](respondWithFilteredResult(_0xe75e53,_0x3d9cd6))['catch'](handleError(_0xe75e53,null));};exports[_0x4423('0x64')]=function(_0x4a154a,_0x2688db,_0x5e277a){var _0x560198={};var _0x46f9e5={};var _0x53b002;var _0xd6fa21;return db['WhatsappQueue']['findOne']({'where':{'id':_0x4a154a[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x2688db,null))[_0x4423('0x26')](function(_0x310ae6){if(_0x310ae6){_0x53b002=_0x310ae6;_0x46f9e5[_0x4423('0x35')]=_[_0x4423('0x36')](db['Team'][_0x4423('0x31')]);_0x46f9e5['query']=_['keys'](_0x4a154a[_0x4423('0x37')]);_0x46f9e5['filters']=_[_0x4423('0x38')](_0x46f9e5[_0x4423('0x35')],_0x46f9e5[_0x4423('0x37')]);_0x560198[_0x4423('0x39')]=_['intersection'](_0x46f9e5[_0x4423('0x35')],qs[_0x4423('0x3a')](_0x4a154a[_0x4423('0x37')]['fields']));_0x560198[_0x4423('0x39')]=_0x560198[_0x4423('0x39')][_0x4423('0x3b')]?_0x560198[_0x4423('0x39')]:_0x46f9e5[_0x4423('0x35')];_0x560198[_0x4423('0x58')]=qs['sort'](_0x4a154a['query'][_0x4423('0x3e')]);_0x560198[_0x4423('0x3f')]=qs[_0x4423('0x40')](_[_0x4423('0x59')](_0x4a154a['query'],_0x46f9e5['filters']));if(_0x4a154a[_0x4423('0x37')][_0x4423('0x41')]){_0x560198['where']=_[_0x4423('0x43')](_0x560198[_0x4423('0x3f')],{'$or':_['map'](_0x560198[_0x4423('0x39')],function(_0x2c10fc){var _0x447420={};_0x447420[_0x2c10fc]={'$like':'%'+_0x4a154a[_0x4423('0x37')]['filter']+'%'};return _0x447420;})});}_0x560198=_[_0x4423('0x43')]({},_0x560198,_0x4a154a[_0x4423('0x44')]);return _0x53b002['getTeams'](_0x560198);}})[_0x4423('0x26')](function(_0x5cfc51){if(_0x5cfc51){_0xd6fa21=_0x5cfc51['length'];if(!_0x4a154a[_0x4423('0x37')]['hasOwnProperty'](_0x4423('0x3d'))){_0x560198[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x4a154a[_0x4423('0x37')]['limit']);_0x560198['offset']=qs[_0x4423('0x1e')](_0x4a154a[_0x4423('0x37')]['offset']);}return _0x53b002['getTeams'](_0x560198);}})[_0x4423('0x26')](function(_0x27d6b8){if(_0x27d6b8){return _0x27d6b8?{'count':_0xd6fa21,'rows':_0x27d6b8}:null;}})['then'](respondWithResult(_0x2688db,null))['catch'](handleError(_0x2688db,null));};exports[_0x4423('0x65')]=function(_0x1cc8ea,_0xe6d866,_0x21366a){var _0x76dd61=_0x1cc8ea[_0x4423('0x54')][_0x4423('0x66')];return db['Team'][_0x4423('0x46')]({'where':{'id':_0x76dd61},'attributes':['id'],'include':[{'model':db[_0x4423('0x5a')],'as':_0x4423('0x67'),'attributes':['id','name',_0x4423('0x68'),_0x4423('0x69'),_0x4423('0x6a')],'raw':!![]}]})[_0x4423('0x26')](function(_0x42b7d9){if(_0x42b7d9){var _0x59bb48=_['flatMap'](_0x42b7d9,function(_0x1d8778){var _0x3b0f87=_0x1d8778[_0x4423('0x28')]({'plain':!![]});return _0x3b0f87[_0x4423('0x67')];});return db['WhatsappQueue'][_0x4423('0x4f')]({'where':{'id':_0x1cc8ea[_0x4423('0x4a')]['id']}})['then'](function(_0x456d84){return db[_0x4423('0x6b')][_0x4423('0x6c')](function(_0x18858d){return _0x456d84[_0x4423('0x65')](_0x76dd61,{'transaction':_0x18858d})[_0x4423('0x26')](function(){return BPromise['each'](_0x59bb48,function(_0x393be1){return db[_0x4423('0x57')][_0x4423('0x6d')]({'where':{'UserId':_0x393be1['id'],'WhatsappQueueId':_0x1cc8ea[_0x4423('0x4a')]['id']},'transaction':_0x18858d});});})[_0x4423('0x26')](function(){_0x59bb48['forEach'](function(_0x1651e5){socket[_0x4423('0x6e')](_0x4423('0x6f'),{'UserId':_0x1651e5['id'],'WhatsappQueueId':_0x456d84['id']});});});});});}})[_0x4423('0x26')](respondWithStatusCode(_0xe6d866,null))['catch'](handleError(_0xe6d866,null));};exports[_0x4423('0x70')]=function(_0x8d592b,_0x140684,_0xe1c9d1){return db[_0x4423('0x71')][_0x4423('0x46')]({'where':{'id':_0x8d592b['query'][_0x4423('0x66')]},'attributes':['id'],'include':[{'model':db[_0x4423('0x5a')],'as':_0x4423('0x67'),'attributes':['id'],'raw':!![]}]})[_0x4423('0x26')](handleEntityNotFound(_0x140684,null))[_0x4423('0x26')](function(_0xec7811){var _0x6ba097=_[_0x4423('0x2f')](_0xec7811,'id');var _0x270035=[];var _0x16283d=[];var _0x5b4ae0=squel[_0x4423('0x72')]();_0x5b4ae0[_0x4423('0x73')](_0x4423('0x74'))[_0x4423('0x75')]('team_has_whatsapp_queues','tq')['join'](_0x4423('0x76'),'ut',_0x4423('0x77'))['where'](_0x4423('0x78'),_0x8d592b[_0x4423('0x4a')]['id']);for(var _0x56d11c=0x0;_0x56d11c<_0xec7811[_0x4423('0x3b')];_0x56d11c+=0x1){let _0x2c0805=_0xec7811[_0x56d11c];for(var _0x597866=0x0;_0x597866<_0x2c0805[_0x4423('0x67')][_0x4423('0x3b')];_0x597866+=0x1){let _0x365214=_0x2c0805['Agents'][_0x597866];var _0x4f1557=_0x5b4ae0['clone']();_0x4f1557[_0x4423('0x3f')](_0x4423('0x79'),_0x365214['id']);_0x16283d[_0x4423('0x7a')](db[_0x4423('0x6b')]['query'](_0x4f1557['toString'](),{'type':db[_0x4423('0x6b')][_0x4423('0x7b')]['SELECT']})['then'](function(_0x448ee8){if(_0x448ee8['length']===0x1){return _0x365214['id'];}else{var _0x2ba840=_[_0x4423('0x7c')](_[_0x4423('0x2f')](_0x448ee8,_0x4423('0x7d')),function(_0x2a60a8){return _['includes'](_0x6ba097,_0x2a60a8);});if(_0x2ba840){return _0x365214['id'];}}}));}}return BPromise[_0x4423('0x7e')](_0x16283d)[_0x4423('0x26')](function(_0x41c12){_0x270035=_(_0x270035)['union'](_0x41c12)['compact']()['value']();return db[_0x4423('0x30')][_0x4423('0x4f')]({'where':{'id':_0x8d592b[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](function(_0xa648e9){return db['sequelize'][_0x4423('0x6c')](function(_0x4d7c0c){return _0xa648e9[_0x4423('0x70')](_0x8d592b['query'][_0x4423('0x66')],{'transaction':_0x4d7c0c})[_0x4423('0x26')](function(){if(!_[_0x4423('0x7f')](_0x270035)){return _0xa648e9[_0x4423('0x80')](_0x270035,{'transaction':_0x4d7c0c});}})[_0x4423('0x26')](function(){_0x270035[_0x4423('0x81')](function(_0x2b60f3){socket[_0x4423('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x2b60f3,'WhatsappQueueId':_0xa648e9['id']});});});});});});})[_0x4423('0x26')](respondWithStatusCode(_0x140684,null))[_0x4423('0x48')](handleError(_0x140684,null));};exports['addAgents']=function(_0x2a2816,_0x5a4951,_0x24642b){return db[_0x4423('0x30')]['find']({'where':{'id':_0x2a2816[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x5a4951,null))[_0x4423('0x26')](function(_0x2ffbdc){if(_0x2ffbdc){return _0x2ffbdc['addAgents'](_0x2a2816[_0x4423('0x54')]['ids'],_[_0x4423('0x82')](_0x2a2816[_0x4423('0x54')],[_0x4423('0x66'),'id'])||{})[_0x4423('0x83')](function(_0x1db612){for(var _0x16113e=0x0;_0x16113e<_0x2a2816[_0x4423('0x54')]['ids'][_0x4423('0x3b')];_0x16113e+=0x1){socket['emit'](_0x4423('0x6f'),{'UserId':Number(_0x2a2816['body'][_0x4423('0x66')][_0x16113e]),'WhatsappQueueId':Number(_0x2a2816['params']['id'])});}return _0x1db612;});}})[_0x4423('0x26')](respondWithResult(_0x5a4951,null))[_0x4423('0x48')](handleError(_0x5a4951,null));};exports[_0x4423('0x80')]=function(_0x309cd1,_0x54a896,_0x330663){return db['WhatsappQueue'][_0x4423('0x4f')]({'where':{'id':_0x309cd1['params']['id']}})['then'](handleEntityNotFound(_0x54a896,null))['then'](function(_0x4cc753){if(_0x4cc753){return _0x4cc753[_0x4423('0x80')](_0x309cd1[_0x4423('0x37')]['ids'])[_0x4423('0x26')](function(){if(_[_0x4423('0x84')](_0x309cd1['query'][_0x4423('0x66')])){for(var _0x5bac64=0x0;_0x5bac64<_0x309cd1[_0x4423('0x37')]['ids'][_0x4423('0x3b')];_0x5bac64+=0x1){socket['emit'](_0x4423('0x85'),{'UserId':Number(_0x309cd1['query'][_0x4423('0x66')][_0x5bac64]),'WhatsappQueueId':Number(_0x309cd1[_0x4423('0x4a')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x309cd1[_0x4423('0x37')]['ids']),'WhatsappQueueId':Number(_0x309cd1[_0x4423('0x4a')]['id'])});}});}})[_0x4423('0x26')](respondWithStatusCode(_0x54a896,null))[_0x4423('0x48')](handleError(_0x54a896,null));};exports[_0x4423('0x86')]=function(_0x3a43ae,_0x2d81dc,_0x1388ab){var _0x1b49aa={};var _0x1c2e70={};var _0x322aec;var _0x395c20;return db['WhatsappQueue'][_0x4423('0x56')]({'where':{'id':_0x3a43ae[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x2d81dc,null))[_0x4423('0x26')](function(_0x4a4eb3){if(_0x4a4eb3){_0x322aec=_0x4a4eb3;_0x1c2e70[_0x4423('0x35')]=_['keys'](db['User'][_0x4423('0x31')]);_0x1c2e70[_0x4423('0x37')]=_[_0x4423('0x36')](_0x3a43ae['query']);_0x1c2e70[_0x4423('0x40')]=_[_0x4423('0x38')](_0x1c2e70[_0x4423('0x35')],_0x1c2e70[_0x4423('0x37')]);_0x1b49aa[_0x4423('0x39')]=_[_0x4423('0x38')](_0x1c2e70[_0x4423('0x35')],qs['fields'](_0x3a43ae[_0x4423('0x37')][_0x4423('0x3a')]));_0x1b49aa[_0x4423('0x39')]=_0x1b49aa[_0x4423('0x39')][_0x4423('0x3b')]?_0x1b49aa[_0x4423('0x39')]:_0x1c2e70[_0x4423('0x35')];_0x1b49aa['order']=qs[_0x4423('0x3e')](_0x3a43ae[_0x4423('0x37')][_0x4423('0x3e')]);_0x1b49aa[_0x4423('0x3f')]=qs[_0x4423('0x40')](_['pick'](_0x3a43ae[_0x4423('0x37')],_0x1c2e70['filters']));if(_0x3a43ae[_0x4423('0x37')][_0x4423('0x41')]){_0x1b49aa[_0x4423('0x3f')]=_[_0x4423('0x43')](_0x1b49aa[_0x4423('0x3f')],{'$or':_['map'](_0x1b49aa[_0x4423('0x39')],function(_0x50de01){var _0x2e5b81={};_0x2e5b81[_0x50de01]={'$like':'%'+_0x3a43ae[_0x4423('0x37')][_0x4423('0x41')]+'%'};return _0x2e5b81;})});}_0x1b49aa=_[_0x4423('0x43')]({},_0x1b49aa,_0x3a43ae['options']);return _0x322aec[_0x4423('0x86')](_0x1b49aa);}})[_0x4423('0x26')](function(_0x1e5abe){if(_0x1e5abe){_0x395c20=_0x1e5abe[_0x4423('0x3b')];if(!_0x3a43ae['query'][_0x4423('0x3c')](_0x4423('0x3d'))){_0x1b49aa[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x3a43ae[_0x4423('0x37')]['limit']);_0x1b49aa[_0x4423('0x1e')]=qs[_0x4423('0x1e')](_0x3a43ae['query'][_0x4423('0x1e')]);}return _0x322aec[_0x4423('0x86')](_0x1b49aa);}})[_0x4423('0x26')](function(_0x161c1a){if(_0x161c1a){return _0x161c1a?{'count':_0x395c20,'rows':_0x161c1a}:null;}})[_0x4423('0x26')](respondWithResult(_0x2d81dc,null))[_0x4423('0x48')](handleError(_0x2d81dc,null));}; \ No newline at end of file +var _0xce66=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','model','query','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','rows','catch','params','keys','include','find','create','user','WhatsappQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','hasOwnProperty','pick','WhatsappQueueId','findAll','findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','whatsappPause','Team','getTeams','nolimit','ids','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','UserWhatsappQueue','emit','userWhatsappQueue:save','User','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','compact','value','removeTeams','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce66,0xed));var _0x6ce6=function(_0x340da7,_0x13d6fc){_0x340da7=_0x340da7-0x0;var _0x43b466=_0xce66[_0x340da7];return _0x43b466;};'use strict';var emlformat=require(_0x6ce6('0x0'));var rimraf=require(_0x6ce6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6ce6('0x2'));var moment=require('moment');var BPromise=require(_0x6ce6('0x3'));var Mustache=require('mustache');var util=require(_0x6ce6('0x4'));var path=require(_0x6ce6('0x5'));var sox=require('sox');var csv=require(_0x6ce6('0x6'));var ejs=require(_0x6ce6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6ce6('0x8'));var crypto=require(_0x6ce6('0x9'));var jsforce=require(_0x6ce6('0xa'));var deskjs=require(_0x6ce6('0xb'));var toCsv=require(_0x6ce6('0x6'));var querystring=require(_0x6ce6('0xc'));var Papa=require(_0x6ce6('0xd'));var Redis=require(_0x6ce6('0xe'));var authService=require(_0x6ce6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ce6('0x10'));var logger=require(_0x6ce6('0x11'))(_0x6ce6('0x12'));var utils=require(_0x6ce6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6ce6('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6ce6('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ce6('0x16'))(new Redis(config['redis']));require(_0x6ce6('0x17'))[_0x6ce6('0x18')](socket);function respondWithStatusCode(_0x34ea23,_0x5e4dc2){_0x5e4dc2=_0x5e4dc2||0xcc;return function(_0x57bad7){if(_0x57bad7){return _0x34ea23[_0x6ce6('0x19')](_0x5e4dc2);}return _0x34ea23[_0x6ce6('0x1a')](_0x5e4dc2)['end']();};}function respondWithResult(_0x4c382d,_0x5f3f6f){_0x5f3f6f=_0x5f3f6f||0xc8;return function(_0x192e9a){if(_0x192e9a){return _0x4c382d[_0x6ce6('0x1a')](_0x5f3f6f)[_0x6ce6('0x1b')](_0x192e9a);}};}function respondWithFilteredResult(_0x19fbd2,_0x2aa260){return function(_0x12f55c){if(_0x12f55c){var _0x33dc61=typeof _0x2aa260[_0x6ce6('0x1c')]===_0x6ce6('0x1d')&&typeof _0x2aa260[_0x6ce6('0x1e')]===_0x6ce6('0x1d');var _0xf81548=_0x12f55c[_0x6ce6('0x1f')];var _0x6fce75=_0x33dc61?0x0:_0x2aa260[_0x6ce6('0x1c')];var _0x35eb11=_0x33dc61?_0x12f55c[_0x6ce6('0x1f')]:_0x2aa260[_0x6ce6('0x1c')]+_0x2aa260[_0x6ce6('0x1e')];var _0x54435c;if(_0x35eb11>=_0xf81548){_0x35eb11=_0xf81548;_0x54435c=0xc8;}else{_0x54435c=0xce;}_0x19fbd2['status'](_0x54435c);return _0x19fbd2[_0x6ce6('0x20')](_0x6ce6('0x21'),_0x6fce75+'-'+_0x35eb11+'/'+_0xf81548)[_0x6ce6('0x1b')](_0x12f55c);}return null;};}function patchUpdates(_0x66ee33){return function(_0x42d298){try{jsonpatch['apply'](_0x42d298,_0x66ee33,!![]);}catch(_0x16a249){return BPromise[_0x6ce6('0x22')](_0x16a249);}return _0x42d298[_0x6ce6('0x23')]();};}function saveUpdates(_0x4a359f,_0x153987){return function(_0x2a8373){if(_0x2a8373){return _0x2a8373[_0x6ce6('0x24')](_0x4a359f)[_0x6ce6('0x25')](function(_0x22d9e6){return _0x22d9e6;});}return null;};}function removeEntity(_0x1565fe,_0x570209){return function(_0x567631){if(_0x567631){return _0x567631[_0x6ce6('0x26')]()[_0x6ce6('0x25')](function(){var _0x169dc7=_0x567631[_0x6ce6('0x27')]({'plain':!![]});var _0x17b56e='WhatsappQueues';return db['UserProfileResource'][_0x6ce6('0x26')]({'where':{'type':_0x17b56e,'resourceId':_0x169dc7['id']}})[_0x6ce6('0x25')](function(){return _0x567631;});})['then'](function(){_0x1565fe[_0x6ce6('0x1a')](0xcc)[_0x6ce6('0x28')]();});}};}function handleEntityNotFound(_0x3dec9b,_0x54d840){return function(_0x100ba4){if(!_0x100ba4){_0x3dec9b['sendStatus'](0x194);}return _0x100ba4;};}function handleError(_0x46b85b,_0x54e61c){_0x54e61c=_0x54e61c||0x1f4;return function(_0x44e68b){logger[_0x6ce6('0x29')](_0x44e68b[_0x6ce6('0x2a')]);if(_0x44e68b[_0x6ce6('0x2b')]){delete _0x44e68b[_0x6ce6('0x2b')];}_0x46b85b[_0x6ce6('0x1a')](_0x54e61c)[_0x6ce6('0x2c')](_0x44e68b);};}exports[_0x6ce6('0x2d')]=function(_0x1d01ac,_0x53a519){var _0x50115c={},_0x358de3={},_0x4ab099={'count':0x0,'rows':[]};var _0x228866=_[_0x6ce6('0x2e')](db['WhatsappQueue'][_0x6ce6('0x2f')],function(_0x12cd92){return{'name':_0x12cd92['fieldName'],'type':_0x12cd92[_0x6ce6('0x30')]['key']};});_0x358de3[_0x6ce6('0x31')]=_[_0x6ce6('0x2e')](_0x228866,_0x6ce6('0x2b'));_0x358de3[_0x6ce6('0x32')]=_['keys'](_0x1d01ac[_0x6ce6('0x32')]);_0x358de3['filters']=_[_0x6ce6('0x33')](_0x358de3[_0x6ce6('0x31')],_0x358de3['query']);_0x50115c['attributes']=_[_0x6ce6('0x33')](_0x358de3[_0x6ce6('0x31')],qs[_0x6ce6('0x34')](_0x1d01ac[_0x6ce6('0x32')][_0x6ce6('0x34')]));_0x50115c['attributes']=_0x50115c[_0x6ce6('0x35')][_0x6ce6('0x36')]?_0x50115c[_0x6ce6('0x35')]:_0x358de3['model'];if(!_0x1d01ac[_0x6ce6('0x32')]['hasOwnProperty']('nolimit')){_0x50115c['limit']=qs[_0x6ce6('0x1e')](_0x1d01ac[_0x6ce6('0x32')][_0x6ce6('0x1e')]);_0x50115c['offset']=qs[_0x6ce6('0x1c')](_0x1d01ac[_0x6ce6('0x32')][_0x6ce6('0x1c')]);}_0x50115c[_0x6ce6('0x37')]=qs[_0x6ce6('0x38')](_0x1d01ac['query']['sort']);_0x50115c[_0x6ce6('0x39')]=qs[_0x6ce6('0x3a')](_['pick'](_0x1d01ac['query'],_0x358de3[_0x6ce6('0x3a')]),_0x228866);if(_0x1d01ac[_0x6ce6('0x32')][_0x6ce6('0x3b')]){_0x50115c[_0x6ce6('0x39')]=_[_0x6ce6('0x3c')](_0x50115c[_0x6ce6('0x39')],{'$or':_[_0x6ce6('0x2e')](_0x228866,function(_0x3c1ecd){if(_0x3c1ecd[_0x6ce6('0x30')]!==_0x6ce6('0x3d')){var _0x329011={};_0x329011[_0x3c1ecd[_0x6ce6('0x2b')]]={'$like':'%'+_0x1d01ac['query'][_0x6ce6('0x3b')]+'%'};return _0x329011;}})});}_0x50115c=_[_0x6ce6('0x3c')]({},_0x50115c,_0x1d01ac[_0x6ce6('0x3e')]);var _0x1d71f9={'where':_0x50115c[_0x6ce6('0x39')]};return db[_0x6ce6('0x3f')][_0x6ce6('0x1f')](_0x1d71f9)[_0x6ce6('0x25')](function(_0x30f0ca){_0x4ab099[_0x6ce6('0x1f')]=_0x30f0ca;if(_0x1d01ac[_0x6ce6('0x32')][_0x6ce6('0x40')]){_0x50115c['include']=[{'all':!![]}];}return db[_0x6ce6('0x3f')]['findAll'](_0x50115c);})[_0x6ce6('0x25')](function(_0x4b23bb){_0x4ab099[_0x6ce6('0x41')]=_0x4b23bb;return _0x4ab099;})['then'](respondWithFilteredResult(_0x53a519,_0x50115c))[_0x6ce6('0x42')](handleError(_0x53a519,null));};exports['show']=function(_0x4ffb90,_0x1648c6){var _0x755f2={'raw':!![],'where':{'id':_0x4ffb90[_0x6ce6('0x43')]['id']}},_0x28d841={};_0x28d841[_0x6ce6('0x31')]=_['keys'](db[_0x6ce6('0x3f')][_0x6ce6('0x2f')]);_0x28d841[_0x6ce6('0x32')]=_[_0x6ce6('0x44')](_0x4ffb90['query']);_0x28d841[_0x6ce6('0x3a')]=_['intersection'](_0x28d841[_0x6ce6('0x31')],_0x28d841[_0x6ce6('0x32')]);_0x755f2[_0x6ce6('0x35')]=_[_0x6ce6('0x33')](_0x28d841[_0x6ce6('0x31')],qs[_0x6ce6('0x34')](_0x4ffb90[_0x6ce6('0x32')]['fields']));_0x755f2['attributes']=_0x755f2['attributes']['length']?_0x755f2[_0x6ce6('0x35')]:_0x28d841[_0x6ce6('0x31')];if(_0x4ffb90[_0x6ce6('0x32')][_0x6ce6('0x40')]){_0x755f2[_0x6ce6('0x45')]=[{'all':!![]}];}_0x755f2=_['merge']({},_0x755f2,_0x4ffb90[_0x6ce6('0x3e')]);return db[_0x6ce6('0x3f')][_0x6ce6('0x46')](_0x755f2)[_0x6ce6('0x25')](handleEntityNotFound(_0x1648c6,null))[_0x6ce6('0x25')](respondWithResult(_0x1648c6,null))[_0x6ce6('0x42')](handleError(_0x1648c6,null));};exports[_0x6ce6('0x47')]=function(_0xf2e7d,_0xce1454){return db[_0x6ce6('0x3f')]['create'](_0xf2e7d['body'],{})[_0x6ce6('0x25')](function(_0x9d238f){var _0x3fea45=_0xf2e7d[_0x6ce6('0x48')][_0x6ce6('0x27')]({'plain':!![]});if(!_0x3fea45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3fea45['role']==='user'){var _0x1d3d55=_0x9d238f['get']({'plain':!![]});var _0x26c1ce=_0x6ce6('0x49');return db['UserProfileSection'][_0x6ce6('0x46')]({'where':{'name':_0x26c1ce,'userProfileId':_0x3fea45['userProfileId']},'raw':!![]})[_0x6ce6('0x25')](function(_0x176420){if(_0x176420&&_0x176420[_0x6ce6('0x4a')]===0x0){return db['UserProfileResource'][_0x6ce6('0x47')]({'name':_0x1d3d55['name'],'resourceId':_0x1d3d55['id'],'type':_0x176420[_0x6ce6('0x2b')],'sectionId':_0x176420['id']},{})['then'](function(){return _0x9d238f;});}else{return _0x9d238f;}})[_0x6ce6('0x42')](function(_0x3b4a7f){logger[_0x6ce6('0x29')](_0x6ce6('0x4b'),_0x3b4a7f);throw _0x3b4a7f;});}return _0x9d238f;})[_0x6ce6('0x25')](respondWithResult(_0xce1454,0xc9))[_0x6ce6('0x42')](handleError(_0xce1454,null));};exports[_0x6ce6('0x24')]=function(_0x14d308,_0x18218e){if(_0x14d308[_0x6ce6('0x4c')]['id']){delete _0x14d308[_0x6ce6('0x4c')]['id'];}return db[_0x6ce6('0x3f')][_0x6ce6('0x46')]({'where':{'id':_0x14d308[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x18218e,null))[_0x6ce6('0x25')](saveUpdates(_0x14d308[_0x6ce6('0x4c')],null))[_0x6ce6('0x25')](respondWithResult(_0x18218e,null))[_0x6ce6('0x42')](handleError(_0x18218e,null));};exports[_0x6ce6('0x26')]=function(_0xbed1a6,_0x500482){return db[_0x6ce6('0x3f')][_0x6ce6('0x46')]({'where':{'id':_0xbed1a6[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x500482,null))[_0x6ce6('0x25')](removeEntity(_0x500482,null))[_0x6ce6('0x42')](handleError(_0x500482,null));};exports['describe']=function(_0xbe1d75,_0x56f825){return db['WhatsappQueue']['describe']()[_0x6ce6('0x25')](respondWithResult(_0x56f825,null))[_0x6ce6('0x42')](handleError(_0x56f825,null));};exports[_0x6ce6('0x4d')]=function(_0x5cd6ae,_0x41c267,_0x3ebbb3){var _0x1005cc={'raw':!![],'where':{}},_0x233b42={},_0x9dad58;return db[_0x6ce6('0x3f')][_0x6ce6('0x4e')]({'where':{'id':_0x5cd6ae[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x41c267,null))['then'](function(_0x3e3079){if(_0x3e3079){_0x9dad58=_0x3e3079[_0x6ce6('0x27')]({'plain':!![]});_0x233b42[_0x6ce6('0x31')]=_[_0x6ce6('0x44')](db['UserWhatsappQueue'][_0x6ce6('0x2f')]);_0x233b42[_0x6ce6('0x32')]=_[_0x6ce6('0x44')](_0x5cd6ae[_0x6ce6('0x32')]);_0x233b42['filters']=_[_0x6ce6('0x33')](_0x233b42[_0x6ce6('0x31')],_0x233b42[_0x6ce6('0x32')]);_0x1005cc[_0x6ce6('0x35')]=_['intersection'](_0x233b42['model'],qs[_0x6ce6('0x34')](_0x5cd6ae[_0x6ce6('0x32')][_0x6ce6('0x34')]));_0x1005cc['attributes']=_0x1005cc[_0x6ce6('0x35')][_0x6ce6('0x36')]?_0x1005cc[_0x6ce6('0x35')]:_0x233b42[_0x6ce6('0x31')];if(!_0x5cd6ae[_0x6ce6('0x32')][_0x6ce6('0x4f')]('nolimit')){_0x1005cc['limit']=qs[_0x6ce6('0x1e')](_0x5cd6ae['query'][_0x6ce6('0x1e')]);_0x1005cc[_0x6ce6('0x1c')]=qs['offset'](_0x5cd6ae[_0x6ce6('0x32')]['offset']);}_0x1005cc['order']=qs[_0x6ce6('0x38')](_0x5cd6ae[_0x6ce6('0x32')][_0x6ce6('0x38')]);_0x1005cc[_0x6ce6('0x39')]=qs[_0x6ce6('0x3a')](_[_0x6ce6('0x50')](_0x5cd6ae[_0x6ce6('0x32')],_0x233b42[_0x6ce6('0x3a')]));_0x1005cc[_0x6ce6('0x39')][_0x6ce6('0x51')]=_0x3e3079['id'];if(_0x5cd6ae[_0x6ce6('0x32')][_0x6ce6('0x3b')]){_0x1005cc['where']=_[_0x6ce6('0x3c')](_0x1005cc[_0x6ce6('0x39')],{'$or':_[_0x6ce6('0x2e')](_0x1005cc['attributes'],function(_0xfbe3f){var _0x2138df={};_0x2138df[_0xfbe3f]={'$like':'%'+_0x5cd6ae[_0x6ce6('0x32')]['filter']+'%'};return _0x2138df;})});}_0x1005cc=_[_0x6ce6('0x3c')]({},_0x1005cc,_0x5cd6ae['options']);return db['UserWhatsappQueue'][_0x6ce6('0x52')](_0x1005cc);}})['then'](function(_0x419731){if(_0x419731){return db['User'][_0x6ce6('0x53')]({'where':{'id':_['map'](_0x419731,'UserId'),'role':_0x6ce6('0x54')},'attributes':['id',_0x6ce6('0x2b'),'whatsappPause',_0x6ce6('0x55'),_0x6ce6('0x56')]});}})['then'](function(_0x3dd0f5){if(_0x3dd0f5){return{'count':_0x3dd0f5['count'],'rows':_[_0x6ce6('0x2e')](_0x3dd0f5[_0x6ce6('0x41')],function(_0x2c3bed){return{'membername':_0x2c3bed[_0x6ce6('0x2b')],'UserId':_0x2c3bed['id'],'queue_name':_0x9dad58[_0x6ce6('0x2b')],'WhatsappQueueId':_0x9dad58['id'],'interface':util['format'](_0x6ce6('0x57'),_0x6ce6('0x58'),_0x2c3bed[_0x6ce6('0x2b')]),'penalty':0x0,'paused':_0x2c3bed[_0x6ce6('0x59')],'createdAt':_0x2c3bed[_0x6ce6('0x56')],'updatedAt':_0x2c3bed['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6ce6('0x25')](respondWithFilteredResult(_0x41c267,_0x1005cc))['catch'](handleError(_0x41c267,null));};exports['getTeams']=function(_0x5bd9a3,_0x50ca53,_0x4c2b65){var _0x456ec6={};var _0xb821f6={};var _0xb3a717;var _0x1e3781;return db['WhatsappQueue'][_0x6ce6('0x4e')]({'where':{'id':_0x5bd9a3['params']['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x50ca53,null))[_0x6ce6('0x25')](function(_0x42c1e0){if(_0x42c1e0){_0xb3a717=_0x42c1e0;_0xb821f6['model']=_[_0x6ce6('0x44')](db[_0x6ce6('0x5a')]['rawAttributes']);_0xb821f6['query']=_[_0x6ce6('0x44')](_0x5bd9a3[_0x6ce6('0x32')]);_0xb821f6[_0x6ce6('0x3a')]=_['intersection'](_0xb821f6[_0x6ce6('0x31')],_0xb821f6[_0x6ce6('0x32')]);_0x456ec6[_0x6ce6('0x35')]=_[_0x6ce6('0x33')](_0xb821f6[_0x6ce6('0x31')],qs[_0x6ce6('0x34')](_0x5bd9a3[_0x6ce6('0x32')]['fields']));_0x456ec6[_0x6ce6('0x35')]=_0x456ec6[_0x6ce6('0x35')][_0x6ce6('0x36')]?_0x456ec6['attributes']:_0xb821f6[_0x6ce6('0x31')];_0x456ec6[_0x6ce6('0x37')]=qs[_0x6ce6('0x38')](_0x5bd9a3[_0x6ce6('0x32')][_0x6ce6('0x38')]);_0x456ec6['where']=qs[_0x6ce6('0x3a')](_[_0x6ce6('0x50')](_0x5bd9a3[_0x6ce6('0x32')],_0xb821f6[_0x6ce6('0x3a')]));if(_0x5bd9a3[_0x6ce6('0x32')][_0x6ce6('0x3b')]){_0x456ec6[_0x6ce6('0x39')]=_['merge'](_0x456ec6[_0x6ce6('0x39')],{'$or':_[_0x6ce6('0x2e')](_0x456ec6[_0x6ce6('0x35')],function(_0x4321ee){var _0x5d978d={};_0x5d978d[_0x4321ee]={'$like':'%'+_0x5bd9a3[_0x6ce6('0x32')][_0x6ce6('0x3b')]+'%'};return _0x5d978d;})});}_0x456ec6=_[_0x6ce6('0x3c')]({},_0x456ec6,_0x5bd9a3['options']);return _0xb3a717[_0x6ce6('0x5b')](_0x456ec6);}})['then'](function(_0x22ec18){if(_0x22ec18){_0x1e3781=_0x22ec18[_0x6ce6('0x36')];if(!_0x5bd9a3['query'][_0x6ce6('0x4f')](_0x6ce6('0x5c'))){_0x456ec6['limit']=qs['limit'](_0x5bd9a3[_0x6ce6('0x32')][_0x6ce6('0x1e')]);_0x456ec6[_0x6ce6('0x1c')]=qs[_0x6ce6('0x1c')](_0x5bd9a3['query'][_0x6ce6('0x1c')]);}return _0xb3a717['getTeams'](_0x456ec6);}})[_0x6ce6('0x25')](function(_0x665de2){if(_0x665de2){return _0x665de2?{'count':_0x1e3781,'rows':_0x665de2}:null;}})[_0x6ce6('0x25')](respondWithResult(_0x50ca53,null))[_0x6ce6('0x42')](handleError(_0x50ca53,null));};exports['addTeams']=function(_0x589a1a,_0x3a07db,_0x35d41e){var _0x327a36=_0x589a1a[_0x6ce6('0x4c')][_0x6ce6('0x5d')];return db['Team'][_0x6ce6('0x52')]({'where':{'id':_0x327a36},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6ce6('0x5e'),'attributes':['id','name',_0x6ce6('0x5f'),_0x6ce6('0x60'),_0x6ce6('0x61')],'raw':!![]}]})[_0x6ce6('0x25')](function(_0xfa9a7d){if(_0xfa9a7d){var _0x3ef023=_[_0x6ce6('0x62')](_0xfa9a7d,function(_0x45c081){var _0xdea05d=_0x45c081[_0x6ce6('0x27')]({'plain':!![]});return _0xdea05d[_0x6ce6('0x5e')];});return db[_0x6ce6('0x3f')][_0x6ce6('0x46')]({'where':{'id':_0x589a1a['params']['id']}})['then'](function(_0x4db4bf){return db['sequelize'][_0x6ce6('0x63')](function(_0x30f249){return _0x4db4bf[_0x6ce6('0x64')](_0x327a36,{'transaction':_0x30f249})['then'](function(){return BPromise[_0x6ce6('0x65')](_0x3ef023,function(_0x14b336){return db[_0x6ce6('0x66')]['findOrCreate']({'where':{'UserId':_0x14b336['id'],'WhatsappQueueId':_0x589a1a[_0x6ce6('0x43')]['id']},'transaction':_0x30f249});});})[_0x6ce6('0x25')](function(){_0x3ef023['forEach'](function(_0x58e4b3){socket[_0x6ce6('0x67')](_0x6ce6('0x68'),{'UserId':_0x58e4b3['id'],'WhatsappQueueId':_0x4db4bf['id']});});});});});}})['then'](respondWithStatusCode(_0x3a07db,null))['catch'](handleError(_0x3a07db,null));};exports['removeTeams']=function(_0x9472de,_0x2a2e4b,_0xf6894f){return db[_0x6ce6('0x5a')][_0x6ce6('0x52')]({'where':{'id':_0x9472de['query'][_0x6ce6('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x6ce6('0x69')],'as':_0x6ce6('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a2e4b,null))['then'](function(_0x445c31){var _0x167d46=_['map'](_0x445c31,'id');var _0x1c7987=[];var _0x69e2cd=[];var _0x389d03=squel[_0x6ce6('0x6a')]();_0x389d03[_0x6ce6('0x6b')](_0x6ce6('0x6c'))['from'](_0x6ce6('0x6d'),'tq')[_0x6ce6('0x6e')]('user_has_teams','ut',_0x6ce6('0x6f'))[_0x6ce6('0x39')](_0x6ce6('0x70'),_0x9472de[_0x6ce6('0x43')]['id']);for(var _0x365857=0x0;_0x365857<_0x445c31['length'];_0x365857+=0x1){let _0x23c306=_0x445c31[_0x365857];for(var _0x3dc0fa=0x0;_0x3dc0fa<_0x23c306['Agents'][_0x6ce6('0x36')];_0x3dc0fa+=0x1){let _0x238809=_0x23c306['Agents'][_0x3dc0fa];var _0x59325d=_0x389d03[_0x6ce6('0x71')]();_0x59325d[_0x6ce6('0x39')]('ut.UserId\x20=\x20?',_0x238809['id']);_0x69e2cd[_0x6ce6('0x72')](db[_0x6ce6('0x73')][_0x6ce6('0x32')](_0x59325d[_0x6ce6('0x74')](),{'type':db[_0x6ce6('0x73')]['QueryTypes']['SELECT']})['then'](function(_0x52f119){if(_0x52f119['length']===0x1){return _0x238809['id'];}else{var _0x1205b1=_[_0x6ce6('0x75')](_[_0x6ce6('0x2e')](_0x52f119,_0x6ce6('0x76')),function(_0x434f5f){return _[_0x6ce6('0x77')](_0x167d46,_0x434f5f);});if(_0x1205b1){return _0x238809['id'];}}}));}}return BPromise['all'](_0x69e2cd)[_0x6ce6('0x25')](function(_0x4e3e04){_0x1c7987=_(_0x1c7987)['union'](_0x4e3e04)[_0x6ce6('0x78')]()[_0x6ce6('0x79')]();return db[_0x6ce6('0x3f')]['find']({'where':{'id':_0x9472de[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](function(_0x541676){return db['sequelize']['transaction'](function(_0x584215){return _0x541676[_0x6ce6('0x7a')](_0x9472de[_0x6ce6('0x32')]['ids'],{'transaction':_0x584215})[_0x6ce6('0x25')](function(){if(!_[_0x6ce6('0x7b')](_0x1c7987)){return _0x541676['removeAgents'](_0x1c7987,{'transaction':_0x584215});}})[_0x6ce6('0x25')](function(){_0x1c7987[_0x6ce6('0x7c')](function(_0xb26ed1){socket['emit'](_0x6ce6('0x7d'),{'UserId':_0xb26ed1,'WhatsappQueueId':_0x541676['id']});});});});});});})[_0x6ce6('0x25')](respondWithStatusCode(_0x2a2e4b,null))['catch'](handleError(_0x2a2e4b,null));};exports[_0x6ce6('0x7e')]=function(_0x5c486b,_0x22130b,_0x415cc4){return db[_0x6ce6('0x3f')]['find']({'where':{'id':_0x5c486b[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x22130b,null))[_0x6ce6('0x25')](function(_0x2e7ed2){if(_0x2e7ed2){return _0x2e7ed2[_0x6ce6('0x7e')](_0x5c486b[_0x6ce6('0x4c')][_0x6ce6('0x5d')],_[_0x6ce6('0x7f')](_0x5c486b['body'],[_0x6ce6('0x5d'),'id'])||{})[_0x6ce6('0x80')](function(_0x41a460){for(var _0x8da6f=0x0;_0x8da6f<_0x5c486b[_0x6ce6('0x4c')][_0x6ce6('0x5d')][_0x6ce6('0x36')];_0x8da6f+=0x1){socket['emit'](_0x6ce6('0x68'),{'UserId':Number(_0x5c486b[_0x6ce6('0x4c')]['ids'][_0x8da6f]),'WhatsappQueueId':Number(_0x5c486b['params']['id'])});}return _0x41a460;});}})[_0x6ce6('0x25')](respondWithResult(_0x22130b,null))[_0x6ce6('0x42')](handleError(_0x22130b,null));};exports['removeAgents']=function(_0x148e88,_0x225dd8,_0x2a6dda){return db[_0x6ce6('0x3f')][_0x6ce6('0x46')]({'where':{'id':_0x148e88[_0x6ce6('0x43')]['id']}})['then'](handleEntityNotFound(_0x225dd8,null))[_0x6ce6('0x25')](function(_0x318049){if(_0x318049){return _0x318049['removeAgents'](_0x148e88[_0x6ce6('0x32')][_0x6ce6('0x5d')])[_0x6ce6('0x25')](function(){if(_[_0x6ce6('0x81')](_0x148e88['query'][_0x6ce6('0x5d')])){for(var _0x2325a9=0x0;_0x2325a9<_0x148e88[_0x6ce6('0x32')][_0x6ce6('0x5d')][_0x6ce6('0x36')];_0x2325a9+=0x1){socket['emit'](_0x6ce6('0x7d'),{'UserId':Number(_0x148e88[_0x6ce6('0x32')]['ids'][_0x2325a9]),'WhatsappQueueId':Number(_0x148e88[_0x6ce6('0x43')]['id'])});}}else{socket['emit'](_0x6ce6('0x7d'),{'UserId':Number(_0x148e88['query'][_0x6ce6('0x5d')]),'WhatsappQueueId':Number(_0x148e88[_0x6ce6('0x43')]['id'])});}});}})[_0x6ce6('0x25')](respondWithStatusCode(_0x225dd8,null))[_0x6ce6('0x42')](handleError(_0x225dd8,null));};exports[_0x6ce6('0x82')]=function(_0x43a77b,_0x34c51b,_0x1a5fbd){var _0x2d17c0={};var _0x19a18a={};var _0xd157b;var _0x453239;return db[_0x6ce6('0x3f')][_0x6ce6('0x4e')]({'where':{'id':_0x43a77b[_0x6ce6('0x43')]['id']}})[_0x6ce6('0x25')](handleEntityNotFound(_0x34c51b,null))[_0x6ce6('0x25')](function(_0x181907){if(_0x181907){_0xd157b=_0x181907;_0x19a18a[_0x6ce6('0x31')]=_[_0x6ce6('0x44')](db[_0x6ce6('0x69')][_0x6ce6('0x2f')]);_0x19a18a[_0x6ce6('0x32')]=_[_0x6ce6('0x44')](_0x43a77b[_0x6ce6('0x32')]);_0x19a18a[_0x6ce6('0x3a')]=_[_0x6ce6('0x33')](_0x19a18a[_0x6ce6('0x31')],_0x19a18a['query']);_0x2d17c0[_0x6ce6('0x35')]=_[_0x6ce6('0x33')](_0x19a18a['model'],qs[_0x6ce6('0x34')](_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x34')]));_0x2d17c0[_0x6ce6('0x35')]=_0x2d17c0[_0x6ce6('0x35')]['length']?_0x2d17c0['attributes']:_0x19a18a[_0x6ce6('0x31')];_0x2d17c0['order']=qs['sort'](_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x38')]);_0x2d17c0[_0x6ce6('0x39')]=qs[_0x6ce6('0x3a')](_[_0x6ce6('0x50')](_0x43a77b[_0x6ce6('0x32')],_0x19a18a['filters']));if(_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x3b')]){_0x2d17c0[_0x6ce6('0x39')]=_[_0x6ce6('0x3c')](_0x2d17c0[_0x6ce6('0x39')],{'$or':_['map'](_0x2d17c0[_0x6ce6('0x35')],function(_0x463aca){var _0x4a189a={};_0x4a189a[_0x463aca]={'$like':'%'+_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x3b')]+'%'};return _0x4a189a;})});}_0x2d17c0=_[_0x6ce6('0x3c')]({},_0x2d17c0,_0x43a77b[_0x6ce6('0x3e')]);return _0xd157b[_0x6ce6('0x82')](_0x2d17c0);}})[_0x6ce6('0x25')](function(_0x381cc7){if(_0x381cc7){_0x453239=_0x381cc7[_0x6ce6('0x36')];if(!_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x4f')](_0x6ce6('0x5c'))){_0x2d17c0[_0x6ce6('0x1e')]=qs['limit'](_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x1e')]);_0x2d17c0[_0x6ce6('0x1c')]=qs[_0x6ce6('0x1c')](_0x43a77b[_0x6ce6('0x32')][_0x6ce6('0x1c')]);}return _0xd157b['getAgents'](_0x2d17c0);}})[_0x6ce6('0x25')](function(_0x1f74e9){if(_0x1f74e9){return _0x1f74e9?{'count':_0x453239,'rows':_0x1f74e9}:null;}})[_0x6ce6('0x25')](respondWithResult(_0x34c51b,null))[_0x6ce6('0x42')](handleError(_0x34c51b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4b5fda0..9e27e9c 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 _0xea3b=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x1c301f,_0x3147d2){var _0x534338=function(_0x29dd11){while(--_0x29dd11){_0x1c301f['push'](_0x1c301f['shift']());}};_0x534338(++_0x3147d2);}(_0xea3b,0x19f));var _0xbea3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xea3b[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xbea3('0x0'))['db'][_0xbea3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbea3('0x2')](0x0);var events={'afterCreate':_0xbea3('0x3'),'afterUpdate':_0xbea3('0x4'),'afterDestroy':_0xbea3('0x5')};function emitEvent(_0x4f08ad){return function(_0x298397,_0x209910,_0x45a377){WhatsappQueueEvents[_0xbea3('0x6')](_0x4f08ad+':'+_0x298397['id'],_0x298397);WhatsappQueueEvents[_0xbea3('0x6')](_0x4f08ad,_0x298397);_0x45a377(null);};}for(var e in events){if(events[_0xbea3('0x7')](e)){var event=events[e];WhatsappQueue[_0xbea3('0x8')](e,emitEvent(event));}}module[_0xbea3('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa176=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa176,0x9c));var _0x6a17=function(_0x3e70b2,_0x1c9271){_0x3e70b2=_0x3e70b2-0x0;var _0x14a451=_0xa176[_0x3e70b2];return _0x14a451;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x6a17('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6a17('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a17('0x2'),'afterDestroy':_0x6a17('0x3')};function emitEvent(_0x52ed8f){return function(_0x934e3f,_0x19b185,_0x4cb848){WhatsappQueueEvents[_0x6a17('0x4')](_0x52ed8f+':'+_0x934e3f['id'],_0x934e3f);WhatsappQueueEvents[_0x6a17('0x4')](_0x52ed8f,_0x934e3f);_0x4cb848(null);};}for(var e in events){if(events[_0x6a17('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x6a17('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 34af734..155e352 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 _0x1416=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x1416,0xe9));var _0x6141=function(_0x950e31,_0x299b10){_0x950e31=_0x950e31-0x0;var _0x472120=_0x1416[_0x950e31];return _0x472120;};'use strict';var _=require(_0x6141('0x0'));var util=require('util');var logger=require(_0x6141('0x1'))(_0x6141('0x2'));var moment=require('moment');var BPromise=require(_0x6141('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6141('0x4'));var rimraf=require(_0x6141('0x5'));var config=require(_0x6141('0x6'));var attributes=require(_0x6141('0x7'));module[_0x6141('0x8')]=function(_0x4e3b36,_0x76acc8){return _0x4e3b36['define'](_0x6141('0x9'),attributes,{'tableName':_0x6141('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8705=['moment','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger'];(function(_0x2d70e3,_0xfa2091){var _0x1b91e6=function(_0x272651){while(--_0x272651){_0x2d70e3['push'](_0x2d70e3['shift']());}};_0x1b91e6(++_0xfa2091);}(_0x8705,0x1b6));var _0x5870=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8705[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5870('0x0'));var util=require(_0x5870('0x1'));var logger=require(_0x5870('0x2'))('api');var moment=require(_0x5870('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(_0x5870('0x4'));var attributes=require(_0x5870('0x5'));module[_0x5870('0x6')]=function(_0x2015fc,_0x280aaa){return _0x2015fc[_0x5870('0x7')](_0x5870('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 9cda19a..afdf7c2 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 _0x0707=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','then','ShowWhatsappQueue','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x0707,0x91));var _0x7070=function(_0x402869,_0x327918){_0x402869=_0x402869-0x0;var _0x365a0d=_0x0707[_0x402869];return _0x365a0d;};'use strict';var _=require(_0x7070('0x0'));var util=require(_0x7070('0x1'));var moment=require(_0x7070('0x2'));var BPromise=require(_0x7070('0x3'));var rs=require(_0x7070('0x4'));var fs=require('fs');var Redis=require(_0x7070('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7070('0x6'));var logger=require(_0x7070('0x7'))(_0x7070('0x8'));var config=require('../../config/environment');var jayson=require(_0x7070('0x9'));var client=jayson[_0x7070('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7070('0xb')](config[_0x7070('0xc')],{'host':_0x7070('0xd'),'port':0x18eb});var socket=require(_0x7070('0xe'))(new Redis(config[_0x7070('0xc')]));require(_0x7070('0xf'))[_0x7070('0x10')](socket);function respondWithRpcPromise(_0x41fd2e,_0x348ce2,_0x58b592){return new BPromise(function(_0x40b72c,_0x30cb60){return client['request'](_0x41fd2e,_0x58b592)['then'](function(_0x485208){logger[_0x7070('0x11')](_0x7070('0x12'),_0x348ce2,_0x7070('0x13'));logger[_0x7070('0x14')](_0x7070('0x15'),_0x348ce2,_0x7070('0x13'),JSON[_0x7070('0x16')](_0x485208));if(_0x485208[_0x7070('0x17')]){if(_0x485208[_0x7070('0x17')][_0x7070('0x18')]===0x1f4){logger[_0x7070('0x17')](_0x7070('0x12'),_0x348ce2,_0x485208[_0x7070('0x17')]['message']);return _0x30cb60(_0x485208[_0x7070('0x17')][_0x7070('0x19')]);}logger['error'](_0x7070('0x12'),_0x348ce2,_0x485208['error'][_0x7070('0x19')]);return _0x40b72c(_0x485208['error']['message']);}else{logger[_0x7070('0x11')](_0x7070('0x12'),_0x348ce2,_0x7070('0x13'));_0x40b72c(_0x485208['result'][_0x7070('0x19')]);}})[_0x7070('0x1a')](function(_0x2d22da){logger[_0x7070('0x17')](_0x7070('0x12'),_0x348ce2,_0x2d22da);_0x30cb60(_0x2d22da);});});}exports[_0x7070('0x1b')]=function(_0x1fcd7e){var _0x4a51f4=this;return new Promise(function(_0x2c3e8c,_0x3f1417){return db[_0x7070('0x1c')][_0x7070('0x1d')]({'raw':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e['options'][_0x7070('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fcd7e['options']?_0x1fcd7e['options'][_0x7070('0x20')]||null:null,'attributes':_0x1fcd7e['options']?_0x1fcd7e['options'][_0x7070('0x21')]||null:null,'limit':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e[_0x7070('0x1e')][_0x7070('0x22')]||null:null,'include':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e['options'][_0x7070('0x23')]?_['map'](_0x1fcd7e[_0x7070('0x1e')]['include'],function(_0x268289){return{'model':db[_0x268289[_0x7070('0x24')]],'as':_0x268289['as'],'attributes':_0x268289['attributes'],'include':_0x268289[_0x7070('0x23')]?_['map'](_0x268289[_0x7070('0x23')],function(_0x4508aa){return{'model':db[_0x4508aa[_0x7070('0x24')]],'as':_0x4508aa['as'],'attributes':_0x4508aa[_0x7070('0x21')],'include':_0x4508aa[_0x7070('0x23')]?_['map'](_0x4508aa[_0x7070('0x23')],function(_0x4559d3){return{'model':db[_0x4559d3[_0x7070('0x24')]],'as':_0x4559d3['as'],'attributes':_0x4559d3[_0x7070('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7070('0x25')](function(_0x3b15dc){logger[_0x7070('0x11')](_0x7070('0x1b'),_0x1fcd7e);logger[_0x7070('0x14')]('GetWhatsappQueue',_0x1fcd7e,JSON[_0x7070('0x16')](_0x3b15dc));_0x2c3e8c(_0x3b15dc);})[_0x7070('0x1a')](function(_0x873f22){logger['error'](_0x7070('0x1b'),_0x873f22[_0x7070('0x19')],_0x1fcd7e);_0x3f1417(_0x4a51f4['error'](0x1f4,_0x873f22[_0x7070('0x19')]));});});};exports[_0x7070('0x26')]=function(_0x1e5f05){var _0x14e1c6=this;return new Promise(function(_0x1ca334,_0xc34e88){return db[_0x7070('0x1c')][_0x7070('0x27')]({'raw':_0x1e5f05['options']?_0x1e5f05['options'][_0x7070('0x1f')]===undefined?!![]:![]:!![],'where':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05['options'][_0x7070('0x20')]||null:null,'attributes':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05[_0x7070('0x1e')]['attributes']||null:null,'include':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05['options']['include']?_[_0x7070('0x28')](_0x1e5f05['options'][_0x7070('0x23')],function(_0x57506f){return{'model':db[_0x57506f[_0x7070('0x24')]],'as':_0x57506f['as'],'attributes':_0x57506f[_0x7070('0x21')],'include':_0x57506f[_0x7070('0x23')]?_['map'](_0x57506f[_0x7070('0x23')],function(_0x211ed9){return{'model':db[_0x211ed9[_0x7070('0x24')]],'as':_0x211ed9['as'],'attributes':_0x211ed9[_0x7070('0x21')],'include':_0x211ed9['include']?_[_0x7070('0x28')](_0x211ed9[_0x7070('0x23')],function(_0x47b71d){return{'model':db[_0x47b71d[_0x7070('0x24')]],'as':_0x47b71d['as'],'attributes':_0x47b71d[_0x7070('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7070('0x25')](function(_0x20868b){logger[_0x7070('0x11')](_0x7070('0x26'),_0x1e5f05);logger[_0x7070('0x14')](_0x7070('0x26'),_0x1e5f05,JSON['stringify'](_0x20868b));_0x1ca334(_0x20868b);})[_0x7070('0x1a')](function(_0x511a3f){logger[_0x7070('0x17')]('ShowWhatsappQueue',_0x511a3f[_0x7070('0x19')],_0x1e5f05);_0xc34e88(_0x14e1c6[_0x7070('0x17')](0x1f4,_0x511a3f['message']));});});}; \ No newline at end of file +var _0x130d=['../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x130d,0x1cd));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd130('0x0'));var moment=require(_0xd130('0x1'));var BPromise=require(_0xd130('0x2'));var rs=require(_0xd130('0x3'));var fs=require('fs');var Redis=require(_0xd130('0x4'));var db=require(_0xd130('0x5'))['db'];var utils=require(_0xd130('0x6'));var logger=require(_0xd130('0x7'))(_0xd130('0x8'));var config=require(_0xd130('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd130('0xa')]=_[_0xd130('0xb')](config[_0xd130('0xa')],{'host':_0xd130('0xc'),'port':0x18eb});var socket=require(_0xd130('0xd'))(new Redis(config[_0xd130('0xa')]));require('./whatsappQueue.socket')[_0xd130('0xe')](socket);function respondWithRpcPromise(_0x48e9f7,_0x46476a,_0x2f726b){return new BPromise(function(_0x39e09e,_0x2b18d1){return client['request'](_0x48e9f7,_0x2f726b)[_0xd130('0xf')](function(_0x472fff){logger[_0xd130('0x10')](_0xd130('0x11'),_0x46476a,'request\x20sent');logger[_0xd130('0x12')](_0xd130('0x13'),_0x46476a,_0xd130('0x14'),JSON['stringify'](_0x472fff));if(_0x472fff['error']){if(_0x472fff[_0xd130('0x15')][_0xd130('0x16')]===0x1f4){logger['error'](_0xd130('0x11'),_0x46476a,_0x472fff[_0xd130('0x15')]['message']);return _0x2b18d1(_0x472fff[_0xd130('0x15')][_0xd130('0x17')]);}logger[_0xd130('0x15')](_0xd130('0x11'),_0x46476a,_0x472fff[_0xd130('0x15')][_0xd130('0x17')]);return _0x39e09e(_0x472fff[_0xd130('0x15')][_0xd130('0x17')]);}else{logger[_0xd130('0x10')](_0xd130('0x11'),_0x46476a,_0xd130('0x14'));_0x39e09e(_0x472fff[_0xd130('0x18')][_0xd130('0x17')]);}})[_0xd130('0x19')](function(_0xacecae){logger[_0xd130('0x15')](_0xd130('0x11'),_0x46476a,_0xacecae);_0x2b18d1(_0xacecae);});});}exports[_0xd130('0x1a')]=function(_0x27b3e8){var _0xff752f=this;return new Promise(function(_0x5cbcb5,_0x152ab7){return db[_0xd130('0x1b')]['findAll']({'raw':_0x27b3e8[_0xd130('0x1c')]?_0x27b3e8[_0xd130('0x1c')][_0xd130('0x1d')]===undefined?!![]:![]:!![],'where':_0x27b3e8[_0xd130('0x1c')]?_0x27b3e8[_0xd130('0x1c')]['where']||null:null,'attributes':_0x27b3e8[_0xd130('0x1c')]?_0x27b3e8['options']['attributes']||null:null,'limit':_0x27b3e8[_0xd130('0x1c')]?_0x27b3e8['options'][_0xd130('0x1e')]||null:null,'include':_0x27b3e8[_0xd130('0x1c')]?_0x27b3e8[_0xd130('0x1c')][_0xd130('0x1f')]?_[_0xd130('0x20')](_0x27b3e8['options'][_0xd130('0x1f')],function(_0x973aa5){return{'model':db[_0x973aa5[_0xd130('0x21')]],'as':_0x973aa5['as'],'attributes':_0x973aa5[_0xd130('0x22')],'include':_0x973aa5['include']?_['map'](_0x973aa5['include'],function(_0x4e44e1){return{'model':db[_0x4e44e1[_0xd130('0x21')]],'as':_0x4e44e1['as'],'attributes':_0x4e44e1[_0xd130('0x22')],'include':_0x4e44e1['include']?_[_0xd130('0x20')](_0x4e44e1[_0xd130('0x1f')],function(_0x17542a){return{'model':db[_0x17542a[_0xd130('0x21')]],'as':_0x17542a['as'],'attributes':_0x17542a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40ef54){logger[_0xd130('0x10')](_0xd130('0x1a'),_0x27b3e8);logger[_0xd130('0x12')]('GetWhatsappQueue',_0x27b3e8,JSON[_0xd130('0x23')](_0x40ef54));_0x5cbcb5(_0x40ef54);})[_0xd130('0x19')](function(_0xebc13b){logger[_0xd130('0x15')](_0xd130('0x1a'),_0xebc13b[_0xd130('0x17')],_0x27b3e8);_0x152ab7(_0xff752f['error'](0x1f4,_0xebc13b[_0xd130('0x17')]));});});};exports[_0xd130('0x24')]=function(_0x2affa2){var _0x5c4f24=this;return new Promise(function(_0x50601b,_0x1d5552){return db['WhatsappQueue'][_0xd130('0x25')]({'raw':_0x2affa2['options']?_0x2affa2['options']['raw']===undefined?!![]:![]:!![],'where':_0x2affa2['options']?_0x2affa2[_0xd130('0x1c')][_0xd130('0x26')]||null:null,'attributes':_0x2affa2[_0xd130('0x1c')]?_0x2affa2['options'][_0xd130('0x22')]||null:null,'include':_0x2affa2[_0xd130('0x1c')]?_0x2affa2[_0xd130('0x1c')]['include']?_[_0xd130('0x20')](_0x2affa2[_0xd130('0x1c')]['include'],function(_0x5daaca){return{'model':db[_0x5daaca[_0xd130('0x21')]],'as':_0x5daaca['as'],'attributes':_0x5daaca[_0xd130('0x22')],'include':_0x5daaca[_0xd130('0x1f')]?_[_0xd130('0x20')](_0x5daaca['include'],function(_0x40c1bc){return{'model':db[_0x40c1bc[_0xd130('0x21')]],'as':_0x40c1bc['as'],'attributes':_0x40c1bc[_0xd130('0x22')],'include':_0x40c1bc[_0xd130('0x1f')]?_[_0xd130('0x20')](_0x40c1bc[_0xd130('0x1f')],function(_0x4e4dd1){return{'model':db[_0x4e4dd1['model']],'as':_0x4e4dd1['as'],'attributes':_0x4e4dd1[_0xd130('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd130('0xf')](function(_0x581cc5){logger['info'](_0xd130('0x24'),_0x2affa2);logger[_0xd130('0x12')](_0xd130('0x24'),_0x2affa2,JSON[_0xd130('0x23')](_0x581cc5));_0x50601b(_0x581cc5);})[_0xd130('0x19')](function(_0x5b2249){logger[_0xd130('0x15')](_0xd130('0x24'),_0x5b2249[_0xd130('0x17')],_0x2affa2);_0x1d5552(_0x5c4f24[_0xd130('0x15')](0x1f4,_0x5b2249['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index bf597ab..9426da9 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 _0xb9f5=['length','whatsappQueue:','save','remove','emit'];(function(_0x190325,_0x27adef){var _0x1b4c89=function(_0xd01a43){while(--_0xd01a43){_0x190325['push'](_0x190325['shift']());}};_0x1b4c89(++_0x27adef);}(_0xb9f5,0x165));var _0x5b9f=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xb9f5[_0x37ffea];return _0x2e2615;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x5b9f('0x0'),_0x5b9f('0x1'),'update'];function createListener(_0x350de3,_0x587de7){return function(_0x1604ed){_0x587de7[_0x5b9f('0x2')](_0x350de3,_0x1604ed);};}function removeListener(_0x1e05a6,_0x159271){return function(){WhatsappQueueEvents['removeListener'](_0x1e05a6,_0x159271);};}exports['register']=function(_0x643a63){for(var _0x435bf3=0x0,_0x119749=events[_0x5b9f('0x3')];_0x435bf3<_0x119749;_0x435bf3++){var _0xd834de=events[_0x435bf3];var _0x2e1b67=createListener(_0x5b9f('0x4')+_0xd834de,_0x643a63);WhatsappQueueEvents['on'](_0xd834de,_0x2e1b67);}}; \ No newline at end of file +var _0x042c=['remove','update','emit','removeListener','length','save'];(function(_0x399ad3,_0x249e0f){var _0x290fed=function(_0x2c9415){while(--_0x2c9415){_0x399ad3['push'](_0x399ad3['shift']());}};_0x290fed(++_0x249e0f);}(_0x042c,0x119));var _0xc042=function(_0x497c3e,_0x2456fd){_0x497c3e=_0x497c3e-0x0;var _0x18332b=_0x042c[_0x497c3e];return _0x18332b;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xc042('0x0'),_0xc042('0x1'),_0xc042('0x2')];function createListener(_0x397968,_0x1f00d){return function(_0x1703aa){_0x1f00d[_0xc042('0x3')](_0x397968,_0x1703aa);};}function removeListener(_0xfb07e8,_0x2fa597){return function(){WhatsappQueueEvents[_0xc042('0x4')](_0xfb07e8,_0x2fa597);};}exports['register']=function(_0x5cfd05){for(var _0x4cf462=0x0,_0xadf002=events[_0xc042('0x5')];_0x4cf462<_0xadf002;_0x4cf462++){var _0x5dec7d=events[_0x4cf462];var _0x4104cb=createListener('whatsappQueue:'+_0x5dec7d,_0x5cfd05);WhatsappQueueEvents['on'](_0x5dec7d,_0x4104cb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ca6d560..2c41b7a 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 _0xd3f0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xd3f0,0x160));var _0x0d3f=function(_0x4f41a0,_0xeb6e74){_0x4f41a0=_0x4f41a0-0x0;var _0x1618cd=_0xd3f0[_0x4f41a0];return _0x1618cd;};'use strict';var multer=require(_0x0d3f('0x0'));var util=require(_0x0d3f('0x1'));var path=require(_0x0d3f('0x2'));var timeout=require(_0x0d3f('0x3'));var express=require(_0x0d3f('0x4'));var router=express[_0x0d3f('0x5')]();var fs_extra=require(_0x0d3f('0x6'));var auth=require(_0x0d3f('0x7'));var interaction=require(_0x0d3f('0x8'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0xa')]);router[_0x0d3f('0xb')](_0x0d3f('0xc'),auth[_0x0d3f('0x9')](),controller['describe']);router[_0x0d3f('0xb')](_0x0d3f('0xd'),auth[_0x0d3f('0x9')](),controller[_0x0d3f('0xe')]);router[_0x0d3f('0xf')]('/',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0x10')]);router[_0x0d3f('0x11')]('/:id',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0x12')]);router[_0x0d3f('0x13')](_0x0d3f('0xd'),auth['isAuthenticated'](),controller[_0x0d3f('0x14')]);module[_0x0d3f('0x15')]=router; \ No newline at end of file +var _0xfa0e=['post','create','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfa0e,0x123));var _0xefa0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa0e[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xefa0('0x0'));var express=require(_0xefa0('0x1'));var router=express['Router']();var fs_extra=require(_0xefa0('0x2'));var auth=require(_0xefa0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xefa0('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xefa0('0x5')]('/',auth[_0xefa0('0x6')](),controller[_0xefa0('0x7')]);router['get'](_0xefa0('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xefa0('0x5')]('/:id',auth[_0xefa0('0x6')](),controller['show']);router[_0xefa0('0x9')]('/',auth['isAuthenticated'](),controller[_0xefa0('0xa')]);router['put']('/:id',auth[_0xefa0('0x6')](),controller[_0xefa0('0xb')]);router[_0xefa0('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xefa0('0xd')]);module[_0xefa0('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ab0e383..1d3ac0b 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4240f7,_0x50daab){var _0x2c2564=function(_0x1c550e){while(--_0x1c550e){_0x4240f7['push'](_0x4240f7['shift']());}};_0x2c2564(++_0x50daab);}(_0x7a54,0x106));var _0x47a5=function(_0x50fe87,_0x3bec30){_0x50fe87=_0x50fe87-0x0;var _0x327051=_0x7a54[_0x50fe87];return _0x327051;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x591355,_0x533447){var _0x34c4e3=function(_0x4f2bd9){while(--_0x4f2bd9){_0x591355['push'](_0x591355['shift']());}};_0x34c4e3(++_0x533447);}(_0x7a54,0x106));var _0x47a5=function(_0x344caa,_0x2de456){_0x344caa=_0x344caa-0x0;var _0x1fddd4=_0x7a54[_0x344caa];return _0x1fddd4;};'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 f156c48..e221792 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xdd15fd,_0x161a0a){var _0x3d71fd=function(_0x128859){while(--_0x128859){_0xdd15fd['push'](_0xdd15fd['shift']());}};_0x3d71fd(++_0x161a0a);}(_0x373d,0x1e2));var _0xd373=function(_0x1aaf71,_0x495878){_0x1aaf71=_0x1aaf71-0x0;var _0x1a3993=_0x373d[_0x1aaf71];return _0x1a3993;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x5872c9,_0x37822b){var _0x13170f=function(_0x3ab494){while(--_0x3ab494){_0x5872c9['push'](_0x5872c9['shift']());}};_0x13170f(++_0x37822b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x512051,_0x2efc29){_0x512051=_0x512051-0x0;var _0x177771=_0x02ce[_0x512051];return _0x177771;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 175f68a..4bef11d 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 _0x0e78=['path','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd9e1a7,_0x5f5386){var _0x105ce1=function(_0x472be8){while(--_0x472be8){_0xd9e1a7['push'](_0xd9e1a7['shift']());}};_0x105ce1(++_0x5f5386);}(_0x0e78,0x1f4));var _0x80e7=function(_0x28560c,_0x4bcb77){_0x28560c=_0x28560c-0x0;var _0x464398=_0x0e78[_0x28560c];return _0x464398;};'use strict';var _=require(_0x80e7('0x0'));var util=require(_0x80e7('0x1'));var logger=require(_0x80e7('0x2'))(_0x80e7('0x3'));var moment=require(_0x80e7('0x4'));var BPromise=require(_0x80e7('0x5'));var rp=require(_0x80e7('0x6'));var fs=require('fs');var path=require(_0x80e7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80e7('0x8'));module[_0x80e7('0x9')]=function(_0x337728,_0x3cbc2a){return _0x337728[_0x80e7('0xa')](_0x80e7('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x80e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe796=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xe796,0xa2));var _0x6e79=function(_0xb591f0,_0x319160){_0xb591f0=_0xb591f0-0x0;var _0x3055ae=_0xe796[_0xb591f0];return _0x3055ae;};'use strict';var _=require('lodash');var util=require(_0x6e79('0x0'));var logger=require(_0x6e79('0x1'))(_0x6e79('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6e79('0x3'));var fs=require('fs');var path=require(_0x6e79('0x4'));var rimraf=require(_0x6e79('0x5'));var config=require(_0x6e79('0x6'));var attributes=require(_0x6e79('0x7'));module['exports']=function(_0xa9ba6b,_0x1d39e1){return _0xa9ba6b['define'](_0x6e79('0x8'),attributes,{'tableName':_0x6e79('0x9'),'paranoid':![],'indexes':[{'name':_0x6e79('0xa'),'fields':[_0x6e79('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index b37810c..2cf14a4 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 _0x7720=['request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','debug','stringify','update','where','attributes','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x3dbbb7,_0x9f32b8){var _0x1cf503=function(_0x3e4605){while(--_0x3e4605){_0x3dbbb7['push'](_0x3dbbb7['shift']());}};_0x1cf503(++_0x9f32b8);}(_0x7720,0x172));var _0x0772=function(_0x5d9601,_0x17868e){_0x5d9601=_0x5d9601-0x0;var _0x3fdb5c=_0x7720[_0x5d9601];return _0x3fdb5c;};'use strict';var _=require('lodash');var util=require(_0x0772('0x0'));var moment=require(_0x0772('0x1'));var BPromise=require(_0x0772('0x2'));var rs=require(_0x0772('0x3'));var fs=require('fs');var Redis=require(_0x0772('0x4'));var db=require(_0x0772('0x5'))['db'];var utils=require(_0x0772('0x6'));var logger=require(_0x0772('0x7'))(_0x0772('0x8'));var config=require(_0x0772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0772('0xa')][_0x0772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c128,_0x3a964a,_0x434feb){return new BPromise(function(_0x11a98a,_0x2e7164){return client[_0x0772('0xc')](_0x56c128,_0x434feb)['then'](function(_0x1a3ba2){logger[_0x0772('0xd')](_0x0772('0xe'),_0x3a964a,_0x0772('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3a964a,_0x0772('0xf'),JSON['stringify'](_0x1a3ba2));if(_0x1a3ba2[_0x0772('0x10')]){if(_0x1a3ba2[_0x0772('0x10')][_0x0772('0x11')]===0x1f4){logger[_0x0772('0x10')](_0x0772('0xe'),_0x3a964a,_0x1a3ba2[_0x0772('0x10')]['message']);return _0x2e7164(_0x1a3ba2['error'][_0x0772('0x12')]);}logger[_0x0772('0x10')](_0x0772('0xe'),_0x3a964a,_0x1a3ba2[_0x0772('0x10')][_0x0772('0x12')]);return _0x11a98a(_0x1a3ba2[_0x0772('0x10')][_0x0772('0x12')]);}else{logger[_0x0772('0xd')](_0x0772('0xe'),_0x3a964a,'request\x20sent');_0x11a98a(_0x1a3ba2[_0x0772('0x13')]['message']);}})[_0x0772('0x14')](function(_0x4deafd){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3a964a,_0x4deafd);_0x2e7164(_0x4deafd);});});}exports[_0x0772('0x15')]=function(_0x2183ec){var _0x1fa649=this;return new Promise(function(_0x58ac3a,_0x3e055b){return db[_0x0772('0x16')][_0x0772('0x17')](_0x2183ec[_0x0772('0x18')],{'raw':_0x2183ec[_0x0772('0x19')]?_0x2183ec[_0x0772('0x19')][_0x0772('0x1a')]===undefined?!![]:![]:!![]})[_0x0772('0x1b')](function(_0x3cf2eb){logger[_0x0772('0xd')](_0x0772('0x15'),_0x2183ec);logger[_0x0772('0x1c')](_0x0772('0x15'),_0x2183ec,JSON[_0x0772('0x1d')](_0x3cf2eb));_0x58ac3a(_0x3cf2eb);})[_0x0772('0x14')](function(_0x58425c){logger[_0x0772('0x10')]('CreateWhatsappQueueReport',_0x58425c[_0x0772('0x12')],_0x2183ec);_0x3e055b(_0x1fa649['error'](0x1f4,_0x58425c['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x5e6e82){var _0x4d6fba=this;return new Promise(function(_0x511609,_0x25a5d4){return db[_0x0772('0x16')][_0x0772('0x1e')](_0x5e6e82[_0x0772('0x18')],{'raw':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x1f')]||null:null,'attributes':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x20')]||null:null,'limit':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82['options'][_0x0772('0x21')]||null:null})[_0x0772('0x1b')](function(_0x340ffc){logger['info']('UpdateWhatsappQueueReport',_0x5e6e82);logger['debug'](_0x0772('0x22'),_0x5e6e82,JSON[_0x0772('0x1d')](_0x340ffc));_0x511609(_0x340ffc);})[_0x0772('0x14')](function(_0x1dc616){logger['error'](_0x0772('0x22'),_0x1dc616[_0x0772('0x12')],_0x5e6e82);_0x25a5d4(_0x4d6fba[_0x0772('0x10')](0x1f4,_0x1dc616['message']));});});}; \ No newline at end of file +var _0x457e=['error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','UpdateWhatsappQueueReport','body','where','attributes','limit','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x457e,0xa6));var _0xe457=function(_0x4a35c1,_0x282706){_0x4a35c1=_0x4a35c1-0x0;var _0xa8c9e8=_0x457e[_0x4a35c1];return _0xa8c9e8;};'use strict';var _=require(_0xe457('0x0'));var util=require('util');var moment=require(_0xe457('0x1'));var BPromise=require('bluebird');var rs=require(_0xe457('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe457('0x3'));var logger=require(_0xe457('0x4'))('rpc');var config=require(_0xe457('0x5'));var jayson=require(_0xe457('0x6'));var client=jayson[_0xe457('0x7')][_0xe457('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5be516,_0x3da34e,_0x27a3b0){return new BPromise(function(_0x278551,_0x5cc9df){return client[_0xe457('0x9')](_0x5be516,_0x27a3b0)[_0xe457('0xa')](function(_0x14a147){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x3da34e,'request\x20sent');logger[_0xe457('0xb')](_0xe457('0xc'),_0x3da34e,'request\x20sent',JSON[_0xe457('0xd')](_0x14a147));if(_0x14a147[_0xe457('0xe')]){if(_0x14a147[_0xe457('0xe')][_0xe457('0xf')]===0x1f4){logger['error'](_0xe457('0x10'),_0x3da34e,_0x14a147[_0xe457('0xe')]['message']);return _0x5cc9df(_0x14a147[_0xe457('0xe')][_0xe457('0x11')]);}logger[_0xe457('0xe')](_0xe457('0x10'),_0x3da34e,_0x14a147[_0xe457('0xe')][_0xe457('0x11')]);return _0x278551(_0x14a147[_0xe457('0xe')][_0xe457('0x11')]);}else{logger[_0xe457('0x12')](_0xe457('0x10'),_0x3da34e,'request\x20sent');_0x278551(_0x14a147[_0xe457('0x13')][_0xe457('0x11')]);}})[_0xe457('0x14')](function(_0x580d8a){logger[_0xe457('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3da34e,_0x580d8a);_0x5cc9df(_0x580d8a);});});}exports[_0xe457('0x15')]=function(_0x858229){var _0x3614de=this;return new Promise(function(_0x29ce6c,_0x2ca3dd){return db[_0xe457('0x16')]['create'](_0x858229['body'],{'raw':_0x858229[_0xe457('0x17')]?_0x858229['options'][_0xe457('0x18')]===undefined?!![]:![]:!![]})[_0xe457('0xa')](function(_0x43bee3){logger[_0xe457('0x12')]('CreateWhatsappQueueReport',_0x858229);logger[_0xe457('0xb')](_0xe457('0x15'),_0x858229,JSON[_0xe457('0xd')](_0x43bee3));_0x29ce6c(_0x43bee3);})['catch'](function(_0x405d07){logger[_0xe457('0xe')](_0xe457('0x15'),_0x405d07[_0xe457('0x11')],_0x858229);_0x2ca3dd(_0x3614de['error'](0x1f4,_0x405d07[_0xe457('0x11')]));});});};exports[_0xe457('0x19')]=function(_0xb157f7){var _0x126880=this;return new Promise(function(_0x3736a7,_0x54345e){return db['WhatsappQueueReport']['update'](_0xb157f7[_0xe457('0x1a')],{'raw':_0xb157f7[_0xe457('0x17')]?_0xb157f7[_0xe457('0x17')][_0xe457('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb157f7[_0xe457('0x17')]?_0xb157f7[_0xe457('0x17')][_0xe457('0x1b')]||null:null,'attributes':_0xb157f7[_0xe457('0x17')]?_0xb157f7[_0xe457('0x17')][_0xe457('0x1c')]||null:null,'limit':_0xb157f7['options']?_0xb157f7['options'][_0xe457('0x1d')]||null:null})['then'](function(_0x50cb00){logger[_0xe457('0x12')](_0xe457('0x19'),_0xb157f7);logger['debug'](_0xe457('0x19'),_0xb157f7,JSON['stringify'](_0x50cb00));_0x3736a7(_0x50cb00);})[_0xe457('0x14')](function(_0x16b82d){logger[_0xe457('0xe')]('UpdateWhatsappQueueReport',_0x16b82d['message'],_0xb157f7);_0x54345e(_0x126880['error'](0x1f4,_0x16b82d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4041071..54d0051 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 _0x7e93=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7e93,0x145));var _0x37e9=function(_0x23ab43,_0x548e4b){_0x23ab43=_0x23ab43-0x0;var _0x3df4dc=_0x7e93[_0x23ab43];return _0x3df4dc;};'use strict';var multer=require(_0x37e9('0x0'));var util=require(_0x37e9('0x1'));var path=require(_0x37e9('0x2'));var timeout=require(_0x37e9('0x3'));var express=require(_0x37e9('0x4'));var router=express[_0x37e9('0x5')]();var fs_extra=require(_0x37e9('0x6'));var auth=require(_0x37e9('0x7'));var interaction=require(_0x37e9('0x8'));var config=require(_0x37e9('0x9'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x37e9('0xa')](),controller[_0x37e9('0xb')]);router[_0x37e9('0xc')](_0x37e9('0xd'),auth[_0x37e9('0xa')](),controller[_0x37e9('0xe')]);router[_0x37e9('0xc')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller[_0x37e9('0x10')]);router['post']('/',auth[_0x37e9('0xa')](),controller[_0x37e9('0x11')]);router[_0x37e9('0x12')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller[_0x37e9('0x13')]);router[_0x37e9('0x14')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller['destroy']);module[_0x37e9('0x15')]=router; \ No newline at end of file +var _0xe72f=['update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x3233c3,_0x15e5fa){var _0x36029b=function(_0xe3dd12){while(--_0xe3dd12){_0x3233c3['push'](_0x3233c3['shift']());}};_0x36029b(++_0x15e5fa);}(_0xe72f,0x102));var _0xfe72=function(_0x222cfe,_0x5387c1){_0x222cfe=_0x222cfe-0x0;var _0x560a59=_0xe72f[_0x222cfe];return _0x560a59;};'use strict';var multer=require('multer');var util=require(_0xfe72('0x0'));var path=require(_0xfe72('0x1'));var timeout=require(_0xfe72('0x2'));var express=require(_0xfe72('0x3'));var router=express[_0xfe72('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfe72('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe72('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xfe72('0x7')]('/',auth[_0xfe72('0x8')](),controller[_0xfe72('0x9')]);router[_0xfe72('0x7')](_0xfe72('0xa'),auth[_0xfe72('0x8')](),controller[_0xfe72('0xb')]);router[_0xfe72('0x7')](_0xfe72('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfe72('0xd')]('/',auth[_0xfe72('0x8')](),controller['create']);router['put'](_0xfe72('0xc'),auth[_0xfe72('0x8')](),controller[_0xfe72('0xe')]);router[_0xfe72('0xf')](_0xfe72('0xc'),auth[_0xfe72('0x8')](),controller[_0xfe72('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d378c20..98d4e1b 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 _0x47d6=['exports','STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x3014e1,_0xd20822){var _0x5a5818=function(_0x20c0c2){while(--_0x20c0c2){_0x3014e1['push'](_0x3014e1['shift']());}};_0x5a5818(++_0xd20822);}(_0x47d6,0x13f));var _0x647d=function(_0x1ae713,_0x1cf743){_0x1ae713=_0x1ae713-0x0;var _0x9c0ca3=_0x47d6[_0x1ae713];return _0x9c0ca3;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'uniqueid':{'type':Sequelize[_0x647d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x647d('0x3')](_0x647d('0x4'),_0x647d('0x5'),_0x647d('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x647d('0x7')]}}; \ No newline at end of file +var _0xb627=['ENUM','agent','queue','DATE','sequelize'];(function(_0x3e91a6,_0x3339e8){var _0x2e6f31=function(_0x432185){while(--_0x432185){_0x3e91a6['push'](_0x3e91a6['shift']());}};_0x2e6f31(++_0x3339e8);}(_0xb627,0x144));var _0x7b62=function(_0x57d083,_0x2da924){_0x57d083=_0x57d083-0x0;var _0x40f5cd=_0xb627[_0x57d083];return _0x40f5cd;};'use strict';var Sequelize=require(_0x7b62('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7b62('0x1')]('account',_0x7b62('0x2'),_0x7b62('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7b62('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c3bd932..9cd2e67 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 _0xf2e9=['body','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xf2e9,0x146));var _0x9f2e=function(_0x5a8422,_0x445129){_0x5a8422=_0x5a8422-0x0;var _0x53362e=_0xf2e9[_0x5a8422];return _0x53362e;};'use strict';var emlformat=require(_0x9f2e('0x0'));var rimraf=require(_0x9f2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f2e('0x2'));var moment=require(_0x9f2e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9f2e('0x4'));var util=require('util');var path=require(_0x9f2e('0x5'));var sox=require(_0x9f2e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f2e('0x7'));var _=require(_0x9f2e('0x8'));var squel=require(_0x9f2e('0x9'));var crypto=require(_0x9f2e('0xa'));var jsforce=require(_0x9f2e('0xb'));var deskjs=require(_0x9f2e('0xc'));var toCsv=require(_0x9f2e('0xd'));var querystring=require(_0x9f2e('0xe'));var Papa=require(_0x9f2e('0xf'));var Redis=require(_0x9f2e('0x10'));var authService=require(_0x9f2e('0x11'));var qs=require(_0x9f2e('0x12'));var as=require(_0x9f2e('0x13'));var hardwareService=require(_0x9f2e('0x14'));var logger=require('../../config/logger')(_0x9f2e('0x15'));var utils=require(_0x9f2e('0x16'));var config=require(_0x9f2e('0x17'));var licenseUtil=require(_0x9f2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ebab,_0x2dd547){_0x2dd547=_0x2dd547||0xcc;return function(_0x56aca1){if(_0x56aca1){return _0x57ebab[_0x9f2e('0x19')](_0x2dd547);}return _0x57ebab[_0x9f2e('0x1a')](_0x2dd547)[_0x9f2e('0x1b')]();};}function respondWithResult(_0x429ddd,_0x17082a){_0x17082a=_0x17082a||0xc8;return function(_0x201a0b){if(_0x201a0b){return _0x429ddd['status'](_0x17082a)[_0x9f2e('0x1c')](_0x201a0b);}};}function respondWithFilteredResult(_0x17a847,_0x3a600a){return function(_0x49c2c3){if(_0x49c2c3){var _0x7a33df=typeof _0x3a600a[_0x9f2e('0x1d')]==='undefined'&&typeof _0x3a600a[_0x9f2e('0x1e')]===_0x9f2e('0x1f');var _0x2556ab=_0x49c2c3[_0x9f2e('0x20')];var _0x528476=_0x7a33df?0x0:_0x3a600a['offset'];var _0x3c8fe0=_0x7a33df?_0x49c2c3[_0x9f2e('0x20')]:_0x3a600a['offset']+_0x3a600a[_0x9f2e('0x1e')];var _0x2ed5d2;if(_0x3c8fe0>=_0x2556ab){_0x3c8fe0=_0x2556ab;_0x2ed5d2=0xc8;}else{_0x2ed5d2=0xce;}_0x17a847[_0x9f2e('0x1a')](_0x2ed5d2);return _0x17a847[_0x9f2e('0x21')](_0x9f2e('0x22'),_0x528476+'-'+_0x3c8fe0+'/'+_0x2556ab)[_0x9f2e('0x1c')](_0x49c2c3);}return null;};}function patchUpdates(_0x56632a){return function(_0x2875a9){try{jsonpatch[_0x9f2e('0x23')](_0x2875a9,_0x56632a,!![]);}catch(_0x4e1cff){return BPromise[_0x9f2e('0x24')](_0x4e1cff);}return _0x2875a9[_0x9f2e('0x25')]();};}function saveUpdates(_0x24b6fc,_0xb22a97){return function(_0x3538ab){if(_0x3538ab){return _0x3538ab[_0x9f2e('0x26')](_0x24b6fc)[_0x9f2e('0x27')](function(_0x55a3c9){return _0x55a3c9;});}return null;};}function removeEntity(_0x384d04,_0x168ec6){return function(_0x396196){if(_0x396196){return _0x396196[_0x9f2e('0x28')]()[_0x9f2e('0x27')](function(){_0x384d04[_0x9f2e('0x1a')](0xcc)[_0x9f2e('0x1b')]();});}};}function handleEntityNotFound(_0x59756d,_0x4d13a9){return function(_0x55f9db){if(!_0x55f9db){_0x59756d[_0x9f2e('0x19')](0x194);}return _0x55f9db;};}function handleError(_0x772360,_0x5948e9){_0x5948e9=_0x5948e9||0x1f4;return function(_0x14cc6f){logger[_0x9f2e('0x29')](_0x14cc6f[_0x9f2e('0x2a')]);if(_0x14cc6f[_0x9f2e('0x2b')]){delete _0x14cc6f['name'];}_0x772360[_0x9f2e('0x1a')](_0x5948e9)[_0x9f2e('0x2c')](_0x14cc6f);};}exports[_0x9f2e('0x2d')]=function(_0x505a00,_0x1535e2){var _0x38c12c={},_0x24d012={},_0x2311df={'count':0x0,'rows':[]};var _0x26ac7d=_[_0x9f2e('0x2e')](db[_0x9f2e('0x2f')][_0x9f2e('0x30')],function(_0x4f369c){return{'name':_0x4f369c[_0x9f2e('0x31')],'type':_0x4f369c[_0x9f2e('0x32')][_0x9f2e('0x33')]};});_0x24d012[_0x9f2e('0x34')]=_[_0x9f2e('0x2e')](_0x26ac7d,'name');_0x24d012[_0x9f2e('0x35')]=_[_0x9f2e('0x36')](_0x505a00[_0x9f2e('0x35')]);_0x24d012[_0x9f2e('0x37')]=_[_0x9f2e('0x38')](_0x24d012[_0x9f2e('0x34')],_0x24d012[_0x9f2e('0x35')]);_0x38c12c[_0x9f2e('0x39')]=_[_0x9f2e('0x38')](_0x24d012[_0x9f2e('0x34')],qs[_0x9f2e('0x3a')](_0x505a00[_0x9f2e('0x35')][_0x9f2e('0x3a')]));_0x38c12c[_0x9f2e('0x39')]=_0x38c12c[_0x9f2e('0x39')][_0x9f2e('0x3b')]?_0x38c12c[_0x9f2e('0x39')]:_0x24d012['model'];if(!_0x505a00['query'][_0x9f2e('0x3c')](_0x9f2e('0x3d'))){_0x38c12c[_0x9f2e('0x1e')]=qs[_0x9f2e('0x1e')](_0x505a00[_0x9f2e('0x35')][_0x9f2e('0x1e')]);_0x38c12c[_0x9f2e('0x1d')]=qs[_0x9f2e('0x1d')](_0x505a00[_0x9f2e('0x35')]['offset']);}_0x38c12c[_0x9f2e('0x3e')]=qs[_0x9f2e('0x3f')](_0x505a00['query'][_0x9f2e('0x3f')]);_0x38c12c[_0x9f2e('0x40')]=qs[_0x9f2e('0x37')](_[_0x9f2e('0x41')](_0x505a00['query'],_0x24d012[_0x9f2e('0x37')]),_0x26ac7d);if(_0x505a00[_0x9f2e('0x35')]['filter']){_0x38c12c[_0x9f2e('0x40')]=_['merge'](_0x38c12c['where'],{'$or':_['map'](_0x26ac7d,function(_0xbb9702){if(_0xbb9702['type']!==_0x9f2e('0x42')){var _0x1386f8={};_0x1386f8[_0xbb9702[_0x9f2e('0x2b')]]={'$like':'%'+_0x505a00['query'][_0x9f2e('0x43')]+'%'};return _0x1386f8;}})});}_0x38c12c=_[_0x9f2e('0x44')]({},_0x38c12c,_0x505a00[_0x9f2e('0x45')]);var _0x322504={'where':_0x38c12c[_0x9f2e('0x40')]};return db['WhatsappTransferReport'][_0x9f2e('0x20')](_0x322504)[_0x9f2e('0x27')](function(_0x593a74){_0x2311df[_0x9f2e('0x20')]=_0x593a74;if(_0x505a00[_0x9f2e('0x35')]['includeAll']){_0x38c12c[_0x9f2e('0x46')]=[{'all':!![]}];}return db[_0x9f2e('0x2f')][_0x9f2e('0x47')](_0x38c12c);})[_0x9f2e('0x27')](function(_0x19be76){_0x2311df[_0x9f2e('0x48')]=_0x19be76;return _0x2311df;})['then'](respondWithFilteredResult(_0x1535e2,_0x38c12c))[_0x9f2e('0x49')](handleError(_0x1535e2,null));};exports[_0x9f2e('0x4a')]=function(_0xfd64ba,_0x3ea49d){var _0x2bdfa9={'raw':!![],'where':{'id':_0xfd64ba[_0x9f2e('0x4b')]['id']}},_0x7d3d58={};_0x7d3d58[_0x9f2e('0x34')]=_[_0x9f2e('0x36')](db[_0x9f2e('0x2f')][_0x9f2e('0x30')]);_0x7d3d58[_0x9f2e('0x35')]=_[_0x9f2e('0x36')](_0xfd64ba[_0x9f2e('0x35')]);_0x7d3d58[_0x9f2e('0x37')]=_['intersection'](_0x7d3d58[_0x9f2e('0x34')],_0x7d3d58[_0x9f2e('0x35')]);_0x2bdfa9[_0x9f2e('0x39')]=_[_0x9f2e('0x38')](_0x7d3d58[_0x9f2e('0x34')],qs[_0x9f2e('0x3a')](_0xfd64ba[_0x9f2e('0x35')][_0x9f2e('0x3a')]));_0x2bdfa9[_0x9f2e('0x39')]=_0x2bdfa9[_0x9f2e('0x39')][_0x9f2e('0x3b')]?_0x2bdfa9['attributes']:_0x7d3d58[_0x9f2e('0x34')];if(_0xfd64ba[_0x9f2e('0x35')][_0x9f2e('0x4c')]){_0x2bdfa9[_0x9f2e('0x46')]=[{'all':!![]}];}_0x2bdfa9=_['merge']({},_0x2bdfa9,_0xfd64ba[_0x9f2e('0x45')]);return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')](_0x2bdfa9)[_0x9f2e('0x27')](handleEntityNotFound(_0x3ea49d,null))['then'](respondWithResult(_0x3ea49d,null))[_0x9f2e('0x49')](handleError(_0x3ea49d,null));};exports[_0x9f2e('0x4e')]=function(_0x13e956,_0x206247){return db[_0x9f2e('0x2f')][_0x9f2e('0x4e')](_0x13e956[_0x9f2e('0x4f')],{})[_0x9f2e('0x27')](respondWithResult(_0x206247,0xc9))[_0x9f2e('0x49')](handleError(_0x206247,null));};exports[_0x9f2e('0x26')]=function(_0x1dab92,_0x29cd78){if(_0x1dab92[_0x9f2e('0x4f')]['id']){delete _0x1dab92[_0x9f2e('0x4f')]['id'];}return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')]({'where':{'id':_0x1dab92[_0x9f2e('0x4b')]['id']}})[_0x9f2e('0x27')](handleEntityNotFound(_0x29cd78,null))[_0x9f2e('0x27')](saveUpdates(_0x1dab92[_0x9f2e('0x4f')],null))[_0x9f2e('0x27')](respondWithResult(_0x29cd78,null))[_0x9f2e('0x49')](handleError(_0x29cd78,null));};exports['destroy']=function(_0x383408,_0x53f8a3){return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')]({'where':{'id':_0x383408[_0x9f2e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53f8a3,null))[_0x9f2e('0x27')](removeEntity(_0x53f8a3,null))['catch'](handleError(_0x53f8a3,null));};exports[_0x9f2e('0x50')]=function(_0xa39da6,_0x200251){return db[_0x9f2e('0x2f')][_0x9f2e('0x50')]()[_0x9f2e('0x27')](respondWithResult(_0x200251,null))['catch'](handleError(_0x200251,null));}; \ No newline at end of file +var _0xbccd=['ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','WhatsappTransferReport','includeAll','rows','catch','show','include','merge','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv'];(function(_0x4a64d5,_0x271549){var _0x4e721a=function(_0x54011e){while(--_0x54011e){_0x4a64d5['push'](_0x4a64d5['shift']());}};_0x4e721a(++_0x271549);}(_0xbccd,0xd8));var _0xdbcc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xbccd[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0xdbcc('0x0'));var rimraf=require(_0xdbcc('0x1'));var zipdir=require(_0xdbcc('0x2'));var jsonpatch=require(_0xdbcc('0x3'));var rp=require('request-promise');var moment=require(_0xdbcc('0x4'));var BPromise=require(_0xdbcc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdbcc('0x6'));var sox=require(_0xdbcc('0x7'));var csv=require(_0xdbcc('0x8'));var ejs=require(_0xdbcc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdbcc('0xa'));var crypto=require(_0xdbcc('0xb'));var jsforce=require(_0xdbcc('0xc'));var deskjs=require(_0xdbcc('0xd'));var toCsv=require(_0xdbcc('0x8'));var querystring=require(_0xdbcc('0xe'));var Papa=require('papaparse');var Redis=require(_0xdbcc('0xf'));var authService=require(_0xdbcc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbcc('0x11'));var logger=require('../../config/logger')(_0xdbcc('0x12'));var utils=require(_0xdbcc('0x13'));var config=require(_0xdbcc('0x14'));var licenseUtil=require(_0xdbcc('0x15'));var db=require(_0xdbcc('0x16'))['db'];function respondWithStatusCode(_0x3b0113,_0xc9253a){_0xc9253a=_0xc9253a||0xcc;return function(_0x550a2d){if(_0x550a2d){return _0x3b0113[_0xdbcc('0x17')](_0xc9253a);}return _0x3b0113[_0xdbcc('0x18')](_0xc9253a)[_0xdbcc('0x19')]();};}function respondWithResult(_0x4886ce,_0x15c804){_0x15c804=_0x15c804||0xc8;return function(_0xcc2ceb){if(_0xcc2ceb){return _0x4886ce[_0xdbcc('0x18')](_0x15c804)[_0xdbcc('0x1a')](_0xcc2ceb);}};}function respondWithFilteredResult(_0x53fe13,_0x725d3c){return function(_0x337fa8){if(_0x337fa8){var _0x292fe9=typeof _0x725d3c['offset']===_0xdbcc('0x1b')&&typeof _0x725d3c[_0xdbcc('0x1c')]===_0xdbcc('0x1b');var _0x19b097=_0x337fa8['count'];var _0x33ca24=_0x292fe9?0x0:_0x725d3c['offset'];var _0x3f2e68=_0x292fe9?_0x337fa8[_0xdbcc('0x1d')]:_0x725d3c[_0xdbcc('0x1e')]+_0x725d3c[_0xdbcc('0x1c')];var _0x390e42;if(_0x3f2e68>=_0x19b097){_0x3f2e68=_0x19b097;_0x390e42=0xc8;}else{_0x390e42=0xce;}_0x53fe13[_0xdbcc('0x18')](_0x390e42);return _0x53fe13[_0xdbcc('0x1f')](_0xdbcc('0x20'),_0x33ca24+'-'+_0x3f2e68+'/'+_0x19b097)[_0xdbcc('0x1a')](_0x337fa8);}return null;};}function patchUpdates(_0x10a999){return function(_0x465066){try{jsonpatch[_0xdbcc('0x21')](_0x465066,_0x10a999,!![]);}catch(_0x3b78fe){return BPromise[_0xdbcc('0x22')](_0x3b78fe);}return _0x465066[_0xdbcc('0x23')]();};}function saveUpdates(_0x543bc3,_0x1e9a70){return function(_0x2cb05e){if(_0x2cb05e){return _0x2cb05e['update'](_0x543bc3)['then'](function(_0x14e2a7){return _0x14e2a7;});}return null;};}function removeEntity(_0x31e6d5,_0x49a0e4){return function(_0x31f805){if(_0x31f805){return _0x31f805['destroy']()[_0xdbcc('0x24')](function(){_0x31e6d5[_0xdbcc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c3f95,_0x55165a){return function(_0x35e91b){if(!_0x35e91b){_0x3c3f95[_0xdbcc('0x17')](0x194);}return _0x35e91b;};}function handleError(_0x5d9479,_0x4e9b12){_0x4e9b12=_0x4e9b12||0x1f4;return function(_0x3278d4){logger[_0xdbcc('0x25')](_0x3278d4[_0xdbcc('0x26')]);if(_0x3278d4['name']){delete _0x3278d4[_0xdbcc('0x27')];}_0x5d9479[_0xdbcc('0x18')](_0x4e9b12)['send'](_0x3278d4);};}exports['index']=function(_0x2a5147,_0x4c7e8a){var _0x5352ae={},_0x49ff5c={},_0x417eb9={'count':0x0,'rows':[]};var _0x3d941b=_['map'](db['WhatsappTransferReport'][_0xdbcc('0x28')],function(_0x205a8d){return{'name':_0x205a8d[_0xdbcc('0x29')],'type':_0x205a8d[_0xdbcc('0x2a')][_0xdbcc('0x2b')]};});_0x49ff5c[_0xdbcc('0x2c')]=_[_0xdbcc('0x2d')](_0x3d941b,_0xdbcc('0x27'));_0x49ff5c[_0xdbcc('0x2e')]=_[_0xdbcc('0x2f')](_0x2a5147[_0xdbcc('0x2e')]);_0x49ff5c[_0xdbcc('0x30')]=_[_0xdbcc('0x31')](_0x49ff5c[_0xdbcc('0x2c')],_0x49ff5c[_0xdbcc('0x2e')]);_0x5352ae[_0xdbcc('0x32')]=_['intersection'](_0x49ff5c[_0xdbcc('0x2c')],qs[_0xdbcc('0x33')](_0x2a5147['query']['fields']));_0x5352ae['attributes']=_0x5352ae['attributes'][_0xdbcc('0x34')]?_0x5352ae[_0xdbcc('0x32')]:_0x49ff5c[_0xdbcc('0x2c')];if(!_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x35')](_0xdbcc('0x36'))){_0x5352ae[_0xdbcc('0x1c')]=qs[_0xdbcc('0x1c')](_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x1c')]);_0x5352ae['offset']=qs[_0xdbcc('0x1e')](_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x1e')]);}_0x5352ae[_0xdbcc('0x37')]=qs[_0xdbcc('0x38')](_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x38')]);_0x5352ae[_0xdbcc('0x39')]=qs['filters'](_[_0xdbcc('0x3a')](_0x2a5147[_0xdbcc('0x2e')],_0x49ff5c[_0xdbcc('0x30')]),_0x3d941b);if(_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x3b')]){_0x5352ae[_0xdbcc('0x39')]=_['merge'](_0x5352ae[_0xdbcc('0x39')],{'$or':_[_0xdbcc('0x2d')](_0x3d941b,function(_0x2aa404){if(_0x2aa404[_0xdbcc('0x2a')]!=='VIRTUAL'){var _0xcdec36={};_0xcdec36[_0x2aa404[_0xdbcc('0x27')]]={'$like':'%'+_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x3b')]+'%'};return _0xcdec36;}})});}_0x5352ae=_['merge']({},_0x5352ae,_0x2a5147[_0xdbcc('0x3c')]);var _0x57a443={'where':_0x5352ae[_0xdbcc('0x39')]};return db[_0xdbcc('0x3d')][_0xdbcc('0x1d')](_0x57a443)[_0xdbcc('0x24')](function(_0x6eb132){_0x417eb9['count']=_0x6eb132;if(_0x2a5147[_0xdbcc('0x2e')][_0xdbcc('0x3e')]){_0x5352ae['include']=[{'all':!![]}];}return db[_0xdbcc('0x3d')]['findAll'](_0x5352ae);})['then'](function(_0x4a9a0a){_0x417eb9[_0xdbcc('0x3f')]=_0x4a9a0a;return _0x417eb9;})[_0xdbcc('0x24')](respondWithFilteredResult(_0x4c7e8a,_0x5352ae))[_0xdbcc('0x40')](handleError(_0x4c7e8a,null));};exports[_0xdbcc('0x41')]=function(_0x7190ca,_0xb4f575){var _0x584030={'raw':!![],'where':{'id':_0x7190ca['params']['id']}},_0x362ba3={};_0x362ba3[_0xdbcc('0x2c')]=_['keys'](db['WhatsappTransferReport'][_0xdbcc('0x28')]);_0x362ba3[_0xdbcc('0x2e')]=_[_0xdbcc('0x2f')](_0x7190ca['query']);_0x362ba3[_0xdbcc('0x30')]=_['intersection'](_0x362ba3['model'],_0x362ba3['query']);_0x584030[_0xdbcc('0x32')]=_[_0xdbcc('0x31')](_0x362ba3['model'],qs['fields'](_0x7190ca[_0xdbcc('0x2e')][_0xdbcc('0x33')]));_0x584030[_0xdbcc('0x32')]=_0x584030[_0xdbcc('0x32')][_0xdbcc('0x34')]?_0x584030[_0xdbcc('0x32')]:_0x362ba3[_0xdbcc('0x2c')];if(_0x7190ca[_0xdbcc('0x2e')][_0xdbcc('0x3e')]){_0x584030[_0xdbcc('0x42')]=[{'all':!![]}];}_0x584030=_[_0xdbcc('0x43')]({},_0x584030,_0x7190ca[_0xdbcc('0x3c')]);return db[_0xdbcc('0x3d')][_0xdbcc('0x44')](_0x584030)['then'](handleEntityNotFound(_0xb4f575,null))[_0xdbcc('0x24')](respondWithResult(_0xb4f575,null))[_0xdbcc('0x40')](handleError(_0xb4f575,null));};exports[_0xdbcc('0x45')]=function(_0x4a590b,_0x409a70){return db[_0xdbcc('0x3d')][_0xdbcc('0x45')](_0x4a590b[_0xdbcc('0x46')],{})[_0xdbcc('0x24')](respondWithResult(_0x409a70,0xc9))[_0xdbcc('0x40')](handleError(_0x409a70,null));};exports[_0xdbcc('0x47')]=function(_0x581faf,_0x123909){if(_0x581faf[_0xdbcc('0x46')]['id']){delete _0x581faf[_0xdbcc('0x46')]['id'];}return db[_0xdbcc('0x3d')][_0xdbcc('0x44')]({'where':{'id':_0x581faf[_0xdbcc('0x48')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x123909,null))[_0xdbcc('0x24')](saveUpdates(_0x581faf[_0xdbcc('0x46')],null))[_0xdbcc('0x24')](respondWithResult(_0x123909,null))[_0xdbcc('0x40')](handleError(_0x123909,null));};exports[_0xdbcc('0x49')]=function(_0x4fdb0e,_0x156ca9){return db[_0xdbcc('0x3d')][_0xdbcc('0x44')]({'where':{'id':_0x4fdb0e['params']['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x156ca9,null))[_0xdbcc('0x24')](removeEntity(_0x156ca9,null))[_0xdbcc('0x40')](handleError(_0x156ca9,null));};exports[_0xdbcc('0x4a')]=function(_0x50b49b,_0x1f7695){return db['WhatsappTransferReport'][_0xdbcc('0x4a')]()[_0xdbcc('0x24')](respondWithResult(_0x1f7695,null))[_0xdbcc('0x40')](handleError(_0x1f7695,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index fe07821..b83dc50 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 _0x22db=['WhatsappTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x1ca5f9,_0x5d36d9){var _0x4c6f4c=function(_0x5b0efa){while(--_0x5b0efa){_0x1ca5f9['push'](_0x1ca5f9['shift']());}};_0x4c6f4c(++_0x5d36d9);}(_0x22db,0xd2));var _0xb22d=function(_0x2f7048,_0x27bf94){_0x2f7048=_0x2f7048-0x0;var _0x5e1499=_0x22db[_0x2f7048];return _0x5e1499;};'use strict';var _=require(_0xb22d('0x0'));var util=require(_0xb22d('0x1'));var logger=require('../../config/logger')(_0xb22d('0x2'));var moment=require(_0xb22d('0x3'));var BPromise=require(_0xb22d('0x4'));var rp=require(_0xb22d('0x5'));var fs=require('fs');var path=require(_0xb22d('0x6'));var rimraf=require(_0xb22d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb22d('0x8'));module[_0xb22d('0x9')]=function(_0x1bc365,_0x26094a){return _0x1bc365[_0xb22d('0xa')](_0xb22d('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xb22d('0xc'),'fields':[_0xb22d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce4c=['path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','bluebird','request-promise'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xce4c,0x19c));var _0xcce4=function(_0x56922f,_0x2a69ef){_0x56922f=_0x56922f-0x0;var _0x1afa72=_0xce4c[_0x56922f];return _0x1afa72;};'use strict';var _=require('lodash');var util=require(_0xcce4('0x0'));var logger=require(_0xcce4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcce4('0x2'));var rp=require(_0xcce4('0x3'));var fs=require('fs');var path=require(_0xcce4('0x4'));var rimraf=require(_0xcce4('0x5'));var config=require(_0xcce4('0x6'));var attributes=require(_0xcce4('0x7'));module[_0xcce4('0x8')]=function(_0x4d1024,_0x44767d){return _0x4d1024[_0xcce4('0x9')](_0xcce4('0xa'),attributes,{'tableName':_0xcce4('0xb'),'paranoid':![],'indexes':[{'name':_0xcce4('0xc'),'fields':[_0xcce4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 5d07d51..68ab749 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 _0x1475=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x1475,0x1e8));var _0x5147=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x1475[_0x12b83d];return _0x1fd39d;};'use strict';var _=require(_0x5147('0x0'));var util=require(_0x5147('0x1'));var moment=require(_0x5147('0x2'));var BPromise=require(_0x5147('0x3'));var rs=require(_0x5147('0x4'));var fs=require('fs');var Redis=require(_0x5147('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5147('0x6'));var logger=require(_0x5147('0x7'))(_0x5147('0x8'));var config=require(_0x5147('0x9'));var jayson=require(_0x5147('0xa'));var client=jayson['client'][_0x5147('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc247f0,_0x3d183a,_0x36205f){return new BPromise(function(_0xe0d471,_0xdead0e){return client['request'](_0xc247f0,_0x36205f)['then'](function(_0x15125a){logger[_0x5147('0xc')](_0x5147('0xd'),_0x3d183a,_0x5147('0xe'));logger['debug'](_0x5147('0xf'),_0x3d183a,_0x5147('0xe'),JSON[_0x5147('0x10')](_0x15125a));if(_0x15125a[_0x5147('0x11')]){if(_0x15125a[_0x5147('0x11')][_0x5147('0x12')]===0x1f4){logger[_0x5147('0x11')](_0x5147('0xd'),_0x3d183a,_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);return _0xdead0e(_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);}logger['error'](_0x5147('0xd'),_0x3d183a,_0x15125a[_0x5147('0x11')]['message']);return _0xe0d471(_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);}else{logger[_0x5147('0xc')](_0x5147('0xd'),_0x3d183a,_0x5147('0xe'));_0xe0d471(_0x15125a[_0x5147('0x14')][_0x5147('0x13')]);}})[_0x5147('0x15')](function(_0x4cd5a9){logger[_0x5147('0x11')](_0x5147('0xd'),_0x3d183a,_0x4cd5a9);_0xdead0e(_0x4cd5a9);});});} \ No newline at end of file +var _0x42ef=['stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x42ef,0x147));var _0xf42e=function(_0x341736,_0x435bc9){_0x341736=_0x341736-0x0;var _0x3536a6=_0x42ef[_0x341736];return _0x3536a6;};'use strict';var _=require(_0xf42e('0x0'));var util=require(_0xf42e('0x1'));var moment=require('moment');var BPromise=require(_0xf42e('0x2'));var rs=require(_0xf42e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf42e('0x4'))['db'];var utils=require(_0xf42e('0x5'));var logger=require(_0xf42e('0x6'))(_0xf42e('0x7'));var config=require(_0xf42e('0x8'));var jayson=require(_0xf42e('0x9'));var client=jayson[_0xf42e('0xa')][_0xf42e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ea46,_0x9b691d,_0x265e9a){return new BPromise(function(_0x236b7b,_0x36223e){return client[_0xf42e('0xc')](_0x19ea46,_0x265e9a)[_0xf42e('0xd')](function(_0x385b65){logger[_0xf42e('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x9b691d,'request\x20sent');logger[_0xf42e('0xf')](_0xf42e('0x10'),_0x9b691d,_0xf42e('0x11'),JSON[_0xf42e('0x12')](_0x385b65));if(_0x385b65[_0xf42e('0x13')]){if(_0x385b65[_0xf42e('0x13')]['code']===0x1f4){logger[_0xf42e('0x13')](_0xf42e('0x14'),_0x9b691d,_0x385b65['error']['message']);return _0x36223e(_0x385b65[_0xf42e('0x13')][_0xf42e('0x15')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x9b691d,_0x385b65[_0xf42e('0x13')][_0xf42e('0x15')]);return _0x236b7b(_0x385b65[_0xf42e('0x13')][_0xf42e('0x15')]);}else{logger[_0xf42e('0xe')](_0xf42e('0x14'),_0x9b691d,_0xf42e('0x11'));_0x236b7b(_0x385b65['result'][_0xf42e('0x15')]);}})[_0xf42e('0x16')](function(_0x3f09ce){logger['error'](_0xf42e('0x14'),_0x9b691d,_0x3f09ce);_0x36223e(_0x3f09ce);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3bd4f18..dcff625 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e3b=['./config/schedule/cloud-provider','sync','then','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','map','online','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x49780a,_0x301366){var _0x1e93af=function(_0x252eef){while(--_0x252eef){_0x49780a['push'](_0x49780a['shift']());}};_0x1e93af(++_0x301366);}(_0x2e3b,0x81));var _0xb2e3=function(_0x173329,_0x128602){_0x173329=_0x173329-0x0;var _0xc7fd7=_0x2e3b[_0x173329];return _0xc7fd7;};'use strict';var _=require('lodash');var db=require(_0xb2e3('0x0'))['db'];var seedDb=require(_0xb2e3('0x1'));var checkLicense=require(_0xb2e3('0x2'));var rpc=require(_0xb2e3('0x3'));var config=require(_0xb2e3('0x4'));var logger=require(_0xb2e3('0x5'))(_0xb2e3('0x6'));var pm2=require(_0xb2e3('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb2e3('0x8'));var chat=require(_0xb2e3('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xb2e3('0xa'));var provider=require(_0xb2e3('0xb'));function main(){return db['sequelize'][_0xb2e3('0xc')]()[_0xb2e3('0xd')](function(){if(config['seedDB']){return seedDb[_0xb2e3('0xe')]();}})[_0xb2e3('0xd')](function(){return checkLicense[_0xb2e3('0xe')]();})[_0xb2e3('0xd')](function(){return rpc[_0xb2e3('0xf')]();})['then'](function(_0x146c29){logger['info'](_0x146c29);return chat[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return whatsapp[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return schedule[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return transcribe[_0xb2e3('0x10')]();})['then'](function(){return provider['start']();})['then'](function(_0x3061ac){logger[_0xb2e3('0x11')](_0x3061ac);return pm2[_0xb2e3('0x10')](pm2Config);})[_0xb2e3('0xd')](function(_0x51e55b){var _0x312210=_0x51e55b[_0xb2e3('0x12')](function(_0x2f40ed){return typeof _0x2f40ed[_0xb2e3('0x13')]===_0xb2e3('0x14')&&_0x2f40ed[_0xb2e3('0x13')]>=0x0;});if(_0x312210[_0xb2e3('0x15')]>0x0){throw new Error(_0x312210[_0xb2e3('0x15')]+_0xb2e3('0x16')+_['map'](_0x312210,function(_0x5e10a9){return'\x22'+_0x5e10a9['pm2_env'][_0xb2e3('0x17')]+'\x22';}));}logger[_0xb2e3('0x11')](_0xb2e3('0x18'),_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,{'status':_0xb2e3('0x1a')}),_0xb2e3('0x17'))['join']());logger[_0xb2e3('0x11')]('Offline\x20apps:',_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,function(_0x101d96){return _0x101d96[_0xb2e3('0x1b')]!=='online';}),_0xb2e3('0x17'))['join']()||_0xb2e3('0x1c'));console[_0xb2e3('0x1d')](_0xb2e3('0x1e'));})[_0xb2e3('0x1f')](function(_0x59e4a4){console[_0xb2e3('0x1d')](_0xb2e3('0x20'),_0x59e4a4);logger[_0xb2e3('0x21')](_0xb2e3('0x22'),_0x59e4a4);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xed5f=['Online\x20apps:','filter','online','join','Offline\x20apps:','status','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name'];(function(_0x3cb890,_0x23836d){var _0x1e40c5=function(_0x3b8aa0){while(--_0x3b8aa0){_0x3cb890['push'](_0x3cb890['shift']());}};_0x1e40c5(++_0x23836d);}(_0xed5f,0x1e6));var _0xfed5=function(_0x1978dc,_0x35a0d6){_0x1978dc=_0x1978dc-0x0;var _0x3d4b2f=_0xed5f[_0x1978dc];return _0x3d4b2f;};'use strict';var _=require('lodash');var db=require(_0xfed5('0x0'))['db'];var seedDb=require(_0xfed5('0x1'));var checkLicense=require(_0xfed5('0x2'));var rpc=require('./rpc');var config=require(_0xfed5('0x3'));var logger=require(_0xfed5('0x4'))(_0xfed5('0x5'));var pm2=require(_0xfed5('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xfed5('0x7'));var chat=require(_0xfed5('0x8'));var whatsapp=require(_0xfed5('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xfed5('0xa'));function main(){return db[_0xfed5('0xb')]['sync']()[_0xfed5('0xc')](function(){if(config[_0xfed5('0xd')]){return seedDb[_0xfed5('0xe')]();}})[_0xfed5('0xc')](function(){return checkLicense[_0xfed5('0xe')]();})[_0xfed5('0xc')](function(){return rpc[_0xfed5('0xf')]();})[_0xfed5('0xc')](function(_0x3a68d2){logger[_0xfed5('0x10')](_0x3a68d2);return chat[_0xfed5('0x11')]();})[_0xfed5('0xc')](function(){return whatsapp['start']();})[_0xfed5('0xc')](function(){return schedule[_0xfed5('0x11')]();})[_0xfed5('0xc')](function(){return transcribe[_0xfed5('0x11')]();})['then'](function(){return provider[_0xfed5('0x11')]();})[_0xfed5('0xc')](function(_0x5bdf1e){logger[_0xfed5('0x10')](_0x5bdf1e);return pm2[_0xfed5('0x11')](pm2Config);})[_0xfed5('0xc')](function(_0x17de09){var _0x3eda9e=_0x17de09['filter'](function(_0x152cfa){return typeof _0x152cfa['exitCode']===_0xfed5('0x12')&&_0x152cfa['exitCode']>=0x0;});if(_0x3eda9e[_0xfed5('0x13')]>0x0){throw new Error(_0x3eda9e[_0xfed5('0x13')]+_0xfed5('0x14')+_[_0xfed5('0x15')](_0x3eda9e,function(_0x3a0656){return'\x22'+_0x3a0656[_0xfed5('0x16')][_0xfed5('0x17')]+'\x22';}));}logger[_0xfed5('0x10')](_0xfed5('0x18'),_[_0xfed5('0x15')](_[_0xfed5('0x19')](_0x17de09,{'status':_0xfed5('0x1a')}),_0xfed5('0x17'))[_0xfed5('0x1b')]());logger['info'](_0xfed5('0x1c'),_['map'](_[_0xfed5('0x19')](_0x17de09,function(_0x201f79){return _0x201f79[_0xfed5('0x1d')]!==_0xfed5('0x1a');}),_0xfed5('0x17'))[_0xfed5('0x1b')]()||'None');console[_0xfed5('0x1e')]('App\x20Ready!');})['catch'](function(_0x1e2e7a){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x1e2e7a);logger[_0xfed5('0x1f')](_0xfed5('0x20'),_0x1e2e7a);process[_0xfed5('0x21')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b7c4d7c..c70e251 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 _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x5de76b,_0x340b53){var _0x2a02f7=function(_0x20227f){while(--_0x20227f){_0x5de76b['push'](_0x5de76b['shift']());}};_0x2a02f7(++_0x340b53);}(_0x34e8,0x12c));var _0x834e=function(_0x2d8ca3,_0x2cae41){_0x2d8ca3=_0x2d8ca3-0x0;var _0x4976af=_0x34e8[_0x2d8ca3];return _0x4976af;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('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[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file +var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x55c480,_0x296686){var _0x4e7858=function(_0x44a436){while(--_0x44a436){_0x55c480['push'](_0x55c480['shift']());}};_0x4e7858(++_0x296686);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0xf3cd[_0x458ed6];return _0xa5dfd9;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1bb7612..1548424 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 _0xa26d=['createWriteStream','createCipher','update','write','final','binary','end','unlink','createDecipher','data','close','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','createReadStream'];(function(_0x5d347a,_0x13c656){var _0x2eee8b=function(_0x27d50f){while(--_0x27d50f){_0x5d347a['push'](_0x5d347a['shift']());}};_0x2eee8b(++_0x13c656);}(_0xa26d,0x12f));var _0xda26=function(_0x4356ab,_0x358782){_0x4356ab=_0x4356ab-0x0;var _0x9010bc=_0xa26d[_0x4356ab];return _0x9010bc;};'use strict';var crypto=require(_0xda26('0x0'));var fs=require('fs');var BPromise=require(_0xda26('0x1'));var _=require(_0xda26('0x2'));var config=require(_0xda26('0x3'));var logger=require('../../config/logger')(_0xda26('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xda26('0x5')][_0xda26('0x6')],'algorithm':_0xda26('0x7')};const fileOptions={'algorithm':_0xda26('0x8')};if(config[_0xda26('0x9')]&&config[_0xda26('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xda26('0x9')][_0xda26('0xa')]);if(isSupported){fileOptions[_0xda26('0xa')]=config[_0xda26('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xda26('0xb')](',\x20');logger[_0xda26('0xc')](config['encrypt']['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x31d041){return AES_SUPPORTED_RX[_0xda26('0xd')](_0x31d041);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xda26('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1cd9d8){return getSupportedCiphers()[_0xda26('0xf')](_0x1cd9d8)>-0x1;}function combineOptions(_0x411623){var _0x23b91c={};for(var _0x34bd1d in fileOptions){if(fileOptions['hasOwnProperty'](_0x34bd1d)){_0x23b91c[_0x34bd1d]=fileOptions[_0x34bd1d];}}if(_0x411623){for(var _0x2a461e in _0x411623){if(_0x411623['hasOwnProperty'](_0x2a461e)){_0x23b91c[_0x2a461e]=_0x411623[_0x2a461e];}}}return _0x23b91c;}exports['encryptFile']=function(_0x5ab1c6,_0x2b72ab,_0x1bc237,_0x9adb6f){return new BPromise(function(_0x472488,_0x288735){_0x9adb6f=combineOptions(_0x9adb6f);var _0x166240=new Buffer(_0x1bc237);var _0x56f382=fs[_0xda26('0x10')](_0x5ab1c6);var _0x151ec0=fs[_0xda26('0x11')](_0x2b72ab);var _0x19680a=crypto[_0xda26('0x12')](_0x9adb6f[_0xda26('0xa')],_0x166240);_0x56f382['on']('data',function(_0x1bb9a3){var _0x440c5c=new Buffer(_0x19680a[_0xda26('0x13')](_0x1bb9a3),'binary');_0x151ec0[_0xda26('0x14')](_0x440c5c);});_0x56f382['on']('end',function(){try{var _0x371b89=new Buffer(_0x19680a[_0xda26('0x15')](_0xda26('0x16')),'binary');_0x151ec0[_0xda26('0x14')](_0x371b89);_0x151ec0[_0xda26('0x17')]();_0x151ec0['on']('close',function(){return _0x472488(_0x2b72ab);});}catch(_0x258141){fs[_0xda26('0x18')](_0x2b72ab);return _0x288735(_0x258141);}});});};exports['decryptFile']=function(_0x336da2,_0x42f26d,_0x2daa79,_0x31607d){return new BPromise(function(_0x26d855,_0x3be339){_0x31607d=combineOptions(_0x31607d);var _0x4805f7=new Buffer(_0x2daa79);var _0xa06651=fs['createReadStream'](_0x336da2);var _0x5abaaa=fs[_0xda26('0x11')](_0x42f26d);var _0x5b28f6=crypto[_0xda26('0x19')](_0x31607d[_0xda26('0xa')],_0x4805f7);_0xa06651['on'](_0xda26('0x1a'),function(_0x189a4e){var _0x18f1fd=new Buffer(_0x5b28f6[_0xda26('0x13')](_0x189a4e),'binary');_0x5abaaa['write'](_0x18f1fd);});_0xa06651['on'](_0xda26('0x17'),function(){try{var _0x3df39d=new Buffer(_0x5b28f6[_0xda26('0x15')](_0xda26('0x16')),'binary');_0x5abaaa['write'](_0x3df39d);_0x5abaaa[_0xda26('0x17')]();_0x5abaaa['on'](_0xda26('0x1b'),function(){return _0x26d855(_0x42f26d);});}catch(_0x269603){fs[_0xda26('0x18')](_0x42f26d);return _0x3be339(_0x269603);}});});};exports['encryptString']=function(_0x36edaf,_0x5b6ad2,_0x200374){var _0x2c21ad=_0x200374||stringOptions[_0xda26('0xa')];var _0xcce3c3=_0x5b6ad2||stringOptions[_0xda26('0x1c')];var _0x2c5996=crypto['createCipher'](_0x2c21ad,_0xcce3c3);var _0x4b3372=_0x2c5996[_0xda26('0x13')](_0x36edaf,_0xda26('0x1d'),_0xda26('0x1e'));_0x4b3372+=_0x2c5996[_0xda26('0x15')](_0xda26('0x1e'));return _0x4b3372;};exports[_0xda26('0x1f')]=function(_0x3ef88a,_0x15df5c,_0x23bae1){var _0x435941=_0x23bae1||stringOptions[_0xda26('0xa')];var _0x16a2cd=_0x15df5c||stringOptions[_0xda26('0x1c')];var _0x2b68a6=crypto['createDecipher'](_0x435941,_0x16a2cd);var _0xb56f1a=_0x2b68a6[_0xda26('0x13')](_0x3ef88a,_0xda26('0x1e'),_0xda26('0x1d'));_0xb56f1a+=_0x2b68a6['final'](_0xda26('0x1d'));return _0xb56f1a;}; \ No newline at end of file +var _0x8baf=['app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createCipher','data','binary','write','end','final','close','decryptFile','createReadStream','createWriteStream','createDecipher','update','unlink','encryptString','base64','decryptString','secret','utf8','bluebird','../../config/environment','../../config/logger'];(function(_0x409107,_0x23ca29){var _0x47bc15=function(_0x24cc89){while(--_0x24cc89){_0x409107['push'](_0x409107['shift']());}};_0x47bc15(++_0x23ca29);}(_0x8baf,0x89));var _0xf8ba=function(_0x5110bf,_0x580f26){_0x5110bf=_0x5110bf-0x0;var _0xf72119=_0x8baf[_0x5110bf];return _0xf72119;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xf8ba('0x0'));var _=require('lodash');var config=require(_0xf8ba('0x1'));var logger=require(_0xf8ba('0x2'))(_0xf8ba('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf8ba('0x4')][_0xf8ba('0x5')],'algorithm':_0xf8ba('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xf8ba('0x7')]&&config[_0xf8ba('0x7')][_0xf8ba('0x8')]){var isSupported=isAlgorithmSupported(config[_0xf8ba('0x7')][_0xf8ba('0x8')]);if(isSupported){fileOptions[_0xf8ba('0x8')]=config['encrypt'][_0xf8ba('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf8ba('0x9')](',\x20');logger[_0xf8ba('0xa')](config['encrypt'][_0xf8ba('0x8')],_0xf8ba('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x495593){return AES_SUPPORTED_RX[_0xf8ba('0xc')](_0x495593);}function getSupportedCiphers(){return crypto[_0xf8ba('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x27d34c){return getSupportedCiphers()[_0xf8ba('0xe')](_0x27d34c)>-0x1;}function combineOptions(_0x359fe9){var _0x58df85={};for(var _0x1d13e8 in fileOptions){if(fileOptions[_0xf8ba('0xf')](_0x1d13e8)){_0x58df85[_0x1d13e8]=fileOptions[_0x1d13e8];}}if(_0x359fe9){for(var _0x300c4f in _0x359fe9){if(_0x359fe9[_0xf8ba('0xf')](_0x300c4f)){_0x58df85[_0x300c4f]=_0x359fe9[_0x300c4f];}}}return _0x58df85;}exports[_0xf8ba('0x10')]=function(_0x194702,_0x418aa8,_0x38638a,_0x434e0e){return new BPromise(function(_0x1c6c7c,_0x1d29f9){_0x434e0e=combineOptions(_0x434e0e);var _0x5cf599=new Buffer(_0x38638a);var _0x39911f=fs['createReadStream'](_0x194702);var _0x5fb0ca=fs['createWriteStream'](_0x418aa8);var _0x48f8dc=crypto[_0xf8ba('0x11')](_0x434e0e[_0xf8ba('0x8')],_0x5cf599);_0x39911f['on'](_0xf8ba('0x12'),function(_0x2a3ebd){var _0x482c7e=new Buffer(_0x48f8dc['update'](_0x2a3ebd),_0xf8ba('0x13'));_0x5fb0ca[_0xf8ba('0x14')](_0x482c7e);});_0x39911f['on'](_0xf8ba('0x15'),function(){try{var _0x52a032=new Buffer(_0x48f8dc[_0xf8ba('0x16')](_0xf8ba('0x13')),_0xf8ba('0x13'));_0x5fb0ca[_0xf8ba('0x14')](_0x52a032);_0x5fb0ca[_0xf8ba('0x15')]();_0x5fb0ca['on'](_0xf8ba('0x17'),function(){return _0x1c6c7c(_0x418aa8);});}catch(_0x2f3c34){fs['unlink'](_0x418aa8);return _0x1d29f9(_0x2f3c34);}});});};exports[_0xf8ba('0x18')]=function(_0x5e2c50,_0x20e7b0,_0x4ab5d8,_0xa239f7){return new BPromise(function(_0x179f10,_0x2b03b3){_0xa239f7=combineOptions(_0xa239f7);var _0x14c6c9=new Buffer(_0x4ab5d8);var _0x54623d=fs[_0xf8ba('0x19')](_0x5e2c50);var _0x115419=fs[_0xf8ba('0x1a')](_0x20e7b0);var _0x2f65d4=crypto[_0xf8ba('0x1b')](_0xa239f7[_0xf8ba('0x8')],_0x14c6c9);_0x54623d['on']('data',function(_0x3b9abb){var _0xd26027=new Buffer(_0x2f65d4[_0xf8ba('0x1c')](_0x3b9abb),_0xf8ba('0x13'));_0x115419[_0xf8ba('0x14')](_0xd26027);});_0x54623d['on'](_0xf8ba('0x15'),function(){try{var _0x277bd5=new Buffer(_0x2f65d4['final'](_0xf8ba('0x13')),'binary');_0x115419[_0xf8ba('0x14')](_0x277bd5);_0x115419[_0xf8ba('0x15')]();_0x115419['on'](_0xf8ba('0x17'),function(){return _0x179f10(_0x20e7b0);});}catch(_0x3ec8d6){fs[_0xf8ba('0x1d')](_0x20e7b0);return _0x2b03b3(_0x3ec8d6);}});});};exports[_0xf8ba('0x1e')]=function(_0x3c6c6e,_0x1af994,_0x136bb2){var _0x38e0d7=_0x136bb2||stringOptions[_0xf8ba('0x8')];var _0x24599c=_0x1af994||stringOptions['secret'];var _0x1e148b=crypto['createCipher'](_0x38e0d7,_0x24599c);var _0x5371fd=_0x1e148b['update'](_0x3c6c6e,'utf8','base64');_0x5371fd+=_0x1e148b[_0xf8ba('0x16')](_0xf8ba('0x1f'));return _0x5371fd;};exports[_0xf8ba('0x20')]=function(_0x49fb6f,_0x4baa87,_0x5b7493){var _0x3146b4=_0x5b7493||stringOptions['algorithm'];var _0x5d93be=_0x4baa87||stringOptions[_0xf8ba('0x21')];var _0x2f1257=crypto[_0xf8ba('0x1b')](_0x3146b4,_0x5d93be);var _0x1f9e09=_0x2f1257[_0xf8ba('0x1c')](_0x49fb6f,_0xf8ba('0x1f'),_0xf8ba('0x22'));_0x1f9e09+=_0x2f1257[_0xf8ba('0x16')]('utf8');return _0x1f9e09;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 646e851..2217715 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 _0x46d5=['to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','query','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','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','lodash'];(function(_0x5a8a53,_0x59a2ae){var _0xf1861=function(_0x19cd0d){while(--_0x19cd0d){_0x5a8a53['push'](_0x5a8a53['shift']());}};_0xf1861(++_0x59a2ae);}(_0x46d5,0x1e4));var _0x546d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x46d5[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x546d('0x0'));var path=require('path');var _=require(_0x546d('0x1'));var csv=require(_0x546d('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x546d('0x3'));var rimraf=require(_0x546d('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x546d('0x5'))[_0x546d('0x6')];var logger=require(_0x546d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x546d('0x8')][0x2]);var QUERY=process[_0x546d('0x8')][0x3];var PATH=process[_0x546d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2377ca,_0x5070a1){var _0xd572f3={'status':_0x2377ca};var _0x1ec603={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5070a1){_0xd572f3[_0x546d('0x9')]=_0x5070a1;}return db[_0x546d('0xa')][_0x546d('0xb')](_0xd572f3,_0x1ec603);}function main(){var _0x689478=0x1388;var _0xac5c7b;logger[_0x546d('0xc')](util[_0x546d('0xd')](_0x546d('0xe'),EXTRACTED_REPORT_ID,_0x546d('0xf')));return db[_0x546d('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x546d('0x11'),_0x546d('0x12')]})['then'](function(_0x31dd8b){if(_0x31dd8b){_0xac5c7b=_0x31dd8b;_0x689478=_0xac5c7b[_0x546d('0x12')]||0x1388;}})[_0x546d('0x13')](function(){return dbH[_0x546d('0x14')]['query'](util[_0x546d('0xd')](_0x546d('0x15'),QUERY),{'type':dbH[_0x546d('0x14')][_0x546d('0x16')][_0x546d('0x17')]});})[_0x546d('0x13')](function(_0x4bfe85){if(!_0x4bfe85[0x0][_0x546d('0x18')]){return analyticExtractedReport(_0x546d('0x19'));}var _0x440571=[];var _0x21c0e3=0x0;if(_0xac5c7b[_0x546d('0x11')]){if(_0x4bfe85&&_0x4bfe85['length']){var _0x4a6b6f=_[_0x546d('0x1a')](_0x4bfe85[0x0][_0x546d('0x18')]/_0x689478);var _0x598d6e=Number[_0x546d('0x1b')](_0x4bfe85[0x0]['num']/_0x689478)?_0x4bfe85[0x0][_0x546d('0x18')]%_0x689478:0x0;_0x4a6b6f[_0x546d('0x1c')](function(_0xc6ed3){if(_0xc6ed3>0x0){_0x21c0e3+=_0x689478;}_0x440571['push'](dbH[_0x546d('0x14')][_0x546d('0x1d')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x689478,_0x21c0e3),{'type':dbH[_0x546d('0x14')][_0x546d('0x16')][_0x546d('0x17')]}));});if(_0x598d6e>0x0){_0x21c0e3+=_0x689478;_0x440571[_0x546d('0x1e')](dbH[_0x546d('0x14')][_0x546d('0x1d')](util[_0x546d('0xd')](_0x546d('0x1f'),QUERY,_0x598d6e,_0x21c0e3),{'type':dbH['sequelize'][_0x546d('0x16')][_0x546d('0x17')]}));}}}else{_0x440571[_0x546d('0x1e')](dbH[_0x546d('0x14')][_0x546d('0x1d')](QUERY,{'type':dbH[_0x546d('0x14')][_0x546d('0x16')]['SELECT']}));}var _0x3ba019=path[_0x546d('0x20')](PATH);var _0x3a8cee=path[_0x546d('0x21')](PATH,_0x546d('0x22'));var _0x1e5485=_0xac5c7b['split']&&_0x440571[_0x546d('0x23')]>0x1;var _0x5c95b3=[];if(!fs[_0x546d('0x24')](path[_0x546d('0x25')](_0x3ba019,_0x3a8cee))&&_0x1e5485){fs[_0x546d('0x26')](path['join'](_0x3ba019,_0x3a8cee));}return BPromise[_0x546d('0x27')](_0x440571,function(_0x45703d){_0x5c95b3[_0x546d('0x1e')](_0x45703d);})[_0x546d('0x13')](function(){for(var _0x52ec21=0x0;_0x52ec21<_0x5c95b3['length'];_0x52ec21+=0x1){var _0x3c4354;var _0x3c641c=_0x5c95b3[_0x52ec21];if(_0x1e5485){_0x3c4354=path['join'](_0x3ba019,_0x3a8cee,util[_0x546d('0xd')](_0x546d('0x28'),_0x3a8cee,_0x52ec21,_0x546d('0x29')));}else{_0x3c4354=path[_0x546d('0x25')](_0x3ba019,util[_0x546d('0xd')](_0x546d('0x2a'),_0x3a8cee,'csv'));}fs[_0x546d('0x2b')](_0x3c4354,csv(_0x3c641c));}})[_0x546d('0x13')](function(){if(_0x1e5485){return new Promise(function(_0x30fad3){zipdir(path['join'](_0x3ba019,_0x3a8cee),{'saveTo':path[_0x546d('0x25')](_0x3ba019,util[_0x546d('0xd')]('%s.%s',_0x3a8cee,_0x546d('0x2c')))},function(_0x32a0d2,_0x5ee928){rimraf(path[_0x546d('0x25')](_0x3ba019,_0x3a8cee),function(){});_0x30fad3(_0x546d('0x2d'));});});}})[_0x546d('0x13')](function(){logger[_0x546d('0xc')](util['format'](_0x546d('0x2e'),EXTRACTED_REPORT_ID,_0x546d('0xf')));return analyticExtractedReport(_0x546d('0x2f'),_0x1e5485?util['format']('%s.%s',_0x3a8cee,_0x1e5485?_0x546d('0x2c'):_0x546d('0x29')):null);});})[_0x546d('0x30')](function(_0x15e0a8){logger[_0x546d('0xc')](util[_0x546d('0xd')](_0x546d('0x31'),EXTRACTED_REPORT_ID,_0x546d('0xf')),util[_0x546d('0x32')](_0x15e0a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x546d('0x33'));})[_0x546d('0x34')](function(){process[_0x546d('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xcb4a=['QueryTypes','SELECT','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','length','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Failed','finally','exit','path','lodash','to-csv','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x52947b,_0x2326f4){var _0x4199ce=function(_0x25cc6d){while(--_0x25cc6d){_0x52947b['push'](_0x52947b['shift']());}};_0x4199ce(++_0x2326f4);}(_0xcb4a,0x74));var _0xacb4=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcb4a[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var path=require(_0xacb4('0x0'));var _=require(_0xacb4('0x1'));var csv=require(_0xacb4('0x2'));var fs=require('fs');var BPromise=require(_0xacb4('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xacb4('0x4'))['db'];var dbH=require(_0xacb4('0x4'))['dbH'];var logger=require(_0xacb4('0x5'))(_0xacb4('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xacb4('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xacb4('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1aed0f,_0x4be468){var _0x2d7b7a={'status':_0x1aed0f};var _0x4d284e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4be468){_0x2d7b7a[_0xacb4('0x8')]=_0x4be468;}return db[_0xacb4('0x9')]['update'](_0x2d7b7a,_0x4d284e);}function main(){var _0x4a7715=0x1388;var _0x40999d;logger[_0xacb4('0xa')](util[_0xacb4('0xb')](_0xacb4('0xc'),EXTRACTED_REPORT_ID,_0xacb4('0xd')));return db[_0xacb4('0xe')][_0xacb4('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xacb4('0x10'),_0xacb4('0x11')]})[_0xacb4('0x12')](function(_0x418900){if(_0x418900){_0x40999d=_0x418900;_0x4a7715=_0x40999d['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xacb4('0x13')][_0xacb4('0x14')](util[_0xacb4('0xb')](_0xacb4('0x15'),QUERY),{'type':dbH[_0xacb4('0x13')][_0xacb4('0x16')][_0xacb4('0x17')]});})[_0xacb4('0x12')](function(_0x3bdf26){if(!_0x3bdf26[0x0]['num']){return analyticExtractedReport('Empty');}var _0x304870=[];var _0x2e0051=0x0;if(_0x40999d['split']){if(_0x3bdf26&&_0x3bdf26['length']){var _0x53d5fa=_[_0xacb4('0x18')](_0x3bdf26[0x0][_0xacb4('0x19')]/_0x4a7715);var _0x183d4c=Number[_0xacb4('0x1a')](_0x3bdf26[0x0]['num']/_0x4a7715)?_0x3bdf26[0x0]['num']%_0x4a7715:0x0;_0x53d5fa[_0xacb4('0x1b')](function(_0x1bb7ee){if(_0x1bb7ee>0x0){_0x2e0051+=_0x4a7715;}_0x304870[_0xacb4('0x1c')](dbH[_0xacb4('0x13')][_0xacb4('0x14')](util[_0xacb4('0xb')](_0xacb4('0x1d'),QUERY,_0x4a7715,_0x2e0051),{'type':dbH[_0xacb4('0x13')][_0xacb4('0x16')][_0xacb4('0x17')]}));});if(_0x183d4c>0x0){_0x2e0051+=_0x4a7715;_0x304870['push'](dbH['sequelize'][_0xacb4('0x14')](util[_0xacb4('0xb')](_0xacb4('0x1d'),QUERY,_0x183d4c,_0x2e0051),{'type':dbH[_0xacb4('0x13')][_0xacb4('0x16')]['SELECT']}));}}}else{_0x304870[_0xacb4('0x1c')](dbH[_0xacb4('0x13')][_0xacb4('0x14')](QUERY,{'type':dbH['sequelize'][_0xacb4('0x16')][_0xacb4('0x17')]}));}var _0x1846d6=path[_0xacb4('0x1e')](PATH);var _0x4296ec=path['basename'](PATH,'.csv');var _0x534f8c=_0x40999d[_0xacb4('0x10')]&&_0x304870[_0xacb4('0x1f')]>0x1;var _0x17c3ff=[];if(!fs[_0xacb4('0x20')](path[_0xacb4('0x21')](_0x1846d6,_0x4296ec))&&_0x534f8c){fs[_0xacb4('0x22')](path['join'](_0x1846d6,_0x4296ec));}return BPromise['each'](_0x304870,function(_0x280f63){_0x17c3ff['push'](_0x280f63);})[_0xacb4('0x12')](function(){for(var _0x2fc3ad=0x0;_0x2fc3ad<_0x17c3ff[_0xacb4('0x1f')];_0x2fc3ad+=0x1){var _0x2708f1;var _0x1d3fff=_0x17c3ff[_0x2fc3ad];if(_0x534f8c){_0x2708f1=path[_0xacb4('0x21')](_0x1846d6,_0x4296ec,util['format'](_0xacb4('0x23'),_0x4296ec,_0x2fc3ad,_0xacb4('0x24')));}else{_0x2708f1=path[_0xacb4('0x21')](_0x1846d6,util['format'](_0xacb4('0x25'),_0x4296ec,_0xacb4('0x24')));}fs[_0xacb4('0x26')](_0x2708f1,csv(_0x1d3fff));}})[_0xacb4('0x12')](function(){if(_0x534f8c){return new Promise(function(_0x2ad933){zipdir(path['join'](_0x1846d6,_0x4296ec),{'saveTo':path[_0xacb4('0x21')](_0x1846d6,util['format'](_0xacb4('0x25'),_0x4296ec,_0xacb4('0x27')))},function(_0x3c3c96,_0xecbc33){rimraf(path[_0xacb4('0x21')](_0x1846d6,_0x4296ec),function(){});_0x2ad933(_0xacb4('0x28'));});});}})[_0xacb4('0x12')](function(){logger['info'](util[_0xacb4('0xb')](_0xacb4('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xacb4('0x2a'),_0x534f8c?util['format'](_0xacb4('0x25'),_0x4296ec,_0x534f8c?_0xacb4('0x27'):_0xacb4('0x24')):null);});})['catch'](function(_0x1cee7c){logger[_0xacb4('0xa')](util[_0xacb4('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x1cee7c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xacb4('0x2b'));})[_0xacb4('0x2c')](function(){process[_0xacb4('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 9992f91..e553042 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 _0x7be7=['Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','forEach','sequelize','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','info','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','pipe','finish','error','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','value','fill','length','auto','body','push','concat','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right'];(function(_0x4673d4,_0x3d2597){var _0x41a926=function(_0x43ef5e){while(--_0x43ef5e){_0x4673d4['push'](_0x4673d4['shift']());}};_0x41a926(++_0x3d2597);}(_0x7be7,0x19b));var _0x77be=function(_0x658218,_0x5d42ab){_0x658218=_0x658218-0x0;var _0x5541e6=_0x7be7[_0x658218];return _0x5541e6;};'use strict';var _=require(_0x77be('0x0'));var fs=require('fs');var util=require(_0x77be('0x1'));var path=require(_0x77be('0x2'));var moment=require(_0x77be('0x3'));var htmlToPdfmake=require(_0x77be('0x4'));var PdfPrinter=require(_0x77be('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x77be('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x77be('0x7')];var BPromise=require(_0x77be('0x8'));var db=require(_0x77be('0x9'))['db'];var dbH=require('../../mysqldb')[_0x77be('0xa')];var logger=require(_0x77be('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x77be('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x77be('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x20b234,_0x5e173a){var _0x5400b5={'status':_0x20b234};var _0x2cd392={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e173a){_0x5400b5[_0x77be('0xe')]=_0x5e173a;}return db[_0x77be('0xf')]['update'](_0x5400b5,_0x2cd392);}function getHeaders(_0x3a59c6){return _[_0x77be('0x10')](_0x3a59c6,function(_0x343a94){return{'text':_0x343a94,'style':_0x77be('0x11')};});}function getRows(_0xbe3f46,_0x684d79){return _[_0x77be('0x10')](_0x684d79,function(_0x149fd5){return _(_0x149fd5)['pick'](_0xbe3f46)[_0x77be('0x10')](function(_0x25e0de){return _0x25e0de?_['toString'](_0x25e0de):'';})[_0x77be('0x12')]();});}function createTable(_0x4810bc,_0x151fee){var _0x1cb9a1={'widths':_[_0x77be('0x13')](Array(_0x4810bc[_0x77be('0x14')]),0x91),'heights':function(_0x4eab13){return _0x4eab13===0x0?_0x77be('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xac76cc=getHeaders(_0x4810bc);_0x1cb9a1[_0x77be('0x16')][_0x77be('0x17')](_0xac76cc);var _0x221bb8=getRows(_0x4810bc,_0x151fee);_0x1cb9a1[_0x77be('0x16')]=_0x1cb9a1[_0x77be('0x16')][_0x77be('0x18')](_0x221bb8);return _0x1cb9a1;}function createTables(_0x4ba4fd){var _0x147382=[];var _0x172d7b=_[_0x77be('0x19')](Object['keys'](_0x4ba4fd[0x0]),0x5);_0x172d7b['forEach'](function(_0x161b59){_0x147382['push'](createTable(_0x161b59,_0x4ba4fd));});return _0x147382;}function getPDFDocDefinition(_0x54b857){var _0x25dbd0=util['format'](_0x77be('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x77be('0x1b')])[_0x77be('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x77be('0x1d')])[_0x77be('0x1c')](FORMAT));var _0x16aba5=[];for(var _0x1d1b5a=0x0;_0x1d1b5a<_0x54b857[_0x77be('0x14')];_0x1d1b5a++){var _0x396131=[];if(_0x1d1b5a===0x0){_0x396131[_0x77be('0x17')]({'text':_0x25dbd0,'style':_0x77be('0x1e')});}var _0x347cb9={'table':_0x54b857[_0x1d1b5a]};if(_0x1d1b5a>0x0){_0x347cb9[_0x77be('0x1f')]='before';_0x347cb9[_0x77be('0x20')]=[0x0,0x46,0x0,0x0];}_0x396131['push'](_0x347cb9);_0x16aba5[_0x77be('0x17')](_0x396131);}return{'pageSize':'A4','pageOrientation':_0x77be('0x21'),'content':_0x16aba5,'footer':function(_0x58d1b3,_0x26d437){return{'text':_0x58d1b3['toString']()+_0x77be('0x22')+_0x26d437,'style':_0x77be('0x23')};},'defaultStyle':{'font':_0x77be('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x77be('0x25')},'footer':{'alignment':_0x77be('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x8bc5df){var _0x615802=0x1388;var _0xbc20f4;if(!_0x8bc5df[0x0]['num']){return analyticExtractedReport(_0x77be('0x27'));}return db[_0x77be('0x28')][_0x77be('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x77be('0x2a'),_0x77be('0x2b')]})[_0x77be('0x2c')](function(_0x5975aa){if(_0x5975aa){_0xbc20f4=_0x5975aa;_0x615802=_0xbc20f4['splitSizePdf']||0x3e8;}})[_0x77be('0x2c')](function(){var _0x5e0561=[];var _0x3217dd=0x0;if(_0xbc20f4[_0x77be('0x2a')]){if(_0x8bc5df&&_0x8bc5df['length']){var _0x5dabc1=_[_0x77be('0x2d')](_0x8bc5df[0x0][_0x77be('0x2e')]/_0x615802);var _0x43b2ef=Number[_0x77be('0x2f')](_0x8bc5df[0x0][_0x77be('0x2e')]/_0x615802)?_0x8bc5df[0x0][_0x77be('0x2e')]%_0x615802:0x0;_0x5dabc1[_0x77be('0x30')](function(_0x18bef3){if(_0x18bef3>0x0){_0x3217dd+=_0x615802;}_0x5e0561['push'](dbH[_0x77be('0x31')]['query'](util[_0x77be('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x615802,_0x3217dd),{'type':dbH[_0x77be('0x31')]['QueryTypes'][_0x77be('0x32')]}));});if(_0x43b2ef>0x0){_0x3217dd+=_0x615802;_0x5e0561[_0x77be('0x17')](dbH[_0x77be('0x31')]['query'](util[_0x77be('0x1c')](_0x77be('0x33'),QUERY,_0x43b2ef,_0x3217dd),{'type':dbH['sequelize']['QueryTypes'][_0x77be('0x32')]}));}}}else{_0x5e0561[_0x77be('0x17')](dbH[_0x77be('0x31')][_0x77be('0x34')](QUERY,{'type':dbH[_0x77be('0x31')][_0x77be('0x35')][_0x77be('0x32')]}));}var _0xb098bd=path[_0x77be('0x36')](PATH);var _0x5db7c6=path[_0x77be('0x37')](PATH,_0x77be('0x38'));var _0x44ce7a=_0xbc20f4[_0x77be('0x2a')]&&_0x5e0561[_0x77be('0x14')]>0x1;var _0x12d224=[];if(!fs[_0x77be('0x39')](path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6))&&_0x44ce7a){fs[_0x77be('0x3b')](path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6));}return BPromise[_0x77be('0x3c')](_0x5e0561,function(_0x1f1c0b){_0x12d224[_0x77be('0x17')](_0x1f1c0b);})[_0x77be('0x2c')](function(){var _0x1a4b87=[];for(var _0x3a9706=0x0;_0x3a9706<_0x12d224[_0x77be('0x14')];_0x3a9706+=0x1){var _0x284cd7=_0x12d224[_0x3a9706];var _0x4db94c=createTables(_['flatten'](_0x284cd7));var _0x172af9;var _0x4c65d6=getPDFDocDefinition(_0x4db94c);var _0x317ff4=getPDFPrinter();var _0x28653a=_0x317ff4[_0x77be('0x3d')](_0x4c65d6);if(_0x44ce7a){_0x172af9=path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6,util['format'](_0x77be('0x3e'),_0x5db7c6,_0x3a9706,'pdf'));}else{_0x172af9=path[_0x77be('0x3a')](_0xb098bd,util[_0x77be('0x1c')](_0x77be('0x3f'),_0x5db7c6,'pdf'));}_0x1a4b87[_0x77be('0x17')](writePDFDocument(_0x28653a,_0x172af9));}return Promise[_0x77be('0x40')](_0x1a4b87);})[_0x77be('0x2c')](function(){if(_0x44ce7a){return new Promise(function(_0x5c2204){zipdir(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),{'saveTo':path[_0x77be('0x3a')](_0xb098bd,util[_0x77be('0x1c')]('%s.%s',_0x5db7c6,_0x77be('0x41')))},function(){rimraf(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),function(){});_0x5c2204('zip\x20finished');});});}})[_0x77be('0x2c')](function(){if(!_0x44ce7a)return;rimraf(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),function(){});})[_0x77be('0x2c')](function(){logger[_0x77be('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x77be('0x43')));return analyticExtractedReport(_0x77be('0x44'),_0x44ce7a?util[_0x77be('0x1c')]('%s.%s',_0x5db7c6,_0x44ce7a?_0x77be('0x41'):_0x77be('0x45')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x77be('0x42')](util[_0x77be('0x1c')](_0x77be('0x46'),EXTRACTED_REPORT_ID,_0x77be('0x43')));return db[_0x77be('0xf')][_0x77be('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x77be('0x2c')](function(_0x2b24be){EXTRACTED_REPORT=_0x2b24be;return dbH[_0x77be('0x31')]['query'](util['format'](_0x77be('0x48'),QUERY),{'type':dbH[_0x77be('0x31')][_0x77be('0x35')]['SELECT']});})[_0x77be('0x2c')](extractReport)[_0x77be('0x49')](function(_0x28bc34){logger[_0x77be('0x42')](util[_0x77be('0x1c')](_0x77be('0x4a'),EXTRACTED_REPORT_ID,_0x77be('0x43')),util['inspect'](_0x28bc34,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x77be('0x4b'));})[_0x77be('0x4c')](function(){process[_0x77be('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2118b9=new PdfPrinter({'Arial':{'normal':__dirname+_0x77be('0x4e'),'bold':__dirname+_0x77be('0x4f'),'italics':__dirname+_0x77be('0x50'),'bolditalics':__dirname+_0x77be('0x51')}});return _0x2118b9;}function getPDFDocDefinitionFromHTML(_0x1f7c58,_0x513231){var _0x1e5f23=util['format'](_0x77be('0x52'),_0x513231['channel'],_0x513231[_0x77be('0x53')]);var _0x168d51=moment()[_0x77be('0x1c')]('YYYY-MM-DD')['toString']();var _0x46c010=htmlToPdfmake(_0x1f7c58,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46c010],'defaultStyle':{'font':_0x77be('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x77be('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x77be('0x55'),'style':'header'}];},'footer':function(_0x438e2a,_0x5ee98c){return[{'text':util[_0x77be('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1e5f23,_0x438e2a,_0x5ee98c,_0x168d51),'style':_0x77be('0x23')}];}};}function writePDFDocument(_0x163ce4,_0x5f319b){return new Promise(function(_0x186d2c,_0x40ed91){var _0x33033e=_0x163ce4[_0x77be('0x56')](fs['createWriteStream'](_0x5f319b));_0x33033e['on'](_0x77be('0x57'),function(){_0x186d2c(_0x77be('0x57'));});_0x33033e['on'](_0x77be('0x58'),function(_0x350f4e){_0x40ed91(_0x350f4e);});_0x163ce4[_0x77be('0x59')]();});}exports['createPdfFromHTML']=function(_0x52e0b4,_0x5ca465){var _0x1eec5d=getPDFPrinter();var _0x275f8f=getPDFDocDefinitionFromHTML(_0x52e0b4,_0x5ca465);var _0x1aede8=_0x1eec5d[_0x77be('0x3d')](_0x275f8f);return writePDFDocument(_0x1aede8,_0x5ca465[_0x77be('0x2')])[_0x77be('0x49')](function(_0x5cbf9b){throw _0x5cbf9b;});}; \ No newline at end of file +var _0x91db=['each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','.pdf','existsSync','join','mkdirSync'];(function(_0x528fc6,_0x1c848f){var _0x218634=function(_0x534ab6){while(--_0x534ab6){_0x528fc6['push'](_0x528fc6['shift']());}};_0x218634(++_0x1c848f);}(_0x91db,0xe4));var _0xb91d=function(_0x153eb1,_0x3154b4){_0x153eb1=_0x153eb1-0x0;var _0x3f0304=_0x91db[_0x153eb1];return _0x3f0304;};'use strict';var _=require(_0xb91d('0x0'));var fs=require('fs');var util=require(_0xb91d('0x1'));var path=require(_0xb91d('0x2'));var moment=require(_0xb91d('0x3'));var htmlToPdfmake=require(_0xb91d('0x4'));var PdfPrinter=require(_0xb91d('0x5'));var zipdir=require(_0xb91d('0x6'));var rimraf=require(_0xb91d('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xb91d('0x8')];var BPromise=require(_0xb91d('0x9'));var db=require(_0xb91d('0xa'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xb91d('0xb'))(_0xb91d('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0xb91d('0xd')][0x2]);var QUERY=process[_0xb91d('0xd')][0x3];var PATH=process[_0xb91d('0xd')][0x4];var NAME=process[_0xb91d('0xd')][0x5];var FORMAT=_0xb91d('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a6f65,_0x3081ab){var _0x26e8d5={'status':_0x4a6f65};var _0x4d9d1b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3081ab){_0x26e8d5[_0xb91d('0xf')]=_0x3081ab;}return db[_0xb91d('0x10')][_0xb91d('0x11')](_0x26e8d5,_0x4d9d1b);}function getHeaders(_0xb6024d){return _[_0xb91d('0x12')](_0xb6024d,function(_0x410678){return{'text':_0x410678,'style':_0xb91d('0x13')};});}function getRows(_0x1d92cc,_0x1903b5){return _['map'](_0x1903b5,function(_0x59376e){return _(_0x59376e)[_0xb91d('0x14')](_0x1d92cc)[_0xb91d('0x12')](function(_0x13c9c4){return _0x13c9c4?_[_0xb91d('0x15')](_0x13c9c4):'';})[_0xb91d('0x16')]();});}function createTable(_0x5eaa23,_0x10f8cb){var _0x173bbb={'widths':_[_0xb91d('0x17')](Array(_0x5eaa23[_0xb91d('0x18')]),0x91),'heights':function(_0x2271e5){return _0x2271e5===0x0?_0xb91d('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x187097=getHeaders(_0x5eaa23);_0x173bbb[_0xb91d('0x1a')][_0xb91d('0x1b')](_0x187097);var _0x490f04=getRows(_0x5eaa23,_0x10f8cb);_0x173bbb['body']=_0x173bbb[_0xb91d('0x1a')][_0xb91d('0x1c')](_0x490f04);return _0x173bbb;}function createTables(_0x318d6d){var _0x49366f=[];var _0x58ba24=_[_0xb91d('0x1d')](Object[_0xb91d('0x1e')](_0x318d6d[0x0]),0x5);_0x58ba24[_0xb91d('0x1f')](function(_0x759d74){_0x49366f[_0xb91d('0x1b')](createTable(_0x759d74,_0x318d6d));});return _0x49366f;}function getPDFDocDefinition(_0x103137){var _0x1d67a6=util[_0xb91d('0x20')](_0xb91d('0x21'),NAME,EXTRACTED_REPORT[_0xb91d('0x22')],moment(EXTRACTED_REPORT[_0xb91d('0x23')])[_0xb91d('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0xb91d('0x24')])[_0xb91d('0x20')](FORMAT));var _0x1f39b7=[];for(var _0x560234=0x0;_0x560234<_0x103137[_0xb91d('0x18')];_0x560234++){var _0x368e93=[];if(_0x560234===0x0){_0x368e93['push']({'text':_0x1d67a6,'style':'header'});}var _0x2dea07={'table':_0x103137[_0x560234]};if(_0x560234>0x0){_0x2dea07[_0xb91d('0x25')]=_0xb91d('0x26');_0x2dea07[_0xb91d('0x27')]=[0x0,0x46,0x0,0x0];}_0x368e93[_0xb91d('0x1b')](_0x2dea07);_0x1f39b7[_0xb91d('0x1b')](_0x368e93);}return{'pageSize':'A4','pageOrientation':_0xb91d('0x28'),'content':_0x1f39b7,'footer':function(_0xddb0b6,_0x2727ed){return{'text':_0xddb0b6['toString']()+_0xb91d('0x29')+_0x2727ed,'style':_0xb91d('0x2a')};},'defaultStyle':{'font':_0xb91d('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xb91d('0x2c')},'footer':{'alignment':_0xb91d('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x37348c){var _0x5b544c=0x1388;var _0x26af39;if(!_0x37348c[0x0][_0xb91d('0x2e')]){return analyticExtractedReport(_0xb91d('0x2f'));}return db[_0xb91d('0x30')][_0xb91d('0x31')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb91d('0x32'),'splitSizePdf']})[_0xb91d('0x33')](function(_0x51db28){if(_0x51db28){_0x26af39=_0x51db28;_0x5b544c=_0x26af39[_0xb91d('0x34')]||0x3e8;}})[_0xb91d('0x33')](function(){var _0xd1c490=[];var _0x592492=0x0;if(_0x26af39[_0xb91d('0x32')]){if(_0x37348c&&_0x37348c[_0xb91d('0x18')]){var _0x31f451=_[_0xb91d('0x35')](_0x37348c[0x0][_0xb91d('0x2e')]/_0x5b544c);var _0x1035f0=Number[_0xb91d('0x36')](_0x37348c[0x0]['num']/_0x5b544c)?_0x37348c[0x0][_0xb91d('0x2e')]%_0x5b544c:0x0;_0x31f451[_0xb91d('0x1f')](function(_0x55c0d5){if(_0x55c0d5>0x0){_0x592492+=_0x5b544c;}_0xd1c490[_0xb91d('0x1b')](dbH[_0xb91d('0x37')]['query'](util[_0xb91d('0x20')](_0xb91d('0x38'),QUERY,_0x5b544c,_0x592492),{'type':dbH[_0xb91d('0x37')][_0xb91d('0x39')][_0xb91d('0x3a')]}));});if(_0x1035f0>0x0){_0x592492+=_0x5b544c;_0xd1c490[_0xb91d('0x1b')](dbH[_0xb91d('0x37')]['query'](util[_0xb91d('0x20')](_0xb91d('0x38'),QUERY,_0x1035f0,_0x592492),{'type':dbH['sequelize'][_0xb91d('0x39')][_0xb91d('0x3a')]}));}}}else{_0xd1c490[_0xb91d('0x1b')](dbH[_0xb91d('0x37')][_0xb91d('0x3b')](QUERY,{'type':dbH[_0xb91d('0x37')][_0xb91d('0x39')]['SELECT']}));}var _0x56a069=path[_0xb91d('0x3c')](PATH);var _0x1d2a6a=path[_0xb91d('0x3d')](PATH,_0xb91d('0x3e'));var _0x40d66c=_0x26af39['split']&&_0xd1c490[_0xb91d('0x18')]>0x1;var _0xf449c2=[];if(!fs[_0xb91d('0x3f')](path[_0xb91d('0x40')](_0x56a069,_0x1d2a6a))&&_0x40d66c){fs[_0xb91d('0x41')](path[_0xb91d('0x40')](_0x56a069,_0x1d2a6a));}return BPromise[_0xb91d('0x42')](_0xd1c490,function(_0x45be65){_0xf449c2['push'](_0x45be65);})[_0xb91d('0x33')](function(){var _0x28ada0=[];for(var _0x41fe1c=0x0;_0x41fe1c<_0xf449c2['length'];_0x41fe1c+=0x1){var _0x1d0ae8=_0xf449c2[_0x41fe1c];var _0x2b4d51=createTables(_[_0xb91d('0x43')](_0x1d0ae8));var _0x3e77be;var _0x200261=getPDFDocDefinition(_0x2b4d51);var _0x53c275=getPDFPrinter();var _0x2555a0=_0x53c275[_0xb91d('0x44')](_0x200261);if(_0x40d66c){_0x3e77be=path[_0xb91d('0x40')](_0x56a069,_0x1d2a6a,util['format'](_0xb91d('0x45'),_0x1d2a6a,_0x41fe1c,_0xb91d('0x46')));}else{_0x3e77be=path[_0xb91d('0x40')](_0x56a069,util['format']('%s.%s',_0x1d2a6a,_0xb91d('0x46')));}_0x28ada0[_0xb91d('0x1b')](writePDFDocument(_0x2555a0,_0x3e77be));}return Promise[_0xb91d('0x47')](_0x28ada0);})['then'](function(){if(_0x40d66c){return new Promise(function(_0x245115){zipdir(path['join'](_0x56a069,_0x1d2a6a),{'saveTo':path['join'](_0x56a069,util[_0xb91d('0x20')](_0xb91d('0x48'),_0x1d2a6a,_0xb91d('0x49')))},function(){rimraf(path['join'](_0x56a069,_0x1d2a6a),function(){});_0x245115('zip\x20finished');});});}})[_0xb91d('0x33')](function(){if(!_0x40d66c)return;rimraf(path['join'](_0x56a069,_0x1d2a6a),function(){});})[_0xb91d('0x33')](function(){logger[_0xb91d('0x4a')](util[_0xb91d('0x20')](_0xb91d('0x4b'),EXTRACTED_REPORT_ID,_0xb91d('0x4c')));return analyticExtractedReport(_0xb91d('0x4d'),_0x40d66c?util[_0xb91d('0x20')](_0xb91d('0x48'),_0x1d2a6a,_0x40d66c?_0xb91d('0x49'):_0xb91d('0x46')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xb91d('0x4a')](util[_0xb91d('0x20')](_0xb91d('0x4e'),EXTRACTED_REPORT_ID,_0xb91d('0x4c')));return db[_0xb91d('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xe6f75a){EXTRACTED_REPORT=_0xe6f75a;return dbH[_0xb91d('0x37')]['query'](util[_0xb91d('0x20')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb91d('0x37')]['QueryTypes'][_0xb91d('0x3a')]});})[_0xb91d('0x33')](extractReport)['catch'](function(_0x54c45a){logger['info'](util[_0xb91d('0x20')](_0xb91d('0x4f'),EXTRACTED_REPORT_ID,_0xb91d('0x4c')),util[_0xb91d('0x50')](_0x54c45a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb91d('0x51')](function(){process[_0xb91d('0x52')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xdc7e20=new PdfPrinter({'Arial':{'normal':__dirname+_0xb91d('0x53'),'bold':__dirname+_0xb91d('0x54'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xdc7e20;}function getPDFDocDefinitionFromHTML(_0xc0c2c4,_0x8ea35f){var _0x15a544=util['format']('%s\x20#%d',_0x8ea35f[_0xb91d('0x55')],_0x8ea35f[_0xb91d('0x56')]);var _0x5c49bf=moment()['format'](_0xb91d('0x57'))[_0xb91d('0x15')]();var _0x5833cb=htmlToPdfmake(_0xc0c2c4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5833cb],'defaultStyle':{'font':_0xb91d('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb91d('0x58'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xb91d('0x58'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xb91d('0x58')}},'header':function(){return[{'text':_0xb91d('0x59'),'style':_0xb91d('0x5a')}];},'footer':function(_0x508355,_0x5c3e29){return[{'text':util[_0xb91d('0x20')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x15a544,_0x508355,_0x5c3e29,_0x5c49bf),'style':'footer'}];}};}function writePDFDocument(_0x40b791,_0x15d79e){return new Promise(function(_0x115591,_0x4bebe2){var _0x193ff1=_0x40b791[_0xb91d('0x5b')](fs[_0xb91d('0x5c')](_0x15d79e));_0x193ff1['on'](_0xb91d('0x5d'),function(){_0x115591('finish');});_0x193ff1['on'](_0xb91d('0x5e'),function(_0x604e79){_0x4bebe2(_0x604e79);});_0x40b791[_0xb91d('0x5f')]();});}exports[_0xb91d('0x60')]=function(_0x53de6d,_0x5015db){var _0x5003fb=getPDFPrinter();var _0x55f560=getPDFDocDefinitionFromHTML(_0x53de6d,_0x5015db);var _0x4da626=_0x5003fb[_0xb91d('0x44')](_0x55f560);return writePDFDocument(_0x4da626,_0x5015db[_0xb91d('0x2')])[_0xb91d('0x61')](function(_0x517b59){throw _0x517b59;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c59610f..58aaeb5 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 _0xd1fb=['join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','.xlsx','existsSync'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xd1fb,0xa2));var _0xbd1f=function(_0x54d267,_0x57d7fc){_0x54d267=_0x54d267-0x0;var _0x4c0b1b=_0xd1fb[_0x54d267];return _0x4c0b1b;};'use strict';var util=require(_0xbd1f('0x0'));var path=require(_0xbd1f('0x1'));var _=require(_0xbd1f('0x2'));var fs=require('fs');var json2xls=require(_0xbd1f('0x3'));var BPromise=require(_0xbd1f('0x4'));var zipdir=require(_0xbd1f('0x5'));var rimraf=require(_0xbd1f('0x6'));var db=require(_0xbd1f('0x7'))['db'];var dbH=require(_0xbd1f('0x7'))[_0xbd1f('0x8')];var logger=require('../../config/logger')(_0xbd1f('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xbd1f('0xa')][0x2]);var QUERY=process[_0xbd1f('0xa')][0x3];var PATH=process[_0xbd1f('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbaf62b,_0xace629){var _0x5cc94f={'status':_0xbaf62b};var _0x933b50={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xace629){_0x5cc94f[_0xbd1f('0xb')]=_0xace629;}return db[_0xbd1f('0xc')][_0xbd1f('0xd')](_0x5cc94f,_0x933b50);}function main(){var _0x10536f=0x1388;var _0x3cacee;logger['info'](util['format'](_0xbd1f('0xe'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')));return db[_0xbd1f('0x10')][_0xbd1f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd1f('0x12'),_0xbd1f('0x13')]})[_0xbd1f('0x14')](function(_0x3e1238){if(_0x3e1238){_0x3cacee=_0x3e1238;_0x10536f=_0x3cacee[_0xbd1f('0x13')]||0x1388;}})[_0xbd1f('0x14')](function(){return dbH[_0xbd1f('0x15')][_0xbd1f('0x16')](util[_0xbd1f('0x17')](_0xbd1f('0x18'),QUERY),{'type':dbH[_0xbd1f('0x15')]['QueryTypes']['SELECT']});})[_0xbd1f('0x14')](function(_0x1c7c53){if(!_0x1c7c53[0x0][_0xbd1f('0x19')]){return analyticExtractedReport('Empty');}var _0x452931=[];var _0x382251=0x0;if(_0x3cacee[_0xbd1f('0x12')]){if(_0x1c7c53&&_0x1c7c53[_0xbd1f('0x1a')]){var _0x31233c=_[_0xbd1f('0x1b')](_0x1c7c53[0x0][_0xbd1f('0x19')]/_0x10536f);var _0x1465e5=Number['isInteger'](_0x1c7c53[0x0][_0xbd1f('0x19')]/_0x10536f)?_0x1c7c53[0x0][_0xbd1f('0x19')]%_0x10536f:0x0;_0x31233c['forEach'](function(_0xc46665){if(_0xc46665>0x0){_0x382251+=_0x10536f;}_0x452931[_0xbd1f('0x1c')](dbH[_0xbd1f('0x15')]['query'](util[_0xbd1f('0x17')](_0xbd1f('0x1d'),QUERY,_0x10536f,_0x382251),{'type':dbH[_0xbd1f('0x15')]['QueryTypes'][_0xbd1f('0x1e')]}));});if(_0x1465e5>0x0){_0x382251+=_0x10536f;_0x452931['push'](dbH[_0xbd1f('0x15')]['query'](util[_0xbd1f('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1465e5,_0x382251),{'type':dbH[_0xbd1f('0x15')][_0xbd1f('0x1f')][_0xbd1f('0x1e')]}));}}}else{_0x452931['push'](dbH[_0xbd1f('0x15')][_0xbd1f('0x16')](QUERY,{'type':dbH[_0xbd1f('0x15')]['QueryTypes'][_0xbd1f('0x1e')]}));}var _0x4d9dc8=path['dirname'](PATH);var _0x3bca7b=path['basename'](PATH,_0xbd1f('0x20'));var _0x268548=_0x3cacee['split']&&_0x452931['length']>0x1;var _0x2721bb=[];if(!fs[_0xbd1f('0x21')](path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b))&&_0x268548){fs[_0xbd1f('0x23')](path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b));}return BPromise[_0xbd1f('0x24')](_0x452931,function(_0x1a0ac5){_0x2721bb[_0xbd1f('0x1c')](_0x1a0ac5);})[_0xbd1f('0x14')](function(){for(var _0x47f7b7=0x0;_0x47f7b7<_0x2721bb['length'];_0x47f7b7+=0x1){var _0x184200;var _0x455bea=_0x2721bb[_0x47f7b7];if(_0x268548){_0x184200=path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b,util[_0xbd1f('0x17')](_0xbd1f('0x25'),_0x3bca7b,_0x47f7b7,'xlsx'));}else{_0x184200=path[_0xbd1f('0x22')](_0x4d9dc8,util[_0xbd1f('0x17')](_0xbd1f('0x26'),_0x3bca7b,_0xbd1f('0x27')));}fs[_0xbd1f('0x28')](_0x184200,json2xls(_0x455bea),'binary');}})[_0xbd1f('0x14')](function(){if(_0x268548){return new Promise(function(_0x19f48a){zipdir(path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b),{'saveTo':path[_0xbd1f('0x22')](_0x4d9dc8,util['format'](_0xbd1f('0x26'),_0x3bca7b,_0xbd1f('0x29')))},function(_0x17d96a,_0x126621){rimraf(path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b),function(){});_0x19f48a(_0xbd1f('0x2a'));});});}})['then'](function(){logger[_0xbd1f('0x2b')](util['format'](_0xbd1f('0x2c'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')));return analyticExtractedReport(_0xbd1f('0x2d'),_0x268548?util[_0xbd1f('0x17')](_0xbd1f('0x26'),_0x3bca7b,_0x268548?'zip':_0xbd1f('0x27')):null);});})['catch'](function(_0x362e2a){logger['info'](util['format'](_0xbd1f('0x2e'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')),util['inspect'](_0x362e2a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbd1f('0x2f'));})['finally'](function(){process[_0xbd1f('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd5f5=['Empty','length','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','existsSync','join','each','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','json2xls','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','splitSizeXlsx','sequelize','query','QueryTypes'];(function(_0x1fefbc,_0x31636c){var _0x4ee94d=function(_0x51efe0){while(--_0x51efe0){_0x1fefbc['push'](_0x1fefbc['shift']());}};_0x4ee94d(++_0x31636c);}(_0xd5f5,0xcc));var _0x5d5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd5f5[_0x46698a];return _0x356db0;};'use strict';var util=require(_0x5d5f('0x0'));var path=require(_0x5d5f('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x5d5f('0x2'));var BPromise=require(_0x5d5f('0x3'));var zipdir=require(_0x5d5f('0x4'));var rimraf=require('rimraf');var db=require(_0x5d5f('0x5'))['db'];var dbH=require(_0x5d5f('0x5'))[_0x5d5f('0x6')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x5d5f('0x7')][0x2]);var QUERY=process[_0x5d5f('0x7')][0x3];var PATH=process[_0x5d5f('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x554131,_0xf5c59c){var _0x99c8ef={'status':_0x554131};var _0xa6b45a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf5c59c){_0x99c8ef[_0x5d5f('0x8')]=_0xf5c59c;}return db[_0x5d5f('0x9')]['update'](_0x99c8ef,_0xa6b45a);}function main(){var _0x3c17e1=0x1388;var _0x5e23c2;logger['info'](util[_0x5d5f('0xa')](_0x5d5f('0xb'),EXTRACTED_REPORT_ID,_0x5d5f('0xc')));return db[_0x5d5f('0xd')][_0x5d5f('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5d5f('0xf'),'splitSizeXlsx']})[_0x5d5f('0x10')](function(_0x1dd593){if(_0x1dd593){_0x5e23c2=_0x1dd593;_0x3c17e1=_0x5e23c2[_0x5d5f('0x11')]||0x1388;}})['then'](function(){return dbH[_0x5d5f('0x12')][_0x5d5f('0x13')](util[_0x5d5f('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5d5f('0x12')][_0x5d5f('0x14')]['SELECT']});})[_0x5d5f('0x10')](function(_0x337c1e){if(!_0x337c1e[0x0]['num']){return analyticExtractedReport(_0x5d5f('0x15'));}var _0x4f2406=[];var _0x2377c9=0x0;if(_0x5e23c2[_0x5d5f('0xf')]){if(_0x337c1e&&_0x337c1e[_0x5d5f('0x16')]){var _0x275a75=_['range'](_0x337c1e[0x0][_0x5d5f('0x17')]/_0x3c17e1);var _0x39adef=Number['isInteger'](_0x337c1e[0x0]['num']/_0x3c17e1)?_0x337c1e[0x0][_0x5d5f('0x17')]%_0x3c17e1:0x0;_0x275a75[_0x5d5f('0x18')](function(_0xc5c364){if(_0xc5c364>0x0){_0x2377c9+=_0x3c17e1;}_0x4f2406[_0x5d5f('0x19')](dbH['sequelize'][_0x5d5f('0x13')](util[_0x5d5f('0xa')](_0x5d5f('0x1a'),QUERY,_0x3c17e1,_0x2377c9),{'type':dbH[_0x5d5f('0x12')][_0x5d5f('0x14')][_0x5d5f('0x1b')]}));});if(_0x39adef>0x0){_0x2377c9+=_0x3c17e1;_0x4f2406[_0x5d5f('0x19')](dbH[_0x5d5f('0x12')][_0x5d5f('0x13')](util[_0x5d5f('0xa')](_0x5d5f('0x1a'),QUERY,_0x39adef,_0x2377c9),{'type':dbH[_0x5d5f('0x12')][_0x5d5f('0x14')]['SELECT']}));}}}else{_0x4f2406[_0x5d5f('0x19')](dbH[_0x5d5f('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0x5d5f('0x14')][_0x5d5f('0x1b')]}));}var _0x3dde89=path[_0x5d5f('0x1c')](PATH);var _0x1811f7=path[_0x5d5f('0x1d')](PATH,'.xlsx');var _0x359d72=_0x5e23c2[_0x5d5f('0xf')]&&_0x4f2406[_0x5d5f('0x16')]>0x1;var _0x2cadb2=[];if(!fs[_0x5d5f('0x1e')](path[_0x5d5f('0x1f')](_0x3dde89,_0x1811f7))&&_0x359d72){fs['mkdirSync'](path[_0x5d5f('0x1f')](_0x3dde89,_0x1811f7));}return BPromise[_0x5d5f('0x20')](_0x4f2406,function(_0x93ed4a){_0x2cadb2[_0x5d5f('0x19')](_0x93ed4a);})['then'](function(){for(var _0x3d0673=0x0;_0x3d0673<_0x2cadb2['length'];_0x3d0673+=0x1){var _0x2b4503;var _0x498a41=_0x2cadb2[_0x3d0673];if(_0x359d72){_0x2b4503=path[_0x5d5f('0x1f')](_0x3dde89,_0x1811f7,util[_0x5d5f('0xa')]('%s%d.%s',_0x1811f7,_0x3d0673,_0x5d5f('0x21')));}else{_0x2b4503=path[_0x5d5f('0x1f')](_0x3dde89,util[_0x5d5f('0xa')](_0x5d5f('0x22'),_0x1811f7,_0x5d5f('0x21')));}fs['writeFileSync'](_0x2b4503,json2xls(_0x498a41),_0x5d5f('0x23'));}})[_0x5d5f('0x10')](function(){if(_0x359d72){return new Promise(function(_0x48de0d){zipdir(path[_0x5d5f('0x1f')](_0x3dde89,_0x1811f7),{'saveTo':path[_0x5d5f('0x1f')](_0x3dde89,util['format']('%s.%s',_0x1811f7,_0x5d5f('0x24')))},function(_0x16062b,_0x597a4b){rimraf(path[_0x5d5f('0x1f')](_0x3dde89,_0x1811f7),function(){});_0x48de0d(_0x5d5f('0x25'));});});}})[_0x5d5f('0x10')](function(){logger['info'](util['format'](_0x5d5f('0x26'),EXTRACTED_REPORT_ID,_0x5d5f('0xc')));return analyticExtractedReport(_0x5d5f('0x27'),_0x359d72?util[_0x5d5f('0xa')]('%s.%s',_0x1811f7,_0x359d72?'zip':_0x5d5f('0x21')):null);});})['catch'](function(_0x588d6f){logger[_0x5d5f('0x28')](util[_0x5d5f('0xa')](_0x5d5f('0x29'),EXTRACTED_REPORT_ID,_0x5d5f('0xc')),util[_0x5d5f('0x2a')](_0x588d6f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x5d5f('0x2b')](function(){process[_0x5d5f('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c431e3e..3261840 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 _0x2b3f=['tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','priority','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*'];(function(_0xff03b9,_0x5b3def){var _0x2f9a9f=function(_0x303cc0){while(--_0x303cc0){_0xff03b9['push'](_0xff03b9['shift']());}};_0x2f9a9f(++_0x5b3def);}(_0x2b3f,0x9b));var _0xf2b3=function(_0x330851,_0x329b34){_0x330851=_0x330851-0x0;var _0x272ba7=_0x2b3f[_0x330851];return _0x272ba7;};'use strict';var _=require('lodash');var util=require(_0xf2b3('0x0'));function rewrite(_0x485d3c,_0x316a91){var _0x5c2998=this;return _0x485d3c[_0xf2b3('0x1')]['Interval'][_0xf2b3('0x2')]({'raw':!![]})[_0xf2b3('0x3')](function(_0x1d6c66){_0x5c2998[_0xf2b3('0x4')]=_0x1d6c66;return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x2')]({'where':{'IntervalId':_0x316a91[_0xf2b3('0x6')]},'raw':!![]});})[_0xf2b3('0x3')](function(_0x153449){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x2')]({'where':{'exten':{'$in':_[_0xf2b3('0x7')](_[_0xf2b3('0x8')](_0x153449,_0xf2b3('0x9')))}},'order':[{'raw':_0xf2b3('0xa')}],'raw':!![]});})[_0xf2b3('0x3')](function(_0x1abd12){var _0x548f15=_[_0xf2b3('0xb')](_0x1abd12,{'priority':'1'});var _0x52c902=_[_0xf2b3('0xb')](_0x1abd12,{'isApp':0x1});var _0x5e5e8f=_[_0xf2b3('0xc')](_0x52c902,'exten');var _0x112c10=['queue',_0xf2b3('0xd')];var _0x32d2ff=[];var _0x5d0cb3=[];for(var _0x45db2b in _0x5e5e8f){if(_0x5e5e8f['hasOwnProperty'](_0x45db2b)){_0x5c2998['priority']=0x2;_0x5c2998['extensions']=[];_0x5c2998[_0xf2b3('0xe')]=_[_0xf2b3('0xf')](_0x548f15,{'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')]});_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':util[_0xf2b3('0x12')](_0xf2b3('0x13'),_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]===_0xf2b3('0x16')){_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x18')+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}else if(_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]===_0xf2b3('0x1a')){if(_0x5c2998['extension']){_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0]['type'],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x1c')+(_0x5c2998['extension'][_0xf2b3('0x1d')]?'${EXTEN:'+_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x1d')]+'}':_0xf2b3('0x1e')),'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x18')+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});var _0x2653a9=_0x5c2998[_0xf2b3('0x19')]++;_0x5c2998[_0xf2b3('0x1b')]['push']({'type':_0x5e5e8f[_0x45db2b][0x0]['type'],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x20')+(_0x2653a9+0x2)+_0xf2b3('0x21')+(_0x2653a9+0x1)+')','context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x2653a9,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5c2998['extension']){_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x5c2998[_0xf2b3('0xe')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});}_0x5c2998[_0xf2b3('0x1b')]['push']({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':'outboundrouteid='+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5c2998['extension']&&_0x5c2998['extension'][_0xf2b3('0x22')](_0xf2b3('0x23'))&&_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x23')]!==_0xf2b3('0x24')){_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x25'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5c2998[_0xf2b3('0xe')]['recordingFormat']||_0xf2b3('0x26'),'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}}_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x27'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x28'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});for(var _0x5d4a7b=0x0,_0x4d0679=0x0;_0x5d4a7b<_0x5e5e8f[_0x45db2b][_0xf2b3('0x29')];_0x5d4a7b+=0x1,_0x4d0679=0x0){var _0x58a468=_0x5e5e8f[_0x45db2b][_0x5d4a7b];if(_0x58a468[_0xf2b3('0x11')]){_0x58a468[_0xf2b3('0x11')]=_0x58a468[_0xf2b3('0x11')]['toLowerCase']();}var _0x487aa8=[];var _0x4828d2=[];delete _0x58a468['id'];delete _0x58a468[_0xf2b3('0x2a')];delete _0x58a468[_0xf2b3('0x2b')];var _0x1987fe=_0x58a468[_0xf2b3('0x2c')]!==_0xf2b3('0x2d')?[_0x58a468[_0xf2b3('0x2c')]]:_0x58a468[_0xf2b3('0x6')]?_[_0xf2b3('0x8')](_[_0xf2b3('0xb')](_0x5c2998[_0xf2b3('0x4')],{'IntervalId':_0x58a468[_0xf2b3('0x6')]}),_0xf2b3('0x2c')):[];if(_0x58a468[_0xf2b3('0x22')]('tag')){if(_0x58a468[_0xf2b3('0x2e')]&&_0x58a468[_0xf2b3('0x2e')]!=='--'){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468['type'],'app':_0xf2b3('0x17'),'appdata':'CDR(tag)='+_0x58a468[_0xf2b3('0x2e')],'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468['exten'],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}if(_0x58a468[_0xf2b3('0x11')]===_0xf2b3('0x1a')&&_0x58a468[_0xf2b3('0x22')](_0xf2b3('0x2f'))){if(_0x58a468[_0xf2b3('0x2f')]){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':'ExecIf','appdata':_0xf2b3('0x30')+_0x58a468[_0xf2b3('0x2f')]+')','context':_0x58a468['context'],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}else{_0x487aa8['push']({'type':_0x58a468['type'],'app':_0xf2b3('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468['exten'],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}if(_0x58a468[_0xf2b3('0x22')](_0xf2b3('0x31'))){if(_0x112c10[_0xf2b3('0x32')](_0x58a468[_0xf2b3('0x33')]['toLowerCase']())>=0x0&&_0x58a468['appType']!==_0xf2b3('0x34')){if(_0x58a468[_0xf2b3('0x31')]){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x35'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998['priority']+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x36'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}else{_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x37'),'context':_0x58a468['context'],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe['length']+_0x5c2998['priority']+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468['type'],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x38'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}}for(var _0xd3625e=0x0;_0xd3625e<_0x1987fe[_0xf2b3('0x29')];_0xd3625e+=0x1){var _0x196f26=_0x5c2998[_0xf2b3('0x19')]+_0x1987fe['length'];var _0x56eb96=_0xd3625e===_0x1987fe[_0xf2b3('0x29')]-0x1?_0x5c2998[_0xf2b3('0x19')]+_0x487aa8[_0xf2b3('0x29')]+_0x4828d2[_0xf2b3('0x29')]+0x2:_0x5c2998[_0xf2b3('0x19')]+_0xd3625e+0x1;_0x487aa8['splice'](_0xd3625e,0x0,{'type':_0x58a468['type'],'app':_0xf2b3('0x39'),'appdata':_0x1987fe[_0xd3625e]+'?'+_0x58a468[_0xf2b3('0x14')]+_0xf2b3('0x3a')+_0x196f26+':'+_0x58a468[_0xf2b3('0x14')]+_0xf2b3('0x3a')+_0x56eb96,'exten':_0x58a468[_0xf2b3('0x9')],'context':_0x58a468['context'],'priority':_0x5c2998[_0xf2b3('0x19')]+_0xd3625e,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});}_0x58a468[_0xf2b3('0x19')]=_0x487aa8['length']?_[_0xf2b3('0x3b')](_0x487aa8)[_0xf2b3('0x19')]+0x1:_0x5c2998[_0xf2b3('0x19')];_0x5c2998['priority']=(_0x4828d2[_0xf2b3('0x29')]?_[_0xf2b3('0x3b')](_0x4828d2)['priority']:_0x58a468[_0xf2b3('0x19')])+0x1;_0x5c2998[_0xf2b3('0x1b')]=_[_0xf2b3('0x3c')](_0x5c2998[_0xf2b3('0x1b')],_0x487aa8,[_0x58a468],_0x4828d2);}_0x5c2998['extensions']['push']({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x3d'),'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'priority':_0x5c2998[_0xf2b3('0x19')],'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});_0x32d2ff['push'](_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]);_0x5d0cb3=_[_0xf2b3('0x3c')](_0x5d0cb3,_0x5c2998['extensions']);}}return _0x485d3c['transaction'](function(_0x29e820){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x32d2ff}},'transaction':_0x29e820})[_0xf2b3('0x3')](function(_0x363cfe){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x3f')](_[_0xf2b3('0x40')](_0x5d0cb3,_0xf2b3('0x19')),{'transaction':_0x29e820});});});})['catch'](function(_0x5d7946){console[_0xf2b3('0x41')](_0x5d7946);});}exports[_0xf2b3('0x42')]=rewrite; \ No newline at end of file +var _0xc224=['models','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash'];(function(_0x9e3edc,_0x594d61){var _0x44a387=function(_0x4edc66){while(--_0x4edc66){_0x9e3edc['push'](_0x9e3edc['shift']());}};_0x44a387(++_0x594d61);}(_0xc224,0x153));var _0x4c22=function(_0x53a4fc,_0x282ef7){_0x53a4fc=_0x53a4fc-0x0;var _0x48b6ed=_0xc224[_0x53a4fc];return _0x48b6ed;};'use strict';var _=require(_0x4c22('0x0'));var util=require('util');function rewrite(_0x47a78e,_0x547c3b){var _0x36f3c6=this;return _0x47a78e[_0x4c22('0x1')]['Interval']['findAll']({'raw':!![]})[_0x4c22('0x2')](function(_0x14732c){_0x36f3c6[_0x4c22('0x3')]=_0x14732c;return _0x47a78e[_0x4c22('0x1')][_0x4c22('0x4')][_0x4c22('0x5')]({'where':{'IntervalId':_0x547c3b[_0x4c22('0x6')]},'raw':!![]});})[_0x4c22('0x2')](function(_0x35d04f){return _0x47a78e[_0x4c22('0x1')][_0x4c22('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x4c22('0x7')](_[_0x4c22('0x8')](_0x35d04f,_0x4c22('0x9')))}},'order':[{'raw':_0x4c22('0xa')}],'raw':!![]});})['then'](function(_0x2c936a){var _0x1dc5c5=_[_0x4c22('0xb')](_0x2c936a,{'priority':'1'});var _0x548e8f=_[_0x4c22('0xb')](_0x2c936a,{'isApp':0x1});var _0xea8293=_[_0x4c22('0xc')](_0x548e8f,_0x4c22('0x9'));var _0x24543f=['queue',_0x4c22('0xd')];var _0x311662=[];var _0x627c60=[];for(var _0x11deb3 in _0xea8293){if(_0xea8293[_0x4c22('0xe')](_0x11deb3)){_0x36f3c6['priority']=0x2;_0x36f3c6[_0x4c22('0xf')]=[];_0x36f3c6[_0x4c22('0x10')]=_[_0x4c22('0x11')](_0x1dc5c5,{'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')]});_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':util[_0x4c22('0x15')](_0x4c22('0x16'),_0xea8293[_0x11deb3][0x0]['type']),'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});if(_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')]===_0x4c22('0x1a')){_0x36f3c6['extensions'][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':'CDR(routeid)='+_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')],'context':_0xea8293[_0x11deb3][0x0]['context'],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0]['VoiceExtensionId']});}else if(_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')]==='outbound'){if(_0x36f3c6[_0x4c22('0x10')]){_0x36f3c6[_0x4c22('0xf')]['push']({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':'Set','appdata':_0x4c22('0x1b')+(_0x36f3c6['extension'][_0x4c22('0x1c')]?_0x4c22('0x1d')+_0x36f3c6['extension'][_0x4c22('0x1c')]+'}':_0x4c22('0x1e')),'context':_0xea8293[_0x11deb3][0x0]['context'],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});}_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':'CDR(routeid)='+_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')],'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});var _0x468425=_0x36f3c6['priority']++;_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x1f'),'appdata':_0x4c22('0x20')+(_0x468425+0x2)+'):Goto('+(_0x468425+0x1)+')','context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x468425,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0]['VoiceExtensionId']});if(_0x36f3c6[_0x4c22('0x10')]){_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':_0x36f3c6[_0x4c22('0x10')][_0x4c22('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x36f3c6[_0x4c22('0x10')][_0x4c22('0x1c')]+'}':_0x4c22('0x21'),'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});}_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':_0x4c22('0x22')+_0xea8293[_0x11deb3][0x0]['VoiceExtensionId'],'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});if(_0x36f3c6['extension']&&_0x36f3c6[_0x4c22('0x10')][_0x4c22('0xe')](_0x4c22('0x23'))&&_0x36f3c6[_0x4c22('0x10')][_0x4c22('0x23')]!==_0x4c22('0x24')){_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':_0x4c22('0x25'),'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0]['exten'],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':'Set','appdata':_0x4c22('0x26')+_0x36f3c6[_0x4c22('0x10')][_0x4c22('0x23')]||_0x4c22('0x27'),'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0]['exten'],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});}}_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xea8293[_0x11deb3][0x0]['context'],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0][_0x4c22('0x13')],'app':_0x4c22('0x14'),'appdata':_0x4c22('0x28'),'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});_0x36f3c6['extensions'][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'priority':_0x36f3c6[_0x4c22('0x18')]++,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});for(var _0x5b659b=0x0,_0x5cffdf=0x0;_0x5b659b<_0xea8293[_0x11deb3]['length'];_0x5b659b+=0x1,_0x5cffdf=0x0){var _0x6a7b1f=_0xea8293[_0x11deb3][_0x5b659b];if(_0x6a7b1f[_0x4c22('0x13')]){_0x6a7b1f[_0x4c22('0x13')]=_0x6a7b1f[_0x4c22('0x13')][_0x4c22('0x29')]();}var _0x30abf4=[];var _0x59e747=[];delete _0x6a7b1f['id'];delete _0x6a7b1f[_0x4c22('0x2a')];delete _0x6a7b1f['updatedAt'];var _0xcbeace=_0x6a7b1f[_0x4c22('0x2b')]!=='*,*,*,*'?[_0x6a7b1f[_0x4c22('0x2b')]]:_0x6a7b1f[_0x4c22('0x6')]?_[_0x4c22('0x8')](_[_0x4c22('0xb')](_0x36f3c6[_0x4c22('0x3')],{'IntervalId':_0x6a7b1f[_0x4c22('0x6')]}),_0x4c22('0x2b')):[];if(_0x6a7b1f[_0x4c22('0xe')]('tag')){if(_0x6a7b1f[_0x4c22('0x2c')]&&_0x6a7b1f['tag']!=='--'){_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f['type'],'app':'Set','appdata':_0x4c22('0x2d')+_0x6a7b1f['tag'],'context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f['exten'],'priority':_0xcbeace[_0x4c22('0x2e')]+_0x36f3c6['priority']+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});}}if(_0x6a7b1f['type']===_0x4c22('0x2f')&&_0x6a7b1f['hasOwnProperty'](_0x4c22('0x30'))){if(_0x6a7b1f[_0x4c22('0x30')]){_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f[_0x4c22('0x13')],'app':_0x4c22('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x6a7b1f['callerID']+')','context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f[_0x4c22('0x9')],'priority':_0xcbeace[_0x4c22('0x2e')]+_0x36f3c6[_0x4c22('0x18')]+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});}else{_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f[_0x4c22('0x13')],'app':_0x4c22('0x1f'),'appdata':_0x4c22('0x31'),'context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f[_0x4c22('0x9')],'priority':_0xcbeace[_0x4c22('0x2e')]+_0x36f3c6[_0x4c22('0x18')]+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});}}if(_0x6a7b1f['hasOwnProperty'](_0x4c22('0x32'))){if(_0x24543f[_0x4c22('0x33')](_0x6a7b1f['app']['toLowerCase']())>=0x0&&_0x6a7b1f[_0x4c22('0x34')]!==_0x4c22('0x35')){if(_0x6a7b1f[_0x4c22('0x32')]){_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f[_0x4c22('0x13')],'app':'ExecIf','appdata':_0x4c22('0x36'),'context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f['exten'],'priority':_0xcbeace['length']+_0x36f3c6[_0x4c22('0x18')]+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f['type'],'app':_0x4c22('0x14'),'appdata':_0x4c22('0x37'),'context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f[_0x4c22('0x9')],'priority':_0xcbeace[_0x4c22('0x2e')]+_0x36f3c6[_0x4c22('0x18')]+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});}else{_0x30abf4['push']({'type':_0x6a7b1f['type'],'app':_0x4c22('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x6a7b1f['context'],'exten':_0x6a7b1f[_0x4c22('0x9')],'priority':_0xcbeace[_0x4c22('0x2e')]+_0x36f3c6['priority']+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});_0x30abf4[_0x4c22('0x12')]({'type':_0x6a7b1f[_0x4c22('0x13')],'app':'Set','appdata':_0x4c22('0x38'),'context':_0x6a7b1f[_0x4c22('0x17')],'exten':_0x6a7b1f[_0x4c22('0x9')],'priority':_0xcbeace['length']+_0x36f3c6[_0x4c22('0x18')]+_0x5cffdf++,'VoiceExtensionId':_0x6a7b1f[_0x4c22('0x19')]});}}}for(var _0x459773=0x0;_0x459773<_0xcbeace[_0x4c22('0x2e')];_0x459773+=0x1){var _0xd47b4a=_0x36f3c6[_0x4c22('0x18')]+_0xcbeace['length'];var _0x28994e=_0x459773===_0xcbeace[_0x4c22('0x2e')]-0x1?_0x36f3c6[_0x4c22('0x18')]+_0x30abf4[_0x4c22('0x2e')]+_0x59e747[_0x4c22('0x2e')]+0x2:_0x36f3c6[_0x4c22('0x18')]+_0x459773+0x1;_0x30abf4['splice'](_0x459773,0x0,{'type':_0x6a7b1f['type'],'app':'GotoIfTime','appdata':_0xcbeace[_0x459773]+'?'+_0x6a7b1f[_0x4c22('0x17')]+_0x4c22('0x39')+_0xd47b4a+':'+_0x6a7b1f[_0x4c22('0x17')]+',${EXTEN},'+_0x28994e,'exten':_0x6a7b1f[_0x4c22('0x9')],'context':_0x6a7b1f['context'],'priority':_0x36f3c6[_0x4c22('0x18')]+_0x459773,'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});}_0x6a7b1f[_0x4c22('0x18')]=_0x30abf4[_0x4c22('0x2e')]?_[_0x4c22('0x3a')](_0x30abf4)['priority']+0x1:_0x36f3c6['priority'];_0x36f3c6[_0x4c22('0x18')]=(_0x59e747[_0x4c22('0x2e')]?_['last'](_0x59e747)[_0x4c22('0x18')]:_0x6a7b1f['priority'])+0x1;_0x36f3c6[_0x4c22('0xf')]=_['concat'](_0x36f3c6[_0x4c22('0xf')],_0x30abf4,[_0x6a7b1f],_0x59e747);}_0x36f3c6[_0x4c22('0xf')][_0x4c22('0x12')]({'type':_0xea8293[_0x11deb3][0x0]['type'],'app':_0x4c22('0x3b'),'exten':_0xea8293[_0x11deb3][0x0][_0x4c22('0x9')],'context':_0xea8293[_0x11deb3][0x0][_0x4c22('0x17')],'priority':_0x36f3c6[_0x4c22('0x18')],'VoiceExtensionId':_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]});_0x311662['push'](_0xea8293[_0x11deb3][0x0][_0x4c22('0x19')]);_0x627c60=_[_0x4c22('0x3c')](_0x627c60,_0x36f3c6['extensions']);}}return _0x47a78e[_0x4c22('0x3d')](function(_0x51253e){return _0x47a78e[_0x4c22('0x1')]['VoiceExtension'][_0x4c22('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x311662}},'transaction':_0x51253e})[_0x4c22('0x2')](function(_0x22d57e){return _0x47a78e[_0x4c22('0x1')][_0x4c22('0x4')][_0x4c22('0x3f')](_[_0x4c22('0x40')](_0x627c60,_0x4c22('0x18')),{'transaction':_0x51253e});});});})[_0x4c22('0x41')](function(_0x5ac701){console[_0x4c22('0x42')](_0x5ac701);});}exports[_0x4c22('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index e0a3fce..239db01 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 _0xcfd7=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','message','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','cm_contacts','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','outbound','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','error','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','data','phone','birthDate'];(function(_0x9d7494,_0x19c86a){var _0x5b4804=function(_0x2a0160){while(--_0x2a0160){_0x9d7494['push'](_0x9d7494['shift']());}};_0x5b4804(++_0x19c86a);}(_0xcfd7,0x1da));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x7cfd('0x0'));var util=require(_0x7cfd('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x7cfd('0x2'));var Redis=require(_0x7cfd('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x7cfd('0x4'))(_0x7cfd('0x5'));config[_0x7cfd('0x6')]=_['defaults'](config[_0x7cfd('0x6')],{'host':_0x7cfd('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7cfd('0x6')]));require(_0x7cfd('0x8'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x7cfd('0x9')][0x2]===_0x7cfd('0xa')||process[_0x7cfd('0x9')][0x2]===_0x7cfd('0xb')){throw new Error(_0x7cfd('0xc'));}var FILEPATH=process[_0x7cfd('0x9')][0x2];if(!process[_0x7cfd('0x9')][0x3]||process[_0x7cfd('0x9')][0x3]===_0x7cfd('0xa')||process[_0x7cfd('0x9')][0x3]===_0x7cfd('0xb')||!process[_0x7cfd('0x9')][0x4]||process[_0x7cfd('0x9')][0x4]==='undefined'||process[_0x7cfd('0x9')][0x4]===_0x7cfd('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x7cfd('0xd')](process[_0x7cfd('0x9')][0x3][_0x7cfd('0xe')](','),process[_0x7cfd('0x9')][0x4][_0x7cfd('0xe')](','));if(!process[_0x7cfd('0x9')][0x5]||process[_0x7cfd('0x9')][0x5]===_0x7cfd('0xa')||process['argv'][0x5]==='null'){throw new Error(_0x7cfd('0xf'));}var LISTID=process[_0x7cfd('0x9')][0x5];var COMPANYID=process[_0x7cfd('0x9')][0x6]&&process[_0x7cfd('0x9')][0x6]!==_0x7cfd('0xa')&&process[_0x7cfd('0x9')][0x6]!==_0x7cfd('0xb')?process[_0x7cfd('0x9')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7cfd('0x9')][0x7]!==_0x7cfd('0xa')&&process[_0x7cfd('0x9')][0x7]!==_0x7cfd('0xb')?process[_0x7cfd('0x9')][0x7]:null;if(!process[_0x7cfd('0x9')][0x8]||process[_0x7cfd('0x9')][0x8]==='undefined'||process[_0x7cfd('0x9')][0x8]===_0x7cfd('0xb')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7cfd('0x9')][0x8];}catch(_0x5e5fc7){logger[_0x7cfd('0x10')](_0x5e5fc7);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(_0x5653fb,_0x541c93,_0x3df8a0,_0x1cb7f5){var _0x33c412={'message':_0x541c93};_0x33c412[_0x5653fb]=!![];if(_0x3df8a0){_0x33c412['contact']=_0x3df8a0;}if(_0x1cb7f5){_0x33c412['index']=_0x1cb7f5;}return _0x33c412;}function isEmail(_0x2e299e){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))*$/[_0x7cfd('0x11')](_0x2e299e);}function checkRow(_0x31f726,_0x1fda95,_0x5afb39){return new BPromise(function(_0x2011a4,_0x37148f){if(_[_0x7cfd('0x12')](_0x31f726)){return _0x37148f(handleCheckRowError('error',_0x7cfd('0x13'),null,_0x5afb39));}if(_0x31f726['errors']&&_0x31f726[_0x7cfd('0x14')][_0x7cfd('0x15')]){var _0x3dceee=_['map'](_0x31f726[_0x7cfd('0x14')],'message')[_0x7cfd('0x16')](';');return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),_0x3dceee,null,_0x5afb39));}var _0x4ab0bc={};for(var _0x574a4c in FIELDS){if(FIELDS['hasOwnProperty'](_0x574a4c)&&FIELDS[_0x574a4c]){_0x4ab0bc[_0x574a4c]=_0x31f726[_0x7cfd('0x17')][0x0][FIELDS[_0x574a4c]]||_0x31f726['data'][0x0]['\ufeff'+FIELDS[_0x574a4c]];}}if(!_0x4ab0bc['firstName']){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'firstName\x20not\x20specified!',null,_0x5afb39));}if(!_0x4ab0bc[_0x7cfd('0x18')]){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'phone\x20not\x20specified!',null,_0x5afb39));}if(_0x4ab0bc[_0x7cfd('0x19')]){var _0x38f7fc=moment(_0x4ab0bc['birthDate'],_0x7cfd('0x1a'));if(!_0x38f7fc[_0x7cfd('0x1b')]()){return _0x37148f(handleCheckRowError('error',_0x7cfd('0x1c'),null,_0x5afb39));}}if(_0x4ab0bc['email']){if(!isEmail(_0x4ab0bc[_0x7cfd('0x1d')])){return _0x37148f(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x5afb39));}}_0x4ab0bc[_0x7cfd('0x1e')]=LISTID;_0x4ab0bc[_0x7cfd('0x1f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7cfd('0x15')]&&_0x1fda95){var _0x1010d9={};for(var _0x55e9b7=0x0,_0xc98b5=DUPLICATES[_0x7cfd('0x15')];_0x55e9b7<_0xc98b5;_0x55e9b7+=0x1){_0x1010d9[DUPLICATES[_0x55e9b7]]=_0x4ab0bc[DUPLICATES[_0x55e9b7]];}var _0x428cd9=_[_0x7cfd('0x20')](_0x1fda95,_0x1010d9);if(_0x428cd9){return _0x37148f(handleCheckRowError(_0x7cfd('0x21'),_0x7cfd('0x22'),_0x428cd9,_0x5afb39));}}return db[_0x7cfd('0x23')][_0x7cfd('0x24')](_0x4ab0bc,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4ab0bc)})[_0x7cfd('0x25')](function(_0x18da05){if(DUPLICATES&&DUPLICATES[_0x7cfd('0x15')]&&_0x1fda95){_0x1fda95[_0x7cfd('0x26')](_[_0x7cfd('0x27')](_0x4ab0bc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18da05['id'];return _0x2011a4();})[_0x7cfd('0x28')](function(_0x3b793b){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3b793b[_0x7cfd('0x29')]||JSON[_0x7cfd('0x2a')](_0x3b793b)),null,_0x5afb39));});});}function checkHopper(){function _0x15a226(){return function(_0x5c6ddb){logger['error']('cmContact',_0x7cfd('0x2b'),util[_0x7cfd('0x2c')](_0x5c6ddb,{'showHidden':![],'depth':null}));};}var _0x35530d=function(_0x572c2f,_0x1cc9f6){var _0x18f0c1=squel[_0x7cfd('0x2d')]()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')]([_0x7cfd('0x18'),_0x7cfd('0x31'),_0x7cfd('0x32'),_0x7cfd('0x1e'),_0x1cc9f6,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field'](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x31'))[_0x7cfd('0x36')]('id',_0x7cfd('0x32'))['field'](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x572c2f['id'][_0x7cfd('0x38')](),_0x1cc9f6)['field']('NOW()',_0x7cfd('0x33'))[_0x7cfd('0x36')]('NOW()',_0x7cfd('0x34'))['from']('cm_contacts')[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')](_0x7cfd('0x3b'),LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')](_0x7cfd('0x3c'))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel['select']()[_0x7cfd('0x36')](_0x7cfd('0x18'))['from'](_0x7cfd('0x2f'))[_0x7cfd('0x39')](_0x1cc9f6+_0x7cfd('0x3e'),_0x572c2f['id'][_0x7cfd('0x38')]())))[_0x7cfd('0x38')]();return _0x18f0c1;};var _0x382f4c=function(_0x28b8b6,_0x2c8dfe){var _0xb9888c=squel['insert']()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')](['phone',_0x7cfd('0x31'),'ContactId',_0x7cfd('0x1e'),_0x2c8dfe,_0x7cfd('0x33'),'updatedAt'],squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')](_0x7cfd('0x37'),'scheduledAt')[_0x7cfd('0x36')]('id',_0x7cfd('0x32'))[_0x7cfd('0x36')](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x28b8b6['id'][_0x7cfd('0x38')](),_0x2c8dfe)[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x33'))['field'](_0x7cfd('0x37'),_0x7cfd('0x34'))[_0x7cfd('0x3f')](_0x7cfd('0x40'))[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')]('ListId\x20=\x20?',LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')]('id\x20IN\x20?',squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')](_0x7cfd('0x3c'))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')](_0x7cfd('0x42'))[_0x7cfd('0x3f')](_0x7cfd('0x43'))['where'](_0x2c8dfe+_0x7cfd('0x3e'),_0x28b8b6['id'][_0x7cfd('0x38')]()))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')]('phone')[_0x7cfd('0x3f')](_0x7cfd('0x2f'))[_0x7cfd('0x39')](_0x2c8dfe+_0x7cfd('0x3e'),_0x28b8b6['id'][_0x7cfd('0x38')]())))['toString']();return _0xb9888c;};function _0x2527b8(_0x4fe42d,_0x4610f8){var _0x58f651=squel[_0x7cfd('0x2d')]()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')]([_0x7cfd('0x18'),_0x7cfd('0x31'),'ContactId','ListId',_0x4610f8,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field'](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')]('NOW()','scheduledAt')[_0x7cfd('0x36')]('id','ContactId')[_0x7cfd('0x36')](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x4fe42d['id'][_0x7cfd('0x38')](),_0x4610f8)[_0x7cfd('0x36')]('NOW()','createdAt')['field'](_0x7cfd('0x37'),_0x7cfd('0x34'))[_0x7cfd('0x3f')]('cm_contacts')[_0x7cfd('0x39')](_0x7cfd('0x3a'))['where'](_0x7cfd('0x3b'),LISTID['toString']())[_0x7cfd('0x39')](_0x7cfd('0x44'),squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')](_0x7cfd('0x3c')))[_0x7cfd('0x38')]();return _0x58f651;}function _0x1e528f(_0x362e0e,_0x1a6559){var _0x401565=squel['insert']()[_0x7cfd('0x2e')](_0x7cfd('0x45'))[_0x7cfd('0x30')](['phone','ContactId','ListId',_0x1a6559,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field']('phone',_0x7cfd('0x18'))[_0x7cfd('0x36')]('id','ContactId')[_0x7cfd('0x36')](LISTID[_0x7cfd('0x38')](),_0x7cfd('0x1e'))['field'](_0x362e0e['id'][_0x7cfd('0x38')](),_0x1a6559)[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x33'))['field']('NOW()','updatedAt')[_0x7cfd('0x3f')](_0x7cfd('0x40'))[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')](_0x7cfd('0x3b'),LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')]('id\x20IN\x20?',squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x7cfd('0x38')]();return _0x401565;}return db[_0x7cfd('0x46')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x7cfd('0x47')],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x49'),'where':{'id':LISTID}}]})[_0x7cfd('0x25')](function(_0x391a08){var _0x5de403=[];if(_0x391a08){var _0x415811;for(var _0x3ab2d9=0x0,_0xa372dd;_0x3ab2d9<_0x391a08['length'];_0x3ab2d9+=0x1){_0xa372dd=_0x391a08[_0x3ab2d9][_0x7cfd('0x4a')]({'plain':!![]});switch(_0xa372dd[_0x7cfd('0x47')]){case _0x7cfd('0x4b'):_0x5de403['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x382f4c(_0xa372dd,_0x7cfd('0x4e')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));break;case _0x7cfd('0x4f'):_0x5de403[_0x7cfd('0x26')](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x35530d(_0xa372dd,'VoiceQueueId'))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));break;default:_0x5de403[_0x7cfd('0x26')](db[_0x7cfd('0x4c')]['query'](_0x2527b8(_0xa372dd,_0x7cfd('0x4e')))['then'](function(){})[_0x7cfd('0x28')](_0x15a226()));}}}return _0x5de403;})[_0x7cfd('0x50')]()[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x46')][_0x7cfd('0x51')]({'where':{'type':_0x7cfd('0x52')},'attributes':['id'],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x53'),'where':{'id':LISTID}}]})['then'](function(_0xc3d635){var _0x556927=[];if(_0xc3d635){var _0x263a28;for(var _0x2c6b62=0x0,_0x1847e9;_0x2c6b62<_0xc3d635[_0x7cfd('0x15')];_0x2c6b62+=0x1){_0x1847e9=_0xc3d635[_0x2c6b62][_0x7cfd('0x4a')]({'plain':!![]});_0x556927[_0x7cfd('0x26')](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x1e528f(_0x1847e9,_0x7cfd('0x4e')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));}}return _0x556927;})[_0x7cfd('0x50')]();})[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x54')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x49'),'where':{'id':LISTID}}]})['then'](function(_0x452007){var _0x2117c3=[];if(_0x452007){for(var _0x23889e=0x0,_0x2314d6;_0x23889e<_0x452007[_0x7cfd('0x15')];_0x23889e+=0x1){_0x2314d6=_0x452007[_0x23889e]['get']({'plain':!![]});switch(_0x2314d6[_0x7cfd('0x47')]){case'always':_0x2117c3[_0x7cfd('0x26')](db['sequelize']['query'](_0x382f4c(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));break;case _0x7cfd('0x4f'):_0x2117c3['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x35530d(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));break;default:_0x2117c3['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x2527b8(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));}}}return _0x2117c3;})[_0x7cfd('0x50')]();})[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x54')][_0x7cfd('0x51')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7cfd('0x53'),'where':{'id':LISTID}}]})[_0x7cfd('0x25')](function(_0x46ab4e){var _0x4b7010=[];if(_0x46ab4e){for(var _0x3ffaa4=0x0,_0x40d08b;_0x3ffaa4<_0x46ab4e['length'];_0x3ffaa4+=0x1){_0x40d08b=_0x46ab4e[_0x3ffaa4][_0x7cfd('0x4a')]({'plain':!![]});_0x4b7010['push'](db[_0x7cfd('0x4c')]['query'](_0x1e528f(_0x40d08b,'CampaignId'))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));}}return _0x4b7010;})[_0x7cfd('0x50')]();})['catch'](function(_0x23fe70){logger[_0x7cfd('0x10')]('cmContact,\x20%s,\x20%s',_0x7cfd('0x56'),_0x23fe70[_0x7cfd('0x29')]);});}var processPromises=function(_0x24460b){return BPromise['all'](promises)[_0x7cfd('0x25')](function(_0x157f84){})['catch'](function(_0x14f788){logger[_0x7cfd('0x10')](_0x7cfd('0x57'),JSON['stringify'](_0x14f788));})['finally'](function(){socket[_0x7cfd('0x58')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x24460b){return _0x24460b[_0x7cfd('0x59')]();}});};var endCsv=function(){return BPromise[_0x7cfd('0x5a')]()[_0x7cfd('0x25')](function(){if(hopperContacts){return checkHopper();}})[_0x7cfd('0x25')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7cfd('0x5b')](FILEPATH);}catch(_0x2e63c7){logger[_0x7cfd('0x10')](_0x7cfd('0x5c'),JSON[_0x7cfd('0x2a')](_0x2e63c7));}finally{process[_0x7cfd('0x5d')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7cfd('0x5e')](_0x7cfd('0x5f'));endCsv();});function main(){return BPromise['resolve']()[_0x7cfd('0x25')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7cfd('0xe')](',');return db[_0x7cfd('0x23')][_0x7cfd('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7cfd('0x25')](function(_0x5ddb4f){var _0x283580=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7cfd('0x60')](_0x283580,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf67055,_0x3e72ab){total+=0x1;var _0x1c4faf=total;promises[_0x7cfd('0x26')](checkRow(_0xf67055,_0x5ddb4f,_0x1c4faf)[_0x7cfd('0x25')](function(){success+=0x1;})['catch'](function(_0x4336e0){if(_0x4336e0[_0x7cfd('0x10')]){errors+=0x1;delete _0x4336e0[_0x7cfd('0x10')];}else if(_0x4336e0[_0x7cfd('0x21')]){duplicates+=0x1;delete _0x4336e0[_0x7cfd('0x21')];}rows[_0x7cfd('0x26')](_0x4336e0);}));if(total%0xc8===0x0){_0x3e72ab['pause']();return processPromises(_0x3e72ab);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7cfd('0x5e')](_0x7cfd('0x61'));endCsv();});},'error':function(_0x1e8b26,_0x5f220e){logger[_0x7cfd('0x5e')](_0x7cfd('0x62'),JSON[_0x7cfd('0x2a')](_0x1e8b26));endCsv();}});})[_0x7cfd('0x28')](function(_0x23d569){logger[_0x7cfd('0x10')](_0x7cfd('0x63'),JSON[_0x7cfd('0x2a')](_0x23d569));});}main(); \ No newline at end of file +var _0x1cd2=['cm_contacts','ListId\x20=\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../config/environment','api','redis','defaults','socket.io-emitter','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','updatedAt','from','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert'];(function(_0x1eb696,_0x5edb5a){var _0x1ecd33=function(_0x2d51fd){while(--_0x2d51fd){_0x1eb696['push'](_0x1eb696['shift']());}};_0x1ecd33(++_0x5edb5a);}(_0x1cd2,0xf5));var _0x21cd=function(_0x16880c,_0x3e7feb){_0x16880c=_0x16880c-0x0;var _0x13a765=_0x1cd2[_0x16880c];return _0x13a765;};'use strict';var BPromise=require(_0x21cd('0x0'));var util=require(_0x21cd('0x1'));var _=require(_0x21cd('0x2'));var fs=require('fs');var squel=require(_0x21cd('0x3'));var Papa=require('papaparse');var Redis=require(_0x21cd('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x21cd('0x5'));var logger=require('../../../config/logger')(_0x21cd('0x6'));config[_0x21cd('0x7')]=_[_0x21cd('0x8')](config[_0x21cd('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x21cd('0x9'))(new Redis(config[_0x21cd('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x21cd('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x21cd('0xb')][0x2]===_0x21cd('0xc')||process[_0x21cd('0xb')][0x2]===_0x21cd('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x21cd('0xb')][0x3]||process['argv'][0x3]===_0x21cd('0xc')||process[_0x21cd('0xb')][0x3]===_0x21cd('0xd')||!process[_0x21cd('0xb')][0x4]||process[_0x21cd('0xb')][0x4]===_0x21cd('0xc')||process[_0x21cd('0xb')][0x4]===_0x21cd('0xd')){throw new Error(_0x21cd('0xe'));}var FIELDS=_['zipObject'](process[_0x21cd('0xb')][0x3][_0x21cd('0xf')](','),process[_0x21cd('0xb')][0x4][_0x21cd('0xf')](','));if(!process[_0x21cd('0xb')][0x5]||process[_0x21cd('0xb')][0x5]===_0x21cd('0xc')||process[_0x21cd('0xb')][0x5]===_0x21cd('0xd')){throw new Error(_0x21cd('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x21cd('0xb')][0x6]&&process[_0x21cd('0xb')][0x6]!==_0x21cd('0xc')&&process[_0x21cd('0xb')][0x6]!==_0x21cd('0xd')?process[_0x21cd('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x21cd('0xb')][0x7]!==_0x21cd('0xc')&&process[_0x21cd('0xb')][0x7]!==_0x21cd('0xd')?process[_0x21cd('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x21cd('0xb')][0x8]==='null'){throw new Error(_0x21cd('0x11'));}var SOCKET_TIMESTAMP=process[_0x21cd('0xb')][0x8];}catch(_0x39ff8f){logger[_0x21cd('0x12')](_0x39ff8f);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(_0x683d0c,_0x2b4054,_0x9ae748,_0x55eb5d){var _0x19240c={'message':_0x2b4054};_0x19240c[_0x683d0c]=!![];if(_0x9ae748){_0x19240c[_0x21cd('0x13')]=_0x9ae748;}if(_0x55eb5d){_0x19240c[_0x21cd('0x14')]=_0x55eb5d;}return _0x19240c;}function isEmail(_0x3b1b95){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'](_0x3b1b95);}function checkRow(_0x124e31,_0x9d9cfd,_0x30fa01){return new BPromise(function(_0x2dc823,_0x5be5a2){if(_[_0x21cd('0x15')](_0x124e31)){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x16'),null,_0x30fa01));}if(_0x124e31[_0x21cd('0x17')]&&_0x124e31[_0x21cd('0x17')][_0x21cd('0x18')]){var _0xfa79cd=_[_0x21cd('0x19')](_0x124e31['errors'],'message')[_0x21cd('0x1a')](';');return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0xfa79cd,null,_0x30fa01));}var _0x1df9e5={};for(var _0x480622 in FIELDS){if(FIELDS[_0x21cd('0x1b')](_0x480622)&&FIELDS[_0x480622]){_0x1df9e5[_0x480622]=_0x124e31[_0x21cd('0x1c')][0x0][FIELDS[_0x480622]]||_0x124e31[_0x21cd('0x1c')][0x0]['\ufeff'+FIELDS[_0x480622]];}}if(!_0x1df9e5['firstName']){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x1d'),null,_0x30fa01));}if(!_0x1df9e5[_0x21cd('0x1e')]){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x1f'),null,_0x30fa01));}if(_0x1df9e5['birthDate']){var _0x11283b=moment(_0x1df9e5[_0x21cd('0x20')],_0x21cd('0x21'));if(!_0x11283b[_0x21cd('0x22')]()){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x23'),null,_0x30fa01));}}if(_0x1df9e5[_0x21cd('0x24')]){if(!isEmail(_0x1df9e5[_0x21cd('0x24')])){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x25'),null,_0x30fa01));}}_0x1df9e5[_0x21cd('0x26')]=LISTID;_0x1df9e5['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x21cd('0x18')]&&_0x9d9cfd){var _0x42ed8c={};for(var _0x155a4d=0x0,_0x258328=DUPLICATES[_0x21cd('0x18')];_0x155a4d<_0x258328;_0x155a4d+=0x1){_0x42ed8c[DUPLICATES[_0x155a4d]]=_0x1df9e5[DUPLICATES[_0x155a4d]];}var _0x2a0d7d=_['find'](_0x9d9cfd,_0x42ed8c);if(_0x2a0d7d){return _0x5be5a2(handleCheckRowError(_0x21cd('0x27'),_0x21cd('0x28'),_0x2a0d7d,_0x30fa01));}}return db[_0x21cd('0x29')][_0x21cd('0x2a')](_0x1df9e5,{'raw':!![],'hooks':![],'fields':_['keys'](_0x1df9e5)})[_0x21cd('0x2b')](function(_0x4d9a6c){if(DUPLICATES&&DUPLICATES[_0x21cd('0x18')]&&_0x9d9cfd){_0x9d9cfd[_0x21cd('0x2c')](_[_0x21cd('0x2d')](_0x1df9e5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4d9a6c['id'];return _0x2dc823();})[_0x21cd('0x2e')](function(_0x494e46){return _0x5be5a2(handleCheckRowError(_0x21cd('0x12'),_0x21cd('0x2f')+(_0x494e46[_0x21cd('0x30')]||JSON[_0x21cd('0x31')](_0x494e46)),null,_0x30fa01));});});}function checkHopper(){function _0x113d50(){return function(_0x302c92){logger[_0x21cd('0x12')](_0x21cd('0x32'),'checkHopper',util[_0x21cd('0x33')](_0x302c92,{'showHidden':![],'depth':null}));};}var _0x937d22=function(_0x2d4edd,_0x56e6b1){var _0x45a08d=squel['insert']()[_0x21cd('0x34')](_0x21cd('0x35'))[_0x21cd('0x36')]([_0x21cd('0x1e'),_0x21cd('0x37'),_0x21cd('0x38'),_0x21cd('0x26'),_0x56e6b1,_0x21cd('0x39'),'updatedAt'],squel[_0x21cd('0x3a')]()[_0x21cd('0x3b')](_0x21cd('0x1e'),_0x21cd('0x1e'))[_0x21cd('0x3b')](_0x21cd('0x3c'),_0x21cd('0x37'))[_0x21cd('0x3b')]('id','ContactId')[_0x21cd('0x3b')](LISTID[_0x21cd('0x3d')](),_0x21cd('0x26'))[_0x21cd('0x3b')](_0x2d4edd['id']['toString'](),_0x56e6b1)['field']('NOW()',_0x21cd('0x39'))['field']('NOW()',_0x21cd('0x3e'))[_0x21cd('0x3f')]('cm_contacts')['where'](_0x21cd('0x40'))[_0x21cd('0x41')]('ListId\x20=\x20?',LISTID[_0x21cd('0x3d')]())['where'](_0x21cd('0x42'))[_0x21cd('0x41')](_0x21cd('0x43'),squel[_0x21cd('0x3a')]()[_0x21cd('0x3b')](_0x21cd('0x1e'))[_0x21cd('0x3f')](_0x21cd('0x35'))[_0x21cd('0x41')](_0x56e6b1+_0x21cd('0x44'),_0x2d4edd['id'][_0x21cd('0x3d')]())))[_0x21cd('0x3d')]();return _0x45a08d;};var _0x1a4848=function(_0x4fd47d,_0x2c2fcb){var _0x55440f=squel[_0x21cd('0x45')]()['into'](_0x21cd('0x35'))[_0x21cd('0x36')]([_0x21cd('0x1e'),_0x21cd('0x37'),_0x21cd('0x38'),_0x21cd('0x26'),_0x2c2fcb,_0x21cd('0x39'),'updatedAt'],squel['select']()['field'](_0x21cd('0x1e'),_0x21cd('0x1e'))['field']('NOW()',_0x21cd('0x37'))[_0x21cd('0x3b')]('id','ContactId')[_0x21cd('0x3b')](LISTID['toString'](),_0x21cd('0x26'))[_0x21cd('0x3b')](_0x4fd47d['id'][_0x21cd('0x3d')](),_0x2c2fcb)['field'](_0x21cd('0x3c'),'createdAt')[_0x21cd('0x3b')](_0x21cd('0x3c'),_0x21cd('0x3e'))['from'](_0x21cd('0x46'))[_0x21cd('0x41')](_0x21cd('0x40'))[_0x21cd('0x41')](_0x21cd('0x47'),LISTID[_0x21cd('0x3d')]())[_0x21cd('0x41')]('id\x20IN\x20?',squel[_0x21cd('0x48')](hopperContacts))[_0x21cd('0x41')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x21cd('0x43'),squel['select']()['field'](_0x21cd('0x49'))[_0x21cd('0x3f')](_0x21cd('0x4a'))[_0x21cd('0x41')](_0x2c2fcb+_0x21cd('0x44'),_0x4fd47d['id'][_0x21cd('0x3d')]()))[_0x21cd('0x41')](_0x21cd('0x43'),squel[_0x21cd('0x3a')]()['field']('phone')[_0x21cd('0x3f')](_0x21cd('0x35'))[_0x21cd('0x41')](_0x2c2fcb+_0x21cd('0x44'),_0x4fd47d['id']['toString']())))['toString']();return _0x55440f;};function _0x2ef7c1(_0x11ca54,_0x79f395){var _0x5b5c21=squel[_0x21cd('0x45')]()[_0x21cd('0x34')](_0x21cd('0x35'))[_0x21cd('0x36')]([_0x21cd('0x1e'),_0x21cd('0x37'),_0x21cd('0x38'),_0x21cd('0x26'),_0x79f395,_0x21cd('0x39'),'updatedAt'],squel[_0x21cd('0x3a')]()[_0x21cd('0x3b')](_0x21cd('0x1e'),_0x21cd('0x1e'))[_0x21cd('0x3b')](_0x21cd('0x3c'),_0x21cd('0x37'))[_0x21cd('0x3b')]('id','ContactId')[_0x21cd('0x3b')](LISTID['toString'](),_0x21cd('0x26'))[_0x21cd('0x3b')](_0x11ca54['id'][_0x21cd('0x3d')](),_0x79f395)['field'](_0x21cd('0x3c'),_0x21cd('0x39'))['field'](_0x21cd('0x3c'),_0x21cd('0x3e'))[_0x21cd('0x3f')](_0x21cd('0x46'))[_0x21cd('0x41')]('deletedAt\x20IS\x20NULL')[_0x21cd('0x41')](_0x21cd('0x47'),LISTID['toString']())[_0x21cd('0x41')]('id\x20IN\x20?',squel[_0x21cd('0x48')](hopperContacts))['where'](_0x21cd('0x42')))[_0x21cd('0x3d')]();return _0x5b5c21;}function _0x1aba6c(_0x39d44b,_0x2dd261){var _0x14c114=squel[_0x21cd('0x45')]()[_0x21cd('0x34')](_0x21cd('0x4b'))['fromQuery']([_0x21cd('0x1e'),_0x21cd('0x38'),_0x21cd('0x26'),_0x2dd261,_0x21cd('0x39'),'updatedAt'],squel[_0x21cd('0x3a')]()[_0x21cd('0x3b')](_0x21cd('0x1e'),_0x21cd('0x1e'))[_0x21cd('0x3b')]('id',_0x21cd('0x38'))[_0x21cd('0x3b')](LISTID[_0x21cd('0x3d')](),_0x21cd('0x26'))[_0x21cd('0x3b')](_0x39d44b['id']['toString'](),_0x2dd261)['field']('NOW()',_0x21cd('0x39'))[_0x21cd('0x3b')]('NOW()',_0x21cd('0x3e'))['from']('cm_contacts')['where'](_0x21cd('0x40'))[_0x21cd('0x41')](_0x21cd('0x47'),LISTID['toString']())[_0x21cd('0x41')]('id\x20IN\x20?',squel[_0x21cd('0x48')](hopperContacts))[_0x21cd('0x41')](_0x21cd('0x42')))[_0x21cd('0x3d')]();return _0x14c114;}return db[_0x21cd('0x4c')][_0x21cd('0x4d')]({'where':{'type':_0x21cd('0x4e')},'attributes':['id',_0x21cd('0x4f')],'include':[{'model':db[_0x21cd('0x50')],'as':_0x21cd('0x51'),'where':{'id':LISTID}}]})[_0x21cd('0x2b')](function(_0x268ee2){var _0x4f7a3d=[];if(_0x268ee2){var _0x1976af;for(var _0xe64fe7=0x0,_0x5d0e68;_0xe64fe7<_0x268ee2[_0x21cd('0x18')];_0xe64fe7+=0x1){_0x5d0e68=_0x268ee2[_0xe64fe7][_0x21cd('0x52')]({'plain':!![]});switch(_0x5d0e68[_0x21cd('0x4f')]){case'always':_0x4f7a3d['push'](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x1a4848(_0x5d0e68,_0x21cd('0x55')))['then'](function(){})[_0x21cd('0x2e')](_0x113d50()));break;case _0x21cd('0x56'):_0x4f7a3d[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x937d22(_0x5d0e68,_0x21cd('0x55')))['then'](function(){})[_0x21cd('0x2e')](_0x113d50()));break;default:_0x4f7a3d[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x2ef7c1(_0x5d0e68,'VoiceQueueId'))[_0x21cd('0x2b')](function(){})[_0x21cd('0x2e')](_0x113d50()));}}}return _0x4f7a3d;})['all']()[_0x21cd('0x2b')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x21cd('0x4e')},'attributes':['id'],'include':[{'model':db[_0x21cd('0x50')],'as':_0x21cd('0x57'),'where':{'id':LISTID}}]})[_0x21cd('0x2b')](function(_0x35f48d){var _0x5de66a=[];if(_0x35f48d){var _0x2f87f9;for(var _0x1bc8b7=0x0,_0x3ca1bf;_0x1bc8b7<_0x35f48d[_0x21cd('0x18')];_0x1bc8b7+=0x1){_0x3ca1bf=_0x35f48d[_0x1bc8b7]['get']({'plain':!![]});_0x5de66a[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x1aba6c(_0x3ca1bf,'VoiceQueueId'))[_0x21cd('0x2b')](function(){})[_0x21cd('0x2e')](_0x113d50()));}}return _0x5de66a;})[_0x21cd('0x58')]();})[_0x21cd('0x2b')](function(){return db[_0x21cd('0x59')][_0x21cd('0x4d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x21cd('0x50')],'as':_0x21cd('0x51'),'where':{'id':LISTID}}]})[_0x21cd('0x2b')](function(_0x1a227b){var _0x4902d2=[];if(_0x1a227b){for(var _0x2226b4=0x0,_0x2646c3;_0x2226b4<_0x1a227b[_0x21cd('0x18')];_0x2226b4+=0x1){_0x2646c3=_0x1a227b[_0x2226b4]['get']({'plain':!![]});switch(_0x2646c3['dialCheckDuplicateType']){case _0x21cd('0x5a'):_0x4902d2[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x1a4848(_0x2646c3,_0x21cd('0x5b')))[_0x21cd('0x2b')](function(){})[_0x21cd('0x2e')](_0x113d50()));break;case _0x21cd('0x56'):_0x4902d2['push'](db['sequelize'][_0x21cd('0x54')](_0x937d22(_0x2646c3,_0x21cd('0x5b')))['then'](function(){})[_0x21cd('0x2e')](_0x113d50()));break;default:_0x4902d2[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x2ef7c1(_0x2646c3,_0x21cd('0x5b')))['then'](function(){})[_0x21cd('0x2e')](_0x113d50()));}}}return _0x4902d2;})[_0x21cd('0x58')]();})[_0x21cd('0x2b')](function(){return db[_0x21cd('0x59')][_0x21cd('0x4d')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x21cd('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x5b6e23){var _0xc9ddc1=[];if(_0x5b6e23){for(var _0x486aa9=0x0,_0x53c683;_0x486aa9<_0x5b6e23[_0x21cd('0x18')];_0x486aa9+=0x1){_0x53c683=_0x5b6e23[_0x486aa9]['get']({'plain':!![]});_0xc9ddc1[_0x21cd('0x2c')](db[_0x21cd('0x53')][_0x21cd('0x54')](_0x1aba6c(_0x53c683,_0x21cd('0x5b')))[_0x21cd('0x2b')](function(){})['catch'](_0x113d50()));}}return _0xc9ddc1;})[_0x21cd('0x58')]();})[_0x21cd('0x2e')](function(_0x574d23){logger[_0x21cd('0x12')]('cmContact,\x20%s,\x20%s',_0x21cd('0x5c'),_0x574d23['message']);});}var processPromises=function(_0x224e44){return BPromise[_0x21cd('0x58')](promises)[_0x21cd('0x2b')](function(_0x586bc8){})[_0x21cd('0x2e')](function(_0x3e67bf){logger[_0x21cd('0x12')](_0x21cd('0x5d'),JSON['stringify'](_0x3e67bf));})[_0x21cd('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x224e44){return _0x224e44['resume']();}});};var endCsv=function(){return BPromise[_0x21cd('0x5f')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x21cd('0x2b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x21cd('0x60')](FILEPATH);}catch(_0x1985a5){logger['error'](_0x21cd('0x61'),JSON[_0x21cd('0x31')](_0x1985a5));}finally{process[_0x21cd('0x62')](0x0);}});};process['on'](_0x21cd('0x63'),function(){logger[_0x21cd('0x64')](_0x21cd('0x65'));endCsv();});function main(){return BPromise[_0x21cd('0x5f')]()[_0x21cd('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x21cd('0xf')](',');return db[_0x21cd('0x29')][_0x21cd('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x21cd('0x2b')](function(_0x1de9fc){var _0x56694f=fs[_0x21cd('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x21cd('0x67')](_0x56694f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x577e1d,_0x4ef28e){total+=0x1;var _0x4e28c9=total;promises[_0x21cd('0x2c')](checkRow(_0x577e1d,_0x1de9fc,_0x4e28c9)[_0x21cd('0x2b')](function(){success+=0x1;})[_0x21cd('0x2e')](function(_0x4fb4a2){if(_0x4fb4a2[_0x21cd('0x12')]){errors+=0x1;delete _0x4fb4a2[_0x21cd('0x12')];}else if(_0x4fb4a2[_0x21cd('0x27')]){duplicates+=0x1;delete _0x4fb4a2[_0x21cd('0x27')];}rows[_0x21cd('0x2c')](_0x4fb4a2);}));if(total%0xc8===0x0){_0x4ef28e['pause']();return processPromises(_0x4ef28e);}},'complete':function(){return processPromises()[_0x21cd('0x2b')](function(){logger[_0x21cd('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2e2a32,_0x34c6d8){logger[_0x21cd('0x64')](_0x21cd('0x68'),JSON[_0x21cd('0x31')](_0x2e2a32));endCsv();}});})[_0x21cd('0x2e')](function(_0x24cd24){logger[_0x21cd('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x24cd24));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 0f5860b..6c37715 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 _0x7cf4=['voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','from','where','\x20=\x20','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','recallme','select','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','phone','createdAt','cm_contacts.ListId\x20=\x20','\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','insert','priority','UserId','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','push','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','isNil','set','offset','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','SystemRow','appendFileSync','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','VoiceQueueId'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7cf4,0xb0));var _0x47cf=function(_0x2f700b,_0x1508cd){_0x2f700b=_0x2f700b-0x0;var _0x368f17=_0x7cf4[_0x2f700b];return _0x368f17;};'use strict';var fs=require('fs');var path=require(_0x47cf('0x0'));var _=require(_0x47cf('0x1'));var Papa=require(_0x47cf('0x2'));var util=require(_0x47cf('0x3'));var BPromise=require(_0x47cf('0x4'));var moment=require(_0x47cf('0x5'));var squel=require('squel');var Redis=require(_0x47cf('0x6'));var db=require(_0x47cf('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x47cf('0x8'));var logger=require(_0x47cf('0x9'))('import');config[_0x47cf('0xa')]=_[_0x47cf('0xb')](config['redis'],{'host':_0x47cf('0xc'),'port':0x18eb});var socket=require(_0x47cf('0xd'))(new Redis(config[_0x47cf('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x47cf('0xe')](_0x47cf('0xf'));function isEmail(_0x5119ea){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'](_0x5119ea);}function selectNotIn(_0x182f83,_0x280837,_0x44c654,_0x5b4284,_0x3f4466){return squel['select']()['field']('phone')[_0x47cf('0x10')](_0x5b4284)['join'](_0x280837,null,_0x280837+'.id\x20=\x20'+_0x5b4284+'.'+_0x44c654)[_0x47cf('0x11')](_0x5b4284+'.'+_0x44c654+_0x47cf('0x12')+_0x182f83+'.'+_0x44c654)['where'](_0x280837+'.dialCheckDuplicateType\x20IN\x20('+_0x3f4466[_0x47cf('0x13')]()+')');}function insertCmHopper(_0x5eca93,_0x1640db,_0xab2e31,_0x1ec242,_0xf13a4f){var _0x906f57=['cm_contacts.phone',_0x47cf('0x14'),_0x47cf('0x15'),_0x47cf('0x16'),_0x1640db+'.'+_0x1ec242,_0x47cf('0x17'),_0x47cf('0x18'),_0x47cf('0x19'),_0x47cf('0x1a'),'\x22'+_0xf13a4f+'\x22'];return squel['insert']()[_0x47cf('0x1b')]('cm_hopper')[_0x47cf('0x1c')](['phone',_0x47cf('0x1d'),_0x47cf('0x1e'),_0x47cf('0x1f'),_0x1ec242,'createdAt',_0x47cf('0x20'),'priority','UserId',_0x47cf('0x21')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x906f57)[_0x47cf('0x10')](_0x1640db)[_0x47cf('0x13')](_0x47cf('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x1640db+_0x47cf('0x25'))[_0x47cf('0x13')](_0xab2e31,null,_0xab2e31+_0x47cf('0x26')+_0x1640db+'.'+_0x1ec242)[_0x47cf('0x11')](_0x1640db+_0x47cf('0x27'),_0x5eca93)[_0x47cf('0x11')](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x1640db,_0xab2e31,_0x1ec242,_0x47cf('0x2a'),[_0x47cf('0x2b'),_0x47cf('0x2c')]))[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x1640db,_0xab2e31,_0x1ec242,_0x47cf('0x2a'),[_0x47cf('0x2b')])))[_0x47cf('0x2d')]();}function insertCmHopperBlack(_0x1a91e6,_0x49bdc4,_0x665eab,_0x539fe7){var _0x32e531=[_0x47cf('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x49bdc4+'.'+_0x539fe7,'cm_contacts.createdAt',_0x47cf('0x18')];return squel['insert']()['into'](_0x47cf('0x2f'))['fromQuery']([_0x47cf('0x30'),_0x47cf('0x1e'),_0x47cf('0x1f'),_0x539fe7,_0x47cf('0x31'),_0x47cf('0x20')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x32e531)[_0x47cf('0x10')](_0x49bdc4)['join'](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x49bdc4+'.CmListId')[_0x47cf('0x13')](_0x665eab,null,_0x665eab+'.id\x20=\x20'+_0x49bdc4+'.'+_0x539fe7)[_0x47cf('0x11')](_0x49bdc4+_0x47cf('0x27'),_0x1a91e6)[_0x47cf('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47cf('0x11')](_0x47cf('0x29'),squel[_0x47cf('0x22')]()['field'](_0x47cf('0x30'))['from'](_0x47cf('0x2f'))[_0x47cf('0x11')]('ListId\x20=\x20?',_0x1a91e6)['where'](_0x539fe7+_0x47cf('0x33'),_0x49bdc4+'.'+_0x539fe7)))[_0x47cf('0x2d')]();}function insertTzCmHopper(_0x3d6e26,_0x2f9852,_0x18530d,_0x28051d,_0x4e5e21,_0x5bfedd){var _0x36a7ab=[_0x47cf('0x2e'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5bfedd+_0x47cf('0x34'),_0x47cf('0x15'),_0x47cf('0x16'),_0x2f9852+'.'+_0x28051d,_0x47cf('0x17'),'cm_contacts.updatedAt',_0x47cf('0x19'),_0x47cf('0x1a'),'\x22'+_0x4e5e21+'\x22'];var _0x67a8c5=squel[_0x47cf('0x35')]()['into'](_0x47cf('0x2a'))[_0x47cf('0x1c')]([_0x47cf('0x30'),'scheduledat',_0x47cf('0x1e'),'ListId',_0x28051d,'createdAt',_0x47cf('0x20'),_0x47cf('0x36'),_0x47cf('0x37'),_0x47cf('0x21')],squel['select']()[_0x47cf('0x23')](_0x36a7ab)[_0x47cf('0x10')](_0x2f9852)['join'](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x2f9852+_0x47cf('0x25'))[_0x47cf('0x13')](_0x18530d,null,_0x18530d+'.id\x20=\x20'+_0x2f9852+'.'+_0x28051d)[_0x47cf('0x13')](_0x5bfedd,null,_0x5bfedd+_0x47cf('0x26')+_0x2f9852+'.'+_0x28051d)[_0x47cf('0x11')](_0x2f9852+'.CmListId\x20=\x20?',_0x3d6e26)[_0x47cf('0x11')](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x2f9852,_0x18530d,_0x28051d,_0x47cf('0x2a'),[_0x47cf('0x2b'),_0x47cf('0x2c')]))[_0x47cf('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2f9852,_0x18530d,_0x28051d,_0x47cf('0x2a'),[_0x47cf('0x2b')])))[_0x47cf('0x2d')]();return _0x67a8c5;}function insertTzCmHopperBlack(_0x247ed6,_0x38cf5c,_0x53fdb3,_0x5766e1){var _0x3ad3b3=[_0x47cf('0x2e'),_0x47cf('0x15'),_0x47cf('0x16'),_0x38cf5c+'.'+_0x5766e1,_0x47cf('0x17'),'cm_contacts.updatedAt'];return squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x47cf('0x2f'))[_0x47cf('0x1c')]([_0x47cf('0x30'),_0x47cf('0x1e'),'ListId',_0x5766e1,_0x47cf('0x31'),_0x47cf('0x20')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x3ad3b3)[_0x47cf('0x10')](_0x38cf5c)[_0x47cf('0x13')](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x38cf5c+'.CmListId')[_0x47cf('0x13')](_0x53fdb3,null,_0x53fdb3+_0x47cf('0x26')+_0x38cf5c+'.'+_0x5766e1)['where'](_0x38cf5c+'.CmListId\x20=\x20?',_0x247ed6)['where'](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),squel[_0x47cf('0x22')]()['field'](_0x47cf('0x30'))[_0x47cf('0x10')](_0x47cf('0x2f'))[_0x47cf('0x11')](_0x47cf('0x38'),_0x247ed6)['where'](_0x5766e1+'\x20=\x20?',_0x38cf5c+'.'+_0x5766e1)))[_0x47cf('0x2d')]();}function insertCmContact(_0x25741a,_0x125d78,_0x23b6eb,_0x2cd57c){var _0x171aa5=_[_0x47cf('0x39')](_[_0x47cf('0x3a')](_0x2cd57c),[_0x47cf('0x1f'),_0x47cf('0x3b'),_0x47cf('0x31'),_0x47cf('0x20')]);return squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x47cf('0x24'))[_0x47cf('0x1c')](_0x171aa5,squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x171aa5)[_0x47cf('0x10')](_0x125d78)[_0x47cf('0x11')]('('+_0x23b6eb[_0x47cf('0x13')](',')+_0x47cf('0x3c'),squel[_0x47cf('0x22')]()['fields'](_0x23b6eb)[_0x47cf('0x10')](_0x47cf('0x24'))[_0x47cf('0x11')](_0x47cf('0x38'),_0x25741a)[_0x47cf('0x11')]('deletedAt\x20IS\x20NULL'))[_0x47cf('0x11')](_0x47cf('0x3d'),squel[_0x47cf('0x22')]()[_0x47cf('0x3e')](_0x47cf('0x3f'),_0x47cf('0x40'))[_0x47cf('0x10')](_0x125d78)[_0x47cf('0x41')](_0x23b6eb[_0x47cf('0x13')](','))))[_0x47cf('0x2d')]();}function handleStop(){logger[_0x47cf('0x42')](_0x47cf('0x43'));stopped=!![];}function handleUncaughtException(_0x5d39ab){logger[_0x47cf('0x44')](_0x5d39ab[_0x47cf('0x45')]);process[_0x47cf('0x46')](0x1);}function handleError(_0x2a6e28,_0x755df2){stats['errors']['push']({'name':_0x755df2[_0x47cf('0x47')],'message':_0x755df2['message'],'row':_0x2a6e28});}function handleQuery(_0x43bed8){logger['info'](_0x43bed8);return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x43bed8)[_0x47cf('0x4a')](function(_0x1a4b4e){results['push'](_0x1a4b4e);})[_0x47cf('0x4b')](function(_0x293041){logger[_0x47cf('0x44')](_0x293041[_0x47cf('0x45')]);});}function updateTzCampaigns(_0x2f584a){return new Promise(function(_0x5202bf,_0x11eb9e){var _0x1f26ff=squel[_0x47cf('0x22')]()[_0x47cf('0x23')]([_0x47cf('0x4c'),_0x47cf('0x4d')])[_0x47cf('0x10')](_0x47cf('0x4e'))['join'](_0x47cf('0x4f'),null,_0x47cf('0x50'))['where'](_0x47cf('0x51')+_0x2f584a);db[_0x47cf('0x48')]['query'](_0x1f26ff[_0x47cf('0x2d')]())['spread'](function(_0x4b1316){var _0x2202e5=[];for(var _0xc32a91=0x0;_0xc32a91<_0x4b1316[_0x47cf('0x52')];_0xc32a91++){_0x2202e5[_0x47cf('0x53')](getTimezoneData(_0x4b1316[_0xc32a91],tmp_campaigns));}BPromise[_0x47cf('0x54')](_0x2202e5)[_0x47cf('0x55')](function(){_0x5202bf({'val':0x1});});})['catch'](function(_0x5235b5){logger[_0x47cf('0x44')](_0x5235b5[_0x47cf('0x45')]);_0x5202bf({'val':0x0});});});}function updateTzVoiceQueues(_0x21cce8){return new Promise(function(_0x11b811,_0xf24298){var _0x39883f=squel[_0x47cf('0x22')]()[_0x47cf('0x23')]([_0x47cf('0x56'),_0x47cf('0x57')])['from'](_0x47cf('0x58'))[_0x47cf('0x13')](_0x47cf('0x59'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x21cce8);db[_0x47cf('0x48')][_0x47cf('0x49')](_0x39883f[_0x47cf('0x2d')]())[_0x47cf('0x4a')](function(_0x10becd){var _0x1bc954=[];for(var _0x2b0800=0x0;_0x2b0800<_0x10becd['length'];_0x2b0800++){_0x1bc954[_0x47cf('0x53')](getTimezoneData(_0x10becd[_0x2b0800],tmp_voice_queues));}BPromise[_0x47cf('0x54')](_0x1bc954)['then'](function(){_0x11b811({'val':0x1});});})[_0x47cf('0x4b')](function(_0x1fae9c){logger['error'](_0x1fae9c[_0x47cf('0x45')]);_0x11b811({'val':0x0});});});}function getTimezoneData(_0x18ad8e,_0x7130a9){return new Promise(function(_0x15c691,_0x1654cd){var _0x347563=shared[_0x47cf('0x5a')];var _0x518678=_0x347563[_0x18ad8e[_0x47cf('0x5b')]];if(_[_0x47cf('0x5c')](_0x518678)){_0x15c691({'ret':0x1});}else{var _0x10c669=_0x518678['utcOffset'];var _0x46e520=squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x7130a9)[_0x47cf('0x5d')]('id',_0x18ad8e['id'])[_0x47cf('0x5d')](_0x47cf('0x5e'),_0x10c669)['set'](_0x47cf('0x5b'),_0x18ad8e[_0x47cf('0x5b')])['toString']();return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x46e520)[_0x47cf('0x4a')](function(_0xed149){_0x15c691({'ret':0x1});})[_0x47cf('0x4b')](function(_0x16df19){logger[_0x47cf('0x44')](_0x16df19[_0x47cf('0x45')]);_0x1654cd({'ret':0x1});});}});}function handleTZQuery(_0x2f9383){logger['info'](_0x2f9383);return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x2f9383)[_0x47cf('0x4a')](function(_0x61b4d1){})[_0x47cf('0x4b')](function(_0xb0deb2){logger[_0x47cf('0x44')](_0xb0deb2[_0x47cf('0x45')]);});}function main(_0x2781fb,_0x57fb07,_0x3cc368,_0x4f73b6){logger[_0x47cf('0x42')](_0x47cf('0x5f'),_0x2781fb,JSON[_0x47cf('0x60')](_0x57fb07));process['send'](_0x47cf('0x61'));var _0x5cdf63=_0x57fb07[_0x47cf('0x62')];var _0x206013=_0x57fb07[_0x47cf('0x63')];var _0x191242=path[_0x47cf('0x13')](config[_0x47cf('0x64')],_0x47cf('0x65'),_0x206013+_0x47cf('0x66'));hasTZ=_[_0x47cf('0x3a')](_0x5cdf63)[_0x47cf('0x67')](_0x47cf('0x5b'));var _0x29162a=_[_0x47cf('0x3a')](_0x5cdf63)[_0x47cf('0x13')]();logger[_0x47cf('0x42')](_0x47cf('0x68'),_0x29162a);if(hasTZ)_0x29162a+=_0x47cf('0x69');fs['writeFileSync'](_0x191242,_0x29162a+'\x0a');Papa[_0x47cf('0x6a')](fs[_0x47cf('0x6b')](_0x2781fb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14bb5e,_0x2451c8){try{for(var _0x487a16=0x0,_0x1c6c35=[];_0x487a16<_0x14bb5e[_0x47cf('0x6c')]['length'];_0x487a16++){stats[_0x47cf('0x6d')]+=0x1;if(_0x14bb5e[_0x47cf('0x6e')][_0x487a16]){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],_0x14bb5e['errors'][_0x487a16]);}else{var _0x2fed35=[];for(var _0x589edd in _0x5cdf63){if(_0x5cdf63[_0x47cf('0x6f')](_0x589edd)){if(_0x14bb5e[_0x47cf('0x6c')][_0x487a16][_0x5cdf63[_0x589edd]]){var _0x3a07e2=_[_0x47cf('0x70')](_0x14bb5e[_0x47cf('0x6c')][_0x487a16][_0x5cdf63[_0x589edd]][_0x47cf('0x71')](/"/g,'\x27'));switch(_0x589edd){case _0x47cf('0x1d'):var _0x5d487b=moment(_0x3a07e2,_0x47cf('0xf'),!![]);if(_0x5d487b[_0x47cf('0x72')]()){_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x73'));}break;case _0x47cf('0x36'):var _0x1ee900=parseInt(_0x3a07e2);_0x3a07e2=_[_0x47cf('0x74')](_0x1ee900)||_0x1ee900<0x0||_0x1ee900>0x4?_0x4f73b6?0x3:0x2:_0x1ee900;_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');break;case _0x47cf('0x37'):var _0x3165df=parseInt(_0x3a07e2);if(_[_0x47cf('0x75')](_0x3165df)&&_['includes'](_0x3cc368,_0x3165df)){_0x1c6c35['push']('\x22'+_0x3165df+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x76'));}break;case _0x47cf('0x77'):if(isEmail(_0x3a07e2)){_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35['push'](_0x47cf('0x78'));}break;case _0x47cf('0x79'):var _0x3f673e=moment(_0x3a07e2,_0x47cf('0x7a'),!![]);if(_0x3f673e[_0x47cf('0x72')]()){_0x1c6c35['push']('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x7b'));}break;case _0x47cf('0x5b'):var _0x1446cd=shared[_0x47cf('0x5a')];var _0x58d339=_0x1446cd[_0x3a07e2];if(!_[_0x47cf('0x5c')](_0x58d339)){var _0x59ed82=_0x58d339[_0x47cf('0x7c')];_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x59ed82+'\x22');}break;default:_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}}else{switch(_0x589edd){case _0x47cf('0x7d'):case'phone':_0x2fed35[_0x47cf('0x53')](_0x589edd+'\x20not\x20specified');break;default:_0x1c6c35[_0x47cf('0x53')]('\x22\x22');}}}}if(_0x2fed35[_0x47cf('0x52')]){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],{'code':_0x47cf('0x7e'),'message':_0x2fed35[_0x47cf('0x13')]()});}else{fs[_0x47cf('0x7f')](_0x191242,_0x1c6c35[_0x47cf('0x13')]()+'\x0a');}_0x1c6c35=[];}if(!(stats[_0x47cf('0x6d')]%0xc8)){socket['emit'](_0x47cf('0x80')+_0x206013,stats);stats[_0x47cf('0x6e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x2451c8[_0x47cf('0x81')]();}}catch(_0x59fdc3){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],{'code':_0x47cf('0x82'),'message':_0x59fdc3[_0x47cf('0x45')]});logger[_0x47cf('0x44')](_0x47cf('0x83'),_0x59fdc3[_0x47cf('0x45')]);}},'complete':function(){try{var _0x1a4a36=[];var _0x5d48c9=[];var _0x2dd0ee=_0x47cf('0x24');if(_0x57fb07[_0x47cf('0x84')]&&_0x57fb07['duplicates'][_0x47cf('0x52')]){_0x2dd0ee=_0x47cf('0x85')+_0x206013;_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x86')+_0x2dd0ee+_0x47cf('0x87'));}tmp_campaigns='campaigns_'+_0x206013;tmp_voice_queues=_0x47cf('0x88')+_0x206013;_0x5d48c9[_0x47cf('0x53')](_0x47cf('0x86')+tmp_campaigns+_0x47cf('0x89'));_0x5d48c9[_0x47cf('0x53')](_0x47cf('0x86')+tmp_voice_queues+_0x47cf('0x89'));BPromise[_0x47cf('0x8a')](_0x5d48c9,handleTZQuery)[_0x47cf('0x55')](function(_0x110969){updateTzCampaigns(_0x57fb07[_0x47cf('0x1f')])[_0x47cf('0x55')](function(_0x25377f){updateTzVoiceQueues(_0x57fb07[_0x47cf('0x1f')])['then'](function(_0x4bbc47){var _0x8dcbac=util['format'](_0x47cf('0x8b'),_0x191242,_0x2dd0ee,_0x29162a,_0x57fb07['ListId'],_0x57fb07[_0x47cf('0x3b')]||null,NOW,NOW);if(_[_0x47cf('0x5c')](_0x5cdf63[_0x47cf('0x1d')])){_0x8dcbac+=',\x20scheduledAt\x20=\x20NOW()';}_0x1a4a36['push'](_0x8dcbac);if(_0x57fb07['duplicates']&&_0x57fb07[_0x47cf('0x84')][_0x47cf('0x52')]){_0x1a4a36[_0x47cf('0x53')](insertCmContact(_0x57fb07['ListId'],_0x2dd0ee,_0x57fb07['duplicates'],_0x5cdf63));_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+_0x2dd0ee+';');}if(hasTZ){_0x1a4a36['push'](insertTzCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x59'),_0x47cf('0x58'),_0x47cf('0x8d'),_0x4f73b6,tmp_voice_queues));_0x1a4a36[_0x47cf('0x53')](insertTzCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x8e'),'voice_queues','VoiceQueueId'));_0x1a4a36[_0x47cf('0x53')](insertTzCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x4f'),_0x47cf('0x4e'),'CampaignId',_0x4f73b6,tmp_campaigns));_0x1a4a36['push'](insertTzCmHopperBlack(_0x57fb07['ListId'],_0x47cf('0x8f'),'campaigns',_0x47cf('0x90')));}else{_0x1a4a36[_0x47cf('0x53')](insertCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x59'),_0x47cf('0x58'),_0x47cf('0x8d'),_0x4f73b6));_0x1a4a36['push'](insertCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],'voice_queues_has_cm_blacklists',_0x47cf('0x58'),_0x47cf('0x8d')));_0x1a4a36[_0x47cf('0x53')](insertCmHopper(_0x57fb07[_0x47cf('0x1f')],'campaigns_has_cm_lists',_0x47cf('0x4e'),_0x47cf('0x90'),_0x4f73b6));_0x1a4a36[_0x47cf('0x53')](insertCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x8f'),_0x47cf('0x4e'),'CampaignId'));}_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+tmp_campaigns+';');_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+tmp_voice_queues+';');BPromise['each'](_0x1a4a36,handleQuery)[_0x47cf('0x55')](function(_0x58ea61){stats[_0x47cf('0x91')]=!![];stats[_0x47cf('0x92')]=_0x57fb07['duplicates']&&_0x57fb07[_0x47cf('0x84')][_0x47cf('0x52')]?results[0x2][_0x47cf('0x92')]:results[0x0][_0x47cf('0x92')];socket[_0x47cf('0x93')]('contact:import:'+_0x206013,stats);fs[_0x47cf('0x94')](_0x2781fb);fs['unlink'](_0x191242);process[_0x47cf('0x46')](0x0);})[_0x47cf('0x4b')](function(_0x34901a){logger[_0x47cf('0x44')](_0x34901a['message']);process[_0x47cf('0x46')](0x1);});});});});}catch(_0x2dc9b4){logger[_0x47cf('0x44')](_0x47cf('0x95'),_0x2dc9b4[_0x47cf('0x45')]);process[_0x47cf('0x46')](0x1);}},'error':function(_0x30b2e1,_0x2f449e,_0x5aba97,_0x39b90b){throw new Error(_0x39b90b);}});}function validate(){if(process['argv']&&process[_0x47cf('0x96')][_0x47cf('0x52')]<0x4){throw new Error(_0x47cf('0x97'));}var _0x13bd21=path['join'](config[_0x47cf('0x64')],_0x47cf('0x65'),process['argv'][0x2]);if(!fs['existsSync'](_0x13bd21)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x32d75a={};try{_0x32d75a=JSON[_0x47cf('0x6a')](process[_0x47cf('0x96')][0x3]);if(!_0x32d75a[_0x47cf('0x62')]){throw new Error(_0x47cf('0x98'));}if(!_0x32d75a[_0x47cf('0x62')][_0x47cf('0x30')]){throw new Error(_0x47cf('0x99'));}if(!_0x32d75a[_0x47cf('0x62')][_0x47cf('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5c239d=0x0;if(_0x32d75a[_0x47cf('0x62')][_0x47cf('0x37')]){_0x5c239d=0x1;}if(!_0x32d75a['ListId']){throw new Error(_0x47cf('0x9a'));}}catch(_0x4cafea){throw new Error(_0x47cf('0x9b'));}var _0x7fad24=[];try{_0x7fad24=_['map'](JSON[_0x47cf('0x6a')](process['argv'][0x4]),'id');}catch(_0x306504){logger['info'](_0x47cf('0x9c'));}main(_0x13bd21,_0x32d75a,_0x7fad24,_0x5c239d);}validate();process['on'](_0x47cf('0x9d'),handleStop);process['on'](_0x47cf('0x9e'),handleUncaughtException); \ No newline at end of file +var _0xd4c4=['ContactId','ListId','createdAt','UserId','recallme','select','fields','cm_contacts','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','fromQuery','updatedAt','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.UserId','priority','cm_contacts.ListId\x20=\x20','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','query','spread','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','then','catch','timezones','dialTimezone','isNil','utcOffset','set','offset','stringify','start','socket_timestamp','root','server/files/tmp','keys','includes','header',',utcOffset','writeFileSync','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','parse','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','scheduledat'];(function(_0x33d0fb,_0x59aa45){var _0x4d6fd7=function(_0x347c03){while(--_0x347c03){_0x33d0fb['push'](_0x33d0fb['shift']());}};_0x4d6fd7(++_0x59aa45);}(_0xd4c4,0x1c3));var _0x4d4c=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xd4c4[_0x162780];return _0x1ea2dc;};'use strict';var fs=require('fs');var path=require(_0x4d4c('0x0'));var _=require(_0x4d4c('0x1'));var Papa=require(_0x4d4c('0x2'));var util=require(_0x4d4c('0x3'));var BPromise=require(_0x4d4c('0x4'));var moment=require(_0x4d4c('0x5'));var squel=require(_0x4d4c('0x6'));var Redis=require('ioredis');var db=require(_0x4d4c('0x7'))['db'];var config=require(_0x4d4c('0x8'));var shared=require(_0x4d4c('0x9'));var logger=require(_0x4d4c('0xa'))('import');config[_0x4d4c('0xb')]=_[_0x4d4c('0xc')](config[_0x4d4c('0xb')],{'host':_0x4d4c('0xd'),'port':0x18eb});var socket=require(_0x4d4c('0xe'))(new Redis(config[_0x4d4c('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4d4c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x53166c){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'](_0x53166c);}function selectNotIn(_0x57fd8c,_0x277056,_0x2e3744,_0x27cbf0,_0x14c961){return squel['select']()[_0x4d4c('0x10')](_0x4d4c('0x11'))[_0x4d4c('0x12')](_0x27cbf0)[_0x4d4c('0x13')](_0x277056,null,_0x277056+_0x4d4c('0x14')+_0x27cbf0+'.'+_0x2e3744)[_0x4d4c('0x15')](_0x27cbf0+'.'+_0x2e3744+_0x4d4c('0x16')+_0x57fd8c+'.'+_0x2e3744)[_0x4d4c('0x15')](_0x277056+'.dialCheckDuplicateType\x20IN\x20('+_0x14c961[_0x4d4c('0x13')]()+')');}function insertCmHopper(_0x515468,_0x89b717,_0x54961f,_0x460c09,_0x54cec0){var _0x314873=[_0x4d4c('0x17'),'cm_contacts.scheduledat',_0x4d4c('0x18'),_0x4d4c('0x19'),_0x89b717+'.'+_0x460c09,_0x4d4c('0x1a'),_0x4d4c('0x1b'),_0x4d4c('0x1c'),'cm_contacts.UserId','\x22'+_0x54cec0+'\x22'];return squel[_0x4d4c('0x1d')]()[_0x4d4c('0x1e')]('cm_hopper')['fromQuery']([_0x4d4c('0x11'),_0x4d4c('0x1f'),_0x4d4c('0x20'),_0x4d4c('0x21'),_0x460c09,_0x4d4c('0x22'),'updatedAt','priority',_0x4d4c('0x23'),_0x4d4c('0x24')],squel[_0x4d4c('0x25')]()[_0x4d4c('0x26')](_0x314873)[_0x4d4c('0x12')](_0x89b717)[_0x4d4c('0x13')](_0x4d4c('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x89b717+'.CmListId')[_0x4d4c('0x13')](_0x54961f,null,_0x54961f+'.id\x20=\x20'+_0x89b717+'.'+_0x460c09)[_0x4d4c('0x15')](_0x89b717+'.CmListId\x20=\x20?',_0x515468)[_0x4d4c('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4d4c('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x89b717,_0x54961f,_0x460c09,_0x4d4c('0x28'),[_0x4d4c('0x29'),_0x4d4c('0x2a')]))[_0x4d4c('0x15')](_0x4d4c('0x2b'),selectNotIn(_0x89b717,_0x54961f,_0x460c09,_0x4d4c('0x28'),[_0x4d4c('0x29')])))[_0x4d4c('0x2c')]();}function insertCmHopperBlack(_0x53ee7d,_0x348f66,_0x129c42,_0x1f0622){var _0x36af94=[_0x4d4c('0x17'),'cm_contacts.id',_0x4d4c('0x19'),_0x348f66+'.'+_0x1f0622,_0x4d4c('0x1a'),_0x4d4c('0x1b')];return squel[_0x4d4c('0x1d')]()[_0x4d4c('0x1e')](_0x4d4c('0x2d'))[_0x4d4c('0x2e')]([_0x4d4c('0x11'),'ContactId',_0x4d4c('0x21'),_0x1f0622,'createdAt',_0x4d4c('0x2f')],squel[_0x4d4c('0x25')]()[_0x4d4c('0x26')](_0x36af94)[_0x4d4c('0x12')](_0x348f66)[_0x4d4c('0x13')](_0x4d4c('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x348f66+_0x4d4c('0x30'))[_0x4d4c('0x13')](_0x129c42,null,_0x129c42+_0x4d4c('0x14')+_0x348f66+'.'+_0x1f0622)[_0x4d4c('0x15')](_0x348f66+_0x4d4c('0x31'),_0x53ee7d)[_0x4d4c('0x15')](_0x4d4c('0x32'),NOW)[_0x4d4c('0x15')](_0x4d4c('0x2b'),squel['select']()[_0x4d4c('0x10')](_0x4d4c('0x11'))[_0x4d4c('0x12')](_0x4d4c('0x2d'))[_0x4d4c('0x15')](_0x4d4c('0x33'),_0x53ee7d)[_0x4d4c('0x15')](_0x1f0622+_0x4d4c('0x34'),_0x348f66+'.'+_0x1f0622)))[_0x4d4c('0x2c')]();}function insertTzCmHopper(_0x3f5ebc,_0x314ffc,_0x595199,_0x1ecb6c,_0x4f8331,_0x1a679d){var _0x5e6fd1=[_0x4d4c('0x17'),_0x4d4c('0x35')+_0x1a679d+_0x4d4c('0x36'),_0x4d4c('0x18'),_0x4d4c('0x19'),_0x314ffc+'.'+_0x1ecb6c,_0x4d4c('0x1a'),'cm_contacts.updatedAt',_0x4d4c('0x1c'),_0x4d4c('0x37'),'\x22'+_0x4f8331+'\x22'];var _0xd5cbf1=squel[_0x4d4c('0x1d')]()['into'](_0x4d4c('0x28'))[_0x4d4c('0x2e')](['phone','scheduledat',_0x4d4c('0x20'),_0x4d4c('0x21'),_0x1ecb6c,_0x4d4c('0x22'),_0x4d4c('0x2f'),_0x4d4c('0x38'),'UserId','recallme'],squel['select']()['fields'](_0x5e6fd1)['from'](_0x314ffc)[_0x4d4c('0x13')]('cm_contacts',null,_0x4d4c('0x39')+_0x314ffc+'.CmListId')[_0x4d4c('0x13')](_0x595199,null,_0x595199+_0x4d4c('0x14')+_0x314ffc+'.'+_0x1ecb6c)[_0x4d4c('0x13')](_0x1a679d,null,_0x1a679d+_0x4d4c('0x14')+_0x314ffc+'.'+_0x1ecb6c)['where'](_0x314ffc+'.CmListId\x20=\x20?',_0x3f5ebc)['where'](_0x4d4c('0x32'),NOW)['where'](_0x4d4c('0x2b'),selectNotIn(_0x314ffc,_0x595199,_0x1ecb6c,_0x4d4c('0x28'),[_0x4d4c('0x29'),'\x22onlyIfOpen\x22']))[_0x4d4c('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x314ffc,_0x595199,_0x1ecb6c,_0x4d4c('0x28'),['\x22always\x22'])))[_0x4d4c('0x2c')]();return _0xd5cbf1;}function insertTzCmHopperBlack(_0x30b240,_0x1f0a3d,_0x3d0c3f,_0x35397e){var _0x224c75=[_0x4d4c('0x17'),_0x4d4c('0x18'),_0x4d4c('0x19'),_0x1f0a3d+'.'+_0x35397e,_0x4d4c('0x1a'),'cm_contacts.updatedAt'];return squel[_0x4d4c('0x1d')]()['into'](_0x4d4c('0x2d'))['fromQuery']([_0x4d4c('0x11'),'ContactId','ListId',_0x35397e,_0x4d4c('0x22'),'updatedAt'],squel[_0x4d4c('0x25')]()[_0x4d4c('0x26')](_0x224c75)['from'](_0x1f0a3d)[_0x4d4c('0x13')](_0x4d4c('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0x1f0a3d+_0x4d4c('0x30'))['join'](_0x3d0c3f,null,_0x3d0c3f+_0x4d4c('0x14')+_0x1f0a3d+'.'+_0x35397e)[_0x4d4c('0x15')](_0x1f0a3d+_0x4d4c('0x31'),_0x30b240)[_0x4d4c('0x15')](_0x4d4c('0x32'),NOW)[_0x4d4c('0x15')](_0x4d4c('0x2b'),squel[_0x4d4c('0x25')]()[_0x4d4c('0x10')](_0x4d4c('0x11'))['from'](_0x4d4c('0x2d'))['where']('ListId\x20=\x20?',_0x30b240)[_0x4d4c('0x15')](_0x35397e+_0x4d4c('0x34'),_0x1f0a3d+'.'+_0x35397e)))['toString']();}function insertCmContact(_0x12057e,_0x53f3bf,_0x335ce7,_0x5b01ae){var _0x5571d3=_['concat'](_['keys'](_0x5b01ae),['ListId','CompanyId',_0x4d4c('0x22'),_0x4d4c('0x2f')]);return squel[_0x4d4c('0x1d')]()['into'](_0x4d4c('0x27'))[_0x4d4c('0x2e')](_0x5571d3,squel['select']()[_0x4d4c('0x26')](_0x5571d3)['from'](_0x53f3bf)[_0x4d4c('0x15')]('('+_0x335ce7[_0x4d4c('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x4d4c('0x26')](_0x335ce7)[_0x4d4c('0x12')](_0x4d4c('0x27'))['where'](_0x4d4c('0x33'),_0x12057e)['where'](_0x4d4c('0x3a')))[_0x4d4c('0x15')]('id\x20IN\x20?',squel[_0x4d4c('0x25')]()[_0x4d4c('0x10')](_0x4d4c('0x3b'),_0x4d4c('0x3c'))[_0x4d4c('0x12')](_0x53f3bf)[_0x4d4c('0x3d')](_0x335ce7['join'](','))))[_0x4d4c('0x2c')]();}function handleStop(){logger[_0x4d4c('0x3e')](_0x4d4c('0x3f'));stopped=!![];}function handleUncaughtException(_0x39adb8){logger[_0x4d4c('0x40')](_0x39adb8[_0x4d4c('0x41')]);process[_0x4d4c('0x42')](0x1);}function handleError(_0x51ea8d,_0x1f406f){stats['errors'][_0x4d4c('0x43')]({'name':_0x1f406f[_0x4d4c('0x44')],'message':_0x1f406f[_0x4d4c('0x41')],'row':_0x51ea8d});}function handleQuery(_0x4dc535){logger[_0x4d4c('0x3e')](_0x4dc535);return db[_0x4d4c('0x45')][_0x4d4c('0x46')](_0x4dc535)[_0x4d4c('0x47')](function(_0xc9c73e){results[_0x4d4c('0x43')](_0xc9c73e);})['catch'](function(_0x2ccf44){logger[_0x4d4c('0x40')](_0x2ccf44[_0x4d4c('0x41')]);});}function updateTzCampaigns(_0x4bfc9b){return new Promise(function(_0x32676f,_0x44d03f){var _0x198dbe=squel[_0x4d4c('0x25')]()[_0x4d4c('0x26')]([_0x4d4c('0x48'),'campaigns.dialTimezone'])[_0x4d4c('0x12')]('campaigns')[_0x4d4c('0x13')](_0x4d4c('0x49'),null,_0x4d4c('0x4a'))['where'](_0x4d4c('0x4b')+_0x4bfc9b);db['sequelize']['query'](_0x198dbe[_0x4d4c('0x2c')]())[_0x4d4c('0x47')](function(_0x2cc5c5){var _0x44b4e7=[];for(var _0x4b354c=0x0;_0x4b354c<_0x2cc5c5[_0x4d4c('0x4c')];_0x4b354c++){_0x44b4e7[_0x4d4c('0x43')](getTimezoneData(_0x2cc5c5[_0x4b354c],tmp_campaigns));}BPromise['all'](_0x44b4e7)['then'](function(){_0x32676f({'val':0x1});});})['catch'](function(_0x363aaa){logger[_0x4d4c('0x40')](_0x363aaa['message']);_0x32676f({'val':0x0});});});}function updateTzVoiceQueues(_0x185055){return new Promise(function(_0x76557f,_0x86aa87){var _0x1d37ba=squel[_0x4d4c('0x25')]()['fields']([_0x4d4c('0x4d'),_0x4d4c('0x4e')])[_0x4d4c('0x12')](_0x4d4c('0x4f'))['join'](_0x4d4c('0x50'),null,_0x4d4c('0x51'))[_0x4d4c('0x15')](_0x4d4c('0x52')+_0x185055);db[_0x4d4c('0x45')][_0x4d4c('0x46')](_0x1d37ba[_0x4d4c('0x2c')]())[_0x4d4c('0x47')](function(_0xb35082){var _0x4fc358=[];for(var _0x238bdb=0x0;_0x238bdb<_0xb35082[_0x4d4c('0x4c')];_0x238bdb++){_0x4fc358['push'](getTimezoneData(_0xb35082[_0x238bdb],tmp_voice_queues));}BPromise[_0x4d4c('0x53')](_0x4fc358)[_0x4d4c('0x54')](function(){_0x76557f({'val':0x1});});})[_0x4d4c('0x55')](function(_0x1bebaf){logger[_0x4d4c('0x40')](_0x1bebaf[_0x4d4c('0x41')]);_0x76557f({'val':0x0});});});}function getTimezoneData(_0x4bf8d3,_0x3f59a3){return new Promise(function(_0xf77841,_0x4559d6){var _0x1c4204=shared[_0x4d4c('0x56')];var _0xf745b2=_0x1c4204[_0x4bf8d3[_0x4d4c('0x57')]];if(_[_0x4d4c('0x58')](_0xf745b2)){_0xf77841({'ret':0x1});}else{var _0x548a8d=_0xf745b2[_0x4d4c('0x59')];var _0x3b33f5=squel[_0x4d4c('0x1d')]()[_0x4d4c('0x1e')](_0x3f59a3)['set']('id',_0x4bf8d3['id'])[_0x4d4c('0x5a')](_0x4d4c('0x5b'),_0x548a8d)[_0x4d4c('0x5a')](_0x4d4c('0x57'),_0x4bf8d3[_0x4d4c('0x57')])[_0x4d4c('0x2c')]();return db['sequelize'][_0x4d4c('0x46')](_0x3b33f5)[_0x4d4c('0x47')](function(_0x7a6965){_0xf77841({'ret':0x1});})['catch'](function(_0x542eda){logger[_0x4d4c('0x40')](_0x542eda['message']);_0x4559d6({'ret':0x1});});}});}function handleTZQuery(_0x494c20){logger[_0x4d4c('0x3e')](_0x494c20);return db['sequelize']['query'](_0x494c20)[_0x4d4c('0x47')](function(_0x428900){})[_0x4d4c('0x55')](function(_0x5d3d9e){logger[_0x4d4c('0x40')](_0x5d3d9e[_0x4d4c('0x41')]);});}function main(_0x5546b4,_0x139a36,_0x1f41bd,_0x17753d){logger['info']('main',_0x5546b4,JSON[_0x4d4c('0x5c')](_0x139a36));process['send'](_0x4d4c('0x5d'));var _0x47855a=_0x139a36['binding'];var _0x4ae18d=_0x139a36[_0x4d4c('0x5e')];var _0x5beb97=path[_0x4d4c('0x13')](config[_0x4d4c('0x5f')],_0x4d4c('0x60'),_0x4ae18d+'.csv');hasTZ=_[_0x4d4c('0x61')](_0x47855a)[_0x4d4c('0x62')](_0x4d4c('0x57'));var _0x246cc1=_[_0x4d4c('0x61')](_0x47855a)[_0x4d4c('0x13')]();logger[_0x4d4c('0x3e')](_0x4d4c('0x63'),_0x246cc1);if(hasTZ)_0x246cc1+=_0x4d4c('0x64');fs[_0x4d4c('0x65')](_0x5beb97,_0x246cc1+'\x0a');Papa['parse'](fs[_0x4d4c('0x66')](_0x5546b4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x39fd6d,_0x20210c){try{for(var _0xd0c2e=0x0,_0x22e86e=[];_0xd0c2e<_0x39fd6d[_0x4d4c('0x67')]['length'];_0xd0c2e++){stats[_0x4d4c('0x68')]+=0x1;if(_0x39fd6d['errors'][_0xd0c2e]){handleError(_0x39fd6d['data'][_0xd0c2e],_0x39fd6d[_0x4d4c('0x69')][_0xd0c2e]);}else{var _0x89afbe=[];for(var _0x5713a2 in _0x47855a){if(_0x47855a[_0x4d4c('0x6a')](_0x5713a2)){if(_0x39fd6d['data'][_0xd0c2e][_0x47855a[_0x5713a2]]){var _0x212610=_[_0x4d4c('0x6b')](_0x39fd6d[_0x4d4c('0x67')][_0xd0c2e][_0x47855a[_0x5713a2]][_0x4d4c('0x6c')](/"/g,'\x27'));switch(_0x5713a2){case _0x4d4c('0x1f'):var _0x2d1240=moment(_0x212610,_0x4d4c('0x6d'),!![]);if(_0x2d1240[_0x4d4c('0x6e')]()){_0x22e86e[_0x4d4c('0x43')]('\x22'+_0x212610+'\x22');}else{_0x89afbe[_0x4d4c('0x43')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x16ddba=parseInt(_0x212610);_0x212610=_[_0x4d4c('0x6f')](_0x16ddba)||_0x16ddba<0x0||_0x16ddba>0x4?_0x17753d?0x3:0x2:_0x16ddba;_0x22e86e[_0x4d4c('0x43')]('\x22'+_0x212610+'\x22');break;case _0x4d4c('0x23'):var _0x4d1947=parseInt(_0x212610);if(_['isNumber'](_0x4d1947)&&_[_0x4d4c('0x62')](_0x1f41bd,_0x4d1947)){_0x22e86e[_0x4d4c('0x43')]('\x22'+_0x4d1947+'\x22');}else{_0x89afbe[_0x4d4c('0x43')](_0x4d4c('0x70'));}break;case _0x4d4c('0x71'):if(isEmail(_0x212610)){_0x22e86e['push']('\x22'+_0x212610+'\x22');}else{_0x89afbe[_0x4d4c('0x43')](_0x4d4c('0x72'));}break;case _0x4d4c('0x73'):var _0x4e17a7=moment(_0x212610,_0x4d4c('0x74'),!![]);if(_0x4e17a7[_0x4d4c('0x6e')]()){_0x22e86e['push']('\x22'+_0x212610+'\x22');}else{_0x89afbe['push'](_0x4d4c('0x75'));}break;case _0x4d4c('0x57'):var _0x5a9a1f=shared[_0x4d4c('0x56')];var _0x2eee1a=_0x5a9a1f[_0x212610];if(!_[_0x4d4c('0x58')](_0x2eee1a)){var _0x4ee11c=_0x2eee1a[_0x4d4c('0x59')];_0x22e86e['push']('\x22'+_0x212610+'\x22');_0x22e86e['push']('\x22'+_0x4ee11c+'\x22');}break;default:_0x22e86e[_0x4d4c('0x43')]('\x22'+_0x212610+'\x22');}}else{switch(_0x5713a2){case _0x4d4c('0x76'):case _0x4d4c('0x11'):_0x89afbe[_0x4d4c('0x43')](_0x5713a2+_0x4d4c('0x77'));break;default:_0x22e86e[_0x4d4c('0x43')]('\x22\x22');}}}}if(_0x89afbe[_0x4d4c('0x4c')]){handleError(_0x39fd6d[_0x4d4c('0x67')][_0xd0c2e],{'code':'SystemRow','message':_0x89afbe[_0x4d4c('0x13')]()});}else{fs[_0x4d4c('0x78')](_0x5beb97,_0x22e86e[_0x4d4c('0x13')]()+'\x0a');}_0x22e86e=[];}if(!(stats[_0x4d4c('0x68')]%0xc8)){socket[_0x4d4c('0x79')](_0x4d4c('0x7a')+_0x4ae18d,stats);stats[_0x4d4c('0x69')]=[];}}if(stopped){logger[_0x4d4c('0x3e')]('Abort\x20parser');_0x20210c[_0x4d4c('0x7b')]();}}catch(_0x483f54){handleError(_0x39fd6d[_0x4d4c('0x67')][_0xd0c2e],{'code':_0x4d4c('0x7c'),'message':_0x483f54[_0x4d4c('0x41')]});logger[_0x4d4c('0x40')](_0x4d4c('0x7d'),_0x483f54[_0x4d4c('0x41')]);}},'complete':function(){try{var _0x48cdd8=[];var _0x5d4ac4=[];var _0x437401=_0x4d4c('0x27');if(_0x139a36[_0x4d4c('0x7e')]&&_0x139a36[_0x4d4c('0x7e')]['length']){_0x437401=_0x4d4c('0x7f')+_0x4ae18d;_0x48cdd8[_0x4d4c('0x43')](_0x4d4c('0x80')+_0x437401+_0x4d4c('0x81'));}tmp_campaigns=_0x4d4c('0x82')+_0x4ae18d;tmp_voice_queues=_0x4d4c('0x83')+_0x4ae18d;_0x5d4ac4[_0x4d4c('0x43')](_0x4d4c('0x80')+tmp_campaigns+_0x4d4c('0x84'));_0x5d4ac4[_0x4d4c('0x43')](_0x4d4c('0x80')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x4d4c('0x85')](_0x5d4ac4,handleTZQuery)[_0x4d4c('0x54')](function(_0x2fc92a){updateTzCampaigns(_0x139a36[_0x4d4c('0x21')])[_0x4d4c('0x54')](function(_0x5d98d){updateTzVoiceQueues(_0x139a36[_0x4d4c('0x21')])['then'](function(_0x351a9a){var _0x529ac5=util['format'](_0x4d4c('0x86'),_0x5beb97,_0x437401,_0x246cc1,_0x139a36['ListId'],_0x139a36[_0x4d4c('0x87')]||null,NOW,NOW);if(_['isNil'](_0x47855a['scheduledat'])){_0x529ac5+=_0x4d4c('0x88');}_0x48cdd8[_0x4d4c('0x43')](_0x529ac5);if(_0x139a36['duplicates']&&_0x139a36[_0x4d4c('0x7e')][_0x4d4c('0x4c')]){_0x48cdd8[_0x4d4c('0x43')](insertCmContact(_0x139a36[_0x4d4c('0x21')],_0x437401,_0x139a36[_0x4d4c('0x7e')],_0x47855a));_0x48cdd8[_0x4d4c('0x43')](_0x4d4c('0x89')+_0x437401+';');}if(hasTZ){_0x48cdd8['push'](insertTzCmHopper(_0x139a36[_0x4d4c('0x21')],_0x4d4c('0x50'),'voice_queues',_0x4d4c('0x8a'),_0x17753d,tmp_voice_queues));_0x48cdd8['push'](insertTzCmHopperBlack(_0x139a36[_0x4d4c('0x21')],'voice_queues_has_cm_blacklists',_0x4d4c('0x4f'),_0x4d4c('0x8a')));_0x48cdd8[_0x4d4c('0x43')](insertTzCmHopper(_0x139a36['ListId'],_0x4d4c('0x49'),_0x4d4c('0x8b'),_0x4d4c('0x8c'),_0x17753d,tmp_campaigns));_0x48cdd8['push'](insertTzCmHopperBlack(_0x139a36[_0x4d4c('0x21')],_0x4d4c('0x8d'),_0x4d4c('0x8b'),_0x4d4c('0x8c')));}else{_0x48cdd8[_0x4d4c('0x43')](insertCmHopper(_0x139a36['ListId'],_0x4d4c('0x50'),'voice_queues',_0x4d4c('0x8a'),_0x17753d));_0x48cdd8[_0x4d4c('0x43')](insertCmHopperBlack(_0x139a36['ListId'],_0x4d4c('0x8e'),_0x4d4c('0x4f'),_0x4d4c('0x8a')));_0x48cdd8[_0x4d4c('0x43')](insertCmHopper(_0x139a36[_0x4d4c('0x21')],_0x4d4c('0x49'),_0x4d4c('0x8b'),_0x4d4c('0x8c'),_0x17753d));_0x48cdd8[_0x4d4c('0x43')](insertCmHopperBlack(_0x139a36[_0x4d4c('0x21')],'campaigns_has_cm_blacklists','campaigns',_0x4d4c('0x8c')));}_0x48cdd8[_0x4d4c('0x43')](_0x4d4c('0x89')+tmp_campaigns+';');_0x48cdd8[_0x4d4c('0x43')](_0x4d4c('0x89')+tmp_voice_queues+';');BPromise[_0x4d4c('0x85')](_0x48cdd8,handleQuery)[_0x4d4c('0x54')](function(_0x571c55){stats[_0x4d4c('0x8f')]=!![];stats[_0x4d4c('0x90')]=_0x139a36['duplicates']&&_0x139a36[_0x4d4c('0x7e')][_0x4d4c('0x4c')]?results[0x2][_0x4d4c('0x90')]:results[0x0]['affectedRows'];socket[_0x4d4c('0x79')](_0x4d4c('0x7a')+_0x4ae18d,stats);fs[_0x4d4c('0x91')](_0x5546b4);fs['unlink'](_0x5beb97);process[_0x4d4c('0x42')](0x0);})[_0x4d4c('0x55')](function(_0x598a17){logger[_0x4d4c('0x40')](_0x598a17[_0x4d4c('0x41')]);process[_0x4d4c('0x42')](0x1);});});});});}catch(_0x568c5c){logger[_0x4d4c('0x40')](_0x4d4c('0x92'),_0x568c5c[_0x4d4c('0x41')]);process[_0x4d4c('0x42')](0x1);}},'error':function(_0x419e18,_0x35dcaf,_0x3a7741,_0x1249f5){throw new Error(_0x1249f5);}});}function validate(){if(process['argv']&&process[_0x4d4c('0x93')][_0x4d4c('0x4c')]<0x4){throw new Error(_0x4d4c('0x94'));}var _0x56918f=path[_0x4d4c('0x13')](config['root'],'server/files/tmp',process[_0x4d4c('0x93')][0x2]);if(!fs[_0x4d4c('0x95')](_0x56918f)){throw new Error(_0x4d4c('0x96'));}var _0x4cbd2e={};try{_0x4cbd2e=JSON['parse'](process[_0x4d4c('0x93')][0x3]);if(!_0x4cbd2e[_0x4d4c('0x97')]){throw new Error(_0x4d4c('0x98'));}if(!_0x4cbd2e[_0x4d4c('0x97')][_0x4d4c('0x11')]){throw new Error(_0x4d4c('0x99'));}if(!_0x4cbd2e['binding'][_0x4d4c('0x76')]){throw new Error(_0x4d4c('0x9a'));}var _0x3d3ad7=0x0;if(_0x4cbd2e['binding'][_0x4d4c('0x23')]){_0x3d3ad7=0x1;}if(!_0x4cbd2e['ListId']){throw new Error(_0x4d4c('0x9b'));}}catch(_0x293008){throw new Error(_0x4d4c('0x9c'));}var _0x5a345d=[];try{_0x5a345d=_[_0x4d4c('0x9d')](JSON[_0x4d4c('0x9e')](process[_0x4d4c('0x93')][0x4]),'id');}catch(_0x212ba5){logger[_0x4d4c('0x3e')](_0x4d4c('0x9f'));}main(_0x56918f,_0x4cbd2e,_0x5a345d,_0x3d3ad7);}validate();process['on']('SIGINT',handleStop);process['on'](_0x4d4c('0xa0'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 044a3a0..9c9ba93 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 _0x2e0d=['Billable\x20Time','getSubjects','string','voice','toLowerCase','inbound','queue','variable','outbound','push','Outbound\x20Call','***\x20Call\x20Info\x20***','Caller\x20Number','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','destcalleridnum','Member\x20Name','membername','UniqueId','uniqueid','starttime','endtime','duration'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x2e0d,0xc9));var _0xd2e0=function(_0x3988b2,_0x42b98b){_0x3988b2=_0x3988b2-0x0;var _0x3adf85=_0x2e0d[_0x3988b2];return _0x3adf85;};'use strict';exports[_0xd2e0('0x0')]=function(_0x7a972c,_0x58a6fd){var _0x57f6e6=[{'type':_0xd2e0('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x7a972c['toLowerCase']()){case _0xd2e0('0x2'):switch(_0x58a6fd[_0xd2e0('0x3')]()){case _0xd2e0('0x4'):_0x57f6e6['push']({'type':'variable','content':'','variableName':_0xd2e0('0x5')});_0x57f6e6['push']({'type':_0xd2e0('0x6'),'content':'','variableName':'calleridnum'});break;case _0xd2e0('0x7'):_0x57f6e6[_0xd2e0('0x8')]({'type':'string','content':_0xd2e0('0x9'),'variableName':null});_0x57f6e6[_0xd2e0('0x8')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x57f6e6;};exports['getDescriptions']=function(_0x262079,_0x2acaaf){var _0x51d127=[];switch(_0x262079[_0xd2e0('0x3')]()){case _0xd2e0('0x2'):switch(_0x2acaaf['toLowerCase']()){case _0xd2e0('0x4'):_0x51d127=[{'type':_0xd2e0('0x1'),'content':_0xd2e0('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xd2e0('0xb'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0xc')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0xe'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0xf')},{'type':'keyValue','content':'','key':_0xd2e0('0x10'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xd2e0('0x6'),'variableName':'queue'},{'type':_0xd2e0('0xd'),'content':'','key':'UniqueId','keyType':_0xd2e0('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xd2e0('0x12'),'keyType':'variable','variableName':_0xd2e0('0x13')},{'type':_0xd2e0('0x1'),'content':_0xd2e0('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xd2e0('0x6'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xd2e0('0x15'),'keyType':_0xd2e0('0x6'),'variableName':'destcalleridnum'},{'type':'string','content':_0xd2e0('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x13')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x17'),'keyType':'variable','variableName':_0xd2e0('0x18')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x19'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x1a')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1b'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x1c')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1d'),'keyType':_0xd2e0('0x6'),'variableName':'talktime'}];break;case _0xd2e0('0x7'):_0x51d127=[{'type':_0xd2e0('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1e'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x1f')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x20'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x21')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x22'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x23')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x12'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x24')},{'type':_0xd2e0('0x1'),'content':_0xd2e0('0x16')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xd2e0('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x25')},{'type':_0xd2e0('0xd'),'content':'','key':'Duration','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x26')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x51d127;}; \ No newline at end of file +var _0x2a07=['agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','Agent\x20Complete','Hold\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','starttime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date'];(function(_0x1e7b9f,_0x2f2bbe){var _0x53f9a9=function(_0x3a7fd8){while(--_0x3a7fd8){_0x1e7b9f['push'](_0x1e7b9f['shift']());}};_0x53f9a9(++_0x2f2bbe);}(_0x2a07,0x171));var _0x72a0=function(_0x3d3817,_0x5d0b91){_0x3d3817=_0x3d3817-0x0;var _0x4f23ce=_0x2a07[_0x3d3817];return _0x4f23ce;};'use strict';exports[_0x72a0('0x0')]=function(_0x48a71f,_0x2d8fc5){var _0x3799c2=[{'type':_0x72a0('0x1'),'content':_0x72a0('0x2'),'variableName':null}];switch(_0x48a71f['toLowerCase']()){case _0x72a0('0x3'):switch(_0x2d8fc5[_0x72a0('0x4')]()){case _0x72a0('0x5'):_0x3799c2['push']({'type':'variable','content':'','variableName':'queue'});_0x3799c2['push']({'type':_0x72a0('0x6'),'content':'','variableName':_0x72a0('0x7')});break;case _0x72a0('0x8'):_0x3799c2['push']({'type':_0x72a0('0x1'),'content':_0x72a0('0x9'),'variableName':null});_0x3799c2['push']({'type':_0x72a0('0x6'),'content':'','variableName':_0x72a0('0xa')});break;}}return _0x3799c2;};exports['getDescriptions']=function(_0x567d55,_0x13fa81){var _0x40049c=[];switch(_0x567d55['toLowerCase']()){case _0x72a0('0x3'):switch(_0x13fa81[_0x72a0('0x4')]()){case _0x72a0('0x5'):_0x40049c=[{'type':_0x72a0('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x7')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0xc'),'keyType':_0x72a0('0x6'),'variableName':_0x72a0('0xd')},{'type':'keyValue','content':'','key':_0x72a0('0xe'),'keyType':_0x72a0('0x6'),'variableName':_0x72a0('0xf')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x10'),'keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x11')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x12'),'keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x13')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x14'),'keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x16')},{'type':_0x72a0('0xb'),'content':'','key':'Agent\x20Number','keyType':_0x72a0('0x6'),'variableName':_0x72a0('0xa')},{'type':_0x72a0('0x1'),'content':_0x72a0('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x18'),'keyType':'variable','variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x19')},{'type':'keyValue','content':'','key':_0x72a0('0x1a'),'keyType':_0x72a0('0x6'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x72a0('0x1b'),'keyType':_0x72a0('0x6'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x72a0('0x6'),'variableName':_0x72a0('0x1c')}];break;case _0x72a0('0x8'):_0x40049c=[{'type':_0x72a0('0x1'),'content':_0x72a0('0x1d'),'variableName':null},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x1e'),'keyType':'variable','keyContent':'','variableName':_0x72a0('0xa')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x1f'),'keyType':_0x72a0('0x6'),'keyContent':'','variableName':_0x72a0('0x20')},{'type':_0x72a0('0xb'),'content':'','key':'UniqueId','keyType':_0x72a0('0x6'),'keyContent':'','variableName':'uniqueid'},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x14'),'keyType':_0x72a0('0x6'),'keyContent':'','variableName':_0x72a0('0x21')},{'type':'string','content':_0x72a0('0x17')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x72a0('0x6'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x72a0('0x22'),'keyType':_0x72a0('0x6'),'keyContent':'','variableName':_0x72a0('0x23')},{'type':_0x72a0('0xb'),'content':'','key':_0x72a0('0x24'),'keyType':_0x72a0('0x6'),'keyContent':'','variableName':_0x72a0('0x25')},{'type':_0x72a0('0xb'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':_0x72a0('0x26')}];break;}}return _0x40049c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 346e2b5..85b8ba6 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 _0x737d=['clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','user','query'];(function(_0x4cc85f,_0x335b29){var _0x4560de=function(_0x4ecee3){while(--_0x4ecee3){_0x4cc85f['push'](_0x4cc85f['shift']());}};_0x4560de(++_0x335b29);}(_0x737d,0x7a));var _0xd737=function(_0x5e1c64,_0x289764){_0x5e1c64=_0x5e1c64-0x0;var _0x38ea78=_0x737d[_0x5e1c64];return _0x38ea78;};'use strict';var _=require(_0xd737('0x0'));var db=require(_0xd737('0x1'))['db'];var loggers={'openchannel':require(_0xd737('0x2'))(_0xd737('0x3')),'mail':require(_0xd737('0x2'))(_0xd737('0x4')),'fax':require(_0xd737('0x2'))(_0xd737('0x5')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xd737('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd737('0x6'))};function getInteractionId(_0x63705f,_0x5ef8af,_0x362713){if(_0x63705f&&_0x63705f[_['upperFirst'](_0x362713)+_0xd737('0x7')]){return _0x63705f[_[_0xd737('0x8')](_0x362713)+'InteractionId'];}else if(_0x63705f&&_0x63705f['id']){return _0x63705f['id'];}else if(_0x5ef8af&&_0x5ef8af['id']){return _0x5ef8af['id'];}else{return _0xd737('0x9');}}function log(_0x15475a,_0x4c9e9a,_0x3b54ba,_0x3752bc,_0x1d6f66,_0x30793e){loggers[_0x1d6f66[_0xd737('0xa')]()][_0x15475a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30793e[_0xd737('0xb')](),_0x4c9e9a?_0x4c9e9a['id']:null,_0x4c9e9a?_0x4c9e9a[_0xd737('0xc')]:null,_0x4c9e9a?_0x4c9e9a[_0xd737('0xd')]:null,getInteractionId(_0x3b54ba,_0x3752bc,_0x1d6f66),_0x3b54ba?JSON[_0xd737('0xe')](_0x3b54ba):_0xd737('0xf'));}function updateUser(_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765){db[_['upperFirst'](_0x16c7fc)+_0xd737('0x10')][_0xd737('0x11')]({'where':{'id':getInteractionId(_0x473066,_0x4c586c,_0x16c7fc)}})[_0xd737('0x12')](function(_0x4917f8){if(_0x4917f8){return _0x4917f8['update']({'UserId':_0x26976d?_0x26976d['id']:null});}})[_0xd737('0x12')](function(_0x1573fd){if(_0x1573fd){log(_0xd737('0x13'),_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765);}})[_0xd737('0x14')](function(){log('error',_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765);});}exports['tracked']=function(_0x10002a,_0x23ca01){return function(_0x4a5c0f,_0x4b6f4b,_0x436afa){var _0x470c97=_0x4a5c0f[_0xd737('0x15')];var _0x2f5dee={};var _0x4f2a5e=_0x4a5c0f[_0xd737('0x16')];if(_0x2f5dee){_0x2f5dee=_[_0xd737('0x17')](_0x4a5c0f[_0xd737('0x18')]);_0x2f5dee=_[_0xd737('0x19')](_0x2f5dee,[_0xd737('0x18'),_0xd737('0x1a'),'phone',_0xd737('0x1b'),_0xd737('0x1c')]);}updateUser(_0x470c97,_0x2f5dee,_0x4f2a5e,_0x10002a,_0x23ca01);_0x436afa(null);};}; \ No newline at end of file +var _0xd8d2=['name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','user','query','clone','body','omit','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xd8d2,0x103));var _0x2d8d=function(_0x5b95ec,_0x16e0d0){_0x5b95ec=_0x5b95ec-0x0;var _0x2af647=_0xd8d2[_0x5b95ec];return _0x2af647;};'use strict';var _=require(_0x2d8d('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x2d8d('0x1'))(_0x2d8d('0x2')),'mail':require('../../config/logger')(_0x2d8d('0x3')),'fax':require(_0x2d8d('0x1'))(_0x2d8d('0x4')),'sms':require('../../config/logger')(_0x2d8d('0x5')),'chat':require(_0x2d8d('0x1'))(_0x2d8d('0x6')),'whatsapp':require(_0x2d8d('0x1'))(_0x2d8d('0x7'))};function getInteractionId(_0x3c0845,_0xd36277,_0x1cd20b){if(_0x3c0845&&_0x3c0845[_[_0x2d8d('0x8')](_0x1cd20b)+_0x2d8d('0x9')]){return _0x3c0845[_['upperFirst'](_0x1cd20b)+_0x2d8d('0x9')];}else if(_0x3c0845&&_0x3c0845['id']){return _0x3c0845['id'];}else if(_0xd36277&&_0xd36277['id']){return _0xd36277['id'];}else{return'unknown';}}function log(_0x1f0bf9,_0x5e4387,_0xb829aa,_0x78c095,_0xbad4f1,_0x4d21e2){loggers[_0xbad4f1['toLowerCase']()][_0x1f0bf9](_0x2d8d('0xa'),_0x4d21e2['toUpperCase'](),_0x5e4387?_0x5e4387['id']:null,_0x5e4387?_0x5e4387[_0x2d8d('0xb')]:null,_0x5e4387?_0x5e4387[_0x2d8d('0xc')]:null,getInteractionId(_0xb829aa,_0x78c095,_0xbad4f1),_0xb829aa?JSON[_0x2d8d('0xd')](_0xb829aa):_0x2d8d('0xe'));}function updateUser(_0x494413,_0x320474,_0x400ddb,_0x217372,_0x30829e){db[_['upperFirst'](_0x217372)+_0x2d8d('0xf')][_0x2d8d('0x10')]({'where':{'id':getInteractionId(_0x320474,_0x400ddb,_0x217372)}})[_0x2d8d('0x11')](function(_0x241971){if(_0x241971){return _0x241971[_0x2d8d('0x12')]({'UserId':_0x494413?_0x494413['id']:null});}})[_0x2d8d('0x11')](function(_0x504319){if(_0x504319){log(_0x2d8d('0x13'),_0x494413,_0x320474,_0x400ddb,_0x217372,_0x30829e);}})[_0x2d8d('0x14')](function(){log(_0x2d8d('0x15'),_0x494413,_0x320474,_0x400ddb,_0x217372,_0x30829e);});}exports['tracked']=function(_0x1ee735,_0x44c9ed){return function(_0x4d2900,_0x4ab286,_0x316a35){var _0x14f813=_0x4d2900[_0x2d8d('0x16')];var _0x30e98f={};var _0x95b5a4=_0x4d2900[_0x2d8d('0x17')];if(_0x30e98f){_0x30e98f=_[_0x2d8d('0x18')](_0x4d2900[_0x2d8d('0x19')]);_0x30e98f=_[_0x2d8d('0x1a')](_0x30e98f,['body','html',_0x2d8d('0x1b'),_0x2d8d('0x1c'),_0x2d8d('0x1d')]);}updateUser(_0x14f813,_0x30e98f,_0x95b5a4,_0x1ee735,_0x44c9ed);_0x316a35(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a34fbe8..d4cdc20 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 _0xa6a2=['License','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use'];(function(_0x315902,_0xb6d9ad){var _0x8190b9=function(_0xc82d9a){while(--_0xc82d9a){_0x315902['push'](_0x315902['shift']());}};_0x8190b9(++_0xb6d9ad);}(_0xa6a2,0x133));var _0x2a6a=function(_0x3cade8,_0x5d674f){_0x3cade8=_0x3cade8-0x0;var _0x18be8c=_0xa6a2[_0x3cade8];return _0x18be8c;};'use strict';var crypto=require(_0x2a6a('0x0'));var util=require(_0x2a6a('0x1'));var compose=require(_0x2a6a('0x2'));var db=require(_0x2a6a('0x3'))['db'];var config=require(_0x2a6a('0x4'));function getValueFromLicense(_0x1a1b9d,_0xf8be8e){if(_0x1a1b9d&&_0xf8be8e){if(_0xf8be8e[_0x2a6a('0x5')]&&_0xf8be8e[_0x2a6a('0x6')]){var _0x441d81=_0xf8be8e['data1'];var _0x3812e9=_0xf8be8e['license'];var _0x140eb9=_0x441d81[_0x2a6a('0x7')]('-')[0x4];var _0x2cf2c4=_0x441d81[_0x2a6a('0x7')]('-')[0x0];var _0x180977=crypto[_0x2a6a('0x8')]('aes-256-ctr',util[_0x2a6a('0x9')](_0x2a6a('0xa'),_0x140eb9,_0x441d81,_0x2cf2c4));var _0x422474=_0x180977[_0x2a6a('0xb')](_0x3812e9,_0x2a6a('0xc'),_0x2a6a('0xd'));_0x422474+=_0x180977[_0x2a6a('0xe')](_0x2a6a('0xd'));var _0x5541bc=JSON['parse'](_0x422474);return _0x5541bc[_0x2a6a('0xf')](_0x1a1b9d)?_0x5541bc[_0x1a1b9d]:null;}}return null;}function isLimit(_0x49a239,_0x3942af,_0x15b92e,_0x390afd){var _0x555055=_0x3942af;return compose()[_0x2a6a('0x10')](function(_0x1def43,_0x55c26e,_0x198812){return db[_0x2a6a('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2a6a('0x12')](function(_0x3041f5){var _0x33f607=getValueFromLicense(_0x49a239,_0x3041f5);return _0x33f607?_0x33f607:_0x555055;})['then'](function(_0x676b55){_0x555055=_0x676b55;return _0x15b92e[_0x2a6a('0x13')](_0x390afd);})[_0x2a6a('0x12')](function(_0x38ab56){if(_0x38ab56>=_0x555055){return _0x55c26e['status'](0x193)[_0x2a6a('0x14')]({'message':util[_0x2a6a('0x9')](_0x2a6a('0x15'),_0x49a239)});}_0x198812();})['catch'](function(_0x55dd7c){_0x198812(_0x55dd7c);});});}function isUserLimit(){return isLimit(_0x2a6a('0x16'),0x1,db[_0x2a6a('0x17')],{'where':{'$or':[{'role':_0x2a6a('0x18')},{'role':_0x2a6a('0x19')}]}});}exports[_0x2a6a('0x1a')]=isUserLimit; \ No newline at end of file +var _0x7dfa=['isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x7dfa,0x1ee));var _0xa7df=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x7dfa[_0x309d93];return _0x2dd61d;};'use strict';var crypto=require(_0xa7df('0x0'));var util=require(_0xa7df('0x1'));var compose=require(_0xa7df('0x2'));var db=require(_0xa7df('0x3'))['db'];var config=require(_0xa7df('0x4'));function getValueFromLicense(_0x26b736,_0x1a79f4){if(_0x26b736&&_0x1a79f4){if(_0x1a79f4[_0xa7df('0x5')]&&_0x1a79f4[_0xa7df('0x6')]){var _0x45daa7=_0x1a79f4[_0xa7df('0x5')];var _0x31d0c2=_0x1a79f4[_0xa7df('0x6')];var _0x1ef56e=_0x45daa7[_0xa7df('0x7')]('-')[0x4];var _0x14bb0f=_0x45daa7[_0xa7df('0x7')]('-')[0x0];var _0x2babbd=crypto[_0xa7df('0x8')](_0xa7df('0x9'),util[_0xa7df('0xa')](_0xa7df('0xb'),_0x1ef56e,_0x45daa7,_0x14bb0f));var _0x57e581=_0x2babbd[_0xa7df('0xc')](_0x31d0c2,_0xa7df('0xd'),_0xa7df('0xe'));_0x57e581+=_0x2babbd[_0xa7df('0xf')]('utf8');var _0x26f2f3=JSON[_0xa7df('0x10')](_0x57e581);return _0x26f2f3[_0xa7df('0x11')](_0x26b736)?_0x26f2f3[_0x26b736]:null;}}return null;}function isLimit(_0x35defd,_0x3984f5,_0x7741c3,_0x32a03e){var _0x1c2cd8=_0x3984f5;return compose()['use'](function(_0x4ed151,_0x30741b,_0x3fdaca){return db[_0xa7df('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x317ec2){var _0x5dcc07=getValueFromLicense(_0x35defd,_0x317ec2);return _0x5dcc07?_0x5dcc07:_0x1c2cd8;})[_0xa7df('0x13')](function(_0x5d32ac){_0x1c2cd8=_0x5d32ac;return _0x7741c3[_0xa7df('0x14')](_0x32a03e);})['then'](function(_0x4c8358){if(_0x4c8358>=_0x1c2cd8){return _0x30741b[_0xa7df('0x15')](0x193)[_0xa7df('0x16')]({'message':util['format'](_0xa7df('0x17'),_0x35defd)});}_0x3fdaca();})['catch'](function(_0x304aff){_0x3fdaca(_0x304aff);});});}function isUserLimit(){return isLimit(_0xa7df('0x18'),0x1,db[_0xa7df('0x19')],{'where':{'$or':[{'role':_0xa7df('0x1a')},{'role':_0xa7df('0x1b')}]}});}exports[_0xa7df('0x1c')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index f2715eb..5be07a5 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 _0x6049=['<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x58767b,_0x443cab){var _0x4e25e8=function(_0x1457da){while(--_0x1457da){_0x58767b['push'](_0x58767b['shift']());}};_0x4e25e8(++_0x443cab);}(_0x6049,0x85));var _0x9604=function(_0x5e4d61,_0x5a5e1d){_0x5e4d61=_0x5e4d61-0x0;var _0x27d8ad=_0x6049[_0x5e4d61];return _0x27d8ad;};'use strict';var _=require('lodash');var moment=require(_0x9604('0x0'));exports[_0x9604('0x1')]=function(_0x40c3f8){var _0x4d96f8={'conditions':[]};_0x4d96f8[_0x9604('0x2')]=_[_0x9604('0x3')](_0x40c3f8,_0x9604('0x4'))?'or':_0x9604('0x5');var _0x347781=_0x40c3f8[_0x9604('0x6')](_0x9604('0x7'),'')[_0x9604('0x6')](_0x9604('0x4'),'')['split']('||');for(var _0x42a6e5=0x0;_0x42a6e5<_0x347781[_0x9604('0x8')];_0x42a6e5++){var _0x2eab1c=_0x347781[_0x42a6e5][_0x9604('0x9')](':=');var _0x7ebcf2=_0x2eab1c[0x0];var _0x224bfc=_0x2eab1c[_0x9604('0xa')](0x1);_0x224bfc['forEach'](function(_0xb5b0c2){var _0x4a4294=_0xb5b0c2[_0x9604('0x9')]('[')[_0x9604('0xb')]();var _0x50ca5c=_0xb5b0c2[_0x9604('0xc')](/\[(.*?)\]/g);_0x50ca5c[_0x9604('0xd')](function(_0x2b7788){var _0x1bc91b=_0x2b7788['split']('[')[_0x9604('0xe')](function(_0x199a22){return _0x199a22[_0x9604('0xf')](']')>-0x1;})[_0x9604('0x10')](function(_0x3f5c6c){return _0x3f5c6c[_0x9604('0x9')](']')[0x0];})[0x0];_0x4d96f8[_0x9604('0x11')]['push']({'field':_0x7ebcf2,'operator':_0x4a4294,'value':_0x1bc91b});});});}return _0x4d96f8;};exports[_0x9604('0x12')]=function(_0x24e17a,_0x5d3fec,_0x1ca9b6){var _0x30d900={};if(_0x5d3fec==='DATE'){if(_0x1ca9b6['operator']===_0x9604('0x13')){_0x1ca9b6[_0x9604('0x14')]=_0x9604('0x15');_0x1ca9b6[_0x9604('0x16')]+=','+_0x1ca9b6[_0x9604('0x16')];}else if(_[_0x9604('0x17')]([_0x9604('0x18'),_0x9604('0x19')],_0x1ca9b6['operator'])){_0x1ca9b6[_0x9604('0x16')]=moment(_0x1ca9b6[_0x9604('0x16')])[_0x9604('0x1a')](0x1,_0x9604('0x1b'))[_0x9604('0x1c')]('YYYY-MM-DD');}}if(_0x1ca9b6[_0x9604('0x1d')]){_0x5d3fec=_0x1ca9b6[_0x9604('0x1d')];_0x30d900[_0x9604('0x1e')]='CAST('+_0x24e17a+'.'+_0x1ca9b6[_0x9604('0x1f')]+_0x9604('0x20')+_0x1ca9b6[_0x9604('0x1d')]+')\x20'+parseOperator(_0x1ca9b6['operator']);}else{_0x30d900[_0x9604('0x1e')]=_0x24e17a+'.'+_0x1ca9b6['field']+'\x20'+parseOperator(_0x1ca9b6['operator']);}if(_[_0x9604('0x17')]([_0x9604('0x21'),_0x9604('0x22')],_0x1ca9b6[_0x9604('0x14')]))_0x30d900['text']='('+_0x30d900[_0x9604('0x1e')]+_0x9604('0x23')+_0x24e17a+'.'+_0x1ca9b6[_0x9604('0x1f')]+_0x9604('0x24');_0x30d900[_0x9604('0x16')]=parseValue(_0x5d3fec,_0x1ca9b6[_0x9604('0x14')],_0x1ca9b6[_0x9604('0x16')]);return _0x30d900;};function parseOperator(_0x416096){var _0x28e338;switch(_0x416096){case _0x9604('0x25'):_0x28e338=_0x9604('0x26');break;case _0x9604('0x22'):_0x28e338=_0x9604('0x27');break;case _0x9604('0x13'):_0x28e338=_0x9604('0x28');break;case'$ne':_0x28e338=_0x9604('0x29');break;case _0x9604('0x2a'):case _0x9604('0x2b'):case _0x9604('0x2c'):_0x28e338=_0x9604('0x2d');break;case _0x9604('0x2e'):_0x28e338=_0x9604('0x2f');break;case _0x9604('0x18'):_0x28e338=_0x9604('0x30');break;case _0x9604('0x19'):_0x28e338=_0x9604('0x31');break;case'$gte':_0x28e338=_0x9604('0x32');break;case'$between':_0x28e338=_0x9604('0x33');break;}return _0x28e338;}function parseValue(_0x2f4fa6,_0x15410a,_0x387043){var _0x240546={'start':undefined,'end':undefined};switch(_0x15410a){case _0x9604('0x25'):case _0x9604('0x22'):_0x240546[_0x9604('0x34')]=_0x387043[_0x9604('0x9')](',');break;case _0x9604('0x2a'):_0x240546[_0x9604('0x34')]='%'+_0x387043+'%';break;case _0x9604('0x2b'):_0x240546[_0x9604('0x34')]=_0x387043+'%';break;case _0x9604('0x2c'):_0x240546[_0x9604('0x34')]='%'+_0x387043;break;case _0x9604('0x15'):var _0x24eb66=_0x387043[_0x9604('0x9')](',');var _0x387043=_0x24eb66[_0x9604('0xb')]();var _0x1af6e2=_0x24eb66[_0x9604('0x35')]();if(_0x2f4fa6===_0x9604('0x36')){_0x387043=moment(_0x387043)[_0x9604('0x37')](0x0,!![])[_0x9604('0x1c')]();_0x1af6e2=moment(_0x1af6e2)[_0x9604('0x37')](0x0,!![])['add'](0x17,'hours')[_0x9604('0x1a')](0x3b,_0x9604('0x38'))[_0x9604('0x1a')](0x3b,_0x9604('0x39'))[_0x9604('0x1c')]();}_0x240546={'start':_0x387043,'end':_0x1af6e2};break;default:_0x240546['start']=_0x387043;break;}return _0x240546;} \ No newline at end of file +var _0x05bc=['$between','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','filter','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','CAST(','field','\x20AS\x20','castTo','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte'];(function(_0x38a136,_0x174636){var _0x1a0f58=function(_0x552c20){while(--_0x552c20){_0x38a136['push'](_0x38a136['shift']());}};_0x1a0f58(++_0x174636);}(_0x05bc,0xb2));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc05b('0x0'));var moment=require(_0xc05b('0x1'));exports[_0xc05b('0x2')]=function(_0x3f5827){var _0x3aa02e={'conditions':[]};_0x3aa02e[_0xc05b('0x3')]=_[_0xc05b('0x4')](_0x3f5827,_0xc05b('0x5'))?'or':_0xc05b('0x6');var _0x5a616e=_0x3f5827[_0xc05b('0x7')](_0xc05b('0x8'),'')[_0xc05b('0x7')](_0xc05b('0x5'),'')[_0xc05b('0x9')]('||');for(var _0x3fafcd=0x0;_0x3fafcd<_0x5a616e[_0xc05b('0xa')];_0x3fafcd++){var _0x57a303=_0x5a616e[_0x3fafcd][_0xc05b('0x9')](':=');var _0x185d68=_0x57a303[0x0];var _0x71282d=_0x57a303[_0xc05b('0xb')](0x1);_0x71282d[_0xc05b('0xc')](function(_0x545864){var _0x1a17f0=_0x545864[_0xc05b('0x9')]('[')[_0xc05b('0xd')]();var _0x19f24b=_0x545864['match'](/\[(.*?)\]/g);_0x19f24b[_0xc05b('0xc')](function(_0xb97618){var _0x434906=_0xb97618[_0xc05b('0x9')]('[')[_0xc05b('0xe')](function(_0x3b2432){return _0x3b2432['indexOf'](']')>-0x1;})[_0xc05b('0xf')](function(_0x25fdad){return _0x25fdad[_0xc05b('0x9')](']')[0x0];})[0x0];_0x3aa02e[_0xc05b('0x10')][_0xc05b('0x11')]({'field':_0x185d68,'operator':_0x1a17f0,'value':_0x434906});});});}return _0x3aa02e;};exports[_0xc05b('0x12')]=function(_0x4fc77d,_0x4cc970,_0x34bd0c){var _0x398365={};if(_0x4cc970===_0xc05b('0x13')){if(_0x34bd0c[_0xc05b('0x14')]===_0xc05b('0x15')){_0x34bd0c[_0xc05b('0x14')]='$between';_0x34bd0c['value']+=','+_0x34bd0c[_0xc05b('0x16')];}else if(_[_0xc05b('0x17')]([_0xc05b('0x18'),_0xc05b('0x19')],_0x34bd0c[_0xc05b('0x14')])){_0x34bd0c[_0xc05b('0x16')]=moment(_0x34bd0c[_0xc05b('0x16')])[_0xc05b('0x1a')](0x1,_0xc05b('0x1b'))[_0xc05b('0x1c')](_0xc05b('0x1d'));}}if(_0x34bd0c['castTo']){_0x4cc970=_0x34bd0c['castTo'];_0x398365['text']=_0xc05b('0x1e')+_0x4fc77d+'.'+_0x34bd0c[_0xc05b('0x1f')]+_0xc05b('0x20')+_0x34bd0c[_0xc05b('0x21')]+')\x20'+parseOperator(_0x34bd0c[_0xc05b('0x14')]);}else{_0x398365[_0xc05b('0x22')]=_0x4fc77d+'.'+_0x34bd0c[_0xc05b('0x1f')]+'\x20'+parseOperator(_0x34bd0c[_0xc05b('0x14')]);}if(_[_0xc05b('0x17')]([_0xc05b('0x23'),_0xc05b('0x24')],_0x34bd0c[_0xc05b('0x14')]))_0x398365[_0xc05b('0x22')]='('+_0x398365[_0xc05b('0x22')]+_0xc05b('0x25')+_0x4fc77d+'.'+_0x34bd0c[_0xc05b('0x1f')]+_0xc05b('0x26');_0x398365[_0xc05b('0x16')]=parseValue(_0x4cc970,_0x34bd0c[_0xc05b('0x14')],_0x34bd0c[_0xc05b('0x16')]);return _0x398365;};function parseOperator(_0x467a9d){var _0x50fa12;switch(_0x467a9d){case _0xc05b('0x27'):_0x50fa12='IN\x20?';break;case _0xc05b('0x24'):_0x50fa12=_0xc05b('0x28');break;case _0xc05b('0x15'):_0x50fa12=_0xc05b('0x29');break;case'$ne':_0x50fa12='<>\x20?';break;case _0xc05b('0x2a'):case _0xc05b('0x2b'):case _0xc05b('0x2c'):_0x50fa12='LIKE\x20?';break;case _0xc05b('0x2d'):_0x50fa12=_0xc05b('0x2e');break;case _0xc05b('0x18'):_0x50fa12=_0xc05b('0x2f');break;case _0xc05b('0x19'):_0x50fa12=_0xc05b('0x30');break;case _0xc05b('0x31'):_0x50fa12='>=\x20?';break;case _0xc05b('0x32'):_0x50fa12=_0xc05b('0x33');break;}return _0x50fa12;}function parseValue(_0x1b6d58,_0x50ca02,_0x35a385){var _0x3acd2c={'start':undefined,'end':undefined};switch(_0x50ca02){case _0xc05b('0x27'):case _0xc05b('0x24'):_0x3acd2c['start']=_0x35a385[_0xc05b('0x9')](',');break;case _0xc05b('0x2a'):_0x3acd2c[_0xc05b('0x34')]='%'+_0x35a385+'%';break;case _0xc05b('0x2b'):_0x3acd2c[_0xc05b('0x34')]=_0x35a385+'%';break;case _0xc05b('0x2c'):_0x3acd2c[_0xc05b('0x34')]='%'+_0x35a385;break;case _0xc05b('0x32'):var _0x4198e3=_0x35a385[_0xc05b('0x9')](',');var _0x35a385=_0x4198e3['shift']();var _0x391df0=_0x4198e3[_0xc05b('0x35')]();if(_0x1b6d58===_0xc05b('0x13')){_0x35a385=moment(_0x35a385)[_0xc05b('0x36')](0x0,!![])[_0xc05b('0x1c')]();_0x391df0=moment(_0x391df0)[_0xc05b('0x36')](0x0,!![])[_0xc05b('0x1a')](0x17,'hours')['add'](0x3b,_0xc05b('0x37'))['add'](0x3b,_0xc05b('0x38'))[_0xc05b('0x1c')]();}_0x3acd2c={'start':_0x35a385,'end':_0x391df0};break;default:_0x3acd2c['start']=_0x35a385;break;}return _0x3acd2c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 27814c1..7a5d50b 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 _0x7da7=['attributes','length','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','limit','offset','sort','map','indexOf','priority','cast','unsigned','DESC','col','ASC','isEmpty','isArray','omit','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters'];(function(_0x4ba015,_0x1cd065){var _0x2f31ad=function(_0x1f1510){while(--_0x1f1510){_0x4ba015['push'](_0x4ba015['shift']());}};_0x2f31ad(++_0x1cd065);}(_0x7da7,0x10d));var _0x77da=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x7da7[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x77da('0x0'));var sequelize=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x571213){var _0x59892b=['ne'];try{var _0x37667b=JSON[_0x77da('0x3')](_0x571213);var _0x4f60c3=Object[_0x77da('0x4')](_0x37667b)[0x0];return _0x59892b[_0x77da('0x5')](_0x4f60c3);}catch(_0x56458c){return![];}}function getOperatorValue(_0x19331c){var _0xc54a12=JSON['parse'](_0x19331c);var _0x30afe0=Object['keys'](_0xc54a12)[0x0];var _0x1191de=_0xc54a12[_0x30afe0];return{['$'+_0x30afe0]:_0x1191de};}exports[_0x77da('0x6')]=function(_0x37c5ab){var _0x910e5b=null;if(_0x37c5ab){_0x910e5b=_0x37c5ab[_0x77da('0x7')](',');}return _0x910e5b;};exports['filters']=function(_0x40c86e,_0xb55827){var _0x172d7f={};if(!_['isEmpty'](_0x40c86e)){_[_0x77da('0x8')](_0x40c86e,function(_0x1ab717,_0x163350){try{if(_0xb55827){var _0x2a675a=_['find'](_0xb55827,{'name':_0x163350})||{};if(hasSequelizeOperator(_0x1ab717)){_0x172d7f[_0x163350]=getOperatorValue(_0x1ab717);}else if(_0x2a675a[_0x77da('0x9')]===_0x77da('0xa')&&_[_0x77da('0xb')](_0x1ab717)){var _0x5d6e2f=JSON['parse'](_0x1ab717);var _0x26e3ff={'$gte':moment(moment(_0x5d6e2f[_0x77da('0xc')])['format'](_0x77da('0xd')))[_0x77da('0xe')]()[_0x77da('0xf')](),'$lte':moment(moment(_0x5d6e2f[_0x77da('0x10')])['format'](_0x77da('0xd')))['utc']()[_0x77da('0x11')](0x1,'s')[_0x77da('0xf')]()};_0x172d7f[_0x163350]=_0x26e3ff;}else if(_0x2a675a[_0x77da('0x12')]===_0x77da('0x13')){_0x172d7f[_0x163350]=_0x1ab717;}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}catch(_0x103e46){_0x172d7f[_0x163350]=_0x1ab717[_0x77da('0x7')](',');}});}return _0x172d7f;};exports[_0x77da('0x14')]=function(_0x335dcb){_0x335dcb=parseInt(_0x335dcb,0xa);if(!_0x335dcb||_0x335dcb<0x0){_0x335dcb=LIMIT_VALUE;}return _0x335dcb;};exports[_0x77da('0x15')]=function(_0x12d2b1){_0x12d2b1=parseInt(_0x12d2b1,0xa);if(!_0x12d2b1||_0x12d2b1<0x0){_0x12d2b1=0x0;}return _0x12d2b1;};exports[_0x77da('0x16')]=function(_0x3b6dde){var _0x544104,_0x492063=null;if(_0x3b6dde){_0x544104=_0x3b6dde[_0x77da('0x7')](',');_0x492063=_[_0x77da('0x17')](_0x544104,function(_0x507979){if(_0x507979[_0x77da('0x18')]('-')===0x0){return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize['col']('priority'),_0x77da('0x1b')):_0x507979['substr'](0x1),_0x77da('0x1c')];}else{return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize[_0x77da('0x1d')](_0x77da('0x19')),_0x77da('0x1b')):_0x507979,_0x77da('0x1e')];}});}return _0x492063;};exports['omit']=function(_0x4885ec,_0xfd160){if(_[_0x77da('0x1f')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x20')](_0x4885ec)){for(var _0xbd06b7=0x0;_0xbd06b7<_0x4885ec['length'];_0xbd06b7+=0x1){_0x4885ec[_0xbd06b7]=this[_0x77da('0x21')](_0x4885ec[_0xbd06b7],_0xfd160);}return _0x4885ec;}if(!_[_0x77da('0x22')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x23')](_0xfd160)){_0xfd160=[_0xfd160];}if(!_[_0x77da('0x20')](_0xfd160)){return _0x4885ec;}for(var _0x446ae7=0x0;_0x446ae7<_0xfd160['length'];_0x446ae7+=0x1){_[_0x77da('0x24')](_0x4885ec,_0xfd160[_0x446ae7]);}for(var _0x3e090d in _0x4885ec){if(_0x4885ec[_0x77da('0x25')](_0x3e090d)){_0x4885ec[_0x3e090d]=this[_0x77da('0x21')](_0x4885ec[_0x3e090d],_0xfd160);}}return _0x4885ec;};exports['isNumeric']=function(_0x5b4638){return _0x5b4638['match'](RegExp(_0x77da('0x26')))?!![]:![];};exports[_0x77da('0x27')]=function(_0x410d09){return _0x410d09[_0x77da('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x77da('0x29')]=function(_0x4eeb99){var _0x350b4e=[];_0x4eeb99[_0x77da('0x7')](/[ ,]+/)[_0x77da('0x2a')](function(_0x1d381b){_0x1d381b=_0x1d381b[_0x77da('0x2b')](/([^:]")"+/g,'$1');_0x1d381b='+'+_0x1d381b+'*';var _0x46e6b4=/[ `!@#$%^&*()_\-?~]/;if(_0x1d381b['match'](_0x46e6b4))_0x1d381b='\x22'+_0x1d381b+'\x22';_0x350b4e[_0x77da('0x2c')](_0x1d381b);});return _0x350b4e[_0x77da('0x2d')]('\x20');};exports[_0x77da('0x2e')]=function(_0x38643a,_0x3c3c64,_0x12ea16){var _0x3343b4={},_0x2c790d={};if(_0x3c3c64['query']['$id']){_0x3c3c64[_0x77da('0x2f')]['id']=_0x3c3c64[_0x77da('0x2f')]['$id'];delete _0x3c3c64[_0x77da('0x2f')][_0x77da('0x30')];}_0x3343b4[_0x77da('0x31')]=_[_0x77da('0x17')](_0x38643a,_0x77da('0x12'));_0x3343b4[_0x77da('0x2f')]=_[_0x77da('0x4')](_0x3c3c64['query']);_0x3343b4[_0x77da('0x32')]=_['intersection'](_0x3343b4['model'],_0x3343b4['query']);_0x2c790d[_0x77da('0x33')]=_['intersection'](_0x3343b4[_0x77da('0x31')],this[_0x77da('0x6')](_0x3c3c64[_0x77da('0x2f')][_0x77da('0x6')]));_0x2c790d[_0x77da('0x33')]=_0x2c790d[_0x77da('0x33')][_0x77da('0x34')]?_0x2c790d['attributes']:_0x3343b4[_0x77da('0x31')];if(!_0x3c3c64[_0x77da('0x2f')][_0x77da('0x25')](_0x77da('0x35'))){_0x2c790d[_0x77da('0x14')]=this[_0x77da('0x14')](_0x3c3c64['query'][_0x77da('0x14')]);_0x2c790d[_0x77da('0x15')]=this[_0x77da('0x15')](_0x3c3c64['query'][_0x77da('0x15')]);}_0x2c790d['order']=this['sort'](_0x3c3c64['query']['sort']);_0x2c790d[_0x77da('0x36')]=this[_0x77da('0x32')](_[_0x77da('0x37')](_0x3c3c64['query'],_0x3343b4[_0x77da('0x32')]),_0x38643a);if(_0x3c3c64['query'][_0x77da('0x38')]){var _0x517bd0=_0x38643a;var _0x3c216f=_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')];if(typeof _0x3c216f===_0x77da('0x39')){_0x517bd0=_[_0x77da('0x38')](_0x38643a,function(_0x5ecf12){return _[_0x77da('0x5')](_0x3c216f[_0x77da('0x3a')],_0x5ecf12[_0x77da('0x12')]);});_0x3c216f=_0x3c216f[_0x77da('0x3b')];}_0x2c790d[_0x77da('0x36')]=_[_0x77da('0x3c')](_0x2c790d['where'],{'$or':_[_0x77da('0x17')](_0x517bd0,function(_0x2f0495){if(_0x2f0495[_0x77da('0x9')]!==_0x77da('0x3d')){if(_0x12ea16){return sequelize[_0x77da('0x36')](sequelize['fn'](_0x77da('0x3e'),sequelize['col'](_0x2f0495[_0x77da('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%')});}else{var _0x40a492={};_0x40a492[_0x2f0495['name']]={'$like':'%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%'};return _0x40a492;}}})});}_0x2c790d=_[_0x77da('0x3c')]({},_0x2c790d,_0x3c3c64[_0x77da('0x3f')]);return _0x2c790d;}; \ No newline at end of file +var _0x277c=['DATE','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','isEmpty','length','omit','isObject','isString','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','forEach','replace','join','getOptions','$id','query','model','attributes','nolimit','pick','filter','object','columns','type','VIRTUAL','where','lower','merge','options','lodash','moment','parse','keys','includes','fields','split','filters','find'];(function(_0x298f8c,_0x21cf71){var _0x468f84=function(_0x30202a){while(--_0x30202a){_0x298f8c['push'](_0x298f8c['shift']());}};_0x468f84(++_0x21cf71);}(_0x277c,0x153));var _0xc277=function(_0x4005f4,_0x39c22e){_0x4005f4=_0x4005f4-0x0;var _0x1af721=_0x277c[_0x4005f4];return _0x1af721;};'use strict';var _=require(_0xc277('0x0'));var sequelize=require('sequelize');var moment=require(_0xc277('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3420cf){var _0x3cd265=['ne'];try{var _0x21d6f2=JSON[_0xc277('0x2')](_0x3420cf);var _0x1fcae3=Object[_0xc277('0x3')](_0x21d6f2)[0x0];return _0x3cd265[_0xc277('0x4')](_0x1fcae3);}catch(_0x4f78ab){return![];}}function getOperatorValue(_0x4bfaeb){var _0x1a6582=JSON['parse'](_0x4bfaeb);var _0x77e168=Object['keys'](_0x1a6582)[0x0];var _0x378158=_0x1a6582[_0x77e168];return{['$'+_0x77e168]:_0x378158};}exports[_0xc277('0x5')]=function(_0x55be1f){var _0x324ef7=null;if(_0x55be1f){_0x324ef7=_0x55be1f[_0xc277('0x6')](',');}return _0x324ef7;};exports[_0xc277('0x7')]=function(_0x1b1db0,_0x3f766f){var _0x1e4087={};if(!_['isEmpty'](_0x1b1db0)){_['forOwn'](_0x1b1db0,function(_0x30a5dc,_0x1632bb){try{if(_0x3f766f){var _0x2df373=_[_0xc277('0x8')](_0x3f766f,{'name':_0x1632bb})||{};if(hasSequelizeOperator(_0x30a5dc)){_0x1e4087[_0x1632bb]=getOperatorValue(_0x30a5dc);}else if(_0x2df373['type']===_0xc277('0x9')&&_['isPlainObject'](_0x30a5dc)){var _0xb6b933=JSON[_0xc277('0x2')](_0x30a5dc);var _0x1850eb={'$gte':moment(moment(_0xb6b933[_0xc277('0xa')])['format'](_0xc277('0xb')))[_0xc277('0xc')]()[_0xc277('0xd')](),'$lte':moment(moment(_0xb6b933['$lte'])['format'](_0xc277('0xb')))['utc']()[_0xc277('0xe')](0x1,'s')['format']()};_0x1e4087[_0x1632bb]=_0x1850eb;}else if(_0x2df373[_0xc277('0xf')]===_0xc277('0x10')){_0x1e4087[_0x1632bb]=_0x30a5dc;}else{_0x1e4087[_0x1632bb]=_[_0xc277('0x11')](_0x30a5dc)?_0x30a5dc:JSON['parse'](_0x30a5dc);}}else{_0x1e4087[_0x1632bb]=_['isArray'](_0x30a5dc)?_0x30a5dc:JSON[_0xc277('0x2')](_0x30a5dc);}}catch(_0x4d23a7){_0x1e4087[_0x1632bb]=_0x30a5dc['split'](',');}});}return _0x1e4087;};exports[_0xc277('0x12')]=function(_0xba31f6){_0xba31f6=parseInt(_0xba31f6,0xa);if(!_0xba31f6||_0xba31f6<0x0){_0xba31f6=LIMIT_VALUE;}return _0xba31f6;};exports[_0xc277('0x13')]=function(_0x176dfb){_0x176dfb=parseInt(_0x176dfb,0xa);if(!_0x176dfb||_0x176dfb<0x0){_0x176dfb=0x0;}return _0x176dfb;};exports[_0xc277('0x14')]=function(_0x355eee){var _0x391cc3,_0x4a7a79=null;if(_0x355eee){_0x391cc3=_0x355eee['split'](',');_0x4a7a79=_[_0xc277('0x15')](_0x391cc3,function(_0x28900e){if(_0x28900e[_0xc277('0x16')]('-')===0x0){return[_0x28900e===_0xc277('0x17')?sequelize[_0xc277('0x18')](sequelize[_0xc277('0x19')](_0xc277('0x17')),_0xc277('0x1a')):_0x28900e[_0xc277('0x1b')](0x1),_0xc277('0x1c')];}else{return[_0x28900e===_0xc277('0x17')?sequelize['cast'](sequelize[_0xc277('0x19')](_0xc277('0x17')),'unsigned'):_0x28900e,_0xc277('0x1d')];}});}return _0x4a7a79;};exports['omit']=function(_0x48124d,_0x3292ab){if(_[_0xc277('0x1e')](_0x48124d)){return _0x48124d;}if(_[_0xc277('0x11')](_0x48124d)){for(var _0x436784=0x0;_0x436784<_0x48124d[_0xc277('0x1f')];_0x436784+=0x1){_0x48124d[_0x436784]=this[_0xc277('0x20')](_0x48124d[_0x436784],_0x3292ab);}return _0x48124d;}if(!_[_0xc277('0x21')](_0x48124d)){return _0x48124d;}if(_[_0xc277('0x22')](_0x3292ab)){_0x3292ab=[_0x3292ab];}if(!_[_0xc277('0x11')](_0x3292ab)){return _0x48124d;}for(var _0x3e04cb=0x0;_0x3e04cb<_0x3292ab[_0xc277('0x1f')];_0x3e04cb+=0x1){_['unset'](_0x48124d,_0x3292ab[_0x3e04cb]);}for(var _0x5f3933 in _0x48124d){if(_0x48124d[_0xc277('0x23')](_0x5f3933)){_0x48124d[_0x5f3933]=this[_0xc277('0x20')](_0x48124d[_0x5f3933],_0x3292ab);}}return _0x48124d;};exports['isNumeric']=function(_0x4efc1e){return _0x4efc1e[_0xc277('0x24')](RegExp(_0xc277('0x25')))?!![]:![];};exports[_0xc277('0x26')]=function(_0x21c78c){return _0x21c78c[_0xc277('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x43757c){var _0x5edf7e=[];_0x43757c[_0xc277('0x6')](/[ ,]+/)[_0xc277('0x27')](function(_0x4348d9){_0x4348d9=_0x4348d9[_0xc277('0x28')](/([^:]")"+/g,'$1');_0x4348d9='+'+_0x4348d9+'*';var _0x5e9f22=/[ `!@#$%^&*()_\-?~]/;if(_0x4348d9[_0xc277('0x24')](_0x5e9f22))_0x4348d9='\x22'+_0x4348d9+'\x22';_0x5edf7e['push'](_0x4348d9);});return _0x5edf7e[_0xc277('0x29')]('\x20');};exports[_0xc277('0x2a')]=function(_0xbc1a66,_0x3591ab,_0x4f1603){var _0x278e56={},_0x3a7294={};if(_0x3591ab['query'][_0xc277('0x2b')]){_0x3591ab['query']['id']=_0x3591ab[_0xc277('0x2c')][_0xc277('0x2b')];delete _0x3591ab[_0xc277('0x2c')][_0xc277('0x2b')];}_0x278e56[_0xc277('0x2d')]=_[_0xc277('0x15')](_0xbc1a66,_0xc277('0xf'));_0x278e56[_0xc277('0x2c')]=_[_0xc277('0x3')](_0x3591ab[_0xc277('0x2c')]);_0x278e56[_0xc277('0x7')]=_['intersection'](_0x278e56[_0xc277('0x2d')],_0x278e56[_0xc277('0x2c')]);_0x3a7294[_0xc277('0x2e')]=_['intersection'](_0x278e56[_0xc277('0x2d')],this[_0xc277('0x5')](_0x3591ab[_0xc277('0x2c')][_0xc277('0x5')]));_0x3a7294[_0xc277('0x2e')]=_0x3a7294['attributes']['length']?_0x3a7294[_0xc277('0x2e')]:_0x278e56['model'];if(!_0x3591ab[_0xc277('0x2c')][_0xc277('0x23')](_0xc277('0x2f'))){_0x3a7294[_0xc277('0x12')]=this[_0xc277('0x12')](_0x3591ab[_0xc277('0x2c')][_0xc277('0x12')]);_0x3a7294[_0xc277('0x13')]=this[_0xc277('0x13')](_0x3591ab[_0xc277('0x2c')][_0xc277('0x13')]);}_0x3a7294['order']=this[_0xc277('0x14')](_0x3591ab[_0xc277('0x2c')][_0xc277('0x14')]);_0x3a7294['where']=this[_0xc277('0x7')](_[_0xc277('0x30')](_0x3591ab['query'],_0x278e56['filters']),_0xbc1a66);if(_0x3591ab[_0xc277('0x2c')][_0xc277('0x31')]){var _0x22c5b3=_0xbc1a66;var _0x1ca33a=_0x3591ab[_0xc277('0x2c')][_0xc277('0x31')];if(typeof _0x1ca33a===_0xc277('0x32')){_0x22c5b3=_['filter'](_0xbc1a66,function(_0x2561dd){return _[_0xc277('0x4')](_0x1ca33a[_0xc277('0x33')],_0x2561dd['name']);});_0x1ca33a=_0x1ca33a['value'];}_0x3a7294['where']=_['merge'](_0x3a7294['where'],{'$or':_[_0xc277('0x15')](_0x22c5b3,function(_0x4a26e3){if(_0x4a26e3[_0xc277('0x34')]!==_0xc277('0x35')){if(_0x4f1603){return sequelize[_0xc277('0x36')](sequelize['fn']('lower',sequelize[_0xc277('0x19')](_0x4a26e3[_0xc277('0xf')])),{'$like':sequelize['fn'](_0xc277('0x37'),'%'+_0x3591ab[_0xc277('0x2c')]['filter']+'%')});}else{var _0x284630={};_0x284630[_0x4a26e3[_0xc277('0xf')]]={'$like':'%'+_0x3591ab['query'][_0xc277('0x31')]+'%'};return _0x284630;}}})});}_0x3a7294=_[_0xc277('0x38')]({},_0x3a7294,_0x3591ab[_0xc277('0x39')]);return _0x3a7294;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 49db951..df826e2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x23840e,_0x2fb0cb){var _0x277300=function(_0x246e5a){while(--_0x246e5a){_0x23840e['push'](_0x23840e['shift']());}};_0x277300(++_0x2fb0cb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x3e23fd,_0x324cb8){var _0x23e70d=function(_0x34ce32){while(--_0x34ce32){_0x3e23fd['push'](_0x3e23fd['shift']());}};_0x23e70d(++_0x324cb8);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f71b039..defe87f 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 _0x0be2=['join','createHash','update','digest','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','family','internal','concat','head','address','127.0.0.1','cpus','model'];(function(_0x3d4a33,_0x260982){var _0x4ec13e=function(_0x225e6e){while(--_0x225e6e){_0x3d4a33['push'](_0x3d4a33['shift']());}};_0x4ec13e(++_0x260982);}(_0x0be2,0x125));var _0x20be=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x0be2[_0x20cc29];return _0x28d513;};'use strict';var _=require(_0x20be('0x0'));var os=require('os');var crypto=require(_0x20be('0x1'));var machine=require(_0x20be('0x2'));var exec=require('child_process')[_0x20be('0x3')];var config=require(_0x20be('0x4'));function getInterfaces(){var _0x7c3982=[];var _0x4677fd=os[_0x20be('0x5')]();var _0x27d2ae=_[_0x20be('0x6')](_[_0x20be('0x7')](_0x4677fd));for(var _0x1663cc=0x0;_0x1663cc<_0x27d2ae[_0x20be('0x8')];_0x1663cc++){var _0x2813f4=_0x4677fd[_0x27d2ae[_0x1663cc]]['filter'](function(_0x5ef7c0){return _0x5ef7c0[_0x20be('0x9')]==='IPv4'&&_0x5ef7c0[_0x20be('0xa')]===![];});_0x7c3982=_0x7c3982[_0x20be('0xb')](_0x2813f4);}return _0x7c3982;}function getFirstInterface(){var _0x13f179=_[_0x20be('0xc')](getInterfaces());return{'macAddress':_0x13f179&&_0x13f179['mac']?_0x13f179['mac']:'00:00:00:00:00:00','ipAddress':_0x13f179&&_0x13f179[_0x20be('0xd')]?_0x13f179[_0x20be('0xd')]:_0x20be('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5a6aa1=_[_0x20be('0x6')](os[_0x20be('0xf')]()['map'](function(_0x161ad2){return _0x161ad2[_0x20be('0x10')];}))[_0x20be('0x11')](':');return crypto[_0x20be('0x12')]('md5')[_0x20be('0x13')](_0x5a6aa1)[_0x20be('0x14')]('hex');}exports['getUuid']=function(){var _0x3fce97=os[_0x20be('0x15')]();var _0x404396=/[0-9a-f-]{36}/;if(config[_0x20be('0x16')]&&_0x404396[_0x20be('0x17')](config[_0x20be('0x16')])){return config[_0x20be('0x16')];}else if(_0x3fce97===_0x20be('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x20be('0x19')})[_0x20be('0x1a')]('\x0d\x0a','');}else{var _0x4548eb=getFirstInterface();var _0x3487fe=getCPUhash();var _0x367c1b=_0x3487fe+'|'+os[_0x20be('0x1b')]()+'|'+_0x4548eb['macAddress']+'|'+_0x4548eb[_0x20be('0x1c')];var _0x44cfc5=crypto[_0x20be('0x12')]('md5')['update'](_0x367c1b)['digest'](_0x20be('0x1d'));return _0x44cfc5[_0x20be('0x1e')](0x0,0x8)+'-'+_0x44cfc5[_0x20be('0x1e')](0x8,0xc)+'-'+_0x44cfc5['substring'](0xc,0x10)+'-'+_0x44cfc5['substring'](0x10,0x14)+'-'+_0x44cfc5[_0x20be('0x1e')](0x14);}}; \ No newline at end of file +var _0xb8cf=['orderBy','keys','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','model','createHash','md5','update','digest','getUuid','platform','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces'];(function(_0x3b6554,_0x52ce17){var _0x1e2195=function(_0x235639){while(--_0x235639){_0x3b6554['push'](_0x3b6554['shift']());}};_0x1e2195(++_0x52ce17);}(_0xb8cf,0x1d6));var _0xfb8c=function(_0x83b7b9,_0x554605){_0x83b7b9=_0x83b7b9-0x0;var _0x5057a2=_0xb8cf[_0x83b7b9];return _0x5057a2;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xfb8c('0x0'));var machine=require(_0xfb8c('0x1'));var exec=require(_0xfb8c('0x2'))[_0xfb8c('0x3')];var config=require(_0xfb8c('0x4'));function getInterfaces(){var _0x22ee13=[];var _0x8cc0d5=os[_0xfb8c('0x5')]();var _0x2d7831=_[_0xfb8c('0x6')](_[_0xfb8c('0x7')](_0x8cc0d5));for(var _0x565da3=0x0;_0x565da3<_0x2d7831['length'];_0x565da3++){var _0x5bd3d5=_0x8cc0d5[_0x2d7831[_0x565da3]]['filter'](function(_0x39265a){return _0x39265a[_0xfb8c('0x8')]===_0xfb8c('0x9')&&_0x39265a['internal']===![];});_0x22ee13=_0x22ee13[_0xfb8c('0xa')](_0x5bd3d5);}return _0x22ee13;}function getFirstInterface(){var _0x15a108=_[_0xfb8c('0xb')](getInterfaces());return{'macAddress':_0x15a108&&_0x15a108[_0xfb8c('0xc')]?_0x15a108[_0xfb8c('0xc')]:_0xfb8c('0xd'),'ipAddress':_0x15a108&&_0x15a108[_0xfb8c('0xe')]?_0x15a108['address']:_0xfb8c('0xf')};}exports[_0xfb8c('0x10')]=getFirstInterface;function getCPUhash(){var _0x3920e0=_[_0xfb8c('0x6')](os['cpus']()['map'](function(_0x4cfada){return _0x4cfada[_0xfb8c('0x11')];}))['join'](':');return crypto[_0xfb8c('0x12')](_0xfb8c('0x13'))[_0xfb8c('0x14')](_0x3920e0)[_0xfb8c('0x15')]('hex');}exports[_0xfb8c('0x16')]=function(){var _0x1878f3=os[_0xfb8c('0x17')]();var _0xc9131b=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0xc9131b[_0xfb8c('0x18')](config['licenseToken'])){return config['licenseToken'];}else if(_0x1878f3===_0xfb8c('0x19')){return exec(_0xfb8c('0x1a'),{'encoding':_0xfb8c('0x1b')})[_0xfb8c('0x1c')]('\x0d\x0a','');}else{var _0x576f7e=getFirstInterface();var _0x11d24d=getCPUhash();var _0x5f487b=_0x11d24d+'|'+os[_0xfb8c('0x1d')]()+'|'+_0x576f7e[_0xfb8c('0x1e')]+'|'+_0x576f7e[_0xfb8c('0x1f')];var _0x462f8b=crypto['createHash']('md5')['update'](_0x5f487b)[_0xfb8c('0x15')](_0xfb8c('0x20'));return _0x462f8b[_0xfb8c('0x21')](0x0,0x8)+'-'+_0x462f8b[_0xfb8c('0x21')](0x8,0xc)+'-'+_0x462f8b[_0xfb8c('0x21')](0xc,0x10)+'-'+_0x462f8b[_0xfb8c('0x21')](0x10,0x14)+'-'+_0x462f8b[_0xfb8c('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 9d5090a..aaf789e 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 _0xa66f=['YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','message','finally','getUuid','License','findOrCreate','spread','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','format','%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data1','data2','then','active','license','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa66f,0xf9));var _0xfa66=function(_0x1664cb,_0x57a951){_0x1664cb=_0x1664cb-0x0;var _0x4edd61=_0xa66f[_0x1664cb];return _0x4edd61;};'use strict';var util=require(_0xfa66('0x0'));var moment=require('moment');var rp=require(_0xfa66('0x1'));var BPromise=require(_0xfa66('0x2'));var pkginfo=require(_0xfa66('0x3'))(module,_0xfa66('0x4'));var db=require(_0xfa66('0x5'))['db'];var encryptor=require(_0xfa66('0x6'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46461d){return new BPromise(function(_0x395117,_0x18f628){var _0x208773=util[_0xfa66('0x7')](_0xfa66('0x8'),HOST,_0x46461d,module[_0xfa66('0x9')]['version']);if(oldToken){_0x208773=util[_0xfa66('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x46461d,module['exports']['version'],oldToken);}var _0x14d51d={'uri':_0x208773,'method':_0xfa66('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x14d51d)['then'](function(_0x23c2b6){_0x395117(_0x23c2b6);})[_0xfa66('0xb')](function(_0x475633){_0x18f628(_0x475633);});});}function manageLicense(_0x3a5e8a,_0x14b37f){var _0xf89884=_0x14b37f[_0xfa66('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0xf89884[_0xfa66('0xd')]!==_0x3a5e8a&&!_0xf89884[_0xfa66('0xe')]){oldToken=_0xf89884[_0xfa66('0xd')];}httpRequest(_0x3a5e8a)[_0xfa66('0xf')](function(_0x1f4731){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1f4731[_0xfa66('0x10')]){isOldTokenSent=![];if(!_0xf89884[_0xfa66('0x11')]&&_0xf89884[_0xfa66('0x11')]!=_0x1f4731[_0xfa66('0x11')]||_0xf89884[_0xfa66('0x11')]&&_0xf89884['data2']){logger[_0xfa66('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xf89884[_0xfa66('0x11')]&&!_0xf89884[_0xfa66('0xe')]&&_0xf89884[_0xfa66('0x11')]!=_0x1f4731[_0xfa66('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xf89884[_0xfa66('0x11')]&&!_0xf89884[_0xfa66('0xe')]&&_0xf89884[_0xfa66('0x11')]==_0x1f4731[_0xfa66('0x11')]){return _0x14b37f;}return _0x14b37f[_0xfa66('0x13')]({'data1':_0x3a5e8a,'data2':null,'license':_0x1f4731[_0xfa66('0x11')]});}else{if(_0x1f4731[_0xfa66('0x11')]||_0xf89884['license']){if(!_0xf89884[_0xfa66('0xe')]){if(_0xf89884[_0xfa66('0xd')]==_0x3a5e8a){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xfa66('0x14'));}else{GRAY_PERIOD_REASON=_0xfa66('0x15');logger[_0xfa66('0x12')](_0xfa66('0x16'),_0xf89884[_0xfa66('0xd')],_0x3a5e8a);}logger[_0xfa66('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xfa66('0x17')));return _0x14b37f[_0xfa66('0x13')]({'data2':encryptor[_0xfa66('0x18')](moment()[_0xfa66('0x7')](_0xfa66('0x17')))});}else{if(moment()[_0xfa66('0x19')](encryptor[_0xfa66('0x1a')](_0xf89884[_0xfa66('0xe')]),_0xfa66('0x1b'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xfa66('0x7')](_0xfa66('0x17')));isOldTokenSent=![];return _0x14b37f[_0xfa66('0x13')]({'data1':_0x3a5e8a,'data2':null,'license':null});}}}else{if(_0xf89884[_0xfa66('0xd')]!=_0x3a5e8a){logger[_0xfa66('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xf89884[_0xfa66('0xd')],_0x3a5e8a);return _0x14b37f['update']({'data1':_0x3a5e8a,'data2':null,'license':null});}}}return _0x14b37f;})[_0xfa66('0xf')](function(_0x46335a){_0x14b37f=_0x46335a;})[_0xfa66('0xb')](function(_0x42ad6e){logger['error'](_0x42ad6e[_0xfa66('0x1c')]);})[_0xfa66('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xfa66('0x1e')](),_0x14b37f);},TIME);});}function defaultLicense(){var _0x55ce73=hardware[_0xfa66('0x1e')]();if(_0x55ce73){return db[_0xfa66('0x1f')][_0xfa66('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x55ce73}})[_0xfa66('0x21')](function(_0x4a97d9,_0x315dc7){logger[_0xfa66('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x55ce73);manageLicense(_0x55ce73,_0x4a97d9);})[_0xfa66('0xb')](function(_0x2effa1){logger['error'](_0x2effa1['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x0557=['encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','spread','error','default','util','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm'];(function(_0x1fe69b,_0x245bf7){var _0x1a4ba8=function(_0x49968b){while(--_0x49968b){_0x1fe69b['push'](_0x1fe69b['shift']());}};_0x1a4ba8(++_0x245bf7);}(_0x0557,0xaa));var _0x7055=function(_0x4c23bb,_0x1d491c){_0x4c23bb=_0x4c23bb-0x0;var _0x32949e=_0x0557[_0x4c23bb];return _0x32949e;};'use strict';var util=require(_0x7055('0x0'));var moment=require('moment');var rp=require(_0x7055('0x1'));var BPromise=require(_0x7055('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x7055('0x3'))['db'];var encryptor=require(_0x7055('0x4'));var hardware=require(_0x7055('0x5'));var logger=require(_0x7055('0x6'))(_0x7055('0x7'));var HOST=_0x7055('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x307748){return new BPromise(function(_0x984d8f,_0x2c35cd){var _0x41fc15=util[_0x7055('0x9')](_0x7055('0xa'),HOST,_0x307748,module['exports'][_0x7055('0xb')]);if(oldToken){_0x41fc15=util[_0x7055('0x9')](_0x7055('0xc'),HOST,_0x307748,module[_0x7055('0xd')][_0x7055('0xb')],oldToken);}var _0x233a8e={'uri':_0x41fc15,'method':_0x7055('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x233a8e)[_0x7055('0xf')](function(_0x1e4c36){_0x984d8f(_0x1e4c36);})[_0x7055('0x10')](function(_0x2e9050){_0x2c35cd(_0x2e9050);});});}function manageLicense(_0xa2bc24,_0x244f01){var _0x23ca92=_0x244f01[_0x7055('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x23ca92['data1']!==_0xa2bc24&&!_0x23ca92[_0x7055('0x12')]){oldToken=_0x23ca92[_0x7055('0x13')];}httpRequest(_0xa2bc24)[_0x7055('0xf')](function(_0x1d1ad8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1d1ad8[_0x7055('0x14')]){isOldTokenSent=![];if(!_0x23ca92['license']&&_0x23ca92[_0x7055('0x7')]!=_0x1d1ad8[_0x7055('0x7')]||_0x23ca92[_0x7055('0x7')]&&_0x23ca92[_0x7055('0x12')]){logger[_0x7055('0x15')](_0x7055('0x16'));}if(_0x23ca92[_0x7055('0x7')]&&!_0x23ca92['data2']&&_0x23ca92['license']!=_0x1d1ad8[_0x7055('0x7')]){logger[_0x7055('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x23ca92['license']&&!_0x23ca92[_0x7055('0x12')]&&_0x23ca92[_0x7055('0x7')]==_0x1d1ad8[_0x7055('0x7')]){return _0x244f01;}return _0x244f01[_0x7055('0x17')]({'data1':_0xa2bc24,'data2':null,'license':_0x1d1ad8['license']});}else{if(_0x1d1ad8[_0x7055('0x7')]||_0x23ca92[_0x7055('0x7')]){if(!_0x23ca92[_0x7055('0x12')]){if(_0x23ca92[_0x7055('0x13')]==_0xa2bc24){GRAY_PERIOD_REASON=_0x7055('0x18');logger[_0x7055('0x15')](_0x7055('0x19'));}else{GRAY_PERIOD_REASON=_0x7055('0x1a');logger[_0x7055('0x15')](_0x7055('0x1b'),_0x23ca92[_0x7055('0x13')],_0xa2bc24);}logger['info'](_0x7055('0x1c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x7055('0x1d')));return _0x244f01[_0x7055('0x17')]({'data2':encryptor[_0x7055('0x1e')](moment()[_0x7055('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x7055('0x1f')](_0x23ca92['data2']),_0x7055('0x20'))>DAYS){logger[_0x7055('0x15')](_0x7055('0x21'),moment()[_0x7055('0x9')](_0x7055('0x1d')));isOldTokenSent=![];return _0x244f01['update']({'data1':_0xa2bc24,'data2':null,'license':null});}}}else{if(_0x23ca92[_0x7055('0x13')]!=_0xa2bc24){logger['info'](_0x7055('0x1b'),_0x23ca92[_0x7055('0x13')],_0xa2bc24);return _0x244f01[_0x7055('0x17')]({'data1':_0xa2bc24,'data2':null,'license':null});}}}return _0x244f01;})[_0x7055('0xf')](function(_0x41e454){_0x244f01=_0x41e454;})['catch'](function(_0x2b05d6){logger['error'](_0x2b05d6[_0x7055('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x7055('0x23')](),_0x244f01);},TIME);});}function defaultLicense(){var _0x28af78=hardware['getUuid']();if(_0x28af78){return db[_0x7055('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x28af78}})[_0x7055('0x25')](function(_0x487dcd,_0x5c3d04){logger[_0x7055('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x28af78);manageLicense(_0x28af78,_0x487dcd);})[_0x7055('0x10')](function(_0x252373){logger[_0x7055('0x26')](_0x252373[_0x7055('0x22')]);});}}exports[_0x7055('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 72e2e49..4327029 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 _0x8b1a=['then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','uuid','machineUuid','gray','deadline','add','days','changed','disabled','message','User','sequelize','COUNT','col','role','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults'];(function(_0x5087b7,_0x117485){var _0x3b4c2b=function(_0x3d25db){while(--_0x3d25db){_0x5087b7['push'](_0x5087b7['shift']());}};_0x3b4c2b(++_0x117485);}(_0x8b1a,0x131));var _0xa8b1=function(_0x189aa6,_0x1ac764){_0x189aa6=_0x189aa6-0x0;var _0x4810a6=_0x8b1a[_0x189aa6];return _0x4810a6;};'use strict';var util=require(_0xa8b1('0x0'));var _=require(_0xa8b1('0x1'));var moment=require('moment');var BPromise=require(_0xa8b1('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xa8b1('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa8b1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa8b1('0x5'),'machineUuid':hardware[_0xa8b1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa8b1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa8b1('0x7'),'machineUuid':hardware[_0xa8b1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3e8775){return new BPromise(function(_0x5e3759,_0x29c720){return db['License'][_0xa8b1('0x8')](_[_0xa8b1('0x9')](_0x3e8775,{'raw':!![],'where':{'id':0x1}}))[_0xa8b1('0xa')](function(_0x57f1b2){return checkLicense(_0x57f1b2,null);})[_0xa8b1('0xa')](function(_0x599339){_0x5e3759(_0x599339);return;})[_0xa8b1('0xb')](function(_0x5b6c45){_0x29c720(_0x5b6c45);});});}function checkLicense(_0x586bd2,_0x591931){if(!_0x586bd2){demoLicense['uuid']=_0x586bd2[_0xa8b1('0xc')];return demoLicense;}try{var _0xdc36c1=_0x591931||_0x586bd2[_0xa8b1('0xd')];if(_[_0xa8b1('0xe')](_0xdc36c1)){throw new Error(_0xa8b1('0xf'));}var _0x209691=_0x586bd2['data1'];var _0x4a5694=_0x586bd2[_0xa8b1('0x10')];var _0x591be2=_0x209691[_0xa8b1('0x11')]('-')[0x4];var _0x147e50=_0x209691['split']('-')[0x0];var _0x36fcef=encryptor[_0xa8b1('0x12')](_0xdc36c1,util[_0xa8b1('0x13')]('%s:%s:%s',_0x591be2,_0x209691,_0x147e50));var _0x265b45=JSON[_0xa8b1('0x14')](_0x36fcef);_0x265b45['demo']=![];_0x265b45[_0xa8b1('0x15')]=_0x209691;_0x265b45[_0xa8b1('0x16')]=hardware['getUuid']();if(_0x4a5694){var _0x89c42c=encryptor['decryptString'](_0x4a5694);_0x265b45[_0xa8b1('0x17')]=_0x89c42c;_0x265b45[_0xa8b1('0x18')]=moment(_0x89c42c)[_0xa8b1('0x19')](0x7,_0xa8b1('0x1a'))[_0xa8b1('0x13')]();_0x265b45['grayReason']=_0x265b45[_0xa8b1('0x15')]!=_0x265b45[_0xa8b1('0x16')]?_0xa8b1('0x1b'):_0xa8b1('0x1c');}return _0x265b45;}catch(_0x5b67f1){breakingLicense[_0xa8b1('0x15')]=_0x586bd2[_0xa8b1('0xc')];breakingLicense['message']=_0x5b67f1[_0xa8b1('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x121a65,_0x3d79b8){getLicense()[_0xa8b1('0xa')](function(_0x74e933){return db[_0xa8b1('0x1e')]['findAll']({'attributes':['role',[db[_0xa8b1('0x1f')]['fn'](_0xa8b1('0x20'),db[_0xa8b1('0x1f')][_0xa8b1('0x21')](_0xa8b1('0x22'))),'count']],'group':_0xa8b1('0x22'),'where':{'role':{'$or':[_0xa8b1('0x23'),_0xa8b1('0x24'),_0xa8b1('0x25')]}},'raw':!![]})[_0xa8b1('0xa')](function(_0xd7e9be){var _0x5ed784={'user':_0x74e933[_0xa8b1('0x26')]||0x0,'telephone':_0x74e933[_0xa8b1('0x27')]||0x0};_0xd7e9be[_0xa8b1('0x28')](function(_0x54bcb4){var _0x138295=_0x54bcb4['role']==='admin'?'user':_0x54bcb4[_0xa8b1('0x22')];_0x5ed784[_0x138295]-=_0x54bcb4['count'];if(_0x5ed784[_0x138295]<0x0)_0x5ed784[_0x138295]=0x0;});_0x121a65(_0x5ed784);return;});})[_0xa8b1('0xb')](function(_0x138297){_0x3d79b8(_0x138297);});});}function checkUserLimits(_0x1a3c6c){return new BPromise(function(_0x52cf7c,_0x450141){getLimits()[_0xa8b1('0xa')](function(_0x54fafb){var _0x5302d1=_['pick'](_[_0xa8b1('0x29')](_0x1a3c6c,_0xa8b1('0x22')),['admin',_0xa8b1('0x24'),_0xa8b1('0x25')]);var _0x289143=(_0x5302d1['admin']||0x0)+(_0x5302d1[_0xa8b1('0x24')]||0x0);var _0x5b7226=_0x5302d1[_0xa8b1('0x25')]||0x0;if(_0x289143>_0x54fafb[_0xa8b1('0x24')])return _0x450141(_0xa8b1('0x2a'));if(_0x5b7226>_0x54fafb[_0xa8b1('0x25')])return _0x450141(_0xa8b1('0x2b'));return _0x52cf7c();})[_0xa8b1('0xb')](function(_0x266389){_0x450141(_0x266389);});});}module[_0xa8b1('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe589=['User','findAll','role','COUNT','sequelize','user','users','telephones','admin','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','uuid','data1','license','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','format','grayReason','changed','disabled','message'];(function(_0x37b4df,_0x36f349){var _0x4e6250=function(_0x2c9f23){while(--_0x2c9f23){_0x37b4df['push'](_0x37b4df['shift']());}};_0x4e6250(++_0x36f349);}(_0xe589,0x12b));var _0x9e58=function(_0x20298a,_0x7ad1e8){_0x20298a=_0x20298a-0x0;var _0x1ca713=_0xe589[_0x20298a];return _0x1ca713;};'use strict';var util=require(_0x9e58('0x0'));var _=require('lodash');var moment=require(_0x9e58('0x1'));var BPromise=require('bluebird');var hardware=require(_0x9e58('0x2'));var encryptor=require(_0x9e58('0x3'));var db=require(_0x9e58('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9e58('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9e58('0x6'),'machineUuid':hardware[_0x9e58('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9e58('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9e58('0x8'),'machineUuid':hardware[_0x9e58('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x324480){return new BPromise(function(_0x4fde16,_0x28c47a){return db[_0x9e58('0x9')]['find'](_[_0x9e58('0xa')](_0x324480,{'raw':!![],'where':{'id':0x1}}))[_0x9e58('0xb')](function(_0x61057b){return checkLicense(_0x61057b,null);})['then'](function(_0x5dd41c){_0x4fde16(_0x5dd41c);return;})['catch'](function(_0x7b4786){_0x28c47a(_0x7b4786);});});}function checkLicense(_0x14f046,_0x3c8ddf){if(!_0x14f046){demoLicense[_0x9e58('0xc')]=_0x14f046[_0x9e58('0xd')];return demoLicense;}try{var _0x163256=_0x3c8ddf||_0x14f046[_0x9e58('0xe')];if(_['isEmpty'](_0x163256)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3a5e94=_0x14f046['data1'];var _0x310295=_0x14f046['data2'];var _0x338628=_0x3a5e94[_0x9e58('0xf')]('-')[0x4];var _0xf62469=_0x3a5e94[_0x9e58('0xf')]('-')[0x0];var _0x501975=encryptor[_0x9e58('0x10')](_0x163256,util['format'](_0x9e58('0x11'),_0x338628,_0x3a5e94,_0xf62469));var _0x20c713=JSON[_0x9e58('0x12')](_0x501975);_0x20c713[_0x9e58('0x13')]=![];_0x20c713[_0x9e58('0xc')]=_0x3a5e94;_0x20c713[_0x9e58('0x14')]=hardware[_0x9e58('0x7')]();if(_0x310295){var _0x25934a=encryptor['decryptString'](_0x310295);_0x20c713[_0x9e58('0x15')]=_0x25934a;_0x20c713[_0x9e58('0x16')]=moment(_0x25934a)[_0x9e58('0x17')](0x7,_0x9e58('0x18'))[_0x9e58('0x19')]();_0x20c713[_0x9e58('0x1a')]=_0x20c713['uuid']!=_0x20c713[_0x9e58('0x14')]?_0x9e58('0x1b'):_0x9e58('0x1c');}return _0x20c713;}catch(_0x1ccc75){breakingLicense[_0x9e58('0xc')]=_0x14f046['data1'];breakingLicense[_0x9e58('0x1d')]=_0x1ccc75[_0x9e58('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5635bf,_0x3178cc){getLicense()[_0x9e58('0xb')](function(_0x1cc6f7){return db[_0x9e58('0x1e')][_0x9e58('0x1f')]({'attributes':[_0x9e58('0x20'),[db['sequelize']['fn'](_0x9e58('0x21'),db[_0x9e58('0x22')]['col'](_0x9e58('0x20'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0x9e58('0x23'),'telephone']}},'raw':!![]})[_0x9e58('0xb')](function(_0x3d1dd5){var _0x33e0e7={'user':_0x1cc6f7[_0x9e58('0x24')]||0x0,'telephone':_0x1cc6f7[_0x9e58('0x25')]||0x0};_0x3d1dd5['forEach'](function(_0x27011c){var _0x5618ec=_0x27011c[_0x9e58('0x20')]===_0x9e58('0x26')?_0x9e58('0x23'):_0x27011c[_0x9e58('0x20')];_0x33e0e7[_0x5618ec]-=_0x27011c[_0x9e58('0x27')];if(_0x33e0e7[_0x5618ec]<0x0)_0x33e0e7[_0x5618ec]=0x0;});_0x5635bf(_0x33e0e7);return;});})['catch'](function(_0x2e835d){_0x3178cc(_0x2e835d);});});}function checkUserLimits(_0x36b02c){return new BPromise(function(_0x5a18f0,_0xacaa7e){getLimits()['then'](function(_0x499036){var _0x2c2633=_[_0x9e58('0x28')](_[_0x9e58('0x29')](_0x36b02c,_0x9e58('0x20')),[_0x9e58('0x26'),_0x9e58('0x23'),_0x9e58('0x2a')]);var _0x2dce93=(_0x2c2633[_0x9e58('0x26')]||0x0)+(_0x2c2633['user']||0x0);var _0x13e3c0=_0x2c2633['telephone']||0x0;if(_0x2dce93>_0x499036[_0x9e58('0x23')])return _0xacaa7e(_0x9e58('0x2b'));if(_0x13e3c0>_0x499036[_0x9e58('0x2a')])return _0xacaa7e(_0x9e58('0x2c'));return _0x5a18f0();})[_0x9e58('0x2d')](function(_0x51dff9){_0xacaa7e(_0x51dff9);});});}module[_0x9e58('0x2e')]={'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 bde049e..d45b4f0 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 _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5aed5d,_0x26ee01){_0x5aed5d=_0x5aed5d-0x0;var _0x4f5949=_0xf7b4[_0x5aed5d];return _0x4f5949;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x2da6=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1d6e6e,_0x536992){var _0xa2795e=function(_0x2544fc){while(--_0x2544fc){_0x1d6e6e['push'](_0x1d6e6e['shift']());}};_0xa2795e(++_0x536992);}(_0x2da6,0x1dd));var _0x62da=function(_0x5896f4,_0x2546b4){_0x5896f4=_0x5896f4-0x0;var _0x3b4b60=_0x2da6[_0x5896f4];return _0x3b4b60;};'use strict';module[_0x62da('0x0')]={'DOMAIN':_0x62da('0x1'),'SESSION_SECRET':_0x62da('0x2'),'GOOGLE_ID':_0x62da('0x3'),'GOOGLE_SECRET':_0x62da('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cf4dcdc..4414a97 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0594=['fileLogger','exports','../utils/loggers'];(function(_0x2221df,_0x3c6cca){var _0x47da80=function(_0x5f2502){while(--_0x5f2502){_0x2221df['push'](_0x2221df['shift']());}};_0x47da80(++_0x3c6cca);}(_0x0594,0x107));var _0x4059=function(_0xea716a,_0x13fd90){_0xea716a=_0xea716a-0x0;var _0x3ce469=_0x0594[_0xea716a];return _0x3ce469;};'use strict';var fileLogger=require(_0x4059('0x0'))[_0x4059('0x1')];module[_0x4059('0x2')]=fileLogger; \ No newline at end of file +var _0xb4e0=['fileLogger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb4e0,0x97));var _0x0b4e=function(_0xf04b13,_0x3baf4e){_0xf04b13=_0xf04b13-0x0;var _0x179f6e=_0xb4e0[_0xf04b13];return _0x179f6e;};'use strict';var fileLogger=require('../utils/loggers')[_0x0b4e('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3d54f65..1674a87 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 _0xbd79=['../../services/routing/index.js','xdr','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email','routing'];(function(_0x4b7d9b,_0x52fe91){var _0x53711f=function(_0x45d05e){while(--_0x45d05e){_0x4b7d9b['push'](_0x4b7d9b['shift']());}};_0x53711f(++_0x52fe91);}(_0xbd79,0x197));var _0x9bd7=function(_0x9ead33,_0x330699){_0x9ead33=_0x9ead33-0x0;var _0x18eff0=_0xbd79[_0x9ead33];return _0x18eff0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x9bd7('0x0'))},{'name':_0x9bd7('0x1'),'script':path[_0x9bd7('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9bd7('0x3'),'script':path['join'](__dirname,_0x9bd7('0x4'))},{'name':_0x9bd7('0x5'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x9bd7('0x6'),'script':path[_0x9bd7('0x2')](__dirname,_0x9bd7('0x7'))},{'name':_0x9bd7('0x8'),'script':path[_0x9bd7('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x7ea4=['express','join','../../services/express/index.js','../../services/agi/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x4a9431,_0x14063f){var _0x2517cf=function(_0x30d274){while(--_0x30d274){_0x4a9431['push'](_0x4a9431['shift']());}};_0x2517cf(++_0x14063f);}(_0x7ea4,0x9f));var _0x47ea=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x7ea4[_0x1e4360];return _0x31e6b4;};'use strict';var path=require(_0x47ea('0x0'));var os=require('os');var config={'apps':[{'name':_0x47ea('0x1'),'script':path[_0x47ea('0x2')](__dirname,_0x47ea('0x3'))},{'name':'ami','script':path[_0x47ea('0x2')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x47ea('0x2')](__dirname,_0x47ea('0x4'))},{'name':'email','script':path[_0x47ea('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x47ea('0x5'),'script':path[_0x47ea('0x2')](__dirname,_0x47ea('0x6'))},{'name':_0x47ea('0x7'),'script':path[_0x47ea('0x2')](__dirname,_0x47ea('0x8'))}]};module[_0x47ea('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f153b1e..fd87e51 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 _0xa51d=['list','describe','delete','dump','saved','pm2','./config','connected','start','disconnect','stop','then','restart'];(function(_0x56fedd,_0x376499){var _0x426e8c=function(_0x446dcb){while(--_0x446dcb){_0x56fedd['push'](_0x56fedd['shift']());}};_0x426e8c(++_0x376499);}(_0xa51d,0x1a5));var _0xda51=function(_0x448422,_0x362248){_0x448422=_0x448422-0x0;var _0xcc0afd=_0xa51d[_0x448422];return _0xcc0afd;};'use strict';var pm2=require(_0xda51('0x0'));var BPromise=require('bluebird');var config=require(_0xda51('0x1'));function connect(){return new BPromise(function(_0x148fca,_0x3a67c9){return pm2['connect'](function(_0x2d538b){if(_0x2d538b){return _0x3a67c9(_0x2d538b);}return _0x148fca(_0xda51('0x2'));});});};exports[_0xda51('0x3')]=function(_0x4de16f){return connect()['then'](function(){return new BPromise(function(_0x52d2fd,_0x435d65){return pm2[_0xda51('0x3')](_0x4de16f,function(_0x54226b,_0x3c8166){if(_0x54226b){return _0x435d65(_0x54226b);}pm2[_0xda51('0x4')]();return _0x52d2fd(_0x3c8166);});});});};exports[_0xda51('0x5')]=function(_0xae9f7a){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x4b8067,_0x4ce51e){return pm2[_0xda51('0x5')](_0xae9f7a,function(_0x25d8ae,_0x26a2d9){if(_0x25d8ae){return _0x4ce51e(_0x25d8ae);}pm2[_0xda51('0x4')]();return _0x4b8067(_0x26a2d9);});});});};exports[_0xda51('0x7')]=function(_0x290cdb){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x502cf6,_0x2ba4c7){return pm2['restart'](_0x290cdb,function(_0x479400,_0x263d31){if(_0x479400){return _0x2ba4c7(_0x479400);}pm2[_0xda51('0x4')]();return _0x502cf6(_0x263d31);});});});};exports[_0xda51('0x8')]=function(){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x378d23,_0x58d4ec){return pm2[_0xda51('0x8')](function(_0x161d0b,_0x41d7bb){if(_0x161d0b){return _0x58d4ec(_0x161d0b);}pm2[_0xda51('0x4')]();return _0x378d23(_0x41d7bb);});});});};exports[_0xda51('0x9')]=function(_0x68b690){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x2a598b,_0xa93674){return pm2[_0xda51('0x9')](_0x68b690,function(_0x561595,_0x42d838){if(_0x561595){return _0xa93674(_0x561595);}pm2[_0xda51('0x4')]();return _0x2a598b(_0x42d838);});});});};exports['delete']=function(_0x5a3b13){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x36e0c4,_0x2f85f5){return pm2[_0xda51('0xa')](_0x5a3b13,function(_0x361fd0,_0x1cefb6){if(_0x361fd0){return _0x2f85f5(_0x361fd0);}pm2['disconnect']();return _0x36e0c4(_0x1cefb6);});});});};exports[_0xda51('0xb')]=function(){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x2b47cf,_0x59b221){return pm2[_0xda51('0xb')](function(_0x2764ff){if(_0x2764ff){return _0x59b221(_0x2764ff);}return _0x2b47cf(_0xda51('0xc'));});});});}; \ No newline at end of file +var _0xbfe4=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','list','describe','delete','dump','saved'];(function(_0x406618,_0xef5e1){var _0x58d993=function(_0x2c2d9b){while(--_0x2c2d9b){_0x406618['push'](_0x406618['shift']());}};_0x58d993(++_0xef5e1);}(_0xbfe4,0x1c0));var _0x4bfe=function(_0x45a12b,_0x5d7caa){_0x45a12b=_0x45a12b-0x0;var _0x33cb4c=_0xbfe4[_0x45a12b];return _0x33cb4c;};'use strict';var pm2=require(_0x4bfe('0x0'));var BPromise=require(_0x4bfe('0x1'));var config=require(_0x4bfe('0x2'));function connect(){return new BPromise(function(_0xb1ba7d,_0x45ba4e){return pm2[_0x4bfe('0x3')](function(_0x1b492c){if(_0x1b492c){return _0x45ba4e(_0x1b492c);}return _0xb1ba7d(_0x4bfe('0x4'));});});};exports[_0x4bfe('0x5')]=function(_0x2c7dc0){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x205842,_0x39a731){return pm2[_0x4bfe('0x5')](_0x2c7dc0,function(_0x39e373,_0x54cdb6){if(_0x39e373){return _0x39a731(_0x39e373);}pm2[_0x4bfe('0x7')]();return _0x205842(_0x54cdb6);});});});};exports[_0x4bfe('0x8')]=function(_0x439524){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x53cf39,_0x325230){return pm2[_0x4bfe('0x8')](_0x439524,function(_0x2222f7,_0x89645e){if(_0x2222f7){return _0x325230(_0x2222f7);}pm2[_0x4bfe('0x7')]();return _0x53cf39(_0x89645e);});});});};exports['restart']=function(_0x460276){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x3c5e59,_0x48e74f){return pm2['restart'](_0x460276,function(_0x528956,_0xa2813c){if(_0x528956){return _0x48e74f(_0x528956);}pm2[_0x4bfe('0x7')]();return _0x3c5e59(_0xa2813c);});});});};exports[_0x4bfe('0x9')]=function(){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x5dcff1,_0x22cd5e){return pm2[_0x4bfe('0x9')](function(_0x1f2aaf,_0x44932e){if(_0x1f2aaf){return _0x22cd5e(_0x1f2aaf);}pm2[_0x4bfe('0x7')]();return _0x5dcff1(_0x44932e);});});});};exports[_0x4bfe('0xa')]=function(_0x1a3e8c){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x167a7c,_0x345ae1){return pm2[_0x4bfe('0xa')](_0x1a3e8c,function(_0x49d890,_0x26f581){if(_0x49d890){return _0x345ae1(_0x49d890);}pm2['disconnect']();return _0x167a7c(_0x26f581);});});});};exports[_0x4bfe('0xb')]=function(_0x59d5dd){return connect()['then'](function(){return new BPromise(function(_0x5dc8df,_0x17c927){return pm2[_0x4bfe('0xb')](_0x59d5dd,function(_0x1cf464,_0xd35593){if(_0x1cf464){return _0x17c927(_0x1cf464);}pm2[_0x4bfe('0x7')]();return _0x5dc8df(_0xd35593);});});});};exports[_0x4bfe('0xc')]=function(){return connect()[_0x4bfe('0x6')](function(){return new BPromise(function(_0x307063,_0x250eeb){return pm2[_0x4bfe('0xc')](function(_0x332adb){if(_0x332adb){return _0x250eeb(_0x332adb);}return _0x307063(_0x4bfe('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 08abfd5..3fc2c9e 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 _0xb30a=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','map','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb30a,0xad));var _0xab30=function(_0x2246e0,_0x2403df){_0x2246e0=_0x2246e0-0x0;var _0x5325a3=_0xb30a[_0x2246e0];return _0x5325a3;};'use strict';var _=require(_0xab30('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xab30('0x1'));var config=require(_0xab30('0x2'));var db=require(_0xab30('0x3'))['db'];var logger=require(_0xab30('0x4'))(_0xab30('0x5'));config['redis']=_['defaults'](config[_0xab30('0x6')],{'host':_0xab30('0x7'),'port':0x18eb});var io=require(_0xab30('0x8'))(new Redis(config[_0xab30('0x6')]));function closeInteractions(){var _0x5273bd=0x0;var _0x555104=[];return db[_0xab30('0x9')]['find']({'raw':!![],'attributes':['id',_0xab30('0xa')],'where':{'id':0x1}})[_0xab30('0xb')](function(_0x30e109){_0x5273bd=_0x30e109['chatTimeout'];if(_0x5273bd){return db[_0xab30('0xc')][_0xab30('0xd')]({'raw':!![],'attributes':['id',_0xab30('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xab30('0xf')](_0x30e109['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x681ca1){if(_0x681ca1&&_0x681ca1['length']){_0x555104=_[_0xab30('0x10')](_0x681ca1||[],'id');logger['info'](_0xab30('0x11'),_0x555104[_0xab30('0x12')]());return db['ChatInteraction'][_0xab30('0x13')]({'closeReason':_0xab30('0x14'),'disposition':_0xab30('0x15'),'closed':!![],'closedAt':moment()[_0xab30('0x16')](_0xab30('0x17'))},{'where':{'id':_0x555104}});}})[_0xab30('0xb')](function(){if(_0x555104&&_0x555104[_0xab30('0x18')]){logger[_0xab30('0x19')](_0xab30('0x1a'),_0x555104[_0xab30('0x12')]());for(var _0x4ab4d9=0x0;_0x4ab4d9<_0x555104['length'];_0x4ab4d9++){io[_0xab30('0x1b')](_0xab30('0x1c'),{'id':_0x555104[_0x4ab4d9],'closed':!![]});}}})[_0xab30('0x1d')](function(_0x5171cb){logger[_0xab30('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5171cb?util[_0xab30('0x1f')](_0x5171cb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5a72=['chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','Setting','find','then'];(function(_0x52c52d,_0x209e15){var _0x1a9b68=function(_0x3eaa4b){while(--_0x3eaa4b){_0x52c52d['push'](_0x52c52d['shift']());}};_0x1a9b68(++_0x209e15);}(_0x5a72,0x103));var _0x25a7=function(_0x136269,_0x26c699){_0x136269=_0x136269-0x0;var _0x501dfe=_0x5a72[_0x136269];return _0x501dfe;};'use strict';var _=require(_0x25a7('0x0'));var moment=require(_0x25a7('0x1'));var Redis=require(_0x25a7('0x2'));var util=require(_0x25a7('0x3'));var config=require(_0x25a7('0x4'));var db=require(_0x25a7('0x5'))['db'];var logger=require('../logger')(_0x25a7('0x6'));config['redis']=_['defaults'](config[_0x25a7('0x7')],{'host':_0x25a7('0x8'),'port':0x18eb});var io=require(_0x25a7('0x9'))(new Redis(config[_0x25a7('0x7')]));function closeInteractions(){var _0x1ac2e7=0x0;var _0x3ca58a=[];return db[_0x25a7('0xa')][_0x25a7('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x25a7('0xc')](function(_0x5e54e6){_0x1ac2e7=_0x5e54e6[_0x25a7('0xd')];if(_0x1ac2e7){return db[_0x25a7('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x25a7('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x25a7('0x10')](_0x5e54e6['chatTimeout'],_0x25a7('0x11'))}}});}else{return[];}})[_0x25a7('0xc')](function(_0xed04d5){if(_0xed04d5&&_0xed04d5[_0x25a7('0x12')]){_0x3ca58a=_[_0x25a7('0x13')](_0xed04d5||[],'id');logger[_0x25a7('0x14')](_0x25a7('0x15'),_0x3ca58a['join']());return db[_0x25a7('0xe')][_0x25a7('0x16')]({'closeReason':_0x25a7('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x25a7('0x18')](_0x25a7('0x19'))},{'where':{'id':_0x3ca58a}});}})[_0x25a7('0xc')](function(){if(_0x3ca58a&&_0x3ca58a['length']){logger[_0x25a7('0x14')](_0x25a7('0x1a'),_0x3ca58a[_0x25a7('0x1b')]());for(var _0x126bc6=0x0;_0x126bc6<_0x3ca58a[_0x25a7('0x12')];_0x126bc6++){io[_0x25a7('0x1c')](_0x25a7('0x1d'),{'id':_0x3ca58a[_0x126bc6],'closed':!![]});}}})[_0x25a7('0x1e')](function(_0x54bda0){logger['error'](_0x25a7('0x1f'),_0x54bda0?util[_0x25a7('0x20')](_0x54bda0,{'showHidden':![],'depth':null}):'');});}exports[_0x25a7('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index db7d82c..e5b77ad 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 _0xe250=['exports'];(function(_0xc35e79,_0x37df8f){var _0x2f2750=function(_0x33ab91){while(--_0x33ab91){_0xc35e79['push'](_0xc35e79['shift']());}};_0x2f2750(++_0x37df8f);}(_0xe250,0xe8));var _0x0e25=function(_0x55f645,_0x39d392){_0x55f645=_0x55f645-0x0;var _0xfa9292=_0xe250[_0x55f645];return _0xfa9292;};'use strict';function start(){var _0x259f66=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x259f66['startAllRefreshIntervals']();}module[_0x0e25('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x7cb8=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1ea061,_0x2c572e){var _0x5057c0=function(_0xcc049f){while(--_0xcc049f){_0x1ea061['push'](_0x1ea061['shift']());}};_0x5057c0(++_0x2c572e);}(_0x7cb8,0x11b));var _0x87cb=function(_0x12485d,_0x4915f6){_0x12485d=_0x12485d-0x0;var _0x52a311=_0x7cb8[_0x12485d];return _0x52a311;};'use strict';function start(){var _0x2e7f19=require(_0x87cb('0x0'));return _0x2e7f19['startAllRefreshIntervals']();}module[_0x87cb('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 287a916..25df599 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 _0xd937=['add\x20cron','update','stop\x20cron','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','email','MailServerOut','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start'];(function(_0x3a032a,_0x2ac8b5){var _0x48a76d=function(_0x45d4ac){while(--_0x45d4ac){_0x3a032a['push'](_0x3a032a['shift']());}};_0x48a76d(++_0x2ac8b5);}(_0xd937,0xad));var _0x7d93=function(_0x4a90ef,_0x2c3d81){_0x4a90ef=_0x4a90ef-0x0;var _0x50e65c=_0xd937[_0x4a90ef];return _0x50e65c;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require('lodash');var moment=require(_0x7d93('0x0'));var CronJobManager=require(_0x7d93('0x1'));var jayson=require(_0x7d93('0x2'));var BPromise=require(_0x7d93('0x3'));var logger=require('../logger')(_0x7d93('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x7d93('0x5'));var analyticDefaultReportController=require(_0x7d93('0x6'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xce5056,_0x4eda1f){return function(){logger[_0x7d93('0x7')](_0x7d93('0x8'),_0xce5056['email']);var _0x33d883=!![];var _0x4f4030={'tls':{'rejectUnauthorized':![]}};if(_0xce5056['MailAccount'][_0x7d93('0x9')][_0x7d93('0xa')]){_0x4f4030[_0x7d93('0xa')]=_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0xa')];}else{_0x4f4030[_0x7d93('0xc')]=_0xce5056[_0x7d93('0xb')]['Smtp']['host'];_0x4f4030['port']=_0xce5056['MailAccount'][_0x7d93('0x9')][_0x7d93('0xd')];_0x4f4030[_0x7d93('0xe')]=_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0xe')];}if(_0xce5056['MailAccount']['Smtp'][_0x7d93('0xf')]){_0x4f4030[_0x7d93('0x10')]={'user':_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0x11')],'pass':_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')]['pass']};}var _0x5db1bb={'account':_0x4f4030,'message':{'from':util[_0x7d93('0x12')]('\x22%s\x22\x20<%s>',_0xce5056[_0x7d93('0xb')][_0x7d93('0x13')],_0xce5056[_0x7d93('0xb')]['email']||_0xce5056[_0x7d93('0xb')]['Smtp'][_0x7d93('0x11')]),'to':_0xce5056['email'],'cc':_0xce5056['cc'],'bcc':_0xce5056['bcc'],'subject':util[_0x7d93('0x12')](_0x7d93('0x14'),_0x4eda1f['name'],_0xce5056[_0x7d93('0x15')],_0xce5056['subtractUnit'])}};var _0x1006ea=path[_0x7d93('0x16')](__dirname,_0x7d93('0x17'));var _0x5cfe62=_0x4eda1f[_0x7d93('0x18')];var _0x1444cf=util[_0x7d93('0x12')](_0x7d93('0x19'),path[_0x7d93('0x1a')](_0x4eda1f[_0x7d93('0x18')],path[_0x7d93('0x1b')](_0x4eda1f[_0x7d93('0x18')])),_0x7d93('0x1c'));var _0x19aae4=path[_0x7d93('0x16')](_0x1006ea,_0x5cfe62);var _0x51ba56=path[_0x7d93('0x16')](_0x1006ea,_0x1444cf);if(fs[_0x7d93('0x1d')](_0x19aae4)){_0x4eda1f[_0x7d93('0x1e')]=_0x7d93('0x1f');_0x5db1bb['message']['attachments']=[{'filename':_0x5cfe62,'path':_0x19aae4}];_0x5db1bb[_0x7d93('0x20')][_0x7d93('0x21')]=util['format'](_0x7d93('0x22'),JSON[_0x7d93('0x23')](_0x4eda1f,null,0x2));}else if(fs['existsSync'](_0x51ba56)){_0x4eda1f['status']=_0x7d93('0x1f');_0x5db1bb['message'][_0x7d93('0x24')]=[{'filename':_0x1444cf,'path':_0x51ba56}];}else{_0x5db1bb['message']['text']=_0x7d93('0x25');if(!_0xce5056[_0x7d93('0x26')]){_0x33d883=![];logger[_0x7d93('0x7')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x33d883){return client['request'](_0x7d93('0x27'),_0x5db1bb)['then'](function(_0x4dc72b){if(_0x4dc72b[_0x7d93('0x28')]){return logger[_0x7d93('0x28')](_0x7d93('0x29'),JSON[_0x7d93('0x23')](_0x4dc72b));}return logger[_0x7d93('0x7')]('email\x20sent');})['catch'](function(_0x34e442){return logger[_0x7d93('0x28')]('error\x20mail',JSON[_0x7d93('0x23')](_0x34e442));});}};}function handleError(){return function(_0xc3edd){return logger[_0x7d93('0x28')](JSON[_0x7d93('0x23')](_0xc3edd));};}function handleResult(_0x77de1c){return function(_0x5164fe){logger[_0x7d93('0x7')](_0x7d93('0x2a'),JSON[_0x7d93('0x23')](_0x5164fe));if(_0x77de1c[_0x7d93('0xb')]&&_0x77de1c[_0x7d93('0xb')]['Smtp']&&!_[_0x7d93('0x2b')](_0x77de1c['email'])){setTimeout(handleSendEmail(_0x77de1c,_0x5164fe),0x3c*0x3e8);}};}function handleJob(_0x2ee784){return function(){try{if(_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x15')])){return logger['info'](_0x7d93('0x2c'));}if(_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x2d')])){return logger[_0x7d93('0x7')](_0x7d93('0x2e'));}var _0x9c0ecc={'startDate':moment()[_0x7d93('0x2f')](_0x2ee784['subtractNumber'],_0x2ee784[_0x7d93('0x2d')])[_0x7d93('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x7d93('0x30')),'type':_0x7d93('0x31'),'output':_0x2ee784['output'],'name':_0x2ee784[_0x7d93('0x13')]};if(!_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x32')])){logger['info'](_0x7d93('0x33'),_0x2ee784[_0x7d93('0x32')]);return analyticDefaultReportController[_0x7d93('0x34')]({'id':_0x2ee784[_0x7d93('0x32')]},_0x9c0ecc)[_0x7d93('0x35')](handleResult(_0x2ee784))[_0x7d93('0x36')](handleError());}if(!_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x37')])){logger['info'](_0x7d93('0x38'),_0x2ee784[_0x7d93('0x37')]);return analyticCustomReportController['runReport']({'id':_0x2ee784['CustomReportId']},_0x9c0ecc)[_0x7d93('0x35')](handleResult(_0x2ee784))[_0x7d93('0x36')](handleError());}}catch(_0x28e68a){logger[_0x7d93('0x28')](JSON[_0x7d93('0x23')](_0x28e68a));}return logger[_0x7d93('0x7')]('no\x20report\x20id');};}function getJobs(_0xeb6725){var _0x5cc07f={};if(_0xeb6725){_0x5cc07f['id']=_0xeb6725;}return db[_0x7d93('0x39')][_0x7d93('0x3a')]({'where':_0x5cc07f,'include':[{'model':db[_0x7d93('0xb')],'attributes':['id',_0x7d93('0x13'),_0x7d93('0x3b')],'include':[{'model':db[_0x7d93('0x3c')],'as':_0x7d93('0x9')}]}]})[_0x7d93('0x35')](function(_0x2addff){var _0x28ddae=_['keys'](manager['jobs']);var _0x4a1251=_['map'](_0x2addff,function(_0x432d64){return _0x432d64['id']['toString']();});var _0x34a5e8=_[_0x7d93('0x3d')](_0x2addff,function(_0xc09577){return _0xc09577['id'][_0x7d93('0x3e')]();});var _0x165a02=_0xeb6725?_0x4a1251:_[_0x7d93('0x3f')](_0x4a1251,_0x28ddae);var _0x2cdaae=_[_0x7d93('0x40')](_0x4a1251,_0x28ddae);var _0x2b04df=_[_0x7d93('0x3f')](_0x28ddae,_0x4a1251);var _0x4eecd9;var _0x19a6fe;for(_0x4eecd9=0x0;_0x4eecd9<_0x2b04df[_0x7d93('0x41')]&&!_0xeb6725;_0x4eecd9+=0x1){_0x19a6fe=_0x2b04df[_0x4eecd9][_0x7d93('0x3e')]();if(manager[_0x7d93('0x42')](_0x19a6fe)){manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x45'),_0x19a6fe);}}logger[_0x7d93('0x7')](_0x7d93('0x46'),JSON[_0x7d93('0x23')](_0x165a02));for(_0x4eecd9=0x0;_0x4eecd9<_0x165a02[_0x7d93('0x41')];_0x4eecd9+=0x1){_0x19a6fe=_0x165a02[_0x4eecd9][_0x7d93('0x3e')]();logger[_0x7d93('0x7')](_0x7d93('0x47'),_0x19a6fe);if(_0xeb6725){logger[_0x7d93('0x7')](_0x7d93('0x48'),_0xeb6725);logger[_0x7d93('0x7')](JSON[_0x7d93('0x23')](_0x34a5e8[_0x19a6fe]));BPromise[_0x7d93('0x49')]()[_0x7d93('0x35')](handleJob(_0x34a5e8[_0x19a6fe]));logger[_0x7d93('0x7')](_0x7d93('0x4a'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else if(_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]&&_0x34a5e8[_0x19a6fe][_0x7d93('0x4c')]&&moment()[_0x7d93('0x4d')](_0x34a5e8[_0x19a6fe][_0x7d93('0x4e')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4f')])){manager[_0x7d93('0x50')](_0x19a6fe,_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')],handleJob(_0x34a5e8[_0x19a6fe]));manager[_0x7d93('0x51')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x52'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else if(manager['exists'](_0x19a6fe)){manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')]('stop\x20cron',_0x34a5e8[_0x19a6fe]['name'],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}}for(_0x4eecd9=0x0,_0x19a6fe;_0x4eecd9<_0x2cdaae[_0x7d93('0x41')]&&!_0xeb6725;_0x4eecd9+=0x1){_0x19a6fe=_0x2cdaae[_0x4eecd9][_0x7d93('0x3e')]();if(manager[_0x7d93('0x42')](_0x19a6fe)){if(_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]&&_0x34a5e8[_0x19a6fe][_0x7d93('0x4c')]&&moment()[_0x7d93('0x4d')](_0x34a5e8[_0x19a6fe][_0x7d93('0x4e')],_0x34a5e8[_0x19a6fe]['endAt'])){manager[_0x7d93('0x53')](_0x19a6fe,_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')],handleJob(_0x34a5e8[_0x19a6fe]));logger['info']('update\x20cron',_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else{manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x54'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}}}})[_0x7d93('0x36')](function(_0x19da7d){logger['error'](JSON[_0x7d93('0x23')](_0x19da7d));});}exports['run']=function(_0x593229){return getJobs(_0x593229);};exports[_0x7d93('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1e6b=['\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','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','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','run','util','path','lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','user','format'];(function(_0x481f99,_0x458b72){var _0x721d60=function(_0x42b5c3){while(--_0x42b5c3){_0x481f99['push'](_0x481f99['shift']());}};_0x721d60(++_0x458b72);}(_0x1e6b,0x181));var _0xb1e6=function(_0x43e8cd,_0x359cb9){_0x43e8cd=_0x43e8cd-0x0;var _0x14da96=_0x1e6b[_0x43e8cd];return _0x14da96;};'use strict';var fs=require('fs');var util=require(_0xb1e6('0x0'));var path=require(_0xb1e6('0x1'));var _=require(_0xb1e6('0x2'));var moment=require(_0xb1e6('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xb1e6('0x4'));var logger=require(_0xb1e6('0x5'))('schedule');var db=require(_0xb1e6('0x6'))['db'];var analyticCustomReportController=require(_0xb1e6('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xb1e6('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1e3d46,_0x282ef7){return function(){logger[_0xb1e6('0x9')](_0xb1e6('0xa'),_0x1e3d46[_0xb1e6('0xb')]);var _0x41a8b4=!![];var _0xa851df={'tls':{'rejectUnauthorized':![]}};if(_0x1e3d46[_0xb1e6('0xc')]['Smtp'][_0xb1e6('0xd')]){_0xa851df[_0xb1e6('0xd')]=_0x1e3d46[_0xb1e6('0xc')][_0xb1e6('0xe')]['service'];}else{_0xa851df[_0xb1e6('0xf')]=_0x1e3d46[_0xb1e6('0xc')][_0xb1e6('0xe')][_0xb1e6('0xf')];_0xa851df[_0xb1e6('0x10')]=_0x1e3d46[_0xb1e6('0xc')][_0xb1e6('0xe')][_0xb1e6('0x10')];_0xa851df[_0xb1e6('0x11')]=_0x1e3d46[_0xb1e6('0xc')][_0xb1e6('0xe')]['secure'];}if(_0x1e3d46['MailAccount']['Smtp']['authentication']){_0xa851df['auth']={'user':_0x1e3d46[_0xb1e6('0xc')][_0xb1e6('0xe')][_0xb1e6('0x12')],'pass':_0x1e3d46[_0xb1e6('0xc')]['Smtp']['pass']};}var _0x25cc8c={'account':_0xa851df,'message':{'from':util[_0xb1e6('0x13')](_0xb1e6('0x14'),_0x1e3d46['MailAccount'][_0xb1e6('0x15')],_0x1e3d46['MailAccount'][_0xb1e6('0xb')]||_0x1e3d46['MailAccount'][_0xb1e6('0xe')][_0xb1e6('0x12')]),'to':_0x1e3d46[_0xb1e6('0xb')],'cc':_0x1e3d46['cc'],'bcc':_0x1e3d46[_0xb1e6('0x16')],'subject':util[_0xb1e6('0x13')](_0xb1e6('0x17'),_0x282ef7[_0xb1e6('0x15')],_0x1e3d46[_0xb1e6('0x18')],_0x1e3d46[_0xb1e6('0x19')])}};var _0x5ed00e=path[_0xb1e6('0x1a')](__dirname,_0xb1e6('0x1b'));var _0x448dad=_0x282ef7[_0xb1e6('0x1c')];var _0x391a55=util[_0xb1e6('0x13')](_0xb1e6('0x1d'),path['basename'](_0x282ef7[_0xb1e6('0x1c')],path[_0xb1e6('0x1e')](_0x282ef7[_0xb1e6('0x1c')])),_0xb1e6('0x1f'));var _0xbd446=path[_0xb1e6('0x1a')](_0x5ed00e,_0x448dad);var _0x96a3b5=path[_0xb1e6('0x1a')](_0x5ed00e,_0x391a55);if(fs['existsSync'](_0xbd446)){_0x282ef7['status']='Sent';_0x25cc8c[_0xb1e6('0x20')]['attachments']=[{'filename':_0x448dad,'path':_0xbd446}];_0x25cc8c[_0xb1e6('0x20')]['text']=util[_0xb1e6('0x13')](_0xb1e6('0x21'),JSON[_0xb1e6('0x22')](_0x282ef7,null,0x2));}else if(fs['existsSync'](_0x96a3b5)){_0x282ef7['status']='Sent';_0x25cc8c[_0xb1e6('0x20')]['attachments']=[{'filename':_0x391a55,'path':_0x96a3b5}];}else{_0x25cc8c[_0xb1e6('0x20')][_0xb1e6('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1e3d46[_0xb1e6('0x24')]){_0x41a8b4=![];logger['info'](_0xb1e6('0x25'));}}if(_0x41a8b4){return client[_0xb1e6('0x26')](_0xb1e6('0x27'),_0x25cc8c)[_0xb1e6('0x28')](function(_0x124ba6){if(_0x124ba6[_0xb1e6('0x29')]){return logger[_0xb1e6('0x29')](_0xb1e6('0x2a'),JSON[_0xb1e6('0x22')](_0x124ba6));}return logger['info'](_0xb1e6('0x2b'));})[_0xb1e6('0x2c')](function(_0x4dea2c){return logger['error'](_0xb1e6('0x2a'),JSON[_0xb1e6('0x22')](_0x4dea2c));});}};}function handleError(){return function(_0x57b4a9){return logger['error'](JSON[_0xb1e6('0x22')](_0x57b4a9));};}function handleResult(_0x407999){return function(_0x342f12){logger[_0xb1e6('0x9')](_0xb1e6('0x2d'),JSON[_0xb1e6('0x22')](_0x342f12));if(_0x407999[_0xb1e6('0xc')]&&_0x407999[_0xb1e6('0xc')][_0xb1e6('0xe')]&&!_[_0xb1e6('0x2e')](_0x407999[_0xb1e6('0xb')])){setTimeout(handleSendEmail(_0x407999,_0x342f12),0x3c*0x3e8);}};}function handleJob(_0x3c11aa){return function(){try{if(_[_0xb1e6('0x2e')](_0x3c11aa[_0xb1e6('0x18')])){return logger[_0xb1e6('0x9')](_0xb1e6('0x2f'));}if(_[_0xb1e6('0x2e')](_0x3c11aa[_0xb1e6('0x19')])){return logger[_0xb1e6('0x9')](_0xb1e6('0x30'));}var _0x3c5f03={'startDate':moment()['subtract'](_0x3c11aa[_0xb1e6('0x18')],_0x3c11aa[_0xb1e6('0x19')])[_0xb1e6('0x13')](_0xb1e6('0x31')),'endDate':moment()[_0xb1e6('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xb1e6('0x32'),'output':_0x3c11aa[_0xb1e6('0x33')],'name':_0x3c11aa[_0xb1e6('0x15')]};if(!_['isNil'](_0x3c11aa[_0xb1e6('0x34')])){logger[_0xb1e6('0x9')](_0xb1e6('0x35'),_0x3c11aa[_0xb1e6('0x34')]);return analyticDefaultReportController[_0xb1e6('0x36')]({'id':_0x3c11aa[_0xb1e6('0x34')]},_0x3c5f03)[_0xb1e6('0x28')](handleResult(_0x3c11aa))[_0xb1e6('0x2c')](handleError());}if(!_[_0xb1e6('0x2e')](_0x3c11aa[_0xb1e6('0x37')])){logger[_0xb1e6('0x9')]('exec\x20custom\x20report\x20id:%s',_0x3c11aa['CustomReportId']);return analyticCustomReportController[_0xb1e6('0x36')]({'id':_0x3c11aa['CustomReportId']},_0x3c5f03)[_0xb1e6('0x28')](handleResult(_0x3c11aa))['catch'](handleError());}}catch(_0x38ad0f){logger[_0xb1e6('0x29')](JSON[_0xb1e6('0x22')](_0x38ad0f));}return logger[_0xb1e6('0x9')](_0xb1e6('0x38'));};}function getJobs(_0x46e551){var _0x2be1ab={};if(_0x46e551){_0x2be1ab['id']=_0x46e551;}return db[_0xb1e6('0x39')]['findAll']({'where':_0x2be1ab,'include':[{'model':db[_0xb1e6('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0xb1e6('0x3a')],'as':_0xb1e6('0xe')}]}]})[_0xb1e6('0x28')](function(_0xe47336){var _0x383d68=_[_0xb1e6('0x3b')](manager[_0xb1e6('0x3c')]);var _0x3ca396=_[_0xb1e6('0x3d')](_0xe47336,function(_0x1a4863){return _0x1a4863['id'][_0xb1e6('0x3e')]();});var _0x2098ff=_[_0xb1e6('0x3f')](_0xe47336,function(_0x69f365){return _0x69f365['id']['toString']();});var _0x30106e=_0x46e551?_0x3ca396:_[_0xb1e6('0x40')](_0x3ca396,_0x383d68);var _0x5d47ff=_['intersection'](_0x3ca396,_0x383d68);var _0x15569d=_[_0xb1e6('0x40')](_0x383d68,_0x3ca396);var _0x23dae1;var _0x2e252d;for(_0x23dae1=0x0;_0x23dae1<_0x15569d[_0xb1e6('0x41')]&&!_0x46e551;_0x23dae1+=0x1){_0x2e252d=_0x15569d[_0x23dae1][_0xb1e6('0x3e')]();if(manager[_0xb1e6('0x42')](_0x2e252d)){manager[_0xb1e6('0x43')](_0x2e252d);manager[_0xb1e6('0x44')](_0x2e252d);logger[_0xb1e6('0x9')](_0xb1e6('0x45'),_0x2e252d);}}logger[_0xb1e6('0x9')]('toRun',JSON[_0xb1e6('0x22')](_0x30106e));for(_0x23dae1=0x0;_0x23dae1<_0x30106e[_0xb1e6('0x41')];_0x23dae1+=0x1){_0x2e252d=_0x30106e[_0x23dae1][_0xb1e6('0x3e')]();logger[_0xb1e6('0x9')](_0xb1e6('0x46'),_0x2e252d);if(_0x46e551){logger[_0xb1e6('0x9')](_0xb1e6('0x47'),_0x46e551);logger['info'](JSON['stringify'](_0x2098ff[_0x2e252d]));BPromise['resolve']()[_0xb1e6('0x28')](handleJob(_0x2098ff[_0x2e252d]));logger['info']('run\x20job',_0x2098ff[_0x2e252d][_0xb1e6('0x15')],_0x2098ff[_0x2e252d]['cron']);}else if(_0x2098ff[_0x2e252d][_0xb1e6('0x48')]&&_0x2098ff[_0x2e252d][_0xb1e6('0x49')]&&moment()[_0xb1e6('0x4a')](_0x2098ff[_0x2e252d][_0xb1e6('0x4b')],_0x2098ff[_0x2e252d][_0xb1e6('0x4c')])){manager['add'](_0x2e252d,_0x2098ff[_0x2e252d][_0xb1e6('0x48')],handleJob(_0x2098ff[_0x2e252d]));manager[_0xb1e6('0x4d')](_0x2e252d);logger[_0xb1e6('0x9')](_0xb1e6('0x4e'),_0x2098ff[_0x2e252d][_0xb1e6('0x15')],_0x2098ff[_0x2e252d][_0xb1e6('0x48')]);}else if(manager['exists'](_0x2e252d)){manager['stop'](_0x2e252d);manager[_0xb1e6('0x44')](_0x2e252d);logger[_0xb1e6('0x9')](_0xb1e6('0x4f'),_0x2098ff[_0x2e252d]['name'],_0x2098ff[_0x2e252d][_0xb1e6('0x48')]);}}for(_0x23dae1=0x0,_0x2e252d;_0x23dae1<_0x5d47ff[_0xb1e6('0x41')]&&!_0x46e551;_0x23dae1+=0x1){_0x2e252d=_0x5d47ff[_0x23dae1][_0xb1e6('0x3e')]();if(manager[_0xb1e6('0x42')](_0x2e252d)){if(_0x2098ff[_0x2e252d]['cron']&&_0x2098ff[_0x2e252d]['active']&&moment()[_0xb1e6('0x4a')](_0x2098ff[_0x2e252d][_0xb1e6('0x4b')],_0x2098ff[_0x2e252d][_0xb1e6('0x4c')])){manager['update'](_0x2e252d,_0x2098ff[_0x2e252d][_0xb1e6('0x48')],handleJob(_0x2098ff[_0x2e252d]));logger[_0xb1e6('0x9')]('update\x20cron',_0x2098ff[_0x2e252d][_0xb1e6('0x15')],_0x2098ff[_0x2e252d][_0xb1e6('0x48')]);}else{manager['stop'](_0x2e252d);manager[_0xb1e6('0x44')](_0x2e252d);logger[_0xb1e6('0x9')](_0xb1e6('0x4f'),_0x2098ff[_0x2e252d][_0xb1e6('0x15')],_0x2098ff[_0x2e252d][_0xb1e6('0x48')]);}}}})[_0xb1e6('0x2c')](function(_0x759c0e){logger['error'](JSON[_0xb1e6('0x22')](_0x759c0e));});}exports[_0xb1e6('0x50')]=function(_0x1c3295){return getJobs(_0x1c3295);};exports[_0xb1e6('0x4d')]=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 370684a..90da8c6 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 _0xf53d=['[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Mixed','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','Transcribe\x20not\x20configured','push','all','catch','inspect','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri'];(function(_0x261b84,_0x5bda10){var _0x1fcf21=function(_0x1dcc8e){while(--_0x1dcc8e){_0x261b84['push'](_0x261b84['shift']());}};_0x1fcf21(++_0x5bda10);}(_0xf53d,0x199));var _0xdf53=function(_0x5bb865,_0x151d2d){_0x5bb865=_0x5bb865-0x0;var _0x548b1e=_0xf53d[_0x5bb865];return _0x548b1e;};var _=require(_0xdf53('0x0'));var AWS=require(_0xdf53('0x1'));var rp=require('request-promise');var util=require(_0xdf53('0x2'));var BPromise=require(_0xdf53('0x3'));var db=require(_0xdf53('0x4'))['db'];var logger=require('../../config/logger')(_0xdf53('0x5'));function getTranscriptionJob(_0x5d9500,_0x3ae2e2,_0x5e66f4,_0x531636){return new Promise(function(_0xa9fb11,_0x4cf8d5){var _0x1500ae=new AWS[(_0xdf53('0x6'))]({'accessKeyId':_0x3ae2e2,'secretAccessKey':_0x5d9500,'region':_0x5e66f4});_0x1500ae[_0xdf53('0x7')]({'TranscriptionJobName':_0x531636},function(_0x3a449,_0x328fd3){if(_0x3a449){return _0x4cf8d5(_0x3a449);}else{return _0xa9fb11(_0x328fd3);}});});}function sentiment(_0x1549ef,_0x14af2f,_0x3cb753,_0x4c0fb1,_0x29152a){return new Promise(function(_0x2293f3,_0x5e1df7){var _0x1e54dd=new AWS['Comprehend']({'accessKeyId':_0x14af2f,'secretAccessKey':_0x1549ef,'region':_0x3cb753});_0x1e54dd[_0xdf53('0x8')]({'Text':_0x4c0fb1,'LanguageCode':_0x29152a[_0xdf53('0x9')](0x0,0x2)},function(_0x2412ce,_0x39f5c7){if(_0x2412ce){return _0x5e1df7(_0x2412ce);}else{return _0x2293f3(_0x39f5c7);}});});}function checkTranscribeJob(_0xc8937d,_0x336304,_0x4c1eee){var _0x4082e3;return new BPromise(function(_0x5d5447,_0x493d4e){logger['info'](util[_0xdf53('0xa')](_0xdf53('0xb'),_0xc8937d['id'],_0xc8937d[_0xdf53('0xc')]));return getTranscriptionJob(_0x4c1eee['data1'],_0x4c1eee[_0xdf53('0xd')],_0x336304[_0xdf53('0xe')],_0xc8937d[_0xdf53('0xc')])[_0xdf53('0xf')](function(_0x22deb2){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x11'),_0xc8937d['id'],_0xc8937d[_0xdf53('0xc')],_0x22deb2[_0xdf53('0x12')][_0xdf53('0x13')]));if(!_0xc8937d[_0xdf53('0x14')]){switch(_0x22deb2['TranscriptionJob'][_0xdf53('0x13')]){case'COMPLETED':var _0x22d112={'transcribeStatus':_0x22deb2[_0xdf53('0x12')][_0xdf53('0x13')],'fileUri':_0x22deb2['TranscriptionJob'][_0xdf53('0x15')][_0xdf53('0x16')]};logger[_0xdf53('0x10')](util['format'](_0xdf53('0x17'),_0xc8937d['id']));return rp({'uri':_0x22deb2['TranscriptionJob']['Transcript'][_0xdf53('0x16')],'json':!![]})['then'](function(_0x1e003d){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x18'),_0xc8937d['id']));if(_0x1e003d&&_0x1e003d[_0xdf53('0x19')]&&_0x1e003d[_0xdf53('0x19')][_0xdf53('0x1a')]&&_0x1e003d['results'][_0xdf53('0x1a')][_0xdf53('0x1b')]){_0x22d112[_0xdf53('0x14')]='';for(var _0x260cb3=0x0;_0x260cb3<_0x1e003d['results'][_0xdf53('0x1a')][_0xdf53('0x1b')];_0x260cb3++){_0x22d112[_0xdf53('0x14')]+=_0x1e003d[_0xdf53('0x19')][_0xdf53('0x1a')][_0x260cb3][_0xdf53('0x1c')]+'';}}return _0xc8937d[_0xdf53('0x1d')](_0x22d112);})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x1e'),_0xc8937d['id']));if(!_0xc8937d[_0xdf53('0x1f')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x22'));}if(!_0x336304['sentiment']||!_0x336304[_0xdf53('0x23')]||!_0x336304['sentimentRegion']||!_0x336304['language']||!_0x336304[_0xdf53('0x24')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x25'));}if(!_0x22d112[_0xdf53('0x14')]){throw new Error(_0xdf53('0x26'));}if(_0x336304[_0xdf53('0x23')]===_0x4c1eee['id']){return _0x4c1eee;}else{return db[_0xdf53('0x27')]['findOne']({'where':{'id':_settings[_0xdf53('0x23')]}});}})[_0xdf53('0xf')](function(_0x2afa60){if(!_0x2afa60){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x2afa60[_0xdf53('0x29')]||!_0x2afa60[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x4082e3=_0x2afa60;logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x2b'),_0xc8937d['id']));return sentiment(_0x4082e3['data1'],_0x4082e3[_0xdf53('0xd')],_0x336304['sentimentRegion'],_0x22d112[_0xdf53('0x14')],_0x336304[_0xdf53('0x2c')]);})['then'](function(_0x3a993d){logger['info'](util[_0xdf53('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xc8937d['id']));return _0xc8937d[_0xdf53('0x1d')]({'sentiment':_0x3a993d[_0xdf53('0x2d')],'sPositive':_0x3a993d[_0xdf53('0x2e')]['Positive'],'sNegative':_0x3a993d[_0xdf53('0x2e')]['Negative'],'sMixed':_0x3a993d['SentimentScore'][_0xdf53('0x2f')],'sNeutral':_0x3a993d['SentimentScore']['Neutral']});})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x1e'),_0xc8937d['id']));_0x5d5447();});case'FAILED':return _0xc8937d[_0xdf53('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x22deb2[_0xdf53('0x12')]['FailureReason']})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util['format'](_0xdf53('0x1e'),_0xc8937d['id']));_0x5d5447();});default:logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x30'),_0xc8937d['id']));break;}}else{return BPromise[_0xdf53('0x31')]()[_0xdf53('0xf')](function(){if(!_0xc8937d[_0xdf53('0x1f')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x22'));}if(!_0x336304[_0xdf53('0x32')]||!_0x336304[_0xdf53('0x23')]||!_0x336304['sentimentRegion']||!_0x336304[_0xdf53('0x2c')]||!_0x336304[_0xdf53('0x24')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x25'));}if(!_0xc8937d[_0xdf53('0x14')]){throw new Error(_0xdf53('0x26'));}if(_0x336304[_0xdf53('0x23')]===_0x4c1eee['id']){return _0x4c1eee;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xdf53('0x23')]}});}})[_0xdf53('0xf')](function(_0x4a5b42){if(!_0x4a5b42){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x4a5b42['data1']||!_0x4a5b42[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x4082e3=_0x4a5b42;logger['info'](util[_0xdf53('0xa')](_0xdf53('0x2b'),_0xc8937d['id']));return sentiment(_0x4082e3[_0xdf53('0x29')],_0x4082e3[_0xdf53('0xd')],_0x336304[_0xdf53('0x33')],_0xc8937d[_0xdf53('0x14')],_0x336304['language']);})['then'](function(_0x2d339f){logger['info'](util['format'](_0xdf53('0x34'),_0xc8937d['id']));return _0xc8937d[_0xdf53('0x1d')]({'sentiment':_0x2d339f['Sentiment'],'sPositive':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x35')],'sNegative':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x36')],'sMixed':_0x2d339f['SentimentScore'][_0xdf53('0x2f')],'sNeutral':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x37')],'transcribeStatus':'COMPLETED'});})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xc8937d['id']));_0x5d5447();});}})['catch'](function(_0x368e7b){if(_0x368e7b){if(!_0x368e7b[_0xdf53('0x38')]||_0x368e7b[_0xdf53('0x38')]!==_0xdf53('0x39')){logger[_0xdf53('0x3a')](util[_0xdf53('0xa')](_0xdf53('0x3b'),_0xc8937d['id']),util['inspect'](_0x368e7b,{'showHidden':![],'depth':null}));}}_0x5d5447();});});}function checkTranscribe(){var _0x4fca5f;var _0x94f1d9;var _0x37f56c;return db[_0xdf53('0x3c')][_0xdf53('0x3d')]({'where':{'transcribeStatus':_0xdf53('0x3e')}})[_0xdf53('0xf')](function(_0x1c98d7){if(!_0x1c98d7||!_0x1c98d7[_0xdf53('0x1b')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x3f'));}_0x4fca5f=_0x1c98d7;return db[_0xdf53('0x40')][_0xdf53('0x41')]({'where':{'id':0x1}});})[_0xdf53('0xf')](function(_0x3808fd){if(!_0x3808fd){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x42'));}_0x94f1d9=_0x3808fd;if(!_0x94f1d9[_0xdf53('0x5')]||!_0x94f1d9['transcribeAccountId']||!_0x94f1d9[_0xdf53('0xe')]||!_0x94f1d9[_0xdf53('0x2c')]||!_0x94f1d9[_0xdf53('0x24')]){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x43'));}return db['CloudProvider'][_0xdf53('0x41')]({'where':{'id':_0x94f1d9['transcribeAccountId']}});})[_0xdf53('0xf')](function(_0x33853b){if(!_0x33853b){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x33853b[_0xdf53('0x29')]||!_0x33853b[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x37f56c=_0x33853b;var _0x2fdef4=[];_0x4fca5f['forEach'](function(_0x5cbfc3){_0x2fdef4[_0xdf53('0x44')](checkTranscribeJob(_0x5cbfc3,_0x94f1d9,_0x37f56c));});return BPromise[_0xdf53('0x45')](_0x2fdef4);})[_0xdf53('0x46')](function(_0x40cff4){if(_0x40cff4){if(!_0x40cff4[_0xdf53('0x38')]||_0x40cff4['name']!=='SequelizeValidationError'){logger['error'](util[_0xdf53('0x47')](_0x40cff4,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x56dc=['Cloud\x20Provider\x20not\x20configured','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','inspect','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','ValidationError','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Transcript\x20not\x20available'];(function(_0x393d69,_0x3a8c83){var _0x3cee37=function(_0x462682){while(--_0x462682){_0x393d69['push'](_0x393d69['shift']());}};_0x3cee37(++_0x3a8c83);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};var _=require(_0xc56d('0x0'));var AWS=require('aws-sdk');var rp=require(_0xc56d('0x1'));var util=require(_0xc56d('0x2'));var BPromise=require(_0xc56d('0x3'));var db=require(_0xc56d('0x4'))['db'];var logger=require(_0xc56d('0x5'))('transcribe');function getTranscriptionJob(_0x2ffdfe,_0x2e7620,_0x289bb7,_0x464c0a){return new Promise(function(_0x3eb4ed,_0x3e68f4){var _0x571341=new AWS[(_0xc56d('0x6'))]({'accessKeyId':_0x2e7620,'secretAccessKey':_0x2ffdfe,'region':_0x289bb7});_0x571341[_0xc56d('0x7')]({'TranscriptionJobName':_0x464c0a},function(_0x3ac7cd,_0x51ca01){if(_0x3ac7cd){return _0x3e68f4(_0x3ac7cd);}else{return _0x3eb4ed(_0x51ca01);}});});}function sentiment(_0x146dc4,_0x1043f9,_0x3ff2cb,_0x1df34e,_0x3a6456){return new Promise(function(_0x544cef,_0x3bfd34){var _0x2d459d=new AWS[(_0xc56d('0x8'))]({'accessKeyId':_0x1043f9,'secretAccessKey':_0x146dc4,'region':_0x3ff2cb});_0x2d459d['detectSentiment']({'Text':_0x1df34e,'LanguageCode':_0x3a6456[_0xc56d('0x9')](0x0,0x2)},function(_0x2eeb7d,_0x247cea){if(_0x2eeb7d){return _0x3bfd34(_0x2eeb7d);}else{return _0x544cef(_0x247cea);}});});}function checkTranscribeJob(_0x14b82e,_0x585ca5,_0xf82e05){var _0x2f120a;return new BPromise(function(_0x26744e,_0x4b60cd){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0xc'),_0x14b82e['id'],_0x14b82e[_0xc56d('0xd')]));return getTranscriptionJob(_0xf82e05['data1'],_0xf82e05[_0xc56d('0xe')],_0x585ca5[_0xc56d('0xf')],_0x14b82e['transcribeName'])['then'](function(_0x259967){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x10'),_0x14b82e['id'],_0x14b82e['transcribeName'],_0x259967[_0xc56d('0x11')]['TranscriptionJobStatus']));if(!_0x14b82e[_0xc56d('0x12')]){switch(_0x259967[_0xc56d('0x11')]['TranscriptionJobStatus']){case _0xc56d('0x13'):var _0x22f20a={'transcribeStatus':_0x259967[_0xc56d('0x11')][_0xc56d('0x14')],'fileUri':_0x259967[_0xc56d('0x11')]['Transcript'][_0xc56d('0x15')]};logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x16'),_0x14b82e['id']));return rp({'uri':_0x259967['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0xc56d('0x17')](function(_0x1c9a1c){logger[_0xc56d('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x14b82e['id']));if(_0x1c9a1c&&_0x1c9a1c[_0xc56d('0x18')]&&_0x1c9a1c[_0xc56d('0x18')]['transcripts']&&_0x1c9a1c[_0xc56d('0x18')][_0xc56d('0x19')][_0xc56d('0x1a')]){_0x22f20a[_0xc56d('0x12')]='';for(var _0x527929=0x0;_0x527929<_0x1c9a1c['results'][_0xc56d('0x19')][_0xc56d('0x1a')];_0x527929++){_0x22f20a['fileText']+=_0x1c9a1c[_0xc56d('0x18')][_0xc56d('0x19')][_0x527929][_0xc56d('0x1b')]+'';}}return _0x14b82e['update'](_0x22f20a);})[_0xc56d('0x17')](function(){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x1c'),_0x14b82e['id']));if(!_0x14b82e[_0xc56d('0x1d')]){throw new db[(_0xc56d('0x1e'))]['ValidationError'](_0xc56d('0x1f'));}if(!_0x585ca5['sentiment']||!_0x585ca5[_0xc56d('0x20')]||!_0x585ca5[_0xc56d('0x21')]||!_0x585ca5[_0xc56d('0x22')]||!_0x585ca5[_0xc56d('0x23')]){throw new db[(_0xc56d('0x1e'))]['ValidationError'](_0xc56d('0x24'));}if(!_0x22f20a['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x585ca5['sentimentAccountId']===_0xf82e05['id']){return _0xf82e05;}else{return db[_0xc56d('0x25')]['findOne']({'where':{'id':_settings[_0xc56d('0x20')]}});}})[_0xc56d('0x17')](function(_0x32d057){if(!_0x32d057){throw new db['Sequelize'][(_0xc56d('0x26'))](_0xc56d('0x27'));}if(!_0x32d057[_0xc56d('0x28')]||!_0x32d057[_0xc56d('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2f120a=_0x32d057;logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x29'),_0x14b82e['id']));return sentiment(_0x2f120a[_0xc56d('0x28')],_0x2f120a[_0xc56d('0xe')],_0x585ca5['sentimentRegion'],_0x22f20a[_0xc56d('0x12')],_0x585ca5[_0xc56d('0x22')]);})[_0xc56d('0x17')](function(_0x3f1b42){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x2a'),_0x14b82e['id']));return _0x14b82e['update']({'sentiment':_0x3f1b42[_0xc56d('0x2b')],'sPositive':_0x3f1b42['SentimentScore'][_0xc56d('0x2c')],'sNegative':_0x3f1b42[_0xc56d('0x2d')]['Negative'],'sMixed':_0x3f1b42[_0xc56d('0x2d')][_0xc56d('0x2e')],'sNeutral':_0x3f1b42[_0xc56d('0x2d')][_0xc56d('0x2f')]});})[_0xc56d('0x17')](function(){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x1c'),_0x14b82e['id']));_0x26744e();});case _0xc56d('0x30'):return _0x14b82e[_0xc56d('0x31')]({'transcribeStatus':_0xc56d('0x30'),'failureReason':_0x259967[_0xc56d('0x11')][_0xc56d('0x32')]})[_0xc56d('0x17')](function(){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x1c'),_0x14b82e['id']));_0x26744e();});default:logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x33'),_0x14b82e['id']));break;}}else{return BPromise[_0xc56d('0x34')]()[_0xc56d('0x17')](function(){if(!_0x14b82e[_0xc56d('0x1d')]){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))](_0xc56d('0x1f'));}if(!_0x585ca5[_0xc56d('0x35')]||!_0x585ca5[_0xc56d('0x20')]||!_0x585ca5[_0xc56d('0x21')]||!_0x585ca5['language']||!_0x585ca5[_0xc56d('0x23')]){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x14b82e['fileText']){throw new Error(_0xc56d('0x36'));}if(_0x585ca5['sentimentAccountId']===_0xf82e05['id']){return _0xf82e05;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x1bb678){if(!_0x1bb678){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))](_0xc56d('0x27'));}if(!_0x1bb678[_0xc56d('0x28')]||!_0x1bb678[_0xc56d('0xe')]){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))](_0xc56d('0x37'));}_0x2f120a=_0x1bb678;logger[_0xc56d('0xa')](util['format'](_0xc56d('0x29'),_0x14b82e['id']));return sentiment(_0x2f120a[_0xc56d('0x28')],_0x2f120a[_0xc56d('0xe')],_0x585ca5['sentimentRegion'],_0x14b82e[_0xc56d('0x12')],_0x585ca5[_0xc56d('0x22')]);})[_0xc56d('0x17')](function(_0x12e5c2){logger[_0xc56d('0xa')](util[_0xc56d('0xb')](_0xc56d('0x2a'),_0x14b82e['id']));return _0x14b82e[_0xc56d('0x31')]({'sentiment':_0x12e5c2['Sentiment'],'sPositive':_0x12e5c2[_0xc56d('0x2d')][_0xc56d('0x2c')],'sNegative':_0x12e5c2[_0xc56d('0x2d')][_0xc56d('0x38')],'sMixed':_0x12e5c2[_0xc56d('0x2d')][_0xc56d('0x2e')],'sNeutral':_0x12e5c2[_0xc56d('0x2d')]['Neutral'],'transcribeStatus':_0xc56d('0x13')});})[_0xc56d('0x17')](function(){logger[_0xc56d('0xa')](util['format'](_0xc56d('0x1c'),_0x14b82e['id']));_0x26744e();});}})[_0xc56d('0x39')](function(_0x2b79b7){if(_0x2b79b7){if(!_0x2b79b7[_0xc56d('0x3a')]||_0x2b79b7[_0xc56d('0x3a')]!==_0xc56d('0x3b')){logger[_0xc56d('0x3c')](util['format'](_0xc56d('0x3d'),_0x14b82e['id']),util['inspect'](_0x2b79b7,{'showHidden':![],'depth':null}));}}_0x26744e();});});}function checkTranscribe(){var _0x3ed7b9;var _0x3d39ee;var _0x5280d1;return db[_0xc56d('0x3e')][_0xc56d('0x3f')]({'where':{'transcribeStatus':_0xc56d('0x40')}})['then'](function(_0x21e643){if(!_0x21e643||!_0x21e643[_0xc56d('0x1a')]){throw new db[(_0xc56d('0x1e'))]['ValidationError'](_0xc56d('0x41'));}_0x3ed7b9=_0x21e643;return db[_0xc56d('0x42')][_0xc56d('0x43')]({'where':{'id':0x1}});})[_0xc56d('0x17')](function(_0x4451a5){if(!_0x4451a5){throw new db['Sequelize'][(_0xc56d('0x26'))](_0xc56d('0x44'));}_0x3d39ee=_0x4451a5;if(!_0x3d39ee[_0xc56d('0x45')]||!_0x3d39ee[_0xc56d('0x46')]||!_0x3d39ee[_0xc56d('0xf')]||!_0x3d39ee[_0xc56d('0x22')]||!_0x3d39ee['bucket']){throw new db['Sequelize'][(_0xc56d('0x26'))](_0xc56d('0x47'));}return db[_0xc56d('0x25')][_0xc56d('0x43')]({'where':{'id':_0x3d39ee['transcribeAccountId']}});})[_0xc56d('0x17')](function(_0xa54d26){if(!_0xa54d26){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))](_0xc56d('0x27'));}if(!_0xa54d26['data1']||!_0xa54d26[_0xc56d('0xe')]){throw new db[(_0xc56d('0x1e'))][(_0xc56d('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x5280d1=_0xa54d26;var _0x1f2bd7=[];_0x3ed7b9[_0xc56d('0x48')](function(_0x4f6d64){_0x1f2bd7[_0xc56d('0x49')](checkTranscribeJob(_0x4f6d64,_0x3d39ee,_0x5280d1));});return BPromise[_0xc56d('0x4a')](_0x1f2bd7);})[_0xc56d('0x39')](function(_0x4bb37c){if(_0x4bb37c){if(!_0x4bb37c[_0xc56d('0x3a')]||_0x4bb37c[_0xc56d('0x3a')]!==_0xc56d('0x3b')){logger[_0xc56d('0x3c')](util[_0xc56d('0x4b')](_0x4bb37c,{'showHidden':![],'depth':null}));}}});}exports[_0xc56d('0x4c')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index d8f34c8..e265d9c 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 _0x9ad2=['lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','hours','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start'];(function(_0x56fa5c,_0x46b71e){var _0x5cf91b=function(_0x4f3f03){while(--_0x4f3f03){_0x56fa5c['push'](_0x56fa5c['shift']());}};_0x5cf91b(++_0x46b71e);}(_0x9ad2,0xe0));var _0x29ad=function(_0x11c3e1,_0x2272ee){_0x11c3e1=_0x11c3e1-0x0;var _0x5bde8e=_0x9ad2[_0x11c3e1];return _0x5bde8e;};'use strict';var _=require(_0x29ad('0x0'));var moment=require(_0x29ad('0x1'));var Redis=require(_0x29ad('0x2'));var util=require(_0x29ad('0x3'));var config=require(_0x29ad('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x29ad('0x5'))(_0x29ad('0x6'));config[_0x29ad('0x7')]=_[_0x29ad('0x8')](config[_0x29ad('0x7')],{'host':_0x29ad('0x9'),'port':0x18eb});var io=require(_0x29ad('0xa'))(new Redis(config[_0x29ad('0x7')]));function closeInteractions(){var _0x2ec01e=[];return db['WhatsappInteraction'][_0x29ad('0xb')]({'raw':!![],'attributes':['id',_0x29ad('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x29ad('0xd'))}}})['then'](function(_0x454e72){if(_0x454e72&&_0x454e72['length']){_0x2ec01e=_['map'](_0x454e72||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2ec01e[_0x29ad('0xe')]());return db['WhatsappInteraction'][_0x29ad('0xf')]({'closeReason':'system','disposition':_0x29ad('0x10'),'closed':!![],'closedAt':moment()['format'](_0x29ad('0x11'))},{'where':{'id':_0x2ec01e}});}})[_0x29ad('0x12')](function(){if(_0x2ec01e&&_0x2ec01e[_0x29ad('0x13')]){logger['info'](_0x29ad('0x14'),_0x2ec01e[_0x29ad('0xe')]());for(var _0x19e843=0x0;_0x19e843<_0x2ec01e[_0x29ad('0x13')];_0x19e843++){io[_0x29ad('0x15')](_0x29ad('0x16'),{'id':_0x2ec01e[_0x19e843],'closed':!![]});}}})[_0x29ad('0x17')](function(_0xed88e4){logger[_0x29ad('0x18')](_0x29ad('0x19'),_0xed88e4?util[_0x29ad('0x1a')](_0xed88e4,{'showHidden':![],'depth':null}):'');});}exports[_0x29ad('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbeff=['join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x3d648e,_0x344357){var _0x1594b3=function(_0x19d3b0){while(--_0x19d3b0){_0x3d648e['push'](_0x3d648e['shift']());}};_0x1594b3(++_0x344357);}(_0xbeff,0x8d));var _0xfbef=function(_0x43a559,_0x2358ac){_0x43a559=_0x43a559-0x0;var _0xe67963=_0xbeff[_0x43a559];return _0xe67963;};'use strict';var _=require('lodash');var moment=require(_0xfbef('0x0'));var Redis=require(_0xfbef('0x1'));var util=require(_0xfbef('0x2'));var config=require(_0xfbef('0x3'));var db=require(_0xfbef('0x4'))['db'];var logger=require(_0xfbef('0x5'))('schedule');config[_0xfbef('0x6')]=_[_0xfbef('0x7')](config[_0xfbef('0x6')],{'host':_0xfbef('0x8'),'port':0x18eb});var io=require(_0xfbef('0x9'))(new Redis(config[_0xfbef('0x6')]));function closeInteractions(){var _0x4c677d=[];return db[_0xfbef('0xa')][_0xfbef('0xb')]({'raw':!![],'attributes':['id',_0xfbef('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xfbef('0xd')](0x18,_0xfbef('0xe'))}}})['then'](function(_0x3a069d){if(_0x3a069d&&_0x3a069d[_0xfbef('0xf')]){_0x4c677d=_[_0xfbef('0x10')](_0x3a069d||[],'id');logger[_0xfbef('0x11')](_0xfbef('0x12'),_0x4c677d[_0xfbef('0x13')]());return db[_0xfbef('0xa')]['update']({'closeReason':_0xfbef('0x14'),'disposition':_0xfbef('0x15'),'closed':!![],'closedAt':moment()[_0xfbef('0x16')](_0xfbef('0x17'))},{'where':{'id':_0x4c677d}});}})[_0xfbef('0x18')](function(){if(_0x4c677d&&_0x4c677d[_0xfbef('0xf')]){logger[_0xfbef('0x11')](_0xfbef('0x19'),_0x4c677d[_0xfbef('0x13')]());for(var _0x3c3f7c=0x0;_0x3c3f7c<_0x4c677d[_0xfbef('0xf')];_0x3c3f7c++){io[_0xfbef('0x1a')](_0xfbef('0x1b'),{'id':_0x4c677d[_0x3c3f7c],'closed':!![]});}}})[_0xfbef('0x1c')](function(_0x184209){logger[_0xfbef('0x1d')](_0xfbef('0x1e'),_0x184209?util[_0xfbef('0x1f')](_0x184209,{'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 8cf7472..2bb8b3d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a4b=['log','finished\x20populating','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then'];(function(_0x1f6a60,_0x1465de){var _0x526310=function(_0x18fef2){while(--_0x18fef2){_0x1f6a60['push'](_0x1f6a60['shift']());}};_0x526310(++_0x1465de);}(_0x0a4b,0xf4));var _0xb0a4=function(_0x8eca22,_0x172a81){_0x8eca22=_0x8eca22-0x0;var _0x108523=_0x0a4b[_0x8eca22];return _0x108523;};'use strict';var util=require('util');var db=require(_0xb0a4('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb0a4('0x1')]({'id':i,'firstName':_0xb0a4('0x2')+i,'lastName':_0xb0a4('0x3')+i,'phone':0xf879fb460+i,'email':_0xb0a4('0x4')+i+_0xb0a4('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb0a4('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb0a4('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb0a4('0x6')](),'updatedAt':Date[_0xb0a4('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb0a4('0x2')+i,'lastName':_0xb0a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xb0a4('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb0a4('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb0a4('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb0a4('0x6')]()});}db[_0xb0a4('0x7')][_0xb0a4('0x8')]({'where':{}})['then'](function(){return db[_0xb0a4('0x7')][_0xb0a4('0x9')](contacts);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),'contacts1');return db[_0xb0a4('0xd')]['destroy']({'where':{}});})[_0xb0a4('0xa')](function(){return db[_0xb0a4('0xd')][_0xb0a4('0x9')](hopper);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),_0xb0a4('0xe'));return db[_0xb0a4('0x7')]['bulkCreate'](contacts2);})[_0xb0a4('0xa')](function(){console['log'](_0xb0a4('0xc'),_0xb0a4('0xf'));return db[_0xb0a4('0xd')][_0xb0a4('0x9')](hopper2);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),'hopper2');})[_0xb0a4('0x10')](function(_0x36fb42){console['log'](_0x36fb42);}); \ No newline at end of file +var _0x149e=['contacts2','hopper2','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x566168,_0x4c39af){var _0x4e1f7a=function(_0x5ec3ee){while(--_0x5ec3ee){_0x566168['push'](_0x566168['shift']());}};_0x4e1f7a(++_0x4c39af);}(_0x149e,0xb6));var _0xe149=function(_0xc33495,_0x34d9a8){_0xc33495=_0xc33495-0x0;var _0x4033=_0x149e[_0xc33495];return _0x4033;};'use strict';var util=require(_0xe149('0x0'));var db=require(_0xe149('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xe149('0x2')+i,'lastName':_0xe149('0x3')+i,'phone':0xf879fb460+i,'email':_0xe149('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe149('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xe149('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xe149('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xe149('0x5')]({'id':i,'firstName':_0xe149('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xe149('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe149('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe149('0x6')](),'updatedAt':Date['now']()});}db[_0xe149('0x7')][_0xe149('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0xe149('0x9')](contacts);})[_0xe149('0xa')](function(){console[_0xe149('0xb')](_0xe149('0xc'),_0xe149('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0xe149('0xa')](function(){return db[_0xe149('0xe')][_0xe149('0x9')](hopper);})[_0xe149('0xa')](function(){console[_0xe149('0xb')](_0xe149('0xc'),_0xe149('0xf'));return db[_0xe149('0x7')][_0xe149('0x9')](contacts2);})['then'](function(){console['log'](_0xe149('0xc'),_0xe149('0x10'));return db['CmHopper'][_0xe149('0x9')](hopper2);})[_0xe149('0xa')](function(){console['log'](_0xe149('0xc'),_0xe149('0x11'));})['catch'](function(_0x230132){console[_0xe149('0xb')](_0x230132);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 89eecea..94014f9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a9d=['%s%s@xcally.com','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent','format'];(function(_0x2ed345,_0x59c3c2){var _0x1e812c=function(_0xdb7f76){while(--_0xdb7f76){_0x2ed345['push'](_0x2ed345['shift']());}};_0x1e812c(++_0x59c3c2);}(_0x2a9d,0x174));var _0xd2a9=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x2a9d[_0x148c09];return _0x18e613;};'use strict';var util=require(_0xd2a9('0x0'));var db=require(_0xd2a9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd2a9('0x2')]({'name':util['format'](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'fullname':util[_0xd2a9('0x5')](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'email':util[_0xd2a9('0x5')](_0xd2a9('0x6'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xd2a9('0x7'),'transport':[_0xd2a9('0x8'),'ws','wss'],'disallow':[_0xd2a9('0x9')],'allow':[_0xd2a9('0xa')],'defaultuser':util[_0xd2a9('0x5')](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'encryption':_0xd2a9('0xb'),'avpf':_0xd2a9('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd2a9('0xb'),'dtlsverify':'no','dtlscertfile':_0xd2a9('0xc'),'dtlsprivatekey':_0xd2a9('0xd'),'dtlssetup':_0xd2a9('0xe'),'callerid':util[_0xd2a9('0x5')](_0xd2a9('0xf'),util['format'](_0xd2a9('0x3'),_0xd2a9('0x4'),i),0xfa0+i)});}db['User'][_0xd2a9('0x10')](users)[_0xd2a9('0x11')](function(){console[_0xd2a9('0x12')](_0xd2a9('0x13'));})[_0xd2a9('0x14')](function(_0xa7c429){console['log'](_0xa7c429);}); \ No newline at end of file +var _0x0c86=['log','util','format','%s%s','agent','password','udp','wss','all','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user'];(function(_0x284fc3,_0x2c5973){var _0x4e1297=function(_0x481fa3){while(--_0x481fa3){_0x284fc3['push'](_0x284fc3['shift']());}};_0x4e1297(++_0x2c5973);}(_0x0c86,0x181));var _0x60c8=function(_0x4f7c31,_0x4ef205){_0x4f7c31=_0x4f7c31-0x0;var _0x1783a9=_0x0c86[_0x4f7c31];return _0x1783a9;};'use strict';var util=require(_0x60c8('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x60c8('0x1')](_0x60c8('0x2'),_0x60c8('0x3'),i),'fullname':util['format'](_0x60c8('0x2'),_0x60c8('0x3'),i),'email':util[_0x60c8('0x1')]('%s%s@xcally.com',_0x60c8('0x3'),i),'role':_0x60c8('0x3'),'password':_0x60c8('0x4'),'internal':0xfa0+i,'type':'friend','transport':[_0x60c8('0x5'),'ws',_0x60c8('0x6')],'disallow':[_0x60c8('0x7')],'allow':['ulaw'],'defaultuser':util['format'](_0x60c8('0x2'),_0x60c8('0x3'),i),'encryption':_0x60c8('0x8'),'avpf':'yes','force_avp':_0x60c8('0x8'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x60c8('0x9'),'dtlssetup':'actpass','callerid':util[_0x60c8('0x1')](_0x60c8('0xa'),util[_0x60c8('0x1')](_0x60c8('0x2'),_0x60c8('0x3'),i),0xfa0+i)});}db[_0x60c8('0xb')][_0x60c8('0xc')](users)[_0x60c8('0xd')](function(){console['log'](_0x60c8('0xe'));})['catch'](function(_0x3d9c6c){console[_0x60c8('0xf')](_0x3d9c6c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 748bbda..0842205 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80e6=['type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','Agents','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','ChatQueue','MailQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','User','role','agent','telephone'];(function(_0x5eb816,_0x1cdf68){var _0x5d948b=function(_0x444cfb){while(--_0x444cfb){_0x5eb816['push'](_0x5eb816['shift']());}};_0x5d948b(++_0x1cdf68);}(_0x80e6,0x1e7));var _0x680e=function(_0x205dc2,_0x104851){_0x205dc2=_0x205dc2-0x0;var _0x11e4b8=_0x80e6[_0x205dc2];return _0x11e4b8;};'use strict';var _=require('lodash');var util=require(_0x680e('0x0'));var BPromise=require(_0x680e('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x680e('0x2'));var queryQueues={'attributes':['id',_0x680e('0x3')],'include':[{'as':'Agents','model':db[_0x680e('0x4')],'attributes':['id','name',_0x680e('0x5')],'raw':!![],'where':{'role':_0x680e('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x680e('0x3')],'where':{'role':_0x680e('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x680e('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x680e('0x3')],'where':{'role':_0x680e('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x680e('0x3'),_0x680e('0x8')],'where':{'type':_0x680e('0x9')}};function getAssociatedResources(_0x1a691c,_0x1ec107,_0x18f7e3){return db[_0x680e('0xa')]['findOne']({'where':{'name':_0x1a691c,'userProfileId':_0x1ec107},'raw':!![]})['then'](function(_0x4d80a1){if(_0x4d80a1){if(_0x4d80a1[_0x680e('0xb')]){switch(_0x1a691c){case _0x680e('0xc'):case _0x680e('0xd'):case _0x680e('0xe'):case'SmsQueues':case _0x680e('0xf'):case _0x680e('0x10'):case _0x680e('0x11'):return db[_0x18f7e3][_0x680e('0x12')](queryQueues);case'Telephones':return db[_0x18f7e3][_0x680e('0x12')](queryTelephones);case _0x680e('0x13'):return db[_0x18f7e3][_0x680e('0x12')](queryTrunks);case _0x680e('0x14'):return db[_0x18f7e3][_0x680e('0x12')](queryCampaigns);}}else{return db[_0x680e('0x15')][_0x680e('0x12')]({'attributes':[_0x680e('0x16')],'where':{'sectionId':_0x4d80a1['id']},'raw':!![]})[_0x680e('0x17')](function(_0x3b1d9b){if(_0x3b1d9b){var _0x1993aa={'where':{'id':_[_0x680e('0x18')](_0x3b1d9b,_0x680e('0x16'))},'raw':!![]};switch(_0x18f7e3){case'User':_0x1993aa[_0x680e('0x19')][_0x680e('0x5')]=_0x680e('0x7');break;case _0x680e('0x1a'):_0x1993aa[_0x680e('0x19')][_0x680e('0x8')]=_0x680e('0x9');break;}return db[_0x18f7e3][_0x680e('0x12')](_0x1993aa);}else{return[];}});}}else{return[];}})['then'](function(_0x561f51){return _0x561f51;});}function joinOrLeaveQueues(_0x9c69d4,_0x1b00e3,_0x2ee5b0,_0x113969){_0x9c69d4[_0x1b00e3](util[_0x680e('0x1b')]('%s:queue:%s',_0x2ee5b0,_0x113969[_0x680e('0x3')]));if(_0x113969[_0x680e('0x1c')]){for(var _0x5fc8d0=0x0;_0x5fc8d0<_0x113969[_0x680e('0x1c')]['length'];_0x5fc8d0+=0x1){_0x9c69d4[_0x1b00e3](util[_0x680e('0x1b')]('user:%s',_0x113969[_0x680e('0x1c')][_0x5fc8d0][_0x680e('0x3')]));}}}function joinOrLeave(_0x5f1666,_0x27ad3d,_0x5d22e1){var _0x1e1eb6;if(_0x5f1666[_0x680e('0x1d')][_0x680e('0x1e')]['id']){db[_0x680e('0x4')][_0x680e('0x1f')]({'attributes':['id',_0x680e('0x3'),_0x680e('0x5'),'userProfileId'],'where':{'id':_0x5f1666[_0x680e('0x1d')][_0x680e('0x1e')]['id']},'include':[{'model':db[_0x680e('0x20')],'as':_0x680e('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x22')],'as':_0x680e('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x24')],'as':_0x680e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x26')],'as':_0x680e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x28')],'as':_0x680e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x2a')],'as':_0x680e('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x545973){if(_0x545973){_0x1e1eb6=_0x545973;_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x2c'),_0x545973['name']));var _0x1042e2=[];switch(_0x545973[_0x680e('0x5')]){case _0x680e('0x2d'):_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x1042e2[_0x680e('0x30')](db[_0x680e('0x31')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['ChatQueue'][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x32')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x33')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['MailQueue'][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x34')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x35')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['User'][_0x680e('0x12')](queryTelephones));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x36')]['findAll'](queryTrunks));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x1a')][_0x680e('0x12')](queryCampaigns));_0x1042e2[_0x680e('0x30')](db['User'][_0x680e('0x12')](queryAgents));break;case'user':_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xc'),_0x545973[_0x680e('0x37')],_0x680e('0x31')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xd'),_0x545973[_0x680e('0x37')],_0x680e('0x38')));_0x1042e2['push'](getAssociatedResources(_0x680e('0xe'),_0x545973[_0x680e('0x37')],_0x680e('0x32')));_0x1042e2['push'](getAssociatedResources('SmsQueues',_0x545973['userProfileId'],_0x680e('0x33')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xf'),_0x545973[_0x680e('0x37')],_0x680e('0x39')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x10'),_0x545973[_0x680e('0x37')],_0x680e('0x34')));_0x1042e2[_0x680e('0x30')](getAssociatedResources('WhatsappQueues',_0x545973[_0x680e('0x37')],_0x680e('0x35')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x3a'),_0x545973[_0x680e('0x37')],_0x680e('0x4')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x13'),_0x545973[_0x680e('0x37')],_0x680e('0x36')));_0x1042e2['push'](getAssociatedResources(_0x680e('0x14'),_0x545973[_0x680e('0x37')],_0x680e('0x1a')));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x4')][_0x680e('0x12')](queryAgents));break;case _0x680e('0x6'):_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));_0x1042e2['push'](_0x545973[_0x680e('0x3b')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3c')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3d')]({'attributes':['id','name']}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3e')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2['push'](_0x545973[_0x680e('0x3f')]({'attributes':['id','name']}));_0x1042e2['push'](_0x545973[_0x680e('0x40')]({'attributes':['id','name']}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x41')]({'attributes':['id',_0x680e('0x3')]}));break;}return BPromise['all'](_0x1042e2);}})['then'](function(_0x1cae1e){if(_0x1cae1e&&_0x1cae1e[_0x680e('0x42')]){for(var _0x138a27=0x0;_0x138a27<_0x1cae1e[_0x680e('0x42')];_0x138a27+=0x1){for(var _0x3e3716=0x0;_0x3e3716<_0x1cae1e[_0x138a27][_0x680e('0x42')];_0x3e3716+=0x1){switch(_0x138a27){case 0x0:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x43'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x1:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'chat',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x2:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x44'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x3:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x45'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x4:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'mail',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x5:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'openchannel',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x6:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x46'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x7:if(_0x1e1eb6[_0x680e('0x5')]!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x47'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0x8:if(_0x1e1eb6[_0x680e('0x5')]!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util['format'](_0x680e('0x48'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0x9:if(_0x1e1eb6['role']!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x49'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x8')],_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0xa:_0x5f1666[_0x27ad3d](util['format'](_0x680e('0x2c'),_0x1cae1e[_0x138a27][_0x3e3716]['name']));break;}}}}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x382487=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x21')],'id');return _0x1e1eb6['removeChatInteractions'](_0x382487)['then'](function(){for(var _0x175072=0x0;_0x175072<_0x382487[_0x680e('0x42')];_0x175072+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x4c'),{'ChatInteractionId':Number(_0x382487[_0x175072]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x36b3dc=_['map'](_0x1e1eb6[_0x680e('0x23')],'id');return _0x1e1eb6[_0x680e('0x4d')](_0x36b3dc)[_0x680e('0x17')](function(){for(var _0x9150a8=0x0;_0x9150a8<_0x36b3dc['length'];_0x9150a8+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x4e'),{'MailInteractionId':Number(_0x36b3dc[_0x9150a8]),'UserId':Number(_0x1e1eb6['id'])});}});}})['then'](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x1b685b=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x25')],'id');return _0x1e1eb6['removeFaxInteractions'](_0x1b685b)[_0x680e('0x17')](function(){for(var _0xc2497a=0x0;_0xc2497a<_0x1b685b[_0x680e('0x42')];_0xc2497a+=0x1){_0x5d22e1[_0x680e('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1b685b[_0xc2497a]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x251983=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x27')],'id');return _0x1e1eb6[_0x680e('0x4f')](_0x251983)[_0x680e('0x17')](function(){for(var _0x41bb34=0x0;_0x41bb34<_0x251983['length'];_0x41bb34+=0x1){_0x5d22e1[_0x680e('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x251983[_0x41bb34]),'UserId':Number(_0x1e1eb6['id'])});}});}})['then'](function(){if(_0x27ad3d==='leave'){var _0x27a4cf=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x29')],'id');return _0x1e1eb6[_0x680e('0x50')](_0x27a4cf)[_0x680e('0x17')](function(){for(var _0x996eb6=0x0;_0x996eb6<_0x27a4cf[_0x680e('0x42')];_0x996eb6+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x51'),{'OpenchannelInteractionId':Number(_0x27a4cf[_0x996eb6]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x1dc0f6=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x2b')],'id');return _0x1e1eb6[_0x680e('0x52')](_0x1dc0f6)[_0x680e('0x17')](function(){for(var _0x417368=0x0;_0x417368<_0x1dc0f6[_0x680e('0x42')];_0x417368+=0x1){_0x5d22e1['emit'](_0x680e('0x53'),{'WhatsappInteractionId':Number(_0x1dc0f6[_0x417368]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x54')](function(_0x1ea8a2){_0x5f1666['log'](_0x1ea8a2);});}}function onDisconnect(_0x5ee9c1,_0xfb5948){joinOrLeave(_0x5ee9c1,_0x680e('0x4a'),_0xfb5948);}function onConnect(_0x48c128){joinOrLeave(_0x48c128,_0x680e('0x55'));}exports[_0x680e('0x56')]=function(_0x4227fd){_0x4227fd['on'](_0x680e('0x57'),function(_0xb8f6a3){_0xb8f6a3[_0x680e('0x58')](0x0);_0xb8f6a3[_0x680e('0x59')]=_0xb8f6a3['request'][_0x680e('0x57')][_0x680e('0x5a')]+':'+_0xb8f6a3[_0x680e('0x5b')][_0x680e('0x57')][_0x680e('0x5c')];_0xb8f6a3[_0x680e('0x5d')]=new Date();_0xb8f6a3[_0x680e('0x5e')]=function(_0x19095f){console[_0x680e('0x5e')](_0x680e('0x5f')+_0xb8f6a3[_0x680e('0x60')][_0x680e('0x3')]+'['+_0xb8f6a3[_0x680e('0x59')]+']',_0x19095f);};_0xb8f6a3['on']('disconnect',function(){onDisconnect(_0xb8f6a3,_0x4227fd);_0xb8f6a3[_0x680e('0x5e')](_0x680e('0x61'));});onConnect(_0xb8f6a3);_0xb8f6a3[_0x680e('0x5e')](_0x680e('0x62'));});}; \ No newline at end of file +var _0xb939=['trunk:%s','campaign:%s:%s','user_has_chat_interactions:remove','user_has_mail_interactions:remove','leave','removeFaxInteractions','emit','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','Trunk','user','SmsQueues','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','getChatQueues','getSmsQueues','getWhatsappQueues','chat','fax','sms','openchannel'];(function(_0x19e529,_0x4d5347){var _0x308117=function(_0x267f8d){while(--_0x267f8d){_0x19e529['push'](_0x19e529['shift']());}};_0x308117(++_0x4d5347);}(_0xb939,0x137));var _0x9b93=function(_0x4e658c,_0x3139a5){_0x4e658c=_0x4e658c-0x0;var _0x3a2973=_0xb939[_0x4e658c];return _0x3a2973;};'use strict';var _=require(_0x9b93('0x0'));var util=require('util');var BPromise=require(_0x9b93('0x1'));var db=require(_0x9b93('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x9b93('0x3')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0x9b93('0x4')],'raw':!![],'where':{'role':_0x9b93('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x9b93('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9b93('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x9b93('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x9b93('0x7')],'where':{'type':_0x9b93('0x8')}};function getAssociatedResources(_0x407290,_0x5492aa,_0x56d2d0){return db[_0x9b93('0x9')][_0x9b93('0xa')]({'where':{'name':_0x407290,'userProfileId':_0x5492aa},'raw':!![]})[_0x9b93('0xb')](function(_0x6a8218){if(_0x6a8218){if(_0x6a8218[_0x9b93('0xc')]){switch(_0x407290){case _0x9b93('0xd'):case _0x9b93('0xe'):case _0x9b93('0xf'):case'SmsQueues':case _0x9b93('0x10'):case _0x9b93('0x11'):case _0x9b93('0x12'):return db[_0x56d2d0]['findAll'](queryQueues);case _0x9b93('0x13'):return db[_0x56d2d0][_0x9b93('0x14')](queryTelephones);case _0x9b93('0x15'):return db[_0x56d2d0][_0x9b93('0x14')](queryTrunks);case _0x9b93('0x16'):return db[_0x56d2d0][_0x9b93('0x14')](queryCampaigns);}}else{return db[_0x9b93('0x17')][_0x9b93('0x14')]({'attributes':[_0x9b93('0x18')],'where':{'sectionId':_0x6a8218['id']},'raw':!![]})['then'](function(_0x28f58d){if(_0x28f58d){var _0x325912={'where':{'id':_[_0x9b93('0x19')](_0x28f58d,_0x9b93('0x18'))},'raw':!![]};switch(_0x56d2d0){case _0x9b93('0x1a'):_0x325912[_0x9b93('0x1b')][_0x9b93('0x4')]=_0x9b93('0x6');break;case _0x9b93('0x1c'):_0x325912[_0x9b93('0x1b')][_0x9b93('0x7')]='ivr';break;}return db[_0x56d2d0][_0x9b93('0x14')](_0x325912);}else{return[];}});}}else{return[];}})[_0x9b93('0xb')](function(_0x4964a8){return _0x4964a8;});}function joinOrLeaveQueues(_0x2f411b,_0x5e0b4c,_0x31cf9d,_0x490313){_0x2f411b[_0x5e0b4c](util[_0x9b93('0x1d')](_0x9b93('0x1e'),_0x31cf9d,_0x490313[_0x9b93('0x3')]));if(_0x490313[_0x9b93('0x1f')]){for(var _0x1bbd4f=0x0;_0x1bbd4f<_0x490313['Agents'][_0x9b93('0x20')];_0x1bbd4f+=0x1){_0x2f411b[_0x5e0b4c](util['format'](_0x9b93('0x21'),_0x490313[_0x9b93('0x1f')][_0x1bbd4f][_0x9b93('0x3')]));}}}function joinOrLeave(_0x256ae9,_0x319f5b,_0x464d8a){var _0x1118ed;if(_0x256ae9['handshake'][_0x9b93('0x22')]['id']){db['User'][_0x9b93('0x23')]({'attributes':['id',_0x9b93('0x3'),_0x9b93('0x4'),_0x9b93('0x24')],'where':{'id':_0x256ae9[_0x9b93('0x25')][_0x9b93('0x22')]['id']},'include':[{'model':db[_0x9b93('0x26')],'as':_0x9b93('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b93('0x28')],'as':_0x9b93('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x9b93('0x2a')],'as':_0x9b93('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9b93('0x2c')],'as':_0x9b93('0x2d'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x1a1801){if(_0x1a1801){_0x1118ed=_0x1a1801;_0x256ae9[_0x319f5b](util['format']('user:%s',_0x1a1801['name']));var _0x112a89=[];switch(_0x1a1801[_0x9b93('0x4')]){case _0x9b93('0x2e'):_0x256ae9[_0x319f5b](_0x9b93('0x2f'));_0x256ae9[_0x319f5b](_0x9b93('0x30'));if(queryQueues[_0x9b93('0x31')]('include')){delete queryQueues[_0x9b93('0x32')];}_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x34')][_0x9b93('0x14')](queryQueues));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x35')][_0x9b93('0x14')](queryQueues));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x36')][_0x9b93('0x14')](queryQueues));_0x112a89[_0x9b93('0x33')](db['SmsQueue']['findAll'](queryQueues));_0x112a89[_0x9b93('0x33')](db['MailQueue'][_0x9b93('0x14')](queryQueues));_0x112a89['push'](db['OpenchannelQueue'][_0x9b93('0x14')](queryQueues));_0x112a89['push'](db['WhatsappQueue'][_0x9b93('0x14')](queryQueues));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x1a')][_0x9b93('0x14')](queryTelephones));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x37')][_0x9b93('0x14')](queryTrunks));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x1c')][_0x9b93('0x14')](queryCampaigns));_0x112a89['push'](db['User']['findAll'](queryAgents));break;case _0x9b93('0x38'):_0x256ae9[_0x319f5b]('voice:inbound');_0x256ae9[_0x319f5b]('voice:outbound');_0x112a89['push'](getAssociatedResources(_0x9b93('0xd'),_0x1a1801[_0x9b93('0x24')],_0x9b93('0x34')));_0x112a89[_0x9b93('0x33')](getAssociatedResources(_0x9b93('0xe'),_0x1a1801[_0x9b93('0x24')],_0x9b93('0x35')));_0x112a89['push'](getAssociatedResources(_0x9b93('0xf'),_0x1a1801[_0x9b93('0x24')],_0x9b93('0x36')));_0x112a89[_0x9b93('0x33')](getAssociatedResources(_0x9b93('0x39'),_0x1a1801[_0x9b93('0x24')],_0x9b93('0x3a')));_0x112a89[_0x9b93('0x33')](getAssociatedResources(_0x9b93('0x10'),_0x1a1801[_0x9b93('0x24')],_0x9b93('0x3b')));_0x112a89['push'](getAssociatedResources('OpenchannelQueues',_0x1a1801[_0x9b93('0x24')],_0x9b93('0x3c')));_0x112a89['push'](getAssociatedResources('WhatsappQueues',_0x1a1801[_0x9b93('0x24')],_0x9b93('0x3d')));_0x112a89[_0x9b93('0x33')](getAssociatedResources(_0x9b93('0x13'),_0x1a1801['userProfileId'],'User'));_0x112a89[_0x9b93('0x33')](getAssociatedResources(_0x9b93('0x15'),_0x1a1801['userProfileId'],'Trunk'));_0x112a89[_0x9b93('0x33')](getAssociatedResources('IvrCampaigns',_0x1a1801['userProfileId'],_0x9b93('0x1c')));_0x112a89[_0x9b93('0x33')](db[_0x9b93('0x1a')][_0x9b93('0x14')](queryAgents));break;case'agent':_0x256ae9[_0x319f5b](_0x9b93('0x2f'));_0x256ae9[_0x319f5b]('voice:outbound');_0x112a89[_0x9b93('0x33')](_0x1a1801['getVoiceQueues']({'attributes':['id',_0x9b93('0x3')]}));_0x112a89[_0x9b93('0x33')](_0x1a1801[_0x9b93('0x3e')]({'attributes':['id','name']}));_0x112a89[_0x9b93('0x33')](_0x1a1801['getFaxQueues']({'attributes':['id',_0x9b93('0x3')]}));_0x112a89['push'](_0x1a1801[_0x9b93('0x3f')]({'attributes':['id',_0x9b93('0x3')]}));_0x112a89[_0x9b93('0x33')](_0x1a1801['getMailQueues']({'attributes':['id','name']}));_0x112a89['push'](_0x1a1801['getOpenchannelQueues']({'attributes':['id',_0x9b93('0x3')]}));_0x112a89[_0x9b93('0x33')](_0x1a1801[_0x9b93('0x40')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x112a89);}})[_0x9b93('0xb')](function(_0x1e3182){if(_0x1e3182&&_0x1e3182[_0x9b93('0x20')]){for(var _0x1865b9=0x0;_0x1865b9<_0x1e3182[_0x9b93('0x20')];_0x1865b9+=0x1){for(var _0x17a9ea=0x0;_0x17a9ea<_0x1e3182[_0x1865b9]['length'];_0x17a9ea+=0x1){switch(_0x1865b9){case 0x0:joinOrLeaveQueues(_0x256ae9,_0x319f5b,'voice',_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x1:joinOrLeaveQueues(_0x256ae9,_0x319f5b,_0x9b93('0x41'),_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x2:joinOrLeaveQueues(_0x256ae9,_0x319f5b,_0x9b93('0x42'),_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x3:joinOrLeaveQueues(_0x256ae9,_0x319f5b,_0x9b93('0x43'),_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x4:joinOrLeaveQueues(_0x256ae9,_0x319f5b,'mail',_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x5:joinOrLeaveQueues(_0x256ae9,_0x319f5b,_0x9b93('0x44'),_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x6:joinOrLeaveQueues(_0x256ae9,_0x319f5b,'whatsapp',_0x1e3182[_0x1865b9][_0x17a9ea]);break;case 0x7:if(_0x1118ed['role']!==_0x9b93('0x5'))_0x256ae9[_0x319f5b](util[_0x9b93('0x1d')]('telephone:%s',_0x1e3182[_0x1865b9][_0x17a9ea][_0x9b93('0x3')]));break;case 0x8:if(_0x1118ed[_0x9b93('0x4')]!=='agent')_0x256ae9[_0x319f5b](util[_0x9b93('0x1d')](_0x9b93('0x45'),_0x1e3182[_0x1865b9][_0x17a9ea][_0x9b93('0x3')]));break;case 0x9:if(_0x1118ed['role']!=='agent')_0x256ae9[_0x319f5b](util[_0x9b93('0x1d')](_0x9b93('0x46'),_0x1e3182[_0x1865b9][_0x17a9ea][_0x9b93('0x7')],_0x1e3182[_0x1865b9][_0x17a9ea][_0x9b93('0x3')]));break;case 0xa:_0x256ae9[_0x319f5b](util[_0x9b93('0x1d')]('user:%s',_0x1e3182[_0x1865b9][_0x17a9ea]['name']));break;}}}}})[_0x9b93('0xb')](function(){if(_0x319f5b==='leave'){var _0x332f10=_[_0x9b93('0x19')](_0x1118ed[_0x9b93('0x27')],'id');return _0x1118ed['removeChatInteractions'](_0x332f10)[_0x9b93('0xb')](function(){for(var _0x36772e=0x0;_0x36772e<_0x332f10[_0x9b93('0x20')];_0x36772e+=0x1){_0x464d8a['emit'](_0x9b93('0x47'),{'ChatInteractionId':Number(_0x332f10[_0x36772e]),'UserId':Number(_0x1118ed['id'])});}});}})[_0x9b93('0xb')](function(){if(_0x319f5b==='leave'){var _0x1c8079=_[_0x9b93('0x19')](_0x1118ed[_0x9b93('0x29')],'id');return _0x1118ed['removeMailInteractions'](_0x1c8079)['then'](function(){for(var _0x458ae2=0x0;_0x458ae2<_0x1c8079[_0x9b93('0x20')];_0x458ae2+=0x1){_0x464d8a['emit'](_0x9b93('0x48'),{'MailInteractionId':Number(_0x1c8079[_0x458ae2]),'UserId':Number(_0x1118ed['id'])});}});}})[_0x9b93('0xb')](function(){if(_0x319f5b===_0x9b93('0x49')){var _0x51fc96=_[_0x9b93('0x19')](_0x1118ed[_0x9b93('0x2b')],'id');return _0x1118ed[_0x9b93('0x4a')](_0x51fc96)[_0x9b93('0xb')](function(){for(var _0x46fb28=0x0;_0x46fb28<_0x51fc96[_0x9b93('0x20')];_0x46fb28+=0x1){_0x464d8a[_0x9b93('0x4b')](_0x9b93('0x4c'),{'FaxInteractionId':Number(_0x51fc96[_0x46fb28]),'UserId':Number(_0x1118ed['id'])});}});}})[_0x9b93('0xb')](function(){if(_0x319f5b===_0x9b93('0x49')){var _0x38a9d9=_['map'](_0x1118ed[_0x9b93('0x4d')],'id');return _0x1118ed[_0x9b93('0x4e')](_0x38a9d9)['then'](function(){for(var _0x47ca0d=0x0;_0x47ca0d<_0x38a9d9[_0x9b93('0x20')];_0x47ca0d+=0x1){_0x464d8a[_0x9b93('0x4b')](_0x9b93('0x4f'),{'SmsInteractionId':Number(_0x38a9d9[_0x47ca0d]),'UserId':Number(_0x1118ed['id'])});}});}})[_0x9b93('0xb')](function(){if(_0x319f5b===_0x9b93('0x49')){var _0x20a92a=_[_0x9b93('0x19')](_0x1118ed[_0x9b93('0x2d')],'id');return _0x1118ed['removeOpenchannelInteractions'](_0x20a92a)[_0x9b93('0xb')](function(){for(var _0xb86577=0x0;_0xb86577<_0x20a92a['length'];_0xb86577+=0x1){_0x464d8a[_0x9b93('0x4b')](_0x9b93('0x50'),{'OpenchannelInteractionId':Number(_0x20a92a[_0xb86577]),'UserId':Number(_0x1118ed['id'])});}});}})[_0x9b93('0xb')](function(){if(_0x319f5b===_0x9b93('0x49')){var _0x251954=_[_0x9b93('0x19')](_0x1118ed['WhatsappInteractions'],'id');return _0x1118ed[_0x9b93('0x51')](_0x251954)[_0x9b93('0xb')](function(){for(var _0x5acc41=0x0;_0x5acc41<_0x251954['length'];_0x5acc41+=0x1){_0x464d8a[_0x9b93('0x4b')](_0x9b93('0x52'),{'WhatsappInteractionId':Number(_0x251954[_0x5acc41]),'UserId':Number(_0x1118ed['id'])});}});}})['catch'](function(_0x53ee89){_0x256ae9[_0x9b93('0x53')](_0x53ee89);});}}function onDisconnect(_0x436624,_0x307168){joinOrLeave(_0x436624,'leave',_0x307168);}function onConnect(_0x1aeba5){joinOrLeave(_0x1aeba5,_0x9b93('0x54'));}exports['default']=function(_0x3ba1bd){_0x3ba1bd['on'](_0x9b93('0x55'),function(_0x57fe98){_0x57fe98['setMaxListeners'](0x0);_0x57fe98[_0x9b93('0x56')]=_0x57fe98[_0x9b93('0x57')][_0x9b93('0x55')][_0x9b93('0x58')]+':'+_0x57fe98[_0x9b93('0x57')][_0x9b93('0x55')][_0x9b93('0x59')];_0x57fe98[_0x9b93('0x5a')]=new Date();_0x57fe98['log']=function(_0x47da2b){console[_0x9b93('0x53')](_0x9b93('0x5b')+_0x57fe98[_0x9b93('0x5c')][_0x9b93('0x3')]+'['+_0x57fe98['address']+']',_0x47da2b);};_0x57fe98['on']('disconnect',function(){onDisconnect(_0x57fe98,_0x3ba1bd);_0x57fe98[_0x9b93('0x53')](_0x9b93('0x5d'));});onConnect(_0x57fe98);_0x57fe98[_0x9b93('0x53')](_0x9b93('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index e53c843..7c19660 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 _0xb864=['OpenchannelMessage','request','EventManager','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','direction','then','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','opened','resolve','name','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','callback','util','../../mysqldb','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','newmessage','ChatOfflineMessage','newinteraction','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb864,0x162));var _0x4b86=function(_0x37f8ef,_0x48c182){_0x37f8ef=_0x37f8ef-0x0;var _0x135464=_0xb864[_0x37f8ef];return _0x135464;};'use strict';var util=require(_0x4b86('0x0'));var db=require(_0x4b86('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x4b86('0x2'))(_0x4b86('0x3'));var client=jayson[_0x4b86('0x4')][_0x4b86('0x5')]({'port':0x232a});var triggers=[{'channel':_0x4b86('0x6'),'model':_0x4b86('0x7'),'event':_0x4b86('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4b86('0x6'),'model':_0x4b86('0x7'),'event':_0x4b86('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x4b86('0x8'),'condition':_0x4b86('0xa'),'callback':afterCreateMessage},{'channel':_0x4b86('0x6'),'model':_0x4b86('0xb'),'event':'afterCreate','condition':_0x4b86('0xa'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x4b86('0x8'),'condition':_0x4b86('0xc'),'callback':afterCreate},{'channel':_0x4b86('0xd'),'model':_0x4b86('0xe'),'event':_0x4b86('0x9'),'condition':_0x4b86('0xf'),'callback':afterUpdate},{'channel':_0x4b86('0xd'),'model':_0x4b86('0x10'),'event':_0x4b86('0x8'),'condition':_0x4b86('0xa'),'callback':afterCreateMessage},{'channel':_0x4b86('0x11'),'model':_0x4b86('0x12'),'event':_0x4b86('0x8'),'condition':_0x4b86('0xc'),'callback':afterCreate},{'channel':_0x4b86('0x11'),'model':'WhatsappInteraction','event':_0x4b86('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4b86('0x11'),'model':'WhatsappMessage','event':_0x4b86('0x8'),'condition':_0x4b86('0xa'),'callback':afterCreateMessage},{'channel':_0x4b86('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':_0x4b86('0xc'),'callback':afterCreate},{'channel':_0x4b86('0x13'),'model':_0x4b86('0x14'),'event':_0x4b86('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x4b86('0x13'),'model':_0x4b86('0x15'),'event':_0x4b86('0x8'),'condition':_0x4b86('0xa'),'callback':afterCreateMessage},{'channel':_0x4b86('0x16'),'model':_0x4b86('0x17'),'event':_0x4b86('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x4b86('0x16'),'model':_0x4b86('0x17'),'event':'afterUpdate','condition':_0x4b86('0xf'),'callback':afterUpdate},{'channel':_0x4b86('0x16'),'model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x4b86('0x18'),'model':_0x4b86('0x19'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x4b86('0x18'),'model':'OpenchannelInteraction','event':_0x4b86('0x9'),'condition':_0x4b86('0xf'),'callback':afterUpdate},{'channel':_0x4b86('0x18'),'model':_0x4b86('0x1a'),'event':'afterCreate','condition':_0x4b86('0xa'),'callback':afterCreateMessage}];function request(_0x30e5e6){return client[_0x4b86('0x1b')](_0x4b86('0x1c'),_0x30e5e6)['then'](function(_0xb0f538){logger[_0x4b86('0x1d')](_0x4b86('0x1e'),_0x4b86('0x1c'),_0xb0f538);if(_0xb0f538[_0x4b86('0x1f')]){if(_0xb0f538[_0x4b86('0x1f')][_0x4b86('0x20')]===0x1f4){logger['error'](_0x4b86('0x1e'),_0x4b86('0x1c'),_0xb0f538['error']);}}})[_0x4b86('0x21')](function(_0x477e55){logger[_0x4b86('0x1f')](_0x4b86('0x1e'),_0x4b86('0x1c'),_0x477e55);});}function afterCreateMessage(_0x4afd1a){return function(_0x16cca9){_0x16cca9=_0x16cca9['get']({'plain':!![]});_0x16cca9[_0x4b86('0x22')]=_0x4afd1a;_0x16cca9[_0x4b86('0x23')]=_0x4afd1a;_0x16cca9[_0x4b86('0x24')]=_0x16cca9[_0x4b86('0x25')];Promise['resolve']()[_0x4b86('0x26')](function(){if(typeof _0x16cca9['ContactId']===_0x4b86('0x27'))return null;var _0x34cedb=_0x4b86('0x28')+_0x16cca9[_0x4b86('0x29')];return db[_0x4b86('0x2a')][_0x4b86('0x2b')](_0x34cedb,{'type':db[_0x4b86('0x2c')][_0x4b86('0x2d')][_0x4b86('0x2e')],'raw':!![]});})[_0x4b86('0x26')](function(_0x23a009){if(_0x23a009){_0x16cca9[_0x4b86('0x2f')]=_0x23a009[0x0];}if(typeof _0x16cca9[_0x4b86('0x30')]===_0x4b86('0x27'))return;return getAgent(_0x16cca9[_0x4b86('0x30')]);})[_0x4b86('0x26')](function(_0x286f5a){if(_0x286f5a){_0x16cca9[_0x4b86('0x31')]=util[_0x4b86('0x32')](_0x4b86('0x33'),_0x286f5a['name']);_0x16cca9[_0x4b86('0x34')]=_0x286f5a;_0x16cca9['channel']=_0x4afd1a;return request({'event':_0x4b86('0x35'),'message':_0x16cca9});}else{return request({'event':_0x4b86('0x36'),'message':_0x16cca9});}})[_0x4b86('0x21')](function(_0x13d3e9){logger['error'](_0x4b86('0x1e'),_0x4b86('0x37'),_0x13d3e9);});};}function afterCreateOfflineMessage(_0x13b89d){return function(_0x26eb0d){_0x26eb0d=_0x26eb0d[_0x4b86('0x38')]({'plain':!![]});_0x26eb0d[_0x4b86('0x22')]=_0x13b89d;_0x26eb0d[_0x4b86('0x23')]=_0x13b89d;_0x26eb0d['event']=_0x4b86('0x39');return request({'event':_0x26eb0d[_0x4b86('0x24')],'message':_0x26eb0d});};}function afterCreate(_0x40c2e6,_0x5d4f87){return function(_0x1bf918){_0x1bf918=_0x1bf918[_0x4b86('0x38')]({'plain':!![]});_0x1bf918[_0x4b86('0x22')]=_0x40c2e6;_0x1bf918[_0x4b86('0x23')]=_0x40c2e6;_0x1bf918[_0x4b86('0x24')]=_0x4b86('0x3a');Promise[_0x4b86('0x3b')]()[_0x4b86('0x26')](function(){var _0xdbf547=_0x4b86('0x28')+_0x1bf918[_0x4b86('0x29')];return db[_0x4b86('0x2a')][_0x4b86('0x2b')](_0xdbf547,{'type':db['Sequelize'][_0x4b86('0x2d')]['SELECT'],'raw':!![]});})[_0x4b86('0x26')](function(_0x26881a){if(_0x26881a){_0x1bf918[_0x4b86('0x2f')]=_0x26881a[0x0];}if(typeof _0x1bf918[_0x4b86('0x30')]===_0x4b86('0x27'))return;return getAgent(_0x1bf918[_0x4b86('0x30')]);})[_0x4b86('0x26')](function(_0x15817c){if(_0x15817c){_0x1bf918['interface']=util['format'](_0x4b86('0x33'),_0x15817c[_0x4b86('0x3c')]);_0x1bf918[_0x4b86('0x34')]=_0x15817c;}return request({'event':_0x5d4f87,'message':_0x1bf918});})['catch'](function(_0x2fc158){logger[_0x4b86('0x1f')]('Trigger,\x20%s',_0x4b86('0x3d'),_0x2fc158);});};}function afterUpdate(_0x460429){return function(_0xdbb35b){var _0x2dada7=_0xdbb35b[_0x4b86('0x3e')](_0x4b86('0x3f'))&&_0xdbb35b[_0x4b86('0x3f')];var _0x478d5c=_0xdbb35b[_0x4b86('0x3e')](_0x4b86('0x40'));if(_0x2dada7||_0x478d5c){var _0x551c25=_0x2dada7?_0x4b86('0xf'):_0x4b86('0x40');var _0x1b1ffa=_0xdbb35b['get']({'plain':!![]});_0x1b1ffa['channel']=_0x460429;_0x1b1ffa[_0x4b86('0x23')]=_0x460429;_0x1b1ffa[_0x4b86('0x24')]=_0x2dada7?_0x4b86('0x3f'):_0x4b86('0x40');var _0x3b90c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1b1ffa['ContactId'];return db[_0x4b86('0x2a')][_0x4b86('0x2b')](_0x3b90c6,{'type':db['Sequelize'][_0x4b86('0x2d')][_0x4b86('0x2e')],'raw':!![]})['then'](function(_0x51b1f2){if(_0x51b1f2){_0x1b1ffa[_0x4b86('0x2f')]=_0x51b1f2[0x0];}if(typeof _0x1b1ffa['UserId']==='undefined')return;return getAgent(_0x1b1ffa['UserId']);})[_0x4b86('0x26')](function(_0x17711d){if(_0x17711d){_0x1b1ffa['interface']=util[_0x4b86('0x32')]('SIP/%s',_0x17711d[_0x4b86('0x3c')]);_0x1b1ffa['agent']=_0x17711d;}return request({'event':_0x551c25,'message':_0x1b1ffa});})[_0x4b86('0x21')](function(_0x1cc085){logger[_0x4b86('0x1f')](_0x4b86('0x1e'),_0x4b86('0x41'),_0x1cc085);});}};}function getAgent(_0x4e2b7b){return db[_0x4b86('0x42')][_0x4b86('0x43')]({'where':{'id':_0x4e2b7b},'attributes':['id','name',_0x4b86('0x44'),'email',_0x4b86('0x45')],'raw':!![]})[_0x4b86('0x26')](function(_0x499c9a){return _0x499c9a;});}exports[_0x4b86('0x46')]=function(){for(var _0x4acab9=0x0;_0x4acab9=_0x7578fb['agents']){throw Error(_0x702d('0x13'));}_0x2eb2e9(_0x2fc8fd);})[_0x702d('0x14')](function(_0x6b141c){_0x1e3f47(_0x6b141c);});});}; \ No newline at end of file +var _0xc3d6=['clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','voice','mail','chat','whatsapp','openchannel','toLowerCase','includes'];(function(_0x3652d6,_0x5e755e){var _0x58bb60=function(_0xf4054a){while(--_0xf4054a){_0x3652d6['push'](_0x3652d6['shift']());}};_0x58bb60(++_0x5e755e);}(_0xc3d6,0x115));var _0x6c3d=function(_0x320880,_0x4ea585){_0x320880=_0x320880-0x0;var _0x5e4a4a=_0xc3d6[_0x320880];return _0x5e4a4a;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x6c3d('0x0'))['db'];var util=require('./license/util');var channels=[_0x6c3d('0x1'),_0x6c3d('0x2'),_0x6c3d('0x3'),'fax','sms',_0x6c3d('0x4'),_0x6c3d('0x5')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x27320e){_0x27320e=_0x27320e[_0x6c3d('0x6')]();return _[_0x6c3d('0x7')](channels,_0x27320e);};exports[_0x6c3d('0x8')]=function(_0x1c2142,_0x2805b7,_0x30aab6,_0x3972fc){var _0x2878bd={'loginAttempts':_0x2805b7,'blocked':_0x30aab6};if(!_[_0x6c3d('0x9')](_0x3972fc)){_0x2878bd[_0x6c3d('0xa')]=_0x3972fc;}return _0x1c2142[_0x6c3d('0xb')](_0x2878bd);};exports[_0x6c3d('0xc')]=function(_0x136347){return new BPromise(function(_0x1ba8ba,_0x2c023c){var _0x7352e2=0x0;if(_0x136347[_0x6c3d('0xd')]!=='agent'){_0x1ba8ba(_0x136347);}db[_0x6c3d('0xe')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x136347['id']}}})[_0x6c3d('0xf')](function(_0x3a7734){_0x7352e2=_0x3a7734;return util['getLicense']();})[_0x6c3d('0xf')](function(_0x3973bb){if(_0x3973bb&&_0x3973bb[_0x6c3d('0x10')]&&_0x7352e2>=_0x3973bb['agents']){throw Error(_0x6c3d('0x11'));}_0x1ba8ba(_0x136347);})[_0x6c3d('0x12')](function(_0x5affda){_0x2c023c(_0x5affda);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a101d1c..fe0cb68 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a5c=['status','json','send','exports','404'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a5c,0x184));var _0xc9a5=function(_0x5b3e50,_0xa7a3cb){_0x5b3e50=_0x5b3e50-0x0;var _0x89a0c9=_0x9a5c[_0x5b3e50];return _0x89a0c9;};'use strict';module[_0xc9a5('0x0')][0x194]=function pageNotFound(_0x33a93d,_0x5cd502){var _0x35a64a=_0xc9a5('0x1');var _0x4374c0=0x194;var _0x1ad288={'status':_0x4374c0};_0x5cd502[_0xc9a5('0x2')](_0x1ad288[_0xc9a5('0x2')]);_0x5cd502['render'](_0x35a64a,{},function(_0x4b0a4b,_0x320e96){if(_0x4b0a4b){return _0x5cd502[_0xc9a5('0x2')](_0x1ad288[_0xc9a5('0x2')])[_0xc9a5('0x3')](_0x1ad288);}_0x5cd502[_0xc9a5('0x4')](_0x320e96);});}; \ No newline at end of file +var _0xc116=['json','send','exports','404','status','render'];(function(_0x1616fb,_0x275597){var _0x150f94=function(_0x1518f9){while(--_0x1518f9){_0x1616fb['push'](_0x1616fb['shift']());}};_0x150f94(++_0x275597);}(_0xc116,0x164));var _0x6c11=function(_0x5f23fd,_0x1f8c43){_0x5f23fd=_0x5f23fd-0x0;var _0x5c060e=_0xc116[_0x5f23fd];return _0x5c060e;};'use strict';module[_0x6c11('0x0')][0x194]=function pageNotFound(_0x3c7164,_0x30bc5f){var _0x3194e1=_0x6c11('0x1');var _0xeb5522=0x194;var _0x186e6a={'status':_0xeb5522};_0x30bc5f[_0x6c11('0x2')](_0x186e6a['status']);_0x30bc5f[_0x6c11('0x3')](_0x3194e1,{},function(_0x3d1a9b,_0x2d7a3e){if(_0x3d1a9b){return _0x30bc5f[_0x6c11('0x2')](_0x186e6a['status'])[_0x6c11('0x4')](_0x186e6a);}_0x30bc5f[_0x6c11('0x5')](_0x2d7a3e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0963644..b6cc97c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaac8=['Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','CmContact','cm_user_has_contacts','cm_user_has_lists','Team','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','UserVoicePrefix','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','WhatsappQueues','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','MailMessage','Interactions','List','TemplateId','Pause','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Attachment','Attachments','ChatWebsiteId','IntervalId','TagId','Items','Dispositions','FaxAccountId','Exntensions','ListId','FaxApplication','fax_interaction_has_tags','Tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','OpenchannelAccountId','OpenchannelInteraction','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatMessage','Agent','ChatApplication','ChatQueue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Hoppers','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','SugarcrmConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','int_freshdesk_configuration_has_tags','FreshsalesAccount','ChatQueueReport','FromId','SessionId','ProjectId','user_has_teams','team_has_sms_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','FromUserId','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','username','password','database','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.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','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model'];(function(_0xa76112,_0x3e48ae){var _0x597fd1=function(_0x5c0002){while(--_0x5c0002){_0xa76112['push'](_0xa76112['shift']());}};_0x597fd1(++_0x3e48ae);}(_0xaac8,0x118));var _0x8aac=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xaac8[_0x47fd36];return _0x21a0fc;};'use strict';var config=require(_0x8aac('0x0'));var Sequelize=require(_0x8aac('0x1'));var _=require(_0x8aac('0x2'));var jstz=require(_0x8aac('0x3'));var timezone=jstz[_0x8aac('0x4')]();config[_0x8aac('0x1')]=_[_0x8aac('0x5')](config[_0x8aac('0x1')],{'database':'motion2','username':'xcall','password':_0x8aac('0x6'),'options':{'host':_0x8aac('0x7'),'port':0xcea,'dialect':_0x8aac('0x8'),'dialectOptions':{'charset':_0x8aac('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8aac('0xa'),'collate':_0x8aac('0xb')}}});config[_0x8aac('0xc')]=_[_0x8aac('0x5')](config[_0x8aac('0xc')],{'database':'motion2','username':'xcall','password':_0x8aac('0x6'),'options':{'host':_0x8aac('0x7'),'port':0xcea,'dialect':_0x8aac('0x8'),'dialectOptions':{'charset':_0x8aac('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x8aac('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8aac('0x1')]['database'],config[_0x8aac('0x1')][_0x8aac('0xd')],config['sequelize'][_0x8aac('0xe')],config[_0x8aac('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8aac('0xc')][_0x8aac('0xf')],config[_0x8aac('0xc')][_0x8aac('0xd')],config[_0x8aac('0xc')][_0x8aac('0xe')],config['sequelizeHistory'][_0x8aac('0x10')])};db[_0x8aac('0x11')]=db['sequelize'][_0x8aac('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x13'));db[_0x8aac('0x14')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x15'));db['VoiceExtension']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8aac('0x16')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x17'));db[_0x8aac('0x18')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x19'));db['ScreenRecording']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1a'));db[_0x8aac('0x1b')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1c'));db[_0x8aac('0x1d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8aac('0x1e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1f'));db[_0x8aac('0x20')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x21'));db[_0x8aac('0x22')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x23'));db[_0x8aac('0x24')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x25'));db[_0x8aac('0x26')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/memberReport/memberReport.model');db[_0x8aac('0x27')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/trunk/trunk.model');db[_0x8aac('0x28')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x29'));db[_0x8aac('0x2a')]=db[_0x8aac('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8aac('0x2b')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x8aac('0x2c')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x2d'));db['UserFaxQueue']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x2e'));db[_0x8aac('0x2f')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x30'));db[_0x8aac('0x31')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x8aac('0x32')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x33'));db[_0x8aac('0x34')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x35'));db[_0x8aac('0x36')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x37'));db['MailAccount']=db[_0x8aac('0x1')]['import'](_0x8aac('0x38'));db[_0x8aac('0x39')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x3a'));db[_0x8aac('0x3b')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x3c'));db[_0x8aac('0x3d')]=db['sequelize']['import'](_0x8aac('0x3e'));db['MailMessage']=db['sequelize']['import'](_0x8aac('0x3f'));db[_0x8aac('0x40')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x41'));db[_0x8aac('0x42')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x43'));db[_0x8aac('0x44')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x45'));db[_0x8aac('0x46')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x47'));db['FaxAccount']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/faxApplication/faxApplication.model');db[_0x8aac('0x48')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x49'));db[_0x8aac('0x4a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x4b'));db[_0x8aac('0x4c')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x4d'));db[_0x8aac('0x4e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x4f'));db[_0x8aac('0x50')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x51'));db[_0x8aac('0x52')]=db['sequelize']['import'](_0x8aac('0x53'));db[_0x8aac('0x54')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x55'));db[_0x8aac('0x56')]=db['sequelize'][_0x8aac('0x12')]('../api/smsMessage/smsMessage.model');db[_0x8aac('0x57')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x58'));db[_0x8aac('0x59')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5a'));db['OpenchannelApplication']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5b'));db['OpenchannelInteraction']=db[_0x8aac('0x1')]['import'](_0x8aac('0x5c'));db[_0x8aac('0x5d')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5e'));db['OpenchannelQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x5f'));db[_0x8aac('0x60')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x61'));db[_0x8aac('0x62')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x63'));db['ChatInteraction']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x64'));db['ChatMessage']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/chatMessage/chatMessage.model');db[_0x8aac('0x65')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x66'));db[_0x8aac('0x67')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x68'));db[_0x8aac('0x69')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6a'));db['CmCompany']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x6b'));db['CmContact']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6c'));db[_0x8aac('0x6d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/cmHopper/cmHopper.model');db[_0x8aac('0x6e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6f'));db[_0x8aac('0x70')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x71'));db['CmHopperHistory']=db[_0x8aac('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x8aac('0x72')]=db[_0x8aac('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x8aac('0x73')]=db['sequelize'][_0x8aac('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x8aac('0x74')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x75'));db[_0x8aac('0x76')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/automation/automation.model');db[_0x8aac('0x77')]=db['sequelize'][_0x8aac('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x8aac('0x78')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x79'));db[_0x8aac('0x7a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x7b'));db['Interval']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x7c'));db['Pause']=db[_0x8aac('0x1')]['import'](_0x8aac('0x7d'));db['Cdr']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x7e'));db[_0x8aac('0x7f')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x8aac('0x80')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x81'));db[_0x8aac('0x82')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x83'));db[_0x8aac('0x84')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/tag/tag.model');db[_0x8aac('0x85')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x86'));db['Trigger']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x87'));db[_0x8aac('0x88')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x89'));db[_0x8aac('0x8a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x8b'));db[_0x8aac('0x8c')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x8d'));db['AnalyticCustomReport']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8aac('0x8e')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x8f'));db[_0x8aac('0x90')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x91'));db['AnalyticFieldReport']=db[_0x8aac('0x1')]['import'](_0x8aac('0x92'));db[_0x8aac('0x93')]=db[_0x8aac('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8aac('0x94')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8aac('0x95')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x96'));db[_0x8aac('0x97')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x98'));db[_0x8aac('0x99')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x9a'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x8aac('0x9b'));db[_0x8aac('0x9c')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x8aac('0x9d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x8aac('0x9e')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x9f'));db[_0x8aac('0xa0')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa1'));db[_0x8aac('0xa2')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0x8aac('0xa3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xa4'));db['ZohoField']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intZohoField/intZohoField.model');db[_0x8aac('0xa5')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa6'));db['ZendeskConfiguration']=db['sequelize']['import'](_0x8aac('0xa7'));db[_0x8aac('0xa8')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa9'));db[_0x8aac('0xaa')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xab'));db[_0x8aac('0xac')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xad'));db[_0x8aac('0xae')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8aac('0xaf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb0'));db[_0x8aac('0xb1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb2'));db[_0x8aac('0xb3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb4'));db[_0x8aac('0xb5')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8aac('0xb6')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb7'));db[_0x8aac('0xb8')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb9'));db[_0x8aac('0xba')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8aac('0xbb')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xbc'));db[_0x8aac('0xbd')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0x8aac('0x1')]['import'](_0x8aac('0xbe'));db[_0x8aac('0xbf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc0'));db[_0x8aac('0xc1')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xc2'));db[_0x8aac('0x8a')]=db['sequelize'][_0x8aac('0x12')]('../api/integration/integration.model');db[_0x8aac('0xc3')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xc4'));db['ChatQueueReport']=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x8aac('0xc5')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc6'));db[_0x8aac('0xc7')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc8'));db[_0x8aac('0xc9')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xca'));db[_0x8aac('0xcb')]=db[_0x8aac('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8aac('0xcc')]=db['sequelize']['import'](_0x8aac('0xcd'));db[_0x8aac('0xce')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/squareReport/squareReport.model');db[_0x8aac('0xcf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd0'));db[_0x8aac('0xd1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd2'));db[_0x8aac('0xd3')]=db['sequelize'][_0x8aac('0x12')]('../api/setting/setting.model');db[_0x8aac('0xd4')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd5'));db[_0x8aac('0xd6')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd7'));db[_0x8aac('0xd8')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xd9'));db[_0x8aac('0xda')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xdb'));db['Team']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xdc'));db[_0x8aac('0xdd')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xde'));db[_0x8aac('0xdf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xe0'));db[_0x8aac('0xe1')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xe2'));db['Attachment']=db[_0x8aac('0x1')]['import'](_0x8aac('0xe3'));db['Plugin']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xe4'));db[_0x8aac('0xe5')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xe6'));db[_0x8aac('0xe7')]=db[_0x8aac('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x8aac('0xe8')]=db['sequelize'][_0x8aac('0x12')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xe9'));db['SmsTransferReport']=db[_0x8aac('0x1')]['import'](_0x8aac('0xea'));db[_0x8aac('0xeb')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xec'));db[_0x8aac('0xed')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xee'));db[_0x8aac('0xef')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf0'));db[_0x8aac('0xf1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf2'));db[_0x8aac('0xf3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf4'));db[_0x8aac('0xf5')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf6'));db[_0x8aac('0xf7')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf8'));db['WhatsappApplication']=db['sequelize'][_0x8aac('0x12')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf9'));db[_0x8aac('0xfa')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xfb'));db[_0x8aac('0xfc')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xfd'));db[_0x8aac('0xfe')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xff'));db[_0x8aac('0x100')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x101'));db[_0x8aac('0x102')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x103'));db['TeamVoiceQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x104'));db[_0x8aac('0x105')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x106'));db['UserVoicePrefix']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x107'));db[_0x8aac('0x108')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/user-setting/user-setting.model');db[_0x8aac('0x11')][_0x8aac('0x109')](db[_0x8aac('0x1b')],{'as':_0x8aac('0x1b'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x109')](db[_0x8aac('0x108')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x18')],{'as':_0x8aac('0x10d'),'foreignKey':_0x8aac('0x10b')});db['User'][_0x8aac('0x10c')](db[_0x8aac('0x10e')],{'as':'VoiceQueuesRt','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')]['hasMany'](db[_0x8aac('0x10f')],{'as':_0x8aac('0x110'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x10b')});db['User']['hasMany'](db[_0x8aac('0x112')],{'as':_0x8aac('0x113'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db['ReportAgentPreview'],{'as':_0x8aac('0x72'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db['OpenchannelInteraction'],{'as':_0x8aac('0x114'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x115')],{'as':_0x8aac('0x116'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')]['hasMany'](db[_0x8aac('0x48')],{'as':_0x8aac('0x118'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x11a')],{'as':_0x8aac('0x11b'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0xf5')],{'as':_0x8aac('0x11c'),'foreignKey':_0x8aac('0x11d')});db[_0x8aac('0x11')][_0x8aac('0x11e')](db['UserProfile'],{'as':_0x8aac('0xef'),'foreignKey':'userProfileId'});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x67')],{'as':_0x8aac('0x120'),'through':'chat_group_has_users'});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x121')],{'as':'Contacts','through':_0x8aac('0x122')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':'Lists','through':_0x8aac('0x123')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':'user_has_teams'});db[_0x8aac('0x11')]['belongsToMany'](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'through':_0x8aac('0x125')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x115')],{'as':_0x8aac('0x116'),'through':_0x8aac('0x126')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x8aac('0x127')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'through':_0x8aac('0x128')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['OpenchannelInteraction'],{'as':_0x8aac('0x114'),'through':_0x8aac('0x129')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x16')],{'as':_0x8aac('0x12a'),'through':_0x8aac('0x2a'),'required':![]});db['User'][_0x8aac('0x11f')](db[_0x8aac('0xed')],{'as':'VoicePrefixes','through':_0x8aac('0x12b'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['MailQueue'],{'as':'MailQueues','through':_0x8aac('0x2c'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['ChatQueue'],{'as':_0x8aac('0x12c'),'through':_0x8aac('0x2b'),'required':![],'hooks':!![]});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x4c')],{'as':_0x8aac('0x12d'),'through':_0x8aac('0x12e'),'required':![]});db[_0x8aac('0x11')]['belongsToMany'](db['SmsQueue'],{'as':_0x8aac('0x12f'),'through':'UserSmsQueue','required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x130')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x8aac('0x11')]['belongsToMany'](db[_0x8aac('0x100')],{'as':_0x8aac('0x131'),'through':_0x8aac('0x32'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'through':_0x8aac('0x123')});db['User'][_0x8aac('0x11f')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x8aac('0x132')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x133')],{'as':'FaxAccounts','through':_0x8aac('0x134')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x135')],{'as':_0x8aac('0x136'),'through':_0x8aac('0x137')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x59')],{'as':_0x8aac('0x138'),'through':_0x8aac('0x139')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x50')],{'as':_0x8aac('0x13a'),'through':_0x8aac('0x13b')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0xf7')],{'as':_0x8aac('0x13c'),'through':_0x8aac('0x13d')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['SquareProject'],{'as':_0x8aac('0x13e'),'through':_0x8aac('0x13f')});db[_0x8aac('0x140')][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x141'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x142')});db['VoiceContext'][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x10f')]['hasMany'](db['VoiceExtension'],{'as':_0x8aac('0x143'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x144')]['belongsToMany'](db['Sound'],{'as':_0x8aac('0x145'),'through':_0x8aac('0x146')});db[_0x8aac('0x16')]['hasMany'](db[_0x8aac('0x10e')],{'as':_0x8aac('0x147'),'foreignKey':'VoiceQueueId'});db[_0x8aac('0x16')][_0x8aac('0x10c')](db[_0x8aac('0x6d')],{'as':'Hoppers','foreignKey':_0x8aac('0x148')});db['VoiceQueue'][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x8aac('0x10c')](db['CmHopperHistory'],{'as':_0x8aac('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':_0x8aac('0x72'),'foreignKey':_0x8aac('0x148')});db[_0x8aac('0x16')][_0x8aac('0x10c')](db[_0x8aac('0x6e')],{'as':_0x8aac('0x14a'),'foreignKey':_0x8aac('0x148')});db['VoiceQueue']['hasMany'](db[_0x8aac('0xcb')],{'as':_0x8aac('0x14b'),'foreignKey':_0x8aac('0x148')});db['VoiceQueue']['belongsTo'](db[_0x8aac('0x27')],{'as':_0x8aac('0x27'),'foreignKey':_0x8aac('0x14c')});db['VoiceQueue'][_0x8aac('0x11e')](db[_0x8aac('0x27')],{'as':_0x8aac('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x8aac('0x16')][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'as':_0x8aac('0x14e'),'foreignKey':'IntervalId'});db[_0x8aac('0x16')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db['VoiceQueue'][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':'Lists','through':_0x8aac('0x151')});db[_0x8aac('0x16')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserVoiceQueue'});db[_0x8aac('0x16')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'as':_0x8aac('0x153'),'through':_0x8aac('0x154')});db['VoiceQueue'][_0x8aac('0x11f')](db['CmList'],{'as':'BlackLists','through':_0x8aac('0x155')});db[_0x8aac('0x18')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db['ScreenRecording'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x1b')][_0x8aac('0x10c')](db[_0x8aac('0x1d')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x157'),'sourceKey':_0x8aac('0x158')});db[_0x8aac('0x1d')][_0x8aac('0x11e')](db[_0x8aac('0x1b')],{'foreignKey':'mailboxuser','targetKey':_0x8aac('0x158')});db[_0x8aac('0x1e')][_0x8aac('0x10c')](db[_0x8aac('0x24')],{'as':_0x8aac('0x159'),'foreignKey':_0x8aac('0x15a'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x8aac('0x22')],{'as':'AgentReports','foreignKey':_0x8aac('0x15a'),'constraints':![]});db[_0x8aac('0x1e')]['belongsTo'](db[_0x8aac('0x11')],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x1e')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x34')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':'MailAccount','foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x34')][_0x8aac('0x11e')](db[_0x8aac('0x102')],{'as':'CloudProvider','foreignKey':_0x8aac('0x15e'),'onDelete':_0x8aac('0x15f')});db['MailServerOut'][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x135'),'foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x36')][_0x8aac('0x11e')](db[_0x8aac('0x102')],{'as':_0x8aac('0x102'),'foreignKey':'CloudProviderId','onDelete':_0x8aac('0x15f')});db[_0x8aac('0x135')][_0x8aac('0x109')](db['MailServerIn'],{'as':_0x8aac('0x160'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x135')][_0x8aac('0x109')](db[_0x8aac('0x36')],{'as':_0x8aac('0x161'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':'Dispositions','foreignKey':_0x8aac('0x15d'),'onDelete':'cascade'});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x77')],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x15d')});db['MailAccount'][_0x8aac('0x10c')](db[_0x8aac('0x163')],{'as':_0x8aac('0x156'),'foreignKey':'MailAccountId'});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x164')});db[_0x8aac('0x135')]['hasMany'](db[_0x8aac('0x40')],{'as':_0x8aac('0x143')});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':'ListId'});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0x85')],{'as':_0x8aac('0x85'),'foreignKey':_0x8aac('0x166')});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x135')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x137')});db[_0x8aac('0x39')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserMailQueue'});db[_0x8aac('0x39')]['belongsToMany'](db[_0x8aac('0x124')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x8aac('0x3d')][_0x8aac('0x10c')](db['MailMessage'],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x168')});db[_0x8aac('0x3d')][_0x8aac('0x11e')](db['MailAccount'],{'as':_0x8aac('0x169'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x3d')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x3d')][_0x8aac('0x11f')](db['Tag'],{'through':_0x8aac('0x16b'),'as':'Tags'});db[_0x8aac('0x3d')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x16b'),'as':_0x8aac('0x16c')});db[_0x8aac('0x3d')]['belongsToMany'](db[_0x8aac('0x11')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x8aac('0x163')]['hasMany'](db[_0x8aac('0x16d')],{'as':_0x8aac('0x16e'),'onDelete':_0x8aac('0x10a')});db['MailMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x11')});db[_0x8aac('0x163')]['belongsTo'](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':'Contact'});db[_0x8aac('0x163')][_0x8aac('0x11e')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x8aac('0x168')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x60'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x65')],{'as':_0x8aac('0x65'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')]['belongsTo'](db[_0x8aac('0x39')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db['Interval'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db['Tag'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x42')]['belongsTo'](db[_0x8aac('0x135')],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x8aac('0x42')]['belongsTo'](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['MailQueueReport']['belongsTo'](db[_0x8aac('0x3d')],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['MailMessage'],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db[_0x8aac('0x39')],{});db[_0x8aac('0x44')][_0x8aac('0x10c')](db[_0x8aac('0x46')],{'as':_0x8aac('0x172'),'onDelete':_0x8aac('0x10a')});db['FaxAccount'][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x174'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x133')][_0x8aac('0x10c')](db['CannedAnswer'],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x174')});db['FaxAccount'][_0x8aac('0x10c')](db[_0x8aac('0x48')],{'as':'Interactions'});db[_0x8aac('0x133')][_0x8aac('0x10c')](db['FaxApplication'],{'as':_0x8aac('0x143')});db[_0x8aac('0x133')][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x175'),'onDelete':_0x8aac('0x10a')});db['FaxAccount']['hasMany'](db[_0x8aac('0x4a')],{'as':_0x8aac('0x156')});db[_0x8aac('0x133')]['belongsTo'](db['Trunk'],{'as':_0x8aac('0x27')});db['FaxAccount'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x133')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x133')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x134')});db[_0x8aac('0x177')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x8aac('0x4c')],{'onDelete':_0x8aac('0x15f')});db['FaxApplication'][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x177')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db['FaxInteraction'][_0x8aac('0x10c')](db[_0x8aac('0x4a')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':'FaxInteractionId'});db[_0x8aac('0x48')][_0x8aac('0x11e')](db['FaxAccount'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x174')});db['FaxInteraction'][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x48')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x48')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x178'),'as':_0x8aac('0x179')});db[_0x8aac('0x48')]['belongsToMany'](db[_0x8aac('0x84')],{'through':'fax_interaction_has_tags','as':_0x8aac('0x16c')});db[_0x8aac('0x48')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Users','through':_0x8aac('0x127'),'foreignKey':_0x8aac('0x17a')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x11')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x48')],{'as':_0x8aac('0x17b'),'foreignKey':_0x8aac('0x17a')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db[_0x8aac('0x4a')][_0x8aac('0x11e')](db[_0x8aac('0x16d')],{'as':'Attachment','foreignKey':_0x8aac('0x17c')});db['FaxMessage'][_0x8aac('0x11e')](db['FaxAccount'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x174')});db[_0x8aac('0x4c')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x12e')});db[_0x8aac('0x4c')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x17d'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x8aac('0x133')],{});db[_0x8aac('0x4e')][_0x8aac('0x11e')](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db['FaxQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8aac('0x4e')]['belongsTo'](db['FaxInteraction'],{});db[_0x8aac('0x4e')]['belongsTo'](db[_0x8aac('0x4a')],{});db['FaxQueueReport'][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0x4e')][_0x8aac('0x11e')](db[_0x8aac('0x4c')],{});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x17e'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db['CannedAnswer'],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x56')],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x17e')});db['SmsAccount']['hasMany'](db[_0x8aac('0x54')],{'as':_0x8aac('0x164')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x52')],{'as':_0x8aac('0x143')});db[_0x8aac('0x50')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db[_0x8aac('0x50')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8aac('0x50')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x13b')});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x52')]['belongsTo'](db[_0x8aac('0x57')],{'onDelete':'restrict'});db[_0x8aac('0x52')][_0x8aac('0x11e')](db[_0x8aac('0x50')],{'onDelete':'restrict'});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['Interval'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['Tag'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x54')][_0x8aac('0x10c')](db['SmsMessage'],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x17f')});db['SmsInteraction'][_0x8aac('0x11e')](db[_0x8aac('0x50')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x54')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x54')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x54')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x180'),'as':_0x8aac('0x179')});db[_0x8aac('0x54')][_0x8aac('0x11f')](db['Tag'],{'through':_0x8aac('0x180'),'as':'ThroughTags'});db[_0x8aac('0x54')]['belongsToMany'](db['User'],{'as':_0x8aac('0x181'),'through':'user_has_sms_interactions','foreignKey':_0x8aac('0x17f')});db[_0x8aac('0x56')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x11')});db[_0x8aac('0x56')]['belongsTo'](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db[_0x8aac('0x56')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'SmsInteractionId'});db[_0x8aac('0x56')]['belongsTo'](db[_0x8aac('0x50')],{'as':'Account','foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x57')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Agents','through':_0x8aac('0x2f'),'foreignKey':_0x8aac('0x182')});db[_0x8aac('0x57')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x8aac('0x59')]['hasMany'](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x183'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x77')],{'as':'Answers','foreignKey':_0x8aac('0x183')});db['OpenchannelAccount'][_0x8aac('0x10c')](db[_0x8aac('0x184')],{'as':_0x8aac('0x164'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x5d')],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x185')],{'as':_0x8aac('0x143'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x11e')](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x59')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x59')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x139')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'restrict'});db[_0x8aac('0x185')][_0x8aac('0x11e')](db['OpenchannelQueue'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x186')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'onDelete':_0x8aac('0x15f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x184')][_0x8aac('0x10c')](db[_0x8aac('0x5d')],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x187')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x188'),'as':_0x8aac('0x179')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x188'),'as':_0x8aac('0x16c')});db[_0x8aac('0x184')]['belongsToMany'](db['User'],{'as':_0x8aac('0x181'),'through':_0x8aac('0x129'),'foreignKey':_0x8aac('0x187')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'cascade','as':_0x8aac('0x11')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db['OpenchannelMessage'][_0x8aac('0x11e')](db['OpenchannelInteraction'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x8aac('0x16d')],{'as':_0x8aac('0x16d'),'foreignKey':_0x8aac('0x17c')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x130')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x31'),'foreignKey':_0x8aac('0x186')});db[_0x8aac('0x130')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x189'),'as':_0x8aac('0x153')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db['Disposition'],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x16f'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x60')]['hasMany'](db[_0x8aac('0x77')],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db[_0x8aac('0x69')],{'as':_0x8aac('0x18a')});db['ChatWebsite'][_0x8aac('0x10c')](db[_0x8aac('0x115')],{'as':_0x8aac('0x164')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db['ChatApplication'],{'as':_0x8aac('0x143')});db['ChatWebsite'][_0x8aac('0x10c')](db[_0x8aac('0x18b')],{'as':_0x8aac('0x156')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db['Interval'],{'as':_0x8aac('0x14e'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x135'),'foreignKey':'MailAccountId'});db[_0x8aac('0x60')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8aac('0x60')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x132')});db[_0x8aac('0x62')][_0x8aac('0x11e')](db['OpenchannelAccount'],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8aac('0x62')]['belongsTo'](db[_0x8aac('0x184')],{});db['OpenchannelQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x5d')],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x18c'),'foreignKey':_0x8aac('0x10b'),'onDelete':'restrict'});db[_0x8aac('0x18d')][_0x8aac('0x11e')](db[_0x8aac('0x18e')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x8aac('0x15f')});db[_0x8aac('0x18d')]['belongsTo'](db[_0x8aac('0x60')],{'as':_0x8aac('0x18f'),'foreignKey':_0x8aac('0x16f'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x18d')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x115')]['hasMany'](db[_0x8aac('0x18b')],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x190')});db['ChatInteraction'][_0x8aac('0x11e')](db['ChatWebsite'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x115')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x115')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x115')][_0x8aac('0x11f')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x8aac('0x179')});db[_0x8aac('0x115')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x191'),'as':_0x8aac('0x16c')});db[_0x8aac('0x115')]['belongsToMany'](db[_0x8aac('0x11')],{'as':'Users','through':_0x8aac('0x126'),'foreignKey':_0x8aac('0x190')});db['ChatMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'as':'User'});db[_0x8aac('0x18b')][_0x8aac('0x11e')](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['ChatMessage'][_0x8aac('0x11e')](db[_0x8aac('0x115')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':_0x8aac('0x190')});db[_0x8aac('0x18b')]['belongsTo'](db[_0x8aac('0x16d')],{'as':'Attachment','foreignKey':_0x8aac('0x17c')});db[_0x8aac('0x18b')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db['ChatOfflineMessage'][_0x8aac('0x10c')](db[_0x8aac('0x16d')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x65')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x65')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x18e')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x2b'),'hooks':!![]});db['ChatQueue'][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x192'),'as':_0x8aac('0x153')});db['ChatGroup'][_0x8aac('0x10c')](db['ChatInternalMessage'],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x193'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x67')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x147'),'through':_0x8aac('0x194')});db[_0x8aac('0x69')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x18f'),'foreignKey':_0x8aac('0x16f')});db['CmCompany'][_0x8aac('0x10c')](db[_0x8aac('0x121')],{'as':_0x8aac('0x195'),'foreignKey':_0x8aac('0x196')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0x6d')],{'as':_0x8aac('0x197'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')]['hasMany'](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')]['hasMany'](db[_0x8aac('0x112')],{'as':'HopperHistories','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0x72')],{'as':_0x8aac('0x72'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0xcb')],{'as':_0x8aac('0x14b'),'foreignKey':'ContactId'});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x184')],{'as':_0x8aac('0x114'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db['CmContact'][_0x8aac('0x10c')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8aac('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x8aac('0x121')]['hasMany'](db['FaxInteraction'],{'as':_0x8aac('0x118'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x121')]['belongsTo'](db[_0x8aac('0x198')],{'as':_0x8aac('0x199'),'foreignKey':_0x8aac('0x196')});db['CmContact'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x121')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':'cm_user_has_contacts'});db[_0x8aac('0x121')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'as':_0x8aac('0x179'),'through':_0x8aac('0x19a')});db[_0x8aac('0x121')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')]['belongsTo'](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db['CmHopper'][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x18c'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0x16')],{'as':_0x8aac('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0xdf')],{'as':'Campaign','foreignKey':_0x8aac('0x19c'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')]['belongsTo'](db[_0x8aac('0x11')],{'as':'Owner','foreignKey':_0x8aac('0x19d')});db[_0x8aac('0x6e')]['belongsTo'](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x10a')});db['CmHopperBlack'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176'),'onDelete':'cascade'});db[_0x8aac('0x6e')]['belongsTo'](db[_0x8aac('0x16')],{'as':_0x8aac('0x19b'),'foreignKey':_0x8aac('0x148'),'onDelete':'cascade'});db[_0x8aac('0x6e')][_0x8aac('0x11e')](db[_0x8aac('0xdf')],{'as':_0x8aac('0xdf'),'foreignKey':_0x8aac('0x19c'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x8aac('0x7a')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x8aac('0x19e'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x76')][_0x8aac('0x10c')](db['Condition'],{'as':{'plural':_0x8aac('0x19f'),'singular':_0x8aac('0x1a0')},'foreignKey':_0x8aac('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x8aac('0x76')]['hasMany'](db[_0x8aac('0x74')],{'as':'Actions','foreignKey':_0x8aac('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x1a3'),'onDelete':'cascade'});db['Interval'][_0x8aac('0x10c')](db[_0x8aac('0x14e')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x8aac('0x10a'),'hooks':!![],'required':![]});db['Interval'][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x110'),'foreignKey':_0x8aac('0x170'),'onDelete':_0x8aac('0x15f')});db['Interval'][_0x8aac('0x10c')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x8aac('0x14e')][_0x8aac('0x10c')](db[_0x8aac('0x18d')],{'as':_0x8aac('0x1a4'),'foreignKey':'IntervalId'});db['Interval'][_0x8aac('0x10c')](db['FaxApplication'],{'as':_0x8aac('0x1a5'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x14e')]['hasMany'](db[_0x8aac('0x52')],{'as':_0x8aac('0x1a6'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x80')]['belongsTo'](db[_0x8aac('0x135')],{});db[_0x8aac('0x80')][_0x8aac('0x11e')](db[_0x8aac('0x8e')],{'foreignKey':_0x8aac('0x1a7')});db[_0x8aac('0x80')]['belongsTo'](db[_0x8aac('0x1a8')],{'foreignKey':_0x8aac('0x1a9')});db[_0x8aac('0x82')]['belongsToMany'](db[_0x8aac('0x144')],{'as':_0x8aac('0x1aa'),'through':_0x8aac('0x146'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x84')][_0x8aac('0x11f')](db[_0x8aac('0x121')],{'through':'cm_contact_has_tags'});db[_0x8aac('0x84')][_0x8aac('0x11f')](db[_0x8aac('0x115')],{'through':_0x8aac('0x191')});db['Tag'][_0x8aac('0x11f')](db['MailInteraction'],{'through':_0x8aac('0x16b')});db['Tag']['belongsToMany'](db[_0x8aac('0x54')],{'through':_0x8aac('0x180')});db[_0x8aac('0x84')]['belongsToMany'](db[_0x8aac('0x48')],{'through':_0x8aac('0x178')});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x8aac('0x188')});db[_0x8aac('0x84')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x8aac('0x1ab')});db[_0x8aac('0x1ac')][_0x8aac('0x10c')](db['Condition'],{'as':{'plural':_0x8aac('0x1ad'),'singular':'AllCondition'},'foreignKey':_0x8aac('0x1ae'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x8aac('0x10c')](db[_0x8aac('0x7a')],{'as':{'plural':_0x8aac('0x1af'),'singular':_0x8aac('0x1b0')},'foreignKey':_0x8aac('0x1b1'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x1ac')][_0x8aac('0x10c')](db[_0x8aac('0x74')],{'as':_0x8aac('0x1b2'),'foreignKey':_0x8aac('0x1b3'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x1a8')][_0x8aac('0x10c')](db[_0x8aac('0x1b4')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x8aac('0x8e')][_0x8aac('0x10c')](db['AnalyticFieldReport'],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x8aac('0x90')][_0x8aac('0x10c')](db[_0x8aac('0x1b4')],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':_0x8aac('0x1b6')});db['AnalyticFieldReport'][_0x8aac('0x11e')](db[_0x8aac('0x90')],{'foreignKey':_0x8aac('0x1b6')});db[_0x8aac('0x94')][_0x8aac('0x10c')](db[_0x8aac('0x95')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8aac('0x95')]['hasMany'](db['SalesforceField'],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x95')]['hasMany'](db[_0x8aac('0x97')],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0x95')][_0x8aac('0x10c')](db['SalesforceField'],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x95')][_0x8aac('0x11e')](db[_0x8aac('0x94')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db['SalesforceField'][_0x8aac('0x10c')](db[_0x8aac('0x97')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0x97')][_0x8aac('0x10c')](db['SalesforceField'],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x97')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x99')][_0x8aac('0x10c')](db[_0x8aac('0x1c2')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db['SugarcrmConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0x9c')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c2')][_0x8aac('0x10c')](db['SugarcrmField'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':'DescriptionId'});db[_0x8aac('0x1c2')]['hasMany'](db[_0x8aac('0x9c')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x1c2')][_0x8aac('0x11e')](db[_0x8aac('0x99')],{'as':_0x8aac('0x169'),'foreignKey':'AccountId'});db[_0x8aac('0x9c')][_0x8aac('0x10c')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x9c')]['hasMany'](db['SugarcrmField'],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db['SugarcrmField'][_0x8aac('0x10c')](db[_0x8aac('0x9c')],{'as':_0x8aac('0x1c0'),'foreignKey':'FieldId'});db[_0x8aac('0x9c')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':'Variable','foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x9d')][_0x8aac('0x10c')](db[_0x8aac('0x9e')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':'AccountId'});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db['DeskField'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':'DescriptionId'});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x9e')][_0x8aac('0x11e')](db['DeskAccount'],{'as':_0x8aac('0x169'),'foreignKey':'AccountId'});db[_0x8aac('0x9e')]['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x1c3')});db[_0x8aac('0xa0')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db['DeskField']['hasMany'](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xa0')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa0')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xa2')][_0x8aac('0x10c')](db[_0x8aac('0xa3')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xa3')]['hasMany'](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':'SubjectId'});db[_0x8aac('0xa3')][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1ba'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bb')});db['ZohoConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa3')][_0x8aac('0x11e')](db[_0x8aac('0xa2')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db['ZohoField'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c4')][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x1c4')][_0x8aac('0x11e')](db['Variable'],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xa5')]['hasMany'](db[_0x8aac('0x1c5')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0x1c5')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1b8'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c5')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1ba'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1b5'),'foreignKey':'FieldId'});db[_0x8aac('0x1c5')][_0x8aac('0x11e')](db[_0x8aac('0xa5')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0x1c5')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':'int_zendesk_configuration_has_tags'});db[_0x8aac('0xa8')][_0x8aac('0x10c')](db['ZendeskField'],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xa8')]['hasMany'](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xa8')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':'Field','foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa8')][_0x8aac('0x11e')](db['Variable'],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xaa')]['hasMany'](db[_0x8aac('0xac')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':'Descriptions','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':'FieldId'});db[_0x8aac('0xac')]['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xac')]['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x1c6')});db[_0x8aac('0xae')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db['FreshdeskField']['hasMany'](db[_0x8aac('0xae')],{'as':'Description','foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xae')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1c0'),'foreignKey':'FieldId'});db[_0x8aac('0xae')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xaf')][_0x8aac('0x10c')](db[_0x8aac('0xb1')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xb1')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1b8'),'foreignKey':_0x8aac('0x1b9')});db['VtigerConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb1')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb1')][_0x8aac('0x11e')](db[_0x8aac('0xaf')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db['VtigerField'][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xb3')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb3')][_0x8aac('0x10c')](db['VtigerField'],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb3')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xb5')]['hasMany'](db[_0x8aac('0xb6')],{'as':'Configurations','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db['ServicenowConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1b8'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb6')][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb6')][_0x8aac('0x11e')](db[_0x8aac('0xb5')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xb8')]['hasMany'](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1be'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db['ServicenowField'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db['ServicenowField'][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xba')][_0x8aac('0x10c')](db['Dynamics365Configuration'],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xbb')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db['Dynamics365Configuration'][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbb')][_0x8aac('0x11e')](db['Dynamics365Account'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xbd')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db['Dynamics365Field'][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1bf'),'foreignKey':'DescriptionId'});db[_0x8aac('0xbd')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbd')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x1c7')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x8aac('0x10a'),'foreignKey':'AccountId'});db[_0x8aac('0xbf')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1b8'),'foreignKey':'SubjectId'});db[_0x8aac('0xbf')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xbf')]['hasMany'](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbf')][_0x8aac('0x11e')](db[_0x8aac('0x1c7')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xc1')][_0x8aac('0x10c')](db['FreshsalesField'],{'as':_0x8aac('0x1be'),'foreignKey':'SubjectId'});db[_0x8aac('0xc1')]['hasMany'](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xc1')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db['FreshsalesField'][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8aac('0x1c8')]['belongsTo'](db[_0x8aac('0x60')],{});db[_0x8aac('0x1c8')]['belongsTo'](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db['ChatQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['ChatQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x115')],{});db[_0x8aac('0x1c8')][_0x8aac('0x11e')](db[_0x8aac('0x18b')],{});db[_0x8aac('0x1c8')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db['ChatQueueReport'][_0x8aac('0x11e')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1c9')});db[_0x8aac('0xc5')]['belongsTo'](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'foreignKey':'ToId'});db[_0x8aac('0xcb')][_0x8aac('0x10c')](db[_0x8aac('0xc9')],{'foreignKey':_0x8aac('0x1ca'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xcb')]['hasMany'](db[_0x8aac('0xc7')],{'foreignKey':_0x8aac('0x1ca'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db['SmsAccount'],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0xcc')]['belongsTo'](db[_0x8aac('0x54')],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0x56')],{});db['SmsQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db['SmsQueue'],{});db[_0x8aac('0xd1')][_0x8aac('0x10c')](db[_0x8aac('0xcb')],{'foreignKey':_0x8aac('0x1cb')});db['JscriptyProject'][_0x8aac('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x8aac('0x1cb')});db[_0x8aac('0xd1')][_0x8aac('0x10c')](db[_0x8aac('0xc7')],{'foreignKey':_0x8aac('0x1cb')});db[_0x8aac('0xd6')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':'user_has_square_projects'});db['Team']['belongsToMany'](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x1cc')});db[_0x8aac('0x124')][_0x8aac('0x11f')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x8aac('0x12a')});db[_0x8aac('0x124')][_0x8aac('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0x18e')],{'through':_0x8aac('0x192'),'as':_0x8aac('0x12c')});db[_0x8aac('0x124')]['belongsToMany'](db['FaxQueue'],{'through':_0x8aac('0x17d'),'as':'FaxQueues'});db[_0x8aac('0x124')]['belongsToMany'](db[_0x8aac('0x57')],{'through':_0x8aac('0x1cd'),'as':_0x8aac('0x12f')});db['Team'][_0x8aac('0x11f')](db[_0x8aac('0x130')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0x100')],{'through':_0x8aac('0x1ce'),'as':'WhatsappQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0xed')],{'through':_0x8aac('0x105'),'as':'VoicePrefixes'});db[_0x8aac('0xdf')][_0x8aac('0x10c')](db['CmHopper'],{'as':_0x8aac('0x197'),'foreignKey':_0x8aac('0x19c')});db['Campaign'][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':'CampaignId'});db[_0x8aac('0xdf')]['hasMany'](db[_0x8aac('0x112')],{'as':_0x8aac('0x149'),'foreignKey':'CampaignId'});db[_0x8aac('0xdf')][_0x8aac('0x10c')](db[_0x8aac('0x6e')],{'as':_0x8aac('0x14a'),'foreignKey':_0x8aac('0x19c')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db['Trunk'],{'as':'Trunk','foreignKey':_0x8aac('0x14c')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db[_0x8aac('0x27')],{'as':_0x8aac('0x14d'),'foreignKey':_0x8aac('0x1cf')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'as':_0x8aac('0x14e'),'foreignKey':_0x8aac('0x170')});db['Campaign'][_0x8aac('0x11e')](db[_0x8aac('0xd6')],{'as':_0x8aac('0xd6'),'foreignKey':_0x8aac('0x1d0')});db[_0x8aac('0xdf')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x1d1'),'through':_0x8aac('0x1d2')});db[_0x8aac('0xdf')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x1d3'),'through':_0x8aac('0x1d4')});db[_0x8aac('0x16d')][_0x8aac('0x11e')](db[_0x8aac('0x65')],{'as':_0x8aac('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db['MailMessage'],{});db[_0x8aac('0xe5')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db['MailTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x39')],{'foreignKey':_0x8aac('0x1d6'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db['MailAccount'],{'foreignKey':_0x8aac('0x1d8'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xe7')]['belongsTo'](db[_0x8aac('0x18b')],{});db[_0x8aac('0xe7')]['belongsTo'](db[_0x8aac('0x115')],{});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'foreignKey':'FromChatWebsiteId','as':_0x8aac('0x1da')});db['ChatTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db['User'],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db[_0x8aac('0x18e')],{'foreignKey':_0x8aac('0x1de'),'as':_0x8aac('0x1d7')});db['ChatTransferReport'][_0x8aac('0x11e')](db['ChatWebsite'],{'foreignKey':_0x8aac('0x1df'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db['FaxMessage'],{});db[_0x8aac('0xe8')]['belongsTo'](db[_0x8aac('0x48')],{});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'foreignKey':_0x8aac('0x1e0'),'as':'FromAccount'});db[_0x8aac('0xe8')]['belongsTo'](db['User'],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db[_0x8aac('0xe8')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8aac('0x1e1'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'foreignKey':_0x8aac('0x1e2'),'as':_0x8aac('0x1d9')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x5d')],{});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x184')],{});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'foreignKey':_0x8aac('0x1e4'),'as':_0x8aac('0x1da')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x130')],{'foreignKey':_0x8aac('0x1e5'),'as':_0x8aac('0x1d7')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'foreignKey':_0x8aac('0x1e6'),'as':_0x8aac('0x1d9')});db[_0x8aac('0x1e7')][_0x8aac('0x11e')](db['SmsMessage'],{});db[_0x8aac('0x1e7')][_0x8aac('0x11e')](db[_0x8aac('0x54')],{});db[_0x8aac('0x1e7')]['belongsTo'](db[_0x8aac('0x50')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x8aac('0x1e7')]['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'FromUserId','as':_0x8aac('0x1dc')});db['SmsTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0x1e7')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x8aac('0x1e8'),'as':_0x8aac('0x1d7')});db['SmsTransferReport']['belongsTo'](db[_0x8aac('0x50')],{'foreignKey':_0x8aac('0x1e9'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x73')],{'as':'CustomFields','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x121')],{'as':'Contacts','onDelete':_0x8aac('0x10a'),'foreignKey':'ListId'});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x176')});db['CmList']['hasMany'](db[_0x8aac('0x112')],{'as':'HopperHistory','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')]['hasMany'](db[_0x8aac('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')][_0x8aac('0x11f')](db[_0x8aac('0x16')],{'as':_0x8aac('0x1ea'),'through':'voice_queues_has_cm_lists'});db[_0x8aac('0xeb')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Agents','through':_0x8aac('0x123')});db[_0x8aac('0xed')][_0x8aac('0x10c')](db['VoiceExtension'],{'as':_0x8aac('0x110'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xed')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0x8aac('0x124')],{'through':_0x8aac('0x105'),'as':_0x8aac('0x153')});db[_0x8aac('0xef')][_0x8aac('0x10c')](db['User'],{'as':'Users','foreignKey':_0x8aac('0x1eb')});db[_0x8aac('0xef')][_0x8aac('0x10c')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x8aac('0x1eb'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xf1')][_0x8aac('0x10c')](db[_0x8aac('0xf3')],{'as':_0x8aac('0x1ec'),'foreignKey':_0x8aac('0x1ed'),'onDelete':_0x8aac('0x10a')});db['WhatsappAccount']['hasMany'](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x1ee'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xf7')]['hasMany'](db[_0x8aac('0x77')],{'as':'Answers','foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db['WhatsappMessage'],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db[_0x8aac('0x11a')],{'as':'Interactions'});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db[_0x8aac('0x1ef')],{'as':_0x8aac('0x143')});db[_0x8aac('0xf7')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db['WhatsappAccount'][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0xf7')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'user_has_whatsapp_accounts'});db[_0x8aac('0x1ef')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x8aac('0x1ef')]['belongsTo'](db[_0x8aac('0x100')],{'onDelete':_0x8aac('0x15f')});db['WhatsappApplication'][_0x8aac('0x11e')](db['WhatsappAccount'],{'onDelete':_0x8aac('0x15f')});db['WhatsappApplication'][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'onDelete':_0x8aac('0x15f'),'foreignKey':'IntervalId'});db[_0x8aac('0x1ef')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db['WhatsappInteraction'][_0x8aac('0x10c')](db[_0x8aac('0xfa')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1f0')});db['WhatsappInteraction']['belongsTo'](db[_0x8aac('0xf7')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0x11a')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11a')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x1ab'),'as':_0x8aac('0x179')});db[_0x8aac('0x11a')]['belongsToMany'](db['Tag'],{'through':_0x8aac('0x1ab'),'as':_0x8aac('0x16c')});db[_0x8aac('0x11a')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':_0x8aac('0x1f1'),'foreignKey':'WhatsappInteractionId'});db[_0x8aac('0xfa')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':'User'});db[_0x8aac('0xfa')]['belongsTo'](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db['WhatsappMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11a')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'WhatsappInteractionId'});db[_0x8aac('0xfa')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':'ListId'});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['WhatsappQueueReport'][_0x8aac('0x11e')](db['WhatsappInteraction'],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0x100')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xfa')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db['WhatsappInteraction'],{});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{'foreignKey':_0x8aac('0x1f2'),'as':_0x8aac('0x1da')});db[_0x8aac('0xfe')]['belongsTo'](db[_0x8aac('0xf7')],{'foreignKey':_0x8aac('0x1f3'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db[_0x8aac('0x100')],{'foreignKey':_0x8aac('0x1f4'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db['User'],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xfe')]['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db[_0x8aac('0x100')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x32'),'foreignKey':'WhatsappQueueId'});db[_0x8aac('0x100')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x1ce'),'as':_0x8aac('0x153')});db[_0x8aac('0x108')]['belongsTo'](db[_0x8aac('0x11')],{'as':_0x8aac('0x1f5'),'foreignKey':_0x8aac('0x10b'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x8aac('0x34')],{'as':_0x8aac('0x160'),'onDelete':_0x8aac('0x15f')});db['CloudProvider'][_0x8aac('0x109')](db[_0x8aac('0x36')],{'as':_0x8aac('0x161'),'onDelete':_0x8aac('0x15f')});module[_0x8aac('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x6b16=['../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.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','../api/pause/pause.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','ChatInteraction','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoicePrefix','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','Applications','Sound','Sounds','Members','Hoppers','VoiceQueueId','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','ScreenRecording','VoiceMailMessage','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Dispositions','CannedAnswer','Messages','Interactions','MailApplication','ListId','TemplateId','Agents','team_has_mail_queues','Account','Owner','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatWebsiteId','List','Dashboard','DashboardItem','Items','Answers','FaxAccountId','Exntensions','mandatoryDispositionPause','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','Tags','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','AttachmentId','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','moh_has_sounds','mail_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerAccount','ServicenowAccount','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','user_has_square_projects','SmsQueues','team_has_whatsapp_queues','VoicePrefixes','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','TeamVoicePrefix','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','lodash','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt'];(function(_0x399a1f,_0x108aa2){var _0x1b0e9f=function(_0x15e26d){while(--_0x15e26d){_0x399a1f['push'](_0x399a1f['shift']());}};_0x1b0e9f(++_0x108aa2);}(_0x6b16,0x1c8));var _0x66b1=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x6b16[_0x10c16d];return _0x5896f4;};'use strict';var config=require(_0x66b1('0x0'));var Sequelize=require('sequelize');var _=require(_0x66b1('0x1'));var jstz=require('jstz');var timezone=jstz[_0x66b1('0x2')]();config[_0x66b1('0x3')]=_[_0x66b1('0x4')](config[_0x66b1('0x3')],{'database':'motion2','username':_0x66b1('0x5'),'password':_0x66b1('0x6'),'options':{'host':_0x66b1('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x66b1('0x8')},'logging':![],'timezone':timezone[_0x66b1('0x9')](),'define':{'charset':_0x66b1('0xa'),'collate':_0x66b1('0xb')}}});config[_0x66b1('0xc')]=_['defaultsDeep'](config[_0x66b1('0xc')],{'database':_0x66b1('0xd'),'username':_0x66b1('0x5'),'password':_0x66b1('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x66b1('0xa'),'collate':_0x66b1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66b1('0x3')][_0x66b1('0xe')],config[_0x66b1('0x3')][_0x66b1('0xf')],config[_0x66b1('0x3')][_0x66b1('0x10')],config['sequelize'][_0x66b1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66b1('0xc')][_0x66b1('0xe')],config[_0x66b1('0xc')][_0x66b1('0xf')],config[_0x66b1('0xc')]['password'],config[_0x66b1('0xc')][_0x66b1('0x11')])};db[_0x66b1('0x12')]=db['sequelize'][_0x66b1('0x13')]('../api/user/user.model');db[_0x66b1('0x14')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x15'));db[_0x66b1('0x16')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x17'));db[_0x66b1('0x18')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x19'));db[_0x66b1('0x1a')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x1b'));db[_0x66b1('0x1c')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x66b1('0x1d')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x1e'));db[_0x66b1('0x1f')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x20'));db['VoiceMailMessage']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x21'));db[_0x66b1('0x22')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0x66b1('0x23')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x24'));db[_0x66b1('0x25')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x66b1('0x26')]=db[_0x66b1('0x3')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0x66b1('0x3')]['import'](_0x66b1('0x27'));db['Trunk']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x28'));db[_0x66b1('0x29')]=db['sequelize']['import'](_0x66b1('0x2a'));db[_0x66b1('0x2b')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x2c'));db[_0x66b1('0x2d')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db['sequelize']['import'](_0x66b1('0x2e'));db['UserMailQueue']=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x66b1('0x2f')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x30'));db['UserSmsQueue']=db[_0x66b1('0x3')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x66b1('0x31')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x32'));db[_0x66b1('0x33')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x34'));db[_0x66b1('0x35')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x36'));db[_0x66b1('0x37')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0x66b1('0x38')]=db[_0x66b1('0x3')]['import']('../api/mailAccount/mailAccount.model');db[_0x66b1('0x39')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x3a'));db[_0x66b1('0x3b')]=db[_0x66b1('0x3')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x66b1('0x3c')]=db['sequelize'][_0x66b1('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x66b1('0x3d')]=db[_0x66b1('0x3')]['import']('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/mailApplication/mailApplication.model');db[_0x66b1('0x3e')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x3f'));db['Dashboard']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x40'));db['DashboardItem']=db[_0x66b1('0x3')]['import'](_0x66b1('0x41'));db[_0x66b1('0x42')]=db[_0x66b1('0x3')]['import']('../api/faxAccount/faxAccount.model');db[_0x66b1('0x43')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x44'));db[_0x66b1('0x45')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x66b1('0x46')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x47'));db[_0x66b1('0x48')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x49'));db[_0x66b1('0x4a')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x4b'));db['SmsAccount']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x4c'));db[_0x66b1('0x4d')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x4e'));db[_0x66b1('0x4f')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x50'));db[_0x66b1('0x51')]=db['sequelize']['import'](_0x66b1('0x52'));db['SmsQueue']=db[_0x66b1('0x3')]['import'](_0x66b1('0x53'));db[_0x66b1('0x54')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x55'));db[_0x66b1('0x56')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x66b1('0x57')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x58'));db[_0x66b1('0x59')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x5a'));db[_0x66b1('0x5b')]=db[_0x66b1('0x3')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x66b1('0x5c')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x66b1('0x5d')]=db['sequelize']['import'](_0x66b1('0x5e'));db['ChatInteraction']=db['sequelize'][_0x66b1('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x66b1('0x5f')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x60'));db[_0x66b1('0x61')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x62'));db[_0x66b1('0x63')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x64'));db[_0x66b1('0x65')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x66'));db[_0x66b1('0x67')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x68'));db['CmCompany']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x69'));db[_0x66b1('0x6a')]=db['sequelize'][_0x66b1('0x13')]('../api/cmContact/cmContact.model');db[_0x66b1('0x6b')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x6c'));db['CmHopperBlack']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x6d'));db['CmHopperFinal']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x6e'));db[_0x66b1('0x6f')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x70'));db[_0x66b1('0x71')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x72'));db[_0x66b1('0x73')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x74'));db['Action']=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/action/action.model');db[_0x66b1('0x75')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x76'));db['CannedAnswer']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x77'));db[_0x66b1('0x78')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x79'));db[_0x66b1('0x7a')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x7b'));db[_0x66b1('0x7c')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x7d'));db['Pause']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x7e'));db['Cdr']=db['sequelize']['import']('../api/cdr/cdr.model');db[_0x66b1('0x7f')]=db['sequelize'][_0x66b1('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x66b1('0x80')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x81'));db['Sound']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x82'));db[_0x66b1('0x83')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x84'));db[_0x66b1('0x85')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x86'));db[_0x66b1('0x87')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x88'));db[_0x66b1('0x89')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x8a'));db[_0x66b1('0x8b')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x8c'));db['IntegrationReport']=db['sequelize']['import'](_0x66b1('0x8d'));db['AnalyticCustomReport']=db[_0x66b1('0x3')]['import'](_0x66b1('0x8e'));db[_0x66b1('0x8f')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x90'));db[_0x66b1('0x91')]=db[_0x66b1('0x3')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x66b1('0x92')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x93'));db['AnalyticFieldReport']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x94'));db[_0x66b1('0x95')]=db[_0x66b1('0x3')]['import'](_0x66b1('0x96'));db[_0x66b1('0x97')]=db['sequelize'][_0x66b1('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x66b1('0x98')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x99'));db[_0x66b1('0x9a')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x66b1('0x9b')]=db[_0x66b1('0x3')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x66b1('0x9c')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x66b1('0x9d')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x9e'));db[_0x66b1('0x9f')]=db[_0x66b1('0x3')]['import']('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xa0'));db['DeskField']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xa1'));db['ZohoAccount']=db[_0x66b1('0x3')]['import'](_0x66b1('0xa2'));db[_0x66b1('0xa3')]=db['sequelize']['import'](_0x66b1('0xa4'));db[_0x66b1('0xa5')]=db['sequelize'][_0x66b1('0x13')]('../api/intZohoField/intZohoField.model');db[_0x66b1('0xa6')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xa7'));db[_0x66b1('0xa8')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xa9'));db[_0x66b1('0xaa')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xab'));db['FreshdeskAccount']=db['sequelize'][_0x66b1('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x66b1('0xac')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x66b1('0xad')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xae'));db['VtigerAccount']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xaf'));db[_0x66b1('0xb0')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xb1'));db[_0x66b1('0xb2')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xb3'));db['ServicenowAccount']=db['sequelize'][_0x66b1('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x66b1('0xb4')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xb5'));db[_0x66b1('0xb6')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xb7'));db[_0x66b1('0xb8')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xb9'));db[_0x66b1('0xba')]=db['sequelize'][_0x66b1('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x66b1('0xbb')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xbc'));db['FreshsalesAccount']=db[_0x66b1('0x3')]['import'](_0x66b1('0xbd'));db[_0x66b1('0xbe')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xbf'));db[_0x66b1('0xc0')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xc1'));db[_0x66b1('0x8b')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0x8c'));db['Network']=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/network/network.model');db['ChatQueueReport']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xc2'));db[_0x66b1('0xc3')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xc4'));db[_0x66b1('0xc5')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x66b1('0xc6')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xc7'));db[_0x66b1('0xc8')]=db[_0x66b1('0x3')]['import'](_0x66b1('0xc9'));db[_0x66b1('0xca')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xcb'));db['SquareReport']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xcc'));db[_0x66b1('0xcd')]=db['sequelize'][_0x66b1('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x66b1('0xce')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xcf'));db[_0x66b1('0xd0')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xd1'));db[_0x66b1('0xd2')]=db[_0x66b1('0x3')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x66b1('0xd3')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xd4'));db[_0x66b1('0xd5')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/squareRecording/squareRecording.model');db[_0x66b1('0xd6')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xd7'));db[_0x66b1('0xd8')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xd9'));db[_0x66b1('0xda')]=db[_0x66b1('0x3')]['import'](_0x66b1('0xdb'));db[_0x66b1('0xdc')]=db['sequelize'][_0x66b1('0x13')]('../api/campaign/campaign.model');db[_0x66b1('0xdd')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xde'));db['Attachment']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xdf'));db['Plugin']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xe0'));db[_0x66b1('0xe1')]=db['sequelize']['import']('../api/mailTransferReport/mailTransferReport.model');db[_0x66b1('0xe2')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xe3'));db[_0x66b1('0xe4')]=db[_0x66b1('0x3')]['import'](_0x66b1('0xe5'));db[_0x66b1('0xe6')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xe7'));db[_0x66b1('0xe8')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xe9'));db[_0x66b1('0xea')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xeb'));db[_0x66b1('0xec')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xed'));db['UserProfile']=db['sequelize'][_0x66b1('0x13')]('../api/userProfile/userProfile.model');db[_0x66b1('0xee')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xef'));db[_0x66b1('0xf0')]=db[_0x66b1('0x3')]['import'](_0x66b1('0xf1'));db[_0x66b1('0xf2')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xf3'));db['WhatsappAccount']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xf4'));db[_0x66b1('0xf5')]=db['sequelize']['import'](_0x66b1('0xf6'));db['WhatsappInteraction']=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xf7'));db[_0x66b1('0xf8')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x66b1('0xf9')]=db[_0x66b1('0x3')][_0x66b1('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize']['import'](_0x66b1('0xfa'));db[_0x66b1('0xfb')]=db['sequelize'][_0x66b1('0x13')](_0x66b1('0xfc'));db[_0x66b1('0xfd')]=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0x66b1('0xfe')]=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0xff'));db['TeamVoicePrefix']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x100'));db['UserVoicePrefix']=db[_0x66b1('0x3')][_0x66b1('0x13')](_0x66b1('0x101'));db[_0x66b1('0x102')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db[_0x66b1('0x12')][_0x66b1('0x103')](db[_0x66b1('0x1f')],{'as':_0x66b1('0x1f'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')][_0x66b1('0x103')](db['UserSetting'],{'as':_0x66b1('0x106'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')][_0x66b1('0x107')](db['VoiceRecording'],{'as':_0x66b1('0x108'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')][_0x66b1('0x107')](db[_0x66b1('0x2b')],{'as':_0x66b1('0x109'),'foreignKey':'UserId'});db[_0x66b1('0x12')][_0x66b1('0x107')](db['VoiceExtension'],{'as':_0x66b1('0x10a'),'onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x12')][_0x66b1('0x107')](db[_0x66b1('0x10b')],{'as':_0x66b1('0x10c'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')]['hasMany'](db[_0x66b1('0x6f')],{'as':_0x66b1('0x10d'),'foreignKey':'UserId'});db[_0x66b1('0x12')][_0x66b1('0x107')](db[_0x66b1('0x71')],{'as':_0x66b1('0x71'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')]['hasMany'](db[_0x66b1('0x57')],{'as':_0x66b1('0x10e'),'foreignKey':_0x66b1('0x105')});db['User'][_0x66b1('0x107')](db['ChatInteraction'],{'as':_0x66b1('0x10f'),'foreignKey':_0x66b1('0x105')});db['User']['hasMany'](db[_0x66b1('0x4f')],{'as':'SmsInteractions','foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0x66b1('0x110'),'foreignKey':_0x66b1('0x105')});db['User'][_0x66b1('0x107')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x66b1('0x105')});db[_0x66b1('0x12')][_0x66b1('0x107')](db[_0x66b1('0x111')],{'as':_0x66b1('0x112'),'foreignKey':_0x66b1('0x105')});db['User']['hasMany'](db[_0x66b1('0xf2')],{'as':_0x66b1('0x113'),'foreignKey':'SenderId'});db[_0x66b1('0x12')][_0x66b1('0x114')](db[_0x66b1('0x115')],{'as':_0x66b1('0x115'),'foreignKey':_0x66b1('0x116')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x65')],{'as':_0x66b1('0x118'),'through':_0x66b1('0x119')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x11a'),'through':_0x66b1('0x11b')});db[_0x66b1('0x12')][_0x66b1('0x117')](db['CmList'],{'as':_0x66b1('0x11c'),'through':_0x66b1('0x11d')});db['User'][_0x66b1('0x117')](db[_0x66b1('0xd8')],{'through':_0x66b1('0x11e')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x3c')],{'as':_0x66b1('0x11f'),'through':'user_has_mail_interactions'});db['User'][_0x66b1('0x117')](db[_0x66b1('0x120')],{'as':_0x66b1('0x10f'),'through':'user_has_chat_interactions'});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x45')],{'as':_0x66b1('0x110'),'through':_0x66b1('0x121')});db[_0x66b1('0x12')][_0x66b1('0x117')](db['SmsInteraction'],{'as':_0x66b1('0x122'),'through':_0x66b1('0x123')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x57')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x66b1('0x12')][_0x66b1('0x117')](db['WhatsappInteraction'],{'as':_0x66b1('0x112'),'through':_0x66b1('0x124')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x1c')],{'as':_0x66b1('0x125'),'through':'UserVoiceQueue','required':![]});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0xec')],{'as':'VoicePrefixes','through':_0x66b1('0x126'),'required':![]});db['User'][_0x66b1('0x117')](db[_0x66b1('0x39')],{'as':_0x66b1('0x127'),'through':_0x66b1('0x128'),'required':![]});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x63')],{'as':_0x66b1('0x129'),'through':_0x66b1('0x12a'),'required':![],'hooks':!![]});db[_0x66b1('0x12')]['belongsToMany'](db[_0x66b1('0x48')],{'as':_0x66b1('0x12b'),'through':_0x66b1('0x2f'),'required':![]});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x12c')],{'as':'SmsQueues','through':_0x66b1('0x12d'),'required':![]});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x59')],{'as':_0x66b1('0x12e'),'through':_0x66b1('0x31'),'required':![]});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0xfb')],{'as':_0x66b1('0x12f'),'through':_0x66b1('0x33'),'required':![]});db['User'][_0x66b1('0x117')](db[_0x66b1('0xea')],{'through':'cm_user_has_lists'});db['User'][_0x66b1('0x117')](db[_0x66b1('0x5b')],{'as':_0x66b1('0x130'),'through':'user_has_chat_websites'});db[_0x66b1('0x12')]['belongsToMany'](db[_0x66b1('0x42')],{'as':_0x66b1('0x131'),'through':'user_has_fax_accounts'});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x38')],{'as':_0x66b1('0x132'),'through':_0x66b1('0x133')});db[_0x66b1('0x12')]['belongsToMany'](db[_0x66b1('0x54')],{'as':_0x66b1('0x134'),'through':_0x66b1('0x135')});db['User'][_0x66b1('0x117')](db[_0x66b1('0x136')],{'as':_0x66b1('0x137'),'through':_0x66b1('0x138')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0x139')],{'as':_0x66b1('0x13a'),'through':_0x66b1('0x13b')});db[_0x66b1('0x12')][_0x66b1('0x117')](db[_0x66b1('0xd3')],{'as':_0x66b1('0x13c'),'through':'user_has_square_projects'});db[_0x66b1('0x14')][_0x66b1('0x107')](db[_0x66b1('0x18')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db['VoiceContext'][_0x66b1('0x107')](db[_0x66b1('0x18')],{'onDelete':_0x66b1('0x104')});db['VoiceExtension'][_0x66b1('0x107')](db[_0x66b1('0x18')],{'as':_0x66b1('0x13d'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x1a')][_0x66b1('0x117')](db[_0x66b1('0x13e')],{'as':_0x66b1('0x13f'),'through':'moh_has_sounds'});db[_0x66b1('0x1c')][_0x66b1('0x107')](db[_0x66b1('0x2b')],{'as':_0x66b1('0x140'),'foreignKey':'VoiceQueueId'});db[_0x66b1('0x1c')][_0x66b1('0x107')](db[_0x66b1('0x6b')],{'as':_0x66b1('0x141'),'foreignKey':_0x66b1('0x142')});db[_0x66b1('0x1c')][_0x66b1('0x107')](db[_0x66b1('0x10b')],{'as':'HopperFinals','foreignKey':_0x66b1('0x142')});db[_0x66b1('0x1c')][_0x66b1('0x107')](db[_0x66b1('0x6f')],{'as':_0x66b1('0x143'),'foreignKey':_0x66b1('0x142')});db[_0x66b1('0x1c')][_0x66b1('0x107')](db['ReportAgentPreview'],{'as':_0x66b1('0x71'),'foreignKey':_0x66b1('0x142')});db[_0x66b1('0x1c')][_0x66b1('0x107')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x66b1('0x142')});db[_0x66b1('0x1c')][_0x66b1('0x107')](db[_0x66b1('0xc8')],{'as':_0x66b1('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['belongsTo'](db[_0x66b1('0x145')],{'as':_0x66b1('0x145'),'foreignKey':_0x66b1('0x146')});db[_0x66b1('0x1c')][_0x66b1('0x114')](db['Trunk'],{'as':_0x66b1('0x147'),'foreignKey':'TrunkBackupId'});db[_0x66b1('0x1c')][_0x66b1('0x114')](db['Interval'],{'as':_0x66b1('0x7c'),'foreignKey':_0x66b1('0x148')});db['VoiceQueue'][_0x66b1('0x114')](db[_0x66b1('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x1c')]['belongsToMany'](db[_0x66b1('0xea')],{'as':'Lists','through':_0x66b1('0x14b')});db[_0x66b1('0x1c')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x66b1('0x2d')});db[_0x66b1('0x1c')][_0x66b1('0x117')](db[_0x66b1('0xd8')],{'as':_0x66b1('0x14c'),'through':_0x66b1('0xfe')});db['VoiceQueue']['belongsToMany'](db[_0x66b1('0xea')],{'as':_0x66b1('0x14d'),'through':'voice_queues_has_cm_blacklists'});db[_0x66b1('0x1d')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':'User','foreignKey':_0x66b1('0x105')});db[_0x66b1('0x14e')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x12'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x1f')][_0x66b1('0x107')](db[_0x66b1('0x14f')],{'as':'Messages','onDelete':_0x66b1('0x104'),'foreignKey':'mailboxuser','sourceKey':_0x66b1('0x150')});db[_0x66b1('0x14f')][_0x66b1('0x114')](db[_0x66b1('0x1f')],{'foreignKey':_0x66b1('0x151'),'targetKey':_0x66b1('0x150')});db['VoiceCallReport'][_0x66b1('0x107')](db[_0x66b1('0x26')],{'as':_0x66b1('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0x66b1('0x22')][_0x66b1('0x107')](db[_0x66b1('0x25')],{'as':'AgentReports','foreignKey':_0x66b1('0x153'),'constraints':![]});db[_0x66b1('0x22')]['belongsTo'](db[_0x66b1('0x12')],{'as':_0x66b1('0x12'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x22')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db['MailServerIn'][_0x66b1('0x114')](db[_0x66b1('0x38')],{'as':_0x66b1('0x38'),'foreignKey':_0x66b1('0x156')});db['MailServerIn'][_0x66b1('0x114')](db[_0x66b1('0xfd')],{'as':_0x66b1('0xfd'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x66b1('0x37')]['belongsTo'](db[_0x66b1('0x38')],{'as':_0x66b1('0x38'),'foreignKey':_0x66b1('0x156')});db[_0x66b1('0x37')][_0x66b1('0x114')](db[_0x66b1('0xfd')],{'as':'CloudProvider','foreignKey':_0x66b1('0x157'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x38')][_0x66b1('0x103')](db[_0x66b1('0x35')],{'as':'Imap','onDelete':_0x66b1('0x104')});db[_0x66b1('0x38')][_0x66b1('0x103')](db[_0x66b1('0x37')],{'as':_0x66b1('0x159'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x38')][_0x66b1('0x107')](db['Disposition'],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x156'),'onDelete':'cascade'});db[_0x66b1('0x38')][_0x66b1('0x107')](db[_0x66b1('0x15b')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x66b1('0x38')][_0x66b1('0x107')](db[_0x66b1('0x3d')],{'as':_0x66b1('0x15c'),'foreignKey':_0x66b1('0x156')});db[_0x66b1('0x38')][_0x66b1('0x107')](db[_0x66b1('0x3c')],{'as':_0x66b1('0x15d')});db[_0x66b1('0x38')][_0x66b1('0x107')](db[_0x66b1('0x15e')],{'as':_0x66b1('0x13d')});db[_0x66b1('0x38')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':'List','foreignKey':_0x66b1('0x15f')});db['MailAccount'][_0x66b1('0x114')](db['Template'],{'as':_0x66b1('0x85'),'foreignKey':_0x66b1('0x160')});db['MailAccount'][_0x66b1('0x114')](db[_0x66b1('0x149')],{'as':'mandatoryDispositionPause','foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x38')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x133')});db['MailQueue'][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0x66b1('0xd8')],{'through':_0x66b1('0x162'),'as':'Teams'});db['MailInteraction']['hasMany'](db[_0x66b1('0x3d')],{'as':_0x66b1('0x15c'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x66b1('0x3c')][_0x66b1('0x114')](db[_0x66b1('0x38')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x156')});db[_0x66b1('0x3c')]['belongsTo'](db[_0x66b1('0x6a')],{'as':'Contact','foreignKey':_0x66b1('0x155')});db[_0x66b1('0x3c')]['belongsTo'](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x3c')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x66b1('0x3c')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':'mail_interaction_has_tags','as':_0x66b1('0x165')});db['MailInteraction'][_0x66b1('0x117')](db['User'],{'as':_0x66b1('0x166'),'through':'user_has_mail_interactions','foreignKey':_0x66b1('0x167')});db[_0x66b1('0x3d')][_0x66b1('0x107')](db[_0x66b1('0x168')],{'as':_0x66b1('0x169'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x3d')]['belongsTo'](db[_0x66b1('0x12')],{'as':_0x66b1('0x12')});db['MailMessage']['belongsTo'](db[_0x66b1('0x6a')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x154')});db[_0x66b1('0x3d')][_0x66b1('0x114')](db[_0x66b1('0x3c')],{'as':_0x66b1('0x16a'),'foreignKey':'MailInteractionId'});db[_0x66b1('0x3d')]['belongsTo'](db[_0x66b1('0x38')],{'as':'Account','foreignKey':_0x66b1('0x156')});db[_0x66b1('0x3d')][_0x66b1('0x114')](db['ChatWebsite'],{'as':_0x66b1('0x5b'),'foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x3d')][_0x66b1('0x114')](db[_0x66b1('0x61')],{'as':_0x66b1('0x61'),'foreignKey':'ChatOfflineMessageId'});db[_0x66b1('0x15e')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':_0x66b1('0x158')});db['MailApplication'][_0x66b1('0x114')](db['MailQueue'],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x15e')][_0x66b1('0x114')](db[_0x66b1('0x38')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x15e')][_0x66b1('0x114')](db[_0x66b1('0x7c')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x148')});db[_0x66b1('0x15e')]['belongsTo'](db[_0x66b1('0x83')],{'onDelete':_0x66b1('0x158'),'foreignKey':'TagId'});db['MailQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x38')],{});db[_0x66b1('0x3e')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0x3e')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db['MailQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x3c')],{});db[_0x66b1('0x3e')][_0x66b1('0x114')](db[_0x66b1('0x3d')],{});db[_0x66b1('0x3e')]['belongsTo'](db[_0x66b1('0x12')],{});db['MailQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x39')],{});db[_0x66b1('0x16d')][_0x66b1('0x107')](db[_0x66b1('0x16e')],{'as':_0x66b1('0x16f'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x42')][_0x66b1('0x107')](db['Disposition'],{'as':_0x66b1('0x15a'),'foreignKey':'FaxAccountId','onDelete':_0x66b1('0x104')});db['FaxAccount']['hasMany'](db[_0x66b1('0x15b')],{'as':_0x66b1('0x170'),'foreignKey':_0x66b1('0x171')});db[_0x66b1('0x42')][_0x66b1('0x107')](db[_0x66b1('0x45')],{'as':_0x66b1('0x15d')});db[_0x66b1('0x42')][_0x66b1('0x107')](db[_0x66b1('0x43')],{'as':_0x66b1('0x13d')});db[_0x66b1('0x42')]['hasMany'](db[_0x66b1('0x18')],{'as':_0x66b1('0x172'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x42')]['hasMany'](db[_0x66b1('0x46')],{'as':_0x66b1('0x15c')});db[_0x66b1('0x42')][_0x66b1('0x114')](db[_0x66b1('0x145')],{'as':_0x66b1('0x145')});db[_0x66b1('0x42')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0x42')][_0x66b1('0x114')](db['Pause'],{'as':_0x66b1('0x173'),'foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x42')]['belongsToMany'](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x174')});db['FaxApplication'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x43')][_0x66b1('0x114')](db[_0x66b1('0x48')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x43')]['belongsTo'](db[_0x66b1('0x42')],{'onDelete':_0x66b1('0x158')});db['FaxApplication'][_0x66b1('0x114')](db['Tag'],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x175')});db[_0x66b1('0x45')][_0x66b1('0x107')](db['FaxMessage'],{'as':_0x66b1('0x15c'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x176')});db[_0x66b1('0x45')][_0x66b1('0x114')](db[_0x66b1('0x42')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x171')});db['FaxInteraction'][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db['FaxInteraction']['belongsTo'](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':_0x66b1('0x105')});db[_0x66b1('0x45')][_0x66b1('0x117')](db['Tag'],{'through':_0x66b1('0x177'),'as':_0x66b1('0x178')});db[_0x66b1('0x45')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x66b1('0x45')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x166'),'through':_0x66b1('0x121'),'foreignKey':'FaxInteractionId'});db[_0x66b1('0x46')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x12')});db['FaxMessage'][_0x66b1('0x114')](db['FaxInteraction'],{'as':_0x66b1('0x16a'),'foreignKey':_0x66b1('0x176')});db[_0x66b1('0x46')]['belongsTo'](db['CmContact'],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x154')});db[_0x66b1('0x46')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x66b1('0x46')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x66b1('0x171')});db['FaxQueue'][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x2f')});db[_0x66b1('0x48')]['belongsToMany'](db[_0x66b1('0xd8')],{'through':_0x66b1('0x179'),'as':_0x66b1('0x14c')});db['FaxQueueReport']['belongsTo'](db[_0x66b1('0x42')],{});db[_0x66b1('0x4a')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0x4a')][_0x66b1('0x114')](db['CmContact'],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db['FaxQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x45')],{});db['FaxQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x46')],{});db[_0x66b1('0x4a')][_0x66b1('0x114')](db[_0x66b1('0x12')],{});db['FaxQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x48')],{});db['SmsAccount'][_0x66b1('0x107')](db[_0x66b1('0x78')],{'as':_0x66b1('0x15a'),'foreignKey':'SmsAccountId','onDelete':_0x66b1('0x104')});db['SmsAccount'][_0x66b1('0x107')](db[_0x66b1('0x15b')],{'as':_0x66b1('0x170'),'foreignKey':'SmsAccountId'});db[_0x66b1('0x136')][_0x66b1('0x107')](db[_0x66b1('0x51')],{'as':_0x66b1('0x15c'),'foreignKey':_0x66b1('0x17a')});db[_0x66b1('0x136')][_0x66b1('0x107')](db[_0x66b1('0x4f')],{'as':'Interactions'});db[_0x66b1('0x136')][_0x66b1('0x107')](db[_0x66b1('0x4d')],{'as':'Applications'});db[_0x66b1('0x136')]['belongsTo'](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':'ListId'});db[_0x66b1('0x136')][_0x66b1('0x114')](db[_0x66b1('0x149')],{'as':_0x66b1('0x173'),'foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x136')][_0x66b1('0x117')](db['User'],{'as':_0x66b1('0x161'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':'restrict'});db[_0x66b1('0x4d')][_0x66b1('0x114')](db[_0x66b1('0x12c')],{'onDelete':_0x66b1('0x158')});db['SmsApplication']['belongsTo'](db[_0x66b1('0x136')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x4d')][_0x66b1('0x114')](db[_0x66b1('0x7c')],{'onDelete':_0x66b1('0x158'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x66b1('0x114')](db[_0x66b1('0x83')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x175')});db['SmsInteraction'][_0x66b1('0x107')](db[_0x66b1('0x51')],{'as':_0x66b1('0x15c'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x17b')});db[_0x66b1('0x4f')][_0x66b1('0x114')](db[_0x66b1('0x136')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x17a')});db[_0x66b1('0x4f')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0x4f')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':_0x66b1('0x105')});db['SmsInteraction'][_0x66b1('0x117')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x66b1('0x178')});db[_0x66b1('0x4f')][_0x66b1('0x117')](db['Tag'],{'through':_0x66b1('0x17c'),'as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x66b1('0x166'),'through':_0x66b1('0x123'),'foreignKey':_0x66b1('0x17b')});db['SmsMessage'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x12')});db[_0x66b1('0x51')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'onDelete':'cascade','as':_0x66b1('0x154')});db[_0x66b1('0x51')][_0x66b1('0x114')](db[_0x66b1('0x4f')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x16a'),'foreignKey':_0x66b1('0x17b')});db[_0x66b1('0x51')][_0x66b1('0x114')](db['SmsAccount'],{'as':'Account','foreignKey':_0x66b1('0x17a')});db[_0x66b1('0x12c')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x12d'),'foreignKey':_0x66b1('0x17d')});db[_0x66b1('0x12c')][_0x66b1('0x117')](db[_0x66b1('0xd8')],{'through':_0x66b1('0x17e'),'as':_0x66b1('0x14c')});db[_0x66b1('0x54')][_0x66b1('0x107')](db['Disposition'],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x17f'),'onDelete':'cascade'});db['OpenchannelAccount'][_0x66b1('0x107')](db[_0x66b1('0x15b')],{'as':_0x66b1('0x170'),'foreignKey':_0x66b1('0x17f')});db[_0x66b1('0x54')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x66b1('0x15d'),'foreignKey':_0x66b1('0x17f')});db[_0x66b1('0x54')]['hasMany'](db[_0x66b1('0x180')],{'as':_0x66b1('0x15c'),'foreignKey':'OpenchannelAccountId'});db[_0x66b1('0x54')][_0x66b1('0x107')](db[_0x66b1('0x56')],{'as':_0x66b1('0x13d'),'foreignKey':_0x66b1('0x17f')});db['OpenchannelAccount']['belongsTo'](db[_0x66b1('0xea')],{'as':'List','foreignKey':'ListId'});db[_0x66b1('0x54')]['belongsTo'](db['Pause'],{'as':_0x66b1('0x173'),'foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x54')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':'Agents','through':_0x66b1('0x135')});db['OpenchannelApplication'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0x56')][_0x66b1('0x114')](db['OpenchannelQueue'],{'onDelete':_0x66b1('0x158'),'foreignKey':'OpenchannelQueueId'});db[_0x66b1('0x56')][_0x66b1('0x114')](db[_0x66b1('0x54')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x17f')});db['OpenchannelApplication'][_0x66b1('0x114')](db[_0x66b1('0x7c')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x148')});db[_0x66b1('0x56')][_0x66b1('0x114')](db[_0x66b1('0x83')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x175')});db[_0x66b1('0x57')][_0x66b1('0x107')](db[_0x66b1('0x180')],{'as':_0x66b1('0x15c'),'onDelete':'cascade','foreignKey':_0x66b1('0x181')});db[_0x66b1('0x57')]['belongsTo'](db[_0x66b1('0x54')],{'as':_0x66b1('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x66b1('0x57')][_0x66b1('0x114')](db['CmContact'],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0x57')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':'UserId'});db[_0x66b1('0x57')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':_0x66b1('0x182'),'as':'Tags'});db[_0x66b1('0x57')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x66b1('0x57')]['belongsToMany'](db['User'],{'as':_0x66b1('0x166'),'through':'user_has_openchannel_interactions','foreignKey':_0x66b1('0x181')});db[_0x66b1('0x180')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x12')});db['OpenchannelMessage'][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x154')});db[_0x66b1('0x180')]['belongsTo'](db[_0x66b1('0x57')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x16a'),'foreignKey':_0x66b1('0x181')});db[_0x66b1('0x180')]['belongsTo'](db[_0x66b1('0x168')],{'as':_0x66b1('0x168'),'foreignKey':'AttachmentId'});db[_0x66b1('0x180')][_0x66b1('0x114')](db[_0x66b1('0x54')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x17f')});db['OpenchannelQueue'][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':'UserOpenchannelQueue','foreignKey':_0x66b1('0x183')});db[_0x66b1('0x59')][_0x66b1('0x117')](db['Team'],{'through':_0x66b1('0x184'),'as':'Teams'});db[_0x66b1('0x5b')][_0x66b1('0x107')](db['Disposition'],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x16b'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x5b')][_0x66b1('0x107')](db[_0x66b1('0x15b')],{'as':_0x66b1('0x170'),'foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x5b')]['hasMany'](db[_0x66b1('0x67')],{'as':_0x66b1('0x185')});db[_0x66b1('0x5b')][_0x66b1('0x107')](db['ChatInteraction'],{'as':'Interactions'});db[_0x66b1('0x5b')][_0x66b1('0x107')](db[_0x66b1('0x5d')],{'as':_0x66b1('0x13d')});db['ChatWebsite'][_0x66b1('0x107')](db['ChatMessage'],{'as':_0x66b1('0x15c')});db[_0x66b1('0x5b')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db['ChatWebsite']['belongsTo'](db[_0x66b1('0x7c')],{'as':_0x66b1('0x7c'),'foreignKey':_0x66b1('0x148')});db[_0x66b1('0x5b')][_0x66b1('0x114')](db['MailAccount'],{'as':_0x66b1('0x38'),'foreignKey':_0x66b1('0x156')});db[_0x66b1('0x5b')][_0x66b1('0x114')](db[_0x66b1('0x149')],{'as':_0x66b1('0x173'),'foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x5b')]['belongsToMany'](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x186')});db[_0x66b1('0x5c')][_0x66b1('0x114')](db[_0x66b1('0x54')],{});db[_0x66b1('0x5c')]['belongsTo'](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0x5c')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0x5c')][_0x66b1('0x114')](db[_0x66b1('0x57')],{});db[_0x66b1('0x5c')][_0x66b1('0x114')](db[_0x66b1('0x180')],{});db['OpenchannelQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x12')],{});db[_0x66b1('0x5c')][_0x66b1('0x114')](db[_0x66b1('0x59')],{});db[_0x66b1('0x5d')]['belongsTo'](db[_0x66b1('0x12')],{'as':_0x66b1('0x187'),'foreignKey':_0x66b1('0x105'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x5d')][_0x66b1('0x114')](db['ChatQueue'],{'as':_0x66b1('0x188'),'foreignKey':_0x66b1('0x189'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x5d')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'as':_0x66b1('0x18a'),'foreignKey':_0x66b1('0x16b'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x5d')]['belongsTo'](db[_0x66b1('0x83')],{'onDelete':'restrict','foreignKey':_0x66b1('0x175')});db[_0x66b1('0x120')][_0x66b1('0x107')](db['ChatMessage'],{'as':_0x66b1('0x15c'),'onDelete':_0x66b1('0x104'),'foreignKey':'ChatInteractionId'});db[_0x66b1('0x120')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'as':'Account','foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x120')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':'Contact','foreignKey':_0x66b1('0x155')});db[_0x66b1('0x120')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':'UserId'});db[_0x66b1('0x120')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':_0x66b1('0x18b'),'as':_0x66b1('0x178')});db['ChatInteraction'][_0x66b1('0x117')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x66b1('0x165')});db['ChatInteraction'][_0x66b1('0x117')](db['User'],{'as':_0x66b1('0x166'),'through':_0x66b1('0x18c'),'foreignKey':_0x66b1('0x18d')});db['ChatMessage']['belongsTo'](db['User'],{'onDelete':_0x66b1('0x104'),'as':'User'});db['ChatMessage'][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'onDelete':_0x66b1('0x104'),'as':_0x66b1('0x154'),'foreignKey':'ContactId'});db['ChatMessage'][_0x66b1('0x114')](db[_0x66b1('0x120')],{'onDelete':_0x66b1('0x104'),'as':'Interaction','foreignKey':_0x66b1('0x18d')});db[_0x66b1('0x5f')]['belongsTo'](db[_0x66b1('0x168')],{'as':_0x66b1('0x168'),'foreignKey':_0x66b1('0x18e')});db[_0x66b1('0x5f')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'as':'Account','foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x61')][_0x66b1('0x107')](db[_0x66b1('0x168')],{'as':_0x66b1('0x169'),'foreignKey':_0x66b1('0x18f'),'onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x61')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'onDelete':_0x66b1('0x104'),'as':'Contact','foreignKey':_0x66b1('0x155')});db[_0x66b1('0x61')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x63')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x12a'),'hooks':!![]});db[_0x66b1('0x63')][_0x66b1('0x117')](db[_0x66b1('0xd8')],{'through':_0x66b1('0x190'),'as':_0x66b1('0x14c')});db[_0x66b1('0x65')][_0x66b1('0x107')](db[_0x66b1('0xc3')],{'as':_0x66b1('0x15c'),'foreignKey':_0x66b1('0x191'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x65')]['belongsToMany'](db[_0x66b1('0x12')],{'as':_0x66b1('0x140'),'through':'chat_group_has_users'});db[_0x66b1('0x67')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'as':'Website','foreignKey':_0x66b1('0x16b')});db[_0x66b1('0x192')]['hasMany'](db[_0x66b1('0x6a')],{'as':_0x66b1('0x11a'),'foreignKey':_0x66b1('0x193')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db[_0x66b1('0x6b')],{'as':_0x66b1('0x141'),'foreignKey':_0x66b1('0x155')});db['CmContact'][_0x66b1('0x107')](db[_0x66b1('0x10b')],{'as':'HopperFinals','foreignKey':_0x66b1('0x155')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db[_0x66b1('0x6f')],{'as':_0x66b1('0x143'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0x6a')]['hasMany'](db[_0x66b1('0x71')],{'as':_0x66b1('0x71'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db[_0x66b1('0xc8')],{'as':'JscriptySessions','foreignKey':_0x66b1('0x155')});db['CmContact'][_0x66b1('0x107')](db[_0x66b1('0x57')],{'as':'OpenchannelInteractions','foreignKey':_0x66b1('0x155'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db[_0x66b1('0x120')],{'as':'ChatInteractions','foreignKey':_0x66b1('0x155'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db['SmsInteraction'],{'as':_0x66b1('0x122'),'foreignKey':_0x66b1('0x155'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x6a')][_0x66b1('0x107')](db['FaxInteraction'],{'as':_0x66b1('0x110'),'foreignKey':'ContactId','onDelete':_0x66b1('0x158')});db[_0x66b1('0x6a')]['hasMany'](db[_0x66b1('0x3c')],{'as':_0x66b1('0x11f'),'foreignKey':_0x66b1('0x155'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x6a')][_0x66b1('0x114')](db[_0x66b1('0x192')],{'as':_0x66b1('0x194'),'foreignKey':_0x66b1('0x193')});db[_0x66b1('0x6a')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f'),'onDelete':'cascade'});db[_0x66b1('0x6a')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x166'),'through':_0x66b1('0x11b')});db['CmContact'][_0x66b1('0x117')](db[_0x66b1('0x83')],{'as':'Tags','through':_0x66b1('0x195')});db[_0x66b1('0x6a')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db['CmHopper'][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':'Contact','foreignKey':_0x66b1('0x155'),'onDelete':'cascade'});db[_0x66b1('0x6b')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x6b')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0x66b1('0x114')](db[_0x66b1('0x1c')],{'as':_0x66b1('0x188'),'foreignKey':_0x66b1('0x142'),'onDelete':'cascade'});db['CmHopper'][_0x66b1('0x114')](db[_0x66b1('0xdc')],{'as':_0x66b1('0xdc'),'foreignKey':_0x66b1('0x196'),'onDelete':_0x66b1('0x104')});db['CmHopper'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':'Owner','foreignKey':_0x66b1('0x197')});db[_0x66b1('0x198')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':'Contact','foreignKey':_0x66b1('0x155'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x198')][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f'),'onDelete':_0x66b1('0x104')});db['CmHopperBlack'][_0x66b1('0x114')](db[_0x66b1('0x1c')],{'as':_0x66b1('0x188'),'foreignKey':_0x66b1('0x142'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0x198')][_0x66b1('0x114')](db[_0x66b1('0xdc')],{'as':_0x66b1('0xdc'),'foreignKey':_0x66b1('0x196'),'onDelete':_0x66b1('0x104')});db['Automation'][_0x66b1('0x107')](db[_0x66b1('0x7a')],{'as':{'plural':_0x66b1('0x199'),'singular':_0x66b1('0x19a')},'foreignKey':_0x66b1('0x19b'),'onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x75')][_0x66b1('0x107')](db['Condition'],{'as':{'plural':_0x66b1('0x19c'),'singular':_0x66b1('0x19d')},'foreignKey':_0x66b1('0x19e'),'onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x75')][_0x66b1('0x107')](db[_0x66b1('0x19f')],{'as':_0x66b1('0x1a0'),'foreignKey':'AutomationId','onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x78')]['hasMany'](db[_0x66b1('0x78')],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x1a1'),'onDelete':'cascade'});db[_0x66b1('0x7c')][_0x66b1('0x107')](db['Interval'],{'as':_0x66b1('0x1a2'),'foreignKey':_0x66b1('0x148'),'onDelete':_0x66b1('0x104'),'hooks':!![],'required':![]});db['Interval'][_0x66b1('0x107')](db[_0x66b1('0x18')],{'as':_0x66b1('0x10a'),'foreignKey':_0x66b1('0x148'),'onDelete':_0x66b1('0x158')});db[_0x66b1('0x7c')][_0x66b1('0x107')](db['MailApplication'],{'as':_0x66b1('0x1a3'),'foreignKey':_0x66b1('0x148')});db[_0x66b1('0x7c')][_0x66b1('0x107')](db[_0x66b1('0x5d')],{'as':_0x66b1('0x1a4'),'foreignKey':'IntervalId'});db[_0x66b1('0x7c')][_0x66b1('0x107')](db[_0x66b1('0x43')],{'as':_0x66b1('0x1a5'),'foreignKey':_0x66b1('0x148')});db[_0x66b1('0x7c')][_0x66b1('0x107')](db[_0x66b1('0x4d')],{'as':_0x66b1('0x1a6'),'foreignKey':'IntervalId'});db[_0x66b1('0x80')][_0x66b1('0x114')](db[_0x66b1('0x38')],{});db[_0x66b1('0x80')][_0x66b1('0x114')](db[_0x66b1('0x8f')],{'foreignKey':_0x66b1('0x1a7')});db['Schedule'][_0x66b1('0x114')](db[_0x66b1('0x1a8')],{'foreignKey':_0x66b1('0x1a9')});db[_0x66b1('0x13e')][_0x66b1('0x117')](db[_0x66b1('0x1a')],{'as':'Mohs','through':_0x66b1('0x1aa'),'onDelete':'restrict'});db['Tag'][_0x66b1('0x117')](db[_0x66b1('0x6a')],{'through':'cm_contact_has_tags'});db[_0x66b1('0x83')][_0x66b1('0x117')](db[_0x66b1('0x120')],{'through':_0x66b1('0x18b')});db[_0x66b1('0x83')][_0x66b1('0x117')](db['MailInteraction'],{'through':_0x66b1('0x1ab')});db[_0x66b1('0x83')][_0x66b1('0x117')](db[_0x66b1('0x4f')],{'through':_0x66b1('0x17c')});db[_0x66b1('0x83')]['belongsToMany'](db[_0x66b1('0x45')],{'through':'fax_interaction_has_tags'});db[_0x66b1('0x83')][_0x66b1('0x117')](db[_0x66b1('0x57')],{'through':'openchannel_interaction_has_tags'});db[_0x66b1('0x83')][_0x66b1('0x117')](db[_0x66b1('0x111')],{'through':_0x66b1('0x1ac')});db[_0x66b1('0x87')][_0x66b1('0x107')](db[_0x66b1('0x7a')],{'as':{'plural':_0x66b1('0x1ad'),'singular':_0x66b1('0x1ae')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0x66b1('0x107')](db['Condition'],{'as':{'plural':_0x66b1('0x1af'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x87')][_0x66b1('0x107')](db['Action'],{'as':_0x66b1('0x1a0'),'foreignKey':_0x66b1('0x1b0'),'onDelete':_0x66b1('0x104'),'hooks':!![]});db[_0x66b1('0x1a8')][_0x66b1('0x107')](db[_0x66b1('0x1b1')],{'as':_0x66b1('0x1b2'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x66b1('0x8f')][_0x66b1('0x107')](db[_0x66b1('0x1b1')],{'as':_0x66b1('0x1b2'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1a7')});db[_0x66b1('0x92')][_0x66b1('0x107')](db[_0x66b1('0x1b1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x66b1('0x1b3')});db[_0x66b1('0x1b1')][_0x66b1('0x114')](db[_0x66b1('0x92')],{'foreignKey':_0x66b1('0x1b3')});db[_0x66b1('0x97')][_0x66b1('0x107')](db[_0x66b1('0x98')],{'as':_0x66b1('0x1b4'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db['SalesforceConfiguration'][_0x66b1('0x107')](db[_0x66b1('0x9a')],{'as':_0x66b1('0x1b6'),'onDelete':'cascade','foreignKey':_0x66b1('0x1b7')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x66b1('0x1b8'),'onDelete':'cascade','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0x98')][_0x66b1('0x107')](db['SalesforceField'],{'as':'Fields','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0x98')][_0x66b1('0x114')](db['SalesforceAccount'],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0x9a')][_0x66b1('0x107')](db[_0x66b1('0x9a')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db['SalesforceField'][_0x66b1('0x107')](db[_0x66b1('0x9a')],{'as':_0x66b1('0x1bc'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0x9a')][_0x66b1('0x107')](db[_0x66b1('0x9a')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db['SalesforceField'][_0x66b1('0x114')](db[_0x66b1('0x89')],{'as':'Variable','foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x9b')][_0x66b1('0x107')](db[_0x66b1('0x9c')],{'as':_0x66b1('0x1b4'),'onDelete':'cascade','foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0x9c')]['hasMany'](db[_0x66b1('0x9d')],{'as':'Subjects','onDelete':_0x66b1('0x104'),'foreignKey':'SubjectId'});db[_0x66b1('0x9c')][_0x66b1('0x107')](db['SugarcrmField'],{'as':_0x66b1('0x1b8'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b9')});db['SugarcrmConfiguration'][_0x66b1('0x107')](db[_0x66b1('0x9d')],{'as':_0x66b1('0x1b2'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0x9c')][_0x66b1('0x114')](db['SugarcrmAccount'],{'as':_0x66b1('0x163'),'foreignKey':'AccountId'});db[_0x66b1('0x9d')][_0x66b1('0x107')](db[_0x66b1('0x9d')],{'as':'Subject','foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0x9d')][_0x66b1('0x107')](db[_0x66b1('0x9d')],{'as':_0x66b1('0x1bc'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x66b1('0x107')](db[_0x66b1('0x9d')],{'as':'Field','foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0x9d')]['belongsTo'](db[_0x66b1('0x89')],{'as':_0x66b1('0x89'),'foreignKey':'VariableId'});db['DeskAccount'][_0x66b1('0x107')](db[_0x66b1('0x1bf')],{'as':'Configurations','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db['DeskConfiguration'][_0x66b1('0x107')](db[_0x66b1('0x1c0')],{'as':_0x66b1('0x1b6'),'onDelete':_0x66b1('0x104'),'foreignKey':'SubjectId'});db[_0x66b1('0x1bf')][_0x66b1('0x107')](db[_0x66b1('0x1c0')],{'as':_0x66b1('0x1b8'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0x1bf')][_0x66b1('0x107')](db[_0x66b1('0x1c0')],{'as':'Fields','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ba')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0x66b1('0x163'),'foreignKey':'AccountId'});db[_0x66b1('0x1bf')]['belongsToMany'](db['Tag'],{'through':_0x66b1('0x1c1')});db[_0x66b1('0x1c0')]['hasMany'](db[_0x66b1('0x1c0')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0x1c0')][_0x66b1('0x107')](db[_0x66b1('0x1c0')],{'as':'Description','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0x1c0')][_0x66b1('0x107')](db[_0x66b1('0x1c0')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0x1c0')][_0x66b1('0x114')](db['Variable'],{'as':_0x66b1('0x89'),'foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x1c2')][_0x66b1('0x107')](db['ZohoConfiguration'],{'as':_0x66b1('0x1b4'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xa3')]['hasMany'](db[_0x66b1('0xa5')],{'as':_0x66b1('0x1b6'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xa3')]['hasMany'](db[_0x66b1('0xa5')],{'as':_0x66b1('0x1b8'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xa3')][_0x66b1('0x107')](db[_0x66b1('0xa5')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x66b1('0xa3')][_0x66b1('0x114')](db['ZohoAccount'],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db['ZohoField'][_0x66b1('0x107')](db[_0x66b1('0xa5')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xa5')][_0x66b1('0x107')](db[_0x66b1('0xa5')],{'as':_0x66b1('0x1bc'),'foreignKey':_0x66b1('0x1b9')});db['ZohoField'][_0x66b1('0x107')](db[_0x66b1('0xa5')],{'as':'Field','foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xa5')][_0x66b1('0x114')](db[_0x66b1('0x89')],{'as':_0x66b1('0x89'),'foreignKey':_0x66b1('0x1be')});db['ZendeskAccount'][_0x66b1('0x107')](db[_0x66b1('0xa8')],{'as':'Configurations','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xa8')][_0x66b1('0x107')](db[_0x66b1('0xaa')],{'as':_0x66b1('0x1b6'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xa8')][_0x66b1('0x107')](db[_0x66b1('0xaa')],{'as':'Descriptions','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xa8')]['hasMany'](db[_0x66b1('0xaa')],{'as':_0x66b1('0x1b2'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xa8')]['belongsTo'](db[_0x66b1('0xa6')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db['ZendeskConfiguration'][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':_0x66b1('0x1c3')});db[_0x66b1('0xaa')]['hasMany'](db[_0x66b1('0xaa')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xaa')][_0x66b1('0x107')](db[_0x66b1('0xaa')],{'as':_0x66b1('0x1bc'),'foreignKey':_0x66b1('0x1b9')});db['ZendeskField'][_0x66b1('0x107')](db[_0x66b1('0xaa')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db['ZendeskField'][_0x66b1('0x114')](db[_0x66b1('0x89')],{'as':'Variable','foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x1c4')][_0x66b1('0x107')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x66b1('0x1b6'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xac')][_0x66b1('0x107')](db[_0x66b1('0xad')],{'as':_0x66b1('0x1b8'),'onDelete':'cascade','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xac')][_0x66b1('0x107')](db[_0x66b1('0xad')],{'as':'Fields','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xac')][_0x66b1('0x114')](db['FreshdeskAccount'],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xac')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x66b1('0xad')]['hasMany'](db['FreshdeskField'],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db['FreshdeskField'][_0x66b1('0x107')](db['FreshdeskField'],{'as':_0x66b1('0x1bc'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xad')]['hasMany'](db[_0x66b1('0xad')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xad')][_0x66b1('0x114')](db[_0x66b1('0x89')],{'as':_0x66b1('0x89'),'foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x1c5')][_0x66b1('0x107')](db[_0x66b1('0xb0')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x66b1('0xb0')]['hasMany'](db[_0x66b1('0xb2')],{'as':_0x66b1('0x1b6'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xb0')][_0x66b1('0x107')](db[_0x66b1('0xb2')],{'as':_0x66b1('0x1b8'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x66b1('0x107')](db['VtigerField'],{'as':_0x66b1('0x1b2'),'foreignKey':_0x66b1('0x1ba')});db['VtigerConfiguration'][_0x66b1('0x114')](db[_0x66b1('0x1c5')],{'as':'Account','foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xb2')][_0x66b1('0x107')](db['VtigerField'],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db['VtigerField'][_0x66b1('0x107')](db[_0x66b1('0xb2')],{'as':'Description','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xb2')][_0x66b1('0x107')](db[_0x66b1('0xb2')],{'as':_0x66b1('0x1bd'),'foreignKey':'FieldId'});db[_0x66b1('0xb2')]['belongsTo'](db['Variable'],{'as':_0x66b1('0x89'),'foreignKey':'VariableId'});db[_0x66b1('0x1c6')][_0x66b1('0x107')](db[_0x66b1('0xb4')],{'as':_0x66b1('0x1b4'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xb4')]['hasMany'](db[_0x66b1('0xb6')],{'as':_0x66b1('0x1b6'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xb4')][_0x66b1('0x107')](db['ServicenowField'],{'as':_0x66b1('0x1b8'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xb4')][_0x66b1('0x107')](db[_0x66b1('0xb6')],{'as':_0x66b1('0x1b2'),'foreignKey':_0x66b1('0x1ba')});db['ServicenowConfiguration'][_0x66b1('0x114')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x66b1('0x1b5')});db['ServicenowField']['hasMany'](db[_0x66b1('0xb6')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xb6')][_0x66b1('0x107')](db[_0x66b1('0xb6')],{'as':'Description','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xb6')][_0x66b1('0x107')](db[_0x66b1('0xb6')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xb6')][_0x66b1('0x114')](db[_0x66b1('0x89')],{'as':'Variable','foreignKey':_0x66b1('0x1be')});db[_0x66b1('0xb8')][_0x66b1('0x107')](db['Dynamics365Configuration'],{'as':_0x66b1('0x1b4'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xba')][_0x66b1('0x107')](db[_0x66b1('0xbb')],{'as':_0x66b1('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x66b1('0xba')]['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x66b1('0x1b9')});db['Dynamics365Configuration'][_0x66b1('0x107')](db[_0x66b1('0xbb')],{'as':'Fields','onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ba')});db[_0x66b1('0xba')][_0x66b1('0x114')](db[_0x66b1('0xb8')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xbb')][_0x66b1('0x107')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xbb')][_0x66b1('0x107')](db[_0x66b1('0xbb')],{'as':'Field','foreignKey':_0x66b1('0x1ba')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x66b1('0x89'),'foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x1c7')]['hasMany'](db[_0x66b1('0xbe')],{'as':_0x66b1('0x1b4'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xbe')][_0x66b1('0x107')](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1b6'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xbe')][_0x66b1('0x107')](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1b8'),'foreignKey':'DescriptionId'});db[_0x66b1('0xbe')][_0x66b1('0x107')](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1b2'),'foreignKey':_0x66b1('0x1ba')});db['FreshsalesConfiguration'][_0x66b1('0x114')](db[_0x66b1('0x1c7')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1b5')});db[_0x66b1('0xc0')]['hasMany'](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1bb'),'foreignKey':_0x66b1('0x1b7')});db[_0x66b1('0xc0')]['hasMany'](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1bc'),'foreignKey':_0x66b1('0x1b9')});db[_0x66b1('0xc0')]['hasMany'](db[_0x66b1('0xc0')],{'as':_0x66b1('0x1bd'),'foreignKey':_0x66b1('0x1ba')});db['FreshsalesField']['belongsTo'](db[_0x66b1('0x89')],{'as':_0x66b1('0x89'),'foreignKey':_0x66b1('0x1be')});db[_0x66b1('0x1c8')]['belongsTo'](db[_0x66b1('0x5b')],{});db['ChatQueueReport'][_0x66b1('0x114')](db[_0x66b1('0xea')],{'as':'List','foreignKey':_0x66b1('0x15f')});db['ChatQueueReport'][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':'ContactId'});db[_0x66b1('0x1c8')]['belongsTo'](db[_0x66b1('0x120')],{});db[_0x66b1('0x1c8')][_0x66b1('0x114')](db[_0x66b1('0x5f')],{});db[_0x66b1('0x1c8')][_0x66b1('0x114')](db[_0x66b1('0x12')],{});db[_0x66b1('0x1c8')][_0x66b1('0x114')](db[_0x66b1('0x63')],{});db[_0x66b1('0xc3')][_0x66b1('0x114')](db['User'],{'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1c9')});db[_0x66b1('0xc3')][_0x66b1('0x114')](db['User'],{'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x1ca')});db[_0x66b1('0xc8')][_0x66b1('0x107')](db[_0x66b1('0xc6')],{'foreignKey':_0x66b1('0x1cb'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0xc8')][_0x66b1('0x107')](db[_0x66b1('0xc5')],{'foreignKey':_0x66b1('0x1cb'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0xca')]['belongsTo'](db[_0x66b1('0x136')],{});db[_0x66b1('0xca')][_0x66b1('0x114')](db['CmList'],{'as':_0x66b1('0x16c'),'foreignKey':'ListId'});db[_0x66b1('0xca')][_0x66b1('0x114')](db['CmContact'],{'as':_0x66b1('0x154'),'foreignKey':'ContactId'});db[_0x66b1('0xca')]['belongsTo'](db['SmsInteraction'],{});db[_0x66b1('0xca')][_0x66b1('0x114')](db[_0x66b1('0x51')],{});db[_0x66b1('0xca')][_0x66b1('0x114')](db[_0x66b1('0x12')],{});db[_0x66b1('0xca')][_0x66b1('0x114')](db['SmsQueue'],{});db[_0x66b1('0xce')]['hasMany'](db[_0x66b1('0xc8')],{'foreignKey':_0x66b1('0x1cc')});db[_0x66b1('0xce')][_0x66b1('0x107')](db[_0x66b1('0xc6')],{'foreignKey':_0x66b1('0x1cc')});db[_0x66b1('0xce')]['hasMany'](db[_0x66b1('0xc5')],{'foreignKey':_0x66b1('0x1cc')});db[_0x66b1('0xd3')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x166'),'through':_0x66b1('0x1cd')});db['Team'][_0x66b1('0x117')](db['User'],{'as':_0x66b1('0x161'),'through':_0x66b1('0x11e')});db[_0x66b1('0xd8')][_0x66b1('0x117')](db[_0x66b1('0x1c')],{'through':_0x66b1('0xfe'),'as':'VoiceQueues'});db[_0x66b1('0xd8')][_0x66b1('0x117')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x66b1('0x127')});db[_0x66b1('0xd8')][_0x66b1('0x117')](db[_0x66b1('0x63')],{'through':_0x66b1('0x190'),'as':'ChatQueues'});db[_0x66b1('0xd8')][_0x66b1('0x117')](db['FaxQueue'],{'through':_0x66b1('0x179'),'as':_0x66b1('0x12b')});db[_0x66b1('0xd8')][_0x66b1('0x117')](db[_0x66b1('0x12c')],{'through':_0x66b1('0x17e'),'as':_0x66b1('0x1ce')});db[_0x66b1('0xd8')][_0x66b1('0x117')](db[_0x66b1('0x59')],{'through':_0x66b1('0x184'),'as':_0x66b1('0x12e')});db['Team']['belongsToMany'](db[_0x66b1('0xfb')],{'through':_0x66b1('0x1cf'),'as':_0x66b1('0x12f')});db['Team'][_0x66b1('0x117')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x66b1('0x1d0')});db[_0x66b1('0xdc')][_0x66b1('0x107')](db[_0x66b1('0x6b')],{'as':_0x66b1('0x141'),'foreignKey':'CampaignId'});db[_0x66b1('0xdc')][_0x66b1('0x107')](db[_0x66b1('0x10b')],{'as':_0x66b1('0x10c'),'foreignKey':_0x66b1('0x196')});db['Campaign']['hasMany'](db['CmHopperHistory'],{'as':_0x66b1('0x143'),'foreignKey':'CampaignId'});db[_0x66b1('0xdc')][_0x66b1('0x107')](db[_0x66b1('0x198')],{'as':_0x66b1('0x1d1'),'foreignKey':_0x66b1('0x196')});db[_0x66b1('0xdc')][_0x66b1('0x114')](db[_0x66b1('0x145')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x66b1('0xdc')][_0x66b1('0x114')](db[_0x66b1('0x145')],{'as':'TrunkBackup','foreignKey':_0x66b1('0x1d2')});db['Campaign'][_0x66b1('0x114')](db[_0x66b1('0x7c')],{'as':_0x66b1('0x7c'),'foreignKey':'IntervalId'});db[_0x66b1('0xdc')][_0x66b1('0x114')](db[_0x66b1('0xd3')],{'as':_0x66b1('0xd3'),'foreignKey':_0x66b1('0x1d3')});db['Campaign'][_0x66b1('0x117')](db[_0x66b1('0xea')],{'as':_0x66b1('0x11c'),'through':'campaigns_has_cm_lists'});db[_0x66b1('0xdc')][_0x66b1('0x117')](db[_0x66b1('0xea')],{'as':_0x66b1('0x14d'),'through':_0x66b1('0x1d4')});db[_0x66b1('0x168')][_0x66b1('0x114')](db[_0x66b1('0x61')],{'as':_0x66b1('0x61'),'foreignKey':_0x66b1('0x18f')});db[_0x66b1('0xe1')][_0x66b1('0x114')](db[_0x66b1('0x3d')],{});db[_0x66b1('0xe1')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0x66b1('0x38')],{'foreignKey':_0x66b1('0x1d5'),'as':_0x66b1('0x1d6')});db['MailTransferReport'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d7'),'as':_0x66b1('0x1d8')});db[_0x66b1('0xe1')]['belongsTo'](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d9'),'as':'ToAgent'});db[_0x66b1('0xe1')][_0x66b1('0x114')](db[_0x66b1('0x39')],{'foreignKey':_0x66b1('0x1da'),'as':_0x66b1('0x1db')});db[_0x66b1('0xe1')][_0x66b1('0x114')](db['MailAccount'],{'foreignKey':_0x66b1('0x1dc'),'as':_0x66b1('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0x66b1('0x5f')],{});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x120')],{});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'foreignKey':'FromChatWebsiteId','as':_0x66b1('0x1d6')});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d7'),'as':'FromAgent'});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d9'),'as':_0x66b1('0x1de')});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x63')],{'foreignKey':_0x66b1('0x1df'),'as':_0x66b1('0x1db')});db[_0x66b1('0xe2')][_0x66b1('0x114')](db[_0x66b1('0x5b')],{'foreignKey':_0x66b1('0x1e0'),'as':_0x66b1('0x1dd')});db[_0x66b1('0xe4')][_0x66b1('0x114')](db[_0x66b1('0x46')],{});db[_0x66b1('0xe4')]['belongsTo'](db[_0x66b1('0x45')],{});db['FaxTransferReport'][_0x66b1('0x114')](db[_0x66b1('0x42')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d7'),'as':_0x66b1('0x1d8')});db[_0x66b1('0xe4')]['belongsTo'](db['User'],{'foreignKey':_0x66b1('0x1d9'),'as':_0x66b1('0x1de')});db[_0x66b1('0xe4')][_0x66b1('0x114')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x66b1('0x1db')});db[_0x66b1('0xe4')]['belongsTo'](db[_0x66b1('0x42')],{'foreignKey':_0x66b1('0x1e1'),'as':_0x66b1('0x1dd')});db['OpenchannelTransferReport'][_0x66b1('0x114')](db['OpenchannelMessage'],{});db[_0x66b1('0xe6')][_0x66b1('0x114')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x66b1('0x114')](db[_0x66b1('0x54')],{'foreignKey':_0x66b1('0x1e2'),'as':_0x66b1('0x1d6')});db[_0x66b1('0xe6')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d7'),'as':_0x66b1('0x1d8')});db[_0x66b1('0xe6')][_0x66b1('0x114')](db[_0x66b1('0x12')],{'foreignKey':_0x66b1('0x1d9'),'as':_0x66b1('0x1de')});db[_0x66b1('0xe6')][_0x66b1('0x114')](db[_0x66b1('0x59')],{'foreignKey':_0x66b1('0x1e3'),'as':_0x66b1('0x1db')});db[_0x66b1('0xe6')][_0x66b1('0x114')](db[_0x66b1('0x54')],{'foreignKey':_0x66b1('0x1e4'),'as':'ToAccount'});db[_0x66b1('0xe8')]['belongsTo'](db['SmsMessage'],{});db[_0x66b1('0xe8')][_0x66b1('0x114')](db[_0x66b1('0x4f')],{});db[_0x66b1('0xe8')][_0x66b1('0x114')](db[_0x66b1('0x136')],{'foreignKey':_0x66b1('0x1e5'),'as':_0x66b1('0x1d6')});db[_0x66b1('0xe8')][_0x66b1('0x114')](db['User'],{'foreignKey':_0x66b1('0x1d7'),'as':_0x66b1('0x1d8')});db[_0x66b1('0xe8')][_0x66b1('0x114')](db['User'],{'foreignKey':_0x66b1('0x1d9'),'as':_0x66b1('0x1de')});db[_0x66b1('0xe8')]['belongsTo'](db[_0x66b1('0x12c')],{'foreignKey':_0x66b1('0x1e6'),'as':_0x66b1('0x1db')});db['SmsTransferReport']['belongsTo'](db[_0x66b1('0x136')],{'foreignKey':_0x66b1('0x1e7'),'as':_0x66b1('0x1dd')});db[_0x66b1('0xea')][_0x66b1('0x107')](db['Disposition'],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x15f'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0xea')][_0x66b1('0x107')](db[_0x66b1('0x73')],{'as':_0x66b1('0x1e8'),'foreignKey':'ListId'});db[_0x66b1('0xea')][_0x66b1('0x107')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x11a'),'onDelete':_0x66b1('0x104'),'foreignKey':_0x66b1('0x15f')});db['CmList'][_0x66b1('0x107')](db[_0x66b1('0x10b')],{'as':_0x66b1('0x10c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0xea')]['hasMany'](db[_0x66b1('0x6f')],{'as':_0x66b1('0x10d'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0xea')][_0x66b1('0x107')](db[_0x66b1('0x71')],{'as':_0x66b1('0x71'),'foreignKey':'ListId'});db[_0x66b1('0xea')][_0x66b1('0x117')](db['VoiceQueue'],{'as':_0x66b1('0x1e9'),'through':_0x66b1('0x14b')});db['CmList'][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x11d')});db['VoicePrefix'][_0x66b1('0x107')](db[_0x66b1('0x18')],{'as':_0x66b1('0x10a'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0xec')]['belongsToMany'](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':_0x66b1('0x126')});db[_0x66b1('0xec')][_0x66b1('0x117')](db['Team'],{'through':_0x66b1('0x1ea'),'as':_0x66b1('0x14c')});db[_0x66b1('0x115')][_0x66b1('0x107')](db[_0x66b1('0x12')],{'as':_0x66b1('0x166'),'foreignKey':_0x66b1('0x116')});db[_0x66b1('0x115')][_0x66b1('0x107')](db[_0x66b1('0xee')],{'as':_0x66b1('0x1eb'),'foreignKey':_0x66b1('0x116'),'onDelete':_0x66b1('0x104')});db[_0x66b1('0xee')][_0x66b1('0x107')](db[_0x66b1('0xf0')],{'as':_0x66b1('0x1ec'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x66b1('0x139')][_0x66b1('0x107')](db[_0x66b1('0x78')],{'as':_0x66b1('0x15a'),'foreignKey':_0x66b1('0x1ed'),'onDelete':'cascade'});db[_0x66b1('0x139')][_0x66b1('0x107')](db[_0x66b1('0x15b')],{'as':'Answers','foreignKey':_0x66b1('0x1ed')});db['WhatsappAccount'][_0x66b1('0x107')](db[_0x66b1('0xf8')],{'as':'Messages','foreignKey':_0x66b1('0x1ed')});db[_0x66b1('0x139')]['hasMany'](db[_0x66b1('0x111')],{'as':_0x66b1('0x15d')});db[_0x66b1('0x139')][_0x66b1('0x107')](db[_0x66b1('0xf5')],{'as':_0x66b1('0x13d')});db[_0x66b1('0x139')]['belongsTo'](db[_0x66b1('0xea')],{'as':_0x66b1('0x16c'),'foreignKey':'ListId'});db[_0x66b1('0x139')]['belongsTo'](db[_0x66b1('0x149')],{'as':_0x66b1('0x173'),'foreignKey':_0x66b1('0x14a')});db[_0x66b1('0x139')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x161'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'onDelete':'restrict'});db[_0x66b1('0xf5')][_0x66b1('0x114')](db[_0x66b1('0xfb')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x66b1('0x114')](db[_0x66b1('0x139')],{'onDelete':_0x66b1('0x158')});db[_0x66b1('0xf5')][_0x66b1('0x114')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x66b1('0xf5')][_0x66b1('0x114')](db[_0x66b1('0x83')],{'onDelete':_0x66b1('0x158'),'foreignKey':_0x66b1('0x175')});db[_0x66b1('0x111')][_0x66b1('0x107')](db[_0x66b1('0xf8')],{'as':_0x66b1('0x15c'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x66b1('0x111')]['belongsTo'](db[_0x66b1('0x139')],{'as':_0x66b1('0x163'),'foreignKey':_0x66b1('0x1ed')});db[_0x66b1('0x111')]['belongsTo'](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':_0x66b1('0x164'),'foreignKey':'UserId'});db[_0x66b1('0x111')][_0x66b1('0x117')](db['Tag'],{'through':_0x66b1('0x1ac'),'as':_0x66b1('0x178')});db[_0x66b1('0x111')][_0x66b1('0x117')](db[_0x66b1('0x83')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0x66b1('0x111')][_0x66b1('0x117')](db[_0x66b1('0x12')],{'as':_0x66b1('0x166'),'through':_0x66b1('0x124'),'foreignKey':_0x66b1('0x1ee')});db[_0x66b1('0xf8')][_0x66b1('0x114')](db['User'],{'as':_0x66b1('0x12')});db[_0x66b1('0xf8')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'onDelete':_0x66b1('0x104'),'as':'Contact'});db[_0x66b1('0xf8')][_0x66b1('0x114')](db[_0x66b1('0x111')],{'onDelete':'cascade','as':_0x66b1('0x16a'),'foreignKey':_0x66b1('0x1ee')});db[_0x66b1('0xf8')]['belongsTo'](db[_0x66b1('0x139')],{'as':'Account','foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db[_0x66b1('0x139')],{});db[_0x66b1('0xf9')][_0x66b1('0x114')](db['CmList'],{'as':_0x66b1('0x16c'),'foreignKey':_0x66b1('0x15f')});db[_0x66b1('0xf9')][_0x66b1('0x114')](db[_0x66b1('0x6a')],{'as':_0x66b1('0x154'),'foreignKey':_0x66b1('0x155')});db[_0x66b1('0xf9')][_0x66b1('0x114')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x66b1('0x114')](db[_0x66b1('0xfb')],{});db['WhatsappQueueReport'][_0x66b1('0x114')](db['WhatsappMessage'],{});db[_0x66b1('0xf9')]['belongsTo'](db['User'],{});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db[_0x66b1('0xf8')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x66b1('0x111')],{});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db[_0x66b1('0x139')],{'foreignKey':_0x66b1('0x1f0'),'as':'FromAccount'});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db[_0x66b1('0x139')],{'foreignKey':_0x66b1('0x1f1'),'as':_0x66b1('0x1dd')});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db[_0x66b1('0xfb')],{'foreignKey':'ToQueueId','as':_0x66b1('0x1db')});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db['User'],{'foreignKey':'FromUserId','as':_0x66b1('0x1d8')});db[_0x66b1('0x1ef')][_0x66b1('0x114')](db['User'],{'foreignKey':_0x66b1('0x1d9'),'as':_0x66b1('0x1de')});db[_0x66b1('0xfb')]['belongsToMany'](db['User'],{'as':_0x66b1('0x161'),'through':_0x66b1('0x33'),'foreignKey':_0x66b1('0x1f2')});db[_0x66b1('0xfb')][_0x66b1('0x117')](db['Team'],{'through':_0x66b1('0x1cf'),'as':_0x66b1('0x14c')});db['UserSetting'][_0x66b1('0x114')](db[_0x66b1('0x12')],{'as':'user','foreignKey':_0x66b1('0x105'),'onDelete':'cascade','hooks':!![]});db[_0x66b1('0xfd')]['hasOne'](db[_0x66b1('0x35')],{'as':'Imap','onDelete':'restrict'});db[_0x66b1('0xfd')]['hasOne'](db[_0x66b1('0x37')],{'as':_0x66b1('0x159'),'onDelete':_0x66b1('0x158')});module[_0x66b1('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b71518e..3ca16df 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/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/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/chat/reports/transfer','./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/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','root','join','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport'];(function(_0x19fbf7,_0x630038){var _0x27046c=function(_0x219610){while(--_0x219610){_0x19fbf7['push'](_0x19fbf7['shift']());}};_0x27046c(++_0x630038);}(_0x008c,0x188));var _0xc008=function(_0x54501d,_0x42e8a6){_0x54501d=_0x54501d-0x0;var _0x2b9b2c=_0x008c[_0x54501d];return _0x2b9b2c;};'use strict';var path=require(_0xc008('0x0'));var express=require(_0xc008('0x1'));var errors=require(_0xc008('0x2'));var config=require(_0xc008('0x3'));var setupLoggers=require(_0xc008('0x4'))['setupLoggers'];var clientSideLogs=require(_0xc008('0x5'));exports[_0xc008('0x6')]=function(_0x10b33c){return setupLoggers(_0x10b33c)[_0xc008('0x7')](function(){_0x10b33c[_0xc008('0x8')](_0xc008('0x9'),require(_0xc008('0xa')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb'),require('./api/voiceChanSpy'));_0x10b33c[_0xc008('0x8')]('/api/voice/contexts',require(_0xc008('0xc')));_0x10b33c['use']('/api/voice/extensions',require(_0xc008('0xd')));_0x10b33c[_0xc008('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x10b33c['use'](_0xc008('0xe'),require(_0xc008('0xf')));_0x10b33c['use'](_0xc008('0x10'),require(_0xc008('0x11')));_0x10b33c[_0xc008('0x8')](_0xc008('0x12'),require(_0xc008('0x13')));_0x10b33c[_0xc008('0x8')](_0xc008('0x14'),require('./api/voiceMail'));_0x10b33c['use'](_0xc008('0x15'),require('./api/voiceMailMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x16'),require(_0xc008('0x17')));_0x10b33c[_0xc008('0x8')](_0xc008('0x18'),require('./api/voiceDialReport'));_0x10b33c['use']('/api/voice/agents/reports',require(_0xc008('0x19')));_0x10b33c[_0xc008('0x8')](_0xc008('0x1a'),require(_0xc008('0x1b')));_0x10b33c['use']('/api/members/reports',require('./api/memberReport'));_0x10b33c['use'](_0xc008('0x1c'),require(_0xc008('0x1d')));_0x10b33c['use'](_0xc008('0x1e'),require('./api/voiceTransferReport'));_0x10b33c['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x10b33c[_0xc008('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x10b33c['use']('/api/mail/queues',require('./api/mailQueue'));_0x10b33c[_0xc008('0x8')](_0xc008('0x1f'),require(_0xc008('0x20')));_0x10b33c[_0xc008('0x8')](_0xc008('0x21'),require(_0xc008('0x22')));_0x10b33c['use'](_0xc008('0x23'),require('./api/mailMessage'));_0x10b33c['use'](_0xc008('0x24'),require(_0xc008('0x25')));_0x10b33c[_0xc008('0x8')](_0xc008('0x26'),require('./api/mailQueueReport'));_0x10b33c['use']('/api/dashboards',require(_0xc008('0x27')));_0x10b33c[_0xc008('0x8')](_0xc008('0x28'),require(_0xc008('0x29')));_0x10b33c['use']('/api/fax/accounts',require('./api/faxAccount'));_0x10b33c['use']('/api/fax/applications',require(_0xc008('0x2a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x2b'),require('./api/faxInteraction'));_0x10b33c[_0xc008('0x8')](_0xc008('0x2c'),require(_0xc008('0x2d')));_0x10b33c[_0xc008('0x8')]('/api/fax/queues',require(_0xc008('0x2e')));_0x10b33c[_0xc008('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x10b33c['use'](_0xc008('0x2f'),require(_0xc008('0x30')));_0x10b33c[_0xc008('0x8')](_0xc008('0x31'),require(_0xc008('0x32')));_0x10b33c[_0xc008('0x8')](_0xc008('0x33'),require(_0xc008('0x34')));_0x10b33c[_0xc008('0x8')](_0xc008('0x35'),require(_0xc008('0x36')));_0x10b33c[_0xc008('0x8')]('/api/sms/queues',require(_0xc008('0x37')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/accounts',require(_0xc008('0x38')));_0x10b33c[_0xc008('0x8')](_0xc008('0x39'),require(_0xc008('0x3a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3b'),require(_0xc008('0x3c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3d'),require('./api/openchannelMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x3e'),require(_0xc008('0x3f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x40'),require(_0xc008('0x41')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/reports/queue',require(_0xc008('0x42')));_0x10b33c[_0xc008('0x8')]('/api/chat/applications',require(_0xc008('0x43')));_0x10b33c[_0xc008('0x8')]('/api/chat/interactions',require(_0xc008('0x44')));_0x10b33c[_0xc008('0x8')](_0xc008('0x45'),require('./api/chatMessage'));_0x10b33c['use']('/api/chat/offline_messages',require(_0xc008('0x46')));_0x10b33c['use'](_0xc008('0x47'),require(_0xc008('0x48')));_0x10b33c[_0xc008('0x8')](_0xc008('0x49'),require(_0xc008('0x4a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4b'),require(_0xc008('0x4c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4d'),require(_0xc008('0x4e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4f'),require(_0xc008('0x50')));_0x10b33c['use'](_0xc008('0x51'),require(_0xc008('0x52')));_0x10b33c[_0xc008('0x8')](_0xc008('0x53'),require('./api/cmHopperBlack'));_0x10b33c[_0xc008('0x8')](_0xc008('0x54'),require(_0xc008('0x55')));_0x10b33c[_0xc008('0x8')](_0xc008('0x56'),require('./api/cmHopperHistory'));_0x10b33c[_0xc008('0x8')](_0xc008('0x57'),require(_0xc008('0x58')));_0x10b33c[_0xc008('0x8')](_0xc008('0x59'),require('./api/action'));_0x10b33c[_0xc008('0x8')](_0xc008('0x5a'),require(_0xc008('0x5b')));_0x10b33c[_0xc008('0x8')]('/api/canned_answers',require(_0xc008('0x5c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x5d'),require('./api/disposition'));_0x10b33c[_0xc008('0x8')]('/api/conditions',require(_0xc008('0x5e')));_0x10b33c['use'](_0xc008('0x5f'),require(_0xc008('0x60')));_0x10b33c['use'](_0xc008('0x61'),require(_0xc008('0x62')));_0x10b33c[_0xc008('0x8')]('/api/cdr',require(_0xc008('0x63')));_0x10b33c[_0xc008('0x8')](_0xc008('0x64'),require(_0xc008('0x65')));_0x10b33c[_0xc008('0x8')](_0xc008('0x66'),require('./api/schedule'));_0x10b33c['use']('/api/sounds',require(_0xc008('0x67')));_0x10b33c[_0xc008('0x8')](_0xc008('0x68'),require(_0xc008('0x69')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6a'),require(_0xc008('0x6b')));_0x10b33c[_0xc008('0x8')]('/api/triggers',require('./api/trigger'));_0x10b33c['use'](_0xc008('0x6c'),require(_0xc008('0x6d')));_0x10b33c[_0xc008('0x8')]('/api/integrations',require(_0xc008('0x6e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6f'),require(_0xc008('0x70')));_0x10b33c[_0xc008('0x8')](_0xc008('0x71'),require(_0xc008('0x72')));_0x10b33c[_0xc008('0x8')](_0xc008('0x73'),require(_0xc008('0x74')));_0x10b33c['use']('/api/analytics/extracted_reports',require(_0xc008('0x75')));_0x10b33c['use'](_0xc008('0x76'),require(_0xc008('0x77')));_0x10b33c[_0xc008('0x8')]('/api/analytics/field_reports',require(_0xc008('0x78')));_0x10b33c[_0xc008('0x8')](_0xc008('0x79'),require(_0xc008('0x7a')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/accounts',require(_0xc008('0x7b')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/configurations',require(_0xc008('0x7c')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x7d'),require(_0xc008('0x7e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x7f'),require('./api/intSugarcrmConfiguration'));_0x10b33c['use'](_0xc008('0x80'),require('./api/intSugarcrmField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x81'),require(_0xc008('0x82')));_0x10b33c[_0xc008('0x8')](_0xc008('0x83'),require(_0xc008('0x84')));_0x10b33c['use'](_0xc008('0x85'),require(_0xc008('0x86')));_0x10b33c[_0xc008('0x8')](_0xc008('0x87'),require(_0xc008('0x88')));_0x10b33c['use'](_0xc008('0x89'),require('./api/intZohoConfiguration'));_0x10b33c['use']('/api/integrations/zoho/fields',require(_0xc008('0x8a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x8b'),require('./api/intZendeskAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0x8c'),require(_0xc008('0x8d')));_0x10b33c['use'](_0xc008('0x8e'),require(_0xc008('0x8f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x90'),require('./api/intFreshdeskAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshdesk/configurations',require(_0xc008('0x91')));_0x10b33c[_0xc008('0x8')](_0xc008('0x92'),require(_0xc008('0x93')));_0x10b33c[_0xc008('0x8')](_0xc008('0x94'),require('./api/intVtigerAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x10b33c[_0xc008('0x8')](_0xc008('0x95'),require('./api/intVtigerField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x96'),require(_0xc008('0x97')));_0x10b33c[_0xc008('0x8')](_0xc008('0x98'),require(_0xc008('0x99')));_0x10b33c[_0xc008('0x8')]('/api/integrations/servicenow/fields',require(_0xc008('0x9a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9b'),require(_0xc008('0x9c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9d'),require(_0xc008('0x9e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9f'),require(_0xc008('0xa0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa1'),require(_0xc008('0xa2')));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshsales/configurations',require(_0xc008('0xa3')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa4'),require('./api/intFreshsalesField'));_0x10b33c[_0xc008('0x8')](_0xc008('0xa5'),require('./api/network'));_0x10b33c['use'](_0xc008('0xa6'),require(_0xc008('0xa7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa8'),require(_0xc008('0xa9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xaa'),require(_0xc008('0xab')));_0x10b33c[_0xc008('0x8')](_0xc008('0xac'),require(_0xc008('0xad')));_0x10b33c['use'](_0xc008('0xae'),require(_0xc008('0xaf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb0'),require('./api/smsQueueReport'));_0x10b33c[_0xc008('0x8')]('/api/square/reports',require(_0xc008('0xb1')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb2'),require('./api/squareReportDetail'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb3'),require(_0xc008('0xb4')));_0x10b33c['use'](_0xc008('0xb5'),require('./api/setting'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb6'),require(_0xc008('0xb7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb8'),require('./api/squareProject'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb9'),require('./api/squareRecording'));_0x10b33c[_0xc008('0x8')]('/api/square/messages',require(_0xc008('0xba')));_0x10b33c['use'](_0xc008('0xbb'),require('./api/team'));_0x10b33c[_0xc008('0x8')](_0xc008('0xbc'),require(_0xc008('0xbd')));_0x10b33c[_0xc008('0x8')]('/api/campaigns',require(_0xc008('0xbe')));_0x10b33c[_0xc008('0x8')](_0xc008('0xbf'),require(_0xc008('0xc0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc1'),require(_0xc008('0xc2')));_0x10b33c[_0xc008('0x8')]('/api/plugins',require(_0xc008('0xc3')));_0x10b33c['use']('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xc4'),require(_0xc008('0xc5')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc6'),require(_0xc008('0xc7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc8'),require(_0xc008('0xc9')));_0x10b33c['use'](_0xc008('0xca'),require(_0xc008('0xcb')));_0x10b33c[_0xc008('0x8')](_0xc008('0xcc'),require(_0xc008('0xcd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xce'),require(_0xc008('0xcf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd0'),require(_0xc008('0xd1')));_0x10b33c[_0xc008('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd2'),require(_0xc008('0xd3')));_0x10b33c['use'](_0xc008('0xd4'),require(_0xc008('0xd5')));_0x10b33c['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd6'),require(_0xc008('0xd7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd8'),require(_0xc008('0xd9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xda'),require(_0xc008('0xdb')));_0x10b33c[_0xc008('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xdc'),require(_0xc008('0xdd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xde'),require(_0xc008('0xdf')));_0x10b33c['use']('/api/cloudProviders',require(_0xc008('0xe0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xe1'),require('./api/realtime'));_0x10b33c['use']('/api/user-settings',require('./api/user-setting'));_0x10b33c['use']('/api/auth/local',require(_0xc008('0xe2')));_0x10b33c['use'](_0xc008('0xe3'),require('./api/authGoogle'));_0x10b33c[_0xc008('0x8')](_0xc008('0xe4'),require(_0xc008('0xe5')));_0x10b33c['use']('/api/jira',require(_0xc008('0xe6')));_0x10b33c['use'](_0xc008('0xe7'),require(_0xc008('0xe8')));_0x10b33c['use'](_0xc008('0xe9'),require('./api/version'));_0x10b33c['use'](_0xc008('0xea'),require(_0xc008('0xeb')));_0x10b33c['use'](_0xc008('0xec'),require(_0xc008('0xed')));_0x10b33c[_0xc008('0x8')]('/api/webbar',require(_0xc008('0xee')));_0x10b33c[_0xc008('0x8')](_0xc008('0xef'),clientSideLogs);_0x10b33c[_0xc008('0x8')](_0xc008('0xf0'),express[_0xc008('0xf1')](path['join'](config[_0xc008('0xf2')],_0xc008('0xf0'))));_0x10b33c[_0xc008('0x8')]('/www',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],'/www')));_0x10b33c['use']('/demo',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf4'))));_0x10b33c[_0xc008('0x8')](_0xc008('0xf5'),express[_0xc008('0xf1')](path[_0xc008('0xf3')](config['root'],_0xc008('0xf6'),_0xc008('0xf7'))));_0x10b33c['use']('/plugins',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf8'))));_0x10b33c[_0xc008('0xf9')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc008('0xfa')](errors[0x194]);_0x10b33c[_0xc008('0xf9')]('/*')['get'](function(_0xb02bd,_0x1cc68f){_0x1cc68f[_0xc008('0xfb')](path[_0xc008('0xfc')](_0x10b33c['get'](_0xc008('0xfd'))+_0xc008('0xfe')));});return _0x10b33c;});}; \ No newline at end of file +var _0xeec6=['/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/templates','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','appPath','path','express','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./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/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog'];(function(_0x15f649,_0x3281fe){var _0x5a0484=function(_0x20b817){while(--_0x20b817){_0x15f649['push'](_0x15f649['shift']());}};_0x5a0484(++_0x3281fe);}(_0xeec6,0x1c2));var _0x6eec=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0xeec6[_0x43e2e4];return _0x1b71d0;};'use strict';var path=require(_0x6eec('0x0'));var express=require(_0x6eec('0x1'));var errors=require(_0x6eec('0x2'));var config=require(_0x6eec('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x6eec('0x4')];var clientSideLogs=require(_0x6eec('0x5'));exports[_0x6eec('0x6')]=function(_0x2d7a15){return setupLoggers(_0x2d7a15)[_0x6eec('0x7')](function(){_0x2d7a15[_0x6eec('0x8')]('/api/users',require(_0x6eec('0x9')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/chanspy',require(_0x6eec('0xa')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb'),require(_0x6eec('0xc')));_0x2d7a15['use'](_0x6eec('0xd'),require(_0x6eec('0xe')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x2d7a15['use'](_0x6eec('0xf'),require(_0x6eec('0x10')));_0x2d7a15['use']('/api/voice/recordings',require(_0x6eec('0x11')));_0x2d7a15['use'](_0x6eec('0x12'),require(_0x6eec('0x13')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x14'),require(_0x6eec('0x15')));_0x2d7a15['use'](_0x6eec('0x16'),require(_0x6eec('0x17')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x18'),require(_0x6eec('0x19')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1a'),require(_0x6eec('0x1b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1c'),require('./api/voiceAgentReport'));_0x2d7a15[_0x6eec('0x8')]('/api/voice/queues/reports',require(_0x6eec('0x1d')));_0x2d7a15[_0x6eec('0x8')]('/api/members/reports',require(_0x6eec('0x1e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x1f'),require('./api/trunk'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x20'),require(_0x6eec('0x21')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x22'),require(_0x6eec('0x23')));_0x2d7a15['use'](_0x6eec('0x24'),require(_0x6eec('0x25')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x26'),require(_0x6eec('0x27')));_0x2d7a15[_0x6eec('0x8')]('/api/mail/substatuses',require(_0x6eec('0x28')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x29'),require(_0x6eec('0x2a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2b'),require('./api/mailMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2c'),require(_0x6eec('0x2d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x2e'),require(_0x6eec('0x2f')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x30'),require(_0x6eec('0x31')));_0x2d7a15['use'](_0x6eec('0x32'),require(_0x6eec('0x33')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x34'),require('./api/faxAccount'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x35'),require('./api/faxApplication'));_0x2d7a15['use'](_0x6eec('0x36'),require('./api/faxInteraction'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x37'),require(_0x6eec('0x38')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x39'),require(_0x6eec('0x3a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x3b'),require(_0x6eec('0x3c')));_0x2d7a15[_0x6eec('0x8')]('/api/sms/accounts',require(_0x6eec('0x3d')));_0x2d7a15['use'](_0x6eec('0x3e'),require(_0x6eec('0x3f')));_0x2d7a15[_0x6eec('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x2d7a15['use'](_0x6eec('0x40'),require(_0x6eec('0x41')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x42'),require(_0x6eec('0x43')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x44'),require(_0x6eec('0x45')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x46'),require(_0x6eec('0x47')));_0x2d7a15[_0x6eec('0x8')]('/api/openchannel/interactions',require(_0x6eec('0x48')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x49'),require('./api/openchannelMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x4a'),require(_0x6eec('0x4b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x4c'),require(_0x6eec('0x4d')));_0x2d7a15['use'](_0x6eec('0x4e'),require(_0x6eec('0x4f')));_0x2d7a15[_0x6eec('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x50'),require(_0x6eec('0x51')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x52'),require('./api/chatMessage'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x53'),require(_0x6eec('0x54')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x55'),require(_0x6eec('0x56')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x57'),require('./api/chatGroup'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x58'),require('./api/chatProactiveAction'));_0x2d7a15['use'](_0x6eec('0x59'),require(_0x6eec('0x5a')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x5b'),require('./api/cmContact'));_0x2d7a15['use'](_0x6eec('0x5c'),require('./api/cmHopper'));_0x2d7a15['use'](_0x6eec('0x5d'),require(_0x6eec('0x5e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x5f'),require(_0x6eec('0x60')));_0x2d7a15['use'](_0x6eec('0x61'),require(_0x6eec('0x62')));_0x2d7a15['use'](_0x6eec('0x63'),require(_0x6eec('0x64')));_0x2d7a15['use'](_0x6eec('0x65'),require(_0x6eec('0x66')));_0x2d7a15['use'](_0x6eec('0x67'),require(_0x6eec('0x68')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x69'),require('./api/cannedAnswer'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6a'),require(_0x6eec('0x6b')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6c'),require('./api/condition'));_0x2d7a15['use'](_0x6eec('0x6d'),require(_0x6eec('0x6e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x6f'),require(_0x6eec('0x70')));_0x2d7a15['use'](_0x6eec('0x71'),require('./api/cdr'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x72'),require(_0x6eec('0x73')));_0x2d7a15['use'](_0x6eec('0x74'),require(_0x6eec('0x75')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x76'),require(_0x6eec('0x77')));_0x2d7a15['use'](_0x6eec('0x78'),require('./api/tag'));_0x2d7a15['use'](_0x6eec('0x79'),require('./api/template'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7a'),require(_0x6eec('0x7b')));_0x2d7a15['use']('/api/variables',require(_0x6eec('0x7c')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7d'),require(_0x6eec('0x7e')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x7f'),require(_0x6eec('0x80')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x81'),require(_0x6eec('0x82')));_0x2d7a15['use']('/api/analytics/default_reports',require(_0x6eec('0x83')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x84'),require('./api/analyticExtractedReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x85'),require(_0x6eec('0x86')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x87'),require(_0x6eec('0x88')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x89'),require('./api/analyticTreeReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x8a'),require(_0x6eec('0x8b')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x2d7a15['use'](_0x6eec('0x8c'),require(_0x6eec('0x8d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x8e'),require('./api/intSugarcrmAccount'));_0x2d7a15['use'](_0x6eec('0x8f'),require(_0x6eec('0x90')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/sugarcrm/fields',require(_0x6eec('0x91')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x92'),require(_0x6eec('0x93')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x94'),require(_0x6eec('0x95')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x96'),require('./api/intDeskField'));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/zoho/accounts',require(_0x6eec('0x97')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x98'),require(_0x6eec('0x99')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x9a'),require(_0x6eec('0x9b')));_0x2d7a15['use'](_0x6eec('0x9c'),require('./api/intZendeskAccount'));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/zendesk/configurations',require(_0x6eec('0x9d')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x9e'),require(_0x6eec('0x9f')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa0'),require(_0x6eec('0xa1')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa2'),require(_0x6eec('0xa3')));_0x2d7a15['use']('/api/integrations/freshdesk/fields',require(_0x6eec('0xa4')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xa5'),require(_0x6eec('0xa6')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/vtiger/configurations',require(_0x6eec('0xa7')));_0x2d7a15[_0x6eec('0x8')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x2d7a15['use'](_0x6eec('0xa8'),require(_0x6eec('0xa9')));_0x2d7a15['use'](_0x6eec('0xaa'),require(_0x6eec('0xab')));_0x2d7a15['use'](_0x6eec('0xac'),require(_0x6eec('0xad')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xae'),require('./api/intDynamics365Account'));_0x2d7a15['use'](_0x6eec('0xaf'),require(_0x6eec('0xb0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb1'),require(_0x6eec('0xb2')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb3'),require(_0x6eec('0xb4')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb5'),require(_0x6eec('0xb6')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb7'),require(_0x6eec('0xb8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xb9'),require(_0x6eec('0xba')));_0x2d7a15['use'](_0x6eec('0xbb'),require(_0x6eec('0xbc')));_0x2d7a15['use'](_0x6eec('0xbd'),require(_0x6eec('0xbe')));_0x2d7a15['use'](_0x6eec('0xbf'),require(_0x6eec('0xc0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc1'),require('./api/jscriptyQuestionReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc2'),require(_0x6eec('0xc3')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc4'),require(_0x6eec('0xc5')));_0x2d7a15['use'](_0x6eec('0xc6'),require('./api/squareReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc7'),require(_0x6eec('0xc8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xc9'),require(_0x6eec('0xca')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xcb'),require(_0x6eec('0xcc')));_0x2d7a15['use'](_0x6eec('0xcd'),require(_0x6eec('0xce')));_0x2d7a15[_0x6eec('0x8')]('/api/square/projects',require(_0x6eec('0xcf')));_0x2d7a15[_0x6eec('0x8')]('/api/square/recordings',require(_0x6eec('0xd0')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd1'),require(_0x6eec('0xd2')));_0x2d7a15[_0x6eec('0x8')]('/api/teams',require(_0x6eec('0xd3')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd4'),require(_0x6eec('0xd5')));_0x2d7a15[_0x6eec('0x8')]('/api/campaigns',require(_0x6eec('0xd6')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd7'),require(_0x6eec('0xd8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xd9'),require(_0x6eec('0xda')));_0x2d7a15[_0x6eec('0x8')]('/api/plugins',require(_0x6eec('0xdb')));_0x2d7a15['use'](_0x6eec('0xdc'),require(_0x6eec('0xdd')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xde'),require('./api/chatTransferReport'));_0x2d7a15[_0x6eec('0x8')]('/api/fax/reports/transfer',require(_0x6eec('0xdf')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe0'),require(_0x6eec('0xe1')));_0x2d7a15['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe2'),require(_0x6eec('0xe3')));_0x2d7a15[_0x6eec('0x8')]('/api/voice/prefixes',require(_0x6eec('0xe4')));_0x2d7a15['use'](_0x6eec('0xe5'),require(_0x6eec('0xe6')));_0x2d7a15['use'](_0x6eec('0xe7'),require(_0x6eec('0xe8')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xe9'),require(_0x6eec('0xea')));_0x2d7a15[_0x6eec('0x8')]('/api/userNotifications',require(_0x6eec('0xeb')));_0x2d7a15['use'](_0x6eec('0xec'),require(_0x6eec('0xed')));_0x2d7a15['use'](_0x6eec('0xee'),require('./api/whatsappApplication'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xef'),require(_0x6eec('0xf0')));_0x2d7a15[_0x6eec('0x8')]('/api/whatsapp/messages',require(_0x6eec('0xf1')));_0x2d7a15['use'](_0x6eec('0xf2'),require(_0x6eec('0xf3')));_0x2d7a15['use'](_0x6eec('0xf4'),require(_0x6eec('0xf5')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xf6'),require(_0x6eec('0xf7')));_0x2d7a15['use'](_0x6eec('0xf8'),require(_0x6eec('0xf9')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xfa'),require(_0x6eec('0xfb')));_0x2d7a15[_0x6eec('0x8')]('/api/user-settings',require('./api/user-setting'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0xfc'),require('./api/authLocal'));_0x2d7a15['use'](_0x6eec('0xfd'),require(_0x6eec('0xfe')));_0x2d7a15['use'](_0x6eec('0xff'),require(_0x6eec('0x100')));_0x2d7a15[_0x6eec('0x8')]('/api/jira',require(_0x6eec('0x101')));_0x2d7a15['use'](_0x6eec('0x102'),require(_0x6eec('0x103')));_0x2d7a15['use'](_0x6eec('0x104'),require(_0x6eec('0x105')));_0x2d7a15[_0x6eec('0x8')]('/api/system',require(_0x6eec('0x106')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x107'),require(_0x6eec('0x108')));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x109'),require('./api/webbar'));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10a'),clientSideLogs);_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10b'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x10b'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x10f'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config['root'],_0x6eec('0x10f'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x110'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x110'))));_0x2d7a15[_0x6eec('0x8')](_0x6eec('0x111'),express[_0x6eec('0x10c')](path[_0x6eec('0x10d')](config[_0x6eec('0x10e')],_0x6eec('0x112'),_0x6eec('0x113'))));_0x2d7a15[_0x6eec('0x8')]('/plugins',express[_0x6eec('0x10c')](path['join'](config[_0x6eec('0x10e')],_0x6eec('0x114'))));_0x2d7a15[_0x6eec('0x115')](_0x6eec('0x116'))['get'](errors[0x194]);_0x2d7a15[_0x6eec('0x115')]('/*')['get'](function(_0x205310,_0x340f8c){_0x340f8c[_0x6eec('0x117')](path[_0x6eec('0x118')](_0x2d7a15[_0x6eec('0x119')](_0x6eec('0x11a'))+'/index.html'));});return _0x2d7a15;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index dbf4df5..9025f97 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca02=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.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/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xca02,0x1e0));var _0x2ca0=function(_0x485e7a,_0x3fd29d){_0x485e7a=_0x485e7a-0x0;var _0x366deb=_0xca02[_0x485e7a];return _0x366deb;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2ca0('0x0'));var config=require(_0x2ca0('0x1'));exports[_0x2ca0('0x2')]=function(){return new Promise(function(_0x45bce3,_0x5b1626){var _0x3a1816={};_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x3')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x5')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x6')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x7')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x8')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x9')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xa')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/memberReport/memberReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xb')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailServerIn/mailServerIn.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xc')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailQueue/mailQueue.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xd')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0xe')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailApplication/mailApplication.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xf')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x10')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x11')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x12')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x13')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x14')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x15')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x16')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x17')));_0x3a1816=_['merge'](_0x3a1816,require('../api/smsMessage/smsMessage.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x18')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x19')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1b')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x1c')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1d')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/cmContact/cmContact.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x1e')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1f')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x20')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x21')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x22')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x23')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x24')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/sound/sound.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x25')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x26')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x27')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x28')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x29')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2b')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2c')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2d')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2e')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x2f')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x30')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x31')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x32')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x33')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x34')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/squareRecording/squareRecording.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x35')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x36')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x37')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x38')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x39')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x3a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x3b')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x3c')));var _0x19f1b2=jayson['server'](_0x3a1816)[_0x2ca0('0x3d')]();var _0x579410=config[_0x2ca0('0x3e')][_0x2ca0('0x3f')]||config[_0x2ca0('0x3f')]+0x1;var _0x3b1d1e=config['rpc']['ip']||_0x2ca0('0x40');_0x19f1b2['on'](_0x2ca0('0x41'),function(_0x146ac0){return _0x5b1626(_0x146ac0);});_0x19f1b2[_0x2ca0('0x2')](_0x579410,_0x3b1d1e,function(){console[_0x2ca0('0x42')](_0x2ca0('0x43'),_0x3b1d1e,_0x579410);require(_0x2ca0('0x44'))[_0x2ca0('0x45')]();return _0x45bce3('RPC\x20listening\x20on\x20'+_0x3b1d1e+':'+_0x579410);});});}; \ No newline at end of file +var _0x6239=['listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','jayson/promise','lodash'];(function(_0x2406bd,_0x262586){var _0x262964=function(_0x5e06ce){while(--_0x5e06ce){_0x2406bd['push'](_0x2406bd['shift']());}};_0x262964(++_0x262586);}(_0x6239,0x126));var _0x9623=function(_0x408e33,_0x3ee9f6){_0x408e33=_0x408e33-0x0;var _0x4d9043=_0x6239[_0x408e33];return _0x4d9043;};'use strict';var jayson=require(_0x9623('0x0'));var _=require(_0x9623('0x1'));var config=require('../config/environment');exports[_0x9623('0x2')]=function(){return new Promise(function(_0x3c46e6,_0x33c083){var _0x3e8218={};_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/user/user.rpc'));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x4')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x5')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x6')));_0x3e8218=_['merge'](_0x3e8218,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x7')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x8')));_0x3e8218=_['merge'](_0x3e8218,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/memberReport/memberReport.rpc'));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x9')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0xa')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0xb')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0xc')));_0x3e8218=_['merge'](_0x3e8218,require('../api/mailAccount/mailAccount.rpc'));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0xd')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0xe')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/mailMessage/mailMessage.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0xf')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x10')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x11')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x12')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x13')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x14')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x15')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x16')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/smsAccount/smsAccount.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x17')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x18')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x19')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1a')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1b')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1c')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1d')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1e')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x1f')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x20')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x21')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x22')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x23')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x24')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x25')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x26')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x27')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x28')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x29')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/template/template.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x2a')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x2b')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x2c')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x2d')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x2e')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x2f')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x30')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x31')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x32')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x33')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x34')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x35')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x36')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x37')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x38')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x39')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3a')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3b')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3c')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3d')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3e')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x3f')));_0x3e8218=_['merge'](_0x3e8218,require(_0x9623('0x40')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x41')));_0x3e8218=_[_0x9623('0x3')](_0x3e8218,require(_0x9623('0x42')));var _0x336cb6=jayson[_0x9623('0x43')](_0x3e8218)[_0x9623('0x44')]();var _0x4ca805=config[_0x9623('0x45')][_0x9623('0x46')]||config[_0x9623('0x46')]+0x1;var _0x2549ae=config[_0x9623('0x45')]['ip']||_0x9623('0x47');_0x336cb6['on'](_0x9623('0x48'),function(_0x5b7661){return _0x33c083(_0x5b7661);});_0x336cb6[_0x9623('0x2')](_0x4ca805,_0x2549ae,function(){console[_0x9623('0x49')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2549ae,_0x4ca805);require('../config/triggers')['default']();return _0x3c46e6('RPC\x20listening\x20on\x20'+_0x2549ae+':'+_0x4ca805);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 350c3fa..4c41f80 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 _0xf271=['startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','sync','prototype','answer','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr'];(function(_0x57a154,_0x5b0077){var _0x4bbb7e=function(_0x10fa34){while(--_0x10fa34){_0x57a154['push'](_0x57a154['shift']());}};_0x4bbb7e(++_0x5b0077);}(_0xf271,0x10b));var _0x1f27=function(_0x42be10,_0x44767f){_0x42be10=_0x42be10-0x0;var _0x4322ce=_0xf271[_0x42be10];return _0x4322ce;};'use strict';var util=require(_0x1f27('0x0'));var _=require('lodash');var EventEmitter=require(_0x1f27('0x1'))[_0x1f27('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x192c2e){var _0x1bec69=this,_0xc86d8c=new AGIReply(),_0x2a5241=![],_0x3704e3={};EventEmitter[_0x1f27('0x3')](_0x1bec69);_0x192c2e[_0x1f27('0x4')](_0x1f27('0x5'));_0x192c2e[_0x1f27('0x6')](0x8*0x3c*0x3c*0x3e8);_0xc86d8c[_0x1f27('0x4')](_0x1f27('0x5'));_0xc86d8c['on'](_0x1f27('0x7'),function(_0xf12834){for(var _0x1eee62 in _0xf12834){_0x1bec69[_0x1eee62]=_0xf12834[_0x1eee62];}_0x1bec69[_0x1f27('0x8')](_0x1f27('0x9'));});_0xc86d8c['on'](_0x1f27('0xa'),function(_0x1913f4){if(_0x1913f4[_0x1f27('0xb')]()=='hangup'){_0x1bec69[_0x1f27('0x8')]('hangup');return;}if(_0x1913f4[_0x1f27('0xc')](0x0,0xb)==_0x1f27('0xd')){_0x2a5241=!![];}if(_0x2a5241){_0x3704e3['rx']+=_0x1913f4+'\x0a';if(_0x1913f4[_0x1f27('0xe')](_0x1f27('0xf'))!=-0x1){_0x2a5241=![];}}else{_0x3704e3['rx']=_0x1913f4;}if(_0x2a5241){return;}if(typeof _0x3704e3['cb']==_0x1f27('0x10')){var _0x46adbd=_0x3704e3['rx'][_0x1f27('0xc')](0x0,0x3),_0x2781fc=null,_0x4ce87d=null;_0x46adbd=parseInt(_0x46adbd);if(isNaN(_0x46adbd)){_0x3704e3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1f27('0x11')});return;}if(_0x46adbd!=0xc8){_0x3704e3['cb'](null,{'code':_0x46adbd,'result':-0x1,'extra':'KO'});return;}_0x2781fc=_0x3704e3['rx'][_0x1f27('0xc')](0x4)['replace'](_0x1f27('0x12'),'');if(_0x2781fc[_0x1f27('0x13')]('\x20')!=-0x1){_0x2781fc=_0x2781fc[_0x1f27('0x14')](0x0,_0x2781fc[_0x1f27('0x13')]('\x20'));}if(_[_0x1f27('0x15')](_0x2781fc,'-1')){_0x2781fc=parseInt(_0x2781fc);}_0x4ce87d=_0x3704e3['rx'][_0x1f27('0x16')]('\x20');if(_0x4ce87d[_0x1f27('0x17')]==0x3){_0x4ce87d=_0x4ce87d[0x2]['substring'](0x1,_0x4ce87d[0x2][_0x1f27('0x17')]-0x1);}else if(_0x4ce87d[_0x1f27('0x17')]>0x3){var _0x3cda5b=/\((.+)\)/;var _0xb7a71a=_0x3704e3['rx']['match'](_0x3cda5b);if(_0xb7a71a){_0x4ce87d=_0xb7a71a[0x1];}else{_0x4ce87d=null;}}else{_0x4ce87d=null;}_0x3704e3['cb'](null,{'code':_0x46adbd,'result':_0x2781fc,'extra':_0x4ce87d});}});_0x192c2e['on'](_0x1f27('0x18'),function(_0x338680){_0x1bec69[_0x1f27('0x8')](_0x1f27('0x18'),new AGIError(_0x1f27('0x19'),_0x338680['code']));});_0x192c2e['on'](_0x1f27('0x1a'),function(){_0x1bec69[_0x1f27('0x8')](_0x1f27('0x1a'),new AGIError(_0x1f27('0x1b')));});_0x192c2e['on']('timeout',function(){_0x1bec69[_0x1f27('0x8')]('timeout',new AGIError(_0x1f27('0x1c')));_0x192c2e[_0x1f27('0x1d')]();});_0x192c2e[_0x1f27('0x1e')](_0xc86d8c);this[_0x1f27('0x1f')]=function(_0x1df49f,_0x1831d1){var _0x1df49f=_0x1df49f||'',_0x1831d1=typeof _0x1831d1==_0x1f27('0x10')?_0x1831d1:new Function();_0x3704e3={'tx':_0x1df49f,'rx':'','cb':_0x1831d1};_0x192c2e[_0x1f27('0x20')](_0x1df49f+'\x0a');},this[_0x1f27('0x1a')]=function(){_0x192c2e['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1f27('0x21')]=function(_0x3d00c2){return this[_0x1f27('0x1f')][_0x1f27('0x22')](this,_0x3d00c2);};AGIChannel[_0x1f27('0x23')][_0x1f27('0x24')]=function(){return this[_0x1f27('0x21')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x1ed51d,_0x16e115,_0x5e090a){_0x1ed51d=_0x1ed51d===undefined?_0x1f27('0x25'):_0x1ed51d;_0x16e115=_0x16e115===undefined?'5':_0x16e115;_0x5e090a=_0x5e090a===undefined?'1':_0x5e090a;return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x27'),_0x1ed51d,_0x16e115*0x3e8,_0x5e090a));};AGIChannel['prototype'][_0x1f27('0x28')]=function(_0x3975e1){_0x3975e1=_0x3975e1||_0x1f27('0x29');return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x2a'),_0x3975e1));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x2b')]=function(_0x276f2d,_0x43728e){if(_[_0x1f27('0x2c')](_0x43728e)){return this[_0x1f27('0x21')](util['format'](_0x1f27('0x2d'),_0x276f2d,_0x43728e[_0x1f27('0x2e')](',')));}return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x2d'),_0x276f2d,_0x43728e));};AGIChannel['prototype'][_0x1f27('0x2f')]=function(_0x10c2bf){return this['sendRequest'](util[_0x1f27('0x26')](_0x1f27('0x30'),_0x10c2bf));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x31')]=function(_0x1a8993){return this[_0x1f27('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x1a8993));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x32')]=function(_0x3eabb1){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SET\x20PRIORITY\x20%s',_0x3eabb1));};AGIChannel[_0x1f27('0x23')]['hangup']=function(){return this[_0x1f27('0x21')](_0x1f27('0x33'));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x34')]=function(_0x1574a7,_0x5792ea){var _0x341101=_[_0x1f27('0x35')](_0x5792ea)||_[_0x1f27('0x36')](_0x5792ea)?_0x5792ea['toString']():_0x5792ea;return this[_0x1f27('0x21')](util['format'](_0x1f27('0x37'),_0x1574a7,_0x341101?_0x341101[_0x1f27('0x38')]()[_0x1f27('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3a')]=function(_0x3dd784,_0x1daedd){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x3dd784,_0x1daedd));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3b')]=function(_0x205ba0,_0x37aba4){return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x3c'),_0x205ba0,_0x37aba4));};AGIChannel[_0x1f27('0x23')]['sayPhonetic']=function(_0x119d99,_0x367b2c){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x119d99,_0x367b2c));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3d')]=function(_0x477d8b,_0x31c625,_0x423845){_0x31c625=_0x31c625||this[_0x1f27('0x3e')];_0x423845=_0x423845||0x1;this[_0x1f27('0x2f')](_0x477d8b);this[_0x1f27('0x31')](_0x31c625);this[_0x1f27('0x32')](_0x423845);return this[_0x1f27('0x28')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x477d8b,_0x31c625,_0x423845));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3f')]=function(_0x5957a8){return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x40'),_0x5957a8));};AGIChannel['prototype']['recordFile']=function(_0x37c95a,_0x5e151f,_0x19ce84,_0x25d7d5,_0x40461b,_0x756f67){_0x5e151f=_0x5e151f||_0x1f27('0x41');_0x19ce84=_0x19ce84||'';_0x25d7d5=_0x25d7d5===undefined?-0x1:_0x25d7d5==='-1'?-0x1:_0x25d7d5*0x3e8;_0x40461b=_0x40461b===undefined?'':'s='+_0x40461b;_0x756f67=_0x756f67?_0x1f27('0x42'):'';return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x43'),_0x37c95a,_0x5e151f,_0x19ce84,_0x25d7d5,_0x756f67,_0x40461b));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x44')]=function(_0x50145b,_0x53d0cb){_0x53d0cb=_0x53d0cb||'';return this['sendRequest'](util[_0x1f27('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x50145b,_0x53d0cb));};AGIChannel['prototype']['agi']=function(_0x11d5e0){return this['exec']('AGI',_0x11d5e0);};AGIChannel[_0x1f27('0x23')]['wait']=function(_0x126199){return this[_0x1f27('0x2b')](_0x1f27('0x45'),_0x126199);};AGIChannel[_0x1f27('0x23')][_0x1f27('0x18')]=function(_0x3f4155,_0x1aba03){this[_0x1f27('0x28')](util['format'](_0x1f27('0x46'),_0x3f4155['id'],_0x3f4155['label'],_0x1aba03));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1f27('0x47')]=AGIChannel; \ No newline at end of file +var _0xeae4=['setTimeout','setEncoding','headers','emit','ready','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','function','sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','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','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','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','util','lodash','events','EventEmitter','./reply','./error','call','utf8'];(function(_0x2e4f96,_0x3f7d0c){var _0x548233=function(_0x213183){while(--_0x213183){_0x2e4f96['push'](_0x2e4f96['shift']());}};_0x548233(++_0x3f7d0c);}(_0xeae4,0xe8));var _0x4eae=function(_0x41e019,_0x1d1b8a){_0x41e019=_0x41e019-0x0;var _0xf1e101=_0xeae4[_0x41e019];return _0xf1e101;};'use strict';var util=require(_0x4eae('0x0'));var _=require(_0x4eae('0x1'));var EventEmitter=require(_0x4eae('0x2'))[_0x4eae('0x3')];var AGIReply=require(_0x4eae('0x4'));var AGIError=require(_0x4eae('0x5'));function AGIChannel(_0x3bf52b){var _0x1bbfec=this,_0x177aae=new AGIReply(),_0x3358d5=![],_0x4e940a={};EventEmitter[_0x4eae('0x6')](_0x1bbfec);_0x3bf52b['setEncoding'](_0x4eae('0x7'));_0x3bf52b[_0x4eae('0x8')](0x8*0x3c*0x3c*0x3e8);_0x177aae[_0x4eae('0x9')](_0x4eae('0x7'));_0x177aae['on'](_0x4eae('0xa'),function(_0x1c8370){for(var _0x4f7adc in _0x1c8370){_0x1bbfec[_0x4f7adc]=_0x1c8370[_0x4f7adc];}_0x1bbfec[_0x4eae('0xb')](_0x4eae('0xc'));});_0x177aae['on']('line',function(_0x532bf9){if(_0x532bf9['toLowerCase']()==_0x4eae('0xd')){_0x1bbfec[_0x4eae('0xb')](_0x4eae('0xd'));return;}if(_0x532bf9[_0x4eae('0xe')](0x0,0xb)==_0x4eae('0xf')){_0x3358d5=!![];}if(_0x3358d5){_0x4e940a['rx']+=_0x532bf9+'\x0a';if(_0x532bf9[_0x4eae('0x10')](_0x4eae('0x11'))!=-0x1){_0x3358d5=![];}}else{_0x4e940a['rx']=_0x532bf9;}if(_0x3358d5){return;}if(typeof _0x4e940a['cb']=='function'){var _0x47d076=_0x4e940a['rx'][_0x4eae('0xe')](0x0,0x3),_0x51f1f4=null,_0x53986f=null;_0x47d076=parseInt(_0x47d076);if(isNaN(_0x47d076)){_0x4e940a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x47d076!=0xc8){_0x4e940a['cb'](null,{'code':_0x47d076,'result':-0x1,'extra':'KO'});return;}_0x51f1f4=_0x4e940a['rx'][_0x4eae('0xe')](0x4)[_0x4eae('0x12')](_0x4eae('0x13'),'');if(_0x51f1f4[_0x4eae('0x14')]('\x20')!=-0x1){_0x51f1f4=_0x51f1f4[_0x4eae('0x15')](0x0,_0x51f1f4[_0x4eae('0x14')]('\x20'));}if(_[_0x4eae('0x16')](_0x51f1f4,'-1')){_0x51f1f4=parseInt(_0x51f1f4);}_0x53986f=_0x4e940a['rx'][_0x4eae('0x17')]('\x20');if(_0x53986f[_0x4eae('0x18')]==0x3){_0x53986f=_0x53986f[0x2]['substring'](0x1,_0x53986f[0x2]['length']-0x1);}else if(_0x53986f[_0x4eae('0x18')]>0x3){var _0x54a9d7=/\((.+)\)/;var _0x51321f=_0x4e940a['rx'][_0x4eae('0x19')](_0x54a9d7);if(_0x51321f){_0x53986f=_0x51321f[0x1];}else{_0x53986f=null;}}else{_0x53986f=null;}_0x4e940a['cb'](null,{'code':_0x47d076,'result':_0x51f1f4,'extra':_0x53986f});}});_0x3bf52b['on']('error',function(_0x83fa03){_0x1bbfec[_0x4eae('0xb')](_0x4eae('0x1a'),new AGIError(_0x4eae('0x1b'),_0x83fa03['code']));});_0x3bf52b['on'](_0x4eae('0x1c'),function(){_0x1bbfec[_0x4eae('0xb')]('close',new AGIError(_0x4eae('0x1d')));});_0x3bf52b['on']('timeout',function(){_0x1bbfec[_0x4eae('0xb')](_0x4eae('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3bf52b[_0x4eae('0x1f')]();});_0x3bf52b[_0x4eae('0x20')](_0x177aae);this[_0x4eae('0x21')]=function(_0x58e18d,_0x229266){var _0x58e18d=_0x58e18d||'',_0x229266=typeof _0x229266==_0x4eae('0x22')?_0x229266:new Function();_0x4e940a={'tx':_0x58e18d,'rx':'','cb':_0x229266};_0x3bf52b['write'](_0x58e18d+'\x0a');},this[_0x4eae('0x1c')]=function(){_0x3bf52b[_0x4eae('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x4eae('0x23')]=function(_0x3c7b07){return this[_0x4eae('0x21')][_0x4eae('0x24')](this,_0x3c7b07);};AGIChannel[_0x4eae('0x25')][_0x4eae('0x26')]=function(){return this[_0x4eae('0x23')](_0x4eae('0x27'));};AGIChannel['prototype'][_0x4eae('0x28')]=function(_0x5ca5cb,_0x307846,_0x49b32a){_0x5ca5cb=_0x5ca5cb===undefined?_0x4eae('0x29'):_0x5ca5cb;_0x307846=_0x307846===undefined?'5':_0x307846;_0x49b32a=_0x49b32a===undefined?'1':_0x49b32a;return this['sendRequest'](util[_0x4eae('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x5ca5cb,_0x307846*0x3e8,_0x49b32a));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x2b')]=function(_0x352956){_0x352956=_0x352956||_0x4eae('0x2c');return this[_0x4eae('0x23')](util[_0x4eae('0x2a')](_0x4eae('0x2d'),_0x352956));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x2e')]=function(_0x10e6e5,_0x15c6d4){if(_[_0x4eae('0x2f')](_0x15c6d4)){return this[_0x4eae('0x23')](util['format'](_0x4eae('0x30'),_0x10e6e5,_0x15c6d4[_0x4eae('0x31')](',')));}return this['sendRequest'](util[_0x4eae('0x2a')](_0x4eae('0x30'),_0x10e6e5,_0x15c6d4));};AGIChannel['prototype'][_0x4eae('0x32')]=function(_0x38ea61){return this[_0x4eae('0x23')](util['format'](_0x4eae('0x33'),_0x38ea61));};AGIChannel['prototype'][_0x4eae('0x34')]=function(_0x2d7299){return this[_0x4eae('0x23')](util['format'](_0x4eae('0x35'),_0x2d7299));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x36')]=function(_0x23594d){return this['sendRequest'](util['format']('SET\x20PRIORITY\x20%s',_0x23594d));};AGIChannel['prototype']['hangup']=function(){return this[_0x4eae('0x23')](_0x4eae('0x37'));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x38')]=function(_0x1bea0a,_0x3fb29b){var _0x2dd5a0=_[_0x4eae('0x39')](_0x3fb29b)||_[_0x4eae('0x3a')](_0x3fb29b)?_0x3fb29b[_0x4eae('0x3b')]():_0x3fb29b;return this['sendRequest'](util[_0x4eae('0x2a')](_0x4eae('0x3c'),_0x1bea0a,_0x2dd5a0?_0x2dd5a0[_0x4eae('0x3b')]()[_0x4eae('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x4eae('0x3d')]=function(_0x1e9973,_0x135398){return this[_0x4eae('0x23')](util['format'](_0x4eae('0x3e'),_0x1e9973,_0x135398));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x3f')]=function(_0x14dab5,_0x10d9c0){return this[_0x4eae('0x23')](util[_0x4eae('0x2a')](_0x4eae('0x40'),_0x14dab5,_0x10d9c0));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x41')]=function(_0x580427,_0x5c4ca7){return this[_0x4eae('0x23')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x580427,_0x5c4ca7));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x42')]=function(_0x621ee0,_0x2c12d5,_0x559a9c){_0x2c12d5=_0x2c12d5||this[_0x4eae('0x43')];_0x559a9c=_0x559a9c||0x1;this[_0x4eae('0x32')](_0x621ee0);this[_0x4eae('0x34')](_0x2c12d5);this[_0x4eae('0x36')](_0x559a9c);return this[_0x4eae('0x2b')](util[_0x4eae('0x2a')](_0x4eae('0x44'),_0x621ee0,_0x2c12d5,_0x559a9c));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x45')]=function(_0xf065c0){return this[_0x4eae('0x23')](util['format'](_0x4eae('0x46'),_0xf065c0));};AGIChannel['prototype'][_0x4eae('0x47')]=function(_0x4afb97,_0x3d216e,_0x2c311d,_0x354b0f,_0x5dc4c1,_0x452e1f){_0x3d216e=_0x3d216e||'wav';_0x2c311d=_0x2c311d||'';_0x354b0f=_0x354b0f===undefined?-0x1:_0x354b0f==='-1'?-0x1:_0x354b0f*0x3e8;_0x5dc4c1=_0x5dc4c1===undefined?'':'s='+_0x5dc4c1;_0x452e1f=_0x452e1f?'BEEP':'';return this['sendRequest'](util[_0x4eae('0x2a')](_0x4eae('0x48'),_0x4afb97,_0x3d216e,_0x2c311d,_0x354b0f,_0x452e1f,_0x5dc4c1));};AGIChannel[_0x4eae('0x25')]['streamFile']=function(_0x320908,_0x2dc50d){_0x2dc50d=_0x2dc50d||'';return this[_0x4eae('0x23')](util[_0x4eae('0x2a')](_0x4eae('0x49'),_0x320908,_0x2dc50d));};AGIChannel[_0x4eae('0x25')][_0x4eae('0x4a')]=function(_0x278150){return this[_0x4eae('0x2e')](_0x4eae('0x4b'),_0x278150);};AGIChannel['prototype']['wait']=function(_0x76e166){return this['exec'](_0x4eae('0x4c'),_0x76e166);};AGIChannel[_0x4eae('0x25')]['error']=function(_0x2ba96a,_0x162125){this[_0x4eae('0x2b')](util[_0x4eae('0x2a')](_0x4eae('0x4d'),_0x2ba96a['id'],_0x2ba96a[_0x4eae('0x4e')],_0x162125));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4eae('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 71c9d66..9736541 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 _0x3538=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x3c2cc6,_0x3285fa){var _0x11c0a6=function(_0x3fd419){while(--_0x3fd419){_0x3c2cc6['push'](_0x3c2cc6['shift']());}};_0x11c0a6(++_0x3285fa);}(_0x3538,0x14e));var _0x8353=function(_0x4e3a1f,_0x3dbd3f){_0x4e3a1f=_0x4e3a1f-0x0;var _0x6d4971=_0x3538[_0x4e3a1f];return _0x6d4971;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8353('0x0'),'E_AGI_ARGUMENT_PORT':_0x8353('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x8353('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x8353('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8353('0x4'),'E_AGI_SOCKET_CLOSE':_0x8353('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8353('0x6'),'E_AGI_IVR_ENTRY':_0x8353('0x7')};function AGIError(_0x1a1037){var _0x1a1037=_0x1a1037||null,_0x4c6f5a=_0x4c6f5a||[],_0x339467=0x1,_0x25ca13='';if(!error[_0x1a1037]){_0x1a1037=_0x8353('0x8');}_0x4c6f5a['push'](error[_0x1a1037]);while(arguments[_0x339467]){_0x4c6f5a[_0x8353('0x9')](arguments[_0x339467]);_0x339467++;}_0x25ca13=util['format'][_0x8353('0xa')](util,_0x4c6f5a);this[_0x8353('0xb')]=_0x25ca13;this[_0x8353('0xc')]=_0x1a1037;}module[_0x8353('0xd')]=AGIError; \ No newline at end of file +var _0x31b0=['E_AGI_UNDEFINED','push','format','apply','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x4a3135,_0x4a3600){var _0x1506ad=function(_0x10ee1d){while(--_0x10ee1d){_0x4a3135['push'](_0x4a3135['shift']());}};_0x1506ad(++_0x4a3600);}(_0x31b0,0xa5));var _0x031b=function(_0x24fd75,_0x3e4969){_0x24fd75=_0x24fd75-0x0;var _0x31d947=_0x31b0[_0x24fd75];return _0x31d947;};'use strict';var util=require(_0x031b('0x0'));var error={'E_AGI_UNDEFINED':_0x031b('0x1'),'E_AGI_ARGUMENT_PORT':_0x031b('0x2'),'E_AGI_SERVER_ERROR':_0x031b('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x031b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x031b('0x5'),'E_AGI_SOCKET_ERROR':_0x031b('0x6'),'E_AGI_SOCKET_CLOSE':_0x031b('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x031b('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x031b('0x9'),'E_AGI_IVR_ENTRY':_0x031b('0xa')};function AGIError(_0x5ae30a){var _0x5ae30a=_0x5ae30a||null,_0x2a8d1c=_0x2a8d1c||[],_0x26aff9=0x1,_0x47e838='';if(!error[_0x5ae30a]){_0x5ae30a=_0x031b('0xb');}_0x2a8d1c[_0x031b('0xc')](error[_0x5ae30a]);while(arguments[_0x26aff9]){_0x2a8d1c[_0x031b('0xc')](arguments[_0x26aff9]);_0x26aff9++;}_0x47e838=util[_0x031b('0xd')][_0x031b('0xe')](util,_0x2a8d1c);this['message']=_0x47e838;this['name']=_0x5ae30a;}module[_0x031b('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 31571d0..ddcbd0c 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 _0x0a4f=['no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getdigits','edges','numberOfEdges','prototype','addEdge','size','vertices','relations','traverseBFS','info'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0a4f,0x153));var _0xf0a4=function(_0x12a594,_0x19a33c){_0x12a594=_0x12a594-0x0;var _0x352236=_0x0a4f[_0x12a594];return _0x352236;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xf0a4('0x0'));var verticesWithRetry=[_0xf0a4('0x1'),_0xf0a4('0x2'),'getsecretdigits'];var Graph=function(){this['vertices']={};this[_0xf0a4('0x3')]={};this[_0xf0a4('0x4')]=0x0;};Graph['prototype']['addVertex']=function(_0x43ee1e){this['vertices'][_0x43ee1e['id']]=_0x43ee1e;this['edges'][_0x43ee1e['id']]=[];};Graph[_0xf0a4('0x5')][_0xf0a4('0x6')]=function(_0x1b581e,_0x2bf40f,_0x8e3b93){this[_0xf0a4('0x3')][_0x1b581e]['push']({'target':_0x2bf40f,'condition':_0x8e3b93});this[_0xf0a4('0x4')]+=0x1;};Graph[_0xf0a4('0x5')][_0xf0a4('0x7')]=function(){return _[_0xf0a4('0x7')](this[_0xf0a4('0x8')]);};Graph[_0xf0a4('0x5')][_0xf0a4('0x9')]=function(){return this[_0xf0a4('0x4')];};Graph[_0xf0a4('0x5')]['getVertex']=function(_0x16691c){return this['vertices'][_0x16691c];};Graph[_0xf0a4('0x5')][_0xf0a4('0xa')]=function(_0x22cfa4,_0x3b19b5){if(!this[_0xf0a4('0x8')][_0x22cfa4]){return logger[_0xf0a4('0xb')](_0xf0a4('0xc'));}var _0xdc8b00=_0x3b19b5(this[_0xf0a4('0x8')][_0x22cfa4]);if(!_0xdc8b00){return logger[_0xf0a4('0xb')](_0xf0a4('0xd'));}if(this['edges'][_0x22cfa4]['length']===0x0){return logger['info'](_0xf0a4('0xe'));}for(var _0xdbcf9f=0x0,_0x1fc164=[],_0x772ec1=![];_0xdbcf9f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','joinAt','traverseBFS','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','isUndefined','continueAt','Project\x20%s\x20not\x20found','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','lodash','util','moment','../../config/logger','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','stack','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd9ec,0x77));var _0xcd9e=function(_0x2813f7,_0x38c480){_0x2813f7=_0x2813f7-0x0;var _0x155923=_0xd9ec[_0x2813f7];return _0x155923;};'use strict';var parser=require('xml2json');var _=require(_0xcd9e('0x0'));var syncho=require('syncho');var util=require(_0xcd9e('0x1'));var moment=require(_0xcd9e('0x2'));var config=require('../../config/environment');var logger=require(_0xcd9e('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0xcd9e('0x4'));var Graph=require(_0xcd9e('0x5'));var Vertices=require(_0xcd9e('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xcd9e('0x7')]=_[_0xcd9e('0x8')](config['agi'],{'ip':_0xcd9e('0x9'),'port':0x11dd});function connectionHandler(_0x6b4ed4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x6b4ed4);agiHandler(_0x6b4ed4);}catch(_0x42b0c2){logger['error'](_0x42b0c2[_0xcd9e('0xa')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xcd9e('0x7')][_0xcd9e('0xb')]);logger['info'](util[_0xcd9e('0xc')](_0xcd9e('0xd'),config['agi']['ip'],config['agi'][_0xcd9e('0xb')]));}function errorHandler(_0x2edee9){if(_0x2edee9&&_0x2edee9[_0xcd9e('0xe')]&&_0x2edee9[_0xcd9e('0xf')]){logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x11'),_0x2edee9['name'],_0x2edee9['message']));}else{logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x12'),_0x2edee9[_0xcd9e('0xa')]));}}function closeHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x14'),this['arg_1'],this['calleridname'],this[_0xcd9e('0x15')],this[_0xcd9e('0x16')],this[_0xcd9e('0x17')]));try{createSquareReport(this);}catch(_0x398387){logger[_0xcd9e('0x10')](_0x398387[_0xcd9e('0xa')]);}}function timeoutHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x18'),this[_0xcd9e('0x19')],this[_0xcd9e('0x1a')],this['callerid'],this['dnid'],this[_0xcd9e('0x17')]));}function hangupHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x1b'),this[_0xcd9e('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xcd9e('0x17')]));this['evtHangup']=!![];}function getRoot(_0x355034){return parser['toJson'](_0x355034,{'object':!![]})['mxGraphModel'][_0xcd9e('0x1c')];}function addVertex(_0x53171f,_0x3b2130,_0x41a2a2){_0x3b2130[_0xcd9e('0x1d')]=_0x41a2a2;if(_0x3b2130[_0xcd9e('0x1e')](_0xcd9e('0x1f'))){_0x3b2130[_0xcd9e('0x20')]=parseInt(_0x3b2130[_0xcd9e('0x1f')],0xa);}_0x53171f[_0xcd9e('0x21')](_[_0xcd9e('0x22')](_0x3b2130,_0xcd9e('0x23')));}function initGraph(_0xebbb55,_0x435397){var _0x40ca08=new Graph();for(var _0x56c206 in _0xebbb55){if(_0xebbb55['hasOwnProperty'](_0x56c206)){if(_['isArray'](_0xebbb55[_0x56c206])){for(var _0x57a11d=0x0;_0x57a11d<_0xebbb55[_0x56c206][_0xcd9e('0x24')];_0x57a11d+=0x1){addVertex(_0x40ca08,_0xebbb55[_0x56c206][_0x57a11d],_0x56c206);}}else{addVertex(_0x40ca08,_0xebbb55[_0x56c206],_0x56c206);}}}for(var _0x1da9fe=0x0;_0x1da9fe<_0x435397[_0xcd9e('0x24')];_0x1da9fe+=0x1){if(_0x435397[_0x1da9fe]['source']&&_0x435397[_0x1da9fe][_0xcd9e('0x25')]){_0x40ca08[_0xcd9e('0x26')](_0x435397[_0x1da9fe][_0xcd9e('0x27')],_0x435397[_0x1da9fe][_0xcd9e('0x25')],_0x435397[_0x1da9fe][_0xcd9e('0x28')]);}}return _0x40ca08;}function getSquareProject(_0x4ae2a0,_0x240842){rpc['getSquareProject'](_0x4ae2a0)['then'](function(_0x29b853){_0x240842(null,_0x29b853);})[_0xcd9e('0x29')](function(_0x2b7845){_0x240842(null,_0x2b7845);});}function createSquareReport(_0xdb6bc1,_0x5ac772){rpc[_0xcd9e('0x2a')](_0xdb6bc1)['then'](function(_0x44c977){if(_0x5ac772){_0x5ac772(null,_0x44c977);}})[_0xcd9e('0x29')](function(_0x3b1611){if(_0x5ac772){_0x5ac772(null,_0x3b1611);}});}function setChannelVariables(_0x2e1f28){for(var _0xcb5be1 in _0x2e1f28){if(_0x2e1f28['hasOwnProperty'](_0xcb5be1)){if(_0xcb5be1['indexOf']('agi_')===0x0){_0x2e1f28[_0xcb5be1['substring'](0x4)]=_0x2e1f28[_0xcb5be1];delete _0x2e1f28[_0xcb5be1];}}}}function getLogFromObject(_0x5e49cc){return util['inspect'](_0x5e49cc,{'showHidden':![],'depth':null});}function agiHandler(_0x3b34fd){var _0x138303,_0x260b00,_0x564fed,_0x4adb33,_0x417bc0;logger[_0xcd9e('0x2b')]('variables',JSON['stringify'](_0x3b34fd,null,0x2));logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x2c'),_0x3b34fd[_0xcd9e('0x19')],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd['callerid'],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));_0x3b34fd['on'](_0xcd9e('0x10'),errorHandler);_0x3b34fd['on'](_0xcd9e('0x2d'),closeHandler);_0x3b34fd['on'](_0xcd9e('0x2e'),timeoutHandler);_0x3b34fd[_0xcd9e('0x2f')]=![];_0x3b34fd['on'](_0xcd9e('0x30'),hangupHandler);var _0x39a47e=getSquareProject[_0xcd9e('0x31')](null,_0x3b34fd['arg_1']);if(_0x39a47e){if(_0x39a47e['production']){_0x138303=getRoot(_0x39a47e[_0xcd9e('0x32')]);if(_0x138303&&_0x138303[_0xcd9e('0x33')]){logger[_0xcd9e('0x2b')](_0xcd9e('0x1c'),JSON['stringify'](_0x138303,null,0x2));_0x3b34fd[_0xcd9e('0x34')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x260b00=initGraph(_[_0xcd9e('0x22')](_0x138303,_0xcd9e('0x23')),_0x138303[_0xcd9e('0x23')]);_0x564fed=new Vertices(_0x3b34fd,rpc,mailRpc);logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b34fd['arg_1'],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));_0x260b00[_0xcd9e('0x35')](_0x138303[_0xcd9e('0x33')]['id'],function(_0x1a4ef1){try{_0x1a4ef1=_0x564fed['clear'](_0x1a4ef1);logger['debug']('vertex',JSON[_0xcd9e('0x36')](_0x1a4ef1,null,0x2));if(_0x1a4ef1[_0xcd9e('0x1d')]===_0xcd9e('0x37')){logger[_0xcd9e('0x13')](_0xcd9e('0x38'));_0x3b34fd[_0xcd9e('0x39')]=_0x1a4ef1[_0xcd9e('0x39')]||_0x3b34fd[_0xcd9e('0x39')];_0x3b34fd['extension']=_0x1a4ef1[_0xcd9e('0x3a')];_0x3b34fd[_0xcd9e('0x3b')]=_0x1a4ef1[_0xcd9e('0x3b')]?_0x1a4ef1[_0xcd9e('0x3b')]-0x1:0x1;return null;}else if(_0x1a4ef1&&_0x564fed[_0x1a4ef1[_0xcd9e('0x1d')]]){_0x417bc0=_0x564fed[_0x1a4ef1['agicommand']](_0x1a4ef1);logger['info'](_0xcd9e('0x3c'),JSON['stringify'](_0x417bc0,null,0x2));if(_0x417bc0&&_0x417bc0['code']===AGI_CODE_SUCCESS&&_0x417bc0[_0xcd9e('0x3d')]!==AGI_RESULT_ERROR&&!_0x3b34fd[_0xcd9e('0x2f')]){logger[_0xcd9e('0x2b')](_0xcd9e('0x3c'),getLogFromObject(_0x417bc0));return _['isUndefined'](_0x417bc0[_0xcd9e('0x3d')])?null:_0x417bc0['result'][_0xcd9e('0x3e')]();}else{logger[_0xcd9e('0x10')]('response',getLogFromObject(_0x417bc0));return null;}}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3f'));return null;}}catch(_0x38a1b3){logger[_0xcd9e('0x10')](_0x38a1b3[_0xcd9e('0xa')]);return null;}});if(_0x138303[_0xcd9e('0x40')]){logger['info'](util[_0xcd9e('0xc')](_0xcd9e('0x41'),_0x3b34fd['arg_1'],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd['dnid'],_0x3b34fd[_0xcd9e('0x17')]));_0x260b00[_0xcd9e('0x35')](_0x138303[_0xcd9e('0x40')]['id'],function(_0x3612d8){try{_0x3612d8=_0x564fed[_0xcd9e('0x42')](_0x3612d8);logger[_0xcd9e('0x2b')]('vertex',JSON[_0xcd9e('0x36')](_0x3612d8,null,0x2));if(_0x3612d8&&_0x564fed[_0x3612d8['agicommand']]){_0x417bc0=_0x564fed[_0x3612d8[_0xcd9e('0x1d')]](_0x3612d8);if(_0x417bc0){logger[_0xcd9e('0x2b')]('response',getLogFromObject(_0x417bc0));return _[_0xcd9e('0x43')](_0x417bc0['result'])?null:_0x417bc0[_0xcd9e('0x3d')][_0xcd9e('0x3e')]();}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3c'),getLogFromObject(_0x417bc0));return null;}}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3f'));return null;}}catch(_0x47e4e8){logger['error'](_0x47e4e8['stack']);return null;}});}logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b34fd[_0xcd9e('0x19')],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));logger[_0xcd9e('0x13')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd['close']();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x3b34fd['arg_1']));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd[_0xcd9e('0x2d')]();}}else{logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x45'),_0x3b34fd[_0xcd9e('0x19')]));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd['extension'],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd[_0xcd9e('0x2d')]();}}function main(){var _0x4251e9;return utilLicense['getLicense']()[_0xcd9e('0x46')](function(_0x283483){if(_0x283483){if(_0x283483[_0xcd9e('0x47')]){if(_0x283483[_0xcd9e('0x48')]&&_0x283483['callysquare']>0x0){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[LICENSE]\x20CHANNELS:\x20%s',_0x283483[_0xcd9e('0x48')]));_0x4251e9=_0x283483[_0xcd9e('0x48')];}else{logger['info'](_0xcd9e('0x49'));}}else{logger[_0xcd9e('0x13')](_0xcd9e('0x4a'));_0x4251e9=-0x1;}}})[_0xcd9e('0x29')](function(_0x29f40a){logger[_0xcd9e('0x10')]('[LICENSE]',_0x29f40a[_0xcd9e('0xa')]);})[_0xcd9e('0x40')](function(){var _0x211ed9=require('./server')(config[_0xcd9e('0x7')][_0xcd9e('0xb')],config[_0xcd9e('0x7')]['ip'],_0x4251e9);_0x211ed9['on'](_0xcd9e('0x10'),errorHandler);_0x211ed9['on'](_0xcd9e('0x4b'),listeningHandler);_0x211ed9['on'](_0xcd9e('0x4c'),connectionHandler);_0x211ed9['on'](_0xcd9e('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0x816e=['isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','calleridname','callerid','evtHangup','toJson','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','sync','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result'];(function(_0x1bf446,_0x2a92e1){var _0x67eecd=function(_0x2dc476){while(--_0x2dc476){_0x1bf446['push'](_0x1bf446['shift']());}};_0x67eecd(++_0x2a92e1);}(_0x816e,0x1db));var _0xe816=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x816e[_0x209941];return _0x1e8729;};'use strict';var parser=require(_0xe816('0x0'));var _=require('lodash');var syncho=require(_0xe816('0x1'));var util=require(_0xe816('0x2'));var moment=require(_0xe816('0x3'));var config=require(_0xe816('0x4'));var logger=require(_0xe816('0x5'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0xe816('0x6'));var mailRpc=require(_0xe816('0x7'));var Graph=require(_0xe816('0x8'));var Vertices=require(_0xe816('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe816('0xa')]=_[_0xe816('0xb')](config['agi'],{'ip':_0xe816('0xc'),'port':0x11dd});function connectionHandler(_0x39f5cb){process[_0xe816('0xd')](function(){syncho(function(){try{setChannelVariables(_0x39f5cb);agiHandler(_0x39f5cb);}catch(_0x2e9495){logger[_0xe816('0xe')](_0x2e9495[_0xe816('0xf')]);}});});}function listeningHandler(){console['log'](_0xe816('0x10'),config[_0xe816('0xa')][_0xe816('0x11')]);logger[_0xe816('0x12')](util[_0xe816('0x13')](_0xe816('0x14'),config[_0xe816('0xa')]['ip'],config[_0xe816('0xa')]['port']));}function errorHandler(_0x3b609a){if(_0x3b609a&&_0x3b609a[_0xe816('0x15')]&&_0x3b609a[_0xe816('0x16')]){logger[_0xe816('0xe')](util[_0xe816('0x13')](_0xe816('0x17'),_0x3b609a[_0xe816('0x15')],_0x3b609a[_0xe816('0x16')]));}else{logger[_0xe816('0xe')](util[_0xe816('0x13')](_0xe816('0x18'),_0x3b609a[_0xe816('0xf')]));}}function closeHandler(){logger[_0xe816('0x12')](util[_0xe816('0x13')](_0xe816('0x19'),this[_0xe816('0x1a')],this['calleridname'],this['callerid'],this[_0xe816('0x1b')],this[_0xe816('0x1c')]));try{createSquareReport(this);}catch(_0x8c6ce7){logger['error'](_0x8c6ce7[_0xe816('0xf')]);}}function timeoutHandler(){logger[_0xe816('0x12')](util[_0xe816('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe816('0x1a')],this[_0xe816('0x1d')],this['callerid'],this[_0xe816('0x1b')],this[_0xe816('0x1c')]));}function hangupHandler(){logger[_0xe816('0x12')](util[_0xe816('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xe816('0x1a')],this[_0xe816('0x1d')],this[_0xe816('0x1e')],this[_0xe816('0x1b')],this[_0xe816('0x1c')]));this[_0xe816('0x1f')]=!![];}function getRoot(_0x143566){return parser[_0xe816('0x20')](_0x143566,{'object':!![]})['mxGraphModel'][_0xe816('0x21')];}function addVertex(_0x3661ed,_0x9484cc,_0x461271){_0x9484cc['agicommand']=_0x461271;if(_0x9484cc[_0xe816('0x22')](_0xe816('0x23'))){_0x9484cc[_0xe816('0x24')]=parseInt(_0x9484cc[_0xe816('0x23')],0xa);}_0x3661ed[_0xe816('0x25')](_[_0xe816('0x26')](_0x9484cc,_0xe816('0x27')));}function initGraph(_0x3998e1,_0x5b3369){var _0x2512dd=new Graph();for(var _0x2a1755 in _0x3998e1){if(_0x3998e1[_0xe816('0x22')](_0x2a1755)){if(_['isArray'](_0x3998e1[_0x2a1755])){for(var _0x11b19d=0x0;_0x11b19d<_0x3998e1[_0x2a1755][_0xe816('0x28')];_0x11b19d+=0x1){addVertex(_0x2512dd,_0x3998e1[_0x2a1755][_0x11b19d],_0x2a1755);}}else{addVertex(_0x2512dd,_0x3998e1[_0x2a1755],_0x2a1755);}}}for(var _0x4a7458=0x0;_0x4a7458<_0x5b3369[_0xe816('0x28')];_0x4a7458+=0x1){if(_0x5b3369[_0x4a7458]['source']&&_0x5b3369[_0x4a7458]['target']){_0x2512dd['addEdge'](_0x5b3369[_0x4a7458][_0xe816('0x29')],_0x5b3369[_0x4a7458][_0xe816('0x2a')],_0x5b3369[_0x4a7458]['value']);}}return _0x2512dd;}function getSquareProject(_0x23d78b,_0x439405){rpc[_0xe816('0x2b')](_0x23d78b)[_0xe816('0x2c')](function(_0x350ab2){_0x439405(null,_0x350ab2);})['catch'](function(_0x5abcb3){_0x439405(null,_0x5abcb3);});}function createSquareReport(_0x178ffe,_0x9ad71f){rpc[_0xe816('0x2d')](_0x178ffe)[_0xe816('0x2c')](function(_0xd919e2){if(_0x9ad71f){_0x9ad71f(null,_0xd919e2);}})[_0xe816('0x2e')](function(_0x502bad){if(_0x9ad71f){_0x9ad71f(null,_0x502bad);}});}function setChannelVariables(_0xa7c286){for(var _0x278324 in _0xa7c286){if(_0xa7c286[_0xe816('0x22')](_0x278324)){if(_0x278324[_0xe816('0x2f')](_0xe816('0x30'))===0x0){_0xa7c286[_0x278324[_0xe816('0x31')](0x4)]=_0xa7c286[_0x278324];delete _0xa7c286[_0x278324];}}}}function getLogFromObject(_0x463e38){return util[_0xe816('0x32')](_0x463e38,{'showHidden':![],'depth':null});}function agiHandler(_0x4b3813){var _0x28c1a8,_0x188cdb,_0x255a09,_0x2b25e5,_0x1f369c;logger[_0xe816('0x33')]('variables',JSON[_0xe816('0x34')](_0x4b3813,null,0x2));logger[_0xe816('0x12')](util[_0xe816('0x13')](_0xe816('0x35'),_0x4b3813[_0xe816('0x1a')],_0x4b3813['calleridname'],_0x4b3813[_0xe816('0x1e')],_0x4b3813[_0xe816('0x1b')],_0x4b3813[_0xe816('0x1c')]));_0x4b3813['on'](_0xe816('0xe'),errorHandler);_0x4b3813['on'](_0xe816('0x36'),closeHandler);_0x4b3813['on']('timeout',timeoutHandler);_0x4b3813[_0xe816('0x1f')]=![];_0x4b3813['on']('hangup',hangupHandler);var _0x4a469e=getSquareProject[_0xe816('0x37')](null,_0x4b3813[_0xe816('0x1a')]);if(_0x4a469e){if(_0x4a469e['production']){_0x28c1a8=getRoot(_0x4a469e['production']);if(_0x28c1a8&&_0x28c1a8[_0xe816('0x38')]){logger[_0xe816('0x33')]('root',JSON['stringify'](_0x28c1a8,null,0x2));_0x4b3813[_0xe816('0x39')]=moment()[_0xe816('0x13')](_0xe816('0x3a'));_0x188cdb=initGraph(_['omit'](_0x28c1a8,'mxCell'),_0x28c1a8[_0xe816('0x27')]);_0x255a09=new Vertices(_0x4b3813,rpc,mailRpc);logger[_0xe816('0x12')](util[_0xe816('0x13')](_0xe816('0x3b'),_0x4b3813[_0xe816('0x1a')],_0x4b3813['calleridname'],_0x4b3813[_0xe816('0x1e')],_0x4b3813[_0xe816('0x1b')],_0x4b3813[_0xe816('0x1c')]));_0x188cdb[_0xe816('0x3c')](_0x28c1a8[_0xe816('0x38')]['id'],function(_0xa1e8a9){try{_0xa1e8a9=_0x255a09[_0xe816('0x3d')](_0xa1e8a9);logger['debug'](_0xe816('0x3e'),JSON[_0xe816('0x34')](_0xa1e8a9,null,0x2));if(_0xa1e8a9[_0xe816('0x3f')]===_0xe816('0x40')){logger[_0xe816('0x12')](_0xe816('0x41'));_0x4b3813[_0xe816('0x42')]=_0xa1e8a9[_0xe816('0x42')]||_0x4b3813[_0xe816('0x42')];_0x4b3813['extension']=_0xa1e8a9[_0xe816('0x43')];_0x4b3813['priority']=_0xa1e8a9[_0xe816('0x44')]?_0xa1e8a9['priority']-0x1:0x1;return null;}else if(_0xa1e8a9&&_0x255a09[_0xa1e8a9['agicommand']]){_0x1f369c=_0x255a09[_0xa1e8a9[_0xe816('0x3f')]](_0xa1e8a9);logger[_0xe816('0x12')](_0xe816('0x45'),JSON[_0xe816('0x34')](_0x1f369c,null,0x2));if(_0x1f369c&&_0x1f369c['code']===AGI_CODE_SUCCESS&&_0x1f369c[_0xe816('0x46')]!==AGI_RESULT_ERROR&&!_0x4b3813[_0xe816('0x1f')]){logger[_0xe816('0x33')](_0xe816('0x45'),getLogFromObject(_0x1f369c));return _[_0xe816('0x47')](_0x1f369c[_0xe816('0x46')])?null:_0x1f369c[_0xe816('0x46')][_0xe816('0x48')]();}else{logger[_0xe816('0xe')](_0xe816('0x45'),getLogFromObject(_0x1f369c));return null;}}else{logger[_0xe816('0xe')](_0xe816('0x49'));return null;}}catch(_0x15e284){logger[_0xe816('0xe')](_0x15e284['stack']);return null;}});if(_0x28c1a8[_0xe816('0x4a')]){logger[_0xe816('0x12')](util['format'](_0xe816('0x4b'),_0x4b3813['arg_1'],_0x4b3813[_0xe816('0x1d')],_0x4b3813[_0xe816('0x1e')],_0x4b3813['dnid'],_0x4b3813[_0xe816('0x1c')]));_0x188cdb[_0xe816('0x3c')](_0x28c1a8[_0xe816('0x4a')]['id'],function(_0x3741e6){try{_0x3741e6=_0x255a09[_0xe816('0x3d')](_0x3741e6);logger[_0xe816('0x33')]('vertex',JSON[_0xe816('0x34')](_0x3741e6,null,0x2));if(_0x3741e6&&_0x255a09[_0x3741e6[_0xe816('0x3f')]]){_0x1f369c=_0x255a09[_0x3741e6[_0xe816('0x3f')]](_0x3741e6);if(_0x1f369c){logger['debug']('response',getLogFromObject(_0x1f369c));return _[_0xe816('0x47')](_0x1f369c[_0xe816('0x46')])?null:_0x1f369c[_0xe816('0x46')]['toString']();}else{logger[_0xe816('0xe')]('response',getLogFromObject(_0x1f369c));return null;}}else{logger[_0xe816('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x41fc98){logger['error'](_0x41fc98[_0xe816('0xf')]);return null;}});}logger[_0xe816('0x12')](util['format'](_0xe816('0x4c'),_0x4b3813[_0xe816('0x1a')],_0x4b3813['calleridname'],_0x4b3813['callerid'],_0x4b3813[_0xe816('0x1b')],_0x4b3813[_0xe816('0x1c')]));logger[_0xe816('0x12')](util[_0xe816('0x13')](_0xe816('0x4d'),_0x4b3813[_0xe816('0x42')],_0x4b3813[_0xe816('0x43')],parseInt(_0x4b3813[_0xe816('0x44')],0xa)+0x1));_0x4b3813[_0xe816('0x4e')](_0x4b3813[_0xe816('0x42')],_0x4b3813[_0xe816('0x43')],parseInt(_0x4b3813[_0xe816('0x44')],0xa)+0x1);_0x4b3813[_0xe816('0x36')]();}}else{logger[_0xe816('0xe')](util[_0xe816('0x13')](_0xe816('0x4f'),_0x4b3813[_0xe816('0x1a')]));_0x4b3813[_0xe816('0x4e')](_0x4b3813['context'],_0x4b3813[_0xe816('0x43')],parseInt(_0x4b3813[_0xe816('0x44')],0xa)+0x1);_0x4b3813[_0xe816('0x36')]();}}else{logger['error'](util['format'](_0xe816('0x50'),_0x4b3813[_0xe816('0x1a')]));_0x4b3813['continueAt'](_0x4b3813['context'],_0x4b3813['extension'],parseInt(_0x4b3813['priority'],0xa)+0x1);_0x4b3813['close']();}}function main(){var _0x2e8ef6;return utilLicense[_0xe816('0x51')]()[_0xe816('0x2c')](function(_0x2b7721){if(_0x2b7721){if(_0x2b7721[_0xe816('0x52')]){if(_0x2b7721[_0xe816('0x53')]&&_0x2b7721['callysquare']>0x0){logger['info'](util[_0xe816('0x13')](_0xe816('0x54'),_0x2b7721[_0xe816('0x53')]));_0x2e8ef6=_0x2b7721['callysquare'];}else{logger['info'](_0xe816('0x55'));}}else{logger[_0xe816('0x12')](_0xe816('0x56'));_0x2e8ef6=-0x1;}}})[_0xe816('0x2e')](function(_0x1ad5a3){logger[_0xe816('0xe')](_0xe816('0x57'),_0x1ad5a3[_0xe816('0xf')]);})[_0xe816('0x4a')](function(){var _0x58e2de=require(_0xe816('0x58'))(config[_0xe816('0xa')][_0xe816('0x11')],config['agi']['ip'],_0x2e8ef6);_0x58e2de['on']('error',errorHandler);_0x58e2de['on'](_0xe816('0x59'),listeningHandler);_0x58e2de['on'](_0xe816('0x5a'),connectionHandler);_0x58e2de['on'](_0xe816('0x36'),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 ae33453..770af1d 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 _0x52d3=['sendMailMessage','jayson/promise','client','http','request','then','error','message','result'];(function(_0x35d06a,_0x81abc0){var _0x3cf8a5=function(_0x2693f){while(--_0x2693f){_0x35d06a['push'](_0x35d06a['shift']());}};_0x3cf8a5(++_0x81abc0);}(_0x52d3,0x1a8));var _0x352d=function(_0x3c1fa3,_0x508676){_0x3c1fa3=_0x3c1fa3-0x0;var _0x39b034=_0x52d3[_0x3c1fa3];return _0x39b034;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x352d('0x0'));var client=jayson[_0x352d('0x1')][_0x352d('0x2')]({'port':0x232b});function request(_0x421187,_0x41d6c0){return new BPromise(function(_0x5e1397,_0x4da045){return client[_0x352d('0x3')](_0x421187,_0x41d6c0)[_0x352d('0x4')](function(_0x482257){if(_0x482257[_0x352d('0x5')]){return _0x4da045(_0x482257[_0x352d('0x5')][_0x352d('0x6')]);}else{return _0x5e1397(_0x482257[_0x352d('0x7')]);}})['catch'](function(_0x258568){return _0x4da045(_0x258568);});});}exports[_0x352d('0x8')]=function(_0x166da0,_0xe9a2ef){return request('SendMail',{'account':_0x166da0,'message':_0xe9a2ef});}; \ No newline at end of file +var _0x5170=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5170,0x1a7));var _0x0517=function(_0x54377b,_0x2f06e5){_0x54377b=_0x54377b-0x0;var _0x35ec2a=_0x5170[_0x54377b];return _0x35ec2a;};'use strict';var BPromise=require(_0x0517('0x0'));var jayson=require(_0x0517('0x1'));var client=jayson[_0x0517('0x2')][_0x0517('0x3')]({'port':0x232b});function request(_0x3801ea,_0x5d4fe0){return new BPromise(function(_0x540341,_0x20c920){return client[_0x0517('0x4')](_0x3801ea,_0x5d4fe0)[_0x0517('0x5')](function(_0x353d4b){if(_0x353d4b[_0x0517('0x6')]){return _0x20c920(_0x353d4b[_0x0517('0x6')][_0x0517('0x7')]);}else{return _0x540341(_0x353d4b[_0x0517('0x8')]);}})[_0x0517('0x9')](function(_0x256f18){return _0x20c920(_0x256f18);});});}exports[_0x0517('0xa')]=function(_0x47c9ab,_0x302d0f){return request(_0x0517('0xb'),{'account':_0x47c9ab,'message':_0x302d0f});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 4c678d7..4db16a2 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 _0x5e65=['substring','length','split','slice','trim','emit','headers','exports','util','_localBuffer','inherits','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf'];(function(_0x2bb30a,_0x13c669){var _0x1d0ae8=function(_0x3083b5){while(--_0x3083b5){_0x2bb30a['push'](_0x2bb30a['shift']());}};_0x1d0ae8(++_0x13c669);}(_0x5e65,0x152));var _0x55e6=function(_0x1d16e8,_0xcc4b08){_0x1d16e8=_0x1d16e8-0x0;var _0xeb1321=_0x5e65[_0x1d16e8];return _0xeb1321;};'use strict';var util=require(_0x55e6('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0xbbaa87){Transform['call'](this,_0xbbaa87);this[_0x55e6('0x1')]='';this['_inBody']=![];}util[_0x55e6('0x2')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x44da02,_0x29950c,_0x70cd2f){var _0x2e4a86='\x0a',_0x1ac851=['\x0a\x0a',_0x55e6('0x3')],_0x4e2707=-0x1,_0x347488=-0x1,_0x4e5a46='',_0x5e0895=0x0,_0x4dd854='',_0x41cd76='';this[_0x55e6('0x1')]+=_0x44da02[_0x55e6('0x4')]();_0x4dd854=this['_localBuffer'];if(!this[_0x55e6('0x5')]){_0x5e0895=0x0;while(_0x1ac851[_0x5e0895]){while((_0x347488=_0x4dd854[_0x55e6('0x6')](_0x1ac851[_0x5e0895]))!=-0x1){_0x4e5a46=_0x1ac851[_0x5e0895];_0x41cd76=_0x4dd854[_0x55e6('0x7')](0x0,_0x347488);_0x4dd854=_0x4dd854[_0x55e6('0x7')](_0x347488+_0x4e5a46[_0x55e6('0x8')]);var _0x219b3b=_0x41cd76[_0x55e6('0x9')](_0x2e4a86),_0x591a77=0x0,_0x43d369={},_0x4d6c07='',_0x530246='',_0x5e0e02=-0x1;while(_0x219b3b[_0x591a77]){_0x5e0e02=_0x219b3b[_0x591a77][_0x55e6('0x6')](':');if(_0x5e0e02!=-0x1){_0x4d6c07=_0x219b3b[_0x591a77][_0x55e6('0xa')](0x0,_0x5e0e02)[_0x55e6('0xb')]();_0x530246=_0x219b3b[_0x591a77][_0x55e6('0xa')](_0x5e0e02+0x1)['trim']();if(_0x4d6c07[_0x55e6('0x8')]>0x0){_0x43d369[_0x4d6c07]=_0x530246;}}else{}_0x591a77++;}this[_0x55e6('0xc')](_0x55e6('0xd'),_0x43d369);this[_0x55e6('0x5')]=!![];}_0x5e0895++;}this[_0x55e6('0x1')]=_0x4dd854;}else{while((_0x4e2707=_0x4dd854['indexOf'](_0x2e4a86))!=-0x1){_0x41cd76=_0x4dd854[_0x55e6('0x7')](0x0,_0x4e2707);this[_0x55e6('0xc')]('line',_0x41cd76);_0x4dd854=_0x4dd854[_0x55e6('0x7')](_0x4e2707+_0x2e4a86[_0x55e6('0x8')]);}this['_localBuffer']=_0x4dd854;}_0x70cd2f();};module[_0x55e6('0xe')]=AGIReply; \ No newline at end of file +var _0x75b0=['call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','line','exports','stream','Transform'];(function(_0x280d3c,_0x54f132){var _0x81dbab=function(_0x23ee60){while(--_0x23ee60){_0x280d3c['push'](_0x280d3c['shift']());}};_0x81dbab(++_0x54f132);}(_0x75b0,0xe8));var _0x075b=function(_0x34c56f,_0x599298){_0x34c56f=_0x34c56f-0x0;var _0x20d25c=_0x75b0[_0x34c56f];return _0x20d25c;};'use strict';var util=require('util');var Transform=require(_0x075b('0x0'))[_0x075b('0x1')];function AGIReply(_0x4d03ad){Transform[_0x075b('0x2')](this,_0x4d03ad);this[_0x075b('0x3')]='';this[_0x075b('0x4')]=![];}util[_0x075b('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x075b('0x6')]=function(_0x17914d,_0x1637d8,_0x5b1f91){var _0x575dbd='\x0a',_0x44eac1=['\x0a\x0a',_0x075b('0x7')],_0x521bbe=-0x1,_0x130b10=-0x1,_0x2febc9='',_0x60df11=0x0,_0x91a69b='',_0x3f3068='';this[_0x075b('0x3')]+=_0x17914d[_0x075b('0x8')]();_0x91a69b=this[_0x075b('0x3')];if(!this[_0x075b('0x4')]){_0x60df11=0x0;while(_0x44eac1[_0x60df11]){while((_0x130b10=_0x91a69b['indexOf'](_0x44eac1[_0x60df11]))!=-0x1){_0x2febc9=_0x44eac1[_0x60df11];_0x3f3068=_0x91a69b['substring'](0x0,_0x130b10);_0x91a69b=_0x91a69b[_0x075b('0x9')](_0x130b10+_0x2febc9[_0x075b('0xa')]);var _0x4057cf=_0x3f3068[_0x075b('0xb')](_0x575dbd),_0x4d48fd=0x0,_0x4ace4e={},_0x4ba02c='',_0xe320bc='',_0x59738e=-0x1;while(_0x4057cf[_0x4d48fd]){_0x59738e=_0x4057cf[_0x4d48fd][_0x075b('0xc')](':');if(_0x59738e!=-0x1){_0x4ba02c=_0x4057cf[_0x4d48fd][_0x075b('0xd')](0x0,_0x59738e)['trim']();_0xe320bc=_0x4057cf[_0x4d48fd][_0x075b('0xd')](_0x59738e+0x1)[_0x075b('0xe')]();if(_0x4ba02c[_0x075b('0xa')]>0x0){_0x4ace4e[_0x4ba02c]=_0xe320bc;}}else{}_0x4d48fd++;}this[_0x075b('0xf')]('headers',_0x4ace4e);this[_0x075b('0x4')]=!![];}_0x60df11++;}this['_localBuffer']=_0x91a69b;}else{while((_0x521bbe=_0x91a69b[_0x075b('0xc')](_0x575dbd))!=-0x1){_0x3f3068=_0x91a69b[_0x075b('0x9')](0x0,_0x521bbe);this[_0x075b('0xf')](_0x075b('0x10'),_0x3f3068);_0x91a69b=_0x91a69b['substring'](_0x521bbe+_0x575dbd[_0x075b('0xa')]);}this[_0x075b('0x3')]=_0x91a69b;}_0x5b1f91();};module[_0x075b('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 9e49be4..83b59a9 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 _0x34f8=['CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','request','then','message','result','catch','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport'];(function(_0x4e4423,_0x530265){var _0x466c57=function(_0x1433f){while(--_0x1433f){_0x4e4423['push'](_0x4e4423['shift']());}};_0x466c57(++_0x530265);}(_0x34f8,0x80));var _0x834f=function(_0x29e2ba,_0x1b171f){_0x29e2ba=_0x29e2ba-0x0;var _0x5c5920=_0x34f8[_0x29e2ba];return _0x5c5920;};'use strict';var BPromise=require(_0x834f('0x0'));var moment=require(_0x834f('0x1'));var _=require(_0x834f('0x2'));var util=require(_0x834f('0x3'));var jayson=require(_0x834f('0x4'));var client=jayson['client']['http']({'port':0x2329});function request(_0xe34aa5,_0x92264b){return new BPromise(function(_0x4d23b1,_0x4652f9){return client[_0x834f('0x5')](_0xe34aa5,_0x92264b)[_0x834f('0x6')](function(_0x3498dd){if(_0x3498dd['error']){return _0x4652f9(_0x3498dd['error'][_0x834f('0x7')]);}else{return _0x4d23b1(_0x3498dd[_0x834f('0x8')]);}})[_0x834f('0x9')](function(_0x436eb3){return _0x4652f9(_0x436eb3);});});}exports['getSquareProject']=function(_0x4210cf){return request(_0x834f('0xa'),{'options':{'raw':![],'where':{'name':_0x4210cf},'attributes':['production']}});};exports[_0x834f('0xb')]=function(_0x353699){return request(_0x834f('0xc'),{'options':{'raw':![],'where':{'id':_0x353699},'include':[{'model':_0x834f('0xd'),'as':_0x834f('0xe')}],'attributes':['id',_0x834f('0xf'),_0x834f('0x10')]}});};exports[_0x834f('0x11')]=function(_0x4f919a){return request(_0x834f('0xa'),{'options':{'where':{'id':_0x4f919a},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x12')]=function(_0xda9f2d){return request(_0x834f('0x13'),{'options':{'where':{'id':_0xda9f2d},'attributes':['name']}});};exports[_0x834f('0x14')]=function(_0x2f8592){return request('ShowVariable',{'options':{'where':{'id':_0x2f8592},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x15')]=function(_0x55bc81){return request(_0x834f('0x16'),{'options':{'where':{'id':_0x55bc81},'attributes':['dsn']}});};exports[_0x834f('0x17')]=function(_0x438187){return request(_0x834f('0x18'),{'options':{'where':{'id':_0x438187},'attributes':[_0x834f('0xf')]}});};exports['getContactByPhone']=function(_0x58154d){return request(_0x834f('0x19'),{'options':{'where':{'phone':_0x58154d[_0x834f('0x1a')]},'attributes':['id']}});};exports[_0x834f('0x1b')]=function(_0x320ee2){return request('ShowTrunk',{'options':{'where':{'id':_0x320ee2},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x1c')]=function(_0x29cccd){return request('ShowSound',{'options':{'where':{'id':_0x29cccd},'attributes':['save_name']}});};exports[_0x834f('0x1d')]=function(_0x5535e9){return request(_0x834f('0x1e'),{'options':{'raw':![],'where':{'id':_0x5535e9},'include':[{'model':_0x834f('0x1f'),'as':'Intervals'}]}});};exports[_0x834f('0x20')]=function(_0x5e4fa2){return request(_0x834f('0x21'),{'options':{'where':{'id':_0x5e4fa2},'attributes':['id',_0x834f('0xf')]}});};exports[_0x834f('0x22')]=function(_0x24cf5d){return request('CreateSmsMessage',{'body':_0x24cf5d});};exports[_0x834f('0x23')]=function(_0x4f62c8){return request(_0x834f('0x24'),{'body':_0x4f62c8});};exports['createSquareReport']=function(_0x536907){return request(_0x834f('0x25'),{'body':_['merge'](_0x536907,{'project_name':_0x536907['arg_1'],'prev_project_name':_0x536907['arg_2']||'','is_subproject':_0x536907[_0x834f('0x26')]?!![]:![],'leaveAt':moment()[_0x834f('0x27')](_0x834f('0x28'))})});};exports[_0x834f('0x29')]=function(_0x44355b){return request(_0x834f('0x2a'),{'body':_0x44355b});};exports[_0x834f('0x2b')]=function(_0x139495){return request(_0x834f('0x2c'),{'body':_0x139495});};exports[_0x834f('0x2d')]=function(_0x2338de){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2338de[_0x834f('0x1a')],'ListId':_0x2338de[_0x834f('0x2e')]}}})[_0x834f('0x6')](function(_0x586324){if(_0x586324){return _0x586324;}return request(_0x834f('0x2f'),{'body':_0x2338de});});};exports[_0x834f('0x30')]=function(_0x20da2d){return request(_0x834f('0x31'),{'options':{'where':{'id':_0x20da2d},'attributes':['name']}});};exports[_0x834f('0x32')]=function(_0x2a68b1,_0xd411e){return request(_0x834f('0x33'),{'body':{'interface':_0xd411e},'options':{'where':_0x2a68b1}});};exports['agentPause']=function(_0x3fc0ef,_0x345acc,_0x55d4af){return request(_0x834f('0x34'),{'body':{'type':_0x345acc,'uniqueid':_0x55d4af},'options':{'where':_0x3fc0ef}});};exports['agentUnpause']=function(_0x38f165){return request(_0x834f('0x35'),{'body':{},'options':{'where':_0x38f165}});};exports['agentLogout']=function(_0x456a78){return request(_0x834f('0x36'),{'body':{},'options':{'where':_0x456a78}});}; \ No newline at end of file +var _0x303a=['agentUnpause','agentLogout','LogoutUser','bluebird','lodash','util','jayson/promise','client','request','then','error','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser'];(function(_0x52264b,_0x13e49e){var _0x5b6391=function(_0x447b84){while(--_0x447b84){_0x52264b['push'](_0x52264b['shift']());}};_0x5b6391(++_0x13e49e);}(_0x303a,0x1a0));var _0xa303=function(_0x5d4600,_0x2c572f){_0x5d4600=_0x5d4600-0x0;var _0x5e71ef=_0x303a[_0x5d4600];return _0x5e71ef;};'use strict';var BPromise=require(_0xa303('0x0'));var moment=require('moment');var _=require(_0xa303('0x1'));var util=require(_0xa303('0x2'));var jayson=require(_0xa303('0x3'));var client=jayson[_0xa303('0x4')]['http']({'port':0x2329});function request(_0x46c56b,_0x26b47c){return new BPromise(function(_0x38a354,_0x217275){return client[_0xa303('0x5')](_0x46c56b,_0x26b47c)[_0xa303('0x6')](function(_0x2bc3d7){if(_0x2bc3d7[_0xa303('0x7')]){return _0x217275(_0x2bc3d7[_0xa303('0x7')]['message']);}else{return _0x38a354(_0x2bc3d7['result']);}})['catch'](function(_0x9142e7){return _0x217275(_0x9142e7);});});}exports[_0xa303('0x8')]=function(_0x5e2e48){return request(_0xa303('0x9'),{'options':{'raw':![],'where':{'name':_0x5e2e48},'attributes':['production']}});};exports[_0xa303('0xa')]=function(_0x59f18a){return request(_0xa303('0xb'),{'options':{'raw':![],'where':{'id':_0x59f18a},'include':[{'model':_0xa303('0xc'),'as':_0xa303('0xd')}],'attributes':['id',_0xa303('0xe'),'email']}});};exports[_0xa303('0xf')]=function(_0x4c0169){return request(_0xa303('0x9'),{'options':{'where':{'id':_0x4c0169},'attributes':[_0xa303('0xe')]}});};exports[_0xa303('0x10')]=function(_0x5b530d){return request(_0xa303('0x11'),{'options':{'where':{'id':_0x5b530d},'attributes':[_0xa303('0xe')]}});};exports[_0xa303('0x12')]=function(_0xfa522c){return request(_0xa303('0x13'),{'options':{'where':{'id':_0xfa522c},'attributes':[_0xa303('0xe')]}});};exports[_0xa303('0x14')]=function(_0x2d1110){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2d1110},'attributes':[_0xa303('0x15')]}});};exports[_0xa303('0x16')]=function(_0x1f3ede){return request(_0xa303('0x17'),{'options':{'where':{'id':_0x1f3ede},'attributes':[_0xa303('0xe')]}});};exports[_0xa303('0x18')]=function(_0x5ec243){return request(_0xa303('0x19'),{'options':{'where':{'phone':_0x5ec243['phone']},'attributes':['id']}});};exports[_0xa303('0x1a')]=function(_0x4cf535){return request(_0xa303('0x1b'),{'options':{'where':{'id':_0x4cf535},'attributes':['name']}});};exports[_0xa303('0x1c')]=function(_0xe263f9){return request(_0xa303('0x1d'),{'options':{'where':{'id':_0xe263f9},'attributes':['save_name']}});};exports[_0xa303('0x1e')]=function(_0x188cb6){return request(_0xa303('0x1f'),{'options':{'raw':![],'where':{'id':_0x188cb6},'include':[{'model':'Interval','as':_0xa303('0x20')}]}});};exports[_0xa303('0x21')]=function(_0x21deee){return request(_0xa303('0x22'),{'options':{'where':{'id':_0x21deee},'attributes':['id','name']}});};exports[_0xa303('0x23')]=function(_0x2a2512){return request('CreateSmsMessage',{'body':_0x2a2512});};exports[_0xa303('0x24')]=function(_0x27c1d7){return request(_0xa303('0x25'),{'body':_0x27c1d7});};exports[_0xa303('0x26')]=function(_0x65ab0e){return request(_0xa303('0x27'),{'body':_[_0xa303('0x28')](_0x65ab0e,{'project_name':_0x65ab0e[_0xa303('0x29')],'prev_project_name':_0x65ab0e[_0xa303('0x2a')]||'','is_subproject':_0x65ab0e['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x5da2d2){return request(_0xa303('0x2b'),{'body':_0x5da2d2});};exports[_0xa303('0x2c')]=function(_0x3680fb){return request(_0xa303('0x2d'),{'body':_0x3680fb});};exports[_0xa303('0x2e')]=function(_0x48e79f){return request(_0xa303('0x2f'),{'options':{'raw':![],'where':{'phone':_0x48e79f[_0xa303('0x30')],'ListId':_0x48e79f['ListId']}}})[_0xa303('0x6')](function(_0xef04b){if(_0xef04b){return _0xef04b;}return request(_0xa303('0x31'),{'body':_0x48e79f});});};exports[_0xa303('0x32')]=function(_0x3c85de){return request(_0xa303('0x33'),{'options':{'where':{'id':_0x3c85de},'attributes':[_0xa303('0xe')]}});};exports[_0xa303('0x34')]=function(_0x411b42,_0x3383f4){return request(_0xa303('0x35'),{'body':{'interface':_0x3383f4},'options':{'where':_0x411b42}});};exports[_0xa303('0x36')]=function(_0x2f7775,_0x1a44fc,_0x35e324){return request(_0xa303('0x37'),{'body':{'type':_0x1a44fc,'uniqueid':_0x35e324},'options':{'where':_0x2f7775}});};exports[_0xa303('0x38')]=function(_0x5de180){return request('UnpauseUser',{'body':{},'options':{'where':_0x5de180}});};exports[_0xa303('0x39')]=function(_0x37cda6){return request(_0xa303('0x3a'),{'body':{},'options':{'where':_0x37cda6}});}; \ 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 e5d2c47..943dc2b 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 _0xc319=['./lex','exports','./polly'];(function(_0x15d409,_0x16c2ee){var _0x379106=function(_0x3ab526){while(--_0x3ab526){_0x15d409['push'](_0x15d409['shift']());}};_0x379106(++_0x16c2ee);}(_0xc319,0x12e));var _0x9c31=function(_0x5e589f,_0x30c06f){_0x5e589f=_0x5e589f-0x0;var _0x3e6d35=_0xc319[_0x5e589f];return _0x3e6d35;};var polly=require(_0x9c31('0x0'));var lex=require(_0x9c31('0x1'));module[_0x9c31('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xdc86=['./lex'];(function(_0x3647d3,_0x4c6857){var _0x557f88=function(_0x57efb7){while(--_0x57efb7){_0x3647d3['push'](_0x3647d3['shift']());}};_0x557f88(++_0x4c6857);}(_0xdc86,0x118));var _0x6dc8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xdc86[_0x31a371];return _0x2a5bd6;};var polly=require('./polly');var lex=require(_0x6dc8('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1ae8a3c..a968403 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 _0x4483=['exports','./lib/api'];(function(_0x281ec2,_0x27257c){var _0x2ea8d5=function(_0x196fae){while(--_0x196fae){_0x281ec2['push'](_0x281ec2['shift']());}};_0x2ea8d5(++_0x27257c);}(_0x4483,0x1a3));var _0x3448=function(_0x2c9bc9,_0x9797d3){_0x2c9bc9=_0x2c9bc9-0x0;var _0x652fc3=_0x4483[_0x2c9bc9];return _0x652fc3;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0x55e0=['./lib/api','exports'];(function(_0x272ce4,_0xcc9405){var _0x2d3aaa=function(_0x43bf19){while(--_0x43bf19){_0x272ce4['push'](_0x272ce4['shift']());}};_0x2d3aaa(++_0xcc9405);}(_0x55e0,0xdc));var _0x055e=function(_0x394939,_0xc426dd){_0x394939=_0x394939-0x0;var _0x335251=_0x55e0[_0x394939];return _0x335251;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ 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 7a3d50b..3c96e2a 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(_0xe60d50,_0x1fb66d){var _0x789475=function(_0x334e9d){while(--_0x334e9d){_0xe60d50['push'](_0xe60d50['shift']());}};_0x789475(++_0x1fb66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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(_0x37bd34,_0x3c1983){var _0x4abdb3=function(_0x2912a3){while(--_0x2912a3){_0x37bd34['push'](_0x37bd34['shift']());}};_0x4abdb3(++_0x3c1983);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 e7b6806..ab1d7d8 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 _0xa854=['exports'];(function(_0x2e2ee0,_0x4497e4){var _0x1d04a6=function(_0x71dabe){while(--_0x71dabe){_0x2e2ee0['push'](_0x2e2ee0['shift']());}};_0x1d04a6(++_0x4497e4);}(_0xa854,0xfc));var _0x4a85=function(_0x1dcf64,_0x387af5){_0x1dcf64=_0x1dcf64-0x0;var _0x13b700=_0xa854[_0x1dcf64];return _0x13b700;};'use strict';var polly=require('./lib/api');module[_0x4a85('0x0')]=function(_0x401b73,_0x55b5d4,_0x3b1c92,_0xc0a9ec,_0x126204,_0x2eddae,_0x365a2b){return polly(_0x401b73,_0x55b5d4,_0x3b1c92,_0xc0a9ec,_0x126204,_0x2eddae,_0x365a2b);}; \ No newline at end of file +var _0xb05a=['exports'];(function(_0x3804d6,_0x440bb8){var _0x5e7d4d=function(_0x513616){while(--_0x513616){_0x3804d6['push'](_0x3804d6['shift']());}};_0x5e7d4d(++_0x440bb8);}(_0xb05a,0x8a));var _0xab05=function(_0x4d12c0,_0x19f3af){_0x4d12c0=_0x4d12c0-0x0;var _0x216508=_0xb05a[_0x4d12c0];return _0x216508;};'use strict';var polly=require('./lib/api');module[_0xab05('0x0')]=function(_0x349ee3,_0xbadbbd,_0x1de958,_0xf3a3e,_0x3904c9,_0x2532ea,_0x579fb3){return polly(_0x349ee3,_0xbadbbd,_0x1de958,_0xf3a3e,_0x3904c9,_0x2532ea,_0x579fb3);}; \ 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 bea77e0..e4671d3 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 _0x5bc6=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5bc6,0x9a));var _0x65bc=function(_0x5e566c,_0x2ff6cc){_0x5e566c=_0x5e566c-0x0;var _0x416b06=_0x5bc6[_0x5e566c];return _0x416b06;};'use strict';var fs=require('fs');var path=require(_0x65bc('0x0'));var BPromise=require(_0x65bc('0x1'));var rs=require('randomstring');var AWS=require(_0x65bc('0x2'));function pollyResult(_0x35096c,_0xfd78db,_0x2c5f58){return new BPromise(function(_0x178ba6,_0x3dcfc8){_0x35096c[_0x65bc('0x3')](_0xfd78db,function(_0x4885e6,_0x1df563){if(_0x4885e6){_0x3dcfc8(_0x4885e6);}else if(_0x1df563){if(_0x1df563[_0x65bc('0x4')]instanceof Buffer){fs[_0x65bc('0x5')](_0x2c5f58,_0x1df563['AudioStream'],function(_0x54c1e6){if(_0x54c1e6){_0x3dcfc8(_0x54c1e6);}else{_0x178ba6();}});}else{_0x3dcfc8(new Error(_0x65bc('0x6')));}}else{_0x3dcfc8(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x65bc('0x7')]=function(_0x10dd9c,_0x3e533b,_0x1eb235,_0x34faaa,_0x4d2a13,_0x118d74,_0x1fdaa5){var _0x4ad176=new AWS[(_0x65bc('0x8'))]({'accessKeyId':_0x10dd9c,'secretAccessKey':_0x3e533b,'region':_0x1eb235});var _0x47fe6d={'Text':_0x4d2a13,'TextType':_0x118d74||_0x65bc('0x9'),'OutputFormat':'mp3','VoiceId':_0x34faaa};return pollyResult(_0x4ad176,_0x47fe6d,_0x1fdaa5);}; \ No newline at end of file +var _0xb25d=['path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x203437,_0x2202c8){var _0x3b9557=function(_0xc69066){while(--_0xc69066){_0x203437['push'](_0x203437['shift']());}};_0x3b9557(++_0x2202c8);}(_0xb25d,0x82));var _0xdb25=function(_0x36eeff,_0x228d2f){_0x36eeff=_0x36eeff-0x0;var _0x4e1bc5=_0xb25d[_0x36eeff];return _0x4e1bc5;};'use strict';var fs=require('fs');var path=require(_0xdb25('0x0'));var BPromise=require('bluebird');var rs=require(_0xdb25('0x1'));var AWS=require(_0xdb25('0x2'));function pollyResult(_0x436876,_0x400228,_0x9bb581){return new BPromise(function(_0x302a21,_0x2590ec){_0x436876[_0xdb25('0x3')](_0x400228,function(_0x1dd571,_0x38fef1){if(_0x1dd571){_0x2590ec(_0x1dd571);}else if(_0x38fef1){if(_0x38fef1[_0xdb25('0x4')]instanceof Buffer){fs['writeFile'](_0x9bb581,_0x38fef1[_0xdb25('0x4')],function(_0x350424){if(_0x350424){_0x2590ec(_0x350424);}else{_0x302a21();}});}else{_0x2590ec(new Error(_0xdb25('0x5')));}}else{_0x2590ec(new Error(_0xdb25('0x6')));}});});}module[_0xdb25('0x7')]=function(_0x2f5384,_0x1436ca,_0x4e4086,_0x962a95,_0x40dd78,_0x519f93,_0x35d41b){var _0x41100d=new AWS[(_0xdb25('0x8'))]({'accessKeyId':_0x2f5384,'secretAccessKey':_0x1436ca,'region':_0x4e4086});var _0x2b5a07={'Text':_0x40dd78,'TextType':_0x519f93||_0xdb25('0x9'),'OutputFormat':'mp3','VoiceId':_0x962a95};return pollyResult(_0x41100d,_0x2b5a07,_0x35d41b);}; \ 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 f438386..73cde3c 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 _0x0155=['./lib/api','exports'];(function(_0x375bbc,_0x26b3e8){var _0x4a2f03=function(_0x331db4){while(--_0x331db4){_0x375bbc['push'](_0x375bbc['shift']());}};_0x4a2f03(++_0x26b3e8);}(_0x0155,0x10a));var _0x5015=function(_0x180791,_0x4ec373){_0x180791=_0x180791-0x0;var _0x1dc7d7=_0x0155[_0x180791];return _0x1dc7d7;};'use strict';var asr=require(_0x5015('0x0'));module[_0x5015('0x1')]=function(_0x5274e2,_0x5e3502,_0x5a3251,_0x36bd3a){return asr(_0x5274e2,_0x5e3502,_0x5a3251);}; \ No newline at end of file +var _0x802f=['./lib/api'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x802f,0x1ee));var _0xf802=function(_0x29276c,_0x2e6cf8){_0x29276c=_0x29276c-0x0;var _0x2e82f9=_0x802f[_0x29276c];return _0x2e82f9;};'use strict';var asr=require(_0xf802('0x0'));module['exports']=function(_0x15fda5,_0x364dbf,_0x4891a8,_0x3211e2){return asr(_0x15fda5,_0x364dbf,_0x4891a8);}; \ 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 50b36df..c3cdf0f 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 _0xadb8=['key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xadb8,0x1d0));var _0x8adb=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xadb8[_0x810e4d];return _0x13f01c;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x8adb('0x0');module['exports']=function(_0x2b8a76,_0x2a0b30,_0x24f912){return new BPromise(function(_0x1bf88c,_0x44fdf7){var _0x2baedb;if(typeof _0x2b8a76!==_0x8adb('0x1')||_0x2b8a76['length']===0x0){return _0x44fdf7(_0x8adb('0x2'));}if(typeof _0x2a0b30!==_0x8adb('0x1')||_0x2a0b30[_0x8adb('0x3')]===0x0){return _0x44fdf7(_0x8adb('0x4'));}if(typeof _0x24f912!==_0x8adb('0x5')&&(typeof _0x24f912!==_0x8adb('0x1')||_0x24f912[_0x8adb('0x3')]===0x0)){return _0x44fdf7('lang\x20should\x20be\x20a\x20string');}try{_0x2baedb=fs['readFileSync'](_0x2b8a76)['toString'](_0x8adb('0x6'));}catch(_0x5be2f4){return _0x44fdf7(_0x5be2f4);}return _0x1bf88c({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x2a0b30,'body':{'config':{'encoding':_0x8adb('0x7'),'sampleRateHertz':_0x8adb('0x8'),'languageCode':_0x24f912},'audio':{'content':_0x2baedb}},'json':!![]});});}; \ No newline at end of file +var _0x1b73=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x1b73,0x1d5));var _0x31b7=function(_0x4647a7,_0x2cd7b4){_0x4647a7=_0x4647a7-0x0;var _0x198dda=_0x1b73[_0x4647a7];return _0x198dda;};'use strict';var url=require('url');var BPromise=require(_0x31b7('0x0'));var fs=require('fs');var host=_0x31b7('0x1');module[_0x31b7('0x2')]=function(_0x5c767e,_0x4bf5ae,_0x17c0ef){return new BPromise(function(_0x59e606,_0x40fef2){var _0x3682cc;if(typeof _0x5c767e!=='string'||_0x5c767e[_0x31b7('0x3')]===0x0){return _0x40fef2(_0x31b7('0x4'));}if(typeof _0x4bf5ae!==_0x31b7('0x5')||_0x4bf5ae['length']===0x0){return _0x40fef2(_0x31b7('0x6'));}if(typeof _0x17c0ef!==_0x31b7('0x7')&&(typeof _0x17c0ef!==_0x31b7('0x5')||_0x17c0ef[_0x31b7('0x3')]===0x0)){return _0x40fef2(_0x31b7('0x8'));}try{_0x3682cc=fs[_0x31b7('0x9')](_0x5c767e)[_0x31b7('0xa')]('base64');}catch(_0x268428){return _0x40fef2(_0x268428);}return _0x59e606({'method':_0x31b7('0xb'),'uri':host+_0x31b7('0xc')+_0x4bf5ae,'body':{'config':{'encoding':_0x31b7('0xd'),'sampleRateHertz':_0x31b7('0xe'),'languageCode':_0x17c0ef},'audio':{'content':_0x3682cc}},'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 3a4ad76..0e268ea 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 _0xca70=['./asr'];(function(_0x5855c6,_0x272865){var _0x1e65b5=function(_0x20b078){while(--_0x20b078){_0x5855c6['push'](_0x5855c6['shift']());}};_0x1e65b5(++_0x272865);}(_0xca70,0xb4));var _0x0ca7=function(_0x49d5ef,_0x24f7bf){_0x49d5ef=_0x49d5ef-0x0;var _0x1398a5=_0xca70[_0x49d5ef];return _0x1398a5;};var asr=require(_0x0ca7('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x2ce2=['exports','./asr'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2ce2,0xab));var _0x22ce=function(_0x5491e5,_0x37a869){_0x5491e5=_0x5491e5-0x0;var _0x214eb5=_0x2ce2[_0x5491e5];return _0x214eb5;};var asr=require(_0x22ce('0x0'));module[_0x22ce('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index d9a1c08..ecca14a 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 _0xc7cd=['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','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','path','sox','google-tts-api','url','util','./aws','./sestek','./tilde','../../../config/logger','https:','host','WHAT_EVER','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','protocol','get','end','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','data','writeFileSync','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','source','action','fulfillment','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','lex'];(function(_0x145cf9,_0x3c95cf){var _0x472300=function(_0x265bad){while(--_0x265bad){_0x145cf9['push'](_0x145cf9['shift']());}};_0x472300(++_0x3c95cf);}(_0xc7cd,0x196));var _0xdc7c=function(_0x57a7a1,_0x43bfc3){_0x57a7a1=_0x57a7a1-0x0;var _0x14f5fd=_0xc7cd[_0x57a7a1];return _0x14f5fd;};'use strict';var apiai=require(_0xdc7c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xdc7c('0x1'));var fs=require('fs');var http=require(_0xdc7c('0x2'));var https=require(_0xdc7c('0x3'));var md5=require(_0xdc7c('0x4'));var path=require(_0xdc7c('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xdc7c('0x6'));var tts=require(_0xdc7c('0x7'));var urlParse=require(_0xdc7c('0x8'))['parse'];var util=require(_0xdc7c('0x9'));var aws=require(_0xdc7c('0xa'));var google=require('./google');var sestek=require(_0xdc7c('0xb'));var tilde=require(_0xdc7c('0xc'));var logger=require(_0xdc7c('0xd'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x13b36f,_0x122bea){return new BPromise(function(_0x5ef5e1,_0x37ea42){var _0x4b2f8b=urlParse(_0x13b36f);var _0x55a564=_0x4b2f8b['protocol']===_0xdc7c('0xe')?https:http;var _0x5ccef0={'host':_0x4b2f8b[_0xdc7c('0xf')],'path':_0x4b2f8b[_0xdc7c('0x5')],'headers':{'user-agent':_0xdc7c('0x10')}};_0x55a564['get'](_0x5ccef0,function(_0x45a22e){if(_0x45a22e['statusCode']!==0xc8){logger['error'](_0xdc7c('0x11')+_0x13b36f+_0xdc7c('0x12')+_0x45a22e[_0xdc7c('0x13')]+'\x20('+_0x45a22e['statusMessage']+')');_0x37ea42(new Error(_0xdc7c('0x11')+_0x13b36f+_0xdc7c('0x12')+_0x45a22e['statusCode']+'\x20('+_0x45a22e[_0xdc7c('0x14')]+')'));return;}var _0x4d4b6f=fs['createWriteStream'](_0x122bea);_0x4d4b6f['on'](_0xdc7c('0x15'),function(){logger[_0xdc7c('0x16')](_0xdc7c('0x17'));_0x4d4b6f['close'](_0x5ef5e1);});_0x4d4b6f['on'](_0xdc7c('0x18'),function(_0x549af0){fs[_0xdc7c('0x19')](_0x122bea);logger[_0xdc7c('0x18')](_0xdc7c('0x1a'),_0x549af0);_0x37ea42(_0x549af0);});_0x45a22e[_0xdc7c('0x1b')](_0x4d4b6f);})['on'](_0xdc7c('0x18'),function(_0x14c3b9){logger[_0xdc7c('0x18')](_0x14c3b9);_0x37ea42(_0x14c3b9);})['end']();});}function uploadFile(_0x4c3aa0){return new BPromise(function(_0x1b7c22,_0x519ac2){var _0xaec7c2=urlParse(_0x4c3aa0);var _0x561142=_0xaec7c2[_0xdc7c('0x1c')]===_0xdc7c('0xe')?https:http;var _0x269fd0={'host':_0xaec7c2[_0xdc7c('0xf')],'path':_0xaec7c2[_0xdc7c('0x5')],'headers':{'user-agent':_0xdc7c('0x10')}};_0x561142[_0xdc7c('0x1d')](_0x269fd0,function(_0x34135c){if(_0x34135c[_0xdc7c('0x13')]!==0xc8){_0x519ac2(new Error(_0xdc7c('0x11')+_0x4c3aa0+_0xdc7c('0x12')+_0x34135c['statusCode']+'\x20('+_0x34135c[_0xdc7c('0x14')]+')'));return;}var _0x220611='';_0x34135c['on']('data',function(_0x50e537){_0x220611+=_0x50e537;});_0x34135c['on'](_0xdc7c('0x1e'),function(){_0x1b7c22(_0x220611);});})['on'](_0xdc7c('0x18'),function(_0x2345f5){_0x519ac2(_0x2345f5);})[_0xdc7c('0x1e')]();});}function convertFile(_0x247dae,_0x39407f){return new BPromise(function(_0x3c38dc,_0x53eee1){var _0x2f066b=sox['transcode'](_0x247dae,_0x39407f,{'sampleRate':0x1f40,'format':_0xdc7c('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f066b['on'](_0xdc7c('0x18'),function(_0x40f604){logger[_0xdc7c('0x18')](_0xdc7c('0x20'),_0x40f604);_0x53eee1(_0x40f604);});_0x2f066b['on'](_0xdc7c('0x1e'),function(){logger['info'](_0xdc7c('0x21'));_0x3c38dc();});_0x2f066b[_0xdc7c('0x22')]();});}function base64Decode(_0x3f86ac,_0x553288){var _0x18f43e=path['resolve'](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25'));fs['writeFileSync'](_0x18f43e,_0x3f86ac,_0xdc7c('0x26'));return convertFile(_0x18f43e,_0x553288)[_0xdc7c('0x27')](function(){try{fs['unlink'](_0x18f43e);fs[_0xdc7c('0x28')](_0x553288,_0xdc7c('0x29'));}catch(_0x54d8f5){logger['error'](_0x54d8f5);}return _0x553288[_0xdc7c('0x2a')]('.')[0x0];});}function base64Encode(_0x2bb4e9){var _0x38d695=fs[_0xdc7c('0x2b')](_0x2bb4e9);return new Buffer(_0x38d695)[_0xdc7c('0x2c')]('base64');}exports[_0xdc7c('0x2d')]=function(_0x549a9c,_0x501a67,_0x473739,_0x2a6199,_0x395abf,_0x3e7b88){var _0x2087a5,_0x55e3a8;var _0x49ba46=_0xdc7c('0x2e');var _0x390691=_0xdc7c('0x2f')+_0x549a9c;var _0x5de50d={};if(_0x501a67===_0xdc7c('0x30')){_0x5de50d[_0xdc7c('0x31')]={'ssml':_0x473739};}else{_0x5de50d[_0xdc7c('0x31')]={'text':_0x473739};};_0x5de50d[_0xdc7c('0x32')]={'languageCode':_0x2a6199,'ssmlGender':_0x395abf};_0x5de50d[_0xdc7c('0x33')]={'audioEncoding':_0xdc7c('0x34'),'sampleRateHertz':0x1f40};var _0x1b97fa={'url':_0x49ba46+_0xdc7c('0x35')+_0x390691,'method':_0xdc7c('0x36'),'json':!![],'body':_0x5de50d};return rp(_0x1b97fa)['then'](function(_0x51af73){return new BPromise(function(_0x84e660,_0x278acf){_0x2087a5=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+'.mp3');var _0x3d7029=Buffer['from'](_0x51af73['audioContent'],_0xdc7c('0x26'));return fs[_0xdc7c('0x38')](_0x2087a5,_0x3d7029,function(_0x1dc2d4){_0x278acf(_0x1dc2d4);},function(_0x3b53d6){fs[_0xdc7c('0x28')](_0x2087a5,_0xdc7c('0x29'));_0x84e660(_0x3b53d6);});});})[_0xdc7c('0x27')](function(_0x917082){_0x55e3a8=path['resolve'](__dirname,_0xdc7c('0x23'),rs['generate'](0x4)+_0xdc7c('0x25'));return convertFile(_0x2087a5,_0x55e3a8);})['then'](function(){try{fs[_0xdc7c('0x19')](_0x2087a5);fs[_0xdc7c('0x28')](_0x55e3a8,'777');}catch(_0x4cc550){logger['error'](_0x4cc550);}logger[_0xdc7c('0x16')](_0xdc7c('0x39'),_0x55e3a8[_0xdc7c('0x2a')]('.')[0x0]);return _0x55e3a8[_0xdc7c('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x2e4762,_0xc92013){var _0x37799d=_0xdc7c('0x3a');var _0x1f36d2,_0x4176b0;var _0x31f5f2;var _0x3dd8ef={'encoding':'utf8','method':_0xdc7c('0x36'),'timeout':0x2710,'url':_0x37799d,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xdc7c('0x3b')+encodeURIComponent(JSON['stringify']([[[_0xdc7c('0x3c'),JSON[_0xdc7c('0x3d')]([_0x2e4762,_0xc92013||'en',![],_0xdc7c('0x3e')]),null,_0xdc7c('0x3f')]]]))};return rp(_0x3dd8ef)[_0xdc7c('0x27')](function(_0x4c73e4){try{_0x31f5f2=eval(_0x4c73e4[_0xdc7c('0x40')](0x5))[0x0][0x2];}catch(_0x2a403a){throw new Error(_0xdc7c('0x41')+_0x4c73e4['data']);}if(!_0x31f5f2){if(_0x2e4762[_0xdc7c('0x42')]>0xc8){throw new Error(_0xdc7c('0x43'));}else{throw new Error('lang\x20\x22'+_0xc92013+'\x22\x20might\x20not\x20exist');}}try{_0x31f5f2=eval(_0x31f5f2)[0x0];}catch(_0x3e2436){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xdc7c('0x44')]);}const _0x46aefa=_0x31f5f2;_0x1f36d2=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+'.mp3');fs[_0xdc7c('0x45')](_0x1f36d2,_0x31f5f2,{'encoding':_0xdc7c('0x26')});_0x4176b0=path[_0xdc7c('0x37')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1f36d2,_0x4176b0);})[_0xdc7c('0x27')](function(){try{fs[_0xdc7c('0x19')](_0x1f36d2);fs['chmodSync'](_0x4176b0,_0xdc7c('0x29'));}catch(_0x19f8fd){logger[_0xdc7c('0x18')](_0x19f8fd);}logger['info']('goggleTTS\x20path',_0x4176b0[_0xdc7c('0x2a')]('.')[0x0]);return _0x4176b0[_0xdc7c('0x2a')]('.')[0x0];});};exports[_0xdc7c('0x46')]=function(_0x33880c,_0x4bcc56,_0x53bcb8){return google[_0xdc7c('0x47')](_0x33880c,_0x4bcc56,_0x53bcb8)[_0xdc7c('0x27')](function(_0x54315b){logger['info'](_0x54315b['uri']);return rp(_0x54315b);})[_0xdc7c('0x27')](function(_0xd930e9){var _0xe3ff4c='';var _0x4b0bc1=0x0;try{fs['unlink'](_0x33880c);}catch(_0x29d789){logger[_0xdc7c('0x18')](_0x29d789);}if(_0xd930e9&&_0xd930e9['results']){_0xe3ff4c=_0xd930e9[_0xdc7c('0x48')][_0xdc7c('0x49')](function(_0x50cf1d){return _0x50cf1d&&_0x50cf1d[_0xdc7c('0x4a')][0x0]&&_0x50cf1d[_0xdc7c('0x4a')][0x0][_0xdc7c('0x4b')]?_0x50cf1d['alternatives'][0x0][_0xdc7c('0x4b')]:'';})[_0xdc7c('0x4c')]('\x0a');_0x4b0bc1=_0xd930e9['results'][_0xdc7c('0x49')](function(_0x1f495c){return _0x1f495c&&_0x1f495c[_0xdc7c('0x4a')][0x0]&&_0x1f495c['alternatives'][0x0][_0xdc7c('0x4d')]?_0x1f495c[_0xdc7c('0x4a')][0x0][_0xdc7c('0x4d')]:0x0;})[_0xdc7c('0x4c')]('\x0a');}logger[_0xdc7c('0x16')]('googleASR\x20transcription',_0xe3ff4c);logger['info'](_0xdc7c('0x4e'),_0x4b0bc1);return{'transcript':_0xe3ff4c,'confidence':_0x4b0bc1};})[_0xdc7c('0x4f')](function(_0x1ac223){logger[_0xdc7c('0x18')](_0xdc7c('0x50'),_0x1ac223[_0xdc7c('0x13')],_0x1ac223[_0xdc7c('0x51')],_0x1ac223[_0xdc7c('0x52')]);});};exports['googleDialogflow']=function(_0x443884,_0x3fe5d0,_0x234add,_0x2b4aec){var _0x1841ff=apiai(_0x3fe5d0,{'language':_0x2b4aec||'en'});return _0x1841ff['textRequest'](_0x234add,{'sessionId':md5(_0x443884)})[_0xdc7c('0x27')](function(_0x1d8d3f){logger[_0xdc7c('0x16')](JSON[_0xdc7c('0x3d')](_0x1d8d3f));return{'source':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x54')],'resolvedQuery':_0x1d8d3f['result']['resolvedQuery'],'action':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x55')],'actionIncomplete':_0x1d8d3f[_0xdc7c('0x53')]['actionIncomplete'],'speech':_0x1d8d3f['result'][_0xdc7c('0x56')]['speech'],'score':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x57')],'statusCode':_0x1d8d3f[_0xdc7c('0x58')]['code'],'endConversation':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x59')][_0xdc7c('0x5a')]||![],'isFallbackIntent':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x59')][_0xdc7c('0x5b')]};});};exports[_0xdc7c('0x5c')]=function(_0x5a0d2a,_0x12f325,_0x34aa76,_0x348ec3,_0x256770,_0x2aed9d){var _0x55270a=_0x348ec3['replace'](/\\n/g,'\x0a');var _0x15abb8={'credentials':{'private_key':_0x55270a,'client_email':_0x34aa76}};var _0x24edd3=new dialogflow[(_0xdc7c('0x5d'))](_0x15abb8);var _0x577ac4=_0x24edd3[_0xdc7c('0x5e')](_0x12f325,md5(_0x5a0d2a));var _0x3eb13e={'session':_0x577ac4,'queryInput':{'text':{'text':_0x256770,'languageCode':_0x2aed9d}}};return _0x24edd3[_0xdc7c('0x5f')](_0x3eb13e)[_0xdc7c('0x27')](function(_0x55dac3){if(_0x55dac3&&_0x55dac3[_0xdc7c('0x42')]){logger['info'](_0xdc7c('0x60'),JSON['stringify'](_0x55dac3));var _0x28d412=_0x55dac3[0x0];if(_0x28d412){var _0x3c7fc9={'action':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x55')],'allRequiredParamsPresent':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x62')],'endConversation':_0x28d412[_0xdc7c('0x61')]['diagnosticInfo']&&_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x63')][_0xdc7c('0x64')]?_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x63')][_0xdc7c('0x64')][_0xdc7c('0x65')][_0xdc7c('0x66')]:![],'fulfillmentText':_0x28d412['queryResult'][_0xdc7c('0x67')],'intentName':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x68')][_0xdc7c('0x51')],'intentDisplayName':_0x28d412[_0xdc7c('0x61')]['intent'][_0xdc7c('0x69')],'isFallbackIntent':_0x28d412['queryResult'][_0xdc7c('0x68')][_0xdc7c('0x6a')],'languageCode':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x6b')],'queryText':_0x28d412[_0xdc7c('0x61')]['queryText'],'responseId':_0x28d412[_0xdc7c('0x6c')],'score':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x6d')],'speech':_0x28d412[_0xdc7c('0x61')]['fulfillmentText'],'providerResponse':JSON[_0xdc7c('0x3d')](_0x55dac3)};return _0x3c7fc9;}}});};exports[_0xdc7c('0x6e')]=function(_0x578cf9,_0x50f062,_0x1dbd99,_0x18f938){return tilde['asr'](_0x578cf9,_0x50f062,_0x1dbd99,_0x18f938)[_0xdc7c('0x27')](function(_0x511e0b){try{fs[_0xdc7c('0x19')](_0x578cf9);}catch(_0x17258e){logger[_0xdc7c('0x18')](_0x17258e);}logger[_0xdc7c('0x16')](_0xdc7c('0x6f'),_0x511e0b[_0xdc7c('0x4b')]);logger[_0xdc7c('0x16')](_0xdc7c('0x70'),_0x511e0b[_0xdc7c('0x4d')]);return _0x511e0b;});};exports[_0xdc7c('0x71')]=function(_0x3fcb95,_0x4cc544,_0x1f34ca,_0x3aa510,_0x445ec1,_0x3097f9){var _0x50ea5e=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x72'));var _0x139bc6;return aws[_0xdc7c('0x73')](_0x3fcb95,_0x4cc544,_0x1f34ca,_0x3aa510,_0x445ec1,_0x3097f9,_0x50ea5e)[_0xdc7c('0x27')](function(){_0x139bc6=path[_0xdc7c('0x37')](__dirname,'tmp',rs['generate'](0x4)+_0xdc7c('0x25'));return convertFile(_0x50ea5e,_0x139bc6);})[_0xdc7c('0x27')](function(){try{fs['unlink'](_0x50ea5e);fs[_0xdc7c('0x28')](_0x139bc6,'777');}catch(_0xb56b15){logger[_0xdc7c('0x18')](_0xb56b15);}return _0x139bc6[_0xdc7c('0x2a')]('.')[0x0];});};exports[_0xdc7c('0x74')]=function(_0x1cc8c8,_0x4e49f8,_0x37f545,_0x394f38,_0x56043f,_0x2d6011){return aws[_0xdc7c('0x75')](_0x1cc8c8,_0x4e49f8,_0x37f545,_0x394f38,_0x56043f,_0x2d6011)[_0xdc7c('0x27')](function(_0x382f26){logger[_0xdc7c('0x16')](JSON[_0xdc7c('0x3d')](_0x382f26));return _0x382f26;});};exports['ispeechTTS']=function(_0x499808,_0x2f7dda,_0x250922,_0x2b131f){var _0x15a5aa=util[_0xdc7c('0x76')](_0xdc7c('0x77'),ISPEECH_API,_0x499808,encodeURIComponent(_0x2f7dda),_0x250922,_0x2b131f);var _0x269377=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs['generate'](0x4)+_0xdc7c('0x72'));var _0x343941;return downloadFile(_0x15a5aa,_0x269377)[_0xdc7c('0x27')](function(){_0x343941=path['resolve'](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25'));return convertFile(_0x269377,_0x343941);})[_0xdc7c('0x27')](function(){try{fs[_0xdc7c('0x19')](_0x269377);fs[_0xdc7c('0x28')](_0x343941,_0xdc7c('0x29'));}catch(_0x3c1283){logger[_0xdc7c('0x18')](_0x3c1283);}return _0x343941['split']('.')[0x0];});};exports[_0xdc7c('0x78')]=function(_0x48013a,_0x447afc,_0x32384c,_0x1a184c){var _0x2eb523=util[_0xdc7c('0x76')](_0xdc7c('0x79'),ISPEECH_API,_0x447afc,_0x32384c,base64Encode(_0x48013a),_0x1a184c?util[_0xdc7c('0x76')]('model=%s',encodeURIComponent(_0x1a184c)):_0xdc7c('0x7a'));return uploadFile(_0x2eb523)[_0xdc7c('0x27')](function(_0x1bb85c){return querystring['parse'](_0x1bb85c);});};exports[_0xdc7c('0x7b')]=function(_0x6e37f4,_0x14a2f2){return sestek[_0xdc7c('0x7c')](_0x6e37f4,_0x14a2f2)['then'](function(_0x3c6a7f){logger['info'](JSON[_0xdc7c('0x3d')](_0x3c6a7f));var _0x51d62c={'speech':_0x3c6a7f[_0xdc7c('0x7d')],'action':_0x3c6a7f[_0xdc7c('0x7e')]?_0x3c6a7f[_0xdc7c('0x7e')][_0xdc7c('0x7f')]:undefined,'actiondata':_0x3c6a7f[_0xdc7c('0x7e')]?_0x3c6a7f[_0xdc7c('0x7e')][_0xdc7c('0x80')]:undefined};if(_0x3c6a7f['channelData']&&_0x3c6a7f['channelData'][_0xdc7c('0x81')]){return base64Decode(_0x3c6a7f['channelData'][_0xdc7c('0x81')]['Data'],path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25')))[_0xdc7c('0x27')](function(_0x1a1482){_0x51d62c['audiofile']=_0x1a1482;return _0x51d62c;});}return _0x51d62c;});};exports[_0xdc7c('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x20cd=['host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','download\x20error','pipe','end','path','request\x20to\x20','wav','error\x20convert','finish\x20to\x20convert','start','generate','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','then','resolve','tmp','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','polly','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','apiai-promise','bluebird','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:'];(function(_0x4456d4,_0x3cf810){var _0x459e9c=function(_0x210b2d){while(--_0x210b2d){_0x4456d4['push'](_0x4456d4['shift']());}};_0x459e9c(++_0x3cf810);}(_0x20cd,0x72));var _0xd20c=function(_0x3ee722,_0x3f02a7){_0x3ee722=_0x3ee722-0x0;var _0x49d55c=_0x20cd[_0x3ee722];return _0x49d55c;};'use strict';var apiai=require(_0xd20c('0x0'));var BPromise=require(_0xd20c('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xd20c('0x2'));var https=require(_0xd20c('0x3'));var md5=require(_0xd20c('0x4'));var path=require('path');var querystring=require(_0xd20c('0x5'));var rp=require(_0xd20c('0x6'));var rs=require(_0xd20c('0x7'));var sox=require(_0xd20c('0x8'));var tts=require(_0xd20c('0x9'));var urlParse=require(_0xd20c('0xa'))[_0xd20c('0xb')];var util=require(_0xd20c('0xc'));var aws=require(_0xd20c('0xd'));var google=require('./google');var sestek=require(_0xd20c('0xe'));var tilde=require(_0xd20c('0xf'));var logger=require(_0xd20c('0x10'))(_0xd20c('0x11'));var ISPEECH_API=_0xd20c('0x12');function downloadFile(_0x250c9e,_0x559c92){return new BPromise(function(_0x443035,_0x521351){var _0x4d2a35=urlParse(_0x250c9e);var _0x30f587=_0x4d2a35[_0xd20c('0x13')]===_0xd20c('0x14')?https:http;var _0x3db6e2={'host':_0x4d2a35[_0xd20c('0x15')],'path':_0x4d2a35['path'],'headers':{'user-agent':_0xd20c('0x16')}};_0x30f587[_0xd20c('0x17')](_0x3db6e2,function(_0x5ec667){if(_0x5ec667[_0xd20c('0x18')]!==0xc8){logger[_0xd20c('0x19')]('request\x20to\x20'+_0x250c9e+_0xd20c('0x1a')+_0x5ec667[_0xd20c('0x18')]+'\x20('+_0x5ec667[_0xd20c('0x1b')]+')');_0x521351(new Error('request\x20to\x20'+_0x250c9e+'\x20failed,\x20status\x20code\x20=\x20'+_0x5ec667[_0xd20c('0x18')]+'\x20('+_0x5ec667['statusMessage']+')'));return;}var _0x210fb6=fs[_0xd20c('0x1c')](_0x559c92);_0x210fb6['on']('finish',function(){logger[_0xd20c('0x1d')](_0xd20c('0x1e'));_0x210fb6['close'](_0x443035);});_0x210fb6['on'](_0xd20c('0x19'),function(_0x52208d){fs['unlink'](_0x559c92);logger[_0xd20c('0x19')](_0xd20c('0x1f'),_0x52208d);_0x521351(_0x52208d);});_0x5ec667[_0xd20c('0x20')](_0x210fb6);})['on'](_0xd20c('0x19'),function(_0xebc49a){logger[_0xd20c('0x19')](_0xebc49a);_0x521351(_0xebc49a);})[_0xd20c('0x21')]();});}function uploadFile(_0x4b62a7){return new BPromise(function(_0x20758b,_0x57a788){var _0x441d49=urlParse(_0x4b62a7);var _0x42605d=_0x441d49[_0xd20c('0x13')]==='https:'?https:http;var _0x1c5e36={'host':_0x441d49[_0xd20c('0x15')],'path':_0x441d49[_0xd20c('0x22')],'headers':{'user-agent':'WHAT_EVER'}};_0x42605d['get'](_0x1c5e36,function(_0x142bd2){if(_0x142bd2['statusCode']!==0xc8){_0x57a788(new Error(_0xd20c('0x23')+_0x4b62a7+_0xd20c('0x1a')+_0x142bd2[_0xd20c('0x18')]+'\x20('+_0x142bd2[_0xd20c('0x1b')]+')'));return;}var _0x4aeb60='';_0x142bd2['on']('data',function(_0x4b1d02){_0x4aeb60+=_0x4b1d02;});_0x142bd2['on'](_0xd20c('0x21'),function(){_0x20758b(_0x4aeb60);});})['on']('error',function(_0x5cf87d){_0x57a788(_0x5cf87d);})[_0xd20c('0x21')]();});}function convertFile(_0x3f3617,_0x416673){return new BPromise(function(_0x123bb7,_0x2e510d){var _0x53e263=sox['transcode'](_0x3f3617,_0x416673,{'sampleRate':0x1f40,'format':_0xd20c('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53e263['on'](_0xd20c('0x19'),function(_0x506261){logger[_0xd20c('0x19')](_0xd20c('0x25'),_0x506261);_0x2e510d(_0x506261);});_0x53e263['on']('end',function(){logger[_0xd20c('0x1d')](_0xd20c('0x26'));_0x123bb7();});_0x53e263[_0xd20c('0x27')]();});}function base64Decode(_0x49daf2,_0x2f9455){var _0x31bc3c=path['resolve'](__dirname,'tmp',rs[_0xd20c('0x28')](0x4)+'.wav');fs[_0xd20c('0x29')](_0x31bc3c,_0x49daf2,_0xd20c('0x2a'));return convertFile(_0x31bc3c,_0x2f9455)['then'](function(){try{fs[_0xd20c('0x2b')](_0x31bc3c);fs[_0xd20c('0x2c')](_0x2f9455,_0xd20c('0x2d'));}catch(_0x41ccbc){logger[_0xd20c('0x19')](_0x41ccbc);}return _0x2f9455[_0xd20c('0x2e')]('.')[0x0];});}function base64Encode(_0x184884){var _0x1fceb6=fs[_0xd20c('0x2f')](_0x184884);return new Buffer(_0x1fceb6)[_0xd20c('0x30')](_0xd20c('0x2a'));}exports['googleCloudTTS']=function(_0x7129bc,_0x222c6f,_0x273e51,_0x63194,_0x2b7a16,_0x5d8ea2){var _0x173b7d,_0x353968;var _0x422416='https://texttospeech.googleapis.com/v1/';var _0x456a68=_0xd20c('0x31')+_0x7129bc;var _0x136fde={};if(_0x222c6f===_0xd20c('0x32')){_0x136fde['input']={'ssml':_0x273e51};}else{_0x136fde[_0xd20c('0x33')]={'text':_0x273e51};};_0x136fde[_0xd20c('0x34')]={'languageCode':_0x63194,'ssmlGender':_0x2b7a16};_0x136fde[_0xd20c('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x50ada0={'url':_0x422416+_0xd20c('0x36')+_0x456a68,'method':_0xd20c('0x37'),'json':!![],'body':_0x136fde};return rp(_0x50ada0)[_0xd20c('0x38')](function(_0x2f040d){return new BPromise(function(_0x472c1c,_0x177e5a){_0x173b7d=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs['generate'](0x4)+_0xd20c('0x3b'));var _0x3007f3=Buffer[_0xd20c('0x3c')](_0x2f040d[_0xd20c('0x3d')],_0xd20c('0x2a'));return fs[_0xd20c('0x3e')](_0x173b7d,_0x3007f3,function(_0x4f464f){_0x177e5a(_0x4f464f);},function(_0x50236d){fs['chmodSync'](_0x173b7d,_0xd20c('0x2d'));_0x472c1c(_0x50236d);});});})['then'](function(_0x46f781){_0x353968=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs[_0xd20c('0x28')](0x4)+_0xd20c('0x3f'));return convertFile(_0x173b7d,_0x353968);})[_0xd20c('0x38')](function(){try{fs[_0xd20c('0x2b')](_0x173b7d);fs[_0xd20c('0x2c')](_0x353968,'777');}catch(_0x241715){logger[_0xd20c('0x19')](_0x241715);}logger[_0xd20c('0x1d')](_0xd20c('0x40'),_0x353968[_0xd20c('0x2e')]('.')[0x0]);return _0x353968[_0xd20c('0x2e')]('.')[0x0];});};exports[_0xd20c('0x41')]=function(_0x2d3efa,_0x187bc7){var _0x4e298d=_0xd20c('0x42');var _0x4a0b7f,_0x4df5f9;var _0x1a2b15;var _0x1e136f={'encoding':_0xd20c('0x43'),'method':'POST','timeout':0x2710,'url':_0x4e298d,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xd20c('0x44')+encodeURIComponent(JSON[_0xd20c('0x45')]([[[_0xd20c('0x46'),JSON[_0xd20c('0x45')]([_0x2d3efa,_0x187bc7||'en',![],_0xd20c('0x47')]),null,_0xd20c('0x48')]]]))};return rp(_0x1e136f)[_0xd20c('0x38')](function(_0xed52b9){try{_0x1a2b15=eval(_0xed52b9[_0xd20c('0x49')](0x5))[0x0][0x2];}catch(_0x1a3c23){throw new Error(_0xd20c('0x4a')+_0xed52b9[_0xd20c('0x4b')]);}if(!_0x1a2b15){if(_0x2d3efa[_0xd20c('0x4c')]>0xc8){throw new Error(_0xd20c('0x4d'));}else{throw new Error('lang\x20\x22'+_0x187bc7+_0xd20c('0x4e'));}}try{_0x1a2b15=eval(_0x1a2b15)[0x0];}catch(_0x3de2b3){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xd20c('0x4b')]);}const _0x43fc51=_0x1a2b15;_0x4a0b7f=path['resolve'](__dirname,'tmp',rs[_0xd20c('0x28')](0x4)+_0xd20c('0x3b'));fs[_0xd20c('0x29')](_0x4a0b7f,_0x1a2b15,{'encoding':_0xd20c('0x2a')});_0x4df5f9=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs[_0xd20c('0x28')](0x4)+'.wav');return convertFile(_0x4a0b7f,_0x4df5f9);})['then'](function(){try{fs[_0xd20c('0x2b')](_0x4a0b7f);fs[_0xd20c('0x2c')](_0x4df5f9,_0xd20c('0x2d'));}catch(_0x17f4f9){logger[_0xd20c('0x19')](_0x17f4f9);}logger[_0xd20c('0x1d')]('goggleTTS\x20path',_0x4df5f9[_0xd20c('0x2e')]('.')[0x0]);return _0x4df5f9['split']('.')[0x0];});};exports[_0xd20c('0x4f')]=function(_0x576a72,_0x22edbc,_0x3064be){return google[_0xd20c('0x50')](_0x576a72,_0x22edbc,_0x3064be)[_0xd20c('0x38')](function(_0x3ec327){logger[_0xd20c('0x1d')](_0x3ec327[_0xd20c('0x51')]);return rp(_0x3ec327);})['then'](function(_0x99e088){var _0x241868='';var _0x23112d=0x0;try{fs[_0xd20c('0x2b')](_0x576a72);}catch(_0x203e51){logger[_0xd20c('0x19')](_0x203e51);}if(_0x99e088&&_0x99e088['results']){_0x241868=_0x99e088[_0xd20c('0x52')][_0xd20c('0x53')](function(_0x3d6306){return _0x3d6306&&_0x3d6306[_0xd20c('0x54')][0x0]&&_0x3d6306[_0xd20c('0x54')][0x0]['transcript']?_0x3d6306['alternatives'][0x0][_0xd20c('0x55')]:'';})[_0xd20c('0x56')]('\x0a');_0x23112d=_0x99e088[_0xd20c('0x52')]['map'](function(_0x2c80ed){return _0x2c80ed&&_0x2c80ed[_0xd20c('0x54')][0x0]&&_0x2c80ed[_0xd20c('0x54')][0x0][_0xd20c('0x57')]?_0x2c80ed[_0xd20c('0x54')][0x0][_0xd20c('0x57')]:0x0;})['join']('\x0a');}logger['info'](_0xd20c('0x58'),_0x241868);logger[_0xd20c('0x1d')](_0xd20c('0x59'),_0x23112d);return{'transcript':_0x241868,'confidence':_0x23112d};})['catch'](function(_0x52548c){logger[_0xd20c('0x19')]('[%s]\x20%s:%s',_0x52548c['statusCode'],_0x52548c[_0xd20c('0x5a')],_0x52548c['message']);});};exports[_0xd20c('0x5b')]=function(_0x1349b2,_0x4ad918,_0x349b37,_0xca56cb){var _0x19356c=apiai(_0x4ad918,{'language':_0xca56cb||'en'});return _0x19356c[_0xd20c('0x5c')](_0x349b37,{'sessionId':md5(_0x1349b2)})[_0xd20c('0x38')](function(_0x402644){logger[_0xd20c('0x1d')](JSON[_0xd20c('0x45')](_0x402644));return{'source':_0x402644[_0xd20c('0x5d')][_0xd20c('0x5e')],'resolvedQuery':_0x402644[_0xd20c('0x5d')][_0xd20c('0x5f')],'action':_0x402644[_0xd20c('0x5d')][_0xd20c('0x60')],'actionIncomplete':_0x402644[_0xd20c('0x5d')][_0xd20c('0x61')],'speech':_0x402644['result']['fulfillment'][_0xd20c('0x62')],'score':_0x402644[_0xd20c('0x5d')][_0xd20c('0x63')],'statusCode':_0x402644[_0xd20c('0x64')][_0xd20c('0x65')],'endConversation':_0x402644[_0xd20c('0x5d')][_0xd20c('0x66')]['endConversation']||![],'isFallbackIntent':_0x402644['result'][_0xd20c('0x66')]['isFallbackIntent']};});};exports[_0xd20c('0x67')]=function(_0x3888cf,_0x1161dd,_0x20fe20,_0x595c16,_0x568b89,_0x41e0f6){var _0x3a84a8=_0x595c16[_0xd20c('0x68')](/\\n/g,'\x0a');var _0x5f1873={'credentials':{'private_key':_0x3a84a8,'client_email':_0x20fe20}};var _0x1fb25e=new dialogflow['SessionsClient'](_0x5f1873);var _0x1c4453=_0x1fb25e[_0xd20c('0x69')](_0x1161dd,md5(_0x3888cf));var _0x198c90={'session':_0x1c4453,'queryInput':{'text':{'text':_0x568b89,'languageCode':_0x41e0f6}}};return _0x1fb25e['detectIntent'](_0x198c90)[_0xd20c('0x38')](function(_0x45b296){if(_0x45b296&&_0x45b296['length']){logger[_0xd20c('0x1d')](_0xd20c('0x6a'),JSON[_0xd20c('0x45')](_0x45b296));var _0x39e220=_0x45b296[0x0];if(_0x39e220){var _0x523932={'action':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x60')],'allRequiredParamsPresent':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x6c')],'endConversation':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x6d')]&&_0x39e220[_0xd20c('0x6b')][_0xd20c('0x6d')]['fields']?_0x39e220[_0xd20c('0x6b')][_0xd20c('0x6d')][_0xd20c('0x6e')]['end_conversation'][_0xd20c('0x6f')]:![],'fulfillmentText':_0x39e220['queryResult']['fulfillmentText'],'intentName':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x70')][_0xd20c('0x5a')],'intentDisplayName':_0x39e220['queryResult'][_0xd20c('0x70')][_0xd20c('0x71')],'isFallbackIntent':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x70')][_0xd20c('0x72')],'languageCode':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x73')],'queryText':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x74')],'responseId':_0x39e220[_0xd20c('0x75')],'score':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x76')],'speech':_0x39e220[_0xd20c('0x6b')][_0xd20c('0x77')],'providerResponse':JSON[_0xd20c('0x45')](_0x45b296)};return _0x523932;}}});};exports[_0xd20c('0x78')]=function(_0x5c1caf,_0x29b9e1,_0x23641d,_0x42e29a){return tilde[_0xd20c('0x50')](_0x5c1caf,_0x29b9e1,_0x23641d,_0x42e29a)[_0xd20c('0x38')](function(_0x26f908){try{fs[_0xd20c('0x2b')](_0x5c1caf);}catch(_0x596611){logger[_0xd20c('0x19')](_0x596611);}logger['info']('Tilde\x20ASR\x20transcription',_0x26f908[_0xd20c('0x55')]);logger[_0xd20c('0x1d')](_0xd20c('0x79'),_0x26f908[_0xd20c('0x57')]);return _0x26f908;});};exports['awsPolly']=function(_0x1f6012,_0x2e6c98,_0x25d385,_0x479017,_0x32a44f,_0x297b42){var _0x22a32e=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs[_0xd20c('0x28')](0x4)+_0xd20c('0x3b'));var _0x3df018;return aws[_0xd20c('0x7a')](_0x1f6012,_0x2e6c98,_0x25d385,_0x479017,_0x32a44f,_0x297b42,_0x22a32e)[_0xd20c('0x38')](function(){_0x3df018=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs[_0xd20c('0x28')](0x4)+_0xd20c('0x3f'));return convertFile(_0x22a32e,_0x3df018);})[_0xd20c('0x38')](function(){try{fs[_0xd20c('0x2b')](_0x22a32e);fs['chmodSync'](_0x3df018,_0xd20c('0x2d'));}catch(_0x1563c3){logger[_0xd20c('0x19')](_0x1563c3);}return _0x3df018[_0xd20c('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x1bd3bf,_0x41225e,_0x47e943,_0x4c1fb9,_0x2cda80,_0x2aafcb){return aws['lex'](_0x1bd3bf,_0x41225e,_0x47e943,_0x4c1fb9,_0x2cda80,_0x2aafcb)[_0xd20c('0x38')](function(_0x42d00c){logger[_0xd20c('0x1d')](JSON['stringify'](_0x42d00c));return _0x42d00c;});};exports[_0xd20c('0x7b')]=function(_0x5412f3,_0x3d9932,_0x2a87ea,_0x4064b1){var _0x158ce0=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x5412f3,encodeURIComponent(_0x3d9932),_0x2a87ea,_0x4064b1);var _0x18323d=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs['generate'](0x4)+_0xd20c('0x3b'));var _0x725150;return downloadFile(_0x158ce0,_0x18323d)['then'](function(){_0x725150=path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs[_0xd20c('0x28')](0x4)+'.wav');return convertFile(_0x18323d,_0x725150);})['then'](function(){try{fs[_0xd20c('0x2b')](_0x18323d);fs[_0xd20c('0x2c')](_0x725150,_0xd20c('0x2d'));}catch(_0x113de3){logger[_0xd20c('0x19')](_0x113de3);}return _0x725150[_0xd20c('0x2e')]('.')[0x0];});};exports['ispeechASR']=function(_0x40e9c6,_0x3e3397,_0x1e137e,_0x13e7a9){var _0xe2dcd1=util[_0xd20c('0x7c')](_0xd20c('0x7d'),ISPEECH_API,_0x3e3397,_0x1e137e,base64Encode(_0x40e9c6),_0x13e7a9?util['format'](_0xd20c('0x7e'),encodeURIComponent(_0x13e7a9)):_0xd20c('0x7f'));return uploadFile(_0xe2dcd1)['then'](function(_0x5c8531){return querystring['parse'](_0x5c8531);});};exports[_0xd20c('0x80')]=function(_0x3a9400,_0x278a59){return sestek[_0xd20c('0x81')](_0x3a9400,_0x278a59)[_0xd20c('0x38')](function(_0xbcaed4){logger[_0xd20c('0x1d')](JSON[_0xd20c('0x45')](_0xbcaed4));var _0x240553={'speech':_0xbcaed4[_0xd20c('0x82')],'action':_0xbcaed4[_0xd20c('0x83')]?_0xbcaed4[_0xd20c('0x83')][_0xd20c('0x84')]:undefined,'actiondata':_0xbcaed4[_0xd20c('0x83')]?_0xbcaed4[_0xd20c('0x83')]['CustomActionData']:undefined};if(_0xbcaed4['channelData']&&_0xbcaed4['channelData']['AudioFromTts']){return base64Decode(_0xbcaed4[_0xd20c('0x83')][_0xd20c('0x85')]['Data'],path[_0xd20c('0x39')](__dirname,_0xd20c('0x3a'),rs['generate'](0x4)+_0xd20c('0x3f')))[_0xd20c('0x38')](function(_0x25b3b7){_0x240553[_0xd20c('0x86')]=_0x25b3b7;return _0x240553;});}return _0x240553;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 6842761..b2f8bdc 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 _0x09cc=['exports','./nda'];(function(_0x58ed42,_0x21ee5c){var _0x16f61c=function(_0x2cd3fb){while(--_0x2cd3fb){_0x58ed42['push'](_0x58ed42['shift']());}};_0x16f61c(++_0x21ee5c);}(_0x09cc,0x6b));var _0xc09c=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x09cc[_0x39cf70];return _0x580424;};var nda=require(_0xc09c('0x0'));module[_0xc09c('0x1')]={'nda':nda}; \ No newline at end of file +var _0xcff4=['exports','./nda'];(function(_0x59c774,_0x28d516){var _0x4067d6=function(_0x2b78c3){while(--_0x2b78c3){_0x59c774['push'](_0x59c774['shift']());}};_0x4067d6(++_0x28d516);}(_0xcff4,0x1cf));var _0x4cff=function(_0x21d01a,_0x55f706){_0x21d01a=_0x21d01a-0x0;var _0x981991=_0xcff4[_0x21d01a];return _0x981991;};var nda=require(_0x4cff('0x0'));module[_0x4cff('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8fc7b56..2af35b7 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 _0xc718=['CustomActionData','stringify','request-promise','../../../../../config/logger','agi','resolve','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0xc4f63c,_0x1bce35){var _0x2b8374=function(_0x5b6d09){while(--_0x5b6d09){_0xc4f63c['push'](_0xc4f63c['shift']());}};_0x2b8374(++_0x1bce35);}(_0xc718,0xb6));var _0x8c71=function(_0x1cb12f,_0x21db54){_0x1cb12f=_0x1cb12f-0x0;var _0x192de5=_0xc718[_0x1cb12f];return _0x192de5;};'use strict';var rp=require(_0x8c71('0x0'));var url=require('url');var logger=require(_0x8c71('0x1'))(_0x8c71('0x2'));module['exports']=function(_0x6f90b5,_0x28f8a8){var _0x5402e6={'method':'POST','uri':url[_0x8c71('0x3')](_0x28f8a8['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x28f8a8[_0x8c71('0x4')],'password':_0x28f8a8['password']},'json':!![]};return rp(_0x5402e6)[_0x8c71('0x5')](function(_0x10c4a){var _0x29f3b7={'method':_0x8c71('0x6'),'uri':url[_0x8c71('0x3')](_0x28f8a8['ndassistant_url'],_0x8c71('0x7')),'body':{'type':_0x28f8a8[_0x8c71('0x8')]||_0x8c71('0x9'),'channelId':_0x8c71('0xa'),'conversation':{'id':_0x6f90b5[_0x8c71('0xb')]},'from':{'id':_0x6f90b5[_0x8c71('0xc')],'name':_0x6f90b5[_0x8c71('0xd')]},'recipient':{'id':_0x6f90b5[_0x8c71('0xe')],'name':_0x6f90b5[_0x8c71('0xf')]},'text':_0x28f8a8['text'],'channelData':{}},'headers':{'Authorization':_0x8c71('0x10')+_0x10c4a[_0x8c71('0x11')]},'json':!![]};if(_0x28f8a8[_0x8c71('0x12')]){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x15')]=_0x28f8a8[_0x8c71('0x12')];}if(_0x28f8a8[_0x8c71('0x16')]=='1'){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c71('0x18')};}if(_0x28f8a8[_0x8c71('0x19')]){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x1a')]=_0x28f8a8[_0x8c71('0x19')];if(_0x28f8a8[_0x8c71('0x1b')]){_0x29f3b7['body'][_0x8c71('0x14')][_0x8c71('0x1c')]=_0x28f8a8['custom_action_data'];}}logger['info'](JSON[_0x8c71('0x1d')](_0x29f3b7));return rp(_0x29f3b7);});}; \ No newline at end of file +var _0x9aea=['custom_action','CustomAction','custom_action_data','CustomActionData','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x45e604,_0x58a542){var _0x4948f8=function(_0x47a93e){while(--_0x47a93e){_0x45e604['push'](_0x45e604['shift']());}};_0x4948f8(++_0x58a542);}(_0x9aea,0xdd));var _0xa9ae=function(_0x205647,_0x57d3d0){_0x205647=_0x205647-0x0;var _0x46c644=_0x9aea[_0x205647];return _0x46c644;};'use strict';var rp=require(_0xa9ae('0x0'));var url=require('url');var logger=require(_0xa9ae('0x1'))('agi');module[_0xa9ae('0x2')]=function(_0x13679e,_0x563a24){var _0x414638={'method':_0xa9ae('0x3'),'uri':url[_0xa9ae('0x4')](_0x563a24[_0xa9ae('0x5')],_0xa9ae('0x6')),'form':{'grant_type':'password','username':_0x563a24[_0xa9ae('0x7')],'password':_0x563a24[_0xa9ae('0x8')]},'json':!![]};return rp(_0x414638)[_0xa9ae('0x9')](function(_0x53e52c){var _0x1f2e4b={'method':_0xa9ae('0x3'),'uri':url[_0xa9ae('0x4')](_0x563a24[_0xa9ae('0xa')],_0xa9ae('0xb')),'body':{'type':_0x563a24[_0xa9ae('0xc')]||_0xa9ae('0xd'),'channelId':_0xa9ae('0xe'),'conversation':{'id':_0x13679e[_0xa9ae('0xf')]},'from':{'id':_0x13679e['callerid'],'name':_0x13679e[_0xa9ae('0x10')]},'recipient':{'id':_0x13679e['dnid'],'name':_0x13679e[_0xa9ae('0x11')]},'text':_0x563a24[_0xa9ae('0x12')],'channelData':{}},'headers':{'Authorization':_0xa9ae('0x13')+_0x53e52c[_0xa9ae('0x14')]},'json':!![]};if(_0x563a24[_0xa9ae('0x15')]){_0x1f2e4b[_0xa9ae('0x16')][_0xa9ae('0x17')][_0xa9ae('0x18')]=_0x563a24['project'];}if(_0x563a24[_0xa9ae('0x19')]=='1'){_0x1f2e4b[_0xa9ae('0x16')][_0xa9ae('0x17')][_0xa9ae('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x563a24[_0xa9ae('0x1b')]){_0x1f2e4b[_0xa9ae('0x16')][_0xa9ae('0x17')][_0xa9ae('0x1c')]=_0x563a24[_0xa9ae('0x1b')];if(_0x563a24[_0xa9ae('0x1d')]){_0x1f2e4b['body'][_0xa9ae('0x17')][_0xa9ae('0x1e')]=_0x563a24[_0xa9ae('0x1d')];}}logger['info'](JSON['stringify'](_0x1f2e4b));return rp(_0x1f2e4b);});}; \ 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 2d4ef8a..291e3f8 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 _0x43fb=['./lib/api','exports'];(function(_0x3e6d1b,_0x2da3b4){var _0x10376d=function(_0x1acd03){while(--_0x1acd03){_0x3e6d1b['push'](_0x3e6d1b['shift']());}};_0x10376d(++_0x2da3b4);}(_0x43fb,0x170));var _0xb43f=function(_0x1af843,_0x7f237d){_0x1af843=_0x1af843-0x0;var _0x4b832b=_0x43fb[_0x1af843];return _0x4b832b;};'use strict';var asr=require(_0xb43f('0x0'));module[_0xb43f('0x1')]=function(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c){return asr(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c);}; \ No newline at end of file +var _0x0b52=['exports','./lib/api'];(function(_0x6a1f54,_0x278cd5){var _0x28b84a=function(_0x3d9f47){while(--_0x3d9f47){_0x6a1f54['push'](_0x6a1f54['shift']());}};_0x28b84a(++_0x278cd5);}(_0x0b52,0xb9));var _0x20b5=function(_0x39a56b,_0x46e82f){_0x39a56b=_0x39a56b-0x0;var _0x9c9af5=_0x0b52[_0x39a56b];return _0x9c9af5;};'use strict';var asr=require(_0x20b5('0x0'));module[_0x20b5('0x1')]=function(_0x5f5a19,_0x30623d,_0x14f8ad,_0x1dad00){return asr(_0x5f5a19,_0x30623d,_0x14f8ad,_0x1dad00);}; \ 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 d5eb89d..fc3aa64 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 _0x01a8=['status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','info','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x435f7c,_0x3c50e5){var _0x11be96=function(_0x4b91e3){while(--_0x4b91e3){_0x435f7c['push'](_0x435f7c['shift']());}};_0x11be96(++_0x3c50e5);}(_0x01a8,0x64));var _0x801a=function(_0x4ea3e3,_0x2a7e29){_0x4ea3e3=_0x4ea3e3-0x0;var _0x13c5a7=_0x01a8[_0x4ea3e3];return _0x13c5a7;};'use strict';var BPromise=require('bluebird');var _=require(_0x801a('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x801a('0x1'));var crypto=require(_0x801a('0x2'));var logger=require(_0x801a('0x3'))(_0x801a('0x4'));module[_0x801a('0x5')]=function(_0x17b9d3,_0x387eca,_0x5c1796,_0x4ae0a5){return new BPromise(function(_0x1b5ae5,_0x3bef58){logger['info'](_0x801a('0x6'),_0x4ae0a5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1bb8eb=new WebSocket(_0x4ae0a5||_0x801a('0x7'),{'perMessageDeflate':![]});var _0x5bcde0='';var _0x96ee16='0';var _0x5ad086='1';var _0x2e052f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3e24b5(_0x1d353b){var _0x3dacb7=crypto[_0x801a('0x8')](_0x801a('0x9'));_0x3dacb7[_0x801a('0xa')](_0x1d353b);return _0x3dacb7[_0x801a('0xb')]('hex');}function _0x100301(){try{logger[_0x801a('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x4d0062=moment()[_0x801a('0xd')]();var _0xd0cbe4=_0x3e24b5(_0x4d0062+_0x387eca+_0x5c1796);_0x1bb8eb[_0x801a('0xe')](JSON[_0x801a('0xf')]({'appID':_0x387eca,'timestamp':_0x4d0062,'appKey':_0xd0cbe4}));var _0x23d0f7=fs[_0x801a('0x10')](_0x17b9d3);_0x23d0f7['on'](_0x801a('0x11'),function(_0x2bab20){_0x1bb8eb['send'](_0x2bab20);});_0x23d0f7['on'](_0x801a('0x12'),function(){_0x1bb8eb['send'](_0x801a('0x13'));});}catch(_0x5ad6eb){logger['error'](_0x801a('0x14'),JSON['stringify'](_0x5ad6eb));_0x1bb8eb[_0x801a('0x15')]();}}function _0xfb253e(_0x5a1003){try{if(_0x5a1003){var _0x47df83=JSON[_0x801a('0x16')](_0x5a1003);switch(_0x47df83[_0x801a('0x17')]){case 0x0:if(_0x47df83[_0x801a('0x18')]){if(_0x47df83[_0x801a('0x18')]['final']){logger[_0x801a('0xc')](_0x801a('0x19'),JSON[_0x801a('0xf')](_0x47df83[_0x801a('0x18')][_0x801a('0x1a')]));_0x5bcde0=_0x47df83[_0x801a('0x18')]['hypotheses'][0x0][_0x801a('0x1b')];_0x96ee16=_0x47df83[_0x801a('0x18')][_0x801a('0x1a')][0x0]['likelihood'];_0x5ad086='0';_0x2e052f=_0x801a('0x1c');_0x1bb8eb[_0x801a('0x15')]();}}break;case 0x1:logger['info'](_0x801a('0x1d'));_0x5ad086='1';_0x2e052f=_0x801a('0x1d');break;case 0x2:logger['info'](_0x801a('0x1e'));_0x5ad086='2';_0x2e052f=_0x801a('0x1e');break;case 0x9:logger[_0x801a('0xc')](_0x801a('0x1f'));_0x5ad086='9';_0x2e052f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x801a('0xc')]('Authentication\x20failed.');_0x5ad086='10';_0x2e052f=_0x801a('0x20');break;case 0xb:logger[_0x801a('0xc')](_0x801a('0x21'));_0x5ad086='11';_0x2e052f=_0x801a('0x21');}}}catch(_0x443676){logger[_0x801a('0x22')](_0x801a('0x23'),JSON[_0x801a('0xf')](_0x443676));_0x1bb8eb[_0x801a('0x15')]();}}function _0x5601b8(){logger[_0x801a('0xc')](_0x801a('0x24'));_0x1b5ae5({'transcript':_0x5bcde0,'confidence':_0x96ee16,'status':_0x5ad086,'status_message':_0x2e052f});}function _0x4e9d99(_0xebdc23){logger[_0x801a('0x22')](_0x801a('0x25'));if(!_[_0x801a('0x26')](_0xebdc23)){logger[_0x801a('0x22')](_[_0x801a('0x27')](_0xebdc23)?JSON[_0x801a('0xf')](_0xebdc23):_0xebdc23);}}_0x1bb8eb['on'](_0x801a('0x28'),_0x100301);_0x1bb8eb['on']('message',_0xfb253e);_0x1bb8eb['on']('close',_0x5601b8);_0x1bb8eb['on'](_0x801a('0x22'),_0x4e9d99);});}; \ No newline at end of file +var _0x4639=['Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','Open\x20Tilde\x20ASR\x20socket','stringify','send','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.'];(function(_0x64c82a,_0x34e6dd){var _0x1574f7=function(_0x11fd61){while(--_0x11fd61){_0x64c82a['push'](_0x64c82a['shift']());}};_0x1574f7(++_0x34e6dd);}(_0x4639,0x1b9));var _0x9463=function(_0x30bf81,_0x4c00c5){_0x30bf81=_0x30bf81-0x0;var _0x148a30=_0x4639[_0x30bf81];return _0x148a30;};'use strict';var BPromise=require(_0x9463('0x0'));var _=require(_0x9463('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9463('0x2'));var crypto=require(_0x9463('0x3'));var logger=require(_0x9463('0x4'))('agi');module[_0x9463('0x5')]=function(_0x497152,_0xa99c24,_0x1ef9c7,_0x36ae8d){return new BPromise(function(_0x4f4baf,_0x32f219){logger[_0x9463('0x6')](_0x9463('0x7'),_0x36ae8d||_0x9463('0x8'));var _0x48d5b5=new WebSocket(_0x36ae8d||_0x9463('0x8'),{'perMessageDeflate':![]});var _0x437f73='';var _0x367b77='0';var _0x3de8aa='1';var _0x2b3a9a=_0x9463('0x9');function _0x452a39(_0x3d4f06){var _0x193032=crypto[_0x9463('0xa')](_0x9463('0xb'));_0x193032['update'](_0x3d4f06);return _0x193032['digest']('hex');}function _0x29c062(){try{logger['info'](_0x9463('0xc'));var _0xfc119d=moment()['unix']();var _0x1d0e6a=_0x452a39(_0xfc119d+_0xa99c24+_0x1ef9c7);_0x48d5b5['send'](JSON[_0x9463('0xd')]({'appID':_0xa99c24,'timestamp':_0xfc119d,'appKey':_0x1d0e6a}));var _0x13f6ee=fs['createReadStream'](_0x497152);_0x13f6ee['on']('data',function(_0x17d0cd){_0x48d5b5[_0x9463('0xe')](_0x17d0cd);});_0x13f6ee['on'](_0x9463('0xf'),function(){_0x48d5b5['send']('EOS');});}catch(_0x569d5c){logger['error'](_0x9463('0x10'),JSON[_0x9463('0xd')](_0x569d5c));_0x48d5b5[_0x9463('0x11')]();}}function _0x2b3cee(_0x4ab9e7){try{if(_0x4ab9e7){var _0xef3a7=JSON[_0x9463('0x12')](_0x4ab9e7);switch(_0xef3a7[_0x9463('0x13')]){case 0x0:if(_0xef3a7[_0x9463('0x14')]){if(_0xef3a7[_0x9463('0x14')][_0x9463('0x15')]){logger[_0x9463('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x9463('0xd')](_0xef3a7['result'][_0x9463('0x16')]));_0x437f73=_0xef3a7[_0x9463('0x14')][_0x9463('0x16')][0x0][_0x9463('0x17')];_0x367b77=_0xef3a7[_0x9463('0x14')][_0x9463('0x16')][0x0]['likelihood'];_0x3de8aa='0';_0x2b3a9a=_0x9463('0x18');_0x48d5b5['terminate']();}}break;case 0x1:logger['info'](_0x9463('0x9'));_0x3de8aa='1';_0x2b3a9a=_0x9463('0x9');break;case 0x2:logger[_0x9463('0x6')](_0x9463('0x19'));_0x3de8aa='2';_0x2b3a9a=_0x9463('0x19');break;case 0x9:logger[_0x9463('0x6')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3de8aa='9';_0x2b3a9a=_0x9463('0x1a');break;case 0xa:logger[_0x9463('0x6')](_0x9463('0x1b'));_0x3de8aa='10';_0x2b3a9a=_0x9463('0x1b');break;case 0xb:logger[_0x9463('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3de8aa='11';_0x2b3a9a=_0x9463('0x1c');}}}catch(_0x1615c8){logger[_0x9463('0x1d')](_0x9463('0x1e'),JSON[_0x9463('0xd')](_0x1615c8));_0x48d5b5[_0x9463('0x11')]();}}function _0x3ac46b(){logger[_0x9463('0x6')](_0x9463('0x1f'));_0x4f4baf({'transcript':_0x437f73,'confidence':_0x367b77,'status':_0x3de8aa,'status_message':_0x2b3a9a});}function _0x78248c(_0x48a24a){logger[_0x9463('0x1d')](_0x9463('0x20'));if(!_[_0x9463('0x21')](_0x48a24a)){logger[_0x9463('0x1d')](_['isObject'](_0x48a24a)?JSON['stringify'](_0x48a24a):_0x48a24a);}}_0x48d5b5['on'](_0x9463('0x22'),_0x29c062);_0x48d5b5['on'](_0x9463('0x23'),_0x2b3cee);_0x48d5b5['on']('close',_0x3ac46b);_0x48d5b5['on']('error',_0x78248c);});}; \ 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 0dc7543..4988482 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 _0xc84e=['./asr','exports'];(function(_0xe341c4,_0xdaa216){var _0x47174e=function(_0x297a94){while(--_0x297a94){_0xe341c4['push'](_0xe341c4['shift']());}};_0x47174e(++_0xdaa216);}(_0xc84e,0x1ca));var _0xec84=function(_0x204227,_0x4d1b12){_0x204227=_0x204227-0x0;var _0x3783a6=_0xc84e[_0x204227];return _0x3783a6;};var asr=require(_0xec84('0x0'));module[_0xec84('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd811=['./asr','exports'];(function(_0x4520c9,_0x578868){var _0x310387=function(_0x31f909){while(--_0x31f909){_0x4520c9['push'](_0x4520c9['shift']());}};_0x310387(++_0x578868);}(_0xd811,0x7e));var _0x1d81=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0xd811[_0x185832];return _0x253dda;};var asr=require(_0x1d81('0x0'));module[_0x1d81('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index a84b7da..5d59483 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 _0xc41c=['E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','createServer','listening','getConnections','E_AGI_SERVER_ERROR','destroy'];(function(_0x5ee4e2,_0x3bdcd4){var _0x5e85d4=function(_0x393da1){while(--_0x393da1){_0x5ee4e2['push'](_0x5ee4e2['shift']());}};_0x5e85d4(++_0x3bdcd4);}(_0xc41c,0x6a));var _0xcc41=function(_0xf670f0,_0x353747){_0xf670f0=_0xf670f0-0x0;var _0x3c21c6=_0xc41c[_0xf670f0];return _0x3c21c6;};'use strict';var util=require(_0xcc41('0x0'));var net=require(_0xcc41('0x1'));var EventEmitter=require('events')[_0xcc41('0x2')];var AGIError=require(_0xcc41('0x3'));var AGIChannel=require(_0xcc41('0x4'));var AGIServer=function(_0x9c082a,_0x2c8e80,_0xf26592){var _0x47f108=this,_0x9c082a=_0x9c082a||0x11dd,_0x2c8e80=_0x2c8e80||_0xcc41('0x5'),_0x23dd6a=null,_0x235b00=0x0;EventEmitter[_0xcc41('0x6')](_0x47f108);function _0x2ae9eb(){if(!_0x9c082a){_0x47f108[_0xcc41('0x7')](_0xcc41('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x23dd6a=net[_0xcc41('0x9')]();_0x23dd6a['listen'](_0x9c082a,_0x2c8e80);_0x23dd6a['on'](_0xcc41('0xa'),function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0xa'));});_0x23dd6a['on']('connection',function(_0x43bab3){_0x23dd6a[_0xcc41('0xb')](function(_0x177f63,_0xb2a282){if(_0x177f63){_0x47f108[_0xcc41('0x7')](_0xcc41('0x8'),new AGIError(_0xcc41('0xc'),_0x177f63));}else if(_0xf26592&&_0xf26592<0x0){_0x47f108[_0xcc41('0x7')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x43bab3[_0xcc41('0xd')]();}else if(_0xf26592&&_0xf26592>0x0&&_0xf26592<_0xb2a282){_0x235b00+=0x1;_0x47f108[_0xcc41('0x7')]('error',new AGIError(_0xcc41('0xe'),_0x235b00));_0x43bab3[_0xcc41('0xd')]();}else{var _0x8ae82d=new AGIChannel(_0x43bab3);_0x8ae82d['on']('ready',function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0xf'),_0x8ae82d);});}});});_0x23dd6a['on'](_0xcc41('0x8'),function(_0x16b807){_0x47f108[_0xcc41('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x16b807[_0xcc41('0x10')]));});_0x23dd6a['on'](_0xcc41('0x11'),function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0x11'),new AGIError(_0xcc41('0x12')));});}process[_0xcc41('0x13')](function(){_0x2ae9eb();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x265ad3,_0x2b2a8f,_0x3d8a99){return new AGIServer(_0x265ad3,_0x2b2a8f,_0x3d8a99);}; \ No newline at end of file +var _0x72e1=['127.0.0.1','call','emit','error','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','exports','util','net','events','EventEmitter','./error','./channel'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x72e1,0x6d));var _0x172e=function(_0x62dd40,_0x5e0390){_0x62dd40=_0x62dd40-0x0;var _0x13d8be=_0x72e1[_0x62dd40];return _0x13d8be;};'use strict';var util=require(_0x172e('0x0'));var net=require(_0x172e('0x1'));var EventEmitter=require(_0x172e('0x2'))[_0x172e('0x3')];var AGIError=require(_0x172e('0x4'));var AGIChannel=require(_0x172e('0x5'));var AGIServer=function(_0x5a18a7,_0x2fde38,_0x25a850){var _0x5095f7=this,_0x5a18a7=_0x5a18a7||0x11dd,_0x2fde38=_0x2fde38||_0x172e('0x6'),_0x169818=null,_0xc4646f=0x0;EventEmitter[_0x172e('0x7')](_0x5095f7);function _0x3f47b7(){if(!_0x5a18a7){_0x5095f7[_0x172e('0x8')](_0x172e('0x9'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x169818=net[_0x172e('0xa')]();_0x169818[_0x172e('0xb')](_0x5a18a7,_0x2fde38);_0x169818['on']('listening',function(){_0x5095f7[_0x172e('0x8')](_0x172e('0xc'));});_0x169818['on'](_0x172e('0xd'),function(_0x2df67a){_0x169818['getConnections'](function(_0x2196df,_0x357e1b){if(_0x2196df){_0x5095f7[_0x172e('0x8')](_0x172e('0x9'),new AGIError(_0x172e('0xe'),_0x2196df));}else if(_0x25a850&&_0x25a850<0x0){_0x5095f7[_0x172e('0x8')]('error',new AGIError(_0x172e('0xf')));_0x2df67a[_0x172e('0x10')]();}else if(_0x25a850&&_0x25a850>0x0&&_0x25a850<_0x357e1b){_0xc4646f+=0x1;_0x5095f7[_0x172e('0x8')](_0x172e('0x9'),new AGIError(_0x172e('0x11'),_0xc4646f));_0x2df67a[_0x172e('0x10')]();}else{var _0x42be0f=new AGIChannel(_0x2df67a);_0x42be0f['on'](_0x172e('0x12'),function(){_0x5095f7[_0x172e('0x8')]('connection',_0x42be0f);});}});});_0x169818['on'](_0x172e('0x9'),function(_0x4a6e47){_0x5095f7[_0x172e('0x8')](_0x172e('0x9'),new AGIError(_0x172e('0xe'),_0x4a6e47[_0x172e('0x13')]));});_0x169818['on'](_0x172e('0x14'),function(){_0x5095f7[_0x172e('0x8')](_0x172e('0x14'),new AGIError(_0x172e('0x15')));});}process['nextTick'](function(){_0x3f47b7();});};util['inherits'](AGIServer,EventEmitter);module[_0x172e('0x16')]=function(_0x19d6ae,_0x162c6f,_0x5016b0){return new AGIServer(_0x19d6ae,_0x162c6f,_0x5016b0);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 91c6732..020ed90 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 _0xd4d1=['Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','noop','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','SIP/%s','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','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','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','service','host','port','secure','authentication','auth','pass','template_id','debug','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\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','googleTTS','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','path','util','lodash','shelljs','odbc','moment','request-promise','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','rpc','mailRpc','prototype','getVariableById','then','name','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','phone','timezones','utcOffset','scheduledat','add','minutes','insertContact','getPause','agentPause','agentUnpause','agent','error','agentLogout','internal','%s/%s@from-sip/n','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','google_tts_language','restAPI','method','timeout','number','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','no\x20text\x20configured','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog'];(function(_0x27d9eb,_0x42276c){var _0x360665=function(_0xeddd30){while(--_0xeddd30){_0x27d9eb['push'](_0x27d9eb['shift']());}};_0x360665(++_0x42276c);}(_0xd4d1,0x123));var _0x1d4d=function(_0x18a098,_0x248e70){_0x18a098=_0x18a098-0x0;var _0x292df6=_0xd4d1[_0x18a098];return _0x292df6;};'use strict';var fs=require('fs');var path=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var _=require(_0x1d4d('0x2'));var sh=require(_0x1d4d('0x3'));var odbc=require(_0x1d4d('0x4'))();var rs=require('randomstring');var moment=require(_0x1d4d('0x5'));var Mustache=require('mustache');var rp=require(_0x1d4d('0x6'));var logger=require('../../config/logger')(_0x1d4d('0x7'));var config=require('../../config/environment');var shared=require(_0x1d4d('0x8'));var scripts=require(_0x1d4d('0x9'));var FILES_PATH=_0x1d4d('0xa');var recursiveMapAttributes=['rawHeaders',_0x1d4d('0xb')];var verticesWithRetry=['menu',_0x1d4d('0xc'),'getsecretdigits'];var AGIVertices=function(_0x46c8f6,_0x2b72da,_0x324f5b){this['channel']=_0x46c8f6;this[_0x1d4d('0xd')]=_0x2b72da;this[_0x1d4d('0xe')]=_0x324f5b;};AGIVertices[_0x1d4d('0xf')]['getVariable']=function(_0x448c4e,_0x338a05){this[_0x1d4d('0xd')][_0x1d4d('0x10')](_0x448c4e)[_0x1d4d('0x11')](function(_0x9f5623){_0x338a05(null,_0x9f5623?_0x9f5623[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x1dc105){_0x338a05(_0x1dc105);});};AGIVertices[_0x1d4d('0xf')]['getVoiceQueue']=function(_0x2941e6,_0x4561e3){this['rpc']['getVoiceQueueById'](_0x2941e6)['then'](function(_0x14a98c){_0x4561e3(null,_0x14a98c?_0x14a98c['name']:![]);})[_0x1d4d('0x13')](function(_0x59de78){_0x4561e3(_0x59de78);});};AGIVertices['prototype'][_0x1d4d('0x14')]=function(_0x9469d3,_0x566807){this[_0x1d4d('0xd')]['getSquareProjectById'](_0x9469d3)[_0x1d4d('0x11')](function(_0x1b591b){_0x566807(null,_0x1b591b?_0x1b591b[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x470935){_0x566807(_0x470935);});};AGIVertices['prototype'][_0x1d4d('0x15')]=function(_0x37b6d3,_0x4b43ba){this['rpc'][_0x1d4d('0x16')](_0x37b6d3)[_0x1d4d('0x11')](function(_0x3a2f35){_0x4b43ba(null,_0x3a2f35?_0x3a2f35['dsn']:![]);})['catch'](function(_0x5500e8){_0x4b43ba(_0x5500e8);});};AGIVertices['prototype'][_0x1d4d('0x17')]=function(_0x227278,_0x321e00){this['rpc'][_0x1d4d('0x18')](_0x227278)['then'](function(_0x4b985b){_0x321e00(null,_0x4b985b?_0x4b985b[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x544f7a){_0x321e00(_0x544f7a);});};AGIVertices['prototype'][_0x1d4d('0x19')]=function(_0x41b7b2,_0x28f827){this[_0x1d4d('0xd')]['getTrunkById'](_0x41b7b2)[_0x1d4d('0x11')](function(_0x2b1b8b){_0x28f827(null,_0x2b1b8b?_0x2b1b8b[_0x1d4d('0x12')]:![]);})['catch'](function(_0x310ec0){_0x28f827(_0x310ec0);});};AGIVertices['prototype']['getSound']=function(_0x1a0cd3,_0x9cb611){var _0x2e1955=this;this[_0x1d4d('0xd')][_0x1d4d('0x1a')](_0x1a0cd3)['then'](function(_0xc9f05b){_0x9cb611(null,_0xc9f05b?_0x2e1955[_0x1d4d('0x1b')](_0xc9f05b['save_name']):![]);})[_0x1d4d('0x13')](function(_0x30a08d){_0x9cb611(_0x30a08d);});};AGIVertices['prototype'][_0x1d4d('0x1c')]=function(_0x18bb03,_0x89cd09){this[_0x1d4d('0xd')][_0x1d4d('0x1d')](_0x18bb03)[_0x1d4d('0x11')](function(_0x221463){_0x89cd09(null,_0x221463?_0x221463:![]);})['catch'](function(_0x2ba411){_0x89cd09(_0x2ba411);});};AGIVertices[_0x1d4d('0xf')]['sendMailMessage']=function(_0x3b63fd,_0x5b99eb,_0x10338b){this[_0x1d4d('0xe')][_0x1d4d('0x1e')](_0x3b63fd,_0x5b99eb)[_0x1d4d('0x11')](function(){_0x10338b(null);})[_0x1d4d('0x13')](function(_0x1df322){_0x10338b(_0x1df322);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1f')]=function(_0x3cf167,_0x5e81d1){this['rpc'][_0x1d4d('0x20')](_0x3cf167)['then'](function(_0x2765dc){if(_0x2765dc){if(_0x2765dc[_0x1d4d('0x21')]){_0x5e81d1(null,[_0x2765dc[_0x1d4d('0x22')]]);}else{_0x5e81d1(null,_[_0x1d4d('0x23')](_0x2765dc[_0x1d4d('0x24')],_0x1d4d('0x22')));}}else{_0x5e81d1(null,![]);}})[_0x1d4d('0x13')](function(_0x3146a3){_0x5e81d1(_0x3146a3);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1b')]=function(_0x29bfc0){return util[_0x1d4d('0x25')](_0x1d4d('0x26'),FILES_PATH,_0x29bfc0);};AGIVertices['prototype'][_0x1d4d('0x27')]=function(_0x534ac8,_0x1fc1c6,_0xc74357){odbc['open'](_0x534ac8,function(_0x3e24b3){if(_0x3e24b3){logger['error'](_0x1d4d('0x28'),_0x3e24b3);_0xc74357(_0x3e24b3);}else{logger[_0x1d4d('0x29')](_0x1d4d('0x2a'));odbc[_0x1d4d('0x2b')](_0x1fc1c6,function(_0x49fbb6,_0x24cc17){if(_0x49fbb6){logger[_0x1d4d('0x29')]('Error\x20executing\x20query\x20%s',_0x1fc1c6);_0xc74357(_0x49fbb6);}else{logger[_0x1d4d('0x29')](_0x1d4d('0x2c'),_0x1fc1c6);odbc[_0x1d4d('0x2d')](function(_0x422c72){if(_0x422c72){logger['error'](_0x1d4d('0x2e'),_0x422c72);}_0xc74357(null,_0x24cc17);});}});}});};AGIVertices['prototype'][_0x1d4d('0x2f')]=function(_0x1e9434,_0x7b40b0){this['rpc']['getSmsAccountById'](_0x1e9434)[_0x1d4d('0x11')](function(_0x108ded){_0x7b40b0(null,_0x108ded?_0x108ded:![]);})['catch'](function(_0x2eb4c0){_0x7b40b0(_0x2eb4c0);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x30')]=function(_0x2b9c38,_0x438ec7){this[_0x1d4d('0xd')]['createSmsMessage'](_0x2b9c38)[_0x1d4d('0x11')](function(_0x3d3010){_0x438ec7(null,_0x3d3010);})[_0x1d4d('0x13')](function(_0x4c028f){_0x438ec7(_0x4c028f);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x31')]=function(_0x5e171e,_0xf975d6,_0x148bd6){this[_0x1d4d('0xd')][_0x1d4d('0x31')]({'uniqueid':this['channel']['uniqueid'],'node':_0x5e171e['label'],'application':_0x5e171e['agicommand'],'data':_0xf975d6||null,'project_name':this[_0x1d4d('0x32')][_0x1d4d('0x33')],'callerid':this[_0x1d4d('0x32')][_0x1d4d('0x34')]})[_0x1d4d('0x11')](function(_0x34ef4b){if(_0x148bd6){_0x148bd6(null,_0x34ef4b);}})[_0x1d4d('0x13')](function(_0x3c3bc0){if(_0x148bd6){_0x148bd6(_0x3c3bc0);}});};AGIVertices['prototype'][_0x1d4d('0x35')]=function(_0x4700f3,_0x20e064,_0xb5a76f,_0x5e16a1){this[_0x1d4d('0xd')][_0x1d4d('0x35')]({'uniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'callerid':this[_0x1d4d('0x32')][_0x1d4d('0x34')],'calleridname':this['channel'][_0x1d4d('0x37')],'context':this[_0x1d4d('0x32')][_0x1d4d('0x38')],'extension':this['channel'][_0x1d4d('0x39')],'priority':this['channel']['priority'],'accountcode':this[_0x1d4d('0x32')][_0x1d4d('0x3a')],'dnid':this['channel']['dnid'],'projectName':this[_0x1d4d('0x32')]['arg_1'],'saveName':_0x20e064,'filename':_0x4700f3[_0x1d4d('0x3b')]||_0x20e064,'savePath':_0xb5a76f})[_0x1d4d('0x11')](function(_0x9dd1a5){_0x5e16a1(null,_0x9dd1a5);})[_0x1d4d('0x13')](function(_0x5ae8aa){_0x5e16a1(_0x5ae8aa);});};AGIVertices[_0x1d4d('0xf')]['createSquareMessage']=function(_0x4afb4b,_0x5424a8,_0x41cd94,_0x300df2,_0x11fd27){this[_0x1d4d('0xd')][_0x1d4d('0x3c')]({'uniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'body':_0x4afb4b,'direction':_0x5424a8,'providerName':_0x41cd94,'providerResponse':_0x300df2})[_0x1d4d('0x11')](function(_0x32b3c4){if(_0x11fd27){_0x11fd27(null,_0x32b3c4);}})[_0x1d4d('0x13')](function(_0x28ea46){if(_0x11fd27){_0x11fd27(_0x28ea46);}});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x3d')]=function(_0x3b84ce,_0x50fd38){var _0x5ed40f=this;var _0x34da01=0x0;var _0x6a0612={'firstName':_[_0x1d4d('0x3e')](_0x3b84ce[_0x1d4d('0x12')])||_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x12')])?_0x1d4d('0x40')+Math['random']():_0x3b84ce['name'],'lastName':_[_0x1d4d('0x3e')](_0x3b84ce['lastName'])||_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x41')])?null:_0x3b84ce['lastName'],'phone':_0x3b84ce['phone'],'ListId':_0x3b84ce[_0x1d4d('0x42')],'scheduledat':_0x3b84ce[_0x1d4d('0x43')],'callbackUniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'tags':'callback','description':_0x1d4d('0x44')+_0x3b84ce['scheduledAt'][_0x1d4d('0x45')](),'priority':_0x3b84ce[_0x1d4d('0x46')]};if(_[_0x1d4d('0x47')](_0x3b84ce,_0x1d4d('0x48'))){if(!_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x48')])){var _0x4bc657=_0x3b84ce[_0x1d4d('0x48')];if(_0x3b84ce['dialTimezone']=='CALLERID(dialTimezone)'){this[_0x1d4d('0xd')]['getContactByPhone']({'phone':_0x3b84ce[_0x1d4d('0x49')]})[_0x1d4d('0x11')](function(_0x744dd2){if(!_[_0x1d4d('0x3f')](_0x744dd2)){var _0x13dd96=_0x744dd2[_0x1d4d('0x48')];if(!_['isNil'](_0x13dd96)){var _0xc071d9=shared[_0x1d4d('0x4a')][_0x13dd96];if(!_[_0x1d4d('0x3f')](_0xc071d9)){var _0x1e4d91=-0x1*_0xc071d9[_0x1d4d('0x4b')];_0x6a0612[_0x1d4d('0x4c')]=moment(_0x3b84ce['scheduledat'])[_0x1d4d('0x4d')](_0x1e4d91,_0x1d4d('0x4e'));_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}});}else{var _0x34da01=shared[_0x1d4d('0x4a')][_0x4bc657];if(!_['isNil'](_0x34da01)){var _0x1ad0b7=-0x1*_0x34da01[_0x1d4d('0x4b')];_0x6a0612[_0x1d4d('0x4c')]=moment(_0x3b84ce[_0x1d4d('0x4c')])[_0x1d4d('0x4d')](_0x1ad0b7,_0x1d4d('0x4e'));_0x5ed40f['insertContact'](_0x6a0612,_0x3b84ce,_0x50fd38);}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x50')]=function(_0x29739f,_0x50055d){this[_0x1d4d('0xd')]['getPauseById'](_0x29739f)['then'](function(_0xa1012d){_0x50055d(null,_0xa1012d?_0xa1012d[_0x1d4d('0x12')]:![]);})['catch'](function(_0xc8316a){_0x50055d(_0xc8316a);});};AGIVertices['prototype'][_0x1d4d('0x51')]=function(_0x447e8e,_0x13b0db,_0xba4d55){var _0x5a9cdc={'role':'agent'};_0x5a9cdc[_0x447e8e]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];this[_0x1d4d('0xd')][_0x1d4d('0x51')](_0x5a9cdc,_0x13b0db,this[_0x1d4d('0x32')][_0x1d4d('0x36')])[_0x1d4d('0x11')](function(_0x5593b2){_0xba4d55(null,_['isNil'](_0x5593b2)?![]:!![]);})['catch'](function(_0x469f16){logger['error'](_0x469f16);_0xba4d55(null,![]);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x52')]=function(_0x57a8ad,_0x3776bc){var _0x241546={'role':_0x1d4d('0x53')};_0x241546[_0x57a8ad]=this[_0x1d4d('0x32')]['callerid'];this['rpc']['agentUnpause'](_0x241546)[_0x1d4d('0x11')](function(_0x23d621){_0x3776bc(null,_['isNil'](_0x23d621)?![]:!![]);})[_0x1d4d('0x13')](function(_0x3b1e32){logger[_0x1d4d('0x54')](_0x3b1e32);_0x3776bc(null,![]);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x55')]=function(_0x2f2b6d,_0xc6a7f8){var _0x36bd1e={'role':_0x1d4d('0x53')};_0x36bd1e[_0x2f2b6d]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];this[_0x1d4d('0xd')][_0x1d4d('0x55')](_0x36bd1e)[_0x1d4d('0x11')](function(_0x44a0f8){_0xc6a7f8(null,_[_0x1d4d('0x3f')](_0x44a0f8)?![]:!![]);})[_0x1d4d('0x13')](function(_0x9fd657){logger[_0x1d4d('0x54')](_0x9fd657);_0xc6a7f8(null,![]);});};AGIVertices[_0x1d4d('0xf')]['agentLogin']=function(_0x23dce0,_0x5122f8){var _0x1e0aee={'role':_0x1d4d('0x53')};_0x1e0aee[_0x23dce0]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];var _0x1829ce=_0x23dce0!=_0x1d4d('0x56')?util[_0x1d4d('0x25')](_0x1d4d('0x57'),'LOCAL',this['channel'][_0x1d4d('0x34')]):undefined;this[_0x1d4d('0xd')]['agentLogin'](_0x1e0aee,_0x1829ce)[_0x1d4d('0x11')](function(_0x737b8){_0x5122f8(null,_[_0x1d4d('0x3f')](_0x737b8)?![]:!![]);})[_0x1d4d('0x13')](function(_0xc593ef){logger['error'](_0xc593ef);_0x5122f8(null,![]);});};AGIVertices['prototype'][_0x1d4d('0x58')]=function(_0x384c46,_0x3a1c48){sh['exec'](_['trim'](_0x384c46),function(_0x443cc4,_0x71162){var _0x3a4025=_0x71162[_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'');_0x3a1c48(null,_0x3a4025);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4ae1e8,_0x13b20d){scripts[_0x1d4d('0x5a')](_0x4ae1e8['apiKey'],_0x4ae1e8[_0x1d4d('0x5b')]||_0x1d4d('0x5c'),_0x4ae1e8[_0x1d4d('0x5c')],_0x4ae1e8[_0x1d4d('0x5d')]||_0x1d4d('0x5e'),_0x4ae1e8[_0x1d4d('0x5f')]||'MALE',_0x4ae1e8[_0x1d4d('0x60')]||_0x1d4d('0x61'))[_0x1d4d('0x11')](function(_0x58c0b6){_0x13b20d(null,_0x58c0b6);})[_0x1d4d('0x13')](function(_0x56e541){_0x13b20d(_0x56e541);});};AGIVertices[_0x1d4d('0xf')]['googleTTS']=function(_0x564d9e,_0x33c62d){scripts['googleTTS'](_0x564d9e['text'],_0x564d9e[_0x1d4d('0x62')]||'en',0x1)[_0x1d4d('0x11')](function(_0x42f756){_0x33c62d(null,_0x42f756);})[_0x1d4d('0x13')](function(_0x26a98c){_0x33c62d(_0x26a98c);});};AGIVertices['prototype'][_0x1d4d('0x63')]=function(_0x534597,_0x1c1c22){var _0x268b86={'uri':_0x534597['url'],'method':_0x534597[_0x1d4d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x534597[_0x1d4d('0x65')])===_0x1d4d('0x66')&&parseInt(_0x534597[_0x1d4d('0x65')])>=0x1?parseInt(_0x534597['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x1d4d('0x67'),'PUT'],_0x268b86[_0x1d4d('0x64')]['toUpperCase']())){try{_0x268b86[_0x1d4d('0x68')]=_0x534597[_0x1d4d('0xb')]?JSON[_0x1d4d('0x69')](_0x534597[_0x1d4d('0xb')]):{};}catch(_0x338e5f){logger[_0x1d4d('0x54')](_0x1d4d('0x6a'),_0x338e5f);}}try{_0x268b86[_0x1d4d('0x6b')]=_0x534597[_0x1d4d('0x6c')]?JSON[_0x1d4d('0x69')](_0x534597[_0x1d4d('0x6c')]):{};}catch(_0xce1df0){logger['error'](_0x1d4d('0x6d'),_0xce1df0);}if(_0x534597[_0x1d4d('0x6e')]){try{var _0x414493=require(_0x534597[_0x1d4d('0x6e')])['sync'](this,_0x268b86);_0x268b86[_0x1d4d('0x6f')]=Mustache[_0x1d4d('0x70')](_0x534597[_0x1d4d('0x71')],_0x414493,{},['$$','$$']);if(_0x268b86['headers']){_0x268b86[_0x1d4d('0x6b')]=JSON['parse'](Mustache[_0x1d4d('0x70')](JSON[_0x1d4d('0x72')](_0x268b86[_0x1d4d('0x6b')]),_0x414493,{},['$$','$$']));}if(_0x268b86[_0x1d4d('0x68')]){_0x268b86[_0x1d4d('0x68')]=JSON['parse'](Mustache[_0x1d4d('0x70')](JSON['stringify'](_0x268b86[_0x1d4d('0x68')]),_0x414493,{},['$$','$$']));}}catch(_0x3308e8){logger[_0x1d4d('0x54')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3308e8);}}rp(_0x268b86)[_0x1d4d('0x11')](function(_0x5740e8){var _0x441d07={'statusCode':_0x5740e8[_0x1d4d('0x73')]||0xc8,'statusMessage':_0x5740e8[_0x1d4d('0x74')]||'OK','headers':_0x5740e8[_0x1d4d('0x6b')]||{},'body':_0x5740e8[_0x1d4d('0x68')]||{}};_0x1c1c22(null,_0x441d07);})[_0x1d4d('0x13')](function(_0x59d5e8){var _0x2d26d9={'statusCode':_0x59d5e8[_0x1d4d('0x73')]||0x1f4,'statusMessage':_0x59d5e8[_0x1d4d('0x75')]||_0x1d4d('0x76'),'headers':_0x59d5e8[_0x1d4d('0x77')][_0x1d4d('0x6b')]||{},'body':_0x59d5e8[_0x1d4d('0x77')][_0x1d4d('0x68')]||{}};_0x1c1c22(null,_0x2d26d9);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x78')]=function(_0x193fe4,_0x263664){scripts[_0x1d4d('0x78')](this[_0x1d4d('0x32')][_0x1d4d('0x36')],_0x193fe4['key'],_0x193fe4[_0x1d4d('0x5c')],_0x193fe4[_0x1d4d('0x79')]||'en')['then'](function(_0x3cd114){_0x263664(null,_0x3cd114);})['catch'](function(_0x314b61){_0x263664(_0x314b61);});};AGIVertices[_0x1d4d('0xf')]['googleDialogflowV2']=function(_0x3274d9,_0x151f26){scripts[_0x1d4d('0x7a')](this[_0x1d4d('0x32')][_0x1d4d('0x36')],_0x3274d9['dialogflowV2_project_id'],_0x3274d9[_0x1d4d('0x7b')],_0x3274d9[_0x1d4d('0x7c')],_0x3274d9[_0x1d4d('0x5c')],_0x3274d9[_0x1d4d('0x7d')]||'en')['then'](function(_0x1c1e26){_0x151f26(null,_0x1c1e26);})[_0x1d4d('0x13')](function(_0x1664e6){_0x151f26(_0x1664e6);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7e')]=function(_0x1aa09f,_0x1ffb9b){scripts['sestekNDA'](this[_0x1d4d('0x32')],_0x1aa09f)[_0x1d4d('0x11')](function(_0x5ec254){_0x1ffb9b(null,_0x5ec254);})[_0x1d4d('0x13')](function(_0x1b7713){_0x1ffb9b(_0x1b7713);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7f')]=function(_0x183bea,_0x2cf6f7){scripts['ispeechTTS'](_0x183bea[_0x1d4d('0x80')],_0x183bea[_0x1d4d('0x5c')],_0x183bea[_0x1d4d('0x81')]||_0x1d4d('0x5e'),_0x183bea[_0x1d4d('0x82')])[_0x1d4d('0x11')](function(_0x49d726){_0x2cf6f7(null,_0x49d726);})[_0x1d4d('0x13')](function(_0x20a539){_0x2cf6f7(_0x20a539);});};AGIVertices['prototype'][_0x1d4d('0x83')]=function(_0x47f4a0,_0x19b6b6,_0x4b4d63){scripts[_0x1d4d('0x83')](_0x19b6b6,_0x47f4a0[_0x1d4d('0x80')],_0x47f4a0[_0x1d4d('0x84')]||_0x1d4d('0x5e'),this[_0x1d4d('0x85')](_0x47f4a0[_0x1d4d('0x86')])?_0x47f4a0[_0x1d4d('0x86')]:undefined)['then'](function(_0x16e1ec){_0x4b4d63(null,_0x16e1ec);})['catch'](function(_0x56a7cc){_0x4b4d63(_0x56a7cc);});};AGIVertices['prototype'][_0x1d4d('0x87')]=function(_0x22bcf4,_0x42f841){scripts[_0x1d4d('0x87')](_0x22bcf4[_0x1d4d('0x88')],_0x22bcf4['aws_secret_access_key'],_0x22bcf4[_0x1d4d('0x89')],_0x22bcf4['aws_polly_voice']||_0x1d4d('0x8a'),_0x22bcf4['text'],_0x22bcf4[_0x1d4d('0x8b')]||_0x1d4d('0x5c'))[_0x1d4d('0x11')](function(_0x4624aa){_0x42f841(null,_0x4624aa);})[_0x1d4d('0x13')](function(_0x1e33b2){_0x42f841(_0x1e33b2);});};AGIVertices[_0x1d4d('0xf')]['awsLex']=function(_0x414c03,_0x3e18d8){scripts['awsLex'](this[_0x1d4d('0x32')]['uniqueid'],_0x414c03['aws_access_key_id'],_0x414c03['aws_secret_access_key'],_0x414c03['aws_lex_region'],_0x414c03[_0x1d4d('0x5c')],_0x414c03[_0x1d4d('0x8c')])[_0x1d4d('0x11')](function(_0x58f26c){_0x3e18d8(null,_0x58f26c);})[_0x1d4d('0x13')](function(_0x24a614){_0x3e18d8(_0x24a614);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x8d')]=function(_0x6814f,_0x571a5a,_0x221022){scripts[_0x1d4d('0x8d')](_0x571a5a,_0x6814f[_0x1d4d('0x80')],_0x6814f[_0x1d4d('0x8e')]||'en-US')[_0x1d4d('0x11')](function(_0x10737d){_0x221022(null,_0x10737d);})[_0x1d4d('0x13')](function(_0x3177cf){_0x221022(_0x3177cf);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x8f')]=function(_0x3b7c50,_0x275f4d,_0x146977){scripts[_0x1d4d('0x8f')](_0x275f4d,_0x3b7c50[_0x1d4d('0x90')],_0x3b7c50[_0x1d4d('0x91')],_0x3b7c50[_0x1d4d('0x6f')])[_0x1d4d('0x11')](function(_0x5a3252){_0x146977(null,_0x5a3252);})[_0x1d4d('0x13')](function(_0x45a380){_0x146977(_0x45a380);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x92')]=function(_0x3a1e00){var _0x2941aa=_['includes'](verticesWithRetry,_0x3a1e00['agicommand'])?_0x3a1e00:_[_0x1d4d('0x93')](_0x3a1e00);for(var _0x3938b2 in _0x2941aa){if(_0x2941aa['hasOwnProperty'](_0x3938b2)){if(_0x2941aa[_0x3938b2]&&_['isString'](_0x2941aa[_0x3938b2])){if(_[_0x1d4d('0x94')](recursiveMapAttributes,_0x3938b2)){_0x2941aa[_0x3938b2]=this[_0x1d4d('0x95')](_0x2941aa[_0x3938b2]);}else{_0x2941aa[_0x3938b2]=this[_0x1d4d('0x96')](_0x2941aa[_0x3938b2]);}}}}return _0x2941aa;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x97')]=function(_0x1742de){for(var _0x1ce5bd in _0x1742de){if(_0x1742de[_0x1d4d('0x98')](_0x1ce5bd)){if(_[_0x1d4d('0x99')](_0x1742de[_0x1ce5bd])){this[_0x1d4d('0x97')](_0x1742de[_0x1ce5bd]);}else if(_[_0x1d4d('0x9a')](_0x1742de[_0x1ce5bd])){for(var _0x479821=0x0;_0x479821<_0x1742de[_0x1ce5bd][_0x1d4d('0x9b')];_0x479821++){this[_0x1d4d('0x97')](_0x1742de[_0x1ce5bd][_0x479821]);}}else if(_[_0x1d4d('0x9c')](_0x1742de[_0x1ce5bd])){_0x1742de[_0x1ce5bd]=this[_0x1d4d('0x96')](_0x1742de[_0x1ce5bd]);}}}};AGIVertices['prototype'][_0x1d4d('0x9d')]=function(_0x5b085f,_0x52573e){for(var _0x34a2b1 in _0x5b085f){if(_0x5b085f[_0x1d4d('0x98')](_0x34a2b1)){if(_[_0x1d4d('0x99')](_0x5b085f[_0x34a2b1])){if(!_[_0x1d4d('0x3e')](_0x5b085f[_0x34a2b1])){this['saveRestApiResult'](_0x5b085f[_0x34a2b1],util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1));}}else if(_[_0x1d4d('0x9a')](_0x5b085f[_0x34a2b1])){for(var _0x5350d7=0x0;_0x5350d7<_0x5b085f[_0x34a2b1]['length'];_0x5350d7++){this[_0x1d4d('0x9d')](_0x5b085f[_0x34a2b1][_0x5350d7],util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1+'['+_0x5350d7+']'));}}else{if(!_[_0x1d4d('0x3f')](_0x5b085f[_0x34a2b1])){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1),_0x5b085f[_0x34a2b1]);}}}}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x95')]=function(_0x4c4070){try{var _0x5c6cc5=JSON[_0x1d4d('0x69')](_0x4c4070);this['recursiveNodeIndex'](_0x5c6cc5);return JSON[_0x1d4d('0x72')](_0x5c6cc5);}catch(_0x58890c){return this['replaceAllVariables'](_0x4c4070);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x96')]=function(_0x408e6f){var _0x6ebda4=_0x408e6f[_0x1d4d('0xa0')]('{');for(var _0x57ba17=0x1;_0x57ba17<_0x6ebda4['length'];_0x57ba17+=0x1){var _0x228a2a=_0x6ebda4[_0x57ba17][_0x1d4d('0xa0')]('}');if(_0x228a2a[_0x1d4d('0x9b')]>0x1){_0x408e6f=_0x408e6f[_0x1d4d('0xa1')]('{'+_0x228a2a[0x0]+'}',this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x228a2a[0x0])[_0x1d4d('0xa3')]||_0x228a2a[0x0]);}}if(_0x6ebda4['length']===0x1){return _0x408e6f[_0x1d4d('0x45')]();}return this[_0x1d4d('0x96')](_0x408e6f);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xa4')]=function(_0x1f492a,_0x1e0f6a){var _0x2bcae7=this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x1f492a);if(_0x2bcae7[_0x1d4d('0xa5')]===-0x1){return _0x2bcae7;}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xa6'),_0x1e0f6a,_0x2bcae7[_0x1d4d('0xa3')]));return this['channel'][_0x1d4d('0x9f')](_0x1e0f6a,_0x2bcae7['extra']);};AGIVertices['prototype'][_0x1d4d('0x85')]=function(_0x565a30){return _0x565a30&&_0x565a30!=='0'&&_0x565a30!=='-1'&&_0x565a30!=='';};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xa7')]=function(_0x3b4531){this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3b4531,'-');_0x3b4531[_0x1d4d('0xa9')]=_0x3b4531['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xaa')]=function(_0xcd2413){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xcd2413['label']));if(!this[_0x1d4d('0x85')](_0xcd2413[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xab'));}var _0x12d6f3='\x22'+_0xcd2413['text']+'\x22';if(this['isConfigured'](_0xcd2413[_0x1d4d('0x77')])){_0x12d6f3+=','+_0xcd2413[_0x1d4d('0x77')];}var _0x36bdc1=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('MRCPSynth',_0x12d6f3);if(_0x36bdc1[_0x1d4d('0xa5')]===-0x1){return _0x36bdc1;}return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xad'),_0x12d6f3));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xae')]=function(_0x2ee361){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xaf'),_0x2ee361[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2ee361[_0x1d4d('0xb1')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20grammar\x20configured');}var _0xaee551=_0x2ee361[_0x1d4d('0xb1')];if(this[_0x1d4d('0x85')](_0x2ee361[_0x1d4d('0x77')])){_0xaee551+=','+_0x2ee361['options'];}var _0x4c6e22=this[_0x1d4d('0x32')]['exec'](_0x1d4d('0xb3'),_0xaee551);if(_0x4c6e22[_0x1d4d('0xa5')]===-0x1){return _0x4c6e22;}var _0x59a0b3=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xb5'));if(_0x59a0b3[_0x1d4d('0xa5')]===-0x1){return _0x59a0b3;}var _0x48beef=this[_0x1d4d('0xa4')](_0x1d4d('0xb6'),_0x1d4d('0xb7'));if(_0x48beef[_0x1d4d('0xa5')]===-0x1){return _0x48beef;}var _0x3ad3b7=this[_0x1d4d('0xa4')](_0x1d4d('0xb8'),'MRCP_RECOG_INSTANCE');if(_0x3ad3b7[_0x1d4d('0xa5')]===-0x1){return _0x3ad3b7;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xb9'),_0xaee551));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7')]=function(_0x5da7a6){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xba'),_0x5da7a6[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x7')]([_0x5da7a6[_0x1d4d('0xbb')],_0x5da7a6[_0x1d4d('0xbc')]]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xbd')]=function(_0x280d84){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x280d84[_0x1d4d('0xb0')]));if(this[_0x1d4d('0x85')](_0x280d84[_0x1d4d('0x65')])){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xbe'),_0x280d84['timeout']));var _0x46e547=this[_0x1d4d('0x32')][_0x1d4d('0xbf')](_0x280d84[_0x1d4d('0x65')]);if(_0x46e547['result']===-0x1){return _0x46e547;}}return this[_0x1d4d('0x32')][_0x1d4d('0xbd')]();};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc0')]=function(_0x10079){logger[_0x1d4d('0x29')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x10079['label']));if(!this[_0x1d4d('0x85')](_0x10079['list_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x10079,_0x1d4d('0xc1'));}_0x10079['scheduledAt']=moment();if(this[_0x1d4d('0x85')](_0x10079['delay'])){_0x10079['scheduledAt']=moment()[_0x1d4d('0x4d')](_0x10079[_0x1d4d('0xc2')],_0x1d4d('0x4e'));}if(!this[_0x1d4d('0x85')](_0x10079['callback_priority'])){_0x10079[_0x1d4d('0x46')]=0x2;}this[_0x1d4d('0x3d')][_0x1d4d('0xa8')](this,_0x10079);return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xc3'),_0x10079[_0x1d4d('0x49')],_0x10079[_0x1d4d('0x42')],_0x10079['scheduledAt']));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc4')]=function(_0x2c603b){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xc5'),_0x2c603b[_0x1d4d('0xb0')]));var _0x163851=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x2c603b['application'],_0x2c603b[_0x1d4d('0x77')]);if(_0x163851[_0x1d4d('0xa5')]===-0x1){return _0x163851;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x2c603b[_0x1d4d('0xc7')],_0x2c603b[_0x1d4d('0x77')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc8')]=function(_0x29ab74){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xc9'),_0x29ab74['label']));if(!this['isConfigured'](_0x29ab74['text'])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xab'));}var _0x1a1e61='\x22'+_0x29ab74['text']+'\x22';if(this[_0x1d4d('0x85')](_0x29ab74['options'])){_0x1a1e61+=','+_0x29ab74[_0x1d4d('0x77')];}var _0x15e056=this['channel']['exec'](_0x1d4d('0xca'),_0x1a1e61);if(_0x15e056['result']===-0x1){return _0x15e056;}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1a1e61));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xcb')]=function(_0x7ea3fa){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0xcc'),_0x7ea3fa[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x7ea3fa[_0x1d4d('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}var _0xa442dc='\x22'+_0x7ea3fa[_0x1d4d('0x5c')]+'\x22';if(this[_0x1d4d('0x85')](_0x7ea3fa[_0x1d4d('0x77')])){_0xa442dc+=','+_0x7ea3fa[_0x1d4d('0x77')];}var _0x586b57=this[_0x1d4d('0x32')]['exec']('MRCPSynth',_0xa442dc);if(_0x586b57[_0x1d4d('0xa5')]===-0x1){return _0x586b57;}return this['channel'][_0x1d4d('0xb2')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0xa442dc));};AGIVertices[_0x1d4d('0xf')]['lumenvoxasr']=function(_0x4b8a63){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xcd'),_0x4b8a63['label']));if(!this[_0x1d4d('0x85')](_0x4b8a63['grammar'])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xce'));}var _0x26b293=_0x4b8a63[_0x1d4d('0xb1')];if(this[_0x1d4d('0x85')](_0x4b8a63[_0x1d4d('0x77')])){_0x26b293+=','+_0x4b8a63[_0x1d4d('0x77')];}var _0x34aec5=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0xb3'),_0x26b293);if(_0x34aec5['result']===-0x1){return _0x34aec5;}var _0x123535=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xcf'));if(_0x123535[_0x1d4d('0xa5')]===-0x1){return _0x123535;}var _0x176e60=this[_0x1d4d('0xa4')](_0x1d4d('0xb6'),_0x1d4d('0xd0'));if(_0x176e60[_0x1d4d('0xa5')]===-0x1){return _0x176e60;}var _0x20e067=this['getAndSetVariable'](_0x1d4d('0xb8'),_0x1d4d('0xd1'));if(_0x20e067[_0x1d4d('0xa5')]===-0x1){return _0x20e067;}return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x26b293));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xd2')]=function(_0x87d9d1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xd3'),_0x87d9d1[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x87d9d1[_0x1d4d('0xb1')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xce'));}var _0x2cde6b=_0x87d9d1[_0x1d4d('0xb1')];if(this['isConfigured'](_0x87d9d1[_0x1d4d('0x77')])){_0x2cde6b+=','+_0x87d9d1['options'];}var _0x2ac222=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('MRCPRecog',_0x2cde6b);if(_0x2ac222['result']===-0x1){return _0x2ac222;}var _0x5dad17=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xd4'));if(_0x5dad17['result']===-0x1){return _0x5dad17;}var _0x4d350c=this['getAndSetVariable'](_0x1d4d('0xb6'),_0x1d4d('0xd5'));if(_0x4d350c[_0x1d4d('0xa5')]===-0x1){return _0x4d350c;}var _0x4259d0=this[_0x1d4d('0xa4')](_0x1d4d('0xb8'),_0x1d4d('0xd6'));if(_0x4259d0[_0x1d4d('0xa5')]===-0x1){return _0x4259d0;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xb9'),_0x2cde6b));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xd7')]=function(_0x1618b5){logger[_0x1d4d('0x29')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1618b5[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1618b5['odbc_id'])){return this[_0x1d4d('0x32')]['error'](_0x1618b5,_0x1d4d('0xd8'));}var _0x18f840=this[_0x1d4d('0x15')]['sync'](this,_0x1618b5[_0x1d4d('0xd9')]);if(!_0x18f840){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x1618b5,_0x1d4d('0xda'));}if(!this[_0x1d4d('0x85')](_0x1618b5['query'])){return this[_0x1d4d('0x32')]['error'](_0x1618b5,'no\x20query\x20configured');}var _0x14e4d5=_0x1618b5[_0x1d4d('0x2b')][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0xdb'),_0x14e4d5));var _0x130eac=this[_0x1d4d('0x27')][_0x1d4d('0xa8')](this,_0x18f840,_0x14e4d5);this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x1618b5,_0x14e4d5);if(!this['isConfigured'](_0x1618b5['variable_id'])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xdc'));}var _0x53ec9c=this['getVariable'][_0x1d4d('0xa8')](this,_0x1618b5[_0x1d4d('0xdd')]);if(!_0x53ec9c){return this[_0x1d4d('0x32')]['error'](_0x1618b5,_0x1d4d('0xde'));}var _0x1ea731=this;_0x130eac[_0x1d4d('0xdf')](function(_0x408863,_0x45d450){Object[_0x1d4d('0xe0')](_0x408863)[_0x1d4d('0xdf')](function(_0x15353f){_0x1ea731[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')]('%s[%s][%s]',_0x53ec9c,_0x45d450,_0x15353f),_0x408863[_0x15353f]);});});this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util['format'](_0x1d4d('0xe1'),_0x53ec9c),_0x130eac[_0x1d4d('0x9b')]);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xe2'),_0x53ec9c));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xe3')]=function(_0x156c34){logger['debug'](util[_0x1d4d('0x25')](_0x1d4d('0xe4'),_0x156c34[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x156c34[_0x1d4d('0xe5')])){return this['channel'][_0x1d4d('0x54')](_0x156c34,_0x1d4d('0xe6'));}var _0x3213d1=this[_0x1d4d('0x17')][_0x1d4d('0xa8')](this,_0x156c34[_0x1d4d('0xe5')]);if(!_0x3213d1){return this['channel']['error'](_0x156c34,'no\x20user\x20found');}var _0x24fda4=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('DIAL',[util['format'](_0x1d4d('0xe7'),_0x3213d1),_0x156c34[_0x1d4d('0x65')],_0x156c34['opts'],_0x156c34[_0x1d4d('0x71')]]);if(_0x24fda4['result']===-0x1){return _0x24fda4;}return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xe8'),_0x1d4d('0xe9')));};AGIVertices[_0x1d4d('0xf')]['dialogflow']=function(_0x1e0ad0){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xea'),_0x1e0ad0[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1e0ad0[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}if(!this[_0x1d4d('0x85')](_0x1e0ad0['text'])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this[_0x1d4d('0x31')](_0x1e0ad0);this['createSquareMessage'](_0x1e0ad0[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xed'),_0x1e0ad0['text']));var _0x435949=this[_0x1d4d('0x78')][_0x1d4d('0xa8')](this,_0x1e0ad0);if(_0x435949){for(var _0x5aa9ed in _0x435949){if(_0x435949[_0x1d4d('0x98')](_0x5aa9ed)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0xee'),_0x5aa9ed[_0x1d4d('0xef')]()),_0x435949[_0x5aa9ed]);}}this['createSquareMessage'](_0x435949['speech'],_0x1d4d('0xf0'),_0x1d4d('0xf1'),'');return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0xf2'),_0x435949['speech']));}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x1e0ad0,_0x1d4d('0xf3'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xf4')]=function(_0x2c8852){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2c8852[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2c8852['dialogflowV2_project_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20project_id\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852['client_email'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20client_email\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852[_0x1d4d('0x7c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xf5'));}if(!this[_0x1d4d('0x85')](_0x2c8852[_0x1d4d('0x7d')])){return this[_0x1d4d('0x32')]['noop']('no\x20anguage\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852['text'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this['createSquareDetailsReport'](_0x2c8852);this[_0x1d4d('0x3c')](_0x2c8852[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xf6'),_0x2c8852[_0x1d4d('0x5c')]));var _0x416fd6=this[_0x1d4d('0x7a')][_0x1d4d('0xa8')](this,_0x2c8852);if(_0x416fd6){for(var _0x4328a4 in _0x416fd6){if(_0x416fd6['hasOwnProperty'](_0x4328a4)){if(_0x4328a4!==_0x1d4d('0xf7')){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0xee'),_0x4328a4[_0x1d4d('0xef')]()),_0x416fd6[_0x4328a4]);}}}this[_0x1d4d('0x3c')](_0x416fd6[_0x1d4d('0xf8')],_0x1d4d('0xf0'),_0x1d4d('0xf4'),_0x416fd6[_0x1d4d('0xf7')]);return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('DialogflowV2\x20Result\x20%s',_0x416fd6[_0x1d4d('0xf8')]));}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2c8852,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xf9')]=function(_0x543f0b){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xfa'),_0x543f0b[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xfb')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xfc'));}if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xfd')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xfe'));}if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xff')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0x100'));}if(!this[_0x1d4d('0x85')](_0x543f0b[_0x1d4d('0x101')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this[_0x1d4d('0x31')](_0x543f0b);this[_0x1d4d('0x3c')](_0x543f0b[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x102'),_0x543f0b[_0x1d4d('0x5c')]));var _0x2ffc4a=this[_0x1d4d('0x7e')][_0x1d4d('0xa8')](this,_0x543f0b);if(_0x2ffc4a){for(var _0x1e01e1 in _0x2ffc4a){if(_0x2ffc4a['hasOwnProperty'](_0x1e01e1)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x103'),_0x1e01e1[_0x1d4d('0xef')]()),_0x2ffc4a[_0x1e01e1]);}}this[_0x1d4d('0x3c')](_0x2ffc4a[_0x1d4d('0xf8')],_0x1d4d('0xf0'),_0x1d4d('0xf9'),'');if(_0x2ffc4a[_0x1d4d('0x104')]){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x105'),_0x2ffc4a[_0x1d4d('0x104')]));var _0x888aa6=this['channel'][_0x1d4d('0x106')](_0x2ffc4a['audiofile']);try{fs[_0x1d4d('0x107')](_0x2ffc4a['audiofile']+_0x1d4d('0x108'));}catch(_0x51a483){logger[_0x1d4d('0x54')](_0x51a483);}return _0x888aa6;}else{return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x109'),_0x2ffc4a[_0x1d4d('0xf8')]));}}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x543f0b,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x1d4d('0x10a')]=function(_0x2e0759){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x2e0759[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('end');};AGIVertices['prototype'][_0x1d4d('0x10b')]=function(_0x57e191){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x10c'),_0x57e191[_0x1d4d('0xb0')]));var _0x46f50e='';if(_0x57e191['trunk_id']){if(!this[_0x1d4d('0x85')](_0x57e191[_0x1d4d('0x10d')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x57e191,_0x1d4d('0x10e'));}else{var _0x3322f8=parseInt(_0x57e191['trunk_id'],0xa);if(isNaN(_0x3322f8)){_0x46f50e=_0x57e191['trunk_id'];}else{_0x46f50e=this['getTrunk'][_0x1d4d('0xa8')](this,_0x57e191['trunk_id']);if(!_0x46f50e){return this[_0x1d4d('0x32')]['error'](_0x57e191,_0x1d4d('0x10f'));}}}}else if(_0x57e191[_0x1d4d('0x110')]){_0x46f50e=_0x57e191[_0x1d4d('0x110')];}else{return this[_0x1d4d('0x32')]['error'](_0x57e191,_0x1d4d('0x10e'));}var _0x49d54c=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('DIAL',[util[_0x1d4d('0x25')](_0x1d4d('0x111'),_0x46f50e,_0x57e191[_0x1d4d('0x49')]),_0x57e191['timeout'],_0x57e191['opts'],_0x57e191[_0x1d4d('0x71')]]);if(_0x49d54c[_0x1d4d('0xa5')]===-0x1){return _0x49d54c;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xe8'),_0x1d4d('0xe9')));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x112')]=function(_0xac4a9){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x113'),_0xac4a9[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x112'));};AGIVertices['prototype'][_0x1d4d('0xc')]=function(_0x3688d2){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x114'),_0x3688d2[_0x1d4d('0xb0')]));if(_0x3688d2[_0x1d4d('0xa9')]===0x0){return this[_0x1d4d('0xa7')](_0x3688d2);}_0x3688d2[_0x1d4d('0xa9')]-=0x1;if(!this[_0x1d4d('0x85')](_0x3688d2[_0x1d4d('0x115')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x3688d2,_0x1d4d('0x116'));}var _0x34b992=this[_0x1d4d('0x117')][_0x1d4d('0xa8')](this,_0x3688d2[_0x1d4d('0x115')]);if(!_0x34b992){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x3688d2,'no\x20file\x20audio\x20found');}if(!this[_0x1d4d('0x85')](_0x3688d2[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3bee41=this[_0x1d4d('0x32')][_0x1d4d('0x118')](_0x34b992,_0x3688d2[_0x1d4d('0x119')],_0x3688d2['maxdigit']);var _0xe2d9db=_0x3bee41[_0x1d4d('0xa5')]?_0x3bee41[_0x1d4d('0xa5')]['toString']():'';logger[_0x1d4d('0x29')]('test',JSON[_0x1d4d('0x72')](_0x3bee41));if(_0x3bee41[_0x1d4d('0xa5')]===-0x1){this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,_0xe2d9db);return _0x3bee41;}else if(_0x3bee41[_0x1d4d('0xa3')]===_0x1d4d('0x65')){_0x3bee41[_0x1d4d('0xa5')]=_0xe2d9db['length']>=parseInt(_0x3688d2[_0x1d4d('0x11a')])?'x':'i';}else{_0x3bee41[_0x1d4d('0xa5')]=_0xe2d9db[_0x1d4d('0x9b')]>=parseInt(_0x3688d2[_0x1d4d('0x11a')])&&_0xe2d9db['length']<=parseInt(_0x3688d2[_0x1d4d('0x11b')])?'x':'i';}var _0x156ce0=this['getVariable']['sync'](this,_0x3688d2['variable_id']);if(!_0x156ce0){return this[_0x1d4d('0x32')]['error'](_0x3688d2,'no\x20variable\x20found');}this['channel'][_0x1d4d('0x9f')](_0x156ce0,_0xe2d9db);if(this['isConfigured'](_0x3688d2[_0x1d4d('0x11c')])){var _0x2c80aa=parseInt(_0x3688d2['hiddendigitsnum'],0xa);var _0x360860=rs[_0x1d4d('0x11d')]({'charset':'*','length':_0x2c80aa});var _0x32ac8c=_0xe2d9db[_0x1d4d('0x9b')];if(_0x32ac8c>0x0){if(_0x32ac8c>_0x2c80aa){this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3688d2,_0x3688d2[_0x1d4d('0x11e')]===_0x1d4d('0x11f')?_0x360860+_0xe2d9db[_0x1d4d('0x120')](_0x2c80aa):_0xe2d9db[_0x1d4d('0x120')](0x0,_0x32ac8c-_0x2c80aa)+_0x360860);}else{this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,rs['generate']({'charset':'*','length':_0x32ac8c}));}}else{this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,'');}}else{this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3688d2,_0xe2d9db);}return _0x3bee41;};AGIVertices[_0x1d4d('0xf')]['getsecretdigits']=function(_0x1d3402){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x121'),_0x1d3402[_0x1d4d('0xb0')]));return this['getdigits'](_0x1d3402);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x122')]=function(_0x446419){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x446419[_0x1d4d('0xb0')]));this[_0x1d4d('0x31')]['sync'](this,_0x446419,_0x446419[_0x1d4d('0x123')]);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x124'),_0x446419[_0x1d4d('0x123')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x125')]=function(_0x51b4c5){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x126'),_0x51b4c5[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x51b4c5[_0x1d4d('0x88')])||!this['isConfigured'](_0x51b4c5[_0x1d4d('0x127')])){return this['channel']['noop'](_0x1d4d('0x128'));}if(!this['isConfigured'](_0x51b4c5[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x51b4c5[_0x1d4d('0x5c')]));var _0x5161b0=this['awsPolly']['sync'](this,_0x51b4c5);if(_0x5161b0){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x5161b0));var _0x7b75e0=this[_0x1d4d('0x32')]['streamFile'](_0x5161b0);try{fs[_0x1d4d('0x107')](_0x5161b0+'.wav');}catch(_0x291a17){logger['error'](_0x291a17);}return _0x7b75e0;}return this['channel'][_0x1d4d('0x54')](_0x51b4c5,_0x1d4d('0x129'));};AGIVertices[_0x1d4d('0xf')]['awslex']=function(_0x38f9d7){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x38f9d7[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x88')])||!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x127')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x128'));}if(!this['isConfigured'](_0x38f9d7[_0x1d4d('0x8c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0x12a'));}if(!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this['channel'][_0x1d4d('0xec')]=!![];this['createSquareDetailsReport'](_0x38f9d7);this[_0x1d4d('0x3c')](_0x38f9d7['text'],'in','','');this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x38f9d7['text']));var _0x17eed5=this['awsLex'][_0x1d4d('0xa8')](this,_0x38f9d7);if(_0x17eed5){for(var _0x17f379 in _0x17eed5){if(_0x17eed5['hasOwnProperty'](_0x17f379)&&_[_0x1d4d('0x9c')](_0x17eed5[_0x17f379])){this[_0x1d4d('0x32')]['setVariable'](util[_0x1d4d('0x25')](_0x1d4d('0x12b'),_0x17f379[_0x1d4d('0xef')]()),_0x17eed5[_0x17f379]);}}if(_[_0x1d4d('0x3f')](_0x17eed5[_0x1d4d('0x75')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x12c'));}else{this[_0x1d4d('0x3c')](_0x17eed5[_0x1d4d('0x75')],_0x1d4d('0xf0'),_0x1d4d('0x12d'),'');return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x12e'),_0x17eed5[_0x1d4d('0x75')]));}}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x38f9d7,_0x1d4d('0x12f'));};AGIVertices[_0x1d4d('0xf')]['googleasr']=function(_0x146dc7){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x130'),_0x146dc7['label'],_0x146dc7[_0x1d4d('0x65')]));if(!this[_0x1d4d('0x85')](_0x146dc7[_0x1d4d('0x80')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}var _0x4ad942=_0x1d4d('0x131');var _0x4be5b2=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs['generate'](0x4));var _0x21c5a9=util[_0x1d4d('0x25')]('%s.%s',_0x4be5b2,_0x4ad942);var _0x4b7cee=!![];if(_0x146dc7[_0x1d4d('0x133')]===_0x1d4d('0x134')){_0x4b7cee=![];}var _0x523cee=this['channel'][_0x1d4d('0x135')](_0x4be5b2,_0x4ad942,_0x146dc7[_0x1d4d('0x136')],_0x146dc7[_0x1d4d('0x65')],undefined,_0x4b7cee);if(_0x523cee[_0x1d4d('0xa5')]!==-0x1){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x137'),_0x21c5a9));var _0x301b21=this['googleASR'][_0x1d4d('0xa8')](this,_0x146dc7,_0x21c5a9);if(_0x301b21){for(var _0x7bfede in _0x301b21){if(_0x301b21[_0x1d4d('0x98')](_0x7bfede)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x138'),_0x7bfede[_0x1d4d('0xef')]()),_0x301b21[_0x7bfede]);}}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x139'),JSON[_0x1d4d('0x72')](_0x301b21)));}}return _0x523cee;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x13a')]=function(_0x34e1f0){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x13b'),_0x34e1f0[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x34e1f0[_0x1d4d('0x90')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0x13c'));}if(!this[_0x1d4d('0x85')](_0x34e1f0[_0x1d4d('0x91')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20appsecret\x20configured');}var _0x100601=_0x1d4d('0x131');var _0x35c752=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs[_0x1d4d('0x11d')](0x4));var _0x5beb46=util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x35c752,_0x100601);var _0x25c79d=!![];if(_0x34e1f0['beep']==='NOBEEP'){_0x25c79d=![];}var _0x24cbb8=this[_0x1d4d('0x32')]['recordFile'](_0x35c752,_0x100601,_0x34e1f0[_0x1d4d('0x136')],_0x34e1f0['timeout'],undefined,_0x25c79d);if(_0x24cbb8[_0x1d4d('0xa5')]!==-0x1){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x13d'),_0x5beb46));var _0x34581e=this[_0x1d4d('0x8f')][_0x1d4d('0xa8')](this,_0x34e1f0,_0x5beb46);if(_0x34581e){for(var _0x54b0a1 in _0x34581e){if(_0x34581e[_0x1d4d('0x98')](_0x54b0a1)){this['channel'][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x13e'),_0x54b0a1['toUpperCase']()),_0x34581e[_0x54b0a1]);}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x13f'),JSON[_0x1d4d('0x72')](_0x34581e)));}}return _0x24cbb8;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x140')]=function(_0x3953d4){logger['info'](util['format'](_0x1d4d('0x141'),_0x3953d4[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x142')](_0x3953d4[_0x1d4d('0x38')],_0x3953d4[_0x1d4d('0x39')],_0x3953d4[_0x1d4d('0x143')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x144')]=function(_0xe2f27e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x145'),_0xe2f27e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0xe2f27e[_0x1d4d('0x146')])){return this['channel'][_0x1d4d('0x54')](_0xe2f27e,_0x1d4d('0x147'));}try{var _0x3dc19f=eval(_0xe2f27e[_0x1d4d('0x146')])?_0x1d4d('0x148'):'false';this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x149'),_0xe2f27e[_0x1d4d('0x146')],_0x3dc19f));return{'code':0xc8,'result':_0x3dc19f};}catch(_0x458072){return{'code':0xc8,'result':_0x1d4d('0x14a')};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x14b')]=function(_0x19dc7f){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x14c'),_0x19dc7f[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x19dc7f['interval_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x19dc7f,_0x1d4d('0x14d'));}var _0x4942bf=this[_0x1d4d('0x1f')][_0x1d4d('0xa8')](this,_0x19dc7f[_0x1d4d('0x14e')]);if(!_0x4942bf){return this[_0x1d4d('0x32')]['error'](_0x19dc7f,_0x1d4d('0x14f'));}for(var _0xebef3c=0x0;_0xebef3c<_0x4942bf[_0x1d4d('0x9b')];_0xebef3c+=0x1){var _0x350d29=this[_0x1d4d('0x32')]['getVariable'](util[_0x1d4d('0x25')]('IFTIME(%s?true:false)',_0x4942bf[_0xebef3c]));if(_0x350d29[_0x1d4d('0xa5')]===-0x1){return _0x350d29;}logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x350d29[_0x1d4d('0xa3')]));if(_0x350d29[_0x1d4d('0xa3')]===_0x1d4d('0x148')){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x148')));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x148')));return{'code':0xc8,'result':'true'};}else{logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x14a')));this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x14a')));}}return{'code':0xc8,'result':_0x1d4d('0x14a')};};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x151')]=function(_0x431642){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x152'),_0x431642['label']));return this['channel'][_0x1d4d('0x151')]();};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x153')]=function(_0x15280c){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x154'),_0x15280c[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x15280c[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}var _0x3c0dbe='wav';var _0x32a671=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs['generate'](0x4));var _0x204adb=util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x32a671,_0x3c0dbe);var _0x2a263d=!![];if(_0x15280c['beep']==='NOBEEP'){_0x2a263d=![];}var _0x738057=this[_0x1d4d('0x32')][_0x1d4d('0x135')](_0x32a671,_0x3c0dbe,_0x15280c['intKey'],_0x15280c[_0x1d4d('0x65')],undefined,_0x2a263d);if(_0x738057[_0x1d4d('0xa5')]!==-0x1){this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x155'),_0x204adb));var _0x22105d=this[_0x1d4d('0x83')]['sync'](this,_0x15280c,_0x204adb);if(_0x22105d){for(var _0x106a73 in _0x22105d){if(_0x22105d[_0x1d4d('0x98')](_0x106a73)){this[_0x1d4d('0x32')]['setVariable'](util[_0x1d4d('0x25')](_0x1d4d('0x156'),_0x106a73[_0x1d4d('0xef')]()),_0x22105d[_0x106a73]);}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('IspeechASR\x20Result\x20%s',JSON[_0x1d4d('0x72')](_0x22105d)));}}return _0x738057;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x157')]=function(_0x18b3a9){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x158'),_0x18b3a9[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x18b3a9[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}if(!this[_0x1d4d('0x85')](_0x18b3a9['text'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x159'),_0x18b3a9[_0x1d4d('0x5c')]));var _0x341598=this['ispeechTTS'][_0x1d4d('0xa8')](this,_0x18b3a9);if(_0x341598){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x155'),_0x341598));var _0x43ac02=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x341598,_0x18b3a9['intKey']);try{fs[_0x1d4d('0x107')](_0x341598+_0x1d4d('0x108'));}catch(_0x33091a){logger[_0x1d4d('0x54')](_0x33091a);}return _0x43ac02;}return this['channel']['error'](_0x18b3a9,_0x1d4d('0x15a'));};AGIVertices[_0x1d4d('0xf')]['login']=function(_0x2f43a6){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2f43a6['label']));if(!this[_0x1d4d('0x85')](_0x2f43a6['findBy'])){return this[_0x1d4d('0x32')]['error'](_0x2f43a6,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6[_0x1d4d('0x15c')]));var _0x1923b6=this[_0x1d4d('0x15d')][_0x1d4d('0xa8')](this,_0x2f43a6['findBy']);if(_0x1923b6){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices['prototype'][_0x1d4d('0x162')]=function(_0x2ee30a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x163'),_0x2ee30a[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2ee30a[_0x1d4d('0x15c')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2ee30a,_0x1d4d('0x15b'));}logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));var _0x5d07ae=this[_0x1d4d('0x55')][_0x1d4d('0xa8')](this,_0x2ee30a[_0x1d4d('0x15c')]);if(_0x5d07ae){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x160'),this[_0x1d4d('0x32')]['callerid'],_0x2ee30a[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x165')]=function(_0x171844){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x171844[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x171844[_0x1d4d('0x166')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x171844,'no\x20operation\x20configured');}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x167'),_0x171844[_0x1d4d('0x166')]));var _0x3d4391=eval(_0x171844[_0x1d4d('0x166')]);if(!this[_0x1d4d('0x85')](_0x171844[_0x1d4d('0xdd')])){return this['channel']['noop'](_0x1d4d('0xdc'));}var _0x3b75b3=this['getVariable'][_0x1d4d('0xa8')](this,_0x171844[_0x1d4d('0xdd')]);if(!_0x3b75b3){return this[_0x1d4d('0x32')]['error'](_0x171844,_0x1d4d('0xde'));}if(_[_0x1d4d('0x9a')](_0x3d4391)){var _0xf3bfac=this;_0x3d4391[_0x1d4d('0xdf')](function(_0x247063,_0x4d9cff){_0xf3bfac[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x168'),_0x3b75b3,_0x4d9cff),_0x247063);});return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('variable\x20%s[key]\x20set',_0x3b75b3));}else{return this['channel'][_0x1d4d('0x9f')](_0x3b75b3,_0x3d4391);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x169')]=function(_0x5b437a){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x16a'),_0x5b437a[_0x1d4d('0xb0')]));if(_0x5b437a[_0x1d4d('0xa9')]===0x0){return this[_0x1d4d('0xa7')](_0x5b437a);}_0x5b437a[_0x1d4d('0xa9')]-=0x1;if(!this['isConfigured'](_0x5b437a[_0x1d4d('0x115')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,'no\x20file\x20audio\x20selected');}var _0x1807e7=this[_0x1d4d('0x117')][_0x1d4d('0xa8')](this,_0x5b437a[_0x1d4d('0x115')]);if(!_0x1807e7){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,_0x1d4d('0x16b'));}var _0x20db3e=this[_0x1d4d('0x32')][_0x1d4d('0x118')](_0x1807e7,_0x5b437a[_0x1d4d('0x119')],_0x5b437a[_0x1d4d('0x16c')]);var _0x59558c=_0x20db3e['result'];if(_0x20db3e['result']===-0x1){this['createSquareDetailsReport'][_0x1d4d('0xa8')](this,_0x5b437a,'-1');return _0x20db3e;}else if(_0x20db3e[_0x1d4d('0xa3')]===_0x1d4d('0x65')){_0x20db3e[_0x1d4d('0xa5')]=_0x20db3e[_0x1d4d('0xa5')][_0x1d4d('0x9b')]>0x0?_0x20db3e[_0x1d4d('0xa5')]:'t';}else if(_['isEmpty'](_0x20db3e[_0x1d4d('0xa5')])){_0x20db3e['result']='#';_0x59558c='#';}if(!this[_0x1d4d('0x85')](_0x5b437a[_0x1d4d('0xdd')])){this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x362aab=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x5b437a['variable_id']);if(!_0x362aab){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,_0x1d4d('0xde'));}this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x362aab,_0x59558c);}this['createSquareDetailsReport'][_0x1d4d('0xa8')](this,_0x5b437a,_0x59558c);return _0x20db3e;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xb2')]=function(_0x10c1bd){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x16d'),_0x10c1bd['label']));return this['channel'][_0x1d4d('0xb2')](_0x10c1bd['output']||_0x10c1bd[_0x1d4d('0xb0')]);};AGIVertices['prototype']['pause']=function(_0x501d6e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x501d6e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x501d6e[_0x1d4d('0x15c')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x501d6e,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this['channel'][_0x1d4d('0x34')],_0x501d6e['findBy']));var _0x65b3ec=this[_0x1d4d('0x50')][_0x1d4d('0xa8')](this,_0x501d6e['pause_id']);var _0x51c7e4=this[_0x1d4d('0x51')][_0x1d4d('0xa8')](this,_0x501d6e['findBy'],_0x65b3ec);if(_0x51c7e4){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel']['callerid'],_0x501d6e['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x501d6e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x1d4d('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x501d6e[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x501d6e[_0x1d4d('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x16e')]=function(_0x5eeb14){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x16f'),_0x5eeb14['label']));if(!this[_0x1d4d('0x85')](_0x5eeb14['file_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5eeb14,'no\x20file\x20audio\x20selected');}var _0x255b3f=this[_0x1d4d('0x117')]['sync'](this,_0x5eeb14[_0x1d4d('0x115')]);if(!_0x255b3f){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5eeb14,_0x1d4d('0x16b'));}var _0x51791c=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x170'),[_0x255b3f,_0x5eeb14[_0x1d4d('0x171')]]);if(_0x51791c['result']===-0x1){return _0x51791c;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x1d4d('0x170'),_0x255b3f));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x172')]=function(_0x42546e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x173'),_0x42546e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x42546e['queue_id'])){return this['channel'][_0x1d4d('0x54')](_0x42546e,_0x1d4d('0x174'));}var _0xd93b33='';var _0x4f0989=parseInt(_0x42546e['queue_id'],0xa);if(isNaN(_0x4f0989)){_0xd93b33=_0x42546e[_0x1d4d('0x175')];}else{_0xd93b33=this['getVoiceQueue'][_0x1d4d('0xa8')](this,_0x42546e['queue_id']);if(!_0xd93b33){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x42546e,_0x1d4d('0x176'));}}var _0x2b2300='';if(this[_0x1d4d('0x85')](_0x42546e[_0x1d4d('0x115')])){var _0x4d2c11=this['getSound'][_0x1d4d('0xa8')](this,_0x42546e['file_id']);if(_0x4d2c11){_0x2b2300=_0x4d2c11;}}this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x42546e,_0xd93b33);if(_0x42546e[_0x1d4d('0x171')][_0x1d4d('0x177')]('x')<0x0){_0x42546e[_0x1d4d('0x171')]+='x';}if(_0x42546e[_0x1d4d('0x171')]['indexOf']('X')<0x0){_0x42546e[_0x1d4d('0x171')]+='X';}this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x1d4d('0x178'),_0xd93b33?_0xd93b33['toLowerCase']():'');var _0x173eaa=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x179'),[_0xd93b33,_0x42546e['opts'],_0x42546e[_0x1d4d('0x71')],_0x2b2300,_0x42546e[_0x1d4d('0x65')],_0x42546e[_0x1d4d('0x7')],_0x42546e[_0x1d4d('0x17a')],_0x42546e[_0x1d4d('0x17b')],'',_0x42546e[_0x1d4d('0x17c')]]);if(_0x173eaa[_0x1d4d('0xa5')]===-0x1){return _0x173eaa;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xc6'),_0x1d4d('0x179'),_0xd93b33));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x17d')]=function(_0x1c68a0){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1c68a0[_0x1d4d('0xb0')]));var _0x44d572=_0x1c68a0['recordingFormat']||_0x1d4d('0x131');var _0x4485c7=util[_0x1d4d('0x25')](_0x1d4d('0x17e'),this[_0x1d4d('0x32')][_0x1d4d('0x36')],rs[_0x1d4d('0x11d')](0x5));var _0x2f7573=util['format'](_0x1d4d('0x17f'),FILES_PATH,_0x4485c7,_0x44d572);var _0x7ca289=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,_0x4485c7);this[_0x1d4d('0x35')][_0x1d4d('0xa8')](this,_0x1c68a0,_0x4485c7,_0x2f7573);this[_0x1d4d('0x32')]['setVariable']('RECORDING_SAVENAME',_0x4485c7);logger[_0x1d4d('0x29')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x7ca289,_0x44d572,_0x1c68a0[_0x1d4d('0x180')],_0x1c68a0[_0x1d4d('0x65')]);return this[_0x1d4d('0x32')][_0x1d4d('0x135')](_0x7ca289,_0x44d572,_0x1c68a0[_0x1d4d('0x180')],_0x1c68a0[_0x1d4d('0x65')],undefined,!![]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x181')]=function(_0x971588){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x182'),_0x971588[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x971588[_0x1d4d('0x71')])){return this['channel'][_0x1d4d('0xb2')]('no\x20url\x20configured');}var _0x403893=this[_0x1d4d('0x63')]['sync'](this,_0x971588);logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x183'),util['inspect'](_0x403893,{'showHidden':![],'depth':null})));if(!this[_0x1d4d('0x85')](_0x971588[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x236222=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x971588['variable_id']);if(!_0x236222){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x971588,_0x1d4d('0xde'));}this['channel'][_0x1d4d('0x9f')](util['format'](_0x1d4d('0x184'),_0x236222),_0x403893['statusCode']?_0x403893['statusCode']:_0x1d4d('0x185'));this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util['format'](_0x1d4d('0x186'),_0x236222),_0x403893[_0x1d4d('0x74')]?_0x403893[_0x1d4d('0x74')]:'OK');if(_0x403893[_0x1d4d('0x68')]){try{this[_0x1d4d('0x9d')](_0x403893[_0x1d4d('0x68')],_0x236222);}catch(_0x19484e){logger['error'](util['format'](_0x1d4d('0x187'),_0x236222));}}return this[_0x1d4d('0x32')]['noop'](util['format']('variable\x20%s\x20set',_0x236222));};AGIVertices[_0x1d4d('0xf')]['saydigits']=function(_0x1f949a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x188'),_0x1f949a[_0x1d4d('0xb0')]));return this['channel'][_0x1d4d('0x189')](_0x1f949a[_0x1d4d('0x18a')][_0x1d4d('0x59')](/\s+/g,''),_0x1f949a['escape_digits']);};AGIVertices[_0x1d4d('0xf')]['saynumber']=function(_0x484874){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x18b'),_0x484874['label']));return this[_0x1d4d('0x32')][_0x1d4d('0x18c')](_0x484874[_0x1d4d('0x66')]['replace'](/\s+/g,''),_0x484874[_0x1d4d('0x180')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x18d')]=function(_0x10c0b0){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x18e'),_0x10c0b0[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x18f')](_0x10c0b0[_0x1d4d('0x5c')],_0x10c0b0['escape_digits']);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x190')]=function(_0x16228a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x191'),_0x16228a[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x16228a[_0x1d4d('0x192')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20mail\x20account\x20configured');}var _0x3dcbed=this['getMailAccount']['sync'](this,_0x16228a[_0x1d4d('0x192')]);if(!_0x3dcbed||!_0x3dcbed['Smtp']){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x16228a,_0x1d4d('0x193'));}var _0x28c15a={'from':util[_0x1d4d('0x25')](_0x1d4d('0x194'),_0x3dcbed[_0x1d4d('0x12')],_0x3dcbed[_0x1d4d('0x195')]||_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x197')]),'to':_0x16228a['to']||'','cc':_0x16228a['cc']||'','bcc':_0x16228a['bcc']||'','subject':_0x16228a['subject'],'html':_0x16228a[_0x1d4d('0x5c')],'text':_0x16228a[_0x1d4d('0x5c')]};var _0xdb36cf={'tls':{'rejectUnauthorized':![]}};if(_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x198')]){_0xdb36cf['service']=_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x198')];}else{_0xdb36cf['host']=_0x3dcbed['Smtp'][_0x1d4d('0x199')];_0xdb36cf[_0x1d4d('0x19a')]=_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x19a')];_0xdb36cf[_0x1d4d('0x19b')]=_0x3dcbed[_0x1d4d('0x196')]['secure'];}if(_0x3dcbed['Smtp'][_0x1d4d('0x19c')]){_0xdb36cf[_0x1d4d('0x19d')]={'user':_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x197')],'pass':_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x19e')]};}if(this[_0x1d4d('0x85')](_0x16228a[_0x1d4d('0x19f')])){}logger[_0x1d4d('0x1a0')]('sendMail\x20message',JSON['stringify'](_0x28c15a));this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x16228a,_0x16228a[_0x1d4d('0x192')]);this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1a1'),_0x3dcbed[_0x1d4d('0x12')]));this['sendMailMessage'][_0x1d4d('0xa8')](this,_0xdb36cf,_0x28c15a);return this['channel']['noop'](_0x1d4d('0x1a2'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1a3')]=function(_0x494f15){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1a4'),_0x494f15['label']));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1a5'));};AGIVertices[_0x1d4d('0xf')]['sendSMS']=function(_0x4a47a1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4a47a1['label']));if(!this[_0x1d4d('0x85')](_0x4a47a1[_0x1d4d('0x1a6')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1a7'));}var _0x3eaaa7=this['getSmsAccount'][_0x1d4d('0xa8')](this,_0x4a47a1['sms_account_id']);if(!_0x3eaaa7){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x4a47a1,_0x1d4d('0x1a8'));}var _0x17a343={'body':_0x4a47a1[_0x1d4d('0x1a9')],'phone':_0x4a47a1['to']||'','SmsAccountId':_0x3eaaa7['id']};logger[_0x1d4d('0x1a0')](_0x1d4d('0x1aa'),JSON[_0x1d4d('0x72')](_0x17a343));this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x4a47a1,_0x4a47a1[_0x1d4d('0x1a6')]);this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1ab'),_0x3eaaa7[_0x1d4d('0x12')]));this[_0x1d4d('0x30')][_0x1d4d('0xa8')](this,_0x17a343);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1ac'));};AGIVertices[_0x1d4d('0xf')]['set']=function(_0x4c5329){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1ad'),_0x4c5329[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x4c5329[_0x1d4d('0xdd')])){return this['channel']['error'](_0x4c5329,_0x1d4d('0x1ae'));}var _0x4d0e5d=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x4c5329[_0x1d4d('0xdd')]);if(!_0x4d0e5d){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x4c5329,_0x1d4d('0xde'));}return this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x4d0e5d,_0x4c5329[_0x1d4d('0x1af')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1b0')]=function(_0x5829f1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1b1'),_0x5829f1[_0x1d4d('0xb0')]));this['channel'][_0x1d4d('0xb2')]('START\x20CALLY\x20SQUARE');if(_0x5829f1['answer']===_0x1d4d('0x1b2')){this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('Answer');return this[_0x1d4d('0x32')][_0x1d4d('0xbd')]();}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1b3'));};AGIVertices['prototype']['subproject']=function(_0x321b90){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x1b4'),_0x321b90['label']));if(!this[_0x1d4d('0x85')](_0x321b90[_0x1d4d('0x1b5')])){return this[_0x1d4d('0x32')]['error'](_0x321b90,_0x1d4d('0x1b6'));}var _0x2f345f=this[_0x1d4d('0x14')][_0x1d4d('0xa8')](this,_0x321b90['project_id']);if(!this['isConfigured'](_0x2f345f)){return this['channel'][_0x1d4d('0x54')](_0x321b90,util['format'](_0x1d4d('0x1b7'),_0x321b90[_0x1d4d('0x1b5')]));}if(_0x2f345f===this[_0x1d4d('0x32')]['arg_1']){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x321b90,_0x1d4d('0x1b8'));}this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x321b90,_0x2f345f);var _0x4cb252=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x1b9'),util[_0x1d4d('0x25')](_0x1d4d('0x1ba'),config[_0x1d4d('0x7')][_0x1d4d('0x199')]||_0x1d4d('0x1bb'),_0x2f345f,this[_0x1d4d('0x32')][_0x1d4d('0x33')]));if(_0x4cb252[_0x1d4d('0xa5')]===-0x1){return _0x4cb252;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x1d4d('0x1b9'),_0x2f345f));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1bc')]=function(_0x2220fa){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2220fa['label']));var _0x11634b=this[_0x1d4d('0x58')]['sync'](this,_0x2220fa[_0x1d4d('0xbb')]);this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x2220fa,_0x2220fa[_0x1d4d('0xbb')]);if(this[_0x1d4d('0x85')](_0x2220fa['variable_id'])){var _0x45ab7e=this[_0x1d4d('0xa2')]['sync'](this,_0x2220fa['variable_id']);if(_0x45ab7e){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x45ab7e,_0x11634b);return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1bd'),_0x2220fa[_0x1d4d('0xbb')],_0x45ab7e));}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2220fa['command']));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1be')]=function(_0x20db3c){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1bf'),_0x20db3c[_0x1d4d('0xb0')]));_0x20db3c[_0x1d4d('0x5c')]=_0x20db3c['text'][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1d4d('0x85')](_0x20db3c[_0x1d4d('0x1c0')])){return this['channel']['noop'](_0x1d4d('0x1c1'));}if(!this['isConfigured'](_0x20db3c[_0x1d4d('0x5c')])){return this['channel'][_0x1d4d('0xb2')]('no\x20text\x20configured');}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1c2'),_0x20db3c[_0x1d4d('0x5c')]));var _0x15587a=this[_0x1d4d('0x5a')]['sync'](this,_0x20db3c);if(_0x15587a){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1c3'),_0x15587a));var _0xe176d6=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x15587a);try{fs[_0x1d4d('0x107')](_0x15587a+'.wav');}catch(_0x290b49){logger[_0x1d4d('0x54')](_0x290b49);}return _0xe176d6;}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x20db3c,_0x1d4d('0x1c4'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1c5')]=function(_0x2b0380){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1c6'),_0x2b0380[_0x1d4d('0xb0')]));_0x2b0380[_0x1d4d('0x5c')]=_0x2b0380[_0x1d4d('0x5c')][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1d4d('0x85')](_0x2b0380[_0x1d4d('0x5c')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x2b0380[_0x1d4d('0x5c')]));var _0x34da29=this[_0x1d4d('0x1c7')][_0x1d4d('0xa8')](this,_0x2b0380);if(_0x34da29){this['channel'][_0x1d4d('0xb2')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x34da29));var _0x234011=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x34da29);try{fs[_0x1d4d('0x107')](_0x34da29+'.wav');}catch(_0xb84ce0){logger[_0x1d4d('0x54')](_0xb84ce0);}return _0x234011;}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2b0380,_0x1d4d('0x1c8'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1c9')]=function(_0x1005cb){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1ca'),_0x1005cb[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1005cb[_0x1d4d('0x15c')])){return this['channel']['error'](_0x1005cb,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb['findBy']));var _0x39508c=this[_0x1d4d('0x52')][_0x1d4d('0xa8')](this,_0x1005cb[_0x1d4d('0x15c')]);if(_0x39508c){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x1005cb[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb['findBy']));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this['channel']['callerid'],_0x1005cb[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices['prototype'][_0x1d4d('0x1cb')]=function(_0x39e940){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1cc'),_0x39e940[_0x1d4d('0xb0')]));var _0x20bde0=this[_0x1d4d('0x32')]['exec'](_0x1d4d('0x1cd'),[_0x39e940[_0x1d4d('0x1ce')],_0x39e940[_0x1d4d('0x77')]]);if(_0x20bde0[_0x1d4d('0xa5')]===-0x1){return _0x20bde0;}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Executed\x20command\x20%s\x20%s',_0x1d4d('0x1cd'),_0x39e940[_0x1d4d('0x1ce')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1cf')]=function(_0x55ddfa){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x55ddfa['label']));if(!this[_0x1d4d('0x85')](_0x55ddfa[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x55ddfa,_0x1d4d('0x1ae'));}var _0x1454e3=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x55ddfa[_0x1d4d('0xdd')]);if(!_0x1454e3){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x55ddfa,_0x1d4d('0xde'));}var _0x5066f8=this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x1454e3);return{'code':0xc8,'result':_0x5066f8[_0x1d4d('0xa3')]?_0x5066f8[_0x1d4d('0xa3')]:'-'};};String[_0x1d4d('0xf')]['replaceAll']=function(_0x547009,_0x2b95ca){return this[_0x1d4d('0xa0')](_0x547009)[_0x1d4d('0x1d0')](_0x2b95ca);};module[_0x1d4d('0x1d1')]=AGIVertices; \ No newline at end of file +var _0x2830=['MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','getData','digit','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_MESSAGE','statusMessage','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','start','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','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','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','arg_1','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','dialTimezone','CALLERID(dialTimezone)','timezones','utcOffset','scheduledat','add','insertContact','minutes','getPause','agentPause','agent','callerid','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','includes','POST','PUT','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','%s.%s','length','saveRestApiResult','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','createSquareDetailsReport','sync','retry','maxRetry','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()'];(function(_0x4fdd64,_0x4ec5d4){var _0x1e9ae1=function(_0x60bf04){while(--_0x60bf04){_0x4fdd64['push'](_0x4fdd64['shift']());}};_0x1e9ae1(++_0x4ec5d4);}(_0x2830,0x117));var _0x0283=function(_0x25588a,_0x159564){_0x25588a=_0x25588a-0x0;var _0x13fe3a=_0x2830[_0x25588a];return _0x13fe3a;};'use strict';var fs=require('fs');var path=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var _=require(_0x0283('0x2'));var sh=require(_0x0283('0x3'));var odbc=require(_0x0283('0x4'))();var rs=require(_0x0283('0x5'));var moment=require(_0x0283('0x6'));var Mustache=require('mustache');var rp=require(_0x0283('0x7'));var logger=require('../../config/logger')(_0x0283('0x8'));var config=require(_0x0283('0x9'));var shared=require(_0x0283('0xa'));var scripts=require(_0x0283('0xb'));var FILES_PATH=_0x0283('0xc');var recursiveMapAttributes=[_0x0283('0xd'),_0x0283('0xe')];var verticesWithRetry=['menu',_0x0283('0xf'),_0x0283('0x10')];var AGIVertices=function(_0x1f0d10,_0x3a25f8,_0x27bf23){this[_0x0283('0x11')]=_0x1f0d10;this[_0x0283('0x12')]=_0x3a25f8;this[_0x0283('0x13')]=_0x27bf23;};AGIVertices['prototype'][_0x0283('0x14')]=function(_0x3cff0c,_0x1d77cc){this[_0x0283('0x12')][_0x0283('0x15')](_0x3cff0c)[_0x0283('0x16')](function(_0xccfdc8){_0x1d77cc(null,_0xccfdc8?_0xccfdc8['name']:![]);})[_0x0283('0x17')](function(_0x5cd101){_0x1d77cc(_0x5cd101);});};AGIVertices['prototype'][_0x0283('0x18')]=function(_0x3d05c4,_0x3e8141){this[_0x0283('0x12')][_0x0283('0x19')](_0x3d05c4)['then'](function(_0x566e68){_0x3e8141(null,_0x566e68?_0x566e68['name']:![]);})[_0x0283('0x17')](function(_0x414d92){_0x3e8141(_0x414d92);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x1b')]=function(_0x2a801b,_0x282fac){this[_0x0283('0x12')][_0x0283('0x1c')](_0x2a801b)[_0x0283('0x16')](function(_0x26f1c5){_0x282fac(null,_0x26f1c5?_0x26f1c5[_0x0283('0x1d')]:![]);})['catch'](function(_0x3bbb8c){_0x282fac(_0x3bbb8c);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x1e')]=function(_0x475acc,_0x1f12b5){this['rpc'][_0x0283('0x1f')](_0x475acc)[_0x0283('0x16')](function(_0x44f137){_0x1f12b5(null,_0x44f137?_0x44f137[_0x0283('0x20')]:![]);})[_0x0283('0x17')](function(_0x35952b){_0x1f12b5(_0x35952b);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x21')]=function(_0x4e2822,_0x17f52e){this[_0x0283('0x12')]['getUserById'](_0x4e2822)[_0x0283('0x16')](function(_0x4206e3){_0x17f52e(null,_0x4206e3?_0x4206e3[_0x0283('0x1d')]:![]);})[_0x0283('0x17')](function(_0x2138c1){_0x17f52e(_0x2138c1);});};AGIVertices['prototype']['getTrunk']=function(_0x3d73c0,_0x458787){this[_0x0283('0x12')][_0x0283('0x22')](_0x3d73c0)[_0x0283('0x16')](function(_0x209c1f){_0x458787(null,_0x209c1f?_0x209c1f['name']:![]);})[_0x0283('0x17')](function(_0x3c16db){_0x458787(_0x3c16db);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x23')]=function(_0x5ce2da,_0x24c124){var _0x115283=this;this[_0x0283('0x12')]['getSoundById'](_0x5ce2da)[_0x0283('0x16')](function(_0x7bf1e3){_0x24c124(null,_0x7bf1e3?_0x115283[_0x0283('0x24')](_0x7bf1e3[_0x0283('0x25')]):![]);})['catch'](function(_0x5743ce){_0x24c124(_0x5743ce);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x26')]=function(_0x45de1f,_0xcc53b2){this['rpc'][_0x0283('0x27')](_0x45de1f)['then'](function(_0x4ce58e){_0xcc53b2(null,_0x4ce58e?_0x4ce58e:![]);})[_0x0283('0x17')](function(_0x405649){_0xcc53b2(_0x405649);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x28')]=function(_0x8063c7,_0x1e0440,_0xab03e9){this[_0x0283('0x13')]['sendMailMessage'](_0x8063c7,_0x1e0440)['then'](function(){_0xab03e9(null);})[_0x0283('0x17')](function(_0x43cb59){_0xab03e9(_0x43cb59);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x29')]=function(_0x380b8a,_0xc269db){this[_0x0283('0x12')][_0x0283('0x2a')](_0x380b8a)['then'](function(_0x56bbba){if(_0x56bbba){if(_0x56bbba[_0x0283('0x2b')]){_0xc269db(null,[_0x56bbba[_0x0283('0x2c')]]);}else{_0xc269db(null,_[_0x0283('0x2d')](_0x56bbba['Intervals'],_0x0283('0x2c')));}}else{_0xc269db(null,![]);}})['catch'](function(_0x4be411){_0xc269db(_0x4be411);});};AGIVertices['prototype'][_0x0283('0x24')]=function(_0x4e9437){return util['format'](_0x0283('0x2e'),FILES_PATH,_0x4e9437);};AGIVertices['prototype'][_0x0283('0x2f')]=function(_0x3c49c5,_0x158510,_0x221a97){odbc[_0x0283('0x30')](_0x3c49c5,function(_0x1a4ee8){if(_0x1a4ee8){logger[_0x0283('0x31')](_0x0283('0x32'),_0x1a4ee8);_0x221a97(_0x1a4ee8);}else{logger['info'](_0x0283('0x33'));odbc[_0x0283('0x34')](_0x158510,function(_0x5c4f49,_0x1ea3d9){if(_0x5c4f49){logger[_0x0283('0x35')](_0x0283('0x36'),_0x158510);_0x221a97(_0x5c4f49);}else{logger[_0x0283('0x35')](_0x0283('0x37'),_0x158510);odbc[_0x0283('0x38')](function(_0x358a6b){if(_0x358a6b){logger[_0x0283('0x31')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x358a6b);}_0x221a97(null,_0x1ea3d9);});}});}});};AGIVertices['prototype'][_0x0283('0x39')]=function(_0x3936f1,_0x636192){this[_0x0283('0x12')][_0x0283('0x3a')](_0x3936f1)[_0x0283('0x16')](function(_0x3786f3){_0x636192(null,_0x3786f3?_0x3786f3:![]);})[_0x0283('0x17')](function(_0x5bf2a0){_0x636192(_0x5bf2a0);});};AGIVertices['prototype'][_0x0283('0x3b')]=function(_0x4d5443,_0x571ae8){this[_0x0283('0x12')][_0x0283('0x3b')](_0x4d5443)[_0x0283('0x16')](function(_0x492135){_0x571ae8(null,_0x492135);})[_0x0283('0x17')](function(_0x5914f5){_0x571ae8(_0x5914f5);});};AGIVertices[_0x0283('0x1a')]['createSquareDetailsReport']=function(_0x19c0e6,_0x2b3ac6,_0x16a71e){this[_0x0283('0x12')]['createSquareDetailsReport']({'uniqueid':this[_0x0283('0x11')][_0x0283('0x3c')],'node':_0x19c0e6[_0x0283('0x3d')],'application':_0x19c0e6[_0x0283('0x3e')],'data':_0x2b3ac6||null,'project_name':this['channel'][_0x0283('0x3f')],'callerid':this[_0x0283('0x11')]['callerid']})['then'](function(_0x3b285b){if(_0x16a71e){_0x16a71e(null,_0x3b285b);}})['catch'](function(_0x386521){if(_0x16a71e){_0x16a71e(_0x386521);}});};AGIVertices['prototype'][_0x0283('0x40')]=function(_0x1dfcbf,_0xed9b96,_0x451299,_0x4675e8){this[_0x0283('0x12')][_0x0283('0x40')]({'uniqueid':this[_0x0283('0x11')][_0x0283('0x3c')],'callerid':this[_0x0283('0x11')]['callerid'],'calleridname':this[_0x0283('0x11')]['calleridname'],'context':this[_0x0283('0x11')][_0x0283('0x41')],'extension':this['channel'][_0x0283('0x42')],'priority':this[_0x0283('0x11')][_0x0283('0x43')],'accountcode':this[_0x0283('0x11')][_0x0283('0x44')],'dnid':this[_0x0283('0x11')][_0x0283('0x45')],'projectName':this['channel']['arg_1'],'saveName':_0xed9b96,'filename':_0x1dfcbf[_0x0283('0x46')]||_0xed9b96,'savePath':_0x451299})[_0x0283('0x16')](function(_0x16ae13){_0x4675e8(null,_0x16ae13);})[_0x0283('0x17')](function(_0x4d7669){_0x4675e8(_0x4d7669);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x47')]=function(_0xf8bfd8,_0x201494,_0x3f689d,_0x1c4940,_0x5a020a){this[_0x0283('0x12')][_0x0283('0x47')]({'uniqueid':this[_0x0283('0x11')]['uniqueid'],'body':_0xf8bfd8,'direction':_0x201494,'providerName':_0x3f689d,'providerResponse':_0x1c4940})[_0x0283('0x16')](function(_0x157235){if(_0x5a020a){_0x5a020a(null,_0x157235);}})[_0x0283('0x17')](function(_0x269d42){if(_0x5a020a){_0x5a020a(_0x269d42);}});};AGIVertices['prototype'][_0x0283('0x48')]=function(_0x16c9b9,_0x50790a){var _0x59bd39=this;var _0x2a4268=0x0;var _0x3389ad={'firstName':_['isEmpty'](_0x16c9b9['name'])||_[_0x0283('0x49')](_0x16c9b9['name'])?_0x0283('0x4a')+Math[_0x0283('0x4b')]():_0x16c9b9[_0x0283('0x1d')],'lastName':_[_0x0283('0x4c')](_0x16c9b9[_0x0283('0x4d')])||_[_0x0283('0x49')](_0x16c9b9[_0x0283('0x4d')])?null:_0x16c9b9['lastName'],'phone':_0x16c9b9[_0x0283('0x4e')],'ListId':_0x16c9b9[_0x0283('0x4f')],'scheduledat':_0x16c9b9[_0x0283('0x50')],'callbackUniqueid':this['channel'][_0x0283('0x3c')],'tags':_0x0283('0x51'),'description':_0x0283('0x52')+_0x16c9b9[_0x0283('0x50')][_0x0283('0x53')](),'priority':_0x16c9b9[_0x0283('0x54')]};if(_['has'](_0x16c9b9,_0x0283('0x55'))){if(!_['isNil'](_0x16c9b9[_0x0283('0x55')])){var _0x154da4=_0x16c9b9[_0x0283('0x55')];if(_0x16c9b9[_0x0283('0x55')]==_0x0283('0x56')){this[_0x0283('0x12')]['getContactByPhone']({'phone':_0x16c9b9[_0x0283('0x4e')]})[_0x0283('0x16')](function(_0x450bb5){if(!_[_0x0283('0x49')](_0x450bb5)){var _0x14538a=_0x450bb5[_0x0283('0x55')];if(!_[_0x0283('0x49')](_0x14538a)){var _0x37454d=shared[_0x0283('0x57')][_0x14538a];if(!_[_0x0283('0x49')](_0x37454d)){var _0x5843fe=-0x1*_0x37454d[_0x0283('0x58')];_0x3389ad[_0x0283('0x59')]=moment(_0x16c9b9[_0x0283('0x59')])[_0x0283('0x5a')](_0x5843fe,'minutes');_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}else{_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}}else{_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}}else{_0x59bd39['insertContact'](_0x3389ad,_0x16c9b9,_0x50790a);}});}else{var _0x2a4268=shared[_0x0283('0x57')][_0x154da4];if(!_[_0x0283('0x49')](_0x2a4268)){var _0x3fb7bd=-0x1*_0x2a4268[_0x0283('0x58')];_0x3389ad['scheduledat']=moment(_0x16c9b9[_0x0283('0x59')])[_0x0283('0x5a')](_0x3fb7bd,_0x0283('0x5c'));_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}else{_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}}}else{_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}}else{_0x59bd39[_0x0283('0x5b')](_0x3389ad,_0x16c9b9,_0x50790a);}};AGIVertices['prototype'][_0x0283('0x5d')]=function(_0x2c47d1,_0x26e7a0){this[_0x0283('0x12')]['getPauseById'](_0x2c47d1)['then'](function(_0x2c1de7){_0x26e7a0(null,_0x2c1de7?_0x2c1de7['name']:![]);})[_0x0283('0x17')](function(_0x241b27){_0x26e7a0(_0x241b27);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x5e')]=function(_0xd4be36,_0xa5f163,_0x5306da){var _0x262042={'role':_0x0283('0x5f')};_0x262042[_0xd4be36]=this[_0x0283('0x11')][_0x0283('0x60')];this[_0x0283('0x12')][_0x0283('0x5e')](_0x262042,_0xa5f163,this[_0x0283('0x11')][_0x0283('0x3c')])['then'](function(_0x1fa496){_0x5306da(null,_[_0x0283('0x49')](_0x1fa496)?![]:!![]);})[_0x0283('0x17')](function(_0x1b1331){logger[_0x0283('0x31')](_0x1b1331);_0x5306da(null,![]);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x61')]=function(_0x4dc694,_0x2a82ed){var _0xaa1bb2={'role':_0x0283('0x5f')};_0xaa1bb2[_0x4dc694]=this['channel']['callerid'];this['rpc'][_0x0283('0x61')](_0xaa1bb2)[_0x0283('0x16')](function(_0x3294bb){_0x2a82ed(null,_[_0x0283('0x49')](_0x3294bb)?![]:!![]);})[_0x0283('0x17')](function(_0x4c5f97){logger[_0x0283('0x31')](_0x4c5f97);_0x2a82ed(null,![]);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x62')]=function(_0x261cbe,_0x530474){var _0x155ff9={'role':'agent'};_0x155ff9[_0x261cbe]=this[_0x0283('0x11')][_0x0283('0x60')];this[_0x0283('0x12')][_0x0283('0x62')](_0x155ff9)[_0x0283('0x16')](function(_0x56eab1){_0x530474(null,_[_0x0283('0x49')](_0x56eab1)?![]:!![]);})[_0x0283('0x17')](function(_0x223df2){logger[_0x0283('0x31')](_0x223df2);_0x530474(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x725b6d,_0x251165){var _0x2a554b={'role':_0x0283('0x5f')};_0x2a554b[_0x725b6d]=this['channel'][_0x0283('0x60')];var _0x1149e9=_0x725b6d!=_0x0283('0x63')?util[_0x0283('0x64')](_0x0283('0x65'),'LOCAL',this[_0x0283('0x11')][_0x0283('0x60')]):undefined;this[_0x0283('0x12')][_0x0283('0x66')](_0x2a554b,_0x1149e9)[_0x0283('0x16')](function(_0x1f2eec){_0x251165(null,_[_0x0283('0x49')](_0x1f2eec)?![]:!![]);})[_0x0283('0x17')](function(_0x2ef953){logger[_0x0283('0x31')](_0x2ef953);_0x251165(null,![]);});};AGIVertices[_0x0283('0x1a')]['shellCommand']=function(_0x1894a4,_0x1f5b3a){sh[_0x0283('0x67')](_[_0x0283('0x68')](_0x1894a4),function(_0x9ab33,_0x162b06){var _0x5835f9=_0x162b06[_0x0283('0x69')](/(\r\n|\n|\r)/gm,'');_0x1f5b3a(null,_0x5835f9);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x6a')]=function(_0x283da3,_0x17aea9){scripts['googleCloudTTS'](_0x283da3[_0x0283('0x6b')],_0x283da3[_0x0283('0x6c')]||_0x0283('0x6d'),_0x283da3[_0x0283('0x6d')],_0x283da3[_0x0283('0x6e')]||'en-US',_0x283da3[_0x0283('0x6f')]||_0x0283('0x70'),_0x283da3['audioEncoding']||_0x0283('0x71'))['then'](function(_0x1ab49d){_0x17aea9(null,_0x1ab49d);})[_0x0283('0x17')](function(_0x2b8052){_0x17aea9(_0x2b8052);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x72')]=function(_0x313598,_0x5b6b27){scripts[_0x0283('0x72')](_0x313598[_0x0283('0x6d')],_0x313598[_0x0283('0x73')]||'en',0x1)[_0x0283('0x16')](function(_0x296d22){_0x5b6b27(null,_0x296d22);})[_0x0283('0x17')](function(_0x33713c){_0x5b6b27(_0x33713c);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x74')]=function(_0x5c5ce0,_0x184ecd){var _0x3a4d47={'uri':_0x5c5ce0[_0x0283('0x75')],'method':_0x5c5ce0['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5c5ce0['timeout'])===_0x0283('0x76')&&parseInt(_0x5c5ce0[_0x0283('0x77')])>=0x1?parseInt(_0x5c5ce0[_0x0283('0x77')])*0x3e8:0x5*0x3e8};if(_[_0x0283('0x78')]([_0x0283('0x79'),_0x0283('0x7a')],_0x3a4d47[_0x0283('0x7b')][_0x0283('0x7c')]())){try{_0x3a4d47[_0x0283('0x7d')]=_0x5c5ce0[_0x0283('0xe')]?JSON[_0x0283('0x7e')](_0x5c5ce0[_0x0283('0xe')]):{};}catch(_0x46faf5){logger['error'](_0x0283('0x7f'),_0x46faf5);}}try{_0x3a4d47['headers']=_0x5c5ce0[_0x0283('0xd')]?JSON[_0x0283('0x7e')](_0x5c5ce0[_0x0283('0xd')]):{};}catch(_0x4c19f5){logger[_0x0283('0x31')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4c19f5);}if(_0x5c5ce0[_0x0283('0x80')]){try{var _0x53c85b=require(_0x5c5ce0[_0x0283('0x80')])['sync'](this,_0x3a4d47);_0x3a4d47[_0x0283('0x81')]=Mustache['render'](_0x5c5ce0['url'],_0x53c85b,{},['$$','$$']);if(_0x3a4d47['headers']){_0x3a4d47['headers']=JSON[_0x0283('0x7e')](Mustache['render'](JSON['stringify'](_0x3a4d47[_0x0283('0x82')]),_0x53c85b,{},['$$','$$']));}if(_0x3a4d47[_0x0283('0x7d')]){_0x3a4d47[_0x0283('0x7d')]=JSON[_0x0283('0x7e')](Mustache[_0x0283('0x83')](JSON[_0x0283('0x84')](_0x3a4d47['body']),_0x53c85b,{},['$$','$$']));}}catch(_0xaa0615){logger[_0x0283('0x31')](_0x0283('0x85'),_0xaa0615);}}rp(_0x3a4d47)['then'](function(_0x35514f){var _0x308963={'statusCode':_0x35514f[_0x0283('0x86')]||0xc8,'statusMessage':_0x35514f['statusMessage']||'OK','headers':_0x35514f[_0x0283('0x82')]||{},'body':_0x35514f[_0x0283('0x7d')]||{}};_0x184ecd(null,_0x308963);})['catch'](function(_0x320c6f){var _0x4523f6={'statusCode':_0x320c6f[_0x0283('0x86')]||0x1f4,'statusMessage':_0x320c6f[_0x0283('0x87')]||_0x0283('0x88'),'headers':_0x320c6f[_0x0283('0x89')][_0x0283('0x82')]||{},'body':_0x320c6f[_0x0283('0x89')][_0x0283('0x7d')]||{}};_0x184ecd(null,_0x4523f6);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x8a')]=function(_0x48bfaa,_0x29c08f){scripts['googleDialogflow'](this[_0x0283('0x11')]['uniqueid'],_0x48bfaa[_0x0283('0x8b')],_0x48bfaa[_0x0283('0x6d')],_0x48bfaa[_0x0283('0x8c')]||'en')['then'](function(_0x2e6e9f){_0x29c08f(null,_0x2e6e9f);})[_0x0283('0x17')](function(_0x1b6b25){_0x29c08f(_0x1b6b25);});};AGIVertices[_0x0283('0x1a')]['googleDialogflowV2']=function(_0x59b129,_0x47c5bc){scripts[_0x0283('0x8d')](this[_0x0283('0x11')][_0x0283('0x3c')],_0x59b129[_0x0283('0x8e')],_0x59b129[_0x0283('0x8f')],_0x59b129['private_key'],_0x59b129[_0x0283('0x6d')],_0x59b129['dialogflowV2_language']||'en')[_0x0283('0x16')](function(_0x29d9c5){_0x47c5bc(null,_0x29d9c5);})[_0x0283('0x17')](function(_0x1679f7){_0x47c5bc(_0x1679f7);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x90')]=function(_0x4c87fc,_0x103fd1){scripts[_0x0283('0x90')](this['channel'],_0x4c87fc)['then'](function(_0x46f097){_0x103fd1(null,_0x46f097);})[_0x0283('0x17')](function(_0x51123f){_0x103fd1(_0x51123f);});};AGIVertices[_0x0283('0x1a')]['ispeechTTS']=function(_0x2301a1,_0x4e902d){scripts['ispeechTTS'](_0x2301a1[_0x0283('0x8b')],_0x2301a1['text'],_0x2301a1[_0x0283('0x91')]||_0x0283('0x92'),_0x2301a1[_0x0283('0x93')])[_0x0283('0x16')](function(_0x3fe7a6){_0x4e902d(null,_0x3fe7a6);})['catch'](function(_0x35f9c5){_0x4e902d(_0x35f9c5);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x94')]=function(_0x4fe045,_0x107d6d,_0x4676fc){scripts[_0x0283('0x94')](_0x107d6d,_0x4fe045[_0x0283('0x8b')],_0x4fe045['ispeech_asr_language']||_0x0283('0x92'),this[_0x0283('0x95')](_0x4fe045['model'])?_0x4fe045['model']:undefined)[_0x0283('0x16')](function(_0x5ed0e9){_0x4676fc(null,_0x5ed0e9);})['catch'](function(_0x341e93){_0x4676fc(_0x341e93);});};AGIVertices['prototype']['awsPolly']=function(_0xc78a6,_0x4f5df2){scripts[_0x0283('0x96')](_0xc78a6[_0x0283('0x97')],_0xc78a6[_0x0283('0x98')],_0xc78a6['aws_polly_region'],_0xc78a6[_0x0283('0x99')]||'Amy',_0xc78a6[_0x0283('0x6d')],_0xc78a6[_0x0283('0x9a')]||_0x0283('0x6d'))[_0x0283('0x16')](function(_0x4a53f5){_0x4f5df2(null,_0x4a53f5);})[_0x0283('0x17')](function(_0xba1ebe){_0x4f5df2(_0xba1ebe);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x9b')]=function(_0x4d53d7,_0x554e84){scripts[_0x0283('0x9b')](this[_0x0283('0x11')][_0x0283('0x3c')],_0x4d53d7[_0x0283('0x97')],_0x4d53d7[_0x0283('0x98')],_0x4d53d7[_0x0283('0x9c')],_0x4d53d7['text'],_0x4d53d7[_0x0283('0x9d')])[_0x0283('0x16')](function(_0x411acb){_0x554e84(null,_0x411acb);})[_0x0283('0x17')](function(_0x3e5542){_0x554e84(_0x3e5542);});};AGIVertices[_0x0283('0x1a')][_0x0283('0x9e')]=function(_0xe1aae4,_0x3b922d,_0x22049c){scripts[_0x0283('0x9e')](_0x3b922d,_0xe1aae4['key'],_0xe1aae4[_0x0283('0x9f')]||_0x0283('0x92'))['then'](function(_0x50c47e){_0x22049c(null,_0x50c47e);})['catch'](function(_0x131fc7){_0x22049c(_0x131fc7);});};AGIVertices[_0x0283('0x1a')][_0x0283('0xa0')]=function(_0xc80e2,_0x505e86,_0x5de4c9){scripts[_0x0283('0xa0')](_0x505e86,_0xc80e2['appid'],_0xc80e2[_0x0283('0xa1')],_0xc80e2[_0x0283('0x81')])['then'](function(_0x211afd){_0x5de4c9(null,_0x211afd);})['catch'](function(_0x915342){_0x5de4c9(_0x915342);});};AGIVertices[_0x0283('0x1a')]['clear']=function(_0x37d353){var _0x2402b9=_['includes'](verticesWithRetry,_0x37d353[_0x0283('0x3e')])?_0x37d353:_[_0x0283('0xa2')](_0x37d353);for(var _0x1e5ad0 in _0x2402b9){if(_0x2402b9[_0x0283('0xa3')](_0x1e5ad0)){if(_0x2402b9[_0x1e5ad0]&&_[_0x0283('0xa4')](_0x2402b9[_0x1e5ad0])){if(_[_0x0283('0x78')](recursiveMapAttributes,_0x1e5ad0)){_0x2402b9[_0x1e5ad0]=this['replaceObjectAllVariables'](_0x2402b9[_0x1e5ad0]);}else{_0x2402b9[_0x1e5ad0]=this[_0x0283('0xa5')](_0x2402b9[_0x1e5ad0]);}}}}return _0x2402b9;};AGIVertices['prototype'][_0x0283('0xa6')]=function(_0x2dfb1d){for(var _0x3b4fd2 in _0x2dfb1d){if(_0x2dfb1d['hasOwnProperty'](_0x3b4fd2)){if(_[_0x0283('0xa7')](_0x2dfb1d[_0x3b4fd2])){this[_0x0283('0xa6')](_0x2dfb1d[_0x3b4fd2]);}else if(_[_0x0283('0xa8')](_0x2dfb1d[_0x3b4fd2])){for(var _0x50cb8d=0x0;_0x50cb8d<_0x2dfb1d[_0x3b4fd2]['length'];_0x50cb8d++){this[_0x0283('0xa6')](_0x2dfb1d[_0x3b4fd2][_0x50cb8d]);}}else if(_[_0x0283('0xa4')](_0x2dfb1d[_0x3b4fd2])){_0x2dfb1d[_0x3b4fd2]=this[_0x0283('0xa5')](_0x2dfb1d[_0x3b4fd2]);}}}};AGIVertices[_0x0283('0x1a')]['saveRestApiResult']=function(_0x407d8a,_0x2fc8a2){for(var _0x55db23 in _0x407d8a){if(_0x407d8a[_0x0283('0xa3')](_0x55db23)){if(_[_0x0283('0xa7')](_0x407d8a[_0x55db23])){if(!_['isEmpty'](_0x407d8a[_0x55db23])){this['saveRestApiResult'](_0x407d8a[_0x55db23],util[_0x0283('0x64')](_0x0283('0xa9'),_0x2fc8a2,_0x55db23));}}else if(_[_0x0283('0xa8')](_0x407d8a[_0x55db23])){for(var _0x4951c2=0x0;_0x4951c2<_0x407d8a[_0x55db23][_0x0283('0xaa')];_0x4951c2++){this[_0x0283('0xab')](_0x407d8a[_0x55db23][_0x4951c2],util['format']('%s.%s',_0x2fc8a2,_0x55db23+'['+_0x4951c2+']'));}}else{if(!_['isNil'](_0x407d8a[_0x55db23])){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')]('%s.%s',_0x2fc8a2,_0x55db23),_0x407d8a[_0x55db23]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0xb96788){try{var _0x34f9e6=JSON[_0x0283('0x7e')](_0xb96788);this['recursiveNodeIndex'](_0x34f9e6);return JSON[_0x0283('0x84')](_0x34f9e6);}catch(_0x431c8c){return this[_0x0283('0xa5')](_0xb96788);}};AGIVertices[_0x0283('0x1a')][_0x0283('0xa5')]=function(_0x519195){var _0x4fbb5d=_0x519195[_0x0283('0xad')]('{');for(var _0x2c9c6d=0x1;_0x2c9c6d<_0x4fbb5d[_0x0283('0xaa')];_0x2c9c6d+=0x1){var _0x20da62=_0x4fbb5d[_0x2c9c6d]['split']('}');if(_0x20da62[_0x0283('0xaa')]>0x1){_0x519195=_0x519195[_0x0283('0xae')]('{'+_0x20da62[0x0]+'}',this[_0x0283('0x11')][_0x0283('0x14')](_0x20da62[0x0])[_0x0283('0xaf')]||_0x20da62[0x0]);}}if(_0x4fbb5d['length']===0x1){return _0x519195['toString']();}return this[_0x0283('0xa5')](_0x519195);};AGIVertices[_0x0283('0x1a')]['getAndSetVariable']=function(_0x44fa2f,_0xa186a6){var _0x219ac6=this[_0x0283('0x11')][_0x0283('0x14')](_0x44fa2f);if(_0x219ac6[_0x0283('0xb0')]===-0x1){return _0x219ac6;}logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0xb1'),_0xa186a6,_0x219ac6[_0x0283('0xaf')]));return this[_0x0283('0x11')][_0x0283('0xac')](_0xa186a6,_0x219ac6[_0x0283('0xaf')]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x95')]=function(_0x20ce47){return _0x20ce47&&_0x20ce47!=='0'&&_0x20ce47!=='-1'&&_0x20ce47!=='';};AGIVertices[_0x0283('0x1a')]['maxRetry']=function(_0x4776f9){this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x4776f9,'-');_0x4776f9[_0x0283('0xb4')]=_0x4776f9[_0x0283('0xb5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0283('0x1a')]['mrcpsynth']=function(_0x5b0fac){logger[_0x0283('0x35')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x5b0fac['label']));if(!this['isConfigured'](_0x5b0fac[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20text\x20configured');}var _0x5a5f24='\x22'+_0x5b0fac[_0x0283('0x6d')]+'\x22';if(this['isConfigured'](_0x5b0fac[_0x0283('0x89')])){_0x5a5f24+=','+_0x5b0fac['options'];}var _0x29d865=this[_0x0283('0x11')][_0x0283('0x67')](_0x0283('0xb7'),_0x5a5f24);if(_0x29d865[_0x0283('0xb0')]===-0x1){return _0x29d865;}return this['channel'][_0x0283('0xb6')](util['format'](_0x0283('0xb8'),_0x5a5f24));};AGIVertices[_0x0283('0x1a')]['mrcprecog']=function(_0x11308c){logger['info'](util[_0x0283('0x64')](_0x0283('0xb9'),_0x11308c[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x11308c[_0x0283('0xba')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xbb'));}var _0x49378b=_0x11308c['grammar'];if(this['isConfigured'](_0x11308c[_0x0283('0x89')])){_0x49378b+=','+_0x11308c[_0x0283('0x89')];}var _0x48d33=this[_0x0283('0x11')][_0x0283('0x67')](_0x0283('0xbc'),_0x49378b);if(_0x48d33[_0x0283('0xb0')]===-0x1){return _0x48d33;}var _0x5f2c78=this[_0x0283('0xbd')]('RECOG_CONFIDENCE()',_0x0283('0xbe'));if(_0x5f2c78[_0x0283('0xb0')]===-0x1){return _0x5f2c78;}var _0x3fc404=this[_0x0283('0xbd')](_0x0283('0xbf'),_0x0283('0xc0'));if(_0x3fc404[_0x0283('0xb0')]===-0x1){return _0x3fc404;}var _0x1d3c9f=this[_0x0283('0xbd')](_0x0283('0xc1'),_0x0283('0xc2'));if(_0x1d3c9f[_0x0283('0xb0')]===-0x1){return _0x1d3c9f;}return this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xc3'),_0x49378b));};AGIVertices[_0x0283('0x1a')][_0x0283('0x8')]=function(_0x13daf9){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0xc4'),_0x13daf9[_0x0283('0x3d')]));return this['channel'][_0x0283('0x8')]([_0x13daf9['command'],_0x13daf9[_0x0283('0xc5')]]);};AGIVertices[_0x0283('0x1a')][_0x0283('0xc6')]=function(_0x3b8247){logger[_0x0283('0x35')](util['format'](_0x0283('0xc7'),_0x3b8247['label']));if(this['isConfigured'](_0x3b8247[_0x0283('0x77')])){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0xc8'),_0x3b8247[_0x0283('0x77')]));var _0x5d348f=this[_0x0283('0x11')][_0x0283('0xc9')](_0x3b8247[_0x0283('0x77')]);if(_0x5d348f[_0x0283('0xb0')]===-0x1){return _0x5d348f;}}return this[_0x0283('0x11')][_0x0283('0xc6')]();};AGIVertices[_0x0283('0x1a')][_0x0283('0x51')]=function(_0x367908){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x367908[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x367908['list_id'])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x367908,_0x0283('0xca'));}_0x367908[_0x0283('0x50')]=moment();if(this[_0x0283('0x95')](_0x367908[_0x0283('0xcb')])){_0x367908['scheduledAt']=moment()['add'](_0x367908[_0x0283('0xcb')],'minutes');}if(!this[_0x0283('0x95')](_0x367908[_0x0283('0x54')])){_0x367908[_0x0283('0x54')]=0x2;}this[_0x0283('0x48')][_0x0283('0xb3')](this,_0x367908);return this[_0x0283('0x11')][_0x0283('0xb6')](util['format'](_0x0283('0xcc'),_0x367908['phone'],_0x367908['list_id'],_0x367908['scheduledAt']));};AGIVertices[_0x0283('0x1a')][_0x0283('0xcd')]=function(_0x10b247){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0xce'),_0x10b247['label']));var _0x4a9e30=this[_0x0283('0x11')][_0x0283('0x67')](_0x10b247[_0x0283('0xcf')],_0x10b247[_0x0283('0x89')]);if(_0x4a9e30[_0x0283('0xb0')]===-0x1){return _0x4a9e30;}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xd0'),_0x10b247[_0x0283('0xcf')],_0x10b247[_0x0283('0x89')]));};AGIVertices['prototype'][_0x0283('0xd1')]=function(_0x56ff4c){logger[_0x0283('0x35')](util['format'](_0x0283('0xd2'),_0x56ff4c[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x56ff4c[_0x0283('0x6d')])){return this[_0x0283('0x11')]['noop'](_0x0283('0xd3'));}var _0x5c9d2a='\x22'+_0x56ff4c[_0x0283('0x6d')]+'\x22';if(this[_0x0283('0x95')](_0x56ff4c['options'])){_0x5c9d2a+=','+_0x56ff4c[_0x0283('0x89')];}var _0x18c7e4=this['channel'][_0x0283('0x67')](_0x0283('0xb7'),_0x5c9d2a);if(_0x18c7e4[_0x0283('0xb0')]===-0x1){return _0x18c7e4;}return this[_0x0283('0x11')][_0x0283('0xb6')](util['format'](_0x0283('0xb8'),_0x5c9d2a));};AGIVertices['prototype']['sestektts']=function(_0x46d08e){logger['info'](util['format'](_0x0283('0xd4'),_0x46d08e[_0x0283('0x3d')]));if(!this['isConfigured'](_0x46d08e[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20text\x20configured');}var _0x40b37f='\x22'+_0x46d08e[_0x0283('0x6d')]+'\x22';if(this[_0x0283('0x95')](_0x46d08e[_0x0283('0x89')])){_0x40b37f+=','+_0x46d08e[_0x0283('0x89')];}var _0x4f4481=this[_0x0283('0x11')]['exec']('MRCPSynth',_0x40b37f);if(_0x4f4481[_0x0283('0xb0')]===-0x1){return _0x4f4481;}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xb8'),_0x40b37f));};AGIVertices['prototype'][_0x0283('0xd5')]=function(_0xeb3cea){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xeb3cea['label']));if(!this['isConfigured'](_0xeb3cea[_0x0283('0xba')])){return this['channel'][_0x0283('0xb6')]('no\x20grammar\x20configured');}var _0x4a1257=_0xeb3cea[_0x0283('0xba')];if(this[_0x0283('0x95')](_0xeb3cea[_0x0283('0x89')])){_0x4a1257+=','+_0xeb3cea[_0x0283('0x89')];}var _0x30eb92=this[_0x0283('0x11')]['exec'](_0x0283('0xbc'),_0x4a1257);if(_0x30eb92['result']===-0x1){return _0x30eb92;}var _0x43f943=this['getAndSetVariable'](_0x0283('0xd6'),_0x0283('0xd7'));if(_0x43f943['result']===-0x1){return _0x43f943;}var _0x5cf02a=this['getAndSetVariable'](_0x0283('0xbf'),_0x0283('0xd8'));if(_0x5cf02a[_0x0283('0xb0')]===-0x1){return _0x5cf02a;}var _0x30c797=this['getAndSetVariable'](_0x0283('0xc1'),'LUMENVOX_ASR_INSTANCE');if(_0x30c797['result']===-0x1){return _0x30c797;}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xc3'),_0x4a1257));};AGIVertices['prototype'][_0x0283('0xd9')]=function(_0x300812){logger['info'](util[_0x0283('0x64')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x300812[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x300812[_0x0283('0xba')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20grammar\x20configured');}var _0x409326=_0x300812[_0x0283('0xba')];if(this['isConfigured'](_0x300812[_0x0283('0x89')])){_0x409326+=','+_0x300812[_0x0283('0x89')];}var _0x562f4f=this['channel'][_0x0283('0x67')]('MRCPRecog',_0x409326);if(_0x562f4f[_0x0283('0xb0')]===-0x1){return _0x562f4f;}var _0x369ec7=this['getAndSetVariable'](_0x0283('0xd6'),_0x0283('0xda'));if(_0x369ec7[_0x0283('0xb0')]===-0x1){return _0x369ec7;}var _0x2ad398=this[_0x0283('0xbd')](_0x0283('0xbf'),_0x0283('0xdb'));if(_0x2ad398[_0x0283('0xb0')]===-0x1){return _0x2ad398;}var _0x58b273=this[_0x0283('0xbd')](_0x0283('0xc1'),'SESTEK_ASR_INSTANCE');if(_0x58b273['result']===-0x1){return _0x58b273;}return this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xc3'),_0x409326));};AGIVertices['prototype'][_0x0283('0xdc')]=function(_0x2e5153){logger['info'](util[_0x0283('0x64')](_0x0283('0xdd'),_0x2e5153[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x2e5153[_0x0283('0xde')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x2e5153,_0x0283('0xdf'));}var _0x537354=this[_0x0283('0x1e')][_0x0283('0xb3')](this,_0x2e5153[_0x0283('0xde')]);if(!_0x537354){return this[_0x0283('0x11')][_0x0283('0x31')](_0x2e5153,_0x0283('0xe0'));}if(!this[_0x0283('0x95')](_0x2e5153['query'])){return this['channel'][_0x0283('0x31')](_0x2e5153,'no\x20query\x20configured');}var _0x391440=_0x2e5153['query'][_0x0283('0x69')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0283('0x11')]['noop'](util['format'](_0x0283('0xe1'),_0x391440));var _0x8a2ec1=this[_0x0283('0x2f')][_0x0283('0xb3')](this,_0x537354,_0x391440);this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x2e5153,_0x391440);if(!this[_0x0283('0x95')](_0x2e5153[_0x0283('0xe2')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xe3'));}var _0x57ee68=this['getVariable'][_0x0283('0xb3')](this,_0x2e5153['variable_id']);if(!_0x57ee68){return this[_0x0283('0x11')][_0x0283('0x31')](_0x2e5153,'no\x20variable\x20found');}var _0x13bb8c=this;_0x8a2ec1[_0x0283('0xe4')](function(_0x33679d,_0x211820){Object['keys'](_0x33679d)[_0x0283('0xe4')](function(_0x23b275){_0x13bb8c[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0xe5'),_0x57ee68,_0x211820,_0x23b275),_0x33679d[_0x23b275]);});});this[_0x0283('0x11')][_0x0283('0xac')](util['format'](_0x0283('0xe6'),_0x57ee68),_0x8a2ec1['length']);return this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0xe7'),_0x57ee68));};AGIVertices[_0x0283('0x1a')][_0x0283('0xe8')]=function(_0x132159){logger[_0x0283('0xe9')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x132159['label']));if(!this[_0x0283('0x95')](_0x132159['sip_id'])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x132159,'no\x20user\x20selected');}var _0x4b921b=this[_0x0283('0x21')]['sync'](this,_0x132159[_0x0283('0xea')]);if(!_0x4b921b){return this['channel'][_0x0283('0x31')](_0x132159,'no\x20user\x20found');}var _0x2a759b=this['channel'][_0x0283('0x67')](_0x0283('0xeb'),[util[_0x0283('0x64')](_0x0283('0xec'),_0x4b921b),_0x132159[_0x0283('0x77')],_0x132159[_0x0283('0xed')],_0x132159[_0x0283('0x75')]]);if(_0x2a759b[_0x0283('0xb0')]===-0x1){return _0x2a759b;}return this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xee'),_0x0283('0xeb')));};AGIVertices[_0x0283('0x1a')][_0x0283('0xef')]=function(_0x263ac4){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0xf0'),_0x263ac4[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x263ac4['key'])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xf1'));}if(!this[_0x0283('0x95')](_0x263ac4[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xd3'));}this[_0x0283('0x11')][_0x0283('0xf2')]=!![];this[_0x0283('0xb2')](_0x263ac4);this[_0x0283('0x47')](_0x263ac4[_0x0283('0x6d')],'in','','');this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0xf3'),_0x263ac4[_0x0283('0x6d')]));var _0x34e63f=this['googleDialogflow'][_0x0283('0xb3')](this,_0x263ac4);if(_0x34e63f){for(var _0x131e37 in _0x34e63f){if(_0x34e63f[_0x0283('0xa3')](_0x131e37)){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0xf4'),_0x131e37[_0x0283('0x7c')]()),_0x34e63f[_0x131e37]);}}this['createSquareMessage'](_0x34e63f['speech'],'out','dialogflow','');return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xf5'),_0x34e63f[_0x0283('0xf6')]));}return this[_0x0283('0x11')][_0x0283('0x31')](_0x263ac4,_0x0283('0xf7'));};AGIVertices[_0x0283('0x1a')][_0x0283('0xf8')]=function(_0x420493){logger[_0x0283('0x35')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x420493['label']));if(!this['isConfigured'](_0x420493[_0x0283('0x8e')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xf9'));}if(!this[_0x0283('0x95')](_0x420493[_0x0283('0x8f')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20client_email\x20configured');}if(!this[_0x0283('0x95')](_0x420493[_0x0283('0xfa')])){return this[_0x0283('0x11')]['noop'](_0x0283('0xfb'));}if(!this[_0x0283('0x95')](_0x420493[_0x0283('0xfc')])){return this['channel']['noop'](_0x0283('0xfd'));}if(!this[_0x0283('0x95')](_0x420493[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xd3'));}this[_0x0283('0x11')][_0x0283('0xf2')]=!![];this['createSquareDetailsReport'](_0x420493);this[_0x0283('0x47')](_0x420493[_0x0283('0x6d')],'in','','');this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0xfe'),_0x420493[_0x0283('0x6d')]));var _0x97f86d=this['googleDialogflowV2'][_0x0283('0xb3')](this,_0x420493);if(_0x97f86d){for(var _0x43b4a8 in _0x97f86d){if(_0x97f86d['hasOwnProperty'](_0x43b4a8)){if(_0x43b4a8!==_0x0283('0xff')){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')]('DIALOGFLOW_%s',_0x43b4a8['toUpperCase']()),_0x97f86d[_0x43b4a8]);}}}this[_0x0283('0x47')](_0x97f86d['speech'],'out',_0x0283('0xf8'),_0x97f86d[_0x0283('0xff')]);return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x100'),_0x97f86d['speech']));}return this[_0x0283('0x11')][_0x0283('0x31')](_0x420493,_0x0283('0x101'));};AGIVertices[_0x0283('0x1a')][_0x0283('0x102')]=function(_0x3dc12){logger['info'](util[_0x0283('0x64')](_0x0283('0x103'),_0x3dc12[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x3dc12[_0x0283('0x104')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x0283('0x95')](_0x3dc12[_0x0283('0x105')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x106'));}if(!this['isConfigured'](_0x3dc12[_0x0283('0x107')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x108'));}if(!this[_0x0283('0x95')](_0x3dc12[_0x0283('0x109')])){return this['channel'][_0x0283('0xb6')](_0x0283('0xd3'));}this['channel']['bot']=!![];this[_0x0283('0xb2')](_0x3dc12);this['createSquareMessage'](_0x3dc12[_0x0283('0x6d')],'in','','');this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x10a'),_0x3dc12[_0x0283('0x6d')]));var _0x25783e=this['sestekNDA']['sync'](this,_0x3dc12);if(_0x25783e){for(var _0x1cb294 in _0x25783e){if(_0x25783e[_0x0283('0xa3')](_0x1cb294)){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0x10b'),_0x1cb294[_0x0283('0x7c')]()),_0x25783e[_0x1cb294]);}}this[_0x0283('0x47')](_0x25783e[_0x0283('0xf6')],_0x0283('0x10c'),_0x0283('0x102'),'');if(_0x25783e[_0x0283('0x10d')]){this[_0x0283('0x11')][_0x0283('0xb6')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x25783e[_0x0283('0x10d')]));var _0x3c5d5e=this[_0x0283('0x11')][_0x0283('0x10e')](_0x25783e['audiofile']);try{fs[_0x0283('0x10f')](_0x25783e[_0x0283('0x10d')]+_0x0283('0x110'));}catch(_0x4e9112){logger[_0x0283('0x31')](_0x4e9112);}return _0x3c5d5e;}else{return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x111'),_0x25783e[_0x0283('0xf6')]));}}return this[_0x0283('0x11')]['error'](_0x3dc12,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x0283('0x1a')]['end']=function(_0x7de48e){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x112'),_0x7de48e[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0xb6')]('end');};AGIVertices[_0x0283('0x1a')][_0x0283('0x113')]=function(_0xbbc5bc){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x114'),_0xbbc5bc[_0x0283('0x3d')]));var _0x8d8ebe='';if(_0xbbc5bc[_0x0283('0x115')]){if(!this[_0x0283('0x95')](_0xbbc5bc[_0x0283('0x115')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0xbbc5bc,_0x0283('0x116'));}else{var _0x18b96f=parseInt(_0xbbc5bc[_0x0283('0x115')],0xa);if(isNaN(_0x18b96f)){_0x8d8ebe=_0xbbc5bc['trunk_id'];}else{_0x8d8ebe=this[_0x0283('0x117')]['sync'](this,_0xbbc5bc[_0x0283('0x115')]);if(!_0x8d8ebe){return this[_0x0283('0x11')][_0x0283('0x31')](_0xbbc5bc,_0x0283('0x118'));}}}}else if(_0xbbc5bc['trunk_name']){_0x8d8ebe=_0xbbc5bc[_0x0283('0x119')];}else{return this['channel'][_0x0283('0x31')](_0xbbc5bc,'no\x20trunk\x20selected');}var _0x3e0409=this[_0x0283('0x11')][_0x0283('0x67')](_0x0283('0xeb'),[util[_0x0283('0x64')](_0x0283('0x11a'),_0x8d8ebe,_0xbbc5bc[_0x0283('0x4e')]),_0xbbc5bc[_0x0283('0x77')],_0xbbc5bc[_0x0283('0xed')],_0xbbc5bc[_0x0283('0x75')]]);if(_0x3e0409[_0x0283('0xb0')]===-0x1){return _0x3e0409;}return this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0xee'),_0x0283('0xeb')));};AGIVertices[_0x0283('0x1a')]['finally']=function(_0x2df59b){logger['info'](util[_0x0283('0x64')](_0x0283('0x11b'),_0x2df59b[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x11c'));};AGIVertices[_0x0283('0x1a')][_0x0283('0xf')]=function(_0x474bbc){logger[_0x0283('0x35')](util['format'](_0x0283('0x11d'),_0x474bbc[_0x0283('0x3d')]));if(_0x474bbc[_0x0283('0xb4')]===0x0){return this['maxRetry'](_0x474bbc);}_0x474bbc[_0x0283('0xb4')]-=0x1;if(!this[_0x0283('0x95')](_0x474bbc['file_id'])){return this['channel'][_0x0283('0x31')](_0x474bbc,'no\x20file\x20audio\x20selected');}var _0xce2b=this[_0x0283('0x23')][_0x0283('0xb3')](this,_0x474bbc['file_id']);if(!_0xce2b){return this[_0x0283('0x11')]['error'](_0x474bbc,_0x0283('0x11e'));}if(!this['isConfigured'](_0x474bbc[_0x0283('0xe2')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x0283('0xe3'));}var _0x13a9b2=this[_0x0283('0x11')]['getData'](_0xce2b,_0x474bbc[_0x0283('0x11f')],_0x474bbc[_0x0283('0x120')]);var _0x345612=_0x13a9b2[_0x0283('0xb0')]?_0x13a9b2[_0x0283('0xb0')][_0x0283('0x53')]():'';logger[_0x0283('0x35')](_0x0283('0x121'),JSON[_0x0283('0x84')](_0x13a9b2));if(_0x13a9b2[_0x0283('0xb0')]===-0x1){this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x474bbc,_0x345612);return _0x13a9b2;}else if(_0x13a9b2[_0x0283('0xaf')]==='timeout'){_0x13a9b2[_0x0283('0xb0')]=_0x345612[_0x0283('0xaa')]>=parseInt(_0x474bbc[_0x0283('0x122')])?'x':'i';}else{_0x13a9b2[_0x0283('0xb0')]=_0x345612[_0x0283('0xaa')]>=parseInt(_0x474bbc[_0x0283('0x122')])&&_0x345612['length']<=parseInt(_0x474bbc[_0x0283('0x120')])?'x':'i';}var _0x1a6c32=this[_0x0283('0x14')]['sync'](this,_0x474bbc[_0x0283('0xe2')]);if(!_0x1a6c32){return this['channel'][_0x0283('0x31')](_0x474bbc,_0x0283('0x123'));}this[_0x0283('0x11')][_0x0283('0xac')](_0x1a6c32,_0x345612);if(this[_0x0283('0x95')](_0x474bbc['hiddendigitsnum'])){var _0x42c891=parseInt(_0x474bbc['hiddendigitsnum'],0xa);var _0x1bda16=rs['generate']({'charset':'*','length':_0x42c891});var _0x2101e0=_0x345612[_0x0283('0xaa')];if(_0x2101e0>0x0){if(_0x2101e0>_0x42c891){this['createSquareDetailsReport'][_0x0283('0xb3')](this,_0x474bbc,_0x474bbc[_0x0283('0x124')]===_0x0283('0x125')?_0x1bda16+_0x345612[_0x0283('0x126')](_0x42c891):_0x345612[_0x0283('0x126')](0x0,_0x2101e0-_0x42c891)+_0x1bda16);}else{this[_0x0283('0xb2')]['sync'](this,_0x474bbc,rs[_0x0283('0x127')]({'charset':'*','length':_0x2101e0}));}}else{this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x474bbc,'');}}else{this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x474bbc,_0x345612);}return _0x13a9b2;};AGIVertices[_0x0283('0x1a')]['getsecretdigits']=function(_0x3feb3d){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x128'),_0x3feb3d['label']));return this['getdigits'](_0x3feb3d);};AGIVertices[_0x0283('0x1a')][_0x0283('0x129')]=function(_0x143210){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x12a'),_0x143210[_0x0283('0x3d')]));this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x143210,_0x143210[_0x0283('0x12b')]);return this['channel']['noop'](util[_0x0283('0x64')](_0x0283('0x12c'),_0x143210[_0x0283('0x12b')]));};AGIVertices['prototype'][_0x0283('0x12d')]=function(_0x1ea9f5){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x12e'),_0x1ea9f5['label']));if(!this[_0x0283('0x95')](_0x1ea9f5[_0x0283('0x97')])||!this[_0x0283('0x95')](_0x1ea9f5[_0x0283('0x98')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x12f'));}if(!this[_0x0283('0x95')](_0x1ea9f5[_0x0283('0x6d')])){return this[_0x0283('0x11')]['noop']('no\x20text\x20configured');}this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x130'),_0x1ea9f5[_0x0283('0x6d')]));var _0x525a56=this['awsPolly'][_0x0283('0xb3')](this,_0x1ea9f5);if(_0x525a56){this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')]('aws\x20Polly\x20%s\x20file\x20created',_0x525a56));var _0x57429f=this['channel'][_0x0283('0x10e')](_0x525a56);try{fs[_0x0283('0x10f')](_0x525a56+_0x0283('0x110'));}catch(_0x3e41db){logger['error'](_0x3e41db);}return _0x57429f;}return this[_0x0283('0x11')]['error'](_0x1ea9f5,_0x0283('0x131'));};AGIVertices[_0x0283('0x1a')][_0x0283('0x132')]=function(_0xfec778){logger[_0x0283('0x35')](util['format'](_0x0283('0x133'),_0xfec778[_0x0283('0x3d')]));if(!this['isConfigured'](_0xfec778[_0x0283('0x97')])||!this[_0x0283('0x95')](_0xfec778['aws_secret_access_key'])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x0283('0x95')](_0xfec778[_0x0283('0x9d')])){return this[_0x0283('0x11')]['noop'](_0x0283('0x134'));}if(!this[_0x0283('0x95')](_0xfec778[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20text\x20configured');}this['channel'][_0x0283('0xf2')]=!![];this[_0x0283('0xb2')](_0xfec778);this[_0x0283('0x47')](_0xfec778[_0x0283('0x6d')],'in','','');this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x135'),_0xfec778[_0x0283('0x6d')]));var _0x133aac=this[_0x0283('0x9b')][_0x0283('0xb3')](this,_0xfec778);if(_0x133aac){for(var _0x2e5843 in _0x133aac){if(_0x133aac[_0x0283('0xa3')](_0x2e5843)&&_[_0x0283('0xa4')](_0x133aac[_0x2e5843])){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0x136'),_0x2e5843[_0x0283('0x7c')]()),_0x133aac[_0x2e5843]);}}if(_[_0x0283('0x49')](_0x133aac[_0x0283('0x87')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x0283('0x47')](_0x133aac[_0x0283('0x87')],_0x0283('0x10c'),_0x0283('0x137'),'');return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x138'),_0x133aac['message']));}}return this[_0x0283('0x11')][_0x0283('0x31')](_0xfec778,_0x0283('0x139'));};AGIVertices[_0x0283('0x1a')][_0x0283('0x13a')]=function(_0x1ac0e0){logger[_0x0283('0x35')](util['format'](_0x0283('0x13b'),_0x1ac0e0[_0x0283('0x3d')],_0x1ac0e0[_0x0283('0x77')]));if(!this[_0x0283('0x95')](_0x1ac0e0['key'])){return this['channel'][_0x0283('0xb6')](_0x0283('0xf1'));}var _0x37d59a=_0x0283('0x13c');var _0x452593=util[_0x0283('0x64')]('%s/recordings/%s',FILES_PATH,rs[_0x0283('0x127')](0x4));var _0x3c6bb9=util[_0x0283('0x64')](_0x0283('0xa9'),_0x452593,_0x37d59a);var _0x57f618=!![];if(_0x1ac0e0[_0x0283('0x13d')]===_0x0283('0x13e')){_0x57f618=![];}var _0x2c131f=this[_0x0283('0x11')][_0x0283('0x13f')](_0x452593,_0x37d59a,_0x1ac0e0[_0x0283('0x140')],_0x1ac0e0['timeout'],undefined,_0x57f618);if(_0x2c131f[_0x0283('0xb0')]!==-0x1){this[_0x0283('0x11')][_0x0283('0xb6')](util['format']('google\x20%s\x20file\x20created',_0x3c6bb9));var _0x326d1f=this['googleASR'][_0x0283('0xb3')](this,_0x1ac0e0,_0x3c6bb9);if(_0x326d1f){for(var _0x5217de in _0x326d1f){if(_0x326d1f[_0x0283('0xa3')](_0x5217de)){this[_0x0283('0x11')][_0x0283('0xac')](util['format'](_0x0283('0x141'),_0x5217de[_0x0283('0x7c')]()),_0x326d1f[_0x5217de]);}}return this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')]('GoogleASR\x20Result\x20%s',JSON[_0x0283('0x84')](_0x326d1f)));}}return _0x2c131f;};AGIVertices[_0x0283('0x1a')][_0x0283('0x142')]=function(_0x17e920){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x143'),_0x17e920[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x17e920[_0x0283('0x144')])){return this['channel']['noop'](_0x0283('0x145'));}if(!this['isConfigured'](_0x17e920['appsecret'])){return this['channel']['noop'](_0x0283('0x146'));}var _0x5edb0c='wav';var _0x420ca6=util[_0x0283('0x64')](_0x0283('0x147'),FILES_PATH,rs[_0x0283('0x127')](0x4));var _0x3ba445=util['format']('%s.%s',_0x420ca6,_0x5edb0c);var _0x5432b3=!![];if(_0x17e920[_0x0283('0x13d')]===_0x0283('0x13e')){_0x5432b3=![];}var _0x16a6cd=this[_0x0283('0x11')]['recordFile'](_0x420ca6,_0x5edb0c,_0x17e920[_0x0283('0x140')],_0x17e920['timeout'],undefined,_0x5432b3);if(_0x16a6cd['result']!==-0x1){this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x148'),_0x3ba445));var _0x365e2c=this[_0x0283('0xa0')]['sync'](this,_0x17e920,_0x3ba445);if(_0x365e2c){for(var _0x45eb94 in _0x365e2c){if(_0x365e2c[_0x0283('0xa3')](_0x45eb94)){this[_0x0283('0x11')][_0x0283('0xac')](util['format'](_0x0283('0x149'),_0x45eb94[_0x0283('0x7c')]()),_0x365e2c[_0x45eb94]);}}return this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')]('TildeASR\x20Result\x20%s',JSON[_0x0283('0x84')](_0x365e2c)));}}return _0x16a6cd;};AGIVertices['prototype'][_0x0283('0x14a')]=function(_0x327236){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x14b'),_0x327236[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0x14c')](_0x327236[_0x0283('0x41')],_0x327236[_0x0283('0x42')],_0x327236['priority']);};AGIVertices[_0x0283('0x1a')][_0x0283('0x14d')]=function(_0x59b1c8){logger[_0x0283('0x35')](util['format'](_0x0283('0x14e'),_0x59b1c8['label']));if(!this[_0x0283('0x95')](_0x59b1c8[_0x0283('0x14f')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x59b1c8,'no\x20condition\x20configured');}try{var _0x47dd69=eval(_0x59b1c8[_0x0283('0x14f')])?_0x0283('0x150'):_0x0283('0x151');this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0x152'),_0x59b1c8[_0x0283('0x14f')],_0x47dd69));return{'code':0xc8,'result':_0x47dd69};}catch(_0xf62f5e){return{'code':0xc8,'result':_0x0283('0x151')};}};AGIVertices[_0x0283('0x1a')][_0x0283('0x153')]=function(_0x2d3fc1){logger['info'](util[_0x0283('0x64')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x2d3fc1[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x2d3fc1[_0x0283('0x154')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x2d3fc1,_0x0283('0x155'));}var _0x1f6269=this[_0x0283('0x29')][_0x0283('0xb3')](this,_0x2d3fc1[_0x0283('0x154')]);if(!_0x1f6269){return this[_0x0283('0x11')][_0x0283('0x31')](_0x2d3fc1,_0x0283('0x156'));}for(var _0x1355f7=0x0;_0x1355f7<_0x1f6269[_0x0283('0xaa')];_0x1355f7+=0x1){var _0x54774c=this['channel'][_0x0283('0x14')](util[_0x0283('0x64')](_0x0283('0x157'),_0x1f6269[_0x1355f7]));if(_0x54774c['result']===-0x1){return _0x54774c;}logger[_0x0283('0x35')](util[_0x0283('0x64')]('IFTIME\x20%s\x20%s',_0x1f6269[_0x1355f7],_0x54774c[_0x0283('0xaf')]));if(_0x54774c[_0x0283('0xaf')]===_0x0283('0x150')){logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x1f6269[_0x1355f7],_0x0283('0x150')));this['channel'][_0x0283('0xb6')](util['format']('IFTIME\x20%s\x20%s',_0x1f6269[_0x1355f7],_0x0283('0x150')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x0283('0x64')]('IFTIME\x20%s\x20%s',_0x1f6269[_0x1355f7],_0x0283('0x151')));this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x158'),_0x1f6269[_0x1355f7],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x0283('0x159')]=function(_0x4a6e54){logger['info'](util[_0x0283('0x64')](_0x0283('0x15a'),_0x4a6e54[_0x0283('0x3d')]));return this['channel'][_0x0283('0x159')]();};AGIVertices['prototype'][_0x0283('0x15b')]=function(_0x7b9af6){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x15c'),_0x7b9af6['label']));if(!this[_0x0283('0x95')](_0x7b9af6[_0x0283('0x8b')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20key\x20configured');}var _0x1a069f=_0x0283('0x13c');var _0x20bf5f=util[_0x0283('0x64')](_0x0283('0x147'),FILES_PATH,rs['generate'](0x4));var _0x320d65=util[_0x0283('0x64')](_0x0283('0xa9'),_0x20bf5f,_0x1a069f);var _0xc5e8af=!![];if(_0x7b9af6[_0x0283('0x13d')]===_0x0283('0x13e')){_0xc5e8af=![];}var _0x106765=this[_0x0283('0x11')][_0x0283('0x13f')](_0x20bf5f,_0x1a069f,_0x7b9af6[_0x0283('0x140')],_0x7b9af6['timeout'],undefined,_0xc5e8af);if(_0x106765[_0x0283('0xb0')]!==-0x1){this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')]('ispeech\x20%s\x20file\x20created',_0x320d65));var _0x4a200d=this['ispeechASR'][_0x0283('0xb3')](this,_0x7b9af6,_0x320d65);if(_0x4a200d){for(var _0x23c404 in _0x4a200d){if(_0x4a200d[_0x0283('0xa3')](_0x23c404)){this[_0x0283('0x11')][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0x15d'),_0x23c404[_0x0283('0x7c')]()),_0x4a200d[_0x23c404]);}}return this['channel']['noop'](util['format'](_0x0283('0x15e'),JSON[_0x0283('0x84')](_0x4a200d)));}}return _0x106765;};AGIVertices[_0x0283('0x1a')][_0x0283('0x15f')]=function(_0x109f3e){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x109f3e[_0x0283('0x3d')]));if(!this['isConfigured'](_0x109f3e[_0x0283('0x8b')])){return this[_0x0283('0x11')][_0x0283('0xb6')]('no\x20key\x20configured');}if(!this[_0x0283('0x95')](_0x109f3e[_0x0283('0x6d')])){return this['channel']['noop'](_0x0283('0xd3'));}this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x160'),_0x109f3e['text']));var _0x1b6723=this[_0x0283('0x161')]['sync'](this,_0x109f3e);if(_0x1b6723){this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')]('ispeech\x20%s\x20file\x20created',_0x1b6723));var _0x4a43fc=this[_0x0283('0x11')]['streamFile'](_0x1b6723,_0x109f3e[_0x0283('0x140')]);try{fs['unlink'](_0x1b6723+'.wav');}catch(_0x26e44c){logger[_0x0283('0x31')](_0x26e44c);}return _0x4a43fc;}return this[_0x0283('0x11')]['error'](_0x109f3e,_0x0283('0x162'));};AGIVertices[_0x0283('0x1a')]['login']=function(_0xa953fc){logger['info'](util[_0x0283('0x64')](_0x0283('0x163'),_0xa953fc['label']));if(!this[_0x0283('0x95')](_0xa953fc[_0x0283('0x164')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0xa953fc,'no\x20find\x20by\x20configured');}logger[_0x0283('0x35')](util['format'](_0x0283('0x165'),this[_0x0283('0x11')][_0x0283('0x60')],_0xa953fc[_0x0283('0x164')]));var _0x354195=this[_0x0283('0x66')][_0x0283('0xb3')](this,_0xa953fc['findBy']);if(_0x354195){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x166'),this['channel'][_0x0283('0x60')],_0xa953fc['findBy']));this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0283('0x11')][_0x0283('0x60')],_0xa953fc['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x167'),this[_0x0283('0x11')][_0x0283('0x60')],_0xa953fc[_0x0283('0x164')]));this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x167'),this[_0x0283('0x11')][_0x0283('0x60')],_0xa953fc[_0x0283('0x164')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0283('0x168')]=function(_0xb16921){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x169'),_0xb16921[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0xb16921['findBy'])){return this[_0x0283('0x11')]['error'](_0xb16921,_0x0283('0x16a'));}logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x165'),this[_0x0283('0x11')][_0x0283('0x60')],_0xb16921['findBy']));var _0x435917=this[_0x0283('0x62')][_0x0283('0xb3')](this,_0xb16921[_0x0283('0x164')]);if(_0x435917){logger[_0x0283('0x35')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0283('0x11')][_0x0283('0x60')],_0xb16921[_0x0283('0x164')]));this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x166'),this[_0x0283('0x11')][_0x0283('0x60')],_0xb16921[_0x0283('0x164')]));return{'code':0xc8,'result':_0x0283('0x16b')};}else{logger['info'](util['format'](_0x0283('0x167'),this[_0x0283('0x11')][_0x0283('0x60')],_0xb16921[_0x0283('0x164')]));this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0283('0x11')][_0x0283('0x60')],_0xb16921[_0x0283('0x164')]));return{'code':0xc8,'result':_0x0283('0x16c')};}};AGIVertices[_0x0283('0x1a')][_0x0283('0x16d')]=function(_0x25a8a0){logger['info'](util[_0x0283('0x64')](_0x0283('0x16e'),_0x25a8a0[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x25a8a0[_0x0283('0x16f')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x25a8a0,_0x0283('0x170'));}this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x171'),_0x25a8a0[_0x0283('0x16f')]));var _0x56ffaf=eval(_0x25a8a0['operation']);if(!this[_0x0283('0x95')](_0x25a8a0[_0x0283('0xe2')])){return this['channel'][_0x0283('0xb6')](_0x0283('0xe3'));}var _0x1fa087=this['getVariable']['sync'](this,_0x25a8a0[_0x0283('0xe2')]);if(!_0x1fa087){return this[_0x0283('0x11')][_0x0283('0x31')](_0x25a8a0,_0x0283('0x123'));}if(_[_0x0283('0xa8')](_0x56ffaf)){var _0x16c902=this;_0x56ffaf[_0x0283('0xe4')](function(_0x5ecdc6,_0x5a741c){_0x16c902[_0x0283('0x11')]['setVariable'](util[_0x0283('0x64')](_0x0283('0x172'),_0x1fa087,_0x5a741c),_0x5ecdc6);});return this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')]('variable\x20%s[key]\x20set',_0x1fa087));}else{return this['channel']['setVariable'](_0x1fa087,_0x56ffaf);}};AGIVertices[_0x0283('0x1a')][_0x0283('0x173')]=function(_0x367794){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x174'),_0x367794[_0x0283('0x3d')]));if(_0x367794['retry']===0x0){return this['maxRetry'](_0x367794);}_0x367794[_0x0283('0xb4')]-=0x1;if(!this['isConfigured'](_0x367794[_0x0283('0x175')])){return this[_0x0283('0x11')]['error'](_0x367794,'no\x20file\x20audio\x20selected');}var _0x43f10e=this[_0x0283('0x23')][_0x0283('0xb3')](this,_0x367794[_0x0283('0x175')]);if(!_0x43f10e){return this['channel']['error'](_0x367794,_0x0283('0x11e'));}var _0x268e8d=this[_0x0283('0x11')][_0x0283('0x176')](_0x43f10e,_0x367794[_0x0283('0x11f')],_0x367794[_0x0283('0x177')]);var _0x22cb94=_0x268e8d[_0x0283('0xb0')];if(_0x268e8d['result']===-0x1){this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x367794,'-1');return _0x268e8d;}else if(_0x268e8d['extra']===_0x0283('0x77')){_0x268e8d[_0x0283('0xb0')]=_0x268e8d[_0x0283('0xb0')][_0x0283('0xaa')]>0x0?_0x268e8d[_0x0283('0xb0')]:'t';}else if(_[_0x0283('0x4c')](_0x268e8d[_0x0283('0xb0')])){_0x268e8d['result']='#';_0x22cb94='#';}if(!this[_0x0283('0x95')](_0x367794[_0x0283('0xe2')])){this[_0x0283('0x11')]['noop'](_0x0283('0xe3'));}else{var _0x760b43=this[_0x0283('0x14')][_0x0283('0xb3')](this,_0x367794[_0x0283('0xe2')]);if(!_0x760b43){return this[_0x0283('0x11')][_0x0283('0x31')](_0x367794,_0x0283('0x123'));}this['channel'][_0x0283('0xac')](_0x760b43,_0x22cb94);}this['createSquareDetailsReport'][_0x0283('0xb3')](this,_0x367794,_0x22cb94);return _0x268e8d;};AGIVertices[_0x0283('0x1a')][_0x0283('0xb6')]=function(_0x3f4a7c){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3f4a7c[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0xb6')](_0x3f4a7c[_0x0283('0x178')]||_0x3f4a7c[_0x0283('0x3d')]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x179')]=function(_0x29060a){logger[_0x0283('0x35')](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x29060a[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x29060a[_0x0283('0x164')])){return this[_0x0283('0x11')]['error'](_0x29060a,_0x0283('0x16a'));}logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x165'),this['channel']['callerid'],_0x29060a[_0x0283('0x164')]));var _0x58b62b=this[_0x0283('0x5d')][_0x0283('0xb3')](this,_0x29060a['pause_id']);var _0x5618e4=this[_0x0283('0x5e')][_0x0283('0xb3')](this,_0x29060a[_0x0283('0x164')],_0x58b62b);if(_0x5618e4){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x166'),this[_0x0283('0x11')][_0x0283('0x60')],_0x29060a['findBy']));this[_0x0283('0x11')]['noop'](util['format'](_0x0283('0x166'),this[_0x0283('0x11')]['callerid'],_0x29060a[_0x0283('0x164')]));return{'code':0xc8,'result':_0x0283('0x16b')};}else{logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x167'),this['channel'][_0x0283('0x60')],_0x29060a[_0x0283('0x164')]));this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x29060a[_0x0283('0x164')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0283('0x17a')]=function(_0x4dd422){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x17b'),_0x4dd422[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x4dd422[_0x0283('0x175')])){return this['channel']['error'](_0x4dd422,_0x0283('0x17c'));}var _0xa5552e=this[_0x0283('0x23')][_0x0283('0xb3')](this,_0x4dd422[_0x0283('0x175')]);if(!_0xa5552e){return this['channel'][_0x0283('0x31')](_0x4dd422,_0x0283('0x11e'));}var _0x4c1b75=this[_0x0283('0x11')][_0x0283('0x67')](_0x0283('0x17d'),[_0xa5552e,_0x4dd422[_0x0283('0xed')]]);if(_0x4c1b75[_0x0283('0xb0')]===-0x1){return _0x4c1b75;}return this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xd0'),_0x0283('0x17d'),_0xa5552e));};AGIVertices[_0x0283('0x1a')][_0x0283('0x17e')]=function(_0x43bf1f){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x43bf1f[_0x0283('0x3d')]));if(!this['isConfigured'](_0x43bf1f[_0x0283('0x17f')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x43bf1f,_0x0283('0x180'));}var _0x50eaf7='';var _0x1dad9f=parseInt(_0x43bf1f[_0x0283('0x17f')],0xa);if(isNaN(_0x1dad9f)){_0x50eaf7=_0x43bf1f[_0x0283('0x17f')];}else{_0x50eaf7=this['getVoiceQueue']['sync'](this,_0x43bf1f[_0x0283('0x17f')]);if(!_0x50eaf7){return this[_0x0283('0x11')]['error'](_0x43bf1f,'no\x20queue\x20found');}}var _0x30d44f='';if(this['isConfigured'](_0x43bf1f[_0x0283('0x175')])){var _0x328267=this[_0x0283('0x23')]['sync'](this,_0x43bf1f[_0x0283('0x175')]);if(_0x328267){_0x30d44f=_0x328267;}}this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x43bf1f,_0x50eaf7);if(_0x43bf1f['opts'][_0x0283('0x181')]('x')<0x0){_0x43bf1f[_0x0283('0xed')]+='x';}if(_0x43bf1f[_0x0283('0xed')][_0x0283('0x181')]('X')<0x0){_0x43bf1f['opts']+='X';}this[_0x0283('0x11')]['setVariable'](_0x0283('0x182'),_0x50eaf7?_0x50eaf7[_0x0283('0x183')]():'');var _0x56e493=this[_0x0283('0x11')][_0x0283('0x67')]('QUEUE',[_0x50eaf7,_0x43bf1f[_0x0283('0xed')],_0x43bf1f[_0x0283('0x75')],_0x30d44f,_0x43bf1f[_0x0283('0x77')],_0x43bf1f['agi'],_0x43bf1f[_0x0283('0x184')],_0x43bf1f['gosub'],'',_0x43bf1f[_0x0283('0x185')]]);if(_0x56e493['result']===-0x1){return _0x56e493;}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xd0'),'QUEUE',_0x50eaf7));};AGIVertices[_0x0283('0x1a')][_0x0283('0x186')]=function(_0x31a984){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x187'),_0x31a984[_0x0283('0x3d')]));var _0x368af0=_0x31a984[_0x0283('0x188')]||_0x0283('0x13c');var _0x1ebe3c=util[_0x0283('0x64')]('%s_%s',this[_0x0283('0x11')][_0x0283('0x3c')],rs[_0x0283('0x127')](0x5));var _0x2f3a02=util[_0x0283('0x64')]('%s/recordings/%s.%s',FILES_PATH,_0x1ebe3c,_0x368af0);var _0x3fd494=util[_0x0283('0x64')](_0x0283('0x147'),FILES_PATH,_0x1ebe3c);this[_0x0283('0x40')][_0x0283('0xb3')](this,_0x31a984,_0x1ebe3c,_0x2f3a02);this[_0x0283('0x11')][_0x0283('0xac')](_0x0283('0x189'),_0x1ebe3c);logger[_0x0283('0x35')](_0x0283('0x18a'),_0x3fd494,_0x368af0,_0x31a984[_0x0283('0x18b')],_0x31a984['timeout']);return this[_0x0283('0x11')][_0x0283('0x13f')](_0x3fd494,_0x368af0,_0x31a984['escape_digits'],_0x31a984[_0x0283('0x77')],undefined,!![]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x18c')]=function(_0x396b47){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x396b47['label']));if(!this[_0x0283('0x95')](_0x396b47[_0x0283('0x75')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x18d'));}var _0x30879b=this[_0x0283('0x74')][_0x0283('0xb3')](this,_0x396b47);logger['info'](util[_0x0283('0x64')](_0x0283('0x18e'),util[_0x0283('0x18f')](_0x30879b,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x396b47[_0x0283('0xe2')])){return this[_0x0283('0x11')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x307a28=this['getVariable'][_0x0283('0xb3')](this,_0x396b47[_0x0283('0xe2')]);if(!_0x307a28){return this[_0x0283('0x11')]['error'](_0x396b47,_0x0283('0x123'));}this['channel'][_0x0283('0xac')](util[_0x0283('0x64')]('%s_STATUS_CODE',_0x307a28),_0x30879b[_0x0283('0x86')]?_0x30879b[_0x0283('0x86')]:'200');this['channel'][_0x0283('0xac')](util[_0x0283('0x64')](_0x0283('0x190'),_0x307a28),_0x30879b[_0x0283('0x191')]?_0x30879b[_0x0283('0x191')]:'OK');if(_0x30879b['body']){try{this[_0x0283('0xab')](_0x30879b[_0x0283('0x7d')],_0x307a28);}catch(_0x217d76){logger[_0x0283('0x31')](util[_0x0283('0x64')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x307a28));}}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0xe7'),_0x307a28));};AGIVertices[_0x0283('0x1a')]['saydigits']=function(_0xc8030b){logger[_0x0283('0x35')](util['format'](_0x0283('0x192'),_0xc8030b[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0x193')](_0xc8030b[_0x0283('0x194')][_0x0283('0x69')](/\s+/g,''),_0xc8030b['escape_digits']);};AGIVertices[_0x0283('0x1a')][_0x0283('0x195')]=function(_0x3fe86c){logger['info'](util[_0x0283('0x64')](_0x0283('0x196'),_0x3fe86c['label']));return this[_0x0283('0x11')][_0x0283('0x197')](_0x3fe86c[_0x0283('0x76')][_0x0283('0x69')](/\s+/g,''),_0x3fe86c[_0x0283('0x18b')]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x198')]=function(_0x37f0f6){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x199'),_0x37f0f6[_0x0283('0x3d')]));return this[_0x0283('0x11')][_0x0283('0x19a')](_0x37f0f6[_0x0283('0x6d')],_0x37f0f6[_0x0283('0x18b')]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x19b')]=function(_0x38236b){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x19c'),_0x38236b[_0x0283('0x3d')]));if(!this['isConfigured'](_0x38236b[_0x0283('0x19d')])){return this['channel']['noop'](_0x0283('0x19e'));}var _0x2d608c=this['getMailAccount']['sync'](this,_0x38236b[_0x0283('0x19d')]);if(!_0x2d608c||!_0x2d608c[_0x0283('0x19f')]){return this['channel'][_0x0283('0x31')](_0x38236b,_0x0283('0x1a0'));}var _0x4e7c48={'from':util[_0x0283('0x64')]('\x22%s\x22\x20<%s>',_0x2d608c[_0x0283('0x1d')],_0x2d608c[_0x0283('0x1a1')]||_0x2d608c['Smtp'][_0x0283('0x1a2')]),'to':_0x38236b['to']||'','cc':_0x38236b['cc']||'','bcc':_0x38236b[_0x0283('0x1a3')]||'','subject':_0x38236b[_0x0283('0x1a4')],'html':_0x38236b[_0x0283('0x6d')],'text':_0x38236b[_0x0283('0x6d')]};var _0x42c0e7={'tls':{'rejectUnauthorized':![]}};if(_0x2d608c[_0x0283('0x19f')]['service']){_0x42c0e7[_0x0283('0x1a5')]=_0x2d608c[_0x0283('0x19f')][_0x0283('0x1a5')];}else{_0x42c0e7[_0x0283('0x1a6')]=_0x2d608c['Smtp'][_0x0283('0x1a6')];_0x42c0e7[_0x0283('0x1a7')]=_0x2d608c[_0x0283('0x19f')][_0x0283('0x1a7')];_0x42c0e7['secure']=_0x2d608c[_0x0283('0x19f')][_0x0283('0x1a8')];}if(_0x2d608c['Smtp']['authentication']){_0x42c0e7[_0x0283('0x1a9')]={'user':_0x2d608c[_0x0283('0x19f')][_0x0283('0x1a2')],'pass':_0x2d608c[_0x0283('0x19f')][_0x0283('0x1aa')]};}if(this[_0x0283('0x95')](_0x38236b['template_id'])){}logger[_0x0283('0xe9')](_0x0283('0x1ab'),JSON[_0x0283('0x84')](_0x4e7c48));this[_0x0283('0xb2')]['sync'](this,_0x38236b,_0x38236b[_0x0283('0x19d')]);this['channel']['noop'](util[_0x0283('0x64')](_0x0283('0x1ac'),_0x2d608c[_0x0283('0x1d')]));this['sendMailMessage'][_0x0283('0xb3')](this,_0x42c0e7,_0x4e7c48);return this['channel']['noop'](_0x0283('0x1ad'));};AGIVertices[_0x0283('0x1a')]['sendFax']=function(_0xa7b46d){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1ae'),_0xa7b46d[_0x0283('0x3d')]));return this[_0x0283('0x11')]['noop'](_0x0283('0x1af'));};AGIVertices[_0x0283('0x1a')][_0x0283('0x1b0')]=function(_0x4ac32d){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1b1'),_0x4ac32d[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x4ac32d[_0x0283('0x1b2')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x1b3'));}var _0x4e31c5=this[_0x0283('0x39')][_0x0283('0xb3')](this,_0x4ac32d['sms_account_id']);if(!_0x4e31c5){return this['channel'][_0x0283('0x31')](_0x4ac32d,_0x0283('0x1b4'));}var _0x332e5b={'body':_0x4ac32d['sms_text'],'phone':_0x4ac32d['to']||'','SmsAccountId':_0x4e31c5['id']};logger['debug'](_0x0283('0x1b5'),JSON[_0x0283('0x84')](_0x332e5b));this['createSquareDetailsReport']['sync'](this,_0x4ac32d,_0x4ac32d['sms_account_id']);this['channel']['noop'](util[_0x0283('0x64')](_0x0283('0x1b6'),_0x4e31c5[_0x0283('0x1d')]));this[_0x0283('0x3b')][_0x0283('0xb3')](this,_0x332e5b);return this[_0x0283('0x11')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x0283('0x1b7')]=function(_0x4b096e){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4b096e['label']));if(!this[_0x0283('0x95')](_0x4b096e[_0x0283('0xe2')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x4b096e,_0x0283('0x1b8'));}var _0x5a1b8d=this['getVariable'][_0x0283('0xb3')](this,_0x4b096e['variable_id']);if(!_0x5a1b8d){return this[_0x0283('0x11')][_0x0283('0x31')](_0x4b096e,_0x0283('0x123'));}return this['channel'][_0x0283('0xac')](_0x5a1b8d,_0x4b096e[_0x0283('0x1b9')]);};AGIVertices[_0x0283('0x1a')][_0x0283('0x1ba')]=function(_0x5f1c96){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5f1c96[_0x0283('0x3d')]));this[_0x0283('0x11')]['noop']('START\x20CALLY\x20SQUARE');if(_0x5f1c96['answer']===_0x0283('0x1bb')){this[_0x0283('0x11')][_0x0283('0xb6')]('Answer');return this['channel'][_0x0283('0xc6')]();}return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0x1bc'));};AGIVertices[_0x0283('0x1a')]['subproject']=function(_0x5d50ae){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1bd'),_0x5d50ae[_0x0283('0x3d')]));if(!this['isConfigured'](_0x5d50ae[_0x0283('0x1be')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x5d50ae,_0x0283('0x1bf'));}var _0x1228c1=this[_0x0283('0x1b')][_0x0283('0xb3')](this,_0x5d50ae[_0x0283('0x1be')]);if(!this[_0x0283('0x95')](_0x1228c1)){return this['channel'][_0x0283('0x31')](_0x5d50ae,util[_0x0283('0x64')](_0x0283('0x1c0'),_0x5d50ae[_0x0283('0x1be')]));}if(_0x1228c1===this[_0x0283('0x11')][_0x0283('0x3f')]){return this[_0x0283('0x11')]['error'](_0x5d50ae,_0x0283('0x1c1'));}this[_0x0283('0xb2')][_0x0283('0xb3')](this,_0x5d50ae,_0x1228c1);var _0x2d773c=this[_0x0283('0x11')][_0x0283('0x67')](_0x0283('0x1c2'),util[_0x0283('0x64')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x0283('0x1a6')]||'127.0.0.1',_0x1228c1,this[_0x0283('0x11')][_0x0283('0x3f')]));if(_0x2d773c[_0x0283('0xb0')]===-0x1){return _0x2d773c;}return this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')]('Executed\x20command\x20%s\x20%s',_0x0283('0x1c2'),_0x1228c1));};AGIVertices[_0x0283('0x1a')]['system']=function(_0x20439c){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1c3'),_0x20439c[_0x0283('0x3d')]));var _0x5f2d51=this['shellCommand']['sync'](this,_0x20439c[_0x0283('0x1c4')]);this['createSquareDetailsReport'][_0x0283('0xb3')](this,_0x20439c,_0x20439c['command']);if(this['isConfigured'](_0x20439c[_0x0283('0xe2')])){var _0x5947fa=this[_0x0283('0x14')][_0x0283('0xb3')](this,_0x20439c[_0x0283('0xe2')]);if(_0x5947fa){this[_0x0283('0x11')][_0x0283('0xac')](_0x5947fa,_0x5f2d51);return this['channel']['noop'](util[_0x0283('0x64')](_0x0283('0x1c5'),_0x20439c[_0x0283('0x1c4')],_0x5947fa));}}return this['channel'][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x1c6'),_0x20439c[_0x0283('0x1c4')]));};AGIVertices[_0x0283('0x1a')][_0x0283('0x1c7')]=function(_0x39f09d){logger['info'](util[_0x0283('0x64')](_0x0283('0x1c8'),_0x39f09d['label']));_0x39f09d[_0x0283('0x6d')]=_0x39f09d[_0x0283('0x6d')][_0x0283('0x69')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0283('0x95')](_0x39f09d[_0x0283('0x6b')])){return this[_0x0283('0x11')]['noop'](_0x0283('0x1c9'));}if(!this[_0x0283('0x95')](_0x39f09d[_0x0283('0x6d')])){return this[_0x0283('0x11')][_0x0283('0xb6')](_0x0283('0xd3'));}this[_0x0283('0x11')][_0x0283('0xb6')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x39f09d['text']));var _0x5da1e=this['googleCloudTTS']['sync'](this,_0x39f09d);if(_0x5da1e){this['channel']['noop'](util['format'](_0x0283('0x1ca'),_0x5da1e));var _0x1c9988=this[_0x0283('0x11')][_0x0283('0x10e')](_0x5da1e);try{fs[_0x0283('0x10f')](_0x5da1e+_0x0283('0x110'));}catch(_0x45cd30){logger[_0x0283('0x31')](_0x45cd30);}return _0x1c9988;}return this[_0x0283('0x11')][_0x0283('0x31')](_0x39f09d,_0x0283('0x1cb'));};AGIVertices[_0x0283('0x1a')][_0x0283('0x1cc')]=function(_0x3d678c){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1cd'),_0x3d678c[_0x0283('0x3d')]));_0x3d678c[_0x0283('0x6d')]=_0x3d678c[_0x0283('0x6d')][_0x0283('0x69')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0283('0x95')](_0x3d678c['text'])){return this['channel'][_0x0283('0xb6')](_0x0283('0xd3'));}this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x1ce'),_0x3d678c[_0x0283('0x6d')]));var _0x2bf770=this[_0x0283('0x72')][_0x0283('0xb3')](this,_0x3d678c);if(_0x2bf770){this[_0x0283('0x11')][_0x0283('0xb6')](util['format'](_0x0283('0x1cf'),_0x2bf770));var _0x2641fd=this[_0x0283('0x11')]['streamFile'](_0x2bf770);try{fs[_0x0283('0x10f')](_0x2bf770+_0x0283('0x110'));}catch(_0x394b2d){logger['error'](_0x394b2d);}return _0x2641fd;}return this[_0x0283('0x11')][_0x0283('0x31')](_0x3d678c,_0x0283('0x1d0'));};AGIVertices[_0x0283('0x1a')]['unpause']=function(_0x5e15f9){logger[_0x0283('0x35')](util[_0x0283('0x64')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5e15f9[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x5e15f9[_0x0283('0x164')])){return this[_0x0283('0x11')][_0x0283('0x31')](_0x5e15f9,_0x0283('0x16a'));}logger[_0x0283('0x35')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0283('0x11')]['callerid'],_0x5e15f9[_0x0283('0x164')]));var _0x563d76=this[_0x0283('0x61')][_0x0283('0xb3')](this,_0x5e15f9[_0x0283('0x164')]);if(_0x563d76){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x166'),this[_0x0283('0x11')][_0x0283('0x60')],_0x5e15f9[_0x0283('0x164')]));this[_0x0283('0x11')][_0x0283('0xb6')](util[_0x0283('0x64')](_0x0283('0x166'),this[_0x0283('0x11')][_0x0283('0x60')],_0x5e15f9[_0x0283('0x164')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x167'),this[_0x0283('0x11')][_0x0283('0x60')],_0x5e15f9[_0x0283('0x164')]));this[_0x0283('0x11')]['noop'](util[_0x0283('0x64')](_0x0283('0x167'),this[_0x0283('0x11')][_0x0283('0x60')],_0x5e15f9[_0x0283('0x164')]));return{'code':0xc8,'result':_0x0283('0x16c')};}};AGIVertices[_0x0283('0x1a')][_0x0283('0x1d1')]=function(_0x165935){logger[_0x0283('0x35')](util['format'](_0x0283('0x1d2'),_0x165935[_0x0283('0x3d')]));var _0x4fa4c9=this[_0x0283('0x11')]['exec']('VOICEMAIL',[_0x165935[_0x0283('0x1d3')],_0x165935[_0x0283('0x89')]]);if(_0x4fa4c9['result']===-0x1){return _0x4fa4c9;}return this[_0x0283('0x11')][_0x0283('0xb6')](util['format']('Executed\x20command\x20%s\x20%s',_0x0283('0x1d4'),_0x165935['mailbox']));};AGIVertices['prototype'][_0x0283('0x1d5')]=function(_0x26568f){logger[_0x0283('0x35')](util[_0x0283('0x64')](_0x0283('0x1d6'),_0x26568f[_0x0283('0x3d')]));if(!this[_0x0283('0x95')](_0x26568f[_0x0283('0xe2')])){return this[_0x0283('0x11')]['error'](_0x26568f,_0x0283('0x1b8'));}var _0x2f6d48=this[_0x0283('0x14')][_0x0283('0xb3')](this,_0x26568f[_0x0283('0xe2')]);if(!_0x2f6d48){return this['channel'][_0x0283('0x31')](_0x26568f,_0x0283('0x123'));}var _0x1ade0=this['channel']['getVariable'](_0x2f6d48);return{'code':0xc8,'result':_0x1ade0['extra']?_0x1ade0[_0x0283('0xaf')]:'-'};};String[_0x0283('0x1a')][_0x0283('0xae')]=function(_0x2f6e33,_0x5f095f){return this['split'](_0x2f6e33)[_0x0283('0x1d7')](_0x5f095f);};module[_0x0283('0x1d8')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d04813b..41bfeed 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 _0xfa11=['uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','stringify','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x244325,_0x1e3d6c){var _0x5693db=function(_0x24a6b7){while(--_0x24a6b7){_0x244325['push'](_0x244325['shift']());}};_0x5693db(++_0x1e3d6c);}(_0xfa11,0x1d5));var _0x1fa1=function(_0x542735,_0x723cb8){_0x542735=_0x542735-0x0;var _0x54570e=_0xfa11[_0x542735];return _0x54570e;};'use strict';var util=require(_0x1fa1('0x0'));var _=require(_0x1fa1('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0x1fa1('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x1fa1('0x3'));function Acw(_0x385f00){this[_0x1fa1('0x4')]=_0x385f00['voiceQueues'];this[_0x1fa1('0x5')]=_0x385f00[_0x1fa1('0x5')];this[_0x1fa1('0x6')]=_0x385f00[_0x1fa1('0x6')];this['channels']={};ami['on'](_0x1fa1('0x7'),this[_0x1fa1('0x8')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xa'),this[_0x1fa1('0xb')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xc'),this['syncHangup'][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xd'),this['syncAgentRingNoAnswer'][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xe'),this[_0x1fa1('0xf')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0x10'),this[_0x1fa1('0x11')]['bind'](this));ami['on'](_0x1fa1('0x12'),this[_0x1fa1('0x13')]['bind'](this));}function getDiff(_0x5d14b4){var _0x20fd39=moment()[_0x1fa1('0x14')](0x0);var _0x50073d=moment(_0x5d14b4)[_0x1fa1('0x14')](0x0);return _0x20fd39['diff'](_0x50073d,_0x1fa1('0x15'));}Acw[_0x1fa1('0x16')]['startAcw']=function(_0x2177a4){try{var _0x11b268=this;var _0x149765=this[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x18')];var _0x27321e=this[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x19')];var _0x990233=this[_0x1fa1('0x4')][_0x27321e];var _0x36b129=![];var _0x7d7d9d=_0x1fa1('0x1a');if(_0x990233[_0x1fa1('0x1b')]){if(_0x990233[_0x1fa1('0x1c')][_0x1fa1('0x1d')]){_0x36b129=!![];_0x7d7d9d=_0x990233[_0x1fa1('0x1c')]['name'];}}ami['Action']({'action':'QueuePause','interface':_0x149765,'paused':!![],'reason':_0x7d7d9d})[_0x1fa1('0x1e')](function(_0x3f0ccb){if(_0x11b268[_0x1fa1('0x5')][_0x149765]){return RpcUser[_0x1fa1('0x1f')](_0x11b268['agents'][_0x149765]['id'])[_0x1fa1('0x1e')](function(_0xa088fa){if(_0xa088fa&&!_0xa088fa[_0x1fa1('0x20')]){logger[_0x1fa1('0x21')](_0x1fa1('0x22'),_0x2177a4,_0x149765,_0x27321e);var _0x47fb3a=_0x11b268[_0x1fa1('0x17')][_0x2177a4]['attended']&&_0x11b268[_0x1fa1('0x17')][_0x2177a4]['destlinkedid']?_0x11b268[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x23')]:_0x2177a4;return RpcUser[_0x1fa1('0x24')](_0x11b268[_0x1fa1('0x5')][_0x149765],_0x7d7d9d,_0x47fb3a)[_0x1fa1('0x1e')](function(_0x537494){if(!_0x36b129){_0x11b268[_0x1fa1('0x6')][_0x149765]={};logger[_0x1fa1('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2177a4,_0x11b268['voiceQueues'][_0x27321e]['acwTimeout'],_0x149765,_0x27321e);_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x25')]=setTimeout(_0x11b268[_0x1fa1('0x26')]['bind'](_0x11b268,_0x149765),_0x11b268[_0x1fa1('0x4')][_0x27321e]['acwTimeout']*0x3e8);_0x11b268[_0x1fa1('0x6')][_0x149765]['lastPauseAt']=moment()[_0x1fa1('0x27')](_0x1fa1('0x28'));_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x29')]=_0x2177a4;_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x19')]=_0x27321e;_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x2a')]=function(){var _0x79886d=getDiff(_0x11b268[_0x1fa1('0x6')][_0x149765]['lastPauseAt']);clearTimeout(_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x25')]);_0x11b268['timers'][_0x149765]['timer']=![];RpcVoiceAgentReport[_0x1fa1('0x2b')]({'acwtime':_0x79886d},_0x11b268['timers'][_0x149765]['uniqueid'],_0x149765)[_0x1fa1('0x1e')](function(_0x260b84){logger[_0x1fa1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x2177a4,_0x79886d,_0x260b84);})[_0x1fa1('0x2c')](function(_0x37607b){logger[_0x1fa1('0x2d')](_0x1fa1('0x2e'),_0x2177a4,_0x37607b);});delete _0x11b268[_0x1fa1('0x6')][_0x149765];};}});}else{logger[_0x1fa1('0x21')](_0x1fa1('0x2f'),_0x2177a4,_0x149765,_0x27321e);}});}})[_0x1fa1('0x2c')](function(_0x105251){logger[_0x1fa1('0x2d')](_0x1fa1('0x30'),_0x2177a4,_0x11b268[_0x1fa1('0x4')][_0x27321e][_0x1fa1('0x31')],_0x149765,_0x27321e);})[_0x1fa1('0x32')](function(){delete _0x11b268['channels'][_0x2177a4];});}catch(_0x5b5c67){logger[_0x1fa1('0x2d')](_0x1fa1('0x33'),_0x5b5c67[_0x1fa1('0x34')]);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x26')]=function(_0x30d294){try{var _0x304d80=this;if(_0x304d80[_0x1fa1('0x6')][_0x30d294]){_0x304d80[_0x1fa1('0x6')][_0x30d294][_0x1fa1('0x25')]=![];var _0xcb3dda=_0x304d80['timers'][_0x30d294]['uniqueid'];var _0x5592fb=_0x304d80['timers'][_0x30d294][_0x1fa1('0x19')];var _0x5d713d=_0x304d80[_0x1fa1('0x4')][_0x5592fb][_0x1fa1('0x31')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0xcb3dda,_0x30d294);RpcUser[_0x1fa1('0x35')](this['agents'][_0x30d294]);RpcVoiceAgentReport['update']({'acwtime':_0x5d713d,'agentacw':!![]},_0xcb3dda,_0x30d294)[_0x1fa1('0x1e')](function(_0x410e11){logger[_0x1fa1('0x21')](_0x1fa1('0x36'),_0xcb3dda,_0x5d713d,_0x410e11);})['catch'](function(_0x4f963c){logger['error'](_0x1fa1('0x2e'),_0xcb3dda,_0x4f963c);});}else{logger[_0x1fa1('0x2d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x30d294);if(_0x304d80['timers']){logger[_0x1fa1('0x21')]('[ACW][TIMERS]',JSON[_0x1fa1('0x37')](_0x304d80[_0x1fa1('0x6')]));}}}catch(_0x4e2feb){logger[_0x1fa1('0x2d')]('[ACW][STOP]\x20%s',_0x4e2feb['message']);}};Acw[_0x1fa1('0x16')]['syncAgentConnect']=function(_0x4bc30d){try{if(this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]]&&(this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]][_0x1fa1('0x2')]||this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]][_0x1fa1('0x1b')])){if(this[_0x1fa1('0x5')][_0x4bc30d[_0x1fa1('0x18')]]){this[_0x1fa1('0x17')][_0x4bc30d[_0x1fa1('0x29')]]={'queue':_0x4bc30d[_0x1fa1('0x19')],'interface':_0x4bc30d['interface'],'destlinkedid':_0x4bc30d[_0x1fa1('0x23')]};}}}catch(_0x1da7c5){logger[_0x1fa1('0x2d')](_0x1fa1('0x38'),_0x1da7c5['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x13')]=function(_0x2cc8d1){try{if(this[_0x1fa1('0x4')][_0x2cc8d1[_0x1fa1('0x19')]]&&(this['voiceQueues'][_0x2cc8d1[_0x1fa1('0x19')]]['acw']||this[_0x1fa1('0x4')][_0x2cc8d1[_0x1fa1('0x19')]][_0x1fa1('0x1b')])){if(this[_0x1fa1('0x5')][_0x2cc8d1['interface']]){this[_0x1fa1('0x17')][_0x2cc8d1[_0x1fa1('0x29')]]={'queue':_0x2cc8d1[_0x1fa1('0x19')],'interface':_0x2cc8d1[_0x1fa1('0x18')]};}}}catch(_0x4a6c65){logger[_0x1fa1('0x2d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4a6c65[_0x1fa1('0x34')]);}};Acw['prototype']['syncHangupRequest']=function(_0x22cb96){try{if(this[_0x1fa1('0x17')][_0x22cb96[_0x1fa1('0x29')]]&&_[_0x1fa1('0x39')](this['channels'][_0x22cb96['uniqueid']][_0x1fa1('0x3a')])){logger[_0x1fa1('0x21')](_0x1fa1('0x3b'),_0x22cb96[_0x1fa1('0x29')]);this[_0x1fa1('0x3c')](_0x22cb96[_0x1fa1('0x29')]);}else if(this[_0x1fa1('0x17')][_0x22cb96['linkedid']]&&_['isUndefined'](this[_0x1fa1('0x17')][_0x22cb96[_0x1fa1('0x3d')]][_0x1fa1('0x3a')])){logger['info'](_0x1fa1('0x3e'),_0x22cb96['linkedid']);this[_0x1fa1('0x3c')](_0x22cb96[_0x1fa1('0x3d')]);}}catch(_0x7ae8dd){logger['error'](_0x1fa1('0x3f'),_0x7ae8dd['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x40')]=function(_0x1dead2){try{if(this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x29')]]&&this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x29')]][_0x1fa1('0x3a')]){logger[_0x1fa1('0x21')](_0x1fa1('0x41'),_0x1dead2[_0x1fa1('0x29')]);this[_0x1fa1('0x3c')](_0x1dead2['uniqueid']);}else if(this['channels'][_0x1dead2['linkedid']]&&this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x3d')]][_0x1fa1('0x3a')]){logger[_0x1fa1('0x21')](_0x1fa1('0x42'),_0x1dead2[_0x1fa1('0x3d')]);this['startAcw'](_0x1dead2[_0x1fa1('0x3d')]);}}catch(_0x59bb3a){logger[_0x1fa1('0x2d')](_0x1fa1('0x43'),_0x59bb3a[_0x1fa1('0x34')]);}};Acw['prototype'][_0x1fa1('0xf')]=function(_0x2b1e44){try{if(!_[_0x1fa1('0x44')](this[_0x1fa1('0x17')][_0x2b1e44['transfereeuniqueid']])){this[_0x1fa1('0x3c')](_0x2b1e44[_0x1fa1('0x45')]);if(this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']]){this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']][_0x1fa1('0x3a')]=!![];this[_0x1fa1('0x17')][_0x2b1e44['transfertargetuniqueid']]=this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']];delete this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x46')]];}}else if(!_[_0x1fa1('0x44')](this[_0x1fa1('0x17')][_0x2b1e44['transfertargetuniqueid']])){this[_0x1fa1('0x3c')](_0x2b1e44[_0x1fa1('0x47')]);if(this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x48')]]){this[_0x1fa1('0x17')][_0x2b1e44['origtransfereruniqueid']][_0x1fa1('0x3a')]=!![];this['channels'][_0x2b1e44[_0x1fa1('0x45')]]=this[_0x1fa1('0x17')][_0x2b1e44['origtransfereruniqueid']];delete this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x48')]];}}}catch(_0x5afb52){logger[_0x1fa1('0x2d')](_0x1fa1('0x49'),_0x5afb52['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x11')]=function(_0x11aee8){try{if(this[_0x1fa1('0x17')][_0x11aee8[_0x1fa1('0x4a')]]){logger[_0x1fa1('0x21')](_0x1fa1('0x4b'),JSON[_0x1fa1('0x37')](_0x11aee8[_0x1fa1('0x4a')]));this[_0x1fa1('0x3c')](_0x11aee8[_0x1fa1('0x4a')]);}else if(this['channels'][_0x11aee8[_0x1fa1('0x4c')]]){logger[_0x1fa1('0x21')](_0x1fa1('0x4d'),JSON[_0x1fa1('0x37')](_0x11aee8[_0x1fa1('0x4c')]));this['startAcw'](_0x11aee8[_0x1fa1('0x4c')]);}}catch(_0x23b33a){logger[_0x1fa1('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x23b33a['message']);}};Acw['prototype'][_0x1fa1('0x4e')]=function(_0xb159f){try{if(this[_0x1fa1('0x4')][_0xb159f[_0x1fa1('0x19')]]&&this[_0x1fa1('0x4')][_0xb159f[_0x1fa1('0x19')]][_0x1fa1('0x4f')]===_0x1fa1('0x50')){if(this[_0x1fa1('0x5')][_0xb159f['interface']]){logger[_0x1fa1('0x21')](_0x1fa1('0x51'),_0xb159f[_0x1fa1('0x29')],_0xb159f[_0x1fa1('0x18')],_0xb159f[_0x1fa1('0x19')]);return RpcUser[_0x1fa1('0x24')](this['agents'][_0xb159f[_0x1fa1('0x18')]],_0x1fa1('0x52'),_0xb159f[_0x1fa1('0x29')]);}}}catch(_0x26a215){logger[_0x1fa1('0x2d')](_0x1fa1('0x53'),_0x26a215[_0x1fa1('0x34')]);}};module[_0x1fa1('0x54')]=Acw; \ No newline at end of file +var _0x6694=['../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x6694,0x1a9));var _0x4669=function(_0x166f2f,_0x58b359){_0x166f2f=_0x166f2f-0x0;var _0x1e98a9=_0x6694[_0x166f2f];return _0x1e98a9;};'use strict';var util=require(_0x4669('0x0'));var _=require(_0x4669('0x1'));var moment=require(_0x4669('0x2'));var ami=require('../ami');var logger=require(_0x4669('0x3'))(_0x4669('0x4'));var RpcUser=require(_0x4669('0x5'));var RpcVoiceAgentReport=require(_0x4669('0x6'));function Acw(_0x11ae85){this[_0x4669('0x7')]=_0x11ae85['voiceQueues'];this[_0x4669('0x8')]=_0x11ae85[_0x4669('0x8')];this['timers']=_0x11ae85[_0x4669('0x9')];this[_0x4669('0xa')]={};ami['on'](_0x4669('0xb'),this[_0x4669('0xc')][_0x4669('0xd')](this));ami['on']('hanguprequest',this[_0x4669('0xe')]['bind'](this));ami['on']('hangup',this['syncHangup'][_0x4669('0xd')](this));ami['on']('agentringnoanswer',this[_0x4669('0xf')][_0x4669('0xd')](this));ami['on']('attendedtransfer',this[_0x4669('0x10')][_0x4669('0xd')](this));ami['on'](_0x4669('0x11'),this[_0x4669('0x12')]['bind'](this));ami['on'](_0x4669('0x13'),this[_0x4669('0x14')][_0x4669('0xd')](this));}function getDiff(_0x289e64){var _0x1ac998=moment()['milliseconds'](0x0);var _0x2660ed=moment(_0x289e64)[_0x4669('0x15')](0x0);return _0x1ac998[_0x4669('0x16')](_0x2660ed,_0x4669('0x17'));}Acw[_0x4669('0x18')][_0x4669('0x19')]=function(_0x47ecd3){try{var _0x38ecd9=this;var _0x490603=this[_0x4669('0xa')][_0x47ecd3][_0x4669('0x1a')];var _0x2021d0=this[_0x4669('0xa')][_0x47ecd3][_0x4669('0x1b')];var _0x5e1873=this['voiceQueues'][_0x2021d0];var _0x675fc6=![];var _0x1ecda5=_0x4669('0x1c');if(_0x5e1873[_0x4669('0x1d')]){if(_0x5e1873[_0x4669('0x1e')][_0x4669('0x1f')]){_0x675fc6=!![];_0x1ecda5=_0x5e1873['mandatoryDispositionPause'][_0x4669('0x1f')];}}ami['Action']({'action':_0x4669('0x20'),'interface':_0x490603,'paused':!![],'reason':_0x1ecda5})[_0x4669('0x21')](function(_0x13b8be){if(_0x38ecd9[_0x4669('0x8')][_0x490603]){return RpcUser[_0x4669('0x22')](_0x38ecd9[_0x4669('0x8')][_0x490603]['id'])['then'](function(_0x5e6e1e){if(_0x5e6e1e&&!_0x5e6e1e['voicePause']){logger[_0x4669('0x23')](_0x4669('0x24'),_0x47ecd3,_0x490603,_0x2021d0);var _0x285080=_0x38ecd9[_0x4669('0xa')][_0x47ecd3][_0x4669('0x25')]&&_0x38ecd9[_0x4669('0xa')][_0x47ecd3][_0x4669('0x26')]?_0x38ecd9['channels'][_0x47ecd3][_0x4669('0x26')]:_0x47ecd3;return RpcUser[_0x4669('0x27')](_0x38ecd9['agents'][_0x490603],_0x1ecda5,_0x285080)['then'](function(_0x3f5a20){if(!_0x675fc6){_0x38ecd9[_0x4669('0x9')][_0x490603]={};logger['info'](_0x4669('0x28'),_0x47ecd3,_0x38ecd9['voiceQueues'][_0x2021d0][_0x4669('0x29')],_0x490603,_0x2021d0);_0x38ecd9[_0x4669('0x9')][_0x490603][_0x4669('0x2a')]=setTimeout(_0x38ecd9[_0x4669('0x2b')][_0x4669('0xd')](_0x38ecd9,_0x490603),_0x38ecd9[_0x4669('0x7')][_0x2021d0][_0x4669('0x29')]*0x3e8);_0x38ecd9['timers'][_0x490603][_0x4669('0x2c')]=moment()[_0x4669('0x2d')](_0x4669('0x2e'));_0x38ecd9['timers'][_0x490603]['uniqueid']=_0x47ecd3;_0x38ecd9['timers'][_0x490603][_0x4669('0x1b')]=_0x2021d0;_0x38ecd9[_0x4669('0x9')][_0x490603][_0x4669('0x2f')]=function(){var _0x2b9aab=getDiff(_0x38ecd9[_0x4669('0x9')][_0x490603][_0x4669('0x2c')]);clearTimeout(_0x38ecd9[_0x4669('0x9')][_0x490603][_0x4669('0x2a')]);_0x38ecd9[_0x4669('0x9')][_0x490603][_0x4669('0x2a')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x2b9aab},_0x38ecd9['timers'][_0x490603][_0x4669('0x30')],_0x490603)[_0x4669('0x21')](function(_0x16b1ab){logger[_0x4669('0x23')](_0x4669('0x31'),_0x47ecd3,_0x2b9aab,_0x16b1ab);})['catch'](function(_0x1c742e){logger[_0x4669('0x32')](_0x4669('0x33'),_0x47ecd3,_0x1c742e);});delete _0x38ecd9[_0x4669('0x9')][_0x490603];};}});}else{logger[_0x4669('0x23')](_0x4669('0x34'),_0x47ecd3,_0x490603,_0x2021d0);}});}})['catch'](function(_0x2116c9){logger[_0x4669('0x32')](_0x4669('0x28'),_0x47ecd3,_0x38ecd9['voiceQueues'][_0x2021d0][_0x4669('0x29')],_0x490603,_0x2021d0);})[_0x4669('0x35')](function(){delete _0x38ecd9['channels'][_0x47ecd3];});}catch(_0x35f7a7){logger[_0x4669('0x32')](_0x4669('0x36'),_0x35f7a7[_0x4669('0x37')]);}};Acw[_0x4669('0x18')]['stopAcw']=function(_0x3f48b2){try{var _0x2483c1=this;if(_0x2483c1['timers'][_0x3f48b2]){_0x2483c1[_0x4669('0x9')][_0x3f48b2][_0x4669('0x2a')]=![];var _0x11805a=_0x2483c1['timers'][_0x3f48b2][_0x4669('0x30')];var _0x25a738=_0x2483c1['timers'][_0x3f48b2][_0x4669('0x1b')];var _0x3dcea9=_0x2483c1[_0x4669('0x7')][_0x25a738]['acwTimeout'];logger[_0x4669('0x23')](_0x4669('0x38'),_0x11805a,_0x3f48b2);RpcUser[_0x4669('0x39')](this[_0x4669('0x8')][_0x3f48b2]);RpcVoiceAgentReport[_0x4669('0x3a')]({'acwtime':_0x3dcea9,'agentacw':!![]},_0x11805a,_0x3f48b2)[_0x4669('0x21')](function(_0x847562){logger[_0x4669('0x23')](_0x4669('0x31'),_0x11805a,_0x3dcea9,_0x847562);})['catch'](function(_0x4ec00e){logger[_0x4669('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x11805a,_0x4ec00e);});}else{logger['error'](_0x4669('0x3b'),_0x3f48b2);if(_0x2483c1['timers']){logger['info'](_0x4669('0x3c'),JSON['stringify'](_0x2483c1['timers']));}}}catch(_0x2311fd){logger[_0x4669('0x32')](_0x4669('0x3d'),_0x2311fd['message']);}};Acw[_0x4669('0x18')][_0x4669('0xc')]=function(_0x4ba65e){try{if(this[_0x4669('0x7')][_0x4ba65e[_0x4669('0x1b')]]&&(this[_0x4669('0x7')][_0x4ba65e[_0x4669('0x1b')]][_0x4669('0x4')]||this[_0x4669('0x7')][_0x4ba65e[_0x4669('0x1b')]][_0x4669('0x1d')])){if(this[_0x4669('0x8')][_0x4ba65e['interface']]){this['channels'][_0x4ba65e[_0x4669('0x30')]]={'queue':_0x4ba65e[_0x4669('0x1b')],'interface':_0x4ba65e[_0x4669('0x1a')],'destlinkedid':_0x4ba65e[_0x4669('0x26')]};}}}catch(_0x2ccec7){logger[_0x4669('0x32')](_0x4669('0x3e'),_0x2ccec7[_0x4669('0x37')]);}};Acw['prototype'][_0x4669('0x14')]=function(_0x14c76b){try{if(this[_0x4669('0x7')][_0x14c76b['queue']]&&(this['voiceQueues'][_0x14c76b[_0x4669('0x1b')]][_0x4669('0x4')]||this[_0x4669('0x7')][_0x14c76b[_0x4669('0x1b')]][_0x4669('0x1d')])){if(this['agents'][_0x14c76b[_0x4669('0x1a')]]){this[_0x4669('0xa')][_0x14c76b[_0x4669('0x30')]]={'queue':_0x14c76b['queue'],'interface':_0x14c76b[_0x4669('0x1a')]};}}}catch(_0x4e081f){logger[_0x4669('0x32')](_0x4669('0x3f'),_0x4e081f[_0x4669('0x37')]);}};Acw[_0x4669('0x18')][_0x4669('0xe')]=function(_0x1e8dd9){try{if(this['channels'][_0x1e8dd9[_0x4669('0x30')]]&&_[_0x4669('0x40')](this['channels'][_0x1e8dd9[_0x4669('0x30')]][_0x4669('0x25')])){logger[_0x4669('0x23')](_0x4669('0x41'),_0x1e8dd9[_0x4669('0x30')]);this[_0x4669('0x19')](_0x1e8dd9[_0x4669('0x30')]);}else if(this[_0x4669('0xa')][_0x1e8dd9['linkedid']]&&_['isUndefined'](this['channels'][_0x1e8dd9[_0x4669('0x42')]]['attended'])){logger['info'](_0x4669('0x43'),_0x1e8dd9[_0x4669('0x42')]);this[_0x4669('0x19')](_0x1e8dd9[_0x4669('0x42')]);}}catch(_0x41aa90){logger[_0x4669('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x41aa90['message']);}};Acw[_0x4669('0x18')][_0x4669('0x44')]=function(_0x43ec69){try{if(this[_0x4669('0xa')][_0x43ec69[_0x4669('0x30')]]&&this[_0x4669('0xa')][_0x43ec69['uniqueid']][_0x4669('0x25')]){logger[_0x4669('0x23')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x43ec69[_0x4669('0x30')]);this[_0x4669('0x19')](_0x43ec69[_0x4669('0x30')]);}else if(this[_0x4669('0xa')][_0x43ec69['linkedid']]&&this['channels'][_0x43ec69[_0x4669('0x42')]][_0x4669('0x25')]){logger[_0x4669('0x23')](_0x4669('0x45'),_0x43ec69['linkedid']);this['startAcw'](_0x43ec69[_0x4669('0x42')]);}}catch(_0xe1f3d3){logger[_0x4669('0x32')](_0x4669('0x46'),_0xe1f3d3['message']);}};Acw[_0x4669('0x18')][_0x4669('0x10')]=function(_0x6f8931){try{if(!_['isNil'](this[_0x4669('0xa')][_0x6f8931[_0x4669('0x47')]])){this['startAcw'](_0x6f8931['transfereeuniqueid']);if(this[_0x4669('0xa')][_0x6f8931['secondtransfereruniqueid']]){this[_0x4669('0xa')][_0x6f8931[_0x4669('0x48')]][_0x4669('0x25')]=!![];this[_0x4669('0xa')][_0x6f8931[_0x4669('0x49')]]=this[_0x4669('0xa')][_0x6f8931[_0x4669('0x48')]];delete this[_0x4669('0xa')][_0x6f8931['secondtransfereruniqueid']];}}else if(!_[_0x4669('0x4a')](this[_0x4669('0xa')][_0x6f8931[_0x4669('0x49')]])){this[_0x4669('0x19')](_0x6f8931[_0x4669('0x49')]);if(this['channels'][_0x6f8931[_0x4669('0x4b')]]){this[_0x4669('0xa')][_0x6f8931[_0x4669('0x4b')]][_0x4669('0x25')]=!![];this['channels'][_0x6f8931[_0x4669('0x47')]]=this[_0x4669('0xa')][_0x6f8931[_0x4669('0x4b')]];delete this[_0x4669('0xa')][_0x6f8931[_0x4669('0x4b')]];}}}catch(_0x48b6cf){logger[_0x4669('0x32')](_0x4669('0x4c'),_0x48b6cf['message']);}};Acw[_0x4669('0x18')]['syncBlindTransfer']=function(_0x4c4a4c){try{if(this[_0x4669('0xa')][_0x4c4a4c[_0x4669('0x4d')]]){logger[_0x4669('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x4669('0x4e')](_0x4c4a4c['transfereruniqueid']));this[_0x4669('0x19')](_0x4c4a4c[_0x4669('0x4d')]);}else if(this['channels'][_0x4c4a4c['transfererlinkedid']]){logger[_0x4669('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4669('0x4e')](_0x4c4a4c[_0x4669('0x4f')]));this[_0x4669('0x19')](_0x4c4a4c[_0x4669('0x4f')]);}}catch(_0x3ef4bd){logger[_0x4669('0x32')](_0x4669('0x50'),_0x3ef4bd[_0x4669('0x37')]);}};Acw[_0x4669('0x18')][_0x4669('0xf')]=function(_0x58f2fb){try{if(this[_0x4669('0x7')][_0x58f2fb[_0x4669('0x1b')]]&&this['voiceQueues'][_0x58f2fb[_0x4669('0x1b')]]['autopause']===_0x4669('0x51')){if(this[_0x4669('0x8')][_0x58f2fb['interface']]){logger['info'](_0x4669('0x52'),_0x58f2fb[_0x4669('0x30')],_0x58f2fb[_0x4669('0x1a')],_0x58f2fb[_0x4669('0x1b')]);return RpcUser[_0x4669('0x27')](this['agents'][_0x58f2fb[_0x4669('0x1a')]],_0x4669('0x53'),_0x58f2fb['uniqueid']);}}}catch(_0x3104ee){logger['error'](_0x4669('0x54'),_0x3104ee['message']);}};module[_0x4669('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3c3b8f7..061659f 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x450781,_0x33b54c){var _0x8fc838=function(_0x206536){while(--_0x206536){_0x450781['push'](_0x450781['shift']());}};_0x8fc838(++_0x33b54c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0x0b0e[_0x52b91f];return _0x15f8f5;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x404460,_0x53dcf8){var _0x423a08=function(_0x23ffb6){while(--_0x23ffb6){_0x404460['push'](_0x404460['shift']());}};_0x423a08(++_0x53dcf8);}(_0x757a,0xde));var _0xa757=function(_0x320f44,_0x2a200e){_0x320f44=_0x320f44-0x0;var _0x908b46=_0x757a[_0x320f44];return _0x908b46;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d363c5c..594fb7f 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(_0x2c96de,_0x4624f1){var _0x1610af=function(_0x330906){while(--_0x330906){_0x2c96de['push'](_0x2c96de['shift']());}};_0x1610af(++_0x4624f1);}(_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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x174e10,_0x32f58c){var _0x4184c5=function(_0x4988aa){while(--_0x4988aa){_0x174e10['push'](_0x174e10['shift']());}};_0x4184c5(++_0x32f58c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x33e678,_0x536cd9){_0x33e678=_0x33e678-0x0;var _0x16b4a6=_0xb43b[_0x33e678];return _0x16b4a6;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 5d00f54..5a0d795 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 _0xbec0=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','util','lodash','string','isNil','voiceQueue','uniqueid','Contact','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x493de0,_0x458795){var _0x421d14=function(_0x4ec67d){while(--_0x4ec67d){_0x493de0['push'](_0x493de0['shift']());}};_0x421d14(++_0x458795);}(_0xbec0,0x125));var _0x0bec=function(_0x2c2530,_0x1635ce){_0x2c2530=_0x2c2530-0x0;var _0x20ee16=_0xbec0[_0x2c2530];return _0x20ee16;};'use strict';var util=require(_0x0bec('0x0'));var _=require(_0x0bec('0x1'));var moment=require('moment');function checkNameSurname(_0x3b2926,_0x70d7b1,_0x5dbba8){var _0x11c61c='';if(!_['isNil'](_0x70d7b1)&&_0x0bec('0x2')===typeof _0x70d7b1){_0x11c61c+=_0x70d7b1;}if(!_[_0x0bec('0x3')](_0x5dbba8)&&_0x0bec('0x2')===typeof _0x5dbba8){_0x11c61c+='\x20'+_0x5dbba8;}if(_0x11c61c!==''){return _0x11c61c;}return _0x3b2926;}function Action(_0x2cb991,_0x554246,_0x49a360){this[_0x0bec('0x4')]=_0x2cb991;this[_0x0bec('0x5')]=_0x49a360||undefined;this['name']=checkNameSurname(_0x554246['Contact']['phone'],_0x554246[_0x0bec('0x6')]['firstName'],_0x554246[_0x0bec('0x6')][_0x0bec('0x7')]);this['number']=_0x554246[_0x0bec('0x6')]['phone'];this[_0x0bec('0x8')]=_0x2cb991[_0x0bec('0x9')];this['active']=_0x554246[_0x0bec('0xa')]||![];this[_0x0bec('0xb')]=_0x2cb991['type'];this[_0x0bec('0xc')]=_0x2cb991[_0x0bec('0xc')]||0x3;this['scheduledat']=_0x554246[_0x0bec('0xd')];this[_0x0bec('0xe')]=_0x554246[_0x0bec('0xe')];this['countcongestionretry']=_0x554246[_0x0bec('0xf')];this['countnoanswerretry']=_0x554246[_0x0bec('0x10')];this[_0x0bec('0x11')]=_0x554246[_0x0bec('0x11')];this[_0x0bec('0x12')]=_0x554246['countdropretry'];this[_0x0bec('0x13')]=_0x554246[_0x0bec('0x13')];this[_0x0bec('0x14')]=_0x554246[_0x0bec('0x14')];this['countagentrejectretry']=_0x554246[_0x0bec('0x15')];this[_0x0bec('0x16')]=_0x554246[_0x0bec('0x16')];this[_0x0bec('0x17')]=_0x554246['ListId'];this[_0x0bec('0x18')]=_0x554246[_0x0bec('0x18')];this[_0x0bec('0x19')]=_0x554246[_0x0bec('0x19')];this[_0x0bec('0x1a')]=_0x554246[_0x0bec('0x1a')];this[_0x0bec('0x1b')]=_0x554246['id'];this[_0x0bec('0x1c')]=_0x554246['Contact']['firstName']||'';this[_0x0bec('0x1d')]=moment()['format'](_0x0bec('0x1e'));this[_0x0bec('0x1f')]=_0x554246['callback'];this[_0x0bec('0x20')]=_0x554246['callbackuniqueid'];this[_0x0bec('0x21')]=_0x554246[_0x0bec('0x21')];this[_0x0bec('0x22')]=_0x554246[_0x0bec('0x22')];this[_0x0bec('0x23')]='';this[_0x0bec('0x24')]='';}Action[_0x0bec('0x25')][_0x0bec('0x26')]=function(){return util[_0x0bec('0x27')](_0x0bec('0x28'),this['name'],this[_0x0bec('0x4')][_0x0bec('0x29')]>0x0?this[_0x0bec('0x2a')][_0x0bec('0x2b')](this[_0x0bec('0x4')][_0x0bec('0x29')]):this[_0x0bec('0x2a')]);};Action[_0x0bec('0x25')]['getQueue']=function(){return this[_0x0bec('0x8')];};module['exports']=Action; \ No newline at end of file +var _0x99c5=['ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','name','substring','getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','Contact','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x5a6a86,_0xc94d06){var _0x30b169=function(_0x55ed0c){while(--_0x55ed0c){_0x5a6a86['push'](_0x5a6a86['shift']());}};_0x30b169(++_0xc94d06);}(_0x99c5,0xc0));var _0x599c=function(_0x4b1314,_0xbdac65){_0x4b1314=_0x4b1314-0x0;var _0x3a25ca=_0x99c5[_0x4b1314];return _0x3a25ca;};'use strict';var util=require('util');var _=require(_0x599c('0x0'));var moment=require('moment');function checkNameSurname(_0x51e7d0,_0x80f30c,_0x501c03){var _0x269395='';if(!_[_0x599c('0x1')](_0x80f30c)&&_0x599c('0x2')===typeof _0x80f30c){_0x269395+=_0x80f30c;}if(!_['isNil'](_0x501c03)&&_0x599c('0x2')===typeof _0x501c03){_0x269395+='\x20'+_0x501c03;}if(_0x269395!==''){return _0x269395;}return _0x51e7d0;}function Action(_0x22ed59,_0x51a91d,_0x47d3ff){this[_0x599c('0x3')]=_0x22ed59;this[_0x599c('0x4')]=_0x47d3ff||undefined;this['name']=checkNameSurname(_0x51a91d[_0x599c('0x5')]['phone'],_0x51a91d[_0x599c('0x5')]['firstName'],_0x51a91d[_0x599c('0x5')][_0x599c('0x6')]);this[_0x599c('0x7')]=_0x51a91d['Contact'][_0x599c('0x8')];this[_0x599c('0x9')]=_0x22ed59['name'];this['active']=_0x51a91d[_0x599c('0xa')]||![];this[_0x599c('0xb')]=_0x22ed59[_0x599c('0xb')];this['dialQueueTimeout']=_0x22ed59[_0x599c('0xc')]||0x3;this[_0x599c('0xd')]=_0x51a91d[_0x599c('0xd')];this[_0x599c('0xe')]=_0x51a91d[_0x599c('0xe')];this[_0x599c('0xf')]=_0x51a91d[_0x599c('0xf')];this[_0x599c('0x10')]=_0x51a91d[_0x599c('0x10')];this[_0x599c('0x11')]=_0x51a91d[_0x599c('0x11')];this['countdropretry']=_0x51a91d[_0x599c('0x12')];this['countabandonedretry']=_0x51a91d[_0x599c('0x13')];this['countmachineretry']=_0x51a91d[_0x599c('0x14')];this[_0x599c('0x15')]=_0x51a91d['countagentrejectretry'];this[_0x599c('0x16')]=_0x51a91d[_0x599c('0x16')];this['ListId']=_0x51a91d[_0x599c('0x17')];this[_0x599c('0x18')]=_0x51a91d[_0x599c('0x18')];this[_0x599c('0x19')]=_0x51a91d['VoiceQueueId'];this[_0x599c('0x1a')]=_0x51a91d[_0x599c('0x1a')];this[_0x599c('0x1b')]=_0x51a91d['id'];this[_0x599c('0x1c')]=_0x51a91d[_0x599c('0x5')][_0x599c('0x1d')]||'';this[_0x599c('0x1e')]=moment()[_0x599c('0x1f')](_0x599c('0x20'));this['callback']=_0x51a91d['callback'];this['callbackuniqueid']=_0x51a91d[_0x599c('0x21')];this[_0x599c('0x22')]=_0x51a91d[_0x599c('0x22')];this[_0x599c('0x23')]=_0x51a91d[_0x599c('0x23')];this[_0x599c('0x24')]='';this['originatecalleridname']='';}Action[_0x599c('0x25')][_0x599c('0x26')]=function(){return util[_0x599c('0x1f')](_0x599c('0x27'),this[_0x599c('0x28')],this[_0x599c('0x3')]['dialCutDigit']>0x0?this[_0x599c('0x7')][_0x599c('0x29')](this['voiceQueue']['dialCutDigit']):this['number']);};Action[_0x599c('0x25')][_0x599c('0x2a')]=function(){return this[_0x599c('0x9')];};module[_0x599c('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ea0892e..1a5891d 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 _0x236f=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','responsetime','answertime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x236f,0x1b2));var _0xf236=function(_0xf3d675,_0x18b880){_0xf3d675=_0xf3d675-0x0;var _0xa41008=_0x236f[_0xf3d675];return _0xa41008;};'use strict';var util=require(_0xf236('0x0'));var _=require(_0xf236('0x1'));var moment=require(_0xf236('0x2'));function getSeconds(_0x5de6e4,_0x3e2a1a){var _0x5698e1=moment(_0x5de6e4)[_0xf236('0x3')](0x0);var _0xc290ac=moment(_0x3e2a1a)[_0xf236('0x3')](0x0);return _0x5698e1['diff'](_0xc290ac,'seconds');}function AgentComplete(_0x52d1d9,_0x19238f){this[_0xf236('0x4')]=0x4;this[_0xf236('0x5')]='Answer';this['scheduledat']=_0x52d1d9[_0xf236('0x6')];this[_0xf236('0x7')]=_0x52d1d9['type'];this[_0xf236('0x8')]=_0x52d1d9[_0xf236('0x7')]===_0xf236('0x9')?_0xf236('0xa'):_0x52d1d9[_0xf236('0x7')];this[_0xf236('0xb')]=_0x52d1d9[_0xf236('0xb')];this[_0xf236('0xc')]=_0x52d1d9[_0xf236('0xc')];this[_0xf236('0xd')]=_0x52d1d9[_0xf236('0xd')];this[_0xf236('0xe')]=_0x52d1d9[_0xf236('0xb')]+_0x52d1d9[_0xf236('0xc')]+_0x52d1d9[_0xf236('0xd')]+_0x52d1d9[_0xf236('0xf')]+_0x52d1d9[_0xf236('0x10')]+_0x52d1d9[_0xf236('0x11')]+_0x52d1d9[_0xf236('0x12')]+_0x52d1d9[_0xf236('0x13')];this[_0xf236('0xf')]=_0x52d1d9[_0xf236('0xf')];this[_0xf236('0x10')]=_0x52d1d9['countdropretry'];this['countabandonedretry']=_0x52d1d9[_0xf236('0x11')];this[_0xf236('0x12')]=_0x52d1d9[_0xf236('0x12')];this[_0xf236('0x13')]=_0x52d1d9[_0xf236('0x13')];this['uniqueid']=_0x19238f['uniqueid'];this[_0xf236('0x14')]=_0x52d1d9[_0xf236('0x15')];this[_0xf236('0x16')]=_0x52d1d9['number'];this['starttime']=_0x52d1d9['starttime'];this['responsetime']=_0x52d1d9[_0xf236('0x17')];this[_0xf236('0x18')]=_0x52d1d9[_0xf236('0x18')];this[_0xf236('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf236('0x1a')]=getSeconds(_0x52d1d9[_0xf236('0x17')],_0x52d1d9['starttime']);this[_0xf236('0x1b')]=getSeconds(_0x52d1d9[_0xf236('0x18')],_0x52d1d9['responsetime']);this['talktime']=getSeconds(this[_0xf236('0x19')],_0x52d1d9[_0xf236('0x18')]);this['queue']=_0x19238f[_0xf236('0xa')];this['membername']=_0x19238f[_0xf236('0x1c')];this[_0xf236('0x1d')]=_0x19238f[_0xf236('0x1d')];this[_0xf236('0x1e')]=_0x52d1d9[_0xf236('0x1e')];this[_0xf236('0x1f')]=_0x52d1d9['callbackuniqueid'];this[_0xf236('0x20')]=_0x52d1d9[_0xf236('0x20')];this[_0xf236('0x21')]=_0x52d1d9[_0xf236('0x21')];this[_0xf236('0x22')]=_0x52d1d9[_0xf236('0x22')];this[_0xf236('0x23')]=_0x52d1d9[_0xf236('0x23')];this['UserId']=_0x52d1d9['UserId'];this[_0xf236('0x24')]=_0x52d1d9[_0xf236('0x24')];this[_0xf236('0x25')]=_0x52d1d9[_0xf236('0x25')];this[_0xf236('0x26')]=_0x52d1d9[_0xf236('0x26')]||'';this['originatecalleridname']=_0x52d1d9[_0xf236('0x27')]||'';}module[_0xf236('0x28')]=AgentComplete; \ No newline at end of file +var _0x2fe6=['talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2fe6,0xc1));var _0x62fe=function(_0x537964,_0x101826){_0x537964=_0x537964-0x0;var _0x44d361=_0x2fe6[_0x537964];return _0x44d361;};'use strict';var util=require('util');var _=require(_0x62fe('0x0'));var moment=require(_0x62fe('0x1'));function getSeconds(_0xc6c271,_0xa3ca12){var _0x515232=moment(_0xc6c271)[_0x62fe('0x2')](0x0);var _0x2175ad=moment(_0xa3ca12)[_0x62fe('0x2')](0x0);return _0x515232['diff'](_0x2175ad,_0x62fe('0x3'));}function AgentComplete(_0x1b258e,_0x37bde5){this[_0x62fe('0x4')]=0x4;this[_0x62fe('0x5')]=_0x62fe('0x6');this[_0x62fe('0x7')]=_0x1b258e[_0x62fe('0x7')];this[_0x62fe('0x8')]=_0x1b258e[_0x62fe('0x8')];this[_0x62fe('0x9')]=_0x1b258e[_0x62fe('0x8')]===_0x62fe('0xa')?_0x62fe('0xb'):_0x1b258e[_0x62fe('0x8')];this[_0x62fe('0xc')]=_0x1b258e[_0x62fe('0xc')];this[_0x62fe('0xd')]=_0x1b258e[_0x62fe('0xd')];this['countnoanswerretry']=_0x1b258e[_0x62fe('0xe')];this[_0x62fe('0xf')]=_0x1b258e[_0x62fe('0xc')]+_0x1b258e[_0x62fe('0xd')]+_0x1b258e['countnoanswerretry']+_0x1b258e['countnosuchnumberretry']+_0x1b258e[_0x62fe('0x10')]+_0x1b258e['countabandonedretry']+_0x1b258e[_0x62fe('0x11')]+_0x1b258e[_0x62fe('0x12')];this[_0x62fe('0x13')]=_0x1b258e['countnosuchnumberretry'];this[_0x62fe('0x10')]=_0x1b258e[_0x62fe('0x10')];this[_0x62fe('0x14')]=_0x1b258e[_0x62fe('0x14')];this[_0x62fe('0x11')]=_0x1b258e['countmachineretry'];this[_0x62fe('0x12')]=_0x1b258e['countagentrejectretry'];this['uniqueid']=_0x37bde5[_0x62fe('0x15')];this['calleridname']=_0x1b258e['name'];this[_0x62fe('0x16')]=_0x1b258e[_0x62fe('0x17')];this[_0x62fe('0x18')]=_0x1b258e[_0x62fe('0x18')];this[_0x62fe('0x19')]=_0x1b258e[_0x62fe('0x19')];this[_0x62fe('0x1a')]=_0x1b258e[_0x62fe('0x1a')];this[_0x62fe('0x1b')]=moment()[_0x62fe('0x1c')](_0x62fe('0x1d'));this[_0x62fe('0x1e')]=getSeconds(_0x1b258e[_0x62fe('0x19')],_0x1b258e[_0x62fe('0x18')]);this[_0x62fe('0x1f')]=getSeconds(_0x1b258e[_0x62fe('0x1a')],_0x1b258e['responsetime']);this[_0x62fe('0x20')]=getSeconds(this[_0x62fe('0x1b')],_0x1b258e[_0x62fe('0x1a')]);this[_0x62fe('0xb')]=_0x37bde5[_0x62fe('0xb')];this['membername']=_0x37bde5[_0x62fe('0x21')];this['reason']=_0x37bde5[_0x62fe('0x22')];this[_0x62fe('0x23')]=_0x1b258e[_0x62fe('0x23')];this['callbackuniqueid']=_0x1b258e[_0x62fe('0x24')];this[_0x62fe('0x25')]=_0x1b258e['callbackat'];this['recallme']=_0x1b258e[_0x62fe('0x26')];this[_0x62fe('0x27')]=_0x1b258e[_0x62fe('0x27')];this[_0x62fe('0x28')]=_0x1b258e[_0x62fe('0x28')];this[_0x62fe('0x29')]=_0x1b258e[_0x62fe('0x29')];this[_0x62fe('0x2a')]=_0x1b258e[_0x62fe('0x2a')];this[_0x62fe('0x2b')]=_0x1b258e[_0x62fe('0x2b')];this[_0x62fe('0x2c')]=_0x1b258e[_0x62fe('0x2c')]||'';this['originatecalleridname']=_0x1b258e['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 21a8943..a9fb651 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 _0x0faf=['originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x5b1861,_0x162600){var _0x1058fd=function(_0x21587d){while(--_0x21587d){_0x5b1861['push'](_0x5b1861['shift']());}};_0x1058fd(++_0x162600);}(_0x0faf,0x132));var _0xf0fa=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x0faf[_0x2d486b];return _0x4291d1;};'use strict';var util=require(_0xf0fa('0x0'));var _=require('lodash');var moment=require(_0xf0fa('0x1'));function getSeconds(_0x1b4763,_0x2c6207){var _0x35a260=moment(_0x1b4763)[_0xf0fa('0x2')](0x0);var _0xdc9ce3=moment(_0x2c6207)[_0xf0fa('0x2')](0x0);return _0x35a260[_0xf0fa('0x3')](_0xdc9ce3,_0xf0fa('0x4'));}function Final(_0x5d9b58){this[_0xf0fa('0x5')]=_0x5d9b58[_0xf0fa('0x5')];this[_0xf0fa('0x6')]=_0x5d9b58[_0xf0fa('0x6')];this[_0xf0fa('0x7')]=_0x5d9b58['type'];this[_0xf0fa('0x8')]=_0x5d9b58[_0xf0fa('0x7')]==='outbound'?'queue':_0x5d9b58[_0xf0fa('0x7')];this[_0xf0fa('0x9')]=_0x5d9b58[_0xf0fa('0x9')];this[_0xf0fa('0xa')]=_0x5d9b58[_0xf0fa('0xa')];this[_0xf0fa('0xb')]=_0x5d9b58[_0xf0fa('0xb')];this[_0xf0fa('0xc')]=_0x5d9b58['countbusyretry']+_0x5d9b58[_0xf0fa('0xa')]+_0x5d9b58['countnoanswerretry']+_0x5d9b58[_0xf0fa('0xd')]+_0x5d9b58['countdropretry']+_0x5d9b58[_0xf0fa('0xe')]+_0x5d9b58[_0xf0fa('0xf')]+_0x5d9b58[_0xf0fa('0x10')];this['countnosuchnumberretry']=_0x5d9b58['countnosuchnumberretry'];this[_0xf0fa('0x11')]=_0x5d9b58['countdropretry'];this[_0xf0fa('0xe')]=_0x5d9b58[_0xf0fa('0xe')];this[_0xf0fa('0xf')]=_0x5d9b58[_0xf0fa('0xf')];this[_0xf0fa('0x10')]=_0x5d9b58[_0xf0fa('0x10')];this[_0xf0fa('0x12')]=_0x5d9b58[_0xf0fa('0x12')];this['calleridname']=_0x5d9b58[_0xf0fa('0x13')];this[_0xf0fa('0x14')]=_0x5d9b58[_0xf0fa('0x14')];this[_0xf0fa('0x15')]=_0x5d9b58[_0xf0fa('0x15')];this[_0xf0fa('0x16')]=_0x5d9b58['responsetime'];this['endtime']=_0x5d9b58[_0xf0fa('0x16')];this[_0xf0fa('0x17')]=_0x5d9b58[_0xf0fa('0x17')]||0x0;this[_0xf0fa('0x18')]=_0x5d9b58[_0xf0fa('0x18')]||0x0;this[_0xf0fa('0x19')]=_0x5d9b58[_0xf0fa('0x19')]||0x0;this[_0xf0fa('0x1a')]=_0x5d9b58[_0xf0fa('0x1a')];this[_0xf0fa('0x1b')]=_0x5d9b58[_0xf0fa('0x1b')];this['callbackat']=_0x5d9b58[_0xf0fa('0x1c')];this[_0xf0fa('0x1d')]=_0x5d9b58[_0xf0fa('0x1d')];this[_0xf0fa('0x1e')]=_0x5d9b58[_0xf0fa('0x1e')];this[_0xf0fa('0x1f')]=_0x5d9b58[_0xf0fa('0x1f')];this[_0xf0fa('0x20')]=_0x5d9b58[_0xf0fa('0x20')];this['VoiceQueueId']=_0x5d9b58[_0xf0fa('0x21')];this[_0xf0fa('0x22')]=_0x5d9b58['CampaignId'];this[_0xf0fa('0x23')]=_0x5d9b58[_0xf0fa('0x23')]||'';this[_0xf0fa('0x24')]=_0x5d9b58['originatecalleridname']||'';}module[_0xf0fa('0x25')]=Final; \ No newline at end of file +var _0xfd20=['lodash','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname'];(function(_0x30e069,_0xb94d4){var _0x138c47=function(_0x186d60){while(--_0x186d60){_0x30e069['push'](_0x30e069['shift']());}};_0x138c47(++_0xb94d4);}(_0xfd20,0x66));var _0x0fd2=function(_0x25b50a,_0x364868){_0x25b50a=_0x25b50a-0x0;var _0xf6a93=_0xfd20[_0x25b50a];return _0xf6a93;};'use strict';var util=require('util');var _=require(_0x0fd2('0x0'));var moment=require('moment');function getSeconds(_0x54f464,_0x429df4){var _0x28eb77=moment(_0x54f464)['milliseconds'](0x0);var _0x27bee6=moment(_0x429df4)['milliseconds'](0x0);return _0x28eb77[_0x0fd2('0x1')](_0x27bee6,_0x0fd2('0x2'));}function Final(_0x2ef0c3){this[_0x0fd2('0x3')]=_0x2ef0c3[_0x0fd2('0x3')];this['scheduledat']=_0x2ef0c3['scheduledat'];this[_0x0fd2('0x4')]=_0x2ef0c3[_0x0fd2('0x4')];this[_0x0fd2('0x5')]=_0x2ef0c3[_0x0fd2('0x4')]===_0x0fd2('0x6')?_0x0fd2('0x7'):_0x2ef0c3[_0x0fd2('0x4')];this['countbusyretry']=_0x2ef0c3[_0x0fd2('0x8')];this[_0x0fd2('0x9')]=_0x2ef0c3['countcongestionretry'];this[_0x0fd2('0xa')]=_0x2ef0c3['countnoanswerretry'];this[_0x0fd2('0xb')]=_0x2ef0c3[_0x0fd2('0x8')]+_0x2ef0c3[_0x0fd2('0x9')]+_0x2ef0c3[_0x0fd2('0xa')]+_0x2ef0c3[_0x0fd2('0xc')]+_0x2ef0c3[_0x0fd2('0xd')]+_0x2ef0c3[_0x0fd2('0xe')]+_0x2ef0c3[_0x0fd2('0xf')]+_0x2ef0c3['countagentrejectretry'];this['countnosuchnumberretry']=_0x2ef0c3[_0x0fd2('0xc')];this[_0x0fd2('0xd')]=_0x2ef0c3[_0x0fd2('0xd')];this[_0x0fd2('0xe')]=_0x2ef0c3['countabandonedretry'];this[_0x0fd2('0xf')]=_0x2ef0c3['countmachineretry'];this['countagentrejectretry']=_0x2ef0c3[_0x0fd2('0x10')];this['queue']=_0x2ef0c3[_0x0fd2('0x7')];this['calleridname']=_0x2ef0c3[_0x0fd2('0x11')];this['calleridnum']=_0x2ef0c3[_0x0fd2('0x12')];this[_0x0fd2('0x13')]=_0x2ef0c3['starttime'];this[_0x0fd2('0x14')]=_0x2ef0c3['responsetime'];this[_0x0fd2('0x15')]=_0x2ef0c3[_0x0fd2('0x14')];this[_0x0fd2('0x16')]=_0x2ef0c3[_0x0fd2('0x16')]||0x0;this[_0x0fd2('0x17')]=_0x2ef0c3[_0x0fd2('0x17')]||0x0;this[_0x0fd2('0x18')]=_0x2ef0c3[_0x0fd2('0x18')]||0x0;this[_0x0fd2('0x19')]=_0x2ef0c3[_0x0fd2('0x19')];this['callbackuniqueid']=_0x2ef0c3['callbackuniqueid'];this['callbackat']=_0x2ef0c3[_0x0fd2('0x1a')];this[_0x0fd2('0x1b')]=_0x2ef0c3['recallme'];this['ContactId']=_0x2ef0c3[_0x0fd2('0x1c')];this[_0x0fd2('0x1d')]=_0x2ef0c3[_0x0fd2('0x1d')];this[_0x0fd2('0x1e')]=_0x2ef0c3[_0x0fd2('0x1e')];this['VoiceQueueId']=_0x2ef0c3[_0x0fd2('0x1f')];this[_0x0fd2('0x20')]=_0x2ef0c3[_0x0fd2('0x20')];this['originatecalleridnum']=_0x2ef0c3['originatecalleridnum']||'';this[_0x0fd2('0x21')]=_0x2ef0c3[_0x0fd2('0x21')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b5db53d..223f69f 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 _0xad16=['seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad16,0x174));var _0x6ad1=function(_0x5ab658,_0xcea814){_0x5ab658=_0x5ab658-0x0;var _0x11e196=_0xad16[_0x5ab658];return _0x11e196;};'use strict';var util=require(_0x6ad1('0x0'));var _=require(_0x6ad1('0x1'));var moment=require(_0x6ad1('0x2'));function getSeconds(_0x23f278,_0x51f745){var _0x3468b9=moment(_0x23f278)[_0x6ad1('0x3')](0x0);var _0x29ebaf=moment(_0x51f745)[_0x6ad1('0x3')](0x0);return _0x3468b9['diff'](_0x29ebaf,_0x6ad1('0x4'));}function Hangup(_0x47cd84,_0x818d71){this[_0x6ad1('0x5')]=0x4;this[_0x6ad1('0x6')]=_0x6ad1('0x7');this[_0x6ad1('0x8')]=_0x47cd84['scheduledat'];this['type']=_0x47cd84[_0x6ad1('0x9')];this[_0x6ad1('0xa')]=_0x47cd84[_0x6ad1('0x9')]===_0x6ad1('0xb')?_0x6ad1('0xc'):_0x47cd84[_0x6ad1('0x9')];this['countbusyretry']=_0x47cd84['countbusyretry'];this['countcongestionretry']=_0x47cd84[_0x6ad1('0xd')];this[_0x6ad1('0xe')]=_0x47cd84[_0x6ad1('0xe')];this[_0x6ad1('0xf')]=_0x47cd84[_0x6ad1('0x10')]+_0x47cd84[_0x6ad1('0xd')]+_0x47cd84['countnoanswerretry']+_0x47cd84[_0x6ad1('0x11')]+_0x47cd84[_0x6ad1('0x12')]+_0x47cd84[_0x6ad1('0x13')]+_0x47cd84[_0x6ad1('0x14')]+_0x47cd84[_0x6ad1('0x15')];this[_0x6ad1('0x11')]=_0x47cd84[_0x6ad1('0x11')];this['countdropretry']=_0x47cd84['countdropretry'];this[_0x6ad1('0x13')]=_0x47cd84[_0x6ad1('0x13')];this[_0x6ad1('0x14')]=_0x47cd84[_0x6ad1('0x14')];this[_0x6ad1('0x15')]=_0x47cd84[_0x6ad1('0x15')];this['uniqueid']=_0x818d71[_0x6ad1('0x16')];this['calleridname']=_0x47cd84[_0x6ad1('0x17')];this[_0x6ad1('0x18')]=_0x47cd84[_0x6ad1('0x19')];this[_0x6ad1('0x1a')]=_0x47cd84[_0x6ad1('0x1a')];this[_0x6ad1('0x1b')]=_0x47cd84[_0x6ad1('0x1b')];this['endtime']=moment()[_0x6ad1('0x1c')](_0x6ad1('0x1d'));this[_0x6ad1('0x1e')]=getSeconds(_0x47cd84[_0x6ad1('0x1b')],_0x47cd84[_0x6ad1('0x1a')]);this[_0x6ad1('0x1f')]=0x0;this[_0x6ad1('0x20')]=getSeconds(this[_0x6ad1('0x21')],_0x47cd84['responsetime']);this[_0x6ad1('0xc')]=_0x47cd84[_0x6ad1('0xc')];this[_0x6ad1('0x22')]=_0x6ad1('0x23');this['reason']=_0x818d71[_0x6ad1('0x24')];this[_0x6ad1('0x25')]=_0x47cd84[_0x6ad1('0x25')];this[_0x6ad1('0x26')]=_0x47cd84[_0x6ad1('0x26')];this['callbackat']=_0x47cd84[_0x6ad1('0x27')];this[_0x6ad1('0x28')]=_0x47cd84['recallme'];this[_0x6ad1('0x29')]=_0x47cd84[_0x6ad1('0x29')];this[_0x6ad1('0x2a')]=_0x47cd84[_0x6ad1('0x2a')];this[_0x6ad1('0x2b')]=_0x47cd84['UserId'];this[_0x6ad1('0x2c')]=_0x47cd84[_0x6ad1('0x2c')];this[_0x6ad1('0x2d')]=_0x47cd84[_0x6ad1('0x2d')];}module[_0x6ad1('0x2e')]=Hangup; \ No newline at end of file +var _0xfcc3=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x517a86,_0x1b0466){var _0x5abb1c=function(_0x459bd9){while(--_0x459bd9){_0x517a86['push'](_0x517a86['shift']());}};_0x5abb1c(++_0x1b0466);}(_0xfcc3,0x152));var _0x3fcc=function(_0x365fd0,_0x4859a3){_0x365fd0=_0x365fd0-0x0;var _0x69f41e=_0xfcc3[_0x365fd0];return _0x69f41e;};'use strict';var util=require(_0x3fcc('0x0'));var _=require('lodash');var moment=require(_0x3fcc('0x1'));function getSeconds(_0x1b907b,_0x4c45be){var _0x10013d=moment(_0x1b907b)[_0x3fcc('0x2')](0x0);var _0x2d2ce5=moment(_0x4c45be)[_0x3fcc('0x2')](0x0);return _0x10013d[_0x3fcc('0x3')](_0x2d2ce5,_0x3fcc('0x4'));}function Hangup(_0x3162fd,_0x142409){this['state']=0x4;this[_0x3fcc('0x5')]=_0x3fcc('0x6');this[_0x3fcc('0x7')]=_0x3162fd[_0x3fcc('0x7')];this[_0x3fcc('0x8')]=_0x3162fd['type'];this[_0x3fcc('0x9')]=_0x3162fd[_0x3fcc('0x8')]===_0x3fcc('0xa')?_0x3fcc('0xb'):_0x3162fd[_0x3fcc('0x8')];this[_0x3fcc('0xc')]=_0x3162fd[_0x3fcc('0xc')];this[_0x3fcc('0xd')]=_0x3162fd['countcongestionretry'];this[_0x3fcc('0xe')]=_0x3162fd[_0x3fcc('0xe')];this[_0x3fcc('0xf')]=_0x3162fd['countbusyretry']+_0x3162fd[_0x3fcc('0xd')]+_0x3162fd[_0x3fcc('0xe')]+_0x3162fd[_0x3fcc('0x10')]+_0x3162fd[_0x3fcc('0x11')]+_0x3162fd['countabandonedretry']+_0x3162fd['countmachineretry']+_0x3162fd[_0x3fcc('0x12')];this[_0x3fcc('0x10')]=_0x3162fd[_0x3fcc('0x10')];this['countdropretry']=_0x3162fd[_0x3fcc('0x11')];this[_0x3fcc('0x13')]=_0x3162fd['countabandonedretry'];this[_0x3fcc('0x14')]=_0x3162fd[_0x3fcc('0x14')];this[_0x3fcc('0x12')]=_0x3162fd[_0x3fcc('0x12')];this[_0x3fcc('0x15')]=_0x142409['uniqueid'];this[_0x3fcc('0x16')]=_0x3162fd['name'];this[_0x3fcc('0x17')]=_0x3162fd[_0x3fcc('0x18')];this[_0x3fcc('0x19')]=_0x3162fd[_0x3fcc('0x19')];this[_0x3fcc('0x1a')]=_0x3162fd['responsetime'];this[_0x3fcc('0x1b')]=moment()[_0x3fcc('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fcc('0x1d')]=getSeconds(_0x3162fd[_0x3fcc('0x1a')],_0x3162fd[_0x3fcc('0x19')]);this[_0x3fcc('0x1e')]=0x0;this[_0x3fcc('0x1f')]=getSeconds(this[_0x3fcc('0x1b')],_0x3162fd[_0x3fcc('0x1a')]);this[_0x3fcc('0xb')]=_0x3162fd[_0x3fcc('0xb')];this['membername']=_0x3fcc('0x20');this[_0x3fcc('0x21')]=_0x142409[_0x3fcc('0x22')];this[_0x3fcc('0x23')]=_0x3162fd[_0x3fcc('0x23')];this['callbackuniqueid']=_0x3162fd[_0x3fcc('0x24')];this['callbackat']=_0x3162fd[_0x3fcc('0x25')];this[_0x3fcc('0x26')]=_0x3162fd[_0x3fcc('0x26')];this[_0x3fcc('0x27')]=_0x3162fd[_0x3fcc('0x27')];this[_0x3fcc('0x28')]=_0x3162fd[_0x3fcc('0x28')];this[_0x3fcc('0x29')]=_0x3162fd[_0x3fcc('0x29')];this[_0x3fcc('0x2a')]=_0x3162fd[_0x3fcc('0x2a')];this['CampaignId']=_0x3162fd['CampaignId'];}module[_0x3fcc('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e925bf1..f09157d 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 _0xca6c=['countmachineretry','countabandonedretry','countagentrejectretry','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x3f7861,_0x13619b){var _0x36fdae=function(_0x6aa7b8){while(--_0x6aa7b8){_0x3f7861['push'](_0x3f7861['shift']());}};_0x36fdae(++_0x13619b);}(_0xca6c,0xa1));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcca6('0x0'));var _=require(_0xcca6('0x1'));var moment=require(_0xcca6('0x2'));function getSeconds(_0x45b4f3,_0x25286d){var _0x296b9b=moment(_0x45b4f3)[_0xcca6('0x3')](0x0);var _0x22efe4=moment(_0x25286d)['milliseconds'](0x0);return _0x296b9b['diff'](_0x22efe4,_0xcca6('0x4'));}function History(_0x5dbcff){this['uniqueid']=_0x5dbcff[_0xcca6('0x5')];this[_0xcca6('0x6')]=_0x5dbcff['scheduledat']||undefined;this['type']=_0x5dbcff[_0xcca6('0x7')];this[_0xcca6('0x8')]=_0x5dbcff[_0xcca6('0x7')]==='outbound'?_0xcca6('0x9'):_0x5dbcff[_0xcca6('0x7')];this[_0xcca6('0xa')]=_0x5dbcff['countbusyretry'];this['countcongestionretry']=_0x5dbcff[_0xcca6('0xb')];this[_0xcca6('0xc')]=_0x5dbcff[_0xcca6('0xc')];this['countglobal']=_0x5dbcff[_0xcca6('0xa')]+_0x5dbcff['countcongestionretry']+_0x5dbcff['countnoanswerretry']+_0x5dbcff[_0xcca6('0xd')]+_0x5dbcff['countdropretry']+_0x5dbcff['countabandonedretry']+_0x5dbcff[_0xcca6('0xe')]+_0x5dbcff['countagentrejectretry'];this[_0xcca6('0xd')]=_0x5dbcff[_0xcca6('0xd')];this['countdropretry']=_0x5dbcff['countdropretry'];this[_0xcca6('0xf')]=_0x5dbcff[_0xcca6('0xf')];this['countmachineretry']=_0x5dbcff['countmachineretry'];this['countagentrejectretry']=_0x5dbcff[_0xcca6('0x10')];this[_0xcca6('0x9')]=_0x5dbcff['queue'];this['calleridname']=_0x5dbcff['name'];this[_0xcca6('0x11')]=_0x5dbcff[_0xcca6('0x12')];this['starttime']=_0x5dbcff[_0xcca6('0x13')];this[_0xcca6('0x14')]=_0x5dbcff[_0xcca6('0x14')];this['endtime']=_0x5dbcff[_0xcca6('0x14')];this[_0xcca6('0x15')]=getSeconds(_0x5dbcff['responsetime'],_0x5dbcff[_0xcca6('0x13')]);this[_0xcca6('0x16')]=0x0;this[_0xcca6('0x17')]=0x0;this[_0xcca6('0x18')]=_0x5dbcff[_0xcca6('0x18')];this[_0xcca6('0x19')]=_0x5dbcff['callbackuniqueid'];this['callbackat']=_0x5dbcff[_0xcca6('0x1a')];this[_0xcca6('0x1b')]=_0x5dbcff[_0xcca6('0x1b')];this[_0xcca6('0x1c')]=_0x5dbcff[_0xcca6('0x1c')];this[_0xcca6('0x1d')]=_0x5dbcff['ListId'];this[_0xcca6('0x1e')]=_0x5dbcff[_0xcca6('0x1e')];this['VoiceQueueId']=_0x5dbcff['VoiceQueueId'];this[_0xcca6('0x1f')]=_0x5dbcff[_0xcca6('0x1f')];this['originatecalleridnum']=_0x5dbcff[_0xcca6('0x20')]||'';this[_0xcca6('0x21')]=_0x5dbcff[_0xcca6('0x21')]||'';}module[_0xcca6('0x22')]=History; \ No newline at end of file +var _0x8c04=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid'];(function(_0x2ef1d1,_0x37f6c4){var _0x4aa104=function(_0x341c75){while(--_0x341c75){_0x2ef1d1['push'](_0x2ef1d1['shift']());}};_0x4aa104(++_0x37f6c4);}(_0x8c04,0x155));var _0x48c0=function(_0x618ad6,_0x4992d2){_0x618ad6=_0x618ad6-0x0;var _0x277505=_0x8c04[_0x618ad6];return _0x277505;};'use strict';var util=require(_0x48c0('0x0'));var _=require(_0x48c0('0x1'));var moment=require(_0x48c0('0x2'));function getSeconds(_0x1d6d08,_0x3faf1b){var _0x4df881=moment(_0x1d6d08)[_0x48c0('0x3')](0x0);var _0x172479=moment(_0x3faf1b)[_0x48c0('0x3')](0x0);return _0x4df881[_0x48c0('0x4')](_0x172479,_0x48c0('0x5'));}function History(_0x39125f){this[_0x48c0('0x6')]=_0x39125f['uniqueid'];this['scheduledat']=_0x39125f[_0x48c0('0x7')]||undefined;this[_0x48c0('0x8')]=_0x39125f[_0x48c0('0x8')];this[_0x48c0('0x9')]=_0x39125f['type']==='outbound'?_0x48c0('0xa'):_0x39125f['type'];this[_0x48c0('0xb')]=_0x39125f['countbusyretry'];this['countcongestionretry']=_0x39125f[_0x48c0('0xc')];this[_0x48c0('0xd')]=_0x39125f[_0x48c0('0xd')];this[_0x48c0('0xe')]=_0x39125f[_0x48c0('0xb')]+_0x39125f[_0x48c0('0xc')]+_0x39125f[_0x48c0('0xd')]+_0x39125f['countnosuchnumberretry']+_0x39125f[_0x48c0('0xf')]+_0x39125f['countabandonedretry']+_0x39125f[_0x48c0('0x10')]+_0x39125f[_0x48c0('0x11')];this['countnosuchnumberretry']=_0x39125f[_0x48c0('0x12')];this['countdropretry']=_0x39125f[_0x48c0('0xf')];this[_0x48c0('0x13')]=_0x39125f[_0x48c0('0x13')];this['countmachineretry']=_0x39125f[_0x48c0('0x10')];this[_0x48c0('0x11')]=_0x39125f[_0x48c0('0x11')];this['queue']=_0x39125f[_0x48c0('0xa')];this['calleridname']=_0x39125f[_0x48c0('0x14')];this[_0x48c0('0x15')]=_0x39125f[_0x48c0('0x16')];this[_0x48c0('0x17')]=_0x39125f['starttime'];this['responsetime']=_0x39125f[_0x48c0('0x18')];this[_0x48c0('0x19')]=_0x39125f[_0x48c0('0x18')];this['ringtime']=getSeconds(_0x39125f[_0x48c0('0x18')],_0x39125f['starttime']);this['holdtime']=0x0;this[_0x48c0('0x1a')]=0x0;this[_0x48c0('0x1b')]=_0x39125f[_0x48c0('0x1b')];this['callbackuniqueid']=_0x39125f[_0x48c0('0x1c')];this['callbackat']=_0x39125f[_0x48c0('0x1d')];this[_0x48c0('0x1e')]=_0x39125f['recallme'];this['ContactId']=_0x39125f[_0x48c0('0x1f')];this[_0x48c0('0x20')]=_0x39125f[_0x48c0('0x20')];this[_0x48c0('0x21')]=_0x39125f[_0x48c0('0x21')];this['VoiceQueueId']=_0x39125f[_0x48c0('0x22')];this[_0x48c0('0x23')]=_0x39125f['CampaignId'];this['originatecalleridnum']=_0x39125f['originatecalleridnum']||'';this[_0x48c0('0x24')]=_0x39125f['originatecalleridname']||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 41914f6..288286a 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 _0xc1c1=['tags','createdAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','object','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','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','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','emptyContact','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\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','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','127.0.0.1','rrmemory','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','emit','type','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\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','---------------------------','isUndefined','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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','Machine','countdropretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','locked','agents','stateinterface','push','idHopper','paused','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','content','true','iftime\x20%s,%s','indexOf','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','syncCampaigns','pow','replace','random','match','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1c1,0x9c));var _0x1c1c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1c1[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x1c1c('0x0'));var _=require(_0x1c1c('0x1'));var BPromise=require(_0x1c1c('0x2'));var uuid=require(_0x1c1c('0x3'));var moment=require(_0x1c1c('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x1c1c('0x5'));var ut=require(_0x1c1c('0x6'));var config=require(_0x1c1c('0x7'));var logger=require(_0x1c1c('0x8'))(_0x1c1c('0x9'));var loggerBooked=require(_0x1c1c('0x8'))(_0x1c1c('0xa'));var loggerPredictive=require('../../../config/logger')(_0x1c1c('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x1c1c('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x1c1c('0xd'));var ami=require(_0x1c1c('0xe'));config[_0x1c1c('0xf')]=_[_0x1c1c('0x10')](config['redis'],{'host':_0x1c1c('0x11'),'port':0x18eb});var io=require(_0x1c1c('0x12'))(new Redis(config[_0x1c1c('0xf')]));var cmHopper=require(_0x1c1c('0x13'));var cmHopperHistory=require(_0x1c1c('0x14'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1c1c('0x15'));var RpcSetting=require('../rpc/setting');var Action=require(_0x1c1c('0x16'));var History=require(_0x1c1c('0x17'));var Final=require(_0x1c1c('0x18'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x1c1c('0x19'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x1c1c('0x1a');var strategy={'rrmemory':_0x1c1c('0x1b'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1c1c('0x1c')][_0x1c1c('0x1d')]=function(_0x34e2ce){this['tail']=this[_0x1c1c('0x1e')]?this['tail']['finally'](_0x34e2ce):_0x34e2ce();};function Dialer(_0x14abc0,_0x39db67){this[_0x1c1c('0x1f')]=new Sequence();this[_0x1c1c('0x20')]=_0x39db67;this[_0x1c1c('0x21')]=_0x14abc0[_0x1c1c('0x21')];this[_0x1c1c('0x22')]=_0x14abc0[_0x1c1c('0x22')];this['agents']=_0x14abc0['agents'];this[_0x1c1c('0x23')]=_0x14abc0[_0x1c1c('0x23')];this[_0x1c1c('0x24')]=config[_0x1c1c('0x24')]||0x2;this['channels']={};this[_0x1c1c('0x25')]={};this[_0x1c1c('0x26')]={};this[_0x1c1c('0x27')]={};this[_0x1c1c('0x28')]={};this[_0x1c1c('0x29')]={};this['startProgressive']={};this[_0x1c1c('0x2a')]={};this[_0x1c1c('0x2b')]={};this[_0x1c1c('0x2c')]={};ami['on']('agentconnect',this[_0x1c1c('0x2d')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x2f'),this['syncQueueCallerAbandon'][_0x1c1c('0x2e')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x30'),this[_0x1c1c('0x31')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x32'),this[_0x1c1c('0xd')]['bind'](this));ami['on'](_0x1c1c('0x33'),this[_0x1c1c('0x34')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x35'),this['syncNewExten'][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x36'),this[_0x1c1c('0x37')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x38'),this[_0x1c1c('0x39')][_0x1c1c('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x1c1c('0x3a')][_0x1c1c('0x2e')](this));this[_0x1c1c('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x1c1c('0x3c')]()[_0x1c1c('0x3d')](function(_0x4bef1e){previewRecallmeReminderInterval=_0x4bef1e[_0x1c1c('0x3e')];});}function isNotNull(_0x12e372){return _0x12e372!==null&&!_['isUndefined'](_0x12e372);}function checkIsLoggedIn(_0x36ea24,_0x1c3bb1){return function(){if(_0x1c3bb1<=0x0){_0x36ea24[_0x1c1c('0x3f')]='AGENTS_NOT_LOGGED';throw _0x36ea24[_0x1c1c('0x40')]+_0x1c1c('0x41');}};}function isActive(_0x24f510){return _0x24f510;}function checkIsActive(_0x11a19e,_0x41d06a){return function(){if(!isActive(_0x41d06a)){_0x11a19e[_0x1c1c('0x3f')]=_0x1c1c('0x42');throw _0x11a19e[_0x1c1c('0x40')]+_0x1c1c('0x43');}};}function checkInterval(_0x27baef){return function(){if(!isNotNull(_0x27baef[_0x1c1c('0x44')])){_0x27baef[_0x1c1c('0x3f')]=_0x1c1c('0x45');throw _0x27baef['name']+_0x1c1c('0x46');}if(!isNotNull(_0x27baef[_0x1c1c('0x44')][_0x1c1c('0x47')])){_0x27baef[_0x1c1c('0x3f')]=_0x1c1c('0x45');throw _0x27baef['name']+_0x1c1c('0x46');}if(!isNotNull(_['isEmpty'](_0x27baef[_0x1c1c('0x44')][_0x1c1c('0x47')]))){_0x27baef[_0x1c1c('0x3f')]='INTERVAL_IS_NULL';throw _0x27baef[_0x1c1c('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x53dc2d,_0x115675,_0x2c4e45){return{'action':_0x53dc2d,'response':_0x115675,'message':_0x2c4e45,'stack':_0x2c4e45};}function myreject(_0x235661){return function(_0x1e5616){return _0x235661(msgResponse('[ifTime][Action]',_0x1c1c('0x48'),JSON[_0x1c1c('0x49')](_0x1e5616)));};}function getSeconds(_0x197132,_0x1fcea4){var _0x37ac77=moment(_0x197132)[_0x1c1c('0x4a')](0x0);var _0xcc76ca=moment(_0x1fcea4)[_0x1c1c('0x4a')](0x0);return _0x37ac77[_0x1c1c('0x4b')](_0xcc76ca,_0x1c1c('0x4c'));}function emit(_0x1e3658,_0x2f85b2,_0x983e53){io['to'](_0x1e3658)[_0x1c1c('0x4d')](_0x2f85b2,_0x983e53);}function emitVoiceQueueSummary(_0x5546bc){if(_0x5546bc[_0x1c1c('0x4e')]==='outbound'){var _0x2c9bae={'id':_0x5546bc['id'],'name':_0x5546bc[_0x1c1c('0x40')],'strategy':_0x5546bc['strategy'],'answered':_0x5546bc['answered'],'available':_0x5546bc[_0x1c1c('0x4f')],'loggedIn':_0x5546bc[_0x1c1c('0x50')],'pTalking':_0x5546bc[_0x1c1c('0x51')],'sumBillable':_0x5546bc[_0x1c1c('0x52')],'sumDuration':_0x5546bc[_0x1c1c('0x53')],'sumHoldTime':_0x5546bc[_0x1c1c('0x54')]||0x0,'talking':_0x5546bc[_0x1c1c('0x55')],'total':_0x5546bc[_0x1c1c('0x56')],'type':_0x5546bc[_0x1c1c('0x4e')],'unmanaged':_0x5546bc['unmanaged'],'abandoned':_0x5546bc[_0x1c1c('0x57')],'waiting':_0x5546bc[_0x1c1c('0x58')],'loggedInDb':_0x5546bc[_0x1c1c('0x59')],'dialActive':_0x5546bc['dialActive'],'dialMethod':_0x5546bc[_0x1c1c('0x5a')],'dialOriginateCallerIdName':_0x5546bc[_0x1c1c('0x5b')],'dialOriginateCallerIdNumber':_0x5546bc[_0x1c1c('0x5c')],'dialOriginateTimeout':_0x5546bc[_0x1c1c('0x5d')],'dialPrefix':_0x5546bc[_0x1c1c('0x5e')],'outboundAnswerAgiCallsDay':_0x5546bc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5546bc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5546bc[_0x1c1c('0x5f')],'outboundBusyCallsDay':_0x5546bc[_0x1c1c('0x60')],'outboundCongestionCallsDay':_0x5546bc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5546bc[_0x1c1c('0x61')],'outboundDropCallsDayCallersExit':_0x5546bc[_0x1c1c('0x62')],'outboundDropCallsDayTimeout':_0x5546bc[_0x1c1c('0x63')],'outboundNoAnswerCallsDay':_0x5546bc[_0x1c1c('0x64')],'outboundNoSuchCallsDay':_0x5546bc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5546bc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5546bc['outboundReCallsDay'],'outboundRejectCallsDay':_0x5546bc[_0x1c1c('0x65')],'outboundUnknownCallsDay':_0x5546bc[_0x1c1c('0x66')],'predictiveIntervalAnsweredCalls':_0x5546bc[_0x1c1c('0x67')],'predictiveIntervalAvgHoldtime':_0x5546bc[_0x1c1c('0x68')],'predictiveIntervalAvgTalktime':_0x5546bc[_0x1c1c('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x5546bc[_0x1c1c('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x5546bc[_0x1c1c('0x6b')],'predictiveIntervalErlangCalls':_0x5546bc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5546bc[_0x1c1c('0x6c')],'predictiveIntervalHitRate':_0x5546bc[_0x1c1c('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5546bc[_0x1c1c('0x6e')],'predictiveIntervalPauses':_0x5546bc['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5546bc[_0x1c1c('0x6f')],'predictiveIntervalTotalCalls':_0x5546bc[_0x1c1c('0x70')],'message':_0x5546bc[_0x1c1c('0x3f')],'originated':_0x5546bc[_0x1c1c('0x71')],'erlangCalls':_0x5546bc[_0x1c1c('0x72')],'erlangCallToSecond':_0x5546bc[_0x1c1c('0x73')],'erlangAbandonmentRate':_0x5546bc[_0x1c1c('0x74')],'erlangBusyFactor':_0x5546bc['erlangBusyFactor'],'startPredictive':_0x5546bc[_0x1c1c('0x29')],'startProgressive':_0x5546bc['startProgressive']};if(_0x5546bc[_0x1c1c('0x75')]){_0x2c9bae['Trunk']={'id':_0x5546bc[_0x1c1c('0x75')]['id'],'name':_0x5546bc[_0x1c1c('0x75')]['name'],'active':_0x5546bc[_0x1c1c('0x75')][_0x1c1c('0x76')],'callerid':_0x5546bc['Trunk']['callerid']};}if(_0x5546bc[_0x1c1c('0x44')]){_0x2c9bae[_0x1c1c('0x44')]={'id':_0x5546bc[_0x1c1c('0x44')]['id'],'name':_0x5546bc['Interval']['name']};}var _0x4654ab=md5(JSON[_0x1c1c('0x49')](_0x2c9bae));if(_0x5546bc[_0x1c1c('0x77')]!==_0x4654ab){_0x5546bc[_0x1c1c('0x77')]=_0x4654ab;emit(util[_0x1c1c('0x78')](_0x1c1c('0x79'),_0x2c9bae[_0x1c1c('0x40')]),_0x1c1c('0x7a'),_0x2c9bae);}}}function emitCampaignSummary(_0x1e17be){if(_0x1e17be[_0x1c1c('0x4e')]===_0x1c1c('0x7b')){emit(util['format'](_0x1c1c('0x7c'),_0x1e17be[_0x1c1c('0x40')]),_0x1c1c('0x7d'),_0x1e17be);}}function checkGetDataPredictive(_0xc5a583){if(isNotNull(_0xc5a583)&&!_['isEmpty'](_0xc5a583)){loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x7f'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x80'),_0xc5a583[_0x1c1c('0x70')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x81'),_0xc5a583[_0x1c1c('0x67')]);loggerPredictive[_0x1c1c('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc5a583['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x82'),_0xc5a583[_0x1c1c('0x6a')]);loggerPredictive['info'](_0x1c1c('0x83'),_0xc5a583[_0x1c1c('0x68')]);loggerPredictive[_0x1c1c('0x7e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc5a583[_0x1c1c('0x69')]);loggerPredictive['info'](_0x1c1c('0x84'));if(_0xc5a583[_0x1c1c('0x70')]>0x0){if(!_[_0x1c1c('0x85')](_0xc5a583[_0x1c1c('0x69')])&&_0xc5a583[_0x1c1c('0x69')]>0x0){return!![];}loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x86'));if(!_[_0x1c1c('0x85')](_0xc5a583['predictiveIntervalAvgHoldtime'])&&_0xc5a583[_0x1c1c('0x68')]>0x0){return!![];}loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x87'));}else{loggerPredictive['info'](_0x1c1c('0x88'));}}else{loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x89'));}return![];}function mergeDataErlangB(_0x1eb583){return function(_0x3eb907){loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8a'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8b'),_0x3eb907[_0x1c1c('0x72')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8c'),_0x3eb907['erlangCallToSecond']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8d'),_0x3eb907[_0x1c1c('0x74')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8e'),_0x3eb907['erlangBusyFactor']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8d'),_0x3eb907['erlangAbandonmentRate']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x84'));_[_0x1c1c('0x8f')](_0x1eb583,_0x3eb907);};}function getDiff(_0x3a7a21){var _0x2cf974=moment()['milliseconds'](0x0);var _0x191e26=moment(_0x3a7a21)['milliseconds'](0x0);return _0x2cf974[_0x1c1c('0x4b')](_0x191e26,_0x1c1c('0x4c'));}function ifInterval(_0x2edde5,_0x29be10){if(_[_0x1c1c('0x85')](_0x29be10)){return![];}return getDiff(_0x29be10)<_0x2edde5*0x3c;}function freeVariablesPredictive(_0x13d732){if(isNotNull(_0x13d732)){if(!_[_0x1c1c('0x85')](_0x13d732[_0x1c1c('0x90')])){_0x13d732[_0x1c1c('0x90')]=undefined;loggerPredictive['info'](_0x13d732['name'],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x13d732[_0x1c1c('0x29')])){_0x13d732[_0x1c1c('0x29')]=undefined;loggerPredictive[_0x1c1c('0x7e')](_0x13d732[_0x1c1c('0x40')],_0x1c1c('0x91'));}if(!_[_0x1c1c('0x85')](_0x13d732[_0x1c1c('0x92')])){clearInterval(_0x13d732[_0x1c1c('0x92')]);_0x13d732[_0x1c1c('0x92')]=undefined;loggerPredictive['info'](_0x13d732[_0x1c1c('0x40')],_0x1c1c('0x93'));}}}function erlangb(_0x3f3f5d,_0x2b47ad){if(_0x2b47ad===0x0){return 0x0;}var _0x994735=0x1;for(var _0x2bc1aa=0x1;_0x2bc1aa<=_0x2b47ad;_0x2bc1aa+=0x1){_0x994735=0x1+_0x994735*_0x2bc1aa/_0x3f3f5d;}return 0x1/_0x994735;}function isVoiceQueueOutbound(_0x368b5d){return _0x368b5d==='outbound';}function isNotPreview(_0x181453){return _0x181453!==_0x1c1c('0x20');}function isCampaignIvr(_0x341942){return _0x341942===_0x1c1c('0x7b');}function getCallerId(_0x48b7e0,_0x5b3176,_0x196eca){if(!_[_0x1c1c('0x85')](_0x196eca)&&typeof _0x196eca===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x196eca)){if(!_[_0x1c1c('0x85')](_0x5b3176)&&typeof _0x5b3176===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x5b3176)){return util[_0x1c1c('0x78')]('\x22%s\x22\x20<%s>',_0x5b3176,_0x196eca);}return util[_0x1c1c('0x78')](_0x1c1c('0x96'),_0x196eca,_0x196eca);}if(!_[_0x1c1c('0x85')](_0x48b7e0)&&typeof _0x48b7e0===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x48b7e0)){return _0x48b7e0;}return _0x1c1c('0x97');}function loggerCatchQueueSummary(_0x334b79,_0x1d30dc){return function(_0x18ee9c){freeVariablesPredictive(_0x1d30dc);emitVoiceQueueSummary(_0x1d30dc);emitCampaignSummary(_0x1d30dc);loggerSyncQueueSummary[_0x1c1c('0x98')](_0x334b79,util[_0x1c1c('0x99')](_0x18ee9c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x345368,_0x23e9f9){return function(_0xfc7893){loggerPredictive[_0x1c1c('0x98')](_0x23e9f9[_0x1c1c('0x40')],_0x345368);loggerPredictive[_0x1c1c('0x98')](_0xfc7893['stack']);freeVariablesPredictive(_0x23e9f9);};}function loggerCatch(_0x339df0){return function(_0x5d4240){logger[_0x1c1c('0x98')](_0x339df0,util[_0x1c1c('0x99')](_0x5d4240,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x23d042){return _0x23d042&&!_['isUndefined'](_0x23d042)&&_0x23d042[_0x1c1c('0x9a')]>0x0;}function decremetOriginate(_0x87be34){if(!_[_0x1c1c('0x85')](_0x87be34)&&_0x87be34!==null){if(typeof _0x87be34['originated']!=='undefined'){if(_0x87be34['originated']>0x0){_0x87be34[_0x1c1c('0x71')]-=0x1;}else{logger['error'](_0x1c1c('0x9b'));}}}else{logger['error'](_0x1c1c('0x9c'));}}function checkContactLowerLimitOriginate(_0xaabbf0,_0x25ad92,_0x385cb9){if(_0x25ad92>_0x385cb9){for(var _0x4fb742=0x0;_0x4fb742<_0x25ad92-_0x385cb9;_0x4fb742+=0x1){decremetOriginate(_0xaabbf0);}}}function loggerGetContactDialer(_0x4c4f98,_0x427d48,_0x227bdc){return function(_0xb01563){checkContactLowerLimitOriginate(_0x427d48,_0x227bdc,0x0);logger[_0x1c1c('0x98')](_0x4c4f98,util[_0x1c1c('0x99')](_0xb01563,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xbd8607){return function(_0x44c5cb){if(isNotNull(_0x44c5cb)&&isNotNull(_0x44c5cb[0x0])){if(_0x44c5cb[0x0]['contactsRescheduled']>0x0){_0xbd8607['message']=_0x1c1c('0x9d');logger[_0x1c1c('0x7e')](_0x1c1c('0x9e')+_0xbd8607['name'],_0x44c5cb[0x0][_0x1c1c('0x9f')],_0x1c1c('0xa0'));}else{_0xbd8607[_0x1c1c('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x1c1c('0xa1')+_0xbd8607[_0x1c1c('0x40')]);}}};}function notSendMessagesQueue(_0x53dd9b){if(_0x53dd9b[_0x1c1c('0xa2')]){freeVariablesPredictive(_0x53dd9b);if(_0x53dd9b['originated']===0x0&&_0x53dd9b[_0x1c1c('0x55')]===0x0&&_0x53dd9b['waiting']===0x0&&(_0x53dd9b['pTalking']||0x0)===0x0){_0x53dd9b[_0x1c1c('0xa2')]=![];_0x53dd9b[_0x1c1c('0x4f')]=0x0;_0x53dd9b[_0x1c1c('0x3f')]=_0x1c1c('0x42');loggerSyncQueueSummary[_0x1c1c('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x53dd9b[_0x1c1c('0x40')],_0x1c1c('0xa3'));}else{_0x53dd9b[_0x1c1c('0x3f')]=_0x1c1c('0xa4');loggerSyncQueueSummary[_0x1c1c('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x53dd9b[_0x1c1c('0x40')],_0x1c1c('0xa5'));}emitVoiceQueueSummary(_0x53dd9b);}}function notSendMessagesCampaign(_0x484c79){if(_0x484c79[_0x1c1c('0xa2')]){if(_0x484c79[_0x1c1c('0x71')]===0x0){_0x484c79['sendMessageOneNotActive']=![];_0x484c79[_0x1c1c('0x3f')]=_0x1c1c('0x42');loggerSyncQueueSummary[_0x1c1c('0x98')](_0x1c1c('0xa6'),_0x484c79[_0x1c1c('0x40')],_0x1c1c('0xa3'));}else{_0x484c79[_0x1c1c('0x3f')]=_0x1c1c('0xa4');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x484c79['name'],_0x1c1c('0xa5'));}emitCampaignSummary(_0x484c79);}}function createObjHistory(_0x3e975e,_0x31d5c2,_0x2c0cb3,_0x2d2ad2,_0x111d8b){_0x3e975e['message']=_0x2c0cb3;var _0xf2070e=new Action(_0x3e975e,_0x31d5c2);var _0x171b09=new History(_0xf2070e);_0x171b09[_0x1c1c('0xa7')]=_0x2d2ad2;_0x171b09[_0x1c1c('0xa8')]=_0x111d8b;_0x171b09[_0x1c1c('0xa9')]=_0xf2070e[_0x1c1c('0xaa')];return _0x171b09;}Dialer[_0x1c1c('0x1c')][_0x1c1c('0xab')]=function(){var _0x3eaea9=this;setInterval(function(){_0x3eaea9[_0x1c1c('0xac')](_0x3eaea9[_0x1c1c('0x27')],_0x1c1c('0xad'));_0x3eaea9[_0x1c1c('0xac')](_0x3eaea9[_0x1c1c('0x25')],_0x1c1c('0xae'));},0x32c8);};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xac')]=function(_0x5e53e4,_0x380f10){var _0x119496=this;for(var _0x1c5b35 in _0x5e53e4){if(typeof _0x5e53e4[_0x1c5b35]!==_0x1c1c('0xaf')){this[_0x1c1c('0x1f')][_0x1c1c('0x1d')](function(){if(!_[_0x1c1c('0xb0')](_0x5e53e4[_0x1c5b35])){return ami[_0x1c1c('0xb1')]({'action':_0x1c1c('0xb2'),'channel':_0x5e53e4[_0x1c5b35][_0x1c1c('0xb3')]})['catch'](function(_0xde707){if(_0xde707[_0x1c1c('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5e53e4[_0x1c5b35]&&_0x5e53e4[_0x1c5b35]['type']!==_0x1c1c('0x7b')){_0x119496['updateOriginated'](_0x119496[_0x1c1c('0x21')][_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]]);logger[_0x1c1c('0x98')](_0x1c1c('0xb5'),_0x380f10,_0x1c5b35,_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]);delete _0x5e53e4[_0x1c5b35];}if(_0x5e53e4[_0x1c5b35]&&_0x5e53e4[_0x1c5b35]['type']===_0x1c1c('0x7b')){_0x119496[_0x1c1c('0xb6')](_0x119496[_0x1c1c('0x22')][_0x5e53e4[_0x1c5b35]['queue']]);logger[_0x1c1c('0x98')](_0x1c1c('0xb7'),_0x380f10,_0x1c5b35,_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]);delete _0x5e53e4[_0x1c5b35];}},0x2328);}});}});}}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xb8')]=function(_0x3c567a){return BPromise['resolve']()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xb8')](_0x3c567a))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xba')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xbb')]=function(_0x573f24){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperBlack['checkIsBlackList'](_0x573f24))['catch'](loggerCatch(_0x1c1c('0xbd')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x38b911){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperBlack[_0x1c1c('0xbe')](_0x38b911))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xbf')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc0')]=function(_0x1046bd){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopperHistory['avgHandleTime'](_0x1046bd))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xc1')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc2')]=function(_0x5cd24c){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper['rescheduleContact'](_0x5cd24c))['catch'](loggerCatch(_0x1c1c('0xc3')));};Dialer[_0x1c1c('0x1c')]['unlockContact']=function(_0x250a5e,_0x265128,_0x5becf7){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xc4')](_0x250a5e,_0x265128,_0x5becf7))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xc5')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc6')]=function(_0x145d9d,_0x35cb20,_0x5a2ac6,_0x3e2a20,_0x5444e1){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xc6')](_0x145d9d,_0x35cb20,_0x5a2ac6,_0x3e2a20))[_0x1c1c('0xb9')](function(_0x5197e6){_0x5444e1[_0x1c1c('0xc7')]-=_0x5a2ac6;_0x5444e1[_0x1c1c('0xc7')]=_0x5444e1[_0x1c1c('0xc7')]>0x0?_0x5444e1[_0x1c1c('0xc7')]:0x0;loggerCatch(_0x1c1c('0xc8'))(_0x5197e6);});};Dialer['prototype'][_0x1c1c('0xc9')]=function(_0x1c716f,_0x120cc5,_0x10d08c,_0x1ee3f4){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper['getContactDialerIvr'](_0x1c716f,_0x120cc5,_0x10d08c))['catch'](function(_0x35b464){_0x1ee3f4['temp']-=_0x120cc5;_0x1ee3f4[_0x1c1c('0xc7')]=_0x1ee3f4[_0x1c1c('0xc7')]>0x0?_0x1ee3f4[_0x1c1c('0xc7')]:0x0;loggerCatch(_0x1c1c('0xca'))(_0x35b464);});};Dialer[_0x1c1c('0x1c')]['getVoiceQueueRtPauses']=function(_0x466122){return BPromise['resolve']()[_0x1c1c('0x3d')](voiceQueueRt[_0x1c1c('0xcb')](_0x466122))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xcc')));};Dialer['prototype'][_0x1c1c('0xcd')]=function(_0x107320){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopper['moveContactManagedDialer'](_0x107320))['catch'](loggerCatch(_0x1c1c('0xce')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xcf')]=function(_0x2719c0){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperHistory[_0x1c1c('0xcf')](_0x2719c0))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xd0')));};Dialer['prototype'][_0x1c1c('0xb6')]=function(_0x2d9828){if(!_[_0x1c1c('0x85')](_0x2d9828)&&_0x2d9828!==null){if(typeof _0x2d9828[_0x1c1c('0x71')]!==_0x1c1c('0xaf')){if(_0x2d9828[_0x1c1c('0x71')]>0x0){_0x2d9828[_0x1c1c('0x71')]-=0x1;}else{logger[_0x1c1c('0x98')](_0x1c1c('0xd1'));}}}else{logger['error'](_0x1c1c('0xd2'));}};Dialer[_0x1c1c('0x1c')]['loggerHandler']=function(_0x3d70e9,_0x484f18){var _0x3144e8=this;return function(_0x1de8fb){_0x3144e8[_0x1c1c('0xb6')](_0x484f18);logger['error'](_0x3d70e9,util[_0x1c1c('0x99')](_0x1de8fb,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x586e7a,_0xf6e31d,_0x62961){var _0x2ebfc7={'state':0x19,'statedesc':_0x1c1c('0xd3')};this[_0x1c1c('0xb6')](_0xf6e31d);this[_0x1c1c('0xd4')](_[_0x1c1c('0x8f')](_0x2ebfc7,_[_0x1c1c('0xd5')](_0x62961,[_0x1c1c('0xd6'),_0x1c1c('0xd7'),_0x1c1c('0xd8'),'VoiceQueueId',_0x1c1c('0xd9')])),_0x1c1c('0xda'),_0x1c1c('0xdb'));logger[_0x1c1c('0x98')](_0x586e7a);};Dialer[_0x1c1c('0x1c')]['isSuccess']=function(_0x538586){return _0x538586===_0x1c1c('0xdc');};Dialer['prototype'][_0x1c1c('0xdd')]=function(_0x38ae0e){return!_['isUndefined'](_0x38ae0e)&&_0x38ae0e&&!_[_0x1c1c('0x85')](_0x38ae0e[_0x1c1c('0x40')])&&!_['isUndefined'](_0x38ae0e[_0x1c1c('0x76')])&&_0x38ae0e[_0x1c1c('0x76')]&&(this[_0x1c1c('0x23')][util[_0x1c1c('0x78')](_0x1c1c('0xde'),_0x38ae0e[_0x1c1c('0x40')])][_0x1c1c('0xb2')]===_0x1c1c('0xdf')||this[_0x1c1c('0x23')][util[_0x1c1c('0x78')]('SIP/%s',_0x38ae0e['name'])][_0x1c1c('0xb2')]==='unmonitored');};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xd4')]=function(_0x5c7daf,_0x2d7b49,_0x5b6e52){this[_0x1c1c('0xcf')](_0x5c7daf)['catch'](loggerCatch(_0x2d7b49));this['moveContactManagedDialer'](_0x5c7daf)['catch'](loggerCatch(_0x5b6e52));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x37')]=function(_0x2c4e55){var _0x17cd15=this[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];var _0x4e1ec7;if(!_[_0x1c1c('0xb0')](_0x2c4e55)&&!_[_0x1c1c('0xb0')](_0x2c4e55[_0x1c1c('0xe1')])&&!_[_0x1c1c('0xb0')](_0x2c4e55[_0x1c1c('0xe1')][_0x1c1c('0xe2')])&&_0x2c4e55[_0x1c1c('0xe3')]===_0x1c1c('0xe4')&&_0x17cd15){if(_0x17cd15[_0x1c1c('0x4e')]!=='ivr'&&this[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xe7')){delete this[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x17cd15['queue']]);this[_0x1c1c('0x21')][_0x17cd15['queue']][_0x1c1c('0xe8')]+=0x1;this[_0x1c1c('0x21')][_0x17cd15['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4e1ec7=new Hangup(_0x17cd15,_0x2c4e55);_0x4e1ec7['state']=0x12;_0x4e1ec7[_0x1c1c('0xa8')]=_0x1c1c('0xe9');_0x4e1ec7[_0x1c1c('0xea')]=_0x1c1c('0xeb');ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut[_0x1c1c('0xed')](_0x4e1ec7,_0x1c1c('0xee')));this[_0x1c1c('0xd4')](_0x4e1ec7,'[syncHangupInAMD][createHistory]',_0x1c1c('0xef'));}if(_0x17cd15[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')&&this[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]]['dialAMDActive']&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xf0')){var _0x43b2da=this;return new BPromise(function(_0x2b9f00,_0x1197e7){delete _0x43b2da[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];_0x43b2da[_0x1c1c('0xb6')](_0x43b2da[_0x1c1c('0x21')][_0x17cd15['queue']]);_0x43b2da['voiceQueues'][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe8')]+=0x1;_0x43b2da[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1b31c0=_0x43b2da[_0x1c1c('0x21')][_0x17cd15['queue']];var _0x1627a8=new Hangup(_0x17cd15,_0x2c4e55);_0x1627a8[_0x1c1c('0xa7')]=0x13;_0x1627a8[_0x1c1c('0xa8')]='Machine';_0x1627a8['membername']=_0x1c1c('0xeb');_0x1627a8[_0x1c1c('0xf1')]+=0x1;_0x1627a8['countglobal']+=0x1;_0x1627a8[_0x1c1c('0xee')]=!![];ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut[_0x1c1c('0xed')](_0x1627a8,_0x1c1c('0xee')));_0x43b2da[_0x1c1c('0xcf')](_0x1627a8)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x1627a8[_0x1c1c('0xf3')]+_0x1627a8[_0x1c1c('0xf4')]+_0x1627a8[_0x1c1c('0xf5')]+_0x1627a8[_0x1c1c('0xf6')]+_0x1627a8['countdropretry']+_0x1627a8[_0x1c1c('0xf7')]+_0x1627a8['countmachineretry']+_0x1627a8[_0x1c1c('0xf8')]>=_0x1b31c0[_0x1c1c('0xf9')]){_0x43b2da['stateGlobal'](_0x1627a8,_0x2b9f00,_0x1197e7,_0x1c1c('0xfa'));}else{if(_0x1627a8['countmachineretry']>=_0x1b31c0[_0x1c1c('0xfb')]){_0x43b2da[_0x1c1c('0xfc')](_0x1627a8,_0x2b9f00,_0x1197e7,_0x1c1c('0xfd'));}else{_0x43b2da[_0x1c1c('0xc2')]({'active':![],'countmachineretry':_0x1627a8[_0x1c1c('0xf1')],'scheduledat':moment()[_0x1c1c('0xfe')](_0x1b31c0[_0x1c1c('0xff')],'minutes')[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x1627a8['ContactId'],'ListId':_0x1627a8[_0x1c1c('0xd7')],'VoiceQueueId':_0x1627a8[_0x1c1c('0x101')]||undefined,'CampaignId':_0x1627a8[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x2b9f00({'reschedule':0x1});}}});}if(_0x17cd15[_0x1c1c('0x4e')]===_0x1c1c('0x7b')&&this[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xe7')){delete this[_0x1c1c('0x27')][_0x2c4e55['uniqueid']];this['updateOriginated'](this[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]]);_0x4e1ec7=new Hangup(_0x17cd15,_0x2c4e55);_0x4e1ec7[_0x1c1c('0xa7')]=0x12;_0x4e1ec7[_0x1c1c('0xa8')]=_0x1c1c('0xe9');_0x4e1ec7[_0x1c1c('0xea')]=_0x1c1c('0xeb');ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut['buildObj'](_0x4e1ec7,_0x1c1c('0xee')));this[_0x1c1c('0xd4')](_0x4e1ec7,_0x1c1c('0x102'),_0x1c1c('0x103'));}if(_0x17cd15[_0x1c1c('0x4e')]==='ivr'&&this['campaigns'][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]==='MACHINE'){var _0x43b2da=this;return new BPromise(function(_0x33b1e8,_0x2ea58e){delete _0x43b2da[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];_0x43b2da[_0x1c1c('0xb6')](_0x43b2da['campaigns'][_0x17cd15['queue']]);_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0x104')]+=0x1;var _0x54c834=_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]];var _0x2941cd=new Hangup(_0x17cd15,_0x2c4e55);_0x2941cd[_0x1c1c('0xa7')]=0x13;_0x2941cd['statedesc']=_0x1c1c('0x105');_0x2941cd['membername']=_0x1c1c('0xeb');_0x2941cd[_0x1c1c('0xf1')]+=0x1;_0x2941cd['countglobal']+=0x1;_0x2941cd['amd']=!![];ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut['buildObj'](_0x2941cd,'amd'));_0x43b2da[_0x1c1c('0xcf')](_0x2941cd)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x2941cd[_0x1c1c('0xf3')]+_0x2941cd[_0x1c1c('0xf4')]+_0x2941cd[_0x1c1c('0xf5')]+_0x2941cd['countnosuchnumberretry']+_0x2941cd[_0x1c1c('0x106')]+_0x2941cd[_0x1c1c('0xf7')]+_0x2941cd[_0x1c1c('0xf1')]+_0x2941cd[_0x1c1c('0xf8')]>=_0x54c834[_0x1c1c('0xf9')]){_0x43b2da['stateGlobal'](_0x2941cd,_0x33b1e8,_0x2ea58e,_0x1c1c('0xfa'));}else{if(_0x2941cd['countmachineretry']>=_0x54c834[_0x1c1c('0xfb')]){_0x43b2da['createStateFinal'](_0x2941cd,_0x33b1e8,_0x2ea58e,_0x1c1c('0xfd'));}else{_0x43b2da['rescheduleContact']({'active':![],'countmachineretry':_0x2941cd['countmachineretry'],'scheduledat':moment()[_0x1c1c('0xfe')](_0x54c834[_0x1c1c('0xff')],'minutes')[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x2941cd['ContactId'],'ListId':_0x2941cd['ListId'],'VoiceQueueId':_0x2941cd['VoiceQueueId']||undefined,'CampaignId':_0x2941cd[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x107')));_0x33b1e8({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1c1c('0x34')]=function(_0x5ccdbe){var _0x16f312=this[_0x1c1c('0x27')][_0x5ccdbe['uniqueid']];var _0x1333eb=this;var _0x114692;if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]===_0x1c1c('0x7b')){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x22')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x22')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x108')]+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);this[_0x1c1c('0xcf')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x10a')));}if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')&&isNotNull(this[_0x1c1c('0x21')][_0x16f312['queue']][_0x1c1c('0x10b')])){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0xe8')]+=0x1;this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x104')]+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);_0x114692[_0x1c1c('0xa7')]=0x10;_0x114692[_0x1c1c('0xa8')]=_0x1c1c('0x10c');_0x114692[_0x1c1c('0xea')]=_0x1c1c('0x10d');this[_0x1c1c('0xcf')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x10a')));}if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]!=='ivr'&&!isNotNull(this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x10b')])){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);_0x114692[_0x1c1c('0xa7')]=0xc;_0x114692['statedesc']=_0x5ccdbe[_0x1c1c('0x10e')];_0x114692['membername']='Unknow';this[_0x1c1c('0xcf')](_0x114692)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x31')]=function(_0x154e60){var _0xfa26a8=this[_0x1c1c('0x27')][_0x154e60[_0x1c1c('0xe0')]];var _0x4a3003=this;if(this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]]){if(_0xfa26a8&&_0xfa26a8[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')){delete this[_0x1c1c('0x27')][_0x154e60['uniqueid']];this[_0x1c1c('0x21')][_0x154e60['queue']][_0x1c1c('0xe8')]+=0x1;var _0x17deaf=new AgentComplete(_0xfa26a8,_0x154e60);if(_0x154e60['reason']===_0x1c1c('0x10f')){_0x17deaf[_0x1c1c('0x110')]=this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]][_0x1c1c('0x111')]&&this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]][_0x1c1c('0x112')]?moment()[_0x1c1c('0x78')](_0x1c1c('0x100')):undefined;}this['createHistory'](_0x17deaf)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1c1c('0xcd')](_0x17deaf)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x1c1c('0x2d')]=function(_0x247bed){if(this[_0x1c1c('0x21')][_0x247bed['queue']]){if(this[_0x1c1c('0x27')][_0x247bed[_0x1c1c('0xe0')]]&&this[_0x1c1c('0x27')][_0x247bed[_0x1c1c('0xe0')]][_0x1c1c('0x4e')]!=='ivr'){this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x247bed[_0x1c1c('0xb4')]]);this['uniqueId'][_0x247bed[_0x1c1c('0xe0')]][_0x1c1c('0x113')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x1c1c('0x114')]=function(_0x745ebc){this['createHistory'](_0x745ebc)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x115')));this[_0x1c1c('0xcd')](_0x745ebc)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x116')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x117')]=function(_0x39f323){var _0x12da7e=this[_0x1c1c('0x27')][_0x39f323[_0x1c1c('0xe0')]];var _0x5eb2bd=this;if(this['voiceQueues'][_0x39f323['queue']]){if(_0x12da7e&&_0x12da7e['type']!==_0x1c1c('0x7b')){delete this['uniqueId'][_0x39f323[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this['voiceQueues'][_0x39f323[_0x1c1c('0xb4')]]);_0x12da7e[_0x1c1c('0x118')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x37bd07=new QueueCallerAbandon(_0x12da7e,_0x39f323);if(getSeconds(_0x12da7e[_0x1c1c('0x118')],_0x12da7e[_0x1c1c('0x119')])>=_0x12da7e[_0x1c1c('0x11a')]){this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6b')]+=0x1;this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x63')]+=0x1;this['voiceQueues'][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6c')]+=0x1;_0x37bd07[_0x1c1c('0xa7')]=0xa;_0x37bd07['statedesc']=_0x1c1c('0x11b');_0x37bd07['dropreason']=_0x1c1c('0x11c');_0x37bd07[_0x1c1c('0x110')]=this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x111')]?moment()[_0x1c1c('0x78')](_0x1c1c('0x100')):undefined;_0x37bd07[_0x1c1c('0x106')]+=0x1;_0x37bd07['countglobal']+=0x1;if(_0x37bd07[_0x1c1c('0x106')]>=this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x11d')]){this[_0x1c1c('0x114')](_0x37bd07);}else{this[_0x1c1c('0xc2')]({'active':![],'countdropretry':_0x37bd07[_0x1c1c('0x106')],'scheduledat':moment()[_0x1c1c('0xfe')](this['voiceQueues'][_0x39f323['queue']]['dialDropRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x12da7e[_0x1c1c('0xd6')],'ListId':_0x12da7e['ListId'],'VoiceQueueId':_0x12da7e[_0x1c1c('0x101')]||undefined,'CampaignId':_0x12da7e['CampaignId']||undefined})['catch'](loggerCatch(_0x1c1c('0x11f')));var _0x40ec78=new History(_0x37bd07);_0x40ec78[_0x1c1c('0xa7')]=0xa;_0x40ec78[_0x1c1c('0xa8')]=_0x1c1c('0x11b');_0x40ec78['starttime']=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));_0x40ec78[_0x1c1c('0xa9')]=_0x40ec78[_0x1c1c('0xaa')];_0x40ec78[_0x1c1c('0x120')]=_0x37bd07[_0x1c1c('0x120')];_0x40ec78['calleridnum']=_0x37bd07['calleridnum'];this[_0x1c1c('0xcf')](_0x40ec78)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x121')));}}else{this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6a')]+=0x1;this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x62')]+=0x1;_0x37bd07[_0x1c1c('0xa7')]=0xb;_0x37bd07['statedesc']=_0x1c1c('0x122');_0x37bd07[_0x1c1c('0x123')]='CALLEREXIT';_0x37bd07[_0x1c1c('0xf7')]+=0x1;_0x37bd07['countglobal']+=0x1;if(_0x37bd07['countabandonedretry']>=this[_0x1c1c('0x21')][_0x39f323['queue']]['dialAbandonedMaxRetry']){this[_0x1c1c('0x114')](_0x37bd07);}else{this[_0x1c1c('0xc2')]({'active':![],'countabandonedretry':_0x37bd07[_0x1c1c('0xf7')],'scheduledat':moment()['add'](this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x124')],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12da7e[_0x1c1c('0xd6')],'ListId':_0x12da7e[_0x1c1c('0xd7')],'VoiceQueueId':_0x12da7e[_0x1c1c('0x101')]||undefined,'CampaignId':_0x12da7e[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x125')));var _0x40ec78=new History(_0x37bd07);_0x40ec78['state']=0xb;_0x40ec78['statedesc']=_0x1c1c('0x122');_0x40ec78[_0x1c1c('0xaa')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));_0x40ec78[_0x1c1c('0xa9')]=_0x40ec78[_0x1c1c('0xaa')];_0x40ec78['calleridname']=_0x37bd07['calleridname'];_0x40ec78[_0x1c1c('0x126')]=_0x37bd07['calleridnum'];this[_0x1c1c('0xcf')](_0x40ec78)['catch'](loggerCatch(_0x1c1c('0x127')));}}}}};Dialer[_0x1c1c('0x1c')]['syncNewExten']=function(_0x1be4b0){if(this[_0x1c1c('0x25')][_0x1be4b0['uniqueid']]){this[_0x1c1c('0x25')][_0x1be4b0[_0x1c1c('0xe0')]][_0x1c1c('0xb3')]=_0x1be4b0[_0x1c1c('0xb3')];}if(this['uniqueId'][_0x1be4b0[_0x1c1c('0xe0')]]){this[_0x1c1c('0x27')][_0x1be4b0['uniqueid']][_0x1c1c('0xb3')]=_0x1be4b0[_0x1c1c('0xb3')];}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x39')]=function(_0x2bd121){if(strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x129')]]===_0x1c1c('0x12a')){if(this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]&&_[_0x1c1c('0xb0')](this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0x12b')])&&_0x2bd121[_0x1c1c('0xb2')]==='1'&&_0x2bd121['paused']==='0'){if(this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]]){if(!this['agents'][_0x2bd121[_0x1c1c('0x12d')]][_0x1c1c('0x12b')]){this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]][_0x1c1c('0x12b')]=!![];this[_0x1c1c('0x25')][_0x2bd121['actionid']][_0x1c1c('0x12b')]=!![];this['actions'][_0x2bd121['actionid']][_0x1c1c('0x12d')]=_0x2bd121[_0x1c1c('0x12d')];}}}}else if((strategy[this['voiceQueues'][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]['strategy']]||_0x1c1c('0x1b'))===_0x1c1c('0x1b')){if(this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]){if(this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]]){this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0x12d')]=_0x2bd121[_0x1c1c('0x12d')];if(_[_0x1c1c('0xb0')](this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]['queue']])){this['queueBooked'][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]=[];}this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x12e')](_[_0x1c1c('0x8f')](_[_0x1c1c('0xd5')](this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]],[_0x1c1c('0x12f'),_0x1c1c('0x12d')]),{'status':_0x2bd121[_0x1c1c('0xb2')],'paused':_0x2bd121[_0x1c1c('0x130')]}));}}}};function unlockQueueStatus(_0x6fc0d4,_0x328598){setTimeout(function(){if(_[_0x1c1c('0x85')](_0x6fc0d4['queueStatusComplete'])){loggerBooked[_0x1c1c('0x98')](_0x1c1c('0x131'),_0x328598);}_0x6fc0d4['queueStatusComplete']=!![];loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x132'),_0x328598,JSON[_0x1c1c('0x49')](_[_0x1c1c('0xd5')](_0x6fc0d4,[_0x1c1c('0x40'),_0x1c1c('0x133')])));},0x1f3);}Dialer['prototype'][_0x1c1c('0x3a')]=function(_0x45b92a){var _0x55f3ee=this;var _0x1b9521=_0x55f3ee[_0x1c1c('0x21')][_0x55f3ee['actions'][_0x45b92a['actionid']]['queue']];if(strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['queue']][_0x1c1c('0x129')]]===_0x1c1c('0x12a')){if(this['actions'][_0x45b92a[_0x1c1c('0x128')]]&&this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['stateinterface']){this[_0x1c1c('0x20')][_0x1c1c('0x134')](this['actions'][_0x45b92a['actionid']][_0x1c1c('0x12f')],this[_0x1c1c('0x25')][_0x45b92a['actionid']]['stateinterface'])[_0x1c1c('0xb9')](function(_0x443464){logger[_0x1c1c('0x98')](_0x1c1c('0x135'),util[_0x1c1c('0x99')](_0x443464,{'showHidden':![],'depth':null}));})[_0x1c1c('0x136')](function(){_0x55f3ee[_0x1c1c('0xb6')](_0x55f3ee[_0x1c1c('0x21')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]);_0x55f3ee[_0x1c1c('0x12c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0x12d')]][_0x1c1c('0x12b')]=![];delete _0x55f3ee[_0x1c1c('0x25')][_0x45b92a['actionid']];unlockQueueStatus(_0x1b9521);});}else{this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]);this[_0x1c1c('0xc2')]({'active':![],'ContactId':this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xd6')],'ListId':this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xd7')],'VoiceQueueId':this['actions'][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0x101')]||undefined,'CampaignId':this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x137')));delete this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]];unlockQueueStatus(_0x1b9521);}}else if((strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]][_0x1c1c('0x129')]]||'rrmemory')==='rrmemory'){var _0x1bb005;if(this['actions'][_0x45b92a[_0x1c1c('0x128')]]&&!_[_0x1c1c('0x95')](this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]])){if(this[_0x1c1c('0x2c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]){this[_0x1c1c('0x2c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]=this['queueBookedRR'][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]?this[_0x1c1c('0x2c')][this[_0x1c1c('0x25')][_0x45b92a['actionid']]['queue']]:this[_0x1c1c('0x2b')][this['actions'][_0x45b92a[_0x1c1c('0x128')]]['queue']]?this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x138')]||0x0:0x0;}this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['queue']][_0x1c1c('0x138')]=this[_0x1c1c('0x2c')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]];for(var _0x3e2aed=0x0;_0x3e2aed=0x0;})['catch'](myreject(_0x31f806)));}}else{_0x5596b7['push'](ami[_0x1c1c('0xb1')]({'action':'command','command':util['format'](_0x1c1c('0x154'),_0x58392e,!_['isUndefined'](config[_0x1c1c('0x14d')][_0x2e2545])?_0x2e2545:'')})['then'](function(_0x1ce373){return _0x1ce373[_0x1c1c('0x152')][_0x1c1c('0x155')](_0x1c1c('0x153'))>=0x0;})[_0x1c1c('0xb9')](myreject(_0x31f806)));}BPromise['all'](_0x5596b7)[_0x1c1c('0x3d')](function(_0x1607e3){var _0x3b30e9=_[_0x1c1c('0x156')](_0x1607e3);if(_0x3b30e9){return _0x2dfa3d(_0x3b30e9);}else{_0x2e53cd[_0x1c1c('0x3f')]=_0x5c0ecb?'GLOBAL_INTERVAL_IS_OVERTIME':_0x1c1c('0x157');return _0x31f806(msgResponse(_0x1c1c('0x158'),'Failure',_0x1c1c('0x159')+_0x5c0ecb+'\x20'+_0x415892+_0x1c1c('0x15a')+util['inspect'](_0x58392e,{'showHidden':![],'depth':null})+_0x1c1c('0x15b')+_0x2e2545));}})[_0x1c1c('0xb9')](function(_0x417cd9){return _0x31f806(msgResponse(_0x1c1c('0x147'),'Failure',JSON['stringify'](_0x417cd9)));});});};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x15c')]=function(_0x323771){var _0x77cce5=this;return function(){switch(_0x323771['dialMethod']){case _0x1c1c('0x15d'):freeVariablesPredictive(_0x323771);_0x77cce5['handlePower'](_0x323771,0x1);break;case _0x1c1c('0x15e'):freeVariablesPredictive(_0x323771);_0x77cce5[_0x1c1c('0x15f')](_0x323771,_0x323771[_0x1c1c('0x160')]);break;case _0x1c1c('0xb'):_0x77cce5[_0x1c1c('0xb')](_0x323771);break;case _0x1c1c('0xa'):freeVariablesPredictive(_0x323771);_0x77cce5[_0x1c1c('0x15f')](_0x323771,0x1);break;default:freeVariablesPredictive(_0x323771);logger[_0x1c1c('0x98')](_0x1c1c('0x161'),_0x323771[_0x1c1c('0x40')],_0x1c1c('0x162'));}};};Dialer['prototype'][_0x1c1c('0x163')]=function(_0x4609e2){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0x164')](_0x4609e2['id'],previewRecallmeReminderInterval))['then'](function(_0x2ed4dd){for(var _0xf7e14a=0x0;_0xf7e14a<_0x2ed4dd[_0x1c1c('0x9a')];_0xf7e14a++){var _0x5660de=_0x2ed4dd[_0xf7e14a][_0x1c1c('0x165')][_0x1c1c('0x40')];if(_0x5660de)io['to'](util['format']('user:%s',_0x5660de))[_0x1c1c('0x4d')](_0x1c1c('0x166'),{'hopper':_0x2ed4dd[_0xf7e14a]});}})['catch'](function(_0x14eac0){});};Dialer['prototype'][_0x1c1c('0x167')]=function(_0x8c0acf){var _0x22d1ce=this;return function(){_0x22d1ce[_0x1c1c('0x168')](_0x8c0acf);};};Dialer['prototype'][_0x1c1c('0xd')]=function(_0x40e4d7){var _0x205449=this;if(isNotPreview(_0x40e4d7[_0x1c1c('0x5a')])){if(isVoiceQueueOutbound(_0x40e4d7['type'])&&isActive(_0x40e4d7[_0x1c1c('0x169')])){_0x40e4d7[_0x1c1c('0xa2')]=!![];BPromise['resolve']()[_0x1c1c('0x3d')](checkIsLoggedIn(_0x40e4d7,_0x40e4d7[_0x1c1c('0x50')]))[_0x1c1c('0x3d')](checkIsActive(_0x40e4d7,_0x40e4d7['dialActive']))[_0x1c1c('0x3d')](checkInterval(_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x142')](_0x40e4d7))[_0x1c1c('0x3d')](_0x205449['checkIfTime'](_0x40e4d7[_0x1c1c('0x16a')],_0x40e4d7[_0x1c1c('0x16b')],_0x40e4d7['name'],_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x148')](_0x40e4d7[_0x1c1c('0x44')],_0x40e4d7[_0x1c1c('0x16b')],_0x40e4d7[_0x1c1c('0x40')],_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x15c')](_0x40e4d7))[_0x1c1c('0xb9')](loggerCatchQueueSummary(_0x1c1c('0x16c'),_0x40e4d7));}else{notSendMessagesQueue(_0x40e4d7);}}else{freeVariablesPredictive(_0x40e4d7);if(_0x40e4d7[_0x1c1c('0x16d')]){_0x205449[_0x1c1c('0x163')](_0x40e4d7);}}};Dialer['prototype'][_0x1c1c('0x16e')]=function(){var _0x5714d2=this;var _0x3f09b2;for(var _0x3b40ec in this[_0x1c1c('0x22')]){if(typeof this[_0x1c1c('0x22')][_0x3b40ec]!==_0x1c1c('0xaf')){_0x3f09b2=this[_0x1c1c('0x22')][_0x3b40ec];if(isCampaignIvr(_0x3f09b2[_0x1c1c('0x4e')])&&isActive(_0x3f09b2[_0x1c1c('0x76')])){_0x3f09b2[_0x1c1c('0xa2')]=!![];BPromise['resolve']()[_0x1c1c('0x3d')](checkIsActive(_0x3f09b2,_0x3f09b2[_0x1c1c('0x76')]))[_0x1c1c('0x3d')](checkInterval(_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2[_0x1c1c('0x142')](_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2[_0x1c1c('0x146')](_0x3f09b2['dialGlobalInterval'],_0x3f09b2['dialTimezone'],_0x3f09b2[_0x1c1c('0x40')],_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2['checkIfTimeIntervals'](_0x3f09b2['Interval'],_0x3f09b2[_0x1c1c('0x16b')],_0x3f09b2[_0x1c1c('0x40')],_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2['launchHandleIvr'](_0x3f09b2))[_0x1c1c('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x3f09b2));}else{notSendMessagesCampaign(_0x3f09b2);}}}};function getCallerIdRandom(_0xb6950b,_0x2f8359){var _0x2b799a;var _0x2116cc;var _0x2f473c;if(_0x2f8359<=0x0){_0x2f8359=0x1;}_0x2b799a=new RegExp('\x5cw{0,'+_0x2f8359+'}$');_0x2116cc=Math[_0x1c1c('0x16f')](0xa,_0x2f8359-0x1);_0x2f473c=Math[_0x1c1c('0x16f')](0xa,_0x2f8359)-0x1;return util[_0x1c1c('0x78')]('%s',_[_0x1c1c('0x170')](_0xb6950b,_0x2b799a,_[_0x1c1c('0x171')](_0x2116cc,_0x2f473c)));}function extractCalleridName(_0x2e9485){var _0x4ca266=_0x2e9485[_0x1c1c('0x172')](/"(.*?)"/);return _0x4ca266?_0x4ca266[0x1]:_0x2e9485;}function extractCalleridNumber(_0x107e9e){var _0x50a0f6=_0x107e9e[_0x1c1c('0x172')](/<(.*?)>/);return _0x50a0f6?_0x50a0f6[0x1]:_0x107e9e;}Dialer['prototype']['actionOriginate']=function(_0x2b8036,_0x2a6f37){var _0x1ae099=this;var _0x259655=uuid['v4']();this['actions'][_0x259655]=new Action(_0x2b8036,_0x2a6f37,_0x259655);return new BPromise(function(_0x238e3d,_0x483149){if(_['isUndefined'](_0x2b8036)&&typeof _0x2b8036!=='object'){return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x149'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1c1c('0x85')](_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')])||_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')]===null){return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x149'),_0x1c1c('0x176')));}var _0x13b6dc={'XMD-CALLERID':_0x1ae099['actions'][_0x259655][_0x1c1c('0x177')](),'XMD-AGI':_0x2b8036[_0x1c1c('0x10b')]?util[_0x1c1c('0x78')](_0x1c1c('0x178'),ipAgi,_0x2b8036['dialQueueProject']):_0x1c1c('0x179'),'XMD-AGIAFTER':_0x2b8036['dialQueueProject2']?util[_0x1c1c('0x78')](_0x1c1c('0x178'),ipAgi,_0x2b8036['dialQueueProject2']):_0x1c1c('0x179'),'XMD-QUEUE':_0x2b8036[_0x1c1c('0x4e')]===_0x1c1c('0x17a')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2b8036['name'],_0x2b8036[_0x1c1c('0x17b')]||'',_0x2b8036['dialAgiAfterHangupAgent']?'c':'',_0x2b8036[_0x1c1c('0x11a')]||0x3):'NONE','XMD-CONTACTID':_0x2a6f37[_0x1c1c('0xd6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x177')](),'XMD-AMD':_0x2b8036[_0x1c1c('0xe5')]?_0x1c1c('0x17c'):_0x1c1c('0x179'),'XMD-DESTINATION':_0x1c1c('0xe4')};if(_0x2b8036['dialAMDActive']){_0x13b6dc[_0x1c1c('0x17d')]=_0x2b8036['dialAMDInitialSilence']||0x9c4;_0x13b6dc[_0x1c1c('0x17e')]=_0x2b8036[_0x1c1c('0x17f')]||0x5dc;_0x13b6dc[_0x1c1c('0x180')]=_0x2b8036[_0x1c1c('0x181')]||0x320;_0x13b6dc[_0x1c1c('0x182')]=_0x2b8036[_0x1c1c('0x183')]||0x1388;_0x13b6dc[_0x1c1c('0x184')]=_0x2b8036[_0x1c1c('0x185')]||0x64;_0x13b6dc[_0x1c1c('0x186')]=_0x2b8036[_0x1c1c('0x187')]||0x32;_0x13b6dc[_0x1c1c('0x188')]=_0x2b8036[_0x1c1c('0x189')]||0x3;_0x13b6dc[_0x1c1c('0x18a')]=_0x2b8036['dialAMDSilenceThreshold']||0x100;_0x13b6dc[_0x1c1c('0x18b')]=_0x2b8036[_0x1c1c('0x18c')]||0x1388;}if(_0x2b8036['type']==='outbound'){_0x13b6dc['XMD-VOICEQUEUEID']=_0x2a6f37[_0x1c1c('0x101')];}else{_0x13b6dc['XMD-CAMPAIGNID']=_0x2a6f37[_0x1c1c('0xd9')];}for(var _0x3aeb8a in _0x2a6f37[_0x1c1c('0x174')]){if(typeof _0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a]!=='undefined'){if(isNotNull(_0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a])&&_0x3aeb8a!=='id'&&_0x3aeb8a!==_0x1c1c('0x18d')&&_0x3aeb8a!==_0x1c1c('0x18e')&&_0x3aeb8a!=='updatedAt'){_0x13b6dc[util[_0x1c1c('0x78')](_0x1c1c('0x18f'),_0x1c1c('0x190'),_['toUpper'](_0x3aeb8a))]=_0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a];}}}var _0x264c7f=_0x1ae099['isTrunkReachable'](_0x2b8036['Trunk'])?getCallerId(_0x2b8036[_0x1c1c('0x75')][_0x1c1c('0x191')],_0x2b8036[_0x1c1c('0x5b')],_0x2b8036[_0x1c1c('0x192')]>0x0?getCallerIdRandom(_0x2b8036['dialOriginateCallerIdNumber'],_0x2b8036[_0x1c1c('0x192')]):_0x2b8036['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x2b8036['TrunkBackup'])?_0x2b8036[_0x1c1c('0x75')]['callerid']:_0x2b8036['TrunkBackup'][_0x1c1c('0x191')],_0x2b8036[_0x1c1c('0x5b')],_0x2b8036[_0x1c1c('0x192')]>0x0?getCallerIdRandom(_0x2b8036[_0x1c1c('0x5c')],_0x2b8036[_0x1c1c('0x192')]):_0x2b8036['dialOriginateCallerIdNumber']);if(_0x264c7f){_0x13b6dc[_0x1c1c('0x193')]=_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x194')]=extractCalleridName(_0x264c7f);_0x13b6dc['XMD-ORIGINATECALLERIDNUM']=_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x195')]=extractCalleridNumber(_0x264c7f);}return ami[_0x1c1c('0xb1')]({'actionid':_0x259655,'action':_0x1c1c('0x173'),'channel':_0x1ae099['isTrunkReachable'](_0x2b8036[_0x1c1c('0x75')])?util['format'](_0x1c1c('0x196'),_0x2b8036['Trunk'][_0x1c1c('0x40')],isNotNull(_0x2b8036[_0x1c1c('0x5e')])?_0x2b8036[_0x1c1c('0x5e')]['trim']()||'':'',_0x2b8036[_0x1c1c('0x197')]>0x0?_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')]['substring'](_0x2b8036[_0x1c1c('0x197')]):_0x2a6f37['Contact'][_0x1c1c('0x175')]):util[_0x1c1c('0x78')](_0x1c1c('0x196'),_[_0x1c1c('0xb0')](_0x2b8036[_0x1c1c('0x143')])?_0x2b8036['Trunk'][_0x1c1c('0x40')]:_0x2b8036[_0x1c1c('0x143')][_0x1c1c('0x40')],isNotNull(_0x2b8036[_0x1c1c('0x5e')])?_0x2b8036[_0x1c1c('0x5e')][_0x1c1c('0x198')]()||'':'',_0x2b8036['dialCutDigit']>0x0?_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')][_0x1c1c('0x199')](_0x2b8036[_0x1c1c('0x197')]):_0x2a6f37['Contact'][_0x1c1c('0x175')]),'callerid':_0x264c7f,'Exten':_0x1c1c('0xe4'),'Context':_0x1c1c('0x19a'),'Priority':'1','variable':_0x13b6dc,'timeout':(_0x2b8036[_0x1c1c('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x259655})[_0x1c1c('0x3d')](function(_0x130428){return _0x238e3d(_0x130428);})[_0x1c1c('0xb9')](function(_0x49edd6){_0x2b8036[_0x1c1c('0x19b')]+=0x1;var _0x281101=new History(_0x1ae099[_0x1c1c('0x25')][_0x259655]);logger[_0x1c1c('0x98')](util[_0x1c1c('0x78')](_0x1c1c('0x19c'),JSON[_0x1c1c('0x49')](_0x49edd6)));_0x281101[_0x1c1c('0xa7')]=0xe;_0x281101[_0x1c1c('0xa8')]=_0x1c1c('0x19d');_0x281101[_0x1c1c('0xaa')]=moment()[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x281101['endtime']=_0x281101[_0x1c1c('0xaa')];_0x1ae099[_0x1c1c('0xcf')](_0x281101)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x19e')));_0x1ae099[_0x1c1c('0xcd')](_0x281101)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x19e')))['finally'](function(){delete _0x1ae099[_0x1c1c('0x25')][_0x259655];return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x48'),_0x1c1c('0x19f')));});});});};Dialer['prototype'][_0x1c1c('0x1a0')]=function(_0x10199e){var _0x24d02b=this['actions'][_0x10199e['actionid']];if(_0x24d02b){delete this['actions'][_0x10199e[_0x1c1c('0x128')]];_0x24d02b[_0x1c1c('0x119')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));var _0x15a673=_0x24d02b[_0x1c1c('0x4e')]==='ivr'?this[_0x1c1c('0x22')][_0x24d02b[_0x1c1c('0xb4')]]:this[_0x1c1c('0x21')][_0x24d02b[_0x1c1c('0x1a1')]()];if(!this[_0x1c1c('0x1a2')](_0x10199e[_0x1c1c('0x1a3')])){this[_0x1c1c('0xb6')](_0x15a673);return this[_0x1c1c('0x1a4')](_0x24d02b,_0x15a673,_0x10199e)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1a5')));}this[_0x1c1c('0x27')][_0x10199e[_0x1c1c('0xe0')]]=_0x24d02b;}};Dialer[_0x1c1c('0x1c')]['checkRetriveMax']=function(_0x5afce7,_0x57915c,_0x3f5f02){var _0x3f9393=new History(_0x57915c);if(_0x3f9393['countbusyretry']+_0x3f9393['countcongestionretry']+_0x3f9393[_0x1c1c('0xf5')]+_0x3f9393[_0x1c1c('0xf6')]+_0x3f9393[_0x1c1c('0x106')]+_0x3f9393[_0x1c1c('0xf7')]+_0x3f9393[_0x1c1c('0xf1')]+_0x3f9393[_0x1c1c('0xf8')]>=_0x3f5f02['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5afce7){case 0x3:if(_0x3f9393[_0x1c1c('0xf5')]>=_0x3f5f02[_0x1c1c('0x1a6')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countnoanswerretry':_0x3f9393[_0x1c1c('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02[_0x1c1c('0x1a7')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3f9393['countbusyretry']>=_0x3f5f02[_0x1c1c('0x1a8')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3f9393[_0x1c1c('0xf3')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02['dialBusyRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3f9393[_0x1c1c('0xf4')]>=_0x3f5f02['dialCongestionMaxRetry']-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countcongestionretry':_0x3f9393[_0x1c1c('0xf4')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0x1a9')],_0x1c1c('0x11e'))['format'](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1aa')));break;case 0x0:if(_0x3f9393['countnosuchnumberretry']>=_0x3f5f02['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x1c1c('0xc2')]({'active':![],'countnosuchnumberretry':_0x3f9393[_0x1c1c('0xf6')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0x1ab')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393['CampaignId']||undefined})['catch'](loggerCatch(_0x1c1c('0x1ac')));}break;case 0xa:if(_0x3f9393['countdropretry']>=_0x3f5f02[_0x1c1c('0x11d')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countdropretry':_0x3f9393[_0x1c1c('0x106')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02['dialDropRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393['ListId'],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x11f')));break;case 0xb:if(_0x3f9393[_0x1c1c('0xf7')]>=_0x3f5f02[_0x1c1c('0x1ad')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countabandonedretry':_0x3f9393['countabandonedretry']+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02['dialAbandonedRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393['ContactId'],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x125')));break;case 0x13:if(_0x3f9393[_0x1c1c('0xf1')]>=_0x3f5f02[_0x1c1c('0xfb')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countmachineretry':_0x3f9393['countmachineretry']+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0xff')],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3f9393[_0x1c1c('0xf8')]>=_0x3f5f02[_0x1c1c('0x1ae')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3f9393[_0x1c1c('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02[_0x1c1c('0x1af')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4de369,_0x35188b,_0x5d4931){var _0x430d96=this;var _0x15185c=new History(_0x4de369);return new BPromise(function(_0x581928,_0xaf687){if(_[_0x1c1c('0x85')](_0x35188b)&&typeof _0x35188b!=='object'){return _0xaf687(msgResponse(_0x1c1c('0x1b0'),_0x1c1c('0x149'),'entity\x20is\x20undefine'));}if(_[_0x1c1c('0x85')](_0x5d4931)&&typeof _0x5d4931!==_0x1c1c('0x1b1')){return _0xaf687(msgResponse('[callProgressDetecting]',_0x1c1c('0x149'),_0x1c1c('0x1b2')));}switch(_0x5d4931[_0x1c1c('0x1b3')]){case'0':_0x35188b[_0x1c1c('0x1b4')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x0;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1b5');_0x15185c[_0x1c1c('0xf6')]+=0x1;_0x15185c['countglobal']+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1b6'),ut['buildObj'](_0x4de369,'nosuchnumber'));_0x430d96['createHistory'](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x430d96[_0x1c1c('0x1b7')](0x0,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf6')]>=_0x35188b[_0x1c1c('0x1b8')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1b9'));}else{_0x430d96['stateGlobal'](_0x15185c,_0x581928,_0xaf687,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x35188b[_0x1c1c('0x64')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x3;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1ba');_0x15185c[_0x1c1c('0xf5')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1bc'),ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1bd')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1be')));if(_0x430d96[_0x1c1c('0x1b7')](0x3,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf5')]>=_0x35188b[_0x1c1c('0x1a6')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1bf'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1bf'));}}break;case'5':_0x35188b['outboundBusyCallsDay']+=0x1;_0x15185c['state']=0x5;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1c1');_0x15185c[_0x1c1c('0xf3')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')]('custom:agentbusy',ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1c2')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1c3')));if(_0x430d96[_0x1c1c('0x1b7')](0x5,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf3')]>=_0x35188b[_0x1c1c('0x1a8')]){_0x430d96['createStateFinal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c4'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c4'));}}break;case'8':_0x35188b['outboundCongestionCallsDay']+=0x1;_0x15185c['state']=0x8;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1c5');_0x15185c[_0x1c1c('0xf4')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1c6'),ut[_0x1c1c('0xed')](_0x4de369,'congestion'));_0x430d96[_0x1c1c('0xcf')](_0x15185c)['catch'](loggerCatch(_0x1c1c('0x1c7')));if(_0x430d96[_0x1c1c('0x1b7')](0x8,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf4')]>=_0x35188b[_0x1c1c('0x1c8')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c9'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c9'));}}break;case'11':_0x35188b['outboundAbandonedCallsDay']+=0x1;_0x15185c[_0x1c1c('0xa7')]=0xb;_0x15185c[_0x1c1c('0xa8')]='Abandoned';_0x15185c[_0x1c1c('0xf7')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x127')));if(_0x430d96['checkRetriveMax'](0xb,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf7')]>=_0x35188b[_0x1c1c('0x1ad')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ca'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,'reason\x2011\x20abandoned');}}break;case'20':_0x35188b[_0x1c1c('0x65')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x14;_0x15185c[_0x1c1c('0xa8')]='AgentReject';_0x15185c[_0x1c1c('0xf8')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1cb'),ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1cc')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)['catch'](loggerCatch(_0x1c1c('0x1cd')));if(_0x430d96[_0x1c1c('0x1b7')](0x14,_0x4de369,_0x35188b)){if(_0x15185c['countagentrejectretry']>=_0x35188b['dialAgentRejectMaxRetry']){_0x430d96['createStateFinal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ce'));}else{_0x430d96['stateGlobal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ce'));}}break;default:_0x35188b[_0x1c1c('0x66')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0xc;_0x15185c[_0x1c1c('0xa8')]=_0x5d4931[_0x1c1c('0x1b3')];_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x430d96['checkRetriveMax'](_0x5d4931['reason'],_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf3')]+_0x15185c[_0x1c1c('0xf4')]+_0x15185c['countnoanswerretry']+_0x15185c['countnosuchnumberretry']+_0x15185c[_0x1c1c('0x106')]+_0x15185c[_0x1c1c('0xf7')]+_0x15185c[_0x1c1c('0xf1')]+_0x15185c['countagentrejectretry']>=_0x35188b['dialGlobalMaxRetry']){_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x5d4931[_0x1c1c('0x1b3')]);}else{_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x5d4931[_0x1c1c('0x1b3')]);}}}});};Dialer[_0x1c1c('0x1c')]['stateGlobal']=function(_0x42cc7b,_0xca82fb,_0x2da6bc,_0x29d74c){var _0xa905eb=new Final(_0x42cc7b);_0xa905eb[_0x1c1c('0xa7')]=0xf;_0xa905eb['statedesc']=_0x1c1c('0x1cf');this[_0x1c1c('0xfc')](_0xa905eb,_0xca82fb,_0x2da6bc,_0x29d74c);};Dialer['prototype'][_0x1c1c('0xfc')]=function(_0x460d1c,_0x335bc2,_0x19ff2a,_0x48427c){this[_0x1c1c('0xcd')](_0x460d1c)[_0x1c1c('0x3d')](function(){return _0x335bc2(msgResponse(_0x1c1c('0x1b0'),_0x1c1c('0xdc'),_0x48427c));})[_0x1c1c('0xb9')](function(){return _0x19ff2a(msgResponse(_0x1c1c('0x1d0'),'Failure',_0x1c1c('0x1d1')));});};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xb')]=function(_0x11e20c){var _0xe86ffe=_0x11e20c[_0x1c1c('0x1d2')]/0x64;var _0x33a8b0=_0x11e20c[_0x1c1c('0x63')]/(_0x11e20c[_0x1c1c('0x63')]+_0x11e20c[_0x1c1c('0xe8')]);var _0xf61718=Math[_0x1c1c('0x1d3')](_0x11e20c[_0x1c1c('0x6f')]*(_0x11e20c[_0x1c1c('0x1d4')]/0x64));var _0x3355a7=Math[_0x1c1c('0x1d3')](_0x11e20c[_0x1c1c('0x6f')]*(_0x11e20c[_0x1c1c('0x1d5')]/0x64));var _0x23d7e7=_0x11e20c[_0x1c1c('0x4f')]+_0x11e20c[_0x1c1c('0x55')];var _0x114231=Math[_0x1c1c('0x1d6')](_0x11e20c['erlangCalls']*_0x11e20c[_0x1c1c('0x74')]*_0x11e20c[_0x1c1c('0x6d')]*_0x11e20c[_0x1c1c('0x6e')]);if(_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x90')])){if(!_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x29')])){_0x11e20c[_0x1c1c('0x29')]=undefined;loggerPredictive['error'](_0x1c1c('0x1d7'),_0x1c1c('0x1d8'));}if(!_['isUndefined'](_0x11e20c[_0x1c1c('0x92')])){loggerPredictive[_0x1c1c('0x98')](_0x1c1c('0x1d7'),_0x1c1c('0x1d9'));clearInterval(_0x11e20c[_0x1c1c('0x92')]);_0x11e20c[_0x1c1c('0x92')]=undefined;}_0x11e20c[_0x1c1c('0x90')]=moment()[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x11e20c[_0x1c1c('0x90')]);this[_0x1c1c('0x15f')](_0x11e20c,0x1);}else if(ifInterval(_0x11e20c[_0x1c1c('0x1da')],_0x11e20c[_0x1c1c('0x90')])){this['handlePower'](_0x11e20c,0x1);loggerPredictiveCalls['info'](_0x1c1c('0x1db'),_0x11e20c[_0x1c1c('0x90')],_0x11e20c[_0x1c1c('0x40')]);_0x11e20c['erlangCalls']=0x0;_0x11e20c[_0x1c1c('0x6c')]=0x0;}else if(_0xe86ffe<_0x33a8b0&&_0x11e20c[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){freeVariablesPredictive(_0x11e20c);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x1de'),_0x1c1c('0x1df'),_0x33a8b0,'startProgressive',_0x11e20c['name']);}else if(_0x114231<_0x11e20c['predictiveIntervalErlangCallsDroppedCalls']&&_0x11e20c[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){freeVariablesPredictive(_0x11e20c);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x1e0'),_0x1c1c('0x1e1'),_0x114231,_0x1c1c('0x1e2'),_0x11e20c['predictiveIntervalErlangCallsDroppedCalls'],_0x1c1c('0x90'),_0x11e20c[_0x1c1c('0x40')]);}else if(!ifInterval(_0x11e20c[_0x1c1c('0x1da')],_0x11e20c[_0x1c1c('0x90')])&&_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x29')])&&!_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x90')])){_0x11e20c[_0x1c1c('0x29')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));loggerPredictive[_0x1c1c('0x7e')](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e3'),_0x11e20c['startPredictive']);this[_0x1c1c('0xc0')](_0x11e20c[_0x1c1c('0x1da')])[_0x1c1c('0x3d')](this[_0x1c1c('0x1e4')](_0x11e20c))[_0x1c1c('0x3d')](mergeDataErlangB(_0x11e20c))[_0x1c1c('0x3d')](this[_0x1c1c('0x1e5')](_0x11e20c))[_0x1c1c('0xb9')](loggerCatchPredictive(_0x1c1c('0x1e6'),_0x11e20c));}else if(!ifInterval(_0x11e20c['dialPredictiveInterval'],_0x11e20c[_0x1c1c('0x29')])){_0x11e20c[_0x1c1c('0x6c')]=0x0;_0x11e20c[_0x1c1c('0x29')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));loggerPredictive[_0x1c1c('0x7e')](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e7'),_0x11e20c[_0x1c1c('0x29')]);clearInterval(_0x11e20c[_0x1c1c('0x92')]);_0x11e20c[_0x1c1c('0x92')]=undefined;this['averageHandleTime'](_0x11e20c['dialPredictiveInterval'])['then'](this[_0x1c1c('0x1e4')](_0x11e20c))[_0x1c1c('0x3d')](mergeDataErlangB(_0x11e20c))[_0x1c1c('0x3d')](this['startMethodPredictive'](_0x11e20c))[_0x1c1c('0xb9')](loggerCatchPredictive(_0x1c1c('0x1e8'),_0x11e20c));}else if(_0x11e20c[_0x1c1c('0x6f')]&&_0x23d7e7<_0x11e20c[_0x1c1c('0x6f')]-_0x3355a7){freeVariablesPredictive(_0x11e20c);loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e9'),_0x23d7e7,_0x1c1c('0x1ea'),_0x11e20c[_0x1c1c('0x6f')],'-',_0x3355a7,'=',_0x11e20c[_0x1c1c('0x6f')]-_0x3355a7,')');}else if(_0x11e20c[_0x1c1c('0x6f')]&&_0x23d7e7>_0x11e20c[_0x1c1c('0x6f')]+_0xf61718){freeVariablesPredictive(_0x11e20c);loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e9'),_0x23d7e7,_0x1c1c('0x1eb'),_0x11e20c['predictiveIntervalAvailable'],'+',_0xf61718,'=',_0x11e20c[_0x1c1c('0x6f')]+_0xf61718,')');}};Dialer[_0x1c1c('0x1c')]['getDataPredictive']=function(_0x5388a5){var _0x4bad39=this;return function(_0x1a61fe){return new BPromise(function(_0x160b60,_0x5be204){_[_0x1c1c('0x8f')](_0x5388a5,_0x1a61fe[0x0]);if(checkGetDataPredictive(_0x1a61fe[0x0])){var _0x58346c=_0x5388a5[_0x1c1c('0x6f')]=_0x5388a5[_0x1c1c('0x55')]+_0x5388a5[_0x1c1c('0x4f')];var _0x2e8bf9=_0x5388a5[_0x1c1c('0x1da')]*0x3c;var _0x1536d0=_0x1a61fe[0x0]['predictiveIntervalAvgTalktime']+_0x1a61fe[0x0]['predictiveIntervalAvgHoldtime'];var _0x3ea48f=(_0x1a61fe[0x0][_0x1c1c('0x67')]+_0x1a61fe[0x0][_0x1c1c('0x6b')]+_0x1a61fe[0x0][_0x1c1c('0x6a')])/_0x1a61fe[0x0][_0x1c1c('0x70')];_0x5388a5[_0x1c1c('0x6d')]=_0x3ea48f>0x0?_0x3ea48f:0x1;switch(_0x5388a5[_0x1c1c('0x1dc')]){case _0x1c1c('0x1dd'):var _0x414aa1=_0x5388a5[_0x1c1c('0x1d2')]/0x64;return _0x4bad39[_0x1c1c('0x1ec')](_0x58346c,_0x2e8bf9,_0x1536d0,_0x3ea48f,_0x414aa1)[_0x1c1c('0x3d')](function(_0x620db1){return _0x160b60(_0x620db1);});case _0x1c1c('0x1ed'):var _0x33affb=_0x5388a5[_0x1c1c('0x1d2')]/0x64;return _0x4bad39['busyFactor'](_0x58346c,_0x2e8bf9,_0x1536d0,_0x3ea48f,_0x33affb)[_0x1c1c('0x3d')](function(_0x2a5bed){return _0x160b60(_0x2a5bed);});default:return _0x5be204(msgResponse(_0x1c1c('0x1ee'),'Failure',_0x1c1c('0x1ef')));}}else{return _0x5be204(msgResponse(_0x1c1c('0x1ee'),'Failure',_0x1c1c('0x1f0')));}});};};Dialer[_0x1c1c('0x1c')]['getDataPredictiveOld']=function(_0x4efce7){var _0x296b28=this;return function(_0x2543fb){return new BPromise(function(_0x427914,_0x461587){_[_0x1c1c('0x8f')](_0x4efce7,_0x2543fb[0x0]);if(checkGetDataPredictive(_0x2543fb[0x0])){loggerPredictive[_0x1c1c('0x7e')](JSON['stringify'](_0x2543fb[0x0]));if(_0x4efce7[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){return _0x296b28[_0x1c1c('0xcb')](_0x4efce7['id'])[_0x1c1c('0x3d')](function(_0x48aed8){var _0x56d6a1=_0x4efce7['loggedIn']-_0x48aed8[0x0][_0x1c1c('0x1f1')];var _0x25b235=_0x4efce7[_0x1c1c('0x1da')]*0x3c;var _0x624d92=_0x2543fb[0x0][_0x1c1c('0x69')]+_0x2543fb[0x0]['predictiveIntervalAvgHoldtime'];var _0x3365f6=(_0x2543fb[0x0]['predictiveIntervalAnsweredCalls']+_0x2543fb[0x0][_0x1c1c('0x6b')]+_0x2543fb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2543fb[0x0]['predictiveIntervalTotalCalls'];var _0x2364c1=_0x4efce7[_0x1c1c('0x1d2')]/0x64;_0x4efce7[_0x1c1c('0x1f2')]=_0x48aed8[0x0][_0x1c1c('0x1f1')]||0x0;_0x4efce7['predictiveIntervalHitRate']=_0x3365f6>0x0?_0x3365f6:0x1;return _0x296b28[_0x1c1c('0x1ec')](_0x56d6a1,_0x25b235,_0x624d92,_0x3365f6,_0x2364c1);})[_0x1c1c('0x3d')](function(_0x36db00){return _0x427914(_0x36db00);})['catch'](function(_0x16fd6a){return _0x461587(msgResponse(_0x1c1c('0x1f3'),_0x1c1c('0x149'),JSON[_0x1c1c('0x49')](_0x16fd6a)));});}if(_0x4efce7[_0x1c1c('0x1dc')]===_0x1c1c('0x1ed')){return _0x296b28[_0x1c1c('0xcb')](_0x4efce7['id'])['then'](function(_0x3940e6){var _0x3d4658=_0x4efce7[_0x1c1c('0x50')]-_0x3940e6[0x0][_0x1c1c('0x1f1')];var _0x58fe87=_0x4efce7[_0x1c1c('0x1da')]*0x3c;var _0x42ce6c=_0x2543fb[0x0][_0x1c1c('0x69')]+_0x2543fb[0x0][_0x1c1c('0x68')];var _0x2b0950=(_0x2543fb[0x0][_0x1c1c('0x67')]+_0x2543fb[0x0][_0x1c1c('0x6b')]+_0x2543fb[0x0][_0x1c1c('0x6a')])/_0x2543fb[0x0][_0x1c1c('0x70')];var _0x495cf2=_0x4efce7[_0x1c1c('0x1d2')]/0x64;_0x4efce7[_0x1c1c('0x1f2')]=_0x3940e6[0x0][_0x1c1c('0x1f1')]||0x0;_0x4efce7[_0x1c1c('0x6d')]=_0x2b0950>0x0?_0x2b0950:0x1;return _0x296b28[_0x1c1c('0x1f4')](_0x3d4658,_0x58fe87,_0x42ce6c,_0x2b0950,_0x495cf2);})[_0x1c1c('0x3d')](function(_0x121a82){return _0x427914(_0x121a82);})[_0x1c1c('0xb9')](function(_0xf4e21d){return _0x461587(msgResponse(_0x1c1c('0x1f3'),'Failure',JSON[_0x1c1c('0x49')](_0xf4e21d)));});}}else{return _0x461587(msgResponse(_0x1c1c('0x1ee'),_0x1c1c('0x149'),_0x1c1c('0x1f0')));}});};};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x1e5')]=function(_0x2e85cd){var _0x3eddad=this;return function(){var _0x2b2bbe=0x0;var _0x5c07fb=Math['floor'](_0x2e85cd['erlangCallToSecond']*0x3e8);if(_0x5c07fb>0x0){_0x5c07fb=_0x5c07fb<0x64?0x64:_0x5c07fb;loggerPredictive[_0x1c1c('0x7e')](_0x2e85cd[_0x1c1c('0x40')],'one\x20call\x20every:',_0x5c07fb,_0x1c1c('0x4a'));_0x2e85cd[_0x1c1c('0x92')]=setInterval(function(){_0x3eddad[_0x1c1c('0x92')](_0x2e85cd);loggerPredictiveCalls[_0x1c1c('0x7e')](_0x1c1c('0x1f5'),_0x2b2bbe+=0x1);},_0x5c07fb);}else{loggerPredictive[_0x1c1c('0x7e')](_0x2e85cd[_0x1c1c('0x40')],_0x1c1c('0x1f6'));}};};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x1f7')]=function(_0x133192,_0xfe609b){var _0x2198ef=this;return function(_0x34f9f7){if(_['isEmpty'](_0x34f9f7)){if(_['isNil'](_0xfe609b[_0x1c1c('0xd8')])||!_0xfe609b[_0x1c1c('0x1f8')]){if(_0x133192[_0x1c1c('0x5a')]==='booked'){_0x133192[_0x1c1c('0x133')]=_[_0x1c1c('0x85')](_0x133192[_0x1c1c('0x133')])?!![]:_0x133192[_0x1c1c('0x133')];var _0x5332f7=uuid['v4']();_0x2198ef[_0x1c1c('0x25')][_0x5332f7]=new Action(_0x133192,_0xfe609b,_0x5332f7);loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x1f9'),_0x5332f7,'queueStatusComplete:\x20',JSON[_0x1c1c('0x49')](_0x133192[_0x1c1c('0x133')]),_0x1c1c('0x1fa'),_0x133192[_0x1c1c('0x40')]);if(_0x133192[_0x1c1c('0x133')]){_0x133192['queueStatusComplete']=![];_0x2198ef[_0x1c1c('0x2b')][_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xb4')]]=[];ami[_0x1c1c('0xb1')]({'actionid':_0x5332f7,'action':'queuestatus','queue':_0x133192[_0x1c1c('0x40')]})[_0x1c1c('0xb9')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);_0x2198ef[_0x1c1c('0xc2')]({'active':![],'ContactId':_0x2198ef['actions'][_0x5332f7]['ContactId'],'ListId':_0x2198ef['actions'][_0x5332f7][_0x1c1c('0xd7')],'VoiceQueueId':_0x2198ef['actions'][_0x5332f7][_0x1c1c('0x101')]||undefined,'CampaignId':_0x2198ef['actions'][_0x5332f7]['CampaignId']||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1fb')));delete _0x2198ef['actions'][_0x5332f7];});}else{loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x1fc'),JSON['stringify'](_0x133192['queueStatusComplete']),_0x1c1c('0x1fa'),_0x133192[_0x1c1c('0x40')]);_0x2198ef[_0x1c1c('0xb6')](_0x133192);_0x2198ef['rescheduleContact']({'active':![],'ContactId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xd6')],'ListId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7]['ListId'],'VoiceQueueId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0x101')]||undefined,'CampaignId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1fb')));delete _0x2198ef[_0x1c1c('0x25')][_0x5332f7];}}else{return _0x2198ef[_0x1c1c('0x1fd')](_0x133192,_0xfe609b);}}else{if(getDiff(_0xfe609b['scheduledat'])<_0x133192[_0x1c1c('0x1fe')]*0x3c){if(_0xfe609b[_0x1c1c('0x165')]&&!_0xfe609b[_0x1c1c('0x165')][_0x1c1c('0x1ff')]){_0x2198ef[_0x1c1c('0x20')][_0x1c1c('0x134')](_0xfe609b['id'])[_0x1c1c('0x136')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);});}else{_0x2198ef[_0x1c1c('0xc4')]({'active':![]},_0xfe609b['id'],0x1)[_0x1c1c('0x136')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);});}}else{_0x133192[_0x1c1c('0x200')]+=0x1;_0x2198ef[_0x1c1c('0xb6')](_0x133192);if(_0x133192[_0x1c1c('0x201')]){_0x2198ef[_0x1c1c('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xfe609b[_0x1c1c('0xd6')],'ListId':_0xfe609b[_0x1c1c('0xd7')],'VoiceQueueId':_0xfe609b[_0x1c1c('0x101')]||undefined,'CampaignId':_0xfe609b[_0x1c1c('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2198ef[_0x1c1c('0xcf')](createObjHistory(_0x133192,_0xfe609b,_0x1c1c('0x202'),0x17,'RecallInQueue'))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x203')));}else{_0x2198ef[_0x1c1c('0xd4')](createObjHistory(_0x133192,_0xfe609b,_0x1c1c('0x204'),0x16,_0x1c1c('0x205')),_0x1c1c('0x206'),_0x1c1c('0x207'));}}}}else{_0x133192[_0x1c1c('0x5f')]+=0x1;_0x2198ef[_0x1c1c('0xd4')](createObjHistory(_0x133192,_0xfe609b,'BLACKLIST',0xd,_0x1c1c('0x208')),_0x1c1c('0x209'),_0x1c1c('0x20a'));throw'inBlackList';}};};Dialer[_0x1c1c('0x1c')]['handleIvr']=function(_0x59b230){var _0x151053=this;var _0x3accee=_0x59b230[_0x1c1c('0x20b')]-_0x59b230[_0x1c1c('0x71')]-_0x59b230['temp'];emitCampaignSummary(_0x59b230);if(_0x3accee>0x0){if(_0x3accee>this['maxNumberOriginate']){_0x3accee=this['maxNumberOriginate'];}_0x59b230[_0x1c1c('0xc7')]+=_0x3accee;this[_0x1c1c('0xc9')](_0x59b230['id'],_0x3accee,_0x59b230[_0x1c1c('0x20c')],_0x59b230)['then'](function(_0x46974c){_0x59b230[_0x1c1c('0xc7')]-=_0x3accee;_0x59b230['temp']=_0x59b230[_0x1c1c('0xc7')]>0x0?_0x59b230[_0x1c1c('0xc7')]:0x0;if(!checkContactEmpty(_0x46974c)){_0x59b230[_0x1c1c('0x3f')]=_0x1c1c('0x20d');logger[_0x1c1c('0x7e')]('[getContactCampaign2][Empty]'+_0x59b230['name']);}else{_0x59b230['originated']+=_0x46974c['length'];_0x59b230[_0x1c1c('0x3f')]=_0x1c1c('0x20e');for(var _0x1f91bb=0x0;_0x1f91bb<_0x46974c[_0x1c1c('0x9a')];_0x1f91bb+=0x1){_0x59b230['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x46974c[_0x1f91bb])||_[_0x1c1c('0xb0')](_0x46974c[_0x1f91bb][_0x1c1c('0x174')])||_['isNil'](_0x46974c[_0x1f91bb][_0x1c1c('0x174')][_0x1c1c('0x175')])){_0x151053['emptyContact'](_0x1c1c('0x20f'),_0x59b230,_0x46974c[_0x1f91bb]);}else{_0x151053[_0x1c1c('0xbe')](_[_0x1c1c('0xd5')](_0x46974c[_0x1f91bb],[_0x1c1c('0xd9'),_0x1c1c('0x210')]))[_0x1c1c('0x3d')](_0x151053[_0x1c1c('0x1f7')](_0x59b230,_0x46974c[_0x1f91bb]))['catch'](_0x151053[_0x1c1c('0x211')](_0x1c1c('0x212'),_0x59b230));}}}})[_0x1c1c('0xb9')](loggerGetContactDialer(_0x1c1c('0x213'),_0x59b230,_0x3accee));}};Dialer['prototype'][_0x1c1c('0x15f')]=function(_0x37deba,_0x3f9f75){var _0x1b90df=this;var _0x2dfcf7=[];var _0x10f2b2=_0x3f9f75>=0x1?_0x3f9f75:0x1;if(_0x37deba[_0x1c1c('0x5a')]===_0x1c1c('0xa')){_0x10f2b2=0x1;}var _0xb19da7=Math[_0x1c1c('0x1d6')](_0x37deba[_0x1c1c('0x4f')]*_0x10f2b2)-_0x37deba[_0x1c1c('0x71')]-_0x37deba[_0x1c1c('0xc7')];emitVoiceQueueSummary(_0x37deba);if(_0x37deba['dialLimitQueue']>0x0){var _0x5ed3ee=_0x37deba[_0x1c1c('0x214')]-_0x37deba['originated']-_0x37deba[_0x1c1c('0x55')]-_0x37deba['temp']-_0x37deba['pTalking'];if(_0xb19da7>_0x5ed3ee){_0xb19da7=_0x5ed3ee;}}if(_0xb19da7>0x0){if(_0x37deba['dialMethod']===_0x1c1c('0xa')){_0xb19da7=0x1;}if(_0xb19da7>this[_0x1c1c('0x24')]){_0xb19da7=this['maxNumberOriginate'];}_0x37deba[_0x1c1c('0xc7')]+=_0xb19da7;for(var _0x4d176a in this[_0x1c1c('0x12c')]){if(typeof this[_0x1c1c('0x12c')][_0x4d176a]!==_0x1c1c('0xaf')){if(this[_0x1c1c('0x12c')][_0x4d176a]['state']===_0x1c1c('0x215')&&this['agents'][_0x4d176a]['status']===_0x1c1c('0xdf')){_0x2dfcf7[_0x1c1c('0x12e')](this[_0x1c1c('0x12c')][_0x4d176a]['id']);}}}this['getContactDialer'](_0x37deba['id'],_0x2dfcf7,_0xb19da7,_0x37deba[_0x1c1c('0x20c')],_0x37deba)[_0x1c1c('0x3d')](function(_0x2ebfb1){_0x37deba[_0x1c1c('0xc7')]-=_0xb19da7;_0x37deba['temp']=_0x37deba[_0x1c1c('0xc7')]>0x0?_0x37deba[_0x1c1c('0xc7')]:0x0;if(!checkContactEmpty(_0x2ebfb1)){_0x1b90df[_0x1c1c('0xb8')](_0x37deba)[_0x1c1c('0x3d')](sendMessageReschedule(_0x37deba))['catch'](loggerCatch(_0x1c1c('0xba')));}else{_0x37deba['originated']+=_0x2ebfb1[_0x1c1c('0x9a')];_0x37deba['message']=_0x37deba[_0x1c1c('0x5a')]===_0x1c1c('0xa')?'ACTIVE':_0x1c1c('0x20e');for(var _0x5a622e=0x0;_0x5a622e<_0x2ebfb1['length'];_0x5a622e+=0x1){if(_['isNil'](_0x2ebfb1[_0x5a622e])||_[_0x1c1c('0xb0')](_0x2ebfb1[_0x5a622e]['Contact'])||_['isNil'](_0x2ebfb1[_0x5a622e][_0x1c1c('0x174')]['phone'])){_0x1b90df[_0x1c1c('0x216')](_0x1c1c('0x20f'),_0x37deba,_0x2ebfb1[_0x5a622e]);}else{_0x1b90df[_0x1c1c('0xbb')](_[_0x1c1c('0xd5')](_0x2ebfb1[_0x5a622e],[_0x1c1c('0x101'),'Contact.phone']))[_0x1c1c('0x3d')](_0x1b90df[_0x1c1c('0x1f7')](_0x37deba,_0x2ebfb1[_0x5a622e]))[_0x1c1c('0xb9')](_0x1b90df[_0x1c1c('0x211')](_0x1c1c('0x20f'),_0x37deba));}}}})['catch'](loggerGetContactDialer(_0x1c1c('0x217'),_0x37deba,_0xb19da7));}};Dialer[_0x1c1c('0x1c')]['handlePredictive']=function(_0x2345af){if(_0x2345af[_0x1c1c('0x214')]>0x0){var _0x574103=_0x2345af['dialLimitQueue']-_0x2345af['originated']-_0x2345af['talking'];if(_0x574103>0x0){this[_0x1c1c('0x218')](_0x2345af);}else{loggerPredictiveCalls['info'](_0x1c1c('0x219'));}}else{this[_0x1c1c('0x218')](_0x2345af);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x17e988){var _0x149f24=this;var _0x26ce18=[];_0x17e988[_0x1c1c('0x71')]+=0x1;for(var _0x2c0875 in this[_0x1c1c('0x12c')]){if(typeof this[_0x1c1c('0x12c')][_0x2c0875]!=='undefined'){if(this[_0x1c1c('0x12c')][_0x2c0875][_0x1c1c('0xa7')]===_0x1c1c('0x215')&&this[_0x1c1c('0x12c')][_0x2c0875]['status']===_0x1c1c('0xdf')){_0x26ce18[_0x1c1c('0x12e')](this[_0x1c1c('0x12c')][_0x2c0875]['id']);}}}this[_0x1c1c('0xc6')](_0x17e988['id'],_0x26ce18,0x1,_0x17e988[_0x1c1c('0x20c')],_0x17e988)[_0x1c1c('0x3d')](function(_0x470630){if(!checkContactEmpty(_0x470630)){checkContactLowerLimitOriginate(_0x17e988,0x1,0x0);_0x149f24[_0x1c1c('0xb8')](_0x17e988)['then'](sendMessageReschedule(_0x17e988))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xba')));}else{_0x17e988[_0x1c1c('0x3f')]=_0x1c1c('0x20e');if(_['isNil'](_0x470630[0x0])||_[_0x1c1c('0xb0')](_0x470630[0x0][_0x1c1c('0x174')])||_['isNil'](_0x470630[0x0][_0x1c1c('0x174')][_0x1c1c('0x175')])){_0x149f24[_0x1c1c('0x216')](_0x1c1c('0x20f'),_0x17e988,_0x470630[0x0]);}else{_0x149f24[_0x1c1c('0xbb')](_[_0x1c1c('0xd5')](_0x470630[0x0],[_0x1c1c('0x101'),_0x1c1c('0x210')]))['then'](_0x149f24['checkContactBlack'](_0x17e988,_0x470630[0x0]))[_0x1c1c('0xb9')](_0x149f24[_0x1c1c('0x211')]('[actionOriginatePredictive]\x20',_0x17e988));}}})[_0x1c1c('0xb9')](loggerGetContactDialer(_0x1c1c('0x21a'),_0x17e988,0x1));emitVoiceQueueSummary(_0x17e988);};Dialer['prototype'][_0x1c1c('0x1ec')]=function(_0x354047,_0x59ffd8,_0x170960,_0x566a35,_0x41670b,_0x31be76){loggerPredictive['info'](_0x1c1c('0x21b'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21c'),_0x354047);loggerPredictive['info'](_0x1c1c('0x21d'),_0x59ffd8);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21e'),_0x170960);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21f'),_0x566a35);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x41670b);loggerPredictive['info'](_0x1c1c('0x84'));return new BPromise(function(_0x460e0f,_0x48b033){if(_0x354047<=0x0||isNaN(_0x354047)){return _0x48b033(msgResponse(_0x1c1c('0x220'),'Error','m\x20=\x20'+_0x354047));}if(_0x170960<=0x0||isNaN(_0x170960)){return _0x48b033(msgResponse(_0x1c1c('0x220'),_0x1c1c('0x48'),_0x1c1c('0x221')+_0x170960));}if(_0x566a35<=0x0||isNaN(_0x566a35)){return _0x48b033(msgResponse('[abandonmentRate]',_0x1c1c('0x48'),'p\x20=\x20'+_0x566a35));}if(_0x59ffd8<=0x0||isNaN(_0x59ffd8)){return _0x48b033(msgResponse(_0x1c1c('0x220'),'Error',_0x1c1c('0x222')+_0x59ffd8));}if(_0x41670b<=0x0||isNaN(_0x41670b)){return _0x48b033(msgResponse(_0x1c1c('0x220'),_0x1c1c('0x48'),_0x1c1c('0x223')+_0x41670b));}_0x31be76=_0x31be76||0x0;var _0x10a9a9=0x1/_0x170960;var _0x4da2da=0x0;var _0x36f6bf=0x0;var _0x278711=0x0;var _0x496f78=0x0;for(var _0x11c0e9=0x0;_0x278711<_0x41670b;_0x11c0e9+=0x1){_0x36f6bf=_0x11c0e9/_0x59ffd8;_0x4da2da=(_0x566a35*_0x36f6bf+_0x31be76)/_0x10a9a9;_0x278711=erlangb(_0x4da2da,_0x354047);_0x496f78=_0x4da2da/_0x354047*(0x1-erlangb(_0x4da2da,_0x354047));}return _0x460e0f({'erlangCalls':_0x11c0e9,'erlangCallToSecond':_0x59ffd8/_0x11c0e9,'erlangAbandonmentRate':_0x278711,'erlangBusyFactor':_0x496f78});});};Dialer['prototype'][_0x1c1c('0x1f4')]=function(_0x58338f,_0x369e21,_0x232352,_0x54c528,_0x38336a,_0x39ea1e){loggerPredictive[_0x1c1c('0x7e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21c'),_0x58338f);loggerPredictive['info'](_0x1c1c('0x21d'),_0x369e21);loggerPredictive['info'](_0x1c1c('0x21e'),_0x232352);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21f'),_0x54c528);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x224'),_0x38336a);loggerPredictive[_0x1c1c('0x7e')]('---------------------------');return new BPromise(function(_0x3f562,_0x536c32){if(_0x58338f<=0x0||isNaN(_0x58338f)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),'m\x20=\x20'+_0x58338f));}if(_0x232352<=0x0||isNaN(_0x232352)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x221')+_0x232352));}if(_0x54c528<=0x0||isNaN(_0x54c528)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x226')+_0x54c528));}if(_0x369e21<=0x0||isNaN(_0x369e21)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x222')+_0x369e21));}if(_0x38336a<=0x0||isNaN(_0x38336a)){return _0x536c32(msgResponse(_0x1c1c('0x225'),'Error',_0x1c1c('0x227')+_0x38336a));}_0x39ea1e=_0x39ea1e||0x0;var _0x43c715=0x1/_0x232352;var _0x5ad108=0x0;var _0x35108d=0x0;var _0x2d3904=0x0;var _0x437a47=0x0;for(var _0x4dd55f=0x0;_0x437a47<_0x38336a;_0x4dd55f+=0x1){_0x35108d=_0x4dd55f/_0x369e21;_0x5ad108=(_0x54c528*_0x35108d+_0x39ea1e)/_0x43c715;_0x2d3904=erlangb(_0x5ad108,_0x58338f);_0x437a47=_0x5ad108/_0x58338f*(0x1-erlangb(_0x5ad108,_0x58338f));}return _0x3f562({'erlangCalls':_0x4dd55f,'erlangCallToSecond':_0x369e21/_0x4dd55f,'erlangAbandonmentRate':_0x2d3904,'erlangBusyFactor':_0x437a47});});};module[_0x1c1c('0x228')]=Dialer; \ No newline at end of file +var _0x0acc=['XMD-','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','check\x20failure','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[handlePredictive][limitChannel]','tryOriginatePredictive','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\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]','interval\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','redis','localhost','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','message','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Interval','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','outbound','strategy','available','pTalking','sumBillable','sumDuration','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Avg\x20Talk\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','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','Action','status','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','prototype','resolve','countReScheduled','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueid','variable','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','outboundAnswerAgiCallsDay','emit','countdropretry','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','syncNewExten','channel','actionid','locked','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','run','[Catch][Preview][syncQueueStatusComplete]','_rr','paused','unlockRR','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','isArray','iftime\x20%s,%s','content','indexOf','true','command','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','handlePower','power','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0acc,0x9a));var _0xc0ac=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0x0acc[_0x5e8fc];return _0x41c58c;};'use strict';var util=require('util');var _=require(_0xc0ac('0x0'));var BPromise=require('bluebird');var uuid=require(_0xc0ac('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0xc0ac('0x2'));var Redis=require(_0xc0ac('0x3'));var ut=require(_0xc0ac('0x4'));var config=require(_0xc0ac('0x5'));var logger=require(_0xc0ac('0x6'))(_0xc0ac('0x7'));var loggerBooked=require(_0xc0ac('0x6'))(_0xc0ac('0x8'));var loggerPredictive=require(_0xc0ac('0x6'))(_0xc0ac('0x9'));var loggerPredictiveCalls=require(_0xc0ac('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xc0ac('0x6'))(_0xc0ac('0xa'));var ami=require('../ami');config[_0xc0ac('0xb')]=_['defaults'](config[_0xc0ac('0xb')],{'host':_0xc0ac('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc0ac('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xc0ac('0xd'));var voiceQueueRt=require(_0xc0ac('0xe'));var RpcSetting=require(_0xc0ac('0xf'));var Action=require(_0xc0ac('0x10'));var History=require(_0xc0ac('0x11'));var Final=require('./final');var AgentComplete=require(_0xc0ac('0x12'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xc0ac('0x13'));var ipAgi=process[_0xc0ac('0x14')][_0xc0ac('0x15')]||'127.0.0.1';var strategy={'rrmemory':_0xc0ac('0x16'),'roundrobin':_0xc0ac('0x17')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xc0ac('0x18')]=function(_0x5c46de){this[_0xc0ac('0x19')]=this[_0xc0ac('0x19')]?this['tail'][_0xc0ac('0x1a')](_0x5c46de):_0x5c46de();};function Dialer(_0x146c9f,_0x9152be){this['sequence']=new Sequence();this[_0xc0ac('0x1b')]=_0x9152be;this[_0xc0ac('0x1c')]=_0x146c9f[_0xc0ac('0x1c')];this[_0xc0ac('0x1d')]=_0x146c9f['campaigns'];this[_0xc0ac('0x1e')]=_0x146c9f[_0xc0ac('0x1e')];this[_0xc0ac('0x1f')]=_0x146c9f[_0xc0ac('0x1f')];this[_0xc0ac('0x20')]=config[_0xc0ac('0x20')]||0x2;this[_0xc0ac('0x21')]={};this[_0xc0ac('0x22')]={};this[_0xc0ac('0x23')]={};this[_0xc0ac('0x24')]={};this[_0xc0ac('0x25')]={};this[_0xc0ac('0x26')]={};this[_0xc0ac('0x27')]={};this[_0xc0ac('0x28')]={};this[_0xc0ac('0x29')]={};this[_0xc0ac('0x2a')]={};ami['on']('agentconnect',this[_0xc0ac('0x2b')][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x2d'),this[_0xc0ac('0x2e')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0xc0ac('0x2f'),this[_0xc0ac('0x30')][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x31'),this[_0xc0ac('0xa')]['bind'](this));ami['on'](_0xc0ac('0x32'),this[_0xc0ac('0x33')][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x34'),this['syncNewExten'][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x35'),this[_0xc0ac('0x36')][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x37'),this[_0xc0ac('0x38')][_0xc0ac('0x2c')](this));ami['on'](_0xc0ac('0x39'),this[_0xc0ac('0x3a')][_0xc0ac('0x2c')](this));this[_0xc0ac('0x3b')]();this[_0xc0ac('0x3c')]();RpcSetting[_0xc0ac('0x3d')]()[_0xc0ac('0x3e')](function(_0x1b9105){previewRecallmeReminderInterval=_0x1b9105[_0xc0ac('0x3f')];});}function isNotNull(_0x1d79db){return _0x1d79db!==null&&!_[_0xc0ac('0x40')](_0x1d79db);}function checkIsLoggedIn(_0x2f097e,_0x14148c){return function(){if(_0x14148c<=0x0){_0x2f097e['message']='AGENTS_NOT_LOGGED';throw _0x2f097e['name']+_0xc0ac('0x41');}};}function isActive(_0x365394){return _0x365394;}function checkIsActive(_0x3654f4,_0x4a4560){return function(){if(!isActive(_0x4a4560)){_0x3654f4[_0xc0ac('0x42')]='NOT_ACTIVE';throw _0x3654f4['name']+'\x20NOT\x20Active';}};}function checkInterval(_0xab4987){return function(){if(!isNotNull(_0xab4987['Interval'])){_0xab4987[_0xc0ac('0x42')]=_0xc0ac('0x43');throw _0xab4987[_0xc0ac('0x44')]+_0xc0ac('0x45');}if(!isNotNull(_0xab4987[_0xc0ac('0x46')]['Intervals'])){_0xab4987[_0xc0ac('0x42')]='INTERVAL_IS_NULL';throw _0xab4987['name']+_0xc0ac('0x45');}if(!isNotNull(_[_0xc0ac('0x47')](_0xab4987[_0xc0ac('0x46')][_0xc0ac('0x48')]))){_0xab4987[_0xc0ac('0x42')]=_0xc0ac('0x43');throw _0xab4987[_0xc0ac('0x44')]+_0xc0ac('0x45');}};}function msgResponse(_0x3ef462,_0x264ac4,_0x50ba33){return{'action':_0x3ef462,'response':_0x264ac4,'message':_0x50ba33,'stack':_0x50ba33};}function myreject(_0x21f9e0){return function(_0x5d4069){return _0x21f9e0(msgResponse(_0xc0ac('0x49'),_0xc0ac('0x4a'),JSON[_0xc0ac('0x4b')](_0x5d4069)));};}function getSeconds(_0x2c186b,_0x30bcaf){var _0xe212a8=moment(_0x2c186b)[_0xc0ac('0x4c')](0x0);var _0x5cc576=moment(_0x30bcaf)[_0xc0ac('0x4c')](0x0);return _0xe212a8[_0xc0ac('0x4d')](_0x5cc576,_0xc0ac('0x4e'));}function emit(_0x5786c4,_0x52ec53,_0x1b6437){io['to'](_0x5786c4)['emit'](_0x52ec53,_0x1b6437);}function emitVoiceQueueSummary(_0x1abb6e){if(_0x1abb6e['type']===_0xc0ac('0x4f')){var _0x29d77a={'id':_0x1abb6e['id'],'name':_0x1abb6e[_0xc0ac('0x44')],'strategy':_0x1abb6e[_0xc0ac('0x50')],'answered':_0x1abb6e['answered'],'available':_0x1abb6e[_0xc0ac('0x51')],'loggedIn':_0x1abb6e['loggedIn'],'pTalking':_0x1abb6e[_0xc0ac('0x52')],'sumBillable':_0x1abb6e[_0xc0ac('0x53')],'sumDuration':_0x1abb6e[_0xc0ac('0x54')],'sumHoldTime':_0x1abb6e['sumHoldTime']||0x0,'talking':_0x1abb6e['talking'],'total':_0x1abb6e[_0xc0ac('0x55')],'type':_0x1abb6e[_0xc0ac('0x56')],'unmanaged':_0x1abb6e[_0xc0ac('0x57')],'abandoned':_0x1abb6e[_0xc0ac('0x58')],'waiting':_0x1abb6e[_0xc0ac('0x59')],'loggedInDb':_0x1abb6e[_0xc0ac('0x5a')],'dialActive':_0x1abb6e[_0xc0ac('0x5b')],'dialMethod':_0x1abb6e[_0xc0ac('0x5c')],'dialOriginateCallerIdName':_0x1abb6e[_0xc0ac('0x5d')],'dialOriginateCallerIdNumber':_0x1abb6e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1abb6e[_0xc0ac('0x5e')],'dialPrefix':_0x1abb6e[_0xc0ac('0x5f')],'outboundAnswerAgiCallsDay':_0x1abb6e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1abb6e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1abb6e[_0xc0ac('0x60')],'outboundBusyCallsDay':_0x1abb6e['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1abb6e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1abb6e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1abb6e['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1abb6e[_0xc0ac('0x61')],'outboundNoAnswerCallsDay':_0x1abb6e[_0xc0ac('0x62')],'outboundNoSuchCallsDay':_0x1abb6e['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1abb6e[_0xc0ac('0x63')],'outboundReCallsDay':_0x1abb6e[_0xc0ac('0x64')],'outboundRejectCallsDay':_0x1abb6e[_0xc0ac('0x65')],'outboundUnknownCallsDay':_0x1abb6e[_0xc0ac('0x66')],'predictiveIntervalAnsweredCalls':_0x1abb6e[_0xc0ac('0x67')],'predictiveIntervalAvgHoldtime':_0x1abb6e[_0xc0ac('0x68')],'predictiveIntervalAvgTalktime':_0x1abb6e[_0xc0ac('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x1abb6e[_0xc0ac('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x1abb6e[_0xc0ac('0x6b')],'predictiveIntervalErlangCalls':_0x1abb6e[_0xc0ac('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x1abb6e[_0xc0ac('0x6d')],'predictiveIntervalHitRate':_0x1abb6e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1abb6e[_0xc0ac('0x6e')],'predictiveIntervalPauses':_0x1abb6e[_0xc0ac('0x6f')],'predictiveIntervalAvailable':_0x1abb6e['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1abb6e[_0xc0ac('0x70')],'message':_0x1abb6e[_0xc0ac('0x42')],'originated':_0x1abb6e[_0xc0ac('0x71')],'erlangCalls':_0x1abb6e['erlangCalls'],'erlangCallToSecond':_0x1abb6e[_0xc0ac('0x72')],'erlangAbandonmentRate':_0x1abb6e[_0xc0ac('0x73')],'erlangBusyFactor':_0x1abb6e[_0xc0ac('0x74')],'startPredictive':_0x1abb6e[_0xc0ac('0x26')],'startProgressive':_0x1abb6e[_0xc0ac('0x27')]};if(_0x1abb6e[_0xc0ac('0x75')]){_0x29d77a['Trunk']={'id':_0x1abb6e[_0xc0ac('0x75')]['id'],'name':_0x1abb6e['Trunk'][_0xc0ac('0x44')],'active':_0x1abb6e[_0xc0ac('0x75')][_0xc0ac('0x76')],'callerid':_0x1abb6e[_0xc0ac('0x75')][_0xc0ac('0x77')]};}if(_0x1abb6e[_0xc0ac('0x46')]){_0x29d77a['Interval']={'id':_0x1abb6e[_0xc0ac('0x46')]['id'],'name':_0x1abb6e[_0xc0ac('0x46')][_0xc0ac('0x44')]};}var _0x408fd5=md5(JSON[_0xc0ac('0x4b')](_0x29d77a));if(_0x1abb6e[_0xc0ac('0x2')]!==_0x408fd5){_0x1abb6e['md5']=_0x408fd5;emit(util[_0xc0ac('0x78')]('voice:queue:%s',_0x29d77a[_0xc0ac('0x44')]),'voice_queue:save',_0x29d77a);}}}function emitCampaignSummary(_0x5175ae){if(_0x5175ae[_0xc0ac('0x56')]==='ivr'){emit(util[_0xc0ac('0x78')](_0xc0ac('0x79'),_0x5175ae[_0xc0ac('0x44')]),_0xc0ac('0x7a'),_0x5175ae);}}function checkGetDataPredictive(_0x2cb3d2){if(isNotNull(_0x2cb3d2)&&!_[_0xc0ac('0x47')](_0x2cb3d2)){loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x7c'));loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x7d'),_0x2cb3d2[_0xc0ac('0x70')]);loggerPredictive[_0xc0ac('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2cb3d2['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xc0ac('0x7e'),_0x2cb3d2[_0xc0ac('0x6b')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x7f'),_0x2cb3d2[_0xc0ac('0x6a')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x80'),_0x2cb3d2[_0xc0ac('0x68')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x81'),_0x2cb3d2['predictiveIntervalAvgTalktime']);loggerPredictive[_0xc0ac('0x7b')]('---------------------------');if(_0x2cb3d2[_0xc0ac('0x70')]>0x0){if(!_['isUndefined'](_0x2cb3d2['predictiveIntervalAvgTalktime'])&&_0x2cb3d2[_0xc0ac('0x69')]>0x0){return!![];}loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x82'));if(!_[_0xc0ac('0x40')](_0x2cb3d2[_0xc0ac('0x68')])&&_0x2cb3d2[_0xc0ac('0x68')]>0x0){return!![];}loggerPredictive[_0xc0ac('0x7b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x83'));}}else{loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x84'));}return![];}function mergeDataErlangB(_0x85bb60){return function(_0x25c240){loggerPredictive[_0xc0ac('0x7b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x85'),_0x25c240[_0xc0ac('0x86')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x87'),_0x25c240[_0xc0ac('0x72')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x88'),_0x25c240[_0xc0ac('0x73')]);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x89'),_0x25c240[_0xc0ac('0x74')]);loggerPredictive['info'](_0xc0ac('0x88'),_0x25c240['erlangAbandonmentRate']);loggerPredictive['info'](_0xc0ac('0x8a'));_[_0xc0ac('0x8b')](_0x85bb60,_0x25c240);};}function getDiff(_0x3827d7){var _0x300ed9=moment()[_0xc0ac('0x4c')](0x0);var _0xd20706=moment(_0x3827d7)[_0xc0ac('0x4c')](0x0);return _0x300ed9[_0xc0ac('0x4d')](_0xd20706,_0xc0ac('0x4e'));}function ifInterval(_0x399f1a,_0x21a760){if(_[_0xc0ac('0x40')](_0x21a760)){return![];}return getDiff(_0x21a760)<_0x399f1a*0x3c;}function freeVariablesPredictive(_0x5d4eec){if(isNotNull(_0x5d4eec)){if(!_['isUndefined'](_0x5d4eec[_0xc0ac('0x27')])){_0x5d4eec[_0xc0ac('0x27')]=undefined;loggerPredictive[_0xc0ac('0x7b')](_0x5d4eec[_0xc0ac('0x44')],_0xc0ac('0x8c'));}if(!_[_0xc0ac('0x40')](_0x5d4eec[_0xc0ac('0x26')])){_0x5d4eec[_0xc0ac('0x26')]=undefined;loggerPredictive['info'](_0x5d4eec[_0xc0ac('0x44')],_0xc0ac('0x8d'));}if(!_[_0xc0ac('0x40')](_0x5d4eec['handlePredictive'])){clearInterval(_0x5d4eec[_0xc0ac('0x8e')]);_0x5d4eec[_0xc0ac('0x8e')]=undefined;loggerPredictive['info'](_0x5d4eec[_0xc0ac('0x44')],_0xc0ac('0x8f'));}}}function erlangb(_0x2cd446,_0x2fc7c7){if(_0x2fc7c7===0x0){return 0x0;}var _0x8aaba2=0x1;for(var _0x3f606c=0x1;_0x3f606c<=_0x2fc7c7;_0x3f606c+=0x1){_0x8aaba2=0x1+_0x8aaba2*_0x3f606c/_0x2cd446;}return 0x1/_0x8aaba2;}function isVoiceQueueOutbound(_0x47ee54){return _0x47ee54==='outbound';}function isNotPreview(_0x1c26e1){return _0x1c26e1!==_0xc0ac('0x1b');}function isCampaignIvr(_0x5ea3f0){return _0x5ea3f0===_0xc0ac('0x90');}function getCallerId(_0x4fdb39,_0x4afaeb,_0x3f78cb){if(!_['isUndefined'](_0x3f78cb)&&typeof _0x3f78cb===_0xc0ac('0x91')&&!_[_0xc0ac('0x47')](_0x3f78cb)){if(!_[_0xc0ac('0x40')](_0x4afaeb)&&typeof _0x4afaeb===_0xc0ac('0x91')&&!_['isEmpty'](_0x4afaeb)){return util[_0xc0ac('0x78')]('\x22%s\x22\x20<%s>',_0x4afaeb,_0x3f78cb);}return util[_0xc0ac('0x78')](_0xc0ac('0x92'),_0x3f78cb,_0x3f78cb);}if(!_[_0xc0ac('0x40')](_0x4fdb39)&&typeof _0x4fdb39===_0xc0ac('0x91')&&!_['isEmpty'](_0x4fdb39)){return _0x4fdb39;}return _0xc0ac('0x93');}function loggerCatchQueueSummary(_0x2db312,_0x1dc6a4){return function(_0x595a7c){freeVariablesPredictive(_0x1dc6a4);emitVoiceQueueSummary(_0x1dc6a4);emitCampaignSummary(_0x1dc6a4);loggerSyncQueueSummary['error'](_0x2db312,util[_0xc0ac('0x94')](_0x595a7c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x460328,_0x2d4c7f){return function(_0x4158e0){loggerPredictive[_0xc0ac('0x95')](_0x2d4c7f[_0xc0ac('0x44')],_0x460328);loggerPredictive[_0xc0ac('0x95')](_0x4158e0['stack']);freeVariablesPredictive(_0x2d4c7f);};}function loggerCatch(_0x188bb0){return function(_0x301b09){logger['error'](_0x188bb0,util[_0xc0ac('0x94')](_0x301b09,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x911699){return _0x911699&&!_[_0xc0ac('0x40')](_0x911699)&&_0x911699[_0xc0ac('0x96')]>0x0;}function decremetOriginate(_0x354f32){if(!_[_0xc0ac('0x40')](_0x354f32)&&_0x354f32!==null){if(typeof _0x354f32['originated']!==_0xc0ac('0x97')){if(_0x354f32[_0xc0ac('0x71')]>0x0){_0x354f32[_0xc0ac('0x71')]-=0x1;}else{logger['error'](_0xc0ac('0x98'));}}}else{logger[_0xc0ac('0x95')](_0xc0ac('0x99'));}}function checkContactLowerLimitOriginate(_0x47db69,_0x4e82a1,_0x1bbc3c){if(_0x4e82a1>_0x1bbc3c){for(var _0x367eee=0x0;_0x367eee<_0x4e82a1-_0x1bbc3c;_0x367eee+=0x1){decremetOriginate(_0x47db69);}}}function loggerGetContactDialer(_0x4ef6ff,_0x49d2cd,_0x199297){return function(_0xa04e11){checkContactLowerLimitOriginate(_0x49d2cd,_0x199297,0x0);logger['error'](_0x4ef6ff,util[_0xc0ac('0x94')](_0xa04e11,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5afff7){return function(_0x1221e5){if(isNotNull(_0x1221e5)&&isNotNull(_0x1221e5[0x0])){if(_0x1221e5[0x0][_0xc0ac('0x9a')]>0x0){_0x5afff7[_0xc0ac('0x42')]=_0xc0ac('0x9b');logger[_0xc0ac('0x7b')]('[getContactDialer2][ReScheduled]'+_0x5afff7['name'],_0x1221e5[0x0][_0xc0ac('0x9a')],_0xc0ac('0x9c'));}else{_0x5afff7['message']=_0xc0ac('0x9d');logger[_0xc0ac('0x7b')](_0xc0ac('0x9e')+_0x5afff7['name']);}}};}function notSendMessagesQueue(_0xd3a081){if(_0xd3a081[_0xc0ac('0x9f')]){freeVariablesPredictive(_0xd3a081);if(_0xd3a081['originated']===0x0&&_0xd3a081[_0xc0ac('0xa0')]===0x0&&_0xd3a081[_0xc0ac('0x59')]===0x0&&(_0xd3a081['pTalking']||0x0)===0x0){_0xd3a081[_0xc0ac('0x9f')]=![];_0xd3a081[_0xc0ac('0x51')]=0x0;_0xd3a081['message']=_0xc0ac('0xa1');loggerSyncQueueSummary[_0xc0ac('0x95')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xd3a081[_0xc0ac('0x44')],_0xc0ac('0xa2'));}else{_0xd3a081['message']=_0xc0ac('0xa3');loggerSyncQueueSummary[_0xc0ac('0x95')](_0xc0ac('0xa4'),_0xd3a081[_0xc0ac('0x44')],_0xc0ac('0xa5'));}emitVoiceQueueSummary(_0xd3a081);}}function notSendMessagesCampaign(_0x4a934b){if(_0x4a934b[_0xc0ac('0x9f')]){if(_0x4a934b[_0xc0ac('0x71')]===0x0){_0x4a934b[_0xc0ac('0x9f')]=![];_0x4a934b[_0xc0ac('0x42')]=_0xc0ac('0xa1');loggerSyncQueueSummary[_0xc0ac('0x95')](_0xc0ac('0xa6'),_0x4a934b['name'],'is\x20not\x20active');}else{_0x4a934b[_0xc0ac('0x42')]=_0xc0ac('0xa3');loggerSyncQueueSummary[_0xc0ac('0x95')](_0xc0ac('0xa6'),_0x4a934b[_0xc0ac('0x44')],_0xc0ac('0xa5'));}emitCampaignSummary(_0x4a934b);}}function createObjHistory(_0x5f3311,_0x2f6833,_0x4b3e03,_0x3d641c,_0x499285){_0x5f3311['message']=_0x4b3e03;var _0x56961a=new Action(_0x5f3311,_0x2f6833);var _0x405612=new History(_0x56961a);_0x405612[_0xc0ac('0xa7')]=_0x3d641c;_0x405612[_0xc0ac('0xa8')]=_0x499285;_0x405612[_0xc0ac('0xa9')]=_0x56961a[_0xc0ac('0xaa')];return _0x405612;}Dialer['prototype'][_0xc0ac('0x3c')]=function(){var _0x5da57a=this;setInterval(function(){_0x5da57a[_0xc0ac('0xab')](_0x5da57a[_0xc0ac('0x24')],_0xc0ac('0xac'));_0x5da57a['clearZombieChannels'](_0x5da57a[_0xc0ac('0x22')],_0xc0ac('0xad'));},0x32c8);};Dialer['prototype'][_0xc0ac('0xab')]=function(_0x30c165,_0x46c7f0){var _0x1d5e03=this;for(var _0x5f4228 in _0x30c165){if(typeof _0x30c165[_0x5f4228]!=='undefined'){this[_0xc0ac('0xae')][_0xc0ac('0x18')](function(){if(!_[_0xc0ac('0xaf')](_0x30c165[_0x5f4228])){return ami[_0xc0ac('0xb0')]({'action':_0xc0ac('0xb1'),'channel':_0x30c165[_0x5f4228]['channel']})['catch'](function(_0x25d770){if(_0x25d770[_0xc0ac('0x42')]===_0xc0ac('0xb2')){setTimeout(function(){if(_0x30c165[_0x5f4228]&&_0x30c165[_0x5f4228][_0xc0ac('0x56')]!==_0xc0ac('0x90')){_0x1d5e03[_0xc0ac('0xb3')](_0x1d5e03[_0xc0ac('0x1c')][_0x30c165[_0x5f4228][_0xc0ac('0xb4')]]);logger[_0xc0ac('0x95')](_0xc0ac('0xb5'),_0x46c7f0,_0x5f4228,_0x30c165[_0x5f4228][_0xc0ac('0xb4')]);delete _0x30c165[_0x5f4228];}if(_0x30c165[_0x5f4228]&&_0x30c165[_0x5f4228][_0xc0ac('0x56')]===_0xc0ac('0x90')){_0x1d5e03[_0xc0ac('0xb3')](_0x1d5e03[_0xc0ac('0x1d')][_0x30c165[_0x5f4228]['queue']]);logger[_0xc0ac('0x95')](_0xc0ac('0xb6'),_0x46c7f0,_0x5f4228,_0x30c165[_0x5f4228][_0xc0ac('0xb4')]);delete _0x30c165[_0x5f4228];}},0x2328);}});}});}}};Dialer[_0xc0ac('0xb7')]['countReScheduled']=function(_0x482fbb){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xb9')](_0x482fbb))[_0xc0ac('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xbb')]=function(_0x4bbc7e){return BPromise[_0xc0ac('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4bbc7e))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xbc')));};Dialer[_0xc0ac('0xb7')]['checkIsBlackListIvr']=function(_0x1fd49b){return BPromise[_0xc0ac('0xb8')]()['then'](cmHopperBlack[_0xc0ac('0xbd')](_0x1fd49b))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xbe')));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xbf')]=function(_0xd8a167){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopperHistory[_0xc0ac('0xc0')](_0xd8a167))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xc1')]=function(_0x304b18){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xc1')](_0x304b18))[_0xc0ac('0xba')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xc2')]=function(_0x1e59da,_0x45db59,_0x251eb0){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xc2')](_0x1e59da,_0x45db59,_0x251eb0))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xc3')));};Dialer['prototype'][_0xc0ac('0xc4')]=function(_0x1cda93,_0x459011,_0x133e8a,_0x476bf1,_0x28dcf5){return BPromise['resolve']()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xc4')](_0x1cda93,_0x459011,_0x133e8a,_0x476bf1))[_0xc0ac('0xba')](function(_0x154e6c){_0x28dcf5[_0xc0ac('0xc5')]-=_0x133e8a;_0x28dcf5[_0xc0ac('0xc5')]=_0x28dcf5[_0xc0ac('0xc5')]>0x0?_0x28dcf5[_0xc0ac('0xc5')]:0x0;loggerCatch(_0xc0ac('0xc6'))(_0x154e6c);});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xc7')]=function(_0x2beb18,_0x2f2821,_0x1e3b6e,_0x40e29f){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xc7')](_0x2beb18,_0x2f2821,_0x1e3b6e))[_0xc0ac('0xba')](function(_0x27641e){_0x40e29f[_0xc0ac('0xc5')]-=_0x2f2821;_0x40e29f[_0xc0ac('0xc5')]=_0x40e29f['temp']>0x0?_0x40e29f[_0xc0ac('0xc5')]:0x0;loggerCatch(_0xc0ac('0xc8'))(_0x27641e);});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xc9')]=function(_0x4250b0){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](voiceQueueRt[_0xc0ac('0xc9')](_0x4250b0))['catch'](loggerCatch(_0xc0ac('0xca')));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xcb')]=function(_0x185f08){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0xcb')](_0x185f08))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xcc')));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xcd')]=function(_0x3d1020){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopperHistory[_0xc0ac('0xcd')](_0x3d1020))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xce')));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xb3')]=function(_0x1960e7){if(!_[_0xc0ac('0x40')](_0x1960e7)&&_0x1960e7!==null){if(typeof _0x1960e7[_0xc0ac('0x71')]!==_0xc0ac('0x97')){if(_0x1960e7[_0xc0ac('0x71')]>0x0){_0x1960e7[_0xc0ac('0x71')]-=0x1;}else{logger[_0xc0ac('0x95')](_0xc0ac('0xcf'));}}}else{logger['error'](_0xc0ac('0xd0'));}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xd1')]=function(_0x32cddd,_0x28b980){var _0x5aaf23=this;return function(_0x510f86){_0x5aaf23[_0xc0ac('0xb3')](_0x28b980);logger['error'](_0x32cddd,util[_0xc0ac('0x94')](_0x510f86,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x33480a,_0x103877,_0x4f8208){var _0x45db08={'state':0x19,'statedesc':_0xc0ac('0xd2')};this['updateOriginated'](_0x103877);this[_0xc0ac('0xd3')](_[_0xc0ac('0x8b')](_0x45db08,_['pick'](_0x4f8208,[_0xc0ac('0xd4'),_0xc0ac('0xd5'),_0xc0ac('0xd6'),_0xc0ac('0xd7'),_0xc0ac('0xd8')])),_0xc0ac('0xd9'),_0xc0ac('0xda'));logger[_0xc0ac('0x95')](_0x33480a);};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xdb')]=function(_0x14971d){return _0x14971d===_0xc0ac('0xdc');};Dialer['prototype'][_0xc0ac('0xdd')]=function(_0x3fe1be){return!_[_0xc0ac('0x40')](_0x3fe1be)&&_0x3fe1be&&!_[_0xc0ac('0x40')](_0x3fe1be['name'])&&!_[_0xc0ac('0x40')](_0x3fe1be[_0xc0ac('0x76')])&&_0x3fe1be[_0xc0ac('0x76')]&&(this['trunks'][util['format']('SIP/%s',_0x3fe1be['name'])]['status']===_0xc0ac('0xde')||this['trunks'][util['format'](_0xc0ac('0xdf'),_0x3fe1be[_0xc0ac('0x44')])][_0xc0ac('0xb1')]===_0xc0ac('0xe0'));};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xd3')]=function(_0x4d9765,_0x4764a2,_0x2ba192){this[_0xc0ac('0xcd')](_0x4d9765)[_0xc0ac('0xba')](loggerCatch(_0x4764a2));this['moveContactManagedDialer'](_0x4d9765)[_0xc0ac('0xba')](loggerCatch(_0x2ba192));};Dialer['prototype'][_0xc0ac('0x36')]=function(_0x437805){var _0xad4c2f=this[_0xc0ac('0x24')][_0x437805[_0xc0ac('0xe1')]];var _0x4e9197;if(!_['isNil'](_0x437805)&&!_[_0xc0ac('0xaf')](_0x437805[_0xc0ac('0xe2')])&&!_[_0xc0ac('0xaf')](_0x437805['variable']['amdstatus'])&&_0x437805['exten']===_0xc0ac('0xe3')&&_0xad4c2f){if(_0xad4c2f[_0xc0ac('0x56')]!==_0xc0ac('0x90')&&this[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]][_0xc0ac('0xe4')]&&_0x437805[_0xc0ac('0xe5')]===_0xc0ac('0xe6')){delete this['uniqueId'][_0x437805[_0xc0ac('0xe1')]];this['updateOriginated'](this[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]]);this[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]][_0xc0ac('0xe7')]+=0x1;this[_0xc0ac('0x1c')][_0xad4c2f['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4e9197=new Hangup(_0xad4c2f,_0x437805);_0x4e9197[_0xc0ac('0xa7')]=0x12;_0x4e9197[_0xc0ac('0xa8')]='HangupInAMD';_0x4e9197[_0xc0ac('0xe8')]='AMD';ami['emit'](_0xc0ac('0xe9'),ut[_0xc0ac('0xea')](_0x4e9197,_0xc0ac('0xeb')));this[_0xc0ac('0xd3')](_0x4e9197,_0xc0ac('0xec'),'[syncHangupInAMD]');}if(_0xad4c2f[_0xc0ac('0x56')]!==_0xc0ac('0x90')&&this[_0xc0ac('0x1c')][_0xad4c2f['queue']]['dialAMDActive']&&_0x437805['value']===_0xc0ac('0xed')){var _0x4a21fd=this;return new BPromise(function(_0x4f71b9,_0x3ef0ad){delete _0x4a21fd[_0xc0ac('0x24')][_0x437805[_0xc0ac('0xe1')]];_0x4a21fd['updateOriginated'](_0x4a21fd[_0xc0ac('0x1c')][_0xad4c2f['queue']]);_0x4a21fd[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x4a21fd[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x291bcc=_0x4a21fd[_0xc0ac('0x1c')][_0xad4c2f[_0xc0ac('0xb4')]];var _0x21ecf0=new Hangup(_0xad4c2f,_0x437805);_0x21ecf0[_0xc0ac('0xa7')]=0x13;_0x21ecf0[_0xc0ac('0xa8')]=_0xc0ac('0xee');_0x21ecf0[_0xc0ac('0xe8')]=_0xc0ac('0xef');_0x21ecf0[_0xc0ac('0xf0')]+=0x1;_0x21ecf0[_0xc0ac('0xf1')]+=0x1;_0x21ecf0[_0xc0ac('0xeb')]=!![];ami['emit'](_0xc0ac('0xe9'),ut[_0xc0ac('0xea')](_0x21ecf0,_0xc0ac('0xeb')));_0x4a21fd[_0xc0ac('0xcd')](_0x21ecf0)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xf2')));if(_0x21ecf0[_0xc0ac('0xf3')]+_0x21ecf0[_0xc0ac('0xf4')]+_0x21ecf0[_0xc0ac('0xf5')]+_0x21ecf0[_0xc0ac('0xf6')]+_0x21ecf0['countdropretry']+_0x21ecf0[_0xc0ac('0xf7')]+_0x21ecf0['countmachineretry']+_0x21ecf0[_0xc0ac('0xf8')]>=_0x291bcc[_0xc0ac('0xf9')]){_0x4a21fd[_0xc0ac('0xfa')](_0x21ecf0,_0x4f71b9,_0x3ef0ad,'reason19\x20machine....');}else{if(_0x21ecf0[_0xc0ac('0xf0')]>=_0x291bcc['dialMachineMaxRetry']){_0x4a21fd[_0xc0ac('0xfb')](_0x21ecf0,_0x4f71b9,_0x3ef0ad,'reason\x2019\x20machine....');}else{_0x4a21fd[_0xc0ac('0xc1')]({'active':![],'countmachineretry':_0x21ecf0[_0xc0ac('0xf0')],'scheduledat':moment()[_0xc0ac('0xfc')](_0x291bcc['dialMachineRetryFrequency'],'minutes')['format'](_0xc0ac('0xfd')),'ContactId':_0x21ecf0['ContactId'],'ListId':_0x21ecf0[_0xc0ac('0xd5')],'VoiceQueueId':_0x21ecf0[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x21ecf0['CampaignId']||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xfe')));_0x4f71b9({'reschedule':0x1});}}});}if(_0xad4c2f[_0xc0ac('0x56')]===_0xc0ac('0x90')&&this['campaigns'][_0xad4c2f[_0xc0ac('0xb4')]]['dialAMDActive']&&_0x437805[_0xc0ac('0xe5')]==='HANGUP'){delete this[_0xc0ac('0x24')][_0x437805[_0xc0ac('0xe1')]];this['updateOriginated'](this[_0xc0ac('0x1d')][_0xad4c2f['queue']]);_0x4e9197=new Hangup(_0xad4c2f,_0x437805);_0x4e9197[_0xc0ac('0xa7')]=0x12;_0x4e9197['statedesc']=_0xc0ac('0xff');_0x4e9197[_0xc0ac('0xe8')]=_0xc0ac('0xef');ami['emit'](_0xc0ac('0xe9'),ut['buildObj'](_0x4e9197,_0xc0ac('0xeb')));this[_0xc0ac('0xd3')](_0x4e9197,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0xad4c2f[_0xc0ac('0x56')]==='ivr'&&this[_0xc0ac('0x1d')][_0xad4c2f['queue']][_0xc0ac('0xe4')]&&_0x437805[_0xc0ac('0xe5')]===_0xc0ac('0xed')){var _0x4a21fd=this;return new BPromise(function(_0x66d958,_0xe3eb56){delete _0x4a21fd[_0xc0ac('0x24')][_0x437805[_0xc0ac('0xe1')]];_0x4a21fd['updateOriginated'](_0x4a21fd[_0xc0ac('0x1d')][_0xad4c2f[_0xc0ac('0xb4')]]);_0x4a21fd['campaigns'][_0xad4c2f[_0xc0ac('0xb4')]][_0xc0ac('0xe7')]+=0x1;_0x4a21fd[_0xc0ac('0x1d')][_0xad4c2f['queue']][_0xc0ac('0x100')]+=0x1;var _0x387947=_0x4a21fd[_0xc0ac('0x1d')][_0xad4c2f['queue']];var _0x51c1df=new Hangup(_0xad4c2f,_0x437805);_0x51c1df['state']=0x13;_0x51c1df['statedesc']=_0xc0ac('0xee');_0x51c1df[_0xc0ac('0xe8')]=_0xc0ac('0xef');_0x51c1df['countmachineretry']+=0x1;_0x51c1df[_0xc0ac('0xf1')]+=0x1;_0x51c1df['amd']=!![];ami[_0xc0ac('0x101')]('custom:amd',ut[_0xc0ac('0xea')](_0x51c1df,_0xc0ac('0xeb')));_0x4a21fd['createHistory'](_0x51c1df)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xf2')));if(_0x51c1df[_0xc0ac('0xf3')]+_0x51c1df[_0xc0ac('0xf4')]+_0x51c1df[_0xc0ac('0xf5')]+_0x51c1df[_0xc0ac('0xf6')]+_0x51c1df[_0xc0ac('0x102')]+_0x51c1df[_0xc0ac('0xf7')]+_0x51c1df[_0xc0ac('0xf0')]+_0x51c1df[_0xc0ac('0xf8')]>=_0x387947[_0xc0ac('0xf9')]){_0x4a21fd[_0xc0ac('0xfa')](_0x51c1df,_0x66d958,_0xe3eb56,_0xc0ac('0x103'));}else{if(_0x51c1df[_0xc0ac('0xf0')]>=_0x387947[_0xc0ac('0x104')]){_0x4a21fd[_0xc0ac('0xfb')](_0x51c1df,_0x66d958,_0xe3eb56,'reason\x2019\x20machine....');}else{_0x4a21fd[_0xc0ac('0xc1')]({'active':![],'countmachineretry':_0x51c1df['countmachineretry'],'scheduledat':moment()[_0xc0ac('0xfc')](_0x387947[_0xc0ac('0x105')],_0xc0ac('0x106'))[_0xc0ac('0x78')](_0xc0ac('0xfd')),'ContactId':_0x51c1df[_0xc0ac('0xd4')],'ListId':_0x51c1df[_0xc0ac('0xd5')],'VoiceQueueId':_0x51c1df[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x51c1df[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0x66d958({'reschedule':0x1});}}});}}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x33')]=function(_0x3b7165){var _0x7b2e1=this['uniqueId'][_0x3b7165[_0xc0ac('0xe1')]];var _0x10f165=this;var _0x3b36ce;if(_0x7b2e1&&_0x7b2e1[_0xc0ac('0x56')]==='ivr'){delete this['uniqueId'][_0x3b7165[_0xc0ac('0xe1')]];this['updateOriginated'](this['campaigns'][_0x7b2e1[_0xc0ac('0xb4')]]);this[_0xc0ac('0x1d')][_0x7b2e1[_0xc0ac('0xb4')]][_0xc0ac('0x107')]+=0x1;_0x3b36ce=new Hangup(_0x7b2e1,_0x3b7165);this[_0xc0ac('0xcd')](_0x3b36ce)[_0xc0ac('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x3b36ce)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x108')));}if(_0x7b2e1&&_0x7b2e1[_0xc0ac('0x56')]!=='ivr'&&isNotNull(this[_0xc0ac('0x1c')][_0x7b2e1[_0xc0ac('0xb4')]]['dialQueueProject'])){delete this[_0xc0ac('0x24')][_0x3b7165[_0xc0ac('0xe1')]];this['updateOriginated'](this[_0xc0ac('0x1c')][_0x7b2e1[_0xc0ac('0xb4')]]);this[_0xc0ac('0x1c')][_0x7b2e1[_0xc0ac('0xb4')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x7b2e1['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x3b36ce=new Hangup(_0x7b2e1,_0x3b7165);_0x3b36ce[_0xc0ac('0xa7')]=0x10;_0x3b36ce[_0xc0ac('0xa8')]=_0xc0ac('0x109');_0x3b36ce['membername']=_0xc0ac('0x10a');this['createHistory'](_0x3b36ce)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x10b')));this['moveContactManagedDialer'](_0x3b36ce)['catch'](loggerCatch(_0xc0ac('0x108')));}if(_0x7b2e1&&_0x7b2e1[_0xc0ac('0x56')]!==_0xc0ac('0x90')&&!isNotNull(this[_0xc0ac('0x1c')][_0x7b2e1[_0xc0ac('0xb4')]]['dialQueueProject'])){delete this['uniqueId'][_0x3b7165[_0xc0ac('0xe1')]];this[_0xc0ac('0xb3')](this[_0xc0ac('0x1c')][_0x7b2e1[_0xc0ac('0xb4')]]);this['voiceQueues'][_0x7b2e1[_0xc0ac('0xb4')]][_0xc0ac('0x66')]+=0x1;_0x3b36ce=new Hangup(_0x7b2e1,_0x3b7165);_0x3b36ce[_0xc0ac('0xa7')]=0xc;_0x3b36ce[_0xc0ac('0xa8')]=_0x3b7165[_0xc0ac('0x10c')];_0x3b36ce[_0xc0ac('0xe8')]=_0xc0ac('0x10d');this['createHistory'](_0x3b36ce)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xc0ac('0xcb')](_0x3b36ce)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x108')));}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x30')]=function(_0x21beed){var _0x23540f=this[_0xc0ac('0x24')][_0x21beed[_0xc0ac('0xe1')]];var _0x3f2898=this;if(this[_0xc0ac('0x1c')][_0x21beed[_0xc0ac('0xb4')]]){if(_0x23540f&&_0x23540f['type']!==_0xc0ac('0x90')){delete this[_0xc0ac('0x24')][_0x21beed['uniqueid']];this[_0xc0ac('0x1c')][_0x21beed['queue']]['outboundAnswerCallsDay']+=0x1;var _0x152c6a=new AgentComplete(_0x23540f,_0x21beed);if(_0x21beed[_0xc0ac('0x10e')]===_0xc0ac('0x10f')){_0x152c6a[_0xc0ac('0x110')]=this[_0xc0ac('0x1c')][_0x21beed[_0xc0ac('0xb4')]][_0xc0ac('0x111')]&&this[_0xc0ac('0x1c')][_0x21beed[_0xc0ac('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0xc0ac('0x78')](_0xc0ac('0xfd')):undefined;}this['createHistory'](_0x152c6a)['catch'](loggerCatch(_0xc0ac('0x112')));this[_0xc0ac('0xcb')](_0x152c6a)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x113')));}}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x2b')]=function(_0x5a3b52){if(this['voiceQueues'][_0x5a3b52[_0xc0ac('0xb4')]]){if(this[_0xc0ac('0x24')][_0x5a3b52['uniqueid']]&&this[_0xc0ac('0x24')][_0x5a3b52[_0xc0ac('0xe1')]][_0xc0ac('0x56')]!==_0xc0ac('0x90')){this[_0xc0ac('0xb3')](this[_0xc0ac('0x1c')][_0x5a3b52[_0xc0ac('0xb4')]]);this['uniqueId'][_0x5a3b52[_0xc0ac('0xe1')]][_0xc0ac('0x114')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));}}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x115')]=function(_0x3c3a4b){this[_0xc0ac('0xcd')](_0x3c3a4b)[_0xc0ac('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xc0ac('0xcb')](_0x3c3a4b)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x116')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x44a3cf){var _0x15707e=this[_0xc0ac('0x24')][_0x44a3cf[_0xc0ac('0xe1')]];var _0xd91a36=this;if(this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]]){if(_0x15707e&&_0x15707e['type']!==_0xc0ac('0x90')){delete this[_0xc0ac('0x24')][_0x44a3cf[_0xc0ac('0xe1')]];this[_0xc0ac('0xb3')](this[_0xc0ac('0x1c')][_0x44a3cf['queue']]);_0x15707e[_0xc0ac('0x117')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));var _0x3303bf=new QueueCallerAbandon(_0x15707e,_0x44a3cf);if(getSeconds(_0x15707e['droptime'],_0x15707e['responsetime'])>=_0x15707e[_0xc0ac('0x118')]){this['voiceQueues'][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x6b')]+=0x1;this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x61')]+=0x1;this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x6d')]+=0x1;_0x3303bf[_0xc0ac('0xa7')]=0xa;_0x3303bf['statedesc']=_0xc0ac('0x119');_0x3303bf[_0xc0ac('0x11a')]='TIMEOUT';_0x3303bf[_0xc0ac('0x110')]=this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x111')]?moment()[_0xc0ac('0x78')](_0xc0ac('0xfd')):undefined;_0x3303bf['countdropretry']+=0x1;_0x3303bf[_0xc0ac('0xf1')]+=0x1;if(_0x3303bf['countdropretry']>=this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x11b')]){this[_0xc0ac('0x115')](_0x3303bf);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x3303bf[_0xc0ac('0x102')],'scheduledat':moment()[_0xc0ac('0xfc')](this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x11c')],_0xc0ac('0x106'))[_0xc0ac('0x78')](_0xc0ac('0xfd')),'ContactId':_0x15707e['ContactId'],'ListId':_0x15707e[_0xc0ac('0xd5')],'VoiceQueueId':_0x15707e['VoiceQueueId']||undefined,'CampaignId':_0x15707e[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x11d')));var _0x3156b1=new History(_0x3303bf);_0x3156b1['state']=0xa;_0x3156b1['statedesc']='Drop';_0x3156b1[_0xc0ac('0xaa')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));_0x3156b1[_0xc0ac('0xa9')]=_0x3156b1[_0xc0ac('0xaa')];_0x3156b1[_0xc0ac('0x11e')]=_0x3303bf[_0xc0ac('0x11e')];_0x3156b1[_0xc0ac('0x11f')]=_0x3303bf[_0xc0ac('0x11f')];this[_0xc0ac('0xcd')](_0x3156b1)['catch'](loggerCatch(_0xc0ac('0x120')));}}else{this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x6a')]+=0x1;this[_0xc0ac('0x1c')][_0x44a3cf['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x3303bf['state']=0xb;_0x3303bf[_0xc0ac('0xa8')]='Abandoned';_0x3303bf[_0xc0ac('0x11a')]='CALLEREXIT';_0x3303bf[_0xc0ac('0xf7')]+=0x1;_0x3303bf[_0xc0ac('0xf1')]+=0x1;if(_0x3303bf[_0xc0ac('0xf7')]>=this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x121')]){this[_0xc0ac('0x115')](_0x3303bf);}else{this[_0xc0ac('0xc1')]({'active':![],'countabandonedretry':_0x3303bf[_0xc0ac('0xf7')],'scheduledat':moment()['add'](this[_0xc0ac('0x1c')][_0x44a3cf[_0xc0ac('0xb4')]][_0xc0ac('0x122')],_0xc0ac('0x106'))[_0xc0ac('0x78')](_0xc0ac('0xfd')),'ContactId':_0x15707e[_0xc0ac('0xd4')],'ListId':_0x15707e[_0xc0ac('0xd5')],'VoiceQueueId':_0x15707e['VoiceQueueId']||undefined,'CampaignId':_0x15707e[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x123')));var _0x3156b1=new History(_0x3303bf);_0x3156b1['state']=0xb;_0x3156b1[_0xc0ac('0xa8')]=_0xc0ac('0x124');_0x3156b1['starttime']=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));_0x3156b1[_0xc0ac('0xa9')]=_0x3156b1[_0xc0ac('0xaa')];_0x3156b1[_0xc0ac('0x11e')]=_0x3303bf[_0xc0ac('0x11e')];_0x3156b1['calleridnum']=_0x3303bf[_0xc0ac('0x11f')];this[_0xc0ac('0xcd')](_0x3156b1)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x125')]=function(_0x563aad){if(this[_0xc0ac('0x22')][_0x563aad[_0xc0ac('0xe1')]]){this[_0xc0ac('0x22')][_0x563aad[_0xc0ac('0xe1')]][_0xc0ac('0x126')]=_0x563aad['channel'];}if(this['uniqueId'][_0x563aad['uniqueid']]){this[_0xc0ac('0x24')][_0x563aad[_0xc0ac('0xe1')]][_0xc0ac('0x126')]=_0x563aad[_0xc0ac('0x126')];}};Dialer[_0xc0ac('0xb7')]['syncQueueMember']=function(_0x44aeb6){if(strategy[this[_0xc0ac('0x1c')][this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]]['queue']][_0xc0ac('0x50')]]===_0xc0ac('0x17')){if(this[_0xc0ac('0x22')][_0x44aeb6['actionid']]&&_['isNil'](this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]][_0xc0ac('0x128')])&&_0x44aeb6[_0xc0ac('0xb1')]==='1'&&_0x44aeb6['paused']==='0'){if(this[_0xc0ac('0x1e')][_0x44aeb6[_0xc0ac('0x129')]]){if(!this[_0xc0ac('0x1e')][_0x44aeb6[_0xc0ac('0x129')]][_0xc0ac('0x128')]){this['agents'][_0x44aeb6[_0xc0ac('0x129')]][_0xc0ac('0x128')]=!![];this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]][_0xc0ac('0x128')]=!![];this[_0xc0ac('0x22')][_0x44aeb6['actionid']]['stateinterface']=_0x44aeb6[_0xc0ac('0x129')];}}}}else if((strategy[this[_0xc0ac('0x1c')][this['actions'][_0x44aeb6['actionid']][_0xc0ac('0xb4')]]['strategy']]||_0xc0ac('0x16'))===_0xc0ac('0x16')){if(this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]]){if(this[_0xc0ac('0x1e')][_0x44aeb6['stateinterface']]){this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]][_0xc0ac('0x129')]=_0x44aeb6[_0xc0ac('0x129')];if(_['isNil'](this[_0xc0ac('0x29')][this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]]['queue']])){this['queueBooked'][this['actions'][_0x44aeb6[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]=[];}this['queueBooked'][this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]][_0xc0ac('0xb4')]][_0xc0ac('0x12a')](_[_0xc0ac('0x8b')](_['pick'](this[_0xc0ac('0x22')][_0x44aeb6[_0xc0ac('0x127')]],[_0xc0ac('0x12b'),'stateinterface']),{'status':_0x44aeb6[_0xc0ac('0xb1')],'paused':_0x44aeb6['paused']}));}}}};function unlockQueueStatus(_0x231fc1,_0x2c23c8){setTimeout(function(){if(_[_0xc0ac('0x40')](_0x231fc1[_0xc0ac('0x12c')])){loggerBooked[_0xc0ac('0x95')](_0xc0ac('0x12d'),_0x2c23c8);}_0x231fc1[_0xc0ac('0x12c')]=!![];loggerBooked[_0xc0ac('0x7b')](_0xc0ac('0x12e'),_0x2c23c8,JSON['stringify'](_[_0xc0ac('0x12f')](_0x231fc1,[_0xc0ac('0x44'),_0xc0ac('0x12c')])));},0x1f3);}Dialer[_0xc0ac('0xb7')][_0xc0ac('0x3a')]=function(_0x588f11){var _0x2ea552=this;var _0x5c07d2=_0x2ea552[_0xc0ac('0x1c')][_0x2ea552[_0xc0ac('0x22')][_0x588f11['actionid']][_0xc0ac('0xb4')]];if(strategy[this[_0xc0ac('0x1c')][this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]][_0xc0ac('0x50')]]==='roundrobin'){if(this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]]&&this['actions'][_0x588f11[_0xc0ac('0x127')]]['stateinterface']){this[_0xc0ac('0x1b')][_0xc0ac('0x130')](this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0x12b')],this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0x129')])['catch'](function(_0x18ea5e){logger[_0xc0ac('0x95')](_0xc0ac('0x131'),util[_0xc0ac('0x94')](_0x18ea5e,{'showHidden':![],'depth':null}));})[_0xc0ac('0x1a')](function(){_0x2ea552[_0xc0ac('0xb3')](_0x2ea552[_0xc0ac('0x1c')][_0x2ea552[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]);_0x2ea552[_0xc0ac('0x1e')][_0x2ea552[_0xc0ac('0x22')][_0x588f11['actionid']][_0xc0ac('0x129')]]['locked']=![];delete _0x2ea552[_0xc0ac('0x22')][_0x588f11['actionid']];unlockQueueStatus(_0x5c07d2);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]);this[_0xc0ac('0xc1')]({'active':![],'ContactId':this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xd4')],'ListId':this['actions'][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xd5')],'VoiceQueueId':this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc0ac('0x22')][_0x588f11['actionid']];unlockQueueStatus(_0x5c07d2);}}else if((strategy[this[_0xc0ac('0x1c')][this['actions'][_0x588f11[_0xc0ac('0x127')]]['queue']][_0xc0ac('0x50')]]||_0xc0ac('0x16'))===_0xc0ac('0x16')){var _0x54d52d;if(this['actions'][_0x588f11[_0xc0ac('0x127')]]&&!_['isEmpty'](this[_0xc0ac('0x29')][this['actions'][_0x588f11[_0xc0ac('0x127')]]['queue']])){if(this[_0xc0ac('0x2a')][_0x2ea552[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]]['queue']]){this[_0xc0ac('0x2a')][_0x2ea552['actions'][_0x588f11[_0xc0ac('0x127')]]['queue']]=this[_0xc0ac('0x2a')][this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]?this[_0xc0ac('0x2a')][this['actions'][_0x588f11[_0xc0ac('0x127')]]['queue']]:this['queueBooked'][this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]?this[_0xc0ac('0x29')][this[_0xc0ac('0x22')][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]]['_rr']||0x0:0x0;}this['queueBooked'][this['actions'][_0x588f11[_0xc0ac('0x127')]][_0xc0ac('0xb4')]][_0xc0ac('0x132')]=this[_0xc0ac('0x2a')][this[_0xc0ac('0x22')][_0x588f11['actionid']][_0xc0ac('0xb4')]];for(var _0x28b29e=0x0;_0x28b29e=0x0;})['catch'](myreject(_0x54d7f4)));}}else{_0x4eeae3['push'](ami['Action']({'action':_0xc0ac('0x14c'),'command':util[_0xc0ac('0x78')]('iftime\x20%s,%s',_0x492616,!_[_0xc0ac('0x40')](config[_0xc0ac('0x146')][_0x2a553f])?_0x2a553f:'')})[_0xc0ac('0x3e')](function(_0x45698a){return _0x45698a[_0xc0ac('0x149')][_0xc0ac('0x14a')](_0xc0ac('0x14b'))>=0x0;})['catch'](myreject(_0x54d7f4)));}BPromise[_0xc0ac('0x14d')](_0x4eeae3)[_0xc0ac('0x3e')](function(_0x3b600f){var _0x18f5c2=_[_0xc0ac('0x14e')](_0x3b600f);if(_0x18f5c2){return _0x326d00(_0x18f5c2);}else{_0x578ef5[_0xc0ac('0x42')]=_0x62b9de?'GLOBAL_INTERVAL_IS_OVERTIME':_0xc0ac('0x14f');return _0x54d7f4(msgResponse(_0xc0ac('0x150'),_0xc0ac('0x144'),_0xc0ac('0x151')+_0x62b9de+'\x20'+_0x57e5a1+_0xc0ac('0x152')+util[_0xc0ac('0x94')](_0x492616,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2a553f));}})[_0xc0ac('0xba')](function(_0x1024b5){return _0x54d7f4(msgResponse(_0xc0ac('0x141'),_0xc0ac('0x144'),JSON[_0xc0ac('0x4b')](_0x1024b5)));});});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x153')]=function(_0x504a6a){var _0x1555e9=this;return function(){switch(_0x504a6a[_0xc0ac('0x5c')]){case _0xc0ac('0x154'):freeVariablesPredictive(_0x504a6a);_0x1555e9[_0xc0ac('0x155')](_0x504a6a,0x1);break;case _0xc0ac('0x156'):freeVariablesPredictive(_0x504a6a);_0x1555e9[_0xc0ac('0x155')](_0x504a6a,_0x504a6a['dialPowerLevel']);break;case _0xc0ac('0x9'):_0x1555e9[_0xc0ac('0x9')](_0x504a6a);break;case'booked':freeVariablesPredictive(_0x504a6a);_0x1555e9[_0xc0ac('0x155')](_0x504a6a,0x1);break;default:freeVariablesPredictive(_0x504a6a);logger[_0xc0ac('0x95')](_0xc0ac('0x157'),_0x504a6a[_0xc0ac('0x44')],'method\x20not\x20recognized');}};};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x158')]=function(_0x58ae0d){return BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](cmHopper[_0xc0ac('0x159')](_0x58ae0d['id'],previewRecallmeReminderInterval))[_0xc0ac('0x3e')](function(_0x5c2f64){for(var _0x22e501=0x0;_0x22e501<_0x5c2f64['length'];_0x22e501++){var _0x5151a9=_0x5c2f64[_0x22e501][_0xc0ac('0x15a')][_0xc0ac('0x44')];if(_0x5151a9)io['to'](util[_0xc0ac('0x78')](_0xc0ac('0x15b'),_0x5151a9))[_0xc0ac('0x101')](_0xc0ac('0x15c'),{'hopper':_0x5c2f64[_0x22e501]});}})[_0xc0ac('0xba')](function(_0x303c97){});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x15d')]=function(_0x1ee5dc){var _0x277fc0=this;return function(){_0x277fc0['handleIvr'](_0x1ee5dc);};};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xa')]=function(_0x2c2c7e){var _0x164276=this;if(isNotPreview(_0x2c2c7e[_0xc0ac('0x5c')])){if(isVoiceQueueOutbound(_0x2c2c7e[_0xc0ac('0x56')])&&isActive(_0x2c2c7e[_0xc0ac('0x5b')])){_0x2c2c7e[_0xc0ac('0x9f')]=!![];BPromise[_0xc0ac('0xb8')]()['then'](checkIsLoggedIn(_0x2c2c7e,_0x2c2c7e[_0xc0ac('0x15e')]))[_0xc0ac('0x3e')](checkIsActive(_0x2c2c7e,_0x2c2c7e[_0xc0ac('0x5b')]))[_0xc0ac('0x3e')](checkInterval(_0x2c2c7e))[_0xc0ac('0x3e')](_0x164276[_0xc0ac('0x15f')](_0x2c2c7e))[_0xc0ac('0x3e')](_0x164276[_0xc0ac('0x140')](_0x2c2c7e[_0xc0ac('0x160')],_0x2c2c7e['dialTimezone'],_0x2c2c7e[_0xc0ac('0x44')],_0x2c2c7e))[_0xc0ac('0x3e')](_0x164276['checkIfTimeIntervals'](_0x2c2c7e[_0xc0ac('0x46')],_0x2c2c7e[_0xc0ac('0x161')],_0x2c2c7e[_0xc0ac('0x44')],_0x2c2c7e))[_0xc0ac('0x3e')](_0x164276[_0xc0ac('0x153')](_0x2c2c7e))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x2c2c7e));}else{notSendMessagesQueue(_0x2c2c7e);}}else{freeVariablesPredictive(_0x2c2c7e);if(_0x2c2c7e[_0xc0ac('0x162')]){_0x164276['checkPreviewRecallReminder'](_0x2c2c7e);}}};Dialer[_0xc0ac('0xb7')]['syncCampaigns']=function(){var _0x1aedd7=this;var _0x2d5d11;for(var _0x48f345 in this['campaigns']){if(typeof this[_0xc0ac('0x1d')][_0x48f345]!==_0xc0ac('0x97')){_0x2d5d11=this['campaigns'][_0x48f345];if(isCampaignIvr(_0x2d5d11[_0xc0ac('0x56')])&&isActive(_0x2d5d11['active'])){_0x2d5d11[_0xc0ac('0x9f')]=!![];BPromise[_0xc0ac('0xb8')]()[_0xc0ac('0x3e')](checkIsActive(_0x2d5d11,_0x2d5d11[_0xc0ac('0x76')]))[_0xc0ac('0x3e')](checkInterval(_0x2d5d11))[_0xc0ac('0x3e')](_0x1aedd7[_0xc0ac('0x15f')](_0x2d5d11))[_0xc0ac('0x3e')](_0x1aedd7[_0xc0ac('0x140')](_0x2d5d11[_0xc0ac('0x160')],_0x2d5d11['dialTimezone'],_0x2d5d11['name'],_0x2d5d11))[_0xc0ac('0x3e')](_0x1aedd7[_0xc0ac('0x142')](_0x2d5d11['Interval'],_0x2d5d11[_0xc0ac('0x161')],_0x2d5d11[_0xc0ac('0x44')],_0x2d5d11))[_0xc0ac('0x3e')](_0x1aedd7[_0xc0ac('0x15d')](_0x2d5d11))['catch'](loggerCatchQueueSummary(_0xc0ac('0x163'),_0x2d5d11));}else{notSendMessagesCampaign(_0x2d5d11);}}}};function getCallerIdRandom(_0x446390,_0x58c2a5){var _0x3e4744;var _0x33eea4;var _0x385825;if(_0x58c2a5<=0x0){_0x58c2a5=0x1;}_0x3e4744=new RegExp(_0xc0ac('0x164')+_0x58c2a5+'}$');_0x33eea4=Math[_0xc0ac('0x165')](0xa,_0x58c2a5-0x1);_0x385825=Math[_0xc0ac('0x165')](0xa,_0x58c2a5)-0x1;return util[_0xc0ac('0x78')]('%s',_['replace'](_0x446390,_0x3e4744,_[_0xc0ac('0x166')](_0x33eea4,_0x385825)));}function extractCalleridName(_0x46e9ad){var _0x26c702=_0x46e9ad[_0xc0ac('0x167')](/"(.*?)"/);return _0x26c702?_0x26c702[0x1]:_0x46e9ad;}function extractCalleridNumber(_0x283c78){var _0x48fd7f=_0x283c78[_0xc0ac('0x167')](/<(.*?)>/);return _0x48fd7f?_0x48fd7f[0x1]:_0x283c78;}Dialer[_0xc0ac('0xb7')][_0xc0ac('0x168')]=function(_0x5a6133,_0x4a83b3){var _0x3a7b5e=this;var _0x58eaee=uuid['v4']();this[_0xc0ac('0x22')][_0x58eaee]=new Action(_0x5a6133,_0x4a83b3,_0x58eaee);return new BPromise(function(_0x5cc88c,_0x422c18){if(_[_0xc0ac('0x40')](_0x5a6133)&&typeof _0x5a6133!=='object'){return _0x422c18(msgResponse(_0xc0ac('0x169'),_0xc0ac('0x144'),_0xc0ac('0x16a')));}if(_['isUndefined'](_0x4a83b3[_0xc0ac('0x16b')]['phone'])||_0x4a83b3[_0xc0ac('0x16b')][_0xc0ac('0x16c')]===null){return _0x422c18(msgResponse('originate',_0xc0ac('0x144'),_0xc0ac('0x16d')));}var _0x1dfd7f={'XMD-CALLERID':_0x3a7b5e[_0xc0ac('0x22')][_0x58eaee][_0xc0ac('0x16e')](),'XMD-AGI':_0x5a6133[_0xc0ac('0x16f')]?util[_0xc0ac('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5a6133[_0xc0ac('0x16f')]):_0xc0ac('0x170'),'XMD-AGIAFTER':_0x5a6133['dialQueueProject2']?util[_0xc0ac('0x78')](_0xc0ac('0x171'),ipAgi,_0x5a6133[_0xc0ac('0x111')]):_0xc0ac('0x170'),'XMD-QUEUE':_0x5a6133['type']===_0xc0ac('0x4f')?util['format'](_0xc0ac('0x172'),_0x5a6133[_0xc0ac('0x44')],_0x5a6133[_0xc0ac('0x173')]||'',_0x5a6133[_0xc0ac('0x174')]?'c':'',_0x5a6133[_0xc0ac('0x118')]||0x3):'NONE','XMD-CONTACTID':_0x4a83b3['ContactId'],'XMD-CDRTYPE':_0xc0ac('0x7'),'CALLERID(all)':_0x3a7b5e[_0xc0ac('0x22')][_0x58eaee][_0xc0ac('0x16e')](),'XMD-AMD':_0x5a6133[_0xc0ac('0xe4')]?_0xc0ac('0x175'):'NONE','XMD-DESTINATION':_0xc0ac('0xe3')};if(_0x5a6133[_0xc0ac('0xe4')]){_0x1dfd7f[_0xc0ac('0x176')]=_0x5a6133['dialAMDInitialSilence']||0x9c4;_0x1dfd7f[_0xc0ac('0x177')]=_0x5a6133['dialAMDGreeting']||0x5dc;_0x1dfd7f['XMD-AMDAFTERGREETINGSILENCE']=_0x5a6133[_0xc0ac('0x178')]||0x320;_0x1dfd7f['XMD-AMDTOTALANALYSISTIME']=_0x5a6133[_0xc0ac('0x179')]||0x1388;_0x1dfd7f['XMD-AMDMINWORDLENGTH']=_0x5a6133[_0xc0ac('0x17a')]||0x64;_0x1dfd7f[_0xc0ac('0x17b')]=_0x5a6133[_0xc0ac('0x17c')]||0x32;_0x1dfd7f[_0xc0ac('0x17d')]=_0x5a6133['dialAMDMaximumNumberOfWords']||0x3;_0x1dfd7f['XMD-AMDSILENCETHRESHOLD']=_0x5a6133[_0xc0ac('0x17e')]||0x100;_0x1dfd7f[_0xc0ac('0x17f')]=_0x5a6133['dialAMDMaximumWordLength']||0x1388;}if(_0x5a6133[_0xc0ac('0x56')]===_0xc0ac('0x4f')){_0x1dfd7f[_0xc0ac('0x180')]=_0x4a83b3[_0xc0ac('0xd7')];}else{_0x1dfd7f[_0xc0ac('0x181')]=_0x4a83b3[_0xc0ac('0xd8')];}for(var _0x3deab3 in _0x4a83b3[_0xc0ac('0x16b')]){if(typeof _0x4a83b3[_0xc0ac('0x16b')][_0x3deab3]!==_0xc0ac('0x97')){if(isNotNull(_0x4a83b3[_0xc0ac('0x16b')][_0x3deab3])&&_0x3deab3!=='id'&&_0x3deab3!==_0xc0ac('0x182')&&_0x3deab3!==_0xc0ac('0x183')&&_0x3deab3!=='updatedAt'){_0x1dfd7f[util['format']('%s%s',_0xc0ac('0x184'),_[_0xc0ac('0x185')](_0x3deab3))]=_0x4a83b3[_0xc0ac('0x16b')][_0x3deab3];}}}var _0x207027=_0x3a7b5e[_0xc0ac('0xdd')](_0x5a6133[_0xc0ac('0x75')])?getCallerId(_0x5a6133['Trunk'][_0xc0ac('0x77')],_0x5a6133['dialOriginateCallerIdName'],_0x5a6133['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5a6133[_0xc0ac('0x186')],_0x5a6133[_0xc0ac('0x187')]):_0x5a6133[_0xc0ac('0x186')]):getCallerId(_[_0xc0ac('0xaf')](_0x5a6133[_0xc0ac('0x13d')])?_0x5a6133['Trunk']['callerid']:_0x5a6133['TrunkBackup'][_0xc0ac('0x77')],_0x5a6133[_0xc0ac('0x5d')],_0x5a6133['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5a6133[_0xc0ac('0x186')],_0x5a6133[_0xc0ac('0x187')]):_0x5a6133[_0xc0ac('0x186')]);if(_0x207027){_0x1dfd7f[_0xc0ac('0x188')]=_0x3a7b5e[_0xc0ac('0x22')][_0x58eaee][_0xc0ac('0x189')]=extractCalleridName(_0x207027);_0x1dfd7f[_0xc0ac('0x18a')]=_0x3a7b5e['actions'][_0x58eaee][_0xc0ac('0x18b')]=extractCalleridNumber(_0x207027);}return ami['Action']({'actionid':_0x58eaee,'action':_0xc0ac('0x169'),'channel':_0x3a7b5e[_0xc0ac('0xdd')](_0x5a6133['Trunk'])?util['format'](_0xc0ac('0x18c'),_0x5a6133[_0xc0ac('0x75')][_0xc0ac('0x44')],isNotNull(_0x5a6133[_0xc0ac('0x5f')])?_0x5a6133[_0xc0ac('0x5f')]['trim']()||'':'',_0x5a6133['dialCutDigit']>0x0?_0x4a83b3[_0xc0ac('0x16b')][_0xc0ac('0x16c')]['substring'](_0x5a6133[_0xc0ac('0x18d')]):_0x4a83b3[_0xc0ac('0x16b')][_0xc0ac('0x16c')]):util[_0xc0ac('0x78')](_0xc0ac('0x18c'),_[_0xc0ac('0xaf')](_0x5a6133[_0xc0ac('0x13d')])?_0x5a6133[_0xc0ac('0x75')][_0xc0ac('0x44')]:_0x5a6133[_0xc0ac('0x13d')][_0xc0ac('0x44')],isNotNull(_0x5a6133[_0xc0ac('0x5f')])?_0x5a6133[_0xc0ac('0x5f')][_0xc0ac('0x18e')]()||'':'',_0x5a6133[_0xc0ac('0x18d')]>0x0?_0x4a83b3['Contact'][_0xc0ac('0x16c')][_0xc0ac('0x18f')](_0x5a6133[_0xc0ac('0x18d')]):_0x4a83b3[_0xc0ac('0x16b')][_0xc0ac('0x16c')]),'callerid':_0x207027,'Exten':_0xc0ac('0xe3'),'Context':_0xc0ac('0x190'),'Priority':'1','variable':_0x1dfd7f,'timeout':(_0x5a6133['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x58eaee})[_0xc0ac('0x3e')](function(_0x1a3a95){return _0x5cc88c(_0x1a3a95);})['catch'](function(_0x21e0c5){_0x5a6133[_0xc0ac('0x63')]+=0x1;var _0x2a54d3=new History(_0x3a7b5e[_0xc0ac('0x22')][_0x58eaee]);logger[_0xc0ac('0x95')](util[_0xc0ac('0x78')](_0xc0ac('0x191'),JSON[_0xc0ac('0x4b')](_0x21e0c5)));_0x2a54d3[_0xc0ac('0xa7')]=0xe;_0x2a54d3['statedesc']=_0xc0ac('0x192');_0x2a54d3[_0xc0ac('0xaa')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));_0x2a54d3[_0xc0ac('0xa9')]=_0x2a54d3[_0xc0ac('0xaa')];_0x3a7b5e[_0xc0ac('0xcd')](_0x2a54d3)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x193')));_0x3a7b5e[_0xc0ac('0xcb')](_0x2a54d3)[_0xc0ac('0xba')](loggerCatch('[originate][error]'))[_0xc0ac('0x1a')](function(){delete _0x3a7b5e[_0xc0ac('0x22')][_0x58eaee];return _0x422c18(msgResponse(_0xc0ac('0x169'),_0xc0ac('0x4a'),_0xc0ac('0x194')));});});});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x195')]=function(_0xe2eb6f){var _0x3252f8=this[_0xc0ac('0x22')][_0xe2eb6f['actionid']];if(_0x3252f8){delete this[_0xc0ac('0x22')][_0xe2eb6f['actionid']];_0x3252f8[_0xc0ac('0x196')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));var _0x1d678f=_0x3252f8[_0xc0ac('0x56')]==='ivr'?this[_0xc0ac('0x1d')][_0x3252f8['queue']]:this['voiceQueues'][_0x3252f8[_0xc0ac('0x197')]()];if(!this[_0xc0ac('0xdb')](_0xe2eb6f[_0xc0ac('0x198')])){this[_0xc0ac('0xb3')](_0x1d678f);return this[_0xc0ac('0x199')](_0x3252f8,_0x1d678f,_0xe2eb6f)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x19a')));}this[_0xc0ac('0x24')][_0xe2eb6f['uniqueid']]=_0x3252f8;}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x19b')]=function(_0x3ca764,_0x3b85ce,_0xdfbd06){var _0x46d36f=new History(_0x3b85ce);if(_0x46d36f[_0xc0ac('0xf3')]+_0x46d36f[_0xc0ac('0xf4')]+_0x46d36f['countnoanswerretry']+_0x46d36f[_0xc0ac('0xf6')]+_0x46d36f[_0xc0ac('0x102')]+_0x46d36f[_0xc0ac('0xf7')]+_0x46d36f[_0xc0ac('0xf0')]+_0x46d36f[_0xc0ac('0xf8')]>=_0xdfbd06[_0xc0ac('0xf9')]-0x1){return!![];}switch(_0x3ca764){case 0x3:if(_0x46d36f[_0xc0ac('0xf5')]>=_0xdfbd06[_0xc0ac('0x19c')]-0x1){return!![];}this[_0xc0ac('0xc1')]({'active':![],'countnoanswerretry':_0x46d36f[_0xc0ac('0xf5')]+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06[_0xc0ac('0x19d')],_0xc0ac('0x106'))['format'](_0xc0ac('0xfd')),'ContactId':_0x46d36f['ContactId'],'ListId':_0x46d36f[_0xc0ac('0xd5')],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x19e')));break;case 0x5:if(_0x46d36f['countbusyretry']>=_0xdfbd06[_0xc0ac('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x46d36f[_0xc0ac('0xf3')]+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06['dialBusyRetryFrequency'],_0xc0ac('0x106'))[_0xc0ac('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f[_0xc0ac('0xd5')],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})['catch'](loggerCatch(_0xc0ac('0x1a0')));break;case 0x8:if(_0x46d36f[_0xc0ac('0xf4')]>=_0xdfbd06[_0xc0ac('0x1a1')]-0x1){return!![];}this[_0xc0ac('0xc1')]({'active':![],'countcongestionretry':_0x46d36f[_0xc0ac('0xf4')]+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06[_0xc0ac('0x1a2')],_0xc0ac('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f[_0xc0ac('0xd5')],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1a3')));break;case 0x0:if(_0x46d36f['countnosuchnumberretry']>=_0xdfbd06['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x46d36f[_0xc0ac('0xf6')]+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06[_0xc0ac('0x1a4')],_0xc0ac('0x106'))[_0xc0ac('0x78')](_0xc0ac('0xfd')),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f[_0xc0ac('0xd5')],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})['catch'](loggerCatch(_0xc0ac('0x1a5')));}break;case 0xa:if(_0x46d36f[_0xc0ac('0x102')]>=_0xdfbd06[_0xc0ac('0x11b')]-0x1){return!![];}this[_0xc0ac('0xc1')]({'active':![],'countdropretry':_0x46d36f[_0xc0ac('0x102')]+=0x1,'scheduledat':moment()['add'](_0xdfbd06[_0xc0ac('0x11c')],_0xc0ac('0x106'))['format'](_0xc0ac('0xfd')),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f['ListId'],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x11d')));break;case 0xb:if(_0x46d36f[_0xc0ac('0xf7')]>=_0xdfbd06[_0xc0ac('0x121')]-0x1){return!![];}this[_0xc0ac('0xc1')]({'active':![],'countabandonedretry':_0x46d36f[_0xc0ac('0xf7')]+=0x1,'scheduledat':moment()['add'](_0xdfbd06[_0xc0ac('0x122')],_0xc0ac('0x106'))[_0xc0ac('0x78')](_0xc0ac('0xfd')),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f['ListId'],'VoiceQueueId':_0x46d36f['VoiceQueueId']||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x46d36f[_0xc0ac('0xf0')]>=_0xdfbd06[_0xc0ac('0x104')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x46d36f[_0xc0ac('0xf0')]+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06['dialMachineRetryFrequency'],_0xc0ac('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f['ListId'],'VoiceQueueId':_0x46d36f[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x46d36f[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xfe')));break;case 0x14:if(_0x46d36f['countagentrejectretry']>=_0xdfbd06['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x46d36f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xc0ac('0xfc')](_0xdfbd06[_0xc0ac('0x1a6')],_0xc0ac('0x106'))[_0xc0ac('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x46d36f[_0xc0ac('0xd4')],'ListId':_0x46d36f[_0xc0ac('0xd5')],'VoiceQueueId':_0x46d36f['VoiceQueueId']||undefined,'CampaignId':_0x46d36f['CampaignId']||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1a7')));break;default:return!![];}};Dialer[_0xc0ac('0xb7')]['callProgressDetecting']=function(_0x152b5e,_0x11fc33,_0x12053b){var _0x503b1f=this;var _0x522e68=new History(_0x152b5e);return new BPromise(function(_0x8a5381,_0x42429e){if(_['isUndefined'](_0x11fc33)&&typeof _0x11fc33!=='object'){return _0x42429e(msgResponse(_0xc0ac('0x1a8'),'Failure',_0xc0ac('0x1a9')));}if(_['isUndefined'](_0x12053b)&&typeof _0x12053b!==_0xc0ac('0x1aa')){return _0x42429e(msgResponse(_0xc0ac('0x1a8'),_0xc0ac('0x144'),_0xc0ac('0x1ab')));}switch(_0x12053b[_0xc0ac('0x10e')]){case'0':_0x11fc33['outboundNoSuchCallsDay']+=0x1;_0x522e68[_0xc0ac('0xa7')]=0x0;_0x522e68[_0xc0ac('0xa8')]=_0xc0ac('0x1ac');_0x522e68[_0xc0ac('0xf6')]+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;ami[_0xc0ac('0x101')](_0xc0ac('0x1ad'),ut[_0xc0ac('0xea')](_0x152b5e,'nosuchnumber'));_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0xf2')));if(_0x503b1f[_0xc0ac('0x19b')](0x0,_0x152b5e,_0x11fc33)){if(_0x522e68['countnosuchnumberretry']>=_0x11fc33['dialNoSuchNumberMaxRetry']){_0x503b1f[_0xc0ac('0xfb')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1ae'));}else{_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1ae'));}}break;case'3':_0x11fc33[_0xc0ac('0x62')]+=0x1;_0x522e68['state']=0x3;_0x522e68['statedesc']='NoAnswer';_0x522e68[_0xc0ac('0xf5')]+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;ami[_0xc0ac('0x101')](_0xc0ac('0x1af'),ut[_0xc0ac('0xea')](_0x152b5e,_0xc0ac('0x1b0')));_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1b1')));if(_0x503b1f[_0xc0ac('0x19b')](0x3,_0x152b5e,_0x11fc33)){if(_0x522e68[_0xc0ac('0xf5')]>=_0x11fc33[_0xc0ac('0x19c')]){_0x503b1f[_0xc0ac('0xfb')](_0x522e68,_0x8a5381,_0x42429e,'reason\x203\x20ringing\x20no\x20answer');}else{_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1b2'));}}break;case'5':_0x11fc33['outboundBusyCallsDay']+=0x1;_0x522e68[_0xc0ac('0xa7')]=0x5;_0x522e68['statedesc']='Busy';_0x522e68[_0xc0ac('0xf3')]+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;ami['emit']('custom:agentbusy',ut['buildObj'](_0x152b5e,_0xc0ac('0x1b3')));_0x503b1f['createHistory'](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1b4')));if(_0x503b1f['checkRetriveMax'](0x5,_0x152b5e,_0x11fc33)){if(_0x522e68[_0xc0ac('0xf3')]>=_0x11fc33[_0xc0ac('0x19f')]){_0x503b1f[_0xc0ac('0xfb')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1b5'));}else{_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1b5'));}}break;case'8':_0x11fc33[_0xc0ac('0x1b6')]+=0x1;_0x522e68['state']=0x8;_0x522e68[_0xc0ac('0xa8')]=_0xc0ac('0x1b7');_0x522e68[_0xc0ac('0xf4')]+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;ami[_0xc0ac('0x101')]('custom:agentcongestion',ut[_0xc0ac('0xea')](_0x152b5e,_0xc0ac('0x1b8')));_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1b9')));if(_0x503b1f[_0xc0ac('0x19b')](0x8,_0x152b5e,_0x11fc33)){if(_0x522e68[_0xc0ac('0xf4')]>=_0x11fc33[_0xc0ac('0x1a1')]){_0x503b1f[_0xc0ac('0xfb')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1ba'));}else{_0x503b1f['stateGlobal'](_0x522e68,_0x8a5381,_0x42429e,'reason\x208\x20congestion');}}break;case'11':_0x11fc33['outboundAbandonedCallsDay']+=0x1;_0x522e68[_0xc0ac('0xa7')]=0xb;_0x522e68['statedesc']=_0xc0ac('0x124');_0x522e68['countabandonedretry']+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x503b1f['checkRetriveMax'](0xb,_0x152b5e,_0x11fc33)){if(_0x522e68[_0xc0ac('0xf7')]>=_0x11fc33[_0xc0ac('0x121')]){_0x503b1f['createStateFinal'](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1bb'));}else{_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1bb'));}}break;case'20':_0x11fc33[_0xc0ac('0x65')]+=0x1;_0x522e68[_0xc0ac('0xa7')]=0x14;_0x522e68[_0xc0ac('0xa8')]='AgentReject';_0x522e68[_0xc0ac('0xf8')]+=0x1;_0x522e68[_0xc0ac('0xf1')]+=0x1;ami[_0xc0ac('0x101')](_0xc0ac('0x1bc'),ut[_0xc0ac('0xea')](_0x152b5e,'agentreject'));_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1bd')));if(_0x503b1f[_0xc0ac('0x19b')](0x14,_0x152b5e,_0x11fc33)){if(_0x522e68['countagentrejectretry']>=_0x11fc33[_0xc0ac('0x1be')]){_0x503b1f[_0xc0ac('0xfb')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1bf'));}else{_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0xc0ac('0x1bf'));}}break;default:_0x11fc33[_0xc0ac('0x66')]+=0x1;_0x522e68['state']=0xc;_0x522e68[_0xc0ac('0xa8')]=_0x12053b[_0xc0ac('0x10e')];_0x503b1f[_0xc0ac('0xcd')](_0x522e68)[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1c0')));if(_0x503b1f['checkRetriveMax'](_0x12053b[_0xc0ac('0x10e')],_0x152b5e,_0x11fc33)){if(_0x522e68[_0xc0ac('0xf3')]+_0x522e68[_0xc0ac('0xf4')]+_0x522e68['countnoanswerretry']+_0x522e68[_0xc0ac('0xf6')]+_0x522e68[_0xc0ac('0x102')]+_0x522e68[_0xc0ac('0xf7')]+_0x522e68[_0xc0ac('0xf0')]+_0x522e68[_0xc0ac('0xf8')]>=_0x11fc33[_0xc0ac('0xf9')]){_0x503b1f[_0xc0ac('0xfa')](_0x522e68,_0x8a5381,_0x42429e,_0x12053b[_0xc0ac('0x10e')]);}else{_0x503b1f['createStateFinal'](_0x522e68,_0x8a5381,_0x42429e,_0x12053b[_0xc0ac('0x10e')]);}}}});};Dialer['prototype'][_0xc0ac('0xfa')]=function(_0xcbc04a,_0x36c9d4,_0x4cebac,_0x38b8fd){var _0x9b6d77=new Final(_0xcbc04a);_0x9b6d77[_0xc0ac('0xa7')]=0xf;_0x9b6d77[_0xc0ac('0xa8')]='Global';this[_0xc0ac('0xfb')](_0x9b6d77,_0x36c9d4,_0x4cebac,_0x38b8fd);};Dialer[_0xc0ac('0xb7')][_0xc0ac('0xfb')]=function(_0x1a49fb,_0x3402e0,_0x477086,_0x5b78ed){this[_0xc0ac('0xcb')](_0x1a49fb)[_0xc0ac('0x3e')](function(){return _0x3402e0(msgResponse(_0xc0ac('0x1a8'),'Success',_0x5b78ed));})['catch'](function(){return _0x477086(msgResponse(_0xc0ac('0x1c1'),_0xc0ac('0x144'),_0xc0ac('0x1c2')));});};Dialer['prototype'][_0xc0ac('0x9')]=function(_0x51c4c7){var _0x6fd8ab=_0x51c4c7[_0xc0ac('0x1c3')]/0x64;var _0x4a4da0=_0x51c4c7['outboundDropCallsDayTimeout']/(_0x51c4c7[_0xc0ac('0x61')]+_0x51c4c7['outboundAnswerCallsDay']);var _0x435128=Math[_0xc0ac('0x1c4')](_0x51c4c7[_0xc0ac('0x1c5')]*(_0x51c4c7[_0xc0ac('0x1c6')]/0x64));var _0x129850=Math[_0xc0ac('0x1c4')](_0x51c4c7[_0xc0ac('0x1c5')]*(_0x51c4c7['predictiveIntervalMinThreshold']/0x64));var _0x2df32f=_0x51c4c7['available']+_0x51c4c7['talking'];var _0x231fc8=Math[_0xc0ac('0x1c7')](_0x51c4c7['erlangCalls']*_0x51c4c7[_0xc0ac('0x73')]*_0x51c4c7[_0xc0ac('0x1c8')]*_0x51c4c7['predictiveIntervalMultiplicativeFactor']);if(_[_0xc0ac('0x40')](_0x51c4c7[_0xc0ac('0x27')])){if(!_[_0xc0ac('0x40')](_0x51c4c7['startPredictive'])){_0x51c4c7[_0xc0ac('0x26')]=undefined;loggerPredictive[_0xc0ac('0x95')](_0xc0ac('0x1c9'),_0xc0ac('0x1ca'));}if(!_[_0xc0ac('0x40')](_0x51c4c7[_0xc0ac('0x8e')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xc0ac('0x1cb'));clearInterval(_0x51c4c7['handlePredictive']);_0x51c4c7[_0xc0ac('0x8e')]=undefined;}_0x51c4c7['startProgressive']=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));loggerPredictive['info'](_0x51c4c7[_0xc0ac('0x44')],'collection\x20data\x20in\x20progressive\x20at',_0x51c4c7[_0xc0ac('0x27')]);this[_0xc0ac('0x155')](_0x51c4c7,0x1);}else if(ifInterval(_0x51c4c7[_0xc0ac('0x1cc')],_0x51c4c7[_0xc0ac('0x27')])){this[_0xc0ac('0x155')](_0x51c4c7,0x1);loggerPredictiveCalls[_0xc0ac('0x7b')](_0xc0ac('0x1cd'),_0x51c4c7[_0xc0ac('0x27')],_0x51c4c7[_0xc0ac('0x44')]);_0x51c4c7[_0xc0ac('0x86')]=0x0;_0x51c4c7[_0xc0ac('0x6d')]=0x0;}else if(_0x6fd8ab<_0x4a4da0&&_0x51c4c7['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x51c4c7);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x1ce'),_0xc0ac('0x1cf'),_0x4a4da0,_0xc0ac('0x27'),_0x51c4c7[_0xc0ac('0x44')]);}else if(_0x231fc8<_0x51c4c7[_0xc0ac('0x6d')]&&_0x51c4c7[_0xc0ac('0x1d0')]==='dropRate'){freeVariablesPredictive(_0x51c4c7);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x1d1'),_0xc0ac('0x1d2'),_0x231fc8,'Drop\x20in\x20this\x20interval',_0x51c4c7[_0xc0ac('0x6d')],'startProgressive',_0x51c4c7[_0xc0ac('0x44')]);}else if(!ifInterval(_0x51c4c7[_0xc0ac('0x1cc')],_0x51c4c7[_0xc0ac('0x27')])&&_[_0xc0ac('0x40')](_0x51c4c7[_0xc0ac('0x26')])&&!_[_0xc0ac('0x40')](_0x51c4c7[_0xc0ac('0x27')])){_0x51c4c7['startPredictive']=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));loggerPredictive[_0xc0ac('0x7b')](_0x51c4c7[_0xc0ac('0x44')],_0xc0ac('0x1d3'),_0x51c4c7[_0xc0ac('0x26')]);this[_0xc0ac('0xbf')](_0x51c4c7[_0xc0ac('0x1cc')])[_0xc0ac('0x3e')](this[_0xc0ac('0x1d4')](_0x51c4c7))[_0xc0ac('0x3e')](mergeDataErlangB(_0x51c4c7))[_0xc0ac('0x3e')](this[_0xc0ac('0x1d5')](_0x51c4c7))[_0xc0ac('0xba')](loggerCatchPredictive(_0xc0ac('0x1d6'),_0x51c4c7));}else if(!ifInterval(_0x51c4c7[_0xc0ac('0x1cc')],_0x51c4c7[_0xc0ac('0x26')])){_0x51c4c7[_0xc0ac('0x6d')]=0x0;_0x51c4c7[_0xc0ac('0x26')]=moment()[_0xc0ac('0x78')](_0xc0ac('0xfd'));loggerPredictive[_0xc0ac('0x7b')](_0x51c4c7[_0xc0ac('0x44')],_0xc0ac('0x1d7'),_0x51c4c7[_0xc0ac('0x26')]);clearInterval(_0x51c4c7['handlePredictive']);_0x51c4c7[_0xc0ac('0x8e')]=undefined;this[_0xc0ac('0xbf')](_0x51c4c7[_0xc0ac('0x1cc')])[_0xc0ac('0x3e')](this[_0xc0ac('0x1d4')](_0x51c4c7))[_0xc0ac('0x3e')](mergeDataErlangB(_0x51c4c7))['then'](this[_0xc0ac('0x1d5')](_0x51c4c7))['catch'](loggerCatchPredictive(_0xc0ac('0x1d8'),_0x51c4c7));}else if(_0x51c4c7['predictiveIntervalAvailable']&&_0x2df32f<_0x51c4c7[_0xc0ac('0x1c5')]-_0x129850){freeVariablesPredictive(_0x51c4c7);loggerPredictive[_0xc0ac('0x7b')](_0x51c4c7[_0xc0ac('0x44')],_0xc0ac('0x1d9'),_0x2df32f,')\x20are\x20less\x20than\x20threshold\x20(',_0x51c4c7[_0xc0ac('0x1c5')],'-',_0x129850,'=',_0x51c4c7[_0xc0ac('0x1c5')]-_0x129850,')');}else if(_0x51c4c7[_0xc0ac('0x1c5')]&&_0x2df32f>_0x51c4c7['predictiveIntervalAvailable']+_0x435128){freeVariablesPredictive(_0x51c4c7);loggerPredictive[_0xc0ac('0x7b')](_0x51c4c7[_0xc0ac('0x44')],_0xc0ac('0x1d9'),_0x2df32f,_0xc0ac('0x1da'),_0x51c4c7[_0xc0ac('0x1c5')],'+',_0x435128,'=',_0x51c4c7[_0xc0ac('0x1c5')]+_0x435128,')');}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1d4')]=function(_0x3bcb8f){var _0x50a82e=this;return function(_0x2c63ac){return new BPromise(function(_0x18a8b6,_0x273f18){_[_0xc0ac('0x8b')](_0x3bcb8f,_0x2c63ac[0x0]);if(checkGetDataPredictive(_0x2c63ac[0x0])){var _0x20603e=_0x3bcb8f[_0xc0ac('0x1c5')]=_0x3bcb8f['talking']+_0x3bcb8f[_0xc0ac('0x51')];var _0x5323dd=_0x3bcb8f[_0xc0ac('0x1cc')]*0x3c;var _0x3b3e67=_0x2c63ac[0x0][_0xc0ac('0x69')]+_0x2c63ac[0x0][_0xc0ac('0x68')];var _0x3a33a2=(_0x2c63ac[0x0][_0xc0ac('0x67')]+_0x2c63ac[0x0][_0xc0ac('0x6b')]+_0x2c63ac[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2c63ac[0x0][_0xc0ac('0x70')];_0x3bcb8f[_0xc0ac('0x1c8')]=_0x3a33a2>0x0?_0x3a33a2:0x1;switch(_0x3bcb8f[_0xc0ac('0x1d0')]){case _0xc0ac('0x1db'):var _0x1db85f=_0x3bcb8f['dialPredictiveOptimizationPercentage']/0x64;return _0x50a82e[_0xc0ac('0x1dc')](_0x20603e,_0x5323dd,_0x3b3e67,_0x3a33a2,_0x1db85f)['then'](function(_0x315f1f){return _0x18a8b6(_0x315f1f);});case'agentBusyFactor':var _0xc097c1=_0x3bcb8f['dialPredictiveOptimizationPercentage']/0x64;return _0x50a82e[_0xc0ac('0x1dd')](_0x20603e,_0x5323dd,_0x3b3e67,_0x3a33a2,_0xc097c1)[_0xc0ac('0x3e')](function(_0x35803a){return _0x18a8b6(_0x35803a);});default:return _0x273f18(msgResponse(_0xc0ac('0x1de'),_0xc0ac('0x144'),_0xc0ac('0x1df')));}}else{return _0x273f18(msgResponse(_0xc0ac('0x1de'),_0xc0ac('0x144'),'check\x20failure'));}});};};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1e0')]=function(_0x112dd7){var _0x55651c=this;return function(_0x5d8841){return new BPromise(function(_0x5b892d,_0x4188c1){_['merge'](_0x112dd7,_0x5d8841[0x0]);if(checkGetDataPredictive(_0x5d8841[0x0])){loggerPredictive[_0xc0ac('0x7b')](JSON[_0xc0ac('0x4b')](_0x5d8841[0x0]));if(_0x112dd7['dialPredictiveOptimization']===_0xc0ac('0x1db')){return _0x55651c[_0xc0ac('0xc9')](_0x112dd7['id'])[_0xc0ac('0x3e')](function(_0x54a80c){var _0x15f1bf=_0x112dd7[_0xc0ac('0x15e')]-_0x54a80c[0x0][_0xc0ac('0x1e1')];var _0x543f02=_0x112dd7[_0xc0ac('0x1cc')]*0x3c;var _0x5b7d06=_0x5d8841[0x0][_0xc0ac('0x69')]+_0x5d8841[0x0][_0xc0ac('0x68')];var _0x115829=(_0x5d8841[0x0][_0xc0ac('0x67')]+_0x5d8841[0x0][_0xc0ac('0x6b')]+_0x5d8841[0x0][_0xc0ac('0x6a')])/_0x5d8841[0x0][_0xc0ac('0x70')];var _0x236d4f=_0x112dd7[_0xc0ac('0x1c3')]/0x64;_0x112dd7[_0xc0ac('0x6f')]=_0x54a80c[0x0][_0xc0ac('0x1e1')]||0x0;_0x112dd7[_0xc0ac('0x1c8')]=_0x115829>0x0?_0x115829:0x1;return _0x55651c['abandonmentRate'](_0x15f1bf,_0x543f02,_0x5b7d06,_0x115829,_0x236d4f);})['then'](function(_0x2bb660){return _0x5b892d(_0x2bb660);})['catch'](function(_0x2122b4){return _0x4188c1(msgResponse(_0xc0ac('0x1e2'),_0xc0ac('0x144'),JSON[_0xc0ac('0x4b')](_0x2122b4)));});}if(_0x112dd7[_0xc0ac('0x1d0')]===_0xc0ac('0x1e3')){return _0x55651c[_0xc0ac('0xc9')](_0x112dd7['id'])[_0xc0ac('0x3e')](function(_0x3f1c48){var _0x586b78=_0x112dd7['loggedIn']-_0x3f1c48[0x0][_0xc0ac('0x1e1')];var _0x1580cb=_0x112dd7[_0xc0ac('0x1cc')]*0x3c;var _0x53ae42=_0x5d8841[0x0]['predictiveIntervalAvgTalktime']+_0x5d8841[0x0][_0xc0ac('0x68')];var _0x36a645=(_0x5d8841[0x0][_0xc0ac('0x67')]+_0x5d8841[0x0][_0xc0ac('0x6b')]+_0x5d8841[0x0][_0xc0ac('0x6a')])/_0x5d8841[0x0]['predictiveIntervalTotalCalls'];var _0x2198ef=_0x112dd7[_0xc0ac('0x1c3')]/0x64;_0x112dd7['predictiveIntervalPauses']=_0x3f1c48[0x0][_0xc0ac('0x1e1')]||0x0;_0x112dd7[_0xc0ac('0x1c8')]=_0x36a645>0x0?_0x36a645:0x1;return _0x55651c[_0xc0ac('0x1dd')](_0x586b78,_0x1580cb,_0x53ae42,_0x36a645,_0x2198ef);})['then'](function(_0x2caf75){return _0x5b892d(_0x2caf75);})[_0xc0ac('0xba')](function(_0x578cfb){return _0x4188c1(msgResponse(_0xc0ac('0x1e2'),_0xc0ac('0x144'),JSON[_0xc0ac('0x4b')](_0x578cfb)));});}}else{return _0x4188c1(msgResponse('[getDataPredictive]','Failure',_0xc0ac('0x1e4')));}});};};Dialer[_0xc0ac('0xb7')]['startMethodPredictive']=function(_0xae8a3){var _0x5736b5=this;return function(){var _0x25b2dc=0x0;var _0x16cd2e=Math['floor'](_0xae8a3[_0xc0ac('0x72')]*0x3e8);if(_0x16cd2e>0x0){_0x16cd2e=_0x16cd2e<0x64?0x64:_0x16cd2e;loggerPredictive['info'](_0xae8a3[_0xc0ac('0x44')],'one\x20call\x20every:',_0x16cd2e,'milliseconds');_0xae8a3[_0xc0ac('0x8e')]=setInterval(function(){_0x5736b5['handlePredictive'](_0xae8a3);loggerPredictiveCalls[_0xc0ac('0x7b')](_0xc0ac('0x1e5'),_0x25b2dc+=0x1);},_0x16cd2e);}else{loggerPredictive[_0xc0ac('0x7b')](_0xae8a3['name'],_0xc0ac('0x1e6'));}};};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1e7')]=function(_0x394494,_0x59d2ae){var _0x790541=this;return function(_0x37fc52){if(_['isEmpty'](_0x37fc52)){if(_[_0xc0ac('0xaf')](_0x59d2ae[_0xc0ac('0xd6')])||!_0x59d2ae[_0xc0ac('0x1e8')]){if(_0x394494[_0xc0ac('0x5c')]===_0xc0ac('0x8')){_0x394494[_0xc0ac('0x12c')]=_[_0xc0ac('0x40')](_0x394494[_0xc0ac('0x12c')])?!![]:_0x394494[_0xc0ac('0x12c')];var _0x57d3ef=uuid['v4']();_0x790541[_0xc0ac('0x22')][_0x57d3ef]=new Action(_0x394494,_0x59d2ae,_0x57d3ef);loggerBooked[_0xc0ac('0x7b')](_0xc0ac('0x1e9'),_0x57d3ef,_0xc0ac('0x1ea'),JSON[_0xc0ac('0x4b')](_0x394494[_0xc0ac('0x12c')]),_0xc0ac('0x1eb'),_0x394494[_0xc0ac('0x44')]);if(_0x394494['queueStatusComplete']){_0x394494[_0xc0ac('0x12c')]=![];_0x790541[_0xc0ac('0x29')][_0x790541[_0xc0ac('0x22')][_0x57d3ef][_0xc0ac('0xb4')]]=[];ami['Action']({'actionid':_0x57d3ef,'action':_0xc0ac('0x1ec'),'queue':_0x394494[_0xc0ac('0x44')]})[_0xc0ac('0xba')](function(){_0x790541[_0xc0ac('0xb3')](_0x394494);_0x790541['rescheduleContact']({'active':![],'ContactId':_0x790541[_0xc0ac('0x22')][_0x57d3ef][_0xc0ac('0xd4')],'ListId':_0x790541[_0xc0ac('0x22')][_0x57d3ef]['ListId'],'VoiceQueueId':_0x790541[_0xc0ac('0x22')][_0x57d3ef][_0xc0ac('0xd7')]||undefined,'CampaignId':_0x790541[_0xc0ac('0x22')][_0x57d3ef][_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1ed')));delete _0x790541[_0xc0ac('0x22')][_0x57d3ef];});}else{loggerBooked[_0xc0ac('0x7b')](_0xc0ac('0x1ee'),JSON['stringify'](_0x394494['queueStatusComplete']),_0xc0ac('0x1eb'),_0x394494['name']);_0x790541[_0xc0ac('0xb3')](_0x394494);_0x790541[_0xc0ac('0xc1')]({'active':![],'ContactId':_0x790541['actions'][_0x57d3ef]['ContactId'],'ListId':_0x790541[_0xc0ac('0x22')][_0x57d3ef][_0xc0ac('0xd5')],'VoiceQueueId':_0x790541[_0xc0ac('0x22')][_0x57d3ef]['VoiceQueueId']||undefined,'CampaignId':_0x790541['actions'][_0x57d3ef]['CampaignId']||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1ed')));delete _0x790541[_0xc0ac('0x22')][_0x57d3ef];}}else{return _0x790541[_0xc0ac('0x168')](_0x394494,_0x59d2ae);}}else{if(getDiff(_0x59d2ae[_0xc0ac('0x1ef')])<_0x394494[_0xc0ac('0x1f0')]*0x3c){if(_0x59d2ae[_0xc0ac('0x15a')]&&!_0x59d2ae[_0xc0ac('0x15a')][_0xc0ac('0x1f1')]){_0x790541['preview'][_0xc0ac('0x130')](_0x59d2ae['id'])['finally'](function(){_0x790541[_0xc0ac('0xb3')](_0x394494);});}else{_0x790541[_0xc0ac('0xc2')]({'active':![]},_0x59d2ae['id'],0x1)[_0xc0ac('0x1a')](function(){_0x790541[_0xc0ac('0xb3')](_0x394494);});}}else{_0x394494[_0xc0ac('0x64')]+=0x1;_0x790541['updateOriginated'](_0x394494);if(_0x394494[_0xc0ac('0x1f2')]){_0x790541[_0xc0ac('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x59d2ae['ContactId'],'ListId':_0x59d2ae[_0xc0ac('0xd5')],'VoiceQueueId':_0x59d2ae[_0xc0ac('0xd7')]||undefined,'CampaignId':_0x59d2ae[_0xc0ac('0xd8')]||undefined})[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1f3')));_0x790541[_0xc0ac('0xcd')](createObjHistory(_0x394494,_0x59d2ae,'RECALLINQUEUE',0x17,_0xc0ac('0x1f4')))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x1f5')));}else{_0x790541[_0xc0ac('0xd3')](createObjHistory(_0x394494,_0x59d2ae,_0xc0ac('0x1f6'),0x16,_0xc0ac('0x1f7')),_0xc0ac('0x1f8'),_0xc0ac('0x1f9'));}}}}else{_0x394494['outboundBlacklistCallsDay']+=0x1;_0x790541[_0xc0ac('0xd3')](createObjHistory(_0x394494,_0x59d2ae,_0xc0ac('0x1fa'),0xd,'Blacklist'),_0xc0ac('0x1fb'),_0xc0ac('0x1fc'));throw _0xc0ac('0x1fd');}};};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1fe')]=function(_0xf3bbd){var _0x25feed=this;var _0x2da7c2=_0xf3bbd[_0xc0ac('0x1ff')]-_0xf3bbd['originated']-_0xf3bbd['temp'];emitCampaignSummary(_0xf3bbd);if(_0x2da7c2>0x0){if(_0x2da7c2>this[_0xc0ac('0x20')]){_0x2da7c2=this['maxNumberOriginate'];}_0xf3bbd['temp']+=_0x2da7c2;this[_0xc0ac('0xc7')](_0xf3bbd['id'],_0x2da7c2,_0xf3bbd['dialOrderByScheduledAt'],_0xf3bbd)[_0xc0ac('0x3e')](function(_0x387973){_0xf3bbd['temp']-=_0x2da7c2;_0xf3bbd['temp']=_0xf3bbd[_0xc0ac('0xc5')]>0x0?_0xf3bbd[_0xc0ac('0xc5')]:0x0;if(!checkContactEmpty(_0x387973)){_0xf3bbd[_0xc0ac('0x42')]=_0xc0ac('0x9d');logger[_0xc0ac('0x7b')](_0xc0ac('0x200')+_0xf3bbd[_0xc0ac('0x44')]);}else{_0xf3bbd['originated']+=_0x387973[_0xc0ac('0x96')];_0xf3bbd[_0xc0ac('0x42')]=_0xc0ac('0x201');for(var _0x1ed03e=0x0;_0x1ed03e<_0x387973[_0xc0ac('0x96')];_0x1ed03e+=0x1){_0xf3bbd[_0xc0ac('0x202')]+=0x1;if(_[_0xc0ac('0xaf')](_0x387973[_0x1ed03e])||_['isNil'](_0x387973[_0x1ed03e]['Contact'])||_[_0xc0ac('0xaf')](_0x387973[_0x1ed03e][_0xc0ac('0x16b')][_0xc0ac('0x16c')])){_0x25feed[_0xc0ac('0x203')](_0xc0ac('0x204'),_0xf3bbd,_0x387973[_0x1ed03e]);}else{_0x25feed[_0xc0ac('0xbd')](_[_0xc0ac('0x12f')](_0x387973[_0x1ed03e],[_0xc0ac('0xd8'),'Contact.phone']))[_0xc0ac('0x3e')](_0x25feed[_0xc0ac('0x1e7')](_0xf3bbd,_0x387973[_0x1ed03e]))[_0xc0ac('0xba')](_0x25feed['loggerHandler'](_0xc0ac('0x205'),_0xf3bbd));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0xf3bbd,_0x2da7c2));}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x155')]=function(_0x2ce3b1,_0xfc47ca){var _0x27c094=this;var _0x2a39a9=[];var _0x4826f9=_0xfc47ca>=0x1?_0xfc47ca:0x1;if(_0x2ce3b1[_0xc0ac('0x5c')]===_0xc0ac('0x8')){_0x4826f9=0x1;}var _0x1bdab9=Math[_0xc0ac('0x1c7')](_0x2ce3b1[_0xc0ac('0x51')]*_0x4826f9)-_0x2ce3b1[_0xc0ac('0x71')]-_0x2ce3b1[_0xc0ac('0xc5')];emitVoiceQueueSummary(_0x2ce3b1);if(_0x2ce3b1[_0xc0ac('0x206')]>0x0){var _0x148d5e=_0x2ce3b1[_0xc0ac('0x206')]-_0x2ce3b1[_0xc0ac('0x71')]-_0x2ce3b1[_0xc0ac('0xa0')]-_0x2ce3b1['temp']-_0x2ce3b1[_0xc0ac('0x52')];if(_0x1bdab9>_0x148d5e){_0x1bdab9=_0x148d5e;}}if(_0x1bdab9>0x0){if(_0x2ce3b1[_0xc0ac('0x5c')]===_0xc0ac('0x8')){_0x1bdab9=0x1;}if(_0x1bdab9>this[_0xc0ac('0x20')]){_0x1bdab9=this[_0xc0ac('0x20')];}_0x2ce3b1[_0xc0ac('0xc5')]+=_0x1bdab9;for(var _0x459296 in this[_0xc0ac('0x1e')]){if(typeof this[_0xc0ac('0x1e')][_0x459296]!==_0xc0ac('0x97')){if(this[_0xc0ac('0x1e')][_0x459296][_0xc0ac('0xa7')]===_0xc0ac('0x207')&&this[_0xc0ac('0x1e')][_0x459296][_0xc0ac('0xb1')]==='reachable'){_0x2a39a9[_0xc0ac('0x12a')](this['agents'][_0x459296]['id']);}}}this[_0xc0ac('0xc4')](_0x2ce3b1['id'],_0x2a39a9,_0x1bdab9,_0x2ce3b1[_0xc0ac('0x208')],_0x2ce3b1)[_0xc0ac('0x3e')](function(_0x508117){_0x2ce3b1[_0xc0ac('0xc5')]-=_0x1bdab9;_0x2ce3b1['temp']=_0x2ce3b1[_0xc0ac('0xc5')]>0x0?_0x2ce3b1[_0xc0ac('0xc5')]:0x0;if(!checkContactEmpty(_0x508117)){_0x27c094[_0xc0ac('0xb9')](_0x2ce3b1)[_0xc0ac('0x3e')](sendMessageReschedule(_0x2ce3b1))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x209')));}else{_0x2ce3b1[_0xc0ac('0x71')]+=_0x508117[_0xc0ac('0x96')];_0x2ce3b1['message']=_0x2ce3b1['dialMethod']==='booked'?_0xc0ac('0x175'):'RUNNING';for(var _0x1eae0c=0x0;_0x1eae0c<_0x508117['length'];_0x1eae0c+=0x1){if(_[_0xc0ac('0xaf')](_0x508117[_0x1eae0c])||_[_0xc0ac('0xaf')](_0x508117[_0x1eae0c][_0xc0ac('0x16b')])||_['isNil'](_0x508117[_0x1eae0c]['Contact']['phone'])){_0x27c094[_0xc0ac('0x203')]('[actionOriginate]\x20',_0x2ce3b1,_0x508117[_0x1eae0c]);}else{_0x27c094[_0xc0ac('0xbb')](_[_0xc0ac('0x12f')](_0x508117[_0x1eae0c],[_0xc0ac('0xd7'),'Contact.phone']))['then'](_0x27c094[_0xc0ac('0x1e7')](_0x2ce3b1,_0x508117[_0x1eae0c]))[_0xc0ac('0xba')](_0x27c094[_0xc0ac('0xd1')](_0xc0ac('0x204'),_0x2ce3b1));}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x2ce3b1,_0x1bdab9));}};Dialer['prototype'][_0xc0ac('0x8e')]=function(_0x4392f3){if(_0x4392f3[_0xc0ac('0x206')]>0x0){var _0x2d75d9=_0x4392f3[_0xc0ac('0x206')]-_0x4392f3[_0xc0ac('0x71')]-_0x4392f3[_0xc0ac('0xa0')];if(_0x2d75d9>0x0){this['tryOriginatePredictive'](_0x4392f3);}else{loggerPredictiveCalls[_0xc0ac('0x7b')](_0xc0ac('0x20a'));}}else{this[_0xc0ac('0x20b')](_0x4392f3);}};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x20b')]=function(_0x5842b1){var _0x27ee4f=this;var _0x7fb6a=[];_0x5842b1[_0xc0ac('0x71')]+=0x1;for(var _0x13551f in this[_0xc0ac('0x1e')]){if(typeof this[_0xc0ac('0x1e')][_0x13551f]!=='undefined'){if(this[_0xc0ac('0x1e')][_0x13551f]['state']==='not_inuse'&&this[_0xc0ac('0x1e')][_0x13551f][_0xc0ac('0xb1')]===_0xc0ac('0xde')){_0x7fb6a['push'](this[_0xc0ac('0x1e')][_0x13551f]['id']);}}}this[_0xc0ac('0xc4')](_0x5842b1['id'],_0x7fb6a,0x1,_0x5842b1[_0xc0ac('0x208')],_0x5842b1)['then'](function(_0x540abc){if(!checkContactEmpty(_0x540abc)){checkContactLowerLimitOriginate(_0x5842b1,0x1,0x0);_0x27ee4f[_0xc0ac('0xb9')](_0x5842b1)[_0xc0ac('0x3e')](sendMessageReschedule(_0x5842b1))[_0xc0ac('0xba')](loggerCatch(_0xc0ac('0x209')));}else{_0x5842b1[_0xc0ac('0x42')]=_0xc0ac('0x201');if(_[_0xc0ac('0xaf')](_0x540abc[0x0])||_[_0xc0ac('0xaf')](_0x540abc[0x0][_0xc0ac('0x16b')])||_[_0xc0ac('0xaf')](_0x540abc[0x0]['Contact']['phone'])){_0x27ee4f[_0xc0ac('0x203')](_0xc0ac('0x204'),_0x5842b1,_0x540abc[0x0]);}else{_0x27ee4f[_0xc0ac('0xbb')](_[_0xc0ac('0x12f')](_0x540abc[0x0],[_0xc0ac('0xd7'),_0xc0ac('0x20c')]))[_0xc0ac('0x3e')](_0x27ee4f['checkContactBlack'](_0x5842b1,_0x540abc[0x0]))['catch'](_0x27ee4f['loggerHandler'](_0xc0ac('0x20d'),_0x5842b1));}}})['catch'](loggerGetContactDialer(_0xc0ac('0x20e'),_0x5842b1,0x1));emitVoiceQueueSummary(_0x5842b1);};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1dc')]=function(_0x22b2b4,_0x24ce60,_0xad6051,_0x361eef,_0x3745b5,_0x3b8007){loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x20f'));loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x210'),_0x22b2b4);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x211'),_0x24ce60);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x212'),_0xad6051);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x213'),_0x361eef);loggerPredictive[_0xc0ac('0x7b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3745b5);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x8a'));return new BPromise(function(_0x41b897,_0x550fd5){if(_0x22b2b4<=0x0||isNaN(_0x22b2b4)){return _0x550fd5(msgResponse('[abandonmentRate]',_0xc0ac('0x4a'),_0xc0ac('0x214')+_0x22b2b4));}if(_0xad6051<=0x0||isNaN(_0xad6051)){return _0x550fd5(msgResponse(_0xc0ac('0x215'),_0xc0ac('0x4a'),_0xc0ac('0x216')+_0xad6051));}if(_0x361eef<=0x0||isNaN(_0x361eef)){return _0x550fd5(msgResponse('[abandonmentRate]',_0xc0ac('0x4a'),_0xc0ac('0x217')+_0x361eef));}if(_0x24ce60<=0x0||isNaN(_0x24ce60)){return _0x550fd5(msgResponse(_0xc0ac('0x215'),'Error','interval\x20=\x20'+_0x24ce60));}if(_0x3745b5<=0x0||isNaN(_0x3745b5)){return _0x550fd5(msgResponse(_0xc0ac('0x215'),_0xc0ac('0x4a'),_0xc0ac('0x218')+_0x3745b5));}_0x3b8007=_0x3b8007||0x0;var _0x74cc33=0x1/_0xad6051;var _0x233c01=0x0;var _0x4ad574=0x0;var _0x6d7fe6=0x0;var _0x527f98=0x0;for(var _0x1535b5=0x0;_0x6d7fe6<_0x3745b5;_0x1535b5+=0x1){_0x4ad574=_0x1535b5/_0x24ce60;_0x233c01=(_0x361eef*_0x4ad574+_0x3b8007)/_0x74cc33;_0x6d7fe6=erlangb(_0x233c01,_0x22b2b4);_0x527f98=_0x233c01/_0x22b2b4*(0x1-erlangb(_0x233c01,_0x22b2b4));}return _0x41b897({'erlangCalls':_0x1535b5,'erlangCallToSecond':_0x24ce60/_0x1535b5,'erlangAbandonmentRate':_0x6d7fe6,'erlangBusyFactor':_0x527f98});});};Dialer[_0xc0ac('0xb7')][_0xc0ac('0x1dd')]=function(_0xbbb546,_0x209c5e,_0x14ce27,_0x324f85,_0x38eba2,_0x556f94){loggerPredictive[_0xc0ac('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x210'),_0xbbb546);loggerPredictive[_0xc0ac('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x209c5e);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x212'),_0x14ce27);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x213'),_0x324f85);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x219'),_0x38eba2);loggerPredictive[_0xc0ac('0x7b')](_0xc0ac('0x8a'));return new BPromise(function(_0x2e9e26,_0x371cda){if(_0xbbb546<=0x0||isNaN(_0xbbb546)){return _0x371cda(msgResponse(_0xc0ac('0x21a'),_0xc0ac('0x4a'),_0xc0ac('0x214')+_0xbbb546));}if(_0x14ce27<=0x0||isNaN(_0x14ce27)){return _0x371cda(msgResponse(_0xc0ac('0x21a'),_0xc0ac('0x4a'),_0xc0ac('0x216')+_0x14ce27));}if(_0x324f85<=0x0||isNaN(_0x324f85)){return _0x371cda(msgResponse(_0xc0ac('0x21a'),_0xc0ac('0x4a'),_0xc0ac('0x217')+_0x324f85));}if(_0x209c5e<=0x0||isNaN(_0x209c5e)){return _0x371cda(msgResponse(_0xc0ac('0x21a'),_0xc0ac('0x4a'),_0xc0ac('0x21b')+_0x209c5e));}if(_0x38eba2<=0x0||isNaN(_0x38eba2)){return _0x371cda(msgResponse(_0xc0ac('0x21a'),_0xc0ac('0x4a'),_0xc0ac('0x21c')+_0x38eba2));}_0x556f94=_0x556f94||0x0;var _0x3bbc13=0x1/_0x14ce27;var _0x51cef5=0x0;var _0x39a4ab=0x0;var _0x402222=0x0;var _0x5d7bf6=0x0;for(var _0x178902=0x0;_0x5d7bf6<_0x38eba2;_0x178902+=0x1){_0x39a4ab=_0x178902/_0x209c5e;_0x51cef5=(_0x324f85*_0x39a4ab+_0x556f94)/_0x3bbc13;_0x402222=erlangb(_0x51cef5,_0xbbb546);_0x5d7bf6=_0x51cef5/_0xbbb546*(0x1-erlangb(_0x51cef5,_0xbbb546));}return _0x2e9e26({'erlangCalls':_0x178902,'erlangCallToSecond':_0x209c5e/_0x178902,'erlangAbandonmentRate':_0x402222,'erlangBusyFactor':_0x5d7bf6});});};module[_0xc0ac('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 5307632..155f8e2 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 _0x909f=['countabandonedretry','countagentrejectretry','countmachineretry','calleridnum','number','responsetime','endtime','droptime','starttime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x110a83,_0x7532){var _0xfe8725=function(_0x3580fb){while(--_0x3580fb){_0x110a83['push'](_0x110a83['shift']());}};_0xfe8725(++_0x7532);}(_0x909f,0x1eb));var _0xf909=function(_0x3bb028,_0x36d70f){_0x3bb028=_0x3bb028-0x0;var _0x95983=_0x909f[_0x3bb028];return _0x95983;};'use strict';var util=require(_0xf909('0x0'));var _=require('lodash');var moment=require(_0xf909('0x1'));function getSeconds(_0x2e4637,_0x822f33){var _0x4c00c8=moment(_0x2e4637)[_0xf909('0x2')](0x0);var _0x24dfe3=moment(_0x822f33)['milliseconds'](0x0);return _0x4c00c8[_0xf909('0x3')](_0x24dfe3,_0xf909('0x4'));}function QueueCallerAbandon(_0x16a484,_0x346cf6){this['scheduledat']=_0x16a484[_0xf909('0x5')];this['type']=_0x16a484['type'];this[_0xf909('0x6')]=_0x16a484[_0xf909('0x7')]===_0xf909('0x8')?_0xf909('0x9'):_0x16a484[_0xf909('0x7')];this['countbusyretry']=_0x16a484[_0xf909('0xa')];this[_0xf909('0xb')]=_0x16a484[_0xf909('0xb')];this[_0xf909('0xc')]=_0x16a484[_0xf909('0xc')];this[_0xf909('0xd')]=_0x16a484[_0xf909('0xa')]+_0x16a484['countcongestionretry']+_0x16a484[_0xf909('0xc')]+_0x16a484[_0xf909('0xe')]+_0x16a484[_0xf909('0xf')]+_0x16a484[_0xf909('0x10')]+_0x16a484['countmachineretry']+_0x16a484[_0xf909('0x11')];this[_0xf909('0xe')]=_0x16a484['countnosuchnumberretry'];this['countdropretry']=_0x16a484[_0xf909('0xf')];this[_0xf909('0x10')]=_0x16a484[_0xf909('0x10')];this[_0xf909('0x12')]=_0x16a484[_0xf909('0x12')];this[_0xf909('0x11')]=_0x16a484[_0xf909('0x11')];this['uniqueid']=_0x346cf6['uniqueid'];this['calleridname']=_0x16a484['name'];this[_0xf909('0x13')]=_0x16a484[_0xf909('0x14')];this['starttime']=_0x16a484['starttime'];this[_0xf909('0x15')]=_0x16a484[_0xf909('0x15')];this['droptime']=_0x16a484['droptime'];this[_0xf909('0x16')]=this[_0xf909('0x17')];this['ringtime']=getSeconds(_0x16a484[_0xf909('0x15')],_0x16a484[_0xf909('0x18')]);this['holdtime']=getSeconds(this['droptime'],_0x16a484['responsetime']);this['talktime']=0x0;this[_0xf909('0x9')]=_0x346cf6[_0xf909('0x9')];this[_0xf909('0x19')]=_0x346cf6[_0xf909('0x1a')];this[_0xf909('0x1b')]=_0x346cf6['reason'];this[_0xf909('0x1c')]=_0x16a484['callback'];this['callbackuniqueid']=_0x16a484[_0xf909('0x1d')];this[_0xf909('0x1e')]=_0x16a484[_0xf909('0x1e')];this[_0xf909('0x1f')]=_0x16a484[_0xf909('0x1f')];this[_0xf909('0x20')]=_0x16a484['ContactId'];this[_0xf909('0x21')]=_0x16a484[_0xf909('0x21')];this[_0xf909('0x22')]=_0x16a484['UserId'];this['VoiceQueueId']=_0x16a484['VoiceQueueId'];this[_0xf909('0x23')]=_0x16a484[_0xf909('0x23')];this[_0xf909('0x24')]=_0x16a484[_0xf909('0x24')]||'';this[_0xf909('0x25')]=_0x16a484['originatecalleridname']||'';}module[_0xf909('0x26')]=QueueCallerAbandon; \ No newline at end of file +var _0x395e=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x395e,0x1af));var _0xe395=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x395e[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var _=require(_0xe395('0x0'));var moment=require(_0xe395('0x1'));function getSeconds(_0x53a848,_0x189a1a){var _0xeb4993=moment(_0x53a848)[_0xe395('0x2')](0x0);var _0x513871=moment(_0x189a1a)[_0xe395('0x2')](0x0);return _0xeb4993[_0xe395('0x3')](_0x513871,_0xe395('0x4'));}function QueueCallerAbandon(_0x2a9475,_0x3ea55f){this[_0xe395('0x5')]=_0x2a9475[_0xe395('0x5')];this[_0xe395('0x6')]=_0x2a9475[_0xe395('0x6')];this['campaigntype']=_0x2a9475[_0xe395('0x6')]==='outbound'?_0xe395('0x7'):_0x2a9475[_0xe395('0x6')];this[_0xe395('0x8')]=_0x2a9475[_0xe395('0x8')];this['countcongestionretry']=_0x2a9475[_0xe395('0x9')];this['countnoanswerretry']=_0x2a9475[_0xe395('0xa')];this[_0xe395('0xb')]=_0x2a9475[_0xe395('0x8')]+_0x2a9475[_0xe395('0x9')]+_0x2a9475[_0xe395('0xa')]+_0x2a9475[_0xe395('0xc')]+_0x2a9475[_0xe395('0xd')]+_0x2a9475[_0xe395('0xe')]+_0x2a9475['countmachineretry']+_0x2a9475[_0xe395('0xf')];this['countnosuchnumberretry']=_0x2a9475['countnosuchnumberretry'];this[_0xe395('0xd')]=_0x2a9475[_0xe395('0xd')];this['countabandonedretry']=_0x2a9475[_0xe395('0xe')];this[_0xe395('0x10')]=_0x2a9475['countmachineretry'];this[_0xe395('0xf')]=_0x2a9475[_0xe395('0xf')];this[_0xe395('0x11')]=_0x3ea55f[_0xe395('0x11')];this[_0xe395('0x12')]=_0x2a9475[_0xe395('0x13')];this['calleridnum']=_0x2a9475['number'];this[_0xe395('0x14')]=_0x2a9475['starttime'];this[_0xe395('0x15')]=_0x2a9475[_0xe395('0x15')];this['droptime']=_0x2a9475['droptime'];this[_0xe395('0x16')]=this[_0xe395('0x17')];this[_0xe395('0x18')]=getSeconds(_0x2a9475[_0xe395('0x15')],_0x2a9475[_0xe395('0x14')]);this[_0xe395('0x19')]=getSeconds(this['droptime'],_0x2a9475[_0xe395('0x15')]);this[_0xe395('0x1a')]=0x0;this[_0xe395('0x7')]=_0x3ea55f[_0xe395('0x7')];this[_0xe395('0x1b')]=_0x3ea55f[_0xe395('0x1c')];this[_0xe395('0x1d')]=_0x3ea55f[_0xe395('0x1d')];this[_0xe395('0x1e')]=_0x2a9475[_0xe395('0x1e')];this[_0xe395('0x1f')]=_0x2a9475[_0xe395('0x1f')];this[_0xe395('0x20')]=_0x2a9475[_0xe395('0x20')];this[_0xe395('0x21')]=_0x2a9475[_0xe395('0x21')];this[_0xe395('0x22')]=_0x2a9475['ContactId'];this[_0xe395('0x23')]=_0x2a9475[_0xe395('0x23')];this[_0xe395('0x24')]=_0x2a9475['UserId'];this[_0xe395('0x25')]=_0x2a9475[_0xe395('0x25')];this[_0xe395('0x26')]=_0x2a9475['CampaignId'];this[_0xe395('0x27')]=_0x2a9475[_0xe395('0x27')]||'';this['originatecalleridname']=_0x2a9475[_0xe395('0x28')]||'';}module[_0xe395('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 1ae7b0e..daef2f1 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(_0x491914,_0x509711){var _0x1f4c24=function(_0x35ebe1){while(--_0x35ebe1){_0x491914['push'](_0x491914['shift']());}};_0x1f4c24(++_0x509711);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x102121,_0x582086){var _0x402b5e=function(_0x51d8f5){while(--_0x51d8f5){_0x102121['push'](_0x102121['shift']());}};_0x402b5e(++_0x582086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 98d1f81..4c265f9 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 _0xa74f=['[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','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','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','calleridnum','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]'];(function(_0x5c1473,_0x18dfbb){var _0x233cc1=function(_0x5c6a15){while(--_0x5c6a15){_0x5c1473['push'](_0x5c1473['shift']());}};_0x233cc1(++_0x18dfbb);}(_0xa74f,0x9a));var _0xfa74=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xa74f[_0xa30766];return _0x24e780;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xfa74('0x0'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xfa74('0x1'));var tiff2pdf=require(_0xfa74('0x2'));var gs=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('fax');var ami=require(_0xfa74('0x5'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xfa74('0x6'));var Action=require(_0xfa74('0x7'));var faxAccount=require(_0xfa74('0x8'));var attachment=require(_0xfa74('0x9'));var faxMessage=require(_0xfa74('0xa'));function Fax(_0x344e04){this['channels']={};this[_0xfa74('0xb')]=_0x344e04[_0xfa74('0xb')];this[_0xfa74('0xc')]=_0x344e04[_0xfa74('0xc')];this['actions']={};ami['on'](_0xfa74('0xd'),this[_0xfa74('0xe')]['bind'](this));ami['on'](_0xfa74('0xf'),this[_0xfa74('0x10')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x12'),this['syncNewState'][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x13'),this[_0xfa74('0x14')][_0xfa74('0x11')](this));ami['on']('faxstatus',this[_0xfa74('0x15')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x16'),this[_0xfa74('0x17')][_0xfa74('0x11')](this));ami['on']('hangup',this[_0xfa74('0x18')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x19'),this[_0xfa74('0x1a')][_0xfa74('0x11')](this));}Fax[_0xfa74('0x1b')][_0xfa74('0xe')]=function(_0x48c119){if(_0x48c119[_0xfa74('0x1c')]===_0xfa74('0x1d')){for(var _0x51dda1 in this['faxAccounts']){if(this[_0xfa74('0xb')][_0xfa74('0x1e')](_0x51dda1)){if(_0x48c119[_0xfa74('0x1f')]===this['faxAccounts'][_0x51dda1][_0xfa74('0x20')]){this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]]={};this['channels'][_0x48c119[_0xfa74('0x22')]][_0xfa74('0x23')]=_0x48c119[_0xfa74('0x23')];this['channels'][_0x48c119['uniqueid']]['id']=this[_0xfa74('0xb')][_0x51dda1]['id'];this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]][_0xfa74('0x24')]=this[_0xfa74('0xb')][_0x51dda1]['name'];logger['info'](_0x48c119[_0xfa74('0x22')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x48c119['uniqueid']]){this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]]={};this[_0xfa74('0x21')][_0x48c119['uniqueid']]['channel']=_0x48c119[_0xfa74('0x23')];logger[_0xfa74('0x25')](_0x48c119['uniqueid'],_0xfa74('0x26'));}};Fax['prototype'][_0xfa74('0x10')]=function(_0x153b2a){if(this['channels'][_0x153b2a[_0xfa74('0x22')]]){for(var _0x1130de in _0x153b2a[_0xfa74('0x27')]){if(_0x153b2a[_0xfa74('0x27')]['hasOwnProperty'](_0x1130de)){this[_0xfa74('0x21')][_0x153b2a[_0xfa74('0x22')]][_0x1130de]=_0x153b2a[_0xfa74('0x28')];}}}};Fax['prototype']['syncNewState']=function(_0x1322a4){if(this[_0xfa74('0x21')][_0x1322a4['uniqueid']]){this['channels'][_0x1322a4[_0xfa74('0x22')]]['channelstate']=_0x1322a4[_0xfa74('0x29')];this['channels'][_0x1322a4[_0xfa74('0x22')]][_0xfa74('0x2a')]=_0x1322a4[_0xfa74('0x2a')];}};Fax[_0xfa74('0x1b')]['syncNewExten']=function(_0x25e1fb){if(this[_0xfa74('0x21')][_0x25e1fb[_0xfa74('0x22')]]){for(var _0x16f9dc in _0x25e1fb[_0xfa74('0x27')]){if(_0x25e1fb[_0xfa74('0x27')][_0xfa74('0x1e')](_0x16f9dc)){this['channels'][_0x25e1fb[_0xfa74('0x22')]][_0x16f9dc]=_0x25e1fb['value'];}}}};Fax[_0xfa74('0x1b')][_0xfa74('0x15')]=function(_0xcc5e32){if(this[_0xfa74('0x21')][_0xcc5e32['uniqueid']]){this['channels'][_0xcc5e32[_0xfa74('0x22')]][_0xfa74('0x2b')]=_0xcc5e32[_0xfa74('0x2b')];this[_0xfa74('0x21')][_0xcc5e32['uniqueid']][_0xfa74('0x2c')]=_0xcc5e32[_0xfa74('0x2c')];this['channels'][_0xcc5e32['uniqueid']]['localstationid']=_0xcc5e32['localstationid'];this['channels'][_0xcc5e32[_0xfa74('0x22')]][_0xfa74('0x2d')]=_0xcc5e32[_0xfa74('0x2d')];logger[_0xfa74('0x25')](_0xcc5e32[_0xfa74('0x22')],_0xfa74('0x2e'));}};Fax[_0xfa74('0x1b')][_0xfa74('0x17')]=function(_0x1a2d52){var _0x5368c9=this;if(this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]){var _0x430339=this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]['id'];this[_0xfa74('0x21')][_0x1a2d52['uniqueid']][_0xfa74('0x2f')]=_0x1a2d52[_0xfa74('0x2f')];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]['pagestransferred']=_0x1a2d52[_0xfa74('0x30')];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x20')]=_0x1a2d52['localstationid'];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x31')]=_0x1a2d52['resolution'];this['channels'][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x32')]=_0x1a2d52[_0xfa74('0x32')];this[_0xfa74('0x21')][_0x1a2d52['uniqueid']][_0xfa74('0x2d')]=_0x1a2d52[_0xfa74('0x2d')];this['channels'][_0x1a2d52['uniqueid']]['calleridnum']=_0x1a2d52['calleridnum'];if(this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x30')]>0x0){tiff2pdf(_0x1a2d52[_0xfa74('0x2d')],_0xfa74('0x33'),function(_0x193110){logger[_0xfa74('0x25')](_0x1a2d52['uniqueid'],_0xfa74('0x34'),_0x193110[_0xfa74('0x35')]);attachment[_0xfa74('0x36')]({'name':path[_0xfa74('0x37')](_0x1a2d52[_0xfa74('0x2d')])['name'],'basename':path[_0xfa74('0x37')](_0x1a2d52[_0xfa74('0x2d')])[_0xfa74('0x24')]+_0xfa74('0x38'),'type':_0xfa74('0x39')})[_0xfa74('0x3a')](function(_0x96eeb3){faxAccount[_0xfa74('0x3b')](_0x430339,{'from':_0x1a2d52[_0xfa74('0x3c')],'mapKey':_0xfa74('0x3d'),'body':path['parse'](_0x1a2d52[_0xfa74('0x2d')])['name']+_0xfa74('0x38'),'AttachmentId':_0x96eeb3['id']})[_0xfa74('0x3e')](function(_0x2bb3a4){logger[_0xfa74('0x3f')](_0x1a2d52['uniqueid'],_0xfa74('0x40'),JSON[_0xfa74('0x41')](_0x2bb3a4));});})['catch'](function(_0x1cffca){logger[_0xfa74('0x3f')](_0x1a2d52['uniqueid'],_0xfa74('0x42'),JSON[_0xfa74('0x41')](_0x1cffca));});});}logger[_0xfa74('0x25')](_0x1a2d52[_0xfa74('0x22')],_0xfa74('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x36f6ca){if(this[_0xfa74('0x43')][_0x36f6ca['uniqueid']]){_[_0xfa74('0x44')](this[_0xfa74('0x21')][_0x36f6ca[_0xfa74('0x22')]],_['pick'](_0x36f6ca,['response',_0xfa74('0x45')]));}};function updateStatus(_0x3cd48c){if(_0x3cd48c[_0xfa74('0x46')]){faxMessage[_0xfa74('0x47')](_0x3cd48c[_0xfa74('0x46')],{'failMessage':_0xfa74('0x48')})[_0xfa74('0x3a')](function(_0x30992b){ut['logger'](_0xfa74('0x49'),_0x30992b);})[_0xfa74('0x3e')](function(_0x26bb7e){ut[_0xfa74('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x26bb7e);});}else{ut['logger'](_0xfa74('0x4b'));}}Fax['prototype'][_0xfa74('0x4c')]=function(_0x221dc7,_0x427469,_0x33e31e){var _0x262f75=this;var _0x144c80={};if(_0x427469){_0x144c80={'read':_0x427469};}else{_0x144c80={'failMessage':_0x33e31e};}if(this[_0xfa74('0x43')][_0x221dc7]['AttachmentId']){faxMessage[_0xfa74('0x47')](this['actions'][_0x221dc7][_0xfa74('0x46')],_0x144c80)['then'](function(_0x480c4e){ut[_0xfa74('0x4a')](_0xfa74('0x4d'),_0x480c4e);})['catch'](function(_0x5dcc3c){ut[_0xfa74('0x4a')](_0xfa74('0x4e'),_0x5dcc3c);})[_0xfa74('0x4f')](function(){delete _0x262f75[_0xfa74('0x21')][_0x221dc7];delete _0x262f75[_0xfa74('0x43')][_0x221dc7];});}else{ut[_0xfa74('0x4a')](_0xfa74('0x50'));delete this[_0xfa74('0x21')][_0x221dc7];delete this[_0xfa74('0x43')][_0x221dc7];}};Fax[_0xfa74('0x1b')]['syncHangup']=function(_0x42ca2a){var _0xc89005=this;if(this['channels'][_0x42ca2a['uniqueid']]){if(this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]){this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]]['id']=this[_0xfa74('0x43')][_0x42ca2a['uniqueid']]['id'];this[_0xfa74('0x21')][_0x42ca2a['uniqueid']][_0xfa74('0x24')]=this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]['name'];}logger['info'](_0x42ca2a[_0xfa74('0x22')],this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]?_0xfa74('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0xfa74('0x41')](this[_0xfa74('0x21')][_0x42ca2a['uniqueid']]));if(this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]){if(this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]]['faxpages']>0x0&&this[_0xfa74('0x21')][_0x42ca2a['uniqueid']][_0xfa74('0x52')]===_0xfa74('0x53')){this[_0xfa74('0x4c')](_0x42ca2a[_0xfa74('0x22')],!![]);}else{this[_0xfa74('0x4c')](_0x42ca2a[_0xfa74('0x22')],![],this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]][_0xfa74('0x54')]?_0xfa74('0x55')+this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]][_0xfa74('0x54')]:_0xfa74('0x56'));}}}};Fax[_0xfa74('0x1b')]['send']=function(_0x2361d2){var _0x3b0dd5=this;return new BPromise(function(_0x5035dd,_0x57a923){_0x3b0dd5[_0xfa74('0x57')](_0x2361d2,_0x3b0dd5['faxAccounts'][_0x2361d2[_0xfa74('0x58')]])[_0xfa74('0x3a')](function(_0x29270f){ut['logger'](_0xfa74('0x59'),_0x29270f);_0x5035dd(ut['message']('Fax\x20received'));})[_0xfa74('0x3e')](function(_0x1fccac){ut[_0xfa74('0x4a')](_0xfa74('0x5a'),_0x1fccac);updateStatus(_0x2361d2);_0x57a923(ut[_0xfa74('0x35')](_0xfa74('0x5b')));});});};Fax[_0xfa74('0x1b')][_0xfa74('0x5c')]=function(_0x3dff70){var _0xa16e7b=this;return new BPromise(function(_0x2588bb,_0x4fde10){var _0x3ed6e4=_0xa16e7b['checkTrunk'](_0xa16e7b[_0xfa74('0xb')][_0x3dff70[_0xfa74('0x58')]][_0xfa74('0x5d')],_0x3dff70);if(_0x3ed6e4['isValid']){_0x2588bb(ut[_0xfa74('0x35')](_0xfa74('0x5e')));}else{_0x4fde10(ut[_0xfa74('0x35')](_0x3ed6e4['message']));}});};function originate(_0x1b8c06,_0x34e772,_0x474462){return new BPromise(function(_0x1105e5,_0x10e5f5){if(_0x474462){var _0x5bd0e5=util[_0xfa74('0x5f')](_0xfa74('0x60'),path[_0xfa74('0x37')](_0x1b8c06[_0xfa74('0x1')])[_0xfa74('0x24')],_0x1b8c06[_0xfa74('0x1')]);gs[_0xfa74('0x61')](_0x5bd0e5)[_0xfa74('0x3a')](function(){_0x1b8c06[_0xfa74('0x1')]=util[_0xfa74('0x5f')](_0xfa74('0x62'),path[_0xfa74('0x37')](_0x1b8c06['path'])[_0xfa74('0x63')],path[_0xfa74('0x37')](_0x1b8c06[_0xfa74('0x1')])[_0xfa74('0x24')]);_0x34e772[_0xfa74('0x64')]=_0x1b8c06[_0xfa74('0x1')];ut[_0xfa74('0x4a')](_0xfa74('0x65'),'');ami['Action'](ut[_0xfa74('0x66')](_0x1b8c06,_0x34e772))[_0xfa74('0x3a')](function(_0x176916){_0x1105e5(_0x176916);})[_0xfa74('0x3e')](function(_0x54cc2e){_0x10e5f5(_0x54cc2e);});})[_0xfa74('0x3e')](function(_0x352332){_0x10e5f5(_0x352332);});}else{ami[_0xfa74('0x67')](ut[_0xfa74('0x66')](_0x1b8c06,_0x34e772))['then'](function(_0x2b22d5){_0x1105e5(_0x2b22d5);})['catch'](function(_0x5cc8bf){_0x10e5f5(_0x5cc8bf);});}});}Fax[_0xfa74('0x1b')]['execOriginate']=function(_0x1cc0fe,_0x2d24c7){var _0x4b2f59=this;return new BPromise(function(_0x5121ff,_0xb605a1){var _0x3651ea=uuid['v4']();var _0xc8a671=ut[_0xfa74('0x68')](_0x1cc0fe,_0x2d24c7);_0x4b2f59['actions'][_0x3651ea]=new Action(_0x3651ea,_0x2d24c7,_0x1cc0fe);var _0x5acb9b=_0x4b2f59['actions'][_0x3651ea];if(path[_0xfa74('0x37')](_0x1cc0fe[_0xfa74('0x1')])[_0xfa74('0x69')]===_0xfa74('0x38')){originate(_0x5acb9b,_0xc8a671,!![])[_0xfa74('0x3a')](function(_0x52e8ac){_0x5121ff(_0x52e8ac);})[_0xfa74('0x3e')](function(_0x21c7c3){_0xb605a1(_0x21c7c3);});}else{originate(_0x5acb9b,_0xc8a671,![])[_0xfa74('0x3a')](function(_0x3d8ad8){_0x5121ff(_0x3d8ad8);})[_0xfa74('0x3e')](function(_0x3bf8e5){_0xb605a1(_0x3bf8e5);});}});};Fax[_0xfa74('0x1b')][_0xfa74('0x6a')]=function(_0x8d123c){return!_['isNil'](_0x8d123c)&&!_['isNil'](_0x8d123c['name'])&&!_[_0xfa74('0x6b')](_0x8d123c[_0xfa74('0x6c')])&&_0x8d123c[_0xfa74('0x6c')]&&!_[_0xfa74('0x6b')](this[_0xfa74('0xc')][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])])&&!_['isNil'](this[_0xfa74('0xc')][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])][_0xfa74('0x2c')])&&(this[_0xfa74('0xc')][util[_0xfa74('0x5f')](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])][_0xfa74('0x2c')]==='reachable'||this['trunks'][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])]['status']===_0xfa74('0x6e'));};Fax[_0xfa74('0x1b')][_0xfa74('0x6f')]=function(_0x1364ca,_0x4a65dc){if(!this[_0xfa74('0x6a')](_0x1364ca)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xfa74('0x6b')](_0x1364ca)?'':_0x1364ca[_0xfa74('0x24')]+_0xfa74('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xfa74('0x6b')](_0x4a65dc[_0xfa74('0x3d')])){ut['logger'](_0xfa74('0x71'),JSON['stringify'](_0x4a65dc));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x4a65dc[_0xfa74('0x1')])){ut[_0xfa74('0x4a')](_0xfa74('0x72'),JSON[_0xfa74('0x41')](_0x4a65dc));return{'isValid':![],'message':_0xfa74('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x8603=['filename','calleridnum','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','Action','variablesAction','addVariables','ext','isTrunkReachable','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','isNil','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate'];(function(_0x573063,_0x248ba0){var _0x6b3284=function(_0x234b84){while(--_0x234b84){_0x573063['push'](_0x573063['shift']());}};_0x6b3284(++_0x248ba0);}(_0x8603,0x190));var _0x3860=function(_0x5a0697,_0x135d87){_0x5a0697=_0x5a0697-0x0;var _0x494b79=_0x8603[_0x5a0697];return _0x494b79;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var BPromise=require(_0x3860('0x1'));var uuid=require(_0x3860('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x3860('0x3'));var gs=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('fax');var ami=require(_0x3860('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x3860('0x7'));var ut=require(_0x3860('0x8'));var Action=require(_0x3860('0x9'));var faxAccount=require(_0x3860('0xa'));var attachment=require(_0x3860('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5c7350){this['channels']={};this[_0x3860('0xc')]=_0x5c7350[_0x3860('0xc')];this['trunks']=_0x5c7350[_0x3860('0xd')];this[_0x3860('0xe')]={};ami['on']('newchannel',this[_0x3860('0xf')][_0x3860('0x10')](this));ami['on']('varset',this[_0x3860('0x11')][_0x3860('0x10')](this));ami['on']('newstate',this[_0x3860('0x12')][_0x3860('0x10')](this));ami['on'](_0x3860('0x13'),this[_0x3860('0x14')][_0x3860('0x10')](this));ami['on'](_0x3860('0x15'),this[_0x3860('0x16')][_0x3860('0x10')](this));ami['on'](_0x3860('0x17'),this[_0x3860('0x18')]['bind'](this));ami['on'](_0x3860('0x19'),this[_0x3860('0x1a')][_0x3860('0x10')](this));ami['on'](_0x3860('0x1b'),this[_0x3860('0x1c')][_0x3860('0x10')](this));}Fax[_0x3860('0x1d')][_0x3860('0xf')]=function(_0x311fdb){if(_0x311fdb[_0x3860('0x1e')]===_0x3860('0x1f')){for(var _0x45b799 in this['faxAccounts']){if(this['faxAccounts'][_0x3860('0x20')](_0x45b799)){if(_0x311fdb[_0x3860('0x21')]===this[_0x3860('0xc')][_0x45b799]['localstationid']){this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]={};this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]][_0x3860('0x24')]=_0x311fdb[_0x3860('0x24')];this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]['id']=this[_0x3860('0xc')][_0x45b799]['id'];this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]][_0x3860('0x25')]=this[_0x3860('0xc')][_0x45b799][_0x3860('0x25')];logger[_0x3860('0x26')](_0x311fdb['uniqueid'],_0x3860('0x27'));}}}}if(this[_0x3860('0xe')][_0x311fdb[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x311fdb[_0x3860('0x23')]]={};this['channels'][_0x311fdb[_0x3860('0x23')]]['channel']=_0x311fdb['channel'];logger[_0x3860('0x26')](_0x311fdb[_0x3860('0x23')],'\x20syncNewchannel\x20');}};Fax['prototype']['syncVarSet']=function(_0x1b2e4d){if(this[_0x3860('0x22')][_0x1b2e4d[_0x3860('0x23')]]){for(var _0x371f3a in _0x1b2e4d[_0x3860('0x28')]){if(_0x1b2e4d[_0x3860('0x28')]['hasOwnProperty'](_0x371f3a)){this['channels'][_0x1b2e4d[_0x3860('0x23')]][_0x371f3a]=_0x1b2e4d[_0x3860('0x29')];}}}};Fax['prototype'][_0x3860('0x12')]=function(_0x3d5143){if(this[_0x3860('0x22')][_0x3d5143[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x3d5143['uniqueid']][_0x3860('0x2a')]=_0x3d5143[_0x3860('0x2a')];this[_0x3860('0x22')][_0x3d5143['uniqueid']][_0x3860('0x2b')]=_0x3d5143['channelstatedesc'];}};Fax[_0x3860('0x1d')]['syncNewExten']=function(_0x1c498c){if(this[_0x3860('0x22')][_0x1c498c[_0x3860('0x23')]]){for(var _0x47e350 in _0x1c498c[_0x3860('0x28')]){if(_0x1c498c[_0x3860('0x28')]['hasOwnProperty'](_0x47e350)){this[_0x3860('0x22')][_0x1c498c['uniqueid']][_0x47e350]=_0x1c498c[_0x3860('0x29')];}}}};Fax[_0x3860('0x1d')][_0x3860('0x16')]=function(_0x2fc231){if(this[_0x3860('0x22')][_0x2fc231[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x2fc231['uniqueid']][_0x3860('0x2c')]=_0x2fc231[_0x3860('0x2c')];this['channels'][_0x2fc231[_0x3860('0x23')]][_0x3860('0x2d')]=_0x2fc231[_0x3860('0x2d')];this['channels'][_0x2fc231['uniqueid']][_0x3860('0x2e')]=_0x2fc231[_0x3860('0x2e')];this[_0x3860('0x22')][_0x2fc231[_0x3860('0x23')]]['filename']=_0x2fc231['filename'];logger[_0x3860('0x26')](_0x2fc231[_0x3860('0x23')],_0x3860('0x2f'));}};Fax[_0x3860('0x1d')][_0x3860('0x18')]=function(_0x4df2a9){var _0x424424=this;if(this[_0x3860('0x22')][_0x4df2a9['uniqueid']]){var _0x59c662=this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]]['id'];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x30')]=_0x4df2a9['remotestationid'];this[_0x3860('0x22')][_0x4df2a9['uniqueid']][_0x3860('0x31')]=_0x4df2a9[_0x3860('0x31')];this['channels'][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x2e')]=_0x4df2a9['localstationid'];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x32')]=_0x4df2a9[_0x3860('0x32')];this['channels'][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x33')]=_0x4df2a9[_0x3860('0x33')];this['channels'][_0x4df2a9[_0x3860('0x23')]]['filename']=_0x4df2a9[_0x3860('0x34')];this[_0x3860('0x22')][_0x4df2a9[_0x3860('0x23')]][_0x3860('0x35')]=_0x4df2a9[_0x3860('0x35')];if(this[_0x3860('0x22')][_0x4df2a9['uniqueid']][_0x3860('0x31')]>0x0){tiff2pdf(_0x4df2a9[_0x3860('0x34')],'/var/opt/motion2/server/files/attachments/',function(_0x531402){logger[_0x3860('0x26')](_0x4df2a9[_0x3860('0x23')],'\x20result\x20conversion\x20file\x20',_0x531402[_0x3860('0x36')]);attachment[_0x3860('0x37')]({'name':path['parse'](_0x4df2a9[_0x3860('0x34')])[_0x3860('0x25')],'basename':path[_0x3860('0x38')](_0x4df2a9[_0x3860('0x34')])[_0x3860('0x25')]+_0x3860('0x39'),'type':_0x3860('0x3a')})[_0x3860('0x3b')](function(_0x1a3f39){faxAccount[_0x3860('0x3c')](_0x59c662,{'from':_0x4df2a9[_0x3860('0x35')],'mapKey':_0x3860('0x3d'),'body':path[_0x3860('0x38')](_0x4df2a9['filename'])[_0x3860('0x25')]+'.pdf','AttachmentId':_0x1a3f39['id']})[_0x3860('0x3e')](function(_0x770334){logger[_0x3860('0x3f')](_0x4df2a9[_0x3860('0x23')],_0x3860('0x40'),JSON[_0x3860('0x41')](_0x770334));});})[_0x3860('0x3e')](function(_0x27ef92){logger['error'](_0x4df2a9[_0x3860('0x23')],_0x3860('0x42'),JSON[_0x3860('0x41')](_0x27ef92));});});}logger['info'](_0x4df2a9[_0x3860('0x23')],_0x3860('0x42'));}};Fax[_0x3860('0x1d')][_0x3860('0x1c')]=function(_0x5ed2db){if(this['actions'][_0x5ed2db[_0x3860('0x23')]]){_['merge'](this[_0x3860('0x22')][_0x5ed2db[_0x3860('0x23')]],_[_0x3860('0x43')](_0x5ed2db,['response',_0x3860('0x44')]));}};function updateStatus(_0x5a019a){if(_0x5a019a[_0x3860('0x45')]){faxMessage['update'](_0x5a019a[_0x3860('0x45')],{'failMessage':_0x3860('0x46')})[_0x3860('0x3b')](function(_0x4b5790){ut['logger'](_0x3860('0x47'),_0x4b5790);})[_0x3860('0x3e')](function(_0x478dd9){ut[_0x3860('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x478dd9);});}else{ut[_0x3860('0x48')](_0x3860('0x49'));}}Fax[_0x3860('0x1d')][_0x3860('0x4a')]=function(_0x426497,_0xe93a04,_0x3fad85){var _0x5a9987=this;var _0x2fb762={};if(_0xe93a04){_0x2fb762={'read':_0xe93a04};}else{_0x2fb762={'failMessage':_0x3fad85};}if(this[_0x3860('0xe')][_0x426497][_0x3860('0x45')]){faxMessage[_0x3860('0x4b')](this[_0x3860('0xe')][_0x426497][_0x3860('0x45')],_0x2fb762)['then'](function(_0x2cf48c){ut[_0x3860('0x48')](_0x3860('0x4c'),_0x2cf48c);})[_0x3860('0x3e')](function(_0x3a55e7){ut[_0x3860('0x48')](_0x3860('0x4d'),_0x3a55e7);})[_0x3860('0x4e')](function(){delete _0x5a9987['channels'][_0x426497];delete _0x5a9987[_0x3860('0xe')][_0x426497];});}else{ut[_0x3860('0x48')]('[Fax][Message][NoUpdate2]');delete this[_0x3860('0x22')][_0x426497];delete this[_0x3860('0xe')][_0x426497];}};Fax[_0x3860('0x1d')]['syncHangup']=function(_0x17d2df){var _0x5f4b87=this;if(this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]){if(this[_0x3860('0xe')][_0x17d2df[_0x3860('0x23')]]){this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]['id']=this[_0x3860('0xe')][_0x17d2df[_0x3860('0x23')]]['id'];this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]][_0x3860('0x25')]=this[_0x3860('0xe')][_0x17d2df['uniqueid']]['name'];}logger['info'](_0x17d2df[_0x3860('0x23')],this['actions'][_0x17d2df['uniqueid']]?_0x3860('0x4f'):_0x3860('0x50'),JSON[_0x3860('0x41')](this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]));if(this[_0x3860('0xe')][_0x17d2df['uniqueid']]){if(this['channels'][_0x17d2df['uniqueid']][_0x3860('0x51')]>0x0&&this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]]['faxstatus']===_0x3860('0x52')){this['updateStatus'](_0x17d2df[_0x3860('0x23')],!![]);}else{this[_0x3860('0x4a')](_0x17d2df['uniqueid'],![],this[_0x3860('0x22')][_0x17d2df[_0x3860('0x23')]][_0x3860('0x53')]?_0x3860('0x54')+this['channels'][_0x17d2df[_0x3860('0x23')]][_0x3860('0x53')]:_0x3860('0x55'));}}}};Fax['prototype']['send']=function(_0x26e54b){var _0x2ba958=this;return new BPromise(function(_0xe67023,_0x1ca0e7){_0x2ba958[_0x3860('0x56')](_0x26e54b,_0x2ba958[_0x3860('0xc')][_0x26e54b['FaxAccountId']])[_0x3860('0x3b')](function(_0x4fe4e8){ut['logger'](_0x3860('0x57'),_0x4fe4e8);_0xe67023(ut[_0x3860('0x36')](_0x3860('0x58')));})[_0x3860('0x3e')](function(_0x36431e){ut[_0x3860('0x48')]('[Fax][execOriginate][failure]',_0x36431e);updateStatus(_0x26e54b);_0x1ca0e7(ut[_0x3860('0x36')](_0x3860('0x59')));});});};Fax[_0x3860('0x1d')][_0x3860('0x5a')]=function(_0x1478d9){var _0x2a5c06=this;return new BPromise(function(_0x5f2c66,_0x1ae31b){var _0x81010b=_0x2a5c06[_0x3860('0x5b')](_0x2a5c06['faxAccounts'][_0x1478d9['FaxAccountId']][_0x3860('0x5c')],_0x1478d9);if(_0x81010b[_0x3860('0x5d')]){_0x5f2c66(ut[_0x3860('0x36')](_0x3860('0x5e')));}else{_0x1ae31b(ut[_0x3860('0x36')](_0x81010b['message']));}});};function originate(_0x48ade7,_0x2db53f,_0x393bc4){return new BPromise(function(_0x47e144,_0x5d9416){if(_0x393bc4){var _0x2fd2ec=util[_0x3860('0x5f')]('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[_0x3860('0x38')](_0x48ade7[_0x3860('0x60')])[_0x3860('0x25')],_0x48ade7[_0x3860('0x60')]);gs['execute'](_0x2fd2ec)[_0x3860('0x3b')](function(){_0x48ade7[_0x3860('0x60')]=util['format']('%s/%s.tif',path[_0x3860('0x38')](_0x48ade7[_0x3860('0x60')])['dir'],path[_0x3860('0x38')](_0x48ade7['path'])[_0x3860('0x25')]);_0x2db53f['XMF-PATH']=_0x48ade7['path'];ut[_0x3860('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0x3860('0x61')](ut[_0x3860('0x62')](_0x48ade7,_0x2db53f))[_0x3860('0x3b')](function(_0x2fd2f4){_0x47e144(_0x2fd2f4);})[_0x3860('0x3e')](function(_0x43c5a1){_0x5d9416(_0x43c5a1);});})['catch'](function(_0x3756b3){_0x5d9416(_0x3756b3);});}else{ami[_0x3860('0x61')](ut[_0x3860('0x62')](_0x48ade7,_0x2db53f))['then'](function(_0x352a44){_0x47e144(_0x352a44);})['catch'](function(_0x30e093){_0x5d9416(_0x30e093);});}});}Fax[_0x3860('0x1d')]['execOriginate']=function(_0x73732c,_0x2cd731){var _0x1e94c4=this;return new BPromise(function(_0x5e3276,_0x572707){var _0x5a282a=uuid['v4']();var _0x4c0914=ut[_0x3860('0x63')](_0x73732c,_0x2cd731);_0x1e94c4[_0x3860('0xe')][_0x5a282a]=new Action(_0x5a282a,_0x2cd731,_0x73732c);var _0x3f8b7c=_0x1e94c4[_0x3860('0xe')][_0x5a282a];if(path['parse'](_0x73732c['path'])[_0x3860('0x64')]===_0x3860('0x39')){originate(_0x3f8b7c,_0x4c0914,!![])[_0x3860('0x3b')](function(_0x61798b){_0x5e3276(_0x61798b);})['catch'](function(_0x3a7c0c){_0x572707(_0x3a7c0c);});}else{originate(_0x3f8b7c,_0x4c0914,![])[_0x3860('0x3b')](function(_0x49a4e6){_0x5e3276(_0x49a4e6);})['catch'](function(_0x32cbe8){_0x572707(_0x32cbe8);});}});};Fax[_0x3860('0x1d')][_0x3860('0x65')]=function(_0x27894f){return!_['isNil'](_0x27894f)&&!_['isNil'](_0x27894f[_0x3860('0x25')])&&!_['isNil'](_0x27894f[_0x3860('0x66')])&&_0x27894f[_0x3860('0x66')]&&!_['isNil'](this['trunks'][util['format'](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])])&&!_['isNil'](this[_0x3860('0xd')][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')])&&(this['trunks'][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')]===_0x3860('0x68')||this['trunks'][util[_0x3860('0x5f')](_0x3860('0x67'),_0x27894f[_0x3860('0x25')])][_0x3860('0x2d')]===_0x3860('0x69'));};Fax['prototype']['checkTrunk']=function(_0x196c50,_0x2f3eb6){if(!this[_0x3860('0x65')](_0x196c50)){ut[_0x3860('0x48')](_0x3860('0x6a'),_[_0x3860('0x6b')](_0x196c50)?'':_0x196c50[_0x3860('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x3860('0x6c')};}if(_[_0x3860('0x6b')](_0x2f3eb6['fax'])){ut[_0x3860('0x48')](_0x3860('0x6d'),JSON[_0x3860('0x41')](_0x2f3eb6));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3860('0x6b')](_0x2f3eb6[_0x3860('0x60')])){ut['logger'](_0x3860('0x6e'),JSON['stringify'](_0x2f3eb6));return{'isValid':![],'message':_0x3860('0x6f')};}return{'isValid':!![],'message':_0x3860('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 05705e0..2d6a1c6 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 _0xa3f8=['lodash','../rpc/faxAccount','error','inspect','notify','then','util','../../../config/logger','preview'];(function(_0x57d73c,_0x526dcc){var _0x5a207d=function(_0x5cf38d){while(--_0x5cf38d){_0x57d73c['push'](_0x57d73c['shift']());}};_0x5a207d(++_0x526dcc);}(_0xa3f8,0xc3));var _0x8a3f=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xa3f8[_0x1e5068];return _0x2230b6;};'use strict';var util=require(_0x8a3f('0x0'));var BPromise=require('bluebird');var logger=require(_0x8a3f('0x1'))(_0x8a3f('0x2'));var _=require(_0x8a3f('0x3'));var faxAccount=require(_0x8a3f('0x4'));function loggerCatch(_0x1a0d97){return function(_0x3a444e){logger[_0x8a3f('0x5')](_0x1a0d97,util[_0x8a3f('0x6')](_0x3a444e,{'showHidden':![],'depth':null}));};}exports[_0x8a3f('0x7')]=function(_0x4ac832,_0x45bf3b){return BPromise['resolve']()[_0x8a3f('0x8')](faxAccount[_0x8a3f('0x7')](_0x4ac832,_0x45bf3b))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x5e74=['util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x5e74,0x14a));var _0x45e7=function(_0x176b84,_0x58014f){_0x176b84=_0x176b84-0x0;var _0x27b306=_0x5e74[_0x176b84];return _0x27b306;};'use strict';var util=require(_0x45e7('0x0'));var BPromise=require(_0x45e7('0x1'));var logger=require(_0x45e7('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x45e7('0x3'));function loggerCatch(_0x2fe94b){return function(_0x519106){logger[_0x45e7('0x4')](_0x2fe94b,util[_0x45e7('0x5')](_0x519106,{'showHidden':![],'depth':null}));};}exports[_0x45e7('0x6')]=function(_0x550e70,_0x195a57){return BPromise[_0x45e7('0x7')]()[_0x45e7('0x8')](faxAccount[_0x45e7('0x6')](_0x550e70,_0x195a57))[_0x45e7('0x9')](loggerCatch(_0x45e7('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 4874cb7..f575ac1 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 _0x5246=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x3461a5,_0x1eb1cd){var _0xad8a90=function(_0x497906){while(--_0x497906){_0x3461a5['push'](_0x3461a5['shift']());}};_0xad8a90(++_0x1eb1cd);}(_0x5246,0xe3));var _0x6524=function(_0x10d7d6,_0xbef48a){_0x10d7d6=_0x10d7d6-0x0;var _0x63ce53=_0x5246[_0x10d7d6];return _0x63ce53;};'use strict';var util=require(_0x6524('0x0'));var logger=require(_0x6524('0x1'))('fax');var BPromise=require(_0x6524('0x2'));var exec=require(_0x6524('0x3'))[_0x6524('0x4')];exports[_0x6524('0x5')]=function(_0x22cac0){return new BPromise(function(_0x22db98,_0x33386c){exec(_0x22cac0,function(_0x3749d0,_0x3c3bee,_0x526cc5){logger[_0x6524('0x6')](_0x6524('0x7'),_0x3c3bee);if(_0x3749d0){logger[_0x6524('0x6')](_0x6524('0x7'),_0x6524('0x8'),util[_0x6524('0x9')](_0x3749d0,{'showHidden':![],'depth':null}),_0x3c3bee,_0x526cc5);_0x33386c(_0x3749d0);}_0x22db98(_0x3c3bee);});});}; \ No newline at end of file +var _0x0bcc=['info','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x0bcc,0x92));var _0xc0bc=function(_0x56811d,_0x2a4ac7){_0x56811d=_0x56811d-0x0;var _0x38e02c=_0x0bcc[_0x56811d];return _0x38e02c;};'use strict';var util=require(_0xc0bc('0x0'));var logger=require(_0xc0bc('0x1'))(_0xc0bc('0x2'));var BPromise=require(_0xc0bc('0x3'));var exec=require(_0xc0bc('0x4'))[_0xc0bc('0x5')];exports[_0xc0bc('0x6')]=function(_0x3616f){return new BPromise(function(_0x3e1f0a,_0x3a4cb1){exec(_0x3616f,function(_0x266ce2,_0x1b8fff,_0x5adc3a){logger['info'](_0xc0bc('0x7'),_0x1b8fff);if(_0x266ce2){logger[_0xc0bc('0x8')]('Exec\x20gs',_0xc0bc('0x9'),util[_0xc0bc('0xa')](_0x266ce2,{'showHidden':![],'depth':null}),_0x1b8fff,_0x5adc3a);_0x3a4cb1(_0x266ce2);}_0x3e1f0a(_0x1b8fff);});});}; \ 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 953a76f..3b035bb 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 _0xa40c=['ecm','headerinfo','maxrate','format','gateway','faxdetect','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','fax','message','logger','inspect'];(function(_0x3342af,_0xe71ed){var _0x17ff38=function(_0x390d19){while(--_0x390d19){_0x3342af['push'](_0x3342af['shift']());}};_0x17ff38(++_0xe71ed);}(_0xa40c,0x1f1));var _0xca40=function(_0x52cc29,_0x5568a1){_0x52cc29=_0x52cc29-0x0;var _0x3fd87c=_0xa40c[_0x52cc29];return _0x3fd87c;};'use strict';var util=require(_0xca40('0x0'));var _=require(_0xca40('0x1'));var moment=require(_0xca40('0x2'));var logger=require('../../../../config/logger')(_0xca40('0x3'));exports[_0xca40('0x4')]=function(_0x5cb505){return{'message':_0x5cb505};};exports[_0xca40('0x5')]=function(_0x58c946,_0x58b62d){logger['info'](_0x58c946,util[_0xca40('0x6')](_0x58b62d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x9943a0,_0x1d8e29){var _0x4a3bfb={'XMF-ECM':_0x1d8e29[_0xca40('0x7')],'XMF-HEADERINFO':_0x1d8e29[_0xca40('0x8')],'XMF-MINRATE':_0x1d8e29['minrate'],'XMF-MAXRATE':_0x1d8e29[_0xca40('0x9')],'XMF-MODEM':util[_0xca40('0xa')]('\x22%s\x22',_0x1d8e29['modem']),'XMF-GATEWAY':_0x1d8e29[_0xca40('0xb')],'XMF-FAXDETECT':_0x1d8e29[_0xca40('0xc')],'XMF-T38TIMEOUT':_0x1d8e29[_0xca40('0xd')],'XMF-LOCALSTATIONID':_0x1d8e29['localstationid'],'XMF-PATH':_0x9943a0[_0xca40('0xe')]};return _0x4a3bfb;};exports['variablesAction']=function(_0x16c022,_0xa50a09){return{'actionid':_0x16c022[_0xca40('0xf')],'action':_0xca40('0x10'),'channel':_0x16c022[_0xca40('0x11')],'Exten':_0xca40('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xca40('0xa')](_0xca40('0x13'),_0x16c022['headerinfo']?_0x16c022[_0xca40('0x8')]:'',_0x16c022[_0xca40('0x14')]),'variable':_0xa50a09,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x16c022[_0xca40('0xf')]};}; \ No newline at end of file +var _0xb453=['gateway','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','format','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','info','addVariables','ecm','minrate','maxrate','\x22%s\x22','modem'];(function(_0x398e59,_0x183560){var _0x409032=function(_0x31ad91){while(--_0x31ad91){_0x398e59['push'](_0x398e59['shift']());}};_0x409032(++_0x183560);}(_0xb453,0x68));var _0x3b45=function(_0x39849d,_0x162048){_0x39849d=_0x39849d-0x0;var _0x4b0657=_0xb453[_0x39849d];return _0x4b0657;};'use strict';var util=require(_0x3b45('0x0'));var _=require('lodash');var moment=require(_0x3b45('0x1'));var logger=require(_0x3b45('0x2'))('fax');exports['message']=function(_0x60d0d5){return{'message':_0x60d0d5};};exports['logger']=function(_0x35372f,_0xfb602d){logger[_0x3b45('0x3')](_0x35372f,util['inspect'](_0xfb602d,{'showHidden':![],'depth':null}));};exports[_0x3b45('0x4')]=function(_0x237843,_0xafe2b1){var _0x4c5c69={'XMF-ECM':_0xafe2b1[_0x3b45('0x5')],'XMF-HEADERINFO':_0xafe2b1['headerinfo'],'XMF-MINRATE':_0xafe2b1[_0x3b45('0x6')],'XMF-MAXRATE':_0xafe2b1[_0x3b45('0x7')],'XMF-MODEM':util['format'](_0x3b45('0x8'),_0xafe2b1[_0x3b45('0x9')]),'XMF-GATEWAY':_0xafe2b1[_0x3b45('0xa')],'XMF-FAXDETECT':_0xafe2b1['faxdetect'],'XMF-T38TIMEOUT':_0xafe2b1['t38timeout'],'XMF-LOCALSTATIONID':_0xafe2b1[_0x3b45('0xb')],'XMF-PATH':_0x237843['path']};return _0x4c5c69;};exports[_0x3b45('0xc')]=function(_0x6b9a01,_0x154a25){return{'actionid':_0x6b9a01[_0x3b45('0xd')],'action':'originate','channel':_0x6b9a01[_0x3b45('0xe')],'Exten':_0x3b45('0xf'),'Context':'from-sip','Priority':'1','callerid':util[_0x3b45('0x10')](_0x3b45('0x11'),_0x6b9a01[_0x3b45('0x12')]?_0x6b9a01[_0x3b45('0x12')]:'',_0x6b9a01[_0x3b45('0xb')]),'variable':_0x154a25,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6b9a01[_0x3b45('0xd')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 266da3f..74547e0 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 _0x807f=['error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x807f,0x8a));var _0xf807=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x807f[_0x386c3e];return _0x4b8e13;};'use strict';var BPromise=require(_0xf807('0x0'));var util=require('util');var moment=require(_0xf807('0x1'));var server=require(_0xf807('0x2'));var Realtime=require(_0xf807('0x3'));var Report=require(_0xf807('0x4'));var Acw=require(_0xf807('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xf807('0x6'));var Preview=require(_0xf807('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0xf807('0x8'));var voiceQueueReport=require(_0xf807('0x9'));var voiceCallReport=require(_0xf807('0xa'));var trunk=require(_0xf807('0xb'));var trigger=require(_0xf807('0xc'));var template=require(_0xf807('0xd'));var cmHopperHistory=require(_0xf807('0xe'));var campaign=require(_0xf807('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf807('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xf807('0x11'));var sugarcrm=require(_0xf807('0x12'));var freshdesk=require(_0xf807('0x13'));var desk=require(_0xf807('0x14'));var zoho=require(_0xf807('0x15'));var vtiger=require(_0xf807('0x16'));var freshsales=require(_0xf807('0x17'));var servicenow=require(_0xf807('0x18'));var dynamics365=require(_0xf807('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xf807('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf807('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf807('0x1b')](_0xf807('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf807('0x1d')](user[_0xf807('0x1e')]())[_0xf807('0x1d')](realtime['initAgents']())['then'](user['getTelephones']())[_0xf807('0x1d')](realtime[_0xf807('0x1f')]())['then'](trunk[_0xf807('0x20')]())['then'](realtime[_0xf807('0x21')]())['then'](voiceQueue['getVoiceQueues']())['then'](realtime[_0xf807('0x22')]())[_0xf807('0x1d')](trigger['getTriggers']())[_0xf807('0x1d')](realtime['initTriggers']())[_0xf807('0x1d')](template[_0xf807('0x23')]())[_0xf807('0x1d')](realtime[_0xf807('0x24')]())[_0xf807('0x1d')](zendesk[_0xf807('0x25')]())[_0xf807('0x1d')](realtime['initZendeskAccounts']())[_0xf807('0x1d')](salesforce[_0xf807('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0xf807('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xf807('0x1d')](realtime['initSugarcrmAccounts']())[_0xf807('0x1d')](freshdesk[_0xf807('0x27')]())['then'](realtime['initFreshdeskAccounts']())[_0xf807('0x1d')](desk['getDeskAccounts']())[_0xf807('0x1d')](realtime[_0xf807('0x28')]())['then'](zoho[_0xf807('0x29')]())[_0xf807('0x1d')](realtime[_0xf807('0x2a')]())[_0xf807('0x1d')](vtiger[_0xf807('0x2b')]())[_0xf807('0x1d')](realtime[_0xf807('0x2c')]())[_0xf807('0x1d')](freshsales[_0xf807('0x2d')]())[_0xf807('0x1d')](realtime['initFreshsalesAccounts']())[_0xf807('0x1d')](servicenow[_0xf807('0x2e')]())[_0xf807('0x1d')](realtime[_0xf807('0x2f')]())[_0xf807('0x1d')](dynamics365[_0xf807('0x30')]())['then'](realtime[_0xf807('0x31')]())[_0xf807('0x1d')](campaign[_0xf807('0x32')]())[_0xf807('0x1d')](realtime[_0xf807('0x33')]())['then'](voiceExtension[_0xf807('0x34')]())[_0xf807('0x1d')](realtime[_0xf807('0x35')]())[_0xf807('0x1d')](faxAccount['getFaxAccounts']())[_0xf807('0x1d')](realtime[_0xf807('0x36')]())[_0xf807('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xf807('0x1d')](voiceQueueReport[_0xf807('0x37')]())[_0xf807('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xf807('0x38')]())[_0xf807('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0xf807('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0xf807('0x1d')](realtime['initCampaignHopperHistory']())[_0xf807('0x1d')](voiceCallReport[_0xf807('0x39')]())[_0xf807('0x1d')](realtime[_0xf807('0x3a')]())[_0xf807('0x3b')](function(_0x29e03e){logger[_0xf807('0x3c')](_0xf807('0x3d'),util[_0xf807('0x3e')](_0x29e03e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf807('0x3f')](realtime,preview,fax)[_0xf807('0x1d')](function(_0x4126bb){return initRealtime();})[_0xf807('0x1d')](function(){return initParams();})[_0xf807('0x1d')](function(){report[_0xf807('0x40')]();setInterval(initRealtime,0x1388);})[_0xf807('0x3b')](function(_0x57c0bc){logger[_0xf807('0x3c')](_0xf807('0x41'),util[_0xf807('0x3e')](_0x57c0bc,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xa121=['getVoiceQueues','getTriggers','initTriggers','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xa121,0xb7));var _0x1a12=function(_0x4e8603,_0x34acb9){_0x4e8603=_0x4e8603-0x0;var _0x259613=_0xa121[_0x4e8603];return _0x259613;};'use strict';var BPromise=require('bluebird');var util=require(_0x1a12('0x0'));var moment=require(_0x1a12('0x1'));var server=require(_0x1a12('0x2'));var Realtime=require(_0x1a12('0x3'));var Report=require('./report');var Acw=require(_0x1a12('0x4'));var Trigger=require(_0x1a12('0x5'));var Dialer=require(_0x1a12('0x6'));var Preview=require(_0x1a12('0x7'));var Fax=require(_0x1a12('0x8'));var user=require(_0x1a12('0x9'));var voiceQueue=require(_0x1a12('0xa'));var voiceQueueReport=require(_0x1a12('0xb'));var voiceCallReport=require(_0x1a12('0xc'));var trunk=require(_0x1a12('0xd'));var trigger=require('./rpc/trigger');var template=require(_0x1a12('0xe'));var cmHopperHistory=require(_0x1a12('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x1a12('0x10'));var salesforce=require(_0x1a12('0x11'));var sugarcrm=require(_0x1a12('0x12'));var freshdesk=require(_0x1a12('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1a12('0x14'));var freshsales=require(_0x1a12('0x15'));var servicenow=require(_0x1a12('0x16'));var dynamics365=require(_0x1a12('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x1a12('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1a12('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1a12('0x19')](_0x1a12('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1a12('0x1b')]()[_0x1a12('0x1c')](user[_0x1a12('0x1d')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x1e')]())[_0x1a12('0x1c')](user['getTelephones']())[_0x1a12('0x1c')](realtime[_0x1a12('0x1f')]())['then'](trunk['getTrunks']())['then'](realtime[_0x1a12('0x20')]())[_0x1a12('0x1c')](voiceQueue[_0x1a12('0x21')]())[_0x1a12('0x1c')](realtime['initVoiceQueues']())[_0x1a12('0x1c')](trigger[_0x1a12('0x22')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x23')]())[_0x1a12('0x1c')](template['getTemplates']())['then'](realtime['initTemplates']())[_0x1a12('0x1c')](zendesk['getZendeskAccounts']())[_0x1a12('0x1c')](realtime[_0x1a12('0x24')]())['then'](salesforce[_0x1a12('0x25')]())[_0x1a12('0x1c')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x1a12('0x26')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x27')]())[_0x1a12('0x1c')](freshdesk[_0x1a12('0x28')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x29')]())['then'](desk[_0x1a12('0x2a')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x2b')]())['then'](zoho[_0x1a12('0x2c')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x2d')]())[_0x1a12('0x1c')](vtiger['getVtigerAccounts']())[_0x1a12('0x1c')](realtime[_0x1a12('0x2e')]())[_0x1a12('0x1c')](freshsales[_0x1a12('0x2f')]())['then'](realtime[_0x1a12('0x30')]())['then'](servicenow[_0x1a12('0x31')]())['then'](realtime[_0x1a12('0x32')]())[_0x1a12('0x1c')](dynamics365[_0x1a12('0x33')]())['then'](realtime[_0x1a12('0x34')]())[_0x1a12('0x1c')](campaign[_0x1a12('0x35')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x36')]())['then'](voiceExtension[_0x1a12('0x37')]())[_0x1a12('0x1c')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x1a12('0x38')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x39')]())[_0x1a12('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x1a12('0x1b')]()[_0x1a12('0x1c')](voiceQueueReport[_0x1a12('0x3a')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x3b')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1a12('0x1c')](realtime[_0x1a12('0x3c')]())['then'](cmHopperHistory[_0x1a12('0x3d')]())['then'](realtime[_0x1a12('0x3e')]())[_0x1a12('0x1c')](voiceCallReport[_0x1a12('0x3f')]())[_0x1a12('0x1c')](realtime[_0x1a12('0x40')]())['catch'](function(_0x3cb8ed){logger[_0x1a12('0x41')](_0x1a12('0x42'),util[_0x1a12('0x43')](_0x3cb8ed,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1a12('0x44')](realtime,preview,fax)[_0x1a12('0x1c')](function(_0x20697b){return initRealtime();})['then'](function(){return initParams();})[_0x1a12('0x1c')](function(){report[_0x1a12('0x45')]();setInterval(initRealtime,0x1388);})[_0x1a12('0x46')](function(_0x5b39cc){logger[_0x1a12('0x41')](_0x1a12('0x47'),util['inspect'](_0x5b39cc,{'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 db1de70..270e47b 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0xf8636f,_0x3f1e84){var _0x58f657=function(_0x3afaad){while(--_0x3afaad){_0xf8636f['push'](_0xf8636f['shift']());}};_0x58f657(++_0x3f1e84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0xddd396,_0x32a0e2){var _0x1b458f=function(_0x350d34){while(--_0x350d34){_0xddd396['push'](_0xddd396['shift']());}};_0x1b458f(++_0x32a0e2);}(_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 a101435..c23431d 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 _0x6263=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6263,0x170));var _0x3626=function(_0x594168,_0x3ac22f){_0x594168=_0x594168-0x0;var _0x31645f=_0x6263[_0x594168];return _0x31645f;};'use strict';function Campaign(_0x46235c){this['id']=_0x46235c['id']||0x0;this['name']=_0x46235c[_0x3626('0x0')]||'';this[_0x3626('0x1')]=_0x46235c[_0x3626('0x1')]||_0x3626('0x2');this['originated']=0x0;this[_0x3626('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x3626('0x4')]=0x0;this[_0x3626('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x3626('0x6')]=_0x46235c[_0x3626('0x6')];this[_0x3626('0x7')]=_0x46235c['limitCalls'];this['dialTimezone']=_0x46235c[_0x3626('0x8')]||null;this[_0x3626('0x9')]=_0x46235c['dialGlobalInterval']?_0x46235c[_0x3626('0x9')]:null;this[_0x3626('0xa')]=_0x46235c[_0x3626('0xa')];this['dialOriginateCallerIdNumber']=_0x46235c[_0x3626('0xb')];this['dialOriginateTimeout']=_0x46235c[_0x3626('0xc')]||0x1e;this[_0x3626('0xd')]=_0x46235c['dialCongestionMaxRetry'];this[_0x3626('0xe')]=_0x46235c['dialCongestionRetryFrequency'];this[_0x3626('0xf')]=_0x46235c[_0x3626('0xf')];this['dialBusyRetryFrequency']=_0x46235c[_0x3626('0x10')];this[_0x3626('0x11')]=_0x46235c[_0x3626('0x11')];this[_0x3626('0x12')]=_0x46235c[_0x3626('0x12')];this[_0x3626('0x13')]=_0x46235c[_0x3626('0x13')];this[_0x3626('0x14')]=_0x46235c['dialNoSuchNumberMaxRetry']||0x3;this[_0x3626('0x15')]=_0x46235c[_0x3626('0x15')]||0x96;this[_0x3626('0x16')]=_0x46235c[_0x3626('0x16')]||0x3;this[_0x3626('0x17')]=_0x46235c[_0x3626('0x17')]||0x96;this[_0x3626('0x18')]=_0x46235c[_0x3626('0x18')]||0x3;this[_0x3626('0x19')]=_0x46235c[_0x3626('0x19')]||0x96;this[_0x3626('0x1a')]=_0x46235c[_0x3626('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x46235c[_0x3626('0x1b')]||0x96;this[_0x3626('0x1c')]=_0x46235c['dialAgentRejectMaxRetry']||0x3;this[_0x3626('0x1d')]=_0x46235c['dialAgentRejectRetryFrequency']||0x96;this[_0x3626('0x1e')]=_0x46235c[_0x3626('0x1e')]||'DESC';this[_0x3626('0x1f')]=_0x46235c[_0x3626('0x1f')]||undefined;this[_0x3626('0x20')]=_0x46235c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x3626('0x21')]=_0x46235c[_0x3626('0x21')]||undefined;this[_0x3626('0x22')]=_0x46235c[_0x3626('0x22')]?_0x46235c[_0x3626('0x22')]:undefined;this['Trunk']=_0x46235c[_0x3626('0x23')]?_0x46235c[_0x3626('0x23')]:undefined;this['Interval']=_0x46235c[_0x3626('0x24')]?_0x46235c[_0x3626('0x24')]:undefined;this[_0x3626('0x25')]=_0x46235c[_0x3626('0x25')]?_0x46235c[_0x3626('0x25')]:undefined;this[_0x3626('0x26')]=_0x46235c['SquareProject']?_0x46235c['SquareProject'][_0x3626('0x0')]:undefined;this['dialAMDActive']=_0x46235c[_0x3626('0x27')]||![];this['dialAMDInitialSilence']=_0x46235c[_0x3626('0x28')];this[_0x3626('0x29')]=_0x46235c[_0x3626('0x29')];this[_0x3626('0x2a')]=_0x46235c[_0x3626('0x2a')];this['dialAMDTotalAnalysisTime']=_0x46235c[_0x3626('0x2b')];this[_0x3626('0x2c')]=_0x46235c[_0x3626('0x2c')];this[_0x3626('0x2d')]=_0x46235c[_0x3626('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x46235c['dialAMDMaximumNumberOfWords'];this[_0x3626('0x2e')]=_0x46235c[_0x3626('0x2e')];this[_0x3626('0x2f')]=_0x46235c[_0x3626('0x2f')];}module[_0x3626('0x30')]=Campaign; \ No newline at end of file +var _0x1a4e=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x704940,_0x15a3b3){var _0x17460a=function(_0x29fb66){while(--_0x29fb66){_0x704940['push'](_0x704940['shift']());}};_0x17460a(++_0x15a3b3);}(_0x1a4e,0x15a));var _0xe1a4=function(_0x258b00,_0x28e9b0){_0x258b00=_0x258b00-0x0;var _0x3ca676=_0x1a4e[_0x258b00];return _0x3ca676;};'use strict';function Campaign(_0x2d7a98){this['id']=_0x2d7a98['id']||0x0;this[_0xe1a4('0x0')]=_0x2d7a98[_0xe1a4('0x0')]||'';this[_0xe1a4('0x1')]=_0x2d7a98[_0xe1a4('0x1')]||_0xe1a4('0x2');this[_0xe1a4('0x3')]=0x0;this[_0xe1a4('0x4')]=0x0;this[_0xe1a4('0x5')]=0x0;this[_0xe1a4('0x6')]=0x0;this[_0xe1a4('0x7')]='';this[_0xe1a4('0x8')]=!![];this[_0xe1a4('0x9')]=_0x2d7a98['active'];this[_0xe1a4('0xa')]=_0x2d7a98[_0xe1a4('0xa')];this[_0xe1a4('0xb')]=_0x2d7a98[_0xe1a4('0xb')]||null;this['dialGlobalInterval']=_0x2d7a98['dialGlobalInterval']?_0x2d7a98[_0xe1a4('0xc')]:null;this[_0xe1a4('0xd')]=_0x2d7a98[_0xe1a4('0xd')];this[_0xe1a4('0xe')]=_0x2d7a98[_0xe1a4('0xe')];this[_0xe1a4('0xf')]=_0x2d7a98[_0xe1a4('0xf')]||0x1e;this[_0xe1a4('0x10')]=_0x2d7a98['dialCongestionMaxRetry'];this[_0xe1a4('0x11')]=_0x2d7a98['dialCongestionRetryFrequency'];this[_0xe1a4('0x12')]=_0x2d7a98[_0xe1a4('0x12')];this['dialBusyRetryFrequency']=_0x2d7a98[_0xe1a4('0x13')];this[_0xe1a4('0x14')]=_0x2d7a98[_0xe1a4('0x14')];this[_0xe1a4('0x15')]=_0x2d7a98[_0xe1a4('0x15')];this[_0xe1a4('0x16')]=_0x2d7a98[_0xe1a4('0x16')];this['dialNoSuchNumberMaxRetry']=_0x2d7a98[_0xe1a4('0x17')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2d7a98[_0xe1a4('0x18')]||0x96;this[_0xe1a4('0x19')]=_0x2d7a98['dialDropMaxRetry']||0x3;this[_0xe1a4('0x1a')]=_0x2d7a98[_0xe1a4('0x1a')]||0x96;this[_0xe1a4('0x1b')]=_0x2d7a98[_0xe1a4('0x1b')]||0x3;this['dialAbandonedRetryFrequency']=_0x2d7a98[_0xe1a4('0x1c')]||0x96;this['dialMachineMaxRetry']=_0x2d7a98['dialMachineMaxRetry']||0x3;this[_0xe1a4('0x1d')]=_0x2d7a98[_0xe1a4('0x1d')]||0x96;this[_0xe1a4('0x1e')]=_0x2d7a98[_0xe1a4('0x1e')]||0x3;this[_0xe1a4('0x1f')]=_0x2d7a98[_0xe1a4('0x1f')]||0x96;this[_0xe1a4('0x20')]=_0x2d7a98[_0xe1a4('0x20')]||_0xe1a4('0x21');this['dialPrefix']=_0x2d7a98[_0xe1a4('0x22')]||undefined;this[_0xe1a4('0x23')]=_0x2d7a98[_0xe1a4('0x23')]||undefined;this['dialCutDigit']=_0x2d7a98[_0xe1a4('0x24')]||undefined;this[_0xe1a4('0x25')]=_0x2d7a98['TrunkBackup']?_0x2d7a98[_0xe1a4('0x25')]:undefined;this['Trunk']=_0x2d7a98[_0xe1a4('0x26')]?_0x2d7a98[_0xe1a4('0x26')]:undefined;this[_0xe1a4('0x27')]=_0x2d7a98['Interval']?_0x2d7a98[_0xe1a4('0x27')]:undefined;this[_0xe1a4('0x28')]=_0x2d7a98[_0xe1a4('0x28')]?_0x2d7a98[_0xe1a4('0x28')]:undefined;this[_0xe1a4('0x29')]=_0x2d7a98[_0xe1a4('0x28')]?_0x2d7a98[_0xe1a4('0x28')][_0xe1a4('0x0')]:undefined;this['dialAMDActive']=_0x2d7a98[_0xe1a4('0x2a')]||![];this[_0xe1a4('0x2b')]=_0x2d7a98[_0xe1a4('0x2b')];this[_0xe1a4('0x2c')]=_0x2d7a98[_0xe1a4('0x2c')];this[_0xe1a4('0x2d')]=_0x2d7a98['dialAMDAfterGreetingSilence'];this[_0xe1a4('0x2e')]=_0x2d7a98[_0xe1a4('0x2e')];this[_0xe1a4('0x2f')]=_0x2d7a98[_0xe1a4('0x2f')];this[_0xe1a4('0x30')]=_0x2d7a98[_0xe1a4('0x30')];this[_0xe1a4('0x31')]=_0x2d7a98[_0xe1a4('0x31')];this[_0xe1a4('0x32')]=_0x2d7a98['dialAMDSilenceThreshold'];this[_0xe1a4('0x33')]=_0x2d7a98['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3c91f1f..4833787 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 _0x9af6=['context','uniqueid','linkedid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x3d0632,_0x213d47){var _0x2637dd=function(_0x344469){while(--_0x344469){_0x3d0632['push'](_0x3d0632['shift']());}};_0x2637dd(++_0x213d47);}(_0x9af6,0x1d7));var _0x69af=function(_0x92d72e,_0x6e0a25){_0x92d72e=_0x92d72e-0x0;var _0x5760c1=_0x9af6[_0x92d72e];return _0x5760c1;};'use strict';function Channel(){this[_0x69af('0x0')]=null;this[_0x69af('0x1')]='';this[_0x69af('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x69af('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x69af('0x4')]='';this[_0x69af('0x5')]=0x0;this[_0x69af('0x6')]=0x0;this['exten']=0x0;this[_0x69af('0x7')]=![];this['answertime']=null;this[_0x69af('0x8')]=null;this[_0x69af('0x9')]=![];this[_0x69af('0xa')]=![];this[_0x69af('0xb')]='';this[_0x69af('0xc')]='';this[_0x69af('0xd')]=0x0;this[_0x69af('0xe')]=0x0;this[_0x69af('0xf')]=0x0;this['type']=null;this['tag']=null;this[_0x69af('0x10')]=null;this[_0x69af('0x11')]=![];this[_0x69af('0x12')]=null;this[_0x69af('0x13')]=null;this[_0x69af('0x14')]=[];this[_0x69af('0x15')]=undefined;this[_0x69af('0x16')]=undefined;this[_0x69af('0x17')]=undefined;this['mohtime']=0x0;}module[_0x69af('0x18')]=Channel; \ No newline at end of file +var _0xc0a6=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','lastdata','billableseconds','type','queue','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','calleridnum','calleridname'];(function(_0x19fe01,_0x2242d6){var _0x16bf47=function(_0x1eee7d){while(--_0x1eee7d){_0x19fe01['push'](_0x19fe01['shift']());}};_0x16bf47(++_0x2242d6);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x57012c,_0x457dd9){_0x57012c=_0x57012c-0x0;var _0x3bb06d=_0xc0a6[_0x57012c];return _0x3bb06d;};'use strict';function Channel(){this[_0x6c0a('0x0')]=null;this[_0x6c0a('0x1')]='';this['destinationchannel']='';this[_0x6c0a('0x2')]=0x0;this[_0x6c0a('0x3')]='';this[_0x6c0a('0x4')]=undefined;this[_0x6c0a('0x5')]=undefined;this[_0x6c0a('0x6')]=0x0;this[_0x6c0a('0x7')]='';this[_0x6c0a('0x8')]=0x0;this[_0x6c0a('0x9')]=0x0;this['exten']=0x0;this[_0x6c0a('0xa')]=![];this[_0x6c0a('0xb')]=null;this[_0x6c0a('0xc')]=null;this[_0x6c0a('0xd')]=![];this['abandoned']=![];this[_0x6c0a('0xe')]='';this[_0x6c0a('0xf')]='';this['duration']=0x0;this[_0x6c0a('0x10')]=0x0;this['holdtime']=0x0;this[_0x6c0a('0x11')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this['monitorFilename']=null;this[_0x6c0a('0x12')]=null;this['monitors']=[];this[_0x6c0a('0x13')]=undefined;this[_0x6c0a('0x14')]=undefined;this[_0x6c0a('0x15')]=undefined;this['mohtime']=0x0;}module[_0x6c0a('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 33ea990..411f3ca 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 _0x3ce4=['tokenSecret','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','token'];(function(_0x481401,_0x2d75a6){var _0x169a4c=function(_0x1fdc1f){while(--_0x1fdc1f){_0x481401['push'](_0x481401['shift']());}};_0x169a4c(++_0x2d75a6);}(_0x3ce4,0x1a7));var _0x43ce=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3ce4[_0x11005e];return _0x29338f;};'use strict';function DeskAccount(_0x30550b){this['id']=_0x30550b['id']||0x0;this[_0x43ce('0x0')]=_0x30550b[_0x43ce('0x0')]||'';this[_0x43ce('0x1')]=_0x30550b[_0x43ce('0x1')]||'';this[_0x43ce('0x2')]=_0x30550b[_0x43ce('0x2')]||'';this[_0x43ce('0x3')]=_0x30550b['authType']||'';this[_0x43ce('0x4')]=_0x30550b[_0x43ce('0x4')]||'';this[_0x43ce('0x5')]=_0x30550b['consumerKey']||'';this['consumerSecret']=_0x30550b['consumerSecret']||'';this[_0x43ce('0x6')]=_0x30550b['token']||'';this[_0x43ce('0x7')]=_0x30550b[_0x43ce('0x7')]||'';this['type']=_0x30550b['type']||'';this['serverUrl']=_0x30550b[_0x43ce('0x8')]||'';this[_0x43ce('0x9')]=_0x30550b[_0x43ce('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x8a53=['consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0xb60962,_0x1e85a1){var _0x2a892c=function(_0x2e73f3){while(--_0x2e73f3){_0xb60962['push'](_0xb60962['shift']());}};_0x2a892c(++_0x1e85a1);}(_0x8a53,0x125));var _0x38a5=function(_0x1b11ea,_0xe164b){_0x1b11ea=_0x1b11ea-0x0;var _0x5e9a75=_0x8a53[_0x1b11ea];return _0x5e9a75;};'use strict';function DeskAccount(_0x4249fb){this['id']=_0x4249fb['id']||0x0;this[_0x38a5('0x0')]=_0x4249fb[_0x38a5('0x0')]||'';this[_0x38a5('0x1')]=_0x4249fb['username']||'';this['remoteUri']=_0x4249fb[_0x38a5('0x2')]||'';this['authType']=_0x4249fb['authType']||'';this[_0x38a5('0x3')]=_0x4249fb['password']||'';this[_0x38a5('0x4')]=_0x4249fb[_0x38a5('0x4')]||'';this[_0x38a5('0x5')]=_0x4249fb[_0x38a5('0x5')]||'';this[_0x38a5('0x6')]=_0x4249fb[_0x38a5('0x6')]||'';this[_0x38a5('0x7')]=_0x4249fb[_0x38a5('0x7')]||'';this['type']=_0x4249fb['type']||'';this['serverUrl']=_0x4249fb[_0x38a5('0x8')]||'';this[_0x38a5('0x9')]=_0x4249fb[_0x38a5('0x9')]||{};}module[_0x38a5('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 540cd03..7ef5b4f 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 _0x878f=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x422965,_0x3c52a7){var _0xe01813=function(_0x2ae045){while(--_0x2ae045){_0x422965['push'](_0x422965['shift']());}};_0xe01813(++_0x3c52a7);}(_0x878f,0x173));var _0xf878=function(_0x141946,_0xb52142){_0x141946=_0x141946-0x0;var _0x229d95=_0x878f[_0x141946];return _0x229d95;};'use strict';function Dynamics365Account(_0x51758f){this['id']=_0x51758f['id']||0x0;this[_0xf878('0x0')]=_0x51758f[_0xf878('0x0')]||'';this[_0xf878('0x1')]=_0x51758f[_0xf878('0x1')]||'';this[_0xf878('0x2')]=_0x51758f[_0xf878('0x2')]||'';this[_0xf878('0x3')]=_0x51758f[_0xf878('0x3')]||'';this[_0xf878('0x4')]=_0x51758f[_0xf878('0x4')]||'';this[_0xf878('0x5')]=_0x51758f['clientId']||'';this['clientSecret']=_0x51758f[_0xf878('0x6')]||{};this[_0xf878('0x7')]=_0x51758f['serverUrl']||'';this['Configurations']=_0x51758f['Configurations']||{};}module[_0xf878('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x750a=['tenantId','clientId','clientSecret','serverUrl','exports','name','username','password','remoteUri'];(function(_0x102536,_0x3331a7){var _0x49bb85=function(_0x8ef7e1){while(--_0x8ef7e1){_0x102536['push'](_0x102536['shift']());}};_0x49bb85(++_0x3331a7);}(_0x750a,0x140));var _0xa750=function(_0x536350,_0x25e29e){_0x536350=_0x536350-0x0;var _0x47401a=_0x750a[_0x536350];return _0x47401a;};'use strict';function Dynamics365Account(_0x4eae95){this['id']=_0x4eae95['id']||0x0;this[_0xa750('0x0')]=_0x4eae95['name']||'';this['username']=_0x4eae95[_0xa750('0x1')]||'';this[_0xa750('0x2')]=_0x4eae95[_0xa750('0x2')]||'';this[_0xa750('0x3')]=_0x4eae95[_0xa750('0x3')]||'';this[_0xa750('0x4')]=_0x4eae95[_0xa750('0x4')]||'';this[_0xa750('0x5')]=_0x4eae95[_0xa750('0x5')]||'';this[_0xa750('0x6')]=_0x4eae95[_0xa750('0x6')]||{};this[_0xa750('0x7')]=_0x4eae95[_0xa750('0x7')]||'';this['Configurations']=_0x4eae95['Configurations']||{};}module[_0xa750('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 1b1f369..30000b4 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 _0x1a93=['SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x22dda1,_0x48d7f0){var _0x509548=function(_0x19b042){while(--_0x19b042){_0x22dda1['push'](_0x22dda1['shift']());}};_0x509548(++_0x48d7f0);}(_0x1a93,0x184));var _0x31a9=function(_0x46e326,_0x29eb81){_0x46e326=_0x46e326-0x0;var _0x75f642=_0x1a93[_0x46e326];return _0x75f642;};'use strict';function FaxAccount(_0xabfd0b){this['id']=_0xabfd0b['id']||0x0;this[_0x31a9('0x0')]=_0xabfd0b[_0x31a9('0x0')]||'';this[_0x31a9('0x1')]=_0xabfd0b[_0x31a9('0x1')];this['ecm']=_0xabfd0b[_0x31a9('0x2')];this[_0x31a9('0x3')]=_0xabfd0b[_0x31a9('0x3')];this[_0x31a9('0x4')]=_0xabfd0b[_0x31a9('0x4')];this['minrate']=_0xabfd0b[_0x31a9('0x5')]||0x960;this[_0x31a9('0x6')]=_0xabfd0b[_0x31a9('0x6')]||0x3840;this[_0x31a9('0x7')]=_0xabfd0b['modem']||'v17,v27,v29';this[_0x31a9('0x8')]=_0xabfd0b['gateway']||'no';this['faxdetect']=_0xabfd0b[_0x31a9('0x9')]||'no';this[_0x31a9('0xa')]=_0xabfd0b[_0x31a9('0xa')]||0x1388;this[_0x31a9('0xb')]=_0xabfd0b[_0x31a9('0xb')]||_0x31a9('0xc');this[_0x31a9('0xd')]=_0xabfd0b[_0x31a9('0xd')]?_0xabfd0b['Trunk']:undefined;this[_0x31a9('0xe')]=_0xabfd0b['ListId'];this['key']=_0xabfd0b[_0x31a9('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x02fe=['gateway','faxdetect','t38timeout','SIP','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0x02fe,0x1c7));var _0xe02f=function(_0x54279a,_0x24eaca){_0x54279a=_0x54279a-0x0;var _0xb24b1=_0x02fe[_0x54279a];return _0xb24b1;};'use strict';function FaxAccount(_0x323954){this['id']=_0x323954['id']||0x0;this[_0xe02f('0x0')]=_0x323954[_0xe02f('0x0')]||'';this[_0xe02f('0x1')]=_0x323954['description'];this[_0xe02f('0x2')]=_0x323954[_0xe02f('0x2')];this[_0xe02f('0x3')]=_0x323954[_0xe02f('0x3')];this['localstationid']=_0x323954[_0xe02f('0x4')];this['minrate']=_0x323954[_0xe02f('0x5')]||0x960;this[_0xe02f('0x6')]=_0x323954[_0xe02f('0x6')]||0x3840;this[_0xe02f('0x7')]=_0x323954[_0xe02f('0x7')]||_0xe02f('0x8');this[_0xe02f('0x9')]=_0x323954[_0xe02f('0x9')]||'no';this[_0xe02f('0xa')]=_0x323954[_0xe02f('0xa')]||'no';this[_0xe02f('0xb')]=_0x323954['t38timeout']||0x1388;this['tech']=_0x323954['tech']||_0xe02f('0xc');this['Trunk']=_0x323954[_0xe02f('0xd')]?_0x323954['Trunk']:undefined;this['ListId']=_0x323954['ListId'];this[_0xe02f('0xe')]=_0x323954[_0xe02f('0xe')];}module[_0xe02f('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 850b075..d9d972b 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 _0x857c=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x15a738,_0x180324){var _0x2cd2f8=function(_0x3dc413){while(--_0x3dc413){_0x15a738['push'](_0x15a738['shift']());}};_0x2cd2f8(++_0x180324);}(_0x857c,0x162));var _0xc857=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0x857c[_0x53f715];return _0x16c757;};'use strict';function FreshdeskAccount(_0x47de14){this['id']=_0x47de14['id']||0x0;this['name']=_0x47de14['name']||'';this[_0xc857('0x0')]=_0x47de14[_0xc857('0x0')]||'';this[_0xc857('0x1')]=_0x47de14[_0xc857('0x2')]||'';this[_0xc857('0x3')]=_0x47de14['remoteUri']||'';this['serverUrl']=_0x47de14[_0xc857('0x4')]||'';this[_0xc857('0x5')]=_0x47de14[_0xc857('0x5')]||{};}module[_0xc857('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x75ee=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3fd132,_0x284b33){var _0x48a1b3=function(_0x1434a0){while(--_0x1434a0){_0x3fd132['push'](_0x3fd132['shift']());}};_0x48a1b3(++_0x284b33);}(_0x75ee,0x1b7));var _0xe75e=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x75ee[_0x72895a];return _0x5226d5;};'use strict';function FreshdeskAccount(_0x5c04e1){this['id']=_0x5c04e1['id']||0x0;this[_0xe75e('0x0')]=_0x5c04e1[_0xe75e('0x0')]||'';this[_0xe75e('0x1')]=_0x5c04e1[_0xe75e('0x1')]||'';this[_0xe75e('0x2')]=_0x5c04e1['token']||'';this[_0xe75e('0x3')]=_0x5c04e1[_0xe75e('0x3')]||'';this[_0xe75e('0x4')]=_0x5c04e1[_0xe75e('0x4')]||'';this[_0xe75e('0x5')]=_0x5c04e1[_0xe75e('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index de28b50..3b35865 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 _0xcca7=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1fb11c,_0x48f107){var _0x3ae58d=function(_0x2feae1){while(--_0x2feae1){_0x1fb11c['push'](_0x1fb11c['shift']());}};_0x3ae58d(++_0x48f107);}(_0xcca7,0x1aa));var _0x7cca=function(_0x2beae2,_0x3ce49b){_0x2beae2=_0x2beae2-0x0;var _0xd226a6=_0xcca7[_0x2beae2];return _0xd226a6;};'use strict';function FreshsalesAccount(_0x58285f){this['id']=_0x58285f['id']||0x0;this[_0x7cca('0x0')]=_0x58285f[_0x7cca('0x0')]||'';this[_0x7cca('0x1')]=_0x58285f['username']||'';this['apiKey']=_0x58285f[_0x7cca('0x2')]||'';this['remoteUri']=_0x58285f[_0x7cca('0x3')]||'';this[_0x7cca('0x4')]=_0x58285f[_0x7cca('0x4')]||'';this[_0x7cca('0x5')]=_0x58285f[_0x7cca('0x5')]||{};}module[_0x7cca('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x3468=['Configurations','username','token','remoteUri'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x3468,0x8d));var _0x8346=function(_0x4c920c,_0x1ee00b){_0x4c920c=_0x4c920c-0x0;var _0x2a6282=_0x3468[_0x4c920c];return _0x2a6282;};'use strict';function FreshsalesAccount(_0x1e11ac){this['id']=_0x1e11ac['id']||0x0;this['name']=_0x1e11ac['name']||'';this[_0x8346('0x0')]=_0x1e11ac['username']||'';this['apiKey']=_0x1e11ac[_0x8346('0x1')]||'';this[_0x8346('0x2')]=_0x1e11ac[_0x8346('0x2')]||'';this['serverUrl']=_0x1e11ac['serverUrl']||'';this['Configurations']=_0x1e11ac[_0x8346('0x3')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index eabae26..17749bc 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 _0x9bff=['holdtime','lastAssignedTo','motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9bff,0x109));var _0xf9bf=function(_0x58418a,_0x3d9f06){_0x58418a=_0x58418a-0x0;var _0x2716bf=_0x9bff[_0x58418a];return _0x2716bf;};'use strict';function QueueReport(){this[_0xf9bf('0x0')]=_0xf9bf('0x1');this[_0xf9bf('0x2')]='';this[_0xf9bf('0x3')]='';this[_0xf9bf('0x4')]='';this[_0xf9bf('0x5')]='';this[_0xf9bf('0x6')]=null;this[_0xf9bf('0x7')]=null;this[_0xf9bf('0x8')]=0x1;this[_0xf9bf('0x9')]=0x1;this[_0xf9bf('0xa')]=![];this[_0xf9bf('0xb')]=null;this[_0xf9bf('0xc')]=![];this['queuecallercompleteAt']=null;this[_0xf9bf('0xd')]=![];this[_0xf9bf('0xe')]=null;this[_0xf9bf('0xf')]=0x1;this[_0xf9bf('0x10')]='';this['connectedlinenum']='';this[_0xf9bf('0x11')]='';this['accountcode']='';this[_0xf9bf('0x12')]='';this[_0xf9bf('0x13')]='';this[_0xf9bf('0x14')]='';this[_0xf9bf('0x15')]=0x0;this['assigned']=![];this[_0xf9bf('0x16')]='';this[_0xf9bf('0x17')]='voice';this[_0xf9bf('0x18')]=0x0;this[_0xf9bf('0x19')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x1f12=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1f12,0xac));var _0x21f1=function(_0x482228,_0x51cc63){_0x482228=_0x482228-0x0;var _0x28f38f=_0x1f12[_0x482228];return _0x28f38f;};'use strict';function QueueReport(){this[_0x21f1('0x0')]=_0x21f1('0x1');this[_0x21f1('0x2')]='';this[_0x21f1('0x3')]='';this[_0x21f1('0x4')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x21f1('0x5')]=null;this['position']=0x1;this[_0x21f1('0x6')]=0x1;this[_0x21f1('0x7')]=![];this[_0x21f1('0x8')]=null;this[_0x21f1('0x9')]=![];this[_0x21f1('0xa')]=null;this[_0x21f1('0xb')]=![];this[_0x21f1('0xc')]=null;this[_0x21f1('0xd')]=0x1;this[_0x21f1('0xe')]='';this[_0x21f1('0xf')]='';this['connectedlinename']='';this[_0x21f1('0x10')]='';this[_0x21f1('0x11')]='';this[_0x21f1('0x12')]='';this[_0x21f1('0x13')]='';this[_0x21f1('0x14')]=0x0;this[_0x21f1('0x15')]=![];this['lastAssignedTo']='';this[_0x21f1('0x16')]=_0x21f1('0x17');this[_0x21f1('0x18')]=0x0;this['variables']={};}module[_0x21f1('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 57f5784..2e5efd0 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 _0x9934=['integrationTab','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x9934,0x7c));var _0x4993=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x9934[_0x1d5ba8];return _0x1022a2;};'use strict';function SalesforceAccount(_0x1e6890){this['id']=_0x1e6890['id']||0x0;this[_0x4993('0x0')]=_0x1e6890['name']||'';this[_0x4993('0x1')]=_0x1e6890[_0x4993('0x1')]||'';this[_0x4993('0x2')]=_0x1e6890[_0x4993('0x2')]||'';this['password']=_0x1e6890[_0x4993('0x3')]||'';this[_0x4993('0x4')]=_0x1e6890[_0x4993('0x4')]||'';this[_0x4993('0x5')]=_0x1e6890[_0x4993('0x5')]||'';this[_0x4993('0x6')]=_0x1e6890['securityToken']||'';this['type']=_0x1e6890[_0x4993('0x7')]||_0x4993('0x8');this['serverUrl']=_0x1e6890['serverUrl']||'';this['Configurations']=_0x1e6890[_0x4993('0x9')]||{};}module[_0x4993('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xc6ef=['password','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6ef,0x81));var _0xfc6e=function(_0x12e6e9,_0x280fd0){_0x12e6e9=_0x12e6e9-0x0;var _0x491607=_0xc6ef[_0x12e6e9];return _0x491607;};'use strict';function SalesforceAccount(_0x439e73){this['id']=_0x439e73['id']||0x0;this[_0xfc6e('0x0')]=_0x439e73[_0xfc6e('0x0')]||'';this[_0xfc6e('0x1')]=_0x439e73['username']||'';this[_0xfc6e('0x2')]=_0x439e73[_0xfc6e('0x2')]||'';this[_0xfc6e('0x3')]=_0x439e73[_0xfc6e('0x3')]||'';this['clientId']=_0x439e73['clientId']||'';this[_0xfc6e('0x4')]=_0x439e73[_0xfc6e('0x4')]||'';this['securityToken']=_0x439e73[_0xfc6e('0x5')]||'';this['type']=_0x439e73[_0xfc6e('0x6')]||_0xfc6e('0x7');this[_0xfc6e('0x8')]=_0x439e73[_0xfc6e('0x8')]||'';this[_0xfc6e('0x9')]=_0x439e73['Configurations']||{};}module[_0xfc6e('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 be0c6e5..a7e7cef 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 _0x8ab7=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3072ee,_0x40b136){var _0x47041d=function(_0x47c8ee){while(--_0x47c8ee){_0x3072ee['push'](_0x3072ee['shift']());}};_0x47041d(++_0x40b136);}(_0x8ab7,0x9c));var _0x78ab=function(_0x39ed5e,_0x5b730d){_0x39ed5e=_0x39ed5e-0x0;var _0x12396f=_0x8ab7[_0x39ed5e];return _0x12396f;};'use strict';function ServicenowAccount(_0x456f8a){this['id']=_0x456f8a['id']||0x0;this[_0x78ab('0x0')]=_0x456f8a[_0x78ab('0x0')]||'';this[_0x78ab('0x1')]=_0x456f8a[_0x78ab('0x1')]||'';this['password']=_0x456f8a[_0x78ab('0x2')]||'';this[_0x78ab('0x3')]=_0x456f8a['remoteUri']||'';this[_0x78ab('0x4')]=_0x456f8a[_0x78ab('0x4')]||'';this[_0x78ab('0x5')]=_0x456f8a[_0x78ab('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x50f9=['serverUrl','Configurations','name','username'];(function(_0x345373,_0x587875){var _0x28e6c1=function(_0x56536a){while(--_0x56536a){_0x345373['push'](_0x345373['shift']());}};_0x28e6c1(++_0x587875);}(_0x50f9,0x18a));var _0x950f=function(_0x4dd2a7,_0x1fa277){_0x4dd2a7=_0x4dd2a7-0x0;var _0x3a8cf5=_0x50f9[_0x4dd2a7];return _0x3a8cf5;};'use strict';function ServicenowAccount(_0x339f74){this['id']=_0x339f74['id']||0x0;this[_0x950f('0x0')]=_0x339f74[_0x950f('0x0')]||'';this[_0x950f('0x1')]=_0x339f74['username']||'';this['password']=_0x339f74['password']||'';this['remoteUri']=_0x339f74['remoteUri']||'';this[_0x950f('0x2')]=_0x339f74['serverUrl']||'';this[_0x950f('0x3')]=_0x339f74['Configurations']||{};}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 3528175..bd67e4e 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 _0x70a3=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x70a3,0x16e));var _0x370a=function(_0x18fb50,_0x2d4cc9){_0x18fb50=_0x18fb50-0x0;var _0x38b3bc=_0x70a3[_0x18fb50];return _0x38b3bc;};'use strict';function SugarcrmAccount(_0x5b5273){this['id']=_0x5b5273['id']||0x0;this['name']=_0x5b5273['name']||'';this[_0x370a('0x0')]=_0x5b5273['username']||'';this[_0x370a('0x1')]=_0x5b5273[_0x370a('0x1')]||'';this[_0x370a('0x2')]=_0x5b5273[_0x370a('0x2')]||'';this[_0x370a('0x3')]=_0x5b5273[_0x370a('0x3')]||'';this['Configurations']=_0x5b5273[_0x370a('0x4')]||{};}module[_0x370a('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x54b2=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x54b2,0x6e));var _0x254b=function(_0x311b11,_0xceebac){_0x311b11=_0x311b11-0x0;var _0x20848b=_0x54b2[_0x311b11];return _0x20848b;};'use strict';function SugarcrmAccount(_0x39694b){this['id']=_0x39694b['id']||0x0;this['name']=_0x39694b[_0x254b('0x0')]||'';this[_0x254b('0x1')]=_0x39694b[_0x254b('0x1')]||'';this[_0x254b('0x2')]=_0x39694b[_0x254b('0x2')]||'';this['remoteUri']=_0x39694b[_0x254b('0x3')]||'';this[_0x254b('0x4')]=_0x39694b[_0x254b('0x4')]||'';this[_0x254b('0x5')]=_0x39694b[_0x254b('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 984a810..9a732a3 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 _0x556d=['accountcode','state','stateTime','address','exports','name'];(function(_0x57dd9b,_0xa77869){var _0x18ce60=function(_0x4529c9){while(--_0x4529c9){_0x57dd9b['push'](_0x57dd9b['shift']());}};_0x18ce60(++_0xa77869);}(_0x556d,0x83));var _0xd556=function(_0x2880f8,_0x1ff873){_0x2880f8=_0x2880f8-0x0;var _0x53960d=_0x556d[_0x2880f8];return _0x53960d;};'use strict';function Telephone(_0x32000d){this['id']=_0x32000d['id']||0x0;this[_0xd556('0x0')]=_0x32000d[_0xd556('0x0')]||'';this['accountcode']=_0x32000d[_0xd556('0x1')]||'';this[_0xd556('0x2')]='unknown';this[_0xd556('0x3')]=0x0;this['status']='unknown';this[_0xd556('0x4')]='';}module[_0xd556('0x5')]=Telephone; \ No newline at end of file +var _0x58d6=['accountcode','stateTime','status','unknown','address','name'];(function(_0x460ad6,_0x10a748){var _0x391879=function(_0x530b17){while(--_0x530b17){_0x460ad6['push'](_0x460ad6['shift']());}};_0x391879(++_0x10a748);}(_0x58d6,0x1d3));var _0x658d=function(_0x1e7944,_0x5a1ee7){_0x1e7944=_0x1e7944-0x0;var _0x4be825=_0x58d6[_0x1e7944];return _0x4be825;};'use strict';function Telephone(_0x9e566c){this['id']=_0x9e566c['id']||0x0;this[_0x658d('0x0')]=_0x9e566c[_0x658d('0x0')]||'';this['accountcode']=_0x9e566c[_0x658d('0x1')]||'';this['state']='unknown';this[_0x658d('0x2')]=0x0;this[_0x658d('0x3')]=_0x658d('0x4');this[_0x658d('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index be2f3b1..ea5cbb5 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x57396b,_0x16ce1a){var _0x11b293=function(_0x3999a6){while(--_0x3999a6){_0x57396b['push'](_0x57396b['shift']());}};_0x11b293(++_0x16ce1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d9295,_0x5f5bc6){_0x5d9295=_0x5d9295-0x0;var _0x4f2534=_0xb10b[_0x5d9295];return _0x4f2534;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x11596e,_0x545390){var _0x4f7be1=function(_0x37be13){while(--_0x37be13){_0x11596e['push'](_0x11596e['shift']());}};_0x4f7be1(++_0x545390);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 9f1736a..eccadb0 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x23eaf0,_0x347b70){var _0x353da4=function(_0x22a504){while(--_0x22a504){_0x23eaf0['push'](_0x23eaf0['shift']());}};_0x353da4(++_0x347b70);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4af0dc,_0x2acbeb){var _0xd30e7f=function(_0x442dd2){while(--_0x442dd2){_0x4af0dc['push'](_0x4af0dc['shift']());}};_0xd30e7f(++_0x2acbeb);}(_0x8603,0x190));var _0x3860=function(_0x55dba4,_0x38c942){_0x55dba4=_0x55dba4-0x0;var _0x54c6df=_0x8603[_0x55dba4];return _0x54c6df;};'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 b891860..b22b82c 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 _0x34bd=['stateTime','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x5724bf,_0x47a94a){var _0xc36b04=function(_0x102a52){while(--_0x102a52){_0x5724bf['push'](_0x5724bf['shift']());}};_0xc36b04(++_0x47a94a);}(_0x34bd,0xbd));var _0xd34b=function(_0x1ab313,_0x12bccc){_0x1ab313=_0x1ab313-0x0;var _0x2d73f4=_0x34bd[_0x1ab313];return _0x2d73f4;};'use strict';function Trunk(_0x2c6588){this['id']=_0x2c6588['id']||0x0;this[_0xd34b('0x0')]=_0x2c6588[_0xd34b('0x0')]||![];this[_0xd34b('0x1')]=_0x2c6588['name']||'';this['state']=_0xd34b('0x2');this[_0xd34b('0x3')]=0x0;this['status']='unknown';this[_0xd34b('0x4')]=_0x2c6588['registry']&&_0x2c6588[_0xd34b('0x4')][_0xd34b('0x5')](':')?_0x2c6588['registry'][_0xd34b('0x6')](':')[0x0]:'';this['host']='';this[_0xd34b('0x7')]='';this[_0xd34b('0x8')]='';this[_0xd34b('0x9')]='';this[_0xd34b('0xa')]='';this[_0xd34b('0xb')]=_0xd34b('0x2');this[_0xd34b('0xc')]='';this[_0xd34b('0xd')]='';this['defaultuser']=_0x2c6588[_0xd34b('0xe')]||'';}module[_0xd34b('0xf')]=Trunk; \ No newline at end of file +var _0xb5bc=['address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime'];(function(_0x1221a8,_0x42fafa){var _0x81b49e=function(_0x4f3b44){while(--_0x4f3b44){_0x1221a8['push'](_0x1221a8['shift']());}};_0x81b49e(++_0x42fafa);}(_0xb5bc,0xed));var _0xcb5b=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0xb5bc[_0x187399];return _0x40fa92;};'use strict';function Trunk(_0x282b08){this['id']=_0x282b08['id']||0x0;this[_0xcb5b('0x0')]=_0x282b08[_0xcb5b('0x0')]||![];this[_0xcb5b('0x1')]=_0x282b08[_0xcb5b('0x1')]||'';this[_0xcb5b('0x2')]=_0xcb5b('0x3');this[_0xcb5b('0x4')]=0x0;this[_0xcb5b('0x5')]=_0xcb5b('0x3');this[_0xcb5b('0x6')]=_0x282b08[_0xcb5b('0x6')]&&_0x282b08['registry'][_0xcb5b('0x7')](':')?_0x282b08['registry'][_0xcb5b('0x8')](':')[0x0]:'';this[_0xcb5b('0x9')]='';this[_0xcb5b('0xa')]='';this[_0xcb5b('0xb')]='';this['domainport']='';this[_0xcb5b('0xc')]='';this[_0xcb5b('0xd')]=_0xcb5b('0x3');this[_0xcb5b('0xe')]='';this[_0xcb5b('0xf')]='';this['defaultuser']=_0x282b08[_0xcb5b('0x10')]||'';}module[_0xcb5b('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 693c55c..19d2557 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 _0xeea0=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0xb04261,_0x50e162){var _0x430e34=function(_0x28e7f5){while(--_0x28e7f5){_0xb04261['push'](_0xb04261['shift']());}};_0x430e34(++_0x50e162);}(_0xeea0,0xe8));var _0x0eea=function(_0x54731d,_0x1ba564){_0x54731d=_0x54731d-0x0;var _0x57e50d=_0xeea0[_0x54731d];return _0x57e50d;};'use strict';function voiceExtension(_0x334805){this['id']=_0x334805['id']||0x0;this['exten']=_0x334805[_0x0eea('0x0')]||'';this['recordingFormat']=_0x334805[_0x0eea('0x1')]||_0x0eea('0x2');this[_0x0eea('0x3')]=_0x334805[_0x0eea('0x3')]||![];}module[_0x0eea('0x4')]=voiceExtension; \ No newline at end of file +var _0x787f=['none','mandatoryDisposition','exports','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x787f,0x1c7));var _0xf787=function(_0xc7c78d,_0x1dd9fb){_0xc7c78d=_0xc7c78d-0x0;var _0x175f3d=_0x787f[_0xc7c78d];return _0x175f3d;};'use strict';function voiceExtension(_0x11af01){this['id']=_0x11af01['id']||0x0;this['exten']=_0x11af01['exten']||'';this[_0xf787('0x0')]=_0x11af01[_0xf787('0x0')]||_0xf787('0x1');this[_0xf787('0x2')]=_0x11af01[_0xf787('0x2')]||![];}module[_0xf787('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 6126517..56d82fe 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 _0x32c0=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','monitor_format','type','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x32c0,0x16c));var _0x032c=function(_0x351074,_0x29d945){_0x351074=_0x351074-0x0;var _0x4deb47=_0x32c0[_0x351074];return _0x4deb47;};'use strict';var statusDesc=['unknown',_0x032c('0x0'),_0x032c('0x1'),_0x032c('0x2'),_0x032c('0x3'),_0x032c('0x4'),_0x032c('0x5'),_0x032c('0x6'),_0x032c('0x7')];var monitorFormat={'wav':_0x032c('0x8'),'wav49':_0x032c('0x9'),'gsm':_0x032c('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x43b3ca){this['id']=_0x43b3ca['id']||0x0;this['name']=_0x43b3ca['name']||'';this[_0x032c('0xb')]=_0x43b3ca[_0x032c('0xb')]||'';this['type']=_0x43b3ca[_0x032c('0xc')]||'inbound';this[_0x032c('0xd')]=0x0;this[_0x032c('0xe')]=0x0;this[_0x032c('0xf')]=0x0;this[_0x032c('0x10')]=0x0;this[_0x032c('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x032c('0x12')]=0x0;this[_0x032c('0x13')]=0x0;this[_0x032c('0x14')]=0x0;this[_0x032c('0x15')]=0x0;this[_0x032c('0x16')]=0x0;this[_0x032c('0x17')]=_0x43b3ca[_0x032c('0x17')]||![];this[_0x032c('0x18')]=_0x43b3ca['acwTimeout']||0xa;this[_0x032c('0x19')]=_0x43b3ca[_0x032c('0x19')]||'no';this[_0x032c('0x1a')]=!![];this[_0x032c('0x1b')]='';this[_0x032c('0x1c')]=0x0;this[_0x032c('0x1d')]=0x0;this[_0x032c('0x1e')]=_0x43b3ca[_0x032c('0x1e')]||null;this[_0x032c('0x1f')]=_0x43b3ca[_0x032c('0x1f')]?_0x43b3ca[_0x032c('0x1f')]:null;this[_0x032c('0x20')]=_0x43b3ca['dialActive'];this['dialMethod']=_0x43b3ca['dialMethod']||_0x032c('0x21');this[_0x032c('0x22')]=_0x43b3ca['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x43b3ca['dialLimitQueue']||0x0;this[_0x032c('0x23')]=_0x43b3ca[_0x032c('0x23')]||0x1;this[_0x032c('0x24')]=_0x43b3ca[_0x032c('0x24')]||_0x032c('0x25');this[_0x032c('0x26')]=_0x43b3ca[_0x032c('0x26')]||0.03;this[_0x032c('0x27')]=_0x43b3ca[_0x032c('0x27')]||0x258;this[_0x032c('0x28')]=_0x43b3ca[_0x032c('0x28')]||_0x032c('0x29');this[_0x032c('0x2a')]=_0x43b3ca['dialOriginateCallerIdNumber']||_0x032c('0x29');this[_0x032c('0x2b')]=_0x43b3ca['dialOriginateTimeout']||0x1e;this[_0x032c('0x2c')]=_0x43b3ca[_0x032c('0x2c')]||_0x032c('0x2d');this[_0x032c('0x2e')]=_0x43b3ca[_0x032c('0x2e')]||0x3;this[_0x032c('0x2f')]=_0x43b3ca['dialQueueProject']||undefined;this[_0x032c('0x30')]=_0x43b3ca[_0x032c('0x30')]||0x3;this[_0x032c('0x31')]=_0x43b3ca['dialCongestionRetryFrequency']||0x96;this[_0x032c('0x32')]=_0x43b3ca['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x43b3ca[_0x032c('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x43b3ca['dialNoAnswerMaxRetry']||0x3;this[_0x032c('0x34')]=_0x43b3ca[_0x032c('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x43b3ca[_0x032c('0x35')]||0x3;this[_0x032c('0x36')]=_0x43b3ca[_0x032c('0x36')]||0x96;this[_0x032c('0x37')]=_0x43b3ca['dialDropMaxRetry']||0x3;this[_0x032c('0x38')]=_0x43b3ca[_0x032c('0x38')]||0x96;this[_0x032c('0x39')]=_0x43b3ca[_0x032c('0x39')]||0x3;this[_0x032c('0x3a')]=_0x43b3ca[_0x032c('0x3a')]||0x96;this[_0x032c('0x3b')]=_0x43b3ca[_0x032c('0x3b')]||0x3;this[_0x032c('0x3c')]=_0x43b3ca[_0x032c('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x43b3ca['dialAgentRejectMaxRetry']||0x3;this[_0x032c('0x3d')]=_0x43b3ca[_0x032c('0x3d')]||0x96;this[_0x032c('0x3e')]=_0x43b3ca[_0x032c('0x3e')]||0x4;this[_0x032c('0x3f')]=_0x43b3ca['Trunk']?_0x43b3ca['Trunk']:undefined;this[_0x032c('0x40')]=_0x43b3ca[_0x032c('0x40')]?_0x43b3ca[_0x032c('0x40')]:undefined;this['dialPrefix']=_0x43b3ca['dialPrefix']||undefined;this[_0x032c('0x41')]=_0x43b3ca[_0x032c('0x41')]?_0x43b3ca[_0x032c('0x41')]:undefined;this[_0x032c('0x42')]=_0x43b3ca['dialOrderByScheduledAt']||_0x032c('0x43');this[_0x032c('0x44')]=_0x43b3ca[_0x032c('0x44')]||undefined;this[_0x032c('0x45')]=_0x43b3ca['dialCutDigit']||undefined;this[_0x032c('0x46')]=strategy[_0x43b3ca[_0x032c('0x46')]]||_0x032c('0x47');this[_0x032c('0x48')]=!![];this[_0x032c('0x49')]=_0x43b3ca[_0x032c('0x49')]||![];this['dialAMDInitialSilence']=_0x43b3ca[_0x032c('0x4a')];this['dialAMDGreeting']=_0x43b3ca['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x43b3ca['dialAMDAfterGreetingSilence'];this[_0x032c('0x4b')]=_0x43b3ca[_0x032c('0x4b')];this[_0x032c('0x4c')]=_0x43b3ca[_0x032c('0x4c')];this[_0x032c('0x4d')]=_0x43b3ca[_0x032c('0x4d')];this[_0x032c('0x4e')]=_0x43b3ca['dialAMDMaximumNumberOfWords'];this[_0x032c('0x4f')]=_0x43b3ca[_0x032c('0x4f')];this[_0x032c('0x50')]=_0x43b3ca[_0x032c('0x50')];this[_0x032c('0x51')]=0x0;this['pTalking']=0x0;this[_0x032c('0x52')]=_0x43b3ca[_0x032c('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x032c('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x032c('0x54')]=0x0;this[_0x032c('0x55')]=0x0;this[_0x032c('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x032c('0x57')]=0x0;this[_0x032c('0x58')]=0x0;this[_0x032c('0x59')]=0x0;this[_0x032c('0x5a')]=0x0;this[_0x032c('0x5b')]=0x0;this[_0x032c('0x5c')]=undefined;this['startPredictive']=undefined;this[_0x032c('0x5d')]=undefined;this[_0x032c('0x5e')]=1.05;this[_0x032c('0x5f')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x032c('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x032c('0x61')]=0x0;this[_0x032c('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x032c('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x43b3ca[_0x032c('0x64')]||0x14;this[_0x032c('0x65')]=_0x43b3ca['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x032c('0x66')]=0x1;this[_0x032c('0x67')]=0x0;this[_0x032c('0x68')]=0x0;this[_0x032c('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x032c('0x6a')]=_0x43b3ca[_0x032c('0x6a')]||0x1e;this[_0x032c('0x6b')]=_0x43b3ca[_0x032c('0x6b')]||![];this['dialPreviewAutoRecallMe']=!!_0x43b3ca['dialPreviewAutoRecallMe']||![];this[_0x032c('0x6c')]=!!_0x43b3ca[_0x032c('0x6c')]||![];this[_0x032c('0x6d')]=_0x43b3ca[_0x032c('0x6d')]||undefined;this[_0x032c('0x6e')]=_0x43b3ca[_0x032c('0x6e')]||![];this[_0x032c('0x6f')]=_0x43b3ca[_0x032c('0x6f')]||![];this[_0x032c('0xb')]=monitorFormat[_0x43b3ca[_0x032c('0xb')]]?monitorFormat[_0x43b3ca[_0x032c('0xb')]]:undefined;this[_0x032c('0x70')]=_0x43b3ca[_0x032c('0x70')]||![];this['mandatoryDispositionPause']=_0x43b3ca[_0x032c('0x71')]?_0x43b3ca[_0x032c('0x71')]:undefined;}module[_0x032c('0x72')]=VoiceQueue; \ No newline at end of file +var _0x7c0d=['dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x37fea4,_0x15e543){var _0x462ced=function(_0x22410b){while(--_0x22410b){_0x37fea4['push'](_0x37fea4['shift']());}};_0x462ced(++_0x15e543);}(_0x7c0d,0x7c));var _0xd7c0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7c0d[_0x57b54c];return _0x59cc19;};'use strict';var statusDesc=[_0xd7c0('0x0'),_0xd7c0('0x1'),'inuse',_0xd7c0('0x2'),_0xd7c0('0x3'),_0xd7c0('0x4'),_0xd7c0('0x5'),_0xd7c0('0x6'),_0xd7c0('0x7')];var monitorFormat={'wav':_0xd7c0('0x8'),'wav49':_0xd7c0('0x9'),'gsm':_0xd7c0('0xa')};var strategy={'rrmemory':_0xd7c0('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2bc9ef){this['id']=_0x2bc9ef['id']||0x0;this[_0xd7c0('0xc')]=_0x2bc9ef[_0xd7c0('0xc')]||'';this[_0xd7c0('0xd')]=_0x2bc9ef[_0xd7c0('0xd')]||'';this[_0xd7c0('0xe')]=_0x2bc9ef['type']||_0xd7c0('0xf');this[_0xd7c0('0x10')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0xd7c0('0x11')]=0x0;this[_0xd7c0('0x12')]=0x0;this[_0xd7c0('0x13')]=0x0;this[_0xd7c0('0x14')]=0x0;this[_0xd7c0('0x15')]=0x0;this[_0xd7c0('0x16')]=0x0;this[_0xd7c0('0x17')]=0x0;this['available']=0x0;this[_0xd7c0('0x18')]=_0x2bc9ef[_0xd7c0('0x18')]||![];this[_0xd7c0('0x19')]=_0x2bc9ef[_0xd7c0('0x19')]||0xa;this[_0xd7c0('0x1a')]=_0x2bc9ef[_0xd7c0('0x1a')]||'no';this[_0xd7c0('0x1b')]=!![];this['message']='';this[_0xd7c0('0x1c')]=0x0;this[_0xd7c0('0x1d')]=0x0;this[_0xd7c0('0x1e')]=_0x2bc9ef['dialTimezone']||null;this[_0xd7c0('0x1f')]=_0x2bc9ef[_0xd7c0('0x1f')]?_0x2bc9ef[_0xd7c0('0x1f')]:null;this[_0xd7c0('0x20')]=_0x2bc9ef[_0xd7c0('0x20')];this[_0xd7c0('0x21')]=_0x2bc9ef[_0xd7c0('0x21')]||'progressive';this[_0xd7c0('0x22')]=_0x2bc9ef[_0xd7c0('0x22')]||0x0;this['dialLimitQueue']=_0x2bc9ef[_0xd7c0('0x23')]||0x0;this['dialPowerLevel']=_0x2bc9ef[_0xd7c0('0x24')]||0x1;this[_0xd7c0('0x25')]=_0x2bc9ef['dialPredictiveOptimization']||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x2bc9ef[_0xd7c0('0x26')]||0.03;this[_0xd7c0('0x27')]=_0x2bc9ef[_0xd7c0('0x27')]||0x258;this[_0xd7c0('0x28')]=_0x2bc9ef['dialOriginateCallerIdName']||'anonymous';this[_0xd7c0('0x29')]=_0x2bc9ef[_0xd7c0('0x29')]||_0xd7c0('0x2a');this['dialOriginateTimeout']=_0x2bc9ef[_0xd7c0('0x2b')]||0x1e;this[_0xd7c0('0x2c')]=_0x2bc9ef[_0xd7c0('0x2c')]||'tTxX';this[_0xd7c0('0x2d')]=_0x2bc9ef[_0xd7c0('0x2d')]||0x3;this[_0xd7c0('0x2e')]=_0x2bc9ef[_0xd7c0('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x2bc9ef[_0xd7c0('0x2f')]||0x3;this[_0xd7c0('0x30')]=_0x2bc9ef[_0xd7c0('0x30')]||0x96;this[_0xd7c0('0x31')]=_0x2bc9ef[_0xd7c0('0x31')]||0x3;this[_0xd7c0('0x32')]=_0x2bc9ef[_0xd7c0('0x32')]||0x96;this[_0xd7c0('0x33')]=_0x2bc9ef[_0xd7c0('0x33')]||0x3;this[_0xd7c0('0x34')]=_0x2bc9ef[_0xd7c0('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2bc9ef[_0xd7c0('0x35')]||0x3;this[_0xd7c0('0x36')]=_0x2bc9ef[_0xd7c0('0x36')]||0x96;this[_0xd7c0('0x37')]=_0x2bc9ef[_0xd7c0('0x37')]||0x3;this[_0xd7c0('0x38')]=_0x2bc9ef[_0xd7c0('0x38')]||0x96;this[_0xd7c0('0x39')]=_0x2bc9ef[_0xd7c0('0x39')]||0x3;this[_0xd7c0('0x3a')]=_0x2bc9ef[_0xd7c0('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x2bc9ef[_0xd7c0('0x3b')]||0x3;this[_0xd7c0('0x3c')]=_0x2bc9ef['dialMachineRetryFrequency']||0x96;this[_0xd7c0('0x3d')]=_0x2bc9ef[_0xd7c0('0x3d')]||0x3;this[_0xd7c0('0x3e')]=_0x2bc9ef['dialAgentRejectRetryFrequency']||0x96;this[_0xd7c0('0x3f')]=_0x2bc9ef[_0xd7c0('0x3f')]||0x4;this[_0xd7c0('0x40')]=_0x2bc9ef[_0xd7c0('0x40')]?_0x2bc9ef['Trunk']:undefined;this['TrunkBackup']=_0x2bc9ef[_0xd7c0('0x41')]?_0x2bc9ef[_0xd7c0('0x41')]:undefined;this[_0xd7c0('0x42')]=_0x2bc9ef[_0xd7c0('0x42')]||undefined;this[_0xd7c0('0x43')]=_0x2bc9ef[_0xd7c0('0x43')]?_0x2bc9ef['Interval']:undefined;this[_0xd7c0('0x44')]=_0x2bc9ef[_0xd7c0('0x44')]||'DESC';this[_0xd7c0('0x45')]=_0x2bc9ef[_0xd7c0('0x45')]||undefined;this[_0xd7c0('0x46')]=_0x2bc9ef[_0xd7c0('0x46')]||undefined;this['strategy']=strategy[_0x2bc9ef['strategy']]||_0xd7c0('0xb');this[_0xd7c0('0x47')]=!![];this[_0xd7c0('0x48')]=_0x2bc9ef['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2bc9ef[_0xd7c0('0x49')];this[_0xd7c0('0x4a')]=_0x2bc9ef[_0xd7c0('0x4a')];this[_0xd7c0('0x4b')]=_0x2bc9ef[_0xd7c0('0x4b')];this[_0xd7c0('0x4c')]=_0x2bc9ef[_0xd7c0('0x4c')];this['dialAMDMinWordLength']=_0x2bc9ef[_0xd7c0('0x4d')];this[_0xd7c0('0x4e')]=_0x2bc9ef[_0xd7c0('0x4e')];this['dialAMDMaximumNumberOfWords']=_0x2bc9ef[_0xd7c0('0x4f')];this[_0xd7c0('0x50')]=_0x2bc9ef[_0xd7c0('0x50')];this[_0xd7c0('0x51')]=_0x2bc9ef[_0xd7c0('0x51')];this[_0xd7c0('0x52')]=0x0;this[_0xd7c0('0x53')]=0x0;this[_0xd7c0('0x54')]=_0x2bc9ef[_0xd7c0('0x54')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xd7c0('0x55')]=0x0;this[_0xd7c0('0x56')]=0x0;this[_0xd7c0('0x57')]=0x0;this[_0xd7c0('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xd7c0('0x59')]=0x0;this[_0xd7c0('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xd7c0('0x5b')]=0x0;this[_0xd7c0('0x5c')]=0x0;this[_0xd7c0('0x5d')]=0x0;this[_0xd7c0('0x5e')]=undefined;this[_0xd7c0('0x5f')]=undefined;this[_0xd7c0('0x60')]=undefined;this[_0xd7c0('0x61')]=1.05;this[_0xd7c0('0x62')]=0x0;this[_0xd7c0('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xd7c0('0x64')]=0x0;this[_0xd7c0('0x65')]=0x0;this[_0xd7c0('0x66')]=0x0;this[_0xd7c0('0x67')]=0x0;this['predictiveIntervalMaxThreshold']=_0x2bc9ef['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xd7c0('0x68')]=_0x2bc9ef[_0xd7c0('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xd7c0('0x6a')]=0x0;this[_0xd7c0('0x6b')]=0x1;this[_0xd7c0('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0xd7c0('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x2bc9ef[_0xd7c0('0x6e')]||0x1e;this[_0xd7c0('0x6f')]=_0x2bc9ef['dialRecallInQueue']||![];this[_0xd7c0('0x70')]=!!_0x2bc9ef[_0xd7c0('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x2bc9ef[_0xd7c0('0x71')]||![];this['dialQueueProject2']=_0x2bc9ef[_0xd7c0('0x72')]||undefined;this[_0xd7c0('0x73')]=_0x2bc9ef[_0xd7c0('0x73')]||![];this['dialAgiAfterHangupAgent']=_0x2bc9ef[_0xd7c0('0x74')]||![];this[_0xd7c0('0xd')]=monitorFormat[_0x2bc9ef[_0xd7c0('0xd')]]?monitorFormat[_0x2bc9ef['monitor_format']]:undefined;this[_0xd7c0('0x75')]=_0x2bc9ef[_0xd7c0('0x75')]||![];this['mandatoryDispositionPause']=_0x2bc9ef[_0xd7c0('0x76')]?_0x2bc9ef[_0xd7c0('0x76')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index de66999..78b1681 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 _0x3764=['serverUrl','Configurations','name','accessKey','remoteUri'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x3764,0x124));var _0x4376=function(_0x55a863,_0x5f0459){_0x55a863=_0x55a863-0x0;var _0x47edb0=_0x3764[_0x55a863];return _0x47edb0;};'use strict';function VtigerAccount(_0x536a5c){this['id']=_0x536a5c['id']||0x0;this[_0x4376('0x0')]=_0x536a5c[_0x4376('0x0')]||'';this['username']=_0x536a5c['username']||'';this[_0x4376('0x1')]=_0x536a5c[_0x4376('0x1')]||'';this[_0x4376('0x2')]=_0x536a5c[_0x4376('0x2')]||'';this[_0x4376('0x3')]=_0x536a5c[_0x4376('0x3')]||'';this['Configurations']=_0x536a5c[_0x4376('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x58a0=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x582b0f,_0x35a9de){var _0x4658f0=function(_0x106924){while(--_0x106924){_0x582b0f['push'](_0x582b0f['shift']());}};_0x4658f0(++_0x35a9de);}(_0x58a0,0xce));var _0x058a=function(_0x3cbee0,_0x352a0a){_0x3cbee0=_0x3cbee0-0x0;var _0x2ed094=_0x58a0[_0x3cbee0];return _0x2ed094;};'use strict';function VtigerAccount(_0x33ff67){this['id']=_0x33ff67['id']||0x0;this[_0x058a('0x0')]=_0x33ff67['name']||'';this[_0x058a('0x1')]=_0x33ff67['username']||'';this[_0x058a('0x2')]=_0x33ff67[_0x058a('0x2')]||'';this[_0x058a('0x3')]=_0x33ff67[_0x058a('0x3')]||'';this[_0x058a('0x4')]=_0x33ff67['serverUrl']||'';this[_0x058a('0x5')]=_0x33ff67[_0x058a('0x5')]||{};}module[_0x058a('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c7e8f34..a5210da 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 _0xaff6=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xaff6,0x15f));var _0x6aff=function(_0x163157,_0x59eea5){_0x163157=_0x163157-0x0;var _0x3db535=_0xaff6[_0x163157];return _0x3db535;};'use strict';function ZendeskAccount(_0x232498){this['id']=_0x232498['id']||0x0;this[_0x6aff('0x0')]=_0x232498['name']||'';this[_0x6aff('0x1')]=_0x232498[_0x6aff('0x1')]||'';this['password']=_0x232498[_0x6aff('0x2')]||'';this['token']=_0x232498[_0x6aff('0x3')]||'';this[_0x6aff('0x4')]=_0x232498['remoteUri']||'';this['authType']=_0x232498[_0x6aff('0x5')]||'';this[_0x6aff('0x6')]=_0x232498['type']||_0x6aff('0x7');this[_0x6aff('0x8')]=_0x232498[_0x6aff('0x8')]||'';this[_0x6aff('0x9')]=_0x232498[_0x6aff('0x9')]||{};}module[_0x6aff('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x6c1f=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x342ec7,_0x590a63){var _0x52c5de=function(_0xa8c29){while(--_0xa8c29){_0x342ec7['push'](_0x342ec7['shift']());}};_0x52c5de(++_0x590a63);}(_0x6c1f,0x10d));var _0xf6c1=function(_0x458d68,_0x1dbe12){_0x458d68=_0x458d68-0x0;var _0x3e4a4b=_0x6c1f[_0x458d68];return _0x3e4a4b;};'use strict';function ZendeskAccount(_0x2dc8ac){this['id']=_0x2dc8ac['id']||0x0;this[_0xf6c1('0x0')]=_0x2dc8ac[_0xf6c1('0x0')]||'';this[_0xf6c1('0x1')]=_0x2dc8ac['username']||'';this[_0xf6c1('0x2')]=_0x2dc8ac[_0xf6c1('0x2')]||'';this['token']=_0x2dc8ac[_0xf6c1('0x3')]||'';this[_0xf6c1('0x4')]=_0x2dc8ac[_0xf6c1('0x4')]||'';this[_0xf6c1('0x5')]=_0x2dc8ac[_0xf6c1('0x5')]||'';this[_0xf6c1('0x6')]=_0x2dc8ac['type']||_0xf6c1('0x7');this[_0xf6c1('0x8')]=_0x2dc8ac[_0xf6c1('0x8')]||'';this[_0xf6c1('0x9')]=_0x2dc8ac[_0xf6c1('0x9')]||{};}module[_0xf6c1('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d1fe2c7..8486755 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 _0x935c=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name'];(function(_0x292e87,_0x9b2eb5){var _0x5186f6=function(_0x2eb5b6){while(--_0x2eb5b6){_0x292e87['push'](_0x292e87['shift']());}};_0x5186f6(++_0x9b2eb5);}(_0x935c,0x1ad));var _0xc935=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x935c[_0x21a9d9];return _0x46adce;};'use strict';function ZohoAccount(_0xe69165){this['id']=_0xe69165['id']||0x0;this[_0xc935('0x0')]=_0xe69165[_0xc935('0x0')]||'';this['description']=_0xe69165[_0xc935('0x1')]||'';this[_0xc935('0x2')]=_0xe69165['host']||'';this[_0xc935('0x3')]=_0xe69165[_0xc935('0x3')]||'';this[_0xc935('0x4')]=_0xe69165['clientId']||'';this[_0xc935('0x5')]=_0xe69165[_0xc935('0x5')]||'';this[_0xc935('0x6')]=_0xe69165[_0xc935('0x6')]||'';this['code']=_0xe69165[_0xc935('0x7')]||'';this[_0xc935('0x8')]=_0xe69165[_0xc935('0x8')]||'';this['Configurations']=_0xe69165['Configurations']||{};}module[_0xc935('0x9')]=ZohoAccount; \ No newline at end of file +var _0x1478=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x5dc061,_0x2e276c){var _0xcc5fe8=function(_0x1b16c9){while(--_0x1b16c9){_0x5dc061['push'](_0x5dc061['shift']());}};_0xcc5fe8(++_0x2e276c);}(_0x1478,0x11e));var _0x8147=function(_0x2f78bd,_0x3c4b24){_0x2f78bd=_0x2f78bd-0x0;var _0x48383e=_0x1478[_0x2f78bd];return _0x48383e;};'use strict';function ZohoAccount(_0x22deee){this['id']=_0x22deee['id']||0x0;this[_0x8147('0x0')]=_0x22deee[_0x8147('0x0')]||'';this[_0x8147('0x1')]=_0x22deee[_0x8147('0x1')]||'';this[_0x8147('0x2')]=_0x22deee[_0x8147('0x2')]||'';this[_0x8147('0x3')]=_0x22deee[_0x8147('0x3')]||'';this[_0x8147('0x4')]=_0x22deee[_0x8147('0x4')]||'';this[_0x8147('0x5')]=_0x22deee[_0x8147('0x5')]||'';this[_0x8147('0x6')]=_0x22deee[_0x8147('0x6')]||'';this[_0x8147('0x7')]=_0x22deee[_0x8147('0x7')]||'';this['refreshToken']=_0x22deee[_0x8147('0x8')]||'';this[_0x8147('0x9')]=_0x22deee[_0x8147('0x9')]||{};}module[_0x8147('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 505ed49..3785921 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 _0x6a53=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','type','campaigntype','queue','dialAnswer','membername','Agent','name','SIP/%s','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x6a53,0xdc));var _0x36a5=function(_0x53c2b9,_0x1dbc82){_0x53c2b9=_0x53c2b9-0x0;var _0x2c677b=_0x6a53[_0x53c2b9];return _0x2c677b;};'use strict';var util=require(_0x36a5('0x0'));var _=require(_0x36a5('0x1'));var moment=require('moment');function checkNameSurname(_0x14c8ed,_0x4cb36a,_0x361fdb){var _0x1a7bff='';if(!_[_0x36a5('0x2')](_0x4cb36a)&&_0x36a5('0x3')===typeof _0x4cb36a){_0x1a7bff+=_0x4cb36a;}if(!_['isNil'](_0x361fdb)&&_0x36a5('0x3')===typeof _0x361fdb){_0x1a7bff+='\x20'+_0x361fdb;}if(_0x1a7bff!==''){return _0x1a7bff;}return _0x14c8ed;}function Action(_0x1c108d,_0x485fa0,_0x3923de,_0x2e2808,_0x29c6d7){this[_0x36a5('0x4')]=_0x3923de||undefined;this['idContact']=_0x1c108d['id'];this['queue']=_0x485fa0['name'];this['type']=_0x485fa0[_0x36a5('0x5')];this[_0x36a5('0x6')]=_0x36a5('0x7');this[_0x36a5('0x8')]=![];this[_0x36a5('0x9')]=_['isNil'](_0x1c108d[_0x36a5('0xa')])?undefined:_0x1c108d[_0x36a5('0xa')][_0x36a5('0xb')];this['channelAgent']=this['membername']?util['format'](_0x36a5('0xc'),this[_0x36a5('0x9')]):_0x2e2808||undefined;this['calleridname']=checkNameSurname(_0x1c108d['Contact']['phone'],_0x1c108d[_0x36a5('0xd')][_0x36a5('0xe')],_0x1c108d['Contact'][_0x36a5('0xf')]);this[_0x36a5('0x10')]=_0x1c108d[_0x36a5('0x10')]||![];this['calleridnum']=_0x1c108d['Contact'][_0x36a5('0x11')];this['scheduledat']=_0x1c108d[_0x36a5('0x12')];this[_0x36a5('0x13')]=_0x1c108d['countbusyretry']||0x0;this[_0x36a5('0x14')]=_0x1c108d[_0x36a5('0x14')]||0x0;this['countnoanswerretry']=_0x1c108d[_0x36a5('0x15')]||0x0;this['countglobal']=(_0x1c108d['countbusyretry']||0x0)+(_0x1c108d[_0x36a5('0x14')]||0x0)+(_0x1c108d[_0x36a5('0x15')]||0x0)+(_0x1c108d[_0x36a5('0x16')]||0x0)+(_0x1c108d[_0x36a5('0x17')]||0x0)+(_0x1c108d['countabandonedretry']||0x0)+(_0x1c108d[_0x36a5('0x18')]||0x0)+(_0x1c108d[_0x36a5('0x19')]||0x0);this['countnosuchnumberretry']=_0x1c108d[_0x36a5('0x16')]||0x0;this[_0x36a5('0x17')]=_0x1c108d[_0x36a5('0x17')]||0x0;this[_0x36a5('0x1a')]=_0x1c108d['countabandonedretry']||0x0;this['countmachineretry']=_0x1c108d[_0x36a5('0x18')]||0x0;this[_0x36a5('0x19')]=_0x1c108d[_0x36a5('0x19')]||0x0;this['callback']=_0x1c108d[_0x36a5('0x1b')];this['callbackuniqueid']=_0x1c108d[_0x36a5('0x1c')];this[_0x36a5('0x1d')]=_0x1c108d['callbackat'];this[_0x36a5('0x1e')]=_0x1c108d[_0x36a5('0x1e')];this[_0x36a5('0x1f')]=_0x1c108d[_0x36a5('0x1f')];this[_0x36a5('0x20')]=_0x1c108d[_0x36a5('0x20')];this[_0x36a5('0x21')]=_[_0x36a5('0x2')](_0x1c108d[_0x36a5('0xa')])?_0x1c108d[_0x36a5('0x21')]:_0x1c108d[_0x36a5('0xa')]['id'];this[_0x36a5('0x22')]=_0x1c108d[_0x36a5('0x22')];this[_0x36a5('0x23')]='';this[_0x36a5('0x24')]='';}Action['prototype'][_0x36a5('0x25')]=function(){return util['format'](_0x36a5('0x26'),this['calleridname'],this['number']);};module[_0x36a5('0x27')]=Action; \ No newline at end of file +var _0xfbaa=['getCaller','\x22%s\x22\x20<%s>','lodash','moment','isNil','string','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0xe8ab41,_0x34740b){var _0x42d0e4=function(_0xce0746){while(--_0xce0746){_0xe8ab41['push'](_0xe8ab41['shift']());}};_0x42d0e4(++_0x34740b);}(_0xfbaa,0x7a));var _0xafba=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xfbaa[_0x4c445a];return _0x2f611c;};'use strict';var util=require('util');var _=require(_0xafba('0x0'));var moment=require(_0xafba('0x1'));function checkNameSurname(_0x59858e,_0x13d494,_0xce2c8a){var _0x515a88='';if(!_[_0xafba('0x2')](_0x13d494)&&_0xafba('0x3')===typeof _0x13d494){_0x515a88+=_0x13d494;}if(!_['isNil'](_0xce2c8a)&&_0xafba('0x3')===typeof _0xce2c8a){_0x515a88+='\x20'+_0xce2c8a;}if(_0x515a88!==''){return _0x515a88;}return _0x59858e;}function Action(_0x24f38d,_0x52eb81,_0x412662,_0x12a4ce,_0x32052c){this['uniqueid']=_0x412662||undefined;this[_0xafba('0x4')]=_0x24f38d['id'];this[_0xafba('0x5')]=_0x52eb81['name'];this[_0xafba('0x6')]=_0x52eb81[_0xafba('0x6')];this[_0xafba('0x7')]=_0xafba('0x5');this[_0xafba('0x8')]=![];this[_0xafba('0x9')]=_[_0xafba('0x2')](_0x24f38d[_0xafba('0xa')])?undefined:_0x24f38d['Agent']['name'];this[_0xafba('0xb')]=this[_0xafba('0x9')]?util['format'](_0xafba('0xc'),this[_0xafba('0x9')]):_0x12a4ce||undefined;this[_0xafba('0xd')]=checkNameSurname(_0x24f38d[_0xafba('0xe')][_0xafba('0xf')],_0x24f38d['Contact']['firstName'],_0x24f38d[_0xafba('0xe')]['lastName']);this[_0xafba('0x10')]=_0x24f38d[_0xafba('0x10')]||![];this[_0xafba('0x11')]=_0x24f38d['Contact']['phone'];this[_0xafba('0x12')]=_0x24f38d[_0xafba('0x12')];this[_0xafba('0x13')]=_0x24f38d[_0xafba('0x13')]||0x0;this[_0xafba('0x14')]=_0x24f38d[_0xafba('0x14')]||0x0;this[_0xafba('0x15')]=_0x24f38d[_0xafba('0x15')]||0x0;this[_0xafba('0x16')]=(_0x24f38d[_0xafba('0x13')]||0x0)+(_0x24f38d['countcongestionretry']||0x0)+(_0x24f38d[_0xafba('0x15')]||0x0)+(_0x24f38d[_0xafba('0x17')]||0x0)+(_0x24f38d[_0xafba('0x18')]||0x0)+(_0x24f38d[_0xafba('0x19')]||0x0)+(_0x24f38d[_0xafba('0x1a')]||0x0)+(_0x24f38d['countagentrejectretry']||0x0);this[_0xafba('0x17')]=_0x24f38d[_0xafba('0x17')]||0x0;this['countdropretry']=_0x24f38d[_0xafba('0x18')]||0x0;this['countabandonedretry']=_0x24f38d['countabandonedretry']||0x0;this[_0xafba('0x1a')]=_0x24f38d[_0xafba('0x1a')]||0x0;this[_0xafba('0x1b')]=_0x24f38d['countagentrejectretry']||0x0;this[_0xafba('0x1c')]=_0x24f38d[_0xafba('0x1c')];this['callbackuniqueid']=_0x24f38d[_0xafba('0x1d')];this[_0xafba('0x1e')]=_0x24f38d['callbackat'];this['recallme']=_0x24f38d[_0xafba('0x1f')];this[_0xafba('0x20')]=_0x24f38d[_0xafba('0x20')];this[_0xafba('0x21')]=_0x24f38d['ListId'];this['UserId']=_[_0xafba('0x2')](_0x24f38d[_0xafba('0xa')])?_0x24f38d[_0xafba('0x22')]:_0x24f38d[_0xafba('0xa')]['id'];this['VoiceQueueId']=_0x24f38d[_0xafba('0x23')];this[_0xafba('0x24')]='';this[_0xafba('0x25')]='';}Action['prototype'][_0xafba('0x26')]=function(){return util['format'](_0xafba('0x27'),this[_0xafba('0xd')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e24b0ad..3bf418e 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 _0x0ba7=['merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','sumBillable','sumHoldTime','talking','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','startProgressive','Trunk','active','callerid','Interval','stringify','format','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','message','\x20is\x20not\x20active','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','catch','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','then','length','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','createCustomerFinal','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','unlock','unlockContact','recallme','isValid','Contact.phone','[Preview][checkIsBlackList]','validateContact','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables'];(function(_0x377c86,_0x2e9e19){var _0x3f1fcb=function(_0x14f71f){while(--_0x14f71f){_0x377c86['push'](_0x377c86['shift']());}};_0x3f1fcb(++_0x2e9e19);}(_0x0ba7,0x16d));var _0x70ba=function(_0x289f58,_0x453764){_0x289f58=_0x289f58-0x0;var _0x1fb125=_0x0ba7[_0x289f58];return _0x1fb125;};'use strict';var util=require(_0x70ba('0x0'));var _=require('lodash');var BPromise=require(_0x70ba('0x1'));var uuid=require(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var md5=require(_0x70ba('0x4'));var Redis=require('ioredis');var config=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var loggerAction=require(_0x70ba('0x6'))(_0x70ba('0x8'));var ami=require(_0x70ba('0x9'));var rpcDb=require(_0x70ba('0xa'));var Action=require(_0x70ba('0xb'));var ut=require(_0x70ba('0xc'));config[_0x70ba('0xd')]=_[_0x70ba('0xe')](config[_0x70ba('0xd')],{'host':_0x70ba('0xf'),'port':0x18eb});var io=require(_0x70ba('0x10'))(new Redis(config[_0x70ba('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x70ba('0x11')]=function(_0x4de64d){this[_0x70ba('0x12')]=this[_0x70ba('0x12')]?this[_0x70ba('0x12')][_0x70ba('0x13')](_0x4de64d):_0x4de64d();};function Preview(_0x593fe9){this['sequence']=new Sequence();this[_0x70ba('0x14')]=_0x593fe9['voiceQueues'];this[_0x70ba('0x15')]=_0x593fe9['trunks'];this[_0x70ba('0x16')]={};this[_0x70ba('0x17')]=_0x593fe9['agents'];this[_0x70ba('0x18')]=0x0;ami['on']('originateresponse',this[_0x70ba('0x19')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1b'),this[_0x70ba('0x1c')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1d'),this[_0x70ba('0x1e')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1f'),this[_0x70ba('0x20')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x21'),this[_0x70ba('0x22')][_0x70ba('0x1a')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x70ba('0x23'),this[_0x70ba('0x24')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x25'),this[_0x70ba('0x26')][_0x70ba('0x1a')](this));this[_0x70ba('0x27')](this[_0x70ba('0x14')]);}function emit(_0x415879,_0x40b82c,_0x26c039){io['to'](_0x415879)[_0x70ba('0x28')](_0x40b82c,_0x26c039);}function emitCampaignPreview(_0x2a1328){if(_0x2a1328[_0x70ba('0x29')]===_0x70ba('0x2a')){var _0x5ebe9d={'id':_0x2a1328['id'],'name':_0x2a1328[_0x70ba('0x2b')],'strategy':_0x2a1328[_0x70ba('0x2c')],'answered':_0x2a1328['answered'],'available':_0x2a1328[_0x70ba('0x2d')],'loggedIn':_0x2a1328['loggedIn'],'pTalking':_0x2a1328['pTalking'],'sumBillable':_0x2a1328[_0x70ba('0x2e')],'sumDuration':_0x2a1328['sumDuration'],'sumHoldTime':_0x2a1328[_0x70ba('0x2f')]||0x0,'talking':_0x2a1328[_0x70ba('0x30')],'total':_0x2a1328['total'],'type':_0x2a1328[_0x70ba('0x29')],'unmanaged':_0x2a1328['unmanaged'],'abandoned':_0x2a1328['abandoned'],'waiting':_0x2a1328[_0x70ba('0x31')],'loggedInDb':_0x2a1328['loggedInDb'],'dialActive':_0x2a1328[_0x70ba('0x32')],'dialMethod':_0x2a1328[_0x70ba('0x33')],'dialOriginateCallerIdName':_0x2a1328[_0x70ba('0x34')],'dialOriginateCallerIdNumber':_0x2a1328[_0x70ba('0x35')],'dialOriginateTimeout':_0x2a1328[_0x70ba('0x36')],'dialPrefix':_0x2a1328[_0x70ba('0x37')],'outboundAnswerAgiCallsDay':_0x2a1328['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2a1328[_0x70ba('0x38')],'outboundBlacklistCallsDay':_0x2a1328[_0x70ba('0x39')],'outboundBusyCallsDay':_0x2a1328[_0x70ba('0x3a')],'outboundCongestionCallsDay':_0x2a1328['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2a1328[_0x70ba('0x3b')],'outboundDropCallsDayCallersExit':_0x2a1328['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2a1328['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2a1328['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2a1328[_0x70ba('0x3c')],'outboundOriginateFailureCallsDay':_0x2a1328[_0x70ba('0x3d')],'outboundReCallsDay':_0x2a1328['outboundReCallsDay'],'outboundRejectCallsDay':_0x2a1328['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2a1328[_0x70ba('0x3e')],'outboundAbandonedCallsDay':_0x2a1328['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x2a1328[_0x70ba('0x3f')],'predictiveIntervalAvgHoldtime':_0x2a1328[_0x70ba('0x40')],'predictiveIntervalAvgTalktime':_0x2a1328[_0x70ba('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x2a1328[_0x70ba('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x2a1328[_0x70ba('0x43')],'predictiveIntervalErlangCalls':_0x2a1328[_0x70ba('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x2a1328[_0x70ba('0x45')],'predictiveIntervalHitRate':_0x2a1328[_0x70ba('0x46')],'predictiveIntervalMultiplicativeFactor':_0x2a1328[_0x70ba('0x47')],'predictiveIntervalPauses':_0x2a1328[_0x70ba('0x48')],'predictiveIntervalAvailable':_0x2a1328[_0x70ba('0x49')],'predictiveIntervalTotalCalls':_0x2a1328['predictiveIntervalTotalCalls'],'message':_0x2a1328['message'],'originated':_0x2a1328[_0x70ba('0x4a')],'erlangCalls':_0x2a1328[_0x70ba('0x4b')],'erlangCallToSecond':_0x2a1328[_0x70ba('0x4c')],'erlangAbandonmentRate':_0x2a1328['erlangAbandonmentRate'],'erlangBusyFactor':_0x2a1328['erlangBusyFactor'],'startPredictive':_0x2a1328['startPredictive'],'startProgressive':_0x2a1328[_0x70ba('0x4d')]};if(_0x2a1328[_0x70ba('0x4e')]){_0x5ebe9d[_0x70ba('0x4e')]={'id':_0x2a1328['Trunk']['id'],'name':_0x2a1328[_0x70ba('0x4e')]['name'],'active':_0x2a1328['Trunk'][_0x70ba('0x4f')],'callerid':_0x2a1328['Trunk'][_0x70ba('0x50')]};}if(_0x2a1328[_0x70ba('0x51')]){_0x5ebe9d['Interval']={'id':_0x2a1328[_0x70ba('0x51')]['id'],'name':_0x2a1328[_0x70ba('0x51')][_0x70ba('0x2b')]};}var _0x48328e=md5(JSON[_0x70ba('0x52')](_0x5ebe9d));if(_0x2a1328[_0x70ba('0x4')]!==_0x48328e){_0x2a1328[_0x70ba('0x4')]=_0x48328e;emit(util[_0x70ba('0x53')]('voice:queue:%s',_0x5ebe9d[_0x70ba('0x2b')]),'voice_queue:save',_0x5ebe9d);}}}function emitVoiceQueueChannelRemove(_0x17707a){logger[_0x70ba('0x54')](_0x70ba('0x55'),JSON[_0x70ba('0x52')](_0x17707a));emit(util[_0x70ba('0x53')](_0x70ba('0x56'),_0x17707a[_0x70ba('0x2b')]),'voice_queue_channel:remove',_0x17707a);io[_0x70ba('0x28')](_0x70ba('0x57'),_0x17707a);}function notSendMessagesQueue(_0x31e713){if(_0x31e713[_0x70ba('0x58')]){if(_0x31e713[_0x70ba('0x4a')]===0x0&&_0x31e713[_0x70ba('0x59')]===0x0){_0x31e713['sendMessageOneNotActive']=![];_0x31e713[_0x70ba('0x2d')]=0x0;_0x31e713[_0x70ba('0x5a')]=0x0;_0x31e713[_0x70ba('0x5b')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x31e713[_0x70ba('0x2b')]+_0x70ba('0x5c'));}else{_0x31e713[_0x70ba('0x5b')]='IS_DISACTIVED';ut[_0x70ba('0x5d')](_0x70ba('0x5e'),_0x31e713[_0x70ba('0x2b')]+_0x70ba('0x5f'));}emitCampaignPreview(_0x31e713);}}Preview[_0x70ba('0x60')]['loopCampaigns']=function(){var _0x5ee74c=this;setInterval(function(){_0x5ee74c[_0x70ba('0x61')]();},0x7cf);};Preview[_0x70ba('0x60')][_0x70ba('0x61')]=function(){var _0x5a1edb=this['campaignsPreview'];this[_0x70ba('0x18')]+=0x1;for(var _0x4d6467 in _0x5a1edb){if(_0x5a1edb[_0x70ba('0x62')](_0x4d6467)&&(_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x7')||_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x63'))&&_0x5a1edb[_0x4d6467]['type']===_0x70ba('0x2a')){if(this[_0x70ba('0x18')]>0x7){this[_0x70ba('0x18')]=0x0;this[_0x70ba('0x64')]();}}if(_0x5a1edb[_0x70ba('0x62')](_0x4d6467)&&_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x7')&&_0x5a1edb[_0x4d6467][_0x70ba('0x29')]===_0x70ba('0x2a')){if(_0x5a1edb[_0x4d6467][_0x70ba('0x32')]){this[_0x70ba('0x65')](_0x5a1edb[_0x4d6467]);if(_0x5a1edb[_0x4d6467][_0x70ba('0x66')])this[_0x70ba('0x67')](_0x5a1edb[_0x4d6467]);}else{notSendMessagesQueue(_0x5a1edb[_0x4d6467]);}}}};Preview[_0x70ba('0x60')][_0x70ba('0x68')]=function(_0x529e38){var _0xd7638f=this;this[_0x70ba('0x69')]['enqueue'](function(){if(!_[_0x70ba('0x6a')](_0xd7638f[_0x70ba('0x16')][_0x529e38])){loggerAction[_0x70ba('0x54')](_0x70ba('0x6b'),_0x529e38,_0x70ba('0x6c'),_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')],'originated:\x20',JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]][_0x70ba('0x4a')]),_0x70ba('0x6e'),JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]][_0x70ba('0x59')]),JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6f')]),JSON[_0x70ba('0x52')](_[_0x70ba('0x70')](_0xd7638f[_0x70ba('0x16')][_0x529e38],['contactId',_0x70ba('0x71'),_0x70ba('0x72'),_0x70ba('0x73')])));return ami[_0x70ba('0x74')]({'action':'status','channel':_0xd7638f['actions'][_0x529e38]['channel']})[_0x70ba('0x75')](function(_0x32b54f){if(_0x32b54f['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0xd7638f[_0x70ba('0x16')][_0x529e38]){ut[_0x70ba('0x76')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]],_0x70ba('0x77'));if(_0xd7638f[_0x70ba('0x16')][_0x529e38]['dialAnswer']===!![]){ut['decrementTalkink'](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]],_0x70ba('0x77'));ut['loggerError'](_0x70ba('0x78')+_0x529e38,_0xd7638f[_0x70ba('0x16')][_0x529e38]['queue']);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x529e38,_0xd7638f['actions'][_0x529e38][_0x70ba('0x6d')]);delete _0xd7638f[_0x70ba('0x16')][_0x529e38];}},0x2328);}});}});};Preview[_0x70ba('0x60')]['clearZombieChannels']=function(){var _0x30a1b3=this;loggerAction[_0x70ba('0x54')](_0x70ba('0x79'),_['size'](this[_0x70ba('0x16')]));for(var _0x7ebcc5 in this['actions']){if(_0x30a1b3['actions'][_0x70ba('0x62')](_0x7ebcc5)){_0x30a1b3[_0x70ba('0x68')](_0x7ebcc5);}}};Preview[_0x70ba('0x60')][_0x70ba('0x67')]=function(_0x10e824){var _0x3717a0=this;rpcDb[_0x70ba('0x7a')](_0x10e824['id'],ut['agentReadyId'](this[_0x70ba('0x17')]))[_0x70ba('0x7b')](function(_0x4de412){if(!_['isNil'](_0x4de412)){for(var _0x137b7d=0x0;_0x137b7d<_0x4de412[_0x70ba('0x7c')];_0x137b7d+=0x1){if(ut['getDiff'](_0x4de412[_0x137b7d]['scheduledat'])<_0x10e824[_0x70ba('0x7d')]*0x3c){if(_0x4de412[_0x137b7d]['Agent']&&!_0x4de412[_0x137b7d]['Agent'][_0x70ba('0x7e')]){_0x3717a0[_0x70ba('0x7f')](_0x4de412[_0x137b7d]['id'])[_0x70ba('0x7b')](ut[_0x70ba('0x80')](_0x70ba('0x81')))[_0x70ba('0x75')](ut[_0x70ba('0x80')]('[RecallMe]'));}else{rpcDb[_0x70ba('0x82')](_0x4de412[_0x137b7d]['id']);}}else{var _0x46b32a=new Action(_0x4de412[_0x137b7d],_0x10e824);_0x46b32a[_0x70ba('0x83')]=moment()[_0x70ba('0x53')](_0x70ba('0x84'));_0x10e824[_0x70ba('0x85')]+=0x1;ut['logCustomer'](_0x46b32a,0x17,_0x70ba('0x86'));if(_0x10e824['dialRecallInQueue']){rpcDb[_0x70ba('0x87')](ut['createBody'](_0x4de412[_0x137b7d]));rpcDb[_0x70ba('0x88')](_0x46b32a,_0x70ba('0x89'));}else{ut[_0x70ba('0x8a')](_0x46b32a,0x16,_0x70ba('0x8b'));rpcDb[_0x70ba('0x88')](_0x46b32a,_0x70ba('0x8c'));rpcDb['createCustomerFinal'](_0x46b32a,_0x70ba('0x8c'));}}}}})['catch'](ut['logger2'](_0x70ba('0x8d')));};Preview[_0x70ba('0x60')]['setMessage']=function(_0x208333){_0x208333['sendMessageOneNotActive']=!![];if(ut[_0x70ba('0x8e')](_0x208333[_0x70ba('0x8f')])){_0x208333[_0x70ba('0x5b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x70ba('0x90')](_0x208333['dialActive'])){_0x208333[_0x70ba('0x5b')]='NOT_ACTIVE';}else if(!this[_0x70ba('0x91')](_0x208333[_0x70ba('0x4e')])){if(!this[_0x70ba('0x91')](_0x208333[_0x70ba('0x92')])){_0x208333['message']=_0x70ba('0x93');}else{_0x208333['message']=_0x70ba('0x94');}}else{_0x208333[_0x70ba('0x5b')]=_0x70ba('0x94');}emitCampaignPreview(_0x208333);};Preview[_0x70ba('0x60')]['callProgressDetectingCustomer']=function(_0x101c11,_0x90d90c,_0x3a2132){var _0x353918=this;var _0x14c761=this[_0x70ba('0x16')][_0x90d90c];var _0x2f3b29=this[_0x70ba('0x14')][_0x14c761['queue']];var _0x8b243b;if(_0x2f3b29){switch(_0x3a2132){case'1':_0x2f3b29[_0x70ba('0x3c')]+=0x1;_0x14c761[_0x70ba('0x95')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x0,_0x70ba('0x98'));ami['emit'](_0x70ba('0x99'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0x9b')));rpcDb[_0x70ba('0x88')](_0x14c761,_0x70ba('0x9c'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0x9f'));}else{if(_0x14c761[_0x70ba('0x95')]>=_0x2f3b29[_0x70ba('0xa0')]){rpcDb['createCustomerFinal'](_0x14c761,_0x70ba('0x9f'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,'countnosuchnumberretry',_0x2f3b29[_0x70ba('0xa3')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];break;case _0x70ba('0xa7'):var _0x22e520=moment()['format'](_0x70ba('0x84'));_0x14c761['responsetime']=_0x22e520;_0x14c761['answertime']=_0x22e520;_0x14c761[_0x70ba('0x6f')]=!![];_0x2f3b29[_0x70ba('0x59')]+=0x1;logger[_0x70ba('0x54')](_0x70ba('0xa8'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x2f3b29['pTalking']);ami[_0x70ba('0x28')](_0x70ba('0xab'),ut[_0x70ba('0x9a')](_0x14c761,'connect',this['campaignsPreview'][_0x14c761['queue']]));if(_0x2f3b29[_0x70ba('0xac')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x14c761));}break;case'16':ami[_0x70ba('0x28')](_0x70ba('0xad'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xae'),this[_0x70ba('0x14')][_0x14c761['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x14c761,_0x70ba('0xae')));_0x2f3b29[_0x70ba('0x38')]+=0x1;_0x2f3b29['total']+=0x1;_0x2f3b29[_0x70ba('0xaf')]+=0x1;ut[_0x70ba('0xb0')](_0x2f3b29,_0x70ba('0xb1'));_0x14c761['countglobal']=ut[_0x70ba('0x97')](_0x14c761);ut['logCustomer'](_0x14c761,0x4,_0x70ba('0xb2'));rpcDb[_0x70ba('0x88')](_0x14c761,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x70ba('0xb3')](_0x14c761,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x70ba('0xb4')](_0x14c761);_0x2f3b29[_0x70ba('0xb5')]+=_0x14c761['talktime'];_0x2f3b29[_0x70ba('0x2e')]+=_0x14c761[_0x70ba('0xb6')];logger[_0x70ba('0x54')](_0x70ba('0xb7'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x2f3b29[_0x70ba('0x59')]);delete this[_0x70ba('0x16')][_0x101c11['linkedid']];break;case _0x70ba('0xb8'):_0x2f3b29[_0x70ba('0x3a')]+=0x1;_0x14c761[_0x70ba('0xb9')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x5,'Busy');ami[_0x70ba('0x28')]('custom:agentbusy',ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xba')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xbb'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xbd'));}else{if(_0x14c761[_0x70ba('0xb9')]>=_0x2f3b29['dialBusyMaxRetry']){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xbb'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xb9'),_0x2f3b29[_0x70ba('0xbe')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}break;case'NOANSWER':_0x2f3b29[_0x70ba('0xbf')]+=0x1;_0x14c761[_0x70ba('0xc0')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x3,_0x70ba('0xc1'));ami[_0x70ba('0x28')]('custom:agentnoanswer',ut['buildObj'](_0x14c761,_0x70ba('0xc2')));rpcDb['createCustomerHistory'](_0x14c761,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xc3'));}else{if(_0x14c761['countnoanswerretry']>=_0x2f3b29['dialNoAnswerMaxRetry']){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xc4'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,'countnoanswerretry',_0x2f3b29[_0x70ba('0xc5')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}break;case _0x70ba('0xc6'):_0x2f3b29[_0x70ba('0xc7')]+=0x1;_0x14c761[_0x70ba('0xc8')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x8,_0x70ba('0xc9'));ami[_0x70ba('0x28')](_0x70ba('0xca'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xcb')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xcc'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut['cloneAction'](_0x14c761,0xf,'Global');rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0xcd'));}else{if(_0x14c761[_0x70ba('0xc8')]>=_0x2f3b29[_0x70ba('0xce')]){rpcDb[_0x70ba('0xb3')](_0x14c761,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xc8'),_0x2f3b29[_0x70ba('0xbe')]),_0x14c761['unlockAgent'],_0x14c761['activeContact']);}}break;case'CANCEL':_0x2f3b29[_0x70ba('0xcf')]+=0x1;_0x14c761['countagentrejectretry']+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x14,_0x70ba('0xd0'));ami['emit']('custom:agentreject',ut[_0x70ba('0x9a')](_0x14c761,'agentreject'));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xd1'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0x14,_0x70ba('0xd0'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xd2'));}else{if(_0x14c761[_0x70ba('0xd3')]>=_0x2f3b29[_0x70ba('0xd4')]){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xd2'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xd3'),_0x2f3b29[_0x70ba('0xd5')]),_0x14c761['unlockAgent'],_0x14c761[_0x70ba('0xa5')]);}}break;case _0x70ba('0xd6'):_0x2f3b29[_0x70ba('0xd7')]+=0x1;_0x14c761['countabandonedretry']+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut['logCustomer'](_0x14c761,0xb,_0x70ba('0xd8'));rpcDb['createCustomerHistory'](_0x14c761,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29['dialGlobalMaxRetry']){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xd9'));}else{if(_0x14c761[_0x70ba('0xda')]>=_0x2f3b29[_0x70ba('0xdb')]){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xd9'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xdc'),_0x2f3b29['dialAbandonedRetryFrequency']),_0x14c761[_0x70ba('0xa4')],_0x14c761['activeContact']);}}break;case'18':_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761[_0x70ba('0xdd')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x12,_0x101c11[_0x70ba('0xde')]||_0x101c11[_0x70ba('0xdf')]);ami[_0x70ba('0x28')](_0x70ba('0xe0'),ut['buildObj'](_0x14c761,'amd'));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xe1'));if(ut['totalGlobal'](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0xe1'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe1'));}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];break;case'19':_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761['countglobal']=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x13,_0x101c11[_0x70ba('0xde')]||_0x101c11['dialstatus']);ami[_0x70ba('0x28')]('custom:amd',ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xe2')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xe3'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xe3'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe3'));}delete this['actions'][_0x101c11[_0x70ba('0xa6')]];break;default:if(_0x14c761[_0x70ba('0x6f')]){ut[_0x70ba('0xb0')](_0x2f3b29,_0x70ba('0xe4'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2f3b29[_0x70ba('0x2b')],_0x101c11);}_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761['countglobal']=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0xc,_0x101c11[_0x70ba('0xde')]||_0x101c11[_0x70ba('0xdf')]);rpcDb[_0x70ba('0x88')](_0x14c761,_0x70ba('0xe5'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xe6'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe6'));}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];}if(!(_0x14c761[_0x70ba('0x6f')]&&_0x3a2132==='16')){ut['updateOriginated'](_0x2f3b29,_0x70ba('0xe7'));logger[_0x70ba('0x54')](_0x70ba('0xe8'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0xe9'),_0x2f3b29['originated']);}if(_0x3a2132!=='ANSWER'){delete this[_0x70ba('0x16')][_0x101c11['linkedid']];delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xea')]];}}};Preview[_0x70ba('0x60')][_0x70ba('0xeb')]=function(_0x3a01e9,_0x4109c8,_0x370cb4){if(_['isUndefined'](_0x4109c8)&&_0x70ba('0xec')!==typeof _0x4109c8){return;}if(_[_0x70ba('0xed')](_0x370cb4)&&_0x70ba('0xec')!==typeof _0x370cb4){return;}switch(_0x370cb4[_0x70ba('0xee')]){case'0':ut[_0x70ba('0xef')](_0x3a01e9,0x0,_0x70ba('0x98'));rpcDb['createAgentHistory'](_0x3a01e9,_0x70ba('0xf0'));break;case'3':ut[_0x70ba('0xef')](_0x3a01e9,0x3,_0x70ba('0xc1'));rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf2'));break;case'5':ut[_0x70ba('0xef')](_0x3a01e9,0x5,_0x70ba('0xf3'));rpcDb['createAgentHistory'](_0x3a01e9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x70ba('0xef')](_0x3a01e9,0x8,_0x70ba('0xc9'));rpcDb['createAgentHistory'](_0x3a01e9,_0x70ba('0xf4'));break;case'22':ut['logAgent'](_0x3a01e9,0x16,_0x70ba('0xf5'));rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf6'));break;default:ut[_0x70ba('0xef')](_0x3a01e9,0xc,_0x370cb4[_0x70ba('0xee')]);rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf4'));}ut[_0x70ba('0x76')](_0x4109c8,_0x70ba('0xf7'));logger['info'](_0x70ba('0xf8'),_0x3a01e9[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x4109c8['name'],_0x70ba('0xe9'),_0x4109c8[_0x70ba('0x4a')]);delete this['actions'][_0x3a01e9[_0x70ba('0xa9')]];};Preview[_0x70ba('0x60')][_0x70ba('0xf9')]=function(_0x43a657,_0x45e2fb,_0x3016dd,_0x1dc54c,_0x3732f0){var _0x2baf5d=this;return new BPromise(function(_0x48c6c0,_0x36bdb4){if(_[_0x70ba('0x6a')](_0x45e2fb)||_[_0x70ba('0x6a')](_0x45e2fb['Contact'])||_[_0x70ba('0x6a')](_0x45e2fb['Contact'][_0x70ba('0xfa')])||_[_0x70ba('0x6a')](_0x45e2fb['VoiceQueueId'])){_0x36bdb4(ut['message']('Contact\x20is\x20undefined',_0x1dc54c,_0x3732f0));return;}var _0x28e339=uuid['v4']();var _0x43aba3=_0x2baf5d[_0x70ba('0x14')][_0x45e2fb[_0x70ba('0x6c')][_0x70ba('0x2b')]];var _0x5cb03a=_0x3016dd?_0x2baf5d['agents'][_0x3016dd]['id']:undefined;_0x2baf5d[_0x70ba('0x16')][_0x28e339]=new Action(_0x45e2fb,_0x43aba3,_0x28e339,_0x3016dd,_0x5cb03a);var _0x5830c4=_0x2baf5d[_0x70ba('0x16')][_0x28e339];_0x5830c4[_0x70ba('0xa4')]=_0x1dc54c;_0x5830c4[_0x70ba('0xa5')]=_0x3732f0;_0x5830c4[_0x70ba('0xfb')]=_0x3016dd;if(_[_0x70ba('0xfc')](_0x43a657)){_0x2baf5d[_0x70ba('0xfd')](_0x5830c4,_0x43aba3,_0x45e2fb,_0x3016dd)[_0x70ba('0x7b')](function(_0x3d82d5){logger[_0x70ba('0x54')](_0x70ba('0xfe'),_0x70ba('0xff')+_0x5830c4[_0x70ba('0x6d')]+_0x70ba('0x100')+_0x5830c4[_0x70ba('0x101')],JSON[_0x70ba('0x52')](_0x3d82d5));ami[_0x70ba('0x28')]('custom:agentcalled',ut[_0x70ba('0x9a')](_0x5830c4,'called',_0x2baf5d[_0x70ba('0x14')][_0x5830c4['queue']]));_0x48c6c0(ut[_0x70ba('0x5b')](_0x70ba('0x102')));})['catch'](function(_0x296bc9){ut[_0x70ba('0x5d')](_0x70ba('0x103'),_0x296bc9);_0x36bdb4(ut[_0x70ba('0x5b')](_0x70ba('0x104'),_0x1dc54c,_0x3732f0));});}else{_0x43aba3[_0x70ba('0x39')]+=0x1;ut[_0x70ba('0x105')](_0x5830c4);rpcDb[_0x70ba('0x106')](_0x5830c4,_0x70ba('0x107'));delete _0x2baf5d[_0x70ba('0x16')][_0x28e339];_0x36bdb4(ut[_0x70ba('0x5b')]('Contact\x20in\x20black\x20List',_0x1dc54c,_0x3732f0));}});};Preview[_0x70ba('0x60')][_0x70ba('0x91')]=function(_0x1e1133){return!_['isNil'](_0x1e1133)&&!_[_0x70ba('0x6a')](_0x1e1133['name'])&&!_[_0x70ba('0x6a')](_0x1e1133['active'])&&_0x1e1133[_0x70ba('0x4f')]&&!_[_0x70ba('0x6a')](this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])])&&!_[_0x70ba('0x6a')](this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133['name'])]['status'])&&(this['trunks'][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])][_0x70ba('0x109')]==='reachable'||this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])]['status']===_0x70ba('0x10a'));};Preview[_0x70ba('0x60')]['run']=function(_0x13ce5d,_0x45a1f0){var _0x5d596a=this;return new BPromise(function(_0x20e690,_0x57a62f){_0x5d596a[_0x70ba('0x10b')](_0x13ce5d,_0x45a1f0)[_0x70ba('0x7b')](function(_0x32f8fd){_0x20e690(_[_0x70ba('0x70')](_0x32f8fd,['message']));})[_0x70ba('0x75')](function(_0x26f86f){if(_0x26f86f[_0x70ba('0x10c')]){rpcDb[_0x70ba('0x10d')](_0x13ce5d);}if(_0x26f86f[_0x70ba('0x4f')]){rpcDb['disableContact'](_0x13ce5d);}_0x57a62f(_[_0x70ba('0x70')](_0x26f86f,[_0x70ba('0x5b')]));});});};Preview['prototype'][_0x70ba('0x10b')]=function(_0x7d0cfa,_0x234fed){var _0x1b492c=this;return new BPromise(function(_0x2fcee0,_0x484ce6){var _0x17e3b4,_0x5cfc51;rpcDb['getContactPreview'](_0x7d0cfa)[_0x70ba('0x7b')](function(_0x1e1b11){if(!_['isNil'](_0x1e1b11[0x0])){_0x5cfc51=_0x1e1b11[0x0][_0x70ba('0x10e')]?![]:!![];_0x17e3b4=_0x1e1b11[0x0][_0x70ba('0x10e')]?!![]:![];_0x17e3b4=_0x234fed?!![]:_0x17e3b4;}var _0x4ad225=_0x1b492c['validateContact'](_0x1e1b11);if(_0x4ad225[_0x70ba('0x10f')]){rpcDb['checkIsBlackList'](_[_0x70ba('0x70')](_0x1e1b11[0x0],[_0x70ba('0x72'),_0x70ba('0x110')]))[_0x70ba('0x7b')](function(_0x54fa03){_0x1b492c[_0x70ba('0xf9')](_0x54fa03,_0x1e1b11[0x0],_0x234fed,_0x5cfc51,_0x17e3b4)[_0x70ba('0x7b')](function(_0x2c40c3){_0x2fcee0(_0x2c40c3);})[_0x70ba('0x75')](function(_0x45bde8){_0x484ce6(_0x45bde8);});})['catch'](function(_0xe76d93){ut['logger'](_0x70ba('0x111'),_0xe76d93);_0x484ce6(ut[_0x70ba('0x5b')]('Call\x20unsuccessful',_0x5cfc51,_0x17e3b4));});}else{_0x484ce6(ut[_0x70ba('0x5b')](_0x4ad225[_0x70ba('0x5b')],_0x5cfc51,_0x17e3b4));}})[_0x70ba('0x75')](function(_0x46d97c){ut[_0x70ba('0x5d')]('[Preview][getContactPreview]',_0x46d97c);_0x484ce6(ut[_0x70ba('0x5b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x70ba('0x60')][_0x70ba('0x112')]=function(_0x29b478){if(_[_0x70ba('0x6a')](_0x29b478)||_[_0x70ba('0xfc')](_0x29b478)||!_[_0x70ba('0x6a')](_0x29b478[0x0]['Agent'])&&_[_0x70ba('0x6a')](_0x29b478[0x0][_0x70ba('0x113')][_0x70ba('0x2b')])){ut[_0x70ba('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x29b478);return{'isValid':![],'message':_0x70ba('0x114')};}var _0x130a16=this[_0x70ba('0x14')][_0x29b478[0x0][_0x70ba('0x6c')][_0x70ba('0x2b')]];_0x130a16['message']=_0x70ba('0x94');if(_[_0x70ba('0x6a')](_0x130a16)){ut[_0x70ba('0x5d')](_0x70ba('0x115'),_0x130a16);return{'isValid':![],'message':_0x70ba('0x116')};}if(!this['isTrunkReachable'](_0x130a16[_0x70ba('0x4e')])){ut[_0x70ba('0x5d')](_0x70ba('0x117'),_0x70ba('0x118')+_0x130a16['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x70ba('0x91')](_0x130a16[_0x70ba('0x92')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x119'));return{'isValid':![],'message':_0x70ba('0x11a')};}}if(!ut['isActive'](_0x130a16[_0x70ba('0x32')])){ut['logger'](_0x70ba('0x11b'),_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x11c'));return{'isValid':![],'message':_0x70ba('0x118')+_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x11c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x70ba('0x60')]['execCall']=function(_0x32cabd,_0x1811cd,_0x296c66,_0xa5dc50){var _0x1025d8=this;return new BPromise(function(_0x1cf059,_0x37a6b1){var _0x1e08dd=_0x32cabd[_0x70ba('0xa9')];var _0x288811=_0x1025d8[_0x70ba('0x91')](_0x1811cd[_0x70ba('0x4e')])?util[_0x70ba('0x53')](_0x70ba('0x11d'),_0x1811cd[_0x70ba('0x4e')]['name'],_['isNil'](_0x1811cd[_0x70ba('0x37')])?'':_0x1811cd[_0x70ba('0x37')][_0x70ba('0x11e')]()||'',_0x1811cd[_0x70ba('0x11f')]>0x0?_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')][_0x70ba('0x121')](_0x1811cd[_0x70ba('0x11f')]):_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]):util['format'](_0x70ba('0x11d'),_[_0x70ba('0x6a')](_0x1811cd[_0x70ba('0x92')])?_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x2b')]:_0x1811cd[_0x70ba('0x92')][_0x70ba('0x2b')],_[_0x70ba('0x6a')](_0x1811cd[_0x70ba('0x37')])?'':_0x1811cd[_0x70ba('0x37')][_0x70ba('0x11e')]()||'',_0x1811cd[_0x70ba('0x11f')]>0x0?_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]['substring'](_0x1811cd[_0x70ba('0x11f')]):_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]);var _0x4871d9=_0x1025d8[_0x70ba('0x91')](_0x1811cd[_0x70ba('0x4e')])?ut[_0x70ba('0x122')](_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x50')],_0x1811cd['dialOriginateCallerIdName'],_0x1811cd['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x70ba('0x123')](_0x1811cd[_0x70ba('0x35')],_0x1811cd['dialRandomLastDigitCallerIdNumber']):_0x1811cd[_0x70ba('0x35')]):ut[_0x70ba('0x122')](_['isNil'](_0x1811cd[_0x70ba('0x92')])?_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x50')]:_0x1811cd['TrunkBackup'][_0x70ba('0x50')],_0x1811cd[_0x70ba('0x34')],_0x1811cd[_0x70ba('0x124')]>0x0?ut[_0x70ba('0x123')](_0x1811cd['dialOriginateCallerIdNumber'],_0x1811cd[_0x70ba('0x124')]):_0x1811cd['dialOriginateCallerIdNumber']);if(_0x4871d9){_0x32cabd['originatecalleridname']=ut[_0x70ba('0x125')](_0x4871d9);_0x32cabd[_0x70ba('0x126')]=ut[_0x70ba('0x127')](_0x4871d9);}var _0x4488ac=ut[_0x70ba('0x128')](_0x1811cd,_0x296c66,_0x288811,_0x4871d9,_0x1e08dd,_0x32cabd);_[_0x70ba('0x129')](_0x32cabd,ut[_0x70ba('0x12a')](_0x4488ac));_0x32cabd[_0x70ba('0x83')]=moment()['format'](_0x70ba('0x84'));ami[_0x70ba('0x74')](ut[_0x70ba('0x12b')](_0x32cabd,_0x1811cd,_0x4488ac,_0x32cabd[_0x70ba('0xa5')],_0xa5dc50))['then'](function(_0x2ffc7f){_0x1811cd['originated']+=0x1;logger['info']('[originated][increment]',_0x1e08dd,'\x20Queue',_0x1811cd[_0x70ba('0x2b')],_0x70ba('0xe9'),_0x1811cd['originated']);_0x1cf059(_0x2ffc7f);})[_0x70ba('0x75')](function(_0x101f0c){ut[_0x70ba('0xef')](_0x32cabd,0xe,_0x70ba('0x12c'));rpcDb[_0x70ba('0xf1')](_0x32cabd,_0x70ba('0x12d'));_0x37a6b1(_0x101f0c);});});};Preview['prototype'][_0x70ba('0x22')]=function(_0xba9e86){if(this[_0x70ba('0x16')][_0xba9e86[_0x70ba('0xa6')]]){this['actions'][_0xba9e86['linkedid']][_0x70ba('0x12e')]=_0xba9e86[_0x70ba('0x12e')];}};Preview[_0x70ba('0x60')][_0x70ba('0x19')]=function(_0x4aa467){var _0x4f0cc2=this;var _0x5b4710=this[_0x70ba('0x16')][_0x4aa467['actionid']];if(_0x5b4710){if(_0x5b4710['lookAgent']&&this[_0x70ba('0x17')][_0x5b4710[_0x70ba('0xfb')]]){ut[_0x70ba('0x12f')](_0x5b4710,this['agents'][_0x5b4710['lookAgent']]['name'],this[_0x70ba('0x17')][_0x5b4710[_0x70ba('0xfb')]]['id']);}var _0xe41962=_[_0x70ba('0x130')](_0x5b4710);_0xe41962['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2b8e7d=_0x4f0cc2['campaignsPreview'][_0x5b4710['queue']];if(ut[_0x70ba('0x131')](_0x4aa467[_0x70ba('0x132')])){if(_0x5b4710['unlockAgent']){rpcDb['unlockContact'](_0x5b4710[_0x70ba('0x101')]);}if(_0x5b4710[_0x70ba('0xa5')]){rpcDb[_0x70ba('0x82')](_0x5b4710['idContact']);}ami[_0x70ba('0x28')](_0x70ba('0x133'),ut['buildObj'](_0x5b4710,'rejected',this[_0x70ba('0x14')][_0x5b4710['queue']]));this[_0x70ba('0xeb')](_0xe41962,_0x2b8e7d,_0x4aa467);}else{_0x5b4710[_0x70ba('0x83')]=moment()[_0x70ba('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x70ba('0xef')](_0xe41962,0x4,_0x70ba('0xb2'));rpcDb[_0x70ba('0xf1')](_0xe41962,_0x70ba('0x134'));}}};Preview[_0x70ba('0x60')][_0x70ba('0x1c')]=function(_0x1b21cf){var _0x2ba231=this;var _0x17d5e0=this['actions'][_0x1b21cf[_0x70ba('0xa6')]];var _0x5da6f3;if(_0x17d5e0){_0x5da6f3=this[_0x70ba('0x14')][_0x17d5e0['queue']];logger['info']('[syncHangup][talking]',_0x1b21cf[_0x70ba('0xa6')],_0x70ba('0xaa'),_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);}if(this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]]&&_0x1b21cf[_0x70ba('0xa6')]!==_0x1b21cf[_0x70ba('0xa9')]){if(_0x1b21cf[_0x70ba('0x135')]==='16'&&this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]]['dialAnswer']){this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf[_0x70ba('0x135')]);}else if(this[_0x70ba('0x16')][_0x1b21cf['linkedid']][_0x70ba('0x6f')]){logger[_0x70ba('0x54')](_0x70ba('0x137'),_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')],_0x70ba('0xaa'),_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3['pTalking']);this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')]);}}else if(_0x17d5e0&&_[_0x70ba('0x6a')](_0x17d5e0[_0x70ba('0x138')])&&_0x5da6f3[_0x70ba('0x139')]&&_0x1b21cf['linkedid']===_0x1b21cf[_0x70ba('0xa9')]&&_[_0x70ba('0x6a')](_0x1b21cf[_0x70ba('0xee')])&&_0x1b21cf['cause']==='16'&&_0x1b21cf[_0x70ba('0x13a')]==='6'&&_[_0x70ba('0xed')](_0x17d5e0[_0x70ba('0x13b')])){if(_0x17d5e0[_0x70ba('0xa4')]){rpcDb[_0x70ba('0x10d')](_0x17d5e0[_0x70ba('0x101')]);}if(_0x17d5e0[_0x70ba('0xa5')]){rpcDb[_0x70ba('0x82')](_0x17d5e0[_0x70ba('0x101')]);}_0x1b21cf['reason']='22';this[_0x70ba('0xeb')](_0x17d5e0,_0x5da6f3,_0x1b21cf);}else if(_0x17d5e0&&_0x17d5e0['transfer']){if(_0x1b21cf[_0x70ba('0x135')]==='16'&&this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]][_0x70ba('0x6f')]){logger[_0x70ba('0x54')](_0x70ba('0x13c'),_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf['cause'],'\x20Queue',_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf['cause']);}else if(this[_0x70ba('0x16')][_0x1b21cf['linkedid']]['dialAnswer']){logger[_0x70ba('0x54')](_0x70ba('0x137'),_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')],'\x20Queue',_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);this['callProgressDetectingCustomer'](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf[_0x70ba('0x135')]);}}};Preview[_0x70ba('0x60')][_0x70ba('0x20')]=function(_0x13ed34){if(this[_0x70ba('0x16')][_0x13ed34['destlinkedid']]&&_0x13ed34['destlinkedid']!==_0x13ed34[_0x70ba('0x13d')]){this[_0x70ba('0x136')](_0x13ed34,_0x13ed34[_0x70ba('0xea')],_0x13ed34[_0x70ba('0xdf')]);}};Preview[_0x70ba('0x60')][_0x70ba('0x1e')]=function(_0x273095){if(this[_0x70ba('0x16')][_0x273095[_0x70ba('0xa6')]]&&_0x273095['linkedid']!==_0x273095[_0x70ba('0xa9')]&&!this[_0x70ba('0x16')][_0x273095[_0x70ba('0xa6')]][_0x70ba('0x6f')]){if(_0x273095[_0x70ba('0x135')]==='1'){this[_0x70ba('0x136')](_0x273095,_0x273095[_0x70ba('0xa6')],_0x273095['cause']);}}};Preview[_0x70ba('0x60')][_0x70ba('0x13e')]=function(_0x17b77e,_0x393f9f,_0x2b60a3){if(this[_0x70ba('0x16')][_0x17b77e]){if(_[_0x70ba('0x6a')](this[_0x70ba('0x16')][_0x17b77e][_0x70ba('0x13f')])){this[_0x70ba('0x16')][_0x17b77e]['variables']={};}this['actions'][_0x17b77e][_0x70ba('0x13f')][_0x393f9f]=_0x2b60a3;}};Preview[_0x70ba('0x60')][_0x70ba('0x140')]=function(_0x3e42f4){try{if(!_[_0x70ba('0x6a')](_0x3e42f4)){if(ut[_0x70ba('0x141')](_[_0x70ba('0x142')](_0x3e42f4['variable'])[0x0])){this[_0x70ba('0x13e')](_0x3e42f4[_0x70ba('0xa9')],_[_0x70ba('0x142')](_0x3e42f4[_0x70ba('0x143')])[0x0],_0x3e42f4[_0x70ba('0x144')]);}}}catch(_0x241596){logger[_0x70ba('0x145')](_0x70ba('0x146'),util[_0x70ba('0x147')](_0x241596,{'showHidden':![],'depth':null}));}};Preview[_0x70ba('0x60')]['syncAttendedTransfer']=function(_0x50eafc){if(_0x50eafc){if(this[_0x70ba('0x16')][_0x50eafc[_0x70ba('0x148')]]){this[_0x70ba('0x16')][_0x50eafc[_0x70ba('0x148')]][_0x70ba('0x13b')]=!![];}}};Preview[_0x70ba('0x60')][_0x70ba('0x26')]=function(_0x440cb7){if(_0x440cb7){if(this[_0x70ba('0x16')][_0x440cb7[_0x70ba('0x149')]]){this['actions'][_0x440cb7[_0x70ba('0x149')]][_0x70ba('0x13b')]=!![];}}};module[_0x70ba('0x14a')]=Preview; \ No newline at end of file +var _0xe14b=['sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','unlockAgent','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','unlock','execRun','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','phone','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','error','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','strategy','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','message','erlangCalls','erlangCallToSecond','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','preview','clearZombieChannels','outbound','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','Queue','originated:\x20','pTalking:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','decrementTalkink','loggerError','[action]','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue'];(function(_0x2ed3df,_0x5545cf){var _0x1cfe1c=function(_0x428258){while(--_0x428258){_0x2ed3df['push'](_0x2ed3df['shift']());}};_0x1cfe1c(++_0x5545cf);}(_0xe14b,0x93));var _0xbe14=function(_0x5d5eb4,_0x308f66){_0x5d5eb4=_0x5d5eb4-0x0;var _0x2295a9=_0xe14b[_0x5d5eb4];return _0x2295a9;};'use strict';var util=require(_0xbe14('0x0'));var _=require(_0xbe14('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xbe14('0x2'));var md5=require(_0xbe14('0x3'));var Redis=require('ioredis');var config=require(_0xbe14('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xbe14('0x5'))(_0xbe14('0x6'));var ami=require(_0xbe14('0x7'));var rpcDb=require(_0xbe14('0x8'));var Action=require(_0xbe14('0x9'));var ut=require(_0xbe14('0xa'));config[_0xbe14('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbe14('0xc'))(new Redis(config[_0xbe14('0xb')]));var Sequence=function(){};Sequence[_0xbe14('0xd')][_0xbe14('0xe')]=function(_0x53c7ea){this['tail']=this[_0xbe14('0xf')]?this[_0xbe14('0xf')]['finally'](_0x53c7ea):_0x53c7ea();};function Preview(_0x254c3b){this[_0xbe14('0x10')]=new Sequence();this[_0xbe14('0x11')]=_0x254c3b[_0xbe14('0x12')];this[_0xbe14('0x13')]=_0x254c3b[_0xbe14('0x13')];this[_0xbe14('0x14')]={};this[_0xbe14('0x15')]=_0x254c3b[_0xbe14('0x15')];this[_0xbe14('0x16')]=0x0;ami['on'](_0xbe14('0x17'),this[_0xbe14('0x18')][_0xbe14('0x19')](this));ami['on']('hangup',this['syncHangup'][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1a'),this[_0xbe14('0x1b')][_0xbe14('0x19')](this));ami['on']('dialend',this[_0xbe14('0x1c')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1d'),this[_0xbe14('0x1e')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x1f'),this[_0xbe14('0x20')]['bind'](this));ami['on'](_0xbe14('0x21'),this[_0xbe14('0x22')][_0xbe14('0x19')](this));ami['on'](_0xbe14('0x23'),this[_0xbe14('0x24')][_0xbe14('0x19')](this));this['loopCampaigns'](this[_0xbe14('0x11')]);}function emit(_0x4a1bbd,_0x417c8d,_0xc12977){io['to'](_0x4a1bbd)[_0xbe14('0x25')](_0x417c8d,_0xc12977);}function emitCampaignPreview(_0x51dc0b){if(_0x51dc0b[_0xbe14('0x26')]==='outbound'){var _0x3c1c85={'id':_0x51dc0b['id'],'name':_0x51dc0b['name'],'strategy':_0x51dc0b[_0xbe14('0x27')],'answered':_0x51dc0b['answered'],'available':_0x51dc0b[_0xbe14('0x28')],'loggedIn':_0x51dc0b[_0xbe14('0x29')],'pTalking':_0x51dc0b['pTalking'],'sumBillable':_0x51dc0b[_0xbe14('0x2a')],'sumDuration':_0x51dc0b['sumDuration'],'sumHoldTime':_0x51dc0b[_0xbe14('0x2b')]||0x0,'talking':_0x51dc0b['talking'],'total':_0x51dc0b[_0xbe14('0x2c')],'type':_0x51dc0b[_0xbe14('0x26')],'unmanaged':_0x51dc0b[_0xbe14('0x2d')],'abandoned':_0x51dc0b[_0xbe14('0x2e')],'waiting':_0x51dc0b[_0xbe14('0x2f')],'loggedInDb':_0x51dc0b[_0xbe14('0x30')],'dialActive':_0x51dc0b['dialActive'],'dialMethod':_0x51dc0b[_0xbe14('0x31')],'dialOriginateCallerIdName':_0x51dc0b[_0xbe14('0x32')],'dialOriginateCallerIdNumber':_0x51dc0b[_0xbe14('0x33')],'dialOriginateTimeout':_0x51dc0b[_0xbe14('0x34')],'dialPrefix':_0x51dc0b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x51dc0b[_0xbe14('0x35')],'outboundAnswerCallsDay':_0x51dc0b[_0xbe14('0x36')],'outboundBlacklistCallsDay':_0x51dc0b['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x51dc0b[_0xbe14('0x37')],'outboundCongestionCallsDay':_0x51dc0b[_0xbe14('0x38')],'outboundDropCallsDayACS':_0x51dc0b[_0xbe14('0x39')],'outboundDropCallsDayCallersExit':_0x51dc0b[_0xbe14('0x3a')],'outboundDropCallsDayTimeout':_0x51dc0b[_0xbe14('0x3b')],'outboundNoAnswerCallsDay':_0x51dc0b[_0xbe14('0x3c')],'outboundNoSuchCallsDay':_0x51dc0b[_0xbe14('0x3d')],'outboundOriginateFailureCallsDay':_0x51dc0b[_0xbe14('0x3e')],'outboundReCallsDay':_0x51dc0b[_0xbe14('0x3f')],'outboundRejectCallsDay':_0x51dc0b[_0xbe14('0x40')],'outboundUnknownCallsDay':_0x51dc0b[_0xbe14('0x41')],'outboundAbandonedCallsDay':_0x51dc0b[_0xbe14('0x42')],'predictiveIntervalAnsweredCalls':_0x51dc0b[_0xbe14('0x43')],'predictiveIntervalAvgHoldtime':_0x51dc0b[_0xbe14('0x44')],'predictiveIntervalAvgTalktime':_0x51dc0b[_0xbe14('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x51dc0b[_0xbe14('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x51dc0b[_0xbe14('0x47')],'predictiveIntervalErlangCalls':_0x51dc0b[_0xbe14('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x51dc0b[_0xbe14('0x49')],'predictiveIntervalHitRate':_0x51dc0b[_0xbe14('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x51dc0b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x51dc0b[_0xbe14('0x4b')],'predictiveIntervalAvailable':_0x51dc0b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51dc0b['predictiveIntervalTotalCalls'],'message':_0x51dc0b[_0xbe14('0x4c')],'originated':_0x51dc0b['originated'],'erlangCalls':_0x51dc0b[_0xbe14('0x4d')],'erlangCallToSecond':_0x51dc0b[_0xbe14('0x4e')],'erlangAbandonmentRate':_0x51dc0b['erlangAbandonmentRate'],'erlangBusyFactor':_0x51dc0b['erlangBusyFactor'],'startPredictive':_0x51dc0b['startPredictive'],'startProgressive':_0x51dc0b[_0xbe14('0x4f')]};if(_0x51dc0b[_0xbe14('0x50')]){_0x3c1c85['Trunk']={'id':_0x51dc0b[_0xbe14('0x50')]['id'],'name':_0x51dc0b[_0xbe14('0x50')][_0xbe14('0x51')],'active':_0x51dc0b[_0xbe14('0x50')][_0xbe14('0x52')],'callerid':_0x51dc0b['Trunk']['callerid']};}if(_0x51dc0b[_0xbe14('0x53')]){_0x3c1c85['Interval']={'id':_0x51dc0b['Interval']['id'],'name':_0x51dc0b['Interval'][_0xbe14('0x51')]};}var _0x393f6b=md5(JSON[_0xbe14('0x54')](_0x3c1c85));if(_0x51dc0b[_0xbe14('0x3')]!==_0x393f6b){_0x51dc0b[_0xbe14('0x3')]=_0x393f6b;emit(util[_0xbe14('0x55')](_0xbe14('0x56'),_0x3c1c85[_0xbe14('0x51')]),_0xbe14('0x57'),_0x3c1c85);}}}function emitVoiceQueueChannelRemove(_0x2dfd5a){logger[_0xbe14('0x58')](_0xbe14('0x59'),JSON['stringify'](_0x2dfd5a));emit(util['format'](_0xbe14('0x56'),_0x2dfd5a[_0xbe14('0x51')]),_0xbe14('0x5a'),_0x2dfd5a);io['emit'](_0xbe14('0x5b'),_0x2dfd5a);}function notSendMessagesQueue(_0x2aa453){if(_0x2aa453[_0xbe14('0x5c')]){if(_0x2aa453[_0xbe14('0x5d')]===0x0&&_0x2aa453[_0xbe14('0x5e')]===0x0){_0x2aa453[_0xbe14('0x5c')]=![];_0x2aa453[_0xbe14('0x28')]=0x0;_0x2aa453[_0xbe14('0x5f')]=0x0;_0x2aa453[_0xbe14('0x4c')]='NOT_ACTIVE';ut[_0xbe14('0x60')](_0xbe14('0x61'),_0x2aa453[_0xbe14('0x51')]+_0xbe14('0x62'));}else{_0x2aa453[_0xbe14('0x4c')]=_0xbe14('0x63');ut['logger'](_0xbe14('0x61'),_0x2aa453[_0xbe14('0x51')]+_0xbe14('0x64'));}emitCampaignPreview(_0x2aa453);}}Preview[_0xbe14('0xd')]['loopCampaigns']=function(){var _0x4bfa96=this;setInterval(function(){_0x4bfa96[_0xbe14('0x65')]();},0x7cf);};Preview[_0xbe14('0xd')][_0xbe14('0x65')]=function(){var _0x51c859=this['campaignsPreview'];this[_0xbe14('0x16')]+=0x1;for(var _0x59ae4d in _0x51c859){if(_0x51c859['hasOwnProperty'](_0x59ae4d)&&(_0x51c859[_0x59ae4d][_0xbe14('0x31')]===_0xbe14('0x66')||_0x51c859[_0x59ae4d][_0xbe14('0x31')]==='booked')&&_0x51c859[_0x59ae4d]['type']==='outbound'){if(this[_0xbe14('0x16')]>0x7){this[_0xbe14('0x16')]=0x0;this[_0xbe14('0x67')]();}}if(_0x51c859['hasOwnProperty'](_0x59ae4d)&&_0x51c859[_0x59ae4d][_0xbe14('0x31')]===_0xbe14('0x66')&&_0x51c859[_0x59ae4d][_0xbe14('0x26')]===_0xbe14('0x68')){if(_0x51c859[_0x59ae4d]['dialActive']){this['setMessage'](_0x51c859[_0x59ae4d]);if(_0x51c859[_0x59ae4d][_0xbe14('0x69')])this[_0xbe14('0x6a')](_0x51c859[_0x59ae4d]);}else{notSendMessagesQueue(_0x51c859[_0x59ae4d]);}}}};Preview[_0xbe14('0xd')][_0xbe14('0x6b')]=function(_0x2550dc){var _0x4f2d95=this;this['sequence'][_0xbe14('0xe')](function(){if(!_[_0xbe14('0x6c')](_0x4f2d95[_0xbe14('0x14')][_0x2550dc])){loggerAction[_0xbe14('0x58')]('[clearZombieChannels][talking]',_0x2550dc,_0xbe14('0x6d'),_0x4f2d95[_0xbe14('0x14')][_0x2550dc]['queue'],_0xbe14('0x6e'),JSON[_0xbe14('0x54')](_0x4f2d95[_0xbe14('0x11')][_0x4f2d95[_0xbe14('0x14')][_0x2550dc]['queue']]['originated']),_0xbe14('0x6f'),JSON[_0xbe14('0x54')](_0x4f2d95['campaignsPreview'][_0x4f2d95['actions'][_0x2550dc][_0xbe14('0x70')]][_0xbe14('0x5e')]),JSON[_0xbe14('0x54')](_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x71')]),JSON[_0xbe14('0x54')](_[_0xbe14('0x72')](_0x4f2d95['actions'][_0x2550dc],[_0xbe14('0x73'),_0xbe14('0x74'),_0xbe14('0x75'),_0xbe14('0x76')])));return ami[_0xbe14('0x77')]({'action':'status','channel':_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x78')]})[_0xbe14('0x79')](function(_0x20f46d){if(_0x20f46d[_0xbe14('0x4c')]===_0xbe14('0x7a')){setTimeout(function(){if(_0x4f2d95['actions'][_0x2550dc]){ut['updateOriginated'](_0x4f2d95[_0xbe14('0x11')][_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]],'[clearZombieChannel]');if(_0x4f2d95['actions'][_0x2550dc][_0xbe14('0x71')]===!![]){ut[_0xbe14('0x7b')](_0x4f2d95['campaignsPreview'][_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]],'[clearZombieChannel]');ut[_0xbe14('0x7c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2550dc,_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]);}ut[_0xbe14('0x7c')]('[Dialer][checkChannel][Preview]'+_0x2550dc,_0x4f2d95[_0xbe14('0x14')][_0x2550dc][_0xbe14('0x70')]);delete _0x4f2d95['actions'][_0x2550dc];}},0x2328);}});}});};Preview[_0xbe14('0xd')][_0xbe14('0x67')]=function(){var _0x2210cc=this;loggerAction[_0xbe14('0x58')](_0xbe14('0x7d'),_['size'](this[_0xbe14('0x14')]));for(var _0x34cd66 in this[_0xbe14('0x14')]){if(_0x2210cc[_0xbe14('0x14')][_0xbe14('0x7e')](_0x34cd66)){_0x2210cc[_0xbe14('0x6b')](_0x34cd66);}}};Preview[_0xbe14('0xd')]['recallMe']=function(_0x72c875){var _0x1b47a4=this;rpcDb[_0xbe14('0x7f')](_0x72c875['id'],ut[_0xbe14('0x80')](this[_0xbe14('0x15')]))[_0xbe14('0x81')](function(_0xd8f78f){if(!_[_0xbe14('0x6c')](_0xd8f78f)){for(var _0x285b6e=0x0;_0x285b6e<_0xd8f78f[_0xbe14('0x82')];_0x285b6e+=0x1){if(ut[_0xbe14('0x83')](_0xd8f78f[_0x285b6e]['scheduledat'])<_0x72c875['dialRecallMeTimeout']*0x3c){if(_0xd8f78f[_0x285b6e]['Agent']&&!_0xd8f78f[_0x285b6e][_0xbe14('0x84')][_0xbe14('0x85')]){_0x1b47a4[_0xbe14('0x86')](_0xd8f78f[_0x285b6e]['id'])[_0xbe14('0x81')](ut[_0xbe14('0x87')](_0xbe14('0x88')))[_0xbe14('0x79')](ut[_0xbe14('0x87')](_0xbe14('0x88')));}else{rpcDb[_0xbe14('0x89')](_0xd8f78f[_0x285b6e]['id']);}}else{var _0x603816=new Action(_0xd8f78f[_0x285b6e],_0x72c875);_0x603816[_0xbe14('0x8a')]=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));_0x72c875[_0xbe14('0x3f')]+=0x1;ut[_0xbe14('0x8c')](_0x603816,0x17,_0xbe14('0x8d'));if(_0x72c875[_0xbe14('0x8e')]){rpcDb[_0xbe14('0x8f')](ut[_0xbe14('0x90')](_0xd8f78f[_0x285b6e]));rpcDb['createCustomerHistory'](_0x603816,_0xbe14('0x91'));}else{ut[_0xbe14('0x8c')](_0x603816,0x16,_0xbe14('0x92'));rpcDb[_0xbe14('0x93')](_0x603816,_0xbe14('0x94'));rpcDb[_0xbe14('0x95')](_0x603816,_0xbe14('0x94'));}}}}})[_0xbe14('0x79')](ut[_0xbe14('0x87')](_0xbe14('0x96')));};Preview['prototype'][_0xbe14('0x97')]=function(_0x442ec4){_0x442ec4[_0xbe14('0x5c')]=!![];if(ut[_0xbe14('0x98')](_0x442ec4[_0xbe14('0x29')])){_0x442ec4['message']=_0xbe14('0x99');}else if(!ut[_0xbe14('0x9a')](_0x442ec4[_0xbe14('0x9b')])){_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0x9c');}else if(!this['isTrunkReachable'](_0x442ec4[_0xbe14('0x50')])){if(!this[_0xbe14('0x9d')](_0x442ec4[_0xbe14('0x9e')])){_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0x9f');}else{_0x442ec4[_0xbe14('0x4c')]=_0xbe14('0xa0');}}else{_0x442ec4[_0xbe14('0x4c')]='ACTIVE';}emitCampaignPreview(_0x442ec4);};Preview[_0xbe14('0xd')][_0xbe14('0xa1')]=function(_0x2fdf5d,_0x20b12e,_0x5982b7){var _0xa4b2a3=this;var _0x445302=this['actions'][_0x20b12e];var _0x4eedd2=this[_0xbe14('0x11')][_0x445302[_0xbe14('0x70')]];var _0x2d2643;if(_0x4eedd2){switch(_0x5982b7){case'1':_0x4eedd2[_0xbe14('0x3d')]+=0x1;_0x445302[_0xbe14('0xa2')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x0,'NoSuchNumber');ami['emit'](_0xbe14('0xa5'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xa7')));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xa8'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xac'));}else{if(_0x445302['countnosuchnumberretry']>=_0x4eedd2[_0xbe14('0xad')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xac'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xa2'),_0x4eedd2[_0xbe14('0xb0')]),_0x445302['unlockAgent'],_0x445302[_0xbe14('0xb1')]);}}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;case _0xbe14('0xb3'):var _0x28da4a=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));_0x445302[_0xbe14('0xb4')]=_0x28da4a;_0x445302['answertime']=_0x28da4a;_0x445302[_0xbe14('0x71')]=!![];_0x4eedd2[_0xbe14('0x5e')]+=0x1;logger[_0xbe14('0x58')](_0xbe14('0xb5'),_0x445302[_0xbe14('0xb6')],_0xbe14('0xb7'),_0x4eedd2['name'],_0xbe14('0x6f'),_0x4eedd2[_0xbe14('0x5e')]);ami[_0xbe14('0x25')](_0xbe14('0xb8'),ut['buildObj'](_0x445302,_0xbe14('0xb9'),this[_0xbe14('0x11')][_0x445302[_0xbe14('0x70')]]));if(_0x4eedd2[_0xbe14('0xba')]){ami[_0xbe14('0x25')](_0xbe14('0xbb'),ut[_0xbe14('0xbc')](_0x445302));}break;case'16':ami['emit'](_0xbe14('0xbd'),ut['buildObj'](_0x445302,_0xbe14('0xbe'),this['campaignsPreview'][_0x445302[_0xbe14('0x70')]]));emitVoiceQueueChannelRemove(ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xbe')));_0x4eedd2['outboundAnswerCallsDay']+=0x1;_0x4eedd2[_0xbe14('0x2c')]+=0x1;_0x4eedd2[_0xbe14('0xbf')]+=0x1;ut[_0xbe14('0x7b')](_0x4eedd2,'[16]');_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x4,_0xbe14('0xc0'));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xc1'));rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xc2'));rpcDb[_0xbe14('0xc3')](_0x445302);_0x4eedd2[_0xbe14('0xc4')]+=_0x445302[_0xbe14('0xc5')];_0x4eedd2[_0xbe14('0x2a')]+=_0x445302['talktime'];logger[_0xbe14('0x58')](_0xbe14('0xc6'),_0x445302[_0xbe14('0xb6')],'\x20Queue',_0x4eedd2[_0xbe14('0x51')],_0xbe14('0x6f'),_0x4eedd2[_0xbe14('0x5e')]);delete this['actions'][_0x2fdf5d[_0xbe14('0xb2')]];break;case _0xbe14('0xc7'):_0x4eedd2['outboundBusyCallsDay']+=0x1;_0x445302[_0xbe14('0xc8')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x5,'Busy');ami['emit'](_0xbe14('0xc9'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xca')));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xcb'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,'Global');rpcDb['createCustomerFinal'](_0x2d2643,_0xbe14('0xcc'));}else{if(_0x445302[_0xbe14('0xc8')]>=_0x4eedd2[_0xbe14('0xcd')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xcb'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,'countbusyretry',_0x4eedd2[_0xbe14('0xce')]),_0x445302['unlockAgent'],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xcf'):_0x4eedd2[_0xbe14('0x3c')]+=0x1;_0x445302[_0xbe14('0xd0')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x3,_0xbe14('0xd1'));ami['emit'](_0xbe14('0xd2'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xd3')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xd4'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xd5'));}else{if(_0x445302[_0xbe14('0xd0')]>=_0x4eedd2[_0xbe14('0xd6')]){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xd4'));}else{rpcDb[_0xbe14('0xae')](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xd0'),_0x4eedd2[_0xbe14('0xd7')]),_0x445302[_0xbe14('0xd8')],_0x445302['activeContact']);}}break;case _0xbe14('0xd9'):_0x4eedd2['outboundCongestionCallsDay']+=0x1;_0x445302[_0xbe14('0xda')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x8,_0xbe14('0xdb'));ami['emit']('custom:agentcongestion',ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xdc')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xdd'));if(ut['totalGlobal'](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,'Global');rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xde'));}else{if(_0x445302[_0xbe14('0xda')]>=_0x4eedd2[_0xbe14('0xdf')]){rpcDb['createCustomerFinal'](_0x445302,_0xbe14('0xdd'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x445302,_0xbe14('0xda'),_0x4eedd2[_0xbe14('0xce')]),_0x445302[_0xbe14('0xd8')],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xe0'):_0x4eedd2['outboundRejectCallsDay']+=0x1;_0x445302[_0xbe14('0xe1')]+=0x1;_0x445302[_0xbe14('0xa3')]=ut['totalGlobal'](_0x445302);ut['logCustomer'](_0x445302,0x14,_0xbe14('0xe2'));ami[_0xbe14('0x25')]('custom:agentreject',ut[_0xbe14('0xa6')](_0x445302,'agentreject'));rpcDb[_0xbe14('0x93')](_0x445302,'[syncHangupRequest][logAgentReject]');if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2['dialGlobalMaxRetry']){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0x14,'AgentReject');rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xe3'));}else{if(_0x445302['countagentrejectretry']>=_0x4eedd2['dialAgentRejectMaxRetry']){rpcDb[_0xbe14('0x95')](_0x445302,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0xbe14('0xaf')](_0x445302,_0xbe14('0xe1'),_0x4eedd2[_0xbe14('0xe4')]),_0x445302[_0xbe14('0xd8')],_0x445302[_0xbe14('0xb1')]);}}break;case _0xbe14('0xe5'):_0x4eedd2[_0xbe14('0x42')]+=0x1;_0x445302['countabandonedretry']+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0xb,_0xbe14('0xe6'));rpcDb['createCustomerHistory'](_0x445302,_0xbe14('0xe7'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut['cloneAction'](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x445302[_0xbe14('0xe8')]>=_0x4eedd2['dialAbandonedMaxRety']){rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xe7'));}else{rpcDb[_0xbe14('0xae')](ut['scheduledAt'](_0x445302,_0xbe14('0xe9'),_0x4eedd2['dialAbandonedRetryFrequency']),_0x445302[_0xbe14('0xd8')],_0x445302['activeContact']);}}break;case'18':_0x4eedd2['outboundUnknownCallsDay']+=0x1;_0x445302[_0xbe14('0xea')]+=0x1;_0x445302['countglobal']=ut[_0xbe14('0xa4')](_0x445302);ut['logCustomer'](_0x445302,0x12,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);ami[_0xbe14('0x25')](_0xbe14('0xed'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xee')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xef'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xef'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;case'19':_0x4eedd2[_0xbe14('0x41')]+=0x1;_0x445302['countglobal']=ut['totalGlobal'](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0x13,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);ami[_0xbe14('0x25')](_0xbe14('0xed'),ut[_0xbe14('0xa6')](_0x445302,_0xbe14('0xee')));rpcDb[_0xbe14('0x93')](_0x445302,_0xbe14('0xf0'));if(ut[_0xbe14('0xa4')](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut[_0xbe14('0xaa')](_0x445302,0xf,_0xbe14('0xab'));rpcDb[_0xbe14('0x95')](_0x2d2643,_0xbe14('0xf0'));}else{rpcDb[_0xbe14('0x95')](_0x445302,_0xbe14('0xf0'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];break;default:if(_0x445302[_0xbe14('0x71')]){ut[_0xbe14('0x7b')](_0x4eedd2,_0xbe14('0xf1'));ut[_0xbe14('0x7c')](_0xbe14('0xf2')+_0x4eedd2[_0xbe14('0x51')],_0x2fdf5d);}_0x4eedd2['outboundUnknownCallsDay']+=0x1;_0x445302[_0xbe14('0xa3')]=ut[_0xbe14('0xa4')](_0x445302);ut[_0xbe14('0x8c')](_0x445302,0xc,_0x2fdf5d[_0xbe14('0xeb')]||_0x2fdf5d[_0xbe14('0xec')]);rpcDb[_0xbe14('0x93')](_0x445302,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x445302)>=_0x4eedd2[_0xbe14('0xa9')]){_0x2d2643=ut['cloneAction'](_0x445302,0xf,_0xbe14('0xab'));rpcDb['createCustomerFinal'](_0x2d2643,_0xbe14('0xf3'));}else{rpcDb['createCustomerFinal'](_0x445302,_0xbe14('0xf3'));}delete this[_0xbe14('0x14')][_0x2fdf5d[_0xbe14('0xb2')]];}if(!(_0x445302[_0xbe14('0x71')]&&_0x5982b7==='16')){ut[_0xbe14('0xf4')](_0x4eedd2,_0xbe14('0xf5'));logger[_0xbe14('0x58')](_0xbe14('0xf6'),_0x445302[_0xbe14('0xb6')],'\x20Queue',_0x4eedd2[_0xbe14('0x51')],_0xbe14('0x6e'),_0x4eedd2[_0xbe14('0x5d')]);}if(_0x5982b7!==_0xbe14('0xb3')){delete this['actions'][_0x2fdf5d[_0xbe14('0xb2')]];delete this['actions'][_0x2fdf5d[_0xbe14('0xf7')]];}}};Preview['prototype'][_0xbe14('0xf8')]=function(_0x3e7588,_0x24fa89,_0x5c134f){if(_[_0xbe14('0xf9')](_0x24fa89)&&'object'!==typeof _0x24fa89){return;}if(_[_0xbe14('0xf9')](_0x5c134f)&&_0xbe14('0xfa')!==typeof _0x5c134f){return;}switch(_0x5c134f[_0xbe14('0xfb')]){case'0':ut[_0xbe14('0xfc')](_0x3e7588,0x0,_0xbe14('0xfd'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0xff'));break;case'3':ut[_0xbe14('0xfc')](_0x3e7588,0x3,_0xbe14('0xd1'));rpcDb['createAgentHistory'](_0x3e7588,_0xbe14('0x100'));break;case'5':ut['logAgent'](_0x3e7588,0x5,_0xbe14('0x101'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x102'));break;case'8':ut['logAgent'](_0x3e7588,0x8,_0xbe14('0xdb'));rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x103'));break;case'22':ut[_0xbe14('0xfc')](_0x3e7588,0x16,_0xbe14('0x104'));rpcDb['createAgentHistory'](_0x3e7588,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbe14('0xfc')](_0x3e7588,0xc,_0x5c134f['reason']);rpcDb[_0xbe14('0xfe')](_0x3e7588,_0xbe14('0x103'));}ut[_0xbe14('0xf4')](_0x24fa89,_0xbe14('0x105'));logger['info'](_0xbe14('0x106'),_0x3e7588[_0xbe14('0xb6')],'\x20Queue',_0x24fa89[_0xbe14('0x51')],_0xbe14('0x6e'),_0x24fa89[_0xbe14('0x5d')]);delete this[_0xbe14('0x14')][_0x3e7588['uniqueid']];};Preview[_0xbe14('0xd')][_0xbe14('0x107')]=function(_0x37aff6,_0x3374d8,_0x3b7920,_0x469ef3,_0x208fae){var _0x310d42=this;return new BPromise(function(_0x9c229f,_0x1e8989){if(_['isNil'](_0x3374d8)||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x108')])||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x108')]['phone'])||_[_0xbe14('0x6c')](_0x3374d8[_0xbe14('0x75')])){_0x1e8989(ut[_0xbe14('0x4c')]('Contact\x20is\x20undefined',_0x469ef3,_0x208fae));return;}var _0x431602=uuid['v4']();var _0x3778e0=_0x310d42[_0xbe14('0x11')][_0x3374d8[_0xbe14('0x6d')][_0xbe14('0x51')]];var _0x2306f6=_0x3b7920?_0x310d42[_0xbe14('0x15')][_0x3b7920]['id']:undefined;_0x310d42['actions'][_0x431602]=new Action(_0x3374d8,_0x3778e0,_0x431602,_0x3b7920,_0x2306f6);var _0x2c2e46=_0x310d42['actions'][_0x431602];_0x2c2e46[_0xbe14('0xd8')]=_0x469ef3;_0x2c2e46[_0xbe14('0xb1')]=_0x208fae;_0x2c2e46[_0xbe14('0x109')]=_0x3b7920;if(_[_0xbe14('0x10a')](_0x37aff6)){_0x310d42[_0xbe14('0x10b')](_0x2c2e46,_0x3778e0,_0x3374d8,_0x3b7920)['then'](function(_0x5db8e8){logger[_0xbe14('0x58')](_0xbe14('0x10c'),_0xbe14('0x10d')+_0x2c2e46[_0xbe14('0x70')]+'\x20IdHopper:\x20'+_0x2c2e46[_0xbe14('0x10e')],JSON[_0xbe14('0x54')](_0x5db8e8));ami[_0xbe14('0x25')]('custom:agentcalled',ut[_0xbe14('0xa6')](_0x2c2e46,'called',_0x310d42['campaignsPreview'][_0x2c2e46[_0xbe14('0x70')]]));_0x9c229f(ut[_0xbe14('0x4c')](_0xbe14('0x10f')));})['catch'](function(_0x3ea9c2){ut[_0xbe14('0x60')]('[Preview][execCall][failure]',_0x3ea9c2);_0x1e8989(ut[_0xbe14('0x4c')](_0xbe14('0x110'),_0x469ef3,_0x208fae));});}else{_0x3778e0[_0xbe14('0x111')]+=0x1;ut['logBlacklist'](_0x2c2e46);rpcDb[_0xbe14('0x112')](_0x2c2e46,_0xbe14('0x113'));delete _0x310d42[_0xbe14('0x14')][_0x431602];_0x1e8989(ut[_0xbe14('0x4c')](_0xbe14('0x114'),_0x469ef3,_0x208fae));}});};Preview['prototype'][_0xbe14('0x9d')]=function(_0x2dc3a6){return!_[_0xbe14('0x6c')](_0x2dc3a6)&&!_['isNil'](_0x2dc3a6[_0xbe14('0x51')])&&!_[_0xbe14('0x6c')](_0x2dc3a6[_0xbe14('0x52')])&&_0x2dc3a6[_0xbe14('0x52')]&&!_[_0xbe14('0x6c')](this[_0xbe14('0x13')][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])])&&!_[_0xbe14('0x6c')](this[_0xbe14('0x13')][util['format'](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])][_0xbe14('0x116')])&&(this['trunks'][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6[_0xbe14('0x51')])]['status']===_0xbe14('0x117')||this['trunks'][util[_0xbe14('0x55')](_0xbe14('0x115'),_0x2dc3a6['name'])][_0xbe14('0x116')]===_0xbe14('0x118'));};Preview['prototype'][_0xbe14('0x86')]=function(_0x1e1540,_0x133ae9){var _0x27c892=this;return new BPromise(function(_0x246a02,_0x1662df){_0x27c892['execRun'](_0x1e1540,_0x133ae9)['then'](function(_0x319d08){_0x246a02(_[_0xbe14('0x72')](_0x319d08,[_0xbe14('0x4c')]));})[_0xbe14('0x79')](function(_0x48ec55){if(_0x48ec55[_0xbe14('0x119')]){rpcDb['unlockContact'](_0x1e1540);}if(_0x48ec55[_0xbe14('0x52')]){rpcDb[_0xbe14('0x89')](_0x1e1540);}_0x1662df(_['pick'](_0x48ec55,[_0xbe14('0x4c')]));});});};Preview[_0xbe14('0xd')][_0xbe14('0x11a')]=function(_0x1f06ec,_0x1137a9){var _0x17c8cc=this;return new BPromise(function(_0x1b7d69,_0x8625bb){var _0x220d5d,_0x3117fc;rpcDb[_0xbe14('0x11b')](_0x1f06ec)[_0xbe14('0x81')](function(_0x4ed1f7){if(!_[_0xbe14('0x6c')](_0x4ed1f7[0x0])){_0x3117fc=_0x4ed1f7[0x0][_0xbe14('0x11c')]?![]:!![];_0x220d5d=_0x4ed1f7[0x0][_0xbe14('0x11c')]?!![]:![];_0x220d5d=_0x1137a9?!![]:_0x220d5d;}var _0x4087b6=_0x17c8cc['validateContact'](_0x4ed1f7);if(_0x4087b6[_0xbe14('0x11d')]){rpcDb[_0xbe14('0x11e')](_['pick'](_0x4ed1f7[0x0],[_0xbe14('0x75'),_0xbe14('0x11f')]))[_0xbe14('0x81')](function(_0x4a6fc3){_0x17c8cc[_0xbe14('0x107')](_0x4a6fc3,_0x4ed1f7[0x0],_0x1137a9,_0x3117fc,_0x220d5d)[_0xbe14('0x81')](function(_0x25a038){_0x1b7d69(_0x25a038);})[_0xbe14('0x79')](function(_0x2279d1){_0x8625bb(_0x2279d1);});})['catch'](function(_0x23208d){ut[_0xbe14('0x60')](_0xbe14('0x120'),_0x23208d);_0x8625bb(ut[_0xbe14('0x4c')](_0xbe14('0x121'),_0x3117fc,_0x220d5d));});}else{_0x8625bb(ut['message'](_0x4087b6[_0xbe14('0x4c')],_0x3117fc,_0x220d5d));}})[_0xbe14('0x79')](function(_0x8eeaef){ut[_0xbe14('0x60')](_0xbe14('0x122'),_0x8eeaef);_0x8625bb(ut[_0xbe14('0x4c')](_0xbe14('0x121'),![],!![]));});});};Preview[_0xbe14('0xd')]['validateContact']=function(_0x5c25dc){if(_[_0xbe14('0x6c')](_0x5c25dc)||_[_0xbe14('0x10a')](_0x5c25dc)||!_[_0xbe14('0x6c')](_0x5c25dc[0x0][_0xbe14('0x84')])&&_[_0xbe14('0x6c')](_0x5c25dc[0x0]['Agent'][_0xbe14('0x51')])){ut[_0xbe14('0x60')](_0xbe14('0x123'),_0x5c25dc);return{'isValid':![],'message':_0xbe14('0x124')};}var _0x1257b2=this[_0xbe14('0x11')][_0x5c25dc[0x0][_0xbe14('0x6d')][_0xbe14('0x51')]];_0x1257b2['message']=_0xbe14('0xa0');if(_[_0xbe14('0x6c')](_0x1257b2)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x1257b2);return{'isValid':![],'message':_0xbe14('0x125')};}if(!this['isTrunkReachable'](_0x1257b2[_0xbe14('0x50')])){ut[_0xbe14('0x60')](_0xbe14('0x126'),_0xbe14('0x127')+_0x1257b2[_0xbe14('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xbe14('0x9d')](_0x1257b2[_0xbe14('0x9e')])){ut[_0xbe14('0x60')](_0xbe14('0x126'),_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x128'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x1257b2[_0xbe14('0x9b')])){ut['logger'](_0xbe14('0x129'),_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x12a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1257b2[_0xbe14('0x51')]+_0xbe14('0x12a')};}return{'isValid':!![],'message':_0xbe14('0x12b')};};Preview[_0xbe14('0xd')][_0xbe14('0x10b')]=function(_0x2e5106,_0x156fb3,_0x513b6f,_0x2fd64c){var _0x5d5fad=this;return new BPromise(function(_0x5e8d27,_0x4e849c){var _0x4e3261=_0x2e5106[_0xbe14('0xb6')];var _0x1c899d=_0x5d5fad['isTrunkReachable'](_0x156fb3[_0xbe14('0x50')])?util['format'](_0xbe14('0x12c'),_0x156fb3['Trunk'][_0xbe14('0x51')],_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x12d')])?'':_0x156fb3[_0xbe14('0x12d')][_0xbe14('0x12e')]()||'',_0x156fb3['dialCutDigit']>0x0?_0x513b6f[_0xbe14('0x108')][_0xbe14('0x12f')][_0xbe14('0x130')](_0x156fb3[_0xbe14('0x131')]):_0x513b6f['Contact']['phone']):util['format'](_0xbe14('0x12c'),_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x9e')])?_0x156fb3[_0xbe14('0x50')][_0xbe14('0x51')]:_0x156fb3['TrunkBackup']['name'],_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x12d')])?'':_0x156fb3[_0xbe14('0x12d')][_0xbe14('0x12e')]()||'',_0x156fb3[_0xbe14('0x131')]>0x0?_0x513b6f['Contact'][_0xbe14('0x12f')]['substring'](_0x156fb3[_0xbe14('0x131')]):_0x513b6f[_0xbe14('0x108')][_0xbe14('0x12f')]);var _0x1d1c84=_0x5d5fad['isTrunkReachable'](_0x156fb3[_0xbe14('0x50')])?ut[_0xbe14('0x132')](_0x156fb3[_0xbe14('0x50')][_0xbe14('0x133')],_0x156fb3['dialOriginateCallerIdName'],_0x156fb3[_0xbe14('0x134')]>0x0?ut[_0xbe14('0x135')](_0x156fb3[_0xbe14('0x33')],_0x156fb3['dialRandomLastDigitCallerIdNumber']):_0x156fb3['dialOriginateCallerIdNumber']):ut[_0xbe14('0x132')](_[_0xbe14('0x6c')](_0x156fb3[_0xbe14('0x9e')])?_0x156fb3['Trunk'][_0xbe14('0x133')]:_0x156fb3[_0xbe14('0x9e')][_0xbe14('0x133')],_0x156fb3[_0xbe14('0x32')],_0x156fb3[_0xbe14('0x134')]>0x0?ut[_0xbe14('0x135')](_0x156fb3['dialOriginateCallerIdNumber'],_0x156fb3[_0xbe14('0x134')]):_0x156fb3[_0xbe14('0x33')]);if(_0x1d1c84){_0x2e5106[_0xbe14('0x136')]=ut[_0xbe14('0x137')](_0x1d1c84);_0x2e5106[_0xbe14('0x138')]=ut['extractCalleridNumber'](_0x1d1c84);}var _0x4d2094=ut[_0xbe14('0x139')](_0x156fb3,_0x513b6f,_0x1c899d,_0x1d1c84,_0x4e3261,_0x2e5106);_['merge'](_0x2e5106,ut[_0xbe14('0x13a')](_0x4d2094));_0x2e5106['starttime']=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));ami[_0xbe14('0x77')](ut['variablesAction'](_0x2e5106,_0x156fb3,_0x4d2094,_0x2e5106[_0xbe14('0xb1')],_0x2fd64c))[_0xbe14('0x81')](function(_0x2602ec){_0x156fb3[_0xbe14('0x5d')]+=0x1;logger[_0xbe14('0x58')](_0xbe14('0x13b'),_0x4e3261,_0xbe14('0xb7'),_0x156fb3[_0xbe14('0x51')],_0xbe14('0x6e'),_0x156fb3[_0xbe14('0x5d')]);_0x5e8d27(_0x2602ec);})['catch'](function(_0x1f1fb9){ut[_0xbe14('0xfc')](_0x2e5106,0xe,_0xbe14('0x13c'));rpcDb[_0xbe14('0xfe')](_0x2e5106,_0xbe14('0x13d'));_0x4e849c(_0x1f1fb9);});});};Preview[_0xbe14('0xd')][_0xbe14('0x1e')]=function(_0x36010e){if(this['actions'][_0x36010e[_0xbe14('0xb2')]]){this[_0xbe14('0x14')][_0x36010e[_0xbe14('0xb2')]][_0xbe14('0x78')]=_0x36010e[_0xbe14('0x78')];}};Preview[_0xbe14('0xd')]['syncOriginateResponse']=function(_0x479c1a){var _0x4f09fb=this;var _0x598ccc=this[_0xbe14('0x14')][_0x479c1a[_0xbe14('0x13e')]];if(_0x598ccc){if(_0x598ccc['lookAgent']&&this[_0xbe14('0x15')][_0x598ccc['lookAgent']]){ut[_0xbe14('0x13f')](_0x598ccc,this[_0xbe14('0x15')][_0x598ccc[_0xbe14('0x109')]][_0xbe14('0x51')],this[_0xbe14('0x15')][_0x598ccc[_0xbe14('0x109')]]['id']);}var _0x4f727c=_[_0xbe14('0x140')](_0x598ccc);_0x4f727c[_0xbe14('0xb4')]=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));var _0xc7acb6=_0x4f09fb[_0xbe14('0x11')][_0x598ccc[_0xbe14('0x70')]];if(ut[_0xbe14('0x141')](_0x479c1a[_0xbe14('0x142')])){if(_0x598ccc['unlockAgent']){rpcDb[_0xbe14('0x143')](_0x598ccc['idContact']);}if(_0x598ccc[_0xbe14('0xb1')]){rpcDb['disableContact'](_0x598ccc['idContact']);}ami[_0xbe14('0x25')](_0xbe14('0x144'),ut[_0xbe14('0xa6')](_0x598ccc,'rejected',this[_0xbe14('0x11')][_0x598ccc['queue']]));this[_0xbe14('0xf8')](_0x4f727c,_0xc7acb6,_0x479c1a);}else{_0x598ccc['starttime']=moment()[_0xbe14('0x55')](_0xbe14('0x8b'));ut[_0xbe14('0xfc')](_0x4f727c,0x4,_0xbe14('0xc0'));rpcDb[_0xbe14('0xfe')](_0x4f727c,_0xbe14('0x145'));}}};Preview['prototype'][_0xbe14('0x146')]=function(_0x1100c1){var _0x4d46a3=this;var _0x52cdfd=this['actions'][_0x1100c1[_0xbe14('0xb2')]];var _0x40ef0a;if(_0x52cdfd){_0x40ef0a=this[_0xbe14('0x11')][_0x52cdfd[_0xbe14('0x70')]];logger[_0xbe14('0x58')](_0xbe14('0x147'),_0x1100c1[_0xbe14('0xb2')],'\x20Queue',_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a[_0xbe14('0x5e')]);}if(this['actions'][_0x1100c1[_0xbe14('0xb2')]]&&_0x1100c1[_0xbe14('0xb2')]!==_0x1100c1[_0xbe14('0xb6')]){if(_0x1100c1['cause']==='16'&&this['actions'][_0x1100c1[_0xbe14('0xb2')]]['dialAnswer']){this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}else if(this[_0xbe14('0x14')][_0x1100c1[_0xbe14('0xb2')]][_0xbe14('0x71')]){logger['info'](_0xbe14('0x149'),_0x1100c1['linkedid'],_0x1100c1[_0xbe14('0x148')],_0xbe14('0xb7'),_0x40ef0a[_0xbe14('0x51')],'pTalking:\x20',_0x40ef0a[_0xbe14('0x5e')]);this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1['linkedid'],_0x1100c1['cause']);}}else if(_0x52cdfd&&_[_0xbe14('0x6c')](_0x52cdfd[_0xbe14('0x14a')])&&_0x40ef0a[_0xbe14('0x14b')]&&_0x1100c1['linkedid']===_0x1100c1[_0xbe14('0xb6')]&&_[_0xbe14('0x6c')](_0x1100c1['reason'])&&_0x1100c1['cause']==='16'&&_0x1100c1['channelstate']==='6'&&_['isUndefined'](_0x52cdfd[_0xbe14('0x14c')])){if(_0x52cdfd[_0xbe14('0xd8')]){rpcDb['unlockContact'](_0x52cdfd['idContact']);}if(_0x52cdfd[_0xbe14('0xb1')]){rpcDb[_0xbe14('0x89')](_0x52cdfd[_0xbe14('0x10e')]);}_0x1100c1['reason']='22';this[_0xbe14('0xf8')](_0x52cdfd,_0x40ef0a,_0x1100c1);}else if(_0x52cdfd&&_0x52cdfd[_0xbe14('0x14c')]){if(_0x1100c1[_0xbe14('0x148')]==='16'&&this[_0xbe14('0x14')][_0x1100c1['linkedid']][_0xbe14('0x71')]){logger[_0xbe14('0x58')]('[syncHangup][talking][transfer]',_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')],_0xbe14('0xb7'),_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a['pTalking']);this['callProgressDetectingCustomer'](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}else if(this[_0xbe14('0x14')][_0x1100c1[_0xbe14('0xb2')]]['dialAnswer']){logger[_0xbe14('0x58')](_0xbe14('0x149'),_0x1100c1['linkedid'],_0x1100c1[_0xbe14('0x148')],'\x20Queue',_0x40ef0a[_0xbe14('0x51')],_0xbe14('0x6f'),_0x40ef0a['pTalking']);this[_0xbe14('0xa1')](_0x1100c1,_0x1100c1[_0xbe14('0xb2')],_0x1100c1[_0xbe14('0x148')]);}}};Preview[_0xbe14('0xd')][_0xbe14('0x1c')]=function(_0xac2d63){if(this[_0xbe14('0x14')][_0xac2d63[_0xbe14('0xf7')]]&&_0xac2d63['destlinkedid']!==_0xac2d63[_0xbe14('0x14d')]){this[_0xbe14('0xa1')](_0xac2d63,_0xac2d63[_0xbe14('0xf7')],_0xac2d63['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x2a5e45){if(this[_0xbe14('0x14')][_0x2a5e45[_0xbe14('0xb2')]]&&_0x2a5e45['linkedid']!==_0x2a5e45['uniqueid']&&!this[_0xbe14('0x14')][_0x2a5e45[_0xbe14('0xb2')]][_0xbe14('0x71')]){if(_0x2a5e45[_0xbe14('0x148')]==='1'){this[_0xbe14('0xa1')](_0x2a5e45,_0x2a5e45[_0xbe14('0xb2')],_0x2a5e45[_0xbe14('0x148')]);}}};Preview[_0xbe14('0xd')][_0xbe14('0x14e')]=function(_0x4b76dd,_0x43509d,_0x3a2890){if(this[_0xbe14('0x14')][_0x4b76dd]){if(_[_0xbe14('0x6c')](this[_0xbe14('0x14')][_0x4b76dd]['variables'])){this[_0xbe14('0x14')][_0x4b76dd]['variables']={};}this['actions'][_0x4b76dd][_0xbe14('0x14f')][_0x43509d]=_0x3a2890;}};Preview[_0xbe14('0xd')]['syncVarSet']=function(_0x494083){try{if(!_[_0xbe14('0x6c')](_0x494083)){if(ut[_0xbe14('0x150')](_[_0xbe14('0x151')](_0x494083[_0xbe14('0x152')])[0x0])){this[_0xbe14('0x14e')](_0x494083['uniqueid'],_['keys'](_0x494083[_0xbe14('0x152')])[0x0],_0x494083['value']);}}}catch(_0x76e84){logger[_0xbe14('0x153')]('[syncVarSet][Preview]',util['inspect'](_0x76e84,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xbe14('0x22')]=function(_0x4ee0ad){if(_0x4ee0ad){if(this[_0xbe14('0x14')][_0x4ee0ad[_0xbe14('0x154')]]){this['actions'][_0x4ee0ad[_0xbe14('0x154')]][_0xbe14('0x14c')]=!![];}}};Preview[_0xbe14('0xd')][_0xbe14('0x24')]=function(_0x2ed138){if(_0x2ed138){if(this['actions'][_0x2ed138[_0xbe14('0x155')]]){this[_0xbe14('0x14')][_0x2ed138[_0xbe14('0x155')]][_0xbe14('0x14c')]=!![];}}};module[_0xbe14('0x156')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ba6ea2f..c659cad 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 _0x4290=['resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','then','catch','[createHistory]\x20'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0x4290,0xc1));var _0x0429=function(_0x3d7941,_0x38b97b){_0x3d7941=_0x3d7941-0x0;var _0x452573=_0x4290[_0x3d7941];return _0x452573;};'use strict';var util=require(_0x0429('0x0'));var BPromise=require(_0x0429('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x0429('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x0429('0x3'));var cmHopperBlack=require(_0x0429('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0429('0x5'));function loggerCatch(_0x5194d2){return function(_0x327c29){logger[_0x0429('0x6')](_0x5194d2,util[_0x0429('0x7')](_0x327c29,{'showHidden':![],'depth':null}));};}function create(_0x3e17f5){return BPromise['resolve']()[_0x0429('0x8')](cmHopperHistory['createHistory'](_0x3e17f5))[_0x0429('0x9')](loggerCatch(_0x0429('0xa')));}function createAgent(_0xae2757){return BPromise[_0x0429('0xb')]()['then'](agentReportPreview['createHistory'](_0xae2757))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5c2187){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper[_0x0429('0xc')](_0x5c2187,!![]))[_0x0429('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x0429('0xd')]=function(_0x416eb2){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopperBlack[_0x0429('0xd')](_0x416eb2))[_0x0429('0x9')](loggerCatch(_0x0429('0xe')));};exports['getContactPreview']=function(_0x81b85){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper[_0x0429('0xf')](_0x81b85))['catch'](loggerCatch(_0x0429('0x10')));};exports[_0x0429('0x11')]=function(_0x387573,_0x31682e){create(_0x387573)[_0x0429('0x9')](loggerCatch(_0x31682e));moveContact(_0x387573)[_0x0429('0x9')](loggerCatch(_0x31682e));};exports[_0x0429('0x12')]=function(_0xa47e3a,_0x399ec0){createAgent(_0xa47e3a)[_0x0429('0x9')](loggerCatch(_0x399ec0));};exports[_0x0429('0x13')]=function(_0xf2c007,_0x311ccd){create(_0xf2c007)[_0x0429('0x9')](loggerCatch(_0x311ccd));};exports[_0x0429('0x14')]=function(_0x2fc94d,_0x3ead49){moveContact(_0x2fc94d)[_0x0429('0x9')](loggerCatch(_0x3ead49));};exports[_0x0429('0x15')]=function(_0x5e5334,_0x29c2fb,_0x43b35b){if(_0x29c2fb){_0x5e5334['UserId']=null;}if(_0x43b35b){_0x5e5334['active']=![];}return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper['rescheduleContact'](_0x5e5334))[_0x0429('0x9')](loggerCatch(_0x0429('0x16')));};exports[_0x0429('0x17')]=function(_0x1e81cf){return BPromise[_0x0429('0xb')]()['then'](cmHopper['countReScheduled'](_0x1e81cf))['catch'](loggerCatch(_0x0429('0x18')));};exports['unlockContact']=function(_0x555573){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper['unlockContact']({'UserId':null},_0x555573,0x1))['catch'](loggerCatch(_0x0429('0x19')));};exports[_0x0429('0x1a')]=function(_0x421cbc){return BPromise['resolve']()[_0x0429('0x8')](cmHopper['unlockContact']({'active':![]},_0x421cbc,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x0429('0x1b')]=function(_0x1a7470){var _0x5572ed={};_0x5572ed['type']=_0x1a7470['type'];_0x5572ed[_0x0429('0x1c')]=_0x1a7470[_0x0429('0x1c')];_0x5572ed['calleridnum']=_0x1a7470[_0x0429('0x1d')];_0x5572ed[_0x0429('0x1e')]=_0x1a7470['calleridname'];_0x5572ed[_0x0429('0x1f')]=_0x1a7470['queue'];_0x5572ed[_0x0429('0x20')]=_0x1a7470[_0x0429('0x21')];_0x5572ed['queuecallerleaveAt']=_0x1a7470['answertime'];_0x5572ed[_0x0429('0x22')]=0x1;_0x5572ed[_0x0429('0x23')]=_0x1a7470[_0x0429('0x24')];_0x5572ed[_0x0429('0x25')]=_0x1a7470[_0x0429('0x26')];_0x5572ed[_0x0429('0x27')]='from-sip';_0x5572ed['exten']=_0x0429('0x28');_0x5572ed[_0x0429('0x29')]=0x0;_0x5572ed[_0x0429('0x2a')]=0x1;_0x5572ed[_0x0429('0x2b')]=_0x1a7470[_0x0429('0x26')];_0x5572ed[_0x0429('0x2c')]=_0x0429('0x2d');return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](voiceQueueReport[_0x0429('0x2e')](_0x5572ed))['catch'](loggerCatch(_0x0429('0x2f')));};exports[_0x0429('0x30')]=function(_0x4aaeb4,_0x759517){return BPromise['resolve']()[_0x0429('0x8')](cmHopper[_0x0429('0x30')](_0x4aaeb4,_0x759517))[_0x0429('0x9')](loggerCatch(_0x0429('0x31')));};exports['rescheduleContactInQueue']=function(_0x1477de){return BPromise['resolve']()[_0x0429('0x8')](cmHopper[_0x0429('0x15')](_0x1477de,!![],!![]))[_0x0429('0x9')](loggerCatch(_0x0429('0x32')));}; \ No newline at end of file +var _0x51ec=['[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','[createHistory]\x20','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x51ec,0x114));var _0xc51e=function(_0x5632fb,_0x1ba956){_0x5632fb=_0x5632fb-0x0;var _0x580ed9=_0x51ec[_0x5632fb];return _0x580ed9;};'use strict';var util=require(_0xc51e('0x0'));var BPromise=require(_0xc51e('0x1'));var logger=require(_0xc51e('0x2'))('preview');var _=require(_0xc51e('0x3'));var cmHopper=require(_0xc51e('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xc51e('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xc51e('0x6'));var voiceQueueReport=require(_0xc51e('0x7'));function loggerCatch(_0x307088){return function(_0x104941){logger['error'](_0x307088,util[_0xc51e('0x8')](_0x104941,{'showHidden':![],'depth':null}));};}function create(_0x1e6bb4){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopperHistory['createHistory'](_0x1e6bb4))['catch'](loggerCatch(_0xc51e('0xb')));}function createAgent(_0x516b30){return BPromise['resolve']()[_0xc51e('0xa')](agentReportPreview[_0xc51e('0xc')](_0x516b30))[_0xc51e('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3f7750){return BPromise['resolve']()[_0xc51e('0xa')](cmHopper[_0xc51e('0xe')](_0x3f7750,!![]))[_0xc51e('0xd')](loggerCatch(_0xc51e('0xf')));}exports[_0xc51e('0x10')]=function(_0xd2878a){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopperBlack[_0xc51e('0x10')](_0xd2878a))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x11712f){return BPromise['resolve']()[_0xc51e('0xa')](cmHopper[_0xc51e('0x11')](_0x11712f))[_0xc51e('0xd')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x39fb7f,_0x3179c4){create(_0x39fb7f)[_0xc51e('0xd')](loggerCatch(_0x3179c4));moveContact(_0x39fb7f)[_0xc51e('0xd')](loggerCatch(_0x3179c4));};exports[_0xc51e('0x12')]=function(_0x47792d,_0x3044aa){createAgent(_0x47792d)[_0xc51e('0xd')](loggerCatch(_0x3044aa));};exports[_0xc51e('0x13')]=function(_0x39ecc7,_0x3db1e1){create(_0x39ecc7)[_0xc51e('0xd')](loggerCatch(_0x3db1e1));};exports['createCustomerFinal']=function(_0x52edd0,_0x22cad0){moveContact(_0x52edd0)[_0xc51e('0xd')](loggerCatch(_0x22cad0));};exports[_0xc51e('0x14')]=function(_0x3e17bb,_0x140073,_0x1752c6){if(_0x140073){_0x3e17bb[_0xc51e('0x15')]=null;}if(_0x1752c6){_0x3e17bb[_0xc51e('0x16')]=![];}return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopper[_0xc51e('0x14')](_0x3e17bb))[_0xc51e('0xd')](loggerCatch(_0xc51e('0x17')));};exports['countReScheduled']=function(_0x4d281f){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopper[_0xc51e('0x18')](_0x4d281f))[_0xc51e('0xd')](loggerCatch(_0xc51e('0x19')));};exports['unlockContact']=function(_0x340734){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopper['unlockContact']({'UserId':null},_0x340734,0x1))[_0xc51e('0xd')](loggerCatch(_0xc51e('0x1a')));};exports[_0xc51e('0x1b')]=function(_0x11fcfc){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopper[_0xc51e('0x1c')]({'active':![]},_0x11fcfc,0x1))['catch'](loggerCatch(_0xc51e('0x1d')));};exports[_0xc51e('0x1e')]=function(_0x4a0c8f){var _0x4f891f={};_0x4f891f[_0xc51e('0x1f')]=_0x4a0c8f[_0xc51e('0x1f')];_0x4f891f[_0xc51e('0x20')]=_0x4a0c8f['uniqueid'];_0x4f891f[_0xc51e('0x21')]=_0x4a0c8f[_0xc51e('0x21')];_0x4f891f[_0xc51e('0x22')]=_0x4a0c8f[_0xc51e('0x22')];_0x4f891f[_0xc51e('0x23')]=_0x4a0c8f[_0xc51e('0x23')];_0x4f891f[_0xc51e('0x24')]=_0x4a0c8f['answertime'];_0x4f891f['queuecallerleaveAt']=_0x4a0c8f[_0xc51e('0x25')];_0x4f891f[_0xc51e('0x26')]=0x1;_0x4f891f[_0xc51e('0x27')]=_0x4a0c8f[_0xc51e('0x28')];_0x4f891f[_0xc51e('0x29')]=_0x4a0c8f[_0xc51e('0x2a')];_0x4f891f[_0xc51e('0x2b')]='from-sip';_0x4f891f[_0xc51e('0x2c')]=_0xc51e('0x2d');_0x4f891f[_0xc51e('0x2e')]=0x0;_0x4f891f[_0xc51e('0x2f')]=0x1;_0x4f891f[_0xc51e('0x30')]=_0x4a0c8f[_0xc51e('0x2a')];_0x4f891f[_0xc51e('0x31')]=_0xc51e('0x32');return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](voiceQueueReport[_0xc51e('0x33')](_0x4f891f))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xc51e('0x34')]=function(_0x4c1a6d,_0x434964){return BPromise['resolve']()[_0xc51e('0xa')](cmHopper[_0xc51e('0x34')](_0x4c1a6d,_0x434964))[_0xc51e('0xd')](loggerCatch(_0xc51e('0x35')));};exports['rescheduleContactInQueue']=function(_0x34097c){return BPromise[_0xc51e('0x9')]()[_0xc51e('0xa')](cmHopper[_0xc51e('0x14')](_0x34097c,!![],!![]))['catch'](loggerCatch(_0xc51e('0x36')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d85d324..0a2534c 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 _0xf2f1=['totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','seconds','createBody','CampaignId','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','error','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','format','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','channelAgent','from-sip'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xf2f1,0xda));var _0x1f2f=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0xf2f1[_0x5a4a1e];return _0x13b91d;};'use strict';var util=require(_0x1f2f('0x0'));var _=require(_0x1f2f('0x1'));var moment=require(_0x1f2f('0x2'));var logger=require(_0x1f2f('0x3'))(_0x1f2f('0x4'));var ipAgi=process[_0x1f2f('0x5')][_0x1f2f('0x6')]||'127.0.0.1';function getSeconds(_0x4d3a32,_0x23b89d){var _0x4ab288=moment(_0x4d3a32)[_0x1f2f('0x7')](0x0);var _0x1c4699=moment(_0x23b89d)[_0x1f2f('0x7')](0x0);return _0x4ab288[_0x1f2f('0x8')](_0x1c4699,'seconds');}exports['loggerCatch']=function(_0x4d5b47){return function(_0x5e1ae5){logger[_0x1f2f('0x9')](_0x4d5b47,util[_0x1f2f('0xa')](_0x5e1ae5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x109cad,_0x4d0249){logger['info'](_0x109cad,util[_0x1f2f('0xa')](_0x4d0249,{'showHidden':![],'depth':null}));};exports[_0x1f2f('0xb')]=function(_0x46d048,_0x5e05f6){logger[_0x1f2f('0x9')](_0x46d048,util[_0x1f2f('0xa')](_0x5e05f6,{'showHidden':![],'depth':null}));};exports[_0x1f2f('0xc')]=function(_0x5146ab){return function(_0x4d07ca){logger['info'](_0x5146ab,util['inspect'](_0x4d07ca,{'showHidden':![],'depth':null}));};};exports[_0x1f2f('0xd')]=function(_0x54ba8d,_0x4f6005,_0x16789c){return{'message':_0x54ba8d,'unlock':_0x4f6005,'active':_0x16789c};};exports[_0x1f2f('0xe')]=function(_0x1f3f80,_0x4f665e,_0x270c5b){if(!_[_0x1f2f('0xf')](_0x270c5b)&&_0x1f2f('0x10')===typeof _0x270c5b&&!_[_0x1f2f('0x11')](_0x270c5b)){if(!_[_0x1f2f('0xf')](_0x4f665e)&&'string'===typeof _0x4f665e&&!_[_0x1f2f('0x11')](_0x4f665e)){return util['format'](_0x1f2f('0x12'),_0x4f665e,_0x270c5b);}return util['format'](_0x1f2f('0x12'),_0x270c5b,_0x270c5b);}if(!_[_0x1f2f('0xf')](_0x1f3f80)&&_0x1f2f('0x10')===typeof _0x1f3f80&&!_['isEmpty'](_0x1f3f80)){return _0x1f3f80;}return _0x1f2f('0x13');};exports[_0x1f2f('0x14')]=function(_0xe37616){if(_['isNil'](_0xe37616)){return![];}return _0xe37616;};exports[_0x1f2f('0x15')]=function(_0x400862,_0x88838,_0x36d63e,_0x44d85b,_0x11adb9,_0x595b77){var _0x1d85f0={'XMD-QUEUE':_0x88838[_0x1f2f('0x16')]?_0x88838['Queue'][_0x1f2f('0x17')]:'','XMD-CALLERID':_0x44d85b,'XMD-CALLERID-PREVIEW':_0x595b77?util['format']('\x22%s\x22\x20<%s>',_0x595b77['calleridname'],_0x595b77[_0x1f2f('0x18')]):_0x44d85b,'XMD-DIALID':_0x11adb9,'XMD-CONTACTID':_0x88838[_0x1f2f('0x19')],'XMD-CDRTYPE':_0x1f2f('0x1a'),'CALLERID(all)':_0x44d85b,'XMD-VOICEQUEUEID':_0x88838['VoiceQueueId'],'XMD-DIALCHANNEL':_0x36d63e,'XMD-DIALTIMEOUT':_0x400862[_0x1f2f('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x1f2f('0x1c'),_0x400862[_0x1f2f('0x1d')]?'g':'',_[_0x1f2f('0x11')](_0x400862[_0x1f2f('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x400862[_0x1f2f('0x1f')]||'','XMD-AGI':_0x400862[_0x1f2f('0x20')]?util[_0x1f2f('0x21')](_0x1f2f('0x22'),ipAgi,_0x400862[_0x1f2f('0x20')]):_0x1f2f('0x23'),'XMD-AGIAFTER':_0x400862[_0x1f2f('0x1d')]?util[_0x1f2f('0x21')](_0x1f2f('0x22'),ipAgi,_0x400862[_0x1f2f('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x595b77?_0x595b77[_0x1f2f('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x595b77?_0x595b77['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x1f2f('0x25')};if(!_[_0x1f2f('0x11')](_0x400862['monitor_format'])){_0x1d85f0[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x400862[_0x1f2f('0x1e')];_0x1d85f0[util[_0x1f2f('0x21')]('%s',_0x1f2f('0x26'))]=_0x11adb9;}if(_0x88838&&_0x88838[_0x1f2f('0x27')]){for(var _0x1f12c5 in _0x88838[_0x1f2f('0x27')]){if(_0x88838[_0x1f2f('0x27')]['hasOwnProperty'](_0x1f12c5)){if(!_[_0x1f2f('0x28')](_0x88838['Contact'][_0x1f12c5])&&_0x1f12c5!=='id'&&_0x1f12c5!=='tags'&&_0x1f12c5!==_0x1f2f('0x29')&&_0x1f12c5!==_0x1f2f('0x2a')){_0x1d85f0[util[_0x1f2f('0x21')](_0x1f2f('0x2b'),_0x1f2f('0x2c'),_[_0x1f2f('0x2d')](_0x1f12c5))]=_0x88838[_0x1f2f('0x27')][_0x1f12c5];}}}}return _0x1d85f0;};exports[_0x1f2f('0x2e')]=function(_0x2b4514){var _0x3f051b={};for(var _0x5776a7 in _0x2b4514){if(_0x2b4514['hasOwnProperty'](_0x5776a7)){_0x3f051b[util[_0x1f2f('0x21')]('%s',_['toLower'](_0x5776a7))]=_0x2b4514[_0x5776a7];}}return{'variables':_0x3f051b};};exports[_0x1f2f('0x2f')]=function(_0x1cf0d7,_0x1644c1){if(!_[_0x1f2f('0x28')](_0x1cf0d7)){if(_0x1cf0d7[_0x1f2f('0x30')](_0x1f2f('0x31'))){if(_0x1cf0d7[_0x1f2f('0x31')]>0x0){_0x1cf0d7[_0x1f2f('0x31')]-=0x1;}else{logger[_0x1f2f('0x9')](_0x1f2f('0x32'),_0x1644c1);}}}else{logger[_0x1f2f('0x9')](_0x1f2f('0x33'),_0x1644c1);}};exports[_0x1f2f('0x34')]=function(_0x5bf356){var _0x1f6ec7=moment()[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x5bf356[_0x1f2f('0x36')]=0xd;_0x5bf356['statedesc']=_0x1f2f('0x37');_0x5bf356[_0x1f2f('0x38')]=_0x1f6ec7;_0x5bf356[_0x1f2f('0x39')]=_0x1f6ec7;_0x5bf356[_0x1f2f('0x3a')]=_0x1f6ec7;};exports[_0x1f2f('0x3b')]=function(_0xb24283,_0x2dc84c,_0x18f4ee){var _0x407f18=moment()['format'](_0x1f2f('0x35'));_0xb24283[_0x1f2f('0x36')]=_0x2dc84c;_0xb24283[_0x1f2f('0x3c')]=_0x18f4ee;_0xb24283['responsetime']=_0x407f18;_0xb24283[_0x1f2f('0x3d')]=getSeconds(_0xb24283[_0x1f2f('0x39')],_0xb24283['starttime']);};exports[_0x1f2f('0x3e')]=function(_0x50bf97,_0x2983ca,_0x391863){_0x50bf97[_0x1f2f('0x3f')]=_0x2983ca;_0x50bf97[_0x1f2f('0x40')]=_0x391863;};exports[_0x1f2f('0x41')]=function(_0x11cb50,_0x2f7fe7,_0x5518b7){var _0x4f0c35=moment()[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x11cb50[_0x1f2f('0x36')]=_0x2f7fe7;_0x11cb50['statedesc']=_0x5518b7;_0x11cb50[_0x1f2f('0x39')]=_0x11cb50['responsetime']?_0x11cb50[_0x1f2f('0x39')]:_0x4f0c35;_0x11cb50[_0x1f2f('0x3a')]=_0x11cb50[_0x1f2f('0x3a')]?_0x11cb50[_0x1f2f('0x3a')]:_0x4f0c35;_0x11cb50[_0x1f2f('0x3d')]=getSeconds(_0x11cb50[_0x1f2f('0x39')]||0x0,_0x11cb50['starttime']||0x0);_0x11cb50[_0x1f2f('0x42')]=_0x11cb50[_0x1f2f('0x43')]?getSeconds(_0x11cb50['endtime'],_0x11cb50[_0x1f2f('0x43')]):0x0;};exports[_0x1f2f('0x44')]=function(_0x981741){return _0x981741===_0x1f2f('0x45');};exports[_0x1f2f('0x46')]=function(_0x1abcd9,_0x503372,_0x4e97ea,_0x17d0f5,_0x236727){var _0x4aa91d=_0x17d0f5?_0x1f2f('0x47'):_0x1abcd9[_0x1f2f('0x48')];_0x4aa91d=_0x236727?'BOOKED':_0x4aa91d;return{'actionid':_0x1abcd9[_0x1f2f('0x49')],'action':'originate','channel':_0x1abcd9[_0x1f2f('0x4a')],'callerid':util[_0x1f2f('0x21')]('\x22%s\x22\x20<%s>',_0x4aa91d,_0x1abcd9[_0x1f2f('0x18')]),'Exten':'xcally-motion-preview','Context':_0x1f2f('0x4b'),'Priority':'1','variable':_0x4e97ea,'timeout':(_0x503372['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1abcd9['uniqueid']};};exports[_0x1f2f('0x4c')]=function(_0x2ea1d6){return _0x2ea1d6[_0x1f2f('0x4d')]+_0x2ea1d6[_0x1f2f('0x4e')]+_0x2ea1d6[_0x1f2f('0x4f')]+_0x2ea1d6[_0x1f2f('0x50')]+_0x2ea1d6[_0x1f2f('0x51')];};exports[_0x1f2f('0x52')]=function(_0x2cf55d){var _0x1d62a3=_[_0x1f2f('0x53')](_0x2cf55d);_0x1d62a3[_0x1f2f('0x36')]=0xf;_0x1d62a3[_0x1f2f('0x3c')]=_0x1f2f('0x54');return _0x1d62a3;};exports[_0x1f2f('0x55')]=function(_0x52fb29,_0x2cea52,_0x599129){var _0x4e3991={};_0x4e3991[_0x2cea52]=_0x52fb29[_0x2cea52];_0x4e3991[_0x1f2f('0x56')]=![];_0x4e3991[_0x1f2f('0x57')]=moment()['add'](_0x599129,_0x1f2f('0x58'))[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x4e3991[_0x1f2f('0x19')]=_0x52fb29[_0x1f2f('0x19')];_0x4e3991[_0x1f2f('0x59')]=_0x52fb29[_0x1f2f('0x59')];_0x4e3991[_0x1f2f('0x5a')]=_0x52fb29['VoiceQueueId']||undefined;return _0x4e3991;};exports['decrementTalkink']=function(_0x1b23d4,_0x5de82a){if(!_[_0x1f2f('0x28')](_0x1b23d4)){if(_0x1b23d4[_0x1f2f('0x5b')]>0x0){_0x1b23d4['pTalking']-=0x1;}else{logger[_0x1f2f('0x9')](_0x5de82a,_0x1f2f('0x5c'));}}else{logger[_0x1f2f('0x9')](_0x5de82a,_0x1f2f('0x5d'));}};exports[_0x1f2f('0x5e')]=function(_0x57c899){if(_0x57c899<=0x0){return!![];}return![];};exports[_0x1f2f('0x5f')]=function(_0x556fdc,_0x22a2db,_0xb307a5){_0x556fdc[_0x1f2f('0x60')]=_0x22a2db;_0x556fdc['name']=_0x556fdc[_0x1f2f('0x61')];_0x556fdc[_0x1f2f('0x62')]=_0x556fdc[_0x1f2f('0x4a')];_0x556fdc[_0x1f2f('0x63')]=_0x1f2f('0x64');if(_0xb307a5){_0x556fdc[_0x1f2f('0x65')]=_0xb307a5['mandatoryDisposition'];}return _0x556fdc;};exports[_0x1f2f('0x66')]=function(_0x176ad7){var _0x28021a={};_0x28021a[_0x1f2f('0x61')]=_0x176ad7['queue'];_0x28021a[_0x1f2f('0x62')]=_0x176ad7[_0x1f2f('0x4a')];_0x28021a['uniqueid']=_0x176ad7[_0x1f2f('0x49')];return _0x28021a;};exports[_0x1f2f('0x67')]=function(_0x23c1f7){var _0x1c0782=[];for(var _0x1f209e in _0x23c1f7){if(_0x23c1f7['hasOwnProperty'](_0x1f209e)){if(!_[_0x1f2f('0x28')](_0x23c1f7[_0x1f209e])&&_0x23c1f7[_0x1f209e][_0x1f2f('0x36')]===_0x1f2f('0x68')&&_0x23c1f7[_0x1f209e]['status']===_0x1f2f('0x69')){_0x1c0782[_0x1f2f('0x6a')](_0x23c1f7[_0x1f209e]['id']);}}}return _0x1c0782;};exports[_0x1f2f('0x6b')]=function(_0x351ab8){var _0x4a26e0=moment()[_0x1f2f('0x7')](0x0);var _0x466469=moment(_0x351ab8)[_0x1f2f('0x7')](0x0);return _0x4a26e0['diff'](_0x466469,_0x1f2f('0x6c'));};exports[_0x1f2f('0x6d')]=function(_0x3f4733){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f4733[_0x1f2f('0x19')],'ListId':_0x3f4733['ListId'],'VoiceQueueId':_0x3f4733[_0x1f2f('0x5a')]||undefined,'CampaignId':_0x3f4733[_0x1f2f('0x6e')]||undefined};};exports['filterKey']=function(_0x50043e){if(_0x50043e===_0x1f2f('0x49')||_0x50043e===_0x1f2f('0x6f')||_0x50043e===_0x1f2f('0x61')||_0x50043e===_0x1f2f('0x70')||_0x50043e==='campaigntype'||_0x50043e===_0x1f2f('0x71')||_0x50043e===_0x1f2f('0x3f')||_0x50043e===_0x1f2f('0x4a')||_0x50043e===_0x1f2f('0x48')||_0x50043e==='active'||_0x50043e===_0x1f2f('0x18')||_0x50043e===_0x1f2f('0x57')||_0x50043e===_0x1f2f('0x4d')||_0x50043e===_0x1f2f('0x4e')||_0x50043e===_0x1f2f('0x4f')||_0x50043e==='countglobal'||_0x50043e===_0x1f2f('0x72')||_0x50043e===_0x1f2f('0x73')||_0x50043e===_0x1f2f('0x74')||_0x50043e===_0x1f2f('0x75')||_0x50043e===_0x1f2f('0x19')||_0x50043e==='ListId'||_0x50043e==='UserId'||_0x50043e==='VoiceQueueId'||_0x50043e===_0x1f2f('0x76')||_0x50043e==='xmd-voicequeueid'||_0x50043e===_0x1f2f('0x77')||_0x50043e===_0x1f2f('0x78')||_0x50043e===_0x1f2f('0x79')||_0x50043e===_0x1f2f('0x7a')||_0x50043e===_0x1f2f('0x7b')||_0x50043e===_0x1f2f('0x7c')||_0x50043e===_0x1f2f('0x7d')||_0x50043e===_0x1f2f('0x7e')||_0x50043e===_0x1f2f('0x7f')||_0x50043e===_0x1f2f('0x80')||_0x50043e===_0x1f2f('0x81')||_0x50043e===_0x1f2f('0x82')||_0x50043e==='xmd-agi'||_0x50043e===_0x1f2f('0x83')||_0x50043e==='rtpaudioqosbridged'||_0x50043e===_0x1f2f('0x84')||_0x50043e==='rtpaudioqosjitterbridged'||_0x50043e===_0x1f2f('0x85')||_0x50043e===_0x1f2f('0x86')||_0x50043e==='rtpaudioqosrtt'||_0x50043e===_0x1f2f('0x87')||_0x50043e===_0x1f2f('0x83')||_0x50043e===_0x1f2f('0x88')||_0x50043e===_0x1f2f('0x84')||_0x50043e===_0x1f2f('0x89')||_0x50043e==='rtpaudioqosloss'||_0x50043e===_0x1f2f('0x86')||_0x50043e===_0x1f2f('0x8a')||_0x50043e===_0x1f2f('0x87')||_0x50043e==='bridgepeer'||_0x50043e===_0x1f2f('0x8b')||_0x50043e===_0x1f2f('0x36')||_0x50043e===_0x1f2f('0x3c')){return![];}return!![];};exports[_0x1f2f('0x8c')]=function(_0x571fa0,_0x204148){var _0x52409e,_0x4735a0,_0x59735a;if(_0x204148<=0x0){_0x204148=0x1;}_0x52409e=new RegExp(_0x1f2f('0x8d')+_0x204148+'}$');_0x4735a0=Math[_0x1f2f('0x8e')](0xa,_0x204148-0x1);_0x59735a=Math[_0x1f2f('0x8e')](0xa,_0x204148)-0x1;return util['format']('%s',_[_0x1f2f('0x8f')](_0x571fa0,_0x52409e,_[_0x1f2f('0x90')](_0x4735a0,_0x59735a)));};exports[_0x1f2f('0x91')]=function(_0x14b1ae){var _0xe5796c=_0x14b1ae[_0x1f2f('0x92')](/"(.*?)"/);return _0xe5796c?_0xe5796c[0x1]:_0x14b1ae;};exports['extractCalleridNumber']=function(_0x5ec02e){var _0x4ec495=_0x5ec02e['match'](/<(.*?)>/);return _0x4ec495?_0x4ec495[0x1]:_0x5ec02e;}; \ No newline at end of file +var _0x9a9a=['xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','isNil','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue'];(function(_0x4dda69,_0x2a0fe4){var _0x9014a9=function(_0x3d2b40){while(--_0x3d2b40){_0x4dda69['push'](_0x4dda69['shift']());}};_0x9014a9(++_0x2a0fe4);}(_0x9a9a,0x9d));var _0xa9a9=function(_0x320a35,_0x8205bf){_0x320a35=_0x320a35-0x0;var _0x65836=_0x9a9a[_0x320a35];return _0x65836;};'use strict';var util=require(_0xa9a9('0x0'));var _=require(_0xa9a9('0x1'));var moment=require(_0xa9a9('0x2'));var logger=require(_0xa9a9('0x3'))('preview');var ipAgi=process[_0xa9a9('0x4')][_0xa9a9('0x5')]||'127.0.0.1';function getSeconds(_0x2310ac,_0x2d3830){var _0xdfe386=moment(_0x2310ac)[_0xa9a9('0x6')](0x0);var _0x3842ca=moment(_0x2d3830)[_0xa9a9('0x6')](0x0);return _0xdfe386[_0xa9a9('0x7')](_0x3842ca,_0xa9a9('0x8'));}exports[_0xa9a9('0x9')]=function(_0x591658){return function(_0x17ff79){logger[_0xa9a9('0xa')](_0x591658,util[_0xa9a9('0xb')](_0x17ff79,{'showHidden':![],'depth':null}));};};exports[_0xa9a9('0xc')]=function(_0x1e3ac8,_0x50a1d9){logger[_0xa9a9('0xd')](_0x1e3ac8,util['inspect'](_0x50a1d9,{'showHidden':![],'depth':null}));};exports[_0xa9a9('0xe')]=function(_0xafb0ac,_0x36362c){logger[_0xa9a9('0xa')](_0xafb0ac,util['inspect'](_0x36362c,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2a388c){return function(_0x205d32){logger[_0xa9a9('0xd')](_0x2a388c,util[_0xa9a9('0xb')](_0x205d32,{'showHidden':![],'depth':null}));};};exports[_0xa9a9('0xf')]=function(_0x3dbc59,_0x1647a4,_0x3f5113){return{'message':_0x3dbc59,'unlock':_0x1647a4,'active':_0x3f5113};};exports['getCallerId']=function(_0x385cf1,_0x12dcef,_0x75a530){if(!_['isUndefined'](_0x75a530)&&'string'===typeof _0x75a530&&!_['isEmpty'](_0x75a530)){if(!_[_0xa9a9('0x10')](_0x12dcef)&&_0xa9a9('0x11')===typeof _0x12dcef&&!_[_0xa9a9('0x12')](_0x12dcef)){return util[_0xa9a9('0x13')](_0xa9a9('0x14'),_0x12dcef,_0x75a530);}return util[_0xa9a9('0x13')]('\x22%s\x22\x20<%s>',_0x75a530,_0x75a530);}if(!_[_0xa9a9('0x10')](_0x385cf1)&&_0xa9a9('0x11')===typeof _0x385cf1&&!_['isEmpty'](_0x385cf1)){return _0x385cf1;}return _0xa9a9('0x15');};exports[_0xa9a9('0x16')]=function(_0x56fb36){if(_['isNil'](_0x56fb36)){return![];}return _0x56fb36;};exports[_0xa9a9('0x17')]=function(_0x10386f,_0x52336a,_0x255167,_0x5e27d5,_0x7d8aca,_0x18f9eb){var _0x184974={'XMD-QUEUE':_0x52336a[_0xa9a9('0x18')]?_0x52336a[_0xa9a9('0x18')][_0xa9a9('0x19')]:'','XMD-CALLERID':_0x5e27d5,'XMD-CALLERID-PREVIEW':_0x18f9eb?util[_0xa9a9('0x13')](_0xa9a9('0x14'),_0x18f9eb[_0xa9a9('0x1a')],_0x18f9eb[_0xa9a9('0x1b')]):_0x5e27d5,'XMD-DIALID':_0x7d8aca,'XMD-CONTACTID':_0x52336a['ContactId'],'XMD-CDRTYPE':_0xa9a9('0x1c'),'CALLERID(all)':_0x5e27d5,'XMD-VOICEQUEUEID':_0x52336a[_0xa9a9('0x1d')],'XMD-DIALCHANNEL':_0x255167,'XMD-DIALTIMEOUT':_0x10386f[_0xa9a9('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xa9a9('0x1f'),_0x10386f[_0xa9a9('0x20')]?'g':'',_['isEmpty'](_0x10386f[_0xa9a9('0x21')])?'':_0xa9a9('0x22')),'XMD-DIALURL':_0x10386f[_0xa9a9('0x23')]||'','XMD-AGI':_0x10386f['dialQueueProject']?util[_0xa9a9('0x13')](_0xa9a9('0x24'),ipAgi,_0x10386f['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x10386f[_0xa9a9('0x20')]?util[_0xa9a9('0x13')](_0xa9a9('0x24'),ipAgi,_0x10386f[_0xa9a9('0x20')]):_0xa9a9('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x18f9eb?_0x18f9eb[_0xa9a9('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x18f9eb?_0x18f9eb['originatecalleridname']:'','XMD-DESTINATION':_0xa9a9('0x27'),'SIPADDHEADER':_0xa9a9('0x28')};if(!_[_0xa9a9('0x12')](_0x10386f[_0xa9a9('0x21')])){_0x184974[util[_0xa9a9('0x13')]('%s',_0xa9a9('0x29'))]=_0x10386f[_0xa9a9('0x21')];_0x184974[util[_0xa9a9('0x13')]('%s',_0xa9a9('0x2a'))]=_0x7d8aca;}if(_0x52336a&&_0x52336a[_0xa9a9('0x2b')]){for(var _0x4206fd in _0x52336a[_0xa9a9('0x2b')]){if(_0x52336a[_0xa9a9('0x2b')][_0xa9a9('0x2c')](_0x4206fd)){if(!_['isNil'](_0x52336a[_0xa9a9('0x2b')][_0x4206fd])&&_0x4206fd!=='id'&&_0x4206fd!=='tags'&&_0x4206fd!==_0xa9a9('0x2d')&&_0x4206fd!==_0xa9a9('0x2e')){_0x184974[util[_0xa9a9('0x13')](_0xa9a9('0x2f'),_0xa9a9('0x30'),_[_0xa9a9('0x31')](_0x4206fd))]=_0x52336a[_0xa9a9('0x2b')][_0x4206fd];}}}}return _0x184974;};exports['toLowerVariables']=function(_0x17d9ac){var _0x1e6764={};for(var _0x1a6aa9 in _0x17d9ac){if(_0x17d9ac[_0xa9a9('0x2c')](_0x1a6aa9)){_0x1e6764[util[_0xa9a9('0x13')]('%s',_[_0xa9a9('0x32')](_0x1a6aa9))]=_0x17d9ac[_0x1a6aa9];}}return{'variables':_0x1e6764};};exports[_0xa9a9('0x33')]=function(_0x3cb059,_0x3c860b){if(!_[_0xa9a9('0x34')](_0x3cb059)){if(_0x3cb059[_0xa9a9('0x2c')]('originated')){if(_0x3cb059['originated']>0x0){_0x3cb059['originated']-=0x1;}else{logger[_0xa9a9('0xa')](_0xa9a9('0x35'),_0x3c860b);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3c860b);}};exports[_0xa9a9('0x36')]=function(_0x140a51){var _0x3d7503=moment()[_0xa9a9('0x13')](_0xa9a9('0x37'));_0x140a51[_0xa9a9('0x38')]=0xd;_0x140a51[_0xa9a9('0x39')]=_0xa9a9('0x3a');_0x140a51[_0xa9a9('0x3b')]=_0x3d7503;_0x140a51[_0xa9a9('0x3c')]=_0x3d7503;_0x140a51[_0xa9a9('0x3d')]=_0x3d7503;};exports[_0xa9a9('0x3e')]=function(_0x1ac4ef,_0x35b76a,_0x365ca7){var _0x52a5b1=moment()[_0xa9a9('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ac4ef['state']=_0x35b76a;_0x1ac4ef[_0xa9a9('0x39')]=_0x365ca7;_0x1ac4ef[_0xa9a9('0x3c')]=_0x52a5b1;_0x1ac4ef[_0xa9a9('0x3f')]=getSeconds(_0x1ac4ef[_0xa9a9('0x3c')],_0x1ac4ef[_0xa9a9('0x3b')]);};exports[_0xa9a9('0x40')]=function(_0x46fc28,_0x45298b,_0x3e19b9){_0x46fc28['membername']=_0x45298b;_0x46fc28[_0xa9a9('0x41')]=_0x3e19b9;};exports['logCustomer']=function(_0x3af222,_0x3eead2,_0x354739){var _0x1caab8=moment()[_0xa9a9('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3af222[_0xa9a9('0x38')]=_0x3eead2;_0x3af222[_0xa9a9('0x39')]=_0x354739;_0x3af222['responsetime']=_0x3af222[_0xa9a9('0x3c')]?_0x3af222[_0xa9a9('0x3c')]:_0x1caab8;_0x3af222['endtime']=_0x3af222['endtime']?_0x3af222[_0xa9a9('0x3d')]:_0x1caab8;_0x3af222[_0xa9a9('0x3f')]=getSeconds(_0x3af222[_0xa9a9('0x3c')]||0x0,_0x3af222[_0xa9a9('0x3b')]||0x0);_0x3af222[_0xa9a9('0x42')]=_0x3af222[_0xa9a9('0x43')]?getSeconds(_0x3af222[_0xa9a9('0x3d')],_0x3af222[_0xa9a9('0x43')]):0x0;};exports['isFailure']=function(_0x42fc61){return _0x42fc61===_0xa9a9('0x44');};exports[_0xa9a9('0x45')]=function(_0x4b6adc,_0x46f0e7,_0x6ea08,_0x2583c3,_0x25570e){var _0x187fc6=_0x2583c3?_0xa9a9('0x46'):_0x4b6adc[_0xa9a9('0x1a')];_0x187fc6=_0x25570e?_0xa9a9('0x47'):_0x187fc6;return{'actionid':_0x4b6adc['uniqueid'],'action':'originate','channel':_0x4b6adc[_0xa9a9('0x48')],'callerid':util[_0xa9a9('0x13')](_0xa9a9('0x14'),_0x187fc6,_0x4b6adc[_0xa9a9('0x1b')]),'Exten':_0xa9a9('0x27'),'Context':_0xa9a9('0x49'),'Priority':'1','variable':_0x6ea08,'timeout':(_0x46f0e7[_0xa9a9('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4b6adc[_0xa9a9('0x4b')]};};exports[_0xa9a9('0x4c')]=function(_0x1f1010){return _0x1f1010[_0xa9a9('0x4d')]+_0x1f1010[_0xa9a9('0x4e')]+_0x1f1010[_0xa9a9('0x4f')]+_0x1f1010[_0xa9a9('0x50')]+_0x1f1010[_0xa9a9('0x51')];};exports[_0xa9a9('0x52')]=function(_0x41f945){var _0x3c2ac1=_[_0xa9a9('0x53')](_0x41f945);_0x3c2ac1['state']=0xf;_0x3c2ac1[_0xa9a9('0x39')]=_0xa9a9('0x54');return _0x3c2ac1;};exports['scheduledAt']=function(_0x3c033d,_0x2aba7c,_0x1613bb){var _0x35b80a={};_0x35b80a[_0x2aba7c]=_0x3c033d[_0x2aba7c];_0x35b80a[_0xa9a9('0x55')]=![];_0x35b80a['scheduledat']=moment()[_0xa9a9('0x56')](_0x1613bb,'minutes')[_0xa9a9('0x13')](_0xa9a9('0x37'));_0x35b80a[_0xa9a9('0x57')]=_0x3c033d[_0xa9a9('0x57')];_0x35b80a[_0xa9a9('0x58')]=_0x3c033d[_0xa9a9('0x58')];_0x35b80a[_0xa9a9('0x1d')]=_0x3c033d[_0xa9a9('0x1d')]||undefined;return _0x35b80a;};exports['decrementTalkink']=function(_0x17dfdb,_0x16e06a){if(!_[_0xa9a9('0x34')](_0x17dfdb)){if(_0x17dfdb[_0xa9a9('0x59')]>0x0){_0x17dfdb[_0xa9a9('0x59')]-=0x1;}else{logger['error'](_0x16e06a,_0xa9a9('0x5a'));}}else{logger[_0xa9a9('0xa')](_0x16e06a,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa9a9('0x5b')]=function(_0xc7f489){if(_0xc7f489<=0x0){return!![];}return![];};exports[_0xa9a9('0x5c')]=function(_0x14612b,_0x34416d,_0xed184c){_0x14612b[_0xa9a9('0x5d')]=_0x34416d;_0x14612b[_0xa9a9('0x19')]=_0x14612b[_0xa9a9('0x5e')];_0x14612b[_0xa9a9('0x5f')]=_0x14612b[_0xa9a9('0x48')];_0x14612b['motionChannel']=_0xa9a9('0x60');if(_0xed184c){_0x14612b[_0xa9a9('0x61')]=_0xed184c[_0xa9a9('0x61')];}return _0x14612b;};exports[_0xa9a9('0x62')]=function(_0x387df2){var _0x56d537={};_0x56d537['queue']=_0x387df2[_0xa9a9('0x5e')];_0x56d537[_0xa9a9('0x5f')]=_0x387df2['channelAgent'];_0x56d537[_0xa9a9('0x4b')]=_0x387df2[_0xa9a9('0x4b')];return _0x56d537;};exports[_0xa9a9('0x63')]=function(_0x36b0fe){var _0x24cb4a=[];for(var _0xd28451 in _0x36b0fe){if(_0x36b0fe['hasOwnProperty'](_0xd28451)){if(!_['isNil'](_0x36b0fe[_0xd28451])&&_0x36b0fe[_0xd28451][_0xa9a9('0x38')]==='not_inuse'&&_0x36b0fe[_0xd28451][_0xa9a9('0x64')]===_0xa9a9('0x65')){_0x24cb4a[_0xa9a9('0x66')](_0x36b0fe[_0xd28451]['id']);}}}return _0x24cb4a;};exports['getDiff']=function(_0x5839d4){var _0x3f0be5=moment()['milliseconds'](0x0);var _0x5ebea7=moment(_0x5839d4)['milliseconds'](0x0);return _0x3f0be5[_0xa9a9('0x7')](_0x5ebea7,'seconds');};exports[_0xa9a9('0x67')]=function(_0x41b57e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x41b57e[_0xa9a9('0x57')],'ListId':_0x41b57e[_0xa9a9('0x58')],'VoiceQueueId':_0x41b57e[_0xa9a9('0x1d')]||undefined,'CampaignId':_0x41b57e[_0xa9a9('0x68')]||undefined};};exports[_0xa9a9('0x69')]=function(_0x7e5940){if(_0x7e5940===_0xa9a9('0x4b')||_0x7e5940===_0xa9a9('0x6a')||_0x7e5940===_0xa9a9('0x5e')||_0x7e5940==='type'||_0x7e5940===_0xa9a9('0x6b')||_0x7e5940===_0xa9a9('0x6c')||_0x7e5940==='membername'||_0x7e5940===_0xa9a9('0x48')||_0x7e5940===_0xa9a9('0x1a')||_0x7e5940===_0xa9a9('0x55')||_0x7e5940===_0xa9a9('0x1b')||_0x7e5940==='scheduledat'||_0x7e5940==='countbusyretry'||_0x7e5940===_0xa9a9('0x4e')||_0x7e5940==='countnoanswerretry'||_0x7e5940===_0xa9a9('0x6d')||_0x7e5940===_0xa9a9('0x6e')||_0x7e5940===_0xa9a9('0x6f')||_0x7e5940===_0xa9a9('0x70')||_0x7e5940===_0xa9a9('0x71')||_0x7e5940===_0xa9a9('0x57')||_0x7e5940==='ListId'||_0x7e5940===_0xa9a9('0x41')||_0x7e5940===_0xa9a9('0x1d')||_0x7e5940===_0xa9a9('0x72')||_0x7e5940===_0xa9a9('0x73')||_0x7e5940===_0xa9a9('0x74')||_0x7e5940==='xmd-phone'||_0x7e5940==='xmd-listid'||_0x7e5940==='xmd-dialurl'||_0x7e5940==='xmd-dialtimeout'||_0x7e5940==='xmd-dialoptions'||_0x7e5940===_0xa9a9('0x75')||_0x7e5940===_0xa9a9('0x76')||_0x7e5940===_0xa9a9('0x77')||_0x7e5940==='xmd-cdrtype'||_0x7e5940===_0xa9a9('0x78')||_0x7e5940===_0xa9a9('0x79')||_0x7e5940===_0xa9a9('0x7a')||_0x7e5940===_0xa9a9('0x7b')||_0x7e5940===_0xa9a9('0x7c')||_0x7e5940===_0xa9a9('0x7d')||_0x7e5940==='rtpaudioqosjitterbridged'||_0x7e5940==='rtpaudioqosloss'||_0x7e5940===_0xa9a9('0x7e')||_0x7e5940===_0xa9a9('0x7f')||_0x7e5940===_0xa9a9('0x80')||_0x7e5940===_0xa9a9('0x7b')||_0x7e5940===_0xa9a9('0x7c')||_0x7e5940==='rtpaudioqosjitter'||_0x7e5940==='rtpaudioqosjitterbridged'||_0x7e5940==='rtpaudioqosloss'||_0x7e5940===_0xa9a9('0x7e')||_0x7e5940===_0xa9a9('0x7f')||_0x7e5940===_0xa9a9('0x80')||_0x7e5940===_0xa9a9('0x81')||_0x7e5940==='bridgepvtcallid'||_0x7e5940===_0xa9a9('0x38')||_0x7e5940===_0xa9a9('0x39')){return![];}return!![];};exports[_0xa9a9('0x82')]=function(_0x241344,_0x5de515){var _0x46a302,_0x51d720,_0x313bd0;if(_0x5de515<=0x0){_0x5de515=0x1;}_0x46a302=new RegExp(_0xa9a9('0x83')+_0x5de515+'}$');_0x51d720=Math['pow'](0xa,_0x5de515-0x1);_0x313bd0=Math[_0xa9a9('0x84')](0xa,_0x5de515)-0x1;return util['format']('%s',_[_0xa9a9('0x85')](_0x241344,_0x46a302,_['random'](_0x51d720,_0x313bd0)));};exports[_0xa9a9('0x86')]=function(_0xe0d333){var _0x3fd2a0=_0xe0d333[_0xa9a9('0x87')](/"(.*?)"/);return _0x3fd2a0?_0x3fd2a0[0x1]:_0xe0d333;};exports[_0xa9a9('0x88')]=function(_0x56e3b4){var _0x1edea8=_0x56e3b4[_0xa9a9('0x87')](/<(.*?)>/);return _0x1edea8?_0x1edea8[0x1]:_0x56e3b4;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 33c654a..06fb8bb 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 _0xb9fa=['queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xb9fa,0xa1));var _0xab9f=function(_0x5d8824,_0x164edc){_0x5d8824=_0x5d8824-0x0;var _0x5359d9=_0xb9fa[_0x5d8824];return _0x5359d9;};'use strict';exports[_0xab9f('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xab9f('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xab9f('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xab9f('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xab9f('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xab9f('0x5')},'reason':{'type':_0xab9f('0x1'),'required':![]}};exports[_0xab9f('0x6')]={'module':{'type':_0xab9f('0x1'),'required':![]}};exports[_0xab9f('0x7')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]}};exports[_0xab9f('0x8')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]},'filename':{'type':_0xab9f('0x1')},'format':{'type':_0xab9f('0x1')},'mixmonitorid':{'type':_0xab9f('0x1')}};exports[_0xab9f('0x9')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]}};exports[_0xab9f('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xab9f('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x1d73=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause'];(function(_0x5d0911,_0x2ce0dc){var _0x255c67=function(_0x3c9135){while(--_0x3c9135){_0x5d0911['push'](_0x5d0911['shift']());}};_0x255c67(++_0x2ce0dc);}(_0x1d73,0x127));var _0x31d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1d73[_0x321bb2];return _0x9c12ed;};'use strict';exports[_0x31d7('0x0')]={'queue':{'type':_0x31d7('0x1'),'required':!![]},'interface':{'type':_0x31d7('0x1'),'required':!![]},'membername':{'type':_0x31d7('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x31d7('0x2'),'required':![]}};exports[_0x31d7('0x3')]={'queue':{'type':_0x31d7('0x1'),'required':!![]},'interface':{'type':_0x31d7('0x1'),'required':!![]}};exports[_0x31d7('0x4')]={'interface':{'type':_0x31d7('0x1'),'required':!![]},'paused':{'type':_0x31d7('0x2')},'reason':{'type':_0x31d7('0x1'),'required':![]}};exports[_0x31d7('0x5')]={'module':{'type':_0x31d7('0x1'),'required':![]}};exports[_0x31d7('0x6')]={'uniqueid':{'type':_0x31d7('0x1'),'required':!![]}};exports[_0x31d7('0x7')]={'uniqueid':{'type':_0x31d7('0x1'),'required':!![]},'filename':{'type':_0x31d7('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x31d7('0x1')}};exports[_0x31d7('0x8')]={'uniqueid':{'type':_0x31d7('0x1'),'required':!![]}};exports[_0x31d7('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x31d7('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7db5dea..47cc291 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 _0x1fe2=['queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','total','answered','sumHoldTime','sumBillable','ivrTotalCallsDays','isEmpty','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','name','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon'];(function(_0x23ab94,_0x3ffe14){var _0x3be1aa=function(_0x385fa5){while(--_0x385fa5){_0x23ab94['push'](_0x23ab94['shift']());}};_0x3be1aa(++_0x3ffe14);}(_0x1fe2,0x1d1));var _0x21fe=function(_0xec2a9f,_0x53c0ed){_0xec2a9f=_0xec2a9f-0x0;var _0x294158=_0x1fe2[_0xec2a9f];return _0x294158;};'use strict';var BPromise=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var _=require(_0x21fe('0x2'));var moment=require('moment');var Agent=require(_0x21fe('0x3'));var Telephone=require(_0x21fe('0x4'));var Trunk=require(_0x21fe('0x5'));var VoiceQueue=require(_0x21fe('0x6'));var Trigger=require(_0x21fe('0x7'));var Template=require(_0x21fe('0x8'));var Campaign=require(_0x21fe('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x21fe('0xa'));var SalesforceAccount=require(_0x21fe('0xb'));var FreshdeskAccount=require(_0x21fe('0xc'));var SugarcrmAccount=require(_0x21fe('0xd'));var ZohoAccount=require(_0x21fe('0xe'));var DeskAccount=require(_0x21fe('0xf'));var VtigerAccount=require(_0x21fe('0x10'));var ServicenowAccount=require(_0x21fe('0x11'));var Dynamics365Account=require(_0x21fe('0x12'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x21fe('0x13')]={};this[_0x21fe('0x14')]={};this[_0x21fe('0x15')]={};this[_0x21fe('0x16')]={};this[_0x21fe('0x17')]={};this[_0x21fe('0x18')]={};this['templates']={};this[_0x21fe('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x21fe('0x1a')]={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x21fe('0x1b')]={};this['settings']={};this[_0x21fe('0x1c')]={};this[_0x21fe('0x1d')]={};this['sugarcrmAccounts']={};this[_0x21fe('0x1e')]={};this[_0x21fe('0x1f')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x21fe('0x20')]={};this[_0x21fe('0x21')]={};this[_0x21fe('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x21f3a3,_0x1ab0f0,_0x23855e){var _0x4719b5=_[_0x21fe('0x23')](_0x21f3a3,function(_0x37f34f,_0x2c8a57){return _0x37f34f[_0x23855e];});for(var _0x2611af in _0x1ab0f0){if(_0x1ab0f0[_0x21fe('0x24')](_0x2611af)){if(!_0x4719b5[_0x2611af]){delete _0x1ab0f0[_0x2611af];}}}}function freeIsNotKeySip(_0x4a8ad5,_0x4a2428){var _0x31c2dd=_[_0x21fe('0x23')](_0x4a8ad5,function(_0x3ec2bc,_0x2998b3){return util[_0x21fe('0x25')](_0x21fe('0x26'),_0x3ec2bc['name']);});for(var _0x6b5831 in _0x4a2428){if(_0x4a2428[_0x21fe('0x24')](_0x6b5831)){if(!_0x31c2dd[_0x6b5831]){delete _0x4a2428[_0x6b5831];}}}}function freeIsNotKeyAgent(_0x27906b,_0x1de74b){var _0x5033b7=_[_0x21fe('0x23')](_0x27906b,function(_0x3f0194,_0x329dd7){var _0x446729=_['isNil'](_0x3f0194[_0x21fe('0x27')])?util[_0x21fe('0x25')](_0x21fe('0x26'),_0x3f0194['name']):_0x3f0194['interface'];return _0x446729;});for(var _0x5b0696 in _0x1de74b){if(_0x1de74b[_0x21fe('0x24')](_0x5b0696)){if(!_0x5033b7[_0x5b0696]){delete _0x1de74b[_0x5b0696];}}}}function clearVoiceCallReports(_0x14a260){_0x14a260[_0x21fe('0x28')]=0x0;_0x14a260[_0x21fe('0x29')]=0x0;_0x14a260[_0x21fe('0x2a')]=0x0;_0x14a260['sumDuration']=0x0;_0x14a260[_0x21fe('0x2b')]=0x0;}function clearCampaigns(_0x16f022){if(!_['isEmpty'](_0x16f022)){for(var _0x10ea61 in _0x16f022){if(_0x16f022['hasOwnProperty'](_0x10ea61)){_0x16f022[_0x10ea61][_0x21fe('0x2c')]=0x0;_0x16f022[_0x10ea61]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2bcf6b){if(!_[_0x21fe('0x2d')](_0x2bcf6b)){for(var _0x5395c2 in _0x2bcf6b){if(_0x2bcf6b[_0x21fe('0x24')](_0x5395c2)){_0x2bcf6b[_0x5395c2][_0x21fe('0x28')]=0x0;_0x2bcf6b[_0x5395c2]['answered']=0x0;_0x2bcf6b[_0x5395c2]['unmanaged']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2e')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2a')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2f')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2b')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x30')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x31')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x32')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x33')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x34')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x35')]=0x0;_0x2bcf6b[_0x5395c2]['outboundDropCallsDayTimeout']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x36')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x37')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x38')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x39')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x3a')]=0x0;_0x2bcf6b[_0x5395c2]['outboundAnswerAgiCallsDay']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x3b')]=0x0;_0x2bcf6b[_0x5395c2]['queueStatusComplete']=!![];}}}}Realtime[_0x21fe('0x3c')][_0x21fe('0x3d')]=function(_0x65fec,_0x2e8055){for(var _0x49ddd3 in _0x2e8055){if(_0x65fec['hasOwnProperty'](_0x49ddd3)){_0x65fec[_0x49ddd3]=_0x2e8055[_0x49ddd3];}}};Realtime['prototype'][_0x21fe('0x3e')]=function(){var _0x343488=this;return function(_0x967a10){if(_0x967a10){freeIsNotKeyAgent(_0x967a10,_0x343488[_0x21fe('0x13')]);for(var _0x703cfd=0x0,_0x2ca38c={},_0x1415a={};_0x703cfd<_0x967a10[_0x21fe('0x3f')];_0x703cfd+=0x1){_0x2ca38c=_0x967a10[_0x703cfd];var _0x3e0eaa=_['isNil'](_0x2ca38c[_0x21fe('0x27')])?util['format']('SIP/%s',_0x2ca38c[_0x21fe('0x40')]):_0x2ca38c[_0x21fe('0x27')];if(_[_0x21fe('0x41')](_0x343488[_0x21fe('0x13')][_0x3e0eaa])){_0x343488['agents'][_0x3e0eaa]=new Agent(_0x2ca38c);}else{_0x343488['mergeFromDatabase'](_0x343488[_0x21fe('0x13')][_0x3e0eaa],_0x2ca38c);}}}return _0x343488[_0x21fe('0x13')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x42')]=function(){var _0x56ae5b=this;return function(_0x815087){if(_0x815087){freeIsNotKeySip(_0x815087,_0x56ae5b[_0x21fe('0x14')]);for(var _0x4bb553=0x0,_0x1e2328={},_0x3238b3={};_0x4bb553<_0x815087[_0x21fe('0x3f')];_0x4bb553+=0x1){_0x1e2328=_0x815087[_0x4bb553];if(_[_0x21fe('0x41')](_0x56ae5b[_0x21fe('0x14')][util['format']('SIP/%s',_0x1e2328['name'])])){_0x56ae5b[_0x21fe('0x14')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x1e2328['name'])]=new Telephone(_0x1e2328);}else{_0x56ae5b['mergeFromDatabase'](_0x56ae5b[_0x21fe('0x14')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x1e2328['name'])],_0x1e2328);}}}return _0x56ae5b[_0x21fe('0x14')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x43')]=function(){var _0x5b304d=this;return function(_0x5720b5){if(_0x5720b5){freeIsNotKeySip(_0x5720b5,_0x5b304d[_0x21fe('0x15')]);for(var _0x2e2be2=0x0,_0x409a6a={},_0x4dd1b4={};_0x2e2be2<_0x5720b5[_0x21fe('0x3f')];_0x2e2be2+=0x1){_0x409a6a=_0x5720b5[_0x2e2be2];if(_[_0x21fe('0x41')](_0x5b304d['trunks'][util['format']('SIP/%s',_0x409a6a[_0x21fe('0x40')])])){_0x5b304d[_0x21fe('0x15')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x409a6a[_0x21fe('0x40')])]=new Trunk(_0x409a6a);}else{_0x5b304d[_0x21fe('0x3d')](_0x5b304d[_0x21fe('0x15')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x409a6a[_0x21fe('0x40')])],_0x409a6a);}}}return _0x5b304d['trunks'];};};Realtime['prototype'][_0x21fe('0x44')]=function(){var _0x560117=this;return function(_0x11028e){if(_0x11028e){freeIsNotKey(_0x11028e,_0x560117['voiceQueues'],_0x21fe('0x40'));for(var _0x5d958a=0x0,_0xb0904e={},_0x339ad3={};_0x5d958a<_0x11028e[_0x21fe('0x3f')];_0x5d958a+=0x1){_0xb0904e=_0x11028e[_0x5d958a];if(_[_0x21fe('0x41')](_0x560117[_0x21fe('0x16')][_0xb0904e[_0x21fe('0x40')]])){_0x560117[_0x21fe('0x16')][_0xb0904e[_0x21fe('0x40')]]=new VoiceQueue(_0xb0904e);}else{_0x560117[_0x21fe('0x3d')](_0x560117[_0x21fe('0x16')][_0xb0904e['name']],_0xb0904e);}}}return _0x560117['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0x2bfde3=this;return function(_0x4b65de){if(_0x4b65de){freeIsNotKey(_0x4b65de,_0x2bfde3['triggers'],'id');for(var _0x1e33d2=0x0,_0x40ed0b={},_0x1aca9f={};_0x1e33d2<_0x4b65de[_0x21fe('0x3f')];_0x1e33d2+=0x1){_0x40ed0b=_0x4b65de[_0x1e33d2];if(_[_0x21fe('0x41')](_0x2bfde3[_0x21fe('0x17')][_0x40ed0b['id']])){_0x2bfde3['triggers'][_0x40ed0b['id']]=new Trigger(_0x40ed0b);}else{_0x2bfde3['mergeFromDatabase'](_0x2bfde3['triggers'][_0x40ed0b['id']],_0x40ed0b);}}}return _0x2bfde3['triggers'];};};Realtime['prototype'][_0x21fe('0x45')]=function(){var _0x53f887=this;return function(_0x5a9d4c){if(_0x5a9d4c){freeIsNotKey(_0x5a9d4c,_0x53f887[_0x21fe('0x46')],'id');for(var _0x229232=0x0,_0x2188a3={},_0x4576ad={};_0x229232<_0x5a9d4c[_0x21fe('0x3f')];_0x229232+=0x1){_0x2188a3=_0x5a9d4c[_0x229232];if(_[_0x21fe('0x41')](_0x53f887[_0x21fe('0x46')][_0x2188a3['id']])){_0x53f887['templates'][_0x2188a3['id']]=new Template(_0x2188a3);}else{_0x53f887['mergeFromDatabase'](_0x53f887['templates'][_0x2188a3['id']],_0x2188a3);}}}return _0x53f887['templates'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x47')]=function(){var _0x1ebd32=this;return function(_0x354edf){if(_0x354edf){freeIsNotKey(_0x354edf,_0x1ebd32[_0x21fe('0x1c')],'id');for(var _0x208bd1=0x0,_0x529087={},_0x5d9425={};_0x208bd1<_0x354edf[_0x21fe('0x3f')];_0x208bd1+=0x1){_0x529087=_0x354edf[_0x208bd1];if(_[_0x21fe('0x41')](_0x1ebd32['zendeskAccounts'][_0x529087['id']])){_0x1ebd32[_0x21fe('0x1c')][_0x529087['id']]=new ZendeskAccount(_0x529087);}else{_0x1ebd32[_0x21fe('0x3d')](_0x1ebd32[_0x21fe('0x1c')][_0x529087['id']],_0x529087);}}}return _0x1ebd32[_0x21fe('0x1c')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x48')]=function(){var _0x586d21=this;return function(_0x27dc91){if(_0x27dc91){freeIsNotKey(_0x27dc91,_0x586d21[_0x21fe('0x1d')],'id');for(var _0x3142dc=0x0,_0xad5a45={},_0x46f59d={};_0x3142dc<_0x27dc91['length'];_0x3142dc+=0x1){_0xad5a45=_0x27dc91[_0x3142dc];if(_[_0x21fe('0x41')](_0x586d21[_0x21fe('0x1d')][_0xad5a45['id']])){_0x586d21['salesforceAccounts'][_0xad5a45['id']]=new SalesforceAccount(_0xad5a45);}else{_0x586d21['mergeFromDatabase'](_0x586d21['salesforceAccounts'][_0xad5a45['id']],_0xad5a45);}}}return _0x586d21[_0x21fe('0x1d')];};};Realtime['prototype'][_0x21fe('0x49')]=function(){var _0x34b936=this;return function(_0x452d78){if(_0x452d78){freeIsNotKey(_0x452d78,_0x34b936[_0x21fe('0x1e')],'id');for(var _0x253edf=0x0,_0x3b9554={},_0x5ebe6a={};_0x253edf<_0x452d78[_0x21fe('0x3f')];_0x253edf+=0x1){_0x3b9554=_0x452d78[_0x253edf];if(_[_0x21fe('0x41')](_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']])){_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']]=new FreshdeskAccount(_0x3b9554);}else{_0x34b936[_0x21fe('0x3d')](_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']],_0x3b9554);}}}return _0x34b936[_0x21fe('0x1e')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4a')]=function(){var _0xe6418c=this;return function(_0x55d46f){if(_0x55d46f){freeIsNotKey(_0x55d46f,_0xe6418c[_0x21fe('0x1f')],'id');for(var _0x24b4bd=0x0,_0xd7b9e5={},_0x3fe1b8={};_0x24b4bd<_0x55d46f[_0x21fe('0x3f')];_0x24b4bd+=0x1){_0xd7b9e5=_0x55d46f[_0x24b4bd];if(_[_0x21fe('0x41')](_0xe6418c[_0x21fe('0x1f')][_0xd7b9e5['id']])){_0xe6418c[_0x21fe('0x1f')][_0xd7b9e5['id']]=new ZohoAccount(_0xd7b9e5);}else{_0xe6418c[_0x21fe('0x3d')](_0xe6418c['zohoAccounts'][_0xd7b9e5['id']],_0xd7b9e5);}}}return _0xe6418c[_0x21fe('0x1f')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4b')]=function(){var _0x241c86=this;return function(_0x3f8134){if(_0x3f8134){freeIsNotKey(_0x3f8134,_0x241c86['deskAccounts'],'id');for(var _0x5ee2ad=0x0,_0x9d4ab4={},_0x21919a={};_0x5ee2ad<_0x3f8134[_0x21fe('0x3f')];_0x5ee2ad+=0x1){_0x9d4ab4=_0x3f8134[_0x5ee2ad];if(_[_0x21fe('0x41')](_0x241c86[_0x21fe('0x4c')][_0x9d4ab4['id']])){_0x241c86[_0x21fe('0x4c')][_0x9d4ab4['id']]=new DeskAccount(_0x9d4ab4);}else{_0x241c86[_0x21fe('0x3d')](_0x241c86['deskAccounts'][_0x9d4ab4['id']],_0x9d4ab4);}}}return _0x241c86[_0x21fe('0x4c')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x1a39b6=this;return function(_0xf10837){if(_0xf10837){freeIsNotKey(_0xf10837,_0x1a39b6[_0x21fe('0x4d')],'id');for(var _0x2bf30c=0x0,_0x3f3d3f={},_0x33cffc={};_0x2bf30c<_0xf10837[_0x21fe('0x3f')];_0x2bf30c+=0x1){_0x3f3d3f=_0xf10837[_0x2bf30c];if(_[_0x21fe('0x41')](_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']])){_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']]=new SugarcrmAccount(_0x3f3d3f);}else{_0x1a39b6[_0x21fe('0x3d')](_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']],_0x3f3d3f);}}}return _0x1a39b6[_0x21fe('0x4d')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4e')]=function(){var _0x42a04d=this;return function(_0x2f1787){if(_0x2f1787){freeIsNotKey(_0x2f1787,_0x42a04d['vtigerAccounts'],'id');for(var _0x3533a6=0x0,_0x1be0a7={},_0x35f7e4={};_0x3533a6<_0x2f1787[_0x21fe('0x3f')];_0x3533a6+=0x1){_0x1be0a7=_0x2f1787[_0x3533a6];if(_['isUndefined'](_0x42a04d[_0x21fe('0x4f')][_0x1be0a7['id']])){_0x42a04d[_0x21fe('0x4f')][_0x1be0a7['id']]=new VtigerAccount(_0x1be0a7);}else{_0x42a04d['mergeFromDatabase'](_0x42a04d['vtigerAccounts'][_0x1be0a7['id']],_0x1be0a7);}}}return _0x42a04d['vtigerAccounts'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x50')]=function(){var _0x94b04b=this;return function(_0x39cd17){if(_0x39cd17){freeIsNotKey(_0x39cd17,_0x94b04b['servicenowAccounts'],'id');for(var _0x4b141a=0x0,_0x3963ee={},_0x2dd33f={};_0x4b141a<_0x39cd17[_0x21fe('0x3f')];_0x4b141a+=0x1){_0x3963ee=_0x39cd17[_0x4b141a];if(_['isUndefined'](_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']])){_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']]=new ServicenowAccount(_0x3963ee);}else{_0x94b04b[_0x21fe('0x3d')](_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']],_0x3963ee);}}}return _0x94b04b[_0x21fe('0x20')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x51')]=function(){var _0x1e9fa4=this;return function(_0x5c8337){if(_0x5c8337){freeIsNotKey(_0x5c8337,_0x1e9fa4[_0x21fe('0x21')],'id');for(var _0x43676e=0x0,_0x561a80={},_0x16414f={};_0x43676e<_0x5c8337[_0x21fe('0x3f')];_0x43676e+=0x1){_0x561a80=_0x5c8337[_0x43676e];if(_[_0x21fe('0x41')](_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']])){_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']]=new Dynamics365Account(_0x561a80);}else{_0x1e9fa4[_0x21fe('0x3d')](_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']],_0x561a80);}}}return _0x1e9fa4['dynamics365Accounts'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x52')]=function(){var _0xf588c5=this;return function(_0x89145a){if(_0x89145a){freeIsNotKey(_0x89145a,_0xf588c5['freshsalesAccounts'],'id');for(var _0x191c14=0x0,_0x65b4eb={},_0x3e20e0={};_0x191c14<_0x89145a[_0x21fe('0x3f')];_0x191c14+=0x1){_0x65b4eb=_0x89145a[_0x191c14];if(_['isUndefined'](_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']])){_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']]=new FreshsalesAccount(_0x65b4eb);}else{_0xf588c5[_0x21fe('0x3d')](_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']],_0x65b4eb);}}}return _0xf588c5[_0x21fe('0x22')];};};Realtime[_0x21fe('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x5b5b48=this;return function(_0x3c1e97){for(var _0x186136=0x0;_0x186136<_0x3c1e97[_0x21fe('0x3f')];_0x186136+=0x1){_[_0x21fe('0x53')](_0x5b5b48[_0x21fe('0x16')][_0x3c1e97[_0x186136]['name']],_0x3c1e97[_0x186136]);}return _0x5b5b48[_0x21fe('0x16')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x54')]=function(){var _0x1cbb5d=this;return function(_0x10a4d0){clearVoiceQueues(_0x1cbb5d[_0x21fe('0x16')]);if(_0x10a4d0){_0x10a4d0=_[_0x21fe('0x55')](_0x10a4d0,_0x21fe('0x56'));for(var _0x227cbf in _0x10a4d0){if(_0x10a4d0['hasOwnProperty'](_0x227cbf)){var _0x511c4d={};for(var _0x2dea31=0x0;_0x2dea31<_0x10a4d0[_0x227cbf][_0x21fe('0x3f')];_0x2dea31+=0x1){var _0xcfdc90=_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x57')];if(_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90]){if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x58')]){_0x1cbb5d['voiceQueues'][_0xcfdc90]['unmanaged']+=0x1;}if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x59')]){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2e')]+=0x1;}_0x1cbb5d['voiceQueues'][_0xcfdc90][_0x21fe('0x2a')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5a')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5c')]),'seconds')||0x0;if(_0x2dea31===_0x10a4d0[_0x227cbf][_0x21fe('0x3f')]-0x1){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2f')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5d')]||_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5e')]||_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5f')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5c')]),'seconds')||0x0;_0x1cbb5d['voiceQueues'][_0xcfdc90][_0x21fe('0x28')]+=0x1;if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x60')]){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x29')]+=0x1;_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2b')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5d')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31]['queuecallerleaveAt']),_0x21fe('0x61'))||0x0;}}else{_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2f')]+=_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2a')]||0x0;}}}}}}return _0x1cbb5d[_0x21fe('0x16')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x62')]=function(){var _0x4e36bf=this;return function(_0x4852cd){clearVoiceCallReports(_0x4e36bf['outbound']);if(_0x4852cd){for(var _0x5e01e6=0x0;_0x5e01e6<_0x4852cd[_0x21fe('0x3f')];_0x5e01e6+=0x1){_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x28')]+=0x1;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2f')]+=_0x4852cd[_0x5e01e6][_0x21fe('0x63')];if(_0x4852cd[_0x5e01e6][_0x21fe('0x64')]===_0x21fe('0x65')){_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x29')]+=0x1;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2a')]+=_0x4852cd[_0x5e01e6]['duration']-_0x4852cd[_0x5e01e6]['billableseconds']||0x0;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2b')]+=_0x4852cd[_0x5e01e6][_0x21fe('0x66')];}}}return _0x4e36bf[_0x21fe('0x19')];};};Realtime['prototype'][_0x21fe('0x67')]=function(){var _0x11371d=this;return function(_0x165e40){if(_0x165e40){freeIsNotKey(_0x165e40,_0x11371d[_0x21fe('0x18')],_0x21fe('0x40'));for(var _0x17d046=0x0,_0x3dcd0a={};_0x17d046<_0x165e40[_0x21fe('0x3f')];_0x17d046+=0x1){_0x3dcd0a=_0x165e40[_0x17d046];if(_[_0x21fe('0x41')](_0x11371d['campaigns'][_0x3dcd0a[_0x21fe('0x40')]])){_0x11371d[_0x21fe('0x18')][_0x3dcd0a['name']]=new Campaign(_0x3dcd0a);}else{_0x11371d['mergeFromDatabase'](_0x11371d[_0x21fe('0x18')][_0x3dcd0a['name']],_0x3dcd0a);_0x11371d[_0x21fe('0x18')][_0x3dcd0a[_0x21fe('0x40')]][_0x21fe('0x68')]=_0x3dcd0a['SquareProject']?_0x3dcd0a[_0x21fe('0x69')][_0x21fe('0x40')]:undefined;}}}return _0x11371d[_0x21fe('0x18')];};};Realtime['prototype'][_0x21fe('0x6a')]=function(){var _0x30cd51=this;return function(_0x310972){if(_0x310972){freeIsNotKey(_0x310972,_0x30cd51['voiceExtensions'],'id');for(var _0x4efdff=0x0,_0x37773c={};_0x4efdff<_0x310972[_0x21fe('0x3f')];_0x4efdff+=0x1){_0x37773c=_0x310972[_0x4efdff];if(_[_0x21fe('0x41')](_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']])){_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']]=new VoiceExtension(_0x37773c);}else{_0x30cd51[_0x21fe('0x3d')](_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']],_0x37773c);}}}return _0x30cd51[_0x21fe('0x1a')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x6b')]=function(){var _0xe0f51=this;return function(_0x4b4bd3){clearCampaigns(_0xe0f51[_0x21fe('0x18')]);for(var _0x8b8e80=0x0;_0x8b8e80<_0x4b4bd3['length'];_0x8b8e80+=0x1){_['merge'](_0xe0f51[_0x21fe('0x18')][_0x4b4bd3[_0x8b8e80]['name']],_0x4b4bd3[_0x8b8e80]);}return _0xe0f51['campaigns'];};};Realtime['prototype'][_0x21fe('0x6c')]=function(){var _0x633218=this;return function(_0x2ec2ee){if(_0x2ec2ee){freeIsNotKey(_0x2ec2ee,_0x633218[_0x21fe('0x6d')],'id');for(var _0xb5ac8c=0x0,_0x1e116f={},_0xad97e0={};_0xb5ac8c<_0x2ec2ee['length'];_0xb5ac8c+=0x1){_0x1e116f=_0x2ec2ee[_0xb5ac8c];if(_[_0x21fe('0x41')](_0x633218['faxAccounts'][_0x1e116f['id']])){_0x633218[_0x21fe('0x6d')][_0x1e116f['id']]=new FaxAccount(_0x1e116f);}else{_0x633218[_0x21fe('0x3d')](_0x633218[_0x21fe('0x6d')][_0x1e116f['id']],_0x1e116f);}}}return _0x633218[_0x21fe('0x6d')];};};module[_0x21fe('0x6e')]=Realtime; \ No newline at end of file +var _0x5f01=['sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','merge','initFaxAccounts','faxAccounts','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumDuration','ivrAnswerCallsDay','isEmpty','total','answered','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','SIP/%s','isUndefined','initTelephones','initTrunks','trunks','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','sugarcrmAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queuecallerexit','queuecallerabandon','abandoned'];(function(_0x2e0d6c,_0x137319){var _0x3d0db7=function(_0x430b8a){while(--_0x430b8a){_0x2e0d6c['push'](_0x2e0d6c['shift']());}};_0x3d0db7(++_0x137319);}(_0x5f01,0x1cb));var _0x15f0=function(_0x37de91,_0x263fc2){_0x37de91=_0x37de91-0x0;var _0x5bb10d=_0x5f01[_0x37de91];return _0x5bb10d;};'use strict';var BPromise=require(_0x15f0('0x0'));var util=require(_0x15f0('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x15f0('0x2'));var Telephone=require(_0x15f0('0x3'));var Trunk=require(_0x15f0('0x4'));var VoiceQueue=require(_0x15f0('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x15f0('0x6'));var Campaign=require(_0x15f0('0x7'));var VoiceExtension=require(_0x15f0('0x8'));var ZendeskAccount=require(_0x15f0('0x9'));var SalesforceAccount=require(_0x15f0('0xa'));var FreshdeskAccount=require(_0x15f0('0xb'));var SugarcrmAccount=require(_0x15f0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x15f0('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x15f0('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x15f0('0xf'));var FaxAccount=require(_0x15f0('0x10'));var Realtime=function(){this[_0x15f0('0x11')]={};this[_0x15f0('0x12')]={};this['trunks']={};this['voiceQueues']={};this['triggers']={};this['campaigns']={};this[_0x15f0('0x13')]={};this[_0x15f0('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x15f0('0x15')]={};this[_0x15f0('0x16')]={};this[_0x15f0('0x17')]={};this[_0x15f0('0x18')]={};this[_0x15f0('0x19')]={};this[_0x15f0('0x1a')]={};this[_0x15f0('0x1b')]={};this['sugarcrmAccounts']={};this[_0x15f0('0x1c')]={};this[_0x15f0('0x1d')]={};this[_0x15f0('0x1e')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x15f0('0x1f')]={};this[_0x15f0('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1835ef,_0x14c2a0,_0x1c934f){var _0x371636=_[_0x15f0('0x21')](_0x1835ef,function(_0x519d9b,_0x4cabc5){return _0x519d9b[_0x1c934f];});for(var _0xcee432 in _0x14c2a0){if(_0x14c2a0[_0x15f0('0x22')](_0xcee432)){if(!_0x371636[_0xcee432]){delete _0x14c2a0[_0xcee432];}}}}function freeIsNotKeySip(_0x2c181b,_0x50b5fc){var _0xe60219=_[_0x15f0('0x21')](_0x2c181b,function(_0x49f6bf,_0x45c363){return util[_0x15f0('0x23')]('SIP/%s',_0x49f6bf[_0x15f0('0x24')]);});for(var _0x12c6f8 in _0x50b5fc){if(_0x50b5fc[_0x15f0('0x22')](_0x12c6f8)){if(!_0xe60219[_0x12c6f8]){delete _0x50b5fc[_0x12c6f8];}}}}function freeIsNotKeyAgent(_0x42f3eb,_0x18a236){var _0x1c9d2f=_[_0x15f0('0x21')](_0x42f3eb,function(_0x3098dd,_0x21d222){var _0x323f14=_[_0x15f0('0x25')](_0x3098dd['interface'])?util['format']('SIP/%s',_0x3098dd[_0x15f0('0x24')]):_0x3098dd[_0x15f0('0x26')];return _0x323f14;});for(var _0x3bb096 in _0x18a236){if(_0x18a236[_0x15f0('0x22')](_0x3bb096)){if(!_0x1c9d2f[_0x3bb096]){delete _0x18a236[_0x3bb096];}}}}function clearVoiceCallReports(_0x2ed46e){_0x2ed46e['total']=0x0;_0x2ed46e['answered']=0x0;_0x2ed46e['sumHoldTime']=0x0;_0x2ed46e[_0x15f0('0x27')]=0x0;_0x2ed46e['sumBillable']=0x0;}function clearCampaigns(_0x232864){if(!_['isEmpty'](_0x232864)){for(var _0x5ec55c in _0x232864){if(_0x232864['hasOwnProperty'](_0x5ec55c)){_0x232864[_0x5ec55c]['ivrTotalCallsDays']=0x0;_0x232864[_0x5ec55c][_0x15f0('0x28')]=0x0;}}}}function clearVoiceQueues(_0x3cf05b){if(!_[_0x15f0('0x29')](_0x3cf05b)){for(var _0x34cee7 in _0x3cf05b){if(_0x3cf05b['hasOwnProperty'](_0x34cee7)){_0x3cf05b[_0x34cee7][_0x15f0('0x2a')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2b')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2c')]=0x0;_0x3cf05b[_0x34cee7]['abandoned']=0x0;_0x3cf05b[_0x34cee7]['sumHoldTime']=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x27')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2d')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2e')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2f')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x30')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x31')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x32')]=0x0;_0x3cf05b[_0x34cee7]['outboundUnknownCallsDay']=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x33')]=0x0;_0x3cf05b[_0x34cee7]['outboundDropCallsDayCallersExit']=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x34')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x35')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x36')]=0x0;_0x3cf05b[_0x34cee7]['outboundReCallsDay']=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x2e')]=0x0;_0x3cf05b[_0x34cee7][_0x15f0('0x37')]=0x0;_0x3cf05b[_0x34cee7]['queueStatusComplete']=!![];}}}}Realtime[_0x15f0('0x38')][_0x15f0('0x39')]=function(_0x51b0a3,_0x107ad4){for(var _0x5c4d07 in _0x107ad4){if(_0x51b0a3[_0x15f0('0x22')](_0x5c4d07)){_0x51b0a3[_0x5c4d07]=_0x107ad4[_0x5c4d07];}}};Realtime[_0x15f0('0x38')][_0x15f0('0x3a')]=function(){var _0x109fa0=this;return function(_0x1ea203){if(_0x1ea203){freeIsNotKeyAgent(_0x1ea203,_0x109fa0[_0x15f0('0x11')]);for(var _0x386c68=0x0,_0x319595={},_0x3fa32a={};_0x386c68<_0x1ea203[_0x15f0('0x3b')];_0x386c68+=0x1){_0x319595=_0x1ea203[_0x386c68];var _0x4eb9bf=_[_0x15f0('0x25')](_0x319595[_0x15f0('0x26')])?util[_0x15f0('0x23')](_0x15f0('0x3c'),_0x319595['name']):_0x319595[_0x15f0('0x26')];if(_[_0x15f0('0x3d')](_0x109fa0['agents'][_0x4eb9bf])){_0x109fa0['agents'][_0x4eb9bf]=new Agent(_0x319595);}else{_0x109fa0[_0x15f0('0x39')](_0x109fa0[_0x15f0('0x11')][_0x4eb9bf],_0x319595);}}}return _0x109fa0[_0x15f0('0x11')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x3e')]=function(){var _0x3ca6db=this;return function(_0xcf86a7){if(_0xcf86a7){freeIsNotKeySip(_0xcf86a7,_0x3ca6db[_0x15f0('0x12')]);for(var _0x387466=0x0,_0x3d35f6={},_0x5e1bee={};_0x387466<_0xcf86a7[_0x15f0('0x3b')];_0x387466+=0x1){_0x3d35f6=_0xcf86a7[_0x387466];if(_[_0x15f0('0x3d')](_0x3ca6db[_0x15f0('0x12')][util['format'](_0x15f0('0x3c'),_0x3d35f6['name'])])){_0x3ca6db[_0x15f0('0x12')][util[_0x15f0('0x23')]('SIP/%s',_0x3d35f6['name'])]=new Telephone(_0x3d35f6);}else{_0x3ca6db['mergeFromDatabase'](_0x3ca6db[_0x15f0('0x12')][util[_0x15f0('0x23')]('SIP/%s',_0x3d35f6[_0x15f0('0x24')])],_0x3d35f6);}}}return _0x3ca6db[_0x15f0('0x12')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x3f')]=function(){var _0x5d0341=this;return function(_0x1a444b){if(_0x1a444b){freeIsNotKeySip(_0x1a444b,_0x5d0341[_0x15f0('0x40')]);for(var _0x389cbe=0x0,_0x594ce6={},_0x33c3ee={};_0x389cbe<_0x1a444b[_0x15f0('0x3b')];_0x389cbe+=0x1){_0x594ce6=_0x1a444b[_0x389cbe];if(_[_0x15f0('0x3d')](_0x5d0341[_0x15f0('0x40')][util[_0x15f0('0x23')](_0x15f0('0x3c'),_0x594ce6['name'])])){_0x5d0341[_0x15f0('0x40')][util['format'](_0x15f0('0x3c'),_0x594ce6[_0x15f0('0x24')])]=new Trunk(_0x594ce6);}else{_0x5d0341['mergeFromDatabase'](_0x5d0341['trunks'][util[_0x15f0('0x23')](_0x15f0('0x3c'),_0x594ce6[_0x15f0('0x24')])],_0x594ce6);}}}return _0x5d0341['trunks'];};};Realtime[_0x15f0('0x38')][_0x15f0('0x41')]=function(){var _0x5c1ab6=this;return function(_0xfccd13){if(_0xfccd13){freeIsNotKey(_0xfccd13,_0x5c1ab6[_0x15f0('0x42')],'name');for(var _0x1c4791=0x0,_0x1c855b={},_0x535615={};_0x1c4791<_0xfccd13[_0x15f0('0x3b')];_0x1c4791+=0x1){_0x1c855b=_0xfccd13[_0x1c4791];if(_[_0x15f0('0x3d')](_0x5c1ab6['voiceQueues'][_0x1c855b[_0x15f0('0x24')]])){_0x5c1ab6[_0x15f0('0x42')][_0x1c855b['name']]=new VoiceQueue(_0x1c855b);}else{_0x5c1ab6[_0x15f0('0x39')](_0x5c1ab6['voiceQueues'][_0x1c855b[_0x15f0('0x24')]],_0x1c855b);}}}return _0x5c1ab6['voiceQueues'];};};Realtime['prototype'][_0x15f0('0x43')]=function(){var _0x30b266=this;return function(_0x37ebf8){if(_0x37ebf8){freeIsNotKey(_0x37ebf8,_0x30b266['triggers'],'id');for(var _0x2cfaed=0x0,_0x167d21={},_0x8f81e6={};_0x2cfaed<_0x37ebf8[_0x15f0('0x3b')];_0x2cfaed+=0x1){_0x167d21=_0x37ebf8[_0x2cfaed];if(_[_0x15f0('0x3d')](_0x30b266[_0x15f0('0x44')][_0x167d21['id']])){_0x30b266['triggers'][_0x167d21['id']]=new Trigger(_0x167d21);}else{_0x30b266[_0x15f0('0x39')](_0x30b266['triggers'][_0x167d21['id']],_0x167d21);}}}return _0x30b266['triggers'];};};Realtime[_0x15f0('0x38')][_0x15f0('0x45')]=function(){var _0x25ec76=this;return function(_0x47849a){if(_0x47849a){freeIsNotKey(_0x47849a,_0x25ec76[_0x15f0('0x13')],'id');for(var _0x221c1e=0x0,_0x19b291={},_0x39674c={};_0x221c1e<_0x47849a['length'];_0x221c1e+=0x1){_0x19b291=_0x47849a[_0x221c1e];if(_['isUndefined'](_0x25ec76[_0x15f0('0x13')][_0x19b291['id']])){_0x25ec76[_0x15f0('0x13')][_0x19b291['id']]=new Template(_0x19b291);}else{_0x25ec76[_0x15f0('0x39')](_0x25ec76[_0x15f0('0x13')][_0x19b291['id']],_0x19b291);}}}return _0x25ec76[_0x15f0('0x13')];};};Realtime['prototype'][_0x15f0('0x46')]=function(){var _0x107653=this;return function(_0x3612dc){if(_0x3612dc){freeIsNotKey(_0x3612dc,_0x107653[_0x15f0('0x1a')],'id');for(var _0x2cfc2a=0x0,_0x5b90d2={},_0x407988={};_0x2cfc2a<_0x3612dc['length'];_0x2cfc2a+=0x1){_0x5b90d2=_0x3612dc[_0x2cfc2a];if(_[_0x15f0('0x3d')](_0x107653[_0x15f0('0x1a')][_0x5b90d2['id']])){_0x107653[_0x15f0('0x1a')][_0x5b90d2['id']]=new ZendeskAccount(_0x5b90d2);}else{_0x107653[_0x15f0('0x39')](_0x107653[_0x15f0('0x1a')][_0x5b90d2['id']],_0x5b90d2);}}}return _0x107653[_0x15f0('0x1a')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x47')]=function(){var _0x2777e5=this;return function(_0x3606fe){if(_0x3606fe){freeIsNotKey(_0x3606fe,_0x2777e5['salesforceAccounts'],'id');for(var _0x44d541=0x0,_0x6c0d90={},_0x452183={};_0x44d541<_0x3606fe[_0x15f0('0x3b')];_0x44d541+=0x1){_0x6c0d90=_0x3606fe[_0x44d541];if(_[_0x15f0('0x3d')](_0x2777e5[_0x15f0('0x1b')][_0x6c0d90['id']])){_0x2777e5[_0x15f0('0x1b')][_0x6c0d90['id']]=new SalesforceAccount(_0x6c0d90);}else{_0x2777e5[_0x15f0('0x39')](_0x2777e5[_0x15f0('0x1b')][_0x6c0d90['id']],_0x6c0d90);}}}return _0x2777e5[_0x15f0('0x1b')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x48')]=function(){var _0x344049=this;return function(_0x54e2d1){if(_0x54e2d1){freeIsNotKey(_0x54e2d1,_0x344049[_0x15f0('0x1c')],'id');for(var _0x14c4a9=0x0,_0x3061fc={},_0x17140b={};_0x14c4a9<_0x54e2d1[_0x15f0('0x3b')];_0x14c4a9+=0x1){_0x3061fc=_0x54e2d1[_0x14c4a9];if(_[_0x15f0('0x3d')](_0x344049[_0x15f0('0x1c')][_0x3061fc['id']])){_0x344049[_0x15f0('0x1c')][_0x3061fc['id']]=new FreshdeskAccount(_0x3061fc);}else{_0x344049[_0x15f0('0x39')](_0x344049[_0x15f0('0x1c')][_0x3061fc['id']],_0x3061fc);}}}return _0x344049[_0x15f0('0x1c')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x5430a0=this;return function(_0x5d2fc7){if(_0x5d2fc7){freeIsNotKey(_0x5d2fc7,_0x5430a0[_0x15f0('0x1d')],'id');for(var _0x44fe95=0x0,_0x3c91d4={},_0x258645={};_0x44fe95<_0x5d2fc7[_0x15f0('0x3b')];_0x44fe95+=0x1){_0x3c91d4=_0x5d2fc7[_0x44fe95];if(_[_0x15f0('0x3d')](_0x5430a0[_0x15f0('0x1d')][_0x3c91d4['id']])){_0x5430a0[_0x15f0('0x1d')][_0x3c91d4['id']]=new ZohoAccount(_0x3c91d4);}else{_0x5430a0[_0x15f0('0x39')](_0x5430a0[_0x15f0('0x1d')][_0x3c91d4['id']],_0x3c91d4);}}}return _0x5430a0[_0x15f0('0x1d')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x49')]=function(){var _0x40425c=this;return function(_0x6e61ba){if(_0x6e61ba){freeIsNotKey(_0x6e61ba,_0x40425c['deskAccounts'],'id');for(var _0x190c26=0x0,_0x1d2421={},_0x382f3f={};_0x190c26<_0x6e61ba[_0x15f0('0x3b')];_0x190c26+=0x1){_0x1d2421=_0x6e61ba[_0x190c26];if(_[_0x15f0('0x3d')](_0x40425c[_0x15f0('0x1e')][_0x1d2421['id']])){_0x40425c['deskAccounts'][_0x1d2421['id']]=new DeskAccount(_0x1d2421);}else{_0x40425c[_0x15f0('0x39')](_0x40425c[_0x15f0('0x1e')][_0x1d2421['id']],_0x1d2421);}}}return _0x40425c[_0x15f0('0x1e')];};};Realtime[_0x15f0('0x38')]['initSugarcrmAccounts']=function(){var _0x52f484=this;return function(_0x4a4e59){if(_0x4a4e59){freeIsNotKey(_0x4a4e59,_0x52f484['sugarcrmAccounts'],'id');for(var _0x4845d5=0x0,_0x1513bf={},_0x405962={};_0x4845d5<_0x4a4e59[_0x15f0('0x3b')];_0x4845d5+=0x1){_0x1513bf=_0x4a4e59[_0x4845d5];if(_[_0x15f0('0x3d')](_0x52f484['sugarcrmAccounts'][_0x1513bf['id']])){_0x52f484[_0x15f0('0x4a')][_0x1513bf['id']]=new SugarcrmAccount(_0x1513bf);}else{_0x52f484[_0x15f0('0x39')](_0x52f484[_0x15f0('0x4a')][_0x1513bf['id']],_0x1513bf);}}}return _0x52f484[_0x15f0('0x4a')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x2d8bc9=this;return function(_0x25bc0e){if(_0x25bc0e){freeIsNotKey(_0x25bc0e,_0x2d8bc9[_0x15f0('0x4b')],'id');for(var _0x1ad270=0x0,_0x4e35b7={},_0x5487ca={};_0x1ad270<_0x25bc0e[_0x15f0('0x3b')];_0x1ad270+=0x1){_0x4e35b7=_0x25bc0e[_0x1ad270];if(_[_0x15f0('0x3d')](_0x2d8bc9[_0x15f0('0x4b')][_0x4e35b7['id']])){_0x2d8bc9[_0x15f0('0x4b')][_0x4e35b7['id']]=new VtigerAccount(_0x4e35b7);}else{_0x2d8bc9[_0x15f0('0x39')](_0x2d8bc9[_0x15f0('0x4b')][_0x4e35b7['id']],_0x4e35b7);}}}return _0x2d8bc9['vtigerAccounts'];};};Realtime[_0x15f0('0x38')][_0x15f0('0x4c')]=function(){var _0x3a5e34=this;return function(_0x3eb316){if(_0x3eb316){freeIsNotKey(_0x3eb316,_0x3a5e34[_0x15f0('0x4d')],'id');for(var _0x1d740d=0x0,_0x2399a3={},_0x54ecbc={};_0x1d740d<_0x3eb316[_0x15f0('0x3b')];_0x1d740d+=0x1){_0x2399a3=_0x3eb316[_0x1d740d];if(_[_0x15f0('0x3d')](_0x3a5e34['servicenowAccounts'][_0x2399a3['id']])){_0x3a5e34[_0x15f0('0x4d')][_0x2399a3['id']]=new ServicenowAccount(_0x2399a3);}else{_0x3a5e34[_0x15f0('0x39')](_0x3a5e34[_0x15f0('0x4d')][_0x2399a3['id']],_0x2399a3);}}}return _0x3a5e34[_0x15f0('0x4d')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x4e')]=function(){var _0x455633=this;return function(_0x52bc81){if(_0x52bc81){freeIsNotKey(_0x52bc81,_0x455633[_0x15f0('0x1f')],'id');for(var _0x3d6534=0x0,_0x4e3337={},_0x53c2f6={};_0x3d6534<_0x52bc81['length'];_0x3d6534+=0x1){_0x4e3337=_0x52bc81[_0x3d6534];if(_[_0x15f0('0x3d')](_0x455633[_0x15f0('0x1f')][_0x4e3337['id']])){_0x455633[_0x15f0('0x1f')][_0x4e3337['id']]=new Dynamics365Account(_0x4e3337);}else{_0x455633[_0x15f0('0x39')](_0x455633['dynamics365Accounts'][_0x4e3337['id']],_0x4e3337);}}}return _0x455633[_0x15f0('0x1f')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x4f')]=function(){var _0xeaddd5=this;return function(_0xdd627f){if(_0xdd627f){freeIsNotKey(_0xdd627f,_0xeaddd5['freshsalesAccounts'],'id');for(var _0x493c74=0x0,_0x2679fb={},_0x31b374={};_0x493c74<_0xdd627f[_0x15f0('0x3b')];_0x493c74+=0x1){_0x2679fb=_0xdd627f[_0x493c74];if(_[_0x15f0('0x3d')](_0xeaddd5[_0x15f0('0x20')][_0x2679fb['id']])){_0xeaddd5[_0x15f0('0x20')][_0x2679fb['id']]=new FreshsalesAccount(_0x2679fb);}else{_0xeaddd5[_0x15f0('0x39')](_0xeaddd5[_0x15f0('0x20')][_0x2679fb['id']],_0x2679fb);}}}return _0xeaddd5[_0x15f0('0x20')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x50')]=function(){var _0x11474b=this;return function(_0x43aaeb){for(var _0x4eeb2c=0x0;_0x4eeb2c<_0x43aaeb[_0x15f0('0x3b')];_0x4eeb2c+=0x1){_['merge'](_0x11474b[_0x15f0('0x42')][_0x43aaeb[_0x4eeb2c][_0x15f0('0x24')]],_0x43aaeb[_0x4eeb2c]);}return _0x11474b['voiceQueues'];};};Realtime[_0x15f0('0x38')]['initVoiceQueueReports']=function(){var _0x1e54b3=this;return function(_0x29be7c){clearVoiceQueues(_0x1e54b3[_0x15f0('0x42')]);if(_0x29be7c){_0x29be7c=_[_0x15f0('0x51')](_0x29be7c,_0x15f0('0x52'));for(var _0x4b4eae in _0x29be7c){if(_0x29be7c[_0x15f0('0x22')](_0x4b4eae)){var _0x481ad8={};for(var _0x4b92ab=0x0;_0x4b92ab<_0x29be7c[_0x4b4eae]['length'];_0x4b92ab+=0x1){var _0x10f346=_0x29be7c[_0x4b4eae][_0x4b92ab]['queue'];if(_0x1e54b3[_0x15f0('0x42')][_0x10f346]){if(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x53')]){_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x2c')]+=0x1;}if(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x54')]){_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x55')]+=0x1;}_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x56')]+=moment(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x57')])[_0x15f0('0x58')](moment(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x59')]),_0x15f0('0x5a'))||0x0;if(_0x4b92ab===_0x29be7c[_0x4b4eae][_0x15f0('0x3b')]-0x1){_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x27')]+=moment(_0x29be7c[_0x4b4eae][_0x4b92ab]['queuecallercompleteAt']||_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x5b')]||_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x5c')])[_0x15f0('0x58')](moment(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x59')]),'seconds')||0x0;_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x2a')]+=0x1;if(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x5d')]){_0x1e54b3[_0x15f0('0x42')][_0x10f346][_0x15f0('0x2b')]+=0x1;_0x1e54b3['voiceQueues'][_0x10f346][_0x15f0('0x2d')]+=moment(_0x29be7c[_0x4b4eae][_0x4b92ab][_0x15f0('0x5e')])[_0x15f0('0x58')](moment(_0x29be7c[_0x4b4eae][_0x4b92ab]['queuecallerleaveAt']),_0x15f0('0x5a'))||0x0;}}else{_0x1e54b3[_0x15f0('0x42')][_0x10f346]['sumDuration']+=_0x1e54b3['voiceQueues'][_0x10f346][_0x15f0('0x56')]||0x0;}}}}}}return _0x1e54b3['voiceQueues'];};};Realtime[_0x15f0('0x38')][_0x15f0('0x5f')]=function(){var _0xb8f4ac=this;return function(_0x4e9fc4){clearVoiceCallReports(_0xb8f4ac['outbound']);if(_0x4e9fc4){for(var _0x167b21=0x0;_0x167b21<_0x4e9fc4[_0x15f0('0x3b')];_0x167b21+=0x1){_0xb8f4ac[_0x15f0('0x14')][_0x15f0('0x2a')]+=0x1;_0xb8f4ac[_0x15f0('0x14')]['sumDuration']+=_0x4e9fc4[_0x167b21][_0x15f0('0x60')];if(_0x4e9fc4[_0x167b21][_0x15f0('0x61')]===_0x15f0('0x62')){_0xb8f4ac[_0x15f0('0x14')][_0x15f0('0x2b')]+=0x1;_0xb8f4ac[_0x15f0('0x14')][_0x15f0('0x56')]+=_0x4e9fc4[_0x167b21][_0x15f0('0x60')]-_0x4e9fc4[_0x167b21][_0x15f0('0x63')]||0x0;_0xb8f4ac['outbound'][_0x15f0('0x2d')]+=_0x4e9fc4[_0x167b21][_0x15f0('0x63')];}}}return _0xb8f4ac['outbound'];};};Realtime['prototype'][_0x15f0('0x64')]=function(){var _0xd702ad=this;return function(_0x37240d){if(_0x37240d){freeIsNotKey(_0x37240d,_0xd702ad[_0x15f0('0x65')],_0x15f0('0x24'));for(var _0x34da4b=0x0,_0x326fd2={};_0x34da4b<_0x37240d[_0x15f0('0x3b')];_0x34da4b+=0x1){_0x326fd2=_0x37240d[_0x34da4b];if(_[_0x15f0('0x3d')](_0xd702ad[_0x15f0('0x65')][_0x326fd2[_0x15f0('0x24')]])){_0xd702ad[_0x15f0('0x65')][_0x326fd2[_0x15f0('0x24')]]=new Campaign(_0x326fd2);}else{_0xd702ad[_0x15f0('0x39')](_0xd702ad[_0x15f0('0x65')][_0x326fd2[_0x15f0('0x24')]],_0x326fd2);_0xd702ad[_0x15f0('0x65')][_0x326fd2[_0x15f0('0x24')]][_0x15f0('0x66')]=_0x326fd2[_0x15f0('0x67')]?_0x326fd2[_0x15f0('0x67')]['name']:undefined;}}}return _0xd702ad[_0x15f0('0x65')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x68')]=function(){var _0x5109d1=this;return function(_0x2c8fe7){if(_0x2c8fe7){freeIsNotKey(_0x2c8fe7,_0x5109d1[_0x15f0('0x69')],'id');for(var _0xd8f4c1=0x0,_0x21b757={};_0xd8f4c1<_0x2c8fe7[_0x15f0('0x3b')];_0xd8f4c1+=0x1){_0x21b757=_0x2c8fe7[_0xd8f4c1];if(_[_0x15f0('0x3d')](_0x5109d1['voiceExtensions'][_0x21b757['id']])){_0x5109d1[_0x15f0('0x69')][_0x21b757['id']]=new VoiceExtension(_0x21b757);}else{_0x5109d1[_0x15f0('0x39')](_0x5109d1[_0x15f0('0x69')][_0x21b757['id']],_0x21b757);}}}return _0x5109d1['voiceExtensions'];};};Realtime[_0x15f0('0x38')]['initCampaignHopperHistory']=function(){var _0x1ed646=this;return function(_0x224e5e){clearCampaigns(_0x1ed646[_0x15f0('0x65')]);for(var _0x1173a1=0x0;_0x1173a1<_0x224e5e[_0x15f0('0x3b')];_0x1173a1+=0x1){_[_0x15f0('0x6a')](_0x1ed646[_0x15f0('0x65')][_0x224e5e[_0x1173a1][_0x15f0('0x24')]],_0x224e5e[_0x1173a1]);}return _0x1ed646[_0x15f0('0x65')];};};Realtime[_0x15f0('0x38')][_0x15f0('0x6b')]=function(){var _0x649db4=this;return function(_0x4d13bd){if(_0x4d13bd){freeIsNotKey(_0x4d13bd,_0x649db4['faxAccounts'],'id');for(var _0x58f2c0=0x0,_0x11f8bf={},_0x598cf2={};_0x58f2c0<_0x4d13bd[_0x15f0('0x3b')];_0x58f2c0+=0x1){_0x11f8bf=_0x4d13bd[_0x58f2c0];if(_['isUndefined'](_0x649db4['faxAccounts'][_0x11f8bf['id']])){_0x649db4['faxAccounts'][_0x11f8bf['id']]=new FaxAccount(_0x11f8bf);}else{_0x649db4[_0x15f0('0x39')](_0x649db4[_0x15f0('0x6c')][_0x11f8bf['id']],_0x11f8bf);}}}return _0x649db4[_0x15f0('0x6c')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 331c31d..327974e 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 _0x3fa2=['calleridnum','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','UserId','monitor','monitors','monitorFilename','filename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','getAgentByInternal','keys','getCallType','split','outbound','internal','voiceCallReport','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip'];(function(_0x18fa98,_0x5a594b){var _0x1cce1f=function(_0x6ab354){while(--_0x6ab354){_0x18fa98['push'](_0x18fa98['shift']());}};_0x1cce1f(++_0x5a594b);}(_0x3fa2,0x1f4));var _0x23fa=function(_0x40a44b,_0x2b8785){_0x40a44b=_0x40a44b-0x0;var _0x2b656d=_0x3fa2[_0x40a44b];return _0x2b656d;};'use strict';var _=require(_0x23fa('0x0'));var moment=require(_0x23fa('0x1'));var util=require(_0x23fa('0x2'));var config=require(_0x23fa('0x3'));var ami=require(_0x23fa('0x4'));var RpcVoiceAgentReport=require(_0x23fa('0x5'));var RpcVoiceCallReport=require(_0x23fa('0x6'));var RpcVoiceDialReport=require(_0x23fa('0x7'));var RpcMemberReport=require(_0x23fa('0x8'));var RpcVoiceQueueReport=require(_0x23fa('0x9'));var RpcVoiceRecording=require(_0x23fa('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x23fa('0xb'));var VoiceCallReport=require(_0x23fa('0xc'));var VoiceAgentReport=require(_0x23fa('0xd'));var VoiceDialReport=require(_0x23fa('0xe'));var UserReport=require(_0x23fa('0xf'));function Report(_0x3a592d){this[_0x23fa('0x10')]=_0x3a592d;this[_0x23fa('0x11')]=_0x3a592d[_0x23fa('0x11')];this[_0x23fa('0x12')]=_0x3a592d['telephones'];}Report[_0x23fa('0x13')][_0x23fa('0x14')]=function(_0x2788a2){var _0x1aecde=new VoiceQueueReport(this[_0x23fa('0x10')]);var _0x4f0f77=new VoiceAgentReport(this[_0x23fa('0x10')]);var _0x1651b9=new VoiceDialReport(this[_0x23fa('0x10')]);var _0x5f2ce6=new VoiceCallReport(this[_0x23fa('0x10')]);var _0x5ad79b=new UserReport(this[_0x23fa('0x10')]);if(config[_0x23fa('0x15')]&&config['xdr'][_0x23fa('0x16')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x18'),this['voiceAgentReport'][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x19'),this[_0x23fa('0x1a')][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x1b'),this[_0x23fa('0x1c')][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x1d'),this[_0x23fa('0x1e')][_0x23fa('0x17')](this));}};Report[_0x23fa('0x13')][_0x23fa('0x1f')]=function(_0x281f36){var _0x4266e9;_0x4266e9=_['find'](this[_0x23fa('0x11')],function(_0x3a939d){return _0x3a939d[_0x23fa('0x20')]==_0x281f36||_0x3a939d[_0x23fa('0x21')]==_0x281f36;});if(_[_0x23fa('0x22')](_0x4266e9)){var _0x177ea3=_['find'](this[_0x23fa('0x12')],function(_0x70a87d){return _0x70a87d[_0x23fa('0x20')]==_0x281f36||_0x70a87d[_0x23fa('0x21')]==_0x281f36;});if(_0x177ea3){_0x4266e9=_[_0x23fa('0x23')](this[_0x23fa('0x11')],function(_0x408dd6){return _0x408dd6[_0x23fa('0x24')]==util[_0x23fa('0x25')](_0x23fa('0x26'),_0x177ea3[_0x23fa('0x21')]);});}}return _0x4266e9;};Report[_0x23fa('0x13')]['voiceQueueReport']=function(_0x50ba88){for(var _0x4c3c6e=0x0;_0x4c3c6e<_0x50ba88[_0x23fa('0x27')];_0x4c3c6e+=0x1){var _0x38d967=this['findAgent'](_0x50ba88[_0x4c3c6e][_0x23fa('0x28')]);if(_0x38d967){_0x50ba88[_0x4c3c6e][_0x23fa('0x20')]=_0x38d967[_0x23fa('0x20')];_0x50ba88[_0x4c3c6e][_0x23fa('0x29')]=!![];_0x50ba88[_0x4c3c6e]['lastAssignedTo']=_0x38d967['name'];_0x50ba88[_0x4c3c6e][_0x23fa('0x24')]=_[_0x23fa('0x22')](_0x38d967[_0x23fa('0x24')])?util[_0x23fa('0x25')](_0x23fa('0x26'),_0x38d967['name']):_0x38d967[_0x23fa('0x24')];if(_0x50ba88[_0x4c3c6e][_0x23fa('0x2a')]){_0x50ba88[_0x4c3c6e]['queuecallercompleteAt']=moment()[_0x23fa('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x50ba88[_0x4c3c6e][_0x23fa('0x2b')]){_0x50ba88[_0x4c3c6e][_0x23fa('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x23fa('0x2d')](_0x50ba88[_0x4c3c6e]);}RpcVoiceQueueReport[_0x23fa('0x2e')](_0x50ba88[_0x4c3c6e]);}};function extractCalleridNumber(_0x4dce52){var _0x5bae8e=_0x4dce52['match'](/<(.*?)>/);return _0x5bae8e?_0x5bae8e[0x1]:_0x4dce52;}Report[_0x23fa('0x13')][_0x23fa('0x2f')]=function(_0x2a03d3){for(var _0x200e86=0x0;_0x200e86/);return _0x5ba80c?_0x5ba80c[0x1]:_0x2af07d;}Report[_0x83a4('0xe')][_0x83a4('0x28')]=function(_0x3f46c1){for(var _0x1593a9=0x0;_0x1593a9',_0x1e46e0[_0x83a4('0x3c')],_0x1e46e0['calleridnum']);}if(RpcVoiceTransferReport[_0x83a4('0x3d')][_0x1e46e0[_0x83a4('0x3e')]]){var _0x175981=RpcVoiceTransferReport['transfers'][_0x1e46e0[_0x83a4('0x3e')]];_0x175981['transfereelinkedid']=_0x1e46e0[_0x83a4('0x3f')];RpcVoiceTransferReport[_0x83a4('0x40')](_0x175981);delete RpcVoiceTransferReport[_0x83a4('0x3d')][_0x1e46e0['linkedid']];}if(_['isNil'](_0x1e46e0[_0x83a4('0x32')])){_0x1e46e0['type']=this[_0x83a4('0x41')](_0x1e46e0);}if(_['isNil'](_0x1e46e0[_0x83a4('0x42')])){var _0x1e09fe=_0x1e46e0['channel'][_0x83a4('0x2c')]('-')[0x0];var _0x137207=this[_0x83a4('0xd')][_0x1e09fe];if(!_0x137207)_0x137207=this[_0x83a4('0x28')](_0x1e46e0['accountcode']);if(_0x137207){_0x1e46e0['UserId']=_0x137207['id'];_0x1e46e0[_0x83a4('0x43')]=_0x137207[_0x83a4('0x1e')];}}RpcVoiceCallReport['create'](_0x1e46e0);if(_0x1e46e0['monitor']){for(var _0xd1d2d7=0x0;_0xd1d2d7<_0x1e46e0[_0x83a4('0x44')]['length'];_0xd1d2d7+=0x1){_0x1e46e0[_0x83a4('0x45')]=_0x1e46e0['monitors'][_0xd1d2d7][_0x83a4('0x46')];_0x1e46e0[_0x83a4('0x47')]=_0x1e46e0[_0x83a4('0x44')][_0xd1d2d7][_0x83a4('0x47')];if(_0x1e46e0[_0x83a4('0x31')]==_0x83a4('0x48')){_0x1e46e0['calleridnum']=_0x1e46e0['connectedlinenum'];_0x1e46e0[_0x83a4('0x3c')]=_0x1e46e0[_0x83a4('0x49')];_0x1e46e0[_0x83a4('0x24')]=_0x1e46e0[_0x83a4('0x1d')];_0x1e46e0[_0x83a4('0x49')]=_0x1e46e0[_0x83a4('0x43')];_0x1e46e0[_0x83a4('0x31')]=_0x1e46e0[_0x83a4('0x39')];}else if(_0x1e46e0['exten']=='xcally-motion-dialer'){_0x1e46e0[_0x83a4('0x2d')]=_0x1e46e0[_0x83a4('0x30')];_0x1e46e0[_0x83a4('0x31')]=_0x1e46e0['originatecalleridnum'];}RpcVoiceRecording[_0x83a4('0x4a')](_0x1e46e0);}}};Report[_0x83a4('0xe')][_0x83a4('0x16')]=function(_0x52b6d1){if(_[_0x83a4('0x4b')](_0x52b6d1)){_0x52b6d1[_0x83a4('0x4c')](function(_0x425be2){RpcVoiceAgentReport[_0x83a4('0x4a')](_0x425be2);});}else{RpcVoiceAgentReport[_0x83a4('0x4a')](_0x52b6d1);}};Report[_0x83a4('0xe')][_0x83a4('0x19')]=function(_0x5330e8){RpcVoiceDialReport[_0x83a4('0x4a')](_0x5330e8);var _0x62346;var _0xe6af8e;var _0x113c56=_0x5330e8['channel'];if(_[_0x83a4('0x4d')](_0x113c56,_0x83a4('0x4e'))){_0xe6af8e=_0x113c56[_0x83a4('0x4f')](_0x113c56[_0x83a4('0x50')]('/')+0x1,_0x113c56['indexOf']('@'));_0x62346=_[_0x83a4('0x21')](this[_0x83a4('0xd')],function(_0x3401e9){return _0x3401e9['mobile']==_0xe6af8e||_0x3401e9['phone']==_0xe6af8e||_0x3401e9['accountcode']==_0xe6af8e;});}else{_0xe6af8e=_0x113c56[_0x83a4('0x4f')](_0x113c56[_0x83a4('0x50')]('/')+0x1,_0x113c56['lastIndexOf']('-'));_0x62346=this[_0x83a4('0x1c')](_0xe6af8e);}if(_0x62346){_0x5330e8['interface']=_[_0x83a4('0x1f')](_0x62346['interface'])?util[_0x83a4('0x22')](_0x83a4('0x23'),_0x62346[_0x83a4('0x1e')]):_0x62346[_0x83a4('0x25')];_0x5330e8['membername']=_0x62346[_0x83a4('0x1e')];_0x5330e8['accountcode']=_0x62346[_0x83a4('0x1d')];RpcMemberReport[_0x83a4('0x19')](_0x5330e8);}};Report[_0x83a4('0xe')][_0x83a4('0x40')]=function(_0xb7c744){RpcVoiceTransferReport['transfers'][_0xb7c744[_0x83a4('0x51')]]=_0xb7c744;};Report[_0x83a4('0xe')][_0x83a4('0x52')]=function(_0x531305){RpcVoiceTransferReport['attendedTransfer'](_0x531305);};module[_0x83a4('0x53')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index ea1a208..ce6a8d1 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97e0=['redis','localhost','socket.io-emitter','trunks','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','actionid','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97e0,0x166));var _0x097e=function(_0x5f53ab,_0x324327){_0x5f53ab=_0x5f53ab-0x0;var _0x116166=_0x97e0[_0x5f53ab];return _0x116166;};'use strict';var _=require(_0x097e('0x0'));var moment=require('moment');var util=require(_0x097e('0x1'));var Redis=require(_0x097e('0x2'));var BPromise=require(_0x097e('0x3'));var config=require(_0x097e('0x4'));var logger=require(_0x097e('0x5'))('ami');var ami=require('../ami');config['redis']=_[_0x097e('0x6')](config[_0x097e('0x7')],{'host':_0x097e('0x8'),'port':0x18eb});var io=require(_0x097e('0x9'))(new Redis(config['redis']));function UserReport(_0xe580a3){this[_0x097e('0xa')]=_0xe580a3['trunks'];this['agents']=_0xe580a3['agents'];this[_0x097e('0xb')]=_0xe580a3['telephones'];ami['on']('registryentry',this[_0x097e('0xc')][_0x097e('0xd')](this));ami['on']('registry',this[_0x097e('0xc')][_0x097e('0xd')](this));ami['on'](_0x097e('0xe'),this[_0x097e('0xf')][_0x097e('0xd')](this));ami['on'](_0x097e('0x10'),this[_0x097e('0x11')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x097e('0x12')]()[_0x097e('0x13')](ami['actionSipShowRegistry']())[_0x097e('0x14')](function(_0x774f41){logger[_0x097e('0x15')](_0x097e('0x16'),util[_0x097e('0x17')](_0x774f41,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x097e('0x12')]()[_0x097e('0x13')](ami['actionDeviceStateList']())['catch'](function(_0x3c3299){logger[_0x097e('0x15')]('[userReport][devicestatelist]',util[_0x097e('0x17')](_0x3c3299,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x097e('0x12')]()['then'](ami[_0x097e('0x18')]())[_0x097e('0x14')](function(_0x3c8c54){logger['error'](_0x097e('0x19'),util[_0x097e('0x17')](_0x3c8c54,{'showHidden':![],'depth':null}));});}UserReport[_0x097e('0x1a')][_0x097e('0x1b')]=function(){setInterval(function(){BPromise[_0x097e('0x12')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x097e('0x13')](showPeersStatus());},0x32c8);};UserReport[_0x097e('0x1a')]['isNotNull']=function(_0x15343e){return _0x15343e!==null&&!_[_0x097e('0x1c')](_0x15343e);};UserReport[_0x097e('0x1a')][_0x097e('0x1d')]=function(_0x368f9e,_0x40a0fc,_0x3948cf){io['to'](_0x368f9e)[_0x097e('0x1d')](_0x40a0fc,_0x3948cf);};UserReport[_0x097e('0x1a')][_0x097e('0xc')]=function(_0x404de5){try{if(this[_0x097e('0x1e')](_0x404de5)){logger[_0x097e('0x1f')](_0x097e('0x20'),_0x404de5[_0x097e('0x21')],_0x404de5[_0x097e('0x22')]);logger[_0x097e('0x23')](_0x097e('0x24'),util[_0x097e('0x17')](_0x404de5,{'showHidden':![],'depth':null}));var _0x4829b4=_[_0x097e('0x25')](this[_0x097e('0xa')],{'defaultuser':_0x404de5[_0x097e('0x21')]});if(_0x4829b4){_0x404de5[_0x097e('0x26')]=_0x404de5[_0x097e('0x22')];_[_0x097e('0x27')](_0x4829b4,_[_0x097e('0x28')](_0x404de5,['event',_0x097e('0x29'),'username',_0x097e('0x22')]));logger[_0x097e('0x23')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x097e('0x17')](_0x4829b4,{'showHidden':![],'depth':null}));this[_0x097e('0x1d')](util[_0x097e('0x2a')](_0x097e('0x2b'),_0x4829b4[_0x097e('0x2c')]),'trunk:save',_0x4829b4);}}}catch(_0x2e7702){logger[_0x097e('0x15')](_0x097e('0x24'),util['inspect'](_0x2e7702,{'showHidden':![],'depth':null}));}};UserReport[_0x097e('0x1a')][_0x097e('0xf')]=function(_0x3c2d4c){try{if(this[_0x097e('0x1e')](_0x3c2d4c)){logger[_0x097e('0x1f')](_0x097e('0x2d'),_0x3c2d4c[_0x097e('0x2e')],_0x3c2d4c[_0x097e('0x22')]);logger[_0x097e('0x23')](_0x097e('0x2f'),util[_0x097e('0x17')](_0x3c2d4c,{'showHidden':![],'depth':null}));if(this[_0x097e('0x30')][_0x3c2d4c['device']]){if(!this[_0x097e('0x30')][_0x3c2d4c[_0x097e('0x2e')]]['local']||_0x3c2d4c[_0x097e('0x22')]['toLowerCase']()=='inuse'){this[_0x097e('0x30')][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x31')]=![];if(this[_0x097e('0x30')][_0x3c2d4c[_0x097e('0x2e')]]['state']!==_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]()){this[_0x097e('0x30')][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x33')]=_[_0x097e('0x34')](moment()[_0x097e('0x2a')]('x'));}this['agents'][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x22')]=_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]();this[_0x097e('0x30')][_0x3c2d4c[_0x097e('0x2e')]]['updateStatusRealtime'](_0x3c2d4c);}}else if(this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]]){if(this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x22')]!==_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]()){this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x33')]=_[_0x097e('0x34')](moment()[_0x097e('0x2a')]('x'));}this[_0x097e('0xb')][_0x3c2d4c['device']][_0x097e('0x22')]=_0x3c2d4c[_0x097e('0x22')]['toLowerCase']();logger[_0x097e('0x23')](_0x097e('0x35'),util[_0x097e('0x17')](this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]],{'showHidden':![],'depth':null}));this[_0x097e('0x1d')](util['format'](_0x097e('0x36'),this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]][_0x097e('0x2c')]),_0x097e('0x37'),this[_0x097e('0xb')][_0x3c2d4c[_0x097e('0x2e')]]);}else if(this[_0x097e('0xa')][_0x3c2d4c['device']]){if(this[_0x097e('0xa')][_0x3c2d4c['device']][_0x097e('0x22')]!==_0x3c2d4c[_0x097e('0x22')]['toLowerCase']()){this['trunks'][_0x3c2d4c['device']]['stateTime']=_[_0x097e('0x34')](moment()['format']('x'));}this['trunks'][_0x3c2d4c[_0x097e('0x2e')]]['state']=_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]();logger[_0x097e('0x23')](_0x097e('0x38'),util['inspect'](this[_0x097e('0xa')][_0x3c2d4c['device']],{'showHidden':![],'depth':null}));this[_0x097e('0x1d')](util[_0x097e('0x2a')](_0x097e('0x2b'),this[_0x097e('0xa')][_0x3c2d4c['device']]['name']),'trunk:save',this['trunks'][_0x3c2d4c['device']]);}else if(_[_0x097e('0x39')](_0x3c2d4c[_0x097e('0x2e')],_0x097e('0x3a'))){var _0x377ed5=_0x3c2d4c['device'];var _0x291542=_0x377ed5[_0x097e('0x3b')](_0x377ed5['indexOf']('/')+0x1,_0x377ed5[_0x097e('0x3c')]('@'));var _0x3ea2ea=_[_0x097e('0x25')](this[_0x097e('0x30')],function(_0x300804){return _0x300804[_0x097e('0x3d')]==_0x291542||_0x300804[_0x097e('0x3e')]==_0x291542||_0x300804[_0x097e('0x3f')]==_0x291542;});if(_0x3ea2ea){if(_0x3ea2ea[_0x097e('0x22')]!==_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]()){_0x3ea2ea[_0x097e('0x33')]=_[_0x097e('0x34')](moment()[_0x097e('0x2a')]('x'));}_0x3ea2ea[_0x097e('0x22')]=_0x3c2d4c[_0x097e('0x22')][_0x097e('0x32')]();_0x3ea2ea[_0x097e('0x31')]=!![];_0x3ea2ea[_0x097e('0x40')](_0x3c2d4c);}}}}catch(_0x1c208b){logger['error'](_0x097e('0x2f'),util[_0x097e('0x17')](_0x1c208b,{'showHidden':![],'depth':null}));}};UserReport[_0x097e('0x1a')]['syncPeerStatus']=function(_0x52c0bc){try{if(this[_0x097e('0x1e')](_0x52c0bc)&&this[_0x097e('0x1e')](_0x52c0bc['peerstatus'])){logger['info'](_0x097e('0x41'),_0x52c0bc[_0x097e('0x42')],_0x52c0bc[_0x097e('0x43')],_0x52c0bc['peerstatus']);logger[_0x097e('0x23')](_0x097e('0x44'),util['inspect'](_0x52c0bc,{'showHidden':![],'depth':null}));if(this[_0x097e('0x30')][_0x52c0bc[_0x097e('0x42')]]){if(!this[_0x097e('0x30')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x31')]||_0x52c0bc[_0x097e('0x10')]['toLowerCase']()=='registered'){this['agents'][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x31')]=![];this[_0x097e('0x30')][_0x52c0bc[_0x097e('0x42')]]['status']=_0x52c0bc[_0x097e('0x10')][_0x097e('0x32')]();this[_0x097e('0x30')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x43')]=_0x52c0bc['address'];this[_0x097e('0x30')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x40')](_0x52c0bc);}}else if(this[_0x097e('0xb')][_0x52c0bc[_0x097e('0x42')]]){this[_0x097e('0xb')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x45')]=_0x52c0bc[_0x097e('0x10')][_0x097e('0x32')]();this[_0x097e('0xb')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x43')]=_0x52c0bc[_0x097e('0x43')];logger[_0x097e('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x097e('0x17')](this[_0x097e('0xb')][_0x52c0bc['peer']],{'showHidden':![],'depth':null}));this[_0x097e('0x1d')](util[_0x097e('0x2a')](_0x097e('0x36'),this[_0x097e('0xb')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x2c')]),'telephone:save',this['telephones'][_0x52c0bc[_0x097e('0x42')]]);}else if(this[_0x097e('0xa')][_0x52c0bc[_0x097e('0x42')]]){this[_0x097e('0xa')][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x45')]=_0x52c0bc[_0x097e('0x10')]['toLowerCase']();this[_0x097e('0xa')][_0x52c0bc['peer']][_0x097e('0x43')]=_0x52c0bc[_0x097e('0x43')];logger[_0x097e('0x23')](_0x097e('0x46'),util[_0x097e('0x17')](this['trunks'][_0x52c0bc['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x097e('0x2b'),this['trunks'][_0x52c0bc[_0x097e('0x42')]][_0x097e('0x2c')]),_0x097e('0x47'),this[_0x097e('0xa')][_0x52c0bc[_0x097e('0x42')]]);}}}catch(_0x33b1af){logger[_0x097e('0x15')]('[userReport][peerstatus]',util[_0x097e('0x17')](_0x33b1af,{'showHidden':![],'depth':null}));}};module[_0x097e('0x48')]=UserReport; \ No newline at end of file +var _0x608c=['resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','event','actionid','trunk:%s','name','[userReport][registry]','info','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','format','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','trunk:save','startsWith','Local','indexOf','mobile','phone','isNotNull','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect'];(function(_0x1c028c,_0x2b2009){var _0xb95178=function(_0x2fbc48){while(--_0x2fbc48){_0x1c028c['push'](_0x1c028c['shift']());}};_0xb95178(++_0x2b2009);}(_0x608c,0x1b1));var _0xc608=function(_0x2b8aa1,_0x5c8434){_0x2b8aa1=_0x2b8aa1-0x0;var _0x17936c=_0x608c[_0x2b8aa1];return _0x17936c;};'use strict';var _=require(_0xc608('0x0'));var moment=require(_0xc608('0x1'));var util=require(_0xc608('0x2'));var Redis=require(_0xc608('0x3'));var BPromise=require(_0xc608('0x4'));var config=require('../../../config/environment');var logger=require(_0xc608('0x5'))(_0xc608('0x6'));var ami=require(_0xc608('0x7'));config['redis']=_[_0xc608('0x8')](config[_0xc608('0x9')],{'host':_0xc608('0xa'),'port':0x18eb});var io=require(_0xc608('0xb'))(new Redis(config[_0xc608('0x9')]));function UserReport(_0x5d9dce){this[_0xc608('0xc')]=_0x5d9dce[_0xc608('0xc')];this[_0xc608('0xd')]=_0x5d9dce[_0xc608('0xd')];this[_0xc608('0xe')]=_0x5d9dce['telephones'];ami['on'](_0xc608('0xf'),this[_0xc608('0x10')][_0xc608('0x11')](this));ami['on']('registry',this[_0xc608('0x10')]['bind'](this));ami['on'](_0xc608('0x12'),this[_0xc608('0x13')][_0xc608('0x11')](this));ami['on'](_0xc608('0x14'),this[_0xc608('0x15')][_0xc608('0x11')](this));return this[_0xc608('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0xc608('0x17')](ami[_0xc608('0x18')]())[_0xc608('0x19')](function(_0xda775){logger[_0xc608('0x1a')](_0xc608('0x1b'),util[_0xc608('0x1c')](_0xda775,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc608('0x1d')]()[_0xc608('0x17')](ami[_0xc608('0x1e')]())[_0xc608('0x19')](function(_0x1200d6){logger[_0xc608('0x1a')](_0xc608('0x1f'),util[_0xc608('0x1c')](_0x1200d6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc608('0x1d')]()[_0xc608('0x17')](ami[_0xc608('0x20')]())[_0xc608('0x19')](function(_0xb7fa44){logger[_0xc608('0x1a')](_0xc608('0x21'),util[_0xc608('0x1c')](_0xb7fa44,{'showHidden':![],'depth':null}));});}UserReport[_0xc608('0x22')][_0xc608('0x16')]=function(){setInterval(function(){BPromise[_0xc608('0x1d')]()[_0xc608('0x17')](showSipRegistrations())[_0xc608('0x17')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xc608('0x22')]['isNotNull']=function(_0x39ac8e){return _0x39ac8e!==null&&!_[_0xc608('0x23')](_0x39ac8e);};UserReport['prototype']['emit']=function(_0x5e678e,_0x57df0a,_0xa490d1){io['to'](_0x5e678e)[_0xc608('0x24')](_0x57df0a,_0xa490d1);};UserReport['prototype']['syncRegistry']=function(_0x56332d){try{if(this['isNotNull'](_0x56332d)){logger['info'](_0xc608('0x25'),_0x56332d[_0xc608('0x26')],_0x56332d[_0xc608('0x27')]);logger[_0xc608('0x28')]('[userReport][registry]',util[_0xc608('0x1c')](_0x56332d,{'showHidden':![],'depth':null}));var _0x45ce22=_[_0xc608('0x29')](this['trunks'],{'defaultuser':_0x56332d['username']});if(_0x45ce22){_0x56332d[_0xc608('0x2a')]=_0x56332d['state'];_[_0xc608('0x2b')](_0x45ce22,_['omit'](_0x56332d,[_0xc608('0x2c'),_0xc608('0x2d'),_0xc608('0x26'),'state']));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x45ce22,{'showHidden':![],'depth':null}));this[_0xc608('0x24')](util['format'](_0xc608('0x2e'),_0x45ce22[_0xc608('0x2f')]),'trunk:save',_0x45ce22);}}}catch(_0x319959){logger['error'](_0xc608('0x30'),util[_0xc608('0x1c')](_0x319959,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc608('0x13')]=function(_0x3c8605){try{if(this['isNotNull'](_0x3c8605)){logger[_0xc608('0x31')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3c8605[_0xc608('0x32')],_0x3c8605[_0xc608('0x27')]);logger['debug'](_0xc608('0x33'),util[_0xc608('0x1c')](_0x3c8605,{'showHidden':![],'depth':null}));if(this['agents'][_0x3c8605['device']]){if(!this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x34')]||_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]()==_0xc608('0x36')){this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x34')]=![];if(this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x27')]!==_0x3c8605[_0xc608('0x27')]['toLowerCase']()){this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x37')]=_[_0xc608('0x38')](moment()['format']('x'));}this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]]['state']=_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]();this[_0xc608('0xd')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x39')](_0x3c8605);}}else if(this['telephones'][_0x3c8605[_0xc608('0x32')]]){if(this['telephones'][_0x3c8605[_0xc608('0x32')]][_0xc608('0x27')]!==_0x3c8605[_0xc608('0x27')]['toLowerCase']()){this[_0xc608('0xe')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x37')]=_['toNumber'](moment()[_0xc608('0x3a')]('x'));}this[_0xc608('0xe')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x27')]=_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]();logger['debug'](_0xc608('0x3b'),util['inspect'](this[_0xc608('0xe')][_0x3c8605[_0xc608('0x32')]],{'showHidden':![],'depth':null}));this[_0xc608('0x24')](util[_0xc608('0x3a')]('telephone:%s',this[_0xc608('0xe')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x2f')]),_0xc608('0x3c'),this[_0xc608('0xe')][_0x3c8605['device']]);}else if(this[_0xc608('0xc')][_0x3c8605[_0xc608('0x32')]]){if(this[_0xc608('0xc')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x27')]!==_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]()){this[_0xc608('0xc')][_0x3c8605['device']][_0xc608('0x37')]=_[_0xc608('0x38')](moment()[_0xc608('0x3a')]('x'));}this[_0xc608('0xc')][_0x3c8605[_0xc608('0x32')]][_0xc608('0x27')]=_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xc608('0x1c')](this[_0xc608('0xc')][_0x3c8605[_0xc608('0x32')]],{'showHidden':![],'depth':null}));this[_0xc608('0x24')](util[_0xc608('0x3a')]('trunk:%s',this['trunks'][_0x3c8605['device']]['name']),_0xc608('0x3d'),this[_0xc608('0xc')][_0x3c8605['device']]);}else if(_[_0xc608('0x3e')](_0x3c8605[_0xc608('0x32')],_0xc608('0x3f'))){var _0x2b96d8=_0x3c8605[_0xc608('0x32')];var _0x3a91b1=_0x2b96d8['substring'](_0x2b96d8[_0xc608('0x40')]('/')+0x1,_0x2b96d8['indexOf']('@'));var _0x1053f0=_[_0xc608('0x29')](this['agents'],function(_0x38aa4f){return _0x38aa4f[_0xc608('0x41')]==_0x3a91b1||_0x38aa4f[_0xc608('0x42')]==_0x3a91b1||_0x38aa4f['accountcode']==_0x3a91b1;});if(_0x1053f0){if(_0x1053f0[_0xc608('0x27')]!==_0x3c8605['state'][_0xc608('0x35')]()){_0x1053f0[_0xc608('0x37')]=_[_0xc608('0x38')](moment()['format']('x'));}_0x1053f0[_0xc608('0x27')]=_0x3c8605[_0xc608('0x27')][_0xc608('0x35')]();_0x1053f0[_0xc608('0x34')]=!![];_0x1053f0['updateStatusRealtime'](_0x3c8605);}}}}catch(_0x15a198){logger[_0xc608('0x1a')](_0xc608('0x33'),util['inspect'](_0x15a198,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc608('0x15')]=function(_0x32ad57){try{if(this[_0xc608('0x43')](_0x32ad57)&&this[_0xc608('0x43')](_0x32ad57[_0xc608('0x14')])){logger[_0xc608('0x31')](_0xc608('0x44'),_0x32ad57[_0xc608('0x45')],_0x32ad57[_0xc608('0x46')],_0x32ad57[_0xc608('0x14')]);logger[_0xc608('0x28')]('[userReport][peerstatus]',util[_0xc608('0x1c')](_0x32ad57,{'showHidden':![],'depth':null}));if(this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]]){if(!this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x34')]||_0x32ad57[_0xc608('0x14')][_0xc608('0x35')]()==_0xc608('0x47')){this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x34')]=![];this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]]['status']=_0x32ad57[_0xc608('0x14')]['toLowerCase']();this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]]['address']=_0x32ad57[_0xc608('0x46')];this[_0xc608('0xd')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x39')](_0x32ad57);}}else if(this[_0xc608('0xe')][_0x32ad57[_0xc608('0x45')]]){this[_0xc608('0xe')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x48')]=_0x32ad57[_0xc608('0x14')][_0xc608('0x35')]();this[_0xc608('0xe')][_0x32ad57['peer']][_0xc608('0x46')]=_0x32ad57[_0xc608('0x46')];logger[_0xc608('0x28')](_0xc608('0x49'),util[_0xc608('0x1c')](this[_0xc608('0xe')][_0x32ad57[_0xc608('0x45')]],{'showHidden':![],'depth':null}));this[_0xc608('0x24')](util[_0xc608('0x3a')](_0xc608('0x4a'),this[_0xc608('0xe')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x2f')]),_0xc608('0x3c'),this[_0xc608('0xe')][_0x32ad57['peer']]);}else if(this[_0xc608('0xc')][_0x32ad57[_0xc608('0x45')]]){this['trunks'][_0x32ad57[_0xc608('0x45')]]['status']=_0x32ad57['peerstatus'][_0xc608('0x35')]();this[_0xc608('0xc')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x46')]=_0x32ad57['address'];logger['debug'](_0xc608('0x4b'),util['inspect'](this['trunks'][_0x32ad57['peer']],{'showHidden':![],'depth':null}));this[_0xc608('0x24')](util[_0xc608('0x3a')](_0xc608('0x2e'),this[_0xc608('0xc')][_0x32ad57[_0xc608('0x45')]][_0xc608('0x2f')]),_0xc608('0x3d'),this[_0xc608('0xc')][_0x32ad57[_0xc608('0x45')]]);}}}catch(_0x590282){logger[_0xc608('0x1a')](_0xc608('0x4c'),util[_0xc608('0x1c')](_0x590282,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d2ca7ee..06fc173 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x35293e,_0x5d1114){var _0x5efeeb=function(_0x4e0939){while(--_0x4e0939){_0x35293e['push'](_0x35293e['shift']());}};_0x5efeeb(++_0x5d1114);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x246400,_0x4d9610){var _0x5a9f6a=function(_0x4fc060){while(--_0x4fc060){_0x246400['push'](_0x246400['shift']());}};_0x5a9f6a(++_0x4d9610);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 529d98e..aea5736 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcd7=['syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','split','exten','xcally-motion-preview','channel','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','application','subtract','duration','seconds','includes','lastapplication','match','isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','answertime','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','user:agentcomplete','length','transferType','resolve','undefined','isEmpty','getSettings','stopRecordingOnTransfer','then','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','transfereruniqueid','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','lodash','moment','ioredis','../../../config/environment','../model/channel','../rpc/setting','set','queue','agi','voicemail','NO\x20ANSWER','FAILED','redis','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xfcd7,0x169));var _0x7fcd=function(_0x100bf1,_0x5b69b2){_0x100bf1=_0x100bf1-0x0;var _0x50ecf2=_0xfcd7[_0x100bf1];return _0x50ecf2;};'use strict';var _=require(_0x7fcd('0x0'));var moment=require(_0x7fcd('0x1'));var util=require('util');var path=require('path');var Redis=require(_0x7fcd('0x2'));var config=require(_0x7fcd('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');var Channel=require(_0x7fcd('0x4'));var RpcSetting=require(_0x7fcd('0x5'));var applications=[_0x7fcd('0x6'),_0x7fcd('0x7'),_0x7fcd('0x8'),'dial','playback',_0x7fcd('0x9')];var dispositions=[_0x7fcd('0xa'),_0x7fcd('0xb'),_0x7fcd('0xb'),_0x7fcd('0xa'),_0x7fcd('0xa'),'NO\x20ANSWER','ANSWERED','BUSY',_0x7fcd('0xb'),_0x7fcd('0xb'),'FAILED'];config[_0x7fcd('0xc')]=_['defaults'](config['redis'],{'host':_0x7fcd('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7fcd('0xc')]));function VoiceCallReport(_0x198138){this[_0x7fcd('0xe')]=_0x198138[_0x7fcd('0xe')];this[_0x7fcd('0xf')]=_0x198138['agents'];this[_0x7fcd('0x10')]={};ami['on'](_0x7fcd('0x11'),this[_0x7fcd('0x12')][_0x7fcd('0x13')](this));ami['on'](_0x7fcd('0x14'),this[_0x7fcd('0x12')][_0x7fcd('0x13')](this));ami['on']('newchannel',this[_0x7fcd('0x15')]['bind'](this));ami['on'](_0x7fcd('0x16'),this['syncNewState'][_0x7fcd('0x13')](this));ami['on']('varset',this[_0x7fcd('0x17')][_0x7fcd('0x13')](this));ami['on'](_0x7fcd('0x18'),this[_0x7fcd('0x19')][_0x7fcd('0x13')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x7fcd('0x13')](this));ami['on'](_0x7fcd('0x1a'),this[_0x7fcd('0x1b')][_0x7fcd('0x13')](this));ami['on'](_0x7fcd('0x1c'),this[_0x7fcd('0x1d')][_0x7fcd('0x13')](this));ami['on'](_0x7fcd('0x1e'),this[_0x7fcd('0x1f')]['bind'](this));ami['on'](_0x7fcd('0x20'),this[_0x7fcd('0x21')][_0x7fcd('0x13')](this));try{logger[_0x7fcd('0x22')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x7fcd('0x23')]();}catch(_0x56849c){logger[_0x7fcd('0x24')](_0x7fcd('0x25'),util[_0x7fcd('0x26')](_0x56849c,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7fcd('0x27')]['isNotNull']=function(_0x33ac4d){return _0x33ac4d!==null&&!_[_0x7fcd('0x28')](_0x33ac4d);};VoiceCallReport[_0x7fcd('0x27')]['emit']=function(_0x28e5a3,_0x13495f,_0x2a2a57){io['to'](_0x28e5a3)[_0x7fcd('0x29')](_0x13495f,_0x2a2a57);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x371575){try{if(this[_0x7fcd('0x2a')](_0x371575)){logger[_0x7fcd('0x22')](_0x7fcd('0x2b'),_0x371575[_0x7fcd('0x2c')],_0x371575['calleridname'],_0x371575[_0x7fcd('0x2d')]);logger[_0x7fcd('0x2e')](_0x7fcd('0x2f'),_0x371575['uniqueid'],util[_0x7fcd('0x26')](_0x371575,{'showHidden':![],'depth':null}));if(_0x371575[_0x7fcd('0x2c')]===_0x371575[_0x7fcd('0x30')]){if(!_[_0x7fcd('0x28')](this[_0x7fcd('0xe')][_0x371575[_0x7fcd('0x2c')]])){_[_0x7fcd('0x31')](this[_0x7fcd('0xe')][_0x371575[_0x7fcd('0x2c')]],_[_0x7fcd('0x32')](_0x371575,_[_0x7fcd('0x33')](this[_0x7fcd('0xe')][_0x371575['uniqueid']])));}}if(_0x371575['context']===_0x7fcd('0x34')){if(this[_0x7fcd('0xf')][_0x371575['channel'][_0x7fcd('0x35')]('-')[0x0]]){if(_0x371575[_0x7fcd('0x36')]==_0x7fcd('0x37')){this[_0x7fcd('0xf')][_0x371575[_0x7fcd('0x38')]['split']('-')[0x0]][_0x7fcd('0x39')]=_0x371575[_0x7fcd('0x3a')];this[_0x7fcd('0x29')](util[_0x7fcd('0x3b')](_0x7fcd('0x3c'),this[_0x7fcd('0xf')][_0x371575[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x3d')]),_0x7fcd('0x3e'),{'destaccountcode':this[_0x7fcd('0xf')][_0x371575[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x371575[_0x7fcd('0x3a')]});}}}}}catch(_0x5c5a3e){logger['error'](_0x7fcd('0x3f'),_0x371575[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x5c5a3e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7fcd('0x27')]['syncNewChannel']=function(_0x199a87){try{if(this['isNotNull'](_0x199a87)){logger[_0x7fcd('0x2e')]('[%s][voiceCallReport][newchannel]\x20event:',_0x199a87[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x199a87,{'showHidden':![],'depth':null}));if(this[_0x7fcd('0xe')][_0x199a87[_0x7fcd('0x2c')]])return;if(_0x199a87[_0x7fcd('0x38')]===_0x7fcd('0x40'))return;if(_0x199a87['uniqueid']!==_0x199a87[_0x7fcd('0x30')]&&!this[_0x7fcd('0x10')][_0x199a87[_0x7fcd('0x30')]])return;logger['info'](_0x7fcd('0x41'),_0x199a87['uniqueid'],_0x199a87[_0x7fcd('0x42')],_0x199a87[_0x7fcd('0x36')]);this['channels'][_0x199a87[_0x7fcd('0x2c')]]=new Channel();this['channels'][_0x199a87[_0x7fcd('0x2c')]][_0x7fcd('0x43')]=moment()[_0x7fcd('0x3b')](_0x7fcd('0x44'));this[_0x7fcd('0xe')][_0x199a87[_0x7fcd('0x2c')]][_0x7fcd('0x45')]=dispositions[_[_0x7fcd('0x46')](_0x199a87[_0x7fcd('0x47')])];_[_0x7fcd('0x31')](this['channels'][_0x199a87[_0x7fcd('0x2c')]],_[_0x7fcd('0x32')](_0x199a87,_['keys'](this[_0x7fcd('0xe')][_0x199a87[_0x7fcd('0x2c')]])));if(_0x199a87[_0x7fcd('0x42')]===_0x7fcd('0x34')){if(this[_0x7fcd('0xf')][_0x199a87['channel'][_0x7fcd('0x35')]('-')[0x0]]){if(_[_0x7fcd('0x28')](this[_0x7fcd('0xf')][_0x199a87[_0x7fcd('0x38')]['split']('-')[0x0]][_0x7fcd('0x39')])){this[_0x7fcd('0xf')][_0x199a87[_0x7fcd('0x38')]['split']('-')[0x0]]['destconnectedlinenum']=_0x199a87['exten'];logger[_0x7fcd('0x2e')](_0x7fcd('0x48'),_0x199a87[_0x7fcd('0x2c')],util[_0x7fcd('0x26')]({'id':this['agents'][_0x199a87[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x199a87[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x49')],'destconnectedlinenum':_0x199a87[_0x7fcd('0x36')]},{'showHidden':![],'depth':null}));this[_0x7fcd('0x29')](util[_0x7fcd('0x3b')]('user:%s',this['agents'][_0x199a87[_0x7fcd('0x38')]['split']('-')[0x0]]['name']),_0x7fcd('0x3e'),{'id':this[_0x7fcd('0xf')][_0x199a87['channel'][_0x7fcd('0x35')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x199a87[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x49')],'destconnectedlinenum':_0x199a87[_0x7fcd('0x36')]});}}}}}catch(_0x2c1f18){logger[_0x7fcd('0x24')](_0x7fcd('0x4a'),_0x199a87['uniqueid'],util[_0x7fcd('0x26')](_0x2c1f18,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7fcd('0x27')][_0x7fcd('0x12')]=function(_0x5769d5){try{if(this[_0x7fcd('0x2a')](_0x5769d5)){logger[_0x7fcd('0x2e')](_0x7fcd('0x4b'),_0x5769d5[_0x7fcd('0x2c')],util['inspect'](_0x5769d5,{'showHidden':![],'depth':null}));if(_0x5769d5['channel']===_0x7fcd('0x40')||_0x5769d5[_0x7fcd('0x36')]==='h')return;if(_0x5769d5['uniqueid']===_0x5769d5[_0x7fcd('0x30')]||this[_0x7fcd('0x10')][_0x5769d5[_0x7fcd('0x30')]]){_0x5769d5['application']=_0x5769d5['application'][_0x7fcd('0x4c')]();_0x5769d5[_0x7fcd('0x4d')]=_0x5769d5['appdata']&&_0x5769d5[_0x7fcd('0x4e')][_0x7fcd('0x4f')](_0x7fcd('0x50'))?_0x5769d5[_0x7fcd('0x4e')]:(_0x5769d5['appdata']||_0x5769d5[_0x7fcd('0x4d')])[_0x7fcd('0x4c')]();logger[_0x7fcd('0x22')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x5769d5[_0x7fcd('0x2c')],_0x5769d5[_0x7fcd('0x51')],_0x5769d5[_0x7fcd('0x4d')]);if(_[_0x7fcd('0x28')](this[_0x7fcd('0xe')][_0x5769d5['uniqueid']])){this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]]=new Channel();this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]]['starttime']=_0x5769d5['duration']?moment()[_0x7fcd('0x52')](moment[_0x7fcd('0x53')](_0x5769d5[_0x7fcd('0x53')])[_0x7fcd('0x54')](),_0x7fcd('0x54'))[_0x7fcd('0x3b')](_0x7fcd('0x44')):moment()[_0x7fcd('0x3b')](_0x7fcd('0x44'));this['channels'][_0x5769d5[_0x7fcd('0x2c')]][_0x7fcd('0x45')]=_0x7fcd('0xa');}_[_0x7fcd('0x31')](this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]],_[_0x7fcd('0x32')](_0x5769d5,_[_0x7fcd('0x33')](this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]])));if(_[_0x7fcd('0x55')](applications,_0x5769d5[_0x7fcd('0x51')])){this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]][_0x7fcd('0x56')]=_0x5769d5[_0x7fcd('0x51')];this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]]['lastdata']=_0x5769d5['applicationdata'];if(_0x5769d5[_0x7fcd('0x51')]===_0x7fcd('0x6')&&_[_0x7fcd('0x4f')](_0x5769d5[_0x7fcd('0x4d')][_0x7fcd('0x4c')](),'cdr(')){var _0x4eeaa8=_0x5769d5[_0x7fcd('0x4d')][_0x7fcd('0x35')]('=');var _0x2f9264=_0x4eeaa8[0x0][_0x7fcd('0x4c')]()[_0x7fcd('0x57')](/cdr\((.*)\)/);if(_0x2f9264){if(_0x2f9264[0x1]==='type'&&!_[_0x7fcd('0x58')](this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]][_0x2f9264[0x1]]))return;this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]][_0x2f9264[0x1]]=_0x4eeaa8[0x1];}}else if(_0x5769d5['application']===_0x7fcd('0x7')){this[_0x7fcd('0xe')][_0x5769d5[_0x7fcd('0x2c')]][_0x7fcd('0x7')]=_0x5769d5[_0x7fcd('0x4d')]['split'](',')[0x0];}}}}}catch(_0x24962b){logger['error'](_0x7fcd('0x59'),_0x5769d5[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x24962b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7fcd('0x27')][_0x7fcd('0x5a')]=function(_0x50e4a9){try{if(this['isNotNull'](_0x50e4a9)){logger[_0x7fcd('0x22')](_0x7fcd('0x5b'),_0x50e4a9[_0x7fcd('0x2c')],_0x50e4a9[_0x7fcd('0x30')],_0x50e4a9[_0x7fcd('0x5c')],_0x50e4a9[_0x7fcd('0x2d')]);logger[_0x7fcd('0x2e')](_0x7fcd('0x5d'),_0x50e4a9[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x50e4a9,{'showHidden':![],'depth':null}));if(_0x50e4a9[_0x7fcd('0x47')]!=='6')return;if(_0x50e4a9['uniqueid']!==_0x50e4a9[_0x7fcd('0x30')]){var _0x2d0301=moment();if(this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]]){if(!this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x5e')]){this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x5e')]=!![];this[_0x7fcd('0xe')][_0x50e4a9['linkedid']]['answertime']=_0x2d0301[_0x7fcd('0x3b')](_0x7fcd('0x44'));if(this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]]['starttime']){this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x5f')]=_0x2d0301[_0x7fcd('0x60')](this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x43')],_0x7fcd('0x54'));}}this[_0x7fcd('0xe')][_0x50e4a9['linkedid']][_0x7fcd('0x30')]=_0x50e4a9[_0x7fcd('0x2c')];if(_0x50e4a9[_0x7fcd('0x2d')]!=='xcally-motion-preview'){this['channels'][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x3a')]=_0x50e4a9[_0x7fcd('0x2d')];}this['channels'][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x61')]=_0x50e4a9[_0x7fcd('0x5c')];this['channels'][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x62')]=_0x50e4a9['channel'];this['channels'][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x45')]=dispositions[_[_0x7fcd('0x46')](_0x50e4a9[_0x7fcd('0x47')])];if(this[_0x7fcd('0xf')][_0x50e4a9['channel'][_0x7fcd('0x35')]('-')[0x0]]){this['channels'][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x63')]=this['agents'][_0x50e4a9['channel'][_0x7fcd('0x35')]('-')[0x0]]['id'];this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x64')]=this[_0x7fcd('0xf')][_0x50e4a9['channel'][_0x7fcd('0x35')]('-')[0x0]]['name'];}}if(this[_0x7fcd('0xe')][_0x50e4a9['uniqueid']]){if(!this['channels'][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x5e')]){this['channels'][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x5e')]=!![];this[_0x7fcd('0xe')][_0x50e4a9['uniqueid']]['answertime']=_0x2d0301[_0x7fcd('0x3b')](_0x7fcd('0x44'));if(this['channels'][_0x50e4a9[_0x7fcd('0x2c')]]['starttime']){this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x5f')]=_0x2d0301[_0x7fcd('0x60')](this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x43')],_0x7fcd('0x54'));}}if(_0x50e4a9[_0x7fcd('0x2d')]!==_0x7fcd('0x37')){this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]]['connectedlinenum']=_0x50e4a9[_0x7fcd('0x2d')];}this['channels'][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x61')]=_0x50e4a9[_0x7fcd('0x5c')];this[_0x7fcd('0xe')][_0x50e4a9['uniqueid']]['destinationchannel']=_0x50e4a9[_0x7fcd('0x38')];this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x45')]=dispositions[_[_0x7fcd('0x46')](_0x50e4a9[_0x7fcd('0x47')])];}}else{if(this['channels'][_0x50e4a9[_0x7fcd('0x2c')]]){if(this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]){this[_0x7fcd('0xe')][_0x50e4a9['uniqueid']][_0x7fcd('0x63')]=this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['id'];this[_0x7fcd('0xe')][_0x50e4a9['uniqueid']][_0x7fcd('0x64')]=this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x3d')];}}}if(_0x50e4a9[_0x7fcd('0x42')]===_0x7fcd('0x34')){if(this['agents'][_0x50e4a9[_0x7fcd('0x38')]['split']('-')[0x0]]){this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')]['split']('-')[0x0]]['destconnectedlinenum']=_0x50e4a9[_0x7fcd('0x36')];var _0x3ffa84,_0x531547;if(this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]]){_0x3ffa84=this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]]['routealias'];_0x531547=this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x2c')]][_0x7fcd('0x7')];}else if(this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]]){_0x3ffa84=this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]][_0x7fcd('0x65')];_0x531547=this[_0x7fcd('0xe')][_0x50e4a9[_0x7fcd('0x30')]]['queue'];}logger[_0x7fcd('0x2e')](_0x7fcd('0x66'),_0x50e4a9[_0x7fcd('0x2c')],util[_0x7fcd('0x26')]({'id':this['agents'][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x49')],'destconnectedlinenum':_0x50e4a9[_0x7fcd('0x36')],'routealias':_0x3ffa84,'queue':_0x531547||undefined},{'showHidden':![],'depth':null}));this[_0x7fcd('0x29')](util[_0x7fcd('0x3b')](_0x7fcd('0x3c'),this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x3d')]),_0x7fcd('0x3e'),{'id':this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x7fcd('0xf')][_0x50e4a9[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x49')],'destconnectedlinenum':_0x50e4a9[_0x7fcd('0x36')],'routealias':_0x3ffa84,'queue':_0x531547||undefined});}}}}catch(_0x530d75){logger[_0x7fcd('0x24')](_0x7fcd('0x67'),_0x50e4a9[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x530d75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7fcd('0x27')][_0x7fcd('0x68')]=function(_0x49d796,_0x1f2cec){try{if(this[_0x7fcd('0xe')][_0x49d796]){logger['info'](_0x7fcd('0x69'),_0x49d796,_0x1f2cec);this[_0x7fcd('0xe')][_0x49d796][_0x7fcd('0x6a')]=!![];if(_[_0x7fcd('0x6b')](_0x1f2cec,_0x7fcd('0x6c'))){_0x1f2cec=_0x1f2cec[_0x7fcd('0x6d')](_0x7fcd('0x6c'),_0x7fcd('0x6e'));}this[_0x7fcd('0xe')][_0x49d796]['monitorFilename']=_0x1f2cec;var _0x565243=_['find'](this[_0x7fcd('0xe')][_0x49d796][_0x7fcd('0x6f')],{'filename':_0x1f2cec});if(_[_0x7fcd('0x58')](_0x565243)){this['channels'][_0x49d796][_0x7fcd('0x6f')][_0x7fcd('0x70')]({'filename':_0x1f2cec,'createdAt':moment()['format'](_0x7fcd('0x44')),'mixmonitorid':'','status':_0x7fcd('0x71')});}}}catch(_0x53bda9){logger[_0x7fcd('0x24')](_0x7fcd('0x72'),_0x49d796,util['inspect'](_0x53bda9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x383633){try{if(this['isNotNull'](_0x383633)){logger[_0x7fcd('0x2e')](_0x7fcd('0x73'),_0x383633['uniqueid'],util[_0x7fcd('0x26')](_0x383633,{'showHidden':![],'depth':null}));if(this[_0x7fcd('0xe')][_0x383633['uniqueid']]&&_0x383633['channel']!=_0x7fcd('0x40')){if(this[_0x7fcd('0x2a')](_0x383633['variable'])){if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')][_0x7fcd('0x75')])){logger[_0x7fcd('0x22')](_0x7fcd('0x76'),_0x383633['uniqueid'],_0x383633[_0x7fcd('0x77')]);this[_0x7fcd('0x68')](_0x383633[_0x7fcd('0x2c')],_0x383633['value']);}else if(this['isNotNull'](_0x383633[_0x7fcd('0x74')]['xmd-phone'])){logger[_0x7fcd('0x22')](_0x7fcd('0x78'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633['uniqueid']]['calleridnum']=_0x383633[_0x7fcd('0x77')];}else if(this['isNotNull'](_0x383633[_0x7fcd('0x74')][_0x7fcd('0x79')])){logger['info'](_0x7fcd('0x7a'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this[_0x7fcd('0xe')][_0x383633[_0x7fcd('0x2c')]][_0x7fcd('0x7b')]=_0x383633['value'];}else if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')][_0x7fcd('0x7c')])){logger[_0x7fcd('0x22')](_0x7fcd('0x7d'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this[_0x7fcd('0xe')][_0x383633['uniqueid']][_0x7fcd('0x7e')]=_0x383633['value'];}else if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')][_0x7fcd('0x7f')])){logger[_0x7fcd('0x22')](_0x7fcd('0x80'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]['split'](',')[0x0]);this[_0x7fcd('0xe')][_0x383633['uniqueid']][_0x7fcd('0x7')]=_0x383633[_0x7fcd('0x77')][_0x7fcd('0x35')](',')[0x0];}else if(this[_0x7fcd('0x2a')](_0x383633['variable'][_0x7fcd('0x81')])){logger[_0x7fcd('0x22')](_0x7fcd('0x82'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633[_0x7fcd('0x2c')]][_0x7fcd('0x83')]=_0x383633[_0x7fcd('0x77')];}else if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')]['xmd-destination'])){logger['info'](_0x7fcd('0x84'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633[_0x7fcd('0x2c')]][_0x7fcd('0x85')]=_0x383633[_0x7fcd('0x77')];}else if(this[_0x7fcd('0x2a')](_0x383633['variable'][_0x7fcd('0x86')])){logger[_0x7fcd('0x22')](_0x7fcd('0x87'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633[_0x7fcd('0x2c')]][_0x7fcd('0x88')]=_0x383633[_0x7fcd('0x77')];}else if(this[_0x7fcd('0x2a')](_0x383633['variable'][_0x7fcd('0x89')])){logger[_0x7fcd('0x22')](_0x7fcd('0x8a'),_0x383633[_0x7fcd('0x2c')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633['uniqueid']][_0x7fcd('0x7')]=_0x383633[_0x7fcd('0x77')];}else if(this['isNotNull'](_0x383633['variable'][_0x7fcd('0x8b')])){logger[_0x7fcd('0x22')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x383633[_0x7fcd('0x2c')],_0x383633['value']);this[_0x7fcd('0xe')][_0x383633['uniqueid']][_0x7fcd('0x8c')]=_0x383633[_0x7fcd('0x77')];}}}else if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')][_0x7fcd('0x75')])){if(_0x383633[_0x7fcd('0x77')]){var _0x1465d2=path[_0x7fcd('0x8d')](_0x383633[_0x7fcd('0x77')])[_0x7fcd('0x3d')];logger[_0x7fcd('0x22')](_0x7fcd('0x76'),_0x1465d2,_0x383633[_0x7fcd('0x77')]);this[_0x7fcd('0x68')](_0x1465d2,_0x383633['value']);}}else if(this['channels'][_0x383633[_0x7fcd('0x30')]]){if(this['isNotNull'](_0x383633[_0x7fcd('0x74')])){if(this[_0x7fcd('0x2a')](_0x383633[_0x7fcd('0x74')]['sipcallid'])){logger[_0x7fcd('0x22')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x383633[_0x7fcd('0x30')],_0x383633[_0x7fcd('0x77')]);this['channels'][_0x383633['linkedid']][_0x7fcd('0x8e')]=_0x383633['value'];}}}}}catch(_0x277e95){logger[_0x7fcd('0x24')]('[%s][voiceCallReport][varset]',_0x383633[_0x7fcd('0x2c')],util[_0x7fcd('0x26')](_0x277e95,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7fcd('0x27')][_0x7fcd('0x19')]=function(_0x2faa9d){try{if(this[_0x7fcd('0x2a')](_0x2faa9d)){logger[_0x7fcd('0x2e')](_0x7fcd('0x8f'),_0x2faa9d[_0x7fcd('0x2c')],util['inspect'](_0x2faa9d,{'showHidden':![],'depth':null}));if(this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]]){if(this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]]['linkedid']]){this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x30')]][_0x7fcd('0x2c')]=_0x2faa9d['uniqueid'];this['channels'][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x30')]][_0x7fcd('0x5e')]=this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]]['answered'];this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x30')]][_0x7fcd('0x90')]=this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x90')];this['channels'][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x30')]][_0x7fcd('0x62')]=this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x30')]][_0x7fcd('0x38')];this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x30')]][_0x7fcd('0x45')]=this[_0x7fcd('0xe')][_0x2faa9d['uniqueid']][_0x7fcd('0x45')];this[_0x7fcd('0xe')][_0x2faa9d['uniqueid']]=this['channels'][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x30')]];delete this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]]['linkedid']];}else if(this[_0x7fcd('0xe')][this['blindTransfers'][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]]){this[_0x7fcd('0xe')][this['blindTransfers'][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]][_0x7fcd('0x2c')]=[this['channels'][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]][_0x7fcd('0x30')],this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]][_0x7fcd('0x30')]=this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]]['uniqueid']][0x0];this[_0x7fcd('0xe')][this['blindTransfers'][_0x2faa9d['linkedid']][_0x7fcd('0x2c')]][_0x7fcd('0x5e')]=this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x5e')];this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d['linkedid']][_0x7fcd('0x2c')]]['answertime']=this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x90')];this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]][_0x7fcd('0x62')]=this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]]['uniqueid']]['channel'];this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]][_0x7fcd('0x45')]=this['channels'][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x45')];this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]]=this[_0x7fcd('0xe')][this[_0x7fcd('0x10')][_0x2faa9d[_0x7fcd('0x30')]][_0x7fcd('0x2c')]];delete this[_0x7fcd('0xe')][this['blindTransfers'][_0x2faa9d['linkedid']][_0x7fcd('0x2c')]];}}if(this['channels'][_0x2faa9d[_0x7fcd('0x2c')]]){logger[_0x7fcd('0x22')](_0x7fcd('0x91'),_0x2faa9d[_0x7fcd('0x2c')],_0x2faa9d['cause-txt']);var _0x5b6e3a=moment();this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x92')]=_0x5b6e3a[_0x7fcd('0x3b')](_0x7fcd('0x44'));this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x53')]=_0x5b6e3a[_0x7fcd('0x60')](this['channels'][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x43')],_0x7fcd('0x54'));if(this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x5e')]){this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x93')]=_0x5b6e3a[_0x7fcd('0x60')](this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x90')],'seconds');this[_0x7fcd('0xe')][_0x2faa9d['uniqueid']][_0x7fcd('0x5f')]=this[_0x7fcd('0xe')][_0x2faa9d[_0x7fcd('0x2c')]][_0x7fcd('0x53')]-this[_0x7fcd('0xe')][_0x2faa9d['uniqueid']][_0x7fcd('0x93')];}if(_0x2faa9d[_0x7fcd('0x42')]===_0x7fcd('0x34')){if(this['agents'][_0x2faa9d[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]){this[_0x7fcd('0xf')][_0x2faa9d['channel'][_0x7fcd('0x35')]('-')[0x0]]=_[_0x7fcd('0x94')](this['agents'][_0x2faa9d[_0x7fcd('0x38')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x7fcd('0x2e')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x2faa9d[_0x7fcd('0x2c')],util[_0x7fcd('0x26')]({'id':this['agents'][_0x2faa9d['channel'][_0x7fcd('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x7fcd('0xf')][_0x2faa9d[_0x7fcd('0x38')]['split']('-')[0x0]][_0x7fcd('0x49')]},{'showHidden':![],'depth':null}));this[_0x7fcd('0x29')](util[_0x7fcd('0x3b')](_0x7fcd('0x3c'),this['agents'][_0x2faa9d[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]][_0x7fcd('0x3d')]),_0x7fcd('0x95'),{'id':this[_0x7fcd('0xf')][_0x2faa9d[_0x7fcd('0x38')][_0x7fcd('0x35')]('-')[0x0]]['id'],'destaccountcode':this[_0x7fcd('0xf')][_0x2faa9d['channel']['split']('-')[0x0]][_0x7fcd('0x49')]});for(var _0x1c3912=0x0;_0x1c39120x0?_0x597859:0x0;this[_0xca61('0x14')][_0x25bee7['queue']][_0xca61('0x31')]=this['voiceQueues'][_0x25bee7[_0xca61('0x68')]]['talking']>_[_0xca61('0x6c')](_0x25bee7[_0xca61('0x6d')])?_[_0xca61('0x6c')](_0x25bee7['loggedin']):this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]][_0xca61('0x31')];this[_0xca61('0x4d')](this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]],_0xca61('0x65'));}logger['debug'](_0xca61('0x6e'),util[_0xca61('0x3c')](this['voiceQueues'][_0x25bee7[_0xca61('0x68')]],{'showHidden':![],'depth':null}));ami[_0xca61('0x43')]('custom:queuesummary',this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]]);}}}catch(_0x2f9991){logger[_0xca61('0x3b')](_0xca61('0x66'),util[_0xca61('0x3c')](_0x2f9991,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x19')]=function(_0x2caaaa){logger[_0xca61('0x69')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xca61('0x3c')](_0x2caaaa,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x6f')]=function(_0xea6188){try{if(this['isNotNull'](_0xea6188)){logger[_0xca61('0x69')](_0xca61('0x70'),_0xea6188[_0xca61('0x46')],util[_0xca61('0x3c')](_0xea6188,{'showHidden':![],'depth':null}));if(_[_0xca61('0x71')](this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]]))this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]]=[];if(_[_0xca61('0x71')](this['channels'][_0xea6188['uniqueid']]))this[_0xca61('0x12')][_0xea6188[_0xca61('0x46')]]={};var _0x105ff0=new QueueReport();_0x105ff0['name']=_0xea6188[_0xca61('0x68')];_0x105ff0[_0xca61('0x4e')]=this[_0xca61('0x14')][_0x105ff0[_0xca61('0x49')]]&&this[_0xca61('0x14')][_0x105ff0[_0xca61('0x49')]][_0xca61('0x4e')]?this[_0xca61('0x14')][_0x105ff0['name']]['type']||_0xca61('0x72'):_0xca61('0x72');_0x105ff0[_0xca61('0x68')]=_0xea6188[_0xca61('0x68')];_0x105ff0[_0xca61('0x73')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x105ff0[_0xca61('0x75')]=_0xea6188[_0xca61('0x75')];_0x105ff0[_0xca61('0x76')]=_0xea6188['count'];_0x105ff0[_0xca61('0x46')]=_0xea6188['uniqueid'];_0x105ff0['routealias']=this[_0xca61('0x12')][_0xea6188[_0xca61('0x46')]][_0xca61('0x77')];logger[_0xca61('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x105ff0[_0xca61('0x49')],_0x105ff0['type']);_[_0xca61('0x78')](_0x105ff0,_[_0xca61('0x79')](_0xea6188,_['keys'](_0x105ff0)));this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]][_0xca61('0x7a')](_0x105ff0);this[_0xca61('0x12')][_0xea6188['uniqueid']]=_0x105ff0;this[_0xca61('0x44')](_0x105ff0,'queuecallerjoin');}}catch(_0x30446a){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0xea6188[_0xca61('0x46')],util[_0xca61('0x3c')](_0x30446a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x1c')]=function(_0xffa920){try{if(this[_0xca61('0x61')](_0xffa920)){logger[_0xca61('0x69')](_0xca61('0x7b'),_0xffa920[_0xca61('0x46')],util['inspect'](_0xffa920,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0xffa920['uniqueid']]){var _0x467497=_[_0xca61('0x7c')](this['queueReports'][_0xffa920[_0xca61('0x46')]]);_0x467497[_0xca61('0x7d')]=![];_0x467497['queuecallercompleteAt']=null;_0x467497[_0xca61('0x7e')]=_0xffa920[_0xca61('0x7e')];_0x467497[_0xca61('0x7f')]=_0xffa920['originalposition'];_0x467497[_0xca61('0x1b')]=!![];_0x467497[_0xca61('0x80')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x467497[_0xca61('0x81')]='ABANDONED';_0x467497[_0xca61('0x82')]=null;logger[_0xca61('0x6a')](_0xca61('0x83'),_0x467497[_0xca61('0x49')],_0x467497[_0xca61('0x4e')]);this['channels'][_0xffa920[_0xca61('0x46')]]=_0x467497;this[_0xca61('0x41')](_0x467497,_0xca61('0x1b'));}}}catch(_0x94125a){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0xffa920[_0xca61('0x46')],util[_0xca61('0x3c')](_0x94125a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x1e')]=function(_0x53ca04){try{if(this[_0xca61('0x61')](_0x53ca04)){logger[_0xca61('0x69')](_0xca61('0x84'),_0x53ca04[_0xca61('0x46')],util[_0xca61('0x3c')](_0x53ca04,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x53ca04[_0xca61('0x46')]]){var _0x479853=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x53ca04['uniqueid']]);_0x479853[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x479853[_0xca61('0x86')]=_0x53ca04['connectedlinenum'];_0x479853[_0xca61('0x87')]=_0x53ca04[_0xca61('0x87')];logger[_0xca61('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x479853['name'],_0x479853[_0xca61('0x4e')],_0x53ca04[_0xca61('0x86')],_0x53ca04[_0xca61('0x87')]);this[_0xca61('0x12')][_0x53ca04['uniqueid']]=_0x479853;this['emitVoiceQueueChannelSave'](_0x479853,_0xca61('0x1d'));}}}catch(_0x102904){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerleave]',_0x53ca04[_0xca61('0x46')],util[_0xca61('0x3c')](_0x102904,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xca61('0x21')]=function(_0x47cd40){try{if(this[_0xca61('0x61')](_0x47cd40)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x47cd40[_0xca61('0x46')],util[_0xca61('0x3c')](_0x47cd40,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x47cd40['uniqueid']]){var _0x38bc67=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x47cd40['uniqueid']]);_0x38bc67[_0xca61('0x7d')]=!![];_0x38bc67[_0xca61('0x81')]=_0xca61('0x88');logger[_0xca61('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x38bc67[_0xca61('0x49')],_0x38bc67[_0xca61('0x4e')]);}}}catch(_0x5c9b72){logger[_0xca61('0x3b')](_0xca61('0x89'),_0x47cd40[_0xca61('0x46')],util[_0xca61('0x3c')](_0x5c9b72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')]['syncAgentComplete']=function(_0x140d33){try{if(this[_0xca61('0x61')](_0x140d33)){logger[_0xca61('0x69')](_0xca61('0x8a'),_0x140d33[_0xca61('0x46')],util[_0xca61('0x3c')](_0x140d33,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x140d33[_0xca61('0x46')]]){var _0x22dcb7=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x140d33['uniqueid']]);_0x22dcb7[_0xca61('0x1b')]=![];_0x22dcb7[_0xca61('0x80')]=null;_0x22dcb7[_0xca61('0x8b')]=!![];_0x22dcb7[_0xca61('0x82')]=_0x140d33[_0xca61('0x8c')];_0x22dcb7[_0xca61('0x7e')]=_0x140d33[_0xca61('0x7e')];_0x22dcb7['queuecallercomplete']=!![];_0x22dcb7['queuecallerexit']=![];_0x22dcb7[_0xca61('0x8d')]=null;if(!_0x22dcb7[_0xca61('0x8e')]){if(_0x140d33[_0xca61('0x8f')]=='transfer'){_0x22dcb7['queuecallerexitreason']=_0xca61('0x90');logger[_0xca61('0x6a')](_0xca61('0x91'),_0x22dcb7[_0xca61('0x49')],_0x22dcb7[_0xca61('0x4e')]);}else{if(_[_0xca61('0x92')](_0x140d33[_0xca61('0x93')][_0xca61('0x94')](),_0xca61('0x95'))){if(this[_0xca61('0x10')][_0x140d33['linkedid']]){var _0x5acb85=_['last'](this[_0xca61('0x10')][_0x140d33[_0xca61('0x96')]]);_0x5acb85['queuecallercomplete']=![];_0x5acb85[_0xca61('0x97')]=!![];_0x5acb85['queuecallerexitAt']=moment(_0x22dcb7['queuecallerjoinAt'])[_0xca61('0x98')](_0x140d33[_0xca61('0x7e')],_0xca61('0x99'))[_0xca61('0x47')](_0xca61('0x74'));_0x5acb85[_0xca61('0x81')]=_0xca61('0x9a');_0x5acb85[_0xca61('0x8e')]=!![];_0x5acb85['transfertype']=_0xca61('0x9b');_0x5acb85[_0xca61('0x9c')]=_0x140d33[_0xca61('0x9d')];_0x5acb85[_0xca61('0x9e')]=_0x140d33['uniqueid'];logger['info'](_0xca61('0x9f'),_0x5acb85[_0xca61('0x49')],_0x5acb85['type']);var _0x3877b4=this['queueReports'][_0x140d33[_0xca61('0x96')]];this[_0xca61('0x10')][_0x140d33[_0xca61('0x96')]]=this[_0xca61('0x10')][_0x140d33['uniqueid']];this['queueReports'][_0x140d33['uniqueid']]=_0x3877b4;}}else{_0x22dcb7['queuecallerexitreason']=_0xca61('0xa0')+_0x140d33[_0xca61('0x8f')][_0xca61('0xa1')]();logger[_0xca61('0x6a')](_0xca61('0xa2'),_0x22dcb7[_0xca61('0x49')],_0x22dcb7[_0xca61('0x4e')],_0x22dcb7[_0xca61('0x81')]);}}}this['channels'][_0x140d33[_0xca61('0x46')]]=_0x22dcb7;this['emitVoiceQueueChannelRemove'](_0x22dcb7,_0xca61('0x1f'));}}}catch(_0x27170a){logger[_0xca61('0x3b')](_0xca61('0x8a'),_0x140d33['uniqueid'],util[_0xca61('0x3c')](_0x27170a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x22')]=function(_0x252514){try{if(this[_0xca61('0x61')](_0x252514)){logger['debug']('[%s][voiceQueueReport][varset]',_0x252514[_0xca61('0x46')],util[_0xca61('0x3c')](_0x252514,{'showHidden':![],'depth':null}));this['addVariable'](_0x252514[_0xca61('0x46')],_['keys'](_0x252514[_0xca61('0xa3')])[0x0],_0x252514[_0xca61('0xa4')]);if(this[_0xca61('0x10')][_0x252514[_0xca61('0x46')]]){var _0x20f7f8=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x252514[_0xca61('0x46')]]);if(_0x20f7f8){if(this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')])&&this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')][_0xca61('0xa5')])){switch(_0x252514[_0xca61('0xa4')]){case _0xca61('0xa6'):_0x20f7f8[_0xca61('0x97')]=![];_0x20f7f8[_0xca61('0x8d')]=null;break;case _0xca61('0xa7'):_0x20f7f8[_0xca61('0xa8')]=_0xca61('0xa9');_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8['queuecallerleaveAt']=moment()[_0xca61('0x47')](_0xca61('0x74'));logger[_0xca61('0x69')](_0xca61('0xaa'),_0x252514[_0xca61('0x46')],util[_0xca61('0x3c')](_0x20f7f8,{'showHidden':![],'depth':null}));ami['emit'](_0xca61('0xab'),_0x20f7f8);break;default:_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20f7f8[_0xca61('0x1b')]=![];_0x20f7f8[_0xca61('0x80')]=null;_0x20f7f8[_0xca61('0x81')]=_0x252514[_0xca61('0xa4')];this['channels'][_0x252514[_0xca61('0x46')]]=_0x20f7f8;this[_0xca61('0x41')](_0x20f7f8,_0xca61('0xac'));}else if(this[_0xca61('0x61')](_0x252514['variable'])&&this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')][_0xca61('0xad')])){if(!_0x20f7f8[_0xca61('0x1b')]){_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8[_0xca61('0x81')]='EXITWITHKEY';_0x20f7f8[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xca61('0x12')][_0x252514[_0xca61('0x46')]]=_0x20f7f8;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x252514['uniqueid'],_0x20f7f8[_0xca61('0x49')],_0x20f7f8[_0xca61('0x4e')],_[_0xca61('0xae')](_0x252514[_0xca61('0xa3')])[0x0],_0x252514[_0xca61('0xa4')]);_0x20f7f8[_0xca61('0x16')]=this[_0xca61('0x16')][_0x252514[_0xca61('0x46')]];}}}}catch(_0x3228ce){logger['error'](_0xca61('0xaf'),_0x252514['uniqueid'],util['inspect'](_0x3228ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0xb0')]=function(_0x3c2bdf,_0x42c287,_0x495bdf){var _0x56abdd=[_0xca61('0xb1'),_0xca61('0xb2'),'rtpaudioqosjitter',_0xca61('0xb3'),_0xca61('0xb4'),'rtpaudioqoslossbridged',_0xca61('0xb5'),_0xca61('0xb6'),_0xca61('0xb7'),'sipuri','bridgepeer',_0xca61('0xb8'),'membercalls',_0xca61('0xb9'),_0xca61('0xba'),_0xca61('0xbb'),_0xca61('0x8c'),_0xca61('0xbc'),_0xca61('0xbd')];if(!_[_0xca61('0x36')](_0x42c287)&&!_[_0xca61('0xbe')](_0x56abdd,_0x42c287)){if(_[_0xca61('0x71')](this[_0xca61('0x16')][_0x3c2bdf])){this[_0xca61('0x16')][_0x3c2bdf]={};}this[_0xca61('0x16')][_0x3c2bdf][_0x42c287]=_0x495bdf;}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x24')]=function(_0x5ebc37){try{if(this['isNotNull'](_0x5ebc37)){logger[_0xca61('0x69')](_0xca61('0xbf'),_0x5ebc37[_0xca61('0x46')],util[_0xca61('0x3c')](_0x5ebc37,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x5ebc37[_0xca61('0x46')]]){for(var _0x20d5a5=0x0,_0x15e7d4={};_0x20d5a50x0?_0x47181a:0x0;this[_0x4a7a('0x13')][_0x1e832b[_0x4a7a('0x67')]]['talking']=this[_0x4a7a('0x13')][_0x1e832b['queue']][_0x4a7a('0x33')]>_[_0x4a7a('0x6c')](_0x1e832b[_0x4a7a('0x6e')])?_[_0x4a7a('0x6c')](_0x1e832b[_0x4a7a('0x6e')]):this[_0x4a7a('0x13')][_0x1e832b[_0x4a7a('0x67')]][_0x4a7a('0x33')];this['emitVoiceQueueSummary'](this[_0x4a7a('0x13')][_0x1e832b[_0x4a7a('0x67')]],_0x4a7a('0x16'));}logger[_0x4a7a('0x47')](_0x4a7a('0x6f'),util[_0x4a7a('0x3f')](this[_0x4a7a('0x13')][_0x1e832b[_0x4a7a('0x67')]],{'showHidden':![],'depth':null}));ami[_0x4a7a('0x45')](_0x4a7a('0x70'),this[_0x4a7a('0x13')][_0x1e832b[_0x4a7a('0x67')]]);}}}catch(_0x5db71a){logger[_0x4a7a('0x3d')](_0x4a7a('0x66'),util[_0x4a7a('0x3f')](_0x5db71a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')]['syncQueueSummaryComplete']=function(_0x2fb388){logger[_0x4a7a('0x47')](_0x4a7a('0x71'),util['inspect'](_0x2fb388,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0x4a7a('0x1b')]=function(_0x4e18c6){try{if(this['isNotNull'](_0x4e18c6)){logger[_0x4a7a('0x47')](_0x4a7a('0x72'),_0x4e18c6[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x4e18c6,{'showHidden':![],'depth':null}));if(_[_0x4a7a('0x73')](this[_0x4a7a('0x10')][_0x4e18c6[_0x4a7a('0x4d')]]))this[_0x4a7a('0x10')][_0x4e18c6['uniqueid']]=[];if(_[_0x4a7a('0x73')](this['channels'][_0x4e18c6[_0x4a7a('0x4d')]]))this[_0x4a7a('0x12')][_0x4e18c6[_0x4a7a('0x4d')]]={};var _0x329e14=new QueueReport();_0x329e14['name']=_0x4e18c6['queue'];_0x329e14['type']=this[_0x4a7a('0x13')][_0x329e14[_0x4a7a('0x4a')]]&&this[_0x4a7a('0x13')][_0x329e14[_0x4a7a('0x4a')]][_0x4a7a('0x50')]?this['voiceQueues'][_0x329e14['name']][_0x4a7a('0x50')]||_0x4a7a('0x51'):'inbound';_0x329e14[_0x4a7a('0x67')]=_0x4e18c6[_0x4a7a('0x67')];_0x329e14[_0x4a7a('0x74')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x329e14[_0x4a7a('0x76')]=_0x4e18c6[_0x4a7a('0x76')];_0x329e14[_0x4a7a('0x77')]=_0x4e18c6[_0x4a7a('0x77')];_0x329e14[_0x4a7a('0x4d')]=_0x4e18c6['uniqueid'];_0x329e14[_0x4a7a('0x78')]=this[_0x4a7a('0x12')][_0x4e18c6[_0x4a7a('0x4d')]][_0x4a7a('0x78')];logger[_0x4a7a('0x69')](_0x4a7a('0x79'),_0x329e14['name'],_0x329e14[_0x4a7a('0x50')]);_[_0x4a7a('0x7a')](_0x329e14,_['pick'](_0x4e18c6,_['keys'](_0x329e14)));this[_0x4a7a('0x10')][_0x4e18c6['uniqueid']][_0x4a7a('0x7b')](_0x329e14);this[_0x4a7a('0x12')][_0x4e18c6[_0x4a7a('0x4d')]]=_0x329e14;this['emitVoiceQueueChannelSave'](_0x329e14,_0x4a7a('0x7c'));}}catch(_0x564e01){logger[_0x4a7a('0x3d')](_0x4a7a('0x72'),_0x4e18c6['uniqueid'],util['inspect'](_0x564e01,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')][_0x4a7a('0x1d')]=function(_0x12d070){try{if(this[_0x4a7a('0x60')](_0x12d070)){logger[_0x4a7a('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x12d070[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x12d070,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12d070[_0x4a7a('0x4d')]]){var _0x38950d=_['last'](this[_0x4a7a('0x10')][_0x12d070[_0x4a7a('0x4d')]]);_0x38950d['queuecallercomplete']=![];_0x38950d[_0x4a7a('0x7d')]=null;_0x38950d[_0x4a7a('0x7e')]=_0x12d070[_0x4a7a('0x7e')];_0x38950d['originalposition']=_0x12d070[_0x4a7a('0x7f')];_0x38950d['queuecallerabandon']=!![];_0x38950d['queuecallerabandonAt']=moment()[_0x4a7a('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x38950d[_0x4a7a('0x80')]=_0x4a7a('0x81');_0x38950d[_0x4a7a('0x82')]=null;logger[_0x4a7a('0x69')](_0x4a7a('0x83'),_0x38950d[_0x4a7a('0x4a')],_0x38950d[_0x4a7a('0x50')]);this[_0x4a7a('0x12')][_0x12d070[_0x4a7a('0x4d')]]=_0x38950d;this[_0x4a7a('0x43')](_0x38950d,_0x4a7a('0x1c'));}}}catch(_0x1f3b45){logger[_0x4a7a('0x3d')](_0x4a7a('0x84'),_0x12d070['uniqueid'],util[_0x4a7a('0x3f')](_0x1f3b45,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')][_0x4a7a('0x1f')]=function(_0x248f77){try{if(this[_0x4a7a('0x60')](_0x248f77)){logger[_0x4a7a('0x47')](_0x4a7a('0x85'),_0x248f77[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x248f77,{'showHidden':![],'depth':null}));if(this[_0x4a7a('0x10')][_0x248f77['uniqueid']]){var _0x53199f=_['last'](this[_0x4a7a('0x10')][_0x248f77[_0x4a7a('0x4d')]]);_0x53199f[_0x4a7a('0x86')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x53199f['connectedlinenum']=_0x248f77[_0x4a7a('0x87')];_0x53199f[_0x4a7a('0x88')]=_0x248f77['connectedlinename'];logger[_0x4a7a('0x69')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x53199f[_0x4a7a('0x4a')],_0x53199f['type'],_0x248f77['connectedlinenum'],_0x248f77['connectedlinename']);this[_0x4a7a('0x12')][_0x248f77[_0x4a7a('0x4d')]]=_0x53199f;this[_0x4a7a('0x46')](_0x53199f,_0x4a7a('0x1e'));}}}catch(_0x1efce4){logger[_0x4a7a('0x3d')]('[%s][voiceQueueReport][queuecallerleave]',_0x248f77[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x1efce4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')]['syncAgentConnect']=function(_0xf34e4a){try{if(this[_0x4a7a('0x60')](_0xf34e4a)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0xf34e4a[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0xf34e4a,{'showHidden':![],'depth':null}));if(this[_0x4a7a('0x10')][_0xf34e4a[_0x4a7a('0x4d')]]){var _0x10cc14=_[_0x4a7a('0x89')](this[_0x4a7a('0x10')][_0xf34e4a[_0x4a7a('0x4d')]]);_0x10cc14['queuecallercomplete']=!![];_0x10cc14[_0x4a7a('0x80')]=_0x4a7a('0x8a');logger['info'](_0x4a7a('0x8b'),_0x10cc14[_0x4a7a('0x4a')],_0x10cc14['type']);}}}catch(_0xfa8478){logger[_0x4a7a('0x3d')](_0x4a7a('0x8c'),_0xf34e4a[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0xfa8478,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')][_0x4a7a('0x8d')]=function(_0x2016f7){try{if(this['isNotNull'](_0x2016f7)){logger['debug'](_0x4a7a('0x8e'),_0x2016f7[_0x4a7a('0x4d')],util['inspect'](_0x2016f7,{'showHidden':![],'depth':null}));if(this[_0x4a7a('0x10')][_0x2016f7[_0x4a7a('0x4d')]]){var _0x14083e=_[_0x4a7a('0x89')](this['queueReports'][_0x2016f7['uniqueid']]);_0x14083e[_0x4a7a('0x1c')]=![];_0x14083e[_0x4a7a('0x8f')]=null;_0x14083e[_0x4a7a('0x90')]=!![];_0x14083e[_0x4a7a('0x82')]=_0x2016f7[_0x4a7a('0x91')];_0x14083e['holdtime']=_0x2016f7[_0x4a7a('0x7e')];_0x14083e[_0x4a7a('0x92')]=!![];_0x14083e[_0x4a7a('0x93')]=![];_0x14083e[_0x4a7a('0x94')]=null;if(!_0x14083e['transfer']){if(_0x2016f7[_0x4a7a('0x95')]==_0x4a7a('0x96')){_0x14083e[_0x4a7a('0x80')]=_0x4a7a('0x97');logger[_0x4a7a('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x14083e[_0x4a7a('0x4a')],_0x14083e[_0x4a7a('0x50')]);}else{if(_[_0x4a7a('0x98')](_0x2016f7[_0x4a7a('0x99')]['toLowerCase'](),_0x4a7a('0x9a'))){if(this['queueReports'][_0x2016f7[_0x4a7a('0x9b')]]){var _0x4510cc=_[_0x4a7a('0x89')](this[_0x4a7a('0x10')][_0x2016f7['linkedid']]);_0x4510cc[_0x4a7a('0x92')]=![];_0x4510cc[_0x4a7a('0x93')]=!![];_0x4510cc[_0x4a7a('0x94')]=moment(_0x14083e[_0x4a7a('0x74')])[_0x4a7a('0x9c')](_0x2016f7[_0x4a7a('0x7e')],_0x4a7a('0x9d'))[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x4510cc[_0x4a7a('0x80')]=_0x4a7a('0x9e');_0x4510cc[_0x4a7a('0x96')]=!![];_0x4510cc[_0x4a7a('0x9f')]='FORWARD';_0x4510cc['transferexten']=_0x2016f7[_0x4a7a('0xa0')];_0x4510cc['transferuniqueid']=_0x2016f7[_0x4a7a('0x4d')];logger[_0x4a7a('0x69')](_0x4a7a('0xa1'),_0x4510cc['name'],_0x4510cc[_0x4a7a('0x50')]);var _0x2637af=this[_0x4a7a('0x10')][_0x2016f7[_0x4a7a('0x9b')]];this[_0x4a7a('0x10')][_0x2016f7[_0x4a7a('0x9b')]]=this[_0x4a7a('0x10')][_0x2016f7[_0x4a7a('0x4d')]];this['queueReports'][_0x2016f7[_0x4a7a('0x4d')]]=_0x2637af;}}else{_0x14083e[_0x4a7a('0x80')]='COMPLETEDBY'+_0x2016f7[_0x4a7a('0x95')][_0x4a7a('0xa2')]();logger[_0x4a7a('0x69')](_0x4a7a('0xa3'),_0x14083e[_0x4a7a('0x4a')],_0x14083e[_0x4a7a('0x50')],_0x14083e['queuecallerexitreason']);}}}this[_0x4a7a('0x12')][_0x2016f7[_0x4a7a('0x4d')]]=_0x14083e;this[_0x4a7a('0x43')](_0x14083e,_0x4a7a('0x20'));}}}catch(_0xbdd9ef){logger[_0x4a7a('0x3d')](_0x4a7a('0x8e'),_0x2016f7[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0xbdd9ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')]['syncVarSet']=function(_0x8408b3){try{if(this[_0x4a7a('0x60')](_0x8408b3)){logger[_0x4a7a('0x47')](_0x4a7a('0xa4'),_0x8408b3[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x8408b3,{'showHidden':![],'depth':null}));this['addVariable'](_0x8408b3[_0x4a7a('0x4d')],_[_0x4a7a('0xa5')](_0x8408b3[_0x4a7a('0xa6')])[0x0],_0x8408b3[_0x4a7a('0xa7')]);if(this['queueReports'][_0x8408b3[_0x4a7a('0x4d')]]){var _0x51f30c=_[_0x4a7a('0x89')](this[_0x4a7a('0x10')][_0x8408b3[_0x4a7a('0x4d')]]);if(_0x51f30c){if(this[_0x4a7a('0x60')](_0x8408b3[_0x4a7a('0xa6')])&&this[_0x4a7a('0x60')](_0x8408b3['variable'][_0x4a7a('0xa8')])){switch(_0x8408b3[_0x4a7a('0xa7')]){case _0x4a7a('0xa9'):_0x51f30c['queuecallerexit']=![];_0x51f30c[_0x4a7a('0x94')]=null;break;case _0x4a7a('0xaa'):_0x51f30c[_0x4a7a('0xab')]=_0x4a7a('0xac');_0x51f30c[_0x4a7a('0x93')]=!![];_0x51f30c['queuecallerexitAt']=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x51f30c['queuecallerleaveAt']=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));logger[_0x4a7a('0x47')](_0x4a7a('0xad'),_0x8408b3['uniqueid'],util[_0x4a7a('0x3f')](_0x51f30c,{'showHidden':![],'depth':null}));ami[_0x4a7a('0x45')]('custom:timeout',_0x51f30c);break;default:_0x51f30c[_0x4a7a('0x93')]=!![];_0x51f30c[_0x4a7a('0x94')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x51f30c[_0x4a7a('0x86')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));}_0x51f30c[_0x4a7a('0x1c')]=![];_0x51f30c[_0x4a7a('0x8f')]=null;_0x51f30c[_0x4a7a('0x80')]=_0x8408b3[_0x4a7a('0xa7')];this[_0x4a7a('0x12')][_0x8408b3[_0x4a7a('0x4d')]]=_0x51f30c;this[_0x4a7a('0x43')](_0x51f30c,_0x4a7a('0x23'));}else if(this[_0x4a7a('0x60')](_0x8408b3[_0x4a7a('0xa6')])&&this[_0x4a7a('0x60')](_0x8408b3[_0x4a7a('0xa6')][_0x4a7a('0xae')])){if(!_0x51f30c[_0x4a7a('0x1c')]){_0x51f30c[_0x4a7a('0x93')]=!![];_0x51f30c[_0x4a7a('0x94')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));_0x51f30c['queuecallerexitreason']=_0x4a7a('0xaf');_0x51f30c[_0x4a7a('0x86')]=moment()[_0x4a7a('0x49')](_0x4a7a('0x75'));this[_0x4a7a('0x12')][_0x8408b3[_0x4a7a('0x4d')]]=_0x51f30c;}}logger[_0x4a7a('0x69')](_0x4a7a('0xb0'),_0x8408b3['uniqueid'],_0x51f30c['name'],_0x51f30c[_0x4a7a('0x50')],_['keys'](_0x8408b3[_0x4a7a('0xa6')])[0x0],_0x8408b3[_0x4a7a('0xa7')]);_0x51f30c['variables']=this[_0x4a7a('0x15')][_0x8408b3[_0x4a7a('0x4d')]];}}}}catch(_0x504ab8){logger[_0x4a7a('0x3d')](_0x4a7a('0xa4'),_0x8408b3['uniqueid'],util[_0x4a7a('0x3f')](_0x504ab8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4a7a('0xb')][_0x4a7a('0xb1')]=function(_0x35c0e6,_0x349fce,_0x188ba2){var _0x4f2d7a=[_0x4a7a('0xb2'),_0x4a7a('0xb3'),_0x4a7a('0xb4'),'rtpaudioqosjitterbridged',_0x4a7a('0xb5'),_0x4a7a('0xb6'),_0x4a7a('0xb7'),'rtpaudioqosrttbridged',_0x4a7a('0xb8'),_0x4a7a('0xb9'),'bridgepeer','bridgepvtcallid',_0x4a7a('0xba'),'memberdynamic',_0x4a7a('0xbb'),_0x4a7a('0xbc'),_0x4a7a('0x91'),_0x4a7a('0xbd'),_0x4a7a('0xbe')];if(!_[_0x4a7a('0x39')](_0x349fce)&&!_[_0x4a7a('0xbf')](_0x4f2d7a,_0x349fce)){if(_[_0x4a7a('0x73')](this[_0x4a7a('0x15')][_0x35c0e6])){this[_0x4a7a('0x15')][_0x35c0e6]={};}this['variables'][_0x35c0e6][_0x349fce]=_0x188ba2;}};VoiceQueueReport[_0x4a7a('0xb')][_0x4a7a('0x25')]=function(_0x44a477){try{if(this[_0x4a7a('0x60')](_0x44a477)){logger[_0x4a7a('0x47')](_0x4a7a('0xc0'),_0x44a477[_0x4a7a('0x4d')],util[_0x4a7a('0x3f')](_0x44a477,{'showHidden':![],'depth':null}));if(this[_0x4a7a('0x10')][_0x44a477['uniqueid']]){for(var _0x32064b=0x0,_0x1ca586={};_0x32064b=0x0?moment(_0x5dee14['endtime'])[_0xb53a('0xd')](_0x5dee14[_0xb53a('0x16')],'seconds'):null,'data1':_0xb53a('0x19'),'data2':_0x5dee14[_0xb53a('0x12')],'data3':_0x5dee14[_0xb53a('0xf')],'data4':_0x5dee14[_0xb53a('0x1a')]||null,'role':_0xb53a('0x11'),'internal':_0x5dee14[_0xb53a('0x12')]?_[_0xb53a('0x13')](_0x5dee14[_0xb53a('0x12')]):undefined,'uniqueid':_0x5dee14[_0xb53a('0x14')]},'log':_0xb53a('0x5')});}; \ No newline at end of file +var _0x1df2=['exten','agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0x1df2,0xb3));var _0x21df=function(_0x1c6e48,_0x3bf212){_0x1c6e48=_0x1c6e48-0x0;var _0x3363ae=_0x1df2[_0x1c6e48];return _0x3363ae;};'use strict';var moment=require(_0x21df('0x0'));var _=require('lodash');var util=require(_0x21df('0x1'));var client=require(_0x21df('0x2'));exports[_0x21df('0x3')]=function(_0x333144){var _0x571c46=_0x333144[_0x21df('0x4')]||_0x333144['queuecallerexitAt'];return client[_0x21df('0x5')](_0x21df('0x6'),{'body':{'channel':_0x21df('0x7'),'membername':_0x333144[_0x21df('0x8')],'interface':_['isNil'](_0x333144['interface'])?util[_0x21df('0x9')](_0x21df('0xa'),_0x333144[_0x21df('0x8')]):_0x333144['interface'],'type':_0x21df('0xb'),'enterAt':_0x333144[_0x21df('0xc')],'exitAt':_0x571c46,'duration':moment(_0x571c46)[_0x21df('0xd')](_0x333144[_0x21df('0xc')],_0x21df('0xe')),'data1':_0x21df('0xf'),'data2':_0x333144[_0x21df('0x10')],'data3':_0x333144[_0x21df('0x11')],'data4':null,'data5':_0x333144['queue'],'role':_0x21df('0x12'),'internal':_0x333144['accountcode']?_[_0x21df('0x13')](_0x333144[_0x21df('0x14')]):undefined,'uniqueid':_0x333144[_0x21df('0x15')]},'log':_0x21df('0x6')});};exports[_0x21df('0x16')]=function(_0xa6c045){return client['Request'](_0x21df('0x6'),{'body':{'channel':_0x21df('0x7'),'membername':_0xa6c045[_0x21df('0x17')],'interface':_0xa6c045['interface'],'type':'TALKING','enterAt':_0xa6c045[_0x21df('0x18')],'exitAt':_0xa6c045[_0x21df('0x19')],'duration':moment(_0xa6c045[_0x21df('0x19')])[_0x21df('0xd')](_0xa6c045[_0x21df('0x18')],'seconds')>=0x0?moment(_0xa6c045[_0x21df('0x19')])[_0x21df('0xd')](_0xa6c045['starttime'],_0x21df('0xe')):null,'data1':_0x21df('0x1a'),'data2':_0xa6c045[_0x21df('0x14')],'data3':_0xa6c045[_0x21df('0x11')],'data4':_0xa6c045[_0x21df('0x1b')]||null,'role':_0x21df('0x12'),'internal':_0xa6c045[_0x21df('0x14')]?_['toNumber'](_0xa6c045[_0x21df('0x14')]):undefined,'uniqueid':_0xa6c045[_0x21df('0x15')]},'log':_0x21df('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 5f3d316..be09b49 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 _0x13cf=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0x13cf,0x11d));var _0xf13c=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x13cf[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0xf13c('0x0'));exports[_0xf13c('0x1')]=function(){return client[_0xf13c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf13c('0x3'),_0xf13c('0x4')]},'log':_0xf13c('0x5')});}; \ No newline at end of file +var _0x5a1c=['GetSettings','../client','getSettings','stopRecordingOnTransfer'];(function(_0x533d2a,_0x894b2c){var _0x3104c7=function(_0x128104){while(--_0x128104){_0x533d2a['push'](_0x533d2a['shift']());}};_0x3104c7(++_0x894b2c);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0xbb8f9d,_0xd54e40){_0xbb8f9d=_0xbb8f9d-0x0;var _0x2bdd0b=_0x5a1c[_0xbb8f9d];return _0x2bdd0b;};'use strict';var client=require(_0xc5a1('0x0'));exports[_0xc5a1('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5a1('0x2'),'previewRecallmeReminderInterval']},'log':_0xc5a1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 44e6338..f1659b2 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 _0x728e=['getTemplates','Request','html','GetTemplate','../client'];(function(_0x436fd5,_0x15b4a9){var _0x4bad21=function(_0x3da866){while(--_0x3da866){_0x436fd5['push'](_0x436fd5['shift']());}};_0x4bad21(++_0x15b4a9);}(_0x728e,0x153));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe728('0x0'));exports[_0xe728('0x1')]=function(_0x3ebcc6){return function(_0x22f903){return client[_0xe728('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xe728('0x3')]},'log':_0xe728('0x4')});};}; \ No newline at end of file +var _0x6cd8=['../client','getTemplates','GetTemplate','html'];(function(_0x5b2086,_0x3a6240){var _0x5919e1=function(_0x496b87){while(--_0x496b87){_0x5b2086['push'](_0x5b2086['shift']());}};_0x5919e1(++_0x3a6240);}(_0x6cd8,0x194));var _0x86cd=function(_0x5993b8,_0x182b45){_0x5993b8=_0x5993b8-0x0;var _0x43b1b8=_0x6cd8[_0x5993b8];return _0x43b1b8;};'use strict';var client=require(_0x86cd('0x0'));exports[_0x86cd('0x1')]=function(_0x290991){return function(_0x3ab361){return client['Request'](_0x86cd('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x86cd('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 36dc2b6..581ace0 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 _0x7de4=['GetTrigger','getTriggers','Request','name','Condition','AllConditions','field','value','AnyConditions','operator','data3','data4','data5','data6','data7'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x7de4,0x178));var _0x47de=function(_0x1d4288,_0x4da6aa){_0x1d4288=_0x1d4288-0x0;var _0x4e5cae=_0x7de4[_0x1d4288];return _0x4e5cae;};'use strict';var client=require('../client');exports[_0x47de('0x0')]=function(_0x8e8ffc){return function(_0x1353ec){return client[_0x47de('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x47de('0x2'),'channel','status'],'include':[{'model':_0x47de('0x3'),'as':_0x47de('0x4'),'attributes':['id',_0x47de('0x5'),'operator',_0x47de('0x6')]},{'model':_0x47de('0x3'),'as':_0x47de('0x7'),'attributes':['id','field',_0x47de('0x8'),_0x47de('0x6')]},{'model':'Action','as':'Actions','attributes':['id','action','data1','data2',_0x47de('0x9'),_0x47de('0xa'),_0x47de('0xb'),_0x47de('0xc'),_0x47de('0xd')]}]},'log':_0x47de('0xe')});};}; \ No newline at end of file +var _0x0b8f=['AllConditions','field','value','AnyConditions','operator','Action','Actions','action','data1','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x336ca3,_0x418a0d){var _0x507d25=function(_0x1d09fc){while(--_0x1d09fc){_0x336ca3['push'](_0x336ca3['shift']());}};_0x507d25(++_0x418a0d);}(_0x0b8f,0x1c1));var _0xf0b8=function(_0x323a10,_0x2ec60d){_0x323a10=_0x323a10-0x0;var _0x365a13=_0x0b8f[_0x323a10];return _0x365a13;};'use strict';var client=require('../client');exports[_0xf0b8('0x0')]=function(_0x33f523){return function(_0x29fe05){return client[_0xf0b8('0x1')](_0xf0b8('0x2'),{'options':{'raw':![],'attributes':['id',_0xf0b8('0x3'),_0xf0b8('0x4'),_0xf0b8('0x5')],'include':[{'model':_0xf0b8('0x6'),'as':_0xf0b8('0x7'),'attributes':['id',_0xf0b8('0x8'),'operator',_0xf0b8('0x9')]},{'model':'Condition','as':_0xf0b8('0xa'),'attributes':['id','field',_0xf0b8('0xb'),_0xf0b8('0x9')]},{'model':_0xf0b8('0xc'),'as':_0xf0b8('0xd'),'attributes':['id',_0xf0b8('0xe'),_0xf0b8('0xf'),'data2','data3','data4',_0xf0b8('0x10'),_0xf0b8('0x11'),_0xf0b8('0x12')]}]},'log':_0xf0b8('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index dd8aeac..c308c85 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 _0xa85d=['getTrunks','Request','defaultuser','GetTrunk','../client'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0xa85d,0x68));var _0xda85=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xa85d[_0x13ce0c];return _0x4388fb;};'use strict';var client=require(_0xda85('0x0'));exports[_0xda85('0x1')]=function(_0x3ac5c5){return function(_0x4c9d0a){return client[_0xda85('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xda85('0x3')]},'log':_0xda85('0x4')});};}; \ No newline at end of file +var _0x0b27=['getTrunks','Request','GetTrunk','defaultuser','../client'];(function(_0x1fcee6,_0x181474){var _0x1cc704=function(_0x4f28ca){while(--_0x4f28ca){_0x1fcee6['push'](_0x1fcee6['shift']());}};_0x1cc704(++_0x181474);}(_0x0b27,0xae));var _0x70b2=function(_0x209dd7,_0x5ddaa2){_0x209dd7=_0x209dd7-0x0;var _0x308b8c=_0x0b27[_0x209dd7];return _0x308b8c;};'use strict';var client=require(_0x70b2('0x0'));exports[_0x70b2('0x1')]=function(_0x6489c7){return function(_0x563ea5){return client[_0x70b2('0x2')](_0x70b2('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x70b2('0x4')]},'log':_0x70b2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index acc1e0d..2504c74 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x4e0cfe,_0x417a01){var _0x4d70b2=function(_0x28e871){while(--_0x28e871){_0x4e0cfe['push'](_0x4e0cfe['shift']());}};_0x4d70b2(++_0x417a01);}(_0xedd9,0xfc));var _0x9edd=function(_0x20aef1,_0x24a231){_0x20aef1=_0x20aef1-0x0;var _0x5a61e4=_0xedd9[_0x20aef1];return _0x5a61e4;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0f162cf..a1fbe1a 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 _0x17cb=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x545cb9,_0xc07f0e){var _0x4b37e2=function(_0x487388){while(--_0x487388){_0x545cb9['push'](_0x545cb9['shift']());}};_0x4b37e2(++_0xc07f0e);}(_0x17cb,0x14c));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb17c('0x0'));exports['create']=function(_0xce741d){return client[_0xb17c('0x1')](_0xb17c('0x2'),{'body':_0xce741d,'log':_0xb17c('0x2')});};exports[_0xb17c('0x3')]=function(_0x4f3d6b,_0x477769,_0x553253){return client['Request'](_0xb17c('0x4'),{'body':_0x4f3d6b,'options':{'where':{'uniqueid':_0x477769,'interface':_0x553253,'agentcomplete':!![]}},'log':_0xb17c('0x4')});}; \ No newline at end of file +var _0xc1d7=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client','create'];(function(_0xc28d8c,_0x5c11e4){var _0x1b106f=function(_0x5251b6){while(--_0x5251b6){_0xc28d8c['push'](_0xc28d8c['shift']());}};_0x1b106f(++_0x5c11e4);}(_0xc1d7,0xcb));var _0x7c1d=function(_0x372047,_0x7f5c2b){_0x372047=_0x372047-0x0;var _0x44f282=_0xc1d7[_0x372047];return _0x44f282;};'use strict';var client=require(_0x7c1d('0x0'));exports[_0x7c1d('0x1')]=function(_0x372342){return client['Request']('CreateVoiceAgentReport',{'body':_0x372342,'log':_0x7c1d('0x2')});};exports['update']=function(_0x3f2523,_0x43acfe,_0x5a0895){return client[_0x7c1d('0x3')](_0x7c1d('0x4'),{'body':_0x3f2523,'options':{'where':{'uniqueid':_0x43acfe,'interface':_0x5a0895,'agentcomplete':!![]}},'log':_0x7c1d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3c8d127..efaeb9d 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 _0x47c4=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','context','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x1bd19f,_0x51cf4d){var _0x4d25c4=function(_0x270912){while(--_0x270912){_0x1bd19f['push'](_0x1bd19f['shift']());}};_0x4d25c4(++_0x51cf4d);}(_0x47c4,0xdb));var _0x447c=function(_0x4d672c,_0x15a6e0){_0x4d672c=_0x4d672c-0x0;var _0x22dc61=_0x47c4[_0x4d672c];return _0x22dc61;};'use strict';var moment=require(_0x447c('0x0'));var util=require(_0x447c('0x1'));var _=require('lodash');var client=require('../client');exports[_0x447c('0x2')]=function(_0x3872ab){return client[_0x447c('0x3')](_0x447c('0x4'),{'body':_['merge'](_0x3872ab,{'source':_0x3872ab['calleridnum'],'destinationcontext':_0x3872ab[_0x447c('0x5')],'callerid':_0x3872ab['callerid'],'amaflags':_0x447c('0x6')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x447c('0x3')](_0x447c('0x7'),{'options':{'where':{'type':[_0x447c('0x8')],'createdAt':{'$between':[moment()[_0x447c('0x9')]('day')[_0x447c('0xa')](_0x447c('0xb')),moment()[_0x447c('0xc')](_0x447c('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x447c('0xe'),_0x447c('0xf'),_0x447c('0x10'),_0x447c('0x11')]},'log':_0x447c('0x12')});};}; \ No newline at end of file +var _0xe949=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe949,0x192));var _0x9e94=function(_0x21e45c,_0x58cb79){_0x21e45c=_0x21e45c-0x0;var _0x93e844=_0xe949[_0x21e45c];return _0x93e844;};'use strict';var moment=require(_0x9e94('0x0'));var util=require(_0x9e94('0x1'));var _=require(_0x9e94('0x2'));var client=require(_0x9e94('0x3'));exports[_0x9e94('0x4')]=function(_0x372a79){return client[_0x9e94('0x5')](_0x9e94('0x6'),{'body':_[_0x9e94('0x7')](_0x372a79,{'source':_0x372a79['calleridnum'],'destinationcontext':_0x372a79[_0x9e94('0x8')],'callerid':_0x372a79[_0x9e94('0x9')],'amaflags':_0x9e94('0xa')}),'log':_0x9e94('0x6')});};exports[_0x9e94('0xb')]=function(){return function(){return client[_0x9e94('0x5')](_0x9e94('0xc'),{'options':{'where':{'type':[_0x9e94('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x9e94('0xe'))[_0x9e94('0xf')](_0x9e94('0x10')),moment()[_0x9e94('0x11')](_0x9e94('0xe'))[_0x9e94('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x9e94('0x12'),'disposition',_0x9e94('0x13'),_0x9e94('0x14')]},'log':_0x9e94('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d93321a..110225d 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 _0xb0a0=['Request','../client','create'];(function(_0x2b65ac,_0x268f43){var _0x5cc58f=function(_0x4126cd){while(--_0x4126cd){_0x2b65ac['push'](_0x2b65ac['shift']());}};_0x5cc58f(++_0x268f43);}(_0xb0a0,0x1e4));var _0x0b0a=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xb0a0[_0x32b30c];return _0xcfc212;};'use strict';var client=require(_0x0b0a('0x0'));exports[_0x0b0a('0x1')]=function(_0x1cf8c1){return client[_0x0b0a('0x2')]('CreateVoiceDialReport',{'body':_0x1cf8c1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xa184=['Request','CreateVoiceDialReport'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xa184,0x130));var _0x4a18=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0xa184[_0x2ab365];return _0x49fef3;};'use strict';var client=require('../client');exports['create']=function(_0x5b09da){return client[_0x4a18('0x0')](_0x4a18('0x1'),{'body':_0x5b09da,'log':_0x4a18('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index fa512cc..117875e 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 _0x5eb1=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x1f16e2,_0x3b851f){var _0x38c370=function(_0x50b884){while(--_0x50b884){_0x1f16e2['push'](_0x1f16e2['shift']());}};_0x38c370(++_0x3b851f);}(_0x5eb1,0x7c));var _0x15eb=function(_0x4ddc7a,_0x5b6cb8){_0x4ddc7a=_0x4ddc7a-0x0;var _0x4547c1=_0x5eb1[_0x4ddc7a];return _0x4547c1;};'use strict';var client=require('../client');exports[_0x15eb('0x0')]=function(){return function(){return client[_0x15eb('0x1')](_0x15eb('0x2'),{'options':{'raw':!![],'attributes':['id',_0x15eb('0x3'),_0x15eb('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x15eb('0x0')});};}; \ No newline at end of file +var _0x58e5=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x41c5a6,_0x5310f1){var _0x1aa3f8=function(_0x3ca8ad){while(--_0x3ca8ad){_0x41c5a6['push'](_0x41c5a6['shift']());}};_0x1aa3f8(++_0x5310f1);}(_0x58e5,0xd1));var _0x558e=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x58e5[_0x2e4e19];return _0x9ba20b;};'use strict';var client=require(_0x558e('0x0'));exports[_0x558e('0x1')]=function(){return function(){return client[_0x558e('0x2')](_0x558e('0x3'),{'options':{'raw':!![],'attributes':['id',_0x558e('0x4'),_0x558e('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ff9fdcd..1222224 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 _0x167b=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x5e1f45,_0x3bfbcc){var _0x13cb83=function(_0x3b2f5d){while(--_0x3b2f5d){_0x5e1f45['push'](_0x5e1f45['shift']());}};_0x13cb83(++_0x3bfbcc);}(_0x167b,0x1bb));var _0xb167=function(_0xfc3d39,_0x46cd30){_0xfc3d39=_0xfc3d39-0x0;var _0x5deb87=_0x167b[_0xfc3d39];return _0x5deb87;};'use strict';var client=require(_0xb167('0x0'));exports[_0xb167('0x1')]=function(){return function(){return client[_0xb167('0x2')](_0xb167('0x3'),{'options':{'raw':![],'attributes':['id',_0xb167('0x4'),'acw',_0xb167('0x5'),_0xb167('0x6'),_0xb167('0x7'),'type',_0xb167('0x8'),_0xb167('0x9'),_0xb167('0xa'),_0xb167('0xb'),'dialPowerLevel',_0xb167('0xc'),_0xb167('0xd'),_0xb167('0xe'),_0xb167('0xf'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0xb167('0x10'),_0xb167('0x11'),'dialCongestionMaxRetry',_0xb167('0x12'),_0xb167('0x13'),_0xb167('0x14'),_0xb167('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xb167('0x16'),_0xb167('0x17'),'dialPrefix','dialCheckDuplicateType',_0xb167('0x18'),_0xb167('0x19'),_0xb167('0x1a'),'dialAMDAfterGreetingSilence',_0xb167('0x1b'),_0xb167('0x1c'),_0xb167('0x1d'),_0xb167('0x1e'),'dialAMDSilenceThreshold',_0xb167('0x1f'),_0xb167('0x20'),_0xb167('0x21'),_0xb167('0x22'),'dialOrderByScheduledAt',_0xb167('0x23'),'dialAgiAfterHangupClient',_0xb167('0x24'),_0xb167('0x7'),_0xb167('0x25'),_0xb167('0x26'),_0xb167('0x27'),_0xb167('0x28'),_0xb167('0x29'),_0xb167('0x2a'),'dialDropRetryFrequency',_0xb167('0x2b'),_0xb167('0x2c'),_0xb167('0x2d'),_0xb167('0x2e'),_0xb167('0x2f'),_0xb167('0x30'),_0xb167('0x31'),'dialPredictiveIntervalMaxThreshold',_0xb167('0x32'),_0xb167('0x33'),_0xb167('0x34')],'include':[{'model':_0xb167('0x35'),'as':_0xb167('0x35'),'attributes':['id',_0xb167('0x4'),_0xb167('0x36'),_0xb167('0x37')]},{'model':_0xb167('0x38'),'as':_0xb167('0x39'),'attributes':['id',_0xb167('0x4')]},{'model':_0xb167('0x35'),'as':'TrunkBackup','attributes':['id',_0xb167('0x4'),_0xb167('0x36'),'active']},{'model':_0xb167('0x3a'),'as':_0xb167('0x3a'),'attributes':['id',_0xb167('0x4')],'include':[{'model':'Interval','as':_0xb167('0x3b'),'attributes':['id','name',_0xb167('0x3c')]}]}]},'log':_0xb167('0x1')});};}; \ No newline at end of file +var _0x4603=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x33ac30,_0x51056f){var _0x118992=function(_0x11167d){while(--_0x11167d){_0x33ac30['push'](_0x33ac30['shift']());}};_0x118992(++_0x51056f);}(_0x4603,0x1a3));var _0x3460=function(_0x5166f9,_0x5aaf46){_0x5166f9=_0x5166f9-0x0;var _0x561bf3=_0x4603[_0x5166f9];return _0x561bf3;};'use strict';var client=require('../client');exports[_0x3460('0x0')]=function(){return function(){return client[_0x3460('0x1')](_0x3460('0x2'),{'options':{'raw':![],'attributes':['id',_0x3460('0x3'),_0x3460('0x4'),_0x3460('0x5'),_0x3460('0x6'),'monitor_format','type',_0x3460('0x7'),_0x3460('0x8'),_0x3460('0x9'),_0x3460('0xa'),_0x3460('0xb'),_0x3460('0xc'),'dialPredictiveOptimizationPercentage',_0x3460('0xd'),_0x3460('0xe'),_0x3460('0xf'),_0x3460('0x10'),_0x3460('0x11'),_0x3460('0x12'),_0x3460('0x13'),_0x3460('0x14'),_0x3460('0x15'),_0x3460('0x16'),_0x3460('0x17'),_0x3460('0x18'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x3460('0x19'),_0x3460('0x1a'),_0x3460('0x1b'),'dialCheckDuplicateType',_0x3460('0x1c'),_0x3460('0x1d'),_0x3460('0x1e'),_0x3460('0x1f'),_0x3460('0x20'),_0x3460('0x21'),_0x3460('0x22'),_0x3460('0x23'),_0x3460('0x24'),_0x3460('0x25'),_0x3460('0x26'),_0x3460('0x27'),_0x3460('0x28'),_0x3460('0x29'),_0x3460('0x2a'),_0x3460('0x2b'),_0x3460('0x2c'),_0x3460('0x2d'),_0x3460('0x2e'),_0x3460('0x2f'),'dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x3460('0x30'),_0x3460('0x31'),_0x3460('0x32'),_0x3460('0x33'),_0x3460('0x34'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x3460('0x35'),_0x3460('0x36'),_0x3460('0x37'),_0x3460('0x38'),_0x3460('0x39'),_0x3460('0x3a')],'include':[{'model':'Trunk','as':_0x3460('0x3b'),'attributes':['id','name',_0x3460('0x3c'),'active']},{'model':_0x3460('0x3d'),'as':_0x3460('0x3e'),'attributes':['id',_0x3460('0x3')]},{'model':_0x3460('0x3b'),'as':_0x3460('0x3f'),'attributes':['id',_0x3460('0x3'),_0x3460('0x3c'),_0x3460('0x40')]},{'model':_0x3460('0x41'),'as':_0x3460('0x41'),'attributes':['id',_0x3460('0x3')],'include':[{'model':_0x3460('0x41'),'as':_0x3460('0x42'),'attributes':['id',_0x3460('0x3'),'interval']}]}]},'log':_0x3460('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 246b5ae..4f7c8c7 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(_0x1e2349,_0x4da941){var _0x49bb8e=function(_0x2443f5){while(--_0x2443f5){_0x1e2349['push'](_0x1e2349['shift']());}};_0x49bb8e(++_0x4da941);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x3a9b53,_0x30b0be){var _0xc4154a=function(_0x2df8cd){while(--_0x2df8cd){_0x3a9b53['push'](_0x3a9b53['shift']());}};_0xc4154a(++_0x30b0be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 bad2e71..30d4511 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 _0x05b6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x05b6,0xb0));var _0x605b=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x05b6[_0x9edfd5];return _0x330738;};'use strict';var client=require(_0x605b('0x0'));exports[_0x605b('0x1')]=function(_0x5e8d96){return function(){return client[_0x605b('0x2')](_0x605b('0x3'),{'options':{'where':{'VoiceQueueId':_0x5e8d96,'paused':!![]},'raw':!![]},'log':_0x605b('0x1')});};}; \ No newline at end of file +var _0x4d9e=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4d9e,0x1c8));var _0xe4d9=function(_0x5976bf,_0x23e148){_0x5976bf=_0x5976bf-0x0;var _0x576bf9=_0x4d9e[_0x5976bf];return _0x576bf9;};'use strict';var client=require(_0xe4d9('0x0'));exports[_0xe4d9('0x1')]=function(_0x44c32c){return function(){return client[_0xe4d9('0x2')](_0xe4d9('0x3'),{'options':{'where':{'VoiceQueueId':_0x44c32c,'paused':!![]},'raw':!![]},'log':_0xe4d9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bbbfd35..cf9da3d 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x25540b,_0xd5ea7a){var _0x516594=function(_0x238af3){while(--_0x238af3){_0x25540b['push'](_0x25540b['shift']());}};_0x516594(++_0xd5ea7a);}(_0x7a54,0x106));var _0x47a5=function(_0x632b94,_0x257e2f){_0x632b94=_0x632b94-0x0;var _0x17174d=_0x7a54[_0x632b94];return _0x17174d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4da073,_0x4f073c){var _0x1e1867=function(_0x34861b){while(--_0x34861b){_0x4da073['push'](_0x4da073['shift']());}};_0x1e1867(++_0x4f073c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b32d254..ff510ba 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 _0x1da5=['origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x78f30c,_0x1c1190){var _0x405bf8=function(_0x178d5a){while(--_0x178d5a){_0x78f30c['push'](_0x78f30c['shift']());}};_0x405bf8(++_0x1c1190);}(_0x1da5,0xd9));var _0x51da=function(_0x5b9b95,_0x2ffa51){_0x5b9b95=_0x5b9b95-0x0;var _0x584e72=_0x1da5[_0x5b9b95];return _0x584e72;};'use strict';var client=require(_0x51da('0x0'));exports[_0x51da('0x1')]={};exports[_0x51da('0x2')]=function(_0x18e659){return client[_0x51da('0x3')](_0x51da('0x4'),{'body':{'result':_0x18e659[_0x51da('0x5')],'transfererchannel':_0x18e659[_0x51da('0x6')],'transferercalleridnum':_0x18e659[_0x51da('0x7')],'transferercalleridname':_0x18e659[_0x51da('0x8')],'transfererconnectedlinenum':_0x18e659[_0x51da('0x9')],'transfererconnectedlinename':_0x18e659[_0x51da('0xa')],'transfereraccountcode':_0x18e659[_0x51da('0xb')],'transferercontext':_0x18e659[_0x51da('0xc')],'transfererexten':_0x18e659['transfererexten'],'transfererlinkedid':_0x18e659[_0x51da('0xd')],'transfereechannel':_0x18e659['transfereechannel'],'transfereecalleridnum':_0x18e659[_0x51da('0xe')],'transfereecalleridname':_0x18e659['transfereecalleridname'],'transfereeconnectedlinenum':_0x18e659[_0x51da('0xf')],'transfereeconnectedlinename':_0x18e659['transfereeconnectedlinename'],'transfereeaccountcode':_0x18e659[_0x51da('0x10')],'transfereecontext':_0x18e659[_0x51da('0x11')],'transfereeexten':_0x18e659[_0x51da('0x12')],'transfereelinkedid':_0x18e659[_0x51da('0x13')],'isexternal':_0x18e659[_0x51da('0x14')],'context':_0x18e659['context'],'extension':_0x18e659[_0x51da('0x15')],'type':_0x51da('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x3b0387){return client[_0x51da('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3b0387[_0x51da('0x5')],'transfererchannel':_0x3b0387[_0x51da('0x17')],'transferercalleridnum':_0x3b0387['origtransferercalleridnum'],'transferercalleridname':_0x3b0387['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b0387[_0x51da('0x18')],'transfererconnectedlinename':_0x3b0387[_0x51da('0x19')],'transfereraccountcode':_0x3b0387[_0x51da('0x1a')],'transferercontext':_0x3b0387[_0x51da('0x1b')],'transfererexten':_0x3b0387[_0x51da('0x1c')],'transfererlinkedid':_0x3b0387[_0x51da('0x1d')],'transfereechannel':_0x3b0387[_0x51da('0x1e')],'transfereecalleridnum':_0x3b0387[_0x51da('0x1f')],'transfereecalleridname':_0x3b0387[_0x51da('0x20')],'transfereeconnectedlinenum':_0x3b0387[_0x51da('0x21')],'transfereeconnectedlinename':_0x3b0387[_0x51da('0x22')],'transfereeaccountcode':_0x3b0387[_0x51da('0x23')],'transfereecontext':_0x3b0387[_0x51da('0x24')],'transfereeexten':_0x3b0387['transfertargetexten'],'transfereelinkedid':_0x3b0387[_0x51da('0x25')],'isexternal':_0x3b0387[_0x51da('0x14')],'context':_0x3b0387[_0x51da('0x26')],'extension':_0x3b0387[_0x51da('0x27')],'type':_0x51da('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x8882=['transfertargetconnectedlinename','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x1e7a92,_0x1b4f46){var _0x55adfb=function(_0x562d44){while(--_0x562d44){_0x1e7a92['push'](_0x1e7a92['shift']());}};_0x55adfb(++_0x1b4f46);}(_0x8882,0xb9));var _0x2888=function(_0x58fff4,_0xbd86b2){_0x58fff4=_0x58fff4-0x0;var _0x5670bc=_0x8882[_0x58fff4];return _0x5670bc;};'use strict';var client=require(_0x2888('0x0'));exports[_0x2888('0x1')]={};exports[_0x2888('0x2')]=function(_0x1d4aa3){return client[_0x2888('0x3')](_0x2888('0x4'),{'body':{'result':_0x1d4aa3['result'],'transfererchannel':_0x1d4aa3[_0x2888('0x5')],'transferercalleridnum':_0x1d4aa3[_0x2888('0x6')],'transferercalleridname':_0x1d4aa3['transferercalleridname'],'transfererconnectedlinenum':_0x1d4aa3[_0x2888('0x7')],'transfererconnectedlinename':_0x1d4aa3[_0x2888('0x8')],'transfereraccountcode':_0x1d4aa3['transfereraccountcode'],'transferercontext':_0x1d4aa3[_0x2888('0x9')],'transfererexten':_0x1d4aa3[_0x2888('0xa')],'transfererlinkedid':_0x1d4aa3['transfererlinkedid'],'transfereechannel':_0x1d4aa3[_0x2888('0xb')],'transfereecalleridnum':_0x1d4aa3[_0x2888('0xc')],'transfereecalleridname':_0x1d4aa3[_0x2888('0xd')],'transfereeconnectedlinenum':_0x1d4aa3[_0x2888('0xe')],'transfereeconnectedlinename':_0x1d4aa3[_0x2888('0xf')],'transfereeaccountcode':_0x1d4aa3[_0x2888('0x10')],'transfereecontext':_0x1d4aa3[_0x2888('0x11')],'transfereeexten':_0x1d4aa3['transfereeexten'],'transfereelinkedid':_0x1d4aa3[_0x2888('0x12')],'isexternal':_0x1d4aa3[_0x2888('0x13')],'context':_0x1d4aa3[_0x2888('0x14')],'extension':_0x1d4aa3['extension'],'type':_0x2888('0x15')},'log':_0x2888('0x4')});};exports[_0x2888('0x16')]=function(_0x536024){return client['Request'](_0x2888('0x4'),{'body':{'result':_0x536024['result'],'transfererchannel':_0x536024['origtransfererchannel'],'transferercalleridnum':_0x536024['origtransferercalleridnum'],'transferercalleridname':_0x536024[_0x2888('0x17')],'transfererconnectedlinenum':_0x536024[_0x2888('0x18')],'transfererconnectedlinename':_0x536024['secondtransfererconnectedlinename'],'transfereraccountcode':_0x536024[_0x2888('0x19')],'transferercontext':_0x536024[_0x2888('0x1a')],'transfererexten':_0x536024[_0x2888('0x1b')],'transfererlinkedid':_0x536024[_0x2888('0x1c')],'transfereechannel':_0x536024['transfertargetchannel'],'transfereecalleridnum':_0x536024['transfertargetcalleridnum'],'transfereecalleridname':_0x536024[_0x2888('0x1d')],'transfereeconnectedlinenum':_0x536024[_0x2888('0x1e')],'transfereeconnectedlinename':_0x536024[_0x2888('0x1f')],'transfereeaccountcode':_0x536024['transfertargetaccountcode'],'transfereecontext':_0x536024['transfertargetcontext'],'transfereeexten':_0x536024['transfertargetexten'],'transfereelinkedid':_0x536024[_0x2888('0x20')],'isexternal':_0x536024[_0x2888('0x13')],'context':_0x536024[_0x2888('0x21')],'extension':_0x536024[_0x2888('0x22')],'type':_0x2888('0x23')},'log':_0x2888('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3c19b5d..19ea843 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 _0xcaf2=['lodash','jayson/promise','validate','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','username','join','pick','keys','module','Reload','then','catch','error','message','asterisk','ami\x20disconnected','command','action','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','run','event','emit','faxAccounts','send','checkAfterSend','http','listen','127.0.0.1','RPC\x20listening\x20on\x20port:'];(function(_0x49eac2,_0x289d4f){var _0x47d127=function(_0x502479){while(--_0x502479){_0x49eac2['push'](_0x49eac2['shift']());}};_0x47d127(++_0x289d4f);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0xcaf2[_0x3e4285];return _0xce09e7;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var jayson=require(_0x2caf('0x1'));var schema=require(_0x2caf('0x2'));var BPromise=require('bluebird');var moment=require(_0x2caf('0x3'));var config=require(_0x2caf('0x4'));var properties=require('../properties');var ami=require(_0x2caf('0x5'));exports['listen']=function(_0x335e3c,_0xae320c,_0x249a4b){return new BPromise(function(_0x599ce7,_0xc44e4e){var _0x314486={'QueuePause':function(_0x4667c6){return new Promise(function(_0x34e792,_0x5611aa){var _0x4050ab=util[_0x2caf('0x6')](_0x2caf('0x7'),_0x2caf('0x8'),_0x4667c6[_0x2caf('0x9')]);if(_0x335e3c[_0x2caf('0xa')]&&_0x335e3c[_0x2caf('0xa')][_0x4050ab]&&_0x335e3c[_0x2caf('0xa')][_0x4050ab][_0x2caf('0xb')]){_0x335e3c['timers'][_0x4050ab][_0x2caf('0xc')]();}if(_0x335e3c[_0x2caf('0xd')][_0x4050ab]){_0x335e3c[_0x2caf('0xd')][_0x4050ab][_0x2caf('0xe')]({'statePause':_0x4667c6[_0x2caf('0xf')]?!![]:![]});}_0x34e792({'code':0xc8,'message':_0x2caf('0x10')});});},'Reload':function(_0x252147){var _0x3b2e0a=this;return new Promise(function(_0x5106fd,_0x7258b1){if(ami[_0x2caf('0x11')]()==![]){return _0x7258b1(_0x3b2e0a['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2caf('0x12')],'ami\x20disconnected'][_0x2caf('0x13')]('\x20')));}_0x252147=_[_0x2caf('0x14')](_0x252147,_[_0x2caf('0x15')](properties[_0x2caf('0x16')]));_0x252147['action']=_0x2caf('0x17');return ami['Action'](_0x252147)[_0x2caf('0x18')](function(_0x57f3cd){_0x5106fd({'code':0xc8,'message':_0x57f3cd['message']});})[_0x2caf('0x19')](function(_0x58047b){_0x7258b1(_0x3b2e0a[_0x2caf('0x1a')](0x1f5,_0x58047b[_0x2caf('0x1b')]));});});},'Command':function(_0x5c5d98){var _0x12624b=this;return new Promise(function(_0x1eeb76,_0x6b3778){if(ami[_0x2caf('0x11')]()==![]){return _0x6b3778(_0x12624b[_0x2caf('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}_0x5c5d98=_[_0x2caf('0x14')](_0x5c5d98,_0x2caf('0x1e'));_0x5c5d98[_0x2caf('0x1f')]=_0x2caf('0x20');return ami[_0x2caf('0x21')](_0x5c5d98)[_0x2caf('0x18')](function(_0x6814bc){_0x1eeb76({'code':0xc8,'message':_0x6814bc['content']});})[_0x2caf('0x19')](function(_0x14bfd2){_0x6b3778(_0x12624b[_0x2caf('0x1a')](0x1f5,_0x14bfd2[_0x2caf('0x1b')]));});});},'VoiceQueues':function(_0x3efa4e){return new Promise(function(_0x25ebea,_0x392196){var _0x164da=[];for(var _0x2e0a75 in _0x335e3c[_0x2caf('0x22')]){if(_0x335e3c['voiceQueues'][_0x2caf('0x23')](_0x2e0a75)){var _0x325eda=_0x335e3c[_0x2caf('0x22')][_0x2e0a75];var _0x37b08f={'id':_0x325eda['id'],'name':_0x325eda[_0x2caf('0x9')],'strategy':_0x325eda[_0x2caf('0x24')],'answered':_0x325eda[_0x2caf('0x25')],'available':_0x325eda[_0x2caf('0x26')],'loggedIn':_0x325eda[_0x2caf('0x27')],'pTalking':_0x325eda[_0x2caf('0x28')],'sumBillable':_0x325eda[_0x2caf('0x29')],'sumDuration':_0x325eda[_0x2caf('0x2a')],'sumHoldTime':_0x325eda[_0x2caf('0x2b')]||0x0,'talking':_0x325eda['talking'],'total':_0x325eda[_0x2caf('0x2c')],'type':_0x325eda[_0x2caf('0x2d')],'unmanaged':_0x325eda[_0x2caf('0x2e')],'abandoned':_0x325eda[_0x2caf('0x2f')],'waiting':_0x325eda[_0x2caf('0x30')],'loggedInDb':_0x325eda[_0x2caf('0x31')]};if(_0x325eda[_0x2caf('0x2d')]==='outbound'){_0x37b08f[_0x2caf('0x32')]=_0x325eda[_0x2caf('0x32')];_0x37b08f['dialMethod']=_0x325eda[_0x2caf('0x33')];_0x37b08f[_0x2caf('0x34')]=_0x325eda[_0x2caf('0x34')];_0x37b08f['dialOriginateCallerIdNumber']=_0x325eda[_0x2caf('0x35')];_0x37b08f['dialOriginateTimeout']=_0x325eda['dialOriginateTimeout'];_0x37b08f[_0x2caf('0x36')]=_0x325eda[_0x2caf('0x36')];_0x37b08f[_0x2caf('0x37')]=_0x325eda[_0x2caf('0x37')];_0x37b08f[_0x2caf('0x38')]=_0x325eda[_0x2caf('0x38')];_0x37b08f[_0x2caf('0x39')]=_0x325eda[_0x2caf('0x39')];_0x37b08f[_0x2caf('0x3a')]=_0x325eda['outboundBlacklistCallsDay'];_0x37b08f[_0x2caf('0x3b')]=_0x325eda[_0x2caf('0x3b')];_0x37b08f[_0x2caf('0x3c')]=_0x325eda[_0x2caf('0x3c')];_0x37b08f[_0x2caf('0x3d')]=_0x325eda[_0x2caf('0x3d')];_0x37b08f[_0x2caf('0x3e')]=_0x325eda[_0x2caf('0x3e')];_0x37b08f[_0x2caf('0x3f')]=_0x325eda[_0x2caf('0x3f')];_0x37b08f[_0x2caf('0x40')]=_0x325eda[_0x2caf('0x40')];_0x37b08f['outboundNoSuchCallsDay']=_0x325eda['outboundNoSuchCallsDay'];_0x37b08f[_0x2caf('0x41')]=_0x325eda[_0x2caf('0x41')];_0x37b08f[_0x2caf('0x42')]=_0x325eda[_0x2caf('0x42')];_0x37b08f['outboundRejectCallsDay']=_0x325eda[_0x2caf('0x43')];_0x37b08f[_0x2caf('0x44')]=_0x325eda[_0x2caf('0x44')];_0x37b08f[_0x2caf('0x45')]=_0x325eda[_0x2caf('0x45')];_0x37b08f[_0x2caf('0x46')]=_0x325eda[_0x2caf('0x46')];_0x37b08f[_0x2caf('0x47')]=_0x325eda['predictiveIntervalAvgTalktime'];_0x37b08f['predictiveIntervalDroppedCallsCallersExit']=_0x325eda[_0x2caf('0x48')];_0x37b08f[_0x2caf('0x49')]=_0x325eda[_0x2caf('0x49')];_0x37b08f[_0x2caf('0x4a')]=_0x325eda[_0x2caf('0x4a')];_0x37b08f[_0x2caf('0x4b')]=_0x325eda[_0x2caf('0x4b')];_0x37b08f[_0x2caf('0x4c')]=_0x325eda[_0x2caf('0x4c')];_0x37b08f[_0x2caf('0x4d')]=_0x325eda[_0x2caf('0x4d')];_0x37b08f['predictiveIntervalPauses']=_0x325eda[_0x2caf('0x4e')];_0x37b08f[_0x2caf('0x4f')]=_0x325eda[_0x2caf('0x4f')];_0x37b08f['predictiveIntervalTotalCalls']=_0x325eda[_0x2caf('0x50')];_0x37b08f[_0x2caf('0x1b')]=_0x325eda[_0x2caf('0x1b')];_0x37b08f['originated']=_0x325eda[_0x2caf('0x51')];_0x37b08f[_0x2caf('0x52')]=_0x325eda['erlangCalls'];_0x37b08f[_0x2caf('0x53')]=_0x325eda[_0x2caf('0x53')];_0x37b08f['erlangAbandonmentRate']=_0x325eda[_0x2caf('0x54')];_0x37b08f[_0x2caf('0x55')]=_0x325eda[_0x2caf('0x55')];_0x37b08f[_0x2caf('0x56')]=_0x325eda[_0x2caf('0x56')];_0x37b08f[_0x2caf('0x57')]=_0x325eda[_0x2caf('0x57')];}if(_0x325eda[_0x2caf('0x58')]){_0x37b08f['Trunk']={'id':_0x325eda[_0x2caf('0x58')]['id'],'name':_0x325eda['Trunk'][_0x2caf('0x9')],'active':_0x325eda[_0x2caf('0x58')][_0x2caf('0x59')],'callerid':_0x325eda['Trunk']['callerid']};}if(_0x325eda[_0x2caf('0x5a')]){_0x37b08f['Interval']={'id':_0x325eda[_0x2caf('0x5a')]['id'],'name':_0x325eda[_0x2caf('0x5a')][_0x2caf('0x9')]};}_0x164da[_0x2caf('0x5b')](_0x37b08f);}}_0x25ebea({'count':_0x164da[_0x2caf('0x5c')],'rows':_0x164da});});},'UpdateVoiceQueue':function(_0x334cfa){return new Promise(function(_0x18dc5b,_0x61ca34){var _0x100681=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x22')],{'id':parseInt(_0x334cfa['id'])});var _0x319452=_[_0x2caf('0x5e')](_0x334cfa,['id']);if(_0x100681){for(var _0x9a62bd in _0x319452){if(typeof _0x319452[_0x9a62bd]!==_0x2caf('0x5f')&&typeof _0x100681[_0x9a62bd]!==_0x2caf('0x5f')){_0x100681[_0x9a62bd]=_0x319452[_0x9a62bd];}}_0x18dc5b(_0x100681);}else{_0x61ca34();}});},'VoiceChannels':function(_0x123bab){return new Promise(function(_0x1e691a,_0x36fb19){var _0x3a598b=_[_0x2caf('0x60')](_0x335e3c['channels']);_0x1e691a({'count':_0x3a598b[_0x2caf('0x5c')],'rows':_0x3a598b});});},'VoiceChannelMixMonitor':function(_0x17ea46){var _0x4fe096=this;return new Promise(function(_0x589c57,_0x44bca0){if(ami[_0x2caf('0x11')]()==![]){return _0x44bca0(_0x4fe096['error'](0x1f4,[config[_0x2caf('0x1c')]['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0xb69a31=schema(properties[_0x2caf('0x61')])[_0x2caf('0x2')](_0x17ea46);if(_0xb69a31[_0x2caf('0x5c')]>0x0){return _0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f4,_[_0x2caf('0x62')](_0xb69a31,_0x2caf('0x1b'))[_0x2caf('0x13')](',\x20')));}var _0x5b8d66=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x63')],{'uniqueid':_0x17ea46[_0x2caf('0x64')]});if(_0x5b8d66&&_0x5b8d66['channel']){var _0x473188=util[_0x2caf('0x6')](_0x2caf('0x65'),_0x17ea46[_0x2caf('0x66')]||_0x17ea46[_0x2caf('0x64')],_0x17ea46[_0x2caf('0x6')]||_0x2caf('0x67'));return ami[_0x2caf('0x21')]({'action':_0x2caf('0x68'),'channel':_0x5b8d66[_0x2caf('0x69')],'file':_0x473188,'options':'ai(mixmonitorid)'})[_0x2caf('0x18')](function(_0x106930){var _0xa325cd=_['find'](_0x5b8d66[_0x2caf('0x6a')],{'filename':_0x2caf('0x6b')+_0x473188[_0x2caf('0x6c')]()});if(_['isNil'](_0xa325cd)){_0x5b8d66[_0x2caf('0x6a')][_0x2caf('0x5b')]({'filename':_0x2caf('0x6b')+_0x473188[_0x2caf('0x6c')](),'createdAt':moment()['format'](_0x2caf('0x6d')),'mixmonitorid':_0x106930[_0x2caf('0x6e')],'status':_0x2caf('0x6f')});}else{_0xa325cd['mixmonitorid']=_0x106930[_0x2caf('0x6e')];_0xa325cd[_0x2caf('0x70')]='rec';}_0x589c57({'code':0xc8,'message':[_0x17ea46[_0x2caf('0x64')],_0x2caf('0x71'),_0x106930[_0x2caf('0x6e')]]['join']('\x20'),'mixmonitorid':_0x106930[_0x2caf('0x6e')]});})['catch'](function(_0x96960a){_0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f5,[_0x17ea46['uniqueid'],_0x96960a['message'][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0xb3d0c){var _0x4ea3d5=this;return new Promise(function(_0x2787eb,_0x17451c){if(ami['isConnected']()==![]){return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f4,[config[_0x2caf('0x1c')]['ip'],config['asterisk']['username'],_0x2caf('0x1d')]['join']('\x20')));}var _0x2e8de2=schema(properties[_0x2caf('0x61')])[_0x2caf('0x2')](_0xb3d0c);if(_0x2e8de2[_0x2caf('0x5c')]>0x0){return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f4,_['map'](_0x2e8de2,_0x2caf('0x1b'))['join'](',\x20')));}var _0x21a167=_['find'](_0x335e3c[_0x2caf('0x63')],{'uniqueid':_0xb3d0c['uniqueid']});if(_0x21a167){return BPromise['resolve']()[_0x2caf('0x18')](function(){if(_0x21a167['channel']){return ami[_0x2caf('0x21')]({'action':'StopMixMonitor','channel':_0x21a167['channel'],'mixmonitorid':_0xb3d0c[_0x2caf('0x6e')]})[_0x2caf('0x19')](function(_0x380c2e){});}})[_0x2caf('0x18')](function(){if(_0x21a167[_0x2caf('0x73')]){return ami['Action']({'action':_0x2caf('0x74'),'channel':_0x21a167[_0x2caf('0x73')],'mixmonitorid':_0xb3d0c['mixmonitorid']})[_0x2caf('0x19')](function(_0x4b0360){});}})[_0x2caf('0x18')](function(_0x1bfd2a){var _0x4399ec=_[_0x2caf('0x5d')](_0x21a167[_0x2caf('0x6a')],{'mixmonitorid':_0xb3d0c['mixmonitorid']});if(_0x4399ec){_0x4399ec['status']=_0x2caf('0x75');}})[_0x2caf('0x18')](function(){var _0x90ddb1=util[_0x2caf('0x6')](_0x2caf('0x65'),_0xb3d0c[_0x2caf('0x66')]||_0xb3d0c[_0x2caf('0x64')],_0xb3d0c['format']||_0x2caf('0x67'));var _0x34d3ec=_[_0x2caf('0x5d')](_0x21a167[_0x2caf('0x6a')],{'filename':_0x2caf('0x6b')+_0x90ddb1['toLowerCase']()});if(_0x34d3ec){_0x34d3ec[_0x2caf('0x70')]='stop';}})[_0x2caf('0x18')](function(){_0x2787eb({'code':0xc8,'message':[_0xb3d0c[_0x2caf('0x64')],_0x2caf('0x76')][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x4ebedc){_0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f5,[_0xb3d0c['uniqueid'],_0x4ebedc[_0x2caf('0x1b')][_0x2caf('0x6c')]()]['join']('\x20')));});}else{return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannels':function(_0x131b1c){return new Promise(function(_0x6f5797,_0x172f98){var _0xd851ee=_['values'](_0x335e3c[_0x2caf('0x77')]);_0x6f5797({'count':_0xd851ee['length'],'rows':_0xd851ee});});},'VoiceQueuesChannel':function(_0x1bc5d7){var _0x5ad1be=this;return new Promise(function(_0x1b127c,_0x232120){var _0x42bf85=schema(properties['voicequeuechannel'])[_0x2caf('0x2')](_0x1bc5d7);if(_0x42bf85[_0x2caf('0x5c')]>0x0){return _0x232120(_0x5ad1be[_0x2caf('0x1a')](0x1f4,_[_0x2caf('0x62')](_0x42bf85,_0x2caf('0x1b'))['join'](',\x20')));}var _0x366c5d=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x1bc5d7[_0x2caf('0x64')]});if(_0x366c5d){_0x1b127c(_0x366c5d);}else{return _0x232120(_0x5ad1be[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x5ae8de){var _0x3f2745=this;return new Promise(function(_0x5a2633,_0xaee725){if(ami[_0x2caf('0x11')]()==![]){return _0xaee725(_0x3f2745[_0x2caf('0x1a')](0x1f4,[config[_0x2caf('0x1c')]['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0x5702b4=schema(properties[_0x2caf('0x78')])[_0x2caf('0x2')](_0x5ae8de);if(_0x5702b4[_0x2caf('0x5c')]>0x0){return _0xaee725(_0x3f2745['error'](0x1f4,_[_0x2caf('0x62')](_0x5702b4,_0x2caf('0x1b'))[_0x2caf('0x13')](',\x20')));}var _0x4a29cd=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x5ae8de[_0x2caf('0x64')]});if(_0x4a29cd&&_0x4a29cd[_0x2caf('0x69')]){return ami['Action']({'action':'Hangup','channel':_0x4a29cd[_0x2caf('0x69')]})[_0x2caf('0x18')](function(_0x11d10d){_0x5a2633({'code':0xc8,'message':[_0x5ae8de[_0x2caf('0x64')],_0x11d10d[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x20fb6e){_0xaee725(_0x3f2745[_0x2caf('0x1a')](0x1f5,[_0x5ae8de[_0x2caf('0x64')],_0x20fb6e[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0xaee725(_0x3f2745['error'](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x13e931){var _0x4e1493=this;return new Promise(function(_0x23e2ce,_0x265068){if(ami[_0x2caf('0x11')]()==![]){return _0x265068(_0x4e1493['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0x5e0e3c=schema(properties[_0x2caf('0x79')])[_0x2caf('0x2')](_0x13e931);if(_0x5e0e3c[_0x2caf('0x5c')]>0x0){return _0x265068(_0x4e1493['error'](0x1f4,_[_0x2caf('0x62')](_0x5e0e3c,_0x2caf('0x1b'))['join'](',\x20')));}var _0x3cd498=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x13e931['uniqueid']});if(_0x3cd498&&_0x3cd498[_0x2caf('0x69')]){return ami[_0x2caf('0x21')]({'action':_0x2caf('0x7a'),'channel':_0x3cd498[_0x2caf('0x69')],'exten':_0x13e931[_0x2caf('0x7b')],'context':_0x13e931[_0x2caf('0x7c')]||_0x3cd498['context'],'priority':0x1})['then'](function(_0x2137b7){_0x23e2ce({'code':0xc8,'message':[_0x13e931[_0x2caf('0x64')],_0x2137b7[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x5fd9c3){_0x265068(_0x4e1493[_0x2caf('0x1a')](0x1f5,[_0x13e931[_0x2caf('0x64')],_0x5fd9c3[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0x265068(_0x4e1493['error'](0x1f5,_0x2caf('0x72')));}});},'Agents':function(_0x313273){return new Promise(function(_0x217778,_0x52bf38){var _0x3def55=_['values'](_0x335e3c['agents']);_0x217778({'count':_0x3def55['length'],'rows':_0x3def55});});},'Telephones':function(_0x2cc9fc){return new Promise(function(_0x509ff1,_0xc9ee15){var _0x2069f0=_['values'](_0x335e3c[_0x2caf('0x7d')]);_0x509ff1({'count':_0x2069f0[_0x2caf('0x5c')],'rows':_0x2069f0});});},'Trunks':function(_0x4a21d2){return new Promise(function(_0x492b49,_0x22cd27){var _0xb1f581=_[_0x2caf('0x60')](_0x335e3c['trunks']);_0x492b49({'count':_0xb1f581['length'],'rows':_0xb1f581});});},'OutboundChannels':function(_0x107d05){return new Promise(function(_0x584efc,_0x3add33){var _0x51df18=_[_0x2caf('0x60')](_0x335e3c['outboundChannels']);_0x584efc({'count':_0x51df18['length'],'rows':_0x51df18});});},'Outbound':function(_0x19e2bd){return new Promise(function(_0x54d8d7,_0x485d4a){_0x54d8d7(_0x335e3c[_0x2caf('0x7e')]);});},'Campaigns':function(_0x3c20b4){return new Promise(function(_0x2aab58,_0x387a48){var _0x1663d3=_['values'](_0x335e3c[_0x2caf('0x7f')]);_0x2aab58({'count':_0x1663d3['length'],'rows':_0x1663d3});});},'VoiceQueuesPreview':function(_0x4c456b){var _0x2998ef=this;return new Promise(function(_0x5559fc,_0x4b7b6a){_0xae320c[_0x2caf('0x80')](_0x4c456b['id'])[_0x2caf('0x18')](function(_0x84a87d){_0x5559fc({'code':0xc8,'message':_0x84a87d['message']});})[_0x2caf('0x19')](function(_0x1b63b1){_0x4b7b6a(_0x2998ef['error'](0x1f4,_0x1b63b1[_0x2caf('0x1b')]));});});},'EventManager':function(_0x528336){var _0x2fec57=this;return new Promise(function(_0xc1697,_0x2fdba6){if(!_0x528336[_0x2caf('0x81')]){return _0x2fdba6(_0x2fec57['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x2caf('0x82')]('custom:'+_0x528336[_0x2caf('0x81')],_0x528336['message']);_0xc1697({'code':0xc8,'message':_0x528336});});},'FaxAccounts':function(_0x55811d){return new Promise(function(_0x598610,_0x50f721){var _0x340e20=_[_0x2caf('0x60')](_0x335e3c[_0x2caf('0x83')]);_0x598610({'count':_0x340e20[_0x2caf('0x5c')],'rows':_0x340e20});});},'SendFax':function(_0x297abb){var _0x3f569f=this;return new Promise(function(_0x1c506e,_0x33b627){_0x249a4b[_0x2caf('0x84')](_0x297abb)['then'](function(_0x290b6b){_0x1c506e({'code':0xc8,'message':_0x290b6b[_0x2caf('0x1b')]});})['catch'](function(_0x49b03e){_0x33b627(_0x3f569f[_0x2caf('0x1a')](0x1f4,_0x49b03e[_0x2caf('0x1b')]));});});},'CheckAfterSend':function(_0x170070){var _0x199d4e=this;return new Promise(function(_0x5ee03e,_0x274b11){_0x249a4b[_0x2caf('0x85')](_0x170070)[_0x2caf('0x18')](function(_0x44aafd){_0x5ee03e({'code':0xc8,'message':_0x44aafd[_0x2caf('0x1b')]});})[_0x2caf('0x19')](function(_0x58c736){_0x274b11(_0x199d4e[_0x2caf('0x1a')](0x1f4,_0x58c736[_0x2caf('0x1b')]));});});}};var _0x102599=jayson['server'](_0x314486)[_0x2caf('0x86')]();_0x102599['on'](_0x2caf('0x1a'),function(_0x511202){return _0xc44e4e(_0x511202);});_0x102599[_0x2caf('0x87')](0x232a,_0x2caf('0x88'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x599ce7(_0x2caf('0x89')+0x232a);});});}; \ No newline at end of file +var _0x77a9=['uniqueid','Channel\x20doesn\x27t\x20exist','resolve','channel','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannel','Hangup','exten','context','trunks','campaigns','run','event','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','action','Action','then','catch','message','error','join','Command','content','voiceQueues','hasOwnProperty','loggedIn','sumDuration','talking','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','channels','voicechannel','validate','map','filename','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec'];(function(_0x20d872,_0x15a01b){var _0xea3a4d=function(_0x5cbb38){while(--_0x5cbb38){_0x20d872['push'](_0x20d872['shift']());}};_0xea3a4d(++_0x15a01b);}(_0x77a9,0x19e));var _0x977a=function(_0x4bdce3,_0x565818){_0x4bdce3=_0x4bdce3-0x0;var _0xe9962a=_0x77a9[_0x4bdce3];return _0xe9962a;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var jayson=require(_0x977a('0x1'));var schema=require('validate');var BPromise=require(_0x977a('0x2'));var moment=require(_0x977a('0x3'));var config=require(_0x977a('0x4'));var properties=require(_0x977a('0x5'));var ami=require('../ami');exports[_0x977a('0x6')]=function(_0xb755,_0x3e2b27,_0x2b4ba5){return new BPromise(function(_0x261e46,_0x579e03){var _0x51950c={'QueuePause':function(_0x2e177f){return new Promise(function(_0x12fd82,_0x5ac9c7){var _0x3974cf=util[_0x977a('0x7')](_0x977a('0x8'),_0x977a('0x9'),_0x2e177f[_0x977a('0xa')]);if(_0xb755[_0x977a('0xb')]&&_0xb755[_0x977a('0xb')][_0x3974cf]&&_0xb755[_0x977a('0xb')][_0x3974cf][_0x977a('0xc')]){_0xb755[_0x977a('0xb')][_0x3974cf]['updateAcw']();}if(_0xb755[_0x977a('0xd')][_0x3974cf]){_0xb755[_0x977a('0xd')][_0x3974cf][_0x977a('0xe')]({'statePause':_0x2e177f[_0x977a('0xf')]?!![]:![]});}_0x12fd82({'code':0xc8,'message':_0x977a('0x10')});});},'Reload':function(_0x1fc863){var _0x42ccb8=this;return new Promise(function(_0x2fc086,_0x3d46ba){if(ami[_0x977a('0x11')]()==![]){return _0x3d46ba(_0x42ccb8['error'](0x1f4,[config[_0x977a('0x12')]['ip'],config['asterisk'][_0x977a('0x13')],_0x977a('0x14')]['join']('\x20')));}_0x1fc863=_[_0x977a('0x15')](_0x1fc863,_[_0x977a('0x16')](properties[_0x977a('0x17')]));_0x1fc863[_0x977a('0x18')]='Reload';return ami[_0x977a('0x19')](_0x1fc863)[_0x977a('0x1a')](function(_0x2d47a0){_0x2fc086({'code':0xc8,'message':_0x2d47a0['message']});})[_0x977a('0x1b')](function(_0x20b70b){_0x3d46ba(_0x42ccb8['error'](0x1f5,_0x20b70b[_0x977a('0x1c')]));});});},'Command':function(_0x5bb56d){var _0x709863=this;return new Promise(function(_0x37a2e0,_0x14994a){if(ami[_0x977a('0x11')]()==![]){return _0x14994a(_0x709863[_0x977a('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x977a('0x12')][_0x977a('0x13')],_0x977a('0x14')][_0x977a('0x1e')]('\x20')));}_0x5bb56d=_[_0x977a('0x15')](_0x5bb56d,'command');_0x5bb56d['action']=_0x977a('0x1f');return ami[_0x977a('0x19')](_0x5bb56d)[_0x977a('0x1a')](function(_0x10408d){_0x37a2e0({'code':0xc8,'message':_0x10408d[_0x977a('0x20')]});})['catch'](function(_0x24a519){_0x14994a(_0x709863['error'](0x1f5,_0x24a519[_0x977a('0x1c')]));});});},'VoiceQueues':function(_0x3cc264){return new Promise(function(_0x33c9f9,_0x5794c6){var _0x3734ac=[];for(var _0x1efd0a in _0xb755[_0x977a('0x21')]){if(_0xb755['voiceQueues'][_0x977a('0x22')](_0x1efd0a)){var _0x49a87a=_0xb755[_0x977a('0x21')][_0x1efd0a];var _0x3184b2={'id':_0x49a87a['id'],'name':_0x49a87a[_0x977a('0xa')],'strategy':_0x49a87a['strategy'],'answered':_0x49a87a['answered'],'available':_0x49a87a['available'],'loggedIn':_0x49a87a[_0x977a('0x23')],'pTalking':_0x49a87a['pTalking'],'sumBillable':_0x49a87a['sumBillable'],'sumDuration':_0x49a87a[_0x977a('0x24')],'sumHoldTime':_0x49a87a['sumHoldTime']||0x0,'talking':_0x49a87a[_0x977a('0x25')],'total':_0x49a87a['total'],'type':_0x49a87a[_0x977a('0x26')],'unmanaged':_0x49a87a[_0x977a('0x27')],'abandoned':_0x49a87a[_0x977a('0x28')],'waiting':_0x49a87a[_0x977a('0x29')],'loggedInDb':_0x49a87a['loggedInDb']};if(_0x49a87a[_0x977a('0x26')]===_0x977a('0x2a')){_0x3184b2[_0x977a('0x2b')]=_0x49a87a[_0x977a('0x2b')];_0x3184b2[_0x977a('0x2c')]=_0x49a87a['dialMethod'];_0x3184b2['dialOriginateCallerIdName']=_0x49a87a[_0x977a('0x2d')];_0x3184b2[_0x977a('0x2e')]=_0x49a87a[_0x977a('0x2e')];_0x3184b2['dialOriginateTimeout']=_0x49a87a[_0x977a('0x2f')];_0x3184b2[_0x977a('0x30')]=_0x49a87a[_0x977a('0x30')];_0x3184b2['temp']=_0x49a87a[_0x977a('0x31')];_0x3184b2[_0x977a('0x32')]=_0x49a87a[_0x977a('0x32')];_0x3184b2[_0x977a('0x33')]=_0x49a87a[_0x977a('0x33')];_0x3184b2['outboundBlacklistCallsDay']=_0x49a87a[_0x977a('0x34')];_0x3184b2[_0x977a('0x35')]=_0x49a87a[_0x977a('0x35')];_0x3184b2[_0x977a('0x36')]=_0x49a87a[_0x977a('0x36')];_0x3184b2[_0x977a('0x37')]=_0x49a87a[_0x977a('0x37')];_0x3184b2[_0x977a('0x38')]=_0x49a87a['outboundDropCallsDayCallersExit'];_0x3184b2[_0x977a('0x39')]=_0x49a87a[_0x977a('0x39')];_0x3184b2[_0x977a('0x3a')]=_0x49a87a[_0x977a('0x3a')];_0x3184b2[_0x977a('0x3b')]=_0x49a87a[_0x977a('0x3b')];_0x3184b2[_0x977a('0x3c')]=_0x49a87a['outboundOriginateFailureCallsDay'];_0x3184b2[_0x977a('0x3d')]=_0x49a87a['outboundReCallsDay'];_0x3184b2[_0x977a('0x3e')]=_0x49a87a['outboundRejectCallsDay'];_0x3184b2['outboundUnknownCallsDay']=_0x49a87a[_0x977a('0x3f')];_0x3184b2[_0x977a('0x40')]=_0x49a87a[_0x977a('0x40')];_0x3184b2['predictiveIntervalAvgHoldtime']=_0x49a87a['predictiveIntervalAvgHoldtime'];_0x3184b2[_0x977a('0x41')]=_0x49a87a[_0x977a('0x41')];_0x3184b2[_0x977a('0x42')]=_0x49a87a[_0x977a('0x42')];_0x3184b2['predictiveIntervalDroppedCallsTimeout']=_0x49a87a['predictiveIntervalDroppedCallsTimeout'];_0x3184b2[_0x977a('0x43')]=_0x49a87a[_0x977a('0x43')];_0x3184b2[_0x977a('0x44')]=_0x49a87a['predictiveIntervalErlangCallsDroppedCalls'];_0x3184b2[_0x977a('0x45')]=_0x49a87a['predictiveIntervalHitRate'];_0x3184b2['predictiveIntervalMultiplicativeFactor']=_0x49a87a[_0x977a('0x46')];_0x3184b2['predictiveIntervalPauses']=_0x49a87a[_0x977a('0x47')];_0x3184b2[_0x977a('0x48')]=_0x49a87a[_0x977a('0x48')];_0x3184b2[_0x977a('0x49')]=_0x49a87a[_0x977a('0x49')];_0x3184b2[_0x977a('0x1c')]=_0x49a87a[_0x977a('0x1c')];_0x3184b2['originated']=_0x49a87a['originated'];_0x3184b2[_0x977a('0x4a')]=_0x49a87a[_0x977a('0x4a')];_0x3184b2[_0x977a('0x4b')]=_0x49a87a[_0x977a('0x4b')];_0x3184b2[_0x977a('0x4c')]=_0x49a87a[_0x977a('0x4c')];_0x3184b2[_0x977a('0x4d')]=_0x49a87a[_0x977a('0x4d')];_0x3184b2[_0x977a('0x4e')]=_0x49a87a['startPredictive'];_0x3184b2[_0x977a('0x4f')]=_0x49a87a[_0x977a('0x4f')];}if(_0x49a87a[_0x977a('0x50')]){_0x3184b2[_0x977a('0x50')]={'id':_0x49a87a[_0x977a('0x50')]['id'],'name':_0x49a87a[_0x977a('0x50')]['name'],'active':_0x49a87a[_0x977a('0x50')][_0x977a('0x51')],'callerid':_0x49a87a[_0x977a('0x50')]['callerid']};}if(_0x49a87a['Interval']){_0x3184b2['Interval']={'id':_0x49a87a['Interval']['id'],'name':_0x49a87a[_0x977a('0x52')][_0x977a('0xa')]};}_0x3734ac[_0x977a('0x53')](_0x3184b2);}}_0x33c9f9({'count':_0x3734ac[_0x977a('0x54')],'rows':_0x3734ac});});},'UpdateVoiceQueue':function(_0x24c2d5){return new Promise(function(_0x200586,_0x8f2dfb){var _0x1c2c1a=_[_0x977a('0x55')](_0xb755[_0x977a('0x21')],{'id':parseInt(_0x24c2d5['id'])});var _0x2fb5ab=_[_0x977a('0x56')](_0x24c2d5,['id']);if(_0x1c2c1a){for(var _0x5ee5ee in _0x2fb5ab){if(typeof _0x2fb5ab[_0x5ee5ee]!==_0x977a('0x57')&&typeof _0x1c2c1a[_0x5ee5ee]!==_0x977a('0x57')){_0x1c2c1a[_0x5ee5ee]=_0x2fb5ab[_0x5ee5ee];}}_0x200586(_0x1c2c1a);}else{_0x8f2dfb();}});},'VoiceChannels':function(_0x55d123){return new Promise(function(_0x501186,_0x2a6cb7){var _0x2449d3=_['values'](_0xb755[_0x977a('0x58')]);_0x501186({'count':_0x2449d3['length'],'rows':_0x2449d3});});},'VoiceChannelMixMonitor':function(_0x8b40df){var _0x2d6d75=this;return new Promise(function(_0x1b6fcc,_0x5f06a9){if(ami[_0x977a('0x11')]()==![]){return _0x5f06a9(_0x2d6d75[_0x977a('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x977a('0x12')]['username'],_0x977a('0x14')][_0x977a('0x1e')]('\x20')));}var _0x47c6c6=schema(properties[_0x977a('0x59')])[_0x977a('0x5a')](_0x8b40df);if(_0x47c6c6[_0x977a('0x54')]>0x0){return _0x5f06a9(_0x2d6d75[_0x977a('0x1d')](0x1f4,_[_0x977a('0x5b')](_0x47c6c6,_0x977a('0x1c'))[_0x977a('0x1e')](',\x20')));}var _0x902a8f=_[_0x977a('0x55')](_0xb755[_0x977a('0x58')],{'uniqueid':_0x8b40df['uniqueid']});if(_0x902a8f&&_0x902a8f['channel']){var _0x1f3b5e=util['format']('%s.%s',_0x8b40df[_0x977a('0x5c')]||_0x8b40df['uniqueid'],_0x8b40df['format']||'wav');return ami[_0x977a('0x19')]({'action':_0x977a('0x5d'),'channel':_0x902a8f['channel'],'file':_0x1f3b5e,'options':'ai(mixmonitorid)'})[_0x977a('0x1a')](function(_0x356c36){var _0x1582ec=_[_0x977a('0x55')](_0x902a8f[_0x977a('0x5e')],{'filename':_0x977a('0x5f')+_0x1f3b5e[_0x977a('0x60')]()});if(_[_0x977a('0x61')](_0x1582ec)){_0x902a8f[_0x977a('0x5e')][_0x977a('0x53')]({'filename':_0x977a('0x5f')+_0x1f3b5e['toLowerCase'](),'createdAt':moment()[_0x977a('0x7')](_0x977a('0x62')),'mixmonitorid':_0x356c36[_0x977a('0x63')],'status':'rec'});}else{_0x1582ec[_0x977a('0x63')]=_0x356c36['mixmonitorid'];_0x1582ec[_0x977a('0x64')]=_0x977a('0x65');}_0x1b6fcc({'code':0xc8,'message':[_0x8b40df[_0x977a('0x66')],'MixMonitor\x20Success',_0x356c36[_0x977a('0x63')]]['join']('\x20'),'mixmonitorid':_0x356c36[_0x977a('0x63')]});})[_0x977a('0x1b')](function(_0x199631){_0x5f06a9(_0x2d6d75[_0x977a('0x1d')](0x1f5,[_0x8b40df[_0x977a('0x66')],_0x199631[_0x977a('0x1c')][_0x977a('0x60')]()][_0x977a('0x1e')]('\x20')));});}else{return _0x5f06a9(_0x2d6d75[_0x977a('0x1d')](0x1f5,_0x977a('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x215a2c){var _0x536b42=this;return new Promise(function(_0x4d87a6,_0x5ed283){if(ami[_0x977a('0x11')]()==![]){return _0x5ed283(_0x536b42[_0x977a('0x1d')](0x1f4,[config[_0x977a('0x12')]['ip'],config[_0x977a('0x12')][_0x977a('0x13')],_0x977a('0x14')][_0x977a('0x1e')]('\x20')));}var _0x1d8a4f=schema(properties[_0x977a('0x59')])['validate'](_0x215a2c);if(_0x1d8a4f['length']>0x0){return _0x5ed283(_0x536b42[_0x977a('0x1d')](0x1f4,_[_0x977a('0x5b')](_0x1d8a4f,'message')[_0x977a('0x1e')](',\x20')));}var _0x4fa0ee=_[_0x977a('0x55')](_0xb755[_0x977a('0x58')],{'uniqueid':_0x215a2c[_0x977a('0x66')]});if(_0x4fa0ee){return BPromise[_0x977a('0x68')]()['then'](function(){if(_0x4fa0ee[_0x977a('0x69')]){return ami['Action']({'action':_0x977a('0x6a'),'channel':_0x4fa0ee['channel'],'mixmonitorid':_0x215a2c[_0x977a('0x63')]})['catch'](function(_0xbfbd28){});}})[_0x977a('0x1a')](function(){if(_0x4fa0ee[_0x977a('0x6b')]){return ami['Action']({'action':_0x977a('0x6a'),'channel':_0x4fa0ee[_0x977a('0x6b')],'mixmonitorid':_0x215a2c[_0x977a('0x63')]})['catch'](function(_0x44b391){});}})[_0x977a('0x1a')](function(_0x3baf11){var _0x58ff93=_['find'](_0x4fa0ee['monitors'],{'mixmonitorid':_0x215a2c[_0x977a('0x63')]});if(_0x58ff93){_0x58ff93[_0x977a('0x64')]=_0x977a('0x6c');}})['then'](function(){var _0x3a111c=util[_0x977a('0x7')](_0x977a('0x6d'),_0x215a2c[_0x977a('0x5c')]||_0x215a2c[_0x977a('0x66')],_0x215a2c[_0x977a('0x7')]||'wav');var _0x1122bd=_[_0x977a('0x55')](_0x4fa0ee[_0x977a('0x5e')],{'filename':_0x977a('0x5f')+_0x3a111c[_0x977a('0x60')]()});if(_0x1122bd){_0x1122bd[_0x977a('0x64')]=_0x977a('0x6c');}})[_0x977a('0x1a')](function(){_0x4d87a6({'code':0xc8,'message':[_0x215a2c[_0x977a('0x66')],_0x977a('0x6e')][_0x977a('0x1e')]('\x20')});})[_0x977a('0x1b')](function(_0x4360d4){_0x5ed283(_0x536b42['error'](0x1f5,[_0x215a2c[_0x977a('0x66')],_0x4360d4['message'][_0x977a('0x60')]()][_0x977a('0x1e')]('\x20')));});}else{return _0x5ed283(_0x536b42[_0x977a('0x1d')](0x1f5,_0x977a('0x67')));}});},'VoiceQueuesChannels':function(_0x1e765b){return new Promise(function(_0x5dcba2,_0x4df5c9){var _0x1d3a24=_[_0x977a('0x6f')](_0xb755[_0x977a('0x70')]);_0x5dcba2({'count':_0x1d3a24[_0x977a('0x54')],'rows':_0x1d3a24});});},'VoiceQueuesChannel':function(_0x4a61d4){var _0x1ffcc8=this;return new Promise(function(_0x32efc5,_0x53ef24){var _0x2064f1=schema(properties[_0x977a('0x71')])[_0x977a('0x5a')](_0x4a61d4);if(_0x2064f1[_0x977a('0x54')]>0x0){return _0x53ef24(_0x1ffcc8[_0x977a('0x1d')](0x1f4,_[_0x977a('0x5b')](_0x2064f1,_0x977a('0x1c'))[_0x977a('0x1e')](',\x20')));}var _0x43d232=_['find'](_0xb755['queueChannels'],{'uniqueid':_0x4a61d4[_0x977a('0x66')]});if(_0x43d232){_0x32efc5(_0x43d232);}else{return _0x53ef24(_0x1ffcc8['error'](0x1f5,_0x977a('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x59a34e){var _0x2cf7d8=this;return new Promise(function(_0x57fffa,_0x3200fd){if(ami[_0x977a('0x11')]()==![]){return _0x3200fd(_0x2cf7d8[_0x977a('0x1d')](0x1f4,[config[_0x977a('0x12')]['ip'],config[_0x977a('0x12')]['username'],_0x977a('0x14')]['join']('\x20')));}var _0x250bd2=schema(properties['voicequeuechannelhangup'])[_0x977a('0x5a')](_0x59a34e);if(_0x250bd2[_0x977a('0x54')]>0x0){return _0x3200fd(_0x2cf7d8[_0x977a('0x1d')](0x1f4,_['map'](_0x250bd2,_0x977a('0x1c'))[_0x977a('0x1e')](',\x20')));}var _0x5b0067=_[_0x977a('0x55')](_0xb755[_0x977a('0x70')],{'uniqueid':_0x59a34e['uniqueid']});if(_0x5b0067&&_0x5b0067[_0x977a('0x69')]){return ami['Action']({'action':_0x977a('0x72'),'channel':_0x5b0067[_0x977a('0x69')]})[_0x977a('0x1a')](function(_0x1c6e9b){_0x57fffa({'code':0xc8,'message':[_0x59a34e[_0x977a('0x66')],_0x1c6e9b[_0x977a('0x1c')][_0x977a('0x60')]()]['join']('\x20')});})[_0x977a('0x1b')](function(_0x48da04){_0x3200fd(_0x2cf7d8['error'](0x1f5,[_0x59a34e[_0x977a('0x66')],_0x48da04['message'][_0x977a('0x60')]()][_0x977a('0x1e')]('\x20')));});}else{return _0x3200fd(_0x2cf7d8[_0x977a('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x10d917){var _0x36fc82=this;return new Promise(function(_0x62f26a,_0x17469a){if(ami[_0x977a('0x11')]()==![]){return _0x17469a(_0x36fc82[_0x977a('0x1d')](0x1f4,[config[_0x977a('0x12')]['ip'],config[_0x977a('0x12')][_0x977a('0x13')],'ami\x20disconnected'][_0x977a('0x1e')]('\x20')));}var _0x4f0df1=schema(properties['voicequeuechannelredirect'])[_0x977a('0x5a')](_0x10d917);if(_0x4f0df1[_0x977a('0x54')]>0x0){return _0x17469a(_0x36fc82['error'](0x1f4,_[_0x977a('0x5b')](_0x4f0df1,'message')[_0x977a('0x1e')](',\x20')));}var _0xaa008d=_['find'](_0xb755[_0x977a('0x70')],{'uniqueid':_0x10d917[_0x977a('0x66')]});if(_0xaa008d&&_0xaa008d[_0x977a('0x69')]){return ami[_0x977a('0x19')]({'action':'Redirect','channel':_0xaa008d[_0x977a('0x69')],'exten':_0x10d917[_0x977a('0x73')],'context':_0x10d917['context']||_0xaa008d[_0x977a('0x74')],'priority':0x1})['then'](function(_0x282c75){_0x62f26a({'code':0xc8,'message':[_0x10d917[_0x977a('0x66')],_0x282c75[_0x977a('0x1c')][_0x977a('0x60')]()][_0x977a('0x1e')]('\x20')});})[_0x977a('0x1b')](function(_0xf35f21){_0x17469a(_0x36fc82[_0x977a('0x1d')](0x1f5,[_0x10d917[_0x977a('0x66')],_0xf35f21[_0x977a('0x1c')][_0x977a('0x60')]()]['join']('\x20')));});}else{return _0x17469a(_0x36fc82[_0x977a('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2a2889){return new Promise(function(_0x15863e,_0x1371d0){var _0x1b70e1=_['values'](_0xb755['agents']);_0x15863e({'count':_0x1b70e1[_0x977a('0x54')],'rows':_0x1b70e1});});},'Telephones':function(_0x113fb8){return new Promise(function(_0x497939,_0x456210){var _0x2922cf=_[_0x977a('0x6f')](_0xb755['telephones']);_0x497939({'count':_0x2922cf[_0x977a('0x54')],'rows':_0x2922cf});});},'Trunks':function(_0x3948b0){return new Promise(function(_0x48e12b,_0x324f79){var _0x131066=_[_0x977a('0x6f')](_0xb755[_0x977a('0x75')]);_0x48e12b({'count':_0x131066['length'],'rows':_0x131066});});},'OutboundChannels':function(_0x4272e7){return new Promise(function(_0x47da3e,_0xd802df){var _0x3b03cf=_[_0x977a('0x6f')](_0xb755['outboundChannels']);_0x47da3e({'count':_0x3b03cf[_0x977a('0x54')],'rows':_0x3b03cf});});},'Outbound':function(_0x5f32a4){return new Promise(function(_0x165d70,_0x472b6d){_0x165d70(_0xb755['outbound']);});},'Campaigns':function(_0x2af13a){return new Promise(function(_0x18e6d5,_0x27b491){var _0x3cb5d8=_[_0x977a('0x6f')](_0xb755[_0x977a('0x76')]);_0x18e6d5({'count':_0x3cb5d8['length'],'rows':_0x3cb5d8});});},'VoiceQueuesPreview':function(_0x459d7a){var _0x316034=this;return new Promise(function(_0x23548f,_0x2e5693){_0x3e2b27[_0x977a('0x77')](_0x459d7a['id'])[_0x977a('0x1a')](function(_0x3dce40){_0x23548f({'code':0xc8,'message':_0x3dce40[_0x977a('0x1c')]});})[_0x977a('0x1b')](function(_0x18c65e){_0x2e5693(_0x316034[_0x977a('0x1d')](0x1f4,_0x18c65e[_0x977a('0x1c')]));});});},'EventManager':function(_0x5d0b36){var _0x539525=this;return new Promise(function(_0x11a015,_0x813b70){if(!_0x5d0b36[_0x977a('0x78')]){return _0x813b70(_0x539525['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x977a('0x79')+_0x5d0b36['event'],_0x5d0b36[_0x977a('0x1c')]);_0x11a015({'code':0xc8,'message':_0x5d0b36});});},'FaxAccounts':function(_0x53533c){return new Promise(function(_0x21997a,_0x212654){var _0xe3a0c2=_['values'](_0xb755[_0x977a('0x7a')]);_0x21997a({'count':_0xe3a0c2['length'],'rows':_0xe3a0c2});});},'SendFax':function(_0x38dcf1){var _0x3d2ee3=this;return new Promise(function(_0x5609c4,_0x2a299f){_0x2b4ba5[_0x977a('0x7b')](_0x38dcf1)[_0x977a('0x1a')](function(_0x2e08a8){_0x5609c4({'code':0xc8,'message':_0x2e08a8[_0x977a('0x1c')]});})[_0x977a('0x1b')](function(_0x133c84){_0x2a299f(_0x3d2ee3[_0x977a('0x1d')](0x1f4,_0x133c84[_0x977a('0x1c')]));});});},'CheckAfterSend':function(_0xab8f7c){var _0x279507=this;return new Promise(function(_0x2b35d0,_0x2e9b4c){_0x2b4ba5[_0x977a('0x7c')](_0xab8f7c)[_0x977a('0x1a')](function(_0x5aa2d2){_0x2b35d0({'code':0xc8,'message':_0x5aa2d2[_0x977a('0x1c')]});})['catch'](function(_0x48ac4d){_0x2e9b4c(_0x279507[_0x977a('0x1d')](0x1f4,_0x48ac4d[_0x977a('0x1c')]));});});}};var _0x3d5b60=jayson[_0x977a('0x7d')](_0x51950c)['http']();_0x3d5b60['on'](_0x977a('0x1d'),function(_0x43ddb){return _0x579e03(_0x43ddb);});_0x3d5b60['listen'](0x232a,_0x977a('0x7e'),function(){console['log'](_0x977a('0x7f'),0x232a);return _0x261e46(_0x977a('0x80')+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 2324842..3d3df44 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 _0x207c=['defaults','redis','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x58e8cf,_0x16ff42){var _0x1baba0=function(_0x538707){while(--_0x538707){_0x58e8cf['push'](_0x58e8cf['shift']());}};_0x1baba0(++_0x16ff42);}(_0x207c,0x1e8));var _0xc207=function(_0x3e6aed,_0x97a2f1){_0x3e6aed=_0x3e6aed-0x0;var _0x3220dd=_0x207c[_0x3e6aed];return _0x3220dd;};'use strict';var _=require('lodash');var BPromise=require(_0xc207('0x0'));var Redis=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var config=require(_0xc207('0x3'));var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var cmContactRpc=require(_0xc207('0x6'));config['redis']=_[_0xc207('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc207('0x8')]));function emit(_0x314561,_0x3395e4,_0x59ff6f,_0x25cb97,_0xad159b){logger[_0xc207('0x9')]('[CM][%s][%s]',_0x314561,_0x3395e4['id'],_0x59ff6f,_0x25cb97,JSON[_0xc207('0xa')](_0xad159b));io['to'](_0x59ff6f)[_0xc207('0xb')](_0x25cb97,_0xad159b);}exports[_0xc207('0xc')]=function(_0x13ec41,_0x201162,_0x347549,_0x487d95){var _0x574425,_0x5b556f;var _0x19b297={};var _0x491062=Number(_0x347549[_0xc207('0xd')]);var _0x2782ce=_0x347549['data2']?Boolean(Number(_0x347549[_0xc207('0xe')])):![];var _0xb86b06;var _0x3062f5=![];if(!_[_0xc207('0xf')](_0x347549[_0xc207('0x10')])){if(_0x347549['data5']=='1')_0x3062f5=!![];}if(!_0x3062f5){if(_0x487d95[_0xc207('0x11')]){_0x19b297['id']=_0x487d95[_0xc207('0x11')];}}if(!_0x19b297['id']){_0x19b297[_0xc207('0x12')]=_0x491062;_0xb86b06=_0x347549[_0xc207('0x13')]&&_0x347549['data3']!=='0'?_0x347549['data3']['split'](','):[_0xc207('0x14')];_0x19b297[_0xc207('0x15')]=_[_0xc207('0x16')](_0xb86b06,function(_0x65f539){var _0x4b8f44={};_0x4b8f44[_0x65f539]=_0x487d95[_0xc207('0x17')]?_0x487d95[_0xc207('0x18')]:_0x487d95[_0xc207('0x19')];return _0x4b8f44;});}var _0x5f288e=['id',_0xc207('0x1a'),'lastName',_0xc207('0x14'),_0xc207('0x1b'),_0xc207('0x1c'),_0xc207('0x12'),_0xc207('0x1d'),_0xc207('0x1e'),_0xc207('0x1f')];var _0x464dea=_[_0xc207('0x20')](_0x5f288e,_0xb86b06);BPromise[_0xc207('0x21')]()[_0xc207('0x22')](cmContactRpc[_0xc207('0x23')]({'attributes':_0x464dea,'where':_0x19b297}))[_0xc207('0x22')](function(_0x4b52a7){_0x5b556f=_0x4b52a7;if(!_[_0xc207('0x24')](_0x5b556f)){if(_0x5b556f['length']===0x1){_0x574425=_0x5b556f[0x0];logger[_0xc207('0x9')](_0xc207('0x25'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}else{logger[_0xc207('0x9')](_0xc207('0x27'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_[_0xc207('0x16')](_0x5b556f,'id')[_0xc207('0x28')](','));}return;}else{logger[_0xc207('0x9')](_0xc207('0x29'),_0x487d95[_0xc207('0x26')],_0x201162['id']);var _0x27df03={'ListId':_0x491062};var _0x3f738e=_0x347549[_0xc207('0x2a')]&&_0x347549[_0xc207('0x2a')]!=='0'?_0x347549['data4']:_0xc207('0x14');if(_0x2782ce){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_['isNil'](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2b')]:_0xc207('0x2d');}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2e')]:_0xc207('0x2d');}return BPromise['resolve']()[_0xc207('0x22')](cmContactRpc[_0xc207('0x2f')](_0x27df03))[_0xc207('0x22')](function(_0x448df1){_0x574425=_0x448df1;_0x5b556f[_0xc207('0x30')](_0x448df1);if(_0x574425){logger[_0xc207('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}return;});}else{logger[_0xc207('0x9')](_0xc207('0x31'),_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_['isNil'](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95['calleridname']:'Unknown';}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95['destcalleridname']:_0xc207('0x2d');}_0x574425=_0x27df03;_0x5b556f[_0xc207('0x30')](_0x27df03);return;}}})[_0xc207('0x22')](function(){if(_0x13ec41){emit(_0x487d95[_0xc207('0x26')],_0x201162,util[_0xc207('0x32')]('user:%s',_0x13ec41[_0xc207('0x33')]),util[_0xc207('0x32')]('trigger:%s',_0x347549[_0xc207('0x34')]['toLowerCase']()),{'evt':_[_0xc207('0x35')](_0x487d95,{'autoCreate':_0x2782ce}),'contact':_0x574425===undefined?{}:_0x574425,'contacts':_0x5b556f[_0xc207('0x36')]===0x0?undefined:_0x5b556f});}});}; \ No newline at end of file +var _0x5c12=['bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','map','destcalleridnum','firstName','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge'];(function(_0x4927c0,_0x5e2e39){var _0x159fbf=function(_0x3862ed){while(--_0x3862ed){_0x4927c0['push'](_0x4927c0['shift']());}};_0x159fbf(++_0x5e2e39);}(_0x5c12,0x188));var _0x25c1=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x5c12[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require('lodash');var BPromise=require(_0x25c1('0x0'));var Redis=require(_0x25c1('0x1'));var util=require('util');var config=require(_0x25c1('0x2'));var logger=require(_0x25c1('0x3'))(_0x25c1('0x4'));var cmContactRpc=require(_0x25c1('0x5'));config[_0x25c1('0x6')]=_[_0x25c1('0x7')](config[_0x25c1('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x25c1('0x8'))(new Redis(config[_0x25c1('0x6')]));function emit(_0x382922,_0x4ab674,_0x5c69b1,_0x24981c,_0x3b69ba){logger[_0x25c1('0x9')](_0x25c1('0xa'),_0x382922,_0x4ab674['id'],_0x5c69b1,_0x24981c,JSON[_0x25c1('0xb')](_0x3b69ba));io['to'](_0x5c69b1)['emit'](_0x24981c,_0x3b69ba);}exports[_0x25c1('0xc')]=function(_0x41c89d,_0x11a223,_0x81f0f4,_0x2872b2){var _0x5e44e2,_0x196e2f;var _0x401734={};var _0x49fb8e=Number(_0x81f0f4[_0x25c1('0xd')]);var _0x209af5=_0x81f0f4[_0x25c1('0xe')]?Boolean(Number(_0x81f0f4[_0x25c1('0xe')])):![];var _0x5d3d11;var _0x569ef9=![];if(!_['isNil'](_0x81f0f4['data5'])){if(_0x81f0f4[_0x25c1('0xf')]=='1')_0x569ef9=!![];}if(!_0x569ef9){if(_0x2872b2[_0x25c1('0x10')]){_0x401734['id']=_0x2872b2[_0x25c1('0x10')];}}if(!_0x401734['id']){_0x401734[_0x25c1('0x11')]=_0x49fb8e;_0x5d3d11=_0x81f0f4[_0x25c1('0x12')]&&_0x81f0f4['data3']!=='0'?_0x81f0f4[_0x25c1('0x12')]['split'](','):['phone'];_0x401734['$or']=_[_0x25c1('0x13')](_0x5d3d11,function(_0x1a08b5){var _0x4dc64b={};_0x4dc64b[_0x1a08b5]=_0x2872b2['routeId']?_0x2872b2[_0x25c1('0x14')]:_0x2872b2['calleridnum'];return _0x4dc64b;});}var _0x7175d4=['id',_0x25c1('0x15'),'lastName','phone','mobile',_0x25c1('0x16'),_0x25c1('0x11'),_0x25c1('0x17'),_0x25c1('0x18'),'updatedAt'];var _0x119639=_[_0x25c1('0x19')](_0x7175d4,_0x5d3d11);BPromise[_0x25c1('0x1a')]()[_0x25c1('0x1b')](cmContactRpc['getContacts']({'attributes':_0x119639,'where':_0x401734}))['then'](function(_0x2a8a84){_0x196e2f=_0x2a8a84;if(!_[_0x25c1('0x1c')](_0x196e2f)){if(_0x196e2f[_0x25c1('0x1d')]===0x1){_0x5e44e2=_0x196e2f[0x0];logger[_0x25c1('0x9')](_0x25c1('0x1e'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id'],_0x5e44e2['id']);}else{logger[_0x25c1('0x9')](_0x25c1('0x20'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id'],_[_0x25c1('0x13')](_0x196e2f,'id')[_0x25c1('0x21')](','));}return;}else{logger[_0x25c1('0x9')](_0x25c1('0x22'),_0x2872b2['uniqueid'],_0x11a223['id']);var _0x2dadae={'ListId':_0x49fb8e};var _0x20dbb9=_0x81f0f4[_0x25c1('0x23')]&&_0x81f0f4[_0x25c1('0x23')]!=='0'?_0x81f0f4[_0x25c1('0x23')]:_0x25c1('0x24');if(_0x209af5){logger['info'](_0x25c1('0x25'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id']);_0x2dadae[_0x20dbb9]=_[_0x25c1('0x26')](_0x2872b2[_0x25c1('0x27')])?_0x2872b2[_0x25c1('0x28')]:_0x2872b2[_0x25c1('0x14')];if(_['isNil'](_0x2872b2[_0x25c1('0x27')])){_0x2dadae['firstName']=_0x2872b2[_0x25c1('0x29')]&&_0x2872b2[_0x25c1('0x29')]!==_0x25c1('0x2a')?_0x2872b2[_0x25c1('0x29')]:_0x25c1('0x2b');}else{_0x2dadae[_0x25c1('0x15')]=_0x2872b2[_0x25c1('0x2c')]&&_0x2872b2[_0x25c1('0x2c')]!==_0x25c1('0x2a')?_0x2872b2['destcalleridname']:_0x25c1('0x2b');}return BPromise['resolve']()['then'](cmContactRpc[_0x25c1('0x2d')](_0x2dadae))[_0x25c1('0x1b')](function(_0x4ef790){_0x5e44e2=_0x4ef790;_0x196e2f[_0x25c1('0x2e')](_0x4ef790);if(_0x5e44e2){logger['info'](_0x25c1('0x2f'),_0x2872b2['uniqueid'],_0x11a223['id'],_0x5e44e2['id']);}return;});}else{logger[_0x25c1('0x9')](_0x25c1('0x30'),_0x2872b2[_0x25c1('0x1f')],_0x11a223['id']);_0x2dadae[_0x20dbb9]=_[_0x25c1('0x26')](_0x2872b2[_0x25c1('0x27')])?_0x2872b2[_0x25c1('0x28')]:_0x2872b2[_0x25c1('0x14')];if(_[_0x25c1('0x26')](_0x2872b2['routeId'])){_0x2dadae[_0x25c1('0x15')]=_0x2872b2['calleridname']&&_0x2872b2[_0x25c1('0x29')]!==''?_0x2872b2[_0x25c1('0x29')]:_0x25c1('0x2b');}else{_0x2dadae[_0x25c1('0x15')]=_0x2872b2[_0x25c1('0x2c')]&&_0x2872b2[_0x25c1('0x2c')]!==_0x25c1('0x2a')?_0x2872b2[_0x25c1('0x2c')]:_0x25c1('0x2b');}_0x5e44e2=_0x2dadae;_0x196e2f[_0x25c1('0x2e')](_0x2dadae);return;}}})[_0x25c1('0x1b')](function(){if(_0x41c89d){emit(_0x2872b2[_0x25c1('0x1f')],_0x11a223,util[_0x25c1('0x31')](_0x25c1('0x32'),_0x41c89d[_0x25c1('0x33')]),util[_0x25c1('0x31')](_0x25c1('0x34'),_0x81f0f4[_0x25c1('0x35')][_0x25c1('0x36')]()),{'evt':_[_0x25c1('0x37')](_0x2872b2,{'autoCreate':_0x209af5}),'contact':_0x5e44e2===undefined?{}:_0x5e44e2,'contacts':_0x196e2f[_0x25c1('0x1d')]===0x0?undefined:_0x196e2f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7fd9541..200cae0 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 _0x8a25=['render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','toLowerCase','merge','trigger:%s','contactmanager','exec','queue','routeId','urlforward','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','value','event','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','equals','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','../../../config/logger','trigger','../ami','redis','defaults','localhost','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:offlineMessage','info','emit','prototype','clone','motionChannel','undefined','voice','checkTriggers','checkTrigger','variables','length','Actions','interface','action','data1','popup','data2','html','templates'];(function(_0x4c048d,_0x5029){var _0x189be5=function(_0x40be08){while(--_0x40be08){_0x4c048d['push'](_0x4c048d['shift']());}};_0x189be5(++_0x5029);}(_0x8a25,0xb7));var _0x58a2=function(_0x333dd6,_0x47f2b9){_0x333dd6=_0x333dd6-0x0;var _0x2397a7=_0x8a25[_0x333dd6];return _0x2397a7;};'use strict';var util=require(_0x58a2('0x0'));var _=require(_0x58a2('0x1'));var url=require(_0x58a2('0x2'));var Mustache=require(_0x58a2('0x3'));var Redis=require(_0x58a2('0x4'));var urlforward=require(_0x58a2('0x5'));var integration=require('./integration');var cmContact=require(_0x58a2('0x6'));var script=require('./script');var config=require('../../../config/environment');var logger=require(_0x58a2('0x7'))(_0x58a2('0x8'));var ami=require(_0x58a2('0x9'));config[_0x58a2('0xa')]=_[_0x58a2('0xb')](config[_0x58a2('0xa')],{'host':_0x58a2('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58a2('0xa')]));var operators={'equals':function(_0x12d2b8,_0x187c6e){return _0x12d2b8==_0x187c6e;},'not_equals':function(_0x2c17d9,_0x4e32bd){return _0x2c17d9!=_0x4e32bd;}};var barAndWebActions=['popup',_0x58a2('0x2'),'winapp'];function Trigger(_0x58566e){this[_0x58a2('0xd')]=_0x58566e[_0x58a2('0xd')];this[_0x58a2('0xe')]=_0x58566e[_0x58a2('0xe')];this[_0x58a2('0xf')]=_0x58566e[_0x58a2('0xf')];this['templates']=_0x58566e['templates'];this[_0x58a2('0x10')]=_0x58566e[_0x58a2('0x10')];this[_0x58a2('0x11')]=_0x58566e[_0x58a2('0x11')];this[_0x58a2('0x12')]=_0x58566e[_0x58a2('0x12')];this[_0x58a2('0x13')]=_0x58566e[_0x58a2('0x13')];this[_0x58a2('0x14')]=_0x58566e[_0x58a2('0x14')];this[_0x58a2('0x15')]=_0x58566e[_0x58a2('0x15')];this['deskAccounts']=_0x58566e['deskAccounts'];this[_0x58a2('0x16')]=_0x58566e[_0x58a2('0x16')];this[_0x58a2('0x17')]=_0x58566e[_0x58a2('0x17')];this[_0x58a2('0x18')]=_0x58566e['dynamics365Accounts'];this[_0x58a2('0x19')]=_0x58566e['freshsalesAccounts'];this[_0x58a2('0x1a')]={'zendesk':this[_0x58a2('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x58a2('0x12')],'sugarcrm':this[_0x58a2('0x14')],'zoho':this[_0x58a2('0x15')],'desk':this[_0x58a2('0x1b')],'vtiger':this[_0x58a2('0x16')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x58a2('0x19')],'servicenow':this[_0x58a2('0x17')]};ami['on']('custom:agentcalled',this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x1e'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x1f'),this[_0x58a2('0x1c')]['bind'](this));ami['on'](_0x58a2('0x20'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x21'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x22'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x23'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x24'),this['syncCustomEvent'][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x25'),this['syncCustomEvent'][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x26'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on']('custom:timeout',this[_0x58a2('0x1c')]['bind'](this));ami['on'](_0x58a2('0x27'),this[_0x58a2('0x28')][_0x58a2('0x1d')](this));ami['on']('custom:dialconnect',this['syncAgentDial']['bind'](this));ami['on'](_0x58a2('0x29'),this[_0x58a2('0x28')]['bind'](this));ami['on'](_0x58a2('0x2a'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x2b'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on']('custom:substatus',this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on']('custom:incomingmessage',this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));ami['on'](_0x58a2('0x2c'),this[_0x58a2('0x1c')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x58a2('0x1c')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x58a2('0x1c')]['bind'](this));ami['on'](_0x58a2('0x2d'),this[_0x58a2('0x1c')][_0x58a2('0x1d')](this));}Trigger['prototype']['emit']=function(_0x1a7a60,_0x58bbac,_0x48d51b){logger[_0x58a2('0x2e')](_0x1a7a60,_0x58bbac,JSON['stringify'](_0x48d51b));io['to'](_0x1a7a60)[_0x58a2('0x2f')](_0x58bbac,_0x48d51b);};Trigger[_0x58a2('0x30')][_0x58a2('0x1c')]=function(_0x558af4){var _0x22aa6b=_[_0x58a2('0x31')](_0x558af4);if(typeof _0x22aa6b[_0x58a2('0x32')]===_0x58a2('0x33')){_0x22aa6b[_0x58a2('0x32')]=_0x58a2('0x34');}this['checkTriggers'](_0x22aa6b);};Trigger[_0x58a2('0x30')][_0x58a2('0x28')]=function(_0x5d9780){if(this[_0x58a2('0xe')][_0x5d9780['interface']]){this[_0x58a2('0x1c')](_0x5d9780);}};Trigger['prototype'][_0x58a2('0x35')]=function(_0xc20a8f){var _0x3be086;for(var _0x5abccf in this[_0x58a2('0xd')]){if(this['triggers']['hasOwnProperty'](_0x5abccf)){if(this[_0x58a2('0xd')][_0x5abccf]['status']){_0x3be086=this[_0x58a2('0x36')](this[_0x58a2('0xd')][_0x5abccf],_0xc20a8f);if(_0x3be086){_['merge'](_0xc20a8f,_0xc20a8f[_0x58a2('0x37')]);for(var _0x1d8f88=0x0,_0x55b6ce,_0x145374,_0xb4ef34;_0x1d8f880x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x113b45,_0x41c582){var _0x18b7ba=function(_0xe311cb){while(--_0xe311cb){_0x113b45['push'](_0x113b45['shift']());}};_0x18b7ba(++_0x41c582);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e2ce6c5..8f4683e 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 _0x47ab=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','outbound','destcalleridnum','calleridnum','POST','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','queue','callDirection','phonecalls','Subjects','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','./util','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','clientId','remoteUri','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET'];(function(_0x68d20a,_0xcb3e9f){var _0x442660=function(_0x431c6a){while(--_0x431c6a){_0x68d20a['push'](_0x68d20a['shift']());}};_0x442660(++_0xcb3e9f);}(_0x47ab,0xb9));var _0xb47a=function(_0x3fc702,_0x2f60d5){_0x3fc702=_0x3fc702-0x0;var _0x379946=_0x47ab[_0x3fc702];return _0x379946;};'use strict';var _=require(_0xb47a('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0xb47a('0x1'));var intUtil=require(_0xb47a('0x2'));var md5=require('md5');var Redis=require(_0xb47a('0x3'));var logger=require('../../../../config/logger')(_0xb47a('0x4'));var config=require(_0xb47a('0x5'));config[_0xb47a('0x6')]=_['defaults'](config[_0xb47a('0x6')],{'host':_0xb47a('0x7'),'port':0x18eb});var io=require(_0xb47a('0x8'))(new Redis(config[_0xb47a('0x6')]));function getAuthToken(_0x18846e,_0x1951b0,_0x1b3856){var _0x3477dc={'method':'POST','uri':_0x1951b0,'form':{'client_id':_0x18846e[_0xb47a('0x9')],'resource':_0x18846e[_0xb47a('0xa')],'username':_0x18846e['username'],'password':_0x18846e[_0xb47a('0xb')],'grant_type':'password','client_secret':_0x18846e['clientSecret']},'json':!![]};return rp(_0x3477dc)[_0xb47a('0xc')](function(_0x97edf0){return _0x97edf0['access_token'];})[_0xb47a('0xd')](function(_0x38a7fa){logger[_0xb47a('0xe')]('['+[_0x1b3856[_0xb47a('0xf')]()]+_0xb47a('0x10'));return _0x38a7fa[_0xb47a('0x11')];});}function getUser(_0x145414,_0x1806aa,_0x2aa0c8,_0x384e34,_0x2ae058,_0x17bc8c){return new BPromise(function(_0x11e5a9,_0x428f20){return getAuthToken(_0x1806aa,_0x384e34,_0x17bc8c)[_0xb47a('0xc')](function(_0x36e4b8){var _0x5602bb={'method':_0xb47a('0x12'),'uri':_0x2ae058+_0xb47a('0x13'),'headers':{'Authorization':_0xb47a('0x14')+_0x36e4b8,'OData-Version':_0xb47a('0x15')},'json':!![]};return rp(_0x5602bb);})['then'](function(_0x2e1bbc){var _0x52b791=_0x2e1bbc[_0xb47a('0x16')];var _0x247028=![];var _0x5c46cf=null;if(!_[_0xb47a('0x17')](_0x2aa0c8)){if(intUtil[_0xb47a('0x18')](_0x2aa0c8[_0xb47a('0x19')])){_0x145414[_0xb47a('0x1a')]=_0x2aa0c8[_0xb47a('0x19')];for(_0x5c46cf=0x0;_0x5c46cf<_0x52b791[_0xb47a('0x1b')];_0x5c46cf++){if(_0x52b791[_0x5c46cf][_0xb47a('0x1c')]===_0x2aa0c8[_0xb47a('0x19')]&&!_0x52b791[_0x5c46cf][_0xb47a('0x1d')]){_0x247028=!![];logger[_0xb47a('0x1e')]('['+[_0x17bc8c['toUpperCase']()]+_0xb47a('0x1f')+_0x52b791[_0x5c46cf][_0xb47a('0x20')]+'!');_0x145414[_0xb47a('0x21')]=_0x52b791[_0x5c46cf][_0xb47a('0x20')];}}}}if(!_0x247028){logger[_0xb47a('0x1e')]('['+[_0x17bc8c[_0xb47a('0xf')]()]+_0xb47a('0x22'));_0x145414[_0xb47a('0x1a')]=_0x1806aa[_0xb47a('0x23')];for(_0x5c46cf=0x0;_0x5c46cf<_0x52b791['length'];_0x5c46cf++){if(_0x52b791[_0x5c46cf][_0xb47a('0x1c')]===_0x1806aa[_0xb47a('0x23')]){_0x145414['userId']=_0x52b791[_0x5c46cf][_0xb47a('0x20')];}}}_0x11e5a9(_0x145414);})[_0xb47a('0xd')](function(_0x59ca8c){_0x428f20(_0x59ca8c[_0xb47a('0x11')]);});});}function createEndUser(_0x1fb2b5,_0x574769,_0x35bb22,_0x1328ba,_0x214397,_0xefcb7c){return new BPromise(function(_0x59423b,_0x18ae51){return getAuthToken(_0x574769,_0x35bb22,_0xefcb7c)['then'](function(_0x5a1946){var _0x442d30=_0xefcb7c['toLowerCase']()===_0xb47a('0x24')?_0x214397[_0xb47a('0x25')]:_0x214397[_0xb47a('0x26')];var _0x5bd543={'method':_0xb47a('0x27'),'uri':_0x1328ba+'contacts','body':{'telephone1':_0x442d30,'fullname':_0x442d30,'firstname':_0x442d30,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1fb2b5[_0xb47a('0x21')]+')'},'headers':{'Authorization':_0xb47a('0x14')+_0x5a1946,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5bd543);})[_0xb47a('0xc')](function(_0x2b8578){var _0x2b4737=_0x2b8578[_0xb47a('0x28')][_0xb47a('0x29')];var _0x4df9d3=_0x2b4737[_0xb47a('0x2a')](_0x2b4737[_0xb47a('0x2b')]('(')+0x1,_0x2b4737[_0xb47a('0x2b')](')'));_0x1fb2b5[_0xb47a('0x2c')]=_0x4df9d3;_0x59423b(_0x1fb2b5);})[_0xb47a('0xd')](function(_0x3bc502){_0x18ae51(_0x3bc502[_0xb47a('0x11')]);});});}function getEndUser(_0x38332a,_0x1f2437,_0x5ec6c5,_0x1d947a,_0x22a189,_0x2517f9,_0x538c59){var _0x169c38=_0x2517f9[_0xb47a('0x2d')]()==='outbound'?_0x22a189['destcalleridnum']:_0x22a189[_0xb47a('0x26')];return getAuthToken(_0x1f2437,_0x5ec6c5,_0x2517f9)['then'](function(_0x315d83){var _0x114ffc={'method':'GET','uri':_0x1d947a+_0xb47a('0x2e')+_0x169c38[_0xb47a('0x2f')]('+',_0xb47a('0x30'))+'\x27','headers':{'Authorization':_0xb47a('0x14')+_0x315d83,'If-None-Match':null,'OData-Version':_0xb47a('0x15')},'json':!![]};return rp(_0x114ffc);})[_0xb47a('0xc')](function(_0x2abd7f){var _0x300961=![];if(!_0x2abd7f)return _0x300961;var _0x17905f=_0x2abd7f[_0xb47a('0x16')];for(var _0x48dac1=0x0;_0x48dac1<_0x17905f[_0xb47a('0x1b')];_0x48dac1++){if(_0x17905f[_0x48dac1]['telephone1']===_0x169c38){_0x300961=!![];_0x38332a['enduserId']=_0x17905f[_0x48dac1][_0xb47a('0x31')];}}return _0x300961;})[_0xb47a('0xc')](function(_0x174f46){if(_0x174f46)return _0x38332a;if(_0x538c59===_0xb47a('0x32')){logger[_0xb47a('0x1e')]('['+[_0x2517f9[_0xb47a('0xf')]()]+_0xb47a('0x33'));return _0x38332a;}return createEndUser(_0x38332a,_0x1f2437,_0x5ec6c5,_0x1d947a,_0x22a189,_0x2517f9)[_0xb47a('0xc')](function(_0x3b3d5d){logger['info']('['+[_0x2517f9['toUpperCase']()]+_0xb47a('0x34'),_0x3b3d5d[_0xb47a('0x2c')]);return _0x3b3d5d;});});}function getCustomFields(_0x391bb6,_0x253ba1,_0xfac48a){var _0x354e89={};if(_0x391bb6['length']>0x0){_[_0xb47a('0x35')](_0x391bb6,function(_0x1be8e6){if(_[_0xb47a('0x36')]([_0xb47a('0x37'),'picklist'],_0x1be8e6[_0xb47a('0x38')])&&_0x1be8e6[_0xb47a('0x39')]&&!_0x1be8e6[_0xb47a('0x3a')]){var _0x162721=_0x1be8e6['idField']['toLowerCase']();var _0x376f0e=_0x162721[_0xb47a('0x2a')](0x0,_0x162721[_0xb47a('0x3b')]('_'));var _0x8f49ef=_0x162721['substring'](_0x162721[_0xb47a('0x3b')]('_')+0x1);if(_0x376f0e===_0xfac48a){_0x354e89[_0x8f49ef]=_0x1be8e6['content'];}}});}return _0x354e89;}function getTicket(_0x209699,_0x2675bc,_0x1212d5,_0x510e6f,_0x3ce76e,_0x345e1f,_0x486eca){return new BPromise(function(_0x1d579e,_0x5c1495){var _0x1d8ac6;return getAuthToken(_0x2675bc,_0x1212d5,_0x486eca)[_0xb47a('0xc')](function(_0x120cc3){if(_0x345e1f[_0xb47a('0x3c')]===_0xb47a('0x3d')){_0x1d8ac6={'method':_0xb47a('0x27'),'uri':_0x510e6f+_0xb47a('0x3e'),'body':Object[_0xb47a('0x3f')]({},{'title':intUtil[_0xb47a('0x40')](_0x345e1f['Subjects'],_0x3ce76e,'\x20'),'description':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x41')],_0x3ce76e,'\x0a'),'customerid_contact@odata.bind':_0x209699[_0xb47a('0x2c')]?_0xb47a('0x42')+_0x209699['enduserId']+')':undefined,'ownerid@odata.bind':_0xb47a('0x43')+_0x209699[_0xb47a('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x345e1f['Fields'],_0x3ce76e,_0x345e1f[_0xb47a('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x120cc3,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x345e1f['ticketType']===_0xb47a('0x44')){var _0x57d180=_0x209699[_0xb47a('0x2c')]?[{'partyid_systemuser@odata.bind':_0xb47a('0x43')+_0x209699[_0xb47a('0x21')]+')','participationtypemask':_0x209699['callDirection']===_0xb47a('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xb47a('0x42')+_0x209699[_0xb47a('0x2c')]+')','participationtypemask':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb47a('0x43')+_0x209699['userId']+')','participationtypemask':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?0x2:0x1}];_0x1d8ac6={'method':_0xb47a('0x27'),'uri':_0x510e6f+_0xb47a('0x47'),'body':Object[_0xb47a('0x3f')]({},{'subject':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x48')],_0x3ce76e,'\x20'),'phonenumber':String(_0x3ce76e[_0xb47a('0x26')]),'description':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x41')],_0x3ce76e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x209699[_0xb47a('0x2c')]?_0xb47a('0x42')+_0x209699[_0xb47a('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x209699[_0xb47a('0x21')]+')','directioncode':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?![]:!![],'phonecall_activity_parties':_0x57d180},getCustomFields(_0x345e1f[_0xb47a('0x49')],_0x3ce76e,_0x345e1f['ticketType'])),'headers':{'Authorization':_0xb47a('0x14')+_0x120cc3,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d8ac6);})[_0xb47a('0xc')](function(_0x461afa){var _0xaa1f41=_0x461afa[_0xb47a('0x28')][_0xb47a('0x29')];var _0x22a8d6=_0xaa1f41[_0xb47a('0x2a')](_0xaa1f41[_0xb47a('0x2b')]('(')+0x1,_0xaa1f41[_0xb47a('0x2b')](')'));_0x209699[_0xb47a('0x4a')]=_0x22a8d6;_0x1d579e(_0x209699);})[_0xb47a('0xd')](function(_0xbfd34e){_0x5c1495(_0xbfd34e[_0xb47a('0x11')]);});});}function emit(_0x4008ca,_0x301c9e,_0x224752,_0x14c61a){var _0x1ebb55={'uri':util['format'](_0xb47a('0x4b'),_0x4008ca,_0x224752,_0x14c61a)};io['to'](util[_0xb47a('0x4c')](_0xb47a('0x4d'),_0x301c9e))[_0xb47a('0x4e')](_0xb47a('0x4f'),_0x1ebb55);}exports['cs']=function(_0x16d0e4,_0x446887,_0x2b37a8,_0x59640b,_0xc955aa,_0x15f4a1,_0x16e3a6,_0x28c1eb){var _0x2b00ab={};_0x15f4a1['remoteUri']=intUtil[_0xb47a('0x50')](_0x15f4a1[_0xb47a('0xa')]);_0x15f4a1[_0xb47a('0x51')]=intUtil[_0xb47a('0x50')](_0x15f4a1[_0xb47a('0x51')]);_0x2b00ab[_0xb47a('0x46')]=_0x28c1eb==='queue'||_0x28c1eb===_0xb47a('0x52')?_0xb47a('0x45'):_0xb47a('0x24');var _0x5ebd08=util[_0xb47a('0x4c')](_0xb47a('0x53'),_0x15f4a1[_0xb47a('0xa')]);var _0x20baa0=util[_0xb47a('0x4c')](_0xb47a('0x54'),_0x15f4a1[_0xb47a('0x55')]);var _0x9b7818=util[_0xb47a('0x4c')](_0xb47a('0x56'),_0x15f4a1['serverUrl'],_0x446887[_0xb47a('0x57')],md5(_0x446887['uniqueid']));if(_0xc955aa&&_0xc955aa[_0xb47a('0x58')]){logger[_0xb47a('0x1e')](_0xb47a('0x59'),_0xb47a('0x5a'));_0x446887['recordingURL']=_0x9b7818;}else if(_0x16e3a6&&_0x16e3a6[_0xb47a('0x5b')]&&_0x16e3a6[_0xb47a('0x5b')]!=='none'){logger['info'](_0xb47a('0x5c'),_0xb47a('0x5a'));_0x446887[_0xb47a('0x5d')]=_0x9b7818;}else{_0x446887[_0xb47a('0x5d')]='';}return getUser(_0x2b00ab,_0x15f4a1,_0x59640b,_0x20baa0,_0x5ebd08,_0x28c1eb)[_0xb47a('0xc')](function(_0x58dfb2){logger['info']('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x5e'),_0x58dfb2[_0xb47a('0x21')]);logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+']\x20The\x20User\x20email\x20is:',_0x58dfb2[_0xb47a('0x1a')]);return getEndUser(_0x58dfb2,_0x15f4a1,_0x20baa0,_0x5ebd08,_0x446887,_0x28c1eb,_0x2b37a8[_0xb47a('0x5f')]);})[_0xb47a('0xc')](function(_0x10f806){logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x60'),_0x10f806['enduserId']);logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x446887[_0xb47a('0x26')]);return getTicket(_0x10f806,_0x15f4a1,_0x20baa0,_0x5ebd08,_0x446887,_0x2b37a8,_0x28c1eb);})['then'](function(_0x36d969){logger[_0xb47a('0x1e')](util[_0xb47a('0x4c')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x61'),_0x2b37a8['ticketType'],_0x36d969[_0xb47a('0x4a')]));logger[_0xb47a('0x1e')](util[_0xb47a('0x4c')]('['+_0x28c1eb['toUpperCase']()+_0xb47a('0x62'),_0x28c1eb));if(_0x28c1eb!==_0xb47a('0x52')){logger['info']('['+_0x28c1eb[_0xb47a('0xf')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x15f4a1[_0xb47a('0xa')],_0x59640b[_0xb47a('0x63')],_0x2b37a8['ticketType'],_0x36d969[_0xb47a('0x4a')]);}})['catch'](function(_0x48685a){logger[_0xb47a('0xe')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x64'),util[_0xb47a('0x65')](_0x48685a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xdde8=['value','isNil','validateEmail','userEmail','internalemailaddress','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','username','length','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','toLowerCase','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','customField','indexOf','content','ticketType','incident','POST','assign','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','Fields','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','ioredis','../../../../config/logger','dynamics365','defaults','socket.io-emitter','redis','clientId','remoteUri','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x23940b,_0x58b123){var _0x43f68b=function(_0x44ab3d){while(--_0x44ab3d){_0x23940b['push'](_0x23940b['shift']());}};_0x43f68b(++_0x58b123);}(_0xdde8,0x107));var _0x8dde=function(_0x3f89a1,_0x3edfcb){_0x3f89a1=_0x3f89a1-0x0;var _0x1995e7=_0xdde8[_0x3f89a1];return _0x1995e7;};'use strict';var _=require(_0x8dde('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x8dde('0x1'));var logger=require(_0x8dde('0x2'))(_0x8dde('0x3'));var config=require('../../../../config/environment');config['redis']=_[_0x8dde('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8dde('0x5'))(new Redis(config[_0x8dde('0x6')]));function getAuthToken(_0x59021c,_0x58c9bc,_0xb52d2e){var _0x45a779={'method':'POST','uri':_0x58c9bc,'form':{'client_id':_0x59021c[_0x8dde('0x7')],'resource':_0x59021c[_0x8dde('0x8')],'username':_0x59021c['username'],'password':_0x59021c['password'],'grant_type':_0x8dde('0x9'),'client_secret':_0x59021c[_0x8dde('0xa')]},'json':!![]};return rp(_0x45a779)[_0x8dde('0xb')](function(_0x4ba088){return _0x4ba088[_0x8dde('0xc')];})[_0x8dde('0xd')](function(_0x3d703f){logger[_0x8dde('0xe')]('['+[_0xb52d2e[_0x8dde('0xf')]()]+_0x8dde('0x10'));return _0x3d703f[_0x8dde('0x11')];});}function getUser(_0x2c09a9,_0x2c8d32,_0x26aa07,_0x3e1b7d,_0x52d0eb,_0x92a09d){return new BPromise(function(_0x7598f2,_0x50568b){return getAuthToken(_0x2c8d32,_0x3e1b7d,_0x92a09d)[_0x8dde('0xb')](function(_0x98e3bf){var _0x42abcc={'method':_0x8dde('0x12'),'uri':_0x52d0eb+_0x8dde('0x13'),'headers':{'Authorization':_0x8dde('0x14')+_0x98e3bf,'OData-Version':_0x8dde('0x15')},'json':!![]};return rp(_0x42abcc);})[_0x8dde('0xb')](function(_0x3b4220){var _0x3496dd=_0x3b4220[_0x8dde('0x16')];var _0x34aa32=![];var _0x24b546=null;if(!_[_0x8dde('0x17')](_0x26aa07)){if(intUtil[_0x8dde('0x18')](_0x26aa07['email'])){_0x2c09a9[_0x8dde('0x19')]=_0x26aa07['email'];for(_0x24b546=0x0;_0x24b546<_0x3496dd['length'];_0x24b546++){if(_0x3496dd[_0x24b546][_0x8dde('0x1a')]===_0x26aa07[_0x8dde('0x1b')]&&!_0x3496dd[_0x24b546][_0x8dde('0x1c')]){_0x34aa32=!![];logger[_0x8dde('0x1d')]('['+[_0x92a09d['toUpperCase']()]+_0x8dde('0x1e')+_0x3496dd[_0x24b546][_0x8dde('0x1f')]+'!');_0x2c09a9[_0x8dde('0x20')]=_0x3496dd[_0x24b546]['systemuserid'];}}}}if(!_0x34aa32){logger[_0x8dde('0x1d')]('['+[_0x92a09d['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2c09a9[_0x8dde('0x19')]=_0x2c8d32[_0x8dde('0x21')];for(_0x24b546=0x0;_0x24b546<_0x3496dd[_0x8dde('0x22')];_0x24b546++){if(_0x3496dd[_0x24b546][_0x8dde('0x1a')]===_0x2c8d32[_0x8dde('0x21')]){_0x2c09a9[_0x8dde('0x20')]=_0x3496dd[_0x24b546][_0x8dde('0x1f')];}}}_0x7598f2(_0x2c09a9);})[_0x8dde('0xd')](function(_0x4fd6fc){_0x50568b(_0x4fd6fc[_0x8dde('0x11')]);});});}function createEndUser(_0xade811,_0x23b117,_0x2a6fa1,_0x326283,_0x36f612,_0x221496){return new BPromise(function(_0x26d816,_0x482c10){return getAuthToken(_0x23b117,_0x2a6fa1,_0x221496)[_0x8dde('0xb')](function(_0xfd4120){var _0x4497a6=_0x221496['toLowerCase']()==='outbound'?_0x36f612['destcalleridnum']:_0x36f612[_0x8dde('0x23')];var _0x5f0370={'method':'POST','uri':_0x326283+_0x8dde('0x24'),'body':{'telephone1':_0x4497a6,'fullname':_0x4497a6,'firstname':_0x4497a6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8dde('0x25')+_0xade811[_0x8dde('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xfd4120,'OData-Version':_0x8dde('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5f0370);})[_0x8dde('0xb')](function(_0x20d332){var _0x255492=_0x20d332[_0x8dde('0x26')][_0x8dde('0x27')];var _0x56dc6b=_0x255492[_0x8dde('0x28')](_0x255492[_0x8dde('0x29')]('(')+0x1,_0x255492['lastIndexOf'](')'));_0xade811['enduserId']=_0x56dc6b;_0x26d816(_0xade811);})['catch'](function(_0xaf9bf6){_0x482c10(_0xaf9bf6['message']);});});}function getEndUser(_0x20e64f,_0x262f2a,_0x21aff2,_0x4c2b4f,_0x225c25,_0x14d76f,_0x30ac4a){var _0x106f69=_0x14d76f[_0x8dde('0x2a')]()==='outbound'?_0x225c25['destcalleridnum']:_0x225c25['calleridnum'];return getAuthToken(_0x262f2a,_0x21aff2,_0x14d76f)[_0x8dde('0xb')](function(_0x11704e){var _0xb66bd0={'method':_0x8dde('0x12'),'uri':_0x4c2b4f+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x106f69[_0x8dde('0x2b')]('+',_0x8dde('0x2c'))+'\x27','headers':{'Authorization':_0x8dde('0x14')+_0x11704e,'If-None-Match':null,'OData-Version':_0x8dde('0x15')},'json':!![]};return rp(_0xb66bd0);})[_0x8dde('0xb')](function(_0x6ce8f8){var _0x3c3202=![];if(!_0x6ce8f8)return _0x3c3202;var _0x517195=_0x6ce8f8[_0x8dde('0x16')];for(var _0x43e33b=0x0;_0x43e33b<_0x517195['length'];_0x43e33b++){if(_0x517195[_0x43e33b]['telephone1']===_0x106f69){_0x3c3202=!![];_0x20e64f[_0x8dde('0x2d')]=_0x517195[_0x43e33b][_0x8dde('0x2e')];}}return _0x3c3202;})[_0x8dde('0xb')](function(_0x58ecb6){if(_0x58ecb6)return _0x20e64f;if(_0x30ac4a===_0x8dde('0x2f')){logger[_0x8dde('0x1d')]('['+[_0x14d76f[_0x8dde('0xf')]()]+_0x8dde('0x30'));return _0x20e64f;}return createEndUser(_0x20e64f,_0x262f2a,_0x21aff2,_0x4c2b4f,_0x225c25,_0x14d76f)['then'](function(_0xd37423){logger['info']('['+[_0x14d76f[_0x8dde('0xf')]()]+_0x8dde('0x31'),_0xd37423['enduserId']);return _0xd37423;});});}function getCustomFields(_0x518652,_0x3e682f,_0xbac46b){var _0x51f2dd={};if(_0x518652[_0x8dde('0x22')]>0x0){_['forEach'](_0x518652,function(_0x2dd761){if(_[_0x8dde('0x32')]([_0x8dde('0x33'),_0x8dde('0x34')],_0x2dd761[_0x8dde('0x35')])&&_0x2dd761['nameField']&&!_0x2dd761[_0x8dde('0x36')]){var _0x5a4e59=_0x2dd761['idField']['toLowerCase']();var _0x1fd0d1=_0x5a4e59[_0x8dde('0x28')](0x0,_0x5a4e59[_0x8dde('0x37')]('_'));var _0x16eedf=_0x5a4e59[_0x8dde('0x28')](_0x5a4e59[_0x8dde('0x37')]('_')+0x1);if(_0x1fd0d1===_0xbac46b){_0x51f2dd[_0x16eedf]=_0x2dd761[_0x8dde('0x38')];}}});}return _0x51f2dd;}function getTicket(_0x25d3c7,_0x3f9d43,_0x78448a,_0x3503cc,_0x4fde37,_0x9badd7,_0x211bba){return new BPromise(function(_0x309628,_0x22aa79){var _0x4df657;return getAuthToken(_0x3f9d43,_0x78448a,_0x211bba)['then'](function(_0x3c159b){if(_0x9badd7[_0x8dde('0x39')]===_0x8dde('0x3a')){_0x4df657={'method':_0x8dde('0x3b'),'uri':_0x3503cc+'incidents','body':Object[_0x8dde('0x3c')]({},{'title':intUtil[_0x8dde('0x3d')](_0x9badd7[_0x8dde('0x3e')],_0x4fde37,'\x20'),'description':intUtil[_0x8dde('0x3d')](_0x9badd7[_0x8dde('0x3f')],_0x4fde37,'\x0a'),'customerid_contact@odata.bind':_0x25d3c7[_0x8dde('0x2d')]?_0x8dde('0x40')+_0x25d3c7['enduserId']+')':undefined,'ownerid@odata.bind':_0x8dde('0x25')+_0x25d3c7['userId']+')','caseorigincode':'1'},getCustomFields(_0x9badd7['Fields'],_0x4fde37,_0x9badd7[_0x8dde('0x39')])),'headers':{'Authorization':_0x8dde('0x14')+_0x3c159b,'OData-Version':_0x8dde('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x9badd7['ticketType']===_0x8dde('0x41')){var _0x5420d9=_0x25d3c7[_0x8dde('0x2d')]?[{'partyid_systemuser@odata.bind':_0x8dde('0x25')+_0x25d3c7[_0x8dde('0x20')]+')','participationtypemask':_0x25d3c7[_0x8dde('0x42')]===_0x8dde('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x25d3c7[_0x8dde('0x2d')]+')','participationtypemask':_0x25d3c7[_0x8dde('0x42')]===_0x8dde('0x43')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x8dde('0x25')+_0x25d3c7[_0x8dde('0x20')]+')','participationtypemask':_0x25d3c7[_0x8dde('0x42')]==='queue'?0x2:0x1}];_0x4df657={'method':_0x8dde('0x3b'),'uri':_0x3503cc+_0x8dde('0x44'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x9badd7[_0x8dde('0x3e')],_0x4fde37,'\x20'),'phonenumber':String(_0x4fde37[_0x8dde('0x23')]),'description':intUtil[_0x8dde('0x3d')](_0x9badd7[_0x8dde('0x3f')],_0x4fde37,'\x0a'),'regardingobjectid_contact@odata.bind':_0x25d3c7[_0x8dde('0x2d')]?'/contacts('+_0x25d3c7[_0x8dde('0x2d')]+')':undefined,'ownerid@odata.bind':_0x8dde('0x25')+_0x25d3c7[_0x8dde('0x20')]+')','directioncode':_0x25d3c7[_0x8dde('0x42')]===_0x8dde('0x43')?![]:!![],'phonecall_activity_parties':_0x5420d9},getCustomFields(_0x9badd7[_0x8dde('0x45')],_0x4fde37,_0x9badd7[_0x8dde('0x39')])),'headers':{'Authorization':_0x8dde('0x14')+_0x3c159b,'OData-Version':_0x8dde('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4df657);})[_0x8dde('0xb')](function(_0x115da7){var _0xfcc9c5=_0x115da7['headers']['odata-entityid'];var _0xda4d7a=_0xfcc9c5[_0x8dde('0x28')](_0xfcc9c5[_0x8dde('0x29')]('(')+0x1,_0xfcc9c5[_0x8dde('0x29')](')'));_0x25d3c7[_0x8dde('0x46')]=_0xda4d7a;_0x309628(_0x25d3c7);})[_0x8dde('0xd')](function(_0x124453){_0x22aa79(_0x124453[_0x8dde('0x11')]);});});}function emit(_0x4a6e34,_0x1a6643,_0x11aa2c,_0xd531ce){var _0x58e948={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4a6e34,_0x11aa2c,_0xd531ce)};io['to'](util[_0x8dde('0x47')](_0x8dde('0x48'),_0x1a6643))[_0x8dde('0x49')](_0x8dde('0x4a'),_0x58e948);}exports['cs']=function(_0x4d6e8f,_0x29b4fe,_0x2becb6,_0x543a3f,_0x2bbb4f,_0x14428c,_0x541935,_0x209812){var _0x49b453={};_0x14428c[_0x8dde('0x8')]=intUtil[_0x8dde('0x4b')](_0x14428c[_0x8dde('0x8')]);_0x14428c[_0x8dde('0x4c')]=intUtil[_0x8dde('0x4b')](_0x14428c['serverUrl']);_0x49b453[_0x8dde('0x42')]=_0x209812===_0x8dde('0x43')||_0x209812==='unmanaged'?_0x8dde('0x43'):_0x8dde('0x4d');var _0x3d8968=util[_0x8dde('0x47')](_0x8dde('0x4e'),_0x14428c[_0x8dde('0x8')]);var _0x3a05ed=util[_0x8dde('0x47')]('https://login.microsoftonline.com/%s/oauth2/token',_0x14428c[_0x8dde('0x4f')]);var _0x3c3b83=util[_0x8dde('0x47')](_0x8dde('0x50'),_0x14428c['serverUrl'],_0x29b4fe[_0x8dde('0x51')],md5(_0x29b4fe['uniqueid']));if(_0x2bbb4f&&_0x2bbb4f[_0x8dde('0x52')]){logger['info'](_0x8dde('0x53'),_0x8dde('0x54'));_0x29b4fe['recordingURL']=_0x3c3b83;}else if(_0x541935&&_0x541935[_0x8dde('0x55')]&&_0x541935[_0x8dde('0x55')]!==_0x8dde('0x56')){logger['info'](_0x8dde('0x57'),_0x8dde('0x54'));_0x29b4fe[_0x8dde('0x58')]=_0x3c3b83;}else{_0x29b4fe[_0x8dde('0x58')]='';}return getUser(_0x49b453,_0x14428c,_0x543a3f,_0x3a05ed,_0x3d8968,_0x209812)[_0x8dde('0xb')](function(_0x56ee87){logger[_0x8dde('0x1d')]('['+_0x209812['toUpperCase']()+_0x8dde('0x59'),_0x56ee87['userId']);logger[_0x8dde('0x1d')]('['+_0x209812[_0x8dde('0xf')]()+_0x8dde('0x5a'),_0x56ee87[_0x8dde('0x19')]);return getEndUser(_0x56ee87,_0x14428c,_0x3a05ed,_0x3d8968,_0x29b4fe,_0x209812,_0x2becb6[_0x8dde('0x5b')]);})[_0x8dde('0xb')](function(_0x3fd783){logger[_0x8dde('0x1d')]('['+_0x209812['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x3fd783[_0x8dde('0x2d')]);logger[_0x8dde('0x1d')]('['+_0x209812['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x29b4fe['calleridnum']);return getTicket(_0x3fd783,_0x14428c,_0x3a05ed,_0x3d8968,_0x29b4fe,_0x2becb6,_0x209812);})[_0x8dde('0xb')](function(_0x2e2ae7){logger['info'](util['format']('['+_0x209812['toUpperCase']()+_0x8dde('0x5c'),_0x2becb6['ticketType'],_0x2e2ae7[_0x8dde('0x46')]));logger[_0x8dde('0x1d')](util[_0x8dde('0x47')]('['+_0x209812[_0x8dde('0xf')]()+']\x20Call\x20direction:\x20%s',_0x209812));if(_0x209812!=='unmanaged'){logger[_0x8dde('0x1d')]('['+_0x209812[_0x8dde('0xf')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x14428c['remoteUri'],_0x543a3f[_0x8dde('0x5d')],_0x2becb6[_0x8dde('0x39')],_0x2e2ae7[_0x8dde('0x46')]);}})['catch'](function(_0x349fdd){logger[_0x8dde('0xe')]('['+_0x209812['toUpperCase']()+_0x8dde('0x5e'),util['inspect'](_0x349fdd,{'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 cbbdd64..520fe6f 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 _0x2c29=['Enduser\x20created.','Basic\x20%s','toString','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','The\x20User\x20ID\x20is:','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','Agent\x20found!','find','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x13cfb5,_0x1b6568){var _0x4e86b8=function(_0x11a361){while(--_0x11a361){_0x13cfb5['push'](_0x13cfb5['shift']());}};_0x4e86b8(++_0x1b6568);}(_0x2c29,0x8d));var _0x92c2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2c29[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x92c2('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x92c2('0x1'));var Redis=require(_0x92c2('0x2'));var intUtil=require(_0x92c2('0x3'));var config=require(_0x92c2('0x4'));var logger=require('../../../../config/logger')(_0x92c2('0x5'));config[_0x92c2('0x6')]=_[_0x92c2('0x7')](config['redis'],{'host':_0x92c2('0x8'),'port':0x18eb});var io=require(_0x92c2('0x9'))(new Redis(config[_0x92c2('0x6')]));var headers={'Content-Type':_0x92c2('0xa'),'Accept':_0x92c2('0xa')};function emit(_0x3f429a,_0x5bbaad,_0x265842){io['to'](_0x3f429a)[_0x92c2('0xb')](_0x5bbaad,_0x265842);}function getTicket(_0x290a6e,_0x5aee13,_0x285257,_0x1ba4bb,_0x454626){logger['info'](_0x92c2('0xc'));var _0x569cc5=_[_0x92c2('0xd')]({'responder_id':_0x5aee13['id'],'requester_id':_0x285257['id'],'name':util[_0x92c2('0xe')](_0x92c2('0xf'),_0x454626['calleridname']),'phone':_0x454626[_0x92c2('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x92c2('0x11')](_0x1ba4bb[_0x92c2('0x12')],_0x454626,'\x20'),'description':intUtil[_0x92c2('0x11')](_0x1ba4bb[_0x92c2('0x13')],_0x454626,'
'),'tags':getTags(_0x1ba4bb[_0x92c2('0x14')],_0x92c2('0x15'))},getCustomFields(_0x1ba4bb[_0x92c2('0x16')],_0x454626));_0x569cc5[_0x92c2('0x17')]=_[_0x92c2('0x18')](_[_0x92c2('0x19')](_0x569cc5['custom_fields'],'id'),_0x92c2('0x1a'));return request({'uri':util['format'](_0x92c2('0x1b'),_0x290a6e[_0x92c2('0x1c')]),'method':_0x92c2('0x1d'),'body':_0x569cc5})[_0x92c2('0x1e')](function(_0x4b84ff){logger['info'](_0x92c2('0x1f'));return _0x4b84ff;});}function getUser(_0x330f8e,_0x48cc5d){if(intUtil[_0x92c2('0x20')](_0x48cc5d)){return request({'uri':util[_0x92c2('0xe')]('%s/api/v2/agents',_0x330f8e[_0x92c2('0x1c')]),'qs':{'email':_0x48cc5d}})[_0x92c2('0x1e')](function(_0x3d1900){if(_0x3d1900['length']){logger['info'](_0x92c2('0x21'));return _[_0x92c2('0x22')](_0x3d1900,function(_0x12d4fa){return _0x12d4fa['contact']['email']===_0x48cc5d;});}else{logger[_0x92c2('0x23')](_0x92c2('0x24'));return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x25'),_0x330f8e['remoteUri'])})['then'](function(_0x5e689f){logger[_0x92c2('0x23')](_0x92c2('0x26'));return _0x5e689f;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x25'),_0x330f8e[_0x92c2('0x1c')])})[_0x92c2('0x1e')](function(_0x593637){logger[_0x92c2('0x23')](_0x92c2('0x26'));return _0x593637;});}}function getEndUser(_0x599558,_0x1d72f2,_0x41d4fe){logger['info']('Searching\x20enduser\x20with\x20phone',_0x41d4fe);return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x27'),_0x599558[_0x92c2('0x1c')]),'qs':{'phone':_0x41d4fe}})[_0x92c2('0x1e')](function(_0x4c21fa){if(_0x4c21fa[_0x92c2('0x28')]){logger[_0x92c2('0x23')](_0x92c2('0x29'));return _[_0x92c2('0x22')](_0x4c21fa,{'phone':_0x41d4fe});}else{logger[_0x92c2('0x23')](_0x92c2('0x2a'));return request({'uri':util[_0x92c2('0xe')]('%s/api/v2/contacts',_0x599558[_0x92c2('0x1c')]),'method':'POST','body':{'name':_0x1d72f2,'phone':_0x41d4fe}})[_0x92c2('0x1e')](function(_0xedd020){logger[_0x92c2('0x23')](_0x92c2('0x2b'));return _0xedd020;});}});}function getAuth(_0x22a107){return util[_0x92c2('0xe')](_0x92c2('0x2c'),new Buffer(_0x22a107['apiKey']+':X')[_0x92c2('0x2d')]('base64'));}function request(_0x514f7e){logger['debug'](_0x92c2('0x2e'),JSON[_0x92c2('0x2f')](_0x514f7e));return rp(_[_0x92c2('0x7')](_0x514f7e,{'method':_0x92c2('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2d7633,_0x2ea21b){var _0x4bb3fa=[];if(_0x2d7633&&_0x2d7633[_0x92c2('0x28')]>0x0){_0x4bb3fa=_[_0x92c2('0x31')](_0x2d7633,_0x2ea21b);}return _0x4bb3fa;}function getCustomFields(_0x4bfbcb,_0x4f81d3){var _0x51e176=[];var _0x451db0={'custom_fields':[]};if(_0x4bfbcb[_0x92c2('0x28')]>0x0){_[_0x92c2('0x32')](_0x4bfbcb,function(_0x401c49){if(_[_0x92c2('0x33')]([_0x92c2('0x34'),_0x92c2('0x35')],_0x401c49[_0x92c2('0x36')])&&_0x401c49['nameField']&&!_0x401c49[_0x92c2('0x37')]){_0x451db0[_0x401c49['nameField'][_0x92c2('0x38')]()]=_0x401c49[_0x92c2('0x39')][_0x92c2('0x2d')]();}else if(_['includes'](['string',_0x92c2('0x35')],_0x401c49[_0x92c2('0x36')])&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x451db0[_0x92c2('0x17')][_0x92c2('0x3b')]({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x401c49['content'][_0x92c2('0x2d')]()});}else if(_0x401c49[_0x92c2('0x36')]===_0x92c2('0x3c')&&_0x401c49['variableName']&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x4f81d3[_0x401c49[_0x92c2('0x3d')]]&&_0x451db0[_0x92c2('0x17')]['push']({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x4f81d3[_0x401c49[_0x92c2('0x3d')]][_0x92c2('0x2d')]()});}else if(_0x401c49[_0x92c2('0x36')]===_0x92c2('0x3e')&&_0x401c49[_0x92c2('0x3f')]&&_0x401c49[_0x92c2('0x3f')][_0x92c2('0x15')]&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x4f81d3[_0x401c49['Variable']['name'][_0x92c2('0x38')]()]&&_0x451db0[_0x92c2('0x17')][_0x92c2('0x3b')]({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x4f81d3[_0x401c49[_0x92c2('0x3f')][_0x92c2('0x15')][_0x92c2('0x38')]()][_0x92c2('0x2d')]()});}});}return _0x451db0;}exports[_0x92c2('0x40')]=function(_0x413ada,_0x7c6d73,_0x29d90a,_0xa590eb,_0x32de0a,_0x3f2fe5){var _0x359dc6,_0xbbf237;_0x3f2fe5['remoteUri']=intUtil[_0x92c2('0x41')](_0x3f2fe5['remoteUri']);_0x3f2fe5[_0x92c2('0x42')]=intUtil[_0x92c2('0x41')](_0x3f2fe5[_0x92c2('0x42')]);if(_0x32de0a&&_0x32de0a[_0x92c2('0x43')]){logger[_0x92c2('0x23')](_0x92c2('0x44'),_0x92c2('0x45'));_0x7c6d73[_0x92c2('0x46')]=util[_0x92c2('0xe')](_0x92c2('0x47'),_0x3f2fe5[_0x92c2('0x42')],_0x7c6d73[_0x92c2('0x48')],md5(_0x7c6d73[_0x92c2('0x48')]));}else{_0x7c6d73[_0x92c2('0x46')]='';}headers[_0x92c2('0x49')]=getAuth(_0x3f2fe5);return getUser(_0x3f2fe5,_0xa590eb[_0x92c2('0x4a')])[_0x92c2('0x1e')](function(_0x470ac3){_0x359dc6=_0x470ac3;logger[_0x92c2('0x23')]('The\x20User\x20ID\x20is:',_0x359dc6['id']);return getEndUser(_0x3f2fe5,_0x7c6d73[_0x92c2('0x4b')],_0x7c6d73['calleridnum']);})[_0x92c2('0x1e')](function(_0x1c287d){_0xbbf237=_0x1c287d;logger[_0x92c2('0x23')](_0x92c2('0x4c'),_0xbbf237['id']);return getTicket(_0x3f2fe5,_0x359dc6,_0xbbf237,_0x29d90a,_0x7c6d73);})['then'](function(_0x2ffec2){if(_0x2ffec2&&_0x2ffec2['id']){logger[_0x92c2('0x23')]('Ticket\x20created!');logger[_0x92c2('0x23')]('The\x20Ticket\x20ID\x20is:',_0x2ffec2['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x92c2('0xe')](_0x92c2('0x4d'),_0xa590eb[_0x92c2('0x15')]),_0x92c2('0x4e'),{'uri':util['format'](_0x92c2('0x4f'),_0x3f2fe5[_0x92c2('0x1c')],_0x2ffec2['id'])});}})[_0x92c2('0x50')](function(_0x42946a){logger[_0x92c2('0x51')]('[QUEUE]',JSON[_0x92c2('0x2f')](_0x42946a));});};exports[_0x92c2('0x52')]=function(_0x204e2f,_0x30e445,_0x4f83fa,_0x40c22d,_0x559a4b,_0x129eea,_0x4aa9be){var _0x1b680f,_0x3d098a;_0x129eea[_0x92c2('0x1c')]=intUtil['stripTrailingSlash'](_0x129eea[_0x92c2('0x1c')]);_0x129eea['serverUrl']=intUtil[_0x92c2('0x41')](_0x129eea[_0x92c2('0x42')]);if(_0x4aa9be&&_0x4aa9be['recordingFormat']&&_0x4aa9be['recordingFormat']!==_0x92c2('0x53')){logger['info'](_0x92c2('0x54'),_0x92c2('0x45'));_0x30e445[_0x92c2('0x46')]=util['format'](_0x92c2('0x47'),_0x129eea[_0x92c2('0x42')],_0x30e445[_0x92c2('0x48')],md5(_0x30e445[_0x92c2('0x48')]));}headers[_0x92c2('0x49')]=getAuth(_0x129eea);return getUser(_0x129eea,_0x40c22d[_0x92c2('0x4a')])['then'](function(_0x1663b4){_0x1b680f=_0x1663b4;logger[_0x92c2('0x23')]('The\x20User\x20ID\x20is:',_0x1b680f['id']);return getEndUser(_0x129eea,_0x30e445[_0x92c2('0x55')],_0x30e445['destcalleridnum']);})[_0x92c2('0x1e')](function(_0xda1593){_0x3d098a=_0xda1593;logger[_0x92c2('0x23')](_0x92c2('0x4c'),_0x3d098a['id']);return getTicket(_0x129eea,_0x1b680f,_0x3d098a,_0x4f83fa,_0x30e445);})[_0x92c2('0x1e')](function(_0x40f087){if(_0x40f087&&_0x40f087['id']){logger[_0x92c2('0x23')](_0x92c2('0x1f'));logger[_0x92c2('0x23')](_0x92c2('0x56'),_0x40f087['id']);logger[_0x92c2('0x23')](_0x92c2('0x54'),_0x92c2('0x57'));emit(util['format'](_0x92c2('0x4d'),_0x40c22d[_0x92c2('0x15')]),'trigger:browser:url',{'uri':util[_0x92c2('0xe')](_0x92c2('0x4f'),_0x129eea[_0x92c2('0x1c')],_0x40f087['id'])});}})[_0x92c2('0x50')](function(_0xaf7337){logger['error']('[OUTBOUND]',JSON['stringify'](_0xaf7337));});};exports[_0x92c2('0x58')]=function(_0x5df709,_0x27a089,_0x3207f1,_0x2de024,_0x4b04a9,_0x154f8d){var _0x3232b2,_0x17ae42;_0x154f8d[_0x92c2('0x1c')]=intUtil[_0x92c2('0x41')](_0x154f8d[_0x92c2('0x1c')]);_0x154f8d[_0x92c2('0x42')]=intUtil[_0x92c2('0x41')](_0x154f8d[_0x92c2('0x42')]);if(_0x4b04a9&&_0x4b04a9[_0x92c2('0x43')]){logger[_0x92c2('0x23')]('['+_0x27a089['lastevent']['toUpperCase']()+']',_0x92c2('0x45'));_0x27a089['recordingURL']=util[_0x92c2('0xe')](_0x92c2('0x47'),_0x154f8d['serverUrl'],_0x27a089[_0x92c2('0x48')],md5(_0x27a089[_0x92c2('0x48')]));}else{_0x27a089[_0x92c2('0x46')]='';}headers[_0x92c2('0x49')]=getAuth(_0x154f8d);return getUser(_0x154f8d,'')[_0x92c2('0x1e')](function(_0x362006){_0x3232b2=_0x362006;logger['info'](_0x92c2('0x59'),_0x3232b2['id']);return getEndUser(_0x154f8d,_0x27a089['calleridname'],_0x27a089[_0x92c2('0x10')]);})[_0x92c2('0x1e')](function(_0x3a87c5){_0x17ae42=_0x3a87c5;logger[_0x92c2('0x23')]('The\x20Enduser\x20ID\x20is:',_0x17ae42['id']);return getTicket(_0x154f8d,_0x3232b2,_0x17ae42,_0x3207f1,_0x27a089);})[_0x92c2('0x1e')](function(_0xec5b39){if(_0xec5b39){logger[_0x92c2('0x23')]('Ticket\x20created!');logger[_0x92c2('0x23')]('The\x20Ticket\x20ID\x20is:',_0xec5b39['id']);}})[_0x92c2('0x50')](function(_0x43041b){logger['error']('['+_0x27a089[_0x92c2('0x5a')][_0x92c2('0x5b')]()+']',JSON[_0x92c2('0x2f')](_0x43041b));});}; \ No newline at end of file +var _0x697d=['POST','then','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','toLowerCase','content','idField','customField','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','catch','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri'];(function(_0x5aa8e0,_0x1e552c){var _0x4f4060=function(_0x247415){while(--_0x247415){_0x5aa8e0['push'](_0x5aa8e0['shift']());}};_0x4f4060(++_0x1e552c);}(_0x697d,0x1c2));var _0xd697=function(_0x3a1044,_0x26b0c3){_0x3a1044=_0x3a1044-0x0;var _0x37e92d=_0x697d[_0x3a1044];return _0x37e92d;};'use strict';var _=require(_0xd697('0x0'));var rp=require(_0xd697('0x1'));var md5=require(_0xd697('0x2'));var util=require(_0xd697('0x3'));var Redis=require(_0xd697('0x4'));var intUtil=require(_0xd697('0x5'));var config=require(_0xd697('0x6'));var logger=require(_0xd697('0x7'))(_0xd697('0x8'));config[_0xd697('0x9')]=_['defaults'](config[_0xd697('0x9')],{'host':_0xd697('0xa'),'port':0x18eb});var io=require(_0xd697('0xb'))(new Redis(config[_0xd697('0x9')]));var headers={'Content-Type':_0xd697('0xc'),'Accept':_0xd697('0xc')};function emit(_0x4333e2,_0xa5304c,_0x1e34f4){io['to'](_0x4333e2)[_0xd697('0xd')](_0xa5304c,_0x1e34f4);}function getTicket(_0x1551b2,_0x1072ab,_0x378ec0,_0x1b8750,_0x1efb71){logger[_0xd697('0xe')](_0xd697('0xf'));var _0x47767c=_['merge']({'responder_id':_0x1072ab['id'],'requester_id':_0x378ec0['id'],'name':util[_0xd697('0x10')](_0xd697('0x11'),_0x1efb71[_0xd697('0x12')]),'phone':_0x1efb71[_0xd697('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd697('0x14')](_0x1b8750['Subjects'],_0x1efb71,'\x20'),'description':intUtil[_0xd697('0x14')](_0x1b8750[_0xd697('0x15')],_0x1efb71,_0xd697('0x16')),'tags':getTags(_0x1b8750[_0xd697('0x17')],'name')},getCustomFields(_0x1b8750[_0xd697('0x18')],_0x1efb71));_0x47767c['custom_fields']=_['mapValues'](_[_0xd697('0x19')](_0x47767c[_0xd697('0x1a')],'id'),_0xd697('0x1b'));return request({'uri':util[_0xd697('0x10')](_0xd697('0x1c'),_0x1551b2[_0xd697('0x1d')]),'method':_0xd697('0x1e'),'body':_0x47767c})[_0xd697('0x1f')](function(_0x30fecd){logger['info'](_0xd697('0x20'));return _0x30fecd;});}function getUser(_0x3673f0,_0x38f23d){if(intUtil[_0xd697('0x21')](_0x38f23d)){return request({'uri':util[_0xd697('0x10')]('%s/api/v2/agents',_0x3673f0['remoteUri']),'qs':{'email':_0x38f23d}})['then'](function(_0x29e5d7){if(_0x29e5d7['length']){logger[_0xd697('0xe')](_0xd697('0x22'));return _[_0xd697('0x23')](_0x29e5d7,function(_0x51b243){return _0x51b243[_0xd697('0x24')][_0xd697('0x25')]===_0x38f23d;});}else{logger['info'](_0xd697('0x26'));return request({'uri':util['format'](_0xd697('0x27'),_0x3673f0['remoteUri'])})[_0xd697('0x1f')](function(_0x5cb1c5){logger[_0xd697('0xe')](_0xd697('0x28'));return _0x5cb1c5;});}});}else{logger[_0xd697('0xe')](_0xd697('0x29'));return request({'uri':util[_0xd697('0x10')](_0xd697('0x27'),_0x3673f0[_0xd697('0x1d')])})[_0xd697('0x1f')](function(_0x1f4d0f){logger[_0xd697('0xe')]('Admin\x20account\x20selected.');return _0x1f4d0f;});}}function getEndUser(_0x21833e,_0x3d5979,_0x448fca){logger[_0xd697('0xe')](_0xd697('0x2a'),_0x448fca);return request({'uri':util[_0xd697('0x10')](_0xd697('0x2b'),_0x21833e[_0xd697('0x1d')]),'qs':{'phone':_0x448fca}})[_0xd697('0x1f')](function(_0x3675ee){if(_0x3675ee[_0xd697('0x2c')]){logger[_0xd697('0xe')]('Enduser\x20found!');return _[_0xd697('0x23')](_0x3675ee,{'phone':_0x448fca});}else{logger[_0xd697('0xe')](_0xd697('0x2d'));return request({'uri':util[_0xd697('0x10')]('%s/api/v2/contacts',_0x21833e[_0xd697('0x1d')]),'method':_0xd697('0x1e'),'body':{'name':_0x3d5979,'phone':_0x448fca}})[_0xd697('0x1f')](function(_0x16f182){logger[_0xd697('0xe')]('Enduser\x20created.');return _0x16f182;});}});}function getAuth(_0x2f5201){return util[_0xd697('0x10')](_0xd697('0x2e'),new Buffer(_0x2f5201[_0xd697('0x2f')]+':X')[_0xd697('0x30')](_0xd697('0x31')));}function request(_0x5656a8){logger['debug'](_0xd697('0x32'),JSON[_0xd697('0x33')](_0x5656a8));return rp(_[_0xd697('0x34')](_0x5656a8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4866bf,_0x1f5e16){var _0xf4b92f=[];if(_0x4866bf&&_0x4866bf['length']>0x0){_0xf4b92f=_[_0xd697('0x35')](_0x4866bf,_0x1f5e16);}return _0xf4b92f;}function getCustomFields(_0x420150,_0x3665ec){var _0x53c50d=[];var _0x464e21={'custom_fields':[]};if(_0x420150[_0xd697('0x2c')]>0x0){_[_0xd697('0x36')](_0x420150,function(_0x2b30b1){if(_[_0xd697('0x37')]([_0xd697('0x38'),_0xd697('0x39')],_0x2b30b1[_0xd697('0x3a')])&&_0x2b30b1['nameField']&&!_0x2b30b1['customField']){_0x464e21[_0x2b30b1['nameField'][_0xd697('0x3b')]()]=_0x2b30b1[_0xd697('0x3c')][_0xd697('0x30')]();}else if(_['includes'](['string',_0xd697('0x39')],_0x2b30b1[_0xd697('0x3a')])&&_0x2b30b1[_0xd697('0x3d')]&&_0x2b30b1[_0xd697('0x3e')]){_0x464e21['custom_fields']['push']({'id':_0x2b30b1[_0xd697('0x3d')],'value':_0x2b30b1[_0xd697('0x3c')][_0xd697('0x30')]()});}else if(_0x2b30b1['type']==='variable'&&_0x2b30b1[_0xd697('0x3f')]&&_0x2b30b1[_0xd697('0x3d')]&&_0x2b30b1['customField']){_0x3665ec[_0x2b30b1['variableName']]&&_0x464e21[_0xd697('0x1a')][_0xd697('0x40')]({'id':_0x2b30b1[_0xd697('0x3d')],'value':_0x3665ec[_0x2b30b1[_0xd697('0x3f')]][_0xd697('0x30')]()});}else if(_0x2b30b1['type']===_0xd697('0x41')&&_0x2b30b1[_0xd697('0x42')]&&_0x2b30b1[_0xd697('0x42')][_0xd697('0x43')]&&_0x2b30b1[_0xd697('0x3d')]&&_0x2b30b1['customField']){_0x3665ec[_0x2b30b1[_0xd697('0x42')][_0xd697('0x43')][_0xd697('0x3b')]()]&&_0x464e21['custom_fields']['push']({'id':_0x2b30b1['idField'],'value':_0x3665ec[_0x2b30b1[_0xd697('0x42')][_0xd697('0x43')][_0xd697('0x3b')]()]['toString']()});}});}return _0x464e21;}exports[_0xd697('0x44')]=function(_0x336c6c,_0x2eecf1,_0x6965b,_0x78a19,_0x111757,_0x565e99){var _0x170d91,_0x31c428;_0x565e99['remoteUri']=intUtil[_0xd697('0x45')](_0x565e99['remoteUri']);_0x565e99[_0xd697('0x46')]=intUtil[_0xd697('0x45')](_0x565e99[_0xd697('0x46')]);if(_0x111757&&_0x111757[_0xd697('0x47')]){logger['info']('[QUEUE]',_0xd697('0x48'));_0x2eecf1[_0xd697('0x49')]=util['format'](_0xd697('0x4a'),_0x565e99['serverUrl'],_0x2eecf1[_0xd697('0x4b')],md5(_0x2eecf1[_0xd697('0x4b')]));}else{_0x2eecf1[_0xd697('0x49')]='';}headers[_0xd697('0x4c')]=getAuth(_0x565e99);return getUser(_0x565e99,_0x78a19[_0xd697('0x25')])[_0xd697('0x1f')](function(_0x25f88f){_0x170d91=_0x25f88f;logger[_0xd697('0xe')](_0xd697('0x4d'),_0x170d91['id']);return getEndUser(_0x565e99,_0x2eecf1[_0xd697('0x12')],_0x2eecf1['calleridnum']);})[_0xd697('0x1f')](function(_0x1db29d){_0x31c428=_0x1db29d;logger[_0xd697('0xe')]('The\x20Enduser\x20ID\x20is:',_0x31c428['id']);return getTicket(_0x565e99,_0x170d91,_0x31c428,_0x6965b,_0x2eecf1);})[_0xd697('0x1f')](function(_0x4f908c){if(_0x4f908c&&_0x4f908c['id']){logger[_0xd697('0xe')](_0xd697('0x20'));logger[_0xd697('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4f908c['id']);logger[_0xd697('0xe')](_0xd697('0x4e'),_0xd697('0x4f'));emit(util[_0xd697('0x10')]('user:%s',_0x78a19[_0xd697('0x43')]),_0xd697('0x50'),{'uri':util['format'](_0xd697('0x51'),_0x565e99[_0xd697('0x1d')],_0x4f908c['id'])});}})['catch'](function(_0x2591fc){logger[_0xd697('0x52')](_0xd697('0x4e'),JSON['stringify'](_0x2591fc));});};exports[_0xd697('0x53')]=function(_0x1f0efe,_0x3be6c1,_0x31397f,_0x2a27f8,_0xd2c97e,_0x2da74b,_0x410755){var _0x329c7f,_0x17fedd;_0x2da74b[_0xd697('0x1d')]=intUtil[_0xd697('0x45')](_0x2da74b[_0xd697('0x1d')]);_0x2da74b[_0xd697('0x46')]=intUtil[_0xd697('0x45')](_0x2da74b[_0xd697('0x46')]);if(_0x410755&&_0x410755[_0xd697('0x54')]&&_0x410755[_0xd697('0x54')]!==_0xd697('0x55')){logger[_0xd697('0xe')](_0xd697('0x56'),_0xd697('0x48'));_0x3be6c1['recordingURL']=util[_0xd697('0x10')](_0xd697('0x4a'),_0x2da74b['serverUrl'],_0x3be6c1['uniqueid'],md5(_0x3be6c1['uniqueid']));}headers['Authorization']=getAuth(_0x2da74b);return getUser(_0x2da74b,_0x2a27f8[_0xd697('0x25')])[_0xd697('0x1f')](function(_0xbecbb8){_0x329c7f=_0xbecbb8;logger[_0xd697('0xe')]('The\x20User\x20ID\x20is:',_0x329c7f['id']);return getEndUser(_0x2da74b,_0x3be6c1[_0xd697('0x57')],_0x3be6c1[_0xd697('0x58')]);})[_0xd697('0x1f')](function(_0x8f4909){_0x17fedd=_0x8f4909;logger['info'](_0xd697('0x59'),_0x17fedd['id']);return getTicket(_0x2da74b,_0x329c7f,_0x17fedd,_0x31397f,_0x3be6c1);})['then'](function(_0x3cadbd){if(_0x3cadbd&&_0x3cadbd['id']){logger[_0xd697('0xe')]('Ticket\x20created!');logger[_0xd697('0xe')](_0xd697('0x5a'),_0x3cadbd['id']);logger['info'](_0xd697('0x56'),_0xd697('0x4f'));emit(util['format'](_0xd697('0x5b'),_0x2a27f8['name']),_0xd697('0x50'),{'uri':util[_0xd697('0x10')](_0xd697('0x51'),_0x2da74b[_0xd697('0x1d')],_0x3cadbd['id'])});}})['catch'](function(_0x2f525a){logger['error'](_0xd697('0x56'),JSON['stringify'](_0x2f525a));});};exports[_0xd697('0x5c')]=function(_0x3fa059,_0x5e987c,_0x558b64,_0x557c8f,_0x10697b,_0x105bc){var _0x2ceae3,_0x30269e;_0x105bc[_0xd697('0x1d')]=intUtil[_0xd697('0x45')](_0x105bc['remoteUri']);_0x105bc[_0xd697('0x46')]=intUtil[_0xd697('0x45')](_0x105bc[_0xd697('0x46')]);if(_0x10697b&&_0x10697b['monitor_format']){logger[_0xd697('0xe')]('['+_0x5e987c[_0xd697('0x5d')][_0xd697('0x5e')]()+']',_0xd697('0x48'));_0x5e987c[_0xd697('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x105bc[_0xd697('0x46')],_0x5e987c[_0xd697('0x4b')],md5(_0x5e987c['uniqueid']));}else{_0x5e987c[_0xd697('0x49')]='';}headers[_0xd697('0x4c')]=getAuth(_0x105bc);return getUser(_0x105bc,'')[_0xd697('0x1f')](function(_0x55cecb){_0x2ceae3=_0x55cecb;logger['info']('The\x20User\x20ID\x20is:',_0x2ceae3['id']);return getEndUser(_0x105bc,_0x5e987c[_0xd697('0x12')],_0x5e987c['calleridnum']);})[_0xd697('0x1f')](function(_0x4fe180){_0x30269e=_0x4fe180;logger[_0xd697('0xe')](_0xd697('0x59'),_0x30269e['id']);return getTicket(_0x105bc,_0x2ceae3,_0x30269e,_0x558b64,_0x5e987c);})['then'](function(_0xd03bb2){if(_0xd03bb2){logger[_0xd697('0xe')](_0xd697('0x20'));logger[_0xd697('0xe')](_0xd697('0x5a'),_0xd03bb2['id']);}})[_0xd697('0x5f')](function(_0x246cc2){logger[_0xd697('0x52')]('['+_0x5e987c['lastevent'][_0xd697('0x5e')]()+']',JSON[_0xd697('0x33')](_0x246cc2));});}; \ 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 cce8b7a..e706e8a 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 _0x81b0=['toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','then','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','md5','moment','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81b0,0x93));var _0x081b=function(_0xb71d11,_0x534077){_0xb71d11=_0xb71d11-0x0;var _0x4eb52f=_0x81b0[_0xb71d11];return _0x4eb52f;};'use strict';var _=require(_0x081b('0x0'));var rp=require('request-promise');var md5=require(_0x081b('0x1'));var util=require('util');var moment=require(_0x081b('0x2'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x081b('0x3'));var logger=require(_0x081b('0x4'))(_0x081b('0x5'));config[_0x081b('0x6')]=_[_0x081b('0x7')](config[_0x081b('0x6')],{'host':_0x081b('0x8'),'port':0x18eb});var io=require(_0x081b('0x9'))(new Redis(config[_0x081b('0x6')]));function getAdminId(_0x3773a7,_0x39b872,_0xf7377d,_0x244c53){return new Promise(function(_0x521bfd,_0x446212){var _0x5e9f4d=![];var _0x566f06={'method':_0x081b('0xa'),'uri':_0x244c53+'/api/selector/owners','json':!![]};_0x566f06['headers']=_0xf7377d;logger[_0x081b('0xb')](_0x081b('0xc'));return rp(_0x566f06)['then'](function(_0x243553){if(_0x243553){var _0x4df46c=_0x243553[_0x081b('0xd')];var _0x3fbb1c=null;for(_0x3fbb1c=0x0;_0x3fbb1c<_0x4df46c[_0x081b('0xe')];_0x3fbb1c++){if(_0x4df46c[_0x3fbb1c]['email']===_0x3773a7[_0x081b('0xf')]){_0x3773a7[_0x081b('0x10')]=_0x4df46c[_0x3fbb1c]['id'];_0x5e9f4d=!![];}}if(_0x5e9f4d){logger[_0x081b('0xb')](_0x081b('0x11'),_0x3773a7[_0x081b('0x10')]);_0x521bfd(_0x3773a7);}else{_0x446212({'statusCode':0x194,'message':_0x081b('0x12')});}}else{_0x446212({'statusCode':0x194,'message':_0x081b('0x12')});}})[_0x081b('0x13')](function(_0x5b81dd){logger[_0x081b('0x14')]('['+[_0x39b872[_0x081b('0x15')]()]+']',_0x5b81dd[_0x081b('0x16')]);_0x446212(_0x5b81dd);});});}function getUser(_0x16d402,_0x5dc7de,_0x13f678){return function(_0x2442b1){return new Promise(function(_0xf208f1,_0x4593a8){var _0x5438bd={'method':_0x081b('0xa'),'uri':_0x13f678+_0x081b('0x17'),'json':!![]};_0x5438bd['headers']=_0x5dc7de;logger[_0x081b('0xb')](_0x081b('0x18'));return rp(_0x5438bd)[_0x081b('0x19')](function(_0x862c8){if(_0x862c8){var _0x5a57c3=_0x862c8[_0x081b('0xd')];var _0x187f81=![];var _0x20429b=null;if(_0x2442b1[_0x081b('0x1a')]!==null){logger[_0x081b('0xb')]('Getting\x20user\x20with\x20email',_0x2442b1['agentEmail']);_0x2442b1['userEmail']=_0x2442b1['agentEmail'];for(_0x20429b=0x0;_0x20429b<_0x5a57c3[_0x081b('0xe')];_0x20429b++){if(_0x5a57c3[_0x20429b][_0x081b('0x1b')]===_0x2442b1['agentEmail']){_0x187f81=!![];_0x2442b1[_0x081b('0x1c')]=_0x5a57c3[_0x20429b]['id'];logger['info'](_0x081b('0x1d'),_0x2442b1[_0x081b('0x1c')]);}}}if(!_0x187f81){logger[_0x081b('0xb')](_0x081b('0x1e'));_0x2442b1[_0x081b('0x1f')]=_0x2442b1[_0x081b('0xf')];_0x2442b1[_0x081b('0x1c')]=_0x2442b1[_0x081b('0x10')];_0x187f81=!![];}if(_0x187f81){_0xf208f1(_0x2442b1);}else{_0x4593a8({'statusCode':0x194,'message':_0x081b('0x12')});}}else{_0x4593a8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x081b('0x13')](function(_0x20d169){logger[_0x081b('0x14')]('['+[_0x16d402[_0x081b('0x15')]()]+']',_0x20d169[_0x081b('0x16')]);_0x4593a8(_0x20d169);});});};}function searchContact(_0x137a66,_0x94d1c4,_0x232337,_0x56a6ce){return new Promise(function(_0x3e338a,_0x495e8b){var _0x502c1b={'method':'GET','headers':_0x94d1c4,'uri':_0x137a66+_0x081b('0x20')+_0x56a6ce+_0x081b('0x21')+_0x232337+_0x081b('0x22'),'json':!![]};rp(_0x502c1b)[_0x081b('0x19')](function(_0xcae817){var _0x157486=_[_0x081b('0x23')](_0xcae817['contacts']['contacts'],[_0x232337,_0x56a6ce]);_0x3e338a(_0x157486);})[_0x081b('0x13')](function(_0x1d0c20){_0x495e8b(_0x1d0c20);});});}function getEndUser(_0x4ec9f6,_0x181007,_0x348628){return function(_0x92ac){return new Promise(function(_0x16e74f,_0x4cb864){logger[_0x081b('0xb')](util[_0x081b('0x24')](_0x081b('0x25'),_0x92ac[_0x081b('0x26')]));searchContact(_0x348628,_0x181007,_0x081b('0x27'),_0x92ac[_0x081b('0x26')])[_0x081b('0x19')](function(_0x237725){if(_0x237725){_0x92ac['endUserId']=_0x237725['id'];logger[_0x081b('0xb')](_0x081b('0x28'),_0x92ac[_0x081b('0x29')]);return _0x16e74f(_0x92ac);}searchContact(_0x348628,_0x181007,_0x081b('0x2a'),_0x92ac['contactNumber'])[_0x081b('0x19')](function(_0x67e4c4){if(_0x67e4c4){_0x92ac[_0x081b('0x29')]=_0x67e4c4['id'];logger[_0x081b('0xb')](_0x081b('0x2b'),_0x92ac[_0x081b('0x29')]);return _0x16e74f(_0x92ac);}createEndUser(_0x92ac,_0x4ec9f6,_0x181007,_0x348628)['then'](function(_0x2ba859){logger[_0x081b('0xb')](_0x081b('0x2c'),_0x2ba859[_0x081b('0x29')]);return _0x16e74f(_0x2ba859);});});})[_0x081b('0x13')](function(_0x3c9bf7){_0x4cb864(_0x3c9bf7);});});};}function createEndUser(_0x4acfe9,_0x314102,_0x5d4f2c,_0x328a4e){return new Promise(function(_0x3b98e9,_0x322d76){var _0x11855b=moment();var _0x10c0f8={'method':_0x081b('0x2d'),'uri':_0x328a4e+_0x081b('0x2e'),'body':{'contact':{'last_name':_0x4acfe9[_0x081b('0x26')],'work_number':_0x4acfe9['contactNumber'],'mobile_number':_0x4acfe9[_0x081b('0x26')],'owner_id':_0x4acfe9[_0x081b('0x1c')],'created_at':_0x11855b[_0x081b('0x24')](_0x081b('0x2f'))}},'json':!![]};_0x10c0f8[_0x081b('0x30')]=_0x5d4f2c;logger[_0x081b('0xb')](_0x081b('0x31'));return rp(_0x10c0f8)[_0x081b('0x19')](function(_0x45c803){_0x4acfe9[_0x081b('0x29')]=_0x45c803[_0x081b('0x32')]['id'];_0x3b98e9(_0x4acfe9);})[_0x081b('0x13')](function(_0x2934d1){logger[_0x081b('0x14')]('['+[_0x314102[_0x081b('0x15')]()]+']',_0x2934d1[_0x081b('0x16')]);_0x322d76(_0x2934d1[_0x081b('0x16')]);});});}function getTicket(_0x11598e,_0x2acb05,_0x5f403f,_0xe1bdb8,_0x49c276){return function(_0x4b887c){logger[_0x081b('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x111b12,_0x297545){var _0x161e88=moment();var _0x3a4b8f={'method':_0x081b('0x2d'),'uri':_0x5f403f+_0x081b('0x33'),'body':{'title':intUtil[_0x081b('0x34')](_0xe1bdb8['Subjects'],_0x49c276,'\x20'),'description':intUtil['getString'](_0xe1bdb8[_0x081b('0x35')],_0x49c276,'\x0a'),'owner_id':_0x4b887c[_0x081b('0x1c')],'creater_id':_0x4b887c['adminId'],'targetable_id':_0x4b887c[_0x081b('0x29')],'targetable_type':_0x081b('0x36'),'created_at':_0x161e88['format'](_0x081b('0x2f')),'due_date':_0x161e88[_0x081b('0x37')](0x1e,'m')[_0x081b('0x24')](_0x081b('0x2f'))},'json':!![]};_0x3a4b8f[_0x081b('0x30')]=_0x2acb05;return rp(_0x3a4b8f)[_0x081b('0x19')](function(_0x13c144){_0x4b887c['ticketId']=_0x13c144[_0x081b('0x38')]['id'];logger[_0x081b('0xb')](_0x081b('0x39'),_0x4b887c[_0x081b('0x3a')]);_0x111b12(_0x4b887c);})[_0x081b('0x13')](function(_0x33c3b2){logger[_0x081b('0x14')]('['+[_0x11598e[_0x081b('0x15')]()]+']',_0x33c3b2[_0x081b('0x16')]);_0x297545(_0x33c3b2['message']);});});};}function emit(_0x49b13d,_0x4b7972,_0x516e86){var _0x1a77a4={'uri':_0x49b13d+_0x081b('0x3b')+_0x516e86};io['to'](util[_0x081b('0x24')]('user:%s',_0x4b7972))[_0x081b('0x3c')](_0x081b('0x3d'),_0x1a77a4);}exports['cs']=function(_0x35b756,_0x305d1f,_0x3cf3ca,_0x5d50fe,_0x2c7c58,_0x29ae17,_0x3b332a,_0x3be622){var _0x539bdc={};var _0x3217c7={'Authorization':_0x081b('0x3e')+_0x29ae17['apiKey']};_0x29ae17[_0x081b('0x3f')]=intUtil[_0x081b('0x40')](_0x29ae17[_0x081b('0x3f')]);_0x29ae17[_0x081b('0x41')]=intUtil[_0x081b('0x40')](_0x29ae17[_0x081b('0x41')]);var _0x36419b=_0x29ae17[_0x081b('0x3f')];_0x539bdc[_0x081b('0xf')]=_0x29ae17[_0x081b('0x42')];_0x539bdc[_0x081b('0x26')]=_0x3be622[_0x081b('0x43')]()===_0x081b('0x44')?_0x305d1f[_0x081b('0x45')]:_0x305d1f[_0x081b('0x46')];_0x539bdc[_0x081b('0x47')]=_0x3be622===_0x081b('0x48')||_0x3be622===_0x081b('0x49')?_0x081b('0x48'):_0x081b('0x44');if(_0x5d50fe){_0x539bdc[_0x081b('0x1a')]=_0x5d50fe[_0x081b('0x1b')];}var _0x11abe2=util[_0x081b('0x24')](_0x081b('0x4a'),_0x29ae17[_0x081b('0x41')],_0x305d1f[_0x081b('0x4b')],md5(_0x305d1f[_0x081b('0x4b')]));if(_0x2c7c58&&_0x2c7c58['monitor_format']){logger[_0x081b('0xb')](_0x081b('0x4c'),_0x081b('0x4d'));_0x305d1f[_0x081b('0x4e')]=_0x11abe2;}else if(_0x3b332a&&_0x3b332a[_0x081b('0x4f')]&&_0x3b332a['recordingFormat']!=='none'){logger[_0x081b('0xb')](_0x081b('0x50'),'Recording\x20is\x20enabled!');_0x305d1f[_0x081b('0x4e')]=_0x11abe2;}else{_0x305d1f['recordingURL']='';}return getAdminId(_0x539bdc,_0x3be622,_0x3217c7,_0x36419b)[_0x081b('0x19')](getUser(_0x3be622,_0x3217c7,_0x36419b))[_0x081b('0x19')](getEndUser(_0x3be622,_0x3217c7,_0x36419b))['then'](getTicket(_0x3be622,_0x3217c7,_0x36419b,_0x3cf3ca,_0x305d1f))[_0x081b('0x19')](function(_0x185c30){logger[_0x081b('0xb')](util[_0x081b('0x24')](_0x081b('0x51'),_0x185c30[_0x081b('0x3a')]));if(_0x3be622!==_0x081b('0x49')){logger[_0x081b('0xb')]('['+[_0x3be622[_0x081b('0x15')]()]+']',_0x081b('0x52'));emit(_0x36419b,_0x5d50fe[_0x081b('0x53')],_0x185c30['endUserId']);}})[_0x081b('0x13')](function(_0x196e11){logger[_0x081b('0x14')]('['+[_0x3be622['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x196e11,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x43c9=['recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','headers','Getting\x20admin\x20information','users','length','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','/api/selector/owners','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','Subjects','getString','Descriptions','add','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','adminEmail','toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL'];(function(_0x2f7e1b,_0x545a06){var _0x5832c5=function(_0x38f9bb){while(--_0x38f9bb){_0x2f7e1b['push'](_0x2f7e1b['shift']());}};_0x5832c5(++_0x545a06);}(_0x43c9,0x1f2));var _0x943c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x43c9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x943c('0x0'));var rp=require(_0x943c('0x1'));var md5=require(_0x943c('0x2'));var util=require(_0x943c('0x3'));var moment=require(_0x943c('0x4'));var Promise=require('bluebird');var Redis=require(_0x943c('0x5'));var intUtil=require(_0x943c('0x6'));var config=require(_0x943c('0x7'));var logger=require(_0x943c('0x8'))(_0x943c('0x9'));config['redis']=_[_0x943c('0xa')](config['redis'],{'host':_0x943c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x45f9f1,_0x13ff8c,_0x241f83,_0x1fbac5){return new Promise(function(_0x17051c,_0x431cb6){var _0x161d94=![];var _0x492f73={'method':'GET','uri':_0x1fbac5+'/api/selector/owners','json':!![]};_0x492f73[_0x943c('0xc')]=_0x241f83;logger['info'](_0x943c('0xd'));return rp(_0x492f73)['then'](function(_0x42543a){if(_0x42543a){var _0x5d179b=_0x42543a[_0x943c('0xe')];var _0x149cc0=null;for(_0x149cc0=0x0;_0x149cc0<_0x5d179b[_0x943c('0xf')];_0x149cc0++){if(_0x5d179b[_0x149cc0]['email']===_0x45f9f1['adminEmail']){_0x45f9f1['adminId']=_0x5d179b[_0x149cc0]['id'];_0x161d94=!![];}}if(_0x161d94){logger[_0x943c('0x10')](_0x943c('0x11'),_0x45f9f1[_0x943c('0x12')]);_0x17051c(_0x45f9f1);}else{_0x431cb6({'statusCode':0x194,'message':_0x943c('0x13')});}}else{_0x431cb6({'statusCode':0x194,'message':_0x943c('0x13')});}})[_0x943c('0x14')](function(_0x1e52ba){logger[_0x943c('0x15')]('['+[_0x13ff8c[_0x943c('0x16')]()]+']',_0x1e52ba['message']);_0x431cb6(_0x1e52ba);});});}function getUser(_0x2bdf93,_0x23cdc0,_0x45b753){return function(_0x56fdbb){return new Promise(function(_0x7e4e58,_0x2b82dd){var _0x30fc42={'method':_0x943c('0x17'),'uri':_0x45b753+_0x943c('0x18'),'json':!![]};_0x30fc42[_0x943c('0xc')]=_0x23cdc0;logger[_0x943c('0x10')]('Getting\x20user\x20list');return rp(_0x30fc42)[_0x943c('0x19')](function(_0x3ddd94){if(_0x3ddd94){var _0x43014a=_0x3ddd94[_0x943c('0xe')];var _0x1a7454=![];var _0x231e0e=null;if(_0x56fdbb[_0x943c('0x1a')]!==null){logger[_0x943c('0x10')](_0x943c('0x1b'),_0x56fdbb[_0x943c('0x1a')]);_0x56fdbb[_0x943c('0x1c')]=_0x56fdbb[_0x943c('0x1a')];for(_0x231e0e=0x0;_0x231e0e<_0x43014a['length'];_0x231e0e++){if(_0x43014a[_0x231e0e][_0x943c('0x1d')]===_0x56fdbb[_0x943c('0x1a')]){_0x1a7454=!![];_0x56fdbb['userId']=_0x43014a[_0x231e0e]['id'];logger[_0x943c('0x10')](_0x943c('0x1e'),_0x56fdbb[_0x943c('0x1f')]);}}}if(!_0x1a7454){logger[_0x943c('0x10')]('Admin\x20selected');_0x56fdbb[_0x943c('0x1c')]=_0x56fdbb['adminEmail'];_0x56fdbb[_0x943c('0x1f')]=_0x56fdbb[_0x943c('0x12')];_0x1a7454=!![];}if(_0x1a7454){_0x7e4e58(_0x56fdbb);}else{_0x2b82dd({'statusCode':0x194,'message':_0x943c('0x13')});}}else{_0x2b82dd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x943c('0x14')](function(_0x10cfac){logger['error']('['+[_0x2bdf93[_0x943c('0x16')]()]+']',_0x10cfac[_0x943c('0x20')]);_0x2b82dd(_0x10cfac);});});};}function searchContact(_0x2db3ed,_0x417998,_0x65a8d7,_0x3f5dd0){return new Promise(function(_0x232f9a,_0x290f8a){var _0x3a324={'method':_0x943c('0x17'),'headers':_0x417998,'uri':_0x2db3ed+_0x943c('0x21')+_0x3f5dd0+_0x943c('0x22')+_0x65a8d7+_0x943c('0x23'),'json':!![]};rp(_0x3a324)[_0x943c('0x19')](function(_0x5d68e7){var _0x56bdbe=_[_0x943c('0x24')](_0x5d68e7[_0x943c('0x25')][_0x943c('0x25')],[_0x65a8d7,_0x3f5dd0]);_0x232f9a(_0x56bdbe);})[_0x943c('0x14')](function(_0x239d8){_0x290f8a(_0x239d8);});});}function getEndUser(_0x301db4,_0x509113,_0x14a660){return function(_0x42e724){return new Promise(function(_0x52289d,_0x102b6e){logger[_0x943c('0x10')](util[_0x943c('0x26')](_0x943c('0x27'),_0x42e724[_0x943c('0x28')]));searchContact(_0x14a660,_0x509113,_0x943c('0x29'),_0x42e724['contactNumber'])[_0x943c('0x19')](function(_0x4ddb0d){if(_0x4ddb0d){_0x42e724['endUserId']=_0x4ddb0d['id'];logger['info'](_0x943c('0x2a'),_0x42e724['endUserId']);return _0x52289d(_0x42e724);}searchContact(_0x14a660,_0x509113,_0x943c('0x2b'),_0x42e724[_0x943c('0x28')])[_0x943c('0x19')](function(_0x2423ba){if(_0x2423ba){_0x42e724[_0x943c('0x2c')]=_0x2423ba['id'];logger['info'](_0x943c('0x2d'),_0x42e724[_0x943c('0x2c')]);return _0x52289d(_0x42e724);}createEndUser(_0x42e724,_0x301db4,_0x509113,_0x14a660)[_0x943c('0x19')](function(_0x3c238e){logger[_0x943c('0x10')](_0x943c('0x2e'),_0x3c238e[_0x943c('0x2c')]);return _0x52289d(_0x3c238e);});});})['catch'](function(_0x5ed591){_0x102b6e(_0x5ed591);});});};}function createEndUser(_0x57bf97,_0x40b8bc,_0x22a1e3,_0x5ae3fa){return new Promise(function(_0x4f3f31,_0x59b4a3){var _0x4ead26=moment();var _0x30a651={'method':_0x943c('0x2f'),'uri':_0x5ae3fa+_0x943c('0x30'),'body':{'contact':{'last_name':_0x57bf97[_0x943c('0x28')],'work_number':_0x57bf97[_0x943c('0x28')],'mobile_number':_0x57bf97[_0x943c('0x28')],'owner_id':_0x57bf97['userId'],'created_at':_0x4ead26[_0x943c('0x26')](_0x943c('0x31'))}},'json':!![]};_0x30a651[_0x943c('0xc')]=_0x22a1e3;logger[_0x943c('0x10')](_0x943c('0x32'));return rp(_0x30a651)[_0x943c('0x19')](function(_0x11f326){_0x57bf97[_0x943c('0x2c')]=_0x11f326['contact']['id'];_0x4f3f31(_0x57bf97);})[_0x943c('0x14')](function(_0xae13da){logger[_0x943c('0x15')]('['+[_0x40b8bc['toUpperCase']()]+']',_0xae13da[_0x943c('0x20')]);_0x59b4a3(_0xae13da[_0x943c('0x20')]);});});}function getTicket(_0x1936b6,_0x1fda19,_0x27c16c,_0x17470c,_0x1142de){return function(_0x4407f0){logger[_0x943c('0x10')](_0x943c('0x33'));return new Promise(function(_0x412fd1,_0x405a95){var _0x14da92=moment();var _0x32bade={'method':_0x943c('0x2f'),'uri':_0x27c16c+'/api/tasks','body':{'title':intUtil['getString'](_0x17470c[_0x943c('0x34')],_0x1142de,'\x20'),'description':intUtil[_0x943c('0x35')](_0x17470c[_0x943c('0x36')],_0x1142de,'\x0a'),'owner_id':_0x4407f0['userId'],'creater_id':_0x4407f0['adminId'],'targetable_id':_0x4407f0[_0x943c('0x2c')],'targetable_type':'Contact','created_at':_0x14da92[_0x943c('0x26')](_0x943c('0x31')),'due_date':_0x14da92[_0x943c('0x37')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x32bade[_0x943c('0xc')]=_0x1fda19;return rp(_0x32bade)[_0x943c('0x19')](function(_0x1fe176){_0x4407f0[_0x943c('0x38')]=_0x1fe176[_0x943c('0x39')]['id'];logger[_0x943c('0x10')]('Task\x20created:',_0x4407f0['ticketId']);_0x412fd1(_0x4407f0);})[_0x943c('0x14')](function(_0x3a50e6){logger['error']('['+[_0x1936b6[_0x943c('0x16')]()]+']',_0x3a50e6[_0x943c('0x20')]);_0x405a95(_0x3a50e6['message']);});});};}function emit(_0xc5d94e,_0xe714dd,_0x5477df){var _0x5dbb59={'uri':_0xc5d94e+_0x943c('0x3a')+_0x5477df};io['to'](util[_0x943c('0x26')]('user:%s',_0xe714dd))[_0x943c('0x3b')](_0x943c('0x3c'),_0x5dbb59);}exports['cs']=function(_0x23d7e9,_0x45021c,_0x31db18,_0x4a9104,_0x33deb4,_0x27a40b,_0x454738,_0xf3d4fa){var _0x3d63cd={};var _0x5f0999={'Authorization':_0x943c('0x3d')+_0x27a40b['apiKey']};_0x27a40b[_0x943c('0x3e')]=intUtil[_0x943c('0x3f')](_0x27a40b[_0x943c('0x3e')]);_0x27a40b[_0x943c('0x40')]=intUtil[_0x943c('0x3f')](_0x27a40b['serverUrl']);var _0x11b0bf=_0x27a40b[_0x943c('0x3e')];_0x3d63cd[_0x943c('0x41')]=_0x27a40b['username'];_0x3d63cd[_0x943c('0x28')]=_0xf3d4fa[_0x943c('0x42')]()===_0x943c('0x43')?_0x45021c[_0x943c('0x44')]:_0x45021c['calleridnum'];_0x3d63cd['callDirection']=_0xf3d4fa===_0x943c('0x45')||_0xf3d4fa===_0x943c('0x46')?_0x943c('0x45'):_0x943c('0x43');if(_0x4a9104){_0x3d63cd[_0x943c('0x1a')]=_0x4a9104['email'];}var _0x1a2ff2=util[_0x943c('0x26')](_0x943c('0x47'),_0x27a40b['serverUrl'],_0x45021c[_0x943c('0x48')],md5(_0x45021c['uniqueid']));if(_0x33deb4&&_0x33deb4[_0x943c('0x49')]){logger['info'](_0x943c('0x4a'),'Recording\x20is\x20enabled!');_0x45021c[_0x943c('0x4b')]=_0x1a2ff2;}else if(_0x454738&&_0x454738['recordingFormat']&&_0x454738[_0x943c('0x4c')]!=='none'){logger[_0x943c('0x10')](_0x943c('0x4d'),_0x943c('0x4e'));_0x45021c['recordingURL']=_0x1a2ff2;}else{_0x45021c[_0x943c('0x4b')]='';}return getAdminId(_0x3d63cd,_0xf3d4fa,_0x5f0999,_0x11b0bf)['then'](getUser(_0xf3d4fa,_0x5f0999,_0x11b0bf))[_0x943c('0x19')](getEndUser(_0xf3d4fa,_0x5f0999,_0x11b0bf))['then'](getTicket(_0xf3d4fa,_0x5f0999,_0x11b0bf,_0x31db18,_0x45021c))[_0x943c('0x19')](function(_0x493a53){logger[_0x943c('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x493a53['ticketId']));if(_0xf3d4fa!==_0x943c('0x46')){logger['info']('['+[_0xf3d4fa['toUpperCase']()]+']',_0x943c('0x4f'));emit(_0x11b0bf,_0x4a9104[_0x943c('0x50')],_0x493a53[_0x943c('0x2c')]);}})['catch'](function(_0x23a391){logger['error']('['+[_0xf3d4fa[_0x943c('0x16')]()]+_0x943c('0x51'),util['inspect'](_0x23a391,{'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 f7497ea..f3f4957 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 _0xdeca=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','sugarcrm','freshdesk','log','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xdeca,0x1b8));var _0xadec=function(_0x33eafa,_0x96575f){_0x33eafa=_0x33eafa-0x0;var _0x308a1d=_0xdeca[_0x33eafa];return _0x308a1d;};'use strict';var _=require(_0xadec('0x0'));var util=require(_0xadec('0x1'));var zendesk=require(_0xadec('0x2'));var salesforce=require(_0xadec('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xadec('0x4'));var zoho=require(_0xadec('0x5'));var desk=require(_0xadec('0x6'));var vtiger=require(_0xadec('0x7'));var servicenow=require(_0xadec('0x8'));var dynamics365=require(_0xadec('0x9'));var freshsales=require('./freshsales');var integrations=[_0xadec('0xa'),_0xadec('0xb'),'sugarcrm','freshdesk',_0xadec('0xc'),_0xadec('0xd'),_0xadec('0xe'),_0xadec('0xf'),_0xadec('0x10'),_0xadec('0x11')];exports[_0xadec('0x12')]=function(_0x3e4517,_0x3c5c79,_0x5f35e3,_0x1c8323,_0x83b06b,_0x4369d3){if(_0x5f35e3){if(_[_0xadec('0x13')](integrations,_0x3e4517[_0xadec('0x14')]['toLowerCase']())){try{var _0x4e4547=null;var _0x3724ef='';var _0x35502d=_0x5f35e3[_0x3e4517[_0xadec('0x14')][_0xadec('0x15')]()];if(_0x35502d){var _0x8624a5=_0x35502d[_0x3e4517['data2']];if(_0x8624a5){var _0xca5245=_[_0xadec('0x16')](_0x8624a5[_0xadec('0x17')],{'id':parseInt(_0x3e4517[_0xadec('0x18')],0xa)});if(_0xca5245){if(_0x1c8323){if(_0x83b06b&&_0x3c5c79['queue']){_0x3724ef=_0xadec('0x19');}else if(_0x3c5c79[_0xadec('0x1a')]){_0x3724ef='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x3c5c79);}}else{_0x3724ef='unmanaged';}switch(_0x3e4517[_0xadec('0x14')][_0xadec('0x15')]()){case _0xadec('0xa'):zendesk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xb'):salesforce[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x1b'):sugarcrm[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x1c'):freshdesk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xc'):zoho[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xd'):desk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case'vtiger':vtiger[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x10'):freshsales['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;case'servicenow':servicenow['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;case _0xadec('0xf'):dynamics365['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;default:console[_0xadec('0x1d')]('unknown\x20integration');}}else{_0x4e4547=require(_0xadec('0x1e'))(_0x3e4517['data1'][_0xadec('0x15')]());_0x4e4547[_0xadec('0x1f')](_0xadec('0x20'),util[_0xadec('0x21')](_0xadec('0x22'),_0x3e4517[_0xadec('0x14')]['toLowerCase'](),_0x3e4517['data3']));}}else{_0x4e4547=require(_0xadec('0x1e'))(_0x3e4517['data1'][_0xadec('0x15')]());_0x4e4547[_0xadec('0x1f')](_0xadec('0x20'),util['format'](_0xadec('0x23'),_0x3e4517[_0xadec('0x14')]['toLowerCase'](),_0x3e4517[_0xadec('0x24')]));}}else{}}catch(_0x5a487e){console['error'](_0x5a487e);}}}}; \ No newline at end of file +var _0x6335=['error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','includes','data1','toLowerCase','data2','find','Configurations','queue','log','EVENT\x20UNKNOWN','servicenow','unknown\x20integration','../../../../config/logger'];(function(_0x45562c,_0x13266e){var _0x24a805=function(_0x209154){while(--_0x209154){_0x45562c['push'](_0x45562c['shift']());}};_0x24a805(++_0x13266e);}(_0x6335,0xab));var _0x5633=function(_0x4055d0,_0x2393d0){_0x4055d0=_0x4055d0-0x0;var _0x1c7b2d=_0x6335[_0x4055d0];return _0x1c7b2d;};'use strict';var _=require(_0x5633('0x0'));var util=require('util');var zendesk=require(_0x5633('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0x5633('0x2'));var desk=require(_0x5633('0x3'));var vtiger=require(_0x5633('0x4'));var servicenow=require(_0x5633('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5633('0x6'));var integrations=[_0x5633('0x7'),_0x5633('0x8'),_0x5633('0x9'),_0x5633('0xa'),_0x5633('0xb'),_0x5633('0xc'),_0x5633('0xd'),'dynamics365',_0x5633('0xe'),'servicenow'];exports['exec']=function(_0x293812,_0x20b5ef,_0x57cd66,_0x4edfe5,_0x6cdb4c,_0x8967d1){if(_0x57cd66){if(_[_0x5633('0xf')](integrations,_0x293812[_0x5633('0x10')][_0x5633('0x11')]())){try{var _0x26d1d5=null;var _0x168bef='';var _0x227edc=_0x57cd66[_0x293812[_0x5633('0x10')][_0x5633('0x11')]()];if(_0x227edc){var _0x2ebf83=_0x227edc[_0x293812[_0x5633('0x12')]];if(_0x2ebf83){var _0x544d4c=_[_0x5633('0x13')](_0x2ebf83[_0x5633('0x14')],{'id':parseInt(_0x293812['data3'],0xa)});if(_0x544d4c){if(_0x4edfe5){if(_0x6cdb4c&&_0x20b5ef[_0x5633('0x15')]){_0x168bef=_0x5633('0x15');}else if(_0x20b5ef['routeId']){_0x168bef='outbound';}else{console[_0x5633('0x16')](_0x5633('0x17'),_0x20b5ef);}}else{_0x168bef='unmanaged';}switch(_0x293812[_0x5633('0x10')]['toLowerCase']()){case _0x5633('0x7'):zendesk[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0x8'):salesforce[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0x9'):sugarcrm[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0xa'):freshdesk[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0xb'):zoho[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0xc'):desk[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0xd'):vtiger[_0x168bef](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1);break;case _0x5633('0xe'):freshsales['cs'](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1,_0x168bef);break;case _0x5633('0x18'):servicenow['cs'](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1,_0x168bef);break;case'dynamics365':dynamics365['cs'](_0x293812,_0x20b5ef,_0x544d4c,_0x4edfe5,_0x6cdb4c,_0x2ebf83,_0x8967d1,_0x168bef);break;default:console[_0x5633('0x16')](_0x5633('0x19'));}}else{_0x26d1d5=require(_0x5633('0x1a'))(_0x293812[_0x5633('0x10')]['toLowerCase']());_0x26d1d5[_0x5633('0x1b')](_0x5633('0x1c'),util[_0x5633('0x1d')](_0x5633('0x1e'),_0x293812['data1'][_0x5633('0x11')](),_0x293812[_0x5633('0x1f')]));}}else{_0x26d1d5=require(_0x5633('0x1a'))(_0x293812['data1']['toLowerCase']());_0x26d1d5['error'](_0x5633('0x1c'),util[_0x5633('0x1d')](_0x5633('0x20'),_0x293812[_0x5633('0x10')][_0x5633('0x11')](),_0x293812['data2']));}}else{}}catch(_0x52da92){console['error'](_0x52da92);}}}}; \ 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 f266c21..661e6e8 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 _0x7e5c=['account_contact_lead','additionalSearchAccount','Account','Lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','trigger:browser:url','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsRecurrence','endUserType','lead','WhatId','ticketType','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','additionalSearchLead'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7e5c,0xc6));var _0xc7e5=function(_0x5d2d9,_0x1f79ce){_0x5d2d9=_0x5d2d9-0x0;var _0x250ef3=_0x7e5c[_0x5d2d9];return _0x250ef3;};'use strict';var _=require(_0xc7e5('0x0'));var rp=require('request-promise');var moment=require(_0xc7e5('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xc7e5('0x2'));var util=require('util');var Redis=require(_0xc7e5('0x3'));var intUtil=require(_0xc7e5('0x4'));var config=require(_0xc7e5('0x5'));var logger=require('../../../../config/logger')(_0xc7e5('0x6'));config[_0xc7e5('0x7')]=_[_0xc7e5('0x8')](config['redis'],{'host':_0xc7e5('0x9'),'port':0x18eb});var io=require(_0xc7e5('0xa'))(new Redis(config[_0xc7e5('0x7')]));function emit(_0xd98d6c,_0x58c1e2,_0x17b0e6){io['to'](_0xd98d6c)[_0xc7e5('0xb')](_0x58c1e2,_0x17b0e6);}function getTicket(_0x23d506,_0x2d9f56,_0x351966,_0x2aaea9,_0x5d0690,_0x2ed8e4,_0x83aef0,_0x924e53){var _0x2d10da=Object[_0xc7e5('0xc')]({},{'OwnerId':_0x2d9f56['id'],'Subject':intUtil[_0xc7e5('0xd')](_0x2aaea9[_0xc7e5('0xe')],_0x5d0690,'\x20'),'Description':intUtil[_0xc7e5('0xd')](_0x2aaea9[_0xc7e5('0xf')],_0x5d0690,'\x0a')},getCustomFields(_0x2ed8e4,_0x5d0690));if(_0x351966){if(_0x2aaea9['ticketType']===_0xc7e5('0x10')){_0x2d10da[_0xc7e5('0x11')]=moment['utc']();_0x2d10da['IsReminderSet']=![];_0x2d10da[_0xc7e5('0x12')]=![];if(_0x351966['endUserType']==='contact'||_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x14')){_0x2d10da['WhoId']=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]==='account'){_0x2d10da[_0xc7e5('0x15')]=_0x351966['id'];}}else if(_0x2aaea9[_0xc7e5('0x16')]===_0xc7e5('0x17')){if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x18')){_0x2d10da[_0xc7e5('0x19')]=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x1a')){_0x2d10da[_0xc7e5('0x1b')]=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x14')&&_0x2aaea9[_0xc7e5('0x1c')]){_0x2d10da[_0x2aaea9[_0xc7e5('0x1c')]]=_0x351966['id'];}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x1e'));}}}return _0x83aef0['sobject'](_0x2aaea9['ticketType'])[_0xc7e5('0x1f')](_0x2d10da);}function getUser(_0x559898,_0x10373f,_0x12d863){if(!_[_0xc7e5('0x20')](_0x10373f)&&intUtil[_0xc7e5('0x21')](_0x10373f)){var _0x47e749={'Email':_0x10373f};var _0x76ed9b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12d863['sobject'](_0xc7e5('0x22'))['find'](_0x47e749,_0x76ed9b)[_0xc7e5('0x23')]()[_0xc7e5('0x24')](function(_0x180bb3){if(_0x180bb3[_0xc7e5('0x25')]){var _0x2ec9d9=_[_0xc7e5('0x26')](_0x180bb3,function(_0x541c84){return _0x541c84['Email']===_0x10373f;});if(_0x2ec9d9){logger['info'](_0xc7e5('0x27'),_0x10373f);return BPromise[_0xc7e5('0x28')]({'id':_0x2ec9d9['Id'],'name':_0x2ec9d9[_0xc7e5('0x29')]});}}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x2a'),_0x10373f);return _0x12d863[_0xc7e5('0x2b')]()[_0xc7e5('0x24')](function(_0x16b6fc){return BPromise['resolve']({'id':_0x16b6fc[_0xc7e5('0x2c')],'name':_0x16b6fc[_0xc7e5('0x2d')]});});}});}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x2a'),_0x10373f);return _0x12d863[_0xc7e5('0x2b')]()['then'](function(_0x293d89){return BPromise[_0xc7e5('0x28')]({'id':_0x293d89[_0xc7e5('0x2c')],'name':_0x293d89[_0xc7e5('0x2d')]});});}}function getEndUser(_0x5ce396,_0x3632f9,_0x25288e,_0x10738a,_0x63e5f6){var _0x3a42db={'$or':{'Phone':_0x10738a}};var _0x192ec4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0xc7e5('0x2e'),_0x10738a,_0x3632f9[_0xc7e5('0x2f')]);switch(_0x3632f9[_0xc7e5('0x2f')]){case _0xc7e5('0x30'):var _0x554495=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchContact']){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_[_0xc7e5('0x33')](_0x554495[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x36'))[_0xc7e5('0x26')](_0x554495,_0x192ec4)['execute']()[_0xc7e5('0x24')](function(_0x56994e){if(_0x56994e&&_0x56994e[_0xc7e5('0x25')]){return _0x56994e;}else{var _0x2017dc=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x37')]){var _0x324324={};_0x324324[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x2017dc[_0xc7e5('0x34')],_0x324324);}return _0x63e5f6[_0xc7e5('0x35')]('Lead')[_0xc7e5('0x26')](_0x2017dc,_0x192ec4);}});case _0xc7e5('0x38'):var _0x53b8ea=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x39')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x39')]]=_0x10738a;_['merge'](_0x53b8ea[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6['sobject'](_0xc7e5('0x3a'))[_0xc7e5('0x26')](_0x53b8ea,_0x192ec4)['execute']()[_0xc7e5('0x24')](function(_0x92787){if(_0x92787&&_0x92787['length']){return _0x92787;}else{var _0x4affb3=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x32')]){var _0x4e799a={};_0x4e799a[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_[_0xc7e5('0x33')](_0x4affb3[_0xc7e5('0x34')],_0x4e799a);}return _0x63e5f6['sobject']('Contact')[_0xc7e5('0x26')](_0x4affb3,_0x192ec4)[_0xc7e5('0x24')](function(_0x1061d1){if(_0x1061d1&&_0x1061d1['length']){return _0x1061d1;}else{var _0x3d8578=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchLead']){var _0x156328={};_0x156328[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x3d8578['$or'],_0x156328);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3b'))['find'](_0x3d8578,_0x192ec4);}});}});case'contact':var _0x554495=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x32')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_['merge'](_0x554495[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x36'))[_0xc7e5('0x26')](_0x554495,_0x192ec4)['execute']();case _0xc7e5('0x14'):var _0x4b6902=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchLead']){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x4b6902[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3b'))[_0xc7e5('0x26')](_0x4b6902,_0x192ec4);case _0xc7e5('0x1a'):var _0x53b8ea=_['cloneDeep'](_0x3a42db);if(_0x3632f9[_0xc7e5('0x39')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9['additionalSearchAccount']]=_0x10738a;_['merge'](_0x53b8ea['$or'],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3a'))[_0xc7e5('0x26')](_0x53b8ea,_0x192ec4);default:return null;}})[_0xc7e5('0x24')](function(_0x39a969){if(_0x39a969&&_0x39a969[_0xc7e5('0x25')]){var _0x4d554e=_[_0xc7e5('0x3c')](_0x39a969);if(_0x4d554e){return BPromise[_0xc7e5('0x28')]({'id':_0x4d554e['Id'],'name':_0x4d554e[_0xc7e5('0x29')],'phone':_0x4d554e['Phone'],'endUserType':_0x4d554e['attributes'][_0xc7e5('0x3d')][_0xc7e5('0x3e')]()});}}})[_0xc7e5('0x24')](function(_0x17e2a6){if(_0x17e2a6){logger['info'](_0xc7e5('0x3f'),_0x17e2a6[_0xc7e5('0x13')],_0x10738a);return BPromise[_0xc7e5('0x28')](_0x17e2a6);}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x40'),_0x10738a);var _0x101b8f={'Phone':_0x10738a};if(_0x3632f9[_0xc7e5('0x41')]){if(_0x3632f9[_0xc7e5('0x41')]===_0xc7e5('0x18')){logger[_0xc7e5('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x42')]=_0x25288e!==_0xc7e5('0x43')?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);}else if(_0x3632f9[_0xc7e5('0x41')]===_0xc7e5('0x14')){logger[_0xc7e5('0x1d')](_0xc7e5('0x46'),_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x42')]=_0x25288e!==''?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);_0x101b8f[_0xc7e5('0x47')]=_0xc7e5('0x48');}else if(_0x3632f9['moduleCreate']===_0xc7e5('0x1a')){logger[_0xc7e5('0x1d')](_0xc7e5('0x46'),_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x29')]=_0x25288e!==_0xc7e5('0x43')?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);}else{return null;}}return _0x63e5f6[_0xc7e5('0x35')](_[_0xc7e5('0x49')](_0x3632f9['moduleCreate']))['create'](_0x101b8f)[_0xc7e5('0x24')](function(_0x2db6c2){return BPromise[_0xc7e5('0x28')]({'id':_0x2db6c2['id'],'endUserType':_0x3632f9[_0xc7e5('0x41')]});});}});}function getCustomFields(_0x15d9b5,_0x2c43ae){var _0x1a309f={};if(_0x15d9b5[_0xc7e5('0x25')]>0x0){_['forEach'](_0x15d9b5,function(_0x33f301){if(_[_0xc7e5('0x4a')]([_0xc7e5('0x4b'),_0xc7e5('0x4c')],_0x33f301[_0xc7e5('0x3d')])&&_0x33f301[_0xc7e5('0x4d')]){_0x1a309f[_0x33f301[_0xc7e5('0x4d')]]=_0x33f301[_0xc7e5('0x4e')][_0xc7e5('0x4f')]();}else if(_0x33f301[_0xc7e5('0x3d')]===_0xc7e5('0x50')&&_0x33f301[_0xc7e5('0x51')]&&_0x33f301[_0xc7e5('0x4d')]){_0x2c43ae[_0x33f301[_0xc7e5('0x51')]]&&(_0x1a309f[_0x33f301['idField']]=_0x2c43ae[_0x33f301[_0xc7e5('0x51')]][_0xc7e5('0x4f')]());}else if(_0x33f301[_0xc7e5('0x3d')]===_0xc7e5('0x52')&&_0x33f301[_0xc7e5('0x53')]&&_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')]&&_0x33f301[_0xc7e5('0x4d')]){_0x2c43ae[_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')][_0xc7e5('0x3e')]()]&&(_0x1a309f[_0x33f301[_0xc7e5('0x4d')]]=_0x2c43ae[_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')][_0xc7e5('0x3e')]()][_0xc7e5('0x4f')]());}});}return _0x1a309f;}function getConnection(_0x174007){var _0x33d665=_0x174007[_0xc7e5('0x55')]['concat'](_0x174007[_0xc7e5('0x56')]);var _0x30eb37=new jsforce[(_0xc7e5('0x57'))]({'oauth2':{'loginUrl':_0x174007[_0xc7e5('0x58')]||'https://login.salesforce.com','clientId':_0x174007['clientId'],'clientSecret':_0x174007[_0xc7e5('0x59')]}});return _0x30eb37['login'](_0x174007[_0xc7e5('0x5a')],_0x33d665)[_0xc7e5('0x24')](function(){logger['info']('Connection\x20established.');return _0x30eb37;});}exports[_0xc7e5('0x5b')]=function(_0x561bac,_0x59a8e1,_0x551146,_0x1c1218,_0x311af1,_0x3a6a32){var _0x305e62,_0x2b6455,_0x201e5c,_0x8258b3;_0x3a6a32[_0xc7e5('0x5c')]=intUtil['stripTrailingSlash'](_0x3a6a32[_0xc7e5('0x5c')]);_0x3a6a32[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x3a6a32[_0xc7e5('0x58')]);if(_0x311af1&&_0x311af1[_0xc7e5('0x5e')]){logger['info']('[QUEUE]',_0xc7e5('0x5f'));_0x59a8e1[_0xc7e5('0x60')]=util[_0xc7e5('0x44')](_0xc7e5('0x61'),_0x3a6a32[_0xc7e5('0x5c')],_0x59a8e1['uniqueid'],md5(_0x59a8e1['uniqueid']));}else{_0x59a8e1[_0xc7e5('0x60')]='';}return getConnection(_0x3a6a32)['then'](function(_0x1d96f7){_0x8258b3=_0x1d96f7;return getUser(_0x3a6a32,_0x1c1218[_0xc7e5('0x62')],_0x8258b3);})[_0xc7e5('0x24')](function(_0x340b3f){_0x305e62=_0x340b3f;return getEndUser(_0x3a6a32,_0x551146,_0x59a8e1[_0xc7e5('0x63')],_0x59a8e1[_0xc7e5('0x64')],_0x8258b3);})[_0xc7e5('0x24')](function(_0x4ac766){_0x2b6455=_0x4ac766;return getTicket(_0x3a6a32,_0x305e62,_0x2b6455,_0x551146,_0x59a8e1,_0x551146[_0xc7e5('0x65')],_0x8258b3,_0xc7e5('0x5b'));})[_0xc7e5('0x24')](function(_0x5cbe9b){_0x201e5c=_0x5cbe9b;logger[_0xc7e5('0x1d')](_0xc7e5('0x66'),_0x201e5c['id']);logger[_0xc7e5('0x1d')](_0xc7e5('0x67'),_0x201e5c['id'],_0x1c1218[_0xc7e5('0x54')],_0x3a6a32[_0xc7e5('0x3d')]);switch(_0x3a6a32[_0xc7e5('0x3d')]){case'integrationTab':emit(util[_0xc7e5('0x44')]('user:%s',_0x1c1218['name']),_0xc7e5('0x68'),{'recordId':_0x201e5c['id']});break;case _0xc7e5('0x69'):emit(util['format']('user:%s',_0x1c1218[_0xc7e5('0x54')]),_0xc7e5('0x6a'),{'uri':util['format']('%s/%s/e',_0x8258b3['instanceUrl'],_0x201e5c['id'])});break;default:logger['error'](_0xc7e5('0x6b'));}})['catch'](function(_0x35c76d){logger[_0xc7e5('0x6c')]('[QUEUE]',_0x35c76d);});};exports[_0xc7e5('0x6d')]=function(_0x52d4c8,_0x1c8f39,_0x26e526,_0x1d35a6,_0x1a4582,_0x37159e,_0x42513f){var _0x536eda,_0x4b1ea5,_0xe4608f,_0x1ff0ea;_0x37159e[_0xc7e5('0x5c')]=intUtil['stripTrailingSlash'](_0x37159e[_0xc7e5('0x5c')]);_0x37159e[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x37159e[_0xc7e5('0x58')]);if(_0x42513f&&_0x42513f['recordingFormat']&&_0x42513f[_0xc7e5('0x6e')]!==_0xc7e5('0x6f')){logger['info'](_0xc7e5('0x70'),_0xc7e5('0x5f'));_0x1c8f39[_0xc7e5('0x60')]=util[_0xc7e5('0x44')](_0xc7e5('0x61'),_0x37159e[_0xc7e5('0x5c')],_0x1c8f39[_0xc7e5('0x71')],md5(_0x1c8f39[_0xc7e5('0x71')]));}return getConnection(_0x37159e)[_0xc7e5('0x24')](function(_0x12ab1c){_0x1ff0ea=_0x12ab1c;return getUser(_0x37159e,_0x1d35a6['email'],_0x1ff0ea);})['then'](function(_0x571718){_0x536eda=_0x571718;return getEndUser(_0x37159e,_0x26e526,_0x1c8f39[_0xc7e5('0x72')],_0x1c8f39['destcalleridnum'],_0x1ff0ea);})['then'](function(_0x210243){_0x4b1ea5=_0x210243;return getTicket(_0x37159e,_0x536eda,_0x4b1ea5,_0x26e526,_0x1c8f39,_0x26e526[_0xc7e5('0x65')],_0x1ff0ea,_0xc7e5('0x6d'));})[_0xc7e5('0x24')](function(_0x1767e9){_0xe4608f=_0x1767e9;logger['info'](_0xc7e5('0x73'),_0xe4608f['id']);logger['info'](_0xc7e5('0x74'),_0xe4608f['id'],_0x1d35a6[_0xc7e5('0x54')],_0x37159e[_0xc7e5('0x3d')]);switch(_0x37159e[_0xc7e5('0x3d')]){case _0xc7e5('0x75'):emit(util['format'](_0xc7e5('0x76'),_0x1d35a6[_0xc7e5('0x54')]),'trigger:salesforce:display',{'recordId':_0xe4608f['id']});break;case _0xc7e5('0x69'):emit(util[_0xc7e5('0x44')](_0xc7e5('0x76'),_0x1d35a6['name']),'trigger:browser:url',{'uri':util[_0xc7e5('0x44')](_0xc7e5('0x77'),_0x1ff0ea[_0xc7e5('0x78')],_0xe4608f['id'])});break;default:logger['error']('[OUTBOUND]',_0xc7e5('0x79'));}})[_0xc7e5('0x7a')](function(_0x45f6e4){logger[_0xc7e5('0x6c')](_0xc7e5('0x70'),_0x45f6e4);});};exports[_0xc7e5('0x7b')]=function(_0x13deb8,_0x17947d,_0x5de951,_0x521cc9,_0x554e45,_0x392f70){var _0x1c6032,_0x399a1a,_0x1f71be,_0x514ebf;_0x392f70[_0xc7e5('0x5c')]=intUtil[_0xc7e5('0x5d')](_0x392f70[_0xc7e5('0x5c')]);_0x392f70[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x392f70[_0xc7e5('0x58')]);if(_0x554e45&&_0x554e45[_0xc7e5('0x5e')]){logger['info']('['+_0x17947d[_0xc7e5('0x7c')][_0xc7e5('0x7d')]()+']','Recording\x20is\x20enabled!');_0x17947d[_0xc7e5('0x60')]=util['format'](_0xc7e5('0x61'),_0x392f70[_0xc7e5('0x5c')],_0x17947d[_0xc7e5('0x71')],md5(_0x17947d[_0xc7e5('0x71')]));}else{_0x17947d[_0xc7e5('0x60')]='';}return getConnection(_0x392f70)[_0xc7e5('0x24')](function(_0x5a2a15){_0x514ebf=_0x5a2a15;if(!_[_0xc7e5('0x20')](_0x521cc9)){return getUser(_0x392f70,_0x521cc9[_0xc7e5('0x54')],_0x514ebf);}else{return getUser(_0x392f70,null,_0x514ebf);}})['then'](function(_0x5966a6){_0x1c6032=_0x5966a6;return getEndUser(_0x392f70,_0x5de951,_0x17947d[_0xc7e5('0x63')],_0x17947d[_0xc7e5('0x64')],_0x514ebf);})['then'](function(_0x4e2ddf){_0x399a1a=_0x4e2ddf;return getTicket(_0x392f70,_0x1c6032,_0x399a1a,_0x5de951,_0x17947d,_0x5de951['Fields'],_0x514ebf);})['then'](function(_0x3d2357){_0x1f71be=_0x3d2357;logger[_0xc7e5('0x1d')]('['+_0x17947d['lastevent'][_0xc7e5('0x7d')]()+_0xc7e5('0x7e'),_0x1f71be['id']);logger['info']('['+_0x17947d[_0xc7e5('0x7c')][_0xc7e5('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x392f70[_0xc7e5('0x3d')]);})['catch'](function(_0x42b527){logger[_0xc7e5('0x6c')]('['+_0x17947d['lastevent']['toUpperCase']()+']',_0x42b527);});}; \ No newline at end of file +var _0x7c8c=['redis','defaults','localhost','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','merge','Lead','additionalSearchAccount','Account','Contact','additionalSearchLead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','Company','No\x20Company','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','clientId','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce'];(function(_0x595c47,_0x3e84c5){var _0x40611e=function(_0x516bd8){while(--_0x516bd8){_0x595c47['push'](_0x595c47['shift']());}};_0x40611e(++_0x3e84c5);}(_0x7c8c,0x1db));var _0xc7c8=function(_0x1cf4c1,_0x494249){_0x1cf4c1=_0x1cf4c1-0x0;var _0x4cdf25=_0x7c8c[_0x1cf4c1];return _0x4cdf25;};'use strict';var _=require(_0xc7c8('0x0'));var rp=require('request-promise');var moment=require(_0xc7c8('0x1'));var BPromise=require(_0xc7c8('0x2'));var md5=require(_0xc7c8('0x3'));var jsforce=require('jsforce');var util=require(_0xc7c8('0x4'));var Redis=require(_0xc7c8('0x5'));var intUtil=require('./util');var config=require(_0xc7c8('0x6'));var logger=require(_0xc7c8('0x7'))(_0xc7c8('0x8'));config[_0xc7c8('0x9')]=_[_0xc7c8('0xa')](config[_0xc7c8('0x9')],{'host':_0xc7c8('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7c8('0x9')]));function emit(_0x107231,_0x49e9ad,_0x2e75c7){io['to'](_0x107231)['emit'](_0x49e9ad,_0x2e75c7);}function getTicket(_0x303a0e,_0x3308d4,_0x99c405,_0x42b8aa,_0x35da65,_0x142da5,_0x3c7d82,_0x561c15){var _0x388f54=Object[_0xc7c8('0xc')]({},{'OwnerId':_0x3308d4['id'],'Subject':intUtil['getString'](_0x42b8aa[_0xc7c8('0xd')],_0x35da65,'\x20'),'Description':intUtil[_0xc7c8('0xe')](_0x42b8aa[_0xc7c8('0xf')],_0x35da65,'\x0a')},getCustomFields(_0x142da5,_0x35da65));if(_0x99c405){if(_0x42b8aa[_0xc7c8('0x10')]===_0xc7c8('0x11')){_0x388f54[_0xc7c8('0x12')]=moment['utc']();_0x388f54[_0xc7c8('0x13')]=![];_0x388f54[_0xc7c8('0x14')]=![];if(_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x16')||_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x17')){_0x388f54['WhoId']=_0x99c405['id'];}else if(_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x18')){_0x388f54[_0xc7c8('0x19')]=_0x99c405['id'];}}else if(_0x42b8aa[_0xc7c8('0x10')]==='Case'){if(_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x16')){_0x388f54[_0xc7c8('0x1a')]=_0x99c405['id'];}else if(_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x18')){_0x388f54[_0xc7c8('0x1b')]=_0x99c405['id'];}else if(_0x99c405[_0xc7c8('0x15')]===_0xc7c8('0x17')&&_0x42b8aa[_0xc7c8('0x1c')]){_0x388f54[_0x42b8aa['leadId']]=_0x99c405['id'];}else{logger['info'](_0xc7c8('0x1d'));}}}return _0x3c7d82[_0xc7c8('0x1e')](_0x42b8aa[_0xc7c8('0x10')])['create'](_0x388f54);}function getUser(_0x2dfda2,_0x1c5878,_0x97533f){if(!_[_0xc7c8('0x1f')](_0x1c5878)&&intUtil[_0xc7c8('0x20')](_0x1c5878)){var _0x3924df={'Email':_0x1c5878};var _0x1addbe={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x97533f[_0xc7c8('0x1e')](_0xc7c8('0x21'))[_0xc7c8('0x22')](_0x3924df,_0x1addbe)[_0xc7c8('0x23')]()[_0xc7c8('0x24')](function(_0x4d5fa2){if(_0x4d5fa2[_0xc7c8('0x25')]){var _0x2ed7f0=_[_0xc7c8('0x22')](_0x4d5fa2,function(_0x52e917){return _0x52e917[_0xc7c8('0x26')]===_0x1c5878;});if(_0x2ed7f0){logger['info']('Agent\x20%s\x20found.',_0x1c5878);return BPromise[_0xc7c8('0x27')]({'id':_0x2ed7f0['Id'],'name':_0x2ed7f0[_0xc7c8('0x28')]});}}else{logger[_0xc7c8('0x29')](_0xc7c8('0x2a'),_0x1c5878);return _0x97533f[_0xc7c8('0x2b')]()[_0xc7c8('0x24')](function(_0x2c538b){return BPromise['resolve']({'id':_0x2c538b[_0xc7c8('0x2c')],'name':_0x2c538b[_0xc7c8('0x2d')]});});}});}else{logger[_0xc7c8('0x29')](_0xc7c8('0x2a'),_0x1c5878);return _0x97533f[_0xc7c8('0x2b')]()[_0xc7c8('0x24')](function(_0x56443c){return BPromise[_0xc7c8('0x27')]({'id':_0x56443c['user_id'],'name':_0x56443c[_0xc7c8('0x2d')]});});}}function getEndUser(_0x15f93e,_0x1a6f39,_0x35adbf,_0x4d6efd,_0x19f889){var _0x2babae={'$or':{'Phone':_0x4d6efd}};var _0x31b03b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc7c8('0x27')]()[_0xc7c8('0x24')](function(){logger[_0xc7c8('0x29')](_0xc7c8('0x2e'),_0x4d6efd,_0x1a6f39[_0xc7c8('0x2f')]);switch(_0x1a6f39[_0xc7c8('0x2f')]){case'contact_lead':var _0x318756=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39[_0xc7c8('0x31')]){var _0x56b001={};_0x56b001[_0x1a6f39['additionalSearchContact']]=_0x4d6efd;_['merge'](_0x318756[_0xc7c8('0x32')],_0x56b001);}return _0x19f889[_0xc7c8('0x1e')]('Contact')[_0xc7c8('0x22')](_0x318756,_0x31b03b)[_0xc7c8('0x23')]()[_0xc7c8('0x24')](function(_0x4cb2c4){if(_0x4cb2c4&&_0x4cb2c4[_0xc7c8('0x25')]){return _0x4cb2c4;}else{var _0x369a52=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39['additionalSearchLead']){var _0x33059e={};_0x33059e[_0x1a6f39['additionalSearchLead']]=_0x4d6efd;_[_0xc7c8('0x33')](_0x369a52[_0xc7c8('0x32')],_0x33059e);}return _0x19f889[_0xc7c8('0x1e')](_0xc7c8('0x34'))[_0xc7c8('0x22')](_0x369a52,_0x31b03b);}});case'account_contact_lead':var _0x328631=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39[_0xc7c8('0x35')]){var _0x56b001={};_0x56b001[_0x1a6f39['additionalSearchAccount']]=_0x4d6efd;_['merge'](_0x328631[_0xc7c8('0x32')],_0x56b001);}return _0x19f889[_0xc7c8('0x1e')](_0xc7c8('0x36'))[_0xc7c8('0x22')](_0x328631,_0x31b03b)[_0xc7c8('0x23')]()[_0xc7c8('0x24')](function(_0xe7876e){if(_0xe7876e&&_0xe7876e[_0xc7c8('0x25')]){return _0xe7876e;}else{var _0x4c18a2=_['cloneDeep'](_0x2babae);if(_0x1a6f39['additionalSearchContact']){var _0x1241e0={};_0x1241e0[_0x1a6f39[_0xc7c8('0x31')]]=_0x4d6efd;_[_0xc7c8('0x33')](_0x4c18a2[_0xc7c8('0x32')],_0x1241e0);}return _0x19f889['sobject'](_0xc7c8('0x37'))[_0xc7c8('0x22')](_0x4c18a2,_0x31b03b)[_0xc7c8('0x24')](function(_0x3ca7c0){if(_0x3ca7c0&&_0x3ca7c0[_0xc7c8('0x25')]){return _0x3ca7c0;}else{var _0x5df4f1=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39[_0xc7c8('0x38')]){var _0x3a8b51={};_0x3a8b51[_0x1a6f39[_0xc7c8('0x38')]]=_0x4d6efd;_['merge'](_0x5df4f1[_0xc7c8('0x32')],_0x3a8b51);}return _0x19f889['sobject']('Lead')['find'](_0x5df4f1,_0x31b03b);}});}});case _0xc7c8('0x16'):var _0x318756=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39[_0xc7c8('0x31')]){var _0x56b001={};_0x56b001[_0x1a6f39['additionalSearchContact']]=_0x4d6efd;_[_0xc7c8('0x33')](_0x318756[_0xc7c8('0x32')],_0x56b001);}return _0x19f889[_0xc7c8('0x1e')](_0xc7c8('0x37'))['find'](_0x318756,_0x31b03b)[_0xc7c8('0x23')]();case'lead':var _0x21dd71=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39['additionalSearchLead']){var _0x56b001={};_0x56b001[_0x1a6f39[_0xc7c8('0x38')]]=_0x4d6efd;_[_0xc7c8('0x33')](_0x21dd71[_0xc7c8('0x32')],_0x56b001);}return _0x19f889[_0xc7c8('0x1e')]('Lead')[_0xc7c8('0x22')](_0x21dd71,_0x31b03b);case _0xc7c8('0x18'):var _0x328631=_[_0xc7c8('0x30')](_0x2babae);if(_0x1a6f39[_0xc7c8('0x35')]){var _0x56b001={};_0x56b001[_0x1a6f39[_0xc7c8('0x35')]]=_0x4d6efd;_[_0xc7c8('0x33')](_0x328631[_0xc7c8('0x32')],_0x56b001);}return _0x19f889[_0xc7c8('0x1e')](_0xc7c8('0x36'))[_0xc7c8('0x22')](_0x328631,_0x31b03b);default:return null;}})[_0xc7c8('0x24')](function(_0x5a834b){if(_0x5a834b&&_0x5a834b[_0xc7c8('0x25')]){var _0x5ecb61=_[_0xc7c8('0x39')](_0x5a834b);if(_0x5ecb61){return BPromise[_0xc7c8('0x27')]({'id':_0x5ecb61['Id'],'name':_0x5ecb61[_0xc7c8('0x28')],'phone':_0x5ecb61[_0xc7c8('0x3a')],'endUserType':_0x5ecb61['attributes'][_0xc7c8('0x3b')][_0xc7c8('0x3c')]()});}}})[_0xc7c8('0x24')](function(_0x1a93ce){if(_0x1a93ce){logger['info'](_0xc7c8('0x3d'),_0x1a93ce[_0xc7c8('0x15')],_0x4d6efd);return BPromise[_0xc7c8('0x27')](_0x1a93ce);}else{logger[_0xc7c8('0x29')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4d6efd);var _0x3ee519={'Phone':_0x4d6efd};if(_0x1a6f39['moduleCreate']){if(_0x1a6f39[_0xc7c8('0x3e')]===_0xc7c8('0x16')){logger[_0xc7c8('0x29')](_0xc7c8('0x3f'),_0x4d6efd,_0x1a6f39[_0xc7c8('0x3e')]);_0x3ee519[_0xc7c8('0x40')]=_0x35adbf!==_0xc7c8('0x41')?_0x35adbf:util['format'](_0xc7c8('0x42'),_0x4d6efd);}else if(_0x1a6f39[_0xc7c8('0x3e')]===_0xc7c8('0x17')){logger[_0xc7c8('0x29')](_0xc7c8('0x3f'),_0x4d6efd,_0x1a6f39[_0xc7c8('0x3e')]);_0x3ee519[_0xc7c8('0x40')]=_0x35adbf!==_0xc7c8('0x41')?_0x35adbf:util[_0xc7c8('0x43')](_0xc7c8('0x42'),_0x4d6efd);_0x3ee519[_0xc7c8('0x44')]=_0xc7c8('0x45');}else if(_0x1a6f39[_0xc7c8('0x3e')]===_0xc7c8('0x18')){logger[_0xc7c8('0x29')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4d6efd,_0x1a6f39[_0xc7c8('0x3e')]);_0x3ee519[_0xc7c8('0x28')]=_0x35adbf!==''?_0x35adbf:util[_0xc7c8('0x43')](_0xc7c8('0x42'),_0x4d6efd);}else{return null;}}return _0x19f889[_0xc7c8('0x1e')](_['upperFirst'](_0x1a6f39[_0xc7c8('0x3e')]))['create'](_0x3ee519)['then'](function(_0x4b604a){return BPromise[_0xc7c8('0x27')]({'id':_0x4b604a['id'],'endUserType':_0x1a6f39['moduleCreate']});});}});}function getCustomFields(_0x1416c4,_0x346af3){var _0x573777={};if(_0x1416c4[_0xc7c8('0x25')]>0x0){_['forEach'](_0x1416c4,function(_0x5c6afc){if(_[_0xc7c8('0x46')]([_0xc7c8('0x47'),_0xc7c8('0x48')],_0x5c6afc[_0xc7c8('0x3b')])&&_0x5c6afc[_0xc7c8('0x49')]){_0x573777[_0x5c6afc[_0xc7c8('0x49')]]=_0x5c6afc[_0xc7c8('0x4a')][_0xc7c8('0x4b')]();}else if(_0x5c6afc[_0xc7c8('0x3b')]===_0xc7c8('0x4c')&&_0x5c6afc[_0xc7c8('0x4d')]&&_0x5c6afc[_0xc7c8('0x49')]){_0x346af3[_0x5c6afc['variableName']]&&(_0x573777[_0x5c6afc[_0xc7c8('0x49')]]=_0x346af3[_0x5c6afc['variableName']][_0xc7c8('0x4b')]());}else if(_0x5c6afc[_0xc7c8('0x3b')]===_0xc7c8('0x4e')&&_0x5c6afc[_0xc7c8('0x4f')]&&_0x5c6afc[_0xc7c8('0x4f')][_0xc7c8('0x50')]&&_0x5c6afc[_0xc7c8('0x49')]){_0x346af3[_0x5c6afc[_0xc7c8('0x4f')]['name'][_0xc7c8('0x3c')]()]&&(_0x573777[_0x5c6afc['idField']]=_0x346af3[_0x5c6afc[_0xc7c8('0x4f')]['name'][_0xc7c8('0x3c')]()][_0xc7c8('0x4b')]());}});}return _0x573777;}function getConnection(_0x1b13bf){var _0x112f10=_0x1b13bf['password'][_0xc7c8('0x51')](_0x1b13bf[_0xc7c8('0x52')]);var _0x5a5fc0=new jsforce[(_0xc7c8('0x53'))]({'oauth2':{'loginUrl':_0x1b13bf['remoteUri']||'https://login.salesforce.com','clientId':_0x1b13bf[_0xc7c8('0x54')],'clientSecret':_0x1b13bf['clientSecret']}});return _0x5a5fc0[_0xc7c8('0x55')](_0x1b13bf[_0xc7c8('0x56')],_0x112f10)[_0xc7c8('0x24')](function(){logger[_0xc7c8('0x29')](_0xc7c8('0x57'));return _0x5a5fc0;});}exports['queue']=function(_0x379fdc,_0x540ccc,_0x525719,_0x41ef7c,_0x26d669,_0x1c8f74){var _0x32c351,_0xce88b7,_0x5208e0,_0x251ad3;_0x1c8f74['serverUrl']=intUtil[_0xc7c8('0x58')](_0x1c8f74[_0xc7c8('0x59')]);_0x1c8f74[_0xc7c8('0x5a')]=intUtil[_0xc7c8('0x58')](_0x1c8f74[_0xc7c8('0x5a')]);if(_0x26d669&&_0x26d669[_0xc7c8('0x5b')]){logger['info'](_0xc7c8('0x5c'),_0xc7c8('0x5d'));_0x540ccc[_0xc7c8('0x5e')]=util[_0xc7c8('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c8f74[_0xc7c8('0x59')],_0x540ccc['uniqueid'],md5(_0x540ccc[_0xc7c8('0x5f')]));}else{_0x540ccc[_0xc7c8('0x5e')]='';}return getConnection(_0x1c8f74)[_0xc7c8('0x24')](function(_0x3a9fdf){_0x251ad3=_0x3a9fdf;return getUser(_0x1c8f74,_0x41ef7c[_0xc7c8('0x60')],_0x251ad3);})[_0xc7c8('0x24')](function(_0x37834a){_0x32c351=_0x37834a;return getEndUser(_0x1c8f74,_0x525719,_0x540ccc[_0xc7c8('0x61')],_0x540ccc[_0xc7c8('0x62')],_0x251ad3);})[_0xc7c8('0x24')](function(_0x5721c6){_0xce88b7=_0x5721c6;return getTicket(_0x1c8f74,_0x32c351,_0xce88b7,_0x525719,_0x540ccc,_0x525719[_0xc7c8('0x63')],_0x251ad3,_0xc7c8('0x64'));})['then'](function(_0xb509ae){_0x5208e0=_0xb509ae;logger[_0xc7c8('0x29')](_0xc7c8('0x65'),_0x5208e0['id']);logger[_0xc7c8('0x29')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5208e0['id'],_0x41ef7c['name'],_0x1c8f74[_0xc7c8('0x3b')]);switch(_0x1c8f74['type']){case'integrationTab':emit(util[_0xc7c8('0x43')](_0xc7c8('0x66'),_0x41ef7c[_0xc7c8('0x50')]),_0xc7c8('0x67'),{'recordId':_0x5208e0['id']});break;case'newTab':emit(util[_0xc7c8('0x43')]('user:%s',_0x41ef7c[_0xc7c8('0x50')]),_0xc7c8('0x68'),{'uri':util[_0xc7c8('0x43')](_0xc7c8('0x69'),_0x251ad3[_0xc7c8('0x6a')],_0x5208e0['id'])});break;default:logger[_0xc7c8('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5f53d2){logger[_0xc7c8('0x6b')](_0xc7c8('0x5c'),_0x5f53d2);});};exports['outbound']=function(_0x91d3a6,_0x388a07,_0x55da67,_0x495f65,_0x3a350d,_0x37e4a3,_0x2ce68c){var _0x1f8cbc,_0x4dc33c,_0x300e3b,_0xf07437;_0x37e4a3['serverUrl']=intUtil[_0xc7c8('0x58')](_0x37e4a3[_0xc7c8('0x59')]);_0x37e4a3[_0xc7c8('0x5a')]=intUtil['stripTrailingSlash'](_0x37e4a3[_0xc7c8('0x5a')]);if(_0x2ce68c&&_0x2ce68c['recordingFormat']&&_0x2ce68c['recordingFormat']!=='none'){logger['info'](_0xc7c8('0x6c'),_0xc7c8('0x5d'));_0x388a07['recordingURL']=util[_0xc7c8('0x43')](_0xc7c8('0x6d'),_0x37e4a3[_0xc7c8('0x59')],_0x388a07[_0xc7c8('0x5f')],md5(_0x388a07['uniqueid']));}return getConnection(_0x37e4a3)[_0xc7c8('0x24')](function(_0xb89fcc){_0xf07437=_0xb89fcc;return getUser(_0x37e4a3,_0x495f65['email'],_0xf07437);})[_0xc7c8('0x24')](function(_0x3fa472){_0x1f8cbc=_0x3fa472;return getEndUser(_0x37e4a3,_0x55da67,_0x388a07['destcalleridname'],_0x388a07[_0xc7c8('0x6e')],_0xf07437);})['then'](function(_0x1f9290){_0x4dc33c=_0x1f9290;return getTicket(_0x37e4a3,_0x1f8cbc,_0x4dc33c,_0x55da67,_0x388a07,_0x55da67[_0xc7c8('0x63')],_0xf07437,_0xc7c8('0x6f'));})[_0xc7c8('0x24')](function(_0x582046){_0x300e3b=_0x582046;logger[_0xc7c8('0x29')](_0xc7c8('0x70'),_0x300e3b['id']);logger['info'](_0xc7c8('0x71'),_0x300e3b['id'],_0x495f65[_0xc7c8('0x50')],_0x37e4a3[_0xc7c8('0x3b')]);switch(_0x37e4a3['type']){case _0xc7c8('0x72'):emit(util[_0xc7c8('0x43')](_0xc7c8('0x66'),_0x495f65[_0xc7c8('0x50')]),_0xc7c8('0x67'),{'recordId':_0x300e3b['id']});break;case'newTab':emit(util[_0xc7c8('0x43')]('user:%s',_0x495f65['name']),_0xc7c8('0x68'),{'uri':util['format'](_0xc7c8('0x69'),_0xf07437[_0xc7c8('0x6a')],_0x300e3b['id'])});break;default:logger['error'](_0xc7c8('0x6c'),_0xc7c8('0x73'));}})[_0xc7c8('0x74')](function(_0x138d6f){logger[_0xc7c8('0x6b')]('[OUTBOUND]',_0x138d6f);});};exports['unmanaged']=function(_0x366822,_0xe657ec,_0x15b2db,_0xd3e1f3,_0x5e5ce9,_0x53bde3){var _0x30e50d,_0x1eb316,_0x3c48b6,_0x51e482;_0x53bde3[_0xc7c8('0x59')]=intUtil[_0xc7c8('0x58')](_0x53bde3['serverUrl']);_0x53bde3[_0xc7c8('0x5a')]=intUtil[_0xc7c8('0x58')](_0x53bde3[_0xc7c8('0x5a')]);if(_0x5e5ce9&&_0x5e5ce9[_0xc7c8('0x5b')]){logger[_0xc7c8('0x29')]('['+_0xe657ec[_0xc7c8('0x75')][_0xc7c8('0x76')]()+']',_0xc7c8('0x5d'));_0xe657ec['recordingURL']=util[_0xc7c8('0x43')](_0xc7c8('0x6d'),_0x53bde3[_0xc7c8('0x59')],_0xe657ec[_0xc7c8('0x5f')],md5(_0xe657ec[_0xc7c8('0x5f')]));}else{_0xe657ec[_0xc7c8('0x5e')]='';}return getConnection(_0x53bde3)[_0xc7c8('0x24')](function(_0x5e450e){_0x51e482=_0x5e450e;if(!_[_0xc7c8('0x1f')](_0xd3e1f3)){return getUser(_0x53bde3,_0xd3e1f3[_0xc7c8('0x50')],_0x51e482);}else{return getUser(_0x53bde3,null,_0x51e482);}})[_0xc7c8('0x24')](function(_0x242784){_0x30e50d=_0x242784;return getEndUser(_0x53bde3,_0x15b2db,_0xe657ec[_0xc7c8('0x61')],_0xe657ec[_0xc7c8('0x62')],_0x51e482);})[_0xc7c8('0x24')](function(_0x1cbae7){_0x1eb316=_0x1cbae7;return getTicket(_0x53bde3,_0x30e50d,_0x1eb316,_0x15b2db,_0xe657ec,_0x15b2db['Fields'],_0x51e482);})['then'](function(_0x2b5437){_0x3c48b6=_0x2b5437;logger[_0xc7c8('0x29')]('['+_0xe657ec[_0xc7c8('0x75')][_0xc7c8('0x76')]()+_0xc7c8('0x77'),_0x3c48b6['id']);logger[_0xc7c8('0x29')]('['+_0xe657ec[_0xc7c8('0x75')][_0xc7c8('0x76')]()+_0xc7c8('0x78'),_0x53bde3['type']);})[_0xc7c8('0x74')](function(_0xdca1e6){logger[_0xc7c8('0x6b')]('['+_0xe657ec[_0xc7c8('0x75')]['toUpperCase']()+']',_0xdca1e6);});}; \ 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 cdd04f5..1fe4632 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 _0x8193=['result','length','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','active','userId','adminId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x40409e,_0x517347){var _0x28b8ef=function(_0xd3135d){while(--_0xd3135d){_0x40409e['push'](_0x40409e['shift']());}};_0x28b8ef(++_0x517347);}(_0x8193,0x1a4));var _0x3819=function(_0x532a6c,_0x4982cf){_0x532a6c=_0x532a6c-0x0;var _0x4a54e8=_0x8193[_0x532a6c];return _0x4a54e8;};'use strict';var _=require(_0x3819('0x0'));var Promise=require(_0x3819('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x3819('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3819('0x3'));var config=require(_0x3819('0x4'));var logger=require(_0x3819('0x5'))(_0x3819('0x6'));config[_0x3819('0x7')]=_[_0x3819('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3819('0x9'))(new Redis(config[_0x3819('0x7')]));function getAdminUser(_0x3894b7,_0x542f28,_0x52bea1,_0x387c4e,_0x509db7,_0x54fa61){return new Promise(function(_0x3eb91c,_0x55dff1){var _0x38fb59={'method':_0x3819('0xa'),'uri':_0x387c4e+_0x3819('0xb')+'&'+_0x509db7+'&'+_0x54fa61,'auth':_0x542f28,'json':!![]};return rp(_0x38fb59)['then'](function(_0x4be07d){if(_0x4be07d[_0x3819('0xc')][_0x3819('0xd')]>0x0){_0x52bea1['adminId']=_0x4be07d[_0x3819('0xc')][0x0][_0x3819('0xe')];}logger['info']('['+[_0x3894b7[_0x3819('0xf')]()]+_0x3819('0x10'),_0x52bea1);_0x3eb91c(_0x52bea1);})[_0x3819('0x11')](function(_0x297ee2){logger['error']('['+[_0x3894b7[_0x3819('0xf')]()]+']',_0x297ee2[_0x3819('0x12')]);_0x55dff1(_0x297ee2['message']);});});}function getUser(_0x5c20c3,_0x4ee845,_0x2af629,_0xceeb12,_0x1e8d2f){return function(_0x13537f){logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x13537f);return new Promise(function(_0x3cf183,_0x2a211a){if(intUtil[_0x3819('0x14')](_0x13537f[_0x3819('0x15')])){var _0x344254={'method':'GET','uri':_0x2af629+_0x3819('0x16')+_0x13537f['userEmail']+'&'+_0xceeb12+'&'+_0x1e8d2f,'auth':_0x4ee845,'json':!![]};logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+_0x3819('0x17'),_0x344254);return rp(_0x344254)[_0x3819('0x18')](function(_0x1770fa){logger['info']('['+[_0x5c20c3[_0x3819('0xf')]()]+'],\x20getUser\x20entity',_0x1770fa);if(_0x1770fa[_0x3819('0xc')][_0x3819('0xd')]>0x0&&String(_0x1770fa['result'][0x0][_0x3819('0x19')])==='true'){_0x13537f[_0x3819('0x1a')]=_0x1770fa[_0x3819('0xc')][0x0][_0x3819('0xe')];}else{_0x13537f['userId']=_0x13537f[_0x3819('0x1b')];_0x13537f[_0x3819('0x15')]=_0x13537f[_0x3819('0x1c')];}logger[_0x3819('0x13')]('['+[_0x5c20c3['toUpperCase']()]+_0x3819('0x1d'),_0x13537f);_0x3cf183(_0x13537f);})[_0x3819('0x11')](function(_0x5af48d){logger[_0x3819('0x1e')]('['+[_0x5c20c3[_0x3819('0xf')]()]+']',_0x5af48d[_0x3819('0x12')]);_0x2a211a(_0x5af48d[_0x3819('0x12')]);});}else{logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+_0x3819('0x1f'));_0x13537f[_0x3819('0x1a')]=_0x13537f[_0x3819('0x1b')];_0x13537f[_0x3819('0x15')]=_0x13537f[_0x3819('0x1c')];_0x3cf183(_0x13537f);}});};}function createEndUser(_0x10ac5d,_0x64e5e,_0x197585,_0x4fa8ff,_0x10cec9){logger[_0x3819('0x13')]('['+[_0x10ac5d[_0x3819('0xf')]()]+_0x3819('0x20'),_0x197585);return new Promise(function(_0x2417aa,_0x941220){var _0x212dc9={'method':_0x3819('0x21'),'uri':_0x4fa8ff+_0x3819('0x22')+_0x10cec9,'body':{'user_name':_0x197585['endUserNumber'],'roles':_0x3819('0x23'),'first_name':_0x197585[_0x3819('0x24')],'active':_0x3819('0x25'),'date_format':'System','phone':_0x197585[_0x3819('0x24')]},'auth':_0x64e5e,'json':!![]};return rp(_0x212dc9)[_0x3819('0x18')](function(_0x4051b4){logger[_0x3819('0x13')]('['+[_0x10ac5d[_0x3819('0xf')]()]+_0x3819('0x26'),_0x4051b4[_0x3819('0xc')]);_0x197585['endUserId']=_0x4051b4[_0x3819('0xc')]['sys_id'];_0x2417aa(_0x197585);})['catch'](function(_0x6c50dd){logger[_0x3819('0x1e')]('['+[_0x10ac5d[_0x3819('0xf')]()]+']',_0x6c50dd['message']);_0x941220(_0x6c50dd[_0x3819('0x12')]);});});}function getEndUser(_0x4e020f,_0x3bf448,_0x35a084,_0x39bc76,_0xe8ce){return function(_0x33fe8f){logger[_0x3819('0x13')]('['+[_0x4e020f[_0x3819('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x33fe8f);return new Promise(function(_0x4b57e0,_0x641088){var _0x23f595={'method':'GET','uri':_0x35a084+'sys_user?sysparm_query=phone%3D'+_0x33fe8f[_0x3819('0x24')]+'&'+_0x39bc76+'&'+_0xe8ce,'auth':_0x3bf448,'json':!![]};return rp(_0x23f595)[_0x3819('0x18')](function(_0x42e258){if(_0x42e258[_0x3819('0xc')][_0x3819('0xd')]>0x0){_0x33fe8f[_0x3819('0x27')]=_0x42e258[_0x3819('0xc')][0x0][_0x3819('0xe')];logger[_0x3819('0x13')]('['+[_0x4e020f[_0x3819('0xf')]()]+_0x3819('0x28'),_0x33fe8f);_0x4b57e0(_0x33fe8f);}else{return createEndUser(_0x4e020f,_0x3bf448,_0x33fe8f,_0x35a084,_0x39bc76)[_0x3819('0x18')](function(_0x5e6a50){logger['info']('['+[_0x4e020f[_0x3819('0xf')]()]+'],\x20createEndUser\x20crm',_0x5e6a50);_0x4b57e0(_0x5e6a50);});}})[_0x3819('0x11')](function(_0x5c2b1d){logger[_0x3819('0x1e')]('['+[_0x4e020f['toUpperCase']()]+']',_0x5c2b1d[_0x3819('0x12')]);_0x641088(_0x5c2b1d[_0x3819('0x12')]);});});};}function getCustomFields(_0x532ec8,_0x452bd3){var _0x516cc2={};if(_0x532ec8['length']>0x0){_[_0x3819('0x29')](_0x532ec8,function(_0x281b2f){if(_[_0x3819('0x2a')]([_0x3819('0x2b'),_0x3819('0x2c')],_0x281b2f[_0x3819('0x2d')])&&_0x281b2f[_0x3819('0x2e')]&&!_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f[_0x3819('0x2e')][_0x3819('0x30')]()]=_0x281b2f[_0x3819('0x31')][_0x3819('0x32')]();}else if(_['includes']([_0x3819('0x2b'),_0x3819('0x2c')],_0x281b2f[_0x3819('0x2d')])&&_0x281b2f[_0x3819('0x33')]&&_0x281b2f['customField']){_0x516cc2[_0x281b2f[_0x3819('0x33')][_0x3819('0x30')]()]=_0x281b2f[_0x3819('0x31')][_0x3819('0x32')]();}else if(_0x281b2f[_0x3819('0x2d')]===_0x3819('0x34')&&_0x281b2f[_0x3819('0x35')]&&_0x281b2f['idField']&&_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f[_0x3819('0x33')]['toLowerCase']()]=_0x452bd3[_0x281b2f[_0x3819('0x35')]][_0x3819('0x32')]();}else if(_0x281b2f[_0x3819('0x2d')]===_0x3819('0x36')&&_0x281b2f[_0x3819('0x37')]&&_0x281b2f['Variable'][_0x3819('0x38')]&&_0x281b2f[_0x3819('0x33')]&&_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f['idField'][_0x3819('0x30')]()]=_0x452bd3[_0x281b2f[_0x3819('0x37')][_0x3819('0x38')][_0x3819('0x30')]()][_0x3819('0x32')]();}});}return _0x516cc2;}function getTicket(_0x3ece50,_0x5210e,_0x15f682,_0x2e8f20,_0x173466,_0x4d104b){return function(_0x11300a){logger[_0x3819('0x13')]('['+[_0x3ece50[_0x3819('0xf')]()]+_0x3819('0x39'),_0x11300a);return new Promise(function(_0x4ea6bf,_0x227e8d){var _0x55ac8c=_0x3ece50[_0x3819('0x30')]()===_0x3819('0x3a')?_0x11300a[_0x3819('0x1a')]:_0x11300a['endUserId'];var _0xf03a20={'method':_0x3819('0x21'),'uri':_0x15f682+_0x3819('0x3b')+'?'+_0x4d104b,'body':Object['assign']({},{'active':_0x3819('0x25'),'caller_id':_0x55ac8c,'assigned_to':_0x11300a['userId'],'short_description':intUtil[_0x3819('0x3c')](_0x2e8f20[_0x3819('0x3d')],_0x173466,'\x20'),'description':intUtil['getString'](_0x2e8f20[_0x3819('0x3e')],_0x173466,'\x0a')},getCustomFields(_0x2e8f20[_0x3819('0x3f')],_0x173466)),'auth':_0x5210e,'json':!![]};return rp(_0xf03a20)[_0x3819('0x18')](function(_0x34b203){logger[_0x3819('0x13')]('['+[_0x3ece50[_0x3819('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x34b203[_0x3819('0xc')]);_0x11300a[_0x3819('0x40')]=_0x34b203[_0x3819('0xc')][_0x3819('0xe')];_0x11300a['ticketNumber']=_0x34b203['result'][_0x3819('0x41')];logger['info']('['+[_0x3ece50['toUpperCase']()]+_0x3819('0x42'),_0x11300a);_0x4ea6bf(_0x11300a);})[_0x3819('0x11')](function(_0x547978){logger[_0x3819('0x1e')]('['+[_0x3ece50[_0x3819('0xf')]()]+']',_0x547978['message']);_0x227e8d(_0x547978[_0x3819('0x12')]);});});};}function createRemoteTag(_0x2eb68f,_0x1d2633,_0xd4767e,_0x628574){return new Promise(function(_0x2278ee,_0x794f13){var _0x334729={'method':_0x3819('0x21'),'uri':_0xd4767e+_0x3819('0x43')+'?'+_0x628574,'body':{'short_description':_0x2eb68f,'global':!![],'active':!![],'name':_0x2eb68f},'auth':_0x1d2633,'json':!![]};return rp(_0x334729)[_0x3819('0x18')](function(_0x1777f8){var _0x3dc158=_0x1777f8['result']['sys_id'];_0x2278ee(_0x3dc158);});});}function getRemoteTag(_0x1b6616,_0xe14495,_0x1f4799,_0x2dae70,_0xbfb23a){return new Promise(function(_0x2b279e,_0x56992a){var _0x5cde4a={'method':_0x3819('0xa'),'uri':_0x1f4799+_0x3819('0x43')+_0x3819('0x44')+_0x1b6616+'&'+_0x2dae70,'auth':_0xe14495,'json':!![]};return rp(_0x5cde4a)[_0x3819('0x18')](function(_0x2d7a72){if(_0x2d7a72['result']['length']>0x0){var _0xd40eb8=_0x2d7a72[_0x3819('0xc')][0x0]['sys_id'];_0x2b279e(_0xd40eb8);}else{return createRemoteTag(_0x1b6616,_0xe14495,_0x1f4799,_0x2dae70)[_0x3819('0x18')](function(_0x4cdd13){_0x2b279e(_0x4cdd13);});}});});}function assignTagToIncident(_0x33b0f1,_0x1cc95b,_0x57fdce,_0x30199f,_0x5c749f){return new Promise(function(_0x4da0a2,_0x34aa08){var _0x2af99b={'method':_0x3819('0x21'),'uri':_0x57fdce+_0x3819('0x45')+'?'+_0x5c749f,'body':{'label':_0x33b0f1,'table':'incident','id_type':_0x3819('0x46'),'table_key':_0x30199f[_0x3819('0x40')],'title':_0x3819('0x47')+_0x30199f[_0x3819('0x48')],'id_display':_0x30199f['ticketNumber']},'auth':_0x1cc95b,'json':!![]};return rp(_0x2af99b)[_0x3819('0x18')](function(_0x2a8de5){_0x4da0a2();})[_0x3819('0x11')](function(){_0x4da0a2();});});}function manageTags(_0x189745,_0x45da6b,_0x57f26b,_0x1f679a,_0xaa59ff,_0x393d33,_0x599614){return new Promise(function(_0x6bde19,_0x15a02f){var _0x55872b=[];_0x45da6b['forEach'](function(_0x23a120){_0x55872b[_0x3819('0x49')](getRemoteTag(_0x23a120,_0x57f26b,_0x1f679a,_0x393d33,_0x599614));});return Promise['all'](_0x55872b)[_0x3819('0x18')](function(_0x5c700a){if(_0x5c700a[_0x3819('0xd')]){logger[_0x3819('0x13')]('['+[_0x189745['toUpperCase']()]+_0x3819('0x4a'),_0x5c700a);var _0x2b660f=[];_0x5c700a[_0x3819('0x29')](function(_0x1b850c){_0x2b660f[_0x3819('0x49')](assignTagToIncident(_0x1b850c,_0x57f26b,_0x1f679a,_0xaa59ff,_0x393d33));});return Promise[_0x3819('0x4b')](_0x2b660f)['then'](function(){_0x6bde19();})['catch'](function(){_0x6bde19();});}else{_0x6bde19();}});});}function getTags(_0x5ac667,_0x2bbe95,_0x28eb54,_0x2630a3,_0x4a4817,_0x375c84){return function(_0x2220c5){return new Promise(function(_0x4c3b95,_0x36b60b){var _0x29e4c1=[];var _0x579338=_0x2630a3[_0x3819('0x4c')];if(_0x579338&&_0x579338[_0x3819('0xd')]>0x0){_0x29e4c1=_['map'](_0x579338,_0x3819('0x38'));}if(_0x29e4c1['length']>0x0){return manageTags(_0x5ac667,_0x29e4c1,_0x2bbe95,_0x28eb54,_0x2220c5,_0x4a4817,_0x375c84)[_0x3819('0x18')](function(){_0x4c3b95(_0x2220c5);});}else{_0x4c3b95(_0x2220c5);}});};}function emit(_0x3046ee,_0x85ff39,_0xd39b1e){var _0xc59c5c=_0x3819('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x3819('0x4e');var _0x31fad5={'uri':_0x3046ee+_0x3819('0x4f')+_0xd39b1e+_0xc59c5c};io['to'](util[_0x3819('0x50')](_0x3819('0x51'),_0x85ff39))[_0x3819('0x52')](_0x3819('0x53'),_0x31fad5);}exports['cs']=function(_0x5ca853,_0xc9df55,_0x19b0ee,_0xad866a,_0xab420d,_0x1c44ae,_0x4eb6f8,_0x3c730a){var _0xa02217={};var _0x3d2f77={'user':_0x1c44ae[_0x3819('0x54')],'pass':_0x1c44ae['password']};var _0x514c84=_0x3819('0x55');var _0x26bfc6=_0x3819('0x56');_0x1c44ae[_0x3819('0x57')]=intUtil[_0x3819('0x58')](_0x1c44ae[_0x3819('0x57')]);_0x1c44ae[_0x3819('0x59')]=intUtil[_0x3819('0x58')](_0x1c44ae['serverUrl']);var _0x111068=util[_0x3819('0x50')](_0x3819('0x5a'),_0x1c44ae[_0x3819('0x57')]);_0xa02217[_0x3819('0x15')]=!_[_0x3819('0x5b')](_0xad866a)?_0xad866a[_0x3819('0x5c')]:null;_0xa02217[_0x3819('0x1c')]=_0x1c44ae[_0x3819('0x5c')];_0xa02217[_0x3819('0x24')]=_0x3c730a[_0x3819('0x30')]()===_0x3819('0x3a')?_0xc9df55[_0x3819('0x5d')]:_0xc9df55[_0x3819('0x5e')];_0xa02217[_0x3819('0x5f')]=_0x3c730a===_0x3819('0x60')||_0x3c730a===_0x3819('0x61')?'queue':_0x3819('0x3a');var _0x4ef29b=util['format'](_0x3819('0x62'),_0x1c44ae['serverUrl'],_0xc9df55[_0x3819('0x63')],md5(_0xc9df55[_0x3819('0x63')]));if(_0xab420d&&_0xab420d[_0x3819('0x64')]){logger[_0x3819('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0xc9df55[_0x3819('0x65')]=_0x4ef29b;}else if(_0x4eb6f8&&_0x4eb6f8['recordingFormat']&&_0x4eb6f8['recordingFormat']!==_0x3819('0x66')){logger[_0x3819('0x13')](_0x3819('0x67'),_0x3819('0x68'));_0xc9df55[_0x3819('0x65')]=_0x4ef29b;}else{_0xc9df55[_0x3819('0x65')]='';}return getAdminUser(_0x3c730a,_0x3d2f77,_0xa02217,_0x111068,_0x26bfc6,_0x514c84)[_0x3819('0x18')](getUser(_0x3c730a,_0x3d2f77,_0x111068,_0x26bfc6,_0x514c84))[_0x3819('0x18')](getEndUser(_0x3c730a,_0x3d2f77,_0x111068,_0x26bfc6,_0x514c84))[_0x3819('0x18')](getTicket(_0x3c730a,_0x3d2f77,_0x111068,_0x19b0ee,_0xc9df55,_0x26bfc6))[_0x3819('0x18')](function(_0x29ccf9){logger[_0x3819('0x13')](util[_0x3819('0x50')](_0x3819('0x69'),_0x29ccf9[_0x3819('0x40')]));logger[_0x3819('0x13')](util[_0x3819('0x50')](_0x3819('0x6a'),_0x3c730a));if(_0x3c730a!=='unmanaged'){logger['info']('['+[_0x3c730a[_0x3819('0xf')]()]+']',_0x3819('0x6b'));emit(_0x1c44ae[_0x3819('0x57')],_0xad866a[_0x3819('0x38')],_0x29ccf9[_0x3819('0x40')]);}})[_0x3819('0x11')](function(_0x119ba4){logger[_0x3819('0x1e')]('['+[_0x3c730a[_0x3819('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x119ba4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa39d=['label_entry','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','request-promise','md5','ioredis','../../../../config/environment','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','length','active','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','content','toString','string','idField','toLowerCase','variable','variableName','name','Variable',']\x20getTicket\x20input\x20crm','incident','assign','true','getString','Subjects','Fields','ticketId','label','?sysparm_query=name%3D','POST'];(function(_0x3d0502,_0x1f030f){var _0x4263c3=function(_0x8e5d57){while(--_0x8e5d57){_0x3d0502['push'](_0x3d0502['shift']());}};_0x4263c3(++_0x1f030f);}(_0xa39d,0x88));var _0xda39=function(_0x500bc2,_0x278c52){_0x500bc2=_0x500bc2-0x0;var _0xeb1575=_0xa39d[_0x500bc2];return _0xeb1575;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0xda39('0x0'));var util=require('util');var md5=require(_0xda39('0x1'));var Redis=require(_0xda39('0x2'));var intUtil=require('./util');var config=require(_0xda39('0x3'));var logger=require('../../../../config/logger')('servicenow');config[_0xda39('0x4')]=_[_0xda39('0x5')](config[_0xda39('0x4')],{'host':_0xda39('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xda39('0x4')]));function getAdminUser(_0x222ff6,_0x1bd30e,_0x3d393b,_0x54936e,_0x4eb106,_0x2ea237){return new Promise(function(_0x4c7ff8,_0x502d67){var _0x1b4226={'method':_0xda39('0x7'),'uri':_0x54936e+_0xda39('0x8')+'&'+_0x4eb106+'&'+_0x2ea237,'auth':_0x1bd30e,'json':!![]};return rp(_0x1b4226)[_0xda39('0x9')](function(_0x536486){if(_0x536486[_0xda39('0xa')]['length']>0x0){_0x3d393b[_0xda39('0xb')]=_0x536486[_0xda39('0xa')][0x0]['sys_id'];}logger[_0xda39('0xc')]('['+[_0x222ff6[_0xda39('0xd')]()]+_0xda39('0xe'),_0x3d393b);_0x4c7ff8(_0x3d393b);})[_0xda39('0xf')](function(_0x1120f0){logger[_0xda39('0x10')]('['+[_0x222ff6[_0xda39('0xd')]()]+']',_0x1120f0[_0xda39('0x11')]);_0x502d67(_0x1120f0[_0xda39('0x11')]);});});}function getUser(_0xd0b541,_0x53db94,_0x4f9d26,_0x4d5f6a,_0x3a2f6e){return function(_0x43a6ae){logger[_0xda39('0xc')]('['+[_0xd0b541[_0xda39('0xd')]()]+'],\x20getUser\x20input\x20crm',_0x43a6ae);return new Promise(function(_0x11157e,_0x167b48){if(intUtil[_0xda39('0x12')](_0x43a6ae[_0xda39('0x13')])){var _0x49187b={'method':_0xda39('0x7'),'uri':_0x4f9d26+_0xda39('0x14')+_0x43a6ae[_0xda39('0x13')]+'&'+_0x4d5f6a+'&'+_0x3a2f6e,'auth':_0x53db94,'json':!![]};logger['info']('['+[_0xd0b541[_0xda39('0xd')]()]+'],\x20getUser\x20rp\x20obj',_0x49187b);return rp(_0x49187b)[_0xda39('0x9')](function(_0x2a7d66){logger[_0xda39('0xc')]('['+[_0xd0b541[_0xda39('0xd')]()]+_0xda39('0x15'),_0x2a7d66);if(_0x2a7d66[_0xda39('0xa')][_0xda39('0x16')]>0x0&&String(_0x2a7d66[_0xda39('0xa')][0x0][_0xda39('0x17')])==='true'){_0x43a6ae['userId']=_0x2a7d66[_0xda39('0xa')][0x0][_0xda39('0x18')];}else{_0x43a6ae[_0xda39('0x19')]=_0x43a6ae['adminId'];_0x43a6ae[_0xda39('0x13')]=_0x43a6ae[_0xda39('0x1a')];}logger[_0xda39('0xc')]('['+[_0xd0b541['toUpperCase']()]+_0xda39('0x1b'),_0x43a6ae);_0x11157e(_0x43a6ae);})[_0xda39('0xf')](function(_0xd0619c){logger[_0xda39('0x10')]('['+[_0xd0b541['toUpperCase']()]+']',_0xd0619c['message']);_0x167b48(_0xd0619c[_0xda39('0x11')]);});}else{logger['info']('['+[_0xd0b541[_0xda39('0xd')]()]+_0xda39('0x1c'));_0x43a6ae[_0xda39('0x19')]=_0x43a6ae[_0xda39('0xb')];_0x43a6ae[_0xda39('0x13')]=_0x43a6ae[_0xda39('0x1a')];_0x11157e(_0x43a6ae);}});};}function createEndUser(_0x2f1798,_0x5087b8,_0x562daf,_0x3384f6,_0x256611){logger[_0xda39('0xc')]('['+[_0x2f1798[_0xda39('0xd')]()]+_0xda39('0x1d'),_0x562daf);return new Promise(function(_0x3a8da9,_0x15d138){var _0x2108a9={'method':'POST','uri':_0x3384f6+'sys_user?'+_0x256611,'body':{'user_name':_0x562daf[_0xda39('0x1e')],'roles':_0xda39('0x1f'),'first_name':_0x562daf[_0xda39('0x1e')],'active':'true','date_format':'System','phone':_0x562daf[_0xda39('0x1e')]},'auth':_0x5087b8,'json':!![]};return rp(_0x2108a9)['then'](function(_0x47646f){logger[_0xda39('0xc')]('['+[_0x2f1798[_0xda39('0xd')]()]+_0xda39('0x20'),_0x47646f[_0xda39('0xa')]);_0x562daf[_0xda39('0x21')]=_0x47646f[_0xda39('0xa')][_0xda39('0x18')];_0x3a8da9(_0x562daf);})[_0xda39('0xf')](function(_0x57452b){logger['error']('['+[_0x2f1798['toUpperCase']()]+']',_0x57452b['message']);_0x15d138(_0x57452b['message']);});});}function getEndUser(_0xf70bf3,_0x3d74af,_0x2082e5,_0x544e55,_0x5c752e){return function(_0x35e1ef){logger['info']('['+[_0xf70bf3['toUpperCase']()]+_0xda39('0x22'),_0x35e1ef);return new Promise(function(_0x15c3c9,_0x57aaf1){var _0x34f5e3={'method':_0xda39('0x7'),'uri':_0x2082e5+_0xda39('0x23')+_0x35e1ef['endUserNumber']+'&'+_0x544e55+'&'+_0x5c752e,'auth':_0x3d74af,'json':!![]};return rp(_0x34f5e3)['then'](function(_0x280a0e){if(_0x280a0e['result']['length']>0x0){_0x35e1ef[_0xda39('0x21')]=_0x280a0e[_0xda39('0xa')][0x0][_0xda39('0x18')];logger['info']('['+[_0xf70bf3[_0xda39('0xd')]()]+_0xda39('0x24'),_0x35e1ef);_0x15c3c9(_0x35e1ef);}else{return createEndUser(_0xf70bf3,_0x3d74af,_0x35e1ef,_0x2082e5,_0x544e55)[_0xda39('0x9')](function(_0x11c5bf){logger[_0xda39('0xc')]('['+[_0xf70bf3[_0xda39('0xd')]()]+_0xda39('0x25'),_0x11c5bf);_0x15c3c9(_0x11c5bf);});}})[_0xda39('0xf')](function(_0x2bbe61){logger[_0xda39('0x10')]('['+[_0xf70bf3[_0xda39('0xd')]()]+']',_0x2bbe61[_0xda39('0x11')]);_0x57aaf1(_0x2bbe61[_0xda39('0x11')]);});});};}function getCustomFields(_0x4765f1,_0x1f9ebd){var _0x13cc00={};if(_0x4765f1[_0xda39('0x16')]>0x0){_[_0xda39('0x26')](_0x4765f1,function(_0x434710){if(_[_0xda39('0x27')](['string',_0xda39('0x28')],_0x434710[_0xda39('0x29')])&&_0x434710[_0xda39('0x2a')]&&!_0x434710[_0xda39('0x2b')]){_0x13cc00[_0x434710['nameField']['toLowerCase']()]=_0x434710[_0xda39('0x2c')][_0xda39('0x2d')]();}else if(_['includes']([_0xda39('0x2e'),'picklist'],_0x434710[_0xda39('0x29')])&&_0x434710[_0xda39('0x2f')]&&_0x434710['customField']){_0x13cc00[_0x434710[_0xda39('0x2f')][_0xda39('0x30')]()]=_0x434710[_0xda39('0x2c')][_0xda39('0x2d')]();}else if(_0x434710[_0xda39('0x29')]===_0xda39('0x31')&&_0x434710[_0xda39('0x32')]&&_0x434710[_0xda39('0x2f')]&&_0x434710['customField']){_0x13cc00[_0x434710[_0xda39('0x2f')][_0xda39('0x30')]()]=_0x1f9ebd[_0x434710['variableName']][_0xda39('0x2d')]();}else if(_0x434710[_0xda39('0x29')]==='customVariable'&&_0x434710['Variable']&&_0x434710['Variable'][_0xda39('0x33')]&&_0x434710[_0xda39('0x2f')]&&_0x434710[_0xda39('0x2b')]){_0x13cc00[_0x434710[_0xda39('0x2f')][_0xda39('0x30')]()]=_0x1f9ebd[_0x434710[_0xda39('0x34')][_0xda39('0x33')][_0xda39('0x30')]()][_0xda39('0x2d')]();}});}return _0x13cc00;}function getTicket(_0x29586b,_0x4f5a74,_0x186348,_0x2ea586,_0x56e916,_0x3dd021){return function(_0x24e4f1){logger['info']('['+[_0x29586b[_0xda39('0xd')]()]+_0xda39('0x35'),_0x24e4f1);return new Promise(function(_0x527bf0,_0x1a8437){var _0x1ed24d=_0x29586b[_0xda39('0x30')]()==='outbound'?_0x24e4f1['userId']:_0x24e4f1[_0xda39('0x21')];var _0x4ba1b4={'method':'POST','uri':_0x186348+_0xda39('0x36')+'?'+_0x3dd021,'body':Object[_0xda39('0x37')]({},{'active':_0xda39('0x38'),'caller_id':_0x1ed24d,'assigned_to':_0x24e4f1[_0xda39('0x19')],'short_description':intUtil[_0xda39('0x39')](_0x2ea586[_0xda39('0x3a')],_0x56e916,'\x20'),'description':intUtil[_0xda39('0x39')](_0x2ea586['Descriptions'],_0x56e916,'\x0a')},getCustomFields(_0x2ea586[_0xda39('0x3b')],_0x56e916)),'auth':_0x4f5a74,'json':!![]};return rp(_0x4ba1b4)[_0xda39('0x9')](function(_0xbdb354){logger[_0xda39('0xc')]('['+[_0x29586b[_0xda39('0xd')]()]+']\x20POST\x20incident\x20entity\x20schema',_0xbdb354['result']);_0x24e4f1[_0xda39('0x3c')]=_0xbdb354[_0xda39('0xa')][_0xda39('0x18')];_0x24e4f1['ticketNumber']=_0xbdb354[_0xda39('0xa')]['number'];logger[_0xda39('0xc')]('['+[_0x29586b[_0xda39('0xd')]()]+']\x20getTicket\x20crm',_0x24e4f1);_0x527bf0(_0x24e4f1);})['catch'](function(_0x1c4370){logger['error']('['+[_0x29586b['toUpperCase']()]+']',_0x1c4370[_0xda39('0x11')]);_0x1a8437(_0x1c4370[_0xda39('0x11')]);});});};}function createRemoteTag(_0x547435,_0x27785e,_0x537af4,_0x3b7261){return new Promise(function(_0x12607f,_0x230045){var _0xa5af1e={'method':'POST','uri':_0x537af4+_0xda39('0x3d')+'?'+_0x3b7261,'body':{'short_description':_0x547435,'global':!![],'active':!![],'name':_0x547435},'auth':_0x27785e,'json':!![]};return rp(_0xa5af1e)['then'](function(_0x473212){var _0x6b46f2=_0x473212[_0xda39('0xa')]['sys_id'];_0x12607f(_0x6b46f2);});});}function getRemoteTag(_0x29b356,_0x168dc0,_0x4d9edb,_0x4264db,_0x34a050){return new Promise(function(_0x19d9e1,_0x3adcde){var _0x47d7e9={'method':_0xda39('0x7'),'uri':_0x4d9edb+'label'+_0xda39('0x3e')+_0x29b356+'&'+_0x4264db,'auth':_0x168dc0,'json':!![]};return rp(_0x47d7e9)['then'](function(_0x1572b2){if(_0x1572b2[_0xda39('0xa')][_0xda39('0x16')]>0x0){var _0x10bd76=_0x1572b2[_0xda39('0xa')][0x0]['sys_id'];_0x19d9e1(_0x10bd76);}else{return createRemoteTag(_0x29b356,_0x168dc0,_0x4d9edb,_0x4264db)[_0xda39('0x9')](function(_0x240c39){_0x19d9e1(_0x240c39);});}});});}function assignTagToIncident(_0x1c4fd0,_0x23183c,_0x820b07,_0x4a0c51,_0x5239b8){return new Promise(function(_0x378aa4,_0x41c46b){var _0x3d702f={'method':_0xda39('0x3f'),'uri':_0x820b07+_0xda39('0x40')+'?'+_0x5239b8,'body':{'label':_0x1c4fd0,'table':_0xda39('0x36'),'id_type':_0xda39('0x41'),'table_key':_0x4a0c51[_0xda39('0x3c')],'title':_0xda39('0x42')+_0x4a0c51[_0xda39('0x43')],'id_display':_0x4a0c51[_0xda39('0x43')]},'auth':_0x23183c,'json':!![]};return rp(_0x3d702f)['then'](function(_0x40466d){_0x378aa4();})[_0xda39('0xf')](function(){_0x378aa4();});});}function manageTags(_0x350939,_0x24237a,_0x4c4ea8,_0x7321dd,_0x440e30,_0xd70641,_0x3c5952){return new Promise(function(_0x45fbf7,_0x49acce){var _0x4b92d2=[];_0x24237a['forEach'](function(_0x160811){_0x4b92d2[_0xda39('0x44')](getRemoteTag(_0x160811,_0x4c4ea8,_0x7321dd,_0xd70641,_0x3c5952));});return Promise['all'](_0x4b92d2)[_0xda39('0x9')](function(_0x4404a5){if(_0x4404a5[_0xda39('0x16')]){logger[_0xda39('0xc')]('['+[_0x350939[_0xda39('0xd')]()]+_0xda39('0x45'),_0x4404a5);var _0x17d778=[];_0x4404a5['forEach'](function(_0x372239){_0x17d778['push'](assignTagToIncident(_0x372239,_0x4c4ea8,_0x7321dd,_0x440e30,_0xd70641));});return Promise[_0xda39('0x46')](_0x17d778)[_0xda39('0x9')](function(){_0x45fbf7();})[_0xda39('0xf')](function(){_0x45fbf7();});}else{_0x45fbf7();}});});}function getTags(_0x32c104,_0x26166f,_0x2977df,_0x348d6c,_0xd5d38c,_0x3e85e4){return function(_0x38bd2d){return new Promise(function(_0x22c651,_0x70e6ee){var _0x45e491=[];var _0x2d8eef=_0x348d6c['Tags'];if(_0x2d8eef&&_0x2d8eef['length']>0x0){_0x45e491=_['map'](_0x2d8eef,_0xda39('0x33'));}if(_0x45e491[_0xda39('0x16')]>0x0){return manageTags(_0x32c104,_0x45e491,_0x26166f,_0x2977df,_0x38bd2d,_0xd5d38c,_0x3e85e4)[_0xda39('0x9')](function(){_0x22c651(_0x38bd2d);});}else{_0x22c651(_0x38bd2d);}});};}function emit(_0x945391,_0xf5fc,_0x32a99c){var _0x23a9bb='%26sysparm_record_target%3Dincident'+_0xda39('0x47')+_0xda39('0x48')+'%255EORDERBYDESCnumber';var _0x29b528={'uri':_0x945391+_0xda39('0x49')+_0x32a99c+_0x23a9bb};io['to'](util[_0xda39('0x4a')](_0xda39('0x4b'),_0xf5fc))['emit'](_0xda39('0x4c'),_0x29b528);}exports['cs']=function(_0x51a0f2,_0x58046f,_0xc8b8f0,_0x48fb54,_0x53a1ea,_0x5f074a,_0x33d143,_0x1492cb){var _0x1abacd={};var _0x293028={'user':_0x5f074a[_0xda39('0x4d')],'pass':_0x5f074a[_0xda39('0x4e')]};var _0x218bc2=_0xda39('0x4f');var _0x58437e='sysparm_display_value=true';_0x5f074a[_0xda39('0x50')]=intUtil['stripTrailingSlash'](_0x5f074a[_0xda39('0x50')]);_0x5f074a[_0xda39('0x51')]=intUtil[_0xda39('0x52')](_0x5f074a[_0xda39('0x51')]);var _0x3b4904=util['format'](_0xda39('0x53'),_0x5f074a[_0xda39('0x50')]);_0x1abacd[_0xda39('0x13')]=!_[_0xda39('0x54')](_0x48fb54)?_0x48fb54[_0xda39('0x55')]:null;_0x1abacd[_0xda39('0x1a')]=_0x5f074a[_0xda39('0x55')];_0x1abacd[_0xda39('0x1e')]=_0x1492cb[_0xda39('0x30')]()===_0xda39('0x56')?_0x58046f[_0xda39('0x57')]:_0x58046f[_0xda39('0x58')];_0x1abacd['callDirection']=_0x1492cb==='queue'||_0x1492cb===_0xda39('0x59')?'queue':_0xda39('0x56');var _0x36873c=util[_0xda39('0x4a')](_0xda39('0x5a'),_0x5f074a[_0xda39('0x51')],_0x58046f['uniqueid'],md5(_0x58046f[_0xda39('0x5b')]));if(_0x53a1ea&&_0x53a1ea[_0xda39('0x5c')]){logger['info'](_0xda39('0x5d'),_0xda39('0x5e'));_0x58046f[_0xda39('0x5f')]=_0x36873c;}else if(_0x33d143&&_0x33d143['recordingFormat']&&_0x33d143[_0xda39('0x60')]!==_0xda39('0x61')){logger[_0xda39('0xc')]('[OUTBOUND]',_0xda39('0x5e'));_0x58046f[_0xda39('0x5f')]=_0x36873c;}else{_0x58046f[_0xda39('0x5f')]='';}return getAdminUser(_0x1492cb,_0x293028,_0x1abacd,_0x3b4904,_0x58437e,_0x218bc2)[_0xda39('0x9')](getUser(_0x1492cb,_0x293028,_0x3b4904,_0x58437e,_0x218bc2))[_0xda39('0x9')](getEndUser(_0x1492cb,_0x293028,_0x3b4904,_0x58437e,_0x218bc2))[_0xda39('0x9')](getTicket(_0x1492cb,_0x293028,_0x3b4904,_0xc8b8f0,_0x58046f,_0x58437e))[_0xda39('0x9')](function(_0x30a1b7){logger[_0xda39('0xc')](util[_0xda39('0x4a')]('The\x20ticket\x20ID\x20is:\x20%s',_0x30a1b7[_0xda39('0x3c')]));logger[_0xda39('0xc')](util[_0xda39('0x4a')](_0xda39('0x62'),_0x1492cb));if(_0x1492cb!==_0xda39('0x59')){logger[_0xda39('0xc')]('['+[_0x1492cb[_0xda39('0xd')]()]+']',_0xda39('0x63'));emit(_0x5f074a[_0xda39('0x50')],_0x48fb54['name'],_0x30a1b7[_0xda39('0x3c')]);}})[_0xda39('0xf')](function(_0x5bb463){logger['error']('['+[_0x1492cb[_0xda39('0xd')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x5bb463,{'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 83c4f8f..e0319b8 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 _0x4744=['getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','forEach','type','nameField','toLowerCase','content','toString','string','customField','custom_fields','customVariable','Variable','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','catch','error','unmanaged','monitor_format','toUpperCase','Inbound','contacts','lastevent','lodash','request-promise','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x4744,0x1dd));var _0x4474=function(_0x5522f3,_0x40e0bf){_0x5522f3=_0x5522f3-0x0;var _0x84e4e=_0x4744[_0x5522f3];return _0x84e4e;};'use strict';var _=require(_0x4474('0x0'));var rp=require(_0x4474('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x4474('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4474('0x3'));var config=require(_0x4474('0x4'));var logger=require('../../../../config/logger')(_0x4474('0x5'));config[_0x4474('0x6')]=_[_0x4474('0x7')](config['redis'],{'host':_0x4474('0x8'),'port':0x18eb});var io=require(_0x4474('0x9'))(new Redis(config[_0x4474('0x6')]));var def={'method':_0x4474('0xa'),'json':!![]};function emit(_0x2f58b6,_0x39fb62,_0x51c179){io['to'](_0x2f58b6)[_0x4474('0xb')](_0x39fb62,_0x51c179);}function getTicket(_0x2f0dfb,_0x223d81,_0x57f68e,_0x1dd4e5,_0x53defa,_0x25d88f,_0x2e89be,_0x71569a){logger[_0x4474('0xc')](_0x4474('0xd'));var _0x2a789d=new Date();var _0x9b3558=[{'name':_0x4474('0xe'),'value':intUtil['getString'](_0x1dd4e5[_0x4474('0xf')],_0x53defa,'\x20')},{'name':_0x4474('0x10'),'value':_0x223d81['id']},{'name':_0x4474('0x11'),'value':_0x223d81['id']},{'name':_0x4474('0x12'),'value':intUtil[_0x4474('0x13')](_0x1dd4e5[_0x4474('0x14')],_0x53defa,'\x0a')},{'name':_0x4474('0x15'),'value':_0x2a789d['toISOString']()[_0x4474('0x16')](0x0,0x13)[_0x4474('0x17')]('T','\x20')},{'name':_0x4474('0x18'),'value':'0'},{'name':_0x4474('0x19'),'value':'15'},{'name':_0x4474('0x1a'),'value':_0x57f68e['id']},{'name':_0x4474('0x1b'),'value':_0x4474('0x1c')},{'name':_0x4474('0x1d'),'value':_0x57f68e[_0x4474('0xe')]},{'name':'direction','value':_0x71569a}];if(_0x25d88f[_0x4474('0x1e')]){_['forEach'](_0x25d88f,function(_0x240a76){if(_0x53defa[_0x240a76[_0x4474('0x1f')]]){_0x9b3558[_0x4474('0x20')]({'name':_0x240a76[_0x4474('0x21')],'value':_0x53defa[_0x240a76[_0x4474('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x2e89be['id'],'module_name':_0x4474('0x24'),'name_value_list':_0x9b3558})}});}function getAuth(_0x24a8ad){return util[_0x4474('0x25')](_0x4474('0x26'),new Buffer(_0x24a8ad[_0x4474('0x27')]+':X')['toString'](_0x4474('0x28')));}function getServerInfo(_0x1240a4){return request({'form':{'method':_0x4474('0x29'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x1240a4['id']})}});}function getUser(_0x2100b8,_0x2e003f,_0x4e4d77){if(!_[_0x4474('0x2a')](_0x2e003f)){logger[_0x4474('0xc')](_0x4474('0x2b'),_0x2e003f);return request({'form':{'method':_0x4474('0x2c'),'input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0x4e4d77['id'],'module_name':_0x4474('0x2d'),'query':util[_0x4474('0x25')](_0x4474('0x2e'),_0x2e003f),'order_by':'','offset':'0','select_fields':['id',_0x4474('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4474('0x2f')](function(_0x5a2e15){if(_0x5a2e15[_0x4474('0x30')][_0x4474('0x1e')]){var _0x22abfe=_[_0x4474('0x31')](_0x5a2e15[_0x4474('0x30')],function(_0x3617f2){return _0x3617f2[_0x4474('0x32')]['user_name'][_0x4474('0x33')]===_0x2e003f;});if(_0x22abfe){logger[_0x4474('0xc')](_0x4474('0x34'));return BPromise['resolve']({'id':_0x22abfe[_0x4474('0x32')]['id'][_0x4474('0x33')],'name':_0x22abfe[_0x4474('0x32')]['name'][_0x4474('0x33')]});}}logger[_0x4474('0xc')](_0x4474('0x35'));return BPromise[_0x4474('0x36')]({'id':_0x4e4d77[_0x4474('0x32')][_0x4474('0x37')][_0x4474('0x33')],'name':_0x4e4d77[_0x4474('0x32')][_0x4474('0x38')][_0x4474('0x33')]});});}else{logger[_0x4474('0xc')](_0x4474('0x39'));return BPromise[_0x4474('0x36')]({'id':_0x4e4d77[_0x4474('0x32')]['user_id']['value'],'name':_0x4e4d77[_0x4474('0x32')][_0x4474('0x38')]['value']});}}function getEndUser(_0x386d44,_0x34de14,_0x44ff29,_0xcd4b3b){logger[_0x4474('0xc')]('Searching\x20enduser\x20with\x20phone',_0x44ff29);return request({'form':{'method':_0x4474('0x2c'),'input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0xcd4b3b['id'],'module_name':_0x4474('0x1c'),'query':util[_0x4474('0x25')](_0x4474('0x3a'),_0x44ff29),'order_by':'','offset':'0','select_fields':['id',_0x4474('0xe'),_0x4474('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4474('0x2f')](function(_0x2383fc){if(_0x2383fc[_0x4474('0x30')][_0x4474('0x1e')]){var _0xb19f96=_['find'](_0x2383fc[_0x4474('0x30')],function(_0x75c632){return _0x75c632[_0x4474('0x32')]['phone_home'][_0x4474('0x33')]===_0x44ff29;});if(_0xb19f96){logger[_0x4474('0xc')](_0x4474('0x3c'));return BPromise['resolve']({'id':_0xb19f96[_0x4474('0x32')]['id'][_0x4474('0x33')],'name':_0xb19f96[_0x4474('0x32')][_0x4474('0xe')][_0x4474('0x33')],'phone':_0xb19f96[_0x4474('0x32')][_0x4474('0x3b')][_0x4474('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0xcd4b3b['id'],'module_name':_0x4474('0x1c'),'name_value_list':[{'name':_0x4474('0x3d'),'value':_0x34de14!==_0x4474('0x3e')?_0x34de14:util[_0x4474('0x25')](_0x4474('0x3f'),_0x44ff29)},{'name':_0x4474('0x3b'),'value':_0x44ff29}]})}})['then'](function(_0x51d1e4){logger['info'](_0x4474('0x40'));return BPromise[_0x4474('0x36')]({'id':_0x51d1e4['id'],'name':_0x51d1e4[_0x4474('0x30')][_0x4474('0x3d')]['value'],'phone':_0x51d1e4['entry_list'][_0x4474('0x3b')][_0x4474('0x33')]});});}});}function request(_0x56c6ba){logger[_0x4474('0x41')]('[HTTP]',JSON['stringify'](_0x56c6ba));return rp(_['merge'](def,_0x56c6ba));}function getTags(_0x503878,_0x30679e){var _0xf8a7ac=[];if(_0x503878&&_0x503878[_0x4474('0x1e')]>0x0){_0xf8a7ac=_[_0x4474('0x42')](_0x503878,_0x30679e);}return _0xf8a7ac;}function getCustomFields(_0x2ec67b,_0x4531e4){var _0x4bfb57=[];var _0x2d50d8={'custom_fields':[]};if(_0x2ec67b[_0x4474('0x1e')]>0x0){_[_0x4474('0x43')](_0x2ec67b,function(_0x1ac93f){if(_0x1ac93f[_0x4474('0x44')]==='string'&&_0x1ac93f['nameField']&&!_0x1ac93f['customField']){_0x2d50d8[_0x1ac93f[_0x4474('0x45')][_0x4474('0x46')]()]=_0x1ac93f[_0x4474('0x47')][_0x4474('0x48')]();}else if(_0x1ac93f[_0x4474('0x44')]===_0x4474('0x49')&&_0x1ac93f['idField']&&_0x1ac93f[_0x4474('0x4a')]){_0x2d50d8[_0x4474('0x4b')]['push']({'id':_0x1ac93f[_0x4474('0x21')],'value':_0x1ac93f['content'][_0x4474('0x48')]()});}else if(_0x1ac93f['type']==='variable'&&_0x1ac93f[_0x4474('0x1f')]&&_0x1ac93f[_0x4474('0x21')]&&_0x1ac93f[_0x4474('0x4a')]){_0x4531e4[_0x1ac93f[_0x4474('0x1f')]]&&_0x2d50d8['custom_fields'][_0x4474('0x20')]({'id':_0x1ac93f[_0x4474('0x21')],'value':_0x4531e4[_0x1ac93f[_0x4474('0x1f')]][_0x4474('0x48')]()});}else if(_0x1ac93f[_0x4474('0x44')]===_0x4474('0x4c')&&_0x1ac93f[_0x4474('0x4d')]&&_0x1ac93f['Variable'][_0x4474('0xe')]&&_0x1ac93f[_0x4474('0x21')]&&_0x1ac93f[_0x4474('0x4a')]){_0x4531e4[_0x1ac93f[_0x4474('0x4d')]['name'][_0x4474('0x46')]()]&&_0x2d50d8[_0x4474('0x4b')][_0x4474('0x20')]({'id':_0x1ac93f['idField'],'value':_0x4531e4[_0x1ac93f[_0x4474('0x4d')][_0x4474('0xe')][_0x4474('0x46')]()]['toString']()});}});}return _0x2d50d8;}function getConnection(_0x4d113b){return request({'method':_0x4474('0xa'),'form':{'method':_0x4474('0x4e'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'user_auth':{'user_name':_0x4d113b[_0x4474('0x4f')],'password':_0x4d113b[_0x4474('0x50')],'encryption':_0x4474('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4474('0x2f')](function(_0xcad273){var _0x3dcdb4=_0xcad273;if(_0x3dcdb4['id']){def[_0x4474('0x52')]=_0x3dcdb4['id'];return BPromise[_0x4474('0x36')](_0x3dcdb4);}else{throw new Error(util[_0x4474('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x4d113b['id']));}});}function setRelationship(_0x2791fa,_0x22156f,_0x142d0e,_0x1bb005){return request({'form':{'method':_0x4474('0x53'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x2791fa['id'],'module_name':_0x4474('0x24'),'module_id':_0x142d0e['id'],'link_field_name':_0x1bb005,'related_ids':[_0x22156f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4474('0x54')]=function(_0x51dca9,_0x145947,_0x562c6a,_0x5e43a8,_0x55a060,_0x3c71e5){var _0x2fd884,_0x4a2c12,_0x2dc242,_0xf6526d;_0x3c71e5[_0x4474('0x55')]=intUtil['stripTrailingSlash'](_0x3c71e5['remoteUri']);_0x3c71e5['serverUrl']=intUtil[_0x4474('0x56')](_0x3c71e5[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0x3c71e5['remoteUri']);if(_0x55a060&&_0x55a060['monitor_format']){logger[_0x4474('0xc')](_0x4474('0x5a'),_0x4474('0x5b'));_0x145947[_0x4474('0x5c')]=util[_0x4474('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c71e5[_0x4474('0x57')],_0x145947[_0x4474('0x5d')],md5(_0x145947['uniqueid']));}else{_0x145947['recordingURL']='';}return getConnection(_0x3c71e5)[_0x4474('0x2f')](function(_0x3b42e5){_0xf6526d=_0x3b42e5;return getUser(_0x3c71e5,_0x5e43a8['name'],_0xf6526d);})[_0x4474('0x2f')](function(_0x32b0b2){_0x2fd884=_0x32b0b2;logger[_0x4474('0xc')](_0x4474('0x5e'),_0x2fd884['id']);return getEndUser(_0x3c71e5,_0x145947[_0x4474('0x5f')],_0x145947[_0x4474('0x60')],_0xf6526d);})[_0x4474('0x2f')](function(_0x279539){_0x4a2c12=_0x279539;logger[_0x4474('0xc')](_0x4474('0x61'),_0x4a2c12['id']);return getTicket(_0x3c71e5,_0x2fd884,_0x4a2c12,_0x562c6a,_0x145947,_0x562c6a[_0x4474('0x62')],_0xf6526d,'Inbound');})[_0x4474('0x2f')](function(_0x32a50e){_0x2dc242=_0x32a50e;logger[_0x4474('0xc')](_0x4474('0x63'));logger[_0x4474('0xc')](_0x4474('0x64'),_0x2dc242['id']);return setRelationship(_0xf6526d,_0x2fd884,_0x2dc242,_0x4474('0x65'));})['then'](function(){return setRelationship(_0xf6526d,_0x4a2c12,_0x2dc242,'contacts');})[_0x4474('0x2f')](function(){return getServerInfo(_0xf6526d);})['then'](function(_0x25d127){var _0x3244ff=parseInt(_0x25d127[_0x4474('0x66')][_0x4474('0x67')](0x0));var _0x1c93ef=util['format'](_0x4474('0x68'),_0x3c71e5[_0x4474('0x55')],_0x2dc242['id']);if(_0x3244ff>0x6){_0x1c93ef=util[_0x4474('0x25')](_0x4474('0x69'),_0x3c71e5['remoteUri'],_0x2dc242['id']);}logger[_0x4474('0xc')]('[QUEUE]',_0x4474('0x6a'));emit(util[_0x4474('0x25')](_0x4474('0x6b'),_0x5e43a8[_0x4474('0xe')]),_0x4474('0x6c'),{'uri':_0x1c93ef});})['catch'](function(_0x293e22){logger['error'](_0x4474('0x5a'),JSON['stringify'](_0x293e22));});};exports[_0x4474('0x6d')]=function(_0x44f8df,_0x275b05,_0x597f84,_0x1b8761,_0x15114f,_0x5cf1a0,_0x1dc28b){var _0x4342ee,_0x100978,_0x2e6d78,_0xcb3c36;_0x5cf1a0[_0x4474('0x55')]=intUtil['stripTrailingSlash'](_0x5cf1a0[_0x4474('0x55')]);_0x5cf1a0[_0x4474('0x57')]=intUtil[_0x4474('0x56')](_0x5cf1a0[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0x5cf1a0[_0x4474('0x55')]);if(_0x1dc28b&&_0x1dc28b[_0x4474('0x6e')]&&_0x1dc28b[_0x4474('0x6e')]!=='none'){logger[_0x4474('0xc')]('[OUTBOUND]',_0x4474('0x5b'));_0x275b05[_0x4474('0x5c')]=util[_0x4474('0x25')](_0x4474('0x6f'),_0x5cf1a0[_0x4474('0x57')],_0x275b05['uniqueid'],md5(_0x275b05[_0x4474('0x5d')]));}return getConnection(_0x5cf1a0)['then'](function(_0x42c0d6){_0xcb3c36=_0x42c0d6;return getUser(_0x5cf1a0,_0x1b8761[_0x4474('0xe')],_0xcb3c36);})[_0x4474('0x2f')](function(_0x58377c){_0x4342ee=_0x58377c;logger['info'](_0x4474('0x5e'),_0x4342ee['id']);return getEndUser(_0x5cf1a0,_0x275b05[_0x4474('0x70')],_0x275b05[_0x4474('0x71')],_0xcb3c36);})[_0x4474('0x2f')](function(_0x3fd50e){_0x100978=_0x3fd50e;logger[_0x4474('0xc')]('The\x20Enduser\x20ID\x20is:',_0x100978['id']);return getTicket(_0x5cf1a0,_0x4342ee,_0x100978,_0x597f84,_0x275b05,_0x597f84['Fields'],_0xcb3c36,_0x4474('0x72'));})[_0x4474('0x2f')](function(_0x56ba3c){_0x2e6d78=_0x56ba3c;logger[_0x4474('0xc')](_0x4474('0x63'));logger['info'](_0x4474('0x64'),_0x2e6d78['id']);return setRelationship(_0xcb3c36,_0x4342ee,_0x2e6d78,_0x4474('0x65'));})[_0x4474('0x2f')](function(){return setRelationship(_0xcb3c36,_0x100978,_0x2e6d78,'contacts');})['then'](function(){return getServerInfo(_0xcb3c36);})[_0x4474('0x2f')](function(_0x337f7b){var _0x3ba2c4=parseInt(_0x337f7b['version'][_0x4474('0x67')](0x0));var _0x47e58e=util[_0x4474('0x25')](_0x4474('0x68'),_0x5cf1a0[_0x4474('0x55')],_0x2e6d78['id']);if(_0x3ba2c4>0x6){_0x47e58e=util[_0x4474('0x25')](_0x4474('0x69'),_0x5cf1a0[_0x4474('0x55')],_0x2e6d78['id']);}logger['info'](_0x4474('0x73'),_0x4474('0x6a'));emit(util[_0x4474('0x25')]('user:%s',_0x1b8761[_0x4474('0xe')]),'trigger:browser:url',{'uri':_0x47e58e});})[_0x4474('0x74')](function(_0xf37fe6){logger[_0x4474('0x75')](_0x4474('0x73'),JSON['stringify'](_0xf37fe6));});};exports[_0x4474('0x76')]=function(_0x1a064b,_0x898407,_0x53addc,_0x1ff282,_0x3b2a5f,_0xeed424){var _0x170de5,_0x20453f,_0x3a5c0b,_0x2a02f6;_0xeed424[_0x4474('0x55')]=intUtil[_0x4474('0x56')](_0xeed424[_0x4474('0x55')]);_0xeed424['serverUrl']=intUtil[_0x4474('0x56')](_0xeed424[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0xeed424[_0x4474('0x55')]);if(_0x3b2a5f&&_0x3b2a5f[_0x4474('0x77')]){logger['info']('['+_0x898407['lastevent'][_0x4474('0x78')]()+']',_0x4474('0x5b'));_0x898407[_0x4474('0x5c')]=util[_0x4474('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeed424['serverUrl'],_0x898407[_0x4474('0x5d')],md5(_0x898407[_0x4474('0x5d')]));}else{_0x898407[_0x4474('0x5c')]='';}return getConnection(_0xeed424)[_0x4474('0x2f')](function(_0x2d039b){_0x2a02f6=_0x2d039b;if(!_[_0x4474('0x2a')](_0x1ff282)){return getUser(_0xeed424,_0x1ff282['name'],_0x2a02f6);}else{return getUser(_0xeed424,null,_0x2a02f6);}})[_0x4474('0x2f')](function(_0x592545){_0x170de5=_0x592545;logger[_0x4474('0xc')](_0x4474('0x5e'),_0x170de5['id']);return getEndUser(_0xeed424,_0x898407[_0x4474('0x5f')],_0x898407[_0x4474('0x60')],_0x2a02f6);})['then'](function(_0x332b56){_0x20453f=_0x332b56;logger['info'](_0x4474('0x61'),_0x20453f['id']);return getTicket(_0xeed424,_0x170de5,_0x20453f,_0x53addc,_0x898407,_0x53addc['Fields'],_0x2a02f6,_0x4474('0x79'));})['then'](function(_0x5c0f63){_0x3a5c0b=_0x5c0f63;logger[_0x4474('0xc')](_0x4474('0x63'));logger[_0x4474('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3a5c0b['id']);return setRelationship(_0x2a02f6,_0x170de5,_0x3a5c0b,_0x4474('0x65'));})[_0x4474('0x2f')](function(){return setRelationship(_0x2a02f6,_0x20453f,_0x3a5c0b,_0x4474('0x7a'));})[_0x4474('0x2f')](function(){return getServerInfo(_0x2a02f6);})[_0x4474('0x74')](function(_0x2499bd){logger[_0x4474('0x75')]('['+_0x898407[_0x4474('0x7b')][_0x4474('0x78')]()+']',JSON['stringify'](_0x2499bd));});}; \ No newline at end of file +var _0x2027=['resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','idField','push','content','custom_fields','customVariable','Variable','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','unmanaged','lastevent','toUpperCase','calleridname','catch','lodash','request-promise','bluebird','ioredis','./util','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','getString','Subjects','created_by','description','Descriptions','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','Agent\x20found!'];(function(_0x4d9935,_0x425350){var _0x2d05a3=function(_0x530764){while(--_0x530764){_0x4d9935['push'](_0x4d9935['shift']());}};_0x2d05a3(++_0x425350);}(_0x2027,0x13c));var _0x7202=function(_0x5c26e9,_0x29fffa){_0x5c26e9=_0x5c26e9-0x0;var _0x22373e=_0x2027[_0x5c26e9];return _0x22373e;};'use strict';var _=require(_0x7202('0x0'));var rp=require(_0x7202('0x1'));var BPromise=require(_0x7202('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x7202('0x3'));var intUtil=require(_0x7202('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('sugarcrm');config[_0x7202('0x5')]=_[_0x7202('0x6')](config[_0x7202('0x5')],{'host':_0x7202('0x7'),'port':0x18eb});var io=require(_0x7202('0x8'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x43819d,_0xec471b,_0x1a1d7a){io['to'](_0x43819d)['emit'](_0xec471b,_0x1a1d7a);}function getTicket(_0x2473cb,_0x1ab11c,_0x5beab6,_0x1df55b,_0xef104,_0x3cd25a,_0x5a23de,_0x38b388){logger[_0x7202('0x9')](_0x7202('0xa'));var _0x2027ea=new Date();var _0x4cf357=[{'name':'name','value':intUtil[_0x7202('0xb')](_0x1df55b[_0x7202('0xc')],_0xef104,'\x20')},{'name':'assigned_user_id','value':_0x1ab11c['id']},{'name':_0x7202('0xd'),'value':_0x1ab11c['id']},{'name':_0x7202('0xe'),'value':intUtil['getString'](_0x1df55b[_0x7202('0xf')],_0xef104,'\x0a')},{'name':'date_start','value':_0x2027ea['toISOString']()['slice'](0x0,0x13)[_0x7202('0x10')]('T','\x20')},{'name':_0x7202('0x11'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7202('0x12'),'value':_0x5beab6['id']},{'name':_0x7202('0x13'),'value':_0x7202('0x14')},{'name':_0x7202('0x15'),'value':_0x5beab6[_0x7202('0x16')]},{'name':_0x7202('0x17'),'value':_0x38b388}];if(_0x3cd25a[_0x7202('0x18')]){_[_0x7202('0x19')](_0x3cd25a,function(_0x24c09b){if(_0xef104[_0x24c09b[_0x7202('0x1a')]]){_0x4cf357['push']({'name':_0x24c09b['idField'],'value':_0xef104[_0x24c09b[_0x7202('0x1a')]]});}});}return request({'form':{'method':_0x7202('0x1b'),'input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON['stringify']({'session':_0x5a23de['id'],'module_name':_0x7202('0x1d'),'name_value_list':_0x4cf357})}});}function getAuth(_0xa2966c){return util[_0x7202('0x1e')](_0x7202('0x1f'),new Buffer(_0xa2966c[_0x7202('0x20')]+':X')[_0x7202('0x21')](_0x7202('0x22')));}function getServerInfo(_0x1bd87b){return request({'form':{'method':_0x7202('0x23'),'input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON[_0x7202('0x24')]({'session':_0x1bd87b['id']})}});}function getUser(_0x1541fa,_0x55f1ca,_0x2f2e6a){if(!_[_0x7202('0x25')](_0x55f1ca)){logger[_0x7202('0x9')]('Getting\x20agent\x20with\x20name',_0x55f1ca);return request({'form':{'method':_0x7202('0x26'),'input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON[_0x7202('0x24')]({'session':_0x2f2e6a['id'],'module_name':_0x7202('0x27'),'query':util[_0x7202('0x1e')](_0x7202('0x28'),_0x55f1ca),'order_by':'','offset':'0','select_fields':['id',_0x7202('0x16'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3f2c4e){if(_0x3f2c4e[_0x7202('0x29')][_0x7202('0x18')]){var _0x2e6875=_[_0x7202('0x2a')](_0x3f2c4e[_0x7202('0x29')],function(_0x16390a){return _0x16390a[_0x7202('0x2b')][_0x7202('0x2c')][_0x7202('0x2d')]===_0x55f1ca;});if(_0x2e6875){logger[_0x7202('0x9')](_0x7202('0x2e'));return BPromise[_0x7202('0x2f')]({'id':_0x2e6875['name_value_list']['id'][_0x7202('0x2d')],'name':_0x2e6875[_0x7202('0x2b')][_0x7202('0x16')][_0x7202('0x2d')]});}}logger['info'](_0x7202('0x30'));return BPromise[_0x7202('0x2f')]({'id':_0x2f2e6a[_0x7202('0x2b')][_0x7202('0x31')]['value'],'name':_0x2f2e6a[_0x7202('0x2b')][_0x7202('0x2c')][_0x7202('0x2d')]});});}else{logger[_0x7202('0x9')](_0x7202('0x32'));return BPromise[_0x7202('0x2f')]({'id':_0x2f2e6a[_0x7202('0x2b')][_0x7202('0x31')]['value'],'name':_0x2f2e6a['name_value_list'][_0x7202('0x2c')][_0x7202('0x2d')]});}}function getEndUser(_0x2be719,_0x4faaee,_0x1358a2,_0x19a761){logger[_0x7202('0x9')](_0x7202('0x33'),_0x1358a2);return request({'form':{'method':_0x7202('0x26'),'input_type':'JSON','response_type':_0x7202('0x1c'),'rest_data':JSON[_0x7202('0x24')]({'session':_0x19a761['id'],'module_name':_0x7202('0x14'),'query':util[_0x7202('0x1e')](_0x7202('0x34'),_0x1358a2),'order_by':'','offset':'0','select_fields':['id',_0x7202('0x16'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x8ab59f){if(_0x8ab59f[_0x7202('0x29')]['length']){var _0x29eac1=_[_0x7202('0x2a')](_0x8ab59f[_0x7202('0x29')],function(_0x25a22f){return _0x25a22f[_0x7202('0x2b')][_0x7202('0x35')][_0x7202('0x2d')]===_0x1358a2;});if(_0x29eac1){logger[_0x7202('0x9')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x29eac1[_0x7202('0x2b')]['id'][_0x7202('0x2d')],'name':_0x29eac1[_0x7202('0x2b')][_0x7202('0x16')][_0x7202('0x2d')],'phone':_0x29eac1[_0x7202('0x2b')][_0x7202('0x35')][_0x7202('0x2d')]});}}else{logger[_0x7202('0x9')](_0x7202('0x36'));return request({'form':{'method':_0x7202('0x1b'),'input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON[_0x7202('0x24')]({'session':_0x19a761['id'],'module_name':_0x7202('0x14'),'name_value_list':[{'name':_0x7202('0x37'),'value':_0x4faaee!==_0x7202('0x38')?_0x4faaee:util[_0x7202('0x1e')](_0x7202('0x39'),_0x1358a2)},{'name':_0x7202('0x35'),'value':_0x1358a2}]})}})[_0x7202('0x3a')](function(_0x124484){logger['info'](_0x7202('0x3b'));return BPromise[_0x7202('0x2f')]({'id':_0x124484['id'],'name':_0x124484[_0x7202('0x29')][_0x7202('0x37')][_0x7202('0x2d')],'phone':_0x124484['entry_list']['phone_home'][_0x7202('0x2d')]});});}});}function request(_0x4e9828){logger[_0x7202('0x3c')](_0x7202('0x3d'),JSON['stringify'](_0x4e9828));return rp(_[_0x7202('0x3e')](def,_0x4e9828));}function getTags(_0x5b6314,_0x2ba3e3){var _0x57bb53=[];if(_0x5b6314&&_0x5b6314[_0x7202('0x18')]>0x0){_0x57bb53=_[_0x7202('0x3f')](_0x5b6314,_0x2ba3e3);}return _0x57bb53;}function getCustomFields(_0xe11c02,_0x476667){var _0x59232e=[];var _0x4ae6a6={'custom_fields':[]};if(_0xe11c02[_0x7202('0x18')]>0x0){_[_0x7202('0x19')](_0xe11c02,function(_0x48d0d7){if(_0x48d0d7[_0x7202('0x40')]===_0x7202('0x41')&&_0x48d0d7[_0x7202('0x42')]&&!_0x48d0d7[_0x7202('0x43')]){_0x4ae6a6[_0x48d0d7[_0x7202('0x42')][_0x7202('0x44')]()]=_0x48d0d7['content']['toString']();}else if(_0x48d0d7[_0x7202('0x40')]===_0x7202('0x41')&&_0x48d0d7[_0x7202('0x45')]&&_0x48d0d7[_0x7202('0x43')]){_0x4ae6a6['custom_fields'][_0x7202('0x46')]({'id':_0x48d0d7[_0x7202('0x45')],'value':_0x48d0d7[_0x7202('0x47')][_0x7202('0x21')]()});}else if(_0x48d0d7[_0x7202('0x40')]==='variable'&&_0x48d0d7[_0x7202('0x1a')]&&_0x48d0d7[_0x7202('0x45')]&&_0x48d0d7[_0x7202('0x43')]){_0x476667[_0x48d0d7[_0x7202('0x1a')]]&&_0x4ae6a6[_0x7202('0x48')][_0x7202('0x46')]({'id':_0x48d0d7[_0x7202('0x45')],'value':_0x476667[_0x48d0d7[_0x7202('0x1a')]][_0x7202('0x21')]()});}else if(_0x48d0d7[_0x7202('0x40')]===_0x7202('0x49')&&_0x48d0d7[_0x7202('0x4a')]&&_0x48d0d7[_0x7202('0x4a')]['name']&&_0x48d0d7[_0x7202('0x45')]&&_0x48d0d7[_0x7202('0x43')]){_0x476667[_0x48d0d7[_0x7202('0x4a')][_0x7202('0x16')]['toLowerCase']()]&&_0x4ae6a6['custom_fields']['push']({'id':_0x48d0d7[_0x7202('0x45')],'value':_0x476667[_0x48d0d7['Variable'][_0x7202('0x16')]['toLowerCase']()]['toString']()});}});}return _0x4ae6a6;}function getConnection(_0x9c4976){return request({'method':_0x7202('0x4b'),'form':{'method':_0x7202('0x4c'),'input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x9c4976['username'],'password':_0x9c4976[_0x7202('0x4d')],'encryption':_0x7202('0x4e')},'application':_0x7202('0x4f')})}})[_0x7202('0x3a')](function(_0x5a59d7){var _0x3642ff=_0x5a59d7;if(_0x3642ff['id']){def[_0x7202('0x50')]=_0x3642ff['id'];return BPromise[_0x7202('0x2f')](_0x3642ff);}else{throw new Error(util[_0x7202('0x1e')](_0x7202('0x51'),_0x9c4976['id']));}});}function setRelationship(_0x1526a8,_0x30b7a9,_0x40971f,_0x5a9a40){return request({'form':{'method':'set_relationship','input_type':_0x7202('0x1c'),'response_type':_0x7202('0x1c'),'rest_data':JSON[_0x7202('0x24')]({'session':_0x1526a8['id'],'module_name':'Calls','module_id':_0x40971f['id'],'link_field_name':_0x5a9a40,'related_ids':[_0x30b7a9['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7202('0x52')]=function(_0x135586,_0x5cf095,_0x1ecabd,_0x337cf4,_0x3d3e72,_0x12bb05){var _0x3183ef,_0x1fdab4,_0x3535fe,_0x47bb09;_0x12bb05[_0x7202('0x53')]=intUtil[_0x7202('0x54')](_0x12bb05['remoteUri']);_0x12bb05[_0x7202('0x55')]=intUtil[_0x7202('0x54')](_0x12bb05[_0x7202('0x55')]);def[_0x7202('0x56')]=util[_0x7202('0x1e')](_0x7202('0x57'),_0x12bb05[_0x7202('0x53')]);if(_0x3d3e72&&_0x3d3e72[_0x7202('0x58')]){logger[_0x7202('0x9')]('[QUEUE]',_0x7202('0x59'));_0x5cf095[_0x7202('0x5a')]=util[_0x7202('0x1e')](_0x7202('0x5b'),_0x12bb05[_0x7202('0x55')],_0x5cf095[_0x7202('0x5c')],md5(_0x5cf095[_0x7202('0x5c')]));}else{_0x5cf095[_0x7202('0x5a')]='';}return getConnection(_0x12bb05)[_0x7202('0x3a')](function(_0x28dd3a){_0x47bb09=_0x28dd3a;return getUser(_0x12bb05,_0x337cf4[_0x7202('0x16')],_0x47bb09);})[_0x7202('0x3a')](function(_0x162b28){_0x3183ef=_0x162b28;logger['info'](_0x7202('0x5d'),_0x3183ef['id']);return getEndUser(_0x12bb05,_0x5cf095['calleridname'],_0x5cf095[_0x7202('0x5e')],_0x47bb09);})['then'](function(_0x1fc385){_0x1fdab4=_0x1fc385;logger[_0x7202('0x9')]('The\x20Enduser\x20ID\x20is:',_0x1fdab4['id']);return getTicket(_0x12bb05,_0x3183ef,_0x1fdab4,_0x1ecabd,_0x5cf095,_0x1ecabd['Fields'],_0x47bb09,_0x7202('0x5f'));})['then'](function(_0x3c1a0c){_0x3535fe=_0x3c1a0c;logger[_0x7202('0x9')](_0x7202('0x60'));logger[_0x7202('0x9')](_0x7202('0x61'),_0x3535fe['id']);return setRelationship(_0x47bb09,_0x3183ef,_0x3535fe,_0x7202('0x62'));})[_0x7202('0x3a')](function(){return setRelationship(_0x47bb09,_0x1fdab4,_0x3535fe,_0x7202('0x63'));})['then'](function(){return getServerInfo(_0x47bb09);})[_0x7202('0x3a')](function(_0x2600f8){var _0x5e9d4f=parseInt(_0x2600f8['version']['charAt'](0x0));var _0x588c69=util['format'](_0x7202('0x64'),_0x12bb05[_0x7202('0x53')],_0x3535fe['id']);if(_0x5e9d4f>0x6){_0x588c69=util[_0x7202('0x1e')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x12bb05[_0x7202('0x53')],_0x3535fe['id']);}logger['info'](_0x7202('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x337cf4['name']),_0x7202('0x66'),{'uri':_0x588c69});})['catch'](function(_0x32b0f2){logger['error'](_0x7202('0x65'),JSON['stringify'](_0x32b0f2));});};exports['outbound']=function(_0x9d4b85,_0x51f8b8,_0x23013e,_0x3a3d84,_0x3997ab,_0x2f4732,_0x4882a3){var _0x36ed3b,_0xacdcb5,_0x38ad7f,_0x48a786;_0x2f4732[_0x7202('0x53')]=intUtil[_0x7202('0x54')](_0x2f4732[_0x7202('0x53')]);_0x2f4732[_0x7202('0x55')]=intUtil[_0x7202('0x54')](_0x2f4732[_0x7202('0x55')]);def['uri']=util[_0x7202('0x1e')](_0x7202('0x57'),_0x2f4732[_0x7202('0x53')]);if(_0x4882a3&&_0x4882a3[_0x7202('0x67')]&&_0x4882a3[_0x7202('0x67')]!==_0x7202('0x68')){logger[_0x7202('0x9')](_0x7202('0x69'),_0x7202('0x59'));_0x51f8b8[_0x7202('0x5a')]=util[_0x7202('0x1e')](_0x7202('0x5b'),_0x2f4732[_0x7202('0x55')],_0x51f8b8['uniqueid'],md5(_0x51f8b8[_0x7202('0x5c')]));}return getConnection(_0x2f4732)[_0x7202('0x3a')](function(_0x2b6d74){_0x48a786=_0x2b6d74;return getUser(_0x2f4732,_0x3a3d84[_0x7202('0x16')],_0x48a786);})[_0x7202('0x3a')](function(_0xcc68ff){_0x36ed3b=_0xcc68ff;logger[_0x7202('0x9')](_0x7202('0x5d'),_0x36ed3b['id']);return getEndUser(_0x2f4732,_0x51f8b8[_0x7202('0x6a')],_0x51f8b8[_0x7202('0x6b')],_0x48a786);})[_0x7202('0x3a')](function(_0x547c53){_0xacdcb5=_0x547c53;logger[_0x7202('0x9')](_0x7202('0x6c'),_0xacdcb5['id']);return getTicket(_0x2f4732,_0x36ed3b,_0xacdcb5,_0x23013e,_0x51f8b8,_0x23013e[_0x7202('0x6d')],_0x48a786,'Outbound');})[_0x7202('0x3a')](function(_0x300d49){_0x38ad7f=_0x300d49;logger['info'](_0x7202('0x60'));logger[_0x7202('0x9')](_0x7202('0x61'),_0x38ad7f['id']);return setRelationship(_0x48a786,_0x36ed3b,_0x38ad7f,_0x7202('0x62'));})[_0x7202('0x3a')](function(){return setRelationship(_0x48a786,_0xacdcb5,_0x38ad7f,_0x7202('0x63'));})[_0x7202('0x3a')](function(){return getServerInfo(_0x48a786);})['then'](function(_0x7c0646){var _0x1b1db2=parseInt(_0x7c0646[_0x7202('0x6e')][_0x7202('0x6f')](0x0));var _0x2f1193=util[_0x7202('0x1e')](_0x7202('0x64'),_0x2f4732[_0x7202('0x53')],_0x38ad7f['id']);if(_0x1b1db2>0x6){_0x2f1193=util['format'](_0x7202('0x70'),_0x2f4732['remoteUri'],_0x38ad7f['id']);}logger[_0x7202('0x9')](_0x7202('0x69'),_0x7202('0x71'));emit(util[_0x7202('0x1e')](_0x7202('0x72'),_0x3a3d84[_0x7202('0x16')]),_0x7202('0x66'),{'uri':_0x2f1193});})['catch'](function(_0x1ecbc9){logger[_0x7202('0x73')](_0x7202('0x69'),JSON['stringify'](_0x1ecbc9));});};exports[_0x7202('0x74')]=function(_0x2ce432,_0x3750a8,_0xb5f059,_0xfddc15,_0x383faf,_0x2ff0cc){var _0x111fa9,_0x5ef007,_0x470b5a,_0xd0ac83;_0x2ff0cc[_0x7202('0x53')]=intUtil[_0x7202('0x54')](_0x2ff0cc[_0x7202('0x53')]);_0x2ff0cc[_0x7202('0x55')]=intUtil[_0x7202('0x54')](_0x2ff0cc['serverUrl']);def[_0x7202('0x56')]=util[_0x7202('0x1e')](_0x7202('0x57'),_0x2ff0cc[_0x7202('0x53')]);if(_0x383faf&&_0x383faf['monitor_format']){logger[_0x7202('0x9')]('['+_0x3750a8[_0x7202('0x75')][_0x7202('0x76')]()+']',_0x7202('0x59'));_0x3750a8[_0x7202('0x5a')]=util[_0x7202('0x1e')](_0x7202('0x5b'),_0x2ff0cc[_0x7202('0x55')],_0x3750a8[_0x7202('0x5c')],md5(_0x3750a8[_0x7202('0x5c')]));}else{_0x3750a8[_0x7202('0x5a')]='';}return getConnection(_0x2ff0cc)[_0x7202('0x3a')](function(_0x29c736){_0xd0ac83=_0x29c736;if(!_[_0x7202('0x25')](_0xfddc15)){return getUser(_0x2ff0cc,_0xfddc15[_0x7202('0x16')],_0xd0ac83);}else{return getUser(_0x2ff0cc,null,_0xd0ac83);}})[_0x7202('0x3a')](function(_0x5df5a5){_0x111fa9=_0x5df5a5;logger[_0x7202('0x9')](_0x7202('0x5d'),_0x111fa9['id']);return getEndUser(_0x2ff0cc,_0x3750a8[_0x7202('0x77')],_0x3750a8[_0x7202('0x5e')],_0xd0ac83);})[_0x7202('0x3a')](function(_0x5576d0){_0x5ef007=_0x5576d0;logger[_0x7202('0x9')]('The\x20Enduser\x20ID\x20is:',_0x5ef007['id']);return getTicket(_0x2ff0cc,_0x111fa9,_0x5ef007,_0xb5f059,_0x3750a8,_0xb5f059[_0x7202('0x6d')],_0xd0ac83,_0x7202('0x5f'));})['then'](function(_0x43d152){_0x470b5a=_0x43d152;logger['info'](_0x7202('0x60'));logger[_0x7202('0x9')](_0x7202('0x61'),_0x470b5a['id']);return setRelationship(_0xd0ac83,_0x111fa9,_0x470b5a,_0x7202('0x62'));})[_0x7202('0x3a')](function(){return setRelationship(_0xd0ac83,_0x5ef007,_0x470b5a,_0x7202('0x63'));})[_0x7202('0x3a')](function(){return getServerInfo(_0xd0ac83);})[_0x7202('0x78')](function(_0x15407d){logger[_0x7202('0x73')]('['+_0x3750a8[_0x7202('0x75')][_0x7202('0x76')]()+']',JSON[_0x7202('0x24')](_0x15407d));});}; \ 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 0b93c9b..6a4cc2e 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 _0x0895=['getString','length','sortBy','type','string','content','variable','variableName','push','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x5e237a,_0x459905){var _0x266859=function(_0x14e259){while(--_0x14e259){_0x5e237a['push'](_0x5e237a['shift']());}};_0x266859(++_0x459905);}(_0x0895,0x80));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));exports[_0x5089('0x2')]=function(_0x2a357d,_0x10c090,_0x1f0acf){var _0x41c5ef=[];if(_0x2a357d[_0x5089('0x3')]>0x0){var _0x18994e=_[_0x5089('0x4')](_0x2a357d,['id']);for(var _0x317d4a=0x0;_0x317d4a<_0x18994e[_0x5089('0x3')];_0x317d4a++){var _0x26d1b5=_0x18994e[_0x317d4a];if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0x6')){_0x41c5ef['push'](_0x26d1b5[_0x5089('0x7')]);}else if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0x8')&&_0x26d1b5[_0x5089('0x9')]){_0x10c090[_0x26d1b5[_0x5089('0x9')]]&&_0x41c5ef[_0x5089('0xa')](_0x10c090[_0x26d1b5[_0x5089('0x9')]][_0x5089('0xb')]());}else if(_0x26d1b5[_0x5089('0x5')]==='customVariable'&&_0x26d1b5['Variable']&&_0x26d1b5['Variable'][_0x5089('0xc')]){_0x10c090[_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')][_0x5089('0xe')]()]&&_0x41c5ef[_0x5089('0xa')](_0x10c090[_0x26d1b5[_0x5089('0xd')]['name'][_0x5089('0xe')]()][_0x5089('0xb')]());}else if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0xf')){if(_0x26d1b5[_0x5089('0x10')]===_0x5089('0x6')&&_0x26d1b5[_0x5089('0x11')]){_0x41c5ef[_0x5089('0xa')](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x26d1b5['keyContent']));}else if(_0x26d1b5[_0x5089('0x10')]===_0x5089('0x8')&&_0x26d1b5['variableName']&&_0x26d1b5['key']){_0x10c090[_0x26d1b5[_0x5089('0x9')]]&&_0x41c5ef['push'](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x10c090[_0x26d1b5[_0x5089('0x9')]]));}else if(_0x26d1b5[_0x5089('0x10')]==='customVariable'&&_0x26d1b5['Variable']&&_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')]&&_0x26d1b5[_0x5089('0x11')]){_0x10c090[_0x26d1b5[_0x5089('0xd')]['name'][_0x5089('0xe')]()]&&_0x41c5ef[_0x5089('0xa')](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x10c090[_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')][_0x5089('0xe')]()]));}}}}return _0x41c5ef[_0x5089('0x14')](_0x1f0acf);};exports['stripTrailingSlash']=function(_0x52454a){var _0x47c906=_0x52454a[_0x5089('0x15')](-0x1);if(_0x47c906==='/'){_0x52454a=_0x52454a[_0x5089('0x16')](0x0,_0x52454a[_0x5089('0x17')](_0x47c906));}return _0x52454a;};exports[_0x5089('0x18')]=function(_0x5b0366){if(!_['isNil'](_0x5b0366)&&_0x5b0366!==''){var _0x53bcd5=/^(([^<>()\[\]\\.,;:\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 _0x53bcd5[_0x5089('0x19')](String(_0x5b0366)[_0x5089('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x25a7=['lastIndexOf','isNil','lodash','util','getString','sortBy','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','keyContent','format','%s:\x20%s','keyType','slice','substring'];(function(_0x5ebf90,_0x4aa4fc){var _0x5020ef=function(_0xaba82b){while(--_0xaba82b){_0x5ebf90['push'](_0x5ebf90['shift']());}};_0x5020ef(++_0x4aa4fc);}(_0x25a7,0x188));var _0x725a=function(_0x3af43c,_0x333c9f){_0x3af43c=_0x3af43c-0x0;var _0x206dd4=_0x25a7[_0x3af43c];return _0x206dd4;};'use strict';var _=require(_0x725a('0x0'));var util=require(_0x725a('0x1'));exports[_0x725a('0x2')]=function(_0x28ef22,_0x53372c,_0x457ff0){var _0x3ec6b8=[];if(_0x28ef22['length']>0x0){var _0x23d3ea=_[_0x725a('0x3')](_0x28ef22,['id']);for(var _0x248f47=0x0;_0x248f47<_0x23d3ea[_0x725a('0x4')];_0x248f47++){var _0x2ba49f=_0x23d3ea[_0x248f47];if(_0x2ba49f[_0x725a('0x5')]===_0x725a('0x6')){_0x3ec6b8[_0x725a('0x7')](_0x2ba49f[_0x725a('0x8')]);}else if(_0x2ba49f[_0x725a('0x5')]===_0x725a('0x9')&&_0x2ba49f[_0x725a('0xa')]){_0x53372c[_0x2ba49f[_0x725a('0xa')]]&&_0x3ec6b8[_0x725a('0x7')](_0x53372c[_0x2ba49f[_0x725a('0xa')]][_0x725a('0xb')]());}else if(_0x2ba49f[_0x725a('0x5')]===_0x725a('0xc')&&_0x2ba49f['Variable']&&_0x2ba49f[_0x725a('0xd')][_0x725a('0xe')]){_0x53372c[_0x2ba49f[_0x725a('0xd')]['name']['toLowerCase']()]&&_0x3ec6b8[_0x725a('0x7')](_0x53372c[_0x2ba49f[_0x725a('0xd')][_0x725a('0xe')][_0x725a('0xf')]()][_0x725a('0xb')]());}else if(_0x2ba49f[_0x725a('0x5')]===_0x725a('0x10')){if(_0x2ba49f['keyType']==='string'&&_0x2ba49f['key']){_0x3ec6b8[_0x725a('0x7')](util['format']('%s:\x20%s',_0x2ba49f[_0x725a('0x11')],_0x2ba49f[_0x725a('0x12')]));}else if(_0x2ba49f['keyType']===_0x725a('0x9')&&_0x2ba49f['variableName']&&_0x2ba49f[_0x725a('0x11')]){_0x53372c[_0x2ba49f[_0x725a('0xa')]]&&_0x3ec6b8['push'](util[_0x725a('0x13')](_0x725a('0x14'),_0x2ba49f[_0x725a('0x11')],_0x53372c[_0x2ba49f['variableName']]));}else if(_0x2ba49f[_0x725a('0x15')]===_0x725a('0xc')&&_0x2ba49f[_0x725a('0xd')]&&_0x2ba49f['Variable']['name']&&_0x2ba49f[_0x725a('0x11')]){_0x53372c[_0x2ba49f[_0x725a('0xd')][_0x725a('0xe')][_0x725a('0xf')]()]&&_0x3ec6b8[_0x725a('0x7')](util['format'](_0x725a('0x14'),_0x2ba49f[_0x725a('0x11')],_0x53372c[_0x2ba49f[_0x725a('0xd')][_0x725a('0xe')][_0x725a('0xf')]()]));}}}}return _0x3ec6b8['join'](_0x457ff0);};exports['stripTrailingSlash']=function(_0x25eb92){var _0x222412=_0x25eb92[_0x725a('0x16')](-0x1);if(_0x222412==='/'){_0x25eb92=_0x25eb92[_0x725a('0x17')](0x0,_0x25eb92[_0x725a('0x18')](_0x222412));}return _0x25eb92;};exports['validateEmail']=function(_0x5b7fec){if(!_[_0x725a('0x19')](_0x5b7fec)&&_0x5b7fec!==''){var _0x1f44eb=/^(([^<>()\[\]\\.,;:\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 _0x1f44eb['test'](String(_0x5b7fec)[_0x725a('0xf')]());}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 cf5ffb1..ace992b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x1864ff,_0x71c448){var _0x3e9480=function(_0x521611){while(--_0x521611){_0x1864ff['push'](_0x1864ff['shift']());}};_0x3e9480(++_0x71c448);}(_0xe706,0xa3));var _0x6e70=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0xe706[_0x23ac30];return _0x208fec;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _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(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 13ef371..3390358 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 _0x5732=['The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','replace','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toString','idField','custom_fields','content','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum'];(function(_0x260e32,_0x3d6daf){var _0x3dbd68=function(_0x1f03c5){while(--_0x1f03c5){_0x260e32['push'](_0x260e32['shift']());}};_0x3dbd68(++_0x3d6daf);}(_0x5732,0x7d));var _0x2573=function(_0x35ad91,_0x5635bc){_0x35ad91=_0x35ad91-0x0;var _0x202ecb=_0x5732[_0x35ad91];return _0x202ecb;};'use strict';var _=require(_0x2573('0x0'));var rp=require(_0x2573('0x1'));var md5=require(_0x2573('0x2'));var util=require(_0x2573('0x3'));var Redis=require(_0x2573('0x4'));var intUtil=require(_0x2573('0x5'));var config=require(_0x2573('0x6'));var logger=require('../../../../config/logger')(_0x2573('0x7'));config[_0x2573('0x8')]=_[_0x2573('0x9')](config[_0x2573('0x8')],{'host':_0x2573('0xa'),'port':0x18eb});var io=require(_0x2573('0xb'))(new Redis(config[_0x2573('0x8')]));function emit(_0x48dcac,_0x4404cc,_0x5e2ad2){io['to'](_0x48dcac)[_0x2573('0xc')](_0x4404cc,_0x5e2ad2);}var headers={'Content-Type':_0x2573('0xd'),'Accept':'application/json'};function getTicket(_0x471d24,_0x17db17,_0x2838ef,_0x1b59a4,_0x52b945){logger[_0x2573('0xe')](_0x2573('0xf'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x11'),_0x471d24['remoteUri']),'method':_0x2573('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x2838ef['id'],'submitter_id':_0x17db17?_0x17db17['id']:undefined,'assignee_id':_0x17db17?_0x17db17['id']:undefined,'tags':getTags(_0x1b59a4[_0x2573('0x13')],_0x2573('0x14')),'subject':intUtil['getString'](_0x1b59a4['Subjects'],_0x52b945,'\x20'),'description':intUtil[_0x2573('0x15')](_0x1b59a4[_0x2573('0x16')],_0x52b945,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2573('0x15')](_0x1b59a4[_0x2573('0x16')],_0x52b945,'\x0a')}},getCustomFields(_0x1b59a4[_0x2573('0x17')],_0x52b945))}})['then'](function(_0x2eb4df){logger[_0x2573('0xe')](_0x2573('0x18'));return _0x2eb4df[_0x2573('0x19')];});}function getUser(_0x47e6a4,_0x231ab7){if(intUtil[_0x2573('0x1a')](_0x231ab7)){logger[_0x2573('0xe')](_0x2573('0x1b'),_0x231ab7);return request({'uri':util[_0x2573('0x10')](_0x2573('0x1c'),_0x47e6a4[_0x2573('0x1d')]),'qs':{'query':util['format'](_0x2573('0x1e'),_0x231ab7)}})[_0x2573('0x1f')](function(_0x5ed073){if(_0x5ed073[_0x2573('0x20')]){logger[_0x2573('0xe')](_0x2573('0x21'));return _[_0x2573('0x22')](_0x5ed073[_0x2573('0x23')],{'email':_0x231ab7,'role':_0x2573('0x24')});}else{logger[_0x2573('0xe')](_0x2573('0x25'));return request({'uri':util['format']('%s/users/me.json',_0x47e6a4[_0x2573('0x1d')])})[_0x2573('0x1f')](function(_0x512edf){logger[_0x2573('0xe')](_0x2573('0x26'));return _0x512edf[_0x2573('0x27')];});}});}else{logger['info'](_0x2573('0x25'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x28'),_0x47e6a4[_0x2573('0x1d')])})['then'](function(_0x50ff99){logger[_0x2573('0xe')](_0x2573('0x26'));return _0x50ff99[_0x2573('0x27')];});}}function getEndUser(_0x135a00,_0x713277,_0x441209){logger['info'](_0x2573('0x29'),_0x441209);return request({'uri':util['format'](_0x2573('0x1c'),_0x135a00[_0x2573('0x1d')]),'qs':{'query':util[_0x2573('0x10')](_0x2573('0x2a'),_0x441209)}})['then'](function(_0x5e0b50){var _0x18e9f4;if(_0x5e0b50[_0x2573('0x23')][_0x2573('0x2b')]){_0x5e0b50[_0x2573('0x23')]=_[_0x2573('0x2c')](_0x5e0b50['results'],{'suspended':![],'role':_0x2573('0x2d')});if(_0x5e0b50['results'][_0x2573('0x2b')]){_0x18e9f4=_[_0x2573('0x2e')](_0x5e0b50['results']);}}if(_0x18e9f4){logger['info']('Enduser\x20found!');return _0x18e9f4;}else{logger[_0x2573('0xe')](_0x2573('0x2f'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x30'),_0x135a00['remoteUri']),'method':'POST','body':{'user':{'role':_0x2573('0x2d'),'name':util[_0x2573('0x10')]('Caller\x20-\x20%s',_0x713277||_0x441209),'phone':_0x441209}}})[_0x2573('0x1f')](function(_0x3bdead){logger[_0x2573('0xe')](_0x2573('0x31'));return _0x3bdead[_0x2573('0x27')];});}});}function getAuth(_0x41bce5){var _0x104681;if(_0x41bce5['authType']===_0x2573('0x32')){_0x104681=util['format'](_0x2573('0x33'),_0x41bce5[_0x2573('0x34')],_0x41bce5[_0x2573('0x32')]);}else if(_0x41bce5[_0x2573('0x35')]===_0x2573('0x36')){_0x104681=util['format'](_0x2573('0x37'),_0x41bce5[_0x2573('0x34')],_0x41bce5[_0x2573('0x36')]);}return util[_0x2573('0x10')](_0x2573('0x38'),new Buffer(_0x104681)['toString']('base64'));}function request(_0x2f099){logger['debug'](_0x2573('0x39'),JSON[_0x2573('0x3a')](_0x2f099));return rp(_[_0x2573('0x9')](_0x2f099,{'method':_0x2573('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x1b19e1,_0x234ab3){var _0x1bb16a=[];if(_0x1b19e1&&_0x1b19e1[_0x2573('0x2b')]>0x0){_0x1bb16a=_[_0x2573('0x3c')](_0x1b19e1,_0x234ab3);}return _0x1bb16a;}function getCustomFields(_0x43f5f7,_0x8903cb){var _0x229234=[];var _0x4daea1={'custom_fields':[]};if(_0x43f5f7[_0x2573('0x2b')]>0x0){_[_0x2573('0x3d')](_0x43f5f7,function(_0x493ac){if(_[_0x2573('0x3e')]([_0x2573('0x3f'),_0x2573('0x40')],_0x493ac[_0x2573('0x41')])&&_0x493ac[_0x2573('0x42')]&&!_0x493ac[_0x2573('0x43')]){_0x4daea1[_0x493ac['nameField']['toLowerCase']()]=_0x493ac['content'][_0x2573('0x44')]();}else if(_['includes']([_0x2573('0x3f'),_0x2573('0x40')],_0x493ac[_0x2573('0x41')])&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x4daea1[_0x2573('0x46')]['push']({'id':_0x493ac[_0x2573('0x45')],'value':_0x493ac[_0x2573('0x47')]['toString']()});}else if(_0x493ac[_0x2573('0x41')]==='variable'&&_0x493ac[_0x2573('0x48')]&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x8903cb[_0x493ac[_0x2573('0x48')]]&&_0x4daea1[_0x2573('0x46')][_0x2573('0x49')]({'id':_0x493ac[_0x2573('0x45')],'value':_0x8903cb[_0x493ac[_0x2573('0x48')]][_0x2573('0x44')]()});}else if(_0x493ac[_0x2573('0x41')]===_0x2573('0x4a')&&_0x493ac[_0x2573('0x4b')]&&_0x493ac[_0x2573('0x4b')][_0x2573('0x14')]&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x8903cb[_0x493ac[_0x2573('0x4b')]['name']['toLowerCase']()]&&_0x4daea1['custom_fields'][_0x2573('0x49')]({'id':_0x493ac['idField'],'value':_0x8903cb[_0x493ac['Variable'][_0x2573('0x14')][_0x2573('0x4c')]()][_0x2573('0x44')]()});}});}return _0x4daea1;}exports[_0x2573('0x4d')]=function(_0x355fe4,_0x1619af,_0xd753b4,_0x4816a0,_0x304066,_0xa95379){var _0x25e7d8,_0xd1016c;_0xa95379[_0x2573('0x1d')]=intUtil['stripTrailingSlash'](_0xa95379['remoteUri']);_0xa95379[_0x2573('0x4e')]=intUtil[_0x2573('0x4f')](_0xa95379['serverUrl']);if(_0x304066&&_0x304066['monitor_format']){logger['info']('[QUEUE]',_0x2573('0x50'));_0x1619af[_0x2573('0x51')]=util[_0x2573('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa95379['serverUrl'],_0x1619af[_0x2573('0x52')],md5(_0x1619af[_0x2573('0x52')]));}else{_0x1619af[_0x2573('0x51')]='';}headers['Authorization']=getAuth(_0xa95379);return getUser(_0xa95379,_0x4816a0[_0x2573('0x53')])['then'](function(_0x5d0e2a){_0x25e7d8=_0x5d0e2a;logger['info'](_0x2573('0x54'),_0x25e7d8['id']);return getEndUser(_0xa95379,_0x1619af[_0x2573('0x55')],_0x1619af[_0x2573('0x56')]);})['then'](function(_0x30ea7a){_0xd1016c=_0x30ea7a;logger[_0x2573('0xe')]('The\x20Enduser\x20ID\x20is:',_0xd1016c['id']);return getTicket(_0xa95379,_0x25e7d8,_0xd1016c,_0xd753b4,_0x1619af);})['then'](function(_0x2f575f){if(_0x2f575f){logger[_0x2573('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2f575f['id']);switch(_0xa95379[_0x2573('0x41')]){case _0x2573('0x57'):logger[_0x2573('0xe')](_0x2573('0x58'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2573('0x59'),_0xa95379['remoteUri'],_0x25e7d8['id'],_0x2f575f['id']),'method':_0x2573('0x12')});case _0x2573('0x5a'):logger[_0x2573('0xe')]('[QUEUE]',_0x2573('0x5b'));emit(util[_0x2573('0x10')](_0x2573('0x5c'),_0x4816a0[_0x2573('0x14')]),_0x2573('0x5d'),{'uri':util[_0x2573('0x10')](_0x2573('0x5e'),_0xa95379[_0x2573('0x1d')]['replace'](_0x2573('0x5f'),''),_0x2f575f['id'])});break;default:logger[_0x2573('0x60')](_0x2573('0x58'),_0x2573('0x61'));}}})[_0x2573('0x62')](function(_0x1b8c6a){logger[_0x2573('0x60')](_0x2573('0x63'),util[_0x2573('0x64')](_0x1b8c6a,{'showHidden':!![],'depth':null}));});};exports[_0x2573('0x65')]=function(_0x3f6ad9,_0x519c87,_0x50af29,_0x426958,_0x2de6aa,_0x4e2bac,_0x4ace94){var _0x21109b,_0x3fafaf;_0x4e2bac['remoteUri']=intUtil[_0x2573('0x4f')](_0x4e2bac[_0x2573('0x1d')]);_0x4e2bac['serverUrl']=intUtil[_0x2573('0x4f')](_0x4e2bac[_0x2573('0x4e')]);if(_0x4ace94&&_0x4ace94[_0x2573('0x66')]&&_0x4ace94['recordingFormat']!==_0x2573('0x67')){logger['info'](_0x2573('0x68'),_0x2573('0x50'));_0x519c87[_0x2573('0x51')]=util[_0x2573('0x10')](_0x2573('0x69'),_0x4e2bac[_0x2573('0x4e')],_0x519c87[_0x2573('0x52')],md5(_0x519c87[_0x2573('0x52')]));}headers[_0x2573('0x6a')]=getAuth(_0x4e2bac);return getUser(_0x4e2bac,_0x426958[_0x2573('0x53')])[_0x2573('0x1f')](function(_0x4cbcba){_0x21109b=_0x4cbcba;logger[_0x2573('0xe')]('The\x20User\x20ID\x20is:',_0x21109b['id']);return getEndUser(_0x4e2bac,_0x519c87[_0x2573('0x6b')],_0x519c87[_0x2573('0x6c')]);})[_0x2573('0x1f')](function(_0x2d043d){_0x3fafaf=_0x2d043d;logger[_0x2573('0xe')](_0x2573('0x6d'),_0x3fafaf['id']);return getTicket(_0x4e2bac,_0x21109b,_0x3fafaf,_0x50af29,_0x519c87);})[_0x2573('0x1f')](function(_0x17af39){if(_0x17af39){logger[_0x2573('0xe')]('The\x20Ticket\x20ID\x20is:',_0x17af39['id']);switch(_0x4e2bac[_0x2573('0x41')]){case _0x2573('0x57'):logger[_0x2573('0xe')](_0x2573('0x68'),_0x2573('0x6e'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x59'),_0x4e2bac[_0x2573('0x1d')],_0x21109b['id'],_0x17af39['id']),'method':_0x2573('0x12')});case _0x2573('0x5a'):logger[_0x2573('0xe')](_0x2573('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x426958[_0x2573('0x14')]),_0x2573('0x5d'),{'uri':util[_0x2573('0x10')](_0x2573('0x5e'),_0x4e2bac[_0x2573('0x1d')][_0x2573('0x6f')](_0x2573('0x5f'),''),_0x17af39['id'])});break;default:logger[_0x2573('0x60')](_0x2573('0x68'),_0x2573('0x61'));}}})[_0x2573('0x62')](function(_0x38c572){logger[_0x2573('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2573('0x64')](_0x38c572,{'showHidden':!![],'depth':null}));});};exports[_0x2573('0x70')]=function(_0x5ade92,_0x2840df,_0x54e188,_0x323882,_0x4f4368,_0x47127a){var _0x33fdf6,_0x33c1bb;_0x47127a[_0x2573('0x1d')]=intUtil[_0x2573('0x4f')](_0x47127a[_0x2573('0x1d')]);_0x47127a[_0x2573('0x4e')]=intUtil[_0x2573('0x4f')](_0x47127a[_0x2573('0x4e')]);if(_0x4f4368&&_0x4f4368['monitor_format']){logger[_0x2573('0xe')]('['+_0x2840df[_0x2573('0x71')][_0x2573('0x72')]()+']',_0x2573('0x50'));_0x2840df[_0x2573('0x51')]=util[_0x2573('0x10')](_0x2573('0x69'),_0x47127a[_0x2573('0x4e')],_0x2840df[_0x2573('0x52')],md5(_0x2840df['uniqueid']));}else{_0x2840df[_0x2573('0x51')]='';}headers[_0x2573('0x6a')]=getAuth(_0x47127a);return getUser(_0x47127a)[_0x2573('0x1f')](function(_0x514668){_0x33fdf6=_0x514668;logger[_0x2573('0xe')](_0x2573('0x54'),_0x33fdf6['id']);return getEndUser(_0x47127a,_0x2840df[_0x2573('0x55')],_0x2840df[_0x2573('0x56')]);})['then'](function(_0x3d339d){_0x33c1bb=_0x3d339d;logger[_0x2573('0xe')](_0x2573('0x6d'),_0x33c1bb['id']);return getTicket(_0x47127a,_0x33fdf6,_0x33c1bb,_0x54e188,_0x2840df);})[_0x2573('0x1f')](function(_0x41b4d2){if(_0x41b4d2){logger[_0x2573('0xe')](_0x2573('0x73'),_0x41b4d2['id']);}})['catch'](function(_0x2a8e86){logger[_0x2573('0x60')]('['+_0x2840df[_0x2573('0x71')][_0x2573('0x72')]()+']'+_0x2573('0x74'),util['inspect'](_0x2a8e86,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd34d=['validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variable','variableName','custom_fields','Variable','toLowerCase','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','integrationTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','ioredis','./util','zendesk','defaults','socket.io-emitter','redis','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','POST','Tags','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!'];(function(_0x40c326,_0x52f1cc){var _0x4df27b=function(_0x2a5382){while(--_0x2a5382){_0x40c326['push'](_0x40c326['shift']());}};_0x4df27b(++_0x52f1cc);}(_0xd34d,0xc7));var _0xdd34=function(_0x122afc,_0x2b77e8){_0x122afc=_0x122afc-0x0;var _0x2041d0=_0xd34d[_0x122afc];return _0x2041d0;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0xdd34('0x0'));var intUtil=require(_0xdd34('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdd34('0x2'));config['redis']=_[_0xdd34('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdd34('0x4'))(new Redis(config[_0xdd34('0x5')]));function emit(_0x5b38ef,_0x38b63c,_0x59b760){io['to'](_0x5b38ef)[_0xdd34('0x6')](_0x38b63c,_0x59b760);}var headers={'Content-Type':_0xdd34('0x7'),'Accept':'application/json'};function getTicket(_0x23bd47,_0x49bc64,_0x2322ab,_0x58eee5,_0xb58bbb){logger['info'](_0xdd34('0x8'));return request({'uri':util['format'](_0xdd34('0x9'),_0x23bd47['remoteUri']),'method':_0xdd34('0xa'),'body':{'ticket':_['merge']({'requester_id':_0x2322ab['id'],'submitter_id':_0x49bc64?_0x49bc64['id']:undefined,'assignee_id':_0x49bc64?_0x49bc64['id']:undefined,'tags':getTags(_0x58eee5[_0xdd34('0xb')],'name'),'subject':intUtil[_0xdd34('0xc')](_0x58eee5[_0xdd34('0xd')],_0xb58bbb,'\x20'),'description':intUtil[_0xdd34('0xc')](_0x58eee5[_0xdd34('0xe')],_0xb58bbb,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x58eee5[_0xdd34('0xe')],_0xb58bbb,'\x0a')}},getCustomFields(_0x58eee5[_0xdd34('0xf')],_0xb58bbb))}})[_0xdd34('0x10')](function(_0x5a6466){logger[_0xdd34('0x11')](_0xdd34('0x12'));return _0x5a6466['ticket'];});}function getUser(_0x2ed084,_0x50963b){if(intUtil[_0xdd34('0x13')](_0x50963b)){logger[_0xdd34('0x11')](_0xdd34('0x14'),_0x50963b);return request({'uri':util[_0xdd34('0x15')](_0xdd34('0x16'),_0x2ed084[_0xdd34('0x17')]),'qs':{'query':util[_0xdd34('0x15')](_0xdd34('0x18'),_0x50963b)}})[_0xdd34('0x10')](function(_0x17a20e){if(_0x17a20e['count']){logger[_0xdd34('0x11')](_0xdd34('0x19'));return _[_0xdd34('0x1a')](_0x17a20e[_0xdd34('0x1b')],{'email':_0x50963b,'role':_0xdd34('0x1c')});}else{logger[_0xdd34('0x11')](_0xdd34('0x1d'));return request({'uri':util[_0xdd34('0x15')](_0xdd34('0x1e'),_0x2ed084['remoteUri'])})[_0xdd34('0x10')](function(_0x35184b){logger[_0xdd34('0x11')](_0xdd34('0x1f'));return _0x35184b[_0xdd34('0x20')];});}});}else{logger[_0xdd34('0x11')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdd34('0x15')](_0xdd34('0x1e'),_0x2ed084[_0xdd34('0x17')])})[_0xdd34('0x10')](function(_0xc829d8){logger[_0xdd34('0x11')](_0xdd34('0x1f'));return _0xc829d8['user'];});}}function getEndUser(_0x3c0d2b,_0x5abc23,_0x1fd153){logger[_0xdd34('0x11')]('Searching\x20enduser\x20with\x20phone',_0x1fd153);return request({'uri':util[_0xdd34('0x15')]('%s/search.json',_0x3c0d2b[_0xdd34('0x17')]),'qs':{'query':util[_0xdd34('0x15')]('type:user\x20role:end-user\x20phone:%s',_0x1fd153)}})[_0xdd34('0x10')](function(_0x2bba42){var _0x2dd939;if(_0x2bba42[_0xdd34('0x1b')][_0xdd34('0x21')]){_0x2bba42['results']=_[_0xdd34('0x22')](_0x2bba42[_0xdd34('0x1b')],{'suspended':![],'role':'end-user'});if(_0x2bba42[_0xdd34('0x1b')]['length']){_0x2dd939=_[_0xdd34('0x23')](_0x2bba42[_0xdd34('0x1b')]);}}if(_0x2dd939){logger['info'](_0xdd34('0x24'));return _0x2dd939;}else{logger[_0xdd34('0x11')](_0xdd34('0x25'));return request({'uri':util['format'](_0xdd34('0x26'),_0x3c0d2b[_0xdd34('0x17')]),'method':_0xdd34('0xa'),'body':{'user':{'role':_0xdd34('0x27'),'name':util[_0xdd34('0x15')](_0xdd34('0x28'),_0x5abc23||_0x1fd153),'phone':_0x1fd153}}})['then'](function(_0x35ecba){logger['info'](_0xdd34('0x29'));return _0x35ecba[_0xdd34('0x20')];});}});}function getAuth(_0xc09099){var _0x49a98d;if(_0xc09099[_0xdd34('0x2a')]===_0xdd34('0x2b')){_0x49a98d=util['format']('%s:%s',_0xc09099[_0xdd34('0x2c')],_0xc09099[_0xdd34('0x2b')]);}else if(_0xc09099[_0xdd34('0x2a')]===_0xdd34('0x2d')){_0x49a98d=util[_0xdd34('0x15')](_0xdd34('0x2e'),_0xc09099[_0xdd34('0x2c')],_0xc09099[_0xdd34('0x2d')]);}return util['format'](_0xdd34('0x2f'),new Buffer(_0x49a98d)[_0xdd34('0x30')]('base64'));}function request(_0x150d0c){logger[_0xdd34('0x31')](_0xdd34('0x32'),JSON['stringify'](_0x150d0c));return rp(_[_0xdd34('0x3')](_0x150d0c,{'method':_0xdd34('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x53516e,_0x1c378f){var _0x14881b=[];if(_0x53516e&&_0x53516e[_0xdd34('0x21')]>0x0){_0x14881b=_[_0xdd34('0x34')](_0x53516e,_0x1c378f);}return _0x14881b;}function getCustomFields(_0x410dd1,_0x50614a){var _0x1bb66b=[];var _0x47f51b={'custom_fields':[]};if(_0x410dd1[_0xdd34('0x21')]>0x0){_[_0xdd34('0x35')](_0x410dd1,function(_0x1efdf7){if(_[_0xdd34('0x36')]([_0xdd34('0x37'),_0xdd34('0x38')],_0x1efdf7[_0xdd34('0x39')])&&_0x1efdf7[_0xdd34('0x3a')]&&!_0x1efdf7[_0xdd34('0x3b')]){_0x47f51b[_0x1efdf7[_0xdd34('0x3a')]['toLowerCase']()]=_0x1efdf7[_0xdd34('0x3c')][_0xdd34('0x30')]();}else if(_['includes']([_0xdd34('0x37'),_0xdd34('0x38')],_0x1efdf7[_0xdd34('0x39')])&&_0x1efdf7[_0xdd34('0x3d')]&&_0x1efdf7[_0xdd34('0x3b')]){_0x47f51b['custom_fields'][_0xdd34('0x3e')]({'id':_0x1efdf7['idField'],'value':_0x1efdf7[_0xdd34('0x3c')][_0xdd34('0x30')]()});}else if(_0x1efdf7[_0xdd34('0x39')]===_0xdd34('0x3f')&&_0x1efdf7[_0xdd34('0x40')]&&_0x1efdf7[_0xdd34('0x3d')]&&_0x1efdf7[_0xdd34('0x3b')]){_0x50614a[_0x1efdf7['variableName']]&&_0x47f51b[_0xdd34('0x41')]['push']({'id':_0x1efdf7[_0xdd34('0x3d')],'value':_0x50614a[_0x1efdf7['variableName']][_0xdd34('0x30')]()});}else if(_0x1efdf7['type']==='customVariable'&&_0x1efdf7[_0xdd34('0x42')]&&_0x1efdf7[_0xdd34('0x42')]['name']&&_0x1efdf7[_0xdd34('0x3d')]&&_0x1efdf7[_0xdd34('0x3b')]){_0x50614a[_0x1efdf7[_0xdd34('0x42')]['name'][_0xdd34('0x43')]()]&&_0x47f51b[_0xdd34('0x41')][_0xdd34('0x3e')]({'id':_0x1efdf7[_0xdd34('0x3d')],'value':_0x50614a[_0x1efdf7['Variable'][_0xdd34('0x44')][_0xdd34('0x43')]()]['toString']()});}});}return _0x47f51b;}exports[_0xdd34('0x45')]=function(_0x13d92d,_0x4c1e19,_0x475f84,_0x5845a2,_0x3c2fc8,_0x36670f){var _0x55f6f2,_0x55effe;_0x36670f[_0xdd34('0x17')]=intUtil[_0xdd34('0x46')](_0x36670f[_0xdd34('0x17')]);_0x36670f[_0xdd34('0x47')]=intUtil['stripTrailingSlash'](_0x36670f[_0xdd34('0x47')]);if(_0x3c2fc8&&_0x3c2fc8[_0xdd34('0x48')]){logger['info'](_0xdd34('0x49'),_0xdd34('0x4a'));_0x4c1e19[_0xdd34('0x4b')]=util[_0xdd34('0x15')](_0xdd34('0x4c'),_0x36670f[_0xdd34('0x47')],_0x4c1e19[_0xdd34('0x4d')],md5(_0x4c1e19[_0xdd34('0x4d')]));}else{_0x4c1e19[_0xdd34('0x4b')]='';}headers[_0xdd34('0x4e')]=getAuth(_0x36670f);return getUser(_0x36670f,_0x5845a2[_0xdd34('0x4f')])[_0xdd34('0x10')](function(_0x360a59){_0x55f6f2=_0x360a59;logger['info'](_0xdd34('0x50'),_0x55f6f2['id']);return getEndUser(_0x36670f,_0x4c1e19['calleridname'],_0x4c1e19[_0xdd34('0x51')]);})[_0xdd34('0x10')](function(_0x5e8427){_0x55effe=_0x5e8427;logger[_0xdd34('0x11')]('The\x20Enduser\x20ID\x20is:',_0x55effe['id']);return getTicket(_0x36670f,_0x55f6f2,_0x55effe,_0x475f84,_0x4c1e19);})[_0xdd34('0x10')](function(_0x39831a){if(_0x39831a){logger['info'](_0xdd34('0x52'),_0x39831a['id']);switch(_0x36670f[_0xdd34('0x39')]){case'integrationTab':logger[_0xdd34('0x11')]('[QUEUE]',_0xdd34('0x53'));return request({'uri':util[_0xdd34('0x15')](_0xdd34('0x54'),_0x36670f['remoteUri'],_0x55f6f2['id'],_0x39831a['id']),'method':'POST'});case _0xdd34('0x55'):logger[_0xdd34('0x11')](_0xdd34('0x49'),_0xdd34('0x56'));emit(util[_0xdd34('0x15')](_0xdd34('0x57'),_0x5845a2[_0xdd34('0x44')]),_0xdd34('0x58'),{'uri':util[_0xdd34('0x15')](_0xdd34('0x59'),_0x36670f[_0xdd34('0x17')][_0xdd34('0x5a')](_0xdd34('0x5b'),''),_0x39831a['id'])});break;default:logger[_0xdd34('0x5c')](_0xdd34('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdd34('0x5d')](function(_0x29b4ab){logger['error'](_0xdd34('0x5e'),util[_0xdd34('0x5f')](_0x29b4ab,{'showHidden':!![],'depth':null}));});};exports[_0xdd34('0x60')]=function(_0x55b759,_0x5d3457,_0x1a1517,_0x5c349a,_0x1af095,_0x412769,_0x48f116){var _0x179004,_0x5c635c;_0x412769[_0xdd34('0x17')]=intUtil[_0xdd34('0x46')](_0x412769[_0xdd34('0x17')]);_0x412769[_0xdd34('0x47')]=intUtil[_0xdd34('0x46')](_0x412769[_0xdd34('0x47')]);if(_0x48f116&&_0x48f116[_0xdd34('0x61')]&&_0x48f116[_0xdd34('0x61')]!==_0xdd34('0x62')){logger['info'](_0xdd34('0x63'),_0xdd34('0x4a'));_0x5d3457['recordingURL']=util['format'](_0xdd34('0x4c'),_0x412769[_0xdd34('0x47')],_0x5d3457[_0xdd34('0x4d')],md5(_0x5d3457['uniqueid']));}headers[_0xdd34('0x4e')]=getAuth(_0x412769);return getUser(_0x412769,_0x5c349a[_0xdd34('0x4f')])['then'](function(_0x12f7de){_0x179004=_0x12f7de;logger[_0xdd34('0x11')](_0xdd34('0x50'),_0x179004['id']);return getEndUser(_0x412769,_0x5d3457['destcalleridname'],_0x5d3457['destcalleridnum']);})['then'](function(_0x58534d){_0x5c635c=_0x58534d;logger[_0xdd34('0x11')]('The\x20Enduser\x20ID\x20is:',_0x5c635c['id']);return getTicket(_0x412769,_0x179004,_0x5c635c,_0x1a1517,_0x5d3457);})[_0xdd34('0x10')](function(_0x32f399){if(_0x32f399){logger[_0xdd34('0x11')](_0xdd34('0x52'),_0x32f399['id']);switch(_0x412769[_0xdd34('0x39')]){case _0xdd34('0x64'):logger[_0xdd34('0x11')](_0xdd34('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xdd34('0x15')](_0xdd34('0x54'),_0x412769[_0xdd34('0x17')],_0x179004['id'],_0x32f399['id']),'method':_0xdd34('0xa')});case _0xdd34('0x55'):logger['info'](_0xdd34('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdd34('0x15')](_0xdd34('0x57'),_0x5c349a[_0xdd34('0x44')]),_0xdd34('0x58'),{'uri':util[_0xdd34('0x15')](_0xdd34('0x59'),_0x412769['remoteUri'][_0xdd34('0x5a')](_0xdd34('0x5b'),''),_0x32f399['id'])});break;default:logger['error']('[OUTBOUND]',_0xdd34('0x65'));}}})[_0xdd34('0x5d')](function(_0x53cb4c){logger['error'](_0xdd34('0x66'),util['inspect'](_0x53cb4c,{'showHidden':!![],'depth':null}));});};exports[_0xdd34('0x67')]=function(_0x281bbe,_0x535a56,_0x1f31fd,_0x3c6506,_0x4681ee,_0x334dbd){var _0x16f108,_0x1a0568;_0x334dbd[_0xdd34('0x17')]=intUtil['stripTrailingSlash'](_0x334dbd['remoteUri']);_0x334dbd['serverUrl']=intUtil['stripTrailingSlash'](_0x334dbd['serverUrl']);if(_0x4681ee&&_0x4681ee[_0xdd34('0x48')]){logger[_0xdd34('0x11')]('['+_0x535a56[_0xdd34('0x68')][_0xdd34('0x69')]()+']','Recording\x20is\x20enabled!');_0x535a56[_0xdd34('0x4b')]=util['format'](_0xdd34('0x4c'),_0x334dbd['serverUrl'],_0x535a56['uniqueid'],md5(_0x535a56[_0xdd34('0x4d')]));}else{_0x535a56[_0xdd34('0x4b')]='';}headers[_0xdd34('0x4e')]=getAuth(_0x334dbd);return getUser(_0x334dbd)['then'](function(_0x215cbe){_0x16f108=_0x215cbe;logger['info'](_0xdd34('0x50'),_0x16f108['id']);return getEndUser(_0x334dbd,_0x535a56[_0xdd34('0x6a')],_0x535a56['calleridnum']);})['then'](function(_0x44a109){_0x1a0568=_0x44a109;logger[_0xdd34('0x11')](_0xdd34('0x6b'),_0x1a0568['id']);return getTicket(_0x334dbd,_0x16f108,_0x1a0568,_0x1f31fd,_0x535a56);})[_0xdd34('0x10')](function(_0x296a80){if(_0x296a80){logger[_0xdd34('0x11')](_0xdd34('0x52'),_0x296a80['id']);}})[_0xdd34('0x5d')](function(_0x4da6f7){logger[_0xdd34('0x5c')]('['+_0x535a56['lastevent'][_0xdd34('0x69')]()+']'+_0xdd34('0x6c'),util[_0xdd34('0x5f')](_0x4da6f7,{'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 e348de3..3bc4a36 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 _0xd41f=['log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','md5','./util','moment','ioredis','bluebird','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','then','seconds','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var rp=require(_0xfd41('0x0'));var md5=require(_0xfd41('0x1'));var util=require('util');var intUtil=require(_0xfd41('0x2'));var moment=require(_0xfd41('0x3'));var Redis=require(_0xfd41('0x4'));var BPromise=require(_0xfd41('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0xfd41('0x6')]=_['defaults'](config[_0xfd41('0x6')],{'host':_0xfd41('0x7'),'port':0x18eb});var io=require(_0xfd41('0x8'))(new Redis(config[_0xfd41('0x6')]));function emit(_0x5e9bf2,_0x898a79,_0xa0fd71){io['to'](_0x5e9bf2)[_0xfd41('0x9')](_0x898a79,_0xa0fd71);}function request(_0x4fdd6f){logger[_0xfd41('0xa')](_0xfd41('0xb'),JSON['stringify'](_0x4fdd6f));return rp(_0x4fdd6f);}function getCustomFields(_0x5037d8,_0x5368f0){var _0x59f7bd={};if(_0x5037d8[_0xfd41('0xc')]>0x0){_['forEach'](_0x5037d8,function(_0x5b5dd6){if(_[_0xfd41('0xd')]([_0xfd41('0xe'),'picklist'],_0x5b5dd6[_0xfd41('0xf')])&&_0x5b5dd6['idField']){_0x59f7bd[_0x5b5dd6['idField']]=_0x5b5dd6[_0xfd41('0x10')][_0xfd41('0x11')]();}else if(_0x5b5dd6['type']===_0xfd41('0x12')&&_0x5b5dd6[_0xfd41('0x13')]&&_0x5b5dd6[_0xfd41('0x14')]&&_0x5368f0[_0x5b5dd6[_0xfd41('0x13')]]){_0x59f7bd[_0x5b5dd6[_0xfd41('0x14')]]=_0x5368f0[_0x5b5dd6[_0xfd41('0x13')]][_0xfd41('0x11')]();}else if(_0x5b5dd6[_0xfd41('0xf')]===_0xfd41('0x15')&&_0x5b5dd6[_0xfd41('0x16')]&&_0x5b5dd6['Variable'][_0xfd41('0x17')]&&_0x5b5dd6[_0xfd41('0x14')]&&_0x5368f0[_0x5b5dd6['Variable'][_0xfd41('0x17')][_0xfd41('0x18')]()]){_0x59f7bd[_0x5b5dd6[_0xfd41('0x14')]]=_0x5368f0[_0x5b5dd6['Variable'][_0xfd41('0x17')][_0xfd41('0x18')]()][_0xfd41('0x11')]();}});}return _0x59f7bd;}function getName(_0x3401b4){if(_0x3401b4[_0xfd41('0x19')]('\x20')>0x0){var _0x810f0c=_0x3401b4[_0xfd41('0x1a')](/ (.+)/);if(_0x810f0c[0x1]){return _0x810f0c;}}return[_0x3401b4,_0x3401b4];}var accountsTokens={};function getAccessToken(_0x542863){return new Promise(function(_0x24a367,_0x51cb26){if(!_[_0xfd41('0x1b')](accountsTokens[_0x542863['id']])&&!_[_0xfd41('0x1b')](accountsTokens[_0x542863['id']]['access_token'])){if(moment()[_0xfd41('0x1c')](accountsTokens[_0x542863['id']][_0xfd41('0x1d')])){_0x24a367(accountsTokens[_0x542863['id']][_0xfd41('0x1e')]);}}var _0x595728;switch(_0x542863[_0xfd41('0x1f')]){case'US':_0x595728=_0xfd41('0x20');break;case'AU':_0x595728=_0xfd41('0x21');break;case'EU':_0x595728=_0xfd41('0x22');break;case'IN':_0x595728=_0xfd41('0x23');break;case'CN':_0x595728=_0xfd41('0x24');break;default:_0x595728=_0xfd41('0x22');break;}var _0x18ec63={'method':_0xfd41('0x25'),'uri':_0x595728+_0xfd41('0x26'),'qs':{'refresh_token':_0x542863['refreshToken'],'client_id':_0x542863['clientId'],'client_secret':_0x542863[_0xfd41('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x18ec63)[_0xfd41('0x28')](function(_0x238c5f){accountsTokens[_0x542863['id']]={'access_token':_0x238c5f['access_token'],'expires_in':moment()['add'](_0x238c5f[_0xfd41('0x1d')],_0xfd41('0x29'))};_0x24a367(_0x238c5f['access_token']);})['catch'](function(_0x46a0c0){logger['error']('Failing\x20creating\x20the\x20access_token',_0x46a0c0[_0xfd41('0x2a')]);_0x51cb26(_0x46a0c0);});});}function getUser(_0x4b450c,_0x25d658,_0x50d435,_0x338658){logger[_0xfd41('0x2b')]('Search\x20user');return request({'method':_0xfd41('0x2c'),'uri':util[_0xfd41('0x2d')](_0xfd41('0x2e'),_0x25d658),'qs':{'type':_0xfd41('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4b450c},'json':!![]})[_0xfd41('0x28')](function(_0x3be7d6){if(_0x3be7d6['users']){var _0x114d43=-0x1;if(_[_0xfd41('0x30')](_0x3be7d6[_0xfd41('0x31')])){if(!_[_0xfd41('0x1b')](_0x338658)){_0x114d43=_[_0xfd41('0x32')](_0x3be7d6['users'],function(_0x29809e){return _0x29809e[_0xfd41('0x33')]===_0x338658;});}if(_0x114d43>=0x0){logger['info'](_0xfd41('0x34'));}else{logger['info'](_0xfd41('0x35'));_0x114d43=_[_0xfd41('0x32')](_0x3be7d6[_0xfd41('0x31')],function(_0x4e2f7a){return _0x4e2f7a[_0xfd41('0x36')][_0xfd41('0x17')]===_0xfd41('0x37');});}return _0x3be7d6[_0xfd41('0x31')][_0x114d43];}else{if(_0x3be7d6[_0xfd41('0x38')][_0xfd41('0x36')]['name']===_0xfd41('0x37')){logger[_0xfd41('0x2b')](_0xfd41('0x35'));user=_0x3be7d6[_0xfd41('0x38')];return user;}else{logger[_0xfd41('0x39')](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](_0x3be7d6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x3be7d6));}}}else{logger['error'](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](_0x3be7d6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfd41('0x3b')](_0x3be7d6));}})[_0xfd41('0x3c')](function(_0x18ac43){console[_0xfd41('0x39')](_0x18ac43);});}function getZohoUser(_0x2817fb,_0x3caaf5){return new BPromise(function(_0x1b2f92,_0x1e0a68){request(_0x2817fb)['then'](function(_0x2a5a75){var _0x1169e3=null;if(_0x2a5a75){_0x1169e3=_0x2a5a75[_0xfd41('0x3d')][0x0];_0x1169e3[_0xfd41('0x3e')]=_0x3caaf5;}_0x1b2f92(_0x1169e3);})[_0xfd41('0x3c')](function(_0x179538){_0x1e0a68(_0x179538);});});}function createEndUser(_0x2aaa40,_0x51e01b,_0x1f2bd4,_0x25926d,_0x12ac4c,_0xb9f30){var _0x1f2bd4=getName(_0x1f2bd4);return request({'method':_0xfd41('0x25'),'uri':_0xfd41('0x3f')+_0x51e01b+_0xfd41('0x40')+_[_0xfd41('0x41')](_0xb9f30[_0xfd41('0x42')])+'s','body':{'data':[{'Last_Name':_0x1f2bd4[0x1],'First_Name':_0x1f2bd4[0x0],'Phone':_0x25926d,'Owner':{'name':!_[_0xfd41('0x1b')](_0x12ac4c[_0xfd41('0x43')]['name'])?_0x12ac4c[_0xfd41('0x43')]['name']:!_[_0xfd41('0x1b')](_0x12ac4c[_0xfd41('0x44')])?_0x12ac4c[_0xfd41('0x44')]+'\x20'+_0x12ac4c['last_name']:_0x12ac4c[_0xfd41('0x45')],'id':_0x12ac4c['id']}}]},'headers':{'Authorization':_0xfd41('0x46')+_0x2aaa40},'json':!![]})[_0xfd41('0x28')](function(_0x55f713){if(_0x55f713&&_0x55f713['data'][0x0][_0xfd41('0x47')]===_0xfd41('0x48')){var _0x56c494=_0x55f713[_0xfd41('0x3d')][0x0][_0xfd41('0x49')];_0x56c494[_0xfd41('0x3e')]=_[_0xfd41('0x41')](_0xb9f30[_0xfd41('0x42')])+'s';return _0x56c494;}logger[_0xfd41('0x39')](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](data));throw new Error(_0xfd41('0x4a')+JSON[_0xfd41('0x3b')](data));})[_0xfd41('0x3c')](function(_0x546f9d){console[_0xfd41('0x4b')](_0xfd41('0x4c'),_0x546f9d);});}function getEndUser(_0x1e74ce,_0x37256d,_0x472b4e,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459){var _0x4356eb={'method':_0xfd41('0x2c'),'uri':'','headers':{'Authorization':_0xfd41('0x46')+_0x1e74ce},'json':!![]};switch(_0x3e4459[_0xfd41('0x4d')]){case _0xfd41('0x4e'):_0x4356eb['uri']=_0xfd41('0x3f')+_0x37256d+_0xfd41('0x4f')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x50'))['then'](function(_0x3a1113){if(_0x3a1113)return _0x3a1113;_0x4356eb[_0xfd41('0x51')]='https://www.zohoapis.'+_0x37256d+_0xfd41('0x52')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,'Leads')[_0xfd41('0x28')](function(_0x591958){if(_0x591958)return _0x591958;if(_0x3e4459[_0xfd41('0x42')]!=_0xfd41('0x53')){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});});break;case _0xfd41('0x54'):_0x4356eb['uri']=_0xfd41('0x3f')+_0x37256d+_0xfd41('0x4f')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x50'))['then'](function(_0x228c74){if(_0x228c74)return _0x228c74;if(_0x3e4459[_0xfd41('0x42')]!=_0xfd41('0x53')){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});break;case _0xfd41('0x55'):_0x4356eb[_0xfd41('0x51')]='https://www.zohoapis.'+_0x37256d+_0xfd41('0x52')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x56'))[_0xfd41('0x28')](function(_0x461323){if(_0x461323)return _0x461323;if(_0x3e4459['moduleCreate']!='nothing'){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});break;}}function getCall(_0x53161f,_0x1d383b,_0x3008ae,_0x46adec,_0x1a3944,_0x3d5500,_0x1fb12e,_0x2abe48){logger[_0xfd41('0x2b')](_0xfd41('0x57'));var _0x5baf8a={};_0x5baf8a[_0xfd41('0x58')]={'name':!_[_0xfd41('0x1b')](_0x46adec[_0xfd41('0x43')]['name'])&&!_['isNil'](_0x46adec['profile'][_0xfd41('0x17')])&&_0x46adec[_0xfd41('0x36')][_0xfd41('0x17')]==='administrator'?_0x46adec[_0xfd41('0x43')][_0xfd41('0x17')]:!_['isNil'](_0x46adec[_0xfd41('0x44')])?_0x46adec[_0xfd41('0x44')]+'\x20'+_0x46adec[_0xfd41('0x45')]:_0x46adec[_0xfd41('0x45')],'id':_0x46adec['id']};_0x5baf8a['Subject']=intUtil[_0xfd41('0x59')](_0x3d5500[_0xfd41('0x5a')],_0x1fb12e,'\x20');_0x5baf8a['Description']=intUtil[_0xfd41('0x59')](_0x3d5500[_0xfd41('0x5b')],_0x1fb12e,'\x0a');if(_0x1a3944[_0xfd41('0x3e')]===_0xfd41('0x50')){_0x5baf8a[_0xfd41('0x5c')]={'name':!_[_0xfd41('0x1b')](_0x1a3944[_0xfd41('0x5d')])?_0x1a3944[_0xfd41('0x5d')]:!_['isNil'](_0x1a3944[_0xfd41('0x5e')])?_0x1a3944['First_Name']+'\x20'+_0x1a3944['Last_Name']:_0x1a3944[_0xfd41('0x5f')],'id':_0x1a3944['id']};}if(_0x1a3944['enduserType']===_0xfd41('0x56')){_0x5baf8a[_0xfd41('0x60')]={'name':!_[_0xfd41('0x1b')](_0x1a3944['Full_Name'])?_0x1a3944[_0xfd41('0x5d')]:!_[_0xfd41('0x1b')](_0x1a3944[_0xfd41('0x5e')])?_0x1a3944[_0xfd41('0x5e')]+'\x20'+_0x1a3944[_0xfd41('0x5f')]:_0x1a3944['Last_Name'],'id':_0x1a3944['id']};_0x5baf8a[_0xfd41('0x61')]=_['startCase'](_0x1a3944['enduserType']);}if(_0x1fb12e[_0xfd41('0x62')]){_0x5baf8a[_0xfd41('0x63')]=moment[_0xfd41('0x64')](parseInt(_0x1fb12e[_0xfd41('0x62')])*0x3e8)[_0xfd41('0x2d')]('mm:ss');}else if(_0x1fb12e[_0xfd41('0x65')]&&_0x1fb12e[_0xfd41('0x66')]){_0x5baf8a[_0xfd41('0x63')]=moment[_0xfd41('0x64')](moment(_0x1fb12e['endtime'],_0xfd41('0x67'))[_0xfd41('0x68')](moment(_0x1fb12e[_0xfd41('0x69')],_0xfd41('0x67'))))[_0xfd41('0x2d')]('mm:ss');}switch(_0x1fb12e['lastevent']){case _0xfd41('0x6a'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x6c');break;case _0xfd41('0x6d'):case _0xfd41('0x6e'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x6f');break;case _0xfd41('0x70'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x71');break;case _0xfd41('0x72'):_0x5baf8a['Call_Result']=_0xfd41('0x73');break;case _0xfd41('0x74'):_0x5baf8a['Call_Result']=_0xfd41('0x75');default:}_0x5baf8a[_0xfd41('0x76')]=(_0x2abe48==='outbound'?moment(_0x1fb12e[_0xfd41('0x69')])[_0xfd41('0x2d')](_0xfd41('0x67')):moment(_0x1fb12e[_0xfd41('0x77')])['format'](_0xfd41('0x67')))||moment()[_0xfd41('0x2d')](_0xfd41('0x67'));_0x5baf8a[_0xfd41('0x78')]=_0x2abe48||_0xfd41('0x79');_0x5baf8a=_[_0xfd41('0x7a')](_0x5baf8a,getCustomFields(_0x3d5500['Fields'],_0x1fb12e));return request({'method':'POST','uri':_0xfd41('0x3f')+_0x1d383b+_0xfd41('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53161f},'body':{'data':[_0x5baf8a]},'json':!![]})['then'](function(_0x38657d){if(_0x38657d&&_0x38657d['data'][0x0]['code']===_0xfd41('0x48')){logger[_0xfd41('0x2b')](_0xfd41('0x7c'));return{'id':_0x38657d[_0xfd41('0x3d')][0x0]['details']['id']};}})[_0xfd41('0x3c')](function(_0x3f07ff){logger[_0xfd41('0x2b')]('err',_0x3f07ff['stack']);console[_0xfd41('0x4b')](_0xfd41('0x7d'),_0x3f07ff);});}exports[_0xfd41('0x7e')]=function(_0x5c7cd3,_0x55cdf2,_0x1053a8,_0x15e073,_0x2a8ce8,_0x46d97c){var _0x291b77,_0x32a55d,_0x3cbfa2;_0x46d97c[_0xfd41('0x7f')]=intUtil[_0xfd41('0x80')](_0x46d97c[_0xfd41('0x7f')]);_0x46d97c[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0x46d97c['serverUrl']);if(_0x2a8ce8&&_0x2a8ce8[_0xfd41('0x82')]){logger['info']('[QUEUE]',_0xfd41('0x83'));_0x55cdf2[_0xfd41('0x84')]=_0x46d97c[_0xfd41('0x81')]+'/api/voice/recordings/'+_0x55cdf2[_0xfd41('0x85')]+_0xfd41('0x86')+md5(_0x55cdf2['uniqueid']);}else{_0x55cdf2[_0xfd41('0x84')]='';}var _0x304825=_0x46d97c[_0xfd41('0x7f')]===_0xfd41('0x87')?'eu':_0xfd41('0x88');return getAccessToken(_0x46d97c)[_0xfd41('0x28')](function(_0xb701e5){_0x3cbfa2=_0xb701e5;return getUser(_0x3cbfa2,_0x304825,_0x46d97c,_0x15e073[_0xfd41('0x33')]);})[_0xfd41('0x28')](function(_0x2cc6e8){_0x291b77=_0x2cc6e8;logger[_0xfd41('0x2b')](_0xfd41('0x89'),_0x291b77['id']);return getEndUser(_0x3cbfa2,_0x304825,_0x46d97c,_0x55cdf2[_0xfd41('0x8a')],_0x55cdf2[_0xfd41('0x8b')],_0x291b77,_0x1053a8);})[_0xfd41('0x28')](function(_0x2a833e){_0x32a55d=_0x2a833e;return getCall(_0x3cbfa2,_0x304825,_0x46d97c,_0x291b77,_0x32a55d,_0x1053a8,_0x55cdf2,_0xfd41('0x79'));})['then'](function(_0x30a778){if(_0x30a778){logger['info'](_0xfd41('0x8c'),_0x30a778['id']);logger[_0xfd41('0x2b')](_0xfd41('0x8d'),_0xfd41('0x8e'));emit(util[_0xfd41('0x2d')](_0xfd41('0x8f'),_0x15e073[_0xfd41('0x17')]),'trigger:browser:url',{'uri':_0xfd41('0x90')+_0x46d97c[_0xfd41('0x7f')]+_0xfd41('0x91')+_0x30a778['id']});}})[_0xfd41('0x3c')](function(_0x5b8c19){logger[_0xfd41('0x39')](_0xfd41('0x8d'),JSON[_0xfd41('0x3b')](_0x5b8c19));});};exports[_0xfd41('0x92')]=function(_0x25c9ba,_0x7b2989,_0x21bcdf,_0x41cda3,_0x58b845,_0x119378,_0x36e902){var _0x202bb4,_0x54cf83,_0x5a0bc9;_0x119378['host']=intUtil[_0xfd41('0x80')](_0x119378[_0xfd41('0x7f')]);_0x119378[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0x119378['serverUrl']);if(_0x36e902&&_0x36e902['recordingFormat']&&_0x36e902[_0xfd41('0x93')]!==_0xfd41('0x94')){logger[_0xfd41('0x2b')](_0xfd41('0x95'),_0xfd41('0x83'));_0x7b2989[_0xfd41('0x84')]=_0x119378[_0xfd41('0x81')]+_0xfd41('0x96')+_0x7b2989[_0xfd41('0x85')]+_0xfd41('0x86')+md5(_0x7b2989['uniqueid']);}var _0x4eed12=_0x119378['host']===_0xfd41('0x87')?'eu':_0xfd41('0x88');return getAccessToken(_0x119378)[_0xfd41('0x28')](function(_0x3d9aa0){_0x5a0bc9=_0x3d9aa0;return getUser(_0x5a0bc9,_0x4eed12,_0x119378,_0x41cda3['email']);})[_0xfd41('0x28')](function(_0x380866){_0x202bb4=_0x380866;logger[_0xfd41('0x2b')]('The\x20User\x20ID\x20is:',_0x202bb4['id']);return getEndUser(_0x5a0bc9,_0x4eed12,_0x119378,_0x7b2989[_0xfd41('0x97')],_0x7b2989[_0xfd41('0x98')],_0x202bb4,_0x21bcdf);})[_0xfd41('0x28')](function(_0x5a7613){_0x54cf83=_0x5a7613;return getCall(_0x5a0bc9,_0x4eed12,_0x119378,_0x202bb4,_0x54cf83,_0x21bcdf,_0x7b2989,_0xfd41('0x99'));})[_0xfd41('0x28')](function(_0x15224e){if(_0x15224e){logger[_0xfd41('0x2b')](_0xfd41('0x8c'),_0x15224e['id']);logger['info'](_0xfd41('0x95'),_0xfd41('0x8e'));emit(util[_0xfd41('0x2d')](_0xfd41('0x8f'),_0x41cda3[_0xfd41('0x17')]),_0xfd41('0x9a'),{'uri':_0xfd41('0x90')+_0x119378[_0xfd41('0x7f')]+_0xfd41('0x91')+_0x15224e['id']});}})[_0xfd41('0x3c')](function(_0x3796ce){logger[_0xfd41('0x39')](_0xfd41('0x95'),JSON[_0xfd41('0x3b')](_0x3796ce));});};exports[_0xfd41('0x9b')]=function(_0x23f1e2,_0x46f0a9,_0x2729f2,_0x116e0c,_0x3d126b,_0xa97db4){var _0x1cf542,_0x1a3194,_0x4a5d02;_0xa97db4[_0xfd41('0x7f')]=intUtil[_0xfd41('0x80')](_0xa97db4['host']);_0xa97db4[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0xa97db4[_0xfd41('0x81')]);if(_0x3d126b&&_0x3d126b[_0xfd41('0x82')]){logger[_0xfd41('0x2b')]('['+_0x46f0a9[_0xfd41('0x9c')][_0xfd41('0x9d')]()+']','Recording\x20is\x20enabled!');_0x46f0a9[_0xfd41('0x84')]=_0xa97db4[_0xfd41('0x81')]+_0xfd41('0x96')+_0x46f0a9['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x46f0a9[_0xfd41('0x85')]);}else{_0x46f0a9[_0xfd41('0x84')]='';}var _0x2e54d4=_0xa97db4[_0xfd41('0x7f')]==='zoho.eu'?'eu':_0xfd41('0x88');return getAccessToken(_0xa97db4)['then'](function(_0xaa2c62){_0x4a5d02=_0xaa2c62;return getUser(_0x4a5d02,_0x2e54d4,_0xa97db4);})[_0xfd41('0x28')](function(_0x54e74d){_0x1cf542=_0x54e74d;logger[_0xfd41('0x2b')](_0xfd41('0x89'),_0x1cf542['id']);return getEndUser(_0x4a5d02,_0x2e54d4,_0xa97db4,_0x46f0a9[_0xfd41('0x8a')],_0x46f0a9[_0xfd41('0x8b')],_0x1cf542,_0x2729f2);})['then'](function(_0x48b989){_0x1a3194=_0x48b989;return getCall(_0x4a5d02,_0x2e54d4,_0xa97db4,_0x1cf542,_0x1a3194,_0x2729f2,_0x46f0a9,'Inbound');})[_0xfd41('0x28')](function(_0x236729){if(_0x236729){logger['info'](_0xfd41('0x8c'),_0x236729['id']);}})[_0xfd41('0x3c')](function(_0x3dcfa9){logger[_0xfd41('0x39')]('['+_0x46f0a9[_0xfd41('0x9c')][_0xfd41('0x9d')]()+']',JSON[_0xfd41('0x3b')](_0x3dcfa9));});}; \ No newline at end of file +var _0xe845=['profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','role','first_name','last_name','code','details','startCase','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','https://www.zohoapis.','Contacts','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','Call_Duration','talktime','mm:ss','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','https://crm.','unmanaged','toUpperCase','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','picklist','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','access_token','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator'];(function(_0x3e5116,_0x214c7f){var _0x218bdf=function(_0x25374d){while(--_0x25374d){_0x3e5116['push'](_0x3e5116['shift']());}};_0x218bdf(++_0x214c7f);}(_0xe845,0x101));var _0x5e84=function(_0x280ee2,_0x33e8d5){_0x280ee2=_0x280ee2-0x0;var _0x558bc3=_0xe845[_0x280ee2];return _0x558bc3;};'use strict';var _=require('lodash');var rp=require(_0x5e84('0x0'));var md5=require('md5');var util=require(_0x5e84('0x1'));var intUtil=require(_0x5e84('0x2'));var moment=require(_0x5e84('0x3'));var Redis=require(_0x5e84('0x4'));var BPromise=require(_0x5e84('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5e84('0x6'))('zoho');config[_0x5e84('0x7')]=_[_0x5e84('0x8')](config[_0x5e84('0x7')],{'host':_0x5e84('0x9'),'port':0x18eb});var io=require(_0x5e84('0xa'))(new Redis(config['redis']));function emit(_0x1a2437,_0x319cb3,_0x331588){io['to'](_0x1a2437)[_0x5e84('0xb')](_0x319cb3,_0x331588);}function request(_0x38c274){logger[_0x5e84('0xc')]('[HTTP]',JSON[_0x5e84('0xd')](_0x38c274));return rp(_0x38c274);}function getCustomFields(_0x31bc2e,_0x5b1c98){var _0x425738={};if(_0x31bc2e[_0x5e84('0xe')]>0x0){_[_0x5e84('0xf')](_0x31bc2e,function(_0x3dd408){if(_[_0x5e84('0x10')]([_0x5e84('0x11'),_0x5e84('0x12')],_0x3dd408[_0x5e84('0x13')])&&_0x3dd408['idField']){_0x425738[_0x3dd408['idField']]=_0x3dd408[_0x5e84('0x14')][_0x5e84('0x15')]();}else if(_0x3dd408[_0x5e84('0x13')]===_0x5e84('0x16')&&_0x3dd408[_0x5e84('0x17')]&&_0x3dd408[_0x5e84('0x18')]&&_0x5b1c98[_0x3dd408[_0x5e84('0x17')]]){_0x425738[_0x3dd408[_0x5e84('0x18')]]=_0x5b1c98[_0x3dd408[_0x5e84('0x17')]][_0x5e84('0x15')]();}else if(_0x3dd408[_0x5e84('0x13')]===_0x5e84('0x19')&&_0x3dd408[_0x5e84('0x1a')]&&_0x3dd408[_0x5e84('0x1a')][_0x5e84('0x1b')]&&_0x3dd408['idField']&&_0x5b1c98[_0x3dd408[_0x5e84('0x1a')]['name'][_0x5e84('0x1c')]()]){_0x425738[_0x3dd408[_0x5e84('0x18')]]=_0x5b1c98[_0x3dd408[_0x5e84('0x1a')][_0x5e84('0x1b')][_0x5e84('0x1c')]()][_0x5e84('0x15')]();}});}return _0x425738;}function getName(_0x5a75f6){if(_0x5a75f6[_0x5e84('0x1d')]('\x20')>0x0){var _0x807842=_0x5a75f6[_0x5e84('0x1e')](/ (.+)/);if(_0x807842[0x1]){return _0x807842;}}return[_0x5a75f6,_0x5a75f6];}var accountsTokens={};function getAccessToken(_0x341889){return new Promise(function(_0x4bb679,_0x6c14d5){if(!_[_0x5e84('0x1f')](accountsTokens[_0x341889['id']])&&!_['isNil'](accountsTokens[_0x341889['id']]['access_token'])){if(moment()[_0x5e84('0x20')](accountsTokens[_0x341889['id']]['expires_in'])){_0x4bb679(accountsTokens[_0x341889['id']][_0x5e84('0x21')]);}}var _0x30a5cc;switch(_0x341889[_0x5e84('0x22')]){case'US':_0x30a5cc='https://accounts.zoho.com';break;case'AU':_0x30a5cc='https://accounts.zoho.com.au';break;case'EU':_0x30a5cc=_0x5e84('0x23');break;case'IN':_0x30a5cc=_0x5e84('0x24');break;case'CN':_0x30a5cc=_0x5e84('0x25');break;default:_0x30a5cc=_0x5e84('0x23');break;}var _0x3e0b0d={'method':_0x5e84('0x26'),'uri':_0x30a5cc+_0x5e84('0x27'),'qs':{'refresh_token':_0x341889[_0x5e84('0x28')],'client_id':_0x341889[_0x5e84('0x29')],'client_secret':_0x341889[_0x5e84('0x2a')],'grant_type':_0x5e84('0x2b')},'json':!![]};return rp(_0x3e0b0d)[_0x5e84('0x2c')](function(_0x2c34fe){accountsTokens[_0x341889['id']]={'access_token':_0x2c34fe['access_token'],'expires_in':moment()[_0x5e84('0x2d')](_0x2c34fe[_0x5e84('0x2e')],'seconds')};_0x4bb679(_0x2c34fe[_0x5e84('0x21')]);})[_0x5e84('0x2f')](function(_0x5cd025){logger[_0x5e84('0x30')](_0x5e84('0x31'),_0x5cd025[_0x5e84('0x32')]);_0x6c14d5(_0x5cd025);});});}function getUser(_0x193d17,_0x115667,_0xa1bcc4,_0x293cd2){logger['info'](_0x5e84('0x33'));return request({'method':_0x5e84('0x34'),'uri':util[_0x5e84('0x35')](_0x5e84('0x36'),_0x115667),'qs':{'type':_0x5e84('0x37')},'headers':{'Authorization':_0x5e84('0x38')+_0x193d17},'json':!![]})[_0x5e84('0x2c')](function(_0x1f0542){if(_0x1f0542[_0x5e84('0x39')]){var _0x27be3b=-0x1;if(_[_0x5e84('0x3a')](_0x1f0542[_0x5e84('0x39')])){if(!_[_0x5e84('0x1f')](_0x293cd2)){_0x27be3b=_['findIndex'](_0x1f0542['users'],function(_0x4e980f){return _0x4e980f['email']===_0x293cd2;});}if(_0x27be3b>=0x0){logger[_0x5e84('0x3b')](_0x5e84('0x3c'));}else{logger[_0x5e84('0x3b')](_0x5e84('0x3d'));_0x27be3b=_['findIndex'](_0x1f0542[_0x5e84('0x39')],function(_0x5233f4){return _0x5233f4['profile']['name']===_0x5e84('0x3e');});}return _0x1f0542[_0x5e84('0x39')][_0x27be3b];}else{if(_0x1f0542['user'][_0x5e84('0x3f')][_0x5e84('0x1b')]===_0x5e84('0x3e')){logger[_0x5e84('0x3b')](_0x5e84('0x3d'));user=_0x1f0542['user'];return user;}else{logger[_0x5e84('0x30')](_0x5e84('0x40'),JSON[_0x5e84('0xd')](_0x1f0542));throw new Error(_0x5e84('0x41')+JSON[_0x5e84('0xd')](_0x1f0542));}}}else{logger['error'](_0x5e84('0x40'),JSON[_0x5e84('0xd')](_0x1f0542));throw new Error(_0x5e84('0x41')+JSON[_0x5e84('0xd')](_0x1f0542));}})['catch'](function(_0x5829b5){console['error'](_0x5829b5);});}function getZohoUser(_0x9a6dc5,_0x529a70){return new BPromise(function(_0x2436c,_0x3f7230){request(_0x9a6dc5)[_0x5e84('0x2c')](function(_0x371af0){var _0x2de774=null;if(_0x371af0){_0x2de774=_0x371af0[_0x5e84('0x42')][0x0];_0x2de774[_0x5e84('0x43')]=_0x529a70;}_0x2436c(_0x2de774);})[_0x5e84('0x2f')](function(_0x1e7ceb){_0x3f7230(_0x1e7ceb);});});}function createEndUser(_0x53965b,_0x48ea23,_0x5c9e32,_0x15155c,_0x32eaad,_0x2be375){var _0x5c9e32=getName(_0x5c9e32);return request({'method':_0x5e84('0x26'),'uri':'https://www.zohoapis.'+_0x48ea23+_0x5e84('0x44')+_['startCase'](_0x2be375['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5c9e32[0x1],'First_Name':_0x5c9e32[0x0],'Phone':_0x15155c,'Owner':{'name':!_[_0x5e84('0x1f')](_0x32eaad[_0x5e84('0x45')]['name'])?_0x32eaad[_0x5e84('0x45')][_0x5e84('0x1b')]:!_[_0x5e84('0x1f')](_0x32eaad[_0x5e84('0x46')])?_0x32eaad[_0x5e84('0x46')]+'\x20'+_0x32eaad[_0x5e84('0x47')]:_0x32eaad[_0x5e84('0x47')],'id':_0x32eaad['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53965b},'json':!![]})[_0x5e84('0x2c')](function(_0x562938){if(_0x562938&&_0x562938[_0x5e84('0x42')][0x0][_0x5e84('0x48')]==='SUCCESS'){var _0x398b1e=_0x562938[_0x5e84('0x42')][0x0][_0x5e84('0x49')];_0x398b1e[_0x5e84('0x43')]=_[_0x5e84('0x4a')](_0x2be375[_0x5e84('0x4b')])+'s';return _0x398b1e;}logger[_0x5e84('0x30')](_0x5e84('0x40'),JSON[_0x5e84('0xd')](data));throw new Error('Error:\x20'+JSON[_0x5e84('0xd')](data));})[_0x5e84('0x2f')](function(_0x31f8a4){console[_0x5e84('0x4c')](_0x5e84('0x4d'),_0x31f8a4);});}function getEndUser(_0x2bc6e4,_0x323753,_0x801832,_0x3be09c,_0x426362,_0x45edd1,_0x5c2cf6){var _0x3ce15d={'method':_0x5e84('0x34'),'uri':'','headers':{'Authorization':_0x5e84('0x38')+_0x2bc6e4},'json':!![]};switch(_0x5c2cf6[_0x5e84('0x4e')]){case _0x5e84('0x4f'):_0x3ce15d[_0x5e84('0x50')]='https://www.zohoapis.'+_0x323753+_0x5e84('0x51')+_0x426362+'))';return getZohoUser(_0x3ce15d,'Contacts')[_0x5e84('0x2c')](function(_0x474f71){if(_0x474f71)return _0x474f71;_0x3ce15d[_0x5e84('0x50')]='https://www.zohoapis.'+_0x323753+_0x5e84('0x52')+_0x426362+'))';return getZohoUser(_0x3ce15d,'Leads')[_0x5e84('0x2c')](function(_0x4aca28){if(_0x4aca28)return _0x4aca28;if(_0x5c2cf6[_0x5e84('0x4b')]!=_0x5e84('0x53')){return createEndUser(_0x2bc6e4,_0x323753,_0x3be09c,_0x426362,_0x45edd1,_0x5c2cf6);}else{return{};}});});break;case _0x5e84('0x54'):_0x3ce15d[_0x5e84('0x50')]=_0x5e84('0x55')+_0x323753+_0x5e84('0x51')+_0x426362+'))';return getZohoUser(_0x3ce15d,_0x5e84('0x56'))[_0x5e84('0x2c')](function(_0x567744){if(_0x567744)return _0x567744;if(_0x5c2cf6['moduleCreate']!=_0x5e84('0x53')){return createEndUser(_0x2bc6e4,_0x323753,_0x3be09c,_0x426362,_0x45edd1,_0x5c2cf6);}else{return{};}});break;case'lead':_0x3ce15d[_0x5e84('0x50')]=_0x5e84('0x55')+_0x323753+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x426362+'))';return getZohoUser(_0x3ce15d,'Leads')['then'](function(_0x1e3777){if(_0x1e3777)return _0x1e3777;if(_0x5c2cf6[_0x5e84('0x4b')]!=_0x5e84('0x53')){return createEndUser(_0x2bc6e4,_0x323753,_0x3be09c,_0x426362,_0x45edd1,_0x5c2cf6);}else{return{};}});break;}}function getCall(_0x11b3db,_0x22353d,_0x51245e,_0x2a7aa7,_0x5527fa,_0x4ae99d,_0x508e55,_0x36dee0){logger[_0x5e84('0x3b')](_0x5e84('0x57'));var _0x418de8={};_0x418de8[_0x5e84('0x58')]={'name':!_[_0x5e84('0x1f')](_0x2a7aa7[_0x5e84('0x45')][_0x5e84('0x1b')])&&!_[_0x5e84('0x1f')](_0x2a7aa7['profile'][_0x5e84('0x1b')])&&_0x2a7aa7[_0x5e84('0x3f')][_0x5e84('0x1b')]===_0x5e84('0x59')?_0x2a7aa7['role'][_0x5e84('0x1b')]:!_['isNil'](_0x2a7aa7[_0x5e84('0x46')])?_0x2a7aa7['first_name']+'\x20'+_0x2a7aa7[_0x5e84('0x47')]:_0x2a7aa7[_0x5e84('0x47')],'id':_0x2a7aa7['id']};_0x418de8[_0x5e84('0x5a')]=intUtil[_0x5e84('0x5b')](_0x4ae99d[_0x5e84('0x5c')],_0x508e55,'\x20');_0x418de8[_0x5e84('0x5d')]=intUtil['getString'](_0x4ae99d[_0x5e84('0x5e')],_0x508e55,'\x0a');if(_0x5527fa['enduserType']===_0x5e84('0x56')){_0x418de8[_0x5e84('0x5f')]={'name':!_['isNil'](_0x5527fa[_0x5e84('0x60')])?_0x5527fa['Full_Name']:!_[_0x5e84('0x1f')](_0x5527fa[_0x5e84('0x61')])?_0x5527fa[_0x5e84('0x61')]+'\x20'+_0x5527fa[_0x5e84('0x62')]:_0x5527fa[_0x5e84('0x62')],'id':_0x5527fa['id']};}if(_0x5527fa[_0x5e84('0x43')]===_0x5e84('0x63')){_0x418de8[_0x5e84('0x64')]={'name':!_[_0x5e84('0x1f')](_0x5527fa[_0x5e84('0x60')])?_0x5527fa[_0x5e84('0x60')]:!_[_0x5e84('0x1f')](_0x5527fa[_0x5e84('0x61')])?_0x5527fa[_0x5e84('0x61')]+'\x20'+_0x5527fa[_0x5e84('0x62')]:_0x5527fa['Last_Name'],'id':_0x5527fa['id']};_0x418de8[_0x5e84('0x65')]=_['startCase'](_0x5527fa['enduserType']);}if(_0x508e55['talktime']){_0x418de8[_0x5e84('0x66')]=moment['utc'](parseInt(_0x508e55[_0x5e84('0x67')])*0x3e8)[_0x5e84('0x35')](_0x5e84('0x68'));}else if(_0x508e55['answertime']&&_0x508e55[_0x5e84('0x69')]){_0x418de8[_0x5e84('0x66')]=moment[_0x5e84('0x6a')](moment(_0x508e55[_0x5e84('0x69')],_0x5e84('0x6b'))[_0x5e84('0x6c')](moment(_0x508e55[_0x5e84('0x6d')],_0x5e84('0x6b'))))[_0x5e84('0x35')](_0x5e84('0x68'));}switch(_0x508e55['lastevent']){case _0x5e84('0x6e'):_0x418de8['Call_Result']=_0x5e84('0x6f');break;case'complete':case _0x5e84('0x70'):_0x418de8[_0x5e84('0x71')]=_0x5e84('0x72');break;case _0x5e84('0x73'):_0x418de8[_0x5e84('0x71')]=_0x5e84('0x74');break;case _0x5e84('0x75'):_0x418de8[_0x5e84('0x71')]='Abandoned';break;case _0x5e84('0x76'):_0x418de8['Call_Result']=_0x5e84('0x77');default:}_0x418de8[_0x5e84('0x78')]=(_0x36dee0==='outbound'?moment(_0x508e55[_0x5e84('0x6d')])[_0x5e84('0x35')](_0x5e84('0x6b')):moment(_0x508e55[_0x5e84('0x79')])[_0x5e84('0x35')](_0x5e84('0x6b')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x418de8[_0x5e84('0x7a')]=_0x36dee0||_0x5e84('0x7b');_0x418de8=_[_0x5e84('0x7c')](_0x418de8,getCustomFields(_0x4ae99d[_0x5e84('0x7d')],_0x508e55));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x22353d+_0x5e84('0x7e'),'headers':{'Authorization':_0x5e84('0x38')+_0x11b3db},'body':{'data':[_0x418de8]},'json':!![]})[_0x5e84('0x2c')](function(_0x1e51ae){if(_0x1e51ae&&_0x1e51ae[_0x5e84('0x42')][0x0][_0x5e84('0x48')]===_0x5e84('0x7f')){logger[_0x5e84('0x3b')](_0x5e84('0x80'));return{'id':_0x1e51ae[_0x5e84('0x42')][0x0][_0x5e84('0x49')]['id']};}})[_0x5e84('0x2f')](function(_0x8e5244){logger['info'](_0x5e84('0x81'),_0x8e5244['stack']);console['log'](_0x5e84('0x81'),_0x8e5244);});}exports[_0x5e84('0x82')]=function(_0x5342ae,_0x5e7540,_0x252d35,_0x3f817d,_0xbf3809,_0x1b7fb2){var _0x4ef64b,_0x4f7b47,_0x3090b3;_0x1b7fb2[_0x5e84('0x83')]=intUtil[_0x5e84('0x84')](_0x1b7fb2['host']);_0x1b7fb2[_0x5e84('0x85')]=intUtil[_0x5e84('0x84')](_0x1b7fb2[_0x5e84('0x85')]);if(_0xbf3809&&_0xbf3809[_0x5e84('0x86')]){logger['info'](_0x5e84('0x87'),_0x5e84('0x88'));_0x5e7540[_0x5e84('0x89')]=_0x1b7fb2['serverUrl']+_0x5e84('0x8a')+_0x5e7540[_0x5e84('0x8b')]+_0x5e84('0x8c')+md5(_0x5e7540[_0x5e84('0x8b')]);}else{_0x5e7540['recordingURL']='';}var _0x3765e9=_0x1b7fb2[_0x5e84('0x83')]===_0x5e84('0x8d')?'eu':_0x5e84('0x8e');return getAccessToken(_0x1b7fb2)[_0x5e84('0x2c')](function(_0x44c462){_0x3090b3=_0x44c462;return getUser(_0x3090b3,_0x3765e9,_0x1b7fb2,_0x3f817d[_0x5e84('0x8f')]);})[_0x5e84('0x2c')](function(_0x1424b1){_0x4ef64b=_0x1424b1;logger[_0x5e84('0x3b')](_0x5e84('0x90'),_0x4ef64b['id']);return getEndUser(_0x3090b3,_0x3765e9,_0x1b7fb2,_0x5e7540[_0x5e84('0x91')],_0x5e7540['calleridnum'],_0x4ef64b,_0x252d35);})[_0x5e84('0x2c')](function(_0x1513fe){_0x4f7b47=_0x1513fe;return getCall(_0x3090b3,_0x3765e9,_0x1b7fb2,_0x4ef64b,_0x4f7b47,_0x252d35,_0x5e7540,'Inbound');})[_0x5e84('0x2c')](function(_0x3bf8ff){if(_0x3bf8ff){logger[_0x5e84('0x3b')]('The\x20Call\x20ID\x20is:',_0x3bf8ff['id']);logger[_0x5e84('0x3b')](_0x5e84('0x87'),_0x5e84('0x92'));emit(util['format'](_0x5e84('0x93'),_0x3f817d['name']),_0x5e84('0x94'),{'uri':'https://crm.'+_0x1b7fb2[_0x5e84('0x83')]+_0x5e84('0x95')+_0x3bf8ff['id']});}})[_0x5e84('0x2f')](function(_0x1c0bd3){logger[_0x5e84('0x30')](_0x5e84('0x87'),JSON[_0x5e84('0xd')](_0x1c0bd3));});};exports[_0x5e84('0x96')]=function(_0x492c6c,_0x21b90e,_0x2ad34c,_0x198ed1,_0x573ce8,_0x213ad1,_0x2befc9){var _0x6b90e8,_0x46ce3d,_0x474499;_0x213ad1[_0x5e84('0x83')]=intUtil[_0x5e84('0x84')](_0x213ad1['host']);_0x213ad1[_0x5e84('0x85')]=intUtil[_0x5e84('0x84')](_0x213ad1[_0x5e84('0x85')]);if(_0x2befc9&&_0x2befc9[_0x5e84('0x97')]&&_0x2befc9[_0x5e84('0x97')]!==_0x5e84('0x98')){logger[_0x5e84('0x3b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x21b90e[_0x5e84('0x89')]=_0x213ad1[_0x5e84('0x85')]+'/api/voice/recordings/'+_0x21b90e[_0x5e84('0x8b')]+_0x5e84('0x8c')+md5(_0x21b90e[_0x5e84('0x8b')]);}var _0x12bd02=_0x213ad1[_0x5e84('0x83')]===_0x5e84('0x8d')?'eu':'com';return getAccessToken(_0x213ad1)[_0x5e84('0x2c')](function(_0x368c64){_0x474499=_0x368c64;return getUser(_0x474499,_0x12bd02,_0x213ad1,_0x198ed1[_0x5e84('0x8f')]);})[_0x5e84('0x2c')](function(_0x2aec11){_0x6b90e8=_0x2aec11;logger[_0x5e84('0x3b')](_0x5e84('0x90'),_0x6b90e8['id']);return getEndUser(_0x474499,_0x12bd02,_0x213ad1,_0x21b90e[_0x5e84('0x99')],_0x21b90e[_0x5e84('0x9a')],_0x6b90e8,_0x2ad34c);})[_0x5e84('0x2c')](function(_0x4d62b5){_0x46ce3d=_0x4d62b5;return getCall(_0x474499,_0x12bd02,_0x213ad1,_0x6b90e8,_0x46ce3d,_0x2ad34c,_0x21b90e,'Outbound');})[_0x5e84('0x2c')](function(_0x47dc6a){if(_0x47dc6a){logger[_0x5e84('0x3b')](_0x5e84('0x9b'),_0x47dc6a['id']);logger[_0x5e84('0x3b')](_0x5e84('0x9c'),_0x5e84('0x92'));emit(util[_0x5e84('0x35')](_0x5e84('0x93'),_0x198ed1['name']),'trigger:browser:url',{'uri':_0x5e84('0x9d')+_0x213ad1[_0x5e84('0x83')]+_0x5e84('0x95')+_0x47dc6a['id']});}})['catch'](function(_0x3265d3){logger[_0x5e84('0x30')](_0x5e84('0x9c'),JSON[_0x5e84('0xd')](_0x3265d3));});};exports[_0x5e84('0x9e')]=function(_0x3318b2,_0x493d5c,_0x3a9fef,_0x37958f,_0x141dbc,_0x4cddc6){var _0x55da86,_0x379d95,_0x4bc03e;_0x4cddc6[_0x5e84('0x83')]=intUtil[_0x5e84('0x84')](_0x4cddc6['host']);_0x4cddc6['serverUrl']=intUtil[_0x5e84('0x84')](_0x4cddc6[_0x5e84('0x85')]);if(_0x141dbc&&_0x141dbc['monitor_format']){logger[_0x5e84('0x3b')]('['+_0x493d5c['lastevent'][_0x5e84('0x9f')]()+']','Recording\x20is\x20enabled!');_0x493d5c[_0x5e84('0x89')]=_0x4cddc6[_0x5e84('0x85')]+_0x5e84('0x8a')+_0x493d5c['uniqueid']+_0x5e84('0x8c')+md5(_0x493d5c[_0x5e84('0x8b')]);}else{_0x493d5c[_0x5e84('0x89')]='';}var _0x35d0a2=_0x4cddc6[_0x5e84('0x83')]===_0x5e84('0x8d')?'eu':'com';return getAccessToken(_0x4cddc6)[_0x5e84('0x2c')](function(_0x5d1112){_0x4bc03e=_0x5d1112;return getUser(_0x4bc03e,_0x35d0a2,_0x4cddc6);})['then'](function(_0x228160){_0x55da86=_0x228160;logger[_0x5e84('0x3b')](_0x5e84('0x90'),_0x55da86['id']);return getEndUser(_0x4bc03e,_0x35d0a2,_0x4cddc6,_0x493d5c['calleridname'],_0x493d5c['calleridnum'],_0x55da86,_0x3a9fef);})[_0x5e84('0x2c')](function(_0x22ca29){_0x379d95=_0x22ca29;return getCall(_0x4bc03e,_0x35d0a2,_0x4cddc6,_0x55da86,_0x379d95,_0x3a9fef,_0x493d5c,_0x5e84('0x7b'));})['then'](function(_0x37a108){if(_0x37a108){logger[_0x5e84('0x3b')](_0x5e84('0x9b'),_0x37a108['id']);}})[_0x5e84('0x2f')](function(_0x5c9207){logger[_0x5e84('0x30')]('['+_0x493d5c['lastevent'][_0x5e84('0x9f')]()+']',JSON[_0x5e84('0xd')](_0x5c9207));});}; \ 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 2c498d3..048b8fb 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 _0x4090=['info','shelljs','mustache','exec','data2','data3','render','format'];(function(_0x5c5399,_0x223bcc){var _0x24d976=function(_0x4e54b7){while(--_0x4e54b7){_0x5c5399['push'](_0x5c5399['shift']());}};_0x24d976(++_0x223bcc);}(_0x4090,0x161));var _0x0409=function(_0x5ec44e,_0x7f4d80){_0x5ec44e=_0x5ec44e-0x0;var _0x50e415=_0x4090[_0x5ec44e];return _0x50e415;};'use strict';var util=require('util');var sh=require(_0x0409('0x0'));var Mustache=require(_0x0409('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x0409('0x2')]=function(_0x3d84b2,_0x192ec4){var _0x1b17c0=_0x3d84b2[_0x0409('0x3')]?_0x3d84b2[_0x0409('0x3')]:'Script';var _0x31fbad=_0x3d84b2[_0x0409('0x4')]?Mustache[_0x0409('0x5')](_0x3d84b2['data3'],_0x192ec4):_0x192ec4;sh[_0x0409('0x2')](_0x31fbad,function(_0x20ae39,_0x9e581d,_0x3d12c8){if(_0x20ae39!==0x0){logger['error'](util[_0x0409('0x6')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1b17c0,_0x31fbad,_0x20ae39,_0x3d12c8));}else{logger[_0x0409('0x7')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1b17c0,_0x31fbad,_0x9e581d));}});}; \ No newline at end of file +var _0x35e8=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x448b29,_0x309b98){var _0x4c8162=function(_0x22380d){while(--_0x22380d){_0x448b29['push'](_0x448b29['shift']());}};_0x4c8162(++_0x309b98);}(_0x35e8,0x16e));var _0x835e=function(_0xf2645b,_0x3c60f1){_0xf2645b=_0xf2645b-0x0;var _0x5b6d70=_0x35e8[_0xf2645b];return _0x5b6d70;};'use strict';var util=require(_0x835e('0x0'));var sh=require(_0x835e('0x1'));var Mustache=require(_0x835e('0x2'));var logger=require('../../../../config/logger')(_0x835e('0x3'));exports[_0x835e('0x4')]=function(_0x135b59,_0x3f3b7e){var _0x428f6d=_0x135b59[_0x835e('0x5')]?_0x135b59[_0x835e('0x5')]:'Script';var _0x5c4bb3=_0x135b59[_0x835e('0x6')]?Mustache[_0x835e('0x7')](_0x135b59['data3'],_0x3f3b7e):_0x3f3b7e;sh[_0x835e('0x4')](_0x5c4bb3,function(_0x553ae6,_0x1e171c,_0x42e07d){if(_0x553ae6!==0x0){logger[_0x835e('0x8')](util[_0x835e('0x9')](_0x835e('0xa'),_0x428f6d,_0x5c4bb3,_0x553ae6,_0x42e07d));}else{logger[_0x835e('0xb')](util[_0x835e('0x9')](_0x835e('0xc'),_0x428f6d,_0x5c4bb3,_0x1e171c));}});}; \ 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 903372d..518ca5d 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 _0xa293=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','data5','headers','error','stack','DELETE','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode'];(function(_0x24005a,_0x50d6f8){var _0x46a0fd=function(_0x24a830){while(--_0x24a830){_0x24005a['push'](_0x24005a['shift']());}};_0x46a0fd(++_0x50d6f8);}(_0xa293,0x7c));var _0x3a29=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa293[_0x4cf98e];return _0x1623ac;};'use strict';var rp=require(_0x3a29('0x0'));var util=require(_0x3a29('0x1'));var _=require(_0x3a29('0x2'));var Mustache=require(_0x3a29('0x3'));var logger=require(_0x3a29('0x4'))('trigger');exports['exec']=function(_0x22be61,_0x2c37dd){var _0x4af031,_0x35491e;var _0x4d6b56={'method':_0x22be61[_0x3a29('0x5')][_0x3a29('0x6')](),'uri':Mustache[_0x3a29('0x7')](_0x22be61[_0x3a29('0x8')],_0x2c37dd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x22be61['data5'])==='number'&&parseInt(_0x22be61['data5'])>=0x1&&parseInt(_0x22be61['data5'])<=0xa?parseInt(_0x22be61[_0x3a29('0x9')])*0x3e8:0x5*0x3e8};try{_0x4d6b56[_0x3a29('0xa')]=_0x22be61['data6']?JSON['parse'](Mustache[_0x3a29('0x7')](_0x22be61['data6'],_0x2c37dd)):{};}catch(_0x33f487){logger[_0x3a29('0xb')](_0x33f487[_0x3a29('0xc')]);}switch(_0x22be61[_0x3a29('0x5')]['toUpperCase']()){case'GET':case _0x3a29('0xd'):_0x4af031=null;_0x4d6b56['qs']=_0x2c37dd;break;case _0x3a29('0xe'):case'PUT':if(_0x22be61[_0x3a29('0xf')]){try{_0x4af031=JSON['parse'](Mustache[_0x3a29('0x7')](_0x22be61['data7'],_0x2c37dd));_0x4d6b56['body']=_0x4af031;}catch(_0x3fb2df){logger[_0x3a29('0xb')](_0x3fb2df[_0x3a29('0xc')]);logger[_0x3a29('0xb')](_0x3a29('0x10'));}}else{_0x4af031=_0x2c37dd;_0x4d6b56[_0x3a29('0x11')]=_0x4af031;}break;}logger[_0x3a29('0x12')](util[_0x3a29('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x22be61[_0x3a29('0x5')],_0x22be61[_0x3a29('0x8')],JSON[_0x3a29('0x14')](_0x4d6b56)));rp(_0x4d6b56)[_0x3a29('0x15')](function(_0x2fd5d6){_0x4af031=!_[_0x3a29('0x16')](_0x4af031)?_0x3a29('0x17')+_0x4af031:'';_0x35491e=typeof _0x2fd5d6['body']===_0x3a29('0x18')?JSON['stringify'](_0x2fd5d6[_0x3a29('0x11')]):_0x2fd5d6[_0x3a29('0x11')];logger['info'](util[_0x3a29('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x22be61[_0x3a29('0x5')],_0x22be61[_0x3a29('0x8')],_0x2fd5d6[_0x3a29('0x19')],_0x35491e));})[_0x3a29('0x1a')](function(_0x1013b1){logger[_0x3a29('0xb')](util['format'](_0x3a29('0x1b'),_0x22be61[_0x3a29('0x5')],_0x22be61['data2'],_0x1013b1[_0x3a29('0x19')],_0x1013b1[_0x3a29('0x1c')],_0x1013b1[_0x3a29('0x1d')]));});}; \ No newline at end of file +var _0xdd9f=['exec','data1','toUpperCase','render','data5','number','headers','data6','error','stack','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then',',\x20request\x20body:\x20','object','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','util','mustache','trigger'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xdd9f,0x78));var _0xfdd9=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xdd9f[_0xbd08b4];return _0x314f1e;};'use strict';var rp=require(_0xfdd9('0x0'));var util=require(_0xfdd9('0x1'));var _=require('lodash');var Mustache=require(_0xfdd9('0x2'));var logger=require('../../../../config/logger')(_0xfdd9('0x3'));exports[_0xfdd9('0x4')]=function(_0x32e381,_0x726265){var _0x49047c,_0x4218de;var _0x543874={'method':_0x32e381[_0xfdd9('0x5')][_0xfdd9('0x6')](),'uri':Mustache[_0xfdd9('0x7')](_0x32e381['data2'],_0x726265),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x32e381[_0xfdd9('0x8')])===_0xfdd9('0x9')&&parseInt(_0x32e381['data5'])>=0x1&&parseInt(_0x32e381[_0xfdd9('0x8')])<=0xa?parseInt(_0x32e381['data5'])*0x3e8:0x5*0x3e8};try{_0x543874[_0xfdd9('0xa')]=_0x32e381[_0xfdd9('0xb')]?JSON['parse'](Mustache['render'](_0x32e381[_0xfdd9('0xb')],_0x726265)):{};}catch(_0x38134c){logger[_0xfdd9('0xc')](_0x38134c[_0xfdd9('0xd')]);}switch(_0x32e381[_0xfdd9('0x5')]['toUpperCase']()){case _0xfdd9('0xe'):case _0xfdd9('0xf'):_0x49047c=null;_0x543874['qs']=_0x726265;break;case'POST':case _0xfdd9('0x10'):if(_0x32e381[_0xfdd9('0x11')]){try{_0x49047c=JSON['parse'](Mustache[_0xfdd9('0x7')](_0x32e381[_0xfdd9('0x11')],_0x726265));_0x543874[_0xfdd9('0x12')]=_0x49047c;}catch(_0x2aaef6){logger[_0xfdd9('0xc')](_0x2aaef6[_0xfdd9('0xd')]);logger[_0xfdd9('0xc')](_0xfdd9('0x13'));}}else{_0x49047c=_0x726265;_0x543874[_0xfdd9('0x12')]=_0x49047c;}break;}logger[_0xfdd9('0x14')](util[_0xfdd9('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x32e381[_0xfdd9('0x5')],_0x32e381[_0xfdd9('0x16')],JSON[_0xfdd9('0x17')](_0x543874)));rp(_0x543874)[_0xfdd9('0x18')](function(_0xbd540b){_0x49047c=!_['isNil'](_0x49047c)?_0xfdd9('0x19')+_0x49047c:'';_0x4218de=typeof _0xbd540b['body']===_0xfdd9('0x1a')?JSON[_0xfdd9('0x17')](_0xbd540b[_0xfdd9('0x12')]):_0xbd540b[_0xfdd9('0x12')];logger[_0xfdd9('0x14')](util[_0xfdd9('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x32e381[_0xfdd9('0x5')],_0x32e381[_0xfdd9('0x16')],_0xbd540b[_0xfdd9('0x1b')],_0x4218de));})[_0xfdd9('0x1c')](function(_0x42cdc6){logger[_0xfdd9('0xc')](util[_0xfdd9('0x15')](_0xfdd9('0x1d'),_0x32e381[_0xfdd9('0x5')],_0x32e381['data2'],_0x42cdc6[_0xfdd9('0x1b')],_0x42cdc6[_0xfdd9('0x1e')],_0x42cdc6['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 99b8a27..bc06ace 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 _0xa6b2=['http','Request','request','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa6b2,0x100));var _0x2a6b=function(_0x483b23,_0x5c6757){_0x483b23=_0x483b23-0x0;var _0xdfed24=_0xa6b2[_0x483b23];return _0xdfed24;};'use strict';var jayson=require(_0x2a6b('0x0'));var BPromise=require('bluebird');var logger=require(_0x2a6b('0x1'))(_0x2a6b('0x2'));var client=jayson[_0x2a6b('0x3')][_0x2a6b('0x4')]({'port':0x2329});client[_0x2a6b('0x5')]=function(_0x3485d1,_0x3c1c69){return new BPromise(function(_0x396dea,_0xd1e3ad){return client[_0x2a6b('0x6')](_0x3485d1,_0x3c1c69)['then'](function(_0x2a7472){logger[_0x2a6b('0x7')](_0x2a6b('0x8'),'routing',_0x3485d1,_0x3c1c69,_0x2a7472);if(_0x2a7472[_0x2a6b('0x9')]){logger[_0x2a6b('0x9')](_0x2a6b('0x8'),_0x2a6b('0x2'),_0x3485d1,_0x2a7472[_0x2a6b('0x9')][_0x2a6b('0xa')],_0x3c1c69);return _0xd1e3ad(_0x2a7472['error'][_0x2a6b('0xa')]);}else{return _0x396dea(_0x2a7472['result']);}})[_0x2a6b('0xb')](function(_0x1fa2d0){logger[_0x2a6b('0x9')](_0x2a6b('0x8'),_0x2a6b('0x2'),_0x3485d1,_0x1fa2d0,_0x3c1c69);return _0xd1e3ad(_0x1fa2d0);});});};module[_0x2a6b('0xc')]=client; \ No newline at end of file +var _0x093e=['routing','client','http','request','debug','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x4fee31,_0x2b2d0a){var _0x1ae270=function(_0x47b1ba){while(--_0x47b1ba){_0x4fee31['push'](_0x4fee31['shift']());}};_0x1ae270(++_0x2b2d0a);}(_0x093e,0x142));var _0xe093=function(_0x57d7f4,_0x45665d){_0x57d7f4=_0x57d7f4-0x0;var _0x2d49da=_0x093e[_0x57d7f4];return _0x2d49da;};'use strict';var jayson=require(_0xe093('0x0'));var BPromise=require(_0xe093('0x1'));var logger=require(_0xe093('0x2'))(_0xe093('0x3'));var client=jayson[_0xe093('0x4')][_0xe093('0x5')]({'port':0x2329});client['Request']=function(_0x20c9a9,_0x4863a9){return new BPromise(function(_0x5dd376,_0x2d1b65){return client[_0xe093('0x6')](_0x20c9a9,_0x4863a9)['then'](function(_0x1a6dea){logger[_0xe093('0x7')](_0xe093('0x8'),_0xe093('0x3'),_0x20c9a9,_0x4863a9,_0x1a6dea);if(_0x1a6dea['error']){logger[_0xe093('0x9')](_0xe093('0x8'),_0xe093('0x3'),_0x20c9a9,_0x1a6dea['error'][_0xe093('0xa')],_0x4863a9);return _0x2d1b65(_0x1a6dea[_0xe093('0x9')][_0xe093('0xa')]);}else{return _0x5dd376(_0x1a6dea['result']);}})[_0xe093('0xb')](function(_0x601e88){logger['error'](_0xe093('0x8'),_0xe093('0x3'),_0x20c9a9,_0x601e88,_0x4863a9);return _0x2d1b65(_0x601e88);});});};module[_0xe093('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 4893eee..02ae664 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 _0xa5a0=['./rpc/mailAccount','../../config/logger','resolve','getMailAccounts','then','initMailAccounts','listen','loginMailFrequency','catch','./server','./realtime'];(function(_0x54b6ec,_0x462988){var _0x19b90f=function(_0x50a1b3){while(--_0x50a1b3){_0x54b6ec['push'](_0x54b6ec['shift']());}};_0x19b90f(++_0x462988);}(_0xa5a0,0x195));var _0x0a5a=function(_0x429c17,_0xb5ed6b){_0x429c17=_0x429c17-0x0;var _0x220352=_0xa5a0[_0x429c17];return _0x220352;};'use strict';var server=require(_0x0a5a('0x0'));var Realtime=require(_0x0a5a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0a5a('0x2'));var setting=require('./rpc/setting');var logger=require(_0x0a5a('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0a5a('0x4')]()['then'](mailAccount[_0x0a5a('0x5')]())[_0x0a5a('0x6')](realtime[_0x0a5a('0x7')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0a5a('0x8')](realtime,email)[_0x0a5a('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x0a5a('0x6')](function(_0x28bca6){return setInterval(initRealtime,_0x28bca6[_0x0a5a('0x9')]*0x3e8);})[_0x0a5a('0xa')](function(_0x3d98da){logger['error']('Email\x20service\x20initialization',_0x3d98da);});}main(); \ No newline at end of file +var _0x7440=['./rpc/mailAccount','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x5e35fa,_0x5d8898){var _0x1700b5=function(_0x181ec1){while(--_0x181ec1){_0x5e35fa['push'](_0x5e35fa['shift']());}};_0x1700b5(++_0x5d8898);}(_0x7440,0xfd));var _0x0744=function(_0x1e0f65,_0x22f839){_0x1e0f65=_0x1e0f65-0x0;var _0x8c9925=_0x7440[_0x1e0f65];return _0x8c9925;};'use strict';var server=require(_0x0744('0x0'));var Realtime=require(_0x0744('0x1'));var EmailChannel=require(_0x0744('0x2'));var mailAccount=require(_0x0744('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x0744('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0744('0x5')]()[_0x0744('0x6')](mailAccount[_0x0744('0x7')]())[_0x0744('0x6')](realtime[_0x0744('0x8')]())[_0x0744('0x6')](function(){email[_0x0744('0x9')](realtime[_0x0744('0xa')]);return realtime;});}function main(){return server[_0x0744('0xb')](realtime,email)[_0x0744('0x6')](function(){return initRealtime();})[_0x0744('0x6')](function(){return setting[_0x0744('0xc')]();})[_0x0744('0x6')](function(_0x2cc6c1){return setInterval(initRealtime,_0x2cc6c1[_0x0744('0xd')]*0x3e8);})['catch'](function(_0x2ccb57){logger[_0x0744('0xe')](_0x0744('0xf'),_0x2ccb57);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index a57d1c7..b3ac9b7 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 _0x2812=['exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','messageStatus','Imap','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','handleImapEmail','bind','handleImapEnd','handleImapError','status','disabled','emit','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','verify','verified'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2812,0x1d9));var _0x2281=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x2812[_0x462fe4];return _0x82b23a;};'use strict';var _=require(_0x2281('0x0'));var moment=require(_0x2281('0x1'));var BPromise=require(_0x2281('0x2'));var md5=require(_0x2281('0x3'));var Redis=require(_0x2281('0x4'));var config=require(_0x2281('0x5'));var logger=require(_0x2281('0x6'))(_0x2281('0x7'));config[_0x2281('0x8')]=_[_0x2281('0x9')](config['redis'],{'host':_0x2281('0xa'),'port':0x18eb});var io=require(_0x2281('0xb'))(new Redis(config['redis']));var EmailImap=require(_0x2281('0xc'));var EmailSmtp=require(_0x2281('0xd'));var mailAccount=require(_0x2281('0xe'));var md5Accounts={};function EmailChannel(_0xc6b45){logger[_0x2281('0xf')](_0x2281('0x10'));this['mailAccounts']=_0xc6b45[_0x2281('0x11')];this[_0x2281('0x12')]={};this[_0x2281('0x13')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x27fa44){var _0x53abb3=this[_0x2281('0x11')][_0x27fa44];var _0x5b84ad={'id':_0x53abb3['id'],'name':_0x53abb3[_0x2281('0x14')],'key':_0x53abb3[_0x2281('0x15')],'active':_0x53abb3[_0x2281('0x16')],'Imap':{'status':_0x53abb3['Imap']['status'],'messageStatus':_0x53abb3['Imap'][_0x2281('0x17')],'total':_0x53abb3[_0x2281('0x18')][_0x2281('0x19')]}};if(_[_0x2281('0x1a')](md5Accounts[_0x27fa44])){md5Accounts[_0x27fa44]={};}var _0x12ee75=md5(JSON[_0x2281('0x1b')](_0x5b84ad));if(md5Accounts[_0x27fa44][_0x2281('0x3')]!==_0x12ee75){md5Accounts[_0x27fa44]['md5']=_0x12ee75;io['emit'](_0x2281('0x1c'),_0x5b84ad);}};EmailChannel[_0x2281('0x1d')][_0x2281('0x1e')]=function(_0x3763cf){for(var _0x5dc35c in _0x3763cf){if(_0x3763cf[_0x2281('0x1f')](_0x5dc35c)){if(_0x3763cf[_0x5dc35c]['Imap']&&_0x3763cf[_0x5dc35c][_0x2281('0x16')]){var _0x22e860=_0x3763cf[_0x5dc35c][_0x2281('0x18')];if(!_0x22e860[_0x2281('0x20')]&&_0x3763cf[_0x5dc35c]['provider']!==_0x2281('0x21'))_0x22e860[_0x2281('0x20')]=_0x3763cf[_0x5dc35c][_0x2281('0x22')];if(!this[_0x2281('0x12')][_0x2281('0x1f')](_0x22e860['id'])){this[_0x2281('0x12')][_0x22e860['id']]=new EmailImap(_0x22e860,_0x3763cf[_0x5dc35c]['email']);this[_0x2281('0x12')][_0x22e860['id']]['on'](_0x2281('0x23'),this[_0x2281('0x24')]['bind'](this,_0x5dc35c));this[_0x2281('0x12')][_0x22e860['id']]['on']('email',this[_0x2281('0x25')][_0x2281('0x26')](this,_0x5dc35c));this[_0x2281('0x12')][_0x22e860['id']]['on']('end',this[_0x2281('0x27')][_0x2281('0x26')](this,_0x5dc35c));this['imapAccounts'][_0x22e860['id']]['on']('error',this[_0x2281('0x28')][_0x2281('0x26')](this,_0x5dc35c));}}else{if(_[_0x2281('0x1a')](this['mailAccounts'][_0x5dc35c][_0x2281('0x18')])){this['mailAccounts'][_0x5dc35c][_0x2281('0x18')]={};}this[_0x2281('0x11')][_0x5dc35c]['Imap'][_0x2281('0x29')]=_0x2281('0x2a');this[_0x2281('0x11')][_0x5dc35c][_0x2281('0x18')][_0x2281('0x17')]='';this[_0x2281('0x2b')](_0x5dc35c);}}}};EmailChannel[_0x2281('0x1d')][_0x2281('0x24')]=function(_0x4aa5b9,_0x57615e){if(this['mailAccounts'][_0x4aa5b9]){this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x29')]=_0x2281('0x2c');this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x17')]=_0x57615e[_0x2281('0x14')];if(_0x57615e['messages']){this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x19')]=_0x57615e['messages']['total'];}return this[_0x2281('0x2b')](_0x4aa5b9);}};EmailChannel['prototype'][_0x2281('0x25')]=function(_0x46b15e,_0x48012d){logger[_0x2281('0xf')](_0x2281('0x2d'),_0x48012d['firstName'],_0x48012d['lastName'],_0x48012d[_0x2281('0x2e')],_0x46b15e);if(this[_0x2281('0x11')][_0x46b15e]){return mailAccount[_0x2281('0x2f')](_0x46b15e,_0x48012d)[_0x2281('0x30')](function(_0x253b2f){if(_0x253b2f){logger[_0x2281('0xf')](_0x2281('0x31'));}})[_0x2281('0x32')](function(_0x32da51){logger[_0x2281('0x33')](_0x2281('0x34'),JSON[_0x2281('0x1b')](_0x32da51));});}};EmailChannel[_0x2281('0x1d')]['handleImapEnd']=function(_0x4cb49f){if(this[_0x2281('0x11')][_0x4cb49f]&&this[_0x2281('0x11')][_0x4cb49f]['Imap']){if(this[_0x2281('0x12')][this[_0x2281('0x11')][_0x4cb49f]['Imap']['id']]){delete this['imapAccounts'][this[_0x2281('0x11')][_0x4cb49f][_0x2281('0x18')]['id']];}this[_0x2281('0x11')][_0x4cb49f][_0x2281('0x18')]['lastSync']=moment();this[_0x2281('0x2b')](_0x4cb49f);}};EmailChannel[_0x2281('0x1d')]['handleImapError']=function(_0x2e66b0,_0x331d36){if(this[_0x2281('0x11')][_0x2e66b0]){this[_0x2281('0x11')][_0x2e66b0][_0x2281('0x18')][_0x2281('0x29')]='error';this[_0x2281('0x11')][_0x2e66b0]['Imap'][_0x2281('0x17')]=_0x331d36;return this['emit'](_0x2e66b0);}};EmailChannel[_0x2281('0x1d')][_0x2281('0x35')]=function(_0x1e9930,_0x1c165f){return this[_0x2281('0x13')]['send'](_0x1e9930,_0x1c165f);};EmailChannel[_0x2281('0x1d')][_0x2281('0x36')]=function(_0x1f5c16){var _0x1afc08=this;if(this[_0x2281('0x11')][_0x1f5c16['id']]){if(_['isNil'](this[_0x2281('0x11')][_0x1f5c16['id']]['Smtp'])){this[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')]={};}this[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')]['lastSync']=moment();return new BPromise(function(_0x12c369,_0x2952d5){return _0x1afc08[_0x2281('0x13')][_0x2281('0x38')](_0x1f5c16)[_0x2281('0x30')](function(_0x31deb2){_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']]['Smtp'][_0x2281('0x29')]=_0x2281('0x39');_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')][_0x2281('0x17')]='';_0x1afc08[_0x2281('0x2b')](_0x1f5c16['id']);_0x12c369(_0x31deb2);})['catch'](function(_0x5e8f4a){_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']]['Smtp']['status']=_0x2281('0x33');_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')][_0x2281('0x17')]=_0x5e8f4a;_0x1afc08['emit'](_0x1f5c16['id']);_0x2952d5(_0x5e8f4a);});});}return this['smtp'][_0x2281('0x38')](_0x1f5c16);};module[_0x2281('0x3a')]=EmailChannel; \ No newline at end of file +var _0x099c=['bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','box','handleImapBox','bind','end','handleImapError','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','isNil','Smtp','verify','then','verified','catch','exports','lodash'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x099c,0x121));var _0xc099=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x099c[_0x285800];return _0x4b809e;};'use strict';var _=require(_0xc099('0x0'));var moment=require('moment');var BPromise=require(_0xc099('0x1'));var md5=require(_0xc099('0x2'));var Redis=require('ioredis');var config=require(_0xc099('0x3'));var logger=require(_0xc099('0x4'))(_0xc099('0x5'));config[_0xc099('0x6')]=_[_0xc099('0x7')](config[_0xc099('0x6')],{'host':_0xc099('0x8'),'port':0x18eb});var io=require(_0xc099('0x9'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xc099('0xa'));var mailAccount=require(_0xc099('0xb'));var md5Accounts={};function EmailChannel(_0x1b96b5){logger[_0xc099('0xc')](_0xc099('0xd'));this[_0xc099('0xe')]=_0x1b96b5[_0xc099('0xe')];this[_0xc099('0xf')]={};this[_0xc099('0x10')]=new EmailSmtp();}EmailChannel[_0xc099('0x11')][_0xc099('0x12')]=function(_0x11e4cf){var _0x22aeda=this['mailAccounts'][_0x11e4cf];var _0x561b24={'id':_0x22aeda['id'],'name':_0x22aeda[_0xc099('0x13')],'key':_0x22aeda[_0xc099('0x14')],'active':_0x22aeda[_0xc099('0x15')],'Imap':{'status':_0x22aeda[_0xc099('0x16')][_0xc099('0x17')],'messageStatus':_0x22aeda[_0xc099('0x16')][_0xc099('0x18')],'total':_0x22aeda[_0xc099('0x16')][_0xc099('0x19')]}};if(_['isNil'](md5Accounts[_0x11e4cf])){md5Accounts[_0x11e4cf]={};}var _0x510730=md5(JSON['stringify'](_0x561b24));if(md5Accounts[_0x11e4cf][_0xc099('0x2')]!==_0x510730){md5Accounts[_0x11e4cf][_0xc099('0x2')]=_0x510730;io[_0xc099('0x12')](_0xc099('0x1a'),_0x561b24);}};EmailChannel['prototype'][_0xc099('0x1b')]=function(_0x4de38e){for(var _0x4e6c29 in _0x4de38e){if(_0x4de38e['hasOwnProperty'](_0x4e6c29)){if(_0x4de38e[_0x4e6c29]['Imap']&&_0x4de38e[_0x4e6c29][_0xc099('0x15')]){var _0x4ecf47=_0x4de38e[_0x4e6c29][_0xc099('0x16')];if(!_0x4ecf47[_0xc099('0x1c')]&&_0x4de38e[_0x4e6c29][_0xc099('0x1d')]!==_0xc099('0x1e'))_0x4ecf47[_0xc099('0x1c')]=_0x4de38e[_0x4e6c29][_0xc099('0x1d')];if(!this[_0xc099('0xf')][_0xc099('0x1f')](_0x4ecf47['id'])){this[_0xc099('0xf')][_0x4ecf47['id']]=new EmailImap(_0x4ecf47,_0x4de38e[_0x4e6c29]['email']);this[_0xc099('0xf')][_0x4ecf47['id']]['on'](_0xc099('0x20'),this[_0xc099('0x21')][_0xc099('0x22')](this,_0x4e6c29));this[_0xc099('0xf')][_0x4ecf47['id']]['on'](_0xc099('0x5'),this['handleImapEmail'][_0xc099('0x22')](this,_0x4e6c29));this[_0xc099('0xf')][_0x4ecf47['id']]['on'](_0xc099('0x23'),this['handleImapEnd']['bind'](this,_0x4e6c29));this['imapAccounts'][_0x4ecf47['id']]['on']('error',this[_0xc099('0x24')][_0xc099('0x22')](this,_0x4e6c29));}}else{if(_['isNil'](this['mailAccounts'][_0x4e6c29][_0xc099('0x16')])){this[_0xc099('0xe')][_0x4e6c29][_0xc099('0x16')]={};}this['mailAccounts'][_0x4e6c29][_0xc099('0x16')]['status']=_0xc099('0x25');this[_0xc099('0xe')][_0x4e6c29]['Imap'][_0xc099('0x18')]='';this[_0xc099('0x12')](_0x4e6c29);}}}};EmailChannel['prototype'][_0xc099('0x21')]=function(_0x26d623,_0x1abfb1){if(this[_0xc099('0xe')][_0x26d623]){this[_0xc099('0xe')][_0x26d623][_0xc099('0x16')]['status']=_0xc099('0x26');this[_0xc099('0xe')][_0x26d623]['Imap'][_0xc099('0x18')]=_0x1abfb1['name'];if(_0x1abfb1[_0xc099('0x27')]){this[_0xc099('0xe')][_0x26d623][_0xc099('0x16')][_0xc099('0x19')]=_0x1abfb1[_0xc099('0x27')][_0xc099('0x19')];}return this[_0xc099('0x12')](_0x26d623);}};EmailChannel[_0xc099('0x11')][_0xc099('0x28')]=function(_0xd7400b,_0x2e41c9){logger[_0xc099('0xc')](_0xc099('0x29'),_0x2e41c9[_0xc099('0x2a')],_0x2e41c9[_0xc099('0x2b')],_0x2e41c9[_0xc099('0x2c')],_0xd7400b);if(this[_0xc099('0xe')][_0xd7400b]){return mailAccount['notify'](_0xd7400b,_0x2e41c9)['then'](function(_0x4b4cb7){if(_0x4b4cb7){logger[_0xc099('0xc')](_0xc099('0x2d'));}})['catch'](function(_0x4bdc1c){logger[_0xc099('0x2e')](_0xc099('0x2f'),JSON['stringify'](_0x4bdc1c));});}};EmailChannel[_0xc099('0x11')][_0xc099('0x30')]=function(_0x1ef5c5){if(this[_0xc099('0xe')][_0x1ef5c5]&&this[_0xc099('0xe')][_0x1ef5c5][_0xc099('0x16')]){if(this['imapAccounts'][this[_0xc099('0xe')][_0x1ef5c5][_0xc099('0x16')]['id']]){delete this[_0xc099('0xf')][this[_0xc099('0xe')][_0x1ef5c5][_0xc099('0x16')]['id']];}this['mailAccounts'][_0x1ef5c5][_0xc099('0x16')][_0xc099('0x31')]=moment();this[_0xc099('0x12')](_0x1ef5c5);}};EmailChannel['prototype'][_0xc099('0x24')]=function(_0x5c7d63,_0x53f0f2){if(this[_0xc099('0xe')][_0x5c7d63]){this[_0xc099('0xe')][_0x5c7d63][_0xc099('0x16')][_0xc099('0x17')]='error';this[_0xc099('0xe')][_0x5c7d63][_0xc099('0x16')]['messageStatus']=_0x53f0f2;return this['emit'](_0x5c7d63);}};EmailChannel[_0xc099('0x11')]['sendMail']=function(_0x5baf9d,_0x3f677f){return this[_0xc099('0x10')][_0xc099('0x32')](_0x5baf9d,_0x3f677f);};EmailChannel[_0xc099('0x11')]['verifySmtp']=function(_0xa21091){var _0x12a915=this;if(this[_0xc099('0xe')][_0xa21091['id']]){if(_[_0xc099('0x33')](this[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')])){this[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')]={};}this[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')][_0xc099('0x31')]=moment();return new BPromise(function(_0x387b99,_0x40681c){return _0x12a915[_0xc099('0x10')][_0xc099('0x35')](_0xa21091)[_0xc099('0x36')](function(_0x2600d6){_0x12a915[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')]['status']=_0xc099('0x37');_0x12a915[_0xc099('0xe')][_0xa21091['id']]['Smtp'][_0xc099('0x18')]='';_0x12a915[_0xc099('0x12')](_0xa21091['id']);_0x387b99(_0x2600d6);})[_0xc099('0x38')](function(_0x343728){_0x12a915[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')][_0xc099('0x17')]=_0xc099('0x2e');_0x12a915[_0xc099('0xe')][_0xa21091['id']][_0xc099('0x34')][_0xc099('0x18')]=_0x343728;_0x12a915[_0xc099('0x12')](_0xa21091['id']);_0x40681c(_0x343728);});});}return this[_0xc099('0x10')][_0xc099('0x35')](_0xa21091);};module[_0xc099('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index eeff066..1010beb 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 _0xb016=['isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','lodash','util','simpleParser','Iconv','events','EventEmitter','./utils','email','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','connTimeout'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xb016,0x159));var _0x6b01=function(_0x1a9349,_0x57632e){_0x1a9349=_0x1a9349-0x0;var _0x4d60bb=_0xb016[_0x1a9349];return _0x4d60bb;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x6b01('0x2')];var Iconv=require('iconv')[_0x6b01('0x3')];var EventEmitter=require(_0x6b01('0x4'))[_0x6b01('0x5')];var utils=require(_0x6b01('0x6'));var logger=require('../../../config/logger')(_0x6b01('0x7'));function EmailImap(_0x65407a,_0x192b2d){this['mailbox']='INBOX';this[_0x6b01('0x8')]=this[_0x6b01('0x9')](_0x65407a,_0x192b2d);this['imap']=new Imap(this['account']);this[_0x6b01('0xa')][_0x6b01('0xb')](_0x6b01('0xc'),this[_0x6b01('0xd')][_0x6b01('0xe')](this));this['imap']['once'](_0x6b01('0xf'),this[_0x6b01('0x10')][_0x6b01('0xe')](this));this['imap']['on'](_0x6b01('0x11'),this['handleError']['bind'](this));this[_0x6b01('0xa')]['connect']();}util[_0x6b01('0x12')](EmailImap,EventEmitter);EmailImap[_0x6b01('0x13')]['getAccount']=function(_0x2c305e,_0x4ea5fa){var _0x50d778={'connTimeout':_0x2c305e['connTimeout']?_0x2c305e[_0x6b01('0x14')]*0x3e8:0x2710,'authTimeout':_0x2c305e['authTimeout']?_0x2c305e['authTimeout']*0x3e8:0x1388};if(_[_0x6b01('0x15')](_0x2c305e[_0x6b01('0x16')])){if(_0x2c305e[_0x6b01('0x17')]){_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778[_0x6b01('0x1a')]=_0x2c305e[_0x6b01('0x1a')];_0x50d778[_0x6b01('0x1b')]=_0x2c305e[_0x6b01('0x1b')]||0x3e1;if(_0x2c305e['tls']){_0x50d778[_0x6b01('0x1c')]=!![];}else{_0x50d778[_0x6b01('0x1c')]=![];_0x50d778[_0x6b01('0x1d')]=_0x6b01('0x1e');}}else{if(_0x2c305e[_0x6b01('0x1f')]){_0x50d778[_0x6b01('0x20')]=utils[_0x6b01('0x21')](_0x2c305e[_0x6b01('0x22')]['data5'],_0x2c305e[_0x6b01('0x18')]);_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];}else{_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778['host']=utils[_0x6b01('0x23')](_0x2c305e[_0x6b01('0x16')]);_0x50d778[_0x6b01('0x1b')]=0x3e1;_0x50d778['tls']=!![];}_0x50d778[_0x6b01('0x7')]=_0x4ea5fa||_0x2c305e[_0x6b01('0x18')]||_0x6b01('0x24');return _0x50d778;};EmailImap[_0x6b01('0x13')][_0x6b01('0xd')]=function(){this[_0x6b01('0xa')][_0x6b01('0x25')](this[_0x6b01('0x26')],![],this[_0x6b01('0x27')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x27')]=function(_0x154dfc,_0x55ca4b){if(_0x154dfc){this[_0x6b01('0x28')](_0x154dfc,!![]);}else{this[_0x6b01('0x29')](_0x6b01('0x2a'),_0x55ca4b);this[_0x6b01('0x2b')]();}};EmailImap[_0x6b01('0x13')]['handleCloseBox']=function(_0x54f030){if(_0x54f030){this[_0x6b01('0x28')](_0x54f030,!![]);}else{this[_0x6b01('0xa')][_0x6b01('0xf')]();}};EmailImap[_0x6b01('0x13')][_0x6b01('0x2b')]=function(){this[_0x6b01('0xa')]['search']([_0x6b01('0x2c')],this['handleReadUnseen'][_0x6b01('0xe')](this));};EmailImap['prototype'][_0x6b01('0x2d')]=function(_0xa6b2b6,_0x473201){if(_0xa6b2b6){this[_0x6b01('0x28')](_0xa6b2b6,!![]);}else{if(_0x473201[_0x6b01('0x2e')]){try{var _0x54575c=this[_0x6b01('0xa')][_0x6b01('0x2f')](_0x473201,{'bodies':'','markSeen':!![]});_0x54575c['on'](_0x6b01('0x30'),this['handleFetchMessage']['bind'](this));_0x54575c[_0x6b01('0xb')]('error',this[_0x6b01('0x31')][_0x6b01('0xe')](this));_0x54575c[_0x6b01('0xb')]('end',this[_0x6b01('0x32')][_0x6b01('0xe')](this));}catch(_0x186a6d){logger['error'](_0x186a6d);}}else{this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));}}};EmailImap[_0x6b01('0x13')]['handleFetchMessage']=function(_0xa041ea){_0xa041ea['on'](_0x6b01('0x35'),this[_0x6b01('0x36')][_0x6b01('0xe')](this));_0xa041ea[_0x6b01('0xb')](_0x6b01('0x37'),this[_0x6b01('0x38')][_0x6b01('0xe')](this));_0xa041ea['once'](_0x6b01('0xf'),this['handleMessageEnd'][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x36')]=function(_0x318b8b){simpleParser(_0x318b8b,{'Iconv':Iconv},this[_0x6b01('0x39')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x3a')]=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x39')]=function(_0x1ca3aa,_0x2c4205){if(_0x1ca3aa){logger[_0x6b01('0x11')](_0x1ca3aa);}else{var _0x44bf46=this;utils['parser'](this[_0x6b01('0x8')],_0x2c4205,function(_0x55907f){_0x44bf46[_0x6b01('0x29')](_0x6b01('0x7'),_0x55907f);});}};EmailImap['prototype'][_0x6b01('0x32')]=function(){this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x31')]=function(_0x93737a){this[_0x6b01('0x28')](_0x93737a);this[_0x6b01('0xa')]['closeBox'](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6b01('0x29')](_0x6b01('0xf'));};EmailImap['prototype'][_0x6b01('0x28')]=function(_0x3f9e46,_0x55bf71){logger[_0x6b01('0x11')]('handleError',this[_0x6b01('0x8')][_0x6b01('0x7')],JSON[_0x6b01('0x3b')](_0x3f9e46));var _0x50b13d='';if(_0x3f9e46){if(_0x3f9e46[_0x6b01('0x3c')]){_0x50b13d=_0x3f9e46[_0x6b01('0x3c')];}else{for(var _0x52cc57 in _0x3f9e46){if(_0x3f9e46['hasOwnProperty'](_0x52cc57)){_0x50b13d+=_['upperFirst'](_0x52cc57)+':\x20'+_0x3f9e46[_0x52cc57]+'\x0a';}}}}if(_0x55bf71){this[_0x6b01('0xa')][_0x6b01('0xf')]();}else{this[_0x6b01('0x29')](_0x6b01('0x11'),_0x50b13d);this[_0x6b01('0x29')](_0x6b01('0xf'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xc2c7=['textCode','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','email','getAccount','account','once','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleSimpleParser','handleMessageAttributes','handleMessageEnd','parser'];(function(_0x2e5405,_0x11284b){var _0x50442a=function(_0x2d75b5){while(--_0x2d75b5){_0x2e5405['push'](_0x2e5405['shift']());}};_0x50442a(++_0x11284b);}(_0xc2c7,0x134));var _0x7c2c=function(_0x510f45,_0x2553ef){_0x510f45=_0x510f45-0x0;var _0x1a7f09=_0xc2c7[_0x510f45];return _0x1a7f09;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var Imap=require(_0x7c2c('0x1'));var simpleParser=require(_0x7c2c('0x2'))[_0x7c2c('0x3')];var Iconv=require(_0x7c2c('0x4'))[_0x7c2c('0x5')];var EventEmitter=require(_0x7c2c('0x6'))[_0x7c2c('0x7')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x7c2c('0x8'));function EmailImap(_0x42ecc9,_0x23c038){this['mailbox']='INBOX';this['account']=this[_0x7c2c('0x9')](_0x42ecc9,_0x23c038);this[_0x7c2c('0x1')]=new Imap(this[_0x7c2c('0xa')]);this[_0x7c2c('0x1')][_0x7c2c('0xb')]('ready',this[_0x7c2c('0xc')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')][_0x7c2c('0xb')](_0x7c2c('0xe'),this[_0x7c2c('0xf')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')]['on'](_0x7c2c('0x10'),this[_0x7c2c('0x11')][_0x7c2c('0xd')](this));this[_0x7c2c('0x1')][_0x7c2c('0x12')]();}util[_0x7c2c('0x13')](EmailImap,EventEmitter);EmailImap[_0x7c2c('0x14')][_0x7c2c('0x9')]=function(_0x4c4aaf,_0x5b5729){var _0x102778={'connTimeout':_0x4c4aaf[_0x7c2c('0x15')]?_0x4c4aaf[_0x7c2c('0x15')]*0x3e8:0x2710,'authTimeout':_0x4c4aaf['authTimeout']?_0x4c4aaf[_0x7c2c('0x16')]*0x3e8:0x1388};if(_[_0x7c2c('0x17')](_0x4c4aaf['service'])){if(_0x4c4aaf[_0x7c2c('0x18')]){_0x102778['user']=_0x4c4aaf[_0x7c2c('0x19')];_0x102778['password']=_0x4c4aaf[_0x7c2c('0x1a')];}_0x102778[_0x7c2c('0x1b')]=_0x4c4aaf[_0x7c2c('0x1b')];_0x102778[_0x7c2c('0x1c')]=_0x4c4aaf[_0x7c2c('0x1c')]||0x3e1;if(_0x4c4aaf[_0x7c2c('0x1d')]){_0x102778[_0x7c2c('0x1d')]=!![];}else{_0x102778[_0x7c2c('0x1d')]=![];_0x102778[_0x7c2c('0x1e')]=_0x7c2c('0x1f');}}else{if(_0x4c4aaf[_0x7c2c('0x20')]){_0x102778[_0x7c2c('0x21')]=utils['generateXOAuth2Token'](_0x4c4aaf[_0x7c2c('0x22')]['data5'],_0x4c4aaf['user']);_0x102778[_0x7c2c('0x19')]=_0x4c4aaf[_0x7c2c('0x19')];}else{_0x102778[_0x7c2c('0x19')]=_0x4c4aaf[_0x7c2c('0x19')];_0x102778[_0x7c2c('0x1a')]=_0x4c4aaf[_0x7c2c('0x1a')];}_0x102778[_0x7c2c('0x1b')]=utils['getHost'](_0x4c4aaf[_0x7c2c('0x23')]);_0x102778['port']=0x3e1;_0x102778[_0x7c2c('0x1d')]=!![];}_0x102778['email']=_0x5b5729||_0x4c4aaf[_0x7c2c('0x19')]||_0x7c2c('0x24');return _0x102778;};EmailImap[_0x7c2c('0x14')]['handleReady']=function(){this['imap'][_0x7c2c('0x25')](this[_0x7c2c('0x26')],![],this[_0x7c2c('0x27')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x27')]=function(_0x3f4618,_0x4b1dd0){if(_0x3f4618){this[_0x7c2c('0x11')](_0x3f4618,!![]);}else{this[_0x7c2c('0x28')](_0x7c2c('0x29'),_0x4b1dd0);this[_0x7c2c('0x2a')]();}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2b')]=function(_0xf2bfd1){if(_0xf2bfd1){this[_0x7c2c('0x11')](_0xf2bfd1,!![]);}else{this[_0x7c2c('0x1')]['end']();}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2a')]=function(){this[_0x7c2c('0x1')][_0x7c2c('0x2c')](['UNSEEN'],this[_0x7c2c('0x2d')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x2d')]=function(_0x1859c2,_0x3ad837){if(_0x1859c2){this[_0x7c2c('0x11')](_0x1859c2,!![]);}else{if(_0x3ad837['length']){try{var _0x1969f4=this[_0x7c2c('0x1')][_0x7c2c('0x2e')](_0x3ad837,{'bodies':'','markSeen':!![]});_0x1969f4['on'](_0x7c2c('0x2f'),this[_0x7c2c('0x30')]['bind'](this));_0x1969f4['once'](_0x7c2c('0x10'),this['handleFetchError']['bind'](this));_0x1969f4[_0x7c2c('0xb')](_0x7c2c('0xe'),this[_0x7c2c('0x31')][_0x7c2c('0xd')](this));}catch(_0x536dcf){logger[_0x7c2c('0x10')](_0x536dcf);}}else{this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this[_0x7c2c('0x2b')][_0x7c2c('0xd')](this));}}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x30')]=function(_0xab5072){_0xab5072['on'](_0x7c2c('0x33'),this[_0x7c2c('0x34')][_0x7c2c('0xd')](this));_0xab5072[_0x7c2c('0xb')](_0x7c2c('0x35'),this['handleMessageAttributes']['bind'](this));_0xab5072[_0x7c2c('0xb')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x34')]=function(_0x129bf0){simpleParser(_0x129bf0,{'Iconv':Iconv},this[_0x7c2c('0x36')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x37')]=function(){};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x38')]=function(){};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x36')]=function(_0x58696a,_0x4c7402){if(_0x58696a){logger[_0x7c2c('0x10')](_0x58696a);}else{var _0x360928=this;utils[_0x7c2c('0x39')](this[_0x7c2c('0xa')],_0x4c7402,function(_0x5e8c96){_0x360928[_0x7c2c('0x28')](_0x7c2c('0x8'),_0x5e8c96);});}};EmailImap[_0x7c2c('0x14')][_0x7c2c('0x31')]=function(){this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this[_0x7c2c('0x2b')][_0x7c2c('0xd')](this));};EmailImap[_0x7c2c('0x14')]['handleFetchError']=function(_0xe2a67b){this['handleError'](_0xe2a67b);this[_0x7c2c('0x1')][_0x7c2c('0x32')](!![],this['handleCloseBox'][_0x7c2c('0xd')](this));};EmailImap['prototype'][_0x7c2c('0xf')]=function(){this[_0x7c2c('0x28')](_0x7c2c('0xe'));};EmailImap[_0x7c2c('0x14')]['handleError']=function(_0x23fdcf,_0x500974){logger['error'](_0x7c2c('0x11'),this[_0x7c2c('0xa')][_0x7c2c('0x8')],JSON['stringify'](_0x23fdcf));var _0x3adfd1='';if(_0x23fdcf){if(_0x23fdcf[_0x7c2c('0x3a')]){_0x3adfd1=_0x23fdcf['textCode'];}else{for(var _0x267361 in _0x23fdcf){if(_0x23fdcf['hasOwnProperty'](_0x267361)){_0x3adfd1+=_[_0x7c2c('0x3b')](_0x267361)+':\x20'+_0x23fdcf[_0x267361]+'\x0a';}}}}if(_0x500974){this[_0x7c2c('0x1')]['end']();}else{this['emit'](_0x7c2c('0x10'),_0x3adfd1);this[_0x7c2c('0x28')]('end');}};module[_0x7c2c('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 55a2279..dbe24a8 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 _0xea35=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport'];(function(_0x29fba8,_0x2b16f2){var _0x42f260=function(_0x2800a5){while(--_0x2800a5){_0x29fba8['push'](_0x29fba8['shift']());}};_0x42f260(++_0x2b16f2);}(_0xea35,0x86));var _0x5ea3=function(_0x25439d,_0x443288){_0x25439d=_0x25439d-0x0;var _0x363584=_0xea35[_0x25439d];return _0x363584;};'use strict';var nodemailer=require(_0x5ea3('0x0'));var inlineBase64=require(_0x5ea3('0x1'));function EmailSmtp(){}EmailSmtp[_0x5ea3('0x2')][_0x5ea3('0x3')]=function(_0x2eb501,_0x6de4d5){return new Promise(function(_0x8afef5,_0x4f0788){var _0x12398a=nodemailer['createTransport'](_0x2eb501);_0x12398a[_0x5ea3('0x4')](_0x5ea3('0x5'),inlineBase64());_0x12398a[_0x5ea3('0x6')](_0x6de4d5,function(_0x5969e1,_0x1efb66){if(_0x5969e1){_0x4f0788(_0x5969e1[_0x5ea3('0x7')]());}else{_0x8afef5(_0x1efb66);}});});};EmailSmtp['prototype'][_0x5ea3('0x8')]=function(_0x3042d3){return new Promise(function(_0x17d8eb,_0x30861c){var _0x499562=nodemailer[_0x5ea3('0x9')](_0x3042d3);_0x499562[_0x5ea3('0x8')](function(_0x415083,_0xe66665){if(_0x415083){_0x30861c(_0x415083['toString']());}else{if(_0xe66665){_0x17d8eb(_0xe66665);}else{_0x30861c(_0x5ea3('0xa'));}}});});};module[_0x5ea3('0xb')]=EmailSmtp; \ No newline at end of file +var _0x744f=['prototype','send','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x3872e6,_0x23ea68){var _0x57d9c7=function(_0x1f661f){while(--_0x1f661f){_0x3872e6['push'](_0x3872e6['shift']());}};_0x57d9c7(++_0x23ea68);}(_0x744f,0xda));var _0xf744=function(_0x3cce1e,_0x5e1011){_0x3cce1e=_0x3cce1e-0x0;var _0x2cc69d=_0x744f[_0x3cce1e];return _0x2cc69d;};'use strict';var nodemailer=require(_0xf744('0x0'));var inlineBase64=require(_0xf744('0x1'));function EmailSmtp(){}EmailSmtp[_0xf744('0x2')][_0xf744('0x3')]=function(_0x4bd6f8,_0x404fda){return new Promise(function(_0xd3d9d9,_0x261e9e){var _0x2c3f7b=nodemailer['createTransport'](_0x4bd6f8);_0x2c3f7b[_0xf744('0x4')](_0xf744('0x5'),inlineBase64());_0x2c3f7b[_0xf744('0x6')](_0x404fda,function(_0x147541,_0x136452){if(_0x147541){_0x261e9e(_0x147541[_0xf744('0x7')]());}else{_0xd3d9d9(_0x136452);}});});};EmailSmtp[_0xf744('0x2')][_0xf744('0x8')]=function(_0x159e37){return new Promise(function(_0x1db8df,_0x49ab9d){var _0x4d9d0a=nodemailer['createTransport'](_0x159e37);_0x4d9d0a[_0xf744('0x8')](function(_0x2bceb5,_0x5b0686){if(_0x2bceb5){_0x49ab9d(_0x2bceb5[_0xf744('0x7')]());}else{if(_0x5b0686){_0x1db8df(_0x5b0686);}else{_0x49ab9d(_0xf744('0x9'));}}});});};module[_0xf744('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2eca8fc..16f12c1 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 _0xe20b=['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','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','

Empty\x20message

','getHost','gmail','imap.gmail.com','imap-mail.outlook.com','outlook365','outlook.office365.com','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','../../../config/logger','email','../../../config/environment','address','anonymous','@xcally.com','head','name','substring','indexOf','length','Anonymous','value','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x29bbfb['slice'](0x0,-0x1)['join']('\x20'):_0x17e033[_0xbe20('0xa')];}return _0xbe20('0xe');}function getLastName(_0x8b3a6b){var _0x423945=_[_0xbe20('0x9')](_0x8b3a6b[_0xbe20('0xf')]);if(_0x423945&&_0x423945[_0xbe20('0xa')]){var _0x11aab2=_0x423945[_0xbe20('0xa')]['split'](/\s+/);return _0x11aab2[_0xbe20('0xd')]>0x1?_0x11aab2['pop']():'';}return'';}function getMails(_0x430d50,_0x41ed43){var _0x596ac1='';for(var _0xb55720=0x0;_0xb55720<_0x41ed43['value'][_0xbe20('0xd')];_0xb55720+=0x1){if(_0x41ed43[_0xbe20('0xf')][_0xb55720]['address']!==_0x430d50){if(!_[_0xbe20('0x10')](_0x596ac1)){_0x596ac1+=',';}_0x596ac1+=_0x41ed43[_0xbe20('0xf')][_0xb55720]['name']||_0x41ed43[_0xbe20('0xf')][_0xb55720][_0xbe20('0x6')]||'';_0x596ac1+='\x20<';_0x596ac1+=_0x41ed43[_0xbe20('0xf')][_0xb55720]['address']?_0x41ed43['value'][_0xb55720]['address']:_0xbe20('0x7')+random[_0xbe20('0x11')](0x6)+_0xbe20('0x8');_0x596ac1+='>';}}return _0x596ac1;}function parseEmail(_0x1bffb3,_0x561692,_0x4d1c31){if(_0x561692[_0xbe20('0x12')]){var _0x524578=/)<[^<]*)*<\/script>/gi;while(_0x524578[_0xbe20('0x13')](_0x561692[_0xbe20('0x12')])){_0x561692[_0xbe20('0x12')]=_0x561692['html'][_0xbe20('0x14')](_0x524578,'');}if(_0x561692['html'][_0xbe20('0x15')](_0xbe20('0x16'))){var _0x30bccc=[];_0x561692['attachments'][_0xbe20('0x17')](_0xa391a1=>{_0x30bccc[_0xbe20('0x18')](_0xa391a1[_0xbe20('0x19')]);});var _0x3c6881=/]+>/g;var _0x2a8c9c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x20f8ce=_0x561692['html']['replace'](_0x2a8c9c,_0xbe20('0x1a'));var _0xd12fd8=_0x20f8ce[_0xbe20('0x14')](_0x3c6881,_0xbe20('0x1b'));for(let _0xb3b62c=0x0;_0xb3b62c<_0x30bccc[_0xbe20('0xd')];_0xb3b62c++){var _0x379591=_0xd12fd8[_0xbe20('0x14')]('_IMG',_0xbe20('0x1c')+_0x30bccc[_0xb3b62c]+'\x20]');_0xd12fd8=_0x379591;}_0x561692['html']=_0xd12fd8;}_0x4d1c31[_0xbe20('0x1d')]=_0x561692[_0xbe20('0x12')];}else{_0x4d1c31[_0xbe20('0x1d')]=_0x561692[_0xbe20('0x1e')];}if(_0x4d1c31[_0xbe20('0x1d')]){_0x4d1c31['body']=_0x4d1c31['body'][_0xbe20('0x14')](/0x0){var _0x285dc8=[_0xbe20('0x30'),_0xbe20('0x31'),_0xbe20('0x32')];for(var _0x188d4b=0x0;_0x188d4b<_0x561692['headerLines'][_0xbe20('0xd')];_0x188d4b++){var _0x303bb5=_[_0xbe20('0xc')](_0x285dc8,_0x561692[_0xbe20('0x2f')][_0x188d4b]['line']);if(_0x303bb5>=0x0){_0x4d1c31[_0xbe20('0x33')]=!![];}}}return _0x4d1c31;}exports[_0xbe20('0x34')]=function(_0x4c3cae,_0x12e4bf,_0x4a22c1){var _0x1a019c={'from':getAddress(_0x12e4bf[_0xbe20('0x35')]),'firstName':getFirstName(_0x12e4bf[_0xbe20('0x35')]),'lastName':getLastName(_0x12e4bf[_0xbe20('0x35')]),'mapKey':_0xbe20('0x4'),'message':{'from':getMails(_0x4c3cae['email'],_0x12e4bf[_0xbe20('0x35')]),'to':_0x4c3cae[_0xbe20('0x4')],'cc':'','subject':_0x12e4bf[_0xbe20('0x36')]||'','messageId':_0x12e4bf[_0xbe20('0x37')],'inReplyTo':_0x12e4bf[_0xbe20('0x38')],'sentAt':moment(_0x12e4bf[_0xbe20('0x39')])[_0xbe20('0x26')](_0xbe20('0x3a')),'attach':![],'attachments':[]}};if(!_0x12e4bf[_0xbe20('0x12')]&&!_0x12e4bf[_0xbe20('0x1e')]){var _0x5ec178=_[_0xbe20('0x3b')](_0x12e4bf[_0xbe20('0x22')],{'contentType':_0xbe20('0x3c')});if(_0x5ec178['length']){logger[_0xbe20('0x3d')](util[_0xbe20('0x26')](_0xbe20('0x3e'),_0x12e4bf[_0xbe20('0x37')]));tnef[_0xbe20('0x3f')](_[_0xbe20('0x40')](_0x5ec178)['content'],function(_0x42f75b,_0x7c1178){if(_0x7c1178){_0x12e4bf['html']=_0x7c1178[_0xbe20('0x41')]||'

Empty\x20message

';if(_0x7c1178['Attachments']){for(var _0x579af9=0x0;_0x579af9<_0x7c1178[_0xbe20('0x42')][_0xbe20('0xd')];_0x579af9++){var _0x550ddd=_0x7c1178[_0xbe20('0x42')][_0x579af9];_0x1a019c[_0xbe20('0x20')]['attachments'][_0xbe20('0x18')]({'filename':_0x550ddd[_0xbe20('0x43')],'content':Buffer[_0xbe20('0x35')](_0x550ddd['Data'])});}}}_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));});}else{_0x12e4bf[_0xbe20('0x12')]=_0xbe20('0x44');_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));}}else{_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));}};exports[_0xbe20('0x45')]=function(_0x11dc96){switch(_0x11dc96){case _0xbe20('0x46'):return _0xbe20('0x47');case'yahoo':return'imap.mail.yahoo.com';case'hotmail':return _0xbe20('0x48');case _0xbe20('0x49'):return _0xbe20('0x4a');}return'127.0.0.1';};exports[_0xbe20('0x4b')]=function(_0x32568e,_0x37d267){var _0x47d7a2=[_0xbe20('0x4c')+(_0x37d267||''),_0xbe20('0x4d')+_0x32568e,'',''];return Buffer[_0xbe20('0x35')](_0x47d7a2['join'](''),_0xbe20('0x4e'))[_0xbe20('0x4f')](_0xbe20('0x50'));}; \ No newline at end of file +var _0x9abe=['base64','moment','randomstring','path','node-tnef','email','../../../config/environment','head','address','anonymous','generate','value','name','indexOf','length','slice','join','split','pop','isEmpty','@xcally.com','html','test','includes','\x20[Attachment:\x20','body','textAsHtml','message','originCc','originTo','attach','attachment','filename','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','Attachments','Title','

Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','utf-8'];(function(_0x40cdfa,_0x1cf634){var _0x2c5e4d=function(_0x1a666c){while(--_0x1a666c){_0x40cdfa['push'](_0x40cdfa['shift']());}};_0x2c5e4d(++_0x1cf634);}(_0x9abe,0xe5));var _0xe9ab=function(_0x3c7169,_0x1b863a){_0x3c7169=_0x3c7169-0x0;var _0x32d367=_0x9abe[_0x3c7169];return _0x32d367;};'use strict';var _=require('lodash');var moment=require(_0xe9ab('0x0'));var random=require(_0xe9ab('0x1'));var fs=require('fs');var path=require(_0xe9ab('0x2'));var util=require('util');var tnef=require(_0xe9ab('0x3'));var logger=require('../../../config/logger')(_0xe9ab('0x4'));var config=require(_0xe9ab('0x5'));function getAddress(_0x1d4b2f){var _0x3add34=_[_0xe9ab('0x6')](_0x1d4b2f['value']);return _0x3add34&&_0x3add34[_0xe9ab('0x7')]?_0x3add34[_0xe9ab('0x7')]:_0xe9ab('0x8')+random[_0xe9ab('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x4488eb){var _0x1d4b6d=_[_0xe9ab('0x6')](_0x4488eb[_0xe9ab('0xa')]);if(_0x1d4b6d&&_0x1d4b6d[_0xe9ab('0xb')]){if(_0x1d4b6d[_0xe9ab('0xb')]==_0x1d4b6d[_0xe9ab('0x7')]){return _0x1d4b6d[_0xe9ab('0xb')]['substring'](0x0,_0x1d4b6d[_0xe9ab('0xb')][_0xe9ab('0xc')]('@'));}var _0x5b023e=_0x1d4b6d[_0xe9ab('0xb')]['split'](/\s+/);return _0x5b023e[_0xe9ab('0xd')]>0x1?_0x5b023e[_0xe9ab('0xe')](0x0,-0x1)[_0xe9ab('0xf')]('\x20'):_0x1d4b6d[_0xe9ab('0xb')];}return'Anonymous';}function getLastName(_0x18e432){var _0x3981c0=_[_0xe9ab('0x6')](_0x18e432['value']);if(_0x3981c0&&_0x3981c0['name']){var _0x74af4d=_0x3981c0['name'][_0xe9ab('0x10')](/\s+/);return _0x74af4d[_0xe9ab('0xd')]>0x1?_0x74af4d[_0xe9ab('0x11')]():'';}return'';}function getMails(_0x33934f,_0x3040c8){var _0x355d29='';for(var _0x5af083=0x0;_0x5af083<_0x3040c8['value']['length'];_0x5af083+=0x1){if(_0x3040c8[_0xe9ab('0xa')][_0x5af083][_0xe9ab('0x7')]!==_0x33934f){if(!_[_0xe9ab('0x12')](_0x355d29)){_0x355d29+=',';}_0x355d29+=_0x3040c8[_0xe9ab('0xa')][_0x5af083]['name']||_0x3040c8[_0xe9ab('0xa')][_0x5af083]['address']||'';_0x355d29+='\x20<';_0x355d29+=_0x3040c8[_0xe9ab('0xa')][_0x5af083][_0xe9ab('0x7')]?_0x3040c8[_0xe9ab('0xa')][_0x5af083][_0xe9ab('0x7')]:_0xe9ab('0x8')+random[_0xe9ab('0x9')](0x6)+_0xe9ab('0x13');_0x355d29+='>';}}return _0x355d29;}function parseEmail(_0x41c046,_0x123246,_0x22f229){if(_0x123246[_0xe9ab('0x14')]){var _0x5e92a9=/)<[^<]*)*<\/script>/gi;while(_0x5e92a9[_0xe9ab('0x15')](_0x123246[_0xe9ab('0x14')])){_0x123246[_0xe9ab('0x14')]=_0x123246['html']['replace'](_0x5e92a9,'');}if(_0x123246[_0xe9ab('0x14')][_0xe9ab('0x16')](_0xe9ab('0x17'))){var _0xdd652b=[];_0x123246[_0xe9ab('0x18')][_0xe9ab('0x19')](_0x5e7494=>{_0xdd652b[_0xe9ab('0x1a')](_0x5e7494['filename']);});var _0x2a44d3=/]+>/g;var _0x1853f9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x341d64=_0x123246[_0xe9ab('0x14')]['replace'](_0x1853f9,_0xe9ab('0x1b'));var _0x113f35=_0x341d64[_0xe9ab('0x1c')](_0x2a44d3,_0xe9ab('0x1d'));for(let _0xde1e19=0x0;_0xde1e19<_0xdd652b['length'];_0xde1e19++){var _0x2026f5=_0x113f35[_0xe9ab('0x1c')](_0xe9ab('0x1d'),_0xe9ab('0x1e')+_0xdd652b[_0xde1e19]+'\x20]');_0x113f35=_0x2026f5;}_0x123246['html']=_0x113f35;}_0x22f229[_0xe9ab('0x1f')]=_0x123246[_0xe9ab('0x14')];}else{_0x22f229[_0xe9ab('0x1f')]=_0x123246[_0xe9ab('0x20')];}if(_0x22f229[_0xe9ab('0x1f')]){_0x22f229[_0xe9ab('0x1f')]=_0x22f229[_0xe9ab('0x1f')][_0xe9ab('0x1c')](/0x0){var _0xcab706=[_0xe9ab('0x30'),_0xe9ab('0x31'),'Precedence:\x20auto_reply'];for(var _0x58f667=0x0;_0x58f667<_0x123246[_0xe9ab('0x2f')][_0xe9ab('0xd')];_0x58f667++){var _0x50a9cf=_[_0xe9ab('0xc')](_0xcab706,_0x123246[_0xe9ab('0x2f')][_0x58f667][_0xe9ab('0x32')]);if(_0x50a9cf>=0x0){_0x22f229[_0xe9ab('0x33')]=!![];}}}return _0x22f229;}exports[_0xe9ab('0x34')]=function(_0x5a6248,_0x135076,_0x8d0323){var _0x27f8de={'from':getAddress(_0x135076[_0xe9ab('0x35')]),'firstName':getFirstName(_0x135076[_0xe9ab('0x35')]),'lastName':getLastName(_0x135076[_0xe9ab('0x35')]),'mapKey':'email','message':{'from':getMails(_0x5a6248['email'],_0x135076[_0xe9ab('0x35')]),'to':_0x5a6248[_0xe9ab('0x4')],'cc':'','subject':_0x135076['subject']||'','messageId':_0x135076['messageId'],'inReplyTo':_0x135076[_0xe9ab('0x36')],'sentAt':moment(_0x135076[_0xe9ab('0x37')])[_0xe9ab('0x28')](_0xe9ab('0x38')),'attach':![],'attachments':[]}};if(!_0x135076[_0xe9ab('0x14')]&&!_0x135076[_0xe9ab('0x20')]){var _0x3bb35c=_[_0xe9ab('0x39')](_0x135076[_0xe9ab('0x18')],{'contentType':_0xe9ab('0x3a')});if(_0x3bb35c['length']){logger['info'](util[_0xe9ab('0x28')](_0xe9ab('0x3b'),_0x135076['messageId']));tnef[_0xe9ab('0x3c')](_['first'](_0x3bb35c)[_0xe9ab('0x2d')],function(_0x29899d,_0x5e23cb){if(_0x5e23cb){_0x135076[_0xe9ab('0x14')]=_0x5e23cb['BodyHTML']||'

Empty\x20message

';if(_0x5e23cb[_0xe9ab('0x3d')]){for(var _0x2b02b9=0x0;_0x2b02b9<_0x5e23cb[_0xe9ab('0x3d')][_0xe9ab('0xd')];_0x2b02b9++){var _0x232412=_0x5e23cb[_0xe9ab('0x3d')][_0x2b02b9];_0x27f8de[_0xe9ab('0x21')]['attachments'][_0xe9ab('0x1a')]({'filename':_0x232412[_0xe9ab('0x3e')],'content':Buffer[_0xe9ab('0x35')](_0x232412['Data'])});}}}_0x8d0323(parseEmail(_0x5a6248,_0x135076,_0x27f8de));});}else{_0x135076[_0xe9ab('0x14')]=_0xe9ab('0x3f');_0x8d0323(parseEmail(_0x5a6248,_0x135076,_0x27f8de));}}else{_0x8d0323(parseEmail(_0x5a6248,_0x135076,_0x27f8de));}};exports[_0xe9ab('0x40')]=function(_0x35a0e9){switch(_0x35a0e9){case _0xe9ab('0x41'):return _0xe9ab('0x42');case _0xe9ab('0x43'):return _0xe9ab('0x44');case'hotmail':return _0xe9ab('0x45');case _0xe9ab('0x46'):return _0xe9ab('0x47');}return _0xe9ab('0x48');};exports[_0xe9ab('0x49')]=function(_0x12e78c,_0x42689b){var _0x426d19=['user='+(_0x42689b||''),'auth=Bearer\x20'+_0x12e78c,'',''];return Buffer['from'](_0x426d19[_0xe9ab('0xf')](''),_0xe9ab('0x4a'))['toString'](_0xe9ab('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 560675e..352b9de 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 _0xefa8=['Smtp','lodash','name','Service','key','active','Imap'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0xefa8,0x127));var _0x8efa=function(_0x21e11b,_0x55a9df){_0x21e11b=_0x21e11b-0x0;var _0x220006=_0xefa8[_0x21e11b];return _0x220006;};'use strict';var _=require(_0x8efa('0x0'));function MailAccount(_0x49a8c0){this['id']=_0x49a8c0['id']||0x0;this[_0x8efa('0x1')]=_0x49a8c0[_0x8efa('0x1')]||_0x8efa('0x2');this['key']=_0x49a8c0[_0x8efa('0x3')]||'SERV';this[_0x8efa('0x4')]=_0x49a8c0[_0x8efa('0x4')]||![];this['Imap']=_0x49a8c0[_0x8efa('0x5')]||[];this[_0x8efa('0x6')]=_0x49a8c0[_0x8efa('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0xf573=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x29b3aa,_0x50f51f){var _0x303bbb=function(_0x299dcd){while(--_0x299dcd){_0x29b3aa['push'](_0x29b3aa['shift']());}};_0x303bbb(++_0x50f51f);}(_0xf573,0x1d8));var _0x3f57=function(_0x586465,_0x33d879){_0x586465=_0x586465-0x0;var _0x1ec8f5=_0xf573[_0x586465];return _0x1ec8f5;};'use strict';var _=require(_0x3f57('0x0'));function MailAccount(_0x2308e4){this['id']=_0x2308e4['id']||0x0;this[_0x3f57('0x1')]=_0x2308e4[_0x3f57('0x1')]||_0x3f57('0x2');this['key']=_0x2308e4[_0x3f57('0x3')]||_0x3f57('0x4');this[_0x3f57('0x5')]=_0x2308e4[_0x3f57('0x5')]||![];this[_0x3f57('0x6')]=_0x2308e4[_0x3f57('0x6')]||[];this[_0x3f57('0x7')]=_0x2308e4[_0x3f57('0x7')]||[];}module[_0x3f57('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index be8bd8a..56bff12 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 _0x46c4=['isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x46c4,0xde));var _0x446c=function(_0x117b1b,_0x4d0b7d){_0x117b1b=_0x117b1b-0x0;var _0x5429be=_0x46c4[_0x117b1b];return _0x5429be;};'use strict';var _=require(_0x446c('0x0'));var MailAccount=require(_0x446c('0x1'));var Realtime=function(){this[_0x446c('0x2')]={};};function freeIsNotKey(_0x32a6d9,_0x3a1361,_0x398618){var _0x3a00ce=_[_0x446c('0x3')](_0x32a6d9,function(_0x5de425,_0x5da839){return _0x5de425[_0x398618];});for(var _0x533466 in _0x3a1361){if(_0x3a1361['hasOwnProperty'](_0x533466)){if(!_0x3a00ce[_0x533466]){delete _0x3a1361[_0x533466];}}}}Realtime[_0x446c('0x4')][_0x446c('0x5')]=function(_0x547bcd,_0x87c067){for(var _0x1e88ff in _0x87c067){if(_0x547bcd[_0x446c('0x6')](_0x1e88ff)){_0x547bcd[_0x1e88ff]=_0x87c067[_0x1e88ff];}}};Realtime[_0x446c('0x4')][_0x446c('0x7')]=function(){var _0x484a74=this;return function(_0x16eb41){if(_0x16eb41){freeIsNotKey(_0x16eb41,_0x484a74[_0x446c('0x2')],'id');for(var _0x3b4c35=0x0,_0x15d7bf={},_0xa0dfff={};_0x3b4c35<_0x16eb41[_0x446c('0x8')];_0x3b4c35+=0x1){_0x15d7bf=_0x16eb41[_0x3b4c35];if(_[_0x446c('0x9')](_0x484a74[_0x446c('0x2')][_0x15d7bf['id']])){_0x484a74[_0x446c('0x2')][_0x15d7bf['id']]=new MailAccount(_0x15d7bf);}else{_['merge'](_0x484a74[_0x446c('0x2')][_0x15d7bf['id']],_0x15d7bf);}}}return _0x484a74[_0x446c('0x2')];};};module[_0x446c('0xa')]=Realtime; \ No newline at end of file +var _0x23a1=['hasOwnProperty','initMailAccounts','mailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x23a1,0x166));var _0x123a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x123a('0x0'));var MailAccount=require(_0x123a('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5e8021,_0xbf3096,_0x45177b){var _0x1ecea7=_[_0x123a('0x2')](_0x5e8021,function(_0x57e117,_0x119bbd){return _0x57e117[_0x45177b];});for(var _0x20f2ee in _0xbf3096){if(_0xbf3096['hasOwnProperty'](_0x20f2ee)){if(!_0x1ecea7[_0x20f2ee]){delete _0xbf3096[_0x20f2ee];}}}}Realtime[_0x123a('0x3')][_0x123a('0x4')]=function(_0x402a9a,_0x1dcb38){for(var _0x2fdc3a in _0x1dcb38){if(_0x402a9a[_0x123a('0x5')](_0x2fdc3a)){_0x402a9a[_0x2fdc3a]=_0x1dcb38[_0x2fdc3a];}}};Realtime[_0x123a('0x3')][_0x123a('0x6')]=function(){var _0x5c1146=this;return function(_0x4dd4f6){if(_0x4dd4f6){freeIsNotKey(_0x4dd4f6,_0x5c1146[_0x123a('0x7')],'id');for(var _0x173822=0x0,_0x30a81e={},_0x130c41={};_0x173822<_0x4dd4f6[_0x123a('0x8')];_0x173822+=0x1){_0x30a81e=_0x4dd4f6[_0x173822];if(_[_0x123a('0x9')](_0x5c1146[_0x123a('0x7')][_0x30a81e['id']])){_0x5c1146[_0x123a('0x7')][_0x30a81e['id']]=new MailAccount(_0x30a81e);}else{_[_0x123a('0xa')](_0x5c1146[_0x123a('0x7')][_0x30a81e['id']],_0x30a81e);}}}return _0x5c1146[_0x123a('0x7')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ed55556..6fbb2c7 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 _0xdcd5=['CloudProvider','data5','MailServerOut','type','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xdcd5,0x110));var _0x5dcd=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xdcd5[_0x25e109];return _0xc0f7d6;};'use strict';var client=require(_0x5dcd('0x0'));exports[_0x5dcd('0x1')]=function(){return function(){return client[_0x5dcd('0x2')](_0x5dcd('0x3'),{'options':{'attributes':['id',_0x5dcd('0x4'),_0x5dcd('0x5'),_0x5dcd('0x6'),'email',_0x5dcd('0x7'),_0x5dcd('0x8'),_0x5dcd('0x9'),_0x5dcd('0xa')],'raw':![],'include':[{'model':_0x5dcd('0xb'),'as':_0x5dcd('0xc'),'include':[{'model':_0x5dcd('0xd'),'attributes':['id',_0x5dcd('0x4'),'service','type',_0x5dcd('0xe')],'as':_0x5dcd('0xd')}]},{'model':_0x5dcd('0xf'),'as':'Smtp','include':[{'model':_0x5dcd('0xd'),'attributes':['id',_0x5dcd('0x4'),_0x5dcd('0x6'),_0x5dcd('0x10'),_0x5dcd('0xe')],'as':_0x5dcd('0xd')}]}]},'log':_0x5dcd('0x11')});};};exports['notify']=function(_0x5873c8,_0x6de207){return client[_0x5dcd('0x2')]('NotifyMailAccount',{'account':{'id':_0x5873c8},'body':_0x6de207,'log':_0x5dcd('0x12')});}; \ No newline at end of file +var _0x4c41=['Imap','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','key','ListId','TemplateId','MailServerIn'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4c41,0xda));var _0x14c4=function(_0x4a1933,_0x375da7){_0x4a1933=_0x4a1933-0x0;var _0x533553=_0x4c41[_0x4a1933];return _0x533553;};'use strict';var client=require(_0x14c4('0x0'));exports[_0x14c4('0x1')]=function(){return function(){return client[_0x14c4('0x2')](_0x14c4('0x3'),{'options':{'attributes':['id',_0x14c4('0x4'),'provider',_0x14c4('0x5'),'email','active',_0x14c4('0x6'),_0x14c4('0x7'),_0x14c4('0x8')],'raw':![],'include':[{'model':_0x14c4('0x9'),'as':_0x14c4('0xa'),'include':[{'model':_0x14c4('0xb'),'attributes':['id','name',_0x14c4('0x5'),_0x14c4('0xc'),'data5'],'as':_0x14c4('0xb')}]},{'model':_0x14c4('0xd'),'as':_0x14c4('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x14c4('0x4'),_0x14c4('0x5'),'type',_0x14c4('0xf')],'as':_0x14c4('0xb')}]}]},'log':_0x14c4('0x10')});};};exports[_0x14c4('0x11')]=function(_0x4c8ea3,_0xdaf2cf){return client['Request']('NotifyMailAccount',{'account':{'id':_0x4c8ea3},'body':_0xdaf2cf,'log':_0x14c4('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 1c631ab..49d1c64 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 _0x5ddc=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x104c7a,_0x219911){var _0x2a7492=function(_0x40047e){while(--_0x40047e){_0x104c7a['push'](_0x104c7a['shift']());}};_0x2a7492(++_0x219911);}(_0x5ddc,0x14d));var _0xc5dd=function(_0x4afb20,_0xc39d7b){_0x4afb20=_0x4afb20-0x0;var _0x3947ad=_0x5ddc[_0x4afb20];return _0x3947ad;};'use strict';var client=require(_0xc5dd('0x0'));exports[_0xc5dd('0x1')]=function(){return client[_0xc5dd('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5dd('0x3')]},'log':_0xc5dd('0x4')});}; \ No newline at end of file +var _0xfee8=['loginMailFrequency','GetSettings','getSettings','Request'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xfee8,0x14a));var _0x8fee=function(_0x34ac64,_0x23f246){_0x34ac64=_0x34ac64-0x0;var _0xae8ae9=_0xfee8[_0x34ac64];return _0xae8ae9;};'use strict';var client=require('../client');exports[_0x8fee('0x0')]=function(){return client[_0x8fee('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8fee('0x2')]},'log':_0x8fee('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f4af34e..3a00972 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(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 cf687a3..5bda7d0 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 _0x5fe6=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','express','sticky-session','ioredis','../../config/environment','listen','socket.io','websocket','polling','redis','localhost','../../config/triggers','default','once','log'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x5fe6,0x123));var _0x65fe=function(_0x5e1fb8,_0x4e7879){_0x5e1fb8=_0x5e1fb8-0x0;var _0x2406da=_0x5fe6[_0x5e1fb8];return _0x2406da;};'use strict';var _=require(_0x65fe('0x0'));var http=require('http');var express=require(_0x65fe('0x1'));var sticky=require(_0x65fe('0x2'));var Redis=require(_0x65fe('0x3'));var config=require(_0x65fe('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x65fe('0x5')](server,config['port'])){var socketio=require(_0x65fe('0x6'))(server,{'transports':[_0x65fe('0x7'),_0x65fe('0x8')]});config[_0x65fe('0x9')]=_['defaults'](config['redis'],{'host':_0x65fe('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x65fe('0x9')]),'subClient':new Redis(config[_0x65fe('0x9')])}));require(_0x65fe('0xb'))['default']();require('../../config/socketio')[_0x65fe('0xc')](socketio);require('../../config/express')[_0x65fe('0xc')](app);require('../../routes')[_0x65fe('0xc')](app);}else{server[_0x65fe('0xd')]('listening',function(){console[_0x65fe('0xe')](_0x65fe('0xf'),config[_0x65fe('0x10')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xcf60=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','createServer','timeout','listen','socket.io','polling','redis'];(function(_0x29a2ff,_0x42a5cf){var _0x35fbb5=function(_0x358e35){while(--_0x358e35){_0x29a2ff['push'](_0x29a2ff['shift']());}};_0x35fbb5(++_0x42a5cf);}(_0xcf60,0x1c4));var _0x0cf6=function(_0x5c3d7c,_0xfd05cc){_0x5c3d7c=_0x5c3d7c-0x0;var _0xcb1e2f=_0xcf60[_0x5c3d7c];return _0xcb1e2f;};'use strict';var _=require(_0x0cf6('0x0'));var http=require(_0x0cf6('0x1'));var express=require('express');var sticky=require(_0x0cf6('0x2'));var Redis=require(_0x0cf6('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x0cf6('0x4')](app);server[_0x0cf6('0x5')]=0xdbba0;if(sticky[_0x0cf6('0x6')](server,config['port'])){var socketio=require(_0x0cf6('0x7'))(server,{'transports':['websocket',_0x0cf6('0x8')]});config[_0x0cf6('0x9')]=_[_0x0cf6('0xa')](config['redis'],{'host':_0x0cf6('0xb'),'port':0x18eb});socketio[_0x0cf6('0xc')](require(_0x0cf6('0xd'))({'pubClient':new Redis(config[_0x0cf6('0x9')]),'subClient':new Redis(config[_0x0cf6('0x9')])}));require(_0x0cf6('0xe'))[_0x0cf6('0xf')]();require(_0x0cf6('0x10'))['default'](socketio);require(_0x0cf6('0x11'))[_0x0cf6('0xf')](app);require(_0x0cf6('0x12'))[_0x0cf6('0xf')](app);}else{server['once']('listening',function(){console[_0x0cf6('0x13')](_0x0cf6('0x14'),config['port']);});}exports=module[_0x0cf6('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 443a4a6..c1823cc 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 _0xa411=['routing','exports','bluebird','../../config/logger','client','http','Request','then','debug','rpc','error','result','catch'];(function(_0x3a2a87,_0x4b34f0){var _0x525f7a=function(_0x2400ad){while(--_0x2400ad){_0x3a2a87['push'](_0x3a2a87['shift']());}};_0x525f7a(++_0x4b34f0);}(_0xa411,0x13a));var _0x1a41=function(_0xb07bff,_0x58193b){_0xb07bff=_0xb07bff-0x0;var _0x4c60f6=_0xa411[_0xb07bff];return _0x4c60f6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1a41('0x0'));var logger=require(_0x1a41('0x1'))('routing');var client=jayson[_0x1a41('0x2')][_0x1a41('0x3')]({'port':0x2329});client[_0x1a41('0x4')]=function(_0x20a3b2,_0x19a962){return new BPromise(function(_0x25611a,_0x25c440){return client['request'](_0x20a3b2,_0x19a962)[_0x1a41('0x5')](function(_0x3d4067){logger[_0x1a41('0x6')](_0x1a41('0x7'),'routing',_0x20a3b2,_0x19a962,_0x3d4067);if(_0x3d4067[_0x1a41('0x8')]){logger[_0x1a41('0x8')]('rpc','routing',_0x20a3b2,_0x3d4067[_0x1a41('0x8')]['message'],_0x19a962);return _0x25c440(_0x3d4067[_0x1a41('0x8')]['message']);}else{return _0x25611a(_0x3d4067[_0x1a41('0x9')]);}})[_0x1a41('0xa')](function(_0x252196){logger[_0x1a41('0x8')]('rpc',_0x1a41('0xb'),_0x20a3b2,_0x252196,_0x19a962);return _0x25c440(_0x252196);});});};module[_0x1a41('0xc')]=client; \ No newline at end of file +var _0x230f=['client','http','Request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','routing'];(function(_0x3ae285,_0x27a64f){var _0x38de01=function(_0xdd2ac8){while(--_0xdd2ac8){_0x3ae285['push'](_0x3ae285['shift']());}};_0x38de01(++_0x27a64f);}(_0x230f,0x1eb));var _0xf230=function(_0x2a8841,_0x355633){_0x2a8841=_0x2a8841-0x0;var _0x164f64=_0x230f[_0x2a8841];return _0x164f64;};'use strict';var jayson=require(_0xf230('0x0'));var BPromise=require(_0xf230('0x1'));var logger=require('../../config/logger')(_0xf230('0x2'));var client=jayson[_0xf230('0x3')][_0xf230('0x4')]({'port':0x2329});client[_0xf230('0x5')]=function(_0x5785fe,_0x304415){return new BPromise(function(_0x2254e3,_0x2be505){return client['request'](_0x5785fe,_0x304415)[_0xf230('0x6')](function(_0x1e31f0){logger[_0xf230('0x7')](_0xf230('0x8'),_0xf230('0x2'),_0x5785fe,_0x304415,_0x1e31f0);if(_0x1e31f0[_0xf230('0x9')]){logger[_0xf230('0x9')](_0xf230('0x8'),'routing',_0x5785fe,_0x1e31f0['error'][_0xf230('0xa')],_0x304415);return _0x2be505(_0x1e31f0[_0xf230('0x9')][_0xf230('0xa')]);}else{return _0x2254e3(_0x1e31f0[_0xf230('0xb')]);}})['catch'](function(_0xecb375){logger[_0xf230('0x9')](_0xf230('0x8'),_0xf230('0x2'),_0x5785fe,_0xecb375,_0x304415);return _0x2be505(_0xecb375);});});};module[_0xf230('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6756814..07f4479 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 _0xdddc=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','getWhatsappQueues','catch','log','bluebird','./realtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdddc,0x1b7));var _0xcddd=function(_0x483208,_0x1ac290){_0x483208=_0x483208-0x0;var _0x139673=_0xdddc[_0x483208];return _0x139673;};'use strict';var BPromise=require(_0xcddd('0x0'));var server=require('./server');var Realtime=require(_0xcddd('0x1'));var user=require(_0xcddd('0x2'));var interval=require(_0xcddd('0x3'));var openchannelQueue=require(_0xcddd('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xcddd('0x5'));var mailQueue=require(_0xcddd('0x6'));var faxQueue=require(_0xcddd('0x7'));var whatsappQueue=require(_0xcddd('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xcddd('0x9')](user[_0xcddd('0xa')]())['then'](realtime[_0xcddd('0xb')]())[_0xcddd('0x9')](interval['getIntervals']())[_0xcddd('0x9')](realtime[_0xcddd('0xc')]())[_0xcddd('0x9')](openchannelQueue[_0xcddd('0xd')]())[_0xcddd('0x9')](realtime[_0xcddd('0xe')]())[_0xcddd('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xcddd('0xf')]())[_0xcddd('0x9')](smsQueue['getSmsQueues']())[_0xcddd('0x9')](realtime[_0xcddd('0x10')]())[_0xcddd('0x9')](mailQueue[_0xcddd('0x11')]())[_0xcddd('0x9')](realtime['initMailQueues']())[_0xcddd('0x9')](faxQueue['getFaxQueues']())[_0xcddd('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xcddd('0x12')]())['then'](realtime['initWhatsappQueues']())[_0xcddd('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x1bb6a6){return initRealtime();})['then'](function(_0x23a0b4){return setInterval(initRealtime,0x1388);})[_0xcddd('0x13')](function(_0x4e4ff4){console[_0xcddd('0x14')](_0x4e4ff4);});}main(); \ No newline at end of file +var _0x1052=['./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval'];(function(_0x3fb947,_0x162636){var _0x2ced66=function(_0x2fb579){while(--_0x2fb579){_0x3fb947['push'](_0x3fb947['shift']());}};_0x2ced66(++_0x162636);}(_0x1052,0xcb));var _0x2105=function(_0x2cd809,_0x4cdedd){_0x2cd809=_0x2cd809-0x0;var _0x5a1519=_0x1052[_0x2cd809];return _0x5a1519;};'use strict';var BPromise=require(_0x2105('0x0'));var server=require(_0x2105('0x1'));var Realtime=require(_0x2105('0x2'));var user=require(_0x2105('0x3'));var interval=require(_0x2105('0x4'));var openchannelQueue=require(_0x2105('0x5'));var chatQueue=require(_0x2105('0x6'));var smsQueue=require(_0x2105('0x7'));var mailQueue=require(_0x2105('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x2105('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2105('0xa')]()[_0x2105('0xb')](user[_0x2105('0xc')]())[_0x2105('0xb')](realtime['initAgents']())[_0x2105('0xb')](interval[_0x2105('0xd')]())['then'](realtime['initIntervals']())[_0x2105('0xb')](openchannelQueue[_0x2105('0xe')]())[_0x2105('0xb')](realtime[_0x2105('0xf')]())[_0x2105('0xb')](chatQueue[_0x2105('0x10')]())['then'](realtime[_0x2105('0x11')]())[_0x2105('0xb')](smsQueue['getSmsQueues']())[_0x2105('0xb')](realtime['initSmsQueues']())[_0x2105('0xb')](mailQueue[_0x2105('0x12')]())[_0x2105('0xb')](realtime[_0x2105('0x13')]())[_0x2105('0xb')](faxQueue[_0x2105('0x14')]())['then'](realtime['initFaxQueues']())[_0x2105('0xb')](whatsappQueue[_0x2105('0x15')]())['then'](realtime[_0x2105('0x16')]())[_0x2105('0xb')](function(){return realtime;});}function main(){return server[_0x2105('0x17')](realtime)[_0x2105('0xb')](function(_0x5dc797){return initRealtime();})[_0x2105('0xb')](function(_0x86bfee){return setInterval(initRealtime,0x1388);})[_0x2105('0x18')](function(_0x176a90){console[_0x2105('0x19')](_0x176a90);});}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 156adca..177dd7e 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x1261[_0x285824];return _0x311d7e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x38d852,_0x5ce645){var _0x105103=function(_0x5d2805){while(--_0x5d2805){_0x38d852['push'](_0x38d852['shift']());}};_0x105103(++_0x5ce645);}(_0x326f,0xd1));var _0xf326=function(_0x11bc7c,_0x53de6e){_0x11bc7c=_0x11bc7c-0x0;var _0x58c715=_0x326f[_0x11bc7c];return _0x58c715;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index a1151f1..ec76372 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 _0xe8e9=['bluebird','jayson/promise','client','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0xe8e9,0x82));var _0x9e8e=function(_0x28ffc5,_0xe9b237){_0x28ffc5=_0x28ffc5-0x0;var _0x20bdcd=_0xe8e9[_0x28ffc5];return _0x20bdcd;};'use strict';var BPromise=require(_0x9e8e('0x0'));var jayson=require(_0x9e8e('0x1'));var client=jayson[_0x9e8e('0x2')]['http']({'port':0x232b});function request(_0x47b9df,_0x2cc296){return new BPromise(function(_0x1e9026,_0x307f87){return client[_0x9e8e('0x3')](_0x47b9df,_0x2cc296)[_0x9e8e('0x4')](function(_0x3f52b7){if(_0x3f52b7[_0x9e8e('0x5')]){return _0x307f87(_0x3f52b7[_0x9e8e('0x5')][_0x9e8e('0x6')]);}else{return _0x1e9026(_0x3f52b7['result']);}})[_0x9e8e('0x7')](function(_0x2ac82d){return _0x307f87(_0x2ac82d);});});}exports[_0x9e8e('0x8')]=function(_0x23b402,_0x867f68){return request(_0x9e8e('0x9'),{'account':_0x23b402,'message':_0x867f68});}; \ No newline at end of file +var _0x603d=['http','request','error','message','result','catch','SendMail','client'];(function(_0x1bb11e,_0x58fd78){var _0x422492=function(_0x5d8dfd){while(--_0x5d8dfd){_0x1bb11e['push'](_0x1bb11e['shift']());}};_0x422492(++_0x58fd78);}(_0x603d,0xc7));var _0xd603=function(_0x3ecebf,_0x11d3f1){_0x3ecebf=_0x3ecebf-0x0;var _0x452aa8=_0x603d[_0x3ecebf];return _0x452aa8;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xd603('0x0')][_0xd603('0x1')]({'port':0x232b});function request(_0x4946eb,_0x300896){return new BPromise(function(_0x515163,_0x139721){return client[_0xd603('0x2')](_0x4946eb,_0x300896)['then'](function(_0x49b97d){if(_0x49b97d[_0xd603('0x3')]){return _0x139721(_0x49b97d['error'][_0xd603('0x4')]);}else{return _0x515163(_0x49b97d[_0xd603('0x5')]);}})[_0xd603('0x6')](function(_0x184614){return _0x139721(_0x184614);});});}exports['sendMailMessage']=function(_0x350b5d,_0x1eff70){return request(_0xd603('0x7'),{'account':_0x350b5d,'message':_0x1eff70});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 417c4c9..606edc2 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 _0x3f40=['whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','online','chatStatusTime','mailStatus','faxStatusTime','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','emit','user:save','exports','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3f40,0xe0));var _0x03f4=function(_0x49ea92,_0x3900ef){_0x49ea92=_0x49ea92-0x0;var _0x3feb57=_0x3f40[_0x49ea92];return _0x3feb57;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x03f4('0x0'));config['redis']=_[_0x03f4('0x1')](config[_0x03f4('0x2')],{'host':_0x03f4('0x3'),'port':0x18eb});var io=require(_0x03f4('0x4'))(new Redis(config['redis']));function Agent(_0x157c36){this['id']=_0x157c36['id']||0x0;this[_0x03f4('0x5')]=_0x157c36[_0x03f4('0x5')]||'';this['online']=_0x157c36['online']||!![];this[_0x03f4('0x6')]=_0x157c36[_0x03f4('0x6')]||![];this[_0x03f4('0x7')]=_0x157c36['chatPause']||![];this[_0x03f4('0x8')]=_0x157c36[_0x03f4('0x8')]||![];this['faxPause']=_0x157c36[_0x03f4('0x9')]||![];this[_0x03f4('0xa')]=_0x157c36[_0x03f4('0xa')]||![];this[_0x03f4('0xb')]=_0x157c36[_0x03f4('0xb')]||![];this[_0x03f4('0xc')]=_0x03f4('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x157c36[_0x03f4('0xe')]||0x0;this[_0x03f4('0xf')]=0x0;this['mailStatus']=_0x03f4('0xd');this[_0x03f4('0x10')]=0x0;this['mailCapacity']=_0x157c36[_0x03f4('0x11')]||0x0;this[_0x03f4('0x12')]=0x0;this[_0x03f4('0x13')]=_0x03f4('0xd');this['faxStatusTime']=0x0;this[_0x03f4('0x14')]=_0x157c36[_0x03f4('0x14')]||0x0;this[_0x03f4('0x15')]=0x0;this[_0x03f4('0x16')]='unknown';this['smsStatusTime']=0x0;this[_0x03f4('0x17')]=_0x157c36[_0x03f4('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x03f4('0x18')]='unknown';this['whatsappStatusTime']=0x0;this[_0x03f4('0x19')]=_0x157c36['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x03f4('0xd');this[_0x03f4('0x1a')]=0x0;this['openchannelCapacity']=_0x157c36[_0x03f4('0x1b')]||0x0;this[_0x03f4('0x1c')]=0x0;this[_0x03f4('0x1d')]=![];this[_0x03f4('0x1e')]=undefined;this[_0x03f4('0x1f')]='';this[_0x03f4('0x20')]();}Agent[_0x03f4('0x21')][_0x03f4('0x22')]=function(_0x297a60){if(this[_0x297a60+'CurrentCapacity']>0x0){if(this[_0x297a60+_0x03f4('0x23')]>0x0&&this[_0x297a60+_0x03f4('0x24')]>=this[_0x297a60+_0x03f4('0x23')]){return _0x03f4('0x25');}else{return _0x03f4('0x26');}}else{return _0x03f4('0x27');}};Agent['prototype'][_0x03f4('0x20')]=function(){var _0x1a1d10=[_0x03f4('0x28'),_0x03f4('0x29'),_0x03f4('0x2a'),_0x03f4('0x2b'),_0x03f4('0x2c'),_0x03f4('0x2d')];for(var _0x42b358=0x0;_0x42b358<_0x1a1d10[_0x03f4('0x2e')];_0x42b358+=0x1){var _0x42a51d=this[_0x03f4('0x22')](_0x1a1d10[_0x42b358]);if(this[_0x1a1d10[_0x42b358]+'Status']!==_0x42a51d){this[_0x1a1d10[_0x42b358]+_0x03f4('0x2f')]=_[_0x03f4('0x30')](moment()[_0x03f4('0x31')]('x'));}this[_0x1a1d10[_0x42b358]+_0x03f4('0x32')]=_0x42a51d;}var _0x5529c1={'id':this['id'],'name':this[_0x03f4('0x5')],'online':this[_0x03f4('0x33')],'voicePause':this[_0x03f4('0x6')],'chatPause':this['chatPause'],'mailPause':this[_0x03f4('0x8')],'smsPause':this[_0x03f4('0xa')],'faxPause':this[_0x03f4('0x9')],'openchannelPause':this[_0x03f4('0xb')],'chatStatus':this[_0x03f4('0xc')],'chatStatusTime':this[_0x03f4('0x34')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x03f4('0x35')],'mailStatusTime':this[_0x03f4('0x10')],'mailCapacity':this[_0x03f4('0x11')],'mailCurrentCapacity':this[_0x03f4('0x12')],'faxStatus':this[_0x03f4('0x13')],'faxStatusTime':this[_0x03f4('0x36')],'faxCapacity':this[_0x03f4('0x14')],'faxCurrentCapacity':this[_0x03f4('0x15')],'smsStatus':this[_0x03f4('0x16')],'smsStatusTime':this[_0x03f4('0x37')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x03f4('0x38')],'whatsappStatus':this[_0x03f4('0x18')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x03f4('0x19')],'whatsappCurrentCapacity':this[_0x03f4('0x39')],'openchannelStatus':this[_0x03f4('0x3a')],'openchannelStatusTime':this[_0x03f4('0x1a')],'openchannelCapacity':this[_0x03f4('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x03f4('0x1d')],'busyQueue':this['busyQueue']};var _0x2c4832=md5(JSON['stringify'](_0x5529c1));if(this[_0x03f4('0x1f')]!==_0x2c4832){this[_0x03f4('0x1f')]=_0x2c4832;io[_0x03f4('0x3b')](_0x03f4('0x3c'),_0x5529c1);}};module[_0x03f4('0x3d')]=Agent; \ No newline at end of file +var _0x69c4=['stringify','emit','user:save','exports','lodash','moment','ioredis','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','getChannelStatus','Capacity','CurrentCapacity','working','idle','updateRealtime','chat','fax','sms','whatsapp','Status','StatusTime','toNumber','format','chatCurrentCapacity'];(function(_0x9c83e3,_0x460d22){var _0x5d1e0b=function(_0x1b45cc){while(--_0x1b45cc){_0x9c83e3['push'](_0x9c83e3['shift']());}};_0x5d1e0b(++_0x460d22);}(_0x69c4,0xf0));var _0x469c=function(_0x3d8a75,_0x33bb2b){_0x3d8a75=_0x3d8a75-0x0;var _0x209fa8=_0x69c4[_0x3d8a75];return _0x209fa8;};'use strict';var _=require(_0x469c('0x0'));var moment=require(_0x469c('0x1'));var md5=require('md5');var Redis=require(_0x469c('0x2'));var config=require('../../../config/environment');config[_0x469c('0x3')]=_[_0x469c('0x4')](config[_0x469c('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x469c('0x3')]));function Agent(_0x260cf8){this['id']=_0x260cf8['id']||0x0;this['name']=_0x260cf8[_0x469c('0x5')]||'';this['online']=_0x260cf8[_0x469c('0x6')]||!![];this[_0x469c('0x7')]=_0x260cf8[_0x469c('0x7')]||![];this[_0x469c('0x8')]=_0x260cf8[_0x469c('0x8')]||![];this['mailPause']=_0x260cf8[_0x469c('0x9')]||![];this[_0x469c('0xa')]=_0x260cf8[_0x469c('0xa')]||![];this[_0x469c('0xb')]=_0x260cf8['smsPause']||![];this[_0x469c('0xc')]=_0x260cf8['openchannelPause']||![];this[_0x469c('0xd')]=_0x469c('0xe');this['chatStatusTime']=0x0;this[_0x469c('0xf')]=_0x260cf8['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x469c('0x10')]=_0x469c('0xe');this[_0x469c('0x11')]=0x0;this[_0x469c('0x12')]=_0x260cf8[_0x469c('0x12')]||0x0;this[_0x469c('0x13')]=0x0;this[_0x469c('0x14')]=_0x469c('0xe');this[_0x469c('0x15')]=0x0;this['faxCapacity']=_0x260cf8[_0x469c('0x16')]||0x0;this[_0x469c('0x17')]=0x0;this[_0x469c('0x18')]=_0x469c('0xe');this[_0x469c('0x19')]=0x0;this[_0x469c('0x1a')]=_0x260cf8[_0x469c('0x1a')]||0x0;this[_0x469c('0x1b')]=0x0;this[_0x469c('0x1c')]='unknown';this[_0x469c('0x1d')]=0x0;this['whatsappCapacity']=_0x260cf8[_0x469c('0x1e')]||0x0;this[_0x469c('0x1f')]=0x0;this[_0x469c('0x20')]=_0x469c('0xe');this[_0x469c('0x21')]=0x0;this[_0x469c('0x22')]=_0x260cf8['openchannelCapacity']||0x0;this[_0x469c('0x23')]=0x0;this[_0x469c('0x24')]=![];this[_0x469c('0x25')]=undefined;this[_0x469c('0x26')]='';this['updateRealtime']();}Agent[_0x469c('0x27')][_0x469c('0x28')]=function(_0x37e45c){if(this[_0x37e45c+'CurrentCapacity']>0x0){if(this[_0x37e45c+_0x469c('0x29')]>0x0&&this[_0x37e45c+_0x469c('0x2a')]>=this[_0x37e45c+_0x469c('0x29')]){return'maxcapacity';}else{return _0x469c('0x2b');}}else{return _0x469c('0x2c');}};Agent[_0x469c('0x27')][_0x469c('0x2d')]=function(){var _0x252fdc=['mail',_0x469c('0x2e'),'openchannel',_0x469c('0x2f'),_0x469c('0x30'),_0x469c('0x31')];for(var _0x2b5844=0x0;_0x2b5844<_0x252fdc['length'];_0x2b5844+=0x1){var _0x3b2b2f=this['getChannelStatus'](_0x252fdc[_0x2b5844]);if(this[_0x252fdc[_0x2b5844]+_0x469c('0x32')]!==_0x3b2b2f){this[_0x252fdc[_0x2b5844]+_0x469c('0x33')]=_[_0x469c('0x34')](moment()[_0x469c('0x35')]('x'));}this[_0x252fdc[_0x2b5844]+_0x469c('0x32')]=_0x3b2b2f;}var _0x49444e={'id':this['id'],'name':this[_0x469c('0x5')],'online':this[_0x469c('0x6')],'voicePause':this[_0x469c('0x7')],'chatPause':this[_0x469c('0x8')],'mailPause':this[_0x469c('0x9')],'smsPause':this[_0x469c('0xb')],'faxPause':this[_0x469c('0xa')],'openchannelPause':this[_0x469c('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x469c('0xf')],'chatCurrentCapacity':this[_0x469c('0x36')],'mailStatus':this[_0x469c('0x10')],'mailStatusTime':this[_0x469c('0x11')],'mailCapacity':this[_0x469c('0x12')],'mailCurrentCapacity':this[_0x469c('0x13')],'faxStatus':this[_0x469c('0x14')],'faxStatusTime':this[_0x469c('0x15')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x469c('0x18')],'smsStatusTime':this[_0x469c('0x19')],'smsCapacity':this[_0x469c('0x1a')],'smsCurrentCapacity':this[_0x469c('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x469c('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x469c('0x21')],'openchannelCapacity':this[_0x469c('0x22')],'openchannelCurrentCapacity':this[_0x469c('0x23')],'busy':this[_0x469c('0x24')],'busyQueue':this[_0x469c('0x25')]};var _0x1b2df5=md5(JSON[_0x469c('0x37')](_0x49444e));if(this[_0x469c('0x26')]!==_0x1b2df5){this['md5']=_0x1b2df5;io[_0x469c('0x38')](_0x469c('0x39'),_0x49444e);}};module[_0x469c('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b4840cf..350b291 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 _0x9007=['online','loggedIn','chatPause','available','stringify','format','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused'];(function(_0x54d8ac,_0x213a23){var _0x28c4d2=function(_0x1690dc){while(--_0x1690dc){_0x54d8ac['push'](_0x54d8ac['shift']());}};_0x28c4d2(++_0x213a23);}(_0x9007,0x17e));var _0x7900=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x9007[_0x301148];return _0x42ce24;};'use strict';var _=require(_0x7900('0x0'));var md5=require(_0x7900('0x1'));var util=require(_0x7900('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7900('0x3')]=_['defaults'](config[_0x7900('0x3')],{'host':_0x7900('0x4'),'port':0x18eb});var io=require(_0x7900('0x5'))(new Redis(config[_0x7900('0x3')]));function ChatQueue(_0x1bd40f){this['id']=_0x1bd40f['id']||0x0;this[_0x7900('0x6')]=_0x1bd40f[_0x7900('0x6')]||'';this[_0x7900('0x7')]=_0x1bd40f['timeout']||0xa;this[_0x7900('0x8')]=_0x1bd40f['strategy']||_0x7900('0x9');this[_0x7900('0xa')]=_0x1bd40f['Agents'];this[_0x7900('0xb')]={};this[_0x7900('0xc')]=0x0;this[_0x7900('0x1')]='';this[_0x7900('0xd')]();this[_0x7900('0xe')]();}ChatQueue[_0x7900('0xf')]['updateRouting']=function(){var _0x315ef4=this[_0x7900('0xb')]['_rr'];this[_0x7900('0xb')]=_['map'](this[_0x7900('0xa')],'id');this[_0x7900('0xb')][_0x7900('0x10')]=_0x315ef4;};ChatQueue[_0x7900('0xf')][_0x7900('0xe')]=function(){this['loggedIn']=0x0;this[_0x7900('0x11')]=0x0;for(var _0x4063b1=0x0;_0x4063b1=0x0?this['available']:0x0;var _0x463554={'id':this['id'],'available':this[_0x7900('0x15')],'loggedIn':this[_0x7900('0x13')],'name':this[_0x7900('0x6')],'paused':this[_0x7900('0x11')],'waiting':this[_0x7900('0xc')]};var _0x2f0314=md5(JSON[_0x7900('0x16')](_0x463554));if(this['md5']!==_0x2f0314){this[_0x7900('0x1')]=_0x2f0314;io['to'](util[_0x7900('0x17')]('chat:queue:%s',_0x463554[_0x7900('0x6')]))['emit']('chat_queue:save',_0x463554);}};module[_0x7900('0x18')]=ChatQueue; \ No newline at end of file +var _0x05b4=['emit','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','chatPause','available','waiting','stringify','format','chat:queue:%s'];(function(_0x3fb13f,_0x1fabe7){var _0x94344c=function(_0x5ab3e4){while(--_0x5ab3e4){_0x3fb13f['push'](_0x3fb13f['shift']());}};_0x94344c(++_0x1fabe7);}(_0x05b4,0xbe));var _0x405b=function(_0x300441,_0xcb59ad){_0x300441=_0x300441-0x0;var _0x16899f=_0x05b4[_0x300441];return _0x16899f;};'use strict';var _=require('lodash');var md5=require(_0x405b('0x0'));var util=require(_0x405b('0x1'));var Redis=require(_0x405b('0x2'));var config=require(_0x405b('0x3'));config[_0x405b('0x4')]=_[_0x405b('0x5')](config[_0x405b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x405b('0x6'))(new Redis(config[_0x405b('0x4')]));function ChatQueue(_0x1364c6){this['id']=_0x1364c6['id']||0x0;this[_0x405b('0x7')]=_0x1364c6[_0x405b('0x7')]||'';this[_0x405b('0x8')]=_0x1364c6[_0x405b('0x8')]||0xa;this[_0x405b('0x9')]=_0x1364c6[_0x405b('0x9')]||'beepall';this[_0x405b('0xa')]=_0x1364c6[_0x405b('0xa')];this[_0x405b('0xb')]={};this['waiting']=0x0;this[_0x405b('0x0')]='';this[_0x405b('0xc')]();this[_0x405b('0xd')]();}ChatQueue[_0x405b('0xe')][_0x405b('0xc')]=function(){var _0x2db6d1=this[_0x405b('0xb')]['_rr'];this[_0x405b('0xb')]=_[_0x405b('0xf')](this[_0x405b('0xa')],'id');this[_0x405b('0xb')][_0x405b('0x10')]=_0x2db6d1;};ChatQueue['prototype'][_0x405b('0xd')]=function(){this[_0x405b('0x11')]=0x0;this[_0x405b('0x12')]=0x0;for(var _0x1243f6=0x0;_0x1243f6=0x0?this[_0x405b('0x15')]:0x0;var _0x41cecd={'id':this['id'],'available':this[_0x405b('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x405b('0x7')],'paused':this['paused'],'waiting':this[_0x405b('0x16')]};var _0x24a818=md5(JSON[_0x405b('0x17')](_0x41cecd));if(this[_0x405b('0x0')]!==_0x24a818){this['md5']=_0x24a818;io['to'](util[_0x405b('0x18')](_0x405b('0x19'),_0x41cecd['name']))[_0x405b('0x1a')]('chat_queue:save',_0x41cecd);}};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 dc8a198..55bc3a9 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 _0x22d1=['map','_rr','loggedIn','paused','length','online','faxPause','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype'];(function(_0x3f1132,_0x103f8e){var _0x2f2ef8=function(_0x41ecbe){while(--_0x41ecbe){_0x3f1132['push'](_0x3f1132['shift']());}};_0x2f2ef8(++_0x103f8e);}(_0x22d1,0x110));var _0x122d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x22d1[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x122d('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x122d('0x1'));config[_0x122d('0x2')]=_[_0x122d('0x3')](config[_0x122d('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x122d('0x4'))(new Redis(config[_0x122d('0x2')]));function FaxQueue(_0x56ca2d){this['id']=_0x56ca2d['id']||0x0;this[_0x122d('0x5')]=_0x56ca2d[_0x122d('0x5')]||'';this[_0x122d('0x6')]=_0x56ca2d[_0x122d('0x6')]||0xa;this[_0x122d('0x7')]=_0x56ca2d['strategy']||'beepall';this[_0x122d('0x8')]=_0x56ca2d['Agents'];this[_0x122d('0x9')]={};this[_0x122d('0xa')]=0x0;this[_0x122d('0xb')]='';this['updateRouting']();this[_0x122d('0xc')]();}FaxQueue[_0x122d('0xd')]['updateRouting']=function(){var _0x59b340=this[_0x122d('0x9')]['_rr'];this[_0x122d('0x9')]=_[_0x122d('0xe')](this[_0x122d('0x8')],'id');this[_0x122d('0x9')][_0x122d('0xf')]=_0x59b340;};FaxQueue[_0x122d('0xd')][_0x122d('0xc')]=function(){this[_0x122d('0x10')]=0x0;this[_0x122d('0x11')]=0x0;for(var _0x1a0f27=0x0;_0x1a0f27=0x0?this[_0x122d('0x15')]:0x0;var _0x588df1={'id':this['id'],'available':this[_0x122d('0x15')],'loggedIn':this[_0x122d('0x10')],'name':this[_0x122d('0x5')],'paused':this['paused'],'waiting':this[_0x122d('0xa')]};var _0x391b48=md5(JSON['stringify'](_0x588df1));if(this[_0x122d('0xb')]!==_0x391b48){this[_0x122d('0xb')]=_0x391b48;io['to'](util['format'](_0x122d('0x16'),_0x588df1['name']))[_0x122d('0x17')](_0x122d('0x18'),_0x588df1);}};module[_0x122d('0x19')]=FaxQueue; \ No newline at end of file +var _0x3da2=['defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis'];(function(_0x19f33c,_0x4622c9){var _0x4954af=function(_0x3ebcb7){while(--_0x3ebcb7){_0x19f33c['push'](_0x19f33c['shift']());}};_0x4954af(++_0x4622c9);}(_0x3da2,0x1f3));var _0x23da=function(_0x38a88a,_0x19aa68){_0x38a88a=_0x38a88a-0x0;var _0x55837d=_0x3da2[_0x38a88a];return _0x55837d;};'use strict';var _=require(_0x23da('0x0'));var md5=require(_0x23da('0x1'));var util=require(_0x23da('0x2'));var Redis=require('ioredis');var config=require(_0x23da('0x3'));config[_0x23da('0x4')]=_[_0x23da('0x5')](config[_0x23da('0x4')],{'host':_0x23da('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x2f9b9c){this['id']=_0x2f9b9c['id']||0x0;this[_0x23da('0x7')]=_0x2f9b9c['name']||'';this['timeout']=_0x2f9b9c[_0x23da('0x8')]||0xa;this['strategy']=_0x2f9b9c['strategy']||_0x23da('0x9');this['Agents']=_0x2f9b9c[_0x23da('0xa')];this[_0x23da('0xb')]={};this[_0x23da('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype']['updateRouting']=function(){var _0x59ac08=this[_0x23da('0xb')][_0x23da('0xd')];this['mapAgentsId']=_[_0x23da('0xe')](this['Agents'],'id');this[_0x23da('0xb')][_0x23da('0xd')]=_0x59ac08;};FaxQueue[_0x23da('0xf')]['updateRealtime']=function(){this[_0x23da('0x10')]=0x0;this[_0x23da('0x11')]=0x0;for(var _0x2c1b26=0x0;_0x2c1b26=0x0?this['available']:0x0;var _0x3bbf59={'id':this['id'],'available':this['available'],'loggedIn':this[_0x23da('0x10')],'name':this[_0x23da('0x7')],'paused':this[_0x23da('0x11')],'waiting':this[_0x23da('0xc')]};var _0x4f76ac=md5(JSON[_0x23da('0x16')](_0x3bbf59));if(this[_0x23da('0x1')]!==_0x4f76ac){this[_0x23da('0x1')]=_0x4f76ac;io['to'](util[_0x23da('0x17')](_0x23da('0x18'),_0x3bbf59['name']))[_0x23da('0x19')](_0x23da('0x1a'),_0x3bbf59);}};module[_0x23da('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d1fff3f..9c89496 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 _0x06fc=['exports','name','Intervals'];(function(_0x44a6bf,_0x2c7883){var _0x515b54=function(_0x22ae4b){while(--_0x22ae4b){_0x44a6bf['push'](_0x44a6bf['shift']());}};_0x515b54(++_0x2c7883);}(_0x06fc,0x10f));var _0xc06f=function(_0x320968,_0x171dcf){_0x320968=_0x320968-0x0;var _0x404e2a=_0x06fc[_0x320968];return _0x404e2a;};'use strict';function Interval(_0x867b26){this['id']=_0x867b26['id']||0x0;this[_0xc06f('0x0')]=_0x867b26['name']||'';this[_0xc06f('0x1')]=_0x867b26[_0xc06f('0x1')]||{};}module[_0xc06f('0x2')]=Interval; \ No newline at end of file +var _0xd358=['Intervals','exports','name'];(function(_0x58dc8a,_0x1765da){var _0x9461c4=function(_0x2dddc7){while(--_0x2dddc7){_0x58dc8a['push'](_0x58dc8a['shift']());}};_0x9461c4(++_0x1765da);}(_0xd358,0x1a9));var _0x8d35=function(_0x1b1384,_0x174dd0){_0x1b1384=_0x1b1384-0x0;var _0x19618a=_0xd358[_0x1b1384];return _0x19618a;};'use strict';function Interval(_0x2c3b04){this['id']=_0x2c3b04['id']||0x0;this[_0x8d35('0x0')]=_0x2c3b04[_0x8d35('0x0')]||'';this[_0x8d35('0x1')]=_0x2c3b04[_0x8d35('0x1')]||{};}module[_0x8d35('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b84ed0f..2e7665d 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 _0xaa43=['loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x44ea11,_0x542e9b){var _0x5936c2=function(_0xb5256f){while(--_0xb5256f){_0x44ea11['push'](_0x44ea11['shift']());}};_0x5936c2(++_0x542e9b);}(_0xaa43,0x1bd));var _0x3aa4=function(_0x3e061f,_0x336054){_0x3e061f=_0x3e061f-0x0;var _0x2dd5bf=_0xaa43[_0x3e061f];return _0x2dd5bf;};'use strict';var _=require(_0x3aa4('0x0'));var md5=require(_0x3aa4('0x1'));var util=require('util');var Redis=require(_0x3aa4('0x2'));var config=require(_0x3aa4('0x3'));config['redis']=_[_0x3aa4('0x4')](config[_0x3aa4('0x5')],{'host':_0x3aa4('0x6'),'port':0x18eb});var io=require(_0x3aa4('0x7'))(new Redis(config[_0x3aa4('0x5')]));function MailQueue(_0x1c35cd){this['id']=_0x1c35cd['id']||0x0;this[_0x3aa4('0x8')]=_0x1c35cd[_0x3aa4('0x8')]||'';this['timeout']=_0x1c35cd[_0x3aa4('0x9')]||0xa;this[_0x3aa4('0xa')]=_0x1c35cd['strategy']||_0x3aa4('0xb');this[_0x3aa4('0xc')]=_0x1c35cd[_0x3aa4('0xc')];this[_0x3aa4('0xd')]={};this[_0x3aa4('0xe')]=0x0;this[_0x3aa4('0x1')]='';this[_0x3aa4('0xf')]();this[_0x3aa4('0x10')]();}MailQueue[_0x3aa4('0x11')][_0x3aa4('0xf')]=function(){var _0x50cfb6=this['mapAgentsId'][_0x3aa4('0x12')];this[_0x3aa4('0xd')]=_[_0x3aa4('0x13')](this[_0x3aa4('0xc')],'id');this[_0x3aa4('0xd')][_0x3aa4('0x12')]=_0x50cfb6;};MailQueue[_0x3aa4('0x11')]['updateRealtime']=function(){this[_0x3aa4('0x14')]=0x0;this['paused']=0x0;for(var _0x135248=0x0;_0x135248=0x0?this['available']:0x0;var _0x4dc522={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3aa4('0x14')],'name':this[_0x3aa4('0x8')],'paused':this[_0x3aa4('0x18')],'waiting':this['waiting']};var _0xeb9337=md5(JSON[_0x3aa4('0x1a')](_0x4dc522));if(this[_0x3aa4('0x1')]!==_0xeb9337){this[_0x3aa4('0x1')]=_0xeb9337;io['to'](util[_0x3aa4('0x1b')](_0x3aa4('0x1c'),_0x4dc522[_0x3aa4('0x8')]))[_0x3aa4('0x1d')](_0x3aa4('0x1e'),_0x4dc522);}};module['exports']=MailQueue; \ No newline at end of file +var _0x6459=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','mailPause','available','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x4c29f9,_0x5bddd4){var _0x4e17b8=function(_0x12e055){while(--_0x12e055){_0x4c29f9['push'](_0x4c29f9['shift']());}};_0x4e17b8(++_0x5bddd4);}(_0x6459,0xfb));var _0x9645=function(_0x104ef4,_0x52f1d9){_0x104ef4=_0x104ef4-0x0;var _0x26c030=_0x6459[_0x104ef4];return _0x26c030;};'use strict';var _=require(_0x9645('0x0'));var md5=require(_0x9645('0x1'));var util=require(_0x9645('0x2'));var Redis=require('ioredis');var config=require(_0x9645('0x3'));config[_0x9645('0x4')]=_[_0x9645('0x5')](config[_0x9645('0x4')],{'host':_0x9645('0x6'),'port':0x18eb});var io=require(_0x9645('0x7'))(new Redis(config[_0x9645('0x4')]));function MailQueue(_0x46d29a){this['id']=_0x46d29a['id']||0x0;this[_0x9645('0x8')]=_0x46d29a['name']||'';this[_0x9645('0x9')]=_0x46d29a[_0x9645('0x9')]||0xa;this[_0x9645('0xa')]=_0x46d29a['strategy']||_0x9645('0xb');this['Agents']=_0x46d29a[_0x9645('0xc')];this[_0x9645('0xd')]={};this[_0x9645('0xe')]=0x0;this[_0x9645('0x1')]='';this[_0x9645('0xf')]();this[_0x9645('0x10')]();}MailQueue[_0x9645('0x11')][_0x9645('0xf')]=function(){var _0x30e115=this[_0x9645('0xd')][_0x9645('0x12')];this['mapAgentsId']=_['map'](this[_0x9645('0xc')],'id');this['mapAgentsId'][_0x9645('0x12')]=_0x30e115;};MailQueue[_0x9645('0x11')][_0x9645('0x10')]=function(){this[_0x9645('0x13')]=0x0;this[_0x9645('0x14')]=0x0;for(var _0x3e9bc0=0x0;_0x3e9bc0=0x0?this[_0x9645('0x16')]:0x0;var _0x406a0c={'id':this['id'],'available':this[_0x9645('0x16')],'loggedIn':this[_0x9645('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9645('0xe')]};var _0x5c4c06=md5(JSON['stringify'](_0x406a0c));if(this['md5']!==_0x5c4c06){this['md5']=_0x5c4c06;io['to'](util['format'](_0x9645('0x17'),_0x406a0c[_0x9645('0x8')]))['emit'](_0x9645('0x18'),_0x406a0c);}};module[_0x9645('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index bf78ffb..b4d952b 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x7a54,0x106));var _0x47a5=function(_0x1a531d,_0x1c3a76){_0x1a531d=_0x1a531d-0x0;var _0x491a2f=_0x7a54[_0x1a531d];return _0x491a2f;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0xa76db3,_0xf8fd0){var _0x47338e=function(_0x3163b6){while(--_0x3163b6){_0xa76db3['push'](_0xa76db3['shift']());}};_0x47338e(++_0xf8fd0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x5fc3[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b859f37..7308db8 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 _0x3248=['_rr','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map'];(function(_0x451ce0,_0x3d5e2f){var _0x4808d2=function(_0x29ddc1){while(--_0x29ddc1){_0x451ce0['push'](_0x451ce0['shift']());}};_0x4808d2(++_0x3d5e2f);}(_0x3248,0x1bc));var _0x8324=function(_0x192566,_0x260c55){_0x192566=_0x192566-0x0;var _0x405259=_0x3248[_0x192566];return _0x405259;};'use strict';var _=require('lodash');var md5=require(_0x8324('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x8324('0x1'));config[_0x8324('0x2')]=_[_0x8324('0x3')](config[_0x8324('0x2')],{'host':_0x8324('0x4'),'port':0x18eb});var io=require(_0x8324('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1d1033){this['id']=_0x1d1033['id']||0x0;this[_0x8324('0x6')]=_0x1d1033['name']||'';this[_0x8324('0x7')]=_0x1d1033[_0x8324('0x7')]||0xa;this[_0x8324('0x8')]=_0x1d1033[_0x8324('0x8')]||'beepall';this[_0x8324('0x9')]=_0x1d1033[_0x8324('0x9')];this[_0x8324('0xa')]={};this[_0x8324('0xb')]=0x0;this['md5']='';this[_0x8324('0xc')]();this[_0x8324('0xd')]();}SmsQueue['prototype'][_0x8324('0xc')]=function(){var _0x2c190e=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x8324('0xe')](this[_0x8324('0x9')],'id');this[_0x8324('0xa')][_0x8324('0xf')]=_0x2c190e;};SmsQueue['prototype'][_0x8324('0xd')]=function(){this[_0x8324('0x10')]=0x0;this[_0x8324('0x11')]=0x0;for(var _0x13a81f=0x0;_0x13a81f=0x0?this['available']:0x0;var _0x47b5e1={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8324('0x10')],'name':this[_0x8324('0x6')],'paused':this[_0x8324('0x11')],'waiting':this[_0x8324('0xb')]};var _0x50508e=md5(JSON[_0x8324('0x15')](_0x47b5e1));if(this[_0x8324('0x0')]!==_0x50508e){this[_0x8324('0x0')]=_0x50508e;io['to'](util[_0x8324('0x16')](_0x8324('0x17'),_0x47b5e1['name']))[_0x8324('0x18')](_0x8324('0x19'),_0x47b5e1);}};module[_0x8324('0x1a')]=SmsQueue; \ No newline at end of file +var _0x7d86=['Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0xed4017,_0x2e0190){var _0x2d0d1a=function(_0x180999){while(--_0x180999){_0xed4017['push'](_0xed4017['shift']());}};_0x2d0d1a(++_0x2e0190);}(_0x7d86,0x86));var _0x67d8=function(_0x1225f7,_0x542cba){_0x1225f7=_0x1225f7-0x0;var _0x415043=_0x7d86[_0x1225f7];return _0x415043;};'use strict';var _=require(_0x67d8('0x0'));var md5=require('md5');var util=require(_0x67d8('0x1'));var Redis=require(_0x67d8('0x2'));var config=require(_0x67d8('0x3'));config[_0x67d8('0x4')]=_[_0x67d8('0x5')](config[_0x67d8('0x4')],{'host':_0x67d8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x67d8('0x4')]));function SmsQueue(_0x33de53){this['id']=_0x33de53['id']||0x0;this[_0x67d8('0x7')]=_0x33de53[_0x67d8('0x7')]||'';this[_0x67d8('0x8')]=_0x33de53[_0x67d8('0x8')]||0xa;this[_0x67d8('0x9')]=_0x33de53[_0x67d8('0x9')]||_0x67d8('0xa');this[_0x67d8('0xb')]=_0x33de53[_0x67d8('0xb')];this[_0x67d8('0xc')]={};this[_0x67d8('0xd')]=0x0;this[_0x67d8('0xe')]='';this[_0x67d8('0xf')]();this[_0x67d8('0x10')]();}SmsQueue[_0x67d8('0x11')][_0x67d8('0xf')]=function(){var _0x38107b=this[_0x67d8('0xc')][_0x67d8('0x12')];this['mapAgentsId']=_[_0x67d8('0x13')](this[_0x67d8('0xb')],'id');this[_0x67d8('0xc')]['_rr']=_0x38107b;};SmsQueue[_0x67d8('0x11')][_0x67d8('0x10')]=function(){this[_0x67d8('0x14')]=0x0;this[_0x67d8('0x15')]=0x0;for(var _0x2d54e6=0x0;_0x2d54e6=0x0?this[_0x67d8('0x18')]:0x0;var _0x23328d={'id':this['id'],'available':this[_0x67d8('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x67d8('0x7')],'paused':this[_0x67d8('0x15')],'waiting':this[_0x67d8('0xd')]};var _0x14a81f=md5(JSON[_0x67d8('0x19')](_0x23328d));if(this['md5']!==_0x14a81f){this[_0x67d8('0xe')]=_0x14a81f;io['to'](util[_0x67d8('0x1a')]('sms:queue:%s',_0x23328d['name']))[_0x67d8('0x1b')]('sms_queue:save',_0x23328d);}};module[_0x67d8('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 88fac97..3c8810c 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 _0xa0bd=['whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','mapAgentsId','_rr','Agents','prototype','updateRealtime','loggedIn','paused','length','online'];(function(_0x1176c7,_0xcb7727){var _0xc548df=function(_0x107218){while(--_0x107218){_0x1176c7['push'](_0x1176c7['shift']());}};_0xc548df(++_0xcb7727);}(_0xa0bd,0x1c8));var _0xda0b=function(_0x5bf1c5,_0x4219d1){_0x5bf1c5=_0x5bf1c5-0x0;var _0x25d951=_0xa0bd[_0x5bf1c5];return _0x25d951;};'use strict';var _=require(_0xda0b('0x0'));var md5=require('md5');var util=require(_0xda0b('0x1'));var Redis=require(_0xda0b('0x2'));var config=require(_0xda0b('0x3'));config[_0xda0b('0x4')]=_[_0xda0b('0x5')](config[_0xda0b('0x4')],{'host':_0xda0b('0x6'),'port':0x18eb});var io=require(_0xda0b('0x7'))(new Redis(config[_0xda0b('0x4')]));function WhatsappQueue(_0x320e34){this['id']=_0x320e34['id']||0x0;this[_0xda0b('0x8')]=_0x320e34[_0xda0b('0x8')]||'';this[_0xda0b('0x9')]=_0x320e34[_0xda0b('0x9')]||0xa;this[_0xda0b('0xa')]=_0x320e34[_0xda0b('0xa')]||_0xda0b('0xb');this['Agents']=_0x320e34['Agents'];this['mapAgentsId']={};this[_0xda0b('0xc')]=0x0;this[_0xda0b('0xd')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0xda0b('0xe')]=function(){var _0x52d0f6=this[_0xda0b('0xf')][_0xda0b('0x10')];this['mapAgentsId']=_['map'](this[_0xda0b('0x11')],'id');this[_0xda0b('0xf')]['_rr']=_0x52d0f6;};WhatsappQueue[_0xda0b('0x12')][_0xda0b('0x13')]=function(){this[_0xda0b('0x14')]=0x0;this[_0xda0b('0x15')]=0x0;for(var _0x84f423=0x0;_0x84f423=0x0?this['available']:0x0;var _0xd9050e={'id':this['id'],'available':this[_0xda0b('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xda0b('0x8')],'paused':this[_0xda0b('0x15')],'waiting':this[_0xda0b('0xc')]};var _0x20f9b2=md5(JSON[_0xda0b('0x1a')](_0xd9050e));if(this[_0xda0b('0xd')]!==_0x20f9b2){this['md5']=_0x20f9b2;io['to'](util['format']('whatsapp:queue:%s',_0xd9050e[_0xda0b('0x8')]))[_0xda0b('0x1b')](_0xda0b('0x1c'),_0xd9050e);}};module[_0xda0b('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x8194=['name','emit','whatsapp_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','paused','format'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x8194,0xc0));var _0x4819=function(_0x18350a,_0x105fe4){_0x18350a=_0x18350a-0x0;var _0x33050e=_0x8194[_0x18350a];return _0x33050e;};'use strict';var _=require(_0x4819('0x0'));var md5=require(_0x4819('0x1'));var util=require(_0x4819('0x2'));var Redis=require('ioredis');var config=require(_0x4819('0x3'));config[_0x4819('0x4')]=_[_0x4819('0x5')](config[_0x4819('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4819('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x24d077){this['id']=_0x24d077['id']||0x0;this['name']=_0x24d077['name']||'';this[_0x4819('0x7')]=_0x24d077[_0x4819('0x7')]||0xa;this['strategy']=_0x24d077['strategy']||_0x4819('0x8');this[_0x4819('0x9')]=_0x24d077[_0x4819('0x9')];this[_0x4819('0xa')]={};this[_0x4819('0xb')]=0x0;this['md5']='';this[_0x4819('0xc')]();this[_0x4819('0xd')]();}WhatsappQueue[_0x4819('0xe')][_0x4819('0xc')]=function(){var _0x4ea9bf=this[_0x4819('0xa')][_0x4819('0xf')];this[_0x4819('0xa')]=_[_0x4819('0x10')](this[_0x4819('0x9')],'id');this[_0x4819('0xa')]['_rr']=_0x4ea9bf;};WhatsappQueue[_0x4819('0xe')]['updateRealtime']=function(){this[_0x4819('0x11')]=0x0;this['paused']=0x0;for(var _0x2cd29b=0x0;_0x2cd29b=0x0?this[_0x4819('0x15')]:0x0;var _0x2b32e8={'id':this['id'],'available':this[_0x4819('0x15')],'loggedIn':this[_0x4819('0x11')],'name':this['name'],'paused':this[_0x4819('0x16')],'waiting':this[_0x4819('0xb')]};var _0x3e93df=md5(JSON['stringify'](_0x2b32e8));if(this[_0x4819('0x1')]!==_0x3e93df){this[_0x4819('0x1')]=_0x3e93df;io['to'](util[_0x4819('0x17')]('whatsapp:queue:%s',_0x2b32e8[_0x4819('0x18')]))[_0x4819('0x19')](_0x4819('0x1a'),_0x2b32e8);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7447a72..0ccadf0 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(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 4d8526e..82a00eb 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 _0x6a5d=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','updateChatInteraction','addTags'];(function(_0x451fe2,_0x30c868){var _0x3f9fac=function(_0x49e7fb){while(--_0x49e7fb){_0x451fe2['push'](_0x451fe2['shift']());}};_0x3f9fac(++_0x30c868);}(_0x6a5d,0xd4));var _0xd6a5=function(_0x105dde,_0x1710e1){_0x105dde=_0x105dde-0x0;var _0x428585=_0x6a5d[_0x105dde];return _0x428585;};'use strict';var client=require('../client');exports[_0xd6a5('0x0')]=function(_0xb4fc23,_0xb12b5a){return client[_0xd6a5('0x1')]('UpdateChatInteraction',{'body':_0xb12b5a,'options':{'where':{'id':_0xb4fc23}},'log':_0xd6a5('0x2')});};exports[_0xd6a5('0x3')]=function(_0xb68a2,_0x50a50a){return client[_0xd6a5('0x1')](_0xd6a5('0x4'),{'body':_0x50a50a,'options':{'where':{'id':_0xb68a2}},'log':_0xd6a5('0x5')});}; \ No newline at end of file +var _0x4d18=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x4d18,0x1c7));var _0x84d1=function(_0x4d2b53,_0x25f721){_0x4d2b53=_0x4d2b53-0x0;var _0x4bc453=_0x4d18[_0x4d2b53];return _0x4bc453;};'use strict';var client=require(_0x84d1('0x0'));exports[_0x84d1('0x1')]=function(_0x156c07,_0xfac9bd){return client[_0x84d1('0x2')](_0x84d1('0x3'),{'body':_0xfac9bd,'options':{'where':{'id':_0x156c07}},'log':_0x84d1('0x4')});};exports[_0x84d1('0x5')]=function(_0xb4ec1f,_0x413604){return client[_0x84d1('0x2')](_0x84d1('0x6'),{'body':_0x413604,'options':{'where':{'id':_0xb4ec1f}},'log':_0x84d1('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index caeea65..27629a8 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 _0x652e=['createChatMessage','create','Request'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x652e,0xdf));var _0xe652=function(_0x2df9cc,_0xe9bc32){_0x2df9cc=_0x2df9cc-0x0;var _0x2659a5=_0x652e[_0x2df9cc];return _0x2659a5;};'use strict';var client=require('../client');exports[_0xe652('0x0')]=function(_0x4b31b6){return client[_0xe652('0x1')]('CreateChatMessage',{'body':_0x4b31b6,'log':_0xe652('0x2')});}; \ No newline at end of file +var _0x4113=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x410483,_0x411205){var _0x50e82b=function(_0x32a76c){while(--_0x32a76c){_0x410483['push'](_0x410483['shift']());}};_0x50e82b(++_0x411205);}(_0x4113,0xd8));var _0x3411=function(_0x397605,_0x2c5501){_0x397605=_0x397605-0x0;var _0xbc84d1=_0x4113[_0x397605];return _0xbc84d1;};'use strict';var client=require(_0x3411('0x0'));exports['create']=function(_0x73a5f){return client[_0x3411('0x1')](_0x3411('0x2'),{'body':_0x73a5f,'log':_0x3411('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 9968aa2..4e7eb2a 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c1f=['User','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout','strategy'];(function(_0x56c522,_0x516d15){var _0x4d48b9=function(_0x45c29d){while(--_0x45c29d){_0x56c522['push'](_0x56c522['shift']());}};_0x4d48b9(++_0x516d15);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x5c1f[_0x14363e];return _0x17c56d;};'use strict';var client=require(_0xf5c1('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf5c1('0x1')](_0xf5c1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf5c1('0x3'),_0xf5c1('0x4')],'include':[{'model':_0xf5c1('0x5'),'as':'Agents','attributes':['id','name','online',_0xf5c1('0x6')]}]},'log':_0xf5c1('0x7')});};}; \ No newline at end of file +var _0x5fc3=['name','timeout','strategy','User','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5fc3[_0x2bf466];return _0x856885;};'use strict';var client=require(_0x35fc('0x0'));exports[_0x35fc('0x1')]=function(){return function(){return client['Request'](_0x35fc('0x2'),{'options':{'raw':![],'attributes':['id',_0x35fc('0x3'),_0x35fc('0x4'),_0x35fc('0x5')],'include':[{'model':_0x35fc('0x6'),'as':'Agents','attributes':['id',_0x35fc('0x3'),_0x35fc('0x7'),_0x35fc('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 32b98ac..73ea56d 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 _0x3ef0=['../client','CreateChatQueueReport','update','DESC','UpdateChatQueueReport'];(function(_0x37216a,_0x339995){var _0x596ed1=function(_0x2e1fa8){while(--_0x2e1fa8){_0x37216a['push'](_0x37216a['shift']());}};_0x596ed1(++_0x339995);}(_0x3ef0,0x19a));var _0x03ef=function(_0x286305,_0x413532){_0x286305=_0x286305-0x0;var _0x130437=_0x3ef0[_0x286305];return _0x130437;};'use strict';var client=require(_0x03ef('0x0'));exports['create']=function(_0x34c8e7){return client['Request'](_0x03ef('0x1'),{'body':_0x34c8e7,'log':'CreateChatQueueReport'});};exports[_0x03ef('0x2')]=function(_0x2c05c5,_0x321d93){return client['Request']('UpdateChatQueueReport',{'body':_0x321d93,'options':{'where':{'uniqueid':_0x2c05c5},'order':[['id',_0x03ef('0x3')]],'limit':0x1},'log':_0x03ef('0x4')});}; \ No newline at end of file +var _0x89fe=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x89fe,0x83));var _0xe89f=function(_0x4959d0,_0x21f44b){_0x4959d0=_0x4959d0-0x0;var _0x2a7258=_0x89fe[_0x4959d0];return _0x2a7258;};'use strict';var client=require(_0xe89f('0x0'));exports[_0xe89f('0x1')]=function(_0x2aac3e){return client[_0xe89f('0x2')]('CreateChatQueueReport',{'body':_0x2aac3e,'log':_0xe89f('0x3')});};exports[_0xe89f('0x4')]=function(_0x580dce,_0x3d3aa8){return client[_0xe89f('0x2')](_0xe89f('0x5'),{'body':_0x3d3aa8,'options':{'where':{'uniqueid':_0x580dce},'order':[['id',_0xe89f('0x6')]],'limit':0x1},'log':_0xe89f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 4daccb5..ce37966 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x542305,_0x331f9d){var _0xe21aa9=function(_0x22f7cd){while(--_0x22f7cd){_0x542305['push'](_0x542305['shift']());}};_0xe21aa9(++_0x331f9d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x57ec28,_0x2c5feb){var _0xa7324f=function(_0x182d7c){while(--_0x182d7c){_0x57ec28['push'](_0x57ec28['shift']());}};_0xa7324f(++_0x2c5feb);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7949c93..52e0d07 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 _0x967a=['../client','create','Request','CreateFaxMessage'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0x967a,0x1b8));var _0xa967=function(_0x204684,_0x32733e){_0x204684=_0x204684-0x0;var _0x1eaec7=_0x967a[_0x204684];return _0x1eaec7;};'use strict';var client=require(_0xa967('0x0'));exports[_0xa967('0x1')]=function(_0xe37ddc){return client[_0xa967('0x2')](_0xa967('0x3'),{'body':_0xe37ddc,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x89e7=['createFaxMessage','../client','create','Request'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x89e7,0x115));var _0x789e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x89e7[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x789e('0x0'));exports[_0x789e('0x1')]=function(_0x4365e8){return client[_0x789e('0x2')]('CreateFaxMessage',{'body':_0x4365e8,'log':_0x789e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c8728b5..ee81093 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 _0x3b06=['User','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x1382cb,_0xed117a){var _0x58d5af=function(_0x54efd5){while(--_0x54efd5){_0x1382cb['push'](_0x1382cb['shift']());}};_0x58d5af(++_0xed117a);}(_0x3b06,0xa5));var _0x63b0=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x3b06[_0x406115];return _0xbbabdb;};'use strict';var client=require(_0x63b0('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x63b0('0x1')](_0x63b0('0x2'),{'options':{'raw':![],'attributes':['id',_0x63b0('0x3'),_0x63b0('0x4'),_0x63b0('0x5')],'include':[{'model':_0x63b0('0x6'),'as':'Agents','attributes':['id',_0x63b0('0x3'),'online',_0x63b0('0x7')]}]},'log':_0x63b0('0x8')});};}; \ No newline at end of file +var _0xc3d9=['Request','GetFaxQueue','name','timeout','User','Agents','../client','getFaxQueues'];(function(_0x379d86,_0x1814be){var _0x383a3c=function(_0x1223eb){while(--_0x1223eb){_0x379d86['push'](_0x379d86['shift']());}};_0x383a3c(++_0x1814be);}(_0xc3d9,0x13e));var _0x9c3d=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xc3d9[_0x2fdf82];return _0x2382f5;};'use strict';var client=require(_0x9c3d('0x0'));exports[_0x9c3d('0x1')]=function(){return function(){return client[_0x9c3d('0x2')](_0x9c3d('0x3'),{'options':{'raw':![],'attributes':['id',_0x9c3d('0x4'),_0x9c3d('0x5'),'strategy'],'include':[{'model':_0x9c3d('0x6'),'as':_0x9c3d('0x7'),'attributes':['id',_0x9c3d('0x4'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 74d80e0..fea36fd 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 _0xc9aa=['create','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x1c445a,_0xea7543){var _0x33e4ad=function(_0xbf0ca7){while(--_0xbf0ca7){_0x1c445a['push'](_0x1c445a['shift']());}};_0x33e4ad(++_0xea7543);}(_0xc9aa,0x89));var _0xac9a=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xc9aa[_0x380307];return _0x9ea14b;};'use strict';var client=require(_0xac9a('0x0'));exports[_0xac9a('0x1')]=function(_0x5a33b0){return client['Request'](_0xac9a('0x2'),{'body':_0x5a33b0,'log':_0xac9a('0x2')});};exports['update']=function(_0x2749d7,_0x4eea12){return client[_0xac9a('0x3')](_0xac9a('0x4'),{'body':_0x4eea12,'options':{'where':{'uniqueid':_0x2749d7},'order':[['id',_0xac9a('0x5')]],'limit':0x1},'log':_0xac9a('0x4')});}; \ No newline at end of file +var _0x266e=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x266e,0x1d8));var _0xe266=function(_0x403064,_0x38f125){_0x403064=_0x403064-0x0;var _0x30cf56=_0x266e[_0x403064];return _0x30cf56;};'use strict';var client=require(_0xe266('0x0'));exports[_0xe266('0x1')]=function(_0x52a0cb){return client[_0xe266('0x2')]('CreateFaxQueueReport',{'body':_0x52a0cb,'log':_0xe266('0x3')});};exports[_0xe266('0x4')]=function(_0x493290,_0xc705f3){return client[_0xe266('0x2')](_0xe266('0x5'),{'body':_0xc705f3,'options':{'where':{'uniqueid':_0x493290},'order':[['id',_0xe266('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e263bc2..ef90844 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 _0x9c3f=['Intervals','name','interval','getIntervals','../client','GetInterval','Interval'];(function(_0x1c8253,_0x1c4de2){var _0x380d59=function(_0x5bbf67){while(--_0x5bbf67){_0x1c8253['push'](_0x1c8253['shift']());}};_0x380d59(++_0x1c4de2);}(_0x9c3f,0x1d2));var _0xf9c3=function(_0xcaceaf,_0x50fce3){_0xcaceaf=_0xcaceaf-0x0;var _0x5c639d=_0x9c3f[_0xcaceaf];return _0x5c639d;};'use strict';var client=require(_0xf9c3('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xf9c3('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf9c3('0x2'),'as':_0xf9c3('0x3'),'attributes':['id',_0xf9c3('0x4'),_0xf9c3('0x5')]}]},'log':_0xf9c3('0x6')});};}; \ No newline at end of file +var _0x54c6=['name','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54c6,0x139));var _0x654c=function(_0x4b55e2,_0x27fa6){_0x4b55e2=_0x4b55e2-0x0;var _0x2fb1be=_0x54c6[_0x4b55e2];return _0x2fb1be;};'use strict';var client=require('../client');exports[_0x654c('0x0')]=function(){return function(){return client[_0x654c('0x1')](_0x654c('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x654c('0x3'),'as':_0x654c('0x4'),'attributes':['id',_0x654c('0x5'),'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 8657c38..b4a86e0 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 _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5dee28,_0x1645f8){var _0x1207ad=function(_0xe61f2d){while(--_0xe61f2d){_0x5dee28['push'](_0x5dee28['shift']());}};_0x1207ad(++_0x1645f8);}(_0x3266,0x6a));var _0x6326=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x3266[_0x59d0cc];return _0x2ae79f;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file +var _0x33af=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x33af,0xec));var _0xf33a=function(_0x564242,_0x4159f7){_0x564242=_0x564242-0x0;var _0x2906fb=_0x33af[_0x564242];return _0x2906fb;};'use strict';var client=require('../client');exports[_0xf33a('0x0')]=function(_0x54b114,_0x2137be){return client[_0xf33a('0x1')](_0xf33a('0x2'),{'body':_0x2137be,'options':{'where':{'id':_0x54b114}},'log':_0xf33a('0x3')});};exports[_0xf33a('0x4')]=function(_0x25f156,_0x4c734e){return client[_0xf33a('0x1')](_0xf33a('0x5'),{'body':_0x4c734e,'options':{'where':{'id':_0x25f156}},'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 6ba685d..b5a53f5 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 _0x9196=['CreateMailMessage','create'];(function(_0x153162,_0xd7921d){var _0x2f4492=function(_0x23c4ad){while(--_0x23c4ad){_0x153162['push'](_0x153162['shift']());}};_0x2f4492(++_0xd7921d);}(_0x9196,0xd9));var _0x6919=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x9196[_0x283127];return _0x43da5d;};'use strict';var client=require('../client');exports[_0x6919('0x0')]=function(_0x286317){return client['Request'](_0x6919('0x1'),{'body':_0x286317,'log':'createMailMessage'});}; \ No newline at end of file +var _0xbc08=['Request','createMailMessage'];(function(_0x2fe47b,_0x3e7419){var _0x536cd6=function(_0x1a9c98){while(--_0x1a9c98){_0x2fe47b['push'](_0x2fe47b['shift']());}};_0x536cd6(++_0x3e7419);}(_0xbc08,0xd2));var _0x8bc0=function(_0x5e1c1f,_0x477de3){_0x5e1c1f=_0x5e1c1f-0x0;var _0x284a57=_0xbc08[_0x5e1c1f];return _0x284a57;};'use strict';var client=require('../client');exports['create']=function(_0xac83ce){return client[_0x8bc0('0x0')]('CreateMailMessage',{'body':_0xac83ce,'log':_0x8bc0('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3d464d7..f43f536 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 _0xa30f=['Request','GetMailQueue','name','strategy','User','Agents','online','mailPause','getMailQueues','../client'];(function(_0x28a5b8,_0x167f37){var _0x42d119=function(_0xba3c07){while(--_0xba3c07){_0x28a5b8['push'](_0x28a5b8['shift']());}};_0x42d119(++_0x167f37);}(_0xa30f,0x1d5));var _0xfa30=function(_0x513faa,_0x2d4262){_0x513faa=_0x513faa-0x0;var _0x21fe98=_0xa30f[_0x513faa];return _0x21fe98;};'use strict';var client=require(_0xfa30('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xfa30('0x1')](_0xfa30('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa30('0x3'),'timeout',_0xfa30('0x4')],'include':[{'model':_0xfa30('0x5'),'as':_0xfa30('0x6'),'attributes':['id',_0xfa30('0x3'),_0xfa30('0x7'),_0xfa30('0x8')]}]},'log':_0xfa30('0x9')});};}; \ No newline at end of file +var _0x3ee8=['Request','GetMailQueue','name','timeout','User','Agents','online','mailPause'];(function(_0x2fbb5c,_0x3ecbcc){var _0x581a52=function(_0x3ca627){while(--_0x3ca627){_0x2fbb5c['push'](_0x2fbb5c['shift']());}};_0x581a52(++_0x3ecbcc);}(_0x3ee8,0x188));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x83ee('0x0')](_0x83ee('0x1'),{'options':{'raw':![],'attributes':['id',_0x83ee('0x2'),_0x83ee('0x3'),'strategy'],'include':[{'model':_0x83ee('0x4'),'as':_0x83ee('0x5'),'attributes':['id',_0x83ee('0x2'),_0x83ee('0x6'),_0x83ee('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index a70004b..cbc22a2 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 _0xa5f5=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x289e6,_0x5e9b29){var _0x3864f3=function(_0x19b779){while(--_0x19b779){_0x289e6['push'](_0x289e6['shift']());}};_0x3864f3(++_0x5e9b29);}(_0xa5f5,0x198));var _0x5a5f=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xa5f5[_0x12f688];return _0x59c3de;};'use strict';var client=require(_0x5a5f('0x0'));exports[_0x5a5f('0x1')]=function(_0x34ecde){return client['Request'](_0x5a5f('0x2'),{'body':_0x34ecde,'log':_0x5a5f('0x2')});};exports[_0x5a5f('0x3')]=function(_0x180819,_0x2c23e8){return client[_0x5a5f('0x4')](_0x5a5f('0x5'),{'body':_0x2c23e8,'options':{'where':{'uniqueid':_0x180819},'order':[['id','DESC']],'limit':0x1},'log':_0x5a5f('0x5')});}; \ No newline at end of file +var _0xd96a=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x1da80f,_0x59f7c8){var _0x382ff6=function(_0x469595){while(--_0x469595){_0x1da80f['push'](_0x1da80f['shift']());}};_0x382ff6(++_0x59f7c8);}(_0xd96a,0x81));var _0xad96=function(_0x5437fa,_0x429c45){_0x5437fa=_0x5437fa-0x0;var _0xc52711=_0xd96a[_0x5437fa];return _0xc52711;};'use strict';var client=require(_0xad96('0x0'));exports[_0xad96('0x1')]=function(_0x455203){return client[_0xad96('0x2')](_0xad96('0x3'),{'body':_0x455203,'log':_0xad96('0x3')});};exports[_0xad96('0x4')]=function(_0x8bb998,_0x54ad99){return client[_0xad96('0x2')](_0xad96('0x5'),{'body':_0x54ad99,'options':{'where':{'uniqueid':_0x8bb998},'order':[['id',_0xad96('0x6')]],'limit':0x1},'log':_0xad96('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 73f28e9..b7296fe 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 _0x170c=['AddTagsToOpenchannelInteraction','../client','Request'];(function(_0x24c162,_0x109aa0){var _0xbfe017=function(_0x5d2330){while(--_0x5d2330){_0x24c162['push'](_0x24c162['shift']());}};_0xbfe017(++_0x109aa0);}(_0x170c,0x1de));var _0xc170=function(_0x3f8c34,_0x1ab4b3){_0x3f8c34=_0x3f8c34-0x0;var _0x237534=_0x170c[_0x3f8c34];return _0x237534;};'use strict';var client=require(_0xc170('0x0'));exports['update']=function(_0x51388f,_0x24251b){return client[_0xc170('0x1')]('UpdateOpenchannelInteraction',{'body':_0x24251b,'options':{'where':{'id':_0x51388f}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x4313dc,_0x5e68c6){return client[_0xc170('0x1')](_0xc170('0x2'),{'body':_0x5e68c6,'options':{'where':{'id':_0x4313dc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x39cc=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x10fb6e,_0x22949d){var _0x3b58e0=function(_0x2489e6){while(--_0x2489e6){_0x10fb6e['push'](_0x10fb6e['shift']());}};_0x3b58e0(++_0x22949d);}(_0x39cc,0xb8));var _0xc39c=function(_0x3e354a,_0x5b12a5){_0x3e354a=_0x3e354a-0x0;var _0x450168=_0x39cc[_0x3e354a];return _0x450168;};'use strict';var client=require(_0xc39c('0x0'));exports['update']=function(_0x10bcbc,_0x479b3a){return client[_0xc39c('0x1')](_0xc39c('0x2'),{'body':_0x479b3a,'options':{'where':{'id':_0x10bcbc}},'log':_0xc39c('0x3')});};exports[_0xc39c('0x4')]=function(_0x3af7cb,_0x397757){return client['Request'](_0xc39c('0x5'),{'body':_0x397757,'options':{'where':{'id':_0x3af7cb}},'log':_0xc39c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4155883..687d6bc 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 _0xc6a1=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x40388c,_0x4c418c){var _0x3c0701=function(_0x3ca095){while(--_0x3ca095){_0x40388c['push'](_0x40388c['shift']());}};_0x3c0701(++_0x4c418c);}(_0xc6a1,0x17e));var _0x1c6a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc6a1[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x1c6a('0x0'));exports[_0x1c6a('0x1')]=function(_0x4763b7){return client[_0x1c6a('0x2')](_0x1c6a('0x3'),{'body':_0x4763b7,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x838b=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x2210ab,_0x400b89){var _0x302300=function(_0x2c8508){while(--_0x2c8508){_0x2210ab['push'](_0x2210ab['shift']());}};_0x302300(++_0x400b89);}(_0x838b,0xab));var _0xb838=function(_0x490a31,_0x5440f0){_0x490a31=_0x490a31-0x0;var _0x3fe411=_0x838b[_0x490a31];return _0x3fe411;};'use strict';var client=require('../client');exports[_0xb838('0x0')]=function(_0x76b329){return client[_0xb838('0x1')](_0xb838('0x2'),{'body':_0x76b329,'log':_0xb838('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8ac8145..aa96098 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 _0xf06f=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xf06f,0x15f));var _0xff06=function(_0x5954d1,_0x4516d5){_0x5954d1=_0x5954d1-0x0;var _0x1212a5=_0xf06f[_0x5954d1];return _0x1212a5;};'use strict';var client=require(_0xff06('0x0'));exports[_0xff06('0x1')]=function(){return function(){return client[_0xff06('0x2')](_0xff06('0x3'),{'options':{'raw':![],'attributes':['id',_0xff06('0x4'),'timeout',_0xff06('0x5')],'include':[{'model':_0xff06('0x6'),'as':_0xff06('0x7'),'attributes':['id','name',_0xff06('0x8'),_0xff06('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xb1d9=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x39be76,_0x5bf653){var _0x1c163d=function(_0x352d7b){while(--_0x352d7b){_0x39be76['push'](_0x39be76['shift']());}};_0x1c163d(++_0x5bf653);}(_0xb1d9,0x147));var _0x9b1d=function(_0x1c9f12,_0x387041){_0x1c9f12=_0x1c9f12-0x0;var _0x48a3fc=_0xb1d9[_0x1c9f12];return _0x48a3fc;};'use strict';var client=require(_0x9b1d('0x0'));exports[_0x9b1d('0x1')]=function(){return function(){return client[_0x9b1d('0x2')](_0x9b1d('0x3'),{'options':{'raw':![],'attributes':['id',_0x9b1d('0x4'),_0x9b1d('0x5'),_0x9b1d('0x6')],'include':[{'model':_0x9b1d('0x7'),'as':_0x9b1d('0x8'),'attributes':['id','name','online',_0x9b1d('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index daffa7e..9e31f70 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 _0xdf27=['UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport','Request'];(function(_0x67b075,_0x43557d){var _0x39d030=function(_0x4f25e1){while(--_0x4f25e1){_0x67b075['push'](_0x67b075['shift']());}};_0x39d030(++_0x43557d);}(_0xdf27,0x104));var _0x7df2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdf27[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x7df2('0x0'));exports[_0x7df2('0x1')]=function(_0x5691ea){return client['Request'](_0x7df2('0x2'),{'body':_0x5691ea,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5562d9,_0x15c07b){return client[_0x7df2('0x3')](_0x7df2('0x4'),{'body':_0x15c07b,'options':{'where':{'uniqueid':_0x5562d9},'order':[['id',_0x7df2('0x5')]],'limit':0x1},'log':_0x7df2('0x4')});}; \ No newline at end of file +var _0xf1c9=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x4b8903,_0xcb84a0){var _0x277233=function(_0x106c48){while(--_0x106c48){_0x4b8903['push'](_0x4b8903['shift']());}};_0x277233(++_0xcb84a0);}(_0xf1c9,0x12d));var _0x9f1c=function(_0x5b9767,_0x3cec4b){_0x5b9767=_0x5b9767-0x0;var _0x40208d=_0xf1c9[_0x5b9767];return _0x40208d;};'use strict';var client=require(_0x9f1c('0x0'));exports['create']=function(_0x16ceab){return client[_0x9f1c('0x1')](_0x9f1c('0x2'),{'body':_0x16ceab,'log':_0x9f1c('0x2')});};exports[_0x9f1c('0x3')]=function(_0x58790b,_0x232eac){return client['Request'](_0x9f1c('0x4'),{'body':_0x232eac,'options':{'where':{'uniqueid':_0x58790b},'order':[['id',_0x9f1c('0x5')]],'limit':0x1},'log':_0x9f1c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b85682b..234953e 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 _0x383d=['addTags','AddTagsToSmsInteraction','Request','updateSmsInteraction'];(function(_0x5b7106,_0x1dbc12){var _0x390f28=function(_0x49d754){while(--_0x49d754){_0x5b7106['push'](_0x5b7106['shift']());}};_0x390f28(++_0x1dbc12);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['update']=function(_0xced345,_0x326371){return client[_0xd383('0x0')]('UpdateSmsInteraction',{'body':_0x326371,'options':{'where':{'id':_0xced345}},'log':_0xd383('0x1')});};exports[_0xd383('0x2')]=function(_0x319f67,_0x3439dd){return client[_0xd383('0x0')](_0xd383('0x3'),{'body':_0x3439dd,'options':{'where':{'id':_0x319f67}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x8e94=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x235506,_0x458531){var _0x417e23=function(_0x3e57af){while(--_0x3e57af){_0x235506['push'](_0x235506['shift']());}};_0x417e23(++_0x458531);}(_0x8e94,0xf8));var _0x48e9=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x8e94[_0x237546];return _0x233e29;};'use strict';var client=require(_0x48e9('0x0'));exports[_0x48e9('0x1')]=function(_0x58af83,_0x2a7215){return client['Request'](_0x48e9('0x2'),{'body':_0x2a7215,'options':{'where':{'id':_0x58af83}},'log':'updateSmsInteraction'});};exports[_0x48e9('0x3')]=function(_0x5f4f1a,_0x506fa6){return client['Request'](_0x48e9('0x4'),{'body':_0x506fa6,'options':{'where':{'id':_0x5f4f1a}},'log':_0x48e9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 18f7add..6987b91 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 _0x3a59=['CreateSmsMessage','../client','create','Request'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3a59,0xc5));var _0x93a5=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0x3a59[_0x497b1e];return _0x3f72e1;};'use strict';var client=require(_0x93a5('0x0'));exports[_0x93a5('0x1')]=function(_0x4dd82b){return client[_0x93a5('0x2')](_0x93a5('0x3'),{'body':_0x4dd82b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xf62a=['create','Request','createSmsMessage','../client'];(function(_0x197065,_0x2e79d0){var _0x3d9404=function(_0xf582a7){while(--_0xf582a7){_0x197065['push'](_0x197065['shift']());}};_0x3d9404(++_0x2e79d0);}(_0xf62a,0xe3));var _0xaf62=function(_0xa011f5,_0x3e5ea5){_0xa011f5=_0xa011f5-0x0;var _0x2b692e=_0xf62a[_0xa011f5];return _0x2b692e;};'use strict';var client=require(_0xaf62('0x0'));exports[_0xaf62('0x1')]=function(_0x71c5fd){return client[_0xaf62('0x2')]('CreateSmsMessage',{'body':_0x71c5fd,'log':_0xaf62('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 7e2f7d8..10d167d 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x50adac,_0x5975fd){var _0x36f629=function(_0x27e1d8){while(--_0x27e1d8){_0x50adac['push'](_0x50adac['shift']());}};_0x36f629(++_0x5975fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xcb91[_0x1fd9e7];return _0x1781f2;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x489896,_0x5e54a2){var _0x4b1255=function(_0x17d319){while(--_0x17d319){_0x489896['push'](_0x489896['shift']());}};_0x4b1255(++_0x5e54a2);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e97659f..5d07aad 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x4ceb68,_0x3e0a77){var _0x7b1ae=function(_0x4cd88c){while(--_0x4cd88c){_0x4ceb68['push'](_0x4ceb68['shift']());}};_0x7b1ae(++_0x3e0a77);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1a456a,_0x50fe05){var _0x23c52d=function(_0x4b1f65){while(--_0x4b1f65){_0x1a456a['push'](_0x1a456a['shift']());}};_0x23c52d(++_0x50fe05);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 54f3f9e..01ebcc1 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(_0x4d97da,_0x40b24f){var _0x276156=function(_0x298f70){while(--_0x298f70){_0x4d97da['push'](_0x4d97da['shift']());}};_0x276156(++_0x40b24f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x54334a,_0x56bcd8){var _0x51cd78=function(_0x4f9df3){while(--_0x4f9df3){_0x54334a['push'](_0x54334a['shift']());}};_0x51cd78(++_0x56bcd8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 2d817ac..b46db04 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 _0x7ed1=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x32877b,_0x1fe47b){var _0x449a3e=function(_0xf246c4){while(--_0xf246c4){_0x32877b['push'](_0x32877b['shift']());}};_0x449a3e(++_0x1fe47b);}(_0x7ed1,0xca));var _0x17ed=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7ed1[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0x17ed('0x0'));exports['update']=function(_0x10553a,_0x257429){return client[_0x17ed('0x1')](_0x17ed('0x2'),{'body':_0x257429,'options':{'where':{'id':_0x10553a}},'log':_0x17ed('0x3')});};exports[_0x17ed('0x4')]=function(_0x54bf1f,_0x2fdcd3){return client[_0x17ed('0x1')](_0x17ed('0x5'),{'body':_0x2fdcd3,'options':{'where':{'id':_0x54bf1f}},'log':_0x17ed('0x6')});}; \ No newline at end of file +var _0x323f=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x323f,0x1ee));var _0xf323=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x323f[_0x397e5f];return _0x5302b8;};'use strict';var client=require('../client');exports[_0xf323('0x0')]=function(_0x564979,_0x766661){return client[_0xf323('0x1')](_0xf323('0x2'),{'body':_0x766661,'options':{'where':{'id':_0x564979}},'log':_0xf323('0x3')});};exports[_0xf323('0x4')]=function(_0x2c9d35,_0xb4caa8){return client[_0xf323('0x1')](_0xf323('0x5'),{'body':_0xb4caa8,'options':{'where':{'id':_0x2c9d35}},'log':_0xf323('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b70d2fa..18e57f4 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 _0x494f=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x3a6a2b,_0x1cc6a4){var _0xe3ebf3=function(_0x4a1580){while(--_0x4a1580){_0x3a6a2b['push'](_0x3a6a2b['shift']());}};_0xe3ebf3(++_0x1cc6a4);}(_0x494f,0x19b));var _0xf494=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x494f[_0x1e6b59];return _0x40d7c5;};'use strict';var client=require(_0xf494('0x0'));exports[_0xf494('0x1')]=function(_0x16d83a){return client[_0xf494('0x2')](_0xf494('0x3'),{'body':_0x16d83a,'log':_0xf494('0x4')});}; \ No newline at end of file +var _0xc833=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x5cef86,_0x22be08){var _0x5164cc=function(_0x13e26d){while(--_0x13e26d){_0x5cef86['push'](_0x5cef86['shift']());}};_0x5164cc(++_0x22be08);}(_0xc833,0x1f2));var _0x3c83=function(_0x1ca206,_0x2bd5d4){_0x1ca206=_0x1ca206-0x0;var _0x41ddd6=_0xc833[_0x1ca206];return _0x41ddd6;};'use strict';var client=require(_0x3c83('0x0'));exports[_0x3c83('0x1')]=function(_0x41cc1d){return client[_0x3c83('0x2')](_0x3c83('0x3'),{'body':_0x41cc1d,'log':_0x3c83('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bc91339..d5b29da 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 _0x7cc9=['online','GetWhatsappQueue','name','strategy','User'];(function(_0x156920,_0x1b9d56){var _0x120315=function(_0x516dc5){while(--_0x516dc5){_0x156920['push'](_0x156920['shift']());}};_0x120315(++_0x1b9d56);}(_0x7cc9,0xe2));var _0x97cc=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x7cc9[_0x5b8646];return _0x363e4c;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x97cc('0x0'),{'options':{'raw':![],'attributes':['id',_0x97cc('0x1'),'timeout',_0x97cc('0x2')],'include':[{'model':_0x97cc('0x3'),'as':'Agents','attributes':['id',_0x97cc('0x1'),_0x97cc('0x4'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x2d06=['whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0x3d7579,_0x599163){var _0x4db38a=function(_0x535d6a){while(--_0x535d6a){_0x3d7579['push'](_0x3d7579['shift']());}};_0x4db38a(++_0x599163);}(_0x2d06,0x141));var _0x62d0=function(_0x120701,_0x261c55){_0x120701=_0x120701-0x0;var _0x6cdc95=_0x2d06[_0x120701];return _0x6cdc95;};'use strict';var client=require('../client');exports[_0x62d0('0x0')]=function(){return function(){return client['Request'](_0x62d0('0x1'),{'options':{'raw':![],'attributes':['id',_0x62d0('0x2'),_0x62d0('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x62d0('0x2'),'online',_0x62d0('0x4')]}]},'log':_0x62d0('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6cad1ac..5401a47 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 _0x8f1e=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x58198f,_0x6964e0){var _0x449084=function(_0x1f86a1){while(--_0x1f86a1){_0x58198f['push'](_0x58198f['shift']());}};_0x449084(++_0x6964e0);}(_0x8f1e,0x1eb));var _0xe8f1=function(_0x638108,_0x1c68cb){_0x638108=_0x638108-0x0;var _0x6cd7bc=_0x8f1e[_0x638108];return _0x6cd7bc;};'use strict';var client=require('../client');exports[_0xe8f1('0x0')]=function(_0x32f5b3){return client[_0xe8f1('0x1')](_0xe8f1('0x2'),{'body':_0x32f5b3,'log':_0xe8f1('0x2')});};exports[_0xe8f1('0x3')]=function(_0x11f5da,_0x58c14d){return client[_0xe8f1('0x1')](_0xe8f1('0x4'),{'body':_0x58c14d,'options':{'where':{'uniqueid':_0x11f5da},'order':[['id',_0xe8f1('0x5')]],'limit':0x1},'log':_0xe8f1('0x4')});}; \ No newline at end of file +var _0x34e1=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x44eaf6,_0x47f444){var _0x30e5b0=function(_0x5bb46c){while(--_0x5bb46c){_0x44eaf6['push'](_0x44eaf6['shift']());}};_0x30e5b0(++_0x47f444);}(_0x34e1,0x1a4));var _0x134e=function(_0xbe90aa,_0x4be8c6){_0xbe90aa=_0xbe90aa-0x0;var _0x13fed0=_0x34e1[_0xbe90aa];return _0x13fed0;};'use strict';var client=require('../client');exports[_0x134e('0x0')]=function(_0x3c2f35){return client[_0x134e('0x1')](_0x134e('0x2'),{'body':_0x3c2f35,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x3aaef9,_0x1a96e7){return client['Request'](_0x134e('0x3'),{'body':_0x1a96e7,'options':{'where':{'uniqueid':_0x3aaef9},'order':[['id',_0x134e('0x4')]],'limit':0x1},'log':_0x134e('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 3f07bf8..242da52 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 _0x8601=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','channel','START:%s','rules','end','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x3ca9c6,_0x1588fe){var _0x32505f=function(_0x3a41ff){while(--_0x3a41ff){_0x3ca9c6['push'](_0x3ca9c6['shift']());}};_0x32505f(++_0x1588fe);}(_0x8601,0x123));var _0x1860=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8601[_0x432682];return _0x463d05;};'use strict';var schema=require(_0x1860('0x0'));var _=require(_0x1860('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x1860('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1860('0x3'),'required':!![],'message':_0x1860('0x4')},'timeout':{'type':_0x1860('0x5'),'message':_0x1860('0x6')}});function writeLog(_0x4a5fef,_0x355cbb,_0x10e22a){return logger[_0x1860('0x7')](util[_0x1860('0x8')](_0x1860('0x9'),_0x4a5fef,_0x355cbb[_0x1860('0xa')],_0x10e22a));}function handleFindAgent(_0x32dc46){return function(_0x382d29){return _0x382d29[_0x1860('0xa')][_0x1860('0xb')]()===_0x32dc46[_0x1860('0xb')]();};}exports['consequence']=function(_0x302aca,_0x7ada1,_0x2b831b,_0x357d9e){return function(_0x1e83b6){try{var _0x13919d={'name':_0x7ada1[0x0],'timeout':_0x7ada1[0x1]};var _0x2c0d3a=queue[_0x1860('0x0')](_0x13919d,{'typecast':!![]});if(_0x2c0d3a[_0x1860('0xc')]){logger[_0x1860('0xd')](_0x1860('0xe'),_0x302aca,_[_0x1860('0xf')](_0x2c0d3a,_0x1860('0x10'))['join'](',\x20'));_0x1e83b6[_0x1860('0x11')]();}else{var _0x3d3a13=_[_0x1860('0x12')](_0x2b831b[_0x1860('0x13')],handleFindAgent(_0x13919d['name']));if(_0x3d3a13){var _0x494555=(_0x13919d['timeout']||0xa)*0x3e8;var _0x1fba98,_0x39f77e;var _0x4e5a34=seqqueue['createQueue'](_0x494555);_0x4e5a34['id']=_0x302aca;_0x4e5a34['atimeout']=_0x494555;_0x4e5a34[_0x1860('0x14')]=_0x357d9e['channel'];writeLog(_0x302aca,_0x3d3a13,util[_0x1860('0x8')](_0x1860('0x15'),_0x494555));_0x2b831b[_0x1860('0x16')][_0x302aca]['on'](_0x1860('0x17'),function(){logger[_0x1860('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x302aca);clearTimeout(_0x39f77e);_0x39f77e=undefined;_0x4e5a34['close']();if(_0x2b831b[_0x1860('0x16')][_0x302aca]){delete _0x2b831b[_0x1860('0x16')][_0x302aca];}_0x1e83b6[_0x1860('0x11')]();});_0x2b831b['rules'][_0x302aca]['on'](_0x1860('0x18'),function(){if(_0x2b831b[_0x1860('0x16')][_0x302aca]){delete _0x2b831b[_0x1860('0x16')][_0x302aca];}});_0x39f77e=setTimeout(function(){logger['info'](_0x1860('0x19'),_0x302aca);clearTimeout(_0x39f77e);_0x4e5a34[_0x1860('0x1a')]();_0x1e83b6['next']();},_0x494555);strategy[_0x1860('0x1b')](_0x4e5a34,_0x3d3a13,_0x2b831b,_0x357d9e);}else{logger[_0x1860('0xd')](_0x1860('0x1c'),_0x302aca,_0x13919d['name']);_0x1e83b6['stop']();}}}catch(_0x2292c0){console[_0x1860('0x1d')](_0x2292c0);logger[_0x1860('0xd')](_0x1860('0x1e'),_0x302aca,_0x2292c0[_0x1860('0x1f')]);_0x1e83b6[_0x1860('0x11')]();}};}; \ No newline at end of file +var _0x64b8=['stack','validate','util','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','stop','find','timeout','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0x3f0068,_0x227667){var _0x1500ab=function(_0x39d99f){while(--_0x39d99f){_0x3f0068['push'](_0x3f0068['shift']());}};_0x1500ab(++_0x227667);}(_0x64b8,0xda));var _0x864b=function(_0x358a5f,_0x4a2991){_0x358a5f=_0x358a5f-0x0;var _0x400fbb=_0x64b8[_0x358a5f];return _0x400fbb;};'use strict';var schema=require(_0x864b('0x0'));var _=require('lodash');var util=require(_0x864b('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x864b('0x2')},'timeout':{'type':_0x864b('0x3'),'message':_0x864b('0x4')}});function writeLog(_0x5855ac,_0x3ed126,_0x185cd1){return logger[_0x864b('0x5')](util[_0x864b('0x6')](_0x864b('0x7'),_0x5855ac,_0x3ed126[_0x864b('0x8')],_0x185cd1));}function handleFindAgent(_0x101db7){return function(_0x58eb6b){return _0x58eb6b[_0x864b('0x8')][_0x864b('0x9')]()===_0x101db7[_0x864b('0x9')]();};}exports['consequence']=function(_0x48b3ac,_0x5a227b,_0x9d619,_0x12593b){return function(_0x2ba1fd){try{var _0x3cb1df={'name':_0x5a227b[0x0],'timeout':_0x5a227b[0x1]};var _0x32db6c=queue['validate'](_0x3cb1df,{'typecast':!![]});if(_0x32db6c['length']){logger[_0x864b('0xa')](_0x864b('0xb'),_0x48b3ac,_[_0x864b('0xc')](_0x32db6c,_0x864b('0xd'))['join'](',\x20'));_0x2ba1fd[_0x864b('0xe')]();}else{var _0xab6aa8=_[_0x864b('0xf')](_0x9d619['agents'],handleFindAgent(_0x3cb1df['name']));if(_0xab6aa8){var _0x56d0f6=(_0x3cb1df[_0x864b('0x10')]||0xa)*0x3e8;var _0x5492f7,_0x5d2036;var _0x51225d=seqqueue['createQueue'](_0x56d0f6);_0x51225d['id']=_0x48b3ac;_0x51225d[_0x864b('0x11')]=_0x56d0f6;_0x51225d['channel']=_0x12593b[_0x864b('0x12')];writeLog(_0x48b3ac,_0xab6aa8,util[_0x864b('0x6')](_0x864b('0x13'),_0x56d0f6));_0x9d619[_0x864b('0x14')][_0x48b3ac]['on']('end',function(){logger['info'](_0x864b('0x15'),_0x48b3ac);clearTimeout(_0x5d2036);_0x5d2036=undefined;_0x51225d[_0x864b('0x16')]();if(_0x9d619[_0x864b('0x14')][_0x48b3ac]){delete _0x9d619[_0x864b('0x14')][_0x48b3ac];}_0x2ba1fd[_0x864b('0xe')]();});_0x9d619[_0x864b('0x14')][_0x48b3ac]['on'](_0x864b('0x17'),function(){if(_0x9d619[_0x864b('0x14')][_0x48b3ac]){delete _0x9d619[_0x864b('0x14')][_0x48b3ac];}});_0x5d2036=setTimeout(function(){logger['info'](_0x864b('0x18'),_0x48b3ac);clearTimeout(_0x5d2036);_0x51225d[_0x864b('0x16')]();_0x2ba1fd[_0x864b('0x19')]();},_0x56d0f6);strategy[_0x864b('0x1a')](_0x51225d,_0xab6aa8,_0x9d619,_0x12593b);}else{logger[_0x864b('0xa')](_0x864b('0x1b'),_0x48b3ac,_0x3cb1df[_0x864b('0x8')]);_0x2ba1fd[_0x864b('0xe')]();}}}catch(_0xe66376){console[_0x864b('0x1c')](_0xe66376);logger[_0x864b('0xa')](_0x864b('0x1d'),_0x48b3ac,_0xe66376[_0x864b('0x1e')]);_0x2ba1fd[_0x864b('0xe')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index cc6d989..344c1d5 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 _0x000b=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','catch','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','message','postText','amazonlex','providerName','providerResponse','stringify','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x1d1331,_0x17d5d5){var _0x37e107=function(_0x450872){while(--_0x450872){_0x1d1331['push'](_0x1d1331['shift']());}};_0x37e107(++_0x17d5d5);}(_0x000b,0xd3));var _0xb000=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x000b[_0x3ec1da];return _0x472358;};'use strict';var _=require(_0xb000('0x0'));var moment=require(_0xb000('0x1'));var AWS=require(_0xb000('0x2'));var utils=require(_0xb000('0x3'));var logger=require(_0xb000('0x4'))(_0xb000('0x5'));var rpc={'chatMessage':require(_0xb000('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb000('0x7')),'faxMessage':require(_0xb000('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x28849e,_0x4141f6){return function(_0x25d671){try{if(!_['isNil'](this[_0xb000('0x9')]['UserId'])){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0xb000('0xc'));return _0x25d671[_0xb000('0xd')]();}var _0x3bb88d={'ContactId':this[_0xb000('0xe')]['id'],'sentAt':moment()[_0xb000('0xf')](_0xb000('0x10')),'direction':_0xb000('0x11')};if(this[_0xb000('0x12')]==='sms'||this[_0xb000('0x12')]==='whatsapp'){_0x3bb88d[_0xb000('0x13')]=this[_0xb000('0x9')][_0xb000('0x13')];}var _0x4d7bf7=this[_0xb000('0x12')];if(_0x4d7bf7===_0xb000('0x14')){_0x3bb88d[_0xb000('0x15')]=this[_0xb000('0x16')]['id'];}else{_0x3bb88d[_[_0xb000('0x17')](_0x4d7bf7)+_0xb000('0x18')]=this[_0xb000('0x16')]['id'];}_0x3bb88d[_['upperFirst'](_0x4d7bf7)+'InteractionId']=this[_0xb000('0x9')]['id'];if(this[_0xb000('0x9')]['created']){var _0x18b16a=_0x4141f6[0x4];if(!_[_0xb000('0x19')](_0x18b16a)){_0x3bb88d[_0xb000('0x1a')]=utils[_0xb000('0x1b')](_0x18b16a,this);return rpc[_0x4d7bf7+_0xb000('0x1c')][_0xb000('0x1d')](_0x3bb88d)['then'](function(_0x55c821){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0x3bb88d[_0xb000('0x1a')]);})[_0xb000('0x1e')](function(_0x5517ed){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,JSON['stringify'](_0x5517ed));})[_0xb000('0x20')](function(){logger[_0xb000('0xa')](_0xb000('0x21'),_0x28849e);_0x25d671[_0xb000('0x22')]();});}else{logger['info'](_0xb000('0x23'),_0x28849e);_0x25d671[_0xb000('0x22')]();}}else{var _0x3602d1=this;var _0x5e787c=new AWS[(_0xb000('0x24'))]({'accessKeyId':_0x4141f6[0x0],'secretAccessKey':_0x4141f6[0x1],'region':_0x4141f6[0x2]});var _0x356193={'botAlias':'$LATEST','botName':_0x4141f6[0x3],'inputText':this[_0xb000('0x25')][_0xb000('0x1a')],'userId':this[_0xb000('0x12')]+':'+this[_0xb000('0x9')]['id']['toString']()};_0x5e787c[_0xb000('0x26')](_0x356193,function(_0x38ab7a,_0x5679b1){if(_0x38ab7a){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,_0x38ab7a[_0xb000('0x25')]);_0x25d671['next']();}else if(_0x5679b1&&_0x5679b1[_0xb000('0x25')]){_0x3602d1[_0xb000('0x1a')][_0xb000('0x27')]=_0x5679b1;_0x3bb88d['body']=_0x5679b1[_0xb000('0x25')];_0x3bb88d[_0xb000('0x28')]=_0xb000('0x27');_0x3bb88d[_0xb000('0x29')]=JSON[_0xb000('0x2a')](_0x5679b1);return rpc[_0x4d7bf7+_0xb000('0x1c')]['create'](_0x3bb88d)[_0xb000('0x2b')](function(_0x286eea){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0x3bb88d['body']);if(_0x5679b1[_0xb000('0x2c')]==_0xb000('0x2d')){_0x25d671[_0xb000('0xd')]();}else{_0x25d671[_0xb000('0x22')]();}})[_0xb000('0x1e')](function(_0x319c0a){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,JSON['stringify'](_0x319c0a));_0x25d671[_0xb000('0xd')]();});}else{_0x25d671['next']();}});}}catch(_0x1ed6a7){logger[_0xb000('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x28849e,JSON['stringify'](_0x1ed6a7));_0x25d671[_0xb000('0x22')]();}};}; \ No newline at end of file +var _0x39bd=['upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','stop','LexRuntime','message','postText','amazonlex','providerName','providerResponse','next','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','account'];(function(_0x4dbe10,_0x25ef1c){var _0x53d07f=function(_0x314744){while(--_0x314744){_0x4dbe10['push'](_0x4dbe10['shift']());}};_0x53d07f(++_0x25ef1c);}(_0x39bd,0x1bc));var _0xd39b=function(_0x321826,_0x52b3f8){_0x321826=_0x321826-0x0;var _0x206932=_0x39bd[_0x321826];return _0x206932;};'use strict';var _=require(_0xd39b('0x0'));var moment=require(_0xd39b('0x1'));var AWS=require('aws-sdk');var utils=require(_0xd39b('0x2'));var logger=require(_0xd39b('0x3'))(_0xd39b('0x4'));var rpc={'chatMessage':require(_0xd39b('0x5')),'openchannelMessage':require(_0xd39b('0x6')),'mailMessage':require(_0xd39b('0x7')),'smsMessage':require(_0xd39b('0x8')),'faxMessage':require(_0xd39b('0x9')),'whatsappMessage':require(_0xd39b('0xa'))};exports['consequence']=function(_0x43f88c,_0x4d70cb){return function(_0x52024f){try{if(!_[_0xd39b('0xb')](this['interaction'][_0xd39b('0xc')])){logger[_0xd39b('0xd')](_0xd39b('0xe'),_0x43f88c,_0xd39b('0xf'));return _0x52024f['next']();}var _0x4da06b={'ContactId':this[_0xd39b('0x10')]['id'],'sentAt':moment()[_0xd39b('0x11')](_0xd39b('0x12')),'direction':_0xd39b('0x13')};if(this['channel']==='sms'||this[_0xd39b('0x14')]===_0xd39b('0x15')){_0x4da06b[_0xd39b('0x16')]=this[_0xd39b('0x17')][_0xd39b('0x16')];}var _0xe7b9e2=this['channel'];if(_0xe7b9e2===_0xd39b('0x18')){_0x4da06b['ChatWebsiteId']=this[_0xd39b('0x19')]['id'];}else{_0x4da06b[_[_0xd39b('0x1a')](_0xe7b9e2)+_0xd39b('0x1b')]=this[_0xd39b('0x19')]['id'];}_0x4da06b[_[_0xd39b('0x1a')](_0xe7b9e2)+_0xd39b('0x1c')]=this['interaction']['id'];if(this[_0xd39b('0x17')][_0xd39b('0x1d')]){var _0xdd3de8=_0x4d70cb[0x4];if(!_[_0xd39b('0x1e')](_0xdd3de8)){_0x4da06b[_0xd39b('0x1f')]=utils[_0xd39b('0x20')](_0xdd3de8,this);return rpc[_0xe7b9e2+'Message'][_0xd39b('0x21')](_0x4da06b)[_0xd39b('0x22')](function(_0x37e59e){logger[_0xd39b('0xd')](_0xd39b('0xe'),_0x43f88c,_0x4da06b[_0xd39b('0x1f')]);})[_0xd39b('0x23')](function(_0x3b834a){logger[_0xd39b('0x24')]('[%s][AMAZONLEX]\x20%s',_0x43f88c,JSON[_0xd39b('0x25')](_0x3b834a));})[_0xd39b('0x26')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x43f88c);_0x52024f['stop']();});}else{logger[_0xd39b('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x43f88c);_0x52024f[_0xd39b('0x27')]();}}else{var _0x264d3c=this;var _0x1b2ac2=new AWS[(_0xd39b('0x28'))]({'accessKeyId':_0x4d70cb[0x0],'secretAccessKey':_0x4d70cb[0x1],'region':_0x4d70cb[0x2]});var _0x3dda3d={'botAlias':'$LATEST','botName':_0x4d70cb[0x3],'inputText':this[_0xd39b('0x29')][_0xd39b('0x1f')],'userId':this['channel']+':'+this[_0xd39b('0x17')]['id']['toString']()};_0x1b2ac2[_0xd39b('0x2a')](_0x3dda3d,function(_0x59ee55,_0xbcdcdc){if(_0x59ee55){logger[_0xd39b('0x24')](_0xd39b('0xe'),_0x43f88c,_0x59ee55[_0xd39b('0x29')]);_0x52024f['next']();}else if(_0xbcdcdc&&_0xbcdcdc[_0xd39b('0x29')]){_0x264d3c[_0xd39b('0x1f')][_0xd39b('0x2b')]=_0xbcdcdc;_0x4da06b[_0xd39b('0x1f')]=_0xbcdcdc[_0xd39b('0x29')];_0x4da06b[_0xd39b('0x2c')]=_0xd39b('0x2b');_0x4da06b[_0xd39b('0x2d')]=JSON['stringify'](_0xbcdcdc);return rpc[_0xe7b9e2+'Message'][_0xd39b('0x21')](_0x4da06b)['then'](function(_0x6b91b5){logger[_0xd39b('0xd')](_0xd39b('0xe'),_0x43f88c,_0x4da06b[_0xd39b('0x1f')]);if(_0xbcdcdc['dialogState']=='Failed'){_0x52024f[_0xd39b('0x2e')]();}else{_0x52024f[_0xd39b('0x27')]();}})[_0xd39b('0x23')](function(_0xab3251){logger[_0xd39b('0x24')](_0xd39b('0xe'),_0x43f88c,JSON[_0xd39b('0x25')](_0xab3251));_0x52024f[_0xd39b('0x2e')]();});}else{_0x52024f[_0xd39b('0x2e')]();}});}}catch(_0x27cb1e){logger[_0xd39b('0x24')]('[%s][AMAZONLEX]\x20%s',_0x43f88c,JSON[_0xd39b('0x25')](_0x27cb1e));_0x52024f[_0xd39b('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 5e31d19..23b9566 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 _0xca2a=['update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','One\x20Time\x20already\x20sent','contact','out','body','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','Smtp','host','port','secure','authentication','user','inReplyTo','messageId','','replace','';_0x44718f[_0xaca2('0x34')]={'Auto-Submitted':_0xaca2('0x35'),'X-Auto-Response-Suppress':_0xaca2('0x36'),'Precedence':_0xaca2('0x37')};return mailRpc[_0xaca2('0x38')](_0x32314b,_0x44718f)[_0xaca2('0x39')](function(_0x2a9a7b){logger[_0xaca2('0x16')](_0xaca2('0x3a'),_0x59f978);_0x44718f[_0xaca2('0x30')]=_0x2a9a7b[_0xaca2('0x1d')]['messageId'];return rpc[_0x4089a1+_0xaca2('0x28')]['create'](_0x44718f);})[_0xaca2('0x39')](function(_0x3fc246){logger[_0xaca2('0x16')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x3fc246));})[_0xaca2('0x3c')](function(_0x14cd9a){logger[_0xaca2('0x3d')](_0xaca2('0x3e'),_0x59f978,JSON['stringify'](_0x14cd9a));})['finally'](function(){Promise[_0xaca2('0x3f')]()[_0xaca2('0x39')](function(){if(_0x4a73d7[0x0]!=='2'||_0x1564df[_0xaca2('0x40')])return;return rpc[_0x4089a1+'Interaction'][_0xaca2('0x41')](_0x1564df['id'],{'autoreplyExecuted':!![]})['then'](function(_0x57a8c2){logger['info'](_0xaca2('0x42'),_0x59f978,JSON[_0xaca2('0x3b')](_0x57a8c2));})['catch'](function(_0x4938ad){logger[_0xaca2('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59f978,JSON[_0xaca2('0x3b')](_0x4938ad));});})['then'](function(){_0x36b41e[_0xaca2('0x12')]();});});}else{return rpc[this[_0xaca2('0xd')]+_0xaca2('0x28')][_0xaca2('0x43')](_0x44718f)[_0xaca2('0x39')](function(_0x48c242){logger[_0xaca2('0x16')](_0xaca2('0x10'),_0x59f978,_0x44718f[_0xaca2('0x1a')]);})[_0xaca2('0x3c')](function(_0x50837d){logger[_0xaca2('0x3d')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x50837d));})[_0xaca2('0x44')](function(){Promise[_0xaca2('0x3f')]()['then'](function(){if(_0x4a73d7[0x0]!=='2'||_0x1564df[_0xaca2('0x40')])return;return rpc[_0x4089a1+'Interaction'][_0xaca2('0x41')](_0x1564df['id'],{'autoreplyExecuted':!![]})[_0xaca2('0x39')](function(_0x408505){logger[_0xaca2('0x16')](_0xaca2('0x42'),_0x59f978,JSON[_0xaca2('0x3b')](_0x408505));})[_0xaca2('0x3c')](function(_0x5c252a){logger[_0xaca2('0x3d')](_0xaca2('0x45'),_0x59f978,JSON[_0xaca2('0x3b')](_0x5c252a));});})[_0xaca2('0x39')](function(){_0x36b41e['next']();});});}}}catch(_0x2a2896){logger[_0xaca2('0x3d')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x2a2896));_0x36b41e['stop']();}};}; \ No newline at end of file +var _0x1a7d=['[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','read','subject','startsWith','Re:','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','html','replace','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error'];(function(_0x4c9a98,_0x194087){var _0x5be1fd=function(_0x30d8dd){while(--_0x30d8dd){_0x4c9a98['push'](_0x4c9a98['shift']());}};_0x5be1fd(++_0x194087);}(_0x1a7d,0x1ca));var _0xd1a7=function(_0x274838,_0x23a205){_0x274838=_0x274838-0x0;var _0x3f478c=_0x1a7d[_0x274838];return _0x3f478c;};'use strict';var _=require(_0xd1a7('0x0'));var moment=require(_0xd1a7('0x1'));var utils=require(_0xd1a7('0x2'));var logger=require('../../../../config/logger')(_0xd1a7('0x3'));var rpc={'chatMessage':require(_0xd1a7('0x4')),'openchannelMessage':require(_0xd1a7('0x5')),'mailMessage':require(_0xd1a7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xd1a7('0x7')),'whatsappMessage':require(_0xd1a7('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd1a7('0x9')),'mailInteraction':require(_0xd1a7('0xa')),'smsInteraction':require(_0xd1a7('0xb')),'faxInteraction':require(_0xd1a7('0xc')),'whatsappInteraction':require(_0xd1a7('0xd'))};var mailRpc=require(_0xd1a7('0xe'));exports['consequence']=function(_0x4200d5,_0x2ac005,_0x40e6b4,_0x24b0cc){return function(_0x303429){try{var _0x4fccce=this[_0xd1a7('0xf')];if(_0x4fccce===_0xd1a7('0x10')&&_0x24b0cc[_0xd1a7('0x11')][_0xd1a7('0x12')]){logger[_0xd1a7('0x13')](_0xd1a7('0x14'),_0x4200d5,_0xd1a7('0x15'));return _0x303429[_0xd1a7('0x16')]();}if(_0x2ac005[0x0]==='1'&&(_[_0xd1a7('0x17')](this['interaction'][_0xd1a7('0x18')])||!this['interaction'][_0xd1a7('0x18')])){logger[_0xd1a7('0x13')](_0xd1a7('0x14'),_0x4200d5,_0xd1a7('0x19'));return _0x303429[_0xd1a7('0x16')]();}if(_0x2ac005[0x0]==='2'&&this[_0xd1a7('0x1a')][_0xd1a7('0x1b')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4200d5,_0xd1a7('0x1c'));return _0x303429[_0xd1a7('0x16')]();}var _0x565803={'ContactId':this[_0xd1a7('0x1d')]['id'],'sentAt':moment()[_0xd1a7('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xd1a7('0xf')]===_0xd1a7('0x10')){_0x565803[_0xd1a7('0x11')]=utils[_0xd1a7('0x1f')](_0x2ac005[0x2],this);}else{_0x565803[_0xd1a7('0x11')]=utils['getMustacheRender'](_0x2ac005[0x1],this);}if(this[_0xd1a7('0x20')]){_0x565803['to']=this[_0xd1a7('0x20')]['from']||'';if(this[_0xd1a7('0xf')]===_0xd1a7('0x10')&&_0x2ac005[0x1]==='1'){_0x565803['cc']=this[_0xd1a7('0x20')]['cc']||'';}_0x565803[_0xd1a7('0x21')]=this[_0xd1a7('0x20')]['to']||'';_0x565803['phone']=this[_0xd1a7('0x20')]['phone']||'';_0x565803[_0xd1a7('0x22')]=!![];if(this['message']['subject']){_0x565803[_0xd1a7('0x23')]='';_0x565803[_0xd1a7('0x23')]+=_[_0xd1a7('0x24')](this[_0xd1a7('0x20')]['subject'],_0xd1a7('0x25'))?'':'Re:\x20';_0x565803[_0xd1a7('0x23')]+=this[_0xd1a7('0x20')][_0xd1a7('0x23')];}}if(this[_0xd1a7('0xf')]==='chat'){_0x565803[_0xd1a7('0x26')]=this[_0xd1a7('0x27')]['id'];}else{_0x565803[_['upperFirst'](this['channel'])+'AccountId']=this[_0xd1a7('0x27')]['id'];}_0x565803[_[_0xd1a7('0x28')](this['channel'])+_0xd1a7('0x29')]=this[_0xd1a7('0x1a')]['id'];var _0x349f90=this['interaction'];if(rpc[this[_0xd1a7('0xf')]+_0xd1a7('0x2a')]){if(this[_0xd1a7('0xf')]===_0xd1a7('0x10')){var _0x2a0426={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0xd1a7('0x2b')][_0xd1a7('0x2c')]){_0x2a0426[_0xd1a7('0x2c')]=this['account']['Smtp']['service'];}else{_0x2a0426[_0xd1a7('0x2d')]=this[_0xd1a7('0x27')][_0xd1a7('0x2b')][_0xd1a7('0x2d')];_0x2a0426[_0xd1a7('0x2e')]=this[_0xd1a7('0x27')]['Smtp'][_0xd1a7('0x2e')];_0x2a0426[_0xd1a7('0x2f')]=this[_0xd1a7('0x27')][_0xd1a7('0x2b')][_0xd1a7('0x2f')];}if(this[_0xd1a7('0x27')][_0xd1a7('0x2b')][_0xd1a7('0x30')]){_0x2a0426[_0xd1a7('0x31')]={'user':this['account']['Smtp'][_0xd1a7('0x32')],'pass':this[_0xd1a7('0x27')][_0xd1a7('0x2b')]['pass']};}_0x565803[_0xd1a7('0x33')]=this[_0xd1a7('0x20')]['messageId'];_0x565803[_0xd1a7('0x34')]=''+_[_0xd1a7('0x35')](_0x565803[_0xd1a7('0x11')],']+(>|$)/g,''),'priorityTrue':_0x4bb8c9[0x1],'priorityFalse':_0x4bb8c9[0x2]};var _0x19449f=gotoif[_0xf2d7('0x0')](_0x2fb73b,{'typecast':!![]});if(_0x19449f[_0xf2d7('0xd')]){logger[_0xf2d7('0xe')]('[%s][GOTOIF]\x20%s',_0x4c2eb0,_[_0xf2d7('0xf')](_0x19449f,_0xf2d7('0x10'))[_0xf2d7('0x11')](',\x20'));_0x1200bf['stop']();}else{try{var _0xc3afaa=eval('('+_0x2fb73b[_0xf2d7('0x12')]+')');var _0x53520e=_0xc3afaa?_0x2fb73b['priorityTrue']:_0x2fb73b[_0xf2d7('0x13')];logger[_0xf2d7('0x14')](_0xf2d7('0x15'),_0x4c2eb0,_0x2fb73b[_0xf2d7('0x12')],_0xc3afaa,_0x53520e||_0xf2d7('0x16'));if(_0x53520e){var _0x7e81fe=_[_0xf2d7('0x17')](_0x1200bf[_0xf2d7('0x18')](),{'p':_0x53520e});if(_0x7e81fe>=0x0){logger[_0xf2d7('0x14')](_0xf2d7('0x19'),_0x4c2eb0,_0x53520e||_0xf2d7('0x16'),_0x7e81fe);_0x1200bf['next'](_0x7e81fe);}else{logger[_0xf2d7('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4c2eb0,_0x53520e||_0xf2d7('0x16'));_0x1200bf[_0xf2d7('0x1a')]();}}else{_0x1200bf[_0xf2d7('0x16')]();}}catch(_0x3080f5){logger['error'](_0xf2d7('0x1b'),_0x4c2eb0,_0x3080f5[_0xf2d7('0x10')]);_0x1200bf[_0xf2d7('0x1a')]();}}}catch(_0xa34a02){logger['error'](_0xf2d7('0x1c'),_0x4c2eb0,JSON[_0xf2d7('0x1d')](_0xa34a02));_0x1200bf['stop']();}};}; \ No newline at end of file +var _0x25f0=['error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','./utils','../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x2db466,_0x228988){var _0x414add=function(_0x2e8823){while(--_0x2e8823){_0x2db466['push'](_0x2db466['shift']());}};_0x414add(++_0x228988);}(_0x25f0,0x94));var _0x025f=function(_0x4da637,_0xe9fd4c){_0x4da637=_0x4da637-0x0;var _0x51bd8a=_0x25f0[_0x4da637];return _0x51bd8a;};'use strict';var schema=require('validate');var _=require(_0x025f('0x0'));var htmlToText=require('html-to-text');var utils=require(_0x025f('0x1'));var logger=require(_0x025f('0x2'))(_0x025f('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x025f('0x4'),'message':_0x025f('0x5')},'priorityFalse':{'type':_0x025f('0x4'),'message':_0x025f('0x6')}});exports[_0x025f('0x7')]=function(_0x43baec,_0x19c02d){return function(_0x3e2e16){try{var _0x23f9e0={'condition':htmlToText[_0x025f('0x8')](utils['getMustacheRender'](_0x19c02d[0x0],this),{'wordwrap':![]})[_0x025f('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x19c02d[0x1],'priorityFalse':_0x19c02d[0x2]};var _0xc0c2d9=gotoif[_0x025f('0xa')](_0x23f9e0,{'typecast':!![]});if(_0xc0c2d9[_0x025f('0xb')]){logger['error'](_0x025f('0xc'),_0x43baec,_[_0x025f('0xd')](_0xc0c2d9,_0x025f('0xe'))[_0x025f('0xf')](',\x20'));_0x3e2e16[_0x025f('0x10')]();}else{try{var _0x20f177=eval('('+_0x23f9e0[_0x025f('0x11')]+')');var _0x54ac75=_0x20f177?_0x23f9e0[_0x025f('0x12')]:_0x23f9e0[_0x025f('0x13')];logger['info'](_0x025f('0x14'),_0x43baec,_0x23f9e0[_0x025f('0x11')],_0x20f177,_0x54ac75||_0x025f('0x15'));if(_0x54ac75){var _0x4c30b4=_[_0x025f('0x16')](_0x3e2e16['rules'](),{'p':_0x54ac75});if(_0x4c30b4>=0x0){logger[_0x025f('0x17')](_0x025f('0x18'),_0x43baec,_0x54ac75||_0x025f('0x15'),_0x4c30b4);_0x3e2e16['next'](_0x4c30b4);}else{logger['info'](_0x025f('0x19'),_0x43baec,_0x54ac75||'next');_0x3e2e16[_0x025f('0x10')]();}}else{_0x3e2e16[_0x025f('0x15')]();}}catch(_0x2f1880){logger[_0x025f('0x1a')](_0x025f('0x1b'),_0x43baec,_0x2f1880[_0x025f('0xe')]);_0x3e2e16[_0x025f('0x10')]();}}}catch(_0x220cb4){logger[_0x025f('0x1a')](_0x025f('0xc'),_0x43baec,JSON[_0x025f('0x1c')](_0x220cb4));_0x3e2e16[_0x025f('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 c71c094..9515e91 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 _0xdfc3=['message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s'];(function(_0x411ded,_0x59b665){var _0x564124=function(_0x221a0e){while(--_0x221a0e){_0x411ded['push'](_0x411ded['shift']());}};_0x564124(++_0x59b665);}(_0xdfc3,0xe5));var _0x3dfc=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xdfc3[_0x3fba9f];return _0x192cf1;};'use strict';var schema=require(_0x3dfc('0x0'));var _=require(_0x3dfc('0x1'));var logger=require(_0x3dfc('0x2'))(_0x3dfc('0x3'));var gotop=schema({'priority':{'type':_0x3dfc('0x4'),'required':!![],'message':_0x3dfc('0x5')}});exports[_0x3dfc('0x6')]=function(_0x34b6e3,_0x422a37){return function(_0x316417){try{var _0x5100b1={'priority':_0x422a37[0x0]};var _0x40a064=gotop['validate'](_0x5100b1,{'typecast':!![]});if(_0x40a064['length']){logger[_0x3dfc('0x7')](_0x3dfc('0x8'),_0x34b6e3,_['map'](_0x40a064,_0x3dfc('0x9'))['join'](',\x20'));_0x316417[_0x3dfc('0xa')]();}else{logger[_0x3dfc('0xb')](_0x3dfc('0xc'),_0x34b6e3,_0x5100b1['priority']);if(_0x5100b1[_0x3dfc('0xd')]){var _0x5df529=_[_0x3dfc('0xe')](_0x316417[_0x3dfc('0xf')](),{'p':_0x5100b1[_0x3dfc('0xd')]});if(_0x5df529>=0x0){logger[_0x3dfc('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34b6e3,_0x5100b1[_0x3dfc('0xd')]||_0x3dfc('0x10'),_0x5df529);_0x316417[_0x3dfc('0x10')](_0x5df529);}else{logger[_0x3dfc('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x34b6e3,_0x5100b1['priority']||'next');_0x316417[_0x3dfc('0xa')]();}}else{_0x316417['next']();}}}catch(_0x1feede){logger[_0x3dfc('0x7')](_0x3dfc('0x8'),_0x34b6e3,JSON['stringify'](_0x1feede));_0x316417[_0x3dfc('0xa')]();}};}; \ No newline at end of file +var _0xa386=['error','[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','consequence','length'];(function(_0x49a500,_0x167764){var _0x1118cb=function(_0x1c949d){while(--_0x1c949d){_0x49a500['push'](_0x49a500['shift']());}};_0x1118cb(++_0x167764);}(_0xa386,0x1f2));var _0x6a38=function(_0xbfba71,_0x36d378){_0xbfba71=_0xbfba71-0x0;var _0x39470b=_0xa386[_0xbfba71];return _0x39470b;};'use strict';var schema=require(_0x6a38('0x0'));var _=require(_0x6a38('0x1'));var logger=require(_0x6a38('0x2'))(_0x6a38('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x6a38('0x4')]=function(_0x4f3e12,_0x2d7246){return function(_0x36ebfe){try{var _0x5937c2={'priority':_0x2d7246[0x0]};var _0x5406c1=gotop['validate'](_0x5937c2,{'typecast':!![]});if(_0x5406c1[_0x6a38('0x5')]){logger[_0x6a38('0x6')](_0x6a38('0x7'),_0x4f3e12,_[_0x6a38('0x8')](_0x5406c1,_0x6a38('0x9'))['join'](',\x20'));_0x36ebfe[_0x6a38('0xa')]();}else{logger['info'](_0x6a38('0xb'),_0x4f3e12,_0x5937c2[_0x6a38('0xc')]);if(_0x5937c2[_0x6a38('0xc')]){var _0x42ced7=_[_0x6a38('0xd')](_0x36ebfe[_0x6a38('0xe')](),{'p':_0x5937c2[_0x6a38('0xc')]});if(_0x42ced7>=0x0){logger[_0x6a38('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4f3e12,_0x5937c2[_0x6a38('0xc')]||_0x6a38('0x10'),_0x42ced7);_0x36ebfe[_0x6a38('0x10')](_0x42ced7);}else{logger['info'](_0x6a38('0x11'),_0x4f3e12,_0x5937c2['priority']||_0x6a38('0x10'));_0x36ebfe[_0x6a38('0xa')]();}}else{_0x36ebfe[_0x6a38('0x10')]();}}}catch(_0x3e72e4){logger[_0x6a38('0x6')](_0x6a38('0x7'),_0x4f3e12,JSON['stringify'](_0x3e72e4));_0x36ebfe[_0x6a38('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index bae82f9..ca75434 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 _0xc64b=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xc64b,0xaf));var _0xbc64=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xc64b[_0x1f7413];return _0x2d2775;};'use strict';var _=require(_0xbc64('0x0'));var utils=require(_0xbc64('0x1'));var logger=require(_0xbc64('0x2'))(_0xbc64('0x3'));var rpc={'chatMessage':require(_0xbc64('0x4')),'openchannelMessage':require(_0xbc64('0x5')),'mailMessage':require(_0xbc64('0x6')),'smsMessage':require(_0xbc64('0x7')),'faxMessage':require(_0xbc64('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbc64('0x9')]=function(_0x3671e3,_0x4afa1d){return function(_0x38f6a1){try{var _0x33af86={'body':utils['getMustacheRender'](_0x4afa1d[0x0],this),'ContactId':this[_0xbc64('0xa')]['id']};if(this[_0xbc64('0xb')]==='chat'){_0x33af86[_0xbc64('0xc')]=this[_0xbc64('0xd')]['id'];}else{_0x33af86[_[_0xbc64('0xe')](this[_0xbc64('0xb')])+_0xbc64('0xf')]=this[_0xbc64('0xd')]['id'];}_0x33af86[_[_0xbc64('0xe')](this[_0xbc64('0xb')])+_0xbc64('0x10')]=this[_0xbc64('0x11')]['id'];if(rpc[this[_0xbc64('0xb')]+_0xbc64('0x12')]){return rpc[this['channel']+_0xbc64('0x12')][_0xbc64('0x13')](_0x33af86)[_0xbc64('0x14')](function(_0x804ebc){logger[_0xbc64('0x15')](_0xbc64('0x16'),_0x3671e3,_0x33af86[_0xbc64('0x17')]);_0x38f6a1[_0xbc64('0x18')]();})[_0xbc64('0x19')](function(_0xa24e14){logger[_0xbc64('0x1a')](_0xbc64('0x16'),_0x3671e3,JSON[_0xbc64('0x1b')](_0xa24e14));_0x38f6a1[_0xbc64('0x1c')]();});}}catch(_0x1c79d3){logger['error'](_0xbc64('0x16'),_0x3671e3,JSON[_0xbc64('0x1b')](_0x1c79d3));_0x38f6a1[_0xbc64('0x1c')]();}};}; \ No newline at end of file +var _0xd1f1=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','AccountId','account','upperFirst','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger'];(function(_0x55d9d9,_0x134208){var _0x1559da=function(_0x17ec52){while(--_0x17ec52){_0x55d9d9['push'](_0x55d9d9['shift']());}};_0x1559da(++_0x134208);}(_0xd1f1,0x84));var _0x1d1f=function(_0x195299,_0x7a1c77){_0x195299=_0x195299-0x0;var _0x258842=_0xd1f1[_0x195299];return _0x258842;};'use strict';var _=require(_0x1d1f('0x0'));var utils=require(_0x1d1f('0x1'));var logger=require(_0x1d1f('0x2'))(_0x1d1f('0x3'));var rpc={'chatMessage':require(_0x1d1f('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1d1f('0x5')),'smsMessage':require(_0x1d1f('0x6')),'faxMessage':require(_0x1d1f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1d1f('0x8')]=function(_0x13e896,_0x54e8a0){return function(_0x2337fc){try{var _0x5c285a={'body':utils[_0x1d1f('0x9')](_0x54e8a0[0x0],this),'ContactId':this[_0x1d1f('0xa')]['id']};if(this[_0x1d1f('0xb')]===_0x1d1f('0xc')){_0x5c285a['ChatWebsiteId']=this['account']['id'];}else{_0x5c285a[_['upperFirst'](this[_0x1d1f('0xb')])+_0x1d1f('0xd')]=this[_0x1d1f('0xe')]['id'];}_0x5c285a[_[_0x1d1f('0xf')](this['channel'])+_0x1d1f('0x10')]=this[_0x1d1f('0x11')]['id'];if(rpc[this[_0x1d1f('0xb')]+_0x1d1f('0x12')]){return rpc[this[_0x1d1f('0xb')]+_0x1d1f('0x12')]['create'](_0x5c285a)['then'](function(_0x48e2c0){logger[_0x1d1f('0x13')](_0x1d1f('0x14'),_0x13e896,_0x5c285a[_0x1d1f('0x15')]);_0x2337fc[_0x1d1f('0x16')]();})[_0x1d1f('0x17')](function(_0x465f20){logger[_0x1d1f('0x18')](_0x1d1f('0x14'),_0x13e896,JSON[_0x1d1f('0x19')](_0x465f20));_0x2337fc[_0x1d1f('0x1a')]();});}}catch(_0x2ec931){logger[_0x1d1f('0x18')](_0x1d1f('0x14'),_0x13e896,JSON['stringify'](_0x2ec931));_0x2337fc[_0x1d1f('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 2227d94..5c1ea1e 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 _0xf605=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x3835b5,_0x423301){var _0x23d8d6=function(_0x4c9cfa){while(--_0x4c9cfa){_0x3835b5['push'](_0x3835b5['shift']());}};_0x23d8d6(++_0x423301);}(_0xf605,0xd7));var _0x5f60=function(_0x2382e2,_0x1c07e6){_0x2382e2=_0x2382e2-0x0;var _0x5e9fab=_0xf605[_0x2382e2];return _0x5e9fab;};'use strict';var utils=require(_0x5f60('0x0'));var logger=require('../../../../config/logger')(_0x5f60('0x1'));exports[_0x5f60('0x2')]=function(_0x20841b,_0x293554){return function(_0x4bbe02){try{logger[_0x5f60('0x3')](_0x5f60('0x4'),_0x20841b,utils[_0x5f60('0x5')](_0x293554[0x0],this));_0x4bbe02[_0x5f60('0x6')]();}catch(_0x23fd1c){logger[_0x5f60('0x7')](_0x5f60('0x4'),_0x20841b,JSON[_0x5f60('0x8')](_0x23fd1c));_0x4bbe02[_0x5f60('0x9')]();}};}; \ No newline at end of file +var _0x984a=['error','[%s][NOOP]\x20%s','stringify','routing','consequence','info','getMustacheRender','next'];(function(_0x42db70,_0x1a2684){var _0x34e797=function(_0x580b84){while(--_0x580b84){_0x42db70['push'](_0x42db70['shift']());}};_0x34e797(++_0x1a2684);}(_0x984a,0xc3));var _0xa984=function(_0x28c53e,_0x22f67f){_0x28c53e=_0x28c53e-0x0;var _0x2aaf65=_0x984a[_0x28c53e];return _0x2aaf65;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa984('0x0'));exports[_0xa984('0x1')]=function(_0x2ad683,_0x1c5901){return function(_0x4bb0a6){try{logger[_0xa984('0x2')]('[%s][NOOP]\x20%s',_0x2ad683,utils[_0xa984('0x3')](_0x1c5901[0x0],this));_0x4bb0a6[_0xa984('0x4')]();}catch(_0x596331){logger[_0xa984('0x5')](_0xa984('0x6'),_0x2ad683,JSON[_0xa984('0x7')](_0x596331));_0x4bb0a6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 5d9365b..e5f8c50 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 _0xff47=['timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','interaction','channel','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','queue_id','account','queue','from','joinAt','emit','clone','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1b57f9,_0x4b9858){var _0x53c7ae=function(_0x89d9e5){while(--_0x89d9e5){_0x1b57f9['push'](_0x1b57f9['shift']());}};_0x53c7ae(++_0x4b9858);}(_0xff47,0x15c));var _0x7ff4=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xff47[_0x27031e];return _0xfd46b3;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x7ff4('0x0'));var seqqueue=require(_0x7ff4('0x1'));var moment=require(_0x7ff4('0x2'));var Redis=require(_0x7ff4('0x3'));var config=require(_0x7ff4('0x4'));var logger=require(_0x7ff4('0x5'))(_0x7ff4('0x6'));var strategy=require('./strategy');config[_0x7ff4('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x7ff4('0x8'),_0x7ff4('0x9'),_0x7ff4('0xa'),_0x7ff4('0xb'),_0x7ff4('0xc')];function emit(_0x30ae46,_0x2d0b00,_0x2690b8){io['to'](_0x30ae46)[_0x7ff4('0xd')](_0x2d0b00,_0x2690b8);}function emitChannelQueueInteraction(_0x28a02b,_0x459da3,_0x7bcb99,_0x260e6a,_0x2d7b51,_0x1da751,_0x4ecf01,_0x393b88){var _0x2a4ce7=_[_0x7ff4('0xe')](_0x7bcb99);_0x2a4ce7[_0x7ff4('0x8')]=_0x393b88;_0x2a4ce7[_0x7ff4('0xa')]=_0x459da3;_0x2a4ce7[_0x7ff4('0x9')]=_0x260e6a;_0x2a4ce7['id']=_0x2d7b51;if(_0x1da751){_0x4ecf01[util['format']('%sQueuesWaitingInteractions',_0x28a02b)][_0x2d7b51]=_[_0x7ff4('0xf')](_0x2a4ce7,attributes);}else{delete _0x4ecf01[util[_0x7ff4('0x10')](_0x7ff4('0x11'),_0x28a02b)][_0x2d7b51];}emit(util[_0x7ff4('0x10')](_0x7ff4('0x12'),_0x28a02b,_0x459da3),util[_0x7ff4('0x10')](_0x7ff4('0x13'),_0x28a02b,_0x1da751?_0x7ff4('0x14'):_0x7ff4('0x15')),_[_0x7ff4('0xf')](_0x2a4ce7,attributes));}var rpc={'openchannelQueueReport':require(_0x7ff4('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7ff4('0x17')),'smsQueueReport':require(_0x7ff4('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7ff4('0x19'),'required':!![],'message':_0x7ff4('0x1a')},'timeout':{'type':'number','message':_0x7ff4('0x1b')}});function startRouting(_0x4f9da7,_0x3ec51f,_0x16390d,_0x27651e){if(_0x4f9da7&&_0x3ec51f&&_0x16390d){_0x3ec51f[_0x7ff4('0x1c')]+=0x1;var _0x4ad58f={'uniqueid':_0x4f9da7,'from':_0x16390d[_0x7ff4('0x1d')]?_0x16390d[_0x7ff4('0x1d')][_0x7ff4('0xb')]:'','joinAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'ContactId':_0x16390d['contact']?_0x16390d[_0x7ff4('0x1f')]['id']:null,'ListId':_0x16390d[_0x7ff4('0x20')]?_0x16390d[_0x7ff4('0x20')]['id']:null};_0x4ad58f[_['upperFirst'](_0x16390d['channel'])+_0x7ff4('0x21')]=_0x3ec51f['id']||null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d['channel'])+'InteractionId']=_0x16390d[_0x7ff4('0x23')]?_0x16390d[_0x7ff4('0x23')]['id']:null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d[_0x7ff4('0x24')])+_0x7ff4('0x25')]=_0x16390d[_0x7ff4('0x26')]?_0x16390d[_0x7ff4('0x26')]['id']:null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d[_0x7ff4('0x24')])+(_0x16390d[_0x7ff4('0x24')]!=='chat'?_0x7ff4('0x27'):_0x7ff4('0x28'))]=_0x16390d[_0x7ff4('0x9')]?_0x16390d[_0x7ff4('0x9')]['id']:null;logger['info'](util[_0x7ff4('0x10')](_0x7ff4('0x29'),_0x4f9da7,_0x3ec51f['name']));emitChannelQueueInteraction(_0x16390d[_0x7ff4('0x24')],_0x3ec51f[_0x7ff4('0x2a')],_0x4ad58f,_0x16390d['account'][_0x7ff4('0x2a')],_0x16390d['message']['id'],!![],_0x27651e,_0x3ec51f['id']);if(rpc[_0x16390d[_0x7ff4('0x24')]+_0x7ff4('0x2b')]){return rpc[_0x16390d['channel']+'QueueReport'][_0x7ff4('0x2c')](_0x4ad58f)[_0x7ff4('0x2d')](function(_0x757da5){logger[_0x7ff4('0x2e')](_0x7ff4('0x2f'));});}}}function stopRouting(_0x428369,_0x181218,_0xe2e48f,_0x58b84d){if(_0x428369&&_0x181218){_0x181218[_0x7ff4('0x1c')]-=0x1;var _0x1eced3={'leaveAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'acceptAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'reason':_0x7ff4('0x30')};logger['info'](util['format'](_0x7ff4('0x31'),_0x428369,_0x181218[_0x7ff4('0x2a')]));emitChannelQueueInteraction(_0xe2e48f['channel'],_0x181218[_0x7ff4('0x2a')],_0xe2e48f[_0x7ff4('0x1d')],_0xe2e48f[_0x7ff4('0x9')][_0x7ff4('0x2a')],_0xe2e48f[_0x7ff4('0x26')]['id'],![],_0x58b84d,_0x181218['id']);if(rpc[_0xe2e48f[_0x7ff4('0x24')]+'QueueReport']){return rpc[_0xe2e48f[_0x7ff4('0x24')]+_0x7ff4('0x2b')][_0x7ff4('0x32')](_0x428369,_0x1eced3)['catch'](function(_0x41a84f){logger[_0x7ff4('0x2e')](_0x7ff4('0x33'));});}}}function endRouting(_0xf90eab,_0x23b6fc,_0x592e39,_0x5b99e6){if(_0xf90eab&&_0x23b6fc){_0x23b6fc[_0x7ff4('0x1c')]-=0x1;var _0x12c84a={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'reason':_0x7ff4('0x34')};logger[_0x7ff4('0x35')](util['format'](_0x7ff4('0x36'),_0xf90eab,_0x23b6fc[_0x7ff4('0x2a')]));emitChannelQueueInteraction(_0x592e39[_0x7ff4('0x24')],_0x23b6fc['name'],_0x592e39[_0x7ff4('0x1d')],_0x592e39['account'][_0x7ff4('0x2a')],_0x592e39[_0x7ff4('0x26')]['id'],![],_0x5b99e6);if(rpc[_0x592e39['channel']+_0x7ff4('0x2b')]){return rpc[_0x592e39[_0x7ff4('0x24')]+_0x7ff4('0x2b')][_0x7ff4('0x32')](_0xf90eab,_0x12c84a)[_0x7ff4('0x2d')](function(_0x4c8c72){logger['error'](_0x7ff4('0x33'));});}}}function handleFindQueue(_0x33b0f9){return function(_0x2d2f4c){return _0x2d2f4c['name'][_0x7ff4('0x37')]()===_0x33b0f9['toLowerCase']();};}exports['consequence']=function(_0x2fee0f,_0x58e907,_0x20113d,_0x7cb6e8){return function(_0x3d619b){try{var _0x5e6bc8={'name':_0x58e907[0x0],'timeout':_0x58e907[0x1]};var _0x3f8dd9=queue[_0x7ff4('0x38')](_0x5e6bc8,{'typecast':!![]});if(_0x3f8dd9['length']){logger[_0x7ff4('0x2e')](_0x7ff4('0x39'),_0x2fee0f,_[_0x7ff4('0x3a')](_0x3f8dd9,_0x7ff4('0x26'))['join'](',\x20'));_0x3d619b[_0x7ff4('0x3b')]();}else{var _0x3a1415=_['find'](_0x20113d[_0x7cb6e8[_0x7ff4('0x24')]+_0x7ff4('0x3c')],handleFindQueue(_0x5e6bc8[_0x7ff4('0x2a')]));if(_0x3a1415){startRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);var _0x207727=(_0x3a1415[_0x7ff4('0x34')]||0xa)*0x3e8;var _0x1f95d0=(_0x5e6bc8['timeout']||0x14)*0x3e8;var _0x2b1ee5,_0x339f44;if(_0x207727>_0x1f95d0){_0x1f95d0=_0x207727;}var _0x31bc01=seqqueue[_0x7ff4('0x3d')](_0x207727);_0x31bc01['id']=_0x2fee0f;_0x31bc01['atimeout']=_0x207727;_0x31bc01[_0x7ff4('0x3e')]=_0x1f95d0;_0x31bc01[_0x7ff4('0x24')]=_0x7cb6e8[_0x7ff4('0x24')];_0x20113d['rules'][_0x2fee0f]['on'](_0x7ff4('0x3f'),function(){logger[_0x7ff4('0x35')](_0x7ff4('0x40'),_0x2fee0f);stopRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);clearTimeout(_0x2b1ee5);_0x2b1ee5=undefined;_0x31bc01[_0x7ff4('0x41')](!![]);if(_0x20113d[_0x7ff4('0x42')][_0x2fee0f]){delete _0x20113d['rules'][_0x2fee0f];}_0x3d619b[_0x7ff4('0x3b')]();});_0x20113d[_0x7ff4('0x42')][_0x2fee0f]['on'](_0x7ff4('0x43'),function(){if(_0x20113d[_0x7ff4('0x42')][_0x2fee0f]){delete _0x20113d[_0x7ff4('0x42')][_0x2fee0f];}});_0x2b1ee5=setTimeout(function(){logger[_0x7ff4('0x35')](_0x7ff4('0x44'),_0x2fee0f);endRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);clearTimeout(_0x2b1ee5);_0x31bc01[_0x7ff4('0x41')](!![]);_0x3d619b['next']();},_0x1f95d0);switch(_0x3a1415[_0x7ff4('0x45')]){case _0x7ff4('0x46'):strategy[_0x7ff4('0x46')](_0x31bc01,_0x3a1415,_0x20113d,_0x7cb6e8);break;default:strategy[_0x7ff4('0x47')](_0x31bc01,_0x3a1415,_0x20113d,_0x7cb6e8);}}else{logger[_0x7ff4('0x2e')](_0x7ff4('0x48'),_0x2fee0f,_0x5e6bc8['name']);_0x3d619b[_0x7ff4('0x3b')]();}}}catch(_0x2aac2a){console[_0x7ff4('0x49')](_0x2aac2a);logger[_0x7ff4('0x2e')](_0x7ff4('0x39'),_0x2fee0f,_0x2aac2a[_0x7ff4('0x4a')]);_0x3d619b['stop']();}};}; \ No newline at end of file +var _0x6643=['end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','queue','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','info','name','QueueReport','create','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout','toLowerCase','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','qtimeout','rules'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6643,0x1d9));var _0x3664=function(_0x5dd5bc,_0x528adf){_0x5dd5bc=_0x5dd5bc-0x0;var _0x47cb21=_0x6643[_0x5dd5bc];return _0x47cb21;};'use strict';var schema=require(_0x3664('0x0'));var _=require(_0x3664('0x1'));var util=require(_0x3664('0x2'));var seqqueue=require(_0x3664('0x3'));var moment=require(_0x3664('0x4'));var Redis=require(_0x3664('0x5'));var config=require('../../../../config/environment');var logger=require(_0x3664('0x6'))(_0x3664('0x7'));var strategy=require(_0x3664('0x8'));config[_0x3664('0x9')]=_[_0x3664('0xa')](config[_0x3664('0x9')],{'host':_0x3664('0xb'),'port':0x18eb});var io=require(_0x3664('0xc'))(new Redis(config['redis']));var attributes=['id',_0x3664('0xd'),_0x3664('0xe'),'queue',_0x3664('0xf'),_0x3664('0x10')];function emit(_0x352c0d,_0x5a0522,_0x580472){io['to'](_0x352c0d)[_0x3664('0x11')](_0x5a0522,_0x580472);}function emitChannelQueueInteraction(_0x4e294e,_0x119ff5,_0x64b6fb,_0x685224,_0x4a2271,_0x21ec75,_0x378185,_0x5eeca1){var _0x1959c5=_[_0x3664('0x12')](_0x64b6fb);_0x1959c5[_0x3664('0xd')]=_0x5eeca1;_0x1959c5[_0x3664('0x13')]=_0x119ff5;_0x1959c5[_0x3664('0xe')]=_0x685224;_0x1959c5['id']=_0x4a2271;if(_0x21ec75){_0x378185[util['format'](_0x3664('0x14'),_0x4e294e)][_0x4a2271]=_['pick'](_0x1959c5,attributes);}else{delete _0x378185[util[_0x3664('0x15')](_0x3664('0x14'),_0x4e294e)][_0x4a2271];}emit(util['format'](_0x3664('0x16'),_0x4e294e,_0x119ff5),util[_0x3664('0x15')](_0x3664('0x17'),_0x4e294e,_0x21ec75?_0x3664('0x18'):_0x3664('0x19')),_['pick'](_0x1959c5,attributes));}var rpc={'openchannelQueueReport':require(_0x3664('0x1a')),'mailQueueReport':require(_0x3664('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x3664('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3664('0x1d'))};var queue=schema({'name':{'type':_0x3664('0x1e'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x3664('0x1f'),'message':_0x3664('0x20')}});function startRouting(_0x14defa,_0x53a477,_0x3032d1,_0x174553){if(_0x14defa&&_0x53a477&&_0x3032d1){_0x53a477[_0x3664('0x21')]+=0x1;var _0x197e9c={'uniqueid':_0x14defa,'from':_0x3032d1[_0x3664('0x22')]?_0x3032d1[_0x3664('0x22')]['from']:'','joinAt':moment()[_0x3664('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3032d1['contact']?_0x3032d1[_0x3664('0x23')]['id']:null,'ListId':_0x3032d1[_0x3664('0x24')]?_0x3032d1[_0x3664('0x24')]['id']:null};_0x197e9c[_[_0x3664('0x25')](_0x3032d1[_0x3664('0x26')])+_0x3664('0x27')]=_0x53a477['id']||null;_0x197e9c[_[_0x3664('0x25')](_0x3032d1[_0x3664('0x26')])+'InteractionId']=_0x3032d1['interaction']?_0x3032d1[_0x3664('0x28')]['id']:null;_0x197e9c[_['upperFirst'](_0x3032d1[_0x3664('0x26')])+'MessageId']=_0x3032d1[_0x3664('0x29')]?_0x3032d1[_0x3664('0x29')]['id']:null;_0x197e9c[_[_0x3664('0x25')](_0x3032d1[_0x3664('0x26')])+(_0x3032d1[_0x3664('0x26')]!==_0x3664('0x2a')?_0x3664('0x2b'):'WebsiteId')]=_0x3032d1['account']?_0x3032d1[_0x3664('0xe')]['id']:null;logger[_0x3664('0x2c')](util[_0x3664('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x14defa,_0x53a477[_0x3664('0x2d')]));emitChannelQueueInteraction(_0x3032d1[_0x3664('0x26')],_0x53a477[_0x3664('0x2d')],_0x197e9c,_0x3032d1[_0x3664('0xe')][_0x3664('0x2d')],_0x3032d1[_0x3664('0x29')]['id'],!![],_0x174553,_0x53a477['id']);if(rpc[_0x3032d1[_0x3664('0x26')]+_0x3664('0x2e')]){return rpc[_0x3032d1[_0x3664('0x26')]+_0x3664('0x2e')][_0x3664('0x2f')](_0x197e9c)['catch'](function(_0x3eed91){logger['error'](_0x3664('0x30'));});}}}function stopRouting(_0x356975,_0x35c668,_0xbfd9e1,_0x4514f8){if(_0x356975&&_0x35c668){_0x35c668[_0x3664('0x21')]-=0x1;var _0x20177d={'leaveAt':moment()[_0x3664('0x15')](_0x3664('0x31')),'acceptAt':moment()[_0x3664('0x15')](_0x3664('0x31')),'reason':_0x3664('0x32')};logger[_0x3664('0x2c')](util[_0x3664('0x15')](_0x3664('0x33'),_0x356975,_0x35c668[_0x3664('0x2d')]));emitChannelQueueInteraction(_0xbfd9e1['channel'],_0x35c668['name'],_0xbfd9e1['body'],_0xbfd9e1[_0x3664('0xe')][_0x3664('0x2d')],_0xbfd9e1['message']['id'],![],_0x4514f8,_0x35c668['id']);if(rpc[_0xbfd9e1['channel']+_0x3664('0x2e')]){return rpc[_0xbfd9e1[_0x3664('0x26')]+_0x3664('0x2e')][_0x3664('0x34')](_0x356975,_0x20177d)[_0x3664('0x35')](function(_0x3dcd8f){logger[_0x3664('0x36')](_0x3664('0x37'));});}}}function endRouting(_0x5787bb,_0x4209e1,_0x2cb16c,_0x213c22){if(_0x5787bb&&_0x4209e1){_0x4209e1[_0x3664('0x21')]-=0x1;var _0x1a942a={'leaveAt':moment()[_0x3664('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3664('0x38')};logger[_0x3664('0x2c')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x5787bb,_0x4209e1[_0x3664('0x2d')]));emitChannelQueueInteraction(_0x2cb16c['channel'],_0x4209e1[_0x3664('0x2d')],_0x2cb16c[_0x3664('0x22')],_0x2cb16c[_0x3664('0xe')][_0x3664('0x2d')],_0x2cb16c[_0x3664('0x29')]['id'],![],_0x213c22);if(rpc[_0x2cb16c[_0x3664('0x26')]+_0x3664('0x2e')]){return rpc[_0x2cb16c['channel']+'QueueReport'][_0x3664('0x34')](_0x5787bb,_0x1a942a)[_0x3664('0x35')](function(_0x261dca){logger[_0x3664('0x36')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x16f5f3){return function(_0x5d0dab){return _0x5d0dab[_0x3664('0x2d')][_0x3664('0x39')]()===_0x16f5f3[_0x3664('0x39')]();};}exports['consequence']=function(_0x1eb2a6,_0x37c71a,_0x3e7ea3,_0x380530){return function(_0x4376bf){try{var _0x1d4385={'name':_0x37c71a[0x0],'timeout':_0x37c71a[0x1]};var _0x301e6b=queue[_0x3664('0x0')](_0x1d4385,{'typecast':!![]});if(_0x301e6b['length']){logger[_0x3664('0x36')](_0x3664('0x3a'),_0x1eb2a6,_['map'](_0x301e6b,_0x3664('0x29'))[_0x3664('0x3b')](',\x20'));_0x4376bf[_0x3664('0x3c')]();}else{var _0x48775d=_[_0x3664('0x3d')](_0x3e7ea3[_0x380530[_0x3664('0x26')]+_0x3664('0x3e')],handleFindQueue(_0x1d4385[_0x3664('0x2d')]));if(_0x48775d){startRouting(_0x1eb2a6,_0x48775d,_0x380530,_0x3e7ea3);var _0x26b476=(_0x48775d[_0x3664('0x38')]||0xa)*0x3e8;var _0x3165fc=(_0x1d4385['timeout']||0x14)*0x3e8;var _0x40d543,_0x5a63bc;if(_0x26b476>_0x3165fc){_0x3165fc=_0x26b476;}var _0x3fd512=seqqueue[_0x3664('0x3f')](_0x26b476);_0x3fd512['id']=_0x1eb2a6;_0x3fd512['atimeout']=_0x26b476;_0x3fd512[_0x3664('0x40')]=_0x3165fc;_0x3fd512[_0x3664('0x26')]=_0x380530[_0x3664('0x26')];_0x3e7ea3[_0x3664('0x41')][_0x1eb2a6]['on'](_0x3664('0x42'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1eb2a6);stopRouting(_0x1eb2a6,_0x48775d,_0x380530,_0x3e7ea3);clearTimeout(_0x40d543);_0x40d543=undefined;_0x3fd512[_0x3664('0x43')](!![]);if(_0x3e7ea3[_0x3664('0x41')][_0x1eb2a6]){delete _0x3e7ea3[_0x3664('0x41')][_0x1eb2a6];}_0x4376bf[_0x3664('0x3c')]();});_0x3e7ea3[_0x3664('0x41')][_0x1eb2a6]['on'](_0x3664('0x44'),function(){if(_0x3e7ea3[_0x3664('0x41')][_0x1eb2a6]){delete _0x3e7ea3[_0x3664('0x41')][_0x1eb2a6];}});_0x40d543=setTimeout(function(){logger['info'](_0x3664('0x45'),_0x1eb2a6);endRouting(_0x1eb2a6,_0x48775d,_0x380530,_0x3e7ea3);clearTimeout(_0x40d543);_0x3fd512['close'](!![]);_0x4376bf[_0x3664('0x46')]();},_0x3165fc);switch(_0x48775d[_0x3664('0x47')]){case _0x3664('0x48'):strategy['rrmemory'](_0x3fd512,_0x48775d,_0x3e7ea3,_0x380530);break;default:strategy[_0x3664('0x49')](_0x3fd512,_0x48775d,_0x3e7ea3,_0x380530);}}else{logger['error'](_0x3664('0x4a'),_0x1eb2a6,_0x1d4385[_0x3664('0x2d')]);_0x4376bf[_0x3664('0x3c')]();}}}catch(_0x1d927d){console[_0x3664('0x4b')](_0x1d927d);logger[_0x3664('0x36')](_0x3664('0x3a'),_0x1eb2a6,_0x1d927d[_0x3664('0x4c')]);_0x4376bf['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 9952cd2..88c02b8 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 _0x1e7c=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','handleRun','bind','handleTimeout','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','isAgentAvailable','busy','showNotification','writeLog','RINGING',':FORCED'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x1e7c,0x1b7));var _0xc1e7=function(_0xe3fc30,_0x30f7e5){_0xe3fc30=_0xe3fc30-0x0;var _0x116a1e=_0x1e7c[_0xe3fc30];return _0x116a1e;};'use strict';var _=require(_0xc1e7('0x0'));var uuid=require(_0xc1e7('0x1'));var util=require(_0xc1e7('0x2'));var logger=require(_0xc1e7('0x3'))('routing');var Agent=function(_0x5c66b2,_0x4874bc,_0x186461,_0x29f116){this[_0xc1e7('0x4')]=uuid['v4']();this[_0xc1e7('0x5')]=_0x5c66b2;this['agent']=_0x4874bc;this[_0xc1e7('0x6')]=_0x186461;this[_0xc1e7('0x7')]=_0x29f116;this[_0xc1e7('0x5')]['push'](this[_0xc1e7('0x8')][_0xc1e7('0x9')](this),this['handleTimeout'][_0xc1e7('0x9')](this));this['squeue']['on']('timeout',this[_0xc1e7('0xa')][_0xc1e7('0x9')](this));this[_0xc1e7('0x5')]['on']('drained',this[_0xc1e7('0xb')][_0xc1e7('0x9')](this));};Agent[_0xc1e7('0xc')][_0xc1e7('0xd')]=function(){this[_0xc1e7('0x5')][_0xc1e7('0xd')](this[_0xc1e7('0x8')][_0xc1e7('0x9')](this),this[_0xc1e7('0xa')][_0xc1e7('0x9')](this));};Agent['prototype'][_0xc1e7('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xc1e7('0xc')][_0xc1e7('0x8')]=function(_0x24d2a2){logger[_0xc1e7('0xe')](_0xc1e7('0xf'),this[_0xc1e7('0x5')]['id'],this['agent']['id']);if(_[_0xc1e7('0x10')](this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);setTimeout(this['push'][_0xc1e7('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0xc1e7('0x13')](this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']],this['squeue']['channel'],![])){this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']][_0xc1e7('0x14')]=!![];this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0xc1e7('0x15')](this[_0xc1e7('0x4')],this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']],null,this['routing']);util[_0xc1e7('0x16')](this['squeue']['id'],this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']],_0xc1e7('0x17')+(this[_0xc1e7('0x7')]['forcedOwnership']?_0xc1e7('0x18'):''));}else{logger[_0xc1e7('0xe')](_0xc1e7('0x19'),this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);setTimeout(this[_0xc1e7('0xd')][_0xc1e7('0x9')](this),0x3e8);}}};Agent[_0xc1e7('0xc')]['handleTimeout']=function(_0x5a5359){if(_[_0xc1e7('0x10')](this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']])){return logger[_0xc1e7('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc1e7('0x5')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);util['hideNotification'](this[_0xc1e7('0x4')],this['squeue']['id'],this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']],null,this[_0xc1e7('0x7')]);this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']][_0xc1e7('0x14')]=![];this[_0xc1e7('0x6')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xc1e7('0x16')](this[_0xc1e7('0x5')]['id'],this['realtime'][_0xc1e7('0x11')][this['agent']['id']],_0x5a5359?_0xc1e7('0x1a'):_0xc1e7('0x1b'));}if(!_0x5a5359){setTimeout(this[_0xc1e7('0xd')][_0xc1e7('0x9')](this),0x3e8);}};function agent(_0x546ffb,_0x131c65,_0x39cced,_0x700254){return new Agent(_0x546ffb,_0x131c65,_0x39cced,_0x700254);}module[_0xc1e7('0x1c')]=agent; \ No newline at end of file +var _0x3403=['bind','drained','handleDrained','prototype','handleRun','handleTimeout','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','routing','busyQueue','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','squeue','agent','push'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x3403,0x165));var _0x3340=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3403[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x3340('0x0'));var uuid=require('uuid');var util=require(_0x3340('0x1'));var logger=require(_0x3340('0x2'))('routing');var Agent=function(_0x9fd896,_0x242b42,_0x389f3c,_0x2bf293){this['notificationId']=uuid['v4']();this[_0x3340('0x3')]=_0x9fd896;this[_0x3340('0x4')]=_0x242b42;this['realtime']=_0x389f3c;this['routing']=_0x2bf293;this[_0x3340('0x3')][_0x3340('0x5')](this['handleRun'][_0x3340('0x6')](this),this['handleTimeout'][_0x3340('0x6')](this));this[_0x3340('0x3')]['on']('timeout',this['handleTimeout'][_0x3340('0x6')](this));this['squeue']['on'](_0x3340('0x7'),this[_0x3340('0x8')][_0x3340('0x6')](this));};Agent[_0x3340('0x9')][_0x3340('0x5')]=function(){this[_0x3340('0x3')][_0x3340('0x5')](this[_0x3340('0xa')][_0x3340('0x6')](this),this[_0x3340('0xb')][_0x3340('0x6')](this));};Agent[_0x3340('0x9')][_0x3340('0x8')]=function(){this[_0x3340('0xb')](!![]);};Agent[_0x3340('0x9')][_0x3340('0xa')]=function(_0x21626b){logger[_0x3340('0xc')](_0x3340('0xd'),this[_0x3340('0x3')]['id'],this[_0x3340('0x4')]['id']);if(_[_0x3340('0xe')](this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']])){logger[_0x3340('0xc')](_0x3340('0x11'),this[_0x3340('0x3')]['id'],this[_0x3340('0x4')]['id']);setTimeout(this[_0x3340('0x5')][_0x3340('0x6')](this),0x3e8);}else{if(this['routing'][_0x3340('0x12')]||util['isAgentAvailable'](this[_0x3340('0x3')]['id'],this[_0x3340('0xf')][_0x3340('0x10')][this['agent']['id']],this[_0x3340('0x3')]['channel'],![])){this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']][_0x3340('0x13')]=!![];this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']]['busyQueue']=undefined;util[_0x3340('0x14')](this[_0x3340('0x15')],this[_0x3340('0x3')]['id'],this['realtime'][_0x3340('0x10')][this[_0x3340('0x4')]['id']],null,this['routing']);util[_0x3340('0x16')](this[_0x3340('0x3')]['id'],this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']],_0x3340('0x17')+(this['routing'][_0x3340('0x12')]?_0x3340('0x18'):''));}else{logger[_0x3340('0xc')](_0x3340('0x19'),this['squeue']['id'],this[_0x3340('0x4')]['id']);setTimeout(this[_0x3340('0x5')][_0x3340('0x6')](this),0x3e8);}}};Agent['prototype'][_0x3340('0xb')]=function(_0x332f31){if(_[_0x3340('0xe')](this[_0x3340('0xf')][_0x3340('0x10')][this['agent']['id']])){return logger['info'](_0x3340('0x11'),this['squeue']['id'],this[_0x3340('0x4')]['id']);}else{logger['info'](_0x3340('0x1a'),this['squeue']['id'],this[_0x3340('0x4')]['id']);util[_0x3340('0x1b')](this[_0x3340('0x15')],this[_0x3340('0x3')]['id'],this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']],null,this[_0x3340('0x1c')]);this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']]['busy']=![];this['realtime'][_0x3340('0x10')][this[_0x3340('0x4')]['id']][_0x3340('0x1d')]=undefined;util[_0x3340('0x16')](this['squeue']['id'],this[_0x3340('0xf')][_0x3340('0x10')][this[_0x3340('0x4')]['id']],_0x332f31?_0x3340('0x1e'):_0x3340('0x1f'));}if(!_0x332f31){setTimeout(this[_0x3340('0x5')]['bind'](this),0x3e8);}};function agent(_0x5d0a8c,_0x442b3a,_0x5d0bcf,_0x4da47e){return new Agent(_0x5d0a8c,_0x442b3a,_0x5d0bcf,_0x4da47e);}module[_0x3340('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 013b154..a10d5a2 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 _0xf185=['../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','writeLog','RINGING','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busy','busyQueue','exports','lodash','./util'];(function(_0x461850,_0x2b6117){var _0x428fac=function(_0x1b06d5){while(--_0x1b06d5){_0x461850['push'](_0x461850['shift']());}};_0x428fac(++_0x2b6117);}(_0xf185,0x1be));var _0x5f18=function(_0x102886,_0x6b168e){_0x102886=_0x102886-0x0;var _0x134992=_0xf185[_0x102886];return _0x134992;};'use strict';var _=require(_0x5f18('0x0'));var uuid=require('uuid');var util=require(_0x5f18('0x1'));var logger=require(_0x5f18('0x2'))(_0x5f18('0x3'));var Beepall=function(_0x3100aa,_0x40e868,_0x12abae,_0x529b25){this[_0x5f18('0x4')]=uuid['v4']();this[_0x5f18('0x5')]=_0x3100aa;this[_0x5f18('0x6')]=_0x40e868;this[_0x5f18('0x7')]=_0x12abae;this['routing']=_0x529b25;this[_0x5f18('0x5')][_0x5f18('0x8')](this['handleRun'][_0x5f18('0x9')](this),this['handleTimeout'][_0x5f18('0x9')](this));this[_0x5f18('0x5')]['on']('timeout',this[_0x5f18('0xa')][_0x5f18('0x9')](this));this['squeue']['on'](_0x5f18('0xb'),this[_0x5f18('0xc')]['bind'](this));};Beepall['prototype'][_0x5f18('0x8')]=function(){this[_0x5f18('0x5')][_0x5f18('0x8')](this['handleRun'][_0x5f18('0x9')](this),this[_0x5f18('0xa')][_0x5f18('0x9')](this));};Beepall[_0x5f18('0xd')][_0x5f18('0xc')]=function(_0x20117d){this[_0x5f18('0xa')](!![]);};Beepall[_0x5f18('0xd')][_0x5f18('0xe')]=function(_0x4a8150){var _0x28e6ad=!![];if(!_['isNil'](this['queue'])&&!_[_0x5f18('0xf')](this[_0x5f18('0x6')][_0x5f18('0x10')])&&this[_0x5f18('0x6')][_0x5f18('0x10')]['length']>0x0){for(var _0x3d61bf=0x0,_0x45cc93;_0x3d61bf0x0){for(var _0x2975f3=0x0,_0x2a166b;_0x2975f30x0&&_0x6651c8[_0x5dc400+'CurrentCapacity']>=_0x6651c8[_0x5dc400+_0x98ca('0x25')]){writeLog(_0x56f799,_0x6651c8,_0x5dc400['toUpperCase']()+_0x98ca('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x5bf77d,_0x14bfb4,_0x540f45,_0x342a83,_0x35b920){return sendNotification(!![],_0x5bf77d,_0x14bfb4,_0x540f45,_0x342a83,_0x35b920);};exports[_0x98ca('0x28')]=function(_0x21a12a,_0x3b3e60,_0x1e7fcf,_0x11389a,_0x1bf154){return sendNotification(![],_0x21a12a,_0x3b3e60,_0x1e7fcf,_0x11389a,_0x1bf154);};exports[_0x98ca('0x29')]=writeLog; \ No newline at end of file +var _0x1261=['info','[%s][QUEUE][AGENT:%s][STATUS:%s]','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','emit','format','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','notification:%s','save'];(function(_0x42bc5b,_0x4be7d7){var _0x294c06=function(_0xaaac33){while(--_0xaaac33){_0x42bc5b['push'](_0x42bc5b['shift']());}};_0x294c06(++_0x4be7d7);}(_0x1261,0x144));var _0x1126=function(_0x478a19,_0x2ff359){_0x478a19=_0x478a19-0x0;var _0x7fd2fa=_0x1261[_0x478a19];return _0x7fd2fa;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var utils=require(_0x1126('0x1'));var Mustache=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var config=require(_0x1126('0x4'));var logger=require(_0x1126('0x5'))(_0x1126('0x6'));config[_0x1126('0x7')]=_[_0x1126('0x8')](config[_0x1126('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1126('0x7')]));function emit(_0x907180,_0x4f239c,_0x17e5f0){io['to'](_0x907180)[_0x1126('0x9')](_0x4f239c,_0x17e5f0);}function sendNotification(_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1,_0x3f09ac,_0x18dbe6){io['to'](util[_0x1126('0xa')]('user:%s',_0x59cfa1[_0x1126('0xb')]))['emit']('user:save',_0x59cfa1);var _0x15c071=_0x18dbe6||{};var _0x561b93=_0x2d9033[_0x1126('0xc')]('.');var _0x1b364a={'uniqueid':_0x3abb0b,'channel':_0x561b93[0x0],'id':_0x561b93[0x1],'title':_0x561b93[0x0]+_0x1126('0xd'),'interactionId':_0x561b93[0x2],'queue':_0x3f09ac?_0x3f09ac[_0x1126('0xb')]:null,'sound':_0x15c071[_0x1126('0xe')][_0x1126('0xf')],'shake':_0x15c071[_0x1126('0xe')][_0x1126('0x10')]};try{if(!_0x15c071[_0x1126('0x11')]){_0x15c071['body']={};}if(_0x3f09ac){_0x15c071['body'][_0x1126('0x12')]=_0x3f09ac;}else if(_0x15c071[_0x1126('0x11')][_0x1126('0x12')]){delete _0x15c071['body'][_0x1126('0x12')];}_0x1b364a['msg']=utils[_0x1126('0x13')](_0x15c071[_0x1126('0xe')][_0x1126('0x14')],_0x15c071);}catch(_0x4e1c97){_0x1b364a[_0x1126('0x15')]=_0x1126('0x16');logger['error'](util['format'](_0x1126('0x17'),_0x3abb0b,_0x4e1c97[_0x1126('0x18')]));}io['to'](util['format']('user:%s',_0x59cfa1[_0x1126('0xb')]))['emit'](util[_0x1126('0xa')](_0x1126('0x19'),_0x245be9?_0x1126('0x1a'):'remove'),_0x1b364a);}function writeLog(_0x2a08ba,_0x49d209,_0x56efeb){return logger[_0x1126('0x1b')](util[_0x1126('0xa')](_0x1126('0x1c'),_0x2a08ba,_0x49d209[_0x1126('0xb')],_0x56efeb));}exports['isAgentAvailable']=function(_0x29ab60,_0x477e6a,_0x48a08d,_0x2175fa){if(_0x477e6a['busy']){writeLog(_0x29ab60,_0x477e6a,'BUSY');return![];}if(!_0x477e6a['online']){writeLog(_0x29ab60,_0x477e6a,_0x1126('0x1d'));return![];}if(_0x477e6a[_0x48a08d+_0x1126('0x1e')]){writeLog(_0x29ab60,_0x477e6a,_0x1126('0x1f'));return![];}if(_0x2175fa&&_0x477e6a[_0x1126('0x20')](_0x48a08d+_0x1126('0x21'))&&_0x477e6a[_0x1126('0x20')](_0x48a08d+_0x1126('0x22'))){if(_0x477e6a[_0x48a08d+_0x1126('0x21')]>0x0&&_0x477e6a[_0x48a08d+'CurrentCapacity']>=_0x477e6a[_0x48a08d+_0x1126('0x21')]){writeLog(_0x29ab60,_0x477e6a,_0x48a08d[_0x1126('0x23')]()+_0x1126('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x541bc9,_0xeb7d89,_0x39bf0e,_0x55e195,_0x2fb797){return sendNotification(!![],_0x541bc9,_0xeb7d89,_0x39bf0e,_0x55e195,_0x2fb797);};exports[_0x1126('0x25')]=function(_0x4a334a,_0x3fa694,_0x4bf807,_0xc62460,_0x4bd50b){return sendNotification(![],_0x4a334a,_0x3fa694,_0x4bf807,_0xc62460,_0x4bd50b);};exports[_0x1126('0x26')]=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 d044344..02a9658 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 _0x1841=['length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','stringify','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x54cda0,_0x3bf6e9){var _0x26f2c2=function(_0x18761f){while(--_0x18761f){_0x54cda0['push'](_0x54cda0['shift']());}};_0x26f2c2(++_0x3bf6e9);}(_0x1841,0xdf));var _0x1184=function(_0x4a6e03,_0x15174e){_0x4a6e03=_0x4a6e03-0x0;var _0x58854e=_0x1841[_0x4a6e03];return _0x58854e;};'use strict';var schema=require('validate');var sh=require(_0x1184('0x0'));var _=require(_0x1184('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1184('0x2'));var system=schema({'command':{'type':_0x1184('0x3'),'required':!![],'message':_0x1184('0x4')}});exports[_0x1184('0x5')]=function(_0xc01198,_0x5a1882){return function(_0x31cb32){try{var _0x22d7c6={'command':_0x5a1882[0x0]};var _0x3e5b3d=system[_0x1184('0x6')](_0x22d7c6,{'typecast':!![]});if(_0x3e5b3d[_0x1184('0x7')]){logger[_0x1184('0x8')](_0x1184('0x9'),_0xc01198,_[_0x1184('0xa')](_0x3e5b3d,_0x1184('0xb'))[_0x1184('0xc')](',\x20'));logger[_0x1184('0xd')](_0x1184('0xe'),_0xc01198);_0x31cb32[_0x1184('0xf')]();}else{var _0x1c49fe=this;var _0xec26d7=utils[_0x1184('0x10')](_0x5a1882[0x0],this);logger[_0x1184('0xd')](_0x1184('0x11'),_0xc01198,_0xec26d7);sh[_0x1184('0x12')](_['trim'](_0xec26d7),function(_0xacebbb,_0x3f4515){logger[_0x1184('0xd')](_0x1184('0x13'),_0xc01198,_0xacebbb);if(_0xacebbb==0x0){var _0x3e2887=_0x3f4515['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1184('0x14')](_0x5a1882[0x1])||_[_0x1184('0x15')](_0x5a1882[0x1])){logger[_0x1184('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0xc01198);_0x1c49fe['body'][_0x5a1882[0x1]]=_0x3e2887;}else{logger[_0x1184('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xc01198,_0x5a1882[0x1],_0x3e2887);_0x1c49fe['body'][_0x5a1882[0x1]]=_0x3e2887;}}_0x31cb32[_0x1184('0xf')]();});}}catch(_0x103d99){logger[_0x1184('0x8')](_0x1184('0x9'),_0xc01198,_['isObject'](_0x103d99)?JSON[_0x1184('0x16')](_0x103d99):_0x103d99);logger[_0x1184('0xd')](_0x1184('0xe'),_0xc01198);_0x31cb32[_0x1184('0xf')]();}};}; \ No newline at end of file +var _0xdb6f=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender'];(function(_0x11640f,_0x27ba94){var _0x5c2882=function(_0x12626c){while(--_0x12626c){_0x11640f['push'](_0x11640f['shift']());}};_0x5c2882(++_0x27ba94);}(_0xdb6f,0x93));var _0xfdb6=function(_0x22b983,_0x244e2e){_0x22b983=_0x22b983-0x0;var _0x2b28da=_0xdb6f[_0x22b983];return _0x2b28da;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xfdb6('0x0'));var utils=require(_0xfdb6('0x1'));var logger=require(_0xfdb6('0x2'))(_0xfdb6('0x3'));var system=schema({'command':{'type':_0xfdb6('0x4'),'required':!![],'message':_0xfdb6('0x5')}});exports[_0xfdb6('0x6')]=function(_0x332f79,_0x22fe28){return function(_0x47b207){try{var _0x5784af={'command':_0x22fe28[0x0]};var _0xe0b8c0=system[_0xfdb6('0x7')](_0x5784af,{'typecast':!![]});if(_0xe0b8c0[_0xfdb6('0x8')]){logger[_0xfdb6('0x9')]('[%s][SYSTEM]\x20%s',_0x332f79,_[_0xfdb6('0xa')](_0xe0b8c0,'message')[_0xfdb6('0xb')](',\x20'));logger[_0xfdb6('0xc')](_0xfdb6('0xd'),_0x332f79);_0x47b207['next']();}else{var _0x1c8200=this;var _0x4efa2c=utils[_0xfdb6('0xe')](_0x22fe28[0x0],this);logger[_0xfdb6('0xc')](_0xfdb6('0xf'),_0x332f79,_0x4efa2c);sh[_0xfdb6('0x10')](_[_0xfdb6('0x11')](_0x4efa2c),function(_0x2ee8d1,_0x37bb03){logger[_0xfdb6('0xc')](_0xfdb6('0x12'),_0x332f79,_0x2ee8d1);if(_0x2ee8d1==0x0){var _0x552776=_0x37bb03[_0xfdb6('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xfdb6('0x14')](_0x22fe28[0x1])||_[_0xfdb6('0x15')](_0x22fe28[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x332f79);_0x1c8200[_0xfdb6('0x16')][_0x22fe28[0x1]]=_0x552776;}else{logger[_0xfdb6('0xc')](_0xfdb6('0x17'),_0x332f79,_0x22fe28[0x1],_0x552776);_0x1c8200['body'][_0x22fe28[0x1]]=_0x552776;}}_0x47b207[_0xfdb6('0x18')]();});}}catch(_0x32c1a2){logger[_0xfdb6('0x9')](_0xfdb6('0x19'),_0x332f79,_[_0xfdb6('0x1a')](_0x32c1a2)?JSON['stringify'](_0x32c1a2):_0x32c1a2);logger[_0xfdb6('0xc')](_0xfdb6('0xd'),_0x332f79);_0x47b207['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 adb52c5..f4d954c 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 _0x49b9=['interaction','stringify','finally','next','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','info'];(function(_0x4a3bb9,_0x477803){var _0x32fe1f=function(_0x19b38f){while(--_0x19b38f){_0x4a3bb9['push'](_0x4a3bb9['shift']());}};_0x32fe1f(++_0x477803);}(_0x49b9,0x1e5));var _0x949b=function(_0x2c8b14,_0x522352){_0x2c8b14=_0x2c8b14-0x0;var _0x19886a=_0x49b9[_0x2c8b14];return _0x19886a;};'use strict';var schema=require('validate');var _=require(_0x949b('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x949b('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x949b('0x2')),'whatsappInteraction':require(_0x949b('0x3'))};var logger=require(_0x949b('0x4'))(_0x949b('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x949b('0x6')}});exports[_0x949b('0x7')]=function(_0x9360f9,_0x49eda7,_0x23701f,_0x5efa88){return function(_0xf214bf){try{var _0xcdc17b={'tag':_0x49eda7[0x0]};var _0x225a87=tag['validate'](_0xcdc17b,{'typecast':!![]});if(_0x225a87[_0x949b('0x8')]){logger[_0x949b('0x9')](_0x949b('0xa'),_0x9360f9,_['map'](_0x225a87,_0x949b('0xb'))[_0x949b('0xc')](',\x20'));logger['info'](_0x949b('0xd'),_0x9360f9);_0xf214bf['next']();}else{var _0x426b10={'ids':[_0x49eda7[0x0]]};if(rpc[_0x5efa88[_0x949b('0xe')]+'Interaction']){rpc[_0x5efa88['channel']+_0x949b('0xf')][_0x949b('0x10')](_0x5efa88['interaction']['id'],_0x426b10)[_0x949b('0x11')](function(_0xbc4a8f){logger[_0x949b('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x9360f9,_0x49eda7[0x1],_0x5efa88[_0x949b('0xe')],_0x5efa88[_0x949b('0x13')]['id']);})['catch'](function(_0x2134c0){logger['error'](_0x949b('0xa'),_0x9360f9,JSON[_0x949b('0x14')](_0x2134c0));logger[_0x949b('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9360f9);})[_0x949b('0x15')](function(){_0xf214bf[_0x949b('0x16')]();});}}}catch(_0x3b6958){logger[_0x949b('0x9')]('[%s][TAG]\x20%s',_0x9360f9,_[_0x949b('0x17')](_0x3b6958)?JSON['stringify'](_0x3b6958):_0x3b6958);logger['info'](_0x949b('0xd'),_0x9360f9);_0xf214bf['next']();}};}; \ No newline at end of file +var _0xe1b7=['consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','catch','stringify','finally','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0xe1b7,0x16e));var _0x7e1b=function(_0x1c8780,_0x5d68b7){_0x1c8780=_0x1c8780-0x0;var _0x36cd11=_0xe1b7[_0x1c8780];return _0x36cd11;};'use strict';var schema=require(_0x7e1b('0x0'));var _=require(_0x7e1b('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7e1b('0x2')),'smsInteraction':require(_0x7e1b('0x3')),'mailInteraction':require(_0x7e1b('0x4')),'faxInteraction':require(_0x7e1b('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x7e1b('0x6'))(_0x7e1b('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7e1b('0x8')}});exports[_0x7e1b('0x9')]=function(_0x1ebdc7,_0x110a2c,_0x47346c,_0x49a017){return function(_0x5bcfa7){try{var _0x511cd2={'tag':_0x110a2c[0x0]};var _0x1dc34d=tag['validate'](_0x511cd2,{'typecast':!![]});if(_0x1dc34d['length']){logger[_0x7e1b('0xa')](_0x7e1b('0xb'),_0x1ebdc7,_[_0x7e1b('0xc')](_0x1dc34d,_0x7e1b('0xd'))[_0x7e1b('0xe')](',\x20'));logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0x1ebdc7);_0x5bcfa7[_0x7e1b('0x11')]();}else{var _0x19b37c={'ids':[_0x110a2c[0x0]]};if(rpc[_0x49a017[_0x7e1b('0x12')]+_0x7e1b('0x13')]){rpc[_0x49a017[_0x7e1b('0x12')]+'Interaction'][_0x7e1b('0x14')](_0x49a017[_0x7e1b('0x15')]['id'],_0x19b37c)['then'](function(_0x82e97b){logger[_0x7e1b('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x1ebdc7,_0x110a2c[0x1],_0x49a017['channel'],_0x49a017['interaction']['id']);})[_0x7e1b('0x16')](function(_0x1ddc2d){logger[_0x7e1b('0xa')](_0x7e1b('0xb'),_0x1ebdc7,JSON[_0x7e1b('0x17')](_0x1ddc2d));logger['info'](_0x7e1b('0x10'),_0x1ebdc7);})[_0x7e1b('0x18')](function(){_0x5bcfa7[_0x7e1b('0x11')]();});}}}catch(_0x390079){logger[_0x7e1b('0xa')](_0x7e1b('0xb'),_0x1ebdc7,_['isObject'](_0x390079)?JSON[_0x7e1b('0x17')](_0x390079):_0x390079);logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0x1ebdc7);_0x5bcfa7[_0x7e1b('0x11')]();}};}; \ 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 73054e2..1bc8afd 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 _0xee44=['then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','?params=','urlOnRing','2.0','method','login','push','params','utf8','application/json-rpc'];(function(_0x455e4b,_0x1e3882){var _0x47f093=function(_0x3315e7){while(--_0x3315e7){_0x455e4b['push'](_0x455e4b['shift']());}};_0x47f093(++_0x1e3882);}(_0xee44,0x1da));var _0x4ee4=function(_0x1602c4,_0x86f38f){_0x1602c4=_0x1602c4-0x0;var _0x4a0bc6=_0xee44[_0x1602c4];return _0x4a0bc6;};'use strict';var rp=require('request-promise');var logger=require(_0x4ee4('0x0'))(_0x4ee4('0x1'));var _=require(_0x4ee4('0x2'));var arr=[];exports[_0x4ee4('0x3')]=function(_0x596fff,_0x2a904f){return function(_0x48925a){var _0x25fc7f=_0x2a904f[0xa];var _0x5de9ac=_0x2a904f[0xb];var _0x295461=_0x2a904f[0xc];var _0x5ac85b=_0x2a904f[0xd];var _0x56dfc6=_0x2a904f[0xe];var _0x5e5f2b=_0x2a904f[0xf][_0x4ee4('0x4')](/\n/g,_0x4ee4('0x5'));var _0x194178=_0x2a904f[0x10][_0x4ee4('0x4')](/\n/g,'\x20');if(!arr[_0x4ee4('0x6')](_0x5de9ac)){arr['push'](_0x5de9ac);var _0x3d2076=_0x2a904f[0x3];var _0x178f8c=_0x2a904f[0x4];var _0x4c0d65=_0x2a904f[0x1];var _0x18149d=_0x2a904f[0x0];var _0x49ede0={};_0x49ede0['urlOnAnswer']=_0x2a904f[0x8]+_0x4ee4('0x7')+_0x295461+'|'+_0x25fc7f+'|'+_0x5ac85b+'|'+_0x5de9ac+'|'+_0x56dfc6;_0x49ede0[_0x4ee4('0x8')]=_0x2a904f[0x7]+_0x4ee4('0x7')+_0x295461+'|'+_0x25fc7f+'|'+_0x5ac85b+'|'+_0x5de9ac+'|'+_0x56dfc6+'|'+_0x5e5f2b+'|'+_0x194178;_0x49ede0['title']=_0x2a904f[0x9];var _0x4a04e8={};_0x4a04e8['jsonrpc']=_0x4ee4('0x9');_0x4a04e8[_0x4ee4('0xa')]=_0x4ee4('0xb');var _0x54af07=[];_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x2]);_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x5]);_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x6]);_0x4a04e8[_0x4ee4('0xd')]=_0x54af07;_0x4a04e8['id']=0x1;var _0x46908b=JSON['stringify'](_0x4a04e8);var _0xaf418d={'encoding':_0x4ee4('0xe'),'method':'POST','timeout':0x2710,'url':_0x3d2076,'headers':{'Content-Type':_0x4ee4('0xf')},'body':_0x46908b};return rp(_0xaf418d)[_0x4ee4('0x10')](function(_0x3dde53){const _0x15c558=JSON[_0x4ee4('0x11')](_0x3dde53);if(!_0x15c558[_0x4ee4('0x12')][_0x4ee4('0x13')]){throw new Error(_0x4ee4('0x14'));}var _0x55f16a=_0x5de9ac;var _0x1e4e63=_0x4ee4('0x15')+_0x4c0d65+_0x4ee4('0x16')+_0x18149d+_0x4ee4('0x17')+_0x55f16a+_0x4ee4('0x18')+JSON[_0x4ee4('0x19')](_0x49ede0);var _0x4460b1=_0x178f8c+'?'+_0x1e4e63;return rp(_0x4460b1);})[_0x4ee4('0x10')](function(_0x66162c){logger[_0x4ee4('0x1a')](_0x4ee4('0x1b'),_0x596fff,_0x66162c);_0x48925a[_0x4ee4('0x1c')]();})[_0x4ee4('0x1d')](function(_0xa7308c){logger[_0x4ee4('0x1e')](_0x4ee4('0x1f'),_0x596fff,_[_0x4ee4('0x20')](_0xa7308c)?JSON[_0x4ee4('0x19')](_0xa7308c):_0xa7308c);_0x48925a[_0x4ee4('0x1c')]();});}else{logger['info'](_0x4ee4('0x21'),_0x596fff);_0x48925a[_0x4ee4('0x22')]();}};}; \ No newline at end of file +var _0xd960=['lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','params','stringify','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing'];(function(_0xe78ca0,_0x29ffef){var _0x587e2a=function(_0x45f7e4){while(--_0x45f7e4){_0xe78ca0['push'](_0xe78ca0['shift']());}};_0x587e2a(++_0x29ffef);}(_0xd960,0xf9));var _0x0d96=function(_0x4d4600,_0x4f4780){_0x4d4600=_0x4d4600-0x0;var _0x193d8d=_0xd960[_0x4d4600];return _0x193d8d;};'use strict';var rp=require(_0x0d96('0x0'));var logger=require(_0x0d96('0x1'))(_0x0d96('0x2'));var _=require(_0x0d96('0x3'));var arr=[];exports[_0x0d96('0x4')]=function(_0x2d1962,_0x45e98c){return function(_0x1ad507){var _0x287bb6=_0x45e98c[0xa];var _0x566173=_0x45e98c[0xb];var _0x3b5eb1=_0x45e98c[0xc];var _0x49a28e=_0x45e98c[0xd];var _0x480f08=_0x45e98c[0xe];var _0x187f2d=_0x45e98c[0xf][_0x0d96('0x5')](/\n/g,_0x0d96('0x6'));var _0x3bdfcf=_0x45e98c[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x0d96('0x7')](_0x566173)){arr[_0x0d96('0x8')](_0x566173);var _0x49ca39=_0x45e98c[0x3];var _0x42ffb8=_0x45e98c[0x4];var _0x529148=_0x45e98c[0x1];var _0x1e26a5=_0x45e98c[0x0];var _0x10b191={};_0x10b191['urlOnAnswer']=_0x45e98c[0x8]+_0x0d96('0x9')+_0x3b5eb1+'|'+_0x287bb6+'|'+_0x49a28e+'|'+_0x566173+'|'+_0x480f08;_0x10b191[_0x0d96('0xa')]=_0x45e98c[0x7]+_0x0d96('0x9')+_0x3b5eb1+'|'+_0x287bb6+'|'+_0x49a28e+'|'+_0x566173+'|'+_0x480f08+'|'+_0x187f2d+'|'+_0x3bdfcf;_0x10b191[_0x0d96('0xb')]=_0x45e98c[0x9];var _0x276200={};_0x276200[_0x0d96('0xc')]=_0x0d96('0xd');_0x276200['method']='login';var _0x461c9d=[];_0x461c9d[_0x0d96('0x8')](_0x45e98c[0x2]);_0x461c9d[_0x0d96('0x8')](_0x45e98c[0x5]);_0x461c9d[_0x0d96('0x8')](_0x45e98c[0x6]);_0x276200[_0x0d96('0xe')]=_0x461c9d;_0x276200['id']=0x1;var _0x3275c1=JSON[_0x0d96('0xf')](_0x276200);var _0x4ccc4c={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x49ca39,'headers':{'Content-Type':_0x0d96('0x10')},'body':_0x3275c1};return rp(_0x4ccc4c)['then'](function(_0x176747){const _0x5cc8b5=JSON[_0x0d96('0x11')](_0x176747);if(!_0x5cc8b5[_0x0d96('0x12')][_0x0d96('0x13')]){throw new Error(_0x0d96('0x14'));}var _0x302705=_0x566173;var _0x1fcd87='channelId='+_0x529148+'&serviceId='+_0x1e26a5+'&sessionId='+_0x302705+_0x0d96('0x15')+JSON['stringify'](_0x10b191);var _0x53c797=_0x42ffb8+'?'+_0x1fcd87;return rp(_0x53c797);})[_0x0d96('0x16')](function(_0x51efa3){logger[_0x0d96('0x17')](_0x0d96('0x18'),_0x2d1962,_0x51efa3);_0x1ad507[_0x0d96('0x19')]();})[_0x0d96('0x1a')](function(_0x54bc03){logger['error']('[%s][TVOX]\x20%s',_0x2d1962,_['isObject'](_0x54bc03)?JSON[_0x0d96('0xf')](_0x54bc03):_0x54bc03);_0x1ad507[_0x0d96('0x19')]();});}else{logger[_0x0d96('0x17')](_0x0d96('0x1b'),_0x2d1962);_0x1ad507['next']();}};}; \ 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 c1dc91c..ba7ea26 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(_0xe80138,_0x59c70b){var _0x23a111=function(_0x3b4052){while(--_0x3b4052){_0xe80138['push'](_0xe80138['shift']());}};_0x23a111(++_0x59c70b);}(_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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x53abee,_0x116a5f){var _0x48c3b9=function(_0xf88951){while(--_0xf88951){_0x53abee['push'](_0x53abee['shift']());}};_0x48c3b9(++_0x116a5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 02a5a26..dcec347 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 _0xe3db=['uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','split','mail','push','slice','dialogflowv2','appdata','amazonlex','TagId','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','channel','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0xe3db,0xc8));var _0xbe3d=function(_0xf0d8f9,_0x1e11d1){_0xf0d8f9=_0xf0d8f9-0x0;var _0x8ee7d4=_0xe3db[_0xf0d8f9];return _0x8ee7d4;};'use strict';var _=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xbe3d('0x2'));var BPromise=require(_0xbe3d('0x3'));var uuid=require(_0xbe3d('0x4'));var utils=require(_0xbe3d('0x5'));var config=require(_0xbe3d('0x6'));var logger=require(_0xbe3d('0x7'))(_0xbe3d('0x8'));var rpc={'openchannelQueueReport':require(_0xbe3d('0x9')),'mailQueueReport':require(_0xbe3d('0xa')),'chatQueueReport':require(_0xbe3d('0xb')),'smsQueueReport':require(_0xbe3d('0xc')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbe3d('0xd'))};var RuleEngine=require(_0xbe3d('0xe'));function getId(_0x24136a,_0x37e7c0,_0x55df34){return util[_0xbe3d('0xf')](_0xbe3d('0x10'),_0x24136a,_0x37e7c0||0x0,_0x55df34||0x0);}function getIntervals(_0x514464,_0x5eddd8){var _0x3b313c=[];if(!_[_0xbe3d('0x11')](_0x5eddd8[_0xbe3d('0x12')])&&!_[_0xbe3d('0x11')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]])&&!_[_0xbe3d('0x11')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]][_0xbe3d('0x13')])){_0x3b313c=_[_0xbe3d('0x14')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]][_0xbe3d('0x13')],_0xbe3d('0x15'));}else if(!_['isNil'](_0x5eddd8[_0xbe3d('0x15')])){_0x3b313c=[_0x5eddd8[_0xbe3d('0x15')]];}return _0x3b313c;}exports[_0xbe3d('0x16')]=function(_0x1a142b){_0x1a142b[_0xbe3d('0x17')]={};return new BPromise(function(_0x2852e7,_0x20b01f){var _0x98ce08={'Start':function(_0x2bb8c2){var _0x1e8ecc=this;return new Promise(function(_0x2a45ef,_0x196b9a){if(_0x2bb8c2){try{var _0x113b23=[];var _0x3f8630=getId(_0x2bb8c2['channel'],_0x2bb8c2[_0xbe3d('0x18')]?_0x2bb8c2[_0xbe3d('0x18')]['id']:0x0,_0x2bb8c2[_0xbe3d('0x19')]?_0x2bb8c2[_0xbe3d('0x19')]['id']:0x0);if(_0x2bb8c2[_0xbe3d('0x1a')]&&_[_0xbe3d('0x1b')](_0x2bb8c2[_0xbe3d('0x1a')])&&_0x2bb8c2[_0xbe3d('0x1a')][_0xbe3d('0x1c')]){for(var _0x5f0b4b=0x0;_0x5f0b4b<_0x2bb8c2[_0xbe3d('0x1a')][_0xbe3d('0x1c')];_0x5f0b4b+=0x1){var _0x466c2a=_0x2bb8c2[_0xbe3d('0x1a')][_0x5f0b4b];if(fs[_0xbe3d('0x1d')](path[_0xbe3d('0x1e')](__dirname,_0xbe3d('0x1a'),_0x466c2a[_0xbe3d('0x1f')]+_0xbe3d('0x20')))){var _0x37b211=[];switch(_0x466c2a[_0xbe3d('0x1f')]['toLowerCase']()){case _0xbe3d('0x21'):var _0x36909d=_0x466c2a['appdata'][_0xbe3d('0x22')](',');if(_0x2bb8c2['channel']===_0xbe3d('0x23')){_0x37b211[_0xbe3d('0x24')](_0x36909d[0x0]);_0x37b211['push'](_0x36909d[0x1]);_0x37b211[_0xbe3d('0x24')](_0x36909d[_0xbe3d('0x25')](0x2,_0x36909d[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));}else{_0x37b211[_0xbe3d('0x24')](_0x36909d[0x0]);_0x37b211[_0xbe3d('0x24')](_0x36909d[_0xbe3d('0x25')](0x1,_0x36909d[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));}break;case'dialogflow':var _0x14a7f1=_0x466c2a['appdata'][_0xbe3d('0x22')](',');_0x37b211['push'](_0x14a7f1[0x0]);_0x37b211[_0xbe3d('0x24')](_0x14a7f1[0x1]);_0x37b211['push'](_0x14a7f1[_0xbe3d('0x25')](0x2,_0x14a7f1[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));break;case _0xbe3d('0x26'):var _0x1f839f=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211['push'](_0x1f839f[0x0]);_0x37b211[_0xbe3d('0x24')](_0x1f839f[0x1]);_0x37b211[_0xbe3d('0x24')](_0x1f839f[0x2]);_0x37b211['push'](_0x1f839f[0x3]);_0x37b211['push'](_0x1f839f[_0xbe3d('0x25')](0x4,_0x1f839f[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));break;case _0xbe3d('0x28'):var _0x2e8e2e=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x0]);_0x37b211['push'](_0x2e8e2e[0x1]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x2]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x3]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[_0xbe3d('0x25')](0x4,_0x2e8e2e[_0xbe3d('0x1c')])['join'](','));break;case'message':_0x37b211[_0xbe3d('0x24')](_0x466c2a['appdata']);break;case'tag':_0x37b211['push'](_0x466c2a[_0xbe3d('0x29')]);_0x37b211[_0xbe3d('0x24')](_0x466c2a[_0xbe3d('0x27')]);break;case'tvox':var _0x3a23a1=utils[_0xbe3d('0x2a')](_0x2bb8c2[_0xbe3d('0x2b')]['notificationTemplate'],_0x2bb8c2);var _0x466020=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211[_0xbe3d('0x24')](_0x466020[0x0]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x1]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x2]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x3]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x4]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x5]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x6]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x7]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x8]);_0x37b211['push'](_0x466020[0x9]);_0x37b211[_0xbe3d('0x24')](_0x466020[0xa]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x19')]['id']);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x18')]['id']);_0x37b211[_0xbe3d('0x24')](_0x466c2a[_0xbe3d('0x2c')]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x19')][_0xbe3d('0x2d')]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x2e')][_0xbe3d('0x2e')]);_0x37b211['push'](_0x3a23a1);break;default:_0x37b211=_[_0xbe3d('0x11')](_0x466c2a[_0xbe3d('0x27')])?[]:_0x466c2a[_0xbe3d('0x27')]['split'](',');}var _0x913c9d={'id':util[_0xbe3d('0xf')](_0xbe3d('0x2f'),_0x3f8630,_0x466c2a['id'],_0x466c2a[_0xbe3d('0x1f')]),'condition':require(_0xbe3d('0x30'))[_0xbe3d('0x31')](_0x3f8630,getIntervals(_0x1a142b[_0xbe3d('0x32')],_0x466c2a),_0x1a142b),'consequence':require(_0xbe3d('0x33')+_0x466c2a[_0xbe3d('0x1f')])['consequence'](_0x3f8630,_0x37b211,_0x1a142b,_0x2bb8c2),'p':_0x466c2a[_0xbe3d('0x34')]||0x0};logger[_0xbe3d('0x35')](_0xbe3d('0x36'),_0x913c9d['id'],_0xbe3d('0x37'),getIntervals(_0x1a142b[_0xbe3d('0x32')],_0x466c2a)['join'](_0xbe3d('0x38')));_0x113b23['push'](_0x913c9d);}else{logger[_0xbe3d('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xbe3d('0x1a'),_0x466c2a[_0xbe3d('0x1f')]+_0xbe3d('0x20')));}}_0x1a142b[_0xbe3d('0x17')][_0x3f8630]=new RuleEngine(_0x113b23);_0x1a142b[_0xbe3d('0x17')][_0x3f8630][_0xbe3d('0x3a')](_0x2bb8c2,function(_0x15b187){logger['info'](_0xbe3d('0x3b'),JSON[_0xbe3d('0x3c')](_0x15b187[_0xbe3d('0x3d')]));if(_0x1a142b[_0xbe3d('0x17')][_0x3f8630]){_0x1a142b['rules'][_0x3f8630][_0xbe3d('0x3e')](_0xbe3d('0x3f'));}});return _0x2a45ef({'code':0xc8,'message':_0x2bb8c2});}else{logger[_0xbe3d('0x35')](_0xbe3d('0x40'));return _0x2a45ef({'code':0xc8,'message':_0x2bb8c2});}}catch(_0x3810c8){logger[_0xbe3d('0x39')](_0x3810c8[_0xbe3d('0x41')]);return _0x196b9a(_0x1e8ecc[_0xbe3d('0x39')](0x1f4,_0x3810c8));}}return _0x196b9a(_0xbe3d('0x42'));});},'AcceptMessage':function(_0x1d3c01){var _0x21f9ff=this;return new Promise(function(_0xc120a3,_0x4ad4ca){if(_0x1d3c01[_0xbe3d('0x43')]&&_0x1d3c01[_0xbe3d('0x43')]['id']){if(_0x1a142b[_0xbe3d('0x44')][_0x1d3c01['agent']['id']]){_0x1a142b[_0xbe3d('0x44')][_0x1d3c01[_0xbe3d('0x43')]['id']][_0xbe3d('0x45')]=![];_0x1a142b['agents'][_0x1d3c01[_0xbe3d('0x43')]['id']][_0xbe3d('0x46')]=undefined;}}if(_0x1d3c01[_0xbe3d('0x18')]&&_0x1d3c01['message']['id']){try{var _0x2dffaa=getId(_0x1d3c01['channel'],_0x1d3c01['message']?_0x1d3c01[_0xbe3d('0x18')]['id']:0x0,_0x1d3c01[_0xbe3d('0x19')]?_0x1d3c01[_0xbe3d('0x19')]['id']:0x0);if(_0x1a142b[_0xbe3d('0x17')][_0x2dffaa]){_0x1a142b[_0xbe3d('0x17')][_0x2dffaa]['emit'](_0xbe3d('0x47'));if(rpc[_0x1d3c01[_0xbe3d('0x48')]+'QueueReport']){rpc[_0x1d3c01[_0xbe3d('0x48')]+'QueueReport'][_0xbe3d('0x49')](_0x2dffaa,{'UserId':_0x1d3c01[_0xbe3d('0x18')]['UserId']})[_0xbe3d('0x4a')](function(_0x3aa7e2){logger[_0xbe3d('0x39')](_0xbe3d('0x4b'));});}}return _0xc120a3({'code':0xc8,'message':_0x1d3c01});}catch(_0x430803){logger[_0xbe3d('0x39')](_0x430803[_0xbe3d('0x41')]);return _0x4ad4ca(_0x21f9ff['error'](0x1f4,_0x430803));}}logger[_0xbe3d('0x39')](_0xbe3d('0x4c'));return _0x4ad4ca(_0x21f9ff[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'RejectMessage':function(_0x5e0787){var _0x1f7410=this;return new Promise(function(_0x36f4b3,_0x32ac09){if(_0x5e0787[_0xbe3d('0x43')]&&_0x5e0787['agent']['id']){try{if(_0x1a142b[_0xbe3d('0x44')][_0x5e0787[_0xbe3d('0x43')]['id']]){_0x1a142b['agents'][_0x5e0787[_0xbe3d('0x43')]['id']][_0xbe3d('0x45')]=![];_0x1a142b[_0xbe3d('0x44')][_0x5e0787[_0xbe3d('0x43')]['id']][_0xbe3d('0x46')]=undefined;}return _0x36f4b3({'code':0xc8,'message':_0x5e0787});}catch(_0x5e72ee){logger[_0xbe3d('0x39')](_0x5e72ee['stack']);return _0x32ac09(_0x1f7410['error'](0x1f4,_0x5e72ee));}}logger[_0xbe3d('0x39')](_0xbe3d('0x4c'));return _0x32ac09(_0x1f7410[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'AbandonInteraction':function(_0x566c61){var _0x4a9ad9=this;return new Promise(function(_0x3f4f7a,_0x5639a8){if(_0x566c61[_0xbe3d('0x48')]&&_0x566c61[_0xbe3d('0x19')]&&_0x566c61[_0xbe3d('0x19')]['id']){try{var _0x234548=getId(_0x566c61[_0xbe3d('0x48')],_0x566c61[_0xbe3d('0x18')]?_0x566c61['message']['id']:0x0,_0x566c61['interaction']?_0x566c61[_0xbe3d('0x19')]['id']:0x0);if(_0x1a142b[_0xbe3d('0x17')][_0x234548]){_0x1a142b[_0xbe3d('0x17')][_0x234548][_0xbe3d('0x3e')]('end');}return _0x3f4f7a({'code':0xc8,'message':_0x566c61});}catch(_0x3a8f18){logger[_0xbe3d('0x39')](_0x3a8f18['stack']);return _0x5639a8(_0x4a9ad9[_0xbe3d('0x39')](0x1f4,_0x3a8f18));}}logger[_0xbe3d('0x39')]('message\x20is\x20empty');return _0x5639a8(_0x4a9ad9[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'AgentCapacity':function(_0x5dde9e){var _0xffa8bd=this;return new Promise(function(_0x5c58da,_0x1b2162){if(_0x1a142b['agents'][_0xbe3d('0x4d')](_0x5dde9e['id'])){for(var _0x334175 in _0x5dde9e[_0xbe3d('0x4e')]){if(_0x5dde9e['capacity']['hasOwnProperty'](_0x334175)){if(_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']][_0xbe3d('0x4d')](_0x334175+_0xbe3d('0x4f'))){_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']][_0x334175+'CurrentCapacity']=parseInt(_0x5dde9e[_0xbe3d('0x4e')][_0x334175],0xa);}}}_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']]['updateRealtime']();return _0x5c58da({'code':0xc8,'message':_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']]});}else{return _0x1b2162(_0xffa8bd[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x50')));}});},'Agents':function(_0x5110d4){return new Promise(function(_0x151138,_0x4dce3d){var _0x1dae76=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x44')]);_0x151138({'count':_0x1dae76[_0xbe3d('0x1c')],'rows':_0x1dae76});});},'ChatQueues':function(_0xd5974f){return new Promise(function(_0x42ed62,_0x484e5d){var _0x2e3d95=[];for(var _0x4d045f in _0x1a142b[_0xbe3d('0x52')]){if(_0x1a142b[_0xbe3d('0x52')]['hasOwnProperty'](_0x4d045f)){var _0x59ed09=_0x1a142b['chatQueues'][_0x4d045f];var _0x269bd6={'id':_0x59ed09['id'],'available':_0x59ed09['available'],'loggedIn':_0x59ed09[_0xbe3d('0x53')],'name':_0x59ed09[_0xbe3d('0x54')],'paused':_0x59ed09[_0xbe3d('0x55')],'waiting':_0x59ed09[_0xbe3d('0x56')]};_0x2e3d95[_0xbe3d('0x24')](_0x269bd6);}}_0x42ed62({'count':_0x2e3d95[_0xbe3d('0x1c')],'rows':_0x2e3d95});});},'MailQueues':function(_0x213702){return new Promise(function(_0x36fec3,_0x430430){var _0x5235cf=[];for(var _0x2e02fc in _0x1a142b['mailQueues']){if(_0x1a142b[_0xbe3d('0x57')][_0xbe3d('0x4d')](_0x2e02fc)){var _0x1f6cca=_0x1a142b[_0xbe3d('0x57')][_0x2e02fc];var _0x315820={'id':_0x1f6cca['id'],'available':_0x1f6cca[_0xbe3d('0x58')],'loggedIn':_0x1f6cca[_0xbe3d('0x53')],'name':_0x1f6cca[_0xbe3d('0x54')],'paused':_0x1f6cca[_0xbe3d('0x55')],'waiting':_0x1f6cca['waiting']};_0x5235cf[_0xbe3d('0x24')](_0x315820);}}_0x36fec3({'count':_0x5235cf[_0xbe3d('0x1c')],'rows':_0x5235cf});});},'OpenchannelQueues':function(_0x13de5a){return new Promise(function(_0x2a533c,_0x38951a){var _0x252c90=[];for(var _0x4dbe69 in _0x1a142b[_0xbe3d('0x59')]){if(_0x1a142b[_0xbe3d('0x59')][_0xbe3d('0x4d')](_0x4dbe69)){var _0x32111e=_0x1a142b['openchannelQueues'][_0x4dbe69];var _0x52926f={'id':_0x32111e['id'],'available':_0x32111e[_0xbe3d('0x58')],'loggedIn':_0x32111e[_0xbe3d('0x53')],'name':_0x32111e['name'],'paused':_0x32111e[_0xbe3d('0x55')],'waiting':_0x32111e[_0xbe3d('0x56')]};_0x252c90[_0xbe3d('0x24')](_0x52926f);}}_0x2a533c({'count':_0x252c90[_0xbe3d('0x1c')],'rows':_0x252c90});});},'SmsQueues':function(_0x736cd6){return new Promise(function(_0x3109a8,_0x1acc28){var _0xf227e=[];for(var _0x53da5a in _0x1a142b[_0xbe3d('0x5a')]){if(_0x1a142b[_0xbe3d('0x5a')]['hasOwnProperty'](_0x53da5a)){var _0x49ae2a=_0x1a142b[_0xbe3d('0x5a')][_0x53da5a];var _0x28645f={'id':_0x49ae2a['id'],'available':_0x49ae2a[_0xbe3d('0x58')],'loggedIn':_0x49ae2a[_0xbe3d('0x53')],'name':_0x49ae2a[_0xbe3d('0x54')],'paused':_0x49ae2a[_0xbe3d('0x55')],'waiting':_0x49ae2a[_0xbe3d('0x56')]};_0xf227e[_0xbe3d('0x24')](_0x28645f);}}_0x3109a8({'count':_0xf227e[_0xbe3d('0x1c')],'rows':_0xf227e});});},'FaxQueues':function(_0x27a919){return new Promise(function(_0x57dd4c,_0x29d5d4){var _0x3195d0=[];for(var _0x322ca0 in _0x1a142b['faxQueues']){if(_0x1a142b[_0xbe3d('0x5b')]['hasOwnProperty'](_0x322ca0)){var _0x5d2eba=_0x1a142b['faxQueues'][_0x322ca0];var _0x3c395={'id':_0x5d2eba['id'],'available':_0x5d2eba[_0xbe3d('0x58')],'loggedIn':_0x5d2eba[_0xbe3d('0x53')],'name':_0x5d2eba[_0xbe3d('0x54')],'paused':_0x5d2eba[_0xbe3d('0x55')],'waiting':_0x5d2eba[_0xbe3d('0x56')]};_0x3195d0[_0xbe3d('0x24')](_0x3c395);}}_0x57dd4c({'count':_0x3195d0[_0xbe3d('0x1c')],'rows':_0x3195d0});});},'WhatsappQueues':function(_0x5d85c3){return new Promise(function(_0x541fd2,_0x435b74){var _0x46d997=[];for(var _0x5198ae in _0x1a142b[_0xbe3d('0x5c')]){if(_0x1a142b['whatsappQueues'][_0xbe3d('0x4d')](_0x5198ae)){var _0x3418db=_0x1a142b[_0xbe3d('0x5c')][_0x5198ae];var _0x3051c0={'id':_0x3418db['id'],'available':_0x3418db[_0xbe3d('0x58')],'loggedIn':_0x3418db[_0xbe3d('0x53')],'name':_0x3418db[_0xbe3d('0x54')],'paused':_0x3418db[_0xbe3d('0x55')],'waiting':_0x3418db['waiting']};_0x46d997[_0xbe3d('0x24')](_0x3051c0);}}_0x541fd2({'count':_0x46d997[_0xbe3d('0x1c')],'rows':_0x46d997});});},'ChatQueuesWaitingInteractions':function(_0x3d1e61){return new Promise(function(_0x3f5d83,_0x7f1a50){var _0x6b1123=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5d')]);_0x3f5d83({'count':_0x6b1123['length'],'rows':_0x6b1123});});},'MailQueuesWaitingInteractions':function(_0x380b00){return new Promise(function(_0x2ff7e9,_0x2a26a5){var _0x1c65ae=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5e')]);_0x2ff7e9({'count':_0x1c65ae['length'],'rows':_0x1c65ae});});},'OpenchannelQueuesWaitingInteractions':function(_0x41c707){return new Promise(function(_0x8aec3f,_0x320323){var _0x14fd9b=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5f')]);_0x8aec3f({'count':_0x14fd9b['length'],'rows':_0x14fd9b});});},'SmsQueuesWaitingInteractions':function(_0x561af1){return new Promise(function(_0x4f36ee,_0x20ed8a){var _0x11576c=_[_0xbe3d('0x51')](_0x1a142b['smsQueuesWaitingInteractions']);_0x4f36ee({'count':_0x11576c[_0xbe3d('0x1c')],'rows':_0x11576c});});},'FaxQueuesWaitingInteractions':function(_0x67adf){return new Promise(function(_0x1f079d,_0x594737){var _0xe1cd=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x60')]);_0x1f079d({'count':_0xe1cd['length'],'rows':_0xe1cd});});},'WhatsappQueuesWaitingInteractions':function(_0x512b00){return new Promise(function(_0x31d44c,_0x258d4a){var _0xcf0a5d=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x61')]);_0x31d44c({'count':_0xcf0a5d[_0xbe3d('0x1c')],'rows':_0xcf0a5d});});}};var _0x4fc1f4=jayson['server'](_0x98ce08)[_0xbe3d('0x62')]();_0x4fc1f4['on'](_0xbe3d('0x39'),function(_0x318b15){logger[_0xbe3d('0x39')](JSON[_0xbe3d('0x3c')](_0x318b15));return _0x20b01f(_0x318b15);});_0x4fc1f4[_0xbe3d('0x16')](0x232c,_0xbe3d('0x63'),function(){console[_0xbe3d('0x64')](_0xbe3d('0x65'),0x232c);return _0x2852e7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xb921=['condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','stringify','emit','complete','agent','agents','busy','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','waiting','mailQueues','available','loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','message','interaction','applications','length','existsSync','app','toLowerCase','autoreply','appdata','split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xb921,0x16a));var _0x1b92=function(_0x12f4d8,_0x1f6d82){_0x12f4d8=_0x12f4d8-0x0;var _0x265413=_0xb921[_0x12f4d8];return _0x265413;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var path=require(_0x1b92('0x2'));var fs=require('fs');var jayson=require(_0x1b92('0x3'));var BPromise=require(_0x1b92('0x4'));var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x1b92('0x5'));var logger=require(_0x1b92('0x6'))(_0x1b92('0x7'));var rpc={'openchannelQueueReport':require(_0x1b92('0x8')),'mailQueueReport':require(_0x1b92('0x9')),'chatQueueReport':require(_0x1b92('0xa')),'smsQueueReport':require(_0x1b92('0xb')),'faxQueueReport':require(_0x1b92('0xc')),'whatsappQueueReport':require(_0x1b92('0xd'))};var RuleEngine=require(_0x1b92('0xe'));function getId(_0x1545f9,_0x64a3ed,_0x2cf050){return util[_0x1b92('0xf')](_0x1b92('0x10'),_0x1545f9,_0x64a3ed||0x0,_0x2cf050||0x0);}function getIntervals(_0x4c8e30,_0x31e314){var _0x1e5802=[];if(!_[_0x1b92('0x11')](_0x31e314[_0x1b92('0x12')])&&!_[_0x1b92('0x11')](_0x4c8e30[_0x31e314[_0x1b92('0x12')]])&&!_[_0x1b92('0x11')](_0x4c8e30[_0x31e314['IntervalId']][_0x1b92('0x13')])){_0x1e5802=_[_0x1b92('0x14')](_0x4c8e30[_0x31e314['IntervalId']][_0x1b92('0x13')],_0x1b92('0x15'));}else if(!_[_0x1b92('0x11')](_0x31e314[_0x1b92('0x15')])){_0x1e5802=[_0x31e314[_0x1b92('0x15')]];}return _0x1e5802;}exports[_0x1b92('0x16')]=function(_0x1d33bf){_0x1d33bf['rules']={};return new BPromise(function(_0x428396,_0x5c5c89){var _0x1a559b={'Start':function(_0x511a97){var _0x694d4f=this;return new Promise(function(_0x523285,_0x1eee75){if(_0x511a97){try{var _0x19b218=[];var _0x688aef=getId(_0x511a97['channel'],_0x511a97[_0x1b92('0x17')]?_0x511a97[_0x1b92('0x17')]['id']:0x0,_0x511a97[_0x1b92('0x18')]?_0x511a97[_0x1b92('0x18')]['id']:0x0);if(_0x511a97[_0x1b92('0x19')]&&_['isArray'](_0x511a97[_0x1b92('0x19')])&&_0x511a97[_0x1b92('0x19')][_0x1b92('0x1a')]){for(var _0x581d8a=0x0;_0x581d8a<_0x511a97[_0x1b92('0x19')][_0x1b92('0x1a')];_0x581d8a+=0x1){var _0x2cdc01=_0x511a97['applications'][_0x581d8a];if(fs[_0x1b92('0x1b')](path['join'](__dirname,_0x1b92('0x19'),_0x2cdc01[_0x1b92('0x1c')]+'.js'))){var _0x4ea25f=[];switch(_0x2cdc01[_0x1b92('0x1c')][_0x1b92('0x1d')]()){case _0x1b92('0x1e'):var _0x2badce=_0x2cdc01[_0x1b92('0x1f')][_0x1b92('0x20')](',');if(_0x511a97['channel']===_0x1b92('0x21')){_0x4ea25f[_0x1b92('0x22')](_0x2badce[0x0]);_0x4ea25f[_0x1b92('0x22')](_0x2badce[0x1]);_0x4ea25f[_0x1b92('0x22')](_0x2badce['slice'](0x2,_0x2badce[_0x1b92('0x1a')])['join'](','));}else{_0x4ea25f[_0x1b92('0x22')](_0x2badce[0x0]);_0x4ea25f[_0x1b92('0x22')](_0x2badce[_0x1b92('0x23')](0x1,_0x2badce[_0x1b92('0x1a')])[_0x1b92('0x24')](','));}break;case _0x1b92('0x25'):var _0xa56a28=_0x2cdc01[_0x1b92('0x1f')]['split'](',');_0x4ea25f['push'](_0xa56a28[0x0]);_0x4ea25f['push'](_0xa56a28[0x1]);_0x4ea25f[_0x1b92('0x22')](_0xa56a28['slice'](0x2,_0xa56a28[_0x1b92('0x1a')])['join'](','));break;case _0x1b92('0x26'):var _0x4656aa=_0x2cdc01[_0x1b92('0x1f')]['split'](',');_0x4ea25f[_0x1b92('0x22')](_0x4656aa[0x0]);_0x4ea25f[_0x1b92('0x22')](_0x4656aa[0x1]);_0x4ea25f['push'](_0x4656aa[0x2]);_0x4ea25f['push'](_0x4656aa[0x3]);_0x4ea25f[_0x1b92('0x22')](_0x4656aa[_0x1b92('0x23')](0x4,_0x4656aa[_0x1b92('0x1a')])[_0x1b92('0x24')](','));break;case _0x1b92('0x27'):var _0x50eddf=_0x2cdc01[_0x1b92('0x1f')][_0x1b92('0x20')](',');_0x4ea25f[_0x1b92('0x22')](_0x50eddf[0x0]);_0x4ea25f[_0x1b92('0x22')](_0x50eddf[0x1]);_0x4ea25f[_0x1b92('0x22')](_0x50eddf[0x2]);_0x4ea25f[_0x1b92('0x22')](_0x50eddf[0x3]);_0x4ea25f[_0x1b92('0x22')](_0x50eddf['slice'](0x4,_0x50eddf[_0x1b92('0x1a')])[_0x1b92('0x24')](','));break;case'message':_0x4ea25f[_0x1b92('0x22')](_0x2cdc01[_0x1b92('0x1f')]);break;case _0x1b92('0x28'):_0x4ea25f['push'](_0x2cdc01[_0x1b92('0x29')]);_0x4ea25f[_0x1b92('0x22')](_0x2cdc01['appdata']);break;case'tvox':var _0x280bc3=utils[_0x1b92('0x2a')](_0x511a97[_0x1b92('0x2b')][_0x1b92('0x2c')],_0x511a97);var _0x5d1ed8=_0x2cdc01['appdata']['split'](',');_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x0]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x1]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x2]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x3]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x4]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x5]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x6]);_0x4ea25f['push'](_0x5d1ed8[0x7]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x8]);_0x4ea25f[_0x1b92('0x22')](_0x5d1ed8[0x9]);_0x4ea25f['push'](_0x5d1ed8[0xa]);_0x4ea25f[_0x1b92('0x22')](_0x511a97[_0x1b92('0x18')]['id']);_0x4ea25f[_0x1b92('0x22')](_0x511a97[_0x1b92('0x17')]['id']);_0x4ea25f[_0x1b92('0x22')](_0x2cdc01[_0x1b92('0x2d')]);_0x4ea25f[_0x1b92('0x22')](_0x511a97[_0x1b92('0x18')][_0x1b92('0x2e')]);_0x4ea25f[_0x1b92('0x22')](_0x511a97['body'][_0x1b92('0x2f')]);_0x4ea25f['push'](_0x280bc3);break;default:_0x4ea25f=_[_0x1b92('0x11')](_0x2cdc01['appdata'])?[]:_0x2cdc01[_0x1b92('0x1f')][_0x1b92('0x20')](',');}var _0x25e709={'id':util[_0x1b92('0xf')](_0x1b92('0x30'),_0x688aef,_0x2cdc01['id'],_0x2cdc01[_0x1b92('0x1c')]),'condition':require(_0x1b92('0x31'))[_0x1b92('0x32')](_0x688aef,getIntervals(_0x1d33bf[_0x1b92('0x33')],_0x2cdc01),_0x1d33bf),'consequence':require('./applications/'+_0x2cdc01[_0x1b92('0x1c')])['consequence'](_0x688aef,_0x4ea25f,_0x1d33bf,_0x511a97),'p':_0x2cdc01[_0x1b92('0x34')]||0x0};logger[_0x1b92('0x35')](_0x1b92('0x36'),_0x25e709['id'],_0x1b92('0x37'),getIntervals(_0x1d33bf['intervals'],_0x2cdc01)[_0x1b92('0x24')](_0x1b92('0x38')));_0x19b218[_0x1b92('0x22')](_0x25e709);}else{logger[_0x1b92('0x39')](_0x1b92('0x3a'),path[_0x1b92('0x24')](__dirname,'applications',_0x2cdc01[_0x1b92('0x1c')]+_0x1b92('0x3b')));}}_0x1d33bf[_0x1b92('0x3c')][_0x688aef]=new RuleEngine(_0x19b218);_0x1d33bf[_0x1b92('0x3c')][_0x688aef][_0x1b92('0x3d')](_0x511a97,function(_0x2bb12f){logger['info'](_0x1b92('0x3e'),JSON[_0x1b92('0x3f')](_0x2bb12f['matchPath']));if(_0x1d33bf[_0x1b92('0x3c')][_0x688aef]){_0x1d33bf['rules'][_0x688aef][_0x1b92('0x40')](_0x1b92('0x41'));}});return _0x523285({'code':0xc8,'message':_0x511a97});}else{logger[_0x1b92('0x35')]('No\x20applications\x20to\x20execute');return _0x523285({'code':0xc8,'message':_0x511a97});}}catch(_0x31b436){logger[_0x1b92('0x39')](_0x31b436['stack']);return _0x1eee75(_0x694d4f['error'](0x1f4,_0x31b436));}}return _0x1eee75('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2e325c){var _0x401c67=this;return new Promise(function(_0x1b5255,_0x1d04ed){if(_0x2e325c[_0x1b92('0x42')]&&_0x2e325c[_0x1b92('0x42')]['id']){if(_0x1d33bf['agents'][_0x2e325c[_0x1b92('0x42')]['id']]){_0x1d33bf[_0x1b92('0x43')][_0x2e325c['agent']['id']][_0x1b92('0x44')]=![];_0x1d33bf[_0x1b92('0x43')][_0x2e325c[_0x1b92('0x42')]['id']]['busyQueue']=undefined;}}if(_0x2e325c[_0x1b92('0x17')]&&_0x2e325c[_0x1b92('0x17')]['id']){try{var _0x38df65=getId(_0x2e325c[_0x1b92('0x45')],_0x2e325c[_0x1b92('0x17')]?_0x2e325c['message']['id']:0x0,_0x2e325c[_0x1b92('0x18')]?_0x2e325c[_0x1b92('0x18')]['id']:0x0);if(_0x1d33bf[_0x1b92('0x3c')][_0x38df65]){_0x1d33bf[_0x1b92('0x3c')][_0x38df65][_0x1b92('0x40')]('end');if(rpc[_0x2e325c['channel']+_0x1b92('0x46')]){rpc[_0x2e325c[_0x1b92('0x45')]+_0x1b92('0x46')][_0x1b92('0x47')](_0x38df65,{'UserId':_0x2e325c['message'][_0x1b92('0x48')]})[_0x1b92('0x49')](function(_0x5e10fa){logger[_0x1b92('0x39')](_0x1b92('0x4a'));});}}return _0x1b5255({'code':0xc8,'message':_0x2e325c});}catch(_0x10fd17){logger['error'](_0x10fd17[_0x1b92('0x4b')]);return _0x1d04ed(_0x401c67[_0x1b92('0x39')](0x1f4,_0x10fd17));}}logger[_0x1b92('0x39')](_0x1b92('0x4c'));return _0x1d04ed(_0x401c67[_0x1b92('0x39')](0x1f4,_0x1b92('0x4c')));});},'RejectMessage':function(_0x5de86e){var _0x235234=this;return new Promise(function(_0x4baa1a,_0x140202){if(_0x5de86e['agent']&&_0x5de86e[_0x1b92('0x42')]['id']){try{if(_0x1d33bf[_0x1b92('0x43')][_0x5de86e[_0x1b92('0x42')]['id']]){_0x1d33bf[_0x1b92('0x43')][_0x5de86e[_0x1b92('0x42')]['id']][_0x1b92('0x44')]=![];_0x1d33bf[_0x1b92('0x43')][_0x5de86e[_0x1b92('0x42')]['id']][_0x1b92('0x4d')]=undefined;}return _0x4baa1a({'code':0xc8,'message':_0x5de86e});}catch(_0x23e03a){logger[_0x1b92('0x39')](_0x23e03a[_0x1b92('0x4b')]);return _0x140202(_0x235234[_0x1b92('0x39')](0x1f4,_0x23e03a));}}logger[_0x1b92('0x39')](_0x1b92('0x4c'));return _0x140202(_0x235234[_0x1b92('0x39')](0x1f4,_0x1b92('0x4c')));});},'AbandonInteraction':function(_0x29005a){var _0x965e5c=this;return new Promise(function(_0x1e2e77,_0x5d4a1a){if(_0x29005a[_0x1b92('0x45')]&&_0x29005a[_0x1b92('0x18')]&&_0x29005a['interaction']['id']){try{var _0x41a80f=getId(_0x29005a[_0x1b92('0x45')],_0x29005a['message']?_0x29005a['message']['id']:0x0,_0x29005a[_0x1b92('0x18')]?_0x29005a[_0x1b92('0x18')]['id']:0x0);if(_0x1d33bf['rules'][_0x41a80f]){_0x1d33bf[_0x1b92('0x3c')][_0x41a80f][_0x1b92('0x40')](_0x1b92('0x4e'));}return _0x1e2e77({'code':0xc8,'message':_0x29005a});}catch(_0x33069d){logger[_0x1b92('0x39')](_0x33069d[_0x1b92('0x4b')]);return _0x5d4a1a(_0x965e5c['error'](0x1f4,_0x33069d));}}logger[_0x1b92('0x39')]('message\x20is\x20empty');return _0x5d4a1a(_0x965e5c['error'](0x1f4,_0x1b92('0x4c')));});},'AgentCapacity':function(_0x15a756){var _0x98fb95=this;return new Promise(function(_0x432762,_0x10b2b0){if(_0x1d33bf[_0x1b92('0x43')][_0x1b92('0x4f')](_0x15a756['id'])){for(var _0x27f388 in _0x15a756[_0x1b92('0x50')]){if(_0x15a756[_0x1b92('0x50')]['hasOwnProperty'](_0x27f388)){if(_0x1d33bf[_0x1b92('0x43')][_0x15a756['id']][_0x1b92('0x4f')](_0x27f388+_0x1b92('0x51'))){_0x1d33bf['agents'][_0x15a756['id']][_0x27f388+'CurrentCapacity']=parseInt(_0x15a756[_0x1b92('0x50')][_0x27f388],0xa);}}}_0x1d33bf[_0x1b92('0x43')][_0x15a756['id']][_0x1b92('0x52')]();return _0x432762({'code':0xc8,'message':_0x1d33bf[_0x1b92('0x43')][_0x15a756['id']]});}else{return _0x10b2b0(_0x98fb95[_0x1b92('0x39')](0x1f4,_0x1b92('0x53')));}});},'Agents':function(_0x3c4ed4){return new Promise(function(_0x6f27ed,_0x63c79a){var _0x406dd4=_[_0x1b92('0x54')](_0x1d33bf[_0x1b92('0x43')]);_0x6f27ed({'count':_0x406dd4['length'],'rows':_0x406dd4});});},'ChatQueues':function(_0x273b75){return new Promise(function(_0xfecd33,_0x554086){var _0x23eb77=[];for(var _0x46d1e9 in _0x1d33bf['chatQueues']){if(_0x1d33bf[_0x1b92('0x55')][_0x1b92('0x4f')](_0x46d1e9)){var _0x1d3d74=_0x1d33bf[_0x1b92('0x55')][_0x46d1e9];var _0x2540d2={'id':_0x1d3d74['id'],'available':_0x1d3d74['available'],'loggedIn':_0x1d3d74['loggedIn'],'name':_0x1d3d74['name'],'paused':_0x1d3d74['paused'],'waiting':_0x1d3d74[_0x1b92('0x56')]};_0x23eb77[_0x1b92('0x22')](_0x2540d2);}}_0xfecd33({'count':_0x23eb77[_0x1b92('0x1a')],'rows':_0x23eb77});});},'MailQueues':function(_0x2e4330){return new Promise(function(_0x5e1c1d,_0x290959){var _0xb330f=[];for(var _0x513830 in _0x1d33bf[_0x1b92('0x57')]){if(_0x1d33bf['mailQueues']['hasOwnProperty'](_0x513830)){var _0x1684e3=_0x1d33bf['mailQueues'][_0x513830];var _0x1b106d={'id':_0x1684e3['id'],'available':_0x1684e3[_0x1b92('0x58')],'loggedIn':_0x1684e3[_0x1b92('0x59')],'name':_0x1684e3[_0x1b92('0x5a')],'paused':_0x1684e3[_0x1b92('0x5b')],'waiting':_0x1684e3[_0x1b92('0x56')]};_0xb330f['push'](_0x1b106d);}}_0x5e1c1d({'count':_0xb330f[_0x1b92('0x1a')],'rows':_0xb330f});});},'OpenchannelQueues':function(_0x1bab85){return new Promise(function(_0xc0a853,_0x1df855){var _0x1fefaf=[];for(var _0x55b5b2 in _0x1d33bf['openchannelQueues']){if(_0x1d33bf[_0x1b92('0x5c')][_0x1b92('0x4f')](_0x55b5b2)){var _0x39ad41=_0x1d33bf[_0x1b92('0x5c')][_0x55b5b2];var _0x5f3a04={'id':_0x39ad41['id'],'available':_0x39ad41[_0x1b92('0x58')],'loggedIn':_0x39ad41[_0x1b92('0x59')],'name':_0x39ad41[_0x1b92('0x5a')],'paused':_0x39ad41[_0x1b92('0x5b')],'waiting':_0x39ad41['waiting']};_0x1fefaf[_0x1b92('0x22')](_0x5f3a04);}}_0xc0a853({'count':_0x1fefaf[_0x1b92('0x1a')],'rows':_0x1fefaf});});},'SmsQueues':function(_0x15ba0b){return new Promise(function(_0x40f610,_0xfb4a7f){var _0x28de7f=[];for(var _0x15b6b1 in _0x1d33bf['smsQueues']){if(_0x1d33bf[_0x1b92('0x5d')]['hasOwnProperty'](_0x15b6b1)){var _0x59eedf=_0x1d33bf[_0x1b92('0x5d')][_0x15b6b1];var _0x1d5ad6={'id':_0x59eedf['id'],'available':_0x59eedf[_0x1b92('0x58')],'loggedIn':_0x59eedf[_0x1b92('0x59')],'name':_0x59eedf['name'],'paused':_0x59eedf['paused'],'waiting':_0x59eedf[_0x1b92('0x56')]};_0x28de7f[_0x1b92('0x22')](_0x1d5ad6);}}_0x40f610({'count':_0x28de7f['length'],'rows':_0x28de7f});});},'FaxQueues':function(_0x31faab){return new Promise(function(_0x501c8e,_0x67b087){var _0x226fa2=[];for(var _0x36f758 in _0x1d33bf[_0x1b92('0x5e')]){if(_0x1d33bf['faxQueues'][_0x1b92('0x4f')](_0x36f758)){var _0x447b4f=_0x1d33bf[_0x1b92('0x5e')][_0x36f758];var _0x16280d={'id':_0x447b4f['id'],'available':_0x447b4f[_0x1b92('0x58')],'loggedIn':_0x447b4f['loggedIn'],'name':_0x447b4f[_0x1b92('0x5a')],'paused':_0x447b4f[_0x1b92('0x5b')],'waiting':_0x447b4f[_0x1b92('0x56')]};_0x226fa2[_0x1b92('0x22')](_0x16280d);}}_0x501c8e({'count':_0x226fa2['length'],'rows':_0x226fa2});});},'WhatsappQueues':function(_0x2b5e2d){return new Promise(function(_0x2934fd,_0x530b4d){var _0x32a237=[];for(var _0x2b19dc in _0x1d33bf[_0x1b92('0x5f')]){if(_0x1d33bf[_0x1b92('0x5f')][_0x1b92('0x4f')](_0x2b19dc)){var _0x300065=_0x1d33bf['whatsappQueues'][_0x2b19dc];var _0x9bf9af={'id':_0x300065['id'],'available':_0x300065[_0x1b92('0x58')],'loggedIn':_0x300065[_0x1b92('0x59')],'name':_0x300065[_0x1b92('0x5a')],'paused':_0x300065[_0x1b92('0x5b')],'waiting':_0x300065[_0x1b92('0x56')]};_0x32a237[_0x1b92('0x22')](_0x9bf9af);}}_0x2934fd({'count':_0x32a237['length'],'rows':_0x32a237});});},'ChatQueuesWaitingInteractions':function(_0x445241){return new Promise(function(_0x19a439,_0x31853d){var _0x58bd8e=_[_0x1b92('0x54')](_0x1d33bf[_0x1b92('0x60')]);_0x19a439({'count':_0x58bd8e[_0x1b92('0x1a')],'rows':_0x58bd8e});});},'MailQueuesWaitingInteractions':function(_0x142263){return new Promise(function(_0x151b68,_0x223ff1){var _0x685d82=_[_0x1b92('0x54')](_0x1d33bf['mailQueuesWaitingInteractions']);_0x151b68({'count':_0x685d82[_0x1b92('0x1a')],'rows':_0x685d82});});},'OpenchannelQueuesWaitingInteractions':function(_0x558978){return new Promise(function(_0x22b84e,_0xb0d3a){var _0x418560=_[_0x1b92('0x54')](_0x1d33bf[_0x1b92('0x61')]);_0x22b84e({'count':_0x418560['length'],'rows':_0x418560});});},'SmsQueuesWaitingInteractions':function(_0x1b74f3){return new Promise(function(_0x39b518,_0x106c5e){var _0x3974a8=_[_0x1b92('0x54')](_0x1d33bf[_0x1b92('0x62')]);_0x39b518({'count':_0x3974a8[_0x1b92('0x1a')],'rows':_0x3974a8});});},'FaxQueuesWaitingInteractions':function(_0x1b42c4){return new Promise(function(_0x29e462,_0x2330f8){var _0x554502=_[_0x1b92('0x54')](_0x1d33bf[_0x1b92('0x63')]);_0x29e462({'count':_0x554502[_0x1b92('0x1a')],'rows':_0x554502});});},'WhatsappQueuesWaitingInteractions':function(_0x4d4218){return new Promise(function(_0x3eabe1,_0x2dc287){var _0x4d5385=_[_0x1b92('0x54')](_0x1d33bf['whatsappQueuesWaitingInteractions']);_0x3eabe1({'count':_0x4d5385[_0x1b92('0x1a')],'rows':_0x4d5385});});}};var _0x508806=jayson['server'](_0x1a559b)['http']();_0x508806['on'](_0x1b92('0x39'),function(_0x3e3b36){logger[_0x1b92('0x39')](JSON[_0x1b92('0x3f')](_0x3e3b36));return _0x5c5c89(_0x3e3b36);});_0x508806[_0x1b92('0x16')](0x232c,'127.0.0.1',function(){console[_0x1b92('0x64')](_0x1b92('0x65'),0x232c);return _0x428396(_0x1b92('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 9aead87..b3f3343 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 _0xfb2c=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util'];(function(_0x1d0fa7,_0x1ad70f){var _0x5b2d91=function(_0x4ff922){while(--_0x4ff922){_0x1d0fa7['push'](_0x1d0fa7['shift']());}};_0x5b2d91(++_0x1ad70f);}(_0xfb2c,0x6f));var _0xcfb2=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xfb2c[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0xcfb2('0x0'));var BPromise=require(_0xcfb2('0x1'));var jayson=require(_0xcfb2('0x2'));var _=require(_0xcfb2('0x3'));var logger=require(_0xcfb2('0x4'))(_0xcfb2('0x5'));var client=jayson[_0xcfb2('0x6')][_0xcfb2('0x7')]({'port':0x232a});function request(_0x90c762,_0x4ded8b){return new BPromise(function(_0x4a0863,_0x331edb){return client[_0xcfb2('0x8')](_0x90c762,_0x4ded8b)[_0xcfb2('0x9')](function(_0x246a9a){if(_0x246a9a[_0xcfb2('0xa')]){return _0x331edb(_0x246a9a[_0xcfb2('0xa')][_0xcfb2('0xb')]);}else{return _0x4a0863(_0x246a9a['result']);}})[_0xcfb2('0xc')](function(_0x3b2839){return _0x331edb(_0x3b2839);});});}exports[_0xcfb2('0xd')]=function(_0x45e974,_0x33c4ff,_0x2b89a7){return function(_0x16ae95){if(_0x2b89a7[_0xcfb2('0xe')]&&!_0x2b89a7[_0xcfb2('0xe')][_0x45e974]){logger[_0xcfb2('0xf')](_0xcfb2('0x10'),_0x45e974);return _0x16ae95[_0xcfb2('0x11')]();}var _0x363209=[];for(var _0x425d49=0x0;_0x425d49<_0x33c4ff['length'];_0x425d49+=0x1){_0x363209[_0xcfb2('0x12')](request(_0xcfb2('0x13'),{'command':util['format']('iftime\x20%s',_0x33c4ff[_0x425d49])})['then'](function(_0x210edb){return _0x210edb&&_0x210edb[_0xcfb2('0xb')]&&_0x210edb[_0xcfb2('0xb')][_0xcfb2('0x14')]('true')>=0x0?!![]:![];})[_0xcfb2('0xc')](function(_0x43fd01){logger[_0xcfb2('0xa')](_0xcfb2('0x15'),_0x45e974,_0x33c4ff[_0x425d49]);}));}BPromise[_0xcfb2('0x16')](_0x363209)[_0xcfb2('0x9')](function(_0x4389a1){var _0x5111ee=_['some'](_0x4389a1);logger['info'](_0xcfb2('0x17'),_0x45e974,_0x33c4ff[_0xcfb2('0x18')](_0xcfb2('0x19')),_0x5111ee);_0x16ae95['when'](_0x5111ee);})[_0xcfb2('0xc')](function(_0x261e5f){console[_0xcfb2('0x1a')](_0x261e5f);logger[_0xcfb2('0xa')](_0xcfb2('0x17'),_0x45e974,_0x33c4ff[_0xcfb2('0x18')](_0xcfb2('0x19')),_0x261e5f[_0xcfb2('0x1b')]);_0x16ae95[_0xcfb2('0x11')]();});};}; \ No newline at end of file +var _0x2d11=['result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','error','message'];(function(_0x4c8106,_0x37a590){var _0x51f51b=function(_0x47e3f3){while(--_0x47e3f3){_0x4c8106['push'](_0x4c8106['shift']());}};_0x51f51b(++_0x37a590);}(_0x2d11,0x8b));var _0x12d1=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2d11[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x12d1('0x0'));var BPromise=require(_0x12d1('0x1'));var jayson=require(_0x12d1('0x2'));var _=require(_0x12d1('0x3'));var logger=require(_0x12d1('0x4'))(_0x12d1('0x5'));var client=jayson[_0x12d1('0x6')][_0x12d1('0x7')]({'port':0x232a});function request(_0x369179,_0x24b02e){return new BPromise(function(_0x4f4f84,_0x33f483){return client[_0x12d1('0x8')](_0x369179,_0x24b02e)['then'](function(_0x2122b4){if(_0x2122b4['error']){return _0x33f483(_0x2122b4[_0x12d1('0x9')][_0x12d1('0xa')]);}else{return _0x4f4f84(_0x2122b4[_0x12d1('0xb')]);}})[_0x12d1('0xc')](function(_0x5a8f0f){return _0x33f483(_0x5a8f0f);});});}exports[_0x12d1('0xd')]=function(_0x2f4493,_0x1c9a53,_0x41823a){return function(_0x45be17){if(_0x41823a[_0x12d1('0xe')]&&!_0x41823a['rules'][_0x2f4493]){logger[_0x12d1('0xf')](_0x12d1('0x10'),_0x2f4493);return _0x45be17[_0x12d1('0x11')]();}var _0x56dc7c=[];for(var _0xc8a71=0x0;_0xc8a71<_0x1c9a53['length'];_0xc8a71+=0x1){_0x56dc7c[_0x12d1('0x12')](request(_0x12d1('0x13'),{'command':util['format'](_0x12d1('0x14'),_0x1c9a53[_0xc8a71])})[_0x12d1('0x15')](function(_0xeeacaf){return _0xeeacaf&&_0xeeacaf[_0x12d1('0xa')]&&_0xeeacaf[_0x12d1('0xa')][_0x12d1('0x16')](_0x12d1('0x17'))>=0x0?!![]:![];})['catch'](function(_0xc7d803){logger[_0x12d1('0x9')](_0x12d1('0x18'),_0x2f4493,_0x1c9a53[_0xc8a71]);}));}BPromise[_0x12d1('0x19')](_0x56dc7c)[_0x12d1('0x15')](function(_0x305fcb){var _0x119b05=_['some'](_0x305fcb);logger[_0x12d1('0xf')](_0x12d1('0x1a'),_0x2f4493,_0x1c9a53[_0x12d1('0x1b')]('\x20|\x20'),_0x119b05);_0x45be17['when'](_0x119b05);})[_0x12d1('0xc')](function(_0x3177e7){console[_0x12d1('0x1c')](_0x3177e7);logger[_0x12d1('0x9')](_0x12d1('0x1a'),_0x2f4493,_0x1c9a53['join'](_0x12d1('0x1d')),_0x3177e7['stack']);_0x45be17[_0x12d1('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 207334e..c53a1c4 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 _0xda3f=['ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','holdtime','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason'];(function(_0x4c583c,_0x167310){var _0x2d0b2d=function(_0x395dc9){while(--_0x395dc9){_0x4c583c['push'](_0x4c583c['shift']());}};_0x2d0b2d(++_0x167310);}(_0xda3f,0xec));var _0xfda3=function(_0x581b6f,_0x44137f){_0x581b6f=_0x581b6f-0x0;var _0x33b7bf=_0xda3f[_0x581b6f];return _0x33b7bf;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var utils=require(_0xfda3('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x534697,_0x5299b0){utils['info'](util[_0xfda3('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x534697[_0xfda3('0x3')],_0x534697[_0xfda3('0x4')],_0x534697['queue'],_0x534697[_0xfda3('0x5')],_0x534697[_0xfda3('0x6')],_0x534697['calleridnum'],_0x534697['connectedlinenum'],_0x534697[_0xfda3('0x7')]));if(_0x534697[_0xfda3('0x8')]){utils[_0xfda3('0x9')](_0x534697[_0xfda3('0x8')])[_0xfda3('0xa')](function(_0x20e790){if(_0x20e790){_0x534697[_0xfda3('0xb')]=_0x20e790[_0xfda3('0xb')];_0x534697[_0xfda3('0xc')]=_0x534697[_0xfda3('0xd')]?_0x20e790[_0xfda3('0xe')]:![];_0x534697[_0xfda3('0xf')]=_0x534697['agentacw']?_0x20e790[_0xfda3('0x10')]:0x0;}utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);});}else{utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);}if(_0x5299b0){delete transfers[_0x534697['uniqueid']];}else{delete agents[_0x534697[_0xfda3('0x13')]];}}exports['agentcalled']=function(_0x3fd031){try{utils[_0xfda3('0x14')](util['format']('[%s][agents][agentcalled]',_0x3fd031['uniqueid']),_0x3fd031);agents[_0x3fd031[_0xfda3('0x13')]]=_0x3fd031;agents[_0x3fd031[_0xfda3('0x13')]]['agentcalledAt']=utils['now']();agents[_0x3fd031['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x15');agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x16')]=null;agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x17')]=null;utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x19'),_0x3fd031[_0xfda3('0x3')],agents[_0x3fd031['destuniqueid']][_0xfda3('0x5')],_0x3fd031[_0xfda3('0x13')]));}catch(_0x12d568){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x1b'),_0x3fd031[_0xfda3('0x3')]),_0x12d568);}};exports[_0xfda3('0x1c')]=function(_0x51e731){try{if(!_['isNil'](agents[_0x51e731[_0xfda3('0x13')]])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')]('[%s][agents][agentringnoanswer]',_0x51e731[_0xfda3('0x3')]),_0x51e731);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x1d'),_0x51e731[_0xfda3('0x3')],agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x5')],_0x51e731[_0xfda3('0x13')]));agents[_0x51e731[_0xfda3('0x13')]]['agentringnoanswer']=!![];agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();agents[_0x51e731['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x21')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]]['holdtime']=_0x51e731[_0xfda3('0x22')]?parseInt(_0x51e731[_0xfda3('0x22')])/0x3e8:0x0;agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x23')]=0x0;unanswered[_0xfda3('0x24')](_0x51e731['destuniqueid']);}}catch(_0x3c1549){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x25'),_0x51e731[_0xfda3('0x3')]),_0x3c1549);}};exports[_0xfda3('0x26')]=function(_0x26e544){try{_['forIn'](agents,function(_0x56ca3a,_0x3aef3c){if(_0x56ca3a['uniqueid']==_0x26e544['uniqueid']&&!_[_0xfda3('0x27')](unanswered,_0x56ca3a[_0xfda3('0x13')])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x26e544);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x29'),_0x26e544['uniqueid'],_0x56ca3a[_0xfda3('0x5')],_0x56ca3a[_0xfda3('0x13')]));_0x56ca3a[_0xfda3('0x1c')]=!![];_0x56ca3a[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x56ca3a[_0xfda3('0x7')]=_0xfda3('0x2a');_0x56ca3a[_0xfda3('0x21')]=_0xfda3('0x2a');_0x56ca3a['holdtime']=_0x26e544['holdtime'];_0x56ca3a[_0xfda3('0x23')]=0x0;writeDB(_0x56ca3a);}});}catch(_0x17cccb){utils['error'](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x17cccb);}};exports['agentconnect']=function(_0x1d92a9){try{if(agents[_0x1d92a9[_0xfda3('0x13')]]){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x1d92a9);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x2c'),_0x1d92a9['uniqueid'],agents[_0x1d92a9[_0xfda3('0x13')]]['membername'],_0x1d92a9[_0xfda3('0x13')]));agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x16')]=_0x1d92a9[_0xfda3('0x16')];agents[_0x1d92a9[_0xfda3('0x13')]]['connectedlinename']=_0x1d92a9[_0xfda3('0x17')];agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];agents[_0x1d92a9['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x2f');_[_0xfda3('0x30')](agents,function(_0x5bad90,_0x5ac61e){if(_0x5bad90[_0xfda3('0x13')]!=_0x1d92a9[_0xfda3('0x13')]&&_0x5bad90[_0xfda3('0x3')]==_0x1d92a9[_0xfda3('0x3')]){_0x5bad90[_0xfda3('0x23')]=0x0;_0x5bad90[_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];_0x5bad90[_0xfda3('0x1c')]=!![];_0x5bad90[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x5bad90['lastevent']=_0xfda3('0x31');_0x5bad90[_0xfda3('0x21')]='answered_elsewhere';_0x5bad90[_0xfda3('0x32')]=_0x1d92a9['destuniqueid'];_0x5bad90['answeredelsewheremembername']=_0x1d92a9['membername'];writeDB(_0x5bad90);}});}}catch(_0x2208bc){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x2208bc);}};exports[_0xfda3('0xd')]=function(_0x25b9a6){try{if(!_[_0xfda3('0x33')](agents[_0x25b9a6[_0xfda3('0x13')]])){utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x25b9a6);utils['info'](util['format'](_0xfda3('0x35'),_0x25b9a6[_0xfda3('0x3')],agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x5')],_0x25b9a6[_0xfda3('0x13')]));agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0xd')]=!![];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x25b9a6[_0xfda3('0x13')]]['agentcompleteAt'],agents[_0x25b9a6['destuniqueid']][_0xfda3('0x2d')]);agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x21')]=_0x25b9a6[_0xfda3('0x21')];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x7')]=_0xfda3('0x38');writeDB(agents[_0x25b9a6[_0xfda3('0x13')]]);}}catch(_0x1372ee){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x1372ee);}};exports[_0xfda3('0x39')]=function(_0x36aa3a){try{if(!_[_0xfda3('0x33')](agents[_0x36aa3a['transfereruniqueid']])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a['uniqueid']),_0x36aa3a);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x3b'),_0x36aa3a['uniqueid'],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x5')],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x3')]));agents[_0x36aa3a[_0xfda3('0x3c')]]['transfer']=!![];agents[_0x36aa3a[_0xfda3('0x3c')]]['transfertype']=_0xfda3('0x3d');agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3e')]=_0x36aa3a[_0xfda3('0x3f')];agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x40')]=agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3')];}}catch(_0x3b430d){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a[_0xfda3('0x3')]),_0x3b430d);}};exports[_0xfda3('0x41')]=function(_0x54fba2){try{utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x42'),_0x54fba2[_0xfda3('0x43')]),_0x54fba2);if(_0x54fba2['origtransfereruniqueid']==_0x54fba2['origtransfererlinkedid']){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x44')]])){utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x45'),_0x54fba2['origtransfereruniqueid'],agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x46')]=!![];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x3e')]=_0x54fba2[_0xfda3('0x49')];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x40')]=_0x54fba2['origtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x4a')]&&agents[_0x54fba2[_0xfda3('0x4a')]]){agents[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2[_0xfda3('0x4a')]]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x4a')]]);transfers[_0x54fba2['transfereeuniqueid']]['calleridnum']=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4e')]=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4e')];transfers[_0x54fba2[_0xfda3('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4b')]=0x2;}}else if(_0x54fba2[_0xfda3('0x44')]==_0x54fba2[_0xfda3('0x4f')]){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x43')]])){utils[_0xfda3('0x18')](util['format'](_0xfda3('0x45'),_0x54fba2[_0xfda3('0x43')],agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x43')]]['transfer']=!![];agents[_0x54fba2['origtransfereruniqueid']][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2['origtransfereruniqueid']]['transferexten']=_0x54fba2['secondtransfererexten'];agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x40')]=_0x54fba2['secondtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x50')]&&agents[_0x54fba2[_0xfda3('0x50')]]){agents[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2['transfertargetuniqueid']]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x50')]]);transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4d')]=agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfertargetuniqueid']]['calleridname']=agents[_0x54fba2[_0xfda3('0x43')]]['calleridname'];transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x51')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x2;}}}catch(_0x4aa383){utils[_0xfda3('0x1a')](util['format']('[%s][agents][attendedtransfer]',_0x54fba2[_0xfda3('0x43')]),_0x4aa383);}};exports[_0xfda3('0x52')]=function(_0x531874){try{utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x531874);if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]===_0xfda3('0x20')){if(_0x531874[_0xfda3('0x54')]==='21'){agents[_0x531874['uniqueid']]['reason']='rejected';agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x7')]=_0xfda3('0x55');}utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874['uniqueid'],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],agents[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(agents[_0x531874['uniqueid']]);var _0x311645=unanswered[_0xfda3('0x57')](_0x531874[_0xfda3('0x3')]);if(_0x311645>-0x1){unanswered[_0xfda3('0x58')](_0x311645,0x1);}}if(transfers[_0x531874[_0xfda3('0x3')]]){transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0xd')]=!![];transfers[_0x531874['uniqueid']][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](transfers[_0x531874[_0xfda3('0x3')]]['agentcompleteAt'],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]=_0xfda3('0x59');transfers[_0x531874['uniqueid']][_0xfda3('0x7')]=_0xfda3('0x38');utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],transfers[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(transfers[_0x531874[_0xfda3('0x3')]],!![]);}if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]){agents[_0x531874['uniqueid']]['agentcomplete']=!![];agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);agents[_0x531874[_0xfda3('0x3')]]['reason']=agents[_0x531874[_0xfda3('0x3')]]['transfer']?'transfer':'agent';agents[_0x531874[_0xfda3('0x3')]]['lastevent']=_0xfda3('0x38');utils[_0xfda3('0x18')](util['format'](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],agents[_0x531874['uniqueid']][_0xfda3('0x5')],agents[_0x531874['uniqueid']][_0xfda3('0x21')],agents[_0x531874[_0xfda3('0x3')]]['lastevent']));writeDB(agents[_0x531874[_0xfda3('0x3')]]);}}catch(_0x2122e3){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x2122e3);}}; \ No newline at end of file +var _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0xac5315,_0xafce68){var _0x415c41=function(_0x390fe6){while(--_0x390fe6){_0xac5315['push'](_0xac5315['shift']());}};_0x415c41(++_0xafce68);}(_0xb49a,0xfb));var _0xab49=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xb49a[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3c9ecc8..6ac1be7 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 _0xcf2e=['request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','accountcode','context','now','[%s][calls][newstate]','isNil','systemanswertime','transfer','destinationchannel','answertime','toNumber','channelstate','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','UserId'];(function(_0x42a721,_0x2098e5){var _0x300148=function(_0x585f3c){while(--_0x585f3c){_0x42a721['push'](_0x42a721['shift']());}};_0x300148(++_0x2098e5);}(_0xcf2e,0x197));var _0xecf2=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0xcf2e[_0x2a7c2a];return _0x195732;};'use strict';var _=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var utils=require(_0xecf2('0x2'));var transfers=require(_0xecf2('0x3'));var dispositions=[_0xecf2('0x4'),_0xecf2('0x5'),_0xecf2('0x5'),_0xecf2('0x4'),_0xecf2('0x4'),'NO\x20ANSWER',_0xecf2('0x6'),_0xecf2('0x7'),_0xecf2('0x5'),_0xecf2('0x5'),'FAILED'];var channels={};function writeDB(_0x1d4f99){var _0xc8c7f6;if(transfers[_0xecf2('0x8')][_0x1d4f99[_0xecf2('0x9')]]){_0xc8c7f6=_0x1d4f99[_0xecf2('0x9')];_0x1d4f99[_0xecf2('0x9')]=transfers[_0xecf2('0x8')][_0x1d4f99[_0xecf2('0x9')]]['transfereeuniqueid'];}utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0xc'),_0x1d4f99[_0xecf2('0x9')],_0x1d4f99[_0xecf2('0xd')],_0x1d4f99[_0xecf2('0xe')],_0x1d4f99['membername'],_0x1d4f99[_0xecf2('0xf')],_0x1d4f99[_0xecf2('0x10')],_0x1d4f99[_0xecf2('0x11')],_0x1d4f99[_0xecf2('0x12')]));if(_0x1d4f99['accountcode']){utils['getUserByInternal'](_0x1d4f99['accountcode'])[_0xecf2('0x13')](function(_0x2fa9a2){if(_0x2fa9a2){_0x1d4f99[_0xecf2('0x14')]=_0x2fa9a2['id'];}utils[_0xecf2('0x15')](_0xecf2('0x16'),_0x1d4f99);});}else{utils[_0xecf2('0x15')](_0xecf2('0x16'),_0x1d4f99);}if(channels[_0x1d4f99['uniqueid']]){delete channels[_0x1d4f99[_0xecf2('0x9')]];}else if(_0xc8c7f6&&channels[_0xc8c7f6]){if(!transfers['blinds'][_0xc8c7f6][_0xecf2('0x17')])delete transfers[_0xecf2('0x8')][_0xc8c7f6];delete channels[_0xc8c7f6];}}exports['newchannel']=function(_0x556c53){try{utils['debug'](util['format'](_0xecf2('0x18'),_0x556c53[_0xecf2('0x9')]),_0x556c53);if(_0x556c53[_0xecf2('0x9')]==_0x556c53[_0xecf2('0x19')]&&_0x556c53[_0xecf2('0xd')]!='OutgoingSpoolFailed'){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x1a'),_0x556c53[_0xecf2('0x9')],_0x556c53['context'],_0x556c53['exten']));channels[_0x556c53[_0xecf2('0x9')]]={'uniqueid':_0x556c53[_0xecf2('0x9')],'accountcode':_0x556c53[_0xecf2('0x1b')],'source':_0x556c53[_0xecf2('0x10')],'destination':_0x556c53['exten'],'destinationcontext':_0x556c53[_0xecf2('0x1c')],'channel':_0x556c53[_0xecf2('0xd')],'starttime':utils[_0xecf2('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x3ee797){utils['error'](util['format']('[%s][calls][newchannel]',_0x556c53[_0xecf2('0x9')]),_0x3ee797);}};exports['newstate']=function(_0x29ae4a){try{utils['debug'](util[_0xecf2('0xb')](_0xecf2('0x1e'),_0x29ae4a[_0xecf2('0x9')]),_0x29ae4a);if(!_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x9')]])&&_0x29ae4a['channelstate']==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x29ae4a['uniqueid'],_0x29ae4a[_0xecf2('0x1c')],_0x29ae4a[_0xecf2('0xd')]));if(_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x9')]][_0xecf2('0x20')])){channels[_0x29ae4a[_0xecf2('0x9')]][_0xecf2('0x20')]=utils[_0xecf2('0x1d')]();}}else if(!_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x19')]])&&_0x29ae4a['channelstate']==0x6&&_0x29ae4a[_0xecf2('0x1c')]!=_0xecf2('0x21')){utils[_0xecf2('0xa')](util[_0xecf2('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x29ae4a['uniqueid'],_0x29ae4a['linkedid'],_0x29ae4a[_0xecf2('0x1c')],_0x29ae4a[_0xecf2('0xd')]));channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x1b')]=_0x29ae4a[_0xecf2('0x1b')];channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x22')]=_0x29ae4a[_0xecf2('0xd')];if(_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x23')])){channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x23')]=utils[_0xecf2('0x1d')]();}channels[_0x29ae4a[_0xecf2('0x19')]]['disposition']=dispositions[_[_0xecf2('0x24')](_0x29ae4a[_0xecf2('0x25')])]||_0xecf2('0x6');}}catch(_0x1a3577){utils[_0xecf2('0x26')](util['format'](_0xecf2('0x1e'),_0x29ae4a[_0xecf2('0x9')]),_0x1a3577);}};exports[_0xecf2('0x27')]=function(_0x54b9d3){try{if(!_[_0xecf2('0x1f')](channels[_0x54b9d3[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x29'),_0x54b9d3[_0xecf2('0x9')]),_0x54b9d3);if(_[_0xecf2('0x1f')](channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2a')])){channels[_0x54b9d3['uniqueid']][_0xecf2('0x2a')]=_0x54b9d3[_0xecf2('0x2b')]+'\x20<'+_0x54b9d3[_0xecf2('0x10')]+'>';}utils[_0xecf2('0xa')](util['format'](_0xecf2('0x2c'),_0x54b9d3['uniqueid'],channels[_0x54b9d3['uniqueid']][_0xecf2('0x2a')],_0x54b9d3['cause-txt']));channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2d')]=utils[_0xecf2('0x1d')]();channels[_0x54b9d3['uniqueid']][_0xecf2('0x2e')]=utils['diffTime'](channels[_0x54b9d3['uniqueid']][_0xecf2('0x2d')],channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2f')]);channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x30')]=channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x23')]?utils[_0xecf2('0x31')](channels[_0x54b9d3['uniqueid']][_0xecf2('0x2d')],channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x23')]):0x0;writeDB(channels[_0x54b9d3[_0xecf2('0x9')]]);}}catch(_0x196981){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x29'),_0x54b9d3[_0xecf2('0x9')]),_0x196981);}};exports[_0xecf2('0x32')]=function(_0x4cd901){try{if(!_[_0xecf2('0x1f')](channels[_0x4cd901[_0xecf2('0x33')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')]('[%s][calls][attendedtransfer]',_0x4cd901[_0xecf2('0x34')]),_0x4cd901);if(channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0xd')]==_0x4cd901[_0xecf2('0x35')]){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x36'),_0x4cd901[_0xecf2('0x34')],_0x4cd901[_0xecf2('0x33')],_0x4cd901[_0xecf2('0x37')]));channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x22')]=_0x4cd901[_0xecf2('0x37')];channels[_0x4cd901[_0xecf2('0x33')]]['userfield']=_0xecf2('0x38');}else if(channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0xd')]=_0x4cd901['transfertargetchannel']){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x36'),_0x4cd901['origtransfereruniqueid'],_0x4cd901[_0xecf2('0x33')],_0x4cd901[_0xecf2('0x39')]));channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x22')]=_0x4cd901[_0xecf2('0x39')];channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x3a')]=_0xecf2('0x38');}}}catch(_0x4228f7){utils[_0xecf2('0x26')](util['format']('[%s][calls][attendedtransfer]',_0x4cd901[_0xecf2('0x34')]),_0x4228f7);}};exports[_0xecf2('0x3b')]=function(_0x126eb9){try{if(!_['isNil'](channels[_0x126eb9[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x3c'),_0x126eb9[_0xecf2('0x9')]),_0x126eb9);channels[_0x126eb9[_0xecf2('0x9')]][_0xecf2('0x3d')]=utils['now']();utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x3e'),_0x126eb9[_0xecf2('0x9')],channels[_0x126eb9[_0xecf2('0x9')]]['musiconholdstartAt']));}}catch(_0x544a77){utils[_0xecf2('0x26')](util[_0xecf2('0xb')]('[%s][calls][musiconholdstart]',_0x126eb9[_0xecf2('0x9')]),_0x544a77);}};exports[_0xecf2('0x3f')]=function(_0x310ff5){try{if(!_[_0xecf2('0x1f')](channels[_0x310ff5[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x40'),_0x310ff5['uniqueid']),_0x310ff5);if(!_[_0xecf2('0x1f')](channels[_0x310ff5[_0xecf2('0x9')]]['musiconholdstartAt'])){channels[_0x310ff5['uniqueid']][_0xecf2('0x41')]+=utils[_0xecf2('0x31')](utils[_0xecf2('0x1d')](),channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x3d')]);utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x42'),_0x310ff5['uniqueid'],channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x41')]));delete channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x3d')];}}}catch(_0x2f1040){utils['error'](util[_0xecf2('0xb')](_0xecf2('0x40'),_0x310ff5[_0xecf2('0x9')]),_0x2f1040);}};exports[_0xecf2('0x43')]=function(_0x32bf7c){try{if(!_['isNil'](channels[_0x32bf7c[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x44'),_0x32bf7c[_0xecf2('0x9')]),_0x32bf7c);if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')]['xmd-originatecalleridnum'])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x46'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x48')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x49')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4a'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c['uniqueid']]['destination']=_0x32bf7c[_0xecf2('0x47')];channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x2a')]='\x22'+_0x32bf7c['value']+_0xecf2('0x4b')+_0x32bf7c[_0xecf2('0x47')]+'>';}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')]['xmd-callerid-preview'])||!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x4c')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4d'),_0x32bf7c[_0xecf2('0x9')],!_['isNil'](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x4e')])?_0xecf2('0x4e'):_0xecf2('0x4c'),_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x2a')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x4f')])||!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x50')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4d'),_0x32bf7c[_0xecf2('0x9')],!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x4f')])?'xmd-queue':_0xecf2('0x50'),_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x51')]=_0xecf2('0x52');channels[_0x32bf7c['uniqueid']][_0xecf2('0x53')]=_0x32bf7c[_0xecf2('0x47')];channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0xe')]=!![];}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x54')])){utils['info'](util[_0xecf2('0xb')](_0xecf2('0x55'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c['value']));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x56')]=_0x32bf7c[_0xecf2('0x47')];}if(!_['isNil'](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x57')])){utils['info'](util[_0xecf2('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x32bf7c['uniqueid'],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x58')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x59')])){utils[_0xecf2('0xa')](util['format'](_0xecf2('0x5a'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c['value']));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x5b')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable']['sipcallid'])){utils[_0xecf2('0xa')](util['format'](_0xecf2('0x5c'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x5d')]=_0x32bf7c[_0xecf2('0x47')];}}}catch(_0x586817){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x44'),_0x32bf7c['uniqueid']),_0x586817);}};exports[_0xecf2('0x5e')]=function(_0x5060fe){try{if(!_['isNil'](channels[_0x5060fe[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util['format'](_0xecf2('0x5f'),_0x5060fe[_0xecf2('0x9')]),_0x5060fe);utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x60'),_0x5060fe[_0xecf2('0x9')],_0x5060fe[_0xecf2('0x61')],_0x5060fe[_0xecf2('0x62')]));if(_0x5060fe[_0xecf2('0x61')][_0xecf2('0x63')]()==_0xecf2('0x64')&&_['startsWith'](_0x5060fe['appdata']['toLowerCase'](),_0xecf2('0x65'))){var _0x454e93=_0x5060fe[_0xecf2('0x62')]['split']('=');var _0x45d501=_0x454e93[0x0][_0xecf2('0x66')](_0x454e93[0x0][_0xecf2('0x67')]('(')+0x1,_0x454e93[0x0]['lastIndexOf'](')'));var _0x127a2f=_0x454e93[0x1];channels[_0x5060fe[_0xecf2('0x9')]][_0x45d501]=_0x127a2f;}if(!_[_0xecf2('0x68')]([_0xecf2('0x27'),_0xecf2('0x69'),_0xecf2('0x6a'),_0xecf2('0x64'),'gotoif'],_0x5060fe[_0xecf2('0x61')][_0xecf2('0x63')]())){channels[_0x5060fe[_0xecf2('0x9')]][_0xecf2('0x51')]=_0x5060fe['application'];channels[_0x5060fe['uniqueid']][_0xecf2('0x53')]=_0x5060fe[_0xecf2('0x62')];}}}catch(_0x1b2b40){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x5f'),_0x5060fe['uniqueid']),_0x1b2b40);}}; \ No newline at end of file +var _0xc319=['interface','calleridnum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','recording','newchannel','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','cause-txt','endtime','starttime','billableseconds','diffTime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastapplication','Queue','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','substring','lastIndexOf','includes','noop','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername'];(function(_0x2e2799,_0x476010){var _0x23c915=function(_0x346470){while(--_0x346470){_0x2e2799['push'](_0x2e2799['shift']());}};_0x23c915(++_0x476010);}(_0xc319,0x12e));var _0x9c31=function(_0x21a146,_0x25ab99){_0x21a146=_0x21a146-0x0;var _0x534b8c=_0xc319[_0x21a146];return _0x534b8c;};'use strict';var _=require(_0x9c31('0x0'));var util=require(_0x9c31('0x1'));var utils=require(_0x9c31('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x9c31('0x3'),_0x9c31('0x4'),'FAILED',_0x9c31('0x3'),_0x9c31('0x3'),_0x9c31('0x3'),_0x9c31('0x5'),'BUSY',_0x9c31('0x4'),_0x9c31('0x4'),_0x9c31('0x4')];var channels={};function writeDB(_0x2bdff2){var _0x3aa031;if(transfers[_0x9c31('0x6')][_0x2bdff2[_0x9c31('0x7')]]){_0x3aa031=_0x2bdff2[_0x9c31('0x7')];_0x2bdff2[_0x9c31('0x7')]=transfers['blinds'][_0x2bdff2['uniqueid']]['transfereeuniqueid'];}utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0xa'),_0x2bdff2[_0x9c31('0x7')],_0x2bdff2[_0x9c31('0xb')],_0x2bdff2['queue'],_0x2bdff2[_0x9c31('0xc')],_0x2bdff2[_0x9c31('0xd')],_0x2bdff2[_0x9c31('0xe')],_0x2bdff2['connectedlinenum'],_0x2bdff2[_0x9c31('0xf')]));if(_0x2bdff2[_0x9c31('0x10')]){utils[_0x9c31('0x11')](_0x2bdff2[_0x9c31('0x10')])[_0x9c31('0x12')](function(_0x4d9601){if(_0x4d9601){_0x2bdff2['UserId']=_0x4d9601['id'];}utils['request']('CreateVoiceCallReport',_0x2bdff2);});}else{utils['request'](_0x9c31('0x13'),_0x2bdff2);}if(channels[_0x2bdff2[_0x9c31('0x7')]]){delete channels[_0x2bdff2['uniqueid']];}else if(_0x3aa031&&channels[_0x3aa031]){if(!transfers[_0x9c31('0x6')][_0x3aa031][_0x9c31('0x14')])delete transfers[_0x9c31('0x6')][_0x3aa031];delete channels[_0x3aa031];}}exports[_0x9c31('0x15')]=function(_0x330ed4){try{utils['debug'](util[_0x9c31('0x9')]('[%s][calls][newchannel]',_0x330ed4[_0x9c31('0x7')]),_0x330ed4);if(_0x330ed4['uniqueid']==_0x330ed4[_0x9c31('0x16')]&&_0x330ed4['channel']!=_0x9c31('0x17')){utils[_0x9c31('0x8')](util[_0x9c31('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x330ed4[_0x9c31('0x7')],_0x330ed4[_0x9c31('0x18')],_0x330ed4[_0x9c31('0x19')]));channels[_0x330ed4['uniqueid']]={'uniqueid':_0x330ed4[_0x9c31('0x7')],'accountcode':_0x330ed4[_0x9c31('0x10')],'source':_0x330ed4['calleridnum'],'destination':_0x330ed4[_0x9c31('0x19')],'destinationcontext':_0x330ed4[_0x9c31('0x18')],'channel':_0x330ed4[_0x9c31('0xb')],'starttime':utils[_0x9c31('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x9c31('0x1b')};}}catch(_0x3f66ee){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')](_0x9c31('0x1d'),_0x330ed4[_0x9c31('0x7')]),_0x3f66ee);}};exports[_0x9c31('0x1e')]=function(_0x47f388){try{utils[_0x9c31('0x1f')](util[_0x9c31('0x9')](_0x9c31('0x20'),_0x47f388[_0x9c31('0x7')]),_0x47f388);if(!_[_0x9c31('0x21')](channels[_0x47f388[_0x9c31('0x7')]])&&_0x47f388['channelstate']==0x6){utils[_0x9c31('0x8')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x47f388[_0x9c31('0x7')],_0x47f388[_0x9c31('0x18')],_0x47f388[_0x9c31('0xb')]));if(_[_0x9c31('0x21')](channels[_0x47f388['uniqueid']][_0x9c31('0x22')])){channels[_0x47f388[_0x9c31('0x7')]][_0x9c31('0x22')]=utils[_0x9c31('0x1a')]();}}else if(!_[_0x9c31('0x21')](channels[_0x47f388[_0x9c31('0x16')]])&&_0x47f388[_0x9c31('0x23')]==0x6&&_0x47f388['context']!=_0x9c31('0x24')){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x25'),_0x47f388[_0x9c31('0x7')],_0x47f388[_0x9c31('0x16')],_0x47f388[_0x9c31('0x18')],_0x47f388[_0x9c31('0xb')]));channels[_0x47f388[_0x9c31('0x16')]][_0x9c31('0x10')]=_0x47f388[_0x9c31('0x10')];channels[_0x47f388[_0x9c31('0x16')]][_0x9c31('0x26')]=_0x47f388['channel'];if(_['isNil'](channels[_0x47f388[_0x9c31('0x16')]][_0x9c31('0x27')])){channels[_0x47f388[_0x9c31('0x16')]][_0x9c31('0x27')]=utils['now']();}channels[_0x47f388[_0x9c31('0x16')]][_0x9c31('0x28')]=dispositions[_[_0x9c31('0x29')](_0x47f388[_0x9c31('0x23')])]||_0x9c31('0x5');}}catch(_0x10cb06){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')]('[%s][calls][newstate]',_0x47f388[_0x9c31('0x7')]),_0x10cb06);}};exports[_0x9c31('0x2a')]=function(_0xd8ac8f){try{if(!_['isNil'](channels[_0xd8ac8f[_0x9c31('0x7')]])){utils[_0x9c31('0x1f')](util[_0x9c31('0x9')]('[%s][calls][hangup]',_0xd8ac8f[_0x9c31('0x7')]),_0xd8ac8f);if(_[_0x9c31('0x21')](channels[_0xd8ac8f['uniqueid']]['callerid'])){channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x2b')]=_0xd8ac8f[_0x9c31('0x2c')]+'\x20<'+_0xd8ac8f[_0x9c31('0xe')]+'>';}utils[_0x9c31('0x8')](util[_0x9c31('0x9')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xd8ac8f[_0x9c31('0x7')],channels[_0xd8ac8f['uniqueid']][_0x9c31('0x2b')],_0xd8ac8f[_0x9c31('0x2d')]));channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x2e')]=utils[_0x9c31('0x1a')]();channels[_0xd8ac8f[_0x9c31('0x7')]]['duration']=utils['diffTime'](channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x2e')],channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x2f')]);channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x30')]=channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x27')]?utils[_0x9c31('0x31')](channels[_0xd8ac8f['uniqueid']][_0x9c31('0x2e')],channels[_0xd8ac8f[_0x9c31('0x7')]][_0x9c31('0x27')]):0x0;writeDB(channels[_0xd8ac8f['uniqueid']]);}}catch(_0x1e085c){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')](_0x9c31('0x32'),_0xd8ac8f[_0x9c31('0x7')]),_0x1e085c);}};exports['attendedtransfer']=function(_0x3be59d){try{if(!_[_0x9c31('0x21')](channels[_0x3be59d[_0x9c31('0x33')]])){utils['debug'](util[_0x9c31('0x9')](_0x9c31('0x34'),_0x3be59d[_0x9c31('0x35')]),_0x3be59d);if(channels[_0x3be59d[_0x9c31('0x33')]][_0x9c31('0xb')]==_0x3be59d[_0x9c31('0x36')]){utils[_0x9c31('0x8')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3be59d[_0x9c31('0x35')],_0x3be59d[_0x9c31('0x33')],_0x3be59d[_0x9c31('0x37')]));channels[_0x3be59d[_0x9c31('0x33')]][_0x9c31('0x26')]=_0x3be59d['secondtransfererchannel'];channels[_0x3be59d['localtwolinkedid']][_0x9c31('0x38')]=_0x9c31('0x39');}else if(channels[_0x3be59d[_0x9c31('0x33')]][_0x9c31('0xb')]=_0x3be59d[_0x9c31('0x3a')]){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x3b'),_0x3be59d['origtransfereruniqueid'],_0x3be59d[_0x9c31('0x33')],_0x3be59d['origtransfererchannel']));channels[_0x3be59d['localtwolinkedid']][_0x9c31('0x26')]=_0x3be59d[_0x9c31('0x3c')];channels[_0x3be59d['localtwolinkedid']]['userfield']=_0x9c31('0x39');}}}catch(_0x1e0e47){utils[_0x9c31('0x1c')](util['format'](_0x9c31('0x34'),_0x3be59d[_0x9c31('0x35')]),_0x1e0e47);}};exports[_0x9c31('0x3d')]=function(_0x5603f3){try{if(!_[_0x9c31('0x21')](channels[_0x5603f3[_0x9c31('0x7')]])){utils[_0x9c31('0x1f')](util[_0x9c31('0x9')](_0x9c31('0x3e'),_0x5603f3['uniqueid']),_0x5603f3);channels[_0x5603f3['uniqueid']][_0x9c31('0x3f')]=utils[_0x9c31('0x1a')]();utils[_0x9c31('0x8')](util['format'](_0x9c31('0x40'),_0x5603f3[_0x9c31('0x7')],channels[_0x5603f3['uniqueid']][_0x9c31('0x3f')]));}}catch(_0x308303){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')]('[%s][calls][musiconholdstart]',_0x5603f3['uniqueid']),_0x308303);}};exports[_0x9c31('0x41')]=function(_0x4bc5c6){try{if(!_[_0x9c31('0x21')](channels[_0x4bc5c6[_0x9c31('0x7')]])){utils['debug'](util[_0x9c31('0x9')]('[%s][calls][musiconholdstop]',_0x4bc5c6['uniqueid']),_0x4bc5c6);if(!_[_0x9c31('0x21')](channels[_0x4bc5c6[_0x9c31('0x7')]][_0x9c31('0x3f')])){channels[_0x4bc5c6[_0x9c31('0x7')]][_0x9c31('0x42')]+=utils[_0x9c31('0x31')](utils[_0x9c31('0x1a')](),channels[_0x4bc5c6[_0x9c31('0x7')]][_0x9c31('0x3f')]);utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x43'),_0x4bc5c6[_0x9c31('0x7')],channels[_0x4bc5c6['uniqueid']][_0x9c31('0x42')]));delete channels[_0x4bc5c6[_0x9c31('0x7')]][_0x9c31('0x3f')];}}}catch(_0x4a65b3){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')]('[%s][calls][musiconholdstop]',_0x4bc5c6[_0x9c31('0x7')]),_0x4a65b3);}};exports['varset']=function(_0x59683a){try{if(!_[_0x9c31('0x21')](channels[_0x59683a['uniqueid']])){utils['debug'](util[_0x9c31('0x9')](_0x9c31('0x44'),_0x59683a[_0x9c31('0x7')]),_0x59683a);if(!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')]['xmd-originatecalleridnum'])){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x46'),_0x59683a[_0x9c31('0x7')],_0x59683a['value']));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x47')]=_0x59683a[_0x9c31('0x48')];}if(!_['isNil'](_0x59683a[_0x9c31('0x45')]['xmd-phone'])){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x49'),_0x59683a['uniqueid'],_0x59683a[_0x9c31('0x48')]));channels[_0x59683a['uniqueid']][_0x9c31('0x4a')]=_0x59683a[_0x9c31('0x48')];channels[_0x59683a[_0x9c31('0x7')]]['callerid']='\x22'+_0x59683a[_0x9c31('0x48')]+'\x22\x20<'+_0x59683a['value']+'>';}if(!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')]['xmd-callerid-preview'])||!_['isNil'](_0x59683a[_0x9c31('0x45')][_0x9c31('0x4b')])){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x4c'),_0x59683a[_0x9c31('0x7')],!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')]['xmd-callerid-preview'])?_0x9c31('0x4d'):_0x9c31('0x4b'),_0x59683a[_0x9c31('0x48')]));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x2b')]=_0x59683a['value'];}if(!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')]['xmd-queue'])||!_[_0x9c31('0x21')](_0x59683a['variable'][_0x9c31('0x4e')])){utils['info'](util[_0x9c31('0x9')](_0x9c31('0x4c'),_0x59683a['uniqueid'],!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')][_0x9c31('0x4f')])?_0x9c31('0x4f'):_0x9c31('0x4e'),_0x59683a[_0x9c31('0x48')]));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x50')]=_0x9c31('0x51');channels[_0x59683a['uniqueid']]['lastdata']=_0x59683a[_0x9c31('0x48')];channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x52')]=!![];}if(!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')]['xmd-contactid'])){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x53'),_0x59683a['uniqueid'],_0x59683a[_0x9c31('0x48')]));channels[_0x59683a['uniqueid']][_0x9c31('0x54')]=_0x59683a[_0x9c31('0x48')];}if(!_[_0x9c31('0x21')](_0x59683a['variable'][_0x9c31('0x55')])){utils['info'](util[_0x9c31('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x59683a['uniqueid'],_0x59683a[_0x9c31('0x48')]));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x56')]=_0x59683a[_0x9c31('0x48')];}if(!_[_0x9c31('0x21')](_0x59683a['variable']['outboundrouteid'])){utils['info'](util[_0x9c31('0x9')](_0x9c31('0x57'),_0x59683a['uniqueid'],_0x59683a[_0x9c31('0x48')]));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x58')]=_0x59683a[_0x9c31('0x48')];}if(!_[_0x9c31('0x21')](_0x59683a[_0x9c31('0x45')][_0x9c31('0x59')])){utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x5a'),_0x59683a[_0x9c31('0x7')],_0x59683a[_0x9c31('0x48')]));channels[_0x59683a[_0x9c31('0x7')]][_0x9c31('0x59')]=_0x59683a[_0x9c31('0x48')];}}}catch(_0xdfc740){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')](_0x9c31('0x44'),_0x59683a[_0x9c31('0x7')]),_0xdfc740);}};exports[_0x9c31('0x5b')]=function(_0x4d86bd){try{if(!_[_0x9c31('0x21')](channels[_0x4d86bd[_0x9c31('0x7')]])){utils['debug'](util['format'](_0x9c31('0x5c'),_0x4d86bd[_0x9c31('0x7')]),_0x4d86bd);utils[_0x9c31('0x8')](util[_0x9c31('0x9')](_0x9c31('0x5d'),_0x4d86bd['uniqueid'],_0x4d86bd[_0x9c31('0x5e')],_0x4d86bd[_0x9c31('0x5f')]));if(_0x4d86bd[_0x9c31('0x5e')][_0x9c31('0x60')]()==_0x9c31('0x61')&&_[_0x9c31('0x62')](_0x4d86bd[_0x9c31('0x5f')][_0x9c31('0x60')](),'cdr')){var _0x44ca5a=_0x4d86bd[_0x9c31('0x5f')]['split']('=');var _0xccc86a=_0x44ca5a[0x0][_0x9c31('0x63')](_0x44ca5a[0x0][_0x9c31('0x64')]('(')+0x1,_0x44ca5a[0x0]['lastIndexOf'](')'));var _0x3d5ae3=_0x44ca5a[0x1];channels[_0x4d86bd[_0x9c31('0x7')]][_0xccc86a]=_0x3d5ae3;}if(!_[_0x9c31('0x65')]([_0x9c31('0x2a'),_0x9c31('0x66'),'execif',_0x9c31('0x61'),_0x9c31('0x67')],_0x4d86bd['application'][_0x9c31('0x60')]())){channels[_0x4d86bd[_0x9c31('0x7')]][_0x9c31('0x50')]=_0x4d86bd[_0x9c31('0x5e')];channels[_0x4d86bd['uniqueid']][_0x9c31('0x68')]=_0x4d86bd[_0x9c31('0x5f')];}}}catch(_0xc620d1){utils[_0x9c31('0x1c')](util[_0x9c31('0x9')]('[%s][calls][newexten]',_0x4d86bd[_0x9c31('0x7')]),_0xc620d1);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index be605f0..dad0c14 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 _0xf969=['connect','info','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x1ae44a,_0x4a9881){var _0x3f15f2=function(_0x2573d6){while(--_0x2573d6){_0x1ae44a['push'](_0x1ae44a['shift']());}};_0x3f15f2(++_0x4a9881);}(_0xf969,0x96));var _0x9f96=function(_0x5367a1,_0x27dad3){_0x5367a1=_0x5367a1-0x0;var _0x303cac=_0xf969[_0x5367a1];return _0x303cac;};'use strict';var utils=require('./utils');exports[_0x9f96('0x0')]=function(){utils[_0x9f96('0x1')]('[core]\x20connected');};exports[_0x9f96('0x2')]=function(){utils[_0x9f96('0x1')](_0x9f96('0x3'));};exports['fullybooted']=function(){utils[_0x9f96('0x1')](_0x9f96('0x4'));};exports[_0x9f96('0x5')]=function(_0x32f517){utils[_0x9f96('0x5')](_0x9f96('0x6'),_0x32f517);};exports[_0x9f96('0x7')]=function(){utils[_0x9f96('0x1')](_0x9f96('0x8'));};exports[_0x9f96('0x9')]=function(_0xded515){}; \ No newline at end of file +var _0x16dc=['connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0xbcc991,_0x4a7430){var _0x2a2219=function(_0x58c8a9){while(--_0x58c8a9){_0xbcc991['push'](_0xbcc991['shift']());}};_0x2a2219(++_0x4a7430);}(_0x16dc,0x1ef));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('./utils');exports[_0xc16d('0x0')]=function(){utils[_0xc16d('0x1')](_0xc16d('0x2'));};exports['shutdown']=function(){utils['info'](_0xc16d('0x3'));};exports[_0xc16d('0x4')]=function(){utils[_0xc16d('0x1')]('[core]\x20fullybooted');};exports[_0xc16d('0x5')]=function(_0x2f77c7){utils[_0xc16d('0x5')](_0xc16d('0x6'),_0x2f77c7);};exports[_0xc16d('0x7')]=function(){utils[_0xc16d('0x1')](_0xc16d('0x8'));};exports['managerevent']=function(_0x37c14b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c7bf2c8..82768d2 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 _0x82c9=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','holdtime','billableseconds','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x3d609b,_0xf285d){var _0x2dce8b=function(_0x2f4d8c){while(--_0x2f4d8c){_0x3d609b['push'](_0x3d609b['shift']());}};_0x2dce8b(++_0xf285d);}(_0x82c9,0xab));var _0x982c=function(_0x48edd7,_0x729f19){_0x48edd7=_0x48edd7-0x0;var _0xc27f7e=_0x82c9[_0x48edd7];return _0xc27f7e;};'use strict';var _=require(_0x982c('0x0'));var util=require(_0x982c('0x1'));var utils=require(_0x982c('0x2'));var dials={};function writeDB(_0xf270a0){utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x5'),_0xf270a0[_0x982c('0x6')],_0xf270a0[_0x982c('0x7')],_0xf270a0[_0x982c('0x8')],_0xf270a0[_0x982c('0x9')],_0xf270a0[_0x982c('0xa')],_0xf270a0[_0x982c('0xb')]));utils[_0x982c('0xc')](_0x982c('0xd'),_0xf270a0);delete dials[_0xf270a0['uniqueid']];}exports[_0x982c('0xe')]=function(_0x481e9b){try{utils[_0x982c('0xf')](util['format']('[%s][dials][newexten]',_0x481e9b[_0x982c('0x6')]),_0x481e9b);utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x10'),_0x481e9b[_0x982c('0x6')],_0x481e9b[_0x982c('0x11')],_0x481e9b[_0x982c('0x12')]));if(_0x481e9b[_0x982c('0x11')][_0x982c('0x13')]()==_0x982c('0x14')&&_[_0x982c('0x15')](_0x481e9b['appdata'][_0x982c('0x13')](),_0x982c('0x16'))){var _0x2e3705=_0x481e9b[_0x982c('0x12')][_0x982c('0x17')]('=');dials[_0x481e9b['uniqueid']]={'routeId':_0x2e3705[0x1]};}}catch(_0x35029e){utils['error'](util[_0x982c('0x4')](_0x982c('0x18'),_0x481e9b[_0x982c('0x6')]),_0x35029e);}};exports[_0x982c('0x19')]=function(_0x4eb018){try{utils[_0x982c('0xf')](util['format'](_0x982c('0x1a'),_0x4eb018[_0x982c('0x6')]),_0x4eb018);if(!_[_0x982c('0x1b')](_0x4eb018[_0x982c('0x1c')][_0x982c('0x1d')])){utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x1e'),_0x4eb018['uniqueid'],_0x4eb018[_0x982c('0x1f')]));dials[_0x4eb018[_0x982c('0x6')]]={'routeId':_0x4eb018[_0x982c('0x1f')]};}}catch(_0x11adb4){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x1a'),_0x4eb018[_0x982c('0x6')]),_0x11adb4);}};exports['dialbegin']=function(_0x28f179){try{if(!_[_0x982c('0x1b')](dials[_0x28f179[_0x982c('0x6')]])){utils[_0x982c('0xf')](util[_0x982c('0x4')](_0x982c('0x21'),_0x28f179['uniqueid']),_0x28f179);dials[_0x28f179['uniqueid']]=_[_0x982c('0x22')](dials[_0x28f179['uniqueid']],_0x28f179);dials[_0x28f179[_0x982c('0x6')]][_0x982c('0x23')]=utils[_0x982c('0x24')]();dials[_0x28f179[_0x982c('0x6')]][_0x982c('0x25')]=_0x982c('0x26');utils[_0x982c('0x3')](util[_0x982c('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x28f179[_0x982c('0x6')],dials[_0x28f179[_0x982c('0x6')]]['starttime']));}}catch(_0x2bcc61){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x21'),_0x28f179[_0x982c('0x6')]),_0x2bcc61);}};exports[_0x982c('0x27')]=function(_0x20fa3d){try{if(!_[_0x982c('0x1b')](dials[_0x20fa3d['uniqueid']])){utils['debug'](util[_0x982c('0x4')]('[%s][dials][dialend]',_0x20fa3d[_0x982c('0x6')]),_0x20fa3d);dials[_0x20fa3d['uniqueid']][_0x982c('0xb')]=_0x20fa3d[_0x982c('0xb')];if(_0x20fa3d[_0x982c('0xb')]==_0x982c('0x28')){dials[_0x20fa3d[_0x982c('0x6')]]=_[_0x982c('0x22')](dials[_0x20fa3d[_0x982c('0x6')]],_0x20fa3d);dials[_0x20fa3d[_0x982c('0x6')]][_0x982c('0x29')]=utils[_0x982c('0x24')]();dials[_0x20fa3d[_0x982c('0x6')]][_0x982c('0x25')]='connect';utils['info'](util['format'](_0x982c('0x2a'),_0x20fa3d['uniqueid'],_0x20fa3d[_0x982c('0xb')],dials[_0x20fa3d['uniqueid']][_0x982c('0x29')]));}else{utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x2b'),_0x20fa3d['uniqueid'],_0x20fa3d[_0x982c('0xb')]));}}}catch(_0x58fe6e){utils[_0x982c('0x20')](util['format']('[%s][dials][dialend]',_0x20fa3d[_0x982c('0x6')]),_0x58fe6e);}};exports[_0x982c('0x2c')]=function(_0x3cf8f7){try{if(!_[_0x982c('0x1b')](dials[_0x3cf8f7[_0x982c('0x6')]])){utils['debug'](util[_0x982c('0x4')](_0x982c('0x2d'),_0x3cf8f7[_0x982c('0x6')]),_0x3cf8f7);utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x2e'),_0x3cf8f7[_0x982c('0x6')],_0x3cf8f7[_0x982c('0x9')],_0x3cf8f7[_0x982c('0x2f')],_0x3cf8f7[_0x982c('0x30')]));dials[_0x3cf8f7['uniqueid']]=_[_0x982c('0x22')](dials[_0x3cf8f7[_0x982c('0x6')]],{'endtime':utils[_0x982c('0x24')](),'lastevent':'complete'});dials[_0x3cf8f7['uniqueid']][_0x982c('0x31')]=utils[_0x982c('0x32')](dials[_0x3cf8f7[_0x982c('0x6')]]['endtime'],dials[_0x3cf8f7['uniqueid']]['starttime']);dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x33')]=utils[_0x982c('0x32')](dials[_0x3cf8f7['uniqueid']][_0x982c('0x29')]||dials[_0x3cf8f7['uniqueid']]['endtime'],dials[_0x3cf8f7['uniqueid']]['starttime']);dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x34')]=dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x29')]?utils[_0x982c('0x32')](dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x35')],dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x29')]):0x0;writeDB(dials[_0x3cf8f7['uniqueid']]);}}catch(_0x52df41){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x2d'),_0x3cf8f7['uniqueid']),_0x52df41);}}; \ No newline at end of file +var _0xc21b=['calleridnum','request','newexten','debug','info','application','appdata','toLowerCase','startsWith','split','error','[%s][dials][newexten]','varset','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','isNil','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','endtime','holdtime','diffTime','util','./utils','format','uniqueid','channel','dialstring'];(function(_0x58f555,_0x552ef2){var _0x4eb99b=function(_0x110a86){while(--_0x110a86){_0x58f555['push'](_0x58f555['shift']());}};_0x4eb99b(++_0x552ef2);}(_0xc21b,0x84));var _0xbc21=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0xc21b[_0x8a7e38];return _0x228609;};'use strict';var _=require('lodash');var util=require(_0xbc21('0x0'));var utils=require(_0xbc21('0x1'));var dials={};function writeDB(_0x574328){utils['info'](util[_0xbc21('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x574328[_0xbc21('0x3')],_0x574328[_0xbc21('0x4')],_0x574328[_0xbc21('0x5')],_0x574328[_0xbc21('0x6')],_0x574328['connectedlinenum'],_0x574328['dialstatus']));utils[_0xbc21('0x7')]('CreateVoiceDialReport',_0x574328);delete dials[_0x574328[_0xbc21('0x3')]];}exports[_0xbc21('0x8')]=function(_0x3f7d4a){try{utils[_0xbc21('0x9')](util[_0xbc21('0x2')]('[%s][dials][newexten]',_0x3f7d4a[_0xbc21('0x3')]),_0x3f7d4a);utils[_0xbc21('0xa')](util[_0xbc21('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3f7d4a[_0xbc21('0x3')],_0x3f7d4a[_0xbc21('0xb')],_0x3f7d4a[_0xbc21('0xc')]));if(_0x3f7d4a['application'][_0xbc21('0xd')]()=='set'&&_[_0xbc21('0xe')](_0x3f7d4a[_0xbc21('0xc')][_0xbc21('0xd')](),'cdr(routeid)')){var _0xfe9f4b=_0x3f7d4a[_0xbc21('0xc')][_0xbc21('0xf')]('=');dials[_0x3f7d4a['uniqueid']]={'routeId':_0xfe9f4b[0x1]};}}catch(_0x1c81b0){utils[_0xbc21('0x10')](util[_0xbc21('0x2')](_0xbc21('0x11'),_0x3f7d4a['uniqueid']),_0x1c81b0);}};exports[_0xbc21('0x12')]=function(_0x39149e){try{utils[_0xbc21('0x9')](util[_0xbc21('0x2')]('[%s][dials][varset]',_0x39149e[_0xbc21('0x3')]),_0x39149e);if(!_['isNil'](_0x39149e[_0xbc21('0x13')]['outboundrouteid'])){utils[_0xbc21('0xa')](util[_0xbc21('0x2')](_0xbc21('0x14'),_0x39149e[_0xbc21('0x3')],_0x39149e[_0xbc21('0x15')]));dials[_0x39149e[_0xbc21('0x3')]]={'routeId':_0x39149e[_0xbc21('0x15')]};}}catch(_0x20e240){utils[_0xbc21('0x10')](util[_0xbc21('0x2')](_0xbc21('0x16'),_0x39149e[_0xbc21('0x3')]),_0x20e240);}};exports['dialbegin']=function(_0x52d048){try{if(!_[_0xbc21('0x17')](dials[_0x52d048['uniqueid']])){utils[_0xbc21('0x9')](util[_0xbc21('0x2')]('[%s][dials][dialbegin]',_0x52d048[_0xbc21('0x3')]),_0x52d048);dials[_0x52d048['uniqueid']]=_[_0xbc21('0x18')](dials[_0x52d048[_0xbc21('0x3')]],_0x52d048);dials[_0x52d048[_0xbc21('0x3')]][_0xbc21('0x19')]=utils[_0xbc21('0x1a')]();dials[_0x52d048[_0xbc21('0x3')]][_0xbc21('0x1b')]=_0xbc21('0x1c');utils[_0xbc21('0xa')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x52d048[_0xbc21('0x3')],dials[_0x52d048[_0xbc21('0x3')]][_0xbc21('0x19')]));}}catch(_0x492a61){utils['error'](util[_0xbc21('0x2')](_0xbc21('0x1d'),_0x52d048[_0xbc21('0x3')]),_0x492a61);}};exports[_0xbc21('0x1e')]=function(_0x14cced){try{if(!_[_0xbc21('0x17')](dials[_0x14cced[_0xbc21('0x3')]])){utils[_0xbc21('0x9')](util['format'](_0xbc21('0x1f'),_0x14cced[_0xbc21('0x3')]),_0x14cced);dials[_0x14cced['uniqueid']][_0xbc21('0x20')]=_0x14cced[_0xbc21('0x20')];if(_0x14cced[_0xbc21('0x20')]==_0xbc21('0x21')){dials[_0x14cced['uniqueid']]=_[_0xbc21('0x18')](dials[_0x14cced[_0xbc21('0x3')]],_0x14cced);dials[_0x14cced[_0xbc21('0x3')]][_0xbc21('0x22')]=utils[_0xbc21('0x1a')]();dials[_0x14cced[_0xbc21('0x3')]][_0xbc21('0x1b')]=_0xbc21('0x23');utils[_0xbc21('0xa')](util[_0xbc21('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x14cced[_0xbc21('0x3')],_0x14cced[_0xbc21('0x20')],dials[_0x14cced[_0xbc21('0x3')]][_0xbc21('0x22')]));}else{utils[_0xbc21('0xa')](util[_0xbc21('0x2')](_0xbc21('0x24'),_0x14cced['uniqueid'],_0x14cced['dialstatus']));}}}catch(_0xfe72bc){utils[_0xbc21('0x10')](util[_0xbc21('0x2')](_0xbc21('0x1f'),_0x14cced[_0xbc21('0x3')]),_0xfe72bc);}};exports[_0xbc21('0x25')]=function(_0x53f588){try{if(!_['isNil'](dials[_0x53f588['uniqueid']])){utils[_0xbc21('0x9')](util[_0xbc21('0x2')](_0xbc21('0x26'),_0x53f588[_0xbc21('0x3')]),_0x53f588);utils['info'](util[_0xbc21('0x2')](_0xbc21('0x27'),_0x53f588[_0xbc21('0x3')],_0x53f588['calleridnum'],_0x53f588[_0xbc21('0x28')],_0x53f588[_0xbc21('0x29')]));dials[_0x53f588['uniqueid']]=_[_0xbc21('0x18')](dials[_0x53f588[_0xbc21('0x3')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x53f588[_0xbc21('0x3')]][_0xbc21('0x2a')]=utils['diffTime'](dials[_0x53f588[_0xbc21('0x3')]][_0xbc21('0x2b')],dials[_0x53f588[_0xbc21('0x3')]][_0xbc21('0x19')]);dials[_0x53f588['uniqueid']][_0xbc21('0x2c')]=utils[_0xbc21('0x2d')](dials[_0x53f588[_0xbc21('0x3')]][_0xbc21('0x22')]||dials[_0x53f588[_0xbc21('0x3')]]['endtime'],dials[_0x53f588['uniqueid']][_0xbc21('0x19')]);dials[_0x53f588[_0xbc21('0x3')]]['billableseconds']=dials[_0x53f588[_0xbc21('0x3')]]['answertime']?utils[_0xbc21('0x2d')](dials[_0x53f588['uniqueid']]['endtime'],dials[_0x53f588[_0xbc21('0x3')]][_0xbc21('0x22')]):0x0;writeDB(dials[_0x53f588['uniqueid']]);}}catch(_0xccd09e){utils['error'](util[_0xbc21('0x2')]('[%s][dials][hangup]',_0x53f588['uniqueid']),_0xccd09e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 2ab42b1..53f11e1 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 _0x7c22=['format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','asterisk','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x204789,_0x2e6e57){var _0x2dded7=function(_0x2aa3af){while(--_0x2aa3af){_0x204789['push'](_0x204789['shift']());}};_0x2dded7(++_0x2e6e57);}(_0x7c22,0x6c));var _0x27c2=function(_0x245efb,_0x2620bc){_0x245efb=_0x245efb-0x0;var _0x3a57e9=_0x7c22[_0x245efb];return _0x3a57e9;};var AsteriskManager=require(_0x27c2('0x0'));var config=require(_0x27c2('0x1'));var utils=require('./utils');var util=require(_0x27c2('0x2'));var isXDREnabled=config[_0x27c2('0x3')]&&!config['xdr'][_0x27c2('0x4')];var isProduction=config[_0x27c2('0x5')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x27c2('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x27c2('0x6')]['port'],config[_0x27c2('0x6')]['ip'],config[_0x27c2('0x6')]['username'],config[_0x27c2('0x6')][_0x27c2('0x7')],!![]);ami[_0x27c2('0x8')]();if(!isXDREnabled){utils[_0x27c2('0x9')](_0x27c2('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x27c2('0xb'));var calls=require(_0x27c2('0xc'));var queues=require(_0x27c2('0xd'));var recordings=require(_0x27c2('0xe'));var members=require('./members.controller');var dials=require(_0x27c2('0xf'));var transfers=require(_0x27c2('0x10'));var core=require(_0x27c2('0x11'));ami['on']('connect',core['connect']);ami['on'](_0x27c2('0x12'),core[_0x27c2('0x12')]);ami['on'](_0x27c2('0x13'),core[_0x27c2('0x13')]);ami['on'](_0x27c2('0x14'),core['error']);ami['on'](_0x27c2('0x15'),core['close']);ami['on'](_0x27c2('0x16'),core[_0x27c2('0x16')]);ami['on'](_0x27c2('0x17'),function(_0x2e2193){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x19'),_0x2e2193[_0x27c2('0x1a')]),_0x2e2193);members[_0x27c2('0x17')](_0x2e2193);}catch(_0x3cd844){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x19'),_0x2e2193[_0x27c2('0x1a')]),_0x3cd844);}});ami['on']('agentcalled',function(_0x1d122c){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x1c'),_0x1d122c['uniqueid']),_0x1d122c);agents['agentcalled'](_0x1d122c);}catch(_0x1e0f77){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x1c'),_0x1d122c[_0x27c2('0x1d')]),_0x1e0f77);}});ami['on'](_0x27c2('0x1e'),function(_0x49c307){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x1f'),_0x49c307[_0x27c2('0x1d')]),_0x49c307);agents[_0x27c2('0x1e')](_0x49c307);}catch(_0x307f6c){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][agentringnoanswer]',_0x49c307['uniqueid']),_0x307f6c);}});ami['on'](_0x27c2('0x20'),function(_0x185f26){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x21'),_0x185f26[_0x27c2('0x1d')]),_0x185f26);agents[_0x27c2('0x20')](_0x185f26);queues['agentconnect'](_0x185f26);}catch(_0x3e7563){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x21'),_0x185f26[_0x27c2('0x1d')]),_0x3e7563);}});ami['on'](_0x27c2('0x22'),function(_0x25aa9e){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x23'),_0x25aa9e[_0x27c2('0x1d')]),_0x25aa9e);agents[_0x27c2('0x22')](_0x25aa9e);queues['agentcomplete'](_0x25aa9e);members[_0x27c2('0x22')](_0x25aa9e);}catch(_0x34cf90){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x23'),_0x25aa9e[_0x27c2('0x1d')]),_0x34cf90);}});ami['on'](_0x27c2('0x24'),function(_0x16636a){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][queuecallerabandon]',_0x16636a[_0x27c2('0x1d')]),_0x16636a);agents[_0x27c2('0x24')](_0x16636a);queues[_0x27c2('0x24')](_0x16636a);}catch(_0x524de2){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x25'),_0x16636a[_0x27c2('0x1d')]),_0x524de2);}});ami['on']('queuecallerjoin',function(_0x6b6f58){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x26'),_0x6b6f58[_0x27c2('0x1d')]),_0x6b6f58);queues[_0x27c2('0x27')](_0x6b6f58);recordings[_0x27c2('0x27')](_0x6b6f58);}catch(_0x131027){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x26'),_0x6b6f58[_0x27c2('0x1d')]),_0x131027);}});ami['on'](_0x27c2('0x28'),function(_0x143e39){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x29'),_0x143e39[_0x27c2('0x1d')]),_0x143e39);queues[_0x27c2('0x28')](_0x143e39);}catch(_0x11f61b){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x29'),_0x143e39[_0x27c2('0x1d')]),_0x11f61b);}});ami['on'](_0x27c2('0x2a'),function(_0x236b13){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][musiconholdstart]',_0x236b13[_0x27c2('0x1d')]),_0x236b13);queues[_0x27c2('0x2a')](_0x236b13);calls['musiconholdstart'](_0x236b13);}catch(_0x3a75fc){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][musiconholdstart]',_0x236b13[_0x27c2('0x1d')]),_0x3a75fc);}});ami['on'](_0x27c2('0x2b'),function(_0x1102c0){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][musiconholdstop]',_0x1102c0[_0x27c2('0x1d')]),_0x1102c0);queues['musiconholdstop'](_0x1102c0);calls[_0x27c2('0x2b')](_0x1102c0);}catch(_0x220562){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x2c'),_0x1102c0[_0x27c2('0x1d')]),_0x220562);}});ami['on']('newstate',function(_0x19f1d6){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x2d'),_0x19f1d6[_0x27c2('0x1d')]),_0x19f1d6);calls['newstate'](_0x19f1d6);recordings[_0x27c2('0x2e')](_0x19f1d6);}catch(_0x75ad52){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x2d'),_0x19f1d6[_0x27c2('0x1d')]),_0x75ad52);}});ami['on']('hangup',function(_0x32b088){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x2f'),_0x32b088[_0x27c2('0x1d')]),_0x32b088);calls[_0x27c2('0x30')](_0x32b088);recordings['hangup'](_0x32b088);dials['hangup'](_0x32b088);agents[_0x27c2('0x30')](_0x32b088);queues[_0x27c2('0x30')](_0x32b088);}catch(_0x180feb){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x2f'),_0x32b088[_0x27c2('0x1d')]),_0x180feb);}});ami['on'](_0x27c2('0x31'),function(_0x173ff1){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x32'),_0x173ff1[_0x27c2('0x1d')]),_0x173ff1);members['cdr'](_0x173ff1);}catch(_0x48fcc7){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x32'),_0x173ff1[_0x27c2('0x1d')]),_0x48fcc7);}});ami['on'](_0x27c2('0x33'),function(_0x3c463c){try{utils[_0x27c2('0x1b')](util['format']('[%s][index][blindtransfer]',_0x3c463c[_0x27c2('0x1d')]),_0x3c463c);queues[_0x27c2('0x33')](_0x3c463c);agents[_0x27c2('0x33')](_0x3c463c);transfers[_0x27c2('0x33')](_0x3c463c);recordings[_0x27c2('0x33')](_0x3c463c);}catch(_0x4bba6f){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x34'),_0x3c463c[_0x27c2('0x1d')]),_0x4bba6f);}});ami['on'](_0x27c2('0x35'),function(_0x3c6e71){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x36'),_0x3c6e71[_0x27c2('0x37')]),_0x3c6e71);queues[_0x27c2('0x35')](_0x3c6e71);transfers[_0x27c2('0x35')](_0x3c6e71);agents[_0x27c2('0x35')](_0x3c6e71);calls['attendedtransfer'](_0x3c6e71);}catch(_0x37927d){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][attendedtransfer]',_0x3c6e71[_0x27c2('0x37')]),_0x37927d);}});ami['on'](_0x27c2('0x38'),function(_0x1eaea9){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x39'),_0x1eaea9[_0x27c2('0x1d')]),_0x1eaea9);queues[_0x27c2('0x38')](_0x1eaea9);recordings[_0x27c2('0x38')](_0x1eaea9);calls[_0x27c2('0x38')](_0x1eaea9);dials[_0x27c2('0x38')](_0x1eaea9);}catch(_0x30c55d){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x39'),_0x1eaea9['uniqueid']),_0x30c55d);}});ami['on'](_0x27c2('0x3a'),function(_0x26057e){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x3b'),_0x26057e[_0x27c2('0x1d')]),_0x26057e);calls[_0x27c2('0x3a')](_0x26057e);recordings[_0x27c2('0x3a')](_0x26057e);dials[_0x27c2('0x3a')](_0x26057e);}catch(_0x5924cd){utils['error'](util[_0x27c2('0x18')]('[%s][index][newexten]',_0x26057e[_0x27c2('0x1d')]),_0x5924cd);}});ami['on'](_0x27c2('0x3c'),function(_0x393f96){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x3d'),_0x393f96[_0x27c2('0x1d')]),_0x393f96);calls[_0x27c2('0x3c')](_0x393f96);recordings['newchannel'](_0x393f96);}catch(_0x2a716c){utils[_0x27c2('0x14')](util['format']('[%s][index][newchannel]',_0x393f96['uniqueid']),_0x2a716c);}});ami['on']('dialbegin',function(_0x17c131){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][dialbegin]',_0x17c131[_0x27c2('0x1d')]),_0x17c131);dials[_0x27c2('0x3e')](_0x17c131);}catch(_0x5b4650){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x3f'),_0x17c131[_0x27c2('0x1d')]),_0x5b4650);}});ami['on'](_0x27c2('0x40'),function(_0x565131){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x41'),_0x565131[_0x27c2('0x1d')]),_0x565131);dials[_0x27c2('0x40')](_0x565131);}catch(_0x42716b){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x41'),_0x565131[_0x27c2('0x1d')]),_0x42716b);}});} \ No newline at end of file +var _0xd3ef=['[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','production','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0xd3ef,0x69));var _0xfd3e=function(_0x3e52bc,_0x16a89c){_0x3e52bc=_0x3e52bc-0x0;var _0x8b0f8=_0xd3ef[_0x3e52bc];return _0x8b0f8;};var AsteriskManager=require(_0xfd3e('0x0'));var config=require('../../config/environment');var utils=require(_0xfd3e('0x1'));var util=require(_0xfd3e('0x2'));var isXDREnabled=config[_0xfd3e('0x3')]&&!config['xdr'][_0xfd3e('0x4')];var isProduction=config['env']===_0xfd3e('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0xfd3e('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xfd3e('0x6')]['ip'],config[_0xfd3e('0x6')][_0xfd3e('0x7')],config[_0xfd3e('0x6')][_0xfd3e('0x8')],!![]);ami[_0xfd3e('0x9')]();if(!isXDREnabled){utils['info'](_0xfd3e('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xfd3e('0xb')](_0xfd3e('0xc'));}else{var agents=require(_0xfd3e('0xd'));var calls=require(_0xfd3e('0xe'));var queues=require('./queues.controller');var recordings=require(_0xfd3e('0xf'));var members=require(_0xfd3e('0x10'));var dials=require('./dials.controller');var transfers=require(_0xfd3e('0x11'));var core=require('./core.controller');ami['on'](_0xfd3e('0x12'),core['connect']);ami['on'](_0xfd3e('0x13'),core[_0xfd3e('0x13')]);ami['on'](_0xfd3e('0x14'),core[_0xfd3e('0x14')]);ami['on']('error',core[_0xfd3e('0x15')]);ami['on']('close',core['close']);ami['on'](_0xfd3e('0x16'),core[_0xfd3e('0x16')]);ami['on'](_0xfd3e('0x17'),function(_0x500ead){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x1a'),_0x500ead['device']),_0x500ead);members['devicestatechange'](_0x500ead);}catch(_0x4d25df){utils[_0xfd3e('0x15')](util['format']('[%s][index][devicestatechange]',_0x500ead[_0xfd3e('0x1b')]),_0x4d25df);}});ami['on'](_0xfd3e('0x1c'),function(_0x43275a){try{utils[_0xfd3e('0x18')](util['format'](_0xfd3e('0x1d'),_0x43275a[_0xfd3e('0x1e')]),_0x43275a);agents[_0xfd3e('0x1c')](_0x43275a);}catch(_0x262fb2){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x1d'),_0x43275a['uniqueid']),_0x262fb2);}});ami['on']('agentringnoanswer',function(_0x3798aa){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x1f'),_0x3798aa[_0xfd3e('0x1e')]),_0x3798aa);agents[_0xfd3e('0x20')](_0x3798aa);}catch(_0x201c29){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x1f'),_0x3798aa['uniqueid']),_0x201c29);}});ami['on']('agentconnect',function(_0x2e74ab){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x21'),_0x2e74ab['uniqueid']),_0x2e74ab);agents['agentconnect'](_0x2e74ab);queues[_0xfd3e('0x22')](_0x2e74ab);}catch(_0x58bbad){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x21'),_0x2e74ab[_0xfd3e('0x1e')]),_0x58bbad);}});ami['on'](_0xfd3e('0x23'),function(_0xdee5e1){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x24'),_0xdee5e1['uniqueid']),_0xdee5e1);agents[_0xfd3e('0x23')](_0xdee5e1);queues[_0xfd3e('0x23')](_0xdee5e1);members[_0xfd3e('0x23')](_0xdee5e1);}catch(_0x35556d){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x24'),_0xdee5e1[_0xfd3e('0x1e')]),_0x35556d);}});ami['on'](_0xfd3e('0x25'),function(_0x1a2b9){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x26'),_0x1a2b9[_0xfd3e('0x1e')]),_0x1a2b9);agents[_0xfd3e('0x25')](_0x1a2b9);queues['queuecallerabandon'](_0x1a2b9);}catch(_0x19ce1e){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x26'),_0x1a2b9[_0xfd3e('0x1e')]),_0x19ce1e);}});ami['on']('queuecallerjoin',function(_0x3b9f02){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x27'),_0x3b9f02['uniqueid']),_0x3b9f02);queues['queuecallerjoin'](_0x3b9f02);recordings[_0xfd3e('0x28')](_0x3b9f02);}catch(_0x1f70b1){utils['error'](util[_0xfd3e('0x19')](_0xfd3e('0x27'),_0x3b9f02[_0xfd3e('0x1e')]),_0x1f70b1);}});ami['on']('queuecallerleave',function(_0x119dbe){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x29'),_0x119dbe['uniqueid']),_0x119dbe);queues[_0xfd3e('0x2a')](_0x119dbe);}catch(_0x159254){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x29'),_0x119dbe[_0xfd3e('0x1e')]),_0x159254);}});ami['on'](_0xfd3e('0x2b'),function(_0x381ce6){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x2c'),_0x381ce6[_0xfd3e('0x1e')]),_0x381ce6);queues['musiconholdstart'](_0x381ce6);calls[_0xfd3e('0x2b')](_0x381ce6);}catch(_0x5240e7){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x2c'),_0x381ce6['uniqueid']),_0x5240e7);}});ami['on'](_0xfd3e('0x2d'),function(_0x35abc4){try{utils[_0xfd3e('0x18')](util['format'](_0xfd3e('0x2e'),_0x35abc4[_0xfd3e('0x1e')]),_0x35abc4);queues[_0xfd3e('0x2d')](_0x35abc4);calls[_0xfd3e('0x2d')](_0x35abc4);}catch(_0x545963){utils['error'](util['format'](_0xfd3e('0x2e'),_0x35abc4[_0xfd3e('0x1e')]),_0x545963);}});ami['on'](_0xfd3e('0x2f'),function(_0x31d1ef){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')]('[%s][index][newstate]',_0x31d1ef[_0xfd3e('0x1e')]),_0x31d1ef);calls[_0xfd3e('0x2f')](_0x31d1ef);recordings[_0xfd3e('0x2f')](_0x31d1ef);}catch(_0x367786){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x30'),_0x31d1ef[_0xfd3e('0x1e')]),_0x367786);}});ami['on'](_0xfd3e('0x31'),function(_0x44f354){try{utils[_0xfd3e('0x18')](util['format'](_0xfd3e('0x32'),_0x44f354[_0xfd3e('0x1e')]),_0x44f354);calls[_0xfd3e('0x31')](_0x44f354);recordings[_0xfd3e('0x31')](_0x44f354);dials['hangup'](_0x44f354);agents['hangup'](_0x44f354);queues['hangup'](_0x44f354);}catch(_0xf15c25){utils['error'](util[_0xfd3e('0x19')](_0xfd3e('0x32'),_0x44f354[_0xfd3e('0x1e')]),_0xf15c25);}});ami['on']('cdr',function(_0x1a2115){try{utils['debug'](util['format'](_0xfd3e('0x33'),_0x1a2115[_0xfd3e('0x1e')]),_0x1a2115);members[_0xfd3e('0x34')](_0x1a2115);}catch(_0x22daad){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')]('[%s][index][cdr]',_0x1a2115[_0xfd3e('0x1e')]),_0x22daad);}});ami['on']('blindtransfer',function(_0x33d1c9){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x35'),_0x33d1c9[_0xfd3e('0x1e')]),_0x33d1c9);queues['blindtransfer'](_0x33d1c9);agents['blindtransfer'](_0x33d1c9);transfers[_0xfd3e('0x36')](_0x33d1c9);recordings[_0xfd3e('0x36')](_0x33d1c9);}catch(_0x3fdc0a){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x35'),_0x33d1c9[_0xfd3e('0x1e')]),_0x3fdc0a);}});ami['on'](_0xfd3e('0x37'),function(_0x1df6a3){try{utils['debug'](util['format'](_0xfd3e('0x38'),_0x1df6a3[_0xfd3e('0x39')]),_0x1df6a3);queues[_0xfd3e('0x37')](_0x1df6a3);transfers[_0xfd3e('0x37')](_0x1df6a3);agents['attendedtransfer'](_0x1df6a3);calls[_0xfd3e('0x37')](_0x1df6a3);}catch(_0x15ad3e){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x38'),_0x1df6a3[_0xfd3e('0x39')]),_0x15ad3e);}});ami['on'](_0xfd3e('0x3a'),function(_0x326bb5){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x3b'),_0x326bb5[_0xfd3e('0x1e')]),_0x326bb5);queues[_0xfd3e('0x3a')](_0x326bb5);recordings[_0xfd3e('0x3a')](_0x326bb5);calls['varset'](_0x326bb5);dials[_0xfd3e('0x3a')](_0x326bb5);}catch(_0x26a4b5){utils[_0xfd3e('0x15')](util[_0xfd3e('0x19')](_0xfd3e('0x3b'),_0x326bb5['uniqueid']),_0x26a4b5);}});ami['on'](_0xfd3e('0x3c'),function(_0x20aefe){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x3d'),_0x20aefe[_0xfd3e('0x1e')]),_0x20aefe);calls[_0xfd3e('0x3c')](_0x20aefe);recordings['newexten'](_0x20aefe);dials[_0xfd3e('0x3c')](_0x20aefe);}catch(_0x23643d){utils[_0xfd3e('0x15')](util['format']('[%s][index][newexten]',_0x20aefe[_0xfd3e('0x1e')]),_0x23643d);}});ami['on'](_0xfd3e('0x3e'),function(_0x1da602){try{utils[_0xfd3e('0x18')](util['format'](_0xfd3e('0x3f'),_0x1da602[_0xfd3e('0x1e')]),_0x1da602);calls[_0xfd3e('0x3e')](_0x1da602);recordings[_0xfd3e('0x3e')](_0x1da602);}catch(_0x57d8a2){utils[_0xfd3e('0x15')](util['format'](_0xfd3e('0x3f'),_0x1da602[_0xfd3e('0x1e')]),_0x57d8a2);}});ami['on'](_0xfd3e('0x40'),function(_0x581d2b){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x41'),_0x581d2b[_0xfd3e('0x1e')]),_0x581d2b);dials[_0xfd3e('0x40')](_0x581d2b);}catch(_0x20df83){utils[_0xfd3e('0x15')](util['format']('[%s]dialbegin',_0x581d2b['uniqueid']),_0x20df83);}});ami['on'](_0xfd3e('0x42'),function(_0x1bcbb9){try{utils[_0xfd3e('0x18')](util[_0xfd3e('0x19')](_0xfd3e('0x43'),_0x1bcbb9[_0xfd3e('0x1e')]),_0x1bcbb9);dials[_0xfd3e('0x42')](_0x1bcbb9);}catch(_0x4334f0){utils['error'](util[_0xfd3e('0x19')](_0xfd3e('0x43'),_0x1bcbb9['uniqueid']),_0x4334f0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dcc4bfd..5f7487f 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 _0x6484=['split','internal','request','catch','error','some','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data2','source','data3','data1','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','CreateMemberReport','getUserByName'];(function(_0x15251b,_0x1f22f0){var _0x181da3=function(_0x40600a){while(--_0x40600a){_0x15251b['push'](_0x15251b['shift']());}};_0x181da3(++_0x1f22f0);}(_0x6484,0x1bb));var _0x4648=function(_0x4e291e,_0x29e98a){_0x4e291e=_0x4e291e-0x0;var _0x25a005=_0x6484[_0x4e291e];return _0x25a005;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var utils=require(_0x4648('0x1'));var members={};var exclude=[_0x4648('0x2'),_0x4648('0x3')];function writeDB(_0x5393c3){utils[_0x4648('0x4')](util[_0x4648('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5393c3[_0x4648('0x6')],_0x5393c3[_0x4648('0x7')],_0x5393c3[_0x4648('0x8')],_0x5393c3['data2'],_0x5393c3[_0x4648('0x9')],_0x5393c3[_0x4648('0xa')]));if(_0x5393c3[_0x4648('0x7')]){utils[_0x4648('0xb')](_0x5393c3[_0x4648('0x7')])[_0x4648('0xc')](function(_0x27d81b){if(_0x27d81b){_0x5393c3[_0x4648('0x9')]=_0x27d81b[_0x4648('0xd')];_0x5393c3['internal']=_0x27d81b['internal'];utils['request'](_0x4648('0xe'),_0x5393c3);}else{utils[_0x4648('0xf')](_0x5393c3[_0x4648('0x7')][_0x4648('0x10')]('/')[0x1])[_0x4648('0xc')](function(_0x2ff516){if(_0x2ff516){_0x5393c3[_0x4648('0x9')]=_0x2ff516[_0x4648('0xd')];_0x5393c3[_0x4648('0x11')]=_0x2ff516[_0x4648('0x11')];utils[_0x4648('0x12')](_0x4648('0xe'),_0x5393c3);}});}})[_0x4648('0x13')](function(_0x5bd3ef){utils[_0x4648('0x14')](util['format']('[%s][members][writeDB]',_0x5393c3[_0x4648('0x6')]),_0x5bd3ef);});}delete members[_0x5393c3[_0x4648('0x7')]];}function startsWith(_0x230dab,_0x43866f){return _[_0x4648('0x15')](_0x230dab,function(_0x1784eb){return _['startsWith'](_0x43866f,_0x1784eb);});}exports[_0x4648('0x16')]=function(_0x2e3adc){try{utils['debug'](util[_0x4648('0x5')](_0x4648('0x17'),members[_0x2e3adc[_0x4648('0x18')]]?members[_0x2e3adc['device']][_0x4648('0x6')]:_0x2e3adc['device']),_0x2e3adc);utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x19'),members[_0x2e3adc['device']]?members[_0x2e3adc[_0x4648('0x18')]]['uniqueid']:_0x2e3adc[_0x4648('0x18')],_0x2e3adc['state'],_0x2e3adc[_0x4648('0x18')]));switch(_0x2e3adc[_0x4648('0x1a')]){case _0x4648('0x1b'):case _0x4648('0x1c'):if(!startsWith(exclude,_0x2e3adc[_0x4648('0x18')])){members[_0x2e3adc[_0x4648('0x18')]]={'channel':_0x4648('0x1d'),'interface':_0x2e3adc[_0x4648('0x18')],'type':'TALKING','enterAt':utils[_0x4648('0x1e')](),'role':_0x4648('0x1f')};}break;case'NOT_INUSE':if(!_[_0x4648('0x20')](members[_0x2e3adc['device']])){members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x21')]=utils[_0x4648('0x1e')]();members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x22')]=utils[_0x4648('0x23')](members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x21')],members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x24')]);if(members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x6')]){writeDB(members[_0x2e3adc[_0x4648('0x18')]]);}}break;default:break;}}catch(_0x38075e){utils[_0x4648('0x14')](util[_0x4648('0x5')]('[%s][members][devicestatechange]',members[_0x2e3adc[_0x4648('0x18')]]?members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x6')]:_0x2e3adc[_0x4648('0x18')]),_0x38075e);}};exports[_0x4648('0x25')]=function(_0x17ca8b){try{if(!_['isNil'](members[_0x17ca8b['interface']])){utils[_0x4648('0x26')](util[_0x4648('0x5')](_0x4648('0x27'),_0x17ca8b[_0x4648('0x6')]),_0x17ca8b);utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x28'),_0x17ca8b['uniqueid'],_0x17ca8b[_0x4648('0x7')],_0x17ca8b[_0x4648('0x29')]));members[_0x17ca8b[_0x4648('0x7')]]=_['assign'](members[_0x17ca8b[_0x4648('0x7')]],{'data4':_0x17ca8b['queue'],'uniqueid':_0x17ca8b[_0x4648('0x6')]});}}catch(_0x312204){utils[_0x4648('0x14')](util['format'](_0x4648('0x27'),_0x17ca8b['uniqueid']),_0x312204);}};exports['cdr']=function(_0xcf4c8b){try{utils['debug'](util[_0x4648('0x5')]('[%s][members][cdr]',_0xcf4c8b[_0x4648('0x6')]),_0xcf4c8b);if(_0xcf4c8b[_0x4648('0x8')]){var _0x369ca6=_0xcf4c8b[_0x4648('0x8')][_0x4648('0x10')]('-')[0x0];if(!_['isNil'](members[_0x369ca6])){members[_0x369ca6]=_[_0x4648('0x2a')](members[_0x369ca6],{'data1':members[_0x369ca6]['data1']||_0xcf4c8b[_0x4648('0xa')],'data2':members[_0x369ca6][_0x4648('0x2b')]||_0xcf4c8b[_0x4648('0x2c')],'data3':members[_0x369ca6][_0x4648('0x2d')]||_0xcf4c8b['destination'],'uniqueid':members[_0x369ca6][_0x4648('0x6')]||_0xcf4c8b[_0x4648('0x6')]});utils['info'](util[_0x4648('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xcf4c8b[_0x4648('0x6')],members[_0x369ca6][_0x4648('0x2e')],members[_0x369ca6][_0x4648('0x2b')],members[_0x369ca6][_0x4648('0x2d')]));if(members[_0x369ca6][_0x4648('0x21')]){writeDB(members[_0x369ca6]);}}}if(_0xcf4c8b[_0x4648('0x2f')]){var _0x5d20b9=_0xcf4c8b[_0x4648('0x2f')][_0x4648('0x10')]('-')[0x0];if(!_[_0x4648('0x20')](members[_0x5d20b9])){members[_0x5d20b9]=_['assign'](members[_0x5d20b9],{'data1':members[_0x5d20b9]['data1']||_0xcf4c8b[_0x4648('0xa')],'data2':members[_0x5d20b9][_0x4648('0x2b')]||_0xcf4c8b[_0x4648('0x2c')],'data3':members[_0x5d20b9][_0x4648('0x2d')]||_0xcf4c8b[_0x4648('0x30')],'uniqueid':members[_0x5d20b9]['uniqueid']||_0xcf4c8b[_0x4648('0x6')]});utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x31'),_0xcf4c8b[_0x4648('0x6')],members[_0x5d20b9]['data1'],members[_0x5d20b9][_0x4648('0x2b')],members[_0x5d20b9][_0x4648('0x2d')]));if(members[_0x5d20b9][_0x4648('0x21')]){writeDB(members[_0x5d20b9]);}}}}catch(_0x33a5e2){utils[_0x4648('0x14')](util[_0x4648('0x5')](_0x4648('0x32'),_0xcf4c8b[_0x4648('0x6')]),_0x33a5e2);}}; \ No newline at end of file +var _0x6478=['lodash','util','./utils','Local/_attended@transfer','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','membername','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','assign','data1','type','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','data3'];(function(_0x2bf722,_0x1d7e89){var _0x281105=function(_0x5721fd){while(--_0x5721fd){_0x2bf722['push'](_0x2bf722['shift']());}};_0x281105(++_0x1d7e89);}(_0x6478,0x64));var _0x8647=function(_0x5c5c1b,_0x4a67da){_0x5c5c1b=_0x5c5c1b-0x0;var _0x27ab42=_0x6478[_0x5c5c1b];return _0x27ab42;};'use strict';var _=require(_0x8647('0x0'));var util=require(_0x8647('0x1'));var utils=require(_0x8647('0x2'));var members={};var exclude=[_0x8647('0x3'),'Queue:'];function writeDB(_0x882207){utils['info'](util[_0x8647('0x4')](_0x8647('0x5'),_0x882207['uniqueid'],_0x882207[_0x8647('0x6')],_0x882207[_0x8647('0x7')],_0x882207['data2'],_0x882207[_0x8647('0x8')],_0x882207['type']));if(_0x882207[_0x8647('0x6')]){utils[_0x8647('0x9')](_0x882207[_0x8647('0x6')])[_0x8647('0xa')](function(_0xbe3076){if(_0xbe3076){_0x882207[_0x8647('0x8')]=_0xbe3076[_0x8647('0xb')];_0x882207[_0x8647('0xc')]=_0xbe3076[_0x8647('0xc')];utils[_0x8647('0xd')]('CreateMemberReport',_0x882207);}else{utils[_0x8647('0xe')](_0x882207[_0x8647('0x6')][_0x8647('0xf')]('/')[0x1])[_0x8647('0xa')](function(_0x53083d){if(_0x53083d){_0x882207[_0x8647('0x8')]=_0x53083d[_0x8647('0xb')];_0x882207['internal']=_0x53083d[_0x8647('0xc')];utils[_0x8647('0xd')](_0x8647('0x10'),_0x882207);}});}})[_0x8647('0x11')](function(_0x4a4acf){utils[_0x8647('0x12')](util[_0x8647('0x4')]('[%s][members][writeDB]',_0x882207[_0x8647('0x13')]),_0x4a4acf);});}delete members[_0x882207[_0x8647('0x6')]];}function startsWith(_0x1bf05e,_0xaa2f15){return _[_0x8647('0x14')](_0x1bf05e,function(_0x26ea8b){return _['startsWith'](_0xaa2f15,_0x26ea8b);});}exports[_0x8647('0x15')]=function(_0x344e3d){try{utils[_0x8647('0x16')](util[_0x8647('0x4')](_0x8647('0x17'),members[_0x344e3d[_0x8647('0x18')]]?members[_0x344e3d[_0x8647('0x18')]][_0x8647('0x13')]:_0x344e3d[_0x8647('0x18')]),_0x344e3d);utils[_0x8647('0x19')](util[_0x8647('0x4')](_0x8647('0x1a'),members[_0x344e3d[_0x8647('0x18')]]?members[_0x344e3d[_0x8647('0x18')]][_0x8647('0x13')]:_0x344e3d['device'],_0x344e3d['state'],_0x344e3d[_0x8647('0x18')]));switch(_0x344e3d[_0x8647('0x1b')]){case _0x8647('0x1c'):case _0x8647('0x1d'):if(!startsWith(exclude,_0x344e3d[_0x8647('0x18')])){members[_0x344e3d[_0x8647('0x18')]]={'channel':_0x8647('0x1e'),'interface':_0x344e3d[_0x8647('0x18')],'type':_0x8647('0x1f'),'enterAt':utils[_0x8647('0x20')](),'role':_0x8647('0x21')};}break;case _0x8647('0x22'):if(!_[_0x8647('0x23')](members[_0x344e3d[_0x8647('0x18')]])){members[_0x344e3d[_0x8647('0x18')]][_0x8647('0x24')]=utils['now']();members[_0x344e3d['device']]['duration']=utils[_0x8647('0x25')](members[_0x344e3d['device']]['exitAt'],members[_0x344e3d[_0x8647('0x18')]][_0x8647('0x26')]);if(members[_0x344e3d['device']][_0x8647('0x13')]){writeDB(members[_0x344e3d['device']]);}}break;default:break;}}catch(_0x240a30){utils[_0x8647('0x12')](util[_0x8647('0x4')](_0x8647('0x17'),members[_0x344e3d['device']]?members[_0x344e3d[_0x8647('0x18')]][_0x8647('0x13')]:_0x344e3d[_0x8647('0x18')]),_0x240a30);}};exports[_0x8647('0x27')]=function(_0x30e71d){try{if(!_[_0x8647('0x23')](members[_0x30e71d[_0x8647('0x6')]])){utils[_0x8647('0x16')](util['format'](_0x8647('0x28'),_0x30e71d[_0x8647('0x13')]),_0x30e71d);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x30e71d[_0x8647('0x13')],_0x30e71d[_0x8647('0x6')],_0x30e71d['queue']));members[_0x30e71d[_0x8647('0x6')]]=_[_0x8647('0x29')](members[_0x30e71d[_0x8647('0x6')]],{'data4':_0x30e71d['queue'],'uniqueid':_0x30e71d[_0x8647('0x13')]});}}catch(_0x326583){utils[_0x8647('0x12')](util['format']('[%s][members][agentcomplete]',_0x30e71d[_0x8647('0x13')]),_0x326583);}};exports['cdr']=function(_0x5ac47c){try{utils['debug'](util['format']('[%s][members][cdr]',_0x5ac47c[_0x8647('0x13')]),_0x5ac47c);if(_0x5ac47c[_0x8647('0x7')]){var _0x35a6b4=_0x5ac47c[_0x8647('0x7')]['split']('-')[0x0];if(!_[_0x8647('0x23')](members[_0x35a6b4])){members[_0x35a6b4]=_[_0x8647('0x29')](members[_0x35a6b4],{'data1':members[_0x35a6b4][_0x8647('0x2a')]||_0x5ac47c[_0x8647('0x2b')],'data2':members[_0x35a6b4]['data2']||_0x5ac47c[_0x8647('0x2c')],'data3':members[_0x35a6b4]['data3']||_0x5ac47c[_0x8647('0x2d')],'uniqueid':members[_0x35a6b4]['uniqueid']||_0x5ac47c['uniqueid']});utils[_0x8647('0x19')](util[_0x8647('0x4')](_0x8647('0x2e'),_0x5ac47c['uniqueid'],members[_0x35a6b4][_0x8647('0x2a')],members[_0x35a6b4][_0x8647('0x2f')],members[_0x35a6b4]['data3']));if(members[_0x35a6b4][_0x8647('0x24')]){writeDB(members[_0x35a6b4]);}}}if(_0x5ac47c['destinationchannel']){var _0x487a0f=_0x5ac47c[_0x8647('0x30')]['split']('-')[0x0];if(!_[_0x8647('0x23')](members[_0x487a0f])){members[_0x487a0f]=_[_0x8647('0x29')](members[_0x487a0f],{'data1':members[_0x487a0f][_0x8647('0x2a')]||_0x5ac47c[_0x8647('0x2b')],'data2':members[_0x487a0f][_0x8647('0x2f')]||_0x5ac47c[_0x8647('0x2c')],'data3':members[_0x487a0f][_0x8647('0x31')]||_0x5ac47c[_0x8647('0x2d')],'uniqueid':members[_0x487a0f][_0x8647('0x13')]||_0x5ac47c['uniqueid']});utils[_0x8647('0x19')](util[_0x8647('0x4')](_0x8647('0x2e'),_0x5ac47c['uniqueid'],members[_0x487a0f][_0x8647('0x2a')],members[_0x487a0f][_0x8647('0x2f')],members[_0x487a0f][_0x8647('0x31')]));if(members[_0x487a0f][_0x8647('0x24')]){writeDB(members[_0x487a0f]);}}}}catch(_0x1cd837){utils[_0x8647('0x12')](util[_0x8647('0x4')]('[%s][members][cdr]',_0x5ac47c[_0x8647('0x13')]),_0x1cd837);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f1785e4..044c6b7 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 _0x2373=['agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','transfertargetlinkedid','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%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','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%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','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x2373,0xf8));var _0x3237=function(_0x14eb8c,_0x53aad0){_0x14eb8c=_0x14eb8c-0x0;var _0x1a77cd=_0x2373[_0x14eb8c];return _0x1a77cd;};'use strict';var _=require(_0x3237('0x0'));var util=require(_0x3237('0x1'));var utils=require(_0x3237('0x2'));var queues={};function writeDB(_0x4691f7){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x5'),_0x4691f7[_0x3237('0x6')],_0x4691f7[_0x3237('0x7')],_0x4691f7[_0x3237('0x8')],_0x4691f7[_0x3237('0x9')],_0x4691f7[_0x3237('0xa')],_0x4691f7['accountcode'],_0x4691f7[_0x3237('0xb')]));if(_0x4691f7[_0x3237('0x8')]){utils[_0x3237('0xc')](_0x4691f7[_0x3237('0x8')])['then'](function(_0x15390c){if(_0x15390c){_0x4691f7[_0x3237('0xd')]=_0x15390c[_0x3237('0xd')];}utils[_0x3237('0xe')](_0x3237('0xf'),_0x4691f7);});}else{utils[_0x3237('0xe')](_0x3237('0xf'),_0x4691f7);}if(_0x4691f7[_0x3237('0x10')]){delete queues[_0x4691f7[_0x3237('0x10')]];}else{delete queues[_0x4691f7['uniqueid']];}}exports[_0x3237('0x11')]=function(_0x1419a7){try{utils['debug'](util[_0x3237('0x4')](_0x3237('0x12'),_0x1419a7[_0x3237('0x6')]),_0x1419a7);utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x13'),_0x1419a7[_0x3237('0x6')],_0x1419a7[_0x3237('0x8')],_0x1419a7['position']));queues[_0x1419a7[_0x3237('0x6')]]=_['assign'](_0x1419a7,{'originalposition':_0x1419a7['position'],'queuecallerjoinAt':utils[_0x3237('0x14')](),'mohtime':0x0});}catch(_0x24c6f6){utils['error'](util[_0x3237('0x4')](_0x3237('0x12'),_0x1419a7[_0x3237('0x6')]),_0x24c6f6);}};exports[_0x3237('0x15')]=function(_0x3540cd){try{if(!_[_0x3237('0x16')](queues[_0x3540cd['uniqueid']])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x18'),_0x3540cd[_0x3237('0x6')]),_0x3540cd);if(queues[_0x3540cd['uniqueid']][_0x3237('0x19')]){if(!queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1a')]&&!queues[_0x3540cd['uniqueid']][_0x3237('0x1b')]){queues[_0x3540cd['uniqueid']]['queuecallercomplete']=!![];queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1c')]=utils['now']();queues[_0x3540cd[_0x3237('0x6')]]['queuecallerexitreason']=_0x3237('0x1d');}utils['info'](util[_0x3237('0x4')](_0x3237('0x1e'),_0x3540cd[_0x3237('0x6')],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x3540cd[_0x3237('0x6')]]);}else if(queues[_0x3540cd[_0x3237('0x6')]]['transfereduniqueid']){utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3540cd[_0x3237('0x6')],queues[_0x3540cd[_0x3237('0x6')]]['name'],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]));queues[queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]]=queues[_0x3540cd[_0x3237('0x6')]];queues[queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]][_0x3237('0x20')]=0x2;delete queues[_0x3540cd[_0x3237('0x6')]];}}}catch(_0x3db865){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x18'),_0x3540cd[_0x3237('0x6')]),_0x3db865);}};exports['varset']=function(_0x3cb9cb){try{utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x22'),_0x3cb9cb[_0x3237('0x6')]),_0x3cb9cb);if(!_[_0x3237('0x16')](_0x3cb9cb[_0x3237('0x23')][_0x3237('0x24')])&&_0x3cb9cb[_0x3237('0x25')][_0x3237('0x26')]()!==_0x3237('0x27')){if(!_[_0x3237('0x16')](queues[_0x3cb9cb[_0x3237('0x6')]])){queues[_0x3cb9cb['uniqueid']][_0x3237('0x1a')]=![];queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x28')]=null;queues[_0x3cb9cb['uniqueid']][_0x3237('0x1b')]=!![];queues[_0x3cb9cb['uniqueid']][_0x3237('0x29')]=utils['now']();queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]=_0x3cb9cb[_0x3237('0x25')][_0x3237('0x26')]();utils['info'](util['format'](_0x3237('0x2a'),_0x3cb9cb[_0x3237('0x6')],queues[_0x3cb9cb['uniqueid']]['name'],_0x3cb9cb[_0x3237('0x25')],queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x3cb9cb['uniqueid']]);}}else if(!_['isNil'](_0x3cb9cb[_0x3237('0x23')][_0x3237('0x2b')])){if(!_[_0x3237('0x16')](queues[_0x3cb9cb[_0x3237('0x6')]])&&!queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x1a')]){queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x1a')]=![];queues[_0x3cb9cb['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3cb9cb['uniqueid']][_0x3237('0x1b')]=!![];queues[_0x3cb9cb['uniqueid']][_0x3237('0x29')]=utils[_0x3237('0x14')]();queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x2c');utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x2d'),_0x3cb9cb['uniqueid'],queues[_0x3cb9cb['uniqueid']][_0x3237('0x1f')],_0x3cb9cb[_0x3237('0x25')],queues[_0x3cb9cb['uniqueid']][_0x3237('0xb')]));}}}catch(_0x3a2dac){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x22'),_0x3cb9cb['uniqueid']),_0x3a2dac);}};exports[_0x3237('0x1a')]=function(_0x4953b3){try{if(!_[_0x3237('0x16')](queues[_0x4953b3['uniqueid']])){utils[_0x3237('0x17')](util['format'](_0x3237('0x2e'),_0x4953b3[_0x3237('0x6')]),_0x4953b3);queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1b')]=![];queues[_0x4953b3[_0x3237('0x6')]]['queuecallerexitAt']=null;queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1a')]=!![];queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x28')]=utils['now']();queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x2f');utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4953b3[_0x3237('0x6')],queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x4953b3['uniqueid']][_0x3237('0xb')]));}}catch(_0x158b90){utils[_0x3237('0x21')](util[_0x3237('0x4')]('[%s][queues][queuecallerabandon]',_0x4953b3[_0x3237('0x6')]),_0x158b90);}};exports[_0x3237('0x30')]=function(_0x39dd31){try{if(!_['isNil'](queues[_0x39dd31[_0x3237('0x6')]])){utils['debug'](util[_0x3237('0x4')]('[%s][queues][queuecallerleave]',_0x39dd31[_0x3237('0x6')]),_0x39dd31);utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x31'),_0x39dd31[_0x3237('0x6')],queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x1f')],_0x39dd31[_0x3237('0x32')],_0x39dd31[_0x3237('0x33')]));queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x30')]=!![];queues[_0x39dd31[_0x3237('0x6')]]['queuecallerleaveAt']=utils[_0x3237('0x14')]();queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x34')]=utils[_0x3237('0x35')](queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x19')],queues[_0x39dd31['uniqueid']][_0x3237('0x36')]);queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x37')]=_0x39dd31[_0x3237('0x37')];queues[_0x39dd31['uniqueid']][_0x3237('0x38')]=_0x39dd31['count'];queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x32')]=_0x39dd31[_0x3237('0x32')];queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x33')]=_0x39dd31[_0x3237('0x33')];}}catch(_0x4a42d4){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x39'),_0x39dd31[_0x3237('0x6')]),_0x4a42d4);}};exports[_0x3237('0x3a')]=function(_0x25dd1c){try{if(!_[_0x3237('0x16')](queues[_0x25dd1c['uniqueid']])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x3b'),_0x25dd1c[_0x3237('0x6')]),_0x25dd1c);utils['info'](util[_0x3237('0x4')](_0x3237('0x3c'),_0x25dd1c['uniqueid'],queues[_0x25dd1c['uniqueid']]['name'],_0x25dd1c[_0x3237('0x3d')],_0x25dd1c[_0x3237('0x3e')]));queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x1a')]=![];queues[_0x25dd1c[_0x3237('0x6')]]['queuecallerabandon']=![];queues[_0x25dd1c['uniqueid']][_0x3237('0x28')]=null;queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x1b')]=![];queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0xb')]=null;queues[_0x25dd1c[_0x3237('0x6')]]['queuecallerexitAt']=null;queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x3f')]=!![];queues[_0x25dd1c[_0x3237('0x6')]]['accountcode']=_0x25dd1c['destaccountcode'];queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x9')]=_0x25dd1c[_0x3237('0x3d')];}}catch(_0xf32d75){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x3b'),_0x25dd1c[_0x3237('0x6')]),_0xf32d75);}};exports[_0x3237('0x40')]=function(_0x30f709){try{if(!_[_0x3237('0x16')](queues[_0x30f709[_0x3237('0x6')]])){if(queues[_0x30f709[_0x3237('0x6')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x3237('0x41'),_0x30f709[_0x3237('0x6')]),_0x30f709);queues[_0x30f709['uniqueid']][_0x3237('0x1a')]=![];queues[_0x30f709['uniqueid']][_0x3237('0x1a')]=![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x28')]=null;queues[_0x30f709[_0x3237('0x6')]]['queuecallerexit']=![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x29')]=null;queues[_0x30f709['uniqueid']][_0x3237('0x3f')]=!![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x9')]=_0x30f709['membername'];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x42')]=!![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x1c')]=utils[_0x3237('0x14')]();if(_0x30f709[_0x3237('0x43')]==_0x3237('0x44')){if(!queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x44')]){queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x45');}}else{queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x46')+_0x30f709[_0x3237('0x43')]['toUpperCase']();}utils[_0x3237('0x3')](util['format'](_0x3237('0x47'),_0x30f709[_0x3237('0x6')],queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x1f')],_0x30f709['membername'],queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x30f709[_0x3237('0x6')]]);}}}catch(_0x3dee76){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x41'),_0x30f709[_0x3237('0x6')]),_0x3dee76);}};exports[_0x3237('0x48')]=function(_0x2e0af9){try{if(!_[_0x3237('0x16')](queues[_0x2e0af9['transfereeuniqueid']])){utils[_0x3237('0x17')](util['format'](_0x3237('0x49'),_0x2e0af9['uniqueid']),_0x2e0af9);queues[_0x2e0af9[_0x3237('0x4a')]][_0x3237('0x44')]=!![];queues[_0x2e0af9['transfereeuniqueid']][_0x3237('0x4b')]=_0x3237('0x4c');queues[_0x2e0af9[_0x3237('0x4a')]]['transferexten']=_0x2e0af9[_0x3237('0x4d')];queues[_0x2e0af9[_0x3237('0x4a')]][_0x3237('0x4e')]=_0x2e0af9[_0x3237('0x4a')];queues[_0x2e0af9[_0x3237('0x4a')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x4f'),_0x2e0af9[_0x3237('0x6')],queues[_0x2e0af9['transfereeuniqueid']][_0x3237('0x1f')],_0x2e0af9[_0x3237('0x4a')],_0x2e0af9[_0x3237('0x4d')]));}}catch(_0x52e810){utils['error'](util[_0x3237('0x4')](_0x3237('0x49'),_0x2e0af9[_0x3237('0x6')]),_0x52e810);}};exports['attendedtransfer']=function(_0x1b8475){try{utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x50'),_0x1b8475[_0x3237('0x51')]),_0x1b8475);if(_0x1b8475[_0x3237('0x51')]==_0x1b8475['origtransfererlinkedid']){if(!_['isNil'](queues[_0x1b8475[_0x3237('0x52')]])){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x53'),_0x1b8475[_0x3237('0x51')],queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x1f')],_0x1b8475[_0x3237('0x54')]));queues[_0x1b8475[_0x3237('0x52')]]['transfer']=!![];queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x4b')]=_0x3237('0x55');queues[_0x1b8475[_0x3237('0x52')]]['transferexten']=_0x1b8475[_0x3237('0x54')];queues[_0x1b8475[_0x3237('0x52')]]['transferuniqueid']=_0x1b8475[_0x3237('0x51')];queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0xb')]=_0x3237('0x56');}if(!_[_0x3237('0x16')](queues[_0x1b8475['origtransfererlinkedid']])){if(_0x1b8475[_0x3237('0x57')]&&queues[_0x1b8475['transfereelinkedid']]){queues[_0x1b8475['transfereelinkedid']][_0x3237('0x20')]=0x1;queues[_0x1b8475['transfereeuniqueid']]=_[_0x3237('0x58')](queues[_0x1b8475[_0x3237('0x57')]]);queues[_0x1b8475[_0x3237('0x4a')]]['transfereduniqueid']=_0x1b8475[_0x3237('0x59')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x20')]=0x2;queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0xa')]=queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0xa')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x5a')]=queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x5a')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x36')]=utils['now']();queues[_0x1b8475['transfereeuniqueid']][_0x3237('0x19')]=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x4a')]]['holdtime']=0x0;queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x5b')]=0x0;utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b8475[_0x3237('0x51')],queues[_0x1b8475[_0x3237('0x4a')]]['name'],queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0xa')],queues[_0x1b8475[_0x3237('0x4a')]]['calleridname']));}else{utils['info'](util[_0x3237('0x4')](_0x3237('0x5c'),_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x1f')],_0x1b8475['secondtransfererlinkedid']));queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x10')]=_0x1b8475[_0x3237('0x52')];}}}else if(_0x1b8475[_0x3237('0x5e')]==_0x1b8475[_0x3237('0x52')]){if(!_[_0x3237('0x16')](queues[_0x1b8475[_0x3237('0x5d')]])){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x5f'),_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x5d')]]['name'],_0x1b8475[_0x3237('0x5e')],_0x1b8475[_0x3237('0x60')]));queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x44')]=!![];queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x4b')]=_0x3237('0x55');queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x61')]=_0x1b8475['secondtransfererexten'];queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x4e')]=_0x1b8475[_0x3237('0x5e')];queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0xb')]=_0x3237('0x56');}if(!_[_0x3237('0x16')](queues[_0x1b8475[_0x3237('0x52')]])){if(_0x1b8475[_0x3237('0x62')]&&queues[_0x1b8475['transfertargetlinkedid']]){queues[_0x1b8475[_0x3237('0x62')]][_0x3237('0x20')]=0x1;queues[_0x1b8475[_0x3237('0x59')]]=_[_0x3237('0x58')](queues[_0x1b8475[_0x3237('0x62')]]);queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x10')]=_0x1b8475[_0x3237('0x59')];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x20')]=0x2;queues[_0x1b8475['transfertargetuniqueid']][_0x3237('0xa')]=queues[_0x1b8475['origtransfererlinkedid']]['calleridnum'];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5a')]=queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x5a')];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x36')]=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x59')]]['queuecallerleaveAt']=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x34')]=0x0;queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5b')]=0x0;utils['info'](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b8475[_0x3237('0x51')],queues[_0x1b8475['transfertargetuniqueid']]['name'],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x10')],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0xa')],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5a')]));}else{utils['info'](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x1f')],_0x1b8475['origtransfererlinkedid']));queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x10')]=_0x1b8475[_0x3237('0x5d')];}}}}catch(_0x4d46e0){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x50'),_0x1b8475[_0x3237('0x51')]),_0x4d46e0);}};exports['musiconholdstart']=function(_0x342708){try{if(!_[_0x3237('0x16')](queues[_0x342708[_0x3237('0x6')]])){utils[_0x3237('0x17')](util['format'](_0x3237('0x63'),_0x342708['uniqueid']),_0x342708);queues[_0x342708[_0x3237('0x6')]][_0x3237('0x64')]=utils[_0x3237('0x14')]();utils[_0x3237('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x342708[_0x3237('0x6')],queues[_0x342708[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x342708[_0x3237('0x6')]][_0x3237('0x64')]));}}catch(_0x171a99){utils['error'](util[_0x3237('0x4')](_0x3237('0x63'),_0x342708[_0x3237('0x6')]),_0x171a99);}};exports[_0x3237('0x65')]=function(_0x476342){try{if(!_['isNil'](queues[_0x476342[_0x3237('0x6')]])){if(!_['isNil'](queues[_0x476342['uniqueid']][_0x3237('0x64')])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x66'),_0x476342['uniqueid']),_0x476342);queues[_0x476342[_0x3237('0x6')]][_0x3237('0x5b')]+=utils[_0x3237('0x35')](utils['now'](),queues[_0x476342[_0x3237('0x6')]][_0x3237('0x64')]);utils['info'](util[_0x3237('0x4')](_0x3237('0x67'),_0x476342[_0x3237('0x6')],queues[_0x476342[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x476342[_0x3237('0x6')]][_0x3237('0x5b')]));delete queues[_0x476342[_0x3237('0x6')]][_0x3237('0x64')];}}}catch(_0x460974){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x66'),_0x476342[_0x3237('0x6')]),_0x460974);}}; \ No newline at end of file +var _0xdc73=['queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','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','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%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]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt'];(function(_0xc56c46,_0x3fc792){var _0x2055d6=function(_0x110ac3){while(--_0x110ac3){_0xc56c46['push'](_0xc56c46['shift']());}};_0x2055d6(++_0x3fc792);}(_0xdc73,0xb4));var _0x3dc7=function(_0xcc78f,_0x2ec704){_0xcc78f=_0xcc78f-0x0;var _0x36a0b0=_0xdc73[_0xcc78f];return _0x36a0b0;};'use strict';var _=require(_0x3dc7('0x0'));var util=require('util');var utils=require(_0x3dc7('0x1'));var queues={};function writeDB(_0x2a2a87){utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x4'),_0x2a2a87[_0x3dc7('0x5')],_0x2a2a87[_0x3dc7('0x6')],_0x2a2a87['queue'],_0x2a2a87[_0x3dc7('0x7')],_0x2a2a87[_0x3dc7('0x8')],_0x2a2a87['accountcode'],_0x2a2a87['queuecallerexitreason']));if(_0x2a2a87[_0x3dc7('0x9')]){utils[_0x3dc7('0xa')](_0x2a2a87['queue'])[_0x3dc7('0xb')](function(_0x87b261){if(_0x87b261){_0x2a2a87[_0x3dc7('0xc')]=_0x87b261[_0x3dc7('0xc')];}utils[_0x3dc7('0xd')](_0x3dc7('0xe'),_0x2a2a87);});}else{utils[_0x3dc7('0xd')](_0x3dc7('0xe'),_0x2a2a87);}if(_0x2a2a87['transfereduniqueid']){delete queues[_0x2a2a87[_0x3dc7('0xf')]];}else{delete queues[_0x2a2a87['uniqueid']];}}exports['queuecallerjoin']=function(_0x22f699){try{utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x11'),_0x22f699[_0x3dc7('0x5')]),_0x22f699);utils['info'](util[_0x3dc7('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x22f699[_0x3dc7('0x5')],_0x22f699['queue'],_0x22f699[_0x3dc7('0x12')]));queues[_0x22f699[_0x3dc7('0x5')]]=_[_0x3dc7('0x13')](_0x22f699,{'originalposition':_0x22f699['position'],'queuecallerjoinAt':utils[_0x3dc7('0x14')](),'mohtime':0x0});}catch(_0x2080fb){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')]('[%s][queues][queuecallerjoin]',_0x22f699[_0x3dc7('0x5')]),_0x2080fb);}};exports['hangup']=function(_0x10dd6b){try{if(!_[_0x3dc7('0x16')](queues[_0x10dd6b[_0x3dc7('0x5')]])){utils[_0x3dc7('0x10')](util['format'](_0x3dc7('0x17'),_0x10dd6b['uniqueid']),_0x10dd6b);if(queues[_0x10dd6b[_0x3dc7('0x5')]][_0x3dc7('0x18')]){if(!queues[_0x10dd6b[_0x3dc7('0x5')]][_0x3dc7('0x19')]&&!queues[_0x10dd6b[_0x3dc7('0x5')]][_0x3dc7('0x1a')]){queues[_0x10dd6b[_0x3dc7('0x5')]]['queuecallercomplete']=!![];queues[_0x10dd6b[_0x3dc7('0x5')]][_0x3dc7('0x1b')]=utils[_0x3dc7('0x14')]();queues[_0x10dd6b['uniqueid']][_0x3dc7('0x1c')]=_0x3dc7('0x1d');}utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x1e'),_0x10dd6b[_0x3dc7('0x5')],queues[_0x10dd6b['uniqueid']][_0x3dc7('0x1f')],queues[_0x10dd6b['uniqueid']][_0x3dc7('0x1c')]));writeDB(queues[_0x10dd6b[_0x3dc7('0x5')]]);}else if(queues[_0x10dd6b[_0x3dc7('0x5')]]['transfereduniqueid']){utils[_0x3dc7('0x2')](util['format'](_0x3dc7('0x20'),_0x10dd6b[_0x3dc7('0x5')],queues[_0x10dd6b[_0x3dc7('0x5')]][_0x3dc7('0x1f')],queues[_0x10dd6b['uniqueid']][_0x3dc7('0xf')]));queues[queues[_0x10dd6b['uniqueid']][_0x3dc7('0xf')]]=queues[_0x10dd6b[_0x3dc7('0x5')]];queues[queues[_0x10dd6b['uniqueid']]['transfereduniqueid']][_0x3dc7('0x21')]=0x2;delete queues[_0x10dd6b[_0x3dc7('0x5')]];}}}catch(_0x52c073){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')](_0x3dc7('0x17'),_0x10dd6b['uniqueid']),_0x52c073);}};exports['varset']=function(_0x2da265){try{utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x22'),_0x2da265[_0x3dc7('0x5')]),_0x2da265);if(!_['isNil'](_0x2da265['variable'][_0x3dc7('0x23')])&&_0x2da265['value'][_0x3dc7('0x24')]()!==_0x3dc7('0x25')){if(!_[_0x3dc7('0x16')](queues[_0x2da265[_0x3dc7('0x5')]])){queues[_0x2da265[_0x3dc7('0x5')]]['queuecallerabandon']=![];queues[_0x2da265['uniqueid']][_0x3dc7('0x26')]=null;queues[_0x2da265[_0x3dc7('0x5')]][_0x3dc7('0x1a')]=!![];queues[_0x2da265[_0x3dc7('0x5')]][_0x3dc7('0x27')]=utils[_0x3dc7('0x14')]();queues[_0x2da265['uniqueid']][_0x3dc7('0x1c')]=_0x2da265[_0x3dc7('0x28')][_0x3dc7('0x24')]();utils[_0x3dc7('0x2')](util['format'](_0x3dc7('0x29'),_0x2da265[_0x3dc7('0x5')],queues[_0x2da265['uniqueid']][_0x3dc7('0x1f')],_0x2da265[_0x3dc7('0x28')],queues[_0x2da265['uniqueid']][_0x3dc7('0x1c')]));writeDB(queues[_0x2da265[_0x3dc7('0x5')]]);}}else if(!_[_0x3dc7('0x16')](_0x2da265[_0x3dc7('0x2a')][_0x3dc7('0x2b')])){if(!_[_0x3dc7('0x16')](queues[_0x2da265[_0x3dc7('0x5')]])&&!queues[_0x2da265[_0x3dc7('0x5')]][_0x3dc7('0x19')]){queues[_0x2da265['uniqueid']]['queuecallerabandon']=![];queues[_0x2da265[_0x3dc7('0x5')]]['queuecallerabandonAt']=null;queues[_0x2da265[_0x3dc7('0x5')]][_0x3dc7('0x1a')]=!![];queues[_0x2da265[_0x3dc7('0x5')]]['queuecallerexitAt']=utils[_0x3dc7('0x14')]();queues[_0x2da265[_0x3dc7('0x5')]]['queuecallerexitreason']=_0x3dc7('0x2c');utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x2d'),_0x2da265[_0x3dc7('0x5')],queues[_0x2da265[_0x3dc7('0x5')]]['name'],_0x2da265[_0x3dc7('0x28')],queues[_0x2da265['uniqueid']][_0x3dc7('0x1c')]));}}}catch(_0x1a2076){utils[_0x3dc7('0x15')](util['format'](_0x3dc7('0x22'),_0x2da265['uniqueid']),_0x1a2076);}};exports[_0x3dc7('0x19')]=function(_0x29d366){try{if(!_['isNil'](queues[_0x29d366[_0x3dc7('0x5')]])){utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x2e'),_0x29d366[_0x3dc7('0x5')]),_0x29d366);queues[_0x29d366[_0x3dc7('0x5')]][_0x3dc7('0x1a')]=![];queues[_0x29d366[_0x3dc7('0x5')]][_0x3dc7('0x27')]=null;queues[_0x29d366['uniqueid']][_0x3dc7('0x19')]=!![];queues[_0x29d366['uniqueid']][_0x3dc7('0x26')]=utils[_0x3dc7('0x14')]();queues[_0x29d366['uniqueid']][_0x3dc7('0x1c')]=_0x3dc7('0x2f');utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x30'),_0x29d366['uniqueid'],queues[_0x29d366['uniqueid']][_0x3dc7('0x1f')],queues[_0x29d366[_0x3dc7('0x5')]][_0x3dc7('0x1c')]));}}catch(_0x112be9){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')](_0x3dc7('0x2e'),_0x29d366[_0x3dc7('0x5')]),_0x112be9);}};exports[_0x3dc7('0x31')]=function(_0x4d62f2){try{if(!_[_0x3dc7('0x16')](queues[_0x4d62f2[_0x3dc7('0x5')]])){utils['debug'](util[_0x3dc7('0x3')]('[%s][queues][queuecallerleave]',_0x4d62f2[_0x3dc7('0x5')]),_0x4d62f2);utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x32'),_0x4d62f2[_0x3dc7('0x5')],queues[_0x4d62f2[_0x3dc7('0x5')]][_0x3dc7('0x1f')],_0x4d62f2['connectedlinenum'],_0x4d62f2[_0x3dc7('0x33')]));queues[_0x4d62f2[_0x3dc7('0x5')]]['queuecallerleave']=!![];queues[_0x4d62f2[_0x3dc7('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x4d62f2[_0x3dc7('0x5')]]['holdtime']=utils[_0x3dc7('0x34')](queues[_0x4d62f2[_0x3dc7('0x5')]][_0x3dc7('0x18')],queues[_0x4d62f2[_0x3dc7('0x5')]]['queuecallerjoinAt']);queues[_0x4d62f2[_0x3dc7('0x5')]][_0x3dc7('0x12')]=_0x4d62f2[_0x3dc7('0x12')];queues[_0x4d62f2[_0x3dc7('0x5')]]['count']=_0x4d62f2[_0x3dc7('0x35')];queues[_0x4d62f2[_0x3dc7('0x5')]]['connectedlinenum']=_0x4d62f2[_0x3dc7('0x36')];queues[_0x4d62f2[_0x3dc7('0x5')]][_0x3dc7('0x33')]=_0x4d62f2[_0x3dc7('0x33')];}}catch(_0x597a54){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')]('[%s][queues][queuecallerleave]',_0x4d62f2[_0x3dc7('0x5')]),_0x597a54);}};exports[_0x3dc7('0x37')]=function(_0x3e370a){try{if(!_[_0x3dc7('0x16')](queues[_0x3e370a['uniqueid']])){utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x38'),_0x3e370a[_0x3dc7('0x5')]),_0x3e370a);utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3e370a[_0x3dc7('0x5')],queues[_0x3e370a[_0x3dc7('0x5')]]['name'],_0x3e370a[_0x3dc7('0x39')],_0x3e370a[_0x3dc7('0x3a')]));queues[_0x3e370a['uniqueid']]['queuecallerabandon']=![];queues[_0x3e370a['uniqueid']][_0x3dc7('0x19')]=![];queues[_0x3e370a[_0x3dc7('0x5')]][_0x3dc7('0x26')]=null;queues[_0x3e370a[_0x3dc7('0x5')]]['queuecallerexit']=![];queues[_0x3e370a['uniqueid']]['queuecallerexitreason']=null;queues[_0x3e370a[_0x3dc7('0x5')]][_0x3dc7('0x27')]=null;queues[_0x3e370a[_0x3dc7('0x5')]][_0x3dc7('0x3b')]=!![];queues[_0x3e370a[_0x3dc7('0x5')]]['accountcode']=_0x3e370a[_0x3dc7('0x3a')];queues[_0x3e370a[_0x3dc7('0x5')]]['lastAssignedTo']=_0x3e370a[_0x3dc7('0x39')];}}catch(_0x57dbea){utils['error'](util['format'](_0x3dc7('0x38'),_0x3e370a['uniqueid']),_0x57dbea);}};exports[_0x3dc7('0x3c')]=function(_0x16a7df){try{if(!_[_0x3dc7('0x16')](queues[_0x16a7df[_0x3dc7('0x5')]])){if(queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x18')]){utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x3d'),_0x16a7df[_0x3dc7('0x5')]),_0x16a7df);queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x19')]=![];queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x19')]=![];queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x26')]=null;queues[_0x16a7df['uniqueid']][_0x3dc7('0x1a')]=![];queues[_0x16a7df['uniqueid']]['queuecallerexitAt']=null;queues[_0x16a7df['uniqueid']][_0x3dc7('0x3b')]=!![];queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x7')]=_0x16a7df['membername'];queues[_0x16a7df['uniqueid']][_0x3dc7('0x3e')]=!![];queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x1b')]=utils[_0x3dc7('0x14')]();if(_0x16a7df['reason']==_0x3dc7('0x3f')){if(!queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x3f')]){queues[_0x16a7df[_0x3dc7('0x5')]][_0x3dc7('0x1c')]='TRANSFER';}}else{queues[_0x16a7df['uniqueid']][_0x3dc7('0x1c')]=_0x3dc7('0x40')+_0x16a7df[_0x3dc7('0x41')][_0x3dc7('0x24')]();}utils[_0x3dc7('0x2')](util['format'](_0x3dc7('0x42'),_0x16a7df[_0x3dc7('0x5')],queues[_0x16a7df['uniqueid']][_0x3dc7('0x1f')],_0x16a7df[_0x3dc7('0x39')],queues[_0x16a7df['uniqueid']][_0x3dc7('0x1c')]));writeDB(queues[_0x16a7df[_0x3dc7('0x5')]]);}}}catch(_0x4004fc){utils['error'](util[_0x3dc7('0x3')](_0x3dc7('0x3d'),_0x16a7df[_0x3dc7('0x5')]),_0x4004fc);}};exports['blindtransfer']=function(_0x345fa3){try{if(!_['isNil'](queues[_0x345fa3[_0x3dc7('0x43')]])){utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x44'),_0x345fa3['uniqueid']),_0x345fa3);queues[_0x345fa3['transfereeuniqueid']][_0x3dc7('0x3f')]=!![];queues[_0x345fa3[_0x3dc7('0x43')]][_0x3dc7('0x45')]=_0x3dc7('0x46');queues[_0x345fa3[_0x3dc7('0x43')]][_0x3dc7('0x47')]=_0x345fa3[_0x3dc7('0x48')];queues[_0x345fa3[_0x3dc7('0x43')]]['transferuniqueid']=_0x345fa3[_0x3dc7('0x43')];queues[_0x345fa3[_0x3dc7('0x43')]]['queuecallerexitreason']=_0x3dc7('0x49');utils[_0x3dc7('0x2')](util['format'](_0x3dc7('0x4a'),_0x345fa3['uniqueid'],queues[_0x345fa3['transfereeuniqueid']]['name'],_0x345fa3[_0x3dc7('0x43')],_0x345fa3['extension']));}}catch(_0x3412fd){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')]('[%s][queues][blindtransfer]',_0x345fa3[_0x3dc7('0x5')]),_0x3412fd);}};exports[_0x3dc7('0x4b')]=function(_0x1f1ce4){try{utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x4c'),_0x1f1ce4[_0x3dc7('0x4d')]),_0x1f1ce4);if(_0x1f1ce4[_0x3dc7('0x4d')]==_0x1f1ce4[_0x3dc7('0x4e')]){if(!_[_0x3dc7('0x16')](queues[_0x1f1ce4[_0x3dc7('0x4f')]])){utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x50'),_0x1f1ce4[_0x3dc7('0x4d')],queues[_0x1f1ce4[_0x3dc7('0x4f')]]['name'],_0x1f1ce4[_0x3dc7('0x51')]));queues[_0x1f1ce4[_0x3dc7('0x4f')]]['transfer']=!![];queues[_0x1f1ce4[_0x3dc7('0x4f')]][_0x3dc7('0x45')]=_0x3dc7('0x52');queues[_0x1f1ce4[_0x3dc7('0x4f')]][_0x3dc7('0x47')]=_0x1f1ce4[_0x3dc7('0x51')];queues[_0x1f1ce4[_0x3dc7('0x4f')]][_0x3dc7('0x53')]=_0x1f1ce4[_0x3dc7('0x4d')];queues[_0x1f1ce4['secondtransfererlinkedid']][_0x3dc7('0x1c')]=_0x3dc7('0x54');}if(!_['isNil'](queues[_0x1f1ce4['origtransfererlinkedid']])){if(_0x1f1ce4['transfereelinkedid']&&queues[_0x1f1ce4[_0x3dc7('0x55')]]){queues[_0x1f1ce4['transfereelinkedid']][_0x3dc7('0x21')]=0x1;queues[_0x1f1ce4[_0x3dc7('0x43')]]=_[_0x3dc7('0x56')](queues[_0x1f1ce4[_0x3dc7('0x55')]]);queues[_0x1f1ce4['transfereeuniqueid']]['transfereduniqueid']=_0x1f1ce4[_0x3dc7('0x57')];queues[_0x1f1ce4['transfereeuniqueid']][_0x3dc7('0x21')]=0x2;queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x8')]=queues[_0x1f1ce4['secondtransfererlinkedid']][_0x3dc7('0x8')];queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x58')]=queues[_0x1f1ce4[_0x3dc7('0x4f')]][_0x3dc7('0x58')];queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x59')]=utils['now']();queues[_0x1f1ce4['transfereeuniqueid']][_0x3dc7('0x18')]=utils[_0x3dc7('0x14')]();queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x5a')]=0x0;queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x5b')]=0x0;utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x5c'),_0x1f1ce4['origtransfereruniqueid'],queues[_0x1f1ce4[_0x3dc7('0x43')]]['name'],queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x8')],queues[_0x1f1ce4[_0x3dc7('0x43')]][_0x3dc7('0x58')]));}else{utils['info'](util[_0x3dc7('0x3')](_0x3dc7('0x5d'),_0x1f1ce4[_0x3dc7('0x4d')],queues[_0x1f1ce4[_0x3dc7('0x4e')]]['name'],_0x1f1ce4[_0x3dc7('0x4f')]));queues[_0x1f1ce4[_0x3dc7('0x4e')]]['transfereduniqueid']=_0x1f1ce4[_0x3dc7('0x4f')];}}}else if(_0x1f1ce4[_0x3dc7('0x5e')]==_0x1f1ce4['secondtransfererlinkedid']){if(!_[_0x3dc7('0x16')](queues[_0x1f1ce4[_0x3dc7('0x4e')]])){utils['info'](util['format'](_0x3dc7('0x5f'),_0x1f1ce4[_0x3dc7('0x4d')],queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x1f')],_0x1f1ce4[_0x3dc7('0x5e')],_0x1f1ce4[_0x3dc7('0x60')]));queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x3f')]=!![];queues[_0x1f1ce4[_0x3dc7('0x4e')]]['transfertype']='ATTENDED';queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x47')]=_0x1f1ce4[_0x3dc7('0x60')];queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x53')]=_0x1f1ce4[_0x3dc7('0x5e')];queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x1c')]=_0x3dc7('0x54');}if(!_['isNil'](queues[_0x1f1ce4[_0x3dc7('0x4f')]])){if(_0x1f1ce4[_0x3dc7('0x61')]&&queues[_0x1f1ce4['transfertargetlinkedid']]){queues[_0x1f1ce4['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x1f1ce4[_0x3dc7('0x57')]]=_[_0x3dc7('0x56')](queues[_0x1f1ce4[_0x3dc7('0x61')]]);queues[_0x1f1ce4[_0x3dc7('0x57')]]['transfereduniqueid']=_0x1f1ce4['transfertargetuniqueid'];queues[_0x1f1ce4['transfertargetuniqueid']][_0x3dc7('0x21')]=0x2;queues[_0x1f1ce4[_0x3dc7('0x57')]]['calleridnum']=queues[_0x1f1ce4[_0x3dc7('0x4e')]][_0x3dc7('0x8')];queues[_0x1f1ce4['transfertargetuniqueid']][_0x3dc7('0x58')]=queues[_0x1f1ce4[_0x3dc7('0x4e')]]['calleridname'];queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x59')]=utils[_0x3dc7('0x14')]();queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x18')]=utils[_0x3dc7('0x14')]();queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x5a')]=0x0;queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x5b')]=0x0;utils['info'](util['format'](_0x3dc7('0x62'),_0x1f1ce4[_0x3dc7('0x4d')],queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x1f')],queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0xf')],queues[_0x1f1ce4['transfertargetuniqueid']][_0x3dc7('0x8')],queues[_0x1f1ce4[_0x3dc7('0x57')]][_0x3dc7('0x58')]));}else{utils[_0x3dc7('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1f1ce4[_0x3dc7('0x4d')],queues[_0x1f1ce4['secondtransfererlinkedid']][_0x3dc7('0x1f')],_0x1f1ce4[_0x3dc7('0x4e')]));queues[_0x1f1ce4[_0x3dc7('0x4f')]]['transfereduniqueid']=_0x1f1ce4[_0x3dc7('0x4e')];}}}}catch(_0x795b06){utils[_0x3dc7('0x15')](util['format'](_0x3dc7('0x4c'),_0x1f1ce4[_0x3dc7('0x4d')]),_0x795b06);}};exports[_0x3dc7('0x63')]=function(_0x16b890){try{if(!_[_0x3dc7('0x16')](queues[_0x16b890[_0x3dc7('0x5')]])){utils[_0x3dc7('0x10')](util[_0x3dc7('0x3')](_0x3dc7('0x64'),_0x16b890[_0x3dc7('0x5')]),_0x16b890);queues[_0x16b890[_0x3dc7('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')](_0x3dc7('0x65'),_0x16b890[_0x3dc7('0x5')],queues[_0x16b890['uniqueid']]['name'],queues[_0x16b890[_0x3dc7('0x5')]]['musiconholdstartAt']));}}catch(_0x8cae91){utils[_0x3dc7('0x15')](util[_0x3dc7('0x3')](_0x3dc7('0x64'),_0x16b890[_0x3dc7('0x5')]),_0x8cae91);}};exports['musiconholdstop']=function(_0x32567c){try{if(!_[_0x3dc7('0x16')](queues[_0x32567c[_0x3dc7('0x5')]])){if(!_[_0x3dc7('0x16')](queues[_0x32567c['uniqueid']][_0x3dc7('0x66')])){utils['debug'](util[_0x3dc7('0x3')]('[%s][queues][musiconholdstop]',_0x32567c[_0x3dc7('0x5')]),_0x32567c);queues[_0x32567c['uniqueid']][_0x3dc7('0x5b')]+=utils['diffTime'](utils[_0x3dc7('0x14')](),queues[_0x32567c[_0x3dc7('0x5')]][_0x3dc7('0x66')]);utils[_0x3dc7('0x2')](util[_0x3dc7('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x32567c[_0x3dc7('0x5')],queues[_0x32567c[_0x3dc7('0x5')]][_0x3dc7('0x1f')],queues[_0x32567c[_0x3dc7('0x5')]][_0x3dc7('0x5b')]));delete queues[_0x32567c[_0x3dc7('0x5')]][_0x3dc7('0x66')];}}}catch(_0x5031d0){utils['error'](util[_0x3dc7('0x3')](_0x3dc7('0x67'),_0x32567c[_0x3dc7('0x5')]),_0x5031d0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2539979..7451484 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 _0xef5b=['lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','blinds','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring'];(function(_0x112a0f,_0x5d4daf){var _0x570da3=function(_0x47f138){while(--_0x47f138){_0x112a0f['push'](_0x112a0f['shift']());}};_0x570da3(++_0x5d4daf);}(_0xef5b,0x16f));var _0xbef5=function(_0x5009ed,_0x476a42){_0x5009ed=_0x5009ed-0x0;var _0x326706=_0xef5b[_0x5009ed];return _0x326706;};'use strict';var _=require(_0xbef5('0x0'));var util=require('util');var utils=require(_0xbef5('0x1'));var transfers=require(_0xbef5('0x2'));var recordings={};function writeDB(_0x5e4be3){var _0xf07c13;utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x5'),_0x5e4be3[_0xbef5('0x6')]));if(transfers['blinds'][_0x5e4be3[_0xbef5('0x6')]]){_0xf07c13=_0x5e4be3[_0xbef5('0x6')];_0x5e4be3[_0xbef5('0x6')]=transfers['blinds'][_0x5e4be3[_0xbef5('0x6')]][_0xbef5('0x7')];}if(_0x5e4be3[_0xbef5('0x8')]){utils['getUserByInternal'](_0x5e4be3[_0xbef5('0x8')])[_0xbef5('0x9')](function(_0x5c43b8){if(_0x5c43b8){_0x5e4be3[_0xbef5('0xa')]=_0x5c43b8[_0xbef5('0xb')];_0x5e4be3[_0xbef5('0xc')]=_0x5c43b8['id'];}utils[_0xbef5('0xd')](_0xbef5('0xe'),_0x5e4be3);});}else{utils[_0xbef5('0xd')](_0xbef5('0xe'),_0x5e4be3);}if(_0xf07c13)delete transfers[_0xbef5('0xf')][_0xf07c13];}exports['newchannel']=function(_0x3ca6ad){try{utils[_0xbef5('0x10')](util[_0xbef5('0x4')]('[%s][recordings][newchannel]',_0x3ca6ad[_0xbef5('0x6')]),_0x3ca6ad);if(_0x3ca6ad['uniqueid']==_0x3ca6ad[_0xbef5('0x11')]){utils[_0xbef5('0x3')](util['format'](_0xbef5('0x12'),_0x3ca6ad[_0xbef5('0x6')],_0x3ca6ad['context'],_0x3ca6ad[_0xbef5('0x13')]));recordings[_0x3ca6ad['uniqueid']]={'uniqueid':_0x3ca6ad[_0xbef5('0x6')],'accountcode':_0x3ca6ad['accountcode'],'exten':_0x3ca6ad[_0xbef5('0x13')],'context':_0x3ca6ad[_0xbef5('0x14')],'channel':_0x3ca6ad['channel'],'monitors':[]};}}catch(_0x37c1ce){utils['error'](util['format']('[%s][recordings][newchannel]',_0x3ca6ad[_0xbef5('0x6')]),_0x37c1ce);}};exports[_0xbef5('0x15')]=function(_0x390855){try{utils[_0xbef5('0x10')](util[_0xbef5('0x4')]('[%s][recordings][newstate]',_0x390855[_0xbef5('0x6')]),_0x390855);if(!_[_0xbef5('0x16')](recordings[_0x390855[_0xbef5('0x6')]])&&_0x390855['channelstate']==0x6){utils['info'](util[_0xbef5('0x4')](_0xbef5('0x17'),_0x390855[_0xbef5('0x6')],_0x390855[_0xbef5('0x14')],_0x390855['channel']));}else if(!_['isNil'](recordings[_0x390855[_0xbef5('0x11')]])&&_0x390855[_0xbef5('0x18')]==0x6&&_0x390855[_0xbef5('0x14')]!=_0xbef5('0x19')){utils['info'](util[_0xbef5('0x4')](_0xbef5('0x1a'),_0x390855[_0xbef5('0x6')],_0x390855[_0xbef5('0x11')],_0x390855[_0xbef5('0x14')],_0x390855['channel']));recordings[_0x390855[_0xbef5('0x11')]][_0xbef5('0x8')]=_0x390855[_0xbef5('0x8')];}}catch(_0x26fc7e){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x1c'),_0x390855[_0xbef5('0x6')]),_0x26fc7e);}};exports['varset']=function(_0xf312f4){try{if(!_[_0xbef5('0x16')](_0xf312f4['variable'])&&!_['isNil'](_0xf312f4[_0xbef5('0x1d')][_0xbef5('0x1e')])){utils['debug'](util[_0xbef5('0x4')](_0xbef5('0x1f'),_0xf312f4[_0xbef5('0x6')]),_0xf312f4);utils[_0xbef5('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0xf312f4[_0xbef5('0x6')],_0xf312f4['variable'],_0xf312f4[_0xbef5('0x20')]));if(_[_0xbef5('0x21')](_0xf312f4['value'],_0xbef5('0x22'))){_0xf312f4[_0xbef5('0x20')]=_0xf312f4['value'][_0xbef5('0x23')](_0xbef5('0x22'),_0xbef5('0x24'));}if(recordings[_0xf312f4[_0xbef5('0x11')]]){var _0x20bdc5=_[_0xbef5('0x25')](recordings[_0xf312f4[_0xbef5('0x11')]][_0xbef5('0x26')],{'value':_0xf312f4['value']});if(_[_0xbef5('0x16')](_0x20bdc5)){recordings[_0xf312f4[_0xbef5('0x11')]]['monitors'][_0xbef5('0x27')]({'value':_0xf312f4[_0xbef5('0x20')]});}}}}catch(_0x12d2d9){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x1f'),_0xf312f4[_0xbef5('0x6')]),_0x12d2d9);}};exports[_0xbef5('0x28')]=function(_0xc36147){try{if(!_[_0xbef5('0x16')](recordings[_0xc36147[_0xbef5('0x6')]])){utils[_0xbef5('0x10')](util['format'](_0xbef5('0x29'),_0xc36147[_0xbef5('0x6')]),_0xc36147);utils[_0xbef5('0x3')](util['format'](_0xbef5('0x2a'),_0xc36147[_0xbef5('0x6')],_0xc36147[_0xbef5('0x2b')],_0xc36147[_0xbef5('0x2c')],_0xc36147['cause-txt']));recordings[_0xc36147[_0xbef5('0x6')]]['calleridnum']=_0xc36147[_0xbef5('0x2b')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2c')]=_0xc36147[_0xbef5('0x2c')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2d')]=_0xc36147[_0xbef5('0x2d')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2e')]=_0xc36147[_0xbef5('0x2e')];if(recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2f')]==_0xbef5('0x30')&&recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x8')]){recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2d')]=recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x8')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2e')]='';}recordings[_0xc36147['uniqueid']]['monitors']['forEach'](function(_0x29ca9f){var _0x172995=_[_0xbef5('0x31')](recordings[_0xc36147[_0xbef5('0x6')]]);_0x172995[_0xbef5('0x20')]=_0x29ca9f['value'];writeDB(_0x172995);});delete recordings[_0xc36147[_0xbef5('0x6')]];}}catch(_0x3c134a){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x29'),_0xc36147[_0xbef5('0x6')]),_0x3c134a);}};exports[_0xbef5('0x32')]=function(_0x545f5a){try{if(!_[_0xbef5('0x16')](recordings[_0x545f5a[_0xbef5('0x6')]])){utils[_0xbef5('0x10')](util[_0xbef5('0x4')](_0xbef5('0x33'),_0x545f5a[_0xbef5('0x6')]),_0x545f5a);utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x34'),_0x545f5a[_0xbef5('0x6')],_0x545f5a[_0xbef5('0x35')],_0x545f5a[_0xbef5('0x36')]));if(_0x545f5a[_0xbef5('0x35')][_0xbef5('0x37')]()=='set'&&_[_0xbef5('0x38')](_0x545f5a[_0xbef5('0x36')][_0xbef5('0x37')](),'cdr')){var _0x20a7c5=_0x545f5a['appdata'][_0xbef5('0x39')]('=');var _0x4eaa92=_0x20a7c5[0x0][_0xbef5('0x3a')](_0x20a7c5[0x0][_0xbef5('0x3b')]('(')+0x1,_0x20a7c5[0x0]['lastIndexOf'](')'));var _0x5493d6=_0x20a7c5[0x1];recordings[_0x545f5a[_0xbef5('0x6')]][_0x4eaa92]=_0x5493d6;}}}catch(_0x855011){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x33'),_0x545f5a[_0xbef5('0x6')]),_0x855011);}};exports[_0xbef5('0x3c')]=function(_0x33ea5e){try{if(!_['isNil'](recordings[_0x33ea5e[_0xbef5('0x6')]])){utils['debug'](util[_0xbef5('0x4')](_0xbef5('0x3d'),_0x33ea5e[_0xbef5('0x6')]),_0x33ea5e);utils['info'](util[_0xbef5('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x33ea5e[_0xbef5('0x6')],_0x33ea5e[_0xbef5('0x3e')]));recordings[_0x33ea5e[_0xbef5('0x6')]][_0xbef5('0x3e')]=_0x33ea5e['queue'];}}catch(_0x261da6){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x3d'),_0x33ea5e[_0xbef5('0x6')]),_0x261da6);}};exports[_0xbef5('0x3f')]=function(_0x1d7fc8){try{utils[_0xbef5('0x10')](util['format'](_0xbef5('0x40'),_0x1d7fc8[_0xbef5('0x6')]),_0x1d7fc8);utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x41'),_0x1d7fc8['uniqueid'],_0x1d7fc8[_0xbef5('0x42')],_0x1d7fc8[_0xbef5('0x43')],_0x1d7fc8[_0xbef5('0x44')],_0x1d7fc8['transfereecalleridname']));if(recordings[_0x1d7fc8[_0xbef5('0x45')]]&&transfers['blinds'][_0x1d7fc8['transfereruniqueid']]){transfers[_0xbef5('0xf')][_0x1d7fc8[_0xbef5('0x45')]][_0xbef5('0x46')]=!![];}}catch(_0x1b374d){utils[_0xbef5('0x1b')](util['format']('[%s][recordings][blindtransfer]',_0x1d7fc8[_0xbef5('0x6')]),_0x1b374d);}}; \ No newline at end of file +var _0xbb21=['cdr','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','appdata','application','set','startsWith','toLowerCase'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xbb21,0x1ea));var _0x1bb2=function(_0x16e3f3,_0x4a6745){_0x16e3f3=_0x16e3f3-0x0;var _0x1b6b41=_0xbb21[_0x16e3f3];return _0x1b6b41;};'use strict';var _=require('lodash');var util=require(_0x1bb2('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x421253){var _0xbee942;utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')](_0x1bb2('0x3'),_0x421253[_0x1bb2('0x4')]));if(transfers[_0x1bb2('0x5')][_0x421253[_0x1bb2('0x4')]]){_0xbee942=_0x421253[_0x1bb2('0x4')];_0x421253[_0x1bb2('0x4')]=transfers['blinds'][_0x421253[_0x1bb2('0x4')]][_0x1bb2('0x6')];}if(_0x421253[_0x1bb2('0x7')]){utils[_0x1bb2('0x8')](_0x421253[_0x1bb2('0x7')])['then'](function(_0x50dbdc){if(_0x50dbdc){_0x421253[_0x1bb2('0x9')]=_0x50dbdc[_0x1bb2('0xa')];_0x421253[_0x1bb2('0xb')]=_0x50dbdc['id'];}utils[_0x1bb2('0xc')](_0x1bb2('0xd'),_0x421253);});}else{utils['request']('CreateVoiceRecording',_0x421253);}if(_0xbee942)delete transfers[_0x1bb2('0x5')][_0xbee942];}exports['newchannel']=function(_0x122f68){try{utils[_0x1bb2('0xe')](util[_0x1bb2('0x2')]('[%s][recordings][newchannel]',_0x122f68[_0x1bb2('0x4')]),_0x122f68);if(_0x122f68[_0x1bb2('0x4')]==_0x122f68[_0x1bb2('0xf')]){utils['info'](util['format'](_0x1bb2('0x10'),_0x122f68[_0x1bb2('0x4')],_0x122f68[_0x1bb2('0x11')],_0x122f68[_0x1bb2('0x12')]));recordings[_0x122f68[_0x1bb2('0x4')]]={'uniqueid':_0x122f68[_0x1bb2('0x4')],'accountcode':_0x122f68[_0x1bb2('0x7')],'exten':_0x122f68[_0x1bb2('0x12')],'context':_0x122f68[_0x1bb2('0x11')],'channel':_0x122f68[_0x1bb2('0x13')],'monitors':[]};}}catch(_0x538ae0){utils[_0x1bb2('0x14')](util['format'](_0x1bb2('0x15'),_0x122f68[_0x1bb2('0x4')]),_0x538ae0);}};exports['newstate']=function(_0x57d1a4){try{utils[_0x1bb2('0xe')](util[_0x1bb2('0x2')](_0x1bb2('0x16'),_0x57d1a4[_0x1bb2('0x4')]),_0x57d1a4);if(!_[_0x1bb2('0x17')](recordings[_0x57d1a4[_0x1bb2('0x4')]])&&_0x57d1a4[_0x1bb2('0x18')]==0x6){utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')](_0x1bb2('0x19'),_0x57d1a4['uniqueid'],_0x57d1a4[_0x1bb2('0x11')],_0x57d1a4[_0x1bb2('0x13')]));}else if(!_['isNil'](recordings[_0x57d1a4[_0x1bb2('0xf')]])&&_0x57d1a4['channelstate']==0x6&&_0x57d1a4[_0x1bb2('0x11')]!='transfer'){utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')](_0x1bb2('0x1a'),_0x57d1a4[_0x1bb2('0x4')],_0x57d1a4['linkedid'],_0x57d1a4[_0x1bb2('0x11')],_0x57d1a4['channel']));recordings[_0x57d1a4[_0x1bb2('0xf')]][_0x1bb2('0x7')]=_0x57d1a4[_0x1bb2('0x7')];}}catch(_0x50bd2d){utils['error'](util['format'](_0x1bb2('0x16'),_0x57d1a4[_0x1bb2('0x4')]),_0x50bd2d);}};exports['varset']=function(_0x239ceb){try{if(!_[_0x1bb2('0x17')](_0x239ceb[_0x1bb2('0x1b')])&&!_[_0x1bb2('0x17')](_0x239ceb[_0x1bb2('0x1b')]['mixmonitor_filename'])){utils[_0x1bb2('0xe')](util[_0x1bb2('0x2')](_0x1bb2('0x1c'),_0x239ceb[_0x1bb2('0x4')]),_0x239ceb);utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')](_0x1bb2('0x1d'),_0x239ceb[_0x1bb2('0x4')],_0x239ceb[_0x1bb2('0x1b')],_0x239ceb['value']));if(_[_0x1bb2('0x1e')](_0x239ceb[_0x1bb2('0x1f')],_0x1bb2('0x20'))){_0x239ceb['value']=_0x239ceb['value'][_0x1bb2('0x21')](_0x1bb2('0x20'),_0x1bb2('0x22'));}if(recordings[_0x239ceb[_0x1bb2('0xf')]]){var _0x4cf81f=_[_0x1bb2('0x23')](recordings[_0x239ceb['linkedid']][_0x1bb2('0x24')],{'value':_0x239ceb['value']});if(_['isNil'](_0x4cf81f)){recordings[_0x239ceb[_0x1bb2('0xf')]][_0x1bb2('0x24')][_0x1bb2('0x25')]({'value':_0x239ceb[_0x1bb2('0x1f')]});}}}}catch(_0x3152c1){utils[_0x1bb2('0x14')](util[_0x1bb2('0x2')]('[%s][recordings][varset]',_0x239ceb[_0x1bb2('0x4')]),_0x3152c1);}};exports[_0x1bb2('0x26')]=function(_0x2c7866){try{if(!_[_0x1bb2('0x17')](recordings[_0x2c7866['uniqueid']])){utils['debug'](util[_0x1bb2('0x2')](_0x1bb2('0x27'),_0x2c7866[_0x1bb2('0x4')]),_0x2c7866);utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2c7866['uniqueid'],_0x2c7866[_0x1bb2('0x28')],_0x2c7866[_0x1bb2('0x29')],_0x2c7866['cause-txt']));recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x28')]=_0x2c7866[_0x1bb2('0x28')];recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x29')]=_0x2c7866[_0x1bb2('0x29')];recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x2a')]=_0x2c7866[_0x1bb2('0x2a')];recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x2b')]=_0x2c7866['connectedlinename'];if(recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x2c')]==_0x1bb2('0x2d')&&recordings[_0x2c7866['uniqueid']][_0x1bb2('0x7')]){recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x2a')]=recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x7')];recordings[_0x2c7866['uniqueid']]['connectedlinename']='';}recordings[_0x2c7866[_0x1bb2('0x4')]][_0x1bb2('0x24')][_0x1bb2('0x2e')](function(_0x3fd010){var _0xdbe991=_['clone'](recordings[_0x2c7866[_0x1bb2('0x4')]]);_0xdbe991[_0x1bb2('0x1f')]=_0x3fd010['value'];writeDB(_0xdbe991);});delete recordings[_0x2c7866[_0x1bb2('0x4')]];}}catch(_0xb12ad0){utils[_0x1bb2('0x14')](util[_0x1bb2('0x2')]('[%s][recordings][hangup]',_0x2c7866[_0x1bb2('0x4')]),_0xb12ad0);}};exports[_0x1bb2('0x2f')]=function(_0x56d16d){try{if(!_[_0x1bb2('0x17')](recordings[_0x56d16d[_0x1bb2('0x4')]])){utils[_0x1bb2('0xe')](util['format'](_0x1bb2('0x30'),_0x56d16d[_0x1bb2('0x4')]),_0x56d16d);utils['info'](util[_0x1bb2('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x56d16d[_0x1bb2('0x4')],_0x56d16d['application'],_0x56d16d[_0x1bb2('0x31')]));if(_0x56d16d[_0x1bb2('0x32')]['toLowerCase']()==_0x1bb2('0x33')&&_[_0x1bb2('0x34')](_0x56d16d['appdata'][_0x1bb2('0x35')](),_0x1bb2('0x36'))){var _0x360ed0=_0x56d16d['appdata']['split']('=');var _0x280a97=_0x360ed0[0x0][_0x1bb2('0x37')](_0x360ed0[0x0][_0x1bb2('0x38')]('(')+0x1,_0x360ed0[0x0][_0x1bb2('0x38')](')'));var _0x29ee09=_0x360ed0[0x1];recordings[_0x56d16d['uniqueid']][_0x280a97]=_0x29ee09;}}}catch(_0x579ce9){utils['error'](util[_0x1bb2('0x2')]('[%s][recordings][newexten]',_0x56d16d[_0x1bb2('0x4')]),_0x579ce9);}};exports['queuecallerjoin']=function(_0x15f131){try{if(!_[_0x1bb2('0x17')](recordings[_0x15f131[_0x1bb2('0x4')]])){utils[_0x1bb2('0xe')](util[_0x1bb2('0x2')](_0x1bb2('0x39'),_0x15f131[_0x1bb2('0x4')]),_0x15f131);utils[_0x1bb2('0x1')](util['format'](_0x1bb2('0x3a'),_0x15f131[_0x1bb2('0x4')],_0x15f131[_0x1bb2('0x3b')]));recordings[_0x15f131[_0x1bb2('0x4')]]['queue']=_0x15f131[_0x1bb2('0x3b')];}}catch(_0x2eecbc){utils[_0x1bb2('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x15f131[_0x1bb2('0x4')]),_0x2eecbc);}};exports[_0x1bb2('0x3c')]=function(_0x2516dd){try{utils[_0x1bb2('0xe')](util[_0x1bb2('0x2')](_0x1bb2('0x3d'),_0x2516dd['uniqueid']),_0x2516dd);utils[_0x1bb2('0x1')](util[_0x1bb2('0x2')](_0x1bb2('0x3e'),_0x2516dd[_0x1bb2('0x4')],_0x2516dd[_0x1bb2('0x3f')],_0x2516dd['transferercalleridname'],_0x2516dd[_0x1bb2('0x40')],_0x2516dd[_0x1bb2('0x41')]));if(recordings[_0x2516dd[_0x1bb2('0x42')]]&&transfers[_0x1bb2('0x5')][_0x2516dd[_0x1bb2('0x42')]]){transfers[_0x1bb2('0x5')][_0x2516dd['transfereruniqueid']][_0x1bb2('0x43')]=!![];}}catch(_0x1a8e8f){utils[_0x1bb2('0x14')](util['format'](_0x1bb2('0x3d'),_0x2516dd[_0x1bb2('0x4')]),_0x1a8e8f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 37fe417..3397838 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 _0x9e86=['transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x1f635c,_0x4d8532){var _0x472cc8=function(_0x5eb126){while(--_0x5eb126){_0x1f635c['push'](_0x1f635c['shift']());}};_0x472cc8(++_0x4d8532);}(_0x9e86,0xc1));var _0x69e8=function(_0x34d0c0,_0x105e5f){_0x34d0c0=_0x34d0c0-0x0;var _0x91c92f=_0x9e86[_0x34d0c0];return _0x91c92f;};'use strict';var _=require(_0x69e8('0x0'));var util=require('util');var utils=require(_0x69e8('0x1'));function writeDB(_0x13173e){utils[_0x69e8('0x2')](util[_0x69e8('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x13173e[_0x69e8('0x4')]==='attended'?_0x13173e[_0x69e8('0x5')]:_0x13173e[_0x69e8('0x6')],_0x13173e['type']));utils['request'](_0x69e8('0x7'),_0x13173e);}exports[_0x69e8('0x8')]={};exports['blindtransfer']=function(_0x25cc4e){try{utils['debug'](util[_0x69e8('0x3')]('[%s][transfers][blindtransfer]',_0x25cc4e['uniqueid']),_0x25cc4e);utils[_0x69e8('0x2')](util[_0x69e8('0x3')](_0x69e8('0x9'),_0x25cc4e[_0x69e8('0x6')],_0x25cc4e['transferercalleridnum'],_0x25cc4e[_0x69e8('0xa')],_0x25cc4e['transfereecalleridnum'],_0x25cc4e[_0x69e8('0xb')]));_0x25cc4e[_0x69e8('0x4')]=_0x69e8('0xc');exports[_0x69e8('0x8')][_0x25cc4e['transfereruniqueid']]=_0x25cc4e;writeDB(_0x25cc4e);}catch(_0x4f3348){utils['error'](util[_0x69e8('0x3')](_0x69e8('0xd'),_0x25cc4e['uniqueid']),_0x4f3348);}};exports[_0x69e8('0xe')]=function(_0x439df8){try{utils[_0x69e8('0xf')](util['format'](_0x69e8('0x10'),_0x439df8[_0x69e8('0x5')]),_0x439df8);utils[_0x69e8('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x439df8[_0x69e8('0x5')],_0x439df8['origtransferercalleridnum'],_0x439df8['origtransferercalleridname'],_0x439df8['transfertargetcalleridnum'],_0x439df8[_0x69e8('0x11')]));_0x439df8=_[_0x69e8('0x12')](_0x439df8,{'transfererchannel':_0x439df8[_0x69e8('0x13')],'transferercalleridnum':_0x439df8[_0x69e8('0x14')],'transferercalleridname':_0x439df8['origtransferercalleridname'],'transfererconnectedlinenum':_0x439df8[_0x69e8('0x15')],'transfererconnectedlinename':_0x439df8[_0x69e8('0x16')],'transfereraccountcode':_0x439df8[_0x69e8('0x17')],'transferercontext':_0x439df8[_0x69e8('0x18')],'transfererexten':_0x439df8[_0x69e8('0x19')],'transfererlinkedid':_0x439df8['origtransfererlinkedid'],'context':_0x439df8[_0x69e8('0x1a')],'extension':_0x439df8[_0x69e8('0x1b')],'type':_0x69e8('0x1c')});if(_[_0x69e8('0x1d')](_0x439df8[_0x69e8('0x1e')])){_0x439df8=_[_0x69e8('0x12')](_0x439df8,{'transfereechannel':_0x439df8[_0x69e8('0x1f')],'transfereecalleridnum':_0x439df8['transfertargetcalleridnum'],'transfereecalleridname':_0x439df8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x439df8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x439df8[_0x69e8('0x20')],'transfereeaccountcode':_0x439df8[_0x69e8('0x21')],'transfereecontext':_0x439df8[_0x69e8('0x22')],'transfereeexten':_0x439df8[_0x69e8('0x23')],'transfereelinkedid':_0x439df8[_0x69e8('0x24')]});}writeDB(_0x439df8);}catch(_0x2ba871){utils[_0x69e8('0x25')](util[_0x69e8('0x3')]('[%s][transfers][attendedtransfer]',_0x439df8[_0x69e8('0x5')]),_0x2ba871);}}; \ No newline at end of file +var _0x0ad7=['blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransferercontext','origtransfererexten','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ad7,0x8c));var _0x70ad=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0ad7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x70ad('0x0'));var util=require(_0x70ad('0x1'));var utils=require(_0x70ad('0x2'));function writeDB(_0x98f0d9){utils[_0x70ad('0x3')](util[_0x70ad('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x98f0d9[_0x70ad('0x5')]===_0x70ad('0x6')?_0x98f0d9[_0x70ad('0x7')]:_0x98f0d9[_0x70ad('0x8')],_0x98f0d9[_0x70ad('0x5')]));utils[_0x70ad('0x9')](_0x70ad('0xa'),_0x98f0d9);}exports[_0x70ad('0xb')]={};exports[_0x70ad('0xc')]=function(_0x513884){try{utils[_0x70ad('0xd')](util[_0x70ad('0x4')](_0x70ad('0xe'),_0x513884['uniqueid']),_0x513884);utils['info'](util['format'](_0x70ad('0xf'),_0x513884[_0x70ad('0x8')],_0x513884[_0x70ad('0x10')],_0x513884[_0x70ad('0x11')],_0x513884[_0x70ad('0x12')],_0x513884['transfereecalleridname']));_0x513884[_0x70ad('0x5')]=_0x70ad('0x13');exports['blinds'][_0x513884[_0x70ad('0x14')]]=_0x513884;writeDB(_0x513884);}catch(_0x453ad1){utils['error'](util[_0x70ad('0x4')](_0x70ad('0xe'),_0x513884[_0x70ad('0x8')]),_0x453ad1);}};exports[_0x70ad('0x15')]=function(_0x4cd157){try{utils['debug'](util[_0x70ad('0x4')]('[%s][transfers][attendedtransfer]',_0x4cd157['origtransfereruniqueid']),_0x4cd157);utils[_0x70ad('0x3')](util[_0x70ad('0x4')](_0x70ad('0x16'),_0x4cd157[_0x70ad('0x7')],_0x4cd157[_0x70ad('0x17')],_0x4cd157[_0x70ad('0x18')],_0x4cd157['transfertargetcalleridnum'],_0x4cd157[_0x70ad('0x19')]));_0x4cd157=_[_0x70ad('0x1a')](_0x4cd157,{'transfererchannel':_0x4cd157[_0x70ad('0x1b')],'transferercalleridnum':_0x4cd157[_0x70ad('0x17')],'transferercalleridname':_0x4cd157[_0x70ad('0x18')],'transfererconnectedlinenum':_0x4cd157['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4cd157[_0x70ad('0x1c')],'transfereraccountcode':_0x4cd157['origtransfereraccountcode'],'transferercontext':_0x4cd157['secondtransferercontext'],'transfererexten':_0x4cd157['secondtransfererexten'],'transfererlinkedid':_0x4cd157['origtransfererlinkedid'],'context':_0x4cd157[_0x70ad('0x1d')],'extension':_0x4cd157[_0x70ad('0x1e')],'type':_0x70ad('0x6')});if(_['isNil'](_0x4cd157[_0x70ad('0x1f')])){_0x4cd157=_[_0x70ad('0x1a')](_0x4cd157,{'transfereechannel':_0x4cd157['transfertargetchannel'],'transfereecalleridnum':_0x4cd157[_0x70ad('0x20')],'transfereecalleridname':_0x4cd157[_0x70ad('0x19')],'transfereeconnectedlinenum':_0x4cd157[_0x70ad('0x21')],'transfereeconnectedlinename':_0x4cd157[_0x70ad('0x22')],'transfereeaccountcode':_0x4cd157[_0x70ad('0x23')],'transfereecontext':_0x4cd157[_0x70ad('0x24')],'transfereeexten':_0x4cd157[_0x70ad('0x25')],'transfereelinkedid':_0x4cd157['transfertargetlinkedid']});}writeDB(_0x4cd157);}catch(_0x444662){utils['error'](util[_0x70ad('0x4')]('[%s][transfers][attendedtransfer]',_0x4cd157[_0x70ad('0x7')]),_0x444662);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 78f8e69..4e36510 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 _0x667c=['GetUser','internal','name','interface','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','sumTime','now','isAfter','isBefore','bluebird','util','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0x19aee6,_0xcb2918){var _0x511975=function(_0x4fbb42){while(--_0x4fbb42){_0x19aee6['push'](_0x19aee6['shift']());}};_0x511975(++_0xcb2918);}(_0x667c,0xcb));var _0xc667=function(_0x58fa4c,_0x336670){_0x58fa4c=_0x58fa4c-0x0;var _0x33d73f=_0x667c[_0x58fa4c];return _0x33d73f;};'use strict';var BPromise=require(_0xc667('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0xc667('0x1'));var client=jayson[_0xc667('0x2')][_0xc667('0x3')]({'port':0x2329});var logger=require(_0xc667('0x4'))('xdr');exports['info']=function(_0x341efd,_0x3dd155){logger[_0xc667('0x5')](_0x341efd,_0x3dd155?util[_0xc667('0x6')](_0x3dd155,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x539ada,_0x2eb8d0){logger[_0xc667('0x7')](_0x539ada,_0x2eb8d0?util[_0xc667('0x6')](_0x2eb8d0,{'showHidden':![],'depth':null}):'');};exports[_0xc667('0x8')]=function(_0x3c616a,_0x2543a7){logger[_0xc667('0x8')](_0x3c616a,_0x2543a7?util['inspect'](_0x2543a7,{'showHidden':![],'depth':null}):'');};exports[_0xc667('0x9')]=function(_0x13386f,_0x13b5e6){return client[_0xc667('0x9')](_0x13386f,{'body':_0x13b5e6})[_0xc667('0xa')](function(_0x4e9ab2){logger[_0xc667('0x7')]('[utils][request]\x20name:%s',_0x13386f,_0x4e9ab2?util[_0xc667('0x6')](_0x4e9ab2,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x31819e){logger[_0xc667('0x8')](_0xc667('0xb'),_0x13386f,_0x31819e?util[_0xc667('0x6')](_0x31819e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x7d6e7f){return client[_0xc667('0x9')](_0xc667('0xc'),{'options':{'raw':!![],'attributes':['id',_0xc667('0xd'),_0xc667('0xe'),_0xc667('0xf')],'where':_0x7d6e7f,'limit':0x1}})[_0xc667('0xa')](function(_0x4ea9df){logger[_0xc667('0x7')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x7d6e7f),_0x4ea9df?util[_0xc667('0x6')](_0x4ea9df,{'showHidden':![],'depth':null}):'');return _0x4ea9df[_0xc667('0x10')][_0xc667('0x11')]?_0x4ea9df[_0xc667('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x170b3c){return new BPromise(function(_0x230d52,_0x4436c9){if(_0x170b3c){return getUser({'internal':_0x170b3c})[_0xc667('0xa')](function(_0x4c626f){logger[_0xc667('0x5')](_0xc667('0x12'),_0x170b3c,_0x4c626f?_0xc667('0x13'):_0xc667('0x14'));return _0x230d52(_0x4c626f);})[_0xc667('0x15')](function(_0x2d0500){logger['error']('[utils][getUserByInternal]',_0x2d0500?util[_0xc667('0x6')](_0x2d0500,{'showHidden':![],'depth':null}):'');return _0x230d52(null);});}return _0x230d52(null);});};exports[_0xc667('0x16')]=function(_0x94c6f2){return new BPromise(function(_0x58e5b8,_0x484051){if(_0x94c6f2){return getUser({'interface':_0x94c6f2})[_0xc667('0xa')](function(_0x2d7dbd){logger[_0xc667('0x5')](_0xc667('0x17'),_0x94c6f2,_0x2d7dbd?_0xc667('0x13'):_0xc667('0x14'));return _0x58e5b8(_0x2d7dbd);})[_0xc667('0x15')](function(_0x58bf7b){logger[_0xc667('0x8')](_0xc667('0x18'),_0x58bf7b?util['inspect'](_0x58bf7b,{'showHidden':![],'depth':null}):'');return _0x58e5b8(null);});}return _0x58e5b8(null);});};exports['getUserByName']=function(_0x5149dd){return new BPromise(function(_0x42c65d,_0x5be792){if(_0x5149dd){return getUser({'name':_0x5149dd})[_0xc667('0xa')](function(_0x1261aa){logger[_0xc667('0x5')](_0xc667('0x19'),_0x5149dd,_0x1261aa?'found':_0xc667('0x14'));return _0x42c65d(_0x1261aa);})[_0xc667('0x15')](function(_0xe7cc19){logger[_0xc667('0x8')](_0xc667('0x1a'),_0xe7cc19?util[_0xc667('0x6')](_0xe7cc19,{'showHidden':![],'depth':null}):'');return _0x42c65d(null);});}return _0x42c65d(null);});};exports[_0xc667('0x1b')]=function(_0x2f992a){return new BPromise(function(_0x1e91da,_0x4c5d16){if(_0x2f992a){return client[_0xc667('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xc667('0xe'),_0xc667('0x1c'),'acw',_0xc667('0x1d')],'where':{'name':_0x2f992a},'limit':0x1}})['then'](function(_0x2dffa3){logger[_0xc667('0x7')](_0xc667('0x1e'),_0x2f992a,_0x2dffa3?util[_0xc667('0x6')](_0x2dffa3,{'showHidden':![],'depth':null}):'');logger['info'](_0xc667('0x1f'),_0x2f992a,_0x2dffa3?_0xc667('0x13'):_0xc667('0x14'));return _0x1e91da(_0x2dffa3['result'][_0xc667('0x11')]?_0x2dffa3[_0xc667('0x10')][0x0]:null);})[_0xc667('0x15')](function(_0xaa32c1){logger[_0xc667('0x8')](_0xc667('0x20'),_0xaa32c1?util[_0xc667('0x6')](_0xaa32c1,{'showHidden':![],'depth':null}):'');return _0x1e91da(null);});}return _0x1e91da(null);});};exports['addTime']=function(_0x53643b,_0x5c2b9d){return moment(_0x53643b)['add'](_0x5c2b9d,'seconds')[_0xc667('0x21')](_0xc667('0x22'));};exports[_0xc667('0x23')]=function(_0x44acee,_0xa45446){return moment(_0x44acee)[_0xc667('0x24')](_0xa45446,_0xc667('0x25'))[_0xc667('0x21')](_0xc667('0x22'));};exports[_0xc667('0x26')]=function(_0x241c11,_0x35b7de){return moment(_0x241c11)['diff'](moment(_0x35b7de),_0xc667('0x25'));};exports[_0xc667('0x27')]=function(_0xc8637,_0x271d56){return parseInt(_0xc8637,0xa)+parseInt(_0x271d56,0xa);};exports[_0xc667('0x28')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc667('0x29')]=function(_0x17d046,_0x308e95){if(_0x308e95){return moment(_0x17d046)[_0xc667('0x29')](_0x308e95);}return!![];};exports[_0xc667('0x2a')]=function(_0x133523,_0x218d05){if(_0x218d05){return moment(_0x133523)[_0xc667('0x2a')](_0x218d05);}else if(_0x133523){return!![];}return![];}; \ No newline at end of file +var _0x0b0a=['http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client'];(function(_0x5f0b6e,_0x440bc3){var _0x48d913=function(_0x1b1952){while(--_0x1b1952){_0x5f0b6e['push'](_0x5f0b6e['shift']());}};_0x48d913(++_0x440bc3);}(_0x0b0a,0x1c7));var _0xa0b0=function(_0x25a951,_0xfc031b){_0x25a951=_0x25a951-0x0;var _0x2b1815=_0x0b0a[_0x25a951];return _0x2b1815;};'use strict';var BPromise=require(_0xa0b0('0x0'));var jayson=require(_0xa0b0('0x1'));var moment=require(_0xa0b0('0x2'));var util=require(_0xa0b0('0x3'));var client=jayson[_0xa0b0('0x4')][_0xa0b0('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xa0b0('0x6'));exports['info']=function(_0x4727b8,_0x27a5d6){logger[_0xa0b0('0x7')](_0x4727b8,_0x27a5d6?util[_0xa0b0('0x8')](_0x27a5d6,{'showHidden':![],'depth':null}):'');};exports[_0xa0b0('0x9')]=function(_0x246b2b,_0x99fd47){logger[_0xa0b0('0x9')](_0x246b2b,_0x99fd47?util['inspect'](_0x99fd47,{'showHidden':![],'depth':null}):'');};exports[_0xa0b0('0xa')]=function(_0x377827,_0x57b100){logger['error'](_0x377827,_0x57b100?util[_0xa0b0('0x8')](_0x57b100,{'showHidden':![],'depth':null}):'');};exports[_0xa0b0('0xb')]=function(_0x368b54,_0x6f80f7){return client[_0xa0b0('0xb')](_0x368b54,{'body':_0x6f80f7})[_0xa0b0('0xc')](function(_0x30b52a){logger[_0xa0b0('0x9')](_0xa0b0('0xd'),_0x368b54,_0x30b52a?util[_0xa0b0('0x8')](_0x30b52a,{'showHidden':![],'depth':null}):'');})[_0xa0b0('0xe')](function(_0x584f04){logger[_0xa0b0('0xa')](_0xa0b0('0xd'),_0x368b54,_0x584f04?util[_0xa0b0('0x8')](_0x584f04,{'showHidden':![],'depth':null}):'');});};function getUser(_0x22c15f){return client[_0xa0b0('0xb')](_0xa0b0('0xf'),{'options':{'raw':!![],'attributes':['id',_0xa0b0('0x10'),_0xa0b0('0x11'),_0xa0b0('0x12')],'where':_0x22c15f,'limit':0x1}})['then'](function(_0x5b45a3){logger[_0xa0b0('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xa0b0('0x13')](_0x22c15f),_0x5b45a3?util['inspect'](_0x5b45a3,{'showHidden':![],'depth':null}):'');return _0x5b45a3[_0xa0b0('0x14')][_0xa0b0('0x15')]?_0x5b45a3['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x214292){return new BPromise(function(_0x31afc0,_0x349c0b){if(_0x214292){return getUser({'internal':_0x214292})[_0xa0b0('0xc')](function(_0x17f76c){logger[_0xa0b0('0x7')](_0xa0b0('0x16'),_0x214292,_0x17f76c?_0xa0b0('0x17'):_0xa0b0('0x18'));return _0x31afc0(_0x17f76c);})[_0xa0b0('0xe')](function(_0x159413){logger['error'](_0xa0b0('0x19'),_0x159413?util[_0xa0b0('0x8')](_0x159413,{'showHidden':![],'depth':null}):'');return _0x31afc0(null);});}return _0x31afc0(null);});};exports['getUserByInterface']=function(_0x4d9219){return new BPromise(function(_0x2f7eb0,_0x508d55){if(_0x4d9219){return getUser({'interface':_0x4d9219})[_0xa0b0('0xc')](function(_0x211fc3){logger[_0xa0b0('0x7')](_0xa0b0('0x1a'),_0x4d9219,_0x211fc3?_0xa0b0('0x17'):_0xa0b0('0x18'));return _0x2f7eb0(_0x211fc3);})[_0xa0b0('0xe')](function(_0x1011c9){logger[_0xa0b0('0xa')](_0xa0b0('0x1b'),_0x1011c9?util[_0xa0b0('0x8')](_0x1011c9,{'showHidden':![],'depth':null}):'');return _0x2f7eb0(null);});}return _0x2f7eb0(null);});};exports[_0xa0b0('0x1c')]=function(_0x449555){return new BPromise(function(_0x852ec7,_0x440343){if(_0x449555){return getUser({'name':_0x449555})[_0xa0b0('0xc')](function(_0x19c902){logger['info'](_0xa0b0('0x1d'),_0x449555,_0x19c902?_0xa0b0('0x17'):'notfound');return _0x852ec7(_0x19c902);})['catch'](function(_0x2f2402){logger['error'](_0xa0b0('0x1e'),_0x2f2402?util[_0xa0b0('0x8')](_0x2f2402,{'showHidden':![],'depth':null}):'');return _0x852ec7(null);});}return _0x852ec7(null);});};exports[_0xa0b0('0x1f')]=function(_0x1d3b74){return new BPromise(function(_0x1fa01e,_0x27e027){if(_0x1d3b74){return client[_0xa0b0('0xb')](_0xa0b0('0x20'),{'options':{'raw':!![],'attributes':['id','name',_0xa0b0('0x21'),'acw',_0xa0b0('0x22')],'where':{'name':_0x1d3b74},'limit':0x1}})[_0xa0b0('0xc')](function(_0x43c8e8){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x1d3b74,_0x43c8e8?util['inspect'](_0x43c8e8,{'showHidden':![],'depth':null}):'');logger[_0xa0b0('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1d3b74,_0x43c8e8?_0xa0b0('0x17'):_0xa0b0('0x18'));return _0x1fa01e(_0x43c8e8[_0xa0b0('0x14')][_0xa0b0('0x15')]?_0x43c8e8[_0xa0b0('0x14')][0x0]:null);})['catch'](function(_0x3de493){logger[_0xa0b0('0xa')](_0xa0b0('0x23'),_0x3de493?util[_0xa0b0('0x8')](_0x3de493,{'showHidden':![],'depth':null}):'');return _0x1fa01e(null);});}return _0x1fa01e(null);});};exports['addTime']=function(_0x26038d,_0x4a3a61){return moment(_0x26038d)[_0xa0b0('0x24')](_0x4a3a61,_0xa0b0('0x25'))[_0xa0b0('0x26')](_0xa0b0('0x27'));};exports[_0xa0b0('0x28')]=function(_0x201efa,_0x1d9c13){return moment(_0x201efa)[_0xa0b0('0x29')](_0x1d9c13,_0xa0b0('0x25'))[_0xa0b0('0x26')](_0xa0b0('0x27'));};exports[_0xa0b0('0x2a')]=function(_0x5156f1,_0xc4125f){return moment(_0x5156f1)['diff'](moment(_0xc4125f),'seconds');};exports[_0xa0b0('0x2b')]=function(_0x505650,_0x20f283){return parseInt(_0x505650,0xa)+parseInt(_0x20f283,0xa);};exports['now']=function(){return moment()['format'](_0xa0b0('0x27'));};exports[_0xa0b0('0x2c')]=function(_0x5e1f29,_0x1acb72){if(_0x1acb72){return moment(_0x5e1f29)[_0xa0b0('0x2c')](_0x1acb72);}return!![];};exports[_0xa0b0('0x2d')]=function(_0x413e9e,_0x4407ca){if(_0x4407ca){return moment(_0x413e9e)[_0xa0b0('0x2d')](_0x4407ca);}else if(_0x413e9e){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index cca5ff5..4788fbb 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29da=['/var','role','name','ensureDir','then','catch','log','user','data','timestamp','client','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join'];(function(_0x4d0d77,_0x5723de){var _0x56a9f4=function(_0x3dd5ab){while(--_0x3dd5ab){_0x4d0d77['push'](_0x4d0d77['shift']());}};_0x56a9f4(++_0x5723de);}(_0x29da,0x17d));var _0xa29d=function(_0x3922ec,_0x39fddb){_0x3922ec=_0x3922ec-0x0;var _0x26fc74=_0x29da[_0x3922ec];return _0x26fc74;};var fs=require(_0xa29d('0x0'));var _=require(_0xa29d('0x1'));var ewinston=require('express-winston');var path=require(_0xa29d('0x2'));var util=require(_0xa29d('0x3'));var fileLogger=require(_0xa29d('0x4'))[_0xa29d('0x5')];var safeTemplate=require(_0xa29d('0x6'))[_0xa29d('0x7')];var maskSensitiveData=require(_0xa29d('0x8'))[_0xa29d('0x9')];function ClientSideLogger(){function _0x1be427(_0xb7346c){var _0x3ecb26=path[_0xa29d('0xa')](_0xa29d('0xb'),'log','xcally');var _0x5786eb=path[_0xa29d('0xa')]('client',_0xb7346c[_0xa29d('0xc')]+'-'+_0xb7346c[_0xa29d('0xd')]);return fs[_0xa29d('0xe')](path[_0xa29d('0xa')](_0x3ecb26,_0x5786eb))[_0xa29d('0xf')](function(){var _0xc89d60=fileLogger('client',path['join'](_0x3ecb26,_0x5786eb));return _0xc89d60;})[_0xa29d('0x10')](function(_0x56ad89){throw _0x56ad89;});}this[_0xa29d('0x11')]=function(_0x6d322a,_0x59129b,_0x3ab145,_0x1075e7){return _0x1be427(_0x6d322a[_0xa29d('0x12')])[_0xa29d('0xf')](function(_0x3e3511){var _0x2e0218=_0x3e3511[_0x59129b];return _0x2e0218;})[_0xa29d('0xf')](function(_0x57c5d4){var _0x4d234a=_0x6d322a[_0xa29d('0x12')]?_0x6d322a['user']['id']:'no-user';var _0x107fbf=_0x1075e7[_0xa29d('0x13')];var _0x34b6a8=_0x1075e7[_0xa29d('0x14')];var _0x1689e6=new Date(Number(_0x34b6a8));return _0x57c5d4(_0x4d234a,_0x1689e6,_0x3ab145,_0x107fbf);})[_0xa29d('0x10')](function(_0x75a6a5){fileLogger(_0xa29d('0x15'))[_0xa29d('0x16')](_0x75a6a5);});};}function setupLoggers(_0x36d34b){return new Promise(function(_0xf79bfa){var _0x486580=new ClientSideLogger();var _0x45e0ee=fileLogger(_0xa29d('0x17'));var _0x1d2c87=fileLogger(_0xa29d('0x18'));_0x36d34b[_0xa29d('0x19')]('client-side-logger',_0x486580);_0x36d34b[_0xa29d('0x1a')](ewinston[_0xa29d('0x1b')]({'winstonInstance':_0x45e0ee,'meta':![],'statusLevels':!![],'msg':function(_0x2982a9,_0x59220b){var _0x1c6a3e=_0xa29d('0x1c');if(!_['isEmpty'](_0x2982a9[_0xa29d('0x1d')])){_0x1c6a3e+=_0xa29d('0x1e');var _0x3b319e=_0x2982a9[_0xa29d('0x1d')];maskSensitiveData(_0x3b319e);}return safeTemplate(util[_0xa29d('0x1f')](_0x1c6a3e,_0x2982a9[_0xa29d('0x20')],_0x2982a9[_0xa29d('0x21')][_0xa29d('0x22')]?_0x2982a9['headers'][_0xa29d('0x22')]:_0x2982a9[_0xa29d('0x23')][_0xa29d('0x24')]||_0x2982a9['ip'],_0x2982a9[_0xa29d('0x25')],_0x59220b[_0xa29d('0x26')],_0x59220b['responseTime'],_0x2982a9[_0xa29d('0x12')]?_0x2982a9[_0xa29d('0x12')]['id']:null,_0x2982a9['user']?_0x2982a9[_0xa29d('0x12')][_0xa29d('0xd')]:null,_0x2982a9[_0xa29d('0x12')]?_0x2982a9['user'][_0xa29d('0xc')]:null,_0x3b319e?util[_0xa29d('0x27')](_0x3b319e,![],null):''));}}));_0x36d34b['use'](ewinston['logger']({'winstonInstance':_0x1d2c87,'meta':![],'statusLevels':!![],'msg':function(_0x593438,_0x2504ae){var _0x120228=_0xa29d('0x28');if(_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x29')]&&_0x593438[_0xa29d('0x1d')]['agent_id']){_0x120228=_0xa29d('0x2a');}return util[_0xa29d('0x1f')](_0x120228,_0x593438['method'],_0x593438[_0xa29d('0x21')][_0xa29d('0x22')]?_0x593438[_0xa29d('0x21')][_0xa29d('0x22')]:_0x593438['connection'][_0xa29d('0x24')]||_0x593438['ip'],_0x593438[_0xa29d('0x25')],_0x2504ae[_0xa29d('0x26')],_0x2504ae[_0xa29d('0x2b')],_0x593438['user']?_0x593438[_0xa29d('0x12')]['id']:null,_0x593438[_0xa29d('0x12')]?_0x593438[_0xa29d('0x12')]['name']:null,_0x593438['user']?_0x593438[_0xa29d('0x12')]['role']:null,_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x29')]?_0x593438['body'][_0xa29d('0x29')]:_0xa29d('0x2c'),_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x2d')]?_0x593438[_0xa29d('0x1d')][_0xa29d('0x2d')]:'',_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x2e')]?_0x593438[_0xa29d('0x1d')][_0xa29d('0x2e')]:'');},'ignoreRoute':function(_0x24d6b9){var _0x359fca=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x359fca[_0xa29d('0x2f')](_0x24d6b9['url']);}}));return _0xf79bfa();});}exports[_0xa29d('0x30')]=setupLoggers; \ No newline at end of file +var _0x9589=['maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','then','catch','log','user','no-user','data','error','api','auth','set','client-side-logger','use','logger','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','device','other','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data'];(function(_0x2270e0,_0x551309){var _0x1521b1=function(_0x2c5439){while(--_0x2c5439){_0x2270e0['push'](_0x2270e0['shift']());}};_0x1521b1(++_0x551309);}(_0x9589,0x1b0));var _0x9958=function(_0x2986ae,_0x3f4bcb){_0x2986ae=_0x2986ae-0x0;var _0x5b52ca=_0x9589[_0x2986ae];return _0x5b52ca;};var fs=require(_0x9958('0x0'));var _=require(_0x9958('0x1'));var ewinston=require(_0x9958('0x2'));var path=require(_0x9958('0x3'));var util=require(_0x9958('0x4'));var fileLogger=require(_0x9958('0x5'))[_0x9958('0x6')];var safeTemplate=require(_0x9958('0x7'))['safeTemplate'];var maskSensitiveData=require(_0x9958('0x8'))[_0x9958('0x9')];function ClientSideLogger(){function _0x11c831(_0x12a9e9){var _0x5cbc1e=path[_0x9958('0xa')](_0x9958('0xb'),'log',_0x9958('0xc'));var _0x5e7df4=path[_0x9958('0xa')](_0x9958('0xd'),_0x12a9e9[_0x9958('0xe')]+'-'+_0x12a9e9[_0x9958('0xf')]);return fs[_0x9958('0x10')](path['join'](_0x5cbc1e,_0x5e7df4))[_0x9958('0x11')](function(){var _0xa19ac3=fileLogger('client',path[_0x9958('0xa')](_0x5cbc1e,_0x5e7df4));return _0xa19ac3;})[_0x9958('0x12')](function(_0x52f129){throw _0x52f129;});}this[_0x9958('0x13')]=function(_0x3a25bf,_0x32e5d4,_0x2e2bf3,_0x14ec6c){return _0x11c831(_0x3a25bf[_0x9958('0x14')])['then'](function(_0x4ddb48){var _0x3db8f8=_0x4ddb48[_0x32e5d4];return _0x3db8f8;})['then'](function(_0x1d0d77){var _0x67acc2=_0x3a25bf[_0x9958('0x14')]?_0x3a25bf['user']['id']:_0x9958('0x15');var _0x1b8923=_0x14ec6c[_0x9958('0x16')];var _0x1b995b=_0x14ec6c['timestamp'];var _0x4d1a71=new Date(Number(_0x1b995b));return _0x1d0d77(_0x67acc2,_0x4d1a71,_0x2e2bf3,_0x1b8923);})[_0x9958('0x12')](function(_0x53ae6b){fileLogger(_0x9958('0xd'))[_0x9958('0x17')](_0x53ae6b);});};}function setupLoggers(_0x4f1fc2){return new Promise(function(_0x472de7){var _0x284f63=new ClientSideLogger();var _0x2de686=fileLogger(_0x9958('0x18'));var _0x1115cb=fileLogger(_0x9958('0x19'));_0x4f1fc2[_0x9958('0x1a')](_0x9958('0x1b'),_0x284f63);_0x4f1fc2[_0x9958('0x1c')](ewinston[_0x9958('0x1d')]({'winstonInstance':_0x2de686,'meta':![],'statusLevels':!![],'msg':function(_0x5ceab0,_0xcb7c19){var _0x17df03='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x9958('0x1e')](_0x5ceab0['body'])){_0x17df03+=_0x9958('0x1f');var _0xc5a1d4=_0x5ceab0[_0x9958('0x20')];maskSensitiveData(_0xc5a1d4);}return safeTemplate(util[_0x9958('0x21')](_0x17df03,_0x5ceab0[_0x9958('0x22')],_0x5ceab0[_0x9958('0x23')][_0x9958('0x24')]?_0x5ceab0[_0x9958('0x23')][_0x9958('0x24')]:_0x5ceab0[_0x9958('0x25')][_0x9958('0x26')]||_0x5ceab0['ip'],_0x5ceab0[_0x9958('0x27')],_0xcb7c19[_0x9958('0x28')],_0xcb7c19['responseTime'],_0x5ceab0['user']?_0x5ceab0['user']['id']:null,_0x5ceab0[_0x9958('0x14')]?_0x5ceab0['user'][_0x9958('0xf')]:null,_0x5ceab0[_0x9958('0x14')]?_0x5ceab0[_0x9958('0x14')][_0x9958('0xe')]:null,_0xc5a1d4?util[_0x9958('0x29')](_0xc5a1d4,![],null):''));}}));_0x4f1fc2[_0x9958('0x1c')](ewinston[_0x9958('0x1d')]({'winstonInstance':_0x1115cb,'meta':![],'statusLevels':!![],'msg':function(_0x24ce7f,_0x133f3f){var _0x8054c1='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x24ce7f[_0x9958('0x20')]&&_0x24ce7f['body']['device']&&_0x24ce7f['body'][_0x9958('0x2a')]){_0x8054c1=_0x9958('0x2b');}return util[_0x9958('0x21')](_0x8054c1,_0x24ce7f[_0x9958('0x22')],_0x24ce7f['headers']['x-forwarded-for']?_0x24ce7f[_0x9958('0x23')][_0x9958('0x24')]:_0x24ce7f[_0x9958('0x25')][_0x9958('0x26')]||_0x24ce7f['ip'],_0x24ce7f[_0x9958('0x27')],_0x133f3f[_0x9958('0x28')],_0x133f3f[_0x9958('0x2c')],_0x24ce7f[_0x9958('0x14')]?_0x24ce7f['user']['id']:null,_0x24ce7f['user']?_0x24ce7f[_0x9958('0x14')]['name']:null,_0x24ce7f[_0x9958('0x14')]?_0x24ce7f['user'][_0x9958('0xe')]:null,_0x24ce7f[_0x9958('0x20')]&&_0x24ce7f['body'][_0x9958('0x2d')]?_0x24ce7f['body'][_0x9958('0x2d')]:_0x9958('0x2e'),_0x24ce7f[_0x9958('0x20')]&&_0x24ce7f['body'][_0x9958('0x2a')]?_0x24ce7f['body'][_0x9958('0x2a')]:'',_0x24ce7f[_0x9958('0x20')]&&_0x24ce7f['body'][_0x9958('0x2f')]?_0x24ce7f[_0x9958('0x20')][_0x9958('0x2f')]:'');},'ignoreRoute':function(_0x599eea){var _0x500849=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x500849[_0x9958('0x30')](_0x599eea[_0x9958('0x27')]);}}));return _0x472de7();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 2897957..5c4783c 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x067d=['bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','path','util','moment','winston','debugLevel','toLowerCase','info','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue'];(function(_0x47f8cb,_0x44459e){var _0x24a7d6=function(_0x33aa4e){while(--_0x33aa4e){_0x47f8cb['push'](_0x47f8cb['shift']());}};_0x24a7d6(++_0x44459e);}(_0x067d,0xa4));var _0xd067=function(_0x243481,_0x33ba56){_0x243481=_0x243481-0x0;var _0x3c7a5c=_0x067d[_0x243481];return _0x3c7a5c;};'use strict';var path=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var moment=require(_0xd067('0x2'));var winston=require(_0xd067('0x3'));var config=require('../config/environment');var debugLevel=config[_0xd067('0x4')]?config[_0xd067('0x4')][_0xd067('0x5')]():_0xd067('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':'bold\x20yellow','info':'white','print':_0xd067('0x7'),'success':_0xd067('0x8'),'http':'gray','verbose':_0xd067('0x9'),'debug':_0xd067('0xa'),'silly':_0xd067('0xb')};winston[_0xd067('0xc')](XC_LOG_COLORS);function getLogFileName(_0x2e1996,_0x1bb09f,_0x4ada05){var _0x34162a=_0x2e1996||_0xd067('0xd');return path[_0xd067('0xe')](_0x34162a,util['format'](_0xd067('0xf'),_0x1bb09f,_0x4ada05));}function formatter(_0x1bba7f,_0x50da08){_0x50da08[_0xd067('0x10')]=_0x50da08[_0xd067('0x10')]['replace'](/@@{/g,_0xd067('0x11'))[_0xd067('0x12')](/}@@/g,_0xd067('0x13'))[_0xd067('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xd067('0x14')](_0xd067('0x15'),moment()[_0xd067('0x14')](_0xd067('0x16')),_0x50da08[_0xd067('0x17')][_0xd067('0x18')](),_0x1bba7f,_0x50da08[_0xd067('0x10')]);}function fileFormat(_0x4dc62d,_0xd0b433){_0xd0b433[_0xd067('0x10')]=_0xd0b433[_0xd067('0x10')][_0xd067('0x12')](/@@{/g,'{{{')['replace'](/}@@/g,_0xd067('0x13'))[_0xd067('0x12')](/@{/g,'{{')[_0xd067('0x12')](/}@/g,'}}');var _0x3bd441=_0xd0b433[_0xd067('0x19')]&&Object['keys'](_0xd0b433['meta'])[_0xd067('0x1a')]?'\x0a\x09'+JSON[_0xd067('0x1b')](_0xd0b433[_0xd067('0x19')]):'';return util[_0xd067('0x14')](_0xd067('0x1c'),moment()['format'](_0xd067('0x16')),_0xd0b433[_0xd067('0x17')][_0xd067('0x18')](),_0x4dc62d,_0xd0b433[_0xd067('0x10')],_0x3bd441);}function consoleLogger(){var _0x4f92b8=new winston[(_0xd067('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd067('0x1e'))][(_0xd067('0x1f'))]({'level':_0xd067('0x20'),'json':![],'formatter':function(_0x57588e){return formatter('',_0x57588e);}})]});return _0x4f92b8;}function fileLogger(_0x3f5d3a,_0x3b7373){var _0x3945f3=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xd067('0x14')](_0xd067('0x21'),_0x3f5d3a,'error'),'filename':getLogFileName(_0x3b7373,_0x3f5d3a,_0xd067('0x22')),'level':_0xd067('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a0c88){return fileFormat(_0x3f5d3a,_0x5a0c88);}}),new winston['transports']['File']({'name':util[_0xd067('0x14')](_0xd067('0x21'),_0x3f5d3a,debugLevel),'filename':getLogFileName(_0x3b7373,_0x3f5d3a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5aab49){return fileFormat(_0x3f5d3a,_0x5aab49);}}),new winston['transports'][(_0xd067('0x1f'))]({'level':_0xd067('0x20'),'json':![],'formatter':function(_0x4c0965){return fileFormat(_0x3f5d3a,_0x4c0965);}})]});return _0x3945f3;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0xbb1a=['consoleLogger','fileLogger','path','util','moment','winston','../config/environment','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','format','%s-%s.log','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','length','stringify','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','File','%s-%s','error','warn'];(function(_0x2fe299,_0x2e1408){var _0x3e7659=function(_0x399706){while(--_0x399706){_0x2fe299['push'](_0x2fe299['shift']());}};_0x3e7659(++_0x2e1408);}(_0xbb1a,0x105));var _0xabb1=function(_0x45edad,_0x623046){_0x45edad=_0x45edad-0x0;var _0x20a540=_0xbb1a[_0x45edad];return _0x20a540;};'use strict';var path=require(_0xabb1('0x0'));var util=require(_0xabb1('0x1'));var moment=require(_0xabb1('0x2'));var winston=require(_0xabb1('0x3'));var config=require(_0xabb1('0x4'));var debugLevel=config['debugLevel']?config['debugLevel'][_0xabb1('0x5')]():_0xabb1('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xabb1('0x7'),'warn':_0xabb1('0x8'),'info':_0xabb1('0x9'),'print':_0xabb1('0xa'),'success':'bold\x20green','http':_0xabb1('0xb'),'verbose':'bold\x20magenta','debug':_0xabb1('0xc'),'silly':_0xabb1('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x3d5f99,_0x4c2e27,_0x24faba){var _0x383a2c=_0x3d5f99||_0xabb1('0xe');return path['join'](_0x383a2c,util[_0xabb1('0xf')](_0xabb1('0x10'),_0x4c2e27,_0x24faba));}function formatter(_0x32e144,_0x9aace4){_0x9aace4['message']=_0x9aace4['message'][_0xabb1('0x11')](/@@{/g,_0xabb1('0x12'))[_0xabb1('0x11')](/}@@/g,_0xabb1('0x13'))[_0xabb1('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xabb1('0xf')](_0xabb1('0x14')),_0x9aace4[_0xabb1('0x15')][_0xabb1('0x16')](),_0x32e144,_0x9aace4['message']);}function fileFormat(_0x43ab1c,_0x318c18){_0x318c18[_0xabb1('0x17')]=_0x318c18[_0xabb1('0x17')]['replace'](/@@{/g,'{{{')[_0xabb1('0x11')](/}@@/g,'}}}')[_0xabb1('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x53e880=_0x318c18['meta']&&Object['keys'](_0x318c18['meta'])[_0xabb1('0x18')]?'\x0a\x09'+JSON[_0xabb1('0x19')](_0x318c18[_0xabb1('0x1a')]):'';return util['format'](_0xabb1('0x1b'),moment()[_0xabb1('0xf')](_0xabb1('0x14')),_0x318c18[_0xabb1('0x15')][_0xabb1('0x16')](),_0x43ab1c,_0x318c18[_0xabb1('0x17')],_0x53e880);}function consoleLogger(){var _0x3e0bed=new winston[(_0xabb1('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xabb1('0x1d'))][(_0xabb1('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x18b299){return formatter('',_0x18b299);}})]});return _0x3e0bed;}function fileLogger(_0x1f7868,_0x1c78c2){var _0x2576c4=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xabb1('0x1f'))]({'name':util[_0xabb1('0xf')](_0xabb1('0x20'),_0x1f7868,'error'),'filename':getLogFileName(_0x1c78c2,_0x1f7868,_0xabb1('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1f0b0d){return fileFormat(_0x1f7868,_0x1f0b0d);}}),new winston[(_0xabb1('0x1d'))][(_0xabb1('0x1f'))]({'name':util[_0xabb1('0xf')]('%s-%s',_0x1f7868,debugLevel),'filename':getLogFileName(_0x1c78c2,_0x1f7868,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x259f80){return fileFormat(_0x1f7868,_0x259f80);}}),new winston[(_0xabb1('0x1d'))]['Console']({'level':_0xabb1('0x22'),'json':![],'formatter':function(_0x2d84cf){return fileFormat(_0x1f7868,_0x2d84cf);}})]});return _0x2576c4;}exports[_0xabb1('0x23')]=consoleLogger;exports[_0xabb1('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 898d082..d2497e1 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb28,0x106));var _0x8db2=function(_0x1c122f,_0x490a59){_0x1c122f=_0x1c122f-0x0;var _0x768473=_0xdb28[_0x1c122f];return _0x768473;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x1ad805,_0x2dcf2d){var _0x366d90=function(_0x2fa8bd){while(--_0x2fa8bd){_0x1ad805['push'](_0x1ad805['shift']());}};_0x366d90(++_0x2dcf2d);}(_0xadb5,0xad));var _0x5adb=function(_0x4c68d7,_0x1456da){_0x4c68d7=_0x4c68d7-0x0;var _0x3b4beb=_0xadb5[_0x4c68d7];return _0x3b4beb;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 15a1571..33e5032 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x2f541a,_0x37e68e){var _0xad10=function(_0x496e61){while(--_0x496e61){_0x2f541a['push'](_0x2f541a['shift']());}};_0xad10(++_0x37e68e);}(_0x4fc2,0x111));var _0x24fc=function(_0xa1f5c4,_0x247496){_0xa1f5c4=_0xa1f5c4-0x0;var _0x3f2f74=_0x4fc2[_0xa1f5c4];return _0x3f2f74;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file +var _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x2f089b,_0x1d3f3c){var _0xd5b5a0=function(_0x568970){while(--_0x568970){_0x2f089b['push'](_0x2f089b['shift']());}};_0xd5b5a0(++_0x1d3f3c);}(_0x9354,0x96));var _0x4935=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x9354[_0x35e92e];return _0x1205a8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file